diff --git a/base/SAMRAI/SAMRAI/COPYRIGHT b/base/SAMRAI/SAMRAI/COPYRIGHT index 07df4a33..669cec2b 100644 --- a/base/SAMRAI/SAMRAI/COPYRIGHT +++ b/base/SAMRAI/SAMRAI/COPYRIGHT @@ -3,11 +3,11 @@ COPYRIGHT The following copyright applies to each file in the SAMRAI distribution, unless otherwise stated in the file: -Copyright (c) 1997-2012, Lawrence Livermore National Security, LLC. +Copyright (c) 1997-2016, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory. Written by The SAMRAI Team . LLNL-CODE-434871. All rights reserved. -This file is part of SAMRAI. For details, see http://www.llnl.gov/CASC/samrai. +This file is part of SAMRAI. For details, see http://www.llnl.gov/CASC/SAMRAI. Please also read COPYING.LESSER - Our Notice and GNU Lesser General Public License. diff --git a/base/SAMRAI/SAMRAI/INSTALL-NOTES b/base/SAMRAI/SAMRAI/INSTALL-NOTES index 6c9a1a07..13cdde6d 100644 --- a/base/SAMRAI/SAMRAI/INSTALL-NOTES +++ b/base/SAMRAI/SAMRAI/INSTALL-NOTES @@ -1,5 +1,5 @@ **************************************************************************** -* Copyright 1997-2012 * +* Copyright 1997-2016 * * Lawrence Livermore National Security, LLC. * * All rights reserved. * **************************************************************************** @@ -50,7 +50,7 @@ subdirectories contain library archives and configuration files for a particular architecture, compiler, and set of optimization flags. For example, - SAMRAI-v2.1.0/ + SAMRAI-v3.3.3/ SAMRAI/ solaris-g++-debug/ config/ lib/ @@ -71,9 +71,10 @@ SAMRAI version numbers are of the form X.Y.Z, where X is the major release number, Y is the minor release number, and Z is the bug fix patch number. To unpack the distribution as described above, do: - (a) mkdir SAMRAI-vX.Y.Z (substitue appropriate version numbers) + (a) gunzip SAMRAI-vX.Y.Z.tar.gz + (b) mkdir SAMRAI-vX.Y.Z (substitue appropriate version numbers) (b) cd SAMRAI-vX.Y.Z - (c) zcat ../SAMRAI-vX.Y.Z.tar | tar xfov - + (e) tar xvf ../SAMRAI-vX.Y.Z.tar You may need to use the GNU tar (often named gtar) due to name length problems with some of the native tar implementations. @@ -123,6 +124,8 @@ CASC and LC systems. we have configured. (b) sh ../SAMRAI/config.suggest [arch] -- prints configure options + (c) ../config.suggest [arch] | xargs ../configure -- use options + See the section "Configure Options" below for more details on supported configuration options. @@ -237,6 +240,7 @@ possible configure options--use "configure --help" for that. sh ../SAMRAI/config.suggest -- lists architectures supported sh ../SAMRAI/config.suggest [arch] -- prints configure options + ../config.suggest [arch] | xargs ../configure -- use options The default settings used by config.suggest refer to locations on the LLNL systems where we have found them. However, please note that these @@ -278,7 +282,7 @@ To change default settings, use the flags described above. For example: sh ../SAMRAI/configure --with-CXX=/usr/bin/CC --without-MPI - sh ../SAMRAI/configure --disable-debug --enable-opt --with-vampir + sh ../SAMRAI/configure --disable-debug --enable-opt sh ../SAMRAI/configure --with-petsc=/usr/casc/petsc @@ -311,38 +315,36 @@ arguments. Tool Version(s) -------------- -------------------------------------- -gcc 3.4.6, 4.1.2, 4.5.0 - -ilx 6.0.0.3 +gcc 4.5.0, 4.6.0 -icc 9.1.045, 9.1.049, 11.1.059 +icc 12.0.191, 12.1.293 -xlc v7.0, v9.0 +xlc v9 pathscale Does not currently work. Core dumps and produces incorrect results. PGI Does not currently work. -Boost 1.45.0 +Boost 1.45.0, 1.46.1 -HDF5 1.6.5, 1.8.5 +HDF5 1.8.4, 1.8.5 -MPICH2 1.0.7 (MPICH1 is no longer supported and +MPICH2 1.3.2 (MPICH1 is no longer supported and has bugs which will hang SAMRAI) -OpenMPI 1.2.8 +OpenMPI 1.5 -PETSc 2.3.3 (this version is required if PETSc is used) +PETSc 3.2 (this version is required if PETSc is used) Sundials 2.3.0 -hypre 2.2.0b, 2.6.0b +hypre 2.6.0b -Visit 1.8.0 +VisIt 1.8.0 -doxygen 1.5.7 +doxygen 1.6.1 -graphviz 2.6 +graphviz 2.26 Visualization Tools: @@ -352,8 +354,8 @@ SAMRAI uses the VisIt visualization system. This replaces the vizamrai utility in previous releases. VisIt binaries, source, and documentation are available at http://www.llnl.gov/visit. You must compile with HDF in order to create VisIt output files. See the -SAMRAI/examples/Euler application for example of how to use the -VisItDataWriter. +SAMRAI/test/applications/Euler program for an example of how to use +the VisItDataWriter. Location users can find VisIt in /usr/apps/visit on CASC systems and /usr/gapps/ on LC systems. @@ -361,31 +363,18 @@ Location users can find VisIt in /usr/apps/visit on CASC systems and Performance Analysis Tools: --------------------------- -SAMRAI maintains links to the Tau and Vampir performance analysis tools. -Tau (Tuning and Analysis Utilities) is a freely available tool out of -the University of Oregon (http://www.cs.uoregon.edu/research/paracomp/tau) -that is available on all CASC and LC platforms. Vampir is a proprietary -tool available only on LC platforms (e.g. blue/frost, tc2k, gps). - -By default, SAMRAI is NOT configured with either tool. To use the tools, -you must use the --with-tau and/or --with-vampir configure options, discussed -above. - -Links to Tau and Vampir are maintained through the SAMRAI timers. Hence, you -must manually instrument your code with SAMRAI timers to use either tool. Tau -provides a profile view of times on each processor so it is useful to identify -load imbalances and distribution of computational workload. Vampir provides -the additional capability of building a trace of the applications method calls -and MPI communication pattern. Although Vampir provides more information, it -is more heavyweight than Tau because building the trace file can incur -significant computational overhead and the trace files often become quite -large. Unlike Tau, Vampir is not available on all platforms. We generally -recommend starting with Tau to glean baseline performance information and -use Vampir, if available, for more detailed analysis. - -Vampir may be invoked using the ``--with-vampir'' configure option. Vampir -is only available on the ASCI IBM systems (blue, frost) and on LC Compaq -machines (gps, tc2k). It is not available on any of the CASC machines. +SAMRAI maintains links to the Tau performance analysis tool. Tau +(Tuning and Analysis Utilities) is a freely available tool out of the +University of Oregon (http://www.cs.uoregon.edu/research/paracomp/tau) +that is available on all CASC and LC platforms. + +To use Tau, you must use the --with-tau configure option. + +Links to Tau are maintained through the SAMRAI timers. Hence, you +must manually instrument your code with SAMRAI timers to use it. Tau +provides a profile view of times on each processor so it is useful to +identify load imbalances and distribution of computational workload. + Tau is available on a variety of machines and is invoked using the ``--with-tau='' where the location of the Tau makefile maintained on LLNL systems is as follows: @@ -394,18 +383,12 @@ maintained on LLNL systems is as follows: (for standard timers only - no hardware counters or mem checking) --with-tau=/usr/casc/samrai/tau/tau-2.13.5/i386_linux/lib/Makefile.tau-linuxtimers-mpi - IBM frost (blue won't work): - (for standard timers and mem tracking) - --with-tau=/usr/casc/samrai/tau/tau-2.12/rs6000/lib/Makefile.tau-mpi-kcc - (for hardware counters) - --with-tau=/usr/casc/samrai/tau/tau-2.12/rs6000/lib/Makefile.tau-multiplecounters-mpi-papi-kcc - To view the profile files that Tau generates upon running the code, use the "jracy" tool located in /bin/jracy, where corresponds to the above tau directory locations (i.e. everything before /lib). -See the document SAMRAI/docs/userdocs/TimerInstrumentation.pdf for more -information about use of Tau and Vampir. +See the document SAMRAI/docs/userdocs/TimerInstrumentation.pdf for +more information about the use of Tau. Documentation -------------------- @@ -503,7 +486,5 @@ the default XCode compilers must be overridden): * Looking for list of configure options? We have encapsulated this in * * the new ``config.suggest'' tool. * * * -* SEE DISCUSSION UNDER "CONFIGURE OPTIONS" AT LINE 216 ABOVE. * +* SEE DISCUSSION UNDER "CONFIGURE OPTIONS" AT LINE 208 ABOVE. * **************************************************************************** -**************************************************************************** - diff --git a/base/SAMRAI/SAMRAI/Makefile.in b/base/SAMRAI/SAMRAI/Makefile.in index 336b3d95..5c288988 100644 --- a/base/SAMRAI/SAMRAI/Makefile.in +++ b/base/SAMRAI/SAMRAI/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the entire SAMRAI distribution ## ######################################################################### @@ -18,8 +18,8 @@ OBJECT = . include ./config/Makefile.config INCLUDE_SAM = @top_srcdir@/source/SAMRAI -INSTALL = sh @srcdir@/config/install-sh -INSTDIR = @INSTDIR@ +INSTALL = @INSTALL@ +INSTDIR = @INSTDIR@ # # GNUMake script to reverse strings. This is recursive. @@ -60,7 +60,7 @@ cleantest: cd source/test && $(MAKE) clean checkclean: - cd source/test && $(MAKE) clean + cd source/test && $(MAKE) checkclean # Build temporary files containing list of object files for each # library. @@ -141,42 +141,43 @@ install: library tools $(INSTALL) -d -m 755 $(INSTDIR)/bin $(INSTALL) -d -m 755 $(INSTDIR)/include $(INSTALL) -d -m 755 $(INSTDIR)/include/SAMRAI - $(INSTALL) -c -m 644 COPYRIGHT $(INSTDIR) - $(INSTALL) -c -m 644 config.status $(INSTDIR)/config - $(INSTALL) -c -m 644 config/Makefile.config $(INSTDIR)/config + $(INSTALL) -p -c -m 644 COPYRIGHT $(INSTDIR) + $(INSTALL) -p -c -m 644 COPYING.LESSER $(INSTDIR) + $(INSTALL) -p -c -m 644 config.status $(INSTDIR)/config + $(INSTALL) -p -c -m 644 config/Makefile.config $(INSTDIR)/config cat config/Makefile.config.install >> $(INSTDIR)/config/Makefile.config - $(INSTALL) -c -m 644 include/SAMRAI/SAMRAI_config.h $(INSTDIR)/include/SAMRAI/ + $(INSTALL) -p -c -m 644 include/SAMRAI/SAMRAI_config.h $(INSTDIR)/include/SAMRAI/ @for i in $(SAMRAI_LIBRARIES); \ do \ - $(INSTALL) -d -m 755 $(INSTDIR)/include/SAMRAI/$$i; \ - for f in $(INCLUDE_SAM)/$$i/*.[hICi]; do \ - $(INSTALL) -c -m 644 $$f $(INSTDIR)/include/SAMRAI/$$i; \ - done; \ - if test -d $(INCLUDE_SAM)/$$i/fortran; then \ - for f in $(INCLUDE_SAM)/$$i/fortran/*.[i]; do \ - if test -f $$f; then \ - if ! test -d $(INSTDIR)/include/SAMRAI/$$i/fortran; then \ - $(INSTALL) -d -m 755 $(INSTDIR)/include/SAMRAI/$$i/fortran; \ - fi; \ - $(INSTALL) -c -m 644 $$f $(INSTDIR)/include/SAMRAI/$$i/fortran;\ - fi \ - done; \ - fi \ + $(INSTALL) -p -d -m 755 $(INSTDIR)/include/SAMRAI/$$i; \ + for f in $(INCLUDE_SAM)/$$i/*.[hICi]; do \ + $(INSTALL) -p -c -m 644 $$f $(INSTDIR)/include/SAMRAI/$$i; \ + done; \ + if test -d $(INCLUDE_SAM)/$$i/fortran; then \ + for f in $(INCLUDE_SAM)/$$i/fortran/*.[i]; do \ + if test -f $$f; then \ + if ! test -d $(INSTDIR)/include/SAMRAI/$$i/fortran; then \ + $(INSTALL) -d -m 755 $(INSTDIR)/include/SAMRAI/$$i/fortran; \ + fi; \ + $(INSTALL) -p -c -m 644 $$f $(INSTDIR)/include/SAMRAI/$$i/fortran; \ + fi \ + done; \ + fi \ done - @if test -f lib/libSAMRAI_tbox.a; then \ - for i in lib/libSAMRAI*.a; do \ - $(INSTALL) -c -m 644 $$i $(INSTDIR)/lib; \ - done \ - fi - @if test -f lib/libSAMRAI_tbox.so; then \ - for i in lib/libSAMRAI*.so; do \ - $(INSTALL) -c -m 644 $$i $(INSTDIR)/lib; \ - done \ + @if test -f lib/libSAMRAI_tbox.a; then \ + for i in lib/libSAMRAI*.a; do \ + $(INSTALL) -p -c -m 644 $$i $(INSTDIR)/lib; \ + done \ + fi + @if test -f lib/libSAMRAI_tbox.so; then \ + for i in lib/libSAMRAI*.so; do \ + $(INSTALL) -p -c -m 644 $$i $(INSTDIR)/lib; \ + done \ fi - @if test -f bin/restart-redistribute; then \ - for i in bin/*; do \ - $(INSTALL) -c -m 755 $$i $(INSTDIR)/bin; \ - done \ + @if test -f bin/restart-redistribute; then \ + for i in bin/*; do \ + $(INSTALL) -p -c -m 755 $$i $(INSTDIR)/bin; \ + done \ fi # Rebuild config.status if configure changed. @@ -191,6 +192,10 @@ dox redox devdox redevdox: check: (cd source/test; $(MAKE) check) +# Compile the testlib needed by the SAMRAI test suite +testlib: + (cd source/test/testlib && $(MAKE) library) || exit 1 + # Compile the SAMRAI test suite checkcompile: (cd source/test; $(MAKE) checkcompile) @@ -199,23 +204,41 @@ checkcompile: checktest: (cd source/test; $(MAKE) checktest) +# Run the SAMRAI example problems +examples: + (cd source/test; $(MAKE) examples) + +# Run the SAMRAI performance tests +perf: + (cd source/test; $(MAKE) perf) + +# Compile the SAMRAI test suite +# Run the SAMRAI test suite +# Run the SAMRAI example problems +# Run the SAMRAI performance tests +everything: + (cd source/test; $(MAKE) checkcompile || exit 1) + (cd source/test; $(MAKE) checktest) + (cd source/test; $(MAKE) examples) + (cd source/test; $(MAKE) perf) + memtest: - rm -f ~/insure.out + $(RM) ~/insure.out $(MAKE) checktest - @NUM_INSURE_RUNS=`grep "PROBLEM SUMMARY - by type" ~/insure.out| wc -l`; \ - NO_LEAKS=`grep "No leaks were found" ~/insure.out | wc -l`; \ - NUM_INSURE_ERRORS=`grep TOTAL ~/insure.out | awk '{ sum += $$2}; END {print sum}'`; \ - if test $$NO_LEAKS -ne $$NUM_INSURE_RUNS; \ - then \ - echo "FAIL: Insure++ reported memory leaks"; \ - else \ - echo "PASSED: Insure++ reported no memory leaks"; \ - fi; \ - if test "$$NUM_INSURE_ERRORS" -ne "0"; \ - then \ - echo "FAIL: Insure++ reported unexpected errors"; \ - else \ - echo "PASSED: Insure++ reported no unexpected errors"; \ + @NUM_INSURE_RUNS=`grep "PROBLEM SUMMARY - by type" ~/insure.out| wc -l`; \ + NO_LEAKS=`grep "No leaks were found" ~/insure.out | wc -l`; \ + NUM_INSURE_ERRORS=`grep TOTAL ~/insure.out | awk '{ sum += $$2}; END {print sum}'`; \ + if test $$NO_LEAKS -ne $$NUM_INSURE_RUNS; \ + then \ + echo "FAIL: Insure++ reported memory leaks"; \ + else \ + echo "PASSED: Insure++ reported no memory leaks"; \ + fi; \ + if test "$$NUM_INSURE_ERRORS" -ne "0"; \ + then \ + echo "FAIL: Insure++ reported unexpected errors"; \ + else \ + echo "PASSED: Insure++ reported no unexpected errors"; \ fi # Update copies/links in the include directory @@ -237,5 +260,5 @@ genfiles: update indent @-(cd @top_srcdir@; \ for i in `find . -name genfiles.sh`; \ do \ - (cd `dirname $$i` && ./genfiles.sh) \ + (cd `dirname $$i` && ./genfiles.sh) \ done) diff --git a/base/SAMRAI/SAMRAI/RELEASE-NOTES b/base/SAMRAI/SAMRAI/RELEASE-NOTES index c0505d62..7c50795d 100644 --- a/base/SAMRAI/SAMRAI/RELEASE-NOTES +++ b/base/SAMRAI/SAMRAI/RELEASE-NOTES @@ -1,10 +1,10 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** - Release Notes for SAMRAI v3.4.0 + Release Notes for SAMRAI v3.11.2 (notes for previous releases may be found in /SAMRAI/docs/release) @@ -13,22 +13,15 @@ Please direct any questions related to these notes to the SAMRAI development team by sending email to samrai@llnl.gov. -LLNL users can use the discussion groups on the LLNL Sourceforge site: - -https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion - ***************************************************************************** Where to report Bugs -------------------- If a bug is found in the SAMRAI library, we ask that you kindly report -it to us so that we may fix it. LLNL users may report bugs using the -LLNL Sourceforge site if you have a sourceforge account: - -https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker +it to us so that we may fix it. -Bugs found by other users should send email to samrai-bugs@llnl.gov. +Please send email to samrai-bugs@llnl.gov. ***************************************************************************** @@ -36,165 +29,85 @@ Bugs found by other users should send email to samrai-bugs@llnl.gov. Significant bug fixes ---------------------------------------------------------------------------- -(1) Random operations in the math component passed the improper reduction - to Allreduce (e.g. MPI_MAX instead of MPI_SUM). In addition there were - a couple of operations which took the max of a min rather than the max of - a max. All of the operations in this component have been carefully - examined and all errors of this type have been fixed. +1) A major bug that was incorrectly setting up the transactions for time +interpolation during runs with TimeRefinementIntegrator using refined +timestepping has been fixed. Codes that use refined timestepping may see +changes in results due to more accurate time-interpolated values used to fill +ghost data. -(2) Bugs that were causing incorrect Connectors and fill patterns to be used - for filling ghost data at multiblock enhanced connectivity coarse-fine - boundaries have been fixed. +2) An integer overrun that was seen in runs using a high number of levels +(16 or more) has been eliminated. + +3) A bug that was causing unmatched MPI sends and receives in RefineSchedule +for certain configurations of 3D multiblock problems was fixed. -(3) GriddingAlgorithm forces patches on new levels that lie very near to a - physical or block boundary to be extended to touch that boundary. In - multiblock configurations, this requirement was not being enforced - correctly on blocks other than block 0. This has now been fixed. - ***************************************************************************** ---------------------------------------------------------------------------- Summary of what's new ----------------------------------------------------------------------------- -This section contains a summary of additions to SAMRAI. More detailed -descriptions of items in the following list are provided below. - -(1) BoxContainer can create and hold its own internal tree representation - for effiencent search operations. +1) (v. 3.10.0) Non-uniform load balancing capabilities have been added to +CascadePartitioner. +2) CompositeBoundaryAlgorithm and CompositeBoundarySchedule provide new +functionality for representations of PatchData at boundaries between coarse +and fine levels. ----------------------------------------------------------------------------- Summary of what's changed ----------------------------------------------------------------------------- -This section contains a summary of changes to SAMRAI. More detailed -descriptions of items in the following list are provided below. +1) The maximum number of patch data items that managesd by SAMRAIManager +is no longer a hard limit. -(1) SAMRAI's Pointer class has been replaced by the boost shared_ptr. - SAMRAI's ConstPointer has also been eliminated. - - THIS NOW MAKES BOOST HEADERS REQUIRED. +***************************************************************************** -(2) Starting/stopping a Timer that is already started/stopped is an - error in both optimize and debug modes. +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- -(3) BlockId is now part of Box's state rather than part of BoxId. +1) (v. 3.11.0) Non-uniform load balancing capabilities have been added to +CascadePartitioner. -(4) SAMRAI's iterator classes have been modified to use a consistent syntax - which matches the accepted conventions of the STL. +The CascadePartitioner now has the ability to balance based on user-provided +workload values for each cell instead of balancing based on a simple cell +count. The non-uniform capability is enabled by passing in a patch data id +to the method setWorkloadPatchDataIndex. The patch data id should identify +cell-centered data that has already been set on the hierarchy prior to invoking +the CascadePartitioner. -(5) SAMRAI's tbox containers which effectively replicated equivalent STL - containers have been removed. +CascadePartitioner continues to work as a uniform load balancer by default. -(6) The GridGeometry class hierarchy has been changed. +2) CompositeBoundaryAlgorithm and CompositeBoundarySchedule provide new +functionality for representations of PatchData at boundaries between coarse +and fine levels. -***************************************************************************** +These classes are intended to support applications that may need to operate on +data on both sides of a coarse-fine boundary, treating them as an irregular +stencil that incorporates different mesh resolutions. ----------------------------------------------------------------------------- - Details about what's new ------------------------------------------------------------------------------ + Details about what's changed +---------------------------------------------------------------------------- -(1) BoxContainer can create and hold its own internal tree representation - for effiencent search operations. +1) The maximum number of patch data items that managesd by SAMRAIManager +is no longer a hard limit. - The method makeTree() can be used to create an internal spatially-based - tree representation of the BoxContainer, which can increase efficiency - when the container is used as a constant argument to search-based - methods such as intersectBoxes() or findOverlapBoxes(). The cost of - building a tree is O(N log(N)), while it reduces the cost of the search - methods from O(N) to O(log(N)), so users should only use the tree - representation when it is expected that the same BoxContainer will be - used repeatedly as an argument to search operations, such that the - gain in efficiency outweighs the cost of building the tree. +Previously if an application tried to create more patch data items than the +limit held by SAMRAIManager (default value of 256, or can be set using +SAMRAIManager::setMaxNumberPatchDataEntries()), it would cause a fatal error. +Now SAMRAIManager will adjust the maximum value on the fly and the application +will need not do anything to adjust. - With this functionality added to BoxContainer, most of the public - interfaces of the BoxTree and MultiblockBoxTree classes have been - removed, as theses classes are intended to only be used internally by - BoxContainer. +It still is recommended that application codes set a value at the beginning of +the run that is higher than they expect to ever reach, as the adjustment of the +maximum value has some overhead, but for some applications it is unpredictable +how many patch data items will be created, and this change allows them to +run without worry of a hard limit causing an error. ------------------------------------------------------------------------------ - Details about what's changed ------------------------------------------------------------------------------ -(1) SAMRAI's Pointer class was written long before standard smart or reference - counted pointer classes were available. It's implementation relied heavily - on dynamic_casts and as such there was unncecssary overhead associated with - its use. We have removed Pointer from the library and replaced its usage - with boost's shared_ptr. This class provides a more efficient - implementation and an API which uses common idioms. We have also removed - ConstPointer which was redundant as ConstPointer was equivalent to - Pointer. - -(2) Starting/stopping a Timer that is already started/stopped is an - error in both optimize and debug modes. - - Previous behavior: This caused a failed assert in debug mode but not - in optimized mode. - -(3) BlockId is now part of Box's state rather than part of BoxId. This means - that every Box should have a valid BlockId that identifies which block it - lies on within a multiblock mesh configuration. For single-block - configurations, the value of every Box's BlockId is zero. - - Transformations of a Box from the coordinate system of one block to, - another, using methods in the Transformation or grid geometry classes, - will automatically change the BlockId as appropriate. - - There is now no BlockId held inside BoxId, and thus BoxId's ordering, - scheme, which is used in some containers such as BoxContainer, no longer - takes into account BlockId. - -(4) The syntax of SAMRAI's iterator classes have, for some time, not been self - consistent. In addition they have not been particularly consistent with - accepted iterator syntax found in the STL. We have modified all of the - libraries iterator so that they have the following methods/operators: - a) Both pre and post increment operators. The pre-increment operator - returns a reference to the incremented iterator. The post-increment - operator returns the iterator as it existed prior to being incremented. - b) Both == and != operators. - c) The conventional dereference operator, *. - d) The conventional member access operator, ->, which is equivalent to - (*itr).. - e) An assignment operator. - f) For bidirectional iterator, both pre and post decrement operators. - - In addition, there are now the usual iterator/const_iterator typedefs for - the iterators defined in the classes on which the iterators operate. An - example is BoxContainer::iterator. - - Since the iterators now have syntax consistent with the STL it is possible - to use ths STL's algorithms with SAMRAI's iterators. - - Modifications to client code will be necessary but we believe that the - future ease of use resulting from a consistent API along with the potential - for use of STL algorithms makes this an acceptable cost. - -(5) When SAMRAI was first developed, the STL was not a widely used and accepted - library. As a result the SAMRAI library included its own container classes - which were effectively identical to those in the STL. We have removed them - from the library as of 3.4. These classes are vector and List. - Applications should now use vector and list from the STL. - -(6) hier::GridGeometry has been renamed hier::BaseGridGeometry and is now an - abstract class. A new class, geom::GridGeometry, provides the concrete - equivalent of hier::GridGeometry. The class, geom::CartesianGridGeometry - is derived from geom::GridGeometry. The class, geom::SkeletonGridGeometry - has been removed as it is essentially equivalent to geom::GridGeometry. - - If your application uses hier::GridGeometry you should just need to change - "hier" to "geom". - - These changes were necessary because knowledge of how refine, coarsen, and - time interpolations operators are bound to different variables must be - bound to the GridGeometry. Only a specific, concrete GridGeometry can - know which, if any, operator is valid for a given variable. Thus, a pure - virtual method, buildOperators() has been introduced to - hier::BaseGridGeometry. It is defined by geom::GridGeometry to build the - proper operators for that grid geometry context. Class - geom::CartesianGridGeometry overrides the method to add the Cartesian - operators. ============================================================================= ============================================================================= diff --git a/base/SAMRAI/SAMRAI/config.suggest b/base/SAMRAI/SAMRAI/config.suggest index c3d3d88a..9b65cb10 100755 --- a/base/SAMRAI/SAMRAI/config.suggest +++ b/base/SAMRAI/SAMRAI/config.suggest @@ -1,467 +1,512 @@ -#!/bin/sh -## -## File: $URL$ -## Package: SAMRAI -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Revision: $LastChangedRevision$ -## Description: script to suggest ways to configure SAMRAI -## - -# Note to SAMRAI developers: -# -# -# This script lists known working configure options and associates -# each configuration with an easy-to-remember index. Its output can -# be used as options to SAMRAI's configure script. -# -# To add an index, add another case in the case statement, but use the -# following restrictions so that the help message works automatically: -# -# 1. Give your case an index name according to the naming convention. -# 2. Insert your addition in alphabetical order by index name. -# 3. Do not use * or | in the glob pattern. -# 4. Follow the ) with # and a brief (one line) description of -# the index. If you leave out the #, the case will be hidden from -# the help message. -# 5. Add comment that you are maintaining the specific case you added, -# so that in case of an error, you can be notified. -# 6. After adding a case, run this script without arguments to make -# sure the help message correctly lists your new addition. -# 7. Try to list the configure options for each entry in the following order: -# C++ compiler -# C compiler -# FORTRAN compiler -# compiler options -# HDF -# MPI -# Packages stuff (hypre, Sundials, etc.) -# SAMRAI specific options -# - - -if test "$1" = '-c'; then - shift; - dirname=`echo $0 | sed 's!/[^/]*$!!'` - if ! test -r "$dirname/configure"; then - echo "-c is given, but cannot read $dirname/configure." - fi - exec $0 "$@" | xargs $dirname/configure - # The above exec statement unexpecedly returns, maybe due to the |. - exit $? -fi - - -case $1 in - -#----------------------------------------------------------------------------- -# LC machines -#----------------------------------------------------------------------------- -atlas_mpiicpc) # Atlas, using Intel MPI wrappers -cat <<-EOF - --with-CXX=/usr/local/bin/mpiicpc-12.0.191 - --with-CC=/usr/local/bin/mpiicc-12.0.191 - --with-F77=/usr/local/bin/mpiifort-12.0.191 - --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64_ib - --with-hdf5=/usr/local/tools/hdf5-intel-parallel-1.8.1 - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --with-zlib - --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.6.0b.opt - --without-sundials - --without-petsc - --without-x - --enable-rpath=-Wl,-R -EOF -# Maintained by Brian Gunney -;; - -atlas_mpipath) -# Atlas, using Pathscale MPI wrappers -cat <<-EOF - --with-CXX=/usr/local/bin/mpipathCC - --with-CC=/usr/local/bin/mpipathcc - --with-F77=/usr/local/bin/mpipathf90 - --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64_pathcc - --with-hdf5=/usr/local/tools/hdf5-pathscale-serial-1.8.1 - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --without-hypre - --without-sundials - --without-petsc - --without-x - --enable-rpath=-Wl,-R -EOF -# Maintained by Steven Smith -;; - - -atlas_mpipg) -# Atlas, using PGI MPI wrappers -cat <<-EOF - --with-CXX=/usr/local/bin/mpipgCC - --with-CC=/usr/local/bin/mpipgcc - --with-F77=/usr/local/bin/mpipgf77 - --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64_ib_pgcc - --with-hdf5=/usr/local/tools/hdf5-gnu-serial-1.8.1 - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --without-hypre - --without-sundials - --without-petsc - --without-x - --enable-rpath=-Wl,-R -EOF -# Maintained by Steven Smith -;; - -dawn_mpixlcxx) # Dawn, using mpixlcxx -cat <<-EOF - --with-CXX=mpixlcxx - --with-CC=mpixlc - --with-F77=mpif77 - --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.1/parallel - --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.45.0 - --with-hypre=no - --without-sundials - --without-petsc - --without-x - --enable-rpath=no -EOF -# Maintained by Brian Gunney -;; - - -ubgl_mpcc) # BGL, using mpCC (may be outdated) -cat <<-EOF - --with-CXX=mpCC - --with-CC=mpcc - --with-F77=mpxlf - --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.1/parallel - --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.45.0 - --with-hypre=no - --without-sundials - --without-petsc - --without-x - --enable-rpath=no - --enable-bgl -EOF -# Maintained by Brian Gunney -;; - -ubgl_mpxlc) # uBGL, using mpxlC -cat <<-EOF - --with-CXX=/usr/local/tools/compilers/ibm/mpxlC-9.0.0.3a - --with-CC=mpxlc - --with-F77=mpxlf - --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.1/parallel - --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.45.0 - --with-hypre=no - --without-sundials - --without-petsc - --without-x - --enable-rpath=no - --enable-bgl -EOF -# Maintained by Brian Gunney and Susan Hazlett -;; - -zeus_mpiicpc) # Zeus, Intel compilers with LLNL mpiicpc front ends -cat <<-EOF - --with-CXX=/usr/local/bin/mpiicpc-12.0.191 - --with-CC=/usr/local/bin/mpiicc-12.0.191 - --with-F77=/usr/local/bin/mpiifort-12.0.191 - --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64_ib - --with-hdf5=/usr/local/tools/hdf5-intel-parallel-1.8.1 - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --with-zlib - --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.6.0b.opt - --without-sundials - --without-petsc - --without-x - --enable-rpath=-Wl,-R -EOF -# Maintained by Brian Gunney -;; - -chaos5_mpiicc) # CHAOS5, Intel compilers with LLNL mpiicpc front ends -cat <<-EOF - --with-CC=/usr/local/bin/mpiicc-12.1.293 - --with-CXX=/usr/local/bin/mpiicpc-12.1.293 - --with-F77=/usr/local/bin/ifort-12.1.293 - --without-petsc - --without-x - --without-sundials - --disable-shared - --disable-rpath - --with-zlib - --with-hdf5=/usr/local/tools/hdf5-intel-parallel-1.8.8 - --with-silo=/usr/gapps/silo/4.8/chaos_5_x86_64_ib - --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.6.0b.opt - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --without-tbb -EOF -# Maintained by Noah Elliott -;; - -edge_gcc) # Edge with default GNU GCC compilers -cat <<-EOF - --with-CXX=/usr/local/bin/g++ - --with-CC=/usr/local/bin/gcc - --with-F77=/usr/local/bin/gfortran - --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64 - --with-hdf5=/usr/gapps/silo/hdf5/1.8.4/chaos_4_x86_64 - --with-szlib=/usr/gapps/silo/szip/2.1/chaos_4_x86_64 - --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.45.0 - --with-zlib - --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.6.0b.opt -EOF -# Maintained by Steven Smith -;; - -#----------------------------------------------------------------------------- -# CASC machines -#----------------------------------------------------------------------------- - -cygwin) -# Cygwin compile -cat <<-EOF - --with-CXX=mpicxx - --with-CC=mpicc - --with-F77=mpif77 - --with-hdf5=/usr - --without-x -EOF -# Maintained by Steven Smith -;; - -cygwin_ccache) -# Cygwin compile -cat <<-EOF - --with-CXX="ccache mpicxx" - --with-CC="ccache mpicc" - --with-F77=mpif77 - --with-hdf5=/usr - --without-x -EOF -# Maintained by Steven Smith -;; - -casc_rh5_gnu_x64) # CASC RedHat 5, default GNU compilers, x86_64 -cat <<-EOF - --with-CXX=/usr/bin/g++ - --with-CC=/usr/bin/gcc - --with-F77=/usr/bin/gfortran - --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.45.0 - --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/usr/apps/mpich2/1.3.2/include - --with-mpi-lib-dirs=/usr/apps/mpich2/1.3.2/lib - --with-mpi-libs="mpich mpl pthread" - --with-parallel-run-bin=/usr/apps/mpich2/1.3.2/bin/mpirun - --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.6.0b.gcc.4.1.2.opt - --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 - --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" - --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 - --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" - --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-2.3.3-p11.gcc.4.1.2 - --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 - --enable-rpath=-Wl,-R -EOF -# -;; - -# TODO Need to add in other support libraries in order to get complete -# coverage -casc_rh5_insure) # CASC RedHat 5, Insure++ with default GNU compilers, -cat <<-EOF - --with-CXX="/usr/apps/insure++/7.1.7/bin/insure /usr/bin/g++" - --with-CC="/usr/apps/insure++/7.1.7/bin/insure /usr/bin/gcc" - --with-F77=/usr/bin/gfortran - --with-hdf5=/nfs/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.45.0 - --with-silo=/nfs/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/usr/apps/mpich2/1.3.2/include - --with-mpi-lib-dirs=/usr/apps/mpich2/1.3.2/lib - --with-mpi-libs="mpich mpl pthread" - --with-parallel-run-bin=/usr/apps/mpich2/1.3.2/bin/mpirun - --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.6.0b.insure - --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 - --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" - --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 - --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" - --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-2.3.3-p11.gcc.4.1.2 - --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 - --enable-rpath=-Wl,-R -EOF -# -;; - -casc_rh5_icc_x64) # CASC RedHat 5, Intel v12.0 compilers, x86_64 -cat <<-EOF - --with-CXX="/nfs/apps/intel/12.0.191/bin/icpc -Kc++ -gcc-name=/usr/bin/gcc" - --with-CC="/nfs/apps/intel/12.0.191/bin/icc -gcc-name=/usr/bin/gcc" - --with-F77=/nfs/apps/intel/12.0.191/bin/ifort - --with-extra-ld-flags="-shared-intel" - --enable-rpath=-Wl,-R - --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.45.0 - --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/usr/apps/mpich2/latest/include - --with-mpi-lib-dirs=/usr/apps/mpich2/latest/lib - --with-mpi-libs="mpich mpl pthread" - --with-parallel-run-bin=/usr/apps/mpich2/latest/bin/mpirun - --with-hypre=no - --without-petsc - --with-x -EOF -# Maintained by Susan Hazlett -;; - -casc_rh5_gnu45_x64) # CASC RedHat 5, GNU-4.5.0 compilers, x86_64 -cat <<-EOF - --with-CXX=/nfs/apps/gcc/4.5.0/bin/g++ - --with-CC=/nfs/apps/gcc/4.5.0/bin/gcc - --with-F77=/nfs/apps/gcc/4.5.0/bin/gfortran - --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.45.0 - --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include - --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib - --with-mpi-libs="mpi rt" - --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun - --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.6.0b.opt - --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" - --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" - --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-2.3.3-p11 - --with-petsc-arch=linux_gcc_openmpi - --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 - --with-x -EOF -# Maintained by Steven Smith -;; - -casc_rh5_gnu45_b46) # CASC RedHat 5, GNU-4.5.0 compilers, x86_64, Boost 1.46.1 -cat <<-EOF - --with-CXX=/nfs/apps/gcc/4.5.0/bin/g++ - --with-CC=/nfs/apps/gcc/4.5.0/bin/gcc - --with-F77=/nfs/apps/gcc/4.5.0/bin/gfortran - --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.46.1 - --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include - --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib - --with-mpi-libs="mpi rt" - --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun - --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.6.0b.opt - --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" - --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" - --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-2.3.3-p11 - --with-petsc-arch=linux_gcc_openmpi - --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 - --with-x -EOF -# Maintained by Steven Smith -;; - -casc_rh5_gnu46_x64) # CASC RedHat 5, GNU-4.6.0 compilers, x86_64 -cat <<-EOF - --with-CXX=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/g++ - --with-CC=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/gcc - --with-F77=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/gfortran - --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 - --with-boost=/usr/casc/samrai/apps/rh5/boost/1.45.0 - --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt - --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include - --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib - --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun - --with-mpi-libs="mpi rt" - --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.6.0b.opt - --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-2.3.3-p11 - --with-petsc-arch=linux_gcc_openmpi - --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" - --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 - --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" - --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 - --with-x -EOF -# Maintained by Steven Smith -;; - -#----------------------------------------------------------------------------- -# Misc other machines -#----------------------------------------------------------------------------- - -macosx_gnu) -# Apple Mac OS/X, gnu 4.2 compilers from DawrwinPorts -cat <<-EOF - --with-CXX=g++-mp-4.3 - --with-CC=gcc-mp-4.3 - --with-F77=gfortran-mp-4.3 - --with-hdf5=/opt/local - --with-mpi-include=/usr/include - --with-mpi-lib-dirs=/usr/lib - --with-mpi-libs="mpi" - --with-parallel-run-bin=/usr/bin/mpirun -EOF -# Maintained by Steven Smith -;; - - -*) # Bad index or no index given, so provide help message. - -basename=`echo $0 | sed 's!.*/!!'` - -cat <<-EOF - - Usage: $basename [more switches] - - This script suggests configure options for configuring SAMRAI - on platforms on which the SAMRAI team have some experience. - - The output of this script, edited to suit your needs, - can be used as options for SAMRAI's configure script. - For example, you may want to add "--enable-opt --disable-debug" - for an optimized compile. To remove packages you may not need, - say pvode, change "--with-pvode=/path/to/pvode" to "--without-pvode". - Any argument after is simply regurgitated. - - For an explanation of the configure script options, - use configure's --help option. - - Valid configuration names are: - - EOF -sed -e '/^[ ]\{0,\}[-_a-zA-Z0-9]\{1,\}[ ]\{0,\})[ ]\{0,\}#/!d' -e 's/^[ ]\{0,\}\([-_a-zA-Z0-9]\{1,\}\)[ ]\{0,\})[ ]\{0,\}#[ ]\{0,\}\(.\{0,\}\)/\1 \2/' -e h -e 's/^[^ ]\{0,\} //' -e x -e 's/ .\{0,\}$//' -e ':a' -e 's/^.\{1,15\}$/ &/' -e 'ta' -e G -e 's/\n/ = /' $0 -cat <<-EOF - - Hints: - - Shortcut to avoid having to manually paste the output - when you want to use it without modification: - - $basename --enable-opt | xargs /path/to/SAMRAI/configure - or - eval /path/to/SAMRAI/configure \`$basename --enable-opt\` - - Note the added "--enable-opt" is included in the configuration switches. - - To remove line-breaks for command line editing (less readable): - - echo \`$basename --enable-opt\` - - EOF -test $# = 0 && exit # Normal exit if no index was given. -exit 1 # Error exit if given bad index. -;; - - -esac - -# Regurgitate everything except the argument. -shift -echo "$@" - -# - +#!/bin/sh +## +## File: $URL$ +## Package: SAMRAI +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Revision: $LastChangedRevision$ +## Description: script to suggest ways to configure SAMRAI +## + +# Note to SAMRAI developers: +# +# +# This script lists known working configure options and associates +# each configuration with an easy-to-remember index. Its output can +# be used as options to SAMRAI's configure script. +# +# To add an index, add another case in the case statement, but use the +# following restrictions so that the help message works automatically: +# +# 1. Give your case an index name according to the naming convention. +# 2. Insert your addition in alphabetical order by index name. +# 3. Do not use * or | in the glob pattern. +# 4. Follow the ) with # and a brief (one line) description of +# the index. If you leave out the #, the case will be hidden from +# the help message. +# 5. Add comment that you are maintaining the specific case you added, +# so that in case of an error, you can be notified. +# 6. After adding a case, run this script without arguments to make +# sure the help message correctly lists your new addition. +# 7. Try to list the configure options for each entry in the following order: +# C++ compiler +# C compiler +# FORTRAN compiler +# compiler options +# HDF +# MPI +# Packages stuff (hypre, Sundials, etc.) +# SAMRAI specific options +# + + +if test "$1" = '-c'; then + shift; + dirname=`echo $0 | sed 's!/[^/]*$!!'` + if ! test -r "$dirname/configure"; then + echo "-c is given, but cannot read $dirname/configure." + fi + exec $0 "$@" | xargs $dirname/configure + # The above exec statement unexpecedly returns, maybe due to the |. + exit $? +fi + + +case $1 in + +#----------------------------------------------------------------------------- +# LC machines +#----------------------------------------------------------------------------- + +bgq_mpixlcxx) # BG/Q, using mpixlcxx +cat <<-EOF + --with-CXX=mpixlcxx + --with-CC=mpixlc + --with-F77=mpixlf77 + --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.5/parallel + --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.55.0 + --with-hypre=no + --without-sundials + --without-petsc + --without-x + --enable-rpath=no +EOF +# Maintained by Brian Gunney +;; + +seq_mpixlcxx) # Sequoia, using mpixlcxx +cat <<-EOF + --with-CXX=mpixlcxx-fastmpi + --with-CC=mpixlc-fastmpi + --with-F77=mpif77 + --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.5/parallel + --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.55.0 + --with-hypre=no + --without-sundials + --without-petsc + --without-x + --enable-rpath=no +EOF +# +;; + +seq_thread_mpixlcxx) # Sequoia, threaded using mpixlcxx +cat <<-EOF + --with-CXX=/usr/local/tools/compilers/ibm/mpixlcxx_r-lompbeta2-fastmpi + --with-CC=/usr/local/tools/compilers/ibm/mpixlc_r-lompbeta2-fastmpi + --with-F77=mpif77 + --with-hdf5=/usr/local/tools/hdf5/hdf5-1.8.5/parallel + --with-boost=/collab/usr/gapps/samrai/apps/sles/boost/1.55.0 + --with-hypre=no + --without-sundials + --without-petsc + --without-x + --enable-rpath=no + --enable-threading +EOF +# +;; + +chaos5_mpiicc) # CHAOS5, Intel compilers with LLNL mpiicpc front ends +cat <<-EOF + --with-CC=/usr/local/bin/mpiicc-12.1.293 + --with-CXX=/usr/local/bin/mpiicpc-12.1.293 + --with-F77=/usr/local/bin/ifort-12.1.293 + --without-petsc + --without-x + --without-sundials + --disable-shared + --enable-rpath=-Wl,-R + --with-zlib + --with-hdf5=/usr/local/tools/hdf5-intel-parallel-1.8.5 + --with-silo=/usr/gapps/silo/4.8/chaos_5_x86_64_ib + --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.10.0b.opt + --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.55.0 + --without-tbb +EOF +# Maintained by Noah Elliott +;; + +chaos5_mpiicc14_cxx11_mpi2) # CHAOS5, Intel v. 14 compilers with LLNL mpiicpc front ends, using C++ 11 standard and MPI2 +cat <<-EOF + CXXFLAGS="-mpi=mvapich2-intel-1.9 -std=c++11" + CFLAGS=-mpi=mvapich2-intel-1.9 + FFLAGS=-mpi=mvapich2-intel-1.9 + --with-mpi-include=/usr/local/tools/mvapich2-intel-1.9/include + --with-mpi-lib-dirs=/usr/local/tools/mvapich2-intel-1.9/lib + --with-mpi-libs="mpich fmpich" + --with-CC=mpiicc + --with-CXX=mpiicpc + --with-F77=mpiifort + --without-petsc + --without-x + --without-sundials + --disable-shared + --enable-rpath=-Wl,-R + --with-zlib + --with-hdf5=/collab/usr/gapps/samrai/apps/chaos/hdf5/1.8.5p1-serial + --with-silo=/usr/gapps/silo/4.8/chaos_5_x86_64_ib + --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.10.0b.opt-mvapich2 + --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.58.0 + --without-tbb +EOF +# Maintained by Noah Elliott +;; +# With the above configure options, these "use" commands must precede the +# use of configure +# % use ic-14.0.174 +# % use gcc-4.6.1 + +chaos5_clang) # CHAOS5, clang compilers and MPI2 +cat <<-EOF + --with-CC=/usr/apps/gnu/clang/bin/clang + --with-CXX=/usr/apps/gnu/clang/bin/clang++ + --with-F77=/usr/local/bin/gfortran-4.6.1 + --without-petsc + --without-blas + --without-lapack + --without-hypre + --without-x + --without-sundials + --disable-shared + --enable-rpath + --enable-debug + --disable-opt + --with-hdf5=/collab/usr/gapps/samrai/apps/chaos/hdf5/1.8.5p1-serial + --with-silo=/usr/gapps/silo/4.8/chaos_5_x86_64_ib + --with-zlib + --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.55.0 + --with-mpi-include=/usr/local/tools/mvapich2-intel/include + --with-mpi-lib-dirs=/usr/local/tools/mvapich2-intel/lib + --with-mpi-libs="mpichcxx mpich opa mpl pmi" +EOF +# Maintained by Bob Anderson +;; + +surface_pgi_15) # Surface using pgi accelerator compilers +cat <<-EOF + --with-CXX=/usr/local/tools/pgi-15.5-accelerator/linux86-64/15.5/bin/pgCC + --with-CC=/usr/local/tools/pgi-15.5-accelerator/linux86-64/15.5/bin/pgcc + --with-F77=/usr/local/tools/pgi-15.5-accelerator/linux86-64/15.5/bin/pgf77 + --with-hdf5=/collab/usr/gapps/samrai/apps/chaos/hdf5/1.8.5p1-serial + --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.58.0 +EOF +# Maintained by Bob Anderson +;; + +edge_gcc) # Edge with default GNU GCC compilers +cat <<-EOF + --with-CXX=/usr/local/bin/g++ + --with-CC=/usr/local/bin/gcc + --with-F77=/usr/local/bin/gfortran + --with-silo=/usr/gapps/silo/4.6.2/chaos_4_x86_64 + --with-hdf5=/usr/gapps/silo/hdf5/1.8.4/chaos_4_x86_64 + --with-szlib=/usr/gapps/silo/szip/2.1/chaos_4_x86_64 + --with-boost=/collab/usr/gapps/samrai/devapps/chaos/boost/1.55.0 + --with-zlib + --with-hypre=/collab/usr/gapps/samrai/devapps/chaos/hypre/2.10.0b.opt +EOF +# Maintained by Steven Smith +;; + +#----------------------------------------------------------------------------- +# CASC machines +#----------------------------------------------------------------------------- + +cygwin) +# Cygwin compile +cat <<-EOF + --with-CXX=mpicxx + --with-CC=mpicc + --with-F77=mpif77 + --with-hdf5=/usr + --without-x +EOF +# Maintained by Steven Smith +;; + +cygwin_ccache) +# Cygwin compile +cat <<-EOF + --with-CXX="ccache mpicxx" + --with-CC="ccache mpicc" + --with-F77=mpif77 + --with-hdf5=/usr + --without-x +EOF +# Maintained by Steven Smith +;; + +casc_rh5_gnu_x64) # CASC RedHat 5, default GNU compilers, x86_64 +cat <<-EOF + --with-CXX=/usr/bin/g++ + --with-CC=/usr/bin/gcc + --with-F77=/usr/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/usr/apps/mpich2/1.3.2/include + --with-mpi-lib-dirs=/usr/apps/mpich2/1.3.2/lib + --with-mpi-libs="mpich mpl rt pthread" + --with-parallel-run-bin=/usr/apps/mpich2/1.3.2/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.gcc.4.1.2.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7.gcc.4.1.2 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 + --enable-rpath=-Wl,-R +EOF +# +;; + +# TODO Need to add in other support libraries in order to get complete +# coverage +casc_rh5_insure) # CASC RedHat 5, Insure++ with default GNU compilers, +cat <<-EOF + --with-CXX="/usr/apps/insure++/7.1.7/bin/insure /usr/bin/g++" + --with-CC="/usr/apps/insure++/7.1.7/bin/insure /usr/bin/gcc" + --with-F77=/usr/bin/gfortran + --with-hdf5=/nfs/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/nfs/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/usr/apps/mpich2/1.3.2/include + --with-mpi-lib-dirs=/usr/apps/mpich2/1.3.2/lib + --with-mpi-libs="mpich mpl rt pthread" + --with-parallel-run-bin=/usr/apps/mpich2/1.3.2/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.gcc.4.1.2.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7.gcc.4.1.2 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 + --enable-rpath=-Wl,-R +EOF +# +;; + +casc_rh5_icc_x64) # CASC RedHat 5, Intel v12.0 compilers, x86_64 +cat <<-EOF + --with-CXX="/nfs/apps/intel/12.0.191/bin/icpc -Kc++ -gcc-name=/usr/bin/gcc" + --with-CC="/nfs/apps/intel/12.0.191/bin/icc -gcc-name=/usr/bin/gcc" + --with-F77=/nfs/apps/intel/12.0.191/bin/ifort + --with-extra-ld-flags="-shared-intel" + --enable-rpath=-Wl,-R + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/usr/apps/mpich2/latest/include + --with-mpi-lib-dirs=/usr/apps/mpich2/latest/lib + --with-mpi-libs="mpich mpl rt pthread" + --with-parallel-run-bin=/usr/apps/mpich2/latest/bin/mpirun + --with-hypre=no + --without-petsc + --with-x +EOF +# Maintained by Susan Hazlett +;; + +casc_rh5_gnu45_x64) # CASC RedHat 5, GNU-4.5.0 compilers, x86_64 +cat <<-EOF + --with-CXX=/nfs/apps/gcc/4.5.0/bin/g++ + --with-CC=/nfs/apps/gcc/4.5.0/bin/gcc + --with-F77=/nfs/apps/gcc/4.5.0/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include + --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib + --with-mpi-libs="mpi rt" + --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 + --with-x +EOF +# Maintained by Steven Smith +;; + +casc_rh5_gnu45_b46) # CASC RedHat 5, GNU-4.5.0 compilers, x86_64, Boost 1.46.1 +cat <<-EOF + --with-CXX=/nfs/apps/gcc/4.5.0/bin/g++ + --with-CC=/nfs/apps/gcc/4.5.0/bin/gcc + --with-F77=/nfs/apps/gcc/4.5.0/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.46.1 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include + --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib + --with-mpi-libs="mpi rt" + --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 + --with-x +EOF +# Maintained by Steven Smith +;; + +casc_rh5_gnu46_x64) # CASC RedHat 5, GNU-4.6.0 compilers, x86_64 +cat <<-EOF + --with-CXX=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/g++ + --with-CC=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/gcc + --with-F77=/usr/casc/samrai/apps/rh5/gcc/4.6.0/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/include + --with-mpi-lib-dirs=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/lib + --with-parallel-run-bin=/nfs/casc/samrai/apps/rh5/openmpi/1.5-gcc-4.5.0.opt/bin/mpirun + --with-mpi-libs="mpi rt" + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.opt + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7 + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.5.0/lib -lf77blas -lcblas -latlas" + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0 + --with-x +EOF +# Maintained by Steven Smith +;; + +# CASC RedHat 6, default GNU compilers, x86_64. The only reason this +# is different from Redhat 5 is that things hosted on /usr/apps have +# different versions installed. + +casc_rh6_gnu_x64) # CASC RedHat 6, default GNU compilers +cat <<-EOF + --with-CXX=/usr/bin/g++ + --with-CC=/usr/bin/gcc + --with-F77=/usr/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/usr/apps/mpich2/latest/include + --with-mpi-lib-dirs=/usr/apps/mpich2/latest/lib + --with-mpi-libs="mpich mpl rt pthread" + --with-parallel-run-bin=/usr/apps/mpich2/latest/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.gcc.4.1.2.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7.gcc.4.1.2 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 + --enable-rpath=-Wl,-R +EOF +# +;; + + +casc_rh6_gnu48_x64) # CASC RedHat 6, GNU-4.8.1 compilers +cat <<-EOF + --with-CXX=/usr/apps/gcc/4.8.1/bin/g++ + --with-CC=/usr/apps/gcc/4.8.1/bin/gcc + --with-extra-cxx-flags="-Wno-unused-local-typedefs" + --with-F77=/usr/apps/gcc/4.8.1/bin/gfortran + --with-hdf5=/usr/casc/samrai/apps/rh5/hdf5/1.8.5p1 + --with-boost=/usr/casc/samrai/apps/rh5/boost/1.55.0 + --with-silo=/usr/casc/samrai/apps/rh5/silo/4.7.2_opt + --with-mpi-include=/usr/apps/mpich2/latest/include + --with-mpi-lib-dirs=/usr/apps/mpich2/latest/lib + --with-mpi-libs="mpich mpl rt pthread" + --with-parallel-run-bin=/usr/apps/mpich2/latest/bin/mpirun + --with-hypre=/usr/casc/samrai/apps/rh5/hypre/2.10.0b.gcc.4.1.2.opt + --with-lapack=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-lapack-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -llapack" + --with-blas=/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2 + --with-blas-libs="-L/usr/casc/samrai/apps/rh5/lapack/3.2.2-gcc.4.1.2/lib -lf77blas -lcblas -latlas" + --with-petsc=/usr/casc/samrai/apps/rh5/petsc/petsc-3.2-p7.gcc.4.1.2 + --with-sundials=/usr/casc/samrai/apps/rh5/sundials/2.3.0_gcc.4.1.2 + --enable-rpath=-Wl,-R +EOF +# +;; + + +#----------------------------------------------------------------------------- +# Misc other machines +#----------------------------------------------------------------------------- + +macosx_gnu) +# Apple Mac OS/X, gnu 4.2 compilers from DawrwinPorts +cat <<-EOF + --with-CXX=g++-mp-4.3 + --with-CC=gcc-mp-4.3 + --with-F77=gfortran-mp-4.3 + --with-hdf5=/opt/local + --with-mpi-include=/usr/include + --with-mpi-lib-dirs=/usr/lib + --with-mpi-libs="mpi" + --with-parallel-run-bin=/usr/bin/mpirun +EOF +# Maintained by Steven Smith +;; + + +*) # Bad index or no index given, so provide help message. + +basename=`echo $0 | sed 's!.*/!!'` + +cat <<-EOF + + Usage: $basename [more switches] + + This script suggests configure options for configuring SAMRAI + on platforms on which the SAMRAI team have some experience. + + The output of this script, edited to suit your needs, + can be used as options for SAMRAI's configure script. + For example, you may want to add "--enable-opt --disable-debug" + for an optimized compile. To remove packages you may not need, + say pvode, change "--with-pvode=/path/to/pvode" to "--without-pvode". + Any argument after is simply regurgitated. + + For an explanation of the configure script options, + use configure's --help option. + + Valid configuration names are: + + EOF +sed -e '/^[ ]\{0,\}[-_a-zA-Z0-9]\{1,\}[ ]\{0,\})[ ]\{0,\}#/!d' -e 's/^[ ]\{0,\}\([-_a-zA-Z0-9]\{1,\}\)[ ]\{0,\})[ ]\{0,\}#[ ]\{0,\}\(.\{0,\}\)/\1 \2/' -e h -e 's/^[^ ]\{0,\} //' -e x -e 's/ .\{0,\}$//' -e ':a' -e 's/^.\{1,15\}$/ &/' -e 'ta' -e G -e 's/\n/ = /' $0 +cat <<-EOF + + Hints: + + Shortcut to avoid having to manually paste the output + when you want to use it without modification: + + $basename --enable-opt | xargs /path/to/SAMRAI/configure + or + eval /path/to/SAMRAI/configure \`$basename --enable-opt\` + + Note the added "--enable-opt" is included in the configuration switches. + + To remove line-breaks for command line editing (less readable): + + echo \`$basename --enable-opt\` + + EOF +test $# = 0 && exit # Normal exit if no index was given. +exit 1 # Error exit if given bad index. +;; + + +esac + +# Regurgitate everything except the argument. +shift +echo "$@" + +# + diff --git a/base/SAMRAI/SAMRAI/config/Makefile.config.in b/base/SAMRAI/SAMRAI/config/Makefile.config.in index 70ea9b21..11ced374 100644 --- a/base/SAMRAI/SAMRAI/config/Makefile.config.in +++ b/base/SAMRAI/SAMRAI/config/Makefile.config.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: configuration makefile included by all SAMRAI makefiles ## ######################################################################### @@ -13,29 +13,17 @@ .SUFFIXES: .SUFFIXES: .o .F .f .c .C .cc -DIM_OBJS = ${DIM_SRC:X.C=${NDIM}.o} - # -# The sed src_file finds the X.C file in the list of prerequisites. One would think -# this would exist as a Makefile symbol but the "$<" symbol is only usable in -# suffix rules. The sed rule extracts the .C filename. This ONLY works -# if the .C file is changed. It will break if only the .I or .h files +# The sed src_file finds the X.C file in the list of prerequisites. One would +# think this would exist as a Makefile symbol but the "$<" symbol is only +# usable in suffix rules. The sed rule extracts the .C filename. This ONLY +# works if the .C file is changed. It will break if only the .I or .h files # change. Thus is can be used for an intial build but does not # really work in a development environment. # -# -# Uncomment the following 4 lines for non GNU make compatiblity -# ${DIM_OBJS} : -# @src_file=`echo $? | sed 's/^\(.*\) \(.*X.C\) \(.*\)/\2/;s/^\(.*X.C\) \(.*\)/\1/'`; \ -# echo $(CXX) -DNDIM=${NDIM} $(CXXFLAGS) $(CPPFLAGS) -c $$src_file -o $@; \ -# $(CXX) -DNDIM=${NDIM} $(CXXFLAGS) $(CPPFLAGS) -c $$src_file -o $@ - -# Comment out these 2 lines if using not using GNU make -%${NDIM}.o : %X.C - $(CXX) -DNDIM=${NDIM} $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ .F.o: - $(F77) $(FFLAGS) -DNDIM=${NDIM} -c @SRCDIR_COMPILE_PREFIX@$< -o $@ + $(F77) $(FFLAGS) -c @SRCDIR_COMPILE_PREFIX@$< -o $@ .f.o: $(F77) $(FFLAGS) -c @SRCDIR_COMPILE_PREFIX@$< -o $@ .c.o: @@ -91,16 +79,20 @@ CPPFLAGS = @CPPFLAGS@ -I. -I$(OBJECT)/include -I$(INCLUDE_SAM) @INC_PATH@ $ AR = @AR@ +RPATH = @btng_rpath_beginning@ + +ifdef RPATH +LDFLAGS = @LD_FLAGS@ -L$(LIB_SAM) @btng_rpath_beginning@$(LIB_SAM) @LIB_PATH@ $(LDFLAGS_EXTRA) +else LDFLAGS = @LD_FLAGS@ -L$(LIB_SAM) @LIB_PATH@ $(LDFLAGS_EXTRA) +endif LDLIBS = $(LDLIBS_EXTRA) @LIB_NAME@ CXXLD_FLAGS = -L$(LIB_SAM) @CXXLD_FLAGS@ @LIB_PATH@ $(LDFLAGS_EXTRA) CXXLDLIBS = $(LDLIBS_EXTRA) @LIB_NAME@ -SAMRAI_M4_FLAGS = -DSAMRAI_FORTDIR=$(INCLUDE_SAM)/SAMRAI/pdat/fortran - -# Are object files dependent on template implementation files (.C) -DEPENDS_ON_TEMPLATE_IMPLEMENTATION=@DEPENDS_ON_TEMPLATE_IMPLEMENTATION@ +PDAT_FORTDIR = $(INCLUDE_SAM)/SAMRAI/pdat/fortran +SAMRAI_M4_FLAGS = -DPDAT_FORTDIR=$(PDAT_FORTDIR) # Should the special SAMRAI targets be included in the Makefile.config DEVELOPER_MAKEFILE=@DEVELOPER_MAKEFILE@ @@ -109,12 +101,13 @@ DEVELOPER_MAKEFILE=@DEVELOPER_MAKEFILE@ # Rules used in all directories. ###################################################################### -SAMCLEAN=@$(RM) *.o *.ii *.int.c *.log *.log.* stamp-* core core.* stats -r ti_files ii_files \ - *.valgrind +CLEAN_COMMON_LIB_FILES = @$(RM) *.o +CLEAN_COMMON_CHECK_FILES = @$(RM) *visit *.log* foo *core* *.TVD* *.valgrind +CLEAN_COMMON_TEST_FILES = @$(RM) *.o *.f # Used to control which types are created. # Default is double, integer, bool, float, complex, char -SAMRAI_LIBRARY_TARGETS=libdefault +SAMRAI_LIBRARY_TARGETS=libdefault libdcomplex ###################################################################### # Rules for SAMRAI developer builds only. diff --git a/base/SAMRAI/SAMRAI/config/Makefile.config.install.in b/base/SAMRAI/SAMRAI/config/Makefile.config.install.in index eba864da..009f2d7c 100644 --- a/base/SAMRAI/SAMRAI/config/Makefile.config.install.in +++ b/base/SAMRAI/SAMRAI/config/Makefile.config.install.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: part of configuration makefile added for installations ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/config/SAMRAI_config.h.in b/base/SAMRAI/SAMRAI/config/SAMRAI_config.h.in index 4d8e06b1..089b45d5 100644 --- a/base/SAMRAI/SAMRAI/config/SAMRAI_config.h.in +++ b/base/SAMRAI/SAMRAI/config/SAMRAI_config.h.in @@ -6,13 +6,16 @@ #define INCLUDED_SAMRAI_CONFIG_H #define SAMRAI_VERSION_MAJOR 3 -#define SAMRAI_VERSION_MINOR 4 -#define SAMRAI_VERSION_PATCHLEVEL 1 +#define SAMRAI_VERSION_MINOR 11 +#define SAMRAI_VERSION_PATCHLEVEL 2 /* Define if bool type is not properly supported */ #undef BOOL_IS_BROKEN +/* Enable Box counting */ +#undef BOX_TELEMETRY + /* Define if std::fill_n returns void */ #undef CASC_STD_FILL_N_RETURNS_VOID @@ -43,10 +46,10 @@ /* Define to a macro mangling the given C identifier (in lower and upper case), which must not contain underscores, for linking with Fortran. */ -#undef F77_FUNC +#undef SAMRAI_F77_FUNC -/* As F77_FUNC, but for C identifiers containing underscores. */ -#undef F77_FUNC_ +/* As SAMRAI_F77_FUNC, but for C identifiers containing underscores. */ +#undef SAMRAI_F77_FUNC_ /* Define if F77 and FC dummy `main' functions are identical. */ #undef FC_DUMMY_MAIN_EQ_F77 @@ -129,12 +132,18 @@ /* HAVE_NEW_PLACEMENT_OPERATOR */ #undef HAVE_NEW_PLACEMENT_OPERATOR +/* OPENMP is available */ +#undef HAVE_OPENMP + /* PETSC library is available so use it */ #undef HAVE_PETSC /* HAVE_PRAGMA_STATIC_DATA_SPECIALIZATION */ #undef HAVE_PRAGMA_STATIC_DATA_SPECIALIZATION +/* PTSCOTCH headers are available to use */ +#undef HAVE_PTSCOTCH + /* SILO library is available so use it */ #undef HAVE_SILO @@ -204,9 +213,6 @@ /* "Compiling without deprecated features" */ #undef INCLUDE_DEPRECATED -/* INCLUDE_TEMPLATE_IMPLEMENTATION */ -#undef INCLUDE_TEMPLATE_IMPLEMENTATION - /* Header file for iomanip */ #undef IOMANIP_HEADER_FILE @@ -297,6 +303,9 @@ /* Define if NAN is not in float.h */ #undef NAN_IS_BROKEN +/* Optimized build */ +#undef OPT_BUILD + /* The type ostringstream is broken */ #undef OSTRINGSTREAM_TYPE_IS_BROKEN @@ -344,6 +353,10 @@ +namespace SAMRAI { + static const unsigned short MAX_DIM_VAL = SAMRAI_MAXIMUM_DIMENSION; +} + /* * Prevent inclusion of mpi C++ bindings in mpi.h includes. * This is done in here rather than SAMRAI_MPI.h since other diff --git a/base/SAMRAI/SAMRAI/config/aclocal.m4 b/base/SAMRAI/SAMRAI/config/aclocal.m4 index 6ac14105..87477393 100644 --- a/base/SAMRAI/SAMRAI/config/aclocal.m4 +++ b/base/SAMRAI/SAMRAI/config/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -1036,7 +1036,7 @@ AC_DEFUN([CASC_SUPPORT_HDF5],[ # Begin CASC_SUPPORT_HDF5 # Defines hdf5_PREFIX hdf5_INCLUDES and hdf5_LIBS if with-hdf5 is specified. AC_ARG_WITH(hdf5, -[ --with-hdf5[=PATH] Use HDF5 and optionally specify where HDF5 is installed.], +[ --with-hdf5[=PATH] Use HDF5 and optionally specify where HDF5 is installed.], , with_hdf5=no) case "$with_hdf5" in @@ -2826,7 +2826,7 @@ AC_DEFUN([CASC_SUPPORT_SILO],[ # Begin CASC_SUPPORT_SILO # Defines silo_PREFIX silo_INCLUDES and silo_LIBS if with-silo is specified. AC_ARG_WITH(silo, -[ --with-silo[=PATH] Use SILO and optionally specify where SILO is installed.], +[ --with-silo[=PATH] Use SILO and optionally specify where SILO is installed.], , with_silo=no) case "$with_silo" in @@ -2889,7 +2889,7 @@ AC_DEFUN([CASC_SUPPORT_VALGRIND],[ # Begin CASC_SUPPORT_VALGRIND # Defines valgrind_EXE AC_ARG_WITH(valgrind, -[ --with-valgrind[=PATH] Use VALGRIND and optionally specify where VALGRIND is installed.], +[ --with-valgrind[=PATH] Use VALGRIND and optionally specify where VALGRIND is installed.], , with_valgrind=no) case "$with_valgrind" in @@ -4057,7 +4057,7 @@ AC_DEFUN([CASC_SUPPORT_BOOST],[ # Begin CASC_SUPPORT_BOOST # Defines boost_PREFIX boost_INCLUDES and boost_LIBS. AC_ARG_WITH(boost, -[ --with-boost[=PATH] Use BOOST and specify where BOOST is installed.], +[ --with-boost[=PATH] Use BOOST and specify where BOOST is installed.], , with_boost=no) case "$with_boost" in @@ -4113,12 +4113,12 @@ AC_DEFUN_ONCE([SAMRAI_MISC],[ AC_ARG_ENABLE([box_counting], [AS_HELP_STRING([--enable-box_counting], - [Turns on Box and MappedBox telemetry.])], + [Turns on Box and telemetry.])], [ if test "x$enableval" = "xyes"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + AC_DEFINE(BOX_TELEMETRY,1,Enable Box counting) elif test "x$enableval" = "x"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + AC_DEFINE(BOX_TELEMETRY,1,Enable Box counting) fi ],) ] @@ -4308,7 +4308,7 @@ fi dnl dnl File: $HeadURL$ dnl Package: SAMRAI -dnl Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +dnl Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC dnl Date: $Date$ dnl Revision: $LastChangedRevision$ dnl Description: Macro to control whether timers are compile into or @@ -4906,12 +4906,11 @@ dnl $Id$ AC_DEFUN([CASC_SUPPORT_PETSC],[ # Begin macro SUPPORT_PETSC -dnl Support PETSC by setting PETSC_DIR, PETSC_ARCH, +dnl Support PETSC by setting PETSC_DIR dnl petsc_INCLUDE and petsc_LIBS. dnl Also set PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR and dnl PETSC_VERSION_SUBMINOR to indicate PETSc version. dnl -dnl Support --with-petsc-optimize to use optimized PETSC library. dnl Support --with-petsc-mpiuni to use PETSC uniprocessor MPI library. dnl dnl Arg1: non-empty if you want the default to be on. @@ -4953,23 +4952,6 @@ PETSC_VERSION_SUBMINOR=`sed -e '/^[ \t]\{0,\}#define PETSC_VERSION_SUBMINOR/!d' fi CASC_AC_LOG_VAR(PETSC_VERSION_MAJOR PETSC_VERSION_MINOR PETSC_VERSION_SUBMINOR) -# Set PETSC_ARCH. -CASC_ARG_WITH_PREFIX(petsc-arch,PETSC_ARCH, -[ --with-petsc-arch=PETSC_ARCH - Specify the PETSC architecture. - If omitted, the output of the petscarch script - in the PETSc directory is used.]) - -# Set PETSC_OPTIMIZE. -CASC_ARG_WITH_ENV_WRAPPER(petsc-optimize,PETSC_OPTIMIZE, -[ --with-petsc-optimize - Use the optimized PETSC libraries], -# By default, use the debug PETSC library. -PETSC_OPTIMIZE=g -CASC_AC_LOG_VAR(with_petsc_optimize) -test "$with_petsc_optimize" = yes && PETSC_OPTIMIZE=O -) - # Set PETSC_MPIUNI. CASC_ARG_WITH_ENV_WRAPPER(petsc-mpiuni,PETSC_MPIUNI, [ --with-petsc-mpiuni Use the PETSC uniprocessor MPI library], @@ -4993,36 +4975,16 @@ if test "${PETSC_DIR+set}" = set; then AC_MSG_WARN([PETSC directory ($PETSC_DIR) does not look right]) fi export PETSC_DIR - if test -z "$PETSC_ARCH"; then - if test -f "$PETSC_DIR/bmake/petscconf"; then - eval `grep PETSC_ARCH $PETSC_DIR/bmake/petscconf` - elif test -x "$PETSC_DIR/bin/petscarch"; then - PETSC_ARCH=`$PETSC_DIR/bin/petscarch` - else - AC_MSG_WARN([PETSC could not determine PETSC_ARCH]) - fi - export PETSC_ARCH - fi - CASC_AC_LOG_VAR(PETSC_ARCH) - if test ! -d "$PETSC_DIR/bmake/$PETSC_ARCH"; then - AC_MSG_WARN([PETSC architecture ($PETSC_ARCH) does not look right]) - fi - if test ! "$PETSC_OPTIMIZE" = g && test ! "$PETSC_OPTIMIZE" = O; then - AC_MSG_ERROR([PETSC optimize should be either g or O]) - fi - petsc_INCLUDES="-I$PETSC_DIR/include -I$PETSC_DIR/bmake/$PETSC_ARCH" - petsc_INCLUDES="$petsc_INCLUDES -I$PETSC_DIR/src/vec" + petsc_INCLUDES="-I$PETSC_DIR/include" # Currently, I'm not entirely sure why we have to explicitly specify # the src/vec directory in the include path. But there is at least # one required file there that cannot be found in the include directory. # SGS Support latter version of PETSc # Try new structure and then old - if test -d "${PETSC_DIR}/lib/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/${PETSC_ARCH}" - elif test -d "${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}" + if test -d "${PETSC_DIR}/lib"; then + petsc_LIBDIR="${PETSC_DIR}/lib" else AC_MSG_WARN([PETSC lib directory does not look as expected]) fi @@ -5038,7 +5000,7 @@ if test "${PETSC_DIR+set}" = set; then if test -n "$petsc_libs_ls1"; then unset petsc_libs_ls for i in $petsc_libs_ls1; do - j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so$//'` + j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so.*//'` if echo "$petsc_libs_ls" | grep -v " $j " > /dev/null; then # Note padding! petsc_libs_ls="$petsc_libs_ls $j "; # Note space padding! fi @@ -5068,7 +5030,7 @@ if test "${PETSC_DIR+set}" = set; then fi fi - CASC_AC_LOG_VAR(PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_OPTIMIZE PETSC_MPIUNI) + CASC_AC_LOG_VAR(PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_MPIUNI) fi # End macro SUPPORT_PETSC diff --git a/base/SAMRAI/SAMRAI/config/casc_hdf5.m4 b/base/SAMRAI/SAMRAI/config/casc_hdf5.m4 index c9348eb8..54edea9e 100644 --- a/base/SAMRAI/SAMRAI/config/casc_hdf5.m4 +++ b/base/SAMRAI/SAMRAI/config/casc_hdf5.m4 @@ -5,7 +5,7 @@ AC_DEFUN([CASC_SUPPORT_HDF5],[ # Begin CASC_SUPPORT_HDF5 # Defines hdf5_PREFIX hdf5_INCLUDES and hdf5_LIBS if with-hdf5 is specified. AC_ARG_WITH(hdf5, -[ --with-hdf5[=PATH] Use HDF5 and optionally specify where HDF5 is installed.], +[ --with-hdf5[=PATH] Use HDF5 and optionally specify where HDF5 is installed.], , with_hdf5=no) case "$with_hdf5" in diff --git a/base/SAMRAI/SAMRAI/config/casc_silo.m4 b/base/SAMRAI/SAMRAI/config/casc_silo.m4 index cdf60a04..4b137308 100644 --- a/base/SAMRAI/SAMRAI/config/casc_silo.m4 +++ b/base/SAMRAI/SAMRAI/config/casc_silo.m4 @@ -5,7 +5,7 @@ AC_DEFUN([CASC_SUPPORT_SILO],[ # Begin CASC_SUPPORT_SILO # Defines silo_PREFIX silo_INCLUDES and silo_LIBS if with-silo is specified. AC_ARG_WITH(silo, -[ --with-silo[=PATH] Use SILO and optionally specify where SILO is installed.], +[ --with-silo[=PATH] Use SILO and optionally specify where SILO is installed.], , with_silo=no) case "$with_silo" in diff --git a/base/SAMRAI/SAMRAI/config/casc_valgind.m4 b/base/SAMRAI/SAMRAI/config/casc_valgind.m4 index 31f53940..482855b7 100644 --- a/base/SAMRAI/SAMRAI/config/casc_valgind.m4 +++ b/base/SAMRAI/SAMRAI/config/casc_valgind.m4 @@ -5,7 +5,7 @@ AC_DEFUN([CASC_SUPPORT_VALGRIND],[ # Begin CASC_SUPPORT_VALGRIND # Defines valgrind_EXE AC_ARG_WITH(valgrind, -[ --with-valgrind[=PATH] Use VALGRIND and optionally specify where VALGRIND is installed.], +[ --with-valgrind[=PATH] Use VALGRIND and optionally specify where VALGRIND is installed.], , with_valgrind=no) case "$with_valgrind" in diff --git a/base/SAMRAI/SAMRAI/config/preconf b/base/SAMRAI/SAMRAI/config/preconf deleted file mode 100755 index a62c8715..00000000 --- a/base/SAMRAI/SAMRAI/config/preconf +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# This is a short, non-critical script to issue the commands -# for rebuilding the configure script. - -topdir="`echo $0 | sed 's:/[^/]\{1,\}$::'`/.." -topdir="`echo $0 | sed -e 's:^[^/]\{1,\}$:./\&:' -e 's:/[^/]\{1,\}$::'`/.." - - -set -x - -# Go to the top-level directory. -cd "$topdir" - -# We don't always have to remove the cache, but I'm not sure when we -# should so just remove it. -rm -rf autom4te.cache - -# This generates the aclocal.m4 file. -# aclocal grabs needed macros and put them in aclocal.m4. -# Having aclocal.m4 allows one to regenerate configure after -# a "minor change" without having to look for macros. -# A minor change is one that does not require a new macro. -aclocal"$AUTOMAKE_VERSION" -I `pwd`/config --output=config/aclocal.m4 - -# This generates config/SAMRAI_config.h.in -# The file is generated based on the AH_TOP and AH_BOTTOM macros -# and the numerous use of AC_DEFINE. -# -# We remove some macros because they conflict with other packages -# using autoconf, and we don't use these macros anyway. -autoheader"$AUTOCONF_VERSION" -I config -sed -i -e 's/^\(#undef \(PACKAGE\|VERSION\)\)/\/\/ Removed due to name conflict \1/' config/SAMRAI_config.h.in - -# This generates configure -autoconf"$AUTOCONF_VERSION" -I config || exit 1 diff --git a/base/SAMRAI/SAMRAI/config/samrai_boost.m4 b/base/SAMRAI/SAMRAI/config/samrai_boost.m4 index 5fa36ede..9bb4aab9 100644 --- a/base/SAMRAI/SAMRAI/config/samrai_boost.m4 +++ b/base/SAMRAI/SAMRAI/config/samrai_boost.m4 @@ -5,7 +5,7 @@ AC_DEFUN([CASC_SUPPORT_BOOST],[ # Begin CASC_SUPPORT_BOOST # Defines boost_PREFIX boost_INCLUDES and boost_LIBS. AC_ARG_WITH(boost, -[ --with-boost[=PATH] Use BOOST and specify where BOOST is installed.], +[ --with-boost[=PATH] Use BOOST and specify where BOOST is installed.], , with_boost=no) case "$with_boost" in diff --git a/base/SAMRAI/SAMRAI/config/samrai_misc.m4 b/base/SAMRAI/SAMRAI/config/samrai_misc.m4 index dcc73854..0ffb5c1e 100644 --- a/base/SAMRAI/SAMRAI/config/samrai_misc.m4 +++ b/base/SAMRAI/SAMRAI/config/samrai_misc.m4 @@ -11,12 +11,12 @@ AC_DEFUN_ONCE([SAMRAI_MISC],[ AC_ARG_ENABLE([box_counting], [AS_HELP_STRING([--enable-box_counting], - [Turns on Box and MappedBox telemetry.])], + [Turns on Box and telemetry.])], [ if test "x$enableval" = "xyes"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + AC_DEFINE(BOX_TELEMETRY,1,Enable Box counting) elif test "x$enableval" = "x"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + AC_DEFINE(BOX_TELEMETRY,1,Enable Box counting) fi ],) ] diff --git a/base/SAMRAI/SAMRAI/config/samrai_timers.m4 b/base/SAMRAI/SAMRAI/config/samrai_timers.m4 index 485216ae..01d9792e 100644 --- a/base/SAMRAI/SAMRAI/config/samrai_timers.m4 +++ b/base/SAMRAI/SAMRAI/config/samrai_timers.m4 @@ -1,7 +1,7 @@ dnl dnl File: $HeadURL$ dnl Package: SAMRAI -dnl Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +dnl Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC dnl Date: $Date$ dnl Revision: $LastChangedRevision$ dnl Description: Macro to control whether timers are compile into or diff --git a/base/SAMRAI/SAMRAI/config/serpa-run.in b/base/SAMRAI/SAMRAI/config/serpa-run.in index 89aaccd8..a7f3734c 100644 --- a/base/SAMRAI/SAMRAI/config/serpa-run.in +++ b/base/SAMRAI/SAMRAI/config/serpa-run.in @@ -185,7 +185,7 @@ elif echo "${HOST}" | grep '^tc2k' > /dev/null ; then return ${?} } -elif echo "${HOST}" | egrep '^(cab|hera|sierra|ansel|atlas|rzzeus|rzalastor)[0-9]' > /dev/null ; then +elif echo "${HOST}" | egrep '^(atlas|aztec|rzzeus|rzalastor|rzmerl|rzuseqlac|sierra|surface|hera)[0-9]' > /dev/null ; then # For LC Linux clusters using srun. run_multiproc () { @@ -193,7 +193,7 @@ elif echo "${HOST}" | egrep '^(cab|hera|sierra|ansel|atlas|rzzeus|rzalastor)[0-9 if [ -n "${REGRESSION}" ] ; then cmd="mpirun -np ${nproc}" else - cmd="srun -n${nproc} -ppdebug" + cmd="srun -n${nproc}" fi #com="${additional_env} srun -n${nproc} ${program} ${@}" com="${cmd} ${program} ${@}" diff --git a/base/SAMRAI/SAMRAI/config/support-petsc.m4 b/base/SAMRAI/SAMRAI/config/support-petsc.m4 index 7aa2a465..cb7fce94 100644 --- a/base/SAMRAI/SAMRAI/config/support-petsc.m4 +++ b/base/SAMRAI/SAMRAI/config/support-petsc.m4 @@ -2,12 +2,11 @@ dnl $Id$ AC_DEFUN([CASC_SUPPORT_PETSC],[ # Begin macro SUPPORT_PETSC -dnl Support PETSC by setting PETSC_DIR, PETSC_ARCH, +dnl Support PETSC by setting PETSC_DIR dnl petsc_INCLUDE and petsc_LIBS. dnl Also set PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR and dnl PETSC_VERSION_SUBMINOR to indicate PETSc version. dnl -dnl Support --with-petsc-optimize to use optimized PETSC library. dnl Support --with-petsc-mpiuni to use PETSC uniprocessor MPI library. dnl dnl Arg1: non-empty if you want the default to be on. @@ -49,23 +48,6 @@ PETSC_VERSION_SUBMINOR=`sed -e '/^[ \t]\{0,\}#define PETSC_VERSION_SUBMINOR/!d' fi CASC_AC_LOG_VAR(PETSC_VERSION_MAJOR PETSC_VERSION_MINOR PETSC_VERSION_SUBMINOR) -# Set PETSC_ARCH. -CASC_ARG_WITH_PREFIX(petsc-arch,PETSC_ARCH, -[ --with-petsc-arch=PETSC_ARCH - Specify the PETSC architecture. - If omitted, the output of the petscarch script - in the PETSc directory is used.]) - -# Set PETSC_OPTIMIZE. -CASC_ARG_WITH_ENV_WRAPPER(petsc-optimize,PETSC_OPTIMIZE, -[ --with-petsc-optimize - Use the optimized PETSC libraries], -# By default, use the debug PETSC library. -PETSC_OPTIMIZE=g -CASC_AC_LOG_VAR(with_petsc_optimize) -test "$with_petsc_optimize" = yes && PETSC_OPTIMIZE=O -) - # Set PETSC_MPIUNI. CASC_ARG_WITH_ENV_WRAPPER(petsc-mpiuni,PETSC_MPIUNI, [ --with-petsc-mpiuni Use the PETSC uniprocessor MPI library], @@ -89,36 +71,16 @@ if test "${PETSC_DIR+set}" = set; then AC_MSG_WARN([PETSC directory ($PETSC_DIR) does not look right]) fi export PETSC_DIR - if test -z "$PETSC_ARCH"; then - if test -f "$PETSC_DIR/bmake/petscconf"; then - eval `grep PETSC_ARCH $PETSC_DIR/bmake/petscconf` - elif test -x "$PETSC_DIR/bin/petscarch"; then - PETSC_ARCH=`$PETSC_DIR/bin/petscarch` - else - AC_MSG_WARN([PETSC could not determine PETSC_ARCH]) - fi - export PETSC_ARCH - fi - CASC_AC_LOG_VAR(PETSC_ARCH) - if test ! -d "$PETSC_DIR/bmake/$PETSC_ARCH"; then - AC_MSG_WARN([PETSC architecture ($PETSC_ARCH) does not look right]) - fi - if test ! "$PETSC_OPTIMIZE" = g && test ! "$PETSC_OPTIMIZE" = O; then - AC_MSG_ERROR([PETSC optimize should be either g or O]) - fi - petsc_INCLUDES="-I$PETSC_DIR/include -I$PETSC_DIR/bmake/$PETSC_ARCH" - petsc_INCLUDES="$petsc_INCLUDES -I$PETSC_DIR/src/vec" + petsc_INCLUDES="-I$PETSC_DIR/include" # Currently, I'm not entirely sure why we have to explicitly specify # the src/vec directory in the include path. But there is at least # one required file there that cannot be found in the include directory. # SGS Support latter version of PETSc # Try new structure and then old - if test -d "${PETSC_DIR}/lib/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/${PETSC_ARCH}" - elif test -d "${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}" + if test -d "${PETSC_DIR}/lib"; then + petsc_LIBDIR="${PETSC_DIR}/lib" else AC_MSG_WARN([PETSC lib directory does not look as expected]) fi @@ -134,7 +96,7 @@ if test "${PETSC_DIR+set}" = set; then if test -n "$petsc_libs_ls1"; then unset petsc_libs_ls for i in $petsc_libs_ls1; do - j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so$//'` + j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so.*//'` if echo "$petsc_libs_ls" | grep -v " $j " > /dev/null; then # Note padding! petsc_libs_ls="$petsc_libs_ls $j "; # Note space padding! fi @@ -164,7 +126,7 @@ if test "${PETSC_DIR+set}" = set; then fi fi - CASC_AC_LOG_VAR(PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_OPTIMIZE PETSC_MPIUNI) + CASC_AC_LOG_VAR(PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_MPIUNI) fi # End macro SUPPORT_PETSC diff --git a/base/SAMRAI/SAMRAI/configure b/base/SAMRAI/SAMRAI/configure index 8d6d39ec..5adce9a7 100755 --- a/base/SAMRAI/SAMRAI/configure +++ b/base/SAMRAI/SAMRAI/configure @@ -637,6 +637,8 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +btng_rpath_beginning +ac_pwd LIB_NAME LIB_PATH INC_PATH @@ -678,7 +680,6 @@ ac_ct_F77 FFLAGS F77 DEVELOPER_MAKEFILE -DEPENDS_ON_TEMPLATE_IMPLEMENTATION CXXCPP EGREP GREP @@ -762,6 +763,7 @@ enable_check_assertions enable_check_developer_assertions enable_check_dim_assertions enable_bgl +enable_threading with_CC with_CXX with_F77 @@ -776,6 +778,9 @@ with_MPI with_HDF5 with_PETSC with_extra_ld_flags +with_extra_cc_flags +with_extra_cxx_flags +with_extra_f77_flags enable_box_counting enable_timers enable_opt @@ -812,6 +817,7 @@ with_zlib with_szlib with_hdf5 with_boost +with_ptscotch with_tbb with_tbb_include with_tbb_lib_dirs @@ -821,8 +827,6 @@ with_hypre with_superlu_lib with_spooles with_petsc -with_petsc_arch -with_petsc_optimize with_petsc_mpiuni with_petsc_libfiles with_sundials @@ -1494,8 +1498,9 @@ Optional Features: is disabled; is enabled when debugging is enabled) --enable-bgl Identify this platform as one of the bgl family (default is disable) + --enable-threading build with threading on (default is disabled) --enable-deprecated build with deprecated features (default is enabled) - --enable-box_counting Turns on Box and MappedBox telemetry. + --enable-box_counting Turns on Box and telemetry. --disable-timers Disable SAMRAI Timers. --enable-opt=STRING Set compiler optimization switches. --enable-debug=STRING Set compiler debug switches. @@ -1536,8 +1541,14 @@ Optional Packages: --with-extra-ld-flags=STRING Specify additional flags for the loader. + --with-extra-cc-flags=STRING + Specify additional flags for the c compiler. + --with-extra-cxx-flags=STRING + Specify additional flags for the c++ compiler. + --with-extra-f77-flags=STRING + Specify additional flags for the f77 compiler. --with-x use the X Window System - --with-valgrind=PATH Use VALGRIND and optionally specify where VALGRIND is installed. + --with-valgrind=PATH Use VALGRIND and optionally specify where VALGRIND is installed. --with-doxygen=PATH Specify path to doxygen program (equivalent to setting DOXYGEN_BIN in environment) --with-dot-dir=DIR Specify bin directory where dot binaries live. @@ -1607,8 +1618,9 @@ Optional Packages: --with-szlib=DIR root directory path of szlib installation DIR defaults to /usr/local or /usr if not found in /usr/local --without-szlib to disable szlib usage completely the default - --with-hdf5=PATH Use HDF5 and optionally specify where HDF5 is installed. - --with-boost=PATH Use BOOST and specify where BOOST is installed. + --with-hdf5=PATH Use HDF5 and optionally specify where HDF5 is installed. + --with-boost=PATH Use BOOST and specify where BOOST is installed. + --with-ptscotch=PATH Use PT-SCOTCH and specify where PT-SCOTCH is installed. --with-tbb Use Thread Building Blocks --with-tbb-include=DIR tbb.h is in DIR --with-tbb-lib-dirs=DIRS @@ -1618,7 +1630,7 @@ Optional Packages: --with-tbb-libs=LIBS LIBS is a space-separated list of library names needed for Thread Building Blocks, e.g., \"tbb tbbmalloc\" - --with-silo=PATH Use SILO and optionally specify where SILO is installed. + --with-silo=PATH Use SILO and optionally specify where SILO is installed. --with-hypre=PATH Use HYPRE and optionally specify where it is installed. --with-superlu-lib=LIB LIB is the library archive file for the SuperLU package. @@ -1628,12 +1640,6 @@ Optional Packages: --with-petsc=PATH Support PETSc, and specify PETSC top-level directory. Setting PETSC_DIR is equivalent to this. - --with-petsc-arch=PETSC_ARCH - Specify the PETSC architecture. - If omitted, the output of the petscarch script - in the PETSc directory is used. - --with-petsc-optimize - Use the optimized PETSC libraries --with-petsc-mpiuni Use the PETSC uniprocessor MPI library --with-petsc-libfiles Specify explit PETSc library files instead @@ -2118,7 +2124,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:2121:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:2127:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -2292,7 +2298,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:2295:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:2301:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -2364,6 +2370,14 @@ else fi +# Check whether --enable-threading was given. +if test "${enable_threading+set}" = set; then + enableval=$enable_threading; +else + enable_threading="no" + +fi + # Check whether --with-CC was given. if test "${with_CC+set}" = set; then @@ -2580,7 +2594,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:2583:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:2597:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -2639,7 +2653,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:2642:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:2656:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -2665,7 +2679,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:2668:" "before running compiler search: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:2682:" "before running compiler search: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -3301,7 +3315,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:3304:" "after running compiler search: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:3318:" "after running compiler search: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -4106,6 +4120,65 @@ case "$with_extra_ld_flags" in esac +# Check whether --with-extra-cc-flags was given. +if test "${with_extra_cc_flags+set}" = set; then + withval=$with_extra_cc_flags; +else + with_extra_cc_flags='no' +fi + +case "$with_extra_cc_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + C_FLAGS="$C_FLAGS $with_extra_cc_flags" + ;; +esac + + +# Check whether --with-extra-cxx-flags was given. +if test "${with_extra_cxx_flags+set}" = set; then + withval=$with_extra_cxx_flags; +else + with_extra_cxx_flags='no' +fi + +case "$with_extra_cxx_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + CXX_FLAGS="$CXX_FLAGS $with_extra_cxx_flags" + ;; +esac + + +# Check whether --with-extra-f77-flags was given. +if test "${with_extra_f77_flags+set}" = set; then + withval=$with_extra_f77_flags; +else + with_extra_f77_flags='no' +fi + +case "$with_extra_f77_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + F77_FLAGS="$F77_FLAGS $with_extra_f77_flags" + ;; +esac + for ac_prog in $with_AR ar do @@ -4150,8 +4223,8 @@ fi done if test -z "$AR"; then - { { $as_echo "$as_me:$LINENO: error: ar archiver not found - specify with --with-m4=ARG" >&5 -$as_echo "$as_me: error: ar archiver not found - specify with --with-m4=ARG" >&2;} + { { $as_echo "$as_me:$LINENO: error: ar archiver not found - specify with --with-AR=ARG" >&5 +$as_echo "$as_me: error: ar archiver not found - specify with --with-AR=ARG" >&2;} { (exit 1); exit 1; }; } fi @@ -4737,8 +4810,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - echo "configure:4740:" CC is $CC >&5 - echo "configure:4741:" CPP is $CPP >&5 + echo "configure:4813:" CC is $CC >&5 + echo "configure:4814:" CPP is $CPP >&5 CC_ID=unknown CC_VERSION=unknown @@ -4747,7 +4820,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check if it is a Sun compiler. if test $CC_ID = unknown; then - echo "configure:4750:" checking if $CC is sunpro >&5 + echo "configure:4823:" checking if $CC is sunpro >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4772,7 +4845,7 @@ rm -f conftest* # Check if it is a Intel compiler. if test $CC_ID = unknown; then - echo "configure:4775:" checking if $CC is intel >&5 + echo "configure:4848:" checking if $CC is intel >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4800,7 +4873,7 @@ rm -f conftest* # Check if it is a GNU compiler. if test $CC_ID = unknown; then - echo "configure:4803:" checking if $CC is gnu >&5 + echo "configure:4876:" checking if $CC is gnu >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4825,7 +4898,7 @@ rm -f conftest* # Check if it is a DEC compiler. if test $CC_ID = unknown; then - echo "configure:4828:" checking if $CC is dec >&5 + echo "configure:4901:" checking if $CC is dec >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4850,7 +4923,7 @@ rm -f conftest* # Check if it is a KAI compiler. if test $CC_ID = unknown; then - echo "configure:4853:" checking if $CC is kai >&5 + echo "configure:4926:" checking if $CC is kai >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4875,7 +4948,7 @@ rm -f conftest* # Check if it is a SGI compiler. if test $CC_ID = unknown; then - echo "configure:4878:" checking if $CC is sgi >&5 + echo "configure:4951:" checking if $CC is sgi >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4900,17 +4973,17 @@ rm -f conftest* # Check if it is a IBM compiler. if test $CC_ID = unknown; then - echo "configure:4903:" checking if $CC is xlc >&5 + echo "configure:4976:" checking if $CC is xlc >&5 if echo "$host_os" | grep "aix" >/dev/null ; then # The wretched IBM shell does not eval correctly, # so we have to help it with a pre-eval eval statement. ac_cpp=`eval "echo $ac_cpp"` save_ac_cpp=$ac_cpp - echo "configure:4909:" ac_cpp is temporarily set to $ac_cpp >&5 + echo "configure:4982:" ac_cpp is temporarily set to $ac_cpp >&5 else save_ac_cpp= fi - echo "configure:4913:" ac_cpp is $ac_cpp >&5 + echo "configure:4986:" ac_cpp is $ac_cpp >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4934,7 +5007,7 @@ fi rm -f conftest* test "$save_ac_cpp" && ac_cpp=$save_ac_cpp - echo "configure:4937:" ac_cpp is restored to $ac_cpp >&5 + echo "configure:5010:" ac_cpp is restored to $ac_cpp >&5 fi @@ -4954,7 +5027,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:4957:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:5030:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -5206,8 +5279,8 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - echo "configure:5209:" CXXP is $CXX >&5 - echo "configure:5210:" CXXCPP is $CXXCPP >&5 + echo "configure:5282:" CXXP is $CXX >&5 + echo "configure:5283:" CXXCPP is $CXXCPP >&5 CXX_ID=unknown CXX_VERSION=unknown @@ -5216,7 +5289,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Check if it is a Sun compiler. if test $CXX_ID = unknown; then - echo "configure:5219:" checking if $CXX is sunpro >&5 + echo "configure:5292:" checking if $CXX is sunpro >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5241,7 +5314,7 @@ rm -f conftest* # Check if it is a Intel compiler. if test $CXX_ID = unknown; then - echo "configure:5244:" checking if $CXX is intel >&5 + echo "configure:5317:" checking if $CXX is intel >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5269,7 +5342,7 @@ rm -f conftest* # Check if it is a GNU compiler. if test $CXX_ID = unknown; then - echo "configure:5272:" checking if $CXX is gnu >&5 + echo "configure:5345:" checking if $CXX is gnu >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5297,7 +5370,7 @@ rm -f conftest* # Check if it is a DEC compiler. if test $CXX_ID = unknown; then - echo "configure:5300:" checking if $CXX is dec >&5 + echo "configure:5373:" checking if $CXX is dec >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5322,7 +5395,7 @@ rm -f conftest* # Check if it is a KAI compiler. if test $CXX_ID = unknown; then - echo "configure:5325:" checking if $CXX is kai >&5 + echo "configure:5398:" checking if $CXX is kai >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5347,7 +5420,7 @@ rm -f conftest* # Check if it is a SGI compiler. if test $CXX_ID = unknown; then - echo "configure:5350:" checking if $CXX is sgi >&5 + echo "configure:5423:" checking if $CXX is sgi >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5372,7 +5445,7 @@ rm -f conftest* # Check if it is a IBM compiler. if test $CXX_ID = unknown; then - echo "configure:5375:" checking if $CXX is xlc >&5 + echo "configure:5448:" checking if $CXX is xlc >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5414,7 +5487,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:5417:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:5490:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -6274,6 +6347,10 @@ _ACEOF fi +case $CXX in + *insure*) + ;; + *) { $as_echo "$as_me:$LINENO: checking whether ${CXX} supports exception handling" >&5 @@ -6368,6 +6445,8 @@ _ACEOF fi + ;; +esac { $as_echo "$as_me:$LINENO: checking whether ${CXX} supports standard static data specialization" >&5 @@ -7458,6 +7537,7 @@ esac case $CXX_ID in gnu) CXX_FLAGS="-Wall -Wextra -Wconversion $CXX_FLAGS" + case $ARCH in IRIX64) CXX_FLAGS="-mabi=64 $CXX_FLAGS" @@ -7497,13 +7577,34 @@ case $CXX_ID in ;; esac +if test "$enable_threading" = "yes"; then + case $CXX_ID in + gnu) + CXX_FLAGS="$CXX_FLAGS -fopenmp" + ;; + xlc) + CXX_FLAGS="$CXX_FLAGS -qsmp=omp" + ;; + intel) + CXX_FLAGS="$CXX_FLAGS -openmp" + ;; + *) + { $as_echo "$as_me:$LINENO: WARNING: +Use CFLAGS and CXXFLAGS to specify compiler +threading directive for this compiler. +" >&5 +$as_echo "$as_me: WARNING: +Use CFLAGS and CXXFLAGS to specify compiler +threading directive for this compiler. +" >&2;}; + ;; + esac cat >>confdefs.h <<\_ACEOF -#define INCLUDE_TEMPLATE_IMPLEMENTATION 1 +#define HAVE_OPENMP 1 _ACEOF -DEPENDS_ON_TEMPLATE_IMPLEMENTATION="yes" - +fi XARGS="xargs -n 150" @@ -7552,9 +7653,17 @@ fi if test "${enable_box_counting+set}" = set; then enableval=$enable_box_counting; if test "x$enableval" = "xyes"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + +cat >>confdefs.h <<\_ACEOF +#define BOX_TELEMETRY 1 +_ACEOF + elif test "x$enableval" = "x"; then - CPPFLAGS_EXTRA="-DBOX_TELEMETRY $CPPFLAGS_EXTRA" + +cat >>confdefs.h <<\_ACEOF +#define BOX_TELEMETRY 1 +_ACEOF + fi fi @@ -7603,6 +7712,11 @@ if test "${enable_opt+set}" = set; then enableval=$enable_opt; case "$enable_opt" in no) opt_switches= ;; yes) + +cat >>confdefs.h <<\_ACEOF +#define OPT_BUILD 1 +_ACEOF + case $CXX_ID in gnu) opt_switches="-O2" ;; intel) opt_switches="-O3" ;; @@ -7710,7 +7824,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:7713:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:7827:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -7718,7 +7832,7 @@ done if test -n "$with_F77"; then - if test -f $with_F77; then + if test -f "$with_F77"; then F77=$with_F77 else for ac_prog in $with_F77 @@ -7871,7 +7985,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:7874:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:7988:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -8513,7 +8627,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:8516:" "after using ac_f77_library_ldflags: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:8630:" "after using ac_f77_library_ldflags: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -9059,6 +9173,9 @@ $as_echo "no" >&6; } fi +sed 's/F77_FUNC/SAMRAI_F77_FUNC/' confdefs.h > confdefs1.h +mv confdefs1.h confdefs.h + if test "${with_x+set}" = set; then { $as_echo "$as_me:$LINENO: checking for X" >&5 @@ -10817,7 +10934,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:10820:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:10937:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -10872,7 +10989,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:10875:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:10992:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -11021,12 +11138,12 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:11024:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:11141:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done -echo "configure:11029:" begin stringize >&5 +echo "configure:11146:" begin stringize >&5 { $as_echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5 $as_echo_n "checking for preprocessor stringizing operator... " >&6; } if test "${ac_cv_c_stringize+set}" = set; then @@ -11061,7 +11178,7 @@ _ACEOF fi -echo "configure:11064:" end stringize >&5 +echo "configure:11181:" end stringize >&5 @@ -11445,7 +11562,7 @@ fi if test -n "$btng_header_found"; then { $as_echo "$as_me:$LINENO: checking whether $file is the header sought" >&5 $as_echo_n "checking whether $file is the header sought... " >&6; } - echo "configure:11448:" found header file $file >&5 + echo "configure:11565:" found header file $file >&5 CPPFLAGS="$CPPFLAGS_SAVE $CXX_OPTIONS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11550,7 +11667,7 @@ cat >>confdefs.h <<\_ACEOF #define IOSTREAM_IS_BROKEN 1 _ACEOF - echo "configure:11553:" header file iostream is broken >&5 + echo "configure:11670:" header file iostream is broken >&5 else unset iostream_header_is_broken @@ -11558,7 +11675,7 @@ cat >>confdefs.h <<_ACEOF #define IOSTREAM_HEADER_FILE <$IOSTREAM_HEADER_FILE> _ACEOF - echo "configure:11561:" header file iostream is ok >&5 + echo "configure:11678:" header file iostream is ok >&5 fi # End macro CASC_TREAT_VARIABLE_HEADER_FILENAME @@ -11735,7 +11852,7 @@ fi if test -n "$btng_header_found"; then { $as_echo "$as_me:$LINENO: checking whether $file is the header sought" >&5 $as_echo_n "checking whether $file is the header sought... " >&6; } - echo "configure:11738:" found header file $file >&5 + echo "configure:11855:" found header file $file >&5 CPPFLAGS="$CPPFLAGS_SAVE $CXX_OPTIONS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11837,7 +11954,7 @@ cat >>confdefs.h <<\_ACEOF #define IOMANIP_IS_BROKEN 1 _ACEOF - echo "configure:11840:" header file iomanip is broken >&5 + echo "configure:11957:" header file iomanip is broken >&5 else unset iomanip_header_is_broken @@ -11845,7 +11962,7 @@ cat >>confdefs.h <<_ACEOF #define IOMANIP_HEADER_FILE <$IOMANIP_HEADER_FILE> _ACEOF - echo "configure:11848:" header file iomanip is ok >&5 + echo "configure:11965:" header file iomanip is ok >&5 fi # End macro CASC_TREAT_VARIABLE_HEADER_FILENAME @@ -12022,7 +12139,7 @@ fi if test -n "$btng_header_found"; then { $as_echo "$as_me:$LINENO: checking whether $file is the header sought" >&5 $as_echo_n "checking whether $file is the header sought... " >&6; } - echo "configure:12025:" found header file $file >&5 + echo "configure:12142:" found header file $file >&5 CPPFLAGS="$CPPFLAGS_SAVE $CXX_OPTIONS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12127,7 +12244,7 @@ cat >>confdefs.h <<\_ACEOF #define IOSTREAM_IS_BROKEN 1 _ACEOF - echo "configure:12130:" header file iostream is broken >&5 + echo "configure:12247:" header file iostream is broken >&5 else unset iostream_header_is_broken @@ -12135,7 +12252,7 @@ cat >>confdefs.h <<_ACEOF #define IOSTREAM_HEADER_FILE <$IOSTREAM_HEADER_FILE> _ACEOF - echo "configure:12138:" header file iostream is ok >&5 + echo "configure:12255:" header file iostream is ok >&5 fi # End macro CASC_TREAT_VARIABLE_HEADER_FILENAME @@ -12317,7 +12434,7 @@ fi if test -n "$btng_header_found"; then { $as_echo "$as_me:$LINENO: checking whether $file is the header sought" >&5 $as_echo_n "checking whether $file is the header sought... " >&6; } - echo "configure:12320:" found header file $file >&5 + echo "configure:12437:" found header file $file >&5 CPPFLAGS="$CPPFLAGS_SAVE $CXX_OPTIONS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12419,7 +12536,7 @@ cat >>confdefs.h <<\_ACEOF #define STL_SSTREAM_IS_BROKEN 1 _ACEOF - echo "configure:12422:" header file stl-sstream is broken >&5 + echo "configure:12539:" header file stl-sstream is broken >&5 else unset stl_sstream_header_is_broken @@ -12427,7 +12544,7 @@ cat >>confdefs.h <<_ACEOF #define STL_SSTREAM_HEADER_FILE <$STL_SSTREAM_HEADER_FILE> _ACEOF - echo "configure:12430:" header file stl-sstream is ok >&5 + echo "configure:12547:" header file stl-sstream is ok >&5 fi # End macro CASC_TREAT_VARIABLE_HEADER_FILENAME @@ -13212,7 +13329,7 @@ case "$with_dl_includes" in $as_echo "$as_me: error: If you specify --with-dl-includes, you must give it the path as in --with-dl-includes=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:13215:" environment dl_INCLUDES not defined >&5 +echo "configure:13332:" environment dl_INCLUDES not defined >&5 fi @@ -13283,7 +13400,7 @@ case "$with_dl_libs" in $as_echo "$as_me: error: If you specify --with-dl-libs, you must give it the path as in --with-dl-libs=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:13286:" environment dl_LIBS not defined >&5 +echo "configure:13403:" environment dl_LIBS not defined >&5 fi @@ -13435,7 +13552,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:13438:" "After finding dl flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:13555:" "After finding dl flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -13453,7 +13570,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:13456:" "Found dl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:13573:" "Found dl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -13471,7 +13588,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:13474:" "Did not find dl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:13591:" "Did not find dl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -13482,7 +13599,7 @@ fi unset btng_extra_libs unset btng_save_LIBS else - echo "configure:13485:" Not looking for dl because dl_LIBS is already set >&5 + echo "configure:13602:" Not looking for dl because dl_LIBS is already set >&5 fi fi # End macro CASC_VAR_SET_DL @@ -13524,443 +13641,85 @@ fi -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to get verbose linking output from $F77" >&5 -$as_echo_n "checking how to get verbose linking output from $F77... " >&6; } -if test "${ac_cv_prog_f77_v+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main - end -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_f77_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_f77_v= -# Try some options frequently used verbose output -for ac_verb in -v -verbose --verbose -V -\#\#\#; do - cat >conftest.$ac_ext <<_ACEOF - program main - end -_ACEOF -# Compile and link our simple test program by passing a flag (argument -# 1 to this macro) to the Fortran compiler in order to get -# "verbose" output that we can then parse for the Fortran linker -# flags. -ac_save_FFLAGS=$FFLAGS -FFLAGS="$FFLAGS $ac_verb" -eval "set x $ac_link" -shift -$as_echo "$as_me:$LINENO: $*" >&5 -# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, -# LIBRARY_PATH; skip all such settings. -ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | - grep -v 'Driving:' | grep -v "^[_$as_cr_Letters][_$as_cr_alnum]*="` -$as_echo "$ac_f77_v_output" >&5 -FFLAGS=$ac_save_FFLAGS -rm -rf conftest* +# Begin macro CASC_SUPPORT_NSL -# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where -# /foo, /bar, and /baz are search directories for the Fortran linker. -# Here, we change these into -L/foo -L/bar -L/baz (and put it first): -ac_f77_v_output="`echo $ac_f77_v_output | - grep 'LPATH is:' | - sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_f77_v_output" -# FIXME: we keep getting bitten by quoted arguments; a more general fix -# that detects unbalanced quotes in FLIBS should be implemented -# and (ugh) tested at some point. -case $ac_f77_v_output in - # If we are using xlf then replace all the commas with spaces. - *xlfentry*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; +# Start macro CASC_ARG_WITH_ENV_WRAPPER with args nsl and nsl_PREFIX +{ $as_echo "$as_me:$LINENO: checking for nsl" >&5 +$as_echo_n "checking for nsl... " >&6; } +if test "${btng_cv_prog_nsl+set}" = set; then + $as_echo_n "(cached) " >&6 +else - # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted - # $LIBS confuse us, and the libraries appear later in the output anyway). - *mGLOB_options_string*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;; - # Portland Group compiler has singly- or doubly-quoted -cmdline argument - # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4. - # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2". - *-cmdline\ * | *-ignore\ * | *-def\ *) - ac_f77_v_output=`echo $ac_f77_v_output | sed "\ - s/-cmdline *'[^']*'/ /g; s/-cmdline *\"[^\"]*\"/ /g - s/-ignore *'[^']*'/ /g; s/-ignore *\"[^\"]*\"/ /g - s/-def *'[^']*'/ /g; s/-def *\"[^\"]*\"/ /g"` ;; +# Check whether --with-nsl was given. +if test "${with_nsl+set}" = set; then + withval=$with_nsl; +fi - # If we are using Cray Fortran then delete quotes. - *cft90*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;; +# Set nsl_PREFIX, using environment setting if available +# and if command line is ambiguous. +case "$with_nsl" in + no) + # User explictly turned off nsl. + # Ignore value of nsl_PREFIX, even if set in the environment. + unset nsl_PREFIX + ;; + yes|'') + # Flag unissued or ambiguously issued using --with-nsl. + # Because the user did not explicitly turn if off, + # try to set nsl_PREFIX. + # If environment variable nsl_PREFIX is available, use it. + # If not, try the user-supplied commands to set it. + if test -n "${nsl_PREFIX}" ; then + : Nothing to do here actually, because nsl_PREFIX is already in the environment. + else + nsl_PREFIX= + fi + ;; + *) + # User issued a specific string using --with-nsl=non-null-string. + # so that is used to set nsl_PREFIX. + nsl_PREFIX=$with_nsl + ;; esac +if test "${nsl_PREFIX+set}" = set ; then + # This block executes the quality check commands, if any, for nsl_PREFIX. + : +fi +# Cache the value if it was found. +if test "${nsl_PREFIX+set}" = set ; then + btng_cv_prog_nsl=${nsl_PREFIX} +fi - - # look for -l* and *.a constructs in the output - for ac_arg in $ac_f77_v_output; do - case $ac_arg in - [\\/]*.a | ?:[\\/]*.a | -[lLRu]*) - ac_cv_prog_f77_v=$ac_verb - break 2 ;; - esac - done -done -if test -z "$ac_cv_prog_f77_v"; then - { $as_echo "$as_me:$LINENO: WARNING: cannot determine how to obtain linking information from $F77" >&5 -$as_echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} fi +{ $as_echo "$as_me:$LINENO: result: $btng_cv_prog_nsl" >&5 +$as_echo "$btng_cv_prog_nsl" >&6; } +# Set nsl_PREFIX from cache. +# nsl_PREFIX is not yet set if we grabbed it from cache. +if test "${btng_cv_prog_nsl+set}" = set ; then + nsl_PREFIX=$btng_cv_prog_nsl else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: WARNING: compilation failed" >&5 -$as_echo "$as_me: WARNING: compilation failed" >&2;} + unset nsl_PREFIX fi +# End macro CASC_ARG_WITH_ENV_WRAPPER with args nsl_PREFIX and nsl -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_v" >&5 -$as_echo "$ac_cv_prog_f77_v" >&6; } -{ $as_echo "$as_me:$LINENO: checking for Fortran 77 libraries of $F77" >&5 -$as_echo_n "checking for Fortran 77 libraries of $F77... " >&6; } -if test "${ac_cv_f77_libs+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "x$FLIBS" != "x"; then - ac_cv_f77_libs="$FLIBS" # Let the user override the test. -else -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF - -# Compile and link our simple test program by passing a flag (argument -# 1 to this macro) to the Fortran compiler in order to get -# "verbose" output that we can then parse for the Fortran linker -# flags. -ac_save_FFLAGS=$FFLAGS -FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -eval "set x $ac_link" -shift -$as_echo "$as_me:$LINENO: $*" >&5 -# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH, -# LIBRARY_PATH; skip all such settings. -ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | - grep -v 'Driving:' | grep -v "^[_$as_cr_Letters][_$as_cr_alnum]*="` -$as_echo "$ac_f77_v_output" >&5 -FFLAGS=$ac_save_FFLAGS - -rm -rf conftest* - -# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where -# /foo, /bar, and /baz are search directories for the Fortran linker. -# Here, we change these into -L/foo -L/bar -L/baz (and put it first): -ac_f77_v_output="`echo $ac_f77_v_output | - grep 'LPATH is:' | - sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_f77_v_output" - -# FIXME: we keep getting bitten by quoted arguments; a more general fix -# that detects unbalanced quotes in FLIBS should be implemented -# and (ugh) tested at some point. -case $ac_f77_v_output in - # If we are using xlf then replace all the commas with spaces. - *xlfentry*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; - - # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted - # $LIBS confuse us, and the libraries appear later in the output anyway). - *mGLOB_options_string*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;; - - # Portland Group compiler has singly- or doubly-quoted -cmdline argument - # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4. - # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2". - *-cmdline\ * | *-ignore\ * | *-def\ *) - ac_f77_v_output=`echo $ac_f77_v_output | sed "\ - s/-cmdline *'[^']*'/ /g; s/-cmdline *\"[^\"]*\"/ /g - s/-ignore *'[^']*'/ /g; s/-ignore *\"[^\"]*\"/ /g - s/-def *'[^']*'/ /g; s/-def *\"[^\"]*\"/ /g"` ;; - - # If we are using Cray Fortran then delete quotes. - *cft90*) - ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;; -esac - - - -ac_cv_f77_libs= - -# Save positional arguments (if any) -ac_save_positional="$@" - -set X $ac_f77_v_output -while test $# != 1; do - shift - ac_arg=$1 - case $ac_arg in - [\\/]*.a | ?:[\\/]*.a) - ac_exists=false - for ac_i in $ac_cv_f77_libs; do - if test x"$ac_arg" = x"$ac_i"; then - ac_exists=true - break - fi - done - - if test x"$ac_exists" = xtrue; then - : -else - ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" -fi - - ;; - -bI:*) - ac_exists=false - for ac_i in $ac_cv_f77_libs; do - if test x"$ac_arg" = x"$ac_i"; then - ac_exists=true - break - fi - done - - if test x"$ac_exists" = xtrue; then - : -else - if test "$ac_compiler_gnu" = yes; then - for ac_link_opt in $ac_arg; do - ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" - done -else - ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" -fi -fi - - ;; - # Ignore these flags. - -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -LANG:=* | -LIST:* | -LNO:*) - ;; - -lkernel32) - test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" - ;; - -[LRuYz]) - # These flags, when seen by themselves, take an argument. - # We remove the space between option and argument and re-iterate - # unless we find an empty arg or a new option (starting with -) - case $2 in - "" | -*);; - *) - ac_arg="$ac_arg$2" - shift; shift - set X $ac_arg "$@" - ;; - esac - ;; - -YP,*) - for ac_j in `$as_echo "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do - ac_exists=false - for ac_i in $ac_cv_f77_libs; do - if test x"$ac_j" = x"$ac_i"; then - ac_exists=true - break - fi - done - - if test x"$ac_exists" = xtrue; then - : -else - ac_arg="$ac_arg $ac_j" - ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" -fi - - done - ;; - -[lLR]*) - ac_exists=false - for ac_i in $ac_cv_f77_libs; do - if test x"$ac_arg" = x"$ac_i"; then - ac_exists=true - break - fi - done - - if test x"$ac_exists" = xtrue; then - : -else - ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" -fi - - ;; - -zallextract*| -zdefaultextract) - ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" - ;; - # Ignore everything else. - esac -done -# restore positional arguments -set X $ac_save_positional; shift - -# We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, -# then we insist that the "run path" must be an absolute path (i.e. it -# must begin with a "/"). -case `(uname -sr) 2>/dev/null` in - "SunOS 5"*) - ac_ld_run_path=`$as_echo "$ac_f77_v_output" | - sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` - test "x$ac_ld_run_path" != x && - if test "$ac_compiler_gnu" = yes; then - for ac_link_opt in $ac_ld_run_path; do - ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" - done -else - ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path" -fi - ;; -esac -fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_libs" >&5 -$as_echo "$ac_cv_f77_libs" >&6; } -FLIBS="$ac_cv_f77_libs" - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Split FLIBS into the LIB_PATH part (FLIBS_PATH) and the LIB_NAME part (FLIBS_NAME) -if test -n "${FLIBS}"; then - for i in ${FLIBS}; do - case "$i" in - -L*) FLIBS_PATH="${FLIBS_PATH} $i" ;; - *) FLIBS_NAME="${FLIBS_NAME} $i" ;; - esac - done -fi - -LIB_NAME="${LIB_NAME} ${FLIBS_NAME}" -LIB_PATH="${LIB_PATH} ${FLIBS_PATH}" - - -btng_log_vars="FLIBS FLIBS_PATH FLIBS_NAME" -for btng_log_vars_index in $btng_log_vars ; do - eval "test \"\${${btng_log_vars_index}+set}\" = set" - if test $? = 0; then - btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; - else - btng_log_vars_value="unset"; - fi - echo "configure:13881:" "after using ac_f77_library_ldflags: $btng_log_vars_index is $btng_log_vars_value" >&5; -done - - - - - - -# Begin macro CASC_SUPPORT_NSL - - -# Start macro CASC_ARG_WITH_ENV_WRAPPER with args nsl and nsl_PREFIX -{ $as_echo "$as_me:$LINENO: checking for nsl" >&5 -$as_echo_n "checking for nsl... " >&6; } -if test "${btng_cv_prog_nsl+set}" = set; then - $as_echo_n "(cached) " >&6 -else - - -# Check whether --with-nsl was given. -if test "${with_nsl+set}" = set; then - withval=$with_nsl; -fi - -# Set nsl_PREFIX, using environment setting if available -# and if command line is ambiguous. -case "$with_nsl" in - no) - # User explictly turned off nsl. - # Ignore value of nsl_PREFIX, even if set in the environment. - unset nsl_PREFIX - ;; - yes|'') - # Flag unissued or ambiguously issued using --with-nsl. - # Because the user did not explicitly turn if off, - # try to set nsl_PREFIX. - # If environment variable nsl_PREFIX is available, use it. - # If not, try the user-supplied commands to set it. - if test -n "${nsl_PREFIX}" ; then - : Nothing to do here actually, because nsl_PREFIX is already in the environment. - else - nsl_PREFIX= - fi - ;; - *) - # User issued a specific string using --with-nsl=non-null-string. - # so that is used to set nsl_PREFIX. - nsl_PREFIX=$with_nsl - ;; -esac -if test "${nsl_PREFIX+set}" = set ; then - # This block executes the quality check commands, if any, for nsl_PREFIX. - : -fi -# Cache the value if it was found. -if test "${nsl_PREFIX+set}" = set ; then - btng_cv_prog_nsl=${nsl_PREFIX} -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $btng_cv_prog_nsl" >&5 -$as_echo "$btng_cv_prog_nsl" >&6; } -# Set nsl_PREFIX from cache. -# nsl_PREFIX is not yet set if we grabbed it from cache. -if test "${btng_cv_prog_nsl+set}" = set ; then - nsl_PREFIX=$btng_cv_prog_nsl -else - unset nsl_PREFIX -fi -# End macro CASC_ARG_WITH_ENV_WRAPPER with args nsl_PREFIX and nsl - - - -btng_log_vars="nsl_PREFIX nsl_INCLUDES nsl_LIBS" -for btng_log_vars_index in $btng_log_vars ; do - eval "test \"\${${btng_log_vars_index}+set}\" = set" - if test $? = 0; then - btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; - else - btng_log_vars_value="unset"; - fi - echo "configure:13962:" "before looking: $btng_log_vars_index is $btng_log_vars_value" >&5; -done +btng_log_vars="nsl_PREFIX nsl_INCLUDES nsl_LIBS" +for btng_log_vars_index in $btng_log_vars ; do + eval "test \"\${${btng_log_vars_index}+set}\" = set" + if test $? = 0; then + btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; + else + btng_log_vars_value="unset"; + fi + echo "configure:13721:" "before looking: $btng_log_vars_index is $btng_log_vars_value" >&5; +done @@ -14002,7 +13761,7 @@ case "$with_nsl_includes" in $as_echo "$as_me: error: If you specify --with-nsl-includes, you must give it the path as in --with-nsl-includes=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14005:" environment nsl_INCLUDES not defined >&5 +echo "configure:13764:" environment nsl_INCLUDES not defined >&5 fi @@ -14073,7 +13832,7 @@ case "$with_nsl_libs" in $as_echo "$as_me: error: If you specify --with-nsl-libs, you must give it the path as in --with-nsl-libs=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14076:" environment nsl_LIBS not defined >&5 +echo "configure:13835:" environment nsl_LIBS not defined >&5 fi @@ -14224,7 +13983,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14227:" "After finding nsl flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:13986:" "After finding nsl flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14242,7 +14001,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14245:" "Found nsl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14004:" "Found nsl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14260,7 +14019,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14263:" "Did not find nsl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14022:" "Did not find nsl library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14271,7 +14030,7 @@ fi unset btng_extra_libs unset btng_save_LIBS else - echo "configure:14274:" Not looking for nsl because nsl_LIBS is already set >&5 + echo "configure:14033:" Not looking for nsl because nsl_LIBS is already set >&5 fi fi @@ -14403,7 +14162,7 @@ case "$with_blas_includes" in $as_echo "$as_me: error: If you specify --with-blas-includes, you must give it the path as in --with-blas-includes=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14406:" environment blas_INCLUDES not defined >&5 +echo "configure:14165:" environment blas_INCLUDES not defined >&5 fi @@ -14474,7 +14233,7 @@ case "$with_blas_libs" in $as_echo "$as_me: error: If you specify --with-blas-libs, you must give it the path as in --with-blas-libs=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14477:" environment blas_LIBS not defined >&5 +echo "configure:14236:" environment blas_LIBS not defined >&5 fi @@ -14625,7 +14384,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14628:" "After finding blas flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14387:" "After finding blas flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14643,7 +14402,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14646:" "Found blas library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14405:" "Found blas library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14661,7 +14420,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14664:" "Did not find blas library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14423:" "Did not find blas library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14679,7 +14438,7 @@ fi unset btng_extra_libs unset btng_save_LIBS else - echo "configure:14682:" Not looking for blas because blas_LIBS is already set >&5 + echo "configure:14441:" Not looking for blas because blas_LIBS is already set >&5 fi fi @@ -14694,7 +14453,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14697:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14456:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14733,7 +14492,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:14736:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14495:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -14846,7 +14605,7 @@ case "$with_lapack_includes" in $as_echo "$as_me: error: If you specify --with-lapack-includes, you must give it the path as in --with-lapack-includes=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14849:" environment lapack_INCLUDES not defined >&5 +echo "configure:14608:" environment lapack_INCLUDES not defined >&5 fi @@ -14917,7 +14676,7 @@ case "$with_lapack_libs" in $as_echo "$as_me: error: If you specify --with-lapack-libs, you must give it the path as in --with-lapack-libs=/installation/path" >&2;} { (exit 1); exit 1; }; } fi -echo "configure:14920:" environment lapack_LIBS not defined >&5 +echo "configure:14679:" environment lapack_LIBS not defined >&5 fi @@ -15068,7 +14827,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:15071:" "After finding lapack flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14830:" "After finding lapack flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -15086,7 +14845,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:15089:" "Found lapack library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14848:" "Found lapack library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -15104,7 +14863,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:15107:" "Did not find lapack library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14866:" "Did not find lapack library flag: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -15122,7 +14881,7 @@ fi unset btng_extra_libs unset btng_save_LIBS else - echo "configure:15125:" Not looking for lapack because lapack_LIBS is already set >&5 + echo "configure:14884:" Not looking for lapack because lapack_LIBS is already set >&5 fi fi @@ -15137,7 +14896,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:15140:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14899:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -15176,7 +14935,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:15179:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:14938:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -15189,17 +14948,24 @@ if test "${with_mpi+set}" = set; then fi if test "$with_mpi" = no; then - { $as_echo "$as_me:$LINENO: NOTIFICATION: SAMRAI configured without the MPI library" >&5 + if test -z "`echo $CXX:t | grep mpi`" ; then + { $as_echo "$as_me:$LINENO: NOTIFICATION: SAMRAI configured without the MPI library" >&5 $as_echo "$as_me: NOTIFICATION: SAMRAI configured without the MPI library" >&6;} cat >>confdefs.h <<\_ACEOF #define LACKS_MPI 1 _ACEOF + else + { { $as_echo "$as_me:$LINENO: error: You have specified a non-mpi build but are using an mpi compiler wrapper with is contradictory." >&5 +$as_echo "$as_me: error: You have specified a non-mpi build but are using an mpi compiler wrapper with is contradictory." >&2;} + { (exit 1); exit 1; }; } + fi else - case $ARCH in - alpha) + if test -z "`echo $CXX:t | grep mpi`" ; then + case $ARCH in + alpha) casc_find_mpi_cache_used=yes @@ -15334,8 +15100,8 @@ $as_echo "$MPIFLAGS" >&6; } fi - ;; - *) + ;; + *) casc_find_mpi_cache_used=yes @@ -16935,19 +16701,19 @@ fi - ;; - esac + ;; + esac - if test -n "$MPIINCLUDE" -o -n "$MPILIBS" -o -n "$MPILIBDIRS"; then - with_mpi=yes + if test -n "$MPIINCLUDE" -o -n "$MPILIBS" -o -n "$MPILIBDIRS"; then + with_mpi=yes cat >>confdefs.h <<\_ACEOF #define HAVE_MPI 1 _ACEOF - INC_PATH="$MPIINCLUDE $INC_PATH" - LIB_NAME="$MPILIBS $LIB_NAME" - LIB_PATH="$MPILIBDIRS $LIB_PATH" + INC_PATH="$MPIINCLUDE $INC_PATH" + LIB_NAME="$MPILIBS $LIB_NAME" + LIB_PATH="$MPILIBDIRS $LIB_PATH" btng_log_vars="MPIINCLUDE MPILIBS MPILIBDIRS" @@ -16958,10 +16724,20 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:16961:" "After successfully finding MPI using casc_find_mpi: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:16727:" "After successfully finding MPI using casc_find_mpi: $btng_log_vars_index is $btng_log_vars_value" >&5; done + CONFIGURED_WITH_MPI="with_mpi" + + fi + else + with_mpi=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MPI 1 +_ACEOF + CONFIGURED_WITH_MPI="with_mpi" fi @@ -16976,7 +16752,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:16979:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:16755:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -17976,7 +17752,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:17979:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:17755:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18072,10 +17848,95 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18075:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:17851:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done +# Defines ptscotch_PREFIX ptscotch_INCLUDES and ptscotch_LIBS. + +# Check whether --with-ptscotch was given. +if test "${with_ptscotch+set}" = set; then + withval=$with_ptscotch; +else + with_ptscotch=no +fi + + +case "$with_ptscotch" in + no) + : Do nothing + ;; + yes) + # PT-SCOTCH install path was not specified. + # Look in a couple of standard locations to probe if + # PT-SCOTCH header files are there. + { $as_echo "$as_me:$LINENO: checking for PT-SCOTCH installation" >&5 +$as_echo_n "checking for PT-SCOTCH installation... " >&6; } + for dir in /usr /usr/local; do + if test -f ${dir}/ptscotch/include/ptscotch.h; then + ptscotch_PREFIX=${dir} + break + fi + done + { $as_echo "$as_me:$LINENO: result: $ptscotch_PREFIX" >&5 +$as_echo "$ptscotch_PREFIX" >&6; } + ;; + *) + # PT-SCOTCH install path was specified. + { $as_echo "$as_me:$LINENO: checking for PT-SCOTCH installation" >&5 +$as_echo_n "checking for PT-SCOTCH installation... " >&6; } + + if test -f ${with_ptscotch}/include/ptscotch.h; then + ptscotch_PREFIX=$with_ptscotch + ptscotch_INCLUDES="-I${ptscotch_PREFIX}/include" + ptscotch_LIBS="-L${ptscotch_PREFIX}/lib -lptscotch -lptscotcherr -lscotch -lscotcherr" + { $as_echo "$as_me:$LINENO: result: $ptscotch_PREFIX" >&5 +$as_echo "$ptscotch_PREFIX" >&6; } + else + { $as_echo "$as_me:$LINENO: result: $ptscotch_PREFIX" >&5 +$as_echo "$ptscotch_PREFIX" >&6; } + { { $as_echo "$as_me:$LINENO: error: PT-SCOTCH not found in $with_ptscotch" >&5 +$as_echo "$as_me: error: PT-SCOTCH not found in $with_ptscotch" >&2;} + { (exit 1); exit 1; }; } + fi + ;; +esac +if test "${ptscotch_PREFIX+set}" = set; then + +# Split ptscotch_LIBS into the LIB_PATH part (ptscotch_LIB_PATH) and the LIB_NAME part (ptscotch_LIB_NAME) +if test -n "${ptscotch_LIBS}"; then + for i in ${ptscotch_LIBS}; do + case "$i" in + -L*) ptscotch_LIB_PATH="${ptscotch_LIB_PATH} $i" ;; + *) ptscotch_LIB_NAME="${ptscotch_LIB_NAME} $i" ;; + esac + done +fi + + LIB_PATH="$ptscotch_LIB_PATH $LIB_PATH" + LIB_NAME="$ptscotch_LIB_NAME $LIB_NAME" + INC_PATH="$ptscotch_INCLUDES $INC_PATH" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PTSCOTCH 1 +_ACEOF + +fi + + +btng_log_vars="ptscotch_INCLUDES INC_PATH ptscotch_LIBS LIB_PATH LIB_NAME" +for btng_log_vars_index in $btng_log_vars ; do + eval "test \"\${${btng_log_vars_index}+set}\" = set" + if test $? = 0; then + btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; + else + btng_log_vars_value="unset"; + fi + echo "configure:17935:" "$btng_log_vars_index is $btng_log_vars_value" >&5; +done + + + # Begin SAMRAI_SUPPORT_TBB @@ -18335,7 +18196,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18338:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18199:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done fi @@ -18349,7 +18210,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18352:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18213:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18464,7 +18325,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18467:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18328:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18566,7 +18427,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18569:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18430:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18585,7 +18446,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18588:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18449:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18769,7 +18630,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18772:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18633:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18783,7 +18644,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18786:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18647:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18823,7 +18684,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18826:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18687:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -18927,7 +18788,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:18930:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18791:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -19052,163 +18913,10 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19055:" "$btng_log_vars_index is $btng_log_vars_value" >&5; -done - - - -# Set PETSC_ARCH. - -# Start macro CASC_ARG_WITH_PREFIX - -# Start macro CASC_ARG_WITH_ENV_WRAPPER with args petsc-arch and PETSC_ARCH -{ $as_echo "$as_me:$LINENO: checking for petsc-arch" >&5 -$as_echo_n "checking for petsc-arch... " >&6; } -if test "${btng_cv_prog_petsc_arch+set}" = set; then - $as_echo_n "(cached) " >&6 -else - - -# Check whether --with-petsc-arch was given. -if test "${with_petsc_arch+set}" = set; then - withval=$with_petsc_arch; -fi - -# Set PETSC_ARCH, using environment setting if available -# and if command line is ambiguous. -case "$with_petsc_arch" in - no) - # User explictly turned off petsc-arch. - # Ignore value of PETSC_ARCH, even if set in the environment. - unset PETSC_ARCH - ;; - yes|'') - # Flag unissued or ambiguously issued using --with-petsc-arch. - # Because the user did not explicitly turn if off, - # try to set PETSC_ARCH. - # If environment variable PETSC_ARCH is available, use it. - # If not, try the user-supplied commands to set it. - if test -n "${PETSC_ARCH}" ; then - : Nothing to do here actually, because PETSC_ARCH is already in the environment. - else - if test "${with_petsc_arch}" = yes ; then - { { $as_echo "$as_me:$LINENO: error: If you specify --with-petsc-arch, you must give it the path as in --with-petsc-arch=/installation/path" >&5 -$as_echo "$as_me: error: If you specify --with-petsc-arch, you must give it the path as in --with-petsc-arch=/installation/path" >&2;} - { (exit 1); exit 1; }; } -fi -echo "configure:19099:" environment PETSC_ARCH not defined >&5 - - - fi - ;; - *) - # User issued a specific string using --with-petsc-arch=non-null-string. - # so that is used to set PETSC_ARCH. - PETSC_ARCH=$with_petsc_arch - ;; -esac -if test "${PETSC_ARCH+set}" = set ; then - # This block executes the quality check commands, if any, for PETSC_ARCH. - : -fi -# Cache the value if it was found. -if test "${PETSC_ARCH+set}" = set ; then - btng_cv_prog_petsc_arch=${PETSC_ARCH} -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $btng_cv_prog_petsc_arch" >&5 -$as_echo "$btng_cv_prog_petsc_arch" >&6; } -# Set PETSC_ARCH from cache. -# PETSC_ARCH is not yet set if we grabbed it from cache. -if test "${btng_cv_prog_petsc_arch+set}" = set ; then - PETSC_ARCH=$btng_cv_prog_petsc_arch -else - unset PETSC_ARCH -fi -# End macro CASC_ARG_WITH_ENV_WRAPPER with args PETSC_ARCH and petsc-arch -# End macro CASC_ARG_WITH_PREFIX - - -# Set PETSC_OPTIMIZE. - -# Start macro CASC_ARG_WITH_ENV_WRAPPER with args petsc-optimize and PETSC_OPTIMIZE -{ $as_echo "$as_me:$LINENO: checking for petsc-optimize" >&5 -$as_echo_n "checking for petsc-optimize... " >&6; } -if test "${btng_cv_prog_petsc_optimize+set}" = set; then - $as_echo_n "(cached) " >&6 -else - - -# Check whether --with-petsc-optimize was given. -if test "${with_petsc_optimize+set}" = set; then - withval=$with_petsc_optimize; -fi - -# Set PETSC_OPTIMIZE, using environment setting if available -# and if command line is ambiguous. -case "$with_petsc_optimize" in - no) - # User explictly turned off petsc-optimize. - # Ignore value of PETSC_OPTIMIZE, even if set in the environment. - unset PETSC_OPTIMIZE - ;; - yes|'') - # Flag unissued or ambiguously issued using --with-petsc-optimize. - # Because the user did not explicitly turn if off, - # try to set PETSC_OPTIMIZE. - # If environment variable PETSC_OPTIMIZE is available, use it. - # If not, try the user-supplied commands to set it. - if test -n "${PETSC_OPTIMIZE}" ; then - : Nothing to do here actually, because PETSC_OPTIMIZE is already in the environment. - else - # By default, use the debug PETSC library. -PETSC_OPTIMIZE=g - - -btng_log_vars="with_petsc_optimize" -for btng_log_vars_index in $btng_log_vars ; do - eval "test \"\${${btng_log_vars_index}+set}\" = set" - if test $? = 0; then - btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; - else - btng_log_vars_value="unset"; - fi - echo "configure:19177:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:18916:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done -test "$with_petsc_optimize" = yes && PETSC_OPTIMIZE=O - - fi - ;; - *) - # User issued a specific string using --with-petsc-optimize=non-null-string. - # so that is used to set PETSC_OPTIMIZE. - PETSC_OPTIMIZE=$with_petsc_optimize - ;; -esac -if test "${PETSC_OPTIMIZE+set}" = set ; then - # This block executes the quality check commands, if any, for PETSC_OPTIMIZE. - : -fi -# Cache the value if it was found. -if test "${PETSC_OPTIMIZE+set}" = set ; then - btng_cv_prog_petsc_optimize=${PETSC_OPTIMIZE} -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $btng_cv_prog_petsc_optimize" >&5 -$as_echo "$btng_cv_prog_petsc_optimize" >&6; } -# Set PETSC_OPTIMIZE from cache. -# PETSC_OPTIMIZE is not yet set if we grabbed it from cache. -if test "${btng_cv_prog_petsc_optimize+set}" = set ; then - PETSC_OPTIMIZE=$btng_cv_prog_petsc_optimize -else - unset PETSC_OPTIMIZE -fi -# End macro CASC_ARG_WITH_ENV_WRAPPER with args PETSC_OPTIMIZE and petsc-optimize - # Set PETSC_MPIUNI. @@ -19293,53 +19001,16 @@ if test "${PETSC_DIR+set}" = set; then $as_echo "$as_me: WARNING: PETSC directory ($PETSC_DIR) does not look right" >&2;} fi export PETSC_DIR - if test -z "$PETSC_ARCH"; then - if test -f "$PETSC_DIR/bmake/petscconf"; then - eval `grep PETSC_ARCH $PETSC_DIR/bmake/petscconf` - elif test -x "$PETSC_DIR/bin/petscarch"; then - PETSC_ARCH=`$PETSC_DIR/bin/petscarch` - else - { $as_echo "$as_me:$LINENO: WARNING: PETSC could not determine PETSC_ARCH" >&5 -$as_echo "$as_me: WARNING: PETSC could not determine PETSC_ARCH" >&2;} - fi - export PETSC_ARCH - fi - - -btng_log_vars="PETSC_ARCH" -for btng_log_vars_index in $btng_log_vars ; do - eval "test \"\${${btng_log_vars_index}+set}\" = set" - if test $? = 0; then - btng_log_vars_value="'`eval echo \\${$btng_log_vars_index}`'"; - else - btng_log_vars_value="unset"; - fi - echo "configure:19317:" "$btng_log_vars_index is $btng_log_vars_value" >&5; -done - - if test ! -d "$PETSC_DIR/bmake/$PETSC_ARCH"; then - { $as_echo "$as_me:$LINENO: WARNING: PETSC architecture ($PETSC_ARCH) does not look right" >&5 -$as_echo "$as_me: WARNING: PETSC architecture ($PETSC_ARCH) does not look right" >&2;} - fi - if test ! "$PETSC_OPTIMIZE" = g && test ! "$PETSC_OPTIMIZE" = O; then - { { $as_echo "$as_me:$LINENO: error: PETSC optimize should be either g or O" >&5 -$as_echo "$as_me: error: PETSC optimize should be either g or O" >&2;} - { (exit 1); exit 1; }; } - fi - - petsc_INCLUDES="-I$PETSC_DIR/include -I$PETSC_DIR/bmake/$PETSC_ARCH" - petsc_INCLUDES="$petsc_INCLUDES -I$PETSC_DIR/src/vec" + petsc_INCLUDES="-I$PETSC_DIR/include" # Currently, I'm not entirely sure why we have to explicitly specify # the src/vec directory in the include path. But there is at least # one required file there that cannot be found in the include directory. # SGS Support latter version of PETSc # Try new structure and then old - if test -d "${PETSC_DIR}/lib/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/${PETSC_ARCH}" - elif test -d "${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}"; then - petsc_LIBDIR="${PETSC_DIR}/lib/lib${PETSC_OPTIMIZE}/${PETSC_ARCH}" + if test -d "${PETSC_DIR}/lib"; then + petsc_LIBDIR="${PETSC_DIR}/lib" else { $as_echo "$as_me:$LINENO: WARNING: PETSC lib directory does not look as expected" >&5 $as_echo "$as_me: WARNING: PETSC lib directory does not look as expected" >&2;} @@ -19356,7 +19027,7 @@ $as_echo "$as_me: WARNING: PETSC lib directory does not look as expected" >&2;} if test -n "$petsc_libs_ls1"; then unset petsc_libs_ls for i in $petsc_libs_ls1; do - j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so$//'` + j=`echo $i | sed -e 's/lib//' -e 's/\.a$//' -e 's/\.so.*//'` if echo "$petsc_libs_ls" | grep -v " $j " > /dev/null; then # Note padding! petsc_libs_ls="$petsc_libs_ls $j "; # Note space padding! fi @@ -19382,7 +19053,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19385:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:19056:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -19401,7 +19072,7 @@ done -btng_log_vars="PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_OPTIMIZE PETSC_MPIUNI" +btng_log_vars="PETSC_DIR petsc_INCLUDES petsc_LIBS PETSC_MPIUNI" for btng_log_vars_index in $btng_log_vars ; do eval "test \"\${${btng_log_vars_index}+set}\" = set" if test $? = 0; then @@ -19409,7 +19080,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19412:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:19083:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -19437,15 +19108,15 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_PETSC 1 _ACEOF - if test $PETSC_VERSION_MAJOR -ne 2 || \ - test $PETSC_VERSION_MINOR -ne 3 || \ - test $PETSC_VERSION_SUBMINOR -ne 3 ; then + if test $PETSC_VERSION_MAJOR -ne 3 || \ + test $PETSC_VERSION_MINOR -ne 2 || \ + test $PETSC_VERSION_SUBMINOR -ne 0 ; then { $as_echo "$as_me:$LINENO: WARNING: -SAMRAI requires PETSc-2.3.3. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR +SAMRAI requires PETSc-3.2.0. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR which may not work properly! " >&5 $as_echo "$as_me: WARNING: -SAMRAI requires PETSc-2.3.3. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR +SAMRAI requires PETSc-3.2.0. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR which may not work properly! " >&2;} fi @@ -19551,7 +19222,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19554:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:19225:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -19621,7 +19292,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19624:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:19295:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -19684,9 +19355,9 @@ cat >>confdefs.h <<\_ACEOF #define NAN_IS_BROKEN 1 _ACEOF -echo "configure:19687:" "NAN is broken (not in float.h)" >&5 +echo "configure:19358:" "NAN is broken (not in float.h)" >&5 else - echo "configure:19689:" "NAN is ok (in float.h)" >&5 + echo "configure:19360:" "NAN is ok (in float.h)" >&5 fi rm -f conftest* @@ -19710,9 +19381,9 @@ cat >>confdefs.h <<\_ACEOF #define FLT_SNAN_IS_BROKEN 1 _ACEOF -echo "configure:19713:" "FLT_NAN is broken (not in float.h)" >&5 +echo "configure:19384:" "FLT_NAN is broken (not in float.h)" >&5 else - echo "configure:19715:" "FLT_NAN is ok (in float.h)" >&5 + echo "configure:19386:" "FLT_NAN is ok (in float.h)" >&5 fi rm -f conftest* @@ -19736,9 +19407,9 @@ cat >>confdefs.h <<\_ACEOF #define DBL_SNAN_IS_BROKEN 1 _ACEOF -echo "configure:19739:" "DBL_NAN is broken (not in float.h)" >&5 +echo "configure:19410:" "DBL_NAN is broken (not in float.h)" >&5 else - echo "configure:19741:" "DBL_NAN is ok (in float.h)" >&5 + echo "configure:19412:" "DBL_NAN is ok (in float.h)" >&5 fi rm -f conftest* @@ -19762,9 +19433,9 @@ cat >>confdefs.h <<\_ACEOF #define FLT_MAX_IS_BROKEN 1 _ACEOF -echo "configure:19765:" "FLT_MAX is broken (not in float.h)" >&5 +echo "configure:19436:" "FLT_MAX is broken (not in float.h)" >&5 else - echo "configure:19767:" "FLT_MAX is ok (in float.h)" >&5 + echo "configure:19438:" "FLT_MAX is ok (in float.h)" >&5 fi rm -f conftest* @@ -19788,9 +19459,9 @@ cat >>confdefs.h <<\_ACEOF #define DBL_MAX_IS_BROKEN 1 _ACEOF -echo "configure:19791:" "DBL_MAX is broken (not in float.h)" >&5 +echo "configure:19462:" "DBL_MAX is broken (not in float.h)" >&5 else - echo "configure:19793:" "DBL_MAX is ok (in float.h)" >&5 + echo "configure:19464:" "DBL_MAX is ok (in float.h)" >&5 fi rm -f conftest* @@ -19843,7 +19514,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:19846:" "before adding rpath syntax: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:19517:" "before adding rpath syntax: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20350,7 +20021,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20353:" "forming rpaths: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20024:" "forming rpaths: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20416,7 +20087,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20419:" "after adding rpath syntax: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20090:" "after adding rpath syntax: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20459,7 +20130,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20462:" "with-parallel-run-bin given: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20133:" "with-parallel-run-bin given: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20478,7 +20149,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20481:" "with-parallel-run-bin NOT given: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20152:" "with-parallel-run-bin NOT given: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20503,7 +20174,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20506:" "after setting PARALLEL_RUN_BIN: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20177:" "after setting PARALLEL_RUN_BIN: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20535,7 +20206,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20538:" "in support-serpa-run: $btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20209:" "in support-serpa-run: $btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20553,7 +20224,7 @@ ac_config_files="$ac_config_files config/serpa-run" case $CONFIGURED_WITH_MPI in with_mpi) - TEST_NPROCS='1,2' + TEST_NPROCS='1,2,4' ;; *) TEST_NPROCS='0' @@ -20595,6 +20266,8 @@ esac + + @@ -20607,12 +20280,7 @@ then test `pwd` = `cd "$srcdir" && pwd` && link_prefix='.unneeded_link.' -ac_config_links="$ac_config_links source/test/applications/ConvDiff/${link_prefix}example_inputs:source/test/applications/ConvDiff/example_inputs source/test/applications/ConvDiff/${link_prefix}test_inputs:source/test/applications/ConvDiff/test_inputs source/test/applications/Euler/${link_prefix}example_inputs:source/test/applications/Euler/example_inputs source/test/applications/Euler/${link_prefix}test_inputs:source/test/applications/Euler/test_inputs source/test/applications/LinAdv/${link_prefix}example_inputs:source/test/applications/LinAdv/example_inputs source/test/applications/LinAdv/${link_prefix}test_inputs:source/test/applications/LinAdv/test_inputs source/test/async_comm/${link_prefix}test_inputs:source/test/async_comm/test_inputs source/test/boundary/${link_prefix}test_inputs:source/test/boundary/test_inputs source/test/clustering/async_br/${link_prefix}test_inputs:source/test/clustering/async_br/test_inputs source/test/clustering/parallel_br/${link_prefix}test_inputs:source/test/clustering/parallel_br/test_inputs source/test/communication/${link_prefix}test_inputs:source/test/communication/test_inputs source/test/dataaccess/${link_prefix}test_inputs:source/test/dataaccess/test_inputs source/test/dlbg/${link_prefix}test_inputs:source/test/dlbg/test_inputs source/test/FAC_adaptive/${link_prefix}test_inputs:source/test/FAC_adaptive/test_inputs source/test/FAC_nonadaptive/${link_prefix}example_inputs:source/test/FAC_nonadaptive/example_inputs source/test/FAC_nonadaptive/${link_prefix}test_inputs:source/test/FAC_nonadaptive/test_inputs source/test/hierarchy/${link_prefix}test_inputs:source/test/hierarchy/test_inputs source/test/hypre/${link_prefix}test_inputs:source/test/hypre/test_inputs source/test/LoadBalanceCorrectness/${link_prefix}test_inputs:source/test/LoadBalanceCorrectness/test_inputs source/test/MappedBoxLevelConnectorUtilsTests/${link_prefix}test_inputs:source/test/MappedBoxLevelConnectorUtilsTests/test_inputs source/test/MappingConnector/${link_prefix}test_inputs:source/test/MappingConnector/test_inputs source/test/mblkcomm/${link_prefix}test_inputs:source/test/mblkcomm/test_inputs source/test/MblkEuler/${link_prefix}example_inputs:source/test/MblkEuler/example_inputs source/test/MblkEuler/${link_prefix}test_inputs:source/test/MblkEuler/test_inputs source/test/MblkLinAdv/${link_prefix}example_inputs:source/test/MblkLinAdv/example_inputs source/test/MblkLinAdv/${link_prefix}test_inputs:source/test/MblkLinAdv/test_inputs source/test/mblktree/${link_prefix}test_inputs:source/test/mblktree/test_inputs source/test/nonlinear/${link_prefix}test_inputs:source/test/nonlinear/test_inputs source/test/patchbdrysum/${link_prefix}example_inputs:source/test/patchbdrysum/example_inputs source/test/patchbdrysum/${link_prefix}test_inputs:source/test/patchbdrysum/test_inputs source/test/performance/Euler/${link_prefix}performance_inputs:source/test/performance/Euler/performance_inputs source/test/performance/Euler/${link_prefix}sample_inputs:source/test/performance/Euler/sample_inputs source/test/performance/LinAdv/${link_prefix}performance_inputs:source/test/performance/LinAdv/performance_inputs source/test/performance/LinAdv/${link_prefix}sample_inputs:source/test/performance/LinAdv/sample_inputs source/test/performance/LoadBalancers/${link_prefix}cube_inputs:source/test/performance/LoadBalancers/cube_inputs source/test/performance/LoadBalancers/${link_prefix}front_inputs:source/test/performance/LoadBalancers/front_inputs source/test/performance/LoadBalancers/${link_prefix}sphere_inputs:source/test/performance/LoadBalancers/sphere_inputs source/test/performance/LoadBalancers/${link_prefix}test_inputs:source/test/performance/LoadBalancers/test_inputs source/test/performance/MeshGeneration/${link_prefix}performance_inputs:source/test/performance/MeshGeneration/performance_inputs source/test/performance/MeshGeneration/${link_prefix}test_inputs:source/test/performance/MeshGeneration/test_inputs source/test/performance/multiblock/${link_prefix}test_inputs:source/test/performance/multiblock/test_inputs source/test/performance/treesearch/${link_prefix}test_inputs:source/test/performance/treesearch/test_inputs source/test/rank_group/${link_prefix}test_inputs:source/test/rank_group/test_inputs source/test/sparsedata/${link_prefix}test_inputs:source/test/sparsedata/test_inputs source/test/sundials/${link_prefix}example_inputs:source/test/sundials/example_inputs source/test/sundials/${link_prefix}test_inputs:source/test/sundials/test_inputs source/test/timers/${link_prefix}example_inputs:source/test/timers/example_inputs source/test/timers/${link_prefix}test_inputs:source/test/timers/test_inputs" - - - -test `pwd` = `cd "$srcdir" && pwd` && link_prefix='.unneeded_link.' -ac_config_links="$ac_config_links source/test/applications/Euler/${link_prefix}RP_test:source/test/applications/Euler/RP_test" +ac_config_links="$ac_config_links source/test/applications/ConvDiff/${link_prefix}example_inputs:source/test/applications/ConvDiff/example_inputs source/test/applications/ConvDiff/${link_prefix}test_inputs:source/test/applications/ConvDiff/test_inputs source/test/applications/Euler/${link_prefix}example_inputs:source/test/applications/Euler/example_inputs source/test/applications/Euler/${link_prefix}test_inputs:source/test/applications/Euler/test_inputs source/test/applications/LinAdv/${link_prefix}example_inputs:source/test/applications/LinAdv/example_inputs source/test/applications/LinAdv/${link_prefix}test_inputs:source/test/applications/LinAdv/test_inputs source/test/assumed_partition/${link_prefix}test_inputs:source/test/assumed_partition/test_inputs source/test/async_comm/${link_prefix}test_inputs:source/test/async_comm/test_inputs source/test/boundary/${link_prefix}test_inputs:source/test/boundary/test_inputs source/test/clustering/async_br/${link_prefix}test_inputs:source/test/clustering/async_br/test_inputs source/test/communication/${link_prefix}test_inputs:source/test/communication/test_inputs source/test/Connector/${link_prefix}test_inputs:source/test/Connector/test_inputs source/test/dataaccess/${link_prefix}test_inputs:source/test/dataaccess/test_inputs source/test/dlbg/${link_prefix}test_inputs:source/test/dlbg/test_inputs source/test/FAC_adaptive/${link_prefix}test_inputs:source/test/FAC_adaptive/test_inputs source/test/FAC_staticrefinement/${link_prefix}example_inputs:source/test/FAC_staticrefinement/example_inputs source/test/FAC_staticrefinement/${link_prefix}test_inputs:source/test/FAC_staticrefinement/test_inputs source/test/hierarchy/${link_prefix}test_inputs:source/test/hierarchy/test_inputs source/test/hypre/${link_prefix}test_inputs:source/test/hypre/test_inputs source/test/inputdb/${link_prefix}test_inputs:source/test/inputdb/test_inputs source/test/LoadBalanceCorrectness/${link_prefix}test_inputs:source/test/LoadBalanceCorrectness/test_inputs source/test/MappedBoxLevelConnectorUtilsTests/${link_prefix}test_inputs:source/test/MappedBoxLevelConnectorUtilsTests/test_inputs source/test/MappingConnector/${link_prefix}test_inputs:source/test/MappingConnector/test_inputs source/test/mblkcomm/${link_prefix}test_inputs:source/test/mblkcomm/test_inputs source/test/MblkEuler/${link_prefix}test_inputs:source/test/MblkEuler/test_inputs source/test/MblkLinAdv/${link_prefix}test_inputs:source/test/MblkLinAdv/test_inputs source/test/mblktree/${link_prefix}test_inputs:source/test/mblktree/test_inputs source/test/nonlinear/${link_prefix}performance_inputs:source/test/nonlinear/performance_inputs source/test/nonlinear/${link_prefix}test_inputs:source/test/nonlinear/test_inputs source/test/OverlapConnectorAlgorithm/${link_prefix}test_inputs:source/test/OverlapConnectorAlgorithm/test_inputs source/test/patchbdrysum/${link_prefix}test_inputs:source/test/patchbdrysum/test_inputs source/test/performance/Euler/${link_prefix}performance_inputs:source/test/performance/Euler/performance_inputs source/test/performance/LinAdv/${link_prefix}performance_inputs:source/test/performance/LinAdv/performance_inputs source/test/performance/LinAdv/${link_prefix}test_inputs:source/test/performance/LinAdv/test_inputs source/test/performance/MeshGeneration/${link_prefix}performance_inputs:source/test/performance/MeshGeneration/performance_inputs source/test/performance/MeshGeneration/${link_prefix}test_inputs:source/test/performance/MeshGeneration/test_inputs source/test/performance/multiblock/${link_prefix}performance_inputs:source/test/performance/multiblock/performance_inputs source/test/performance/TreeCommunication/${link_prefix}test_inputs:source/test/performance/TreeCommunication/test_inputs source/test/performance/treesearch/${link_prefix}test_inputs:source/test/performance/treesearch/test_inputs source/test/rank_group/${link_prefix}test_inputs:source/test/rank_group/test_inputs source/test/sundials/${link_prefix}test_inputs:source/test/sundials/test_inputs source/test/timers/${link_prefix}test_inputs:source/test/timers/test_inputs" fi @@ -20642,24 +20310,29 @@ source/SAMRAI/xfer source/test source/test/applications source/test/applications/ConvDiff +source/test/applications/ConvDiff/fortran source/test/applications/Euler +source/test/applications/Euler/fortran source/test/applications/LinAdv +source/test/applications/LinAdv/fortran +source/test/assumed_partition source/test/async_comm source/test/boundary source/test/clustering source/test/clustering/async_br -source/test/clustering/parallel_br source/test/communication +source/test/Connector source/test/dataaccess source/test/dataops source/test/dimension source/test/dlbg source/test/FAC_adaptive -source/test/FAC_nonadaptive +source/test/FAC_staticrefinement +source/test/FAC_staticrefinement/fortran source/test/fill_pattern source/test/hierarchy source/test/hypre -source/test/ieee +source/test/hypre/fortran source/test/indexdata source/test/inputdb source/test/LoadBalanceCorrectness @@ -20672,20 +20345,28 @@ source/test/MblkEuler source/test/MblkLinAdv source/test/mblktree source/test/nonlinear +source/test/nonlinear/fortran +source/test/OverlapConnectorAlgorithm source/test/patchbdrysum +source/test/patchbdrysum/fortran source/test/performance source/test/performance/Euler +source/test/performance/Euler/fortran source/test/performance/LinAdv -source/test/performance/LoadBalancers +source/test/performance/LinAdv/fortran source/test/performance/MeshGeneration source/test/performance/multiblock +source/test/performance/multiblock/fortran +source/test/performance/TreeCommunication source/test/performance/treesearch -source/test/pointer source/test/rank_group source/test/restartdb source/test/samrai_mpi source/test/sparsedata source/test/sundials +source/test/sundials/fortran +source/test/testlib +source/test/testlib/fortran source/test/timers source/test/transformation source/test/variables @@ -20706,7 +20387,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20709:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20390:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -20720,7 +20401,7 @@ for btng_log_vars_index in $btng_log_vars ; do else btng_log_vars_value="unset"; fi - echo "configure:20723:" "$btng_log_vars_index is $btng_log_vars_value" >&5; + echo "configure:20404:" "$btng_log_vars_index is $btng_log_vars_value" >&5; done @@ -21331,10 +21012,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Commands before creating links. -link_prefix="${link_prefix}" - - # Commands before creating links. link_prefix="${link_prefix}" @@ -21367,49 +21044,42 @@ do "source/test/applications/Euler/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/applications/Euler/${link_prefix}test_inputs:source/test/applications/Euler/test_inputs" ;; "source/test/applications/LinAdv/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/applications/LinAdv/${link_prefix}example_inputs:source/test/applications/LinAdv/example_inputs" ;; "source/test/applications/LinAdv/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/applications/LinAdv/${link_prefix}test_inputs:source/test/applications/LinAdv/test_inputs" ;; + "source/test/assumed_partition/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/assumed_partition/${link_prefix}test_inputs:source/test/assumed_partition/test_inputs" ;; "source/test/async_comm/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/async_comm/${link_prefix}test_inputs:source/test/async_comm/test_inputs" ;; "source/test/boundary/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/boundary/${link_prefix}test_inputs:source/test/boundary/test_inputs" ;; "source/test/clustering/async_br/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/clustering/async_br/${link_prefix}test_inputs:source/test/clustering/async_br/test_inputs" ;; - "source/test/clustering/parallel_br/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/clustering/parallel_br/${link_prefix}test_inputs:source/test/clustering/parallel_br/test_inputs" ;; "source/test/communication/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/communication/${link_prefix}test_inputs:source/test/communication/test_inputs" ;; + "source/test/Connector/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/Connector/${link_prefix}test_inputs:source/test/Connector/test_inputs" ;; "source/test/dataaccess/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/dataaccess/${link_prefix}test_inputs:source/test/dataaccess/test_inputs" ;; "source/test/dlbg/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/dlbg/${link_prefix}test_inputs:source/test/dlbg/test_inputs" ;; "source/test/FAC_adaptive/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/FAC_adaptive/${link_prefix}test_inputs:source/test/FAC_adaptive/test_inputs" ;; - "source/test/FAC_nonadaptive/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/FAC_nonadaptive/${link_prefix}example_inputs:source/test/FAC_nonadaptive/example_inputs" ;; - "source/test/FAC_nonadaptive/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/FAC_nonadaptive/${link_prefix}test_inputs:source/test/FAC_nonadaptive/test_inputs" ;; + "source/test/FAC_staticrefinement/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/FAC_staticrefinement/${link_prefix}example_inputs:source/test/FAC_staticrefinement/example_inputs" ;; + "source/test/FAC_staticrefinement/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/FAC_staticrefinement/${link_prefix}test_inputs:source/test/FAC_staticrefinement/test_inputs" ;; "source/test/hierarchy/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/hierarchy/${link_prefix}test_inputs:source/test/hierarchy/test_inputs" ;; "source/test/hypre/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/hypre/${link_prefix}test_inputs:source/test/hypre/test_inputs" ;; + "source/test/inputdb/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/inputdb/${link_prefix}test_inputs:source/test/inputdb/test_inputs" ;; "source/test/LoadBalanceCorrectness/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/LoadBalanceCorrectness/${link_prefix}test_inputs:source/test/LoadBalanceCorrectness/test_inputs" ;; "source/test/MappedBoxLevelConnectorUtilsTests/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MappedBoxLevelConnectorUtilsTests/${link_prefix}test_inputs:source/test/MappedBoxLevelConnectorUtilsTests/test_inputs" ;; "source/test/MappingConnector/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MappingConnector/${link_prefix}test_inputs:source/test/MappingConnector/test_inputs" ;; "source/test/mblkcomm/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/mblkcomm/${link_prefix}test_inputs:source/test/mblkcomm/test_inputs" ;; - "source/test/MblkEuler/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MblkEuler/${link_prefix}example_inputs:source/test/MblkEuler/example_inputs" ;; "source/test/MblkEuler/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MblkEuler/${link_prefix}test_inputs:source/test/MblkEuler/test_inputs" ;; - "source/test/MblkLinAdv/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MblkLinAdv/${link_prefix}example_inputs:source/test/MblkLinAdv/example_inputs" ;; "source/test/MblkLinAdv/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/MblkLinAdv/${link_prefix}test_inputs:source/test/MblkLinAdv/test_inputs" ;; "source/test/mblktree/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/mblktree/${link_prefix}test_inputs:source/test/mblktree/test_inputs" ;; + "source/test/nonlinear/${link_prefix}performance_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/nonlinear/${link_prefix}performance_inputs:source/test/nonlinear/performance_inputs" ;; "source/test/nonlinear/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/nonlinear/${link_prefix}test_inputs:source/test/nonlinear/test_inputs" ;; - "source/test/patchbdrysum/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/patchbdrysum/${link_prefix}example_inputs:source/test/patchbdrysum/example_inputs" ;; + "source/test/OverlapConnectorAlgorithm/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/OverlapConnectorAlgorithm/${link_prefix}test_inputs:source/test/OverlapConnectorAlgorithm/test_inputs" ;; "source/test/patchbdrysum/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/patchbdrysum/${link_prefix}test_inputs:source/test/patchbdrysum/test_inputs" ;; "source/test/performance/Euler/${link_prefix}performance_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/Euler/${link_prefix}performance_inputs:source/test/performance/Euler/performance_inputs" ;; - "source/test/performance/Euler/${link_prefix}sample_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/Euler/${link_prefix}sample_inputs:source/test/performance/Euler/sample_inputs" ;; "source/test/performance/LinAdv/${link_prefix}performance_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LinAdv/${link_prefix}performance_inputs:source/test/performance/LinAdv/performance_inputs" ;; - "source/test/performance/LinAdv/${link_prefix}sample_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LinAdv/${link_prefix}sample_inputs:source/test/performance/LinAdv/sample_inputs" ;; - "source/test/performance/LoadBalancers/${link_prefix}cube_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LoadBalancers/${link_prefix}cube_inputs:source/test/performance/LoadBalancers/cube_inputs" ;; - "source/test/performance/LoadBalancers/${link_prefix}front_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LoadBalancers/${link_prefix}front_inputs:source/test/performance/LoadBalancers/front_inputs" ;; - "source/test/performance/LoadBalancers/${link_prefix}sphere_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LoadBalancers/${link_prefix}sphere_inputs:source/test/performance/LoadBalancers/sphere_inputs" ;; - "source/test/performance/LoadBalancers/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LoadBalancers/${link_prefix}test_inputs:source/test/performance/LoadBalancers/test_inputs" ;; + "source/test/performance/LinAdv/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/LinAdv/${link_prefix}test_inputs:source/test/performance/LinAdv/test_inputs" ;; "source/test/performance/MeshGeneration/${link_prefix}performance_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/MeshGeneration/${link_prefix}performance_inputs:source/test/performance/MeshGeneration/performance_inputs" ;; "source/test/performance/MeshGeneration/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/MeshGeneration/${link_prefix}test_inputs:source/test/performance/MeshGeneration/test_inputs" ;; - "source/test/performance/multiblock/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/multiblock/${link_prefix}test_inputs:source/test/performance/multiblock/test_inputs" ;; + "source/test/performance/multiblock/${link_prefix}performance_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/multiblock/${link_prefix}performance_inputs:source/test/performance/multiblock/performance_inputs" ;; + "source/test/performance/TreeCommunication/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/TreeCommunication/${link_prefix}test_inputs:source/test/performance/TreeCommunication/test_inputs" ;; "source/test/performance/treesearch/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/performance/treesearch/${link_prefix}test_inputs:source/test/performance/treesearch/test_inputs" ;; "source/test/rank_group/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/rank_group/${link_prefix}test_inputs:source/test/rank_group/test_inputs" ;; - "source/test/sparsedata/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/sparsedata/${link_prefix}test_inputs:source/test/sparsedata/test_inputs" ;; - "source/test/sundials/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/sundials/${link_prefix}example_inputs:source/test/sundials/example_inputs" ;; "source/test/sundials/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/sundials/${link_prefix}test_inputs:source/test/sundials/test_inputs" ;; - "source/test/timers/${link_prefix}example_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/timers/${link_prefix}example_inputs:source/test/timers/example_inputs" ;; "source/test/timers/${link_prefix}test_inputs") CONFIG_LINKS="$CONFIG_LINKS source/test/timers/${link_prefix}test_inputs:source/test/timers/test_inputs" ;; - "source/test/applications/Euler/${link_prefix}RP_test") CONFIG_LINKS="$CONFIG_LINKS source/test/applications/Euler/${link_prefix}RP_test:source/test/applications/Euler/RP_test" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config/Makefile.config") CONFIG_FILES="$CONFIG_FILES config/Makefile.config" ;; "config/Makefile.config.install") CONFIG_FILES="$CONFIG_FILES config/Makefile.config.install" ;; @@ -22100,35 +21770,54 @@ $MKDIR_P config include lib bin $subdirs if test `pwd` != `cd "$srcdir" && pwd` then $INSTALL $srcdir/COPYRIGHT COPYRIGHT + $INSTALL $srcdir/COPYING.LESSER COPYING.LESSER $INSTALL $srcdir/RELEASE-NOTES RELEASE-NOTES $INSTALL $srcdir/INSTALL-NOTES INSTALL-NOTES $MKDIR_P source/test/testtools $INSTALL $srcdir/source/test/testtools/* source/test/testtools - $INSTALL $srcdir/source/test/inputdb/*.input source/test/inputdb readme='source/test/applications/ConvDiff/README source/test/applications/Euler/README -source/test/applications/Euler/README-test +source/test/applications/Euler/README-RP_test source/test/applications/LinAdv/README +source/test/assumed_partition/README +source/test/async_comm/README source/test/boundary/README +source/test/clustering/async_br/README +source/test/communication/README +source/test/dataaccess/README source/test/dataops/README +source/test/dimension/README +source/test/dlbg/README source/test/FAC_adaptive/README -source/test/FAC_nonadaptive/README +source/test/FAC_staticrefinement/README +source/test/fill_pattern/README +source/test/hierarchy/README source/test/hypre/README +source/test/indexdata/README +source/test/logger/README +source/test/mapped_box_set_iterators/README +source/test/MappingConnector/README +source/test/mblkcomm/README source/test/MblkEuler/README source/test/MblkLinAdv/README +source/test/mblktree/README source/test/nonlinear/README source/test/patchbdrysum/README source/test/performance/Euler/README source/test/performance/LinAdv/README source/test/performance/MeshGeneration/README source/test/performance/multiblock/README -source/test/pointer/README +source/test/performance/TreeCommunication/README +source/test/performance/treesearch/README +source/test/rank_group/README source/test/README source/test/restartdb/README +source/test/samrai_mpi/README +source/test/sparsedata/README source/test/sundials/README source/test/timers/README -source/test/timers/README.example +source/test/transformation/README source/test/variables/README source/test/vector/README ' diff --git a/base/SAMRAI/SAMRAI/configure.in b/base/SAMRAI/SAMRAI/configure.in index 3eede315..5d152c08 100644 --- a/base/SAMRAI/SAMRAI/configure.in +++ b/base/SAMRAI/SAMRAI/configure.in @@ -1,7 +1,7 @@ dnl dnl File: $HeadURL$ dnl Package: SAMRAI build system -dnl Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +dnl Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC dnl Revision: $LastChangedRevision$ dnl Description: autoconfig configuration file dnl @@ -16,11 +16,15 @@ AH_TOP([ #define INCLUDED_SAMRAI_CONFIG_H #define SAMRAI_VERSION_MAJOR 3 -#define SAMRAI_VERSION_MINOR 4 -#define SAMRAI_VERSION_PATCHLEVEL 1 +#define SAMRAI_VERSION_MINOR 11 +#define SAMRAI_VERSION_PATCHLEVEL 2 ]) AH_BOTTOM([ +namespace SAMRAI { + static const unsigned short MAX_DIM_VAL = SAMRAI_MAXIMUM_DIMENSION; +} + /* * Prevent inclusion of mpi C++ bindings in mpi.h includes. * This is done in here rather than SAMRAI_MPI.h since other @@ -147,6 +151,12 @@ AC_ARG_ENABLE([bgl], [enable_bgl=$enableval], [enable_bgl=no] ) +AC_ARG_ENABLE([threading], + [AS_HELP_STRING([--enable-threading], + [build with threading on (default is disabled)])], + , + [enable_threading="no"] + ) AC_ARG_WITH([CC], [AS_HELP_STRING([--with-CC=ARG],[manually set C compiler to ARG])] ) @@ -374,6 +384,62 @@ case "$with_extra_ld_flags" in ;; esac +dnl +dnl A way to manually add flags to the c compiler command. +dnl +AC_ARG_WITH([extra-cc-flags], +[AS_HELP_STRING([--with-extra-cc-flags=STRING], + [Specify additional flags for the c compiler.])], +,with_extra_cc_flags='no') +case "$with_extra_cc_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + C_FLAGS="$C_FLAGS $with_extra_cc_flags" + ;; +esac + +dnl +dnl A way to manually add flags to the c++ compiler command. +dnl +AC_ARG_WITH([extra-cxx-flags], +[AS_HELP_STRING([--with-extra-cxx-flags=STRING], + [Specify additional flags for the c++ compiler.])], +,with_extra_cxx_flags='no') +case "$with_extra_cxx_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + CXX_FLAGS="$CXX_FLAGS $with_extra_cxx_flags" + ;; +esac + +dnl +dnl A way to manually add flags to the f77 compiler command. +dnl +AC_ARG_WITH([extra-f77-flags], +[AS_HELP_STRING([--with-extra-f77-flags=STRING], + [Specify additional flags for the f77 compiler.])], +,with_extra_f77_flags='no') +case "$with_extra_f77_flags" in + no) + : No op + ;; + yes) + : No op + ;; + *) + F77_FLAGS="$F77_FLAGS $with_extra_f77_flags" + ;; +esac dnl dnl Find ar for archiving @@ -381,7 +447,7 @@ dnl AC_CHECK_PROGS(AR, $with_AR ar,) if test -z "$AR"; then - AC_MSG_ERROR([ar archiver not found - specify with --with-m4=ARG]) + AC_MSG_ERROR([ar archiver not found - specify with --with-AR=ARG]) fi dnl @@ -439,7 +505,13 @@ CASC_CXX_IOMANIP_LEFT CASC_CXX_NEW_PLACEMENT_OPERATOR CASC_CXX_MEMBER_FUNCTION_SPECIALIZATION CASC_CXX_STATIC_DATA_INSTANTIATION -CASC_CXX_EXCEPTION_HANDLING +case $CXX in + *insure*) + ;; + *) + CASC_CXX_EXCEPTION_HANDLING + ;; +esac CASC_CXX_STANDARD_STATIC_DATA_SPECIALIZATION if test "$casc_cv_cxx_have_standard_static_data_specialization" = "no"; then CASC_CXX_PRAGMA_STATIC_DATA_SPECIALIZATION @@ -467,6 +539,7 @@ esac case $CXX_ID in gnu) CXX_FLAGS="-Wall -Wextra -Wconversion $CXX_FLAGS" + case $ARCH in IRIX64) CXX_FLAGS="-mabi=64 $CXX_FLAGS" @@ -507,11 +580,28 @@ case $CXX_ID in esac dnl -dnl The standard requires that implementation be present when compiling a template. +dnl Add necessary compiler flag for threading. dnl -AC_DEFINE([INCLUDE_TEMPLATE_IMPLEMENTATION],[1],[INCLUDE_TEMPLATE_IMPLEMENTATION]) -DEPENDS_ON_TEMPLATE_IMPLEMENTATION="yes" -AC_SUBST(DEPENDS_ON_TEMPLATE_IMPLEMENTATION) +if test "$enable_threading" = "yes"; then + case $CXX_ID in + gnu) + CXX_FLAGS="$CXX_FLAGS -fopenmp" + ;; + xlc) + CXX_FLAGS="$CXX_FLAGS -qsmp=omp" + ;; + intel) + CXX_FLAGS="$CXX_FLAGS -openmp" + ;; + *) + AC_MSG_WARN([ +Use CFLAGS and CXXFLAGS to specify compiler +threading directive for this compiler. +]); + ;; + esac + AC_DEFINE(HAVE_OPENMP,1,OPENMP is available) +fi dnl dnl Set the compile mode flag for the kind of target to build @@ -574,6 +664,7 @@ AC_ARG_ENABLE([opt], [case "$enable_opt" in no) opt_switches= ;; yes) + AC_DEFINE([OPT_BUILD],[1],[Optimized build]) case $CXX_ID in gnu) opt_switches="-O2" ;; intel) opt_switches="-O3" ;; @@ -671,7 +762,7 @@ dnl if test -n "$with_F77"; then dnl If user specifies full path then don't search in path - if test -f $with_F77; then + if test -f "$with_F77"; then F77=$with_F77 else AC_CHECK_PROGS(F77, $with_F77) @@ -751,6 +842,13 @@ AC_ARG_ENABLE([fortran-mangling-override], esac], AC_MSG_RESULT(no)) +dnl +dnl Rename the F77_FUNC macros SAMRAI_F77_FUNC to avoid conflicts +dnl with client code using a different version of AC_F77_WRAPPERS. +dnl +sed 's/F77_FUNC/SAMRAI_F77_FUNC/' confdefs.h > confdefs1.h +mv confdefs1.h confdefs.h + dnl dnl Find the X11 include directory, library directory, and associated dnl libraries. @@ -991,11 +1089,11 @@ fi dnl dnl dnl dnl Set up the Fortran libraries. dnl dnl -AC_F77_LIBRARY_LDFLAGS -SAMRAI_SPLIT_LIBS_STRING(FLIBS,FLIBS_PATH,FLIBS_NAME) -LIB_NAME="${LIB_NAME} ${FLIBS_NAME}" -LIB_PATH="${LIB_PATH} ${FLIBS_PATH}" -CASC_AC_LOG_VAR([FLIBS FLIBS_PATH FLIBS_NAME], [after using ac_f77_library_ldflags]) +dnl AC_F77_LIBRARY_LDFLAGS +dnl SAMRAI_SPLIT_LIBS_STRING(FLIBS,FLIBS_PATH,FLIBS_NAME) +dnl LIB_NAME="${LIB_NAME} ${FLIBS_NAME}" +dnl LIB_PATH="${LIB_PATH} ${FLIBS_PATH}" +dnl CASC_AC_LOG_VAR([FLIBS FLIBS_PATH FLIBS_NAME], [after using ac_f77_library_ldflags]) dnl dnl dnl dnl Set fortran library. dnl dnl @@ -1062,26 +1160,37 @@ dnl AC_ARG_WITH([mpi], [AS_HELP_STRING([--without-mpi],[Compile without MPI library.])]) if test "$with_mpi" = no; then - AC_MSG_NOTICE([NOTIFICATION: SAMRAI configured without the MPI library]) - AC_DEFINE([LACKS_MPI],[1],[MPI library is missing]) + if test -z "`echo $CXX:t | grep mpi`" ; then + AC_MSG_NOTICE([NOTIFICATION: SAMRAI configured without the MPI library]) + AC_DEFINE([LACKS_MPI],[1],[MPI library is missing]) + else + AC_MSG_ERROR([You have specified a non-mpi build but are using an mpi compiler wrapper with is contradictory.]) + fi else - case $ARCH in - alpha) - CASC_FIND_MPI_ALPHA - ;; - *) - CASC_FIND_MPI - ;; - esac + if test -z "`echo $CXX:t | grep mpi`" ; then + case $ARCH in + alpha) + CASC_FIND_MPI_ALPHA + ;; + *) + CASC_FIND_MPI + ;; + esac - if test -n "$MPIINCLUDE" -o -n "$MPILIBS" -o -n "$MPILIBDIRS"; then + if test -n "$MPIINCLUDE" -o -n "$MPILIBS" -o -n "$MPILIBDIRS"; then + with_mpi=yes + AC_DEFINE([HAVE_MPI],[1],[MPI library is present]) + INC_PATH="$MPIINCLUDE $INC_PATH" + LIB_NAME="$MPILIBS $LIB_NAME" + LIB_PATH="$MPILIBDIRS $LIB_PATH" + CASC_AC_LOG_VAR(MPIINCLUDE MPILIBS MPILIBDIRS, After successfully finding MPI using casc_find_mpi) + CONFIGURED_WITH_MPI="with_mpi" + AC_SUBST(CONFIGURED_WITH_MPI) + fi + else with_mpi=yes AC_DEFINE([HAVE_MPI],[1],[MPI library is present]) - INC_PATH="$MPIINCLUDE $INC_PATH" - LIB_NAME="$MPILIBS $LIB_NAME" - LIB_PATH="$MPILIBDIRS $LIB_PATH" - CASC_AC_LOG_VAR(MPIINCLUDE MPILIBS MPILIBDIRS, After successfully finding MPI using casc_find_mpi) CONFIGURED_WITH_MPI="with_mpi" AC_SUBST(CONFIGURED_WITH_MPI) fi @@ -1141,6 +1250,54 @@ fi CASC_AC_LOG_VAR( [boost_INCLUDES INC_PATH boost_LIBS LIB_PATH LIB_NAME])dnl +# Defines ptscotch_PREFIX ptscotch_INCLUDES and ptscotch_LIBS. +AC_ARG_WITH(ptscotch, +[ --with-ptscotch[=PATH] Use PT-SCOTCH and specify where PT-SCOTCH is installed.], +, with_ptscotch=no) + +case "$with_ptscotch" in + no) + : Do nothing + ;; + yes) + # PT-SCOTCH install path was not specified. + # Look in a couple of standard locations to probe if + # PT-SCOTCH header files are there. + AC_MSG_CHECKING([for PT-SCOTCH installation]) + for dir in /usr /usr/local; do + if test -f ${dir}/ptscotch/include/ptscotch.h; then + ptscotch_PREFIX=${dir} + break + fi + done + AC_MSG_RESULT([$ptscotch_PREFIX]) + ;; + *) + # PT-SCOTCH install path was specified. + AC_MSG_CHECKING([for PT-SCOTCH installation]) + + if test -f ${with_ptscotch}/include/ptscotch.h; then + ptscotch_PREFIX=$with_ptscotch + ptscotch_INCLUDES="-I${ptscotch_PREFIX}/include" + ptscotch_LIBS="-L${ptscotch_PREFIX}/lib -lptscotch -lptscotcherr -lscotch -lscotcherr" + AC_MSG_RESULT([$ptscotch_PREFIX]) + else + AC_MSG_RESULT([$ptscotch_PREFIX]) + AC_MSG_ERROR([PT-SCOTCH not found in $with_ptscotch]) + fi + ;; +esac +if test "${ptscotch_PREFIX+set}" = set; then + SAMRAI_SPLIT_LIBS_STRING(ptscotch_LIBS,ptscotch_LIB_PATH,ptscotch_LIB_NAME) + LIB_PATH="$ptscotch_LIB_PATH $LIB_PATH" + LIB_NAME="$ptscotch_LIB_NAME $LIB_NAME" + INC_PATH="$ptscotch_INCLUDES $INC_PATH" + AC_DEFINE([HAVE_PTSCOTCH],[1],[PTSCOTCH headers are available to use]) +fi +CASC_AC_LOG_VAR( +[ptscotch_INCLUDES INC_PATH ptscotch_LIBS LIB_PATH LIB_NAME])dnl + + dnl dnl Thread Building Blocks support dnl @@ -1239,11 +1396,11 @@ if test "${PETSC_DIR+set}" = set; then LIB_NAME="$petsc_LIB_NAME $LIB_NAME" INC_PATH="$petsc_INCLUDES $INC_PATH" AC_DEFINE(HAVE_PETSC,1,PETSC library is available so use it) - if test $PETSC_VERSION_MAJOR -ne 2 || \ - test $PETSC_VERSION_MINOR -ne 3 || \ - test $PETSC_VERSION_SUBMINOR -ne 3 ; then + if test $PETSC_VERSION_MAJOR -ne 3 || \ + test $PETSC_VERSION_MINOR -ne 2 || \ + test $PETSC_VERSION_SUBMINOR -ne 0 ; then AC_MSG_WARN([ -SAMRAI requires PETSc-2.3.3. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR +SAMRAI requires PETSc-3.2.0. You have specified version $PETSC_VERSION_MAJOR.$PETSC_VERSION_MINOR.$PETSC_VERSION_SUBMINOR which may not work properly! ]) fi @@ -1325,7 +1482,7 @@ else fi AC_DEFINE([HAVE_SUNDIALS],[1],[HAVE_SUNDIALS]) LIB_PATH="$LIB_PATH -L$sundials_dir/lib" - LIB_NAME="$LIB_NAME -lsundials_cpodes -lsundials_cvode -lsundials_kinsol" + LIB_NAME="$LIB_NAME -lsundials_cvode -lsundials_kinsol" INC_PATH="-I$sundials_dir/include $INC_PATH" fi AC_SUBST(SUNDIALS_C_FILES) @@ -1468,7 +1625,7 @@ dnl Specify how many processors to use in testing. dnl case $CONFIGURED_WITH_MPI in with_mpi) - TEST_NPROCS='1,2' + TEST_NPROCS='1,2,4' ;; *) TEST_NPROCS='0' @@ -1514,6 +1671,8 @@ AC_SUBST(SRCDIR_COMPILE_PREFIX) AC_SUBST(INC_PATH) AC_SUBST(LIB_PATH) AC_SUBST(LIB_NAME) +AC_SUBST(ac_pwd) +AC_SUBST(btng_rpath_beginning) dnl Define a macro that links files from the compile tree to the source tree. dnl The links have the same name as the the target. Nothing is done if @@ -1565,11 +1724,6 @@ then define(samrai_test_inputs,[ '(' -type d -name '*inputs*' '!' -path '*/*inputs*/*' ')' ]) SAMRAI_LINK_FILES([ esyscmd(find source/test samrai_test_inputs | sort --ignore-case) ]) - dnl - dnl Special directories in test that are not caught as part of the previous fined. - dnl - SAMRAI_LINK_FILES([ source/test/applications/Euler/RP_test ]) - fi dnl Undefine the m4 symbols not needed anymore. @@ -1609,11 +1763,11 @@ dnl if test `pwd` != `cd "$srcdir" && pwd` then $INSTALL $srcdir/COPYRIGHT COPYRIGHT + $INSTALL $srcdir/COPYING.LESSER COPYING.LESSER $INSTALL $srcdir/RELEASE-NOTES RELEASE-NOTES $INSTALL $srcdir/INSTALL-NOTES INSTALL-NOTES $MKDIR_P source/test/testtools $INSTALL $srcdir/source/test/testtools/* source/test/testtools - $INSTALL $srcdir/source/test/inputdb/*.input source/test/inputdb dnl dnl Copy README files diff --git a/base/SAMRAI/SAMRAI/docs/Doxyfile.in b/base/SAMRAI/SAMRAI/docs/Doxyfile.in index 95be781a..a050c039 100644 --- a/base/SAMRAI/SAMRAI/docs/Doxyfile.in +++ b/base/SAMRAI/SAMRAI/docs/Doxyfile.in @@ -1028,8 +1028,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = NDIM=3 \ - HAVE_SILO \ +PREDEFINED = HAVE_SILO \ HAVE_SUNDIALS \ HAVE_HYPRE \ HAVE_PETSC \ diff --git a/base/SAMRAI/SAMRAI/docs/Makefile.in b/base/SAMRAI/SAMRAI/docs/Makefile.in index cefa7131..64e38249 100644 --- a/base/SAMRAI/SAMRAI/docs/Makefile.in +++ b/base/SAMRAI/SAMRAI/docs/Makefile.in @@ -3,24 +3,22 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the entire SAMRAI distribution ## ######################################################################### -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -top_builddir = .. -subdir = docs -VPATH = @srcdir@ +SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +OBJECT = .. +SUBDIR = docs +VPATH = @SRCDIR@ -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --file=$(subdir)/$@ +include $(OBJECT)/config/Makefile.config -Doxyfile: $(srcdir)/Doxyfile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --file=$(subdir)/$@ +Doxyfile: $(SRCDIR)/Doxyfile.in $(OBJECT)/config.status + cd $(OBJECT) \ + && CONFIG_FILES=$(SUBDIR)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --file=$(SUBDIR)/$@ dox: Doxyfile doxygenBinaryWarning @mkdir -p @dox_output_dir@. @DOXYGEN_BIN@ Doxyfile @@ -29,11 +27,11 @@ dox: Doxyfile doxygenBinaryWarning cp @dox_output_dir@samrai.tag @dox_output_dir@samrai-dox/html/samrai.tag @echo "Created documentation in @dox_output_dir@" redox: - rm -f dox && $(MAKE) dox + $(RM) dox && $(MAKE) dox -devDoxyfile: $(srcdir)/devDoxyfile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --file=$(subdir)/$@ +devDoxyfile: $(SRCDIR)/devDoxyfile.in $(OBJECT)/config.status + cd $(OBJECT) \ + && CONFIG_FILES=$(SUBDIR)/$@ CONFIG_HEADERS= $(SHELL) ./config.status --file=$(SUBDIR)/$@ devdox: devDoxyfile doxygenBinaryWarning @mkdir -p @dox_output_dir@. @DOXYGEN_BIN@ devDoxyfile @@ -42,7 +40,7 @@ devdox: devDoxyfile doxygenBinaryWarning cp @dox_output_dir@samrai-dev.tag @dox_output_dir@samrai-devdox/html/samrai.tag @echo "Created documentation in @dox_output_dir@" redevdox: - rm -f devdox && $(MAKE) devdox + $(RM) devdox && $(MAKE) devdox grey-dox-bg: @cd @dox_output_dir@. diff --git a/base/SAMRAI/SAMRAI/docs/devDoxyfile.in b/base/SAMRAI/SAMRAI/docs/devDoxyfile.in index b728eb2d..61ad9161 100644 --- a/base/SAMRAI/SAMRAI/docs/devDoxyfile.in +++ b/base/SAMRAI/SAMRAI/docs/devDoxyfile.in @@ -1028,11 +1028,11 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = NDIM=3 \ +PREDEFINED = HAVE_SILO \ + HAVE_SUNDIALS \ HAVE_HYPRE \ HAVE_PETSC \ - HAVE_HDF5 \ - HAVE_SUNDIALS + HAVE_HDF5 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/base/SAMRAI/SAMRAI/docs/main.html b/base/SAMRAI/SAMRAI/docs/main.html index 04f47e91..d7b03777 100644 --- a/base/SAMRAI/SAMRAI/docs/main.html +++ b/base/SAMRAI/SAMRAI/docs/main.html @@ -13,8 +13,8 @@

SAMRAI Documentaion


-

SAMRAI Overview

- Introductory slide presentation.
+

SAMRAI Overview

+ Introduction to SAMR, SAMRAI's conceptualization of SAMR, and design of the library.
@@ -23,23 +23,22 @@

Reference Manual

Documents describing various code functionality in SAMRAI:

    +
  • Input Parameters & Restart +- describes how input parameters and running from restart interact.
  • +
  • Redistribution For Restart +- describes how to run the restart-redistribute tool to redistribute a problem to restart on a different number of processors.
  • +
  • Multiblock Geometries +- describes how to create multiblock geometries in SAMRAI.
  • FAC Preconditioner, Robin Boundary conditions - use of FAC solver classes
  • Regridding and Richardson Extrapolation - describes how to manage refinement using either a gradient detectionn algorithm or Richardson extrapolation.
  • -
  • Communication Algorithms and -Boundary conditions - describes parallel AMR data communication support -and how boundary conditions are invoked.
  • Timing and Instrumentation - describes the timing package to assist in performance analysis and to guide the user about which routines are incurring the largest percentage of computation time.
  • -
  • Vizamrai Writer, VisIt Writer, VisIt Tutorial - describes how -to write data that may be postprocessed by the Vizamrai or VisIt tools.
  • M4 Macros for Fortran - how to use SAMRAI m4 macros for accessing patch data in fortran
  • diff --git a/base/SAMRAI/SAMRAI/docs/release/version-1.4.0 b/base/SAMRAI/SAMRAI/docs/release/version-1.4.0 index fa109cbb..e2dfaa96 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-1.4.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-1.4.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-1.5.0 b/base/SAMRAI/SAMRAI/docs/release/version-1.5.0 index 8f25ce07..fc23a8ba 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-1.5.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-1.5.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.0.0 b/base/SAMRAI/SAMRAI/docs/release/version-2.0.0 index 9657cd44..4c9ebce7 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.0.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.0.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.0.0-beta b/base/SAMRAI/SAMRAI/docs/release/version-2.0.0-beta index 9435cfcd..5084674d 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.0.0-beta +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.0.0-beta @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.1.0 b/base/SAMRAI/SAMRAI/docs/release/version-2.1.0 index e051bf15..ad9d7378 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.1.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.1.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.2.0 b/base/SAMRAI/SAMRAI/docs/release/version-2.2.0 index 9f3aa325..e65c7ca0 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.2.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.2.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.2.1 b/base/SAMRAI/SAMRAI/docs/release/version-2.2.1 index eba5a6f6..71e81317 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.2.1 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.2.1 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.3.0 b/base/SAMRAI/SAMRAI/docs/release/version-2.3.0 index 8889259d..e0060375 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.3.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.3.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-2.4.0 b/base/SAMRAI/SAMRAI/docs/release/version-2.4.0 index d38b472e..77116674 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-2.4.0 +++ b/base/SAMRAI/SAMRAI/docs/release/version-2.4.0 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.1.0-beta b/base/SAMRAI/SAMRAI/docs/release/version-3.1.0-beta index 789f54c1..5ce0fb8b 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-3.1.0-beta +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.1.0-beta @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.10.0 b/base/SAMRAI/SAMRAI/docs/release/version-3.10.0 new file mode 100644 index 00000000..93179ebb --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.10.0 @@ -0,0 +1,178 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.10.0 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. + +Please send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +1) It is now permitted to set up hierarchies with anisotropic refinement +ratios on multiblock geometries with irregular connectivity. This is mainly +handle through changes to IntVector described in "what's changed". + +2) A new feature allows user-defined gradient detector tag values to be saved +and retrieved during or after regridding. + +3) A more scalable partitioner, CascadePartitioner was added, and +TileClustering was improved. Both of these should scale well to +1M+ MPI tasks. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +1) There have been changes to IntVector to allow it to hold different values +on different blocks. IntVector now holds a value for a number of +blocks. There should be no impact on usage in application codes that use only +single-block meshes. + +2) Index is no longer a child class derived from IntVector. + +3) For type-safety reasons, the block number held by BlockId now is expressed +as having type BlockId::block_t. + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) It is now permitted to set up hierarchies with anisotropic refinement +ratios on multiblock geometries with irregular connectivity. This is mainly +handle through changes to IntVector described in "what's changed". + +Previously all multiblock meshes were required to use the same refinement ratio +on all blocks, which made it impossible to use anistropic ratios in any case +that had axis rotations between neighboring blocks. Users are now allowed to +define different refinement ratios on each block, though they must take care +to keep the ratios consistent at block boundaries. + +2) A new feature allows user-defined gradient detector tag values to be saved +and retrieved during or after regridding. + +Previously, when application codes set their tag values in a user-defined +implementation of StandardTagAndInitStrategy::applyGradientDetector(), any +possible integer value was technically valid, but the values were treated by +SAMRAI's gridding and box generation algorithms as effectively boolean--nonzero +values tagged the cells for refinement, and zero values meant the cells were +untagged. Furthermore, there was no way for application codes to see that +data once they passed it back to SAMRAI--it was used to generate new grids and +then deallocated. + +Now application codes, may, if desired, set their tag values to any nonzero +value and they will have a way to retrieve those values for their own +analysis. SAMRAI will internally still treat the tag values as effectively +boolean, but the application will be able to use distinguish different reasons +that particular cells were tagged, which may be analyzed for reasons such +as debugging or visualization. + +There are two ways provided to retrieve those values, both by implementing a +virtual method in StandardTagAndInitStrategy to define a callback into the +application code. + + - The first, getUserTagData, provides a means to retrieve the tag data + on the level where the tags were originally defined. The callback occurs + during regridding, before the tagged level may be regridded and destroyed. + + - The second, checkNewLevelTagData, provides a representation of the tag + data on a new level after it is created. The new level was created based + on tags on a coarser level, and those tag values are filled onto the new + level and can be seed during a callback that occurs after the new level + is fully initialized. This callback can only be used if the boolean + input argument "d_save_tag_data" is set to true in the GriddingAlgorithm + input. This feature adds communication overhead, so it should only be + turned on if it is really desired. + +3) A more scalable partitioner, CascadePartitioner was added, and +TileClustering was improved. Both of these should scale well to +1M+ MPI tasks. + +CascadePartitioner can be used wherever a LoadBalanceStrategy is +needed. TileClustering can be used wherever BoxGeneratorStrategy is +needed. They can be drop-in replacements for what you are using in +the GriddingAlgorithm. See the class documentation. The algorithms +are described in the article "Advances in Patch-Based Adaptive Mesh +Refinement Scalability" submitted to JPDC. Scaling benchmark results +are also in the article. + +Tiling generates clusters of a predetermined tile size. Tile size can +be different on different levels, and mixing tiled and untiled levels +is permitted. However, tiling is most efficient when tile boundaries +coincide, which is achieved by when Tc*R is divisible by Tf or vice +versa, where Tc is the tile size on a coarser level, Tf is the tile +size on the finer level and R is the refinement ratio between the two +levels. Be sure to use a compatible tile size in the partitioning +object. + + + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) There have been changes to IntVector to allow it to hold different values +on different blocks. IntVector now holds a value for a number of +blocks. There should be no impact on usage in application codes that use only +single-block meshes. + +The purpose of this change is to allow for the IntVector to hold differing +values on different blocks for things such as refinement ratios and connector +widths. This makes it possible to set up multiblock hierarchies with +anisotropic refinement ratios. + +IntVectors created in a multiblock problem will have a number of blocks as +part of their state, which can be queried with the method getNumBlocks(). The +number of blocks will be either the number of blocks in the mesh, or one. The +data held by IntVector will be of length equal to the product of the number of +blocks and the number of dimentions. + +The operator[] to access a single integer value from and IntVector now only +works when the number of blocks for the IntVector is one. To access a single +integer value from a multiblock IntVector, use the operator() with two +arguments, one for a block number and one for a dimensional value. + + +2) Index is no longer a child class derived from IntVector. It is now its own +self-contained class. There should be little to no effect on application code +usage, unless codes were using the two classes interchangeably. Both Index +and IntVector have constructors allowing users to construct objects of one +class from input of the other. + + +3) For type-safety reasons, the block number held by BlockId now is expressed +as having type BlockId::block_t. It can be treated like an unsigned int. + + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.11.0 b/base/SAMRAI/SAMRAI/docs/release/version-3.11.0 new file mode 100644 index 00000000..ec4c142f --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.11.0 @@ -0,0 +1,75 @@ +***************************************************************************** + Copyright 1997-2015 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.11.0 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. + +Please send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +1) Non-uniform load balancing capabilities have been added to +CascadePartitioner. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +1) + + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) Non-uniform load balancing capabilities have been added to +CascadePartitioner. + +The CascadePartitioner now has the ability to balance based on user-provided +workload values for each cell instead of balancing based on a simple cell +count. The non-uniform capability is enabled by passing in a patch data id +to the method setWorkloadPatchDataIndex. The patch data id should identify +cell-centered data that has already been set on the hierarchy prior to invoking +the CascadePartitioner. + +CascadePartitioner continues to work as a uniform load balancer by default. + +----------------------------------------------------------------------------- + Details about what's changed +---------------------------------------------------------------------------- + +1) + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.11.1 b/base/SAMRAI/SAMRAI/docs/release/version-3.11.1 new file mode 100644 index 00000000..9dcfe3f1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.11.1 @@ -0,0 +1,110 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.11.1 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. + +Please send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) A major bug that was incorrectly setting up the transactions for time +interpolation during runs with TimeRefinementIntegrator using refined +timestepping has been fixed. Codes that use refined timestepping may see +changes in results due to more accurate time-interpolated values used to fill +ghost data. + +2) An integer overrun that was seen in runs using a high number of levels +(16 or more) has been eliminated. + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +1) (v. 3.10.0) Non-uniform load balancing capabilities have been added to +CascadePartitioner. + +2) CompositeBoundaryAlgorithm and CompositeBoundarySchedule provide new +functionality for representations of PatchData at boundaries between coarse +and fine levels. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +1) The maximum number of patch data items that managesd by SAMRAIManager +is no longer a hard limit. + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) (v. 3.11.0) Non-uniform load balancing capabilities have been added to +CascadePartitioner. + +The CascadePartitioner now has the ability to balance based on user-provided +workload values for each cell instead of balancing based on a simple cell +count. The non-uniform capability is enabled by passing in a patch data id +to the method setWorkloadPatchDataIndex. The patch data id should identify +cell-centered data that has already been set on the hierarchy prior to invoking +the CascadePartitioner. + +CascadePartitioner continues to work as a uniform load balancer by default. + +2) CompositeBoundaryAlgorithm and CompositeBoundarySchedule provide new +functionality for representations of PatchData at boundaries between coarse +and fine levels. + +These classes are intended to support applications that may need to operate on +data on both sides of a coarse-fine boundary, treating them as an irregular +stencil that incorporates different mesh resolutions. + +----------------------------------------------------------------------------- + Details about what's changed +---------------------------------------------------------------------------- + +1) The maximum number of patch data items that managesd by SAMRAIManager +is no longer a hard limit. + +Previously if an application tried to create more patch data items than the +limit held by SAMRAIManager (default value of 256, or can be set using +SAMRAIManager::setMaxNumberPatchDataEntries()), it would cause a fatal error. +Now SAMRAIManager will adjust the maximum value on the fly and the application +will need not do anything to adjust. + +It still is recommended that application codes set a value at the beginning of +the run that is higher than they expect to ever reach, as the adjustment of the +maximum value has some overhead, but for some applications it is unpredictable +how many patch data items will be created, and this change allows them to +run without worry of a hard limit causing an error. + + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.2.1 b/base/SAMRAI/SAMRAI/docs/release/version-3.2.1 index 849aabd3..0cb81c77 100644 --- a/base/SAMRAI/SAMRAI/docs/release/version-3.2.1 +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.2.1 @@ -1,5 +1,5 @@ ***************************************************************************** - Copyright 1997-2012 + Copyright 1997-2016 Lawrence Livermore National Security, LLC. All rights reserved. ***************************************************************************** diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.3.3 b/base/SAMRAI/SAMRAI/docs/release/version-3.3.3 new file mode 100644 index 00000000..11f062eb --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.3.3 @@ -0,0 +1,222 @@ +***************************************************************************** + Copyright 1997-2011 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.3.3 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +(1) Reduced memory usage. + +(2) Better execution times. + +(3) The bridge algorithm is now multi-block aware. + +(4) CoarsenSchedule is multi-block aware. + + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +(1) MappedBox has been merged into Box. + +(2) BoxSet and BoxList have been merged into BoxContainer. + +(3) Internal representation of Connector is now encapsulated behind an abstract + API. + +(4) The ceiling methods in IntVector have been renamed ceilingDivide. + +(5) Operations to remove periodic image boxes now work on this. + +(6) Constructing SAMRAI_MPI with MPI_COMM_NULL sets rank and size + to invalid values. + +(7) Boost is no longer required. + +(8) Fixed bug causing excessive call-backs in RefineSchedule::fillData. + +(9) RefineSchedule construction performance has been improved. + + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +(1) Reduced memory usage. + +Algorithmic improvements and the use of BoxContainer in lieu of BoxSet and/or +BoxList have drastically reduced the number of Box creations and assignments +especially for multi-block. In addition the number of Boxes in existence at +any time has also been drastically reduced especially for multi-block. + +Several test problems run on an in-house application using SAMRAI show that the +maximum number of Boxes in existence at any given time is as much as 16x lower +than in version 3.2. Additionally, the number of constructed Boxes is as +much as 28x lower than in version 3.2. + +(2) Better execution times. + +Larely due to the reduction in object creation/copying execution time has +improved slightly. + +(3) The bridge algorithm is now multi-block aware. + +No interface change, but multi-block now runs faster. + +(4) CoarsenAlgorithm and CoarsenSchedule are multi-block aware. + +MultiblockCoarsenAlgorithm and MultiblockCoarsenSchedule have been removed from +the library, and CoarsenAlgorithm and CoarsenSchedule are now capable of +handling coarsening operations for multi-block configurations. + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +(1) MappedBox has been merged into Box. + +There is no longer a class called MappedBox. + +All Boxes now have a BoxId. + +"Unmapped" Boxes have an invalid BoxId. + +Names of classes have changed to reflect the fact that MappedBox is no longer +a class. For example MappedBoxTree is now just BoxTree. "Mapped box" +terminology still exists in variable and function argument names as no complete +attempt was made to eliminate this. + +(2) BoxSet and BoxList have been merged into BoxContainer. + +The single container, BoxContainer, can act like a set or as a list depending +on the algorithmic needs. + +Internally only one instance of each Box exists. + +Merging these containers eliminates much of the need to copy from one +container representation to another in order to access different container +operations or to pass them in to different interfaces. + +BoxTree and MultiblockBoxTree will be merged into BoxContainer in a future +release. + +BoxContainer maintains an internal state that is "ordered" or "unordered". +An unordered BoxContainer is meant for usage similar to that of the old BoxList +where iterations through the container are sequenced according to how the +container was filled with its members, while an ordered BoxContainer is meant +to have usage similar to the old BoxSet, where there is an internal ordering +of the members according to their BoxId values. + +A BoxContainer may be switched in either direction between ordered or unordered +state using the order() or unorder() methods, though there are restrictions on +switching from unordered to ordered. To switch a BoxContainer from unordered +to ordered, all of its members must have valid BoxIds, and each Box's BoxId +must be unique within the container. + +Some methods of BoxContainer may only be called on ordered containers, other +methods may only be called on unordered containers, and some may be called +on any container. These restrictions are detailed in the class documentation. + +With BoxContainer there are two new associated iterators, +BoxContainer::Iterator and BoxContainer::ConstIterator. These work regardless +of ordered/unordered state, though the sequence of iteration will depend on +that state. The syntax to use these iterators is designed to be more +closely (though not perfectly) aligned with STL iterator syntax than older +SAMRAI iterators have been. + +Iteration should look like: + + for (BoxContainer::Iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { + // Useful code goes here. + } + +(3) Internal representation of Connector is now encapsulated behind an abstract + API. + +Previously, the fact that Connector used a NeighborhoodSet as its internal +representation was implicitly exported. Client code would request the +NeighborhoodSet and explicitly manipulate it. It is no longer possible to +obtain the NeighborhoodSet. Instead, there is an API which allows clients to +abstractly request information from or to perform modifications on a Connector. +There are also typedefs for the different Connector iterators which should +now be used. + +(4) The ceiling methods in IntVector have been renamed ceilingDivide. + +Renaming was meant to show the divide part of the operation. + +(5) Operations to remove periodic image boxes now work on this. + +Old behavior: Take an output box container copy the non-periodic image +there. The method is const. + +New behavior: Remove periodic images from this. The method is non-const. + +(6) Constructing SAMRAI_MPI with MPI_COMM_NULL sets rank and size + to invalid values. + +This change prevents unexpectedly valid rank and group sizes when +SAMRAI_MPI is built with MPI_COMM_NULL. + +(7) Boost is no longer required. + +The compiled Boost libraries are no longer required. Boost headers +are needed for some classes but are not required. Use configure +switch "--without-boost" to remove Boost dependency. Note that, as +warned by the configure script, the SparseData class is not supported +without Boost. + +(8) Fixed bug causing excessive call-backs in RefineSchedule::fillData. + +As a side effect, the method PatchLevel::patchTouchesPeriodicBoundary, +has been removed because it is obsolete. + +(9) RefineSchedule construction performance has been improved. + +Some non-scalable multiblock-related operations were replaced with scalable +operations. + + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.4.1 b/base/SAMRAI/SAMRAI/docs/release/version-3.4.1 new file mode 100644 index 00000000..45f88d2f --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.4.1 @@ -0,0 +1,200 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.4.1 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +(1) Random operations in the math component passed the improper reduction + to Allreduce (e.g. MPI_MAX instead of MPI_SUM). In addition there were + a couple of operations which took the max of a min rather than the max of + a max. All of the operations in this component have been carefully + examined and all errors of this type have been fixed. + +(2) Bugs that were causing incorrect Connectors and fill patterns to be used + for filling ghost data at multiblock enhanced connectivity coarse-fine + boundaries have been fixed. + +(3) GriddingAlgorithm forces patches on new levels that lie very near to a + physical or block boundary to be extended to touch that boundary. In + multiblock configurations, this requirement was not being enforced + correctly on blocks other than block 0. This has now been fixed. + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +(1) BoxContainer can create and hold its own internal tree representation + for effiencent search operations. + + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +(1) SAMRAI's Pointer class has been replaced by the boost shared_ptr. + SAMRAI's ConstPointer has also been eliminated. + + THIS NOW MAKES BOOST HEADERS REQUIRED. + +(2) Starting/stopping a Timer that is already started/stopped is an + error in both optimize and debug modes. + +(3) BlockId is now part of Box's state rather than part of BoxId. + +(4) SAMRAI's iterator classes have been modified to use a consistent syntax + which matches the accepted conventions of the STL. + +(5) SAMRAI's tbox containers which effectively replicated equivalent STL + containers have been removed. + +(6) The GridGeometry class hierarchy has been changed. + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +(1) BoxContainer can create and hold its own internal tree representation + for effiencent search operations. + + The method makeTree() can be used to create an internal spatially-based + tree representation of the BoxContainer, which can increase efficiency + when the container is used as a constant argument to search-based + methods such as intersectBoxes() or findOverlapBoxes(). The cost of + building a tree is O(N log(N)), while it reduces the cost of the search + methods from O(N) to O(log(N)), so users should only use the tree + representation when it is expected that the same BoxContainer will be + used repeatedly as an argument to search operations, such that the + gain in efficiency outweighs the cost of building the tree. + + With this functionality added to BoxContainer, most of the public + interfaces of the BoxTree and MultiblockBoxTree classes have been + removed, as theses classes are intended to only be used internally by + BoxContainer. + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +(1) SAMRAI's Pointer class was written long before standard smart or reference + counted pointer classes were available. It's implementation relied heavily + on dynamic_casts and as such there was unncecssary overhead associated with + its use. We have removed Pointer from the library and replaced its usage + with boost's shared_ptr. This class provides a more efficient + implementation and an API which uses common idioms. We have also removed + ConstPointer which was redundant as ConstPointer was equivalent to + Pointer. + +(2) Starting/stopping a Timer that is already started/stopped is an + error in both optimize and debug modes. + + Previous behavior: This caused a failed assert in debug mode but not + in optimized mode. + +(3) BlockId is now part of Box's state rather than part of BoxId. This means + that every Box should have a valid BlockId that identifies which block it + lies on within a multiblock mesh configuration. For single-block + configurations, the value of every Box's BlockId is zero. + + Transformations of a Box from the coordinate system of one block to, + another, using methods in the Transformation or grid geometry classes, + will automatically change the BlockId as appropriate. + + There is now no BlockId held inside BoxId, and thus BoxId's ordering, + scheme, which is used in some containers such as BoxContainer, no longer + takes into account BlockId. + +(4) The syntax of SAMRAI's iterator classes have, for some time, not been self + consistent. In addition they have not been particularly consistent with + accepted iterator syntax found in the STL. We have modified all of the + libraries iterator so that they have the following methods/operators: + a) Both pre and post increment operators. The pre-increment operator + returns a reference to the incremented iterator. The post-increment + operator returns the iterator as it existed prior to being incremented. + b) Both == and != operators. + c) The conventional dereference operator, *. + d) The conventional member access operator, ->, which is equivalent to + (*itr).. + e) An assignment operator. + f) For bidirectional iterator, both pre and post decrement operators. + + In addition, there are now the usual iterator/const_iterator typedefs for + the iterators defined in the classes on which the iterators operate. An + example is BoxContainer::iterator. + + Since the iterators now have syntax consistent with the STL it is possible + to use ths STL's algorithms with SAMRAI's iterators. + + Modifications to client code will be necessary but we believe that the + future ease of use resulting from a consistent API along with the potential + for use of STL algorithms makes this an acceptable cost. + +(5) When SAMRAI was first developed, the STL was not a widely used and accepted + library. As a result the SAMRAI library included its own container classes + which were effectively identical to those in the STL. We have removed them + from the library as of 3.4. These classes are vector and List. + Applications should now use vector and list from the STL. + +(6) hier::GridGeometry has been renamed hier::BaseGridGeometry and is now an + abstract class. A new class, geom::GridGeometry, provides the concrete + equivalent of hier::GridGeometry. The class, geom::CartesianGridGeometry + is derived from geom::GridGeometry. The class, geom::SkeletonGridGeometry + has been removed as it is essentially equivalent to geom::GridGeometry. + + If your application uses hier::GridGeometry you should just need to change + "hier" to "geom". + + These changes were necessary because knowledge of how refine, coarsen, and + time interpolations operators are bound to different variables must be + bound to the GridGeometry. Only a specific, concrete GridGeometry can + know which, if any, operator is valid for a given variable. Thus, a pure + virtual method, buildOperators() has been introduced to + hier::BaseGridGeometry. It is defined by geom::GridGeometry to build the + proper operators for that grid geometry context. Class + geom::CartesianGridGeometry overrides the method to add the Cartesian + operators. + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.5.2 b/base/SAMRAI/SAMRAI/docs/release/version-3.5.2 new file mode 100644 index 00000000..d61b41dc --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.5.2 @@ -0,0 +1,168 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.5.2 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) The BoxOverlap classes provided by SAMRAI (CellOverlap, NodeOverlap, etc.) + now have "getSourceBoxContainer" methods to get a representation of the + overlap boxes in the index space of the source box of a transaction. + +2) FirstLayerEdgeFillPattern and FirstLayerSideFillPattern added. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) Input for StandardTagAndInitialize has changed to allow for more flexible + tagging criteria. + +2) fillSingularityBoundaryConditions moved from RefinePatchStrategy + to new SingularityPatchStrategy class. + +3) Input parameters are more completely and accurately documented. + +4) A more self consistent model for the handling of input parameters has been + implemented particularly how input and restart databases interact. In + addition, more error and sanity checking has been added to the parsing of + input databases for all classes. + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) The BoxOverlap classes provided by SAMRAI (CellOverlap, NodeOverlap, etc.) + now have "getSourceBoxContainer" methods to get a representation of the + overlap boxes in the index space of the source box of a transaction. + + The overlap classes hold a container of Boxes and a Transformation object + representing a transformation between source and destination index spaces + for a transaction. The Boxes are represented in the destination index + space, that is they exist where they are after the Transformation has been + invoked. getSourceBoxContainer() provides a way to obtain a representation + of these Boxes in the source index space before the Boxes are transformed. + + These are mainly useful for overlaps that are used for data transactions + at block boundaries of multiblock meshes. The overlap object stores the + Boxes in terms of the destination block, while getSourceBoxContainer allows + a user to obtain a represenation of the same Boxes in terms of the source + block. + +2) FirstLayerEdgeFillPattern and FirstLayerSideFillPattern added. + + These implementations of VariableFillPattern allow transactions to be + constructed to communicate EdgeData or SideData only at positions along + the boundary of a Patch. + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) In earlier versions of SAMRAI it was only possible to specify that the + Richardson extrapolation or gradient detector tagging criteria would take + effect at a particular time or cycle and remain in effect for all later + times/cycles. One could also specify specific boxes to refine by level at + at specific times or cycles. It is now possible to apply any combination + of these criteria at any time or cycle. In particular, Richardson + extrapolation and gradient detector criteria may be turned on and off at + will in conjunction with tagging of specific boxes on specific levels. + To support this the input syntax for the StandardTagAndInitialize class + has changed. The general form of this class' input is now: + at_0 { + cycle | time = int | double + tag_0 { + tagging_method = RICHARDSON_EXTRAPOLATION | GRADIENT_DETECTOR | + REFINE_BOXES + level_0 { + // Needed if tagging_method is REFINE_BOXES + level = int + boxes = array of boxes + } + ... + level_k { + } + } + ... + tag_j { + } + } + ... + at_i { + } + + A simple shortcut syntax exists for the simplest cases of GRADIENT_DETECTOR + or RICHARDSON_EXTRAPOLATION applied at cycle 0 onward. The syntax of this + shortcut is unchanged from earlier version of SAMRAI and has the form: + tagging_method = RICHARDSON_EXTRAPOLATION | GRADIENT_DETECTOR + + See the header for StandardTagAndInitialize for more details. + +2) fillSingularityBoundaryConditions moved from RefinePatchStrategy + to new SingularityPatchStrategy class. + + The fillSingularityBoundaryConditions method is only used for multiblock + configurations with at least one singularity. If you have such a + configuration, you must inherit SingularityPatchStrategy in the class + where you inheritted RefinePatchStrategy. See the SingularityPatchStrategy + and RefinePatchStrategy class documentations. If you don't have block + singularities, you need not change anything. + +3) Each class which accepts input parameters now documents those input + parameters via the code's doxygen source code documentation. This + documentation is downloadable or may be generated from the source code + distribution. Included in the documentation of each parameter is: + definition, data type, default value (if any), legal range, whether the + parameter is optional or required, and how the parameter behaves on restart. + +4) For a complete description of SAMRAI's input paramters handling refer to + a new user document, docs/userdocs/InputParametersAndRestart.pdf. + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.6.1 b/base/SAMRAI/SAMRAI/docs/release/version-3.6.1 new file mode 100644 index 00000000..972be82e --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.6.1 @@ -0,0 +1,283 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.6.1 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) Box transformations have been fixed so that 1D Boxes transform properly. + + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) The class MappingConnector which is derived from Connector has been + introduced. The concept of a MappingConnector which is distinct from an + OverlapConnector has always been implied but never actually introduced. In + places where a Connector represents a mapping a MappingConnector is now + used. + +2) Both Connector and MappingConnector hold pointers to their transposes. Hence + one Connector can now be used where 2--the Connector and its transpose-- + were previously required. + +3) A new PatchLevel constructor which acquires a supplied BoxLevel has been + introduced. The existing constructor which copies a supplied BoxLevel is + unchanged. + +4) Dynamic control of refinement criteria via the following methods of + mesh::StandardTagAndInitialize has been added: + turnOnGradientDetector, turnOffGradientDetector, + turnOnRichardsonExtrapolation, turnOffRichardsonExtrapolation, + turnOnRefineBoxes, and turnOffRefineBoxes. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) If using PETSc, 3.2.0 is now required. + +2) All injection coarsening clases are now consistently named as injections. + +3) Instantiation of Connectors and BoxLevels now occurs in the methods that + know how to build them. + +4) BoxIterators are now accessed through the begin and end methods on class + Box. The BoxIterator constructor itself is now private. + +5) Cell/Edge/Face/Node/SideIterators are now accessed through the static + begin and end methods on Cell/Edge/Face/Node/SideGeometry respectively. + The Iterator constructors themselves are now private. + +6) BoxContainerIterator (aka BoxContainer::iterator) and + BoxContainerConstIterator (aka BoxContainer::const_iterator) are now + accessed through the begin and end methods on class BoxContainer. The + constructors for each iterator are now private. + +7) The restart-redistribute tool is now parallel. + +8) The input to mesh::StandardTagAndInitialize for REFINE_BOXES tagging + criteria has been modified to support multiblock. + +9) Use of class Array has been replaced throughout the library and tests with + std::vector. + +10) Access to stored Connectors has been changed. + +11) TreeLoadBalancer parameter affecting number of boxes generated has changed. + +12) Removed some unnecessary arguments from + PatchLevelFillPattern::computeFillBoxesAndNeighborhoodSets(). + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) Class Connector describes Box overlaps between two BoxLevels. It + corresponds to the OverlapConnector concept. Class MappingConnector is + derived from Connector and hence it also describes Box overlaps between two + BoxLevels. However, it describes these overlaps in a specific context-- + when the base BoxLevel has undergone a transition resulting in the head + BoxLevel. Hence it describes how the Boxes in the original BoxLevel (i.e. + the base) map onto the Boxes in the modified BoxLevel (i.e. the head). + + Previously, there was no distinction between these Connector concepts. They + were both embodied in class Connector and there was to way to distinguish + one from another. Hence there was no way to ensure that any given Connector + was being used in the proper context. + + The library now constructs and uses MappingConnectors where connectors + describing how BoxLevels have changed are needed. This provides both type + safety and added clarity as to how methods taking various Connectors are to + be used. + +2) Many interfaces have been simplified as a single Connector object can now + be used to refer to both the Connector and its transpose. In particular, + there is now only 1 modify method and 3 bridge methods as the other + overloaded versions which existed were degenerate cases. Note that in the + case of bridgeWithNesting() and the 2 bridge() methods which create the + result it is now necessary to specify whether or not the tranpose bridge + should be computed. + + Several convenience methods have been added to find/create both a Connector + and its transpose. These are PatchHierarchy::getConnectorWithTranspose(), + OverlapConnectorAlgorithm::findOverlapsWithTranspose(), + PersistentOverlapConnectors::createConnectorWithTranspose(), + PersistentOverlapConnectors::findConnectorWithTranspose(), and + PersistentOverlapConnectors::findOrCreateConnectorWithTranspose(). + +3) The BoxLevel contained in a PatchLevel may not be modified. Therefore, the + existing PatchLevel constructor copied the supplied BoxLevel. However, this + means a BoxLevel copy for each PatchLevel constructed. It the client code + will never modify the supplied BoxLevel, it is not necessary for the new + PatchLevel to copy the BoxLevel. Therefore a new PatchLevel constructor has + been introduced so that the constructed PatchLevel acquires the supplied + BoxLevel. To guarantee that client code does not accidentally modify the + now shared BoxLevel, this constructor locks it so that any subsequent call + to a non-const method on that BoxLevel results in a run-time error. The + library now makes use of this new PatchLevel constructor wherever possible + to avoid the overhead of the old constructor. + + To make use of this new constructor there is are new versions of + PatchHierarchy::makeNewPatchLevel and PatchLevelFactory::allocate. + +4) The ability to dynamically control refinement criteria from an application + has been restored. It is still possible to statically control refinement + criteria via an input file. It is possible to mix static and dynamic + control however caution should be exercised if this is done as these two + separate controls can override one another and yield unintended behavior. + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) SAMRAI has been converted to work with PETSc 3.2.0. + +2) Class pdat::OuternodeDoubleConstantCoarsen has been changed to + pdat::OuternodeDoubleInjection to be consistent with injections for other + data centerings and types. + +3) Previous practice was to instantiate Connectors and BoxLevels in high level + library routines or client code and pass these objects through multiple + levels of library methods to the method that ultimately knows how to build + them. However, until these Connectors and BoxLevels were finally built, + they were in a very ill defined state. This resulted in many ill defined + objects exsiting in the code at any given time. + + Practice is now for the methods that know how to build Connectors and + BoxLevels to also instantiate them. Thus, boost::shared_ptrs to these + objects are typically now created either in client code or high level + library routines and passed along to the method that actaully instantiates + and builds the objects. The shared_ptrs are either null or point to fully + constructed objects. This results in a number of API changes in which + Connector and BoxLevel references are replaced by shared_ptrs to Connectors + and BoxLevels. + +4) Use of BoxIterator now follows the well established pattern of requesting + the iterator through begin and end methods on Box. These methods are also + simpler to use than the BoxIterator constructor which is now private. + +5) Use of Cell/Edge/Face/Node/SideIterator now follows the well established + pattern of requesting the iterators through begin and end methods. These + are static methods on Cell/Edge/Face/Node/SideGeometry respectively. The + begin and end methods are simpler to use that the iterator constructors + which are now private. + +6) Use of BoxContainerIterator and BoxContainerConstIterator now follows the + well established pattern of requesting the iterators through begin and end + methods on BoxContainer. These methods are also simpler to use than the + constructors for these iterators which are now private. + +7) The restart-redistribute tool has been parallelized on the smaller of the + number of input files and the number of output files. You may run the + tool with any number of processors up to the smaller of the number of + input and the number output files. Invocation of the tool is via mpirun + or the appropriate parallel program launcher for your platform. No + arguments to the tool have changed. + +8) In all previous versions of SAMRAI, input for the REFINE_BOXES tagging + criteria consisted only of a level number and the boxes on that level. + There was no way to specify the block these boxes come from. The result was + that the code read the refine boxes as being from block 0 and only that + block. We have expanded the input for REFINE_BOXES to include block numbers + so that boxes from multiple blocks in any given level may be specified for + tagging. In addition, there was some redundancy concerning the + specification of the level which has been removed. Needing a level_n + database followed by a "level" input parameter was clearly unnecessary. See + the docuementation for mesh::StandardTagAndInitialize for specifics of this + new syntax. + + Any input files using REFINE_BOXES will need to be modified. + +9) Class Array is essentially a vector in which the storage is reference + counted and may be shared. The reference counter was not thread safe + however and there was no use anywhere in the library in which the contents + of the Array were actually shared. Therefore all use of Array in the + library and tests have been converted to std::vector. A few interfaces have + changed and will require client code to use std::vector for arguments which + had been Arrays. Class Array is still part of the distribution. However, + we suggest that users begin to migrate their codes to use std::vector as in + some future release Array will likely be removed. + +10) In the past, in order to access persistent Connectors it was necessary to + to chase pointers until one obtained a PersistentOverlapConnectors object. + Now, the accessors (findConnector, findConnectorWithTranspose, + createConnector, createConnectorWithTranspose, cacheConnector, and + hasConnector) have been exported to classes BoxLevel and PatchLevel so + that Connectors are accessed directly from instances of these classes. In + addition, BoxLevel::getPersistentOverlapConnectors() is now private and + there is now no public interface to class PersistentOverlapConnectors as + this class is purely an implementation detail and should not be visible to + client code. Hence, client code will need to be changed (simplified) to + use the new Connector accessors in BoxLevel and PatchLevel. + + In addition to these changes, client code now specifies an action to take + when a requested Connector is not found. The 3 actions are + hier::CONNECTOR_ERROR, hier::CONNECTOR_CREATE, + and hier::CONNECTOR_IMPLICIT_CREATION_RULE. This allows for more explicit + and greater control of the action to take when a Connector is not found. + One implication of this change is that findOrCreateConnector has been + eliminated. It's functionality is equivalent to findConnector called with + hier::CONNECTOR_CREATE. Clients may use + hier::CONNECTOR_IMPLICIT_CREATION_RULE in calls to findConnector while + developing their application and later change these when their application + has actually stored these Connectors. + +11) TreeLoadBalancer parameter affecting number of boxes generated has changed. + TreeLoadBalancer's min_load_fraction_per_box has been removed. + If you get too many small boxes in the hierarchy, try increasing + TreeLoadBalancer's flexible_load_tolerance input parameter. + +12) The Connector arguments of + PatchLevelFillPattern::computeFillBoxesAndNeighborhoodSets() (a pure + virtual method) were removed. In most concrete implementations of + PatchLevelFillPattern, these arguments were unneeded. If a fill pattern + child class does need one of these Connectors, it can be retrieved + from the BoxLevel that is passed in. See + PatchLevelBorderFillPattern::computeFillBoxesAndNeighborhoodSets() for + and example of the usage to retrieve a Connector for this purpose. + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.7.3 b/base/SAMRAI/SAMRAI/docs/release/version-3.7.3 new file mode 100644 index 00000000..44fc1d2a --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.7.3 @@ -0,0 +1,207 @@ +***************************************************************************** + Copyright 1997-2013 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.7.3 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) The MappingConnector assignment operator now returns a non-const + MappingConnector as it should. + +2) A bug in some VariableFillPatterns that caused interpolated data to + overwrite communicated data has been fixed. See "what's changed" for + more info. + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) There is now a new configure option, --enable-threading, which will add + the appropriate compiler directive to enable the parallelizer to generate + multi-threaded code based on the OpenMP directives. The construction of + messages sent to other processors by the various bridge() and modify() + methods in the OverlapConnectorAlgorithm and MappingConnectorAlgorithm + respectively is now threaded. + +2) It is now possible to run on problems with a global cell count in excess + of 2G. + +3) Side-centered patch data classes have new constructors that provide + a simpler way to allocate data in all normal directions. + +4) New interfaces in TagAndInitializeStrategy and + StandardTagAndInitStrategy allow for callbacks to user code before + a PatchLevel is removed from a PatchHierarchy or replaced by a new + PatchLevel during regridding. + + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) The efficiency_tolerance and combine_efficiency input parameters have + been removed from GriddingAlgorithm and moved to BergerRigoutsos. The + corresponding args have been removed from findBoxesContainingTags(). + +2) Begining with Boost 1.53, the static_cast_tag and dynamic_cast_tag and + the constructors using them have been removed from shared_ptr. We have + therefore eliminated our use of them and the macro, BOOST_CAST_TAG from + the library. + +3) The input format for identifying multiblock singularities has + been simplified. + +4) A bug fix for certain VariableFillPattern classes has added an + argument to pure virtual method + VariableFillPattern::computeFillBoxesOverlap. + + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) The --enable-threading configuration option should be used with caution. + If used one should first ensure that their application is thread safe. + Also, one should ensure that threading will provide a performance + advantage on the target platform. On some platforms we have seen + significant performance degradation simply from enabling threading. + +2) The global number of cells held by BoxLevel is now a long. + +3) SideData and associated classes for side-centered data now have constructors + that take no "directions" vector. This provides a default case where + data is allocated in all normal directions. + +4) New interfaces in TagAndInitializeStrategy and + StandardTagAndInitStrategy allow for callbacks to user code before + a PatchLevel is removed from a PatchHierarchy or replaced by a new + PatchLevel during regridding. + + processLevelBeforeRemoval is called before the finest PatchLevel in + a hierarchy is to be removed--that is the total number of levels is being + reduced. This interface provides user code an opportunity to extract + any needed data from the PatchLevel before it is destroyed. + + processHierarchyBeforeAddingNewLevel is called both before adding an + entirely new PatchLevel at a new level of resolution to the hierarchy, + as well as before swapping an old PatchLevel for a new PatchLevel during + regridding. This allows user code an opportunity to do any needed + processing of the hierarchy while the old level still exists and the new + level is known. + + The most common use case for these interfaces is in user classes that + derive from StandardTagAndInitStrategy. These interfaces are provided + as virtual methods with default no-op implementations in + StandardTagAndInitStrategy. + + + + + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) The notions of efficiency_tolerance and combine_efficiency do not apply + to box generators in general. In SAMRAI the only box generator to which + they apply is BergerRigoutsos. Therefore the signature of the abstract + box generator method, findBoxesContainingTags, has been changed to + eliminate these args. This method is called from GriddingAlgorithm which + held these parameters so it no longer makes sense for the parameters to be + associated with GriddingAlgorithm. Instead they are associated with + BergerRigoutsos and this class' findBoxesContainingTags simply uses them + as needed. + +2) If you have used the BOOST_CAST_TAG you will need to use the equivalent + but less compact construct. For example if you had: + + boost::shared_ptr base = ...; + ... + boost::shared_ptr derived(base, BOOST_CAST_TAG); + + it will need to be replaced with: + + boost::shared_ptr base = ...; + ... + boost::shared_ptr derived( + BOOST_CAST(base)); + +3) The input format for identifying multiblock singularities has + been simplified. All that is now required for each singularity in + a multiblock mesh is the "blocks" entry within each SingularityN + input section, taking a list of integers representing the block numbers + of the blocks that touch that singularity, whether it be a point or a + line. + + Singularity0 { + blocks = 0,1,2,4,6 + } + + Additionally, the BlockNeighbors input sections no longer require an + "is_singularity" input option for neighboring blocks that touch across + an enhanced connectivity singularity. The library now determines this + information internally. + +4) A bug fix for certain VariableFillPattern classes has added an + argument to pure virtual method + VariableFillPattern::computeFillBoxesOverlap. + + The bug was that computeFillBoxesOverlap provided only a cell-centered + fill_boxes BoxContainer, which gave no way for concrete fill pattern + implementation for node-centered data or other data with centerings on + the boundary of a cell to distinguish data points that need filling + by interpolation from data points that can be filled from the source level. + A new argument, node_fill_boxes, has been added to computeFillBoxesOverlap + consisting of a BoxContainer of node-centered fill boxes. These boxes are + made by transforming the cell-centered fill boxes to a node centering and + then removing any nodes that can be filled from the source level. + + Only certain specialized implementations of VariableFillPattern need this + new argument. When not needed, it should be ignored. + + + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.8.0 b/base/SAMRAI/SAMRAI/docs/release/version-3.8.0 new file mode 100644 index 00000000..caea64e0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.8.0 @@ -0,0 +1,142 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.8.0 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) Bugs that were preventing ChopAndPackLoadBalancer from being used on + multiblock meshes have been fixed. + +2) Fixed errors in StandardTagAndInitialize::turnOffRefineBoxes, + StandardTagAndInitialize::turnOffGradientDetector, and + StandardTagAndInitialize::turnOffRichardsonExtrapolation that prevented all + of the requested refinement criteria from being turned off. + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) OuterfaceData and OutersideData can now copy to themselves + rather than just to FaceData or SideData. + +2) It is now possible to save PatchData to restart with having to use the + VariableDatabase via the new PatchDataRestartManager class. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) Rename test directory FAC_nonadaptive to FAC_staticrefinement. + +2) Bugs that were preventing ChopAndPackLoadBalancer from being used on + multiblock meshes have been fixed. + +3) Input requirements for setting up Multiblock meshes have been simplified. + It is no longer necessary to provide Singularity information in the + input files. + +4) The Neighbor objects in BaseGridGeometry, which provide information + about neighboring blocks in multiblock meshes, are now stored in + STL maps. + +5) We have new options for mesh generation using "tiles". This should help + if you are scaling above 100K processor runs. For smaller runs, the + older algorithms should be sufficient. + + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) OuterfaceData and OutersideData can now copy to themselves + rather than just to FaceData or SideData. Previously copy methods + were only implement for copies of OuterfaceData -> FaceData and + OutersideData -> SideData. + +2) We have always advertised that the VariableDatabase is completely optional. + The one case where that was not true was if one wished to save PatchData to + restart. A new class, PatchdataRestartManager, has been introduced to + provide the ability to register PatchData for restart in a manner analogous + to how other SAMRAI entities are registered for restart. To see how to use + this new way of putting PatchData to restart see the performance Euler and + LinAdv tests, the Euler and LinAdv application tests, and the sparsedata + test. It is also used in several places in the libaray. + + + + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) Rename test directory FAC_nonadaptive to FAC_staticrefinement. + The old name led some to believe it didn't use AMR. + +2) Bugs that were preventing ChopAndPackLoadBalancer from being used on + multiblock meshes have been fixed. ChopAndPackLoadBalancer can be used + for spatially-based load-balancing and non-uniform load balancing, though + it is not recommended for problems running at very large parallel + processor counts. + +3) Input requirements for setting up Multiblock meshes have been simplified. + It is no longer necessary to provide Singularity information in the + input files. Singularities are now found computationally by the code. + +4) The Neighbor objects in BaseGridGeometry, which provide information + about neighboring blocks in multiblock meshes, are now stored in + STL maps instead of lists. Some interfaces and usage patterns have changed + to reflect this. + +5) If you set up your code properly, SAMRAI's mesh management and dynamic + remeshing algorithms should scale well to 100K processors. Approaching + 1M processors, the older clustering algorithm (BergerRigoutsos) and + partitioner (TreeLoadBalancer) will start to slow down. If your runs + are in this range, try using the TileClustering alternative. You have + to specify a tile size in the TileClustering input and a corresponding + tile size (in the refined resolution) in the TreeLoadBalancer input. + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.8.1 b/base/SAMRAI/SAMRAI/docs/release/version-3.8.1 new file mode 100644 index 00000000..3a8cb663 --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.8.1 @@ -0,0 +1,80 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.8.1 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) Periodic shift computed by refineHierarchy and coarsenHierarchy have been fixed. + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) ChopAndPackLoadBalancer now support tiling mode. + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) + + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) ChopAndPackLoadBalancer now support tiling mode. Tiling is enabled + through the ChopAndPackLoadBalancer input parameter tile_size, just + like in other load balancers. + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/release/version-3.9.0 b/base/SAMRAI/SAMRAI/docs/release/version-3.9.0 new file mode 100644 index 00000000..b2023405 --- /dev/null +++ b/base/SAMRAI/SAMRAI/docs/release/version-3.9.0 @@ -0,0 +1,134 @@ +***************************************************************************** + Copyright 1997-2016 + Lawrence Livermore National Security, LLC. + All rights reserved. +***************************************************************************** + + Release Notes for SAMRAI v3.9.0 + + (notes for previous releases may be found in /SAMRAI/docs/release) + +***************************************************************************** + +Please direct any questions related to these notes to the SAMRAI development +team by sending email to samrai@llnl.gov. + +LLNL users can use the discussion groups on the LLNL Sourceforge site: + +https://sourceforge.llnl.gov/sf/discussion/do/listForums/projects.samrai/discussion + +***************************************************************************** + +Where to report Bugs +-------------------- + +If a bug is found in the SAMRAI library, we ask that you kindly report +it to us so that we may fix it. LLNL users may report bugs using the +LLNL Sourceforge site if you have a sourceforge account: + +https://sourceforge.llnl.gov/sf/tracker/do/listTrackers/projects.samrai/tracker + +Bugs found by other users should send email to samrai-bugs@llnl.gov. + +***************************************************************************** + +---------------------------------------------------------------------------- + Significant bug fixes +---------------------------------------------------------------------------- + +1) Fixed bug in making a refined/coarsened hierarchy when there are periodic + directions. The bug led to wrong periodic shifts in the created hierarchy. + +2) Fixed bug that led to non-nesting or bad levels. The occurance of this + symptom is extremely rare but can happen during GriddingAlgorithm's + box manipulations. + +3) Error checking has been added to ensure that transpose pairs of Connectors + have consistent Connector widths. If both levels connected by the + Connectors are at the level of mesh resolution, the transpose + Connectors must have identical Connector widths. If the levels are at + different levels of resolution, the Connector widths must be consistent + such that refining the width associated with the coarser level will + yield the width associated with the finer level. + +Bug fix in v. 3.9.1: + +4) A bug has been fixed that caused incorrect computations of periodic shifts + when different grid geometries of different sizes were used in the same + application. Now periodic shifts are computed using a PeriodicShiftCatalog + object that is unique to each grid geometry and can be retrieved using + BaseGridGeometry::getPeriodicShiftCatalog(). This bug fix required a change + to the interfaces of one constructor of class Box and one overloaded + version of Box::initialize(). + +***************************************************************************** + +---------------------------------------------------------------------------- + Summary of what's new +----------------------------------------------------------------------------- + +This section contains a summary of additions to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) Formalized the value type of tbox::Dimension with a typedef. + +2) VisItDataWriter::packRegularAndDerivedData now takes a simulation time. + This is useful when the derived data is a function of time. + +----------------------------------------------------------------------------- + Summary of what's changed +----------------------------------------------------------------------------- + +This section contains a summary of changes to SAMRAI. More detailed +descriptions of items in the following list are provided below. + +1) Type returned for cell counts changed from int to size_t. + +2) BalanceUtilities::gatherAndReportLoadBalance changed to + BalanceUtilities::reduceAndReportLoadBalance. + +3) BaseGridGeometry::getNeighbors() has been replaced by iterators over the + neighbors accessed by begin(), end(), and find(). + +4) The non-const versions of Box::upper() and Box::lower() have been replaced + by Box::setUpper() and Box::setLower(). + + +***************************************************************************** + +----------------------------------------------------------------------------- + Details about what's new +----------------------------------------------------------------------------- + +1) Dimension::getValue has been returning an unsigned short. This type has + been formalized with the typedef Dimension::dir_t. + + + +----------------------------------------------------------------------------- + Details about what's changed +----------------------------------------------------------------------------- + +1) Cell counts, as returned by methods such as Box::size, Box::offset, etc. + changed from int to size_t. This was done in order to prevent integer + overflows for huge boxes. + +2) BalanceUtilities::gatherAndReportLoadBalance changed to + BalanceUtilities::reduceAndReportLoadBalance and uses a reduce instead of + a gather for faster completion. The gathered data wasn't useful anyway. + +3) BaseGridGeometry::getNeighbors() exposed the implementation of the storage + of each block's neighbors. It has been replaced by NeighborIterator and + ConstNeighborIterator which iterate over the neighbors of a block. The + method begin(const BlockId&) returns an iterator pointing to the first + Neighbor of the block with the supplied BlockId. Similarly, + end(const BlockId&) returns an iterator pointing one past the last neighbor + of the block with the supplied BlockId. find(const BlockId&, const BlockId&) + returns an iterator pointing to the Neighbor with the 2nd BlockId of the the + block with the 1st BlockId or end() if there is no such Neighbor. + +4) Makes the places where Boxes are being modified explicit. + + +============================================================================= +============================================================================= diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/FAC-Preconditioner.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/FAC-Preconditioner.pdf index f5d1b288..e09f09af 100644 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/FAC-Preconditioner.pdf and b/base/SAMRAI/SAMRAI/docs/userdocs/FAC-Preconditioner.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/InputParametersAndRestart.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/InputParametersAndRestart.pdf new file mode 100644 index 00000000..e8a4f968 Binary files /dev/null and b/base/SAMRAI/SAMRAI/docs/userdocs/InputParametersAndRestart.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Laplacian-ex.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Laplacian-ex.pdf index f5d2f7ea..0746654a 100644 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Laplacian-ex.pdf and b/base/SAMRAI/SAMRAI/docs/userdocs/Laplacian-ex.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Multiblock.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Multiblock.pdf index a4f9495b..4d01465d 100644 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Multiblock.pdf and b/base/SAMRAI/SAMRAI/docs/userdocs/Multiblock.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/NonlinearSolver.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/NonlinearSolver.pdf deleted file mode 100644 index cb000c93..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/NonlinearSolver.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Poisson.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Poisson.pdf index 0aa17175..0e793283 100644 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Poisson.pdf and b/base/SAMRAI/SAMRAI/docs/userdocs/Poisson.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/RestartRedistribute.txt b/base/SAMRAI/SAMRAI/docs/userdocs/RestartRedistribute.txt index 4aa20662..29de4a9b 100644 --- a/base/SAMRAI/SAMRAI/docs/userdocs/RestartRedistribute.txt +++ b/base/SAMRAI/SAMRAI/docs/userdocs/RestartRedistribute.txt @@ -19,33 +19,39 @@ To use the tool, one must first have a set of restart files that was dumped from a run of a SAMRAI-based application. The restart files will be in a directory tree that looks something like: -restart-dir/restore.00005/nodes.00008/proc.00000 - /proc.00001 - /proc.00002 - /proc.00003 - /proc.00004 - /proc.00005 - /proc.00006 - /proc.00007 +restart-dir/restore.000005/nodes.0000008/proc.0000000 + /proc.0000001 + /proc.0000002 + /proc.0000003 + /proc.0000004 + /proc.0000005 + /proc.0000006 + /proc.0000007 'restart-dir' is the directory containing all of the restart dumps. The name of this directory is specified in the input file for the application. 'restart-dir' contains a set of subdirectories with -names in the format of 'restore.DDDDD',where the DDDDD is a a 5-digit -integer that identifies the timestep of the dump. The 'restore.DDDDD' -subdirectory contains a subdirectory 'nodes.NNNNN', where NNNNN is a 5 +names in the format of 'restore.DDDDDD',where the DDDDDD is a a 6-digit +integer that identifies the timestep of the dump. The 'restore.DDDDDD' +subdirectory contains a subdirectory 'nodes.NNNNNNN', where NNNNNNN is a 7 digit integer that specifies the number of processors on which the -application ran. The 'nodes.NNNNN' subdirectory then contains the set +application ran. The 'nodes.NNNNNNN' subdirectory then contains the set of HDF files containing the restart data. The HDF files are named -with the format 'proc.PPPPP', where PPPPP is a 5-digit integer that +with the format 'proc.PPPPPPP', where PPPPPPP is a 7-digit integer that indicates the MPI rank of the the processor that wrote the file. -NOTE: If there is more than one 'nodes.NNNNN' subdirectory the +NOTE: If there is more than one 'nodes.NNNNNNN' subdirectory the resdistribute utility will fail. -The usage of the restart redistribute tool is: +The restart-redistribute tool is a parallel tool. It is parallelized on the +smaller of the number of input files--original number of processors--and the +number of output files--new desired number of processors. Therefore, you may +run on any number of processors up to, but not greater than, this number. +Running parallel programs is platform dependent. The following example showing +the usage of the restart-redistribute tool assumes the use of mpirun to launch +parallel programs: -restart-redistribute INPUT-DIR OUTPUT-DIR TIMESTEP NUM_PROCS_IN NUM_PROCS_OUT +mpirun -np N restart-redistribute INPUT-DIR OUTPUT-DIR TIMESTEP NUM_PROCS_OUT INPUT-DIR - the directory containing the restart dumps from a run @@ -57,9 +63,10 @@ TIMESTEP - integer identifier of the timestep of the restart NUM_PROCS_OUT - the number of processors desired for a new restarted run of the application. -To run the tool on the example given above to redistribute 8 processor restart files to a 16 processor restart file, one would use: +To run the tool on the example given above to redistribute 8 processor restart +files to 16 processor restart file at timestep 5, one could use: -restart-redistribute restart-dir new-restart-dir 5 16 +mpirun -np 8 restart-redistribute restart-dir new-restart-dir 5 16 The resulting restart files could then be used to restart the run on 16 procsessors. diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Robin-Bc.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Robin-Bc.pdf index 7bf6199e..0f27afc4 100644 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Robin-Bc.pdf and b/base/SAMRAI/SAMRAI/docs/userdocs/Robin-Bc.pdf differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-Concepts_SoftwareDesign.docx b/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-Concepts_SoftwareDesign.docx new file mode 100644 index 00000000..f052fb2e Binary files /dev/null and b/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-Concepts_SoftwareDesign.docx differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-overview.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-overview.pdf deleted file mode 100644 index ea8c80e8..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/SAMRAI-overview.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Schedule-Boundary.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Schedule-Boundary.pdf deleted file mode 100644 index 32955279..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Schedule-Boundary.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer-slides.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer-slides.pdf deleted file mode 100644 index 271464c4..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer-slides.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer.pdf deleted file mode 100644 index 90878ebb..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/VisIt-writer.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/Vizamrai-writer.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/Vizamrai-writer.pdf deleted file mode 100644 index 8d9c12cc..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/Vizamrai-writer.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/docs/userdocs/userguide.pdf b/base/SAMRAI/SAMRAI/docs/userdocs/userguide.pdf deleted file mode 100644 index 2ab0b6aa..00000000 Binary files a/base/SAMRAI/SAMRAI/docs/userdocs/userguide.pdf and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/Makefile.in b/base/SAMRAI/SAMRAI/source/Makefile.in index 8ef66720..2c59a6c9 100644 --- a/base/SAMRAI/SAMRAI/source/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the entire SAMRAI distribution ## ######################################################################### @@ -22,5 +22,5 @@ SUBDIRS = SAMRAI library: for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + for DIR in $(SUBDIRS) test; do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/Makefile.in index 70875425..4764111d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the entire SAMRAI distribution ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.C index 90b4f778..2046094d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Integration routines for single level in AMR hierarchy * (basic hyperbolic systems) * ************************************************************************/ - -#ifndef included_algs_HyperbolicLevelIntegrator_C -#define included_algs_HyperbolicLevelIntegrator_C - #include "SAMRAI/algs/HyperbolicLevelIntegrator.h" #include "SAMRAI/pdat/CellData.h" @@ -28,6 +24,7 @@ #include "SAMRAI/xfer/CoarsenSchedule.h" #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/hier/PatchDataFactory.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -58,63 +55,63 @@ extern "C" { #endif // in upfluxsum1d.m4: -void F77_FUNC(upfluxsum1d, UPFLUXSUM1D) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsum1d, UPFLUXSUM1D) (const int&, const int&, const int&, const int&, const double *, double *); // in upfluxsum2d.m4: -void F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); // in upfluxsum3d.m4: -void F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -157,9 +154,17 @@ boost::shared_ptr HyperbolicLevelIntegrator::t_coarsen_rich_extrap; boost::shared_ptr HyperbolicLevelIntegrator::t_get_level_dt; boost::shared_ptr HyperbolicLevelIntegrator::t_get_level_dt_sync; boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level; +boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_integrate; +boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_pre_integrate; +boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_post_integrate; +boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_patch_loop; boost::shared_ptr HyperbolicLevelIntegrator::t_new_advance_bdry_fill_comm; boost::shared_ptr HyperbolicLevelIntegrator::t_patch_num_kernel; boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_sync; +boost::shared_ptr HyperbolicLevelIntegrator::t_advance_level_compute_dt; +boost::shared_ptr HyperbolicLevelIntegrator::t_preprocess_flux_data; +boost::shared_ptr HyperbolicLevelIntegrator::t_postprocess_flux_data; +boost::shared_ptr HyperbolicLevelIntegrator::t_copy_time_dependent_data; boost::shared_ptr HyperbolicLevelIntegrator::t_std_level_sync; boost::shared_ptr HyperbolicLevelIntegrator::t_sync_new_levels; boost::shared_ptr HyperbolicLevelIntegrator::t_barrier_after_error_bdry_fill_comm; @@ -174,9 +179,9 @@ boost::shared_ptr HyperbolicLevelIntegrator::t_coarsen_sync_comm; /* * Statistics on number of cells and patches generated. */ -tbox::Array > HyperbolicLevelIntegrator::s_boxes_stat; -tbox::Array > HyperbolicLevelIntegrator::s_cells_stat; -tbox::Array > HyperbolicLevelIntegrator::s_timestamp_stat; +std::vector > HyperbolicLevelIntegrator::s_boxes_stat; +std::vector > HyperbolicLevelIntegrator::s_cells_stat; +std::vector > HyperbolicLevelIntegrator::s_timestamp_stat; #endif /* @@ -195,73 +200,38 @@ HyperbolicLevelIntegrator::HyperbolicLevelIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, HyperbolicPatchStrategy* patch_strategy, - bool register_for_restart, bool use_time_refinement): - d_dim(patch_strategy->getDim()) + d_patch_strategy(patch_strategy), + d_object_name(object_name), + d_use_time_refinement(use_time_refinement), + d_cfl(tbox::MathUtilities::getSignalingNaN()), + d_cfl_init(tbox::MathUtilities::getSignalingNaN()), + d_lag_dt_computation(true), + d_use_ghosts_for_dt(false), + d_use_flux_correction(true), + d_flux_is_face(true), + d_flux_face_registered(false), + d_flux_side_registered(false), + d_number_time_data_levels(2), + d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")), + d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), + d_new(hier::VariableDatabase::getDatabase()->getContext("NEW")), + d_plot_context(d_current), + d_have_flux_on_level_zero(false), + d_distinguish_mpi_reduction_costs(false), + d_barrier_advance_level_sections(false) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(patch_strategy != ((HyperbolicPatchStrategy *)NULL)); - - d_object_name = object_name; - d_use_time_refinement = use_time_refinement; - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } - - d_patch_strategy = patch_strategy; - - /* - * Default parameter values. - */ - d_number_time_data_levels = 2; + TBOX_ASSERT(patch_strategy != 0); - d_flux_is_face = true; - d_flux_face_registered = false; - d_flux_side_registered = false; - - d_have_flux_on_level_zero = false; - - d_lag_dt_computation = true; - d_use_ghosts_for_dt = false; - d_distinguish_mpi_reduction_costs = false; - - d_cfl = tbox::MathUtilities::getSignalingNaN(); - d_cfl_init = tbox::MathUtilities::getSignalingNaN(); - - /* - * Communication algorithms. - */ - d_bdry_fill_advance.reset(new xfer::RefineAlgorithm(d_dim)); - d_bdry_fill_advance_new.reset(new xfer::RefineAlgorithm(d_dim)); - d_bdry_fill_advance_old.reset(new xfer::RefineAlgorithm(d_dim)); - d_fill_new_level.reset(new xfer::RefineAlgorithm(d_dim)); - d_coarsen_fluxsum.reset(new xfer::CoarsenAlgorithm(d_dim)); - d_coarsen_sync_data.reset(new xfer::CoarsenAlgorithm(d_dim)); - d_sync_initial_data.reset(new xfer::CoarsenAlgorithm(d_dim)); - - d_coarsen_rich_extrap_init.reset(new xfer::CoarsenAlgorithm(d_dim)); - d_coarsen_rich_extrap_final.reset(new xfer::CoarsenAlgorithm(d_dim)); - - /* - * hier::Variable contexts used in algorithm. Note that "OLD" context - * is only created and used in the case of Richardson extrapolation - * and a refinement ratio of 3 (see registerModelVariables()). - */ - d_scratch = hier::VariableDatabase::getDatabase()->getContext("SCRATCH"); - d_current = hier::VariableDatabase::getDatabase()->getContext("CURRENT"); - d_new = hier::VariableDatabase::getDatabase()->getContext("NEW"); - - d_plot_context = d_current; + tbox::RestartManager::getManager()->registerRestartItem(d_object_name, + this); /* * Initialize object with data read from the input and restart databases. */ - bool from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (from_restart && d_registered_for_restart) { + if (from_restart) { getFromRestart(); } getFromInput(input_db, from_restart); @@ -277,9 +247,7 @@ HyperbolicLevelIntegrator::HyperbolicLevelIntegrator( */ HyperbolicLevelIntegrator::~HyperbolicLevelIntegrator() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); } /* @@ -312,16 +280,11 @@ HyperbolicLevelIntegrator::initializeLevelData( const boost::shared_ptr& old_level, const bool allocate_data) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } + TBOX_ASSERT(!old_level || level_number == old_level->getLevelNumber()); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); @@ -391,7 +354,7 @@ HyperbolicLevelIntegrator::initializeLevelData( patch->setPatchData(old_indx, patch->getPatchData(cur_indx)); - time_dep_var++; + ++time_dep_var; } } @@ -441,23 +404,22 @@ HyperbolicLevelIntegrator::resetHierarchyConfiguration( { NULL_USE(finest_level); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((coarsest_level >= 0) && (coarsest_level <= finest_level) && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln0 = 0; ln0 <= finest_level; ln0++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln0 = 0; ln0 <= finest_level; ++ln0) { TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); } #endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); int finest_hiera_level = hierarchy->getFinestLevelNumber(); - d_bdry_sched_advance.resizeArray(finest_hiera_level + 1); - d_bdry_sched_advance_new.resizeArray(finest_hiera_level + 1); + d_bdry_sched_advance.resize(finest_hiera_level + 1); + d_bdry_sched_advance_new.resize(finest_hiera_level + 1); - for (int ln = coarsest_level; ln <= finest_hiera_level; ln++) { + for (int ln = coarsest_level; ln <= finest_hiera_level; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); t_advance_bdry_fill_create->start(); @@ -513,7 +475,6 @@ HyperbolicLevelIntegrator::applyGradientDetector( TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); t_apply_gradient_detector->start(); @@ -597,16 +558,16 @@ HyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( && (level_number <= hierarchy->getFinestLevelNumber())); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); TBOX_ASSERT(coarse_level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *hierarchy, *coarse_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*hierarchy, *coarse_level); t_coarsen_rich_extrap->start(); - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); + hier::IntVector zero_vector(hier::IntVector::getZero(hierarchy->getDim())); boost::shared_ptr hier_level( hierarchy->getPatchLevel(level_number)); - hier::IntVector coarsen_ratio(d_dim); + hier::IntVector coarsen_ratio(zero_vector); if (coarse_level->getRatioToLevelZero() < zero_vector) { if (hier_level->getRatioToLevelZero() < zero_vector) { coarsen_ratio = coarse_level->getRatioToLevelZero() @@ -629,28 +590,28 @@ HyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( hier_level->getRatioToLevelZero()); } -#if 1 /* - * Compute the gcw needed for Connectors. The peer GCW for - * coarse<==>fine can be equivalent to the GCW for fine<==>fine in + * Compute the width needed for Connectors. The peer width for + * coarse<==>fine can be equivalent to the width for fine<==>fine in * the hierarcy, because the coarse level is just the coarsened fine - * level. We just have to convert the GCW to the correct refinement + * level. We just have to convert the width to the correct refinement * ratio before initializing the Connectors. */ - const hier::IntVector peer_gcw = + const hier::IntVector peer_connector_width = hierarchy->getRequiredConnectorWidth( level_number, - level_number); - - coarse_level->getBoxLevel()->getPersistentOverlapConnectors(). - findOrCreateConnector( - *hier_level->getBoxLevel(), - hier::IntVector::ceilingDivide(peer_gcw, coarsen_ratio)); - hier_level->getBoxLevel()->getPersistentOverlapConnectors(). - findOrCreateConnector( - *coarse_level->getBoxLevel(), - peer_gcw); -#endif + level_number, true); + + const hier::IntVector c_to_f_width = + hier::IntVector::ceilingDivide(peer_connector_width, coarsen_ratio); + + const hier::IntVector f_to_c_width(c_to_f_width * coarsen_ratio); + + coarse_level->findConnectorWithTranspose( + *hier_level, + c_to_f_width, + f_to_c_width, + hier::CONNECTOR_CREATE); if (before_advance) { @@ -714,7 +675,6 @@ HyperbolicLevelIntegrator::applyRichardsonExtrapolation( const bool uses_gradient_detector_too) { TBOX_ASSERT(level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); /* * Compare solutions computed on level (stored in NEW context) and on @@ -731,7 +691,7 @@ HyperbolicLevelIntegrator::applyRichardsonExtrapolation( const boost::shared_ptr& patch = *ip; d_patch_strategy-> - tagRichardsonExtrapolationCells(*patch, + tagRichardsonExtrapolationCells(*patch, error_level_number, d_new, // finer context d_current, // coarser context @@ -762,8 +722,8 @@ HyperbolicLevelIntegrator::initializeLevelIntegrator( const boost::shared_ptr& gridding_alg_strategy) { d_gridding_alg = - boost::dynamic_pointer_cast(gridding_alg_strategy); + BOOST_CAST( + gridding_alg_strategy); TBOX_ASSERT(d_gridding_alg); @@ -776,7 +736,7 @@ HyperbolicLevelIntegrator::initializeLevelIntegrator( << " gridding algorithm has bad error coarsen ratio" << std::endl); } - if ((d_gridding_alg->getTagAndInitializeStrategy()->usesTimeIntegration()) && + if ((d_gridding_alg->getTagAndInitializeStrategy()->everUsesTimeIntegration()) && (d_gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() == 3)) { d_number_time_data_levels = 3; d_old = hier::VariableDatabase::getDatabase()->getContext("OLD"); @@ -808,7 +768,6 @@ HyperbolicLevelIntegrator::getLevelDt( const bool initial_time) { TBOX_ASSERT(level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); const tbox::SAMRAI_MPI& mpi(level->getBoxLevel()->getMPI()); @@ -946,13 +905,7 @@ HyperbolicLevelIntegrator::getMaxFinerLevelDt( { NULL_USE(finer_level_number); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, ratio); - -#ifdef DEBUG_CHECK_ASSERTIONS - for (int id = 0; id < d_dim.getValue(); id++) { - TBOX_ASSERT(ratio(id) > 0); - } -#endif + TBOX_ASSERT(ratio.min() > 0); return coarse_dt / double(ratio.max()); } @@ -1045,14 +998,16 @@ HyperbolicLevelIntegrator::advanceLevel( TBOX_ASSERT(level); TBOX_ASSERT(hierarchy); TBOX_ASSERT(current_time <= new_time); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *level, *hierarchy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*level, *hierarchy); // HLI_RECORD_STATS is defined in HyperbolicLevelIntegrator.h #ifdef HLI_RECORD_STATS recordStatistics(*level, current_time); #endif + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); t_advance_level->start(); + t_advance_level_pre_integrate->start(); const int level_number = level->getLevelNumber(); const double dt = new_time - current_time; @@ -1132,6 +1087,10 @@ HyperbolicLevelIntegrator::advanceLevel( d_patch_strategy->clearDataContext(); fill_schedule.reset(); + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level_pre_integrate->stop(); + t_advance_level_integrate->start(); + preprocessFluxData(level, current_time, new_time, @@ -1154,6 +1113,9 @@ HyperbolicLevelIntegrator::advanceLevel( regrid_advance); t_patch_num_kernel->stop(); + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level_patch_loop->start(); + d_patch_strategy->setDataContext(d_scratch); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { @@ -1180,6 +1142,9 @@ HyperbolicLevelIntegrator::advanceLevel( } d_patch_strategy->clearDataContext(); + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level_patch_loop->stop(); + level->setTime(new_time, d_saved_var_scratch_data); level->setTime(new_time, d_flux_var_data); @@ -1194,6 +1159,10 @@ HyperbolicLevelIntegrator::advanceLevel( regrid_advance); t_patch_num_kernel->stop(); + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level_integrate->stop(); + t_advance_level_post_integrate->start(); + /* * (9) If the level advance is for regridding, we compute the next timestep: * @@ -1213,6 +1182,8 @@ HyperbolicLevelIntegrator::advanceLevel( if (!regrid_advance) { + t_advance_level_compute_dt->start(); + if (d_lag_dt_computation) { if (d_use_ghosts_for_dt) { @@ -1228,7 +1199,7 @@ HyperbolicLevelIntegrator::advanceLevel( if (!d_bdry_sched_advance_new[level_number]) { TBOX_ERROR( d_object_name << ": " - << "Attempt to fill new ghost data for timestep" + << "Attempt to fill new ghost data for timestep " << "computation, but schedule not defined." << std::endl); } @@ -1263,6 +1234,8 @@ HyperbolicLevelIntegrator::advanceLevel( } d_patch_strategy->clearDataContext(); + t_advance_level_compute_dt->stop(); + } // !regrid_advance level->deallocatePatchData(d_saved_var_scratch_data); @@ -1272,8 +1245,8 @@ HyperbolicLevelIntegrator::advanceLevel( first_step, last_step); - t_advance_level->stop(); - + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level_post_integrate->stop(); t_advance_level_sync->start(); if (d_distinguish_mpi_reduction_costs) { @@ -1295,6 +1268,9 @@ HyperbolicLevelIntegrator::advanceLevel( t_advance_level_sync->stop(); } + if ( d_barrier_advance_level_sections ) level->getBoxLevel()->getMPI().Barrier(); + t_advance_level->stop(); + return next_dt; } @@ -1316,10 +1292,9 @@ HyperbolicLevelIntegrator::standardLevelSynchronization( const double old_time) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); - tbox::Array old_times(finest_level - coarsest_level + 1); - for (int i = coarsest_level; i <= finest_level; i++) { + std::vector old_times(finest_level - coarsest_level + 1); + for (int i = coarsest_level; i <= finest_level; ++i) { old_times[i] = old_time; } standardLevelSynchronization(hierarchy, coarsest_level, finest_level, @@ -1332,27 +1307,25 @@ HyperbolicLevelIntegrator::standardLevelSynchronization( const int coarsest_level, const int finest_level, const double sync_time, - const tbox::Array& old_times) + const std::vector& old_times) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((coarsest_level >= 0) && (coarsest_level < finest_level) && (finest_level <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(old_times.getSize() >= finest_level); - for (int ln = coarsest_level; ln < finest_level; ln++) { + TBOX_ASSERT(static_cast(old_times.size()) >= finest_level); +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln = coarsest_level; ln < finest_level; ++ln) { TBOX_ASSERT(hierarchy->getPatchLevel(ln)); TBOX_ASSERT(sync_time >= old_times[ln]); } - TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); #endif + TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); t_std_level_sync->start(); - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { + for (int fine_ln = finest_level; fine_ln > coarsest_level; --fine_ln) { const int coarse_ln = fine_ln - 1; - TBOX_ASSERT(sync_time >= old_times[coarse_ln]); - boost::shared_ptr fine_level( hierarchy->getPatchLevel(fine_ln)); boost::shared_ptr coarse_level( @@ -1409,16 +1382,15 @@ HyperbolicLevelIntegrator::synchronizeNewLevels( const double sync_time, const bool initial_time) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((coarsest_level >= 0) && (coarsest_level < finest_level) && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln = coarsest_level; ln <= finest_level; ln++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln = coarsest_level; ln <= finest_level; ++ln) { TBOX_ASSERT(hierarchy->getPatchLevel(ln)); } #endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); t_sync_new_levels->start(); @@ -1426,7 +1398,7 @@ HyperbolicLevelIntegrator::synchronizeNewLevels( d_patch_strategy->setDataContext(d_current); - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { + for (int fine_ln = finest_level; fine_ln > coarsest_level; --fine_ln) { const int coarse_ln = fine_ln - 1; boost::shared_ptr fine_level( @@ -1482,6 +1454,8 @@ HyperbolicLevelIntegrator::synchronizeNewLevels( * (3) Conservatively coarsen solution on interior of fine level to * coarse level. * + * There is an option d_use_flux_correction which can skip (1) and (2). + * ************************************************************************* */ @@ -1496,8 +1470,11 @@ HyperbolicLevelIntegrator::synchronizeLevelWithCoarser( TBOX_ASSERT(coarse_level); TBOX_ASSERT(coarse_level->getLevelNumber() == (fine_level->getLevelNumber() - 1)); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *fine_level, *coarse_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*fine_level, *coarse_level); + TBOX_ASSERT(sync_time > coarse_sim_time); + boost::shared_ptr sched; + /* * Coarsen flux integrals around fine patch boundaries to coarser level * and replace coarse flux information where appropriate. NULL patch @@ -1505,52 +1482,55 @@ HyperbolicLevelIntegrator::synchronizeLevelWithCoarser( * i.e. patch model is not needed in coarsening of flux integrals. */ - t_coarsen_fluxsum_create->start(); - boost::shared_ptr sched( - d_coarsen_fluxsum->createSchedule( + + if (d_use_flux_correction) { + + t_coarsen_fluxsum_create->start(); + sched = d_coarsen_fluxsum->createSchedule( coarse_level, fine_level, - NULL)); - t_coarsen_fluxsum_create->stop(); + 0); + t_coarsen_fluxsum_create->stop(); - t_coarsen_fluxsum_comm->start(); - sched->coarsenData(); - t_coarsen_fluxsum_comm->stop(); - - /* - * Repeat conservative difference on coarser level. - */ - coarse_level->allocatePatchData(d_saved_var_scratch_data, coarse_sim_time); - coarse_level->setTime(coarse_sim_time, d_flux_var_data); + t_coarsen_fluxsum_comm->start(); + sched->coarsenData(); + t_coarsen_fluxsum_comm->stop(); - d_patch_strategy->setDataContext(d_scratch); - t_advance_bdry_fill_comm->start(); - d_bdry_sched_advance[coarse_level->getLevelNumber()]-> - fillData(coarse_sim_time); - t_advance_bdry_fill_comm->stop(); + /* + * Repeat conservative difference on coarser level. + */ + coarse_level->allocatePatchData(d_saved_var_scratch_data, coarse_sim_time); + coarse_level->setTime(coarse_sim_time, d_flux_var_data); - const double reflux_dt = sync_time - coarse_sim_time; + d_patch_strategy->setDataContext(d_scratch); + t_advance_bdry_fill_comm->start(); + d_bdry_sched_advance[coarse_level->getLevelNumber()]-> + fillData(coarse_sim_time); + t_advance_bdry_fill_comm->stop(); - for (hier::PatchLevel::iterator ip(coarse_level->begin()); - ip != coarse_level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; + const double reflux_dt = sync_time - coarse_sim_time; - patch->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); + for (hier::PatchLevel::iterator ip(coarse_level->begin()); + ip != coarse_level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; - bool at_syncronization = true; - d_patch_strategy->conservativeDifferenceOnPatch(*patch, - coarse_sim_time, - reflux_dt, - at_syncronization); - patch->deallocatePatchData(d_temp_var_scratch_data); - } + patch->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); - d_patch_strategy->clearDataContext(); + bool at_syncronization = true; + d_patch_strategy->conservativeDifferenceOnPatch(*patch, + coarse_sim_time, + reflux_dt, + at_syncronization); + patch->deallocatePatchData(d_temp_var_scratch_data); + } - copyTimeDependentData(coarse_level, d_scratch, d_new); + d_patch_strategy->clearDataContext(); - coarse_level->deallocatePatchData(d_saved_var_scratch_data); + copyTimeDependentData(coarse_level, d_scratch, d_new); + coarse_level->deallocatePatchData(d_saved_var_scratch_data); + } + /* * Coarsen time-dependent data from fine patch interiors to coarse patches. */ @@ -1589,7 +1569,6 @@ HyperbolicLevelIntegrator::resetTimeDependentData( const bool can_be_refined) { TBOX_ASSERT(level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); @@ -1599,7 +1578,7 @@ HyperbolicLevelIntegrator::resetTimeDependentData( const boost::shared_ptr& patch = *ip; std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); + d_time_dep_variables.begin(); while (time_dep_var != d_time_dep_variables.end()) { int cur_indx = @@ -1639,7 +1618,7 @@ HyperbolicLevelIntegrator::resetTimeDependentData( patch->deallocatePatchData(new_indx); - time_dep_var++; + ++time_dep_var; } @@ -1667,7 +1646,6 @@ HyperbolicLevelIntegrator::resetDataToPreadvanceState( const boost::shared_ptr& level) { TBOX_ASSERT(level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); /* * De-allocate new context @@ -1760,7 +1738,24 @@ HyperbolicLevelIntegrator::registerVariable( TBOX_ASSERT(var); TBOX_ASSERT(transfer_geom); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, *var); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, *var); + + if (!d_bdry_fill_advance) { + /* + * One-time set-up for communication algorithms. + * We wait until this point to do this because we need a dimension. + */ + d_bdry_fill_advance.reset(new xfer::RefineAlgorithm()); + d_bdry_fill_advance_new.reset(new xfer::RefineAlgorithm()); + d_bdry_fill_advance_old.reset(new xfer::RefineAlgorithm()); + d_fill_new_level.reset(new xfer::RefineAlgorithm()); + d_coarsen_fluxsum.reset(new xfer::CoarsenAlgorithm(dim)); + d_coarsen_sync_data.reset(new xfer::CoarsenAlgorithm(dim)); + d_sync_initial_data.reset(new xfer::CoarsenAlgorithm(dim)); + + d_coarsen_rich_extrap_init.reset(new xfer::CoarsenAlgorithm(dim)); + d_coarsen_rich_extrap_final.reset(new xfer::CoarsenAlgorithm(dim)); + } hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); @@ -1793,7 +1788,7 @@ HyperbolicLevelIntegrator::registerVariable( /* * Register variable and context needed for restart. */ - hier::VariableDatabase::getDatabase()-> + hier::PatchDataRestartManager::getManager()-> registerPatchDataForRestart(cur_id); /* @@ -1888,7 +1883,7 @@ HyperbolicLevelIntegrator::registerVariable( /* * Register variable and context needed for restart. */ - hier::VariableDatabase::getDatabase()-> + hier::PatchDataRestartManager::getManager()-> registerPatchDataForRestart(cur_id); /* @@ -1940,7 +1935,7 @@ HyperbolicLevelIntegrator::registerVariable( /* * Register variable and context needed for restart. */ - hier::VariableDatabase::getDatabase()-> + hier::PatchDataRestartManager::getManager()-> registerPatchDataForRestart(cur_id); boost::shared_ptr refine_op( @@ -1972,11 +1967,11 @@ HyperbolicLevelIntegrator::registerVariable( * synchronization of data betweeen patch levels in the hierarchy. */ const boost::shared_ptr > face_var( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(var)); const boost::shared_ptr > side_var( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(var)); if (face_var) { if (d_flux_side_registered) { @@ -2003,7 +1998,8 @@ HyperbolicLevelIntegrator::registerVariable( } else { TBOX_ERROR( d_object_name << ": " - << "Flux is neither face- or side-centered." << std::endl); + << "Flux is neither face- or side-centered." + << std::endl); } d_flux_variables.push_back(var); @@ -2023,8 +2019,9 @@ HyperbolicLevelIntegrator::registerVariable( if (d_flux_is_face) { boost::shared_ptr > fdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + hier::PatchDataFactory>(var->getPatchDataFactory())); + TBOX_ASSERT(fdf); fluxsum.reset(new pdat::OuterfaceVariable( dim, fsum_name, @@ -2032,8 +2029,9 @@ HyperbolicLevelIntegrator::registerVariable( d_flux_face_registered = true; } else { boost::shared_ptr > sdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + hier::PatchDataFactory>(var->getPatchDataFactory())); + TBOX_ASSERT(sdf); fluxsum.reset(new pdat::OutersideVariable( dim, fsum_name, @@ -2090,6 +2088,8 @@ HyperbolicLevelIntegrator::registerVariable( * If the advance is not temporary, we also zero out the FLUX INTEGRALS * on the first step of any level finer than level zero. * + * This method is local. + * ************************************************************************* */ @@ -2108,8 +2108,6 @@ HyperbolicLevelIntegrator::preprocessFluxData( TBOX_ASSERT(level); TBOX_ASSERT(cur_time <= new_time); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); const int level_number = level->getLevelNumber(); @@ -2148,21 +2146,21 @@ HyperbolicLevelIntegrator::preprocessFluxData( if (d_flux_is_face) { boost::shared_ptr > fsum_data( - patch->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fsum_id))); TBOX_ASSERT(fsum_data); fsum_data->fillAll(0.0); } else { boost::shared_ptr > fsum_data( - patch->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fsum_id))); TBOX_ASSERT(fsum_data); fsum_data->fillAll(0.0); } - fs_var++; + ++fs_var; } } @@ -2193,6 +2191,8 @@ HyperbolicLevelIntegrator::preprocessFluxData( * * If the advance is temporary, deallocate the flux data if first step. * + * This method is local. + * ************************************************************************* */ @@ -2206,11 +2206,10 @@ HyperbolicLevelIntegrator::postprocessFluxData( NULL_USE(last_step); TBOX_ASSERT(level); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); - if (d_dim > tbox::Dimension(3)) { + if (level->getDim() > tbox::Dimension(3)) { TBOX_ERROR( - "HyperbolicLevelIntegrator::postprocessFluxData : DIM > 3 not implemented"); + "HyperbolicLevelIntegrator::postprocessFluxData : DIM > 3 not implemented" << std::endl); } if (regrid_advance && first_step) { @@ -2245,15 +2244,15 @@ HyperbolicLevelIntegrator::postprocessFluxData( boost::shared_ptr > sfsum_data; int ddepth; - hier::IntVector flux_ghosts(d_dim); + hier::IntVector flux_ghosts(level->getDim()); if (d_flux_is_face) { fflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); + BOOST_CAST, hier::PatchData>( + flux_data); ffsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); + BOOST_CAST, hier::PatchData>( + fsum_data); TBOX_ASSERT(fflux_data && ffsum_data); TBOX_ASSERT(fflux_data->getDepth() == ffsum_data->getDepth()); @@ -2261,11 +2260,11 @@ HyperbolicLevelIntegrator::postprocessFluxData( flux_ghosts = fflux_data->getGhostCellWidth(); } else { sflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); + BOOST_CAST, hier::PatchData>( + flux_data); sfsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); + BOOST_CAST, hier::PatchData>( + fsum_data); TBOX_ASSERT(sflux_data && sfsum_data); TBOX_ASSERT(sflux_data->getDepth() == sfsum_data->getDepth()); @@ -2273,11 +2272,11 @@ HyperbolicLevelIntegrator::postprocessFluxData( flux_ghosts = sflux_data->getGhostCellWidth(); } - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { // loop over lower and upper parts of outer face/side arrays - for (int ifs = 0; ifs < 2; ifs++) { - if (d_dim == tbox::Dimension(1)) { - F77_FUNC(upfluxsum1d, UPFLUXSUM1D) (ilo(0), ihi(0), + for (int ifs = 0; ifs < 2; ++ifs) { + if (level->getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(upfluxsum1d, UPFLUXSUM1D) (ilo(0), ihi(0), flux_ghosts(0), ifs, fflux_data->getPointer(0, d), @@ -2285,15 +2284,15 @@ HyperbolicLevelIntegrator::postprocessFluxData( } else { if (d_flux_is_face) { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) (ilo(0), + if (level->getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) (ilo(0), ilo(1), ihi(0), ihi(1), flux_ghosts(0), flux_ghosts(1), ifs, fflux_data->getPointer(0, d), ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) (ilo(0), ilo(1), ihi(0), ihi(1), flux_ghosts(0), flux_ghosts(1), @@ -2302,8 +2301,8 @@ HyperbolicLevelIntegrator::postprocessFluxData( ffsum_data->getPointer(1, ifs, d)); } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) (ilo(0), + if (level->getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2312,7 +2311,7 @@ HyperbolicLevelIntegrator::postprocessFluxData( ifs, fflux_data->getPointer(0, d), ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2321,7 +2320,7 @@ HyperbolicLevelIntegrator::postprocessFluxData( ifs, fflux_data->getPointer(1, d), ffsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2332,15 +2331,15 @@ HyperbolicLevelIntegrator::postprocessFluxData( ffsum_data->getPointer(2, ifs, d)); } } else { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) (ilo(0), + if (level->getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) (ilo(0), ilo(1), ihi(0), ihi(1), flux_ghosts(0), flux_ghosts(1), ifs, sflux_data->getPointer(0, d), sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) (ilo(0), ilo(1), ihi(0), ihi(1), flux_ghosts(0), flux_ghosts(1), @@ -2348,8 +2347,8 @@ HyperbolicLevelIntegrator::postprocessFluxData( sflux_data->getPointer(1, d), sfsum_data->getPointer(1, ifs, d)); } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) (ilo(0), + if (level->getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2358,7 +2357,7 @@ HyperbolicLevelIntegrator::postprocessFluxData( ifs, sflux_data->getPointer(0, d), sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2367,7 +2366,7 @@ HyperbolicLevelIntegrator::postprocessFluxData( ifs, sflux_data->getPointer(1, d), sfsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) (ilo(0), + SAMRAI_F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) (ilo(0), ilo(1), ilo(2), ihi(0), ihi(1), ihi(2), flux_ghosts(0), @@ -2382,8 +2381,8 @@ HyperbolicLevelIntegrator::postprocessFluxData( } // loop over lower and upper sides/faces } // loop over depth - flux_var++; - fluxsum_var++; + ++flux_var; + ++fluxsum_var; } // loop over flux variables @@ -2410,7 +2409,7 @@ HyperbolicLevelIntegrator::copyTimeDependentData( TBOX_ASSERT(level); TBOX_ASSERT(src_context); TBOX_ASSERT(dst_context); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); + t_copy_time_dependent_data->start(); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { @@ -2425,13 +2424,71 @@ HyperbolicLevelIntegrator::copyTimeDependentData( patch->getPatchData(*time_dep_var, dst_context)); dst_data->copy(*src_data); - time_dep_var++; + ++time_dep_var; } } + t_copy_time_dependent_data->stop(); + +} + +/* + ************************************************************************* + * Pass to HyperbolicPatchStrategy to check user tags on a tagged + * level. + ************************************************************************* + */ +void +HyperbolicLevelIntegrator::checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + + boost::shared_ptr level( + hierarchy->getPatchLevel(level_number)); + + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + d_patch_strategy->checkUserTagData(*patch, + tag_index); + } + +} + +/* + ************************************************************************* + * Pass to StandardTagAndInitStrategy to check saved tags on a new level. + ************************************************************************* + */ +void +HyperbolicLevelIntegrator::checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + + boost::shared_ptr level( + hierarchy->getPatchLevel(level_number)); + + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + d_patch_strategy->checkNewPatchTagData(*patch, + tag_index); + } } + + /* ************************************************************************* * @@ -2443,14 +2500,13 @@ HyperbolicLevelIntegrator::recordStatistics( const hier::PatchLevel& patch_level, double current_time) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, patch_level); const int ln = patch_level.getLevelNumber(); - if (ln >= s_boxes_stat.size()) { - s_boxes_stat.resizeArray(ln + 1); - s_cells_stat.resizeArray(ln + 1); - s_timestamp_stat.resizeArray(ln + 1); + if (ln >= static_cast(s_boxes_stat.size())) { + s_boxes_stat.resize(ln + 1); + s_cells_stat.resize(ln + 1); + s_timestamp_stat.resize(ln + 1); } if (ln >= 0 /* Don't record work on non-hierarchy levels */) { @@ -2468,17 +2524,12 @@ HyperbolicLevelIntegrator::recordStatistics( getStatistic(std::string("HLI_TimeL") + lnstr, "PROC_STAT"); } - double level_gridcells = 0.; - double level_local_patches = 0.; - for (hier::PatchLevel::iterator ip(patch_level.begin()); - ip != patch_level.end(); ++ip) { - const boost::shared_ptr& patch = *ip; - level_gridcells += patch->getBox().size(); - level_local_patches += 1.0; - } - - s_boxes_stat[ln]->recordProcStat(level_local_patches); - s_cells_stat[ln]->recordProcStat(level_gridcells); + double level_local_boxes = + static_cast(patch_level.getBoxLevel()->getLocalNumberOfBoxes()); + double level_local_cells = + static_cast(patch_level.getBoxLevel()->getLocalNumberOfCells()); + s_boxes_stat[ln]->recordProcStat(level_local_boxes); + s_cells_stat[ln]->recordProcStat(level_local_cells); s_timestamp_stat[ln]->recordProcStat(current_time); } @@ -2506,7 +2557,7 @@ HyperbolicLevelIntegrator::printStatistics( // statn->printAllGlobalStatData(s); double n_cell_updates = 0; // Number of cell updates. double n_patch_updates = 0; // Number of patch updates. - for (int ln = 0; ln < s_cells_stat.size(); ++ln) { + for (int ln = 0; ln < static_cast(s_cells_stat.size()); ++ln) { tbox::Statistic& cstat = *s_cells_stat[ln]; tbox::Statistic& bstat = *s_boxes_stat[ln]; tbox::Statistic& tstat = *s_timestamp_stat[ln]; @@ -2517,7 +2568,7 @@ HyperbolicLevelIntegrator::printStatistics( } s << - " Seq# SimTime C-Sum C-Avg C-Min -> C-Max C-NormDiff B-Sum B-Avg B-Min -> B-Max B-NormDiff C/B-Avg\n"; + "Seq# SimTime C-Sum C-Avg C-Min -> C-Max C-Max/Avg B-Sum B-Avg B-Min -> B-Max B-Max/Avg C/B-Avg\n"; #ifdef __INTEL_COMPILER #pragma warning (disable:1572) #endif @@ -2528,36 +2579,35 @@ HyperbolicLevelIntegrator::printStatistics( ), sn); const double cmin = statn->getGlobalProcStatMin(cstat.getInstanceId( ), sn); - const double cdiffnorm = cmax != 0 ? 1.0 - cmin / cmax : 0; + const double cavg = csum / mpi.getSize(); + const double cmaxnorm = cavg != 0 ? cmax / cavg : 1; const double bsum = statn->getGlobalProcStatSum(bstat.getInstanceId( ), sn); const double bmax = statn->getGlobalProcStatMax(bstat.getInstanceId( ), sn); const double bmin = statn->getGlobalProcStatMin(bstat.getInstanceId( ), sn); - const double bdiffnorm = bmax != 0 ? 1.0 - bmin / bmax : 0; + const double bavg = bsum / mpi.getSize(); + const double bmaxnorm = bavg != 0 ? bmax / bavg : 1; const double stime = statn->getGlobalProcStatMin( tstat.getInstanceId(), sn); - s << std::setw(3) << sn << " " - << std::scientific << std::setprecision(6) << std::setw(12) - << stime - << " " - << std::fixed << std::setprecision(0) - << std::setw(10) << csum << " " - << std::setw(10) << csum / mpi.getSize() << " " - << std::setw(10) << cmin << " -> " - << std::setw(10) << cmax - << " " << std::setw(4) << std::setprecision(4) << cdiffnorm - << " " - << std::fixed << std::setprecision(0) - << std::setw(6) << bsum << " " - << std::setw(5) << bsum / mpi.getSize() << " " - << std::setw(5) << bmin << " ->" - << std::setw(5) << bmax - << " " << std::setw(4) << std::setprecision(4) << bdiffnorm - << std::setw(10) << std::setprecision(0) - << (bsum != 0 ? csum / bsum : 0) + s << std::setw(4) << sn + << " " << std::scientific << std::setprecision(6) << std::setw(12) << stime + << " " << std::fixed << std::setprecision(0) << std::setw(12) << csum + << " " << std::setw(7) << cavg + << " " << std::setw(7) << cmin + << " -> " << std::setw(10) << cmax + << " " << std::setw(9) << std::setprecision(2) << cmaxnorm + << " " << std::fixed << std::setprecision(0) + << std::setw(9) << bsum + << " " << std::fixed << std::setprecision(2) + << std::setw(7) << bavg + << " " << std::fixed << std::setprecision(0) + << std::setw(3) << bmin + << " -> " << std::setw(5) << bmax + << " " << std::setw(8) << std::setprecision(2) << bmaxnorm + << " " << std::setw(6) << std::setprecision(0) << (bsum != 0 ? csum / bsum : 0) << std::endl; n_cell_updates += csum; n_patch_updates += bsum; @@ -2593,8 +2643,9 @@ HyperbolicLevelIntegrator::printClassData( os << "d_cfl = " << d_cfl << "\n" << "d_cfl_init = " << d_cfl_init << std::endl; os << "d_lag_dt_computation = " << d_lag_dt_computation << "\n" - << "d_use_ghosts_for_dt = " - << d_use_ghosts_for_dt << std::endl; + << "d_use_ghosts_for_dt = " << d_use_ghosts_for_dt + << "d_use_flux_correction = " << d_use_flux_correction + << std::endl; os << "d_patch_strategy = " << (HyperbolicPatchStrategy *)d_patch_strategy << std::endl; os @@ -2606,24 +2657,27 @@ HyperbolicLevelIntegrator::printClassData( ************************************************************************* * * Writes out the class version number, d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_for_dt to the database. + * d_lag_dt_computation, and d_use_ghosts_for_dt to the restart database. * ************************************************************************* */ void -HyperbolicLevelIntegrator::putToDatabase( - const boost::shared_ptr& db) const +HyperbolicLevelIntegrator::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", + restart_db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION); - db->putDouble("d_cfl", d_cfl); - db->putDouble("d_cfl_init", d_cfl_init); - db->putBool("d_lag_dt_computation", d_lag_dt_computation); - db->putBool("d_use_ghosts_for_dt", d_use_ghosts_for_dt); + restart_db->putDouble("cfl", d_cfl); + restart_db->putDouble("cfl_init", d_cfl_init); + restart_db->putBool("lag_dt_computation", d_lag_dt_computation); + restart_db->putBool("use_ghosts_to_compute_dt", d_use_ghosts_for_dt); + restart_db->putBool("use_flux_correction", d_use_flux_correction); + restart_db->putBool("DEV_distinguish_mpi_reduction_costs", + d_distinguish_mpi_reduction_costs); } /* @@ -2639,62 +2693,63 @@ HyperbolicLevelIntegrator::putToDatabase( void HyperbolicLevelIntegrator::getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart) { - TBOX_ASSERT(is_from_restart || db); + if (!is_from_restart && !input_db) { + TBOX_ERROR(": HyperbolicLevelIntegrator::getFromInput()\n" + << "no input database supplied" << std::endl); + } - if (is_from_restart) { + if (!is_from_restart) { - if (db) { - if (db->keyExists("cfl")) { - d_cfl = db->getDouble("cfl"); - } + d_cfl = input_db->getDouble("cfl"); - if (db->keyExists("cfl_init")) { - d_cfl_init = db->getDouble("cfl_init"); - } + d_cfl_init = input_db->getDouble("cfl_init"); - if (db->keyExists("lag_dt_computation")) { - d_lag_dt_computation = db->getBool("lag_dt_computation"); - } + d_lag_dt_computation = + input_db->getBoolWithDefault("lag_dt_computation", true); - if (db->keyExists("use_ghosts_to_compute_dt")) { - d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); - } + d_use_ghosts_for_dt = + input_db->getBoolWithDefault("use_ghosts_to_compute_dt", false); - if (db->keyExists("distinguish_mpi_reduction_costs")) { - d_distinguish_mpi_reduction_costs = - db->getBool("distinguish_mpi_reduction_costs"); - } - } - } else { + d_use_flux_correction = + input_db->getBoolWithDefault("use_flux_correction", true); - if (db->keyExists("cfl")) { - d_cfl = db->getDouble("cfl"); - } + d_distinguish_mpi_reduction_costs = + input_db->getBoolWithDefault("DEV_distinguish_mpi_reduction_costs", false); - if (db->keyExists("cfl_init")) { - d_cfl_init = db->getDouble("cfl_init"); - } + d_barrier_advance_level_sections = + input_db->getBoolWithDefault("DEV_barrier_advance_level_sections", + d_barrier_advance_level_sections); + } else if (input_db) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); - if (db->keyExists("lag_dt_computation")) { - d_lag_dt_computation = db->getBool("lag_dt_computation"); - } + if (read_on_restart) { + d_cfl = input_db->getDoubleWithDefault("cfl", d_cfl); - if (db->keyExists("use_ghosts_to_compute_dt")) { - d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); - } else { - TBOX_WARNING( - d_object_name << ": " - << "Key data `use_ghosts_to_compute_dt' not found in input." - << " Using default value " - << d_use_ghosts_for_dt << std::endl); - } + d_cfl_init = input_db->getDoubleWithDefault("cfl_init", d_cfl_init); + + d_lag_dt_computation = + input_db->getBoolWithDefault("lag_dt_computation", + d_lag_dt_computation); + + d_use_ghosts_for_dt = + input_db->getBoolWithDefault("use_ghosts_to_compute_dt", + d_use_ghosts_for_dt); + + d_use_flux_correction = + input_db->getBoolWithDefault("use_flux_correction", + d_use_flux_correction); - if (db->keyExists("distinguish_mpi_reduction_costs")) { d_distinguish_mpi_reduction_costs = - db->getBool("distinguish_mpi_reduction_costs"); + input_db->getBoolWithDefault("DEV_distinguish_mpi_reduction_costs", + d_distinguish_mpi_reduction_costs); + + d_barrier_advance_level_sections = + input_db->getBoolWithDefault("DEV_barrier_advance_level_sections", + d_barrier_advance_level_sections); } } } @@ -2733,10 +2788,13 @@ HyperbolicLevelIntegrator::getFromRestart() << "than class version." << std::endl); } - d_cfl = db->getDouble("d_cfl"); - d_cfl_init = db->getDouble("d_cfl_init"); - d_lag_dt_computation = db->getBool("d_lag_dt_computation"); - d_use_ghosts_for_dt = db->getBool("d_use_ghosts_for_dt"); + d_cfl = db->getDouble("cfl"); + d_cfl_init = db->getDouble("cfl_init"); + d_lag_dt_computation = db->getBool("lag_dt_computation"); + d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); + d_use_flux_correction = db->getBool("use_flux_correction"); + d_distinguish_mpi_reduction_costs = + db->getBool("DEV_distinguish_mpi_reduction_costs"); } /* @@ -2787,13 +2845,25 @@ HyperbolicLevelIntegrator::initializeCallback() t_get_level_dt_sync = tbox::TimerManager::getManager()-> getTimer("algs::HyperbolicLevelIntegrator::getLevelDt()_sync"); t_advance_level = tbox::TimerManager::getManager()-> - getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()"); + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()"); + t_advance_level_integrate = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_integrate"); + t_advance_level_pre_integrate = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_pre_integrate"); + t_advance_level_post_integrate = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_post_integrate"); + t_advance_level_patch_loop = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_patch_loop"); t_new_advance_bdry_fill_comm = tbox::TimerManager::getManager()-> getTimer("algs::HyperbolicLevelIntegrator::new_advance_bdry_fill_comm"); t_patch_num_kernel = tbox::TimerManager::getManager()-> getTimer("algs::HyperbolicLevelIntegrator::patch_numerical_kernels"); t_advance_level_sync = tbox::TimerManager::getManager()-> getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_sync"); + t_advance_level_compute_dt = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::advanceLevel()_compute_dt"); + t_copy_time_dependent_data = tbox::TimerManager::getManager()-> + getTimer("algs::HyperbolicLevelIntegrator::copyTimeDependentData()"); t_std_level_sync = tbox::TimerManager::getManager()-> getTimer( "algs::HyperbolicLevelIntegrator::standardLevelSynchronization()"); @@ -2862,5 +2932,3 @@ HyperbolicLevelIntegrator::finalizeCallback() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.h index 5751dfd4..60134c3b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicLevelIntegrator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Integration routines for single level in AMR hierarchy * (basic hyperbolic systems) * @@ -30,9 +30,9 @@ #include "SAMRAI/xfer/RefineSchedule.h" #include "SAMRAI/tbox/Timer.h" - -#include +#include "boost/shared_ptr.hpp" #include +#include #define HLI_RECORD_STATS // #undef DGA_RECORD_STATS @@ -84,67 +84,83 @@ namespace algs { * applyGradientDetector(), applyRichardsonExtrapolation(), and * coarsenDataForRichardsonExtrapolation(). * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input and restart data are summarized as follows. - * - * Required input keys and data types: NONE - * - * Optional input keys, data types, and defaults: - * - * - * + * Input Parameters * + * Definitions: * - \b cfl - * double value for the CFL factor used for timestep selection - * (dt used = CFL * max dt). If no input value is given, a default - * value of 0.9 is used. + * the CFL factor used for timestep selection (dt used = CFL * max dt) * * - \b cfl_init - * double value for CFL factor used for initial timestep. - * If no input value is given, a default value of 0.9 is used. + * the CFL factor used for initial timestep * * - \b lag_dt_computation - * boolean value indicating whether dt is based on current - * solution or solution from previous step (possible optimization - * in communication for characteristic analysis). If no input - * value is given, a default value of TRUE is used. - * + * indicates whether dt is based on current solution or solution from + * previous step (possible optimization in communication for + * characteristic analysis) * * - \b use_ghosts_to_compute_dt - * boolean value indicating whether ghost data must be filled before - * timestep is computed on each patch (possible communication - * optimization). if no input value is given, a default value - * of TRUE is used. - * - * - \b distinguish_mpi_reduction_costs - * boolean specifying whether to separate reduction costs in tbox::MPI - * from costs of load imbalances. By specifying it true, a - * barrier is put in place before the reduction call, so an extra - * operation is incurred. For this reason, it is defaulted FALSE. - * - * - * + * indicates whether ghost data must be filled before timestep is + * computed on each patch (possible communication optimization) * + * Note that when continuing from restart, the input parameters in the input + * database override all values read in from the restart database. * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    cfldoublenoneany doublereqParameter read from restart db may be overridden by input db
    cfl_initdoublenoneany doublereqParameter read from restart db may be overridden by input db
    lag_dt_computationboolTRUETRUE, FALSEoptParameter read from restart db may be overridden by input db
    use_ghosts_to_compute_dtboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
    * * A sample input file entry might look like: * - * \verbatim - * + * @code * cfl = 0.9 * cfl_init = 0.9 * lag_dt_computation = FALSE * use_ghosts_to_compute_dt = TRUE - * distinguish_mpi_reduction_costs = TRUE - * - * \endverbatim + * @endcode * - * @see algs::TimeRefinementIntegrator + * @see TimeRefinementIntegrator * @see mesh::StandardTagAndInitStrategy - * @see algs::HyperbolicPatchStrategy + * @see HyperbolicPatchStrategy */ class HyperbolicLevelIntegrator: @@ -189,28 +205,23 @@ class HyperbolicLevelIntegrator: * integration parameters to default values and constructs standard * communication algorithms. Other data members are read in from * the specified input database or the restart database corresponding - * to the specified object_name. The constructor also registers - * this object for restart using the specified object name when - * the boolean argument is true. Whether object will write its state to - * restart files during program execution is determined by this argument. - * Note that it has a default state of true. This class is used by + * to the specified object_name. This class is used by * the time refinement integrator for refined timestepping when the * use_time_refinement argument is true, and for synchronized * timestepping when the boolean is false. * - * When assertion checking is active, passing in any null pointer - * or an empty string will result in an unrecoverable assertion. + * @pre !object_name.empty() + * @pre patch_strategy != 0 */ HyperbolicLevelIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, HyperbolicPatchStrategy* patch_strategy, - bool register_for_restart = true, bool use_time_refinement = true); /** * The destructor for HyperbolicLevelIntegrator unregisters - * the integrator object with the restart manager when so registered. + * the integrator object with the restart manager. */ virtual ~HyperbolicLevelIntegrator(); @@ -220,8 +231,7 @@ class HyperbolicLevelIntegrator: * * This routine also invokes variable registration in the patch strategy. * - * Assertion checking will throw unrecoverable assertions if either - * pointer is null. + * @pre gridding_alg_strategy is actually a boost::dynamic_pointer_cast */ virtual void initializeLevelIntegrator( @@ -238,8 +248,7 @@ class HyperbolicLevelIntegrator: * integrator. The default true setting means the timestep will be * computed if no value is supplied. * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. + * @pre level */ virtual double getLevelDt( @@ -255,8 +264,7 @@ class HyperbolicLevelIntegrator: * conservation laws (constrained by a CFL limit), the fine time increment * is typically the coarse increment divided by the refinement ratio. * - * When assertion checking is active, an unrecoverable assertion will - * result if the ratio vector is not acceptable (i.e., all values > 0). + * @pre each component of ratio_to_coarser is > 0 */ virtual double getMaxFinerLevelDt( @@ -351,12 +359,10 @@ class HyperbolicLevelIntegrator: * - \b regrid_advance * = true. * - * - * - * - * When assertion checking is active, an unrecoverable assertion will - * result if either the level or hierarchy pointer is null, or the - * new time is not greater than the given time. + * @pre level + * @pre hierarchy + * @pre current_time <= new_time + * @pre level->getDim() == hierarchy->getDim() */ virtual double @@ -377,11 +383,12 @@ class HyperbolicLevelIntegrator: * coarsest_level. The array of old time values are used in the * re-integration of the time-dependent data. * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null), or - * all of the old time values are less than the value of sync_time. + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level < finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) + * @pre old_times.size() >= finest_level + * @pre for each i in [coarsest_level, finest_level) hierarchy->getPatchLevel(i) && sync_time >= old_times[i] + * @pre hierarchy->getPatchLevel(finest_level) */ virtual void standardLevelSynchronization( @@ -389,13 +396,20 @@ class HyperbolicLevelIntegrator: const int coarsest_level, const int finest_level, const double sync_time, - const tbox::Array& old_times); + const std::vector& old_times); /** * This overloaded version of standardLevelSynchronization implements * a routine used for synchronized timestepping. Only a single * value for the old time is needed, since all levels would have the * same old time. + * + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level < finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) + * @pre for each i in [coarsest_level, finest_level) hierarchy->getPatchLevel(i) + * @pre sync_time >= old_time + * @pre hierarchy->getPatchLevel(finest_level) */ virtual void standardLevelSynchronization( @@ -421,10 +435,10 @@ class HyperbolicLevelIntegrator: * no data synchronization after regridding beyond interpolation of * data from coarser levels in the hierarchy in some conservative fashion. * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null). + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level < finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) + * @pre for each i in [coarsest_level, finest_level] hierarchy->getPatchLevel(i) */ virtual void synchronizeNewLevels( @@ -437,8 +451,7 @@ class HyperbolicLevelIntegrator: /** * Resets time-dependent data storage and update time for patch level. * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. + * @pre level */ virtual void resetTimeDependentData( @@ -450,8 +463,7 @@ class HyperbolicLevelIntegrator: * Deallocate all new simulation data on the given level. This may * be necessary during regridding, or setting up levels initially. * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. + * @pre level */ virtual void resetDataToPreadvanceState( @@ -486,10 +498,11 @@ class HyperbolicLevelIntegrator: * the level is the finest level allowed in the hierarchy. This may or * may not affect the data initialization process depending on the problem. * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level number does - * not match any level in the hierarchy, or the old level number - * does not match the level number (if the old level pointer is non-null). + * @pre hierarchy + * @pre (level_number >= 0) && + * (level_number <= hierarchy->getFinestLevelNumber()) + * @pre !old_level || (level_number == old_level->getLevelNumber()) + * @pre hierarchy->getPatchLevel(level_number)) */ virtual void initializeLevelData( @@ -516,11 +529,10 @@ class HyperbolicLevelIntegrator: * communication schedules every level finer than and including that * indexed by the coarsest level number given. * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, any pointer to a level - * in the hierarchy that is coarser than the finest level is null, - * or the given level numbers not specified properly; e.g., - * coarsest_level > finest_level. + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level <= finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) + * @pre for all i <= finest_level hierarchy->getPatchLevel(i) is non-NULL */ virtual void resetHierarchyConfiguration( @@ -545,9 +557,10 @@ class HyperbolicLevelIntegrator: * to the user's patch tagging routines since the application of the * gradient detector may be different in each case. * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null or the level number does - * not match any existing level in the hierarchy. + * @pre hierarchy + * @pre (level_number >= 0) && + * (level_number <= hierarchy->getFinestLevelNumber()) + * @pre hierarchy->getPatchLevel(level_number) */ virtual void applyGradientDetector( @@ -584,8 +597,7 @@ class HyperbolicLevelIntegrator: * and false otherwise. This argument helps the user to manage multiple * regridding criteria. * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. + * @pre level */ virtual void applyRichardsonExtrapolation( @@ -606,8 +618,12 @@ class HyperbolicLevelIntegrator: * (i.e., before it has been advanced) or by coarsening the "new" * solution on the fine level (i.e., after it has been advanced). * - * When assertion checking is active, an unrecoverable assertion will - * result if either level pointer is null. + * @pre hierarchy + * @pre (level_number >= 0) && + * (level_number <= hierarchy->getFinestLevelNumber()) + * @pre (hierarchy->getPatchLevel(level_number) + * @pre coarse_level + * @pre hierarchy->getDim() == coarse_level->getDim() */ virtual void coarsenDataForRichardsonExtrapolation( @@ -625,8 +641,9 @@ class HyperbolicLevelIntegrator: * invoked by calling the function initializeLevelIntegrator() above. * In fact, that function should be called before this routine is called. * - * When assertion checking is active, an unrecoverable assertion will - * result if the variable pointer or geometry pointer is null. + * @pre var + * @pre transfer_geom + * @pre ghosts.getDim() == var->getDim() */ virtual void registerVariable( @@ -639,21 +656,19 @@ class HyperbolicLevelIntegrator: /** * Print class data representation for hyperbolic level integrator object. - * This is done automatically, when an unrecoverable run-time assertion - * is thrown within some member function of this class. */ virtual void printClassData( std::ostream& os) const; /** - * Write out object state to the given database. + * Write out object state to the given restart database. * - * When assertion checking is active, database point must be non-null. + * @pre restart_db */ virtual void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Return pointer to "current" variable context used by integrator. @@ -745,15 +760,15 @@ class HyperbolicLevelIntegrator: protected: /** - * Read input values, indicated above, from given database. The boolean + * Read values, indicated above, from given input database. The boolean * argument is_from_restart should be set to true if the simulation * is beginning from restart. Otherwise it should be set to false. * - * When assertion checking is active, the database pointer must be non-null. + * @pre is_from_restart || input_db */ virtual void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); /** @@ -788,9 +803,6 @@ class HyperbolicLevelIntegrator: * how flux and flux integral storage is allocated and initialized. * These are needed since the advanceLevel() routine is used for * both level integration and time-dependent error estimation. - * - * When assertion checking is active, the level and schedule pointers - * must be non-null and the current time must be less than the new time. */ virtual void preprocessFluxData( @@ -807,8 +819,6 @@ class HyperbolicLevelIntegrator: * storage is copied and de-allocated. This is needed since the * advanceLevel() routine is used for both level integration and * time-dependent error estimation. - * - * When assertion checking is active, the level pointer must be non-null. */ virtual void postprocessFluxData( @@ -819,9 +829,6 @@ class HyperbolicLevelIntegrator: /* * Copy time-dependent data from source space to destination space. - * - * When assertion checking is active, the level and context pointers - * must be non-null. */ virtual void copyTimeDependentData( @@ -840,10 +847,11 @@ class HyperbolicLevelIntegrator: * synchronization, the flux and flux integral data storage is reset on * the levels. * - * When assertion checking is turned on, an unrecoverable assertion - * will result if either level pointer is null, the levels are not - * consecutive in the AMR hierarchy, or the coarse sim time is not - * less than the sync time. + * @pre fine_level + * @pre coarse_level + * @pre coarse_level->getLevelNumber() == (fine_level->getLevelNumber()-1)) + * @pre fine_level->getDim() == coarse_level->getDim() + * @pre sync_time > coarse_sim_time */ virtual void synchronizeLevelWithCoarser( @@ -852,6 +860,44 @@ class HyperbolicLevelIntegrator: const double sync_time, const double coarse_sim_time); + /*! + * @brief Check the tags on a tagged level. + * + * This is a callback method that is used to check the values held in + * user tag PatchData. The tag data will contain the tags created + * by either a gradient detector or Richardson extrapolation as well as + * any tags added internally by the GriddingAlgorithm (for + * example, buffering). + * + * @param[in] hierarchy + * @param[in] level_number Level number of the tagged level + * @param[in] tag_index Patch data index for user tags + */ + virtual void + checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const; + + /*! + * @brief Check the tags on a newly-created level. + * + * This is a callback method that allow for checking tag values that + * have been saved on a new level that has been created during + * initialization or regridding. The tag values will be the values + * of the user tags on the coarser level, constant-refined onto the + * cells of the new level. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the new level + * @param[in] tag_index Patch data index for the new tags. + */ + virtual void + checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const; + private: /* * Static integer constant describing class's version number. @@ -866,11 +912,6 @@ class HyperbolicLevelIntegrator: const hier::PatchLevel& patch_level, double current_time); - /* - * Dimension of the problem. - */ - const tbox::Dimension d_dim; - /* * The patch strategy supplies the application-specific operations * needed to treat data on patches in the AMR hierarchy. @@ -885,12 +926,10 @@ class HyperbolicLevelIntegrator: /* * The object name is used as a handle to databases stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. + * restart files and for error reporting purposes. */ std::string d_object_name; bool d_use_time_refinement; - bool d_registered_for_restart; /* * Courant-Friedrichs-Levy parameters for time increment selection. @@ -915,9 +954,15 @@ class HyperbolicLevelIntegrator: * be consistent with the numerical routines used * in the hyperbolic patch strategy object to * calculate the time step size. The default is true. + * + * d_use_flux_correction indicates whether the synchronization step + * will replace coarse fluxes with integrated + * finer level fluxes and repeat the conservative + * update. The default is true. */ bool d_lag_dt_computation; bool d_use_ghosts_for_dt; + bool d_use_flux_correction; /* * Boolean flags for indicated whether face or side data types are @@ -943,7 +988,7 @@ class HyperbolicLevelIntegrator: * will be filled with CURRENT_VAR values. */ boost::shared_ptr d_bdry_fill_advance; - tbox::Array > d_bdry_sched_advance; + std::vector > d_bdry_sched_advance; /* * The "advance new" schedule can be used twice during a time integration @@ -961,7 +1006,7 @@ class HyperbolicLevelIntegrator: * accompanying HyperbolicLevelIntegrator::advanceLevel. */ boost::shared_ptr d_bdry_fill_advance_new; - tbox::Array > + std::vector > d_bdry_sched_advance_new; /* @@ -1072,6 +1117,11 @@ class HyperbolicLevelIntegrator: static bool s_barrier_after_error_bdry_fill_comm; + /*! + * @brief For diagnostics: whether to separate major advanceLevel sections with MPI barriers. + */ + bool d_barrier_advance_level_sections; + /* * Timers interspersed throughout the class. */ @@ -1091,9 +1141,17 @@ class HyperbolicLevelIntegrator: static boost::shared_ptr t_get_level_dt; static boost::shared_ptr t_get_level_dt_sync; static boost::shared_ptr t_advance_level; + static boost::shared_ptr t_advance_level_integrate; + static boost::shared_ptr t_advance_level_pre_integrate; + static boost::shared_ptr t_advance_level_post_integrate; + static boost::shared_ptr t_advance_level_patch_loop; static boost::shared_ptr t_new_advance_bdry_fill_comm; static boost::shared_ptr t_patch_num_kernel; + static boost::shared_ptr t_preprocess_flux_data; + static boost::shared_ptr t_postprocess_flux_data; static boost::shared_ptr t_advance_level_sync; + static boost::shared_ptr t_advance_level_compute_dt; + static boost::shared_ptr t_copy_time_dependent_data; static boost::shared_ptr t_std_level_sync; static boost::shared_ptr t_sync_new_levels; static boost::shared_ptr t_barrier_after_error_bdry_fill_comm; @@ -1108,9 +1166,9 @@ class HyperbolicLevelIntegrator: /* * Statistics on number of cells and patches generated. */ - static tbox::Array > s_boxes_stat; - static tbox::Array > s_cells_stat; - static tbox::Array > s_timestamp_stat; + static std::vector > s_boxes_stat; + static std::vector > s_cells_stat; + static std::vector > s_timestamp_stat; #endif /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.C index 23ecd2a1..aca7de00 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to patch routines for hyperbolic integration scheme. * ************************************************************************/ - -#ifndef included_algs_HyperbolicPatchStrategy_C -#define included_algs_HyperbolicPatchStrategy_C - #include "SAMRAI/algs/HyperbolicPatchStrategy.h" #include "SAMRAI/tbox/Utilities.h" @@ -18,11 +14,9 @@ namespace SAMRAI { namespace algs { -HyperbolicPatchStrategy::HyperbolicPatchStrategy( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - xfer::CoarsenPatchStrategy(dim), - d_dim(dim), +HyperbolicPatchStrategy::HyperbolicPatchStrategy(): + xfer::RefinePatchStrategy(), + xfer::CoarsenPatchStrategy(), d_data_context() { } @@ -128,70 +122,5 @@ HyperbolicPatchStrategy::postprocessAdvanceLevelState( NULL_USE(regrid_advance); } -hier::IntVector -HyperbolicPatchStrategy::getRefineOpStencilWidth() const -{ - return hier::IntVector::getZero(d_dim); -} - -void -HyperbolicPatchStrategy::preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) -{ - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); -} - -void -HyperbolicPatchStrategy::postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) -{ - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); -} - -hier::IntVector -HyperbolicPatchStrategy::getCoarsenOpStencilWidth() const -{ - return hier::IntVector::getZero(d_dim); -} - -void -HyperbolicPatchStrategy::preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); -} - -void -HyperbolicPatchStrategy::postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); -} - } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.h index 6f8c5160..1f9e3854 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/HyperbolicPatchStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to patch routines for hyperbolic integration scheme. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/xfer/CoarsenPatchStrategy.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace algs { @@ -53,7 +53,7 @@ class HyperbolicLevelIntegrator; * context. The concrete patch strategy subclass can access the appropriate * context via the getDataContext() method. * - * @see algs::HyperbolicLevelIntegrator + * @see HyperbolicLevelIntegrator * @see xfer::RefinePatchStrategy * @see xfer::CoarsenPatchStrategy */ @@ -66,8 +66,7 @@ class HyperbolicPatchStrategy: /** * Blank constructor for HyperbolicPatchStrategy. */ - explicit HyperbolicPatchStrategy( - const tbox::Dimension& dim); + HyperbolicPatchStrategy(); /** * Virtual destructor for HyperbolicPatchStrategy. @@ -325,112 +324,55 @@ class HyperbolicPatchStrategy: const double fill_time, const hier::IntVector& ghost_width_to_fill) = 0; - /** - * Return maximum stencil width needed for user-defined - * data interpolation operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector - getRefineOpStencilWidth() const; - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. The - * interpolation routines are used in the hyperbolic AMR algorithm - * for filling patch ghost cells before advancing data on a level - * and after regridding a level to fill portions of the new level - * from some coarser level. These routines are called automatically - * from within patch boundary filling schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_REFINE" is given as the interpolation - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that refine such variables in either - * of these routines, then they will not be refined. + /*! + * @brief Check the tags on a tagged patch. * - * The order in which these operations are used in each patch - * boundary filling schedule is: + * This virtual method provides an interface for a callback into + * application code to check the values held in user tag PatchData + * The tag data will contain the tags created by application code + * plus any tags added internally by the GriddingAlgorithm (for + * example, buffering). * - * - \b (1) {Call user's preprocessRefine() routine.} - * - \b (2) {Refine all variables with standard interpolation operators.} - * - \b (3) {Call user's postprocessRefine() routine.} + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this callback need not implement anything. * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. + * @param[in] patch + * @param[in] tag_index Patch data index for user tags */ virtual void - preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio); + checkUserTagData( + hier::Patch& patch, + const int tag_index) const + { + NULL_USE(patch); + NULL_USE(tag_index); + } - /// - virtual void - postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio); - /** - * Return maximum stencil width needed for user-defined - * data coarsen operations. Default is to return - * zero, assuming no user-defined operations provided. + /*! + * @brief Check the tags on a newly-created patch. * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector - getCoarsenOpStencilWidth() const; - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. The coarsening - * routines are used in the hyperbolic AMR algorithm synchronizing - * coarse and fine levels when they have been integrated to the same - * point. These routines are called automatically from within the - * data synchronization coarsen schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_COARSEN" is given as the coarsening - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that coarsen such variables in either - * of these routines, then they will not be coarsened. + * This virtual method provides an interface for a callback into + * application code to check the tag values that have been saved on + * a new patch that has been created during intitialization or + * regridding. The tag values will be the values of the user tags + * on the coarser level, constant refined onto the cells of the patch + * on the new level. * - * The order in which these operations are used in each coarsening - * schedule is: + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this callback need not implement anything. * - * - \b (1) {Call user's preprocessCoarsen() routine.} - * - \b (2) {Coarsen all variables with standard coarsening operators.} - * - \b (3) {Call user's postprocessCoarsen() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. + * @param[in] patch + * @param[in] tag_index Patch data index for the new tags. */ virtual void - preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); - - /// - virtual void - postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); + checkNewPatchTagData( + hier::Patch& patch, + const int tag_index) const + { + NULL_USE(patch); + NULL_USE(tag_index); + } /** * Return pointer to patch data context. @@ -463,15 +405,7 @@ class HyperbolicPatchStrategy: d_data_context.reset(); } - const tbox::Dimension& - getDim() const - { - return d_dim; - } - private: - const tbox::Dimension d_dim; - boost::shared_ptr d_data_context; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.C index 99c82735..330865f1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface between implicit integrator and equations to solve. * ************************************************************************/ - -#ifndef included_algs_ImplicitEquationStrategy_C -#define included_algs_ImplicitEquationStrategy_C - #include "SAMRAI/algs/ImplicitEquationStrategy.h" namespace SAMRAI { @@ -26,4 +22,3 @@ ImplicitEquationStrategy::~ImplicitEquationStrategy() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.h index 0fb87742..e5ab8379 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitEquationStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface between implicit integrator and equations to solve. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace algs { @@ -35,7 +35,7 @@ namespace algs { * in the interface are provided in a user-supplied concrete equation class * derived from this base class. * - * @see algs::ImplicitIntegrator + * @see ImplicitIntegrator */ class ImplicitEquationStrategy { diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.C index 502b110a..6d244b6d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Implicit time integration manager class for nonlinear problems. * ************************************************************************/ - -#ifndef included_algs_ImplicitIntegrator_C -#define included_algs_ImplicitIntegrator_C - #include "SAMRAI/algs/ImplicitIntegrator.h" #include @@ -44,31 +40,25 @@ ImplicitIntegrator::ImplicitIntegrator( const boost::shared_ptr& input_db, ImplicitEquationStrategy* implicit_equations, solv::NonlinearSolverStrategy* nonlinear_solver, - const boost::shared_ptr& hierarchy) + const boost::shared_ptr& hierarchy): + d_object_name(object_name), + d_implicit_equations(implicit_equations), + d_nonlinear_solver(nonlinear_solver), + d_patch_hierarchy(hierarchy), + d_finest_level(-1), + d_initial_time(tbox::MathUtilities::getSignalingNaN()), + d_final_time(tbox::MathUtilities::getSignalingNaN()), + d_current_time(tbox::MathUtilities::getSignalingNaN()), + d_current_dt(tbox::MathUtilities::getSignalingNaN()), + d_old_dt(tbox::MathUtilities::getSignalingNaN()), + d_integrator_step(0), + d_max_integrator_steps(0) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(implicit_equations != ((ImplicitEquationStrategy *)NULL)); - TBOX_ASSERT(nonlinear_solver != ((solv::NonlinearSolverStrategy *)NULL)); + TBOX_ASSERT(implicit_equations != 0); + TBOX_ASSERT(nonlinear_solver != 0); TBOX_ASSERT(hierarchy); - d_object_name = object_name; - d_implicit_equations = implicit_equations; - d_nonlinear_solver = nonlinear_solver; - d_patch_hierarchy = hierarchy; - - d_solution_vector.reset(); - - d_initial_time = - d_final_time = - d_current_time = - d_current_dt = - d_old_dt = tbox::MathUtilities::getSignalingNaN(); - - d_integrator_step = 0; - d_max_integrator_steps = 0; - - d_finest_level = -1; - /* * Initialize object with data read from input and restart databases. */ @@ -111,13 +101,13 @@ ImplicitIntegrator::initialize() d_solution_vector.reset( new solv::SAMRAIVectorReal("solution_vector", - d_patch_hierarchy, - 0, d_finest_level)); + d_patch_hierarchy, + 0, d_finest_level)); d_implicit_equations->setupSolutionVector(d_solution_vector); if (d_solution_vector->getNumberOfComponents() == 0) { - TBOX_ERROR("Solution vector has zero components."); + TBOX_ERROR("Solution vector has zero components." << std::endl); } d_nonlinear_solver->initialize(d_solution_vector); @@ -255,7 +245,7 @@ ImplicitIntegrator::updateSolution() { d_current_time += d_current_dt; d_old_dt = d_current_dt; - d_integrator_step++; + ++d_integrator_step; d_implicit_equations->updateSolution(d_current_time); @@ -274,98 +264,89 @@ ImplicitIntegrator::updateSolution() void ImplicitIntegrator::getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart) { - TBOX_ASSERT(is_from_restart || db); - - if (is_from_restart) { - - if (db) { - if (db->keyExists("final_time")) { - d_final_time = db->getDouble("final_time"); - if (d_final_time < d_initial_time) { - TBOX_ERROR(d_object_name << " -- Error in input data " - << "final_time < initial_time."); - } - } + if (!is_from_restart && !input_db) { + TBOX_ERROR(": ImplicitIntegrator::getFromInput()\n" + << "no input database supplied" << std::endl); + } - if (db->keyExists("max_integrator_steps")) { - d_max_integrator_steps = db->getInteger("max_integrator_steps"); - if (d_max_integrator_steps < 0) { - TBOX_ERROR(d_object_name << " -- Error in input data " - << "max_integrator_steps < 0."); - } else { - if (d_max_integrator_steps < d_integrator_step) { - TBOX_ERROR( - d_object_name << " -- Error in input data " - << "max_integrator_steps < current integrator step."); - } - } + if (!is_from_restart) { - } + d_initial_time = input_db->getDouble("initial_time"); + if (!(d_initial_time >= 0)) { + INPUT_RANGE_ERROR("initial_time"); } - } else { + d_final_time = input_db->getDouble("final_time"); + if (!(d_final_time >= d_initial_time)) { + INPUT_RANGE_ERROR("final_time"); + } - if (db->keyExists("initial_time")) { - d_initial_time = db->getDouble("initial_time"); - } else { - TBOX_ERROR(d_object_name << " -- Key data `initial_time'" - << " missing in input."); + d_max_integrator_steps = input_db->getInteger("max_integrator_steps"); + if (!(d_max_integrator_steps >= 0)) { + INPUT_RANGE_ERROR("max_integrator_steps"); } - if (db->keyExists("final_time")) { - d_final_time = db->getDouble("final_time"); + } else if (input_db) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + + if (read_on_restart) { + if (input_db->keyExists("initial_time")) { + double tmp = input_db->getDouble("initial_time"); + if (tmp != d_initial_time) { + TBOX_WARNING("ImplicitIntegrator::getFromInput warning...\n" + << "initial_time may not be changed on restart." + << std::endl); + } + } + + d_final_time = + input_db->getDoubleWithDefault("final_time", d_final_time); if (d_final_time < d_initial_time) { - TBOX_ERROR(d_object_name << " -- Error in input data " - << "final_time < initial_time."); + TBOX_ERROR("ImplicitIntegrator::getFromInput() error...\n" + << "final_time must be >= initial_time " << std::endl); } - } else { - TBOX_ERROR(d_object_name << " -- Key data `final_time'" - << " missing in input."); - } - if (db->keyExists("max_integrator_steps")) { - d_max_integrator_steps = db->getInteger("max_integrator_steps"); + d_max_integrator_steps = + input_db->getIntegerWithDefault("max_integrator_steps", + d_max_integrator_steps); if (d_max_integrator_steps < 0) { - TBOX_ERROR(d_object_name << " -- Error in input data " - << "max_integrator_steps < 0."); + TBOX_ERROR("ImplicitIntegrator::getFromInput() error...\n" + << "max_integrator_steps must be >= 0." << std::endl); + } else if (d_max_integrator_steps < d_integrator_step) { + TBOX_ERROR("ImplicitIntegrator::getFromInput() error...\n" + << "max_integrator_steps must be >= current integrator step." + << std::endl); } - } else { - TBOX_ERROR(d_object_name << " -- Key data `max_integrator_steps'" - << " missing in input."); } - } - } /* ************************************************************************* * - * Write out class version number and data members to database. + * Write out class version number and data members to restart database. * ************************************************************************* */ void -ImplicitIntegrator::putToDatabase( - const boost::shared_ptr& db) const +ImplicitIntegrator::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("ALGS_IMPLICIT_INTEGRATOR_VERSION", + restart_db->putInteger("ALGS_IMPLICIT_INTEGRATOR_VERSION", ALGS_IMPLICIT_INTEGRATOR_VERSION); - db->putDouble("d_initial_time", d_initial_time); - db->putDouble("d_final_time", d_final_time); - db->putDouble("d_current_time", d_current_time); - db->putDouble("d_current_dt", d_current_dt); - db->putDouble("d_old_dt", d_old_dt); + restart_db->putDouble("initial_time", d_initial_time); + restart_db->putDouble("final_time", d_final_time); - db->putInteger("d_integrator_step", d_integrator_step); - db->putInteger("d_max_integrator_steps", d_max_integrator_steps); + restart_db->putInteger("d_integrator_step", d_integrator_step); + restart_db->putInteger("max_integrator_steps", d_max_integrator_steps); } @@ -388,7 +369,7 @@ ImplicitIntegrator::getFromRestart() if (!root_db->isDatabase(d_object_name)) { TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file"); + << d_object_name << " not found in restart file" << std::endl); } boost::shared_ptr db(root_db->getDatabase(d_object_name)); @@ -396,17 +377,14 @@ ImplicitIntegrator::getFromRestart() if (ver != ALGS_IMPLICIT_INTEGRATOR_VERSION) { TBOX_ERROR(d_object_name << ": " << "Restart file version different " - << "than class version."); + << "than class version." << std::endl); } - d_initial_time = db->getDouble("d_initial_time"); - d_final_time = db->getDouble("d_final_time"); - d_current_time = db->getDouble("d_current_time"); - d_current_dt = db->getDouble("d_current_dt"); - d_old_dt = db->getDouble("d_old_dt"); + d_initial_time = db->getDouble("initial_time"); + d_final_time = db->getDouble("final_time"); d_integrator_step = db->getInteger("d_integrator_step"); - d_max_integrator_steps = db->getInteger("d_max_integrator_steps"); + d_max_integrator_steps = db->getInteger("max_integrator_steps"); } @@ -447,4 +425,3 @@ ImplicitIntegrator::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.h index d68bb289..7ca87c7e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/ImplicitIntegrator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Implicit time integration manager class. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/Serializable.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,18 +39,55 @@ namespace algs { * When a time step is performed, data on all levels is integrated through * the same time increment. * - * Initialization of an ImplicitIntegrator object is performed via a - * combination of default parameters and values read from input. Data - * read from input is summarized as follows: + * Input Parameters * - * Required input keys and data types: - * @param initial_time double value for the initial simulation time. - * @param final_time double value for the final simulation time. - * @param max_integrator_steps integer value for the maximum number - * of timesteps allowed. + * Definitions: + * - \b initial_time + * initial simulation time. + * - \b final_time + * final simulation time. + * - \b max_integrator_steps + * maximum number of timesteps performed on the coarsest hierarchy level + * during the simulation. * - * All input data items described above, except for initial_time, - * may be overwritten by new input values when continuing from restart. + * All input data items described above, except for initial_time, may be + * overridden by new input values when continuing from restart. + * + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    initial_timedoublenone>=0reqMay not be modified by input db on restart
    final_timedoublenonefinal_time >= initial_timereqParameter read from restart db may be overridden by input db
    max_integrator_stepsintnone>=0reqParameter read from restart db may be overridden by input db
    * * A sample input file entry might look like: * @@ -60,7 +97,7 @@ namespace algs { * max_integrator_steps = 100 * @endcode * - * @see algs::ImplicitEquationStrategy + * @see ImplicitEquationStrategy * @see solv::NonlinearSolverStrategy */ class ImplicitIntegrator: @@ -79,16 +116,16 @@ class ImplicitIntegrator: * created and the nonlinear solver is initialized in the initialize() * member function. * - * If assertion checking is turned on, an unrecoverable assertion will - * result if any of the database, strategy, or hierarchy pointers is - * null. Assertions may also be thrown if any checks for consistency - * among input parameters fail. + * @pre !object_name.empty() + * @pre implicit_equations != 0 + * @pre nonlinear_solver != 0 + * @pre hierarchy */ ImplicitIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, - ImplicitEquationStrategy * implicit_equations, - solv::NonlinearSolverStrategy * nonlinear_solver, + ImplicitEquationStrategy* implicit_equations, + solv::NonlinearSolverStrategy* nonlinear_solver, const boost::shared_ptr& hierarchy); /** @@ -242,13 +279,13 @@ class ImplicitIntegrator: std::ostream& os) const; /** - * Write out state of object to given database. + * Write out state of object to given restart database. * - * When assertion checking is active, the database pointer must be non-null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Returns the object name. @@ -269,12 +306,10 @@ class ImplicitIntegrator: * Read input data from specified database and initialize class members. * If run is from restart, a subset of the restart values may be replaced * with those read from input. - * - * When assertion checking is active, the database pointer must be non-null. */ void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); /* @@ -322,7 +357,7 @@ class ImplicitIntegrator: // The following are not implemented: ImplicitIntegrator( const ImplicitIntegrator&); - void + ImplicitIntegrator& operator = ( const ImplicitIntegrator&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.depend index 8981a59e..b5e69111 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -38,12 +39,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -51,12 +55,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -102,7 +108,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -117,9 +122,9 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -143,10 +148,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ HyperbolicLevelIntegrator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -167,17 +172,17 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=HyperbolicPatchStrategy.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -187,6 +192,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -198,7 +204,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -210,12 +219,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -238,7 +249,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -252,9 +262,9 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -273,10 +283,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ HyperbolicPatchStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -285,12 +295,11 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=ImplicitEquationStrategy.o DEPENDS_2:=\ @@ -327,12 +336,14 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -418,7 +429,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -430,8 +440,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -441,7 +451,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ ImplicitEquationStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -500,11 +509,10 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=ImplicitIntegrator.o DEPENDS_3:=\ @@ -542,12 +550,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -634,7 +644,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/NonlinearSolverStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -649,8 +658,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -660,7 +669,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ImplicitIntegrator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -719,139 +727,17 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} -FILE_4=MblkPatchBoundaryNodeSum.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/MblkPatchBoundaryNodeSum.h \ - $(INCLUDE_SAM)/SAMRAI/algs/OuternodeSumTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkPatchBoundaryNodeSum.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif +${FILE_3}: ${DEPENDS_3} -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} - -FILE_5=MethodOfLinesIntegrator.o -DEPENDS_5:=\ +FILE_4=MethodOfLinesIntegrator.o +DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -861,6 +747,7 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -872,11 +759,15 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -884,12 +775,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -913,7 +806,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -928,9 +820,9 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -954,11 +846,11 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MethodOfLinesIntegrator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ +DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -966,15 +858,14 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=MethodOfLinesPatchStrategy.o -DEPENDS_6:=\ +${FILE_4}: ${DEPENDS_4} + +FILE_5=MethodOfLinesPatchStrategy.o +DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1005,6 +896,7 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1014,7 +906,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1025,8 +916,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1035,19 +926,19 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MethodOfLinesPatchStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} -FILE_7=OuteredgeSumTransaction.o -DEPENDS_7:=\ +${FILE_5}: ${DEPENDS_5} + +FILE_6=OuteredgeSumTransaction.o +DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuteredgeSumTransaction.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1078,6 +969,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1100,7 +992,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1112,8 +1003,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1126,8 +1017,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ OuteredgeSumTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ +DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1135,14 +1025,13 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=OuteredgeSumTransactionFactory.o -DEPENDS_8:=\ +${FILE_6}: ${DEPENDS_6} + +FILE_7=OuteredgeSumTransactionFactory.o +DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuteredgeSumTransaction.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuteredgeSumTransactionFactory.h \ @@ -1174,6 +1063,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1195,7 +1085,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1207,8 +1096,8 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1222,22 +1111,20 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ OuteredgeSumTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ +DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=OuternodeSumTransaction.o -DEPENDS_9:=\ +${FILE_7}: ${DEPENDS_7} + +FILE_8=OuternodeSumTransaction.o +DEPENDS_8:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuternodeSumTransaction.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1268,6 +1155,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1289,7 +1177,6 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1301,8 +1188,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1315,8 +1202,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ OuternodeSumTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ +DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1324,14 +1210,13 @@ DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} -FILE_10=OuternodeSumTransactionFactory.o -DEPENDS_10:=\ +${FILE_8}: ${DEPENDS_8} + +FILE_9=OuternodeSumTransactionFactory.o +DEPENDS_9:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuternodeSumTransaction.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuternodeSumTransactionFactory.h \ @@ -1363,6 +1248,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1383,7 +1269,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1395,8 +1280,8 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1410,22 +1295,20 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ OuternodeSumTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ +DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=PatchBoundaryEdgeSum.o -DEPENDS_11:=\ +${FILE_9}: ${DEPENDS_9} + +FILE_10=PatchBoundaryEdgeSum.o +DEPENDS_10:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuteredgeSumTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/algs/PatchBoundaryEdgeSum.h \ @@ -1461,12 +1344,14 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1486,7 +1371,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1500,8 +1384,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1517,11 +1401,11 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ PatchBoundaryEdgeSum.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ +DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -1532,15 +1416,14 @@ DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} -FILE_12=PatchBoundaryNodeSum.o -DEPENDS_12:=\ +${FILE_10}: ${DEPENDS_10} + +FILE_11=PatchBoundaryNodeSum.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/OuternodeSumTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/algs/PatchBoundaryNodeSum.h \ @@ -1579,12 +1462,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1601,11 +1486,10 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleInjection.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1619,8 +1503,8 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1641,11 +1525,11 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ PatchBoundaryNodeSum.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ +DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -1656,17 +1540,17 @@ DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=TimeRefinementIntegrator.o -DEPENDS_13:=\ +${FILE_11}: ${DEPENDS_11} + +FILE_12=TimeRefinementIntegrator.o +DEPENDS_12:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1698,18 +1582,19 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1721,8 +1606,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -1733,13 +1618,83 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ TimeRefinementIntegrator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) +DEPENDS_12 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=TimeRefinementIntegratorConnectorWidthRequestor.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + TimeRefinementIntegratorConnectorWidthRequestor.C + DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_13}: ${DEPENDS_13} FILE_14=TimeRefinementLevelStrategy.o DEPENDS_14:=\ @@ -1775,18 +1730,19 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1797,8 +1753,8 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1808,11 +1764,9 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ TimeRefinementLevelStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_14 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_14}: ${DEPENDS_14} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.in index 3b6ccb8c..eea441b5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI algs package ## ######################################################################### @@ -23,6 +23,7 @@ SUBDIRS = fortran OBJS = \ TimeRefinementIntegrator.o \ + TimeRefinementIntegratorConnectorWidthRequestor.o \ TimeRefinementLevelStrategy.o \ HyperbolicPatchStrategy.o \ HyperbolicLevelIntegrator.o \ @@ -40,7 +41,7 @@ OBJS = \ library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.C deleted file mode 100644 index bcc78847..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.C +++ /dev/null @@ -1,498 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Routines for summing node data at patch boundaries - * - ************************************************************************/ - -#ifndef included_algs_MblkPatchBoundaryNodeSum_C -#define included_algs_MblkPatchBoundaryNodeSum_C - -#include "SAMRAI/algs/MblkPatchBoundaryNodeSum.h" - -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeDataFactory.h" -#include "SAMRAI/pdat/NodeGeometry.h" -#include "SAMRAI/pdat/OuternodeData.h" -#include "SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h" -#include "SAMRAI/algs/OuternodeSumTransactionFactory.h" -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" -#include "SAMRAI/hier/RefineOperator.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/MathUtilities.h" - -#include - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used to sum node and - * outernode data. - * - ************************************************************************* - */ - -namespace SAMRAI { -namespace algs { - -/* - ************************************************************************* - * - * Initialize the static data members. - * - ************************************************************************* - */ - -int MblkPatchBoundaryNodeSum::s_instance_counter = 0; - -tbox::Array > -MblkPatchBoundaryNodeSum::s_onode_src_id_array = - tbox::Array >(0); -tbox::Array > -MblkPatchBoundaryNodeSum::s_onode_dst_id_array = - tbox::Array >(0); - -/* - ************************************************************************* - * - * Constructor patch boundary node sum objects initializes data members - * to default (undefined) states. - * - ************************************************************************* - */ - -MblkPatchBoundaryNodeSum::MblkPatchBoundaryNodeSum( - const std::string& object_name, - const boost::shared_ptr& hierarchy) : - d_setup_called(false), - d_num_reg_sum(0), - d_hierarchy(hierarchy), - d_coarsest_level(-1), - d_finest_level(-1), - d_level_setup_called(false), - d_hierarchy_setup_called(false), - d_sum_transaction_factory(boost::make_shared()) -{ - TBOX_ASSERT(!object_name.empty()); - - d_object_name = object_name; - - s_instance_counter++; -} - -/* - ************************************************************************* - * - * Destructor removes temporary outernode patch data ids from - * variable database, if defined. - * - ************************************************************************* - */ - -MblkPatchBoundaryNodeSum::~MblkPatchBoundaryNodeSum() -{ - - s_instance_counter--; - if (s_instance_counter == 0) { - const int arr_length_depth = s_onode_src_id_array.size(); - - for (int id = 0; id < arr_length_depth; id++) { - const int arr_length_nvar = s_onode_src_id_array[id].size(); - - for (int iv = 0; iv < arr_length_nvar; iv++) { - - if (s_onode_src_id_array[id][iv] >= 0) { - hier::VariableDatabase::getDatabase()-> - removeInternalSAMRAIVariablePatchDataIndex( - s_onode_src_id_array[id][iv]); - } - if (s_onode_dst_id_array[id][iv] >= 0) { - hier::VariableDatabase::getDatabase()-> - removeInternalSAMRAIVariablePatchDataIndex( - s_onode_dst_id_array[id][iv]); - } - - s_onode_src_id_array[id].resizeArray(0); - s_onode_dst_id_array[id].resizeArray(0); - - } - - } - - s_onode_src_id_array.resizeArray(0); - s_onode_dst_id_array.resizeArray(0); - - } - -} - -/* - ************************************************************************* - * - * Register node patch data index for summation. - * - ************************************************************************* - */ - -void -MblkPatchBoundaryNodeSum::registerSum( - int node_data_id) -{ - - if (d_setup_called) { - TBOX_ERROR("MblkPatchBoundaryNodeSum::register error..." - << "\nobject named " << d_object_name - << "\nCannot call registerSum with this MblkPatchBoundaryNodeSum" - << "\nobject since it has already been used to create communication" - << "\nschedules; i.e., setupSum() has been called." - << std::endl); - } - - if (node_data_id < 0) { - TBOX_ERROR("MblkPatchBoundaryNodeSum register error..." - << "\nobject named " << d_object_name - << "\n node_data_id = " << node_data_id - << " is an invalid patch data identifier." << std::endl); - } - - hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); - - boost::shared_ptr > node_factory( - var_db->getPatchDescriptor()->getPatchDataFactory(node_data_id)); - - if (!node_factory) { - - TBOX_ERROR("MblkPatchBoundaryNodeSum register error..." - << "\nobject named " << d_object_name - << "\n node_data_id = " << node_data_id - << " does not correspond to node data of type double." << std::endl); - - } else { - - static std::string tmp_onode_src_variable_name( - "MblkPatchBoundaryNodeSum__internal-onode-src"); - static std::string tmp_onode_dst_variable_name( - "MblkPatchBoundaryNodeSum__internal-onode-dst"); - - const int reg_sum_id = d_num_reg_sum; - - d_num_reg_sum++; - - d_user_node_data_id.resizeArray(d_num_reg_sum); - d_user_node_data_id[reg_sum_id] = ID_UNDEFINED; - d_user_node_depth.resizeArray(d_num_reg_sum); - d_user_node_depth[reg_sum_id] = ID_UNDEFINED; - d_tmp_onode_src_variable.resizeArray(d_num_reg_sum); - d_tmp_onode_dst_variable.resizeArray(d_num_reg_sum); - d_onode_src_id.resizeArray(d_num_reg_sum); - d_onode_src_id[reg_sum_id] = ID_UNDEFINED; - d_onode_dst_id.resizeArray(d_num_reg_sum); - d_onode_dst_id[reg_sum_id] = ID_UNDEFINED; - - const int data_depth = node_factory->getDefaultDepth(); - const int array_by_depth_size = data_depth + 1; - - if (d_num_registered_data_by_depth.size() < array_by_depth_size) { - const int old_size = d_num_registered_data_by_depth.size(); - const int new_size = array_by_depth_size; - - d_num_registered_data_by_depth.resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - d_num_registered_data_by_depth[i] = 0; - } - } - - const int data_depth_id = d_num_registered_data_by_depth[data_depth]; - const int num_data_at_depth = data_depth_id + 1; - - if (s_onode_src_id_array.size() < array_by_depth_size) { - s_onode_src_id_array.resizeArray(array_by_depth_size); - s_onode_dst_id_array.resizeArray(array_by_depth_size); - } - - if (s_onode_src_id_array[data_depth].size() < num_data_at_depth) { - const int old_size = s_onode_src_id_array[data_depth].size(); - const int new_size = num_data_at_depth; - - s_onode_src_id_array[data_depth].resizeArray(new_size); - s_onode_dst_id_array[data_depth].resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - s_onode_src_id_array[data_depth][i] = ID_UNDEFINED; - s_onode_dst_id_array[data_depth][i] = ID_UNDEFINED; - } - } - - std::string var_suffix = tbox::Utilities::intToString(data_depth_id, 4) - + "__depth=" + tbox::Utilities::intToString(data_depth); - - std::string tonode_src_var_name = tmp_onode_src_variable_name - + var_suffix; - - d_tmp_onode_src_variable[reg_sum_id] = var_db->getVariable( - tonode_src_var_name); - if (!d_tmp_onode_src_variable[reg_sum_id]) { - d_tmp_onode_src_variable[reg_sum_id] = - new pdat::OuternodeVariable(tonode_src_var_name, data_depth); - } - - std::string tonode_dst_var_name = tmp_onode_dst_variable_name - + var_suffix; - d_tmp_onode_dst_variable[reg_sum_id] = var_db->getVariable( - tonode_dst_var_name); - if (!d_tmp_onode_dst_variable[reg_sum_id]) { - d_tmp_onode_dst_variable[reg_sum_id] = - new pdat::OuternodeVariable(tonode_dst_var_name, data_depth); - } - - if (s_onode_src_id_array[data_depth][data_depth_id] < 0) { - s_onode_src_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_onode_src_variable[reg_sum_id], - hier::IntVector(0)); - } - if (s_onode_dst_id_array[data_depth][data_depth_id] < 0) { - s_onode_dst_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_onode_dst_variable[reg_sum_id], - hier::IntVector(0)); - } - - d_user_node_data_id[reg_sum_id] = node_data_id; - d_user_node_depth[reg_sum_id] = data_depth; - - d_num_registered_data_by_depth[data_depth] = num_data_at_depth; - - d_onode_src_id[reg_sum_id] = - s_onode_src_id_array[data_depth][data_depth_id]; - d_onode_dst_id[reg_sum_id] = - s_onode_dst_id_array[data_depth][data_depth_id]; - - d_onode_src_data_set.setFlag(d_onode_src_id[reg_sum_id]); - d_onode_dst_data_set.setFlag(d_onode_dst_id[reg_sum_id]); - - } - -} - -/* - ************************************************************************* - * - * Set up schedule to sum node data around patch boundaries - * on a single level. - * - ************************************************************************* - */ - -void -MblkPatchBoundaryNodeSum::setupSum( - const boost::shared_ptr& level) -{ - TBOX_ASSERT(level); - - if (d_hierarchy_setup_called) { - - TBOX_ERROR("MblkPatchBoundaryNodeSum::setupSum error...\n" - << " object named " << d_object_name - << " already initialized via setupSum() for hierarchy" << std::endl); - - } else { - - d_setup_called = true; - d_level_setup_called = true; - - d_level = level; - - d_single_level_sum_schedule.resizeArray(1); - - // Communication algorithm for summing outernode values on a level - boost::shared_ptr single_level_sum_algorithm( - boost::make_shared()); - - for (int i = 0; i < d_num_reg_sum; i++) { - single_level_sum_algorithm->registerRefine( - d_onode_dst_id[i], // dst data - d_onode_src_id[i], // src data - d_onode_dst_id[i], // scratch data - (hier::RefineOperator *)NULL); - } - - xfer::RefineAlgorithm mblk_sum_algorithm( - single_level_sum_algorithm, d_hierarchy); - - d_single_level_sum_schedule[0] = - mblk_sum_algorithm.createSchedule( - d_level, - (xfer::RefinePatchStrategy *)NULL, - d_sum_transaction_factory); - - } - -} - -/* - ************************************************************************* - * - * Perform patch boundary node sum across single level or multiple - * hierarchy levels depending on how object was initialized. In the - * single level case, values at shared nodes are summed. In the - * multiple-level case, the algorithm involves the following steps: - * - * 1) Sum values at shared nodes on each level. - * 2) Set node values at coarse-fine boundary on each finer level - * to sum of fine level values and coarse level values at all - * nodes that are shared between the coarse and fine level. - * - * 2a) Copy coarser level node values to finer level (outer)node - * values at nodes on boundary of patches on a temporary - * level that represents the finer level coarsened to the - * index space of the coarser level. - * 2b) Sum (outer)node values at patch boundaries on finer level - * and (outer)node values at patch boundaries on coarsened - * finer level and set values on finer level to sum. Note - * that the hanging nodes on the finer level may be treated - * at this point if specified to do so by the user. - * - * 3) Inject (outer)node values around each finer level patch - * boundary to corresponding node values on each coarser level. - * - ************************************************************************* - */ - -void -MblkPatchBoundaryNodeSum::computeSum( - const bool fill_hanging_nodes) const -{ - NULL_USE(fill_hanging_nodes); - - if (d_level_setup_called) { - - d_level->allocatePatchData(d_onode_src_data_set); - d_level->allocatePatchData(d_onode_dst_data_set); - - doLevelSum(d_level); - - d_level->deallocatePatchData(d_onode_src_data_set); - d_level->deallocatePatchData(d_onode_dst_data_set); - - } - -} - -/* - ************************************************************************* - * - * Private member function that performs node sum across single level. - * - * 1. Copy node data to local outernode data. - * 2. Transfer and sum outernode data. - * 3. Copy outernode data back to node data. - * - ************************************************************************* - */ - -void -MblkPatchBoundaryNodeSum::doLevelSum( - const boost::shared_ptr& level) const -{ - TBOX_ASSERT(level); - - copyNodeToOuternodeOnLevel(level, - d_user_node_data_id, - d_onode_src_id); - - int schedule_level_number = 0; - if (!d_level_setup_called) { - schedule_level_number = - tbox::MathUtilities::Max(0, level->getLevelNumber()); - } - d_single_level_sum_schedule[schedule_level_number]->fillData(0.0, false); - - copyOuternodeToNodeOnLevel(level, - d_onode_dst_id, - d_user_node_data_id); -} - -/* - ************************************************************************* - * - * Private member functions to copy between node and outernode data - * over an entire level. - * - ************************************************************************* - */ - -void -MblkPatchBoundaryNodeSum::copyNodeToOuternodeOnLevel( - const boost::shared_ptr& level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id) const -{ - TBOX_ASSERT(level); - TBOX_ASSERT(node_data_id.size() == onode_data_id.size()); - - for (int bn = 0; bn < level->getNumberOfBlocks(); bn++) { - boost::shared_ptr patch_level( - level->getPatchLevelForBlock(bn)); - - if (patch_level) { - - for (hier::PatchLevel::iterator ip(patch_level->begin()); - ip != patch_level->end(); ++ip) { - boost::shared_ptr patch(patch_level->getPatch(*ip)); - - for (int i = 0; i < node_data_id.size(); i++) { - boost::shared_ptr > node_data( - patch->getPatchData(node_data_id[i])); - boost::shared_ptr > onode_data( - patch->getPatchData(onode_data_id[i])); - - onode_data->copy(*node_data); - } - } - } - } -} - -void -MblkPatchBoundaryNodeSum::copyOuternodeToNodeOnLevel( - const boost::shared_ptr& level, - const tbox::Array& onode_data_id, - const tbox::Array& node_data_id) const -{ - TBOX_ASSERT(level); - TBOX_ASSERT(node_data_id.size() == onode_data_id.size()); - - for (int bn = 0; bn < level->getNumberOfBlocks(); bn++) { - boost::shared_ptr patch_level( - level->getPatchLevelForBlock(bn)); - - if (patch_level) { - - for (hier::PatchLevel::iterator ip(patch_level->begin()); - ip != patch_level->end(); ++ip) { - boost::shared_ptr patch(patch_level->getPatch(*ip)); - - for (int i = 0; i < node_data_id.size(); i++) { - boost::shared_ptr > onode_data( - patch->getPatchData(onode_data_id[i])); - boost::shared_ptr > node_data( - patch->getPatchData(node_data_id[i])); - - onode_data->copy2(*node_data); - } - } - } - } -} - -} -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.h deleted file mode 100644 index 453cd988..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MblkPatchBoundaryNodeSum.h +++ /dev/null @@ -1,254 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Routines for summing node data at patch boundaries - * - ************************************************************************/ - -#ifndef included_algs_MblkPatchBoundaryNodeSum -#define included_algs_MblkPatchBoundaryNodeSum - -#include "SAMRAI/SAMRAI_config.h" - -#include "SAMRAI/hier/ComponentSelector.h" -#include "SAMRAI/hier/CoarseFineBoundary.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/pdat/OuternodeVariable.h" -#include "SAMRAI/xfer/CoarsenSchedule.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/xfer/RefineTransactionFactory.h" - -#include -#include - -namespace SAMRAI { -namespace algs { - -/*! - * @brief Class MblkPatchBoundaryNodeSum provides operations for summing node data - * values at nodes that are shared by multiple patches on a single level or across - * multiple hierarchy levels. - * - * Usage of a patch boundry node sum involves the following sequence of steps: - * - * -# Construct a patch boundry node sum object. For example, - * \verbatim - * MblkPatchBoundaryNodeSum my_node_sum("My Node Sum"); - * \endverbatim - * -# Register node data quantities to sum. For example, - * \verbatim - * my_node_sum.registerSum(node_data_id1); - * my_node_sum.registerSum(node_data_id2); - * etc... - * \endverbatim - * -# Setup the sum operations for either single level or a range of levels - * in a patch hierarchy. For example, - * \verbatim - * my_node_sum.setupSum(level); // single level - * -- or -- - * my_node_sum.setupSum(hierarchy, coarsest_ln, finest_ln); // multiple levels - * \endverbatim - * -# Execute the sum operation. For example, - * \verbatim - * my_node_sum.computeSum() - * \endverbatim - * - * The result of these operations is that each node patch data value associated - * with the registered ids at patch boundaries, on either the single level or - * range of hierarchy levels, is replaced by the sum of all data values at the node. - * - * Note that only one of the setupSum() functions may be called once a - * MblkPatchBoundaryNodeSum object is created. - */ - -class MblkPatchBoundaryNodeSum -{ -public: - /*! - * @brief Constructor initializes object to default (mostly undefined) - * state. - * - * @param object_name const std::string reference for name of object used - * in error reporting. When assertion checking is on, the string - * cannot be empty. - * @param hierarchy the hierarchy. - */ - MblkPatchBoundaryNodeSum( - const std::string& object_name, - const boost::shared_ptr& hierarchy); - - /*! - * @brief Destructor for the schedule releases all internal storage. - */ - ~MblkPatchBoundaryNodeSum(); - - /*! - * @brief Register node data with given patch data identifier for summing. - * - * @param node_data_id integer patch data index for node data to sum - * - * The node data id must be a valid patch data id (>=0) and must - * correspond to node-centered double data. If not, an error will result. - */ - void - registerSum( - int node_data_id); - - /*! - * @brief Set up summation operations for node data across shared nodes - * on a single level. - * - * If the other setupSum() function for a range of hierarchy levels has - * been called previously for this object, an error will result. - * - * @param level pointer to level on which to perform node sum - * - * When assertion checking is active, the level pointer cannot be null. - */ - void - setupSum( - const boost::shared_ptr& level); - - /*! - * @brief Compute sum of node values at each shared node and replace - * each such node value with the corresponding sum. - * - * At the end of this method, all values at shared node locations on - * patch boundaries (on levels indicated by the call to one of the - * setupSum() routines) will have the same value. - * - * When the setupSum() method taking a range of patch levels in a - * hierarchy is called, this method will compute the sum of nodal - * quantities at all the specified patch boundaries. For nodes at a - * coarse-fine boundary, nodal sums will only be performed where the - * coarse and fine nodes overlap. A node on a fine level that is not - * also a node on the next coarser level (a so-called "hanging node") - * will not be summed. - * - * The boolean "fill_hanging_nodes" argument specifies whether the - * the hanging nodes should be filled using linearly interpolated values - * from neighboring non-hanging nodes (i.e. those that overlap nodes on - * a coarse level). The correct steps required to deal with hanging - * nodes is algorithm dependent so, if left unspecified, values at the - * hanging nodes will not be adjusted. However, because many algorithms - * average hanging nodes we provide the capability to do it here. Note that - * the hanging node interpolation provided does not take into consideration - * the spatial location of the nodes. So the interpolation may not be - * correct for coordinate systems other than standard Cartesian grid geometry. - * - * @param fill_hanging_nodes Optional boolean value specifying whether hanging - * node values should be set to values interpolated from neighboring - * non-hanging node values. The default is false. - */ - void - computeSum( - const bool fill_hanging_nodes = false) const; - - /*! - * @brief Returns the object name. - * - * @return The object name. - */ - const std::string& - getObjectName() const - { - return d_object_name; - } - -private: - /* - * Private member function to perform node sum across single level -- - * called from computeSum(). - */ - void - doLevelSum( - const boost::shared_ptr& level) const; - - /* - * Private member function to copy node data to outernode data - * on all patches on a level. - */ - void - copyNodeToOuternodeOnLevel( - const boost::shared_ptr& level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id) const; - - /* - * Private member function to copy outernode data to node data - * on all patches on a level. - */ - void - copyOuternodeToNodeOnLevel( - const boost::shared_ptr& level, - const tbox::Array& onode_data_id, - const tbox::Array& node_data_id) const; - - /* - * Static members for managing shared temporary data among multiple - * MblkPatchBoundaryNodeSum objects. - */ - static int s_instance_counter; - // These arrays are indexed [data depth][number of variables with depth] - static tbox::Array > s_onode_src_id_array; - static tbox::Array > s_onode_dst_id_array; - - enum PATCH_BDRY_NODE_SUM_DATA_ID { ID_UNDEFINED = -1 }; - - std::string d_object_name; - bool d_setup_called; - - int d_num_reg_sum; - - // These arrays are indexed [variable registration sequence number] - tbox::Array d_user_node_data_id; - tbox::Array d_user_node_depth; - - // These arrays are indexed [data depth] - tbox::Array d_num_registered_data_by_depth; - - /* - * Node-centered variables and patch data indices used as internal work quantities. - */ - // These arrays are indexed [variable registration sequence number] - tbox::Array > d_tmp_onode_src_variable; - tbox::Array > d_tmp_onode_dst_variable; - - // These arrays are indexed [variable registration sequence number] - tbox::Array d_onode_src_id; - tbox::Array d_onode_dst_id; - - /* - * Sets of indices for temporary variables to expedite allocation/deallocation. - */ - hier::ComponentSelector d_onode_src_data_set; - hier::ComponentSelector d_onode_dst_data_set; - - boost::shared_ptr d_level; - - boost::shared_ptr d_hierarchy; - int d_coarsest_level; - int d_finest_level; - - bool d_level_setup_called; - bool d_hierarchy_setup_called; - - boost::shared_ptr d_sum_transaction_factory; - - tbox::Array > - d_single_level_sum_schedule; - -}; - -} -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.C index e7c01721..65caf2f7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.C @@ -3,18 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic method-of-lines time integration algorithm * ************************************************************************/ - -#ifndef included_algs_MethodOfLinesIntegrator_C -#define included_algs_MethodOfLinesIntegrator_C - #include "SAMRAI/algs/MethodOfLinesIntegrator.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchData.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/RestartManager.h" @@ -40,53 +37,37 @@ const int MethodOfLinesIntegrator::ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION = 2; MethodOfLinesIntegrator::MethodOfLinesIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, - MethodOfLinesPatchStrategy* patch_strategy, - bool register_for_restart) + MethodOfLinesPatchStrategy* patch_strategy): + d_object_name(object_name), + d_order(3), + d_patch_strategy(patch_strategy), + d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), + d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(patch_strategy != ((MethodOfLinesPatchStrategy *)NULL)); - - const tbox::Dimension dim(patch_strategy->getDim()); - - d_object_name = object_name; - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } + TBOX_ASSERT(patch_strategy != 0); - d_patch_strategy = patch_strategy; - - /* - * Communication algorithms. - */ - d_bdry_fill_advance.reset(new xfer::RefineAlgorithm(dim)); - d_fill_after_regrid.reset(new xfer::RefineAlgorithm(dim)); - d_fill_before_tagging.reset(new xfer::RefineAlgorithm(dim)); - d_coarsen_algorithm.reset(new xfer::CoarsenAlgorithm(dim)); + tbox::RestartManager::getManager()->registerRestartItem(d_object_name, + this); /* * hier::Variable contexts used in algorithm. */ - d_current = hier::VariableDatabase::getDatabase()->getContext("CURRENT"); - d_scratch = hier::VariableDatabase::getDatabase()->getContext("SCRATCH"); d_patch_strategy->setInteriorContext(d_current); d_patch_strategy->setInteriorWithGhostsContext(d_scratch); /* * Set default to third-order SSP Runge-Kutta method. */ - d_order = 3; - d_alpha_1.resizeArray(d_order); + d_alpha_1.resize(d_order); d_alpha_1[0] = 1.0; d_alpha_1[1] = 0.75; d_alpha_1[2] = 1.0 / 3.0; - d_alpha_2.resizeArray(d_order); + d_alpha_2.resize(d_order); d_alpha_2[0] = 0.0; d_alpha_2[1] = 0.25; d_alpha_2[2] = 2.0 / 3.0; - d_beta.resizeArray(d_order); + d_beta.resize(d_order); d_beta[0] = 1.0; d_beta[1] = 0.25; d_beta[2] = 2.0 / 3.0; @@ -95,7 +76,7 @@ MethodOfLinesIntegrator::MethodOfLinesIntegrator( * Initialize object with data read from input and restart databases. */ bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (is_from_restart && d_registered_for_restart) { + if (is_from_restart) { getFromRestart(); } @@ -114,9 +95,7 @@ MethodOfLinesIntegrator::MethodOfLinesIntegrator( MethodOfLinesIntegrator::~MethodOfLinesIntegrator() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); } /* @@ -176,7 +155,7 @@ MethodOfLinesIntegrator::getTimestep( double dt = tbox::MathUtilities::getMax(); const int nlevels = hierarchy->getNumberOfLevels(); - for (int l = 0; l < nlevels; l++) { + for (int l = 0; l < nlevels; ++l) { boost::shared_ptr level = hierarchy->getPatchLevel(l); TBOX_ASSERT(level); @@ -238,7 +217,7 @@ MethodOfLinesIntegrator::advanceHierarchy( */ const int nlevels = hierarchy->getNumberOfLevels(); - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); TBOX_ASSERT(level); @@ -259,13 +238,13 @@ MethodOfLinesIntegrator::advanceHierarchy( /* * Loop through Runge-Kutta steps */ - for (int rkstep = 0; rkstep < d_order; rkstep++) { + for (int rkstep = 0; rkstep < d_order; ++rkstep) { /* * Loop through levels in the patch hierarchy and advance data on * each level by a single RK step. */ - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { /* * Fill ghost cells of all patches in level @@ -301,7 +280,7 @@ MethodOfLinesIntegrator::advanceHierarchy( } // rksteps loop - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { copyScratchToCurrent(hierarchy->getPatchLevel(ln)); /* @@ -313,7 +292,7 @@ MethodOfLinesIntegrator::advanceHierarchy( /* * dallocate U_scratch and rhs data */ - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); level->deallocatePatchData(d_scratch_data); level->deallocatePatchData(d_rhs_data); @@ -370,10 +349,21 @@ MethodOfLinesIntegrator::registerVariable( { TBOX_ASSERT(variable); TBOX_ASSERT(transfer_geom); - TBOX_DIM_ASSERT_CHECK_ARGS2(*variable, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, ghosts); tbox::Dimension dim(ghosts.getDim()); + if (!d_bdry_fill_advance) { + /* + * One-time set-up for communication algorithms. + * We wait until this point to do this because we need a dimension. + */ + d_bdry_fill_advance.reset(new xfer::RefineAlgorithm()); + d_fill_after_regrid.reset(new xfer::RefineAlgorithm()); + d_fill_before_tagging.reset(new xfer::RefineAlgorithm()); + d_coarsen_algorithm.reset(new xfer::CoarsenAlgorithm(dim)); + } + hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); switch (m_v_type) { @@ -404,7 +394,7 @@ MethodOfLinesIntegrator::registerVariable( /* * Register variable and context needed for restart. */ - hier::VariableDatabase::getDatabase()-> + hier::PatchDataRestartManager::getManager()-> registerPatchDataForRestart(current); /* @@ -479,7 +469,8 @@ MethodOfLinesIntegrator::registerVariable( default: { TBOX_ERROR(d_object_name << ": " - << "unknown MOL_VAR_TYPE = " << m_v_type); + << "unknown MOL_VAR_TYPE = " << m_v_type + << std::endl); } @@ -513,13 +504,13 @@ MethodOfLinesIntegrator::initializeLevelData( NULL_USE(can_be_refined); NULL_USE(allocate_data); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); TBOX_ASSERT(level_number >= 0); +#ifdef DEBUG_CHECK_ASSERTIONS if (old_level) { TBOX_ASSERT(level_number == old_level->getLevelNumber()); - TBOX_DIM_ASSERT_CHECK_ARGS2(*hierarchy, *old_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*hierarchy, *old_level); } #endif @@ -580,11 +571,11 @@ MethodOfLinesIntegrator::resetHierarchyConfiguration( int finest_hiera_level = hierarchy->getFinestLevelNumber(); // If we have added or removed a level, resize the schedule arrays - d_bdry_sched_advance.resizeArray(finest_hiera_level + 1); - d_coarsen_schedule.resizeArray(finest_hiera_level + 1); + d_bdry_sched_advance.resize(finest_hiera_level + 1); + d_coarsen_schedule.resize(finest_hiera_level + 1); // Build coarsen and refine communication schedules. - for (int ln = coarsest_level; ln <= finest_hiera_level; ln++) { + for (int ln = coarsest_level; ln <= finest_hiera_level; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); TBOX_ASSERT(level); @@ -604,7 +595,7 @@ MethodOfLinesIntegrator::resetHierarchyConfiguration( d_coarsen_algorithm->createSchedule( coarser_level, level, - NULL); + 0); } } @@ -669,24 +660,23 @@ MethodOfLinesIntegrator::applyGradientDetector( ************************************************************************* * * Writes the class version number, order, and - * alpha array to the database. + * alpha array to the restart database. * ************************************************************************* */ void -MethodOfLinesIntegrator::putToDatabase( - const boost::shared_ptr& db) const +MethodOfLinesIntegrator::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION", + restart_db->putInteger("ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION", ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION); - db->putInteger("d_order", d_order); - db->putDoubleArray("d_alpha_1", d_alpha_1); - db->putDoubleArray("d_alpha_2", d_alpha_2); - db->putDoubleArray("d_beta", d_beta); + restart_db->putDoubleVector("alpha_1", d_alpha_1); + restart_db->putDoubleVector("alpha_2", d_alpha_2); + restart_db->putDoubleVector("beta", d_beta); } /* @@ -704,79 +694,58 @@ MethodOfLinesIntegrator::getFromInput( const boost::shared_ptr& input_db, bool is_from_restart) { - TBOX_ASSERT(is_from_restart || input_db); + if (input_db) { - if (is_from_restart) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + if (!is_from_restart || read_on_restart) { - if (input_db) { - if (input_db->keyExists("order")) { - d_order = input_db->getInteger("order"); - if (d_order < 0) { - TBOX_ERROR( - d_object_name << ": " - << "Negative `order' value specified in input."); + if (input_db->keyExists("alpha_1")) { + size_t array_size = input_db->getArraySize("alpha_1"); + if (array_size > 3) { + TBOX_ERROR("MethodOfLinesIntegrator::getFromInput() error...\n" + << "number of alpha_1 entries must be <=3." << std::endl); } - + d_alpha_1 = input_db->getDoubleVector("alpha_1"); } - } - - } else { - d_order = input_db->getIntegerWithDefault("order", d_order); + if (input_db->keyExists("alpha_2")) { + size_t array_size = input_db->getArraySize("alpha_2"); + if (array_size > 3) { + TBOX_ERROR("MethodOfLinesIntegrator::getFromInput() error...\n" + << "number of alpha_2 entries must be <=3." << std::endl); + } + d_alpha_2 = input_db->getDoubleVector("alpha_2"); + } - if (input_db->keyExists("alpha_1")) { - d_alpha_1 = input_db->getDoubleArray("alpha_1"); - } else { - TBOX_WARNING( - d_object_name << ": " - << "Key data `alpha_1' not found in input. " - << "Using default values. See class header."); - } + if (input_db->keyExists("beta")) { + size_t array_size = input_db->getArraySize("beta"); + if (array_size > 3) { + TBOX_ERROR("MethodOfLinesIntegrator::getFromInput() error...\n" + << "number of beta entries must be <=3." << std::endl); + } + d_beta = input_db->getDoubleVector("beta"); + } - if (input_db->keyExists("alpha_2")) { - d_alpha_2 = input_db->getDoubleArray("alpha_2"); - } else { - TBOX_WARNING( - d_object_name << ": " - << "Key data `alpha_2' not found in input. " - << "Using default values. See class header."); - } + if (d_alpha_1.size() != d_alpha_2.size() || + d_alpha_2.size() != d_beta.size()) { + TBOX_ERROR( + d_object_name << ": " + << "The number of alpha_1, alpha_2, and beta " + << "values specified in input is not consistent"); + } - if (input_db->keyExists("beta")) { - d_beta = input_db->getDoubleArray("beta"); - } else { - TBOX_WARNING( - d_object_name << ": " - << "Key data `beta' not found in input. " - << "Using default values. See class header."); + d_order = static_cast(d_alpha_1.size()); } - - } - - if (d_alpha_1.getSize() != d_alpha_2.getSize() || - d_alpha_2.getSize() != d_beta.getSize()) { - TBOX_ERROR( - d_object_name << ": " - << "The number of alpha_1, alpha_2, and beta values " - << "specified in input is not consistent"); - } - - if (d_alpha_1.getSize() != d_order) { - TBOX_WARNING( - d_object_name << ": " - << "The number of alpha values specified in input " - << "does not equal the Runga-Kutta order"); - d_order = d_alpha_1.getSize(); } - } /* ************************************************************************* * * Checks that class and restart file version numbers are equal. If so, - * reads in d_order and d_alpha from the database. Also, does a - * consistency check to make sure that the number of alpha values + * reads in d_alpha_1, d_alpha_2, and d_beta from the database. Also, + * dooes a consistency check to make sure that the number of alpha values * specified equals the order of the Runga-Kutta scheme. * ************************************************************************* @@ -789,33 +758,36 @@ MethodOfLinesIntegrator::getFromRestart() boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); - boost::shared_ptr restart_db; - if (root_db->isDatabase(d_object_name)) { - restart_db = root_db->getDatabase(d_object_name); - } else { + if (!root_db->isDatabase(d_object_name)) { TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file."); + << d_object_name << " not found in restart file." << std::endl); } + boost::shared_ptr restart_db( + root_db->getDatabase(d_object_name)); int ver = restart_db->getInteger("ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION"); if (ver != ALGS_METHOD_OF_LINES_INTEGRATOR_VERSION) { TBOX_ERROR( d_object_name << ": " - << "Restart file version different than class version."); + << "Restart file version different than class version." + << std::endl); } - d_order = restart_db->getInteger("d_order"); - d_alpha_1 = restart_db->getDoubleArray("d_alpha_1"); - d_alpha_2 = restart_db->getDoubleArray("d_alpha_2"); - d_beta = restart_db->getDoubleArray("d_beta"); + d_alpha_1 = restart_db->getDoubleVector("alpha_1"); + d_alpha_2 = restart_db->getDoubleVector("alpha_2"); + d_beta = restart_db->getDoubleVector("beta"); - if (d_alpha_1.getSize() != d_order) { + if (d_alpha_1.size() != d_alpha_2.size() || + d_alpha_2.size() != d_beta.size()) { TBOX_ERROR( d_object_name << ": " - << "The number of alpha values read from restart " - << "does not equal the Runga-Kutta order"); + << "The number of alpha_1, alpha_2, and beta values " + << "specified in restart is not consistent" + << std::endl); } + d_order = static_cast(d_alpha_1.size()); + } /* @@ -846,7 +818,7 @@ MethodOfLinesIntegrator::copyCurrentToScratch( patch->getPatchData(*soln_var, d_scratch)); dst_data->copy(*src_data); - soln_var++; + ++soln_var; } @@ -882,7 +854,7 @@ MethodOfLinesIntegrator::copyScratchToCurrent( patch->getPatchData(*soln_var, d_current)); dst_data->copy(*src_data); - soln_var++; + ++soln_var; } @@ -908,7 +880,7 @@ MethodOfLinesIntegrator::printClassData( os << "d_object_name = " << d_object_name << std::endl; os << "d_order = " << d_order << std::endl; - for (int j = 0; j < d_order; j++) { + for (int j = 0; j < d_order; ++j) { os << "d_alpha_1[" << j << "] = " << d_alpha_1[j] << std::endl; os << "d_alpha_2[" << j << "] = " << d_alpha_2[j] << std::endl; os << "d_beta[" << j << "] = " << d_beta[j] << std::endl; @@ -920,4 +892,3 @@ MethodOfLinesIntegrator::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.h index cca79aa4..8f58a3ec 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesIntegrator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic method-of-lines time integration algorithm * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/xfer/CoarsenAlgorithm.h" #include "SAMRAI/xfer/CoarsenSchedule.h" #include "SAMRAI/hier/ComponentSelector.h" @@ -30,10 +29,11 @@ #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include +#include namespace SAMRAI { namespace algs { @@ -64,34 +64,64 @@ namespace algs { * values may override values read from restart. Data read from input is * summarized as follows: * - * Required input keys and data types: NONE - * - * Optional input keys, data types, and defaults: - * - * - \b order - * integer value specifying order of Runge-Kutta scheme. If no input - * value is given, third order (i.e. order = 3) is used. + * Input Parameters * + * Definitions: * - \b alpha_1 * - \b alpha_2 - * - \b beta + * - \b beta
    * arrays of double values (length = order) specifying the coeffients * used in the multi-step Strong Stability Preserving (SSP) Runge-Kutta - * algorithm. If no input is supplied, the default alpha_1, alpha_2, - * and beta values are automatically set to correspond to the - * specified order. + * algorithm. + * + * Note that when continuing from restart, the input parameters in the input + * database override all values read in from the restart database. * + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    alpha_1array of doubles[1.0, 0.75, 2.0/3.0]any doubles but no more than 3 of themoptParameter read from restart db may be overridden by input db
    alpha_2array of doubles[0.0, 0.25, 2.0/3.0]any doubles but no more than 3 of themoptParameter read from restart db may be overridden by input db
    betaarray of doubles[1.0, 0.25, 2.0/3.0]any doubles but no more than 3 of themoptParameter read from restart db may be overridden by input db
    * * The following represents a sample input entry: * - * \verbatim + * @code * MethodOfLinesIntegrator{ - * order = 3 * alpha_1 = 1., 0.75, 0.33333 * alpha_2 = 0., 0.25, 0.66666 * beta = 1., 0.25, 0.66666 * } - * \endverbatim + * @endcode * * @see mesh::StandardTagAndInitStrategy */ @@ -123,24 +153,19 @@ class MethodOfLinesIntegrator: * (containing problem-specific numerical routines) and initializes * integration algorithm parameters provided in the specified input * database and in the restart database corresponding to the - * specified object_name. The constructor also registers this object - * for restart using the specified object name when the boolean - * argument is true. Whether object will write its state to - * restart files during program execution is determined by this argument. - * Note that it has a default state of true. + * specified object_name. * - * When assertion checking is active, passing in any null pointer - * or an empty std::string will result in an unrecoverable assertion. + * @pre !object_name.empty() + * @pre patch_strategy != 0 */ MethodOfLinesIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, - MethodOfLinesPatchStrategy* patch_strategy, - bool register_for_restart = true); + MethodOfLinesPatchStrategy* patch_strategy); /*! * The destructor for MethodOfLinesIntegrator unregisters - * the integrator object with the restart manager when so registered. + * the integrator object with the restart manager. */ virtual ~MethodOfLinesIntegrator(); @@ -149,6 +174,8 @@ class MethodOfLinesIntegrator: * of data needed based on specifications of the gridding algorithm. * * This routine also invokes variable registration in the patch strategy. + * + * @pre gridding_alg */ void initializeIntegrator( @@ -158,6 +185,8 @@ class MethodOfLinesIntegrator: * Return a suitable time increment over which to integrate the ODE * problem. A minimum is taken over the increment computed on * each patch in the hierarchy. + * + * @pre hierarchy */ double getTimestep( @@ -168,6 +197,8 @@ class MethodOfLinesIntegrator: * Advance the solution through the specified dt, which is assumed * for the problem and state of the solution. Advances all patches * in the hierarchy passed in. + * + * @pre hierarchy */ void advanceHierarchy( @@ -178,6 +209,10 @@ class MethodOfLinesIntegrator: /*! * Register variable quantity defined in the patch strategy with the * method of lines integrator which manipulates its storage. + * + * @pre variable + * @pre transfer_geom + * @pre variable->getDim() == ghosts.getDim() */ void registerVariable( @@ -224,8 +259,11 @@ class MethodOfLinesIntegrator: * circumstances. The can_be_refined boolean argument indicates whether * the level is the finest allowable level in the hierarchy. * - * Note: This function is overloaded from the base class - * mesh::StandardTagAndInitStrategy. + * @pre hierarchy + * @pre level_number >= 0 + * @pre hierarchy->getPatchLevel(level_number) + * @pre !old_level || (level_number == old_level->getLevelNumber()) + * @pre !old_level || (hierarchy->getDim() == old_level->getDim()) */ void initializeLevelData( @@ -251,8 +289,9 @@ class MethodOfLinesIntegrator: * schedules are updated for every level finer than and including that * indexed by coarsest_level. * - * Note: This function is overloaded from the base class - * mesh::StandardTagAndInitStrategy. + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level <= finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) */ void resetHierarchyConfiguration( @@ -275,8 +314,8 @@ class MethodOfLinesIntegrator: * application of the error estimator may be different in each of those * circumstances. * - * Note: This function is overloaded from the base class - * mesh::StandardTagAndInitStrategy. + * @pre hierarchy + * @pre hierarchy->getPatchLevel(level_number) */ virtual void applyGradientDetector( @@ -288,13 +327,13 @@ class MethodOfLinesIntegrator: const bool uses_richardson_extrapolation_too); /*! - * Writes object state out to the given database. + * Writes object state out to the given restart database. * - * When assertion checking is enabled, the database pointer must be non-null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * Returns the object name. @@ -329,12 +368,10 @@ class MethodOfLinesIntegrator: * Reads in parameters from the input database. All * values from the input file take precedence over values from the * restart file. - * - * When assertion checking enabled: db must not be a non-NULL pointer. */ void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); /* @@ -358,20 +395,18 @@ class MethodOfLinesIntegrator: /* * The object name is used as a handle to the database stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. + * restart files and for error reporting purposes. */ std::string d_object_name; - bool d_registered_for_restart; /* * Order of the Runge-Kutta method, and array of alpha values used in * updating solution during multi-step process. */ int d_order; - tbox::Array d_alpha_1; - tbox::Array d_alpha_2; - tbox::Array d_beta; + std::vector d_alpha_1; + std::vector d_alpha_2; + std::vector d_beta; /* * A pointer to the method of lines patch model that will perform @@ -393,7 +428,7 @@ class MethodOfLinesIntegrator: * data at specified time. */ boost::shared_ptr d_bdry_fill_advance; - tbox::Array > d_bdry_sched_advance; + std::vector > d_bdry_sched_advance; /* * Algorithm for transferring data from coarse patch to fine patch @@ -412,7 +447,7 @@ class MethodOfLinesIntegrator: * fine to coarse grid. */ boost::shared_ptr d_coarsen_algorithm; - tbox::Array > d_coarsen_schedule; + std::vector > d_coarsen_schedule; /* * This algorithm has two variable contexts. The current context is the diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.C index 9871e064..cab99523 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to application-specific patch functions to support * MethodOfLines integration algorithm * ************************************************************************/ - -#ifndef included_algs_MethodOfLinesPatchStrategy_C -#define included_algs_MethodOfLinesPatchStrategy_C - #include "SAMRAI/algs/MethodOfLinesPatchStrategy.h" #include "SAMRAI/hier/VariableDatabase.h" @@ -27,11 +23,9 @@ namespace algs { ************************************************************************* */ -MethodOfLinesPatchStrategy::MethodOfLinesPatchStrategy( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - xfer::CoarsenPatchStrategy(dim), - d_dim(dim) +MethodOfLinesPatchStrategy::MethodOfLinesPatchStrategy(): + xfer::RefinePatchStrategy(), + xfer::CoarsenPatchStrategy() { d_interior_with_ghosts.reset(); d_interior.reset(); @@ -41,18 +35,5 @@ MethodOfLinesPatchStrategy::~MethodOfLinesPatchStrategy() { } -hier::IntVector -MethodOfLinesPatchStrategy::getRefineOpStencilWidth() const -{ - return hier::IntVector::getZero(d_dim); -} - -hier::IntVector -MethodOfLinesPatchStrategy::getCoarsenOpStencilWidth() const -{ - return hier::IntVector::getZero(d_dim); -} - } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.h index 39370897..f3980672 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/MethodOfLinesPatchStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to application-specific patch functions in support * Method of Lines integration algorithm * @@ -24,7 +24,7 @@ #include "SAMRAI/xfer/CoarsenPatchStrategy.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace algs { @@ -40,7 +40,7 @@ class MethodOfLinesIntegrator; * interlevel data refining and coarsening operations and the specification * of physical boundary conditions. * - * @see algs::MethodOfLinesIntegrator + * @see MethodOfLinesIntegrator * @see xfer::RefinePatchStrategy * @see xfer::CoarsenPatchStrategy */ @@ -53,8 +53,7 @@ class MethodOfLinesPatchStrategy: /*! * Blank constructor for MethodOfLinesPatchStrategy. */ - explicit MethodOfLinesPatchStrategy( - const tbox::Dimension& dim); + MethodOfLinesPatchStrategy(); /*! * Virtual destructor for MethodOfLinesPatchStrategy. @@ -112,7 +111,8 @@ class MethodOfLinesPatchStrategy: * Using a user-specified gradient detection scheme, determine cells which * have high gradients and, consequently, should be refined. */ - virtual void tagGradientDetectorCells( + virtual void + tagGradientDetectorCells( hier::Patch& patch, const double regrid_time, const bool initial_error, @@ -128,107 +128,6 @@ class MethodOfLinesPatchStrategy: const double fill_time, const hier::IntVector& ghost_width_to_fill) = 0; - /*! - * Return maximum stencil width needed for user-defined - * data interpolation operations. Default is to return - * zero, assuming no user-defined operations provided. - */ - virtual hier::IntVector - getRefineOpStencilWidth() const; - - /*! - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. The - * interpolation routines are used in the MOL AMR algorithm - * for filling patch ghost cells before advancing data on a level - * and after regridding a level to fill portions of the new level - * from some coarser level. These routines are called automatically - * from within patch boundary filling schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch model. However, the routines only need to perform some - * operations when "USER_DEFINED_REFINE" is given as the interpolation - * method for some variable when the patch model registers variables - * with the MOL integration algorithm, typically. If the - * user does not provide operations that refine such variables in either - * of these routines, then they will not be refined. - * - * The order in which these operations are used in each patch - * boundary filling schedule is: - * - * - \b (1) {Call user's preprocessRefine() routine.} - * - \b (2) {Refine all variables with standard interpolation operators.} - * - \b (3) {Call user's postprocessRefine() routine.} - * - * - * Also, user routines that implement these functions must use - * data corresponding to the d_scratch context on both coarse and - * fine patches. - */ - virtual void - preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) = 0; - - /// - virtual void - postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) = 0; - - /*! - * Return maximum stencil width needed for user-defined - * data coarsen operations. Default is to return - * zero, assuming no user-defined operations provided. - */ - virtual hier::IntVector - getCoarsenOpStencilWidth() const; - - /*! - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. The coarsening - * routines are used in the MOL AMR algorithm synchronizing - * coarse and fine levels when they have been integrated to the same - * point. These routines are called automatically from within the - * data synchronization coarsen schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch model. However, the routines only need to perform some - * operations when "USER_DEFINED_COARSEN" is given as the coarsening - * method for some variable when the patch model registers variables - * with the MOL level integration algorithm, typically. If the - * user does not provide operations that coarsen such variables in either - * of these routines, then they will not be coarsened. - * - * The order in which these operations are used in each coarsening - * schedule is: - * - * - \b (1) {Call user's preprocessCoarsen() routine.} - * - \b (2) {Coarsen all variables with standard coarsening operators.} - * - \b (3) {Call user's postprocessCoarsen() routine.} - * - * - * Also, user routines that implement these functions must use - * corresponding to the d_new context on both coarse and fine patches - * for time-dependent quantities. - */ - virtual void - preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) = 0; - - /// - virtual void - postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) = 0; - /*! * The method of lines integrator controls the context for the data to * be used in the numerical routines implemented in the concrete patch @@ -272,15 +171,7 @@ class MethodOfLinesPatchStrategy: d_interior = context; } - const tbox::Dimension& - getDim() const - { - return d_dim; - } - private: - const tbox::Dimension d_dim; - boost::shared_ptr d_interior_with_ghosts; boost::shared_ptr d_interior; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.C index 2e8f3f65..866c67e0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for summing outeredge data * ************************************************************************/ - -#ifndef included_algs_OuteredgeSumTransaction_C -#define included_algs_OuteredgeSumTransaction_C - #include "SAMRAI/algs/OuteredgeSumTransaction.h" #include "SAMRAI/hier/Patch.h" @@ -31,19 +27,6 @@ namespace SAMRAI { namespace algs { -/* - ************************************************************************* - * - * Initialization, set/unset functions for static array of refine items. - * - ************************************************************************* - */ - -const xfer::RefineClasses::Data ** -OuteredgeSumTransaction::s_refine_items = - (const xfer::RefineClasses::Data **)NULL; -int OuteredgeSumTransaction::s_num_refine_items = 0; - /* ************************************************************************* * @@ -58,13 +41,15 @@ OuteredgeSumTransaction::OuteredgeSumTransaction( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int refine_item_id): + const xfer::RefineClasses::Data** refine_data, + int item_id): d_dst_level(dst_level), d_src_level(src_level), d_overlap(overlap), d_dst_node(dst_node), d_src_node(src_node), - d_refine_item_id(refine_item_id), + d_refine_data(refine_data), + d_item_id(item_id), d_incoming_bytes(0), d_outgoing_bytes(0) { @@ -73,10 +58,10 @@ OuteredgeSumTransaction::OuteredgeSumTransaction( TBOX_ASSERT(overlap); TBOX_ASSERT(dst_node.getLocalId() >= 0); TBOX_ASSERT(src_node.getLocalId() >= 0); - TBOX_ASSERT(refine_item_id >= 0); - // Note: s_num_refine_items cannot be used at this point! + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); } OuteredgeSumTransaction::~OuteredgeSumTransaction() @@ -98,14 +83,12 @@ OuteredgeSumTransaction::canEstimateIncomingMessageSize() if (d_src_node.getOwnerRank() == d_src_level->getBoxLevel()->getMPI().getRank()) { can_estimate = d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) + ->getPatchData(d_refine_data[d_item_id]->d_src) ->canEstimateStreamSizeFromBox(); } else { can_estimate = d_dst_level->getPatch(d_dst_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) + ->getPatchData(d_refine_data[d_item_id]->d_scratch) ->canEstimateStreamSizeFromBox(); } return can_estimate; @@ -116,8 +99,7 @@ OuteredgeSumTransaction::computeIncomingMessageSize() { d_incoming_bytes = d_dst_level->getPatch(d_dst_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) + ->getPatchData(d_refine_data[d_item_id]->d_scratch) ->getDataStreamSize(*d_overlap); return d_incoming_bytes; } @@ -127,8 +109,7 @@ OuteredgeSumTransaction::computeOutgoingMessageSize() { d_outgoing_bytes = d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) + ->getPatchData(d_refine_data[d_item_id]->d_src) ->getDataStreamSize(*d_overlap); return d_outgoing_bytes; } @@ -149,10 +130,9 @@ void OuteredgeSumTransaction::packStream( tbox::MessageStream& stream) { - d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) - ->packStream(stream, *d_overlap); + d_src_level->getPatch(d_src_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_src)-> + packStream(stream, *d_overlap); } void @@ -160,9 +140,9 @@ OuteredgeSumTransaction::unpackStream( tbox::MessageStream& stream) { boost::shared_ptr > oedge_dst_data( - d_dst_level->getPatch(d_dst_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_dst_level->getPatch(d_dst_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_scratch))); TBOX_ASSERT(oedge_dst_data); oedge_dst_data->unpackStreamAndSum(stream, *d_overlap); @@ -172,15 +152,15 @@ void OuteredgeSumTransaction::copyLocalData() { boost::shared_ptr > oedge_dst_data( - d_dst_level->getPatch(d_dst_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_dst_level->getPatch(d_dst_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_scratch))); TBOX_ASSERT(oedge_dst_data); boost::shared_ptr > oedge_src_data( - d_src_level->getPatch(d_src_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_src), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_src_level->getPatch(d_src_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_src))); TBOX_ASSERT(oedge_src_data); oedge_dst_data->sum(*oedge_src_data, *d_overlap); @@ -199,17 +179,15 @@ OuteredgeSumTransaction::printClassData( std::ostream& stream) const { stream << "Outeredge Sum Transaction" << std::endl; - stream << " refine item array: " - << (xfer::RefineClasses::Data **)s_refine_items + stream << " refine item: " + << (xfer::RefineClasses::Data *)d_refine_data[d_item_id] << std::endl; - stream << " num refine items: " << s_num_refine_items << std::endl; stream << " destination node: " << d_dst_node << std::endl; stream << " source node: " << d_src_node << std::endl; - stream << " refine item id: " << d_refine_item_id << std::endl; stream << " destination patch data: " - << s_refine_items[d_refine_item_id]->d_scratch << std::endl; + << d_refine_data[d_item_id]->d_scratch << std::endl; stream << " source patch data: " - << s_refine_items[d_refine_item_id]->d_src << std::endl; + << d_refine_data[d_item_id]->d_src << std::endl; stream << " incoming bytes: " << d_incoming_bytes << std::endl; stream << " outgoing bytes: " << d_outgoing_bytes << std::endl; stream << " destination level: " @@ -230,5 +208,3 @@ OuteredgeSumTransaction::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.h index 8c92a75b..7f8f5943 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for summing outeredge data * ************************************************************************/ @@ -43,37 +43,6 @@ namespace algs { class OuteredgeSumTransaction:public tbox::Transaction { public: - /*! - * Static member function to set the array of refine class data items that - * is shared by all object instances of this sum transaction class during - * data transfers. The array must be set before any transactions are - * executed. The array is set in the RefineSchedule class. - */ - static void - setRefineItems( - const xfer::RefineClasses::Data ** refine_items, - int num_refine_items) - { - TBOX_ASSERT(refine_items != (const xfer::RefineClasses::Data **)NULL); - TBOX_ASSERT(num_refine_items >= 0); - s_refine_items = refine_items; - s_num_refine_items = num_refine_items; - } - - /*! - * Static member function to unset the array of refine class data items that - * is shared by all object instances of this sum transaction class during - * data transfers. The unset function is used to prevent erroneous - * execution of different schedules. The array is unset in the - * RefineSchedule class. - */ - static void - unsetRefineItems() - { - s_refine_items = (const xfer::RefineClasses::Data **)NULL; - s_num_refine_items = 0; - } - /*! * Construct a transaction with the specified source and destination * levels, patches, and patch data components found in the refine class @@ -91,12 +60,20 @@ class OuteredgeSumTransaction:public tbox::Transaction * patches. * @param dst_node Destination box. * @param src_node Source box. - * @param refine_item_id Integer id of refine data item owned by refine + * @param refine_data Pointer to array of refine data items + * @param item_id Integer id of refine data item owned by refine * schedule. * - * When assertion checking is active, an assertion will result if any of the - * pointer arguments is null, or if any of the integer arguments is invalid - * (i.e., < 0). + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre refine_data != 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ OuteredgeSumTransaction( const boost::shared_ptr& dst_level, @@ -104,7 +81,8 @@ class OuteredgeSumTransaction:public tbox::Transaction const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int refine_item_id); + const xfer::RefineClasses::Data ** refine_data, + int item_id); /*! * The virtual destructor for the copy transaction releases all @@ -157,6 +135,8 @@ class OuteredgeSumTransaction:public tbox::Transaction /*! * Unpack the transaction data from the message stream. + * + * @pre d_dst_level->getPatch(d_dst_node.getGlobalId())->getPatchData(_refine_data[d_item_id]->d_scratch) is actually a boost::shared_ptr > */ virtual void unpackStream( @@ -164,6 +144,9 @@ class OuteredgeSumTransaction:public tbox::Transaction /*! * Perform the local data copy for the transaction. + * + * @pre d_dst_level->getPatch(d_dst_node.getGlobalId())->getPatchData(d_refine_data[d_item_id]->d_scratch) is actually a boost::shared_ptr > + * @pre d_src_level->getPatch(d_src_node.getGlobalId())->getPatchData(d_refine_data[d_item_id]->d_src) is actually a boost::shared_ptr > */ virtual void copyLocalData(); @@ -178,21 +161,19 @@ class OuteredgeSumTransaction:public tbox::Transaction private: OuteredgeSumTransaction( const OuteredgeSumTransaction&); // not implemented - void + OuteredgeSumTransaction& operator = ( const OuteredgeSumTransaction&); // not implemented - static const xfer::RefineClasses::Data** s_refine_items; - static int s_num_refine_items; - boost::shared_ptr d_dst_level; boost::shared_ptr d_src_level; boost::shared_ptr d_overlap; hier::Box d_dst_node; hier::Box d_src_node; - int d_refine_item_id; - int d_incoming_bytes; - int d_outgoing_bytes; + const xfer::RefineClasses::Data** d_refine_data; + int d_item_id; + size_t d_incoming_bytes; + size_t d_outgoing_bytes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.C index 97660aa5..f8c2a2fa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory for creating outeredge sum transaction objects * ************************************************************************/ - -#ifndef included_algs_OuteredgeSumTransactionFactory_C -#define included_algs_OuteredgeSumTransactionFactory_C - #include "SAMRAI/algs/OuteredgeSumTransactionFactory.h" #include "SAMRAI/pdat/OuteredgeData.h" #include "SAMRAI/algs/OuteredgeSumTransaction.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace algs { @@ -37,33 +33,6 @@ OuteredgeSumTransactionFactory::~OuteredgeSumTransactionFactory() { } -/* - ************************************************************************* - * - * Set/unset information for transactions managed by this factory class. - * - ************************************************************************* - */ - -void -OuteredgeSumTransactionFactory::setRefineItems( - const xfer::RefineClasses::Data** refine_items, - int num_refine_items) -{ - OuteredgeSumTransaction::setRefineItems(refine_items, - num_refine_items); - d_refine_items = refine_items; - d_number_refine_items = num_refine_items; -} - -void -OuteredgeSumTransactionFactory::unsetRefineItems() -{ - OuteredgeSumTransaction::unsetRefineItems(); - d_refine_items = (const xfer::RefineClasses::Data **)NULL; - d_number_refine_items = 0; -} - /* ************************************************************************* * @@ -79,21 +48,30 @@ OuteredgeSumTransactionFactory::allocate( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id, + const xfer::RefineClasses::Data** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation) const { NULL_USE(box); NULL_USE(use_time_interpolation); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT(dst_level); + TBOX_ASSERT(src_level); + TBOX_ASSERT(overlap); + TBOX_ASSERT(dst_node.getLocalId() >= 0); + TBOX_ASSERT(src_node.getLocalId() >= 0); + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); return boost::make_shared(dst_level, - src_level, - overlap, - dst_node, - src_node, - ritem_id); + src_level, + overlap, + dst_node, + src_node, + refine_data, + item_id); } boost::shared_ptr @@ -103,16 +81,25 @@ OuteredgeSumTransactionFactory::allocate( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id) const + const xfer::RefineClasses::Data** refine_data, + int item_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT(dst_level); + TBOX_ASSERT(src_level); + TBOX_ASSERT(overlap); + TBOX_ASSERT(dst_node.getLocalId() >= 0); + TBOX_ASSERT(src_node.getLocalId() >= 0); + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); return allocate(dst_level, src_level, overlap, dst_node, src_node, - ritem_id, + refine_data, + item_id, hier::Box::getEmptyBox(dst_level->getDim()), false); } @@ -142,8 +129,9 @@ OuteredgeSumTransactionFactory::preprocessScratchSpace( for (int n = 0; n < ncomponents; ++n) { if (preprocess_vector.isSet(n)) { boost::shared_ptr > oedge_data( - patch->getPatchData(n), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(n))); + TBOX_ASSERT(oedge_data); oedge_data->fillAll(0.0); } } @@ -153,4 +141,3 @@ OuteredgeSumTransactionFactory::preprocessScratchSpace( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.h index 9e72352b..f7602891 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuteredgeSumTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory for creating outeredge sum transaction objects * ************************************************************************/ @@ -17,14 +17,15 @@ #include "SAMRAI/xfer/RefineClasses.h" #include "SAMRAI/xfer/RefineTransactionFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace algs { /*! - * @brief Concrete subclass of the xfer::RefineTransactionFactory base class that - * allocates outeredge sum transaction objects for a xfer::RefineSchedule object. + * @brief Concrete subclass of the xfer::RefineTransactionFactory base class + * that allocates outeredge sum transaction objects for a xfer::RefineSchedule + * object. * * @see xfer::RefineTransactionFactory * @see xfer::OuteredgeSumTransaction @@ -43,35 +44,34 @@ class OuteredgeSumTransactionFactory:public xfer::RefineTransactionFactory */ virtual ~OuteredgeSumTransactionFactory(); - /*! - * @brief Set the array of xfer::RefineClass::Data items used by the transactions. - */ - void - setRefineItems( - const xfer::RefineClasses::Data ** refine_items, - int num_refine_items); - - /*! - * @brief Clear the array of xfer::RefineClass::Data items used by the transactions. - */ - void - unsetRefineItems(); - /*! * @brief Allocate an OuteredgeSumTransaction object. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. + * @param overlap boost::shared_ptr to overlap region between + * patches. * @param dst_node Destination Box in destination patch level. * @param src_node Source Box in source patch level. - * @param ritem_id Integer index of xfer::RefineClass::Data item + * @param refine_data Pointer to array of refine data items + * @param item_id Integer index of xfer::RefineClasses::Data item * associated with transaction. * @param box Optional const reference to box defining region of - * refine transaction. Use next method if not required. - * @param use_time_interpolation Optional boolean flag indicating whether the - * refine transaction involves time interpolation. + * refine transaction. Use next method if not + * required. + * @param use_time_interpolation Optional boolean flag indicating whether + * the refine transaction involves time interpolation. * Default is false. + * + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ boost::shared_ptr allocate( @@ -80,7 +80,8 @@ class OuteredgeSumTransactionFactory:public xfer::RefineTransactionFactory const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id, + const xfer::RefineClasses::Data ** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation = false) const; @@ -89,6 +90,16 @@ class OuteredgeSumTransactionFactory:public xfer::RefineTransactionFactory * * Same as previous allocate routine but with default empty box and no * timer interpolation. + * + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre ritem_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ boost::shared_ptr allocate( @@ -97,18 +108,22 @@ class OuteredgeSumTransactionFactory:public xfer::RefineTransactionFactory const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id) const; + const xfer::RefineClasses::Data ** refine_data, + int item_id) const; /*! * @brief Function to initialize scratch space data for the sum transactions * (patch data components indicated by the component selector) to zero. * - * @param level boost::shared_ptr to patch level holding scratch data. + * @param level boost::shared_ptr to patch level holding scratch + * data. * @param fill_time Double value of simulation time at which preprocess * operation is called. - * @param preprocess_vector Const reference to hier::ComponentSelector indicating - * patch data array indices of scratch patch data objects - * to preprocess. + * @param preprocess_vector Const reference to hier::ComponentSelector + * indicating patch data array indices of scratch patch + * data objects to preprocess. + * + * @pre level */ void preprocessScratchSpace( @@ -120,13 +135,10 @@ class OuteredgeSumTransactionFactory:public xfer::RefineTransactionFactory // The following two functions are not implemented OuteredgeSumTransactionFactory( const OuteredgeSumTransactionFactory&); - void + OuteredgeSumTransactionFactory& operator = ( const OuteredgeSumTransactionFactory&); - const xfer::RefineClasses::Data** d_refine_items; - int d_number_refine_items; - }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.C index b4c5551f..4be57175 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for summing outernode data * ************************************************************************/ - -#ifndef included_algs_OuternodeSumTransaction_C -#define included_algs_OuternodeSumTransaction_C - #include "SAMRAI/algs/OuternodeSumTransaction.h" #include "SAMRAI/hier/Patch.h" @@ -31,19 +27,6 @@ namespace SAMRAI { namespace algs { -/* - ************************************************************************* - * - * Initialization, set/unset functions for static array of refine items. - * - ************************************************************************* - */ - -const xfer::RefineClasses::Data ** -OuternodeSumTransaction::s_refine_items = - (const xfer::RefineClasses::Data **)NULL; -int OuternodeSumTransaction::s_num_refine_items = 0; - /* ************************************************************************* * @@ -58,13 +41,15 @@ OuternodeSumTransaction::OuternodeSumTransaction( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int refine_item_id): + const xfer::RefineClasses::Data** refine_data, + int item_id): d_dst_level(dst_level), d_src_level(src_level), d_overlap(overlap), d_dst_node(dst_node), d_src_node(src_node), - d_refine_item_id(refine_item_id), + d_refine_data(refine_data), + d_item_id(item_id), d_incoming_bytes(0), d_outgoing_bytes(0) { @@ -73,10 +58,10 @@ OuternodeSumTransaction::OuternodeSumTransaction( TBOX_ASSERT(overlap); TBOX_ASSERT(dst_node.getLocalId() >= 0); TBOX_ASSERT(src_node.getLocalId() >= 0); - TBOX_ASSERT(refine_item_id >= 0); - // Note: s_num_refine_items cannot be used at this point! + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); } OuternodeSumTransaction::~OuternodeSumTransaction() @@ -98,14 +83,12 @@ OuternodeSumTransaction::canEstimateIncomingMessageSize() if (getSourceProcessor() == d_src_level->getBoxLevel()->getMPI().getRank()) { can_estimate = d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) + ->getPatchData(d_refine_data[d_item_id]->d_src) ->canEstimateStreamSizeFromBox(); } else { can_estimate = d_dst_level->getPatch(d_dst_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) + ->getPatchData(d_refine_data[d_item_id]->d_scratch) ->canEstimateStreamSizeFromBox(); } return can_estimate; @@ -115,10 +98,9 @@ size_t OuternodeSumTransaction::computeIncomingMessageSize() { d_incoming_bytes = - d_dst_level->getPatch(d_dst_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) - ->getDataStreamSize(*d_overlap); + d_dst_level->getPatch(d_dst_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_scratch)-> + getDataStreamSize(*d_overlap); return d_incoming_bytes; } @@ -126,10 +108,9 @@ size_t OuternodeSumTransaction::computeOutgoingMessageSize() { d_outgoing_bytes = - d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) - ->getDataStreamSize(*d_overlap); + d_src_level->getPatch(d_src_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_src)-> + getDataStreamSize(*d_overlap); return d_outgoing_bytes; } @@ -149,10 +130,9 @@ void OuternodeSumTransaction::packStream( tbox::MessageStream& stream) { - d_src_level->getPatch(d_src_node.getGlobalId()) - ->getPatchData(s_refine_items[d_refine_item_id]-> - d_src) - ->packStream(stream, *d_overlap); + d_src_level->getPatch(d_src_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_src)-> + packStream(stream, *d_overlap); } void @@ -160,9 +140,9 @@ OuternodeSumTransaction::unpackStream( tbox::MessageStream& stream) { boost::shared_ptr > onode_dst_data( - d_dst_level->getPatch(d_dst_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_dst_level->getPatch(d_dst_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_scratch))); TBOX_ASSERT(onode_dst_data); onode_dst_data->unpackStreamAndSum(stream, *d_overlap); @@ -172,15 +152,15 @@ void OuternodeSumTransaction::copyLocalData() { boost::shared_ptr > onode_dst_data( - d_dst_level->getPatch(d_dst_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_dst_level->getPatch(d_dst_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_scratch))); TBOX_ASSERT(onode_dst_data); boost::shared_ptr > onode_src_data( - d_src_level->getPatch(d_src_node.getGlobalId())-> - getPatchData(s_refine_items[d_refine_item_id]->d_src), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + d_src_level->getPatch(d_src_node.getGlobalId())-> + getPatchData(d_refine_data[d_item_id]->d_src))); TBOX_ASSERT(onode_src_data); onode_dst_data->sum(*onode_src_data, *d_overlap); @@ -199,17 +179,15 @@ OuternodeSumTransaction::printClassData( std::ostream& stream) const { stream << "Outernode Sum Transaction" << std::endl; - stream << " refine item array: " - << (xfer::RefineClasses::Data **)s_refine_items + stream << " refine item: " + << (xfer::RefineClasses::Data *)d_refine_data[d_item_id] << std::endl; - stream << " num refine items: " << s_num_refine_items << std::endl; stream << " destination node: " << d_dst_node << std::endl; stream << " source node: " << d_src_node << std::endl; - stream << " refine item id: " << d_refine_item_id << std::endl; stream << " destination patch data: " - << s_refine_items[d_refine_item_id]->d_scratch << std::endl; + << d_refine_data[d_item_id]->d_scratch << std::endl; stream << " source patch data: " - << s_refine_items[d_refine_item_id]->d_src << std::endl; + << d_refine_data[d_item_id]->d_src << std::endl; stream << " incoming bytes: " << d_incoming_bytes << std::endl; stream << " outgoing bytes: " << d_outgoing_bytes << std::endl; stream << " destination level: " @@ -230,5 +208,3 @@ OuternodeSumTransaction::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.h index 89971f0b..b314f11c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for summing outernode data * ************************************************************************/ @@ -43,37 +43,6 @@ namespace algs { class OuternodeSumTransaction:public tbox::Transaction { public: - /*! - * Static member function to set the array of refine class data items that - * is shared by all object instances of this sum transaction class during - * data transfers. The array must be set before any transactions are - * executed. The array is set in the xfer::RefineSchedule class. - */ - static void - setRefineItems( - const xfer::RefineClasses::Data ** refine_items, - int num_refine_items) - { - TBOX_ASSERT(refine_items != (const xfer::RefineClasses::Data **)NULL); - TBOX_ASSERT(num_refine_items >= 0); - s_refine_items = refine_items; - s_num_refine_items = num_refine_items; - } - - /*! - * Static member function to unset the array of refine class data items that - * is shared by all object instances of this sum transaction class during - * data transfers. The unset function is used to prevent erroneous - * execution of different schedules. The array is unset in the - * RefineSchedule class. - */ - static void - unsetRefineItems() - { - s_refine_items = (const xfer::RefineClasses::Data **)NULL; - s_num_refine_items = 0; - } - /*! * Construct a transaction with the specified source and destination * levels, patches, and patch data components found in the refine class @@ -91,12 +60,20 @@ class OuternodeSumTransaction:public tbox::Transaction * patches. * @param dst_node Destination Box in destination patch level. * @param src_node Source Box in source patch level. - * @param refine_item_id Integer id of refine data item owned by refine + * @param refine_data Pointer to array of refine data items + * @param item_id Integer id of refine data item owned by refine * schedule. * - * When assertion checking is active, an assertion will result if any of the - * pointer arguments is null, or if any of the integer arguments is invalid - * (i.e., < 0). + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre refine_data != 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ OuternodeSumTransaction( const boost::shared_ptr& dst_level, @@ -104,7 +81,8 @@ class OuternodeSumTransaction:public tbox::Transaction const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int refine_item_id); + const xfer::RefineClasses::Data ** refine_data, + int item_id); /*! * The virtual destructor for the copy transaction releases all @@ -157,6 +135,8 @@ class OuternodeSumTransaction:public tbox::Transaction /*! * Unpack the transaction data from the message stream. + * + * @pre d_dst_level->getPatch(d_dst_node.getGlobalId())->getPatchData(d_refine_data[d_item_id]->d_scratch) is actually a boost::shared_ptr > */ virtual void unpackStream( @@ -164,6 +144,9 @@ class OuternodeSumTransaction:public tbox::Transaction /*! * Perform the local data copy for the transaction. + * + * @pre d_dst_level->getPatch(d_dst_node.getGlobalId())->getPatchData(d_refine_data[d_item_id]->d_scratch) is actually a boost::shared_ptr > + * @pre d_src_level->getPatch(d_src_node.getGlobalId())->getPatchData(d_refine_data[d_item_id]->d_src) is actually a boost::shared_ptr > */ virtual void copyLocalData(); @@ -178,21 +161,19 @@ class OuternodeSumTransaction:public tbox::Transaction private: OuternodeSumTransaction( const OuternodeSumTransaction&); // not implemented - void + OuternodeSumTransaction& operator = ( const OuternodeSumTransaction&); // not implemented - static const xfer::RefineClasses::Data** s_refine_items; - static int s_num_refine_items; - boost::shared_ptr d_dst_level; boost::shared_ptr d_src_level; boost::shared_ptr d_overlap; hier::Box d_dst_node; hier::Box d_src_node; - int d_refine_item_id; - int d_incoming_bytes; - int d_outgoing_bytes; + const xfer::RefineClasses::Data** d_refine_data; + int d_item_id; + size_t d_incoming_bytes; + size_t d_outgoing_bytes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.C index 947b91c3..5ca56d90 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory for creating outernode sum transaction objects * ************************************************************************/ - -#ifndef included_algs_OuternodeSumTransactionFactory_C -#define included_algs_OuternodeSumTransactionFactory_C - #include "SAMRAI/algs/OuternodeSumTransactionFactory.h" #include "SAMRAI/pdat/OuternodeData.h" #include "SAMRAI/algs/OuternodeSumTransaction.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace algs { @@ -37,31 +33,6 @@ OuternodeSumTransactionFactory::~OuternodeSumTransactionFactory() { } -/* - ************************************************************************* - * - * Set/unset information for transactions managed by this factory class. - * - ************************************************************************* - */ - -void OuternodeSumTransactionFactory::setRefineItems( - const xfer::RefineClasses::Data** refine_items, - int num_refine_items) -{ - OuternodeSumTransaction::setRefineItems(refine_items, - num_refine_items); - d_refine_items = refine_items; - d_number_refine_items = num_refine_items; -} - -void OuternodeSumTransactionFactory::unsetRefineItems() -{ - OuternodeSumTransaction::unsetRefineItems(); - d_refine_items = (const xfer::RefineClasses::Data **)NULL; - d_number_refine_items = 0; -} - /* ************************************************************************* * @@ -77,21 +48,29 @@ OuternodeSumTransactionFactory::allocate( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id, + const xfer::RefineClasses::Data** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation) const { NULL_USE(box); NULL_USE(use_time_interpolation); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT(dst_level); + TBOX_ASSERT(src_level); + TBOX_ASSERT(overlap); + TBOX_ASSERT(dst_node.getLocalId() >= 0); + TBOX_ASSERT(src_node.getLocalId() >= 0); + TBOX_ASSERT(refine_data != 0); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); return boost::make_shared(dst_level, - src_level, - overlap, - dst_node, - src_node, - ritem_id); + src_level, + overlap, + dst_node, + src_node, + refine_data, + item_id); } boost::shared_ptr @@ -101,16 +80,24 @@ OuternodeSumTransactionFactory::allocate( const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id) const + const xfer::RefineClasses::Data** refine_data, + int item_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, *src_level, dst_node, src_node); + TBOX_ASSERT(dst_level); + TBOX_ASSERT(src_level); + TBOX_ASSERT(overlap); + TBOX_ASSERT(dst_node.getLocalId() >= 0); + TBOX_ASSERT(src_node.getLocalId() >= 0); + TBOX_ASSERT(refine_data != 0); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, dst_node, src_node); return allocate(dst_level, src_level, overlap, dst_node, src_node, - ritem_id, + refine_data, + item_id, hier::Box(dst_level->getDim()), false); } @@ -139,8 +126,9 @@ void OuternodeSumTransactionFactory::preprocessScratchSpace( for (int n = 0; n < ncomponents; ++n) { if (preprocess_vector.isSet(n)) { boost::shared_ptr > onode_data( - patch->getPatchData(n), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(n))); + TBOX_ASSERT(onode_data); onode_data->fillAll(0.0); } } @@ -150,4 +138,3 @@ void OuternodeSumTransactionFactory::preprocessScratchSpace( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.h index 08394d07..7cdcbf9a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/OuternodeSumTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory for creating outernode sum transaction objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/xfer/RefineClasses.h" #include "SAMRAI/xfer/RefineTransactionFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace algs { @@ -47,16 +47,15 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory virtual ~OuternodeSumTransactionFactory(); /*! - * @brief Set the array of xfer::RefineClass::Data items used by the + * @brief Set the array of xfer::RefineClasses::Data items used by the * transactions. */ void setRefineItems( - const xfer::RefineClasses::Data ** refine_items, - int num_refine_items); + const xfer::RefineClasses::Data * const * refine_items); /*! - * @brief Clear the array of xfer::RefineClass::Data items used by the + * @brief Clear the array of xfer::RefineClasses::Data items used by the * transactions. */ void @@ -71,7 +70,8 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory * patches. * @param dst_node Destination Box in destination patch level. * @param src_node Source Box in source patch level. - * @param ritem_id Integer index of xfer::RefineClass::Data item + * @param refine_data Pointer to array of refine data items + * @param item_id Integer index of xfer::RefineClasses::Data item * associated with transaction. * @param box Const reference to box defining region of * refine transaction. Use following allocate method @@ -79,6 +79,16 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory * @param use_time_interpolation Optional boolean flag indicating whether * the refine transaction involves time interpolation. * Default is false. + * + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ boost::shared_ptr allocate( @@ -87,7 +97,8 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id, + const xfer::RefineClasses::Data ** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation = false) const; @@ -96,6 +107,16 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory * * Same as previous allocate routine but with default empty box and no * timer interpolation. + * + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_node.getLocalId() >= 0 + * @pre src_node.getLocalId() >= 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_node.getDim()) && + * (dst_level->getDim() == src_node.getDim()) */ boost::shared_ptr allocate( @@ -104,7 +125,8 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory const boost::shared_ptr& overlap, const hier::Box& dst_node, const hier::Box& src_node, - int ritem_id) const; + const xfer::RefineClasses::Data ** refine_data, + int item_id) const; /*! * @brief Function to initialize scratch space data for the sum transactions @@ -117,6 +139,8 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory * @param preprocess_vector Const reference to hier::ComponentSelector * indicating patch data array indices of scratch patch * data objects to preprocess. + * + * @pre level */ void preprocessScratchSpace( @@ -128,13 +152,10 @@ class OuternodeSumTransactionFactory:public xfer::RefineTransactionFactory // The following two functions are not implemented OuternodeSumTransactionFactory( const OuternodeSumTransactionFactory&); - void + OuternodeSumTransactionFactory& operator = ( const OuternodeSumTransactionFactory&); - const xfer::RefineClasses::Data** d_refine_items; - int d_number_refine_items; - }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.C index 62b180f3..2d009c01 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for summing edge data at patch boundaries * ************************************************************************/ - -#ifndef included_algs_PatchBoundaryEdgeSum_C -#define included_algs_PatchBoundaryEdgeSum_C - #include "SAMRAI/algs/PatchBoundaryEdgeSum.h" #include "SAMRAI/hier/VariableDatabase.h" @@ -22,7 +18,7 @@ #include "SAMRAI/xfer/RefinePatchStrategy.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace algs { @@ -37,12 +33,10 @@ namespace algs { int PatchBoundaryEdgeSum::s_instance_counter = 0; -tbox::Array > -PatchBoundaryEdgeSum::s_oedge_src_id_array = - tbox::Array >(0); -tbox::Array > -PatchBoundaryEdgeSum::s_oedge_dst_id_array = - tbox::Array >(0); +std::vector > PatchBoundaryEdgeSum::s_oedge_src_id_array = + std::vector >(0); +std::vector > PatchBoundaryEdgeSum::s_oedge_dst_id_array = + std::vector >(0); /* ************************************************************************* @@ -54,7 +48,7 @@ PatchBoundaryEdgeSum::s_oedge_dst_id_array = */ PatchBoundaryEdgeSum::PatchBoundaryEdgeSum( - const std::string& object_name) : + const std::string& object_name): d_setup_called(false), d_num_reg_sum(0), d_sum_transaction_factory(boost::make_shared()) @@ -63,7 +57,7 @@ PatchBoundaryEdgeSum::PatchBoundaryEdgeSum( d_object_name = object_name; - s_instance_counter++; + ++s_instance_counter; } /* @@ -78,13 +72,15 @@ PatchBoundaryEdgeSum::PatchBoundaryEdgeSum( PatchBoundaryEdgeSum::~PatchBoundaryEdgeSum() { - s_instance_counter--; + --s_instance_counter; if (s_instance_counter == 0) { - const int arr_length_depth = s_oedge_src_id_array.size(); - for (int id = 0; id < arr_length_depth; id++) { - const int arr_length_nvar = s_oedge_src_id_array[id].size(); + const int arr_length_depth = + static_cast(s_oedge_src_id_array.size()); + for (int id = 0; id < arr_length_depth; ++id) { + const int arr_length_nvar = + static_cast(s_oedge_src_id_array[id].size()); - for (int iv = 0; iv < arr_length_nvar; iv++) { + for (int iv = 0; iv < arr_length_nvar; ++iv) { if (s_oedge_src_id_array[id][iv] >= 0) { hier::VariableDatabase::getDatabase()-> @@ -97,14 +93,14 @@ PatchBoundaryEdgeSum::~PatchBoundaryEdgeSum() s_oedge_dst_id_array[id][iv]); } - s_oedge_src_id_array[id].resizeArray(0); - s_oedge_dst_id_array[id].resizeArray(0); + s_oedge_src_id_array[id].resize(0); + s_oedge_dst_id_array[id].resize(0); } } - s_oedge_src_id_array.resizeArray(0); - s_oedge_dst_id_array.resizeArray(0); + s_oedge_src_id_array.resize(0); + s_oedge_dst_id_array.resize(0); } } @@ -140,125 +136,118 @@ PatchBoundaryEdgeSum::registerSum( hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr > edge_factory( - var_db->getPatchDescriptor()->getPatchDataFactory(edge_data_id), - boost::detail::dynamic_cast_tag()); - - if (!edge_factory) { - - TBOX_ERROR("PatchBoundaryEdgeSum register error..." - << "\nobject named " << d_object_name - << "\n edge_data_id = " << edge_data_id - << " does not correspond to edge data of type double." << std::endl); + BOOST_CAST, hier::PatchDataFactory>( + var_db->getPatchDescriptor()->getPatchDataFactory(edge_data_id))); - } else { + TBOX_ASSERT(edge_factory); - const tbox::Dimension& dim(edge_factory->getDim()); + const tbox::Dimension& dim(edge_factory->getDim()); - static std::string tmp_oedge_src_variable_name( - "PatchBoundaryEdgeSum__internal-oedge-src"); - static std::string tmp_oedge_dst_variable_name( - "PatchBoundaryEdgeSum__internal-oedge-dst"); + static std::string tmp_oedge_src_variable_name( + "PatchBoundaryEdgeSum__internal-oedge-src"); + static std::string tmp_oedge_dst_variable_name( + "PatchBoundaryEdgeSum__internal-oedge-dst"); - const int reg_sum_id = d_num_reg_sum; + const int reg_sum_id = d_num_reg_sum; - d_num_reg_sum++; + ++d_num_reg_sum; - d_user_edge_data_id.resizeArray(d_num_reg_sum); - d_user_edge_data_id[reg_sum_id] = ID_UNDEFINED; - d_user_edge_depth.resizeArray(d_num_reg_sum); - d_user_edge_depth[reg_sum_id] = ID_UNDEFINED; - d_tmp_oedge_src_variable.resizeArray(d_num_reg_sum); - d_tmp_oedge_dst_variable.resizeArray(d_num_reg_sum); - d_oedge_src_id.resizeArray(d_num_reg_sum); - d_oedge_src_id[reg_sum_id] = ID_UNDEFINED; - d_oedge_dst_id.resizeArray(d_num_reg_sum); - d_oedge_dst_id[reg_sum_id] = ID_UNDEFINED; + d_user_edge_data_id.resize(d_num_reg_sum); + d_user_edge_data_id[reg_sum_id] = ID_UNDEFINED; + d_user_edge_depth.resize(d_num_reg_sum); + d_user_edge_depth[reg_sum_id] = ID_UNDEFINED; + d_tmp_oedge_src_variable.resize(d_num_reg_sum); + d_tmp_oedge_dst_variable.resize(d_num_reg_sum); + d_oedge_src_id.resize(d_num_reg_sum); + d_oedge_src_id[reg_sum_id] = ID_UNDEFINED; + d_oedge_dst_id.resize(d_num_reg_sum); + d_oedge_dst_id[reg_sum_id] = ID_UNDEFINED; - const int data_depth = edge_factory->getDepth(); - const int array_by_depth_size = data_depth + 1; + const int data_depth = edge_factory->getDepth(); + const int array_by_depth_size = data_depth + 1; - if (d_num_registered_data_by_depth.size() < array_by_depth_size) { - const int old_size = d_num_registered_data_by_depth.size(); - const int new_size = array_by_depth_size; + if (static_cast(d_num_registered_data_by_depth.size()) < + array_by_depth_size) { + const int old_size = + static_cast(d_num_registered_data_by_depth.size()); + const int new_size = array_by_depth_size; - d_num_registered_data_by_depth.resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - d_num_registered_data_by_depth[i] = 0; - } - } - - const int data_depth_id = d_num_registered_data_by_depth[data_depth]; - const int num_data_at_depth = data_depth_id + 1; - - if (s_oedge_src_id_array.size() < array_by_depth_size) { - s_oedge_src_id_array.resizeArray(array_by_depth_size); - s_oedge_dst_id_array.resizeArray(array_by_depth_size); + d_num_registered_data_by_depth.resize(new_size); + for (int i = old_size; i < new_size; ++i) { + d_num_registered_data_by_depth[i] = 0; } + } - if (s_oedge_src_id_array[data_depth].size() < num_data_at_depth) { - const int old_size = s_oedge_src_id_array[data_depth].size(); - const int new_size = num_data_at_depth; + const int data_depth_id = d_num_registered_data_by_depth[data_depth]; + const int num_data_at_depth = data_depth_id + 1; - s_oedge_src_id_array[data_depth].resizeArray(new_size); - s_oedge_dst_id_array[data_depth].resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - s_oedge_src_id_array[data_depth][i] = ID_UNDEFINED; - s_oedge_dst_id_array[data_depth][i] = ID_UNDEFINED; - } - } + if (static_cast(s_oedge_src_id_array.size()) < array_by_depth_size) { + s_oedge_src_id_array.resize(array_by_depth_size); + s_oedge_dst_id_array.resize(array_by_depth_size); + } - std::string var_suffix = tbox::Utilities::intToString(data_depth_id, 4) - + "__depth=" + tbox::Utilities::intToString(data_depth); - - std::string toedge_src_var_name = tmp_oedge_src_variable_name - + var_suffix; - d_tmp_oedge_src_variable[reg_sum_id] = var_db->getVariable( - toedge_src_var_name); - if (!d_tmp_oedge_src_variable[reg_sum_id]) { - d_tmp_oedge_src_variable[reg_sum_id].reset( - new pdat::OuteredgeVariable(dim, - toedge_src_var_name, - data_depth)); + if (static_cast(s_oedge_src_id_array[data_depth].size()) < + num_data_at_depth) { + const int old_size = + static_cast(s_oedge_src_id_array[data_depth].size()); + const int new_size = num_data_at_depth; + + s_oedge_src_id_array[data_depth].resize(new_size); + s_oedge_dst_id_array[data_depth].resize(new_size); + for (int i = old_size; i < new_size; ++i) { + s_oedge_src_id_array[data_depth][i] = ID_UNDEFINED; + s_oedge_dst_id_array[data_depth][i] = ID_UNDEFINED; } + } - std::string toedge_dst_var_name = tmp_oedge_dst_variable_name - + var_suffix; - d_tmp_oedge_dst_variable[reg_sum_id] = var_db->getVariable( - toedge_dst_var_name); - if (!d_tmp_oedge_dst_variable[reg_sum_id]) { - d_tmp_oedge_dst_variable[reg_sum_id].reset( - new pdat::OuteredgeVariable(dim, - toedge_dst_var_name, - data_depth)); - } + std::string var_suffix = tbox::Utilities::intToString(data_depth_id, 4) + + "__depth=" + tbox::Utilities::intToString(data_depth); + + std::string toedge_src_var_name = tmp_oedge_src_variable_name + var_suffix; + d_tmp_oedge_src_variable[reg_sum_id] = var_db->getVariable( + toedge_src_var_name); + if (!d_tmp_oedge_src_variable[reg_sum_id]) { + d_tmp_oedge_src_variable[reg_sum_id].reset( + new pdat::OuteredgeVariable(dim, + toedge_src_var_name, + data_depth)); + } - if (s_oedge_src_id_array[data_depth][data_depth_id] < 0) { - s_oedge_src_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_oedge_src_variable[reg_sum_id], - hier::IntVector::getZero(dim)); - } - if (s_oedge_dst_id_array[data_depth][data_depth_id] < 0) { - s_oedge_dst_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_oedge_dst_variable[reg_sum_id], - hier::IntVector::getZero(dim)); - } + std::string toedge_dst_var_name = tmp_oedge_dst_variable_name + var_suffix; + d_tmp_oedge_dst_variable[reg_sum_id] = var_db->getVariable( + toedge_dst_var_name); + if (!d_tmp_oedge_dst_variable[reg_sum_id]) { + d_tmp_oedge_dst_variable[reg_sum_id].reset( + new pdat::OuteredgeVariable(dim, + toedge_dst_var_name, + data_depth)); + } - d_user_edge_data_id[reg_sum_id] = edge_data_id; - d_user_edge_depth[reg_sum_id] = data_depth; + if (s_oedge_src_id_array[data_depth][data_depth_id] < 0) { + s_oedge_src_id_array[data_depth][data_depth_id] = + var_db->registerInternalSAMRAIVariable( + d_tmp_oedge_src_variable[reg_sum_id], + hier::IntVector::getZero(dim)); + } + if (s_oedge_dst_id_array[data_depth][data_depth_id] < 0) { + s_oedge_dst_id_array[data_depth][data_depth_id] = + var_db->registerInternalSAMRAIVariable( + d_tmp_oedge_dst_variable[reg_sum_id], + hier::IntVector::getZero(dim)); + } - d_num_registered_data_by_depth[data_depth] = num_data_at_depth; + d_user_edge_data_id[reg_sum_id] = edge_data_id; + d_user_edge_depth[reg_sum_id] = data_depth; - d_oedge_src_id[reg_sum_id] = - s_oedge_src_id_array[data_depth][data_depth_id]; - d_oedge_dst_id[reg_sum_id] = - s_oedge_dst_id_array[data_depth][data_depth_id]; + d_num_registered_data_by_depth[data_depth] = num_data_at_depth; - d_oedge_src_data_set.setFlag(d_oedge_src_id[reg_sum_id]); - d_oedge_dst_data_set.setFlag(d_oedge_dst_id[reg_sum_id]); + d_oedge_src_id[reg_sum_id] = + s_oedge_src_id_array[data_depth][data_depth_id]; + d_oedge_dst_id[reg_sum_id] = + s_oedge_dst_id_array[data_depth][data_depth_id]; - } + d_oedge_src_data_set.setFlag(d_oedge_src_id[reg_sum_id]); + d_oedge_dst_data_set.setFlag(d_oedge_dst_id[reg_sum_id]); } @@ -277,16 +266,14 @@ PatchBoundaryEdgeSum::setupSum( { TBOX_ASSERT(level); - const tbox::Dimension& dim(level->getDim()); - d_setup_called = true; d_level = level; // Communication algorithm for summing outeredge values on a level - xfer::RefineAlgorithm single_level_sum_algorithm(dim); + xfer::RefineAlgorithm single_level_sum_algorithm; - for (int i = 0; i < d_num_reg_sum; i++) { + for (int i = 0; i < d_num_reg_sum; ++i) { single_level_sum_algorithm.registerRefine(d_oedge_dst_id[i], // dst data d_oedge_src_id[i], // src data d_oedge_dst_id[i], // scratch data @@ -296,7 +283,7 @@ PatchBoundaryEdgeSum::setupSum( d_single_level_sum_schedule = single_level_sum_algorithm.createSchedule( d_level, - (xfer::RefinePatchStrategy *)NULL, + 0, d_sum_transaction_factory); } @@ -345,13 +332,17 @@ PatchBoundaryEdgeSum::doLevelSum( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - for (int i = 0; i < d_user_edge_data_id.size(); i++) { + int array_size = static_cast(d_user_edge_data_id.size()); + for (int i = 0; i < array_size; ++i) { boost::shared_ptr > edge_data( - patch->getPatchData(d_user_edge_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_user_edge_data_id[i]))); boost::shared_ptr > oedge_data( - patch->getPatchData(d_oedge_src_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_oedge_src_id[i]))); + + TBOX_ASSERT(edge_data); + TBOX_ASSERT(oedge_data); oedge_data->copy(*edge_data); @@ -364,13 +355,17 @@ PatchBoundaryEdgeSum::doLevelSum( ip2 != level->end(); ++ip2) { const boost::shared_ptr& patch = *ip2; - for (int i = 0; i < d_user_edge_data_id.size(); i++) { + int array_size = static_cast(d_user_edge_data_id.size()); + for (int i = 0; i < array_size; ++i) { boost::shared_ptr > edge_data( - patch->getPatchData(d_user_edge_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_user_edge_data_id[i]))); boost::shared_ptr > oedge_data( - patch->getPatchData(d_oedge_dst_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_oedge_dst_id[i]))); + + TBOX_ASSERT(edge_data); + TBOX_ASSERT(oedge_data); oedge_data->copy2(*edge_data); @@ -381,5 +376,3 @@ PatchBoundaryEdgeSum::doLevelSum( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.h index a2df2e85..ebe5d404 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryEdgeSum.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for summing edge data at patch boundaries * ************************************************************************/ @@ -20,8 +20,9 @@ #include "SAMRAI/xfer/RefineTransactionFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace algs { @@ -112,8 +113,9 @@ class PatchBoundaryEdgeSum * state. * * @param object_name const std::string reference for name of object used - * in error reporting. When assertion checking is on, the string - * cannot be empty. + * in error reporting. + * + * @pre !object_name.empty() */ explicit PatchBoundaryEdgeSum( const std::string& object_name); @@ -128,8 +130,9 @@ class PatchBoundaryEdgeSum * * @param edge_data_id integer patch data index for edge data to sum * - * The edge data id must be a valid patch data id (>=0) and must - * correspond to edge-centered double data. If not, an error will result. + * @pre !d_setup_called + * @pre edge_data_id >= 0 + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(edge_data_id) is actually a boost::shared_ptr > */ void registerSum( @@ -141,7 +144,7 @@ class PatchBoundaryEdgeSum * * @param level pointer to level on which to perform edge sum * - * When assertion checking is active, the level pointer cannot be null. + * @pre level */ void setupSum( @@ -183,8 +186,8 @@ class PatchBoundaryEdgeSum */ static int s_instance_counter; // These arrays are indexed [data depth][number of variables with depth] - static tbox::Array > s_oedge_src_id_array; - static tbox::Array > s_oedge_dst_id_array; + static std::vector > s_oedge_src_id_array; + static std::vector > s_oedge_dst_id_array; enum PATCH_BDRY_EDGE_SUM_DATA_ID { ID_UNDEFINED = -1 }; @@ -194,23 +197,23 @@ class PatchBoundaryEdgeSum int d_num_reg_sum; // These arrays are indexed [variable registration sequence number] - tbox::Array d_user_edge_data_id; - tbox::Array d_user_edge_depth; + std::vector d_user_edge_data_id; + std::vector d_user_edge_depth; // These arrays are indexed [data depth] - tbox::Array d_num_registered_data_by_depth; + std::vector d_num_registered_data_by_depth; /* * Edge-centered variables and patch data indices used as internal work * quantities. */ // These arrays are indexed [variable registration sequence number] - tbox::Array > d_tmp_oedge_src_variable; - tbox::Array > d_tmp_oedge_dst_variable; + std::vector > d_tmp_oedge_src_variable; + std::vector > d_tmp_oedge_dst_variable; // These arrays are indexed [variable registration sequence number] - tbox::Array d_oedge_src_id; - tbox::Array d_oedge_dst_id; + std::vector d_oedge_src_id; + std::vector d_oedge_dst_id; /* * Sets of indices for temporary variables to expedite allocation and diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.C index 493b5b2e..a8d38fbb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for summing node data at patch boundaries * ************************************************************************/ - -#ifndef included_algs_PatchBoundaryNodeSum_C -#define included_algs_PatchBoundaryNodeSum_C - #include "SAMRAI/algs/PatchBoundaryNodeSum.h" #include "SAMRAI/hier/VariableDatabase.h" @@ -18,7 +14,7 @@ #include "SAMRAI/pdat/NodeDataFactory.h" #include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/pdat/OuternodeData.h" -#include "SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h" +#include "SAMRAI/pdat/OuternodeDoubleInjection.h" #include "SAMRAI/algs/OuternodeSumTransactionFactory.h" #include "SAMRAI/xfer/CoarsenAlgorithm.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" @@ -27,7 +23,7 @@ #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" /* ************************************************************************* @@ -45,7 +41,7 @@ extern "C" { #endif // in algs_nodeouternodeops2d.f: -void F77_FUNC(nodeouternodesum2d, NODEOUTERNODESUM2D) ( +void SAMRAI_F77_FUNC(nodeouternodesum2d, NODEOUTERNODESUM2D) ( const int&, const int&, // fine patch lo const int&, const int&, // fine patch hi const int&, const int&, // coarse patch lo @@ -57,7 +53,7 @@ void F77_FUNC(nodeouternodesum2d, NODEOUTERNODESUM2D) ( const double *, const double *, // onode arrays const double *, const double *); -void F77_FUNC(nodehangnodeinterp2d, NODEHANGNODEINTERP2D) ( +void SAMRAI_F77_FUNC(nodehangnodeinterp2d, NODEHANGNODEINTERP2D) ( const int&, const int&, // fine patch lo const int&, const int&, // fine patch hi const int&, const int&, // coarse patch lo @@ -71,7 +67,7 @@ void F77_FUNC(nodehangnodeinterp2d, NODEHANGNODEINTERP2D) ( double *); // node array // in algs_nodeouternodeops3d.f: -void F77_FUNC(nodeouternodesum3d, NODEOUTERNODESUM3D) ( +void SAMRAI_F77_FUNC(nodeouternodesum3d, NODEOUTERNODESUM3D) ( const int&, const int&, const int&, // fine patch lo const int&, const int&, const int&, // fine patch hi const int&, const int&, const int&, // coarse patch lo @@ -84,7 +80,7 @@ void F77_FUNC(nodeouternodesum3d, NODEOUTERNODESUM3D) ( const double *, const double *, const double *, const double *); -void F77_FUNC(nodehangnodeinterp3d, NODEHANGNODEINTERP3D) ( +void SAMRAI_F77_FUNC(nodehangnodeinterp3d, NODEHANGNODEINTERP3D) ( const int&, const int&, const int&, // fine patch lo const int&, const int&, const int&, // fine patch hi const int&, const int&, const int&, // coarse patch lo @@ -111,12 +107,10 @@ namespace algs { int PatchBoundaryNodeSum::s_instance_counter = 0; -tbox::Array > -PatchBoundaryNodeSum::s_onode_src_id_array = - tbox::Array >(0); -tbox::Array > -PatchBoundaryNodeSum::s_onode_dst_id_array = - tbox::Array >(0); +std::vector > PatchBoundaryNodeSum::s_onode_src_id_array = + std::vector >(0); +std::vector > PatchBoundaryNodeSum::s_onode_dst_id_array = + std::vector >(0); /* ************************************************************************* @@ -128,7 +122,7 @@ PatchBoundaryNodeSum::s_onode_dst_id_array = */ PatchBoundaryNodeSum::PatchBoundaryNodeSum( - const std::string& object_name) : + const std::string& object_name): d_setup_called(false), d_num_reg_sum(0), d_coarsest_level(-1), @@ -141,7 +135,7 @@ PatchBoundaryNodeSum::PatchBoundaryNodeSum( d_object_name = object_name; - s_instance_counter++; + ++s_instance_counter; } /* @@ -156,14 +150,16 @@ PatchBoundaryNodeSum::PatchBoundaryNodeSum( PatchBoundaryNodeSum::~PatchBoundaryNodeSum() { - s_instance_counter--; + --s_instance_counter; if (s_instance_counter == 0) { - const int arr_length_depth = s_onode_src_id_array.size(); + const int arr_length_depth = + static_cast(s_onode_src_id_array.size()); - for (int id = 0; id < arr_length_depth; id++) { - const int arr_length_nvar = s_onode_src_id_array[id].size(); + for (int id = 0; id < arr_length_depth; ++id) { + const int arr_length_nvar = + static_cast(s_onode_src_id_array[id].size()); - for (int iv = 0; iv < arr_length_nvar; iv++) { + for (int iv = 0; iv < arr_length_nvar; ++iv) { if (s_onode_src_id_array[id][iv] >= 0) { hier::VariableDatabase::getDatabase()-> @@ -176,15 +172,15 @@ PatchBoundaryNodeSum::~PatchBoundaryNodeSum() s_onode_dst_id_array[id][iv]); } - s_onode_src_id_array[id].resizeArray(0); - s_onode_dst_id_array[id].resizeArray(0); + s_onode_src_id_array[id].resize(0); + s_onode_dst_id_array[id].resize(0); } } - s_onode_src_id_array.resizeArray(0); - s_onode_dst_id_array.resizeArray(0); + s_onode_src_id_array.resize(0); + s_onode_dst_id_array.resize(0); } @@ -222,125 +218,118 @@ PatchBoundaryNodeSum::registerSum( hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr > node_factory( - var_db->getPatchDescriptor()->getPatchDataFactory(node_data_id), - boost::detail::dynamic_cast_tag()); - - if (!node_factory) { - - TBOX_ERROR("PatchBoundaryNodeSum register error..." - << "\nobject named " << d_object_name - << "\n node_data_id = " << node_data_id - << " does not correspond to node data of type double." << std::endl); - - } else { + BOOST_CAST, hier::PatchDataFactory>( + var_db->getPatchDescriptor()->getPatchDataFactory(node_data_id))); - const tbox::Dimension& dim(node_factory->getDim()); + TBOX_ASSERT(node_factory); - static std::string tmp_onode_src_variable_name( - "PatchBoundaryNodeSum__internal-onode-src"); - static std::string tmp_onode_dst_variable_name( - "PatchBoundaryNodeSum__internal-onode-dst"); + const tbox::Dimension& dim(node_factory->getDim()); - const int reg_sum_id = d_num_reg_sum; + static std::string tmp_onode_src_variable_name( + "PatchBoundaryNodeSum__internal-onode-src"); + static std::string tmp_onode_dst_variable_name( + "PatchBoundaryNodeSum__internal-onode-dst"); - d_num_reg_sum++; + const int reg_sum_id = d_num_reg_sum; - d_user_node_data_id.resizeArray(d_num_reg_sum); - d_user_node_data_id[reg_sum_id] = ID_UNDEFINED; - d_user_node_depth.resizeArray(d_num_reg_sum); - d_user_node_depth[reg_sum_id] = ID_UNDEFINED; - d_tmp_onode_src_variable.resizeArray(d_num_reg_sum); - d_tmp_onode_dst_variable.resizeArray(d_num_reg_sum); - d_onode_src_id.resizeArray(d_num_reg_sum); - d_onode_src_id[reg_sum_id] = ID_UNDEFINED; - d_onode_dst_id.resizeArray(d_num_reg_sum); - d_onode_dst_id[reg_sum_id] = ID_UNDEFINED; + ++d_num_reg_sum; - const int data_depth = node_factory->getDepth(); - const int array_by_depth_size = data_depth + 1; + d_user_node_data_id.resize(d_num_reg_sum); + d_user_node_data_id[reg_sum_id] = ID_UNDEFINED; + d_user_node_depth.resize(d_num_reg_sum); + d_user_node_depth[reg_sum_id] = ID_UNDEFINED; + d_tmp_onode_src_variable.resize(d_num_reg_sum); + d_tmp_onode_dst_variable.resize(d_num_reg_sum); + d_onode_src_id.resize(d_num_reg_sum); + d_onode_src_id[reg_sum_id] = ID_UNDEFINED; + d_onode_dst_id.resize(d_num_reg_sum); + d_onode_dst_id[reg_sum_id] = ID_UNDEFINED; - if (d_num_registered_data_by_depth.size() < array_by_depth_size) { - const int old_size = d_num_registered_data_by_depth.size(); - const int new_size = array_by_depth_size; - - d_num_registered_data_by_depth.resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - d_num_registered_data_by_depth[i] = 0; - } - } + const int data_depth = node_factory->getDepth(); + const int array_by_depth_size = data_depth + 1; - const int data_depth_id = d_num_registered_data_by_depth[data_depth]; - const int num_data_at_depth = data_depth_id + 1; + if (static_cast(d_num_registered_data_by_depth.size()) < + array_by_depth_size) { + const int old_size = + static_cast(d_num_registered_data_by_depth.size()); + const int new_size = array_by_depth_size; - if (s_onode_src_id_array.size() < array_by_depth_size) { - s_onode_src_id_array.resizeArray(array_by_depth_size); - s_onode_dst_id_array.resizeArray(array_by_depth_size); + d_num_registered_data_by_depth.resize(new_size); + for (int i = old_size; i < new_size; ++i) { + d_num_registered_data_by_depth[i] = 0; } + } - if (s_onode_src_id_array[data_depth].size() < num_data_at_depth) { - const int old_size = s_onode_src_id_array[data_depth].size(); - const int new_size = num_data_at_depth; + const int data_depth_id = d_num_registered_data_by_depth[data_depth]; + const int num_data_at_depth = data_depth_id + 1; - s_onode_src_id_array[data_depth].resizeArray(new_size); - s_onode_dst_id_array[data_depth].resizeArray(new_size); - for (int i = old_size; i < new_size; i++) { - s_onode_src_id_array[data_depth][i] = ID_UNDEFINED; - s_onode_dst_id_array[data_depth][i] = ID_UNDEFINED; - } - } + if (static_cast(s_onode_src_id_array.size()) < array_by_depth_size) { + s_onode_src_id_array.resize(array_by_depth_size); + s_onode_dst_id_array.resize(array_by_depth_size); + } - std::string var_suffix = tbox::Utilities::intToString(data_depth_id, 4) - + "__depth=" + tbox::Utilities::intToString(data_depth); - - std::string tonode_src_var_name = tmp_onode_src_variable_name - + var_suffix; - d_tmp_onode_src_variable[reg_sum_id] = var_db->getVariable( - tonode_src_var_name); - if (!d_tmp_onode_src_variable[reg_sum_id]) { - d_tmp_onode_src_variable[reg_sum_id].reset( - new pdat::OuternodeVariable(dim, - tonode_src_var_name, - data_depth)); + if (static_cast(s_onode_src_id_array[data_depth].size()) < + num_data_at_depth) { + const int old_size = + static_cast(s_onode_src_id_array[data_depth].size()); + const int new_size = num_data_at_depth; + + s_onode_src_id_array[data_depth].resize(new_size); + s_onode_dst_id_array[data_depth].resize(new_size); + for (int i = old_size; i < new_size; ++i) { + s_onode_src_id_array[data_depth][i] = ID_UNDEFINED; + s_onode_dst_id_array[data_depth][i] = ID_UNDEFINED; } + } - std::string tonode_dst_var_name = tmp_onode_dst_variable_name - + var_suffix; - d_tmp_onode_dst_variable[reg_sum_id] = var_db->getVariable( - tonode_dst_var_name); - if (!d_tmp_onode_dst_variable[reg_sum_id]) { - d_tmp_onode_dst_variable[reg_sum_id].reset( - new pdat::OuternodeVariable(dim, - tonode_dst_var_name, - data_depth)); - } + std::string var_suffix = tbox::Utilities::intToString(data_depth_id, 4) + + "__depth=" + tbox::Utilities::intToString(data_depth); + + std::string tonode_src_var_name = tmp_onode_src_variable_name + var_suffix; + d_tmp_onode_src_variable[reg_sum_id] = var_db->getVariable( + tonode_src_var_name); + if (!d_tmp_onode_src_variable[reg_sum_id]) { + d_tmp_onode_src_variable[reg_sum_id].reset( + new pdat::OuternodeVariable(dim, + tonode_src_var_name, + data_depth)); + } - if (s_onode_src_id_array[data_depth][data_depth_id] < 0) { - s_onode_src_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_onode_src_variable[reg_sum_id], - hier::IntVector::getZero(dim)); - } - if (s_onode_dst_id_array[data_depth][data_depth_id] < 0) { - s_onode_dst_id_array[data_depth][data_depth_id] = - var_db->registerInternalSAMRAIVariable( - d_tmp_onode_dst_variable[reg_sum_id], - hier::IntVector::getZero(dim)); - } + std::string tonode_dst_var_name = tmp_onode_dst_variable_name + var_suffix; + d_tmp_onode_dst_variable[reg_sum_id] = var_db->getVariable( + tonode_dst_var_name); + if (!d_tmp_onode_dst_variable[reg_sum_id]) { + d_tmp_onode_dst_variable[reg_sum_id].reset( + new pdat::OuternodeVariable(dim, + tonode_dst_var_name, + data_depth)); + } - d_user_node_data_id[reg_sum_id] = node_data_id; - d_user_node_depth[reg_sum_id] = data_depth; + if (s_onode_src_id_array[data_depth][data_depth_id] < 0) { + s_onode_src_id_array[data_depth][data_depth_id] = + var_db->registerInternalSAMRAIVariable( + d_tmp_onode_src_variable[reg_sum_id], + hier::IntVector::getZero(dim)); + } + if (s_onode_dst_id_array[data_depth][data_depth_id] < 0) { + s_onode_dst_id_array[data_depth][data_depth_id] = + var_db->registerInternalSAMRAIVariable( + d_tmp_onode_dst_variable[reg_sum_id], + hier::IntVector::getZero(dim)); + } - d_num_registered_data_by_depth[data_depth] = num_data_at_depth; + d_user_node_data_id[reg_sum_id] = node_data_id; + d_user_node_depth[reg_sum_id] = data_depth; - d_onode_src_id[reg_sum_id] = - s_onode_src_id_array[data_depth][data_depth_id]; - d_onode_dst_id[reg_sum_id] = - s_onode_dst_id_array[data_depth][data_depth_id]; + d_num_registered_data_by_depth[data_depth] = num_data_at_depth; - d_onode_src_data_set.setFlag(d_onode_src_id[reg_sum_id]); - d_onode_dst_data_set.setFlag(d_onode_dst_id[reg_sum_id]); + d_onode_src_id[reg_sum_id] = + s_onode_src_id_array[data_depth][data_depth_id]; + d_onode_dst_id[reg_sum_id] = + s_onode_dst_id_array[data_depth][data_depth_id]; - } + d_onode_src_data_set.setFlag(d_onode_src_id[reg_sum_id]); + d_onode_dst_data_set.setFlag(d_onode_dst_id[reg_sum_id]); } @@ -359,8 +348,6 @@ PatchBoundaryNodeSum::setupSum( { TBOX_ASSERT(level); - const tbox::Dimension& dim(level->getDim()); - if (d_hierarchy_setup_called) { TBOX_ERROR("PatchBoundaryNodeSum::setupSum error...\n" @@ -374,12 +361,12 @@ PatchBoundaryNodeSum::setupSum( d_level = level; - d_single_level_sum_schedule.resizeArray(1); + d_single_level_sum_schedule.resize(1); // Communication algorithm for summing outernode values on a level - xfer::RefineAlgorithm single_level_sum_algorithm(dim); + xfer::RefineAlgorithm single_level_sum_algorithm; - for (int i = 0; i < d_num_reg_sum; i++) { + for (int i = 0; i < d_num_reg_sum; ++i) { single_level_sum_algorithm.registerRefine(d_onode_dst_id[i], // dst data d_onode_src_id[i], // src data d_onode_dst_id[i], // scratch data @@ -389,7 +376,7 @@ PatchBoundaryNodeSum::setupSum( d_single_level_sum_schedule[0] = single_level_sum_algorithm.createSchedule( d_level, - (xfer::RefinePatchStrategy *)NULL, + 0, d_sum_transaction_factory); } @@ -435,28 +422,28 @@ PatchBoundaryNodeSum::setupSum( const int num_levels = d_finest_level + 1; - d_single_level_sum_schedule.resizeArray(num_levels); - d_cfbdry_copy_schedule.resizeArray(num_levels); - d_sync_coarsen_schedule.resizeArray(num_levels); - d_cfbdry_tmp_level.resizeArray(num_levels); + d_single_level_sum_schedule.resize(num_levels); + d_cfbdry_copy_schedule.resize(num_levels); + d_sync_coarsen_schedule.resize(num_levels); + d_cfbdry_tmp_level.resize(num_levels); - d_coarse_fine_boundary.resizeArray(num_levels); + d_coarse_fine_boundary.resize(num_levels); // Communication algorithm for summing outernode values on each level - xfer::RefineAlgorithm single_level_sum_algorithm(dim); + xfer::RefineAlgorithm single_level_sum_algorithm; // Communication algorithm for copying node values on each coarser // level to outernode values on coarsened version of patches on // next finer level - xfer::RefineAlgorithm cfbdry_copy_algorithm(dim); + xfer::RefineAlgorithm cfbdry_copy_algorithm; // Communication algorithm for coarsening outernode values on // each finer level to node data on next coarser level xfer::CoarsenAlgorithm sync_coarsen_algorithm(dim, false); - boost::shared_ptr coarsen_op( - boost::make_shared(dim)); + boost::shared_ptr coarsen_op( + boost::make_shared()); - for (int i = 0; i < d_num_reg_sum; i++) { + for (int i = 0; i < d_num_reg_sum; ++i) { single_level_sum_algorithm.registerRefine(d_onode_dst_id[i], // dst data d_onode_src_id[i], // src data d_onode_dst_id[i], // scratch data @@ -475,10 +462,10 @@ PatchBoundaryNodeSum::setupSum( d_single_level_sum_schedule[d_coarsest_level] = single_level_sum_algorithm.createSchedule( d_hierarchy->getPatchLevel(d_coarsest_level), - (xfer::RefinePatchStrategy *)NULL, + 0, d_sum_transaction_factory); - for (int ln = d_coarsest_level + 1; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level + 1; ln <= d_finest_level; ++ln) { const int crse_level_num = ln - 1; const int fine_level_num = ln; @@ -491,36 +478,33 @@ PatchBoundaryNodeSum::setupSum( d_single_level_sum_schedule[fine_level_num] = single_level_sum_algorithm.createSchedule( fine_level, - (xfer::RefinePatchStrategy *)NULL, + 0, d_sum_transaction_factory); d_cfbdry_tmp_level[fine_level_num].reset(new hier::PatchLevel(dim)); d_cfbdry_tmp_level[fine_level_num]-> - setCoarsenedPatchLevel(fine_level, - fine_level->getRatioToCoarserLevel()); + setCoarsenedPatchLevel(fine_level, + fine_level->getRatioToCoarserLevel()); hier::IntVector crse_tmp_gcw = - d_hierarchy->getConnector(crse_level_num, - fine_level_num).getConnectorWidth(); + d_hierarchy->getPatchLevel(crse_level_num)->findConnector( + *d_hierarchy->getPatchLevel(fine_level_num), + d_hierarchy->getRequiredConnectorWidth(crse_level_num, fine_level_num, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false).getConnectorWidth(); // Create persistent overlap Connectors for use in schedule construction. - // FIXME: There are faster ways to get these edges. BTNG. - d_cfbdry_tmp_level[fine_level_num]->getBoxLevel()-> - getPersistentOverlapConnectors().createConnector( - *crse_level->getBoxLevel(), - crse_tmp_gcw); - crse_level->getBoxLevel()->getPersistentOverlapConnectors(). - createConnector( - *d_cfbdry_tmp_level[fine_level_num]->getBoxLevel(), - crse_tmp_gcw); + // TODO: There are faster ways to get these edges. BTNG. + d_cfbdry_tmp_level[fine_level_num]->createConnectorWithTranspose( + *crse_level, + crse_tmp_gcw, + crse_tmp_gcw); const hier::Connector& crse_to_domain = - d_cfbdry_tmp_level[fine_level_num]->getBoxLevel()-> - getPersistentOverlapConnectors().createConnector( - d_hierarchy->getDomainBoxLevel(), - hier::IntVector::getZero(dim)); + d_cfbdry_tmp_level[fine_level_num]->getBoxLevel()->createConnector( + d_hierarchy->getDomainBoxLevel(), + hier::IntVector::getZero(dim)); const hier::Connector& crse_to_crse = - d_cfbdry_tmp_level[fine_level_num]->getBoxLevel()-> - getPersistentOverlapConnectors().createConnector( - *d_cfbdry_tmp_level[fine_level_num]->getBoxLevel(), - hier::IntVector::getOne(dim)); + d_cfbdry_tmp_level[fine_level_num]->createConnector( + *d_cfbdry_tmp_level[fine_level_num], + hier::IntVector::getOne(dim)); d_cfbdry_copy_schedule[fine_level_num] = cfbdry_copy_algorithm.createSchedule( @@ -538,11 +522,6 @@ PatchBoundaryNodeSum::setupSum( crse_to_domain, crse_to_crse, hier::IntVector::getOne(dim))); -#if 1 - tbox::plog << "PatchBoundaryNodeSum::d_coarse_fine_boundary[" - << fine_level_num << "]:" << std::endl; - d_coarse_fine_boundary[fine_level_num]->printClassData(tbox::plog); -#endif } @@ -598,7 +577,7 @@ PatchBoundaryNodeSum::computeSum( int ln; - for (ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -610,7 +589,7 @@ PatchBoundaryNodeSum::computeSum( } - for (ln = d_coarsest_level + 1; ln <= d_finest_level; ln++) { + for (ln = d_coarsest_level + 1; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -629,7 +608,7 @@ PatchBoundaryNodeSum::computeSum( } - for (ln = d_finest_level; ln > d_coarsest_level; ln--) { + for (ln = d_finest_level; ln > d_coarsest_level; --ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -646,9 +625,9 @@ PatchBoundaryNodeSum::computeSum( } d_hierarchy->getPatchLevel(d_coarsest_level)-> - deallocatePatchData(d_onode_src_data_set); + deallocatePatchData(d_onode_src_data_set); d_hierarchy->getPatchLevel(d_coarsest_level)-> - deallocatePatchData(d_onode_dst_data_set); + deallocatePatchData(d_onode_dst_data_set); } // if d_hierarchy_setup_called @@ -704,20 +683,20 @@ void PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( const boost::shared_ptr& fine_level, const boost::shared_ptr& coarsened_fine_level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id, + const std::vector& node_data_id, + const std::vector& onode_data_id, bool fill_hanging_nodes) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(fine_level); TBOX_ASSERT(coarsened_fine_level); TBOX_ASSERT(node_data_id.size() == onode_data_id.size()); - for (int i = 0; i < node_data_id.size(); i++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (int i = 0; i < static_cast(node_data_id.size()); ++i) { TBOX_ASSERT(fine_level->checkAllocated(node_data_id[i])); TBOX_ASSERT(coarsened_fine_level->checkAllocated(onode_data_id[i])); } #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(*fine_level, *coarsened_fine_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*fine_level, *coarsened_fine_level); const tbox::Dimension& dim(fine_level->getDim()); @@ -727,9 +706,9 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( for (hier::PatchLevel::iterator ip(fine_level->begin()); ip != fine_level->end(); ++ip) { - const tbox::Array& pboundaries = + const std::vector& pboundaries = d_coarse_fine_boundary[level_number]->getBoundaries(ip->getGlobalId(), 1); - const int num_bdry_boxes = pboundaries.getSize(); + const int num_bdry_boxes = static_cast(pboundaries.size()); if (num_bdry_boxes > 0) { @@ -737,19 +716,25 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( boost::shared_ptr cfpatch( coarsened_fine_level->getPatch(fpatch->getGlobalId())); + const hier::IntVector& fpatch_ratio = ratio; + const hier::Index& filo = fpatch->getBox().lower(); const hier::Index& fihi = fpatch->getBox().upper(); const hier::Index& cilo = cfpatch->getBox().lower(); const hier::Index& cihi = cfpatch->getBox().upper(); - for (int i = 0; i < node_data_id.size(); i++) { + int node_data_id_size = static_cast(node_data_id.size()); + for (int i = 0; i < node_data_id_size; ++i) { boost::shared_ptr > node_data( - fpatch->getPatchData(node_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fpatch->getPatchData(node_data_id[i]))); boost::shared_ptr > onode_data( - cfpatch->getPatchData(onode_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + cfpatch->getPatchData(onode_data_id[i]))); + + TBOX_ASSERT(node_data); + TBOX_ASSERT(onode_data); const hier::IntVector& node_gcw(node_data->getGhostCellWidth()); @@ -759,7 +744,7 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( // Copy "coarse" node values on coarse-fine boundary to // temporary outernode data arrays. - for (int ibb0 = 0; ibb0 < num_bdry_boxes; ibb0++) { + for (int ibb0 = 0; ibb0 < num_bdry_boxes; ++ibb0) { const hier::BoundaryBox& bbox = pboundaries[ibb0]; const int bbox_loc = bbox.getLocationIndex(); @@ -933,53 +918,96 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( if ((dim == tbox::Dimension(2))) { - if (tmp_onode_data.getArrayData(0, 0).isInitialized() && - tmp_onode_data.getArrayData(0, 1).isInitialized() && - tmp_onode_data.getArrayData(1, 0).isInitialized() && - tmp_onode_data.getArrayData(1, 1).isInitialized()) { - - F77_FUNC(nodeouternodesum2d, NODEOUTERNODESUM2D) ( - filo(0), filo(1), - fihi(0), fihi(1), - cilo(0), cilo(1), - cihi(0), cihi(1), - &ratio[0], - node_data->getDepth(), - node_gcw(0), node_gcw(1), - node_data->getPointer(), // node data dst - tmp_onode_data.getPointer(0, 0), // x lower src - tmp_onode_data.getPointer(0, 1), // x upper src - tmp_onode_data.getPointer(1, 0), // y lower src - tmp_onode_data.getPointer(1, 1)); // y upper src + double* tmp_onode_data_ptr00, * tmp_onode_data_ptr01, + * tmp_onode_data_ptr10, * tmp_onode_data_ptr11; + if (tmp_onode_data.getArrayData(0, 0).isInitialized()) { + tmp_onode_data_ptr00 = tmp_onode_data.getPointer(0, 0); + } else { + tmp_onode_data_ptr00 = 0; + } + if (tmp_onode_data.getArrayData(0, 1).isInitialized()) { + tmp_onode_data_ptr01 = tmp_onode_data.getPointer(0, 1); + } else { + tmp_onode_data_ptr01 = 0; + } + if (tmp_onode_data.getArrayData(1, 0).isInitialized()) { + tmp_onode_data_ptr10 = tmp_onode_data.getPointer(1, 0); + } else { + tmp_onode_data_ptr10 = 0; } + if (tmp_onode_data.getArrayData(1, 1).isInitialized()) { + tmp_onode_data_ptr11 = tmp_onode_data.getPointer(1, 1); + } else { + tmp_onode_data_ptr11 = 0; + } + + SAMRAI_F77_FUNC(nodeouternodesum2d, NODEOUTERNODESUM2D) ( + filo(0), filo(1), + fihi(0), fihi(1), + cilo(0), cilo(1), + cihi(0), cihi(1), + &fpatch_ratio[0], + node_data->getDepth(), + node_gcw(0), node_gcw(1), + node_data->getPointer(), // node data dst + tmp_onode_data_ptr00, // x lower src + tmp_onode_data_ptr01, // x upper src + tmp_onode_data_ptr10, // y lower src + tmp_onode_data_ptr11); // y upper src } // (dim == tbox::Dimension(2)) if ((dim == tbox::Dimension(3))) { - if (tmp_onode_data.getArrayData(0, 0).isInitialized() && - tmp_onode_data.getArrayData(0, 1).isInitialized() && - tmp_onode_data.getArrayData(1, 0).isInitialized() && - tmp_onode_data.getArrayData(1, 1).isInitialized() && - tmp_onode_data.getArrayData(2, 0).isInitialized() && - tmp_onode_data.getArrayData(2, 1).isInitialized()) { - - F77_FUNC(nodeouternodesum3d, NODEOUTERNODESUM3D) ( - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - node_data->getDepth(), - node_gcw(0), node_gcw(1), node_gcw(2), - node_data->getPointer(), // node data dst - tmp_onode_data.getPointer(0, 0), // x lower src - tmp_onode_data.getPointer(0, 1), // x upper src - tmp_onode_data.getPointer(1, 0), // y lower src - tmp_onode_data.getPointer(1, 1), // y upper src - tmp_onode_data.getPointer(2, 0), // z lower src - tmp_onode_data.getPointer(2, 1)); // z upper src + double* tmp_onode_data_ptr00, * tmp_onode_data_ptr01, + * tmp_onode_data_ptr10, * tmp_onode_data_ptr11, + * tmp_onode_data_ptr20, * tmp_onode_data_ptr21; + if (tmp_onode_data.getArrayData(0, 0).isInitialized()) { + tmp_onode_data_ptr00 = tmp_onode_data.getPointer(0, 0); + } else { + tmp_onode_data_ptr00 = 0; + } + if (tmp_onode_data.getArrayData(0, 1).isInitialized()) { + tmp_onode_data_ptr01 = tmp_onode_data.getPointer(0, 1); + } else { + tmp_onode_data_ptr01 = 0; + } + if (tmp_onode_data.getArrayData(1, 0).isInitialized()) { + tmp_onode_data_ptr10 = tmp_onode_data.getPointer(1, 0); + } else { + tmp_onode_data_ptr10 = 0; + } + if (tmp_onode_data.getArrayData(1, 1).isInitialized()) { + tmp_onode_data_ptr11 = tmp_onode_data.getPointer(1, 1); + } else { + tmp_onode_data_ptr11 = 0; + } + if (tmp_onode_data.getArrayData(2, 0).isInitialized()) { + tmp_onode_data_ptr20 = tmp_onode_data.getPointer(2, 0); + } else { + tmp_onode_data_ptr20 = 0; } + if (tmp_onode_data.getArrayData(2, 1).isInitialized()) { + tmp_onode_data_ptr21 = tmp_onode_data.getPointer(2, 1); + } else { + tmp_onode_data_ptr21 = 0; + } + + SAMRAI_F77_FUNC(nodeouternodesum3d, NODEOUTERNODESUM3D) ( + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + &fpatch_ratio[0], + node_data->getDepth(), + node_gcw(0), node_gcw(1), node_gcw(2), + node_data->getPointer(), // node data dst + tmp_onode_data_ptr00, // x lower src + tmp_onode_data_ptr01, // x upper src + tmp_onode_data_ptr10, // y lower src + tmp_onode_data_ptr11, // y upper src + tmp_onode_data_ptr20, // z lower src + tmp_onode_data_ptr21); // z upper src } // (dim == tbox::Dimension(3)) @@ -988,7 +1016,7 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( // coarse-fine boundary. if (fill_hanging_nodes) { - for (int ibb1 = 0; ibb1 < num_bdry_boxes; ibb1++) { + for (int ibb1 = 0; ibb1 < num_bdry_boxes; ++ibb1) { const hier::BoundaryBox& bbox = pboundaries[ibb1]; const hier::Index& bboxilo = bbox.getBox().lower(); @@ -997,7 +1025,7 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( const int bbox_loc = bbox.getLocationIndex(); if ((dim == tbox::Dimension(2))) { - F77_FUNC(nodehangnodeinterp2d, NODEHANGNODEINTERP2D) ( + SAMRAI_F77_FUNC(nodehangnodeinterp2d, NODEHANGNODEINTERP2D) ( filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), @@ -1005,14 +1033,14 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( bboxilo(0), bboxilo(1), bboxihi(0), bboxihi(1), bbox_loc, - &ratio[0], + &fpatch_ratio[0], node_data->getDepth(), node_gcw(0), node_gcw(1), node_data->getPointer()); } if ((dim == tbox::Dimension(3))) { - F77_FUNC(nodehangnodeinterp3d, NODEHANGNODEINTERP3D) ( + SAMRAI_F77_FUNC(nodehangnodeinterp3d, NODEHANGNODEINTERP3D) ( filo(0), filo(1), filo(2), fihi(0), fihi(1), fihi(2), cilo(0), cilo(1), cilo(2), @@ -1020,7 +1048,7 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( bboxilo(0), bboxilo(1), bboxilo(2), bboxihi(0), bboxihi(1), bboxihi(2), bbox_loc, - &ratio[0], + &fpatch_ratio[0], node_data->getDepth(), node_gcw(0), node_gcw(1), node_gcw(2), node_data->getPointer()); @@ -1050,8 +1078,8 @@ PatchBoundaryNodeSum::doLocalCoarseFineBoundarySum( void PatchBoundaryNodeSum::copyNodeToOuternodeOnLevel( const boost::shared_ptr& level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id) const + const std::vector& node_data_id, + const std::vector& onode_data_id) const { TBOX_ASSERT(level); TBOX_ASSERT(node_data_id.size() == onode_data_id.size()); @@ -1060,13 +1088,17 @@ PatchBoundaryNodeSum::copyNodeToOuternodeOnLevel( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - for (int i = 0; i < node_data_id.size(); i++) { + int node_data_id_size = static_cast(node_data_id.size()); + for (int i = 0; i < node_data_id_size; ++i) { boost::shared_ptr > node_data( - patch->getPatchData(node_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(node_data_id[i]))); boost::shared_ptr > onode_data( - patch->getPatchData(onode_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(onode_data_id[i]))); + + TBOX_ASSERT(node_data); + TBOX_ASSERT(onode_data); onode_data->copy(*node_data); } @@ -1077,8 +1109,8 @@ PatchBoundaryNodeSum::copyNodeToOuternodeOnLevel( void PatchBoundaryNodeSum::copyOuternodeToNodeOnLevel( const boost::shared_ptr& level, - const tbox::Array& onode_data_id, - const tbox::Array& node_data_id) const + const std::vector& onode_data_id, + const std::vector& node_data_id) const { TBOX_ASSERT(level); TBOX_ASSERT(node_data_id.size() == onode_data_id.size()); @@ -1087,13 +1119,17 @@ PatchBoundaryNodeSum::copyOuternodeToNodeOnLevel( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - for (int i = 0; i < node_data_id.size(); i++) { + int node_data_id_size = static_cast(node_data_id.size()); + for (int i = 0; i < node_data_id_size; ++i) { boost::shared_ptr > onode_data( - patch->getPatchData(onode_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(onode_data_id[i]))); boost::shared_ptr > node_data( - patch->getPatchData(node_data_id[i]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(node_data_id[i]))); + + TBOX_ASSERT(node_data); + TBOX_ASSERT(onode_data); onode_data->copy2(*node_data); } @@ -1103,5 +1139,3 @@ PatchBoundaryNodeSum::copyOuternodeToNodeOnLevel( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.h index 57e2191c..1100d0de 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/PatchBoundaryNodeSum.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for summing node data at patch boundaries * ************************************************************************/ @@ -24,7 +24,7 @@ #include "SAMRAI/xfer/RefineTransactionFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -120,8 +120,9 @@ class PatchBoundaryNodeSum * state. * * @param object_name const std::string reference for name of object used - * in error reporting. When assertion checking is on, the string - * cannot be empty. + * in error reporting. + * + * @pre !object_name.empty() */ explicit PatchBoundaryNodeSum( const std::string& object_name); @@ -136,8 +137,9 @@ class PatchBoundaryNodeSum * * @param node_data_id integer patch data index for node data to sum * - * The node data id must be a valid patch data id (>=0) and must - * correspond to node-centered double data. If not, an error will result. + * @pre !d_setup_called + * @pre node_data_id >= 0 + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(node_data_id) is actually a boost::shared_ptr > */ void registerSum( @@ -152,7 +154,8 @@ class PatchBoundaryNodeSum * * @param level pointer to level on which to perform node sum * - * When assertion checking is active, the level pointer cannot be null. + * @pre level + * @pre !d_hierarchy_setup_called */ void setupSum( @@ -169,8 +172,10 @@ class PatchBoundaryNodeSum * @param coarsest_level coarsest level number for node sum * @param finest_level finest level number for node sum * - * When assertion checking is active, the hierarchy pointer cannot be null, - * and the range of levels must be valid. + * @pre hierarchy + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) + * @pre !d_hierarchy_setup_called */ void setupSum( @@ -226,46 +231,89 @@ class PatchBoundaryNodeSum } private: - /* - * Private member function to perform node sum across single level -- - * called from computeSum(). + /*! + * @brief Perform node sum across single level. + * + * Called from computeSum(). + * + * @pre level */ void doLevelSum( const boost::shared_ptr& level) const; - /* - * Private member function to set node node data on a fine level at a - * coarse-fine boundary to the sum of the node values and the associated - * outernode values on a coarsened version of the fine level. + /*! + * @ Sum node data on a coarse-fine boundary + * + * A fine level and a coarse level are given as arguments, with the + * coarse level being a coarsened representation of the fine level. + * This method modifies node data on the coarse-fine boundary of the + * fine level by summing the existing node data values with outernode + * data values from the coarse level. + * + * The data to modify are specified by the node_data_id and onode_data_id + * arrays. Each entry in node_data_id identifies data that will be + * summed with data identified by the corresponding entry in onode_data_id. + * + * If the boolean fill_hanging_nodes is false, only data on the nodes + * coincident between the fine and coarse levels will be modified. If true, + * linear interpolation will be used to fill the remaining fine nodes + * on the coarse-fine boundary. See documentation of method computeSum() + * for more information on this argument. + * + * @param fine_level Level where data will be modified + * @param coarsened_fine_level Coarsened version of fine_level + * @param node_data_id Vector of data ids specifying data to modify + * @param onode_data_id Vector of data ids specifying data to use in sums + * @param fill_hanging_nodes Tells whether to fill fine data on + * intermediate fine nodes. + * + * @pre fine_level + * @pre coarsened_fine_level + * @pre fine_level->getDim() == coarsened_fine_level->getDim() + * @pre node_data_id.size() == onode_data_id.size() + * @pre for each member, i, of node_data_id fine_level->checkAllocated(i) + * @pre for each member, i, of onode_data_id coarsened_fine_level->checkAllocated(i) */ void doLocalCoarseFineBoundarySum( const boost::shared_ptr& fine_level, const boost::shared_ptr& coarsened_fine_level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id, + const std::vector& node_data_id, + const std::vector& onode_data_id, bool fill_hanging_nodes) const; /* - * Private member function to copy node data to outernode data - * on all patches on a level. + * @brief Copy node data to outernode data on all patches of level + * + * Data specified in the node_data_id array will be copied to data + * specified by the onode_data_id array on all patches. + * + * @param level + * @param node_data_id Vector of data ids for NodeData source + * @param onode_data_id Vector of data ids for OuternodeData destination */ void copyNodeToOuternodeOnLevel( const boost::shared_ptr& level, - const tbox::Array& node_data_id, - const tbox::Array& onode_data_id) const; + const std::vector& node_data_id, + const std::vector& onode_data_id) const; /* - * Private member function to copy outernode data to node data - * on all patches on a level. + * @brief Copy outernode data to node data on all patches of level + * + * Data specified in the onode_data_id array will be copied to data + * specified by the node_data_id array on all patches. + * + * @param level + * @param onode_data_id Vector of data ids for OuternodeData source + * @param node_data_id Vector of data ids for NodeData destination */ void copyOuternodeToNodeOnLevel( const boost::shared_ptr& level, - const tbox::Array& onode_data_id, - const tbox::Array& node_data_id) const; + const std::vector& onode_data_id, + const std::vector& node_data_id) const; /* * Static members for managing shared temporary data among multiple @@ -273,8 +321,8 @@ class PatchBoundaryNodeSum */ static int s_instance_counter; // These arrays are indexed [data depth][number of variables with depth] - static tbox::Array > s_onode_src_id_array; - static tbox::Array > s_onode_dst_id_array; + static std::vector > s_onode_src_id_array; + static std::vector > s_onode_dst_id_array; enum PATCH_BDRY_NODE_SUM_DATA_ID { ID_UNDEFINED = -1 }; @@ -284,23 +332,23 @@ class PatchBoundaryNodeSum int d_num_reg_sum; // These arrays are indexed [variable registration sequence number] - tbox::Array d_user_node_data_id; - tbox::Array d_user_node_depth; + std::vector d_user_node_data_id; + std::vector d_user_node_depth; // These arrays are indexed [data depth] - tbox::Array d_num_registered_data_by_depth; + std::vector d_num_registered_data_by_depth; /* * Node-centered variables and patch data indices used as internal work * quantities. */ // These arrays are indexed [variable registration sequence number] - tbox::Array > d_tmp_onode_src_variable; - tbox::Array > d_tmp_onode_dst_variable; + std::vector > d_tmp_onode_src_variable; + std::vector > d_tmp_onode_dst_variable; // These arrays are indexed [variable registration sequence number] - tbox::Array d_onode_src_id; - tbox::Array d_onode_dst_id; + std::vector d_onode_src_id; + std::vector d_onode_dst_id; /* * Sets of indices for temporary variables to expedite allocation and @@ -320,17 +368,18 @@ class PatchBoundaryNodeSum boost::shared_ptr d_sum_transaction_factory; - tbox::Array > - d_single_level_sum_schedule; - tbox::Array > - d_cfbdry_copy_schedule; - tbox::Array > - d_sync_coarsen_schedule; + std::vector > + d_single_level_sum_schedule; + std::vector > + d_cfbdry_copy_schedule; + std::vector > + d_sync_coarsen_schedule; - tbox::Array > d_cfbdry_tmp_level; + // A coarsened version of each fine level. + std::vector > d_cfbdry_tmp_level; - tbox::Array > - d_coarse_fine_boundary; + std::vector > + d_coarse_fine_boundary; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.C index b377d013..764ccf0a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Time integration manager for AMR with local time stepping. * ************************************************************************/ - -#ifndef included_algs_TimeRefinementIntegrator_C -#define included_algs_TimeRefinementIntegrator_C - #include "SAMRAI/algs/TimeRefinementIntegrator.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -24,6 +20,8 @@ #include #include +#include + // #define DEBUG_TIMES namespace SAMRAI { @@ -64,8 +62,19 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( const boost::shared_ptr& input_db, const boost::shared_ptr& hierarchy, const boost::shared_ptr& level_integrator, - const boost::shared_ptr& gridding_algorithm, - bool register_for_restart): + const boost::shared_ptr& gridding_algorithm): + d_object_name(object_name), + d_patch_hierarchy(hierarchy), + d_refine_level_integrator(level_integrator), + d_gridding_algorithm(gridding_algorithm), + d_start_time(tbox::MathUtilities::getSignalingNaN()), + d_end_time(tbox::MathUtilities::getSignalingNaN()), + d_grow_dt(1.0), + d_integrator_time(tbox::MathUtilities::getSignalingNaN()), + d_just_regridded(false), + d_level_0_advanced(false), + d_hierarchy_advanced(false), + d_connector_width_requestor(), d_barrier_and_time(false) { TBOX_ASSERT(!object_name.empty()); @@ -73,46 +82,25 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( TBOX_ASSERT(level_integrator); TBOX_ASSERT(gridding_algorithm); - d_object_name = object_name; - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } - - d_patch_hierarchy = hierarchy; - d_refine_level_integrator = level_integrator; - d_gridding_algorithm = gridding_algorithm; + tbox::RestartManager::getManager()->registerRestartItem(d_object_name, + this); d_use_refined_timestepping = level_integrator->usingRefinedTimestepping(); - /* - * Set default values for debugging. - */ - - d_start_time = tbox::MathUtilities::getSignalingNaN(); - d_end_time = tbox::MathUtilities::getSignalingNaN(); - d_integrator_time = tbox::MathUtilities::getSignalingNaN(); - d_integrator_step = tbox::MathUtilities::getMax(); - d_grow_dt = 1.0; - d_max_integrator_steps = tbox::MathUtilities::getMax(); - const int max_levels = d_patch_hierarchy->getMaxNumberOfLevels(); + d_regrid_interval.resize(max_levels); - d_regrid_interval.resizeArray(max_levels); - - d_level_old_old_time.resizeArray(max_levels); - d_level_old_time.resizeArray(max_levels); - d_level_sim_time.resizeArray(max_levels); - d_dt_max_level.resizeArray(max_levels); - d_dt_actual_level.resizeArray(max_levels); - d_step_level.resizeArray(max_levels); - d_max_steps_level.resizeArray(max_levels); + d_level_old_old_time.resize(max_levels); + d_level_old_time.resize(max_levels); + d_level_sim_time.resize(max_levels); + d_dt_max_level.resize(max_levels); + d_dt_actual_level.resize(max_levels); + d_step_level.resize(max_levels); + d_max_steps_level.resize(max_levels); int level_number; - for (level_number = 0; level_number < max_levels; level_number++) { + for (level_number = 0; level_number < max_levels; ++level_number) { d_regrid_interval[level_number] = tbox::MathUtilities::getMax(); d_level_old_old_time[level_number] = tbox::MathUtilities::getSignalingNaN(); @@ -135,7 +123,7 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( if (d_use_refined_timestepping) { if (max_levels > 1) { - for (level_number = 1; level_number < max_levels; level_number++) { + for (level_number = 1; level_number < max_levels; ++level_number) { const hier::IntVector ratio(d_patch_hierarchy-> getRatioToCoarserLevel(level_number)); @@ -148,7 +136,8 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( TBOX_ERROR( d_object_name << ": " << " integrator cannot set regrid interval" - << " based on ratios between levels."); + << " based on ratios between levels." + << std::endl); } } } @@ -156,7 +145,7 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( d_regrid_interval[0] = d_regrid_interval[1]; } else { - for (level_number = 0; level_number < max_levels; level_number++) { + for (level_number = 0; level_number < max_levels; ++level_number) { d_regrid_interval[level_number] = 1; } } @@ -172,23 +161,30 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( * from input and restart databases. */ bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (is_from_restart && d_registered_for_restart) { + if (is_from_restart) { getFromRestart(); } getFromInput(input_db, is_from_restart); + d_connector_width_requestor.setTagBuffer(d_tag_buffer); + hierarchy->registerConnectorWidthRequestor( + d_connector_width_requestor); + /* * Initialize remaining integrator data members. */ - d_just_regridded = false; - if (!is_from_restart) { d_integrator_time = d_start_time; - d_integrator_step = 0; + d_step_level[0] = 0; d_last_finest_level = 0; } + tbox::plog << "TimeRefinementIntegrator constructor setting regrid intervals:"; + for (size_t i = 0; i < d_regrid_interval.size(); ++i) { + tbox::plog << " [" << i << "]=" << d_regrid_interval[i]; + } + tbox::plog << "\n"; } /* @@ -202,9 +198,7 @@ TimeRefinementIntegrator::TimeRefinementIntegrator( TimeRefinementIntegrator::~TimeRefinementIntegrator() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); } /* @@ -224,9 +218,6 @@ TimeRefinementIntegrator::~TimeRefinementIntegrator() double TimeRefinementIntegrator::initializeHierarchy() { - - TBOX_DIM_ASSERT_CHECK_ARGS1(*d_patch_hierarchy); - if (d_barrier_and_time) { t_initialize_hier->barrierAndStart(); } @@ -235,14 +226,13 @@ TimeRefinementIntegrator::initializeHierarchy() if (tbox::RestartManager::getManager()->isFromRestart()) { - d_patch_hierarchy->getFromRestart(); + d_patch_hierarchy->initializeHierarchy(); d_gridding_algorithm-> getTagAndInitializeStrategy()-> resetHierarchyConfiguration(d_patch_hierarchy, 0, - d_patch_hierarchy-> - getFinestLevelNumber()); + d_patch_hierarchy->getFinestLevelNumber()); } else { @@ -265,13 +255,15 @@ TimeRefinementIntegrator::initializeHierarchy() // "true" argument: const bool initial_time = true; d_refine_level_integrator->synchronizeNewLevels(d_patch_hierarchy, 0, - d_patch_hierarchy-> - getFinestLevelNumber(), + d_patch_hierarchy->getFinestLevelNumber(), d_start_time, true); } } + d_level_0_advanced = true; + d_hierarchy_advanced = true; + if (d_barrier_and_time) { t_initialize_hier->stop(); } @@ -368,8 +360,10 @@ TimeRefinementIntegrator::initializeRefinedTimesteppingLevelData( * Then, query level strategy for proper time step. */ - d_step_level[level_number] = 0; - d_max_steps_level[level_number] = 1; + if (level_number > 0) { + d_step_level[level_number] = 0; + d_max_steps_level[level_number] = 1; + } d_level_sim_time[level_number] = d_start_time; bool initial_time = true; @@ -395,8 +389,7 @@ TimeRefinementIntegrator::initializeRefinedTimesteppingLevelData( d_refine_level_integrator->getMaxFinerLevelDt( level_number, d_dt_actual_level[level_number - 1], - d_patch_hierarchy-> - getRatioToCoarserLevel(level_number))); + d_patch_hierarchy->getRatioToCoarserLevel(level_number))); } d_dt_max_level[level_number] = d_dt_actual_level[level_number] = dt_level; @@ -407,20 +400,22 @@ TimeRefinementIntegrator::initializeRefinedTimesteppingLevelData( if (d_patch_hierarchy->levelCanBeRefined(level_number)) { - int buffer; - if (d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { - buffer = d_regrid_interval[level_number]; + int tag_buffer; + if (d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { + tag_buffer = d_regrid_interval[level_number]; } else { - buffer = d_tag_buffer[level_number]; + tag_buffer = d_tag_buffer[level_number]; } double regrid_start_time = d_level_sim_time[level_number] - d_dt_actual_level[level_number]; // "true" argument: const bool initial_time = true; d_gridding_algorithm->makeFinerLevel( - d_level_sim_time[level_number], + tag_buffer, true, - buffer, + d_step_level[0], + d_level_sim_time[level_number], regrid_start_time); /* @@ -441,7 +436,8 @@ TimeRefinementIntegrator::initializeRefinedTimesteppingLevelData( * regridding on the finer level. */ if (d_patch_hierarchy->levelCanBeRefined(level_number + 1) && - d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { if (d_barrier_and_time) { t_advance_level->barrierAndStart(); @@ -476,7 +472,8 @@ TimeRefinementIntegrator::initializeRefinedTimesteppingLevelData( */ if (d_patch_hierarchy->levelCanBeRefined(level_number + 1) && - d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { d_refine_level_integrator-> resetDataToPreadvanceState(patch_level); } @@ -499,8 +496,10 @@ TimeRefinementIntegrator::initializeSynchronizedTimesteppingLevelData( * Then, query level strategy for proper time step. */ - d_step_level[level_number] = 0; - d_max_steps_level[level_number] = 1; + if (level_number > 0) { + d_step_level[level_number] = 0; + d_max_steps_level[level_number] = 1; + } d_level_sim_time[level_number] = d_start_time; d_level_old_time[level_number] = d_start_time; @@ -518,7 +517,7 @@ TimeRefinementIntegrator::initializeSynchronizedTimesteppingLevelData( } d_dt_max_level[level_number] = d_dt_actual_level[level_number] = d_dt; - for (int i = 0; i < level_number; i++) { + for (int i = 0; i < level_number; ++i) { if (d_dt_max_level[i] > d_dt_max_level[level_number]) { d_dt_max_level[i] = d_dt_actual_level[i] = d_dt_max_level[level_number]; @@ -531,20 +530,22 @@ TimeRefinementIntegrator::initializeSynchronizedTimesteppingLevelData( if (d_patch_hierarchy->levelCanBeRefined(level_number)) { - int buffer; - if (d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { - buffer = d_regrid_interval[level_number]; + int tag_buffer; + if (d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { + tag_buffer = d_regrid_interval[level_number]; } else { - buffer = d_tag_buffer[level_number]; + tag_buffer = d_tag_buffer[level_number]; } double regrid_start_time = d_level_sim_time[level_number] - d_dt_actual_level[level_number]; // "true" argument: const bool initial_time = true; d_gridding_algorithm->makeFinerLevel( - d_level_sim_time[level_number], + tag_buffer, true, - buffer, + d_step_level[0], + d_level_sim_time[level_number], regrid_start_time); /* @@ -565,7 +566,8 @@ TimeRefinementIntegrator::initializeSynchronizedTimesteppingLevelData( * regridding on the finer level. */ if (d_patch_hierarchy->levelCanBeRefined(level_number + 1) && - d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { if (d_barrier_and_time) { t_advance_level->barrierAndStart(); @@ -600,7 +602,8 @@ TimeRefinementIntegrator::initializeSynchronizedTimesteppingLevelData( * may require a different initial time increment size. */ if (d_patch_hierarchy->levelCanBeRefined(level_number + 1) && - d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { d_refine_level_integrator-> resetDataToPreadvanceState(patch_level); } @@ -670,8 +673,13 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( * the max time increment for the level. */ - d_step_level[level_number] = 0; - d_max_steps_level[level_number] = 1; + if (level_number > 0) { + d_step_level[level_number] = 0; + d_max_steps_level[level_number] = 1; + } else { + d_level_0_advanced = false; + d_hierarchy_advanced = false; + } double time_remaining = 0.0; if (level_number > 0) { @@ -690,8 +698,7 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( d_refine_level_integrator->getMaxFinerLevelDt( level_number, d_dt_actual_level[level_number - 1], - d_patch_hierarchy-> - getRatioToCoarserLevel(level_number))); + d_patch_hierarchy->getRatioToCoarserLevel(level_number))); if (d_patch_hierarchy->levelCanBeRefined(level_number)) { d_dt_max_level[level_number] = @@ -781,14 +788,22 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( * Update step count information. Then, advance all finer levels. */ - if (level_number == 0) d_integrator_step++; - d_step_level[level_number]++; + if (level_number == 0) { + d_level_0_advanced = true; + } else { + ++d_step_level[level_number]; + } if (d_patch_hierarchy->finerLevelExists(level_number)) { advanceRecursivelyForRefinedTimestepping(level_number + 1, new_level_time); } + if (level_number == 0) { + ++d_step_level[level_number]; + d_hierarchy_advanced = true; + } + /* * Synchronize data between levels in the hierarchy as necessary. * Note that this process synchronizes data between this level, @@ -844,8 +859,7 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( resetTimeDependentData(d_patch_hierarchy-> getPatchLevel(finest_level_number), new_level_time, - d_patch_hierarchy-> - levelCanBeRefined(finest_level_number)); + d_patch_hierarchy->levelCanBeRefined(finest_level_number)); } } @@ -888,17 +902,17 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( * gridding algorithm does not used time integration, reset data * on all levels. */ - if (d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + if (d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { if (!d_patch_hierarchy-> levelCanBeRefined(finest_level_number)) { d_refine_level_integrator->resetTimeDependentData( d_patch_hierarchy->getPatchLevel(finest_level_number), new_level_time, - d_patch_hierarchy-> - levelCanBeRefined(finest_level_number)); + d_patch_hierarchy->levelCanBeRefined(finest_level_number)); } } else { - for (int ln = level_number; ln <= finest_level_number; ln++) { + for (int ln = level_number; ln <= finest_level_number; ++ln) { d_refine_level_integrator->resetTimeDependentData( d_patch_hierarchy->getPatchLevel(ln), d_level_sim_time[ln], @@ -923,12 +937,14 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( * to throw an assertion if it is accessed. */ - tbox::Array regrid_start_time; - if (!d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + std::vector regrid_start_time; + if (!d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { int max_levels = d_patch_hierarchy->getMaxNumberOfLevels(); - regrid_start_time.resizeArray(max_levels); - for (int i = 0; i < regrid_start_time.getSize(); i++) { + regrid_start_time.resize(max_levels); + int array_size = static_cast(regrid_start_time.size()); + for (int i = 0; i < array_size; ++i) { regrid_start_time[i] = 0.; } @@ -955,8 +971,9 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( d_gridding_algorithm-> regridAllFinerLevels( level_number, - d_level_sim_time[level_number], d_tag_buffer, + d_step_level[0], + d_level_sim_time[level_number], regrid_start_time, (coarsest_sync_level >= level_number)); @@ -987,8 +1004,7 @@ TimeRefinementIntegrator::advanceRecursivelyForRefinedTimestepping( d_refine_level_integrator->resetTimeDependentData( patch_level, d_level_sim_time[level_number], - d_patch_hierarchy-> - levelCanBeRefined(level_number)); + d_patch_hierarchy->levelCanBeRefined(level_number)); } if (d_just_regridded) { @@ -1034,14 +1050,19 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( int finest_level_number = d_patch_hierarchy->getFinestLevelNumber(); double dt_new = tbox::MathUtilities::getMax(); + d_level_0_advanced = false; + d_hierarchy_advanced = false; + int level_num; - for (level_num = 0; level_num <= finest_level_number; level_num++) { + for (level_num = 0; level_num <= finest_level_number; ++level_num) { boost::shared_ptr patch_level( d_patch_hierarchy->getPatchLevel(level_num)); - d_step_level[level_num] = 1; - d_max_steps_level[level_num] = 1; + if (level_num > 0) { + d_step_level[level_num] = 1; + d_max_steps_level[level_num] = 1; + } d_dt_max_level[level_num] = dt; d_level_sim_time[level_num] = d_integrator_time; @@ -1067,6 +1088,10 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( true, false); + if (level_num == 0) { + d_level_0_advanced = true; + } + if (d_barrier_and_time) { t_advance_level->stop(); } @@ -1076,12 +1101,13 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( dt_new = tbox::MathUtilities::Min(dt_new, d_grow_dt * dt); - for (level_num = 0; level_num <= finest_level_number; level_num++) { + for (level_num = 0; level_num <= finest_level_number; ++level_num) { d_dt_max_level[level_num] = d_dt_actual_level[level_num] = dt_new; } d_integrator_time += dt; - d_integrator_step++; + ++d_step_level[0]; + d_hierarchy_advanced = true; int coarse_level_number = 0; @@ -1091,8 +1117,8 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( tbox::plog << "\nSynchronizing levels " << coarse_level_number << " to " << finest_level_number << std::endl; #endif - tbox::Array old_times(finest_level_number+1, - d_integrator_time-dt); + std::vector old_times(finest_level_number + 1, + d_integrator_time - dt); d_refine_level_integrator->standardLevelSynchronization( d_patch_hierarchy, @@ -1107,7 +1133,7 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( * array. This information may be used during the re-gridding * process, if time integration is used during error estimation. */ - for (level_num = 0; level_num <= finest_level_number; level_num++) { + for (level_num = 0; level_num <= finest_level_number; ++level_num) { d_level_old_old_time[level_num] = d_level_old_time[level_num]; d_level_old_time[level_num] = d_level_sim_time[level_num]; } @@ -1115,7 +1141,7 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( /* * Are we ready to re-grid?? */ - bool regrid_now = (d_integrator_step % d_regrid_interval[0] == 0); + bool regrid_now = (d_step_level[0] % d_regrid_interval[0] == 0); if (!regrid_now) { @@ -1124,7 +1150,7 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( * reset the time dependent data on all the levels to * prepare for the next advance. */ - for (int ln = 0; ln <= finest_level_number; ln++) { + for (int ln = 0; ln <= finest_level_number; ++ln) { d_refine_level_integrator->resetTimeDependentData( d_patch_hierarchy->getPatchLevel(ln), d_integrator_time, @@ -1150,17 +1176,16 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( * this is properly done in the level integrator. */ - if (d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { - if (!d_patch_hierarchy-> - levelCanBeRefined(finest_level_number)) { + if (d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { + if (!d_patch_hierarchy->levelCanBeRefined(finest_level_number)) { d_refine_level_integrator->resetTimeDependentData( d_patch_hierarchy->getPatchLevel(finest_level_number), d_integrator_time, - d_patch_hierarchy-> - levelCanBeRefined(finest_level_number)); + d_patch_hierarchy->levelCanBeRefined(finest_level_number)); } } else { - for (int ln = 0; ln <= finest_level_number; ln++) { + for (int ln = 0; ln <= finest_level_number; ++ln) { d_refine_level_integrator->resetTimeDependentData( d_patch_hierarchy->getPatchLevel(ln), d_integrator_time, @@ -1184,12 +1209,14 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( * to throw an assertion if it is accessed. */ - tbox::Array regrid_start_time; - if (!d_gridding_algorithm->getTagAndInitializeStrategy()->usesTimeIntegration()) { + std::vector regrid_start_time; + if (!d_gridding_algorithm->getTagAndInitializeStrategy()-> + usesTimeIntegration(d_step_level[0], d_integrator_time)) { int max_levels = d_patch_hierarchy->getMaxNumberOfLevels(); - regrid_start_time.resizeArray(max_levels); - for (int i = 0; i < regrid_start_time.getSize(); i++) { + regrid_start_time.resize(max_levels); + int array_size = static_cast(regrid_start_time.size()); + for (int i = 0; i < array_size; ++i) { regrid_start_time[i] = 0.; } @@ -1215,8 +1242,9 @@ TimeRefinementIntegrator::advanceForSynchronizedTimestepping( d_gridding_algorithm-> regridAllFinerLevels( coarse_level_number, - d_integrator_time, d_tag_buffer, + d_step_level[0], + d_integrator_time, regrid_start_time); /* @@ -1290,7 +1318,7 @@ TimeRefinementIntegrator::findNextDtAndStepsRemaining( tbox::MathUtilities::Min(dt_bound, d_dt_max_level[level_number] * d_grow_dt); - if (d_step_level[level_number] < d_max_steps_level[level_number]) { + if (stepsRemaining(level_number)) { /* * If we have not exceeded the max number of steps, the max number @@ -1306,11 +1334,13 @@ TimeRefinementIntegrator::findNextDtAndStepsRemaining( if (time_remaining - dt_temp > sqrt(tbox::MathUtilities::getEpsilon()) * time_remaining) { - number_steps_remaining++; + ++number_steps_remaining; } - d_max_steps_level[level_number] = - d_step_level[level_number] + number_steps_remaining; + if (level_number > 0) { + d_max_steps_level[level_number] = + d_step_level[level_number] + number_steps_remaining; + } /* * If we are not on the coarsest hierarchy level, there must be @@ -1329,24 +1359,23 @@ TimeRefinementIntegrator::findNextDtAndStepsRemaining( d_max_steps_level[level_number] / d_regrid_interval[level_number]; if (d_max_steps_level[level_number] - % d_regrid_interval[level_number]) number_regrids++; + % d_regrid_interval[level_number]) ++number_regrids; d_max_steps_level[level_number] = number_regrids * d_regrid_interval[level_number]; - } - - if (d_step_level[level_number] >= d_max_steps_level[level_number]) { - TBOX_ERROR( - d_object_name << ": " - << "no steps left to divide remaining time ...\n" - << "level_number = " << level_number - << std::endl - << "time_remaining = " << time_remaining - << "\ndt_bound = " << dt_bound - << "\nnumber_steps_remaining = " - << number_steps_remaining - << std::endl); + if (d_step_level[level_number] >= d_max_steps_level[level_number]) { + TBOX_ERROR( + d_object_name << ": " + << "no steps left to divide remaining time ...\n" + << "level_number = " << level_number + << std::endl + << "time_remaining = " << time_remaining + << "\ndt_bound = " << dt_bound + << "\nnumber_steps_remaining = " + << number_steps_remaining + << std::endl); + } } /* @@ -1355,16 +1384,24 @@ TimeRefinementIntegrator::findNextDtAndStepsRemaining( * steps remaining. */ - d_dt_actual_level[level_number] = - time_remaining / double(d_max_steps_level[level_number] - - d_step_level[level_number]); + if (level_number == 0) { + d_dt_actual_level[level_number] = time_remaining; + } else { + d_dt_actual_level[level_number] = + time_remaining / double(d_max_steps_level[level_number] + - d_step_level[level_number]); + } } else { d_dt_actual_level[level_number] = d_dt_max_level[level_number]; } - return (d_max_steps_level[level_number] - - d_step_level[level_number]) <= 1; + if (level_number == 0) { + return true; + } else { + return (d_max_steps_level[level_number] + - d_step_level[level_number]) <= 1; + } } @@ -1384,8 +1421,23 @@ TimeRefinementIntegrator::atRegridPoint( TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - int step_number = ((level_number == 0) ? d_integrator_step - : d_step_level[level_number]); + int step_number; + if (level_number == 0) { + // If the entire hierarchy has advanced then so has level 0. + // d_step_level[0] will have advanced by one step and reflects level 0's + // step number. However, if the hierarchy has not yet advanced then + // we're in the middle of a recursive hierarchy advancement and + // d_step_level[0] has not yet been incremented. However, level 0 will + // have advanced by 1 step. So d_step_level[0] + 1 reflects level 0's + // step number. + if (d_hierarchy_advanced) { + step_number = d_step_level[0]; + } else { + step_number = d_step_level[0] + 1; + } + } else { + step_number = d_step_level[level_number]; + } return (step_number > 0) && d_patch_hierarchy->levelCanBeRefined(level_number) @@ -1410,6 +1462,28 @@ TimeRefinementIntegrator::coarserLevelRegridsToo( return (level_number > 0) ? atRegridPoint(level_number - 1) : false; } +/* + ************************************************************************* + ************************************************************************* + */ + +void +TimeRefinementIntegrator::setRegridInterval( + const int regrid_interval) +{ + TBOX_ASSERT(!d_use_refined_timestepping); + int array_size = static_cast(d_regrid_interval.size()); + for (int i = 0; i < array_size; ++i) { + d_regrid_interval[i] = regrid_interval; + } + + tbox::plog << "TimeRefinementIntegrator::setRegridInterval setting regrid intervals:"; + for (size_t i = 0; i < d_regrid_interval.size(); ++i) { + tbox::plog << " [" << i << "]=" << d_regrid_interval[i]; + } + tbox::plog << "\n"; +} + /* ************************************************************************* * @@ -1429,8 +1503,8 @@ TimeRefinementIntegrator::printClassData( os << "d_integrator_time = " << d_integrator_time << "\n" << "d_start_time = " << d_start_time << "\n" << "d_end_time = " << d_end_time << "\n" - << "d_integrator_step = " << d_integrator_step << "\n" - << "d_max_integrator_steps = " << d_max_integrator_steps << "\n" + << "d_integrator_step = " << d_step_level[0] << "\n" + << "d_max_integrator_steps = " << d_max_steps_level[0] << "\n" << "d_grow_dt = " << d_grow_dt << std::endl; os << "d_just_regridded = " << d_just_regridded << std::endl; os << "d_last_finest_level = " << d_last_finest_level << std::endl; @@ -1441,7 +1515,7 @@ TimeRefinementIntegrator::printClassData( << d_gridding_algorithm.get() << std::endl; const int max_levels = d_patch_hierarchy->getMaxNumberOfLevels(); - for (int level_number = 0; level_number < max_levels; level_number++) { + for (int level_number = 0; level_number < max_levels; ++level_number) { printDataForLevel(os, level_number); } } @@ -1481,31 +1555,32 @@ TimeRefinementIntegrator::printDataForLevel( /* ************************************************************************* * - * Write the class version number and data members to database object. + * Write the class version number and data members to restart database object. * ************************************************************************* */ void -TimeRefinementIntegrator::putToDatabase( - const boost::shared_ptr& db) const +TimeRefinementIntegrator::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("ALGS_TIME_REFINEMENT_INTEGRATOR_VERSION", + restart_db->putInteger("ALGS_TIME_REFINEMENT_INTEGRATOR_VERSION", ALGS_TIME_REFINEMENT_INTEGRATOR_VERSION); - db->putDouble("d_start_time", d_start_time); - db->putDouble("d_end_time", d_end_time); - db->putDouble("d_grow_dt", d_grow_dt); - db->putInteger("d_max_integrator_steps", d_max_integrator_steps); - db->putIntegerArray("d_regrid_interval", d_regrid_interval); - db->putIntegerArray("d_tag_buffer", d_tag_buffer); - db->putDouble("d_integrator_time", d_integrator_time); - db->putInteger("d_integrator_step", d_integrator_step); - db->putInteger("d_last_finest_level", d_last_finest_level); - db->putDoubleArray("d_dt_max_level", d_dt_max_level); - db->putDoubleArray("d_dt_actual_level", d_dt_actual_level); + restart_db->putDouble("start_time", d_start_time); + restart_db->putDouble("end_time", d_end_time); + restart_db->putDouble("grow_dt", d_grow_dt); + restart_db->putInteger("max_integrator_steps", d_max_steps_level[0]); + restart_db->putIntegerVector("regrid_interval", d_regrid_interval); + restart_db->putIntegerVector("tag_buffer", d_tag_buffer); + restart_db->putBool("DEV_barrier_and_time", d_barrier_and_time); + restart_db->putDouble("d_integrator_time", d_integrator_time); + restart_db->putInteger("d_integrator_step", d_step_level[0]); + restart_db->putInteger("d_last_finest_level", d_last_finest_level); + restart_db->putDoubleVector("d_dt_max_level", d_dt_max_level); + restart_db->putDoubleVector("d_dt_actual_level", d_dt_actual_level); } /* @@ -1520,118 +1595,145 @@ TimeRefinementIntegrator::putToDatabase( void TimeRefinementIntegrator::getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart) { - TBOX_ASSERT(is_from_restart || db); - - if (is_from_restart) { - if (db) { - if (!d_use_refined_timestepping) { - int regrid_interval = - db->getIntegerWithDefault("regrid_interval", 1); - setRegridInterval(regrid_interval); - } - - if (db->keyExists("end_time")) { - d_end_time = db->getDouble("end_time"); - } - - if (db->keyExists("grow_dt")) { - d_grow_dt = db->getDouble("grow_dt"); - } - - if (db->keyExists("max_integrator_steps")) { - d_max_integrator_steps = db->getInteger("max_integrator_steps"); - } - - if (db->keyExists("tag_buffer")) { - tbox::Array temp_tag_buffer = - db->getIntegerArray("tag_buffer"); - if (temp_tag_buffer.getSize() < - (d_patch_hierarchy->getMaxNumberOfLevels() - 1)) { - int tsize = temp_tag_buffer.getSize(); - temp_tag_buffer.resizeArray( - d_patch_hierarchy->getMaxNumberOfLevels() - 1); - for (int i = tsize; - i < temp_tag_buffer.getSize(); i++) { - temp_tag_buffer[i] = temp_tag_buffer[tsize - 1]; - } - } - d_tag_buffer = temp_tag_buffer; - } - } - } else { + if (!is_from_restart && !input_db) { + TBOX_ERROR(": TimeRefinementIntegrator::getFromInput()\n" + << "no input database supplied" << std::endl); + } + if (!is_from_restart) { /* * If not from restart, read in all data members from input database. */ if (!d_use_refined_timestepping) { - int regrid_interval = db->getIntegerWithDefault("regrid_interval", 1); + int regrid_interval = + input_db->getIntegerWithDefault("regrid_interval", 1); + if (!(regrid_interval >= 1)) { + INPUT_RANGE_ERROR("regrid_interval"); + } setRegridInterval(regrid_interval); + } else if (input_db->keyExists("regrid_interval")) { + TBOX_WARNING("TimeRefinementIntegrator::getFromInput() warning...\n" + << "regrid_interval input parameter not applicable with\n" + << "refined timestepping and will be ignored." << std::endl); } - if (db->keyExists("start_time")) { - d_start_time = db->getDouble("start_time"); - } else { - TBOX_ERROR( - d_object_name << ": " - << "Key data `start_time' not found in input."); + d_start_time = input_db->getDouble("start_time"); + if (!(d_start_time >= 0)) { + INPUT_RANGE_ERROR("start_time"); } - if (db->keyExists("end_time")) { - d_end_time = db->getDouble("end_time"); - } else { - TBOX_ERROR(d_object_name << ": " - << "Key data `end_time' not found in input."); + d_end_time = input_db->getDouble("end_time"); + if (!(d_end_time >= d_start_time)) { + INPUT_RANGE_ERROR("end_time"); } - if (db->keyExists("grow_dt")) { - d_grow_dt = db->getDouble("grow_dt"); - } else { - TBOX_ERROR(d_object_name << ": " - << "Key data `grow_dt' not found in input."); + d_grow_dt = input_db->getDoubleWithDefault("grow_dt", 1.0); + if (!(d_grow_dt > 0)) { + INPUT_RANGE_ERROR("grow_dt"); } - if (db->keyExists("max_integrator_steps")) { - d_max_integrator_steps = db->getInteger("max_integrator_steps"); - } else { - TBOX_ERROR( - d_object_name << ": " - << "Key data `max_integrator_steps' not found in input."); + d_max_steps_level[0] = input_db->getInteger("max_integrator_steps"); + if (!(d_max_steps_level[0] >= 0)) { + INPUT_RANGE_ERROR("max_integrator_steps"); } - if (db->keyExists("tag_buffer")) { - d_tag_buffer = db->getIntegerArray("tag_buffer"); - if (d_tag_buffer.getSize() < + if (input_db->keyExists("tag_buffer")) { + d_tag_buffer = input_db->getIntegerVector("tag_buffer"); + if (static_cast(d_tag_buffer.size()) < (d_patch_hierarchy->getMaxNumberOfLevels() - 1)) { - int tsize = d_tag_buffer.getSize(); - d_tag_buffer.resizeArray( - d_patch_hierarchy->getMaxNumberOfLevels() - 1); - for (int i = tsize; - i < d_patch_hierarchy->getMaxNumberOfLevels() - 1; i++) { - d_tag_buffer[i] = d_tag_buffer[tsize - 1]; - } + int tsize = static_cast(d_tag_buffer.size()); + d_tag_buffer.resize( + d_patch_hierarchy->getMaxNumberOfLevels() - 1, + d_tag_buffer[tsize - 1]); } } else { int level_number; - d_tag_buffer.resizeArray(d_patch_hierarchy->getMaxNumberOfLevels()); + d_tag_buffer.resize(d_patch_hierarchy->getMaxNumberOfLevels()); for (level_number = 0; level_number < d_patch_hierarchy->getMaxNumberOfLevels(); - level_number++) { + ++level_number) { d_tag_buffer[level_number] = d_regrid_interval[level_number]; } - TBOX_WARNING( - d_object_name << ": " - << "Key data `tag_buffer' not found in input. " - << "Default values used. See class header for details."); + TBOX_WARNING("TimeRefinementIntegrator::getFromInput() warning...\n" + << "Key data `tag_buffer' not found in input. " + << "Default values used. See class header for details." + << std::endl); } d_barrier_and_time = - db->getBoolWithDefault("barrier_and_time", d_barrier_and_time); + input_db->getBoolWithDefault("DEV_barrier_and_time", false); + } else if (input_db) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + + if (read_on_restart) { + if (!d_use_refined_timestepping) { + int regrid_interval = + input_db->getIntegerWithDefault("regrid_interval", 1); + if (regrid_interval < 1) { + TBOX_ERROR("TimeRefinementIntegrator::getFromInput() error...\n" + << "regrid_interval must be >=1." << std::endl); + } + setRegridInterval(regrid_interval); + } else if (input_db->keyExists("regrid_interval")) { + TBOX_WARNING("TimeRefinementIntegrator::getFromInput() warning...\n" + << "regrid_interval input parameter not applicable with\n" + << "refined timestepping and will be ignored." << std::endl); + } + + if (input_db->keyExists("start_time")) { + double tmp = input_db->getDouble("start_time"); + if (tmp != d_start_time) { + TBOX_WARNING("TimeRefinementIntegrator::getFromInput warning...\n" + << "start_time may not be changed on restart." << std::endl); + } + } + + d_end_time = input_db->getDoubleWithDefault("end_time", d_end_time); + if (d_end_time < d_start_time) { + TBOX_ERROR("TimeRefinementIntegrator::getFromInput() error...\n" + << "end_time must be >= start_time." << std::endl); + } + + d_grow_dt = input_db->getDoubleWithDefault("grow_dt", d_grow_dt); + if (d_grow_dt <= 0) { + TBOX_ERROR("TimeRefinementIntegrator::getFromInput() error...\n" + << "grow_dt must be > 0." << std::endl); + } + + d_max_steps_level[0] = + input_db->getIntegerWithDefault("max_integrator_steps", + d_max_steps_level[0]); + if (d_max_steps_level[0] < 0) { + TBOX_ERROR("TimeRefinementIntegrator::getFromInput() error...\n" + << "max_integrator_steps must be >= 0." << std::endl); + } else if (d_max_steps_level[0] < d_step_level[0]) { + TBOX_ERROR("TimeRefinementIntegrator::getFromInput() error...\n" + << "max_integrator_steps must be >= current integrator step." + << std::endl); + } + + if (input_db->keyExists("tag_buffer")) { + d_tag_buffer = input_db->getIntegerVector("tag_buffer"); + if (static_cast(d_tag_buffer.size()) < + (d_patch_hierarchy->getMaxNumberOfLevels() - 1)) { + int tsize = static_cast(d_tag_buffer.size()); + d_tag_buffer.resize( + d_patch_hierarchy->getMaxNumberOfLevels() - 1, + d_tag_buffer[tsize - 1]); + } + } + + d_barrier_and_time = + input_db->getBoolWithDefault("DEV_barrier_and_time", + d_barrier_and_time); + } } } @@ -1645,8 +1747,8 @@ TimeRefinementIntegrator::getFromInput( * database. * * Data read from restart database: d_start_time, d_end_time, d_grow_dt, - * d_max_integrator_step, d_regrid_interval, d_tag_buffer, - * d_integrator_step, d_dt_max_level, d_dt_actual_level. + * d_max_steps_level[0], d_regrid_interval, d_tag_buffer, + * d_step_level[0], d_dt_max_level, d_dt_actual_level. * ************************************************************************* */ @@ -1658,32 +1760,33 @@ TimeRefinementIntegrator::getFromRestart() boost::shared_ptr restart_db( tbox::RestartManager::getManager()->getRootDatabase()); - boost::shared_ptr db; - if (restart_db->isDatabase(d_object_name)) { - db = restart_db->getDatabase(d_object_name); - } else { + if (!restart_db->isDatabase(d_object_name)) { TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file."); + << d_object_name << " not found in restart file." << std::endl); } + boost::shared_ptr db( + restart_db->getDatabase(d_object_name)); int ver = db->getInteger("ALGS_TIME_REFINEMENT_INTEGRATOR_VERSION"); if (ver != ALGS_TIME_REFINEMENT_INTEGRATOR_VERSION) { TBOX_ERROR( d_object_name << ": " - << "Restart file version different than class version."); + << "Restart file version different than class version." + << std::endl); } - d_start_time = db->getDouble("d_start_time"); - d_end_time = db->getDouble("d_end_time"); - d_grow_dt = db->getDouble("d_grow_dt"); - d_max_integrator_steps = db->getInteger("d_max_integrator_steps"); - d_regrid_interval = db->getIntegerArray("d_regrid_interval"); - d_tag_buffer = db->getIntegerArray("d_tag_buffer"); + d_start_time = db->getDouble("start_time"); + d_end_time = db->getDouble("end_time"); + d_grow_dt = db->getDouble("grow_dt"); + d_max_steps_level[0] = db->getInteger("max_integrator_steps"); + d_regrid_interval = db->getIntegerVector("regrid_interval"); + d_tag_buffer = db->getIntegerVector("tag_buffer"); + d_barrier_and_time = db->getBool("DEV_barrier_and_time"); d_integrator_time = db->getDouble("d_integrator_time"); - d_integrator_step = db->getInteger("d_integrator_step"); + d_step_level[0] = db->getInteger("d_integrator_step"); d_last_finest_level = db->getInteger("d_last_finest_level"); - d_dt_max_level = db->getDoubleArray("d_dt_max_level"); - d_dt_actual_level = db->getDoubleArray("d_dt_actual_level"); + d_dt_max_level = db->getDoubleVector("d_dt_max_level"); + d_dt_actual_level = db->getDoubleVector("d_dt_actual_level"); } /* @@ -1715,4 +1818,3 @@ TimeRefinementIntegrator::finalizeCallback() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.h index df9a6cc3..abd4bf15 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegrator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Time integration manager for AMR with local time stepping. * ************************************************************************/ @@ -14,15 +14,15 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/algs/TimeRefinementLevelStrategy.h" +#include "SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h" #include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -87,61 +87,110 @@ namespace algs { * time integration, data synchronization, and mesh movement are coordinated * properly. * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input data are summarized as follows. + * Input Parameters * - * Required input keys and data types: + * Definitions: + * - \b regrid_interval + * when using synchronized timestepping, number of timesteps between each + * regrid of the hierarchy * * - \b start_time - * double value representing the start time for the simulation. + * start time for the simulation. * * - \b end_time - * double value representing the end time for the simulation. + * end time for the simulation. * * - \b grow_dt - * double value representing the maximum factor by which each - * succesive time increment may grow (typically >= 1.0). + * maximum factor by which each succesive time increment may grow + * (typically >= 1.0). * * - \b max_integrator_steps - * integer value representing the maximum number of timesteps - * performed on the coarsest hierarchy level during the simulation. - * - * - * Optional input keys, data types, and defaults: + * maximum number of timesteps performed on the coarsest hierarchy level + * during the simulation. * * - \b tag_buffer * array of integer values (one for each level that may be refined) * representing the number of cells by which tagged cells are buffered - * before clustering into boxes. If no input is given, a default value - * equal to the number of steps taken on the level before the next - * regrid is used. + * before clustering into boxes. * + * Note that the input values for regrid_interval, end_time, grow_dt, + * max_integrator_steps, and tag_buffer override values read in from restart. * - * Note that the input values for end_time, grow_dt, max_integrator_step, - * and tag_buffer override values read in from restart. + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    regrid_intervalint1>=1optParameter read from restart db may be overridden by input db
    start_timedoublenonestart_time >=0reqMay not be modified by input db on restart
    end_timedoublenoneend_time >= start_timereqParameter read from restart db may be overridden by input db
    grow_dtdouble1.0>0optParameter read from restart db may be overridden by input db
    max_integrator_stepsintnone>=0reqParameter read from restart db may be overridden by input db
    tag_bufferarray of intsregrid_interval value for corresponding levelall values >= 0optParameter read from restart db may be overridden by input db
    * * A sample input file entry might look like: * - * \verbatim - * + * @code * start_time = 0.e0 // initial simulation time * end_time = 10.e0 // final simulation time * grow_dt = 1.1e0 // growth factor for timesteps * max_integrator_steps = 50 // max number of simulation timesteps * tag_buffer = 1,1,1,1 // a max of 4 finer levels in hierarchy + * @endcode * - * \endverbatim - * - * When running in synchronized timestepping mode, an additional input - * key 'regrid_interval' can be added to specify the number of timesteps - * between each regrid of the hierarchy. - * - * @see algs::TimeRefinementLevelStrategy + * @see TimeRefinementLevelStrategy * @see mesh::GriddingAlgorithmStrategy */ -class TimeRefinementIntegrator : +class TimeRefinementIntegrator: public tbox::Serializable { public: @@ -151,32 +200,26 @@ class TimeRefinementIntegrator : * hierarchy. Some data is set to default values; others are read * from the specified input database and the restart database * corresponding to the specified object_name. Consult top of - * this header file for further details. The constructor also - * registers this object for restart using the specified object name - * when the boolean argument is true. Whether object will write its state - * to restart files during program execution is determined by this argument. - * Note that it has a default state of true. + * this header file for further details. * * Note that this object also invokes the variable creation and * registration process in the level strategy. * - * If assertion checking is turned on, an unrecoverable assertion will - * result if any of the input database, patch hierarchy, - * level strategy, or regridding algorithm pointers is null. Assertions - * may also be thrown if any checks for consistency between parameters - * in the gridding algorithm, level strategy, and this object fail. + * @pre !object_name.empty() + * @pre hierarchy + * @pre level_integrator + * @pre gridding_algorithm */ TimeRefinementIntegrator( const std::string& object_name, const boost::shared_ptr& input_db, const boost::shared_ptr& hierarchy, const boost::shared_ptr& level_integrator, - const boost::shared_ptr& gridding_algorithm, - bool register_for_restart = true); + const boost::shared_ptr& gridding_algorithm); /** * The destructor for TimeRefinementIntegrator unregisters - * the integrator object with the restart manager when so registered. + * the integrator object with the restart manager. */ virtual ~TimeRefinementIntegrator(); @@ -198,17 +241,6 @@ class TimeRefinementIntegrator : * initial hierarchy configuration and simulation data is set properly for * the advanceHierarchy() function to be called. In particular, on each * level constructed only the data needed for initialization exists. - * - * When assertion checking is active, the hierachy database pointer - * must be non-null. - * - * The optional argument is only to be used for a special case - * where the user wishes to manually specify a decomposition for - * the coarsest level of the hierarchy. The BoxLevel - * argument must be a decomposition of the the coarsest level, and - * must exactly fill the index space of the physical domain of the - * hierarchy. If omitted or given an uninitialized - * mapped_box_level, the standard decomposition method is used. */ double initializeHierarchy(); @@ -234,6 +266,8 @@ class TimeRefinementIntegrator : * the new simulation time (where this synchronization process is defined * by the level strategy). Thus, the data is set properly for any * subsequent calls to this function. + * + * @pre dt >= 0 */ double advanceHierarchy( @@ -246,6 +280,9 @@ class TimeRefinementIntegrator : * if both the level allows refinement and the step count is an * integer multiple of the regrid step interval. * Otherwise, false is returned. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ bool atRegridPoint( @@ -285,7 +322,7 @@ class TimeRefinementIntegrator : int getIntegratorStep() const { - return d_integrator_step; + return d_step_level[0]; } /** @@ -295,13 +332,16 @@ class TimeRefinementIntegrator : int getMaxIntegratorSteps() const { - return d_max_integrator_steps; + return d_max_steps_level[0]; } /** * Return true if any steps remain in current step sequence on level * (i.e., before it will synchronize with some coarser level). * Return false otherwise. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ bool stepsRemaining( @@ -309,7 +349,11 @@ class TimeRefinementIntegrator : { TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - return d_step_level[level_number] < d_max_steps_level[level_number]; + if (level_number == 0) { + return !d_level_0_advanced; + } else { + return d_step_level[level_number] < d_max_steps_level[level_number]; + } } /** @@ -318,11 +362,14 @@ class TimeRefinementIntegrator : bool stepsRemaining() const { - return d_integrator_step < d_max_integrator_steps; + return d_step_level[0] < d_max_steps_level[0]; } /** * Return current time increment used to advance level. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ double getLevelDtActual( @@ -335,6 +382,9 @@ class TimeRefinementIntegrator : /** * Return maximum time increment currently allowed on level. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ double getLevelDtMax( @@ -347,6 +397,9 @@ class TimeRefinementIntegrator : /** * Return current simulation time for level. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ double getLevelSimTime( @@ -359,6 +412,9 @@ class TimeRefinementIntegrator : /** * Return step count for current integration sequence on level. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ int getLevelStep( @@ -366,12 +422,19 @@ class TimeRefinementIntegrator : { TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - return d_step_level[level_number]; + if (level_number == 0) { + return d_level_0_advanced ? 1 : 0; + } else { + return d_step_level[level_number]; + } } /** * Return maximum number of time steps allowed on level in * current integration step sequence. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ int getLevelMaxSteps( @@ -379,7 +442,11 @@ class TimeRefinementIntegrator : { TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - return d_max_steps_level[level_number]; + if (level_number == 0) { + return 1; + } else { + return d_max_steps_level[level_number]; + } } /** @@ -412,6 +479,9 @@ class TimeRefinementIntegrator : /** * Return true if current step on level is first in current step * sequence; otherwise return false. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ bool firstLevelStep( @@ -419,12 +489,19 @@ class TimeRefinementIntegrator : { TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - return d_step_level[level_number] <= 0; + if (level_number == 0) { + return !d_level_0_advanced; + } else { + return d_step_level[level_number] <= 0; + } } /** * Return true if current step on level is last in current step * sequence; otherwise return false. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ bool lastLevelStep( @@ -432,22 +509,22 @@ class TimeRefinementIntegrator : { TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); - return d_step_level[level_number] >= d_max_steps_level[level_number]; + if (level_number == 0) { + return d_level_0_advanced; + } else { + return d_step_level[level_number] >= d_max_steps_level[level_number]; + } } /** - * set the regrid interval to a new value. This may only be used + * Set the regrid interval to a new value. This may only be used * when using synchronized timestepping. + * + * @pre !d_use_refined_timestepping */ void setRegridInterval( - const int regrid_interval) - { - TBOX_ASSERT(!d_use_refined_timestepping); - for (int i = 0; i < d_regrid_interval.getSize(); i++) { - d_regrid_interval[i] = regrid_interval; - } - } + const int regrid_interval); /** * Print data representation of this object to given output stream. @@ -458,6 +535,9 @@ class TimeRefinementIntegrator : /** * Print time stepping data for a single level to given output stream. + * + * @pre (level_number >= 0) && + * (level_number <= getPatchHierarchy()->getFinestLevelNumber()) */ void printDataForLevel( @@ -465,13 +545,13 @@ class TimeRefinementIntegrator : const int level_number) const; /** - * Write object state out to the given database. + * Write object state out to the given restart database. * - * When assertion checking is active, the database pointer must be non-null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Returns the object name. @@ -545,9 +625,9 @@ class TimeRefinementIntegrator : const int level_number) const; /* - * Read input data from specified database and initialize class members. - * The argument is_from_restart should be set to true if the simulation - * is from restart. Otherwise, it should be set to false. + * Read input data from specified input database and initialize class + * members. The argument is_from_restart should be set to true if the + * simulation is from restart. Otherwise, it should be set to false. * * If the simulation is not from restart, read in start_time, end_time, * grow_dt, max_integrator_step, and possibly tag_buffer @@ -556,12 +636,10 @@ class TimeRefinementIntegrator : * If the simulation is from restart, then only read in end_time, * grow_dt, max_integrator_step and tag_buffer if they are * found in the input database. - * - * When assertion checking is active, the databse pointer must be non-null. */ virtual void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); /* @@ -583,11 +661,9 @@ class TimeRefinementIntegrator : /* * The object name is used as a handle to databases stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. + * restart files and for error reporting purposes. */ std::string d_object_name; - bool d_registered_for_restart; /* * Pointers to the patch hierarchy, level integration and gridding @@ -610,7 +686,6 @@ class TimeRefinementIntegrator : double d_start_time; double d_end_time; double d_grow_dt; - int d_max_integrator_steps; /* * The regrid interval indicates the number of integration steps taken @@ -625,7 +700,7 @@ class TimeRefinementIntegrator : * that for level 1. In the future, users may be able to specify * this value in the input file. */ - tbox::Array d_regrid_interval; + std::vector d_regrid_interval; /* * The tag buffer indicates the number of cells on each level by which @@ -641,26 +716,29 @@ class TimeRefinementIntegrator : * be taken to assure that improper tag buffering will not degrade the * calculation. */ - tbox::Array d_tag_buffer; + std::vector d_tag_buffer; /* * Integrator data that evolves during time integration and maintains * the state of the timestep sequence over the levels in the AMR hierarchy. */ double d_integrator_time; - int d_integrator_step; bool d_just_regridded; int d_last_finest_level; - tbox::Array d_level_old_old_time; - tbox::Array d_level_old_time; - tbox::Array d_level_sim_time; - tbox::Array d_dt_max_level; - tbox::Array d_dt_actual_level; - tbox::Array d_step_level; - tbox::Array d_max_steps_level; + std::vector d_level_old_old_time; + std::vector d_level_old_time; + std::vector d_level_sim_time; + std::vector d_dt_max_level; + std::vector d_dt_actual_level; + std::vector d_step_level; + std::vector d_max_steps_level; + bool d_level_0_advanced; + bool d_hierarchy_advanced; double d_dt; + TimeRefinementIntegratorConnectorWidthRequestor d_connector_width_requestor; + bool d_barrier_and_time; /* @@ -673,7 +751,7 @@ class TimeRefinementIntegrator : // The following are not implemented: TimeRefinementIntegrator( const TimeRefinementIntegrator&); - void + TimeRefinementIntegrator& operator = ( const TimeRefinementIntegrator&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.C new file mode 100644 index 00000000..1d95a7a5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.C @@ -0,0 +1,81 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: TimeRefinementIntegrator's implementation of PatchHierarchy::ConnectorWidthRequestorStrategy + * + ************************************************************************/ +#include "SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h" + +#include "SAMRAI/tbox/Utilities.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace algs { + +/* + ************************************************************************** + ************************************************************************** + */ +TimeRefinementIntegratorConnectorWidthRequestor::TimeRefinementIntegratorConnectorWidthRequestor() +{ +} + +/* + ************************************************************************** + * Compute Connector widths that this class requires in order to work + * properly on a given hierarchy. + * + * The only TimeRefinementIntegrator requirement is enough + * self_connector_widths to fill the tag buffer that the integrator + * passes to its GriddingAlgorithm. For some reason, this ghost width + * was not registered at the time the required Connector widths are + * computed. This appeared to be by design (see how it uses + * GriddingAlgorithm::resetTagBufferingData), so I didn't change it, + * but it probably should be redesigned. Filling the tag data ghosts + * doesn't use recursive refine schedules, so it has no effect on the + * fine_connector_widths. --BTNG. + ************************************************************************** + */ +void +TimeRefinementIntegratorConnectorWidthRequestor::computeRequiredConnectorWidths( + std::vector& self_connector_widths, + std::vector& fine_connector_widths, + const hier::PatchHierarchy& patch_hierarchy) const +{ + const tbox::Dimension& dim(patch_hierarchy.getDim()); + const int max_levels(patch_hierarchy.getMaxNumberOfLevels()); + + fine_connector_widths.resize(max_levels - 1, hier::IntVector::getZero(dim)); + self_connector_widths.clear(); + self_connector_widths.reserve(max_levels); + for (size_t ln = 0; ln < static_cast(max_levels); ++ln) { + hier::IntVector buffer( + dim, + d_tag_buffer.size() > ln ? d_tag_buffer[ln] : d_tag_buffer.back()); + self_connector_widths.push_back(buffer); + } +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +TimeRefinementIntegratorConnectorWidthRequestor::setTagBuffer( + const std::vector& tag_buffer) +{ + d_tag_buffer = tag_buffer; +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h new file mode 100644 index 00000000..36fe380a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h @@ -0,0 +1,75 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: TimeRefinementIntegrator's implementation of PatchHierarchy::ConnectorWidthRequestorStrategy + * + ************************************************************************/ + +#ifndef included_mesh_TimeRefinementIntegratorConnectorWidthRequestor +#define included_mesh_TimeRefinementIntegratorConnectorWidthRequestor + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/PatchHierarchy.h" + +namespace SAMRAI { +namespace algs { + +/*! + * @brief Implementation of the strategy class + * hier::PatchHierarchy::ConnectorWidthRequestorStrategy to tell the + * hier::PatchHierarchy how wide TimeRefinementIntegrator needs Connectors + * between hierarchy levels to be. + */ +class TimeRefinementIntegratorConnectorWidthRequestor: + public hier::PatchHierarchy::ConnectorWidthRequestorStrategy +{ + +public: + /*! + * @brief Constructor. + */ + TimeRefinementIntegratorConnectorWidthRequestor(); + + /*! + * @brief Compute Connector widths that this class requires in + * order to work properly on a given hierarchy. + * + * Implements the pure virtual method + * hier::PatchHierarchy::ConnectorWidthRequestorStrategy::computeRequiredConnectorWidths() + * + * @param[out] self_connector_widths Array of widths for Connectors + * from a level to itself. + * + * @param[out] fine_connector_widths Array of widths for Connectors + * from a level to the next finer level. + * + * @param[in] patch_hierarchy + */ + void + computeRequiredConnectorWidths( + std::vector& self_connector_widths, + std::vector& fine_connector_widths, + const hier::PatchHierarchy& patch_hierarchy) const; + + /*! + * @brief Plan to specify enough Connector width to support the + * given tag buffer. + * + * This is only used by the TimeRefinementIntegrator that owns this object. + */ + void + setTagBuffer( + const std::vector& tag_buffer); + +private: + std::vector d_tag_buffer; + +}; + +} +} +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.C index fa37caf6..2347fa44 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to level routines for time-refinement integrator. * ************************************************************************/ - -#ifndef included_algs_TimeRefinementLevelStrategy_C -#define included_algs_TimeRefinementLevelStrategy_C - #include "SAMRAI/algs/TimeRefinementLevelStrategy.h" namespace SAMRAI { @@ -34,4 +30,3 @@ TimeRefinementLevelStrategy::~TimeRefinementLevelStrategy() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.h index 154d3764..8535edc6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/TimeRefinementLevelStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to level routines for time-refinement integrator. * ************************************************************************/ @@ -12,14 +12,15 @@ #define included_algs_TimeRefinementLevelStrategy #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" + +#include namespace SAMRAI { namespace algs { @@ -38,7 +39,7 @@ namespace algs { * a concrete implementation of this base class by passing the concrete * object into the to the time refinement integrator constructor. * - * @see algs::TimeRefinementIntegrator + * @see TimeRefinementIntegrator */ class TimeRefinementLevelStrategy @@ -211,7 +212,7 @@ class TimeRefinementLevelStrategy const int coarsest_level, const int finest_level, const double sync_time, - const tbox::Array& old_times) = 0; + const std::vector& old_times) = 0; /** * Synchronize specified levels after regridding has occurred or during diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual.dox index 9e160d45..abd033f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_femutils.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_femutils.dox index 2ce05ab0..6e7a284f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_femutils.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_femutils.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_hyperbolic.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_hyperbolic.dox index 84567f73..21061948 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_hyperbolic.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_hyperbolic.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_implicit.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_implicit.dox index 5d3df472..de21d07c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_implicit.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_implicit.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_method_of_lines.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_method_of_lines.dox index b4f14bc3..7aca410e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_method_of_lines.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_method_of_lines.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_time_refinement.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_time_refinement.dox index fa28c237..37e0787e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_time_refinement.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/dox/manual_time_refinement.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.depend index 1524962d..1f1d70f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,57 +14,60 @@ FILE_0=algs_nodeouternodeops2d.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - algs_nodeouternodeops2d.f + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + algs_nodeouternodeops2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=algs_nodeouternodeops3d.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - algs_nodeouternodeops3d.f + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + algs_nodeouternodeops3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=algs_upfluxsum1d.o DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h algs_upfluxsum1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + algs_upfluxsum1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=algs_upfluxsum2d.o DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h algs_upfluxsum2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + algs_upfluxsum2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=algs_upfluxsum3d.o DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h algs_upfluxsum3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + algs_upfluxsum3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.in index a485b8f1..bfe8a940 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/Makefile.in @@ -3,27 +3,53 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for algs directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/algs/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. -OBJS= algs_upfluxsum1d.o algs_upfluxsum2d.o algs_upfluxsum3d.o\ - algs_nodeouternodeops2d.o algs_nodeouternodeops3d.o\ - default: library include $(OBJECT)/config/Makefile.config -library: $(OBJS) +OBJS= algs_upfluxsum1d.o \ + algs_upfluxsum2d.o \ + algs_upfluxsum3d.o \ + algs_nodeouternodeops2d.o \ + algs_nodeouternodeops3d.o + +library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) + $(RM) *.f include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +algs_upfluxsum1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/algs_upfluxsum1d.m4 > algs_upfluxsum1d.f + $(F77) $(FFLAGS) -c algs_upfluxsum1d.f -o $@ + +algs_upfluxsum2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/algs_upfluxsum2d.m4 > algs_upfluxsum2d.f + $(F77) $(FFLAGS) -c algs_upfluxsum2d.f -o $@ + +algs_upfluxsum3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/algs_upfluxsum3d.m4 > algs_upfluxsum3d.f + $(F77) $(FFLAGS) -c algs_upfluxsum3d.f -o $@ + +algs_nodeouternodeops2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/algs_nodeouternodeops2d.m4 > algs_nodeouternodeops2d.f + $(F77) $(FFLAGS) -c algs_nodeouternodeops2d.f -o $@ + +algs_nodeouternodeops3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/algs_nodeouternodeops3d.m4 > algs_nodeouternodeops3d.f + $(F77) $(FFLAGS) -c algs_nodeouternodeops3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.f deleted file mode 100644 index 45fe539c..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.f +++ /dev/null @@ -1,230 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI algs -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: F77 routines for summing outernode data with -c other node or outernode data -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c - - - -c -c*********************************************************************** -c Sum node data on fine patch with outernode data on coarse patch -c and store back in node data on fine patch. -c i.e. fine_node_data += coarse_outernode_data -c*********************************************************************** -c - subroutine nodeouternodesum2d( - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & depth, - & ngc0,ngc1, - & fnode, - & couternodelower0,couternodeupper0, - & couternodelower1,couternodeupper1) -c*********************************************************************** - implicit none - - integer - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1 - integer ratio(0:2-1), depth - integer ngc0,ngc1 - double precision - & fnode(filo0-ngc0:fihi0+1+ngc0, - & filo1-ngc1:fihi1+1+ngc1,depth), - & couternodelower0(cilo1+1:cihi1,depth), - & couternodeupper0(cilo1+1:cihi1,depth), - & couternodelower1(cilo0:cihi0+1,depth), - & couternodeupper1(cilo0:cihi0+1,depth) - integer ic0,if0,ic1,if1,id - integer cilo0_loop,cilo1_loop,cihi0_loop,cihi1_loop -c -c*********************************************************************** -c - -c sum along XLOWER side - cilo1_loop=cilo1+1 - cihi1_loop=cihi1 - - if0=cilo0*ratio(0) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - fnode(if0,if1,id) = fnode(if0,if1,id) + - & couternodelower0(ic1,id) - enddo - enddo - -c sum along XUPPER side - cilo1_loop=cilo1+1 - cihi1_loop=cihi1 - - if0=(cihi0+1)*ratio(0) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - fnode(if0,if1,id) = fnode(if0,if1,id) + - & couternodeupper0(ic1,id) - enddo - enddo - -c sum along YLOWER side - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - - if1=cilo1*ratio(1) - do id = 1, depth - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,id) = fnode(if0,if1,id) + - & couternodelower1(ic0,id) - enddo - enddo - -c sum along YUPPER side - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - - if1=(cihi1+1)*ratio(1) - do id = 1, depth - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,id) = fnode(if0,if1,id) + - & couternodeupper1(ic0,id) - enddo - enddo - -c - return - end - -c -c*********************************************************************** -c Fill hanging nodes on fine patch (i.e. those nodes that do not overlap -c a coarse level node) along patch boundary by interpolation from -c appropriate neighboring coarse nodes -c*********************************************************************** -c - subroutine nodehangnodeinterp2d( - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & bboxilo0,bboxilo1,bboxihi0,bboxihi1, - & bboxloc, - & ratio, - & depth, - & ngc0,ngc1, - & fnode) -c*********************************************************************** - implicit none - - integer XLOWER,XUPPER,YLOWER,YUPPER - parameter (XLOWER=0) - parameter (XUPPER=1) - parameter (YLOWER=2) - parameter (YUPPER=3) - - double precision one - parameter (one=1.0d0) -c*********************************************************************** -c - integer - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1 - integer bboxilo0,bboxilo1,bboxihi0,bboxihi1,bboxloc - integer ratio(0:2-1),depth - integer ngc0,ngc1 - double precision - & fnode(filo0-ngc0:fihi0+1+ngc0, - & filo1-ngc1:fihi1+1+ngc1,depth) - integer ic0,if0,ir0,ic1,if1,ir1,id - integer cilo0_loop,cilo1_loop,cihi0_loop,cihi1_loop - double precision dratio0,dratio1,x0,x1 -c -c*********************************************************************** -c - dratio0 = dble(ratio(0)) - dratio1 = dble(ratio(1)) - - cilo0_loop=max(cilo0, bboxilo0) - cihi0_loop=min(cihi0, bboxihi0) - cilo1_loop=max(cilo1, bboxilo1) - cihi1_loop=min(cihi1, bboxihi1) -c -c*********************************************************************** -c - if (bboxloc.eq.XLOWER) then - - if0=cilo0*ratio(0) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - fnode(if0,if1+ir1,id) = - & fnode(if0,if1,id) * (one - x1) + - & fnode(if0,if1+ratio(1),id) * x1 - enddo - enddo - enddo - - else if (bboxloc.eq.XUPPER) then - - if0=(cihi0+1)*ratio(0) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - fnode(if0,if1+ir1,id) = - & fnode(if0,if1,id) * (one - x1) + - & fnode(if0,if1+ratio(1),id) * x1 - enddo - enddo - enddo - - else if (bboxloc.eq.YLOWER) then - - if1=cilo1*ratio(1) - do id = 1, depth - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(if0+ir0,if1,id) = - & fnode(if0,if1,id) * (one - x0) + - & fnode(if0+ratio(0),if1,id) * x0 - enddo - enddo - enddo - - else if (bboxloc.eq.YUPPER) then - - if1=(cihi1+1)*ratio(1) - do id = 1, depth - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(if0+ir0,if1,id) = - & fnode(if0,if1,id) * (one - x0) + - & fnode(if0+ratio(0),if1,id) * x0 - enddo - enddo - enddo - - endif -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.m4 index 3248bf67..9fa0dc23 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops2d.m4 @@ -1,15 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI algs -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: F77 routines for summing outernode data with -c other node or outernode data +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for summing outernode data with other node or +c outernode data. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl define(do_cfsum_along_patch_side,`dnl do id = 1, depth diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.f deleted file mode 100644 index bf311578..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.f +++ /dev/null @@ -1,619 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI algs -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: F77 routines for summing outernode data with -c other node or outernode data -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c - - - - - - - - - -c -c*********************************************************************** -c Sum node data on fine patch with outernode data on coarse patch -c and store back in node data on fine patch. -c i.e. fine_node_data += coarse_outernode_data -c*********************************************************************** -c - subroutine nodeouternodesum3d( - & filo0,filo1,filo2, - & fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2, - & cihi0,cihi1,cihi2, - & ratio, - & depth, - & ngc0,ngc1,ngc2, - & fnode, - & couternodelower0,couternodeupper0, - & couternodelower1,couternodeupper1, - & couternodelower2,couternodeupper2) -c*********************************************************************** - implicit none - - integer - & filo0,filo1,filo2, - & fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2, - & cihi0,cihi1,cihi2 - integer ratio(0:3-1),depth - integer ngc0,ngc1,ngc2 - double precision - & fnode(filo0-ngc0:fihi0+1+ngc0, - & filo1-ngc1:fihi1+1+ngc1, - & filo2-ngc2:fihi2+1+ngc2,depth), - & couternodelower0(cilo1+1:cihi1, - & cilo2+1:cihi2,depth), - & couternodeupper0(cilo1+1:cihi1, - & cilo2+1:cihi2,depth), - & couternodelower1(cilo0:cihi0+1, - & cilo2+1:cihi2,depth), - & couternodeupper1(cilo0:cihi0+1, - & cilo2+1:cihi2,depth), - & couternodelower2(cilo0:cihi0+1, - & cilo1:cihi1+1,depth), - & couternodeupper2(cilo0:cihi0+1, - & cilo1:cihi1+1,depth) - integer ic0,if0,ic1,if1,ic2,if2,id - integer cilo0_loop,cilo1_loop,cilo2_loop, - & cihi0_loop,cihi1_loop,cihi2_loop -c -c*********************************************************************** -c - -c sum along XLOWER face - cilo1_loop=cilo1+1 - cihi1_loop=cihi1 - cilo2_loop=cilo2+1 - cihi2_loop=cihi2 - - if0=cilo0*ratio(0) - do id = 1, depth - do ic2=cilo2_loop,cihi2_loop - if2=ic2*ratio(2) - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodelower0(ic1,ic2,id) - enddo - enddo - enddo - -c sum along XUPPER face - cilo1_loop=cilo1+1 - cihi1_loop=cihi1 - cilo2_loop=cilo2+1 - cihi2_loop=cihi2 - - if0=(cihi0+1)*ratio(0) - do id = 1, depth - do ic2=cilo2_loop,cihi2_loop - if2=ic2*ratio(2) - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodeupper0(ic1,ic2,id) - enddo - enddo - enddo - -c sum along YLOWER face - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - cilo2_loop=cilo2+1 - cihi2_loop=cihi2 - - if1=cilo1*ratio(1) - do id = 1, depth - do ic2=cilo2_loop,cihi2_loop - if2=ic2*ratio(2) - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodelower1(ic0,ic2,id) - enddo - enddo - enddo - -c sum along YUPPER face - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - cilo2_loop=cilo2+1 - cihi2_loop=cihi2 - - if1=(cihi1+1)*ratio(1) - do id = 1, depth - do ic2=cilo2_loop,cihi2_loop - if2=ic2*ratio(2) - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodeupper1(ic0,ic2,id) - enddo - enddo - enddo - -c sum along ZLOWER face - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - cilo1_loop=cilo1 - cihi1_loop=cihi1+1 - - if2=cilo2*ratio(2) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodelower2(ic0,ic1,id) - enddo - enddo - enddo - -c sum along ZUPPER face - cilo0_loop=cilo0 - cihi0_loop=cihi0+1 - cilo1_loop=cilo1 - cihi1_loop=cihi1+1 - - if2=(cihi2+1)*ratio(2) - do id = 1, depth - do ic1=cilo1_loop,cihi1_loop - if1=ic1*ratio(1) - do ic0=cilo0_loop,cihi0_loop - if0=ic0*ratio(0) - fnode(if0,if1,if2,id) = fnode(if0,if1,if2,id) + - & couternodeupper2(ic0,ic1,id) - enddo - enddo - enddo - -c - return - end -c - -c -c*********************************************************************** -c Fill hanging nodes on fine patch (i.e. those nodes that do not overlap -c a coarse level node) along patch boundary by interpolation from -c appropriate neighboring coarse nodes. -c*********************************************************************** -c - subroutine nodehangnodeinterp3d( - & filo0,filo1,filo2, - & fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2, - & cihi0,cihi1,cihi2, - & bboxilo0,bboxilo1,bboxilo2, - & bboxihi0,bboxihi1,bboxihi2, - & bboxloc, - & ratio, - & depth, - & ngc0,ngc1,ngc2, - & fnode) -c*********************************************************************** - implicit none - - integer XLOWER,XUPPER,YLOWER,YUPPER,ZLOWER,ZUPPER - parameter (XLOWER=0) - parameter (XUPPER=1) - parameter (YLOWER=2) - parameter (YUPPER=3) - parameter (ZLOWER=4) - parameter (ZUPPER=5) - - double precision one - parameter (one=1.0d0) - -c*********************************************************************** - integer - & filo0,filo1,filo2, - & fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2, - & cihi0,cihi1,cihi2 - integer - & bboxilo0,bboxilo1,bboxilo2, - & bboxihi0,bboxihi1,bboxihi2, - & bboxloc - integer ratio(0:3-1),depth - integer ngc0,ngc1,ngc2 - double precision - & fnode(filo0-ngc0:fihi0+1+ngc0, - & filo1-ngc1:fihi1+1+ngc1, - & filo2-ngc2:fihi2+1+ngc2,depth) - integer ic0,if0,ir0,ic1,if1,ir1,ic2,if2,ir2,id - integer iflower0,iflower1,iflower2,ifupper0,ifupper1,ifupper2 - integer cilo0_loop,cilo1_loop,cilo2_loop, - & cihi0_loop,cihi1_loop,cihi2_loop - double precision dratio0,dratio1,dratio2,x0,x1,x2 -c -c*********************************************************************** -c - - dratio0 = dble(ratio(0)) - dratio1 = dble(ratio(1)) - dratio2 = dble(ratio(2)) - - cilo0_loop=max(cilo0, bboxilo0) - cihi0_loop=min(cihi0, bboxihi0) - cilo1_loop=max(cilo1, bboxilo1) - cihi1_loop=min(cihi1, bboxihi1) - cilo2_loop=max(cilo2, bboxilo2) - cihi2_loop=min(cihi2, bboxihi2) - - if (bboxloc.eq.XLOWER) then - - if0=cilo0*ratio(0) - - do id = 1, depth - -c interpolate nodes along lines in y-direction - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic2=cilo2_loop,cihi2_loop+1 - if2=ic2*ratio(2) - fnode(if0,iflower1+ir1,if2,id) = - & fnode(if0,ifupper1,if2,id) * x1 - & + fnode(if0,iflower1,if2,id) * (one-x1) - enddo - enddo - enddo - -c interpolate nodes along lines in z-direction - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic1=cilo1_loop,cihi1_loop+1 - if1=ic1*ratio(1) - fnode(if0,if1,iflower2+ir2,id) = - & fnode(if0,if1,ifupper2,id) * x2 - & + fnode(if0,if1,iflower2,id) * (one-x2) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - fnode(if0,iflower1+ir1,iflower2+ir2,id) = - & (fnode(if0,iflower1,iflower2,id) * (one-x1) + - & fnode(if0,ifupper1,iflower2,id) * x1) * (one-x2) + - & (fnode(if0,iflower1,ifupper2,id) * (one-x1) + - & fnode(if0,ifupper1,ifupper2,id) * x1) * x2 - enddo - enddo - enddo - enddo - - enddo - - else if (bboxloc.eq.XUPPER) then - - if0=(cihi0+1)*ratio(0) - - do id = 1, depth - -c interpolate nodes along lines in y-direction - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic2=cilo2_loop,cihi2_loop+1 - if2=ic2*ratio(2) - fnode(if0,iflower1+ir1,if2,id) = - & fnode(if0,ifupper1,if2,id) * x1 - & + fnode(if0,iflower1,if2,id) * (one-x1) - enddo - enddo - enddo - -c interpolate nodes along lines in z-direction - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic1=cilo1_loop,cihi1_loop+1 - if1=ic1*ratio(1) - fnode(if0,if1,iflower2+ir2,id) = - & fnode(if0,if1,ifupper2,id) * x2 - & + fnode(if0,if1,iflower2,id) * (one-x2) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - fnode(if0,iflower1+ir1,iflower2+ir2,id) = - & (fnode(if0,iflower1,iflower2,id) * (one-x1) + - & fnode(if0,ifupper1,iflower2,id) * x1) * (one-x2) + - & (fnode(if0,iflower1,ifupper2,id) * (one-x1) + - & fnode(if0,ifupper1,ifupper2,id) * x1) * x2 - enddo - enddo - enddo - enddo - - enddo - - else if (bboxloc.eq.YLOWER) then - - if1=cilo1*ratio(1) - - do id = 1, depth - -c interpolate nodes along lines in x-direction - do ic2=cilo2_loop,cihi2_loop+1 - if2=ic2*ratio(2) - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,if2,id) = - & fnode(ifupper0,if1,if2,id) * x0 - & + fnode(iflower0,if1,if2,id) * (one-x0) - enddo - enddo - enddo - -c interpolate nodes along lines in z-direction - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic0=cilo0_loop,cihi0_loop+1 - if0=ic0*ratio(0) - fnode(if0,if1,iflower2+ir2,id) = - & fnode(if0,if1,ifupper2,id) * x2 - & + fnode(if0,if1,iflower2,id) * (one-x2) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,iflower2+ir2,id) = - & (fnode(iflower0,if1,iflower2,id) * (one-x0) + - & fnode(ifupper0,if1,iflower2,id) * x0) * (one-x2) + - & (fnode(iflower0,if1,ifupper2,id) * (one-x0) + - & fnode(ifupper0,if1,ifupper2,id) * x0) * x2 - enddo - enddo - enddo - enddo - - enddo - - else if (bboxloc.eq.YUPPER) then - - if1=(cihi1+1)*ratio(1) - - do id = 1, depth - -c interpolate nodes along lines in x-direction - do ic2=cilo2_loop,cihi2_loop+1 - if2=ic2*ratio(2) - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,if2,id) = - & fnode(ifupper0,if1,if2,id) * x0 - & + fnode(iflower0,if1,if2,id) * (one-x0) - enddo - enddo - enddo - -c interpolate nodes along lines in z-direction - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic0=cilo0_loop,cihi0_loop+1 - if0=ic0*ratio(0) - fnode(if0,if1,iflower2+ir2,id) = - & fnode(if0,if1,ifupper2,id) * x2 - & + fnode(if0,if1,iflower2,id) * (one-x2) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic2=cilo2_loop,cihi2_loop - iflower2=ic2*ratio(2) - ifupper2=iflower2+ratio(2) - do ir2=1,ratio(2)-1 - x2 = dble(ir2)/dratio2 - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,iflower2+ir2,id) = - & (fnode(iflower0,if1,iflower2,id) * (one-x0) + - & fnode(ifupper0,if1,iflower2,id) * x0) * (one-x2) + - & (fnode(iflower0,if1,ifupper2,id) * (one-x0) + - & fnode(ifupper0,if1,ifupper2,id) * x0) * x2 - enddo - enddo - enddo - enddo - - enddo - - else if (bboxloc.eq.ZLOWER) then - - if2=cilo2*ratio(2) - - do id = 1, depth - -c interpolate nodes along lines in x-direction - do ic1=cilo1_loop,cihi1_loop+1 - if1=ic1*ratio(1) - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,if2,id) = - & fnode(ifupper0,if1,if2,id) * x0 - & + fnode(iflower0,if1,if2,id) * (one-x0) - enddo - enddo - enddo - -c interpolate nodes along lines in y-direction - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic0=cilo0_loop,cihi0_loop+1 - if0=ic0*ratio(0) - fnode(if0,iflower1+ir1,if2,id) = - & fnode(if0,ifupper1,if2,id) * x1 - & + fnode(if0,iflower1,if2,id) * (one-x1) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,iflower1+ir1,if2,id) = - & (fnode(iflower0,iflower1,if2,id) * (one-x0) + - & fnode(ifupper0,iflower1,if2,id) * x0) * (one-x1) + - & (fnode(iflower0,ifupper1,if2,id) * (one-x0) + - & fnode(ifupper0,ifupper1,if2,id) * x0) * x1 - enddo - enddo - enddo - enddo - - enddo - - else if (bboxloc.eq.ZUPPER) then - - if2=(cihi2+1)*ratio(2) - - do id = 1, depth - -c interpolate nodes along lines in x-direction - do ic1=cilo1_loop,cihi1_loop+1 - if1=ic1*ratio(1) - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,if1,if2,id) = - & fnode(ifupper0,if1,if2,id) * x0 - & + fnode(iflower0,if1,if2,id) * (one-x0) - enddo - enddo - enddo - -c interpolate nodes along lines in y-direction - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic0=cilo0_loop,cihi0_loop+1 - if0=ic0*ratio(0) - fnode(if0,iflower1+ir1,if2,id) = - & fnode(if0,ifupper1,if2,id) * x1 - & + fnode(if0,iflower1,if2,id) * (one-x1) - enddo - enddo - enddo - -c interpolate face nodes in coarse cell interiors - do ic1=cilo1_loop,cihi1_loop - iflower1=ic1*ratio(1) - ifupper1=iflower1+ratio(1) - do ir1=1,ratio(1)-1 - x1 = dble(ir1)/dratio1 - do ic0=cilo0_loop,cihi0_loop - iflower0=ic0*ratio(0) - ifupper0=iflower0+ratio(0) - do ir0=1,ratio(0)-1 - x0 = dble(ir0)/dratio0 - fnode(iflower0+ir0,iflower1+ir1,if2,id) = - & (fnode(iflower0,iflower1,if2,id) * (one-x0) + - & fnode(ifupper0,iflower1,if2,id) * x0) * (one-x1) + - & (fnode(iflower0,ifupper1,if2,id) * (one-x0) + - & fnode(ifupper0,ifupper1,if2,id) * x0) * x1 - enddo - enddo - enddo - enddo - - enddo - - endif -c - return - end -c - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.m4 index 9fb942da..f4572a69 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_nodeouternodeops3d.m4 @@ -1,15 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI algs -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: F77 routines for summing outernode data with -c other node or outernode data +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for summing outernode data with other node or +c outernode data. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl define(do_cfsum_along_patch_face,`dnl do id = 1, depth diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.f deleted file mode 100644 index 96294c68..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.f +++ /dev/null @@ -1,48 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 1d flux sums from fluxes. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c - subroutine upfluxsum1d( - & ilo0,ihi0, - & flxgc0, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ihi0, - & flxgc0, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0), - & fluxsum(1) - integer ie0 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie0 = ilo0 - else - ie0 = ihi0+1 - endif - - fluxsum(1)=fluxsum(1)+flux(ie0) -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.m4 index ffb6d94b..98e1ef1a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum1d.m4 @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 1d flux sums from fluxes. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for updating 1d flux sums from fluxes. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl c c*********************************************************************** c Add flux integrals to fluxsums diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.f deleted file mode 100644 index cc901220..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.f +++ /dev/null @@ -1,151 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 2d flux sums from fluxes. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c - subroutine upfluxsumface2d0( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1), - & fluxsum(ilo1:ihi1) - integer ie0,ic1 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie0 = ilo0 - else - ie0 = ihi0+1 - endif - - do ic1=ilo1,ihi1 - fluxsum(ic1)=fluxsum(ic1)+flux(ie0,ic1) - enddo -c - return - end -c - subroutine upfluxsumface2d1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - double precision - & flux(ilo1-flxgc1:ihi1+1+flxgc1, - & ilo0-flxgc0:ihi0+flxgc0), - & fluxsum(ilo0:ihi0) - integer ie1,ic0 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie1 = ilo1 - else - ie1 = ihi1+1 - endif - - do ic0=ilo0,ihi0 - fluxsum(ic0)=fluxsum(ic0)+flux(ie1,ic0) - enddo -c - return - end -c - subroutine upfluxsumside2d0( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1), - & fluxsum(ilo1:ihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - if (iface.eq.0) then - ic0 = ilo0 - else - ic0 = ihi0+1 - endif - - do ic1=ilo1,ihi1 - fluxsum(ic1)=fluxsum(ic1)+flux(ic0,ic1) - enddo -c - return - end -c - subroutine upfluxsumside2d1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+1+flxgc1), - & fluxsum(ilo0:ihi0) - integer ic1,ic0 -c -c*********************************************************************** -c - if (iface.eq.0) then - ic1 = ilo1 - else - ic1 = ihi1+1 - endif - - do ic0=ilo0,ihi0 - fluxsum(ic0)=fluxsum(ic0)+flux(ic0,ic1) - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.m4 index 0ad6f20d..bce47b38 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum2d.m4 @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 2d flux sums from fluxes. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for updating 2d flux sums from fluxes. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c c*********************************************************************** c Add flux integrals to fluxsums diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.f deleted file mode 100644 index 51837b88..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.f +++ /dev/null @@ -1,242 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 3d flux sums from fluxes. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -c -c - subroutine upfluxsumface3d0( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo1:ihi1, - & ilo2:ihi2) - integer ie0,ic1,ic2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie0 = ilo0 - else - ie0 = ihi0+1 - endif - - do ic2=ilo2,ihi2 - do ic1=ilo1,ihi1 - fluxsum(ic1,ic2)=fluxsum(ic1,ic2)+flux(ie0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumface3d1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo1-flxgc1:ihi1+1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2, - & ilo0-flxgc0:ihi0+flxgc0), - & fluxsum(ilo2:ihi2, - & ilo0:ihi0) - integer ie1,ic2,ic0 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie1 = ilo1 - else - ie1 = ihi1+1 - endif - - do ic0=ilo0,ihi0 - do ic2=ilo2,ihi2 - fluxsum(ic2,ic0)=fluxsum(ic2,ic0)+flux(ie1,ic2,ic0) - enddo - enddo -c - return - end -c - subroutine upfluxsumface3d2( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo2-flxgc2:ihi2+1+flxgc2, - & ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1), - & fluxsum(ilo0:ihi0, - & ilo1:ihi1) - integer ie2,ic0,ic1 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie2 = ilo2 - else - ie2 = ihi2+1 - endif - - do ic1=ilo1,ihi1 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic1)=fluxsum(ic0,ic1)+flux(ie2,ic0,ic1) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d0( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo1:ihi1, - & ilo2:ihi2) - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic0 = ilo0 - else - ic0 = ihi0+1 - endif - - do ic2=ilo2,ihi2 - do ic1=ilo1,ihi1 - fluxsum(ic1,ic2)=fluxsum(ic1,ic2)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo2:ihi2) - integer ic1,ic0,ic2 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic1 = ilo1 - else - ic1 = ihi1+1 - endif - - do ic2=ilo2,ihi2 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic2)=fluxsum(ic0,ic2)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d2( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+1+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo1:ihi1) - integer ic2,ic0,ic1 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic2 = ilo2 - else - ic2 = ihi2+1 - endif - - do ic1=ilo1,ihi1 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic1)=fluxsum(ic0,ic1)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.m4 index e2b2e7cc..badfbc3c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/algs/fortran/algs_upfluxsum3d.m4 @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 3d flux sums from fluxes. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for updating 3d flux sums from fluxes. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c c*********************************************************************** c Add flux integrals to fluxsums diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.C index b118a6af..502a5865 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for processing user-defined boundary data in * CartesianBoundaryUtilities classes * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.h index 9be7935a..dae042e5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/BoundaryUtilityStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for processing user-defined boundary data in * CartesianBoundaryUtilities classes * @@ -17,7 +17,7 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -37,8 +37,8 @@ namespace appu { * definitions that apply for the various boundary types, locations, * and boundary conditions. * - * @see appu::CartesianBoundaryUtilities2 - * @see appu::CartesianBoundaryUtilities3 + * @see CartesianBoundaryUtilities2 + * @see CartesianBoundaryUtilities3 */ class BoundaryUtilityStrategy @@ -65,7 +65,8 @@ class BoundaryUtilityStrategy * @param bdry_location_index Integer index for location of edge (in 2d) * or face (in 3d) boundary. */ - virtual void readDirichletBoundaryDataEntry( + virtual void + readDirichletBoundaryDataEntry( const boost::shared_ptr& db, std::string& db_name, int bdry_location_index) = 0; @@ -79,7 +80,8 @@ class BoundaryUtilityStrategy * @param bdry_location_index Integer index for location of edge (in 2d) * or face (in 3d) boundary. */ - virtual void readNeumannBoundaryDataEntry( + virtual void + readNeumannBoundaryDataEntry( const boost::shared_ptr& db, std::string& db_name, int bdry_location_index) = 0; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryDefines.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryDefines.h index 3a600e71..033ea5b1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryDefines.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryDefines.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Defines for boundary condition integer constants * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.C index 5b0913db..59ce3b9d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility routines for manipulating 2D Cartesian boundary data * ************************************************************************/ @@ -33,17 +33,17 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(stufcartbdryloc2d, STUFCARTBDRYLOC2D) (const int&, const int&, +void SAMRAI_F77_FUNC(stufcartbdryloc2d, STUFCARTBDRYLOC2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); -void F77_FUNC(stufcartbdrycond2d, STUFCARTBDRYCOND2D) (const int&, const int&, +void SAMRAI_F77_FUNC(stufcartbdrycond2d, STUFCARTBDRYCOND2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); -void F77_FUNC(getcartedgebdry2d, GETCARTEDGEBDRY2D) (const int&, const int&, +void SAMRAI_F77_FUNC(getcartedgebdry2d, GETCARTEDGEBDRY2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +55,7 @@ void F77_FUNC(getcartedgebdry2d, GETCARTEDGEBDRY2D) (const int&, const int&, double *, const int&); -void F77_FUNC(getcartnodebdry2d, GETCARTNODEBDRY2D) (const int&, const int&, +void SAMRAI_F77_FUNC(getcartnodebdry2d, GETCARTNODEBDRY2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -103,30 +103,34 @@ bool CartesianBoundaryUtilities2::s_fortran_constants_stuffed = false; */ void -CartesianBoundaryUtilities2::readBoundaryInput( +CartesianBoundaryUtilities2::getFromInput( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(2)); - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_2D_NODES); + + if (!input_db) { + TBOX_ERROR(": CartesianBoundaryUtility2::getFromInput()\n" + << "no input database supplied" << std::endl); + } if (!s_fortran_constants_stuffed) { stuff2dBdryFortConst(); } read2dBdryEdges(bdry_strategy, - bdry_db, + input_db, edge_conds, periodic); - read2dBdryNodes(bdry_db, + read2dBdryNodes(input_db, edge_conds, node_conds, periodic); @@ -153,16 +157,17 @@ CartesianBoundaryUtilities2::fillEdgeBoundaryData( const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values) + const std::vector& bdry_edge_conds, + const std::vector& bdry_edge_values) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); + TBOX_ASSERT(static_cast(bdry_edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(bdry_edge_values.size()) == + NUM_2D_EDGES * (vardata->getDepth())); TBOX_DIM_ASSERT(ghost_fill_width.getDim() == tbox::Dimension(2)); - TBOX_DIM_ASSERT_CHECK_ARGS3(*vardata, patch, ghost_fill_width); + TBOX_ASSERT_OBJDIM_EQUALITY3(*vardata, patch, ghost_fill_width); NULL_USE(varname); @@ -171,8 +176,9 @@ CartesianBoundaryUtilities2::fillEdgeBoundaryData( } const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const hier::Box& interior(patch.getBox()); @@ -184,9 +190,9 @@ CartesianBoundaryUtilities2::fillEdgeBoundaryData( hier::IntVector gcw_to_fill(hier::IntVector::min(ghost_cells, ghost_fill_width)); - const tbox::Array& edge_bdry = + const std::vector& edge_bdry = pgeom->getCodimensionBoundaries(Bdry::EDGE2D); - for (int i = 0; i < edge_bdry.getSize(); i++) { + for (int i = 0; i < static_cast(edge_bdry.size()); ++i) { TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE2D); @@ -198,7 +204,7 @@ CartesianBoundaryUtilities2::fillEdgeBoundaryData( const hier::Index& ibeg(fill_box.lower()); const hier::Index& iend(fill_box.upper()); - F77_FUNC(getcartedgebdry2d, GETCARTEDGEBDRY2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(getcartedgebdry2d, GETCARTEDGEBDRY2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ibeg(0), iend(0), ibeg(1), iend(1), @@ -206,7 +212,7 @@ CartesianBoundaryUtilities2::fillEdgeBoundaryData( dx, bedge_loc, bdry_edge_conds[bedge_loc], - bdry_edge_values.getPointer(), + &bdry_edge_values[0], vardata->getPointer(), vardata->getDepth()); @@ -234,16 +240,17 @@ CartesianBoundaryUtilities2::fillNodeBoundaryData( const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values) + const std::vector& bdry_node_conds, + const std::vector& bdry_edge_values) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_2D_NODES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); + TBOX_ASSERT(static_cast(bdry_node_conds.size()) == NUM_2D_NODES); + TBOX_ASSERT(static_cast(bdry_edge_values.size()) == + NUM_2D_EDGES * (vardata->getDepth())); TBOX_DIM_ASSERT(ghost_fill_width.getDim() == tbox::Dimension(2)); - TBOX_DIM_ASSERT_CHECK_ARGS3(*vardata, patch, ghost_fill_width); + TBOX_ASSERT_OBJDIM_EQUALITY3(*vardata, patch, ghost_fill_width); NULL_USE(varname); @@ -252,8 +259,9 @@ CartesianBoundaryUtilities2::fillNodeBoundaryData( } const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const hier::Box& interior(patch.getBox()); @@ -265,9 +273,9 @@ CartesianBoundaryUtilities2::fillNodeBoundaryData( hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, ghost_fill_width); - const tbox::Array& node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(Bdry::NODE2D); - for (int i = 0; i < node_bdry.getSize(); i++) { + for (int i = 0; i < static_cast(node_bdry.size()); ++i) { TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE2D); @@ -279,7 +287,7 @@ CartesianBoundaryUtilities2::fillNodeBoundaryData( const hier::Index& ibeg(fill_box.lower()); const hier::Index& iend(fill_box.upper()); - F77_FUNC(getcartnodebdry2d, GETCARTNODEBDRY2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(getcartnodebdry2d, GETCARTNODEBDRY2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ibeg(0), iend(0), ibeg(1), iend(1), @@ -287,7 +295,7 @@ CartesianBoundaryUtilities2::fillNodeBoundaryData( dx, bnode_loc, bdry_node_conds[bnode_loc], - bdry_edge_values.getPointer(), + &bdry_edge_values[0], vardata->getPointer(), vardata->getDepth()); @@ -383,14 +391,14 @@ CartesianBoundaryUtilities2::checkBdryData( const hier::IntVector& gcw_to_check, const hier::BoundaryBox& bbox, int bcase, - double bstate) + const double& bstate) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(data_id >= 0); TBOX_ASSERT(depth >= 0); TBOX_DIM_ASSERT(gcw_to_check.getDim() == tbox::Dimension(2)); - TBOX_DIM_ASSERT_CHECK_ARGS3(patch, gcw_to_check, bbox); + TBOX_ASSERT_OBJDIM_EQUALITY3(patch, gcw_to_check, bbox); int num_bad_values = 0; @@ -398,12 +406,14 @@ CartesianBoundaryUtilities2::checkBdryData( int bloc = bbox.getLocationIndex(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(data_id))); + TBOX_ASSERT(vardata); std::string bdry_type_str; if (btype == Bdry::EDGE2D) { @@ -424,7 +434,7 @@ CartesianBoundaryUtilities2::checkBdryData( tbox::plog << "btype, bloc, bcase = " << btype << ", = " << bloc << ", = " << bcase << std::endl; - int idir; + tbox::Dimension::dir_t idir; double valfact = 0.0, constval = 0.0, dxfact = 0.0; int offsign; @@ -497,30 +507,31 @@ CartesianBoundaryUtilities2::checkBdryData( hier::Index ilast(vardata->getBox().upper()); if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); + cbox.setLower(idir, ifirst(idir) - 1); + cbox.setUpper(idir, ifirst(idir) - 1); + dbox.setLower(idir, ifirst(idir)); + dbox.setUpper(idir, ifirst(idir)); } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); + cbox.setLower(idir, ilast(idir) + 1); + cbox.setUpper(idir, ilast(idir) + 1); + dbox.setLower(idir, ilast(idir)); + dbox.setUpper(idir, ilast(idir)); } - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { + pdat::CellIterator id(pdat::CellGeometry::begin(dbox)); + pdat::CellIterator icend(pdat::CellGeometry::end(cbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(cbox)); + ic != icend; ++ic) { double checkval = valfact * (*vardata)(*id, depth) + constval; pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { + for (int p = 0; p < gbox_to_check.numberCells(idir); ++p) { double offcheckval = checkval + dxfact * (p + 1); #ifdef __INTEL_COMPILER #pragma warning (disable:1572) #endif if ((*vardata)(check, depth) != offcheckval) { - num_bad_values++; + ++num_bad_values; TBOX_WARNING("Bad " << bdry_type_str << " boundary value for " << varname << " found in cell " << check @@ -543,24 +554,24 @@ CartesianBoundaryUtilities2::checkBdryData( void CartesianBoundaryUtilities2::read2dBdryEdges( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, + const boost::shared_ptr& input_db, + std::vector& edge_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(2)); - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < 2; ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < 2) { // face boundary input required - for (int s = 0; s < NUM_2D_EDGES; s++) { + for (int s = 0; s < NUM_2D_EDGES; ++s) { std::string bdry_loc_str; switch (s) { @@ -589,41 +600,27 @@ CartesianBoundaryUtilities2::read2dBdryEdges( } if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - std::string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - edge_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - edge_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - edge_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else if (bdry_cond_str == "NEUMANN") { - edge_conds[s] = BdryCond::NEUMANN; - bdry_strategy-> - readNeumannBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << std::endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << std::endl); - } - } + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + std::string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "FLOW") { + edge_conds[s] = BdryCond::FLOW; + } else if (bdry_cond_str == "REFLECT") { + edge_conds[s] = BdryCond::REFLECT; + } else if (bdry_cond_str == "DIRICHLET") { + edge_conds[s] = BdryCond::DIRICHLET; + bdry_strategy->readDirichletBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); + } else if (bdry_cond_str == "NEUMANN") { + edge_conds[s] = BdryCond::NEUMANN; + bdry_strategy->readNeumannBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << std::endl); + TBOX_ERROR("Unknown edge boundary string = " + << bdry_cond_str << " found in input." << std::endl); } } // if (need_data_read) @@ -639,25 +636,25 @@ CartesianBoundaryUtilities2::read2dBdryEdges( void CartesianBoundaryUtilities2::read2dBdryNodes( - const boost::shared_ptr& bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + const std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(2)); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_2D_NODES); int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < 2; ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < 1) { // node boundary data required - for (int s = 0; s < NUM_2D_NODES; s++) { + for (int s = 0; s < NUM_2D_NODES; ++s) { std::string bdry_loc_str; switch (s) { @@ -680,157 +677,144 @@ CartesianBoundaryUtilities2::read2dBdryNodes( default: NULL_STATEMENT; } - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - std::string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - node_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - node_conds[s] = BdryCond::YNEUMANN; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << std::endl); - } - - std::string proper_edge; - std::string proper_edge_data; - bool no_edge_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || - s == NodeBdyLoc2D::XLO_YHI) { - proper_edge = "XLO"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - edge_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_edge_data_found = true; - proper_edge_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "XHI"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - edge_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_edge_data_found = true; - proper_edge_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || - s == NodeBdyLoc2D::XHI_YLO) { - proper_edge = "YLO"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - edge_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_edge_data_found = true; - proper_edge_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "YHI"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - edge_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_edge_data_found = true; - proper_edge_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } - if (no_edge_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_edge_data - << " data found for edge " - << proper_edge << std::endl); - } - - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << std::endl); + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + std::string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + node_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + node_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "XREFLECT") { + node_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + node_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + node_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + node_conds[s] = BdryCond::YDIRICHLET; + } else if (bdry_cond_str == "XNEUMANN") { + node_conds[s] = BdryCond::XNEUMANN; + } else if (bdry_cond_str == "YNEUMANN") { + node_conds[s] = BdryCond::YNEUMANN; + } else { + TBOX_ERROR("Unknown node boundary string = " + << bdry_cond_str << " found in input." << std::endl); + } + + std::string proper_edge; + std::string proper_edge_data; + bool no_edge_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN" || + bdry_cond_str == "XREFLECT") { + if (s == NodeBdyLoc2D::XLO_YLO || + s == NodeBdyLoc2D::XLO_YHI) { + proper_edge = "XLO"; + if (bdry_cond_str == "XFLOW" && + edge_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + edge_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + edge_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { + no_edge_data_found = true; + proper_edge_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + edge_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } else { + proper_edge = "XHI"; + if (bdry_cond_str == "XFLOW" && + edge_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + edge_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + edge_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { + no_edge_data_found = true; + proper_edge_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + edge_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; } } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << std::endl); + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN" || + bdry_cond_str == "YREFLECT") { + if (s == NodeBdyLoc2D::XLO_YLO || + s == NodeBdyLoc2D::XHI_YLO) { + proper_edge = "YLO"; + if (bdry_cond_str == "YFLOW" && + edge_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + edge_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + edge_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { + no_edge_data_found = true; + proper_edge_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + edge_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } else { + proper_edge = "YHI"; + if (bdry_cond_str == "YFLOW" && + edge_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + edge_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + edge_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { + no_edge_data_found = true; + proper_edge_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + edge_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } + } + if (no_edge_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_edge_data + << " data found for edge " + << proper_edge << std::endl); } } // for (int s = 0 ... @@ -846,7 +830,7 @@ CartesianBoundaryUtilities2::read2dBdryNodes( void CartesianBoundaryUtilities2::get2dBdryDirectionCheckValues( - int& idir, + tbox::Dimension::dir_t& idir, int& offsign, int btype, int bloc, @@ -923,10 +907,10 @@ CartesianBoundaryUtilities2::get2dBdryDirectionCheckValues( void CartesianBoundaryUtilities2::stuff2dBdryFortConst() { - F77_FUNC(stufcartbdryloc2d, STUFCARTBDRYLOC2D) (BdryLoc::XLO, BdryLoc::XHI, + SAMRAI_F77_FUNC(stufcartbdryloc2d, STUFCARTBDRYLOC2D) (BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, NodeBdyLoc2D::XLO_YLO, NodeBdyLoc2D::XHI_YLO, NodeBdyLoc2D::XLO_YHI, NodeBdyLoc2D::XHI_YHI); - F77_FUNC(stufcartbdrycond2d, STUFCARTBDRYCOND2D) (BdryCond::FLOW, + SAMRAI_F77_FUNC(stufcartbdrycond2d, STUFCARTBDRYCOND2D) (BdryCond::FLOW, BdryCond::XFLOW, BdryCond::YFLOW, BdryCond::REFLECT, BdryCond::XREFLECT, BdryCond::YREFLECT, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.h index 40120b4a..1fcf7e35 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities2.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility routines for manipulating Cartesian 2d boundary data * ************************************************************************/ @@ -19,11 +19,11 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace appu { @@ -38,6 +38,8 @@ namespace appu { * capabilities, or use the input reading, boundary setting, and error * checking routines independently. * + * Input Parameters + * * To use the boundary condition input reading capabilities, the format * of the input file section containing the boundary information must * be as described next. Boundary node and edge entries are only @@ -46,39 +48,33 @@ namespace appu { * * The boundary condition for edge "*" is provided in a section as follows: * - * \verbatim - * + * @code * boundary_edge_* { - * boundary_condition = ... // boundary condition std::string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... + * boundary_condition = ... // boundary condition string identifier * } + * @endcode * - * Allowable edge identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi - * Supported edge boundary_condition strin values are: + * Allowable edge identifiers (i.e., values for "*") are:
    + * xlo, xhi, ylo, yhi
    + * Supported edge boundary_condition string values are:
    * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" * - * \endverbatim - * * The boundary condition for node "*" is provided in a section as follows: * - * \verbatim - * + * @code * boundary_node_* { - * boundary_condition = ... // boundary condition std::string identifier + * boundary_condition = ... // boundary condition string identifier * } + * @endcode * - * Allowable node identifiers (i.e., values for "*") are: - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition std::string values are: + * Allowable node identifiers (i.e., values for "*") are:
    + * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi
    + * Supported node boundary_condition string values are:
    * "XFLOW", "YFLOW", * "XREFLECT", "YREFLECT", * "XDIRICHLET", "YDIRICHLET", * "XNEUMANN", "YNEUMANN" * - * \endverbatim - * * Note that node conditions must be consistent with adjacent edge conditions. * * See the include file CartesianBoundaryDefines.h for integer constant @@ -91,7 +87,7 @@ namespace appu { * inconsistencies between C++ and FORTRAN usage. Please see the * FORTRAN include file cartbdryparams2d.i for details. * - * @see appu::BoundaryUtilityStrategy2 + * @see BoundaryUtilityStrategy2 */ struct CartesianBoundaryUtilities2 { @@ -119,21 +115,27 @@ struct CartesianBoundaryUtilities2 { * * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN * conditions - * @param bdry_db input database containing all boundary data - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read + * @param input_db input database containing all boundary data + * @param edge_conds array into which integer edge boundary condition + * types are read + * @param node_conds array into which integer node boundary condition + * types are read * @param periodic integer vector specifying which coordinate * directions are periodic (e.g., value returned from * GridGeometry2::getPeriodicShift()) + * + * @pre input_db + * @pre periodic.getDim() == tbox::Dimension(2) + * @pre bdry_strategy != 0 + * @pre edge_conds.size() == NUM_2D_EDGES + * @pre node_conds.size() == NUM_2D_NODES */ static void - readBoundaryInput( + getFromInput( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic); /*! @@ -147,8 +149,18 @@ struct CartesianBoundaryUtilities2 { * @param vardata Cell-centered patch data object to fill. * @param patch hier::Patch on which data object lives. * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. + * @param bdry_edge_conds tbox::Array of boundary condition types for + * patch edges. + * @param bdry_edge_values tbox::Array of boundary values for patch + * edges. + * + * @pre !varname.empty()); + * @pre vardata + * @pre bdry_edge_conds.size() == NUM_2D_EDGES + * @pre bdry_edge_values.size() == NUM_2D_EDGES * (vardata->getDepth()) + * @pre ghost_fill_width.getDim() == tbox::Dimension(2) + * @pre (vardata->getDim() == patch.getDim()) && + * (vardata->getDim() == ghost_fill_width.getDim()) */ static void fillEdgeBoundaryData( @@ -156,8 +168,8 @@ struct CartesianBoundaryUtilities2 { const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values); + const std::vector& bdry_edge_conds, + const std::vector& bdry_edge_values); /*! * Function to fill 2d node boundary values for a patch. @@ -170,8 +182,18 @@ struct CartesianBoundaryUtilities2 { * @param vardata Cell-centered patch data object to fill. * @param patch hier::Patch on which data object lives. * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. + * @param bdry_node_conds tbox::Array of boundary condition types for + * patch nodes. + * @param bdry_edge_values tbox::Array of boundary values for patch + * edges. + * + * @pre !varname.empty() + * @pre vardata + * @pre bdry_node_conds.size() == NUM_2D_NODES + * @pre bdry_edge_values.size() == NUM_2D_EDGES * (vardata->getDepth()) + * @pre ghost_fill_width.getDim() == tbox::Dimension(2) + * @pre (vardata->getDim() == patch.getDim()) && + * (vardata->getDim() == ghost_fill_width.getDim()) */ static void fillNodeBoundaryData( @@ -179,8 +201,8 @@ struct CartesianBoundaryUtilities2 { const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values); + const std::vector& bdry_node_conds, + const std::vector& bdry_edge_values); /*! * Function that returns the integer edge boundary location @@ -191,10 +213,20 @@ struct CartesianBoundaryUtilities2 { * or the boundary condition type is inconsistant with the node location * an error results. * - * @return Integer edge location for node location and boundary condition type. + * @return Integer edge location for node location and boundary condition + * type. * * @param node_loc Integer location for node. * @param node_btype Integer boundary condition type for node. + * + * @pre (node_btype == BdryCond::XFLOW) || + * (node_btype == BdryCond::XREFLECT) || + * (node_btype == BdryCond::XDIRICHLET) || + * (node_btype == BdryCond::XNEUMANN) || + * (node_btype == BdryCond::YFLOW) || + * (node_btype == BdryCond::YREFLECT) || + * (node_btype == BdryCond::YDIRICHLET) || + * (node_btype == BdryCond::YNEUMANN) */ static int getEdgeLocationForNodeBdry( @@ -219,7 +251,27 @@ struct CartesianBoundaryUtilities2 { * @param gcw_to_check Width of ghost region to check. * @param bbox Boundary box to check. * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. + * @param bstate Boundary value that applies in DIRICHLET or NEUMANN + * case. + * + * @pre !varname.empty() + * @pre data_id >= 0 + * @pre depth >= 0 + * @pre gcw_to_check.getDim() == tbox::Dimension(2) + * @pre (patch.getDim() == gcw_to_check.getDim()) && + * (patch.getDim() == bbox.getDim()) + * @pre (bbox.getBoundaryType() == Bdry::EDGE2D) || + * (bbox.getBoundaryType() == Bdry::NODE2D) + * @pre ((bbox.getBoundaryType() == Bdry::EDGE2D) && + * ((bcase == BdryCond::FLOW) || (bcase == BdryCond::REFLECT) || + * (bcase == BdryCond::DIRICHLET) || + * (bcase == BdryCond::NEUMANN))) || + * ((bbox.getBoundaryType() == Bdry::NODE2D) && + * ((bcase == BdryCond::XFLOW) || (bcase == BdryCond::YFLOW) || + * (bcase == BdryCond::XREFLECT) || (bcase == BdryCond::YREFLECT) || + * (bcase == BdryCond::XDIRICHLET) || + * (bcase == BdryCond::YDIRICHLET) || + * (bcase == BdryCond::XNEUMANN) || (bcase == BdryCond::YNEUMANN))) */ static int checkBdryData( @@ -230,7 +282,7 @@ struct CartesianBoundaryUtilities2 { const hier::IntVector& gcw_to_check, const hier::BoundaryBox& bbox, int bcase, - double bstate); + const double& bstate); private: static bool s_fortran_constants_stuffed; @@ -238,20 +290,20 @@ struct CartesianBoundaryUtilities2 { static void read2dBdryEdges( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, + const boost::shared_ptr& input_db, + std::vector& edge_conds, const hier::IntVector& periodic); static void read2dBdryNodes( - const boost::shared_ptr& bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + const std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic); static void get2dBdryDirectionCheckValues( - int& idir, + tbox::Dimension::dir_t& idir, int& offsign, int btype, int bloc, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.C index 4aa75edb..a806799e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility routines for manipulating 3D Cartesian boundary data * ************************************************************************/ @@ -34,7 +34,7 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) (const int&, const int&, +void SAMRAI_F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -43,7 +43,7 @@ void F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); -void F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) (const int&, +void SAMRAI_F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +52,7 @@ void F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) (const int&, const int&, const int&, const int&, const int&); -void F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) (const int&, const int&, +void SAMRAI_F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +66,7 @@ void F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) (const int&, const int&, double *, const int&); -void F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) (const int&, const int&, +void SAMRAI_F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -80,7 +80,7 @@ void F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) (const int&, const int&, double *, const int&); -void F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) (const int&, const int&, +void SAMRAI_F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -121,7 +121,7 @@ bool CartesianBoundaryUtilities3::s_fortran_constants_stuffed = false; * * Arguments are: * bdry_strategy .... object that reads DIRICHLET or NEUMANN conditions - * bdry_db .......... input database containing all boundary data + * input_db ......... input database containing all boundary data * face_conds ....... array into which integer boundary conditions * for faces are read * edge_conds ....... array into which integer boundary conditions @@ -134,37 +134,41 @@ bool CartesianBoundaryUtilities3::s_fortran_constants_stuffed = false; */ void -CartesianBoundaryUtilities3::readBoundaryInput( +CartesianBoundaryUtilities3::getFromInput( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + std::vector& face_conds, + std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(3)); - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_3D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_3D_NODES); + + if (!input_db) { + TBOX_ERROR(": CartesianBoundaryUtility3::getFromInput()\n" + << "no input database supplied" << std::endl); + } if (!s_fortran_constants_stuffed) { stuff3dBdryFortConst(); } read3dBdryFaces(bdry_strategy, - bdry_db, + input_db, face_conds, periodic); - read3dBdryEdges(bdry_db, + read3dBdryEdges(input_db, face_conds, edge_conds, periodic); - read3dBdryNodes(bdry_db, + read3dBdryNodes(input_db, face_conds, node_conds, periodic); @@ -191,16 +195,17 @@ CartesianBoundaryUtilities3::fillFaceBoundaryData( const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values) + const std::vector& bdry_face_conds, + const std::vector& bdry_face_values) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); + TBOX_ASSERT(static_cast(bdry_face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(bdry_face_values.size()) == + NUM_3D_FACES * (vardata->getDepth())); TBOX_DIM_ASSERT(ghost_fill_width.getDim() == tbox::Dimension(3)); - TBOX_DIM_ASSERT_CHECK_ARGS3(*vardata, patch, ghost_fill_width); + TBOX_ASSERT_OBJDIM_EQUALITY3(*vardata, patch, ghost_fill_width); NULL_USE(varname); @@ -209,8 +214,9 @@ CartesianBoundaryUtilities3::fillFaceBoundaryData( } const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const hier::Box& interior(patch.getBox()); @@ -222,9 +228,9 @@ CartesianBoundaryUtilities3::fillFaceBoundaryData( hier::IntVector gcw_to_fill(hier::IntVector::min(ghost_cells, ghost_fill_width)); - const tbox::Array& face_bdry = + const std::vector& face_bdry = pgeom->getCodimensionBoundaries(Bdry::FACE3D); - for (int i = 0; i < face_bdry.getSize(); i++) { + for (int i = 0; i < static_cast(face_bdry.size()); ++i) { TBOX_ASSERT(face_bdry[i].getBoundaryType() == Bdry::FACE3D); @@ -236,7 +242,7 @@ CartesianBoundaryUtilities3::fillFaceBoundaryData( const hier::Index& ibeg(fill_box.lower()); const hier::Index& iend(fill_box.upper()); - F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), ibeg(0), iend(0), @@ -246,7 +252,7 @@ CartesianBoundaryUtilities3::fillFaceBoundaryData( dx, bface_loc, bdry_face_conds[bface_loc], - bdry_face_values.getPointer(), + &bdry_face_values[0], vardata->getPointer(), vardata->getDepth()); @@ -274,16 +280,17 @@ CartesianBoundaryUtilities3::fillEdgeBoundaryData( const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values) + const std::vector& bdry_edge_conds, + const std::vector& bdry_face_values) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); + TBOX_ASSERT(static_cast(bdry_edge_conds.size()) == NUM_3D_EDGES); + TBOX_ASSERT(static_cast(bdry_face_values.size()) == + NUM_3D_FACES * (vardata->getDepth())); TBOX_DIM_ASSERT(ghost_fill_width.getDim() == tbox::Dimension(3)); - TBOX_DIM_ASSERT_CHECK_ARGS3(*vardata, patch, ghost_fill_width); + TBOX_ASSERT_OBJDIM_EQUALITY3(*vardata, patch, ghost_fill_width); NULL_USE(varname); @@ -292,8 +299,9 @@ CartesianBoundaryUtilities3::fillEdgeBoundaryData( } const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const hier::Box& interior(patch.getBox()); @@ -305,9 +313,9 @@ CartesianBoundaryUtilities3::fillEdgeBoundaryData( hier::IntVector gcw_to_fill(hier::IntVector::min(ghost_cells, ghost_fill_width)); - const tbox::Array& edge_bdry = + const std::vector& edge_bdry = pgeom->getCodimensionBoundaries(Bdry::EDGE3D); - for (int i = 0; i < edge_bdry.getSize(); i++) { + for (int i = 0; i < static_cast(edge_bdry.size()); ++i) { TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE3D); @@ -319,7 +327,7 @@ CartesianBoundaryUtilities3::fillEdgeBoundaryData( const hier::Index& ibeg(fill_box.lower()); const hier::Index& iend(fill_box.upper()); - F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), ibeg(0), iend(0), @@ -329,7 +337,7 @@ CartesianBoundaryUtilities3::fillEdgeBoundaryData( dx, bedge_loc, bdry_edge_conds[bedge_loc], - bdry_face_values.getPointer(), + &bdry_face_values[0], vardata->getPointer(), vardata->getDepth()); @@ -357,16 +365,17 @@ CartesianBoundaryUtilities3::fillNodeBoundaryData( const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values) + const std::vector& bdry_node_conds, + const std::vector& bdry_face_values) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_3D_NODES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); + TBOX_ASSERT(static_cast(bdry_node_conds.size()) == NUM_3D_NODES); + TBOX_ASSERT(static_cast(bdry_face_values.size()) == + NUM_3D_FACES * (vardata->getDepth())); TBOX_DIM_ASSERT(ghost_fill_width.getDim() == tbox::Dimension(3)); - TBOX_DIM_ASSERT_CHECK_ARGS3(*vardata, patch, ghost_fill_width); + TBOX_ASSERT_OBJDIM_EQUALITY3(*vardata, patch, ghost_fill_width); NULL_USE(varname); @@ -375,8 +384,9 @@ CartesianBoundaryUtilities3::fillNodeBoundaryData( } const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const hier::Box& interior(patch.getBox()); @@ -388,9 +398,9 @@ CartesianBoundaryUtilities3::fillNodeBoundaryData( hier::IntVector gcw_to_fill(hier::IntVector::min(ghost_cells, ghost_fill_width)); - const tbox::Array& node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(Bdry::NODE3D); - for (int i = 0; i < node_bdry.getSize(); i++) { + for (int i = 0; i < static_cast(node_bdry.size()); ++i) { TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE3D); @@ -402,7 +412,7 @@ CartesianBoundaryUtilities3::fillNodeBoundaryData( const hier::Index& ibeg(fill_box.lower()); const hier::Index& iend(fill_box.upper()); - F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), ibeg(0), iend(0), @@ -412,7 +422,7 @@ CartesianBoundaryUtilities3::fillNodeBoundaryData( dx, bnode_loc, bdry_node_conds[bnode_loc], - bdry_face_values.getPointer(), + &bdry_face_values[0], vardata->getPointer(), vardata->getDepth()); @@ -620,14 +630,14 @@ CartesianBoundaryUtilities3::checkBdryData( const hier::IntVector& gcw_to_check, const hier::BoundaryBox& bbox, int bcase, - double bstate) + const double& bstate) { TBOX_ASSERT(!varname.empty()); TBOX_ASSERT(data_id >= 0); TBOX_ASSERT(depth >= 0); TBOX_DIM_ASSERT(gcw_to_check.getDim() == tbox::Dimension(3)); - TBOX_DIM_ASSERT_CHECK_ARGS3(patch, gcw_to_check, bbox); + TBOX_ASSERT_OBJDIM_EQUALITY3(patch, gcw_to_check, bbox); int num_bad_values = 0; @@ -635,12 +645,14 @@ CartesianBoundaryUtilities3::checkBdryData( int bloc = bbox.getLocationIndex(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(data_id))); + TBOX_ASSERT(vardata); std::string bdry_type_str; if (btype == Bdry::FACE3D) { @@ -663,7 +675,7 @@ CartesianBoundaryUtilities3::checkBdryData( tbox::plog << "btype, bloc, bcase = " << btype << ", = " << bloc << ", = " << bcase << std::endl; - int idir; + tbox::Dimension::dir_t idir; double valfact = 0.0, constval = 0.0, dxfact = 0.0; int offsign; @@ -771,28 +783,29 @@ CartesianBoundaryUtilities3::checkBdryData( hier::Index ilast(vardata->getBox().upper()); if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); + cbox.setLower(idir, ifirst(idir) - 1); + cbox.setUpper(idir, ifirst(idir) - 1); + dbox.setLower(idir, ifirst(idir)); + dbox.setUpper(idir, ifirst(idir)); } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); + cbox.setLower(idir, ilast(idir) + 1); + cbox.setUpper(idir, ilast(idir) + 1); + dbox.setLower(idir, ilast(idir)); + dbox.setUpper(idir, ilast(idir)); } - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { + pdat::CellIterator id(pdat::CellGeometry::begin(dbox)); + pdat::CellIterator icend(pdat::CellGeometry::end(cbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(cbox)); + ic != icend; ++ic) { double checkval = valfact * (*vardata)(*id, depth) + constval; pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { + for (int p = 0; p < gbox_to_check.numberCells(idir); ++p) { double offcheckval = checkval + dxfact * (p + 1); if (!tbox::MathUtilities::equalEps((*vardata)(check, depth), offcheckval)) { - num_bad_values++; + ++num_bad_values; TBOX_WARNING("Bad " << bdry_type_str << " boundary value for " << varname << " found in cell " << check @@ -815,24 +828,24 @@ CartesianBoundaryUtilities3::checkBdryData( void CartesianBoundaryUtilities3::read3dBdryFaces( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, + const boost::shared_ptr& input_db, + std::vector& face_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(3)); - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < 3) { // face boundary input required - for (int s = 0; s < NUM_3D_FACES; s++) { + for (int s = 0; s < NUM_3D_FACES; ++s) { std::string bdry_loc_str; switch (s) { @@ -869,41 +882,27 @@ CartesianBoundaryUtilities3::read3dBdryFaces( } if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - std::string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - face_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - face_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - face_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else if (bdry_cond_str == "NEUMANN") { - face_conds[s] = BdryCond::NEUMANN; - bdry_strategy-> - readNeumannBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown face boundary string = " - << bdry_cond_str << " found in input." << std::endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << std::endl); - } - } + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + std::string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "FLOW") { + face_conds[s] = BdryCond::FLOW; + } else if (bdry_cond_str == "REFLECT") { + face_conds[s] = BdryCond::REFLECT; + } else if (bdry_cond_str == "DIRICHLET") { + face_conds[s] = BdryCond::DIRICHLET; + bdry_strategy->readDirichletBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); + } else if (bdry_cond_str == "NEUMANN") { + face_conds[s] = BdryCond::NEUMANN; + bdry_strategy->readNeumannBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << std::endl); + TBOX_ERROR("Unknown face boundary string = " + << bdry_cond_str << " found in input." << std::endl); } } // if (need_data_read) @@ -919,25 +918,25 @@ CartesianBoundaryUtilities3::read3dBdryFaces( void CartesianBoundaryUtilities3::read3dBdryEdges( - const boost::shared_ptr& bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, + const boost::shared_ptr& input_db, + const std::vector& face_conds, + std::vector& edge_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(3)); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_3D_EDGES); int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < 2) { // edge boundary input required - for (int s = 0; s < NUM_3D_EDGES; s++) { + for (int s = 0; s < NUM_3D_EDGES; ++s) { std::string bdry_loc_str; switch (s) { @@ -1016,258 +1015,246 @@ CartesianBoundaryUtilities3::read3dBdryEdges( } if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - std::string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - edge_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - edge_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - edge_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - edge_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - edge_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - edge_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - edge_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - edge_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - edge_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - edge_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - edge_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - edge_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << std::endl); - } - - bool ambiguous_type = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XREFLECT" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN") { - if (s == EdgeBdyLoc3D::YLO_ZLO || - s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || - s == EdgeBdyLoc3D::YHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YREFLECT" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_ZLO || - s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XHI_ZLO || - s == EdgeBdyLoc3D::XHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZREFLECT" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_YLO || - s == EdgeBdyLoc3D::XHI_YLO || - s == EdgeBdyLoc3D::XLO_YHI || - s == EdgeBdyLoc3D::XHI_YHI) { - ambiguous_type = true; - } - } - if (ambiguous_type) { - TBOX_ERROR("Ambiguous bdry condition " - << bdry_cond_str - << " found for " << bdry_loc_str << std::endl); - } - - std::string proper_face; - std::string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || - s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || - s == EdgeBdyLoc3D::XLO_YHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || - s == EdgeBdyLoc3D::XHI_YLO) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || - s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::XLO_ZLO || - s == EdgeBdyLoc3D::XHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << std::endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << std::endl); + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + std::string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + edge_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + edge_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "ZFLOW") { + edge_conds[s] = BdryCond::ZFLOW; + } else if (bdry_cond_str == "XREFLECT") { + edge_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + edge_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "ZREFLECT") { + edge_conds[s] = BdryCond::ZREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + edge_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + edge_conds[s] = BdryCond::YDIRICHLET; + } else if (bdry_cond_str == "ZDIRICHLET") { + edge_conds[s] = BdryCond::ZDIRICHLET; + } else if (bdry_cond_str == "XNEUMANN") { + edge_conds[s] = BdryCond::XNEUMANN; + } else if (bdry_cond_str == "YNEUMANN") { + edge_conds[s] = BdryCond::YNEUMANN; + } else if (bdry_cond_str == "ZNEUMANN") { + edge_conds[s] = BdryCond::ZNEUMANN; + } else { + TBOX_ERROR("Unknown edge boundary string = " + << bdry_cond_str << " found in input." << std::endl); + } + + bool ambiguous_type = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XREFLECT" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN") { + if (s == EdgeBdyLoc3D::YLO_ZLO || + s == EdgeBdyLoc3D::YHI_ZLO || + s == EdgeBdyLoc3D::YLO_ZHI || + s == EdgeBdyLoc3D::YHI_ZHI) { + ambiguous_type = true; + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YREFLECT" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN") { + if (s == EdgeBdyLoc3D::XLO_ZLO || + s == EdgeBdyLoc3D::XLO_ZHI || + s == EdgeBdyLoc3D::XHI_ZLO || + s == EdgeBdyLoc3D::XHI_ZHI) { + ambiguous_type = true; + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZREFLECT" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN") { + if (s == EdgeBdyLoc3D::XLO_YLO || + s == EdgeBdyLoc3D::XHI_YLO || + s == EdgeBdyLoc3D::XLO_YHI || + s == EdgeBdyLoc3D::XHI_YHI) { + ambiguous_type = true; + } + } + if (ambiguous_type) { + TBOX_ERROR("Ambiguous bdry condition " + << bdry_cond_str + << " found for " << bdry_loc_str << std::endl); + } + + std::string proper_face; + std::string proper_face_data; + bool no_face_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN" || + bdry_cond_str == "XREFLECT") { + if (s == EdgeBdyLoc3D::XLO_ZLO || + s == EdgeBdyLoc3D::XLO_ZHI || + s == EdgeBdyLoc3D::XLO_YLO || + s == EdgeBdyLoc3D::XLO_YHI) { + proper_face = "XLO"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "XHI"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN" || + bdry_cond_str == "YREFLECT") { + if (s == EdgeBdyLoc3D::YLO_ZLO || + s == EdgeBdyLoc3D::YLO_ZHI || + s == EdgeBdyLoc3D::XLO_YLO || + s == EdgeBdyLoc3D::XHI_YLO) { + proper_face = "YLO"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "YHI"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN" || + bdry_cond_str == "ZREFLECT") { + if (s == EdgeBdyLoc3D::XLO_ZLO || + s == EdgeBdyLoc3D::YHI_ZLO || + s == EdgeBdyLoc3D::YLO_ZLO || + s == EdgeBdyLoc3D::XHI_ZLO) { + proper_face = "ZLO"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "ZHI"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; } } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << std::endl); + } + if (no_face_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_face_data + << " data found for face " + << proper_face << std::endl); } } // if (need_data_read) @@ -1284,25 +1271,25 @@ CartesianBoundaryUtilities3::read3dBdryEdges( void CartesianBoundaryUtilities3::read3dBdryNodes( - const boost::shared_ptr& bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + const std::vector& face_conds, + std::vector& node_conds, const hier::IntVector& periodic) { TBOX_DIM_ASSERT(periodic.getDim() == tbox::Dimension(3)); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_3D_NODES); int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < 1) { // node boundary data required - for (int s = 0; s < NUM_3D_NODES; s++) { + for (int s = 0; s < NUM_3D_NODES; ++s) { std::string bdry_loc_str; switch (s) { @@ -1341,221 +1328,208 @@ CartesianBoundaryUtilities3::read3dBdryNodes( default: NULL_STATEMENT; } - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - std::string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - node_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - node_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - node_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - node_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - node_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - node_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << std::endl); - } - - std::string proper_face; - std::string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YHI_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || - s == NodeBdyLoc3D::XLO_YHI_ZHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || - s == NodeBdyLoc3D::XHI_YLO_ZHI) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YHI_ZLO || - s == NodeBdyLoc3D::XHI_YHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << std::endl); - } + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + std::string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + node_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + node_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "ZFLOW") { + node_conds[s] = BdryCond::ZFLOW; + } else if (bdry_cond_str == "XREFLECT") { + node_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + node_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "ZREFLECT") { + node_conds[s] = BdryCond::ZREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + node_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + node_conds[s] = BdryCond::YDIRICHLET; + } else if (bdry_cond_str == "ZDIRICHLET") { + node_conds[s] = BdryCond::ZDIRICHLET; + } else if (bdry_cond_str == "XNEUMANN") { + node_conds[s] = BdryCond::XNEUMANN; + } else if (bdry_cond_str == "YNEUMANN") { + node_conds[s] = BdryCond::YNEUMANN; + } else if (bdry_cond_str == "ZNEUMANN") { + node_conds[s] = BdryCond::ZNEUMANN; + } else { + TBOX_ERROR("Unknown node boundary string = " + << bdry_cond_str << " found in input." << std::endl); + } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << std::endl); + std::string proper_face; + std::string proper_face_data; + bool no_face_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN" || + bdry_cond_str == "XREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YHI_ZLO || + s == NodeBdyLoc3D::XLO_YLO_ZHI || + s == NodeBdyLoc3D::XLO_YHI_ZHI) { + proper_face = "XLO"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "XHI"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; } } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << std::endl); + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN" || + bdry_cond_str == "YREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XHI_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YLO_ZHI || + s == NodeBdyLoc3D::XHI_YLO_ZHI) { + proper_face = "YLO"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "YHI"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN" || + bdry_cond_str == "ZREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XHI_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YHI_ZLO || + s == NodeBdyLoc3D::XHI_YHI_ZLO) { + proper_face = "ZLO"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "ZHI"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } + if (no_face_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_face_data + << " data found for face " + << proper_face << std::endl); } } // for (int s = 0 ... @@ -1571,7 +1545,7 @@ CartesianBoundaryUtilities3::read3dBdryNodes( void CartesianBoundaryUtilities3::get3dBdryDirectionCheckValues( - int& idir, + tbox::Dimension::dir_t& idir, int& offsign, int btype, int bloc, @@ -1718,7 +1692,8 @@ CartesianBoundaryUtilities3::get3dBdryDirectionCheckValues( } else { TBOX_ERROR( "Unknown boundary type " << btype - << " passed to CartesianBoundaryUtilities3::get3dBdryDirectionCheckValues()" + << + " passed to CartesianBoundaryUtilities3::get3dBdryDirectionCheckValues()" << "\n for " << bdry_type_str << " at location " << bloc << std::endl); @@ -1733,7 +1708,7 @@ CartesianBoundaryUtilities3::get3dBdryDirectionCheckValues( void CartesianBoundaryUtilities3::stuff3dBdryFortConst() { - F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) (BdryLoc::XLO, BdryLoc::XHI, + SAMRAI_F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) (BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, BdryLoc::ZLO, BdryLoc::ZHI, EdgeBdyLoc3D::YLO_ZLO, EdgeBdyLoc3D::YHI_ZLO, EdgeBdyLoc3D::YLO_ZHI, EdgeBdyLoc3D::YHI_ZHI, EdgeBdyLoc3D::XLO_ZLO, EdgeBdyLoc3D::XLO_ZHI, @@ -1743,7 +1718,7 @@ CartesianBoundaryUtilities3::stuff3dBdryFortConst() NodeBdyLoc3D::XLO_YHI_ZLO, NodeBdyLoc3D::XHI_YHI_ZLO, NodeBdyLoc3D::XLO_YLO_ZHI, NodeBdyLoc3D::XHI_YLO_ZHI, NodeBdyLoc3D::XLO_YHI_ZHI, NodeBdyLoc3D::XHI_YHI_ZHI); - F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) (BdryCond::FLOW, + SAMRAI_F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) (BdryCond::FLOW, BdryCond::XFLOW, BdryCond::YFLOW, BdryCond::ZFLOW, BdryCond::REFLECT, BdryCond::XREFLECT, BdryCond::YREFLECT, BdryCond::ZREFLECT, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.h index d069e67b..bc9a3aed 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/CartesianBoundaryUtilities3.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility routines for manipulating Cartesian 3d boundary data * ************************************************************************/ @@ -19,11 +19,11 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace appu { @@ -38,6 +38,8 @@ namespace appu { * capabilities, or use the input reading, boundary setting, and error * checking routines independently. * + * Input Parameters + * * To use the boundary condition input reading capabilities, the format * of the input file section containing the boundary information must * be as described next. Boundary face, node, and edge entries are only @@ -46,63 +48,54 @@ namespace appu { * * The boundary condition for face "*" is provided in a section as follows: * - * \verbatim - * + * @code * boundary_face_* { - * boundary_condition = ... // boundary condition std::string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... + * boundary_condition = ... // boundary condition string identifier * } + * @endcode * - * Allowable face identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi, zlo, zhi - * Supported face boundary_condition std::string values are: + * Allowable face identifiers (i.e., values for "*") are:
    + * xlo, xhi, ylo, yhi, zlo, zhi
    + * Supported face boundary_condition string values are:
    * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" * - * \endverbatim - * * The boundary condition for edge "*" is provided in a section as follows: * - * \verbatim - * + * @code * boundary_edge_* { - * boundary_condition = ... // boundary condition std::string identifier + * boundary_condition = ... // boundary condition string identifier * } + * @endcode * - * Allowable edge identifiers (i.e., values for "*") are: + * Allowable edge identifiers (i.e., values for "*") are:
    * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported edge boundary_condition std::string values are: + * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi
    + * Supported edge boundary_condition string values are:
    * "XFLOW", "YFLOW", "ZFLOW", * "XREFLECT", "YREFLECT", "ZREFLECT", * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" * "XNEUMANN", "YNEUMANN", "ZNEUMANN" * - * \endverbatim - * * Note that edge conditions must be consistent with adjacent face conditions. * * The boundary condition for node "*" is provided in a section as follows: * - * \verbatim - * + * @code * boundary_node_* { - * boundary_condition = ... // boundary condition std::string identifier + * boundary_condition = ... // boundary condition string identifier * } + * @endcode * - * Allowable node identifiers (i.e., values for "*") are: - * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, - * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition values are: + * Allowable node identifiers (i.e., values for "*") are:
    + * xlo_ylo_zlo, xhi_ylo_zlo, xlo_yhi_zlo, xhi_yhi_zlo, + * xlo_ylo_zhi, xhi_ylo_zhi, xlo_yhi_zhi, xhi_yhi_zhi
    + * Supported node boundary_condition values are:
    * "XFLOW", "YFLOW", "ZFLOW", * "XREFLECT", "YREFLECT", "ZREFLECT", * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" * "XNEUMANN", "YNEUMANN", "ZNEUMANN" * - * \endverbatim - * * Note that node conditions must be consistent with adjacent face conditions. * * See the include file CartesianBoundaryDefines.h for integer constant @@ -115,7 +108,7 @@ namespace appu { * inconsistencies between C++ and FORTRAN usage. Please see the * FORTRAN include file cartbdryparams3d.i for details. * - * @see appu::BoundaryUtilityStrategy3 + * @see BoundaryUtilityStrategy3 */ struct CartesianBoundaryUtilities3 { @@ -144,24 +137,31 @@ struct CartesianBoundaryUtilities3 { * * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN * conditions - * @param bdry_db input database containing all boundary data - * @param face_conds array into which integer face boundary condition types - * are read - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read + * @param input_db input database containing all boundary data + * @param face_conds array into which integer face boundary condition + * types are read + * @param edge_conds array into which integer edge boundary condition + * types are read + * @param node_conds array into which integer node boundary condition + * types are read * @param periodic integer vector specifying which coordinate * directions are periodic (e.g., value returned from * GridGeometry2::getPeriodicShift()) + * + * @pre input_db + * @pre periodic.getDim() == tbox::Dimension(3) + * @pre bdry_strategy != 0 + * @pre face_conds.size() == NUM_3D_FACES + * @pre edge_conds.size() == NUM_3D_EDGES + * @pre node_conds.size() == NUM_3D_NODES */ static void - readBoundaryInput( + getFromInput( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + std::vector& face_conds, + std::vector& edge_conds, + std::vector& node_conds, const hier::IntVector& periodic); /*! @@ -175,8 +175,18 @@ struct CartesianBoundaryUtilities3 { * @param vardata Cell-centered patch data object to fill. * @param patch hier::Patch on which data object lives. * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_face_conds tbox::Array of boundary condition types for patch faces. - * @param bdry_face_values tbox::Array of boundary values for patch faces. + * @param bdry_face_conds tbox::Array of boundary condition types for + * patch faces. + * @param bdry_face_values tbox::Array of boundary values for patch + * faces. + * + * @pre !varname.empty() + * @pre vardata + * @pre bdry_face_conds.size() == NUM_3D_FACES + * @pre bdry_face_values.size() == NUM_3D_FACES * (vardata->getDepth()) + * @pre ghost_fill_width.getDim() == tbox::Dimension(3) + * @pre (vardata->getDim() == patch.getDim()) && + * (vardata->getDim() == ghost_fill_width.getDim()) */ static void fillFaceBoundaryData( @@ -184,8 +194,8 @@ struct CartesianBoundaryUtilities3 { const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values); + const std::vector& bdry_face_conds, + const std::vector& bdry_face_values); /*! * Function to fill 3d edge boundary values for a patch. @@ -198,8 +208,18 @@ struct CartesianBoundaryUtilities3 { * @param vardata Cell-centered patch data object to fill. * @param patch hier::Patch on which data object lives. * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_face_values tbox::Array of boundary values for patch faces. + * @param bdry_edge_conds tbox::Array of boundary condition types for + * patch edges. + * @param bdry_face_values tbox::Array of boundary values for patch + * faces. + * + * @pre !varname.empty() + * @pre vardata + * @pre bdry_edge_conds.size() == NUM_3D_EDGES + * @pre bdry_face_values.size() == NUM_3D_FACES * (vardata->getDepth()) + * @pre ghost_fill_width.getDim() == tbox::Dimension(3) + * @pre (vardata->getDim() == patch.getDim()) && + * (vardata->getDim() == ghost_fill_width.getDim()) */ static void fillEdgeBoundaryData( @@ -207,8 +227,8 @@ struct CartesianBoundaryUtilities3 { const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values); + const std::vector& bdry_edge_conds, + const std::vector& bdry_face_values); /*! * Function to fill 3d node boundary values for a patch. @@ -221,8 +241,18 @@ struct CartesianBoundaryUtilities3 { * @param vardata Cell-centered patch data object to fill. * @param patch hier::Patch on which data object lives. * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_face_values tbox::Array of boundary values for patch faces. + * @param bdry_node_conds tbox::Array of boundary condition types for + * patch nodes. + * @param bdry_face_values tbox::Array of boundary values for patch + * faces. + * + * @pre !varname.empty() + * @pre vardata + * @pre bdry_node_conds.size() == NUM_3D_NODES + * @pre bdry_face_values.size() == NUM_3D_FACES * (vardata->getDepth()) + * @pre ghost_fill_width.getDim() == tbox::Dimension(3) + * @pre (vardata->getDim() == patch.getDim()) && + * (vardata->getDim() == ghost_fill_width.getDim()) */ static void fillNodeBoundaryData( @@ -230,8 +260,8 @@ struct CartesianBoundaryUtilities3 { const boost::shared_ptr >& vardata, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values); + const std::vector& bdry_node_conds, + const std::vector& bdry_face_values); /*! * Function that returns the integer face boundary location @@ -242,10 +272,24 @@ struct CartesianBoundaryUtilities3 { * or the boundary condition type is inconsistant with the edge location * an error results. * - * @return Integer face location for edge location and boundary condition type. + * @return Integer face location for edge location and boundary condition + * type. * * @param edge_loc Integer location for edge. * @param edge_btype Integer boundary condition type for edge. + * + * @pre (edge_btype == BdryCond::XFLOW) || + * (edge_btype == BdryCond::XREFLECT) || + * (edge_btype == BdryCond::XDIRICHLET) || + * (edge_btype == BdryCond::XNEUMANN) || + * (edge_btype == BdryCond::YFLOW) || + * (edge_btype == BdryCond::YREFLECT) || + * (edge_btype == BdryCond::YDIRICHLET) || + * (edge_btype == BdryCond::YNEUMANN) || + * (edge_btype == BdryCond::ZFLOW) || + * (edge_btype == BdryCond::ZREFLECT) || + * (edge_btype == BdryCond::ZDIRICHLET) || + * (edge_btype == BdryCond::ZNEUMANN) */ static int getFaceLocationForEdgeBdry( @@ -261,10 +305,24 @@ struct CartesianBoundaryUtilities3 { * or the boundary condition type is inconsistant with the node location * an error results. * - * @return Integer face location for node location and boundary condition type. + * @return Integer face location for node location and boundary condition + * type. * * @param node_loc Integer location for node. * @param node_btype Integer boundary condition type for node. + * + * @pre (edge_btype == BdryCond::XFLOW) || + * (edge_btype == BdryCond::XREFLECT) || + * (edge_btype == BdryCond::XDIRICHLET) || + * (edge_btype == BdryCond::XNEUMANN) || + * (edge_btype == BdryCond::YFLOW) || + * (edge_btype == BdryCond::YREFLECT) || + * (edge_btype == BdryCond::YDIRICHLET) || + * (edge_btype == BdryCond::YNEUMANN) || + * (edge_btype == BdryCond::ZFLOW) || + * (edge_btype == BdryCond::ZREFLECT) || + * (edge_btype == BdryCond::ZDIRICHLET) || + * (edge_btype == BdryCond::ZNEUMANN) */ static int getFaceLocationForNodeBdry( @@ -289,7 +347,32 @@ struct CartesianBoundaryUtilities3 { * @param gcw_to_check Width of ghost region to check. * @param bbox Boundary box to check. * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. + * @param bstate Boundary value that applies in DIRICHLET or NEUMANN + * case. + * + * @pre !varname.empty() + * @pre data_id >= 0 + * @pre depth >= 0 + * @pre gcw_to_check.getDim() == tbox::Dimension(3) + * @pre (patch.getDim() == gcw_to_check.getDim() && + * (patch.getDim() == bbox.getDim()) + * @pre (bbox.getBoundaryType() == Bdry::FACE3D) || + * (bbox.getBoundaryType() == Bdry::EDGE3D) || + * (bbox.getBoundaryType() == Bdry::NODE3D) + * @pre ((bbox.getBoundaryType() == Bdry::FACE3D) && + * ((bcase == BdryCond::FLOW) || (bcase == BdryCond::REFLECT) || + * (bcase == BdryCond::DIRICHLET) || + * (bcase == BdryCond::NEUMANN))) || + * (((bbox.getBoundaryType() == Bdry::EDGE3D) || + * (bbox.getBoundaryType() == Bdry::NODE3D)) && + * ((bcase == BdryCond::XFLOW) || (bcase == BdryCond::YFLOW) || + * (bcase == BdryCond::ZFLOW) || (bcase == BdryCond::XREFLECT) || + * (bcase == BdryCond::YREFLECT) || (bcase == BdryCond::XREFLECT) || + * (bcase == BdryCond::XDIRICHLET) || + * (bcase == BdryCond::YDIRICHLET) || + * (bcase == BdryCond::ZDIRICHLET) || + * (bcase == BdryCond::XNEUMANN) || (bcase == BdryCond::YNEUMANN) || + * (bcase == BdryCond::ZNEUMANN))) */ static int checkBdryData( @@ -300,7 +383,7 @@ struct CartesianBoundaryUtilities3 { const hier::IntVector& gcw_to_check, const hier::BoundaryBox& bbox, int bcase, - double bstate); + const double& bstate); private: static bool s_fortran_constants_stuffed; @@ -308,27 +391,27 @@ struct CartesianBoundaryUtilities3 { static void read3dBdryFaces( BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, + const boost::shared_ptr& input_db, + std::vector& face_conds, const hier::IntVector& periodic); static void read3dBdryEdges( - const boost::shared_ptr& bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, + const boost::shared_ptr& input_db, + const std::vector& face_conds, + std::vector& edge_conds, const hier::IntVector& periodic); static void read3dBdryNodes( - const boost::shared_ptr& bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, + const boost::shared_ptr& input_db, + const std::vector& face_conds, + std::vector& node_conds, const hier::IntVector& periodic); static void get3dBdryDirectionCheckValues( - int& idir, + tbox::Dimension::dir_t& idir, int& offsign, int btype, int bloc, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.depend index be80e4f4..d9c326ea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -15,7 +15,6 @@ FILE_0=BoundaryUtilityStrategy.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -23,16 +22,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoundaryUtilityStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=CartesianBoundaryUtilities2.o DEPENDS_1:=\ @@ -62,6 +59,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -76,7 +74,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -88,25 +85,24 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianBoundaryUtilities2.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=CartesianBoundaryUtilities3.o DEPENDS_2:=\ @@ -136,6 +132,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -150,7 +147,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -162,25 +158,24 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianBoundaryUtilities3.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=VisDerivedDataStrategy.o DEPENDS_3:=\ @@ -207,11 +202,11 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -222,19 +217,16 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VisDerivedDataStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=VisItDataWriter.o DEPENDS_4:=\ @@ -265,6 +257,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -277,6 +270,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ @@ -284,6 +278,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -307,7 +302,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -320,8 +314,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -330,7 +324,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VisItDataWriter.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -342,11 +335,10 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=VisMaterialsDataStrategy.o DEPENDS_5:=\ @@ -373,11 +365,11 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -388,18 +380,15 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ VisMaterialsDataStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.in index a6603c3d..6cd59b38 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI appu package ## ######################################################################### @@ -29,10 +29,10 @@ OBJS = \ CartesianBoundaryUtilities2.o \ CartesianBoundaryUtilities3.o -library: $(OBJS) $(OBJSXD) +library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.C index f25ae6fb..d2b660a9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.C @@ -3,15 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface for writing user-defined data to either VisIt or - * Vizamrai dump file + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Interface for writing user-defined data to VisIt * ************************************************************************/ - -#ifndef included_appu_VisDerivedDataStrategy_C -#define included_appu_VisDerivedDataStrategy_C - #include "SAMRAI/appu/VisDerivedDataStrategy.h" #include "SAMRAI/tbox/Utilities.h" @@ -52,5 +47,3 @@ VisDerivedDataStrategy::packMixedDerivedDataIntoDoubleBuffer( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.h index 3eefc6fb..9ce9871a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisDerivedDataStrategy.h @@ -3,9 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface for writing user-defined data to either - * VisIt or Vizamrai file + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Interface for writing user-defined data to VisIt * ************************************************************************/ @@ -27,29 +26,25 @@ namespace appu { /*! * @brief Class VisDerivedDataStrategy is an abstract base class * that defines an interface allowing an VisItDataWriter object - * and/or an CartesianVizamraiDataWriter object to generate plot - * files that contain "derived" quantities; that is, data that does - * not reside on the hierarchy, but which is derived from data that - * does reside on the hierarchy. The derived data may be scalar, - * vector, or tensor (VisIt only), and cell-centered or node-centered - * (VisIt only). A concrete object of this type must be registered - * with the data writer if any derived variable is registered with the - * data writer. The registration of the concrete strategy object may - * be done independently using the method setDerivedDataWriter() - * (Vizamrai only) or setDefaultDerivedDataWriter() (VisIt only) from - * the relevant DataWriter class, or the concrete strategy object may - * be registered concurrently with the derived variable using the - * method registerDerivedPlotScalar/Vector/Tensor(). + * to generate plot files that contain "derived" quantities; that + * is, data that does not reside on the hierarchy, but which is + * derived from data that does reside on the hierarchy. The + * derived data may be scalar, vector, or tensor, and cell-centered + * or node-centered. A concrete object of this type must be + * registered with the data writer if any derived variable is + * registered with the data writer. The registration of the + * concrete strategy object may be done independently using the + * method setDefaultDerivedDataWriter() from the relevant DataWriter + * class, or the concrete strategy object may be registered + * concurrently with the derived variable using the method + * registerDerivedPlotScalar/Vector/Tensor(). * * The concrete strategy object is responsible for supplying an * implementation of the function packDerivedDataIntoDoubleBuffer() * which calculates the derived data and writes it into the double * precision buffer passed in to it. * - * This class is shared by both VisDataWriter and - * CartesianVizamraiDataWriter. - * - * @see appu::VisItDataWriter + * @see VisItDataWriter */ class VisDerivedDataStrategy @@ -110,6 +105,8 @@ class VisDerivedDataStrategy * @param depth_index For scalar quantities index will be zero. * For vector data, index varies between 0 and DIM-1. For tensor * data, index varies from 0 (DIM*DIM)-1. + * @param simulation_time Optional argument specifying the double + * precision simulation time. Default is 0.0. * @return Boolean value indicating if derived data defined on this * patch. */ @@ -119,7 +116,8 @@ class VisDerivedDataStrategy const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_index) const = 0; + int depth_index, + double simulation_time = 0.0) const = 0; /*! * @brief This function calculates and packs derived diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.C index 880dfa0d..8a3bab9b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Writes data files for visualization by VisIt * ************************************************************************/ - -#ifndef included_appu_VisItDataWriter_C -#define included_appu_VisItDataWriter_C - #include "SAMRAI/appu/VisItDataWriter.h" #ifdef HAVE_HDF5 @@ -24,7 +20,7 @@ #include "SAMRAI/pdat/NodeDataFactory.h" #include "SAMRAI/geom/CartesianGridGeometry.h" -#include +#include "boost/make_shared.hpp" #include #include @@ -36,44 +32,44 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(cpfdat2buf3d, CPFDAT2BUF3D) ( +void SAMRAI_F77_FUNC(cpfdat2buf3d, CPFDAT2BUF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - float *, double *, const int&); -void F77_FUNC(cpddat2buf3d, CPDDAT2BUF3D) ( + const float *, double *, const int&); +void SAMRAI_F77_FUNC(cpddat2buf3d, CPDDAT2BUF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - double *, double *, const int&); -void F77_FUNC(cpidat2buf3d, CPIDAT2BUF3D) ( + const double *, double *, const int&); +void SAMRAI_F77_FUNC(cpidat2buf3d, CPIDAT2BUF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - int *, double *, const int&); + const int *, double *, const int&); } extern "C" { -void F77_FUNC(cpfdat2buf2d, CPFDAT2BUF2D) ( +void SAMRAI_F77_FUNC(cpfdat2buf2d, CPFDAT2BUF2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - float *, double *, const int&); -void F77_FUNC(cpddat2buf2d, CPDDAT2BUF2D) ( + const float *, double *, const int&); +void SAMRAI_F77_FUNC(cpddat2buf2d, CPDDAT2BUF2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - double *, double *, const int&); -void F77_FUNC(cpidat2buf2d, CPIDAT2BUF2D) ( + const double *, double *, const int&); +void SAMRAI_F77_FUNC(cpidat2buf2d, CPIDAT2BUF2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - int *, double *, const int&); + const int *, double *, const int&); } #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -119,10 +115,11 @@ VisItDataWriter::VisItDataWriter( const std::string& dump_directory_name, int number_procs_per_file, bool is_multiblock): - d_dim(dim) + d_dim(dim), + d_mpi(MPI_COMM_NULL) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(number_procs_per_file > 0); + TBOX_ASSERT(number_procs_per_file == 1); if ((d_dim < tbox::Dimension(2)) || (d_dim > tbox::Dimension(3))) { TBOX_ERROR( @@ -133,8 +130,10 @@ VisItDataWriter::VisItDataWriter( d_object_name = object_name; - d_default_derived_writer = NULL; - d_materials_writer = NULL; + d_mpi.dupCommunicator(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + d_default_derived_writer = 0; + d_materials_writer = 0; d_number_working_slaves = VISIT_UNDEFINED_INDEX; d_file_cluster_size = number_procs_per_file; @@ -144,7 +143,7 @@ VisItDataWriter::VisItDataWriter( d_my_rank_in_file_cluster = VISIT_UNDEFINED_INDEX; d_number_files_this_file_cluster = VISIT_UNDEFINED_INDEX; - d_scaling_ratios.resizeArray(1, hier::IntVector::getOne(dim)); + d_scaling_ratios.resize(1, hier::IntVector::getOne(dim)); d_number_visit_variables = 0; d_number_visit_variables_plus_depth = 0; @@ -156,7 +155,7 @@ VisItDataWriter::VisItDataWriter( d_summary_filename = "summary.samrai"; d_number_levels = 1; - d_worker_min_max = (patchMinMaxStruct *)NULL; + d_worker_min_max = 0; d_is_multiblock = is_multiblock; } @@ -174,16 +173,17 @@ VisItDataWriter::~VisItDataWriter() /* * De-allocate min/max structs for each variable. */ - if (d_worker_min_max != (patchMinMaxStruct *)NULL) + if (d_worker_min_max != 0) delete[] d_worker_min_max; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { - for (int comp = 0; comp < VISIT_MAX_NUMBER_COMPONENTS; comp++) { - if (ipi->d_master_min_max[comp] != (patchMinMaxStruct *)NULL) + ipi != d_plot_items.end(); ++ipi) { + for (int comp = 0; comp < VISIT_MAX_NUMBER_COMPONENTS; ++comp) { + if (ipi->d_master_min_max[comp] != 0) delete[] ipi->d_master_min_max[comp]; } } + d_mpi.freeCommunicator(); } /* @@ -211,7 +211,7 @@ VisItDataWriter::registerPlotQuantity( * Check for name conflicts with existing registered variables. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_var_name == variable_name) { TBOX_ERROR("VisItDataWriter::registerPlotQuantity()" << "\n Attempting to register variable with name " @@ -232,7 +232,7 @@ VisItDataWriter::registerPlotQuantity( scale_factor, variable_centering); - d_number_visit_variables++; + ++d_number_visit_variables; d_number_visit_variables_plus_depth += plotitem.d_depth; d_plot_items.push_back(plotitem); @@ -264,7 +264,7 @@ VisItDataWriter::registerDerivedPlotQuantity( * Check for name conflicts with existing registered variables. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_var_name == variable_name) { TBOX_ERROR("VisItDataWriter::registerDerivedPlotQuantity()" << "\n Attempting to register variable with name " @@ -305,7 +305,7 @@ VisItDataWriter::registerDerivedPlotQuantity( * a special form to the VisIt readible HDF file. */ char temp_buf[VISIT_NAME_BUFSIZE]; - for (int i = 0; i < plotitem.d_depth; i++) { + for (int i = 0; i < plotitem.d_depth; ++i) { sprintf(temp_buf, ".%02d", i); plotitem.d_visit_var_name[i] = variable_name + temp_buf; } @@ -315,7 +315,7 @@ VisItDataWriter::registerDerivedPlotQuantity( * user would like to choose a scale factor, use the * "registerSingleNodeCoordinate()" method. */ - plotitem.d_coord_scale_factor.resizeArray(d_dim.getValue(), 1.0); + plotitem.d_coord_scale_factor.resize(d_dim.getValue(), 1.0); } if (variable_mix_type == "MIXED") { @@ -327,8 +327,8 @@ VisItDataWriter::registerDerivedPlotQuantity( */ plotitem.d_is_derived = true; - if (derived_writer == NULL) { - if (d_default_derived_writer == NULL) { + if (derived_writer == 0) { + if (d_default_derived_writer == 0) { TBOX_ERROR("VisItDataWriter::registerDerivedPlotQuantity" << "\n no derived data writer specified for variable:" << variable_name @@ -341,7 +341,7 @@ VisItDataWriter::registerDerivedPlotQuantity( plotitem.d_derived_writer = derived_writer; } - d_number_visit_variables++; + ++d_number_visit_variables; d_number_visit_variables_plus_depth += plotitem.d_depth; d_plot_items.push_back(plotitem); } @@ -385,8 +385,8 @@ VisItDataWriter::resetLevelPlotQuantity( if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ffactory) { vdt = VISIT_FLOAT; vc = VISIT_CELL; @@ -395,8 +395,8 @@ VisItDataWriter::resetLevelPlotQuantity( } if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ffactory) { vdt = VISIT_FLOAT; vc = VISIT_NODE; @@ -406,8 +406,8 @@ VisItDataWriter::resetLevelPlotQuantity( if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (dfactory) { vdt = VISIT_DOUBLE; vc = VISIT_CELL; @@ -416,8 +416,8 @@ VisItDataWriter::resetLevelPlotQuantity( } if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (dfactory) { vdt = VISIT_DOUBLE; vc = VISIT_NODE; @@ -426,8 +426,8 @@ VisItDataWriter::resetLevelPlotQuantity( } if (!found_type) { boost::shared_ptr > ifactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ifactory) { vdt = VISIT_INT; vc = VISIT_CELL; @@ -436,8 +436,8 @@ VisItDataWriter::resetLevelPlotQuantity( } if (!found_type) { boost::shared_ptr > ifactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ifactory) { vdt = VISIT_INT; vc = VISIT_NODE; @@ -456,7 +456,7 @@ VisItDataWriter::resetLevelPlotQuantity( */ bool found_var = false; for (std::list::iterator ipi(d_plot_items.begin()); - (!found_var && ipi != d_plot_items.end()); ipi++) { + (!found_var && ipi != d_plot_items.end()); ++ipi) { if (ipi->d_var_name == variable_name) { /* @@ -472,8 +472,9 @@ VisItDataWriter::resetLevelPlotQuantity( << variable_name << "\n ***Exiting" << std::endl); } - if (level_number >= ipi->d_level_patch_data_index.getSize()) { - ipi->d_level_patch_data_index.resizeArray(level_number + 1); + if (level_number >= + static_cast(ipi->d_level_patch_data_index.size())) { + ipi->d_level_patch_data_index.resize(level_number + 1); } ipi->d_level_patch_data_index[level_number] = patch_data_index; ipi->d_start_depth_index = start_depth_index; @@ -512,7 +513,7 @@ VisItDataWriter::registerNodeCoordinates( * Check to make sure "Coords" variable has not already been registered. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_var_name == "Coords") { TBOX_ERROR("VisItDataWriter::registerNodeCoordinates()" << "\n Coordinates registered more than once." << std::endl); @@ -538,8 +539,8 @@ VisItDataWriter::registerNodeCoordinates( if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ffactory) { var_depth = ffactory->getDepth(); found_type = true; @@ -547,8 +548,8 @@ VisItDataWriter::registerNodeCoordinates( } if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (dfactory) { var_depth = dfactory->getDepth(); found_type = true; @@ -596,7 +597,7 @@ VisItDataWriter::registerNodeCoordinates( * a special form to the VisIt readible HDF file. */ char temp_buf[VISIT_NAME_BUFSIZE]; - for (int i = 0; i < plotitem.d_depth; i++) { + for (int i = 0; i < plotitem.d_depth; ++i) { sprintf(temp_buf, ".%02d", i); plotitem.d_visit_var_name[i] = var_name + temp_buf; } @@ -606,9 +607,9 @@ VisItDataWriter::registerNodeCoordinates( * user would like to choose a scale factor, use the * "registerSingleNodeCoordinate()" method. */ - plotitem.d_coord_scale_factor.resizeArray(d_dim.getValue(), 1.0); + plotitem.d_coord_scale_factor.resize(d_dim.getValue(), 1.0); - d_number_visit_variables++; + ++d_number_visit_variables; d_number_visit_variables_plus_depth += plotitem.d_depth; d_plot_items.push_back(plotitem); @@ -650,16 +651,16 @@ VisItDataWriter::registerSingleNodeCoordinate( bool found_type = false; if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (ffactory) { found_type = true; } } if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::PatchDataFactory>( + factory)); if (dfactory) { found_type = true; } @@ -683,7 +684,7 @@ VisItDataWriter::registerSingleNodeCoordinate( * Check to make sure "Coords" variable has not already been registered. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_var_name == "Coords") { TBOX_ERROR("VisItDataWriter::registerSingleNodeCoordinate()" << "\n Coordinate registered more than once." @@ -712,14 +713,14 @@ VisItDataWriter::registerSingleNodeCoordinate( * a special form to the VisIt readible HDF file. */ char temp_buf[VISIT_NAME_BUFSIZE]; - for (int i = 0; i < plotitem.d_depth; i++) { + for (int i = 0; i < plotitem.d_depth; ++i) { sprintf(temp_buf, ".%02d", i); plotitem.d_visit_var_name[i] = var_name + temp_buf; } - plotitem.d_coord_scale_factor.resizeArray(d_dim.getValue()); + plotitem.d_coord_scale_factor.resize(d_dim.getValue()); plotitem.d_coord_scale_factor[coordinate_number] = scale_factor; - d_number_visit_variables++; + ++d_number_visit_variables; d_number_visit_variables_plus_depth += plotitem.d_depth; d_plot_items.push_back(plotitem); @@ -727,13 +728,13 @@ VisItDataWriter::registerSingleNodeCoordinate( } else { for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_is_deformed_coords) { ipi->d_var_type = VISIT_VECTOR; ipi->d_depth = d_dim.getValue(); - ipi->d_visit_var_name.resizeArray(d_dim.getValue()); + ipi->d_visit_var_name.resize(d_dim.getValue()); std::string var_name = "Coords"; char temp_buf[VISIT_NAME_BUFSIZE]; @@ -759,14 +760,14 @@ VisItDataWriter::registerSingleNodeCoordinate( void VisItDataWriter::registerMaterialNames( - const tbox::Array& material_names) + const std::vector& material_names) { - TBOX_ASSERT(material_names.getSize() > 0); + TBOX_ASSERT(material_names.size() > 0); /* * Check if we have already tried to register materials. */ - if (d_materials_names.getSize() > 0) { + if (d_materials_names.size() > 0) { TBOX_ERROR("VisItDataWriter::registerMaterialNames" << "\n This method has been called more than once." << "\n The material names may not change during the" @@ -777,9 +778,9 @@ VisItDataWriter::registerMaterialNames( * Register each of the material names as a plot item with material * characteristics. */ - int num_materials = material_names.getSize(); - d_materials_names.resizeArray(num_materials); - for (int i = 0; i < num_materials; i++) { + int num_materials = static_cast(material_names.size()); + d_materials_names.resize(num_materials); + for (int i = 0; i < num_materials; ++i) { if (material_names[i].empty()) { TBOX_ERROR("VisItDataWriter::registerMaterialNames" << "\n Material: " << i @@ -829,14 +830,14 @@ VisItDataWriter::registerMaterialNames( void VisItDataWriter::registerSparseMaterialNames( - const tbox::Array& material_names) + const std::vector& material_names) { - TBOX_ASSERT(material_names.getSize() > 0); + TBOX_ASSERT(material_names.size() > 0); /* * Check if we have already tried to register materials. */ - if (d_materials_names.getSize() > 0) { + if (d_materials_names.size() > 0) { TBOX_ERROR("VisItDataWriter::registerSparseMaterialNames" << "\n This method has been called more than once." << "\n The material names may not change during the" @@ -847,9 +848,9 @@ VisItDataWriter::registerSparseMaterialNames( * Register each of the material names as a plot item with material * characteristics. */ - int num_materials = material_names.getSize(); - d_materials_names.resizeArray(num_materials); - for (int i = 0; i < num_materials; i++) { + int num_materials = static_cast(material_names.size()); + d_materials_names.resize(num_materials); + for (int i = 0; i < num_materials; ++i) { if (material_names[i].empty()) { TBOX_ERROR("VisItDataWriter::registerMaterialNames" << "\n Material: " << i @@ -903,15 +904,15 @@ VisItDataWriter::registerSparseMaterialNames( void VisItDataWriter::registerSpeciesNames( const std::string& material_name, - const tbox::Array& species_names) + const std::vector& species_names) { TBOX_ASSERT(!material_name.empty()); - TBOX_ASSERT(species_names.getSize() > 0); + TBOX_ASSERT(species_names.size() > 0); /* * Be sure we have already registered materials. */ - if (d_materials_names.getSize() == 0) { + if (d_materials_names.size() == 0) { TBOX_ERROR("VisItDataWriter::registerSpeciesNames" << "\n No materials have yet been registered." << "\n Be sure the 'registerMaterialNames()'" @@ -921,7 +922,7 @@ VisItDataWriter::registerSpeciesNames( bool found_material = false; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_material_name == material_name) { found_material = true; } @@ -935,12 +936,12 @@ VisItDataWriter::registerSpeciesNames( /* * Find the material in the list of plot items */ - VisItItem* material_item = (VisItItem *)NULL; + VisItItem* material_item = 0; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if ((ipi->d_material_name == material_name) && ipi->d_isa_material) { - if (ipi->d_species_names.getSize() > 0) { + if (ipi->d_species_names.size() > 0) { TBOX_ERROR("VisItDataWriter::registerSpeciesNames" << "\n material name = " << material_name << "\n registerSpeciesNames has already been" @@ -952,15 +953,15 @@ VisItDataWriter::registerSpeciesNames( } } - TBOX_ASSERT(material_item != (VisItItem *)NULL); + TBOX_ASSERT(material_item != 0); - d_number_species += species_names.getSize(); + d_number_species += static_cast(species_names.size()); material_item->d_species_names = species_names; /* * Create a plot variable for each species of the material. */ - for (int i = 0; i < species_names.getSize(); i++) { + for (int i = 0; i < static_cast(species_names.size()); ++i) { if (species_names[i].empty()) { TBOX_ERROR("VisItDataWriter::registerSpeciesNames" @@ -1012,18 +1013,18 @@ VisItDataWriter::registerSpeciesNames( */ void VisItDataWriter::registerVisItExpressions( - const tbox::Array& expression_keys, - const tbox::Array& expressions, - const tbox::Array& expression_types) + const std::vector& expression_keys, + const std::vector& expressions, + const std::vector& expression_types) { if ((expressions.size() > 0) && (expressions.size() == expression_keys.size()) && (expressions.size() == expression_types.size())) { - int num_current_exp = d_visit_expressions.size(); - d_visit_expressions.resizeArray(num_current_exp + expressions.size()); - d_visit_expression_keys.resizeArray(num_current_exp + expressions.size()); - d_visit_expression_types.resizeArray(num_current_exp + expressions.size()); - for (int i = 0; i < expressions.size(); ++i) { + int num_current_exp = static_cast(d_visit_expressions.size()); + d_visit_expressions.resize(num_current_exp + expressions.size()); + d_visit_expression_keys.resize(num_current_exp + expressions.size()); + d_visit_expression_types.resize(num_current_exp + expressions.size()); + for (int i = 0; i < static_cast(expressions.size()); ++i) { d_visit_expressions[num_current_exp + i] = expressions[i]; d_visit_expression_keys[num_current_exp + i] = expression_keys[i]; d_visit_expression_types[num_current_exp + i] = expression_types[i]; @@ -1079,7 +1080,7 @@ VisItDataWriter::initializePlotItem( * Check to make sure we have not exceeded max allowed components. */ int num_old_components = d_number_visit_variables_plus_depth - + d_materials_names.getSize() // number materials + + static_cast(d_materials_names.size()) // number materials + d_number_species; int new_num_components = num_old_components + plotitem.d_depth; @@ -1123,8 +1124,8 @@ VisItDataWriter::initializePlotItem( if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (ffactory) { plotitem.d_var_centering = VISIT_CELL; plotitem.d_var_data_type = VISIT_FLOAT; @@ -1134,8 +1135,8 @@ VisItDataWriter::initializePlotItem( } if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (dfactory) { plotitem.d_var_centering = VISIT_CELL; plotitem.d_var_data_type = VISIT_DOUBLE; @@ -1145,8 +1146,8 @@ VisItDataWriter::initializePlotItem( } if (!found_type) { boost::shared_ptr > ifactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (ifactory) { plotitem.d_var_centering = VISIT_CELL; plotitem.d_var_data_type = VISIT_INT; @@ -1156,8 +1157,8 @@ VisItDataWriter::initializePlotItem( } if (!found_type) { boost::shared_ptr > ffactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (ffactory) { plotitem.d_var_centering = VISIT_NODE; plotitem.d_var_data_type = VISIT_FLOAT; @@ -1167,8 +1168,8 @@ VisItDataWriter::initializePlotItem( } if (!found_type) { boost::shared_ptr > dfactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (dfactory) { plotitem.d_var_centering = VISIT_NODE; plotitem.d_var_data_type = VISIT_DOUBLE; @@ -1178,8 +1179,8 @@ VisItDataWriter::initializePlotItem( } if (!found_type) { boost::shared_ptr > ifactory( - factory, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(factory)); if (ifactory) { plotitem.d_var_centering = VISIT_NODE; plotitem.d_var_data_type = VISIT_INT; @@ -1235,12 +1236,11 @@ VisItDataWriter::initializePlotItem( * Set the patch data index. */ plotitem.d_patch_data_index = patch_data_index; - plotitem.d_level_patch_data_index.resizeArray(d_number_levels, - patch_data_index); + plotitem.d_level_patch_data_index.resize(d_number_levels, patch_data_index); - plotitem.d_visit_var_name.resizeArray(plotitem.d_depth); + plotitem.d_visit_var_name.resize(plotitem.d_depth); char temp_buf[VISIT_NAME_BUFSIZE]; - for (int i = 0; i < plotitem.d_depth; i++) { + for (int i = 0; i < plotitem.d_depth; ++i) { if (plotitem.d_depth == 1) { plotitem.d_visit_var_name[i] = variable_name; } else { @@ -1255,8 +1255,8 @@ VisItDataWriter::initializePlotItem( /* * Initialize min/max information. */ - for (int i = 0; i < VISIT_MAX_NUMBER_COMPONENTS; i++) { - plotitem.d_master_min_max[i] = (patchMinMaxStruct *)NULL; + for (int i = 0; i < VISIT_MAX_NUMBER_COMPONENTS; ++i) { + plotitem.d_master_min_max[i] = 0; } /* @@ -1265,14 +1265,14 @@ VisItDataWriter::initializePlotItem( * should be set by the appropriate registration functions. */ plotitem.d_is_derived = false; - plotitem.d_derived_writer = (VisDerivedDataStrategy *)NULL; + plotitem.d_derived_writer = 0; plotitem.d_is_deformed_coords = false; plotitem.d_isa_material = false; - plotitem.d_materials_writer = (VisMaterialsDataStrategy *)NULL; + plotitem.d_materials_writer = 0; plotitem.d_isa_species = false; - plotitem.d_parent_material_pointer = (VisItItem *)NULL; + plotitem.d_parent_material_pointer = 0; // default to CLEAN (not mixed data) plotitem.d_is_material_state_variable = false; @@ -1300,10 +1300,9 @@ VisItDataWriter::dumpWriteBarrierBegin() proc_before_me = (d_my_file_cluster_number * d_file_cluster_size) + d_my_rank_in_file_cluster - 1; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { + if (d_mpi.getSize() > 1) { tbox::SAMRAI_MPI::Status status; - mpi.Recv(x, + d_mpi.Recv(x, len, MPI_INT, proc_before_me, @@ -1316,15 +1315,14 @@ VisItDataWriter::dumpWriteBarrierBegin() void VisItDataWriter::dumpWriteBarrierEnd() { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); int x[1], proc_after_me; - int num_procs = mpi.getSize(); + int num_procs = d_mpi.getSize(); proc_after_me = (d_my_file_cluster_number * d_file_cluster_size) + d_my_rank_in_file_cluster + 1; x[0] = 0; if (proc_after_me < num_procs) { - if (mpi.getSize() > 1) { - mpi.Send(x, + if (d_mpi.getSize() > 1) { + d_mpi.Send(x, 1, MPI_INT, proc_after_me, @@ -1358,17 +1356,17 @@ VisItDataWriter::writePlotData( hier::BoxLevelConnectorUtils dlbg_edge_utils; for (int ln = 0; ln < hierarchy->getNumberOfLevels(); ++ln) { - const hier::BoxLevel& unsorted_mapped_box_level = + const hier::BoxLevel& unsorted_box_level = *hierarchy->getPatchLevel(ln)->getBoxLevel(); - hier::BoxLevel sorted_mapped_box_level(d_dim); - hier::Connector unused_sorting_map; + boost::shared_ptr sorted_box_level; + boost::shared_ptr unused_sorting_map; dlbg_edge_utils.makeSortingMap( - sorted_mapped_box_level, + sorted_box_level, unused_sorting_map, - unsorted_mapped_box_level, + unsorted_box_level, false, true); - if (!d_is_multiblock && sorted_mapped_box_level != unsorted_mapped_box_level) { + if (!d_is_multiblock && *sorted_box_level != unsorted_box_level) { TBOX_ERROR( "VisItDataWriter: Encountered existing limitation of VisItDataWriter\n" << "This class cannot write files unless all patch levels have\n" @@ -1391,8 +1389,7 @@ VisItDataWriter::writePlotData( } d_time_step_number = time_step_number; - if ((d_materials_names.getSize() > 0) && - (d_materials_writer == NULL)) { + if ((d_materials_names.size() > 0) && (d_materials_writer == 0)) { TBOX_ERROR("VisItDataWriter::writePlotData" << "\n data writer with name " << d_object_name << "\n setMaterialsDataWriter() has not been called," @@ -1402,11 +1399,10 @@ VisItDataWriter::writePlotData( d_number_levels = hierarchy->getNumberOfLevels(); - if (d_number_levels > d_scaling_ratios.getSize()) { - d_scaling_ratios.resizeArray(d_number_levels, hier::IntVector(d_dim)); - } + d_scaling_ratios.resize(d_number_levels, + hier::IntVector(d_dim, 1, hierarchy->getNumberBlocks())); - for (int ln = 1; ln <= hierarchy->getFinestLevelNumber(); ln++) { + for (int ln = 1; ln <= hierarchy->getFinestLevelNumber(); ++ln) { d_scaling_ratios[ln] = hierarchy->getPatchLevel(ln)->getRatioToCoarserLevel(); } @@ -1418,7 +1414,7 @@ VisItDataWriter::writePlotData( } int num_items_to_plot = d_number_visit_variables_plus_depth - + d_materials_names.getSize() // number of materials + + static_cast(d_materials_names.size()) // number of materials + d_number_species; if (num_items_to_plot == 0) { @@ -1453,7 +1449,6 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( const boost::shared_ptr& hierarchy) { TBOX_ASSERT(hierarchy); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); /* * Compute max number of patches on this processor. @@ -1461,19 +1456,19 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( int number_local_patches = 0; int tot_number_of_patches = 0; - for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ln++) { + for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ++ln) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(ln)); tot_number_of_patches += patch_level->getGlobalNumberOfPatches(); for (hier::PatchLevel::iterator ip(patch_level->begin()); ip != patch_level->end(); ++ip) { - number_local_patches++; + ++number_local_patches; } } int max_number_local_patches = number_local_patches; - if (mpi.getSize() > 1) { - mpi.AllReduce(&max_number_local_patches, 1, MPI_MAX); + if (d_mpi.getSize() > 1) { + d_mpi.AllReduce(&max_number_local_patches, 1, MPI_MAX); } /* @@ -1481,15 +1476,15 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( * don't want to count processor zero. */ int count_me_in = 0; - if (number_local_patches > 0 || mpi.getRank() == VISIT_MASTER) + if (number_local_patches > 0 || d_mpi.getRank() == VISIT_MASTER) count_me_in = 1; d_number_working_slaves = count_me_in; - if (mpi.getSize() > 1) { - mpi.AllReduce(&d_number_working_slaves, 1, MPI_SUM); + if (d_mpi.getSize() > 1) { + d_mpi.AllReduce(&d_number_working_slaves, 1, MPI_SUM); } d_number_working_slaves -= 1; - if (mpi.getRank() != VISIT_MASTER) { + if (d_mpi.getRank() != VISIT_MASTER) { /* * Worker processor: Allocate an array large enough to hold patch @@ -1497,17 +1492,19 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( * level, and local patch number. */ int num_items_to_plot = d_number_visit_variables_plus_depth - + d_materials_names.getSize() // number materials + + static_cast(d_materials_names.size()) // number materials + d_number_species; int num_components = max_number_local_patches * num_items_to_plot; - if (d_worker_min_max != (patchMinMaxStruct *)NULL) { + if (d_worker_min_max != 0) { delete[] d_worker_min_max; } - d_worker_min_max = new patchMinMaxStruct[num_components]; + if (num_components > 0) { + d_worker_min_max = new patchMinMaxStruct[num_components]; + } memset((char *)d_worker_min_max, 0, num_components * sizeof(patchMinMaxStruct)); - for (int i = 0; i < num_components; i++) { + for (int i = 0; i < num_components; ++i) { d_worker_min_max[i].patch_data_on_disk = false; d_worker_min_max[i].min = tbox::MathUtilities::getMax(); d_worker_min_max[i].max = tbox::MathUtilities::getMin(); @@ -1517,22 +1514,22 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( VisMaterialsDataStrategy::VISIT_MIXED; } - } else { // (mpi.getRank() == VISIT_MASTER) + } else { // (d_mpi.getRank() == VISIT_MASTER) /* * Master processor: allocate array for each plot item to hold * min/max information for ALL patches, on all levels. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { - for (int comp = 0; comp < ipi->d_depth; comp++) { + for (int comp = 0; comp < ipi->d_depth; ++comp) { /* * Create space for master min/max struct, if it doesn't * already exist. */ - if (ipi->d_master_min_max[comp] != (patchMinMaxStruct *)NULL) { + if (ipi->d_master_min_max[comp] != 0) { delete[] ipi->d_master_min_max[comp]; } patchMinMaxStruct* mm = @@ -1541,7 +1538,7 @@ VisItDataWriter::initializePlotVariableMinMaxInfo( tot_number_of_patches * sizeof(patchMinMaxStruct)); ipi->d_master_min_max[comp] = mm; - for (int pn = 0; pn < number_local_patches; pn++) { + for (int pn = 0; pn < number_local_patches; ++pn) { ipi->d_master_min_max[comp][pn].patch_data_on_disk = false; ipi->d_master_min_max[comp][pn].min = tbox::MathUtilities::getMax(); @@ -1583,9 +1580,8 @@ VisItDataWriter::writeHDFFiles( std::string dump_dirname; tbox::Database* visit_HDFFilePointer; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - int num_procs = mpi.getSize(); - int my_proc = mpi.getRank(); + int num_procs = d_mpi.getSize(); + int my_proc = d_mpi.getRank(); if (d_file_cluster_size > num_procs) { d_file_cluster_size = num_procs; @@ -1616,15 +1612,20 @@ VisItDataWriter::writeHDFFiles( } } - d_processor_in_file_cluster_number.resizeArray(num_procs); - for (int i = 0; i < num_procs; i++) { + d_processor_in_file_cluster_number.resize(num_procs); + for (int i = 0; i < num_procs; ++i) { d_processor_in_file_cluster_number[i] = i / d_file_cluster_size; } sprintf(temp_buf, "%05d", d_time_step_number); d_current_dump_directory_name = "visit_dump."; d_current_dump_directory_name += temp_buf; - dump_dirname = d_top_level_directory_name + "/"; + if (!d_top_level_directory_name.empty() && + d_top_level_directory_name[d_top_level_directory_name.length() - 1] == '/') { + dump_dirname = d_top_level_directory_name; + } else { + dump_dirname = d_top_level_directory_name + "/"; + } dump_dirname = dump_dirname + d_current_dump_directory_name; tbox::Utilities::recursiveMkdir(dump_dirname); @@ -1668,7 +1669,8 @@ VisItDataWriter::writeHDFFiles( writeVisItVariablesToHDFFile(processor_HDFGroup, hierarchy, 0, - hierarchy->getFinestLevelNumber()); + hierarchy->getFinestLevelNumber(), + simulation_time); visit_HDFFilePointer->close(); // invokes H5FClose delete visit_HDFFilePointer; // deletes tbox::HDFDatabase object } @@ -1720,7 +1722,7 @@ VisItDataWriter::getGlobalPatchNumber( int global_patch_id = 0; - for (int i = 0; i < level_number; i++) { + for (int i = 0; i < level_number; ++i) { global_patch_id += hierarchy->getPatchLevel(i)->getGlobalNumberOfPatches(); } @@ -1742,7 +1744,8 @@ VisItDataWriter::writeVisItVariablesToHDFFile( const boost::shared_ptr& processor_HDFGroup, const boost::shared_ptr& hierarchy, int coarsest_level, - int finest_level) + int finest_level, + double simulation_time) { TBOX_ASSERT(hierarchy); TBOX_ASSERT(coarsest_level >= 0); @@ -1758,7 +1761,7 @@ VisItDataWriter::writeVisItVariablesToHDFFile( char temp_buf[VISIT_NAME_BUFSIZE]; boost::shared_ptr level_HDFGroup, patch_HDFGroup; - for (int ln = coarsest_level; ln <= finest_level; ln++) { + for (int ln = coarsest_level; ln <= finest_level; ++ln) { /* * create new HDFGroup for this level @@ -1783,12 +1786,10 @@ VisItDataWriter::writeVisItVariablesToHDFFile( patch_HDFGroup = level_HDFGroup->putDatabase(std::string(temp_buf)); int curr_var_id_ctr = d_var_id_ctr; - packRegularAndDerivedData(patch_HDFGroup, - hierarchy, - ln, - *patch); + packRegularAndDerivedData( + patch_HDFGroup, hierarchy, ln, *patch, simulation_time); - if (d_materials_names.getSize() > 0) { + if (d_materials_names.size() > 0) { d_var_id_ctr = curr_var_id_ctr; packMaterialsData(patch_HDFGroup, hierarchy, @@ -1809,7 +1810,7 @@ VisItDataWriter::writeVisItVariablesToHDFFile( * pointer reference to HDF5 groups and the file may not be written/closed. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { ipi->d_species_HDFGroup.reset(); ipi->d_extents_species_HDFGroup.reset(); } @@ -1829,19 +1830,18 @@ VisItDataWriter::packRegularAndDerivedData( const boost::shared_ptr& patch_HDFGroup, const boost::shared_ptr& hierarchy, const int level_number, - hier::Patch& patch) + hier::Patch& patch, + double simulation_time) { TBOX_ASSERT(hierarchy); TBOX_ASSERT(level_number >= 0); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - /* * Loop over variables and write out those that are NOT * material or species variables. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { /* * Only write regular (non-derived) and derived vars, not @@ -1861,7 +1861,7 @@ VisItDataWriter::packRegularAndDerivedData( // Check for mixed/clean state variables if (!(ipi->d_is_material_state_variable)) { // Conventional variable - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { /* * If its derived data, pack via the derived writer. @@ -1879,7 +1879,8 @@ VisItDataWriter::packRegularAndDerivedData( patch, patch.getBox(), ipi->d_var_name, - depth_id); + depth_id, + simulation_time); } else { @@ -1888,7 +1889,7 @@ VisItDataWriter::packRegularAndDerivedData( * not, just use the original registered data id. */ patch_data_id = ipi->d_patch_data_index; - if (ipi->d_level_patch_data_index.getSize() > + if (static_cast(ipi->d_level_patch_data_index.size()) > level_number) { patch_data_id = ipi->d_level_patch_data_index[level_number]; @@ -1924,7 +1925,7 @@ VisItDataWriter::packRegularAndDerivedData( #pragma warning (disable:1572) #endif if (scale != 1.0) { - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { dbuffer[i] *= scale; } } @@ -1933,7 +1934,7 @@ VisItDataWriter::packRegularAndDerivedData( * Determine patch min/max. */ - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { if (dbuffer[i] > dmax) { dmax = dbuffer[i]; } @@ -1952,7 +1953,7 @@ VisItDataWriter::packRegularAndDerivedData( /* * Convert buffer from double to float */ - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { fbuffer[i] = static_cast(dbuffer[i]); } @@ -1974,7 +1975,7 @@ VisItDataWriter::packRegularAndDerivedData( /* * Write min/max summary info */ - if (mpi.getRank() == VISIT_MASTER) { + if (d_mpi.getRank() == VISIT_MASTER) { int gpn = getGlobalPatchNumber(hierarchy, level_number, patch.getLocalId().getValue()); @@ -1992,12 +1993,12 @@ VisItDataWriter::packRegularAndDerivedData( /* * Increment local var_id counter used for d_mm array. */ - d_var_id_ctr++; + ++d_var_id_ctr; } // loop over var depths } // conventional (not material state) variable else { // Data is mixed - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { std::vector dmix_data; /* @@ -2036,7 +2037,7 @@ VisItDataWriter::packRegularAndDerivedData( #pragma warning (disable:1572) #endif if (scale != 1.0) { - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { dbuffer[i] *= scale; } // Scale Mixed data @@ -2051,7 +2052,7 @@ VisItDataWriter::packRegularAndDerivedData( */ int i; - for (i = 0; i < buf_size; i++) { + for (i = 0; i < buf_size; ++i) { if (dbuffer[i] > dmax) { dmax = dbuffer[i]; } @@ -2080,7 +2081,7 @@ VisItDataWriter::packRegularAndDerivedData( /* * Convert buffer from double to float */ - for (i = 0; i < buf_size; i++) { + for (i = 0; i < buf_size; ++i) { fbuffer[i] = static_cast(dbuffer[i]); } @@ -2100,7 +2101,7 @@ VisItDataWriter::packRegularAndDerivedData( // If we had a putFloatVector() this copy could be avoided float* fmixbuffer = new float[mix_buf_size]; //std::copy(dmix_data.begin(),dmix_data.end(),fmixbuffer); - for (i = 0; i < mix_buf_size; i++) { + for (i = 0; i < mix_buf_size; ++i) { fmixbuffer[i] = static_cast(dmix_data[i]); } @@ -2136,7 +2137,7 @@ VisItDataWriter::packRegularAndDerivedData( /* * Write min/max summary info */ - if (mpi.getRank() == VISIT_MASTER) { + if (d_mpi.getRank() == VISIT_MASTER) { int gpn = getGlobalPatchNumber(hierarchy, level_number, patch.getLocalId().getValue()); @@ -2154,7 +2155,7 @@ VisItDataWriter::packRegularAndDerivedData( /* * Increment local var_id counter used for d_mm array. */ - d_var_id_ctr++; + ++d_var_id_ctr; } // loop over var depths @@ -2166,7 +2167,7 @@ VisItDataWriter::packRegularAndDerivedData( } // var is not species or material else { for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { - d_var_id_ctr++; + ++d_var_id_ctr; } } @@ -2193,15 +2194,13 @@ VisItDataWriter::packMaterialsData( TBOX_ASSERT(hierarchy); TBOX_ASSERT(level_number >= 0); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - /* * Loop over variables and pull out those that are material variables. */ boost::shared_ptr materials_HDFGroup; boost::shared_ptr material_name_HDFGroup; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_isa_material) { @@ -2213,10 +2212,10 @@ VisItDataWriter::packMaterialsData( ipi->d_var_centering); // Pointers to buffers for dense packing format - double* dbuffer = NULL; // used to pack var - float* fbuffer = NULL; // copy to float for writing + double* dbuffer = 0; // used to pack var + float* fbuffer = 0; // copy to float for writing // Pointer to buffer for sparse packing format - int* ibuffer = NULL; // used to pack mat_list + int* ibuffer = 0; // used to pack mat_list // Allocate appropriate memory for packing format if (!(ipi->d_is_material_state_variable)) { @@ -2226,7 +2225,7 @@ VisItDataWriter::packMaterialsData( ibuffer = new int[buf_size]; } - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { /* * Create the "materials" HDF database entry: @@ -2332,14 +2331,10 @@ VisItDataWriter::packMaterialsData( dummy_pdata_id); vname = "mix_zones"; - materials_HDFGroup->putIntegerArray(vname, - &mix_zones[0], - static_cast(mix_mat.size())); + materials_HDFGroup->putIntegerVector(vname, mix_zones); vname = "mix_mat"; - materials_HDFGroup->putIntegerArray(vname, - &mix_mat[0], - static_cast(mix_mat.size())); + materials_HDFGroup->putIntegerVector(vname, mix_mat); // allocate buffer for volume fraction data float* fmix_data_buffer; @@ -2347,7 +2342,7 @@ VisItDataWriter::packMaterialsData( /* * Convert buffer from double to float */ - for (unsigned int i = 0; i < vol_fracs.size(); i++) { + for (unsigned int i = 0; i < vol_fracs.size(); ++i) { fmix_data_buffer[i] = static_cast(vol_fracs[i]); } @@ -2357,9 +2352,7 @@ VisItDataWriter::packMaterialsData( static_cast(mix_mat.size())); vname = "next_mat"; - materials_HDFGroup->putIntegerArray(vname, - &next_mat[0], - static_cast(mix_mat.size())); + materials_HDFGroup->putIntegerVector(vname, next_mat); // cleanup buffer delete[] fmix_data_buffer; } @@ -2376,7 +2369,7 @@ VisItDataWriter::packMaterialsData( materials_HDFGroup->putDatabase(mname); // create "species" HDF database for material name - if (ipi->d_species_names.getSize() > 0) { + if (ipi->d_species_names.size() > 0) { ipi->d_species_HDFGroup = material_name_HDFGroup->putDatabase("species"); } @@ -2413,7 +2406,7 @@ VisItDataWriter::packMaterialsData( #pragma warning (disable:1572) #endif if (scale != 1.0) { - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { dbuffer[i] *= scale; } } @@ -2422,7 +2415,7 @@ VisItDataWriter::packMaterialsData( * Determine patch min/max. */ int i; - for (i = 0; i < buf_size; i++) { + for (i = 0; i < buf_size; ++i) { if (dbuffer[i] > dmax) { dmax = dbuffer[i]; } @@ -2442,7 +2435,7 @@ VisItDataWriter::packMaterialsData( /* * Convert buffer from double to float */ - for (i = 0; i < buf_size; i++) { + for (i = 0; i < buf_size; ++i) { fbuffer[i] = static_cast(dbuffer[i]); } @@ -2474,7 +2467,7 @@ VisItDataWriter::packMaterialsData( /* * Write min/max summary info */ - if (mpi.getRank() == VISIT_MASTER) { + if (d_mpi.getRank() == VISIT_MASTER) { int gpn = getGlobalPatchNumber(hierarchy, level_number, patch.getLocalId().getValue()); @@ -2496,7 +2489,7 @@ VisItDataWriter::packMaterialsData( /* * Increment local var_id counter used for d_mm array. */ - d_var_id_ctr++; + ++d_var_id_ctr; } // loop over var depths @@ -2510,8 +2503,8 @@ VisItDataWriter::packMaterialsData( } // var is a material else { - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { - d_var_id_ctr++; + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { + ++d_var_id_ctr; } } @@ -2537,13 +2530,11 @@ VisItDataWriter::packSpeciesData( TBOX_ASSERT(hierarchy); TBOX_ASSERT(level_number >= 0); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - /* * Loop over variables and pull out those that are material variables. */ for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_isa_species) { @@ -2557,7 +2548,7 @@ VisItDataWriter::packSpeciesData( double* dbuffer = new double[buf_size]; // used to pack var float* fbuffer = new float[buf_size]; // copy to float for writing - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { // pack the buffer with species data int return_code = d_materials_writer-> @@ -2594,7 +2585,7 @@ VisItDataWriter::packSpeciesData( #pragma warning (disable:1572) #endif if (scale != 1.0) { - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { dbuffer[i] *= scale; } } @@ -2602,7 +2593,7 @@ VisItDataWriter::packSpeciesData( /* * Determine patch min/max. */ - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { if (dbuffer[i] > dmax) { dmax = dbuffer[i]; } @@ -2622,7 +2613,7 @@ VisItDataWriter::packSpeciesData( /* * Convert buffer from double to float */ - for (int i = 0; i < buf_size; i++) { + for (int i = 0; i < buf_size; ++i) { fbuffer[i] = static_cast(dbuffer[i]); } @@ -2653,7 +2644,7 @@ VisItDataWriter::packSpeciesData( /* * Write min/max summary info */ - if (mpi.getRank() == VISIT_MASTER) { + if (d_mpi.getRank() == VISIT_MASTER) { int gpn = getGlobalPatchNumber(hierarchy, level_number, patch.getLocalId().getValue()); @@ -2675,7 +2666,7 @@ VisItDataWriter::packSpeciesData( /* * Increment local var_id counter used for d_mm array. */ - d_var_id_ctr++; + ++d_var_id_ctr; } // loop over var depths @@ -2684,8 +2675,8 @@ VisItDataWriter::packSpeciesData( } // var is a species else { - for (int depth_id = 0; depth_id < ipi->d_depth; depth_id++) { - d_var_id_ctr++; + for (int depth_id = 0; depth_id < ipi->d_depth; ++depth_id) { + ++d_var_id_ctr; } } @@ -2766,7 +2757,6 @@ VisItDataWriter::writeSummaryToHDFFile( TBOX_ASSERT(coarsest_plot_level >= 0); TBOX_ASSERT(finest_plot_level >= 0); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); int i, ln, pn; /* @@ -2788,7 +2778,7 @@ VisItDataWriter::writeSummaryToHDFFile( for (ln = 0; ln < hierarchy->getNumberOfLevels(); ++ln) { hierarchy->getPatchLevel(ln)->getBoxes(); } - int my_proc = mpi.getRank(); + int my_proc = d_mpi.getRank(); if (my_proc == VISIT_MASTER) { char temp_buf[VISIT_NAME_BUFSIZE]; //sprintf(temp_buf, "/summary.samrai"); @@ -2819,8 +2809,8 @@ VisItDataWriter::writeSummaryToHDFFile( summary_HDFFilePointer->putDatabase(std::string(temp_buf))); boost::shared_ptr hdf_database( - basic_HDFGroup, - boost::detail::dynamic_cast_tag()); + BOOST_CAST(basic_HDFGroup)); + TBOX_ASSERT(hdf_database); hid_t basic_group_id = hdf_database->getGroupId(); std::string key_string = "VDR_version_number"; @@ -2846,7 +2836,7 @@ VisItDataWriter::writeSummaryToHDFFile( basic_HDFGroup->putInteger(key_string, d_time_step_number); key_string = "number_processors"; - basic_HDFGroup->putInteger(key_string, mpi.getSize()); + basic_HDFGroup->putInteger(key_string, d_mpi.getSize()); key_string = "number_file_clusters"; basic_HDFGroup->putInteger(key_string, d_number_file_clusters); @@ -2862,20 +2852,19 @@ VisItDataWriter::writeSummaryToHDFFile( basic_HDFGroup->putInteger(key_string, num_levels); key_string = "number_patches_at_level"; - tbox::Array num_patches_per_level(num_levels); - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { + std::vector num_patches_per_level(num_levels); + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { num_patches_per_level[ln] = hierarchy->getPatchLevel(ln)->getGlobalNumberOfPatches(); tot_number_of_patches += num_patches_per_level[ln]; } - basic_HDFGroup->putIntegerArray(key_string, - num_patches_per_level); + basic_HDFGroup->putIntegerVector(key_string, num_patches_per_level); key_string = "number_global_patches"; basic_HDFGroup->putInteger(key_string, tot_number_of_patches); /* - * When writing Visit data, it expects to see 3D data for + * When writing VisIt data, it expects to see 3D data for * xlo, dx, ratios_to_coarser, and number of ghosts. The * VISIT_FIXED_DIM is set to 3, and the third element * is zero if we have 2D data. @@ -2883,14 +2872,14 @@ VisItDataWriter::writeSummaryToHDFFile( key_string = "ratios_to_coarser_levels"; int idx = 0; int* rtcl = new int[num_levels * VISIT_FIXED_DIM]; - for (i = 0; i < num_levels * VISIT_FIXED_DIM; i++) rtcl[i] = 0; - for (ln = 0; ln <= finest_plot_level; ln++) { - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < num_levels * VISIT_FIXED_DIM; ++i) rtcl[i] = 0; + for (ln = 0; ln <= finest_plot_level; ++ln) { + for (i = 0; i < d_dim.getValue(); ++i) { idx = ln * VISIT_FIXED_DIM + i; if (ln == 0) { rtcl[idx] = VISIT_UNDEFINED_INDEX; } else { - rtcl[idx] = d_scaling_ratios[ln](i); + rtcl[idx] = d_scaling_ratios[ln](0,i); } } } @@ -2917,22 +2906,22 @@ VisItDataWriter::writeSummaryToHDFFile( key_string = "number_visit_variables"; basic_HDFGroup->putInteger(key_string, d_number_visit_variables); - tbox::Array var_names(d_number_visit_variables); - tbox::Array var_centering(d_number_visit_variables); - tbox::Array var_scale_factors(d_number_visit_variables); - tbox::Array var_depths(d_number_visit_variables); + std::vector var_names(d_number_visit_variables); + std::vector var_centering(d_number_visit_variables); + std::vector var_scale_factors(d_number_visit_variables); + std::vector var_depths(d_number_visit_variables); // SGS propose adding array indicating clean/mixed - tbox::Array var_material_state_variable(d_number_visit_variables); + std::vector var_material_state_variable(d_number_visit_variables); int* var_ghosts = new int[d_number_visit_variables * VISIT_FIXED_DIM]; - for (i = 0; i < d_number_visit_variables * VISIT_FIXED_DIM; i++) { + for (i = 0; i < d_number_visit_variables * VISIT_FIXED_DIM; ++i) { var_ghosts[i] = 0; } i = 0; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (!(ipi->d_isa_material || ipi->d_isa_species)) { var_names[i] = ipi->d_var_name; @@ -2948,7 +2937,7 @@ VisItDataWriter::writeSummaryToHDFFile( var_scale_factors[i] = ipi->d_scale_factor; } var_depths[i] = ipi->d_depth; - for (int dim = 0; dim < d_dim.getValue(); dim++) { + for (int dim = 0; dim < d_dim.getValue(); ++dim) { var_ghosts[i * VISIT_FIXED_DIM + dim] = 0; } @@ -2959,35 +2948,32 @@ VisItDataWriter::writeSummaryToHDFFile( // var_material_state_variable[i] = VISIT_CLEAN; var_material_state_variable[i] = 0; } - i++; + ++i; } } key_string = "var_names"; - basic_HDFGroup->putStringArray(key_string, - var_names); + basic_HDFGroup->putStringVector(key_string, var_names); key_string = "var_cell_centered"; - basic_HDFGroup->putIntegerArray(key_string, - var_centering); + basic_HDFGroup->putIntegerVector(key_string, var_centering); key_string = "scaling"; - basic_HDFGroup->putDoubleArray(key_string, - var_scale_factors); + basic_HDFGroup->putDoubleVector(key_string, var_scale_factors); - // VCHANGE Visit needs to read this array so it will + // VCHANGE VisIt needs to read this array so it will // know which variables have mixed material data. // SGS key_string = "material_state_variable"; - basic_HDFGroup->putIntegerArray(key_string, + basic_HDFGroup->putIntegerVector(key_string, var_material_state_variable); if (d_grid_type == VISIT_DEFORMED) { - tbox::Array coord_scaling(VISIT_FIXED_DIM); + std::vector coord_scaling(VISIT_FIXED_DIM); for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_is_deformed_coords) { - for (i = 0; i < VISIT_FIXED_DIM; i++) { + for (i = 0; i < VISIT_FIXED_DIM; ++i) { coord_scaling[i] = 0.0; if (i < d_dim.getValue()) { coord_scaling[i] = ipi->d_coord_scale_factor[i]; @@ -2996,13 +2982,11 @@ VisItDataWriter::writeSummaryToHDFFile( } } key_string = "deformed_coordinate_scaling"; - basic_HDFGroup->putDoubleArray(key_string, - coord_scaling); + basic_HDFGroup->putDoubleVector(key_string, coord_scaling); } key_string = "var_number_components"; - basic_HDFGroup->putIntegerArray(key_string, - var_depths); + basic_HDFGroup->putIntegerVector(key_string, var_depths); key_string = "var_number_ghosts"; HDFputIntegerArray2D(key_string, @@ -3024,11 +3008,11 @@ VisItDataWriter::writeSummaryToHDFFile( std::string expression_keys("expression_keys"); std::string expressions("expressions"); std::string expression_types("expression_types"); - expression_HDFGroup->putStringArray(expression_keys, + expression_HDFGroup->putStringVector(expression_keys, d_visit_expression_keys); - expression_HDFGroup->putStringArray(expressions, + expression_HDFGroup->putStringVector(expressions, d_visit_expressions); - expression_HDFGroup->putStringArray(expression_types, + expression_HDFGroup->putStringVector(expression_types, d_visit_expression_types); } @@ -3066,21 +3050,20 @@ VisItDataWriter::writeSummaryToHDFFile( * - material names * - species names */ - if (d_materials_names.getSize() > 0) { + if (d_materials_names.size() > 0) { sprintf(temp_buf, "materials"); boost::shared_ptr materials_HDFGroup( summary_HDFFilePointer->putDatabase(std::string(temp_buf))); key_string = "material_names"; - materials_HDFGroup->putStringArray(key_string, - d_materials_names); + materials_HDFGroup->putStringVector(key_string, d_materials_names); int mat_ghosts[VISIT_FIXED_DIM]; - for (i = 0; i < VISIT_FIXED_DIM; i++) mat_ghosts[i] = 0; + for (i = 0; i < VISIT_FIXED_DIM; ++i) mat_ghosts[i] = 0; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if (ipi->d_isa_material) { - for (int dim = 0; dim < d_dim.getValue(); dim++) { + for (int dim = 0; dim < d_dim.getValue(); ++dim) { mat_ghosts[dim] = 0; } } @@ -3094,15 +3077,14 @@ VisItDataWriter::writeSummaryToHDFFile( boost::shared_ptr species_HDFGroup( materials_HDFGroup->putDatabase(std::string(temp_buf))); - for (i = 0; i < d_materials_names.getSize(); i++) { + for (i = 0; i < static_cast(d_materials_names.size()); ++i) { key_string = d_materials_names[i]; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { + ipi != d_plot_items.end(); ++ipi) { if ((ipi->d_material_name == d_materials_names[i]) && ipi->d_isa_material) { - if (ipi->d_species_names.getSize() > 0) { - species_HDFGroup->putStringArray( - key_string, + if (ipi->d_species_names.size() > 0) { + species_HDFGroup->putStringVector(key_string, ipi->d_species_names); } } @@ -3111,17 +3093,17 @@ VisItDataWriter::writeSummaryToHDFFile( } /* - * When writing Visit data, it expects to see 3D data for + * When writing VisIt data, it expects to see 3D data for * xlo, dx, ratios_to_coarser, and number of ghosts. The * VISIT_FIXED_DIM is set to 3, and the third element * is zero if we have 2D data. */ double geom_lo[VISIT_FIXED_DIM] = { 0., 0., 0. }; - double dx_curr_lev[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double dx_curr_lev[SAMRAI::MAX_DIM_VAL]; double patch_xlo, patch_xhi; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { dx_curr_lev[i] = 0.0; } @@ -3131,30 +3113,33 @@ VisItDataWriter::writeSummaryToHDFFile( double* dx = new double[VISIT_FIXED_DIM * num_levels]; double* xlo = new double[VISIT_FIXED_DIM * num_levels]; - for (i = 0; i < VISIT_FIXED_DIM * num_levels; i++) { + for (i = 0; i < VISIT_FIXED_DIM * num_levels; ++i) { dx[i] = 0.0; xlo[i] = 0.0; } if (d_grid_type != VISIT_DEFORMED) { //This is never entered in multiblock case const boost::shared_ptr ggeom( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + hierarchy->getGridGeometry())); + TBOX_ASSERT(ggeom); int next = 0; - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { - for (i = 0; i < VISIT_FIXED_DIM; i++) { + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { + for (i = 0; i < VISIT_FIXED_DIM; ++i) { if (i < d_dim.getValue()) { if (ln == 0) { xlo[i] = ggeom->getXLower()[i]; dx_curr_lev[i] = ggeom->getDx()[i]; // coarsest level dx dx[next] = dx_curr_lev[i]; } else { - double scale_ratio = (double)d_scaling_ratios[ln](i); + double scale_ratio = + static_cast( + d_scaling_ratios[ln](0,i)); dx_curr_lev[i] = dx_curr_lev[i] / scale_ratio; dx[next] = dx_curr_lev[i]; } } - next++; + ++next; } } } @@ -3188,11 +3173,10 @@ VisItDataWriter::writeSummaryToHDFFile( sprintf(temp_buf, "extents"); boost::shared_ptr extents_HDFGroup( - summary_HDFFilePointer->putDatabase(std::string(temp_buf)), - boost::detail::dynamic_cast_tag()); + summary_HDFFilePointer->putDatabase(std::string(temp_buf))); hdf_database = - boost::dynamic_pointer_cast(extents_HDFGroup); + BOOST_CAST(extents_HDFGroup); + TBOX_ASSERT(hdf_database); hid_t extents_group_id = hdf_database->getGroupId(); /* @@ -3200,13 +3184,13 @@ VisItDataWriter::writeSummaryToHDFFile( */ patchMapStruct* pms = new patchMapStruct[tot_number_of_patches]; - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(ln)); - tbox::Array proc_mapping = + const std::vector& proc_mapping = patch_level->getProcessorMapping().getProcessorMapping(); - for (pn = 0; pn < patch_level->getGlobalNumberOfPatches(); pn++) { + for (pn = 0; pn < patch_level->getGlobalNumberOfPatches(); ++pn) { int proc_num = proc_mapping[pn]; int global_patch_id = getGlobalPatchNumber(hierarchy, ln, pn); pms[global_patch_id].processor_number = proc_num; @@ -3242,8 +3226,8 @@ VisItDataWriter::writeSummaryToHDFFile( */ patchExtentsStruct* pes = new patchExtentsStruct[tot_number_of_patches]; - for (pn = 0; pn < tot_number_of_patches; pn++) { - for (i = 0; i < VISIT_FIXED_DIM; i++) { + for (pn = 0; pn < tot_number_of_patches; ++pn) { + for (i = 0; i < VISIT_FIXED_DIM; ++i) { pes[pn].lower[i] = 0; pes[pn].upper[i] = 0; pes[pn].xlo[i] = 0.; @@ -3257,9 +3241,10 @@ VisItDataWriter::writeSummaryToHDFFile( if (d_grid_type != VISIT_DEFORMED) { //This is never entered in multiblock case const boost::shared_ptr ggeom( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - for (i = 0; i < d_dim.getValue(); i++) { + BOOST_CAST( + hierarchy->getGridGeometry())); + TBOX_ASSERT(ggeom); + for (i = 0; i < d_dim.getValue(); ++i) { geom_lo[i] = ggeom->getXLower()[i]; dx_curr_lev[i] = ggeom->getDx()[i]; // coarsest level dx } @@ -3269,33 +3254,35 @@ VisItDataWriter::writeSummaryToHDFFile( /* * Deformed grid - set extents to 0. */ - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { geom_lo[i] = 0.; dx_curr_lev[i] = 0.; } } - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { const hier::BoxContainer& boxes = hierarchy->getPatchLevel(ln)->getBoxes(); /* * Set the dx for the next level */ - for (i = 0; i < d_dim.getValue(); i++) { - double scale_ratio = (double)d_scaling_ratios[ln](i); + for (i = 0; i < d_dim.getValue(); ++i) { + double scale_ratio = + static_cast( + d_scaling_ratios[ln](0,i)); dx_curr_lev[i] = dx_curr_lev[i] / scale_ratio; } pn = 0; - for (hier::BoxContainer::const_iterator itr(boxes); + for (hier::BoxContainer::const_iterator itr = boxes.begin(); itr != boxes.end(); ++itr, ++pn) { int global_patch_id = getGlobalPatchNumber(hierarchy, ln, pn); const hier::Box& box = *itr; const int* lower = &box.lower()[0]; const int* upper = &box.upper()[0]; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { pes[global_patch_id].lower[i] = lower[i]; pes[global_patch_id].upper[i] = upper[i]; @@ -3320,8 +3307,8 @@ VisItDataWriter::writeSummaryToHDFFile( */ boost::shared_ptr extents_materials_HDFGroup; for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { - for (int comp = 0; comp < ipi->d_depth; comp++) { + ipi != d_plot_items.end(); ++ipi) { + for (int comp = 0; comp < ipi->d_depth; ++comp) { /* * Regular (i.e. not materials or species) variables @@ -3352,7 +3339,7 @@ VisItDataWriter::writeSummaryToHDFFile( key_string = ipi->d_material_name; boost::shared_ptr - extents_material_name_HDFGroup; + extents_material_name_HDFGroup; if (!(ipi->d_is_material_state_variable)) { std::string mname = ipi->d_material_name; // material_name group @@ -3364,8 +3351,9 @@ VisItDataWriter::writeSummaryToHDFFile( extents_material_name_HDFGroup = extents_materials_HDFGroup; } boost::shared_ptr extents_database( - extents_material_name_HDFGroup, - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + extents_material_name_HDFGroup)); + TBOX_ASSERT(extents_database); hid_t extents_material_name_group_id = extents_database->getGroupId(); @@ -3376,7 +3364,7 @@ VisItDataWriter::writeSummaryToHDFFile( extents_material_name_group_id); // species group - if (ipi->d_species_names.getSize() > 0) { + if (ipi->d_species_names.size() > 0) { ipi->d_extents_species_HDFGroup = extents_material_name_HDFGroup->putDatabase("species"); } @@ -3386,8 +3374,9 @@ VisItDataWriter::writeSummaryToHDFFile( // species key_string = ipi->d_species_name; boost::shared_ptr extents_database( - ipi->d_parent_material_pointer->d_extents_species_HDFGroup, - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + ipi->d_parent_material_pointer->d_extents_species_HDFGroup)); + TBOX_ASSERT(extents_database); /* * species group @@ -3404,7 +3393,9 @@ VisItDataWriter::writeSummaryToHDFFile( } // loop over components } // loop over variables - delete[] d_worker_min_max; + if (d_worker_min_max) { + delete[] d_worker_min_max; + } key_string = "patch_extents"; HDFputPatchExtentsStructArray(key_string, @@ -3426,7 +3417,13 @@ VisItDataWriter::writeSummaryToHDFFile( * Add this dump entry to dumps.visit file */ if (d_time_step_number == 0) s_summary_file_opened = false; - std::string path = d_top_level_directory_name + "/dumps.visit"; + std::string path; + if (!d_top_level_directory_name.empty() && + d_top_level_directory_name[d_top_level_directory_name.length() - 1] == '/') { + path = d_top_level_directory_name + "dumps.visit"; + } else { + path = d_top_level_directory_name + "/dumps.visit"; + } std::string file = d_current_dump_directory_name + "/" + d_summary_filename; @@ -3469,8 +3466,6 @@ VisItDataWriter::exchangeMinMaxPatchInformation( TBOX_ASSERT(coarsest_plot_level >= 0); TBOX_ASSERT(finest_plot_level >= 0); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - /* * Compute max number of patches on any processor, and the total number of * patches in the problem. @@ -3479,29 +3474,29 @@ VisItDataWriter::exchangeMinMaxPatchInformation( int number_local_patches = 0; int tot_number_of_patches = 0; - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(ln)); tot_number_of_patches += patch_level->getGlobalNumberOfPatches(); for (hier::PatchLevel::iterator ip(patch_level->begin()); ip != patch_level->end(); ++ip) { - number_local_patches++; + ++number_local_patches; } } int max_number_local_patches = number_local_patches; - if (mpi.getSize() > 1) { - mpi.AllReduce(&max_number_local_patches, 1, MPI_MAX); + if (d_mpi.getSize() > 1) { + d_mpi.AllReduce(&max_number_local_patches, 1, MPI_MAX); } int num_items_to_plot = d_number_visit_variables_plus_depth - + d_materials_names.getSize() // number materials + + static_cast(d_materials_names.size()) // number materials + d_number_species; int message_size = max_number_local_patches * static_cast(sizeof(patchMinMaxStruct)) * num_items_to_plot; - if (mpi.getRank() != VISIT_MASTER) { + if (d_mpi.getRank() != VISIT_MASTER) { /* * Worker processor: send contents of d_worker_min_max array that @@ -3509,8 +3504,8 @@ VisItDataWriter::exchangeMinMaxPatchInformation( * master processor. */ if (number_local_patches > 0) { - if (mpi.getSize() > 1) { - mpi.Send(d_worker_min_max, + if (d_mpi.getSize() > 1) { + d_mpi.Send(d_worker_min_max, message_size, MPI_BYTE, VISIT_MASTER, @@ -3518,7 +3513,7 @@ VisItDataWriter::exchangeMinMaxPatchInformation( } } - } else { // (mpi.getRank() == VISIT_MASTER) + } else { // (d_mpi.getRank() == VISIT_MASTER) /* * Master processor: Receive the min/max information sent by the @@ -3527,7 +3522,7 @@ VisItDataWriter::exchangeMinMaxPatchInformation( */ // recv buffer large enough to receive info from any processor. - patchMinMaxStruct* buf = NULL; + patchMinMaxStruct* buf = 0; if (d_number_working_slaves > 0) { buf = new patchMinMaxStruct[max_number_local_patches * num_items_to_plot]; @@ -3542,9 +3537,9 @@ VisItDataWriter::exchangeMinMaxPatchInformation( int number_msgs_recvd = 0; while (number_msgs_recvd < d_number_working_slaves) { int sending_proc = -1; - if (mpi.getSize() > 1) { + if (d_mpi.getSize() > 1) { tbox::SAMRAI_MPI::Status status; - mpi.Recv(buf, + d_mpi.Recv(buf, message_size, MPI_BYTE, MPI_ANY_SOURCE, @@ -3552,28 +3547,28 @@ VisItDataWriter::exchangeMinMaxPatchInformation( &status); sending_proc = status.MPI_SOURCE; } - number_msgs_recvd++; + ++number_msgs_recvd; /* * Unpack the information from buf and fill d_worker_min_max array. */ item_ctr = 0; - for (ln = coarsest_plot_level; ln <= finest_plot_level; ln++) { - tbox::Array proc_mapping = + for (ln = coarsest_plot_level; ln <= finest_plot_level; ++ln) { + const std::vector& proc_mapping = hierarchy->getPatchLevel(ln)->getProcessorMapping().getProcessorMapping(); - int npatches_on_level = proc_mapping.getSize(); - for (pn = 0; pn < npatches_on_level; pn++) { + int npatches_on_level = static_cast(proc_mapping.size()); + for (pn = 0; pn < npatches_on_level; ++pn) { if (proc_mapping[pn] == sending_proc) { int global_patch_id = getGlobalPatchNumber(hierarchy, ln, pn); for (std::list::iterator ipi(d_plot_items.begin()); - ipi != d_plot_items.end(); ipi++) { - for (comp = 0; comp < ipi->d_depth; comp++) { + ipi != d_plot_items.end(); ++ipi) { + for (comp = 0; comp < ipi->d_depth; ++comp) { ipi->d_master_min_max[comp][global_patch_id] = buf[item_ctr]; - item_ctr++; + ++item_ctr; } } // variables } // patch from sending proc? @@ -3629,7 +3624,7 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( int finest_level = hierarchy->getFinestLevelNumber(); int ln; - for (ln = 0; ln <= finest_level; ln++) { + for (ln = 0; ln <= finest_level; ++ln) { tot_number_of_patches += hierarchy->getPatchLevel(ln)->getGlobalNumberOfPatches(); } int chunk_size = 2 * tot_number_of_patches; @@ -3641,12 +3636,12 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( int child_parent_idx = 0; int child_ptrs_idx = 0; - for (ln = 0; ln <= finest_level; ln++) { - const hier::BoxContainer& coarser_mapped_boxes = + for (ln = 0; ln <= finest_level; ++ln) { + const hier::BoxContainer& coarser_boxes = hierarchy->getPatchLevel(ln)->getBoxLevel()->getGlobalizedVersion().getGlobalBoxes(); boost::shared_ptr child_box_tree; - hier::IntVector ratio(d_dim); + hier::IntVector ratio(hier::IntVector::getZero(d_dim)); if (ln != finest_level) { boost::shared_ptr child_patch_level( @@ -3685,8 +3680,8 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( } } - for (hier::RealBoxConstIterator bi(coarser_mapped_boxes.realBegin()); - bi != coarser_mapped_boxes.realEnd(); ++bi) { + for (hier::RealBoxConstIterator bi(coarser_boxes.realBegin()); + bi != coarser_boxes.realEnd(); ++bi) { if (ln == finest_level) { child_ptrs[child_ptrs_idx].u.number_children = 0; @@ -3696,14 +3691,14 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( hier::Box compare_box(*bi); compare_box.refine(ratio); - hier::BoxContainer overlap_mapped_boxes; + hier::BoxContainer overlap_boxes; child_box_tree->findOverlapBoxes( - overlap_mapped_boxes, + overlap_boxes, compare_box, ratio); - int num_kids = static_cast(overlap_mapped_boxes.size()); + int num_kids = static_cast(overlap_boxes.size()); child_ptrs[child_ptrs_idx].u.number_children = num_kids; if (num_kids == 0) { @@ -3717,16 +3712,15 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( child_parent = new struct childParentStruct[current_child_parent_max_size]; - for (int idx = 0; idx < child_parent_idx; idx++) { + for (int idx = 0; idx < child_parent_idx; ++idx) { child_parent[idx].child = temp[idx].child; child_parent[idx].parent = temp[idx].parent; } delete[] temp; } - for (hier::BoxContainer::iterator - ob_itr = overlap_mapped_boxes.begin(); - ob_itr != overlap_mapped_boxes.end(); ++ob_itr) { + for (hier::BoxContainer::iterator ob_itr = overlap_boxes.begin(); + ob_itr != overlap_boxes.end(); ++ob_itr) { child_parent[child_parent_idx].child = getGlobalPatchNumber(hierarchy, ln + 1, ob_itr->getLocalId().getValue()); @@ -3739,18 +3733,18 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( } } - int* parent_array = (int *)NULL; - int* child_array = (int *)NULL; + int* parent_array = 0; + int* child_array = 0; int parent_array_length = 0; int child_array_length = child_parent_idx; - struct cpPointerStruct* parent_ptrs = (cpPointerStruct *)NULL; + struct cpPointerStruct* parent_ptrs = 0; // copy child info to child array if (child_array_length > 0) { child_array = new int[child_array_length]; - for (int idx = 0; idx < child_array_length; idx++) { + for (int idx = 0; idx < child_array_length; ++idx) { child_array[idx] = child_parent[idx].child; } @@ -3767,7 +3761,7 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( parent_ptrs = new struct cpPointerStruct[tot_number_of_patches]; - for (int gpn = 0; gpn < tot_number_of_patches; gpn++) { + for (int gpn = 0; gpn < tot_number_of_patches; ++gpn) { if (gpn < child_parent[cp_idx].child) { parent_ptrs[gpn].offset = VISIT_UNDEFINED_INDEX; parent_ptrs[gpn].u.number_parents = 0; @@ -3778,18 +3772,18 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( if (num_pars == 0) { parent_ptrs[gpn].offset = next_parent; } - num_pars++; + ++num_pars; if (next_parent >= parent_size) { // increase size of parent_array int old_parent_size = parent_size; int* temp = new int[old_parent_size]; - for (int i = 0; i < old_parent_size; i++) { + for (int i = 0; i < old_parent_size; ++i) { temp[i] = parent_array[i]; } delete[] parent_array; parent_size += chunk_size; parent_array = new int[parent_size]; - for (int i = 0; i < old_parent_size; i++) { + for (int i = 0; i < old_parent_size; ++i) { parent_array[i] = temp[i]; } delete[] temp; @@ -3811,8 +3805,8 @@ VisItDataWriter::writeParentChildInfoToSummaryHDFFile( key_string = "parent_array_length"; basic_HDFGroup->putInteger(key_string, parent_array_length); boost::shared_ptr hdf_database( - basic_HDFGroup, - boost::detail::dynamic_cast_tag()); + BOOST_CAST(basic_HDFGroup)); + TBOX_ASSERT(hdf_database); hid_t basic_group_id = hdf_database->getGroupId(); if (child_array_length > 0) { key_string = "child_array"; @@ -3940,11 +3934,10 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( switch (data_type) { case VISIT_FLOAT: { - float* dat_ptr = NULL; + const float* dat_ptr = 0; if (centering == VISIT_CELL) { - const boost::shared_ptr > fpdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > fpdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(fpdata); @@ -3956,9 +3949,8 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( pdata->copy2(cell_copy); dat_ptr = cell_copy.getPointer(); } else if (centering == VISIT_NODE) { - const boost::shared_ptr > fpdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > fpdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(fpdata); @@ -3971,14 +3963,14 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( dat_ptr = node_copy.getPointer(); } if (d_dim == tbox::Dimension(2)) { - F77_FUNC(cpfdat2buf2d, CPFDAT2BUF2D) (databox_lower(0), + SAMRAI_F77_FUNC(cpfdat2buf2d, CPFDAT2BUF2D) (databox_lower(0), databox_lower(1), plolower(0), plolower(1), ploupper(0), ploupper(1), databox_upper(0), databox_upper(1), dat_ptr, buffer, buf_size); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(cpfdat2buf3d, CPFDAT2BUF3D) (databox_lower(0), + SAMRAI_F77_FUNC(cpfdat2buf3d, CPFDAT2BUF3D) (databox_lower(0), databox_lower(1), databox_lower(2), plolower(0), plolower(1), plolower(2), ploupper(0), ploupper(1), ploupper(2), @@ -3989,11 +3981,10 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( } case VISIT_DOUBLE: { - double* dat_ptr = NULL; + const double* dat_ptr = 0; if (centering == VISIT_CELL) { - const boost::shared_ptr > dpdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > dpdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(dpdata); dat_ptr = dpdata->getPointer(depth_index); @@ -4004,9 +3995,8 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( pdata->copy2(cell_copy); dat_ptr = cell_copy.getPointer(); } else if (centering == VISIT_NODE) { - const boost::shared_ptr > dpdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > dpdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(dpdata); dat_ptr = dpdata->getPointer(depth_index); @@ -4018,14 +4008,14 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( dat_ptr = node_copy.getPointer(); } if (d_dim == tbox::Dimension(2)) { - F77_FUNC(cpddat2buf2d, CPDDAT2BUF2D) (databox_lower(0), + SAMRAI_F77_FUNC(cpddat2buf2d, CPDDAT2BUF2D) (databox_lower(0), databox_lower(1), plolower(0), plolower(1), ploupper(0), ploupper(1), databox_upper(0), databox_upper(1), dat_ptr, buffer, buf_size); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(cpddat2buf3d, CPDDAT2BUF3D) (databox_lower(0), + SAMRAI_F77_FUNC(cpddat2buf3d, CPDDAT2BUF3D) (databox_lower(0), databox_lower(1), databox_lower(2), plolower(0), plolower(1), plolower(2), ploupper(0), ploupper(1), ploupper(2), @@ -4036,11 +4026,10 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( } case VISIT_INT: { - int* dat_ptr = NULL; + const int* dat_ptr = 0; if (centering == VISIT_CELL) { - const boost::shared_ptr > ipdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > ipdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(ipdata); @@ -4051,9 +4040,8 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( pdata->copy2(cell_copy); dat_ptr = cell_copy.getPointer(); } else if (centering == VISIT_NODE) { - const boost::shared_ptr > ipdata( - pdata, - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > ipdata( + BOOST_CAST, hier::PatchData>(pdata)); TBOX_ASSERT(ipdata); @@ -4065,14 +4053,14 @@ VisItDataWriter::packPatchDataIntoDoubleBuffer( dat_ptr = node_copy.getPointer(); } if (d_dim == tbox::Dimension(2)) { - F77_FUNC(cpidat2buf2d, CPIDAT2BUF2D) (databox_lower(0), + SAMRAI_F77_FUNC(cpidat2buf2d, CPIDAT2BUF2D) (databox_lower(0), databox_lower(1), plolower(0), plolower(1), ploupper(0), ploupper(1), databox_upper(0), databox_upper(1), dat_ptr, buffer, buf_size); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(cpidat2buf3d, CPIDAT2BUF3D) (databox_lower(0), + SAMRAI_F77_FUNC(cpidat2buf3d, CPIDAT2BUF3D) (databox_lower(0), databox_lower(1), databox_lower(2), plolower(0), plolower(1), plolower(2), ploupper(0), ploupper(1), ploupper(2), @@ -4109,13 +4097,14 @@ VisItDataWriter::HDFputIntegerArray2D( const hid_t group_id) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT((nelements0 > 0) && (nelements1 > 0)); herr_t errf; if ((nelements0 > 0) && (nelements1 > 0)) { - hsize_t dim[] = { nelements0, nelements1 }; - hid_t space = H5Screate_simple(2, dim, NULL); + hsize_t dim[] = { static_cast(nelements0), + static_cast(nelements1) }; + hid_t space = H5Screate_simple(2, dim, 0); TBOX_ASSERT(space >= 0); @@ -4180,13 +4169,14 @@ VisItDataWriter::HDFputDoubleArray2D( { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT((nelements0 > 0) && (nelements1 > 0)); herr_t errf; if ((nelements0 > 0) && (nelements1 > 0)) { - hsize_t dim[] = { nelements0, nelements1 }; - hid_t space = H5Screate_simple(2, dim, NULL); + hsize_t dim[] = { static_cast(nelements0), + static_cast(nelements1) }; + hid_t space = H5Screate_simple(2, dim, 0); TBOX_ASSERT(space >= 0); @@ -4249,7 +4239,7 @@ VisItDataWriter::HDFputPatchExtentsStructArray( const hid_t group_id) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT(nelements > 0); herr_t errf; @@ -4257,7 +4247,7 @@ VisItDataWriter::HDFputPatchExtentsStructArray( hid_t space; hsize_t dim[1]; dim[0] = nelements; - space = H5Screate_simple(1, dim, NULL); + space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); hid_t pe_id = H5Tcreate(H5T_COMPOUND, sizeof(patchExtentsStruct)); @@ -4268,14 +4258,14 @@ VisItDataWriter::HDFputPatchExtentsStructArray( #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) hid_t intXdType = H5Tarray_create(H5T_NATIVE_INT, 1, dim1); #else - hid_t intXdType = H5Tarray_create(H5T_NATIVE_INT, 1, dim1, NULL); + hid_t intXdType = H5Tarray_create(H5T_NATIVE_INT, 1, dim1, 0); #endif TBOX_ASSERT(intXdType >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) hid_t doubleXdType = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dim1); #else - hid_t doubleXdType = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dim1, NULL); + hid_t doubleXdType = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dim1, 0); #endif TBOX_ASSERT(doubleXdType >= 0); @@ -4368,7 +4358,7 @@ VisItDataWriter::HDFputPatchMapStructArray( const hid_t group_id) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT(nelements > 0); herr_t errf; @@ -4376,7 +4366,7 @@ VisItDataWriter::HDFputPatchMapStructArray( hid_t space; hsize_t dim[1]; dim[0] = nelements; - space = H5Screate_simple(1, dim, NULL); + space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); hid_t pm_id = H5Tcreate(H5T_COMPOUND, sizeof(patchMapStruct)); @@ -4464,7 +4454,7 @@ VisItDataWriter::HDFputPatchMinMaxStructArray( const hid_t group_id) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT(nelements > 0); herr_t errf; @@ -4472,7 +4462,7 @@ VisItDataWriter::HDFputPatchMinMaxStructArray( hid_t space; hsize_t dim[1]; dim[0] = nelements; - space = H5Screate_simple(1, dim, NULL); + space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); hid_t s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(patchMinMaxStruct)); @@ -4571,7 +4561,7 @@ VisItDataWriter::HDFputChildParentStructArray( const std::string& field_name) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); TBOX_ASSERT(nelements > 0); herr_t errf; @@ -4579,7 +4569,7 @@ VisItDataWriter::HDFputChildParentStructArray( hid_t space; hsize_t dim[1]; dim[0] = nelements; - space = H5Screate_simple(1, dim, NULL); + space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); hid_t s1_tid = H5Tcreate(H5T_COMPOUND, sizeOfStruct); @@ -4659,7 +4649,7 @@ VisItDataWriter::getBufferSize( const int* lower = &patch_box.lower()[0]; const int* upper = &patch_box.upper()[0]; - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { buf_size *= upper[i] - lower[i] + cen + (2 * ghost_cell_width(i)); } return buf_size; @@ -4716,7 +4706,7 @@ VisItDataWriter::dumpItem( os << "d_derived_writer ptr: " << plotitem.d_derived_writer << "\n"; int i; - for (i = 0; i < plotitem.d_depth; i++) { + for (i = 0; i < plotitem.d_depth; ++i) { os << " comp_name[" << i << "]: " << plotitem.d_visit_var_name[i] << "\n"; } @@ -4726,7 +4716,7 @@ VisItDataWriter::dumpItem( os << "d_materials_writer ptr: " << plotitem.d_materials_writer << "\n"; if (plotitem.d_isa_material) { os << " Species for this material: " << "\n"; - for (i = 0; i < plotitem.d_species_names.getSize(); i++) { + for (i = 0; i < static_cast(plotitem.d_species_names.size()); ++i) { os << " species[" << i << "]: " << plotitem.d_species_names[i] << "\n"; } @@ -4759,5 +4749,3 @@ VisItDataWriter::childParentStruct::childParentStruct(): #endif #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.h index 0bfa36f9..e0c8c659 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisItDataWriter.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Writes data files for visualization by VisIt * ************************************************************************/ @@ -28,13 +28,14 @@ #include "SAMRAI/tbox/IOStream.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/HDFDatabase.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include +#include "boost/shared_ptr.hpp" #include #include +#include namespace SAMRAI { namespace appu { @@ -99,7 +100,7 @@ namespace appu { * * - Register hierarchy variable data fields using * registerPlotQuantity(). The variables registered may be scalar, - * vector, or tensor (depth 1, DIM, and DIM*DIM, respectively) + * vector, or tensor (depth 1, dim, and dim*dim, respectively) * which is specified in the argument list. All variables require a * string identifier and an index into the patch data array on the * AMR hierarchy. Optionally, a start depth index may be supplied @@ -183,18 +184,22 @@ class VisItDataWriter * registered. * * An error results and the program will halt if: - * - the data is not 2D nor 3D, i.e. DIM != 2 and DIM != 3 + * - the data is not 2D nor 3D, i.e. dim != 2 and dim != 3 * - when assertion checking is active, the object name string is * empty, or the number_procs_per_file is <= 0. * * @param dim * @param object_name String name for data writer object * @param dump_directory_name String name for dump directory, which - * may include a path. + * may include a path. * @param number_procs_per_file Optional integer number processors - * (>= 1) to share a common dump file; default is 1. + * (>= 1) to share a common dump file; default is 1. * @param is_multiblock Optional argument should be set to true only - * only for problems on a multiblock domain. + * only for problems on a multiblock domain. + * + * @pre !object_name.empty() + * @pre number_procs_per_file > 0 + * @pre (dim.getValue() == 2) || (dim.getValue() == 3) */ VisItDataWriter( const tbox::Dimension& dim, @@ -223,13 +228,15 @@ class VisItDataWriter * pointer is null. * * @param default_derived_writer Pointer to a VisDerivedDataStrategy - * object. + * object. + * + * @pre default_derived_writer != 0 */ void setDefaultDerivedDataWriter( VisDerivedDataStrategy* default_derived_writer) { - TBOX_ASSERT(default_derived_writer != (VisDerivedDataStrategy *)NULL); + TBOX_ASSERT(default_derived_writer != 0); d_default_derived_writer = default_derived_writer; } @@ -240,13 +247,16 @@ class VisItDataWriter * - assertion checking is active and the materials_data__writer * pointer is null. * - * @param materials_data_writer Pointer to a VisMaterialsDataStrategy object. + * @param materials_data_writer Pointer to a VisMaterialsDataStrategy + * object. + * + * @pre materials_data_writer != 0 */ void setMaterialsDataWriter( VisMaterialsDataStrategy* materials_data_writer) { - TBOX_ASSERT(materials_data_writer != (VisMaterialsDataStrategy *)NULL); + TBOX_ASSERT(materials_data_writer != 0); d_materials_writer = materials_data_writer; } @@ -256,8 +266,8 @@ class VisItDataWriter * Each plot quantity requires a variable name, which is what VisIt * will label the plotted quantity. The variable type is a string * specifying either "SCALAR", "VECTOR", or "TENSOR". By default, the - * dimension of a scalar variable is 1, vector is DIM, and tensor is - * DIM*DIM. The integer patch data array index and optional depth + * dimension of a scalar variable is 1, vector is dim, and tensor is + * dim*dim. The integer patch data array index and optional depth * index indicate where the data may be found on patches in the hierarchy. * * A number of optional parameters may be used to further specify @@ -293,8 +303,12 @@ class VisItDataWriter * @param variable_centering (optional) "CELL" or "NODE" - used * only when data being registered is not standard cell or * node type. + * + * @pre !variable_name.empty() + * @pre !variable_type.empty() + * @pre patch_data_index >= -1 + * @pre start_depth_index >= 0 */ - void registerPlotQuantity( const std::string& variable_name, @@ -311,8 +325,8 @@ class VisItDataWriter * Each derived variable requires a variable name, which is what VisIt * will label the plotted quantity. The variable type is a string * specifying either "SCALAR", "VECTOR", or "TENSOR". By default, the - * dimension of a scalar variable is 1, vector is DIM, and tensor is - * DIM*DIM. The derived writer should implement methods defined in + * dimension of a scalar variable is 1, vector is dim, and tensor is + * dim*dim. The derived writer should implement methods defined in * the derived data strategy which compute the derived data. * * Optional parameters may be used to further define characteristics @@ -334,18 +348,23 @@ class VisItDataWriter * derived data object if not supplied * @param scale_factor (optional) scale factor with which to multiply * all data values - * @param variable_centering (optional) centering of derived data - "CELL" or "NODE" - * @param variable_mix_type (optional) indicate whether or not the mixed material - * state will be stored, "MIXED", or the default of using cell averages - * "CLEAN". If "MIXED" then packMixedDerivedDataIntoDoubleBuffer() must - * be provided. + * @param variable_centering (optional) centering of derived data - "CELL" + * or "NODE" + * @param variable_mix_type (optional) indicate whether or not the mixed + * material state will be stored, "MIXED", or the default of using cell + * averages "CLEAN". If "MIXED" then + * packMixedDerivedDataIntoDoubleBuffer() must be provided. + * + * @pre !variable_name.empty() + * @pre !variable_type.empty() + * @pre (variable_name != "Coords") || + * ((variable_type == "VECTOR") && (variable_centering == "NODE")) */ void registerDerivedPlotQuantity( const std::string& variable_name, const std::string& variable_type, - VisDerivedDataStrategy* derived_writer = - (VisDerivedDataStrategy *)NULL, + VisDerivedDataStrategy* derived_writer = 0, const double scale_factor = 1.0, const std::string& variable_centering = "CELL", const std::string& variable_mix_type = "CLEAN"); @@ -381,7 +400,13 @@ class VisItDataWriter * @param variable_name name of variable. * @param level_number level number on which data index is being reset. * @param patch_data_index new patch data array index. - * @param start_depth_index (optional) argument indicating the new depth index. + * @param start_depth_index (optional) argument indicating the new depth + * index. + * + * @pre !variable_name.empty() + * @pre level_number >= 0 + * @pre patch_data_index >= -1 + * @pre start_depth_index >= 0 */ void resetLevelPlotQuantity( @@ -394,13 +419,13 @@ class VisItDataWriter * @brief This method is used to register node coordinates for * deformed structured AMR grids (moving grids). * - * The patch data index must correspond to an DIM dimensional vector + * The patch data index must correspond to an dim-dimensional vector * that defines the coordinate location ([X,Y] in 2D, [X,Y,Z] in 3D). * The data defining the node locations must be node centered. * * An error results and the program will halt if: * - the patch data array index is invalid. - * - the depth of the patch data index is less than DIM. + * - the depth of the patch data index is less than dim. * * If the nodal coordinates are not in a NodeData object on the * hierarchy, you can use registerDerivedPlotQuantity() with the @@ -410,6 +435,9 @@ class VisItDataWriter * @param patch_data_index patch data index of the coordinate data. * @param start_depth_index (optional) start index for case where * coordinate data is a subcomponent of a larger patch data vector + * + * @pre patch_data_index >= -1 + * @pre start_depth_index >= 0 */ void registerNodeCoordinates( @@ -436,6 +464,10 @@ class VisItDataWriter * coordinate data is a subcomponent of a larger patch data vector * @param scale_factor scale factor with which to multiply * coordinate data values + * + * @pre (coordinate_number >= 0) && (coordinate_number < d_dim.getValue()) + * @pre patch_data_index >= -1 + * @pre depth_index >= 0 */ void registerSingleNodeCoordinate( @@ -486,10 +518,14 @@ class VisItDataWriter * or any material name string is empty. * * @param material_names tbox::Array of strings: the names of the materials. + * + * @pre material_names.size() > 0 + * @pre for each member of material_names, mn, !mn.empty() + * @pre d_materials_names.size() == 0 */ void registerMaterialNames( - const tbox::Array& material_names); + const std::vector& material_names); /*! * @brief This method registers with the VisIt data writer the @@ -528,10 +564,14 @@ class VisItDataWriter * or any material name string is empty. * * @param material_names tbox::Array of strings: the names of the materials. + * + * @pre material_names.size() > 0 + * @pre for each member of material_names, mn, !mn.empty() + * @pre d_materials_names.size() == 0 */ void registerSparseMaterialNames( - const tbox::Array& material_names); + const std::vector& material_names); /*! * @brief This method registers the names of the species for a @@ -540,7 +580,7 @@ class VisItDataWriter * Species are subcomponents of a material. For example, a simulation * with 4 materials (e.g. "copper", "gold", "liquid" and "gas") may have * one of the materials (e.g. "gas") that is composed of multiple - * species (e.g. "nitrogen" and helium"). Each species is associated + * species (e.g. "nitrogen" and "helium"). Each species is associated * with a particular material, so it is necessary that the * "registerMaterialNames()" method is called before this method. * @@ -573,14 +613,18 @@ class VisItDataWriter * or any name string is empty. * * @param material_name String name of the material whose species - * names are being registered. + * names are being registered. * @param species_names tbox::Array of strings: the names of the species - * for material_name. + * for material_name. + * + * @pre !material_name.empty() + * @pre species_names.size() > 0 + * @pre d_materials_names.size() > 0 */ void registerSpeciesNames( const std::string& material_name, - const tbox::Array& species_names); + const std::vector& species_names); /*! * @brief This method registers expressions that will be embedded in the @@ -591,12 +635,11 @@ class VisItDataWriter * (scalar, vector, tensor). For more information on defining VisIt * expressions see the VisItUsersManual. */ - void registerVisItExpressions( - const tbox::Array& expression_keys, - const tbox::Array& expressions, - const tbox::Array& expression_types); + const std::vector& expression_keys, + const std::vector& expressions, + const std::vector& expression_types); /*! * @brief This method causes the VisIt data writer to dump all @@ -618,11 +661,15 @@ class VisItDataWriter * the time step is < 0, or the dump directory name string is empty, * * @param hierarchy A pointer to the patch hierarchy on which the data - * to be plotted is defined. + * to be plotted is defined. * @param time_step Non-negative integer value specifying the current - * time step number. + * time step number. * @param simulation_time Optional argument specifying the double - * precision simulation time. Default is 0.0. + * precision simulation time. Default is 0.0. + * + * @pre hierarchy + * @pre time_step_number >= 0 + * @pre !d_top_level_directory_name.empty() */ void writePlotData( @@ -639,6 +686,8 @@ class VisItDataWriter * so the actual name of the file will be ".samrai". If no * alternative name is supplied, by default the summary file used is * "summary.samrai". + * + * @pre !filename.empty() */ void setSummaryFilename( @@ -749,8 +798,8 @@ class VisItDataWriter /* * hier::Variable type: * SCALAR - scalar plot variable (depth = 1) - * VECTOR - vector plot variable (depth = DIM) - * TENSOR - tensor plot variable (depth = DIM*DIM) + * VECTOR - vector plot variable (depth = dim) + * TENSOR - tensor plot variable (depth = dim*dim) */ enum variable_type { VISIT_SCALAR = 0, VISIT_VECTOR = 1, @@ -861,18 +910,18 @@ class VisItDataWriter */ int d_depth; variable_data_type d_var_data_type; - tbox::Array d_visit_var_name; + std::vector d_visit_var_name; struct patchMinMaxStruct * d_master_min_max[VISIT_MAX_NUMBER_COMPONENTS]; - tbox::Array d_level_patch_data_index; - tbox::Array d_coord_scale_factor; + std::vector d_level_patch_data_index; + std::vector d_coord_scale_factor; /* * Material information */ bool d_isa_material; std::string d_material_name; - tbox::Array d_species_names; + std::vector d_species_names; VisMaterialsDataStrategy* d_materials_writer; /* * Species information @@ -937,7 +986,8 @@ class VisItDataWriter const boost::shared_ptr& processor_HDFGroup, const boost::shared_ptr& hierarchy, int coarsest_level, - int finest_level); + int finest_level, + double simulation_time); /* * Pack regular (i.e. NOT materials or species) and derived data into @@ -948,7 +998,8 @@ class VisItDataWriter const boost::shared_ptr& patch_HDFGroup, const boost::shared_ptr& hierarchy, const int level_number, - hier::Patch& patch); + hier::Patch& patch, + double simulation_time); /* * Pack the materials data into the supplied database for output. @@ -1043,7 +1094,7 @@ class VisItDataWriter const int finest_plot_level); /* - * Pack DIM patch data into 1D double precision buffer, + * Pack dim patch data into 1D double precision buffer, * eliminating ghost data if necessary */ void @@ -1148,6 +1199,11 @@ class VisItDataWriter */ const tbox::Dimension d_dim; + /*! + * @brief Exclusive SAMRAI_MPI duplicated for this object. + */ + tbox::SAMRAI_MPI d_mpi; + /* * Name of this VisIt data writer object */ @@ -1162,7 +1218,7 @@ class VisItDataWriter * tbox::Array of mesh-scaling ratios from each level to reference level * (i.e., coarsest level). */ - tbox::Array d_scaling_ratios; + std::vector d_scaling_ratios; /* * Default data writer for user defined data. @@ -1205,7 +1261,7 @@ class VisItDataWriter */ int d_number_file_clusters; int d_my_file_cluster_number; - tbox::Array d_processor_in_file_cluster_number; + std::vector d_processor_in_file_cluster_number; bool d_file_cluster_leader; int d_file_cluster_size; int d_my_rank_in_file_cluster; @@ -1229,7 +1285,7 @@ class VisItDataWriter */ int d_number_visit_variables; int d_number_visit_variables_plus_depth; - tbox::Array d_materials_names; + std::vector d_materials_names; int d_number_species; /* @@ -1256,9 +1312,9 @@ class VisItDataWriter * brief Storage for strings defining VisIt expressions to be embedded in * the plot dump. */ - tbox::Array d_visit_expression_keys; - tbox::Array d_visit_expressions; - tbox::Array d_visit_expression_types; + std::vector d_visit_expression_keys; + std::vector d_visit_expressions; + std::vector d_visit_expression_types; //! @brief Timer for writePlotData(). static boost::shared_ptr t_write_plot_data; @@ -1272,7 +1328,7 @@ class VisItDataWriter initializeCallback() { t_write_plot_data = tbox::TimerManager::getManager()->getTimer( - "appu:VisItDataWriter::writePlotData()"); + "appu:VisItDataWriter::writePlotData()"); } /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.C index 7070f0f4..22c5d99b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for writing material related data to VisIt * dump file * ************************************************************************/ - -#ifndef included_appu_VisMaterialsDataStrategy_C -#define included_appu_VisMaterialsDataStrategy_C - #include "SAMRAI/appu/VisMaterialsDataStrategy.h" #include "SAMRAI/tbox/Utilities.h" @@ -96,5 +92,3 @@ VisMaterialsDataStrategy::packSpeciesFractionsIntoDoubleBuffer( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.h index 04ca3673..44272b5e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/VisMaterialsDataStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for writing material related data to a VisIt * dump file. * @@ -45,7 +45,7 @@ namespace appu { * be implemented. If material state variables are used, * packMaterialStateVariableIntoDoubleBuffer() must be implemented. * - * @see appu::VisItDataWriter + * @see VisItDataWriter */ class VisMaterialsDataStrategy diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual.dox index e94e7711..f7400154 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_boundary.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_boundary.dox index 9bfc5cfc..79344f23 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_boundary.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_boundary.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_plotting.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_plotting.dox index e23a991a..735bff03 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_plotting.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/dox/manual_plotting.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ @@ -13,13 +13,12 @@ namespace SAMRAI { @page package_apputils_plotting Visualization Data File Generation These classes provide basic support to generate data files that may - be post-processed using the Vizamrai or Visit visualization tool. Two kinds + be post-processed using the VisIt visualization tool. Two kinds of data quantities are supported, those that reside on an AMR patch hierarchy when a data file is created, and those that are "derived" from data living on an AMR patch hierarchy. - The Vizamrai writer supports cartesian cell-centered data only, while - the Visit writer supports cell, node, and logically-mapped (e.g. ALE) + The VisIt writer supports cell, node, and logically-mapped (e.g. ALE) data. In addition, the VisIt writer supports material-related data and ghost zone data. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.depend index dcacf763..c992eb83 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -13,67 +13,45 @@ FILE_0=appu_cartbdry2d.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_cartbdry2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + appu_cartbdry2d.m4 appu_cartbdryparams2d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=appu_cartbdry3d.o DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_cartbdry3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + appu_cartbdry3d.m4 appu_cartbdryparams3d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=appu_cpdat2buf2d.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_cpdat2buf2d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=appu_cpdat2buf3d.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_cpdat2buf3d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ -endif - -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} - -FILE_4=appu_ebdry2d.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_ebdry2d.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - -endif - -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} -FILE_5=appu_ebdry3d.o -DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h appu_ebdry3d.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ - -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} +${FILE_3}: ${DEPENDS_3} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.in index 6bcfa99b..2617ea36 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/Makefile.in @@ -3,31 +3,40 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for appu directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/appu/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. -# For classes that are non-dimensional. -OBJS= appu_ebdry2d.o appu_ebdry3d.o appu_cpdat2buf2d.o\ - appu_cpdat2buf3d.o\ - appu_cartbdry2d.o \ - appu_cartbdry3d.o - - default: library include $(OBJECT)/config/Makefile.config +OBJS= appu_cpdat2buf2d.o \ + appu_cpdat2buf3d.o \ + appu_cartbdry2d.o \ + appu_cartbdry3d.o + library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) + $(RM) *.f include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +appu_cartbdry2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/appu_cartbdry2d.m4 > appu_cartbdry2d.f + $(F77) $(FFLAGS) -c appu_cartbdry2d.f -o $@ + +appu_cartbdry3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/appu_cartbdry3d.m4 > appu_cartbdry3d.f + $(F77) $(FFLAGS) -c appu_cartbdry3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.f deleted file mode 100644 index 00cc58c0..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.f +++ /dev/null @@ -1,501 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for Cartesian 2d boundary conditions -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c general boundary condition cases -c -c -c node boundary conditions -c -c -c edge boundary conditions -c -c*********************************************************************** -c*********************************************************************** - subroutine getcartedgebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & dx, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks -c - common/cartbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/cartbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c - double precision dx(0:2-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1, 0) 2 (0,-1) -c 1 ( 1, 0) 3 (0, 1) -c*********************************************************************** -c*********************************************************************** - edge_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + dirsign0 - & * edge_values(k,edge_loc) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getcartedgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + dirsign1 - & * edge_values(k,edge_loc) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getcartedgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getcartnodebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & dx, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks -c - common/cartbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/cartbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c - double precision dx(0:2-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc0,edge_loc1 - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index -c 0 (-1,-1) -c 1 ( 1,-1) -c 2 (-1, 1) -c 3 ( 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X0Y1) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - else if (bdry_loc.eq.X1Y1) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc0) - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc1) - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + dirsign0 - & * edge_values(k,edge_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + dirsign1 - & * edge_values(k,edge_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getcartnodebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufcartbdryloc2d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks -c - common/cartbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/cartbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - -c 2d edges - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - -c 2d nodes - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufcartbdrycond2d( - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks -c - common/cartbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/cartbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - - NEUMANN=NEUMANNin - XNEUMANN=XNEUMANNin - YNEUMANN=YNEUMANNin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.m4 index 21abaa91..0a06e633 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry2d.m4 @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for Cartesian 2d boundary conditions +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for Cartesian 2d boundary conditions. c define(NDIM,2)dnl define(REAL,`double precision')dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c c general boundary condition cases c @@ -148,7 +147,7 @@ c*********************************************************************** & arrdepth) c*********************************************************************** implicit none -include(appu_cartbdryparams2d.i)dnl +include(FORTDIR/appu_cartbdryparams2d.i)dnl c*********************************************************************** integer ifirst0,ilast0,ifirst1,ilast1 integer ibeg0,iend0,ibeg1,iend1 @@ -218,7 +217,7 @@ c*********************************************************************** & arrdepth) c*********************************************************************** implicit none -include(appu_cartbdryparams2d.i)dnl +include(FORTDIR/appu_cartbdryparams2d.i)dnl c*********************************************************************** integer ifirst0,ilast0,ifirst1,ilast1 integer ibeg0,iend0,ibeg1,iend1 @@ -293,7 +292,7 @@ c*********************************************************************** integer & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, & X0Y0in, X1Y0in, X0Y1in, X1Y1in -include(appu_cartbdryparams2d.i)dnl +include(FORTDIR/appu_cartbdryparams2d.i)dnl c 2d edges XLEFT=XLEFTin @@ -322,7 +321,7 @@ c*********************************************************************** & REFLECTin, XREFLECTin, YREFLECTin, & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, & NEUMANNin, XNEUMANNin, YNEUMANNin -include(appu_cartbdryparams2d.i)dnl +include(FORTDIR/appu_cartbdryparams2d.i)dnl FLOW=FLOWin XFLOW=XFLOWin diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.f deleted file mode 100644 index 2d4b9538..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.f +++ /dev/null @@ -1,1434 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for Cartesian 3d boundary conditions -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c general boundary condition cases -c -c -c edge boundary conditions -c -c -c node boundary conditions -c -c -c face boundary conditions -c -c*********************************************************************** -c*********************************************************************** - subroutine getcartfacebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks -c - common/cartbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/cartbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (-1, 0, 0) 2 (0,-1, 0) 4 (0, 0,-1) -c 1 ( 1, 0, 0) 3 (0, 1, 0) 5 (0, 0, 1) -c*********************************************************************** -c*********************************************************************** - face_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getcartfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getcartfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.ZLEFT).or.(bdry_loc.eq.ZRIGHT)) then - if (bdry_loc.eq.ZLEFT) then -c z0 boundary - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else -c z1 boundary - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getcartfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getcartedgebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks -c - common/cartbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/cartbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) -c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) -c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) -c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) -c*********************************************************************** -c*********************************************************************** - if ((bdry_loc.eq.Y0Z0).or.(bdry_loc.eq.Y1Z0).or. - & (bdry_loc.eq.Y0Z1).or.(bdry_loc.eq.Y1Z1)) then - if (bdry_loc.eq.Y0Z0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y1Z0) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y0Z1) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getcartedgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Z0).or.(bdry_loc.eq.X0Z1).or. - & (bdry_loc.eq.X1Z0).or.(bdry_loc.eq.X1Z1)) then - if (bdry_loc.eq.X0Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X0Z1) then - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getcartedgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Y0).or.(bdry_loc.eq.X1Y0).or. - & (bdry_loc.eq.X0Y1).or.(bdry_loc.eq.X1Y1)) then - if (bdry_loc.eq.X0Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else if (bdry_loc.eq.X0Y1) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getcartedgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getcartnodebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks -c - common/cartbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/cartbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1,-1,-1) 4 (-1,-1, 1) -c 1 ( 1,-1,-1) 5 ( 1,-1, 1) -c 2 (-1, 1,-1) 6 (-1, 1, 1) -c 3 ( 1, 1,-1) 7 ( 1, 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y0Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y1Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y1Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y0Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y0Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X0Y1Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y1Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getcartnodebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufcartbdryloc3d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks -c - common/cartbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/cartbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - -c 3d faces - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - ZLEFT=ZLEFTin - ZRIGHT=ZRIGHTin - -c 3d edges - Y0Z0=Y0Z0in - Y1Z0=Y1Z0in - Y0Z1=Y0Z1in - Y1Z1=Y1Z1in - X0Z0=X0Z0in - X0Z1=X0Z1in - X1Z0=X1Z0in - X1Z1=X1Z1in - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - -c 3d nodes - X0Y0Z0=X0Y0Z0in - X1Y0Z0=X1Y0Z0in - X0Y1Z0=X0Y1Z0in - X1Y1Z0=X1Y1Z0in - X0Y0Z1=X0Y0Z1in - X1Y0Z1=X1Y0Z1in - X0Y1Z1=X0Y1Z1in - X1Y1Z1=X1Y1Z1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufcartbdrycond3d( - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks -c - common/cartbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/cartbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - ZFLOW=ZFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - ZREFLECT=ZREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - ZDIRICHLET=ZDIRICHLETin - - NEUMANN=NEUMANNin - XNEUMANN=XNEUMANNin - YNEUMANN=YNEUMANNin - ZNEUMANN=ZNEUMANNin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.m4 index d94b6fbc..787c17a9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdry3d.m4 @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for Cartesian 3d boundary conditions +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for Cartesian 3d boundary conditions. c define(NDIM,3)dnl define(REAL,`double precision')dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c c general boundary condition cases c @@ -257,7 +256,7 @@ c*********************************************************************** & arrdepth) c*********************************************************************** implicit none -include(appu_cartbdryparams3d.i)dnl +include(FORTDIR/appu_cartbdryparams3d.i)dnl c*********************************************************************** integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 @@ -338,7 +337,7 @@ c*********************************************************************** & arrdepth) c*********************************************************************** implicit none -include(appu_cartbdryparams3d.i)dnl +include(FORTDIR/appu_cartbdryparams3d.i)dnl c*********************************************************************** integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 @@ -484,7 +483,7 @@ c*********************************************************************** & arrdepth) c*********************************************************************** implicit none -include(appu_cartbdryparams3d.i)dnl +include(FORTDIR/appu_cartbdryparams3d.i)dnl c*********************************************************************** integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 @@ -619,7 +618,7 @@ c*********************************************************************** & X0Y0in, X1Y0in, X0Y1in, X1Y1in, & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in -include(appu_cartbdryparams3d.i)dnl +include(FORTDIR/appu_cartbdryparams3d.i)dnl c 3d faces XLEFT=XLEFTin @@ -668,7 +667,7 @@ c*********************************************************************** & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin -include(appu_cartbdryparams3d.i)dnl +include(FORTDIR/appu_cartbdryparams3d.i)dnl FLOW=FLOWin XFLOW=XFLOWin diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams2d.i index ac615f1f..fd9cfb8e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams2d.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d boundary constant common blocks. c common/cartbdrylocparams2d/ & XLEFT,XRIGHT,YLEFT,YRIGHT, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams3d.i index c77ed0f0..c75aab7d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cartbdryparams3d.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d boundary constant common blocks +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d boundary constant common blocks. c common/cartbdrylocparams3d/ & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf2d.f index b5d9e289..c8c26d70 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf2d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf2d.f @@ -1,9 +1,9 @@ -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: copies data from 2D fortran array to 1D double buffer +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: Copies data from 2D fortran array to 1D double buffer. c subroutine cpddat2buf2d( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf3d.f index a17dafe0..6e08085c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf3d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_cpdat2buf3d.f @@ -1,9 +1,9 @@ -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: copies data from 3D fortran array to 1D double buffer +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: Copies data from 3D fortran array to 1D double buffer. c subroutine cpfdat2buf3d( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.f deleted file mode 100644 index 2d011000..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.f +++ /dev/null @@ -1,320 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for setting embedded boundary conditions. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Set common definitions - integers passed from C++ code that define -c constants. -c*********************************************************************** -c - subroutine setebparams( - & SOLIDin,CUTin,BORDERin,FLOWin, - & OUTSIDEin,INSIDEin,BOUNDARYin,ONBOUNDARYin) -c*********************************************************************** - implicit none - integer - & SOLIDin,CUTin,BORDERin,FLOWin, - & OUTSIDEin,INSIDEin,BOUNDARYin,ONBOUNDARYin -c -c File: $URL$ -c Package: SAMRAI application -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: Commonblock in embedded boundary test code. -c - - common/ebparams/SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB - integer - & SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB -c*********************************************************************** -c - SOLID_EB = SOLIDin - CUT_EB = CUTin - BORDER_EB = BORDERin - FLOW_EB = FLOWin - OUTSIDE_EB = OUTSIDEin - INSIDE_EB = INSIDEin - BOUNDARY_EB = BOUNDARYin - ONBOUNDARY_EB = ONBOUNDARYin - - return - end - -c -c*********************************************************************** -c Convert node inout values to cell flags. -c*********************************************************************** -c - subroutine node2cellflag2d( - & ifirst0,ifirst1, - & ilast0,ilast1, - & ngc0,ngc1, - & cgc0,cgc1, - & node_flag, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: Commonblock in embedded boundary test code. -c - - common/ebparams/SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB - integer - & SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB -c*********************************************************************** -c - integer - & ifirst0,ifirst1, - & ilast0,ilast1, - & ngc0,ngc1, - & cgc0,cgc1 - integer - & node_flag(ifirst0-ngc0:ilast0+1+ngc0, - & ifirst1-ngc1:ilast1+1+ngc1) - integer - & cell_flag(ifirst0-cgc0:ilast0+cgc0, - & ifirst1-cgc1:ilast1+cgc1) - double precision - & cell_vol(ifirst0-cgc0:ilast0+cgc0, - & ifirst1-cgc1:ilast1+cgc1) - integer ic0,ic1 -c -c The cell flag is equal to the sum of the node flags around it. -c - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - cell_flag(ic0,ic1) = - & node_flag(ic0,ic1) + node_flag(ic0+1,ic1) + - & node_flag(ic0,ic1+1) + node_flag(ic0+1,ic1+1) - end do - end do -c -c If the cell flag is: -c flag = 0 - FLOW cell -c flag = 2^NDIM - SOLID cell -c flag = anything else - CUT cell -c -c Set volume of cut cell to -1.0 to trip an error if we don't reset it. -c - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - if (cell_flag(ic0,ic1).eq.0) then - cell_flag(ic0,ic1) = FLOW_EB - cell_vol(ic0,ic1) = 1.0 - else if (cell_flag(ic0,ic1).eq.2**2) then - cell_flag(ic0,ic1) = SOLID_EB - cell_vol(ic0,ic1) = 0.0 - else - cell_flag(ic0,ic1) = CUT_EB - cell_vol(ic0,ic1) = -1.0 - endif - end do - end do - - return - end - - -c -c*********************************************************************** -c Set boundary condtions for embedded boundary -c*********************************************************************** -c - subroutine setebnode2d( - & ifirst0,ilast0, - & ifirst1,ilast1, - & ibeg0,iend0, - & ibeg1,iend1, - & ngc0, ngc1, - & bdry_loc, - & bdry_cond, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d boundary constant common blocks -c - common/cartbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/cartbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN -c*********************************************************************** -c - integer - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, bdry_cond - integer - & cell_flag(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1) - double precision - & cell_vol(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1) - integer ic0,ic1 -c -c*********************************************************************** -c -c -c Set the cell volume and tags appropriately -c -c DIRICHLET,NEUMANN, - cell_tag(bdry) = cell_tag(interior) -c REFLECT cell_vol(bdry) = cell_vol(interior) -c - - - if ((bdry_cond.eq.XDIRICHLET).or. - & (bdry_cond.eq.XREFLECT).or. - & (bdry_cond.eq.XNEUMANN)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ifirst0,ic1) - cell_vol(ic0,ic1) = cell_vol(ifirst0,ic1) - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ifirst0,ic1) - cell_vol(ic0,ic1) = cell_vol(ifirst0,ic1) - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ilast0,ic1) - cell_vol(ic0,ic1) = cell_vol(ilast0,ic1) - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ilast0,ic1) - cell_vol(ic0,ic1) = cell_vol(ilast0,ic1) - end do - end do - endif - - endif - - if ((bdry_cond.eq.YDIRICHLET).or. - & (bdry_cond.eq.YREFLECT).or. - & (bdry_cond.eq.YNEUMANN)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ic0,ifirst1) - cell_vol(ic0,ic1) = cell_vol(ic0,ifirst1) - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ic0,ilast1) - cell_vol(ic0,ic1) = cell_vol(ic0,ilast1) - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ic0,ifirst1) - cell_vol(ic0,ic1) = cell_vol(ic0,ifirst1) - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ic0,ilast1) - cell_vol(ic0,ic1) = cell_vol(ic0,ilast1) - end do - end do - endif - - endif - -c -c FLOW - cell_tag(bdry) = -2 -c cell_vol(bdry) = 0. -c - if ((bdry_cond.eq.XFLOW).or. - & (bdry_cond.eq.YFLOW)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - endif - endif - - - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.m4 deleted file mode 100644 index 1fc63730..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry2d.m4 +++ /dev/null @@ -1,262 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for setting embedded boundary conditions. -c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -c -c*********************************************************************** -c Set common definitions - integers passed from C++ code that define -c constants. -c*********************************************************************** -c - subroutine setebparams( - & SOLIDin,CUTin,BORDERin,FLOWin, - & OUTSIDEin,INSIDEin,BOUNDARYin,ONBOUNDARYin) -c*********************************************************************** - implicit none - integer - & SOLIDin,CUTin,BORDERin,FLOWin, - & OUTSIDEin,INSIDEin,BOUNDARYin,ONBOUNDARYin -include(ebparams.i)dnl -c*********************************************************************** -c - SOLID_EB = SOLIDin - CUT_EB = CUTin - BORDER_EB = BORDERin - FLOW_EB = FLOWin - OUTSIDE_EB = OUTSIDEin - INSIDE_EB = INSIDEin - BOUNDARY_EB = BOUNDARYin - ONBOUNDARY_EB = ONBOUNDARYin - - return - end - -c -c*********************************************************************** -c Convert node inout values to cell flags. -c*********************************************************************** -c - subroutine node2cellflag2d( - & ifirst0,ifirst1, - & ilast0,ilast1, - & ngc0,ngc1, - & cgc0,cgc1, - & node_flag, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -include(ebparams.i)dnl -c*********************************************************************** -c - integer - & ifirst0,ifirst1, - & ilast0,ilast1, - & ngc0,ngc1, - & cgc0,cgc1 - integer - & node_flag(NODE2dVECG(ifirst,ilast,ngc)) - integer - & cell_flag(CELL2dVECG(ifirst,ilast,cgc)) - double precision - & cell_vol(CELL2dVECG(ifirst,ilast,cgc)) - integer ic0,ic1 -c -c The cell flag is equal to the sum of the node flags around it. -c - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - cell_flag(ic0,ic1) = - & node_flag(ic0,ic1) + node_flag(ic0+1,ic1) + - & node_flag(ic0,ic1+1) + node_flag(ic0+1,ic1+1) - end do - end do -c -c If the cell flag is: -c flag = 0 - FLOW cell -c flag = 2^NDIM - SOLID cell -c flag = anything else - CUT cell -c -c Set volume of cut cell to -1.0 to trip an error if we don't reset it. -c - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - if (cell_flag(ic0,ic1).eq.0) then - cell_flag(ic0,ic1) = FLOW_EB - cell_vol(ic0,ic1) = 1.0 - else if (cell_flag(ic0,ic1).eq.2**2) then - cell_flag(ic0,ic1) = SOLID_EB - cell_vol(ic0,ic1) = 0.0 - else - cell_flag(ic0,ic1) = CUT_EB - cell_vol(ic0,ic1) = -1.0 - endif - end do - end do - - return - end - - -c -c*********************************************************************** -c Set boundary condtions for embedded boundary -c*********************************************************************** -c - subroutine setebnode2d( - & ifirst0,ilast0, - & ifirst1,ilast1, - & ibeg0,iend0, - & ibeg1,iend1, - & ngc0, ngc1, - & bdry_loc, - & bdry_cond, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -include(appu_cartbdryparams2d.i)dnl -c*********************************************************************** -c - integer - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, bdry_cond - integer - & cell_flag(CELL2dVECG(ifirst,ilast,ngc)) - double precision - & cell_vol(CELL2dVECG(ifirst,ilast,ngc)) - integer ic0,ic1 -c -c*********************************************************************** -c -c -c Set the cell volume and tags appropriately -c -c DIRICHLET,NEUMANN, - cell_tag(bdry) = cell_tag(interior) -c REFLECT cell_vol(bdry) = cell_vol(interior) -c - - - if ((bdry_cond.eq.XDIRICHLET).or. - & (bdry_cond.eq.XREFLECT).or. - & (bdry_cond.eq.XNEUMANN)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ifirst0,ic1) - cell_vol(ic0,ic1) = cell_vol(ifirst0,ic1) - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ifirst0,ic1) - cell_vol(ic0,ic1) = cell_vol(ifirst0,ic1) - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ilast0,ic1) - cell_vol(ic0,ic1) = cell_vol(ilast0,ic1) - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ilast0,ic1) - cell_vol(ic0,ic1) = cell_vol(ilast0,ic1) - end do - end do - endif - - endif - - if ((bdry_cond.eq.YDIRICHLET).or. - & (bdry_cond.eq.YREFLECT).or. - & (bdry_cond.eq.YNEUMANN)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ic0,ifirst1) - cell_vol(ic0,ic1) = cell_vol(ic0,ifirst1) - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = cell_flag(ic0,ilast1) - cell_vol(ic0,ic1) = cell_vol(ic0,ilast1) - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ic0,ifirst1) - cell_vol(ic0,ic1) = cell_vol(ic0,ifirst1) - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = cell_flag(ic0,ilast1) - cell_vol(ic0,ic1) = cell_vol(ic0,ilast1) - end do - end do - endif - - endif - -c -c FLOW - cell_tag(bdry) = -2 -c cell_vol(bdry) = 0. -c - if ((bdry_cond.eq.XFLOW).or. - & (bdry_cond.eq.YFLOW)) then - - if (bdry_loc.eq.X0Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X0Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ifirst0-ngc0,ifirst0-1 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X1Y0) then - do ic1=ifirst1-ngc1,ifirst1-1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - else if (bdry_loc.eq.X1Y1) then - do ic1=ilast1+1,ilast1+ngc1 - do ic0=ilast0+1,ilast0+ngc0 - cell_flag(ic0,ic1) = -2 - cell_vol(ic0,ic1) = 0. - end do - end do - endif - endif - - - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.f deleted file mode 100644 index 7d157560..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.f +++ /dev/null @@ -1,110 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for setting embedded boundary conditions. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Convert node inout values to cell flags. -c*********************************************************************** -c - subroutine node2cellflag3d( - & ifirst0,ifirst1,ifirst2, - & ilast0,ilast1,ilast2, - & ngc0,ngc1,ngc2, - & cgc0,cgc1,cgc2, - & node_flag, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -c -c File: $URL$ -c Package: SAMRAI application -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: Commonblock in embedded boundary test code. -c - - common/ebparams/SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB - integer - & SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB -c*********************************************************************** -c - integer - & ifirst0,ifirst1,ifirst2, - & ilast0,ilast1,ilast2, - & ngc0,ngc1,ngc2, - & cgc0,cgc1,cgc2 - integer - & node_flag(ifirst0-ngc0:ilast0+1+ngc0, - & ifirst1-ngc1:ilast1+1+ngc1, - & ifirst2-ngc2:ilast2+1+ngc2) - integer - & cell_flag(ifirst0-cgc0:ilast0+cgc0, - & ifirst1-cgc1:ilast1+cgc1, - & ifirst2-cgc2:ilast2+cgc2) - double precision - & cell_vol(ifirst0-cgc0:ilast0+cgc0, - & ifirst1-cgc1:ilast1+cgc1, - & ifirst2-cgc2:ilast2+cgc2) - integer ic0,ic1,ic2 -c -c The cell flag is equal to the sum of the node flags around it. -c - do ic2 = ifirst2, ilast2 - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - cell_flag(ic0,ic1,ic2) = - & node_flag(ic0,ic1,ic2) + - & node_flag(ic0+1,ic1,ic2) + - & node_flag(ic0,ic1+1,ic2) + - & node_flag(ic0+1,ic1+1,ic2) + - & node_flag(ic0,ic1,ic2+1) + - & node_flag(ic0+1,ic1,ic2+1) + - & node_flag(ic0,ic1+1,ic2+1) + - & node_flag(ic0+1,ic1+1,ic2+1) - end do - end do - end do -c -c If the cell flag is: -c flag = 0 - FLOW cell -c flag = 2^NDIM - SOLID cell -c 0 < flag < 2^NDIM - CUT cell -c -c Set volume of cut cell to -1.0 to trip an error if we don't reset it. -c - do ic2 = ifirst2, ilast2 - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - if (cell_flag(ic0,ic1,ic2).eq.0) then - cell_flag(ic0,ic1,ic2) = FLOW_EB - cell_vol(ic0,ic1,ic2) = 1.0 - else if (cell_flag(ic0,ic1,ic2).eq.2**3) then - cell_flag(ic0,ic1,ic2) = SOLID_EB - cell_vol(ic0,ic1,ic2) = 0.0 - else - cell_flag(ic0,ic1,ic2) = CUT_EB - cell_vol(ic0,ic1,ic2) = -1.0 - endif - end do - end do - end do - - return - end - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.m4 deleted file mode 100644 index 27d1e5c2..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/appu_ebdry3d.m4 +++ /dev/null @@ -1,87 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for setting embedded boundary conditions. -c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -c -c*********************************************************************** -c Convert node inout values to cell flags. -c*********************************************************************** -c - subroutine node2cellflag3d( - & ifirst0,ifirst1,ifirst2, - & ilast0,ilast1,ilast2, - & ngc0,ngc1,ngc2, - & cgc0,cgc1,cgc2, - & node_flag, - & cell_flag, - & cell_vol) -c*********************************************************************** - implicit none -include(ebparams.i)dnl -c*********************************************************************** -c - integer - & ifirst0,ifirst1,ifirst2, - & ilast0,ilast1,ilast2, - & ngc0,ngc1,ngc2, - & cgc0,cgc1,cgc2 - integer - & node_flag(NODE3dVECG(ifirst,ilast,ngc)) - integer - & cell_flag(CELL3dVECG(ifirst,ilast,cgc)) - double precision - & cell_vol(CELL3dVECG(ifirst,ilast,cgc)) - integer ic0,ic1,ic2 -c -c The cell flag is equal to the sum of the node flags around it. -c - do ic2 = ifirst2, ilast2 - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - cell_flag(ic0,ic1,ic2) = - & node_flag(ic0,ic1,ic2) + - & node_flag(ic0+1,ic1,ic2) + - & node_flag(ic0,ic1+1,ic2) + - & node_flag(ic0+1,ic1+1,ic2) + - & node_flag(ic0,ic1,ic2+1) + - & node_flag(ic0+1,ic1,ic2+1) + - & node_flag(ic0,ic1+1,ic2+1) + - & node_flag(ic0+1,ic1+1,ic2+1) - end do - end do - end do -c -c If the cell flag is: -c flag = 0 - FLOW cell -c flag = 2^NDIM - SOLID cell -c 0 < flag < 2^NDIM - CUT cell -c -c Set volume of cut cell to -1.0 to trip an error if we don't reset it. -c - do ic2 = ifirst2, ilast2 - do ic1 = ifirst1, ilast1 - do ic0 = ifirst0, ilast0 - if (cell_flag(ic0,ic1,ic2).eq.0) then - cell_flag(ic0,ic1,ic2) = FLOW_EB - cell_vol(ic0,ic1,ic2) = 1.0 - else if (cell_flag(ic0,ic1,ic2).eq.2**3) then - cell_flag(ic0,ic1,ic2) = SOLID_EB - cell_vol(ic0,ic1,ic2) = 0.0 - else - cell_flag(ic0,ic1,ic2) = CUT_EB - cell_vol(ic0,ic1,ic2) = -1.0 - endif - end do - end do - end do - - return - end - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/ebparams.i b/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/ebparams.i deleted file mode 100644 index 939faa20..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/appu/fortran/ebparams.i +++ /dev/null @@ -1,13 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI application -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: Commonblock in embedded boundary test code. -c - - common/ebparams/SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB - integer - & SOLID_EB,CUT_EB,BORDER_EB,FLOW_EB, - & OUTSIDE_EB,INSIDE_EB,BOUNDARY_EB,ONBOUNDARY_EB diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.C index 7e1d76e9..fefdfd18 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.C @@ -3,22 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered * omplex data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellComplexConservativeLinearRefine_C -#define included_geom_CartesianCellComplexConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/tbox/Complex.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include @@ -39,7 +34,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefcellcplx1d, CARTCLINREFCELLCPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellcplx1d, CARTCLINREFCELLCPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -48,7 +43,7 @@ void F77_FUNC(cartclinrefcellcplx1d, CARTCLINREFCELLCPLX1D) (const int&, const dcomplex *, dcomplex *, dcomplex *, dcomplex *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefcellcplx2d, CARTCLINREFCELLCPLX2D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellcplx2d, CARTCLINREFCELLCPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -56,7 +51,7 @@ void F77_FUNC(cartclinrefcellcplx2d, CARTCLINREFCELLCPLX2D) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *, dcomplex *, dcomplex *, dcomplex *, dcomplex *); -void F77_FUNC(cartclinrefcellcplx3d, CARTCLINREFCELLCPLX3D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellcplx3d, CARTCLINREFCELLCPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,9 +72,8 @@ namespace geom { // using namespace std; CartesianCellComplexConservativeLinearRefine:: -CartesianCellComplexConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianCellComplexConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -95,9 +89,9 @@ CartesianCellComplexConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellComplexConservativeLinearRefine::getStencilWidth() const +CartesianCellComplexConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -110,12 +104,13 @@ CartesianCellComplexConservativeLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -134,47 +129,50 @@ CartesianCellComplexConservativeLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 1); + std::vector diff0(cgbox.numberCells(0) + 1); pdat::CellData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinrefcellcplx1d, CARTCLINREFCELLCPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellcplx1d, CARTCLINREFCELLCPLX1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -184,12 +182,12 @@ CartesianCellComplexConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer()); + &diff0[0], slope0.getPointer()); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcellcplx2d, CARTCLINREFCELLCPLX2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellcplx2d, CARTCLINREFCELLCPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -199,16 +197,16 @@ CartesianCellComplexConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer()); } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 1); + std::vector diff2(cgbox.numberCells(2) + 1); pdat::CellData slope2(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcellcplx3d, CARTCLINREFCELLCPLX3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellcplx3d, CARTCLINREFCELLCPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -222,9 +220,9 @@ CartesianCellComplexConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer(), - diff2.getPointer(), slope2.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer(), + &diff2[0], slope2.getPointer()); } else { TBOX_ERROR("CartesianCellComplexConservativeLinearRefine error...\n" << "dim > 3 not supported." << std::endl); @@ -234,5 +232,3 @@ CartesianCellComplexConservativeLinearRefine::refine( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.h index 867321b7..a5c10e1f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered * omplex data on a Cartesian mesh. * @@ -20,7 +20,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -46,8 +46,7 @@ class CartesianCellComplexConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellComplexConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianCellComplexConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -66,7 +65,8 @@ class CartesianCellComplexConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -75,6 +75,8 @@ class CartesianCellComplexConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -93,6 +95,15 @@ class CartesianCellComplexConservativeLinearRefine: * that the coarse patch contains sufficient data for the stencil width of * the refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.C index fc22fa95..7dc278eb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellComplexLinearRefine_C -#define included_geom_CartesianCellComplexLinearRefine_C - #include "SAMRAI/geom/CartesianCellComplexLinearRefine.h" #include "SAMRAI/tbox/Complex.h" @@ -39,7 +35,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefcellcplx1d, CARTLINREFCELLCPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellcplx1d, CARTLINREFCELLCPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -47,7 +43,7 @@ void F77_FUNC(cartlinrefcellcplx1d, CARTLINREFCELLCPLX1D) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefcellcplx2d, CARTLINREFCELLCPLX2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellcplx2d, CARTLINREFCELLCPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(cartlinrefcellcplx2d, CARTLINREFCELLCPLX2D) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefcellcplx3d, CARTLINREFCELLCPLX3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellcplx3d, CARTLINREFCELLCPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -73,9 +69,8 @@ namespace geom { // using namespace std; -CartesianCellComplexLinearRefine::CartesianCellComplexLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianCellComplexLinearRefine::CartesianCellComplexLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -90,9 +85,9 @@ CartesianCellComplexLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellComplexLinearRefine::getStencilWidth() const +CartesianCellComplexLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -105,12 +100,13 @@ CartesianCellComplexLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -129,15 +125,15 @@ CartesianCellComplexLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -145,27 +141,30 @@ CartesianCellComplexLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefcellcplx1d, CARTLINREFCELLCPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellcplx1d, CARTLINREFCELLCPLX1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -176,7 +175,7 @@ CartesianCellComplexLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefcellcplx2d, CARTLINREFCELLCPLX2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellcplx2d, CARTLINREFCELLCPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -187,7 +186,7 @@ CartesianCellComplexLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefcellcplx3d, CARTLINREFCELLCPLX3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellcplx3d, CARTLINREFCELLCPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -211,4 +210,3 @@ CartesianCellComplexLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.h index abe798ef..0620b273 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellComplexLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellComplexLinearRefine( - const tbox::Dimension& dim); + CartesianCellComplexLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellComplexLinearRefine: * of ones. That is, its stencil extends one cell outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianCellComplexLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -88,6 +90,15 @@ class CartesianCellComplexLinearRefine: * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.C index 58696ff8..fe19ffcd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellComplexWeightedAverage_C -#define included_geom_CartesianCellComplexWeightedAverage_C - #include "SAMRAI/geom/CartesianCellComplexWeightedAverage.h" #include "SAMRAI/tbox/Complex.h" @@ -37,21 +33,21 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgcellcplx1d, CARTWGTAVGCELLCPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellcplx1d, CARTWGTAVGCELLCPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgcellcplx2d, CARTWGTAVGCELLCPLX2D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellcplx2d, CARTWGTAVGCELLCPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgcellcplx3d, CARTWGTAVGCELLCPLX3D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellcplx3d, CARTWGTAVGCELLCPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -60,6 +56,16 @@ void F77_FUNC(cartwgtavgcellcplx3d, CARTWGTAVGCELLCPLX3D) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgcellcplx4d, CARTWGTAVGCELLCPLX4D) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const dcomplex *, dcomplex *); } namespace SAMRAI { @@ -67,9 +73,8 @@ namespace geom { // using namespace std; -CartesianCellComplexWeightedAverage::CartesianCellComplexWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianCellComplexWeightedAverage::CartesianCellComplexWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -84,9 +89,9 @@ CartesianCellComplexWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianCellComplexWeightedAverage::getStencilWidth() const +CartesianCellComplexWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -98,37 +103,40 @@ CartesianCellComplexWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgcellcplx1d, CARTWGTAVGCELLCPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcellcplx1d, CARTWGTAVGCELLCPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -137,9 +145,8 @@ CartesianCellComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(d), cdata->getPointer(d)); - } - if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgcellcplx2d, CARTWGTAVGCELLCPLX2D) (ifirstc(0), + } else if ((dim == tbox::Dimension(2))) { + SAMRAI_F77_FUNC(cartwgtavgcellcplx2d, CARTWGTAVGCELLCPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -148,9 +155,8 @@ CartesianCellComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(d), cdata->getPointer(d)); - } - if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgcellcplx3d, CARTWGTAVGCELLCPLX3D) (ifirstc(0), + } else if ((dim == tbox::Dimension(3))) { + SAMRAI_F77_FUNC(cartwgtavgcellcplx3d, CARTWGTAVGCELLCPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -162,13 +168,25 @@ CartesianCellComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(d), cdata->getPointer(d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgcellcplx4d, CARTWGTAVGCELLCPLX4D) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(d), + cdata->getPointer(d)); } else { - TBOX_ERROR("CartesianEdgeComplexWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + TBOX_ERROR("CartesianCellComplexWeightedAverage error...\n" + << "dim > 4 not supported." << std::endl); } } } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.h index 8c473945..646b519d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellComplexWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellComplexWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianCellComplexWeightedAverage( - const tbox::Dimension& dim); + CartesianCellComplexWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellComplexWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianCellComplexWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.C index 633a6c51..41f9813b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered * double data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellDoubleConservativeLinearRefine_C -#define included_geom_CartesianCellDoubleConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.h" #include #include @@ -19,7 +15,6 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -37,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +41,7 @@ void F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (const int&, const double *, double *, double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +50,7 @@ void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (const int&, const double *, double *, double *, double *, double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -84,9 +79,8 @@ namespace geom { // using namespace std; CartesianCellDoubleConservativeLinearRefine:: -CartesianCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianCellDoubleConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -102,9 +96,9 @@ CartesianCellDoubleConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellDoubleConservativeLinearRefine::getStencilWidth() const +CartesianCellDoubleConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -117,12 +111,13 @@ CartesianCellDoubleConservativeLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -141,46 +136,49 @@ CartesianCellDoubleConservativeLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 1); + std::vector diff0(cgbox.numberCells(0) + 1); pdat::CellData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -190,13 +188,13 @@ CartesianCellDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer()); + &diff0[0], slope0.getPointer()); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -206,17 +204,17 @@ CartesianCellDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer()); } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 1); + std::vector diff2(cgbox.numberCells(2) + 1); pdat::CellData slope2(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,9 +228,9 @@ CartesianCellDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer(), - diff2.getPointer(), slope2.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer(), + &diff2[0], slope2.getPointer()); } else { TBOX_ERROR("CartesianCellDoubleConservativeLinearRefine error...\n" << "dim > 3 not supported." << std::endl); @@ -251,5 +249,3 @@ CartesianCellDoubleConservativeLinearRefine::refine( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.h index 3f778fa8..6feebef9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered * double data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianCellDoubleConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianCellDoubleConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianCellDoubleConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,8 @@ class CartesianCellDoubleConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -89,6 +91,15 @@ class CartesianCellDoubleConservativeLinearRefine: * that the coarse patch contains sufficient data for the stencil width of * the refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.C index 99efbeb8..f9207296 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellDoubleLinearRefine_C -#define included_geom_CartesianCellDoubleLinearRefine_C - #include "SAMRAI/geom/CartesianCellDoubleLinearRefine.h" #include @@ -36,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefcelldoub1d, CARTLINREFCELLDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcelldoub1d, CARTLINREFCELLDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -44,7 +40,7 @@ void F77_FUNC(cartlinrefcelldoub1d, CARTLINREFCELLDOUB1D) (const int&, const int *, const double *, const double *, const double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefcelldoub2d, CARTLINREFCELLDOUB2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcelldoub2d, CARTLINREFCELLDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(cartlinrefcelldoub2d, CARTLINREFCELLDOUB2D) (const int&, const int *, const double *, const double *, const double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefcelldoub3d, CARTLINREFCELLDOUB3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcelldoub3d, CARTLINREFCELLDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,9 +66,8 @@ namespace geom { // using namespace std; -CartesianCellDoubleLinearRefine::CartesianCellDoubleLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianCellDoubleLinearRefine::CartesianCellDoubleLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -87,9 +82,9 @@ CartesianCellDoubleLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellDoubleLinearRefine::getStencilWidth() const +CartesianCellDoubleLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -102,12 +97,13 @@ CartesianCellDoubleLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -126,42 +122,45 @@ CartesianCellDoubleLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefcelldoub1d, CARTLINREFCELLDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcelldoub1d, CARTLINREFCELLDOUB1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -172,7 +171,7 @@ CartesianCellDoubleLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefcelldoub2d, CARTLINREFCELLDOUB2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcelldoub2d, CARTLINREFCELLDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,7 +182,7 @@ CartesianCellDoubleLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefcelldoub3d, CARTLINREFCELLDOUB3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcelldoub3d, CARTLINREFCELLDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -207,4 +206,3 @@ CartesianCellDoubleLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.h index 6ef5b39c..3b091134 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellDoubleLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellDoubleLinearRefine( - const tbox::Dimension& dim); + CartesianCellDoubleLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellDoubleLinearRefine: * of ones. That is, its stencil extends one cell outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianCellDoubleLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -88,6 +90,15 @@ class CartesianCellDoubleLinearRefine: * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.C index 0b7cf65d..06fcb809 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellDoubleWeightedAverage_C -#define included_geom_CartesianCellDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianCellDoubleWeightedAverage.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" @@ -36,21 +32,21 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -59,14 +55,23 @@ void F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgcelldoub4d, CARTWGTAVGCELLDOUB4D) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); } namespace SAMRAI { namespace geom { -CartesianCellDoubleWeightedAverage::CartesianCellDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianCellDoubleWeightedAverage::CartesianCellDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -81,9 +86,9 @@ CartesianCellDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianCellDoubleWeightedAverage::getStencilWidth() const +CartesianCellDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -95,38 +100,41 @@ CartesianCellDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -136,7 +144,7 @@ CartesianCellDoubleWeightedAverage::coarsen( fdata->getPointer(d), cdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -146,7 +154,7 @@ CartesianCellDoubleWeightedAverage::coarsen( fdata->getPointer(d), cdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -158,9 +166,22 @@ CartesianCellDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(d), cdata->getPointer(d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgcelldoub4d, CARTWGTAVGCELLDOUB4D) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(d), + cdata->getPointer(d)); } else { TBOX_ERROR("CartesianCellDoubleWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + << "dim > 4 not supported." << std::endl); } } @@ -168,4 +189,3 @@ CartesianCellDoubleWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.h index 6a338e65..817c0576 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianCellDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianCellDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianCellDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.C index 551db76d..dc41a1f8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered float * data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellFloatConservativeLinearRefine_C -#define included_geom_CartesianCellFloatConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.h" #include #include @@ -19,7 +15,6 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -37,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefcellflot1d, CARTCLINREFCELLFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellflot1d, CARTCLINREFCELLFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +41,7 @@ void F77_FUNC(cartclinrefcellflot1d, CARTCLINREFCELLFLOT1D) (const int&, const float *, float *, float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefcellflot2d, CARTCLINREFCELLFLOT2D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellflot2d, CARTCLINREFCELLFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +50,7 @@ void F77_FUNC(cartclinrefcellflot2d, CARTCLINREFCELLFLOT2D) (const int&, const float *, float *, float *, float *, float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefcellflot3d, CARTCLINREFCELLFLOT3D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefcellflot3d, CARTCLINREFCELLFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,9 +71,8 @@ namespace geom { // using namespace std; CartesianCellFloatConservativeLinearRefine:: -CartesianCellFloatConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianCellFloatConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -94,9 +88,9 @@ CartesianCellFloatConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellFloatConservativeLinearRefine::getStencilWidth() const +CartesianCellFloatConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -109,12 +103,13 @@ CartesianCellFloatConservativeLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -133,15 +128,15 @@ CartesianCellFloatConservativeLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -149,31 +144,34 @@ CartesianCellFloatConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 1); + std::vector diff0(cgbox.numberCells(0) + 1); pdat::CellData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinrefcellflot1d, CARTCLINREFCELLFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellflot1d, CARTCLINREFCELLFLOT1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -183,12 +181,12 @@ CartesianCellFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer()); + &diff0[0], slope0.getPointer()); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcellflot2d, CARTCLINREFCELLFLOT2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellflot2d, CARTCLINREFCELLFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -198,16 +196,16 @@ CartesianCellFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer()); } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 1); + std::vector diff1(cgbox.numberCells(1) + 1); pdat::CellData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 1); + std::vector diff2(cgbox.numberCells(2) + 1); pdat::CellData slope2(cgbox, 1, tmp_ghosts); - F77_FUNC(cartclinrefcellflot3d, CARTCLINREFCELLFLOT3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartclinrefcellflot3d, CARTCLINREFCELLFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -221,9 +219,9 @@ CartesianCellFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(d), fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer(), - diff2.getPointer(), slope2.getPointer()); + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer(), + &diff2[0], slope2.getPointer()); } else { TBOX_ERROR("CartesianFloatConservativeLinearRefine error...\n" << "dim > 3 not supported." << std::endl); @@ -234,4 +232,3 @@ CartesianCellFloatConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.h index fa66e66c..69aa3721 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for cell-centered * float data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianCellFloatConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellFloatConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianCellFloatConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianCellFloatConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,8 @@ class CartesianCellFloatConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -89,6 +91,15 @@ class CartesianCellFloatConservativeLinearRefine: * that the coarse patch contains sufficient data for the stencil width of * the refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.C index 8214dfa3..8c24bce0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellFloatLinearRefine_C -#define included_geom_CartesianCellFloatLinearRefine_C - #include "SAMRAI/geom/CartesianCellFloatLinearRefine.h" #include @@ -36,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefcellflot1d, CARTLINREFCELLFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellflot1d, CARTLINREFCELLFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -44,7 +40,7 @@ void F77_FUNC(cartlinrefcellflot1d, CARTLINREFCELLFLOT1D) (const int&, const int *, const double *, const double *, const float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefcellflot2d, CARTLINREFCELLFLOT2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellflot2d, CARTLINREFCELLFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(cartlinrefcellflot2d, CARTLINREFCELLFLOT2D) (const int&, const int *, const double *, const double *, const float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefcellflot3d, CARTLINREFCELLFLOT3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefcellflot3d, CARTLINREFCELLFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,9 +66,8 @@ namespace geom { // using namespace std; -CartesianCellFloatLinearRefine::CartesianCellFloatLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianCellFloatLinearRefine::CartesianCellFloatLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -87,9 +82,9 @@ CartesianCellFloatLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianCellFloatLinearRefine::getStencilWidth() const +CartesianCellFloatLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -102,12 +97,13 @@ CartesianCellFloatLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -126,15 +122,15 @@ CartesianCellFloatLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -142,27 +138,30 @@ CartesianCellFloatLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefcellflot1d, CARTLINREFCELLFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellflot1d, CARTLINREFCELLFLOT1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -173,7 +172,7 @@ CartesianCellFloatLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefcellflot2d, CARTLINREFCELLFLOT2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellflot2d, CARTLINREFCELLFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -184,7 +183,7 @@ CartesianCellFloatLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefcellflot3d, CARTLINREFCELLFLOT3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefcellflot3d, CARTLINREFCELLFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -208,4 +207,3 @@ CartesianCellFloatLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.h index 57e4fbbd..529c95c0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for cell-centered float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellFloatLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianCellFloatLinearRefine( - const tbox::Dimension& dim); + CartesianCellFloatLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellFloatLinearRefine: * of ones. That is, its stencil extends one cell outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianCellFloatLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -87,7 +89,15 @@ class CartesianCellFloatLinearRefine: * of the destination patch and the fine box. It is assumed that the * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method - * only in that it operates on a single fine box instead of a BoxOverlap. + * only in that it operates on a single fine box instead of a BoxOverlap. * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.C index 9a21c8ef..fea6add2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianCellFloatWeightedAverage_C -#define included_geom_CartesianCellFloatWeightedAverage_C - #include "SAMRAI/geom/CartesianCellFloatWeightedAverage.h" #include @@ -36,21 +32,21 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgcellflot1d, CARTWGTAVGCELLFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellflot1d, CARTWGTAVGCELLFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgcellflot2d, CARTWGTAVGCELLFLOT2D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellflot2d, CARTWGTAVGCELLFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgcellflot3d, CARTWGTAVGCELLFLOT3D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgcellflot3d, CARTWGTAVGCELLFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -59,6 +55,16 @@ void F77_FUNC(cartwgtavgcellflot3d, CARTWGTAVGCELLFLOT3D) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgcellflot4d, CARTWGTAVGCELLFLOT4D) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const float *, float *); } namespace SAMRAI { @@ -66,9 +72,8 @@ namespace geom { // using namespace std; -CartesianCellFloatWeightedAverage::CartesianCellFloatWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianCellFloatWeightedAverage::CartesianCellFloatWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -83,9 +88,9 @@ CartesianCellFloatWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianCellFloatWeightedAverage::getStencilWidth() const +CartesianCellFloatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -97,38 +102,41 @@ CartesianCellFloatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); + + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgcellflot1d, CARTWGTAVGCELLFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcellflot1d, CARTWGTAVGCELLFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -138,7 +146,7 @@ CartesianCellFloatWeightedAverage::coarsen( fdata->getPointer(d), cdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgcellflot2d, CARTWGTAVGCELLFLOT2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcellflot2d, CARTWGTAVGCELLFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -148,7 +156,7 @@ CartesianCellFloatWeightedAverage::coarsen( fdata->getPointer(d), cdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgcellflot3d, CARTWGTAVGCELLFLOT3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgcellflot3d, CARTWGTAVGCELLFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -160,9 +168,22 @@ CartesianCellFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(d), cdata->getPointer(d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgcellflot4d, CARTWGTAVGCELLFLOT4D) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(d), + cdata->getPointer(d)); } else { TBOX_ERROR("CartesianCellFloatWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + << "dim > 4 not supported." << std::endl); } } @@ -170,4 +191,3 @@ CartesianCellFloatWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.h index e9988a4e..db84d432 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianCellFloatWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for cell-centered float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianCellFloatWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianCellFloatWeightedAverage( - const tbox::Dimension& dim); + CartesianCellFloatWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianCellFloatWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianCellFloatWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.C index d121f50b..d4b9451b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianEdgeComplexWeightedAverage_C -#define included_geom_CartesianEdgeComplexWeightedAverage_C - #include #include @@ -37,28 +33,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgedgecplx1d, CARTWGTAVGEDGECPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx1d, CARTWGTAVGEDGECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgedgecplx2d0, CARTWGTAVGEDGECPLX2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx2d0, CARTWGTAVGEDGECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgedgecplx2d1, CARTWGTAVGEDGECPLX2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx2d1, CARTWGTAVGEDGECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgedgecplx3d0, CARTWGTAVGEDGECPLX3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx3d0, CARTWGTAVGEDGECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -67,7 +63,7 @@ void F77_FUNC(cartwgtavgedgecplx3d0, CARTWGTAVGEDGECPLX3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgedgecplx3d1, CARTWGTAVGEDGECPLX3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx3d1, CARTWGTAVGEDGECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +72,7 @@ void F77_FUNC(cartwgtavgedgecplx3d1, CARTWGTAVGEDGECPLX3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgedgecplx3d2, CARTWGTAVGEDGECPLX3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgecplx3d2, CARTWGTAVGEDGECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -92,9 +88,8 @@ namespace geom { // using namespace std; -CartesianEdgeComplexWeightedAverage::CartesianEdgeComplexWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianEdgeComplexWeightedAverage::CartesianEdgeComplexWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -109,9 +104,9 @@ CartesianEdgeComplexWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianEdgeComplexWeightedAverage::getStencilWidth() const +CartesianEdgeComplexWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -123,38 +118,41 @@ CartesianEdgeComplexWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgedgecplx1d, CARTWGTAVGEDGECPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx1d, CARTWGTAVGEDGECPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -164,7 +162,7 @@ CartesianEdgeComplexWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgedgecplx2d0, CARTWGTAVGEDGECPLX2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx2d0, CARTWGTAVGEDGECPLX2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -173,7 +171,7 @@ CartesianEdgeComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgecplx2d1, CARTWGTAVGEDGECPLX2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx2d1, CARTWGTAVGEDGECPLX2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,7 +181,7 @@ CartesianEdgeComplexWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgedgecplx3d0, CARTWGTAVGEDGECPLX3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx3d0, CARTWGTAVGEDGECPLX3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -195,7 +193,7 @@ CartesianEdgeComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgecplx3d1, CARTWGTAVGEDGECPLX3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx3d1, CARTWGTAVGEDGECPLX3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -207,7 +205,7 @@ CartesianEdgeComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgedgecplx3d2, CARTWGTAVGEDGECPLX3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgecplx3d2, CARTWGTAVGEDGECPLX3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -229,4 +227,3 @@ CartesianEdgeComplexWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.h index d6e4f1a6..6bfddc33 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeComplexWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianEdgeComplexWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianEdgeComplexWeightedAverage( - const tbox::Dimension& dim); + CartesianEdgeComplexWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianEdgeComplexWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianEdgeComplexWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.C index caa81ac9..fffa24ef 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for edge-centered * double data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianEdgeDoubleConservativeLinearRefine_C -#define included_geom_CartesianEdgeDoubleConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.h" #include #include @@ -19,7 +15,6 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/EdgeData.h" #include "SAMRAI/pdat/EdgeVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -37,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefedgedoub1d, CARTCLINREFEDGEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub1d, CARTCLINREFEDGEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +41,7 @@ void F77_FUNC(cartclinrefedgedoub1d, CARTCLINREFEDGEDOUB1D) (const int&, const double *, double *, double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefedgedoub2d0, CARTCLINREFEDGEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub2d0, CARTCLINREFEDGEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -54,7 +49,7 @@ void F77_FUNC(cartclinrefedgedoub2d0, CARTCLINREFEDGEDOUB2D0) (const int&, const int *, const double *, const double *, const double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefedgedoub2d1, CARTCLINREFEDGEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub2d1, CARTCLINREFEDGEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +58,7 @@ void F77_FUNC(cartclinrefedgedoub2d1, CARTCLINREFEDGEDOUB2D1) (const int&, const double *, double *, double *, double *, double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefedgedoub3d0, CARTCLINREFEDGEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub3d0, CARTCLINREFEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +71,7 @@ void F77_FUNC(cartclinrefedgedoub3d0, CARTCLINREFEDGEDOUB3D0) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefedgedoub3d1, CARTCLINREFEDGEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub3d1, CARTCLINREFEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -89,7 +84,7 @@ void F77_FUNC(cartclinrefedgedoub3d1, CARTCLINREFEDGEDOUB3D1) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefedgedoub3d2, CARTCLINREFEDGEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgedoub3d2, CARTCLINREFEDGEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -110,9 +105,8 @@ namespace geom { // using namespace std; CartesianEdgeDoubleConservativeLinearRefine:: -CartesianEdgeDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianEdgeDoubleConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -128,9 +122,9 @@ CartesianEdgeDoubleConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianEdgeDoubleConservativeLinearRefine::getStencilWidth() const +CartesianEdgeDoubleConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -142,20 +136,20 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -163,46 +157,49 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); + + for (int axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::EdgeData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinrefedgedoub1d, CARTCLINREFEDGEDOUB1D) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub1d, CARTCLINREFEDGEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -212,13 +209,13 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::EdgeData slope1(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinrefedgedoub2d0, CARTCLINREFEDGEDOUB2D0) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub2d0, CARTCLINREFEDGEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -228,10 +225,10 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinrefedgedoub2d1, CARTCLINREFEDGEDOUB2D1) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub2d1, CARTCLINREFEDGEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -241,18 +238,18 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::EdgeData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::EdgeData slope2(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinrefedgedoub3d0, CARTCLINREFEDGEDOUB3D0) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub3d0, CARTCLINREFEDGEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -266,11 +263,11 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinrefedgedoub3d1, CARTCLINREFEDGEDOUB3D1) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub3d1, CARTCLINREFEDGEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -284,11 +281,11 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } else if (axis == 2) { - F77_FUNC(cartclinrefedgedoub3d2, CARTCLINREFEDGEDOUB3D2) ( + SAMRAI_F77_FUNC(cartclinrefedgedoub3d2, CARTCLINREFEDGEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -302,9 +299,9 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -318,4 +315,3 @@ CartesianEdgeDoubleConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.h index 379d3b6e..6a00d387 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for edge-centered * double data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianEdgeDoubleConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianEdgeDoubleConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianEdgeDoubleConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianEdgeDoubleConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianEdgeDoubleConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.C index 4ec6d2f6..86543bcc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianEdgeDoubleWeightedAverage_C -#define included_geom_CartesianEdgeDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgedgedoub1d, CARTWGTAVGEDGEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub1d, CARTWGTAVGEDGEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgedgedoub2d0, CARTWGTAVGEDGEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub2d0, CARTWGTAVGEDGEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgedgedoub2d1, CARTWGTAVGEDGEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub2d1, CARTWGTAVGEDGEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgedgedoub3d0, CARTWGTAVGEDGEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub3d0, CARTWGTAVGEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgedgedoub3d0, CARTWGTAVGEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgedgedoub3d1, CARTWGTAVGEDGEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub3d1, CARTWGTAVGEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgedgedoub3d1, CARTWGTAVGEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgedgedoub3d2, CARTWGTAVGEDGEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgedoub3d2, CARTWGTAVGEDGEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -91,9 +87,8 @@ namespace geom { // using namespace std; -CartesianEdgeDoubleWeightedAverage::CartesianEdgeDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianEdgeDoubleWeightedAverage::CartesianEdgeDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +103,9 @@ CartesianEdgeDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianEdgeDoubleWeightedAverage::getStencilWidth() const +CartesianEdgeDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,38 +117,41 @@ CartesianEdgeDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgedgedoub1d, CARTWGTAVGEDGEDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub1d, CARTWGTAVGEDGEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -163,7 +161,7 @@ CartesianEdgeDoubleWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgedgedoub2d0, CARTWGTAVGEDGEDOUB2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub2d0, CARTWGTAVGEDGEDOUB2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -172,7 +170,7 @@ CartesianEdgeDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgedoub2d1, CARTWGTAVGEDGEDOUB2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub2d1, CARTWGTAVGEDGEDOUB2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -182,7 +180,7 @@ CartesianEdgeDoubleWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgedgedoub3d0, CARTWGTAVGEDGEDOUB3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub3d0, CARTWGTAVGEDGEDOUB3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -194,7 +192,7 @@ CartesianEdgeDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgedoub3d1, CARTWGTAVGEDGEDOUB3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub3d1, CARTWGTAVGEDGEDOUB3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +204,7 @@ CartesianEdgeDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgedgedoub3d2, CARTWGTAVGEDGEDOUB3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgedoub3d2, CARTWGTAVGEDGEDOUB3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -228,4 +226,3 @@ CartesianEdgeDoubleWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.h index f36a857f..7a1f4ab9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianEdgeDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianEdgeDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianEdgeDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianEdgeDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianEdgeDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.C index f48556e1..66833759 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.C @@ -3,22 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for edge-centered * float data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianEdgeFloatConservativeLinearRefine_C -#define included_geom_CartesianEdgeFloatConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/EdgeData.h" #include "SAMRAI/pdat/EdgeVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -36,7 +31,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefedgeflot1d, CARTCLINREFEDGEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot1d, CARTCLINREFEDGEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +40,7 @@ void F77_FUNC(cartclinrefedgeflot1d, CARTCLINREFEDGEFLOT1D) (const int&, const float *, float *, float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefedgeflot2d0, CARTCLINREFEDGEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot2d0, CARTCLINREFEDGEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +48,7 @@ void F77_FUNC(cartclinrefedgeflot2d0, CARTCLINREFEDGEFLOT2D0) (const int&, const int *, const double *, const double *, const float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefedgeflot2d1, CARTCLINREFEDGEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot2d1, CARTCLINREFEDGEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -62,7 +57,7 @@ void F77_FUNC(cartclinrefedgeflot2d1, CARTCLINREFEDGEFLOT2D1) (const int&, const float *, float *, float *, float *, float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefedgeflot3d0, CARTCLINREFEDGEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot3d0, CARTCLINREFEDGEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +70,7 @@ void F77_FUNC(cartclinrefedgeflot3d0, CARTCLINREFEDGEFLOT3D0) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefedgeflot3d1, CARTCLINREFEDGEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot3d1, CARTCLINREFEDGEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -88,7 +83,7 @@ void F77_FUNC(cartclinrefedgeflot3d1, CARTCLINREFEDGEFLOT3D1) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefedgeflot3d2, CARTCLINREFEDGEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinrefedgeflot3d2, CARTCLINREFEDGEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -109,9 +104,8 @@ namespace geom { // using namespace std; CartesianEdgeFloatConservativeLinearRefine:: -CartesianEdgeFloatConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianEdgeFloatConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -127,9 +121,9 @@ CartesianEdgeFloatConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianEdgeFloatConservativeLinearRefine::getStencilWidth() const +CartesianEdgeFloatConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -141,20 +135,20 @@ CartesianEdgeFloatConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -162,46 +156,49 @@ CartesianEdgeFloatConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); + + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::EdgeData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinrefedgeflot1d, CARTCLINREFEDGEFLOT1D) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot1d, CARTCLINREFEDGEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -211,13 +208,13 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::EdgeData slope1(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinrefedgeflot2d0, CARTCLINREFEDGEFLOT2D0) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot2d0, CARTCLINREFEDGEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -227,10 +224,10 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinrefedgeflot2d1, CARTCLINREFEDGEFLOT2D1) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot2d1, CARTCLINREFEDGEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -240,18 +237,18 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::EdgeData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::EdgeData slope2(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinrefedgeflot3d0, CARTCLINREFEDGEFLOT3D0) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot3d0, CARTCLINREFEDGEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -265,11 +262,11 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinrefedgeflot3d1, CARTCLINREFEDGEFLOT3D1) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot3d1, CARTCLINREFEDGEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -283,11 +280,11 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } else if (axis == 2) { - F77_FUNC(cartclinrefedgeflot3d2, CARTCLINREFEDGEFLOT3D2) ( + SAMRAI_F77_FUNC(cartclinrefedgeflot3d2, CARTCLINREFEDGEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -301,9 +298,9 @@ CartesianEdgeFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -317,4 +314,3 @@ CartesianEdgeFloatConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.h index 834ac745..2b5527bb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for edge-centered * float data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianEdgeFloatConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianEdgeFloatConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianEdgeFloatConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianEdgeFloatConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianEdgeFloatConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.C index d4aa7cfa..18c61692 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianEdgeFloatWeightedAverage_C -#define included_geom_CartesianEdgeFloatWeightedAverage_C - #include "SAMRAI/geom/CartesianEdgeFloatWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgedgeflot1d, CARTWGTAVGEDGEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot1d, CARTWGTAVGEDGEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgedgeflot2d0, CARTWGTAVGEDGEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot2d0, CARTWGTAVGEDGEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgedgeflot2d1, CARTWGTAVGEDGEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot2d1, CARTWGTAVGEDGEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgedgeflot3d0, CARTWGTAVGEDGEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot3d0, CARTWGTAVGEDGEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgedgeflot3d0, CARTWGTAVGEDGEFLOT3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgedgeflot3d1, CARTWGTAVGEDGEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot3d1, CARTWGTAVGEDGEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgedgeflot3d1, CARTWGTAVGEDGEFLOT3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgedgeflot3d2, CARTWGTAVGEDGEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgedgeflot3d2, CARTWGTAVGEDGEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -91,9 +87,8 @@ namespace geom { // using namespace std; -CartesianEdgeFloatWeightedAverage::CartesianEdgeFloatWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianEdgeFloatWeightedAverage::CartesianEdgeFloatWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +103,9 @@ CartesianEdgeFloatWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianEdgeFloatWeightedAverage::getStencilWidth() const +CartesianEdgeFloatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,38 +117,41 @@ CartesianEdgeFloatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgedgeflot1d, CARTWGTAVGEDGEFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot1d, CARTWGTAVGEDGEFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -163,7 +161,7 @@ CartesianEdgeFloatWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgedgeflot2d0, CARTWGTAVGEDGEFLOT2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot2d0, CARTWGTAVGEDGEFLOT2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -172,7 +170,7 @@ CartesianEdgeFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgeflot2d1, CARTWGTAVGEDGEFLOT2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot2d1, CARTWGTAVGEDGEFLOT2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -182,7 +180,7 @@ CartesianEdgeFloatWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgedgeflot3d0, CARTWGTAVGEDGEFLOT3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot3d0, CARTWGTAVGEDGEFLOT3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -194,7 +192,7 @@ CartesianEdgeFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgedgeflot3d1, CARTWGTAVGEDGEFLOT3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot3d1, CARTWGTAVGEDGEFLOT3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +204,7 @@ CartesianEdgeFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgedgeflot3d2, CARTWGTAVGEDGEFLOT3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgedgeflot3d2, CARTWGTAVGEDGEFLOT3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -227,4 +225,3 @@ CartesianEdgeFloatWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.h index 6cb3f49a..5d33d602 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianEdgeFloatWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for edge-centered float data on * a Cartesian mesh. * @@ -22,7 +22,7 @@ #endif #include "SAMRAI/hier/CoarsenOperator.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace geom { @@ -43,8 +43,7 @@ class CartesianEdgeFloatWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianEdgeFloatWeightedAverage( - const tbox::Dimension& dim); + CartesianEdgeFloatWeightedAverage(); /** * Uninteresting virtual destructor. @@ -63,7 +62,8 @@ class CartesianEdgeFloatWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -72,6 +72,15 @@ class CartesianEdgeFloatWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.C index 9dd2965a..4a9a8ac1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianFaceComplexWeightedAverage_C -#define included_geom_CartesianFaceComplexWeightedAverage_C - #include "SAMRAI/geom/CartesianFaceComplexWeightedAverage.h" #include "SAMRAI/tbox/Complex.h" @@ -37,28 +33,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgfacecplx1d, CARTWGTAVGFACECPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx1d, CARTWGTAVGFACECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgfacecplx2d0, CARTWGTAVGFACECPLX2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx2d0, CARTWGTAVGFACECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgfacecplx2d1, CARTWGTAVGFACECPLX2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx2d1, CARTWGTAVGFACECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgfacecplx3d0, CARTWGTAVGFACECPLX3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx3d0, CARTWGTAVGFACECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -67,7 +63,7 @@ void F77_FUNC(cartwgtavgfacecplx3d0, CARTWGTAVGFACECPLX3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgfacecplx3d1, CARTWGTAVGFACECPLX3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx3d1, CARTWGTAVGFACECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +72,7 @@ void F77_FUNC(cartwgtavgfacecplx3d1, CARTWGTAVGFACECPLX3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgfacecplx3d2, CARTWGTAVGFACECPLX3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacecplx3d2, CARTWGTAVGFACECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -85,6 +81,43 @@ void F77_FUNC(cartwgtavgfacecplx3d2, CARTWGTAVGFACECPLX3D2) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgfacecplx4d0, CARTWGTAVGFACECPLX4D0) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const dcomplex *, dcomplex *); +void SAMRAI_F77_FUNC(cartwgtavgfacecplx4d1, CARTWGTAVGFACECPLX4D1) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const dcomplex *, dcomplex *); +void SAMRAI_F77_FUNC(cartwgtavgfacecplx4d2, CARTWGTAVGFACECPLX4D2) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const dcomplex *, dcomplex *); +void SAMRAI_F77_FUNC(cartwgtavgfacecplx4d3, CARTWGTAVGFACECPLX4D3) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const dcomplex *, dcomplex *); } namespace SAMRAI { @@ -92,9 +125,8 @@ namespace geom { // using namespace std; -CartesianFaceComplexWeightedAverage::CartesianFaceComplexWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianFaceComplexWeightedAverage::CartesianFaceComplexWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -109,9 +141,9 @@ CartesianFaceComplexWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianFaceComplexWeightedAverage::getStencilWidth() const +CartesianFaceComplexWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -123,38 +155,41 @@ CartesianFaceComplexWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgfacecplx1d, CARTWGTAVGFACECPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx1d, CARTWGTAVGFACECPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -164,7 +199,7 @@ CartesianFaceComplexWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgfacecplx2d0, CARTWGTAVGFACECPLX2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx2d0, CARTWGTAVGFACECPLX2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -173,7 +208,7 @@ CartesianFaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfacecplx2d1, CARTWGTAVGFACECPLX2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx2d1, CARTWGTAVGFACECPLX2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,7 +218,7 @@ CartesianFaceComplexWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgfacecplx3d0, CARTWGTAVGFACECPLX3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx3d0, CARTWGTAVGFACECPLX3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -195,7 +230,7 @@ CartesianFaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfacecplx3d1, CARTWGTAVGFACECPLX3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx3d1, CARTWGTAVGFACECPLX3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -207,7 +242,7 @@ CartesianFaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgfacecplx3d2, CARTWGTAVGFACECPLX3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacecplx3d2, CARTWGTAVGFACECPLX3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -219,9 +254,58 @@ CartesianFaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(2, d), cdata->getPointer(2, d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgfacecplx4d0, CARTWGTAVGFACECPLX4D0) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(0, d), + cdata->getPointer(0, d)); + SAMRAI_F77_FUNC(cartwgtavgfacecplx4d1, CARTWGTAVGFACECPLX4D1) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(1, d), + cdata->getPointer(1, d)); + SAMRAI_F77_FUNC(cartwgtavgfacecplx4d2, CARTWGTAVGFACECPLX4D2) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(2, d), + cdata->getPointer(2, d)); + SAMRAI_F77_FUNC(cartwgtavgfacecplx4d3, CARTWGTAVGFACECPLX4D3) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(3, d), + cdata->getPointer(3, d)); } else { TBOX_ERROR("CartesianFaceComplexWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + << "dim > 4 not supported." << std::endl); } } @@ -229,4 +313,3 @@ CartesianFaceComplexWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.h index ed69d96b..1312f857 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceComplexWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered complex data on * a Cartesian mesh. * @@ -41,8 +41,7 @@ class CartesianFaceComplexWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianFaceComplexWeightedAverage( - const tbox::Dimension& dim); + CartesianFaceComplexWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianFaceComplexWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianFaceComplexWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.C index 59aec5f9..6ebb4b9d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for face-centered * double data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianFaceDoubleConservativeLinearRefine_C -#define included_geom_CartesianFaceDoubleConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.h" #include #include @@ -19,7 +15,6 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/FaceData.h" #include "SAMRAI/pdat/FaceVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -37,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinreffacedoub1d, CARTCLINREFFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub1d, CARTCLINREFFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +41,7 @@ void F77_FUNC(cartclinreffacedoub1d, CARTCLINREFFACEDOUB1D) (const int&, const double *, double *, double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartclinreffacedoub2d0, CARTCLINREFFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub2d0, CARTCLINREFFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -54,7 +49,7 @@ void F77_FUNC(cartclinreffacedoub2d0, CARTCLINREFFACEDOUB2D0) (const int&, const int *, const double *, const double *, const double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinreffacedoub2d1, CARTCLINREFFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub2d1, CARTCLINREFFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +58,7 @@ void F77_FUNC(cartclinreffacedoub2d1, CARTCLINREFFACEDOUB2D1) (const int&, const double *, double *, double *, double *, double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartclinreffacedoub3d0, CARTCLINREFFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub3d0, CARTCLINREFFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +71,7 @@ void F77_FUNC(cartclinreffacedoub3d0, CARTCLINREFFACEDOUB3D0) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinreffacedoub3d1, CARTCLINREFFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub3d1, CARTCLINREFFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -89,7 +84,7 @@ void F77_FUNC(cartclinreffacedoub3d1, CARTCLINREFFACEDOUB3D1) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinreffacedoub3d2, CARTCLINREFFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinreffacedoub3d2, CARTCLINREFFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -110,9 +105,8 @@ namespace geom { // using namespace std; CartesianFaceDoubleConservativeLinearRefine:: -CartesianFaceDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianFaceDoubleConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -128,9 +122,9 @@ CartesianFaceDoubleConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianFaceDoubleConservativeLinearRefine::getStencilWidth() const +CartesianFaceDoubleConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -142,20 +136,20 @@ CartesianFaceDoubleConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -163,48 +157,50 @@ CartesianFaceDoubleConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::FaceData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinreffacedoub1d, CARTCLINREFFACEDOUB1D) ( + SAMRAI_F77_FUNC(cartclinreffacedoub1d, CARTCLINREFFACEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -214,13 +210,13 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::FaceData slope1(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinreffacedoub2d0, CARTCLINREFFACEDOUB2D0) ( + SAMRAI_F77_FUNC(cartclinreffacedoub2d0, CARTCLINREFFACEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -230,10 +226,10 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinreffacedoub2d1, CARTCLINREFFACEDOUB2D1) ( + SAMRAI_F77_FUNC(cartclinreffacedoub2d1, CARTCLINREFFACEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -243,18 +239,18 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::FaceData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::FaceData slope2(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinreffacedoub3d0, CARTCLINREFFACEDOUB3D0) ( + SAMRAI_F77_FUNC(cartclinreffacedoub3d0, CARTCLINREFFACEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -268,11 +264,11 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinreffacedoub3d1, CARTCLINREFFACEDOUB3D1) ( + SAMRAI_F77_FUNC(cartclinreffacedoub3d1, CARTCLINREFFACEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -286,11 +282,11 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } else if (axis == 2) { - F77_FUNC(cartclinreffacedoub3d2, CARTCLINREFFACEDOUB3D2) ( + SAMRAI_F77_FUNC(cartclinreffacedoub3d2, CARTCLINREFFACEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -304,9 +300,9 @@ CartesianFaceDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -320,4 +316,3 @@ CartesianFaceDoubleConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.h index c9733d17..f0dcfc77 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for face-centered * double data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianFaceDoubleConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianFaceDoubleConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianFaceDoubleConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianFaceDoubleConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianFaceDoubleConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.C index b1e05fa5..7c3462c9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianFaceDoubleWeightedAverage_C -#define included_geom_CartesianFaceDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianFaceDoubleWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgfacedoub1d, CARTWGTAVGFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub1d, CARTWGTAVGFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgfacedoub2d0, CARTWGTAVGFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub2d0, CARTWGTAVGFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgfacedoub2d1, CARTWGTAVGFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub2d1, CARTWGTAVGFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -84,6 +80,43 @@ void F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgfacedoub4d0, CARTWGTAVGFACEDOUB4D0) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +void SAMRAI_F77_FUNC(cartwgtavgfacedoub4d1, CARTWGTAVGFACEDOUB4D1) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +void SAMRAI_F77_FUNC(cartwgtavgfacedoub4d2, CARTWGTAVGFACEDOUB4D2) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +void SAMRAI_F77_FUNC(cartwgtavgfacedoub4d3, CARTWGTAVGFACEDOUB4D3) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); } namespace SAMRAI { @@ -91,9 +124,8 @@ namespace geom { // using namespace std; -CartesianFaceDoubleWeightedAverage::CartesianFaceDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianFaceDoubleWeightedAverage::CartesianFaceDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +140,9 @@ CartesianFaceDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianFaceDoubleWeightedAverage::getStencilWidth() const +CartesianFaceDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,38 +154,41 @@ CartesianFaceDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgfacedoub1d, CARTWGTAVGFACEDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub1d, CARTWGTAVGFACEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -163,7 +198,7 @@ CartesianFaceDoubleWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgfacedoub2d0, CARTWGTAVGFACEDOUB2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub2d0, CARTWGTAVGFACEDOUB2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -172,7 +207,7 @@ CartesianFaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfacedoub2d1, CARTWGTAVGFACEDOUB2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub2d1, CARTWGTAVGFACEDOUB2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -182,7 +217,7 @@ CartesianFaceDoubleWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub3d0, CARTWGTAVGFACEDOUB3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -194,7 +229,7 @@ CartesianFaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub3d1, CARTWGTAVGFACEDOUB3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +241,7 @@ CartesianFaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfacedoub3d2, CARTWGTAVGFACEDOUB3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -218,13 +253,61 @@ CartesianFaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(2, d), cdata->getPointer(2, d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgfacedoub4d0, CARTWGTAVGFACEDOUB4D0) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(0, d), + cdata->getPointer(0, d)); + SAMRAI_F77_FUNC(cartwgtavgfacedoub4d1, CARTWGTAVGFACEDOUB4D1) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(1, d), + cdata->getPointer(1, d)); + SAMRAI_F77_FUNC(cartwgtavgfacedoub4d2, CARTWGTAVGFACEDOUB4D2) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(2, d), + cdata->getPointer(2, d)); + SAMRAI_F77_FUNC(cartwgtavgfacedoub4d3, CARTWGTAVGFACEDOUB4D3) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(3, d), + cdata->getPointer(3, d)); } else { TBOX_ERROR("CartesianFaceDoubleWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + << "dim > 4 not supported." << std::endl); } } } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.h index 5c8ca875..e85b2fa7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianFaceDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianFaceDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianFaceDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianFaceDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianFaceDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.C index a22e2058..ec6dc6e9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for face-centered * float data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianFaceFloatConservativeLinearRefine_C -#define included_geom_CartesianFaceFloatConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.h" #include #include @@ -19,7 +15,6 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/FaceData.h" #include "SAMRAI/pdat/FaceVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -37,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinreffaceflot1d, CARTCLINREFFACEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot1d, CARTCLINREFFACEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +41,7 @@ void F77_FUNC(cartclinreffaceflot1d, CARTCLINREFFACEFLOT1D) (const int&, const float *, float *, float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartclinreffaceflot2d0, CARTCLINREFFACEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot2d0, CARTCLINREFFACEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -54,7 +49,7 @@ void F77_FUNC(cartclinreffaceflot2d0, CARTCLINREFFACEFLOT2D0) (const int&, const int *, const double *, const double *, const float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinreffaceflot2d1, CARTCLINREFFACEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot2d1, CARTCLINREFFACEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +58,7 @@ void F77_FUNC(cartclinreffaceflot2d1, CARTCLINREFFACEFLOT2D1) (const int&, const float *, float *, float *, float *, float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartclinreffaceflot3d0, CARTCLINREFFACEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot3d0, CARTCLINREFFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +71,7 @@ void F77_FUNC(cartclinreffaceflot3d0, CARTCLINREFFACEFLOT3D0) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinreffaceflot3d1, CARTCLINREFFACEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot3d1, CARTCLINREFFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -89,7 +84,7 @@ void F77_FUNC(cartclinreffaceflot3d1, CARTCLINREFFACEFLOT3D1) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinreffaceflot3d2, CARTCLINREFFACEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinreffaceflot3d2, CARTCLINREFFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -108,9 +103,8 @@ namespace SAMRAI { namespace geom { CartesianFaceFloatConservativeLinearRefine:: -CartesianFaceFloatConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianFaceFloatConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -126,9 +120,9 @@ CartesianFaceFloatConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianFaceFloatConservativeLinearRefine::getStencilWidth() const +CartesianFaceFloatConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -140,20 +134,20 @@ CartesianFaceFloatConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -161,48 +155,53 @@ CartesianFaceFloatConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); + + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::FaceData slope0(cgbox, 1, tmp_ghosts); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartclinreffaceflot1d, CARTCLINREFFACEFLOT1D) ( + SAMRAI_F77_FUNC(cartclinreffaceflot1d, CARTCLINREFFACEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -212,13 +211,13 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::FaceData slope1(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinreffaceflot2d0, CARTCLINREFFACEFLOT2D0) ( + SAMRAI_F77_FUNC(cartclinreffaceflot2d0, CARTCLINREFFACEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -228,10 +227,10 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinreffaceflot2d1, CARTCLINREFFACEFLOT2D1) ( + SAMRAI_F77_FUNC(cartclinreffaceflot2d1, CARTCLINREFFACEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -241,18 +240,18 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::FaceData slope1(cgbox, 1, tmp_ghosts); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::FaceData slope2(cgbox, 1, tmp_ghosts); if (axis == 0) { - F77_FUNC(cartclinreffaceflot3d0, CARTCLINREFFACEFLOT3D0) ( + SAMRAI_F77_FUNC(cartclinreffaceflot3d0, CARTCLINREFFACEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -266,11 +265,11 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } else if (axis == 1) { - F77_FUNC(cartclinreffaceflot3d1, CARTCLINREFFACEFLOT3D1) ( + SAMRAI_F77_FUNC(cartclinreffaceflot3d1, CARTCLINREFFACEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -284,11 +283,11 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } else if (axis == 2) { - F77_FUNC(cartclinreffaceflot3d2, CARTCLINREFFACEFLOT3D2) ( + SAMRAI_F77_FUNC(cartclinreffaceflot3d2, CARTCLINREFFACEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -302,9 +301,9 @@ CartesianFaceFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -318,4 +317,3 @@ CartesianFaceFloatConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.h index d2ed6b82..2e8c1c6c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for face-centered * float data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianFaceFloatConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianFaceFloatConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianFaceFloatConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianFaceFloatConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianFaceFloatConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.C index 8bdbaaa0..31c1cbd8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianFaceFloatWeightedAverage_C -#define included_geom_CartesianFaceFloatWeightedAverage_C - #include "SAMRAI/geom/CartesianFaceFloatWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgfaceflot1d, CARTWGTAVGFACEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot1d, CARTWGTAVGFACEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgfaceflot2d0, CARTWGTAVGFACEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot2d0, CARTWGTAVGFACEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgfaceflot2d1, CARTWGTAVGFACEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot2d1, CARTWGTAVGFACEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgfaceflot3d0, CARTWGTAVGFACEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot3d0, CARTWGTAVGFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgfaceflot3d0, CARTWGTAVGFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgfaceflot3d1, CARTWGTAVGFACEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot3d1, CARTWGTAVGFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgfaceflot3d1, CARTWGTAVGFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgfaceflot3d2, CARTWGTAVGFACEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgfaceflot3d2, CARTWGTAVGFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -84,6 +80,43 @@ void F77_FUNC(cartwgtavgfaceflot3d2, CARTWGTAVGFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); +// in cartcoarsen4d.f: +void SAMRAI_F77_FUNC(cartwgtavgfaceflot4d0, CARTWGTAVGFACEFLOT4D0) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const float *, float *); +void SAMRAI_F77_FUNC(cartwgtavgfaceflot4d1, CARTWGTAVGFACEFLOT4D1) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const float *, float *); +void SAMRAI_F77_FUNC(cartwgtavgfaceflot4d2, CARTWGTAVGFACEFLOT4D2) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const float *, float *); +void SAMRAI_F77_FUNC(cartwgtavgfaceflot4d3, CARTWGTAVGFACEFLOT4D3) (const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const float *, float *); } namespace SAMRAI { @@ -91,9 +124,8 @@ namespace geom { // using namespace std; -CartesianFaceFloatWeightedAverage::CartesianFaceFloatWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianFaceFloatWeightedAverage::CartesianFaceFloatWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +140,9 @@ CartesianFaceFloatWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianFaceFloatWeightedAverage::getStencilWidth() const +CartesianFaceFloatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,38 +154,41 @@ CartesianFaceFloatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgfaceflot1d, CARTWGTAVGFACEFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot1d, CARTWGTAVGFACEFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -163,7 +198,7 @@ CartesianFaceFloatWeightedAverage::coarsen( fdata->getPointer(0, d), cdata->getPointer(0, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgfaceflot2d0, CARTWGTAVGFACEFLOT2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot2d0, CARTWGTAVGFACEFLOT2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -172,7 +207,7 @@ CartesianFaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfaceflot2d1, CARTWGTAVGFACEFLOT2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot2d1, CARTWGTAVGFACEFLOT2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -182,7 +217,7 @@ CartesianFaceFloatWeightedAverage::coarsen( fdata->getPointer(1, d), cdata->getPointer(1, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgfaceflot3d0, CARTWGTAVGFACEFLOT3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot3d0, CARTWGTAVGFACEFLOT3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -194,7 +229,7 @@ CartesianFaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, d), cdata->getPointer(0, d)); - F77_FUNC(cartwgtavgfaceflot3d1, CARTWGTAVGFACEFLOT3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot3d1, CARTWGTAVGFACEFLOT3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +241,7 @@ CartesianFaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, d), cdata->getPointer(1, d)); - F77_FUNC(cartwgtavgfaceflot3d2, CARTWGTAVGFACEFLOT3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgfaceflot3d2, CARTWGTAVGFACEFLOT3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -218,13 +253,61 @@ CartesianFaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(2, d), cdata->getPointer(2, d)); + } else if ((dim == tbox::Dimension(4))) { + SAMRAI_F77_FUNC(cartwgtavgfaceflot4d0, CARTWGTAVGFACEFLOT4D0) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(0, d), + cdata->getPointer(0, d)); + SAMRAI_F77_FUNC(cartwgtavgfaceflot4d1, CARTWGTAVGFACEFLOT4D1) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(1, d), + cdata->getPointer(1, d)); + SAMRAI_F77_FUNC(cartwgtavgfaceflot4d2, CARTWGTAVGFACEFLOT4D2) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(2, d), + cdata->getPointer(2, d)); + SAMRAI_F77_FUNC(cartwgtavgfaceflot4d3, CARTWGTAVGFACEFLOT4D3) (ifirstc(0), + ifirstc(1), ifirstc(2), ifirstc(3), + ilastc(0), ilastc(1), ilastc(2), ilastc(3), + filo(0), filo(1), filo(2), filo(3), + fihi(0), fihi(1), fihi(2), fihi(3), + cilo(0), cilo(1), cilo(2), cilo(3), + cihi(0), cihi(1), cihi(2), cihi(3), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + fdata->getPointer(3, d), + cdata->getPointer(3, d)); } else { TBOX_ERROR("CartesianFaceFloatWeightedAverage error...\n" - << "dim > 3 not supported." << std::endl); + << "dim > 4 not supported." << std::endl); } } } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.h index 5cef42a0..d35cfb12 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianFaceFloatWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for face-centered float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianFaceFloatWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianFaceFloatWeightedAverage( - const tbox::Dimension& dim); + CartesianFaceFloatWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianFaceFloatWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianFaceFloatWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.C index 60133840..af240ac0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple Cartesian grid geometry for an AMR hierarchy. * ************************************************************************/ - -#ifndef included_geom_CartesianGridGeometry_C -#define included_geom_CartesianGridGeometry_C - #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -83,13 +79,12 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" #include #include #include @@ -99,8 +94,6 @@ namespace geom { const int CartesianGridGeometry::GEOM_CARTESIAN_GRID_GEOMETRY_VERSION = 2; -// using namespace std; - /* ************************************************************************* * @@ -114,22 +107,17 @@ const int CartesianGridGeometry::GEOM_CARTESIAN_GRID_GEOMETRY_VERSION = 2; CartesianGridGeometry::CartesianGridGeometry( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& input_db, - bool register_for_restart): - GridGeometry(dim, object_name), + const boost::shared_ptr& input_db): + GridGeometry(dim, object_name, input_db, false), d_domain_box(dim) { + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + buildOperators(); bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (is_from_restart && d_registered_for_restart) { + if (is_from_restart) { getFromRestart(); } @@ -140,21 +128,16 @@ CartesianGridGeometry::CartesianGridGeometry( const std::string& object_name, const double* x_lo, const double* x_up, - const hier::BoxContainer& domain, - bool register_for_restart): - GridGeometry(domain.front().getDim(), object_name), + hier::BoxContainer& domain): + GridGeometry(object_name, domain), d_domain_box(domain.front().getDim()) { + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(domain.size() > 0); - TBOX_ASSERT(!(x_lo == (double *)NULL)); - TBOX_ASSERT(!(x_up == (double *)NULL)); - - d_registered_for_restart = register_for_restart; + TBOX_ASSERT(x_lo != 0); + TBOX_ASSERT(x_up != 0); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + buildOperators(); setGeometryData(x_lo, x_up, domain); } @@ -163,22 +146,17 @@ CartesianGridGeometry::CartesianGridGeometry( const std::string& object_name, const double* x_lo, const double* x_up, - const hier::BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart) : - GridGeometry(domain.front().getDim(), object_name, op_reg), + hier::BoxContainer& domain, + const boost::shared_ptr& op_reg): + GridGeometry(object_name, domain, op_reg), d_domain_box(domain.front().getDim()) { + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(domain.size() > 0); - TBOX_ASSERT(!(x_lo == (double *)NULL)); - TBOX_ASSERT(!(x_up == (double *)NULL)); + TBOX_ASSERT(x_lo != 0); + TBOX_ASSERT(x_up != 0); - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + buildOperators(); setGeometryData(x_lo, x_up, domain); } @@ -207,8 +185,7 @@ CartesianGridGeometry::~CartesianGridGeometry() boost::shared_ptr CartesianGridGeometry::makeRefinedGridGeometry( const std::string& fine_geom_name, - const hier::IntVector& refine_ratio, - bool register_for_restart) const + const hier::IntVector& refine_ratio) const { const tbox::Dimension dim(getDim()); @@ -220,15 +197,13 @@ CartesianGridGeometry::makeRefinedGridGeometry( fine_domain.refine(refine_ratio); boost::shared_ptr fine_geometry( - boost::make_shared(fine_geom_name, + new CartesianGridGeometry(fine_geom_name, d_x_lo, d_x_up, fine_domain, - d_transfer_operator_registry, - register_for_restart)); + d_transfer_operator_registry)); - fine_geometry->initializePeriodicShift(getPeriodicShift(hier:: - IntVector::getOne(dim))); + fine_geometry->initializePeriodicShift(getPeriodicShift(refine_ratio)); return fine_geometry; } @@ -245,14 +220,11 @@ CartesianGridGeometry::makeRefinedGridGeometry( boost::shared_ptr CartesianGridGeometry::makeCoarsenedGridGeometry( const std::string& coarse_geom_name, - const hier::IntVector& coarsen_ratio, - bool register_for_restart) const + const hier::IntVector& coarsen_ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_ASSERT(!coarse_geom_name.empty()); TBOX_ASSERT(coarse_geom_name != getObjectName()); - TBOX_ASSERT(coarsen_ratio > hier::IntVector::getZero(dim)); + TBOX_ASSERT(coarsen_ratio > hier::IntVector::getZero(getDim())); hier::BoxContainer coarse_domain(getPhysicalDomain()); coarse_domain.coarsen(coarsen_ratio); @@ -262,10 +234,12 @@ CartesianGridGeometry::makeCoarsenedGridGeometry( */ const hier::BoxContainer& fine_domain = getPhysicalDomain(); const int nboxes = fine_domain.size(); - hier::BoxContainer::const_iterator fine_domain_itr(fine_domain); - hier::BoxContainer::iterator coarse_domain_itr(coarse_domain); - for (int ib = 0; ib < nboxes; ib++, ++fine_domain_itr, ++coarse_domain_itr) { - hier::Box testbox = hier::Box::refine(*coarse_domain_itr, coarsen_ratio); + hier::BoxContainer::const_iterator fine_domain_itr = fine_domain.begin(); + hier::BoxContainer::iterator coarse_domain_itr = coarse_domain.begin(); + for (int ib = 0; ib < nboxes; ++ib, ++fine_domain_itr, ++coarse_domain_itr) { + hier::Box testbox = + hier::Box::refine(*coarse_domain_itr, + coarsen_ratio); if (!testbox.isSpatiallyEqual(*fine_domain_itr)) { #ifdef DEBUG_CHECK_ASSERTIONS tbox::plog @@ -284,15 +258,13 @@ CartesianGridGeometry::makeCoarsenedGridGeometry( } boost::shared_ptr coarse_geometry( - boost::make_shared(coarse_geom_name, + new CartesianGridGeometry(coarse_geom_name, d_x_lo, d_x_up, coarse_domain, - d_transfer_operator_registry, - register_for_restart)); + d_transfer_operator_registry)); - coarse_geometry->initializePeriodicShift(getPeriodicShift(hier:: - IntVector::getOne(dim))); + coarse_geometry->initializePeriodicShift(getPeriodicShift(-coarsen_ratio)); return coarse_geometry; } @@ -313,19 +285,21 @@ CartesianGridGeometry::setGeometryData( { const tbox::Dimension& dim(getDim()); - TBOX_ASSERT(!(x_lo == (double *)NULL)); - TBOX_ASSERT(!(x_up == (double *)NULL)); + TBOX_ASSERT(x_lo != 0); + TBOX_ASSERT(x_up != 0); - for (int id = 0; id < dim.getValue(); id++) { + for (int id = 0; id < dim.getValue(); ++id) { d_x_lo[id] = x_lo[id]; d_x_up[id] = x_up[id]; } - setPhysicalDomain(domain, 1); + if (getPhysicalDomain().empty()) { + setPhysicalDomain(domain, 1); + } hier::Box bigbox(dim); const hier::BoxContainer& block_domain = getPhysicalDomain(); - for (hier::BoxContainer::const_iterator k(block_domain); + for (hier::BoxContainer::const_iterator k = block_domain.begin(); k != block_domain.end(); ++k) { bigbox += *k; } @@ -333,7 +307,7 @@ CartesianGridGeometry::setGeometryData( d_domain_box = bigbox; hier::IntVector ncells = d_domain_box.numberCells(); - for (int id2 = 0; id2 < dim.getValue(); id2++) { + for (int id2 = 0; id2 < dim.getValue(); ++id2) { double length = d_x_up[id2] - d_x_lo[id2]; d_dx[id2] = length / ((double)ncells(id2)); } @@ -352,39 +326,42 @@ void CartesianGridGeometry::setGeometryDataOnPatch( hier::Patch& patch, const hier::IntVector& ratio_to_level_zero, - const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry) const + const TwoDimBool& touches_regular_bdry) const { const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(dim, patch, ratio_to_level_zero); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, patch, ratio_to_level_zero); + + const hier::BlockId& block_id = patch.getBox().getBlockId(); + hier::BlockId::block_t blk = block_id.getBlockValue(); #ifdef DEBUG_CHECK_ASSERTIONS /* * All components of ratio must be nonzero. Additionally, * all components not equal to 1 must have the same sign. */ - TBOX_ASSERT(ratio_to_level_zero != hier::IntVector::getZero(dim)); + TBOX_ASSERT(ratio_to_level_zero != 0); if (dim > tbox::Dimension(1)) { - for (int i = 0; i < dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % dim.getValue()) == 1)); + for (unsigned int i = 0; i < dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(blk,i) > 0; + bool pos1 = ratio_to_level_zero(blk,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(blk,i) == 1) + || (ratio_to_level_zero(blk,(i + 1) % dim.getValue()) == 1)); } } #endif - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double x_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double x_up[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double dx[SAMRAI::MAX_DIM_VAL]; + double x_lo[SAMRAI::MAX_DIM_VAL]; + double x_up[SAMRAI::MAX_DIM_VAL]; bool coarsen = false; - if (ratio_to_level_zero(0) < 0) coarsen = true; - hier::IntVector tmp_rat = (ratio_to_level_zero); - for (int id2 = 0; id2 < dim.getValue(); id2++) { - tmp_rat(id2) = abs(ratio_to_level_zero(id2)); + if (ratio_to_level_zero(blk,0) < 0) coarsen = true; + hier::IntVector tmp_rat = ratio_to_level_zero; + for (int id2 = 0; id2 < dim.getValue(); ++id2) { + tmp_rat(blk,id2) = abs(ratio_to_level_zero(blk,id2)); } hier::Box index_box = d_domain_box; @@ -392,17 +369,17 @@ CartesianGridGeometry::setGeometryDataOnPatch( if (coarsen) { index_box.coarsen(tmp_rat); - for (int id3 = 0; id3 < dim.getValue(); id3++) { + for (tbox::Dimension::dir_t id3 = 0; id3 < dim.getValue(); ++id3) { dx[id3] = d_dx[id3] * ((double)tmp_rat(id3)); } } else { index_box.refine(tmp_rat); - for (int id4 = 0; id4 < dim.getValue(); id4++) { + for (tbox::Dimension::dir_t id4 = 0; id4 < dim.getValue(); ++id4) { dx[id4] = d_dx[id4] / ((double)tmp_rat(id4)); } } - for (int id5 = 0; id5 < dim.getValue(); id5++) { + for (tbox::Dimension::dir_t id5 = 0; id5 < dim.getValue(); ++id5) { x_lo[id5] = d_x_lo[id5] + ((double)(box.lower(id5) - index_box.lower(id5))) * dx[id5]; x_up[id5] = x_lo[id5] + ((double)box.numberCells(id5)) * dx[id5]; @@ -411,7 +388,7 @@ CartesianGridGeometry::setGeometryDataOnPatch( boost::shared_ptr geom( boost::make_shared(ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry, + block_id, dx, x_lo, x_up)); patch.setPatchGeometry(geom); @@ -421,104 +398,102 @@ CartesianGridGeometry::setGeometryDataOnPatch( void CartesianGridGeometry::buildOperators() { - GridGeometry::buildOperators(); - // CartesianGridGeometry specific Coarsening Operators addCoarsenOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::OutersideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); // CartesianGridGeometry specific Refinement Operators addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); } /* @@ -541,17 +516,17 @@ CartesianGridGeometry::printClassData( int id; os << "d_x_lo = "; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { os << d_x_lo[id] << " "; } os << std::endl; os << "d_x_up = "; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { os << d_x_up[id] << " "; } os << std::endl; os << "d_dx = "; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { os << d_dx[id] << " "; } os << std::endl; @@ -564,32 +539,26 @@ CartesianGridGeometry::printClassData( /* ************************************************************************* * - * Write class version number and object state to database. + * Write class version number and object state to restart database. * ************************************************************************* */ void -CartesianGridGeometry::putToDatabase( - const boost::shared_ptr& db) const +CartesianGridGeometry::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); + + hier::BaseGridGeometry::putToRestart(restart_db); const tbox::Dimension& dim(getDim()); - db->putInteger("GEOM_CARTESIAN_GRID_GEOMETRY_VERSION", + restart_db->putInteger("GEOM_CARTESIAN_GRID_GEOMETRY_VERSION", GEOM_CARTESIAN_GRID_GEOMETRY_VERSION); - tbox::Array temp_box_array = getPhysicalDomain(); - db->putDatabaseBoxArray("d_physical_domain", temp_box_array); - - db->putDoubleArray("d_dx", d_dx, dim.getValue()); - db->putDoubleArray("d_x_lo", d_x_lo, dim.getValue()); - db->putDoubleArray("d_x_up", d_x_up, dim.getValue()); - hier::IntVector level0_shift( - getPeriodicShift(hier::IntVector::getOne(dim))); - int* temp_shift = &level0_shift[0]; - db->putIntegerArray("d_periodic_shift", temp_shift, dim.getValue()); + restart_db->putDoubleArray("x_lo", d_x_lo, dim.getValue()); + restart_db->putDoubleArray("x_up", d_x_up, dim.getValue()); } @@ -607,70 +576,41 @@ CartesianGridGeometry::putToDatabase( void CartesianGridGeometry::getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart) { - TBOX_ASSERT(db); + if (!is_from_restart && !input_db) { + TBOX_ERROR(": CartesianGridGeometry::getFromInput()\n" + << "no input database supplied" << std::endl); + } const tbox::Dimension& dim(getDim()); if (!is_from_restart) { - hier::BoxContainer domain; - if (db->keyExists("domain_boxes")) { - hier::BoxContainer input_domain( - db->getDatabaseBoxArray("domain_boxes")); - if (input_domain.size() == 0) { - TBOX_ERROR( - "CartesianGridGeometry::getFromInput() error...\n" - << " geometry object with name = " << getObjectName() - << "\n Empty `domain_boxes' array found in input." - << std::endl); - } - hier::LocalId local_id(0); - for (hier::BoxContainer::iterator itr = input_domain.begin(); - itr != input_domain.end(); ++itr) { - itr->setBlockId(hier::BlockId(0)); - domain.pushBack(hier::Box(*itr, local_id++, 0)); - } - } else { - TBOX_ERROR("CartesianGridGeometry::getFromInput() error...\n" - << " geometry object with name = " << getObjectName() - << "\n Key data `domain_boxes' not found in input." << std::endl); - } - - double x_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE], - x_up[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - if (db->keyExists("x_lo")) { - db->getDoubleArray("x_lo", x_lo, dim.getValue()); - } else { - TBOX_ERROR("CartesianGridGeometry::getFromInput() error...\n" - << " geometry object with name = " << getObjectName() - << "\n Key data `x_lo' not found in input." << std::endl); - } - if (db->keyExists("x_up")) { - db->getDoubleArray("x_up", x_up, dim.getValue()); - } else { - TBOX_ERROR("CartesianGridGeometry::getFromInput() error...\n" - << " geometry object with name = " << getObjectName() - << "\n Key data `x_up' not found in input." << std::endl); - } + double x_lo[SAMRAI::MAX_DIM_VAL], + x_up[SAMRAI::MAX_DIM_VAL]; - int pbc[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - hier::IntVector per_bc(dim, 0); - if (db->keyExists("periodic_dimension")) { - db->getIntegerArray("periodic_dimension", pbc, dim.getValue()); - for (int i = 0; i < dim.getValue(); i++) { - per_bc(i) = ((pbc[i] == 0) ? 0 : 1); + input_db->getDoubleArray("x_lo", x_lo, dim.getValue()); + input_db->getDoubleArray("x_up", x_up, dim.getValue()); + for (int i = 0; i < dim.getValue(); ++i) { + if (!(x_lo[i] < x_up[i])) { + INPUT_RANGE_ERROR("x_lo and x_up"); } } - - initializePeriodicShift(per_bc); - - setGeometryData(x_lo, x_up, domain); - + setGeometryData(x_lo, x_up, getPhysicalDomain()); + + } else if (input_db) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + int num_keys = static_cast(input_db->getAllKeys().size()); + if (num_keys > 0 && read_on_restart) { + TBOX_WARNING( + "CartesianGridGeometry::getFromInput() warning...\n" + << "You want to override restart data with values from\n" + << "an input database which is not allowed." << std::endl); + } } } @@ -688,8 +628,6 @@ CartesianGridGeometry::getFromInput( void CartesianGridGeometry::getFromRestart() { - const tbox::Dimension& dim(getDim()); - boost::shared_ptr restart_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -701,36 +639,24 @@ CartesianGridGeometry::getFromRestart() boost::shared_ptr db( restart_db->getDatabase(getObjectName())); + const tbox::Dimension& dim(getDim()); + int ver = db->getInteger("GEOM_CARTESIAN_GRID_GEOMETRY_VERSION"); if (ver != GEOM_CARTESIAN_GRID_GEOMETRY_VERSION) { TBOX_ERROR("CartesianGridGeometry::getFromRestart() error...\n" << " geometry object with name = " << getObjectName() - << "Restart file version is different than class version" << std::endl); - } - hier::BoxContainer restart_domain( - db->getDatabaseBoxArray("d_physical_domain")); - double x_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE], - x_up[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - db->getDoubleArray("d_x_lo", x_lo, dim.getValue()); - db->getDoubleArray("d_x_up", x_up, dim.getValue()); - - hier::BoxContainer domain; - hier::LocalId local_id(0); - for (hier::BoxContainer::iterator itr = restart_domain.begin(); - itr != restart_domain.end(); ++itr) { - itr->setBlockId(hier::BlockId(0)); - domain.pushBack(hier::Box(*itr, local_id++, 0)); + << "Restart file version is different than class version" + << std::endl); } - setGeometryData(x_lo, x_up, domain); + double x_lo[SAMRAI::MAX_DIM_VAL], + x_up[SAMRAI::MAX_DIM_VAL]; + db->getDoubleArray("x_lo", x_lo, dim.getValue()); + db->getDoubleArray("x_up", x_up, dim.getValue()); - hier::IntVector periodic_shift(dim); - int* temp_shift = &periodic_shift[0]; - db->getIntegerArray("d_periodic_shift", temp_shift, dim.getValue()); - initializePeriodicShift(periodic_shift); + setGeometryData(x_lo, x_up, getPhysicalDomain()); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.h index a51e2bed..ad2cb5d4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianGridGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple Cartesian grid geometry for an AMR hierarchy. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Serializable.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -36,73 +36,96 @@ namespace geom { * domain. The mesh increments on each level are defined with respect to * the coarsest hierarchy level and multiplying those values by the proper * refinement ratio. This class sets geometry information on each patch in - * an AMR hierarchy. This class is derived from the geom::GridGeometry - * base class. - * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input and restart data are summarized as follows: - * - * Required input keys and data types: - * - * + * an AMR hierarchy. This class is derived from the GridGeometry base class. * + * Input Parameters * + * Definitions: * - \b domain_boxes - * tbox::Array of boxes representing the index space for the entire - * domain (on the coarsest refinement level). + * an array of boxes representing the index space for the entire domain + * on the coarsest mesh level; i.e., level zero. + * + * - \b periodic_dimension + * An array of integer values (expected number of values is equal to + * the spatial dimension of the mesh) representing the directions in + * which the physical domain is periodic. A non-zero value indicates + * that the direction is periodic. A zero value indicates that the + * direction is not periodic. * * - \b x_lo - * tbox::Array of double values representing the spatial coordinates of - * the lower corner of the physical domain. + * values representing the spatial coordinates of the lower corner of the + * physical domain. * * - \b x_up - * tbox::Array of double values representing the spatial coordinates of - * the upper corner of the physical domain. - * - * - * - * - * - * Optional input keys, data types, and defaults: - * - * - * - * - * - \b periodic_dimension - * tbox::Array of integer values representing the directions in which - * the physical domain is periodic. A non-zero value indicates - * that the direction is periodic. A zero value indicates that - * the direction is not periodic. If no values are specified, then - * the array is initialized to all zeros (no periodic directions). - * + * values representing the spatial coordinates of the upper corner of the + * physical domain. * + * No values read in from a restart database may be overridden by input + * database values. * - * No input values can overwrite restart values. + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    domain_boxesarray of DatabaseBoxesnoneall Boxes must be non-emptyreqMay not be modified by input db on restart
    periodic_dimensionint[]all values 0any intoptMay not be modified by input db on restart
    x_lodouble[]noneeach x_lo < corresponding x_upreqMay not be modified by input db on restart
    x_updouble[]noneeach x_up > corresponding x_loreqMay not be modified by input db on restart
    * * A sample input file for a two-dimensional problem might look like: * - * @verbatim - * + * @code * domain_boxes = [(0,0) , (49,39)] * x_lo = 0.0 , 0.0 * x_up = 50.0 , 40.0 * periodic_dimension = 0, 1 // periodic in y only - * - * @endverbatim + * @endcode * * This generates a two-dimensional rectangular domain periodic in the * y-direction, and having 50 cells in the x-direction and 40 cells in * the y-direction, with the cell size 1 unit in each direction. * - * @see geom::GridGeometry + * @see GridGeometry */ class CartesianGridGeometry: - public geom::GridGeometry + public GridGeometry { - friend class TransferOperatorRegistry; - typedef hier::PatchGeometry::TwoDimBool TwoDimBool; public: @@ -110,38 +133,30 @@ class CartesianGridGeometry: * Constructor for CartesianGridGeometry initializes data * members based on parameters read from the specified input database * or from the restart database corresponding to the specified - * object name. The constructor also registers this object - * for restart using the specified object name when the boolean - * argument is true. Whether object will write its state to restart - * files during program execution is determined by this argument. - * Note that it has a default state of true. + * object name. * - * Errors: passing in a null database pointer or an empty std::string - * will result in an unrecoverable assertion. + * @pre !object_name.empty() + * @pre input_db */ CartesianGridGeometry( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& input_db, - bool register_for_restart = true); + const boost::shared_ptr& input_db); /** * Constructor for CartesianGridGeometry sets data members - * based on arguments. The constructor also registers this object - * for restart using the specified object name when the boolean - * argument is true. Whether object will write its state to restart - * files during program execution is determined by this argument. - * Note that it has a default state of true. + * based on arguments. * - * Errors: passing in an empty std::string, or null data pointers will - * result in an unrecoverable assertion. + * @pre !object_name.empty() + * @pre domain.size() > 0 + * @pre x_lo != 0 + * @pre x_up != 0 */ CartesianGridGeometry( const std::string& object_name, const double* x_lo, const double* x_up, - const hier::BoxContainer& domain, - bool register_for_restart = true); + hier::BoxContainer& domain); /*! * @brief Construct a new coarsened/refined CartesianGridGeometry object @@ -160,57 +175,71 @@ class CartesianGridGeometry: * @param[in] domain The coarsened/refined domain. * @param[in] op_reg The same operator registry as the uncoarsened/unrefined * grid geometry. - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. + * + * @pre !object_name.empty() + * @pre domain.size() > 0 + * @pre x_lo != 0 + * @pre x_up != 0 */ CartesianGridGeometry( const std::string& object_name, const double* x_lo, const double* x_up, - const hier::BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart); + hier::BoxContainer& domain, + const boost::shared_ptr& op_reg); /** * Destructor for CartesianGridGeometry deallocates * data describing grid geometry and unregisters the object with - * the restart manager if previously registered. + * the restart manager. */ virtual ~CartesianGridGeometry(); /** * Create and return a pointer to a refined version of this Cartesian grid * geometry object. + * + * @pre !fine_geom_name.empty() + * @pre fine_geom_name != getObjectName() + * @pre refine_ratio > hier::IntVector::getZero(getDim()) */ boost::shared_ptr makeRefinedGridGeometry( const std::string& fine_geom_name, - const hier::IntVector& refine_ratio, - bool register_for_restart) const; + const hier::IntVector& refine_ratio) const; /** * Create and return a pointer to a coarsened version of this Cartesian grid * geometry object. + * + * @pre !coarse_geom_name.empty() + * @pre coarse_geom_name != getObjectName() + * @pre coarsen_ratio > hier::IntVector::getZero(getDim()) */ boost::shared_ptr makeCoarsenedGridGeometry( const std::string& coarse_geom_name, - const hier::IntVector& coarsen_ratio, - bool register_for_restart) const; + const hier::IntVector& coarsen_ratio) const; /* * Compute grid data for patch and assign new geom_CartesianPatchGeometry * object to patch. + * + * @pre (getDim() == patch.getDim()) && + * (getDim() == ratio_to_level_zero.getDim()) + * @pre ratio_to_level_zero != hier::IntVector::getZero(getDim()) */ void setGeometryDataOnPatch( hier::Patch& patch, const hier::IntVector& ratio_to_level_zero, - const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry) const; + const TwoDimBool& touches_regular_bdry) const; /** * Set data members for this CartesianGridGeometry object. + * + * @pre x_lo != 0 + * @pre x_up != 0 */ void setGeometryData( @@ -256,13 +285,13 @@ class CartesianGridGeometry: /** * Writes the state of the CartesianGridGeometry object to the - * database. + * restart database. * - * When assertion checking is active, db cannot be a null database pointer. + * @pre restart_db */ virtual void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; protected: /*! @@ -282,12 +311,11 @@ class CartesianGridGeometry: * Data is read from input only if the simulation is not from restart. * Otherwise, all values specified in the input database are ignored. * - * Arguments: is_from_restart is true when simulation is from restart - * Assertions: db must not be a null pointer. + * @pre is_from_restart || input_db */ void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); /* @@ -307,15 +335,10 @@ class CartesianGridGeometry: void getFromRestart(); - /* - * Flag to determine whether this instance is registered for restart. - */ - bool d_registered_for_restart; - - double d_dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // mesh increments for level 0. - double d_x_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // spatial coordinates of lower corner + double d_dx[SAMRAI::MAX_DIM_VAL]; // mesh increments for level 0. + double d_x_lo[SAMRAI::MAX_DIM_VAL]; // spatial coordinates of lower corner // (i.e., box corner) of problem domain. - double d_x_up[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // spatial coordinates of upper corner + double d_x_up[SAMRAI::MAX_DIM_VAL]; // spatial coordinates of upper corner // (i.e., box corner) of problem domain. hier::Box d_domain_box; // smallest box covering coarsest level diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.C index 6de7f600..5f36aea4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianNodeComplexLinearRefine_C -#define included_geom_CartesianNodeComplexLinearRefine_C - #include "SAMRAI/geom/CartesianNodeComplexLinearRefine.h" #include "SAMRAI/tbox/Complex.h" @@ -37,7 +33,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefnodecplx1d, CARTLINREFNODECPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodecplx1d, CARTLINREFNODECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(cartlinrefnodecplx1d, CARTLINREFNODECPLX1D) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefnodecplx2d, CARTLINREFNODECPLX2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodecplx2d, CARTLINREFNODECPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +49,7 @@ void F77_FUNC(cartlinrefnodecplx2d, CARTLINREFNODECPLX2D) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefnodecplx3d, CARTLINREFNODECPLX3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodecplx3d, CARTLINREFNODECPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -71,9 +67,8 @@ namespace geom { // using namespace std; -CartesianNodeComplexLinearRefine::CartesianNodeComplexLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianNodeComplexLinearRefine::CartesianNodeComplexLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -88,9 +83,9 @@ CartesianNodeComplexLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianNodeComplexLinearRefine::getStencilWidth() const +CartesianNodeComplexLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -103,12 +98,13 @@ CartesianNodeComplexLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::NodeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box fine_box(*b); fine_box.growUpper(hier::IntVector(ratio.getDim(), -1)); refine(fine, @@ -129,42 +125,45 @@ CartesianNodeComplexLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefnodecplx1d, CARTLINREFNODECPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodecplx1d, CARTLINREFNODECPLX1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -175,7 +174,7 @@ CartesianNodeComplexLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefnodecplx2d, CARTLINREFNODECPLX2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodecplx2d, CARTLINREFNODECPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -186,7 +185,7 @@ CartesianNodeComplexLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefnodecplx3d, CARTLINREFNODECPLX3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodecplx3d, CARTLINREFNODECPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -209,4 +208,3 @@ CartesianNodeComplexLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.h index a47d60b7..9b0104cb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeComplexLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianNodeComplexLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianNodeComplexLinearRefine( - const tbox::Dimension& dim); + CartesianNodeComplexLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianNodeComplexLinearRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianNodeComplexLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -88,6 +90,15 @@ class CartesianNodeComplexLinearRefine: * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.C index 3221a288..cc146207 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianNodeDoubleLinearRefine_C -#define included_geom_CartesianNodeDoubleLinearRefine_C - #include "SAMRAI/geom/CartesianNodeDoubleLinearRefine.h" #include @@ -36,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefnodedoub1d, CARTLINREFNODEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodedoub1d, CARTLINREFNODEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -44,7 +40,7 @@ void F77_FUNC(cartlinrefnodedoub1d, CARTLINREFNODEDOUB1D) (const int&, const int *, const double *, const double *, const double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefnodedoub2d, CARTLINREFNODEDOUB2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodedoub2d, CARTLINREFNODEDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(cartlinrefnodedoub2d, CARTLINREFNODEDOUB2D) (const int&, const int *, const double *, const double *, const double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefnodedoub3d, CARTLINREFNODEDOUB3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodedoub3d, CARTLINREFNODEDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,9 +66,8 @@ namespace geom { // using namespace std; -CartesianNodeDoubleLinearRefine::CartesianNodeDoubleLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianNodeDoubleLinearRefine::CartesianNodeDoubleLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -87,9 +82,9 @@ CartesianNodeDoubleLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianNodeDoubleLinearRefine::getStencilWidth() const +CartesianNodeDoubleLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -102,12 +97,13 @@ CartesianNodeDoubleLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::NodeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box fine_box(*b); fine_box.growUpper(hier::IntVector(ratio.getDim(), -1)); refine(fine, @@ -128,42 +124,45 @@ CartesianNodeDoubleLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefnodedoub1d, CARTLINREFNODEDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodedoub1d, CARTLINREFNODEDOUB1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -174,7 +173,7 @@ CartesianNodeDoubleLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefnodedoub2d, CARTLINREFNODEDOUB2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodedoub2d, CARTLINREFNODEDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -185,7 +184,7 @@ CartesianNodeDoubleLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefnodedoub3d, CARTLINREFNODEDOUB3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodedoub3d, CARTLINREFNODEDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -208,4 +207,3 @@ CartesianNodeDoubleLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.h index e2bada57..a7d56aa9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeDoubleLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianNodeDoubleLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianNodeDoubleLinearRefine( - const tbox::Dimension& dim); + CartesianNodeDoubleLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianNodeDoubleLinearRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianNodeDoubleLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -88,6 +90,15 @@ class CartesianNodeDoubleLinearRefine: * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.C index 1d57f38a..56f69763 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianNodeFloatLinearRefine_C -#define included_geom_CartesianNodeFloatLinearRefine_C - #include "SAMRAI/geom/CartesianNodeFloatLinearRefine.h" #include @@ -36,7 +32,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartlinrefnodeflot1d, CARTLINREFNODEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodeflot1d, CARTLINREFNODEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -44,7 +40,7 @@ void F77_FUNC(cartlinrefnodeflot1d, CARTLINREFNODEFLOT1D) (const int&, const int *, const double *, const double *, const float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartlinrefnodeflot2d, CARTLINREFNODEFLOT2D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodeflot2d, CARTLINREFNODEFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(cartlinrefnodeflot2d, CARTLINREFNODEFLOT2D) (const int&, const int *, const double *, const double *, const float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartlinrefnodeflot3d, CARTLINREFNODEFLOT3D) (const int&, +void SAMRAI_F77_FUNC(cartlinrefnodeflot3d, CARTLINREFNODEFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,9 +64,8 @@ void F77_FUNC(cartlinrefnodeflot3d, CARTLINREFNODEFLOT3D) (const int&, namespace SAMRAI { namespace geom { -CartesianNodeFloatLinearRefine::CartesianNodeFloatLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "LINEAR_REFINE") +CartesianNodeFloatLinearRefine::CartesianNodeFloatLinearRefine(): + hier::RefineOperator("LINEAR_REFINE") { } @@ -85,9 +80,9 @@ CartesianNodeFloatLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianNodeFloatLinearRefine::getStencilWidth() const +CartesianNodeFloatLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -100,12 +95,13 @@ CartesianNodeFloatLinearRefine::refine( const hier::IntVector& ratio) const { const pdat::NodeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box fine_box(*b); fine_box.growUpper(hier::IntVector(ratio.getDim(), -1)); refine(fine, @@ -126,42 +122,45 @@ CartesianNodeFloatLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, fine_box, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartlinrefnodeflot1d, CARTLINREFNODEFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodeflot1d, CARTLINREFNODEFLOT1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -172,7 +171,7 @@ CartesianNodeFloatLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartlinrefnodeflot2d, CARTLINREFNODEFLOT2D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodeflot2d, CARTLINREFNODEFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,7 +182,7 @@ CartesianNodeFloatLinearRefine::refine( cdata->getPointer(d), fdata->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartlinrefnodeflot3d, CARTLINREFNODEFLOT3D) (ifirstc(0), + SAMRAI_F77_FUNC(cartlinrefnodeflot3d, CARTLINREFNODEFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -207,4 +206,3 @@ CartesianNodeFloatLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.h index 7ffddafb..dd474d80 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianNodeFloatLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear refine operator for node-centered float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianNodeFloatLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianNodeFloatLinearRefine( - const tbox::Dimension& dim); + CartesianNodeFloatLinearRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianNodeFloatLinearRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CartesianNodeFloatLinearRefine: * of the destination patch and the boxes contained in fine_overlap * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( @@ -88,6 +90,15 @@ class CartesianNodeFloatLinearRefine: * coarse patch contains sufficient data for the stencil width of the * refinement operator. This differs from the above refine() method * only in that it operates on a single fine box instead of a BoxOverlap. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.C index 23487532..7a48f357 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianOuterfaceComplexWeightedAverage_C -#define included_geom_CartesianOuterfaceComplexWeightedAverage_C - #include "SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.h" #include "SAMRAI/tbox/Complex.h" @@ -37,14 +33,14 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutfacecplx1d, CARTWGTAVGOUTFACECPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx1d, CARTWGTAVGOUTFACECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutfacecplx2d0, CARTWGTAVGOUTFACECPLX2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx2d0, CARTWGTAVGOUTFACECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -54,7 +50,7 @@ void F77_FUNC(cartwgtavgoutfacecplx2d0, CARTWGTAVGOUTFACECPLX2D0) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgoutfacecplx2d1, CARTWGTAVGOUTFACECPLX2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx2d1, CARTWGTAVGOUTFACECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +60,7 @@ void F77_FUNC(cartwgtavgoutfacecplx2d1, CARTWGTAVGOUTFACECPLX2D1) (const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutfacecplx3d0, CARTWGTAVGOUTFACECPLX3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d0, CARTWGTAVGOUTFACECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -73,7 +69,7 @@ void F77_FUNC(cartwgtavgoutfacecplx3d0, CARTWGTAVGOUTFACECPLX3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgoutfacecplx3d1, CARTWGTAVGOUTFACECPLX3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d1, CARTWGTAVGOUTFACECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(cartwgtavgoutfacecplx3d1, CARTWGTAVGOUTFACECPLX3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgoutfacecplx3d2, CARTWGTAVGOUTFACECPLX3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d2, CARTWGTAVGOUTFACECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -99,9 +95,8 @@ namespace geom { // using namespace std; CartesianOuterfaceComplexWeightedAverage:: -CartesianOuterfaceComplexWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianOuterfaceComplexWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -117,9 +112,9 @@ CartesianOuterfaceComplexWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianOuterfaceComplexWeightedAverage::getStencilWidth() const +CartesianOuterfaceComplexWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -131,40 +126,43 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgoutfacecplx1d, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx1d, CARTWGTAVGOUTFACECPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -174,7 +172,7 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgoutfacecplx2d0, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx2d0, CARTWGTAVGOUTFACECPLX2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -184,7 +182,7 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacecplx2d1, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx2d1, CARTWGTAVGOUTFACECPLX2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -195,7 +193,7 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgoutfacecplx3d0, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d0, CARTWGTAVGOUTFACECPLX3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -207,7 +205,7 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacecplx3d1, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d1, CARTWGTAVGOUTFACECPLX3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -219,7 +217,7 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutfacecplx3d2, + SAMRAI_F77_FUNC(cartwgtavgoutfacecplx3d2, CARTWGTAVGOUTFACECPLX3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -241,4 +239,3 @@ CartesianOuterfaceComplexWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.h index ca829f97..8c55516c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceComplexWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianOuterfaceComplexWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianOuterfaceComplexWeightedAverage( - const tbox::Dimension& dim); + CartesianOuterfaceComplexWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianOuterfaceComplexWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianOuterfaceComplexWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.C index 438c8b9c..c293b0f7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianOuterfaceDoubleWeightedAverage_C -#define included_geom_CartesianOuterfaceDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.h" #include @@ -36,14 +32,14 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +49,7 @@ void F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) (const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +59,7 @@ void F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) (const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -72,7 +68,7 @@ void F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -81,7 +77,7 @@ void F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -98,9 +94,8 @@ namespace geom { // using namespace std; CartesianOuterfaceDoubleWeightedAverage:: -CartesianOuterfaceDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianOuterfaceDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -116,9 +111,9 @@ CartesianOuterfaceDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianOuterfaceDoubleWeightedAverage::getStencilWidth() const +CartesianOuterfaceDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -130,40 +125,43 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgoutfacedoub1d, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -173,7 +171,7 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgoutfacedoub2d0, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -183,7 +181,7 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacedoub2d1, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -194,7 +192,7 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgoutfacedoub3d0, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +204,7 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacedoub3d1, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -218,7 +216,7 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutfacedoub3d2, + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -240,4 +238,3 @@ CartesianOuterfaceDoubleWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.h index 5d78dfe4..b5b40a41 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianOuterfaceDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianOuterfaceDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianOuterfaceDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianOuterfaceDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianOuterfaceDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.C index 1024aa2c..cc59b2ea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianOuterfaceFloatWeightedAverage_C -#define included_geom_CartesianOuterfaceFloatWeightedAverage_C - #include "SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.h" #include @@ -36,14 +32,14 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutfaceflot1d, CARTWGTAVGOUTFACEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot1d, CARTWGTAVGOUTFACEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutfaceflot2d0, CARTWGTAVGOUTFACEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot2d0, CARTWGTAVGOUTFACEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +49,7 @@ void F77_FUNC(cartwgtavgoutfaceflot2d0, CARTWGTAVGOUTFACEFLOT2D0) (const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgoutfaceflot2d1, CARTWGTAVGOUTFACEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot2d1, CARTWGTAVGOUTFACEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +59,7 @@ void F77_FUNC(cartwgtavgoutfaceflot2d1, CARTWGTAVGOUTFACEFLOT2D1) (const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutfaceflot3d0, CARTWGTAVGOUTFACEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d0, CARTWGTAVGOUTFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -72,7 +68,7 @@ void F77_FUNC(cartwgtavgoutfaceflot3d0, CARTWGTAVGOUTFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgoutfaceflot3d1, CARTWGTAVGOUTFACEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d1, CARTWGTAVGOUTFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -81,7 +77,7 @@ void F77_FUNC(cartwgtavgoutfaceflot3d1, CARTWGTAVGOUTFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgoutfaceflot3d2, CARTWGTAVGOUTFACEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d2, CARTWGTAVGOUTFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -97,9 +93,8 @@ namespace geom { // using namespace std; -CartesianOuterfaceFloatWeightedAverage::CartesianOuterfaceFloatWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianOuterfaceFloatWeightedAverage::CartesianOuterfaceFloatWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -114,9 +109,9 @@ CartesianOuterfaceFloatWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianOuterfaceFloatWeightedAverage::getStencilWidth() const +CartesianOuterfaceFloatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -128,40 +123,43 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgoutfaceflot1d, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot1d, CARTWGTAVGOUTFACEFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -171,7 +169,7 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgoutfaceflot2d0, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot2d0, CARTWGTAVGOUTFACEFLOT2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -181,7 +179,7 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfaceflot2d1, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot2d1, CARTWGTAVGOUTFACEFLOT2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -192,7 +190,7 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgoutfaceflot3d0, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d0, CARTWGTAVGOUTFACEFLOT3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -204,7 +202,7 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfaceflot3d1, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d1, CARTWGTAVGOUTFACEFLOT3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -216,7 +214,7 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutfaceflot3d2, + SAMRAI_F77_FUNC(cartwgtavgoutfaceflot3d2, CARTWGTAVGOUTFACEFLOT3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -239,4 +237,3 @@ CartesianOuterfaceFloatWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.h index 56e0bf80..1559d74a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOuterfaceFloatWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerface float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianOuterfaceFloatWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianOuterfaceFloatWeightedAverage( - const tbox::Dimension& dim); + CartesianOuterfaceFloatWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianOuterfaceFloatWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianOuterfaceFloatWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.C index 6052231d..0d36009a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianOutersideDoubleWeightedAverage_C -#define included_geom_CartesianOutersideDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.h" #include @@ -36,14 +32,14 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +49,7 @@ void F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) (const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,7 +59,7 @@ void F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) (const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -72,7 +68,7 @@ void F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -81,7 +77,7 @@ void F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -98,9 +94,8 @@ namespace geom { // using namespace std; CartesianOutersideDoubleWeightedAverage:: -CartesianOutersideDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianOutersideDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -116,9 +111,9 @@ CartesianOutersideDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianOutersideDoubleWeightedAverage::getStencilWidth() const +CartesianOutersideDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -130,41 +125,44 @@ CartesianOutersideDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if ((dim == tbox::Dimension(1))) { - F77_FUNC(cartwgtavgoutsidedoub1d, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -174,7 +172,7 @@ CartesianOutersideDoubleWeightedAverage::coarsen( fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(cartwgtavgoutsidedoub2d0, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -184,7 +182,7 @@ CartesianOutersideDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutsidedoub2d1, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -195,7 +193,7 @@ CartesianOutersideDoubleWeightedAverage::coarsen( fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(cartwgtavgoutsidedoub3d0, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -207,7 +205,7 @@ CartesianOutersideDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutsidedoub3d1, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -219,7 +217,7 @@ CartesianOutersideDoubleWeightedAverage::coarsen( cgeom->getDx(), fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutsidedoub3d2, + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -241,4 +239,3 @@ CartesianOutersideDoubleWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.h index 3282c92b..37edaf54 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianOutersideDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianOutersideDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianOutersideDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianOutersideDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianOutersideDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianOutersideDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.C index f2c079a9..4614815f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple Cartesian grid geometry for an AMR hierarchy. * ************************************************************************/ - -#ifndef included_geom_CartesianPatchGeometry_C -#define included_geom_CartesianPatchGeometry_C - #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/tbox/Utilities.h" @@ -30,21 +26,21 @@ namespace geom { CartesianPatchGeometry::CartesianPatchGeometry( const hier::IntVector& ratio_to_level_zero, const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry, + const hier::BlockId& block_id, const double* dx, const double* x_lo, const double* x_up): hier::PatchGeometry(ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry) + block_id) { - TBOX_ASSERT(!(dx == (double *)NULL)); - TBOX_ASSERT(!(x_lo == (double *)NULL)); - TBOX_ASSERT(!(x_up == (double *)NULL)); + TBOX_ASSERT(dx != 0); + TBOX_ASSERT(x_lo != 0); + TBOX_ASSERT(x_up != 0); const tbox::Dimension& dim(ratio_to_level_zero.getDim()); - for (int id = 0; id < dim.getValue(); id++) { + for (int id = 0; id < dim.getValue(); ++id) { d_dx[id] = dx[id]; d_x_lo[id] = x_lo[id]; d_x_up[id] = x_up[id]; @@ -78,17 +74,17 @@ CartesianPatchGeometry::printClassData( os << "Printing CartesianPatchGeometry data: this = " << (CartesianPatchGeometry *)this << std::endl; os << "x_lo = "; - for (int id1 = 0; id1 < dim.getValue(); id1++) { + for (int id1 = 0; id1 < dim.getValue(); ++id1) { os << d_x_lo[id1] << " "; } os << std::endl; os << "x_up = "; - for (int id2 = 0; id2 < dim.getValue(); id2++) { + for (int id2 = 0; id2 < dim.getValue(); ++id2) { os << d_x_up[id2] << " "; } os << std::endl; os << "dx = "; - for (int id3 = 0; id3 < dim.getValue(); id3++) { + for (int id3 = 0; id3 < dim.getValue(); ++id3) { os << d_dx[id3] << " "; } os << std::endl; @@ -98,4 +94,3 @@ CartesianPatchGeometry::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.h index 17eab23d..abd4fa30 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianPatchGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple Cartesian grid geometry for an AMR hierarchy. * ************************************************************************/ @@ -30,7 +30,7 @@ namespace geom { * * @see hier::BoundaryBox * @see hier::PatchGeometry - * @see geom::CartesianGridGeometry + * @see CartesianGridGeometry */ class CartesianPatchGeometry: @@ -43,11 +43,15 @@ class CartesianPatchGeometry: * Constructor for CartesianPatchGeometry class. It simply passes * patch boundary information to hier::PatchGeometry base class constructor * and allocates storage for spatial coordinates on patch. + * + * @pre dx != 0 + * @pre x_lo != 0 + * @pre x_up != 0 */ CartesianPatchGeometry( const hier::IntVector& ratio_to_level_zero, const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry, + const hier::BlockId& block_id, const double * dx, const double * x_lo, const double * x_hi); @@ -96,13 +100,13 @@ class CartesianPatchGeometry: // These are not implemented. CartesianPatchGeometry( const CartesianPatchGeometry&); - void + CartesianPatchGeometry& operator = ( const CartesianPatchGeometry&); - double d_dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // mesh increments for patch. - double d_x_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // spatial coords of lower end of patch. - double d_x_up[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // spatial coords of upper end of patch. + double d_dx[SAMRAI::MAX_DIM_VAL]; // mesh increments for patch. + double d_x_lo[SAMRAI::MAX_DIM_VAL]; // spatial coords of lower end of patch. + double d_x_up[SAMRAI::MAX_DIM_VAL]; // spatial coords of upper end of patch. }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.C index 8b349b15..7feb5846 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered complex data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianSideComplexWeightedAverage_C -#define included_geom_CartesianSideComplexWeightedAverage_C - #include "SAMRAI/geom/CartesianSideComplexWeightedAverage.h" #include "SAMRAI/tbox/Complex.h" @@ -37,28 +33,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgsidecplx1d, CARTWGTAVGSIDECPLX1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx1d, CARTWGTAVGSIDECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgsidecplx2d0, CARTWGTAVGSIDECPLX2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx2d0, CARTWGTAVGSIDECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgsidecplx2d1, CARTWGTAVGSIDECPLX2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx2d1, CARTWGTAVGSIDECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgsidecplx3d0, CARTWGTAVGSIDECPLX3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx3d0, CARTWGTAVGSIDECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -67,7 +63,7 @@ void F77_FUNC(cartwgtavgsidecplx3d0, CARTWGTAVGSIDECPLX3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgsidecplx3d1, CARTWGTAVGSIDECPLX3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx3d1, CARTWGTAVGSIDECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -76,7 +72,7 @@ void F77_FUNC(cartwgtavgsidecplx3d1, CARTWGTAVGSIDECPLX3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const dcomplex *, dcomplex *); -void F77_FUNC(cartwgtavgsidecplx3d2, CARTWGTAVGSIDECPLX3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidecplx3d2, CARTWGTAVGSIDECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -92,9 +88,8 @@ namespace geom { // using namespace std; -CartesianSideComplexWeightedAverage::CartesianSideComplexWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianSideComplexWeightedAverage::CartesianSideComplexWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -109,9 +104,9 @@ CartesianSideComplexWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianSideComplexWeightedAverage::getStencilWidth() const +CartesianSideComplexWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -123,16 +118,16 @@ CartesianSideComplexWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); @@ -143,25 +138,28 @@ CartesianSideComplexWeightedAverage::coarsen( TBOX_ASSERT(directions == hier::IntVector::min(directions, fdata->getDirectionVector())); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidecplx1d, CARTWGTAVGSIDECPLX1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx1d, CARTWGTAVGSIDECPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -173,7 +171,7 @@ CartesianSideComplexWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(2))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidecplx2d0, CARTWGTAVGSIDECPLX2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx2d0, CARTWGTAVGSIDECPLX2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -184,7 +182,7 @@ CartesianSideComplexWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsidecplx2d1, CARTWGTAVGSIDECPLX2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx2d1, CARTWGTAVGSIDECPLX2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -196,7 +194,7 @@ CartesianSideComplexWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(3))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidecplx3d0, CARTWGTAVGSIDECPLX3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx3d0, CARTWGTAVGSIDECPLX3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -210,7 +208,7 @@ CartesianSideComplexWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsidecplx3d1, CARTWGTAVGSIDECPLX3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx3d1, CARTWGTAVGSIDECPLX3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -224,7 +222,7 @@ CartesianSideComplexWeightedAverage::coarsen( cdata->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(cartwgtavgsidecplx3d2, CARTWGTAVGSIDECPLX3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidecplx3d2, CARTWGTAVGSIDECPLX3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -247,4 +245,3 @@ CartesianSideComplexWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.h index 0542e6e3..cafb0580 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideComplexWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered complex data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianSideComplexWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianSideComplexWeightedAverage( - const tbox::Dimension& dim); + CartesianSideComplexWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianSideComplexWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianSideComplexWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.C index 8be9d132..b67eb930 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.C @@ -3,21 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for side-centered * double data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianSideDoubleConservativeLinearRefine_C -#define included_geom_CartesianSideDoubleConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/SideData.h" #include "SAMRAI/pdat/SideVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include @@ -38,7 +33,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefsidedoub1d, CARTCLINREFSIDEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub1d, CARTCLINREFSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -47,7 +42,7 @@ void F77_FUNC(cartclinrefsidedoub1d, CARTCLINREFSIDEDOUB1D) (const int&, const double *, double *, double *, double *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefsidedoub2d0, CARTCLINREFSIDEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub2d0, CARTCLINREFSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +50,7 @@ void F77_FUNC(cartclinrefsidedoub2d0, CARTCLINREFSIDEDOUB2D0) (const int&, const int *, const double *, const double *, const double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefsidedoub2d1, CARTCLINREFSIDEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub2d1, CARTCLINREFSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +59,7 @@ void F77_FUNC(cartclinrefsidedoub2d1, CARTCLINREFSIDEDOUB2D1) (const int&, const double *, double *, double *, double *, double *, double *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefsidedoub3d0, CARTCLINREFSIDEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub3d0, CARTCLINREFSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +72,7 @@ void F77_FUNC(cartclinrefsidedoub3d0, CARTCLINREFSIDEDOUB3D0) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefsidedoub3d1, CARTCLINREFSIDEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub3d1, CARTCLINREFSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -90,7 +85,7 @@ void F77_FUNC(cartclinrefsidedoub3d1, CARTCLINREFSIDEDOUB3D1) (const int&, const double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(cartclinrefsidedoub3d2, CARTCLINREFSIDEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsidedoub3d2, CARTCLINREFSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -109,9 +104,8 @@ namespace SAMRAI { namespace geom { CartesianSideDoubleConservativeLinearRefine:: -CartesianSideDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianSideDoubleConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -127,9 +121,9 @@ CartesianSideDoubleConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianSideDoubleConservativeLinearRefine::getStencilWidth() const +CartesianSideDoubleConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -141,20 +135,20 @@ CartesianSideDoubleConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -167,44 +161,47 @@ CartesianSideDoubleConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); + + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::SideData slope0(cgbox, 1, tmp_ghosts, directions); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { if (directions(axis)) { - F77_FUNC(cartclinrefsidedoub1d, CARTCLINREFSIDEDOUB1D) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub1d, CARTCLINREFSIDEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -214,15 +211,15 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::SideData slope1(cgbox, 1, tmp_ghosts, directions); if (axis == 0 && directions(0)) { - F77_FUNC(cartclinrefsidedoub2d0, CARTCLINREFSIDEDOUB2D0) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub2d0, CARTCLINREFSIDEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -232,11 +229,11 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } if (axis == 1 && directions(1)) { - F77_FUNC(cartclinrefsidedoub2d1, CARTCLINREFSIDEDOUB2D1) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub2d1, CARTCLINREFSIDEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -246,20 +243,20 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::SideData slope1(cgbox, 1, tmp_ghosts, directions); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::SideData slope2(cgbox, 1, tmp_ghosts, directions); if (axis == 0 && directions(0)) { - F77_FUNC(cartclinrefsidedoub3d0, CARTCLINREFSIDEDOUB3D0) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub3d0, CARTCLINREFSIDEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -273,12 +270,12 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } if (axis == 1 && directions(1)) { - F77_FUNC(cartclinrefsidedoub3d1, CARTCLINREFSIDEDOUB3D1) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub3d1, CARTCLINREFSIDEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -292,12 +289,12 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } if (axis == 2 && directions(2)) { - F77_FUNC(cartclinrefsidedoub3d2, CARTCLINREFSIDEDOUB3D2) ( + SAMRAI_F77_FUNC(cartclinrefsidedoub3d2, CARTCLINREFSIDEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -311,9 +308,9 @@ CartesianSideDoubleConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -327,4 +324,3 @@ CartesianSideDoubleConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.h index 14add4fc..d89f1e34 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for side-centered * double data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianSideDoubleConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianSideDoubleConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianSideDoubleConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianSideDoubleConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianSideDoubleConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.C index b33a4b47..6171886c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered double data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianSideDoubleWeightedAverage_C -#define included_geom_CartesianSideDoubleWeightedAverage_C - #include "SAMRAI/geom/CartesianSideDoubleWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgsidedoub1d, CARTWGTAVGSIDEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub1d, CARTWGTAVGSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgsidedoub2d0, CARTWGTAVGSIDEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub2d0, CARTWGTAVGSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgsidedoub2d1, CARTWGTAVGSIDEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub2d1, CARTWGTAVGSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgsidedoub3d0, CARTWGTAVGSIDEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub3d0, CARTWGTAVGSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgsidedoub3d0, CARTWGTAVGSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgsidedoub3d1, CARTWGTAVGSIDEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub3d1, CARTWGTAVGSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgsidedoub3d1, CARTWGTAVGSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgsidedoub3d2, CARTWGTAVGSIDEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsidedoub3d2, CARTWGTAVGSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -91,9 +87,8 @@ namespace geom { // using namespace std; -CartesianSideDoubleWeightedAverage::CartesianSideDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianSideDoubleWeightedAverage::CartesianSideDoubleWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +103,9 @@ CartesianSideDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianSideDoubleWeightedAverage::getStencilWidth() const +CartesianSideDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,16 +117,16 @@ CartesianSideDoubleWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); @@ -142,25 +137,28 @@ CartesianSideDoubleWeightedAverage::coarsen( TBOX_ASSERT(directions == hier::IntVector::min(directions, fdata->getDirectionVector())); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidedoub1d, CARTWGTAVGSIDEDOUB1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub1d, CARTWGTAVGSIDEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -172,7 +170,7 @@ CartesianSideDoubleWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(2))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidedoub2d0, CARTWGTAVGSIDEDOUB2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub2d0, CARTWGTAVGSIDEDOUB2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,7 +181,7 @@ CartesianSideDoubleWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsidedoub2d1, CARTWGTAVGSIDEDOUB2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub2d1, CARTWGTAVGSIDEDOUB2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -195,7 +193,7 @@ CartesianSideDoubleWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(3))) { if (directions(0)) { - F77_FUNC(cartwgtavgsidedoub3d0, CARTWGTAVGSIDEDOUB3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub3d0, CARTWGTAVGSIDEDOUB3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -209,7 +207,7 @@ CartesianSideDoubleWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsidedoub3d1, CARTWGTAVGSIDEDOUB3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub3d1, CARTWGTAVGSIDEDOUB3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -223,7 +221,7 @@ CartesianSideDoubleWeightedAverage::coarsen( cdata->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(cartwgtavgsidedoub3d2, CARTWGTAVGSIDEDOUB3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsidedoub3d2, CARTWGTAVGSIDEDOUB3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -245,4 +243,3 @@ CartesianSideDoubleWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.h index 3f754321..69c9f6df 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered double data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianSideDoubleWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianSideDoubleWeightedAverage( - const tbox::Dimension& dim); + CartesianSideDoubleWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianSideDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianSideDoubleWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.C index dd012549..3661a0f9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.C @@ -3,22 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for side-centered * float data on a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianSideFloatConservativeLinearRefine_C -#define included_geom_CartesianSideFloatConservativeLinearRefine_C - #include "SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/pdat/SideData.h" #include "SAMRAI/pdat/SideVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" /* @@ -36,7 +31,7 @@ extern "C" { #endif // in cartrefine1d.f: -void F77_FUNC(cartclinrefsideflot1d, CARTCLINREFSIDEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot1d, CARTCLINREFSIDEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +40,7 @@ void F77_FUNC(cartclinrefsideflot1d, CARTCLINREFSIDEFLOT1D) (const int&, const float *, float *, float *, float *); // in cartrefine2d.f: -void F77_FUNC(cartclinrefsideflot2d0, CARTCLINREFSIDEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot2d0, CARTCLINREFSIDEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -53,7 +48,7 @@ void F77_FUNC(cartclinrefsideflot2d0, CARTCLINREFSIDEFLOT2D0) (const int&, const int *, const double *, const double *, const float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefsideflot2d1, CARTCLINREFSIDEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot2d1, CARTCLINREFSIDEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -62,7 +57,7 @@ void F77_FUNC(cartclinrefsideflot2d1, CARTCLINREFSIDEFLOT2D1) (const int&, const float *, float *, float *, float *, float *, float *); // in cartrefine3d.f: -void F77_FUNC(cartclinrefsideflot3d0, CARTCLINREFSIDEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot3d0, CARTCLINREFSIDEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +70,7 @@ void F77_FUNC(cartclinrefsideflot3d0, CARTCLINREFSIDEFLOT3D0) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefsideflot3d1, CARTCLINREFSIDEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot3d1, CARTCLINREFSIDEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -88,7 +83,7 @@ void F77_FUNC(cartclinrefsideflot3d1, CARTCLINREFSIDEFLOT3D1) (const int&, const float *, float *, float *, float *, float *, float *, float *, float *); -void F77_FUNC(cartclinrefsideflot3d2, CARTCLINREFSIDEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartclinrefsideflot3d2, CARTCLINREFSIDEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -109,9 +104,8 @@ namespace geom { // using namespace std; CartesianSideFloatConservativeLinearRefine:: -CartesianSideFloatConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSERVATIVE_LINEAR_REFINE") +CartesianSideFloatConservativeLinearRefine(): + hier::RefineOperator("CONSERVATIVE_LINEAR_REFINE") { } @@ -127,9 +121,9 @@ CartesianSideFloatConservativeLinearRefine::getOperatorPriority() const } hier::IntVector -CartesianSideFloatConservativeLinearRefine::getStencilWidth() const +CartesianSideFloatConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(getDim()); + return hier::IntVector::getOne(dim); } void @@ -141,20 +135,20 @@ CartesianSideFloatConservativeLinearRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, fine, coarse, ratio); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, coarse, ratio); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const pdat::SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); @@ -167,44 +161,47 @@ CartesianSideFloatConservativeLinearRefine::refine( const hier::Box cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); - for (int axis = 0; axis < dim.getValue(); axis++) { + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); + + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); const hier::IntVector tmp_ghosts(dim, 0); - tbox::Array diff0(cgbox.numberCells(0) + 2); + std::vector diff0(cgbox.numberCells(0) + 2); pdat::SideData slope0(cgbox, 1, tmp_ghosts, directions); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { if (directions(axis)) { - F77_FUNC(cartclinrefsideflot1d, CARTCLINREFSIDEFLOT1D) ( + SAMRAI_F77_FUNC(cartclinrefsideflot1d, CARTCLINREFSIDEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -214,15 +211,15 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0)); + &diff0[0], slope0.getPointer(0)); } } else if ((dim == tbox::Dimension(2))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::SideData slope1(cgbox, 1, tmp_ghosts, directions); if (axis == 0 && directions(0)) { - F77_FUNC(cartclinrefsideflot2d0, CARTCLINREFSIDEFLOT2D0) ( + SAMRAI_F77_FUNC(cartclinrefsideflot2d0, CARTCLINREFSIDEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -232,11 +229,11 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0)); } if (axis == 1 && directions(1)) { - F77_FUNC(cartclinrefsideflot2d1, CARTCLINREFSIDEFLOT2D1) ( + SAMRAI_F77_FUNC(cartclinrefsideflot2d1, CARTCLINREFSIDEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -246,20 +243,20 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff0[0], slope0.getPointer(1)); } } else if ((dim == tbox::Dimension(3))) { - tbox::Array diff1(cgbox.numberCells(1) + 2); + std::vector diff1(cgbox.numberCells(1) + 2); pdat::SideData slope1(cgbox, 1, tmp_ghosts, directions); - tbox::Array diff2(cgbox.numberCells(2) + 2); + std::vector diff2(cgbox.numberCells(2) + 2); pdat::SideData slope2(cgbox, 1, tmp_ghosts, directions); if (axis == 0 && directions(0)) { - F77_FUNC(cartclinrefsideflot3d0, CARTCLINREFSIDEFLOT3D0) ( + SAMRAI_F77_FUNC(cartclinrefsideflot3d0, CARTCLINREFSIDEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -273,12 +270,12 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(0, d), fdata->getPointer(0, d), - diff0.getPointer(), slope0.getPointer(0), - diff1.getPointer(), slope1.getPointer(0), - diff2.getPointer(), slope2.getPointer(0)); + &diff0[0], slope0.getPointer(0), + &diff1[0], slope1.getPointer(0), + &diff2[0], slope2.getPointer(0)); } if (axis == 1 && directions(1)) { - F77_FUNC(cartclinrefsideflot3d1, CARTCLINREFSIDEFLOT3D1) ( + SAMRAI_F77_FUNC(cartclinrefsideflot3d1, CARTCLINREFSIDEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -292,12 +289,12 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(1, d), fdata->getPointer(1, d), - diff1.getPointer(), slope1.getPointer(1), - diff2.getPointer(), slope2.getPointer(1), - diff0.getPointer(), slope0.getPointer(1)); + &diff1[0], slope1.getPointer(1), + &diff2[0], slope2.getPointer(1), + &diff0[0], slope0.getPointer(1)); } if (axis == 2 && directions(2)) { - F77_FUNC(cartclinrefsideflot3d2, CARTCLINREFSIDEFLOT3D2) ( + SAMRAI_F77_FUNC(cartclinrefsideflot3d2, CARTCLINREFSIDEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -311,9 +308,9 @@ CartesianSideFloatConservativeLinearRefine::refine( fgeom->getDx(), cdata->getPointer(2, d), fdata->getPointer(2, d), - diff2.getPointer(), slope2.getPointer(2), - diff0.getPointer(), slope0.getPointer(2), - diff1.getPointer(), slope1.getPointer(2)); + &diff2[0], slope2.getPointer(2), + &diff0[0], slope0.getPointer(2), + &diff1[0], slope1.getPointer(2)); } } else { TBOX_ERROR( @@ -327,4 +324,3 @@ CartesianSideFloatConservativeLinearRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.h index 86832db9..b6e307f7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatConservativeLinearRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Conservative linear refine operator for side-centered * float data on a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class CartesianSideFloatConservativeLinearRefine: /** * Uninteresting default constructor. */ - explicit CartesianSideFloatConservativeLinearRefine( - const tbox::Dimension& dim); + CartesianSideFloatConservativeLinearRefine(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class CartesianSideFloatConservativeLinearRefine: * the vector of ones. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -71,6 +71,15 @@ class CartesianSideFloatConservativeLinearRefine: * intersection of the destination patch and the boxes contained in * fine_overlap. It is assumed that the coarse patch contains sufficient * data for the stencil width of the refinement operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre dynamic_cast(&fine_overlap) != 0 + * @pre coarse.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(src_component)->getDepth() == fine.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.C index 30366f0b..2ad28050 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered float data on * a Cartesian mesh. * ************************************************************************/ - -#ifndef included_geom_CartesianSideFloatWeightedAverage_C -#define included_geom_CartesianSideFloatWeightedAverage_C - #include "SAMRAI/geom/CartesianSideFloatWeightedAverage.h" #include @@ -36,28 +32,28 @@ extern "C" { #endif // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgsideflot1d, CARTWGTAVGSIDEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot1d, CARTWGTAVGSIDEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgsideflot2d0, CARTWGTAVGSIDEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot2d0, CARTWGTAVGSIDEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgsideflot2d1, CARTWGTAVGSIDEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot2d1, CARTWGTAVGSIDEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (const int&, const int&, const int&, const int&, const int *, const double *, const double *, const float *, float *); -void F77_FUNC(cartwgtavgsideflot3d2, CARTWGTAVGSIDEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(cartwgtavgsideflot3d2, CARTWGTAVGSIDEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -91,9 +87,8 @@ namespace geom { // using namespace std; -CartesianSideFloatWeightedAverage::CartesianSideFloatWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSERVATIVE_COARSEN") +CartesianSideFloatWeightedAverage::CartesianSideFloatWeightedAverage(): + hier::CoarsenOperator("CONSERVATIVE_COARSEN") { } @@ -108,9 +103,9 @@ CartesianSideFloatWeightedAverage::getOperatorPriority() const } hier::IntVector -CartesianSideFloatWeightedAverage::getStencilWidth() const +CartesianSideFloatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -122,16 +117,16 @@ CartesianSideFloatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, coarse, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); @@ -139,25 +134,28 @@ CartesianSideFloatWeightedAverage::coarsen( TBOX_ASSERT(directions == hier::IntVector::min(directions, fdata->getDirectionVector())); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); - for (int d = 0; d < cdata->getDepth(); d++) { + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int d = 0; d < cdata->getDepth(); ++d) { if ((dim == tbox::Dimension(1))) { if (directions(0)) { - F77_FUNC(cartwgtavgsideflot1d, CARTWGTAVGSIDEFLOT1D) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot1d, CARTWGTAVGSIDEFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -169,7 +167,7 @@ CartesianSideFloatWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(2))) { if (directions(0)) { - F77_FUNC(cartwgtavgsideflot2d0, CARTWGTAVGSIDEFLOT2D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot2d0, CARTWGTAVGSIDEFLOT2D0) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -180,7 +178,7 @@ CartesianSideFloatWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsideflot2d1, CARTWGTAVGSIDEFLOT2D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot2d1, CARTWGTAVGSIDEFLOT2D1) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -192,7 +190,7 @@ CartesianSideFloatWeightedAverage::coarsen( } } else if ((dim == tbox::Dimension(3))) { if (directions(0)) { - F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot3d0, CARTWGTAVGSIDEFLOT3D0) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -206,7 +204,7 @@ CartesianSideFloatWeightedAverage::coarsen( cdata->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot3d1, CARTWGTAVGSIDEFLOT3D1) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -220,7 +218,7 @@ CartesianSideFloatWeightedAverage::coarsen( cdata->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(cartwgtavgsideflot3d2, CARTWGTAVGSIDEFLOT3D2) (ifirstc(0), + SAMRAI_F77_FUNC(cartwgtavgsideflot3d2, CARTWGTAVGSIDEFLOT3D2) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -242,4 +240,3 @@ CartesianSideFloatWeightedAverage::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.h index a9eca209..d7ea539a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/CartesianSideFloatWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for side-centered float data on * a Cartesian mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CartesianSideFloatWeightedAverage: /** * Uninteresting default constructor. */ - explicit CartesianSideFloatWeightedAverage( - const tbox::Dimension& dim); + CartesianSideFloatWeightedAverage(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CartesianSideFloatWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -70,6 +70,15 @@ class CartesianSideFloatWeightedAverage: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == coarse_box.getDim()) && + * (fine.getDim() == ratio.getDim()) + * @pre fine.getPatchData(src_component) is actually a boost::shared_ptr > + * @pre coarse.getPatchData(dst_component) is actually a boost::shared_ptr > + * @pre fine.getPatchData(src_component)->getDepth() == coarse.getPatchData(dst_component)->getDepth() + * @pre (fine.getDim().getValue() == 1) || + * (fine.getDim().getValue() == 2) || (fine.getDim().getValue() == 3) */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.C index de0aa520..413bfc32 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management in AMR hierarchy * ************************************************************************/ - -#ifndef included_geom_GridGeometry_C -#define included_geom_GridGeometry_C - #include "SAMRAI/geom/GridGeometry.h" #include "SAMRAI/pdat/NodeComplexInjection.h" #include "SAMRAI/pdat/NodeDoubleInjection.h" #include "SAMRAI/pdat/NodeFloatInjection.h" #include "SAMRAI/pdat/NodeIntegerInjection.h" -#include "SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h" +#include "SAMRAI/pdat/OuternodeDoubleInjection.h" #include "SAMRAI/pdat/CellComplexConstantRefine.h" #include "SAMRAI/pdat/CellDoubleConstantRefine.h" #include "SAMRAI/pdat/CellFloatConstantRefine.h" @@ -70,7 +66,7 @@ #include #include -#include +#include "boost/make_shared.hpp" #define GEOM_BLOCK_GRID_GEOMETRY_VERSION (1) @@ -98,9 +94,10 @@ GridGeometry::GridGeometry( const tbox::Dimension& dim, const std::string& object_name, const boost::shared_ptr& input_db, - bool register_for_restart): - hier::BaseGridGeometry(dim, object_name, input_db, register_for_restart) + bool allow_multiblock): + hier::BaseGridGeometry(dim, object_name, input_db, allow_multiblock) { + buildOperators(); } /* @@ -114,34 +111,19 @@ GridGeometry::GridGeometry( */ GridGeometry::GridGeometry( const std::string& object_name, - const hier::BoxContainer& domain, - bool register_for_restart): - hier::BaseGridGeometry(object_name, domain, register_for_restart) + hier::BoxContainer& domain): + hier::BaseGridGeometry(object_name, domain) { + buildOperators(); } GridGeometry::GridGeometry( - const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& op_reg) : - hier::BaseGridGeometry(dim, object_name, op_reg) -{ -} - -GridGeometry::GridGeometry( - const tbox::Dimension& dim, - const std::string& object_name) : - hier::BaseGridGeometry(dim, object_name) -{ -} - -GridGeometry::GridGeometry( - const std::string& object_name, - const hier::BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart): - hier::BaseGridGeometry(object_name, domain, op_reg, register_for_restart) + hier::BoxContainer& domain, + const boost::shared_ptr& op_reg): + hier::BaseGridGeometry(object_name, domain, op_reg) { + buildOperators(); } /* @@ -168,14 +150,13 @@ GridGeometry::~GridGeometry() boost::shared_ptr GridGeometry::makeCoarsenedGridGeometry( const std::string& coarse_geom_name, - const hier::IntVector& coarsen_ratio, - bool register_for_restart) const + const hier::IntVector& coarsen_ratio) const { const tbox::Dimension& dim(getDim()); TBOX_ASSERT(!coarse_geom_name.empty()); TBOX_ASSERT(coarse_geom_name != getObjectName()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, coarsen_ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, coarsen_ratio); TBOX_ASSERT(coarsen_ratio > hier::IntVector::getZero(dim)); hier::BoxContainer coarse_domain; @@ -188,10 +169,12 @@ GridGeometry::makeCoarsenedGridGeometry( */ const hier::BoxContainer& fine_domain = getPhysicalDomain(); const int nboxes = fine_domain.size(); - hier::BoxContainer::const_iterator coarse_domain_itr(coarse_domain); - hier::BoxContainer::const_iterator fine_domain_itr(fine_domain); - for (int ib = 0; ib < nboxes; ib++, ++coarse_domain_itr, ++fine_domain_itr) { - hier::Box testbox = hier::Box::refine(*coarse_domain_itr, coarsen_ratio); + hier::BoxContainer::const_iterator coarse_domain_itr = coarse_domain.begin(); + hier::BoxContainer::const_iterator fine_domain_itr = fine_domain.begin(); + for (int ib = 0; ib < nboxes; ++ib, ++coarse_domain_itr, ++fine_domain_itr) { + hier::Box testbox = + hier::Box::refine(*coarse_domain_itr, + coarsen_ratio); if (!testbox.isSpatiallyEqual(*fine_domain_itr)) { #ifdef DEBUG_CHECK_ASSERTIONS tbox::plog @@ -210,14 +193,13 @@ GridGeometry::makeCoarsenedGridGeometry( } boost::shared_ptr coarse_geometry( - boost::make_shared( + new GridGeometry( coarse_geom_name, coarse_domain, - d_transfer_operator_registry, - register_for_restart)); + d_transfer_operator_registry)); coarse_geometry->initializePeriodicShift(getPeriodicShift( - hier::IntVector::getOne(dim))); + hier::IntVector::getOne(dim))); return coarse_geometry; } @@ -234,28 +216,26 @@ GridGeometry::makeCoarsenedGridGeometry( boost::shared_ptr GridGeometry::makeRefinedGridGeometry( const std::string& fine_geom_name, - const hier::IntVector& refine_ratio, - bool register_for_restart) const + const hier::IntVector& refine_ratio) const { const tbox::Dimension& dim(getDim()); TBOX_ASSERT(!fine_geom_name.empty()); TBOX_ASSERT(fine_geom_name != getObjectName()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, refine_ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, refine_ratio); TBOX_ASSERT(refine_ratio > hier::IntVector::getZero(dim)); hier::BoxContainer fine_domain(getPhysicalDomain()); fine_domain.refine(refine_ratio); boost::shared_ptr fine_geometry( - boost::make_shared( + new GridGeometry( fine_geom_name, fine_domain, - d_transfer_operator_registry, - register_for_restart)); + d_transfer_operator_registry)); fine_geometry->initializePeriodicShift(getPeriodicShift( - hier::IntVector::getOne(dim))); + hier::IntVector::getOne(dim))); return fine_geometry; } @@ -266,81 +246,81 @@ GridGeometry::buildOperators() // Coarsening Operators addCoarsenOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::NodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addCoarsenOperator( typeid(pdat::OuternodeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); // Refinement Operators addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::CellVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::EdgeVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::FaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::OuterfaceVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); addRefineOperator( typeid(pdat::SideVariable).name(), - boost::make_shared(d_dim)); + boost::make_shared()); // Time Interpolation Operators addTimeInterpolateOperator( @@ -418,5 +398,3 @@ GridGeometry::buildOperators() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.h index 0b97f488..fb974ab7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/GridGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management in AMR hierarchy * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/tbox/Dimension.h" #include -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace geom { @@ -34,14 +34,106 @@ namespace geom { * problems and other problems where the physical locations of mesh * coordinates are managed by user code. * + * Input Parameters + * + * Definitions: + * - @b num_blocks + * specifies the number of blocks in the mesh configuration. + * + * - @b domain_boxes_ + * For each block, an array of boxes representing the index space for the + * entire domain within a block on the coarsest mesh level; i.e., level + * zero. The key must have an integer value as a suffix + * (domain_boxes_0, domain_boxes_1, etc.), and there must be an entry + * for every block from 0 to num_blocks-1. + * + * - @b periodic_dimension + * An array of integer values (expected number of values is equal to + * the spatial dimension of the mesh) representing the directions in + * which the physical domain is periodic. A non-zero value indicates + * that the direction is periodic. A zero value indicates that the + * direction is not periodic. This key should only be used when the + * number of blocks is 1 (a single block mesh), as periodic boundaries + * are not supported for multiblock meshes. + * + * - @b Singularity + * When there is a reduced or enhanced connectivity singularity, this key + * must be used to identify which blocks touch the singularity and the + * position of the singularity in relation to each block's index space. + * The key for this entry must include a unique trailing integer, and the + * integers for the full set of Singularity keys must be a continuous + * sequence beginning with 0. + * + * - @b BlockNeighbors + * For multiblock grids, a BlockNeighbors entry must be given for every + * pair of blocks that touch each other in any way. Like Singularity, + * each entry must have a trailing integer beginning with 0. + * + * No values read in from a restart database may be overridden by input + * database values. + * + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    num_blocksint1>=1optMay not be modified by input db on restart
    domain_boxes_Narray of DatabaseBoxesnoneall Boxes must be non-emptyreqMay not be modified by input db on restart
    periodic_dimensionint[]all values 0any intoptMay not be modified by input db on restart
    Singularitysee Multiblock.pdf for subentriesnonesee Multiblock.pdf for subentriesoptMay not be modified by input db on restart
    BlockNeighborssee Multiblock.pdf for subentriesnonesee Multiblock.pdf for subentriesoptMay not be modified by input db on restart
    + * + * A description of the input format for Singularity* and BlockNeighbors* + * is included in the Multiblock.pdf document in the docs/userdocs + * directory of the SAMRAI distribution. + * * @see hier::BaseGridGeometry */ class GridGeometry: public hier::BaseGridGeometry { - friend class TransferOperatorRegistry; - public: /*! * @brief Construct a new GridGeometry object and initialize from @@ -49,52 +141,37 @@ class GridGeometry: * * This constructor for GridGeometry initializes data members * based on parameters read from the specified input database. - * The constructor also registers this object for restart using - * the specified object name, when the boolean argument is true. - * Whether the object will write its state to restart files during - * program execution is determined by this argument. * * This constructor is intended for use when directly constructing a * GridGeometry without using a derived child class. The object will * contain all index space grid information for a mesh, but nothing about * the physical coordinates of the mesh. * - * @note - * @b Errors: passing in a null database pointer or an empty string - * will result in an unrecoverable assertion. - * * @param[in] dim * @param[in] object_name * @param[in] input_db - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. @b Default: true + * @param[in] allow_multiblock set to false if called by inherently single + * block derived class such as CartesianGridGeometry */ GridGeometry( const tbox::Dimension& dim, const std::string& object_name, const boost::shared_ptr& input_db, - bool register_for_restart = true); + bool allow_multiblock = true); /*! * @brief Construct a new GridGeometry object based on arguments. * * This constructor creates a new GridGeometry object based on the - * arguments, rather than relying on input or restart data. The - * constructor also registers this object for restart using - * the specified object name, when the boolean argument is true. - * Whether the object will write its state to restart files during - * program execution is determined by this argument. + * arguments, rather than relying on input or restart data. * * @param[in] object_name * @param[in] domain Each element of the array describes the index * space for a block. - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. @b Default: true */ GridGeometry( const std::string& object_name, - const hier::BoxContainer& domain, - bool register_for_restart = true); + hier::BoxContainer& domain); /*! * @brief Construct a new coarsened/refined GridGeometry object with the @@ -109,14 +186,11 @@ class GridGeometry: * @param[in] domain The coarsened/refined domain. * @param[in] op_reg The same operator registry as the * uncoarsened/unrefined grid geometry. - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. */ GridGeometry( const std::string& object_name, - const hier::BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart); + hier::BoxContainer& domain, + const boost::shared_ptr& op_reg); /*! * @brief Virtual destructor @@ -132,16 +206,18 @@ class GridGeometry: * * @param[in] fine_geom_name std::string name of the geometry object * @param[in] refine_ratio the refinement ratio. - * @param[in] register_for_restart Flag to indicate whether to register - * for restart. * * @return The pointer to the grid geometry object. + * + * @pre !fine_geom_name.empty() + * @pre fine_geom_name != getObjectName() + * @pre getDim() == refine_ratio.getDim() + * @pre refine_ratio > hier::IntVector::getZero(getDim()) */ virtual boost::shared_ptr makeRefinedGridGeometry( const std::string& fine_geom_name, - const hier::IntVector& refine_ratio, - bool register_for_restart) const; + const hier::IntVector& refine_ratio) const; /*! * @brief Create a pointer to a coarsened version of this grid geometry @@ -152,42 +228,20 @@ class GridGeometry: * * @param[in] coarse_geom_name std::string name of the geometry object * @param[in] coarsen_ratio the coasening ratio - * @param[in] register_for_restart Flag to indicate whether to register - * for restart. * * @return The pointer to a coarsened version of this grid geometry object. + * + * @pre !coarse_geom_name.empty() + * @pre coarse_geom_name != getObjectName() + * @pre getDim() == coarsen_ratio.getDim() + * @pre coarsen_ratio > hier::IntVector::getZero(getDim()) */ virtual boost::shared_ptr makeCoarsenedGridGeometry( const std::string& coarse_geom_name, - const hier::IntVector& coarsen_ratio, - bool register_for_restart) const; + const hier::IntVector& coarsen_ratio) const; protected: - /*! - * @brief To be called from derived class constructor when constructing - * coarsened/refined grid geometry. - * - * @param [in] dim - * @param [in] object_name - * @param [in] op_reg - */ - GridGeometry( - const tbox::Dimension& dim, - const std::string& object_name, - const boost::shared_ptr& op_reg); - - /*! - * @brief To be called from derived class constructors except when - * constructing coarsened/refined grid geometry. - * - * @param [in] dim - * @param [in] object_name - */ - GridGeometry( - const tbox::Dimension& dim, - const std::string& object_name); - /*! * @brief Build operators appropriate for a GridGeometry. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.depend index b7aed9b1..7fa6599e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -37,6 +37,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -54,7 +55,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -65,15 +65,16 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellComplexConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -82,11 +83,10 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=CartesianCellComplexLinearRefine.o DEPENDS_1:=\ @@ -114,6 +114,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -131,7 +132,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -142,15 +142,16 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellComplexLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -159,11 +160,10 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=CartesianCellComplexWeightedAverage.o DEPENDS_2:=\ @@ -192,6 +192,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -208,7 +209,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -219,15 +219,16 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellComplexWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -236,11 +237,10 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=CartesianCellDoubleConservativeLinearRefine.o DEPENDS_3:=\ @@ -268,6 +268,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -285,7 +286,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -296,15 +296,16 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellDoubleConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -313,11 +314,10 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=CartesianCellDoubleLinearRefine.o DEPENDS_4:=\ @@ -345,6 +345,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -362,7 +363,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -373,15 +373,16 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellDoubleLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -390,11 +391,10 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=CartesianCellDoubleWeightedAverage.o DEPENDS_5:=\ @@ -423,6 +423,7 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -439,7 +440,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -450,15 +450,16 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -467,11 +468,10 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=CartesianCellFloatConservativeLinearRefine.o DEPENDS_6:=\ @@ -499,6 +499,7 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -516,7 +517,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -527,15 +527,16 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellFloatConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -544,11 +545,10 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=CartesianCellFloatLinearRefine.o DEPENDS_7:=\ @@ -576,6 +576,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -593,7 +594,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -604,15 +604,16 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellFloatLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -621,11 +622,10 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=CartesianCellFloatWeightedAverage.o DEPENDS_8:=\ @@ -654,6 +654,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -670,7 +671,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -681,15 +681,16 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianCellFloatWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -698,11 +699,10 @@ DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_8}: ${DEPENDS_8} FILE_9=CartesianEdgeComplexWeightedAverage.o DEPENDS_9:=\ @@ -731,6 +731,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -750,7 +751,6 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -761,15 +761,14 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianEdgeComplexWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -780,11 +779,10 @@ DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} + +${FILE_9}: ${DEPENDS_9} FILE_10=CartesianEdgeDoubleConservativeLinearRefine.o DEPENDS_10:=\ @@ -812,6 +810,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -832,7 +831,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -843,15 +841,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianEdgeDoubleConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -862,11 +859,10 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} + +${FILE_10}: ${DEPENDS_10} FILE_11=CartesianEdgeDoubleWeightedAverage.o DEPENDS_11:=\ @@ -895,6 +891,7 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -914,7 +911,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -925,15 +921,14 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianEdgeDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -944,11 +939,10 @@ DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} + +${FILE_11}: ${DEPENDS_11} FILE_12=CartesianEdgeFloatConservativeLinearRefine.o DEPENDS_12:=\ @@ -976,6 +970,7 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -996,7 +991,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1007,15 +1001,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianEdgeFloatConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1026,11 +1019,10 @@ DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} + +${FILE_12}: ${DEPENDS_12} FILE_13=CartesianEdgeFloatWeightedAverage.o DEPENDS_13:=\ @@ -1059,6 +1051,7 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1078,7 +1071,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1089,15 +1081,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianEdgeFloatWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1108,11 +1099,10 @@ DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_13}: ${DEPENDS_13} FILE_14=CartesianFaceComplexWeightedAverage.o DEPENDS_14:=\ @@ -1141,6 +1131,7 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1160,7 +1151,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1171,15 +1161,14 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianFaceComplexWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1190,11 +1179,10 @@ DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_14}: ${DEPENDS_14} FILE_15=CartesianFaceDoubleConservativeLinearRefine.o DEPENDS_15:=\ @@ -1222,6 +1210,7 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1242,7 +1231,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1253,15 +1241,14 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianFaceDoubleConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1272,11 +1259,10 @@ DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} + +${FILE_15}: ${DEPENDS_15} FILE_16=CartesianFaceDoubleWeightedAverage.o DEPENDS_16:=\ @@ -1305,6 +1291,7 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1324,7 +1311,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1335,15 +1321,14 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianFaceDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1354,11 +1339,10 @@ DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} + +${FILE_16}: ${DEPENDS_16} FILE_17=CartesianFaceFloatConservativeLinearRefine.o DEPENDS_17:=\ @@ -1386,6 +1370,7 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1406,7 +1391,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1417,15 +1401,14 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianFaceFloatConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1436,11 +1419,10 @@ DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} + +${FILE_17}: ${DEPENDS_17} FILE_18=CartesianFaceFloatWeightedAverage.o DEPENDS_18:=\ @@ -1469,6 +1451,7 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1488,7 +1471,6 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1499,15 +1481,14 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianFaceFloatWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1518,11 +1499,10 @@ DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} + +${FILE_18}: ${DEPENDS_18} FILE_19=CartesianGridGeometry.o DEPENDS_19:=\ @@ -1590,6 +1570,7 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1653,7 +1634,6 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1666,8 +1646,8 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -1677,7 +1657,6 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CartesianGridGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1708,11 +1687,10 @@ DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} + +${FILE_19}: ${DEPENDS_19} FILE_20=CartesianNodeComplexLinearRefine.o DEPENDS_20:=\ @@ -1740,6 +1718,7 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1760,7 +1739,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1771,15 +1749,14 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianNodeComplexLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1790,11 +1767,10 @@ DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} + +${FILE_20}: ${DEPENDS_20} FILE_21=CartesianNodeDoubleLinearRefine.o DEPENDS_21:=\ @@ -1822,6 +1798,7 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1842,7 +1819,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1853,15 +1829,14 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianNodeDoubleLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1872,11 +1847,10 @@ DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} + +${FILE_21}: ${DEPENDS_21} FILE_22=CartesianNodeFloatLinearRefine.o DEPENDS_22:=\ @@ -1904,6 +1878,7 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1924,7 +1899,6 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1935,15 +1909,14 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianNodeFloatLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1954,11 +1927,10 @@ DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} + +${FILE_22}: ${DEPENDS_22} FILE_23=CartesianOuterfaceComplexWeightedAverage.o DEPENDS_23:=\ @@ -1987,6 +1959,7 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2006,7 +1979,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2017,15 +1989,14 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianOuterfaceComplexWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2036,11 +2007,10 @@ DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} + +${FILE_23}: ${DEPENDS_23} FILE_24=CartesianOuterfaceDoubleWeightedAverage.o DEPENDS_24:=\ @@ -2069,6 +2039,7 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2088,7 +2059,6 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2099,15 +2069,14 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianOuterfaceDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2118,11 +2087,10 @@ DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} + +${FILE_24}: ${DEPENDS_24} FILE_25=CartesianOuterfaceFloatWeightedAverage.o DEPENDS_25:=\ @@ -2151,6 +2119,7 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2170,7 +2139,6 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2181,15 +2149,14 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianOuterfaceFloatWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2200,11 +2167,10 @@ DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_25:X.o=${NDIM}.o}: ${DEPENDS_25} + +${FILE_25}: ${DEPENDS_25} FILE_26=CartesianOutersideDoubleWeightedAverage.o DEPENDS_26:=\ @@ -2233,6 +2199,7 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2252,7 +2219,6 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2263,15 +2229,14 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianOutersideDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2282,11 +2247,10 @@ DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_26:X.o=${NDIM}.o}: ${DEPENDS_26} + +${FILE_26}: ${DEPENDS_26} FILE_27=CartesianPatchGeometry.o DEPENDS_27:=\ @@ -2303,8 +2267,8 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -2314,18 +2278,15 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CartesianPatchGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_27 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_27:X.o=${NDIM}.o}: ${DEPENDS_27} + +${FILE_27}: ${DEPENDS_27} FILE_28=CartesianSideComplexWeightedAverage.o DEPENDS_28:=\ @@ -2354,6 +2315,7 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2373,7 +2335,6 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2384,15 +2345,14 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianSideComplexWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_28 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2403,11 +2363,10 @@ DEPENDS_28 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_28:X.o=${NDIM}.o}: ${DEPENDS_28} + +${FILE_28}: ${DEPENDS_28} FILE_29=CartesianSideDoubleConservativeLinearRefine.o DEPENDS_29:=\ @@ -2435,6 +2394,7 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2455,7 +2415,6 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2466,15 +2425,14 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianSideDoubleConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_29 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2485,11 +2443,10 @@ DEPENDS_29 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_29:X.o=${NDIM}.o}: ${DEPENDS_29} + +${FILE_29}: ${DEPENDS_29} FILE_30=CartesianSideDoubleWeightedAverage.o DEPENDS_30:=\ @@ -2518,6 +2475,7 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2537,7 +2495,6 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2548,15 +2505,14 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianSideDoubleWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2567,11 +2523,10 @@ DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_30:X.o=${NDIM}.o}: ${DEPENDS_30} + +${FILE_30}: ${DEPENDS_30} FILE_31=CartesianSideFloatConservativeLinearRefine.o DEPENDS_31:=\ @@ -2599,6 +2554,7 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2619,7 +2575,6 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2630,15 +2585,14 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianSideFloatConservativeLinearRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_31 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2649,11 +2603,10 @@ DEPENDS_31 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_31:X.o=${NDIM}.o}: ${DEPENDS_31} + +${FILE_31}: ${DEPENDS_31} FILE_32=CartesianSideFloatWeightedAverage.o DEPENDS_32:=\ @@ -2682,6 +2635,7 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2701,7 +2655,6 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2712,15 +2665,14 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CartesianSideFloatWeightedAverage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_32 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2731,11 +2683,10 @@ DEPENDS_32 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_32:X.o=${NDIM}.o}: ${DEPENDS_32} + +${FILE_32}: ${DEPENDS_32} FILE_33=GridGeometry.o DEPENDS_33:=\ @@ -2764,6 +2715,7 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -2847,7 +2799,7 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleInjection.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h\ @@ -2872,7 +2824,6 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2884,15 +2835,15 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h GridGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_33 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2924,9 +2875,8 @@ DEPENDS_33 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_33:X.o=${NDIM}.o}: ${DEPENDS_33} + +${FILE_33}: ${DEPENDS_33} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.in index f5783429..d0052c6a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI geom package ## ######################################################################### @@ -60,7 +60,7 @@ OBJS = \ library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual.dox index ed2d0cb8..2939c7fb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ @@ -20,6 +20,7 @@ namespace SAMRAI { operators are also included here although they are independent of the mesh description. -# @ref package_geometry_cartesian "simple Cartesian mesh (grid geometry and operators)" + -# @ref package_geometry_generic "generic meshes (grid geometry only)" All class names in the Geometry package are in the SAMRAI::geom namespace. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian.dox index 6428b187..22d29190 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_grid_geom.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_grid_geom.dox index e756c475..d9a6674f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_grid_geom.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_grid_geom.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_cell.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_cell.dox index 7288dacc..8bc6b5ea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_cell.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_cell.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_fortran.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_fortran.dox index f6d7f2d8..7a63d8e8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_fortran.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_operators_fortran.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_patch_geom.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_patch_geom.dox index 06ab10c6..cd73a7d8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_patch_geom.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_cartesian_patch_geom.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_generic.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_generic.dox new file mode 100644 index 00000000..83924f3c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/dox/manual_generic.dox @@ -0,0 +1,22 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Generation of SAMRAI Doxygen source code manual + * + ************************************************************************/ +namespace SAMRAI { + namespace geom { + +/*! + @page package_geometry_generic Generic Mesh Geometry Support + + The GridGeometry class maintains a simple potentially multiblock mesh + geometry description. + - SAMRAI::geom::GridGeometry +*/ + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.depend index 31c2555a..7da2c0e0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -13,67 +13,88 @@ FILE_0=geom_cartcoarsen1d.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartcoarsen1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + geom_cartcoarsen1d.m4 geom_m4cartcoarsenops1d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=geom_cartcoarsen2d.o DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartcoarsen2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + geom_cartcoarsen2d.m4 geom_m4cartcoarsenops2d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=geom_cartcoarsen3d.o DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartcoarsen3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + geom_cartcoarsen3d.m4 geom_m4cartcoarsenops3d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=geom_cartrefine1d.o +${FILE_2}: ${DEPENDS_2} + +FILE_3=geom_cartcoarsen4d.o DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartrefine1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim4d.i \ + geom_cartcoarsen4d.m4 geom_m4cartcoarsenops4d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} -FILE_4=geom_cartrefine2d.o +${FILE_3}: ${DEPENDS_3} + +FILE_4=geom_cartrefine1d.o DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartrefine2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + geom_cartrefine1d.m4 geom_m4cartopstuff.i \ + geom_m4cartrefineops1d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} -FILE_5=geom_cartrefine3d.o +${FILE_4}: ${DEPENDS_4} + +FILE_5=geom_cartrefine2d.o DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h geom_cartrefine3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + geom_cartrefine2d.m4 geom_m4cartopstuff.i \ + geom_m4cartrefineops2d.i -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} + +FILE_6=geom_cartrefine3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + geom_cartrefine3d.m4 geom_m4cartopstuff.i \ + geom_m4cartrefineops3d.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.in index af1c6cb5..8481337d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/Makefile.in @@ -3,30 +3,63 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for geom directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/geom/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. -# For classes that are non-dimensional. -OBJS= geom_cartcoarsen1d.o geom_cartcoarsen3d.o\ - geom_cartrefine2d.o geom_cartcoarsen2d.o\ - geom_cartrefine1d.o geom_cartrefine3d.o\ - - default: library include $(OBJECT)/config/Makefile.config -library: $(OBJS) +OBJS= geom_cartcoarsen1d.o \ + geom_cartcoarsen2d.o \ + geom_cartcoarsen3d.o \ + geom_cartcoarsen4d.o \ + geom_cartrefine1d.o \ + geom_cartrefine2d.o \ + geom_cartrefine3d.o + +library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) + $(RM) *.f include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +geom_cartcoarsen1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartcoarsen1d.m4 > geom_cartcoarsen1d.f + $(F77) $(FFLAGS) -c geom_cartcoarsen1d.f -o $@ + +geom_cartcoarsen2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartcoarsen2d.m4 > geom_cartcoarsen2d.f + $(F77) $(FFLAGS) -c geom_cartcoarsen2d.f -o $@ + +geom_cartcoarsen3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartcoarsen3d.m4 > geom_cartcoarsen3d.f + $(F77) $(FFLAGS) -c geom_cartcoarsen3d.f -o $@ + +geom_cartcoarsen4d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartcoarsen4d.m4 > geom_cartcoarsen4d.f + $(F77) $(FFLAGS) -c geom_cartcoarsen4d.f -o $@ + +geom_cartrefine1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartrefine1d.m4 > geom_cartrefine1d.f + $(F77) $(FFLAGS) -c geom_cartrefine1d.f -o $@ + +geom_cartrefine2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartrefine2d.m4 > geom_cartrefine2d.f + $(F77) $(FFLAGS) -c geom_cartrefine2d.f -o $@ + +geom_cartrefine3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/geom_cartrefine3d.m4 > geom_cartrefine3d.f + $(F77) $(FFLAGS) -c geom_cartrefine3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.f deleted file mode 100644 index f994dec9..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.f +++ /dev/null @@ -1,700 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 1d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Weighted averaging for 1d cell-centered double data -c*********************************************************************** -c - subroutine cartwgtavgcelldoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d cell-centered float data -c*********************************************************************** -c - subroutine cartwgtavgcellflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - real - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d cell-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgcellcplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double complex - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = cmplx(zero, zero) - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d edge-centered double data -c*********************************************************************** -c - subroutine cartwgtavgedgedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d edge-centered float data -c*********************************************************************** -c - subroutine cartwgtavgedgeflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - real - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d edge-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgedgecplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double complex - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision dVf,dVc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - dVf = dxf(0) - dVc = dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = cmplx(zero, zero) - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*dVf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/dVc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d face-centered double data -c*********************************************************************** -c - subroutine cartwgtavgfacedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d face-centered float data -c*********************************************************************** -c - subroutine cartwgtavgfaceflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - real - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d face-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgfacecplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double complex - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d outerface double data -c*********************************************************************** -c - subroutine cartwgtavgoutfacedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d outerface float data -c*********************************************************************** -c - subroutine cartwgtavgoutfaceflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - real - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d outerface complex data -c*********************************************************************** -c - subroutine cartwgtavgoutfacecplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double complex - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d outerside double data -c*********************************************************************** -c - subroutine cartwgtavgoutsidedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d side-centered double data -c*********************************************************************** -c - subroutine cartwgtavgsidedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double precision - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d side-centered float data -c*********************************************************************** -c - subroutine cartwgtavgsideflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - real - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 1d side-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgsidecplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & dxf(0:1-1), - & dxc(0:1-1) - double complex - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.m4 index f2e46842..827be7a0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen1d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 1d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartcoarsenops1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 1d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartcoarsenops1d.i)dnl c c*********************************************************************** c Weighted averaging for 1d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.f deleted file mode 100644 index 1ba31dba..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.f +++ /dev/null @@ -1,1727 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 2d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Weighted averaging for 2d cell-centered double data -c*********************************************************************** -c - subroutine cartwgtavgcelldoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision dVf,dVc - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1) - dVc = dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*dVf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/dVc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d cell-centered float data -c*********************************************************************** -c - subroutine cartwgtavgcellflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision dVf,dVc - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1) - dVc = dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*dVf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/dVc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d cell-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgcellcplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision dVf,dVc - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1) - dVc = dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*dVf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/dVc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d edge-centered double data -c*********************************************************************** -c - subroutine cartwgtavgedgedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d edge-centered float data -c*********************************************************************** -c - subroutine cartwgtavgedgeflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgeflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d edge-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgedgecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d face-centered double data -c*********************************************************************** -c - subroutine cartwgtavgfacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ie0,ic1,if0,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1)=arrayc(ie0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=arrayc(ie0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo1:fihi1+1, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0) - double precision lengthf, lengthc - integer ie1,ic0,if1,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=zero - enddo - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic0)=arrayc(ie1,ic0) - & +arrayf(if1,if0)*lengthf - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=arrayc(ie1,ic0)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d face-centered float data -c*********************************************************************** -c - subroutine cartwgtavgfaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ie0,ic1,if0,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1)=arrayc(ie0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=arrayc(ie0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgfaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo1:fihi1+1, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0) - double precision lengthf, lengthc - integer ie1,ic0,if1,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=zero - enddo - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic0)=arrayc(ie1,ic0) - & +arrayf(if1,if0)*lengthf - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=arrayc(ie1,ic0)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d face-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgfacecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ie0,ic1,if0,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1)=arrayc(ie0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1)=arrayc(ie0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo1:fihi1+1, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0) - double precision lengthf, lengthc - integer ie1,ic0,if1,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=cmplx(zero,zero) - enddo - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic0)=arrayc(ie1,ic0) - & +arrayf(if1,if0)*lengthf - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic0)=arrayc(ie1,ic0)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d outerface double data -c*********************************************************************** -c - subroutine cartwgtavgoutfacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo1:fihi1), - & arrayc(cilo1:cihi1) - double precision lengthf, lengthc - integer ic1,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=zero - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1)=arrayc(ic1)+arrayf(if1)*lengthf - enddo - enddo - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=arrayc(ic1)/lengthc - enddo -c - return - end -c - subroutine cartwgtavgoutfacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision lengthf, lengthc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*lengthf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/lengthc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d outerface float data -c*********************************************************************** -c - subroutine cartwgtavgoutfaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo1:fihi1), - & arrayc(cilo1:cihi1) - double precision lengthf, lengthc - integer ic1,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=zero - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1)=arrayc(ic1)+arrayf(if1)*lengthf - enddo - enddo - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=arrayc(ic1)/lengthc - enddo -c - return - end -c - subroutine cartwgtavgoutfaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision lengthf, lengthc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*lengthf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/lengthc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d outerface complex data -c*********************************************************************** -c - subroutine cartwgtavgoutfacecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo1:fihi1), - & arrayc(cilo1:cihi1) - double precision lengthf, lengthc - integer ic1,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=cmplx(zero,zero) - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1)=arrayc(ic1)+arrayf(if1)*lengthf - enddo - enddo - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=arrayc(ic1)/lengthc - enddo -c - return - end -c - subroutine cartwgtavgoutfacecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision lengthf, lengthc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=cmplx(zero,zero) - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*lengthf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/lengthc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d outerside double data -c*********************************************************************** -c - subroutine cartwgtavgoutsidedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo1:fihi1), - & arrayc(cilo1:cihi1) - double precision lengthf, lengthc - integer ic1,if1,ir1 -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=zero - enddo - - do ir1=0,ratio(1)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1)=arrayc(ic1)+arrayf(if1)*lengthf - enddo - enddo - - do ic1=ifirstc1,ilastc1 - arrayc(ic1)=arrayc(ic1)/lengthc - enddo -c - return - end -c - subroutine cartwgtavgoutsidedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - double precision lengthf, lengthc - integer ic0,if0,ir0 -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0)=arrayc(ic0)+arrayf(if0)*lengthf - enddo - enddo - - do ic0=ifirstc0,ilastc0 - arrayc(ic0)=arrayc(ic0)/lengthc - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d side-centered double data -c*********************************************************************** -c - subroutine cartwgtavgsidedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d side-centered float data -c*********************************************************************** -c - subroutine cartwgtavgsideflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgsideflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 2d side-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgsidecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - do ic0=ifirstc0,ilastc0+1 - - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+0 - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxf(0:2-1), - & dxc(0:2-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1) - double precision lengthf, lengthc - integer ic0,ic1,if0,if1,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+0 - - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*lengthf - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1+1 - do ic0=ifirstc0,ilastc0+0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/lengthc - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.m4 index eb63d99a..b1a9175d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen2d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 2d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartcoarsenops2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 2d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartcoarsenops2d.i)dnl c c*********************************************************************** c Weighted averaging for 2d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.f deleted file mode 100644 index b0cb729f..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.f +++ /dev/null @@ -1,3112 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 3d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Weighted averaging for 3d cell-centered double data -c*********************************************************************** -c - subroutine cartwgtavgcelldoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - double precision dVf,dVc - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1)*dxf(2) - dVc = dxc(0)*dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*dVf - enddo - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/dVc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d cell-centered float data -c*********************************************************************** -c - subroutine cartwgtavgcellflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - double precision dVf,dVc - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1)*dxf(2) - dVc = dxc(0)*dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*dVf - enddo - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/dVc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d cell-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgcellcplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - double precision dVf,dVc - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1)*dxf(2) - dVc = dxc(0)*dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*dVf - enddo - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/dVc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d edge-centered double data -c*********************************************************************** -c - subroutine cartwgtavgedgedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0 - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1 - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(2) - lengthc=dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir=0,ratio(2)-1 - if2=ic2*ratio(2)+ir - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d edge-centered float data -c*********************************************************************** -c - subroutine cartwgtavgedgeflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0 - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgeflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1 - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgeflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(2) - lengthc=dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir=0,ratio(2)-1 - if2=ic2*ratio(2)+ir - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d edge-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgedgecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(0) - lengthc=dxc(0) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0 - do ir=0,ratio(0)-1 - if0=ic0*ratio(0)+ir - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(1) - lengthc=dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - - do ic1=ifirstc1,ilastc1 - do ir=0,ratio(1)-1 - if1=ic1*ratio(1)+ir - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgedgecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision lengthf,lengthc - integer ic0,ic1,ic2,if0,if1,if2,ir -c -c*********************************************************************** -c - lengthf=dxf(2) - lengthc=dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir=0,ratio(2)-1 - if2=ic2*ratio(2)+ir - - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*lengthf - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/lengthc - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d face-centered double data -c*********************************************************************** -c - subroutine cartwgtavgfacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ie0,ic1,ic2,if0,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ie1,ic2,ic0,if1,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=zero - enddo - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0) - & +arrayf(if1,if2,if0)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ie2,ic0,ic1,if2,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=zero - enddo - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1) - & +arrayf(if2,if0,if1)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1)/areac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d face-centered float data -c*********************************************************************** -c - subroutine cartwgtavgfaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ie0,ic1,ic2,if0,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ie1,ic2,ic0,if1,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=zero - enddo - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0) - & +arrayf(if1,if2,if0)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ie2,ic0,ic1,if2,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=zero - enddo - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1) - & +arrayf(if2,if0,if1)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1)/areac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d face-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgfacecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ie0,ic1,ic2,if0,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ie0=ifirstc0,ilastc0+1 - if0=ie0*ratio(0) - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ic1,ic2)=arrayc(ie0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ie1,ic2,ic0,if1,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=cmplx(zero,zero) - enddo - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0) - & +arrayf(if1,if2,if0)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - arrayc(ie1,ic2,ic0)=arrayc(ie1,ic2,ic0)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgfacecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ie2,ic0,ic1,if2,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=cmplx(zero,zero) - enddo - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1) - & +arrayf(if2,if0,if1)*areaf - enddo - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - arrayc(ie2,ic0,ic1)=arrayc(ie2,ic0,ic1)/areac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d outerface double data -c*********************************************************************** -c - subroutine cartwgtavgoutfacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic1,ic2,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=zero - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1,ic2)=arrayc(ic1,ic2) - & +arrayf(if1,if2)*areaf - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=arrayc(ic1,ic2)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ic2,ic0,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=zero - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - arrayc(ic2,ic0)=arrayc(ic2,ic0) - & +arrayf(if2,if0)*areaf - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=arrayc(ic2,ic0)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*areaf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/areac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d outerface float data -c*********************************************************************** -c - subroutine cartwgtavgoutfaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic1,ic2,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=zero - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1,ic2)=arrayc(ic1,ic2) - & +arrayf(if1,if2)*areaf - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=arrayc(ic1,ic2)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ic2,ic0,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=zero - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - arrayc(ic2,ic0)=arrayc(ic2,ic0) - & +arrayf(if2,if0)*areaf - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=arrayc(ic2,ic0)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*areaf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/areac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d outerface complex data -c*********************************************************************** -c - subroutine cartwgtavgoutfacecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic1,ic2,if1,if2,ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=cmplx(zero,zero) - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - arrayc(ic1,ic2)=arrayc(ic1,ic2) - & +arrayf(if1,if2)*areaf - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - arrayc(ic1,ic2)=arrayc(ic1,ic2)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfacecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo2:fihi2, - & filo0:fihi0), - & arrayc(cilo2:cihi2, - & cilo0:cihi0) - double precision areaf,areac - integer ic2,ic0,if2,if0,ir2,ir0 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=cmplx(zero,zero) - enddo - enddo - - do ir0=0,ratio(0)-1 - do ir2=0,ratio(2)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - arrayc(ic2,ic0)=arrayc(ic2,ic0) - & +arrayf(if2,if0)*areaf - enddo - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - arrayc(ic2,ic0)=arrayc(ic2,ic0)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutfacecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=cmplx(zero,zero) - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1)=arrayc(ic0,ic1) - & +arrayf(if0,if1)*areaf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=arrayc(ic0,ic1)/areac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d outerside double data -c*********************************************************************** -c - subroutine cartwgtavgoutsidedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic_outer,ic_inner,if_outer,if_inner, - & ir_outer,ir_inner -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - - do ic_outer=ifirstc2,ilastc2 - do ic_inner=ifirstc1,ilastc1 - - arrayc(ic_inner,ic_outer)=zero - enddo - enddo - - - do ic_outer=ifirstc2,ilastc2 - do ir_outer=0,ratio(2)-1 - if_outer=ic_outer*ratio(2)+ir_outer - do ic_inner=ifirstc1,ilastc1 - do ir_inner=0,ratio(1)-1 - if_inner=ic_inner*ratio(1)+ir_inner - - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer) - & +arrayf(if_inner,if_outer)*areaf - enddo - enddo - enddo - enddo - - - do ic_outer=ifirstc2,ilastc2 - do ic_inner=ifirstc1,ilastc1 - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutsidedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo2:cihi2) - double precision areaf,areac - integer ic_outer,ic_inner,if_outer,if_inner, - & ir_outer,ir_inner -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(2) - areac=dxc(0)*dxc(2) - - - do ic_outer=ifirstc2,ilastc2 - do ic_inner=ifirstc0,ilastc0 - - arrayc(ic_inner,ic_outer)=zero - enddo - enddo - - - do ic_outer=ifirstc2,ilastc2 - do ir_outer=0,ratio(2)-1 - if_outer=ic_outer*ratio(2)+ir_outer - do ic_inner=ifirstc0,ilastc0 - do ir_inner=0,ratio(0)-1 - if_inner=ic_inner*ratio(0)+ir_inner - - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer) - & +arrayf(if_inner,if_outer)*areaf - enddo - enddo - enddo - enddo - - - do ic_outer=ifirstc2,ilastc2 - do ic_inner=ifirstc0,ilastc0 - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer)/areac - enddo - enddo -c - return - end -c - subroutine cartwgtavgoutsidedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - double precision areaf,areac - integer ic_outer,ic_inner,if_outer,if_inner, - & ir_outer,ir_inner -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - - do ic_outer=ifirstc1,ilastc1 - do ic_inner=ifirstc0,ilastc0 - - arrayc(ic_inner,ic_outer)=zero - enddo - enddo - - - do ic_outer=ifirstc1,ilastc1 - do ir_outer=0,ratio(1)-1 - if_outer=ic_outer*ratio(1)+ir_outer - do ic_inner=ifirstc0,ilastc0 - do ir_inner=0,ratio(0)-1 - if_inner=ic_inner*ratio(0)+ir_inner - - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer) - & +arrayf(if_inner,if_outer)*areaf - enddo - enddo - enddo - enddo - - - do ic_outer=ifirstc1,ilastc1 - do ic_inner=ifirstc0,ilastc0 - arrayc(ic_inner,ic_outer)= - & arrayc(ic_inner,ic_outer)/areac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d side-centered double data -c*********************************************************************** -c - subroutine cartwgtavgsidedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir2 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double precision - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d side-centered float data -c*********************************************************************** -c - subroutine cartwgtavgsideflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsideflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir2 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsideflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - real - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Weighted averaging for 3d side-centered complex data -c*********************************************************************** -c - subroutine cartwgtavgsidecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir1,ir2 -c -c*********************************************************************** -c - areaf=dxf(1)*dxf(2) - areac=dxc(1)*dxc(2) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir2 -c -c*********************************************************************** -c - areaf=dxf(2)*dxf(0) - areac=dxc(2)*dxc(0) - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - do ir2=0,ratio(2)-1 - if2=ic2*ratio(2)+ir2 - - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c - subroutine cartwgtavgsidecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & dxf(0:3-1), - & dxc(0:3-1) - double complex - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1) - double precision areaf,areac - integer ic0,ic1,ic2,if0,if1,if2, - - & ir0,ir1 -c -c*********************************************************************** -c - areaf=dxf(0)*dxf(1) - areac=dxc(0)*dxc(1) - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - - arrayc(ic0,ic1,ic2)=cmplx(zero,zero) - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - if2=ic2*ratio(2) - - do ic1=ifirstc1,ilastc1 - do ir1=0,ratio(1)-1 - if1=ic1*ratio(1)+ir1 - - do ic0=ifirstc0,ilastc0 - do ir0=0,ratio(0)-1 - if0=ic0*ratio(0)+ir0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2) - & +arrayf(if0,if1,if2)*areaf - enddo - enddo - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=arrayc(ic0,ic1,ic2)/areac - enddo - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.m4 index 31c59c78..f5ec73a8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen3d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 3d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartcoarsenops3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 3d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartcoarsenops3d.i)dnl c c*********************************************************************** c Weighted averaging for 3d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen4d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen4d.m4 new file mode 100644 index 00000000..dce892c2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartcoarsen4d.m4 @@ -0,0 +1,78 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 4d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartcoarsenops4d.i)dnl +c +c*********************************************************************** +c Weighted averaging for 4d cell-centered double data +c*********************************************************************** +c + subroutine cartwgtavgcelldoub4d( +cart_wgtavg_op_cell_4d(`double precision')dnl +c +c*********************************************************************** +c Weighted averaging for 4d cell-centered float data +c*********************************************************************** +c + subroutine cartwgtavgcellflot4d( +cart_wgtavg_op_cell_4d(`real')dnl +c +c*********************************************************************** +c Weighted averaging for 4d cell-centered complex data +c*********************************************************************** +c + subroutine cartwgtavgcellcplx4d( +cart_wgtavg_op_cell_4d(`double complex')dnl +c +c*********************************************************************** +c Weighted averaging for 4d face-centered double data +c*********************************************************************** +c + subroutine cartwgtavgfacedoub4d0( +cart_wgtavg_op_face_4d(`double precision',0,1,2,3)dnl +c + subroutine cartwgtavgfacedoub4d1( +cart_wgtavg_op_face_4d(`double precision',1,2,3,0)dnl +c + subroutine cartwgtavgfacedoub4d2( +cart_wgtavg_op_face_4d(`double precision',2,3,0,1)dnl +c + subroutine cartwgtavgfacedoub4d3( +cart_wgtavg_op_face_4d(`double precision',3,0,1,2)dnl +c +c*********************************************************************** +c Weighted averaging for 4d face-centered float data +c*********************************************************************** +c + subroutine cartwgtavgfaceflot4d0( +cart_wgtavg_op_face_4d(`real',0,1,2,3)dnl +c + subroutine cartwgtavgfaceflot4d1( +cart_wgtavg_op_face_4d(`real',1,2,3,0)dnl +c + subroutine cartwgtavgfaceflot4d2( +cart_wgtavg_op_face_4d(`real',2,3,0,1)dnl +c + subroutine cartwgtavgfaceflot4d3( +cart_wgtavg_op_face_4d(`real',3,0,1,2)dnl +c +c*********************************************************************** +c Weighted averaging for 4d face-centered complex data +c*********************************************************************** +c + subroutine cartwgtavgfacecplx4d0( +cart_wgtavg_op_face_4d(`double complex',0,1,2,3)dnl +c + subroutine cartwgtavgfacecplx4d1( +cart_wgtavg_op_face_4d(`double complex',1,2,3,0)dnl +c + subroutine cartwgtavgfacecplx4d2( +cart_wgtavg_op_face_4d(`double complex',2,3,0,1)dnl +c + subroutine cartwgtavgfacecplx4d3( +cart_wgtavg_op_face_4d(`double complex',3,0,1,2)dnl diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.f deleted file mode 100644 index 9d93abf0..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.f +++ /dev/null @@ -1,1192 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 1d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for cartesian geometry transfer routines. -c - - - - -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Linear interpolation for 1d cell-centered double data -c*********************************************************************** -c - subroutine cartlinrefcelldoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - double precision deltax(0:15,0:1-1),x - integer ic0,if0,ir0 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0)=arrayc(ic0)+(arrayc(ic0+1)-arrayc(ic0))*x - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 1d cell-centered float data -c*********************************************************************** -c - subroutine cartlinrefcellflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - double precision deltax(0:15,0:1-1),x - integer ic0,if0,ir0 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0)=arrayc(ic0)+(arrayc(ic0+1)-arrayc(ic0))*x - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 1d cell-centered complex data -c*********************************************************************** -c - subroutine cartlinrefcellcplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - double complex - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - double precision deltax(0:15,0:1-1),x - integer ic0,if0,ir0 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0)=arrayc(ic0)+(arrayc(ic0+1)-arrayc(ic0))*x - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d cell-centered double data -c*********************************************************************** -c - subroutine cartclinrefcelldoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - double precision - & coef2,bound -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d cell-centered float data -c*********************************************************************** -c - subroutine cartclinrefcellflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d cell-centered complex data -c*********************************************************************** -c - subroutine cartclinrefcellcplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - double complex - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - double precision - & coef2real,coef2imag,boundreal,boundimag, - & diff0real,diff0imag,diff1real,diff1imag, - & slopereal,slopeimag -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - diff0real=dble(diff0(ic0)) - diff0imag=imag(diff0(ic0)) - diff1real=dble(diff0(ic0+1)) - diff1imag=imag(diff0(ic0+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(0) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(0) - else - slopeimag=zero - endif - slope0(ic0) = slopereal + cmplx(zero,one)*slopeimag - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d edge-centered double data -c*********************************************************************** -c - subroutine cartclinrefedgedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - double precision - & coef2,bound -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d edge-centered float data -c*********************************************************************** -c - subroutine cartclinrefedgeflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d face-centered double data -c*********************************************************************** -c - subroutine cartclinreffacedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - double precision - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1), - & diff0(cilo0:cihi0), - & slope0(cilo0:cihi0+1) - integer ic0,ie0,if0,ir0 - double precision - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1) - & -arrayc(ic0) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d face-centered float data -c*********************************************************************** -c - subroutine cartclinreffaceflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1), - & diff0(cilo0:cihi0), - & slope0(cilo0:cihi0+1) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1) - & -arrayc(ic0) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d face-centered complex data -c*********************************************************************** -c -c subroutine cartclinreffacecplx1d( -ccart_clinref_op_face_1d(double complex)c -c*********************************************************************** -c Linear interpolation for 1d node-centered double data -c*********************************************************************** -c - subroutine cartlinrefnodedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - double precision - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - double precision realrat,x - integer i,ic0,if0,ie0,ir0 -c -c*********************************************************************** -c - realrat=one/dble(ratio(0)) - - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - do ir0=0,ratio(0)-1 - ie0=if0+ir0 - x = dble(ir0)*realrat - if (ie0.ge.filo0.and.ie0.le.fihi0+1) then - arrayf(ie0) = arrayc(ic0)*(one-x) - & + arrayc(ic0+1)*x - endif - enddo - endif - enddo -c - ic0 = ilastc0+1 - if0 = ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - arrayf(if0) = arrayc(ic0) - endif -c - return - end -c -c*********************************************************************** -c Linear interpolation for 1d node-centered float data -c*********************************************************************** -c - subroutine cartlinrefnodeflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - double precision realrat,x - integer i,ic0,if0,ie0,ir0 -c -c*********************************************************************** -c - realrat=one/dble(ratio(0)) - - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - do ir0=0,ratio(0)-1 - ie0=if0+ir0 - x = dble(ir0)*realrat - if (ie0.ge.filo0.and.ie0.le.fihi0+1) then - arrayf(ie0) = arrayc(ic0)*(one-x) - & + arrayc(ic0+1)*x - endif - enddo - endif - enddo -c - ic0 = ilastc0+1 - if0 = ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - arrayf(if0) = arrayc(ic0) - endif -c - return - end -c -c*********************************************************************** -c Linear interpolation for 1d node-centered complex data -c*********************************************************************** -c - subroutine cartlinrefnodecplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - double complex - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - double precision realrat,x - integer i,ic0,if0,ie0,ir0 -c -c*********************************************************************** -c - realrat=one/dble(ratio(0)) - - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - do ir0=0,ratio(0)-1 - ie0=if0+ir0 - x = dble(ir0)*realrat - if (ie0.ge.filo0.and.ie0.le.fihi0+1) then - arrayf(ie0) = arrayc(ic0)*(one-x) - & + arrayc(ic0+1)*x - endif - enddo - endif - enddo -c - ic0 = ilastc0+1 - if0 = ic0*ratio(0) - if (if0.ge.filo0.and.if0.le.fihi0+1) then - arrayf(if0) = arrayc(ic0) - endif -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d outerface double data -c*********************************************************************** -c - subroutine cartclinrefoutfacedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1) - double precision - & arrayc(1), - & arrayf(1) -c -c*********************************************************************** -c - arrayf(1)=arrayc(1) -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d outerface float data -c*********************************************************************** -c - subroutine cartclinrefoutfaceflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1), - & diff0(cilo0:cihi0), - & slope0(cilo0:cihi0+1) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1) - & -arrayc(ic0) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d outerface complex data -c*********************************************************************** -c -c subroutine cartclinrefoutfacecplx1d( -ccart_clinref_op_face_1d(double complex)c -c*********************************************************************** -c Conservative linear interpolation for 1d side-centered double data -c*********************************************************************** -c - subroutine cartclinrefsidedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - double precision - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1), - & diff0(cilo0:cihi0), - & slope0(cilo0:cihi0+1) - integer ic0,ie0,if0,ir0 - double precision - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1) - & -arrayc(ic0) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d side-centered float data -c*********************************************************************** -c - subroutine cartclinrefsideflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & dxc(0:1-1), - & dxf(0:1-1), - & deltax(0:15,0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1), - & diff0(cilo0:cihi0), - & slope0(cilo0:cihi0+1) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1) - & -arrayc(ic0) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0)+slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 1d side-centered complex data -c*********************************************************************** -c -c subroutine cartclinrefsidecplx1d( -ccart_clinref_op_side_1d(double complex)c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.m4 index b5bc3e28..253488c6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine1d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 1d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartrefineops1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 1d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartrefineops1d.i)dnl c c*********************************************************************** c Linear interpolation for 1d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.f deleted file mode 100644 index 6f6e2228..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.f +++ /dev/null @@ -1,2561 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 2d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for cartesian geometry transfer routines. -c - - - - -c -c -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Linear interpolation for 2d cell-centered double data -c*********************************************************************** -c - subroutine cartlinrefcelldoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - double precision deltax(0:15,0:2-1),x,y - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1)= - & (arrayc(ic0,ic1)+(arrayc(ic0+1,ic1)-arrayc(ic0,ic1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1) - & +(arrayc(ic0+1,ic1+1)-arrayc(ic0,ic1+1))*x)*y - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 2d cell-centered float data -c*********************************************************************** -c - subroutine cartlinrefcellflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - double precision deltax(0:15,0:2-1),x,y - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1)= - & (arrayc(ic0,ic1)+(arrayc(ic0+1,ic1)-arrayc(ic0,ic1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1) - & +(arrayc(ic0+1,ic1+1)-arrayc(ic0,ic1+1))*x)*y - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 2d cell-centered complex data -c*********************************************************************** -c - subroutine cartlinrefcellcplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - double precision deltax(0:15,0:2-1),x,y - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1)= - & (arrayc(ic0,ic1)+(arrayc(ic0+1,ic1)-arrayc(ic0,ic1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1) - & +(arrayc(ic0+1,ic1+1)-arrayc(ic0,ic1+1))*x)*y - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d cell-centered double data -c*********************************************************************** -c - subroutine cartclinrefcelldoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d cell-centered float data -c*********************************************************************** -c - subroutine cartclinrefcellflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d cell-centered complex data -c*********************************************************************** -c - subroutine cartclinrefcellcplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2real,coef2imag,boundreal,boundimag, - & diff0real,diff0imag,diff1real,diff1imag, - & slopereal,slopeimag - double precision deltax1 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - diff0real=dble(diff0(ic0)) - diff0imag=imag(diff0(ic0)) - diff1real=dble(diff0(ic0+1)) - diff1imag=imag(diff0(ic0+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(0) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(0) - else - slopeimag=zero - endif - slope0(ic0,ic1) = slopereal + cmplx(zero,one)*slopeimag - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - diff0real=dble(diff1(ic1)) - diff0imag=imag(diff1(ic1)) - diff1real=dble(diff1(ic1+1)) - diff1imag=imag(diff1(ic1+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(1) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(1) - else - slopeimag=zero - endif - slope1(ic0,ic1) = slopereal + cmplx(zero,one)*slopeimag - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d edge-centered double data -c*********************************************************************** -c - subroutine cartclinrefedgedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1) - & -arrayc(ic0,ic1) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinrefedgedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d edge-centered float data -c*********************************************************************** -c - subroutine cartclinrefedgeflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1) - & -arrayc(ic0,ic1) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinrefedgeflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d face-centered double data -c*********************************************************************** -c - subroutine cartclinreffacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ie0=ifirstc0,ilastc0+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie0,ie1) - & -arrayc(ie0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinreffacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1+1, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1+1, - & cilo0:cihi0) - integer ic1,ic0,ie1,ie0,if1,if0,ir1,ir0 - double precision - & coef2,bound - double precision deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic0=ifirstc0,ilastc0 - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic1+1,ic0) - & -arrayc(ic1,ic0) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ie1,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie1,ic0)=zero - endif - enddo - enddo - - do ie1=ifirstc1,ilastc1+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie1,ie0) - & -arrayc(ie1,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ie1,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie1,ic0)=zero - endif - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - ir1=if1-ie1*ratio(1) - arrayf(if1,if0)=arrayc(ie1,ic0) - & +slope1(ie1,ic0)*deltax(ir1,1) - & +slope0(ie1,ic0)*deltax0 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d face-centered float data -c*********************************************************************** -c - subroutine cartclinreffaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ie0=ifirstc0,ilastc0+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie0,ie1) - & -arrayc(ie0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1)=arrayc(ie0,ic1) - & +slope0(ie0,ic1)*deltax(ir0,0) - & +slope1(ie0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinreffaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1+1, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1+1, - & cilo0:cihi0) - integer ic1,ic0,ie1,ie0,if1,if0,ir1,ir0 - real - & coef2,bound - double precision deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic0=ifirstc0,ilastc0 - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic1+1,ic0) - & -arrayc(ic1,ic0) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ie1,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie1,ic0)=zero - endif - enddo - enddo - - do ie1=ifirstc1,ilastc1+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie1,ie0) - & -arrayc(ie1,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ie1,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie1,ic0)=zero - endif - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - ir1=if1-ie1*ratio(1) - arrayf(if1,if0)=arrayc(ie1,ic0) - & +slope1(ie1,ic0)*deltax(ir1,1) - & +slope0(ie1,ic0)*deltax0 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d face-centered complex data -c*********************************************************************** -c -c subroutine cartclinreffacecplx2d0( -ccart_clinref_op_face_2d(double complex,0,1)cc -c subroutine cartclinreffacecplx2d1( -ccart_clinref_op_face_2d(double complex,1,0)c -c*********************************************************************** -c Linear interpolation for 2d node-centered double data -c*********************************************************************** -c - subroutine cartlinrefnodedoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1) - double precision x,y,realrat0,realrat1 - integer ic0,ic1,if0,if1,ie0,ie1,ir0,ir1,i,j -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - arrayf(ie0,ie1)= - & (arrayc(ic0,ic1)*(one-x) + - & arrayc(ic0+1,ic1)*x)*(one-y) + - & (arrayc(ic0,ic1+1)*(one-x) + - & arrayc(ic0+1,ic1+1)*x)*y - endif - end do - end do - endif - end do - end do -c - return - end -c -c*********************************************************************** -c Linear interpolation for 2d node-centered float data -c*********************************************************************** -c - subroutine cartlinrefnodeflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1) - double precision x,y,realrat0,realrat1 - integer ic0,ic1,if0,if1,ie0,ie1,ir0,ir1,i,j -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - arrayf(ie0,ie1)= - & (arrayc(ic0,ic1)*(one-x) + - & arrayc(ic0+1,ic1)*x)*(one-y) + - & (arrayc(ic0,ic1+1)*(one-x) + - & arrayc(ic0+1,ic1+1)*x)*y - endif - end do - end do - endif - end do - end do -c - return - end -c -c*********************************************************************** -c Linear interpolation for 2d node-centered complex data -c*********************************************************************** -c - subroutine cartlinrefnodecplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1) - double precision x,y,realrat0,realrat1 - integer ic0,ic1,if0,if1,ie0,ie1,ir0,ir1,i,j -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - arrayf(ie0,ie1)= - & (arrayc(ic0,ic1)*(one-x) + - & arrayc(ic0+1,ic1)*x)*(one-y) + - & (arrayc(ic0,ic1+1)*(one-x) + - & arrayc(ic0+1,ic1+1)*x)*y - endif - end do - end do - endif - end do - end do -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d outerface double data -c*********************************************************************** -c - subroutine cartclinrefoutfacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1) - integer ic1,ie1,if1,ir1 - double precision - & coef2,bound -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie1) - & -arrayc(ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic1)=zero - endif - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - arrayf(if1)=arrayc(ic1) - & +slope1(ic1)*deltax(ir1,1) - enddo -c - return - end -c - subroutine cartclinrefoutfacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - double precision - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0) - & +slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d outerface float data -c*********************************************************************** -c - subroutine cartclinrefoutfaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1) - integer ic1,ie1,if1,ir1 - real - & coef2,bound -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie1) - & -arrayc(ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic1)=zero - endif - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - arrayf(if1)=arrayc(ic1) - & +slope1(ic1)*deltax(ir1,1) - enddo -c - return - end -c - subroutine cartclinrefoutfaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0) - integer ic0,ie0,if0,ir0 - real - & coef2,bound -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0) - & -arrayc(ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0)=zero - endif - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0)=arrayc(ic0) - & +slope0(ic0)*deltax(ir0,0) - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d outerface complex data -c*********************************************************************** -c -c subroutine cartclinrefoutfacecplx2d0( -ccart_clinref_op_outerface_2d(double complex,0,1)cc -c subroutine cartclinrefoutfacecplx2d1( -ccart_clinref_op_outerface_2d(double complex,1,0)c -c*********************************************************************** -c Conservative linear interpolation for 2d side-centered double data -c*********************************************************************** -c - subroutine cartclinrefsidedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinrefsidedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1) - & -arrayc(ic0,ic1) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d side-centered float data -c*********************************************************************** -c - subroutine cartclinrefsideflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic1=ifirstc1,ilastc1+0 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1) - & -arrayc(ic0,ic1) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c - subroutine cartclinrefsideflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & dxc(0:2-1), - & dxf(0:2-1), - & deltax(0:15,0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0+0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1) - & -arrayc(ic0,ic1) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 2d side-centered complex data -c*********************************************************************** -c -c subroutine cartclinrefsidecplx2d0( -ccart_clinref_op_side_2d(double complex,0,1)cc -c subroutine cartclinrefsidecplx2d1( -ccart_clinref_op_side_2d(double complex,1,0)c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.m4 index 50994b3b..cfec0ab9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine2d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 2d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartrefineops2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 2d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartrefineops2d.i)dnl c c*********************************************************************** c Linear interpolation for 2d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.f deleted file mode 100644 index 6ec1681f..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.f +++ /dev/null @@ -1,4912 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 3d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for cartesian geometry transfer routines. -c - - - - -c -c -c -c -c -c - -c -c -c -c -c -c*********************************************************************** -c Linear interpolation for 3d cell-centered double data -c*********************************************************************** -c - subroutine cartlinrefcelldoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - double precision deltax(0:15,0:3-1),x,y,z - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - z=deltax(ir2,2)/dxc(2) - if( z .lt. 0.d0 ) then - ic2 = ic2-1 - z = z + one - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1,if2)= - & ( (arrayc(ic0,ic1,ic2) - & +(arrayc(ic0+1,ic1,ic2)-arrayc(ic0,ic1,ic2))*x)*(one-y) - & +(arrayc(ic0,ic1+1,ic2) - & +(arrayc(ic0+1,ic1+1,ic2)-arrayc(ic0,ic1+1,ic2))*x)*y ) - & *(one-z) - & +( (arrayc(ic0,ic1,ic2+1) - & +(arrayc(ic0+1,ic1,ic2+1)-arrayc(ic0,ic1,ic2+1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1,ic2+1) - & +(arrayc(ic0+1,ic1+1,ic2+1)-arrayc(ic0,ic1+1,ic2+1))*x)*y) - & *z - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 3d cell-centered float data -c*********************************************************************** -c - subroutine cartlinrefcellflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - double precision deltax(0:15,0:3-1),x,y,z - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - z=deltax(ir2,2)/dxc(2) - if( z .lt. 0.d0 ) then - ic2 = ic2-1 - z = z + one - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1,if2)= - & ( (arrayc(ic0,ic1,ic2) - & +(arrayc(ic0+1,ic1,ic2)-arrayc(ic0,ic1,ic2))*x)*(one-y) - & +(arrayc(ic0,ic1+1,ic2) - & +(arrayc(ic0+1,ic1+1,ic2)-arrayc(ic0,ic1+1,ic2))*x)*y ) - & *(one-z) - & +( (arrayc(ic0,ic1,ic2+1) - & +(arrayc(ic0+1,ic1,ic2+1)-arrayc(ic0,ic1,ic2+1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1,ic2+1) - & +(arrayc(ic0+1,ic1+1,ic2+1)-arrayc(ic0,ic1+1,ic2+1))*x)*y) - & *z - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear interpolation for 3d cell-centered complex data -c*********************************************************************** -c - subroutine cartlinrefcellcplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - double precision deltax(0:15,0:3-1),x,y,z - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - z=deltax(ir2,2)/dxc(2) - if( z .lt. 0.d0 ) then - ic2 = ic2-1 - z = z + one - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - y=deltax(ir1,1)/dxc(1) - if( y .lt. 0.d0 ) then - ic1 = ic1-1 - y = y + one - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - x=deltax(ir0,0)/dxc(0) - if( x .lt. 0.d0 ) then - ic0 = ic0-1 - x = x + one - endif - arrayf(if0,if1,if2)= - & ( (arrayc(ic0,ic1,ic2) - & +(arrayc(ic0+1,ic1,ic2)-arrayc(ic0,ic1,ic2))*x)*(one-y) - & +(arrayc(ic0,ic1+1,ic2) - & +(arrayc(ic0+1,ic1+1,ic2)-arrayc(ic0,ic1+1,ic2))*x)*y ) - & *(one-z) - & +( (arrayc(ic0,ic1,ic2+1) - & +(arrayc(ic0+1,ic1,ic2+1)-arrayc(ic0,ic1,ic2+1))*x) - & *(one-y) - & +(arrayc(ic0,ic1+1,ic2+1) - & +(arrayc(ic0+1,ic1+1,ic2+1)-arrayc(ic0,ic1+1,ic2+1))*x)*y) - & *z - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d cell-centered double data -c*********************************************************************** -c - subroutine cartclinrefcelldoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d cell-centered float data -c*********************************************************************** -c - subroutine cartclinrefcellflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2 - real - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d cell-centered complex data -c*********************************************************************** -c - subroutine cartclinrefcellcplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2 - double precision - & coef2real,coef2imag,boundreal,boundimag, - & diff0real,diff0imag,diff1real,diff1imag, - & slopereal,slopeimag - double precision deltax1,deltax2 -c -c*********************************************************************** -c - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - diff0real=dble(diff0(ic0)) - diff0imag=imag(diff0(ic0)) - diff1real=dble(diff0(ic0+1)) - diff1imag=imag(diff0(ic0+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(0) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(0) - else - slopeimag=zero - endif - slope0(ic0,ic1,ic2) = slopereal + cmplx(zero,one)*slopeimag - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - diff0real=dble(diff1(ic1)) - diff0imag=imag(diff1(ic1)) - diff1real=dble(diff1(ic1+1)) - diff1imag=imag(diff1(ic1+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(1) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(1) - else - slopeimag=zero - endif - slope1(ic0,ic1,ic2) = slopereal + cmplx(zero,one)*slopeimag - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - diff0real=dble(diff2(ic2)) - diff0imag=imag(diff2(ic2)) - diff1real=dble(diff2(ic2+1)) - diff1imag=imag(diff2(ic2+1)) - coef2real=half*(diff0real+diff1real) - coef2imag=half*(diff0imag+diff1imag) - boundreal=two*min(abs(diff1real),abs(diff0real)) - boundimag=two*min(abs(diff1imag),abs(diff0imag)) - if (diff0real*diff1real.gt.zero) then - slopereal=sign(min(abs(coef2real),boundreal),coef2real) - & /dxc(2) - else - slopereal=zero - endif - if (diff0imag*diff1imag.gt.zero) then - slopeimag=sign(min(abs(coef2imag),boundimag),coef2imag) - & /dxc(2) - else - slopeimag=zero - endif - slope2(ic0,ic1,ic2) = slopereal + cmplx(zero,one)*slopeimag - enddo - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d edge-centered double data -c*********************************************************************** -c - subroutine cartclinrefedgedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0 - - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefedgedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0+1 - - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefedgedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0+1 - - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d edge-centered float data -c*********************************************************************** -c - subroutine cartclinrefedgeflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0 - - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefedgeflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0+1 - - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefedgeflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0+1 - - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0+1 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d face-centered double data -c*********************************************************************** -c - subroutine cartclinreffacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0+1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - & +slope0(ie0,ic1,ic2)*deltax(ir0,0) - & +slope1(ie0,ic1,ic2)*deltax1 - & +slope2(ie0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinreffacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & diff2(cilo2:cihi2+1), - & slope2(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0) - integer ic1,ic2,ic0,ie1,ie2,ie0,if1,if2,if0, - & ir1,ir2,ir0 - double precision - & coef2,bound - double precision deltax2,deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic1+1,ic2,ic0) - & -arrayc(ic1,ic2,ic0) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ie1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic1=ifirstc1,ilastc1+1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic1,ie2,ic0) - & -arrayc(ic1,ie2-1,ic0) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic1,ic2,ie0) - & -arrayc(ic1,ic2,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - ir1=if1-ie1*ratio(1) - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - & +slope1(ie1,ic2,ic0)*deltax(ir1,1) - & +slope2(ie1,ic2,ic0)*deltax2 - & +slope0(ie1,ic2,ic0)*deltax0 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinreffacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1), - & diff2(cilo2:cihi2+1), - & slope2(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1) - integer ic2,ic0,ic1,ie2,ie0,ie1,if2,if0,if1, - & ir2,ir0,ir1 - double precision - & coef2,bound - double precision deltax0,deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic2+1,ic0,ic1) - & -arrayc(ic2,ic0,ic1) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ie2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ie2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic2=ifirstc2,ilastc2+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic2,ie0,ic1) - & -arrayc(ic2,ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic2,ic0,ie1) - & -arrayc(ic2,ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - ir2=if2-ie2*ratio(2) - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - & +slope2(ie2,ic0,ic1)*deltax(ir2,2) - & +slope0(ie2,ic0,ic1)*deltax0 - & +slope1(ie2,ic0,ic1)*deltax1 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d face-centered float data -c*********************************************************************** -c - subroutine cartclinreffaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax1,deltax2 -c -c*********************************************************************** -c - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0+1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - ir0=if0-ie0*ratio(0) - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - & +slope0(ie0,ic1,ic2)*deltax(ir0,0) - & +slope1(ie0,ic1,ic2)*deltax1 - & +slope2(ie0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinreffaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & diff2(cilo2:cihi2+1), - & slope2(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0) - integer ic1,ic2,ic0,ie1,ie2,ie0,if1,if2,if0, - & ir1,ir2,ir0 - real - & coef2,bound - double precision deltax2,deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic1+1,ic2,ic0) - & -arrayc(ic1,ic2,ic0) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ie1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ie1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic1=ifirstc1,ilastc1+1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic1,ie2,ic0) - & -arrayc(ic1,ie2-1,ic0) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic1,ic2,ie0) - & -arrayc(ic1,ic2,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic1,ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic1,ic2,ic0)=zero - endif - enddo - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - ir1=if1-ie1*ratio(1) - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - & +slope1(ie1,ic2,ic0)*deltax(ir1,1) - & +slope2(ie1,ic2,ic0)*deltax2 - & +slope0(ie1,ic2,ic0)*deltax0 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinreffaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1), - & diff2(cilo2:cihi2+1), - & slope2(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1) - integer ic2,ic0,ic1,ie2,ie0,ie1,if2,if0,if1, - & ir2,ir0,ir1 - real - & coef2,bound - double precision deltax0,deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic2+1,ic0,ic1) - & -arrayc(ic2,ic0,ic1) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ie2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ie2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic2=ifirstc2,ilastc2+1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic2,ie0,ic1) - & -arrayc(ic2,ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2+1 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic2,ic0,ie1) - & -arrayc(ic2,ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic2,ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic2,ic0,ic1)=zero - endif - enddo - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - ir2=if2-ie2*ratio(2) - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - & +slope2(ie2,ic0,ic1)*deltax(ir2,2) - & +slope0(ie2,ic0,ic1)*deltax0 - & +slope1(ie2,ic0,ic1)*deltax1 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d face-centered complex data -c*********************************************************************** -c -c subroutine cartclinreffacecplx3d0( -ccart_clinref_op_face_3d(double complex,0,1,2)c -c subroutine cartclinreffacecplx3d1( -ccart_clinref_op_face_3d(double complex,1,2,0)c -c subroutine cartclinreffacecplx3d2( -ccart_clinref_op_face_3d(double complex,2,0,1)c -c*********************************************************************** -c Linear interpolation for 3d node-centered double data -c*********************************************************************** -c - subroutine cartlinrefnodedoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1) - double precision x,y,z,realrat0,realrat1,realrat2 - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2,i,j,k -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - realrat2=one/dble(ratio(2)) - - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2) - do ir2=0,ratio(2) - ie2=if2+ir2 - if ((ie2.ge.filo2).and.(ie2.le.(fihi2+1))) then - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - z = dble(ir2)*realrat2 - arrayf(ie0,ie1,ie2)= - & ( (arrayc(ic0,ic1,ic2)*(one-x) + - & arrayc(ic0+1,ic1,ic2)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2)*x)*y ) * (one-z) + - & ( (arrayc(ic0,ic1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1,ic2+1)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2+1)*x)*y ) * z - endif - end do - end do - endif - end do - end do - endif - end do - end do - - return - end -c -c*********************************************************************** -c Linear interpolation for 3d node-centered float data -c*********************************************************************** -c - subroutine cartlinrefnodeflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1) - double precision x,y,z,realrat0,realrat1,realrat2 - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2,i,j,k -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - realrat2=one/dble(ratio(2)) - - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2) - do ir2=0,ratio(2) - ie2=if2+ir2 - if ((ie2.ge.filo2).and.(ie2.le.(fihi2+1))) then - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - z = dble(ir2)*realrat2 - arrayf(ie0,ie1,ie2)= - & ( (arrayc(ic0,ic1,ic2)*(one-x) + - & arrayc(ic0+1,ic1,ic2)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2)*x)*y ) * (one-z) + - & ( (arrayc(ic0,ic1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1,ic2+1)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2+1)*x)*y ) * z - endif - end do - end do - endif - end do - end do - endif - end do - end do - - return - end -c -c*********************************************************************** -c Linear interpolation for 3d node-centered complex data -c*********************************************************************** -c - subroutine cartlinrefnodecplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1) - double precision x,y,z,realrat0,realrat1,realrat2 - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2,i,j,k -c -c*********************************************************************** -c - realrat0=one/dble(ratio(0)) - realrat1=one/dble(ratio(1)) - realrat2=one/dble(ratio(2)) - - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2) - do ir2=0,ratio(2) - ie2=if2+ir2 - if ((ie2.ge.filo2).and.(ie2.le.(fihi2+1))) then - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1) - do ir1=0,ratio(1) - ie1=if1+ir1 - if ((ie1.ge.filo1).and.(ie1.le.(fihi1+1))) then - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0) - do ir0=0,ratio(0) - ie0=if0+ir0 - if ((ie0.ge.filo0).and.(ie0.le.(fihi0+1))) then - x = dble(ir0)*realrat0 - y = dble(ir1)*realrat1 - z = dble(ir2)*realrat2 - arrayf(ie0,ie1,ie2)= - & ( (arrayc(ic0,ic1,ic2)*(one-x) + - & arrayc(ic0+1,ic1,ic2)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2)*x)*y ) * (one-z) + - & ( (arrayc(ic0,ic1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1,ic2+1)*x)*(one-y) - & + (arrayc(ic0,ic1+1,ic2+1)*(one-x) + - & arrayc(ic0+1,ic1+1,ic2+1)*x)*y ) * z - endif - end do - end do - endif - end do - end do - endif - end do - end do - - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d outerface double data -c*********************************************************************** -c - subroutine cartclinrefoutfacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo1:cihi1, - & cilo2:cihi2) - integer ic1,ic2,ie1,ie2,if1,if2,ir1,ir2 - double precision - & coef2,bound - double precision deltax2 -c -c*********************************************************************** -c - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie1,ic2) - & -arrayc(ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic1,ic2)=zero - endif - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic1,ie2) - & -arrayc(ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic1,ic2)=zero - endif - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - arrayf(if1,if2)=arrayc(ic1,ic2) - & +slope1(ic1,ic2)*deltax(ir1,1) - & +slope2(ic1,ic2)*deltax2 - enddo - enddo -c - return - end -c - subroutine cartclinrefoutfacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo2:cihi2, - & cilo0:cihi0), - & diff2(cilo2:cihi2+1), - & slope2(cilo2:cihi2, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo2:cihi2, - & cilo0:cihi0) - integer ic2,ic0,ie2,ie0,if2,if0,ir2,ir0 - double precision - & coef2,bound - double precision deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ie2,ic0) - & -arrayc(ie2-1,ic0) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic2,ic0)=zero - endif - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic2,ie0) - & -arrayc(ic2,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic2,ic0)=zero - endif - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - arrayf(if2,if0)=arrayc(ic2,ic0) - & +slope2(ic2,ic0)*deltax(ir2,2) - & +slope0(ic2,ic0)*deltax0 - enddo - enddo -c - return - end -c - subroutine cartclinrefoutfacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - double precision - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d outerface float data -c*********************************************************************** -c - subroutine cartclinrefoutfaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo1:cihi1, - & cilo2:cihi2) - integer ic1,ic2,ie1,ie2,if1,if2,ir1,ir2 - real - & coef2,bound - double precision deltax2 -c -c*********************************************************************** -c - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ic2=ifirstc2,ilastc2 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ie1,ic2) - & -arrayc(ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic1,ic2)=zero - endif - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic1,ie2) - & -arrayc(ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic1,ic2)=zero - endif - enddo - enddo - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - arrayf(if1,if2)=arrayc(ic1,ic2) - & +slope1(ic1,ic2)*deltax(ir1,1) - & +slope2(ic1,ic2)*deltax2 - enddo - enddo -c - return - end -c - subroutine cartclinrefoutfaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0), - & diff1(cilo1:cihi1+1), - & slope1(cilo2:cihi2, - & cilo0:cihi0), - & diff2(cilo2:cihi2+1), - & slope2(cilo2:cihi2, - & cilo0:cihi0), - & diff0(cilo0:cihi0+1), - & slope0(cilo2:cihi2, - & cilo0:cihi0) - integer ic2,ic0,ie2,ie0,if2,if0,ir2,ir0 - real - & coef2,bound - double precision deltax0 -c -c*********************************************************************** -c - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - do ic0=ifirstc0,ilastc0 - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ie2,ic0) - & -arrayc(ie2-1,ic0) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic2,ic0)=zero - endif - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ic2,ie0) - & -arrayc(ic2,ie0-1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic2,ic0)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic2,ic0)=zero - endif - enddo - enddo - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - deltax0=deltax(ir0,0) - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - arrayf(if2,if0)=arrayc(ic2,ic0) - & +slope2(ic2,ic0)*deltax(ir2,2) - & +slope0(ic2,ic0)*deltax0 - enddo - enddo -c - return - end -c - subroutine cartclinrefoutfaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,ie0,ie1,if0,if1,ir0,ir1 - real - & coef2,bound - double precision deltax1 -c -c*********************************************************************** -c - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - do ic1=ifirstc1,ilastc1 - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1) - & -arrayc(ie0-1,ic1) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1)=zero - endif - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1) - & -arrayc(ic0,ie1-1) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1)=zero - endif - enddo - enddo - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - arrayf(if0,if1)=arrayc(ic0,ic1) - & +slope0(ic0,ic1)*deltax(ir0,0) - & +slope1(ic0,ic1)*deltax1 - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d outerface complex data -c*********************************************************************** -c -c subroutine cartclinrefoutfacecplx3d0( -ccart_clinref_op_outerface_3d(double complex,0,1,2)c -c subroutine cartclinrefoutfacecplx3d1( -ccart_clinref_op_outerface_3d(double complex,1,2,0)c -c subroutine cartclinrefoutfacecplx3d2( -ccart_clinref_op_outerface_3d(double complex,2,0,1)c -c*********************************************************************** -c Conservative linear interpolation for 3d side-centered double data -c*********************************************************************** -c - subroutine cartclinrefsidedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefsidedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefsidedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - double precision - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d side-centered float data -c*********************************************************************** -c - subroutine cartclinrefsideflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=dble(ir0)*dxf(0) - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0-1,ilastc0+1 - diff0(ic0)=arrayc(ic0+1,ic1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie0=ifirstc0,ilastc0+1 - coef2=half*(diff0(ie0-1)+diff0(ie0)) - bound=two*min(abs(diff0(ie0-1)),abs(diff0(ie0))) - if (diff0(ie0)*diff0(ie0-1).gt.zero) then - slope0(ie0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ie0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0+1 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0+1 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefsideflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff1,slope1,diff2,slope2,diff0,slope0) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=dble(ir1)*dxf(1) - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=(dble(ir2)+half)*dxf(2)-dxc(2)*half - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic1=ifirstc1,ilastc1+1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2 - - do ic0=ifirstc0,ilastc0 - - do ic1=ifirstc1-1,ilastc1+1 - diff1(ic1)=arrayc(ic0,ic1+1,ic2) - & -arrayc(ic0,ic1,ic2) - enddo - do ie1=ifirstc1,ilastc1+1 - coef2=half*(diff1(ie1-1)+diff1(ie1)) - bound=two*min(abs(diff1(ie1-1)),abs(diff1(ie1))) - if (diff1(ie1)*diff1(ie1-1).gt.zero) then - slope1(ic0,ie1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ie1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1+1 - - do ic0=ifirstc0,ilastc0 - - do ie2=ifirstc2,ilastc2+1 - diff2(ie2)=arrayc(ic0,ic1,ie2) - & -arrayc(ic0,ic1,ie2-1) - enddo - do ic2=ifirstc2,ilastc2 - coef2=half*(diff2(ic2+1)+diff2(ic2)) - bound=two*min(abs(diff2(ic2+1)),abs(diff2(ic2))) - if (diff2(ic2)*diff2(ic2+1).gt.zero) then - slope2(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c - subroutine cartclinrefsideflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & arrayc,arrayf, - & diff2,slope2,diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none - double precision zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & dxc(0:3-1), - & dxf(0:3-1), - & deltax(0:15,0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1), - & diff2(cilo2:cihi2+1), - & slope2(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff0(cilo0:cihi0+1), - & slope0(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & diff1(cilo1:cihi1+1), - & slope1(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1) - integer ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2, - & ir0,ir1,ir2 - real - & coef2,bound - double precision deltax2,deltax1 -c -c*********************************************************************** -c - - - do ir0=0,ratio(0)-1 - deltax(ir0,0)=(dble(ir0)+half)*dxf(0)-dxc(0)*half - enddo - - - do ir1=0,ratio(1)-1 - deltax(ir1,1)=(dble(ir1)+half)*dxf(1)-dxc(1)*half - enddo - - - do ir2=0,ratio(2)-1 - deltax(ir2,2)=dble(ir2)*dxf(2) - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic1=ifirstc1,ilastc1 - - do ie0=ifirstc0,ilastc0+1 - diff0(ie0)=arrayc(ie0,ic1,ic2) - & -arrayc(ie0-1,ic1,ic2) - enddo - do ic0=ifirstc0,ilastc0 - coef2=half*(diff0(ic0+1)+diff0(ic0)) - bound=two*min(abs(diff0(ic0+1)),abs(diff0(ic0))) - if (diff0(ic0)*diff0(ic0+1).gt.zero) then - slope0(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(0) - else - slope0(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic2=ifirstc2,ilastc2+1 - - do ic0=ifirstc0,ilastc0 - - do ie1=ifirstc1,ilastc1+1 - diff1(ie1)=arrayc(ic0,ie1,ic2) - & -arrayc(ic0,ie1-1,ic2) - enddo - do ic1=ifirstc1,ilastc1 - coef2=half*(diff1(ic1+1)+diff1(ic1)) - bound=two*min(abs(diff1(ic1+1)),abs(diff1(ic1))) - if (diff1(ic1)*diff1(ic1+1).gt.zero) then - slope1(ic0,ic1,ic2)=sign(min(abs(coef2),bound),coef2) - & /dxc(1) - else - slope1(ic0,ic1,ic2)=zero - endif - enddo - enddo - enddo - - - do ic1=ifirstc1,ilastc1 - - do ic0=ifirstc0,ilastc0 - - do ic2=ifirstc2-1,ilastc2+1 - diff2(ic2)=arrayc(ic0,ic1,ic2+1) - & -arrayc(ic0,ic1,ic2) - enddo - do ie2=ifirstc2,ilastc2+1 - coef2=half*(diff2(ie2-1)+diff2(ie2)) - bound=two*min(abs(diff2(ie2-1)),abs(diff2(ie2))) - if (diff2(ie2)*diff2(ie2-1).gt.zero) then - slope2(ic0,ic1,ie2)=sign(min(abs(coef2),bound),coef2) - & /dxc(2) - else - slope2(ic0,ic1,ie2)=zero - endif - enddo - enddo - enddo - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - ir0=if0-ic0*ratio(0) - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - & +slope0(ic0,ic1,ic2)*deltax(ir0,0) - & +slope1(ic0,ic1,ic2)*deltax1 - & +slope2(ic0,ic1,ic2)*deltax2 - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Conservative linear interpolation for 3d side-centered complex data -c*********************************************************************** -c -c subroutine cartclinrefsidecplx3d0( -ccart_clinref_op_side_3d(double complex,0,1,2)c -c subroutine cartclinrefsidecplx3d1( -ccart_clinref_op_side_3d(double complex,1,2,0)c -c subroutine cartclinrefsidecplx3d2( -ccart_clinref_op_side_3d(double complex,2,0,1)c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.m4 index 7546fc0c..a866a40d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_cartrefine3d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 3d patch data -c on a regular Cartesian mesh. -c -include(geom_m4cartrefineops3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 3d patch data +c on a regular Cartesian mesh. +c +include(FORTDIR/geom_m4cartrefineops3d.i)dnl c c*********************************************************************** c Linear interpolation for 3d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops1d.i index 02d0537c..4f4c0b97 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops1d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d Cartesian coarsen operators. c define(NDIM,1)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl define(cart_coarsen_op_subroutine_head_1d,`dnl & ifirstc0,ilastc0, & filo0,fihi0, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops2d.i index aade0342..5caeec7f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops2d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d Cartesian coarsen operators. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl define(cart_coarsen_op_subroutine_head_2d,`dnl & ifirstc0,ifirstc1,ilastc0,ilastc1, & filo0,filo1,fihi0,fihi1, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops3d.i index 359858b6..aab1b5f0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops3d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d Cartesian coarsen operators. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl define(cart_coarsen_op_subroutine_head_3d,`dnl & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, & filo0,filo1,filo2,fihi0,fihi1,fihi2, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops4d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops4d.i new file mode 100644 index 00000000..369f6a1b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartcoarsenops4d.i @@ -0,0 +1,167 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 4d Cartesian coarsen operators. +c +define(NDIM,4)dnl +include(PDAT_FORTDIR/pdat_m4arrdim4d.i)dnl +define(cart_coarsen_op_subroutine_head_4d,`dnl + & ifirstc0,ifirstc1,ifirstc2,ifirstc3, + & ilastc0,ilastc1,ilastc2,ilastc3, + & filo0,filo1,filo2,filo3,fihi0,fihi1,fihi2,fihi3, + & cilo0,cilo1,cilo2,cilo3,cihi0,cihi1,cihi2,cihi3, + & ratio,dxf,dxc, + & arrayf,arrayc) +c*********************************************************************** + implicit none + double precision zero + parameter (zero=0.d0) +c + integer + & ifirstc0,ifirstc1,ifirstc2,ifirstc3, + & ilastc0,ilastc1,ilastc2,ilastc3, + & filo0,filo1,filo2,filo3,fihi0,fihi1,fihi2,fihi3, + & cilo0,cilo1,cilo2,cilo3,cihi0,cihi1,cihi2,cihi3 + integer ratio(0:NDIM-1) + double precision + & dxf(0:NDIM-1), + & dxc(0:NDIM-1) +')dnl +c +define(cart_wgtavg_cell_body_4d,`dnl +c +c*********************************************************************** +c + dVf = dxf(0)*dxf(1)*dxf(2)*dxf(3) + dVc = dxc(0)*dxc(1)*dxc(2)*dxc(3) + + do ic3=ifirstc3,ilastc3 + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 +ifelse($1,`double complex',`dnl + arrayc(ic0,ic1,ic2,ic3)=cmplx(zero,zero) +',`dnl + arrayc(ic0,ic1,ic2,ic3)=zero +')dnl + enddo + enddo + enddo + enddo + + do ir3=0,ratio(3)-1 + do ir2=0,ratio(2)-1 + do ir1=0,ratio(1)-1 + do ir0=0,ratio(0)-1 + do ic3=ifirstc3,ilastc3 + if3=ic3*ratio(3)+ir3 + do ic2=ifirstc2,ilastc2 + if2=ic2*ratio(2)+ir2 + do ic1=ifirstc1,ilastc1 + if1=ic1*ratio(1)+ir1 + do ic0=ifirstc0,ilastc0 + if0=ic0*ratio(0)+ir0 + arrayc(ic0,ic1,ic2,ic3)= + & arrayc(ic0,ic1,ic2,ic3)+ + & arrayf(if0,if1,if2,if3)*dVf + enddo + enddo + enddo + enddo + enddo + enddo + enddo + enddo + + do ic3=ifirstc3,ilastc3 + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + arrayc(ic0,ic1,ic2,ic3)=arrayc(ic0,ic1,ic2,ic3)/dVc + enddo + enddo + enddo + enddo +c + return + end +')dnl +c +define(cart_wgtavg_face_body_4d,`dnl +c +c*********************************************************************** +c + volf=dxf($3)*dxf($4)*dxf($5) + volc=dxc($3)*dxc($4)*dxc($5) + + do ic$5=ifirstc$5,ilastc$5 + do ic$4=ifirstc$4,ilastc$4 + do ic$3=ifirstc$3,ilastc$3 + do ie$2=ifirstc$2,ilastc$2+1 +ifelse($1,`double complex',`dnl + arrayc(ie$2,ic$3,ic$4,ic$5)=cmplx(zero,zero) +',`dnl + arrayc(ie$2,ic$3,ic$4,ic$5)=zero +')dnl + enddo + enddo + enddo + enddo + + do ir$5=0,ratio($5)-1 + do ir$4=0,ratio($4)-1 + do ir$3=0,ratio($3)-1 + do ic$5=ifirstc$5,ilastc$5 + if$5=ic$5*ratio($5)+ir$5 + do ic$4=ifirstc$4,ilastc$4 + if$4=ic$4*ratio($4)+ir$4 + do ic$3=ifirstc$3,ilastc$3 + if$3=ic$3*ratio($3)+ir$3 + do ie$2=ifirstc$2,ilastc$2+1 + if$2=ie$2*ratio($2) + arrayc(ie$2,ic$3,ic$4,ic$5)= + & arrayc(ie$2,ic$3,ic$4,ic$5) + & +arrayf(if$2,if$3,if$4,if$5)*volf + enddo + enddo + enddo + enddo + enddo + enddo + enddo + + do ic$5=ifirstc$5,ilastc$5 + do ic$4=ifirstc$4,ilastc$4 + do ic$3=ifirstc$3,ilastc$3 + do ie$2=ifirstc$2,ilastc$2+1 + arrayc(ie$2,ic$3,ic$4,ic$5)= + & arrayc(ie$2,ic$3,ic$4,ic$5)/volc + enddo + enddo + enddo + enddo +c + return + end +')dnl +c +define(cart_wgtavg_op_cell_4d,`dnl +cart_coarsen_op_subroutine_head_4d()dnl + $1 + & arrayf(CELL4d(filo,fihi,0)), + & arrayc(CELL4d(cilo,cihi,0)) + double precision dVf,dVc + integer ic0,ic1,ic2,ic3,if0,if1,if2,if3,ir0,ir1,ir2,ir3 +cart_wgtavg_cell_body_4d($1)dnl +')dnl +define(cart_wgtavg_op_face_4d,`dnl +cart_coarsen_op_subroutine_head_4d()dnl + $1 + & arrayf(FACE4d$2(filo,fihi,0)), + & arrayc(FACE4d$2(cilo,cihi,0)) + double precision volf,volc + integer ie$2,ic$3,ic$4,ic$5,if$2,if$3,if$4,if$5,ir$3,ir$4,ir$5 +cart_wgtavg_face_body_4d($1,$2,$3,$4,$5)dnl +')dnl diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartopstuff.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartopstuff.i index a3d284fa..802ebcfe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartopstuff.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartopstuff.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for cartesian geometry transfer routines. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for cartesian geometry transfer routines. c define(coarsen_index,`dnl if ($1.lt.0) then diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops1d.i index 82c856f6..c5acdc76 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops1d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d Cartesian refine operators. c define(NDIM,1)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl -include(geom_m4cartopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl +include(FORTDIR/geom_m4cartopstuff.i)dnl c define(cart_refine_op_subroutine_head_1d,`dnl & ifirstc0,ilastc0, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops2d.i index 10aa26a2..b263a8df 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops2d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d Cartesian refine operators. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(geom_m4cartopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/geom_m4cartopstuff.i)dnl c define(cart_refine_op_subroutine_head_2d,`dnl & ifirstc0,ifirstc1,ilastc0,ilastc1, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops3d.i index 9216a48c..ec52a3a6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/geom/fortran/geom_m4cartrefineops3d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI geometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d Cartesian refine operators. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(geom_m4cartopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/geom_m4cartopstuff.i)dnl c define(cart_refine_op_subroutine_head_3d,`dnl & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.C new file mode 100644 index 00000000..3c2737b6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.C @@ -0,0 +1,352 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fast assumed partition for a set of boxes. + * + ************************************************************************/ +#include "SAMRAI/hier/AssumedPartition.h" +#include "SAMRAI/hier/BaseGridGeometry.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace hier { + +/* + ******************************************************************************** + ******************************************************************************** + */ +AssumedPartition::AssumedPartition(): + d_parted_boxes(), + d_rank_begin(0), + d_rank_end(0), + d_index_begin(0), + d_index_end(0) +{ +} + +/* + ******************************************************************************** + ******************************************************************************** + */ +AssumedPartition::AssumedPartition( + const BoxContainer& unpartitioned_boxes, + int rank_begin, + int rank_end, + int index_begin, + double avg_parts_per_rank, + bool interleave): + d_parted_boxes(), + d_rank_begin(rank_begin), + d_rank_end(rank_end), + d_index_begin(index_begin), + d_index_end(index_begin) +{ + partition(unpartitioned_boxes, rank_begin, rank_end, index_begin, + avg_parts_per_rank, interleave); +} + +/* + ******************************************************************************** + * Partition the given boxes. + * + * Partition the rank space into intervals roughly proportional to the + * given boxes then partition each box across its corresponding rank + * space interval. + ******************************************************************************** + */ +void +AssumedPartition::partition( + const BoxContainer& unpartitioned_boxes, + int rank_begin, + int rank_end, + int index_begin, + double avg_parts_per_rank, + bool interleave) +{ + TBOX_ASSERT(rank_end > rank_begin); + d_parted_boxes.clear(); + d_rank_begin = rank_begin; + d_rank_end = rank_end; + d_index_begin = index_begin; + d_index_end = index_begin; + + size_t num_cells = 0; + for (BoxContainer::const_iterator bi = unpartitioned_boxes.begin(); + bi != unpartitioned_boxes.end(); ++bi) { + num_cells += bi->size(); + } + + d_parted_boxes.reserve(unpartitioned_boxes.size()); + + const int num_ranks = rank_end - rank_begin; + double rank_space_cut_lo = 0.0; + double rank_space_cut_hi = 0.0; + size_t cell_count = 0; + for (BoxContainer::const_iterator bi = unpartitioned_boxes.begin(); + bi != unpartitioned_boxes.end(); ++bi) { + cell_count += bi->size(); + + rank_space_cut_lo = rank_space_cut_hi; + rank_space_cut_hi = static_cast(cell_count) / static_cast(num_cells); + + int box_rank_begin = static_cast(rank_space_cut_lo * num_ranks + 0.5); + int box_rank_end = static_cast(rank_space_cut_hi * num_ranks + 0.5); + + // Ensure at least one rank is assigned to this box. + if (box_rank_end == box_rank_begin) { + const double midpoint = 0.5 * (rank_space_cut_lo + rank_space_cut_hi); + box_rank_begin = static_cast(midpoint * num_ranks + 0.5); + box_rank_begin = tbox::MathUtilities::Min(box_rank_begin, d_rank_end - 1); + box_rank_end = box_rank_begin + 1; + } + + d_parted_boxes.push_back( + AssumedPartitionBox(*bi, box_rank_begin, box_rank_end, d_index_end, + avg_parts_per_rank, interleave)); + d_index_end = d_parted_boxes.back().end(); + } + +} + +/* + ******************************************************************************** + * Return index of first box assigned to given rank. + ******************************************************************************** + */ +int +AssumedPartition::beginOfRank(int rank) const +{ + for (size_t i = 0; i < d_parted_boxes.size(); ++i) { + const int begin = d_parted_boxes[i].beginOfRank(rank); + const int end = d_parted_boxes[i].endOfRank(rank); + // If end <= begin, rank owns nothing in this assumed partition. + if (end > begin) { + return begin; + } + } + return d_index_end; +} + +/* + ******************************************************************************** + * Return one past index of last box assigned to given rank. + ******************************************************************************** + */ +int +AssumedPartition::endOfRank(int rank) const +{ + for (PartedBoxes::const_reverse_iterator pi = d_parted_boxes.rbegin(); + pi != d_parted_boxes.rend(); + ++pi) { + const int begin = pi->beginOfRank(rank); + const int end = pi->endOfRank(rank); + // If end <= begin, rank owns nothing in this assumed partition. + if (end > begin) { + return end; + } + } + return d_index_end; +} + +/* + ******************************************************************************** + * Compute the box with the given index. + ******************************************************************************** + */ +int +AssumedPartition::getOwner(int box_index) const +{ + TBOX_ASSERT(box_index >= d_index_begin); + TBOX_ASSERT(box_index < d_index_end); + + for (size_t i = 0; i < d_parted_boxes.size(); ++i) { + if (box_index >= d_parted_boxes[i].begin() && + box_index < d_parted_boxes[i].end()) { + return d_parted_boxes[i].getOwner(box_index); + } + } + + TBOX_ERROR("AssumedPartition::getBox(): Should never be here."); + return tbox::SAMRAI_MPI::getInvalidRank(); +} + +/* + ******************************************************************************** + * Compute the box with the given index. + ******************************************************************************** + */ +Box +AssumedPartition::getBox(int box_index) const +{ + TBOX_ASSERT(box_index >= d_index_begin); + TBOX_ASSERT(box_index < d_index_end); + + for (size_t i = 0; i < d_parted_boxes.size(); ++i) { + if (box_index >= d_parted_boxes[i].begin() && + box_index < d_parted_boxes[i].end()) { + return d_parted_boxes[i].getBox(box_index); + } + } + + TBOX_ERROR("AssumedPartition::getBox(): Should never be here."); + return Box(tbox::Dimension(1)); +} + +/* +******************************************************************************** +* Compute all boxes. +******************************************************************************** +*/ +void +AssumedPartition::getAllBoxes(BoxContainer& all_boxes) const +{ + for (int id = d_index_begin; id < d_index_end; ++id) { + d_parted_boxes[id].getAllBoxes(all_boxes); + } +} + +/* +******************************************************************************** +* Compute all boxes owned by the given rank. +******************************************************************************** +*/ +void +AssumedPartition::getAllBoxes(BoxContainer& all_boxes, int rank) const +{ + const int id_begin = beginOfRank(rank); + const int id_end = endOfRank(rank); + for (int id = id_begin; id < id_end; ++id) { + all_boxes.push_back(getBox(id)); + } +} + +/* + ******************************************************************************** + * Find all boxes intersecting the given box. Return whether any boxes overlap. + ******************************************************************************** + */ +bool +AssumedPartition::findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box, + const BaseGridGeometry& grid_geometry, + const IntVector& refinement_ratio) const +{ + int old_count = overlapping_boxes.size(); + + for (PartedBoxes::const_iterator pi = d_parted_boxes.begin(); pi != d_parted_boxes.end(); + ++pi) { + if (pi->getNumberOfParts() != 0) { + Box transformed_box = box; + grid_geometry.transformBox(transformed_box, + refinement_ratio, + pi->getUnpartitionedBox().getBlockId(), + box.getBlockId()); + if (transformed_box.getBlockId() == pi->getUnpartitionedBox().getBlockId()) { + pi->findOverlaps(overlapping_boxes, transformed_box); + } + } + } + + return overlapping_boxes.size() > old_count; +} + +/* + ******************************************************************************** + * Find all boxes intersecting the given box. Return whether any boxes overlap. + ******************************************************************************** + */ +bool +AssumedPartition::findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box) const +{ + int old_count = overlapping_boxes.size(); + + for (PartedBoxes::const_iterator pi = d_parted_boxes.begin(); pi != d_parted_boxes.end(); + ++pi) { + if (pi->getUnpartitionedBox().getBlockId() != + d_parted_boxes[0].getUnpartitionedBox().getBlockId()) { + TBOX_ERROR("AssumedPartition::findOverlaps: This method may be used only\n" + << "for AssumedPartitions the same BlockId. For multiple blocks,\n" + << "use the version that requires a BaseGridGeometry.\n"); + } + pi->findOverlaps(overlapping_boxes, box); + } + + return overlapping_boxes.size() > old_count; +} + +/* + ******************************************************************************** + * Check the assumed partition for errors and inconsistencies. Write + * error diagnostics to plog. + * + * Return number of errors found. This class should prevent (or at + * least catch) user errors, so any error found here indicates a bug in + * the class. + ******************************************************************************** + */ +size_t +AssumedPartition::selfCheck() const +{ + size_t nerr = 0; + + for (size_t i = 0; i < d_parted_boxes.size(); ++i) { + nerr += d_parted_boxes[i].selfCheck(); + if (i > 0) { + if (d_parted_boxes[i].begin() < d_parted_boxes[i - 1].end()) { + tbox::plog << "AssumedPartition::selfCheck(): index from unpartitioned box " + << i << " overlaps index from unpartitioned box " << i - 1 << std::endl; + ++nerr; + } + } + } + + return nerr; +} + +/* + ******************************************************************************** + ******************************************************************************** + */ +void +AssumedPartition::recursivePrint( + std::ostream& co, + const std::string& border, + int detail_depth) const +{ + const char* to = ".."; + co << border + << "indices (" << d_index_end - d_index_begin << "): " + << d_index_begin << to << d_index_end - 1 + << " ranks (" << d_rank_end - d_rank_begin << "): " + << d_rank_begin << to << d_rank_end - 1 + << '\n'; + co << border << d_parted_boxes.size() << " pre-partition boxes:\n"; + for (size_t i = 0; i < d_parted_boxes.size(); ++i) { + co << border << " d_parted_boxes[" << i << "]:\n"; + d_parted_boxes[i].recursivePrint(co, border + " ", detail_depth - 1); + } +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.h new file mode 100644 index 00000000..8f72841a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartition.h @@ -0,0 +1,215 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fast assumed partition for a set of boxes. + * + ************************************************************************/ +#ifndef included_hier_AssumedPartition +#define included_hier_AssumedPartition + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/AssumedPartitionBox.h" +#include "SAMRAI/hier/BoxContainer.h" + +namespace SAMRAI { +namespace hier { + +/*! + * @brief Compute an assumed partition of a set of boxes. The assumed + * partition should very fast to create and query and requires minimal + * storage. + * + * An assumed partition avoids extreme imbalances, but its purpose is + * not fine load balancing. + * + * See also AssumedPartitionBox. + */ +class AssumedPartition +{ + +public: + /*! + * @brief Construct AssumedPartition of a set of boxes. + * + * @param[in] unpartitioned_boxes Incoming unpartitioned boxes + * + * @param[in] rank_begin First rank + * + * @param[in] rank_end One past last rank + * + * @param[in] index_begin + * + * @param[in] avg_parts_per_rank See partition() + * + * @param[in] interleave See partition() + */ + AssumedPartition( + const BoxContainer& unpartitioned_boxes, + int rank_begin, + int rank_end, + int index_begin = 0, + double avg_parts_per_rank = 1.0, + bool interleave = false); + + /*! + * @brief Construct an empty AssumedPartition. + */ + AssumedPartition(); + + /*! + * @brief Destructor. + */ + ~AssumedPartition() { + } + + /*! + * @brief Partition a set of boxes, discarding the current state. + * + * @param[in] unpartitioned_boxes Incoming unpartitioned boxes + * + * @param[in] rank_begin First rank + * + * @param[in] rank_end One past last rank + * + * @param[in] index_begin + * + * @param[in] avg_parts_per_rank Algorithm normally tries to + * average one partition per rank. This parameter is a request to + * change that. + * + * @param[in] interleave Algorithm normally assign consecutive box + * indices to a process. This flag causes it to interleave + * (round-robin) the box assignments. + */ + void + partition( + const BoxContainer& unpartitioned_boxes, + int rank_begin, + int rank_end, + int index_begin = 0, + double avg_parts_per_rank = 1.0, + bool interleave = false); + + //! @brief Number of box partitions. + size_t getNumberOfParts() const { + return d_index_end - d_index_begin; + } + + //! @brief Return the owner for a partition box. + int + getOwner( + int box_index) const; + + //! @brief Return partition box for given index. + Box + getBox( + int box_index) const; + + //! @brief Get all partition boxes. + void + getAllBoxes( + BoxContainer& all_boxes) const; + + //! @brief Get all partition boxes for a given rank. + void + getAllBoxes( + BoxContainer& all_boxes, + int rank) const; + + //! @brief Return index of first partition box. + int begin() const { + return d_index_begin; + } + + //! @brief Return one past index of last partition box. + int end() const { + return d_index_end; + } + + //! @brief Return index of first partition box assigned to given rank. + int + beginOfRank( + int rank) const; + + //! @brief Return one past index of last partition box assigned to given rank. + int + endOfRank( + int rank) const; + + /*! + * @brief Find box partitions overlapping the given box. + * + * @param[out] overlapping_boxes + * @param[in] box + * @param[in] grid_geometry + * @param[in] refinement_ratio + * + * @return Whether any partitions are found. + */ + bool + findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box, + const BaseGridGeometry& grid_geometry, + const IntVector& refinement_ratio) const; + + /*! + * @brief Find partitions overlapping the given box, when all boxes + * are in the same block. + * + * An unrecoverable error will be thrown if there are multiple blocks. + * + * @param[out] overlapping_boxes + * @param[in] box + * + * @return Whether any partitions are found. + */ + bool + findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box) const; + + /*! + * @brief Check the assumed partition for errors and + * inconsistencies. Write error diagnostics to plog. + * + * @return Number of errors found. (Errors indicate + * a bug in this class.) + */ + size_t + selfCheck() const; + + /*! + * @brief Print info from this object + * + * @param[in,out] os The output stream + * @param[in] border + * @param[in] detail_depth + */ + void + recursivePrint( + std::ostream& os, + const std::string& border, + int detail_depth = 2) const; + +private: + //! @brief Shorthand. + typedef std::vector PartedBoxes; + + PartedBoxes d_parted_boxes; + + int d_rank_begin; + int d_rank_end; + int d_index_begin; + int d_index_end; + +}; + +} +} + +#endif // included_hier_AssumedPartition diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.C new file mode 100644 index 00000000..2446b8d8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.C @@ -0,0 +1,607 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fast assumed partition for a box. + * + ************************************************************************/ +#include "SAMRAI/hier/AssumedPartitionBox.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace hier { + +/* + ******************************************************************************** + ******************************************************************************** + */ +AssumedPartitionBox::AssumedPartitionBox( + const Box& box, + int rank_begin, + int rank_end, + int index_begin, + double avg_parts_per_rank, + bool interleave): + d_box(box), + d_rank_begin(rank_begin), + d_rank_end(rank_end), + d_index_begin(index_begin), + d_index_end(-1), + d_uniform_partition_size(box.getDim()), + d_partition_grid_size(box.getDim()), + d_major(box.getDim()), + d_index_stride(box.getDim()), + d_interleave(interleave) +{ + computeLayout(avg_parts_per_rank); + assignToRanks(); +} + +/* + ******************************************************************************** + ******************************************************************************** + */ +AssumedPartitionBox::AssumedPartitionBox( + const tbox::Dimension& dim): + d_box(dim), + d_rank_begin(-1), + d_rank_end(-1), + d_index_begin(-1), + d_index_end(-1), + d_uniform_partition_size(dim), + d_partition_grid_size(dim), + d_major(dim), + d_index_stride(dim), + d_interleave(false) +{ +} + +/* + ******************************************************************************** + * Partition the given box, discarding the current state. + ******************************************************************************** + */ +void +AssumedPartitionBox::partition( + const Box& box, + int rank_begin, + int rank_end, + int index_begin, + double avg_parts_per_rank, + bool interleave) +{ + d_box = box; + d_rank_begin = rank_begin; + d_rank_end = rank_end; + d_index_begin = index_begin; + d_interleave = interleave; + computeLayout(avg_parts_per_rank); + assignToRanks(); +} + +/* + ******************************************************************************** + * Return index of first box assigned to given rank. + ******************************************************************************** + */ +int +AssumedPartitionBox::beginOfRank(int rank) const +{ + if (d_interleave) { + TBOX_ERROR("AssumedPartitionBox::beginOfRank: You should not use beginOfRank()\n" + << " or endOfRank() for an interleaved AsssumedPartitionBox object\n" + << " because indices owned by the same rank are not contiguous.\n"); + } + int index = + rank < d_rank_begin ? d_index_begin : + rank < d_first_rank_with_1 ? + d_first_index_with_2 + (rank - d_rank_begin) * (1 + d_parts_per_rank) : + rank < d_first_rank_with_0 ? + d_first_index_with_1 + (rank - d_first_rank_with_1) * d_parts_per_rank : + d_index_end; + return index; +} + +/* + ******************************************************************************** + * Return one past index of last box assigned to given rank. + ******************************************************************************** + */ +int +AssumedPartitionBox::endOfRank(int rank) const +{ + if (d_interleave) { + TBOX_ERROR("AssumedPartitionBox::beginOfRank: You should not use beginOfRank()\n" + << " or endOfRank() for an interleaved AsssumedPartitionBox object\n" + << " because indices owned by the same rank are not contiguous.\n"); + } + int index = + rank < d_rank_begin ? d_index_begin : + rank < d_first_rank_with_1 ? + d_first_index_with_2 + (1 + rank - d_rank_begin) * (1 + d_parts_per_rank) : + rank < d_first_rank_with_0 ? + d_first_index_with_1 + (1 + rank - d_first_rank_with_1) * d_parts_per_rank : + d_index_end; + return index; +} + +/* + ******************************************************************************** + * Compute the owner of the given index. + ******************************************************************************** + */ +int +AssumedPartitionBox::getOwner(int box_index) const +{ + TBOX_ASSERT(box_index >= d_index_begin); + TBOX_ASSERT(box_index < d_index_begin + getNumberOfParts()); + + int owner = tbox::SAMRAI_MPI::getInvalidRank(); + + if (d_interleave) { + if (box_index >= d_index_begin && box_index < d_index_end) { + owner = d_rank_begin + (box_index - d_rank_begin) / (d_rank_end - d_rank_begin); + } + } else { + if (box_index < d_index_begin || box_index >= d_index_end) { + // Not an index in this object ==> invalid owner. + } else if (box_index < d_first_index_with_1) { + owner = d_rank_begin + (box_index - d_first_index_with_2) / (1 + d_parts_per_rank); + } else if (box_index < d_index_end) { + owner = d_first_rank_with_1 + (box_index - d_first_index_with_1) / d_parts_per_rank; + } + } + return owner; +} + +/* + ******************************************************************************** + * Compute the partition box with the given index. + ******************************************************************************** + */ +Box +AssumedPartitionBox::getBox(int box_index) const +{ + TBOX_ASSERT(box_index >= d_index_begin); + TBOX_ASSERT(box_index < d_index_begin + d_partition_grid_size.getProduct()); + + // Set lower corner in partition grid resolution, based on the box_index. + Box part(d_box); + int box_index_diff = box_index - d_index_begin; + for (int d = d_box.getDim().getValue() - 1; d >= 0; --d) { + int dir = d_major[d]; + part.setLower(static_cast(dir), box_index_diff / d_index_stride[dir]); + box_index_diff -= part.lower()[dir] * d_index_stride[dir]; + } + + // Refine lower corner and set upper corner. + part.setLower(part.lower() * d_uniform_partition_size); + part.setLower(part.lower() + d_box.lower()); + part.setUpper(part.lower() + d_uniform_partition_size - IntVector::getOne(d_box.getDim())); + part *= d_box; + + return Box(part, LocalId(box_index), getOwner(box_index)); +} + +/* + ******************************************************************************** + * Compute the partition box with the given position in the grid of partitions. + ******************************************************************************** + */ +Box +AssumedPartitionBox::getBox(const IntVector& position) const +{ + TBOX_ASSERT(position >= IntVector::getZero(d_box.getDim())); + TBOX_ASSERT(position < d_partition_grid_size); + + int box_index = d_index_begin; + for (int d = 0; d < d_box.getDim().getValue(); ++d) { + box_index += position[d] * d_index_stride[d]; + } + const int owner = getOwner(box_index); + const Index tmp_index(position); + Box part(tmp_index, + tmp_index, + d_box.getBlockId(), + LocalId(box_index), + owner); + part.refine(d_uniform_partition_size); + part.shift(d_box.lower()); + part *= d_box; + return part; +} + +/* + ******************************************************************************** + * Compute all partition boxes. + ******************************************************************************** + */ +void +AssumedPartitionBox::getAllBoxes(BoxContainer& all_boxes) const +{ + const int id_begin = begin(); + const int id_end = end(); + for (int id = id_begin; id < id_end; ++id) { + all_boxes.push_back(getBox(id)); + } +} + +/* + ******************************************************************************** + * Compute all partition boxes owned by the given rank. + ******************************************************************************** + */ +void +AssumedPartitionBox::getAllBoxes(BoxContainer& all_boxes, int rank) const +{ + const int id_begin = beginOfRank(rank); + const int id_end = endOfRank(rank); + for (int id = id_begin; id < id_end; ++id) { + all_boxes.push_back(getBox(id)); + } +} + +/* + ******************************************************************************** + * Find all partition boxes overlapping the given box. Return whether + * any boxes were found. + ******************************************************************************** + */ +bool +AssumedPartitionBox::findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box) const +{ + Box coarsened_box = box; + coarsened_box.coarsen(d_uniform_partition_size); + coarsened_box *= Box(Index(IntVector::getZero(d_box.getDim())), + Index(d_partition_grid_size - IntVector::getOne(d_box.getDim())), + d_box.getBlockId()); + for (Box::iterator ci = coarsened_box.begin(); ci != coarsened_box.end(); ++ci) { + overlapping_boxes.insert(getBox(*ci)); + } + return !coarsened_box.empty(); +} + +/* + ******************************************************************************** + * Check the assumed partition for errors and inconsistencies. Write + * error diagnostics to plog. + * + * Return number of errors found. This class should prevent (or at + * least catch) user errors, so any error found here indicates a bug in + * the class. + ******************************************************************************** + */ +size_t +AssumedPartitionBox::selfCheck() const +{ + size_t nerr = 0; + + BoxContainer all_parts; + for (int box_index = begin(); box_index != end(); ++box_index) { + const Box box = getBox(box_index); + if (box.getOwnerRank() == tbox::SAMRAI_MPI::getInvalidRank() || + box.getOwnerRank() < d_rank_begin || box.getOwnerRank() >= d_rank_end) { + ++nerr; + tbox::plog << "AssumedPartitionerBox::selfCheck(): Box " + << box << " has owner outside expected range of [" + << d_rank_begin << ',' << d_rank_end << ')' + << std::endl; + } + all_parts.pushBack(getBox(box_index)); + } + all_parts.makeTree(); + + // All parts should match boxes gotten through partition grid indices. + const Box partition_grid(Index(IntVector::getZero(d_box.getDim())), + Index(d_partition_grid_size - IntVector::getOne(d_box.getDim())), + d_box.getBlockId()); + BoxContainer all_parts_by_grid; + for (Box::iterator gi = partition_grid.begin(); gi != partition_grid.end(); ++gi) { + all_parts_by_grid.pushBack(getBox(*gi)); + } + // all_parts_by_grid may be in different order, so sort before comparing. + all_parts.order(); + all_parts_by_grid.order(); + if (all_parts_by_grid != all_parts) { + ++nerr; + tbox::plog << "AssumedPartitionerBox::selfCheck(): Boxes gotten by\n" + << "index loop differs from boxes gotten by grid loop.\n" + << "Boxes by index loop:\n" << all_parts.format("\t") << '\n' + << "Boxes by grid loop:\n" << all_parts_by_grid.format("\t") << '\n'; + } + all_parts.unorder(); + all_parts_by_grid.clear(); + + // Parts should not overlap each other. + BoxContainer tmp_boxes; + for (BoxContainer::const_iterator bi = all_parts.begin(); bi != all_parts.end(); ++bi) { + const Box& box = *bi; + all_parts.findOverlapBoxes(tmp_boxes, box); + tmp_boxes.order(); + if (!tmp_boxes.empty()) { + BoxContainer::iterator self = tmp_boxes.find(box); + if (self != tmp_boxes.end()) { + tmp_boxes.erase(self); + } + } + if (!tmp_boxes.empty()) { + nerr += tmp_boxes.size(); + tbox::plog << "AssumedPartitionerBox::selfCheck(): Box " + << box << " unexpectedly overlaps these:\n" + << tmp_boxes.format("\t") << std::endl; + } + tmp_boxes.clear(); + } + + // Parts should cover no less than d_box. + BoxContainer box_leftover(d_box); + box_leftover.removeIntersections(all_parts); + if (!box_leftover.empty()) { + nerr += box_leftover.size(); + tbox::plog << "AssumedPartitionerBox::selfCheck(): Partitions cover less than box " + << d_box << " Portions not covered by partitions:\n" + << box_leftover.format("\t") << std::endl; + } + + // Parts should cover no more than d_box. + BoxContainer parts_leftover = all_parts; + parts_leftover.removeIntersections(d_box); + if (!parts_leftover.empty()) { + nerr += parts_leftover.size(); + tbox::plog << "AssumedPartitionerBox::selfCheck(): Partitions cover more than box " + << d_box << " Portions outside the box:\n" + << parts_leftover.format("\t") << std::endl; + } + + if (!d_interleave) { + for (int rank = d_rank_begin; rank < d_rank_end; ++rank) { + const int ibegin = beginOfRank(rank); + const int iend = endOfRank(rank); + if (rank > d_rank_begin) { + if (ibegin < endOfRank(rank - 1)) { + ++nerr; + tbox::plog << "AssumedPartitionBox::selfCheck(): Index ranges overlap.\n" + << "Rank " << rank << " has [" << ibegin << ',' << iend << ")\n" + << "Rank " << rank - 1 << " has [" << beginOfRank(rank - 1) + << ',' << endOfRank(rank - 1) << ")\n"; + } + } + const int number_owned = iend - ibegin; + const int expected_number = + rank < d_first_rank_with_1 ? d_parts_per_rank + 1 : + rank < d_first_rank_with_0 ? d_parts_per_rank : 0; + if (number_owned != expected_number) { + ++nerr; + tbox::plog << "AssumedPartition::selfCheck(): Wrong parts count for rank " << rank + << ".\n" + << "It should own " << expected_number << ", but it owns " << number_owned + << ".\n"; + } + for (int id = ibegin; id < iend; ++id) { + const int owner = getOwner(id); + if (owner != rank) { + ++nerr; + tbox::plog << "AssumedPartition::selfCheck(): Wrong owner for id " << id << ".\n" + << "Id " << id << " is owned by " << owner << " but rank " << rank + << " is assined the range (" << ibegin << ',' << iend << ").\n"; + } + } + } + } + + return nerr; +} + +/* + ******************************************************************************** + * Compute the partition lay-out. We use a grid of uniform sized + * partitions whose union covers d_box and as little else as possible. + */ +void +AssumedPartitionBox::computeLayout(double avg_parts_per_rank) +{ + const IntVector box_size = d_box.numberCells(); + + const int num_ranks = d_rank_end - d_rank_begin; + + if (box_size == 0) { + d_uniform_partition_size = d_partition_grid_size = IntVector::getZero(d_box.getDim()); + } else { + /* + * Compute uniform partition size and how many partitions in each + * direction. There isn't one correct lay-out, but we try to avoid + * excessive aspect ratios. + */ + const int target_parts_count = static_cast(num_ranks * avg_parts_per_rank + 0.5); + d_uniform_partition_size = box_size; + d_partition_grid_size = IntVector::getOne(d_box.getDim()); + long int parts_count = d_partition_grid_size.getProduct(); + IntVector num_parts_can_increase(d_box.getDim(), 1); + IntVector sorter(d_box.getDim()); + while (parts_count < target_parts_count && + num_parts_can_increase != IntVector::getZero(d_box.getDim())) { + sorter.sortIntVector(d_uniform_partition_size); + int inc_dir = 0; + for (inc_dir = d_box.getDim().getValue() - 1; inc_dir >= 0; --inc_dir) { + if (num_parts_can_increase[sorter[inc_dir]]) break; + } + inc_dir = sorter[inc_dir]; + + // Double partition grid size, unless it causes too many partitions. + if (2 * parts_count > target_parts_count) { + const long int cross_section = parts_count / d_partition_grid_size[inc_dir]; + d_partition_grid_size[inc_dir] = + static_cast((target_parts_count + cross_section - 1) / cross_section); + parts_count = d_partition_grid_size.getProduct(); + } else { + d_partition_grid_size[inc_dir] *= 2; + parts_count *= 2; + } + + d_uniform_partition_size = IntVector::ceilingDivide(box_size, d_partition_grid_size); + num_parts_can_increase[inc_dir] = d_uniform_partition_size[inc_dir] > 1; + } + TBOX_ASSERT(parts_count == d_partition_grid_size.getProduct()); + + // There can be partitions completele outside d_box. Remove them. + d_partition_grid_size = IntVector::ceilingDivide(box_size, d_uniform_partition_size); + } + + d_index_end = d_index_begin + static_cast(d_partition_grid_size.getProduct()); + + d_major.sortIntVector(d_partition_grid_size); + + for (int d = 0; d < d_box.getDim().getValue(); ++d) { + int dir = d_major[d]; + d_index_stride[dir] = 1; + for (int d1 = d - 1; d1 >= 0; --d1) { + d_index_stride[dir] *= d_partition_grid_size[d_major[d1]]; + } + } +} + +/* + ******************************************************************************** + * Compute rank assignment for the partition lay-out. + ******************************************************************************** + */ +void +AssumedPartitionBox::assignToRanks() +{ + if (d_interleave) { + // No special settings needed. + } else { + assignToRanks_contiguous(); + } +} + +/* + ******************************************************************************** + * Compute rank assignment for the partition lay-out where each rank in + * [d_rank_begin,d_rank_end) gets a contiguous set of box indices in + * [d_index_begin,d_index_end). + * + * Each rank has 0, d_parts_per_rank or 1+d_parts_per_rank partitions. + * Lower ranks have more partitions than higher ranks do. + ******************************************************************************** + */ +void +AssumedPartitionBox::assignToRanks_contiguous() +{ + TBOX_ASSERT(d_index_end - d_index_begin == d_partition_grid_size.getProduct()); + + /* + * If there are more ranks than parts, the first getNumberOfParts() + * ranks have 1 part each and the rest have none. If there are + * more parts than ranks, lower ranks have (d_parts_per_rank_1+1) + * parts each and higher ranks have d_parts_per_rank each. In + * second case, index vs rank looks like this: + * + * index ^ + * | + * i0 | ...... + * | . + * | . + * | . + * i1 | . + * | . + * | . + * | . + * |. + * i2 +-----------------------> rank + * r2 r1 r0 + * + * (r2,i2) = first rank with 1+d_parts_per_rank parts, its first index + * (r1,i1) = first rank with d_parts_per_rank parts, its first index + * (r0,i0) = first rank with 0 parts, d_index_end + * if r1==r2, no rank has 1+d_parts_per_rank parts (more ranks than parts) + * if r0==r1, no rank has d_parts_per_rank parts + */ + if (d_index_end - d_index_begin <= d_rank_end - d_rank_begin) { + d_parts_per_rank = 1; + d_first_rank_with_1 = d_rank_begin; + d_first_rank_with_0 = d_rank_begin + static_cast(d_partition_grid_size.getProduct()); + d_first_index_with_1 = d_first_index_with_2 = d_index_begin; + } else { + d_parts_per_rank = (d_index_end - d_index_begin) / (d_rank_end - d_rank_begin); + d_first_index_with_2 = d_index_begin; + d_first_rank_with_1 = d_rank_begin + + (d_index_end - d_index_begin) % (d_rank_end - d_rank_begin); + d_first_index_with_1 = d_first_index_with_2 + + (1 + d_parts_per_rank) * (d_first_rank_with_1 - d_rank_begin); + d_first_rank_with_0 = d_rank_end; + } +} + +/* + ******************************************************************************** + ******************************************************************************** + */ +void +AssumedPartitionBox::recursivePrint( + std::ostream& co, + const std::string& border, + int detail_depth) const +{ + const char* to = ".."; + co << border << "d_box = " << d_box << " " + << d_box.numberCells() << "|" << d_box.size() + << '\n' << border + << "d_uniform_partition_size = " << d_uniform_partition_size + << " d_partition_grid_size = " << d_partition_grid_size + << " d_major = " << d_major + << " d_index_stride = " << d_index_stride + << '\n' << border + << "indices (" << d_partition_grid_size.getProduct() << "): " + << d_index_begin << to << d_index_begin + d_partition_grid_size.getProduct() - 1 + << " ranks (" << d_rank_end - d_rank_begin << "): " + << d_rank_begin << to << d_rank_end - 1 + << " parts_per_rank=" << d_parts_per_rank + << " interleave=" << d_interleave + << '\n' << border + << "ranks with " << d_parts_per_rank + 1 << " parts (" << d_first_rank_with_1 + - d_rank_begin << "): " + << d_rank_begin << to << d_first_rank_with_1 - 1 + << '\n' << border + << "ranks with " << d_parts_per_rank << " parts (" << d_first_rank_with_0 + - d_first_rank_with_1 << "): " + << d_first_rank_with_1 << to << d_first_rank_with_0 - 1 + << '\n' << border + << "ranks with 0 parts (" << d_rank_end - d_first_rank_with_0 << "): " + << d_first_rank_with_0 << to << d_rank_end - 1 + << '\n' << border + << "d_first_rank_with_1=" << d_first_rank_with_1 + << " d_first_rank_with_0=" << d_first_rank_with_0 + << " d_first_index_with_1=" << d_first_index_with_1 + << " d_first_index_with_2=" << d_first_index_with_2 + << std::endl; + if (detail_depth > 0) { + BoxContainer parts; + for (int box_index = begin(); box_index != end(); ++box_index) { + parts.pushBack(getBox(box_index)); + } + co << border << "Parts: " << parts.format(border); + } +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.h new file mode 100644 index 00000000..1d0c8828 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/AssumedPartitionBox.h @@ -0,0 +1,281 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fast assumed partition for a single box. + * + ************************************************************************/ +#ifndef included_hier_AssumedPartitionBox +#define included_hier_AssumedPartitionBox + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/IntVector.h" + +namespace SAMRAI { +namespace hier { + +/*! + * @brief Compute an assumed partition of a box. The assumed + * partition should very fast to create and query and requires minimal + * storage. + * + * An assumed partition avoids extreme imbalances, but its purpose is + * not fine load balancing. + */ +class AssumedPartitionBox +{ + +public: + /*! + * @brief Construct AssumedPartition from a box. + * + * @param[in] unpartitioned_box Incoming unpartitioned box + * + * @param[in] rank_begin First rank + * + * @param[in] rank_end One past last rank + * + * @param[in] index_begin First index + * + * @param[in] avg_parts_per_rank See partition() + * + * @param[in] interleave See partition() + */ + AssumedPartitionBox( + const Box& unpartitioned_box, + int rank_begin, + int rank_end, + int index_begin = 0, + double avg_parts_per_rank = 1.0, + bool interleave = false); + + /*! + * @brief Nearly default constructor. + */ + AssumedPartitionBox( + const tbox::Dimension& dim); + + /*! + * @brief Partition the given box, discarding the current state. + * + * The partition should degerate correctly if the box is empty, i.e., + * the partition size and count should be zero. + * + * @param[in] unpartitioned_box Incoming unpartitioned box + * @param[in] rank_begin First rank + * @param[in] rank_end One past last rank + * @param[in] index_begin + * + * @param[in] avg_parts_per_rank Algorithm normally tries to get + * one partition per rank. This parameter is a request to change + * that. + * + * @param[in] interleave Algorithm normally assign consecutive box + * indices to a process. This flag causes it to interleave + * (round-robin) the box assignments. + */ + void + partition( + const Box& unpartitioned_box, + int rank_begin, + int rank_end, + int index_begin = 0, + double avg_parts_per_rank = 1.0, + bool interleave = false); + + /*! + * @brief Destructor. + */ + ~AssumedPartitionBox() { + } + + //! @brief Return the original unpartitioned box. + const Box& getUnpartitionedBox() const { + return d_box; + } + + //! @brief Number of box partitions. + int getNumberOfParts() const { + return d_index_end - d_index_begin; + } + + //! @brief Return the owner for a box. + int + getOwner( + int box_index) const; + + //! @brief Return box for given index. + Box + getBox( + int box_index) const; + + //! @brief Return box for given partition's position in the partition grid. + Box + getBox( + const IntVector& position) const; + + //! @brief Get all partition boxes. + void + getAllBoxes( + BoxContainer& all_boxes) const; + + //! @brief Get all partition boxes owned by a given rank. + void + getAllBoxes( + BoxContainer& all_boxes, + int rank) const; + + //! @brief Return index of first partition box. + int begin() const { + return d_index_begin; + } + + //! @brief Return one past index of last partition box. + int end() const { + return d_index_end; + } + + /*! + * @brief Return index of first box in the contiguous index range + * assigned to given rank. + * + * This method should not be used for objects when the ranks are + * interleaved. + * + * If rank is lower than ranks in partitioning, return first index. + * If rank is higher than ranks in partitioning, return one past + * last index. + */ + int + beginOfRank( + int rank) const; + + /*! + * @brief Return one past index of last box in the contiguous index + * range assigned to given rank. + * + * This method should not be used for objects when the ranks are + * interleaved. + * + * If rank is lower than ranks in partitioning, return first index. + * If rank is higher than ranks in partitioning, return one past + * last index. + */ + int + endOfRank( + int rank) const; + + /*! + * @brief Find box partitions overlapping the given box. + * + * The search cost is proportional to number of overlapping boxes + * found, NOT the total number of partitions. + * + * @param[out] overlapping_boxes + * @param[in] box + * + * @return Whether any partitions are found. + */ + bool + findOverlaps( + BoxContainer& overlapping_boxes, + const Box& box) const; + + /*! + * @brief Check the assumed partition for errors and + * inconsistencies. Write error diagnostics to plog. + * + * @return Number of errors found. (Errors indicate + * a bug in this class.) + */ + size_t + selfCheck() const; + + /*! + * @brief Print info from this object + * + * @param[in,out] os The output stream + * @param[in] border + * @param[in] detail_depth + */ + void + recursivePrint( + std::ostream& os, + const std::string& border, + int detail_depth = 2) const; + +private: + //! @brief Compute the partition lay-out. + void + computeLayout( + double avg_parts_per_rank); + + //! @brief Compute rank assignment for the partition lay-out. + void + assignToRanks(); + + /*! + * @brief Compute rank assignment for the partition lay-out, using + * contiguous index assignments. + */ + void + assignToRanks_contiguous(); + + //! @brief Box partitioned. + Box d_box; + //! @brief First rank. + int d_rank_begin; + //! @brief One past last rank. + int d_rank_end; + //! @brief Index for first partition box. + int d_index_begin; + //! @brief One past index of last partition box. + int d_index_end; + + //! @brief Size of each uniform partition. + IntVector d_uniform_partition_size; + //! @brief Number of partitions in each direction (size of partition grid). + IntVector d_partition_grid_size; + + //! @brief Directions sorted from small to big, in d_partition_grid_size. + IntVector d_major; + //! @brief Stride of box index in each direction of the partition grid. + IntVector d_index_stride; + + //! @brief Whether to interleave box assignments using round-robin. + bool d_interleave; + + //@{ + //! @name Parameters for partition assignment in non-interleaved mode + + /*! + * @brief Min (or max) parts per rank when there are more (fewer) + * parts than ranks. + */ + int d_parts_per_rank; + + //! @see assignToRanks_contiguous() + int d_first_rank_with_1; + + //! @see assignToRanks_contiguous() + int d_first_rank_with_0; + + //! @see assignToRanks_contiguous() + int d_first_index_with_2; + + //! @see assignToRanks_contiguous() + int d_first_index_with_1; + + //@} + +}; + +} +} + +#endif // included_hier_AssumedPartitionBox diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.C index 59bfc3c7..38016824 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Algorithms for working with mapping Connectors. * ************************************************************************/ -#ifndef included_hier_BaseConnectorAlgorithm_C -#define included_hier_BaseConnectorAlgorithm_C - #include "SAMRAI/hier/BaseConnectorAlgorithm.h" #include "SAMRAI/hier/BoxContainer.h" @@ -19,8 +16,6 @@ namespace hier { const int BaseConnectorAlgorithm::BASE_CONNECTOR_ALGORITHM_FIRST_DATA_LENGTH = 1000; -char BaseConnectorAlgorithm::s_print_steps = '\0'; - /* *********************************************************************** *********************************************************************** @@ -50,7 +45,8 @@ BaseConnectorAlgorithm::setupCommunication( const std::set& incoming_ranks, const std::set& outgoing_ranks, const boost::shared_ptr& mpi_wait_timer, - int& operation_mpi_tag) const + int& operation_mpi_tag, + bool print_steps) const { /* * Set up communication mechanism (and post receives). We lump all @@ -60,7 +56,9 @@ BaseConnectorAlgorithm::setupCommunication( comm_stage.setCommunicationWaitTimer(mpi_wait_timer); const int n_comm = static_cast( incoming_ranks.size() + outgoing_ranks.size()); - all_comms = new tbox::AsyncCommPeer[n_comm]; + if (n_comm > 0) { + all_comms = new tbox::AsyncCommPeer[n_comm]; + } const int tag0 = ++operation_mpi_tag; const int tag1 = ++operation_mpi_tag; @@ -79,7 +77,7 @@ BaseConnectorAlgorithm::setupCommunication( incoming_comm.limitFirstDataLength( BASE_CONNECTOR_ALGORITHM_FIRST_DATA_LENGTH); incoming_comm.beginRecv(); - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "Receiving from " << incoming_comm.getPeerRank() << std::endl; } @@ -99,7 +97,7 @@ BaseConnectorAlgorithm::setupCommunication( outgoing_comm.setMPITag(tag0, tag1); outgoing_comm.limitFirstDataLength( BASE_CONNECTOR_ALGORITHM_FIRST_DATA_LENGTH); - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "Sending to " << outgoing_comm.getPeerRank() << std::endl; } @@ -109,30 +107,29 @@ BaseConnectorAlgorithm::setupCommunication( /* *********************************************************************** * privateBridge/Modify_findOverlapsForOneProcess() cached some discovered - * remote neighbors into send_mesg. sendDiscoveryToOneProcess() sends - * the message. + * remote neighbors into send_mesg. packReferencedNeighbors() packs the + * message with this information. * * privateBridge/Modify_findOverlapsForOneProcess() placed neighbor data * in referenced_new_head_nabrs and referenced_new_base_nabrs rather than - * directly into send_mesg. This method packs the referenced neighbors - * and send them. + * directly into send_mesg. This method packs the referenced neighbors. *********************************************************************** */ void -BaseConnectorAlgorithm::sendDiscoveryToOneProcess( +BaseConnectorAlgorithm::packReferencedNeighbors( std::vector& send_mesg, - const int idx_offset_to_ref, - BoxContainer& referenced_new_head_nabrs, - BoxContainer& referenced_new_base_nabrs, - tbox::AsyncCommPeer& outgoing_comm, - const tbox::Dimension& dim) const + int idx_offset_to_ref, + const BoxContainer& referenced_new_head_nabrs, + const BoxContainer& referenced_new_base_nabrs, + const tbox::Dimension& dim, + bool print_steps) const { /* * Fill the messages's reference section with all the neighbors * that have been referenced. */ const int offset = send_mesg[idx_offset_to_ref] = - static_cast(send_mesg.size()); + static_cast(send_mesg.size()); const int n_referenced_nabrs = static_cast( referenced_new_head_nabrs.size() + referenced_new_base_nabrs.size()); const int reference_section_size = @@ -146,34 +143,26 @@ BaseConnectorAlgorithm::sendDiscoveryToOneProcess( *(ptr++) = static_cast(referenced_new_head_nabrs.size()); for (BoxContainer::const_iterator ni = referenced_new_base_nabrs.begin(); ni != referenced_new_base_nabrs.end(); ++ni) { - const Box& mapped_box = *ni; - mapped_box.putToIntBuffer(ptr); + const Box& box = *ni; + box.putToIntBuffer(ptr); ptr += Box::commBufferSize(dim); } for (BoxContainer::const_iterator ni = referenced_new_head_nabrs.begin(); ni != referenced_new_head_nabrs.end(); ++ni) { - const Box& mapped_box = *ni; - mapped_box.putToIntBuffer(ptr); + const Box& box = *ni; + box.putToIntBuffer(ptr); ptr += Box::commBufferSize(dim); } - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "sending " << referenced_new_base_nabrs.size() - << " referenced_new_base_nabrs:" - << referenced_new_base_nabrs.format("\n ") << std::endl + << " referenced_new_base_nabrs:\n" + << referenced_new_base_nabrs.format(" ") << std::endl << "sending " << referenced_new_head_nabrs.size() - << " referenced_new_head_nabrs:" - << referenced_new_head_nabrs.format("\n ") << std::endl; + << " referenced_new_head_nabrs:\n" + << referenced_new_head_nabrs.format(" ") << std::endl; } TBOX_ASSERT(ptr == &send_mesg[send_mesg.size() - 1] + 1); - - /* - * Send message. - */ - outgoing_comm.beginSend(&send_mesg[0], static_cast(send_mesg.size())); - if (s_print_steps == 'y') { - tbox::plog << "Sent to " << outgoing_comm.getPeerRank() << std::endl; - } } /* @@ -185,37 +174,37 @@ void BaseConnectorAlgorithm::receiveAndUnpack( Connector& new_base_to_new_head, Connector* new_head_to_new_base, - std::set& incoming_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + tbox::AsyncCommPeer* all_comms, tbox::AsyncCommStage& comm_stage, - const boost::shared_ptr& receive_and_unpack_timer) const + const boost::shared_ptr& receive_and_unpack_timer, + bool print_steps) const { receive_and_unpack_timer->start(); /* * Receive and unpack messages. */ - while ( comm_stage.numberOfCompletedMembers() > 0 || - comm_stage.advanceSome() ) { + while (comm_stage.hasCompletedMembers() || comm_stage.advanceSome()) { tbox::AsyncCommPeer* peer = - dynamic_cast *>(comm_stage.popCompletionQueue()); + CPP_CAST *>(comm_stage.popCompletionQueue()); - TBOX_ASSERT(peer != NULL); + TBOX_ASSERT(peer != 0); if ((size_t)(peer - all_comms) < incoming_ranks.size()) { // Receive from this peer. - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "Received from " << peer->getPeerRank() << std::endl; } unpackDiscoveryMessage( peer, new_base_to_new_head, - new_head_to_new_base); - } - else { + new_head_to_new_base, + print_steps); + } else { // Sent to this peer. No follow-up needed. - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "Sent to " << peer->getPeerRank() << std::endl; } } @@ -233,7 +222,8 @@ void BaseConnectorAlgorithm::unpackDiscoveryMessage( const tbox::AsyncCommPeer* incoming_comm, Connector& new_base_to_new_head, - Connector* new_head_to_new_base) const + Connector* new_head_to_new_base, + bool print_steps) const { const int sender = incoming_comm->getPeerRank(); const int* ptr = incoming_comm->getRecvData(); @@ -252,7 +242,7 @@ BaseConnectorAlgorithm::unpackDiscoveryMessage( /* * Content of send_mesg, constructed largely in * privateBridge/Modify_findOverlapsForOneProcess() and - * sendDiscoveryToOneProcess(): + * packReferencedNeighbors(): * * -neighbor-removal section cached in neighbor_removal_mesg. * - offset to the reference section (see below) @@ -273,30 +263,33 @@ BaseConnectorAlgorithm::unpackDiscoveryMessage( */ // Unpack neighbor-removal section. + // TODO: Get rid of 2 unused values, making sure adjustments in message sizes + // is correct. const int num_removed_boxes = *(ptr++); for (int ii = 0; ii < num_removed_boxes; ++ii) { const LocalId id_gone(*(ptr++)); - const BlockId block_id_gone(*(ptr++)); + // Skip unneeded value. + ++ptr; const int number_affected = *(ptr++); const Box box_gone(dim, GlobalId(id_gone, sender)); - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "Box " << box_gone << " removed, affecting " << number_affected << " boxes." << std::endl; } -//TODO: Is BoxId usage in this method correct regarding block id? for (int iii = 0; iii < number_affected; ++iii) { const LocalId id_affected(*(ptr++)); - const BlockId block_id_affected(*(ptr++)); + // Skip unneeded block id. + ++ptr; BoxId affected_nbrhd(id_affected, rank); - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << " Removing " << box_gone << " from nabr list for " << id_affected << std::endl; } TBOX_ASSERT(new_base_to_new_head.hasLocalNeighbor( - affected_nbrhd, - box_gone)); + affected_nbrhd, + box_gone)); new_base_to_new_head.eraseNeighbor(box_gone, affected_nbrhd); } TBOX_ASSERT(ptr != ptr_end); @@ -313,14 +306,13 @@ BaseConnectorAlgorithm::unpackDiscoveryMessage( const int n_reference_new_base_boxes = *(ref_box_ptr++); const int n_reference_new_head_boxes = *(ref_box_ptr++); - TBOX_ASSERT(new_head_to_new_base != NULL || n_new_head_boxes == 0); + TBOX_ASSERT(new_head_to_new_base != 0 || n_new_head_boxes == 0); #ifdef DEBUG_CHECK_ASSERTIONS const int correct_msg_size = offset + 2 /* counters of new_head and new_base reference boxes */ + Box::commBufferSize(dim) * n_reference_new_base_boxes - + Box::commBufferSize(dim) * n_reference_new_head_boxes - ; + + Box::commBufferSize(dim) * n_reference_new_head_boxes; TBOX_ASSERT(msg_size == correct_msg_size); #endif @@ -341,13 +333,13 @@ BaseConnectorAlgorithm::unpackDiscoveryMessage( } TBOX_ASSERT(ref_box_ptr == ptr_end); - if (s_print_steps == 'y') { + if (print_steps) { tbox::plog << "received " << n_reference_new_base_boxes - << " referenced_new_base_nabrs:" - << referenced_new_base_nabrs.format("\n ") << std::endl + << " referenced_new_base_nabrs:\n" + << referenced_new_base_nabrs.format(" ") << std::endl << "received " << n_reference_new_head_boxes - << " referenced_new_head_nabrs:" - << referenced_new_head_nabrs.format("\n ") << std::endl; + << " referenced_new_head_nabrs:\n" + << referenced_new_head_nabrs.format(" ") << std::endl; } /* @@ -408,4 +400,3 @@ BaseConnectorAlgorithm::unpackDiscoveryMessage( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.h index 83a8c55f..6011db14 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseConnectorAlgorithm.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Algorithms to work with maping Connectors. * ************************************************************************/ @@ -44,17 +44,21 @@ class BaseConnectorAlgorithm const std::set& incoming_ranks, const std::set& outgoing_ranks, const boost::shared_ptr& mpi_wait_timer, - int& operation_mpi_tag) const; + int& operation_mpi_tag, + bool print_steps) const; - //! @brief Send discovery to one processor during privateBridge/Modify. + /*! + * @brief Pack referenced neighbors discovered during privateBridge/Modify + * into message for one processor. + */ void - sendDiscoveryToOneProcess( + packReferencedNeighbors( std::vector& send_mesg, - const int idx_offset_to_ref, - BoxContainer& referenced_new_head_nabrs, - BoxContainer& referenced_new_base_nabrs, - tbox::AsyncCommPeer& outgoing_comm, - const tbox::Dimension& dim) const; + int idx_offset_to_ref, + const BoxContainer& referenced_new_head_nabrs, + const BoxContainer& referenced_new_base_nabrs, + const tbox::Dimension& dim, + bool print_steps) const; /*! * @brief Receive messages and unpack info sent from other processes. @@ -63,26 +67,25 @@ class BaseConnectorAlgorithm receiveAndUnpack( Connector& new_base_to_new_head, Connector* new_head_to_new_base, - std::set& incoming_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + tbox::AsyncCommPeer* all_comms, tbox::AsyncCommStage& comm_stage, - const boost::shared_ptr& receive_and_unpack_timer) const; - - //! @brief Unpack message sent by sendDiscoverytoOneProcess(). - void - unpackDiscoveryMessage( - const tbox::AsyncCommPeer* incoming_comm, - Connector& west_to_east, - Connector* east_to_west) const; - - // Extra checks independent of optimization/debug. - static char s_print_steps; + const boost::shared_ptr& receive_and_unpack_timer, + bool print_steps) const; private: /* * Data length limit on first message of a communication. */ static const int BASE_CONNECTOR_ALGORITHM_FIRST_DATA_LENGTH; + + //! @brief Unpack message sent by sendDiscoverytoOneProcess(). + void + unpackDiscoveryMessage( + const tbox::AsyncCommPeer* incoming_comm, + Connector& west_to_east, + Connector* east_to_west, + bool print_steps) const; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.C index 72882b77..23f62e84 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.C @@ -3,38 +3,26 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management in AMR hierarchy * ************************************************************************/ - -#ifndef included_hier_BaseGridGeometry_C -#define included_hier_BaseGridGeometry_C - #include "SAMRAI/hier/BaseGridGeometry.h" #include "SAMRAI/hier/BoundaryLookupTable.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxContainerSingleBlockIterator.h" -#include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/hier/BoxTree.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/hier/SingularityFinder.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/StartupShutdownManager.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include -#include +#include "boost/shared_ptr.hpp" +#include "boost/make_shared.hpp" #include #include +#include #define HIER_GRID_GEOMETRY_VERSION (3) @@ -65,6 +53,7 @@ boost::shared_ptr BaseGridGeometry::t_set_boundary_boxes; boost::shared_ptr BaseGridGeometry::t_set_geometry_data_on_patches; boost::shared_ptr BaseGridGeometry::t_compute_boundary_boxes_on_level; boost::shared_ptr BaseGridGeometry::t_get_boundary_boxes; +boost::shared_ptr BaseGridGeometry::t_adjust_multiblock_patch_level_boundaries; /* ************************************************************************* @@ -79,30 +68,31 @@ BaseGridGeometry::BaseGridGeometry( const tbox::Dimension& dim, const std::string& object_name, const boost::shared_ptr& input_db, - bool register_for_restart): + bool allow_multiblock): d_transfer_operator_registry( boost::make_shared(dim)), d_dim(dim), d_object_name(object_name), d_periodic_shift(IntVector::getZero(d_dim)), + d_periodic_shift_catalog(d_dim), d_max_data_ghost_width(IntVector(d_dim, -1)), - d_has_enhanced_connectivity(false), - d_registered_for_restart(register_for_restart) + d_ratio_to_level_zero(1, IntVector::getOne(d_dim)), + d_ratios_are_isotropic(true), + d_has_enhanced_connectivity(false) { TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + tbox::RestartManager::getManager()->registerRestartItem(getObjectName(), + this); bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (is_from_restart && d_registered_for_restart) { + if (is_from_restart) { getFromRestart(); } - getFromInput(input_db, is_from_restart); + getFromInput(input_db, is_from_restart, allow_multiblock); + } /* @@ -116,117 +106,85 @@ BaseGridGeometry::BaseGridGeometry( */ BaseGridGeometry::BaseGridGeometry( const std::string& object_name, - const BoxContainer& domain, - bool register_for_restart): + BoxContainer& domain): d_transfer_operator_registry( boost::make_shared( (*(domain.begin())).getDim())), d_dim((*(domain.begin())).getDim()), d_object_name(object_name), - d_physical_domain(domain), + d_physical_domain(), d_periodic_shift(IntVector::getZero(d_dim)), + d_periodic_shift_catalog(d_dim), d_max_data_ghost_width(IntVector(d_dim, -1)), d_number_of_block_singularities(0), - d_has_enhanced_connectivity(false), - d_registered_for_restart(register_for_restart) + d_ratio_to_level_zero(1, IntVector::getOne(d_dim)), + d_ratios_are_isotropic(true), + d_has_enhanced_connectivity(false) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(domain.size() > 0); + TBOX_ASSERT(!domain.empty()); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + tbox::RestartManager::getManager()-> + registerRestartItem(getObjectName(), this); - std::set block_numbers; - for (BoxContainer::const_iterator itr = domain.begin(); itr != domain.end(); + LocalId local_id(0); + std::set block_numbers; + for (BoxContainer::iterator itr = domain.begin(); itr != domain.end(); ++itr) { block_numbers.insert(itr->getBlockId().getBlockValue()); + BoxId box_id(local_id++, 0); + itr->setId(box_id); } - d_number_blocks = static_cast(block_numbers.size()); - d_reduced_connect.resizeArray(d_number_blocks, false); - d_block_neighbors.resizeArray(d_number_blocks); + d_number_blocks = block_numbers.size(); + if (d_ratio_to_level_zero[0].getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero[0] = + IntVector(IntVector::getOne(d_dim), d_number_blocks); + } + + d_block_neighbors.resize(d_number_blocks); setPhysicalDomain(domain, d_number_blocks); } BaseGridGeometry::BaseGridGeometry( - const tbox::Dimension& dim, const std::string& object_name, + BoxContainer& domain, const boost::shared_ptr& op_reg): d_transfer_operator_registry(op_reg), - d_dim(dim), - d_object_name(object_name), - d_periodic_shift(IntVector::getZero(d_dim)), - d_max_data_ghost_width(IntVector(d_dim, -1)), - d_number_blocks(1), - d_number_of_block_singularities(0), - d_block_neighbors(1), - d_singularity(1), - d_singularity_indices(1), - d_reduced_connect(1), - d_has_enhanced_connectivity(false), - d_registered_for_restart(false) -{ - TBOX_ASSERT(!object_name.empty()); -} - -BaseGridGeometry::BaseGridGeometry( - const tbox::Dimension& dim, - const std::string& object_name): - d_transfer_operator_registry( - boost::make_shared(dim)), - d_dim(dim), - d_object_name(object_name), - d_periodic_shift(IntVector::getZero(d_dim)), - d_max_data_ghost_width(IntVector(d_dim, -1)), - d_number_blocks(1), - d_number_of_block_singularities(0), - d_block_neighbors(1), - d_singularity(1), - d_singularity_indices(1), - d_reduced_connect(1), - d_has_enhanced_connectivity(false), - d_registered_for_restart(false) -{ - TBOX_ASSERT(!object_name.empty()); -} - -BaseGridGeometry::BaseGridGeometry( - const std::string& object_name, - const BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart) : - d_transfer_operator_registry(op_reg), d_dim((*(domain.begin())).getDim()), d_object_name(object_name), - d_physical_domain(domain), + d_physical_domain(), d_periodic_shift(IntVector::getZero(d_dim)), + d_periodic_shift_catalog(d_dim), d_max_data_ghost_width(IntVector(d_dim, -1)), d_number_of_block_singularities(0), - d_has_enhanced_connectivity(false), - d_registered_for_restart(register_for_restart) + d_ratio_to_level_zero(1, IntVector::getOne(d_dim)), + d_ratios_are_isotropic(true), + d_has_enhanced_connectivity(false) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(domain.size() > 0); + TBOX_ASSERT(!domain.empty()); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(getObjectName(), this); - } + tbox::RestartManager::getManager()-> + registerRestartItem(getObjectName(), this); - std::set block_numbers; - for (BoxContainer::const_iterator itr = domain.begin(); itr != domain.end(); + LocalId local_id(0); + std::set block_numbers; + for (BoxContainer::iterator itr = domain.begin(); itr != domain.end(); ++itr) { block_numbers.insert(itr->getBlockId().getBlockValue()); + BoxId box_id(local_id++, 0); + itr->setId(box_id); } - d_number_blocks = static_cast(block_numbers.size()); - d_reduced_connect.resizeArray(d_number_blocks, false); - d_block_neighbors.resizeArray(d_number_blocks); + d_number_blocks = block_numbers.size(); + if (d_ratio_to_level_zero[0].getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero[0] = + IntVector(IntVector::getOne(d_dim), d_number_blocks); + } + d_block_neighbors.resize(d_number_blocks); setPhysicalDomain(domain, d_number_blocks); - } /* @@ -239,9 +197,7 @@ BaseGridGeometry::BaseGridGeometry( BaseGridGeometry::~BaseGridGeometry() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(getObjectName()); - } + tbox::RestartManager::getManager()->unregisterRestartItem(getObjectName()); } /* @@ -261,22 +217,22 @@ BaseGridGeometry::computeBoundaryBoxesOnLevel( const PatchLevel& level, const IntVector& periodic_shift, const IntVector& ghost_width, - const tbox::Array& domain, + const std::vector& domain, bool do_all_patches) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(d_dim, level, periodic_shift, ghost_width); t_compute_boundary_boxes_on_level->start(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(ghost_width >= IntVector::getZero(ghost_width.getDim())); + TBOX_ASSERT(ghost_width >= IntVector::getZero(ghost_width.getDim())); +#ifdef DEBUG_CHECK_ASSERTIONS int num_per_dirs = 0; - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { if (periodic_shift(i)) { - num_per_dirs++; + ++num_per_dirs; } } if (num_per_dirs > 0) { @@ -286,8 +242,9 @@ BaseGridGeometry::computeBoundaryBoxesOnLevel( for (PatchLevel::iterator ip(level.begin()); ip != level.end(); ++ip) { const boost::shared_ptr& patch = *ip; - const BoxId& patch_id = patch->getBox().getId(); - const int block_num = patch->getBox().getBlockId().getBlockValue(); + const BoxId& patch_id = patch->getBox().getBoxId(); + const BlockId::block_t& block_num = + patch->getBox().getBlockId().getBlockValue(); if (patch->getPatchGeometry()->getTouchesRegularBoundary() || do_all_patches) { @@ -297,7 +254,7 @@ BaseGridGeometry::computeBoundaryBoxesOnLevel( /* * patch_boundaries is an array of DIM BoxContainers for each patch. * patch_boundaries[DIM-1] will store boundary boxes of the - * mapped_box type. If DIM > 1, patch_boundaries[DIM-2] will store + * nodetype. If DIM > 1, patch_boundaries[DIM-2] will store * boundary boxes of the edge type, and if DIM > 2, * patch_boundaries[DIM-3] will store boundary boxes of the face * type. @@ -319,10 +276,11 @@ BaseGridGeometry::computeBoundaryBoxesOnLevel( ghost_width, periodic_shift); #ifdef DEBUG_CHECK_ASSERTIONS - for (int j = 0; j < d_dim.getValue(); j++) { + for (int j = 0; j < d_dim.getValue(); ++j) { iter = (boundaries.find(patch_id)); TBOX_ASSERT(iter != boundaries.end()); - for (int k = 0; k < ((*iter).second)[j].getSize(); k++) { + for (int k = 0; + k < static_cast(((*iter).second)[j].size()); ++k) { TBOX_ASSERT(checkBoundaryBox(((*iter).second)[j][k], *patch, domain[block_num], num_per_dirs, ghost_width)); } @@ -358,7 +316,7 @@ BaseGridGeometry::findPatchesTouchingBoundaries( t_touching_boundaries_init->stop(); BoxContainer tmp_refined_periodic_domain_tree; - if ( level.getRatioToLevelZero() != IntVector::getOne(level.getDim()) ) { + if (level.getRatioToLevelZero() != IntVector::getOne(level.getDim())) { tmp_refined_periodic_domain_tree = d_domain_with_images; tmp_refined_periodic_domain_tree.refine(level.getRatioToLevelZero()); tmp_refined_periodic_domain_tree.makeTree(this); @@ -370,19 +328,19 @@ BaseGridGeometry::findPatchesTouchingBoundaries( const Box& box(patch->getBox()); std::map::iterator iter_touches_regular_bdry( - touches_regular_bdry.find(ip->getBox().getId())); + touches_regular_bdry.find(ip->getBox().getBoxId())); if (iter_touches_regular_bdry == touches_regular_bdry.end()) { iter_touches_regular_bdry = touches_regular_bdry.insert( iter_touches_regular_bdry, - std::pair(ip->getBox().getId(), TwoDimBool(d_dim))); + std::pair(ip->getBox().getBoxId(), TwoDimBool(d_dim))); } std::map::iterator iter_touches_periodic_bdry( - touches_periodic_bdry.find(ip->getBox().getId())); + touches_periodic_bdry.find(ip->getBox().getBoxId())); if (iter_touches_periodic_bdry == touches_periodic_bdry.end()) { iter_touches_periodic_bdry = touches_periodic_bdry.insert( iter_touches_periodic_bdry, - std::pair(ip->getBox().getId(), TwoDimBool(d_dim))); + std::pair(ip->getBox().getBoxId(), TwoDimBool(d_dim))); } computeBoxTouchingBoundaries( @@ -390,10 +348,10 @@ BaseGridGeometry::findPatchesTouchingBoundaries( (*iter_touches_periodic_bdry).second, box, level.getRatioToLevelZero(), - tmp_refined_periodic_domain_tree.isEmpty() ? + tmp_refined_periodic_domain_tree.empty() ? d_physical_domain : //d_domain_search_tree : - tmp_refined_periodic_domain_tree ); + tmp_refined_periodic_domain_tree); } t_touching_boundaries_loop->stop(); t_find_patches_touching_boundaries->stop(); @@ -404,20 +362,20 @@ BaseGridGeometry::computeBoxTouchingBoundaries( TwoDimBool& touches_regular_bdry, TwoDimBool& touches_periodic_bdry, const Box& box, - const IntVector &refinement_ratio, + const IntVector& refinement_ratio, const BoxContainer& refined_periodic_domain_tree) const { /* - * Create a list of boxes inside a mapped_box_level of one cell outside the + * Create a list of boxes inside a layer of one cell outside the * patch. Remove the intersections with the domain's interior, so that only * boxes outside the physical domain (if any) remain in the list. */ BoxContainer bdry_list(box); bdry_list.grow(IntVector::getOne(d_dim)); bdry_list.removeIntersections(refinement_ratio, - refined_periodic_domain_tree); - const bool touches_any_boundary = (bdry_list.size() > 0); + refined_periodic_domain_tree); + const bool touches_any_boundary = !bdry_list.empty(); if (!touches_any_boundary) { for (int d = 0; d < d_dim.getValue(); ++d) { @@ -426,7 +384,7 @@ BaseGridGeometry::computeBoxTouchingBoundaries( } } else { bool bdry_located = false; - for (int nd = 0; nd < d_dim.getValue(); nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < d_dim.getValue(); ++nd) { BoxContainer lower_list(bdry_list); BoxContainer upper_list(bdry_list); @@ -439,14 +397,14 @@ BaseGridGeometry::computeBoxTouchingBoundaries( test_box.growUpper(nd, 1); upper_list.intersectBoxes(test_box); // performance ok. upper_list is short. - if (lower_list.size()) { + if (!lower_list.empty()) { // Touches regular or periodic bdry on lower side. touches_periodic_bdry(nd, 0) = (d_periodic_shift(nd) != 0); touches_regular_bdry(nd, 0) = (d_periodic_shift(nd) == 0); bdry_located = true; } - if (upper_list.size()) { + if (!upper_list.empty()) { // Touches regular or periodic bdry on upper side. touches_periodic_bdry(nd, 1) = (d_periodic_shift(nd) != 0); touches_regular_bdry(nd, 1) = (d_periodic_shift(nd) == 0); @@ -462,12 +420,12 @@ BaseGridGeometry::computeBoxTouchingBoundaries( * concave corner of an L-shaped domain. */ if (!bdry_located) { - for (int nd = 0; nd < d_dim.getValue(); nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < d_dim.getValue(); ++nd) { touches_periodic_bdry(nd, 0) = touches_periodic_bdry(nd, 1) = false; bool lower_side = false; bool upper_side = false; - for (BoxContainer::iterator bl(bdry_list); + for (BoxContainer::iterator bl = bdry_list.begin(); bl != bdry_list.end(); ++bl) { if (bl->lower() (nd) < box.lower(nd)) { lower_side = true; @@ -498,25 +456,29 @@ void BaseGridGeometry::setGeometryOnPatches( PatchLevel& level, const IntVector& ratio_to_level_zero, - std::map& touches_regular_bdry, - std::map& touches_periodic_bdry, - bool defer_boundary_box_creation) + const std::map& touches_regular_bdry, + const bool defer_boundary_box_creation) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, level, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, level, ratio_to_level_zero); t_set_geometry_on_patches->start(); -#ifdef DEBUG_CHECK_ASSERTIONS + /* * All components of ratio must be nonzero. Additionally, * all components not equal to 1 must have the same sign. */ - TBOX_ASSERT(ratio_to_level_zero != IntVector::getZero(d_dim)); + TBOX_ASSERT(ratio_to_level_zero != 0); +#ifdef DEBUG_CHECK_ASSERTIONS if (d_dim.getValue() > 1) { - for (int i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || (ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } } } #endif @@ -525,14 +487,14 @@ BaseGridGeometry::setGeometryOnPatches( for (PatchLevel::iterator ip(level.begin()); ip != level.end(); ++ip) { const boost::shared_ptr& patch = *ip; setGeometryDataOnPatch(*patch, ratio_to_level_zero, - (*touches_regular_bdry.find(ip->getBox().getId())).second, - (*touches_periodic_bdry.find(ip->getBox().getId())).second); + (*touches_regular_bdry.find(ip->getBox().getBoxId())).second); } t_set_geometry_data_on_patches->stop(); if (!defer_boundary_box_creation) { setBoundaryBoxes(level); } + t_set_geometry_on_patches->stop(); } @@ -548,12 +510,12 @@ void BaseGridGeometry::setBoundaryBoxes( PatchLevel& level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, level); t_set_boundary_boxes->start(); std::map boundaries; - tbox::Array domain(level.getPhysicalDomainArray()); + const std::vector& domain(level.getPhysicalDomainArray()); IntVector ghost_width( level.getPatchDescriptor()->getMaxGhostWidth(d_dim)); @@ -564,7 +526,7 @@ BaseGridGeometry::setBoundaryBoxes( TBOX_ERROR("Error in BaseGridGeometry object with name = " << d_object_name << ": in computeMaxGhostWidth(): " << "Cannot add variables and increase maximum ghost " - << "width after creating the BaseGridGeometry!"); + << "width after creating the BaseGridGeometry!" << std::endl); } d_max_data_ghost_width = ghost_width; @@ -576,10 +538,10 @@ BaseGridGeometry::setBoundaryBoxes( d_max_data_ghost_width, domain); - for (std::map::const_iterator mi = boundaries.begin(); + for (std::map::iterator mi = boundaries.begin(); mi != boundaries.end(); ++mi) { boost::shared_ptr patch(level.getPatch((*mi).first)); - patch->getPatchGeometry()->setBoundaryBoxesOnPatch((*mi).second.getArrays()); + patch->getPatchGeometry()->setBoundaryBoxesOnPatch((*mi).second.getVectors()); } t_set_boundary_boxes->stop(); @@ -598,30 +560,29 @@ void BaseGridGeometry::setGeometryDataOnPatch( Patch& patch, const IntVector& ratio_to_level_zero, - const PatchGeometry::TwoDimBool& touches_regular_bdry, - const PatchGeometry::TwoDimBool& touches_periodic_bdry) -const + const PatchGeometry::TwoDimBool& touches_regular_bdry) const { #ifdef DEBUG_CHECK_ASSERTIONS const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, patch, ratio_to_level_zero, - touches_regular_bdry, touches_periodic_bdry); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, patch, ratio_to_level_zero, + touches_regular_bdry); /* * All components of ratio must be nonzero. Additionally, * all components not equal to 1 must have the same sign. */ - int i; - for (i = 0; i < dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } - if (dim > tbox::Dimension(1)) { - for (i = 0; i < dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % dim.getValue()) == 1)); + TBOX_ASSERT(ratio_to_level_zero != 0); + if (d_dim.getValue() > 1) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || (ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } } } #endif @@ -630,7 +591,7 @@ const boost::make_shared( ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry)); + patch.getBox().getBlockId())); patch.setPatchGeometry(geometry); @@ -648,42 +609,47 @@ const void BaseGridGeometry::getFromRestart() { - const tbox::Dimension dim(getDim()); - boost::shared_ptr restart_db( tbox::RestartManager::getManager()->getRootDatabase()); if (!restart_db->isDatabase(getObjectName())) { TBOX_ERROR("Restart database corresponding to " - << getObjectName() << " not found in the restart file."); + << getObjectName() << " not found in the restart file." << std::endl); } boost::shared_ptr db( restart_db->getDatabase(getObjectName())); + const tbox::Dimension dim(getDim()); + int ver = db->getInteger("HIER_GRID_GEOMETRY_VERSION"); if (ver != HIER_GRID_GEOMETRY_VERSION) { TBOX_ERROR( getObjectName() << ": " - << "Restart file version is different than class version."); + << "Restart file version is different than class version." + << std::endl); + } + + d_number_blocks = static_cast(db->getInteger("num_blocks")); + if (d_ratio_to_level_zero[0].getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero[0] = + IntVector(IntVector::getOne(d_dim), d_number_blocks); } - d_number_blocks = db->getInteger("d_number_blocks"); + d_singularity.resize(d_number_blocks); + d_block_neighbors.resize(d_number_blocks); std::string domain_name; BoxContainer domain; LocalId local_id(0); - for (int b = 0; b < d_number_blocks; b++) { - domain_name = "d_physical_domain_" + tbox::Utilities::intToString(b); - BoxContainer block_domain_boxes; - if (db->keyExists(domain_name)) { - block_domain_boxes = db->getDatabaseBoxArray(domain_name); - } else { - TBOX_ERROR( - getObjectName() << ": " - << "No '" << domain_name << "' restart data found for " - << "Block " << b << " physical domain. "); - } + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + std::string blk_string = + tbox::Utilities::intToString(static_cast(b)); + + domain_name = "domain_boxes_" + blk_string; + std::vector db_box_vector = + db->getDatabaseBoxVector(domain_name); + BoxContainer block_domain_boxes(db_box_vector); for (BoxContainer::iterator itr = block_domain_boxes.begin(); itr != block_domain_boxes.end(); ++itr) { @@ -691,15 +657,62 @@ BaseGridGeometry::getFromRestart() box.setBlockId(BlockId(b)); domain.pushBack(box); } + + if (d_number_blocks > 1) { + + std::string singularity_db_name = + "Singularity_" + blk_string; + boost::shared_ptr singularity_db = + db->getDatabase(singularity_db_name); + d_singularity[b].getFromRestart(*singularity_db); + + std::string neighbors_db_name = + "Neighbors_" + blk_string; + boost::shared_ptr neighbors_db = + db->getDatabase(neighbors_db_name); + int num_neighbors = neighbors_db->getInteger("num_neighbors"); + for (int count = 0; count < num_neighbors; ++count) { + std::string neighbor_db_name = + "neighbor_" + tbox::Utilities::intToString(count); + boost::shared_ptr neighbor_db = + neighbors_db->getDatabase(neighbor_db_name); + BlockId nbr_block_id(neighbor_db->getInteger("nbr_block_id")); + BoxContainer nbr_transformed_domain; + nbr_transformed_domain.getFromRestart(*neighbor_db); + Transformation::RotationIdentifier nbr_rotation_ident = + static_cast( + neighbor_db->getInteger("rotation_identifier")); + IntVector nbr_offset(dim); + nbr_offset.getFromRestart(*neighbor_db, "offset"); + BlockId nbr_begin_block(neighbor_db->getInteger("begin_block")); + BlockId nbr_end_block(neighbor_db->getInteger("end_block")); + bool nbr_is_singularity = neighbor_db->getBool("d_is_singularity"); + Transformation nbr_transformation(nbr_rotation_ident, + nbr_offset, + nbr_begin_block, + nbr_end_block); + std::vector restart_transformation( + 1, nbr_transformation); + Neighbor block_nbr(nbr_block_id, + nbr_transformed_domain, + restart_transformation); + block_nbr.setSingularity(nbr_is_singularity); + std::pair nbr_pair(nbr_block_id, block_nbr); + d_block_neighbors[b].insert(nbr_pair); + } + } } setPhysicalDomain(domain, d_number_blocks); + d_has_enhanced_connectivity = db->getInteger("d_has_enhanced_connectivity"); + + d_number_of_block_singularities = + db->getInteger("d_number_of_block_singularities"); + IntVector periodic_shift(dim); int* temp_shift = &periodic_shift[0]; - db->getIntegerArray("d_periodic_shift", temp_shift, dim.getValue()); + db->getIntegerArray("periodic_dimension", temp_shift, dim.getValue()); initializePeriodicShift(periodic_shift); - - d_has_enhanced_connectivity = db->getBool("d_has_enhanced_connectivity"); } /* @@ -715,39 +728,73 @@ BaseGridGeometry::getFromRestart() void BaseGridGeometry::getFromInput( - const boost::shared_ptr& db, - bool is_from_restart) + const boost::shared_ptr& input_db, + bool is_from_restart, + bool allow_multiblock) { - - TBOX_ASSERT(db); + if (!is_from_restart && !input_db) { + TBOX_ERROR(": BaseGridGeometry::getFromInput()\n" + << "no input database supplied" << std::endl); + } const tbox::Dimension dim(getDim()); if (!is_from_restart) { - d_number_blocks = db->getIntegerWithDefault("num_blocks", 1); + d_number_blocks = + static_cast( + input_db->getIntegerWithDefault("num_blocks", 1)); + if (!(d_number_blocks >= 1)) { + INPUT_RANGE_ERROR("num_blocks"); + } + + if (d_number_blocks > 1 && !allow_multiblock) { + TBOX_ERROR("BaseGridGeometry::getFromInput error...\n" + << "num_blocks is >1 for an inherently single block grid geometry." + << std::endl); + } + + if (d_ratio_to_level_zero[0].getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero[0] = + IntVector(IntVector::getOne(d_dim), d_number_blocks); + } std::string domain_name; BoxContainer domain; LocalId local_id(0); - for (int b = 0; b < d_number_blocks; b++) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { - domain_name = "domain_boxes_" + tbox::Utilities::intToString(b); + domain_name = "domain_boxes_" + + tbox::Utilities::intToString(static_cast(b)); - BoxContainer block_domain_boxes; - if (db->keyExists(domain_name)) { - block_domain_boxes = db->getDatabaseBoxArray(domain_name); - if (block_domain_boxes.size() == 0) { + BoxContainer block_domain_boxes; + if (input_db->keyExists(domain_name)) { + std::vector db_box_vector = + input_db->getDatabaseBoxVector(domain_name); + block_domain_boxes = db_box_vector; + if (block_domain_boxes.empty()) { TBOX_ERROR( getObjectName() << ": " << "No boxes for " << domain_name - << " array found in input."); + << " array found in input." << std::endl); + } + } else if (b == 0 && d_number_blocks == 1 && + input_db->keyExists("domain_boxes")) { + std::vector db_box_vector = + input_db->getDatabaseBoxVector("domain_boxes"); + block_domain_boxes = db_box_vector; + if (block_domain_boxes.empty()) { + TBOX_ERROR( + getObjectName() << ": " + << "No boxes for domain_boxes" + << " array found in input." << std::endl); } } else { TBOX_ERROR( getObjectName() << ": " - << "Key data '" << domain_name << "' not found in input."); + << "Key data '" << domain_name << "' not found in input." + << std::endl); } for (BoxContainer::iterator itr = block_domain_boxes.begin(); @@ -759,61 +806,124 @@ BaseGridGeometry::getFromInput( } - int pbc[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int pbc[SAMRAI::MAX_DIM_VAL]; IntVector per_bc(dim, 0); - if (db->keyExists("periodic_dimension")) { - db->getIntegerArray("periodic_dimension", pbc, dim.getValue()); - for (int i = 0; i < dim.getValue(); i++) { + if (input_db->keyExists("periodic_dimension")) { + input_db->getIntegerArray("periodic_dimension", pbc, dim.getValue()); + for (int i = 0; i < dim.getValue(); ++i) { per_bc(i) = ((pbc[i] == 0) ? 0 : 1); } } - setPhysicalDomain(domain, d_number_blocks); + if (d_number_blocks > 1 && per_bc != IntVector::getZero(dim)) { + TBOX_ERROR("BaseGridGeometry::getFromInput() error...\n" + << "periodic boundaries are not currently supported for multiblock meshes." + << std::endl); + } initializePeriodicShift(per_bc); - } - readBlockDataFromInput(db); + setPhysicalDomain(domain, d_number_blocks); + + readBlockDataFromInput(input_db); + } else if (input_db) { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + int num_keys = static_cast(input_db->getAllKeys().size()); + if (num_keys > 0 && read_on_restart) { + TBOX_WARNING( + "BaseGridGeometry::getFromInput() warning...\n" + << "You want to override restart data with values from\n" + << "an input database which is not allowed." << std::endl); + } + } } /* ************************************************************************* * - * Writes out version number and data members for the class. + * Writes version number and data members for the class to restart database. * ************************************************************************* */ void -BaseGridGeometry::putToDatabase( - const boost::shared_ptr& db) const +BaseGridGeometry::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); const tbox::Dimension dim(getDim()); - db->putInteger("HIER_GRID_GEOMETRY_VERSION", + restart_db->putInteger("HIER_GRID_GEOMETRY_VERSION", HIER_GRID_GEOMETRY_VERSION); - db->putInteger("d_number_blocks", d_number_blocks); - - std::string domain_name; + restart_db->putInteger("num_blocks", static_cast(d_number_blocks)); - for (int b = 0; b < d_number_blocks; b++) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { - domain_name = "d_physical_domain_" + tbox::Utilities::intToString(b); + std::string blk_string = + tbox::Utilities::intToString(static_cast(b)); + std::string domain_name = + "domain_boxes_" + blk_string; BoxContainer block_phys_domain(getPhysicalDomain(), BlockId(b)); - tbox::Array temp_box_array = block_phys_domain; - - db->putDatabaseBoxArray(domain_name, temp_box_array); + std::vector temp_box_vector = block_phys_domain; + + restart_db->putDatabaseBoxVector(domain_name, temp_box_vector); + + if (d_number_blocks > 1) { + + std::string singularity_db_name = + "Singularity_" + blk_string; + boost::shared_ptr singularity_db = + restart_db->putDatabase(singularity_db_name); + d_singularity[b].putToRestart(singularity_db); + + std::string neighbors_db_name = + "Neighbors_" + blk_string; + boost::shared_ptr neighbors_db = + restart_db->putDatabase(neighbors_db_name); + neighbors_db->putInteger("num_neighbors", + static_cast(d_block_neighbors[b].size())); + int count = 0; + for (std::map::const_iterator ni = d_block_neighbors[b].begin(); + ni != d_block_neighbors[b].end(); ++ni) { + const Neighbor& neighbor = ni->second; + std::string neighbor_db_name = + "neighbor_" + blk_string; + boost::shared_ptr neighbor_db = + neighbors_db->putDatabase(neighbor_db_name); + neighbor_db->putInteger("nbr_block_id", + static_cast(neighbor.getBlockId().getBlockValue())); + neighbor.getTransformedDomain().putToRestart(neighbor_db); + neighbor_db->putInteger("rotation_identifier", + neighbor.getTransformation(0).getRotation()); + neighbor.getTransformation(0).getOffset().putToRestart(*neighbor_db, + "offset"); + neighbor_db->putInteger("begin_block", + static_cast( + neighbor.getTransformation(0).getBeginBlock().getBlockValue())); + neighbor_db->putInteger("end_block", + static_cast( + neighbor.getTransformation(0).getEndBlock().getBlockValue())); + neighbor_db->putBool("d_is_singularity", neighbor.isSingularity()); + ++count; + } + } } + restart_db->putInteger("d_has_enhanced_connectivity", + d_has_enhanced_connectivity); + + restart_db->putInteger("d_number_of_block_singularities", + d_number_of_block_singularities); + IntVector level0_shift(getPeriodicShift(IntVector::getOne(dim))); int* temp_shift = &level0_shift[0]; - db->putIntegerArray("d_periodic_shift", temp_shift, dim.getValue()); - - db->putBool("d_has_enhanced_connectivity", d_has_enhanced_connectivity); + restart_db->putIntegerArray("periodic_dimension", + temp_shift, + dim.getValue()); } /* @@ -831,41 +941,38 @@ BaseGridGeometry::computeShiftsForBox( const BoxContainer& domain_search_tree, const IntVector& periodic_shift) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, box, periodic_shift); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, box, periodic_shift); shifts.clear(); int num_periodic_dirs = 0; - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { if (periodic_shift(i) != 0) { - num_periodic_dirs++; + ++num_periodic_dirs; } } if (num_periodic_dirs > 0) { - const PeriodicShiftCatalog* periodic_shift_catalog = - PeriodicShiftCatalog::getCatalog(d_dim); - - shifts.reserve(periodic_shift_catalog->getNumberOfShifts()); + shifts.reserve(d_periodic_shift_catalog.getNumberOfShifts()); BoundaryLookupTable* blut = BoundaryLookupTable::getLookupTable(d_dim); - const tbox::Array& location_index_max = + const std::vector& location_index_max = blut->getMaxLocationIndices(); - for (int d = 0; d < num_periodic_dirs; d++) { + for (tbox::Dimension::dir_t d = 0; d < num_periodic_dirs; ++d) { - const int codim = d + 1; + const tbox::Dimension::dir_t codim = static_cast(d + 1); - for (int loc = 0; loc < location_index_max[d]; loc++) { + for (int loc = 0; loc < location_index_max[d]; ++loc) { - const tbox::Array& dirs = blut->getDirections(loc, codim); + const std::vector& dirs = blut->getDirections(loc, codim); bool need_to_test = true; - for (int k = 0; k < dirs.size(); k++) { + for (int k = 0; k < static_cast(dirs.size()); ++k) { if (periodic_shift(dirs[k]) == 0) { need_to_test = false; break; @@ -877,16 +984,16 @@ BaseGridGeometry::computeShiftsForBox( Box border(box); IntVector border_shift(d_dim, 0); - tbox::Array is_upper(codim); - for (int j = 0; j < codim; j++) { + std::vector is_upper(codim); + for (tbox::Dimension::dir_t j = 0; j < codim; ++j) { if (blut->isUpper(loc, codim, j)) { - border.lower(dirs[j]) = box.upper(dirs[j]); - border.upper(dirs[j]) = box.upper(dirs[j]); + border.setLower(dirs[j], box.upper(dirs[j])); + border.setUpper(dirs[j], box.upper(dirs[j])); border_shift(dirs[j]) = 1; is_upper[j] = true; } else { - border.lower(dirs[j]) = box.lower(dirs[j]); - border.upper(dirs[j]) = box.lower(dirs[j]); + border.setLower(dirs[j], box.lower(dirs[j])); + border.setUpper(dirs[j], box.lower(dirs[j])); border_shift(dirs[j]) = -1; is_upper[j] = false; } @@ -897,7 +1004,7 @@ BaseGridGeometry::computeShiftsForBox( border_list.removeIntersections(domain_search_tree); - if (border_list.size() > 0) { + if (!border_list.empty()) { const Box& domain_bound_box = domain_search_tree.getBoundingBox(); @@ -918,7 +1025,7 @@ BaseGridGeometry::computeShiftsForBox( } else { bool shift_to_add = true; - for (int c = 0; c < codim; c++) { + for (int c = 0; c < codim; ++c) { if (is_upper[c]) { if (border.upper(dirs[c]) <= @@ -938,7 +1045,7 @@ BaseGridGeometry::computeShiftsForBox( if (shift_to_add) { IntVector new_shift(d_dim, 0); - for (int b = 0; b < codim; b++) { + for (int b = 0; b < codim; ++b) { if (is_upper[b]) { new_shift(dirs[b]) = -domain_bound_box.numberCells(dirs[b]); @@ -974,7 +1081,7 @@ BaseGridGeometry::getBoundaryBoxes( const IntVector& ghosts, const IntVector& periodic_shift) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, box, ghosts, periodic_shift); + TBOX_ASSERT_OBJDIM_EQUALITY4(*this, box, ghosts, periodic_shift); t_get_boundary_boxes->start(); @@ -982,56 +1089,46 @@ BaseGridGeometry::getBoundaryBoxes( const Index ilast = box.upper(); int num_per_dirs = 0; - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < d_dim.getValue(); ++d) { num_per_dirs += (periodic_shift(d) ? 1 : 0); } if (num_per_dirs == d_dim.getValue()) { - for (int k = 0; k < d_dim.getValue(); k++) { - patch_boundaries[k].resizeArray(0, BoundaryBox(d_dim)); + for (int k = 0; k < d_dim.getValue(); ++k) { + patch_boundaries[k].clear(); } - } else { if (!domain_boxes.hasTree() && domain_boxes.size() > 10) { - domain_boxes.makeTree(NULL); + domain_boxes.makeTree(0); } BoxContainer per_domain_boxes; if (num_per_dirs != 0) { per_domain_boxes = domain_boxes; per_domain_boxes.grow(periodic_shift); - if (per_domain_boxes.size() > 10) { - per_domain_boxes.makeTree(NULL); + if (per_domain_boxes.size() > 10) { + per_domain_boxes.makeTree(0); } } BoundaryLookupTable* blut = BoundaryLookupTable::getLookupTable(d_dim); - const tbox::Array& location_index_max = + const std::vector& location_index_max = blut->getMaxLocationIndices(); - tbox::Array codim_boxlist(d_dim.getValue()); + std::vector codim_boxlist(d_dim.getValue()); - for (int d = 0; d < d_dim.getValue() - num_per_dirs; d++) { + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue() - num_per_dirs; ++d) { - int codim = d + 1; + tbox::Dimension::dir_t codim = static_cast(d + 1); - patch_boundaries[d].resizeArray(location_index_max[d], - BoundaryBox(d_dim)); - int bdry_array_size = location_index_max[d]; - int num_bboxes = 0; + for (int loc = 0; loc < location_index_max[d]; ++loc) { + const std::vector& dirs = blut->getDirections(loc, codim); - for (int loc = 0; loc < location_index_max[d]; loc++) { - const tbox::Array& dirs = blut->getDirections(loc, codim); - - tbox::Array periodic_dir(codim); bool all_is_per = true; - for (int p = 0; p < codim; p++) { + for (tbox::Dimension::dir_t p = 0; p < codim; ++p) { if (periodic_shift(dirs[p]) == 0) { - periodic_dir[p] = false; all_is_per = false; - } else { - periodic_dir[p] = true; } } @@ -1039,30 +1136,30 @@ BaseGridGeometry::getBoundaryBoxes( Box border(box); IntVector border_shift(d_dim, 0); - for (int i = 0; i < codim; i++) { + for (tbox::Dimension::dir_t i = 0; i < codim; ++i) { if (blut->isUpper(loc, codim, i)) { - border.lower(dirs[i]) = box.upper(dirs[i]); - border.upper(dirs[i]) = box.upper(dirs[i]); + border.setLower(dirs[i], box.upper(dirs[i])); + border.setUpper(dirs[i], box.upper(dirs[i])); border_shift(dirs[i]) = 1; } else { - border.lower(dirs[i]) = box.lower(dirs[i]); - border.upper(dirs[i]) = box.lower(dirs[i]); + border.setLower(dirs[i], box.lower(dirs[i])); + border.setUpper(dirs[i], box.lower(dirs[i])); border_shift(dirs[i]) = -1; } } // grow in non-dirs directions - for (int j = 0; j < d_dim.getValue(); j++) { + for (tbox::Dimension::dir_t j = 0; j < d_dim.getValue(); ++j) { bool dir_used = false; - for (int du = 0; du < codim; du++) { + for (tbox::Dimension::dir_t du = 0; du < codim; ++du) { if (dirs[du] == j) { dir_used = true; break; } } if (!dir_used) { - border.upper(j) = ilast(j) + ghosts(j); - border.lower(j) = ifirst(j) - ghosts(j); + border.setUpper(j, ilast(j) + ghosts(j)); + border.setLower(j, ifirst(j) - ghosts(j)); } } @@ -1085,43 +1182,31 @@ BaseGridGeometry::getBoundaryBoxes( } else { border_list.removeIntersections(domain_boxes); } - - if (border_list.size() > 0) { - for (int bd = 0; bd < d; bd++) { + + if (!border_list.empty()) { + for (int bd = 0; bd < d; ++bd) { border_list.removeIntersections(codim_boxlist[bd]); - if (border_list.size() == 0) { + if (border_list.empty()) { break; } } } - if (border_list.size() > 0) { + if (!border_list.empty()) { border_list.coalesce(); - for (BoxContainer::iterator bl(border_list); + for (BoxContainer::iterator bl = border_list.begin(); bl != border_list.end(); ++bl) { - if (num_bboxes == bdry_array_size) { - patch_boundaries[d].resizeArray( - bdry_array_size + location_index_max[d], - BoundaryBox(d_dim)); - bdry_array_size = patch_boundaries[d].size(); - } BoundaryBox boundary_box(*bl, codim, loc); - patch_boundaries[d][num_bboxes] = boundary_box; - - num_bboxes++; + patch_boundaries[d].push_back(boundary_box); } codim_boxlist[d].spliceFront(border_list); } } - if (loc + 1 == location_index_max[d]) { - patch_boundaries[d].resizeArray(num_bboxes, - BoundaryBox(d_dim)); - } } } } @@ -1140,50 +1225,54 @@ BaseGridGeometry::getBoundaryBoxes( void BaseGridGeometry::computePhysicalDomain( - BoxContainer& domain_mapped_boxes, + BoxContainer& domain_boxes, const IntVector& ratio_to_level_zero, const BlockId& block_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio_to_level_zero); + const BlockId::block_t b = block_id.getBlockValue(); #ifdef DEBUG_CHECK_ASSERTIONS /* * All components of ratio must be nonzero. Additionally, all components * of ratio not equal to 1 must have the same sign. */ - int i; - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } - if (d_dim.getValue() > 1) { - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + if (ratio_to_level_zero != 1) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + TBOX_ASSERT(ratio_to_level_zero(b,i) != 0); + } + if (d_dim.getValue() > 1) { + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || ((ratio_to_level_zero(b,i + 1) % d_dim.getValue()) == 1)); + } } } #endif - domain_mapped_boxes.clear(); + domain_boxes.clear(); for (BoxContainer::const_iterator itr = d_physical_domain.begin(); itr != d_physical_domain.end(); ++itr) { if (itr->getBlockId() == block_id) { - domain_mapped_boxes.insert(*itr); + domain_boxes.insert(*itr); } } - if (ratio_to_level_zero != IntVector::getOne(d_dim)) { + if (ratio_to_level_zero != 1) { bool coarsen = false; IntVector tmp_rat = ratio_to_level_zero; - for (int id = 0; id < d_dim.getValue(); id++) { - if (ratio_to_level_zero(id) < 0) coarsen = true; - tmp_rat(id) = abs(ratio_to_level_zero(id)); + for (int id = 0; id < d_dim.getValue(); ++id) { + if (ratio_to_level_zero(b,id) < 0) coarsen = true; + tmp_rat(b,id) = abs(ratio_to_level_zero(b,id)); } if (coarsen) { - domain_mapped_boxes.coarsen(tmp_rat); + domain_boxes.coarsen(tmp_rat); } else { - domain_mapped_boxes.refine(tmp_rat); + domain_boxes.refine(tmp_rat); } } } @@ -1204,23 +1293,27 @@ BaseGridGeometry::computePhysicalDomain( const IntVector& ratio_to_level_zero, const BlockId& block_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio_to_level_zero); + const BlockId::block_t b = block_id.getBlockValue(); #ifdef DEBUG_CHECK_ASSERTIONS /* * All components of ratio must be nonzero. Additionally, all components * of ratio not equal to 1 must have the same sign. */ - int i; - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } - if (d_dim.getValue() > 1) { - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + if (ratio_to_level_zero != 1) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + TBOX_ASSERT(ratio_to_level_zero(b,i) != 0); + } + if (d_dim.getValue() > 1) { + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || (ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } } } #endif @@ -1233,14 +1326,14 @@ BaseGridGeometry::computePhysicalDomain( } } - if (ratio_to_level_zero != IntVector::getOne(d_dim)) { + if (ratio_to_level_zero != 1) { bool coarsen = false; IntVector tmp_rat = ratio_to_level_zero; - for (int id = 0; id < d_dim.getValue(); id++) { - if (ratio_to_level_zero(id) < 0) { + for (int id = 0; id < d_dim.getValue(); ++id) { + if (ratio_to_level_zero(b,id) < 0) { coarsen = true; } - tmp_rat(id) = abs(ratio_to_level_zero(id)); + tmp_rat(id) = abs(ratio_to_level_zero(b,id)); } if (coarsen) { box_level.coarsenBoxes(box_level, tmp_rat, IntVector::getOne(d_dim)); @@ -1262,43 +1355,52 @@ BaseGridGeometry::computePhysicalDomain( void BaseGridGeometry::computePhysicalDomain( - BoxContainer& domain_mapped_boxes, + BoxContainer& domain_boxes, const IntVector& ratio_to_level_zero) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio_to_level_zero); #ifdef DEBUG_CHECK_ASSERTIONS - /* - * All components of ratio must be nonzero. Additionally, all components - * of ratio not equal to 1 must have the same sign. - */ - int i; - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } - if (d_dim.getValue() > 1) { - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + if (ratio_to_level_zero != 1) { + /* + * All components of ratio must be nonzero. Additionally, all components + * of ratio not equal to 1 must have the same sign. + */ + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + TBOX_ASSERT(ratio_to_level_zero(b,i) != 0); + } + if (d_dim.getValue() > 1) { + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || (ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } + } } - } + } #endif - domain_mapped_boxes = d_domain_with_images; + domain_boxes = d_domain_with_images; - if (ratio_to_level_zero != IntVector::getOne(d_dim)) { + if (ratio_to_level_zero != 1) { bool coarsen = false; IntVector tmp_rat = ratio_to_level_zero; - for (int id = 0; id < d_dim.getValue(); id++) { - if (ratio_to_level_zero(id) < 0) coarsen = true; - tmp_rat(id) = abs(ratio_to_level_zero(id)); + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int id = 0; id < d_dim.getValue(); ++id) { + if (ratio_to_level_zero(b,id) < 0) { + coarsen = true; + } + tmp_rat(b,id) = abs(ratio_to_level_zero(b,id)); + } } if (coarsen) { - domain_mapped_boxes.coarsen(tmp_rat); + domain_boxes.coarsen(tmp_rat); } else { - domain_mapped_boxes.refine(tmp_rat); + domain_boxes.refine(tmp_rat); } } @@ -1309,35 +1411,44 @@ BaseGridGeometry::computePhysicalDomain( BoxLevel& box_level, const IntVector& ratio_to_level_zero) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio_to_level_zero); #ifdef DEBUG_CHECK_ASSERTIONS /* * All components of ratio must be nonzero. Additionally, all components * of ratio not equal to 1 must have the same sign. */ - int i; - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } - if (d_dim.getValue() > 1) { - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + if (ratio_to_level_zero != 1) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + TBOX_ASSERT(ratio_to_level_zero(b,i) != 0); + } + if (d_dim.getValue() > 1) { + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = ratio_to_level_zero(b,i) > 0; + bool pos1 = ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (ratio_to_level_zero(b,i) == 1) + || (ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } + } } } #endif BoxContainer domain_boxes = d_domain_with_images; - if (ratio_to_level_zero != IntVector::getOne(d_dim)) { + if (ratio_to_level_zero != 1) { bool coarsen = false; IntVector tmp_rat = ratio_to_level_zero; - for (int id = 0; id < d_dim.getValue(); id++) { - if (ratio_to_level_zero(id) < 0) coarsen = true; - tmp_rat(id) = abs(ratio_to_level_zero(id)); + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int id = 0; id < d_dim.getValue(); ++id) { + if (ratio_to_level_zero(b,id) < 0) { + coarsen = true; + } + tmp_rat(b,id) = abs(ratio_to_level_zero(b,id)); + } } if (coarsen) { domain_boxes.coarsen(tmp_rat); @@ -1366,29 +1477,37 @@ BaseGridGeometry::computePhysicalDomain( void BaseGridGeometry::setPhysicalDomain( const BoxContainer& domain, - const int number_blocks) + const size_t number_blocks) { + TBOX_ASSERT(!domain.empty()); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(domain.size() > 0); for (BoxContainer::const_iterator itr = domain.begin(); itr != domain.end(); ++itr) { - TBOX_ASSERT(itr->getBlockId().isValid()); - TBOX_ASSERT(itr->getBlockId().getBlockValue() < number_blocks); - } + TBOX_ASSERT(itr->getBlockId().isValid()); + TBOX_ASSERT(itr->getBlockId().getBlockValue() < number_blocks); + } #endif - d_domain_is_single_box.resizeArray(number_blocks); + d_physical_domain.clear(); + + d_domain_is_single_box.resize(number_blocks); d_number_blocks = number_blocks; + if (d_ratio_to_level_zero[0].getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero[0] = + IntVector(IntVector::getOne(d_dim), d_number_blocks); + } + LocalId local_id(0); - for (int b = 0; b < number_blocks; b++) { + for (BlockId::block_t b = 0; b < number_blocks; ++b) { BlockId block_id(b); BoxContainer block_domain(domain, block_id); + TBOX_ASSERT(!block_domain.empty()); Box bounding_box(block_domain.getBoundingBox()); BoxContainer bounding_cntnr(bounding_box); bounding_cntnr.removeIntersections(block_domain); - if (bounding_cntnr.size() == 0) { + if (bounding_cntnr.empty()) { d_domain_is_single_box[b] = true; Box box(bounding_box, local_id++, 0); box.setBlockId(block_id); @@ -1403,13 +1522,13 @@ BaseGridGeometry::setPhysicalDomain( } if (d_physical_domain.size() == 1 && - d_periodic_shift != IntVector::getZero(d_dim) ) { + d_periodic_shift != IntVector::getZero(d_dim)) { /* * If necessary, reset periodic shift amounts using the new * bounding box. */ - for (int id = 0; id < d_dim.getValue(); id++) { + for (int id = 0; id < d_dim.getValue(); ++id) { d_periodic_shift(id) = ((d_periodic_shift(id) == 0) ? 0 : 1); } @@ -1417,21 +1536,21 @@ BaseGridGeometry::setPhysicalDomain( /* * Check if the physical domain is valid for the specified * periodic conditions. If so, compute the shift in each - * dimension based on the the number of cells. + * direction based on the the number of cells. */ if (checkPeriodicValidity(d_physical_domain)) { Box bounding_box(d_physical_domain.getBoundingBox()); - for (int id = 0; id < d_dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { d_periodic_shift(id) *= bounding_box.numberCells(id); } } else { TBOX_ERROR("Error in BaseGridGeometry object with name = " << d_object_name << ": in initializePeriodicShift(): " - << "Domain is not periodic for one (or more) of the dimensions " - << "specified in the geometry input file!"); + << "Domain is not periodic for one (or more) of the directions " + << "specified in the geometry input file!" << std::endl); } } } @@ -1461,31 +1580,30 @@ BaseGridGeometry::resetDomainBoxContainer() if (is_periodic) { - PeriodicShiftCatalog::initializeShiftsByIndexDirections(d_periodic_shift); - const PeriodicShiftCatalog* periodic_shift_catalog = - PeriodicShiftCatalog::getCatalog(d_dim); + d_periodic_shift_catalog.initializeShiftsByIndexDirections(d_periodic_shift); - const IntVector &one_vector(IntVector::getOne(d_dim)); + const IntVector& one_vector(IntVector::getOne(d_dim)); - for ( BoxContainer::const_iterator ni(d_physical_domain.begin()); - ni!=d_physical_domain.end(); ++ni ) { + for (BoxContainer::const_iterator ni = d_physical_domain.begin(); + ni != d_physical_domain.end(); ++ni) { - const Box &real_box = *ni; - TBOX_ASSERT(real_box.getPeriodicId() == periodic_shift_catalog->getZeroShiftNumber()); + const Box& real_box = *ni; + TBOX_ASSERT(real_box.getPeriodicId() == d_periodic_shift_catalog.getZeroShiftNumber()); - for ( int ishift=1; ishiftgetNumberOfShifts(); - ++ishift ) { - const Box image_box( real_box, PeriodicId(ishift), one_vector ); + for (int ishift = 1; ishift < d_periodic_shift_catalog.getNumberOfShifts(); + ++ishift) { + const Box image_box(real_box, + PeriodicId(ishift), + one_vector, + d_periodic_shift_catalog); d_domain_with_images.pushBack(image_box); } } } d_domain_with_images.makeTree(this); - -} - +} /* ************************************************************************* @@ -1503,7 +1621,7 @@ void BaseGridGeometry::initializePeriodicShift( const IntVector& directions) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, directions); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, directions); d_periodic_shift = directions; @@ -1528,34 +1646,50 @@ IntVector BaseGridGeometry::getPeriodicShift( const IntVector& ratio_to_level_zero) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio_to_level_zero); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio_to_level_zero); + + IntVector periodic_shift(d_dim); + if (d_number_blocks > 1) { + if (d_periodic_shift != IntVector::getZero(d_dim)) { + TBOX_ERROR("BaseGridGeometry::getPeriodicShift() error...\n" + << "A non-zero periodic shift cannont be used in a multiblock geometry." + << std::endl); + } else { + periodic_shift = d_periodic_shift; + } + } else { + /* + * This is single-block, so only use zero BlockId. + */ + const IntVector& block_ratio = + ratio_to_level_zero; #ifdef DEBUG_CHECK_ASSERTIONS - /* - * All components of ratio vector must be nonzero. Additionally, - * all components not equal to 1 must have the same sign. - */ - int k; - for (k = 0; k < d_dim.getValue(); k++) { - TBOX_ASSERT(ratio_to_level_zero(k) != 0); - } - if (d_dim.getValue() > 1) { - for (k = 0; k < d_dim.getValue(); k++) { - TBOX_ASSERT((ratio_to_level_zero(k) - * ratio_to_level_zero((k + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(k) == 1) - || (ratio_to_level_zero((k + 1) % d_dim.getValue()) == 1)); + /* + * All components of ratio vector must be nonzero. Additionally, + * all components not equal to 1 must have the same sign. + */ + int k; + for (k = 0; k < d_dim.getValue(); ++k) { + TBOX_ASSERT(block_ratio(k) != 0); + } + if (d_dim.getValue() > 1) { + for (k = 0; k < d_dim.getValue(); ++k) { + TBOX_ASSERT((block_ratio(k) + * block_ratio((k + 1) % d_dim.getValue()) > 0) + || (block_ratio(k) == 1) + || (block_ratio((k + 1) % d_dim.getValue()) == 1)); + } } - } #endif - IntVector periodic_shift(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { - if (ratio_to_level_zero(i) > 0) { - periodic_shift(i) = d_periodic_shift(i) * ratio_to_level_zero(i); - } else { - int abs_ratio = abs(ratio_to_level_zero(i)); - periodic_shift(i) = d_periodic_shift(i) / abs_ratio; + for (int i = 0; i < d_dim.getValue(); ++i) { + if (block_ratio(i) > 0) { + periodic_shift(i) = d_periodic_shift(i) * block_ratio(i); + } else { + int abs_ratio = abs(block_ratio(i)); + periodic_shift(i) = d_periodic_shift(i) / abs_ratio; + } } } return periodic_shift; @@ -1588,23 +1722,23 @@ BaseGridGeometry::checkPeriodicValidity( Box domain_box = dup_domain.getBoundingBox(); domain_box.grow(grow_direction); - int i; + tbox::Dimension::dir_t i; Index min_index(d_dim, 0), max_index(d_dim, 0); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { //set min/max of the bounding box min_index(i) = domain_box.lower(i); max_index(i) = domain_box.upper(i); } /* - * Next, for each dimension, grow another "duplicate" domain + * Next, for each direction, grow another "duplicate" domain * by 1. Remove the intersections with the original domain, * and loop through the remaining box list, checking if the * upper index of the box matches the bounding box max or the * lower index of the box matches the bounding box min. If - * not, this dimension is not a valid periodic dimension. + * not, this direction is not a valid periodic direction. */ - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { BoxContainer dup_domain2(domain); IntVector grow_one(d_dim, 0); grow_one(i) = 1; @@ -1612,7 +1746,7 @@ BaseGridGeometry::checkPeriodicValidity( dup_domain2.unorder(); dup_domain2.removeIntersections(domain); - BoxContainer::iterator n(dup_domain2); + BoxContainer::iterator n = dup_domain2.begin(); for ( ; n != dup_domain2.end(); ++n) { Box this_box = *n; Index box_lower = this_box.lower(); @@ -1626,7 +1760,7 @@ BaseGridGeometry::checkPeriodicValidity( } } - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if ((valid_direction(i) == 0) && (d_periodic_shift(i) != 0)) { is_valid = false; @@ -1654,7 +1788,7 @@ BaseGridGeometry::checkBoundaryBox( const int num_per_dirs, const IntVector& max_data_ghost_width) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, + TBOX_ASSERT_OBJDIM_EQUALITY4(*this, boundary_box, patch, max_data_ghost_width); @@ -1668,7 +1802,7 @@ BaseGridGeometry::checkBoundaryBox( */ IntVector box_size(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { box_size(i) = bbox.numberCells(i); } @@ -1689,21 +1823,21 @@ BaseGridGeometry::checkBoundaryBox( if (!grow_patch_box.isSpatiallyEqual((grow_patch_box + bbox))) { bool valid_box = false; grow_patch_box = patch_box; - for (int j = 0; j < d_dim.getValue(); j++) { + for (tbox::Dimension::dir_t j = 0; j < d_dim.getValue(); ++j) { if (num_per_dirs == 0) { - for (int k = 1; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 1; k < d_dim.getValue(); ++k) { - grow_patch_box.grow((j + k) % d_dim.getValue(), + grow_patch_box.grow(static_cast((j + k) % d_dim.getValue()), max_data_ghost_width((j + k) % d_dim.getValue())); } } else { - for (int k = 1; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 1; k < d_dim.getValue(); ++k) { - grow_patch_box.grow((j + k) % d_dim.getValue(), + grow_patch_box.grow(static_cast((j + k) % d_dim.getValue()), 2 * max_data_ghost_width((j + k) % d_dim.getValue())); } @@ -1726,7 +1860,7 @@ BaseGridGeometry::checkBoundaryBox( BoxContainer bbox_list(bbox); bbox_list.intersectBoxes(domain); - if (bbox_list.size()) { + if (!bbox_list.empty()) { return_val = false; } @@ -1744,50 +1878,13 @@ BaseGridGeometry::readBlockDataFromInput( { TBOX_ASSERT(input_db); - d_singularity.resizeArray(d_number_blocks); - d_singularity_indices.resizeArray(d_number_blocks); - d_reduced_connect.resizeArray(d_number_blocks); - d_block_neighbors.resizeArray(d_number_blocks); + d_singularity.resize(d_number_blocks); + d_block_neighbors.resize(d_number_blocks); std::string sing_name; std::string neighbor_name; - for (int i = 0; i < d_number_blocks; i++) { - - d_reduced_connect[i] = false; - - } - - for (d_number_of_block_singularities = 0; true; ++d_number_of_block_singularities) { - - sing_name = "Singularity" + tbox::Utilities::intToString(d_number_of_block_singularities); - - if (!input_db->keyExists(sing_name)) { - break; - } - - boost::shared_ptr sing_db( - input_db->getDatabase(sing_name)); - - tbox::Array blocks = sing_db->getIntegerArray("blocks"); - - for (int i = 0; i < blocks.size(); i++) { - - const int block_number = blocks[i]; - - std::string block_box_name = "sing_box_" - + tbox::Utilities::intToString(block_number); - - Box sing_box(sing_db->getDatabaseBox(block_box_name)); - sing_box.setBlockId(BlockId(block_number)); - - d_singularity[block_number].pushFront(sing_box); - - d_singularity_indices[block_number].push_back(d_number_of_block_singularities); - } - } - - for (int bn = 0; true; bn++) { + for (int bn = 0; true; ++bn) { neighbor_name = "BlockNeighbors" + tbox::Utilities::intToString(bn); if (!input_db->keyExists(neighbor_name)) { @@ -1804,19 +1901,19 @@ BaseGridGeometry::readBlockDataFromInput( if (d_dim.getValue() == 1) { rotation_b_to_a = Transformation::NO_ROTATE; } else { - tbox::Array rstr = - pair_db->getStringArray("rotation_b_to_a"); + std::vector rstr = + pair_db->getStringVector("rotation_b_to_a"); rotation_b_to_a = Transformation::getRotationIdentifier(rstr, d_dim); - tbox::Array b_array = - pair_db->getIntegerArray("point_in_b_space"); - tbox::Array a_array = - pair_db->getIntegerArray("point_in_a_space"); + std::vector b_array = + pair_db->getIntegerVector("point_in_b_space"); + std::vector a_array = + pair_db->getIntegerVector("point_in_a_space"); Index b_index(d_dim); Index a_index(d_dim); - for (int p = 0; p < d_dim.getValue(); p++) { + for (int p = 0; p < d_dim.getValue(); ++p) { b_index(p) = b_array[p]; a_index(p) = a_array[p]; } @@ -1831,136 +1928,786 @@ BaseGridGeometry::readBlockDataFromInput( shift = a_point - b_rotated_point; } - bool is_singularity = - pair_db->getBoolWithDefault("is_singularity", false); - registerNeighbors(block_a, block_b, - rotation_b_to_a, shift, is_singularity); + rotation_b_to_a, shift); } + /* + * Each singularity exists where a certain set of blocks touch. + * Each element of this vector represents a singularity, and the + * set of integers are the block numbers for the blocks touching that + * singularity. + */ + std::set > singularity_blocks; if (d_number_blocks > 1) { - for (int b = 0; b < d_number_blocks; b++) { - BlockId block_id(b); - BoxContainer pseudo_domain; - getDomainOutsideBlock(pseudo_domain, block_id); - - BoxContainer block_domain(d_physical_domain, block_id); - pseudo_domain.spliceFront(block_domain); - - for (BoxContainer::iterator - si(d_singularity[b]); si != d_singularity[b].end(); ++si) { - BoxContainer test_domain(pseudo_domain); - test_domain.intersectBoxes(*si); - if (test_domain.size() == 0) { - d_reduced_connect[b] = true; - break; - } - } - } + findSingularities(singularity_blocks); } -} - -/* - * ************************************************************************ - * - * Get a BoxContainer representing all of the domain outside the given block. - * - * ************************************************************************ - */ + d_number_of_block_singularities = + static_cast(singularity_blocks.size()); -void -BaseGridGeometry::getDomainOutsideBlock( - BoxContainer& domain_outside_block, - const BlockId& block_id) const -{ - const std::list& nbr_list = - d_block_neighbors[block_id.getBlockValue()]; - for (std::list::const_iterator nei = nbr_list.begin(); - nei != nbr_list.end(); nei++) { - BoxContainer transformed_domain(nei->getTransformedDomain()); - domain_outside_block.spliceFront(transformed_domain); + if (d_number_blocks == 1 && d_number_of_block_singularities > 0) { + TBOX_ERROR("BaseGridGeometry::readBlockDataFromInput() error...\n" + << "block singularities specified for single block problem." + << std::endl); } -} -/* - * ************************************************************************ - * - * Register a neighbor relationship between two blocks. - * - * ************************************************************************ - */ + if (d_number_of_block_singularities > 0) { -void -BaseGridGeometry::registerNeighbors( - const BlockId& block_a, - const BlockId& block_b, - const Transformation::RotationIdentifier rotation, - const IntVector& shift, - const int is_singularity) -{ - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, shift); + /* + * Process the singularites to determine if they are enhanced or + * reduced connectivity, then compute and store needed internal data + * for each case. + */ + for (std::set >::iterator + si = singularity_blocks.begin(); + si != singularity_blocks.end(); ++si) { - const int& a = block_a.getBlockValue(); - const int& b = block_b.getBlockValue(); - BoxContainer b_domain_in_a_space(d_physical_domain, block_b); - BoxContainer a_domain_in_b_space(d_physical_domain, block_a); - b_domain_in_a_space.unorder(); - a_domain_in_b_space.unorder(); + for (std::set::iterator sbi = si->begin(); + sbi != si->end(); ++sbi) { - Transformation::RotationIdentifier back_rotation = - Transformation::getReverseRotationIdentifier(rotation, d_dim); - IntVector back_shift(d_dim); + const BlockId& cur_block_id = *sbi; + const BlockId::block_t& cur_block = cur_block_id.getBlockValue(); + BoxContainer cur_grow(d_physical_domain, cur_block_id); + cur_grow.unorder(); + cur_grow.grow(IntVector::getOne(d_dim)); + cur_grow.simplify(); - if (d_dim.getValue() == 2 || d_dim.getValue() == 3) { - Transformation::calculateReverseShift(back_shift, shift, rotation); - } else { - TBOX_ERROR("BaseGridGeometry::registerNeighbors error...\n" - << " object name = " << d_object_name - << " Multiblock only works for 2D and 3D" << std::endl); - } + std::map& nbr_map = + d_block_neighbors[cur_block]; - bool rotation_needed; - if (rotation != 0) { - rotation_needed = true; - } else { - rotation_needed = false; - } + /* + * nbr_ghost_buffer will contain buffers of width 1 covering the + * space immediately across the block boundary with each + * neighboring block. The Boxes representing these buffers + * are all transformed to the index spce of the current block. + */ + std::map nbr_ghost_buffer; - if (rotation_needed) { - b_domain_in_a_space.rotate(rotation); - a_domain_in_b_space.rotate(back_rotation); - } - b_domain_in_a_space.shift(shift); - a_domain_in_b_space.shift(back_shift); + for (std::map::iterator nei = nbr_map.begin(); + nei != nbr_map.end(); ++nei) { - for (BoxContainer::iterator itr = b_domain_in_a_space.begin(); - itr != b_domain_in_a_space.end(); ++itr) { - itr->setBlockId(block_a); + const BlockId& nbr_blk = nei->second.getBlockId(); + + if (si->find(nbr_blk) != si->end()) { + + BoxContainer transformed_domain( + nei->second.getTransformedDomain()); + transformed_domain.unorder(); + transformed_domain.intersectBoxes(cur_grow); + + nbr_ghost_buffer[nbr_blk] = transformed_domain; + } + } + + /* + * Compare all the buffers in nbr_ghost_buffer to see if + * any cover the same index space from the perspective of the + * current block. If any do, that means the current block has + * more than one block neighbor that can fill the same ghost + * region. Those neighbors are enhanced connectivity neighbors + * at this singularity. + */ + std::set encon_nbrs; + for (std::map::iterator ng_itr = + nbr_ghost_buffer.begin(); + ng_itr != nbr_ghost_buffer.end(); ++ng_itr) { + + const BoxContainer& ghost_buf = ng_itr->second; + + for (std::map::iterator other = ng_itr; + other != nbr_ghost_buffer.end(); ++other) { + + if (other != ng_itr) { + + BoxContainer test_boxes(other->second); + test_boxes.intersectBoxes(ghost_buf); + if (!test_boxes.empty()) { + test_boxes.coalesce(); + d_singularity[cur_block].spliceFront(test_boxes); + encon_nbrs.insert(ng_itr->first.getBlockValue()); + encon_nbrs.insert(other->first.getBlockValue()); + } + } + } + } + + /* + * If neighboring blocks have been identified as enhanced + * connectivity neighbors, set the flag in the Neighbor objects. + */ + if (!encon_nbrs.empty()) { + + d_has_enhanced_connectivity = true; + d_singularity[cur_block].coalesce(); + + for (std::map::iterator nei = nbr_map.begin(); + nei != nbr_map.end(); ++nei) { + + const BlockId& nbr_blk = nei->second.getBlockId(); + if (encon_nbrs.find(nbr_blk.getBlockValue()) != + encon_nbrs.end()) { + + nei->second.setSingularity(true); + + } + } + + } else { + + /* + * If no enhanced connectivity neighbors have been found, we + * must be at a reduced connectivity singularity. + */ + + /* + * The location of the reduced connectivity singularity is + * found by converting the block domain boxes to node-centered + * representations and finding the intersection between + * the blocks in singularity_blocks[si]. + */ + + BoxContainer cur_domain(d_physical_domain, cur_block_id); + cur_domain.coalesce(); + + BoxContainer cur_domain_nodal(cur_domain); + for (BoxContainer::iterator cdn = cur_domain_nodal.begin(); + cdn != cur_domain_nodal.end(); ++cdn) { + cdn->setUpper(cdn->upper() + IntVector::getOne(d_dim)); + } + + for (std::map::iterator nei = nbr_map.begin(); + nei != nbr_map.end(); ++nei) { + + const BlockId& nbr_blk = nei->second.getBlockId(); + + if (si->find(nbr_blk) != si->end()) { + + BoxContainer nbr_block_nodal( + nei->second.getTransformedDomain()); + for (BoxContainer::iterator nbn = nbr_block_nodal.begin(); + nbn != nbr_block_nodal.end(); ++nbn) { + nbn->setUpper(nbn->upper() + IntVector::getOne(d_dim)); + } + + cur_domain_nodal.intersectBoxes(nbr_block_nodal); + } + } + cur_domain_nodal.coalesce(); + TBOX_ASSERT(cur_domain_nodal.size() <= 1); + + /* + * cur_domain_nodal now contains a node-centered box that + * represents the location of the singularity. Here we + * convert that box to a cell-centered box located immediately + * outside the current block's domain. + */ + if (!cur_domain_nodal.empty()) { + + const Box& sing_node_box = *(cur_domain_nodal.begin()); + Box sing_box(d_dim); + sing_box.setBlockId(cur_block_id); + + size_t sing_size = sing_node_box.size(); + + if (sing_size == 1) { + + /* + * single point singularity. + */ + const Index& sing_node = sing_node_box.lower(); + + bool found_corner[d_dim.getValue()]; + for (int d = 0; d < d_dim.getValue(); ++d) { + found_corner[d] = false; + } + + bool use_box = true; + + for (BoxContainer::iterator cd = cur_domain.begin(); + cd != cur_domain.end(); ++cd) { + + const Box& domain_box = *cd; + + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + + if (sing_node(d) == domain_box.lower(d)) { + sing_box.setLower(d, sing_node(d) - 1); + sing_box.setUpper(d, sing_node(d) - 1); + found_corner[d] = true; + } else if (sing_node(d) == domain_box.upper(d) + 1) { + sing_box.setLower(d, sing_node(d)); + sing_box.setUpper(d, sing_node(d)); + found_corner[d] = true; + } + } + + for (int d = 0; d < d_dim.getValue(); ++d) { + if (!found_corner[d]) { + use_box = false; + } + } + + if (use_box) { + d_singularity[cur_block].pushFront(sing_box); + break; + } + } + } else { + /* + * Line singularities + */ + TBOX_ASSERT(d_dim.getValue() == 3); + + IntVector width(sing_node_box.numberCells()); + int num_width_one = 0; + int long_dir = -1; + for (int d = 0; d < d_dim.getValue(); ++d) { + if (width[d] == 1) { + ++num_width_one; + } else { + long_dir = d; + } + } + TBOX_ASSERT(long_dir >= 0); + + if (num_width_one != 2) { + TBOX_ERROR("BaseGridGeometry::readBlockDataFromInput error...\n" + << " object name = " << d_object_name + << " The computed singularity boundary for " + << sing_name << " is neither a point nor a line. " + << " The user should verify that the input for " + << " the blocks at this singulary is correct." + << std::endl); + TBOX_ERROR("The computed singularity boundary between "); + } + + const Index& sing_node = sing_node_box.lower(); + + bool found_corner[d_dim.getValue()]; + for (int d = 0; d < d_dim.getValue(); ++d) { + found_corner[d] = false; + } + + bool use_box = true; + + for (BoxContainer::iterator cd = cur_domain.begin(); + cd != cur_domain.end(); ++cd) { + + const Box& domain_box = *cd; + + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + + if (d != long_dir) { + if (sing_node(d) == domain_box.lower(d)) { + sing_box.setLower(d, sing_node(d) - 1); + sing_box.setUpper(d, sing_node(d) - 1); + found_corner[d] = true; + } else if (sing_node(d) == domain_box.upper(d) + 1) { + sing_box.setLower(d, sing_node(d)); + sing_box.setUpper(d, sing_node(d)); + found_corner[d] = true; + } + } else { + sing_box.setLower(d, sing_node_box.lower() (d)); + sing_box.setUpper(d, sing_node_box.upper() (d) - 1); + } + } + + for (int d = 0; d < d_dim.getValue(); ++d) { + if (d != long_dir && !found_corner[d]) { + use_box = false; + } + } + if (use_box) { + d_singularity[cur_block].pushFront(sing_box); + break; + } + } + } + } + } + } + } + } +} + +/* + * ************************************************************************ + * + * Get a BoxContainer representing all of the domain outside the given block. + * + * ************************************************************************ + */ + +void +BaseGridGeometry::getDomainOutsideBlock( + BoxContainer& domain_outside_block, + const BlockId& block_id) const +{ + const std::map& nbr_map = + d_block_neighbors[block_id.getBlockValue()]; + for (std::map::const_iterator nei = nbr_map.begin(); + nei != nbr_map.end(); ++nei) { + BoxContainer transformed_domain(nei->second.getTransformedDomain()); + domain_outside_block.spliceFront(transformed_domain); + } +} + +/* + * ************************************************************************ + * + * Register a neighbor relationship between two blocks. + * + * ************************************************************************ + */ + +void +BaseGridGeometry::registerNeighbors( + const BlockId& block_a, + const BlockId& block_b, + const Transformation::RotationIdentifier rotation, + const IntVector& shift_b_to_a) +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, shift_b_to_a); + + const BlockId::block_t& a = block_a.getBlockValue(); + const BlockId::block_t& b = block_b.getBlockValue(); + BoxContainer b_domain_in_a_space(d_physical_domain, block_b); + BoxContainer a_domain_in_b_space(d_physical_domain, block_a); + b_domain_in_a_space.unorder(); + a_domain_in_b_space.unorder(); + + Transformation::RotationIdentifier back_rotation = + Transformation::getReverseRotationIdentifier(rotation, d_dim); + IntVector back_shift(d_dim); + + if (d_dim.getValue() == 2 || d_dim.getValue() == 3) { + Transformation::calculateReverseShift(back_shift, + shift_b_to_a, + rotation); + } else { + TBOX_ERROR("BaseGridGeometry::registerNeighbors error...\n" + << " object name = " << d_object_name + << " Multiblock only works for 2D and 3D" << std::endl); + } + + bool rotation_needed; + if (rotation != 0) { + rotation_needed = true; + } else { + rotation_needed = false; + } + + if (rotation_needed) { + b_domain_in_a_space.rotate(rotation); + a_domain_in_b_space.rotate(back_rotation); + } + b_domain_in_a_space.shift(shift_b_to_a); + a_domain_in_b_space.shift(back_shift); + + for (BoxContainer::iterator itr = b_domain_in_a_space.begin(); + itr != b_domain_in_a_space.end(); ++itr) { + itr->setBlockId(block_a); } for (BoxContainer::iterator itr = a_domain_in_b_space.begin(); itr != a_domain_in_b_space.end(); ++itr) { itr->setBlockId(block_b); } - Transformation transformation(rotation, shift, block_b, block_a); - Transformation back_transformation(back_rotation, back_shift, - block_a, block_b); + std::vector transformation; + transformation.push_back(Transformation(rotation, + shift_b_to_a, + block_b, + block_a)); + std::vector back_transformation; + back_transformation.push_back(Transformation(back_rotation, + back_shift, + block_a, + block_b)); Neighbor neighbor_of_b(block_a, a_domain_in_b_space, - back_transformation, - is_singularity); + back_transformation); Neighbor neighbor_of_a(block_b, b_domain_in_a_space, - transformation, - is_singularity); + transformation); + + std::pair nbr_of_a_pair(block_b, neighbor_of_a); + d_block_neighbors[a].insert(nbr_of_a_pair); + std::pair nbr_of_b_pair(block_a, neighbor_of_b); + d_block_neighbors[b].insert(nbr_of_b_pair); +} + +/* + * ************************************************************************ + * + * Find singularities + * + * ************************************************************************ + */ + +void BaseGridGeometry::findSingularities( + std::set >& singularity_blocks) +{ + TBOX_ASSERT(d_number_blocks > 1); + TBOX_ASSERT(singularity_blocks.empty()); + + BoxContainer chopped_domain; + chopDomain(chopped_domain); + + chopped_domain.makeTree(this); + + std::map > face_neighbors; + + for (BoxContainer::iterator b_itr = chopped_domain.begin(); + b_itr != chopped_domain.end(); ++b_itr) { + + const Box& base_box = *b_itr; + const BlockId& base_block = base_box.getBlockId(); + const BoxId& base_id = base_box.getBoxId(); + + Box grow_base(base_box); + grow_base.grow(IntVector::getOne(d_dim)); + + std::vector nbr_boxes; + chopped_domain.findOverlapBoxes(nbr_boxes, grow_base, IntVector::getOne(d_dim)); + + const std::map& nbrs_of_base = + d_block_neighbors[base_block.getBlockValue()]; + + for (std::vector::const_iterator n_itr = nbr_boxes.begin(); + n_itr != nbr_boxes.end(); ++n_itr) { + + const Box& nbr_box = **n_itr; + const BoxId& nbr_id = nbr_box.getBoxId(); + + if (nbr_id <= base_id) { + continue; + } + + const BlockId& nbr_block = nbr_box.getBlockId(); + if (base_block != nbr_block && + nbrs_of_base.find(nbr_block) == nbrs_of_base.end()) { + continue; + } + + if (face_neighbors[base_id].find(nbr_id) != + face_neighbors[base_id].end()) { + TBOX_ASSERT(face_neighbors[nbr_id].find(base_id) != + face_neighbors[nbr_id].end()); + + continue; + } + + Box base_node_box(base_box); + base_node_box.setUpper( + base_node_box.upper() + IntVector::getOne(d_dim)); + + Box transformed_nbr_box(nbr_box); + if (nbr_block != base_block) { + transformBox(transformed_nbr_box, + 0, + base_block, + nbr_block); + } + + Box& nbr_node_box = transformed_nbr_box; + nbr_node_box.setUpper( + nbr_node_box.upper() + IntVector::getOne(d_dim)); + + Box face_box(base_node_box * nbr_node_box); + + bool is_face = false; + int face_num = -1; - d_block_neighbors[a].push_front(neighbor_of_a); - d_block_neighbors[b].push_front(neighbor_of_b); + if (!face_box.empty()) { + IntVector box_size(face_box.numberCells()); + + int num_width_one = 0; + int normal_dir = -1; + for (int d = 0; d < d_dim.getValue(); ++d) { + if (box_size[d] == 1) { + ++num_width_one; + normal_dir = d; + } + } + + if (num_width_one == 1) { + is_face = true; + if (face_box.lower() (normal_dir) == + base_node_box.lower() (normal_dir)) { + face_num = 2 * normal_dir; + } else { + face_num = 2 * normal_dir + 1; + } + } + } + + if (is_face) { + TBOX_ASSERT(face_num >= 0); + face_neighbors[base_id].insert(std::make_pair(nbr_id, face_num)); + + Box transformed_base_box(base_box); + if (nbr_block != base_block) { + transformBox(transformed_base_box, + 0, + nbr_block, + base_block); + } + + transformed_base_box.setUpper( + transformed_base_box.upper() + IntVector::getOne(d_dim)); + + nbr_node_box = nbr_box; + nbr_node_box.setUpper( + nbr_node_box.upper() + IntVector::getOne(d_dim)); + + face_box = transformed_base_box * nbr_node_box; + + if (!face_box.empty()) { + IntVector box_size(face_box.numberCells()); + face_num = -1; + int num_width_one = 0; + int normal_dir = -1; + + for (int d = 0; d < d_dim.getValue(); ++d) { + if (box_size[d] == 1) { + ++num_width_one; + normal_dir = d; + } + } + + if (num_width_one == 1) { + is_face = true; + if (face_box.lower() (normal_dir) == + nbr_node_box.lower() (normal_dir)) { + face_num = 2 * normal_dir; + } else { + face_num = 2 * normal_dir + 1; + } + } else { + TBOX_ERROR( + "BaseGridGeometry::findSingularities: Face found on one side of block boundary but not the other."); + } + + face_neighbors[nbr_id].insert(std::make_pair(base_id, face_num)); + } + } + } + } - if (is_singularity) { - d_has_enhanced_connectivity = true; + if (!face_neighbors.empty()) { + if (d_singularity_finder.get() == 0) { + d_singularity_finder.reset(new SingularityFinder(d_dim)); + } + d_singularity_finder->findSingularities(singularity_blocks, + chopped_domain, + *this, + face_neighbors); } +} + +/* + * ************************************************************************ + * + * Chop domain to eliminate T-junctions. + * + * ************************************************************************ + */ +void +BaseGridGeometry::chopDomain( + BoxContainer& chopped_domain) +{ + TBOX_ASSERT(chopped_domain.empty()); + + chopped_domain = d_physical_domain; + chopped_domain.order(); + + std::map > dont_chop; + std::map > neighbors; + + bool breaking_needed = true; + bool chopped = false; + while (breaking_needed) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + BlockId base_block(b); + + const std::map& nbrs_of_base = d_block_neighbors[b]; + + BoxContainerSingleBlockIterator bi(chopped_domain.begin(base_block)); + + chopped = false; + for ( ; bi != chopped_domain.end(base_block); ++bi) { + + const Box& base_box = *bi; + const BoxId& base_id = base_box.getBoxId(); + Box base_node_box(base_box); + base_node_box.setUpper( + base_node_box.upper() + IntVector::getOne(d_dim)); + IntVector base_node_size(base_node_box.numberCells()); + + BoxContainerSingleBlockIterator si( + chopped_domain.begin(base_block)); + + for ( ; si != chopped_domain.end(base_block); ++si) { + const BoxId& other_id = si->getBoxId(); + if (base_id != other_id) { + if (dont_chop[base_id].find(other_id) == dont_chop[base_id].end()) { + Box nbr_node_box(*si); + nbr_node_box.setUpper( + nbr_node_box.upper() + IntVector::getOne(d_dim)); + + Box intersect(base_node_box * nbr_node_box); + if (!intersect.empty()) { + neighbors[base_id].insert(other_id); + neighbors[other_id].insert(base_id); + IntVector intersect_size(intersect.numberCells()); + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + if (intersect_size[d] != 1) { + if (intersect_size[d] != base_node_size[d]) { + bool chop_low; + int chop; + if (base_box.lower() (d) != si->lower() (d)) { + chop = std::max(base_box.lower(d), + si->lower(d)); + chop_low = true; + } else { + chop = std::min(base_box.upper(d), + si->upper(d)); + chop_low = false; + } + + BoxContainer::iterator box_itr = + chopped_domain.find(base_box); + + LocalId local_id(chopped_domain.size()); + Box new_box(base_box, local_id, 0); + if (chop_low == true) { + new_box.setLower(d, chop); + box_itr->setUpper(d, chop - 1); + } else { + new_box.setUpper(d, chop); + box_itr->setLower(d, chop + 1); + } + chopped_domain.insert(chopped_domain.end(), + new_box); + chopped = true; + + dont_chop[base_id].clear(); + for (std::set::iterator nn_itr = + neighbors[base_id].begin(); + nn_itr != neighbors[base_id].end(); + ++nn_itr) { + + dont_chop[*nn_itr].erase(base_id); + } + break; + } + } + } + } + } + if (chopped) { + break; + } else { + dont_chop[base_id].insert(other_id); + } + } + } + if (chopped) break; + + for (std::map::const_iterator + itr = nbrs_of_base.begin(); + itr != nbrs_of_base.end(); ++itr) { + + const BlockId& nbr_block = itr->second.getBlockId(); + + BoxContainerSingleBlockIterator ni( + chopped_domain.begin(nbr_block)); + + for ( ; ni != chopped_domain.end(nbr_block); ++ni) { + + const BoxId& other_id = ni->getBoxId(); + std::set& nochop = dont_chop[base_id]; + if (nochop.find(other_id) == nochop.end()) { + + Box nbr_box(*ni); + transformBox(nbr_box, + 0, + base_block, + nbr_block); + Box nbr_node_box(nbr_box); + nbr_node_box.setUpper( + nbr_node_box.upper() + IntVector::getOne(d_dim)); + + Box intersect(base_node_box * nbr_node_box); + if (!intersect.empty()) { + neighbors[base_id].insert(other_id); + neighbors[other_id].insert(base_id); + IntVector intersect_size(intersect.numberCells()); + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + if (intersect_size[d] != 1) { + if (intersect_size[d] != base_node_size[d]) { + bool chop_low; + int chop; + if (base_box.lower() (d) != nbr_box.lower() (d)) { + chop = std::max(base_box.lower(d), + nbr_box.lower(d)); + chop_low = true; + } else { + chop = std::min(base_box.upper(d), + nbr_box.upper(d)); + chop_low = false; + } + + BoxContainer::iterator box_itr = + chopped_domain.find(base_box); + + LocalId local_id(chopped_domain.size()); + Box new_box(base_box, local_id, 0); + if (chop_low == true) { + new_box.setLower(d, chop); + box_itr->setUpper(d, chop - 1); + } else { + new_box.setUpper(d, chop); + box_itr->setLower(d, chop + 1); + } + + chopped_domain.insert(chopped_domain.end(), + new_box); + chopped = true; + + nochop.clear(); + for (std::set::iterator nn_itr = + neighbors[base_id].begin(); + nn_itr != neighbors[base_id].end(); + ++nn_itr) { + + dont_chop[*nn_itr].erase(base_id); + } + break; + } + } + } + } + } + + if (chopped) { + break; + } else { + nochop.insert(other_id); + } + } + if (chopped) break; + } + if (chopped) break; + } + if (chopped) break; + } + if (!chopped) { + breaking_needed = false; + } + } } /* @@ -1974,27 +2721,41 @@ BaseGridGeometry::registerNeighbors( bool BaseGridGeometry::transformBox( Box& box, - const IntVector& ratio, + int level_number, const BlockId& output_block, const BlockId& input_block) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, box, ratio); - - const std::list& nbr_list = - d_block_neighbors[output_block.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == input_block) { - IntVector refined_shift = (ni->getShift()) * (ratio); - box.rotate(ni->getRotationIdentifier()); - box.shift(refined_shift); - box.setBlockId(output_block); - return true; - } + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + + const BlockId::block_t& out_blk = output_block.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[out_blk].find(input_block); + if (itr != d_block_neighbors[out_blk].end()) { + const Neighbor& neighbor = itr->second; + const IntVector& refined_shift = neighbor.getShift(level_number); + box.rotate(neighbor.getRotationIdentifier()); + box.shift(refined_shift); + box.setBlockId(output_block); + return true; } return false; } +bool +BaseGridGeometry::transformBox( + Box& box, + const IntVector& ratio, + const BlockId& output_block, + const BlockId& input_block) const +{ + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, box, ratio); + + return transformBox(box, + getEquivalentLevelNumber(ratio), + output_block, + input_block); +} + /* * ************************************************************************ * @@ -2012,20 +2773,19 @@ BaseGridGeometry::transformBoxContainer( const BlockId& output_block, const BlockId& input_block) const { - const std::list& nbr_list = - d_block_neighbors[output_block.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == input_block) { - IntVector refined_shift = (ni->getShift()) * (ratio); - boxes.rotate(ni->getRotationIdentifier()); - boxes.shift(refined_shift); - for (BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); - ++itr) { - itr->setBlockId(output_block); - } - return true; + const BlockId::block_t& out_blk = output_block.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[out_blk].find(input_block); + if (itr != d_block_neighbors[out_blk].end()) { + const Neighbor& neighbor = itr->second; + const IntVector& refined_shift = neighbor.getShift(getEquivalentLevelNumber(ratio)); + boxes.rotate(neighbor.getRotationIdentifier()); + boxes.shift(refined_shift); + for (BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); + ++itr) { + itr->setBlockId(output_block); } + return true; } return false; } @@ -2045,14 +2805,11 @@ BaseGridGeometry::getTransformedBlock( const BlockId& base_block, const BlockId& transformed_block) { - std::list& nbr_list = - d_block_neighbors[base_block.getBlockValue()]; - for (std::list::iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == transformed_block) { - block = ni->getTransformedDomain(); - break; - } + const BlockId::block_t& base_blk = base_block.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[base_blk].find(transformed_block); + if (itr != d_block_neighbors[base_blk].end()) { + block = itr->second.getTransformedDomain(); } } @@ -2069,17 +2826,19 @@ void BaseGridGeometry::adjustMultiblockPatchLevelBoundaries( PatchLevel& patch_level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch_level); TBOX_ASSERT(patch_level.getGridGeometry()->getNumberBlocks() == d_number_blocks); if (d_number_blocks > 1) { - const BoxContainer& d_mapped_boxes = + t_adjust_multiblock_patch_level_boundaries->start(); + + const BoxContainer& d_boxes = patch_level.getBoxLevel()->getBoxes(); IntVector gcw(patch_level.getPatchDescriptor()->getMaxGhostWidth(d_dim)); - for (int nb = 0; nb < d_number_blocks; nb++) { + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { const BlockId block_id(nb); @@ -2088,32 +2847,34 @@ BaseGridGeometry::adjustMultiblockPatchLevelBoundaries( BoxContainer pseudo_domain; - std::list& nbr_list = d_block_neighbors[nb]; - for (std::list::iterator nei = nbr_list.begin(); - nei != nbr_list.end(); nei++) { - BoxContainer transformed_domain(nei->getTransformedDomain()); + std::map& nbr_map = d_block_neighbors[nb]; + for (std::map::iterator nei = nbr_map.begin(); + nei != nbr_map.end(); ++nei) { + BoxContainer transformed_domain(nei->second.getTransformedDomain()); pseudo_domain.spliceFront(transformed_domain); } pseudo_domain.refine(patch_level.getRatioToLevelZero()); BoxContainer physical_domain(patch_level.getPhysicalDomain(block_id)); - BoxContainer sing_boxes(singularity); + BoxContainer sing_boxes(singularity); pseudo_domain.spliceFront(physical_domain); pseudo_domain.spliceFront(sing_boxes); pseudo_domain.coalesce(); - BoxContainerSingleBlockIterator mbi(d_mapped_boxes.begin(block_id)); + BoxContainerSingleBlockIterator mbi(d_boxes.begin(block_id)); - for ( ; mbi != d_mapped_boxes.end(block_id); ++mbi) { - const BoxId& mapped_box_id = mbi->getId(); + for ( ; mbi != d_boxes.end(block_id); ++mbi) { + const BoxId& box_id = mbi->getBoxId(); adjustBoundaryBoxesOnPatch( - *patch_level.getPatch(mapped_box_id), + *patch_level.getPatch(box_id), pseudo_domain, gcw, singularity); } } + + t_adjust_multiblock_patch_level_boundaries->stop(); } } @@ -2133,7 +2894,7 @@ BaseGridGeometry::adjustBoundaryBoxesOnPatch( const IntVector& gcw, const BoxContainer& singularity) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, patch, gcw); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, patch, gcw); /* * Avoid adjusting boundary boxes for the case where we just use @@ -2149,39 +2910,34 @@ BaseGridGeometry::adjustBoundaryBoxesOnPatch( gcw, IntVector::getZero(d_dim)); - tbox::Array codim_boundaries[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; - std::list boundaries_in_sing[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; - for (int codim = 2; codim <= d_dim.getValue(); codim++) { + std::vector codim_boundaries[SAMRAI::MAX_DIM_VAL]; + std::list boundaries_in_sing[SAMRAI::MAX_DIM_VAL]; + for (int codim = 2; codim <= d_dim.getValue(); ++codim) { codim_boundaries[codim - 1] = patch.getPatchGeometry()->getCodimensionBoundaries(codim); - int num_boxes = codim_boundaries[codim - 1].size(); + int num_boxes = static_cast(codim_boundaries[codim - 1].size()); - for (int n = 0; n < num_boxes; n++) { + for (int n = 0; n < num_boxes; ++n) { Box border_box(codim_boundaries[codim - 1][n].getBox()); BoxContainer sing_test_list(singularity); sing_test_list.intersectBoxes(border_box); - if (sing_test_list.size() != 0) { + if (!sing_test_list.empty()) { boundaries_in_sing[codim - 1].push_front(n); } } } - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { if (!boundaries_in_sing[i].empty()) { - int old_size = boundaries[i].size(); - int new_size = - old_size + static_cast(boundaries_in_sing[i].size()); - boundaries[i].resizeArray(new_size, BoundaryBox(d_dim)); + int old_size = static_cast(boundaries[i].size()); int nb = 0; for (std::list::iterator b = boundaries_in_sing[i].begin(); - b != boundaries_in_sing[i].end(); b++) { - boundaries[i][old_size + nb] = codim_boundaries[i][*b]; + b != boundaries_in_sing[i].end(); ++b) { + boundaries[i].push_back(codim_boundaries[i][*b]); boundaries[i][old_size + nb].setIsMultiblockSingularity(true); - nb++; + ++nb; } } patch.getPatchGeometry()->setCodimensionBoundaries(boundaries[i], @@ -2205,14 +2961,11 @@ BaseGridGeometry::getRotationIdentifier( TBOX_ASSERT(areNeighbors(dst, src)); Transformation::RotationIdentifier rotate = Transformation::NO_ROTATE; - const std::list& nbr_list = - d_block_neighbors[dst.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == src.getBlockValue()) { - rotate = ni->getTransformation().getRotation(); - break; - } + const BlockId::block_t& dst_blk = dst.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[dst_blk].find(src); + if (itr != d_block_neighbors[dst_blk].end()) { + rotate = itr->second.getTransformation(0).getRotation(); } return rotate; @@ -2226,17 +2979,16 @@ BaseGridGeometry::getRotationIdentifier( const IntVector& BaseGridGeometry::getOffset( const BlockId& dst, - const BlockId& src) const + const BlockId& src, + int level_num) const { TBOX_ASSERT(areNeighbors(dst, src)); - const std::list& nbr_list = - d_block_neighbors[dst.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == src.getBlockValue()) { - return ni->getTransformation().getOffset(); - } + const BlockId::block_t& dst_blk = dst.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[dst_blk].find(src); + if (itr != d_block_neighbors[dst_blk].end()) { + return itr->second.getTransformation(level_num).getOffset(); } return IntVector::getOne(d_dim); @@ -2254,14 +3006,11 @@ BaseGridGeometry::areNeighbors( { bool are_neighbors = false; - const std::list& nbr_list = - d_block_neighbors[block_a.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == block_b.getBlockValue()) { - are_neighbors = true; - break; - } + const BlockId::block_t& a_blk = block_a.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[a_blk].find(block_b); + if (itr != d_block_neighbors[a_blk].end()) { + are_neighbors = true; } return are_neighbors; @@ -2279,21 +3028,262 @@ BaseGridGeometry::areSingularityNeighbors( { bool are_sing_neighbors = false; - const std::list& nbr_list = - d_block_neighbors[block_a.getBlockValue()]; - for (std::list::const_iterator ni = nbr_list.begin(); - ni != nbr_list.end(); ni++) { - if (ni->getBlockId() == block_b.getBlockValue()) { - if (ni->isSingularity()) { - are_sing_neighbors = true; + const BlockId::block_t& a_blk = block_a.getBlockValue(); + std::map::const_iterator itr = + d_block_neighbors[a_blk].find(block_b); + if (itr != d_block_neighbors[a_blk].end()) { + if (itr->second.isSingularity()) { + are_sing_neighbors = true; + } + } + + return are_sing_neighbors; +} + +void +BaseGridGeometry::setUpRatios( + const std::vector& ratio_to_coarser) +{ + int max_levels = static_cast(ratio_to_coarser.size()); + TBOX_ASSERT(max_levels > 0); + + d_ratio_to_level_zero.resize(max_levels, + IntVector(IntVector::getOne(d_dim), d_number_blocks)); + for (int ln = 1; ln < max_levels; ++ln) { + d_ratio_to_level_zero[ln] = d_ratio_to_level_zero[ln-1] * + ratio_to_coarser[ln]; + } + + if (d_number_blocks > 1) { + for (int ln = 1; ln < max_levels; ++ln) { + if (d_ratio_to_level_zero[ln].min() != + d_ratio_to_level_zero[ln].max()) { + d_ratios_are_isotropic = false; break; } } } - return are_sing_neighbors; + if (d_number_blocks > 1 && max_levels > 1) { + setUpFineLevelTransformations(); + } +} + +void +BaseGridGeometry::setUpFineLevelTransformations() +{ + int max_levels = static_cast(d_ratio_to_level_zero.size()); + + const IntVector& one_vector = IntVector::getOne(d_dim); + + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + + BlockId block_id(b); + + BoxContainer grow_domain; + computePhysicalDomain(grow_domain, IntVector::getOne(d_dim), block_id); + TBOX_ASSERT(d_number_blocks == 1 || grow_domain.size() == 1); + Box domain_box(grow_domain.front()); + grow_domain.unorder(); + + grow_domain.grow(one_vector); + + std::map& neighbors(d_block_neighbors[b]); + + for (int ln = 1; ln < max_levels; ++ln) { + const IntVector& current_ratio = d_ratio_to_level_zero[ln]; + + for (std::map::iterator ni = neighbors.begin(); + ni != neighbors.end(); ++ni) { + + const BlockId& nbr_block = ni->second.getBlockId(); + const BoxContainer& nbr_domain = ni->second.getTransformedDomain(); + TBOX_ASSERT(nbr_domain.size() == 1); + const Box& nbr_box = nbr_domain.front(); + + Box base_node_box(domain_box); + base_node_box.setUpper(base_node_box.upper() + IntVector::getOne(d_dim)); + Box nbr_node_box(nbr_box); + nbr_node_box.setUpper(nbr_node_box.upper() + IntVector::getOne(d_dim)); + + Box shared_base_nodes(base_node_box*nbr_node_box); + IntVector shared_size(shared_base_nodes.numberCells()); + + IntVector base_bdry_dir(IntVector::getZero(d_dim)); + for (int d = 0; d < d_dim.getValue(); ++d) { + if (shared_size[d] == 1) { + if (shared_base_nodes.upper(static_cast(d)) == + base_node_box.lower(static_cast(d))) { + base_bdry_dir[d] = -1; + } else if (shared_base_nodes.lower(static_cast(d)) == + base_node_box.upper(static_cast(d))) { + base_bdry_dir[d] = 1; + } + } + } + + Box transformed_base_box(domain_box); + transformBox(transformed_base_box, + 0, + nbr_block, + block_id); + + Box true_nbr_box(nbr_box); + transformBox(true_nbr_box, + 0, + nbr_block, + block_id); + + Box tran_base_node(transformed_base_box); + tran_base_node.setUpper(tran_base_node.upper() + IntVector::getOne(d_dim)); + Box true_nbr_node(true_nbr_box); + true_nbr_node.setUpper(true_nbr_node.upper() + IntVector::getOne(d_dim)); + Box shared_nbr_nodes(tran_base_node * true_nbr_node); + + shared_size = shared_nbr_nodes.numberCells(); + + IntVector nbr_bdry_dir(IntVector::getZero(d_dim)); + for (int d = 0; d < d_dim.getValue(); ++d) { + if (shared_size[d] == 1) { + if (shared_nbr_nodes.upper(static_cast(d)) == + true_nbr_node.lower(static_cast(d))) { + nbr_bdry_dir[d] = -1; + } else if (shared_nbr_nodes.lower(static_cast(d)) == + true_nbr_node.upper(static_cast(d))) { + nbr_bdry_dir[d] = 1; + } + } + } + + Box refined_base(domain_box); + refined_base.refine(current_ratio); + Box refined_nbr(true_nbr_box); + refined_nbr.refine(current_ratio); + + Box refined_base_node(refined_base); + refined_base_node.setUpper(refined_base_node.upper() + IntVector::getOne(d_dim)); + Box refined_nbr_node(refined_nbr); + refined_nbr_node.setUpper(refined_nbr_node.upper() + IntVector::getOne(d_dim)); + + shared_base_nodes.refine(current_ratio); + shared_nbr_nodes.refine(current_ratio); + shared_base_nodes *= refined_base_node; + shared_nbr_nodes *= refined_nbr_node; + + + Index base_cell(refined_base.lower()); + Index nbr_cell(refined_nbr.lower()); + for (int d = 0; d < d_dim.getValue(); ++d) { + if (base_bdry_dir[d] == -1) { + base_cell[d] = + refined_base.lower(static_cast(d)); + } else if (base_bdry_dir[d] == 1) { + base_cell[d] = + refined_base.upper(static_cast(d)); + } else { + base_cell[d] = + shared_base_nodes.lower(static_cast(d)) + + ((shared_base_nodes.upper(static_cast(d)) - + shared_base_nodes.lower(static_cast(d)))/2); + } + if (nbr_bdry_dir[d] == -1) { + nbr_cell[d] = refined_nbr.lower(static_cast(d)); + } else if (nbr_bdry_dir[d] == 1) { + nbr_cell[d] = refined_nbr.upper(static_cast(d)); + } else { + nbr_cell[d] = + shared_nbr_nodes.lower(static_cast(d)) + + ((shared_nbr_nodes.upper(static_cast(d)) - + shared_nbr_nodes.lower(static_cast(d)))/2); + } + } + + nbr_cell += nbr_bdry_dir; + + Transformation::RotationIdentifier rotation = + ni->second.getRotationIdentifier(); + + Box box_in_base(base_cell, base_cell, block_id); + Box box_in_nbr(nbr_cell, nbr_cell, nbr_block); + + box_in_nbr.rotate(rotation); + + IntVector test_shift(box_in_base.lower() - box_in_nbr.lower()); + + IntVector final_shift (d_dim); + + Box test_box(refined_nbr); + test_box.rotate(rotation); + test_box.shift(test_shift); + test_box.setBlockId(block_id); + Box test_box_node(test_box); + test_box_node.setUpper(test_box_node.upper() + IntVector::getOne(d_dim)); + IntVector sh_num_cells(shared_nbr_nodes.numberCells()); + for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + if (sh_num_cells[d] == + current_ratio(shared_nbr_nodes.getBlockId().getBlockValue(),d)) { + shared_nbr_nodes.setLower(static_cast(d), + shared_nbr_nodes.upper(static_cast(d))); + } + } + size_t sh_size = shared_nbr_nodes.size(); + + if ((test_box_node * refined_base_node).size() == sh_size) { + final_shift = test_shift; + } else { + IntVector adj_shift(d_dim); + Box adj(Index(d_dim,-1),Index(d_dim,1),block_id); + Box::iterator aend(adj.end()); + for (Box::iterator ai(adj.begin()); ai != aend; ++ai) { + adj_shift = test_shift + IntVector(*ai); + test_box_node = refined_nbr; + test_box_node.rotate(rotation); + test_box_node.shift(adj_shift); + test_box_node.setBlockId(block_id); + test_box_node.setUpper(test_box_node.upper() + IntVector::getOne(d_dim)); + + if ((test_box_node * refined_base_node).size() == sh_size) { + final_shift = adj_shift; + break; + } + } + if (final_shift != adj_shift) { + const IntVector& coarse_shift = ni->second.getTransformation(ln-1).getOffset();; + for (int i = 0; i < d_dim.getValue(); ++i) { + if (coarse_shift[i] == 0) { + final_shift[i] = 0; + } else if (test_shift[i] % coarse_shift[i] == 0) { + final_shift[i] = test_shift[i]; + } else if ((test_shift[i]-1) % coarse_shift[i] == 0) { + final_shift[i] = test_shift[i]-1; + } else if ((test_shift[i]+1) % coarse_shift[i] == 0) { + final_shift[i] = test_shift[i]+1; + } else { + TBOX_ERROR("BaseGridGeometry error...\n" + << " Could not compute Level " << ln + << " shift between blocks " + << block_id.getBlockValue() + << " and " << nbr_block.getBlockValue() + << std::endl); + } + } + } + } + + Transformation new_transformation(rotation, + final_shift, + nbr_block, + block_id); + + ni->second.addTransformation(new_transformation, ln); + + } + } + } + } + /* ************************************************************************* * @@ -2323,24 +3313,23 @@ BaseGridGeometry::printClassData( stream << "Block neighbor data:\n"; - for (int bn = 0; bn < d_number_blocks; ++bn) { + for (BlockId::block_t bn = 0; bn < d_number_blocks; ++bn) { stream << " Block " << bn << '\n'; const BlockId block_id(bn); - const std::list& block_neighbors(getNeighbors(block_id)); - - const BoxContainer& singularity_boxlist(getSingularityBoxContainer(block_id)); + const BoxContainer& singularity_boxlist( + getSingularityBoxContainer(block_id)); - for (std::list::const_iterator li = block_neighbors.begin(); - li != block_neighbors.end(); li++) { + for (ConstNeighborIterator li = begin(block_id); + li != end(block_id); ++li) { const Neighbor& neighbor(*li); stream << " neighbor block " << neighbor.getBlockId() << ':'; stream << " singularity = " << neighbor.isSingularity() << '\n'; } stream << " singularity Boxes (" << singularity_boxlist.size() << ")\n"; - for (BoxContainer::const_iterator bi(singularity_boxlist); + for (BoxContainer::const_iterator bi = singularity_boxlist.begin(); bi != singularity_boxlist.end(); ++bi) { stream << " " << *bi << '\n'; } @@ -2359,28 +3348,22 @@ BaseGridGeometry::initializeCallback() { t_find_patches_touching_boundaries = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::findPatchesTouchingBoundaries()"); - TBOX_ASSERT(t_find_patches_touching_boundaries); t_touching_boundaries_init = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::...TouchingBoundaries()_init"); - TBOX_ASSERT(t_touching_boundaries_init); t_touching_boundaries_loop = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::...TouchingBoundaries()_loop"); - TBOX_ASSERT(t_touching_boundaries_loop); t_set_geometry_on_patches = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::setGeometryOnPatches()"); - TBOX_ASSERT(t_set_geometry_on_patches); t_set_boundary_boxes = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::setBoundaryBoxes()"); - TBOX_ASSERT(t_set_boundary_boxes); t_set_geometry_data_on_patches = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::set_geometry_data_on_patches"); - TBOX_ASSERT(t_set_geometry_data_on_patches); t_compute_boundary_boxes_on_level = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::computeBoundaryBoxesOnLevel()"); - TBOX_ASSERT(t_compute_boundary_boxes_on_level); t_get_boundary_boxes = tbox::TimerManager::getManager()-> getTimer("hier::BaseGridGeometry::getBoundaryBoxes()"); - TBOX_ASSERT(t_get_boundary_boxes); + t_adjust_multiblock_patch_level_boundaries = tbox::TimerManager::getManager()-> + getTimer("hier::BaseGridGeometry::adjustMultiblockPatchLevelBoundaries()"); } /* @@ -2409,12 +3392,150 @@ BaseGridGeometry::finalizeCallback() BaseGridGeometry::Neighbor::Neighbor( const BlockId& block_id, const BoxContainer& domain, - const Transformation& transformation, - const bool is_singularity): + const std::vector& transformation): d_block_id(block_id), d_transformed_domain(domain), d_transformation(transformation), - d_is_singularity(is_singularity) + d_is_singularity(false) +{ +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::NeighborIterator::NeighborIterator( + BaseGridGeometry* grid_geometry, + const BlockId& block_id, + bool from_start): + d_grid_geom(grid_geometry), + d_block_id(block_id) +{ + TBOX_ASSERT(grid_geometry != 0); + + if (from_start) { + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].begin(); + } else { + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].end(); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::NeighborIterator::NeighborIterator( + BaseGridGeometry* grid_geometry, + const BlockId& block_id, + const BlockId& nbr_block_id): + d_grid_geom(grid_geometry), + d_block_id(block_id) +{ + TBOX_ASSERT(grid_geometry != 0); + + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].find(nbr_block_id); +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::NeighborIterator::NeighborIterator( + const NeighborIterator& other) +{ + d_grid_geom = other.d_grid_geom; + d_block_id.setId(other.d_block_id.getBlockValue()); + d_nbr_itr = other.d_nbr_itr; +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::NeighborIterator::~NeighborIterator() +{ +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::ConstNeighborIterator::ConstNeighborIterator( + const BaseGridGeometry* grid_geometry, + const BlockId& block_id, + bool from_start): + d_grid_geom(grid_geometry), + d_block_id(block_id) +{ + TBOX_ASSERT(grid_geometry != 0); + + if (from_start) { + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].begin(); + } else { + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].end(); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::ConstNeighborIterator::ConstNeighborIterator( + const BaseGridGeometry* grid_geometry, + const BlockId& block_id, + const BlockId& nbr_block_id): + d_grid_geom(grid_geometry), + d_block_id(block_id) +{ + TBOX_ASSERT(grid_geometry != 0); + + d_nbr_itr = + grid_geometry->d_block_neighbors[block_id.getBlockValue()].find(nbr_block_id); +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::ConstNeighborIterator::ConstNeighborIterator( + const ConstNeighborIterator& other) +{ + d_grid_geom = other.d_grid_geom; + d_block_id.setId(other.d_block_id.getBlockValue()); + d_nbr_itr = other.d_nbr_itr; +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::ConstNeighborIterator::ConstNeighborIterator( + const NeighborIterator& other) +{ + d_grid_geom = other.d_grid_geom; + d_block_id.setId(other.d_block_id.getBlockValue()); + d_nbr_itr = other.d_nbr_itr; +} + +/* + ************************************************************************* + ************************************************************************* + */ + +BaseGridGeometry::ConstNeighborIterator::~ConstNeighborIterator() { } @@ -2428,5 +3549,3 @@ BaseGridGeometry::Neighbor::Neighbor( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.h index 2395225e..5bb33ab0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BaseGridGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management in AMR hierarchy * ************************************************************************/ @@ -18,6 +18,7 @@ #include "SAMRAI/hier/CoarsenOperator.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchGeometry.h" +#include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" #include "SAMRAI/hier/TransferOperatorRegistry.h" @@ -33,8 +34,9 @@ namespace SAMRAI { namespace hier { class BoxLevel; -class PatchLevel; class BoxTree; +class PatchLevel; +class SingularityFinder; /*! * @brief Class BaseGridGeometry manages the index space that determines the @@ -48,68 +50,18 @@ class BoxTree; * about the index space describing the physical domain and computing this * information for patches in an AMR hierarchy. * - * Required input file keys and data types (only required when using first - * constructor which takes an input database): - * - * - @b num_blocks - * Integer value specifying the number of blocks in the multiblock - * mesh configuration. - * - * - @b domain_boxes_ - * For each block, an array of boxes representing the index space for the - * entire domain within a block (on the coarsest mesh level; i.e., level - * zero). The key must have an integer value as a suffix - * (domain_boxes_0, domain_boxes_1, etc.), and there must be an entry - * for every block from 0 to num_blocks-1. - * - * Optional input file keys and data types (for first constructor which - * takes an input database): - * - * - @b periodic_dimension - * An array of integer values (expected number of values is equal to - * the spatial dimension of the mesh) representing the directions in - * which the physical domain is periodic. A non-zero value indicates - * that the direction is periodic. A zero value indicates that - * the direction is not periodic. If no values are specified, then - * the array is initialized to all zeros (no periodic directions). - * This key should only be used when the number of blocks is 1 (a - * single block mesh), as periodic boundaries are not supported for - * multiblock meshes. - * - * - @b BlockNeighbors - * - * For multiblock grids, a BlockNeighbors entry must be given for - * every pair of blocks that touch each other in any way. The key - * for this entry must include a unique trailing integer, and the - * integers for the full set of BlockNeighbors keys must be a - * continuous sequence beginning with 0. - * - * - @b Singularity - * - * When there is a reduced or enhanced connectivity singularity, - * this key must be used to identify which blocks touch the - * singularity and the position of the singularity in relation to - * each block's index space. Like BlockNeighbors, each entry must - * have a trailing integer beginning with 0. - * - * A description of the input format for BlockNeighbors* and Singularity - * is included in the Multiblock.pdf document in the docs/userdocs - * directory of the SAMRAI distribution. - * * @par Additional Functionality * Operations performed by this class include determining which patches are * adjacent to the physical domain boundary and computing boundary boxes * for patches which describe how the patch touches the domain boundary * (useful for filling ghost cell data for physical boundary conditions). * - * @see hier::BoundaryBox + * @see BoundaryBox */ class BaseGridGeometry: public tbox::Serializable { - friend class TransferOperatorRegistry; - public: typedef PatchGeometry::TwoDimBool TwoDimBool; @@ -119,52 +71,43 @@ class BaseGridGeometry: * * This constructor for BaseGridGeometry initializes data members * based on parameters read from the specified input database. - * The constructor also registers this object for restart using - * the specified object name, when the boolean argument is true. - * Whether the object will write its state to restart files during - * program execution is determined by this argument. * * This constructor is intended for use when directly constructing a * BaseGridGeometry without using a derived child class. The object will * contain all index space grid information for a mesh, but nothing about * the physical coordinates of the mesh. * - * @note - * @b Errors: passing in a null database pointer or an empty string - * will result in an unrecoverable assertion. - * * @param[in] dim * @param[in] object_name * @param[in] input_db - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. @b Default: true + * @param[in] allow_multiblock set to false if called by inherently single + * block derived class such as CartesianGridGeometry + * + * @pre !object_name.empty() + * @pre input_db */ BaseGridGeometry( const tbox::Dimension& dim, const std::string& object_name, const boost::shared_ptr& input_db, - bool register_for_restart = true); + bool allow_multiblock = true); /*! * @brief Construct a new BaseGridGeometry object based on arguments. * * This constructor creates a new BaseGridGeometry object based on the - * arguments, rather than relying on input or restart data. The - * constructor also registers this object for restart using - * the specified object name, when the boolean argument is true. - * Whether the object will write its state to restart files during - * program execution is determined by this argument. + * arguments, rather than relying on input or restart data. * * @param[in] object_name * @param[in] domain Each element of the array describes the index * space for a block. - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. @b Default: true + * + * @pre !object_name.empty() + * @pre !domain.empty() */ BaseGridGeometry( const std::string& object_name, - const BoxContainer& domain, - bool register_for_restart = true); + BoxContainer& domain); /*! * @brief Virtual destructor @@ -212,7 +155,7 @@ class BaseGridGeometry: TwoDimBool& touches_regular_bdry, TwoDimBool& touches_periodic_bdry, const Box& box, - const IntVector &refinement_ratio, + const IntVector& refinement_ratio, const BoxContainer& refined_periodic_domain_tree) const; /*! @@ -222,19 +165,18 @@ class BaseGridGeometry: * will pass the information to the concrete implementation of the * geometry class, and construct boundary boxes if required. * - * @param[in] level containing the patches to be checked. + * @param[in,out] level containing the patches to be checked. * @param[in] ratio_to_level_zero ratio to the coarsest level. * @param[in] touches_regular_bdry Array storing which patches touch * non-periodic boundaries. - * @param[in] touches_periodic_bdry Array storing which patches touch - * periodic boundaries. * @param[in] defer_boundary_box_creation Flag to indicate if boundary * boxes should be created + * + * @pre (getDim() == level.getDim()) && + * (getDim() == ratio_to_level_zero.getDim()) + * @pre ratio_to_level_zero != IntVector::getZero(getDim()) */ /* - * TODO: Are all these parameters really only input params? If so, these - * should be const references rather than non-const. - * * TODO: The confusing coordination and sequence of calls between * grid geometry classes and patch geometry classes should * be reworked, including simplification of the data we're @@ -246,9 +188,8 @@ class BaseGridGeometry: setGeometryOnPatches( PatchLevel& level, const IntVector& ratio_to_level_zero, - std::map& touches_regular_bdry, - std::map& touches_periodic_bdry, - bool defer_boundary_box_creation); + const std::map& touches_regular_bdry, + const bool defer_boundary_box_creation); /*! * @brief Construct and set the boundary boxes for each patch. @@ -257,11 +198,11 @@ class BaseGridGeometry: * Once constructed, the boundary boxes are set on each patch's * PatchGeometry object. * - * @param[in] level The level for which boundary boxes are constructed. + * @param[in,out] level The level for which boundary boxes are constructed. + * + * @pre getDim() == level.getDim() */ /* - * TODO: really input param? If so, should be const qualified. - * * TODO: See the second TODO item for the previous method. */ void @@ -283,6 +224,8 @@ class BaseGridGeometry: * @param[out] domain The BoxContainer to be computed * @param[in] ratio_to_level_zero ratio to the coarsest level * @param[in] block_id + * + * @pre getDim() == ratio_to_level_zero.getDim() */ void computePhysicalDomain( @@ -311,6 +254,8 @@ class BaseGridGeometry: * Boxes describing the index space * @param[in] ratio_to_level_zero ratio to the coarsest level * @param[in] block_id + * + * @pre getDim() == ratio_to_level_zero.getDim() */ void computePhysicalDomain( @@ -328,13 +273,15 @@ class BaseGridGeometry: * coarsened with respect to the physical domain description. * Otherwise, the index space is refined. * - * @param[out] domain_mapped_boxes The BoxContainer containing all + * @param[out] domain_boxes The BoxContainer containing all * Boxes describing the physical domain * @param[in] ratio_to_level_zero ratio to the coarsest level + * + * @pre getDim() == ratio_to_level_zero.getDim() */ void computePhysicalDomain( - BoxContainer& domain_mapped_boxes, + BoxContainer& domain_boxes, const IntVector& ratio_to_level_zero) const; /*! @@ -350,6 +297,8 @@ class BaseGridGeometry: * @param[out] box_level The BoxLevel containing all * Boxes describing the physical domain * @param[in] ratio_to_level_zero ratio to the coarsest level + * + * @pre getDim() == ratio_to_level_zero.getDim() */ void computePhysicalDomain( @@ -370,11 +319,15 @@ class BaseGridGeometry: * * @param[in] domain The input array of BoxContainer * @param[in] number_blocks + * + * @pre !domain.empty() + * @pre for each box in domain: box.getBlockId().isValid() && + * (box.getBlockId().getBlockValue() < number_blocks) */ void setPhysicalDomain( const BoxContainer& domain, - const int number_blocks); + const size_t number_blocks); /*! * @brief Get the physical domain description on level zero. @@ -409,7 +362,7 @@ class BaseGridGeometry: * @return The domain description as a search tree with periodic * images (if any). */ - const BoxContainer& + const BoxContainer& getPeriodicDomainSearchTree() const { return d_domain_with_images; @@ -437,6 +390,8 @@ class BaseGridGeometry: * @param[in] directions an array indicating periodic directions(1) or * all others (0). * + * @pre getDim() == directions.getDim() + * * @note * The IntVector argument should be set to 1 for periodic directions * and 0 for all other directions. The shift will be calculated to @@ -461,15 +416,27 @@ class BaseGridGeometry: * @return The periodic shift in each direction for a domain * represented by a refinement of the reference physical * domain. + * + * @pre getDim() == ratio_to_level_zero.getDim() */ IntVector getPeriodicShift( const IntVector& ratio_to_level_zero) const; + /*! + * @brief Get the periodic shift catalog object, used for mapping between + * a PeriodicId and an IntVector representation of a periodic shift. + */ + const PeriodicShiftCatalog& + getPeriodicShiftCatalog() const + { + return d_periodic_shift_catalog; + } + /*! * @brief Get the number of blocks in the geometry. */ - int + size_t getNumberBlocks() const { return d_number_blocks; @@ -486,9 +453,9 @@ class BaseGridGeometry: * @return The max stencil width of all transfer operators. */ IntVector - getMaxTransferOpStencilWidth() + getMaxTransferOpStencilWidth(const tbox::Dimension& dim) { - return d_transfer_operator_registry->getMaxTransferOpStencilWidth(); + return d_transfer_operator_registry->getMaxTransferOpStencilWidth(dim); } /*! @@ -500,16 +467,13 @@ class BaseGridGeometry: * * @param[in] fine_geom_name std::string name of the geometry object * @param[in] refine_ratio the refinement ratio. - * @param[in] register_for_restart Flag to indicate whether to register - * for restart. * * @return The pointer to the grid geometry object. */ virtual boost::shared_ptr makeRefinedGridGeometry( const std::string& fine_geom_name, - const IntVector& refine_ratio, - bool register_for_restart) const = 0; + const IntVector& refine_ratio) const = 0; /*! * @brief Create a pointer to a coarsened version of this grid geometry @@ -520,16 +484,13 @@ class BaseGridGeometry: * * @param[in] coarse_geom_name std::string name of the geometry object * @param[in] coarsen_ratio the coasening ratio - * @param[in] register_for_restart Flag to indicate whether to register - * for restart. * * @return The pointer to a coarsened version of this grid geometry object. */ virtual boost::shared_ptr makeCoarsenedGridGeometry( const std::string& coarse_geom_name, - const IntVector& coarsen_ratio, - bool register_for_restart) const = 0; + const IntVector& coarsen_ratio) const = 0; /*! * @brief Compute and set grid data for patch. @@ -542,8 +503,10 @@ class BaseGridGeometry: * @param[in] ratio_to_level_zero ratio to coarsest level * @param[in] touches_regular_bdry Array storing which patches touch * non-periodic boundaries. - * @param[in] touches_periodic_bdry Array storing which patches touch - * periodic boundaries. + * + * @pre (getDim() == patch.getDim()) && + * (getDim() == ratio_to_level_zero.getDim()) && + * (getDim() == touches_regular_bdry.getDim()) */ /* * TODO: See the second TODO item for the setGeometryOnPatches() method. @@ -552,8 +515,7 @@ class BaseGridGeometry: setGeometryDataOnPatch( Patch& patch, const IntVector& ratio_to_level_zero, - const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry) const; + const TwoDimBool& touches_regular_bdry) const; /*! * @brief Compute boundary boxes for each patch in patch level. @@ -570,9 +532,9 @@ class BaseGridGeometry: * of boundary box arrays will be ordered as follows: * * @code - * (patch 0 face array, patch 0 edge array, patch 0 mapped_box array, - * patch 1 face array, patch 1 edge array, patch 1 mapped_box array, . . . , - * patch n-1 face array, patch n-1 edge array, patch n-1 mapped_box array) + * (patch 0 face array, patch 0 edge array, patch 0 box array, + * patch 1 face array, patch 1 edge array, patch 1 box array, . . . , + * patch n-1 face array, patch n-1 edge array, patch n-1 box array) * @endcode * * @note @@ -597,6 +559,11 @@ class BaseGridGeometry: * computing boundary boxes. * @param[in] do_all_patches Flag to indicate boundary box computation * on all patches, even those known to not touch a boundary + * + * @pre (getDim() == level.getDim()) && + * (getDim() == periodic_shift.getDim()) && + * (getDim() == ghost_width.getDim()) + * @pre ghost_width >= IntVector::getZero(ghost_width.getDim()) */ void computeBoundaryBoxesOnLevel( @@ -604,21 +571,24 @@ class BaseGridGeometry: const PatchLevel& level, const IntVector& periodic_shift, const IntVector& ghost_width, - const tbox::Array& domain, + const std::vector& domain, bool do_all_patches = false) const; /*! * @brief Compute boundary boxes for patch * * Decompose patch boundary region into pieces depending on spatial - * dimensions. Boxes are extended along the boundary to the edge - * of the ghost mapped_box_level if necessary. + * directions. Boxes are extended along the boundary to the edge + * of the ghost box_level if necessary. * * @param[out] patch_boundaries output boundaries * @param[in] box * @param[in] domain_boxes * @param[in] ghosts * @param[in] periodic_shift + * + * @pre (getDim() == box.getDim()) && (getDim() == ghosts.getDim()) && + * (getDim() == periodic_shift.getDim()) */ void getBoundaryBoxes( @@ -641,6 +611,10 @@ class BaseGridGeometry: * are represented. * * @param[in,out] patch_level Level where boundaries need to be adjusted. + * + * @pre getDim() == patch_level.getDim() + * @pre patch_level.getGridGeometry()->getNumberBlocks() == getNumberBlocks() + * * TODO: Incorporate into regular boundary box computation once * PatchLevel is multiblock-aware. */ @@ -720,7 +694,7 @@ class BaseGridGeometry: const std::string& op_name) { return d_transfer_operator_registry->lookupCoarsenOperator( - *this, var, op_name); + var, op_name); } /*! @@ -741,7 +715,7 @@ class BaseGridGeometry: const std::string& op_name) { return d_transfer_operator_registry->lookupRefineOperator( - *this, var, op_name); + var, op_name); } /*! @@ -764,7 +738,7 @@ class BaseGridGeometry: "STD_LINEAR_TIME_INTERPOLATE") { return d_transfer_operator_registry->lookupTimeInterpolateOperator( - *this, var, op_name); + var, op_name); } /*! @@ -823,15 +797,11 @@ class BaseGridGeometry: * block's index space * @param[in] transformation The transformation needed to align the * neighboring index spaces - * @param[in] is_singularity True if the current block and the - * neighboring block abut at a reduced - * or enhanced connectivity singularity */ Neighbor( const BlockId& block_id, const BoxContainer& domain, - const Transformation& transformation, - const bool is_singularity); + const std::vector& transformation); /*! * @brief Get the block number of the neighboring block. @@ -856,9 +826,9 @@ class BaseGridGeometry: * @brief Get the Transformation for the neighbor relationship. */ const Transformation& - getTransformation() const + getTransformation(const int level_num) const { - return d_transformation; + return d_transformation[level_num]; } /*! @@ -867,20 +837,41 @@ class BaseGridGeometry: Transformation::RotationIdentifier getRotationIdentifier() const { - return d_transformation.getRotation(); + return d_transformation[0].getRotation(); } /*! * @brief Get the shift for the neighbor relationship. */ const IntVector& - getShift() const + getShift(const int level_num) const + { + return d_transformation[level_num].getOffset(); + } + + void + addTransformation(const Transformation& transformation, + int level_num) + { +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(level_num); +#endif + TBOX_ASSERT(static_cast(level_num) == d_transformation.size()); + d_transformation.push_back(transformation); + } + + /*! + * @brief Set the flag telling if that the neighboring blocks + * touch each other at an enhanced connectivity singularity. + */ + void + setSingularity(bool is_singularity) { - return d_transformation.getOffset(); + d_is_singularity = is_singularity; } /*! - * @brief Tell if the neighboring block touch each other at an + * @brief Tell if the neighboring blocks touch each other at an * enhanced connectivity singularity. */ bool @@ -905,7 +896,7 @@ class BaseGridGeometry: * @brief The transformation to transform the neighboring block's * coordinate system into the current coordinate system. */ - Transformation d_transformation; + std::vector d_transformation; /*! * True if the current block and the neighboring block abut at a @@ -925,16 +916,53 @@ class BaseGridGeometry: * with block a's * @param[in] shift_b_to_a The post-rotation shift to move b into its * correct location within a's index space - * @param[in] neighbor_type The type (codimension) of the neighbor - * relationship + * + * @pre getDim() = shift_b_to_a.getDim() */ void registerNeighbors( const BlockId& block_a, const BlockId& block_b, const Transformation::RotationIdentifier rotation_b_to_a, - const IntVector& shift_b_to_a, - const int neighbor_type); + const IntVector& shift_b_to_a); + + /*! + * @brief find the blocks that touch singularities. + * + * @param[out] singularity_blocks Container to hold the singularity + * information. Each singularity is + * represented by a member of the outer set, + * while the inner set holds all BlockIds + * for the blocks that touch a particular + * singularity. + * + * @pre singularity_blocks.empty() + * @pre d_number_blocks > 1 + */ + void + findSingularities( + std::set >& singularity_blocks); + + /* + * @brief Chop the physical domain of this geometry into a container + * that has no T-junctions at adjacent faces + * + * A T-junction occurs when a face one Box in the physical touches the faces + * of more than one other Box. This method creates a representation of the + * domain that has chopped the physical domain Boxes such that there are + * no T-junctions. + * + * If the physical domain has no T-junctions, then the output chopped_domain + * will be a simple copy of the physical domain. + * + * @param[out] chopped_domain Container to hold chopped representation of + * the domain. + * + * @pre chopped_domain.empty(); + */ + void + chopDomain( + BoxContainer& chopped_domain); /*! * @brief Get a BoxContainer that contains all of the index space of all other @@ -971,7 +999,7 @@ class BaseGridGeometry: * @return For every singularity point the block touches, the BoxContainer will * contain a single-cell box that lies just outside the block domain, * touching the block only at the singularity point. For line singularities, - * the BoxContainer will contain boxes of width 1 in all dimensions except one, + * the BoxContainer will contain boxes of width 1 in all directions except one, * lying outside the block's coarse-level domain and touching the domain * only along the line of singularity. * @@ -984,51 +1012,21 @@ class BaseGridGeometry: return d_singularity[block_id.getBlockValue()]; } - /*! - * @brief Return a list of integers indicating all of the - * singularities touched by the block indicated by block_id. - * - * @return For every singularity point the block touches, the - * vector will contain the index of that singularity. - * - * @param[in] block_id - */ - const std::vector& - getSingularityIndices( - const BlockId& block_id) const - { - return d_singularity_indices[block_id.getBlockValue()]; - } - - /*! - * @brief Tell if block represented by block_id touches - * a reduced-connectivity singularity - * - * @return True if the block touches reduced connectivity singularity, - * false if not. - * - * @param[in] block_id - */ - bool - reducedConnectivityExists( - const BlockId& block_id) const - { - return d_reduced_connect[block_id.getBlockValue()]; - } - /*! * @brief Modify a box by rotating and shifting from the index space of * the transformed_block to the index space of the base_block at the * resolution level defined by ratio_to_level_zero. * * @param[in,out] box The boxes will be transformed from the - * transformed_block index space to the base_block - * index space. + * transformed_block index space to the base_block + * index space. * @param[in] ratio * @param[in] output_block Integer identifier of the block whose index space - * will be represented in the boxes at output + * will be represented in the boxes at output * @param[in] input_block Integer identifier of the block whose index - * space is represented in the boxes at input + * space is represented in the boxes at input + * + * @pre (getDim() == box.getDim()) && (getDim() == ratio.getDim()) * * @return Whether the box has been transformed. True if there is a * relationship between input_block and output_block. False if @@ -1040,6 +1038,12 @@ class BaseGridGeometry: const IntVector& ratio, const BlockId& output_block, const BlockId& input_block) const; + bool + transformBox( + Box& box, + int level_number, + const BlockId& output_block, + const BlockId& input_block) const; /*! * @brief Modify boxes by rotating and shifting from the index space of @@ -1086,21 +1090,6 @@ class BaseGridGeometry: const BlockId& base_block, const BlockId& transformed_block); - /*! - * @brief Return a list of Neighbor objects describing all of the neighbors - * of the block indicated by the block_id. - * - * @return The list of neighbors - * - * @param[in] block_id - */ - const std::list& - getNeighbors( - const BlockId& block_id) const - { - return d_block_neighbors[block_id.getBlockValue()]; - } - /*! * @brief Return the number of neighbors a specific block of the Multiblock * domain has. @@ -1117,11 +1106,14 @@ class BaseGridGeometry: const BlockId& block_id) const { return static_cast( - d_block_neighbors[block_id.getBlockValue()].size()); + d_block_neighbors[block_id.getBlockValue()].size()); } /*! * @brief Tell if the given BlockIds represent neighboring blocks. + * + * @param block_a + * @param block_b */ bool areNeighbors( @@ -1130,6 +1122,9 @@ class BaseGridGeometry: /*! * @brief Tell if the given BlockIds represent neighboring blocks. + * + * @param block_a + * @param block_b */ bool areSingularityNeighbors( @@ -1137,7 +1132,12 @@ class BaseGridGeometry: const BlockId& block_b) const; /*! - * @brief Get the rotation identifier to rotate from src to dst. + * @brief Get the rotation identifier to rotate from src to dst.\ + * + * @param dst + * @param src + * + * @pre areNeighbors(dst, src) */ Transformation::RotationIdentifier getRotationIdentifier( @@ -1146,11 +1146,18 @@ class BaseGridGeometry: /*! * @brief Get the offset to shift from src to dst after rotation. + * + * @param dst + * @param src + * @param level_num + * + * @pre areNeighbors(dst, src) */ const IntVector& getOffset( const BlockId& dst, - const BlockId& src) const; + const BlockId& src, + int level_num) const; /*! * @brief Query if the geometry has enhanced connectivity. @@ -1161,6 +1168,57 @@ class BaseGridGeometry: return d_has_enhanced_connectivity; } + /*! + * @brief Query if the the refinement ratios used in this geometry are + * isotropic + * + * All ratios must be isotropic for this to return true. + * + */ + bool + hasIsotropicRatios() const + { + return d_ratios_are_isotropic; + } + + /*! + * @brief Set the relative refinement ratios between each level and its + * next coarser level + * + * @param ratio_to_coarser Vector of refinement ratios. + */ + void + setUpRatios( + const std::vector& ratio_to_coarser); + + /*! + * @brief Get a level number based on a refinement ratio. + * + * An error will occur if the given ratio is not equal to one of the ratios + * stored in this geometry. + * + * @param ratio_to_level_zero + */ + int + getEquivalentLevelNumber(const IntVector& ratio_to_level_zero) const + { + int level_num = -1; + for (int i = 0; i < static_cast(d_ratio_to_level_zero.size()); ++i) { + if (d_ratio_to_level_zero[i] == ratio_to_level_zero) { + level_num = i; + break; + } + } + if (level_num == -1) { + TBOX_ERROR( + getObjectName() << ": " + << ratio_to_level_zero << " is not a valid" + << " ratio in this geometry." << std::endl); + } + + return level_num; + } + /*! * @brief Print object data to the specified output stream. * @@ -1172,49 +1230,506 @@ class BaseGridGeometry: /*! * @brief Writes the state of the BaseGridGeometry object to the - * database. + * restart database. * - * When assertion checking is active, db cannot be a null database pointer. + * @param[in,out] restart_db The restart database to write/serialize to. * - * @param[in,out] db The database to write to write/serialize. + * @pre restart_db */ virtual void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; -protected: /*! - * @brief Construct a new BaseGridGeometry object in its default state. + * @brief Class NeighborIterator iterates over the Neighbors of a block. * - * This constructor is intended to be called from a child class derived - * from BaseGridGeometry. It will not register for restart nor read any - * input data, as it is expected that the child class will handle those - * operations. + * The iterator points to a mutable Neighbor. + */ + class NeighborIterator + { + friend class BaseGridGeometry; +public: + /*! + * @brief Copy constructor. + * + * @param[in] other The non-const iterator to copy. + */ + NeighborIterator( + const NeighborIterator& other); + + /*! + * @brief Destructor. + */ + ~NeighborIterator(); + + /*! + * @brief Assignment operator. + * + * @param[in] rhs The non-const iterator being assigned. + * + * @return This object after the assignment. + */ + NeighborIterator& + operator = ( + const NeighborIterator& rhs) + { + d_grid_geom = rhs.d_grid_geom; + d_block_id.setId(rhs.d_block_id.getBlockValue()); + d_nbr_itr = rhs.d_nbr_itr; + return *this; + } + + /*! + * @brief Dereference operator. + * + * @return The Neighbor that the iterator is currently pointing to. + */ + Neighbor& + operator * () const + { + return d_nbr_itr->second; + } + + /*! + * @brief Post-increment operator. + * + * @return This iterator prior to having been incremented. + */ + NeighborIterator + operator ++ ( + int) + { + NeighborIterator tmp = *this; + if (d_nbr_itr != + d_grid_geom->d_block_neighbors[d_block_id.getBlockValue()].end()) { + ++d_nbr_itr; + } + return tmp; + } + + /*! + * @brief Pre-increment operator. + * + * @return This iterator after having been incremented. + */ + NeighborIterator& + operator ++ () + { + if (d_nbr_itr != + d_grid_geom->d_block_neighbors[d_block_id.getBlockValue()].end()) { + ++d_nbr_itr; + } + return *this; + } + + /*! + * @brief Equality operator. + * + * @param[in] rhs The right hand side of the comparison. + * + * @return True if this and rhs are pointing to the same Neighbor of the + * same block of the same grid geometry. + */ + bool + operator == ( + const NeighborIterator& rhs) const + { + return (d_grid_geom == rhs.d_grid_geom) && + (d_block_id == rhs.d_block_id) && + (d_nbr_itr == rhs.d_nbr_itr); + } + + /*! + * @brief Inequality operator. + * + * @param[in] rhs The right hand side of the comparison. + * + * @return True if this and rhs are not pointing to different Neighbors + * or iterating over different block or different grid geometries. + */ + bool + operator != ( + const NeighborIterator& rhs) const + { + return !(*this == rhs); + } + +private: + /*! + * @brief Constructor. + * + * Constructs an iterator that points to the first or one past the last + * Neighbor of the block with the supplied BlockId in the supplied + * GridGeometry. + * + * @pre grid_geometry != 0 + * + * @param[in] grid_geometry The grid geometry whose block Neighbors are + * of iterest. + * @param[in] block_id The ID of the block of interest in the grid + * geometry. + * @param[in] from_start If true iterator first points to the first + * Neighbor. + */ + NeighborIterator( + BaseGridGeometry* grid_geometry, + const BlockId& block_id, + bool from_start = true); + + /*! + * @brief Constructor. + * + * Constructs an iterator that points to the Neighbor block with BlockId + * nbr_blk_id of the block with BlockId block_id. If no such Neighbor + * exists the iterator points to end(). + * + * @pre grid_geometry != 0 + * + * @param[in] grid_geometry The grid geometry whose block Neighbor is of + * iterest. + * @param[in] block_id The ID of the block of interest in the grid + * geometry. + * @param[in] nbr_block_id The ID of the Neighbor block of interest in + * the grid geometry. + */ + NeighborIterator( + BaseGridGeometry* grid_geometry, + const BlockId& block_id, + const BlockId& nbr_block_id); + + /*! + * @brief Unimplemented default constructor. + */ + NeighborIterator(); + + /*! + * @brief The grid geometry whose block neighbors are of interest. + */ + BaseGridGeometry* d_grid_geom; + + /*! + * @brief The block id if the block whose Neighors are of interest. + */ + BlockId d_block_id; + + /*! + * @brief The underlying iterator. + */ + std::map::iterator d_nbr_itr; + }; + + /*! + * @brief Class ConstNeighborIterator iterates over the Neighbors of a + * block. * - * @param[in] dim - * @param[in] object_name - * @param[in] op_reg + * The iterator points to a const Neighbor. */ - BaseGridGeometry( - const tbox::Dimension& dim, - const std::string& object_name, - const boost::shared_ptr& op_reg); + class ConstNeighborIterator + { + friend class BaseGridGeometry; +public: + /*! + * @brief Copy constructor. + * + * @param[in] other The const iterator to copy. + */ + ConstNeighborIterator( + const ConstNeighborIterator& other); + + /*! + * @brief Copy constructor. + * + * @param[in] other The non-const iterator to copy. + */ + ConstNeighborIterator( + const NeighborIterator& other); + + /*! + * @brief Destructor. + */ + ~ConstNeighborIterator(); + + /*! + * @brief Assignment operator. + * + * @param[in] rhs The const iterator being assigned. + * + * @return This object after the assignment. + */ + ConstNeighborIterator& + operator = ( + const ConstNeighborIterator& rhs) + { + d_grid_geom = rhs.d_grid_geom; + d_block_id.setId(rhs.d_block_id.getBlockValue()); + d_nbr_itr = rhs.d_nbr_itr; + return *this; + } + + /*! + * @brief Assignment operator. + * + * @param[in] rhs The non-const iterator being assigned. + * + * @return This object after the assignment. + */ + ConstNeighborIterator& + operator = ( + const NeighborIterator& rhs) + { + d_grid_geom = rhs.d_grid_geom; + d_block_id.setId(rhs.d_block_id.getBlockValue()); + d_nbr_itr = rhs.d_nbr_itr; + return *this; + } + + /*! + * @brief Dereference operator. + * + * @return The Neighbor that the iterator is currently pointing to. + */ + const Neighbor& + operator * () const + { + return d_nbr_itr->second; + } + + /*! + * @brief Post-increment operator. + * + * @return This iterator prior to having been incremented. + */ + ConstNeighborIterator + operator ++ ( + int) + { + ConstNeighborIterator tmp = *this; + if (d_nbr_itr != + d_grid_geom->d_block_neighbors[d_block_id.getBlockValue()].end()) { + ++d_nbr_itr; + } + return tmp; + } + + /*! + * @brief Pre-increment operator. + * + * @return This iterator after having been incremented. + */ + ConstNeighborIterator& + operator ++ () + { + if (d_nbr_itr != + d_grid_geom->d_block_neighbors[d_block_id.getBlockValue()].end()) { + ++d_nbr_itr; + } + return *this; + } + + /*! + * @brief Equality operator. + * + * @param[in] rhs The right hand side of the comparison. + * + * @return True if this and rhs are pointing to the same Neighbor of the + * same block of the same grid geometry. + */ + bool + operator == ( + const ConstNeighborIterator& rhs) const + { + return (d_grid_geom == rhs.d_grid_geom) && + (d_block_id == rhs.d_block_id) && + (d_nbr_itr == rhs.d_nbr_itr); + } + + /*! + * @brief Inequality operator. + * + * @param[in] rhs The right hand side of the comparison. + * + * @return True if this and rhs are not pointing to different Neighbors + * or iterating over different block or different grid geometries. + */ + bool + operator != ( + const ConstNeighborIterator& rhs) const + { + return !(*this == rhs); + } +private: + /*! + * @brief Constructor. + * + * Constructs an iterator that points to the first or one past the last + * Neighbor of the block with the supplied BlockId in the supplied + * GridGeometry. + * + * @pre grid_geometry != 0 + * + * @param[in] grid_geometry The grid geometry whose block Neighbors are + * of iterest. + * @param[in] block_id The ID of the block of interest in the grid + * geometry. + * @param[in] from_start If true iterator first points to the first + * Neighbor. + */ + ConstNeighborIterator( + const BaseGridGeometry* grid_geometry, + const BlockId& block_id, + bool from_start = true); + + /*! + * @brief Constructor. + * + * Constructs an iterator that points to the Neighbor block with BlockId + * nbr_blk_id of the block with BlockId block_id. If no such Neighbor + * exists the iterator points to end(). + * + * @pre grid_geometry != 0 + * + * @param[in] grid_geometry The grid geometry whose block Neighbor is of + * iterest. + * @param[in] block_id The ID of the block of interest in the grid + * geometry. + * @param[in] nbr_block_id The ID of the Neighbor block of interest in + * the grid geometry. + */ + ConstNeighborIterator( + const BaseGridGeometry* grid_geometry, + const BlockId& block_id, + const BlockId& nbr_block_id); + + /*! + * @brief Unimplemented default constructor. + */ + ConstNeighborIterator(); + + /*! + * @brief The grid geometry whose block neighbors are of interest. + */ + const BaseGridGeometry* d_grid_geom; + + /*! + * @brief The block id if the block whose Neighors are of interest. + */ + BlockId d_block_id; + + /*! + * @brief The underlying iterator. + */ + std::map::const_iterator d_nbr_itr; + }; /*! - * @brief Construct a new BaseGridGeometry object in its default state. + * @brief Create iterator pointing to the first Neighbor of the block with + * the supplied block id. * - * This constructor is intended to be called from a child class derived - * from BaseGridGeometry. It will not register for restart nor read any - * input data, as it is expected that the child class will handle those - * operations. + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. * - * @param[in] dim - * @param[in] object_name + * @return Iterator pointing to the first Neighbor of the block with + * supplied block id. */ - BaseGridGeometry( - const tbox::Dimension& dim, - const std::string& object_name); + NeighborIterator + begin( + const BlockId& block_id) + { + return NeighborIterator(this, block_id); + } + + /*! + * @brief Create iterator pointing one past the last Neighbor of the block + * with the supplied block id. + * + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. + * + * @return Iterator pointing one past the Neighbor of the block with + * supplied block id. + */ + NeighborIterator + end( + const BlockId& block_id) + { + return NeighborIterator(this, block_id, false); + } + + /*! + * @brief Create iterator pointing to the Neighbor with block id + * nbr_block_id of the block with block id block_id. + * + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. + * + * @param[in] nbr_block_id The block id of the Neighbor of interest. + * + * @return Iterator pointing to the requested Neighbor of the block with + * supplied block id. + */ + NeighborIterator + find( + const BlockId& block_id, + const BlockId& nbr_block_id) + { + return NeighborIterator(this, block_id, nbr_block_id); + } + /*! + * @brief Create iterator pointing to the first Neighbor of the block with + * the supplied block id. + * + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. + * + * @return Iterator pointing to the first Neighbor of the block with + * supplied block id. + */ + ConstNeighborIterator + begin( + const BlockId& block_id) const + { + return ConstNeighborIterator(this, block_id); + } + + /*! + * @brief Create iterator pointing one past the last Neighbor of the block + * with the supplied block id. + * + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. + * + * @return Iterator pointing one past the Neighbor of the block with + * supplied block id. + */ + ConstNeighborIterator + end( + const BlockId& block_id) const + { + return ConstNeighborIterator(this, block_id, false); + } + + /*! + * @brief Create iterator pointing to the Neighbor with block id + * nbr_block_id of the block with block id block_id. + * + * @param[in] block_id The block id of the block whose Neighbors are of + * interest. + * + * @param[in] nbr_block_id The block id of the Neighbor of interest. + * + * @return Iterator pointing to the requested Neighbor of the block with + * supplied block id. + */ + ConstNeighborIterator + find( + const BlockId& block_id, + const BlockId& nbr_block_id) const + { + return ConstNeighborIterator(this, block_id, nbr_block_id); + } + +protected: /*! * @brief Construct a new BaseGridGeometry object based on arguments. * @@ -1222,19 +1737,21 @@ class BaseGridGeometry: * @param[in] domain Each element of the array describes the index * space for a block. * @param[in] op_reg - * @param[in] register_for_restart Flag indicating whether this instance - * should be registered for restart. @b Default: true + * + * @pre !object_name.empty() + * @pre !domain.empty() */ BaseGridGeometry( const std::string& object_name, - const BoxContainer& domain, - const boost::shared_ptr& op_reg, - bool register_for_restart); + BoxContainer& domain, + const boost::shared_ptr& op_reg); /*! * @brief Read multiblock metadata input from the input database * * @param[in] input_db + * + * @pre input_db */ void readBlockDataFromInput( @@ -1276,6 +1793,10 @@ class BaseGridGeometry: * It returns true when a BoundaryBox has a width of 1 in at least * one direction, is adjacent to the patch boundary (possible extended * into the patch's ghost region) and is outside the physical domain. + * + * @pre (getDim() == boundary_box.getDim()) && + * (getDim() == patch.getDim()) && + * (getDim() == max_data_ghost_width.getDim()) */ bool checkBoundaryBox( @@ -1296,6 +1817,8 @@ class BaseGridGeometry: * @param[in] box Box on which to compute periodic shifts * @param[in] domain_search_tree search tree for the domain * @param[in] periodic_shift + * + * @pre (getDim() == box.getDim()) && (getDim() == periodic_shift.getDim()) */ void computeShiftsForBox( @@ -1309,13 +1832,13 @@ class BaseGridGeometry: * into account the full multiblock configuration. * * @param[in] patch - * @param[in] geometry * @param[in] pseudo_domain The full multiblock domain represented as if * every block were in the index space where the patch exists * @param[in] gcw The maximum patch data ghost width * @param[in] singularity BoxContainer obtained by getSingularityBoxContainer() + * + * @pre (getDim() == patch.getDim()) && (getDim() == gcw.getDim()) */ - void adjustBoundaryBoxesOnPatch( const Patch& patch, @@ -1323,19 +1846,35 @@ class BaseGridGeometry: const IntVector& gcw, const BoxContainer& singularity); + /*! + * @brief Set the transformations between block neighbors for every level + * + * The transformations between block neighbors are originally received from + * input for the coarsest level. This method computes the transformations + * for all potential levels after the ratios to level zero for each level + * are computed. + */ + void + setUpFineLevelTransformations(); + /*! * @brief Reads in data from the specified input database. * * If the simulation is from restart, these values are taken from restart * and newly specified values in the input database are ignored. * - * @param[in] db input database, must not be NULL pointer + * @param[in] input_db input database, must not be NULL pointer * @param[in] is_from_restart set to true if simulation is from restart + * @param[in] allow_multiblock set to false if called by inherently single + * block derived class such as CartesianGridGeometry + * + * @pre is_from_restart || input_db */ void getFromInput( - const boost::shared_ptr& db, - bool is_from_restart); + const boost::shared_ptr& input_db, + bool is_from_restart, + bool allow_multiblock); /*! * @brief Read object state from the restart file and initialize class data @@ -1344,6 +1883,8 @@ class BaseGridGeometry: * The database from which the restart data is read is * determined by the object_name specified in the constructor. * + * @pre tbox::RestartManager::getManager()->getRootDatabase()->isDatabase(getObjectName() + * * Unrecoverable Errors: * * -The database corresponding to object_name is not found @@ -1385,7 +1926,7 @@ class BaseGridGeometry: * Boolean array telling for each block whether the domain of that block * can be represented by a single box. */ - tbox::Array d_domain_is_single_box; + std::vector d_domain_is_single_box; /*! * @brief BoxContainer representation of the physical domain, including @@ -1399,6 +1940,12 @@ class BaseGridGeometry: */ IntVector d_periodic_shift; + /*! + * PeriodicShiftCatalog object that is constructed in accordance with + * this grid geometry's domain and periodic shift. + */ + PeriodicShiftCatalog d_periodic_shift_catalog; + /*! * Current maximum ghost cell width over all patch data objects * known to the patch descriptor. This is used to compute @@ -1409,38 +1956,31 @@ class BaseGridGeometry: /*! * The number of blocks represented in the BaseGridGeometry. */ - int d_number_blocks; + size_t d_number_blocks; /*! - * The number of blocks singularities in the block configuration. + * The number of block singularities in the block configuration. */ int d_number_of_block_singularities; + boost::shared_ptr d_singularity_finder; + /*! * @brief Associated with each block is a list of Neighbors that * it shares a block boundary with. */ - tbox::Array > d_block_neighbors; + std::vector > d_block_neighbors; /*! * @brief An array of BoxContainers defining the singularities of a multiblock * domain. Each BoxContainer element defines the singularities that a single * block touches. */ - tbox::Array d_singularity; + std::vector d_singularity; - /*! - * @brief An array of singularity indices of a multiblock - * domain. d_singularity_indices[bn] is a list of singularity indices - * touched by block bn. - */ - tbox::Array > d_singularity_indices; + std::vector d_ratio_to_level_zero; - /*! - * @brief Tell whether each block touches a reduced-connectivity - * singularity. - */ - tbox::Array d_reduced_connect; + bool d_ratios_are_isotropic; /*! * @brief Tell whether there is enhanced connectivity anywhere in the @@ -1448,11 +1988,6 @@ class BaseGridGeometry: */ bool d_has_enhanced_connectivity; - /*! - * Flag to determine whether this instance is registered for restart. - */ - bool d_registered_for_restart; - static boost::shared_ptr t_find_patches_touching_boundaries; static boost::shared_ptr t_touching_boundaries_init; static boost::shared_ptr t_touching_boundaries_loop; @@ -1461,6 +1996,7 @@ class BaseGridGeometry: static boost::shared_ptr t_set_geometry_data_on_patches; static boost::shared_ptr t_compute_boundary_boxes_on_level; static boost::shared_ptr t_get_boundary_boxes; + static boost::shared_ptr t_adjust_multiblock_patch_level_boundaries; /* * Static initialization and cleanup handler. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.C index 2d1e9513..7e0b043d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.C @@ -3,23 +3,22 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Block identifier in multiblock domain. * ************************************************************************/ - -#ifndef included_hier_BlockId_C -#define included_hier_BlockId_C - #include "SAMRAI/hier/BlockId.h" #include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/tbox/Utilities.h" #include namespace SAMRAI { namespace hier { -const BlockId BlockId::s_invalid_id(tbox::MathUtilities::getMax()); +const BlockId +BlockId::s_invalid_id( + tbox::MathUtilities::getMax()); const BlockId BlockId::s_zero_id(0); /* @@ -46,11 +45,22 @@ BlockId::BlockId( ******************************************************************************* */ BlockId::BlockId( - const int& value): + const unsigned int& value): d_value(value) { } +/* + ******************************************************************************* + ******************************************************************************* + */ +BlockId::BlockId( + const int& value): + d_value(static_cast(value)) +{ + TBOX_ASSERT(value >=0); +} + /* ******************************************************************************* ******************************************************************************* @@ -64,4 +74,3 @@ BlockId::~BlockId() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.h index ee36b6dd..ca0031e9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BlockId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Block identifier in multiblock domain. * ************************************************************************/ @@ -12,6 +12,7 @@ #define included_hier_BlockId #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/Utilities.h" #include @@ -28,6 +29,10 @@ class BlockId { public: + + //! @brief Primitive type for the number associated with a block. + typedef unsigned int block_t; + /*! * @brief Default constructor sets the value to invalid. */ @@ -40,9 +45,19 @@ class BlockId const BlockId& other); /*! - * @brief Construct from a numerical value. + * @brief Construct from an unsigned int. + * + * This method is explicit to prevent automatic conversion. + */ + explicit BlockId( + const unsigned int& value); + + /*! + * @brief Construct from a signed int. * * This method is explicit to prevent automatic conversion. + * + * @pre value >= 0 */ explicit BlockId( const int& value); @@ -75,6 +90,14 @@ class BlockId void setId( const int& rhs) + { + TBOX_ASSERT(rhs >= 0); + d_value = static_cast(rhs); + } + + void + setId( + const unsigned int& rhs) { d_value = rhs; } @@ -91,7 +114,7 @@ class BlockId /*! * @brief Access the numerical value. */ - const int& + const block_t& getBlockValue() const { return d_value; @@ -146,7 +169,6 @@ class BlockId { return d_value != rhs.d_value; } - /*! * @brief Less-than operator. @@ -219,7 +241,7 @@ class BlockId */ bool operator == ( - const int& rhs) const + const block_t& rhs) const { return d_value == rhs; } @@ -233,7 +255,7 @@ class BlockId */ bool operator != ( - const int& rhs) const + const block_t& rhs) const { return d_value != rhs; } @@ -247,7 +269,7 @@ class BlockId */ bool operator < ( - const int& rhs) const + const block_t& rhs) const { return d_value < rhs; } @@ -261,7 +283,7 @@ class BlockId */ bool operator > ( - const int& rhs) const + const block_t& rhs) const { return d_value > rhs; } @@ -275,7 +297,7 @@ class BlockId */ bool operator <= ( - const int& rhs) const + const block_t& rhs) const { return d_value <= rhs; } @@ -289,7 +311,7 @@ class BlockId */ bool operator >= ( - const int& rhs) const + const block_t& rhs) const { return d_value >= rhs; } @@ -312,7 +334,7 @@ class BlockId /*! * @brief Numerical value of the identifier. */ - int d_value; + unsigned int d_value; /*! * @brief BlockId with a numerical value of zero. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.C index 78c11d97..07ba8b66 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: BoundaryBox representing a portion of the physical boundary * ************************************************************************/ - -#ifndef included_hier_BoundaryBox_C -#define included_hier_BoundaryBox_C - #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/hier/BoundaryLookupTable.h" @@ -25,7 +21,6 @@ BoundaryBox::BoundaryBox( d_bdry_type(-1), d_location_index(-1) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); } BoundaryBox::BoundaryBox( @@ -46,9 +41,8 @@ BoundaryBox::BoundaryBox( d_box(box) { #ifdef DEBUG_CHECK_ASSERTIONS - BoundaryLookupTable* blut = - BoundaryLookupTable::getLookupTable(d_dim); - const tbox::Array& location_index_max = blut->getMaxLocationIndices(); + BoundaryLookupTable* blut = BoundaryLookupTable::getLookupTable(d_dim); + const std::vector& location_index_max = blut->getMaxLocationIndices(); TBOX_ASSERT((bdry_type >= 1) && (bdry_type <= d_dim.getValue())); TBOX_ASSERT(location_index >= 0); @@ -95,5 +89,3 @@ BoundaryBox::getBoundaryOrientation( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.h index 05b260a4..b729b446 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBox.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box representing a portion of the AMR index space * ************************************************************************/ @@ -31,9 +31,9 @@ namespace hier { * See the getBoundaryType() and getLocationIndex() methods for more * information. * - * @see hier::Box - * @see hier::PatchGeometry - * @see hier::BoundaryLookupTable + * @see Box + * @see PatchGeometry + * @see BoundaryLookupTable */ class BoundaryBox @@ -60,6 +60,10 @@ class BoundaryBox * @param[in] box * @param[in] bdry_type * @param[in] location_index + * + * @pre (bdry_type >= 1) && (bdry_type <= d_dim.getValue()) + * @pre location_index >= 0 + * @pre location_index < BoundaryLookupTable::getLookupTable(box.getDim())->getMaxLocationIndices()[bdry_type - 1] */ BoundaryBox( const Box& box, @@ -127,7 +131,7 @@ class BoundaryBox * The location index is an integer which indicates the location of the * the boundary box in relation to the location of the associated patch. * The conventions for the location index depend on the dimension of - * the problem and the boundary type (codimentsion) of the BoundaryBox. + * the problem and the boundary type (codimension) of the BoundaryBox. * * \verbatim * Conventions: @@ -267,6 +271,8 @@ class BoundaryBox * @return BoundaryOrientation value LOWER, MIDDLE, or UPPER * * @param[in] dir Coordinate direction on which to query + * + * @pre dir < getDim().getValue() */ BoundaryOrientation getBoundaryOrientation( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.C index 605fad93..67b2ca4d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generic utilities for boundary box calculus. * ************************************************************************/ - -#ifndef included_hier_BoundaryBoxUtils_C -#define included_hier_BoundaryBoxUtils_C - #include "SAMRAI/hier/BoundaryBoxUtils.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Utilities.h" @@ -19,12 +15,6 @@ namespace SAMRAI { namespace hier { -BoundaryBoxUtils::BoundaryBoxUtils(): - d_bbox(tbox::Dimension::getInvalidDimension()), - d_outward(tbox::Dimension::getInvalidDimension(), 0) -{ -} - BoundaryBoxUtils::BoundaryBoxUtils( const BoundaryBox& bbox): d_bbox(bbox), @@ -105,6 +95,7 @@ BoundaryBoxUtils::computeOutwardShift() TBOX_ERROR("BoundaryBoxUtils cannot compute\n" << "boundary direction for type " << d_bbox.getBoundaryType() << " in " << dim << "D"); + break; } } @@ -113,25 +104,25 @@ BoundaryBoxUtils::stretchBoxToGhostWidth( Box& box, const IntVector& ghost_cell_width) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_bbox, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_bbox, box); const tbox::Dimension& dim(d_bbox.getDim()); TBOX_ASSERT(ghost_cell_width >= IntVector::getZero(dim)); box = d_bbox.getBox(); - for (int d = 0; d < dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { /* - * If gcw along dimension d is > 1, stretch it out to that width. - * If gcw a long dimension d is 0, shrink the box down to nothing - * in that dimension. + * If gcw along direction d is > 1, stretch it out to that width. + * If gcw a long direction d is 0, shrink the box down to nothing + * in that direction. */ if (d_outward(d) == -1) { if (ghost_cell_width(d) > 1) box.growLower(d, ghost_cell_width(d) - 1); - else box.lower() (d) = box.upper() (d) - (ghost_cell_width(d) - 1); + else box.setLower(d, box.upper(d) - (ghost_cell_width(d) - 1)); } else if (d_outward(d) == 1) { if (ghost_cell_width(d) > 1) box.growUpper(d, ghost_cell_width(d) - 1); - else box.upper() (d) = box.lower() (d) + (ghost_cell_width(d) - 1); + else box.setUpper(d, box.lower(d) + (ghost_cell_width(d) - 1)); } } } @@ -141,12 +132,12 @@ BoundaryBoxUtils::extendBoxOutward( Box& box, const IntVector& extension) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_bbox, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_bbox, box); const tbox::Dimension& dim(d_bbox.getDim()); box = d_bbox.getBox(); - for (int d = 0; d < dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { if (d_outward(d) == -1) box.growLower(d, extension(d)); else if (d_outward(d) == 1) box.growUpper(d, extension(d)); } @@ -173,7 +164,7 @@ BoundaryBoxUtils::getSurfaceBoxFromBoundaryBox() const * than the boundary cell indices, in the direction normal * to the boundary. */ - side_index_box.shift(location_index / 2, 1); + side_index_box.shift(static_cast(location_index / 2), 1); } return side_index_box; } @@ -189,7 +180,7 @@ BoundaryBox BoundaryBoxUtils::trimBoundaryBox( const Box& limit_box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_bbox, limit_box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_bbox, limit_box); const tbox::Dimension& dim(d_bbox.getDim()); @@ -252,5 +243,3 @@ BoundaryBoxUtils::trimBoundaryBox( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.h index b256dba0..5544fd6f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryBoxUtils.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generic utilities for boundary box calculus. * ************************************************************************/ @@ -21,7 +21,7 @@ namespace hier { * @brief Perform shifts, extensions, etc on a BoundaryBox using the box's * location index and type. * - * @see hier::BoundaryBox + * @see BoundaryBox */ class BoundaryBoxUtils @@ -107,6 +107,9 @@ class BoundaryBoxUtils * * @param[out] box The stretched box. * @param[in] ghost_cell_width Ghost width to stretch the box. + * + * @pre getBoundaryBox().getDim() == box.getDim() + * @pre ghost_cell_width >= IntVector::getZero(getBoundaryBox().getDim()) */ void stretchBoxToGhostWidth( @@ -126,6 +129,8 @@ class BoundaryBoxUtils * @param[out] box The extended box * @param[in] extension IntVector telling how many cells to extend the box * in each coordinate direction. + * + * @pre getBoundaryBox().getDim() == box.getDim() */ void extendBoxOutward( @@ -144,7 +149,7 @@ class BoundaryBoxUtils int normalDir() const { - return d_bbox.getLocationIndex() / 2; + return getBoundaryBox().getLocationIndex() / 2; } /*! @@ -152,8 +157,8 @@ class BoundaryBoxUtils * past a limiting box in direction transverse to the boundary * normal. * - * This method affects the only box dimensions parallel to - * the boundary. For methods affecting other box dimensions, + * This method affects the only box directions parallel to + * the boundary. For methods affecting other box directions, * see stretchBoxToGhostWidth(). * * The boundary type of the BoundaryBox that was given to the @@ -162,6 +167,9 @@ class BoundaryBoxUtils * @param[in] limit_box Box to not stick out past * * @return New trimmed boundary box. + * + * @pre getBoundaryBox().getDim() == limit_box.getDim() + * @pre getBoundaryBox().getBoundaryType() < getBoundaryBox().getDim().getValue()) */ BoundaryBox trimBoundaryBox( @@ -176,18 +184,21 @@ class BoundaryBoxUtils * in 2D. These surfaces lie on the boundary itself. * * The input boundary_box must be of type 1 - * (see hier::BoundaryBox::getBoundaryType()). + * (see BoundaryBox::getBoundaryType()). * * This is a utility function for working with the surface * indices corresponding to a boundary box. * * @return a box to define the side indices corresponding to the * BoundaryBox + * + * @pre getBoundaryBox().getBoundaryType() == 1 */ Box getSurfaceBoxFromBoundaryBox() const; private: + // Unimplemented default constructor. BoundaryBoxUtils(); /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.C index 73e2e566..7912c7bf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Lookup table to aid in BoundaryBox construction * ************************************************************************/ - -#ifndef included_hier_BoundaryLookupTable_C -#define included_hier_BoundaryLookupTable_C - #include "SAMRAI/hier/BoundaryLookupTable.h" #include "SAMRAI/tbox/StartupShutdownManager.h" @@ -26,8 +22,7 @@ namespace SAMRAI { namespace hier { BoundaryLookupTable * -BoundaryLookupTable::s_lookup_table_instance[tbox::Dimension::MAXIMUM_DIMENSION_VALUE -] = { (BoundaryLookupTable *)NULL }; +BoundaryLookupTable::s_lookup_table_instance[SAMRAI::MAX_DIM_VAL] = { 0 }; tbox::StartupShutdownManager::Handler BoundaryLookupTable::s_finalize_handler( @@ -49,31 +44,34 @@ BoundaryLookupTable::BoundaryLookupTable( const tbox::Dimension& dim): d_dim(dim) { - if (d_table[0].isNull()) { - int factrl[tbox::Dimension::MAXIMUM_DIMENSION_VALUE + 1]; + if (d_table[0].empty()) { + const tbox::Dimension::dir_t dim_val = d_dim.getValue(); + int factrl[SAMRAI::MAX_DIM_VAL + 1]; factrl[0] = 1; - for (int i = 1; i <= d_dim.getValue(); i++) factrl[i] = i * factrl[i - 1]; - d_ncomb.resizeArray(d_dim.getValue()); - d_max_li.resizeArray(d_dim.getValue()); - for (int codim = 1; codim <= d_dim.getValue(); codim++) { - int cdm1 = codim - 1; - d_ncomb[cdm1] = factrl[d_dim.getValue()] - / (factrl[codim] * factrl[d_dim.getValue() - codim]); - - tbox::Array work; - work.resizeArray(codim * d_ncomb[cdm1]); - - int recursive_work[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + for (int i = 1; i <= dim_val; ++i) { + factrl[i] = i * factrl[i - 1]; + } + + d_ncomb.resize(dim_val); + d_max_li.resize(dim_val); + for (tbox::Dimension::dir_t codim = 1; codim <= dim_val; ++codim) { + tbox::Dimension::dir_t cdm1 = static_cast(codim - 1); + d_ncomb[cdm1] = factrl[dim_val] + / (factrl[codim] * factrl[dim_val - codim]); + + std::vector work(codim * d_ncomb[cdm1]); + + int recursive_work[SAMRAI::MAX_DIM_VAL]; int recursive_work_lvl = 0; int* recursive_work_ptr; - buildTable(work.getPointer(), codim, 1, recursive_work, - recursive_work_lvl, recursive_work_ptr); - - d_table[cdm1].resizeArray(d_ncomb[cdm1]); - for (int j = 0; j < d_ncomb[cdm1]; j++) { - d_table[cdm1][j].resizeArray(codim); - for (int k = 0; k < codim; k++) { - d_table[cdm1][j][k] = work[j * codim + k] - 1; + buildTable(&work[0], recursive_work, + recursive_work_lvl, recursive_work_ptr, codim, 1); + + d_table[cdm1].resize(d_ncomb[cdm1]); + for (tbox::Dimension::dir_t j = 0; j < d_ncomb[cdm1]; ++j) { + d_table[cdm1][j].resize(codim); + for (tbox::Dimension::dir_t k = 0; k < codim; ++k) { + d_table[cdm1][j][k] = static_cast(work[j * codim + k] - 1); } } @@ -100,27 +98,29 @@ BoundaryLookupTable::~BoundaryLookupTable() void BoundaryLookupTable::buildTable( int* table, - int codim, - int ibeg, - int(&work)[tbox::Dimension::MAXIMUM_DIMENSION_VALUE], - int& lvl, - int *& ptr) + int(&work)[SAMRAI::MAX_DIM_VAL], + int& rec_level, + int *& ptr, + const int codim, + const int ibeg) { - lvl++; - if (lvl == 1) ptr = table; - int iend = d_dim.getValue() - codim + lvl; - for (int i = ibeg; i <= iend; i++) { - work[lvl - 1] = i; - if (lvl != codim) { - buildTable(ptr, codim, i + 1, work, lvl, ptr); + ++rec_level; + if (rec_level == 1) { + ptr = table; + } + int iend = d_dim.getValue() - codim + rec_level; + for (int i = ibeg; i <= iend; ++i) { + work[rec_level - 1] = i; + if (rec_level != codim) { + buildTable(ptr, work, rec_level, ptr, codim, i + 1); } else { - for (int j = 0; j < codim; j++) { + for (int j = 0; j < codim; ++j) { *(ptr + j) = work[j]; } ptr += codim; } } - lvl--; + --rec_level; } /* @@ -136,16 +136,16 @@ void BoundaryLookupTable::buildBoundaryDirectionVectors() { - d_bdry_dirs.resizeArray(d_dim.getValue()); + d_bdry_dirs.resize(d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { - d_bdry_dirs[i].resizeArray(d_max_li[i], IntVector::getZero(d_dim)); - int codim = i + 1; + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { + d_bdry_dirs[i].resize(d_max_li[i], IntVector::getZero(d_dim)); + tbox::Dimension::dir_t codim = static_cast(i + 1); - for (int loc = 0; loc < d_max_li[i]; loc++) { - const tbox::Array& dirs = getDirections(loc, codim); + for (int loc = 0; loc < d_max_li[i]; ++loc) { + const std::vector& dirs = getDirections(loc, codim); - for (int d = 0; d < dirs.size(); d++) { + for (int d = 0; d < static_cast(dirs.size()); ++d) { if (isUpper(loc, codim, d)) { @@ -171,11 +171,11 @@ BoundaryLookupTable::buildBoundaryDirectionVectors() void BoundaryLookupTable::finalizeCallback() { - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++i) { + for (int i = 0; i < SAMRAI::MAX_DIM_VAL; ++i) { if (s_lookup_table_instance[i]) { delete s_lookup_table_instance[i]; } - s_lookup_table_instance[i] = ((BoundaryLookupTable *)NULL); + s_lookup_table_instance[i] = 0; } } @@ -190,5 +190,3 @@ BoundaryLookupTable::finalizeCallback() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.h index c701287b..e17c5af0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoundaryLookupTable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Lookup table to aid in BoundaryBox construction * ************************************************************************/ @@ -14,7 +14,8 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/tbox/Array.h" + +#include namespace SAMRAI { namespace hier { @@ -34,9 +35,9 @@ namespace hier { * of using this class is that such calculations can be programmed in * a dimension-independent way. * - * @see hier::BoundaryBox - * @see hier::BaseGridGeometry - * @see hier::PatchGeometry + * @see BoundaryBox + * @see BaseGridGeometry + * @see PatchGeometry */ class BoundaryLookupTable @@ -57,7 +58,7 @@ class BoundaryLookupTable getLookupTable( const tbox::Dimension& dim) { - int idx = dim.getValue() - 1; + int idx = dim.getValue() - 1; if (!s_lookup_table_instance[idx]) { s_lookup_table_instance[idx] = new BoundaryLookupTable(dim); } @@ -76,17 +77,20 @@ class BoundaryLookupTable * @param loc integer location index of boundary region * @param codim integer codimension of boundary region * - * @return const reference to integer array of length codim + * @return const reference to integer vector of length codim * containing the active directions for this boundary case. + * + * @pre (codim > 0) && (codim <= getDim().getValue()) + * @pre (loc >= 0) && (loc < getMaxLocationIndex(codim - 1)) */ - const tbox::Array& + const std::vector& getDirections( int loc, - int codim) const + tbox::Dimension::dir_t codim) const { - TBOX_ASSERT((codim > 0) && (codim <= d_dim.getValue())); - TBOX_ASSERT((loc >= 0) && (loc < d_max_li[codim - 1])); - int iloc = loc / (1 << codim); + TBOX_ASSERT((codim > 0) && (codim <= getDim().getValue())); + TBOX_ASSERT((loc >= 0) && (loc < getMaxLocationIndex(codim - 1))); + tbox::Dimension::dir_t iloc = static_cast(loc / (1 << codim)); return d_table[codim - 1][iloc]; } @@ -99,16 +103,23 @@ class BoundaryLookupTable * patch has 6 possible locations for codimension 1 (faces), 12 for * codimension 2 (edges), and 8 for codimension 3 (nodes). * - * @return integer array of length dim, each entry of which indicates + * @return integer vector of length dim, each entry of which indicates * the maximum number of boundary locations for each * codimension */ - const tbox::Array& + const std::vector& getMaxLocationIndices() const { return d_max_li; } + int + getMaxLocationIndex( + int i) const + { + return d_max_li[i]; + } + /*! * @brief Determines if given boundary information indicates a * a lower boundary region. @@ -125,6 +136,10 @@ class BoundaryLookupTable * @return bool true if the boundary type of codimension codim indexed * by loc is a lower boundary in the specified direction; * return false if the boundary is an upper boundary. + * + * @pre (codim > 0) && (codim <= getDim().getValue())) + * @pre (loc >= 0) && (loc < getMaxLocationIndex(codim - 1)) + * @pre (dir_index >= 0) && (dir_index < codim) */ bool isLower( @@ -132,8 +147,8 @@ class BoundaryLookupTable int codim, int dir_index) const { - TBOX_ASSERT((codim > 0) && (codim <= d_dim.getValue())); - TBOX_ASSERT((loc >= 0) && (loc < d_max_li[codim - 1])); + TBOX_ASSERT((codim > 0) && (codim <= getDim().getValue())); + TBOX_ASSERT((loc >= 0) && (loc < getMaxLocationIndex(codim - 1))); TBOX_ASSERT((dir_index >= 0) && (dir_index < codim)); return !isUpper(loc, codim, dir_index); } @@ -154,6 +169,10 @@ class BoundaryLookupTable * @return bool true if the boundary type of codimension codim indexed * by loc is an upper boundary in the specified direction; * return false if the boundary is a lower boundary. + * + * @pre (codim > 0) && (codim <= getDim().getValue()) + * @pre (loc >= 0) && (loc < getMaxLocationIndex(codim - 1)) + * @pre (dir_index >= 0) && (dir_index < codim) */ bool isUpper( @@ -161,8 +180,8 @@ class BoundaryLookupTable int codim, int dir_index) const { - TBOX_ASSERT((codim > 0) && (codim <= d_dim.getValue())); - TBOX_ASSERT((loc >= 0) && (loc < d_max_li[codim - 1])); + TBOX_ASSERT((codim > 0) && (codim <= getDim().getValue())); + TBOX_ASSERT((loc >= 0) && (loc < getMaxLocationIndex(codim - 1))); TBOX_ASSERT((dir_index >= 0) && (dir_index < codim)); return (loc % (1 << codim)) & (1 << (dir_index)); } @@ -183,16 +202,24 @@ class BoundaryLookupTable * neither, and 1 indicates upper. * * @param codim codimension - * @return Array of IntVectors, one element for each valid location + * @return Vector of IntVectors, one element for each valid location + * + * @pre (codim > 0) && (codim <= getDim().getValue()) */ - const tbox::Array& + const std::vector& getBoundaryDirections( int codim) const { - TBOX_ASSERT((codim > 0) && (codim <= d_dim.getValue())); + TBOX_ASSERT((codim > 0) && (codim <= getDim().getValue())); return d_bdry_dirs[codim - 1]; } + const tbox::Dimension& + getDim() const + { + return d_dim; + } + protected: /*! * @brief protected constructor @@ -220,18 +247,23 @@ class BoundaryLookupTable private: /*! - * @brief Build table by recursively computing the entries in the + * @brief Build static table by recursively computing the entries in the * lookup table for a given codimension. * - * TODO: Document the parameters. + * @param table Array to hold data for the table + * @param work Storage where values are computed for the table + * @param rec_level Level of recursion + * @param ptr Pointer to pass the table array recursively + * @param codim Codimension being worked on + * @param ibeg Beginning of iteration over dimensions */ void buildTable(int* table, - int codim, - int ibeg, - int(&work)[tbox::Dimension::MAXIMUM_DIMENSION_VALUE], - int& lvl, - int * & ptr); + int(&work)[SAMRAI::MAX_DIM_VAL], + int& rec_level, + int * & ptr, + const int codim, + const int ibeg); /*! * @brief Build table of direction IntVectors @@ -256,8 +288,7 @@ class BoundaryLookupTable * @brief Static data members used to control access to and destruction of * singleton variable database instance. */ - static BoundaryLookupTable* s_lookup_table_instance[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; + static BoundaryLookupTable* s_lookup_table_instance[SAMRAI::MAX_DIM_VAL]; /*! * @brief Dimension of the object @@ -265,28 +296,27 @@ class BoundaryLookupTable const tbox::Dimension d_dim; /*! - * @brief Array used to store the number of combinations for + * @brief Vector used to store the number of combinations for * each codimension. */ - tbox::Array d_ncomb; + std::vector d_ncomb; /*! - * @brief Array used to store the number of possible location indices + * @brief Vector used to store the number of possible location indices * for each codimension. */ - tbox::Array d_max_li; + std::vector d_max_li; /*! * @brief Data member used to store the lookup table. */ - tbox::Array > - d_table[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + std::vector > d_table[SAMRAI::MAX_DIM_VAL]; /*! - * @brief Array to hold information about possible directions for each + * @brief Vector to hold information about possible directions for each * codimension. */ - tbox::Array > d_bdry_dirs; + std::vector > d_bdry_dirs; static tbox::StartupShutdownManager::Handler s_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.C index 7bc13446..ac3d1925 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box representing a portion of the AMR index space * ************************************************************************/ - -#ifndef included_hier_Box_C -#define included_hier_Box_C - #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/tbox/StartupShutdownManager.h" @@ -18,8 +14,8 @@ namespace SAMRAI { namespace hier { -Box * Box::s_emptys[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; -Box * Box::s_universes[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +Box * Box::s_emptys[SAMRAI::MAX_DIM_VAL]; +Box * Box::s_universes[SAMRAI::MAX_DIM_VAL]; tbox::StartupShutdownManager::Handler Box::s_initialize_finalize_handler( @@ -42,32 +38,15 @@ int Box::s_active_ct = 0; int Box::s_high_water = 0; #endif -Box::Box(): - d_lo(tbox::Dimension::getInvalidDimension(), tbox::MathUtilities::getMax()), - d_hi(tbox::Dimension::getInvalidDimension(), tbox::MathUtilities::getMin()), - d_block_id(BlockId::invalidId()), - d_id_locked(false) -{ -#ifdef BOX_TELEMETRY - // Increment the cumulative constructed count, active box count and reset - // the high water mark of active boxes if necessary. - ++s_cumulative_constructed_ct; - ++s_active_ct; - if (s_active_ct > s_high_water) { - s_high_water = s_active_ct; - } -#endif -} - Box::Box( const tbox::Dimension& dim): d_lo(dim, tbox::MathUtilities::getMax()), d_hi(dim, tbox::MathUtilities::getMin()), d_block_id(BlockId::invalidId()), d_id(GlobalId(), PeriodicId::zero()), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(true) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); #ifdef BOX_TELEMETRY // Increment the cumulative constructed count, active box count and reset // the high water mark of active boxes if necessary. @@ -87,9 +66,10 @@ Box::Box( d_hi(upper), d_block_id(block_id), d_id(GlobalId(), PeriodicId::zero()), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(boost::logic::indeterminate) { - TBOX_DIM_ASSERT_CHECK_ARGS2(lower, upper); + TBOX_ASSERT_OBJDIM_EQUALITY2(lower, upper); TBOX_ASSERT(block_id != BlockId::invalidId()); #ifdef BOX_TELEMETRY // Increment the cumulative constructed count, active box count and reset @@ -108,7 +88,8 @@ Box::Box( d_hi(box.d_hi), d_block_id(box.d_block_id), d_id(box.d_id), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(box.d_empty_flag) { #ifdef BOX_TELEMETRY // Increment the cumulative constructed count, active box count and reset @@ -123,8 +104,10 @@ Box::Box( Box::Box( const tbox::DatabaseBox& box): - d_lo(box.getDim(), tbox::MathUtilities::getMax()), - d_hi(box.getDim(), tbox::MathUtilities::getMin()), + d_lo(tbox::Dimension(static_cast(box.getDimVal())), + tbox::MathUtilities::getMax()), + d_hi(tbox::Dimension(static_cast(box.getDimVal())), + tbox::MathUtilities::getMin()), d_id(GlobalId(), PeriodicId::zero()), d_id_locked(false) { @@ -140,6 +123,32 @@ Box::Box( #endif } +Box::Box( + const Index& lower, + const Index& upper, + const BlockId& block_id, + const LocalId& local_id, + const int owner_rank, + const PeriodicId& periodic_id): + d_lo(lower), + d_hi(upper), + d_block_id(block_id), + d_id(local_id, owner_rank, periodic_id), + d_id_locked(false), + d_empty_flag(boost::logic::indeterminate) +{ + TBOX_ASSERT(periodic_id.isValid()); +#ifdef BOX_TELEMETRY + // Increment the cumulative constructed count, active box count and + // reset the high water mark of active boxes if necessary. + ++s_cumulative_constructed_ct; + ++s_active_ct; + if (s_active_ct > s_high_water) { + s_high_water = s_active_ct; + } +#endif +} + Box::Box( const Box& box, const LocalId& local_id, @@ -149,14 +158,13 @@ Box::Box( d_hi(box.d_hi), d_block_id(box.d_block_id), d_id(local_id, owner, periodic_id), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(box.d_empty_flag) { TBOX_ASSERT(periodic_id.isValid()); - TBOX_ASSERT(periodic_id.getPeriodicValue() < - PeriodicShiftCatalog::getCatalog(box.getDim())->getNumberOfShifts()); #ifdef BOX_TELEMETRY - // Increment the cumulative constructed count, active mapped box count and - // reset the high water mark of active mapped boxes if necessary. + // Increment the cumulative constructed count, active box count and + // reset the high water mark of active boxes if necessary. ++s_cumulative_constructed_ct; ++s_active_ct; if (s_active_ct > s_high_water) { @@ -169,18 +177,17 @@ Box::Box( const tbox::Dimension& dim, const GlobalId& global_id, const PeriodicId& periodic_id): - d_lo(dim), - d_hi(dim), + d_lo(dim, tbox::MathUtilities::getMax()), + d_hi(dim, tbox::MathUtilities::getMin()), d_block_id(BlockId::invalidId()), d_id(global_id, periodic_id), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(true) { TBOX_ASSERT(periodic_id.isValid()); - TBOX_ASSERT(periodic_id.getPeriodicValue() < PeriodicShiftCatalog::getCatalog( - dim)->getNumberOfShifts()); #ifdef BOX_TELEMETRY - // Increment the cumulative constructed count, active mapped box count and - // reset the high water mark of active mapped boxes if necessary. + // Increment the cumulative constructed count, active box count and + // reset the high water mark of active boxes if necessary. ++s_cumulative_constructed_ct; ++s_active_ct; if (s_active_ct > s_high_water) { @@ -191,19 +198,17 @@ Box::Box( Box::Box( const tbox::Dimension& dim, - const BoxId& mapped_box_id): - d_lo(dim), - d_hi(dim), - d_id(mapped_box_id), - d_id_locked(false) + const BoxId& box_id): + d_lo(dim, tbox::MathUtilities::getMax()), + d_hi(dim, tbox::MathUtilities::getMin()), + d_id(box_id), + d_id_locked(false), + d_empty_flag(true) { - TBOX_ASSERT(mapped_box_id.getPeriodicId().isValid()); - TBOX_ASSERT( - mapped_box_id.getPeriodicId().getPeriodicValue() < - PeriodicShiftCatalog::getCatalog(dim)->getNumberOfShifts()); + TBOX_ASSERT(box_id.getPeriodicId().isValid()); #ifdef BOX_TELEMETRY - // Increment the cumulative constructed count, active mapped box count and - // reset the high water mark of active mapped boxes if necessary. + // Increment the cumulative constructed count, active box count and + // reset the high water mark of active boxes if necessary. ++s_cumulative_constructed_ct; ++s_active_ct; if (s_active_ct > s_high_water) { @@ -213,26 +218,28 @@ Box::Box( } /* - ******************************************************************************* + ****************************************************************************** * Construct Box from the components of a reference Box * and possibly changing the periodic shift. - ******************************************************************************* + ****************************************************************************** */ Box::Box( const Box& other, const PeriodicId& periodic_id, - const IntVector& refinement_ratio): + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog): d_lo(other.d_lo), d_hi(other.d_hi), d_block_id(other.getBlockId()), d_id(other.getLocalId(), other.getOwnerRank(), periodic_id), - d_id_locked(false) + d_id_locked(false), + d_empty_flag(other.d_empty_flag) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, other, refinement_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, other, refinement_ratio); #ifdef BOX_TELEMETRY - // Increment the cumulative constructed count, active mapped box count and - // reset the high water mark of active mapped boxes if necessary. + // Increment the cumulative constructed count, active box count and + // reset the high water mark of active boxes if necessary. ++s_cumulative_constructed_ct; ++s_active_ct; if (s_active_ct > s_high_water) { @@ -242,38 +249,35 @@ Box::Box( const tbox::Dimension& dim(d_lo.getDim()); - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(dim); - TBOX_ASSERT(periodic_id.isValid()); - TBOX_ASSERT(periodic_id.getPeriodicValue() < shift_catalog->getNumberOfShifts()); + TBOX_ASSERT(periodic_id.getPeriodicValue() < shift_catalog.getNumberOfShifts()); if (refinement_ratio > IntVector::getZero(dim)) { - if (other.getPeriodicId() != shift_catalog->getZeroShiftNumber()) { + if (other.getPeriodicId() != shift_catalog.getZeroShiftNumber()) { // Undo the shift that existed in other's Box. - shift(-shift_catalog->shiftNumberToShiftDistance(other. + shift(-shift_catalog.shiftNumberToShiftDistance(other. getPeriodicId()) * refinement_ratio); } - if (periodic_id != shift_catalog->getZeroShiftNumber()) { + if (periodic_id != shift_catalog.getZeroShiftNumber()) { // Apply the shift for this Box. - shift(shift_catalog->shiftNumberToShiftDistance(periodic_id) + shift(shift_catalog.shiftNumberToShiftDistance(periodic_id) * refinement_ratio); } } else if (refinement_ratio < IntVector::getZero(dim)) { - if (other.getPeriodicId() != shift_catalog->getZeroShiftNumber()) { + if (other.getPeriodicId() != shift_catalog.getZeroShiftNumber()) { // Undo the shift that existed in other's Box. - shift(shift_catalog->shiftNumberToShiftDistance(other.getPeriodicId()) + shift(shift_catalog.shiftNumberToShiftDistance(other.getPeriodicId()) / refinement_ratio); } - if (periodic_id != shift_catalog->getZeroShiftNumber()) { + if (periodic_id != shift_catalog.getZeroShiftNumber()) { // Apply the shift for this Box. - shift(-shift_catalog->shiftNumberToShiftDistance(periodic_id) + shift(-shift_catalog.shiftNumberToShiftDistance(periodic_id) / refinement_ratio); } @@ -299,24 +303,17 @@ Box& Box::operator = ( const Box& rhs) { - if (this != &rhs) { - /* - * Allow assignment of to an uninitialized box but - * not from an uninitialized box. - * This is needed for tbox::Array and vector. - */ - if (getDim().isValid()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - } else { - TBOX_DIM_ASSERT_CHECK_DIM(rhs.getDim()); - } + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); d_lo = rhs.d_lo; d_hi = rhs.d_hi; + d_empty_flag = rhs.d_empty_flag; if (!d_id_locked) { d_block_id = rhs.d_block_id; d_id = rhs.d_id; + } else if (d_block_id == rhs.d_block_id && d_id == rhs.d_id) { + //No operation needed, the id objects were already equal. } else { TBOX_ERROR("Attempted to change BoxId that is locked in an ordered BoxContainer."); } @@ -345,47 +342,46 @@ void Box::initialize( const Box& other, const PeriodicId& periodic_id, - const IntVector& refinement_ratio) + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, other, refinement_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, other, refinement_ratio); const tbox::Dimension& dim(d_lo.getDim()); - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(dim); - TBOX_ASSERT(periodic_id.isValid()); - TBOX_ASSERT(periodic_id.getPeriodicValue() < shift_catalog->getNumberOfShifts()); + TBOX_ASSERT(periodic_id.getPeriodicValue() < shift_catalog.getNumberOfShifts()); d_lo = other.d_lo; d_hi = other.d_hi; + d_empty_flag = other.d_empty_flag; if (refinement_ratio > IntVector::getZero(dim)) { - if (other.getPeriodicId() != shift_catalog->getZeroShiftNumber()) { + if (other.getPeriodicId() != shift_catalog.getZeroShiftNumber()) { // Undo the shift that existed in r's Box. - shift(-shift_catalog->shiftNumberToShiftDistance(other. + shift(-shift_catalog.shiftNumberToShiftDistance(other. getPeriodicId()) * refinement_ratio); } - if (periodic_id != shift_catalog->getZeroShiftNumber()) { + if (periodic_id != shift_catalog.getZeroShiftNumber()) { // Apply the shift for this Box. - shift(shift_catalog->shiftNumberToShiftDistance(periodic_id) + shift(shift_catalog.shiftNumberToShiftDistance(periodic_id) * refinement_ratio); } } else if (refinement_ratio < IntVector::getZero(dim)) { - if (other.getPeriodicId() != shift_catalog->getZeroShiftNumber()) { + if (other.getPeriodicId() != shift_catalog.getZeroShiftNumber()) { // Undo the shift that existed in r's Box. - shift(shift_catalog->shiftNumberToShiftDistance(other.getPeriodicId()) + shift(shift_catalog.shiftNumberToShiftDistance(other.getPeriodicId()) / refinement_ratio); } - if (periodic_id != shift_catalog->getZeroShiftNumber()) { + if (periodic_id != shift_catalog.getZeroShiftNumber()) { // Apply the shift for this Box. - shift(-shift_catalog->shiftNumberToShiftDistance(periodic_id) + shift(-shift_catalog.shiftNumberToShiftDistance(periodic_id) / refinement_ratio); } @@ -411,9 +407,8 @@ Box::initialize( Index Box::index( - const int offset) const + const size_t offset) const { - TBOX_ASSERT(offset >= 0); TBOX_ASSERT(offset <= size()); IntVector n(getDim()); @@ -421,33 +416,31 @@ Box::index( n = numberCells(); - int remainder = offset; + size_t remainder = offset; - for (int d = getDim().getValue() - 1; d > -1; d--) { + for (int d = getDim().getValue() - 1; d > -1; --d) { /* Compute the stride for indexing */ int stride = 1; - for (int stride_dim = 0; stride_dim < d; stride_dim++) { + for (int stride_dim = 0; stride_dim < d; ++stride_dim) { stride *= n[stride_dim]; } /* Compute the local index */ - index[d] = remainder / stride; + index[d] = static_cast(remainder / stride); remainder -= index[d] * stride; /* Compute the global index */ - index[getDim().getValue()] += lower(d); + index[d] += lower(static_cast(d)); } - Index idx(index); - - return idx; + return Index(index); } bool Box::contains( const Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); if (box.empty()) { return true; @@ -472,7 +465,7 @@ Box Box::operator * ( const Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); Box both(*this); @@ -481,10 +474,11 @@ Box::operator * ( both.setEmpty(); } else { TBOX_ERROR("Attempted intersection of Boxes from different blocks."); - } + } } else { both.d_lo.max(box.d_lo); both.d_hi.min(box.d_hi); + both.d_empty_flag = boost::logic::indeterminate; } return both; @@ -494,7 +488,7 @@ Box& Box::operator *= ( const Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); if (d_block_id != box.d_block_id) { if (empty() || box.empty()) { @@ -505,8 +499,9 @@ Box::operator *= ( } else { d_lo.max(box.d_lo); d_hi.min(box.d_hi); + d_empty_flag = boost::logic::indeterminate; } - + return *this; } @@ -515,7 +510,7 @@ Box::intersect( const Box& other, Box& result) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, other); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, other); result = *this; if (result.d_block_id != other.d_block_id) { @@ -527,6 +522,7 @@ Box::intersect( } else { result.d_lo.max(other.d_lo); result.d_hi.min(other.d_hi); + result.d_empty_flag = boost::logic::indeterminate; } } @@ -534,17 +530,17 @@ bool Box::intersects( const Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); if (d_block_id != box.d_block_id) { if (empty() || box.empty()) { return false; } else { - TBOX_ERROR("Attempted intersection of Boxes from different blocks."); + TBOX_ERROR("Attempted intersection of Boxes from different blocks."); } } - for (int i = 0; i < getDim().getValue(); i++) { + for (dir_t i = 0; i < getDim().getValue(); ++i) { if (tbox::MathUtilities::Max(d_lo(i), box.d_lo(i)) > tbox::MathUtilities::Min(d_hi(i), box.d_hi(i))) { return false; @@ -558,9 +554,7 @@ Box Box::operator + ( const Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - - Box bbox(*this); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); if (d_block_id != box.d_block_id) { if (!(empty()) || !(box.empty())) { @@ -568,16 +562,37 @@ Box::operator + ( } } + Box bbox(*this); bbox += box; return bbox; } +Box& +Box::operator += ( + const Box& box) +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + + if (!box.empty()) { + if (empty()) { + *this = box; + } else if (d_block_id == box.d_block_id) { + d_lo.min(box.d_lo); + d_hi.max(box.d_hi); + d_empty_flag = boost::logic::indeterminate; + } else { + TBOX_ERROR("Attempted bounding box of Boxes from different blocks."); + } + } + return *this; +} + void Box::lengthen( - const int direction, + const dir_t direction, const int ghosts) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); if (!empty()) { if (ghosts > 0) { @@ -590,10 +605,10 @@ Box::lengthen( void Box::shorten( - const int direction, + const dir_t direction, const int ghosts) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); if (!empty()) { if (ghosts > 0) { @@ -601,6 +616,7 @@ Box::shorten( } else { d_lo(direction) -= ghosts; } + d_empty_flag = boost::logic::indeterminate; } } @@ -608,27 +624,31 @@ void Box::refine( const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio); + BlockId::block_t b = ratio.getNumBlocks() > 1 ? d_block_id.getBlockValue() : 0; + TBOX_ASSERT(b < ratio.getNumBlocks()); bool negative_ratio = false; - for (int d = 0; d < getDim().getValue(); d++) { - if (ratio(d) < 0) { + for (unsigned int d = 0; d < getDim().getValue(); ++d) { + if (ratio(b,d) < 0) { negative_ratio = true; break; } } if (!negative_ratio) { - d_lo *= ratio; - d_hi = d_hi * ratio + (ratio - 1); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_lo(i) *= ratio(b,i); + d_hi(i) = d_hi(i) * ratio(b,i) + (ratio(b,i) - 1); + } } else { - for (int i = 0; i < getDim().getValue(); i++) { - if (ratio(i) > 0) { - d_lo(i) *= ratio(i); - d_hi(i) = d_hi(i) * ratio(i) + (ratio(i) - 1); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + if (ratio(b,i) > 0) { + d_lo(i) *= ratio(b,i); + d_hi(i) = d_hi(i) * ratio(b,i) + (ratio(b,i) - 1); } else { - d_lo(i) = coarsen(d_lo(i), -ratio(i)); - d_hi(i) = coarsen(d_hi(i), -ratio(i)); + d_lo(i) = coarsen(d_lo(i), -ratio(b,i)); + d_hi(i) = coarsen(d_hi(i), -ratio(b,i)); } } } @@ -637,18 +657,18 @@ Box::refine( /* ************************************************************************* * - * Return the dimension of the box that is the longest. + * Return the direction of the box that is the longest. * ************************************************************************* */ -int -Box::longestDimension() const +Box::dir_t +Box::longestDirection() const { int max = upper(0) - lower(0); - int dim = 0; + dir_t dim = 0; - for (int i = 1; i < getDim().getValue(); i++) + for (dir_t i = 1; i < getDim().getValue(); ++i) if ((upper(i) - lower(i)) > max) { max = upper(i) - lower(i); dim = i; @@ -667,13 +687,11 @@ Box::longestDimension() const tbox::DatabaseBox Box::DatabaseBox_from_Box() const { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - tbox::DatabaseBox new_Box; new_Box.setDim(getDim()); - for (int i = 0; i < getDim().getValue(); i++) { + for (dir_t i = 0; i < getDim().getValue(); ++i) { new_Box.lower(i) = d_lo(i); new_Box.upper(i) = d_hi(i); } @@ -685,26 +703,25 @@ void Box::set_Box_from_DatabaseBox( const tbox::DatabaseBox& box) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - - for (int i = 0; i < box.getDim().getValue(); i++) { + for (dir_t i = 0; i < box.getDimVal(); ++i) { d_lo(i) = box.lower(i); d_hi(i) = box.upper(i); } + d_empty_flag = boost::logic::indeterminate; } void Box::putToIntBuffer( int* buffer) const { - buffer[0] = d_block_id.getBlockValue(); - buffer++; + buffer[0] = static_cast(d_block_id.getBlockValue()); + ++buffer; d_id.putToIntBuffer(buffer); buffer += BoxId::commBufferSize(); - const int dim(d_lo.getDim().getValue()); - for (int d = 0; d < dim; ++d) { + const dir_t dim(d_lo.getDim().getValue()); + for (dir_t d = 0; d < dim; ++d) { buffer[d] = d_lo(d); buffer[dim + d] = d_hi(d); } @@ -716,41 +733,41 @@ Box::getFromIntBuffer( const int* buffer) { d_block_id = BlockId(buffer[0]); - buffer++; + ++buffer; d_id.getFromIntBuffer(buffer); buffer += BoxId::commBufferSize(); - const int dim(d_lo.getDim().getValue()); - for (int d = 0; d < dim; ++d) { + const dir_t dim(d_lo.getDim().getValue()); + for (dir_t d = 0; d < dim; ++d) { d_lo(d) = buffer[d]; d_hi(d) = buffer[dim + d]; } + d_empty_flag = boost::logic::indeterminate; } void Box::putToMessageStream( - tbox::MessageStream &msg) const + tbox::MessageStream& msg) const { msg << d_block_id.getBlockValue(); d_id.putToMessageStream(msg); - msg.pack( &d_lo[0], d_lo.getDim().getValue() ); - msg.pack( &d_hi[0], d_hi.getDim().getValue() ); - return; + msg.pack(&d_lo[0], d_lo.getDim().getValue()); + msg.pack(&d_hi[0], d_hi.getDim().getValue()); } void Box::getFromMessageStream( - tbox::MessageStream &msg) + tbox::MessageStream& msg) { int tmpi; msg >> tmpi; d_block_id = BlockId(tmpi); d_id.getFromMessageStream(msg); - msg.unpack( &d_lo[0], d_lo.getDim().getValue() ); - msg.unpack( &d_hi[0], d_hi.getDim().getValue() ); - return; + msg.unpack(&d_lo[0], d_lo.getDim().getValue()); + msg.unpack(&d_hi[0], d_hi.getDim().getValue()); + d_empty_flag = boost::logic::indeterminate; } /* @@ -766,12 +783,13 @@ operator >> ( std::istream& s, Box& box) { - TBOX_DIM_ASSERT_CHECK_DIM(box.getDim()); - while (s.get() != '[') ; - s >> box.lower(); + Index tmp(box.getDim()); + s >> tmp; + box.setLower(tmp); while (s.get() != ',') NULL_STATEMENT; - s >> box.upper(); + s >> tmp; + box.setUpper(tmp); while (s.get() != ']') NULL_STATEMENT; return s; } @@ -781,40 +799,20 @@ operator << ( std::ostream& s, const Box& box) { - TBOX_DIM_ASSERT_CHECK_DIM(box.getDim()); - if (box.empty()) { s << "[(),()]"; } else { - s << box.getId() << " [" << box.lower() << "," << box.upper() << "]"; + s << box.getBoxId() << ' ' << box.getBlockId() + << '[' << box.lower() << ',' << box.upper() << ']'; } return s; } -Box& -Box::operator += ( - const Box& box) -{ - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - - if (!box.empty()) { - if (empty()) { - *this = box; - } else if (d_block_id == box.d_block_id) { - d_lo.min(box.d_lo); - d_hi.max(box.d_hi); - } else { - TBOX_ERROR("Attempted bounding box of Boxes from different blocks."); - } - } - return *this; -} - /* ************************************************************************* * * Static member function called from coalesceWith(). It attempts to - * recursively coalesce intervals individual dimensions in index space. + * recursively coalesce intervals individual directions in index space. * If it is possible to coalesce two intervals (defined by a proper * overlap or adjacency relationship), the value true is returned. * If this is impossible, false is returned. @@ -843,21 +841,21 @@ Box::coalesceIntervals( return retval; } } else { - for (int id = 0; id < dim; id++) { + for (dir_t id = 0; id < dim; ++id) { if ((lo1[id] == lo2[id]) && (hi1[id] == hi2[id])) { - int id2; - int low1[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int high1[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int low2[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int high2[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (id2 = 0; id2 < id; id2++) { + dir_t id2; + int low1[SAMRAI::MAX_DIM_VAL]; + int high1[SAMRAI::MAX_DIM_VAL]; + int low2[SAMRAI::MAX_DIM_VAL]; + int high2[SAMRAI::MAX_DIM_VAL]; + for (id2 = 0; id2 < id; ++id2) { low1[id2] = lo1[id2]; high1[id2] = hi1[id2]; low2[id2] = lo2[id2]; high2[id2] = hi2[id2]; } - for (id2 = id + 1; id2 < dim; id2++) { - int id1 = id2 - 1; + for (id2 = static_cast(id + 1); id2 < dim; ++id2) { + dir_t id1 = static_cast(id2 - 1); low1[id1] = lo1[id2]; high1[id1] = hi1[id2]; low2[id1] = lo2[id2]; @@ -890,7 +888,7 @@ bool Box::coalesceWith( const Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); bool retval = false; @@ -898,12 +896,12 @@ Box::coalesceWith( retval = true; *this += box; } else if (d_block_id == box.d_block_id) { - int id; + dir_t id; const int* box_lo = &box.lower()[0]; const int* box_hi = &box.upper()[0]; - int me_lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int me_hi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (id = 0; id < getDim().getValue(); id++) { + int me_lo[SAMRAI::MAX_DIM_VAL]; + int me_hi[SAMRAI::MAX_DIM_VAL]; + for (id = 0; id < getDim().getValue(); ++id) { me_lo[id] = d_lo(id); me_hi[id] = d_hi(id); } @@ -915,7 +913,7 @@ Box::coalesceWith( id = 0; while (retval && (id < getDim().getValue())) { retval = ((me_lo[id] <= box_lo[id]) && (me_hi[id] >= box_hi[id])); - id++; + ++id; } if (!retval) { // me doesn't contain box; check other way around... retval = true; @@ -923,7 +921,7 @@ Box::coalesceWith( while (retval && (id < getDim().getValue())) { retval = ((box_lo[id] <= me_lo[id]) && (box_hi[id] >= me_hi[id])); - id++; + ++id; } } } @@ -939,18 +937,17 @@ Box::coalesceWith( /* ************************************************************************* * * - * Rotates a 3-Dimensional box 45*num_rotations degrees around the given * - * and set this box to the union of the boxes. * + * Rotates a 3-Dimensional box 90*num_rotations degrees around the given * + * axis. * * * ************************************************************************* */ void Box::rotateAboutAxis( - const int axis, + const dir_t axis, const int num_rotations) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); TBOX_ASSERT(axis < getDim().getValue()); TBOX_ASSERT(getDim().getValue() == 3); @@ -962,7 +959,7 @@ Box::rotateAboutAxis( Index tmp_lo(dim); Index tmp_hi(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_lo = d_lo; tmp_hi = d_hi; d_lo(a) = tmp_lo(b); @@ -987,15 +984,26 @@ Box::rotate( if (rotation_ident == Transformation::NO_ROTATE) return; - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - TBOX_ASSERT(getDim().getValue() == 2 || getDim().getValue() == 3); + TBOX_ASSERT(getDim().getValue() == 1 || getDim().getValue() == 2 || + getDim().getValue() == 3); - if (getDim().getValue() == 2) { + if (getDim().getValue() == 1) { + int rotation_number = static_cast(rotation_ident); + if (rotation_number > 1) { + TBOX_ERROR("Box::rotate invalid 1D RotationIdentifier."); + } + if (rotation_number) { + Index tmp_lo(d_lo); + Index tmp_hi(d_hi); + d_lo(0) = -tmp_hi(0) - 1; + d_hi(0) = -tmp_lo(0) - 1; + } + } else if (getDim().getValue() == 2) { int rotation_number = static_cast(rotation_ident); if (rotation_number > 3) { TBOX_ERROR("Box::rotate invalid 2D RotationIdentifier."); } - for (int j = 0; j < rotation_number; j++) { + for (int j = 0; j < rotation_number; ++j) { Index tmp_lo(d_lo); Index tmp_hi(d_hi); @@ -1084,7 +1092,7 @@ Box::rotate( void Box::initializeCallback() { - for (unsigned short d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (unsigned short d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { tbox::Dimension dim(static_cast(d + 1)); s_emptys[d] = new Box(dim); @@ -1106,22 +1114,41 @@ Box::initializeCallback() void Box::finalizeCallback() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { delete s_emptys[d]; delete s_universes[d]; } } +/* + ************************************************************************* + ************************************************************************* + */ +BoxIterator +Box::begin() const +{ + return iterator(*this, true); +} + +/* + ************************************************************************* + ************************************************************************* + */ +BoxIterator +Box::end() const +{ + return iterator(*this, false); +} + BoxIterator::BoxIterator( const Box& box, bool begin): d_index(box.lower()), d_box(box) { - TBOX_DIM_ASSERT_CHECK_DIM(box.getDim()); if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -1138,5 +1165,3 @@ BoxIterator::~BoxIterator() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.h index f4f64e9c..d4220309 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Box.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box representing a portion of the AMR index space * ************************************************************************/ @@ -13,33 +13,20 @@ #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/BoxId.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/BoxId.h" +#include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/hier/Transformation.h" +#include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/MessageStream.h" #include "SAMRAI/tbox/Utilities.h" +#include "boost/logic/tribool.hpp" #include -/* - * Forward declaration, which is questionable with respect to SAMRAI - * package ordering. This is needed since pdat::ArrayData class - * needs to access private Box default constructor. - * - * It would be good to come up with an alternative to this. - */ -namespace SAMRAI { - -namespace pdat { -template -class ArrayData; -} - -} - namespace SAMRAI { namespace hier { @@ -61,16 +48,24 @@ class BoxIterator; * SAMRAI, the BlockId and the PeriodicId associated with a Box cannot both be * nonzero. * - * @see hier::BoxIterator - * @see hier::Index - * @see hier::BlockId - * @see hier::BoxId - * @see hier::PeriodicId + * @see BoxIterator + * @see Index + * @see BlockId + * @see BoxId + * @see PeriodicId */ class Box { public: + typedef tbox::Dimension::dir_t dir_t; + + /** + * A box iterator iterates over the elements of a box. This class is + * defined elsewhere, and the typedef is used to point to that class. + */ + typedef BoxIterator iterator; + /*! * @brief Creates an empty box with invalid BlockId and BoxId values. * @@ -87,6 +82,9 @@ class Box * @param[in] lower Lower extent * @param[in] upper Upper extent * @param[in] block_id Block where the Box exists + * + * @pre lower.getDim() == upper.getDim() + * @pre block_id != BlockId::invalidId() */ Box( const Index& lower, @@ -94,7 +92,7 @@ class Box const BlockId& block_id); /*! - * @brief Copy constructor + * @brief Copy constructor */ Box( const Box& box); @@ -105,6 +103,34 @@ class Box explicit Box( const tbox::DatabaseBox& box); + /*! + * @brief Initializing constructor. + * + * @param[in] lower + * + * @param[in] upper + * + * @param[in] block_id + * + * @param[in] local_id + * + * @param[in] owner_rank + * + * @param[in] periodic_id Describes the periodic shift. If + * periodic_id is non-zero, specify the Box in the position shifted + * according to the @c periodic_id. The default argument for @c + * periodic_id corresponds to the zero-shift. + * + * @pre periodic_id.isValid() + */ + Box( + const Index& lower, + const Index& upper, + const BlockId& block_id, + const LocalId& local_id, + const int owner_rank, + const PeriodicId& periodic_id = PeriodicId::zero()); + /*! * @brief Initializing constructor. * @@ -118,6 +144,8 @@ class Box * periodic_id is non-zero, specify the Box in the position shifted * according to the @c periodic_id. The default argument for @c * periodic_id corresponds to the zero-shift. + * + * @pre periodic_id.isValid() */ Box( const Box& box, @@ -136,6 +164,8 @@ class Box * @param[in] id * * @param[in] periodic_id + * + * @pre periodic_id.isValid() */ /* * TODO: Constructors initializing boxes are only used to construct @@ -156,7 +186,9 @@ class Box * * @param[in] dim * - * @param[in] mapped_box_id + * @param[in] box_id + * + * @pre box_id.getPeriodicId().isValid() */ /* * TODO: Constructors initializing boxes are only used to construct @@ -166,7 +198,7 @@ class Box */ Box( const tbox::Dimension& dim, - const BoxId& mapped_box_id); + const BoxId& box_id); /*! * @brief "Copy" constructor allowing change in PeriodicId. @@ -178,15 +210,24 @@ class Box * the shift in @c other. The box will be set to the real box * shifted to the position specified by this value. * - * @param[in] refinement_ratio The index space where the Box - * lives. + * @param[in] refinement_ratio The index space where the Box lives. + * + * @param[in] shift_catalog PeriodicShiftCatalog object that maps the + * PeriodicId to a specific shift. + * + * @pre other.getDim() == refinement_ratio.getDim() + * @pre periodic_id.isValid() + * @pre periodic_id.getPeriodicValue() < shift_catalog.getNumberOfShifts() + * @pre (refinement_ratio > IntVector::getZero(other.getDim())) || + * (refinement_ratio < IntVector::getZero(other.getDim())) * * @see initialize( const Box&, const int, const IntVector&); */ Box( const Box& other, const PeriodicId& periodic_id, - const IntVector& refinement_ratio); + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog); /*! * @brief The destructor for Box. @@ -206,6 +247,8 @@ class Box * this is not zero, specify @c box in the shifted position. The * default argument for @c periodic_id corresponds to the * zero-shift. + * + * @pre idLocked() */ void initialize( @@ -214,13 +257,17 @@ class Box const int owner_rank, const PeriodicId& periodic_id = PeriodicId::zero()) { - d_lo = box.d_lo; - d_hi = box.d_hi; - d_block_id = box.d_block_id; - if (!d_id_locked) { + if (&box != this) { + d_lo = box.d_lo; + d_hi = box.d_hi; + d_block_id = box.d_block_id; + d_empty_flag = box.d_empty_flag; + } + if (!idLocked()) { d_id.initialize(local_id, owner_rank, periodic_id); } else { - TBOX_ERROR("Attempted to change BoxId that is locked in an ordered BoxContainer."); + TBOX_ERROR( + "Attempted to change BoxId that is locked in an ordered BoxContainer." << std::endl); } } @@ -235,14 +282,25 @@ class Box * shift in @c other. The box will be set to the real box shifted * to the position specified by this value. * - * @param[in] refinement_ratio The index space where the Box - * lives. + * @param[in] refinement_ratio The index space where the Box lives. + * + * @param[in] shift_catalog PeriodicShiftCatalog object that maps the + * PeriodicId to a specific shift. + * + * @pre (getDim() == other.getDim()) && + * (getDim() == refinement_ratio.getDim()) + * @pre periodic_id.isValid() + * @pre periodic_id.getPeriodicValue() < shift_catalog.getNumberOfShifts() + * @pre (refinement_ratio > IntVector::getZero(getDim())) || + * (refinement_ratio < IntVector::getZero(getDim())) + * @pre !idLocked() */ void initialize( const Box& other, const PeriodicId& periodic_id, - const IntVector& refinement_ratio); + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog); //! @brief Set the BoxId. void @@ -254,7 +312,7 @@ class Box //! @brief Get the BoxId. const BoxId& - getId() const + getBoxId() const { return d_id; } @@ -274,6 +332,13 @@ class Box return d_block_id; } + //! @brief Set the LocalId. + void + setLocalId(const LocalId& local_id) + { + return d_id.initialize(local_id, d_id.getOwnerRank(), d_id.getPeriodicId()); + } + //! @brief Get the LocalId. const LocalId& getLocalId() const @@ -338,13 +403,13 @@ class Box bool operator () (const Box& b1, const Box& b2) const { - return b1.getId() < b2.getId(); + return b1.getBoxId() < b2.getBoxId(); } bool operator () (const Box* b1, const Box* b2) const { - return b1->getId() < b2->getId(); + return b1->getBoxId() < b2->getBoxId(); } }; @@ -396,7 +461,7 @@ class Box */ void putToMessageStream( - tbox::MessageStream &msg) const; + tbox::MessageStream& msg) const; /*! * @brief Set attributes according to data in MessageStream. @@ -407,94 +472,104 @@ class Box */ void getFromMessageStream( - tbox::MessageStream &msg); + tbox::MessageStream& msg); //@} /*! * @brief assignment operator * - * An assignment to an uninitialized box is allowed but assigning - * from an uninitialized box will result in an assertion failure + * @param rhs + * + * @pre (this == &rhs) || (getDim() == rhs.getDim()) + * @pre (this == &rhs) || !idLocked() */ Box& operator = ( - const Box& box); + const Box& rhs); /*! - * @brief Return a non-const lower index of the box. + * @brief Return a const lower index of the box. */ - Index& - lower() + const Index& + lower() const { return d_lo; } /*! - * @brief Return a non-const upper index of the box. + * @brief Sets lower index of the box. */ - Index& - upper() + void + setLower( + const Index& new_lower) { - return d_hi; + d_lo = new_lower; + d_empty_flag = boost::logic::indeterminate; } /*! - * @brief Return a const lower index of the box. + * @brief Return a const upper index of the box. */ const Index& - lower() const + upper() const { - return d_lo; + return d_hi; } /*! - * @brief Return a const upper index of the box. + * @brief Sets upper index of the box. */ - const Index& - upper() const + void + setUpper( + const Index& new_upper) { - return d_hi; + d_hi = new_upper; + d_empty_flag = boost::logic::indeterminate; } /*! - * @brief Return the i'th component (non-const) of the lower index. + * @brief Return the i'th component (const) of the lower index. */ - int& + const int& lower( - const int i) + dir_t i) const { return d_lo(i); } /*! - * @brief Return the i'th component (non-const) of the upper index. + * @brief Sets the i'th component of the lower index. */ - int& - upper( - const int i) + void + setLower( + dir_t i, + int new_lower) { - return d_hi(i); + d_lo(i) = new_lower; + d_empty_flag = boost::logic::indeterminate; } /*! - * @brief Return the i'th component (const) of the lower index. + * @brief Return the i'th component (const) of the upper index. */ const int& - lower( - const int i) const + upper( + dir_t i) const { - return d_lo(i); + return d_hi(i); } /*! - * @brief Return the i'th component (const) of the upper index. + * @brief Sets the i'th component of the upper index. */ - const int& - upper( - const int i) const + void + setUpper( + dir_t i, + int new_upper) { - return d_hi(i); + d_hi(i) = new_upper; + d_empty_flag = boost::logic::indeterminate; } /*! @@ -506,42 +581,51 @@ class Box const tbox::Dimension& dim(getDim()); d_lo = Index(dim, tbox::MathUtilities::getMax()); d_hi = Index(dim, tbox::MathUtilities::getMin()); + d_empty_flag = true; } /*! * @brief Return whether the box is ``empty''. * - * isEmpty() is preferred to match "is" standard syntax for - * boolean methods. + * Archaic syntax. Synonymous with empty(). Retained for backward + * compatibility. * - * @see isEmpty() + * @see empty() */ - bool - empty() const + DEPRECATED( + bool + isEmpty() const) { - for (int i = 0; i < getDim().getValue(); i++) { - if (d_hi(i) < d_lo(i)) { - return true; - } - } - return false; + return empty(); } /*! * @brief Return whether the box is ``empty''. * + * This version follows the naming standards used in STL. + * * A box is empty if any of the lower bounds is greater than the * corresponding upper bound. An empty box has a size of zero. + * + * @return True if the box is empty. */ bool - isEmpty() const + empty() const { - for (int i = 0; i < getDim().getValue(); i++) { - if (d_hi(i) < d_lo(i)) { - return true; + if (d_empty_flag) { + return true; + } else if (!d_empty_flag) { + return false; + } else { + for (dir_t i = 0; i < getDim().getValue(); ++i) { + if (d_hi(i) < d_lo(i)) { + d_empty_flag = true; + return true; + } } + d_empty_flag = false; + return false; } - return false; } /*! @@ -550,7 +634,7 @@ class Box */ int numberCells( - const int i) const + const dir_t i) const { if (empty()) { return 0; @@ -569,34 +653,34 @@ class Box if (empty()) { return IntVector::getZero(getDim()); } else { - return d_hi - d_lo + 1; + return IntVector(d_hi - d_lo + 1); } } /*! * @brief Calculate the number of indices represented by the box. - * + * * If the box is empty, then the number of index points within the box is * zero. */ - int + size_t size() const { - int mysize = 0; + size_t mysize = 0; if (!empty()) { - mysize = 1; - for (int i = 0; i < getDim().getValue(); i++) { - mysize *= (d_hi(i) - d_lo(i) + 1); + mysize = static_cast((d_hi(0) - d_lo(0) + 1)); + for (dir_t i = 1; i < getDim().getValue(); ++i) { + mysize *= static_cast((d_hi(i) - d_lo(i) + 1)); } } return mysize; } /*! - * @brief Return the dimension of the box that is longest. + * @brief Return the direction of the box that is longest. */ - int - longestDimension() const; + dir_t + longestDirection() const; /*! * @brief Given an index, calculate the offset of the index into the box. @@ -605,15 +689,16 @@ class Box * the indices within the box. This operation is a convenience * function for array indexing operations. */ - int + size_t offset( const Index& p) const { - int myoffset = 0; - for (int i = getDim().getValue() - 1; i > 0; i--) { - myoffset = (d_hi(i - 1) - d_lo(i - 1) + 1) * (p(i) - d_lo(i) + myoffset); + size_t myoffset = 0; + for (unsigned int i = getDim().getValue() - 1; i > 0; --i) { + myoffset = static_cast( + (d_hi(i - 1) - d_lo(i - 1) + 1) * (p(i) - d_lo(i) + myoffset)); } - myoffset += p(0) - d_lo(0); + myoffset += static_cast(p(0) - d_lo(0)); return myoffset; } @@ -623,19 +708,37 @@ class Box * This function assumes column-major (e.g., Fortran) ordering of * the indices within the box. This operation is a convenience * function for array indexing operations. + * + * @param offset + * + * @pre (offset >= 0) && (offset <= size()) */ Index index( - const int offset) const; + const size_t offset) const; + + /*! + * @brief Return an iterator pointing to the first index of this. + */ + iterator + begin() const; + + /*! + * @brief Return an iterator pointing to the last index of this. + */ + iterator + end() const; /*! * @brief Check whether an index lies within the bounds of the box. + * + * @param p */ bool contains( const Index& p) const { - for (int i = 0; i < getDim().getValue(); i++) { + for (dir_t i = 0; i < getDim().getValue(); ++i) { if ((p(i) < d_lo(i)) || (p(i) > d_hi(i))) { return false; } @@ -646,11 +749,15 @@ class Box /*! * @brief Check whether a given box lies within the bounds of the box. * - * If @c b is empty, always return true. + * If @c box is empty, always return true. + * + * @param box + * + * @pre getDim() == box.getDim() */ bool contains( - const Box& b) const; + const Box& box) const; /*! * @brief Check whether two boxes represent the same portion of index space @@ -669,14 +776,22 @@ class Box { return b1.isSpatiallyEqual(b2); } + bool + operator () (const Box* b1, const Box* b2) const + { + return b1->isSpatiallyEqual(*b2); + } }; /*! * @brief Calculate the intersection of the index spaces of two boxes. * - * The intersection with an empty box always yields an empty box. If the - * two boxes have different BlockIds and are both non-empty, an error will - * occur. + * The intersection with an empty box always yields an empty box. + * + * @param box + * + * @pre getDim() == box.getDim() + * @pre (getBlockId() == box.getBlockId()) || empty() || box.empty() */ Box operator * ( @@ -686,21 +801,29 @@ class Box * @brief Calculate the intersection of the index spaces of this and the * given box. * - * The intersection with an empty box always yields an empty box. If the - * two boxes have different BlockIds and are both non-empty, an error will - * occur. + * The intersection with an empty box always yields an empty box. + * + * @param box + * + * @pre getDim() == box.getDim() + * @pre (getBlockId() == box.getBlockId()) || empty() || box.empty() */ Box - &operator *= ( + & + operator *= ( const Box& box); /*! * @brief Box intersection. - * + * * Calculate the intersection of the index spaces of two boxes. The - * intersection with an empty box always yields an empty box. If the - * two boxes have different BlockIds and are both non-empty, an error will - * occur. + * intersection with an empty box always yields an empty box. + * + * @param other + * @param result + * + * @pre getDim() == box.getDim() + * @pre (getBlockId() == box.getBlockId()) || empty() || box.empty() */ void intersect( @@ -711,6 +834,11 @@ class Box * @brief check if boxes intersect. * * Returns true if two boxes have a non-empty intersection. + * + * @param box + * + * @pre getDim() == box.getDim() + * @pre (getBlockId() == box.getBlockId()) || empty() || box.empty() */ bool intersects( @@ -724,8 +852,12 @@ class Box * contains both boxes. * * If one box is empty and the other is non-empty, the non-empty box will - * be returned. If both boxes are non-empty and have different BlockIds, - * an assertion failure will occur. + * be returned. + * + * @param box + * + * @pre getDim() == box.getDim() + * @pre (getBlock_id() == box.getBlockId()) || empty() || box.empty() */ Box operator + ( @@ -739,8 +871,10 @@ class Box * * If the argument box is empty, this box will be unchanged. * - * If the two boxes are both non-empty and have different BlockIds, and - * assertion failure will occur. + * @param box + * + * @pre getDim() == box.getDim() + * @pre (getBlockId() == box.getBlockId()) || empty() || box.empty() */ Box& operator += ( @@ -749,13 +883,17 @@ class Box /*! * @brief Return true if this box can be coalesced with the argument box, * and set this box to the union of the boxes. - * + * * Otherwise, return false and leave boxes as is. Two boxes may be * coalesced if their union is a box (recall that index set union is not * closed over boxes). If one box is empty and the other is non-empty, then * the return value is true and this box becomes equal to the non-empty box. * If both boxes are empty, the return value is true and this box remains * empty. + * + * @param box + * + * @pre getDim() == box.getDim() */ bool coalesceWith( @@ -765,18 +903,31 @@ class Box * @brief Grow this box by the specified ghost cell width. * * The lower bound decremented by the width, and the upper bound is - * incremented by the width. All dimensions are grown by the corresponding + * incremented by the width. All directions are grown by the corresponding * component in the IntVector; ghost cell widths may be different in each - * dimension. Negative ghost cell widths will shrink the box. + * direction. Negative ghost cell widths will shrink the box. + * + * @param ghosts + * + * @pre getDim() == ghosts.getDim() */ void grow( const IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); if (!empty()) { - d_lo -= ghosts; - d_hi += ghosts; + if (ghosts.getNumBlocks() > 1) { + BlockId::block_t b = d_block_id.getBlockValue(); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_lo(i) -= ghosts(b,i); + d_hi(i) += ghosts(b,i); + } + } else { + d_lo -= ghosts; + d_hi += ghosts; + } + d_empty_flag = boost::logic::indeterminate; } } @@ -787,74 +938,102 @@ class Box * The lower bound is decremented by the width, and the upper bound is * incremented by the width. Note that negative ghost cell widths * will shrink the box. + * + * @param direction + * @param ghosts + * + * @pre (direction < getDim().getValue()) */ void grow( - const int direction, + const dir_t direction, const int ghosts) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); if (!empty()) { d_lo(direction) -= ghosts; d_hi(direction) += ghosts; + d_empty_flag = boost::logic::indeterminate; } } /*! * @brief Similar to grow() functions. However, box is only grown in lower * directions (i.e., only lower index is changed). + * + * @param ghosts + * + * @pre getDim() == ghosts.getDim() */ void growLower( const IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); if (!empty()) { d_lo -= ghosts; + d_empty_flag = boost::logic::indeterminate; } } /*! * @brief Similar to grow() functions. However, box is only grown in lower * bound of given direction in index space. + * + * @param direction + * @param ghosts + * + * @pre (direction < getDim().getValue()) */ void growLower( - const int direction, + const dir_t direction, const int ghosts) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); if (!empty()) { d_lo(direction) -= ghosts; + d_empty_flag = boost::logic::indeterminate; } } /*! * @brief Similar to grow() function. However, box is only grown in upper * directions (i.e., only upper index is changed). + * + * @param ghosts + * + * @pre getDim() == ghosts.getDim() */ void growUpper( const IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); if (!empty()) { d_hi += ghosts; + d_empty_flag = boost::logic::indeterminate; } } /*! * @brief Similar to grow() functions. However, box is only grown in upper * bound of given direction in index space. + * + * @param direction + * @param ghosts + * + * @pre (direction < getDim().getValue()) */ void growUpper( - const int direction, + const dir_t direction, const int ghosts) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); if (!empty()) { d_hi(direction) += ghosts; + d_empty_flag = boost::logic::indeterminate; } } @@ -864,10 +1043,15 @@ class Box * * The sign of @c ghosts refer to whether the box is lengthened in * the upper or lower side. + * + * @param direction + * @param ghosts + * + * @pre (direction < getDim().getValue()) */ void lengthen( - const int direction, + const dir_t direction, const int ghosts); /*! @@ -876,22 +1060,31 @@ class Box * * The sign of @c ghosts refer to whether the box is shortened in * the upper or lower side. + * + * @param direction + * @param ghosts + * + * @pre (direction < getDim().getValue()) */ void shorten( - const int direction, + const dir_t direction, const int ghosts); /*! * @brief Shift this box by the specified offset. * * The box will be located at (lower+offset, upper+offset). + * + * @param offset + * + * @pre getDim() == offset.getDim() */ void shift( const IntVector& offset) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, offset); d_lo += offset; d_hi += offset; } @@ -901,19 +1094,29 @@ class Box * specified direction in index space. * * The box will located at (lower+offset, upper+offset) in that direction. + * + * @param direction + * @param offset + * + * @pre (direction < getDim().getValue()) */ void shift( - const int direction, + const dir_t direction, const int offset) { - TBOX_ASSERT((direction >= 0) && (direction < getDim().getValue())); + TBOX_ASSERT((direction < getDim().getValue())); d_lo(direction) += offset; d_hi(direction) += offset; } /*! - * Rotate 90 degrees around origin. + * @brief Rotate 90 degrees around origin. + * + * @param rotation_ident + * + * @pre (getDim().getValue() == 1) || (getDim().getValue() == 2) || + * (getDim().getValue() == 3) */ void rotate( @@ -924,6 +1127,10 @@ class Box * * Each component of the box is multiplied by the refinement ratio, * then @c (ratio-1) is added to the upper corner. + * + * @param ratio + * + * @pre getDim() == ratio.getDim() */ void refine( @@ -937,26 +1144,43 @@ class Box * are the parents of the refined box. In other words, refining a * coarsened box will always yield a box that is equal to or larger * than the original box. + * + * @param ratio + * + * @pre getDim() == ratio.getDim() */ void coarsen( const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio); - for (int i = 0; i < getDim().getValue(); i++) { - d_lo(i) = coarsen(d_lo(i), ratio(i)); - d_hi(i) = coarsen(d_hi(i), ratio(i)); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio); + if (ratio.getNumBlocks() > 1) { + BlockId::block_t b = d_block_id.getBlockValue(); + for (dir_t i = 0; i < getDim().getValue(); ++i) { + d_lo(i) = coarsen(d_lo(i), ratio(b,i)); + d_hi(i) = coarsen(d_hi(i), ratio(b,i)); + } + } else { + for (dir_t i = 0; i < getDim().getValue(); ++i) { + d_lo(i) = coarsen(d_lo(i), ratio(i)); + d_hi(i) = coarsen(d_hi(i), ratio(i)); + } } + } /*! * @brief This assignment operator constructs a Box given a DatabaseBox. + * + * @param box + * + * @pre getDim().getValue() == box.getDimVal() */ Box& operator = ( const tbox::DatabaseBox& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT(getDim().getValue() == box.getDimVal()); #ifdef BOX_TELEMETRY // Increment the cumulative assigned count only. ++s_cumulative_assigned_ct; @@ -1008,13 +1232,18 @@ class Box /*! * @brief Static function to grow a box by the specified vector ghost cell * width. + * + * @param box + * @param ghosts + * + * @pre box.getDim() == ghosts.getDim() */ static Box grow( const Box& box, const IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); Box tmp = box; tmp.grow(ghosts); return tmp; @@ -1022,26 +1251,36 @@ class Box /*! * @brief Static function to shift a box by the specified offset. + * + * @param box + * @param offset + * + * @pre box.getDim() == offset.getDim() */ static Box shift( const Box& box, const IntVector& offset) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, offset); return Box(box.lower() + offset, box.upper() + offset, box.d_block_id); } /*! * @brief Static function to refine the index space of a box by the * specified refinement ratio. + * + * @param box + * @param ratio + * + * @pre box.getDim() == ratio.getDim() */ static Box refine( const Box& box, const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ratio); Box tmp = box; tmp.refine(ratio); return tmp; @@ -1050,13 +1289,18 @@ class Box /*! * @brief Static function to coarsen the index space of a box by the * specified coarsening ratio. + * + * @param box + * @param ratio + * + * @pre box.getDim() == ratio.getDim() */ static Box coarsen( const Box& box, const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ratio); Box tmp = box; tmp.coarsen(ratio); return tmp; @@ -1081,6 +1325,15 @@ class Box d_id_locked = true; } + /*! + * @brief Returns true if the BoxId of this Box is locked. + */ + bool + idLocked() const + { + return d_id_locked; + } + /*! * @brief Read the box description in the form [L,U], where L and U are the * lower and upper bounds of the box. @@ -1108,7 +1361,6 @@ class Box getEmptyBox( const tbox::Dimension& dim) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); return *(s_emptys[dim.getValue() - 1]); } @@ -1120,20 +1372,10 @@ class Box getUniverse( const tbox::Dimension& dim) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); return *(s_universes[dim.getValue() - 1]); } - /** - * A box iterator iterates over the elements of a box. This class is - * defined elsewhere, and the typedef is used to point to that class. - */ - typedef BoxIterator iterator; - - template - friend class pdat::ArrayData; friend class BoxIterator; - friend class std::vector; #ifdef BOX_TELEMETRY // These are to optionally track the cumulative number of Boxes constructed, @@ -1150,9 +1392,7 @@ class Box private: /** - * The default constructor creates an uninitialized box. - * - * This should never be invoked, it will cause assertions + * Unimplemented default constructor. */ Box(); @@ -1174,10 +1414,9 @@ class Box void rotateAboutAxis( - const int axis, + const dir_t axis, const int num_rotations); - /*! * @brief Initialize static objects and register shutdown routine. * @@ -1199,6 +1438,7 @@ class Box BlockId d_block_id; BoxId d_id; bool d_id_locked; + mutable boost::tribool d_empty_flag; /* * Array of empty boxes for each dimension. Preallocated @@ -1206,13 +1446,13 @@ class Box * them in multiple places. */ - static Box* s_emptys[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static Box* s_emptys[SAMRAI::MAX_DIM_VAL]; /* * Box that represents the maximum allowed index extents, * the "universe" that can be represented. */ - static Box* s_universes[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static Box* s_universes[SAMRAI::MAX_DIM_VAL]; static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; @@ -1226,8 +1466,8 @@ class Box * \verbatim * Box box; * ... - * Box::iterator bend(box, false); - * for (Box::iterator b(box, true); b != bend; ++b) { + * Box::iterator bend(box.end()); + * for (Box::iterator b(box.begin()); b != bend; ++b) { * // use index b of the box * } * \endverbatim @@ -1235,21 +1475,16 @@ class Box * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see hier::Index - * @see hier::Box + * @see Index + * @see Box */ class BoxIterator { -public: - /** - * Constructor for the box iterator. The iterator will enumerate the - * indices in the argument box. - */ - explicit BoxIterator( - const Box& box, - bool begin); + friend class Box; +public: + typedef tbox::Dimension::dir_t dir_t; /** * Copy constructor for the box iterator. */ @@ -1287,7 +1522,7 @@ class BoxIterator * Return a pointer to the current index in the box. This operation is * undefined if the iterator is past the last Index in the box. */ - const Index* + const Index * operator -> () const { return &d_index; @@ -1301,11 +1536,11 @@ class BoxIterator int) { BoxIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < (d_index.getDim().getValue() - 1); i++) { + ++d_index(0); + for (dir_t i = 0; i < (d_index.getDim().getValue() - 1); ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else break; } @@ -1318,11 +1553,11 @@ class BoxIterator BoxIterator& operator ++ () { - d_index(0)++; - for (int i = 0; i < (d_index.getDim().getValue() - 1); i++) { + ++d_index(0); + for (dir_t i = 0; i < (d_index.getDim().getValue() - 1); ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else break; } @@ -1350,6 +1585,14 @@ class BoxIterator } private: + /** + * Constructor for the box iterator. The iterator will enumerate the + * indices in the argument box. + */ + BoxIterator( + const Box& box, + bool begin); + /* * Unimplemented default constructor. */ @@ -1364,5 +1607,4 @@ class BoxIterator } } - #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.C index 3d1766af..a4319336 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A container of boxes with basic domain calculus operations * ************************************************************************/ - -#ifndef included_hier_BoxContainer_C -#define included_hier_BoxContainer_C - #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxContainerSingleBlockIterator.h" @@ -32,20 +28,19 @@ namespace hier { const int BoxContainer::HIER_BOX_CONTAINER_VERSION = 0; - /* ************************************************************************* * Constructors and destructor ************************************************************************* */ -BoxContainer::BoxContainer() : +BoxContainer::BoxContainer(): d_ordered(false) { } BoxContainer::BoxContainer( - const bool ordered) : + const bool ordered): d_ordered(ordered) { } @@ -64,13 +59,13 @@ BoxContainer::BoxContainer( BoxContainer::BoxContainer( const BoxContainer& other): d_list(other.d_list), - d_ordered(false) + d_ordered(false) { if (other.d_ordered) { order(); } if (other.d_tree) { - makeTree(); + makeTree(other.d_tree->getGridGeometry()); } } @@ -87,8 +82,8 @@ BoxContainer::BoxContainer( { BoxContainerSingleBlockIterator itr(other.begin(block_id)); while (itr != other.end(block_id)) { - const Box& mapped_box = *itr; - pushBack(mapped_box); + const Box& box = *itr; + pushBack(box); ++itr; } if (other.d_ordered) { @@ -123,16 +118,16 @@ BoxContainer::BoxContainer( ************************************************************************* * * Construct from DatabaseBox array. - * + * ************************************************************************* */ BoxContainer::BoxContainer( - const tbox::Array& other): + const std::vector& other): d_ordered(false) { - const int n = other.size(); - for (int j = 0; j < n; j++) { + const int n = static_cast(other.size()); + for (int j = 0; j < n; ++j) { pushBack(Box(other[j])); } } @@ -145,7 +140,7 @@ BoxContainer::~BoxContainer() ************************************************************************* * * Assignment. - * + * ************************************************************************* */ @@ -156,7 +151,7 @@ BoxContainer::operator = ( if (this != &rhs) { clear(); d_list = rhs.d_list; - if (rhs.d_ordered) { + if (rhs.d_ordered) { order(); } else { d_ordered = false; @@ -167,12 +162,12 @@ BoxContainer::operator = ( BoxContainer& BoxContainer::operator = ( - const tbox::Array& rhs) + const std::vector& rhs) { clear(); - const int n = rhs.size(); - for (int j = 0; j < n; j++) { + const int n = static_cast(rhs.size()); + for (int j = 0; j < n; ++j) { pushBack(Box(rhs[j])); } d_ordered = false; @@ -190,21 +185,55 @@ bool BoxContainer::operator == ( const BoxContainer& rhs) const { - bool isEqual = (d_ordered && rhs.d_ordered); - if (isEqual) { - isEqual = size() == rhs.size(); + bool is_equal = (d_ordered == rhs.d_ordered); + if (is_equal) { + if (!d_ordered) { + is_equal = isSpatiallyEqual(rhs); + } else { + is_equal = isIdEqual(rhs); + if (is_equal) { + is_equal = isSpatiallyEqual(rhs); + } + } } - if (isEqual) { - if (!d_ordered) { - isEqual = std::equal(d_list.begin(), d_list.end(), - rhs.d_list.begin(), Box::box_equality()); + + return is_equal; +} + +bool +BoxContainer::isIdEqual( + const BoxContainer& other) const +{ + if (!d_ordered || !other.d_ordered) { + TBOX_ERROR("isIdEqual called on unordered container." << std::endl); + } + + bool is_equal = (size() == other.size()); + if (is_equal) { + is_equal = std::equal(d_set.begin(), d_set.end(), + other.d_set.begin(), Box::id_equal()); + } + + return is_equal; +} + +bool +BoxContainer::isSpatiallyEqual( + const BoxContainer& other) const +{ + + bool is_equal = (size() == other.size()); + if (is_equal) { + if (d_ordered && other.d_ordered) { + is_equal = std::equal(d_set.begin(), d_set.end(), + other.d_set.begin(), Box::box_equality()); } else { - isEqual = std::equal(d_set.begin(), d_set.end(), - rhs.d_set.begin(), Box::id_equal()); + is_equal = std::equal(d_list.begin(), d_list.end(), + other.d_list.begin(), Box::box_equality()); } } - return isEqual; + return is_equal; } /* @@ -220,20 +249,21 @@ BoxContainer::insert( iterator position, const Box& box) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(box.getId().isValid()); + TBOX_ASSERT(box.getBoxId().isValid()); TBOX_ASSERT(box.getBlockId() != BlockId::invalidId()); - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), box); +#ifdef DEBUG_CHECK_ASSERTIONS + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), box); } #endif - if (!d_ordered && size() == 0) { + if (!d_ordered && empty()) { order(); + position.d_set_iter = d_set.begin(); } if (!d_ordered) { - TBOX_ERROR("insert attempted on unordered container."); + TBOX_ERROR("insert attempted on unordered container." << std::endl); } if (d_tree) { @@ -260,19 +290,20 @@ bool BoxContainer::insert( const Box& box) { + TBOX_ASSERT(box.getBoxId().isValid()); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(box.getId().isValid()); - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), box); + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), box); } #endif - if (!d_ordered && size() == 0) { + if (!d_ordered && empty()) { order(); } if (!d_ordered) { - TBOX_ERROR("BoxContainer::insert called on unordered BoxContainer."); + TBOX_ERROR("BoxContainer::insert called on unordered BoxContainer." + << std::endl); } if (d_tree) { @@ -280,7 +311,7 @@ BoxContainer::insert( } const std::list::iterator& iter = d_list.insert(d_list.end(), box); - Box* box_ptr(&(*iter)); + Box * box_ptr(&(*iter)); if (d_set.insert(box_ptr).second) { box_ptr->lockId(); return true; @@ -300,30 +331,30 @@ BoxContainer::insert( */ void -BoxContainer::insert ( +BoxContainer::insert( const_iterator first, - const_iterator last ) + const_iterator last) { - if (!d_ordered && size() == 0) { + if (!d_ordered && empty()) { order(); } if (!d_ordered) { - TBOX_ERROR("insert attempted on unordered container."); + TBOX_ERROR("insert attempted on unordered container." << std::endl); } if (d_tree) { d_tree.reset(); } - for (std::set::const_iterator set_iter = first.d_set_iter; + for (std::set::const_iterator set_iter = first.d_set_iter; set_iter != last.d_set_iter; ++set_iter) { + TBOX_ASSERT((**set_iter).getBoxId().isValid()); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT((**set_iter).getId().isValid()); - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), **set_iter); + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), **set_iter); } #endif @@ -346,20 +377,20 @@ BoxContainer::insert ( * coalesces regions together where possible. * * The canonical ordering for boxes is defined such that boxes which - * lie next to each other in higher dimensions are coalesced together - * before boxes which lie next to each other in lower dimensions. + * lie next to each other in higher directions are coalesced together + * before boxes which lie next to each other in lower directions. * Thus, we try to coalesce two boxes together on the higher - * dimensions first. + * directions first. * * Assuming that two boxes a and b of dimension DIM are in canonical - * order for dimensions d+1, ..., D, we can coalesce them together on - * dimension d if: + * order for directions d+1, ..., D, we can coalesce them together on + * direction d if: * * (1) the lower and upper bounds for a and b agree for all - * dimensions greater than d + * directions greater than d * (2) boxes a and b overlap or are next to each other in - * dimension d - * (3) boxes a and b overlap for all dimensions less than d + * direction d + * (3) boxes a and b overlap for all directions less than d * * If these conditions hold, then we break up the two boxes and put * them into the container of non-canonical boxes. @@ -370,11 +401,11 @@ void BoxContainer::simplify() { if (d_ordered) { - TBOX_ERROR("simplify called on ordered BoxContainer."); + TBOX_ERROR("simplify called on ordered BoxContainer." << std::endl); } #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0) { + if (!empty()) { const BlockId& front_block_id = front().getBlockId(); for (const_iterator itr = begin(); itr != end(); ++itr) { TBOX_ASSERT(itr->getBlockId() == front_block_id); @@ -386,16 +417,16 @@ BoxContainer::simplify() d_tree.reset(); } - // Start coalescing on the highest dimension of the containers and work down + // Start coalescing on the highest direction of the containers and work down // While there are non-canonical boxes, pick somebody out of the container. - if (!isEmpty()) { + if (!empty()) { const tbox::Dimension dim(d_list.front().getDim()); BoxContainer notCanonical; - for (int d = dim.getValue() - 1; d >= 0; d--) { + for (int d = dim.getValue() - 1; d >= 0; --d) { notCanonical.spliceBack(*this); - while (!notCanonical.isEmpty()) { + while (!notCanonical.empty()) { Box tryMe = notCanonical.front(); notCanonical.popFront(); @@ -404,7 +435,7 @@ BoxContainer::simplify() if (!tryMe.empty()) { bool combineDaPuppies = false; - iterator l(*this); + iterator l = begin(); for ( ; l != end(); ++l) { const Box andMe = *l; @@ -414,7 +445,7 @@ BoxContainer::simplify() const Index& bh = tryMe.upper(); combineDaPuppies = true; - for (int du = d + 1; du < dim.getValue(); du++) { + for (int du = d + 1; du < dim.getValue(); ++du) { if ((al(du) != bl(du)) || (ah(du) != bh(du))) { combineDaPuppies = false; break; @@ -424,7 +455,7 @@ BoxContainer::simplify() if ((bl(d) > ah(d) + 1) || (bh(d) < al(d) - 1)) { combineDaPuppies = false; } else { - for (int dl = 0; dl < d; dl++) { + for (int dl = 0; dl < d; ++dl) { if ((bl(dl) > ah(dl)) || (bh(dl) < al(dl))) { combineDaPuppies = false; break; @@ -450,7 +481,7 @@ BoxContainer::simplify() const Index& bh = tryMe.upper(); Index il = andMe.lower(); Index ih = andMe.upper(); - for (int dl = 0; dl < d; dl++) { + for (int dl = 0; dl < d; ++dl) { if (il(dl) < bl(dl)) { il(dl) = bl(dl); } @@ -497,7 +528,7 @@ void BoxContainer::coalesce() { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0) { + if (!empty()) { const BlockId& front_block_id = front().getBlockId(); for (const_iterator itr = begin(); itr != end(); ++itr) { TBOX_ASSERT(itr->getBlockId() == front_block_id); @@ -506,14 +537,14 @@ BoxContainer::coalesce() #endif if (d_ordered) { - TBOX_ERROR("coalesce called on ordered BoxContainer."); + TBOX_ERROR("coalesce called on ordered BoxContainer." << std::endl); } if (d_tree) { d_tree.reset(); } - iterator tb(*this); + iterator tb = begin(); while (tb != end()) { bool found_match = false; @@ -548,8 +579,9 @@ BoxContainer::coalesce() void BoxContainer::removePeriodicImageBoxes() { - if (!d_ordered && size() > 0) { - TBOX_ERROR("removePeriodicImages attempted on unordered container."); + if (!d_ordered && !empty()) { + TBOX_ERROR("removePeriodicImages attempted on unordered container." + << std::endl); } if (d_tree) { @@ -559,8 +591,7 @@ BoxContainer::removePeriodicImageBoxes() for (iterator na = begin(); na != end(); ) { if (na->isPeriodicImage()) { erase(na++); - } - else { + } else { ++na; } } @@ -573,28 +604,25 @@ BoxContainer::removePeriodicImageBoxes() */ void BoxContainer::separatePeriodicImages( - std::vector& real_mapped_box_vector, - std::vector& periodic_image_mapped_box_vector) const + std::vector& real_box_vector, + std::vector& periodic_image_box_vector, + const PeriodicShiftCatalog& shift_catalog) const { if (!d_ordered) { - TBOX_ERROR("separatePeriodicImages called on unordered BoxContainer."); + TBOX_ERROR("separatePeriodicImages called on unordered BoxContainer." + << std::endl); } - if (!isEmpty()) { - - const Box& first_element(*begin()); + if (!empty()) { + const PeriodicId zero_shift_number(shift_catalog.getZeroShiftNumber()); - const PeriodicId zero_shift_number(PeriodicShiftCatalog::getCatalog( - first_element.getDim())-> - getZeroShiftNumber()); - - real_mapped_box_vector.reserve(real_mapped_box_vector.size() + size()); + real_box_vector.reserve(real_box_vector.size() + size()); for (const_iterator ni = begin(); ni != end(); ++ni) { - const Box& mapped_box = *ni; - if (mapped_box.getPeriodicId() == zero_shift_number) { - real_mapped_box_vector.push_back(mapped_box); + const Box& box = *ni; + if (box.getPeriodicId() == zero_shift_number) { + real_box_vector.push_back(box); } else { - periodic_image_mapped_box_vector.push_back(mapped_box); + periodic_image_box_vector.push_back(box); } } } @@ -610,20 +638,20 @@ void BoxContainer::rotate( const Transformation::RotationIdentifier rotation_ident) { - if (!isEmpty()) { + if (!empty()) { - if (d_tree) { - d_tree.reset(); - } + if (d_tree) { + d_tree.reset(); + } const tbox::Dimension& dim = d_list.front().getDim(); const BlockId& block_id = d_list.front().getBlockId(); - if (dim.getValue() == 2 || dim.getValue() == 3) { - for (iterator i(*this); i != end(); ++i) { + if (dim.getValue() == 1 || dim.getValue() == 2 || dim.getValue() == 3) { + for (iterator i = begin(); i != end(); ++i) { if (i->getBlockId() != block_id) { TBOX_ERROR("BoxContainer::rotate() error ..." - << "\n Attempted to rotate BoxContainer having Boxes with" - << "\n differing BlockIds " << std::endl); + << "\n Attempted to rotate BoxContainer having Boxes with" + << "\n differing BlockIds " << std::endl); } else { i->rotate(rotation_ident); } @@ -632,12 +660,11 @@ BoxContainer::rotate( NULL_USE(rotation_ident); TBOX_ERROR("BoxContainer::rotate() error ..." - << "\n Rotation only implemented for 2D and 3D " << std::endl); + << "\n Rotation only implemented for 1D 2D and 3D " << std::endl); } } } - /* ************************************************************************* * @@ -648,71 +675,66 @@ BoxContainer::rotate( Box BoxContainer::getBoundingBox() const { - if (isEmpty()) { - TBOX_WARNING("Bounding box container is empty"); - const tbox::Dimension dim(tbox::Dimension::getInvalidDimension()); - Box empty(dim); - return empty; - } else { - const_iterator i = begin(); - Box bbox(*i); - const BlockId& block_id = bbox.getBlockId(); - ++i; - for ( ; i != end(); ++i) { - if (i->getBlockId() == block_id) { - bbox += *i; - } else { - TBOX_ERROR("Attempted to find bounding box for BoxContainer with boxes from different blocks"); - } + if (empty()) { + TBOX_ERROR("Bounding box container is empty" << std::endl); + } + const_iterator i = begin(); + Box bbox(*i); + const BlockId& block_id = bbox.getBlockId(); + ++i; + for ( ; i != end(); ++i) { + if (i->getBlockId() == block_id) { + bbox += *i; + } else { + TBOX_ERROR( + "Attempted to find bounding box for BoxContainer with boxes from different blocks" + << std::endl); } - return bbox; } + return bbox; } - Box BoxContainer::getBoundingBox( const BlockId& block_id) const { - if (isEmpty()) { - TBOX_WARNING("Bounding box container is empty"); - const tbox::Dimension dim(tbox::Dimension::getInvalidDimension()); - Box empty(dim); - return empty; - } else { - const tbox::Dimension& dim = d_list.front().getDim(); - Box bbox(dim); + if (empty()) { + TBOX_ERROR("Bounding box container is empty" << std::endl); + } - /* - * First find the first box with the given BlockId - */ - const_iterator i = begin(); - for ( ; i != end(); ++i) { - if (i->getBlockId() == block_id) { - bbox = *i; - break; - } + const tbox::Dimension& dim = d_list.front().getDim(); + Box bbox(dim); + + /* + * First find the first box with the given BlockId + */ + const_iterator i = begin(); + for ( ; i != end(); ++i) { + if (i->getBlockId() == block_id) { + bbox = *i; + break; } + } - /* - * If no boxes were found with the desired BlockId, then the returned - * box will be empty. - */ - if (i == end()) { - TBOX_WARNING("Container has no boxes with the given BlockId"); - } else { + /* + * If no boxes were found with the desired BlockId, then the returned + * box will be empty. + */ + if (i == end()) { + TBOX_WARNING("Container has no boxes with the given BlockId" + << std::endl); + } else { - ++i; + ++i; - for ( ; i != end(); ++i) { - if (i->getBlockId() == block_id) { - bbox += *i; - } + for ( ; i != end(); ++i) { + if (i->getBlockId() == block_id) { + bbox += *i; } } - - return bbox; } + + return bbox; } /* @@ -727,8 +749,8 @@ BoxContainer::boxesIntersect() const { bool intersections = false; - const_iterator tryMe(*this); - const_iterator whatAboutMe(*this); + const_iterator tryMe = begin(); + const_iterator whatAboutMe = begin(); ++whatAboutMe; while (!intersections && tryMe != end()) { while (!intersections && whatAboutMe != end()) { @@ -741,7 +763,9 @@ BoxContainer::boxesIntersect() const } ++tryMe; whatAboutMe = tryMe; - ++whatAboutMe; + if (whatAboutMe != end()) { + ++whatAboutMe; + } } return intersections; } @@ -757,12 +781,13 @@ void BoxContainer::removeIntersections( const Box& takeaway) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } if (d_tree) { @@ -770,7 +795,7 @@ BoxContainer::removeIntersections( } const unsigned short dim = takeaway.getDim().getValue(); - iterator insertion_pt(*this); + iterator insertion_pt = begin(); while (insertion_pt != end()) { Box& tryme = *insertion_pt; if (!tryme.intersects(takeaway)) { @@ -795,12 +820,13 @@ void BoxContainer::removeIntersections( const BoxContainer& takeaway) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } if (d_tree) { @@ -810,7 +836,8 @@ BoxContainer::removeIntersections( if (takeaway.d_tree) { removeIntersections(*(takeaway.d_tree)); } else { - for (const_iterator remove(takeaway); remove != takeaway.end(); ++remove) { + for (const_iterator remove = takeaway.begin(); + remove != takeaway.end(); ++remove) { const Box& byebye = *remove; removeIntersections(byebye); } @@ -831,50 +858,52 @@ BoxContainer::removeIntersections( const BoxContainer& takeaway, const bool include_singularity_block_neighbors) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } if (d_tree) { d_tree.reset(); } - if (takeaway.size() == 0) { + if (takeaway.empty()) { return; } if (!takeaway.d_tree) { - TBOX_ERROR("Multiblock removeIntersections called without makeTree."); + TBOX_ERROR("Multiblock removeIntersections called without makeTree." + << std::endl); } const BaseGridGeometry& grid_geometry(*takeaway.d_tree->getGridGeometry()); - std::vector overlap_mapped_boxes; - iterator itr(*this); + std::vector overlap_boxes; + iterator itr = begin(); while (itr != end()) { const Box& tryme = *itr; - takeaway.d_tree->findOverlapBoxes(overlap_mapped_boxes, + takeaway.d_tree->findOverlapBoxes(overlap_boxes, tryme, refinement_ratio, include_singularity_block_neighbors); - if (overlap_mapped_boxes.empty()) { + if (overlap_boxes.empty()) { ++itr; } else { iterator sublist_start = itr; iterator sublist_end = sublist_start; ++sublist_end; for (size_t i = 0; - i < overlap_mapped_boxes.size() && sublist_start != sublist_end; + i < overlap_boxes.size() && sublist_start != sublist_end; ++i) { iterator insertion_pt = sublist_start; const BlockId& overlap_box_block_id = - overlap_mapped_boxes[i]->getBlockId(); + overlap_boxes[i]->getBlockId(); if (overlap_box_block_id != sublist_start->getBlockId()) { - Box overlap_box = *overlap_mapped_boxes[i]; + Box overlap_box = *overlap_boxes[i]; grid_geometry.transformBox(overlap_box, refinement_ratio, sublist_start->getBlockId(), @@ -886,13 +915,13 @@ BoxContainer::removeIntersections( insertion_pt); } else { removeIntersectionsFromSublist( - *overlap_mapped_boxes[i], + *overlap_boxes[i], sublist_start, sublist_end, insertion_pt); } } - overlap_mapped_boxes.clear(); + overlap_boxes.clear(); itr = sublist_end; } } @@ -904,7 +933,8 @@ BoxContainer::removeIntersections( const Box& takeaway) { if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } /* @@ -914,7 +944,7 @@ BoxContainer::removeIntersections( * the intersection of box with takeaway. If the two boxes do not * intersect, simply add box to the box container (no intersection removed). */ - TBOX_ASSERT(isEmpty()); + TBOX_ASSERT(empty()); TBOX_ASSERT(box.getBlockId() == takeaway.getBlockId()); if (d_tree) { @@ -933,46 +963,46 @@ void BoxContainer::removeIntersections( const MultiblockBoxTree& takeaway) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } if (d_tree) { d_tree.reset(); } - std::vector overlap_mapped_boxes; - iterator itr(*this); + std::vector overlap_boxes; + iterator itr = begin(); while (itr != end()) { const Box& tryme = *itr; - takeaway.findOverlapBoxes(overlap_mapped_boxes, tryme); - if (overlap_mapped_boxes.empty()) { + takeaway.findOverlapBoxes(overlap_boxes, tryme); + if (overlap_boxes.empty()) { ++itr; } else { iterator sublist_start = itr; iterator sublist_end = sublist_start; ++sublist_end; for (size_t i = 0; - i < overlap_mapped_boxes.size() && sublist_start != sublist_end; + i < overlap_boxes.size() && sublist_start != sublist_end; ++i) { iterator insertion_pt = sublist_start; removeIntersectionsFromSublist( - *overlap_mapped_boxes[i], + *overlap_boxes[i], sublist_start, sublist_end, insertion_pt); } - overlap_mapped_boxes.clear(); + overlap_boxes.clear(); itr = sublist_end; } } } - void BoxContainer::removeIntersectionsFromSublist( const Box& takeaway, @@ -981,7 +1011,8 @@ BoxContainer::removeIntersectionsFromSublist( iterator& insertion_pt) { if (d_ordered) { - TBOX_ERROR("removeIntersections attempted on ordered container."); + TBOX_ERROR("removeIntersections attempted on ordered container." + << std::endl); } if (d_tree) { @@ -1019,19 +1050,20 @@ void BoxContainer::intersectBoxes( const Box& keep) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("intersectBoxes attempted on ordered container."); + TBOX_ERROR("intersectBoxes attempted on ordered container." + << std::endl); } if (d_tree) { d_tree.reset(); } - iterator i(*this); + iterator i = begin(); Box overlap(i->getDim()); while (i != end()) { Box& tryMe = *i; @@ -1051,12 +1083,13 @@ void BoxContainer::intersectBoxes( const BoxContainer& keep) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("intersectBoxes attempted on ordered container."); + TBOX_ERROR("intersectBoxes attempted on ordered container." + << std::endl); } if (d_tree) { @@ -1066,12 +1099,12 @@ BoxContainer::intersectBoxes( if (keep.d_tree) { intersectBoxes(*(keep.d_tree)); } else { - iterator insertion_pt(*this); + iterator insertion_pt = begin(); Box overlap(insertion_pt->getDim()); while (insertion_pt != end()) { iterator tmp = insertion_pt; const Box& tryme = *insertion_pt; - for (const_iterator i(keep); i != keep.end(); ++i) { + for (const_iterator i = keep.begin(); i != keep.end(); ++i) { tryme.intersect(*i, overlap); if (!overlap.empty()) { insertAfter(insertion_pt, overlap); @@ -1088,33 +1121,34 @@ void BoxContainer::intersectBoxes( const MultiblockBoxTree& keep) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("intersectBoxes attempted on ordered container."); + TBOX_ERROR("intersectBoxes attempted on ordered container." + << std::endl); } if (d_tree) { d_tree.reset(); } - std::vector overlap_mapped_boxes; + std::vector overlap_boxes; Box overlap(front().getDim()); - iterator itr(*this); + iterator itr = begin(); iterator insertion_pt = itr; while (itr != end()) { const Box& tryme = *itr; - keep.findOverlapBoxes(overlap_mapped_boxes, tryme); - for (size_t i = 0; i < overlap_mapped_boxes.size(); ++i) { - tryme.intersect(*overlap_mapped_boxes[i], overlap); + keep.findOverlapBoxes(overlap_boxes, tryme); + for (size_t i = 0; i < overlap_boxes.size(); ++i) { + tryme.intersect(*overlap_boxes[i], overlap); if (!overlap.empty()) { insertAfter(insertion_pt, overlap); ++insertion_pt; } } - overlap_mapped_boxes.clear(); + overlap_boxes.clear(); iterator tmp = itr; ++insertion_pt; itr = insertion_pt; @@ -1128,44 +1162,45 @@ BoxContainer::intersectBoxes( const BoxContainer& keep, const bool include_singularity_block_neighbors) { - if (isEmpty()) { + if (empty()) { return; } if (d_ordered) { - TBOX_ERROR("intersectBoxes attempted on ordered container."); + TBOX_ERROR("intersectBoxes attempted on ordered container." + << std::endl); } if (d_tree) { d_tree.reset(); } - if (keep.size() == 0) { + if (keep.empty()) { clear(); - return; + return; } if (!keep.d_tree) { - TBOX_ERROR("Multiblock intersectBoxes called without makeTree."); + TBOX_ERROR("Multiblock intersectBoxes called without makeTree." + << std::endl); } const BaseGridGeometry& grid_geometry(*keep.d_tree->getGridGeometry()); - std::vector overlap_mapped_boxes; + std::vector overlap_boxes; Box overlap(front().getDim()); - iterator itr(*this); + iterator itr = begin(); iterator insertion_pt = itr; while (itr != end()) { const Box& tryme = *itr; - keep.d_tree->findOverlapBoxes(overlap_mapped_boxes, + keep.d_tree->findOverlapBoxes(overlap_boxes, tryme, refinement_ratio, include_singularity_block_neighbors); - for (size_t i = 0; i < overlap_mapped_boxes.size(); ++i) { - const BlockId& overlap_box_block_id = - overlap_mapped_boxes[i]->getBlockId(); + for (size_t i = 0; i < overlap_boxes.size(); ++i) { + const BlockId& overlap_box_block_id = overlap_boxes[i]->getBlockId(); if (overlap_box_block_id != tryme.getBlockId()) { - Box overlap_box = *overlap_mapped_boxes[i]; + Box overlap_box = *overlap_boxes[i]; grid_geometry.transformBox(overlap_box, refinement_ratio, tryme.getBlockId(), @@ -1176,14 +1211,14 @@ BoxContainer::intersectBoxes( ++insertion_pt; } } else { - tryme.intersect(*overlap_mapped_boxes[i], overlap); + tryme.intersect(*overlap_boxes[i], overlap); if (!overlap.empty()) { insertAfter(insertion_pt, overlap); ++insertion_pt; } } } - overlap_mapped_boxes.clear(); + overlap_boxes.clear(); iterator tmp = itr; ++insertion_pt; itr = insertion_pt; @@ -1194,29 +1229,28 @@ BoxContainer::intersectBoxes( /* ************************************************************************* * - * Type conversion from a BoxContainer to an Array of - * tbox::DatabaseBoxes. + * Type conversion from a BoxContainer to a vector of tbox::DatabaseBoxes. * ************************************************************************* */ -BoxContainer::operator tbox::Array() const +BoxContainer::operator std::vector() const { - tbox::Array new_Array(size()); + std::vector new_vector(size()); int j = 0; for (const_iterator i = begin(); i != end(); ++i) { - new_Array[j++] = (tbox::DatabaseBox)(*i); + new_vector[j++] = (tbox::DatabaseBox)(*i); } - return new_Array; + return new_vector; } /* ************************************************************************* * * Break up box bursty against box solid and adds the pieces to - * container. The bursting is done on dimensions 0 through dimension-1, - * starting with lowest dimensions first to try to maintain the + * container. The bursting is done on directions 0 through dimension-1, + * starting with lowest directions first to try to maintain the * canonical representation for the bursted domains. * ************************************************************************* @@ -1227,7 +1261,7 @@ BoxContainer::burstBoxes( const Box& solid, const int dimension) { - TBOX_DIM_ASSERT_CHECK_ARGS2(bursty, solid); + TBOX_ASSERT_OBJDIM_EQUALITY2(bursty, solid); TBOX_ASSERT(dimension <= bursty.getDim().getValue()); // Set up the lower and upper bounds of the regions for ease of access @@ -1238,9 +1272,9 @@ BoxContainer::burstBoxes( const Index& solidh = solid.upper(); const BlockId& block_id = bursty.getBlockId(); - // Break bursty region against solid region along low dimensions first + // Break bursty region against solid region along low directions first - for (int d = 0; d < dimension; d++) { + for (int d = 0; d < dimension; ++d) { if (bursth(d) > solidh(d)) { Index newl = burstl; newl(d) = solidh(d) + 1; @@ -1261,8 +1295,8 @@ BoxContainer::burstBoxes( * * Break up box bursty against box solid and adds the pieces to * container starting at the location pointed to by the supplied - * iterator. The bursting is done on dimensions 0 through dimension-1, - * starting with lowest dimensions first to try to maintain the + * iterator. The bursting is done on directions 0 through dimension-1, + * starting with lowest directions first to try to maintain the * canonical representation for the bursted domains. * ************************************************************************* @@ -1271,11 +1305,11 @@ void BoxContainer::burstBoxes( const Box& bursty, const Box& solid, - const int dimension, + const int direction, iterator& insertion_pt) { - TBOX_DIM_ASSERT_CHECK_ARGS2(bursty, solid); - TBOX_ASSERT(dimension <= bursty.getDim().getValue()); + TBOX_ASSERT_OBJDIM_EQUALITY2(bursty, solid); + TBOX_ASSERT(direction <= bursty.getDim().getValue()); // Set up the lower and upper bounds of the regions for ease of access @@ -1285,9 +1319,9 @@ BoxContainer::burstBoxes( const Index& solidh = solid.upper(); const BlockId& block_id = bursty.getBlockId(); - // Break bursty region against solid region along low dimensions first + // Break bursty region against solid region along low directions first - for (int d = 0; d < dimension; d++) { + for (int d = 0; d < direction; ++d) { if (bursth(d) > solidh(d)) { Index newl = burstl; newl(d) = solidh(d) + 1; @@ -1323,11 +1357,12 @@ BoxContainer::getOwners( } else { for (const_iterator i_nabr = begin(); i_nabr != end(); ++i_nabr) { - if (i_nabr->getId().isValid()) { + if (i_nabr->getBoxId().isValid()) { const int owner = i_nabr->getOwnerRank(); owners.insert(owner); } else { - TBOX_ERROR("Attempted to get owner of Box with invalid BoxId."); + TBOX_ERROR("Attempted to get owner of Box with invalid BoxId." + << std::endl); } } } @@ -1340,29 +1375,29 @@ BoxContainer::getOwners( */ void BoxContainer::unshiftPeriodicImageBoxes( - BoxContainer& output_mapped_boxes, - const IntVector& refinement_ratio) const + BoxContainer& output_boxes, + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog) const { if (!d_ordered) { - TBOX_ERROR("unshiftPeriodicImageBoxes called on unordered container."); + TBOX_ERROR("unshiftPeriodicImageBoxes called on unordered container." + << std::endl); } - iterator hint = output_mapped_boxes.begin(); - - if (!isEmpty()) { - const Box& first_element(*begin()); + iterator hint = output_boxes.begin(); - const PeriodicId zero_shift_number(PeriodicShiftCatalog::getCatalog( - first_element.getDim())-> - getZeroShiftNumber()); + if (!empty()) { + const PeriodicId zero_shift_number(shift_catalog.getZeroShiftNumber()); for (const_iterator na = begin(); na != end(); ++na) { if (na->isPeriodicImage()) { - const Box unshifted_mapped_box( - *na, zero_shift_number, refinement_ratio); - hint = output_mapped_boxes.insert(hint, unshifted_mapped_box); + const Box unshifted_box(*na, + zero_shift_number, + refinement_ratio, + shift_catalog); + hint = output_boxes.insert(hint, unshifted_box); } else { - hint = output_mapped_boxes.insert(hint, *na); + hint = output_boxes.insert(hint, *na); } } } @@ -1378,12 +1413,14 @@ BoxContainer::order() { if (!d_ordered) { d_set.clear(); - for (iterator i(*this); i != end(); ++i) { - if (!i->getId().isValid()) { - TBOX_ERROR("Attempted to order a BoxContainer that has a member with an invalid BoxId."); + for (iterator i = begin(); i != end(); ++i) { + if (!i->getBoxId().isValid()) { + TBOX_ERROR("Attempted to order a BoxContainer that has a member with an invalid BoxId." + << std::endl); } if (d_set.insert(&(*i)).second == false) { - TBOX_ERROR("Attempted to order a BoxContainer with duplicate BoxIds."); + TBOX_ERROR("Attempted to order a BoxContainer with duplicate BoxIds." + << std::endl); } i->lockId(); } @@ -1423,7 +1460,7 @@ BoxContainer::erase( for (std::list::iterator bi = d_list.begin(); bi != d_list.end(); ++bi) { - if (bi->getId() == box.getId()) { + if (bi->getBoxId() == box.getBoxId()) { d_list.erase(bi); break; } @@ -1451,19 +1488,19 @@ BoxContainer::erase( } } - int BoxContainer::erase( const Box& box) { if (!d_ordered) { - TBOX_ERROR("erase with Box argument attempted on unordered BoxContainer."); + TBOX_ERROR("erase with Box argument attempted on unordered BoxContainer." + << std::endl); } - int ret = static_cast(d_set.erase(const_cast(&box))); + int ret = static_cast(d_set.erase(const_cast(&box))); for (std::list::iterator bi = d_list.begin(); bi != d_list.end(); ++bi) { - if (bi->getId() == box.getId()) { + if (bi->getBoxId() == box.getBoxId()) { d_list.erase(bi++); break; } @@ -1482,16 +1519,16 @@ BoxContainer::erase( ************************************************************************* */ -int +size_t BoxContainer::getTotalSizeOfBoxes() const { - int size = 0; + size_t size = 0; if (!d_ordered) { - for (const_iterator i(*this); i != end(); ++i) { + for (const_iterator i = begin(); i != end(); ++i) { size += i->size(); } } else { - for (const_iterator i(*this); i != end(); ++i) { + for (const_iterator i = begin(); i != end(); ++i) { size += i->size(); } } @@ -1503,10 +1540,9 @@ BoxContainer::contains( const Index& idx, const BlockId& block_id) const { - for (const_iterator i(*this); i != end(); ++i) { - //TODO: Change this when BoxContainer can no longer accept invalid BlockId - if (i->getBlockId() == block_id || - i->getBlockId() == BlockId::invalidId()) { + for (const_iterator i = begin(); i != end(); ++i) { + TBOX_ASSERT(i->getBlockId().isValid()); + if (i->getBlockId() == block_id) { if (i->contains(idx)) { return true; } @@ -1520,12 +1556,11 @@ BoxContainer::contains( * Spatial manipulation of Boxes ************************************************************************ */ - void BoxContainer::grow( const IntVector& ghosts) { - for (iterator i(*this); i != end(); ++i) { + for (iterator i = begin(); i != end(); ++i) { i->grow(ghosts); } @@ -1534,12 +1569,11 @@ BoxContainer::grow( } } - void BoxContainer::shift( const IntVector& offset) { - for (iterator i(*this); i != end(); ++i) { + for (iterator i = begin(); i != end(); ++i) { i->shift(offset); } if (d_tree) { @@ -1551,7 +1585,7 @@ void BoxContainer::refine( const IntVector& ratio) { - for (iterator i(*this); i != end(); ++i) { + for (iterator i = begin(); i != end(); ++i) { i->refine(ratio); } if (d_tree) { @@ -1563,7 +1597,7 @@ void BoxContainer::coarsen( const IntVector& ratio) { - for (iterator i(*this); i != end(); ++i) { + for (iterator i = begin(); i != end(); ++i) { i->coarsen(ratio); } if (d_tree) { @@ -1578,7 +1612,7 @@ BoxContainer::makeTree( { TBOX_ASSERT(min_number > 0); - if (!d_tree && size() > 0) { + if (!d_tree && !empty()) { d_tree.reset(new MultiblockBoxTree(*this, grid_geometry, min_number)); } } @@ -1599,21 +1633,20 @@ BoxContainer::hasBoxInBlock( } } - /* *********************************************************************** - * Write the BoxContainer to a database. + * Write the BoxContainer to a restart database. *********************************************************************** */ void -BoxContainer::putUnregisteredToDatabase( - const boost::shared_ptr& database) const +BoxContainer::putToRestart( + const boost::shared_ptr& restart_db) const { - database->putInteger( + restart_db->putInteger( "HIER_BOX_CONTAINER_VERSION", HIER_BOX_CONTAINER_VERSION); const int mbs_size = size(); - database->putInteger("mapped_box_set_size", mbs_size); + restart_db->putInteger("mapped_box_set_size", mbs_size); if (mbs_size > 0) { std::vector local_ids; @@ -1625,83 +1658,84 @@ BoxContainer::putUnregisteredToDatabase( block_ids.reserve(mbs_size); periodic_ids.reserve(mbs_size); - tbox::Array db_box_array(mbs_size); + std::vector db_box_array(mbs_size); int counter = -1; for (BoxContainer::const_iterator ni = begin(); ni != end(); ++ni) { local_ids.push_back(ni->getLocalId().getValue()); ranks.push_back(ni->getOwnerRank()); - block_ids.push_back(ni->getBlockId().getBlockValue()); + block_ids.push_back(static_cast(ni->getBlockId().getBlockValue())); periodic_ids.push_back(ni->getPeriodicId().getPeriodicValue()); db_box_array[++counter] = *ni; } - database->putIntegerArray("local_indices", &local_ids[0], mbs_size); - database->putIntegerArray("ranks", &ranks[0], mbs_size); - database->putIntegerArray("block_ids", &block_ids[0], mbs_size); - database->putIntegerArray("periodic_ids", &periodic_ids[0], mbs_size); - database->putDatabaseBoxArray("boxes", &db_box_array[0], mbs_size); + restart_db->putIntegerVector("local_indices", local_ids); + restart_db->putIntegerVector("ranks", ranks); + restart_db->putIntegerVector("block_ids", block_ids); + restart_db->putIntegerVector("periodic_ids", periodic_ids); + restart_db->putDatabaseBoxVector("boxes", db_box_array); } } - /* *********************************************************************** - * Read the BoxContainer from a database. + * Read the BoxContainer from a restart database. *********************************************************************** */ void -BoxContainer::getFromDatabase( - tbox::Database& database) +BoxContainer::getFromRestart( + tbox::Database& restart_db) { - const unsigned int mbs_size = database.getInteger("mapped_box_set_size"); + int version = restart_db.getInteger("HIER_BOX_CONTAINER_VERSION"); + if (version != HIER_BOX_CONTAINER_VERSION) { + TBOX_ERROR("BoxContainer::getFromRestart() error...\n" + << " Restart file version different than class version." + << std::endl); + } + + const unsigned int mbs_size = restart_db.getInteger("mapped_box_set_size"); if (mbs_size > 0) { - std::vector local_ids(mbs_size); - std::vector ranks(mbs_size); - std::vector block_ids(mbs_size); - std::vector periodic_ids(mbs_size); - tbox::Array db_box_array(mbs_size); - - database.getIntegerArray( - "local_indices", &local_ids[0], mbs_size); - database.getIntegerArray( - "ranks", &ranks[0], mbs_size); - database.getIntegerArray( - "block_ids", &block_ids[0], mbs_size); - database.getIntegerArray( - "periodic_ids", &periodic_ids[0], mbs_size); - database.getDatabaseBoxArray( - "boxes", &db_box_array[0], mbs_size); + std::vector local_ids = + restart_db.getIntegerVector("local_indices"); + std::vector ranks = + restart_db.getIntegerVector("ranks"); + std::vector block_ids = + restart_db.getIntegerVector("block_ids"); + std::vector periodic_ids = + restart_db.getIntegerVector("periodic_ids"); + + std::vector db_box_array = + restart_db.getDatabaseBoxVector("boxes"); for (unsigned int i = 0; i < mbs_size; ++i) { - Box box(db_box_array[i]); - box.setBlockId(BlockId(block_ids[i])); - Box mapped_box( - box, - LocalId(local_ids[i]), - ranks[i], - PeriodicId(periodic_ids[i])); - insert(end(), mapped_box); + Box array_box(db_box_array[i]); + array_box.setBlockId(BlockId(block_ids[i])); + BoxId box_id(LocalId(local_ids[i]), + ranks[i], + PeriodicId(periodic_ids[i])); + array_box.setId(box_id); + insert(end(), array_box); } } } - /* *********************************************************************** - * Prind contents of the BoxContainer + * Print contents of the BoxContainer *********************************************************************** */ void BoxContainer::print( - std::ostream& co) const + std::ostream& co, + const std::string& border) const { - co << size() << " boxes, " << (d_ordered?"ordered":"unordered") << '\n'; + co << size() << " boxes, " << (d_ordered ? "ordered" : "unordered") << '\n'; for (const_iterator bi = begin(); bi != end(); ++bi) { - Box box(*bi); - co << " " + const Box& box(*bi); + co << border << " " << box << " " - << box.numberCells() << '\n'; + << box.numberCells() << '|' + << box.size() << '\n'; } } @@ -1712,10 +1746,10 @@ BoxContainer::print( */ BoxContainer::Outputter::Outputter( - const BoxContainer& mapped_box_set, + const BoxContainer& boxes, const std::string& border, int detail_depth): - d_set(mapped_box_set), + d_set(boxes), d_border(border), d_detail_depth(detail_depth) { @@ -1732,11 +1766,10 @@ operator << ( std::ostream& s, const BoxContainer::Outputter& format) { - format.d_set.print(s); + format.d_set.print(s, format.d_border); return s; } - /* *********************************************************************** * Return a Outputter that can dump the BoxContainer to a stream. @@ -1779,7 +1812,7 @@ BoxContainer::findOverlapBoxes( void BoxContainer::findOverlapBoxes( - std::vector& box_vector, + std::vector& box_vector, const Box& box) const { if (d_tree) { @@ -1802,38 +1835,62 @@ BoxContainer::findOverlapBoxes( const IntVector& refinement_ratio, bool include_singularity_block_neighbors) const { - if (isEmpty()) { + if (empty()) { return; } if (!d_tree) { - TBOX_ERROR("Must call makeTree before calling findOverlapBoxes with refinement ratio argument."); + TBOX_ERROR( + "Must call makeTree before calling findOverlapBoxes with refinement ratio argument." + << std::endl); } d_tree->findOverlapBoxes(overlap_boxes, - box, - refinement_ratio, - include_singularity_block_neighbors); + box, + refinement_ratio, + include_singularity_block_neighbors); } +void +BoxContainer::findOverlapBoxes( + std::vector& overlap_boxes, + const Box& box, + const IntVector& refinement_ratio, + bool include_singularity_block_neighbors) const +{ + if (empty()) { + return; + } + + if (!d_tree) { + TBOX_ERROR( + "Must call makeTree before calling findOverlapBoxes with refinement ratio argument." + << std::endl); + } + + d_tree->findOverlapBoxes(overlap_boxes, + box, + refinement_ratio, + include_singularity_block_neighbors); +} bool BoxContainer::hasOverlap( const Box& box) const { if (d_tree) { - return (d_tree->hasOverlap(box)); + return d_tree->hasOverlap(box); } else { - bool ret_val = false; + bool ret_val = false; for (const_iterator ni = begin(); ni != end(); ++ni) { const Box& my_box = *ni; if (box.intersects(my_box)) { ret_val = true; break; - } + } } return ret_val; - } + } } BoxContainerSingleBlockIterator @@ -1882,17 +1939,20 @@ BoxContainer::BoxContainerIterator::BoxContainerIterator( d_list_iter(from_start ? container.d_list.begin() : container.d_list.end()), d_set_iter(from_start ? container.d_set.begin() : - container.d_set.end()), + container.d_set.end()), d_ordered(container.d_ordered) { } BoxContainer::BoxContainerIterator::BoxContainerIterator( - const BoxContainerIterator& other): - d_list_iter(other.d_list_iter), - d_set_iter(other.d_set_iter), - d_ordered(other.d_ordered) + const BoxContainerIterator& other) { + d_ordered = other.d_ordered; + if (d_ordered) { + d_set_iter = other.d_set_iter; + } else { + d_list_iter = other.d_list_iter; + } } BoxContainer::BoxContainerIterator::BoxContainerIterator(): @@ -1916,18 +1976,29 @@ BoxContainer::BoxContainerConstIterator::BoxContainerConstIterator( } BoxContainer::BoxContainerConstIterator::BoxContainerConstIterator( - const BoxContainerConstIterator& other): - d_list_iter(other.d_list_iter), - d_set_iter(other.d_set_iter), - d_ordered(other.d_ordered) + const BoxContainerConstIterator& other) { + d_ordered = other.d_ordered; + if (d_ordered) { + d_set_iter = other.d_set_iter; + } else { + d_list_iter = other.d_list_iter; + } } BoxContainer::BoxContainerConstIterator::BoxContainerConstIterator( - const BoxContainerIterator& other): - d_list_iter(other.d_list_iter), - d_set_iter(other.d_set_iter), - d_ordered(other.d_ordered) + const BoxContainerIterator& other) +{ + d_ordered = other.d_ordered; + if (d_ordered) { + d_set_iter = other.d_set_iter; + } else { + d_list_iter = other.d_list_iter; + } +} + +BoxContainer::BoxContainerConstIterator::BoxContainerConstIterator(): + d_ordered(false) { } @@ -1945,5 +2016,3 @@ BoxContainer::BoxContainerConstIterator::~BoxContainerConstIterator() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.h index d380a5c2..1fc9fc6a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A container of boxes with basic domain calculus operations * ************************************************************************/ @@ -16,13 +16,13 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/MultiblockBoxTree.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/tbox/Utilities.h" #include #include #include - +#include namespace SAMRAI { namespace hier { @@ -80,11 +80,10 @@ class RealBoxConstIterator; */ class BoxContainer { -friend class BoxContainerIterator; -friend class BoxContainerConstIterator; + friend class BoxContainerIterator; + friend class BoxContainerConstIterator; public: - class BoxContainerIterator; /*! @@ -103,21 +102,12 @@ friend class BoxContainerConstIterator; friend class BoxContainer; friend class BoxContainerIterator; - public: - - /*! - * @brief Constructor for the BoxContainerConstIterator. - * - * The iterator will point to the beginning or the end of the argument - * container, depending on the from_start argument - * - * @param[in] container The container whose members are iterated. - * @param[in] from_start true if iteration starts at beginning of - * container. - */ - explicit BoxContainerConstIterator( - const BoxContainer& container, - bool from_start = true); +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef const Box value_type; + typedef ptrdiff_t difference_type; + typedef const Box * pointer; + typedef const Box& reference; /*! * @brief Copy constructor. @@ -144,9 +134,12 @@ friend class BoxContainerConstIterator; const BoxContainerConstIterator& rhs) { if (this != &rhs) { - d_list_iter = rhs.d_list_iter; - d_set_iter = rhs.d_set_iter; d_ordered = rhs.d_ordered; + if (d_ordered) { + d_set_iter = rhs.d_set_iter; + } else { + d_list_iter = rhs.d_list_iter; + } } return *this; } @@ -172,7 +165,7 @@ friend class BoxContainerConstIterator; * * @return Const pointer to the current box. */ - const Box* + const Box * operator -> () const { return d_ordered ? *d_set_iter : &(*d_list_iter); @@ -262,7 +255,7 @@ friend class BoxContainerConstIterator; const BoxContainerConstIterator& other) const { return d_ordered ? d_set_iter == other.d_set_iter : - d_list_iter == other.d_list_iter; + d_list_iter == other.d_list_iter; } /*! @@ -277,15 +270,29 @@ friend class BoxContainerConstIterator; const BoxContainerConstIterator& other) const { return d_ordered ? d_set_iter != other.d_set_iter : - d_list_iter != other.d_list_iter; + d_list_iter != other.d_list_iter; } - private: - /* - * Default constructor just to be clear that there is none. +private: + /*! + * @brief Default constructor is defined but accessible only by friends. */ BoxContainerConstIterator(); + /*! + * @brief Constructor for the BoxContainerConstIterator. + * + * The iterator will point to the beginning or the end of the argument + * container, depending on the from_start argument + * + * @param[in] container The container whose members are iterated. + * @param[in] from_start true if iteration starts at beginning of + * container. + */ + explicit BoxContainerConstIterator( + const BoxContainer& container, + bool from_start = true); + /* * Underlying iterator to be used when unordered. */ @@ -294,7 +301,7 @@ friend class BoxContainerConstIterator; /* * Underlying iterator to be used when ordered. */ - std::set::const_iterator d_set_iter; + std::set::const_iterator d_set_iter; bool d_ordered; }; @@ -315,21 +322,12 @@ friend class BoxContainerConstIterator; friend class BoxContainer; friend class BoxContainerConstIterator; - public: - - /*! - * @brief Constructor for the BoxContainerIterator. - * - * The iterator will point to the beginning or the end of the argument - * container, depending on the from_start argument - * - * @param[in] container The container whose members are iterated. - * @param[in] from_start true if iteration starts at beginning of - * container. - */ - explicit BoxContainerIterator( - BoxContainer& container, - bool from_start = true); +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef Box value_type; + typedef ptrdiff_t difference_type; + typedef Box * pointer; + typedef Box& reference; /*! * @brief Copy constructor. @@ -349,9 +347,12 @@ friend class BoxContainerConstIterator; const BoxContainerIterator& rhs) { if (this != &rhs) { - d_list_iter = rhs.d_list_iter; - d_set_iter = rhs.d_set_iter; d_ordered = rhs.d_ordered; + if (d_ordered) { + d_set_iter = rhs.d_set_iter; + } else { + d_list_iter = rhs.d_list_iter; + } } return *this; } @@ -376,8 +377,8 @@ friend class BoxContainerConstIterator; * @brief Get pointer to box at iterator's position in container. * * @return Pointer to the current box. - */ - Box* + */ + Box * operator -> () const { return d_ordered ? *d_set_iter : &(*d_list_iter); @@ -389,7 +390,7 @@ friend class BoxContainerConstIterator; * @return Iterator at the position in the container before the * increment. */ - BoxContainerIterator + BoxContainerIterator operator ++ ( int) { @@ -438,7 +439,6 @@ friend class BoxContainerConstIterator; return return_iter; } - /*! * @brief Pre-decrement iterator to point to next box in the container. * @@ -456,7 +456,6 @@ friend class BoxContainerConstIterator; return *this; } - /*! * @brief Equality operators * @@ -469,7 +468,7 @@ friend class BoxContainerConstIterator; const BoxContainerIterator& other) const { return d_ordered ? d_set_iter == other.d_set_iter : - d_list_iter == other.d_list_iter; + d_list_iter == other.d_list_iter; } bool @@ -477,7 +476,7 @@ friend class BoxContainerConstIterator; const BoxContainerConstIterator& other) const { return d_ordered ? d_set_iter == other.d_set_iter : - d_list_iter == other.d_list_iter; + d_list_iter == other.d_list_iter; } /*! @@ -492,7 +491,7 @@ friend class BoxContainerConstIterator; const BoxContainerIterator& other) const { return d_ordered ? d_set_iter != other.d_set_iter : - d_list_iter != other.d_list_iter; + d_list_iter != other.d_list_iter; } bool @@ -500,16 +499,29 @@ friend class BoxContainerConstIterator; const BoxContainerConstIterator& other) const { return d_ordered ? d_set_iter != other.d_set_iter : - d_list_iter != other.d_list_iter; + d_list_iter != other.d_list_iter; } - private: - +private: /*! * @brief Default constructor is defined but accessible only by friends. */ BoxContainerIterator(); + /*! + * @brief Constructor for the BoxContainerIterator. + * + * The iterator will point to the beginning or the end of the argument + * container, depending on the from_start argument + * + * @param[in] container The container whose members are iterated. + * @param[in] from_start true if iteration starts at beginning of + * container. + */ + explicit BoxContainerIterator( + BoxContainer& container, + bool from_start = true); + /* * Underlying iterator to be used when unordered. */ @@ -518,7 +530,7 @@ friend class BoxContainerConstIterator; /* * Underlying iterator to be used when ordered. */ - std::set::iterator d_set_iter; + std::set::iterator d_set_iter; bool d_ordered; @@ -592,7 +604,7 @@ friend class BoxContainerConstIterator; * @param[in] other */ explicit BoxContainer( - const tbox::Array& other); + const std::vector& other); /*! * @brief Constructor that copies only Boxes having the given BlockId @@ -631,7 +643,7 @@ friend class BoxContainerConstIterator; */ BoxContainer& operator = ( - const tbox::Array& rhs); + const std::vector& rhs); /*! * @brief The destructor releases all storage. @@ -658,12 +670,29 @@ friend class BoxContainerConstIterator; } /*! - * @brief Returns true if there are no boxes in the container + * @brief Returns true if there are no boxes in the container. + * + * Archaic syntax. Synonymous with empty(). Retained for backward + * compatibility. + * + * @see empty() + */ + DEPRECATED( + bool + isEmpty() const) + { + return empty(); + } + + /*! + * @brief Returns true if there are no boxes in the container. + * + * This version follows the naming standards used in STL. * * @return True if the container is empty. */ bool - isEmpty() const + empty() const { return d_list.empty(); } @@ -858,7 +887,7 @@ friend class BoxContainerConstIterator; bool other_set_created = other.d_ordered; other.d_ordered = d_ordered; d_ordered = other_set_created; - d_tree = other.d_tree; + d_tree.swap(other.d_tree); } /*! @@ -867,6 +896,8 @@ friend class BoxContainerConstIterator; * The rank of every member of this container is inserted into the set. * * @param[out] owners + * + * @pre isOrdered() || for each box in container has valid BoxId */ void getOwners( @@ -913,7 +944,7 @@ friend class BoxContainerConstIterator; * * @return Total number of indices of all boxes in the container. */ - int + size_t getTotalSizeOfBoxes() const; /*! @@ -925,6 +956,8 @@ friend class BoxContainerConstIterator; * * @param[in] idx * @param[in] block_id + * + * @pre each box in container must have a valid BlockId */ bool contains( @@ -934,8 +967,8 @@ friend class BoxContainerConstIterator; /*! * @brief Returns the bounding box for all the boxes in the container. * - * A run-time error will occur if Boxes in this container have different - * BlockIds. + * @pre !empty() + * @pre each Box in container has same BlockId */ Box getBoundingBox() const; @@ -943,6 +976,10 @@ friend class BoxContainerConstIterator; /*! * @brief Returns the bounding box for all the boxes in the container * having the given BlockId. + * + * @param[in] block_id + * + * @pre !empty() */ Box getBoundingBox( @@ -964,11 +1001,9 @@ friend class BoxContainerConstIterator; /*! * @brief Changes state of this container to ordered. * - * This can be called on an unordered container with the restriction that - * every member of the container must have a valid and unique BoxId. - * If this restriction is not met, then a run-time error will occur. - * * If called on a container that is already ordered, nothing changes. + * + * @pre each box in container must have valid and unique BoxId */ void order(); @@ -1003,20 +1038,23 @@ friend class BoxContainerConstIterator; * front() in an unordered container. * * @param[in] item + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() */ void pushFront( const Box& item) { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), item); + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), item); } #endif if (!d_ordered) { d_list.push_front(item); } else { - TBOX_ERROR("Attempted pushFront on an ordered BoxContainer"); + TBOX_ERROR("Attempted pushFront on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1030,26 +1068,49 @@ friend class BoxContainerConstIterator; * back() in an unordered container. * * @param[in] item + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() */ void pushBack( const Box& item) { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), item); + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), item); } #endif if (!d_ordered) { d_list.push_back(item); } else { - TBOX_ERROR("Attempted pushBack on an ordered BoxContainer"); + TBOX_ERROR("Attempted pushBack on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); } } + /*! + * @brief STL-named version of pushFront(). + */ + void + push_front( + const Box& item) + { + pushFront(item); + } + + /*! + * @brief STL-named version of pushBack(). + */ + void + push_back( + const Box& item) + { + pushBack(item); + } + /*! * @brief Add "item" to specific place in the container. * @@ -1058,6 +1119,9 @@ friend class BoxContainerConstIterator; * * @param[in] iter Location to add item before. * @param[in] item Box to add to container. + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() */ void insertBefore( @@ -1065,14 +1129,14 @@ friend class BoxContainerConstIterator; const Box& item) { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), item); + if (!empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), item); } #endif if (!d_ordered) { d_list.insert(iter.d_list_iter, item); } else { - TBOX_ERROR("Attempted insertBefore on an ordered BoxContainer"); + TBOX_ERROR("Attempted insertBefore on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1087,6 +1151,9 @@ friend class BoxContainerConstIterator; * * @param[in] iter Location to add item after. * @param[in] item Box to add to container. + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() */ void insertAfter( @@ -1102,7 +1169,7 @@ friend class BoxContainerConstIterator; insertBefore(tmp, item); } } else { - TBOX_ERROR("Attempted insertAfter called on ordered BoxContainer."); + TBOX_ERROR("Attempted insertAfter called on ordered BoxContainer." << std::endl); } if (d_tree) { d_tree.reset(); @@ -1115,20 +1182,25 @@ friend class BoxContainerConstIterator; * "boxes" will be empty following this operation. * * @param[in] boxes + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() + * + * @post boxes.empty() */ void spliceFront( BoxContainer& boxes) { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0 && boxes.size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), boxes.front()); + if (!empty() && !boxes.empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), boxes.front()); } #endif if (!d_ordered) { d_list.splice(begin().d_list_iter, boxes.d_list); } else { - TBOX_ERROR("Attempted spliceFront on an ordered BoxContainer"); + TBOX_ERROR("Attempted spliceFront on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1141,21 +1213,26 @@ friend class BoxContainerConstIterator; * "boxes" will be empty following this operation. * * @param[in] boxes + * + * @pre empty() || (front().getDim() == item.getDim()) + * @pre !isOrdered() + * + * @post boxes.empty() */ void spliceBack( BoxContainer& boxes) { #ifdef DEBUG_CHECK_ASSERTIONS - if (size() > 0 && boxes.size() > 0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(front(), boxes.front()); + if (!empty() && !boxes.empty()) { + TBOX_ASSERT_OBJDIM_EQUALITY2(front(), boxes.front()); } #endif if (!d_ordered) { boxes.spliceFront(*this); d_list.swap(boxes.d_list); } else { - TBOX_ERROR("Attempted spliceBack on an ordered BoxContainer"); + TBOX_ERROR("Attempted spliceBack on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1164,6 +1241,8 @@ friend class BoxContainerConstIterator; /*! * @brief Remove the first member of the unordered container. + * + * @pre !isOrdered() */ void popFront() @@ -1171,7 +1250,7 @@ friend class BoxContainerConstIterator; if (!d_ordered) { d_list.pop_front(); } else { - TBOX_ERROR("Attempted popFront on an ordered BoxContainer"); + TBOX_ERROR("Attempted popFront on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1180,6 +1259,8 @@ friend class BoxContainerConstIterator; /*! * @brief Remove the last member of the unordered container. + * + * @pre !isOrdered() */ void popBack() @@ -1187,7 +1268,7 @@ friend class BoxContainerConstIterator; if (!d_ordered) { d_list.pop_back(); } else { - TBOX_ERROR("Attempted popBack on an ordered BoxContainer"); + TBOX_ERROR("Attempted popBack on an ordered BoxContainer" << std::endl); } if (d_tree) { d_tree.reset(); @@ -1198,8 +1279,8 @@ friend class BoxContainerConstIterator; * @brief Place the boxes in the container into a canonical ordering. * * The canonical ordering for boxes is defined such that boxes that lie - * next to each other in higher dimensions are coalesced together before - * boxes that lie next to each other in lower dimensions. This ordering + * next to each other in higher directions are coalesced together before + * boxes that lie next to each other in lower directions. This ordering * provides a standard representation that can be used to compare box * containers. The canonical ordering also does not allow any overlap * between the boxes in the container. This routine is potentially @@ -1207,6 +1288,9 @@ friend class BoxContainerConstIterator; * of the domain calculus routines call simplify(); all calls to simplify * the boxes must be explicit. Note that this routine is distinct from * coalesce(), which is not guaranteed to produce a canonical ordering. + * + * @pre !isOrdered() + * @pre empty() || all Boxes in container have same BlockId */ void simplify(); @@ -1225,6 +1309,9 @@ friend class BoxContainerConstIterator; * the boxes in the order in which they appear in the container, rather * than attempting to coalesce boxes along specific coordinate directions * before others. + * + * @pre !isOrdered() + * @pre empty() || all Boxes in container have same BlockId */ void coalesce(); @@ -1235,6 +1322,9 @@ friend class BoxContainerConstIterator; * @note Works only in 2D or 3D. * * @param[in] rotation_ident + * + * @pre each Box in container has dim 2 or 3 + * @pre each Box in container has same BlockId */ void rotate( @@ -1250,6 +1340,8 @@ friend class BoxContainerConstIterator; * '^' indicates intersection. * * @param[in] takeaway What to exclude from each box in the container. + * + * @pre !isOrdered() */ void removeIntersections( @@ -1265,6 +1357,8 @@ friend class BoxContainerConstIterator; * BoxContainer have the same BlockId. An error will occur otherwise. * * @param[in] takeaway What to exclude from each box in the container. + * + * @pre !isOrdered() */ void removeIntersections( @@ -1277,7 +1371,7 @@ friend class BoxContainerConstIterator; * across block boundaries if needed. * * @param[in] refinement_ratio All boxes in this BoxContainer - * are assumed to exist in index space that has this refinement ratio + * are assumed to exist in index space that has this refinement ratio * relative to the coarse-level domain. * * @param[in] takeaway The boxes to take away from this BoxContainer. An @@ -1287,6 +1381,9 @@ friend class BoxContainerConstIterator; * @param[in] include_singularity_block_neighbors If true, intersections * with neighboring blocks that touch only across an enhanced connectivity * singularity will be removed. If false, those intersections are ignored. + * + * @pre !isOrdered() + * @pre takeaway.hasTree() */ void removeIntersections( @@ -1307,6 +1404,10 @@ friend class BoxContainerConstIterator; * * @param[in] box * @param[in] takeaway + * + * @pre !isOrdered() + * @pre empty() + * @pre box.getBlockId() == takeaway.getBlockId() */ void removeIntersections( @@ -1320,6 +1421,8 @@ friend class BoxContainerConstIterator; * container with \f$N\f$ boxes. The complement of removeIntersections. * * @param[in] keep + * + * @pre !isOrdered() */ void intersectBoxes( @@ -1333,10 +1436,12 @@ friend class BoxContainerConstIterator; * \f$O(N^2)\f$ time for containers with \f$N\f$ boxes. The complement * of removeIntersections. * - * This only works if all boxes in this BoxContainer and the keep + * This only works if all boxes in this BoxContainer and the keep * BoxContainer have the same BlockId. An error will occur otherwise. * * @param[in] keep + * + * @pre !isOrdered() */ void intersectBoxes( @@ -1349,7 +1454,7 @@ friend class BoxContainerConstIterator; * across block boundaries if needed. * * @param[in] refinement_ratio All boxes in this BoxContainer - * are assumed to exist in index space that has this refinement ratio + * are assumed to exist in index space that has this refinement ratio * relative to the coarse-level domain. * * @param[in] keep The boxes to intersect with this BoxContainer. An @@ -1359,6 +1464,9 @@ friend class BoxContainerConstIterator; * @param[in] include_singularity_block_neighbors If true, intersections * with neighboring blocks that touch only across an enhanced connectivity * singularity will be kept. If false, those intersections are ignored. + * + * @pre !isOrdered() + * @pre keep.hasTree() */ void intersectBoxes( @@ -1389,7 +1497,11 @@ friend class BoxContainerConstIterator; * same BoxId, false otherwise. * * @param[in] box Box to attempt to insert into the container. - */ + * + * @pre box.getBoxId().isValid() + * @pre empty() || (front().getDim() == box.getDim()) + * @pre empty() || isOrdered() + */ bool insert( const Box& box); @@ -1418,11 +1530,16 @@ friend class BoxContainerConstIterator; * * @param[in] position Location to begin searching for place to insert Box * @param[in] box Box to attempt to insert into the container + * + * @pre box.getBoxId().isValid() + * @pre box.getBlockId() != BlockId::invalidId() + * @pre empty() || (front().getDim() == box.getDim()) + * @pre empty() || isOrdered() */ iterator insert( iterator position, - const Box& box ); + const Box& box); /*! * @brief Insert all Boxes within a range. @@ -1433,13 +1550,17 @@ friend class BoxContainerConstIterator; * * @param[in] first * @param[in] last + * + * @pre empty() || isOrdered() + * @pre for each box in [first, last), box.getBoxId().isValid() && + * (empty || front().getDim() == box.getDim()) */ void insert( const_iterator first, - const_iterator last ); + const_iterator last); - //@} + //@} //@{ @name Methods that may only be called on an ordered container @@ -1454,17 +1575,19 @@ friend class BoxContainerConstIterator; * end() for this container is returned. * * @param[in] box Box serving as key for the find operation. Only - * its BoxId is compared to members of this container. - */ + * its BoxId is compared to members of this container. + * + * @pre isOrdered() + */ iterator find( const Box& box) const { if (!d_ordered) { - TBOX_ERROR("find attempted on unordered BoxContainer."); + TBOX_ERROR("find attempted on unordered BoxContainer." << std::endl); } iterator iter; - iter.d_set_iter = d_set.find(const_cast(&box)); + iter.d_set_iter = d_set.find(const_cast(&box)); iter.d_ordered = true; return iter; } @@ -1479,16 +1602,18 @@ friend class BoxContainerConstIterator; * the argument Box. * * @param[in] box Box serving as key for the lower bound search. + * + * @pre isOrdered() */ iterator lowerBound( const Box& box) const { if (!d_ordered) { - TBOX_ERROR("lowerBound attempted on unordered BoxContainer."); + TBOX_ERROR("lowerBound attempted on unordered BoxContainer." << std::endl); } iterator iter; - iter.d_set_iter = d_set.lower_bound(const_cast(&box)); + iter.d_set_iter = d_set.lower_bound(const_cast(&box)); iter.d_ordered = true; return iter; } @@ -1496,24 +1621,24 @@ friend class BoxContainerConstIterator; /*! * @brief Get upper bound iterator for a given Box. * - * This may only be called on an ordered container. - * * @return iterator pointing to the first member of this container * with a BoxId value greater than the BoxId of the argument * Box. Will return end() if there are no members with a greater * BoxId value. * * @param[in] box Box serving as key for the upper bound search. + * + * @pre isOrdered() */ iterator upperBound( const Box& box) const { if (!d_ordered) { - TBOX_ERROR("upperBound attempted on unordered BoxContainer."); + TBOX_ERROR("upperBound attempted on unordered BoxContainer." << std::endl); } iterator iter; - iter.d_set_iter = d_set.upper_bound(const_cast(&box)); + iter.d_set_iter = d_set.upper_bound(const_cast(&box)); iter.d_ordered = true; return iter; } @@ -1521,14 +1646,15 @@ friend class BoxContainerConstIterator; /*! * @brief Erase a Box from the container. * - * This may only be called on an ordered container. If a member of the - * container has the same BoxId as the argument Box, it will be erased - * from the container. If no such member is found, the container is - * unchanged. + * If a member of the container has the same BoxId as the argument Box, + * it will be erased from the container. If no such member is found, + * the container is unchanged. * * @return 1 if a Box is erased, 0 otherwise. * * @param[in] box Box serving as key to find a Box to be erased. + * + * @pre isOrdered() */ int erase( @@ -1545,17 +1671,24 @@ friend class BoxContainerConstIterator; * efficiency, the output containers are NOT cleared first, so users * may want to clear them before calling this method. * - * @param[out] real_mapped_box_vector - * @param[out] periodic_image_mapped_box_vector + * @param[out] real_box_vector + * @param[out] periodic_image_box_vector + * @param[in] shift_catalog PeriodicShiftCatalog object that maps the + * PeriodicId to a specific shift. + * + * @pre isOrdered() */ void separatePeriodicImages( - std::vector& real_mapped_box_vector, - std::vector& periodic_image_mapped_box_vector) const; + std::vector& real_box_vector, + std::vector& periodic_image_box_vector, + const PeriodicShiftCatalog& shift_catalog) const; /*! * @brief Any members of this container that are periodic images will * be erased. + * + * @pre empty() || isOrdered() */ void removePeriodicImageBoxes(); @@ -1571,23 +1704,34 @@ friend class BoxContainerConstIterator; * For flexibility and efficiency, the output container is NOT cleared * first, so users may want to clear it before calling this method. * - * @param[out] output_mapped_boxes + * @param[out] output_boxes * * @param[in] refinement_ratio Refinement ratio where the boxes live. + * + * @param[in] shift_catalog PeriodicShiftCatalog object that maps the + * PeriodicId to a specific shift. + * + * @pre isOrdered() */ void unshiftPeriodicImageBoxes( - BoxContainer& output_mapped_boxes, - const IntVector& refinement_ratio) const; + BoxContainer& output_boxes, + const IntVector& refinement_ratio, + const PeriodicShiftCatalog& shift_catalog) const; //@} /*! * @brief Equality operator * - * @return If ordered, return true if all BoxIds in this and rhs are - * identical. If unordered, return true if a Boxes in this - * and rhs are spatially equal. + * If the container is ordered, then this checks if all boxes have + * identical BoxIds and are spatially equal to the boxes in rhs. If + * unordered, then this checks only the spatial equality of the boxes. + * + * Addtionally to be considered equal, both containers must contain the + * same number of boxes and have the same ordered/unordered state. + * + * @return true only if the containers meet the equality conditions. * * @param[in] rhs */ @@ -1595,6 +1739,35 @@ friend class BoxContainerConstIterator; operator == ( const BoxContainer& rhs) const; + /*! + * @brief Check for equality of BoxIds in ordered containers. + * + * An error will occur if this operator is called with either BoxContainer + * in unordered state. + * + * @return true if both containers are the same size and the boxes + * have identical BoxIds. + * + * @param[in] other + * @pre isOrdered() && other.isOrdered() + * + */ + bool + isIdEqual( + const BoxContainer& other) const; + + /*! + * @brief Check for spatial equality of all boxes + * + * @return true if both containers are the same size and the boxes + * are spatially equal (same extents and same BlockId). + * + * @param[in] other + */ + bool + isSpatiallyEqual( + const BoxContainer& other) const; + /*! * @brief Inequality operator * @@ -1612,32 +1785,34 @@ friend class BoxContainerConstIterator; //@{ @name I/O /*! - * @brief Write the BoxContainer to a database. + * @brief Write the BoxContainer to a restart database. */ void - putUnregisteredToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! - * @brief Read the BoxContainer from a database. + * @brief Read the BoxContainer from a restart database. */ void - getFromDatabase( - tbox::Database& database); + getFromRestart( + tbox::Database& restart_db); /*! - * @brief Conversion from BoxContainer to tbox::Array. + * @brief Conversion from BoxContainer to std::vector. */ - operator tbox::Array() const; + operator std::vector() const; /*! * @brief Print each box in the container to the specified output stream. * * @param[in] os + * @param[in] border */ void print( - std::ostream& os = tbox::plog) const; + std::ostream& os = tbox::plog, + const std::string& border = std::string()) const; /*! * @brief Intermediary between BoxContainer and output streams, @@ -1660,11 +1835,11 @@ friend class BoxContainerConstIterator; * parameters needed to output the BoxContainer to a stream. */ Outputter( - const BoxContainer& mapped_box_set, + const BoxContainer& boxes, const std::string& border, - int detail_depth = 0); + int detail_depth = 2); - void + Outputter& operator = ( const Outputter& rhs); // Unimplemented private. @@ -1681,7 +1856,7 @@ friend class BoxContainerConstIterator; * * Usage example (printing with a tab indentation): * @verbatim - * cout << "my mapped_boxes:\n" << mapped_boxes.format("\t") << endl; + * cout << "my boxes:\n" << boxes.format("\t") << endl; * @endverbatim * * @param[in] border Left border of the output @@ -1691,7 +1866,7 @@ friend class BoxContainerConstIterator; Outputter format( const std::string& border = std::string(), - int detail_depth = 0) const; + int detail_depth = 2) const; //@} @@ -1726,14 +1901,20 @@ friend class BoxContainerConstIterator; * container is going to be used in any of the methods that handle * multiblock transformations. If this container is used only in a * single-block context, no BaseGridGeometry argument is necessary. - * + * + * @note The grid_geometry argument is required for multiblock. It must + * be the GridGeometry from which the Boxes stored in the container came + * from. + * * @param[in] grid_geometry To handle multiblock transformations if - * needed. - * @param[in] min_number An assertion failure will occur if not positive + * needed. + * @param[in] min_number + * + * @pre min_number > 0 */ void makeTree( - const BaseGridGeometry* grid_geometry = NULL, + const BaseGridGeometry* grid_geometry = 0, const int min_number = 10) const; /*! @@ -1742,7 +1923,7 @@ friend class BoxContainerConstIterator; bool hasTree() const { - return (d_tree.get() != 0); + return d_tree.get() != 0; } /*! @@ -1792,10 +1973,12 @@ friend class BoxContainerConstIterator; * @param[out] overlap_boxes * * @param[in] box + * + * @pre !hasTree() || (d_tree->getNumberBlocksInTree() == 1) */ void findOverlapBoxes( - std::vector& overlap_boxes, + std::vector& overlap_boxes, const Box& box) const; /*! @@ -1816,13 +1999,15 @@ friend class BoxContainerConstIterator; * @param[in] box * * @param[in] refinement_ratio All boxes in this BoxContainer - * are assumed to exist in index space that has this refinement ratio + * are assumed to exist in index space that has this refinement ratio * relative to the coarse-level domain. * * @param[in] include_singularity_block_neighbors If true, intersections * with neighboring blocks that touch only across an enhanced connectivity * singularity will be added to output. If false, those intersections are * ignored. + * + * @pre hasTree() */ void findOverlapBoxes( @@ -1831,6 +2016,13 @@ friend class BoxContainerConstIterator; const IntVector& refinement_ratio, bool include_singularity_block_neighbors = false) const; + void + findOverlapBoxes( + std::vector& overlap_boxes, + const Box& box, + const IntVector& refinement_ratio, + bool include_singularity_block_neighbors = false) const; + /*! * @brief Determine if a given box intersects with the BoxContainer. * @@ -1840,7 +2032,7 @@ friend class BoxContainerConstIterator; * * This only works if all boxes in this BoxContainer have the same BlockId, * and the argument box also has that same BlockId. An error will occur if - * these conditions are not met. + * these conditions are not met. * * @return True if box intersects with any member of the BoxContainer, * false otherwise. @@ -1852,7 +2044,6 @@ friend class BoxContainerConstIterator; const Box& box) const; private: - /* * Static integer constant describing class's version number. */ @@ -1867,6 +2058,8 @@ friend class BoxContainerConstIterator; * this operation computes b-(b^t) where '^' indicates intersection. * * @param[in] takeaway What to exclude from each box in the container. + * + * @pre !isOrdered() */ void removeIntersections( @@ -1880,6 +2073,8 @@ friend class BoxContainerConstIterator; * removeIntersections. * * @param[in] keep + * + * @pre !isOrdered() */ void intersectBoxes( @@ -1888,38 +2083,44 @@ friend class BoxContainerConstIterator; /*! * @brief Break up bursty against solid and adds the pieces to container. * - * The bursting is done on dimensions 0 through dimension-1, starting - * with lowest dimensions first to try to maintain the canonical + * The bursting is done on directions 0 through dimension-1, starting + * with lowest directions first to try to maintain the canonical * representation for the bursted domains. * * @param[in] bursty * @param[in] solid - * @param[in] dimension + * @param[in] direction + * + * @pre bursty.getDim() == solid.getDim() + * @pre dimension <= bursty.getDim().getValue() */ void burstBoxes( const Box& bursty, const Box& solid, - const int dimension); + const int direction); /*! * @brief Break up bursty against solid and adds the pieces to container * starting at location pointed to by itr. * - * The bursting is done on dimensions 0 through dimension-1, starting - * with lowest dimensions first to try to maintain the canonical + * The bursting is done on directions 0 through dimension-1, starting + * with lowest directions first to try to maintain the canonical * representation for the bursted domains. * * @param[in] bursty * @param[in] solid - * @param[in] dimension + * @param[in] direction * @param[in] itr + * + * @pre bursty.getDim() == solid.getDim() + * @pre dimension <= bursty.getDim().getValue() */ void burstBoxes( const Box& bursty, const Box& solid, - const int dimension, + const int direction, iterator& itr); /*! @@ -1931,6 +2132,8 @@ friend class BoxContainerConstIterator; * @param[in] sublist_end * @param[in] insertion_pt Where to put new boxes created by this * operation. + * + * @pre !isOrdered() */ void removeIntersectionsFromSublist( @@ -1948,7 +2151,7 @@ friend class BoxContainerConstIterator; * Set of Box* used for ordered containers. Each Box* in the set * points to a member of d_list. */ - std::set d_set; + std::set d_set; bool d_ordered; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.C index a57740d9..499f183f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.C @@ -3,28 +3,25 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Special iterator for BoxContainer. * ************************************************************************/ -#ifndef included_hier_BoxContainerSingleBlockIterator_C -#define included_hier_BoxContainerSingleBlockIterator_C - #include "SAMRAI/hier/BoxContainerSingleBlockIterator.h" namespace SAMRAI { namespace hier { BoxContainerSingleBlockIterator::BoxContainerSingleBlockIterator( - const BoxContainer& mapped_boxes, + const BoxContainer& boxes, const BlockId& block_id, bool begin): - d_mapped_boxes(&mapped_boxes), + d_boxes(&boxes), d_block_id(block_id), - d_iter(begin ? d_mapped_boxes->begin() : d_mapped_boxes->end()) + d_iter(begin ? d_boxes->begin() : d_boxes->end()) { if (begin) { - while (d_iter != d_mapped_boxes->end() && + while (d_iter != d_boxes->end() && d_iter->getBlockId() != d_block_id) { ++d_iter; } @@ -33,7 +30,7 @@ BoxContainerSingleBlockIterator::BoxContainerSingleBlockIterator( BoxContainerSingleBlockIterator::~BoxContainerSingleBlockIterator() { - d_mapped_boxes = NULL; + d_boxes = 0; } /* @@ -47,7 +44,7 @@ BoxContainerSingleBlockIterator::operator ++ () { do { ++d_iter; - } while (d_iter != d_mapped_boxes->end() && + } while (d_iter != d_boxes->end() && d_iter->getBlockId() != d_block_id); return *this; } @@ -65,7 +62,7 @@ BoxContainerSingleBlockIterator::operator ++ ( BoxContainerSingleBlockIterator saved = *this; do { ++d_iter; - } while (d_iter != d_mapped_boxes->end() && + } while (d_iter != d_boxes->end() && d_iter->getBlockId() != d_block_id); return saved; } @@ -74,8 +71,8 @@ int BoxContainerSingleBlockIterator::count() const { int ct = 0; - BoxContainerSingleBlockIterator iter(d_mapped_boxes->begin(d_block_id)); - while (iter != d_mapped_boxes->end(d_block_id)) { + BoxContainerSingleBlockIterator iter(d_boxes->begin(d_block_id)); + while (iter != d_boxes->end(d_block_id)) { ++ct; ++iter; } @@ -84,4 +81,3 @@ BoxContainerSingleBlockIterator::count() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.h index 75cf1787..18fcc9d3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleBlockIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Special iterator for BoxContainer. * ************************************************************************/ @@ -29,7 +29,7 @@ namespace hier { */ class BoxContainerSingleBlockIterator { -friend class BoxContainer; + friend class BoxContainer; public: //! @brief Destructor @@ -42,7 +42,7 @@ friend class BoxContainer; operator = ( const BoxContainerSingleBlockIterator& r) { - d_mapped_boxes = r.d_mapped_boxes; + d_boxes = r.d_boxes; d_iter = r.d_iter; d_block_id = r.d_block_id; return *this; @@ -73,7 +73,7 @@ friend class BoxContainer; operator == ( const BoxContainerSingleBlockIterator& r) const { - return d_mapped_boxes == r.d_mapped_boxes && + return d_boxes == r.d_boxes && d_block_id == r.d_block_id && d_iter == r.d_iter; } @@ -85,7 +85,7 @@ friend class BoxContainer; operator != ( const BoxContainerSingleBlockIterator& r) const { - return d_mapped_boxes != r.d_mapped_boxes || + return d_boxes != r.d_boxes || d_block_id != r.d_block_id || d_iter != r.d_iter; } @@ -119,9 +119,9 @@ friend class BoxContainer; /*! * @brief Constructor * - * @param [i] container - * @param [i] block_id - * @param [i] begin + * @param [in] container + * @param [in] block_id + * @param [in] begin */ BoxContainerSingleBlockIterator( const BoxContainer& container, @@ -131,7 +131,7 @@ friend class BoxContainer; /*! * @brief BoxContainer being iterated through. */ - const BoxContainer* d_mapped_boxes; + const BoxContainer* d_boxes; /*! * @brief The BlockId. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.C index 1ab4e6b0..6414e43a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.C @@ -3,29 +3,25 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Special iterator for BoxContainer. * ************************************************************************/ -#ifndef included_hier_BoxContainerSingleOwnerIterator_C -#define included_hier_BoxContainerSingleOwnerIterator_C - #include "SAMRAI/hier/BoxContainerSingleOwnerIterator.h" namespace SAMRAI { namespace hier { BoxContainerSingleOwnerIterator::BoxContainerSingleOwnerIterator( - const BoxContainer& mapped_boxes, + const BoxContainer& boxes, const int& owner_rank, bool begin): - d_mapped_boxes(&mapped_boxes), + d_boxes(&boxes), d_owner_rank(owner_rank), - d_iter(begin ? d_mapped_boxes->begin() : d_mapped_boxes->end()) + d_iter(begin ? d_boxes->begin() : d_boxes->end()) { - if (begin) - { - while (d_iter != d_mapped_boxes->end() && + if (begin) { + while (d_iter != d_boxes->end() && d_iter->getOwnerRank() != d_owner_rank) { ++d_iter; } @@ -34,7 +30,7 @@ BoxContainerSingleOwnerIterator::BoxContainerSingleOwnerIterator( BoxContainerSingleOwnerIterator::~BoxContainerSingleOwnerIterator() { - d_mapped_boxes = NULL; + d_boxes = 0; } /* @@ -48,7 +44,7 @@ BoxContainerSingleOwnerIterator::operator ++ () { do { ++d_iter; - } while (d_iter != d_mapped_boxes->end() && + } while (d_iter != d_boxes->end() && d_iter->getOwnerRank() != d_owner_rank); return *this; } @@ -66,11 +62,10 @@ BoxContainerSingleOwnerIterator::operator ++ ( BoxContainerSingleOwnerIterator saved = *this; do { ++d_iter; - } while (d_iter != d_mapped_boxes->end() && + } while (d_iter != d_boxes->end() && d_iter->getOwnerRank() != d_owner_rank); return saved; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.h index 7bce02b8..a6a81737 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerSingleOwnerIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Special iterator for BoxContainer. * ************************************************************************/ @@ -28,7 +28,7 @@ namespace hier { */ class BoxContainerSingleOwnerIterator { -friend class BoxContainer; + friend class BoxContainer; public: //! @brief Destructor @@ -41,7 +41,7 @@ friend class BoxContainer; operator = ( const BoxContainerSingleOwnerIterator& r) { - d_mapped_boxes = r.d_mapped_boxes; + d_boxes = r.d_boxes; d_iter = r.d_iter; d_owner_rank = r.d_owner_rank; return *this; @@ -72,7 +72,7 @@ friend class BoxContainer; operator == ( const BoxContainerSingleOwnerIterator& r) const { - return d_mapped_boxes == r.d_mapped_boxes && + return d_boxes == r.d_boxes && d_owner_rank == r.d_owner_rank && d_iter == r.d_iter; } @@ -84,7 +84,7 @@ friend class BoxContainer; operator != ( const BoxContainerSingleOwnerIterator& r) const { - return d_mapped_boxes != r.d_mapped_boxes || + return d_boxes != r.d_boxes || d_owner_rank != r.d_owner_rank || d_iter != r.d_iter; } @@ -112,9 +112,9 @@ friend class BoxContainer; /*! * @brief Constructor * - * @param [i] container - * @param [i] owner_rank - * @param [i] begin + * @param [in] container + * @param [in] owner_rank + * @param [in] begin */ BoxContainerSingleOwnerIterator( const BoxContainer& container, @@ -124,7 +124,7 @@ friend class BoxContainer; /*! * @brief BoxContainer being iterated through. */ - const BoxContainer* d_mapped_boxes; + const BoxContainer* d_boxes; /*! * @brief The owner_rank. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.C index 36a22f24..8f2b193f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Common Box operations for Box containers. * ************************************************************************/ -#ifndef included_hier_BoxContainerUtils_C -#define included_hier_BoxContainerUtils_C - #include "SAMRAI/hier/BoxContainerUtils.h" #include "SAMRAI/tbox/StartupShutdownManager.h" #include "SAMRAI/tbox/TimerManager.h" @@ -32,7 +29,7 @@ BoxContainerUtils::BoxContainerUtils() void BoxContainerUtils::recursivePrintBoxVector( - const std::vector& mapped_boxes, + const std::vector& boxes, std::ostream& os, const std::string& border, int detail_depth) @@ -40,8 +37,8 @@ BoxContainerUtils::recursivePrintBoxVector( NULL_USE(detail_depth); os << border; - for (std::vector::const_iterator ni = mapped_boxes.begin(); - ni != mapped_boxes.end(); + for (std::vector::const_iterator ni = boxes.begin(); + ni != boxes.end(); ++ni) { os << " " << *ni; } @@ -49,4 +46,3 @@ BoxContainerUtils::recursivePrintBoxVector( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.h index 94e75296..9cb77636 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxContainerUtils.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Common Box operations for Box containers. * ************************************************************************/ @@ -12,7 +12,9 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/Box.h" + +#include namespace SAMRAI { namespace hier { @@ -20,14 +22,6 @@ namespace hier { /*! * @brief Utilities for performing simple common tasks on a container * of Boxes. - * - * TODO: Arguments should be re-ordered to the SAMRAI standard, output - * before input. - * - * TODO: There are some very similar methods in this class. In many cases, - * one version supports input and output being the same object, but the other - * does not. For uniformity, all these methods should support input and - * output containers being the same object. It's simple to implement. */ class BoxContainerUtils { @@ -40,7 +34,7 @@ class BoxContainerUtils /*! * @brief Print a vector of Boxes to an output stream. * - * @param[in] mapped_boxes + * @param[in] boxes * * @param[in] output_stream * @@ -50,7 +44,7 @@ class BoxContainerUtils */ static void recursivePrintBoxVector( - const std::vector& mapped_boxes, + const std::vector& boxes, std::ostream& output_stream = tbox::plog, const std::string& border = std::string(), int detail_depth = 0); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.C index e985c8be..1d135e46 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box geometry description for overlap computations * ************************************************************************/ - -#ifndef included_hier_BoxGeometry_C -#define included_hier_BoxGeometry_C - #include "SAMRAI/hier/BoxGeometry.h" namespace SAMRAI { @@ -26,4 +22,3 @@ BoxGeometry::~BoxGeometry() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.h index 08232c8f..4d5dc0a8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box geometry description for overlap computations * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace hier { @@ -62,9 +62,9 @@ namespace hier { * then data will be copied only into the ghost cell values and not the * interior values of the patch. * - * @see hier::BoxOverlap - * @see hier::PatchDataFactory - * @see hier::PatchData + * @see BoxOverlap + * @see PatchDataFactory + * @see PatchData */ class BoxGeometry @@ -162,7 +162,7 @@ class BoxGeometry private: BoxGeometry( const BoxGeometry&); // not implemented - void + BoxGeometry& operator = ( const BoxGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.C index d05097c1..56a8db18 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Identifier for a Box. * ************************************************************************/ - -#ifndef included_hier_BoxId_C -#define included_hier_BoxId_C - #include "SAMRAI/hier/BoxId.h" #include @@ -83,4 +79,3 @@ operator << ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.h index eb1291ec..2443c25a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Identifier for a Box. * ************************************************************************/ @@ -54,6 +54,8 @@ class BoxId * @param[in] owner_rank * * @param[in] periodic_id + * + * @pre periodic_id.isValid() */ BoxId( const LocalId& local_id, @@ -66,6 +68,8 @@ class BoxId * @param[in] id * * @param[in] periodic_id + * + * @pre periodic_id.isValid() */ explicit BoxId( const GlobalId& id, @@ -75,6 +79,8 @@ class BoxId * @brief Copy constructor. * * @param[in] other + * + * @pre other.periodic_id.isValid() */ BoxId( const BoxId& other); @@ -154,13 +160,14 @@ class BoxId /*! * @brief Whether the BoxId is valid--meaning it has a valid * GlobalId and PeriodicId. - */ + */ bool isValid() const { - return (d_periodic_id.isValid() && - d_global_id.getLocalId() != LocalId::getInvalidId() && - d_global_id.getOwnerRank() != tbox::SAMRAI_MPI::getInvalidRank()); + return d_periodic_id.isValid() && + d_global_id.getLocalId() != LocalId::getInvalidId() && + d_global_id.getLocalId() >= 0 && + d_global_id.getOwnerRank() != tbox::SAMRAI_MPI::getInvalidRank(); } //@{ @@ -281,7 +288,7 @@ class BoxId */ void putToIntBuffer( - int * buffer) const + int* buffer) const { buffer[0] = getOwnerRank(); buffer[1] = getLocalId().getValue(); @@ -296,7 +303,7 @@ class BoxId */ void getFromIntBuffer( - const int * buffer) + const int* buffer) { initialize(LocalId(buffer[1]), buffer[0], @@ -311,7 +318,7 @@ class BoxId */ void putToMessageStream( - tbox::MessageStream &msg) const + tbox::MessageStream& msg) const { msg << getOwnerRank(); msg << getLocalId().getValue(); @@ -326,7 +333,7 @@ class BoxId */ void getFromMessageStream( - tbox::MessageStream &msg) + tbox::MessageStream& msg) { int i1, i2, i3; msg >> i1; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.C index 097046b0..94349985 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Set of boxes in a box_level of a distributed box graph. * ************************************************************************/ -#ifndef included_hier_BoxLevel_C -#define included_hier_BoxLevel_C - #include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/hier/BoxContainer.h" @@ -35,8 +32,8 @@ namespace SAMRAI { namespace hier { -const int BoxLevel::HIER_MAPPED_BOX_LEVEL_VERSION = 0; -const int BoxLevel::MAPPED_BOX_LEVEL_NUMBER_OF_STATS = 20; +const int BoxLevel::HIER_BOX_LEVEL_VERSION = 0; +const int BoxLevel::BOX_LEVEL_NUMBER_OF_STATS = 20; boost::shared_ptr BoxLevel::t_initialize_private; boost::shared_ptr BoxLevel::t_acquire_remote_boxes; @@ -52,72 +49,42 @@ BoxLevel::s_initialize_finalize_handler( BoxLevel::finalizeCallback, tbox::StartupShutdownManager::priorityTimers); -BoxLevel::BoxLevel(): - d_mpi(tbox::SAMRAI_MPI::commNull), - d_ratio(tbox::Dimension::getInvalidDimension(), 0), - - d_local_number_of_cells(0), - d_global_number_of_cells(-1), - d_local_number_of_boxes(0), - d_global_number_of_boxes(-1), - - d_max_number_of_boxes(-1), - d_min_number_of_boxes(-1), - d_max_number_of_cells(-1), - d_min_number_of_cells(-1), - - d_local_max_box_size(0), - d_global_max_box_size(0), - d_local_min_box_size(0), - d_global_min_box_size(0), - - d_local_bounding_box(0), - d_local_bounding_box_up_to_date(false), - d_global_bounding_box(0), - d_global_data_up_to_date(false), - - d_parallel_state(DISTRIBUTED), - d_globalized_version(NULL), - d_persistent_overlap_connectors(NULL), - d_handle(), - d_grid_geometry() -{ - // This ctor should never be invoked. - TBOX_ERROR("Somehow, we entered code that was never meant to be used."); -} - BoxLevel::BoxLevel( - const tbox::Dimension& dim): + const tbox::Dimension& dim, + tbox::Database& restart_db, + const boost::shared_ptr& grid_geom): - d_mpi(tbox::SAMRAI_MPI::commNull), - d_ratio(dim, 0), + d_mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()), + d_ratio(IntVector::getZero(dim)), d_local_number_of_cells(0), - d_global_number_of_cells(-1), + d_global_number_of_cells(0), d_local_number_of_boxes(0), - d_global_number_of_boxes(-1), + d_global_number_of_boxes(0), - d_max_number_of_boxes(-1), - d_min_number_of_boxes(-1), - d_max_number_of_cells(-1), - d_min_number_of_cells(-1), + d_max_number_of_boxes(0), + d_min_number_of_boxes(0), + d_max_number_of_cells(0), + d_min_number_of_cells(0), - d_local_max_box_size(0), - d_global_max_box_size(0), - d_local_min_box_size(0), - d_global_min_box_size(0), + d_local_max_box_size(), + d_global_max_box_size(), + d_local_min_box_size(), + d_global_min_box_size(), - d_local_bounding_box(0), + d_local_bounding_box(), d_local_bounding_box_up_to_date(false), - d_global_bounding_box(0), + d_global_bounding_box(), d_global_data_up_to_date(false), d_parallel_state(DISTRIBUTED), - d_globalized_version(NULL), - d_persistent_overlap_connectors(NULL), + d_globalized_version(0), + d_persistent_overlap_connectors(0), d_handle(), - d_grid_geometry() + d_grid_geometry(), + d_locked(false) { + getFromRestart(restart_db, grid_geom); } BoxLevel::BoxLevel( @@ -148,10 +115,11 @@ BoxLevel::BoxLevel( d_global_data_up_to_date(rhs.d_global_data_up_to_date), d_parallel_state(rhs.d_parallel_state), - d_globalized_version(NULL), - d_persistent_overlap_connectors(NULL), + d_globalized_version(0), + d_persistent_overlap_connectors(0), d_handle(), - d_grid_geometry(rhs.d_grid_geometry) + d_grid_geometry(rhs.d_grid_geometry), + d_locked(false) { // This cannot be the first constructor call, so no need to set timers. } @@ -161,44 +129,85 @@ BoxLevel::BoxLevel( const boost::shared_ptr& grid_geom, const tbox::SAMRAI_MPI& mpi, const ParallelState parallel_state): - d_mpi(tbox::SAMRAI_MPI::commNull), + d_mpi(MPI_COMM_NULL), d_ratio(ratio), d_local_number_of_cells(0), - d_global_number_of_cells(-1), + d_global_number_of_cells(0), d_local_number_of_boxes(0), - d_global_number_of_boxes(-1), + d_global_number_of_boxes(0), - d_max_number_of_boxes(-1), - d_min_number_of_boxes(-1), - d_max_number_of_cells(-1), - d_min_number_of_cells(-1), + d_max_number_of_boxes(0), + d_min_number_of_boxes(0), + d_max_number_of_cells(0), + d_min_number_of_cells(0), - d_local_max_box_size(0), - d_global_max_box_size(0), - d_local_min_box_size(0), - d_global_min_box_size(0), + d_local_max_box_size(), + d_global_max_box_size(), + d_local_min_box_size(), + d_global_min_box_size(), - d_local_bounding_box(0), + d_local_bounding_box(), d_local_bounding_box_up_to_date(false), - d_global_bounding_box(0), + d_global_bounding_box(), d_global_data_up_to_date(false), d_parallel_state(DISTRIBUTED), - d_globalized_version(NULL), - d_persistent_overlap_connectors(NULL), + d_globalized_version(0), + d_persistent_overlap_connectors(0), d_handle(), - d_grid_geometry() + d_grid_geometry(), + d_locked(false) { - initialize(ratio, grid_geom, mpi, parallel_state); + initialize(BoxContainer(), ratio, grid_geom, mpi, parallel_state); +} + +BoxLevel::BoxLevel( + const BoxContainer& boxes, + const IntVector& ratio, + const boost::shared_ptr& grid_geom, + const tbox::SAMRAI_MPI& mpi, + const ParallelState parallel_state): + d_mpi(MPI_COMM_NULL), + d_ratio(ratio), + + d_local_number_of_cells(0), + d_global_number_of_cells(0), + d_local_number_of_boxes(0), + d_global_number_of_boxes(0), + + d_max_number_of_boxes(0), + d_min_number_of_boxes(0), + d_max_number_of_cells(0), + d_min_number_of_cells(0), + + d_local_max_box_size(), + d_global_max_box_size(), + d_local_min_box_size(), + d_global_min_box_size(), + + d_local_bounding_box(), + d_local_bounding_box_up_to_date(false), + d_global_bounding_box(), + d_global_data_up_to_date(false), + + d_parallel_state(DISTRIBUTED), + d_globalized_version(0), + d_persistent_overlap_connectors(0), + d_handle(), + d_grid_geometry(), + d_locked(false) +{ + initialize(boxes, ratio, grid_geom, mpi, parallel_state); } BoxLevel::~BoxLevel() { + d_locked = false; clear(); - if (d_persistent_overlap_connectors != NULL) { + if (d_persistent_overlap_connectors != 0) { delete d_persistent_overlap_connectors; - d_persistent_overlap_connectors = NULL; + d_persistent_overlap_connectors = 0; } } @@ -211,6 +220,10 @@ BoxLevel& BoxLevel::operator = ( const BoxLevel& rhs) { + if (locked()) { + TBOX_ERROR("BoxLevel::operator =: operating on locked BoxLevel." + << std::endl); + } if (&rhs != this) { /* * Protect this block from assignment to self because it is @@ -249,12 +262,18 @@ BoxLevel::operator = ( void BoxLevel::initialize( + const BoxContainer& boxes, const IntVector& ratio, const boost::shared_ptr& grid_geom, const tbox::SAMRAI_MPI& mpi, const ParallelState parallel_state) { - d_boxes.clear(); + if (locked()) { + TBOX_ERROR("BoxLevel::initialize(): operating on locked BoxLevel." + << std::endl); + } + + d_boxes = boxes; d_boxes.order(); initializePrivate( ratio, @@ -271,8 +290,13 @@ BoxLevel::swapInitialize( const tbox::SAMRAI_MPI& mpi, const ParallelState parallel_state) { + if (locked()) { + TBOX_ERROR("BoxLevel::swapInitialize(): operating on locked BoxLevel." + << std::endl); + } TBOX_ASSERT(&boxes != &d_boxes); // Library error if this fails. d_boxes.swap(boxes); + d_boxes.order(); initializePrivate(ratio, grid_geom, mpi, @@ -282,6 +306,10 @@ BoxLevel::swapInitialize( void BoxLevel::finalize() { + if (locked()) { + TBOX_ERROR("BoxLevel::finalize(): operating on locked BoxLevel." + << std::endl); + } // Erase non-local Boxes, if any, from d_boxes. for (BoxContainer::iterator mbi = d_boxes.begin(); @@ -294,7 +322,6 @@ BoxLevel::finalize() } computeLocalRedundantData(); - return; } void @@ -304,9 +331,22 @@ BoxLevel::initializePrivate( const tbox::SAMRAI_MPI& mpi, const ParallelState parallel_state) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio); t_initialize_private->start(); + d_ratio = ratio; + if (d_ratio.getNumBlocks() != grid_geom->getNumberBlocks()) { + if (d_ratio.max() == d_ratio.min()) { + size_t new_size = grid_geom->getNumberBlocks(); + d_ratio = IntVector(d_ratio, new_size); + } else { + TBOX_ERROR("BoxLevel::initializePrivate: anisotropic refinement\n" + << "ratio " << ratio << " must be \n" + << "defined for " << grid_geom->getNumberBlocks() << " blocks." + << std::endl); + } + } + clearForBoxChanges(); d_mpi = mpi; @@ -319,7 +359,7 @@ BoxLevel::initializePrivate( } // Erase non-local Boxes, if any, from d_boxes. - for (BoxContainer::iterator mbi(d_boxes.begin()); + for (BoxContainer::iterator mbi = d_boxes.begin(); mbi != d_boxes.end(); /* incremented in loop */) { if (mbi->getOwnerRank() != d_mpi.getRank()) { d_boxes.erase(mbi++); @@ -328,10 +368,13 @@ BoxLevel::initializePrivate( } } - d_ratio = ratio; d_parallel_state = parallel_state; - d_global_number_of_cells = -1; - d_global_number_of_boxes = -1; + d_global_number_of_cells = 0; + d_global_number_of_boxes = 0; + d_max_number_of_boxes = 0; + d_min_number_of_boxes = 0; + d_max_number_of_cells = 0; + d_min_number_of_cells = 0; d_local_bounding_box_up_to_date = false; d_global_data_up_to_date = false; computeLocalRedundantData(); @@ -396,10 +439,14 @@ BoxLevel::operator != ( void BoxLevel::removePeriodicImageBoxes() { + if (locked()) { + TBOX_ERROR("BoxLevel::removePeriodicImageBoxes(): operating on locked BoxLevel." + << std::endl); + } if (isInitialized()) { clearForBoxChanges(); d_boxes.removePeriodicImageBoxes(); - if ( d_parallel_state == GLOBALIZED ) { + if (d_parallel_state == GLOBALIZED) { d_global_boxes.removePeriodicImageBoxes(); } } @@ -416,16 +463,24 @@ BoxLevel::removePeriodicImageBoxes() void BoxLevel::clear() { + if (locked()) { + TBOX_ERROR("BoxLevel::clear(): operating on locked BoxLevel." + << std::endl); + } if (isInitialized()) { clearForBoxChanges(); - d_mpi = tbox::SAMRAI_MPI(tbox::SAMRAI_MPI::commNull); + d_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL); d_boxes.clear(); d_global_boxes.clear(); - d_ratio(0) = 0; + d_ratio(0,0) = 0; d_local_number_of_cells = 0; - d_global_number_of_cells = -1; + d_global_number_of_cells = 0; d_local_number_of_boxes = 0; - d_global_number_of_boxes = -1; + d_global_number_of_boxes = 0; + d_max_number_of_boxes = 0; + d_min_number_of_boxes = 0; + d_max_number_of_cells = 0; + d_min_number_of_cells = 0; d_local_bounding_box.clear(); d_local_bounding_box_up_to_date = false; d_global_bounding_box.clear(); @@ -444,10 +499,14 @@ BoxLevel::swap( BoxLevel& level_a, BoxLevel& level_b) { + if (level_a.locked() || level_b.locked()) { + TBOX_ERROR("BoxLevel::initialize(): operating on locked BoxLevel." + << std::endl); + } if (&level_a != &level_b) { if (level_a.isInitialized() && level_b.isInitialized()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(level_a, level_b); + TBOX_ASSERT_OBJDIM_EQUALITY2(level_a, level_b); } level_a.clearPersistentOverlapConnectors(); @@ -468,11 +527,10 @@ BoxLevel::swap( int tmpint; bool tmpbool; - IntVector tmpvec(level_a.getDim()); Box tmpbox(level_a.getDim()); ParallelState tmpstate; const BoxLevel* tmpmbl; - tbox::SAMRAI_MPI tmpmpi(tbox::SAMRAI_MPI::commNull); + tbox::SAMRAI_MPI tmpmpi(MPI_COMM_NULL); boost::shared_ptr tmpgridgeom( level_a.getGridGeometry()); @@ -484,7 +542,7 @@ BoxLevel::swap( level_a.d_mpi = level_b.d_mpi; level_b.d_mpi = tmpmpi; - tmpvec = level_a.d_ratio; + IntVector tmpvec = level_a.d_ratio; level_a.d_ratio = level_b.d_ratio; level_b.d_ratio = tmpvec; @@ -492,9 +550,9 @@ BoxLevel::swap( level_a.d_local_number_of_cells = level_b.d_local_number_of_cells; level_b.d_local_number_of_cells = tmpint; - tmpint = level_a.d_global_number_of_cells; + long int tmplongint = level_a.d_global_number_of_cells; level_a.d_global_number_of_cells = level_b.d_global_number_of_cells; - level_b.d_global_number_of_cells = tmpint; + level_b.d_global_number_of_cells = tmplongint; tmpint = static_cast(level_a.d_local_number_of_boxes); level_a.d_local_number_of_boxes = level_b.d_local_number_of_boxes; @@ -526,21 +584,22 @@ BoxLevel::computeLocalRedundantData() { const IntVector max_vec(d_ratio.getDim(), tbox::MathUtilities::getMax()); const IntVector& zero_vec = IntVector::getZero(d_ratio.getDim()); - const int nblocks = d_grid_geometry->getNumberBlocks(); + const size_t nblocks = d_grid_geometry->getNumberBlocks(); d_local_number_of_boxes = 0; d_local_number_of_cells = 0; - if (int(d_local_bounding_box.size()) != nblocks) { - d_local_bounding_box.resize(nblocks, Box(d_grid_geometry->getDim())); - d_local_min_box_size.resize(nblocks, max_vec); - d_local_max_box_size.resize(nblocks, zero_vec); - } + d_local_bounding_box.clear(); + d_local_min_box_size.clear(); + d_local_max_box_size.clear(); + d_local_bounding_box.resize(nblocks, Box(d_grid_geometry->getDim())); + d_local_min_box_size.resize(nblocks, max_vec); + d_local_max_box_size.resize(nblocks, zero_vec); for (RealBoxConstIterator ni(d_boxes.realBegin()); ni != d_boxes.realEnd(); ++ni) { - int block_num = ni->getBlockId().getBlockValue(); + const BlockId::block_t& block_num = ni->getBlockId().getBlockValue(); const IntVector boxdim(ni->numberCells()); ++d_local_number_of_boxes; d_local_number_of_cells += boxdim.getProduct(); @@ -574,7 +633,7 @@ BoxLevel::cacheGlobalReducedData() const t_cache_global_reduced_data->barrierAndStart(); - const int nblocks = d_grid_geometry->getNumberBlocks(); + const size_t nblocks = d_grid_geometry->getNumberBlocks(); /* * Sum reduction is used to compute the global sums of box count @@ -591,30 +650,23 @@ BoxLevel::cacheGlobalReducedData() const } } else { if (d_mpi.getSize() > 1) { - int tmpa[2], tmpb[2]; + unsigned long int tmpa[2], tmpb[2]; tmpa[0] = getLocalNumberOfBoxes(); tmpa[1] = getLocalNumberOfCells(); - - TBOX_ASSERT(tmpa[0] >= 0); - TBOX_ASSERT(tmpa[1] >= 0); - d_mpi.Allreduce(tmpa, tmpb, // Better to use MPI_IN_PLACE, but not some MPI's do not support. 2, - MPI_INT, + MPI_LONG, MPI_SUM); - d_global_number_of_boxes = tmpb[0]; - d_global_number_of_cells = tmpb[1]; + d_global_number_of_boxes = static_cast(tmpb[0]); + d_global_number_of_cells = static_cast(tmpb[1]); } else { d_global_number_of_boxes = getLocalNumberOfBoxes(); d_global_number_of_cells = getLocalNumberOfCells(); } - - TBOX_ASSERT(d_global_number_of_boxes >= 0); - TBOX_ASSERT(d_global_number_of_cells >= 0); } - if (int(d_global_bounding_box.size()) != nblocks) { + if (d_global_bounding_box.size() != nblocks) { d_global_bounding_box.resize(nblocks, Box(getDim())); d_global_min_box_size.resize(nblocks, IntVector(getDim())); d_global_max_box_size.resize(nblocks, IntVector(getDim())); @@ -627,8 +679,10 @@ BoxLevel::cacheGlobalReducedData() const if (d_mpi.getSize() == 1) { d_global_bounding_box = d_local_bounding_box; - d_max_number_of_boxes = d_min_number_of_boxes = getLocalNumberOfBoxes(); - d_max_number_of_cells = d_min_number_of_cells = getLocalNumberOfCells(); + d_max_number_of_boxes = d_min_number_of_boxes = + static_cast(getLocalNumberOfBoxes()); + d_max_number_of_cells = d_min_number_of_cells = + static_cast(getLocalNumberOfCells()); d_global_max_box_size = d_local_max_box_size; d_global_min_box_size = d_local_min_box_size; @@ -639,9 +693,7 @@ BoxLevel::cacheGlobalReducedData() const std::vector send_mesg; send_mesg.reserve(nblocks * 4 * dim.getValue() + 4); - int bishift; - for (int bn = 0; bn < nblocks; ++bn) { - bishift = bn * nblocks; + for (BlockId::block_t bn = 0; bn < nblocks; ++bn) { for (int i = 0; i < dim.getValue(); ++i) { send_mesg.push_back(-d_local_bounding_box[bn].lower()[i]); send_mesg.push_back(d_local_bounding_box[bn].upper()[i]); @@ -649,9 +701,9 @@ BoxLevel::cacheGlobalReducedData() const send_mesg.push_back(d_local_max_box_size[bn][i]); } } - send_mesg.push_back(getLocalNumberOfBoxes()); + send_mesg.push_back(static_cast(getLocalNumberOfBoxes())); send_mesg.push_back(-static_cast(getLocalNumberOfBoxes())); - send_mesg.push_back(getLocalNumberOfCells()); + send_mesg.push_back(static_cast(getLocalNumberOfCells())); send_mesg.push_back(-static_cast(getLocalNumberOfCells())); std::vector recv_mesg(send_mesg.size()); @@ -663,10 +715,12 @@ BoxLevel::cacheGlobalReducedData() const MPI_MAX); int tmpi = -1; - for (int bn = 0; bn < nblocks; ++bn) { + for (BlockId::block_t bn = 0; bn < nblocks; ++bn) { for (int i = 0; i < dim.getValue(); ++i) { - d_global_bounding_box[bn].lower()[i] = -recv_mesg[++tmpi]; - d_global_bounding_box[bn].upper()[i] = recv_mesg[++tmpi]; + d_global_bounding_box[bn].setLower(static_cast(i), + -recv_mesg[++tmpi]); + d_global_bounding_box[bn].setUpper(static_cast(i), + recv_mesg[++tmpi]); d_global_min_box_size[bn][i] = -recv_mesg[++tmpi]; d_global_max_box_size[bn][i] = recv_mesg[++tmpi]; } @@ -688,7 +742,7 @@ BoxLevel::cacheGlobalReducedData() const t_cache_global_reduced_data->stop(); } -size_t +int BoxLevel::getLocalNumberOfBoxes( int rank) const { @@ -696,15 +750,16 @@ BoxLevel::getLocalNumberOfBoxes( #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state == DISTRIBUTED && rank != d_mpi.getRank()) { TBOX_ERROR( - "Non-local boxes are not available in DISTRIBUTED mode."); + "Non-local boxes are not available in DISTRIBUTED mode." + << std::endl); } - TBOX_ASSERT(rank >= 0 && rank < d_mpi.getSize()); #endif + TBOX_ASSERT(rank >= 0 && rank < d_mpi.getSize()); if (rank == d_mpi.getRank()) { return d_local_number_of_boxes; } else { - size_t count = 0; + int count = 0; BoxContainerSingleOwnerIterator mbi(d_global_boxes.begin(rank)); for ( ; mbi != d_global_boxes.end(rank); ++mbi) { if (!(*mbi).isPeriodicImage()) { @@ -724,10 +779,11 @@ BoxLevel::getLocalNumberOfCells( #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state == DISTRIBUTED && rank != d_mpi.getRank()) { TBOX_ERROR( - "Non-local boxes are not available in DISTRIBUTED mode."); + "Non-local boxes are not available in DISTRIBUTED mode." + << std::endl); } - TBOX_ASSERT(rank >= 0 && rank < d_mpi.getSize()); #endif + TBOX_ASSERT(rank >= 0 && rank < d_mpi.getSize()); if (rank == d_mpi.getRank()) { return d_local_number_of_cells; @@ -771,23 +827,22 @@ void BoxLevel::setParallelState( const ParallelState parallel_state) { + if (locked()) { + TBOX_ERROR("BoxLevel::setParallelState(): operating on locked BoxLevel." + << std::endl); + } #ifdef DEBUG_CHECK_ASSERTIONS if (!isInitialized()) { TBOX_ERROR( "BoxLevel::setParallelState: Cannot change the parallel state of\n" - << "an uninitialized BoxLevel. See BoxLevel::initialize()"); + << "an uninitialized BoxLevel. See BoxLevel::initialize()" + << std::endl); } #endif - if (parallel_state != DISTRIBUTED && parallel_state != GLOBALIZED) { - TBOX_ERROR( - "BoxLevel::setParallelState: Invalid distribution state: " - << parallel_state << "\n"); - } - if (d_parallel_state == DISTRIBUTED && parallel_state == GLOBALIZED) { acquireRemoteBoxes(); - } else if (d_parallel_state == GLOBALIZED && parallel_state == - DISTRIBUTED) { + } else if (d_parallel_state == GLOBALIZED && + parallel_state == DISTRIBUTED) { d_global_boxes.clear(); } d_parallel_state = parallel_state; @@ -989,27 +1044,17 @@ BoxLevel::acquireRemoteBoxes_unpack( BoxContainer::const_iterator BoxLevel::addBox( const Box& box, - const BlockId& block_id, - const bool use_vacant_index) + const BlockId& block_id) { - const tbox::Dimension& dim(getDim()); - /* - * FIXME: bug: if some procs add a Box and others do not, - * their d_computed_global_* flags will be inconsistent - * resulting in incomplete participation in future communication - * calls to compute those parameters. - * - * This problem is not exclusive to box adding. - * It would also happen if some call initialize() - * and others do not. But because box adding is finer grained - * than initialize(), it is more likely that some processors - * will skip over the box adding. - */ + if (locked()) { + TBOX_ERROR("BoxLevel::addBox(): operating on locked BoxLevel." + << std::endl); + } #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state != DISTRIBUTED) { TBOX_ERROR("Individually adding Boxes is a local process\n" << "so it can only be performed in\n" - << "distributed state."); + << "DISTRIBUTED state." << std::endl); } if (box.getBlockId() != BlockId::invalidId()) { TBOX_ASSERT(box.getBlockId() == block_id); @@ -1018,14 +1063,17 @@ BoxLevel::addBox( clearForBoxChanges(false); - BoxContainer::iterator new_iterator(d_boxes); + const PeriodicShiftCatalog& shift_catalog = + getGridGeometry()->getPeriodicShiftCatalog(); + + BoxContainer::iterator new_iterator = d_boxes.begin(); - if (d_boxes.size() == 0) { + if (d_boxes.empty()) { Box new_box( box, LocalId::getZero(), d_mpi.getRank(), - PeriodicShiftCatalog::getCatalog(dim)->getZeroShiftNumber()); + shift_catalog.getZeroShiftNumber()); new_box.setBlockId(block_id); new_iterator = d_boxes.insert(d_boxes.end(), new_box); } else { @@ -1036,29 +1084,6 @@ BoxLevel::addBox( --ni; } while (ni->isPeriodicImage()); LocalId new_index = ni->getLocalId() + 1; - if (use_vacant_index) { - TBOX_ASSERT(new_index >= 0); - - if (new_index.getValue() != - static_cast(d_local_number_of_boxes)) { - /* - * There is a smaller unused index we can use for the new index. - */ - for (new_index = 0, ni = d_boxes.begin(); - ni != d_boxes.end(); - ++ni) { - if (new_index != (*ni).getLocalId()) { - break; - } - if (!ni->isPeriodicImage()) { - ++new_index; - } - } - // We should have found an unused index. - TBOX_ASSERT(ni != d_boxes.end()); - } - } - Box new_box( box, new_index, d_mpi.getRank()); new_box.setBlockId(block_id); @@ -1085,25 +1110,25 @@ BoxLevel::addPeriodicBox( const Box& ref_box, const PeriodicId& shift_number) { - // FIXME: We don't allow individually adding remote Boxes even in globalized state. We probably shouldn't allow adding remote images either. -#ifdef DEBUG_CHECK_ASSERTIONS - if (shift_number == - PeriodicShiftCatalog::getCatalog(getDim())->getZeroShiftNumber()) { - TBOX_ERROR( - "BoxLevel::addPeriodicBox cannot be used to add regular box."); + if (locked()) { + TBOX_ERROR("BoxLevel::addPeriodicBox(): operating on locked BoxLevel." + << std::endl); } - if (d_parallel_state != GLOBALIZED && ref_box.getOwnerRank() != - d_mpi.getRank()) { + + const PeriodicShiftCatalog& shift_catalog = + getGridGeometry()->getPeriodicShiftCatalog(); + +#ifdef DEBUG_CHECK_ASSERTIONS + if (shift_number == shift_catalog.getZeroShiftNumber()) { TBOX_ERROR( - "BoxLevel::addPeriodicBox: Cannot add remote Box\n" - << "(owned by rank " << ref_box.getOwnerRank() << ")\n" - << "when not in GLOBALIZED state."); + "BoxLevel::addPeriodicBox cannot be used to add regular box." + << std::endl); } #endif clearForBoxChanges(false); - Box image_box(ref_box, shift_number, d_ratio); + Box image_box(ref_box, shift_number, d_ratio, shift_catalog); #ifdef DEBUG_CHECK_ASSERTIONS BoxContainer& boxes = @@ -1116,8 +1141,7 @@ BoxLevel::addPeriodicBox( */ Box real_box(getDim(), ref_box.getGlobalId(), - PeriodicShiftCatalog::getCatalog( - getDim())->getZeroShiftNumber()); + shift_catalog.getZeroShiftNumber()); if (boxes.find(real_box) == boxes.end()) { TBOX_ERROR( "BoxLevel::addPeriodicBox: cannot add periodic image Box " @@ -1143,14 +1167,11 @@ void BoxLevel::addBox( const Box& box) { -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_parallel_state != GLOBALIZED && box.getOwnerRank() != d_mpi.getRank()) { - TBOX_ERROR("BoxLevel::addBox: Cannot add remote Box\n" - << "(owned by rank " << box.getOwnerRank() << ")\n" - << "when not in GLOBALIZED state."); + TBOX_ASSERT(box.getLocalId().isValid()); + if (locked()) { + TBOX_ERROR("BoxLevel::addBox(): operating on locked BoxLevel." + << std::endl); } -#endif - clearForBoxChanges(false); #ifdef DEBUG_CHECK_ASSERTIONS @@ -1161,8 +1182,8 @@ BoxLevel::addBox( if (box.isPeriodicImage()) { Box real_box(getDim(), box.getGlobalId(), - PeriodicShiftCatalog::getCatalog( - getDim())->getZeroShiftNumber()); + getGridGeometry()->getPeriodicShiftCatalog(). + getZeroShiftNumber()); BoxContainer& boxes = box.getOwnerRank() == d_mpi.getRank() ? d_boxes : d_global_boxes; if (boxes.find(real_box) == boxes.end()) { @@ -1192,10 +1213,11 @@ BoxLevel::addBox( d_local_bounding_box[box.getBlockId().getBlockValue()] += box; d_local_max_box_size[box.getBlockId().getBlockValue()].max(box_size); d_local_min_box_size[box.getBlockId().getBlockValue()].min(box_size); + d_global_data_up_to_date = false; } d_global_data_up_to_date = false; /* - * FIXME: bug: if some procs add a real Box and others do not, + * TODO: bug: if some procs add a real Box and others do not, * their d_global_data_up_to_date flags will be inconsistent * resulting in incomplete participation in future collective * communication to compute that parameter. @@ -1219,11 +1241,15 @@ void BoxLevel::eraseBox( BoxContainer::iterator& ibox) { + if (locked()) { + TBOX_ERROR("BoxLevel::eraseBox(): operating on locked BoxLevel." + << std::endl); + } #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state != DISTRIBUTED) { TBOX_ERROR("Individually erasing boxes is a local process\n" << "so it can only be performed in\n" - << "distributed state."); + << "distributed state." << std::endl); } #endif @@ -1267,22 +1293,15 @@ void BoxLevel::eraseBox( const Box& box) { - /* - * FIXME: bug: if some procs erase some Boxes and others do - * not, their d_computed_global_* flags will be inconsistent - * resulting in incomplete participation in future communication - * calls to compute those parameters. - * - * This problem is not exclusive to box adding/erasing. It would - * also happen if some call initialize() and others do not. But - * because box adding is finer grained than initialize(), it is - * more likely that some processors will skip over the box adding. - */ + if (locked()) { + TBOX_ERROR("BoxLevel::eraseBox(): operating on locked BoxLevel." + << std::endl); + } #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state != DISTRIBUTED) { TBOX_ERROR("Individually erasing Boxes is a local process\n" << "so it can only be performed in\n" - << "distributed state."); + << "distributed state." << std::endl); } #endif @@ -1311,12 +1330,12 @@ BoxLevel::getGlobalizedVersion() const return *this; } - if (d_globalized_version == NULL) { + if (d_globalized_version == 0) { BoxLevel* globalized_version = new BoxLevel(*this); globalized_version->setParallelState(GLOBALIZED); TBOX_ASSERT(globalized_version->getParallelState() == GLOBALIZED); d_globalized_version = globalized_version; - globalized_version = NULL; + globalized_version = 0; } TBOX_ASSERT(d_globalized_version->getParallelState() == GLOBALIZED); @@ -1330,7 +1349,7 @@ BoxLevel::getGlobalizedVersion() const PersistentOverlapConnectors& BoxLevel::getPersistentOverlapConnectors() const { - if (d_persistent_overlap_connectors == NULL) { + if (d_persistent_overlap_connectors == 0) { d_persistent_overlap_connectors = new PersistentOverlapConnectors(*this); } return *d_persistent_overlap_connectors; @@ -1342,7 +1361,7 @@ BoxLevel::getFirstLocalId() const TBOX_ASSERT(isInitialized()); const BoxContainer& boxes = getBoxes(); - if (boxes.isEmpty()) { + if (boxes.empty()) { return s_negative_one_local_id; } BoxContainer::const_iterator ni = boxes.begin(); @@ -1359,7 +1378,7 @@ BoxLevel::getLastLocalId() const TBOX_ASSERT(isInitialized()); const BoxContainer& boxes = getBoxes(); - if (boxes.isEmpty()) { + if (boxes.empty()) { return s_negative_one_local_id; } LocalId last_local_id(0); @@ -1390,7 +1409,7 @@ BoxLevel::hasBox( if (d_parallel_state == DISTRIBUTED) { TBOX_ERROR("BoxLevel: Cannot check on remote Box " << box << " while in DISTRIBUTED mode.\n" - << "See BoxLevel::setParallelState()."); + << "See BoxLevel::setParallelState()." << std::endl); } #endif BoxContainer::const_iterator ni = d_global_boxes.find(box); @@ -1412,7 +1431,7 @@ BoxLevel::getBoxStrict( TBOX_ERROR( "BoxContainer::getBoxStrict: requested box " << box - << " does not exist in the box_level."); + << " does not exist in the box_level." << std::endl); } return ni; @@ -1421,7 +1440,7 @@ BoxLevel::getBoxStrict( if (d_parallel_state != GLOBALIZED) { TBOX_ERROR( "BoxLevel::getBox: cannot get remote box " - << box << " without being in globalized state."); + << box << " without being in globalized state." << std::endl); } #endif BoxContainer::const_iterator ni = d_global_boxes.find(box); @@ -1429,7 +1448,7 @@ BoxLevel::getBoxStrict( TBOX_ERROR( "BoxContainer::getBoxStrict: requested box " << box - << " does not exist in the box_level."); + << " does not exist in the box_level." << std::endl); } return ni; @@ -1448,20 +1467,19 @@ BoxLevel::getBoxStrict( if (box_id.getOwnerRank() != d_mpi.getRank() && d_parallel_state != GLOBALIZED) { TBOX_ERROR( "BoxLevel::getBoxStrict: cannot get remote box " << box_id - << - " without being in globalized state."); + << + " without being in globalized state." << std::endl); } #endif - Box box(getDim(), - box_id); + Box box(getDim(), box_id); if (box.getOwnerRank() == d_mpi.getRank()) { BoxContainer::const_iterator ni = d_boxes.find(box); if (ni == d_boxes.end()) { TBOX_ERROR( "BoxContainer::getBoxStrict: requested box " << box - << " does not exist in the box_level."); + << " does not exist in the box_level." << std::endl); } return ni; } else { @@ -1470,7 +1488,7 @@ BoxLevel::getBoxStrict( TBOX_ERROR( "BoxContainer::getBoxStrict: requested box " << box - << " does not exist in the box_level."); + << " does not exist in the box_level." << std::endl); } return ni; } @@ -1491,25 +1509,37 @@ BoxLevel::getGlobalBoxes(BoxContainer& global_boxes) const /* *********************************************************************** - * Write the BoxLevel to a database. + * Write the BoxLevel to a restart database. * * Write only local parts. *********************************************************************** */ void -BoxLevel::putUnregisteredToDatabase( - const boost::shared_ptr& database) const +BoxLevel::putToRestart( + const boost::shared_ptr& restart_db) const { - database->putBool("d_is_mapped_box_level", true); - database->putInteger( - "HIER_MAPPED_BOX_LEVEL_VERSION", HIER_MAPPED_BOX_LEVEL_VERSION); - database->putInteger("d_nproc", d_mpi.getSize()); - database->putInteger("d_rank", d_mpi.getRank()); - database->putInteger("dim", d_ratio.getDim().getValue()); - database->putIntegerArray( - "d_ratio", &d_ratio[0], d_ratio.getDim().getValue()); - getBoxes().putUnregisteredToDatabase(database->putDatabase("mapped_boxes")); + // This appears to be used in the RedistributedRestartUtility. + restart_db->putBool("d_is_mapped_box_level", true); + + restart_db->putInteger( + "HIER_MAPPED_BOX_LEVEL_VERSION", HIER_BOX_LEVEL_VERSION); + restart_db->putInteger("d_nproc", d_mpi.getSize()); + restart_db->putInteger("d_rank", d_mpi.getRank()); + restart_db->putInteger("dim", d_ratio.getDim().getValue()); + const size_t nblocks = d_grid_geometry->getNumberBlocks(); + for (BlockId::block_t b =0; b < nblocks; ++b) { + std::string ratio_name = "d_ratio_" + + tbox::Utilities::intToString(static_cast(b)); + std::vector tmp_ratio(d_ratio.getDim().getValue()); + for (unsigned int d = 0; d < d_ratio.getDim().getValue(); ++d) { + tmp_ratio[d] = d_ratio(b,d); + } + restart_db->putIntegerArray(ratio_name, + &(tmp_ratio[0]), + d_ratio.getDim().getValue()); + } + getBoxes().putToRestart(restart_db->putDatabase("mapped_boxes")); } /* @@ -1519,54 +1549,47 @@ BoxLevel::putUnregisteredToDatabase( */ void -BoxLevel::getFromDatabase( - tbox::Database& database, +BoxLevel::getFromRestart( + tbox::Database& restart_db, const boost::shared_ptr& grid_geom) { - TBOX_ASSERT(database.isInteger("dim")); - const tbox::Dimension dim(static_cast(database.getInteger("dim"))); + TBOX_ASSERT(restart_db.isInteger("dim")); + const tbox::Dimension dim(static_cast( + restart_db.getInteger("dim"))); TBOX_ASSERT(getDim() == dim); - IntVector ratio(dim); - database.getIntegerArray("d_ratio", &ratio[0], dim.getValue()); + const size_t nblocks = grid_geom->getNumberBlocks(); + IntVector ratio(nblocks, dim); + for (BlockId::block_t b = 0; b < nblocks; ++b) { + std::string ratio_name = "d_ratio_" + + tbox::Utilities::intToString(static_cast(b)); + std::vector tmp_ratio(dim.getValue()); + restart_db.getIntegerArray(ratio_name, &tmp_ratio[0], dim.getValue()); + for (int d = 0; d < dim.getValue(); ++d) { + ratio(b,d) = tmp_ratio[d]; + } + } + #ifdef DEBUG_CHECK_ASSERTIONS - const int version = database.getInteger("HIER_MAPPED_BOX_LEVEL_VERSION"); - const int nproc = database.getInteger("d_nproc"); - const int rank = database.getInteger("d_rank"); - TBOX_ASSERT(ratio >= IntVector::getOne(dim)); - TBOX_ASSERT(version <= HIER_MAPPED_BOX_LEVEL_VERSION); + const int version = restart_db.getInteger("HIER_MAPPED_BOX_LEVEL_VERSION"); + const int nproc = restart_db.getInteger("d_nproc"); + const int rank = restart_db.getInteger("d_rank"); #endif + TBOX_ASSERT(ratio >= IntVector::getOne(dim)); + TBOX_ASSERT(version <= HIER_BOX_LEVEL_VERSION); - /* - * If the communicator is already set, use it. Otherwise, use the - * one in tbox::SAMRAI_MPI::getSAMRAIWorld(). - * - * There must be a better way to handle the communicator than this. - */ - if (isInitialized()) { - TBOX_ASSERT(ratio == d_ratio); - if (d_parallel_state != DISTRIBUTED) { - setParallelState(DISTRIBUTED); - d_boxes.clear(); - } - } else { - TBOX_WARNING( - "BoxLevel::getFromDatabase: Uninitialized MPI communicator.\n" - << "Using tbox::SAMRAI_MPI::getSAMRAIWorld()."); - initialize(ratio, grid_geom, - tbox::SAMRAI_MPI::getSAMRAIWorld(), DISTRIBUTED); - } + initialize(BoxContainer(), ratio, grid_geom); /* * Failing these asserts means that we don't have a compatible - * database for the number of processors or we are reading another + * restart database for the number of processors or we are reading another * processor's data. */ TBOX_ASSERT(nproc == d_mpi.getSize()); TBOX_ASSERT(rank == d_mpi.getRank()); - d_boxes.getFromDatabase(*database.getDatabase("mapped_boxes")); + d_boxes.getFromRestart(*restart_db.getDatabase("mapped_boxes")); computeLocalRedundantData(); } @@ -1600,11 +1623,10 @@ operator << ( std::ostream& s, const BoxLevel::Outputter& format) { - if ( format.d_output_statistics ) { + if (format.d_output_statistics) { BoxLevelStatistics bls(format.d_level); bls.printBoxStats(s, format.d_border); - } - else { + } else { format.d_level.recursivePrint(s, format.d_border, format.d_detail_depth); } return s; @@ -1664,8 +1686,8 @@ BoxLevel::recursivePrint( << d_global_number_of_boxes << '\n' << border << "Cell count : " << d_local_number_of_cells << ", " << d_global_number_of_cells << '\n' - << border << "Bounding box : " << getLocalBoundingBox(0) << ", " - << (d_global_data_up_to_date ? getGlobalBoundingBox(0) : Box(getDim())) + << border << "Bounding box : " << getLocalBoundingBox(BlockId(0)) << ", " + << (d_global_data_up_to_date ? getGlobalBoundingBox(BlockId(0)) : Box(getDim())) << '\n' << border << "Comm,rank,nproc: " << d_mpi.getCommunicator() << ", " << d_mpi.getRank() << ", " << d_mpi.getSize() << '\n' @@ -1710,5 +1732,3 @@ BoxLevel::recursivePrint( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.h index 92d72296..b3021830 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevel.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Set of Boxes in the same "level". * ************************************************************************/ @@ -22,12 +22,24 @@ #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace hier { +/* + ***************************************************************************** + * IMPORTANT + * IF YOU ARE ADDING A NON-CONST METHOD IT MUST BE PREFACED WITH THE FOLLOWING + * CODE AS LOCKED BOX_LEVELS MAY NOT BE MODIFIED IN ANY WAY + * if (locked()) { + * TBOX_ERROR("BoxLevel::newMethodName(): operating on locked BoxLevel." + * << std::endl); + * } + ***************************************************************************** + */ + /*! * @brief A distributed set of Box objects which reside in the * same index space. @@ -89,25 +101,20 @@ class BoxLevel /*! * @brief Names of parallel states. */ - /* - * TODO: We should only have one enum for this. Currently, we have - * this one and a similar one in Connector.h. - */ enum ParallelState { DISTRIBUTED, GLOBALIZED }; /*! - * @brief Construct uninitialized object. - * - * Uninitialized objects can be initialized by calling initialize() - * or swapInitialize(). - * - * @see initialize() - * @see swapInitialize() + * @brief Construct a BoxLevel which will be initialized from the supplied + * restart database. * * @param[in] dim + * @param[in] restart_db + * @param[in] grid_geom */ - explicit BoxLevel( - const tbox::Dimension& dim); + BoxLevel( + const tbox::Dimension& dim, + tbox::Database& restart_db, + const boost::shared_ptr& grid_geom); /*! * @brief Copy constructor. @@ -128,15 +135,33 @@ class BoxLevel * @brief Constructs an empty, initialized object. * * @see addBox() + * @see initialize() + * + * @param[in] ratio + * @param[in] grid_geom + * @param[in] mpi + * @param[in] parallel_state + */ + BoxLevel( + const IntVector& ratio, + const boost::shared_ptr& grid_geom, + const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(), + const ParallelState parallel_state = DISTRIBUTED); + + /*! + * @brief Constructs a populated object. + * * @see addBox() * @see initialize() * + * @param[in] boxes * @param[in] ratio * @param[in] grid_geom * @param[in] mpi * @param[in] parallel_state */ BoxLevel( + const BoxContainer& boxes, const IntVector& ratio, const boost::shared_ptr& grid_geom, const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(), @@ -153,15 +178,15 @@ class BoxLevel //! @name Initialization and clearing methods /*! - * @brief Initialize the BoxLevel without and Boxes + * @brief Initialize the BoxLevel * * The content and state of the object before calling this function * is discarded. * * @see addBox() - * @see addBox() * @see initialize(const BoxContainer&, const IntVector&, const tbox::SAMRAI_MPI&, const ParallelState) * + * @param[in] boxes * @param[in] ratio * @param[in] grid_geom * @param[in] mpi @@ -169,6 +194,7 @@ class BoxLevel */ void initialize( + const BoxContainer& boxes, const IntVector& ratio, const boost::shared_ptr& grid_geom, const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(), @@ -195,6 +221,8 @@ class BoxLevel * @param[in] grid_geom * @param[in] mpi * @param[in] parallel_state + * + * @pre &boxes != &getBoxes() */ void swapInitialize( @@ -219,7 +247,7 @@ class BoxLevel bool isInitialized() const { - return d_ratio(0) != 0; + return d_ratio(0,0) != 0; } /*! @@ -256,6 +284,10 @@ class BoxLevel clearForBoxChanges( bool isInvalid = true) { + if (locked()) { + TBOX_ERROR("BoxLevel::clearForBoxChanges(): operating on locked BoxLevel." + << std::endl); + } deallocateGlobalizedVersion(); clearPersistentOverlapConnectors(); if (isInvalid) { @@ -284,6 +316,8 @@ class BoxLevel * Data not used by the new state gets deallocated. * * @param[in] parallel_state + * + * @pre isInitialized() */ void setParallelState( @@ -307,7 +341,9 @@ class BoxLevel * be accessed without further communications, until the object * changes. * - * Sets d_global_data_up_to_date; + * Sets d_global_data_up_to_date to true; + * + * @pre isInitialized() */ void cacheGlobalReducedData() const; @@ -329,6 +365,10 @@ class BoxLevel * BoxLevel is in DISTRIBUTED state and there is no cached * version yet), all processes must make this call at the same * point. + * + * @pre isInitialized() + * + * @post d_globalized_version->getParallelState() == GLOBALIZED */ const BoxLevel& getGlobalizedVersion() const; @@ -336,14 +376,17 @@ class BoxLevel /*! * @brief Deallocate the internal globalized version of the * BoxLevel, if there is any. + * + * @pre (d_globalized_version == 0) || + * (d_globalized_version->getParallelState() == GLOBALIZED) */ void deallocateGlobalizedVersion() const { - if (d_globalized_version != NULL) { + if (d_globalized_version != 0) { TBOX_ASSERT(d_globalized_version->getParallelState() == GLOBALIZED); delete d_globalized_version; - d_globalized_version = NULL; + d_globalized_version = 0; } } @@ -384,7 +427,7 @@ class BoxLevel * @brief Swap the contents of two BoxLevel objects. * * Swapping is a modifying operation, so the - * PersistentOverlapConnectorss of the operands are cleared. + * PersistentOverlapConnectors of the operands are cleared. * * Persistent Connectors are not swapped. This decision * was based on expected usage, which is that @@ -394,6 +437,10 @@ class BoxLevel * * @param[in,out] level_a * @param[in,out] level_b + * + * @pre (&level_a == &level_b) || + * !level_a.isInitialized() || !level_b.isInitialized() || + * (level_a.getDim() == level_b.getDim()) */ static void swap( @@ -455,6 +502,17 @@ class BoxLevel * invalidate other internal data. Use other methods for modifying * the BoxContainer. * + * @note It is possible that one may wish to perform repeated searches on + * the Boxes in the BoxContainer returned by this method. As noted in + * BoxContainer's documentation, it may be advantageous to call the makeTree + * method on the BoxContainer in this case. If you do, remember that the + * GridGeometry passed to makeTree must be the GridGeometry held by this + * BoxLevel. Thus the proper use of makeTree with the result of a call to + * this method will look like: + * @verbatim + * box_level.getBoxes().makeTree(box_level.getGridGeometry()); + * @endverbatim + * * @see getGlobalNumberOfBoxes() * @see getLocalNumberOfBoxes() * @@ -467,6 +525,17 @@ class BoxLevel /*! * @brief Returns the container of global Boxes. + * + * @note It is possible that one may wish to perform repeated searches on + * the Boxes in the BoxContainer returned by this method. As noted in + * BoxContainer's documentation, it may be advantageous to call the makeTree + * method on the BoxContainer in this case. If you do, remember that the + * GridGeometry passed to makeTree must be the GridGeometry held by this + * BoxLevel. Thus the proper use of makeTree with the result of a call to + * this method will look like: + * @verbatim + * box_level.getBoxes().makeTree(box_level.getGridGeometry()); + * @endverbatim */ const BoxContainer& getGlobalBoxes() const @@ -491,6 +560,8 @@ class BoxLevel /*! * @brief Returns the first LocalId, or one with a value of -1 if * no local Box exists. + * + * @pre isInitialized() */ LocalId getFirstLocalId() const; @@ -498,6 +569,8 @@ class BoxLevel /*! * @brief Returns the last LocalId, or one with a value of -1 if no * local Box exists. + * + * @pre isInitialized() */ LocalId getLastLocalId() const; @@ -516,8 +589,10 @@ class BoxLevel * @brief Return local number of boxes. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ - size_t + int getLocalNumberOfBoxes() const { TBOX_ASSERT(isInitialized()); @@ -529,11 +604,13 @@ class BoxLevel * * Periodic image Boxes are excluded. * - * Object must be in GLOBALIZED mode to use this method. - * * @param[in] rank + * + * @pre isInitialized() + * @pre (getParallelState() == GLOBALIZED) || (rank == getMPI().getRank()) + * @pre (rank >= 0) && (rank < getMPI().getSize()) */ - size_t + int getLocalNumberOfBoxes( int rank) const; @@ -546,6 +623,8 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ int getGlobalNumberOfBoxes() const @@ -564,6 +643,8 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ int getMaxNumberOfBoxes() const @@ -582,6 +663,8 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ int getMinNumberOfBoxes() const @@ -595,6 +678,8 @@ class BoxLevel * @brief Return local number of cells. * * Cells in periodic image Boxes are excluded. + * + * @pre isInitialized() */ size_t getLocalNumberOfCells() const @@ -612,8 +697,10 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ - int + size_t getMaxNumberOfCells() const { TBOX_ASSERT(isInitialized()); @@ -630,8 +717,10 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Periodic image Boxes are excluded. + * + * @pre isInitialized() */ - int + size_t getMinNumberOfCells() const { TBOX_ASSERT(isInitialized()); @@ -644,9 +733,11 @@ class BoxLevel * * Cells in periodic image Boxes are excluded. * - * Object must be in GLOBALIZED mode to use this method. - * * @param[in] rank + * + * @pre isInitialized() + * @pre (getParallelState() == GLOBALIZED) || (rank == getMPI().getRank()) + * @pre (rank >= 0) && (rank < getMPI().getSize()) */ size_t getLocalNumberOfCells( @@ -661,8 +752,10 @@ class BoxLevel * communication is needed, call cacheGlobalReducedData() first. * * Cells in periodic image Boxes are excluded. + * + * @pre isInitialized() */ - int + size_t getGlobalNumberOfCells() const { TBOX_ASSERT(isInitialized()); @@ -675,9 +768,9 @@ class BoxLevel */ const Box& getLocalBoundingBox( - int block_number) const + const BlockId& block_id) const { - return d_local_bounding_box[block_number]; + return d_local_bounding_box[block_id.getBlockValue()]; } /*! @@ -690,10 +783,10 @@ class BoxLevel */ const Box& getGlobalBoundingBox( - int block_number) const + const BlockId& block_id) const { cacheGlobalReducedData(); - return d_global_bounding_box[block_number]; + return d_global_bounding_box[block_id.getBlockValue()]; } /*! @@ -701,9 +794,9 @@ class BoxLevel */ const IntVector& getLocalMaxBoxSize( - int block_number) const + const BlockId& block_id) const { - return d_local_max_box_size[block_number]; + return d_local_max_box_size[block_id.getBlockValue()]; } /*! @@ -711,9 +804,9 @@ class BoxLevel */ const IntVector& getLocalMinBoxSize( - int block_number) const + const BlockId& block_id) const { - return d_local_min_box_size[block_number]; + return d_local_min_box_size[block_id.getBlockValue()]; } /*! @@ -726,10 +819,10 @@ class BoxLevel */ const IntVector& getGlobalMaxBoxSize( - int block_number) const + const BlockId& block_id) const { cacheGlobalReducedData(); - return d_global_max_box_size[block_number]; + return d_global_max_box_size[block_id.getBlockValue()]; } /*! @@ -742,17 +835,14 @@ class BoxLevel */ const IntVector& getGlobalMinBoxSize( - int block_number) const + const BlockId& block_id) const { cacheGlobalReducedData(); - return d_global_min_box_size[block_number]; + return d_global_min_box_size[block_id.getBlockValue()]; } /*! * @brief Return the dimension of this object. - * - * If object has never been initialized, return - * tbox::Dimension::getInvalidDimension(). */ const tbox::Dimension& getDim() const @@ -777,12 +867,6 @@ class BoxLevel //! @name Methods to modify all Boxes. /* - *************************************************************************** - * TODO: This method puts finer in an inconsistent state by not - * updating the attributes depenent on what has been changed. This - * method seems to be an initializer, but it is not clear from the - * name or documentation if that is so. The same goes for coarsenBoxes. - *************************************************************************** */ /*! * @brief Refine all Boxes of this BoxLevel by ratio placing result into @@ -798,10 +882,20 @@ class BoxLevel const IntVector& ratio, const IntVector& final_ratio) const { + finer.detachMyHandle(); + if (finer.d_globalized_version) { + delete finer.d_globalized_version; + finer.d_globalized_version = 0; + } finer.d_boxes = d_boxes; finer.d_boxes.refine(ratio); + finer.d_parallel_state = d_parallel_state; + if (finer.d_parallel_state == GLOBALIZED) { + finer.d_global_boxes = d_global_boxes; + finer.d_global_boxes.refine(ratio); + } finer.d_ratio = final_ratio; - return; + finer.computeLocalRedundantData(); } /*! @@ -818,10 +912,20 @@ class BoxLevel const IntVector& ratio, const IntVector& final_ratio) const { + coarser.detachMyHandle(); + if (coarser.d_globalized_version) { + delete coarser.d_globalized_version; + coarser.d_globalized_version = 0; + } coarser.d_boxes = d_boxes; coarser.d_boxes.coarsen(ratio); + coarser.d_parallel_state = d_parallel_state; + if (coarser.d_parallel_state == GLOBALIZED) { + coarser.d_global_boxes = d_global_boxes; + coarser.d_global_boxes.coarsen(ratio); + } coarser.d_ratio = final_ratio; - return; + coarser.computeLocalRedundantData(); } //@} @@ -830,49 +934,44 @@ class BoxLevel //! @name Individual Box methods. - /* - * TODO: Why the vacant index thing? The comments say that the - * box will be assigned an unused index. Isn't this a "vacant" index? - * - * TODO: Why does the first method require "distributed" state and the ones - * after require GLOBALIZED state for a remote box? These comments - * are inconsistent and confusing. I think it would be best to have the - * same pre/post conditions apply to all similar methods (e.g., "add box" - * methods), then describe them once rather than repeat (potentially - * inconsistently for each method). - */ - /*! * @brief Create new local Box from given Box and add it to this * level. * - * The new Box will be assigned an unused local index. To be + * The new Box will be assigned an unused local index, so the input + * box need not have a valid one. To be * efficient, no communication will be used. Therefore, the state * must be distributed. * * The new Box will have a periodic shift number * corresponding to zero-shift. * - * It is faster not to request a vacant index when adding a box. + * @note It is imperative that applications which call addBox also call + * invalidateGlobalData. It is possible for some processes to add Boxes and + * for others to not. Since the addBox method sets d_global_data_up_to_date + * to false, some processes in this situation will have this flag set to + * true and others will not. This will result in a hang in + * cacheGlobalReducedData when global data is accessed. We could have + * performed and allReduce of this flag to the top of cacheGlobalReducedData + * but this would have added a costly call for every access of global data. * * @param[in] box * @param[in] block_id - * @param[in] use_vacant_index * * @return iterator to the new Box + * + * @pre getParallelState() == DISTRIBUTED + * @pre (box.getBlockId() == BlockId::invalidId()) || + * (box.getBlockId() == block_id) */ BoxContainer::const_iterator addBox( const Box& box, - const BlockId& block_id, - const bool use_vacant_index = true); + const BlockId& block_id); /*! * @brief Add a Box to this level. * - * Adding a remote Box is allowed if the object is in - * GLOBALIZED mode. - * * @par CAUTION * To be efficient, no checks are made to make sure the * BoxLevel representation is consistent across all @@ -885,8 +984,14 @@ class BoxLevel * * It is an error to add any Box that already exists. * - * FIXME: Should we prevent this operation if persistent overlap - * Connectors are attached to this object? + * @note It is imperative that applications which call addBox also call + * invalidateGlobalData. It is possible for some processes to add Boxes and + * for others to not. Since the addBox method sets d_global_data_up_to_date + * to false, some processes in this situation will have this flag set to + * true and others will not. This will result in a hang in + * cacheGlobalReducedData when global data is accessed. We could have + * performed and allReduce of this flag to the top of cacheGlobalReducedData + * but this would have added a costly call for every access of global data. * * @param[in] box */ @@ -907,33 +1012,33 @@ class BoxLevel addBoxWithoutUpdate( const Box& box) { - if (d_parallel_state == GLOBALIZED) { + if (locked()) { + TBOX_ERROR("BoxLevel::addBoxWithoutUpdate(): operating on locked BoxLevel." + << std::endl); + } + if (getParallelState() == GLOBALIZED) { d_global_boxes.insert(box); } d_boxes.insert(box); - return; } /*! * @brief Insert given periodic image of an existing Box. * - * Adding a remote Box is allowed if the object is in - * GLOBALIZED mode. - * * Unlike adding a regular Box, it is OK to add a periodic * image Box that already exists. However, that is a no-op. * * @par CAUTION * To be efficient, no checks are made to make sure the * BoxLevel representation is consistent across all - * processors. Setting inconsistent data leads potentially elusive - * bugs. + * processors. Setting inconsistent data leads to potentially + * elusive bugs. * * @par Errors * It is an error to add a periodic image of a Box that does * not exist. * - * FIXME: Should we prevent this operation if persistent overlap + * TODO: Should we prevent this operation if persistent overlap * Connectors are attached to this object? * * @param[in] existing_box An existing Box for reference. @@ -942,6 +1047,8 @@ class BoxLevel * position. * @param[in] shift_number The valid shift number for the Box being * added. The shift amount is taken from the PeriodicShiftCatalog. + * + * @pre shift_number != getGridGeometry()->getPeriodicShiftCatalog().getZeroShiftNumber() */ void addPeriodicBox( @@ -958,10 +1065,23 @@ class BoxLevel * * Erasing a Box also erases all of its periodic images. * - * FIXME: Should we prevent this operation if the object has + * TODO: Should we prevent this operation if the object has * persistent overlap Connectors? * + * @note It is imperative that applications which call eraseBox also call + * invalidateGlobalData. It is possible for some processes to erase Boxes + * and for others to not. Since the eraseBox method sets + * d_global_data_up_to_date to false, some processes in this situation will + * have this flag set to true and others will not. This will result in a + * hang in cacheGlobalReducedData when global data is accessed. We could + * have performed and allReduce of this flag to the top of + * cacheGlobalReducedData but this would have erased a costly call for every + * access of global data. + * * @param[in] ibox The iterator of the Box to erase. + * + * @pre getParallelState() == DISTRIBUTED + * @pre ibox == getBoxes().find(*ibox) */ void eraseBox( @@ -976,10 +1096,23 @@ class BoxLevel * * Erasing a Box also erases all of its periodic images. * - * FIXME: Should we prevent this operation if the object has + * TODO: Should we prevent this operation if the object has * persistent overlap Connectors? * + * @note It is imperative that applications which call eraseBox also call + * invalidateGlobalData. It is possible for some processes to erase Boxes + * and for others to not. Since the eraseBox method sets + * d_global_data_up_to_date to false, some processes in this situation will + * have this flag set to true and others will not. This will result in a + * hang in cacheGlobalReducedData when global data is accessed. We could + * have performed and allReduce of this flag to the top of + * cacheGlobalReducedData but this would have erased a costly call for every + * access of global data. + * * @param[in] box + * + * @pre getParallelState() == DISTRIBUTED + * @pre getBoxes().find(box) != getBoxes().end() */ void eraseBox( @@ -998,8 +1131,11 @@ class BoxLevel eraseBoxWithoutUpdate( const Box& box) { + if (locked()) { + TBOX_ERROR("BoxLevel::eraseBoxWithoutUpdate(): operating on locked BoxLevel." + << std::endl); + } d_boxes.erase(box); - return; } /*! @@ -1015,19 +1151,22 @@ class BoxLevel * * @return Iterator to the box, or @c * getBoxes(owner).end() if box does not exist in set. + * + * @pre (box.getOwnerRank() == getMPI().getRank()) || + * (getParallelState() == GLOBALIZED) */ BoxContainer::const_iterator getBox( const Box& box) const { - if (box.getOwnerRank() == d_mpi.getRank()) { + if (box.getOwnerRank() == getMPI().getRank()) { return d_boxes.find(box); } else { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_parallel_state != GLOBALIZED) { + if (getParallelState() != GLOBALIZED) { TBOX_ERROR( "BoxLevel::getBox: cannot get remote box " - << box << " without being in globalized state."); + << box << " without being in globalized state." << std::endl); } #endif return d_global_boxes.find(box); @@ -1071,13 +1210,15 @@ class BoxLevel * invalidate other internal data. Use other methods for modifying * the BoxContainer. * - * @par Assertions - * Throws an unrecoverable assertion if the Box does not - * exist. - * * @param[in] box * * @return Iterator to the box. + * + * @pre ((box.getOwnerRank() == getMPI().getRank()) && + * (getBoxes().find(box) != getBoxes().end())) || + * ((box.getOwnerRank() != getMPI().getRank()) && + * (getParallelState() == GLOBALIZED) && + * (getGlobalBoxes().find(box) != getGlobalBoxes().end())) */ BoxContainer::const_iterator getBoxStrict( @@ -1090,12 +1231,13 @@ class BoxLevel * invalidate other internal data. Use other methods for modifying * the BoxContainer. * - * @par Assertions - * Throw an unrecoverable assertion if the Box does not exist. - * * @param[in] box_id * * @return Iterator to the box. + * + * @pre (box_id.getOwnerRank() == getMPI().getRank()) || + * (getParallelState() == GLOBALIZED) + * @pre box with supplied BoxId exists in the BoxLevel */ BoxContainer::const_iterator getBoxStrict( @@ -1156,6 +1298,9 @@ class BoxLevel * BoxId of the given box. * * @param[in] box + * + * @pre (box.getOwnerRank() == getMPI().getRank()) || + * (getParallelState() == GLOBALIZED) */ bool hasBox( @@ -1169,67 +1314,221 @@ class BoxLevel */ /*! - * @brief Write the BoxLevel to a database. + * @brief Write the BoxLevel to a restart database. * * Write only local parts regardless of parallel state (to avoid * writing tons of repetitive data). * - * @par Assertions - * Check that database is a non-null Pointer. + * @param[in,out] restart_db + */ + void + putToRestart( + const boost::shared_ptr& restart_db) const; + + //@} + + /*! + * @brief Sets d_global_data_up_to_date to false. Must be called after + * calls to addBox or eraseBox. * - * @param[in,out] database + * @see addBox() + * @see eraseBox() */ void - putUnregisteredToDatabase( - const boost::shared_ptr& database) const; + invalidateGlobalData() + { + if (locked()) { + TBOX_ERROR("BoxLevel::invalidateGlobalData(): operating on locked BoxLevel." + << std::endl); + } + d_global_data_up_to_date = false; + } /*! - * @brief Read the BoxLevel from a database. + * @brief Deallocate persistent overlap Connectors, if there are any. + */ + void + clearPersistentOverlapConnectors() + { + if (d_persistent_overlap_connectors != 0) { + d_persistent_overlap_connectors->clear(); + } + } + + /*! + * @brief Find an overlap Connector with the given head and minimum + * Connector width. If the specified Connector is not found, take the + * specified action. * - * Put the BoxLevel in the DISTRIBUTED parallel state and - * read only local parts. + * If multiple Connectors fit the criteria, the one with the + * smallest ghost cell width (based on the algebraic sum of the + * components) is selected. * - * If the BoxLevel is initialized, use its SAMRAI_MPI object - * and require its refinement ratio to match that in the database. - * If the BoxLevel is uninitialized, it will be initialized - * to use tbox::SAMRAI_MPI::getSAMRAIWorld() for the SAMRAI_MPI - * object. Note that these behaviors have not been extensively - * discussed by the SAMRAI developers and may be subject to change. + * @param[in] head Find the overlap Connector with this specified head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum Connector width. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. * - * @par Assertions - * Check that database is a non-null Pointer. + * @return The Connector which matches the search criterion. * - * @param[in,out] database - * @param[in] grid_geom + * @pre isInitialized() + * @pre head.isInitialized() */ - void - getFromDatabase( - tbox::Database& database, - const boost::shared_ptr& grid_geom); + const Connector& + findConnector( + const BoxLevel& head, + const IntVector& min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true) const + { + return getPersistentOverlapConnectors().findConnector(head, + min_connector_width, + not_found_action, + exact_width_only); + } - //@} + /*! + * @brief Find an overlap Connector with its transpose with the given head + * and minimum Connector widths. If the specified Connector is not found, + * take the specified action. + * + * If multiple Connectors fit the criteria, the one with the + * smallest ghost cell width (based on the algebraic sum of the + * components) is selected. + * + * @param[in] head Find the overlap Connector with this specified head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum Connector width. + * @param[in] transpose_min_connector_width Find the transpose overlap + * Connector satisfying this minimum Connector width. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. + * + * @return The Connector which matches the search criterion. + * + * @pre isInitialized() + * @pre head.isInitialized() + */ + const Connector& + findConnectorWithTranspose( + const BoxLevel& head, + const IntVector& min_connector_width, + const IntVector& transpose_min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true) const + { + return getPersistentOverlapConnectors().findConnectorWithTranspose(head, + min_connector_width, + transpose_min_connector_width, + not_found_action, + exact_width_only); + } /*! - * @brief Get the collection of overlap Connectors dedicated to - * provide overlap neighbors for this BoxLevel. + * @brief Create an overlap Connector, computing relationships by + * globalizing data. * - * The PersistentOverlapConnectors provides overlap neighbors for - * this BoxLevel. Its role is to create and manage - * persistent overlap Connectors based at this BoxLevel and - * persisting until the BoxLevel changes (so they should not - * be set up until the BoxLevel is in its final state). This - * is the mechanism by which code that can efficiently generate the - * overlap Connectors (usually the code that generated the - * BoxLevel) provides overlap data to code using the - * BoxLevel. The PersistentOverlapConnectors are guaranteed - * to be correct, so any changes to the BoxLevel will cause - * current Connectors to be deallocated. + * The base will be this BoxLevel. + * Find Connector relationships using a (non-scalable) global search. * - * @see PersistentOverlapConnectors for instructions on creating - * the Connectors. + * @see Connector + * @see Connector::initialize() + * + * @param[in] head This BoxLevel will be the head. + * @param[in] connector_width + * + * @return A const reference to the newly created overlap Connector. + * + * @pre isInitialized() + * @pre head.isInitialized() */ - PersistentOverlapConnectors& - getPersistentOverlapConnectors() const; + const Connector& + createConnector( + const BoxLevel& head, + const IntVector& connector_width) const + { + return getPersistentOverlapConnectors().createConnector(head, + connector_width); + } + + /*! + * @brief Create an overlap Connector with its transpose, computing + * relationships by globalizing data. + * + * The base will be this BoxLevel. + * Find Connector relationships using a (non-scalable) global search. + * + * @see Connector + * @see Connector::initialize() + * + * @param[in] head This BoxLevel will be the head. + * @param[in] connector_width + * @param[in] transpose_connector_width + * + * @return A const reference to the newly created overlap Connector. + * + * @pre isInitialized() + * @pre head.isInitialized() + */ + const Connector& + createConnectorWithTranspose( + const BoxLevel& head, + const IntVector& connector_width, + const IntVector& transpose_connector_width) const + { + return getPersistentOverlapConnectors().createConnectorWithTranspose(head, + connector_width, + transpose_connector_width); + } + + /*! + * @brief Cache the supplied overlap Connector and its transpose + * if it exists. + * + * @param[in] connector + * + * @pre isInitialized() + * @pre connector + */ + void + cacheConnector( + boost::shared_ptr& connector) const + { + return getPersistentOverlapConnectors().cacheConnector(connector); + } + + /*! + * @brief Returns whether the object has overlap + * Connectors with the given head and minimum Connector + * width. + * + * TODO: does the following comment mean that this must be called + * before the call to findConnector? + * + * If this returns true, the Connector fitting the specification + * exists and findConnector() will not throw an assertion. + * + * @param[in] head Find the overlap Connector with this specified head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum ghost cell width. + * + * @return True if a Connector is found, otherwise false. + */ + bool + hasConnector( + const BoxLevel& head, + const IntVector& min_connector_width) const + { + return getPersistentOverlapConnectors().hasConnector(head, + min_connector_width); + } /* * TODO: The following method is "not for general use" and indeed @@ -1270,6 +1569,8 @@ class BoxLevel * @see BoxLevelHandle. * * @return A boost::shared_ptr to the BoxLevelHandle + * + * @pre !d_handle || (d_handle->d_box_level == this) */ const boost::shared_ptr& getBoxLevelHandle() const @@ -1285,11 +1586,30 @@ class BoxLevel * Sanity check: The handle for this object should be attached * to this object. */ - TBOX_ERROR("Library error in BoxLevelHandle::getBoxLevel"); + TBOX_ERROR("Library error in BoxLevelHandle::getBoxLevel" << std::endl); } return d_handle; } + /*! + * @brief Effectively makes a non-const BoxLevel const. Prevents any + * non-const method from executing. + */ + void + lock() + { + d_locked = true; + } + + /*! + * @brief Returns true if the BoxLevel is locked. + */ + bool + locked() + { + return d_locked; + } + //@{ /*! @@ -1307,7 +1627,7 @@ class BoxLevel recursivePrint( std::ostream& os, const std::string& border, - int detail_depth = 0) const; + int detail_depth = 2) const; /*! * @brief A class for outputting BoxLevel. @@ -1343,9 +1663,9 @@ class BoxLevel Outputter( const BoxLevel& box_level, const std::string& border, - int detail_depth = 0, + int detail_depth = 2, bool output_statistics = false); - void + Outputter& operator = ( const Outputter& r); // Unimplemented private. const BoxLevel& d_level; @@ -1360,8 +1680,7 @@ class BoxLevel * * Usage example: * @code - * std::cout << "my box_level:\n" - * << box_level.format(" ", 2) << std::endl; + * tbox::plog << "my box_level:\n" << box_level.format() << endl; * @endcode * * @param[in] border @@ -1370,7 +1689,7 @@ class BoxLevel Outputter format( const std::string& border = std::string(), - int detail_depth = 0) const; + int detail_depth = 2) const; /*! * @brief Return a object that can format the BoxLevel for @@ -1390,52 +1709,19 @@ class BoxLevel //@} - /*! - * @brief Allows std::vector to allocate objects with - * uninitialized dimensions. - */ - friend class std::vector; - - /*! - * @brief Set up things for the entire class. - * - * Only called by StartupShutdownManager. - */ - static void - initializeCallback() - { - t_initialize_private = tbox::TimerManager::getManager()-> - getTimer("hier::BoxLevel::initializePrivate()"); - t_acquire_remote_boxes = tbox::TimerManager::getManager()-> - getTimer("hier::BoxLevel::acquireRemoteBoxes()"); - t_cache_global_reduced_data = tbox::TimerManager::getManager()-> - getTimer("hier::BoxLevel::cacheGlobalReducedData()"); - } - - /*! - * @brief Free static timers. - * - * Only called by StartupShutdownManager. - */ - static void - finalizeCallback() - { - t_initialize_private.reset(); - t_acquire_remote_boxes.reset(); - t_cache_global_reduced_data.reset(); - } - private: + friend class PersistentOverlapConnectors; + /* * Static integer constant describing class's version number. */ - static const int HIER_MAPPED_BOX_LEVEL_VERSION; + static const int HIER_BOX_LEVEL_VERSION; /* * Static integer constant describing the number of statistics in this * class. */ - static const int MAPPED_BOX_LEVEL_NUMBER_OF_STATS; + static const int BOX_LEVEL_NUMBER_OF_STATS; /* * TODO: This same enum is defined in the Connector header. @@ -1446,13 +1732,8 @@ class BoxLevel */ enum { BAD_INT = (1 << (8 * sizeof(int) - 2)) }; - /*! - * @brief Construct uninitialized object. - * - * Constructor creates an uninitialized object in distributed state. - * - * Private to limit where an uninitialized object can - * be created. + /* + * Unimplemented default constructor. */ BoxLevel(); @@ -1513,15 +1794,26 @@ class BoxLevel //@} /*! - * @brief Deallocate persistent overlap Connectors, if there are any. + * @brief Get the collection of overlap Connectors dedicated to + * provide overlap neighbors for this BoxLevel. + * + * The PersistentOverlapConnectors provides overlap neighbors for + * this BoxLevel. Its role is to create and manage + * persistent overlap Connectors based at this BoxLevel and + * persisting until the BoxLevel changes (so they should not + * be set up until the BoxLevel is in its final state). This + * is the mechanism by which code that can efficiently generate the + * overlap Connectors (usually the code that generated the + * BoxLevel) provides overlap data to code using the + * BoxLevel. The PersistentOverlapConnectors are guaranteed + * to be correct, so any changes to the BoxLevel will cause + * current Connectors to be deallocated. + * + * @see PersistentOverlapConnectors for instructions on creating + * the Connectors. */ - void - clearPersistentOverlapConnectors() - { - if (d_persistent_overlap_connectors != NULL) { - d_persistent_overlap_connectors->clear(); - } - } + PersistentOverlapConnectors& + getPersistentOverlapConnectors() const; /*! * @brief Detach this object from the handle it has been using. @@ -1530,9 +1822,10 @@ class BoxLevel * be able to access this BoxLevel by the handle. */ void - detachMyHandle() const + detachMyHandle() { if (d_handle) { + clearPersistentOverlapConnectors(); d_handle->detachMyBoxLevel(); d_handle.reset(); } @@ -1541,6 +1834,8 @@ class BoxLevel /*! * @brief Encapsulates functionality common to all initialization * functions. + * + * @pre getDim() == ratio.getDim() */ void initializePrivate( @@ -1549,6 +1844,56 @@ class BoxLevel const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(), const ParallelState parallel_state = DISTRIBUTED); + /*! + * @brief Read the BoxLevel from a restart database. + * + * Put the BoxLevel in the DISTRIBUTED parallel state and + * read only local parts. + * + * If the BoxLevel is initialized, use its SAMRAI_MPI object + * and require its refinement ratio to match that in the database. + * If the BoxLevel is uninitialized, it will be initialized + * to use tbox::SAMRAI_MPI::getSAMRAIWorld() for the SAMRAI_MPI + * object. Note that these behaviors have not been extensively + * discussed by the SAMRAI developers and may be subject to change. + * + * @param[in,out] restart_db + * @param[in] grid_geom + */ + void + getFromRestart( + tbox::Database& restart_db, + const boost::shared_ptr& grid_geom); + + /*! + * @brief Set up things for the entire class. + * + * Only called by StartupShutdownManager. + */ + static void + initializeCallback() + { + t_initialize_private = tbox::TimerManager::getManager()-> + getTimer("hier::BoxLevel::initializePrivate()"); + t_acquire_remote_boxes = tbox::TimerManager::getManager()-> + getTimer("hier::BoxLevel::acquireRemoteBoxes()"); + t_cache_global_reduced_data = tbox::TimerManager::getManager()-> + getTimer("hier::BoxLevel::cacheGlobalReducedData()"); + } + + /*! + * @brief Free static timers. + * + * Only called by StartupShutdownManager. + */ + static void + finalizeCallback() + { + t_initialize_private.reset(); + t_acquire_remote_boxes.reset(); + t_cache_global_reduced_data.reset(); + } + /*! * @brief BoxLevel is a parallel object, * and this describes its MPI object. @@ -1593,25 +1938,21 @@ class BoxLevel * * This is mutable because it depends on the Boxes and may be * saved by a const object if computed. - * - * A value < 0 means it has not been computed. */ - mutable int d_global_number_of_cells; + mutable size_t d_global_number_of_cells; /*! * @brief Local Box count, excluding periodic images. * * Unlike d_global_number_of_boxes, this parameter is always current. */ - size_t d_local_number_of_boxes; + int d_local_number_of_boxes; /*! * @brief Global box count, excluding periodic images. * * This is mutable because it depends on the Boxes and may be * saved by a const object if computed. - * - * A value < 0 means it has not been computed. */ mutable int d_global_number_of_boxes; @@ -1620,9 +1961,9 @@ class BoxLevel //! @brief Global min box count on any proc, excluding periodic images. mutable int d_min_number_of_boxes; //! @brief Global max cell count on any proc, excluding periodic images. - mutable int d_max_number_of_cells; + mutable size_t d_max_number_of_cells; //! @brief Global min cell count on any proc, excluding periodic images. - mutable int d_min_number_of_cells; + mutable size_t d_min_number_of_cells; //! @brief Max size of largest local box, one for each block. std::vector d_local_max_box_size; @@ -1636,17 +1977,14 @@ class BoxLevel /*! * @brief Bounding box of local Boxes, excluding periodic images. * One for each block. - * - * This is mutable because it depends on the Boxes and may be - * saved by a const object if computed. */ - mutable std::vector d_local_bounding_box; + std::vector d_local_bounding_box; /*! * @brief Whether d_local_bounding_box is up to date (or needs * recomputing. */ - mutable bool d_local_bounding_box_up_to_date; + bool d_local_bounding_box_up_to_date; /*! * @brief Bounding box of global Boxes, excluding periodic images. @@ -1725,6 +2063,8 @@ class BoxLevel */ boost::shared_ptr d_grid_geometry; + bool d_locked; + /*! * @brief A LocalId object with value of -1. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.C index 72bcb361..66be4cdf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utilities for working on DLBG edges. * ************************************************************************/ -#ifndef included_hier_BoxLevelConnectorUtils_C -#define included_hier_BoxLevelConnectorUtils_C - #include "SAMRAI/hier/BoxLevelConnectorUtils.h" #include "SAMRAI/hier/BoxContainer.h" @@ -18,9 +15,10 @@ #include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/StartupShutdownManager.h" +#include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/TimerManager.h" -#include +#include "boost/make_shared.hpp" #include #include #include @@ -28,18 +26,16 @@ namespace SAMRAI { namespace hier { -boost::shared_ptr BoxLevelConnectorUtils::t_make_sorting_map; -boost::shared_ptr BoxLevelConnectorUtils::t_compute_external_parts; -boost::shared_ptr BoxLevelConnectorUtils::t_compute_external_parts_intersection; -boost::shared_ptr BoxLevelConnectorUtils::t_compute_internal_parts; -boost::shared_ptr BoxLevelConnectorUtils::t_compute_internal_parts_intersection; +const std::string BoxLevelConnectorUtils::s_default_timer_prefix("hier::BoxLevelConnectorUtils"); +std::map BoxLevelConnectorUtils::s_static_timers; +char BoxLevelConnectorUtils::s_ignore_external_timer_prefix('\0'); tbox::StartupShutdownManager::Handler -BoxLevelConnectorUtils::s_initialize_finalize_handler( +BoxLevelConnectorUtils::s_initialize_handler( BoxLevelConnectorUtils::initializeCallback, 0, 0, - BoxLevelConnectorUtils::finalizeCallback, + 0, tbox::StartupShutdownManager::priorityTimers); /* @@ -50,6 +46,43 @@ BoxLevelConnectorUtils::BoxLevelConnectorUtils(): d_sanity_check_precond(false), d_sanity_check_postcond(false) { + getFromInput(); + setTimerPrefix(s_default_timer_prefix); +} + +/* + *********************************************************************** + *********************************************************************** + */ +BoxLevelConnectorUtils::~BoxLevelConnectorUtils() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxLevelConnectorUtils::getFromInput() +{ + if (s_ignore_external_timer_prefix == '\0') { + s_ignore_external_timer_prefix = 'n'; + if (tbox::InputManager::inputDatabaseExists()) { + boost::shared_ptr idb( + tbox::InputManager::getInputDatabase()); + if (idb->isDatabase("BoxLevelConnectorUtils")) { + boost::shared_ptr blcu_db( + idb->getDatabase("BoxLevelConnectorUtils")); + s_ignore_external_timer_prefix = + blcu_db->getCharWithDefault("DEV_ignore_external_timer_prefix", + 'n'); + if (!(s_ignore_external_timer_prefix == 'n' || + s_ignore_external_timer_prefix == 'y')) { + INPUT_VALUE_ERROR("DEV_ignore_external_timer_prefix"); + } + } + } + } } /* @@ -71,18 +104,18 @@ BoxLevelConnectorUtils::baseNestsInHead( tbox::Dimension dim(head.getDim()); - TBOX_DIM_ASSERT_CHECK_ARGS2(head_nesting_margin, base_swell); + TBOX_ASSERT_OBJDIM_EQUALITY2(head_nesting_margin, base_swell); TBOX_ASSERT(head.getMPI() == base.getMPI()); #ifdef DEBUG_CHECK_ASSERTIONS - const IntVector& zero_vector(IntVector::getZero(dim)); + const IntVector& zero_vector = IntVector::getZero(dim); TBOX_ASSERT(base_swell >= zero_vector); TBOX_ASSERT(head_swell >= zero_vector); TBOX_ASSERT(head_nesting_margin >= zero_vector); #endif - IntVector required_gcw = base_swell; + IntVector required_gcw(base_swell); if (head.getRefinementRatio() <= base.getRefinementRatio()) { const IntVector ratio = base.getRefinementRatio() / head.getRefinementRatio(); @@ -91,25 +124,24 @@ BoxLevelConnectorUtils::baseNestsInHead( const IntVector ratio = head.getRefinementRatio() / base.getRefinementRatio(); required_gcw += IntVector::ceilingDivide( - (head_swell + head_nesting_margin), - ratio); + (head_swell + head_nesting_margin), + ratio); } else { TBOX_ERROR("BoxLevelConnectorUtils::baseNestsInHead: head index space\n" << "must be either a refinement or a coarsening of\n" - << "base, but not both."); + << "base, but not both." << std::endl); } - Connector base_to_head( + boost::shared_ptr base_to_head; + OverlapConnectorAlgorithm oca; + oca.findOverlaps(base_to_head, base, head, required_gcw); - OverlapConnectorAlgorithm oca; - oca.findOverlaps(base_to_head); - bool rval = baseNestsInHead( locally_nests, - base_to_head, + *base_to_head, base_swell, head_swell, head_nesting_margin, @@ -144,7 +176,7 @@ BoxLevelConnectorUtils::baseNestsInHead( const IntVector& head_nesting_margin, const BoxContainer* domain) const { - TBOX_DIM_ASSERT_CHECK_ARGS3( + TBOX_ASSERT_OBJDIM_EQUALITY3( connector.getBase(), base_swell, head_nesting_margin); TBOX_ASSERT(connector.isFinalized()); const tbox::Dimension& dim(connector.getBase().getDim()); @@ -168,11 +200,9 @@ BoxLevelConnectorUtils::baseNestsInHead( if (!(connector.getConnectorWidth() >= required_gcw)) { TBOX_ERROR("BoxLevelConnectorUtils::baseNestsInHead: connector lacks\n" << "sufficient ghost cell width for determining whether its base\n" - << "nests inside its head."); + << "nests inside its head." << std::endl); } - OverlapConnectorAlgorithm oca; - const BoxLevel& base = connector.getBase(); const BoxLevel& head = connector.getHead(); const boost::shared_ptr& grid_geom( @@ -188,48 +218,48 @@ BoxLevelConnectorUtils::baseNestsInHead( * head_nesting_margin. */ - BoxLevel swelledbase(dim); - if (base_swell == IntVector::getZero(dim)) { - swelledbase = base; + boost::shared_ptr swelledbase; + if (base_swell == 0) { + swelledbase.reset(new BoxLevel(base)); } else { - const BoxContainer& base_mapped_boxes = base.getBoxes(); - swelledbase.initialize( - base.getRefinementRatio(), - grid_geom, - base.getMPI()); - for (BoxContainer::const_iterator ni = base_mapped_boxes.begin(); - ni != base_mapped_boxes.end(); ++ni) { - Box swelledbase_mapped_box(*ni); - swelledbase_mapped_box.grow(base_swell); - swelledbase.addBoxWithoutUpdate(swelledbase_mapped_box); + const BoxContainer& base_boxes = base.getBoxes(); + swelledbase.reset(new BoxLevel( + base.getRefinementRatio(), + grid_geom, + base.getMPI())); + for (BoxContainer::const_iterator ni = base_boxes.begin(); + ni != base_boxes.end(); ++ni) { + Box swelledbase_box(*ni); + swelledbase_box.grow(base_swell); + swelledbase->addBoxWithoutUpdate(swelledbase_box); } - swelledbase.finalize(); + swelledbase->finalize(); } - BoxLevel swelledhead(dim); - if (head_swell == IntVector::getZero(dim)) { - swelledhead = head; + boost::shared_ptr swelledhead; + if (head_swell == 0) { + swelledhead.reset(new BoxLevel(head)); } else { - const BoxContainer& head_mapped_boxes = head.getBoxes(); + const BoxContainer& head_boxes = head.getBoxes(); - swelledhead.initialize( - head.getRefinementRatio(), - grid_geom, - head.getMPI()); + swelledhead.reset(new BoxLevel( + head.getRefinementRatio(), + grid_geom, + head.getMPI())); - for (BoxContainer::const_iterator ni = head_mapped_boxes.begin(); - ni != head_mapped_boxes.end(); ++ni) { - Box swelledhead_mapped_box(*ni); + for (BoxContainer::const_iterator ni = head_boxes.begin(); + ni != head_boxes.end(); ++ni) { + Box swelledhead_box(*ni); - swelledhead_mapped_box.grow(head_swell); - swelledhead.addBoxWithoutUpdate(swelledhead_mapped_box); + swelledhead_box.grow(head_swell); + swelledhead->addBoxWithoutUpdate(swelledhead_box); } - swelledhead.finalize(); + swelledhead->finalize(); } Connector swelledbase_to_swelledhead(connector); - swelledbase_to_swelledhead.setBase(swelledbase); - swelledbase_to_swelledhead.setHead(swelledhead); + swelledbase_to_swelledhead.setBase(*swelledbase); + swelledbase_to_swelledhead.setHead(*swelledhead); swelledbase_to_swelledhead.setWidth( connector.getConnectorWidth() - base_swell, true); @@ -237,7 +267,7 @@ BoxLevelConnectorUtils::baseNestsInHead( swelledbase_to_swelledhead.growLocalNeighbors(head_swell); if (d_sanity_check_precond && - head_swell == IntVector::getZero(dim)) { + head_swell == 0) { /* * If head was swelled, it may generate undetected overlaps that * cannot be compensated for by shrinking the connector width. @@ -245,11 +275,11 @@ BoxLevelConnectorUtils::baseNestsInHead( * so it does not affect our result. Nevertheless, because they * are not detected, don't make this check if head was swelled. */ - oca.assertOverlapCorrectness(swelledbase_to_swelledhead); + swelledbase_to_swelledhead.assertOverlapCorrectness(); } - BoxLevel external(dim); - Connector swelledbase_to_external; + boost::shared_ptr external; + boost::shared_ptr swelledbase_to_external; if (domain) { computeExternalParts( external, @@ -272,176 +302,172 @@ BoxLevelConnectorUtils::baseNestsInHead( * the domain and we want to ignore those parts. */ MappingConnectorAlgorithm mca; - BoxLevel domain_mapped_box_level( + BoxLevel domain_box_level( IntVector::getOne(dim), grid_geom, connector.getMPI(), BoxLevel::GLOBALIZED); for (BoxContainer::const_iterator bi = domain->begin(); bi != domain->end(); ++bi) { - domain_mapped_box_level.addBox(*bi); + domain_box_level.addBox(*bi); } - Connector external_to_domain( - external, - domain_mapped_box_level, + boost::shared_ptr external_to_domain; + OverlapConnectorAlgorithm oca; + oca.findOverlaps(external_to_domain, + *external, + domain_box_level, base_swell); - oca.findOverlaps(external_to_domain); - BoxLevel finalexternal(dim); - Connector external_to_finalexternal; + boost::shared_ptr finalexternal; + boost::shared_ptr external_to_finalexternal; computeInternalParts( finalexternal, external_to_finalexternal, - external_to_domain, + *external_to_domain, IntVector::getZero(dim), *domain); - mca.modify(swelledbase_to_external, - external_to_finalexternal, - &external, - &finalexternal); + mca.modify(*swelledbase_to_external, + *external_to_finalexternal, + external.get(), + finalexternal.get()); } if (locally_nests) { - *locally_nests = external.getLocalNumberOfBoxes() == 0; + *locally_nests = external->getLocalNumberOfBoxes() == 0; } - bool globally_nests = external.getGlobalNumberOfBoxes() == 0; + bool globally_nests = external->getGlobalNumberOfBoxes() == 0; return globally_nests; } /* *********************************************************************** - * Make a Connector object for changing the Box indices of a BoxLevel. + * Make a MappingConnector object for changing the Box indices of a BoxLevel. * * If sequentialize_global_indices is true, the indices are changed * such that they become globally sequential, with processor n * starting where processor n-1 ended. In order to determine what the - * global indices should be, an allgather communication is used to - * determine how many mapped_boxes each processor has. This is a - * utility function for resetting Box indices to correspond to - * patch indices while we try to be backward compatible with non-DLBG - * parts of SAMRAI. + * global indices should be, a scan communication is used. * - * If sort_mapped_boxes_by_corner is true, the local Boxes are - * sorted by their corner indices. This helps to de-randomize - * Boxes that may be randomly ordered by non-deterministic - * algorithms. + * If sort_boxes_by_corner is true, the local Boxes are sorted by + * their corner indices. This helps to de-randomize Boxes that may be + * randomly ordered by non-deterministic algorithms. *********************************************************************** */ void BoxLevelConnectorUtils::makeSortingMap( - BoxLevel& sorted_mapped_box_level, - Connector& output_map, - const BoxLevel& unsorted_mapped_box_level, - bool sort_mapped_boxes_by_corner, + boost::shared_ptr& sorted_box_level, + boost::shared_ptr& output_map, + const BoxLevel& unsorted_box_level, + bool sort_boxes_by_corner, bool sequentialize_global_indices, LocalId initial_sequential_index) const { - const tbox::Dimension& dim(unsorted_mapped_box_level.getDim()); + const tbox::Dimension& dim(unsorted_box_level.getDim()); - if (!sort_mapped_boxes_by_corner && !sequentialize_global_indices) { + if (!sort_boxes_by_corner && !sequentialize_global_indices) { // Make a blank map. - sorted_mapped_box_level = unsorted_mapped_box_level; - output_map.clearNeighborhoods(); - output_map.setConnectorType(Connector::MAPPING); - output_map.setBase(unsorted_mapped_box_level); - output_map.setHead(sorted_mapped_box_level); - output_map.setWidth(IntVector::getZero(dim), true); + sorted_box_level.reset(new BoxLevel(unsorted_box_level)); + output_map.reset(new MappingConnector(unsorted_box_level, + *sorted_box_level, + IntVector::getZero(dim))); return; } - t_make_sorting_map->start(); + d_object_timers->t_make_sorting_map->start(); - const BoxContainer& cur_mapped_boxes = - unsorted_mapped_box_level.getBoxes(); + const BoxContainer& cur_boxes = unsorted_box_level.getBoxes(); LocalId last_index = initial_sequential_index - 1; if (sequentialize_global_indices) { // Increase last_index by the box count of all lower MPI ranks. - int box_count = - static_cast(unsorted_mapped_box_level.getLocalNumberOfBoxes()); - unsorted_mapped_box_level.getMPI().parallelPrefixSum(&box_count, 1, 0); - box_count -= static_cast(unsorted_mapped_box_level.getLocalNumberOfBoxes()); + int local_box_count = + static_cast(unsorted_box_level.getLocalNumberOfBoxes()); + int scanned_box_count = -1; + if (tbox::SAMRAI_MPI::usingMPI()) { + unsorted_box_level.getMPI().Scan(&local_box_count, + &scanned_box_count, + 1, MPI_INT, MPI_SUM); + } else { + scanned_box_count = local_box_count; // Scan result for 1 proc. + } + scanned_box_count -= static_cast(local_box_count); - last_index += box_count; + last_index += scanned_box_count; } - std::vector real_mapped_box_vector; - std::vector periodic_image_mapped_box_vector; - if (!cur_mapped_boxes.isEmpty()) { + std::vector real_box_vector; + std::vector periodic_image_box_vector; + if (!cur_boxes.empty()) { /* - * Bypass qsort if we have no mapped_boxes (else there is a memory - * warning). + * Bypass qsort if we have no boxes (else there is a memory warning). */ - cur_mapped_boxes.separatePeriodicImages( - real_mapped_box_vector, - periodic_image_mapped_box_vector); - if (sort_mapped_boxes_by_corner) { - qsort((void *)&real_mapped_box_vector[0], - real_mapped_box_vector.size(), + cur_boxes.separatePeriodicImages( + real_box_vector, + periodic_image_box_vector, + unsorted_box_level.getGridGeometry()->getPeriodicShiftCatalog()); + if (sort_boxes_by_corner) { + qsort((void *)&real_box_vector[0], + real_box_vector.size(), sizeof(Box), qsortBoxCompare); } } - sorted_mapped_box_level.initialize( - unsorted_mapped_box_level.getRefinementRatio(), - unsorted_mapped_box_level.getGridGeometry(), - unsorted_mapped_box_level.getMPI(), - BoxLevel::DISTRIBUTED); - output_map.clearNeighborhoods(); - output_map.setConnectorType(Connector::MAPPING); - output_map.setBase(unsorted_mapped_box_level); - output_map.setHead(sorted_mapped_box_level); - output_map.setWidth(IntVector::getZero(dim), true); - - for (std::vector::const_iterator ni = real_mapped_box_vector.begin(); - ni != real_mapped_box_vector.end(); ++ni) { - - const Box& cur_mapped_box = *ni; - const Box new_mapped_box(cur_mapped_box, - ++last_index, - cur_mapped_box.getOwnerRank(), - cur_mapped_box.getPeriodicId()); - sorted_mapped_box_level.addBoxWithoutUpdate(new_mapped_box); + sorted_box_level.reset(new BoxLevel( + unsorted_box_level.getRefinementRatio(), + unsorted_box_level.getGridGeometry(), + unsorted_box_level.getMPI())); + output_map.reset(new MappingConnector(unsorted_box_level, + *sorted_box_level, + IntVector::getZero(dim))); + + for (std::vector::const_iterator ni = real_box_vector.begin(); + ni != real_box_vector.end(); ++ni) { + + const Box& cur_box = *ni; + const Box new_box(cur_box, + ++last_index, + cur_box.getOwnerRank(), + cur_box.getPeriodicId()); + sorted_box_level->addBoxWithoutUpdate(new_box); /* - * Now, add cur_mapped_box's periodic images, but give them - * cur_mapped_box's new LocalId. In finding the image mapped_boxes, we - * use the fact that a real mapped_box's image follows the real - * mapped_box in a BoxContainer. + * Now, add cur_box's periodic images, but give them + * cur_box's new LocalId. In finding the image boxes, we + * use the fact that a real box's image follows the real + * box in a BoxContainer. */ - BoxContainer::const_iterator ini = cur_mapped_boxes.find(cur_mapped_box); - TBOX_ASSERT(ini != cur_mapped_boxes.end()); - ++ini; // Skip the real mapped_box to look for its image mapped_boxes. - while (ini != cur_mapped_boxes.end() && - ini->getGlobalId() == cur_mapped_box.getGlobalId()) { - const Box& image_mapped_box = *ini; - const Box new_image_mapped_box(image_mapped_box, - new_mapped_box.getLocalId(), - new_mapped_box.getOwnerRank(), - image_mapped_box. - getPeriodicId()); - TBOX_ASSERT(new_image_mapped_box.getBlockId() == - cur_mapped_box.getBlockId()); - sorted_mapped_box_level.addBoxWithoutUpdate(new_image_mapped_box); + BoxContainer::const_iterator ini = cur_boxes.find(cur_box); + TBOX_ASSERT(ini != cur_boxes.end()); + ++ini; // Skip the real box to look for its image boxes. + while (ini != cur_boxes.end() && + ini->getGlobalId() == cur_box.getGlobalId()) { + const Box& image_box = *ini; + const Box new_image_box(image_box, + new_box.getLocalId(), + new_box.getOwnerRank(), + image_box. + getPeriodicId()); + TBOX_ASSERT(new_image_box.getBlockId() == cur_box.getBlockId()); + sorted_box_level->addBoxWithoutUpdate(new_image_box); ++ini; } /* - * Edge for the mapping. By convention, image mapped_boxes are + * Edge for the mapping. By convention, image boxes are * not explicitly mapped. Also by convention, we don't create * edges unless there is a change. */ - if (cur_mapped_box.getLocalId() != new_mapped_box.getLocalId()) { - output_map.insertLocalNeighbor(new_mapped_box, - cur_mapped_box.getId()); + if (cur_box.getLocalId() != new_box.getLocalId()) { + output_map->insertLocalNeighbor(new_box, + cur_box.getBoxId()); } - sorted_mapped_box_level.finalize(); } + sorted_box_level->finalize(); - t_make_sorting_map->stop(); + d_object_timers->t_make_sorting_map->stop(); } /* @@ -454,25 +480,25 @@ BoxLevelConnectorUtils::qsortBoxCompare( const void* v, const void* w) { - const Box& mapped_box_v(*(const Box *)v); - const Box& mapped_box_w(*(const Box *)w); + const Box& box_v(*(const Box *)v); + const Box& box_w(*(const Box *)w); - if (mapped_box_v.getBlockId() > mapped_box_w.getBlockId()) return 1; + if (box_v.getBlockId() > box_w.getBlockId()) return 1; - if (mapped_box_v.getBlockId() < mapped_box_w.getBlockId()) return -1; + if (box_v.getBlockId() < box_w.getBlockId()) return -1; - const tbox::Dimension& dim(mapped_box_v.getDim()); + const tbox::Dimension& dim(box_v.getDim()); - const IntVector& lowv = mapped_box_v.lower(); - const IntVector& loww = mapped_box_w.lower(); + const Index& lowv = box_v.lower(); + const Index& loww = box_w.lower(); for (int i = 0; i < dim.getValue(); ++i) { if (lowv[i] > loww[i]) return 1; if (lowv[i] < loww[i]) return -1; } - const IntVector& upv = mapped_box_v.upper(); - const IntVector& upw = mapped_box_w.upper(); + const Index& upv = box_v.upper(); + const Index& upw = box_w.upper(); for (int i = 0; i < dim.getValue(); ++i) { if (upv[i] > upw[i]) return 1; @@ -491,7 +517,7 @@ BoxLevelConnectorUtils::qsortBoxCompare( * Identify parts of the input that are internal or external (depending * on the value of internal_or_external) to the reference * BoxLevel, and store the in/external parts in a BoxLevel. - * Create the input_to_parts Connector between the input and these + * Create the input_to_parts MappingConnector between the input and these * parts. * * For generality, the reference BoxLevel can be grown a @@ -540,21 +566,23 @@ BoxLevelConnectorUtils::qsortBoxCompare( */ void BoxLevelConnectorUtils::computeInternalOrExternalParts( - BoxLevel& parts, - Connector& input_to_parts, + boost::shared_ptr& parts, + boost::shared_ptr& input_to_parts, char internal_or_external, const Connector& input_to_reference, const IntVector& nesting_width, const BoxContainer& domain) const { + d_object_timers->t_compute_internal_or_external_parts->start(); + const BoxLevel& input = input_to_reference.getBase(); const boost::shared_ptr& grid_geometry( input.getGridGeometry()); const tbox::Dimension& dim(input.getDim()); - const IntVector& zero_vec(IntVector::getZero(input.getDim())); - const IntVector& one_vec(IntVector::getOne(dim)); + const IntVector& zero_vec = IntVector::getZero(input.getDim()); + const IntVector& one_vec = IntVector::getOne(dim); const bool nonnegative_nesting_width = nesting_width >= zero_vec; @@ -571,33 +599,37 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( << "nesting_width may not have mix of positive\n" << - "and negative values."); + "and negative values." << std::endl); } - if ( nesting_width != zero_vec && - input_to_reference.getConnectorWidth() < one_vec ) { + if (nesting_width != zero_vec && + input_to_reference.getConnectorWidth() < one_vec) { TBOX_ERROR( "BoxLevelConnectorUtils::computeInternalOrExternalParts:" << caller << ": error:\n" - << "If nesting width (" << nesting_width << " is non-zero,\n" - << "width of input_to_reference, " << input_to_reference.getConnectorWidth() << ",\n" - << "must be at least 1. Otherwise, correct results cannot be guaranteed." - ); + << "If nesting width " + << nesting_width + << " is non-zero,\n" + << + "width of input_to_reference, " << input_to_reference.getConnectorWidth() << ",\n" + << + "must be at least 1. Otherwise, correct results cannot be guaranteed." + << std::endl); } - if ( !( input_to_reference.getConnectorWidth() >= - (nonnegative_nesting_width ? nesting_width : -nesting_width)) ) { + if (!(input_to_reference.getConnectorWidth() >= + (nonnegative_nesting_width ? nesting_width : -nesting_width))) { TBOX_ERROR( "BoxLevelConnectorUtils::computeInternalOrExternalParts:" << caller << ": error:\n" << "input_to_reference width, " << input_to_reference.getConnectorWidth() << ",\nmust be greater than the absolute value of nesting_width, " - << nesting_width << ",\nto avoid erroneous results."); + << nesting_width << ",\nto avoid erroneous results." << std::endl); } - parts.initialize(input.getRefinementRatio(), - input.getGridGeometry(), input.getMPI()); + parts.reset(new BoxLevel(input.getRefinementRatio(), + input.getGridGeometry(), input.getMPI())); /* * Get the set of neighboring boxes on the reference BoxLevel. We first @@ -612,7 +644,7 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * Bring reference_box_list into refinement ratio of input * (for intersection checks). */ - if (input_to_reference.getRatio() != IntVector::getOne(dim)) { + if (input_to_reference.getRatio() != 1) { if (input_to_reference.getHeadCoarserFlag()) { reference_box_list.refine(input_to_reference.getRatio()); } else { @@ -631,6 +663,7 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * reference. */ + d_object_timers->t_compute_internal_or_external_parts_manip_reference->start(); const bool search_tree_represents_internal = nonnegative_nesting_width; if (search_tree_represents_internal) { @@ -644,17 +677,23 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( /* * nesting_width is non-positive. The external parts are given * by the grown boundary boxes. + * + * Note: Don't simplify the boxes in computeBoxesAroundBoundary. + * Doing so caused a 200X increase in the run time of this method + * in the domainexpansionc benchmark. We will have to live with + * having extraneous boxes in the boundary description. */ computeBoxesAroundBoundary( reference_box_list, input.getRefinementRatio(), - grid_geometry); + grid_geometry, + false); // ... reference_boundary is now ( (R^1) \ R ) - if (domain.size() > 0) { + if (!domain.empty()) { - if (input.getRefinementRatio() == one_vec) { + if (input.getRefinementRatio() == 1) { reference_box_list.intersectBoxes( input.getRefinementRatio(), domain); @@ -663,7 +702,7 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( refined_domain.refine(input.getRefinementRatio()); refined_domain.makeTree(grid_geometry.get()); reference_box_list.intersectBoxes(input.getRefinementRatio(), - refined_domain); + refined_domain); } } @@ -672,6 +711,7 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( reference_box_list.grow(-nesting_width); // ... reference_boundary is now ( ( (R^1) \ R ) O )^(-g) } // search_tree_represents_internal == false + d_object_timers->t_compute_internal_or_external_parts_manip_reference->stop(); reference_box_list.makeTree(grid_geometry.get()); @@ -689,11 +729,7 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * means that no Box is mapped to something outside its * extent. */ - input_to_parts.clearNeighborhoods(); - input_to_parts.setConnectorType(Connector::UNKNOWN); - input_to_parts.setBase(input); - input_to_parts.setHead(parts); - input_to_parts.setWidth(zero_vec, true); + input_to_parts.reset(new MappingConnector(input, *parts, zero_vec)); const bool compute_overlaps = search_tree_represents_internal == (internal_or_external == 'i'); @@ -703,15 +739,15 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * compute its overlapping (or non-overlapping) parts. */ - const BoxContainer& input_mapped_boxes = input.getBoxes(); + const BoxContainer& input_boxes = input.getBoxes(); - for (RealBoxConstIterator ni(input_mapped_boxes.realBegin()); - ni != input_mapped_boxes.realEnd(); ++ni) { + for (RealBoxConstIterator ni(input_boxes.realBegin()); + ni != input_boxes.realEnd(); ++ni) { - const Box& input_mapped_box = *ni; - const BoxId& input_mapped_box_id = input_mapped_box.getId(); + const Box& input_box = *ni; + const BoxId& input_box_id = input_box.getBoxId(); - if (!input_to_reference.hasNeighborSet(input_mapped_box_id)) { + if (!input_to_reference.hasNeighborSet(input_box_id)) { /* * Absence of a reference neighbor set in the overlap * Connector means the input Box does not overlap the @@ -722,26 +758,26 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * Trying to get the overlapping parts. Create empty * neighbor list to indicate there are no such parts. */ - input_to_parts.makeEmptyLocalNeighborhood(input_mapped_box_id); + input_to_parts->makeEmptyLocalNeighborhood(input_box_id); } else { /* * Trying to get the non-overlapping parts. * Non-overlapping parts is the whole box. */ - parts.addBox(input_mapped_box); + parts->addBox(input_box); } } else { - BoxContainer parts_list(input_mapped_box); + BoxContainer parts_list(input_box); /* - * Compute parts of input_mapped_box either overlapping + * Compute parts of input_box either overlapping * or nor overlapping the reference_box_list. * * Note about intersections in singularity neighbor blocks: * Cells from multiple singularity neighbor blocks can - * coincide when transformed into input_mapped_box's block. - * There is no way to specify that a cell in input_mapped_box + * coincide when transformed into input_box's block. + * There is no way to specify that a cell in input_box * intersects in some singularity block neighbors but not * others. By comparing to singularity neighbor blocks, we * take the convention that intersection in one singularity @@ -751,7 +787,6 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( * underspecifying external parts, and vice versa. */ - t_compute_internal_parts_intersection->start(); if (compute_overlaps) { parts_list.intersectBoxes( input.getRefinementRatio(), @@ -763,58 +798,55 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( reference_box_list, true /* Count singularity neighbors */); } - t_compute_internal_parts_intersection->stop(); /* * Make Boxes from parts_list and create - * Connector from input. + * MappingConnector from input. */ + d_object_timers->t_compute_internal_or_external_parts_simplify->start(); parts_list.simplify(); + d_object_timers->t_compute_internal_or_external_parts_simplify->stop(); if (parts_list.size() == 1 && - parts_list.front().isSpatiallyEqual(input_mapped_box)) { + parts_list.front().isSpatiallyEqual(input_box)) { /* - * The entire input_mapped_box is the part we want. - * The input_mapped_box should be mapped to itself. + * The entire input_box is the part we want. + * The input_box should be mapped to itself. * We can create such a map, but a missing map * means the same thing, so we omit the map */ - parts.addBox(input_mapped_box); + parts->addBox(input_box); } else { Connector::NeighborhoodIterator base_box_itr = - input_to_parts.makeEmptyLocalNeighborhood(input_mapped_box_id); - for (BoxContainer::iterator bi(parts_list); + input_to_parts->makeEmptyLocalNeighborhood(input_box_id); + for (BoxContainer::iterator bi = parts_list.begin(); bi != parts_list.end(); ++bi) { - const Box - parts_mapped_box((*bi), - ++last_used_index, - input_mapped_box.getOwnerRank()); - TBOX_ASSERT(parts_mapped_box.getBlockId() == - input_mapped_box.getBlockId()); - parts.addBox(parts_mapped_box); + const Box parts_box((*bi), + ++last_used_index, + input_box.getOwnerRank()); + TBOX_ASSERT(parts_box.getBlockId() == input_box.getBlockId()); + parts->addBox(parts_box); // Set connectivities between input and internal. - input_to_parts.insertLocalNeighbor( - parts_mapped_box, - base_box_itr); + input_to_parts->insertLocalNeighbor(parts_box, base_box_itr); } } // parts_list - } // !input_to_reference.hasNeighborSet(ni->getId()) + } // !input_to_reference.hasNeighborSet(ni->getBoxId()) - } // Loop through input_mapped_boxes + } // Loop through input_boxes #ifdef DEBUG_CHECK_ASSERTIONS - if (parts.getBoxes().isEmpty()) { + if (parts->getBoxes().empty()) { /* * If there are no parts, then all in input * should be mapped to empty neighbor containers according * to the definition of a map in MappingConnectorAlgorithm::modify(). */ - int a = input_to_parts.getLocalNumberOfNeighborSets(); + int a = input_to_parts->getLocalNumberOfNeighborSets(); int b = static_cast(input.getLocalNumberOfBoxes()); if (a != b) { tbox::perr << "BoxLevelConnectorUtils::" << caller @@ -824,14 +856,15 @@ BoxLevelConnectorUtils::computeInternalOrExternalParts( << "However, not all input Boxes have been mapped.\n" << "input BoxLevel:\n" << input.format("", 2) << "input_to_parts:\n"; - input_to_parts.writeNeighborhoodsToErrorStream(""); + input_to_parts->writeNeighborhoodsToErrorStream(""); TBOX_ERROR("Library error\n"); } - TBOX_ASSERT(a == input_to_parts.numLocalEmptyNeighborhoods()); + TBOX_ASSERT(a == input_to_parts->numLocalEmptyNeighborhoods()); } #endif - TBOX_ASSERT(input_to_parts.isLocal()); + TBOX_ASSERT(input_to_parts->isLocal()); + d_object_timers->t_compute_internal_or_external_parts->stop(); } /* @@ -850,18 +883,19 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( const boost::shared_ptr& grid_geometry, const bool simplify_boundary_boxes) const { + d_object_timers->t_compute_boxes_around_boundary->start(); const tbox::Dimension& dim(grid_geometry->getDim()); const IntVector& one_vec(IntVector::getOne(dim)); - BoxContainer reference_mapped_boxes_tree(boundary); - reference_mapped_boxes_tree.makeTree(grid_geometry.get()); + BoxContainer reference_boxes_tree(boundary); + reference_boxes_tree.makeTree(grid_geometry.get()); std::map single_block_reference; if (grid_geometry->getNumberOfBlockSingularities() > 0) { for (BoxContainer::const_iterator bi = boundary.begin(); bi != boundary.end(); ++bi) { - single_block_reference[bi->getBlockId()].pushBack(*bi); + single_block_reference[bi->getBlockId()].pushBack(*bi); } } @@ -878,11 +912,10 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( boundary.unorder(); boundary.removeIntersections( refinement_ratio, - reference_mapped_boxes_tree, + reference_boxes_tree, false /* excludes singularity neighbors */); // ... boundary is now ( (R^1) \ R ) - /* * Separate boundary into containers for individual blocks required * by the block_id loop. At the end of each block_id loop, stuff @@ -895,8 +928,8 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( } boundary.clear(); - if (grid_geometry->getNumberOfBlockSingularities() > 0) { + d_object_timers->t_compute_boxes_around_boundary_singularity->start(); /* * The boundary obtained by the formula (R^1)\R can have * errors at multiblock singularities. Fix it here. @@ -944,12 +977,10 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( */ BoxContainer reduced_connectivity_singularity_boxes( grid_geometry->getSingularityBoxContainer(block_id)); - const std::list& neighbors( - grid_geometry->getNeighbors(block_id)); - for (std::list::const_iterator ni = - neighbors.begin(); - ni != neighbors.end(); ni++) { + for (BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(block_id); + ni != grid_geometry->end(block_id); ++ni) { const BaseGridGeometry::Neighbor& neighbor(*ni); if (neighbor.isSingularity()) { reduced_connectivity_singularity_boxes.removeIntersections( @@ -957,7 +988,7 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( } } - if (!reduced_connectivity_singularity_boxes.isEmpty()) { + if (!reduced_connectivity_singularity_boxes.empty()) { if (refinement_ratio != one_vec) { reduced_connectivity_singularity_boxes.refine(refinement_ratio); } @@ -975,17 +1006,17 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( */ BoxContainer singularity_boxes( grid_geometry->getSingularityBoxContainer(block_id)); - if (refinement_ratio != one_vec) { + if (refinement_ratio != 1) { singularity_boxes.refine(refinement_ratio); } - for (std::list::const_iterator ni = - neighbors.begin(); - ni != neighbors.end(); ni++) { + for (BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(block_id); + ni != grid_geometry->end(block_id); ++ni) { const BaseGridGeometry::Neighbor& neighbor(*ni); const BlockId neighbor_block_id(neighbor.getBlockId()); if (neighbor.isSingularity() && - reference_mapped_boxes_tree.hasBoxInBlock(neighbor_block_id)) { + reference_boxes_tree.hasBoxInBlock(neighbor_block_id)) { grid_geometry->transformBoxContainer(singularity_boxes, refinement_ratio, @@ -1010,22 +1041,25 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( } // for std::mapt_compute_boxes_around_boundary_singularity->stop(); } // grid_geometry->getNumberOfBlockSingularities() > 0 if (simplify_boundary_boxes) { + d_object_timers->t_compute_boxes_around_boundary_simplify->start(); for (std::map::iterator mi = boundary_by_blocks.begin(); mi != boundary_by_blocks.end(); ++mi) { mi->second.simplify(); } + d_object_timers->t_compute_boxes_around_boundary_simplify->stop(); } // Set correct box ids. for (std::map::iterator bi = boundary_by_blocks.begin(); bi != boundary_by_blocks.end(); ++bi) { - BoxContainer &boxes(bi->second); - for ( BoxContainer::iterator bj=boxes.begin(); bj!=boxes.end(); ++bj ) { - bj->setId(BoxId( bj->getLocalId(), bj->getOwnerRank(), - bj->getPeriodicId() )); + BoxContainer& boxes(bi->second); + for (BoxContainer::iterator bj = boxes.begin(); bj != boxes.end(); ++bj) { + bj->setId(BoxId(bj->getLocalId(), bj->getOwnerRank(), + bj->getPeriodicId())); } } @@ -1034,6 +1068,7 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( boundary.spliceBack(bi->second); } + d_object_timers->t_compute_boxes_around_boundary->stop(); } /* @@ -1041,18 +1076,20 @@ BoxLevelConnectorUtils::computeBoxesAroundBoundary( * Given a mapping from an original BoxLevel to parts to be * removed, construct the remainder BoxLevel and the mapping from * the original to a remainder. + * + * This method does no communication. ************************************************************************* */ void BoxLevelConnectorUtils::makeRemainderMap( - BoxLevel& remainder, - Connector& orig_to_remainder, - const Connector& orig_to_rejection) const + boost::shared_ptr& remainder, + boost::shared_ptr& orig_to_remainder, + const MappingConnector& orig_to_rejection) const { TBOX_ASSERT(orig_to_rejection.isLocal()); - const tbox::Dimension& dim(remainder.getDim()); + const tbox::Dimension& dim(orig_to_rejection.getBase().getDim()); /* * remainder_nodes starts as a copy of orig codes. @@ -1066,13 +1103,11 @@ BoxLevelConnectorUtils::makeRemainderMap( const BoxContainer& orig_nodes = orig.getBoxes(); const int rank = orig.getMPI().getRank(); - remainder = orig; + remainder.reset(new BoxLevel(orig)); - orig_to_remainder.clearNeighborhoods(); - orig_to_remainder.setConnectorType(Connector::MAPPING); - orig_to_remainder.setBase(orig); - orig_to_remainder.setHead(remainder); - orig_to_remainder.setWidth(IntVector::getZero(dim), true); + orig_to_remainder.reset(new MappingConnector(orig, + *remainder, + IntVector::getZero(dim))); /* * Track last used index to ensure we use unique indices for new @@ -1085,24 +1120,24 @@ BoxLevelConnectorUtils::makeRemainderMap( ni != orig_nodes.end(); ++ni) { const Box& orig_node = *ni; - const BoxId mapped_box_id = orig_node.getId(); + const BoxId box_id = orig_node.getBoxId(); - if (!orig_to_rejection.hasNeighborSet(mapped_box_id)) { + if (!orig_to_rejection.hasNeighborSet(box_id)) { /* - * By the definition of a mapping Connector, no mapping means + * By the definition of a MappingConnector, no mapping means * the entire orig_node is rejected. * * - Erase rejected node from remainder * - Build connectivities in orig_to_remainder (empty neighbor list). */ - remainder.eraseBoxWithoutUpdate(orig_node); + remainder->eraseBoxWithoutUpdate(orig_node); - TBOX_ASSERT(!orig_to_remainder.hasNeighborSet(mapped_box_id)); + TBOX_ASSERT(!orig_to_remainder->hasNeighborSet(box_id)); - orig_to_remainder.makeEmptyLocalNeighborhood(mapped_box_id); - } else if (orig_to_rejection.numLocalNeighbors(mapped_box_id) == 0) { + orig_to_remainder->makeEmptyLocalNeighborhood(box_id); + } else if (orig_to_rejection.numLocalNeighbors(box_id) == 0) { /* - * By the definition of a mapping Connector, empty mapping + * By the definition of a MappingConnector, empty mapping * means entire orig_node remains. * * No orig<==>remainder mapping is required. @@ -1118,9 +1153,9 @@ BoxLevelConnectorUtils::makeRemainderMap( */ Connector::ConstNeighborhoodIterator ci = - orig_to_rejection.findLocal(mapped_box_id); + orig_to_rejection.findLocal(box_id); - remainder.eraseBoxWithoutUpdate(orig_node); + remainder->eraseBoxWithoutUpdate(orig_node); BoxContainer remaining_parts_list(orig_node); @@ -1138,35 +1173,35 @@ BoxLevelConnectorUtils::makeRemainderMap( } /* - * Create neighborhood of mapped_box_id in orig_to_remainder even if + * Create neighborhood of box_id in orig_to_remainder even if * remaining_parts_list is empty because its existence defines the * required mapping from the orig node to a (possibly empty) * container of nesting parts. */ Connector::NeighborhoodIterator base_box_itr = - orig_to_remainder.makeEmptyLocalNeighborhood(mapped_box_id); - for (BoxContainer::iterator bi(remaining_parts_list); + orig_to_remainder->makeEmptyLocalNeighborhood(box_id); + for (BoxContainer::iterator bi = remaining_parts_list.begin(); bi != remaining_parts_list.end(); ++bi) { Box new_box = (*bi); Box new_node(new_box, ++last_used_index, rank); TBOX_ASSERT(new_node.getBlockId() == orig_node.getBlockId()); - remainder.addBoxWithoutUpdate(new_node); - orig_to_remainder.insertLocalNeighbor(new_node, base_box_itr); + remainder->addBoxWithoutUpdate(new_node); + orig_to_remainder->insertLocalNeighbor(new_node, base_box_itr); } } } - remainder.finalize(); + remainder->finalize(); } /* ************************************************************************* * Add periodic images to a BoxLevel. * - * We add the periodic images by examining real Mapped_boxes in the - * BoxLevel. For each real mapped_box, consider all of its + * We add the periodic images by examining real boxes in the + * BoxLevel. For each real box, consider all of its * possible periodic images and add those that are within the * given width of the domain. ************************************************************************* @@ -1174,46 +1209,45 @@ BoxLevelConnectorUtils::makeRemainderMap( void BoxLevelConnectorUtils::addPeriodicImages( - BoxLevel& mapped_box_level, + BoxLevel& box_level, const BoxContainer& domain_search_tree, const IntVector& threshold_distance) const { - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(mapped_box_level.getDim()); + const PeriodicShiftCatalog& shift_catalog = + box_level.getGridGeometry()->getPeriodicShiftCatalog(); - if (!shift_catalog->isPeriodic()) { + if (!shift_catalog.isPeriodic()) { return; // No-op. } - boost::shared_ptr domain_tree_for_mapped_box_level( + boost::shared_ptr domain_tree_for_box_level( boost::make_shared(domain_search_tree)); - domain_tree_for_mapped_box_level->refine( - mapped_box_level.getRefinementRatio()); - domain_tree_for_mapped_box_level->makeTree(NULL); + domain_tree_for_box_level->refine(box_level.getRefinementRatio()); + domain_tree_for_box_level->makeTree(0); - const BoxContainer& domain_tree = - *domain_tree_for_mapped_box_level; + const BoxContainer& domain_tree = *domain_tree_for_box_level; - const IntVector& mapped_box_level_growth = threshold_distance; + const IntVector& box_level_growth = threshold_distance; - const BoxContainer& level_boxes(mapped_box_level.getBoxes()); + const BoxContainer& level_boxes(box_level.getBoxes()); for (RealBoxConstIterator ni(level_boxes.realBegin()); ni != level_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - for (int s = 1; s < shift_catalog->getNumberOfShifts(); ++s) { + const Box& level_box = *ni; + for (int s = 1; s < shift_catalog.getNumberOfShifts(); ++s) { PeriodicId id(s); - const IntVector& try_shift = - shift_catalog->shiftNumberToShiftDistance(id); - Box box = mapped_box; + const IntVector try_shift = + shift_catalog.shiftNumberToShiftDistance(id) * box_level.getRefinementRatio(); + Box box = level_box; box.shift(try_shift); - box.grow(mapped_box_level_growth); + box.grow(box_level_growth); if (domain_tree.hasOverlap(box)) { - mapped_box_level.addPeriodicBox(mapped_box, id); + box_level.addPeriodicBox(level_box, id); } } } + box_level.finalize(); } /* @@ -1221,122 +1255,116 @@ BoxLevelConnectorUtils::addPeriodicImages( * Add periodic images to a BoxLevel, and update Connectors that * require new edges incident on the additions to the BoxLevel. * - * We add the periodic images by examining real Mapped_boxes in the - * BoxLevel. For each real mapped_box, consider all of its + * We add the periodic images by examining real boxes in the + * BoxLevel. For each real box, consider all of its * possible periodic images and add those that are within the * Connector width distance of the domain. (We are not interested in * periodic images so far from the domain that they are never used.) * * After adding periodic images, we bridge through - * mapped_box_level<==>anchor<==>anchor so bridge can find the periodic + * box_level<==>anchor<==>anchor so bridge can find the periodic * edges. ************************************************************************* */ void BoxLevelConnectorUtils::addPeriodicImagesAndRelationships( - BoxLevel& mapped_box_level, - Connector& mapped_box_level_to_anchor, - Connector& anchor_to_mapped_box_level, + BoxLevel& box_level, + Connector& box_level_to_anchor, const BoxContainer& domain_search_tree, const Connector& anchor_to_anchor) const { + TBOX_ASSERT(box_level_to_anchor.hasTranspose()); + Connector& anchor_to_box_level = box_level_to_anchor.getTranspose(); OverlapConnectorAlgorithm oca; if (d_sanity_check_precond) { - if (!mapped_box_level_to_anchor.isTransposeOf(anchor_to_mapped_box_level)) { + if (!box_level_to_anchor.isTransposeOf(anchor_to_box_level)) { TBOX_ERROR( "BoxLevelConnectorUtils::addPeriodicImages: non-transposed connector inputs.\n" - << "mapped_box_level_to_anchor and anchor_to_mapped_box_level\n" - << "must be mutual transposes."); + << "box_level_to_anchor and anchor_to_box_level\n" + << "must be mutual transposes." << std::endl); } - mapped_box_level_to_anchor.assertTransposeCorrectness( - anchor_to_mapped_box_level); - if (oca.checkOverlapCorrectness(anchor_to_anchor)) { + box_level_to_anchor.assertTransposeCorrectness(anchor_to_box_level); + if (anchor_to_anchor.checkOverlapCorrectness()) { TBOX_ERROR( "BoxLevelConnectorUtils::addPeriodicImages: input anchor_to_anchor\n" - << "Connector failed edge correctness check."); + << "Connector failed edge correctness check." << std::endl); } - if (oca.checkOverlapCorrectness(anchor_to_mapped_box_level, false, true, - true)) { + if (anchor_to_box_level.checkOverlapCorrectness(false, true, true)) { TBOX_ERROR( - "BoxLevelConnectorUtils::addPeriodicImages: input anchor_to_mapped_box_level\n" - << "Connector failed edge correctness check."); + "BoxLevelConnectorUtils::addPeriodicImages: input anchor_to_box_level\n" + << "Connector failed edge correctness check." << std::endl); } - if (oca.checkOverlapCorrectness(mapped_box_level_to_anchor, false, true, - true)) { + if (box_level_to_anchor.checkOverlapCorrectness(false, true, true)) { TBOX_ERROR( - "BoxLevelConnectorUtils::addPeriodicImages: input mapped_box_level_to_anchor\n" - << "Connector failed edge correctness check."); + "BoxLevelConnectorUtils::addPeriodicImages: input box_level_to_anchor\n" + << "Connector failed edge correctness check." << std::endl); } } if (!(anchor_to_anchor.getConnectorWidth() >= - anchor_to_mapped_box_level.getConnectorWidth())) { + anchor_to_box_level.getConnectorWidth())) { TBOX_ERROR("BoxLevelConnectorUtils::addPeriodicImages: anchor_to_anchor width\n" << anchor_to_anchor.getConnectorWidth() << " is insufficient for\n" - << "generating periodic edges for anchor_to_mapped_box_level's width of " - << anchor_to_mapped_box_level.getConnectorWidth() << ".\n"); + << "generating periodic edges for anchor_to_box_level's width of " + << anchor_to_box_level.getConnectorWidth() << ".\n"); } - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(anchor_to_anchor.getConnectorWidth( - ).getDim()); + const PeriodicShiftCatalog& shift_catalog = + box_level.getGridGeometry()->getPeriodicShiftCatalog(); - if (!shift_catalog->isPeriodic()) { + if (!shift_catalog.isPeriodic()) { return; // No-op. } - const BoxLevel& anchor = anchor_to_mapped_box_level.getBase(); + const BoxLevel& anchor = anchor_to_box_level.getBase(); - BoxContainer domain_tree_for_mapped_box_level(domain_search_tree); - domain_tree_for_mapped_box_level.refine( - mapped_box_level.getRefinementRatio()); - domain_tree_for_mapped_box_level.makeTree(NULL); + BoxContainer domain_tree_for_box_level(domain_search_tree); + domain_tree_for_box_level.refine(box_level.getRefinementRatio()); + domain_tree_for_box_level.makeTree(0); { /* - * Add the periodic image mapped_boxes for mapped_box_level. + * Add the periodic image boxes for box_level. * * Adding images to a Box without neighbors in the anchor * means that this method will not find any edges to the added * images. */ - mapped_box_level.clearForBoxChanges(false); + box_level.clearForBoxChanges(false); if (0) { - tbox::perr << "mapped_box_level:\n" - << mapped_box_level.format("BEFORE-> ", 3); + tbox::perr << "box_level:\n" + << box_level.format("BEFORE-> ", 3); } - const BoxContainer& domain_tree = - domain_tree_for_mapped_box_level; + const BoxContainer& domain_tree = domain_tree_for_box_level; - const IntVector& mapped_box_level_growth = - mapped_box_level_to_anchor.getConnectorWidth(); + const IntVector& box_level_growth = box_level_to_anchor.getConnectorWidth(); - const BoxContainer& level_boxes(mapped_box_level.getBoxes()); + const BoxContainer& level_boxes(box_level.getBoxes()); for (RealBoxConstIterator ni(level_boxes.realBegin()); ni != level_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - Box grown_box = mapped_box; - grown_box.grow(mapped_box_level_growth); + const Box& level_box = *ni; + Box grown_box = level_box; + grown_box.grow(box_level_growth); bool images_added(false); - for (int s = 1; s < shift_catalog->getNumberOfShifts(); ++s) { + for (int s = 1; s < shift_catalog.getNumberOfShifts(); ++s) { PeriodicId id(s); - const IntVector& try_shift = - shift_catalog->shiftNumberToShiftDistance(id); + const IntVector try_shift = + shift_catalog.shiftNumberToShiftDistance(id) * box_level.getRefinementRatio(); Box box = grown_box; box.shift(try_shift); if (domain_tree.hasOverlap(box)) { - mapped_box_level.addPeriodicBox(mapped_box, id); + box_level.addPeriodicBox(level_box, id); images_added = true; } } if (d_sanity_check_precond) { if (images_added && - (!mapped_box_level_to_anchor.hasNeighborSet(mapped_box.getId()) || - mapped_box_level_to_anchor.isEmptyNeighborhood(mapped_box.getId()))) { + (!box_level_to_anchor.hasNeighborSet(level_box.getBoxId()) || + box_level_to_anchor.isEmptyNeighborhood(level_box.getBoxId()))) { TBOX_WARNING( - "BoxLevelConnectorUtils::addPeriodicImages: Box " << mapped_box + "BoxLevelConnectorUtils::addPeriodicImages: Box " << level_box << "\nhas periodic images in or close to the domain\n" << @@ -1352,7 +1380,7 @@ BoxLevelConnectorUtils::addPeriodicImagesAndRelationships( } if (0) { - tbox::perr << "mapped_box_level:\n" << mapped_box_level.format("AFTER-> ", 3); + tbox::perr << "box_level:\n" << box_level.format("AFTER-> ", 3); } } @@ -1360,81 +1388,79 @@ BoxLevelConnectorUtils::addPeriodicImagesAndRelationships( tbox::plog << "Before bridging for periodic edges:\n" << "anchor_to_anchor:\n" << anchor_to_anchor.format("DBG-> ", 3) << "anchor_to_anchor:\n" << anchor_to_anchor.format("DBG-> ", 3) - << "mapped_box_level_to_anchor:\n" << mapped_box_level_to_anchor.format("DBG-> ", + << "box_level_to_anchor:\n" << box_level_to_anchor.format("DBG-> ", 3) - << "anchor_to_mapped_box_level:\n" << anchor_to_mapped_box_level.format("DBG-> ", + << "anchor_to_box_level:\n" << anchor_to_box_level.format("DBG-> ", 3); } IntVector width_limit = - anchor_to_mapped_box_level.getHeadCoarserFlag() ? - mapped_box_level_to_anchor.getConnectorWidth() : - anchor_to_mapped_box_level.getConnectorWidth(); + anchor_to_box_level.getHeadCoarserFlag() ? + box_level_to_anchor.getConnectorWidth() : + anchor_to_box_level.getConnectorWidth(); oca.setSanityCheckMethodPreconditions(d_sanity_check_precond); - oca.bridge(mapped_box_level_to_anchor, - anchor_to_anchor, + oca.bridge(box_level_to_anchor, anchor_to_anchor, - anchor_to_mapped_box_level, width_limit); - anchor_to_mapped_box_level.eraseEmptyNeighborSets(); - mapped_box_level_to_anchor.eraseEmptyNeighborSets(); + anchor_to_box_level.eraseEmptyNeighborSets(); + box_level_to_anchor.eraseEmptyNeighborSets(); if (d_sanity_check_postcond) { // Expensive sanity check for consistency. - size_t err1 = anchor_to_mapped_box_level.checkConsistencyWithBase(); + size_t err1 = anchor_to_box_level.checkConsistencyWithBase(); if (err1) { - tbox::perr << "OverlapConnectorAlgorithm found " << err1 + tbox::perr << "Connector found " << err1 << " edge-base consistency errors in\n" - << "anchor_to_mapped_box_level after computing periodic images.\n"; + << "anchor_to_box_level after computing periodic images.\n"; } - size_t err2 = mapped_box_level_to_anchor.checkConsistencyWithBase(); + size_t err2 = box_level_to_anchor.checkConsistencyWithBase(); if (err2) { - tbox::perr << "OverlapConnectorAlgorithm found " << err2 + tbox::perr << "Connector found " << err2 << " edge-base consistency errors in\n" - << "mapped_box_level_to_anchor after computing periodic images.\n"; + << "box_level_to_anchor after computing periodic images.\n"; } - size_t err3 = anchor_to_mapped_box_level.checkConsistencyWithHead(); + size_t err3 = anchor_to_box_level.checkConsistencyWithHead(); if (err3) { - tbox::perr << "OverlapConnectorAlgorithm found " << err3 - << " edge-mapped_box consistency errors in\n" - << "anchor_to_mapped_box_level after computing periodic images.\n"; + tbox::perr << "Connector found " << err3 + << " edge-box consistency errors in\n" + << "anchor_to_box_level after computing periodic images.\n"; } - size_t err4 = mapped_box_level_to_anchor.checkConsistencyWithHead(); + size_t err4 = box_level_to_anchor.checkConsistencyWithHead(); if (err4) { - tbox::perr << "OverlapConnectorAlgorithm found " << err4 - << " edge-mapped_box consistency errors in\n" - << "mapped_box_level_to_anchor after computing periodic images.\n"; + tbox::perr << "Connector found " << err4 + << " edge-box consistency errors in\n" + << "box_level_to_anchor after computing periodic images.\n"; } if (err1 + err2 + err3 + err4) { TBOX_ERROR( - "OverlapConnectorAlgorithm found consistency errors in\n" + "Connector found consistency errors in\n" << "addPeriodicImages\n" << "anchor:\n" << anchor.format("ERR-> ", 3) - << "mapped_box_level:\n" << mapped_box_level.format("ERR-> ", 3) + << "box_level:\n" << box_level.format("ERR-> ", 3) << "anchor_to_anchor:\n" << anchor_to_anchor.format("ERR-> ", 3) - << "anchor_to_mapped_box_level:\n" - << anchor_to_mapped_box_level.format("ERR-> ", 3) - << "mapped_box_level_to_anchor:\n" - << mapped_box_level_to_anchor.format("ERR-> ", 3)); + << "anchor_to_box_level:\n" + << anchor_to_box_level.format("ERR-> ", 3) + << "box_level_to_anchor:\n" + << box_level_to_anchor.format("ERR-> ", 3) << std::endl); } } if (d_sanity_check_postcond) { // Expensive sanity check for correctness. - int err1 = oca.checkOverlapCorrectness(anchor_to_mapped_box_level); + int err1 = anchor_to_box_level.checkOverlapCorrectness(); if (err1) { tbox::perr << "BoxLevelConnectorUtils::addPeriodicImages found " << err1 << " errors\n" - << "in anchor_to_mapped_box_level after\n" + << "in anchor_to_box_level after\n" << "computing periodic images. If you enabled\n" << "precondition checking, this is probably a\n" << "library error.\n"; } - int err2 = oca.checkOverlapCorrectness(mapped_box_level_to_anchor); + int err2 = box_level_to_anchor.checkOverlapCorrectness(); if (err2) { tbox::perr << "BoxLevelConnectorUtils::addPeriodicImages found " << err2 << " errors\n" - << "in mapped_box_level_to_anchor after\n" + << "in box_level_to_anchor after\n" << "computing periodic images. If you enabled\n" << "precondition checking, this is probably a\n" << "library error.\n"; @@ -1444,18 +1470,139 @@ BoxLevelConnectorUtils::addPeriodicImagesAndRelationships( "BoxLevelConnectorUtils::addPeriodicImages found edge errors\n" << "in output data\n" << "anchor:\n" << anchor.format("ERR-> ", 3) - << "mapped_box_level:\n" << mapped_box_level.format("ERR-> ", 3) + << "box_level:\n" << box_level.format("ERR-> ", 3) << "anchor_to_anchor:\n" << anchor_to_anchor.format("ERR-> ", 3) - << "anchor_to_mapped_box_level:\n" << anchor_to_mapped_box_level.format("ERR-> ", 3) - << "mapped_box_level_to_anchor:\n" << mapped_box_level_to_anchor.format("ERR-> ", 3) - << "anchor_to_mapped_box_level:\n" - << anchor_to_mapped_box_level.format("ERR-> ", 3) - << "mapped_box_level_to_anchor:\n" - << mapped_box_level_to_anchor.format("ERR-> ", 3)); + << "anchor_to_box_level:\n" << anchor_to_box_level.format("ERR-> ", 3) + << "box_level_to_anchor:\n" << box_level_to_anchor.format("ERR-> ", 3) + << "anchor_to_box_level:\n" + << anchor_to_box_level.format("ERR-> ", 3) + << "box_level_to_anchor:\n" + << box_level_to_anchor.format("ERR-> ", 3) << std::endl); } } } +void +BoxLevelConnectorUtils::computeNonIntersectingParts( + boost::shared_ptr& remainder, + boost::shared_ptr& input_to_remainder, + const Connector& input_to_takeaway) const +{ + if (d_sanity_check_precond) { + input_to_takeaway.assertOverlapCorrectness(); + } + + const tbox::Dimension& dim = input_to_takeaway.getConnectorWidth().getDim(); + boost::shared_ptr i_to_r_map; + computeExternalParts(remainder, + i_to_r_map, + input_to_takeaway, + IntVector::getZero(dim)); + + input_to_remainder = boost::static_pointer_cast(i_to_r_map); + + TBOX_ASSERT(input_to_remainder->getConnectorWidth() == + IntVector::getZero(dim)); + + const BoxContainer& remainder_boxes = remainder->getBoxes(); + const BoxContainer& input_boxes = + input_to_takeaway.getBase().getBoxes(); + + if (!remainder_boxes.empty() && !input_boxes.empty()) { + + for (BoxContainer::const_iterator bi = remainder_boxes.begin(); + bi != remainder_boxes.end(); ++bi) { + + if (input_boxes.find(*bi) != input_boxes.end()) { + input_to_remainder->insertLocalNeighbor(*bi, bi->getBoxId()); + } else { + break; + } + } + } + + TBOX_ASSERT(input_to_remainder->isLocal()); +} + +/* + *********************************************************************** + *********************************************************************** + */ + +void +BoxLevelConnectorUtils::initializeCallback() +{ + // Initialize timers with default prefix. + getAllTimers(s_default_timer_prefix, + s_static_timers[s_default_timer_prefix]); + +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxLevelConnectorUtils::setTimerPrefix( + const std::string& timer_prefix) +{ + std::string timer_prefix_used; + if (s_ignore_external_timer_prefix == 'y') { + timer_prefix_used = s_default_timer_prefix; + } else { + timer_prefix_used = timer_prefix; + } + std::map::iterator ti( + s_static_timers.find(timer_prefix_used)); + if (ti == s_static_timers.end()) { + d_object_timers = &s_static_timers[timer_prefix_used]; + getAllTimers(timer_prefix_used, *d_object_timers); + } else { + d_object_timers = &(ti->second); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxLevelConnectorUtils::getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers) +{ + timers.t_make_sorting_map = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::makeSortingMap()"); + + timers.t_compute_boxes_around_boundary = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeBoxesAroundBoundary()"); + + timers.t_compute_boxes_around_boundary_singularity = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeBoxesAroundBoundary()_singularity"); + + timers.t_compute_boxes_around_boundary_simplify = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeBoxesAroundBoundary()_simplify"); + + timers.t_compute_external_parts = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeExternalParts()"); + timers.t_compute_internal_parts = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeInternalParts()"); + + timers.t_compute_internal_or_external_parts = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeInternalOrExternalParts()"); + + timers.t_compute_internal_or_external_parts_manip_reference = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeInternalOrExternalParts()_manip_reference"); + + timers.t_compute_internal_or_external_parts_simplify = + tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::computeInternalOrExternalParts()_simplify"); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.h index f45e2065..dcf0930e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelConnectorUtils.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utilities for working on DLBG edges. * ************************************************************************/ @@ -12,7 +12,7 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/MappingConnector.h" #include "SAMRAI/hier/BoxLevel.h" namespace SAMRAI { @@ -39,6 +39,11 @@ class BoxLevelConnectorUtils */ BoxLevelConnectorUtils(); + /*! + * @brief Destructor. + */ + ~BoxLevelConnectorUtils(); + /*! * @brief Set whether to run expensive sanity checks on input parameters. * @@ -108,6 +113,11 @@ class BoxLevelConnectorUtils * * @return True if the given base BoxLevel nests in the head, * otherwise False. + * @pre (connector.getBase().getDim() == base_swell.getDim()) && + * (connector.getBase().getDim() == head_nesting_margin.getDim()) + * @pre connector.isFinalized() + * @pre base_swell >= IntVector::getZero(connector.getBase().getDim()) + * @pre head_nesting_margin >= IntVector::getZero(connector.getBase().getDim()) */ bool baseNestsInHead( @@ -116,15 +126,15 @@ class BoxLevelConnectorUtils const IntVector& base_swell, const IntVector& head_swell, const IntVector& head_nesting_margin, - const BoxContainer* domain = NULL) const; + const BoxContainer* domain = 0) const; /*! * @brief Given base and head BoxLevels, determine the extent * to which the base nests in the head. * * This method is similar to the version taking a Connector instead - * of the base and head MappedBoxLevels, except that it will use - * the base MappedBoxLevel's PersistentOverlapConnectors object to + * of the base and head BoxLevels, except that it will use + * the base BoxLevel's PersistentOverlapConnectors object to * get the base--->head Connector. If such a Connector does not * exist, the PersistentOverlapConnectors object will create it, an * unscalable operation possibly requiring collective @@ -154,6 +164,14 @@ class BoxLevelConnectorUtils * in search tree format. * * @return Whether the given base BoxLevel nests in the head. + * + * @pre head_nesting_margin.getDim() == base_swell.getDim() + * @pre head.getMPI() == base.getMPI() + * @pre base_swell >= IntVector::getZero(head.getDim()) + * @pre head_swell >= IntVector::getZero(head.getDim()) + * @pre head_nesting_margin >= IntVector::getZero(head.getDim()) + * @pre (head.getRefinementRatio() <= base.getRefinementRatio()) || + * (head.getRefinementRatio() >= base.getRefinementRatio()) || */ bool baseNestsInHead( @@ -163,7 +181,7 @@ class BoxLevelConnectorUtils const IntVector& base_swell, const IntVector& head_swell, const IntVector& head_margin, - const BoxContainer* domain = NULL) const; + const BoxContainer* domain = 0) const; /*! * @brief Compute the parts of one BoxLevel that are external @@ -172,7 +190,7 @@ class BoxLevelConnectorUtils * Compare an input BoxLevel to a "reference" BoxLevel. * Compute the parts of the input that are external to the * reference. Build the "external" BoxLevel representing the - * external parts. Build a mapping Connector with the input as its + * external parts. Build a MappingConnector with the input as its * base and the external as its head. * * A partially external input cell (possible when input is coarser @@ -206,16 +224,18 @@ class BoxLevelConnectorUtils * images, in search tree form. These boxes should be in the * reference index space. If domain is given, do not shrink the * reference BoxLevel where it touches the domain boundary. + * + * @post input_to_external.isLocal() */ void computeExternalParts( - BoxLevel& external, - Connector& input_to_external, + boost::shared_ptr& external, + boost::shared_ptr& input_to_external, const Connector& input_to_reference, const IntVector& nesting_width, const BoxContainer& domain = BoxContainer()) const { - t_compute_external_parts->start(); + d_object_timers->t_compute_external_parts->start(); computeInternalOrExternalParts( external, input_to_external, @@ -223,17 +243,17 @@ class BoxLevelConnectorUtils input_to_reference, nesting_width, domain); - t_compute_external_parts->stop(); + d_object_timers->t_compute_external_parts->stop(); } /*! * @brief Compute the parts of one BoxLevel that are internal * to another BoxLevel. * - * Compare an input BoxLevel to a "reference" mapped_box_level. + * Compare an input BoxLevel to a "reference" box_level. * Identify parts of the input that are internal to the reference * BoxLevel, and store the internal parts in a - * BoxLevel. Set up a mapping Connector between the input + * BoxLevel. Set up a MappingConnector between the input * and its internal parts. * * A partially internal input cell (possible when input is coarser @@ -267,16 +287,18 @@ class BoxLevelConnectorUtils * images, in search tree form. These boxes should be in the * reference index space. If domain is given, do not shrink the * reference BoxLevel where it touches the domain boundary. + * + * @post input_to_internal.isLocal() */ void computeInternalParts( - BoxLevel& internal, - Connector& input_to_internal, + boost::shared_ptr& internal, + boost::shared_ptr& input_to_internal, const Connector& input_to_reference, const IntVector& nesting_width, const BoxContainer& domain = BoxContainer()) const { - t_compute_internal_parts->start(); + d_object_timers->t_compute_internal_parts->start(); computeInternalOrExternalParts( internal, input_to_internal, @@ -284,9 +306,32 @@ class BoxLevelConnectorUtils input_to_reference, nesting_width, domain); - t_compute_internal_parts->stop(); + d_object_timers->t_compute_internal_parts->stop(); } + /*! + * @brief Compute parts of a level that do not intersect with another + * level + * + * Given the Connector input_to_takeaway, this method computes the parts + * of the base level 'input' that do not intersect the head level + * 'takeaway'. The results are stored in the BoxLevel 'remainder', + * with the input_to_remainder Connector storing the overlap + * relationships between 'input' and 'remainder'. + * + * @param[out] remainder The non-intersecting parts of input level + * @param[out] input_to_remainder Overlap connector with width zero + * @param[in] input_to_takeaway Overlap connector, may have any width + * + * @pre input_to_takeaway is a complete overlap connector + * @post input_to_remainder.isLocal() + */ + void + computeNonIntersectingParts( + boost::shared_ptr& remainder, + boost::shared_ptr& input_to_remainder, + const Connector& input_to_takeaway) const; + //@} /*! @@ -296,7 +341,7 @@ class BoxLevelConnectorUtils * @param[out] boundary Boundary boxes, sorted into BoxContainers * according to the BlockId. * - * @param[in] refinement_ratio Refinement ratio of mapped_boxes. + * @param[in] refinement_ratio Refinement ratio of boxes. * * @param[in] grid_geometry * @@ -312,18 +357,18 @@ class BoxLevelConnectorUtils //@{ - //! @name Setting up common mapping Connectors + //! @name Setting up common MappingConnectors /* - * @brief Sort the Boxes in BoxLevel and make a mapping - * Connector from the unsorted BoxLevel to the sorted one. + * @brief Sort the Boxes in BoxLevel and make a MappingConnector + * from the unsorted BoxLevel to the sorted one. * The sorting can renumber the LocalIndices of the Boxes * or put the Boxes in spatial ordering, or both. * - * The Connector map created is local (no Box is mapped to a new + * The MappingConnector created is local (no Box is mapped to a new * owner). * - * If @c sort_mapped_boxes_by_corner is true, the map will reorder + * If @c sort_boxes_by_corner is true, the map will reorder * local Boxes by their box corners. This is useful for * making random box ordering into something deterministic. * @@ -335,18 +380,18 @@ class BoxLevelConnectorUtils * @c initial_sequential_index can specify the first index of first * Box of the lowest rank processor. * - * For more information on mapping Connectors, see + * For more information on MappingConnectors, see * MappingConnectorAlgorithm. * - * @param[out] sorted_mapped_box_level Sorted version of the input - * unsorted_mapped_box_level. + * @param[out] sorted_box_level Sorted version of the input + * unsorted_box_level. * - * @param[out] output_map Mapping from @c unsorted_mapped_box_level - * to @c sorted_mapped_box_level. + * @param[out] output_map Mapping from @c unsorted_box_level + * to @c sorted_box_level. * - * @param[in] unsorted_mapped_box_level + * @param[in] unsorted_box_level * - * @param[in] sort_mapped_boxes_by_corner Whether to sort local + * @param[in] sort_boxes_by_corner Whether to sort local * Boxes by their indices to make their ordering solely a * function of box positions. * @@ -359,10 +404,10 @@ class BoxLevelConnectorUtils */ void makeSortingMap( - BoxLevel& sorted_mapped_box_level, - Connector& output_map, - const BoxLevel& unsorted_mapped_box_level, - bool sort_mapped_boxes_by_corner = true, + boost::shared_ptr& sorted_box_level, + boost::shared_ptr& output_map, + const BoxLevel& unsorted_box_level, + bool sort_boxes_by_corner = true, bool sequentialize_global_indices = true, LocalId initial_sequential_index = LocalId::getZero()) const; @@ -371,6 +416,8 @@ class BoxLevelConnectorUtils * to be removed (rejected), construct the remainder BoxLevel * and the mapping from the original to a remainder. * + * This method does no communication. + * * @see MappingConnectorAlgorithm. * * @param[out] remainder The new BoxLevel resulting from @@ -382,12 +429,14 @@ class BoxLevelConnectorUtils * @param[in] orig_to_rejections Mapping from original * BoxLevel to its parts that should be be removed. This * must be a local map. + * + * @pre orig_to_rejection.isLocal() */ void makeRemainderMap( - BoxLevel& remainder, - Connector& orig_to_remainder, - const Connector& orig_to_rejections) const; + boost::shared_ptr& remainder, + boost::shared_ptr& orig_to_remainder, + const MappingConnector& orig_to_rejections) const; //@} @@ -404,7 +453,7 @@ class BoxLevelConnectorUtils * added, Those farther out are not added. The threshold distance * is @c threshold_distance. * - * @param[in,out] mapped_box_level BoxLevel subject to the + * @param[in,out] box_level BoxLevel subject to the * addition of periodic Boxes. * * @param[in] domain_search_tree Domain description in the reference @@ -414,7 +463,7 @@ class BoxLevelConnectorUtils */ void addPeriodicImages( - BoxLevel& mapped_box_level, + BoxLevel& box_level, const BoxContainer& domain_search_tree, const IntVector& threshold_distance) const; @@ -426,27 +475,24 @@ class BoxLevelConnectorUtils * * Any periodic images within a certain distance of the domain is * added, but the rest are not added. The threshold distance is - * the width of the Connector @c mapped_box_level_to_anchor. + * the width of the Connector @c box_level_to_anchor. * * This method updates the overlap Connectors between the * BoxLevel getting new periodic Boxes and an "anchor" * BoxLevel. New periodic overlap relationships generated * are added to the overlap Connector @c - * mapped_box_level_to_anchor. If you don't need to have a + * box_level_to_anchor. If you don't need to have a * Connector updated, use addPeriodicImages() instead of this * method. * - * Preconditions: mapped_box_level<==>anchor must be transpose + * Preconditions: box_level<==>anchor must be transpose * overlap Connectors (or communications may hang). * anchor--->anchor must be a complete overlap Connector. * - * @param[in,out] mapped_box_level BoxLevel subject to the + * @param[in,out] box_level BoxLevel subject to the * addition of periodic Boxes. * - * @param[in,out] mapped_box_level_to_anchor Overlap Connector to - * be updated with new relationships. - * - * @param[in,out] anchor_to_mapped_box_level Overlap Connector to + * @param[in,out] box_level_to_anchor Overlap Connector to * be updated with new relationships. * * @param[in] domain_search_tree Domain description in the @@ -454,28 +500,53 @@ class BoxLevelConnectorUtils * images. * * @param[in] anchor_to_anchor Self overlap Connector for anchor - * BoxLevel. Must be a complete overlap Connector with - * periodic relationships. + * BoxLevel. Must be a complete overlap Connector with periodic + * relationships. To guarantee complete periodic relationships, + * the anchor, grown by the width of this Connector, must nest + * box_level grown by the width of box_level_to_anchor. */ void addPeriodicImagesAndRelationships( - BoxLevel& mapped_box_level, - Connector& mapped_box_level_to_anchor, - Connector& anchor_to_mapped_box_level, + BoxLevel& box_level, + Connector& box_level_to_anchor, const BoxContainer& domain_search_tree, const Connector& anchor_to_anchor) const; //@} + /*! + * @brief Setup names of timers. + * + * By default, timers are named + * "hier::BoxLevelConnectorUtils::*", where the third field is + * the specific steps performed by the BoxLevelConnectorUtils. + * You can override the first two fields with this method. + * Conforming to the timer naming convention, timer_prefix should + * have the form "*::*". + */ + void + setTimerPrefix( + const std::string& timer_prefix); + + /*! + * @brief Get the name of this object. + */ + const std::string + getObjectName() const + { + return "BoxLevelConnectorUtils"; + } + private: /*! - * @brief Delegated work of computeInternalParts and - * computeExternalParts. + * @brief Delegated work of computeInternalParts and computeExternalParts. + * + * @post input_to_parts.isLocal() */ void computeInternalOrExternalParts( - BoxLevel& parts, - Connector& input_to_parts, + boost::shared_ptr& parts, + boost::shared_ptr& input_to_parts, char internal_or_external, const Connector& input_to_reference, const IntVector& nesting_width, @@ -490,53 +561,74 @@ class BoxLevelConnectorUtils const void* w); /*! - * @brief Allocate statics + * @brief Read extra debugging flag from input database. + */ + void + getFromInput(); + + /*! + * @brief Set up things for the entire class. * * Only called by StartupShutdownManager. */ static void - initializeCallback() - { - t_make_sorting_map = tbox::TimerManager::getManager()-> - getTimer("BoxLevelConnectorUtils::makeSortingMap()"); - t_compute_external_parts = tbox::TimerManager::getManager()-> - getTimer("BoxLevelConnectorUtils::computeExternalParts()"); - t_compute_external_parts_intersection = - tbox::TimerManager::getManager()-> - getTimer("BoxLevelConnectorUtils::computeExternalParts()_intersection"); - t_compute_internal_parts = tbox::TimerManager::getManager()-> - getTimer("BoxLevelConnectorUtils::computeInternalParts()"); - t_compute_internal_parts_intersection = - tbox::TimerManager::getManager()-> - getTimer("BoxLevelConnectorUtils::computeInternalParts()_intersection"); - } + initializeCallback(); - /*! - * @brief Delete statics. + //@{ + //! @name Timer data for this class. + + /* + * @brief Structure of timers used by this class. * - * Only called by StartupShutdownManager. + * Each object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_make_sorting_map; + boost::shared_ptr t_compute_boxes_around_boundary; + boost::shared_ptr t_compute_boxes_around_boundary_singularity; + boost::shared_ptr t_compute_boxes_around_boundary_simplify; + boost::shared_ptr t_compute_external_parts; + boost::shared_ptr t_compute_internal_parts; + boost::shared_ptr t_compute_internal_or_external_parts; + boost::shared_ptr t_compute_internal_or_external_parts_manip_reference; + boost::shared_ptr t_compute_internal_or_external_parts_simplify; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + static char s_ignore_external_timer_prefix; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + /*! + * @brief Get all the timers defined in TimerStruct. The timers + * are named with the given prefix. */ static void - finalizeCallback() - { - t_make_sorting_map.reset(); - t_compute_external_parts.reset(); - t_compute_external_parts_intersection.reset(); - t_compute_internal_parts.reset(); - t_compute_internal_parts_intersection.reset(); - } + getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers); - static boost::shared_ptr t_make_sorting_map; - static boost::shared_ptr t_compute_external_parts; - static boost::shared_ptr t_compute_external_parts_intersection; - static boost::shared_ptr t_compute_internal_parts; - static boost::shared_ptr t_compute_internal_parts_intersection; + //@} bool d_sanity_check_precond; bool d_sanity_check_postcond; - static tbox::StartupShutdownManager::Handler - s_initialize_finalize_handler; + static tbox::StartupShutdownManager::Handler s_initialize_handler; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.C index aec3f58c..5085590c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Registry of BoxLevelHandles incident from a common BoxLevel. * ************************************************************************/ -#ifndef included_hier_BoxLevelHandle_C -#define included_hier_BoxLevelHandle_C - #include "SAMRAI/hier/BoxLevelHandle.h" #include "SAMRAI/hier/BoxLevel.h" @@ -42,7 +39,7 @@ BoxLevelHandle::~BoxLevelHandle() const BoxLevel& BoxLevelHandle::getBoxLevel() const { - if (d_box_level == NULL) { + if (d_box_level == 0) { TBOX_ERROR( "BoxLevelHandle::getBoxLevel Attempted to access a BoxLevel\n" << "that has been detached from its handle. Detachment happens\n" @@ -61,4 +58,3 @@ BoxLevelHandle::getBoxLevel() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.h index d1b8d0b6..d7a42b60 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelHandle.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Auto-release handle to prevent using invalid Connector data. * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace hier { @@ -54,10 +54,9 @@ class BoxLevelHandle /*! * @brief Return the BoxLevel attached to this handle. * - * If there is no attached BoxLevel (isAttached() returns - * false), an assertion is thrown. - * * @see isAttached() + * + * @pre isAttached() */ const BoxLevel& getBoxLevel() const; @@ -69,7 +68,7 @@ class BoxLevelHandle bool isAttached() const { - return d_box_level != NULL; + return d_box_level != 0; } private: @@ -116,7 +115,7 @@ class BoxLevelHandle void detachMyBoxLevel() { - d_box_level = NULL; + d_box_level = 0; } //@{ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelStatistics.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelStatistics.C index e18b23c3..72524f6b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelStatistics.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxLevelStatistics.C @@ -3,18 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Statistical characteristics of a BoxLevel. * ************************************************************************/ -#ifndef included_hier_BoxLevelStatistics_C -#define included_hier_BoxLevelStatistics_C - #include "SAMRAI/hier/BoxLevelStatistics.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* * Suppress XLC warnings @@ -26,7 +25,6 @@ namespace SAMRAI { namespace hier { - std::string BoxLevelStatistics::s_quantity_names[NUMBER_OF_QUANTITIES]; int BoxLevelStatistics::s_longest_length; @@ -38,16 +36,15 @@ BoxLevelStatistics::s_initialize_finalize_handler( BoxLevelStatistics::finalizeCallback, tbox::StartupShutdownManager::priorityTimers); - /* -************************************************************************ -* Constructor. -************************************************************************ -*/ + ************************************************************************ + * Constructor. + ************************************************************************ + */ BoxLevelStatistics::BoxLevelStatistics( - const BoxLevel &box_level ) - : d_mpi(box_level.getMPI()), - d_dim(box_level.getDim()) + const BoxLevel& box_level): + d_mpi(box_level.getMPI()), + d_dim(box_level.getDim()) { if (!box_level.isInitialized()) { TBOX_ERROR("BoxLevelStatistics requires an initialized BoxLevel."); @@ -57,26 +54,24 @@ BoxLevelStatistics::BoxLevelStatistics( reduceStatistics(); } - /* -************************************************************************ -************************************************************************ -*/ + ************************************************************************ + ************************************************************************ + */ BoxLevelStatistics::StatisticalQuantities::StatisticalQuantities() { - for ( int i=0; i::getMax(); d_sq.d_values[MAX_BOX_LEN] = 0; - d_sq.d_values[MIN_BOX_LEN] = - (box_level.getLocalNumberOfBoxes() == 0 ? - 0 : tbox::MathUtilities::getMax()); + d_sq.d_values[MIN_BOX_LEN] = tbox::MathUtilities::getMax(); d_sq.d_values[MAX_ASPECT_RATIO] = 0; d_sq.d_values[SUM_ASPECT_RATIO] = 0; d_sq.d_values[SUM_SURFACE_AREA] = 0.; @@ -111,37 +104,37 @@ void BoxLevelStatistics::computeLocalBoxLevelStatistics( const BoxLevel &box_lev for (RealBoxConstIterator ni(boxes.realBegin()); ni != boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - const IntVector boxdims = mapped_box.numberCells(); - const int boxvol = boxdims.getProduct(); + const Box& box = *ni; + const IntVector boxdims = box.numberCells(); + const double boxvol = static_cast(boxdims.getProduct()); const int longdim = boxdims.max(); const int shortdim = boxdims.min(); double aspect_ratio = 0.0; double surfarea = 0.; for (int d = 0; d < d_dim.getValue(); ++d) { surfarea += 2 * double(boxvol) / boxdims(d); - double tmp = static_cast(boxdims(d))/shortdim - 1.0; - aspect_ratio += tmp*tmp; + double tmp = static_cast(boxdims(d)) / shortdim - 1.0; + aspect_ratio += tmp * tmp; } aspect_ratio = 1.0 + sqrt(aspect_ratio); d_sq.d_values[MAX_BOX_VOL] = tbox::MathUtilities::Max(d_sq.d_values[MAX_BOX_VOL], - boxvol); + boxvol); d_sq.d_values[MIN_BOX_VOL] = tbox::MathUtilities::Min(d_sq.d_values[MIN_BOX_VOL], - boxvol); + boxvol); d_sq.d_values[MAX_BOX_LEN] = tbox::MathUtilities::Max(d_sq.d_values[MAX_BOX_LEN], - longdim); + longdim); d_sq.d_values[MIN_BOX_LEN] = tbox::MathUtilities::Min(d_sq.d_values[MIN_BOX_LEN], - shortdim); + shortdim); d_sq.d_values[MAX_ASPECT_RATIO] = tbox::MathUtilities::Max(d_sq.d_values[MAX_ASPECT_RATIO], - aspect_ratio); + aspect_ratio); d_sq.d_values[SUM_ASPECT_RATIO] += aspect_ratio; d_sq.d_values[SUM_SURFACE_AREA] += surfarea; @@ -153,16 +146,15 @@ void BoxLevelStatistics::computeLocalBoxLevelStatistics( const BoxLevel &box_lev * distributed in d_mpi. */ const double ideal_surfarea = - 2*d_dim.getValue() * - pow(double(box_level.getGlobalNumberOfCells()) / d_mpi.getSize(), - double(d_dim.getValue() - 1) / d_dim.getValue()); + 2 * d_dim.getValue() + * pow(double(box_level.getGlobalNumberOfCells()) / d_mpi.getSize(), + double(d_dim.getValue() - 1) / d_dim.getValue()); d_sq.d_values[SUM_NORM_SURFACE_AREA] = d_sq.d_values[SUM_SURFACE_AREA] / ideal_surfarea; } - /* *********************************************************************** *********************************************************************** @@ -191,11 +183,8 @@ void BoxLevelStatistics::reduceStatistics() d_rank_of_min[i] = d_rank_of_max[i] = 0; } } - - return; } - /* *********************************************************************** * Write out local and globally reduced statistics on the boxes. @@ -213,16 +202,18 @@ void BoxLevelStatistics::printBoxStats( * Smallest surface area possible for the number of cells perfectly * distributed in d_mpi. */ - const double ideal_surfarea = - 2*d_dim.getValue() * + const double ideal_width = pow(d_sq_sum.d_values[NUMBER_OF_CELLS] / d_mpi.getSize(), - double(d_dim.getValue() - 1) / d_dim.getValue()); + 1.0 / d_dim.getValue()); + const double ideal_surfarea = 2 * d_dim.getValue() + * pow(ideal_width, double(d_dim.getValue() - 1)); co << border << "N = " << d_sq_sum.d_values[NUMBER_OF_BOXES] << " (global number of boxes)\n" << border << "P = " << d_mpi.getSize() << " (number of processes)\n" - << border << "Ideal surface area (A) is " << ideal_surfarea << " for " - << (d_sq_sum.d_values[NUMBER_OF_CELLS]/d_mpi.getSize()) << " cells\n" + << border << "Ideal width (W) is " << ideal_width + << ", surface area (A) is " << ideal_surfarea << " for " + << (d_sq_sum.d_values[NUMBER_OF_CELLS] / d_mpi.getSize()) << " cells\n" << border << std::setw(s_longest_length) << std::string() << " local min max sum sum/N sum/P\n"; @@ -240,11 +231,8 @@ void BoxLevelStatistics::printBoxStats( << ' ' << std::setw(8) << std::right << d_sq_sum.d_values[i] / d_mpi.getSize() << '\n'; } - - return; } - /* *********************************************************************** *********************************************************************** @@ -253,21 +241,21 @@ void BoxLevelStatistics::printBoxStats( void BoxLevelStatistics::initializeCallback() { - s_quantity_names[HAS_ANY_BOX] = "has any box"; - s_quantity_names[NUMBER_OF_CELLS] = "num cells"; - s_quantity_names[NUMBER_OF_BOXES] = "num boxes"; - s_quantity_names[MAX_BOX_VOL] = "max box vol"; - s_quantity_names[MIN_BOX_VOL] = "min box vol"; - s_quantity_names[MAX_BOX_LEN] = "max box len"; - s_quantity_names[MIN_BOX_LEN] = "min box len"; - s_quantity_names[MAX_ASPECT_RATIO] = "max aspect ratio"; - s_quantity_names[SUM_ASPECT_RATIO] = "sum aspect ratio"; - s_quantity_names[SUM_SURFACE_AREA] = "sum surf area"; + s_quantity_names[HAS_ANY_BOX] = "has any box"; + s_quantity_names[NUMBER_OF_CELLS] = "num cells"; + s_quantity_names[NUMBER_OF_BOXES] = "num boxes"; + s_quantity_names[MAX_BOX_VOL] = "max box vol"; + s_quantity_names[MIN_BOX_VOL] = "min box vol"; + s_quantity_names[MAX_BOX_LEN] = "max box len"; + s_quantity_names[MIN_BOX_LEN] = "min box len"; + s_quantity_names[MAX_ASPECT_RATIO] = "max aspect ratio"; + s_quantity_names[SUM_ASPECT_RATIO] = "sum aspect ratio"; + s_quantity_names[SUM_SURFACE_AREA] = "sum surf area"; s_quantity_names[SUM_NORM_SURFACE_AREA] = "sum surf area/A"; s_longest_length = 0; - for ( int i=0; i::Max( - s_longest_length, static_cast(s_quantity_names[i].length())); + s_longest_length, static_cast(s_quantity_names[i].length())); } } @@ -279,12 +267,11 @@ BoxLevelStatistics::initializeCallback() void BoxLevelStatistics::finalizeCallback() { - for ( int i=0; igetId()); + insert(itr->getBoxId()); } } @@ -83,7 +79,7 @@ BoxNeighborhoodCollection::operator == ( // check that the neighborhoods are the same. ConstIterator base_boxes_itr(begin()); ConstIterator rhs_base_boxes_itr(rhs.begin()); - for (; base_boxes_itr != end(); ++base_boxes_itr, ++rhs_base_boxes_itr) { + for ( ; base_boxes_itr != end(); ++base_boxes_itr, ++rhs_base_boxes_itr) { // Check that this base Box is the same in each collection and that // the number of neighbors of this base Box is the same in each // collection. @@ -101,7 +97,7 @@ BoxNeighborhoodCollection::operator == ( // neighbor from each collection matches. ConstNeighborIterator nbr_itr(begin(base_boxes_itr)); ConstNeighborIterator rhs_nbr_itr(rhs.begin(rhs_base_boxes_itr)); - for (; nbr_itr != end(base_boxes_itr); ++nbr_itr, ++rhs_nbr_itr) { + for ( ; nbr_itr != end(base_boxes_itr); ++nbr_itr, ++rhs_nbr_itr) { if (!nbr_itr->isSpatiallyEqual(*rhs_nbr_itr) || !nbr_itr->isIdEqual(*rhs_nbr_itr)) { result = false; @@ -123,7 +119,7 @@ bool BoxNeighborhoodCollection::operator != ( const BoxNeighborhoodCollection& rhs) const { - return !(*this == rhs); + return !(*this == rhs); } int @@ -145,13 +141,11 @@ BoxNeighborhoodCollection::hasNeighbor( { if (base_box_itr == end()) { return false; - } - else { + } else { HeadBoxPool::const_iterator nbrs_itr = d_nbrs.find(nbr); if (nbrs_itr == d_nbrs.end()) { return false; - } - else { + } else { return base_box_itr.d_itr->second.find(&(*nbrs_itr)) != base_box_itr.d_itr->second.end(); } @@ -169,7 +163,7 @@ BoxNeighborhoodCollection::neighborhoodEqual( bool result = true; ConstNeighborIterator this_ni = begin(base_box_id); ConstNeighborIterator other_ni = other.begin(base_box_id); - for (; this_ni != end(base_box_id); ++this_ni, ++other_ni) { + for ( ; this_ni != end(base_box_id); ++this_ni, ++other_ni) { if (!this_ni->isIdEqual(*other_ni)) { result = false; break; @@ -207,7 +201,6 @@ BoxNeighborhoodCollection::getOwners( base_box_itr != end(); ++base_box_itr) { getOwners(base_box_itr, owners); } - return; } void @@ -221,7 +214,6 @@ BoxNeighborhoodCollection::getOwners( nbr_itr != end(base_box_itr); ++nbr_itr) { owners.insert(nbr_itr->getOwnerRank()); } - return; } void @@ -247,8 +239,6 @@ BoxNeighborhoodCollection::insert( if (new_nbr_ref) { ++(d_nbr_link_ct.find(&nbr_in_d_nbrs)->second); } - - return; } void @@ -260,7 +250,7 @@ BoxNeighborhoodCollection::insert( TBOX_ASSERT(base_box_itr != end()); // Add each neighbor in the container to the base Box. - for (BoxContainer::const_iterator new_nbr_itr(new_nbrs.begin()); + for (BoxContainer::const_iterator new_nbr_itr = new_nbrs.begin(); new_nbr_itr != new_nbrs.end(); ++new_nbr_itr) { // First add this new neighbor to the collection of neighbors if it is @@ -282,8 +272,6 @@ BoxNeighborhoodCollection::insert( ++(d_nbr_link_ct.find(&nbr_in_d_nbrs)->second); } } - - return; } void @@ -305,12 +293,10 @@ BoxNeighborhoodCollection::erase( if (link_ct == 1) { d_nbr_link_ct.erase(&nbr_in_d_nbrs); d_nbrs.erase(nbr_itr); - } - else { + } else { --link_ct; } } - return; } void @@ -322,7 +308,7 @@ BoxNeighborhoodCollection::erase( TBOX_ASSERT(base_box_itr != end()); // Remove each neighbor in the container from the base Box. - for (BoxContainer::const_iterator old_nbr_itr(nbrs.begin()); + for (BoxContainer::const_iterator old_nbr_itr = nbrs.begin(); old_nbr_itr != nbrs.end(); ++old_nbr_itr) { HeadBoxPool::iterator nbr_itr = d_nbrs.find(*old_nbr_itr); @@ -336,13 +322,11 @@ BoxNeighborhoodCollection::erase( if (link_ct == 1) { d_nbr_link_ct.erase(&nbr_in_d_nbrs); d_nbrs.erase(nbr_itr); - } - else { + } else { --link_ct; } } } - return; } BoxNeighborhoodCollection::InsertRetType @@ -358,11 +342,10 @@ BoxNeighborhoodCollection::insert( // if it is not there. if (base_box_insert_info.second == true) { AdjListItr base_box_itr = d_adj_list.insert( - d_adj_list.end(), - std::make_pair(&(*(base_box_insert_info.first)), Neighborhood())); + d_adj_list.end(), + std::make_pair(&(*(base_box_insert_info.first)), Neighborhood())); return std::make_pair(Iterator(*this, base_box_itr), true); - } - else { + } else { AdjListItr base_box_itr(d_adj_list.find(&(*(base_box_insert_info.first)))); return std::make_pair(Iterator(*this, base_box_itr), false); } @@ -379,7 +362,6 @@ BoxNeighborhoodCollection::erase( // entry. d_base_boxes.erase(base_box_itr.d_base_boxes_itr); d_adj_list.erase(base_box_itr.d_itr); - return; } void @@ -389,12 +371,11 @@ BoxNeighborhoodCollection::erase( { // For each base Box in the range erase it. for (Iterator base_box_itr(first_base_box_itr); - base_box_itr != last_base_box_itr;) { + base_box_itr != last_base_box_itr; ) { Iterator current_base_box(base_box_itr); ++base_box_itr; erase(current_base_box); } - return; } void @@ -403,41 +384,37 @@ BoxNeighborhoodCollection::eraseNonLocalNeighborhoods( { // Find all base Boxes which do not belong to the same processor as this // object and remove them entirely. - for (Iterator base_box_itr(begin()); base_box_itr != end();) { + for (Iterator base_box_itr(begin()); base_box_itr != end(); ) { if (base_box_itr->getOwnerRank() != rank) { Iterator current_base_box(base_box_itr); ++base_box_itr; erase(current_base_box); - } - else { + } else { ++base_box_itr; } } - return; } void BoxNeighborhoodCollection::eraseEmptyNeighborhoods() { // Find all base Boxes which have no neighbors and remove them entirely. - for (Iterator base_box_itr(begin()); base_box_itr != end();) { + for (Iterator base_box_itr(begin()); base_box_itr != end(); ) { if (base_box_itr.d_itr->second.empty()) { Iterator current_base_box(base_box_itr); ++base_box_itr; erase(current_base_box); - } - else { + } else { ++base_box_itr; } } - return; } void BoxNeighborhoodCollection::erasePeriodicNeighbors() { for (Iterator base_box_itr(begin()); base_box_itr != end(); ++base_box_itr) { - for (NeighborIterator nbr(begin(base_box_itr)); nbr != end(base_box_itr);) { + for (NeighborIterator nbr(begin(base_box_itr)); nbr != end(base_box_itr); ) { const Box& nbr_box = *nbr; ++nbr; if (nbr_box.isPeriodicImage()) { @@ -445,7 +422,6 @@ BoxNeighborhoodCollection::erasePeriodicNeighbors() } } } - return; } void @@ -456,7 +432,6 @@ BoxNeighborhoodCollection::clear() d_base_boxes.clear(); d_nbr_link_ct.clear(); d_nbrs.clear(); - return; } void @@ -468,7 +443,6 @@ BoxNeighborhoodCollection::coarsenNeighbors( Box& box_to_coarsen = const_cast(*nbr_itr); box_to_coarsen.coarsen(ratio); } - return; } void @@ -480,7 +454,6 @@ BoxNeighborhoodCollection::refineNeighbors( Box& box_to_refine = const_cast(*nbr_itr); box_to_refine.refine(ratio); } - return; } void @@ -492,7 +465,6 @@ BoxNeighborhoodCollection::growNeighbors( Box& box_to_grow = const_cast(*nbr_itr); box_to_grow.grow(growth); } - return; } void @@ -509,8 +481,7 @@ BoxNeighborhoodCollection::getNeighbors( neighbors.insert(*nbr_itr); } } - } - else { + } else { for (ConstIterator base_box_itr(begin()); base_box_itr != end(); ++base_box_itr) { for (ConstNeighborIterator nbr_itr(begin(base_box_itr)); @@ -519,7 +490,6 @@ BoxNeighborhoodCollection::getNeighbors( } } } - return; } void @@ -539,7 +509,6 @@ BoxNeighborhoodCollection::getNeighbors( } } } - return; } void @@ -554,7 +523,6 @@ BoxNeighborhoodCollection::getNeighbors( neighbors[nbr.getBlockId()].insert(nbr); } } - return; } void @@ -584,7 +552,6 @@ BoxNeighborhoodCollection::getPeriodicNeighbors( } } } - return; } void @@ -613,9 +580,9 @@ BoxNeighborhoodCollection::putToIntBuffer( /* Message size is 1 for number of local base Boxes with neighbor lists plus * the number of neighbors for each base Box plus the amount of box data * written for each base Box and each base Box's neighbors. */ - const int mesg_size = 1 + num_box_neighborhoods + - (num_box_neighborhoods * box_id_com_buf_size) + - (num_nabrs * box_com_buf_size); + const int mesg_size = 1 + num_box_neighborhoods + + (num_box_neighborhoods * box_id_com_buf_size) + + (num_nabrs * box_com_buf_size); send_mesg.resize(mesg_size, buff_init); send_mesg[0] = num_box_neighborhoods; @@ -639,8 +606,6 @@ BoxNeighborhoodCollection::putToIntBuffer( } TBOX_ASSERT(imesg == mesg_size); - - return; } void @@ -685,48 +650,38 @@ BoxNeighborhoodCollection::getFromIntBuffer( } } - return; } -// These are defined in NeighborhoodSet but it's not clear that they -// are ever called or even needed. void -BoxNeighborhoodCollection::putUnregisteredToDatabase( - const boost::shared_ptr& database) const +BoxNeighborhoodCollection::putToRestart( + const boost::shared_ptr& restart_db) const { // This appears to be used in the RedistributedRestartUtility. - database->putBool("d_is_edge_set", true); + restart_db->putBool("d_is_edge_set", true); - database->putInteger( + restart_db->putInteger( "HIER_BOX_NBRHD_COLLECTION_VERSION", HIER_BOX_NBRHD_COLLECTION_VERSION); const int num_neighborhoods = numBoxNeighborhoods(); - database->putInteger("number_of_sets", num_neighborhoods); + restart_db->putInteger("number_of_sets", num_neighborhoods); if (num_neighborhoods > 0) { std::vector owners(num_neighborhoods); std::vector local_indices(num_neighborhoods); std::vector periodic_ids(num_neighborhoods); + int counter = 0; for (ConstIterator ei = begin(); ei != end(); ++ei) { const BoxId& base_box_id = *ei; - owners.push_back(base_box_id.getOwnerRank()); - local_indices.push_back(base_box_id.getLocalId().getValue()); - periodic_ids.push_back(base_box_id.getPeriodicId().getPeriodicValue()); + owners[counter] = base_box_id.getOwnerRank(); + local_indices[counter] = base_box_id.getLocalId().getValue(); + periodic_ids[counter] = base_box_id.getPeriodicId().getPeriodicValue(); + ++counter; } - database->putIntegerArray( - "owners", - &owners[0], - num_neighborhoods); - database->putIntegerArray( - "local_indices", - &local_indices[0], - num_neighborhoods); - database->putIntegerArray( - "periodic_ids", - &periodic_ids[0], - num_neighborhoods); + restart_db->putIntegerVector("owners", owners); + restart_db->putIntegerVector("local_indices", local_indices); + restart_db->putIntegerVector("periodic_ids", periodic_ids); const std::string set_db_string("set_for_local_id_"); for (ConstIterator ei = begin(); ei != end(); ++ei) { @@ -736,10 +691,11 @@ BoxNeighborhoodCollection::putUnregisteredToDatabase( + tbox::Utilities::processorToString(mbid.getOwnerRank()) + tbox::Utilities::patchToString(mbid.getLocalId().getValue()) + tbox::Utilities::intToString(mbid.getPeriodicId().getPeriodicValue()); - tbox::Database& nbr_db = *database->putDatabase(set_name); + boost::shared_ptr nbr_db = + restart_db->putDatabase(set_name); const int mbs_size = numNeighbors(ei); - nbr_db.putInteger("mapped_box_set_size", mbs_size); + nbr_db->putInteger("mapped_box_set_size", mbs_size); if (mbs_size > 0) { @@ -748,67 +704,50 @@ BoxNeighborhoodCollection::putUnregisteredToDatabase( std::vector block_ids(mbs_size); std::vector periodic_ids(mbs_size); - tbox::Array db_box_array(mbs_size); + std::vector db_box_array(mbs_size); - int counter = -1; + counter = 0; for (ConstNeighborIterator ni = begin(ei); ni != end(ei); ++ni) { const Box& nbr = *ni; - local_ids.push_back(nbr.getLocalId().getValue()); - ranks.push_back(nbr.getOwnerRank()); - block_ids.push_back(nbr.getBlockId().getBlockValue()); - periodic_ids.push_back(nbr.getPeriodicId().getPeriodicValue()); - db_box_array[++counter] = nbr; + local_ids[counter] = nbr.getLocalId().getValue(); + ranks[counter] = nbr.getOwnerRank(); + block_ids[counter] = + static_cast(nbr.getBlockId().getBlockValue()); + periodic_ids[counter] = nbr.getPeriodicId().getPeriodicValue(); + db_box_array[counter] = nbr; + ++counter; } - nbr_db.putIntegerArray( - "local_indices", - &local_ids[0], - mbs_size); - nbr_db.putIntegerArray( - "ranks", - &ranks[0], - mbs_size); - nbr_db.putIntegerArray( - "block_ids", - &block_ids[0], - mbs_size); - nbr_db.putIntegerArray( - "periodic_ids", - &periodic_ids[0], - mbs_size); - nbr_db.putDatabaseBoxArray( - "boxes", - &db_box_array[0], - mbs_size); + nbr_db->putIntegerVector("local_indices", local_ids); + nbr_db->putIntegerVector("ranks", ranks); + nbr_db->putIntegerVector("block_ids", block_ids); + nbr_db->putIntegerVector("periodic_ids", periodic_ids); + nbr_db->putDatabaseBoxVector("boxes", db_box_array); } } } - return; } void -BoxNeighborhoodCollection::getFromDatabase( - tbox::Database& database) +BoxNeighborhoodCollection::getFromRestart( + tbox::Database& restart_db) { - const unsigned int number_of_sets = database.getInteger("number_of_sets"); + int version = restart_db.getInteger("HIER_BOX_NBRHD_COLLECTION_VERSION"); + if (version != HIER_BOX_NBRHD_COLLECTION_VERSION) { + TBOX_ERROR("BoxNeighborhoodCollection::getFromRestart() error...\n" + << " Restart file version different than class version."); + } + + const unsigned int number_of_sets = restart_db.getInteger("number_of_sets"); if (number_of_sets > 0) { - std::vector owners(number_of_sets); - std::vector local_indices(number_of_sets); - std::vector periodic_ids(number_of_sets); - database.getIntegerArray( - "owners", - &owners[0], - number_of_sets); - database.getIntegerArray( - "local_indices", - &local_indices[0], - number_of_sets); - database.getIntegerArray( - "periodic_ids", - &periodic_ids[0], - number_of_sets); + std::vector owners = + restart_db.getIntegerVector("owners"); + std::vector local_indices = + restart_db.getIntegerVector("local_indices"); + std::vector periodic_ids = + restart_db.getIntegerVector("periodic_ids"); const std::string set_db_string("set_for_local_id_"); @@ -823,37 +762,22 @@ BoxNeighborhoodCollection::getFromDatabase( + tbox::Utilities::patchToString(box_id.getLocalId().getValue()) + tbox::Utilities::intToString(box_id.getPeriodicId().getPeriodicValue()); boost::shared_ptr nbr_db( - database.getDatabase(set_name)); + restart_db.getDatabase(set_name)); const unsigned int mbs_size = nbr_db->getInteger("mapped_box_set_size"); Iterator base_box_loc = insert(box_id).first; if (mbs_size > 0) { - std::vector local_ids(mbs_size); - std::vector ranks(mbs_size); - std::vector block_ids(mbs_size); - std::vector periodic_ids(mbs_size); - tbox::Array db_box_array(mbs_size); - - nbr_db->getIntegerArray( - "local_indices", - &local_ids[0], - mbs_size); - nbr_db->getIntegerArray( - "ranks", - &ranks[0], - mbs_size); - nbr_db->getIntegerArray( - "block_ids", - &block_ids[0], - mbs_size); - nbr_db->getIntegerArray( - "periodic_ids", - &periodic_ids[0], - mbs_size); - nbr_db->getDatabaseBoxArray( - "boxes", - &db_box_array[0], - mbs_size); + + std::vector local_ids = + nbr_db->getIntegerVector("local_indices"); + std::vector ranks = + nbr_db->getIntegerVector("ranks"); + std::vector block_ids = + nbr_db->getIntegerVector("block_ids"); + std::vector periodic_ids = + nbr_db->getIntegerVector("periodic_ids"); + std::vector db_box_array = + nbr_db->getDatabaseBoxVector("boxes"); for (unsigned int i = 0; i < mbs_size; ++i) { Box nbr(db_box_array[i]); @@ -867,23 +791,22 @@ BoxNeighborhoodCollection::getFromDatabase( } } } - return; } BoxNeighborhoodCollection::Iterator::Iterator( BoxNeighborhoodCollection& nbrhds, - bool from_start) : + bool from_start): d_collection(&nbrhds), d_itr(from_start ? nbrhds.d_adj_list.begin() : - nbrhds.d_adj_list.end()), + nbrhds.d_adj_list.end()), d_base_boxes_itr(from_start ? nbrhds.d_base_boxes.begin() : - nbrhds.d_base_boxes.end()) + nbrhds.d_base_boxes.end()) { } BoxNeighborhoodCollection::Iterator::Iterator( BoxNeighborhoodCollection& nbrhds, - AdjListItr itr) : + AdjListItr itr): d_collection(&nbrhds), d_itr(itr), d_base_boxes_itr(nbrhds.d_base_boxes.find(*(itr->first))) @@ -891,7 +814,7 @@ BoxNeighborhoodCollection::Iterator::Iterator( } BoxNeighborhoodCollection::Iterator::Iterator( - const Iterator& other) : + const Iterator& other): d_collection(other.d_collection), d_itr(other.d_itr), d_base_boxes_itr(other.d_base_boxes_itr) @@ -904,18 +827,18 @@ BoxNeighborhoodCollection::Iterator::~Iterator() BoxNeighborhoodCollection::ConstIterator::ConstIterator( const BoxNeighborhoodCollection& nbrhds, - bool from_start) : + bool from_start): d_collection(&nbrhds), d_itr(from_start ? nbrhds.d_adj_list.begin() : - nbrhds.d_adj_list.end()), + nbrhds.d_adj_list.end()), d_base_boxes_itr(from_start ? nbrhds.d_base_boxes.begin() : - nbrhds.d_base_boxes.end()) + nbrhds.d_base_boxes.end()) { } BoxNeighborhoodCollection::ConstIterator::ConstIterator( const BoxNeighborhoodCollection& nbrhds, - AdjListConstItr itr) : + AdjListConstItr itr): d_collection(&nbrhds), d_itr(itr), d_base_boxes_itr(nbrhds.d_base_boxes.find(*(itr->first))) @@ -923,7 +846,7 @@ BoxNeighborhoodCollection::ConstIterator::ConstIterator( } BoxNeighborhoodCollection::ConstIterator::ConstIterator( - const ConstIterator& other) : + const ConstIterator& other): d_collection(other.d_collection), d_itr(other.d_itr), d_base_boxes_itr(other.d_base_boxes_itr) @@ -931,7 +854,7 @@ BoxNeighborhoodCollection::ConstIterator::ConstIterator( } BoxNeighborhoodCollection::ConstIterator::ConstIterator( - const Iterator& other) : + const Iterator& other): d_collection(other.d_collection), d_itr(other.d_itr), d_base_boxes_itr(other.d_base_boxes_itr) @@ -944,16 +867,16 @@ BoxNeighborhoodCollection::ConstIterator::~ConstIterator() BoxNeighborhoodCollection::NeighborIterator::NeighborIterator( Iterator& base_box_itr, - bool from_start) : + bool from_start): d_collection(base_box_itr.d_collection), d_base_box(base_box_itr.d_itr->first), d_itr(from_start ? base_box_itr.d_itr->second.begin() : - base_box_itr.d_itr->second.end()) + base_box_itr.d_itr->second.end()) { } BoxNeighborhoodCollection::NeighborIterator::NeighborIterator( - const NeighborIterator& other) : + const NeighborIterator& other): d_collection(other.d_collection), d_base_box(other.d_base_box), d_itr(other.d_itr) @@ -966,16 +889,16 @@ BoxNeighborhoodCollection::NeighborIterator::~NeighborIterator() BoxNeighborhoodCollection::ConstNeighborIterator::ConstNeighborIterator( const ConstIterator& base_box_itr, - bool from_start) : + bool from_start): d_collection(base_box_itr.d_collection), d_base_box(base_box_itr.d_itr->first), d_itr(from_start ? base_box_itr.d_itr->second.begin() : - base_box_itr.d_itr->second.end()) + base_box_itr.d_itr->second.end()) { } BoxNeighborhoodCollection::ConstNeighborIterator::ConstNeighborIterator( - const ConstNeighborIterator& other) : + const ConstNeighborIterator& other): d_collection(other.d_collection), d_base_box(other.d_base_box), d_itr(other.d_itr) @@ -983,7 +906,7 @@ BoxNeighborhoodCollection::ConstNeighborIterator::ConstNeighborIterator( } BoxNeighborhoodCollection::ConstNeighborIterator::ConstNeighborIterator( - const NeighborIterator& other) : + const NeighborIterator& other): d_collection(other.d_collection), d_base_box(other.d_base_box), d_itr(other.d_itr) @@ -996,5 +919,3 @@ BoxNeighborhoodCollection::ConstNeighborIterator::~ConstNeighborIterator() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxNeighborhoodCollection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxNeighborhoodCollection.h index f79bc3a8..14919e3b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxNeighborhoodCollection.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxNeighborhoodCollection.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A class describing the adjacency of Boxes. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -41,1618 +41,1644 @@ class BoxNeighborhoodCollection friend class Iterator; friend class ConstIterator; - private: - // Strict weak ordering for pointers to Boxes. - struct box_ptr_less { - bool - operator () (const Box* box0, const Box* box1) const - { - return box0->getId() < box1->getId(); - } - }; - - // Strict weak ordering for Boxes. - struct box_less { - bool - operator () (const Box& box0, const Box& box1) const - { - return box0.getId() < box1.getId(); - } - }; - - // Strict weak ordering for pointers to BoxIds. - struct box_id_ptr_less { - bool - operator () (const BoxId* id0, const BoxId* id1) const - { - return *id0 < *id1; - } - }; - - // Strict weak ordering for BoxIds. - struct box_id_less { - bool - operator () (const BoxId& id0, const BoxId& id1) const - { - return id0 < id1; - } - }; - - // Typedefs. - - typedef std::set BaseBoxPool; - - typedef BaseBoxPool::iterator BaseBoxPoolItr; - - typedef std::set HeadBoxPool; - - typedef std::map HeadBoxLinkCt; - - typedef std::set Neighborhood; - - typedef Neighborhood::iterator NeighborhoodItr; - - typedef Neighborhood::const_iterator NeighborhoodConstItr; - - typedef std::map AdjList; - - typedef AdjList::iterator AdjListItr; - - typedef AdjList::const_iterator AdjListConstItr; - - /* - * Static integer constant describing class's version number. - */ - static const int HIER_BOX_NBRHD_COLLECTION_VERSION; - - /*! - * @brief The pool of BoxIds of base Boxes. - */ - BaseBoxPool d_base_boxes; +private: + // Strict weak ordering for pointers to Boxes. + struct box_ptr_less { + bool + operator () (const Box* box0, const Box* box1) const + { + return box0->getBoxId() < box1->getBoxId(); + } + }; - /*! - * @brief The pool of head Boxes. - */ - HeadBoxPool d_nbrs; + // Strict weak ordering for Boxes. + struct box_less { + bool + operator () (const Box& box0, const Box& box1) const + { + return box0.getBoxId() < box1.getBoxId(); + } + }; - /*! - * @brief The links between members of the pool of base Box BoxIds and - * members of the pool of head Boxes. The links are directed from base - * to head hence a given base BoxId is linked to arbitrarily many head - * Boxes. - */ - AdjList d_adj_list; + // Strict weak ordering for pointers to BoxIds. + struct box_id_ptr_less { + bool + operator () (const BoxId* id0, const BoxId* id1) const + { + return *id0 < *id1; + } + }; - /*! - * @brief The number of incident links for each member of the pool of - * head Boxes. - */ - HeadBoxLinkCt d_nbr_link_ct; + // Strict weak ordering for BoxIds. + struct box_id_less { + bool + operator () (const BoxId& id0, const BoxId& id1) const + { + return id0 < id1; + } + }; - public: + // Typedefs. + + typedef std::set BaseBoxPool; + + typedef BaseBoxPool::iterator BaseBoxPoolItr; + + typedef std::set HeadBoxPool; + + typedef std::map HeadBoxLinkCt; + + typedef std::set Neighborhood; + + typedef Neighborhood::iterator NeighborhoodItr; + + typedef Neighborhood::const_iterator NeighborhoodConstItr; + + typedef std::map AdjList; + + typedef AdjList::iterator AdjListItr; + + typedef AdjList::const_iterator AdjListConstItr; + + /* + * Static integer constant describing class's version number. + */ + static const int HIER_BOX_NBRHD_COLLECTION_VERSION; + + /*! + * @brief The pool of BoxIds of base Boxes. + */ + BaseBoxPool d_base_boxes; + + /*! + * @brief The pool of head Boxes. + */ + HeadBoxPool d_nbrs; + + /*! + * @brief The links between members of the pool of base Box BoxIds and + * members of the pool of head Boxes. The links are directed from base + * to head hence a given base BoxId is linked to arbitrarily many head + * Boxes. + */ + AdjList d_adj_list; + + /*! + * @brief The number of incident links for each member of the pool of + * head Boxes. + */ + HeadBoxLinkCt d_nbr_link_ct; + +public: + // Constructors. + + /*! + * @brief Constructs an empty object. There are not yet any base Boxes + * whose neighborhoods are represented by this object. + */ + BoxNeighborhoodCollection(); + + /*! + * @brief Constructs a collection of empty neighborhoods for each base + * box in base_boxes. + * + * @param base_boxes Base boxes whose neighborhoods will be represented + * by this object. + */ + BoxNeighborhoodCollection( + const BoxContainer& base_boxes); + + /*! + * @brief Copy constructor. + * + * @param other + */ + BoxNeighborhoodCollection( + const BoxNeighborhoodCollection& other); + + /*! + * @brief Assignment operator. + * + * @param rhs + */ + BoxNeighborhoodCollection& + operator = ( + const BoxNeighborhoodCollection& rhs); + + // Destructor + + /*! + * @brief Destructor + */ + ~BoxNeighborhoodCollection(); + + // Operators + + /*! + * @brief Determine if two collections are equivalent. + * + * @param rhs + */ + bool + operator == ( + const BoxNeighborhoodCollection& rhs) const; + + /*! + * @brief Determine if two collections are not equivalent. + * + * @param rhs + */ + bool + operator != ( + const BoxNeighborhoodCollection& rhs) const; + + //@{ + /*! + * @name Iteration + */ + + class Iterator; + class ConstNeighborIterator; + /*! + * @brief An iterator over the base Boxes of the neighborhoods in a const + * BoxNeighborhoodCollection. The interface does not allow modification + * of the base Boxes. + */ + class ConstIterator + { + friend class BoxNeighborhoodCollection; + friend class Connector; + friend class ConstNeighborIterator; + +public: // Constructors. /*! - * @brief Constructs an empty object. There are not yet any base Boxes - * whose neighborhoods are represented by this object. - */ - BoxNeighborhoodCollection(); - - /*! - * @brief Constructs a collection of empty neighborhoods for each base - * box in base_boxes. + * @brief Constructs an iterator over the base Boxes in the + * supplied collection. * - * @param base_boxes Base boxes whose neighborhoods will be represented - * by this object. + * @param nbrhds + * @param from_start */ - BoxNeighborhoodCollection( - const BoxContainer& base_boxes); + ConstIterator( + const BoxNeighborhoodCollection& nbrhds, + bool from_start = true); /*! * @brief Copy constructor. * * @param other */ - BoxNeighborhoodCollection( - const BoxNeighborhoodCollection& other); + ConstIterator( + const ConstIterator& other); /*! - * @brief Assignment operator. + * @brief Copy constructor. * - * @param rhs - */ - BoxNeighborhoodCollection& operator = ( - const BoxNeighborhoodCollection& rhs); - - - // Destructor - - /*! - * @brief Destructor + * @param other */ - ~BoxNeighborhoodCollection(); - - - // Operators + ConstIterator( + const Iterator& other); /*! - * @brief Determine if two collections are equivalent. + * @brief Assignment operator. * * @param rhs */ - bool - operator == ( - const BoxNeighborhoodCollection& rhs) const; + ConstIterator& + operator = ( + const ConstIterator& rhs) + { + d_collection = rhs.d_collection; + d_itr = rhs.d_itr; + d_base_boxes_itr = rhs.d_base_boxes_itr; + return *this; + } /*! - * @brief Determine if two collections are not equivalent. + * @brief Assignment operator. * * @param rhs */ - bool - operator != ( - const BoxNeighborhoodCollection& rhs) const; - - //@{ - /*! - * @name Iteration - */ - - class Iterator; - class ConstNeighborIterator; - /*! - * @brief An iterator over the base Boxes of the neighborhoods in a const - * BoxNeighborhoodCollection. The interface does not allow modification - * of the base Boxes. - */ - class ConstIterator + ConstIterator& + operator = ( + const Iterator& rhs) { - friend class BoxNeighborhoodCollection; - friend class Connector; - friend class ConstNeighborIterator; - - public: - // Constructors. - - /*! - * @brief Constructs an iterator over the base Boxes in the - * supplied collection. - * - * @param nbrhds - * @param from_start - */ - ConstIterator( - const BoxNeighborhoodCollection& nbrhds, - bool from_start = true); - - /*! - * @brief Copy constructor. - * - * @param other - */ - ConstIterator( - const ConstIterator& other); - - /*! - * @brief Copy constructor. - * - * @param other - */ - ConstIterator( - const Iterator& other); - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - ConstIterator& - operator = ( - const ConstIterator& rhs) - { - d_collection = rhs.d_collection; - d_itr = rhs.d_itr; - d_base_boxes_itr = rhs.d_base_boxes_itr; - return *this; - } - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - ConstIterator& - operator = ( - const Iterator& rhs) - { - d_collection = rhs.d_collection; - d_itr = rhs.d_itr; - d_base_boxes_itr = rhs.d_base_boxes_itr; - return *this; - } - - - // Destructor - - /*! - * @brief Performs necessary deletion. - */ - ~ConstIterator(); - - - // Operators - - /*! - * @brief Extracts the BoxId of the base Box of the current - * neighborhood in the iteration. - */ - const BoxId& - operator * () const - { - return *(d_itr->first); - } - - /*! - * @brief Extracts a pointer to the BoxId of the base Box of the - * current neighborhood in the iteration. - */ - const BoxId* - operator -> () const - { - return d_itr->first; - } - - /*! - * @brief Post-increment iterator to point to BoxId of the base Box - * of next neighborhood in the collection. - */ - ConstIterator - operator ++ ( - int) - { - // Go to the next base Box. - ConstIterator tmp = *this; - if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { - ++d_base_boxes_itr; - ++d_itr; - } - return tmp; - } - - /*! - * @brief Pre-increment iterator to point to BoxId of the base Box - * of next neighborhood in the collection. - */ - ConstIterator& - operator ++ () - { - // Go to the next base Box. - if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { - ++d_base_boxes_itr; - ++d_itr; - } - return *this; - } - - /*! - * @brief Determine if two iterators are equivalent. - * - * @param rhs - */ - bool - operator == ( - const ConstIterator& rhs) const - { - return d_collection == rhs.d_collection && - d_itr == rhs.d_itr && - d_base_boxes_itr == rhs.d_base_boxes_itr; - } - - /*! - * @brief Determine if two iterators are not equivalent. - * - * @param rhs - */ - bool - operator != ( - const ConstIterator& rhs) const - { - return !(*this == rhs); - } - - private: - // Default constructor does not exist. - ConstIterator(); - - /*! - * @brief Constructs an iterator pointing to a specific base Box in - * nbrhds. Should only be called by BoxNeighborhoodCollection. - * - * @param nbrhds - * - * @param itr - */ - ConstIterator( - const BoxNeighborhoodCollection& nbrhds, - AdjListConstItr itr); - - const BoxNeighborhoodCollection* d_collection; - - AdjListConstItr d_itr; - - BaseBoxPoolItr d_base_boxes_itr; - }; - - class NeighborIterator; - - /*! - * @brief An iterator over the base Boxes of the neighborhoods in a - * BoxNeighborhoodCollection. The interface does not allow modification - * of the base Boxes. - */ - class Iterator - { - friend class BoxNeighborhoodCollection; - friend class Connector; - friend class ConstIterator; - friend class NeighborIterator; - - public: - // Constructors. - - /*! - * @brief Constructs an iterator over the base Boxes in the - * supplied collection. - * - * @param nbrhds - * @param from_start - */ - Iterator( - BoxNeighborhoodCollection& nbrhds, - bool from_start = true); - - /*! - * @brief Copy constructor. - * - * @param other - */ - Iterator( - const Iterator& other); - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - Iterator& - operator = ( - const Iterator& rhs) - { - d_collection = rhs.d_collection; - d_itr = rhs.d_itr; - d_base_boxes_itr = rhs.d_base_boxes_itr; - return *this; - } - - - // Destructor - - /*! - * @brief Performs necessary deletion. - */ - ~Iterator(); - - - // Operators - - /*! - * @brief Extracts the BoxId of the base Box of the current - * neighborhood in the iteration. - */ - const BoxId& - operator * () const - { - return *(d_itr->first); - } - - /*! - * @brief Extracts a pointer to the BoxId of the base Box of the - * current neighborhood in the iteration. - */ - const BoxId* - operator -> () const - { - return d_itr->first; - } - - /*! - * @brief Post-increment iterator to point to BoxId of the base Box - * of next neighborhood in the collection. - */ - Iterator - operator ++ ( - int) - { - // Go to the next base Box. - Iterator tmp = *this; - if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { - ++d_base_boxes_itr; - ++d_itr; - } - return tmp; - } - - /*! - * @brief Pre-increment iterator to point to BoxId of the base Box - * of next neighborhood in the collection. - */ - Iterator& - operator ++ () - { - // Go to the next base Box. - if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { - ++d_base_boxes_itr; - ++d_itr; - } - return *this; - } - - /*! - * @brief Determine if two iterators are equivalent. - * - * @param rhs - */ - bool - operator == ( - const Iterator& rhs) const - { - return d_collection == rhs.d_collection && - d_itr == rhs.d_itr && - d_base_boxes_itr == rhs.d_base_boxes_itr; - } - - /*! - * @brief Determine if two iterators are not equivalent. - * - * @param rhs - */ - bool - operator != ( - const Iterator& rhs) const - { - return !(*this == rhs); - } - - private: - // Default constructor does not exist. - Iterator(); - - /*! - * @brief Constructs an iterator pointing to a specific base Box in - * nbrhds. Should only be called by BoxNeighborhoodCollection. - * - * @param nbrhds - * - * @param itr - */ - Iterator( - BoxNeighborhoodCollection& nbrhds, - AdjListItr itr); - - const BoxNeighborhoodCollection* d_collection; - - AdjListItr d_itr; - - BaseBoxPoolItr d_base_boxes_itr; - }; + d_collection = rhs.d_collection; + d_itr = rhs.d_itr; + d_base_boxes_itr = rhs.d_base_boxes_itr; + return *this; + } - /*! - * @brief An iterator over the neighbors in the neighborhood of a base - * Box in a const BoxNeighborhoodCollection. The interface does not - * allow modification of the neighbors. - */ - class ConstNeighborIterator - { - friend class BoxNeighborhoodCollection; - - public: - // Constructors - - /*! - * @brief Constructs an iterator over the neighbors of the base Box - * pointed to by the supplied Iterator in the supplied collection - * of neighborhoods. - * - * @param base_box_itr - * @param from_start If true constructs an iterator pointing to the - * first neighbor. Otherwise constructs an iterator pointing one - * past the last neighbor. - */ - ConstNeighborIterator( - const ConstIterator& base_box_itr, - bool from_start = true); - - /*! - * @brief Copy constructor. - * - * @param other - */ - ConstNeighborIterator( - const ConstNeighborIterator& other); - - /*! - * @brief Copy constructor. - * - * @param other - */ - ConstNeighborIterator( - const NeighborIterator& other); - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - ConstNeighborIterator& - operator = ( - const ConstNeighborIterator& rhs) - { - d_collection = rhs.d_collection; - d_base_box = rhs.d_base_box; - d_itr = rhs.d_itr; - return *this; - } - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - ConstNeighborIterator& - operator = ( - const NeighborIterator& rhs) - { - d_collection = rhs.d_collection; - d_base_box = rhs.d_base_box; - d_itr = rhs.d_itr; - return *this; - } - - - // Destructor - - /*! - * @brief Performs necessary deletion. - */ - ~ConstNeighborIterator(); - - - // Operators - - /*! - * @brief Extract the Box which is the current neighbor in the - * iteration of the neighborhood of the base Box. - */ - const Box& - operator * () const - { - return *(*d_itr); - } - - /*! - * @brief Extracts a pointer to the Box which is current neighbor - * in the iteration of the neighborhood of the base Box. - */ - const Box* - operator -> () const - { - return *d_itr; - } - - /*! - * @brief Post-increment iterator to point to the Box which is the - * next neighbor of the base Box. - */ - ConstNeighborIterator - operator ++ ( - int) - { - ConstNeighborIterator tmp = *this; - if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { - ++d_itr; - } - return tmp; - } - - /*! - * @brief Pre-increment iterator to point to the Box which is the - * next neighbor of the base Box. - */ - ConstNeighborIterator& - operator ++ () - { - if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { - ++d_itr; - } - return *this; - } - - /*! - * @brief Determine if two iterators are equivalent. - * - * @param rhs - */ - bool - operator == ( - const ConstNeighborIterator& rhs) const - { - return d_collection == rhs.d_collection && - d_base_box == rhs.d_base_box && - d_itr == rhs.d_itr; - } - - /*! - * @brief Determine if two iterators are not equivalent. - * - * @param rhs - */ - bool - operator != ( - const ConstNeighborIterator& rhs) const - { - return !(*this == rhs); - } - - private: - // Default constructor does not exist. - ConstNeighborIterator(); - - const BoxNeighborhoodCollection* d_collection; - - const BoxId* d_base_box; - - NeighborhoodConstItr d_itr; - }; + // Destructor /*! - * @brief An iterator over the neighbors in the neighborhood of a base - * Box in a BoxNeighborhoodCollection. The interface does not allow - * modification of the neighbors. + * @brief Performs necessary deletion. */ - class NeighborIterator - { - friend class BoxNeighborhoodCollection; - friend class ConstNeighborIterator; - - public: - // Constructors - - /*! - * @brief Constructs an iterator over the neighbors of the base Box - * pointed to by the supplied Iterator in the supplied collection - * of neighborhoods. - * - * @param base_box_itr - * @param from_start If true constructs an iterator pointing to the - * first neighbor. Otherwise constructs an iterator pointing one - * past the last neighbor. - */ - NeighborIterator( - Iterator& base_box_itr, - bool from_start = true); - - /*! - * @brief Copy constructor. - * - * @param other - */ - NeighborIterator( - const NeighborIterator& other); - - /*! - * @brief Assignment operator. - * - * @param rhs - */ - NeighborIterator& - operator = ( - const NeighborIterator& rhs) - { - d_collection = rhs.d_collection; - d_base_box = rhs.d_base_box; - d_itr = rhs.d_itr; - return *this; - } - - - // Destructor - - /*! - * @brief Performs necessary deletion. - */ - ~NeighborIterator(); - - - // Operators - - /*! - * @brief Extract the Box which is the current neighbor in the - * iteration of the neighborhood of the base Box. - */ - const Box& - operator * () const - { - return *(*d_itr); - } - - /*! - * @brief Extracts a pointer to the Box which is current neighbor - * in the iteration of the neighborhood of the base Box. - */ - const Box* - operator -> () const - { - return *d_itr; - } - - /*! - * @brief Post-increment iterator to point to the Box which is the - * next neighbor of the base Box. - */ - NeighborIterator - operator ++ ( - int) - { - NeighborIterator tmp = *this; - if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { - ++d_itr; - } - return tmp; - } - - /*! - * @brief Pre-increment iterator to point to the Box which is the - * next neighbor of the base Box. - */ - NeighborIterator& - operator ++ () - { - if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { - ++d_itr; - } - return *this; - } - - /*! - * @brief Determine if two iterators are equivalent. - * - * @param rhs - */ - bool - operator == ( - const NeighborIterator& rhs) const - { - return d_collection == rhs.d_collection && - d_base_box == rhs.d_base_box && - d_itr == rhs.d_itr; - } - - /*! - * @brief Determine if two iterators are not equivalent. - * - * @param rhs - */ - bool - operator != ( - const NeighborIterator& rhs) const - { - return !(*this == rhs); - } - - private: - // Default constructor does not exist. - NeighborIterator(); - - const BoxNeighborhoodCollection* d_collection; - - const BoxId* d_base_box; - - NeighborhoodItr d_itr; - }; + ~ConstIterator(); - /*! - * @brief Returns an iterator pointing to the beginning of the collection - * of neighborhoods. - */ - Iterator - begin() - { - return Iterator(*this); - } + // Operators /*! - * @brief Returns an iterator pointing to the beginning of the collection - * of neighborhoods. + * @brief Extracts the BoxId of the base Box of the current + * neighborhood in the iteration. */ - ConstIterator - begin() const + const BoxId& + operator * () const { - return ConstIterator(*this); + return *(d_itr->first); } /*! - * @brief Returns an iterator pointing just past the end of the - * collection of neighborhoods. + * @brief Extracts a pointer to the BoxId of the base Box of the + * current neighborhood in the iteration. */ - Iterator - end() + const BoxId * + operator -> () const { - return Iterator(*this, false); + return d_itr->first; } /*! - * @brief Returns an iterator pointing just past the end of the - * collection of neighborhoods. + * @brief Post-increment iterator to point to BoxId of the base Box + * of next neighborhood in the collection. */ ConstIterator - end() const + operator ++ ( + int) { - return ConstIterator(*this, false); + // Go to the next base Box. + ConstIterator tmp = *this; + if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { + ++d_base_boxes_itr; + ++d_itr; + } + return tmp; } /*! - * @brief Returns an iterator pointing to the first neighbor in the - * neighborhood of the base Box with the supplied BoxId. - * - * @param base_box_id + * @brief Pre-increment iterator to point to BoxId of the base Box + * of next neighborhood in the collection. */ - NeighborIterator - begin( - const BoxId& base_box_id) + ConstIterator& + operator ++ () { - Iterator itr(find(base_box_id)); - return begin(itr); + // Go to the next base Box. + if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { + ++d_base_boxes_itr; + ++d_itr; + } + return *this; } /*! - * @brief Returns an iterator pointing to the first neighbor in the - * neighborhood of the base Box with the supplied BoxId. + * @brief Determine if two iterators are equivalent. * - * @param base_box_id + * @param rhs */ - ConstNeighborIterator - begin( - const BoxId& base_box_id) const + bool + operator == ( + const ConstIterator& rhs) const { - return begin(find(base_box_id)); + return d_collection == rhs.d_collection && + d_itr == rhs.d_itr && + d_base_boxes_itr == rhs.d_base_boxes_itr; } /*! - * @brief Returns an iterator pointing to the first neighbor in the - * neighborhood of the base Box pointed to by base_box_itr. + * @brief Determine if two iterators are not equivalent. * - * @param base_box_itr + * @param rhs */ - NeighborIterator - begin( - Iterator& base_box_itr) + bool + operator != ( + const ConstIterator& rhs) const { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return NeighborIterator(base_box_itr); + return !(*this == rhs); } - /*! - * @brief Returns an iterator pointing to the first neighbor in the - * neighborhood of the base Box pointed to by base_box_itr. - * - * @param base_box_itr - */ - ConstNeighborIterator - begin( - const ConstIterator& base_box_itr) const - { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return ConstNeighborIterator(base_box_itr); - } +private: + // Default constructor does not exist. + ConstIterator(); /*! - * @brief Returns an iterator pointing just past the last neighbor in the - * neighborhood of the base Box with the supplied BoxId. + * @brief Constructs an iterator pointing to a specific base Box in + * nbrhds. Should only be called by BoxNeighborhoodCollection. * - * @param base_box_id - */ - NeighborIterator - end( - const BoxId& base_box_id) - { - Iterator itr(find(base_box_id)); - return end(itr); - } - - /*! - * @brief Returns an iterator pointing just past the last neighbor in the - * neighborhood of the base Box with the supplied BoxId. + * @param nbrhds * - * @param base_box_id + * @param itr */ - ConstNeighborIterator - end( - const BoxId& base_box_id) const - { - return end(find(base_box_id)); - } + ConstIterator( + const BoxNeighborhoodCollection& nbrhds, + AdjListConstItr itr); - /*! - * @brief Returns an iterator pointing just past the last neighbor in the - * neighborhood of the base Box pointed to by base_box_itr. - * - * @param base_box_itr - */ - NeighborIterator - end( - Iterator& base_box_itr) - { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return NeighborIterator(base_box_itr, false); - } + const BoxNeighborhoodCollection* d_collection; - /*! - * @brief Returns an iterator pointing just past the last neighbor in the - * neighborhood of the base Box pointed to by base_box_itr. - * - * @param base_box_itr - */ - ConstNeighborIterator - end( - const ConstIterator& base_box_itr) const - { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return ConstNeighborIterator(base_box_itr, false); - } + AdjListConstItr d_itr; - //@} + BaseBoxPoolItr d_base_boxes_itr; + }; + + class NeighborIterator; + + /*! + * @brief An iterator over the base Boxes of the neighborhoods in a + * BoxNeighborhoodCollection. The interface does not allow modification + * of the base Boxes. + */ + class Iterator + { + friend class BoxNeighborhoodCollection; + friend class Connector; + friend class ConstIterator; + friend class NeighborIterator; + +public: + // Constructors. - //@{ /*! - * @name Lookup + * @brief Constructs an iterator over the base Boxes in the + * supplied collection. + * + * @param nbrhds + * @param from_start */ + Iterator( + BoxNeighborhoodCollection& nbrhds, + bool from_start = true); /*! - * @brief Returns an iterator pointing to the base Box with the supplied - * BoxId. If no base Box's BoxId is base_box_id this method returns - * end(). + * @brief Copy constructor. * - * @param base_box_id + * @param other */ - ConstIterator - find( - const BoxId& base_box_id) const - { - BaseBoxPoolItr base_boxes_itr = d_base_boxes.find(base_box_id); - if (base_boxes_itr == d_base_boxes.end()) { - return end(); - } - else { - return ConstIterator(*this, d_adj_list.find(&(*base_boxes_itr))); - } - } + Iterator( + const Iterator& other); /*! - * @brief Returns an iterator pointing to the base Box with the supplied - * BoxId. If no base Box's BoxId is base_box_id this method returns - * end(). + * @brief Assignment operator. * - * @param base_box_id + * @param rhs */ - Iterator - find( - const BoxId& base_box_id) + Iterator& + operator = ( + const Iterator& rhs) { - BaseBoxPoolItr base_boxes_itr = d_base_boxes.find(base_box_id); - if (base_boxes_itr == d_base_boxes.end()) { - return end(); - } - else { - return Iterator(*this, d_adj_list.find(&(*base_boxes_itr))); - } + d_collection = rhs.d_collection; + d_itr = rhs.d_itr; + d_base_boxes_itr = rhs.d_base_boxes_itr; + return *this; } - //@} - - - // Typedefs - typedef std::pair InsertRetType; - + // Destructor - //@{ /*! - * @name State queries + * @brief Performs necessary deletion. */ + ~Iterator(); - /*! - * @brief Returns true if the number of box neighborhoods == 0. - */ - bool - empty() const - { - return d_base_boxes.empty(); - } + // Operators /*! - * @brief Returns the number of box neighborhoods. + * @brief Extracts the BoxId of the base Box of the current + * neighborhood in the iteration. */ - int - numBoxNeighborhoods() const + const BoxId& + operator * () const { - return static_cast(d_base_boxes.size()); + return *(d_itr->first); } /*! - * @brief Returns true if the neighborhood of the base Box with the - * supplied BoxId is empty. - * - * @param base_box_id + * @brief Extracts a pointer to the BoxId of the base Box of the + * current neighborhood in the iteration. */ - bool - emptyBoxNeighborhood( - const BoxId& base_box_id) const + const BoxId * + operator -> () const { - return emptyBoxNeighborhood(find(base_box_id)); + return d_itr->first; } /*! - * @brief Returns true if the neighborhood of the base Box pointed to by - * base_box_itr is empty. - * - * @param base_box_itr + * @brief Post-increment iterator to point to BoxId of the base Box + * of next neighborhood in the collection. */ - bool - emptyBoxNeighborhood( - const ConstIterator& base_box_itr) const + Iterator + operator ++ ( + int) { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return base_box_itr.d_itr->second.empty(); + // Go to the next base Box. + Iterator tmp = *this; + if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { + ++d_base_boxes_itr; + ++d_itr; + } + return tmp; } /*! - * @brief Returns the number of neighbors in the neighborhood of the base - * Box with the supplied BoxId. - * - * @param base_box_id + * @brief Pre-increment iterator to point to BoxId of the base Box + * of next neighborhood in the collection. */ - int - numNeighbors( - const BoxId& base_box_id) const + Iterator& + operator ++ () { - return numNeighbors(find(base_box_id)); + // Go to the next base Box. + if (d_base_boxes_itr != d_collection->d_base_boxes.end()) { + ++d_base_boxes_itr; + ++d_itr; + } + return *this; } /*! - * @brief Returns the number of neighbors in the neighborhood of the base - * Box pointed to by base_box_itr. + * @brief Determine if two iterators are equivalent. * - * @param base_box_itr + * @param rhs */ - int - numNeighbors( - const ConstIterator& base_box_itr) const + bool + operator == ( + const Iterator& rhs) const { - TBOX_ASSERT(base_box_itr.d_collection == this); - TBOX_ASSERT(base_box_itr != end()); - return static_cast(base_box_itr.d_itr->second.size()); + return d_collection == rhs.d_collection && + d_itr == rhs.d_itr && + d_base_boxes_itr == rhs.d_base_boxes_itr; } /*! - * @brief Returns the number of neighbors in all neighborhoods. - */ - int - sumNumNeighbors() const; - - /*! - * @brief Returns true if nbr is a neighbor of the base Box with the - * supplied BoxId. + * @brief Determine if two iterators are not equivalent. * - * @param base_box_id - * @param nbr + * @param rhs */ bool - hasNeighbor( - const BoxId& base_box_id, - const Box& nbr) const + operator != ( + const Iterator& rhs) const { - return hasNeighbor(find(base_box_id), nbr); + return !(*this == rhs); } - /*! - * @brief Returns true if nbr is a neighbor of the base Box pointed to by - * base_box_itr. - * - * @param base_box_itr - * @param nbr - */ - bool - hasNeighbor( - const ConstIterator& base_box_itr, - const Box& nbr) const; +private: + // Default constructor does not exist. + Iterator(); /*! - * @brief Returns true if the neighborhood of the base Box with the - * supplied BoxId is the same in this and other. + * @brief Constructs an iterator pointing to a specific base Box in + * nbrhds. Should only be called by BoxNeighborhoodCollection. * - * @param base_box_id - * @param other - */ - bool - neighborhoodEqual( - const BoxId& base_box_id, - const BoxNeighborhoodCollection& other) const; - - /*! - * @brief Returns true if base_box_id is the BoxId of the base Box of a - * neighborhood held by this object. + * @param nbrhds * - * @param base_box_id + * @param itr */ - bool - isBaseBox( - const BoxId& base_box_id) const - { - return find(base_box_id) != end(); - } + Iterator( + BoxNeighborhoodCollection& nbrhds, + AdjListItr itr); - /*! - * @brief Returns true if all neighbors of all base Boxes are owned by - * the processor owning this object. - * - * @note Currently, this is only called (via Connector::isLocal) from - * within a small number of TBOX_ASSERTs so it is only a sanity check and - * is not called in optimized code. If the method becomes - * algorithmically important an optimization would be to store a boolean - * to indicate if there are any non-local neighbors which would avoid the - * search that this method currently does. - * - * @param rank The rank of the process owning this object. - */ - bool - isLocal( - int rank) const; + const BoxNeighborhoodCollection* d_collection; - //@} + AdjListItr d_itr; - /*! - * @brief Insert the rank of the processor owning each neighbor in each - * neighborhood into the supplied set. - * - * @param owners - */ - void - getOwners( - std::set& owners) const; + BaseBoxPoolItr d_base_boxes_itr; + }; - /*! - * @brief Insert the rank of the processor owning each neighbor in each - * neighborhood into the supplied set. - * - * @param itr - * @param owners - */ - void - getOwners( - ConstIterator& itr, - std::set& owners) const; + /*! + * @brief An iterator over the neighbors in the neighborhood of a base + * Box in a const BoxNeighborhoodCollection. The interface does not + * allow modification of the neighbors. + */ + class ConstNeighborIterator + { + friend class BoxNeighborhoodCollection; +public: + typedef std::forward_iterator_tag iterator_category; + typedef Box value_type; + typedef ptrdiff_t difference_type; + typedef Box * pointer; + typedef Box& reference; - //@{ - /*! - * @name Neighborhood editing - */ + // Constructors /*! - * @brief Inserts a new neighbor into the neighborhood of the base Box - * with the supplied BoxId. - * - * @param base_box_id The BoxId of the neighborhood base Box. - * - * @param new_nbr The new neighbor of base_box_id. + * @brief Constructs an iterator over the neighbors of the base Box + * pointed to by the supplied Iterator in the supplied collection + * of neighborhoods. * - * @return An Iterator pointing to the base Box with the supplied BoxId. + * @param base_box_itr + * @param from_start If true constructs an iterator pointing to the + * first neighbor. Otherwise constructs an iterator pointing one + * past the last neighbor. */ - Iterator - insert( - const BoxId& base_box_id, - const Box& new_nbr) - { - Iterator base_boxes_itr = insert(base_box_id).first; - insert(base_boxes_itr, new_nbr); - return base_boxes_itr; - } + ConstNeighborIterator( + const ConstIterator& base_box_itr, + bool from_start = true); /*! - * @brief Inserts a new neighbor into the neighborhood of the base Box - * pointed to by base_box_itr. - * - * @note base_box_itr must point to a valid base Box or this function - * can not work. Unlike the other versions of insert, this version has - * no return value. The base Box must already exist and the Iterator - * already points to it so returning an Iterator or bool has no value. - * - * @param base_box_itr Iterator pointing to the base Box. + * @brief Copy constructor. * - * @param new_nbr The new neighbor of the base Box. + * @param other */ - void - insert( - Iterator& base_box_itr, - const Box& new_nbr); + ConstNeighborIterator( + const ConstNeighborIterator& other); /*! - * @brief Inserts new neighbors into the neighborhood of the base Box - * with the supplied BoxId. - * - * @param base_box_id The BoxId of the base Box. - * - * @param new_nbrs The new neighbors of the base Box. + * @brief Copy constructor. * - * @return An Iterator pointing to the base Box with the supplied BoxId. + * @param other */ - Iterator - insert( - const BoxId& base_box_id, - const BoxContainer& new_nbrs) - { - Iterator base_boxes_itr = insert(base_box_id).first; - insert(base_boxes_itr, new_nbrs); - return base_boxes_itr; - } + ConstNeighborIterator( + const NeighborIterator& other); /*! - * @brief Inserts new neighbors into the neighborhood of the base Box - * pointed to by base_box_itr. - * - * @note base_box_itr must point to a valid base Box or this function - * can not work. Unlike the other versions of insert, this version has - * no return value. The base Box must already exist and the Iterator - * already points to it so returning an Iterator or bool has no value. - * - * @param base_box_itr Iterator pointing to the base Box. + * @brief Assignment operator. * - * @param new_nbrs The new neighbors of the base Box. + * @param rhs */ - void - insert( - Iterator& base_box_itr, - const BoxContainer& new_nbrs); + ConstNeighborIterator& + operator = ( + const ConstNeighborIterator& rhs) + { + d_collection = rhs.d_collection; + d_base_box = rhs.d_base_box; + d_itr = rhs.d_itr; + return *this; + } /*! - * @brief Erases a neighbor from the neighborhood of the base Box with - * the supplied BoxId. - * - * @param base_box_id The BoxId of the base Box. + * @brief Assignment operator. * - * @param nbr The neighbor of the base Box to be erased. + * @param rhs */ - void - erase( - const BoxId& base_box_id, - const Box& nbr) + ConstNeighborIterator& + operator = ( + const NeighborIterator& rhs) { - Iterator itr(find(base_box_id)); - erase(itr, nbr); - return; + d_collection = rhs.d_collection; + d_base_box = rhs.d_base_box; + d_itr = rhs.d_itr; + return *this; } + // Destructor + /*! - * @brief Erases a neighbor from the neighborhood of the base Box pointed - * to by base_box_itr. - * - * @param base_box_itr An iterator pointing to the base Box. - * - * @param nbr The neighbor of the base Box to be erased. + * @brief Performs necessary deletion. */ - void - erase( - Iterator& base_box_itr, - const Box& nbr); + ~ConstNeighborIterator(); + + // Operators /*! - * @brief Erases neighbors from the neighborhood of the base Box with the - * supplied BoxId. - * - * @param base_box_id The BoxId of the base Box. - * - * @param nbrs The neighbors of base Box to be erased. + * @brief Extract the Box which is the current neighbor in the + * iteration of the neighborhood of the base Box. */ - void - erase( - const BoxId& base_box_id, - const BoxContainer& nbrs) + const Box& + operator * () const { - Iterator itr(find(base_box_id)); - erase(itr, nbrs); - return; + return *(*d_itr); } /*! - * @brief Erases neighbors from the neighborhood of the base Box pointed - * to by base_box_itr. - * - * @param base_box_itr An iterator pointing to the base Box. - * - * @param nbrs The neighbors of base Box to be erased. + * @brief Extracts a pointer to the Box which is current neighbor + * in the iteration of the neighborhood of the base Box. */ - void - erase( - Iterator& base_box_itr, - const BoxContainer& nbrs); - - /*! - * @brief Inserts a base Box with an empty neighborhood. If the base Box - * does not exist in this object then this function returns true. - * Otherwise it returns false and takes no action. - * - * @param new_base_box The new base_box of an empty neighborhood. - * - * @return A pair whose first member is an Iterator and second member is - * a bool. If new_base_box was already a base Box then the Iterator - * points to the already existing base Box's neighborhood and the bool is - * false. If new_base_box did not already exist then the Iterator points - * to the newly inserted base Box's neighborhood and the bool is true. - */ - InsertRetType - insert( - const BoxId& new_base_box); + const Box * + operator -> () const + { + return *d_itr; + } /*! - * @brief Erases the neighbors of the base Box with the supplied BoxId - * including the base Box itself. - * - * @param base_box_id The BoxId of the base Box whose neighbors are to be - * erased. + * @brief Post-increment iterator to point to the Box which is the + * next neighbor of the base Box. */ - void - erase( - const BoxId& base_box_id) + ConstNeighborIterator + operator ++ ( + int) { - Iterator itr(find(base_box_id)); - erase(itr); - return; + ConstNeighborIterator tmp = *this; + if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { + ++d_itr; + } + return tmp; } /*! - * @brief Erases the neighbors of the base Box pointed to by base_box_itr - * including base Box iself. - * - * @param base_box_itr Iterator pointing to the base box whose neighbors - * are to be erased. + * @brief Pre-increment iterator to point to the Box which is the + * next neighbor of the base Box. */ - void - erase( - Iterator& base_box_itr); + ConstNeighborIterator& + operator ++ () + { + if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { + ++d_itr; + } + return *this; + } /*! - * @brief Erases the neighbors of the base Boxes pointed to in the range - * [first_base_box_itr, last_base_box_itr) including the base Boxes - * themselves. - * - * @param first_base_box_itr Iterator pointing to the first base Box - * whose neighbors are to be erased. + * @brief Determine if two iterators are equivalent. * - * @param last_base_box_itr Iterator pointing one past the last base Box - * whose neighbors are to be erased. + * @param rhs */ - void - erase( - Iterator& first_base_box_itr, - Iterator& last_base_box_itr); + bool + operator == ( + const ConstNeighborIterator& rhs) const + { + return d_collection == rhs.d_collection && + d_base_box == rhs.d_base_box && + d_itr == rhs.d_itr; + } /*! - * @brief For all base Boxes not owned by the process owning this object - * this method erases the base Box and its neighbors. + * @brief Determine if two iterators are not equivalent. * - * @param rank the rank of the process owning this object. - */ - void - eraseNonLocalNeighborhoods( - int rank); - - /*! - * @brief Erases all base Boxes having no neighbors. - */ - void - eraseEmptyNeighborhoods(); - - /*! - * @brief Erases all neighbors in all neighborhoods which are periodic - * image boxes. - */ - void - erasePeriodicNeighbors(); - - /*! - * @brief Erases all contents so empty() == true. + * @param rhs */ - void - clear(); - - //@} + bool + operator != ( + const ConstNeighborIterator& rhs) const + { + return !(*this == rhs); + } - //@{ - /*! - * @name Coarsen, refine, grow. - */ +private: + // Default constructor does not exist. + ConstNeighborIterator(); - /*! - * @brief Coarsens the neighbors of each base Box by the given ratio. - * - * @param ratio - */ - void - coarsenNeighbors( - const IntVector& ratio); + const BoxNeighborhoodCollection* d_collection; - /*! - * @brief Refines the neighbors of each base Box by the given ratio. - * - * @param ratio - */ - void - refineNeighbors( - const IntVector& ratio); + const BoxId* d_base_box; - /*! - * @brief Grows the neighbors of each base Box by the given amount. - * - * @param growth - */ - void - growNeighbors( - const IntVector& growth); + NeighborhoodConstItr d_itr; + }; - //@} + /*! + * @brief An iterator over the neighbors in the neighborhood of a base + * Box in a BoxNeighborhoodCollection. The interface does not allow + * modification of the neighbors. + */ + class NeighborIterator + { + friend class BoxNeighborhoodCollection; + friend class ConstNeighborIterator; - //@{ - /*! - * @name Neighborhood member extraction - * Currently, the way some algorithms are implemented these are needed - * but we may find that it is not necessary. - */ +public: + // Constructors /*! - * @brief Fill the supplied BoxContainer with the neighbors from all the - * neighborhoods in this object. The container has no notion of the - * neighborhoods to which its contents belong. + * @brief Constructs an iterator over the neighbors of the base Box + * pointed to by the supplied Iterator in the supplied collection + * of neighborhoods. * - * @param neighbors + * @param base_box_itr + * @param from_start If true constructs an iterator pointing to the + * first neighbor. Otherwise constructs an iterator pointing one + * past the last neighbor. */ - void - getNeighbors( - BoxContainer& neighbors) const; + NeighborIterator( + Iterator& base_box_itr, + bool from_start = true); /*! - * @brief Fill the supplied BoxContainer with the neighbors having the - * specified block id from all the neighborhoods in this object. The - * container has no notion of the neighborhoods to which its contents - * belong. - * - * @param neighbors + * @brief Copy constructor. * - * @param block_id + * @param other */ - void - getNeighbors( - BoxContainer& neighbors, - const BlockId& block_id) const; + NeighborIterator( + const NeighborIterator& other); /*! - * @brief Fill the supplied map with the neighbors from all the - * neighborhoods in this object by block id. The container has no notion - * of the neighborhoods to which its contents belong. + * @brief Assignment operator. * - * @param neighbors + * @param rhs */ - void - getNeighbors( - std::map& neighbors) const; + NeighborIterator& + operator = ( + const NeighborIterator& rhs) + { + d_collection = rhs.d_collection; + d_base_box = rhs.d_base_box; + d_itr = rhs.d_itr; + return *this; + } - /*! - * @brief Fill the supplied BoxContainer with the neighbors of the base - * Box with the supplied BoxId. - * - * @param base_box_id - * @param neighbors - */ - void - getNeighbors( - const BoxId& base_box_id, - BoxContainer& neighbors) const; + // Destructor /*! - * @brief Place any periodic neighbors from each neighborhood into the - * supplied BoxContainer. - * - * @param result + * @brief Performs necessary deletion. */ - void - getPeriodicNeighbors( - BoxContainer& result) const; + ~NeighborIterator(); - //@} + // Operators - //@{ /*! - * @name Communication packing/unpacking + * @brief Extract the Box which is the current neighbor in the + * iteration of the neighborhood of the base Box. */ + const Box& + operator * () const + { + return *(*d_itr); + } /*! - * @brief Load an integer communication buffer with the data from this - * object. - * - * @param send_mesg The integer communication buffer - * - * @param dim - * - * @param buff_init Initializer for newly allocated buffer data. + * @brief Extracts a pointer to the Box which is current neighbor + * in the iteration of the neighborhood of the base Box. */ - void - putToIntBuffer( - std::vector& send_mesg, - const tbox::Dimension& dim, - int buff_init) const; + const Box * + operator -> () const + { + return *d_itr; + } /*! - * @brief Populate object based on information contained in an integer - * communication buffer. - * - * @param recv_mesg The integer communication buffer - * - * @param proc_offset Offset of beginning of message stream in recv_mesg - * for each process. - * - * @param dim - * - * @param num_proc - * - * @param rank + * @brief Post-increment iterator to point to the Box which is the + * next neighbor of the base Box. */ - void - getFromIntBuffer( - const std::vector& recv_mesg, - const std::vector& proc_offset, - const tbox::Dimension& dim, - int num_proc, - int rank); - - //@} + NeighborIterator + operator ++ ( + int) + { + NeighborIterator tmp = *this; + if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { + ++d_itr; + } + return tmp; + } - //@{ /*! - * @name IO--these are only called from the mblktree test. + * @brief Pre-increment iterator to point to the Box which is the + * next neighbor of the base Box. */ + NeighborIterator& + operator ++ () + { + if (d_itr != d_collection->d_adj_list.find(d_base_box)->second.end()) { + ++d_itr; + } + return *this; + } /*! - * @brief Writes the neighborhood information to the supplied database. + * @brief Determine if two iterators are equivalent. * - * @param database + * @param rhs */ - void - putUnregisteredToDatabase( - const boost::shared_ptr& database) const; + bool + operator == ( + const NeighborIterator& rhs) const + { + return d_collection == rhs.d_collection && + d_base_box == rhs.d_base_box && + d_itr == rhs.d_itr; + } /*! - * @brief Constructs the neighborhoods from the supplied database. + * @brief Determine if two iterators are not equivalent. * - * @param database + * @param rhs */ - void - getFromDatabase( - tbox::Database& database); + bool + operator != ( + const NeighborIterator& rhs) const + { + return !(*this == rhs); + } - //@} +private: + // Default constructor does not exist. + NeighborIterator(); + + const BoxNeighborhoodCollection* d_collection; + + const BoxId* d_base_box; + + NeighborhoodItr d_itr; + }; + + /*! + * @brief Returns an iterator pointing to the beginning of the collection + * of neighborhoods. + */ + Iterator + begin() + { + return Iterator(*this); + } + + /*! + * @brief Returns an iterator pointing to the beginning of the collection + * of neighborhoods. + */ + ConstIterator + begin() const + { + return ConstIterator(*this); + } + + /*! + * @brief Returns an iterator pointing just past the end of the + * collection of neighborhoods. + */ + Iterator + end() + { + return Iterator(*this, false); + } + + /*! + * @brief Returns an iterator pointing just past the end of the + * collection of neighborhoods. + */ + ConstIterator + end() const + { + return ConstIterator(*this, false); + } + + /*! + * @brief Returns an iterator pointing to the first neighbor in the + * neighborhood of the base Box with the supplied BoxId. + * + * @param base_box_id + */ + NeighborIterator + begin( + const BoxId& base_box_id) + { + Iterator itr(find(base_box_id)); + return begin(itr); + } + + /*! + * @brief Returns an iterator pointing to the first neighbor in the + * neighborhood of the base Box with the supplied BoxId. + * + * @param base_box_id + */ + ConstNeighborIterator + begin( + const BoxId& base_box_id) const + { + return begin(find(base_box_id)); + } + + /*! + * @brief Returns an iterator pointing to the first neighbor in the + * neighborhood of the base Box pointed to by base_box_itr. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + NeighborIterator + begin( + Iterator& base_box_itr) + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return NeighborIterator(base_box_itr); + } + + /*! + * @brief Returns an iterator pointing to the first neighbor in the + * neighborhood of the base Box pointed to by base_box_itr. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + ConstNeighborIterator + begin( + const ConstIterator& base_box_itr) const + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return ConstNeighborIterator(base_box_itr); + } + + /*! + * @brief Returns an iterator pointing just past the last neighbor in the + * neighborhood of the base Box with the supplied BoxId. + * + * @param base_box_id + */ + NeighborIterator + end( + const BoxId& base_box_id) + { + Iterator itr(find(base_box_id)); + return end(itr); + } + + /*! + * @brief Returns an iterator pointing just past the last neighbor in the + * neighborhood of the base Box with the supplied BoxId. + * + * @param base_box_id + */ + ConstNeighborIterator + end( + const BoxId& base_box_id) const + { + return end(find(base_box_id)); + } + + /*! + * @brief Returns an iterator pointing just past the last neighbor in the + * neighborhood of the base Box pointed to by base_box_itr. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + NeighborIterator + end( + Iterator& base_box_itr) + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return NeighborIterator(base_box_itr, false); + } + + /*! + * @brief Returns an iterator pointing just past the last neighbor in the + * neighborhood of the base Box pointed to by base_box_itr. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + ConstNeighborIterator + end( + const ConstIterator& base_box_itr) const + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return ConstNeighborIterator(base_box_itr, false); + } + + //@} + + //@{ + /*! + * @name Lookup + */ + + /*! + * @brief Returns an iterator pointing to the base Box with the supplied + * BoxId. If no base Box's BoxId is base_box_id this method returns + * end(). + * + * @param base_box_id + */ + ConstIterator + find( + const BoxId& base_box_id) const + { + BaseBoxPoolItr base_boxes_itr = d_base_boxes.find(base_box_id); + if (base_boxes_itr == d_base_boxes.end()) { + return end(); + } else { + return ConstIterator(*this, d_adj_list.find(&(*base_boxes_itr))); + } + } + + /*! + * @brief Returns an iterator pointing to the base Box with the supplied + * BoxId. If no base Box's BoxId is base_box_id this method returns + * end(). + * + * @param base_box_id + */ + Iterator + find( + const BoxId& base_box_id) + { + BaseBoxPoolItr base_boxes_itr = d_base_boxes.find(base_box_id); + if (base_boxes_itr == d_base_boxes.end()) { + return end(); + } else { + return Iterator(*this, d_adj_list.find(&(*base_boxes_itr))); + } + } + + //@} + + // Typedefs + typedef std::pair InsertRetType; + + //@{ + /*! + * @name State queries + */ + + /*! + * @brief Returns true if the number of box neighborhoods == 0. + */ + bool + empty() const + { + return d_base_boxes.empty(); + } + + /*! + * @brief Returns the number of box neighborhoods. + */ + int + numBoxNeighborhoods() const + { + return static_cast(d_base_boxes.size()); + } + + /*! + * @brief Returns true if the neighborhood of the base Box with the + * supplied BoxId is empty. + * + * @param base_box_id + */ + bool + emptyBoxNeighborhood( + const BoxId& base_box_id) const + { + return emptyBoxNeighborhood(find(base_box_id)); + } + + /*! + * @brief Returns true if the neighborhood of the base Box pointed to by + * base_box_itr is empty. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + bool + emptyBoxNeighborhood( + const ConstIterator& base_box_itr) const + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return base_box_itr.d_itr->second.empty(); + } + + /*! + * @brief Returns the number of neighbors in the neighborhood of the base + * Box with the supplied BoxId. + * + * @param base_box_id + */ + int + numNeighbors( + const BoxId& base_box_id) const + { + return numNeighbors(find(base_box_id)); + } + + /*! + * @brief Returns the number of neighbors in the neighborhood of the base + * Box pointed to by base_box_itr. + * + * @param base_box_itr + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + int + numNeighbors( + const ConstIterator& base_box_itr) const + { + TBOX_ASSERT(base_box_itr.d_collection == this); + TBOX_ASSERT(base_box_itr != end()); + return static_cast(base_box_itr.d_itr->second.size()); + } + + /*! + * @brief Returns the number of neighbors in all neighborhoods. + */ + int + sumNumNeighbors() const; + + /*! + * @brief Returns true if nbr is a neighbor of the base Box with the + * supplied BoxId. + * + * @param base_box_id + * @param nbr + */ + bool + hasNeighbor( + const BoxId& base_box_id, + const Box& nbr) const + { + return hasNeighbor(find(base_box_id), nbr); + } + + /*! + * @brief Returns true if nbr is a neighbor of the base Box pointed to by + * base_box_itr. + * + * @param base_box_itr + * @param nbr + */ + bool + hasNeighbor( + const ConstIterator& base_box_itr, + const Box& nbr) const; + + /*! + * @brief Returns true if the neighborhood of the base Box with the + * supplied BoxId is the same in this and other. + * + * @param base_box_id + * @param other + */ + bool + neighborhoodEqual( + const BoxId& base_box_id, + const BoxNeighborhoodCollection& other) const; + + /*! + * @brief Returns true if base_box_id is the BoxId of the base Box of a + * neighborhood held by this object. + * + * @param base_box_id + */ + bool + isBaseBox( + const BoxId& base_box_id) const + { + return find(base_box_id) != end(); + } + + /*! + * @brief Returns true if all neighbors of all base Boxes are owned by + * the processor owning this object. + * + * @note Currently, this is only called (via Connector::isLocal) from + * within a small number of TBOX_ASSERTs so it is only a sanity check and + * is not called in optimized code. If the method becomes + * algorithmically important an optimization would be to store a boolean + * to indicate if there are any non-local neighbors which would avoid the + * search that this method currently does. + * + * @param rank The rank of the process owning this object. + */ + bool + isLocal( + int rank) const; + + //@} + + /*! + * @brief Insert the rank of the processor owning each neighbor in each + * neighborhood into the supplied set. + * + * @param owners + */ + void + getOwners( + std::set& owners) const; + + /*! + * @brief Insert the rank of the processor owning each neighbor in each + * neighborhood into the supplied set. + * + * @param itr + * @param owners + */ + void + getOwners( + ConstIterator& itr, + std::set& owners) const; + + //@{ + /*! + * @name Neighborhood editing + */ + + /*! + * @brief Inserts a new neighbor into the neighborhood of the base Box + * with the supplied BoxId. + * + * @param base_box_id The BoxId of the neighborhood base Box. + * + * @param new_nbr The new neighbor of base_box_id. + * + * @return An Iterator pointing to the base Box with the supplied BoxId. + */ + Iterator + insert( + const BoxId& base_box_id, + const Box& new_nbr) + { + Iterator base_boxes_itr = insert(base_box_id).first; + insert(base_boxes_itr, new_nbr); + return base_boxes_itr; + } + + /*! + * @brief Inserts a new neighbor into the neighborhood of the base Box + * pointed to by base_box_itr. + * + * @note base_box_itr must point to a valid base Box or this function + * can not work. Unlike the other versions of insert, this version has + * no return value. The base Box must already exist and the Iterator + * already points to it so returning an Iterator or bool has no value. + * + * @param base_box_itr Iterator pointing to the base Box. + * + * @param new_nbr The new neighbor of the base Box. + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + void + insert( + Iterator& base_box_itr, + const Box& new_nbr); + + /*! + * @brief Inserts new neighbors into the neighborhood of the base Box + * with the supplied BoxId. + * + * @param base_box_id The BoxId of the base Box. + * + * @param new_nbrs The new neighbors of the base Box. + * + * @return An Iterator pointing to the base Box with the supplied BoxId. + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + Iterator + insert( + const BoxId& base_box_id, + const BoxContainer& new_nbrs) + { + Iterator base_boxes_itr = insert(base_box_id).first; + insert(base_boxes_itr, new_nbrs); + return base_boxes_itr; + } + + /*! + * @brief Inserts new neighbors into the neighborhood of the base Box + * pointed to by base_box_itr. + * + * @note base_box_itr must point to a valid base Box or this function + * can not work. Unlike the other versions of insert, this version has + * no return value. The base Box must already exist and the Iterator + * already points to it so returning an Iterator or bool has no value. + * + * @param base_box_itr Iterator pointing to the base Box. + * + * @param new_nbrs The new neighbors of the base Box. + */ + void + insert( + Iterator& base_box_itr, + const BoxContainer& new_nbrs); + + /*! + * @brief Erases a neighbor from the neighborhood of the base Box with + * the supplied BoxId. + * + * @param base_box_id The BoxId of the base Box. + * + * @param nbr The neighbor of the base Box to be erased. + */ + void + erase( + const BoxId& base_box_id, + const Box& nbr) + { + Iterator itr(find(base_box_id)); + erase(itr, nbr); + } + + /*! + * @brief Erases a neighbor from the neighborhood of the base Box pointed + * to by base_box_itr. + * + * @param base_box_itr An iterator pointing to the base Box. + * + * @param nbr The neighbor of the base Box to be erased. + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + * @pre d_nbrs.find(nbr) != d_nbrs.end() + */ + void + erase( + Iterator& base_box_itr, + const Box& nbr); + + /*! + * @brief Erases neighbors from the neighborhood of the base Box with the + * supplied BoxId. + * + * @param base_box_id The BoxId of the base Box. + * + * @param nbrs The neighbors of base Box to be erased. + */ + void + erase( + const BoxId& base_box_id, + const BoxContainer& nbrs) + { + Iterator itr(find(base_box_id)); + erase(itr, nbrs); + } + + /*! + * @brief Erases neighbors from the neighborhood of the base Box pointed + * to by base_box_itr. + * + * @param base_box_itr An iterator pointing to the base Box. + * + * @param nbrs The neighbors of base Box to be erased. + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + * @pre for each box in nbrs, d_nbrs.find(box) != d_nbrs.end() + */ + void + erase( + Iterator& base_box_itr, + const BoxContainer& nbrs); + + /*! + * @brief Inserts a base Box with an empty neighborhood. If the base Box + * does not exist in this object then this function returns true. + * Otherwise it returns false and takes no action. + * + * @param new_base_box The new base_box of an empty neighborhood. + * + * @return A pair whose first member is an Iterator and second member is + * a bool. If new_base_box was already a base Box then the Iterator + * points to the already existing base Box's neighborhood and the bool is + * false. If new_base_box did not already exist then the Iterator points + * to the newly inserted base Box's neighborhood and the bool is true. + */ + InsertRetType + insert( + const BoxId& new_base_box); + + /*! + * @brief Erases the neighbors of the base Box with the supplied BoxId + * including the base Box itself. + * + * @param base_box_id The BoxId of the base Box whose neighbors are to be + * erased. + */ + void + erase( + const BoxId& base_box_id) + { + Iterator itr(find(base_box_id)); + erase(itr); + } + + /*! + * @brief Erases the neighbors of the base Box pointed to by base_box_itr + * including base Box iself. + * + * @param base_box_itr Iterator pointing to the base box whose neighbors + * are to be erased. + * + * @pre base_box_itr.d_collection == this + * @pre base_box_itr != end() + */ + void + erase( + Iterator& base_box_itr); + + /*! + * @brief Erases the neighbors of the base Boxes pointed to in the range + * [first_base_box_itr, last_base_box_itr) including the base Boxes + * themselves. + * + * @param first_base_box_itr Iterator pointing to the first base Box + * whose neighbors are to be erased. + * + * @param last_base_box_itr Iterator pointing one past the last base Box + * whose neighbors are to be erased. + */ + void + erase( + Iterator& first_base_box_itr, + Iterator& last_base_box_itr); + + /*! + * @brief For all base Boxes not owned by the process owning this object + * this method erases the base Box and its neighbors. + * + * @param rank the rank of the process owning this object. + */ + void + eraseNonLocalNeighborhoods( + int rank); + + /*! + * @brief Erases all base Boxes having no neighbors. + */ + void + eraseEmptyNeighborhoods(); + + /*! + * @brief Erases all neighbors in all neighborhoods which are periodic + * image boxes. + */ + void + erasePeriodicNeighbors(); + + /*! + * @brief Erases all contents so empty() == true. + */ + void + clear(); + + //@} + + //@{ + /*! + * @name Coarsen, refine, grow. + */ + + /*! + * @brief Coarsens the neighbors of each base Box by the given ratio. + * + * @param ratio + */ + void + coarsenNeighbors( + const IntVector& ratio); + + /*! + * @brief Refines the neighbors of each base Box by the given ratio. + * + * @param ratio + */ + void + refineNeighbors( + const IntVector& ratio); + + /*! + * @brief Grows the neighbors of each base Box by the given amount. + * + * @param growth + */ + void + growNeighbors( + const IntVector& growth); + + //@} + + //@{ + /*! + * @name Neighborhood member extraction + * Currently, the way some algorithms are implemented these are needed + * but we may find that it is not necessary. + */ + + /*! + * @brief Fill the supplied BoxContainer with the neighbors from all the + * neighborhoods in this object. The container has no notion of the + * neighborhoods to which its contents belong. + * + * @param neighbors + */ + void + getNeighbors( + BoxContainer& neighbors) const; + + /*! + * @brief Fill the supplied BoxContainer with the neighbors having the + * specified block id from all the neighborhoods in this object. The + * container has no notion of the neighborhoods to which its contents + * belong. + * + * @param neighbors + * + * @param block_id + */ + void + getNeighbors( + BoxContainer& neighbors, + const BlockId& block_id) const; + + /*! + * @brief Fill the supplied map with the neighbors from all the + * neighborhoods in this object by block id. The container has no notion + * of the neighborhoods to which its contents belong. + * + * @param neighbors + */ + void + getNeighbors( + std::map& neighbors) const; + + /*! + * @brief Fill the supplied BoxContainer with the neighbors of the base + * Box with the supplied BoxId. + * + * @param base_box_id + * @param neighbors + */ + void + getNeighbors( + const BoxId& base_box_id, + BoxContainer& neighbors) const; + + /*! + * @brief Place any periodic neighbors from each neighborhood into the + * supplied BoxContainer. + * + * @param result + */ + void + getPeriodicNeighbors( + BoxContainer& result) const; + + //@} + + //@{ + /*! + * @name Communication packing/unpacking + */ + + /*! + * @brief Load an integer communication buffer with the data from this + * object. + * + * @param send_mesg The integer communication buffer + * + * @param dim + * + * @param buff_init Initializer for newly allocated buffer data. + */ + void + putToIntBuffer( + std::vector& send_mesg, + const tbox::Dimension& dim, + int buff_init) const; + + /*! + * @brief Populate object based on information contained in an integer + * communication buffer. + * + * @param recv_mesg The integer communication buffer + * + * @param proc_offset Offset of beginning of message stream in recv_mesg + * for each process. + * + * @param dim + * + * @param num_proc + * + * @param rank + */ + void + getFromIntBuffer( + const std::vector& recv_mesg, + const std::vector& proc_offset, + const tbox::Dimension& dim, + int num_proc, + int rank); + + //@} + + //@{ + /*! + * @name IO--these are only called from the mblktree test. + */ + + /*! + * @brief Writes the neighborhood information to the supplied restart + * database. + * + * @param restart_db + */ + void + putToRestart( + const boost::shared_ptr& restart_db) const; + + /*! + * @brief Constructs the neighborhoods from the supplied restart + * database. + * + * @param restart_db + */ + void + getFromRestart( + tbox::Database& restart_db); + + //@} }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.C index ce408f7a..34a60426 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class that describes intersections between AMR boxes * ************************************************************************/ - -#ifndef included_hier_BoxOverlap_C -#define included_hier_BoxOverlap_C - #include "SAMRAI/hier/BoxOverlap.h" namespace SAMRAI { @@ -33,4 +29,3 @@ BoxOverlap::print( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.h index 4a110152..a6ebfeb6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class that describes intersections between AMR boxes * ************************************************************************/ @@ -38,7 +38,7 @@ namespace hier { * type-safe type casting should be used to access the subclass and its * member functions. * - * @see hier::BoxGeometry + * @see BoxGeometry */ class BoxOverlap @@ -102,7 +102,7 @@ class BoxOverlap private: BoxOverlap( const BoxOverlap&); // not implemented - void + BoxOverlap& operator = ( const BoxOverlap&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.C index 6d522312..7a1fddd0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Binary tree of Boxes for overlap searches. * ************************************************************************/ - -#ifndef included_hier_BoxTree_C -#define included_hier_BoxTree_C - #include "SAMRAI/hier/BoxTree.h" #include "SAMRAI/hier/BoxContainer.h" @@ -18,7 +14,7 @@ #include "SAMRAI/tbox/Statistician.h" #include "SAMRAI/tbox/TimerManager.h" -#include +#include "boost/make_shared.hpp" #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* @@ -31,31 +27,29 @@ namespace SAMRAI { namespace hier { -boost::shared_ptr BoxTree::t_build_tree[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; -boost::shared_ptr BoxTree::t_search[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; -unsigned int BoxTree::s_num_build[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] = +boost::shared_ptr BoxTree::t_build_tree[SAMRAI::MAX_DIM_VAL]; +boost::shared_ptr BoxTree::t_search[SAMRAI::MAX_DIM_VAL]; +unsigned int BoxTree::s_num_build[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_num_generate[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] +unsigned int BoxTree::s_num_generate[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_num_duplicate[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] +unsigned int BoxTree::s_num_duplicate[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_num_search[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] = +unsigned int BoxTree::s_num_search[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_num_sorted_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE +unsigned int BoxTree::s_num_sorted_box[SAMRAI::MAX_DIM_VAL ] = { 0 }; -unsigned int BoxTree::s_num_found_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] +unsigned int BoxTree::s_num_found_box[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_max_sorted_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE +unsigned int BoxTree::s_max_sorted_box[SAMRAI::MAX_DIM_VAL ] = { 0 }; -unsigned int BoxTree::s_max_found_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] +unsigned int BoxTree::s_max_found_box[SAMRAI::MAX_DIM_VAL] = { 0 }; -unsigned int BoxTree::s_max_lin_search[tbox::Dimension::MAXIMUM_DIMENSION_VALUE +unsigned int BoxTree::s_max_lin_search[SAMRAI::MAX_DIM_VAL ] = { 0 }; tbox::StartupShutdownManager::Handler @@ -77,7 +71,7 @@ BoxTree::BoxTree( d_dim(dim), d_bounding_box(dim), d_block_id(BlockId::invalidId()), - d_partition_dim(0) + d_partition_dir(0) { } @@ -100,7 +94,9 @@ BoxTree::BoxTree( s_max_sorted_box[d_dim.getValue() - 1] = tbox::MathUtilities::Max( s_max_sorted_box[d_dim.getValue() - 1], static_cast(boxes.size())); +#ifndef _OPENMP t_build_tree[d_dim.getValue() - 1]->start(); +#endif min_number = (min_number < 1) ? 1 : min_number; #ifdef DEBUG_CHECK_ASSERTIONS @@ -129,7 +125,7 @@ BoxTree::BoxTree( * Compute the bounding box for the set of boxes. Also get * BlockId from the given boxes. */ - if (!boxes.isEmpty()) { + if (!boxes.empty()) { TBOX_ASSERT(boxes.begin()->getBlockId() != BlockId::invalidId()); d_block_id = boxes.begin()->getBlockId(); } @@ -147,14 +143,14 @@ BoxTree::BoxTree( */ if (boxes.size() <= min_number) { for (BoxContainer::const_iterator ni = boxes.begin(); - ni != boxes.end(); ++ni) { + ni != boxes.end(); ++ni) { d_boxes.push_back(&(*ni)); } } else { /* * Partition the boxes into three sets, using the midpoint of - * the longest dimension of the bounding box: + * the longest direction of the bounding box: * * - those that belong to me (intersects the midpoint plane). Put * these in d_boxes. @@ -167,24 +163,24 @@ BoxTree::BoxTree( */ const IntVector bbsize = d_bounding_box.numberCells(); - d_partition_dim = 0; - for (int d = 1; d < d_dim.getValue(); ++d) { - if (bbsize(d_partition_dim) < bbsize(d)) { - d_partition_dim = d; + d_partition_dir = 0; + for (tbox::Dimension::dir_t d = 1; d < d_dim.getValue(); ++d) { + if (bbsize(d_partition_dir) < bbsize(d)) { + d_partition_dir = d; } } int midpoint = - (d_bounding_box.lower(d_partition_dim) - + d_bounding_box.upper(d_partition_dim)) / 2; + (d_bounding_box.lower(d_partition_dir) + + d_bounding_box.upper(d_partition_dir)) / 2; - std::list left_boxes, right_boxes; + std::list left_boxes, right_boxes; for (BoxContainer::const_iterator ni = boxes.begin(); ni != boxes.end(); ++ni) { const Box& box = *ni; - if (box.upper(d_partition_dim) <= midpoint) { + if (box.upper(d_partition_dir) <= midpoint) { left_boxes.push_back(&box); - } else if (box.lower(d_partition_dim) > midpoint) { + } else if (box.lower(d_partition_dir) > midpoint) { right_boxes.push_back(&box); } else { d_boxes.push_back(&box); @@ -201,15 +197,17 @@ BoxTree::BoxTree( static_cast(d_boxes.size()); } +#ifndef _OPENMP t_build_tree[d_dim.getValue() - 1]->stop(); +#endif } BoxTree::BoxTree( - const std::list boxes, - int min_number) -: d_dim((*(boxes.begin()))->getDim()), - d_bounding_box(d_dim), - d_boxes(boxes) + const std::list boxes, + int min_number): + d_dim((*(boxes.begin()))->getDim()), + d_bounding_box(d_dim), + d_boxes(boxes) { ++s_num_build[d_dim.getValue() - 1]; s_num_sorted_box[d_dim.getValue() - 1] += @@ -217,12 +215,16 @@ BoxTree::BoxTree( s_max_sorted_box[d_dim.getValue() - 1] = tbox::MathUtilities::Max( s_max_sorted_box[d_dim.getValue() - 1], static_cast(boxes.size())); +#ifndef _OPENMP t_build_tree[d_dim.getValue() - 1]->start(); +#endif min_number = (min_number < 1) ? 1 : min_number; privateGenerateTree(min_number); +#ifndef _OPENMP t_build_tree[d_dim.getValue() - 1]->stop(); +#endif } @@ -260,7 +262,7 @@ BoxTree::privateGenerateTree( { ++s_num_generate[d_dim.getValue() - 1]; - if (d_boxes.size()) { + if (d_boxes.size() > 0) { d_block_id = (**(d_boxes.begin())).getBlockId(); } @@ -268,7 +270,7 @@ BoxTree::privateGenerateTree( * Compute this tree's domain, which is the bounding box for the * constituent boxes. */ - for (std::list::const_iterator ni = d_boxes.begin(); + for (std::list::const_iterator ni = d_boxes.begin(); ni != d_boxes.end(); ++ni) { d_bounding_box += **ni; } @@ -279,10 +281,10 @@ BoxTree::privateGenerateTree( * live here. In this case, there is no left child, * no right child, and no recursive d_center_child. */ - if (d_boxes.size() > static_cast::size_type>(min_number)) { + if (d_boxes.size() > static_cast::size_type>(min_number)) { /* * Partition the boxes into three sets, using the midpoint of - * the longest dimension of the bounding box: + * the longest direction of the bounding box: * * - those that belong to me (intersects the midpoint plane). Put * these in d_boxes. @@ -295,29 +297,29 @@ BoxTree::privateGenerateTree( */ const IntVector bbsize = d_bounding_box.numberCells(); - d_partition_dim = 0; - for (int d = 1; d < d_dim.getValue(); ++d) { - if (bbsize(d_partition_dim) < bbsize(d)) { - d_partition_dim = d; + d_partition_dir = 0; + for (tbox::Dimension::dir_t d = 1; d < d_dim.getValue(); ++d) { + if (bbsize(d_partition_dir) < bbsize(d)) { + d_partition_dir = d; } } int midpoint = - (d_bounding_box.lower(d_partition_dim) - + d_bounding_box.upper(d_partition_dim)) / 2; + (d_bounding_box.lower(d_partition_dir) + + d_bounding_box.upper(d_partition_dir)) / 2; - std::list left_boxes, right_boxes; - for (std::list::iterator ni = d_boxes.begin(); + std::list left_boxes, right_boxes; + for (std::list::iterator ni = d_boxes.begin(); ni != d_boxes.end(); ) { const Box* box = *ni; - if (box->upper(d_partition_dim) <= midpoint) { + if (box->upper(d_partition_dir) <= midpoint) { left_boxes.push_back(box); - std::list::iterator curr = ni; + std::list::iterator curr = ni; ++ni; d_boxes.erase(curr); - } else if (box->lower(d_partition_dim) > midpoint) { + } else if (box->lower(d_partition_dir) > midpoint) { right_boxes.push_back(box); - std::list::iterator curr = ni; + std::list::iterator curr = ni; ++ni; d_boxes.erase(curr); } else { @@ -347,13 +349,13 @@ BoxTree::privateGenerateTree( void BoxTree::setupChildren( const int min_number, - std::list& left_boxes, - std::list& right_boxes) + std::list& left_boxes, + std::list& right_boxes) { const int total_size = static_cast( - left_boxes.size() + - right_boxes.size() + - d_boxes.size()); + left_boxes.size() + + right_boxes.size() + + d_boxes.size()); /* * If all Boxes are in a single child, the child is just as @@ -361,15 +363,15 @@ BoxTree::setupChildren( * everything into d_boxes so the check below will prevent * recursion. */ - if (left_boxes.size() == static_cast::size_type>(total_size)) { + if (left_boxes.size() == static_cast::size_type>(total_size)) { left_boxes.swap(d_boxes); - } else if (right_boxes.size() == static_cast::size_type>(total_size)) { + } else if (right_boxes.size() == static_cast::size_type>(total_size)) { right_boxes.swap(d_boxes); } #if 0 tbox::plog << "Split " << d_boxes.size() << " " << d_bounding_box - << " across " << d_partition_dim << " at " << mid << " into " + << " across " << d_partition_dir << " at " << mid << " into " << ' ' << left_boxes.size() << ' ' << cent_boxes.size() << ' ' << right_boxes.size() @@ -378,8 +380,10 @@ BoxTree::setupChildren( /* * If d_boxes is big enough, generate a center child for it. */ - if (d_boxes.size() > static_cast::size_type>(min_number) /* recursion criterion */ && - d_boxes.size() < static_cast::size_type>(total_size) /* avoid infinite recursion */) { + if (d_boxes.size() > + static_cast::size_type>(min_number) /* recursion criterion */ && + d_boxes.size() < + static_cast::size_type>(total_size) /* avoid infinite recursion */) { d_center_child.reset(new BoxTree(d_dim)); d_boxes.swap(d_center_child->d_boxes); d_center_child->privateGenerateTree(min_number); @@ -411,14 +415,14 @@ bool BoxTree::hasOverlap( const Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); bool has_overlap = false; if (box.intersects(d_bounding_box)) { if (d_center_child) { has_overlap = d_center_child->hasOverlap(box); } else { - for (std::list::const_iterator ni = d_boxes.begin(); + for (std::list::const_iterator ni = d_boxes.begin(); ni != d_boxes.end(); ++ni) { if (box.intersects(**ni)) { has_overlap = true; @@ -453,10 +457,12 @@ BoxTree::findOverlapBoxes( if (!recursive_call) { ++s_num_search[d_dim.getValue() - 1]; num_found_box = static_cast(overlap_boxes.size()); +#ifndef _OPENMP t_search[d_dim.getValue() - 1]->start(); +#endif } - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT(box.getBlockId() == d_block_id); if (box.intersects(d_bounding_box)) { @@ -464,7 +470,7 @@ BoxTree::findOverlapBoxes( if (d_center_child) { d_center_child->findOverlapBoxes(overlap_boxes, box, true); } else { - for (std::list::const_iterator ni = d_boxes.begin(); + for (std::list::const_iterator ni = d_boxes.begin(); ni != d_boxes.end(); ++ni) { const Box* my_box = *ni; if (box.intersects(*my_box)) { @@ -483,7 +489,9 @@ BoxTree::findOverlapBoxes( } if (!recursive_call) { +#ifndef _OPENMP t_search[d_dim.getValue() - 1]->stop(); +#endif num_found_box = static_cast(overlap_boxes.size()) - num_found_box; s_max_found_box[d_dim.getValue() - 1] = @@ -508,10 +516,12 @@ BoxTree::findOverlapBoxes( if (!recursive_call) { ++s_num_search[d_dim.getValue() - 1]; num_found_box = static_cast(overlap_boxes.size()); +#ifndef _OPENMP t_search[d_dim.getValue() - 1]->start(); +#endif } - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT(box.getBlockId() == d_block_id); if (box.intersects(d_bounding_box)) { @@ -520,7 +530,7 @@ BoxTree::findOverlapBoxes( d_center_child->findOverlapBoxes(overlap_boxes, box, true); } else { if (overlap_boxes.isOrdered()) { - for (std::list::const_iterator ni = d_boxes.begin(); + for (std::list::const_iterator ni = d_boxes.begin(); ni != d_boxes.end(); ++ni) { const Box* this_box = *ni; if (box.intersects(*this_box)) { @@ -528,7 +538,7 @@ BoxTree::findOverlapBoxes( } } } else { - for (std::list::const_iterator ni = d_boxes.begin(); + for (std::list::const_iterator ni = d_boxes.begin(); ni != d_boxes.end(); ++ni) { const Box* this_box = *ni; if (box.intersects(*this_box)) { @@ -547,9 +557,10 @@ BoxTree::findOverlapBoxes( } } - if (!recursive_call) { +#ifndef _OPENMP t_search[d_dim.getValue() - 1]->stop(); +#endif num_found_box = static_cast(overlap_boxes.size()) - num_found_box; s_max_found_box[d_dim.getValue() - 1] = tbox::MathUtilities::Max(s_max_found_box[d_dim.getValue() - 1], @@ -565,7 +576,7 @@ BoxTree::findOverlapBoxes( void BoxTree::initializeCallback() { - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++i) { + for (int i = 0; i < SAMRAI::MAX_DIM_VAL; ++i) { const std::string dim_str(tbox::Utilities::intToString(i + 1)); t_build_tree[i] = tbox::TimerManager::getManager()-> getTimer(std::string("hier::BoxTree::build_tree[") + dim_str + "]"); @@ -583,7 +594,7 @@ BoxTree::initializeCallback() void BoxTree::finalizeCallback() { - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++i) { + for (int i = 0; i < SAMRAI::MAX_DIM_VAL; ++i) { t_build_tree[i].reset(); t_search[i].reset(); } @@ -630,23 +641,23 @@ BoxTree::printStatistics( tbox::Statistician* st = tbox::Statistician::getStatistician(); boost::shared_ptr bdstat(st->getStatistic("num_build", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr gnstat(st->getStatistic("num_generate", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr dpstat(st->getStatistic("num_duplicate", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr srstat(st->getStatistic("num_search", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr sbstat(st->getStatistic("num_sorted_box", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr fbstat(st->getStatistic("num_found_box", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr msbstat(st->getStatistic("max_sorted_box", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr mfbstat(st->getStatistic("max_found_box", - "PROC_STAT")); + "PROC_STAT")); boost::shared_ptr lsstat(st->getStatistic("max_lin_search", - "PROC_STAT")); + "PROC_STAT")); static int seq_num = 0; bdstat->recordProcStat(s_num_build[dim.getValue() - 1], seq_num); @@ -827,5 +838,3 @@ BoxTree::printStatistics( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.h index 9c890c6f..2d2fbd88 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxTree.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Binary tree of Boxes for overlap searches. * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Timer.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -47,7 +47,7 @@ class BoxContainer; class BoxTree { -friend class MultiblockBoxTree; + friend class MultiblockBoxTree; public: @@ -79,7 +79,7 @@ friend class MultiblockBoxTree; private: BoxTree( - const std::list boxes, + const std::list boxes, int min_number = 10); /*! @@ -87,14 +87,15 @@ friend class MultiblockBoxTree; * * @param[in] dim * - * @param[in] boxes. No empty boxes are allowed. An assertion - * failure will occur if the boxes in this - * input set do not all have the same BlockId. + * @param[in] boxes * * @param[in] min_number Split up sets of boxes while the number of * boxes in a subset is greater than this value. Setting to a * larger value tends to make tree building faster but tree * searching slower, and vice versa. @b Default: 10 + * + * @pre for each box in boxes, !box.empty() + * @pre each box in boxes has a valid, identical BlockId */ BoxTree( const tbox::Dimension& dim, @@ -158,6 +159,12 @@ friend class MultiblockBoxTree; return d_dim; } + const BlockId& + getBlockId() const + { + return d_block_id; + } + //@} //@{ @@ -170,6 +177,8 @@ friend class MultiblockBoxTree; * * @param[in] box The box is assumed to be in same index space as * those in the tree. + * + * @pre getDim() == box.getDim() */ bool hasOverlap( @@ -178,7 +187,7 @@ friend class MultiblockBoxTree; /*! * @brief Find all boxes that overlap the given \b box. * - * Analogous to findOverlapBoxes returning a BoxContainer + * Analogous to findOverlapBoxes returning a BoxContainer * but avoids the copies. If the returned overlap_boxes are used * in a context in which the BoxTree is constant there is no point * in incurring the cost of copying the tree's Boxes. Just return @@ -188,8 +197,12 @@ friend class MultiblockBoxTree; * with box. * * @param[in] box the specified box whose overlaps are requested. - * An assertion failure will occur if the box does not have the same - * BlockId as the tree. + * + * @param[in] recursive_call Disable logging of information except at first + * call. + * + * @pre getDim() == box.getDim() + * @pre box.getBlockId() == getBlockId() */ void findOverlapBoxes( @@ -208,8 +221,12 @@ friend class MultiblockBoxTree; * entry of this method * * @param[in] box the specified box whose overlaps are requested. - * An assertion failure will occur if the box does not have the same - * BlockId as the tree. + * + * @param[in] recursive_call Disable logging of information except at first + * call. + * + * @pre getDim() == box.getDim() + * @pre box.getBlockId() == getBlockId() */ void findOverlapBoxes( @@ -230,7 +247,7 @@ friend class MultiblockBoxTree; * been initialized, it should be cleared before calling this * method. @see clear(). * - * @param min_number. @b Default: 10 + * @param min_number @b Default: 10 */ void privateGenerateTree( @@ -311,25 +328,23 @@ friend class MultiblockBoxTree; * @brief Dimension along which the input box triples are * partitioned. */ - int d_partition_dim; + tbox::Dimension::dir_t d_partition_dir; /* * Timers are static to keep the objects light-weight. */ - static boost::shared_ptr t_build_tree[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; - static boost::shared_ptr t_search[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; - - static unsigned int s_num_build[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_num_generate[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_num_duplicate[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_num_search[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_num_sorted_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_num_found_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_max_sorted_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_max_found_box[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static unsigned int s_max_lin_search[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static boost::shared_ptr t_build_tree[SAMRAI::MAX_DIM_VAL]; + static boost::shared_ptr t_search[SAMRAI::MAX_DIM_VAL]; + + static unsigned int s_num_build[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_num_generate[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_num_duplicate[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_num_search[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_num_sorted_box[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_num_found_box[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_max_sorted_box[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_max_found_box[SAMRAI::MAX_DIM_VAL]; + static unsigned int s_max_lin_search[SAMRAI::MAX_DIM_VAL]; static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.C index 6ac7f5ed..499b2db8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.C @@ -3,23 +3,21 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for processing boxes within a domain of index space. * ************************************************************************/ - -#ifndef included_hier_BoxUtilities_C -#define included_hier_BoxUtilities_C - #include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BaseGridGeometry.h" +#include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include namespace SAMRAI { namespace hier { @@ -37,16 +35,16 @@ namespace hier { void BoxUtilities::findBadCutPointsForBorderAndDirection( - const int id, - tbox::Array& bad_cuts, + const tbox::Dimension::dir_t id, + std::vector& bad_cuts, const Box& box, const Box& border, const int bad_interval) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, border); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, border); - TBOX_ASSERT((0 <= id) && (id < box.getDim().getValue())); - TBOX_ASSERT(bad_cuts.getSize() == box.numberCells(id)); + TBOX_ASSERT((id < box.getDim().getValue())); + TBOX_ASSERT(static_cast(bad_cuts.size()) == box.numberCells(id)); TBOX_ASSERT(bad_interval >= 0); if (bad_interval > 0) { @@ -66,14 +64,14 @@ BoxUtilities::findBadCutPointsForBorderAndDirection( tbox::MathUtilities::Max(ilo, (mark - bad_interval + 1)) - ilo; ichi = tbox::MathUtilities::Min(ihi, (mark - 1)) - ilo + 1; - for (ic = iclo; ic < ichi; ic++) bad_cuts[ic] = true; + for (ic = iclo; ic < ichi; ++ic) bad_cuts[ic] = true; iclo = tbox::MathUtilities::Max(ilo, (mark + 1)) - ilo; ichi = tbox::MathUtilities::Min(ihi, (mark + bad_interval - 1)) - ilo + 1; - for (ic = iclo; ic < ichi; ic++) bad_cuts[ic] = true; + for (ic = iclo; ic < ichi; ++ic) bad_cuts[ic] = true; } @@ -87,14 +85,14 @@ BoxUtilities::findBadCutPointsForBorderAndDirection( tbox::MathUtilities::Max(ilo, (mark - bad_interval + 1)) - ilo; ichi = tbox::MathUtilities::Min(ihi, (mark - 1)) - ilo + 1; - for (ic = iclo; ic < ichi; ic++) bad_cuts[ic] = true; + for (ic = iclo; ic < ichi; ++ic) bad_cuts[ic] = true; iclo = tbox::MathUtilities::Max(ilo, (mark + 1)) - ilo; ichi = tbox::MathUtilities::Min(ihi, (mark + bad_interval - 1)) - ilo + 1; - for (ic = iclo; ic < ichi; ic++) bad_cuts[ic] = true; + for (ic = iclo; ic < ichi; ++ic) bad_cuts[ic] = true; } @@ -123,22 +121,23 @@ BoxUtilities::checkBoxConstraints( const BoxContainer& physical_boxes) { - TBOX_DIM_ASSERT_CHECK_ARGS3(min_size, cut_factor, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY3(min_size, cut_factor, bad_interval); TBOX_ASSERT(min_size > IntVector::getZero(min_size.getDim())); TBOX_ASSERT(cut_factor > IntVector::getZero(min_size.getDim())); TBOX_ASSERT(bad_interval >= IntVector::getZero(min_size.getDim())); + BlockId::block_t b = box.getBlockId().getBlockValue(); const tbox::Dimension& dim(box.getDim()); - int id; + tbox::Dimension::dir_t id; /* * Test box against minimum size constraint. */ - tbox::Array min_is_bad(dim.getValue()); + std::vector min_is_bad(dim.getValue()); bool min_violation = false; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (box.numberCells(id) < min_size(id)) { min_is_bad[id] = true; min_violation = true; @@ -150,7 +149,7 @@ BoxUtilities::checkBoxConstraints( if (min_violation) { tbox::perr << "\nBox = " << box << " -- minimum size = " << min_size << std::endl; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (min_is_bad[id]) { tbox::perr << "min size violated in direction " << id << std::endl; } @@ -162,10 +161,11 @@ BoxUtilities::checkBoxConstraints( /* * Test box against cut factor constraint. */ - tbox::Array factor_is_bad(dim.getValue()); + std::vector factor_is_bad(dim.getValue()); bool factor_violation = false; - for (id = 0; id < dim.getValue(); id++) { - if ((box.numberCells(id) % cut_factor(id)) != 0) { + IntVector block_cut_factor(cut_factor.getBlockVector(box.getBlockId())); + for (id = 0; id < dim.getValue(); ++id) { + if ((box.numberCells(id) % block_cut_factor(id)) != 0) { factor_is_bad[id] = true; factor_violation = true; } else { @@ -174,9 +174,9 @@ BoxUtilities::checkBoxConstraints( } if (factor_violation) { - tbox::perr << "\nBox = " << box << " -- cut factor = " << cut_factor + tbox::perr << "\nBox = " << box << " -- cut factor = " << block_cut_factor << std::endl; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (factor_is_bad[id]) { tbox::perr << "factor bad in direction " << id << std::endl; } @@ -185,10 +185,10 @@ BoxUtilities::checkBoxConstraints( << " Box violates cut factor restriction" << std::endl); } - if (physical_boxes.size() > 0) { + if (!physical_boxes.empty()) { - tbox::Array cut_is_bad(dim.getValue()); - for (id = 0; id < dim.getValue(); id++) { + std::vector cut_is_bad(dim.getValue()); + for (id = 0; id < dim.getValue(); ++id) { cut_is_bad[id] = false; } @@ -204,7 +204,7 @@ BoxUtilities::checkBoxConstraints( BoxContainer border_boxes(test_border); border_boxes.removeIntersections(physical_boxes); - if (!border_boxes.isEmpty()) { + if (!border_boxes.empty()) { /* * Test individual box faces in each direction for bad cuts. @@ -215,7 +215,7 @@ BoxUtilities::checkBoxConstraints( int blo = box.lower(id); int bhi = box.upper(id); - int bad = bad_interval(id); + int bad = bad_interval(b,id); /* * Test lower box face in single direction. @@ -224,7 +224,7 @@ BoxUtilities::checkBoxConstraints( Box test_box = box; test_box.grow(bad_interval); - test_box.upper(id) = box.lower(id) - 1; + test_box.setUpper(id, box.lower(id) - 1); BoxContainer test_boxes(test_box); test_boxes.intersectBoxes(border_boxes); @@ -249,9 +249,9 @@ BoxUtilities::checkBoxConstraints( test_box = box; test_box.grow(bad_interval); - test_box.lower(id) = box.upper(id) + 1; + test_box.setLower(id, box.upper(id) + 1); - test_boxes = BoxContainer(test_box); + test_boxes = BoxContainer(test_box); test_boxes.intersectBoxes(border_boxes); test_boxes.simplify(); @@ -267,7 +267,7 @@ BoxUtilities::checkBoxConstraints( } - id++; + ++id; } } @@ -275,14 +275,14 @@ BoxUtilities::checkBoxConstraints( if (bad_cut_violation) { tbox::perr << "Box violates bad cut restriction in directions..."; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (cut_is_bad[id]) tbox::perr << "\n" << id; } tbox::perr << "\nBox = " << box << " -- bad cut interval = " << bad_interval << std::endl; tbox::perr << "Physical domain boxes ... " << std::endl; int ib = 0; - for (BoxContainer::const_iterator itr(physical_boxes); + for (BoxContainer::const_iterator itr = physical_boxes.begin(); itr != physical_boxes.end(); ++itr, ++ib) { tbox::perr << "Box # " << ib << " -- " << *itr << std::endl; } @@ -331,13 +331,13 @@ BoxUtilities::chopBoxes( const IntVector& bad_interval, const BoxContainer& physical_boxes) { - TBOX_DIM_ASSERT_CHECK_ARGS4(max_size, min_size, cut_factor, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY4(max_size, min_size, cut_factor, bad_interval); TBOX_ASSERT(min_size > IntVector::getZero(min_size.getDim())); TBOX_ASSERT(max_size >= min_size); TBOX_ASSERT(cut_factor > IntVector::getZero(min_size.getDim())); TBOX_ASSERT(bad_interval >= IntVector::getZero(min_size.getDim())); - TBOX_ASSERT(physical_boxes.size() > 0); + TBOX_ASSERT(!physical_boxes.empty()); TBOX_ASSERT(!boxes.isOrdered()); const tbox::Dimension& dim(max_size.getDim()); @@ -345,14 +345,14 @@ BoxUtilities::chopBoxes( BoxContainer in_boxes(boxes); boxes.clear(); - while (!in_boxes.isEmpty()) { + while (!in_boxes.empty()) { Box box = in_boxes.front(); in_boxes.popFront(); BoxContainer tmp_boxes; - tbox::Array > cut_points(dim.getValue()); + std::vector > cut_points(dim.getValue()); bool chop_box = findBestCutPointsGivenMax(cut_points, box, max_size, @@ -360,14 +360,16 @@ BoxUtilities::chopBoxes( cut_factor); if (chop_box) { + IntVector block_cut_factor( + cut_factor.getBlockVector(box.getBlockId())); TBOX_ASSERT(box.getBlockId().isValid()); BoxContainer phys_block_boxes(physical_boxes, box.getBlockId()); - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { if (!cut_points[id].empty()) { - tbox::Array bad_cut_points; + std::vector bad_cut_points; findBadCutPointsForDirection(id, bad_cut_points, @@ -379,7 +381,7 @@ BoxUtilities::chopBoxes( bad_cut_points, box, min_size(id), - cut_factor(id)); + block_cut_factor(id)); } @@ -415,11 +417,11 @@ void BoxUtilities::chopBox( BoxContainer& boxes, const Box& box, - const tbox::Array > cut_points) + const std::vector >& cut_points) { const tbox::Dimension& dim(box.getDim()); - TBOX_ASSERT(cut_points.getSize() == dim.getValue()); + TBOX_ASSERT(static_cast(cut_points.size()) == dim.getValue()); if (!box.empty()) { @@ -427,16 +429,16 @@ BoxUtilities::chopBox( boxes.pushBack(box); BoxContainer tmp_boxes; - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { tmp_boxes.clear(); - while (!boxes.isEmpty()) { + while (!boxes.empty()) { Box chop_box = boxes.front(); boxes.popFront(); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, chop_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, chop_box); if (!cut_points[id].empty()) { @@ -451,8 +453,8 @@ BoxUtilities::chopBox( #endif while (cut != cut_points_list.end()) { int cut_val = *cut; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(last_cut <= cut_val); +#ifdef DEBUG_CHECK_ASSERTIONS last_cut = cut_val; #endif ihi(id) = cut_val - 1; @@ -461,7 +463,7 @@ BoxUtilities::chopBox( tmp_boxes.pushBack(new_box); ilo(id) = cut_val; } - cut++; + ++cut; } ihi(id) = chop_box.upper(id); @@ -493,7 +495,7 @@ BoxUtilities::chopBox( * This process eliminates domain boundary intersections which are * deemed unacceptable. Intersections that are disallowed are those in * which a portion of the domain boundary is parallel to a box face and - * lies strictly in the interior of the ghost cell mapped_box_level adjacent to + * lies strictly in the interior of the ghost cell box_level adjacent to * that face. In other words, we eliminate ghost cell regions residing * outside of the domain and which are narrower than the ghost width. * @@ -506,14 +508,14 @@ BoxUtilities::extendBoxesToDomainBoundary( const BoxContainer& domain, const IntVector& ext_ghosts) { - TBOX_ASSERT(!domain.isEmpty()); + TBOX_ASSERT(!domain.empty()); TBOX_ASSERT(ext_ghosts >= IntVector::getZero(ext_ghosts.getDim())); bool out_val = false; BoxContainer out_boxes; - while (!boxes.isEmpty()) { + while (!boxes.empty()) { Box try_box = boxes.front(); boxes.popFront(); @@ -537,12 +539,12 @@ BoxUtilities::extendBoxToDomainBoundary( const IntVector& ext_ghosts) { - TBOX_ASSERT(!domain.isEmpty()); + TBOX_ASSERT(!domain.empty()); TBOX_ASSERT(ext_ghosts >= IntVector::getZero(ext_ghosts.getDim())); const tbox::Dimension& dim(box.getDim()); - int id; + tbox::Dimension::dir_t id; bool out_val = false; if (!box.empty()) { @@ -553,14 +555,14 @@ BoxUtilities::extendBoxToDomainBoundary( BoxContainer outside_domain(test_ghost_box); outside_domain.removeIntersections(domain); - if (!outside_domain.isEmpty()) { + if (!outside_domain.empty()) { - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { BoxContainer outside_boxes; // Test whether lower end of ghost box extends outside domain Box test_region = test_ghost_box; - test_region.upper(id) = box.lower(id) - 1; + test_region.setUpper(id, box.lower(id) - 1); outside_boxes = outside_domain; outside_boxes.intersectBoxes(test_region); @@ -574,7 +576,7 @@ BoxUtilities::extendBoxToDomainBoundary( // Test whether upper end of ghost box extends outside domain test_region = test_ghost_box; - test_region.lower(id) = box.upper(id) + 1; + test_region.setLower(id, box.upper(id) + 1); outside_boxes = outside_domain; outside_boxes.intersectBoxes(test_region); @@ -590,9 +592,9 @@ BoxUtilities::extendBoxToDomainBoundary( (box.upper(id) != box_hi)); } - // Adjust box dimensions as necessary - box.lower(id) = box_lo; - box.upper(id) = box_hi; + // Adjust box sizes as necessary + box.setLower(id, box_lo); + box.setUpper(id, box_hi); } @@ -624,16 +626,16 @@ BoxUtilities::growBoxesWithinDomain( { const tbox::Dimension& dim(min_size.getDim()); - int id; + tbox::Dimension::dir_t id; TBOX_ASSERT(min_size > IntVector::getZero(dim)); - if (!boxes.isEmpty()) { + if (!boxes.empty()) { BoxContainer out_boxes; BoxContainer outside_domain; - if (domain.isEmpty()) { + if (domain.empty()) { Box big_box(boxes.getBoundingBox()); big_box.grow(min_size); outside_domain.pushBack(big_box); @@ -646,12 +648,12 @@ BoxUtilities::growBoxesWithinDomain( outside_domain.removeIntersections(domain); } - while (!boxes.isEmpty()) { + while (!boxes.empty()) { Box try_box = boxes.front(); boxes.popFront(); - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { int grow = min_size(id) - try_box.numberCells(id); @@ -662,8 +664,8 @@ BoxUtilities::growBoxesWithinDomain( // How far may box be grown within domain in lower direction? test_region = try_box; - test_region.lower(id) -= grow; - test_region.upper(id) = try_box.lower(id) - 1; + test_region.setLower(id, test_region.lower(id) - grow); + test_region.setUpper(id, try_box.lower(id) - 1); outside_boxes = outside_domain; outside_boxes.intersectBoxes(test_region); @@ -677,8 +679,8 @@ BoxUtilities::growBoxesWithinDomain( // How far may box be grown within domain in upper direction? test_region = try_box; - test_region.upper(id) += grow; - test_region.lower(id) = try_box.upper(id) + 1; + test_region.setUpper(id, test_region.upper(id) + grow); + test_region.setLower(id, try_box.upper(id) + 1); outside_boxes = outside_domain; outside_boxes.intersectBoxes(test_region); @@ -689,23 +691,25 @@ BoxUtilities::growBoxesWithinDomain( tbox::MathUtilities::Min(grow_up, lb->lower(id) - 1); } - // Adjust box dimensions as necessary + // Adjust box sizes as necessary if ((grow_up - grow_lo + 1) < min_size(id)) { - try_box.lower(id) = grow_lo; - try_box.upper(id) = grow_up; + try_box.setLower(id, grow_lo); + try_box.setUpper(id, grow_up); } else { int left = try_box.lower(id) - grow_lo; int right = grow_up - try_box.upper(id); int grow_half = grow / 2; if (left < right) { - try_box.lower(id) -= ((left < grow_half) ? left - : grow_half); - try_box.upper(id) = try_box.lower(id) + min_size(id) - 1; + try_box.setLower(id, + try_box.lower(id) - ((left < grow_half) ? left : grow_half)); + try_box.setUpper(id, + try_box.lower(id) + min_size(id) - 1); } else { - try_box.upper(id) += ((right < grow_half) ? right - : grow_half); - try_box.lower(id) = try_box.upper(id) - min_size(id) + 1; + try_box.setUpper(id, + try_box.upper(id) + ((right < grow_half) ? right : grow_half)); + try_box.setLower(id, + try_box.upper(id) - min_size(id) + 1); } } @@ -740,13 +744,13 @@ BoxUtilities::growBoxWithinDomain( const IntVector& min_size) { const tbox::Dimension& dim(min_size.getDim()); - int id; + tbox::Dimension::dir_t id; TBOX_ASSERT(min_size > IntVector::getZero(dim)); Box try_box = box; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { int grow = min_size(id) - try_box.numberCells(id); @@ -757,52 +761,62 @@ BoxUtilities::growBoxWithinDomain( // How far may box be grown within domain in lower direction? test_region = try_box; - test_region.lower(id) -= grow; - test_region.upper(id) = try_box.lower(id) - 1; - - outside_boxes = local_domain_complement; - outside_boxes.unorder(); + test_region.setLower(id, test_region.lower(id) - grow); + test_region.setUpper(id, try_box.lower(id) - 1); + + // outside_boxes = local_domain_complement; + // outside_boxes.unorder(); + outside_boxes.clear(); + for (BoxContainer::const_iterator bi = local_domain_complement.begin(); + bi != local_domain_complement.end(); ++bi) { + outside_boxes.push_back(*bi); + } outside_boxes.intersectBoxes(test_region); - BoxContainer::iterator lb = outside_boxes.begin(); int grow_lo = try_box.lower(id) - grow; - for ( ; lb != outside_boxes.end(); ++lb) { + for (BoxContainer::iterator lb = outside_boxes.begin(); lb != outside_boxes.end(); ++lb) { grow_lo = tbox::MathUtilities::Max(grow_lo, lb->upper(id) + 1); } // How far may box be grown within domain in upper direction? test_region = try_box; - test_region.upper(id) += grow; - test_region.lower(id) = try_box.upper(id) + 1; - - outside_boxes = local_domain_complement; - outside_boxes.unorder(); + test_region.setUpper(id, test_region.upper(id) + grow); + test_region.setLower(id, try_box.upper(id) + 1); + + // outside_boxes = local_domain_complement; + // outside_boxes.unorder(); + outside_boxes.clear(); + for (BoxContainer::const_iterator bi = local_domain_complement.begin(); + bi != local_domain_complement.end(); ++bi) { + outside_boxes.push_back(*bi); + } outside_boxes.intersectBoxes(test_region); int grow_up = try_box.upper(id) + grow; - for (lb = outside_boxes.begin(); lb != outside_boxes.end(); ++lb) { + for (BoxContainer::iterator lb = outside_boxes.begin(); lb != outside_boxes.end(); ++lb) { grow_up = tbox::MathUtilities::Min(grow_up, lb->lower(id) - 1); } - // Adjust box dimensions as necessary + // Adjust box sizes as necessary if ((grow_up - grow_lo + 1) < min_size(id)) { - try_box.lower(id) = grow_lo; - try_box.upper(id) = grow_up; + // Can't grow to min_size without hitting complement, but grow as much as possible. + try_box.setLower(id, grow_lo); + try_box.setUpper(id, grow_up); } else { int left = try_box.lower(id) - grow_lo; int right = grow_up - try_box.upper(id); int grow_half = grow / 2; if (left < right) { - try_box.lower(id) -= ((left < grow_half) ? left - : grow_half); - try_box.upper(id) = try_box.lower(id) + min_size(id) - 1; + try_box.setLower(id, + try_box.lower(id) - ((left < grow_half) ? left : grow_half)); + try_box.setUpper(id, try_box.lower(id) + min_size(id) - 1); } else { - try_box.upper(id) += ((right < grow_half) ? right - : grow_half); - try_box.lower(id) = try_box.upper(id) - min_size(id) + 1; + try_box.setUpper(id, + try_box.upper(id) + ((right < grow_half) ? right : grow_half)); + try_box.setLower(id, try_box.upper(id) - min_size(id) + 1); } } @@ -833,7 +847,7 @@ BoxUtilities::growBoxWithinDomain( bool BoxUtilities::findBestCutPointsGivenMax( - tbox::Array >& cut_points, + std::vector >& cut_points, const Box& box, const IntVector& max_size, const IntVector& min_size, @@ -841,24 +855,25 @@ BoxUtilities::findBestCutPointsGivenMax( { const tbox::Dimension& dim(max_size.getDim()); - TBOX_DIM_ASSERT_CHECK_ARGS3(max_size, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY3(max_size, min_size, cut_factor); TBOX_ASSERT(min_size > IntVector::getZero(dim)); TBOX_ASSERT(min_size <= max_size); TBOX_ASSERT(cut_factor > IntVector::getZero(dim)); - int id; + tbox::Dimension::dir_t id; bool chop_ok = false; - cut_points.resizeArray(dim.getValue()); + cut_points.resize(dim.getValue()); - for (id = 0; id < dim.getValue(); id++) { + IntVector block_cut_factor(cut_factor.getBlockVector(box.getBlockId())); + for (id = 0; id < dim.getValue(); ++id) { if (findBestCutPointsForDirectionGivenMax(id, cut_points[id], box, max_size(id), min_size(id), - cut_factor(id))) { + block_cut_factor(id))) { chop_ok = true; } } @@ -888,7 +903,7 @@ BoxUtilities::findBestCutPointsGivenMax( bool BoxUtilities::findBestCutPointsForDirectionGivenMax( - const int idir, + const tbox::Dimension::dir_t idir, std::list& cut_points, const Box& box, const int max_size, @@ -953,12 +968,12 @@ BoxUtilities::findBestCutPointsForDirectionGivenMax( if (num_boxes > 1) { int mark = box.lower(idir); int wide_count = 0; - for (int ic = 0; ic < num_boxes - 1; ic++) { + for (int ic = 0; ic < num_boxes - 1; ++ic) { int width = ((wide_count < num_wide_boxes) ? max_width : min_width); mark += width; cut_points.push_back(mark); - wide_count++; + ++wide_count; } chop_ok = true; @@ -990,13 +1005,13 @@ BoxUtilities::findBestCutPointsForDirectionGivenMax( bool BoxUtilities::findBestCutPointsGivenNumber( - tbox::Array >& cut_points, + std::vector >& cut_points, const Box& box, const IntVector& number_boxes, const IntVector& min_size, const IntVector& cut_factor) { - TBOX_DIM_ASSERT_CHECK_ARGS3(number_boxes, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY3(number_boxes, min_size, cut_factor); const tbox::Dimension& dim(number_boxes.getDim()); @@ -1005,15 +1020,16 @@ BoxUtilities::findBestCutPointsGivenNumber( TBOX_ASSERT(number_boxes > IntVector::getZero(dim)); TBOX_ASSERT(cut_factor > IntVector::getZero(dim)); - int id; + tbox::Dimension::dir_t id; - cut_points.resizeArray(dim.getValue()); + cut_points.resize(dim.getValue()); + IntVector block_cut_factor(cut_factor.getBlockVector(box.getBlockId())); - tbox::Array chop_dir(dim.getValue()); - for (id = 0; id < dim.getValue(); id++) { + std::vector chop_dir(dim.getValue()); + for (id = 0; id < dim.getValue(); ++id) { cut_points[id].clear(); chop_dir[id] = (((number_boxes(id) <= 1) - || (box.numberCells(id) % cut_factor(id)) + || (box.numberCells(id) % block_cut_factor(id)) || (box.numberCells(id) < 2 * min_size(id)) || (box.numberCells(id) < (number_boxes(id) * min_size(id)))) @@ -1022,7 +1038,7 @@ BoxUtilities::findBestCutPointsGivenNumber( bool chop_ok = false; - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (chop_dir[id]) { @@ -1031,7 +1047,7 @@ BoxUtilities::findBestCutPointsGivenNumber( box, number_boxes(id), min_size(id), - cut_factor(id))) { + block_cut_factor(id))) { chop_ok = true; } @@ -1064,7 +1080,7 @@ BoxUtilities::findBestCutPointsGivenNumber( bool BoxUtilities::findBestCutPointsForDirectionGivenNumber( - const int idir, + const tbox::Dimension::dir_t idir, std::list& cut_points, const Box& box, const int num_boxes, @@ -1114,12 +1130,12 @@ BoxUtilities::findBestCutPointsForDirectionGivenNumber( if (num_boxes > 1) { int mark = box.lower(idir); int wide_count = 0; - for (int ic = 0; ic < num_boxes - 1; ic++) { + for (int ic = 0; ic < num_boxes - 1; ++ic) { int width = ((wide_count < num_wide_boxes) ? max_width : min_width); mark += width; cut_points.push_back(mark); - wide_count++; + ++wide_count; } chop_ok = true; @@ -1151,17 +1167,16 @@ BoxUtilities::checkBoxForBadCutPoints( const BoxContainer& physical_boxes, const IntVector& bad_interval) { - TBOX_DIM_ASSERT_CHECK_ARGS3(bad_cut_information, box, - bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY3(bad_cut_information, box, bad_interval); const tbox::Dimension& dim(box.getDim()); bool found_bad = false; - int id; + tbox::Dimension::dir_t id; bad_cut_information = IntVector::getZero(dim); - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { if (checkBoxForBadCutPointsInDirection(id, box, physical_boxes, @@ -1185,25 +1200,26 @@ BoxUtilities::checkBoxForBadCutPoints( bool BoxUtilities::checkBoxForBadCutPointsInDirection( - const int id, + const tbox::Dimension::dir_t id, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, bad_interval); const tbox::Dimension& dim(box.getDim()); TBOX_ASSERT(!box.empty()); TBOX_ASSERT(bad_interval >= IntVector::getZero(dim)); + BlockId::block_t b = box.getBlockId().getBlockValue(); bool found_bad = false; - if (physical_boxes.size() > 0) { + if (!physical_boxes.empty()) { - int bad = bad_interval(id); + int bad = bad_interval(b,id); - int id2 = 0; + tbox::Dimension::dir_t id2 = 0; while ((id2 < dim.getValue()) && !found_bad) { if (id2 != id) { @@ -1216,7 +1232,7 @@ BoxUtilities::checkBoxForBadCutPointsInDirection( Box border = box; border.grow(bad_interval); - border.upper(id2) = box.lower(id2) - 1; + border.setUpper(id2, box.lower(id2) - 1); BoxContainer border_boxes(border); border_boxes.removeIntersections(physical_boxes); @@ -1237,7 +1253,7 @@ BoxUtilities::checkBoxForBadCutPointsInDirection( border = box; border.grow(bad_interval); - border.lower(id2) = box.upper(id2) + 1; + border.setLower(id2, box.upper(id2) + 1); border_boxes.clear(); border_boxes.pushBack(border); @@ -1254,7 +1270,7 @@ BoxUtilities::checkBoxForBadCutPointsInDirection( } } - id2++; + ++id2; } } @@ -1278,7 +1294,7 @@ BoxUtilities::checkBoxForBadCutPointsInDirection( void BoxUtilities::findBadCutPoints( - tbox::Array >& bad_cuts, + std::vector >& bad_cuts, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval) @@ -1286,9 +1302,9 @@ BoxUtilities::findBadCutPoints( const tbox::Dimension& dim(box.getDim()); TBOX_ASSERT(!box.empty()); - TBOX_ASSERT(bad_cuts.getSize() == dim.getValue()); + TBOX_ASSERT(static_cast(bad_cuts.size()) == dim.getValue()); - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { findBadCutPointsForDirection(id, bad_cuts[id], box, @@ -1318,31 +1334,33 @@ BoxUtilities::findBadCutPoints( void BoxUtilities::findBadCutPointsForDirection( - const int id, - tbox::Array& bad_cuts, + const tbox::Dimension::dir_t id, + std::vector& bad_cuts, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, bad_interval); const tbox::Dimension& dim(box.getDim()); TBOX_ASSERT(!box.empty()); TBOX_ASSERT(bad_interval >= IntVector::getZero(dim)); + BlockId::block_t b = box.getBlockId().getBlockValue(); + int ic; /* * Initialize all bad cut points to false; i.e., all are good. */ const int ncells = box.numberCells(id); - bad_cuts.resizeArray(ncells); - for (ic = 0; ic < ncells; ic++) { + bad_cuts.resize(ncells); + for (ic = 0; ic < ncells; ++ic) { bad_cuts[ic] = false; } - if (physical_boxes.size() == 0) { + if (physical_boxes.empty()) { return; // Avoid the code below, which may crash for zero boxes. } @@ -1359,7 +1377,7 @@ BoxUtilities::findBadCutPointsForDirection( Box level_bounding_box = physical_boxes.getBoundingBox(box.getBlockId()); - for (int id2 = 0; id2 < dim.getValue(); id2++) { + for (tbox::Dimension::dir_t id2 = 0; id2 < dim.getValue(); ++id2) { if (((dim.getValue() == 1) && id2 == id) || ((dim.getValue() != 1) && (id2 != id))) { @@ -1369,15 +1387,15 @@ BoxUtilities::findBadCutPointsForDirection( Box border = box; border.grow(bad_interval); - border.upper(id2) = box.lower(id2) - 1; + border.setUpper(id2, box.lower(id2) - 1); /* * limit the width of the border box to the width of the * domain to ensure that bad cut points near the boundary * of the box are not missed. */ - border.upper(id) = level_bounding_box.upper(id); - border.lower(id) = level_bounding_box.lower(id); + border.setUpper(id, level_bounding_box.upper(id)); + border.setLower(id, level_bounding_box.lower(id)); BoxContainer border_boxes(border); @@ -1389,16 +1407,16 @@ BoxUtilities::findBadCutPointsForDirection( border_boxes.removeIntersections(physical_boxes); } - if (!border_boxes.isEmpty()) { + if (!border_boxes.empty()) { border_boxes.simplify(); - for (BoxContainer::iterator bbox(border_boxes); + for (BoxContainer::iterator bbox = border_boxes.begin(); bbox != border_boxes.end(); ++bbox) { findBadCutPointsForBorderAndDirection(id, bad_cuts, box, *bbox, - bad_interval(id)); + bad_interval(b,id)); } } @@ -1408,15 +1426,15 @@ BoxUtilities::findBadCutPointsForDirection( border = box; border.grow(bad_interval); - border.lower(id2) = box.upper(id2) + 1; + border.setLower(id2, box.upper(id2) + 1); /* * limit the width of the border box to the width of the * domain to ensure that bad cut points near the boundary * of the box are not missed. */ - border.upper(id) = level_bounding_box.upper(id); - border.lower(id) = level_bounding_box.lower(id); + border.setUpper(id, level_bounding_box.upper(id)); + border.setLower(id, level_bounding_box.lower(id)); border_boxes.clear(); border_boxes.pushBack(border); @@ -1429,15 +1447,15 @@ BoxUtilities::findBadCutPointsForDirection( border_boxes.removeIntersections(physical_boxes); } - if (!border_boxes.isEmpty()) { + if (!border_boxes.empty()) { border_boxes.simplify(); - for (BoxContainer::iterator bbox(border_boxes); + for (BoxContainer::iterator bbox = border_boxes.begin(); bbox != border_boxes.end(); ++bbox) { findBadCutPointsForBorderAndDirection(id, bad_cuts, box, *bbox, - bad_interval(id)); + bad_interval(b,id)); } } @@ -1455,23 +1473,23 @@ BoxUtilities::findBadCutPointsForDirection( void BoxUtilities::fixBadCutPoints( - tbox::Array >& cuts, - const tbox::Array >& bad_cuts, + std::vector >& cuts, + const std::vector >& bad_cuts, const Box& box, const IntVector& min_size, const IntVector& cut_factor) { - TBOX_DIM_ASSERT_CHECK_ARGS3(box, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY3(box, min_size, cut_factor); const tbox::Dimension& dim(box.getDim()); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(cuts.getSize() == dim.getValue()); - TBOX_ASSERT(bad_cuts.getSize() == dim.getValue()); + TBOX_ASSERT(static_cast(cuts.size()) == dim.getValue()); + TBOX_ASSERT(static_cast(bad_cuts.size()) == dim.getValue()); bool bad_cuts_ok = true; - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { bad_cuts_ok = bad_cuts_ok && - (bad_cuts[id].getSize() == box.numberCells(id)); + (static_cast(bad_cuts[id].size()) == box.numberCells(id)); } TBOX_ASSERT(bad_cuts_ok); TBOX_ASSERT(!box.empty()); @@ -1479,13 +1497,14 @@ BoxUtilities::fixBadCutPoints( TBOX_ASSERT(cut_factor > IntVector::getZero(dim)); #endif - for (int id = 0; id < dim.getValue(); id++) { + IntVector block_cut_factor(cut_factor.getBlockVector(box.getBlockId())); + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { fixBadCutPointsForDirection(id, cuts[id], bad_cuts[id], box, min_size(id), - cut_factor(id)); + block_cut_factor(id)); } } @@ -1507,26 +1526,26 @@ BoxUtilities::fixBadCutPoints( void BoxUtilities::fixBadCutPointsForDirection( - const int id, + const tbox::Dimension::dir_t id, std::list& cuts, - const tbox::Array& bad_cuts, + const std::vector& bad_cuts, const Box& box, const int min_in, const int fact) { #ifdef DEBUG_CHECK_ASSERTIONS std::list::iterator cut = cuts.begin(); - TBOX_ASSERT(bad_cuts.getSize() == box.numberCells(id)); + TBOX_ASSERT(static_cast(bad_cuts.size()) == box.numberCells(id)); bool cuts_strictly_increase = true; if (cut != cuts.end()) { int prev = *cut; - cut++; + ++cut; while (cut != cuts.end() && cuts_strictly_increase) { if (*cut <= prev) { cuts_strictly_increase = false; } prev = *cut; - cut++; + ++cut; } } TBOX_ASSERT(cuts_strictly_increase); @@ -1539,7 +1558,7 @@ BoxUtilities::fixBadCutPointsForDirection( if ((((*cut) - box.lower(id)) % fact) != 0) { cuts_satisfy_factor = false; } - cut++; + ++cut; } TBOX_ASSERT(cuts_satisfy_factor); #endif @@ -1550,7 +1569,7 @@ BoxUtilities::fixBadCutPointsForDirection( */ bool bad_point_exists = false; const int ncells = box.numberCells(id); - for (int ic = 0; ic < ncells; ic++) { + for (int ic = 0; ic < ncells; ++ic) { if (bad_cuts[ic]) { bad_point_exists = true; } @@ -1574,7 +1593,7 @@ BoxUtilities::fixBadCutPointsForDirection( int foo = 0; std::list::iterator cuthi = cuts.insert(cuts.end(), foo); - cuthi--; + --cuthi; cuts.pop_back(); while (cutlo != cuts.end() && cuthi != cuts.end() && @@ -1591,8 +1610,8 @@ BoxUtilities::fixBadCutPointsForDirection( bad_cut_val = *cutlo; std::list::iterator tmplo = cutlo; std::list::iterator tmphi = cutlo; - tmplo--; - tmphi++; + --tmplo; + ++tmphi; cuts.erase(cutlo); below = (tmplo != cuts.end() ? *tmplo : ilo); @@ -1607,15 +1626,15 @@ BoxUtilities::fixBadCutPointsForDirection( found_good_cut = true; if (tmplo != cuts.end()) { std::list::iterator tmp = tmplo; - tmp++; + ++tmp; cuts.insert(tmp, try_cut); cutlo = tmplo; - cutlo++; + ++cutlo; } else { cuts.push_front(try_cut); cutlo = cuts.begin(); } - cutlo++; + ++cutlo; } else { cutlo = tmphi; } @@ -1633,19 +1652,21 @@ BoxUtilities::fixBadCutPointsForDirection( if (tmphi != cuts.end()) { cuts.insert(tmphi, try_cut); cuthi = tmphi; - cuthi--; + --cuthi; } else { cuthi = cuts.insert(cuts.end(), try_cut); } - cuthi--; + --cuthi; } else { cuthi = tmplo; } } } else { - cutlo++; - cuthi--; + ++cutlo; + if (cuthi != cuts.begin()) { + --cuthi; + } } } else { @@ -1654,7 +1675,7 @@ BoxUtilities::fixBadCutPointsForDirection( bad_cut_val = *cutlo; std::list::iterator tmplo = cutlo; - tmplo--; + --tmplo; cuts.erase(cutlo); below = (tmplo != cuts.end() ? *tmplo : ilo); @@ -1668,33 +1689,33 @@ BoxUtilities::fixBadCutPointsForDirection( if (try_cut >= (below + min)) { if (tmplo != cuts.end()) { std::list::iterator tmp = tmplo; - tmp++; + ++tmp; cuts.insert(tmplo, try_cut); cutlo = tmplo; - cutlo++; + ++cutlo; } else { cuts.push_front(try_cut); cutlo = cuts.begin(); } - cutlo++; + ++cutlo; } else { if (tmplo != cuts.end()) { cutlo = tmplo; - cutlo++; + ++cutlo; } else { cutlo = cuts.begin(); } } } else { - cutlo++; + ++cutlo; } if (bad_cuts[*cuthi - offset]) { bad_cut_val = *cuthi; std::list::iterator tmphi = cuthi; - tmphi++; + ++tmphi; cuts.erase(cuthi); above = (tmphi != cuts.end() ? *tmphi : ihi); @@ -1709,24 +1730,24 @@ BoxUtilities::fixBadCutPointsForDirection( if (tmphi != cuts.end()) { cuts.insert(tmphi, try_cut); cuthi = tmphi; - cuthi--; + --cuthi; } else { cuthi = cuts.insert(cuts.end(), try_cut); } - cuthi--; + --cuthi; } else { if (tmphi != cuts.end()) { cuthi = tmphi; - cuthi--; + --cuthi; } else { cuthi = cuts.insert(cuts.end(), foo); - cuthi--; + --cuthi; cuts.pop_back(); } } } else { - cuthi--; + --cuthi; } } @@ -1750,27 +1771,28 @@ BoxUtilities::fixBadCutPointsForDirection( void BoxUtilities::makeNonOverlappingBoxContainers( - tbox::Array& box_list_array, + std::vector& box_list_array, const BoxContainer& boxes) { const int nb = boxes.size(); - for (int i = 0; i < box_list_array.getSize(); i++) { + for (int i = 0; i < static_cast(box_list_array.size()); ++i) { box_list_array[i].clear(); } - box_list_array.resizeArray(nb); + box_list_array.resize(nb); // Copy boxes into a list to preserve the original box array. BoxContainer box_list(boxes); // Remove portion of index space represented by array box from list. // Keep unique pieces on box list. - BoxContainer::const_iterator itr(boxes); + BoxContainer::const_iterator itr = boxes.begin(); for (int ib = 0; ib < nb; ++ib, ++itr) { Box remove = *itr; - for (BoxContainer::iterator l(box_list); l != box_list.end(); ++l) { + for (BoxContainer::iterator l = box_list.begin(); + l != box_list.end(); ++l) { Box intersection = remove * (*l); if (intersection.isSpatiallyEqual(*l)) { box_list_array[ib].pushBack(*l); @@ -1782,7 +1804,191 @@ BoxUtilities::makeNonOverlappingBoxContainers( } } -} + +/* + ************************************************************************* + * + * Grow a box by a given width and chop it at block boundaries. + * + ************************************************************************* + */ + +void +BoxUtilities::growAndAdjustAcrossBlockBoundary( + BoxContainer& grown_boxes, + const Box& box, + const boost::shared_ptr& grid_geom, + const IntVector& ratio_to_level_zero, + const IntVector& refine_coarsen_ratio, + const IntVector& grow_width, + bool do_refine, + bool do_coarsen) +{ + TBOX_ASSERT(do_refine != do_coarsen || (!do_refine && !do_coarsen)); + + const size_t nblocks = grid_geom->getNumberBlocks(); + + TBOX_ASSERT(ratio_to_level_zero.getNumBlocks() == nblocks); + TBOX_ASSERT(refine_coarsen_ratio.getNumBlocks() == nblocks || + refine_coarsen_ratio == 1); + + const BlockId& base_block = box.getBlockId(); + + Box grow_box(box); + + /* + * If coarsening, change everything to the coarsened index space. + */ + if (do_coarsen) { + grow_box.coarsen(refine_coarsen_ratio); + } + + IntVector compare_ratio(ratio_to_level_zero); + IntVector effective_grow_width(grow_width, nblocks); + if (do_coarsen) { + compare_ratio /= refine_coarsen_ratio; + effective_grow_width.ceilingDivide(refine_coarsen_ratio); + } + + /* + * Grow and intersect with the domain on base block. + */ + grow_box.grow(effective_grow_width); + + BoxContainer domain_boxes; + grid_geom->computePhysicalDomain( + domain_boxes, + compare_ratio, + base_block); + + domain_boxes.unorder(); + domain_boxes.intersectBoxes(grow_box); + + if (do_refine) { + domain_boxes.refine(refine_coarsen_ratio); + } + + grown_boxes.spliceBack(domain_boxes); + + /* + * Uniform width means the same value of grow width for all directions on + * all blocks. The intersections with neighbor blocks are simpler if there + * is uniform width + */ + bool uniform_width = true; + if (effective_grow_width.min() != effective_grow_width.max()) { + uniform_width = false; + } + + + /* + * If grow_box is contained within its own block, there is no need to + * check neighboring blocks, so we are done. + */ + if (uniform_width && grown_boxes.size() == 1 && + grown_boxes.front().isSpatiallyEqual(grow_box)) { + return; + } + + /* + * Grow into neighbors. + */ + for (BaseGridGeometry::ConstNeighborIterator ni = + grid_geom->begin(base_block); ni != grid_geom->end(base_block); ++ni) { + + domain_boxes.clear(); + + const BaseGridGeometry::Neighbor& neighbor(*ni); + const BlockId& nbr_block = neighbor.getBlockId(); + + /* + * First step: Grow into neighbor block by transforming and then + * growing, using the neighbor block's portion of effective_grow_width. + */ + grid_geom->computePhysicalDomain( + domain_boxes, + compare_ratio, + nbr_block); + domain_boxes.unorder(); + + Box nbr_grow_box(box); + if (do_coarsen) { + nbr_grow_box.coarsen(refine_coarsen_ratio); + } + grid_geom->transformBox(nbr_grow_box, + compare_ratio, + nbr_block, + base_block); + nbr_grow_box.grow(effective_grow_width); + + BoxContainer nbr_block_boxes(domain_boxes); + nbr_block_boxes.unorder(); + nbr_block_boxes.intersectBoxes(nbr_grow_box); + + BoxContainer nbr_grown_boxes; + if (!nbr_block_boxes.empty()) { + if (do_refine) { + nbr_block_boxes.refine(refine_coarsen_ratio); + } + + nbr_grown_boxes.spliceBack(nbr_block_boxes); + } + + if (!uniform_width) { + + /* + * When width is not uniform, we do a second step of growing the + * box using the base block's grow width and then transforming. + */ + + nbr_block_boxes.spliceBack(domain_boxes); + + nbr_grow_box = box; + if (do_coarsen) { + nbr_grow_box.coarsen(refine_coarsen_ratio); + } + nbr_grow_box.grow(effective_grow_width); + grid_geom->transformBox(nbr_grow_box, + compare_ratio, + nbr_block, + base_block); + + nbr_block_boxes.unorder(); + nbr_block_boxes.intersectBoxes(nbr_grow_box); + + /* + * nbr_grown_boxes will have the intersection results from both steps. + * Coalesce nbr_grown_boxes, which in most cases will reduce + * to one box. In cases where it does not reduce to one, call + * simplify to guarantee that there is no overlapping index space in + * the container. + */ + if (!nbr_block_boxes.empty()) { + if (do_refine) { + nbr_block_boxes.refine(refine_coarsen_ratio); + } + + nbr_grown_boxes.spliceBack(nbr_block_boxes); + nbr_grown_boxes.coalesce(); + if (nbr_grown_boxes.size() > 1) { + nbr_grown_boxes.simplify(); + } + } + } + + /* + * Splice the intersecting boxes for this neighbor onto the output + * container. + */ + if (!nbr_grown_boxes.empty()) { + grown_boxes.spliceBack(nbr_grown_boxes); + } + } } -#endif + + + + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.h index feef9079..92198c5e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/BoxUtilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for processing boxes within a domain of index space. * ************************************************************************/ @@ -16,9 +16,9 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/tbox/Array.h" #include +#include namespace SAMRAI { namespace hier { @@ -63,15 +63,15 @@ namespace hier { * * - \b min_size * min_size is a IntVector that specifies the minimum - * allowable box length in each dimension. For example, if + * allowable box length in each direction. For example, if * min_size = (10,4,15), then the minimum box length in the - * x, y, and z dimensions are 10, 4, and 15 respectively. + * x, y, and z directions are 10, 4, and 15 respectively. * * - \b max_size * max_size is a IntVector that specifies the maximum - * allowable box length in each dimension. For example, if + * allowable box length in each direction. For example, if * max_size = (10,40,50), then the maximum box length in the - * x, y, and z dimensions are 10, 40, and 50 respectively. + * x, y, and z directions are 10, 40, and 50 respectively. * * It should be noted that the max_size constraint has lower * priority than the other constraints. In instances where @@ -80,9 +80,9 @@ namespace hier { * * - \b cut_factor * cut_factor is a IntVector that constrains the - * dimensions of a box to be multiples of the components of the + * size of a box to be multiples of the components of the * cut_factor. For instance, if cut_factor = (2,4,5), then the - * x, y, and z dimensions of a 8 box that satisfies the cut_factor + * x, y, and z directions of a 8 box that satisfies the cut_factor * constraint would be multiples of 2, 4, and 5 respectively. * * This constraint is usually enforced with the cut_factor equal @@ -123,8 +123,8 @@ namespace hier { * than in the box, box list, box array classes to avoid circular dependencies * among these classes. * - * @see hier::Box - * @see hier::BoxContainer + * @see Box + * @see BoxContainer */ struct BoxUtilities { @@ -158,13 +158,11 @@ struct BoxUtilities { * - \b physical_boxes (input) * box array representing the index space of box list domain * - * - * Assertion checks: - * - * - all components of min_size and bad_interval must be nonnegative - * - * - all components of cut_factor must be positive - * + * @pre (min_size.getDim() == cut_factor.getDim()) && + * (min_size.getDim() == bad_interval.getDim()) + * @pre min_size > IntVector::getZero(min_size.getDim()) + * @pre cut_factor > IntVector::getZero(min_size.getDim()) + * @pre bad_interval >= IntVector::getZero(min_size.getDim()) */ static void checkBoxConstraints( @@ -218,6 +216,15 @@ struct BoxUtilities { * restricts the cut locations or if the maximum size is not a * multiple of the cut factor. * + * @pre (max_size.getDim() == min_size.getDim()) && + * (max_size.getDim() == cut_factor.getDim()) && + * (max_size.getDim() == bad_interval.getDim()) + * @pre min_size > IntVector::getZero(min_size.getDim()) + * @pre max_size >= min_size + * @pre cut_factor > IntVector::getZero(min_size.getDim()) + * @pre bad_interval >= IntVector::getZero(min_size.getDim()) + * @pre !physical_boxes.empty() + * @pre !boxes.isOrdered() */ static void chopBoxes( @@ -242,16 +249,13 @@ struct BoxUtilities { * box which is to be chopped * * - \b cut_points (input) - * cut_points is an array of integer lists, each of which + * cut_points is a vector of integer lists, each of which * indicates the indices where the box will be cut in one of * the coordinate directions * * * Assertion checks: * - * - The cut point array must have size equal to the number of - * spatial dimensions for the box. - * * - The cut points for each direction must be on the list in * increasing order. * @@ -262,12 +266,13 @@ struct BoxUtilities { * operations are performed. Thus, any boxes on the list when * the function is called will be lost. * + * @pre cut_points.size() == box.getDim().getValue() */ static void chopBox( BoxContainer& boxes, const Box& box, - const tbox::Array > cut_points); + const std::vector >& cut_points); /** * Extend the box in the list to domain boundary as needed so that @@ -275,7 +280,7 @@ struct BoxUtilities { * the box in an inappropriate manner. Intersections that are * disallowed are those in which a portion of the domain boundary is * parallel to a box face and lies strictly in the interior of the ghost - * cell mapped_box_level adjacent to that face. In other words, we eliminate + * cell box_level adjacent to that face. In other words, we eliminate * ghost cell regions residing outside of a given domain and which are * narrower than the specified ghost width. The boolean return value * is true if the input box was extended to the boundary and thus @@ -297,13 +302,6 @@ struct BoxUtilities { * ghost cell region * * - * Assertion checks: - * - * - domain must not be an empty boxlist. - * - * - All components of ext_ghosts must be nonnegative. - * - * * Notes: * * - The ext_ghosts argument often corresponds to the bad_interval @@ -318,6 +316,8 @@ struct BoxUtilities { * far as it can, but will not remedy these degenerate situations * in general. * + * @pre !domain.empty() + * @pre ext_ghosts >= IntVector::getZero(ext_ghosts.getDim()) */ static bool extendBoxToDomainBoundary( @@ -332,6 +332,9 @@ struct BoxUtilities { * is true if any box in the input box list was extended to the boundary * and thus is changed by the routine. Otherwise, the return value * is false. + * + * @pre !domain.empty() + * @pre ext_ghosts >= IntVector::getZero(ext_ghosts.getDim()) */ static bool extendBoxesToDomainBoundary( @@ -356,11 +359,6 @@ struct BoxUtilities { * description. * * - * Assertion checks: - * - * - The minimum box size argument must have all nonnegative entries. - * - * * Notes: * * - Each box that is grown must remain within the union of the @@ -383,6 +381,8 @@ struct BoxUtilities { * * This routine will grow each box as far as it can, but will not * remedy these situations, generally. + * + * @pre min_size > IntVector::getZero(min_size.getDim()) */ static void growBoxesWithinDomain( @@ -390,10 +390,12 @@ struct BoxUtilities { const BoxContainer& domain, const IntVector& min_size); - /* + /** * Similar to growBoxesWithinDomain but works on one box at * a time and the domain is specified by the complement of local * parts of the domain. + * + * @pre min_size > IntVector::getZero(min_size.getDim()) */ static void growBoxWithinDomain( @@ -417,7 +419,7 @@ struct BoxUtilities { * Arguments: * * - \b cut_points (output) - * array of list of cut points for the box + * vector of list of cut points for the box * * - \b box (input) * box to be cut @@ -433,21 +435,15 @@ struct BoxUtilities { * - \b cut_factor(input) * See class header for description. * - * - * Assertion checks: - * - * - all components of min_size must be nonnegative - * - * - all components of max_size and cut_factor must be positive - * - * - for each i between 0 and (dim-1), the i-th component of - * min_size must be less than or equal to the i-th component - * of max_size - * + * @pre (max_size.getDim() == min_size.getDim()) && + * (max_size.getDim() == cut_factor.getDim()) + * @pre min_size > IntVector::getZero(max_size.getDim()) + * @pre min_size <= max_size + * @pre cut_factor > IntVector::getZero(max_size.getDim()) */ static bool findBestCutPointsGivenMax( - tbox::Array >& cut_points, + std::vector >& cut_points, const Box& box, const IntVector& max_size, const IntVector& min_size, @@ -485,19 +481,14 @@ struct BoxUtilities { * - \b cut_factor (input) * See class header for description. * - * - * Assertion checks: - * - * - min_size must be nonnegative - * - * - max_size and cut_factor must be positive - * - * - min_size must be less than or equal to max_size - * + * @pre !box.empty() + * @pre min_size > 0 + * @pre max_size >= min_size + * @pre cut_factor > 0 */ static bool findBestCutPointsForDirectionGivenMax( - const int idir, + const tbox::Dimension::dir_t idir, std::list& cut_points, const Box& box, const int max_size, @@ -520,7 +511,7 @@ struct BoxUtilities { * Arguments: * * - \b cut_points (output) - * array of list of cut points for the box + * vector of list of cut points for the box * * - \b box (input) * box to be cut @@ -541,16 +532,16 @@ struct BoxUtilities { * Important note: By convention, each integer cut point that is computed * corresponds to the cell index to the right of cut point. * - * Assertion checks: - * - * - all components of min_size must be nonnegative - * - * - all components of cut_factor and number_boxes must be positive - * + * @pre (number_boxes.getDim() == min_size.getDim()) && + * (number_boxes.getDim() == cut_factor.getDim()) + * @pre !box.empty() + * @pre min_size > IntVector::getZero(number_boxes.getDim()) + * @pre number_boxes > IntVector::getZero(number_boxes.getDim()) + * @pre cut_factor > IntVector::getZero(number_boxes.getDim()) */ static bool findBestCutPointsGivenNumber( - tbox::Array >& cut_points, + std::vector >& cut_points, const Box& box, const IntVector& number_boxes, const IntVector& min_size, @@ -589,17 +580,13 @@ struct BoxUtilities { * - \b cut_factor (input) * See class header for description. * - * - * Assertion checks: - * - * - min_size must be nonnegative - * - * - cut_factor and num_boxes must be positive - * + * @pre min_size > 0 + * @pre num_boxes > 0 + * @pre cut_factor > 0 */ static bool findBestCutPointsForDirectionGivenNumber( - const int idir, + const tbox::Dimension::dir_t idir, std::list& cut_points, const Box& box, const int num_boxes, @@ -635,11 +622,9 @@ struct BoxUtilities { * - \b bad_interval (input) * See class header for description. * - * - * Assertion checks: - * - * - all components of bad_interval must be nonnegative - * + * @pre (bad_cut_information.getDim() == box.getDim()) && + * (bad_cut_information.getDim() == bad_interval.getDim()) + * @pre bad_interval >= IntVector::getZero(box.getDim()) */ static bool checkBoxForBadCutPoints( @@ -671,15 +656,13 @@ struct BoxUtilities { * - \b bad_interval (input) * See class header for description. * - * - * Assertion checks: - * - * - all components of bad_interval must be nonnegative. - * + * @pre box.getDim() == bad_interval.getDim() + * @pre !box.empty() + * @pre bad_interval >= IntVector::getZero(box.getDim()) */ static bool checkBoxForBadCutPointsInDirection( - const int dir, + const tbox::Dimension::dir_t dir, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval); @@ -709,17 +692,13 @@ struct BoxUtilities { * - \b bad_interval (input) * See class header for description. * - * - * Assertion checks: - * - * - all components of bad_interval must be nonnegative - * - * - bad_cuts must have size equal to dim - * + * @pre !box.empty() + * @pre bad_cuts.size() == box.getDim().getValue() + * @pre bad_interval >= IntVector::getZero(box.getDim()) */ static void findBadCutPoints( - tbox::Array >& bad_cuts, + std::vector >& bad_cuts, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval); @@ -737,7 +716,7 @@ struct BoxUtilities { * coordinate direction to be checked for bad cut points * * - \b bad_cuts (output) - * boolean arrays whose entries indicates whether + * boolean vector whose entries indicates whether * a potential cut point is bad. * * - \b box (input) @@ -749,16 +728,14 @@ struct BoxUtilities { * - \b bad_interval (input) * See class header for description. * - * - * Assertion checks: - * - * - all components of bad_interval must be nonnegative - * + * @pre box.getDim() == bad_interval.getDim() + * @pre !box.empty() + * @pre bad_interval >= IntVector::getZero(box.getDim()) */ static void findBadCutPointsForDirection( - const int dir, - tbox::Array& bad_cuts, + const tbox::Dimension::dir_t dir, + std::vector& bad_cuts, const Box& box, const BoxContainer& physical_boxes, const IntVector& bad_interval); @@ -795,23 +772,22 @@ struct BoxUtilities { * * Assertion checks: * - * - All components of min_size must be nonnegative. - * - * - All components of cut_factor must be positive. - * - * - cuts and bad_cuts must have size equal to dim - * - * - Each array of integers in bad_cuts must have length - * equal to the number of cells for the box in that dimension. - * * - The cut points for each direction must be strictly increasing * and all satisfy the cut_factor restriction. * + * @pre (box.getDim() == min_size.getDim()) && + * (box.getDim() == cut_factor.getDim()) + * @pre cuts.size() == box.getDim().getValue() + * @pre bad_cuts.size() == box.getDim().getValue() + * @pre !box.empty() + * @pre min_size > IntVector::getZero(box.getDim()) + * @pre cut_factor > IntVector::getZero(box.getDim()) + * @pre for the ith array in bad_cuts, array.size() == box.numberCells(i) */ static void fixBadCutPoints( - tbox::Array >& cuts, - const tbox::Array >& bad_cuts, + std::vector >& cuts, + const std::vector >& bad_cuts, const Box& box, const IntVector& min_size, const IntVector& cut_factor); @@ -847,41 +823,37 @@ struct BoxUtilities { * - \b cut_factor (input) * See class header for description. * - * - * Assertion checks: - * - * - min_size must be nonnegative. - * - * - cut_factor must be positive. - * - * - bad_cut_points must have size equal to the number of - * cells in the box along the specified coordinate direction. - * - * - The cut points must be strictly increasing and all - * satisfy the cut_factor constraint. - * + * @pre bad_cuts.size() == box.numberCells(dir) + * @pre !box.empty() + * @pre min_size > 0 + * @pre cut_factor > 0 */ static void fixBadCutPointsForDirection( - const int dir, + const tbox::Dimension::dir_t dir, std::list& cuts, - const tbox::Array& bad_cuts, + const std::vector& bad_cuts, const Box& box, const int min_size, const int cut_factor); /** * - * This static private member function is called by findBadCutPoints(), + * This function is called by findBadCutPoints(), * and the findBadCutPointsForDirection() member functions. It sets bad * cut points near the lower and upper ends of the border box in the * given coordinate direction. * + * @pre box.getDim() == border.getDim() + * @pre (0 <= id) && (id < box.getDim().getValue()) + * @pre bad_cuts.size() == box.numberCells(id) + * @pre bad_interval >= 0 + * */ static void findBadCutPointsForBorderAndDirection( - const int id, - tbox::Array& bad_cuts, + const tbox::Dimension::dir_t id, + std::vector& bad_cuts, const Box& box, const Box& border, const int bad_interval); @@ -912,9 +884,47 @@ struct BoxUtilities { */ static void makeNonOverlappingBoxContainers( - tbox::Array& box_list_array, + std::vector& box_list_array, const BoxContainer& boxes); + /*! + * @brief Grow a box and chop it at block boundaries. + * + * If growing a box will cause it to extend across a block boundary, this + * method will chop it into distinct parts that are stored in the output + * BoxContainer. + * + * The output may be coarsened or refined from the input's index space, + * controlled by the do_refine and do_coarsen arguments. These arguments + * may both be false, but at most one may be true. + * + * The boxes in the output container that are intersections with neighboring + * blocks will be defined in the index space of those neighboring blocks + * + * @pre (do_refine != do_coarsen || (!do_refine && !do_coarsen)) + * @pre ratio_to_level_zero.getBlockSize() == grid_geom.getNumberBlocks() + * @pre refine_coarsen_ratio.getBlockSize() == grid_geom.getNumberBlocks() + * + * @param[out] grown_boxes Container to hold the results + * @param[in] box Input box + * @param[in] grid_geom Grid Geometry + * @param[in] ratio_to_level_zero Ratio from input box to level 0 + * @param[in] refine_coarsen_ratio Ratio to refine or coarsen output + * @param[in] grow_width Width to grow before chopping + * @param[in] do_refine + * @param[in] do_coarsen + */ + static void growAndAdjustAcrossBlockBoundary( + BoxContainer& grown_boxes, + const Box& box, + const boost::shared_ptr& grid_geom, + const IntVector& ratio_to_level_zero, + const IntVector& refine_coarsen_ratio, + const IntVector& grow_width, + bool do_refine, + bool do_coarsen); + + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.C index 199b479b..69f3d732 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: For describing coarse-fine boundary interfaces * ************************************************************************/ - -#ifndef included_hier_CoarseFineBoundary_C -#define included_hier_CoarseFineBoundary_C - #include "SAMRAI/hier/CoarseFineBoundary.h" #include "SAMRAI/hier/BoxContainer.h" @@ -57,34 +53,46 @@ CoarseFineBoundary::CoarseFineBoundary( d_dim(max_ghost_width.getDim()), d_initialized(hierarchy.getGridGeometry()->getNumberBlocks(), false) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, max_ghost_width); TBOX_ASSERT(max_ghost_width > IntVector(d_dim, -1)); + size_t number_blocks = hierarchy.getGridGeometry()->getNumberBlocks(); + const PatchLevel& level = *hierarchy.getPatchLevel(level_num); + const IntVector& ratio_to_zero = + level.getRatioToLevelZero(); + + IntVector connector_width(max_ghost_width, number_blocks); + connector_width.max(IntVector::getOne(d_dim)); + const Connector& level_to_level = level.findConnector(level, + connector_width, + CONNECTOR_CREATE); + if (level_num != 0) { + for (BlockId::block_t b = 0; b < connector_width.getNumBlocks(); ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + if (connector_width(b,d) % ratio_to_zero(b,d) != 0) { + connector_width(b,d) = + (connector_width(b,d) / ratio_to_zero(b,d)) + + ratio_to_zero(b,d); + } + } + } + } + + const Connector& level_to_domain = + level.getBoxLevel()->findConnector(hierarchy.getDomainBoxLevel(), + connector_width, + CONNECTOR_CREATE); + if (hierarchy.getGridGeometry()->getNumberBlocks() == 1) { - const PatchLevel& level = - dynamic_cast(*hierarchy.getPatchLevel(level_num)); - const Connector& level_to_level = - level.getBoxLevel()->getPersistentOverlapConnectors(). - findOrCreateConnector( - *level.getBoxLevel(), - max_ghost_width); - const Connector& level_to_domain = - level.getBoxLevel()->getPersistentOverlapConnectors(). - findOrCreateConnector( - hierarchy.getDomainBoxLevel(), - max_ghost_width); - computeFromLevel(level, + computeFromLevel( + level, level_to_domain, level_to_level, max_ghost_width); } else { - const PatchLevel& level = - dynamic_cast(*hierarchy.getPatchLevel(level_num)); - const PatchLevel& level0 = - dynamic_cast(*hierarchy.getPatchLevel(0)); - computeFromLevel( + computeFromMultiblockLevel( level, - level0, + level_to_domain, + level_to_level, max_ghost_width); } @@ -92,18 +100,17 @@ CoarseFineBoundary::CoarseFineBoundary( CoarseFineBoundary::CoarseFineBoundary( const PatchLevel& level, - const Connector& mapped_box_level_to_domain, - const Connector& mapped_box_level_to_self, + const Connector& level_to_domain, + const Connector& level_to_level, const IntVector& max_ghost_width): d_dim(max_ghost_width.getDim()), d_initialized(1, false) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, max_ghost_width); TBOX_ASSERT(max_ghost_width > IntVector(d_dim, -1)); computeFromLevel(level, - mapped_box_level_to_domain, - mapped_box_level_to_self, + level_to_domain, + level_to_level, max_ghost_width); } @@ -122,19 +129,19 @@ CoarseFineBoundary::~CoarseFineBoundary() void CoarseFineBoundary::computeFromLevel( const PatchLevel& level, - const Connector& mapped_box_level_to_domain, - const Connector& mapped_box_level_to_self, + const Connector& level_to_domain, + const Connector& level_to_level, const IntVector& max_ghost_width) { //this is single block version. - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, max_ghost_width); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, max_ghost_width); clear(); - const BoxLevel& mapped_box_level = *level.getBoxLevel(); + const BoxLevel& box_level = *level.getBoxLevel(); const IntVector& ratio = level.getRatioToLevelZero(); - boost::shared_ptr grid_geometry (level.getGridGeometry()); + boost::shared_ptr grid_geometry(level.getGridGeometry()); /* * Get the domain's periodic shift. @@ -170,40 +177,51 @@ CoarseFineBoundary::computeFromLevel( * the fake domain be everywhere there is NOT a coarse-fine boundary--or * everywhere there IS a physical boundary or a fine-boundary. */ - tbox::Array fake_domain(1); + std::vector fake_domain(1); BoxContainer& fake_domain_list = fake_domain[0]; - // Every mapped_box should connect to the domain mapped_box_level. - TBOX_ASSERT(mapped_box_level_to_domain.getLocalNumberOfNeighborSets() == - static_cast(mapped_box_level.getLocalNumberOfBoxes())); + // Every box should connect to the domain box_level. + + TBOX_ASSERT(level_to_domain.getLocalNumberOfNeighborSets() == + static_cast(box_level.getLocalNumberOfBoxes())); // Add physical boundaries to the fake domain. - for (Connector::ConstNeighborhoodIterator ei = mapped_box_level_to_domain.begin(); - ei != mapped_box_level_to_domain.end(); ++ei) { - const Box& mapped_box = *mapped_box_level.getBoxStrict(*ei); + IntVector physical_grow_width(max_ghost_width); + physical_grow_width.max(IntVector::getOne(d_dim)); + for (Connector::ConstNeighborhoodIterator ei = level_to_domain.begin(); + ei != level_to_domain.end(); ++ei) { + const Box& box = *box_level.getBoxStrict(*ei); BoxContainer refined_domain_nabrs; - for (Connector::ConstNeighborIterator ni = mapped_box_level_to_domain.begin(ei); - ni != mapped_box_level_to_domain.end(ei); ++ni) { + for (Connector::ConstNeighborIterator ni = level_to_domain.begin(ei); + ni != level_to_domain.end(ei); ++ni) { refined_domain_nabrs.insert(refined_domain_nabrs.end(), *ni); } refined_domain_nabrs.refine(ratio); - Box box = mapped_box; - box.grow(max_ghost_width); - BoxContainer physical_boundary_portion(box); + Box grow_box(box); + grow_box.grow(physical_grow_width); + BoxContainer physical_boundary_portion(grow_box); physical_boundary_portion.removeIntersections(refined_domain_nabrs); fake_domain_list.spliceBack(physical_boundary_portion); } // Add fine-fine boundaries to the fake domain. - TBOX_ASSERT(mapped_box_level_to_self.getConnectorWidth() >= - IntVector::getOne(d_dim)); - mapped_box_level_to_self.getLocalNeighbors(fake_domain_list); +#ifdef DEBUG_CHECK_ASSERTIONS + for (BlockId::block_t b = 0; b < grid_geometry->getNumberBlocks(); ++b) { + TBOX_ASSERT(level_to_level.getConnectorWidth() + >= IntVector::getOne(d_dim)); + } +#endif + BoxContainer level_neighbors; + level_neighbors.order(); + level_to_level.getLocalNeighbors(level_neighbors); + level_neighbors.unorder(); + fake_domain_list.spliceBack(level_neighbors); /* - * Call BaseGridGeometry::computeBoundaryGeometry with arguments contrived + * Call BaseGridGeometry::computeBoundaryBoxesOnLevel with arguments contrived * such that they give the coarse-fine boundaries instead of the domain * boundaries. The basic algorithm used by - * BaseGridGeometry::computeBoundaryGeometry is + * BaseGridGeometry::computeBoundaryBoxesOnLevel is * 1. grow boxes by ghost width * 2. remove intersection with domain * 3. reorganize and classify resulting boxes @@ -240,138 +258,86 @@ CoarseFineBoundary::computeFromLevel( } void -CoarseFineBoundary::computeFromLevel( +CoarseFineBoundary::computeFromMultiblockLevel( const PatchLevel& level, - const PatchLevel& level0, + const Connector& level_to_domain, + const Connector& level_to_level, const IntVector& max_ghost_width) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, max_ghost_width); - - /* - * Get all the boxes on level and level0. These will be used later. - */ - const BoxContainer& all_boxes_on_level = - level.getBoxLevel()->getGlobalizedVersion().getGlobalBoxes(); - const BoxContainer& all_boxes_on_level0 = - level0.getBoxLevel()->getGlobalizedVersion().getGlobalBoxes(); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, max_ghost_width); - /* - * Get the dimension and number of blocks from the grid geometry. - */ - boost::shared_ptr grid_geometry(level.getGridGeometry()); - int nblocks = grid_geometry->getNumberBlocks(); + clear(); - tbox::Array adjusted_level_domain(nblocks); + const BoxLevel& box_level = *level.getBoxLevel(); + const IntVector& ratio = level.getRatioToLevelZero(); + const int level_number = level.getLevelNumber(); /* - * Loop over each block. + * Get the number of blocks from the grid geometry. */ - for (int i = 0; i < nblocks; ++i) { - - clear(); - - BlockId block_id(i); - /* - * Construct an iterator which filters only level's boxes in this block. - */ - BoxContainerSingleBlockIterator itr( - all_boxes_on_level.begin(block_id)); - - /* - * Only do work if there any boxes in this block. - */ - if (itr != all_boxes_on_level.end(block_id)) { - - /* - * Construct the array of boxes on level and level0 in this block. - */ - BoxContainer level_domain(all_boxes_on_level, block_id); - BoxContainer phys_domain(all_boxes_on_level0, block_id); - - const IntVector& ratio = level.getRatioToLevelZero(); - phys_domain.refine(ratio); - - /* - * Create a pseudo-domain -- the union of the physical domain boxes - * of the current block with the physical domain boxes of all of the - * current block's neighbors. These are all represented in the - * current block's index space, and refined by level's refinement - * ratio. - */ - - BoxContainer pseudo_domain(phys_domain); - pseudo_domain.unorder(); - const std::list& nbr_list = - grid_geometry->getNeighbors(block_id); - for (std::list::const_iterator ni = - nbr_list.begin(); - ni != nbr_list.end(); ni++) { - - BoxContainer neighbor_domain(ni->getTransformedDomain()); - neighbor_domain.refine(ratio); - - pseudo_domain.spliceFront(neighbor_domain); - - } - - /* - * Make a list containing the level boxes for the current block, - * then add more boxes as a buffer around physical domain boundaries. - * This prevents physical boundaries from being identified as - * coarse-fine boundaries. - */ + boost::shared_ptr grid_geometry(level.getGridGeometry()); + size_t nblocks = grid_geometry->getNumberBlocks(); - adjusted_level_domain[i] = level_domain; - adjusted_level_domain[i].unorder(); + std::vector fake_domain(nblocks); - for (PatchLevel::iterator p(level.begin()); p != level.end(); ++p) { - if ((*p)->getBox().getBlockId() == i && - (*p)->getPatchGeometry()->getTouchesRegularBoundary()) { + // Every box should connect to the domain box_level. + TBOX_ASSERT(level_to_domain.getLocalNumberOfNeighborSets() == + static_cast(box_level.getLocalNumberOfBoxes())); - const Box& patch_box = (*p)->getBox(); + // Add physical boundaries to the fake domain. + IntVector physical_grow_width(max_ghost_width); + physical_grow_width.max(IntVector::getOne(d_dim)); + for (Connector::ConstNeighborhoodIterator ei = level_to_domain.begin(); + ei != level_to_domain.end(); ++ei) { + const Box& box = *box_level.getBoxStrict(*ei); + const BlockId& block_id = box.getBlockId(); + BoxContainer& fake_domain_list = fake_domain[block_id.getBlockValue()]; - BoxContainer no_shift_boxes(patch_box); - no_shift_boxes.grow(max_ghost_width); - no_shift_boxes.removeIntersections(pseudo_domain); - adjusted_level_domain[i].spliceFront(no_shift_boxes); - } + BoxContainer refined_domain_nabrs; + for (Connector::ConstNeighborIterator ni = level_to_domain.begin(ei); + ni != level_to_domain.end(ei); ++ni) { + if (block_id != ni->getBlockId()) { + Box transform_box(*ni); + grid_geometry->transformBox(transform_box, + 0, + block_id, + ni->getBlockId()); + refined_domain_nabrs.pushBack(transform_box); + } else { + refined_domain_nabrs.pushBack(*ni); } + } + refined_domain_nabrs.refine(ratio); + BoxContainer physical_boundary_portion(box); + physical_boundary_portion.grow(physical_grow_width); + physical_boundary_portion.removeIntersections(refined_domain_nabrs); + fake_domain_list.spliceBack(physical_boundary_portion); + } - /* - * Add buffer of boxes that exist on the current level across - * block boundaries from the current block. This prevents block - * boundaries from being identified as coarse-fine boundaries when - * they are not. - */ - for (std::list::const_iterator ni = - nbr_list.begin(); - ni != nbr_list.end(); ni++) { - - /* - * Construct the array of boxes on level in this neighbor's block. - */ - BlockId nbr_block_id(ni->getBlockId()); - BoxContainer neighbor_boxes(all_boxes_on_level, nbr_block_id); - - if (neighbor_boxes.size()) { - neighbor_boxes.unorder(); - grid_geometry->transformBoxContainer(neighbor_boxes, - ratio, - block_id, - nbr_block_id); - - BoxContainer neighbor_boxes_to_add(phys_domain); - neighbor_boxes_to_add.unorder(); - neighbor_boxes_to_add.grow(max_ghost_width); - - neighbor_boxes_to_add.intersectBoxes(neighbor_boxes); - - adjusted_level_domain[i].spliceFront(neighbor_boxes_to_add); - } + for (Connector::ConstNeighborhoodIterator ei = level_to_level.begin(); + ei != level_to_level.end(); ++ei) { + const Box& box = *box_level.getBoxStrict(*ei); + const BlockId& block_id = box.getBlockId(); + BoxContainer& fake_domain_list = fake_domain[block_id.getBlockValue()]; + + BoxContainer level_nabrs; + for (Connector::ConstNeighborIterator ni = level_to_level.begin(ei); + ni != level_to_level.end(ei); ++ni) { + if (block_id != ni->getBlockId()) { + Box transform_box(*ni); + grid_geometry->transformBox(transform_box, + level_number, + block_id, + ni->getBlockId()); + level_nabrs.pushBack(transform_box); + } else { + level_nabrs.pushBack(*ni); } - } + fake_domain_list.spliceBack(level_nabrs); + } + for (BlockId::block_t i = 0; i < nblocks; ++i) { d_initialized[i] = true; } @@ -407,25 +373,25 @@ CoarseFineBoundary::computeFromLevel( level, use_periodic_shift, max_ghost_width, - adjusted_level_domain, + fake_domain, do_all_patches); } -const tbox::Array& +const std::vector& CoarseFineBoundary::getBoundaries( const GlobalId& global_id, const int boundary_type, const BlockId& block_id) const { - const int& block_num = block_id.getBlockValue(); + const BlockId::block_t& block_num = block_id.getBlockValue(); if (!d_initialized[block_num]) { TBOX_ERROR("The boundary boxes have not been computed."); } - BoxId mapped_box_id(global_id); + BoxId box_id(global_id); std::map::const_iterator - mi = d_boundary_boxes.find(mapped_box_id); + mi = d_boundary_boxes.find(box_id); TBOX_ASSERT(mi != d_boundary_boxes.end()); return (*mi).second[boundary_type - 1]; } @@ -439,9 +405,8 @@ CoarseFineBoundary::printClassData( os << "\n patch " << (*mi).first; for (unsigned int btype = 0; btype < d_dim.getValue(); ++btype) { os << "\n type " << btype; - const tbox::Array - & array_of_boxes = (*mi).second[btype]; - int num_boxes = array_of_boxes.getSize(); + const std::vector& array_of_boxes = (*mi).second[btype]; + int num_boxes = static_cast(array_of_boxes.size()); int bn; for (bn = 0; bn < num_boxes; ++bn) { os << "\n box " @@ -463,5 +428,3 @@ CoarseFineBoundary::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.h index e4f2b997..20ee7219 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarseFineBoundary.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: For describing coarse-fine boundary interfaces * ************************************************************************/ @@ -19,6 +19,8 @@ #include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/hier/PatchHierarchy.h" +#include + namespace SAMRAI { namespace hier { @@ -79,6 +81,8 @@ class CoarseFineBoundary * that as in the case of regular boundary boxes, * each box will always be one cell wide in the * direction perpendicular to the patch boundary. + * + * @pre max_ghost_width > IntVector(max_ghost_width.getDim(), -1) */ CoarseFineBoundary( const PatchHierarchy& hierarchy, @@ -90,25 +94,27 @@ class CoarseFineBoundary * * The coarse-fine boundary will be computed using the physical domain * as the reference coarser level. The physical domain is provided to this - * method as the 'head' level of the mapped_box_level_to_domain Connector. + * method as the 'head' level of the box_level_to_domain Connector. * * @note If the level covers the entire physical domain, the coarse-fine * boundary will be empty. * * @param[in] level - * @param[in] mapped_box_level_to_domain - * @param[in] mapped_box_level_to_self + * @param[in] box_level_to_domain + * @param[in] box_level_to_self * @param[in] max_ghost_width The ghost width determines the extent of the * boundary boxes along the level domain boundary, * similar to regular domain boundary boxes. Note * that as in the case of regular boundary boxes, * each box will always be one cell wide in the * direction perpendicular to the patch boundary. + * + * @pre max_ghost_width > IntVector(max_ghost_width.getDim(), -1) */ CoarseFineBoundary( const PatchLevel& level, - const Connector& mapped_box_level_to_domain, - const Connector& mapped_box_level_to_self, + const Connector& box_level_to_domain, + const Connector& box_level_to_self, const IntVector& max_ghost_width); /*! @@ -131,7 +137,7 @@ class CoarseFineBoundary */ /*! - * @brief Get an array of boundary boxes of a given type + * @brief Get a vector of boundary boxes of a given type * for a specified patch. * * The specified patch must exist in the level used to compute @@ -140,15 +146,17 @@ class CoarseFineBoundary * @param[in] global_id * @param[in] boundary_type Codimension of boundaries. * @param[in] block_id Defaults to 0 for the single block case + * + * @pre d_initialize[block_id.getBlockValue()] */ - const tbox::Array& + const std::vector& getBoundaries( const GlobalId& global_id, const int boundary_type, const BlockId& block_id = BlockId::zero()) const; /*! - * @brief Get an array of node boundary boxes for a specified patch. + * @brief Get a vector of node boundary boxes for a specified patch. * * @see BoundaryBox for more information. * @@ -158,18 +166,18 @@ class CoarseFineBoundary * @param[in] global_id * @param[in] block_id Defaults to 0 for the single block case */ - const tbox::Array& + const std::vector& getNodeBoundaries( const GlobalId& global_id, const BlockId& block_id = BlockId::zero()) const { - return getBoundaries(global_id, d_dim.getValue(), block_id); + return getBoundaries(global_id, getDim().getValue(), block_id); } /*! - * @brief Get an array of edge boundary boxes for a specified patch. + * @brief Get a vector of edge boundary boxes for a specified patch. * - * @see hier::BoundaryBox for more information. + * @see BoundaryBox for more information. * * Note that edge boxes are only meaningful if the dimension is > 1. * The specified patch must exist in the level used to compute @@ -177,25 +185,27 @@ class CoarseFineBoundary * * @param[in] global_id * @param[in] block_id Defaults to 0 for the single block case + * + * @pre getDim().getValue() >= 2 */ - const tbox::Array& + const std::vector& getEdgeBoundaries( const GlobalId& global_id, const BlockId& block_id = BlockId::zero()) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_dim.getValue() < 2) { + if (getDim().getValue() < 2) { TBOX_ERROR("CoarseFineBoundary::getEdgeBoundaries(): There are\n" << "no edge boundaries in " << d_dim << "d.\n"); } #endif - return getBoundaries(global_id, d_dim.getValue() - 1, block_id); + return getBoundaries(global_id, getDim().getValue() - 1, block_id); } /*! - * @brief Get an array of face boundary boxes for a specified patch. + * @brief Get a vector of face boundary boxes for a specified patch. * - * @see hier::BoundaryBox for more information. + * @see BoundaryBox for more information. * * Note that face boxes are only meaningful if the dimension is > 2. * The specified patch must exist in the level used to compute @@ -203,19 +213,21 @@ class CoarseFineBoundary * * @param[in] global_id * @param[in] block_id Defaults to 0 for the single block case + * + * @pre getDim().getValue() >= 3 */ - const tbox::Array& + const std::vector& getFaceBoundaries( const GlobalId& global_id, const BlockId& block_id = BlockId::zero()) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_dim.getValue() < 3) { + if (getDim().getValue() < 3) { TBOX_ERROR("CoarseFineBoundary::getFaceBoundaries(): There are\n" << "no face boundaries in " << d_dim << "d.\n"); } #endif - return getBoundaries(global_id, d_dim.getValue() - 2, block_id); + return getBoundaries(global_id, getDim().getValue() - 2, block_id); } //@} @@ -243,6 +255,12 @@ class CoarseFineBoundary return *this; } + const tbox::Dimension& + getDim() const + { + return d_dim; + } + private: /* Don't allow default ctor */ CoarseFineBoundary(); @@ -252,26 +270,28 @@ class CoarseFineBoundary * * The coarse-fine boundary will be computed using the physical domain * as the reference coarser level. The physical domain is provided to this - * method as the 'head' level of the mapped_box_level_to_domain Connector. + * method as the 'head' level of the box_level_to_domain Connector. * * @note If the level covers the entire physical domain, the coarse-fine * boundary will be empty. * * @param[in] level - * @param[in] mapped_box_level_to_domain - * @param[in] mapped_box_level_to_self + * @param[in] level_to_domain Connector from level to physical domain level + * @param[in] level_to_level Connector from level to itself * @param[in] max_ghost_width The ghost width determines the extent of the * boundary boxes along the level domain boundary, * similar to regular domain boundary boxes. Note * that as in the case of regular boundary boxes, * each box will always be one cell wide in the * direction perpendicular to the patch boundary. + * + * @pre getDim() == max_ghost_width.getDim() */ void computeFromLevel( const PatchLevel& level, - const Connector& mapped_box_level_to_domain, - const Connector& mapped_box_level_to_self, + const Connector& level_to_domain, + const Connector& level_to_level, const IntVector& max_ghost_width); /*! @@ -284,18 +304,22 @@ class CoarseFineBoundary * boundary will be empty. * * @param[in] level - * @param[in] level0 + * @param[in] level_to_domain Connector from level to physical domain level + * @param[in] level_to_level Connector from level to itself * @param[in] max_ghost_width The ghost width determines the extent of the * boundary boxes along the level domain boundary, * similar to regular domain boundary boxes. Note * that as in the case of regular boundary boxes, * each box will always be one cell wide in the * direction perpendicular to the patch boundary. + * + * @pre getDim() == max_ghost_width.getDim() */ void - computeFromLevel( + computeFromMultiblockLevel( const PatchLevel& level, - const PatchLevel& level0, + const Connector& level_to_domain, + const Connector& level_to_level, const IntVector& max_ghost_width); /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.C index d679c7a6..db2ce92a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.C @@ -3,36 +3,33 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for spatial coarsening operators. * ************************************************************************/ - -#ifndef included_hier_CoarsenOperator_C -#define included_hier_CoarsenOperator_C - #include "SAMRAI/hier/CoarsenOperator.h" #include "SAMRAI/tbox/StartupShutdownManager.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" + namespace SAMRAI { namespace hier { std::multimap CoarsenOperator::s_lookup_table; +TBOX_omp_lock_t CoarsenOperator::l_lookup_table; tbox::StartupShutdownManager::Handler CoarsenOperator::s_finalize_handler( - 0, + CoarsenOperator::initializeCallback, 0, 0, CoarsenOperator::finalizeCallback, tbox::StartupShutdownManager::priorityList); CoarsenOperator::CoarsenOperator( - const tbox::Dimension& dim, const std::string& name): - d_name(name), - d_dim(dim) + d_name(name) { registerInLookupTable(name); } @@ -42,15 +39,26 @@ CoarsenOperator::~CoarsenOperator() removeFromLookupTable(d_name); } +void +CoarsenOperator::registerInLookupTable( + const std::string& name) +{ + TBOX_omp_set_lock(&l_lookup_table); + s_lookup_table.insert( + std::pair(name, this)); + TBOX_omp_unset_lock(&l_lookup_table); +} + void CoarsenOperator::removeFromLookupTable( const std::string& name) { /* * The lookup table might be empty if static CoarsenOperator's are used - * in which case the table will have been removed before the statics + * in which case the table will have been cleared before the statics * are destroyed. */ + TBOX_omp_set_lock(&l_lookup_table); if (!s_lookup_table.empty()) { std::multimap::iterator mi = s_lookup_table.find(name); @@ -61,9 +69,10 @@ CoarsenOperator::removeFromLookupTable( } TBOX_ASSERT(mi->first == name); TBOX_ASSERT(mi->second == this); - mi->second = NULL; + mi->second = 0; s_lookup_table.erase(mi); } + TBOX_omp_unset_lock(&l_lookup_table); } /* ************************************************************************* @@ -77,17 +86,37 @@ CoarsenOperator::getMaxCoarsenOpStencilWidth( { IntVector max_width(dim, 0); + TBOX_omp_set_lock(&l_lookup_table); for (std::multimap::const_iterator mi = s_lookup_table.begin(); mi != s_lookup_table.end(); ++mi) { const CoarsenOperator* op = mi->second; - if (op->getDim() == dim) { - max_width.max(op->getStencilWidth()); - } + max_width.max(op->getStencilWidth(dim)); } + TBOX_omp_unset_lock(&l_lookup_table); return max_width; } +/* + ************************************************************************* + ************************************************************************* + */ +void +CoarsenOperator::initializeCallback() +{ + TBOX_omp_init_lock(&l_lookup_table); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +CoarsenOperator::finalizeCallback() +{ + s_lookup_table.clear(); + TBOX_omp_destroy_lock(&l_lookup_table); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.h index 374c1964..8c40797c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/CoarsenOperator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for spatial coarsening operators. * ************************************************************************/ @@ -16,8 +16,9 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/Variable.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -25,7 +26,7 @@ namespace SAMRAI { namespace hier { /** - * Class CoarsenOperator is an abstract base class for each + * Class CoarsenOperator is an abstract base class for each * spatial coarsening operator used in the SAMRAI framework. This class * defines the interface between numerical coarsening routines and the * rest of the framework. Each concrete coarsening operator subclass @@ -52,13 +53,13 @@ namespace hier { * from the getStencilWidth() and getOperatorPriority() functions, * respectively. Then, the new operator must be added to the * operator list for the appropriate transfer geometry object using the - * Geometry::addCarsenOperator() function. + * BaseGridGeometry::addCarsenOperator() function. * * Since spatial coarsening operators usually depend on patch data centering * and data type as well as the mesh coordinate system, they are defined * in the geometry package. * - * @see hier::TransferOperatorRegistry + * @see TransferOperatorRegistry */ class CoarsenOperator @@ -66,15 +67,14 @@ class CoarsenOperator public: /*! * @brief Construct the object with a name to allow the - * hier::TransferOperatorRegistry class to look up the object using a + * TransferOperatorRegistry class to look up the object using a * string. * * The constructor must be given a name. The object will be - * registered under this name with the hier::TransferOperatorRegistry class. + * registered under this name with the TransferOperatorRegistry class. * The name must be unique, as duplicate names are not allowed. */ CoarsenOperator( - const tbox::Dimension& dim, const std::string& name); /** @@ -106,9 +106,12 @@ class CoarsenOperator * The SAMRAI transfer routines guarantee that the source patch will * contain sufficient ghost cell data surrounding the interior to * satisfy the stencil width requirements for each coarsening operator. + * If your implementation doesn't work with the given dimension, return + * zero. */ virtual IntVector - getStencilWidth() const = 0; + getStencilWidth( + const tbox::Dimension& dim) const = 0; /** * Coarsen the source component on the fine patch to the destination @@ -136,19 +139,10 @@ class CoarsenOperator getMaxCoarsenOpStencilWidth( const tbox::Dimension& dim); - /** - * Return the dimension of this object. - */ - const tbox::Dimension& - getDim() const - { - return d_dim; - } - private: CoarsenOperator( const CoarsenOperator&); // not implemented - void + CoarsenOperator& operator = ( const CoarsenOperator&); // not implemented @@ -165,11 +159,7 @@ class CoarsenOperator */ void registerInLookupTable( - const std::string& name) - { - s_lookup_table.insert( - std::pair(name, this)); - } + const std::string& name); /*! * @brief Remove the operator with the given name. @@ -179,19 +169,22 @@ class CoarsenOperator removeFromLookupTable( const std::string& name); + /*! + * @brief Method registered with ShutdownRegister to initialize statics. + */ + static void + initializeCallback(); + /*! * @brief Method registered with ShutdownRegister to cleanup statics. */ static void - finalizeCallback() - { - s_lookup_table.clear(); - } + finalizeCallback(); const std::string d_name; - const tbox::Dimension d_dim; static std::multimap s_lookup_table; + static TBOX_omp_lock_t l_lookup_table; static tbox::StartupShutdownManager::Handler s_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.C index d4e33530..db73a4b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple bit vector of a fixed length (128 bits) * ************************************************************************/ - -#ifndef included_hier_ComponentSelector_C -#define included_hier_ComponentSelector_C - #include "SAMRAI/hier/ComponentSelector.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -26,7 +22,7 @@ ComponentSelector::ComponentSelector( int num_mod = pd_entries % C_BITSET_SIZE; if (num_mod != 0) { - num_bitset_elements++; + ++num_bitset_elements; } std::bitset l_bits; @@ -160,5 +156,3 @@ ComponentSelector::printClassData( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.h index 7a2c0cba..dc6b436a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ComponentSelector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple bit vector. * ************************************************************************/ @@ -170,51 +170,54 @@ class ComponentSelector /*! * @brief Check whether the specified bit vector position is true. * - * When assertion checking is active, an assertion will result if the - * given position is out-of-bounds. - * * @param[in] i The position in the bit vector to check. * * @return True if the bit at position i is set to true. + * + * @pre (i >= 0) */ bool isSet( const int i) const { - TBOX_ASSERT((i >= 0) && (i < getSize())); - return d_bit_vector[_index(i)].test(_element(i)); + TBOX_ASSERT(i >= 0); + return i < getSize() && d_bit_vector[_index(i)].test(_element(i)); } /*! * @brief Set the specified bit vector position to true. * - * When assertion checking is active, an assertion will result if the - * given position is out-of-bounds. - * * @param[in] i The position in the bit vector to set to true. + * + * @pre (i >= 0) */ void setFlag( const int i) { - TBOX_ASSERT((i >= 0) && (i < getSize())); + TBOX_ASSERT(i >= 0); + if (i >= getSize()) { + d_bit_vector.resize(d_bit_vector.size() + 1, d_bit_vector[0]); + d_bit_vector[d_bit_vector.size()-1].reset(); + } d_bit_vector[_index(i)].set(_element(i)); } /*! * @brief Set the specified bit vector position to false. * - * When assertion checking is active, an assertion will result if the - * given position is out-of-bounds. - * * @param[in] i The position in the bit vector to set to false. + * + * @pre (i >= 0) */ void clrFlag( const int i) { - TBOX_ASSERT((i >= 0) && (i < getSize())); - d_bit_vector[_index(i)].reset(_element(i)); + TBOX_ASSERT(i >= 0); + if (i < getSize()) { + d_bit_vector[_index(i)].reset(_element(i)); + } d_max_bit_index = _findMaxIndex(d_bit_vector); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.C index 56ec8852..caf83d4b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.C @@ -3,24 +3,27 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Set of edges incident from a mapped_box_level of a distributed box graph. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Set of edges incident from a box_level of a distributed + * box graph. * ************************************************************************/ -#ifndef included_hier_Connector_C -#define included_hier_Connector_C - #include "SAMRAI/hier/Connector.h" #include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxUtilities.h" #include "SAMRAI/hier/ConnectorStatistics.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" +#include "SAMRAI/tbox/CenteredRankTree.h" #include "SAMRAI/tbox/StartupShutdownManager.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include +#include +#include //#include #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -31,8 +34,6 @@ #pragma report(disable, CPPC5328) #endif -static const std::string dbgbord; - namespace SAMRAI { namespace hier { @@ -40,6 +41,7 @@ const int Connector::HIER_CONNECTOR_VERSION = 0; boost::shared_ptr Connector::t_acquire_remote_relationships; boost::shared_ptr Connector::t_cache_global_reduced_data; +boost::shared_ptr Connector::t_find_overlaps_rbbt; tbox::StartupShutdownManager::Handler Connector::s_initialize_finalize_handler( @@ -54,25 +56,55 @@ Connector::s_initialize_finalize_handler( *********************************************************************** */ -Connector::Connector(): +Connector::Connector( + const tbox::Dimension& dim): d_base_handle(), d_head_handle(), - d_base_width(tbox::Dimension::getInvalidDimension()), - d_ratio(tbox::Dimension::getInvalidDimension()), + d_base_width(dim), + d_ratio(dim), d_ratio_is_exact(false), d_head_coarser(false), d_relationships(), d_global_relationships(), - d_mpi(tbox::SAMRAI_MPI::commNull), + d_mpi(MPI_COMM_NULL), d_parallel_state(BoxLevel::DISTRIBUTED), d_finalized(false), d_global_number_of_neighbor_sets(0), d_global_number_of_relationships(0), d_global_data_up_to_date(false), - d_connector_type(UNKNOWN) + d_transpose(0), + d_owns_transpose(false) { } +/* + *********************************************************************** + *********************************************************************** + */ + +Connector::Connector( + const tbox::Dimension& dim, + tbox::Database& restart_db): + d_base_handle(), + d_head_handle(), + d_base_width(dim), + d_ratio(dim), + d_ratio_is_exact(false), + d_head_coarser(false), + d_relationships(), + d_global_relationships(), + d_mpi(MPI_COMM_NULL), + d_parallel_state(BoxLevel::DISTRIBUTED), + d_finalized(false), + d_global_number_of_neighbor_sets(0), + d_global_number_of_relationships(0), + d_global_data_up_to_date(false), + d_transpose(0), + d_owns_transpose(false) +{ + getFromRestart(restart_db); +} + /* *********************************************************************** *********************************************************************** @@ -94,8 +126,22 @@ Connector::Connector( d_global_number_of_neighbor_sets(other.d_global_number_of_neighbor_sets), d_global_number_of_relationships(other.d_global_number_of_relationships), d_global_data_up_to_date(other.d_global_data_up_to_date), - d_connector_type(other.d_connector_type) + d_transpose(other.d_transpose), + d_owns_transpose(false) { + size_t num_blocks = + d_base_handle->getBoxLevel().getGridGeometry()->getNumberBlocks(); + + if (d_base_width.getNumBlocks() == 1 && num_blocks != 1) { + if (d_base_width.max() == d_base_width.min()) { + d_base_width = IntVector(d_base_width, num_blocks); + } else { + TBOX_ERROR("Connector::Connector: anisotropic connector\n" + << "width " << d_base_width << " must be \n" + << "defined for " << num_blocks << " blocks.\n"); + } + } + } /* @@ -104,30 +150,42 @@ Connector::Connector( */ Connector::Connector( - const BoxLevel& base_mapped_box_level, - const BoxLevel& head_mapped_box_level, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, const IntVector& base_width, const BoxLevel::ParallelState parallel_state): - d_base_width(base_width.getDim(), 0), - d_ratio(base_width.getDim(), 0), + d_base_width(IntVector::getZero(base_width.getDim())), + d_ratio(IntVector::getZero(base_width.getDim())), d_head_coarser(false), d_relationships(), d_global_relationships(), - d_mpi(base_mapped_box_level.getMPI()), + d_mpi(base_box_level.getMPI()), d_parallel_state(parallel_state), d_finalized(false), d_global_number_of_neighbor_sets(0), d_global_number_of_relationships(0), d_global_data_up_to_date(true), - d_connector_type(UNKNOWN) + d_transpose(0), + d_owns_transpose(false) { - TBOX_DIM_ASSERT_CHECK_ARGS3(base_mapped_box_level, - head_mapped_box_level, + TBOX_ASSERT_OBJDIM_EQUALITY3(base_box_level, + head_box_level, base_width); + IntVector tmp_base_width(base_width); + size_t num_blocks = base_box_level.getGridGeometry()->getNumberBlocks(); + if (tmp_base_width.getNumBlocks() == 1 && num_blocks != 1) { + if (tmp_base_width.max() == tmp_base_width.min()) { + tmp_base_width = IntVector(tmp_base_width, num_blocks); + } else { + TBOX_ERROR("Connector::Connector: anisotropic connector\n" + << "width " << base_width << " must be \n" + << "defined for " << num_blocks << " blocks.\n"); + } + } - setBase(base_mapped_box_level); - setHead(head_mapped_box_level); - setWidth(base_width, true); + setBase(base_box_level); + setHead(head_box_level); + setWidth(tmp_base_width, true); } /* @@ -138,13 +196,16 @@ Connector::Connector( Connector::~Connector() { clear(); + if (d_transpose && d_owns_transpose && d_transpose != this) { + delete d_transpose; + } } /* *********************************************************************** *********************************************************************** */ -const Connector& +Connector& Connector::operator = ( const Connector& rhs) { @@ -162,7 +223,8 @@ Connector::operator = ( d_head_coarser = rhs.d_head_coarser; d_parallel_state = rhs.d_parallel_state; d_finalized = rhs.d_finalized; - d_connector_type = rhs.d_connector_type; + d_transpose = rhs.d_transpose; // TODO: This leads to a memory error. + d_owns_transpose = false; } return *this; } @@ -260,7 +322,7 @@ Connector::insertNeighbors( { #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state == BoxLevel::DISTRIBUTED && - base_box.getOwnerRank() != getBase().getMPI().getRank()) { + base_box.getOwnerRank() != getMPI().getRank()) { TBOX_ERROR("Connector::insertNeighbors error: Cannot work on remote\n" << "data in DISTRIBUTED mode."); } @@ -276,7 +338,7 @@ Connector::insertNeighbors( if (d_parallel_state == BoxLevel::GLOBALIZED) { d_global_relationships.insert(base_box, neighbors); } - if (base_box.getOwnerRank() == getBase().getMPI().getRank()) { + if (base_box.getOwnerRank() == getMPI().getRank()) { d_relationships.insert(base_box, neighbors); } } @@ -288,27 +350,27 @@ Connector::insertNeighbors( void Connector::eraseNeighbor( const Box& neighbor, - const BoxId& mapped_box_id) + const BoxId& box_id) { #ifdef DEBUG_CHECK_ASSERTIONS if (d_parallel_state == BoxLevel::DISTRIBUTED && - mapped_box_id.getOwnerRank() != getBase().getMPI().getRank()) { + box_id.getOwnerRank() != getMPI().getRank()) { TBOX_ERROR("Connector::eraseNeighbor error: Cannot work on remote\n" << "data in DISTRIBUTED mode."); } - if (!getBase().hasBox(mapped_box_id)) { + if (!getBase().hasBox(box_id)) { TBOX_ERROR( "Connector::eraseNeighbors: Cannot access neighbors for\n" - << "id " << mapped_box_id << " because it does not " + << "id " << box_id << " because it does not " << "exist in the base.\n" << "base:\n" << getBase().format("", 2)); } #endif if (d_parallel_state == BoxLevel::GLOBALIZED) { - d_global_relationships.erase(mapped_box_id, neighbor); + d_global_relationships.erase(box_id, neighbor); } - if (mapped_box_id.getOwnerRank() == getBase().getMPI().getRank()) { - d_relationships.erase(mapped_box_id, neighbor); + if (box_id.getOwnerRank() == getMPI().getRank()) { + d_relationships.erase(box_id, neighbor); } } @@ -318,15 +380,29 @@ Connector::eraseNeighbor( */ void Connector::shrinkWidth( -const IntVector& new_width) + const IntVector& new_width) { - if (!(new_width <= getConnectorWidth())) { - TBOX_ERROR("Connector::shrinkWidth: new ghost cell\n" - << "width " << new_width << " involves an\n" - << "enlargement of the current cell width " + IntVector shrink_width(new_width); + if (shrink_width.getNumBlocks() == 1 && + d_base_width.getNumBlocks() != 1) { + if (shrink_width.max() == shrink_width.min()) { + size_t new_size = d_base_width.getNumBlocks(); + shrink_width = IntVector(shrink_width, new_size); + } else { + TBOX_ERROR("Connector::shrinkWidth: new anisotropic connector\n" + << "width " << shrink_width << " must be \n" + << "defined for " << d_base_width.getNumBlocks() << " blocks.\n"); + } + } + + TBOX_ASSERT(shrink_width.getNumBlocks() == d_base_width.getNumBlocks()); + if (!(shrink_width <= getConnectorWidth())) { + TBOX_ERROR("Connector::shrinkWidth: new connector\n" + << "width " << shrink_width << " involves an\n" + << "enlargement of the current width " << getConnectorWidth()); } - else if (new_width == getConnectorWidth()) { + else if (shrink_width == getConnectorWidth()) { // This is a no-op. return; } @@ -346,39 +422,356 @@ const IntVector& new_width) const boost::shared_ptr& grid_geom( getBase().getGridGeometry()); - for (NeighborhoodIterator ei = begin(); ei != end(); ++ei) { - const BoxId& mapped_box_id = *ei; - const Box& mapped_box = *getBase().getBoxStrict( - mapped_box_id); - Box mapped_box_box = mapped_box; - mapped_box_box.grow(new_width); - if (base_coarser) { - mapped_box_box.refine(getRatio()); - } - for (NeighborIterator na = begin(ei); - na != end(ei); /* incremented in loop */) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (nabr.getBlockId() != mapped_box.getBlockId()) { - grid_geom->transformBox(nabr_box, - getHead().getRefinementRatio(), - mapped_box.getBlockId(), - nabr.getBlockId()); + if (grid_geom->getNumberBlocks() == 1 || grid_geom->hasIsotropicRatios()) { + for (NeighborhoodIterator ei = begin(); ei != end(); ++ei) { + const BoxId& box_id = *ei; + const Box& box = *getBase().getBoxStrict(box_id); + Box box_box = box; + box_box.grow(shrink_width); + if (base_coarser) { + box_box.refine(getRatio()); } - if (head_coarser) { - nabr_box.refine(getRatio()); + for (NeighborIterator na = begin(ei); + na != end(ei); /* incremented in loop */) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (nabr.getBlockId() != box.getBlockId()) { + grid_geom->transformBox(nabr_box, + getHead().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + if (head_coarser) { + nabr_box.refine(getRatio()); + } + ++na; + if (!box_box.intersects(nabr_box)) { + d_relationships.erase(ei, nabr); + } } - ++na; - if (!mapped_box_box.intersects(nabr_box)) { - d_relationships.erase(ei, nabr); + } + } else { + for (NeighborhoodIterator ei = begin(); ei != end(); ++ei) { + const BoxId& box_id = *ei; + const Box& box = *getBase().getBoxStrict(box_id); + BoxContainer grown_boxes; + BoxUtilities::growAndAdjustAcrossBlockBoundary(grown_boxes, + box, + grid_geom, + getBase().getRefinementRatio(), + getRatio(), + shrink_width, + base_coarser, + head_coarser); + + for (NeighborIterator na = begin(ei); + na != end(ei); /* incremented in loop */) { + + const Box& nabr = *na; + bool intersection = false; + + for (BoxContainer::iterator b_itr = grown_boxes.begin(); + b_itr != grown_boxes.end(); ++b_itr) { + + if (nabr.getBlockId() == b_itr->getBlockId()) { + Box nabr_box = nabr; + + if (head_coarser) { + nabr_box.refine(getRatio()); + } + if (b_itr->intersects(nabr_box)) { + intersection = true; + break; + } + } + } + ++na; + if (!intersection) { + d_relationships.erase(ei, nabr); + } } } } - d_base_width = new_width; + d_base_width = shrink_width; return; } +/* + *********************************************************************** + * Set this Connector to the transpose of another Connector. The + * other's base owners tell its head owners about relationships, and + * head owners (base owners of this Connector) populate the this + * Connector. + * + * This method uses the termination message technique of the assumed + * partition algorithm. + * + * Two communication patterns are executed simultaneously: edge info + * and termination messages. For edge info, other's base box owners + * send data to this's base box owners, who respond with + * acknowledgement messages. Termination messages let the processes + * know when to stop checking for edge messages. They are propagated + * up then down a rank tree. Upward messages inform processes that + * their descendents have received all needed acknowledgements. + * Downward messages inform processes that the entire tree completed + * its acknowledgements, indicating that there are no messages in + * transit and the process can stop. + *********************************************************************** + */ +void +Connector::computeTransposeOf(const Connector& other, + const tbox::SAMRAI_MPI& mpi) +{ + *this = Connector(other.getHead(), other.getBase(), + convertHeadWidthToBase(other.getHead().getRefinementRatio(), + other.getBase().getRefinementRatio(), + other.getConnectorWidth())); + + const tbox::SAMRAI_MPI& mpi1 = mpi.hasNullCommunicator() ? getBase().getMPI() : mpi; + + // Order locally visible edges by owners who need to know about them. + typedef std::map FullNeighborhoodSet; + FullNeighborhoodSet reordered_relationships; + other.reorderRelationshipsByHead(reordered_relationships); + + /* + * We receive different types of messages from different sources + * without knowing which one is next, so we use the same MPI tag + * but differentiate messages by embedding a type in each. + */ + const int mpi_tag = 0; + char edge_msg_type = 'e'; + char ack_msg_type = 'a'; + char upward_term_msg_type = 'u'; + char downward_term_msg_type = 'd'; + + if (mpi1.hasReceivableMessage(0, MPI_ANY_SOURCE, mpi_tag)) { + TBOX_ERROR("Connector::computeTransposeOf: not starting clean of receivable MPI messages."); + } + + std::map > messages; + std::vector requests; + tbox::SAMRAI_MPI::Status tmp_status; + int mpi_err; + + // Send edge messages and remember to get receivers' acknowledgements. + std::set ack_needed; + BoxContainer unshifted_head_nabrs; + for (FullNeighborhoodSet::iterator rr = reordered_relationships.begin(); + rr != reordered_relationships.end(); ++rr) { + + const Box& base_box = rr->first; + const BoxContainer& head_nabrs = rr->second; + TBOX_ASSERT(!base_box.isPeriodicImage()); + + /* + * If base_box is local, store the neighbors. + * Else, send neighbors to base_box's owner to store. + */ + if (base_box.getOwnerRank() == mpi1.getRank()) { + insertNeighbors(head_nabrs, base_box.getBoxId()); + } else { + boost::shared_ptr& mstream = messages[base_box.getOwnerRank()]; + if (!mstream) { + mstream.reset(new tbox::MessageStream); + *mstream << edge_msg_type; + } + *mstream << base_box.getLocalId() << static_cast(head_nabrs.size()); + for (BoxContainer::const_iterator bi = head_nabrs.begin(); bi != head_nabrs.end(); ++bi) { + *mstream << *bi; + } + + FullNeighborhoodSet::iterator nextrr = rr; + ++nextrr; + if (nextrr == reordered_relationships.end() || + nextrr->first.getOwnerRank() != base_box.getOwnerRank()) { + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend((void *)mstream->getBufferStart(), + static_cast(mstream->getCurrentSize()), MPI_CHAR, + base_box.getOwnerRank(), mpi_tag, + &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + ack_needed.insert(base_box.getOwnerRank()); + } + } + } + + // Data for propagating termination messages on the rank tree. + tbox::CenteredRankTree rank_tree(mpi1); + size_t child_term_needed = rank_tree.getNumberOfChildren(); + bool send_upward_term_msg = mpi1.getSize() > 1; + + if (ack_needed.empty() && child_term_needed == 0 && send_upward_term_msg) { + // Leaves of the tree initiate upward termination message if no edge communication. + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend(&upward_term_msg_type, 1, MPI_CHAR, + rank_tree.getParentRank(), mpi_tag, + &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + send_upward_term_msg = false; + } + + /* + * Receive edge messages and propgate termination messages: Both + * communications must occur simultaneously. Don't know where the + * next message will come from, so must receive from any source. + * Process messages based on the embedded msg_type. Stop when + * there are no edge messages are in transit, indicated by the + * downward termination message. Single process execution bypasses + * communication by setting msg_type to downward termination. + */ + int msg_length = 0; + std::vector recv_buffer; + Box tmp_box(getBase().getDim()); + BoxContainer tmp_boxes; + char msg_type = mpi1.getSize() == 1 ? downward_term_msg_type : char(0); + + while (msg_type != downward_term_msg_type) { + + mpi_err = mpi1.Probe(MPI_ANY_SOURCE, mpi_tag, &tmp_status); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + tbox::SAMRAI_MPI::Get_count(&tmp_status, MPI_CHAR, &msg_length); + recv_buffer.resize(msg_length); + mpi_err = mpi1.Recv(&recv_buffer[0], msg_length, MPI_CHAR, + tmp_status.MPI_SOURCE, mpi_tag, &tmp_status); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + + tbox::MessageStream mstream(recv_buffer.size(), tbox::MessageStream::Read, + &recv_buffer[0], false); + + mstream >> msg_type; + if (msg_type == edge_msg_type) { + + // Edge messages require acknowledgement and unpacking. + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend(static_cast(&ack_msg_type), 1, MPI_CHAR, + tmp_status.MPI_SOURCE, mpi_tag, &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + do { + LocalId lid; + size_t num_nabrs; + mstream >> lid >> num_nabrs; + for (size_t i = 0; i < num_nabrs; ++i) { + mstream >> tmp_box; + tmp_boxes.insert(tmp_box); + } + insertNeighbors(tmp_boxes, BoxId(lid, mpi1.getRank())); + tmp_boxes.clear(); + } while (!mstream.endOfData()); + + } else if (msg_type == ack_msg_type) { + TBOX_ASSERT(ack_needed.find(tmp_status.MPI_SOURCE) != ack_needed.end()); + ack_needed.erase(tmp_status.MPI_SOURCE); + } else if (msg_type == upward_term_msg_type) { + TBOX_ASSERT(child_term_needed > 0); + --child_term_needed; + } else if (msg_type == downward_term_msg_type) { + TBOX_ASSERT(child_term_needed == 0); + // Propagate termination message downward. + for (unsigned int ci = 0; ci < rank_tree.getNumberOfChildren(); ++ci) { + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend(&downward_term_msg_type, 1, MPI_CHAR, + rank_tree.getChildRank(ci), mpi_tag, + &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + } + } else { + TBOX_ERROR( + "Connector::computeTransposeOf: Library error: msg_type " + << static_cast(msg_type) + << + " unrecognized,\npossibly due to receiving unrelated message."); + } + TBOX_ASSERT(mstream.endOfData()); + + if (ack_needed.empty() && child_term_needed == 0 && send_upward_term_msg) { + if (rank_tree.isRoot()) { + // Initiate downward termination message. + for (unsigned int ci = 0; ci < rank_tree.getNumberOfChildren(); ++ci) { + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend(&downward_term_msg_type, 1, MPI_CHAR, + rank_tree.getChildRank(ci), mpi_tag, + &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + } + msg_type = downward_term_msg_type; + } else { + // Propagate upward termination message. + requests.push_back(tbox::SAMRAI_MPI::Request()); + mpi_err = mpi1.Isend(&upward_term_msg_type, 1, MPI_CHAR, + rank_tree.getParentRank(), mpi_tag, + &requests.back()); + TBOX_ASSERT(mpi_err == MPI_SUCCESS); + } + send_upward_term_msg = false; + } + + recv_buffer.clear(); + } + + if (!requests.empty()) { + // Complete sends before allowing memory deallocation. + std::vector statuses(requests.size()); + tbox::SAMRAI_MPI::Waitall(static_cast(requests.size()), &requests[0], &statuses[0]); + } + + if (mpi1.hasReceivableMessage(0, MPI_ANY_SOURCE, mpi_tag)) { + TBOX_ERROR("Connector::computeTransposeOf: not finishing clean of receivable MPI messages."); + } +} + +/* + *********************************************************************** + * This method does 2 important things with the edges: + * + * 1. It puts the edge data in head-major order so the base owners can + * easily loop through the head--->base edges in the same order that + * head owners see them. + * + * 2. It shifts periodic image head Boxes back to the zero-shift + * position, and applies a similar shift to base Boxes so that the + * overlap is unchanged. + *********************************************************************** + */ +void +Connector::reorderRelationshipsByHead( + std::map& relationships_by_head) const +{ + const tbox::Dimension& dim(getBase().getDim()); + + const BoxLevel& base_box_level = getBase(); + const IntVector& base_ratio = getBase().getRefinementRatio(); + const IntVector& head_ratio = getHead().getRefinementRatio(); + + const PeriodicShiftCatalog& shift_catalog = + base_box_level.getGridGeometry()->getPeriodicShiftCatalog(); + + Box shifted_box(dim), unshifted_nabr(dim); + relationships_by_head.clear(); + for (Connector::ConstNeighborhoodIterator ci = begin(); ci != end(); ++ci) { + const Box& base_box = *base_box_level.getBoxStrict(*ci); + for (Connector::ConstNeighborIterator na = begin(ci); na != end(ci); ++na) { + const Box& nabr = *na; + if (nabr.isPeriodicImage()) { + shifted_box.initialize( + base_box, + shift_catalog.getOppositeShiftNumber(nabr.getPeriodicId()), + base_ratio, + shift_catalog); + unshifted_nabr.initialize( + nabr, + shift_catalog.getZeroShiftNumber(), + head_ratio, + shift_catalog); + relationships_by_head[unshifted_nabr].insert(shifted_box); + } else { + relationships_by_head[nabr].insert(base_box); + } + } + } +} + /* *********************************************************************** *********************************************************************** @@ -399,8 +792,8 @@ Connector::acquireRemoteNeighborhoods() std::vector send_mesg; std::vector recv_mesg; /* - * Pack relationships from all mapped_box_level relationship sets into a single message. - * Note that each mapped_box_level relationship set object packs the size of its + * Pack relationships from all box_level relationship sets into a single message. + * Note that each box_level relationship set object packs the size of its * sub-message into send_mesg. */ acquireRemoteNeighborhoods_pack(send_mesg); @@ -424,7 +817,7 @@ Connector::acquireRemoteNeighborhoods() proc_offset[n] = totl_size; totl_size += recv_mesg_size[n]; } - recv_mesg.resize(totl_size, BAD_INT); + recv_mesg.resize(totl_size, tbox::MathUtilities::getMax()); mpi.Allgatherv(&send_mesg[0], send_mesg_size, MPI_INT, @@ -451,8 +844,9 @@ Connector::acquireRemoteNeighborhoods_pack( std::vector& send_mesg) const { const tbox::Dimension& dim = getBase().getDim(); - d_relationships.putToIntBuffer(send_mesg, dim, BAD_INT); - return; + d_relationships.putToIntBuffer(send_mesg, + dim, + tbox::MathUtilities::getMax()); } /* @@ -475,7 +869,6 @@ Connector::acquireRemoteNeighborhoods_unpack( dim, num_procs, rank); - return; } /* @@ -494,12 +887,6 @@ Connector::setParallelState( << "an unfinalized Connector. See Connector::finalizeContext()"); } #endif - if (parallel_state != BoxLevel::DISTRIBUTED && parallel_state != - BoxLevel::GLOBALIZED) { - TBOX_ERROR("Connector::setParallelState: Invalid distribution state: " - << parallel_state << "\n"); - } - if (d_parallel_state == BoxLevel::DISTRIBUTED && parallel_state == BoxLevel::GLOBALIZED) { acquireRemoteNeighborhoods(); @@ -519,13 +906,18 @@ Connector::finalizeContext() { TBOX_ASSERT(d_base_handle); TBOX_ASSERT(d_head_handle); - TBOX_ASSERT(d_base_width.getDim().isValid()); const BoxLevel& base = d_base_handle->getBoxLevel(); const BoxLevel& head = d_head_handle->getBoxLevel(); const IntVector& baseRefinementRatio = base.getRefinementRatio(); const IntVector& headRefinementRatio = head.getRefinementRatio(); +#ifdef DEBUG_CHECK_ASSERTIONS + if (!base.getMPI().isCongruentWith(head.getMPI())) { + TBOX_ERROR("Connector::finalizeContext()\n" + "base and head MPI communicators must be congruent."); + } +#endif if (base.getGridGeometry() != head.getGridGeometry()) { TBOX_ERROR("Connector::finalizeContext():\n" << "Connector must be finalized with\n" @@ -535,7 +927,7 @@ Connector::finalizeContext() baseRefinementRatio <= headRefinementRatio)) { TBOX_ERROR("Connector::finalizeContext():\n" << "Refinement ratio between base and head box_levels\n" - << "cannot be mixed (bigger in some dimension and\n" + << "cannot be mixed (bigger in some direction and\n" << "smaller in others).\n" << "Input base ratio = " << baseRefinementRatio << "\n" @@ -568,7 +960,7 @@ Connector::finalizeContext() TBOX_ERROR( "Exiting due to errors." << "\nConnector::finalizeContext base box_level:\n" - << base.format(dbgbord, 2)); + << base.format()); } #endif computeRatioInfo( @@ -580,8 +972,7 @@ Connector::finalizeContext() if (d_parallel_state == BoxLevel::DISTRIBUTED) { d_global_relationships.clear(); - } - else { + } else { if (&d_relationships != &d_global_relationships) { d_global_relationships = d_relationships; } @@ -595,7 +986,6 @@ Connector::finalizeContext() d_base_handle->getBoxLevel().getMPI().getRank()); d_finalized = true; - return; } /* @@ -618,7 +1008,6 @@ Connector::setBase( if (finalize_context) { finalizeContext(); } - return; } /* @@ -640,7 +1029,6 @@ Connector::setHead( if (finalize_context) { finalizeContext(); } - return; } /* @@ -654,15 +1042,28 @@ Connector::setWidth( { if (!(new_width >= IntVector::getZero(new_width.getDim()))) { TBOX_ERROR("Connector::setWidth():\n" - << "Invalid ghost cell width: " + << "Invalid connector width: " << new_width << "\n"); } + d_finalized = false; d_base_width = new_width; + size_t num_blocks = + d_base_handle->getBoxLevel().getGridGeometry()->getNumberBlocks(); + + if (d_base_width.getNumBlocks() == 1 && num_blocks != 1) { + if (d_base_width.max() == d_base_width.min()) { + d_base_width = IntVector(d_base_width, num_blocks); + } else { + TBOX_ERROR("Connector::setWidth: new anisotropic connector\n" + << "width " << d_base_width << " must be \n" + << "defined for " << num_blocks << " blocks.\n"); + } + } + if (finalize_context) { finalizeContext(); } - return; } /* @@ -682,8 +1083,7 @@ Connector::computeRatioInfo( ratio = headRefinementRatio / baseRefinementRatio; head_coarser = false; ratio_is_exact = (ratio * baseRefinementRatio) == headRefinementRatio; - } - else { + } else { ratio = baseRefinementRatio / headRefinementRatio; head_coarser = true; ratio_is_exact = (ratio * headRefinementRatio) == baseRefinementRatio; @@ -694,7 +1094,6 @@ Connector::computeRatioInfo( ratio = -headRefinementRatio * baseRefinementRatio; ratio_is_exact = true; } - return; } /* @@ -719,7 +1118,6 @@ Connector::writeNeighborhoodsToErrorStream( << box.numberCells() << '\n'; } } - return; } /* @@ -727,12 +1125,12 @@ Connector::writeNeighborhoodsToErrorStream( *********************************************************************** */ void -Connector::writeNeighborhoodToErrorStream( +Connector::writeNeighborhoodToStream( + std::ostream& os, const BoxId& box_id) const { const BoxNeighborhoodCollection& relationships = getRelations(box_id); - BoxId non_per_id(box_id.getGlobalId(), - PeriodicId::zero()); + BoxId non_per_id(box_id.getGlobalId(), PeriodicId::zero()); ConstNeighborhoodIterator ei = relationships.find(non_per_id); if (ei == relationships.end()) { TBOX_ERROR("Connector::find: No neighbor set exists for\n" @@ -741,11 +1139,8 @@ Connector::writeNeighborhoodToErrorStream( for (ConstNeighborIterator bi = relationships.begin(ei); bi != relationships.end(ei); ++bi) { const Box& box = *bi; - tbox::perr << " " - << box << " " - << box.numberCells() << '\n'; + os << " " << box << " " << box.numberCells() << '\n'; } - return; } /* @@ -753,84 +1148,160 @@ Connector::writeNeighborhoodToErrorStream( *********************************************************************** */ -void -Connector::initializeToLocalTranspose( - const Connector& connector) +Connector * +Connector::createLocalTranspose() const { - const IntVector my_gcw = convertHeadWidthToBase( - connector.getHead().getRefinementRatio(), - connector.getBase().getRefinementRatio(), - connector.getConnectorWidth()); + const IntVector transpose_width = convertHeadWidthToBase( + getHead().getRefinementRatio(), + getBase().getRefinementRatio(), + getConnectorWidth()); - clearNeighborhoods(); - setBase(connector.d_head_handle->getBoxLevel()); - setHead(connector.d_base_handle->getBoxLevel()); - setWidth(my_gcw, true); - TBOX_ASSERT(isTransposeOf(connector)); + Connector* transpose = new Connector(getHead(), getBase(), transpose_width); + doLocalTransposeWork(transpose); + return transpose; +} + +/* + *********************************************************************** + *********************************************************************** + */ - const tbox::Dimension dim(my_gcw.getDim()); - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(dim); +Connector * +Connector::createTranspose() const +{ + Connector* transpose = + new Connector(getHead(), + getBase(), + convertHeadWidthToBase(getBase().getRefinementRatio(), + getHead().getRefinementRatio(), + getConnectorWidth())); + + doTransposeWork(transpose); + return transpose; +} + +/* + *********************************************************************** + *********************************************************************** + */ + +void +Connector::doLocalTransposeWork( + Connector* transpose) const +{ + TBOX_ASSERT(transpose); + TBOX_ASSERT(isTransposeOf(*transpose)); + + const PeriodicShiftCatalog& shift_catalog = + getBase().getGridGeometry()->getPeriodicShiftCatalog(); - for (ConstNeighborhoodIterator ci = connector.begin(); - ci != connector.end(); ++ci) { + for (ConstNeighborhoodIterator ci = begin(); ci != end(); ++ci) { - const BoxId& mapped_box_id = *ci; - const BoxContainer::const_iterator ni = getHead().getBox(mapped_box_id); - if (ni == getHead().getBoxes().end()) { + const BoxId& box_id = *ci; + const BoxContainer::const_iterator ni = transpose->getHead().getBox(box_id); + if (ni == transpose->getHead().getBoxes().end()) { TBOX_ERROR( - "Connector::initializeToLocalTranspose: mapped_box index\n" - << mapped_box_id - << " not found in local part of head mapped_box_level.\n" - << "This means that the incoming Connector data was not a\n" + "Connector::createLocalTranspose: box index\n" + << box_id + << " not found in local part of head box_level.\n" + << "This means that the Connector data was not a\n" << "self-consistent local mapping.\n"); } - const Box& my_head_mapped_box = *ni; + const Box& my_head_box = *ni; - for (ConstNeighborIterator na = connector.begin(ci); - na != connector.end(ci); ++na) { - const Box& my_base_mapped_box = *na; - if (my_base_mapped_box.getOwnerRank() != getMPI().getRank()) { + for (ConstNeighborIterator na = begin(ci); na != end(ci); ++na) { + const Box& my_base_box = *na; + if (my_base_box.getOwnerRank() != transpose->getMPI().getRank()) { TBOX_ERROR( - "Connector::initializeToLocalTranspose: base mapped_box " - << my_head_mapped_box << "\n" - << "has remote neighbor " << my_base_mapped_box + "Connector::createLocalTranspose: base box " + << my_head_box << "\n" + << "has remote neighbor " << my_base_box << " which is disallowed.\n" - << "Mapped_boxes must have only local neighbors in this method."); + << "Boxes must have only local neighbors in this method."); } - if (my_base_mapped_box.isPeriodicImage()) { - Box my_shifted_head_mapped_box( - my_head_mapped_box, - shift_catalog->getOppositeShiftNumber( - my_base_mapped_box.getPeriodicId()), - getHead().getRefinementRatio()); - if (getHead().hasBox(my_shifted_head_mapped_box)) { + if (my_base_box.isPeriodicImage()) { + Box my_shifted_head_box( + my_head_box, + shift_catalog.getOppositeShiftNumber( + my_base_box.getPeriodicId()), + transpose->getHead().getRefinementRatio(), + shift_catalog); + if (transpose->getHead().hasBox(my_shifted_head_box)) { BoxId base_non_per_id( - my_base_mapped_box.getGlobalId(), + my_base_box.getGlobalId(), PeriodicId::zero()); - d_relationships.insert( + transpose->d_relationships.insert( base_non_per_id, - my_shifted_head_mapped_box); + my_shifted_head_box); } } else { - d_relationships.insert( - my_base_mapped_box.getId(), - my_head_mapped_box); + transpose->d_relationships.insert( + my_base_box.getBoxId(), + my_head_box); } } } if (0) { - tbox::perr << "end of initializeToLocalTranspose:\n" - << "base:\n" << getBase().format("BASE->", 3) - << "head:\n" << getHead().format("HEAD->", 3) - << "this:\n" << format("THIS->", 3) - << "r:\n" << connector.format("RRRR->", 3) + tbox::perr << "end of createLocalTranspose:\n" + << "base:\n" << transpose->getBase().format("BASE->", 3) + << "head:\n" << transpose->getHead().format("HEAD->", 3) + << "this:\n" << transpose->format("RRRR->", 3) + << "r:\n" << format("THIS->", 3) << "Checking this transpose correctness:" << std::endl; - assertTransposeCorrectness(connector, false); + transpose->assertTransposeCorrectness(*this, false); tbox::perr << "Checking r's transpose correctness:" << std::endl; - connector.assertTransposeCorrectness(*this, false); + assertTransposeCorrectness(*transpose, false); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ + +void +Connector::doTransposeWork(Connector* transpose) const +{ + TBOX_ASSERT(transpose); + TBOX_ASSERT(isTransposeOf(*transpose)); + + const tbox::Dimension dim(getBase().getDim()); + + const Connector* globalized = + (d_parallel_state == BoxLevel::GLOBALIZED) ? + this : makeGlobalizedCopy(*this); + + const BoxLevel& globalized_base = getBase().getGlobalizedVersion(); + const BoxContainer& globalized_boxes = globalized_base.getGlobalBoxes(); + + for (BoxNeighborhoodCollection::ConstIterator ni = globalized->d_global_relationships.begin(); + ni != globalized->d_global_relationships.end(); ++ni) { + + for (Connector::ConstNeighborIterator na = begin(ni); na != end(ni); ++na) { + if (na->getOwnerRank() == globalized_base.getMPI().getRank()) { + if (!na->isPeriodicImage()) { + TBOX_ASSERT(getHead().hasBox(*na)); + transpose->insertLocalNeighbor( + *globalized_boxes.find(Box(dim, *ni)), + na->getBoxId()); + } else { + // Need to do shifting. + TBOX_ERROR("Unfinished Code!!!"); + } + } + } + + } + + if (globalized != this) { + delete globalized; + globalized = 0; + } + + if (0) { + TBOX_ASSERT(checkTransposeCorrectness(*transpose)); } } @@ -924,22 +1395,34 @@ IntVector Connector::convertHeadWidthToBase( const IntVector& base_refinement_ratio, const IntVector& head_refinement_ratio, - const IntVector& head_gcw) + const IntVector& head_width) { if (!(base_refinement_ratio >= head_refinement_ratio || base_refinement_ratio <= head_refinement_ratio)) { TBOX_ERROR("Connector::convertHeadWidthToBase:\n" - << "head mapped_box_level must be either\n" + << "head box_level must be either\n" << "finer or coarser than base.\n" << "Combined refinement and coarsening not allowed."); } tbox::Dimension dim(head_refinement_ratio.getDim()); + const size_t num_blocks = base_refinement_ratio.getNumBlocks(); + + IntVector tmp_head_width(head_width); + if (tmp_head_width.getNumBlocks() == 1 && num_blocks != 1) { + if (tmp_head_width.max() == tmp_head_width.min()) { + tmp_head_width = IntVector(tmp_head_width, num_blocks); + } else { + TBOX_ERROR("Connector::convertHeadWidthToBase: anisotropic connector\n" + << "width " << head_width << " must be \n" + << "defined for " << num_blocks << " blocks.\n"); + } + } IntVector ratio(dim); // Ratio between head and base. - if (head_refinement_ratio * base_refinement_ratio > - IntVector::getZero(dim)) { + if ((head_refinement_ratio > IntVector::getZero(dim)) == + (base_refinement_ratio > IntVector::getZero(dim))) { // Same signs for both ratios -> simple to compute head-base ratio. if (base_refinement_ratio >= head_refinement_ratio) { ratio = base_refinement_ratio / head_refinement_ratio; @@ -954,7 +1437,7 @@ Connector::convertHeadWidthToBase( const IntVector base_width = (base_refinement_ratio >= head_refinement_ratio) ? - (head_gcw * ratio) : IntVector::ceilingDivide(head_gcw, ratio); + (tmp_head_width * ratio) : IntVector::ceilingDivide(tmp_head_width, ratio); return base_width; } @@ -979,7 +1462,7 @@ Connector::recursivePrint( return; } bool head_coarser = d_head_coarser; - const IntVector head_gcw = + const IntVector head_width = convertHeadWidthToBase( getHead().getRefinementRatio(), getBase().getRefinementRatio(), @@ -987,7 +1470,8 @@ Connector::recursivePrint( os << border << "Parallel state : " << (getParallelState() == BoxLevel::DISTRIBUTED ? "DIST" : "GLOB") << '\n' - << border << "Rank,nproc : " << getMPI().getRank() << ", " << getMPI().getSize() << '\n' + << border << "Rank,nproc : " << getMPI().getRank() << ", " << getMPI().getSize() + << '\n' << border << "Base,head objects :" << " (" << (d_base_handle == d_head_handle ? "same" : "different") << ") " @@ -998,25 +1482,25 @@ Connector::recursivePrint( << getHead().getRefinementRatio() << ", " << d_ratio << (d_head_coarser ? " (head coarser)" : "") << '\n' << border << "Base,head widths : " << d_base_width << ", " - << head_gcw << '\n' + << head_width << '\n' << border << "Box count : " << getBase().getLocalNumberOfBoxes() << " (" << getLocalNumberOfNeighborSets() << " with neighbor lists)\n" ; if (detail_depth > 0) { - os << border << "Mapped_boxes with neighbors:\n"; + os << border << "Boxes with neighbors:\n"; for (ConstNeighborhoodIterator ei = begin(); ei != end(); ++ei) { const BoxId& box_id = *ei; BoxContainer::const_iterator ni = getBase().getBox(box_id); if (ni != getBase().getBoxes().end()) { os << border << " " << (*ni) << "_" - << (*ni).numberCells() << '\n'; + << (*ni).numberCells(); } else { os << border << " #" << box_id - << ": INVALID DATA WARNING: No base box with this index!\n"; + << ": INVALID DATA WARNING: No base box with this index!"; } - os << border << " Neighbors (" << numLocalNeighbors(box_id) << "):" + os << " has " << numLocalNeighbors(box_id) << " neighbors:" << ((detail_depth > 1) ? "\n" : " ...\n"); if (detail_depth > 1) { for (ConstNeighborIterator i_nabr = begin(ei); @@ -1028,22 +1512,25 @@ Connector::recursivePrint( Box ovlap = *i_nabr; if (ni->getBlockId() != i_nabr->getBlockId()) { d_base_handle->getBoxLevel().getGridGeometry()-> - transformBox( - ovlap, - d_head_handle->getBoxLevel().getRefinementRatio(), - ni->getBlockId(), - i_nabr->getBlockId()); + transformBox( + ovlap, + d_head_handle->getBoxLevel().getRefinementRatio(), + ni->getBlockId(), + i_nabr->getBlockId()); } - if (head_coarser) { - ovlap.refine(d_ratio); - } - else if (d_ratio != 1) { - ovlap.coarsen(d_ratio); + if (ovlap.getBlockId() != ni->getBlockId()) { + os << "\tov undefined (non-touching blocks."; + } else { + if (head_coarser) { + ovlap.refine(d_ratio); + } else if (d_ratio != 1) { + ovlap.coarsen(d_ratio); + } + Box ghost_box = (*ni); + ghost_box.grow(d_base_width); + ovlap = ovlap * ghost_box; + os << "\tov" << ovlap << "_" << ovlap.numberCells(); } - Box ghost_box = (*ni); - ghost_box.grow(d_base_width); - ovlap = ovlap * ghost_box; - os << "\tov" << ovlap << "_" << ovlap.numberCells(); } os << '\n'; } @@ -1081,11 +1568,10 @@ operator << ( std::ostream& os, const Connector::Outputter& format) { - if ( format.d_output_statistics ) { + if (format.d_output_statistics) { ConnectorStatistics cs(format.d_conn); cs.printNeighborStats(os, format.d_border); - } - else { + } else { format.d_conn.recursivePrint(os, format.d_border, format.d_detail_depth); } return os; @@ -1096,7 +1582,7 @@ operator << ( *********************************************************************** */ -Connector* +Connector * Connector::makeGlobalizedCopy( const Connector& other) const { @@ -1140,7 +1626,7 @@ Connector::assertTransposeCorrectness( * * This method does not check whether the Connectors are defined to * form logical transposes (based on their widths and their base and - * head mapped_box_levels). For that, see isTransposeOf(). + * head box_levels). For that, see isTransposeOf(). * *********************************************************************** */ @@ -1158,25 +1644,24 @@ Connector::checkTransposeCorrectness( const BoxLevel& head = getHead().getGlobalizedVersion(); - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(dim); + const PeriodicShiftCatalog& shift_catalog = + head.getGridGeometry()->getPeriodicShiftCatalog(); /* * Check for extraneous relationships. * For every relationship in this, there should be reverse relationship in transpose. */ - Box shifted_mapped_box(dim); // Shifted version of an unshifted Box. - Box unshifted_mapped_box(dim); // Unhifted version of a shifted Box. + Box shifted_box(dim); // Shifted version of an unshifted Box. + Box unshifted_box(dim); // Unhifted version of a shifted Box. size_t err_count = 0; - const BoxNeighborhoodCollection& tran_relationships = transpose->getGlobalNeighborhoodSets(); for (ConstNeighborhoodIterator ci = begin(); ci != end(); ++ci) { - const BoxId& mapped_box_id = *ci; - const Box& mapped_box = *getBase().getBox(mapped_box_id); + const BoxId& box_id = *ci; + const Box& box = *getBase().getBox(box_id); size_t err_count_for_current_index = 0; @@ -1199,7 +1684,7 @@ Connector::checkTransposeCorrectness( if (cn == tran_relationships.end()) { tbox::perr << "\nConnector::checkTransposeCorrectness:\n" - << "Local mapped_box " << mapped_box + << "Local box " << box << " has relationship to " << nabr << " but " << nabr << " has no relationship container.\n"; ++err_count_for_current_index; @@ -1210,21 +1695,22 @@ Connector::checkTransposeCorrectness( bool nabr_has_box; if (nabr.isPeriodicImage()) { - shifted_mapped_box.initialize( - mapped_box, - shift_catalog->getOppositeShiftNumber(nabr.getPeriodicId()), - getBase().getRefinementRatio()); + shifted_box.initialize( + box, + shift_catalog.getOppositeShiftNumber(nabr.getPeriodicId()), + getBase().getRefinementRatio(), + shift_catalog); nabr_has_box = - tran_relationships.hasNeighbor(cn, shifted_mapped_box); + tran_relationships.hasNeighbor(cn, shifted_box); } else { - nabr_has_box = tran_relationships.hasNeighbor(cn, mapped_box); + nabr_has_box = tran_relationships.hasNeighbor(cn, box); } if (!nabr_has_box) { tbox::perr << "\nConnector::checkTransposeCorrectness:\n" - << "Local mapped_box " << mapped_box; + << "Local box " << box; if (nabr.isPeriodicImage()) { - tbox::perr << " (shifted version " << shifted_mapped_box << ")"; + tbox::perr << " (shifted version " << shifted_box << ")"; } tbox::perr << " has relationship to " << nabr << " but " << nabr << " does not have the reverse relationship.\n" @@ -1241,7 +1727,7 @@ Connector::checkTransposeCorrectness( } if (err_count_for_current_index > 0) { - tbox::perr << "Mapped_box " << mapped_box << " had " + tbox::perr << "Box " << box << " had " << err_count_for_current_index << " errors. Neighbors are:\n"; for (ConstNeighborIterator nj = begin(ci); nj != end(ci); ++nj) { @@ -1261,14 +1747,14 @@ Connector::checkTransposeCorrectness( for (ConstNeighborhoodIterator ci = tran_relationships.begin(); ci != tran_relationships.end(); ++ci) { - const BoxId& mapped_box_id = *ci; + const BoxId& box_id = *ci; size_t err_count_for_current_index = 0; - if (!head.hasBox(mapped_box_id)) { - TBOX_ASSERT(head.hasBox(mapped_box_id)); + if (!head.hasBox(box_id)) { + TBOX_ASSERT(head.hasBox(box_id)); } - const Box& head_mapped_box = *head.getBoxStrict(mapped_box_id); + const Box& head_box = *head.getBoxStrict(box_id); for (ConstNeighborIterator na = tran_relationships.begin(ci); na != tran_relationships.end(ci); ++na) { @@ -1283,12 +1769,12 @@ Connector::checkTransposeCorrectness( if (!getBase().hasBox(nabr)) { tbox::perr << "\nConnector::checkTransposeCorrectness:\n" - << "Head mapped_box " << head_mapped_box + << "Head box " << head_box << " has neighbor " << nabr << "\n" << " but the neighbor does not exist " - << "in the base mapped_box_level.\n"; - tbox::perr << "Neighbors of head mapped_box " - << mapped_box_id << " are:\n"; + << "in the base box_level.\n"; + tbox::perr << "Neighbors of head box " + << box_id << " are:\n"; for (ConstNeighborIterator nj = tran_relationships.begin(ci); nj != tran_relationships.end(ci); ++nj) { tbox::perr << " " << *nj << std::endl; @@ -1297,23 +1783,21 @@ Connector::checkTransposeCorrectness( continue; } - const Box& base_mapped_box = *getBase().getBoxStrict(nabr); + const Box& base_box = *getBase().getBoxStrict(nabr); /* * Non-periodic BoxId needed for NeighborhoodSet::find() */ - BoxId base_non_per_id(base_mapped_box.getGlobalId(), - PeriodicId::zero()); + BoxId base_non_per_id(base_box.getGlobalId(), PeriodicId::zero()); if (!d_relationships.isBaseBox(base_non_per_id)) { tbox::perr << "\nConnector::checkTransposeCorrectness:\n" - << "Head mapped_box " << head_mapped_box << "\n" - << " has base mapped_box " - << base_mapped_box << " as a neighbor.\n" - << "But " << base_mapped_box + << "Head box " << head_box << "\n" + << " has base box " + << base_box << " as a neighbor.\n" + << "But " << base_box << " has no neighbor container.\n"; - tbox::perr << "Neighbors of head mapped_box " << BoxId( - mapped_box_id) + tbox::perr << "Neighbors of head box " << BoxId(box_id) << ":" << std::endl; for (ConstNeighborIterator nj = tran_relationships.begin(ci); nj != tran_relationships.end(ci); ++nj) { @@ -1323,32 +1807,33 @@ Connector::checkTransposeCorrectness( continue; } - const Box nabr_nabr(dim, mapped_box_id.getGlobalId(), - shift_catalog->getOppositeShiftNumber( - base_mapped_box.getPeriodicId())); + const Box nabr_nabr(dim, box_id.getGlobalId(), + shift_catalog.getOppositeShiftNumber( + base_box.getPeriodicId())); if (!d_relationships.hasNeighbor(base_non_per_id, nabr_nabr)) { tbox::perr << "\nConnector::checkTransposeCorrectness:\n" - << "Head mapped_box " << head_mapped_box << "\n" - << " has base mapped_box " << base_mapped_box + << "Head box " << head_box << "\n" + << " has base box " << base_box << " as a neighbor.\n" - << "But base mapped_box " << base_mapped_box - << " does not have a mapped_box indexed " - << nabr_nabr.getId() + << "But base box " << base_box + << " does not have a box indexed " + << nabr_nabr.getBoxId() << " in its neighbor list." << std::endl; - tbox::perr << "Neighbors of head mapped_box " << nabr_nabr.getId() + tbox::perr << "Neighbors of head box " << nabr_nabr.getBoxId() << ":" << std::endl; for (ConstNeighborIterator nj = tran_relationships.begin(ci); nj != tran_relationships.end(ci); ++nj) { tbox::perr << " " << *nj << std::endl; } - tbox::perr << "Neighbors of base mapped_box "; + tbox::perr << "Neighbors of base box "; if (nabr.isPeriodicImage()) { - unshifted_mapped_box.initialize( + unshifted_box.initialize( nabr, - shift_catalog->getZeroShiftNumber(), - getBase().getRefinementRatio()); - tbox::perr << unshifted_mapped_box; + shift_catalog.getZeroShiftNumber(), + getBase().getRefinementRatio(), + shift_catalog); + tbox::perr << unshifted_box; } tbox::perr << ":" << std::endl; ConstNeighborhoodIterator nabr_nabrs_ = @@ -1376,7 +1861,9 @@ Connector::checkTransposeCorrectness( } int global_err_count = static_cast(err_count); - getBase().getMPI().AllReduce( &global_err_count, 1, MPI_SUM ); + if (getMPI().getSize() > 1) { + getMPI().AllReduce(&global_err_count, 1, MPI_SUM); + } return static_cast(global_err_count); } @@ -1392,13 +1879,13 @@ Connector::checkConsistencyWithBase() const size_t num_errors = 0; for (ConstNeighborhoodIterator i_relationships = begin(); i_relationships != end(); ++i_relationships) { - const BoxId& mapped_box_id = *i_relationships; - if (!getBase().hasBox(mapped_box_id)) { + const BoxId& box_id = *i_relationships; + if (!getBase().hasBox(box_id)) { ++num_errors; tbox::plog << "ERROR->" - << "Connector::assertConsistencyWithBase: Neighbor data given " - << "\nfor mapped_box " << mapped_box_id - << " but the mapped_box does not exist.\n"; + << "Connector::checkConsistencyWithBase: Neighbor data given " + << "\nfor box " << box_id + << " but the box does not exist.\n"; } } return num_errors; @@ -1414,8 +1901,10 @@ Connector::assertConsistencyWithBase() const { if (checkConsistencyWithBase() > 0) { TBOX_ERROR( - "Connector::assertConsistencyWithBase() found inconsistencies.\n" - << "Base mapped box level:\n" << getBase().format("ERROR->", 2)); + "Connector::assertConsistencyWithHead() found inconsistencies.\n" + << "Base BoxLevel:\n" << getBase().format("base-> ", 3) + << "Head BoxLevel:\n" << getHead().format("head-> ", 3) + << "Connector:\n" << format("E-> ", 3)); } } @@ -1426,54 +1915,57 @@ Connector::assertConsistencyWithBase() const void Connector::computeNeighborhoodDifferences( - Connector& left_minus_right, + boost::shared_ptr& left_minus_right, const Connector& left, const Connector& right) { if (0) { - tbox::plog << "Computing relationship differences, a:\n" << left.format(dbgbord, 3) - << "Computing relationship differences, b:\n" << right.format(dbgbord, 3); + tbox::plog << "Computing relationship differences, a:\n" << left.format("A-> ") + << "Computing relationship differences, b:\n" << right.format("B-> "); } - left_minus_right.clearNeighborhoods(); - left_minus_right.d_parallel_state = left.getParallelState(); - left_minus_right.setBase(left.d_base_handle->getBoxLevel()); - left_minus_right.setHead(left.d_head_handle->getBoxLevel()); - left_minus_right.setWidth(left.d_base_width, true); + left_minus_right.reset(new Connector(left.d_base_handle->getBoxLevel(), + left.d_head_handle->getBoxLevel(), + left.d_base_width, + left.getParallelState())); for (ConstNeighborhoodIterator ai = left.begin(); ai != left.end(); ++ai) { - const BoxId& mapped_box_id = *ai; + const BoxId& box_id = *ai; - ConstNeighborhoodIterator bi = right.findLocal(mapped_box_id); + ConstNeighborhoodIterator bi = right.findLocal(box_id); if (bi != right.end()) { // Remove bi from ai. Put results in a_minus_b. - NeighborhoodIterator base_box_itr = - left_minus_right.makeEmptyLocalNeighborhood(mapped_box_id); - - //equivalent of stl set_difference - ConstNeighborIterator na = left.begin(ai); - ConstNeighborIterator nb = right.begin(bi); - while (na != left.end(ai) && nb != right.end(bi)) { - if (na->getId() < nb->getId()) { - left_minus_right.insertLocalNeighbor(*na, base_box_itr); - ++na; - } else if (nb->getId() < na->getId()) { - ++nb; - } else { - ++na; - ++nb; - } - } - - if (left_minus_right.isEmptyNeighborhood(mapped_box_id)) { - left_minus_right.eraseLocalNeighborhood(mapped_box_id); + + /* + * In theory, we should not have to resort to using std::set + * in order to use set_difference, but our BoxContainer does + * not implement all features necessary to use + * set_difference. + */ + std::set anabrs(left.begin(ai), left.end(ai)); + std::set bnabrs(right.begin(bi), right.end(bi)); + std::set diff; + std::insert_iterator > ii(diff, diff.begin()); + set_difference(anabrs.begin(), + anabrs.end(), + bnabrs.begin(), + bnabrs.end(), + ii, Box::id_less()); + if (!diff.empty()) { + NeighborhoodIterator base_box_itr = + left_minus_right->makeEmptyLocalNeighborhood(box_id); + for (std::set::const_iterator ii = diff.begin(); + ii != diff.end(); + ++ii) { + left_minus_right->insertLocalNeighbor(*ii, base_box_itr); + } } - } else if (left.numLocalNeighbors(mapped_box_id) != 0) { + } else if (left.numLocalNeighbors(box_id) != 0) { NeighborhoodIterator base_box_itr = - left_minus_right.makeEmptyLocalNeighborhood(mapped_box_id); + left_minus_right->makeEmptyLocalNeighborhood(box_id); for (ConstNeighborIterator na = left.begin(ai); na != left.end(ai); ++na) { - left_minus_right.insertLocalNeighbor(*na, base_box_itr); + left_minus_right->insertLocalNeighbor(*na, base_box_itr); } } @@ -1488,13 +1980,13 @@ Connector::computeNeighborhoodDifferences( void Connector::assertConsistencyWithHead() const { - const int number_of_inconsistencies = checkConsistencyWithHead(); + const size_t number_of_inconsistencies = checkConsistencyWithHead(); if (number_of_inconsistencies > 0) { TBOX_ERROR( "Connector::assertConsistencyWithHead() found inconsistencies.\n" - << getBase().format("base-> ", 3) - << getHead().format("head-> ", 3) - << format("E-> ", 3)); + << "Base BoxLevel:\n" << getBase().format("base-> ", 3) + << "Head BoxLevel:\n" << getHead().format("head-> ", 3) + << "Connector:\n" << format("E-> ", 3)); } } @@ -1506,40 +1998,44 @@ Connector::assertConsistencyWithHead() const size_t Connector::checkConsistencyWithHead() const { - const BoxLevel& head_mapped_box_level = getHead().getGlobalizedVersion(); + const BoxLevel& head_box_level = getHead().getGlobalizedVersion(); - TBOX_ASSERT(head_mapped_box_level.getParallelState() == - BoxLevel::GLOBALIZED); + TBOX_ASSERT(head_box_level.getParallelState() == BoxLevel::GLOBALIZED); - const BoxContainer& head_mapped_boxes = - head_mapped_box_level.getGlobalBoxes(); + const PeriodicShiftCatalog& shift_catalog = + head_box_level.getGridGeometry()->getPeriodicShiftCatalog(); + + const BoxContainer& head_boxes = head_box_level.getGlobalBoxes(); size_t number_of_inconsistencies = 0; /* * For each neighbor in each neighbor list, - * check that the neighbor is in the head_mapped_box_level. + * check that the neighbor is in the head_box_level. */ for (ConstNeighborhoodIterator ei = begin(); ei != end(); ++ei) { - const BoxId& mapped_box_id = *ei; + const BoxId& box_id = *ei; for (ConstNeighborIterator na = begin(ei); na != end(ei); ++na) { const Box& nabr = *na; const Box unshifted_nabr( - nabr, PeriodicId::zero(), head_mapped_box_level.getRefinementRatio()); + nabr, + PeriodicId::zero(), + head_box_level.getRefinementRatio(), + shift_catalog); BoxContainer::const_iterator na_in_head = - head_mapped_boxes.find(unshifted_nabr); + head_boxes.find(unshifted_nabr); - if (na_in_head == head_mapped_boxes.end()) { + if (na_in_head == head_boxes.end()) { tbox::perr << "\nConnector::checkConsistencyWithHead:\n" - << "Neighbor list for mapped_box " << mapped_box_id << "\n" + << "Neighbor list for box " << box_id << "\n" << "referenced nonexistent neighbor " << nabr << "\n"; - tbox::perr << "Neighbors of mapped_box " << mapped_box_id << ":\n"; + tbox::perr << "Neighbors of box " << box_id << ":\n"; for (ConstNeighborIterator nb = begin(ei); nb != end(ei); ++nb) { tbox::perr << " " << *nb << '\n'; } @@ -1551,11 +2047,11 @@ Connector::checkConsistencyWithHead() const if (!unshifted_nabr.isIdEqual(nabr_in_head) || !unshifted_nabr.isSpatiallyEqual(nabr_in_head)) { tbox::perr << "\nConnector::checkConsistencyWithHead:\n" - << "Inconsistent mapped_box data at mapped_box " - << mapped_box_id << "\n" + << "Inconsistent box data at box " + << box_id << "\n" << "Neighbor " << nabr << "(unshifted to " << unshifted_nabr << ") does not match " - << "head mapped_box " << nabr_in_head + << "head box " << nabr_in_head << "\n"; ++number_of_inconsistencies; } @@ -1566,6 +2062,576 @@ Connector::checkConsistencyWithHead() const return number_of_inconsistencies; } +/* + *********************************************************************** + * Checking is done as follows: + * - Rebuild the overlap containers using findOverlaps(). + * Note that the rebuilt overlap set is complete. + * - Check the current overlap set against the rebuilt overlap set + * to find missing overlaps and extra overlaps. + * + * Currently, the rebuilt overlaps are rebuilt using findOverlaps(). + * Thus, it may be pointless to use this method as a check for that + * method. + *********************************************************************** + */ + +void +Connector::findOverlapErrors( + boost::shared_ptr& missing, + boost::shared_ptr& extra, + bool ignore_self_overlap) const +{ +#ifdef DEBUG_CHECK_ASSERTIONS + if (!getBase().isInitialized() || !getHead().isInitialized()) { + TBOX_ERROR( + "Connector::findOverlapErrors: Cannot check overlaps\n" + << "when base or head box_level is uninitialized."); + } +#endif + + /* + * Obtain a globalized version of the head for checking. + */ + const BoxLevel& head = getHead().getGlobalizedVersion(); + +#ifdef DEBUG_CHECK_ASSERTIONS + /* + * Before checking on overlap errors, make sure the user gave a + * valid Connector. + * + * Each neighbor set should correspond to a base box. + * + * Each referenced neighbor should exist in the head. + */ + size_t num_base_consistency_errors = checkConsistencyWithBase(); + size_t num_head_consistency_errors = checkConsistencyWithHead(); + if (num_base_consistency_errors > 0) { + tbox::perr + << "Connector::findOverlapErrors: cannot check overlap errors\n" + << "for inconsistent base data.\n"; + } + if (num_head_consistency_errors > 0) { + tbox::perr + << "Connector::findOverlapErrors: cannot check overlap errors\n" + << "for inconsistent head data.\n"; + } + if (num_base_consistency_errors || num_head_consistency_errors) { + TBOX_ERROR( + "Connector::findOverlapErrors exiting due to\n" + << "inconsistent data.\n" + << "Base:\n" << getBase().format("B->", 2) + << "Head:\n" << getHead().format("H->", 2) + << "Connector:\n" << format("C->", 3)); + } +#endif + + /* + * Rebuild the overlap Connector for checking. + */ + Connector rebuilt(getBase(), getHead(), getConnectorWidth()); + rebuilt.findOverlaps_rbbt(head, ignore_self_overlap); + + /* + * Check that the rebuilt overlaps match the existing overlaps. + * + * Currently, we use findOverlaps to rebuild the overlaps. + * Thus, it may be pointless to use this method + * as a check for that method. + */ + computeNeighborhoodDifferences(extra, *this, rebuilt); + TBOX_ASSERT(&extra->getBase() == &getBase()); + TBOX_ASSERT(&extra->getHead() == &getHead()); + computeNeighborhoodDifferences(missing, rebuilt, *this); + TBOX_ASSERT(&missing->getBase() == &getBase()); + TBOX_ASSERT(&missing->getHead() == &getHead()); +} + +/* + *********************************************************************** + *********************************************************************** + */ + +void +Connector::assertOverlapCorrectness( + bool ignore_self_overlap, + bool assert_completeness, + bool ignore_periodic_images) const +{ +#ifdef DEBUG_CHECK_ASSERTIONS + if (!getBase().isInitialized() || !getHead().isInitialized()) { + TBOX_ERROR( + "Connector::assertOverlapCorrectness: Cannot check overlaps\n" + << "when base or head box_level is uninitialized."); + + } +#endif + + int local_error_count = checkOverlapCorrectness(ignore_self_overlap, + assert_completeness, + ignore_periodic_images); + + const tbox::SAMRAI_MPI& mpi(getMPI()); + int max_error_count = local_error_count; + int rank_of_max = mpi.getRank(); + if (mpi.getSize() > 1) { + IntIntStruct send, recv; + send.rank = recv.rank = mpi.getRank(); + send.i = local_error_count; + mpi.Allreduce(&send, &recv, 1, MPI_2INT, MPI_MAXLOC); + max_error_count = recv.i; + rank_of_max = recv.rank; + } + if (max_error_count > 0) { + TBOX_ERROR( + "Connector::assertOverlapCorrectness found missing and/or extra overlaps.\n" + << "Error in connector, " << local_error_count + << " local errors, " + << max_error_count << " max errors on proc " << rank_of_max + << ":\n" + << format("E-> ") + << "base:\n" << getBase().format("B-> ") + << "head:\n" << getHead().format("H-> ")); + } +} + +/* + *********************************************************************** + * Return number of missing and number of extra overlaps. + *********************************************************************** + */ + +int +Connector::checkOverlapCorrectness( + bool ignore_self_overlap, + bool assert_completeness, + bool ignore_periodic_images) const +{ +#ifdef DEBUG_CHECK_ASSERTIONS + if (!getBase().isInitialized() || !getHead().isInitialized()) { + TBOX_ERROR( + "Connector::checkOverlapCorrectness: Cannot check overlaps when\n" + << "base or head box_level is uninitialized."); + + } +#endif + TBOX_ASSERT(!hasPeriodicLocalNeighborhoodBaseBoxes()); + + boost::shared_ptr missing, extra; + findOverlapErrors(missing, extra, ignore_self_overlap); + + if (!assert_completeness) { + // Disregard missing overlaps by resetting missing to empty. + missing->clearNeighborhoods(); + } else if (ignore_periodic_images) { + // Disregard missing overlaps if they are incident on a periodic box. + missing->removePeriodicLocalNeighbors(); + missing->eraseEmptyNeighborSets(); + } + + const BoxId dummy_box_id; + + /* + * Report the errors found, ordered by the Box where the + * error appears. In order to do this, we have to loop through + * the neighborhoods of missing and extra at the same time. + */ + + Connector::ConstNeighborhoodIterator im = missing->begin(); + Connector::ConstNeighborhoodIterator ie = extra->begin(); + for ( ; im != missing->end() || ie != extra->end(); + /* incremented in loop */) { + + const BoxId& global_id_missing = + im == missing->end() ? dummy_box_id : *im; + const BoxId& global_id_extra = + ie == extra->end() ? dummy_box_id : *ie; + + if (im != missing->end() && ie != extra->end() && + *im == *ie) { + + /* + * im and ie are pointing at the same Box. Report the + * error for this Box. + */ + + const Box& box = *getBase().getBoxStrict(global_id_missing); + tbox::perr << "Found " << missing->numLocalNeighbors(*im) + << " missing and " + << extra->numLocalNeighbors(*ie) + << " extra overlaps for " + << box << std::endl; + Connector::ConstNeighborhoodIterator it = findLocal(global_id_missing); + if (it == end()) { + tbox::perr << " Current Neighbors (no neighbor set)." << std::endl; + } else { + tbox::perr << " Current Neighbors (" + << numLocalNeighbors(*it) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = begin(it); + na != end(it); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + { + tbox::perr << " Missing Neighbors (" + << missing->numLocalNeighbors(*im) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = missing->begin(im); + na != missing->end(im); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + { + tbox::perr << " Extra Neighbors (" + << extra->numLocalNeighbors(*ie) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = extra->begin(ie); + na != extra->end(ie); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + ++im; + ++ie; + + } else if ((ie == extra->end()) || + (im != missing->end() && *im < *ie)) { + + /* + * im goes before ie (or ie has reached the end). Report the + * errors for the Box at im. + */ + + const Box& box = *getBase().getBoxStrict(global_id_missing); + tbox::perr << "Found " << missing->numLocalNeighbors(*im) + << " missing overlaps for " << box << std::endl; + Connector::ConstNeighborhoodIterator it = findLocal(global_id_missing); + if (it == end()) { + tbox::perr << " Current Neighbors (no neighbor set)." + << std::endl; + } else { + tbox::perr << " Current Neighbors (" + << numLocalNeighbors(*it) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = begin(it); + na != end(it); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + { + tbox::perr << " Missing Neighbors (" + << missing->numLocalNeighbors(*im) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = missing->begin(im); + na != missing->end(im); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + ++im; + } else if ((im == missing->end()) || + (ie != extra->end() && *ie < *im)) { + + /* + * ie goes before im (or im has reached the end). Report the + * errors for the Box at ie. + */ + + const Box& box = *getBase().getBoxStrict( + global_id_extra); + tbox::perr << "Found " << extra->numLocalNeighbors(*ie) + << " extra overlaps for " << box << std::endl; + Connector::ConstNeighborhoodIterator it = findLocal(global_id_extra); + if (it == end()) { + tbox::perr << " Current Neighbors (no neighbor set)." << std::endl; + } else { + tbox::perr << " Current Neighbors (" + << numLocalNeighbors(*it) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = begin(it); + na != end(it); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + { + tbox::perr << " Extra Neighbors (" + << extra->numLocalNeighbors(*ie) << "):" + << std::endl; + Box ghost_box = box; + ghost_box.grow(getConnectorWidth()); + for (Connector::ConstNeighborIterator na = extra->begin(ie); + na != extra->end(ie); ++na) { + const Box& nabr = *na; + Box nabr_box = nabr; + if (getHeadCoarserFlag()) { + nabr_box.refine(getRatio()); + } else if (getRatio() != 1) { + nabr_box.coarsen(getRatio()); + } + if (nabr_box.getBlockId() != box.getBlockId()) { + getBase().getGridGeometry()->transformBox(nabr_box, + getBase().getRefinementRatio(), + box.getBlockId(), + nabr.getBlockId()); + } + Box ovlap = nabr_box * ghost_box; + tbox::perr << " " << nabr << '_' << nabr.numberCells() + << "\tov" << ovlap << '_' << ovlap.numberCells() + << std::endl; + } + } + ++ie; + } + + } + + return missing->getLocalNumberOfNeighborSets() + + extra->getLocalNumberOfNeighborSets(); +} + +/* + *********************************************************************** + * ignore_self_overlap should be set to true only if + * - the base and head box_levels represent the same box_level. + * Two different box_level objects may represent the same + * box_level if they are of the same refinement ratio. + * - you want to ignore overlaps between a box and itself. + *********************************************************************** + */ + +void +Connector::findOverlaps_rbbt( + const BoxLevel& head, + bool ignore_self_overlap, + bool sanity_check_method_postconditions) +{ + const tbox::Dimension dim(head.getDim()); + + t_find_overlaps_rbbt->start(); + + /* + * Finding overlaps for this object, using + * an externally provided head BoxLevel + * meant to represent d_head. We allow the + * substitution of an external head because + * we require the head is GLOBALIZED. The + * user may have a GLOBALIZED version already, + * in which case we want to avoid the expense + * of creating a temporary GLOBALIZED version. + * + * Global boxes provided by head are sorted in a BoxContainer + * so they can be quickly searched to see which intersects the + * boxes in this object. + */ + if (head.getParallelState() != BoxLevel::GLOBALIZED) { + TBOX_ERROR("Connector::findOverlaps_rbbt() requires given head\n" + << "to be GLOBALIZED.\n"); + } + + /* + * The nomenclature "base" refers to the *this box_level + * and "head" refer to the box_level in the argument. + */ + const BoxLevel& base(getBase()); + + /* + * Determine relationship between base and head index spaces. + */ + const bool head_is_finer = + head.getRefinementRatio() >= base.getRefinementRatio() && + head.getRefinementRatio() != base.getRefinementRatio(); + const bool base_is_finer = + base.getRefinementRatio() >= head.getRefinementRatio() && + base.getRefinementRatio() != head.getRefinementRatio(); + + /* + * Create single container of visible head boxes + * to generate the search tree. + */ + const BoxContainer& rbbt = head.getGlobalBoxes(); + rbbt.makeTree(head.getGridGeometry().get()); + + /* + * A neighbor of a Box would be discarded if + * - ignore_self_overlap is true, + * - the two are equal by comparison, and + * - they are from box_levels with the same refinement ratio + * (we cannot compare box box_level pointers because that + * does not work when a box box_level is a temporary globalized object) + */ + const bool discard_self_overlap = + ignore_self_overlap && + (base.getRefinementRatio() == head.getRefinementRatio()); + + /* + * Discard current overlaps (if any). + */ + clearNeighborhoods(); + + /* + * Use BoxTree to find local base Boxes intersecting head Boxes. + */ + NeighborSet nabrs_for_box; + const BoxContainer& base_boxes = base.getBoxes(); + for (RealBoxConstIterator ni(base_boxes.realBegin()); + ni != base_boxes.realEnd(); ++ni) { + + const Box& base_box = *ni; + + // Grow the base_box and put it in the head refinement ratio. + Box box = base_box; + BoxContainer grown_boxes; + + if (base.getGridGeometry()->getNumberBlocks() == 1 || + base.getGridGeometry()->hasIsotropicRatios()) { + box.grow(getConnectorWidth()); + + if (head_is_finer) { + box.refine(getRatio()); + } else if (base_is_finer) { + box.coarsen(getRatio()); + } + grown_boxes.pushBack(box); + } else { + BoxUtilities::growAndAdjustAcrossBlockBoundary(grown_boxes, + box, + base.getGridGeometry(), + base.getRefinementRatio(), + getRatio(), + getConnectorWidth(), + head_is_finer, + base_is_finer); + } + + for (BoxContainer::iterator b_itr = grown_boxes.begin(); + b_itr != grown_boxes.end(); ++b_itr) { + + // Add found overlaps to neighbor set for box. + rbbt.findOverlapBoxes(nabrs_for_box, + *b_itr, + head.getRefinementRatio(), + true); + } + if (discard_self_overlap) { + nabrs_for_box.order(); + nabrs_for_box.erase(base_box); + } + if (!nabrs_for_box.empty()) { + insertNeighbors(nabrs_for_box, base_box.getBoxId()); + nabrs_for_box.clear(); + } + + } + + if (sanity_check_method_postconditions) { + assertConsistencyWithBase(); + assertConsistencyWithHead(); + } + + t_find_overlaps_rbbt->stop(); +} + } } @@ -1576,5 +2642,3 @@ Connector::checkConsistencyWithHead() const #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.h index c7cce839..74d3e89b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Connector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Set of distributed box-graph relationships from one BoxLevel * to another. * @@ -79,59 +79,35 @@ class Connector */ typedef BoxNeighborhoodCollection::NeighborIterator NeighborIterator; - /// TODO: Possible refactor? Since Connectors do not imply relationship - // meanings, why is this even defined? The "getConnectorType function - // is never called; The individual types are never used except in - // conjunction with the "setConnectorType" function. This seems to be - // a useless enumeration producing unused code. SGH. - /*! - * @brief Types of Connectors - * - * The types describe the meaning of the relationships in a Connector. - * - * @b COMPLETE_OVERLAP: The relationships represent overlaps, and every - * overlap is represented by an relationship, including overlaps with - * periodic images. - * - * @b COMPLETE_OVERLAP_NO_PERIODIC: The relationships represent overlaps, - * and every overlap is represented by an relationship. Overlaps with - * periodic images are omitted. - * - * @b INCOMPLETE_OVERLAP: The relationships represent overlaps, but not - * all overlaps are represented. - * - * @b BASE_GENERATED: The head is generated from the base. Each - * head Box comes from a base Box and there is an relationship - * from the base Box to the head Box. - * - * @b MAPPING: relationships indicate a mapping relationship. Applying - * the map would change Connectors incident to the base into - * Connectors incident to the head. - * - * @b UNKNOWN: Meaning of relationships are unknown. + * @brief Creates an uninitialized Connector object in the + * distributed state. * - * See setConnectorType(), getConnectorType(). + * @param dim The dimension of the head and base BoxLevels that + * this object will eventually connect. * - * The Connector types are not exclusive. For example, a mapping - * Connector may also be used as an overlap Connector. + * @see setBase() + * @see setHead() + * @see setWidth() */ - enum ConnectorType { - COMPLETE_OVERLAP = 1, - COMPLETE_OVERLAP_NO_PERIODIC = 2, - INCOMPLETE_OVERLAP = 3, - BASE_GENERATED = 4, - MAPPING = 5, - UNKNOWN = 6 - }; + explicit Connector( + const tbox::Dimension& dim); /*! - * @brief Creates an uninitialized Connector object in the - * distributed state. + * @brief Creates a Connector which is initialized from a restart database. + * + * @param dim The dimension of the head and base BoxLevels that + * this object will eventually connect. * - * @see initialize() + * @param restart_db Restart Database written by a Connector. + * + * @see setBase() + * @see setHead() + * @see setWidth() */ - Connector(); + Connector( + const tbox::Dimension& dim, + tbox::Database& restart_db); /*! * @brief Copy constructor. @@ -146,21 +122,49 @@ class Connector * * The Connector's relationships are initialized to a dummy state. * - * @param[in] base_mapped_box_level - * @param[in] head_mapped_box_level + * @param[in] base_box_level + * @param[in] head_box_level * @param[in] base_width * @param[in] parallel_state + * + * @pre (base_box_level.getDim() == head_box_level.getDim()) && + * (base_box_level.getDim() == base_width.getDim()) */ Connector( - const BoxLevel& base_mapped_box_level, - const BoxLevel& head_mapped_box_level, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, const IntVector& base_width, const BoxLevel::ParallelState parallel_state = BoxLevel::DISTRIBUTED); /*! * @brief Destructor. */ - ~Connector(); + virtual ~Connector(); + + /*! + * @brief Set this to the transpose of another Connector and + * populate its edges with the other's transposed edges. + * + * This method uses communication to acquire the transpose edges. + * + * @param other [i] + * + * @param mpi SAMRAI_MPI to use for communication. If omitted, use + * the other.getBase().getMPI() by default. If specified, must be + * congruent with the default. + */ + void + computeTransposeOf( + const Connector& other, + const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)); + + /*! + * @brief Transpose the visible relationships so that they point from + * each visible head box to a set of local base boxes. + */ + void + reorderRelationshipsByHead( + std::map& relationships_by_head) const; /*! * @brief Clear the Connector, putting it into an uninitialized state. @@ -168,13 +172,12 @@ class Connector void clear() { - if ( d_base_handle ) { + if (d_base_handle) { d_relationships.clear(); d_global_relationships.clear(); - d_mpi.setCommunicator(tbox::SAMRAI_MPI::commNull); + d_mpi.setCommunicator(MPI_COMM_NULL); d_base_handle.reset(); d_head_handle.reset(); - d_base_width(0) = d_ratio(0) = 0; d_parallel_state = BoxLevel::DISTRIBUTED; } } @@ -187,7 +190,6 @@ class Connector { d_relationships.clear(); d_global_relationships.clear(); - return; } /*! @@ -257,7 +259,7 @@ class Connector NeighborhoodIterator& nbrhd) { BoxNeighborhoodCollection* tmp = - const_cast(nbrhd.d_collection); + const_cast(nbrhd.d_collection); return tmp->begin(nbrhd); } @@ -283,7 +285,7 @@ class Connector NeighborhoodIterator& nbrhd) { BoxNeighborhoodCollection* tmp = - const_cast(nbrhd.d_collection); + const_cast(nbrhd.d_collection); return tmp->end(nbrhd); } @@ -328,8 +330,7 @@ class Connector const BoxId& box_id) const { const BoxNeighborhoodCollection& relationships = getRelations(box_id); - BoxId non_per_id(box_id.getGlobalId(), - PeriodicId::zero()); + BoxId non_per_id(box_id.getGlobalId(), PeriodicId::zero()); ConstNeighborhoodIterator ei = relationships.find(non_per_id); if (ei == relationships.end()) { TBOX_ERROR("Connector::find: No neighbor set exists for\n" @@ -375,16 +376,14 @@ class Connector * @brief Return true if a neighbor set exists for the specified * BoxId. * - * @param[in] mapped_box_id + * @param[in] box_id */ bool hasNeighborSet( - const BoxId& mapped_box_id) const + const BoxId& box_id) const { - const BoxNeighborhoodCollection& relationships = - getRelations(mapped_box_id); - BoxId non_per_id(mapped_box_id.getGlobalId(), - PeriodicId::zero()); + const BoxNeighborhoodCollection& relationships = getRelations(box_id); + BoxId non_per_id(box_id.getGlobalId(), PeriodicId::zero()); ConstNeighborhoodIterator ei = relationships.find(non_per_id); return ei != relationships.end(); } @@ -395,13 +394,15 @@ class Connector * * @param[in] box_id * @param[in] neighbor + * + * @pre box_id.getOwnerRank() == getMPI().getRank() */ bool hasLocalNeighbor( const BoxId& box_id, const Box& neighbor) const { - TBOX_ASSERT( box_id.getOwnerRank() == d_mpi.getRank() ); + TBOX_ASSERT(box_id.getOwnerRank() == d_mpi.getRank()); return d_relationships.hasNeighbor(box_id, neighbor); } @@ -410,12 +411,16 @@ class Connector * * @param[in] box_id * @param[out] nbr_boxes + * + * @pre hasNeighborSet(box_id) */ void getNeighborBoxes( const BoxId& box_id, BoxContainer& nbr_boxes) const { + TBOX_ASSERT(hasNeighborSet(box_id)); + const BoxNeighborhoodCollection& relationships = getRelations(box_id); BoxId non_per_id(box_id.getGlobalId(), PeriodicId::zero()); @@ -432,7 +437,6 @@ class Connector BoxContainer& neighbors) const { d_relationships.getNeighbors(neighbors); - return; } /*! @@ -445,7 +449,6 @@ class Connector std::map& neighbors) const { d_relationships.getNeighbors(neighbors); - return; } /*! @@ -453,6 +456,8 @@ class Connector * supplied BoxId. * * @param[in] box_id + * + * @pre hasNeighborSet(box_id) */ int numLocalNeighbors( @@ -492,7 +497,6 @@ class Connector std::set& owners) const { d_relationships.getOwners(owners); - return; } /*! @@ -508,7 +512,6 @@ class Connector std::set& owners) const { d_relationships.getOwners(base_boxes_itr, owners); - return; } //@{ @@ -521,6 +524,10 @@ class Connector * * @param[in] neighbors * @param[in] base_box + * + * @pre (getParallelState() == BoxLevel::GLOBALIZED) || + * (base_box.getOwnerRank() == getMPI().getRank()) + * @pre getBase().hasBox(base_box) */ void insertNeighbors( @@ -530,29 +537,32 @@ class Connector /*! * @brief Erase neighbor of the specified BoxId. * - * @note Assertions - * It is an error to to specify a non-existent BoxId. - * * @param[in] neighbor - * @param[in] mapped_box_id + * @param[in] box_id + * + * @pre (getParallelState() == BoxLevel::GLOBALIZED) || + * (base_box.getOwnerRank() == getMPI().getRank()) + * @pre getBase().hasBox(box_id) */ void eraseNeighbor( const Box& neighbor, - const BoxId& mapped_box_id); + const BoxId& box_id); /*! * @brief Adds a neighbor of the specified BoxId. * * @param[in] neighbor * @param[in] box_id + * + * @pre box_id.getOwnerRank() == getMPI().getRank() */ void insertLocalNeighbor( const Box& neighbor, const BoxId& box_id) { - TBOX_ASSERT( box_id.getOwnerRank() == d_mpi.getRank() ); + TBOX_ASSERT(box_id.getOwnerRank() == d_mpi.getRank()); d_relationships.insert(box_id, neighbor); } @@ -561,13 +571,15 @@ class Connector * * @param[in] neighbor * @param[in] base_box_itr + * + * @pre base_box_itr->getOwnerRank() == getMPI().getRank() */ void insertLocalNeighbor( const Box& neighbor, NeighborhoodIterator& base_box_itr) { - TBOX_ASSERT( base_box_itr->getOwnerRank() == d_mpi.getRank() ); + TBOX_ASSERT(base_box_itr->getOwnerRank() == d_mpi.getRank()); d_relationships.insert(base_box_itr, neighbor); } @@ -575,12 +587,14 @@ class Connector * @brief Erases the neighborhood of the specified BoxId. * * @param[in] box_id + * + * @pre box_id.getOwnerRank() == getMPI().getRank() */ void eraseLocalNeighborhood( const BoxId& box_id) { - TBOX_ASSERT( box_id.getOwnerRank() == d_mpi.getRank() ); + TBOX_ASSERT(box_id.getOwnerRank() == d_mpi.getRank()); d_relationships.erase(box_id); } @@ -594,7 +608,6 @@ class Connector if (d_parallel_state == BoxLevel::GLOBALIZED) { d_global_relationships.erasePeriodicNeighbors(); } - return; } /*! @@ -604,7 +617,6 @@ class Connector removePeriodicLocalNeighbors() { d_relationships.erasePeriodicNeighbors(); - return; } /*! @@ -629,12 +641,14 @@ class Connector * @brief Make an empty set of neighbors of the supplied box_id. * * @param[in] box_id + * + * @pre box_id.getOwnerRank() == getMPI().getRank() */ NeighborhoodIterator makeEmptyLocalNeighborhood( const BoxId& box_id) { - TBOX_ASSERT( box_id.getOwnerRank() == d_mpi.getRank() ); + TBOX_ASSERT(box_id.getOwnerRank() == d_mpi.getRank()); return d_relationships.insert(box_id).first; } @@ -646,7 +660,6 @@ class Connector { d_relationships.eraseEmptyNeighborhoods(); d_global_data_up_to_date = false; - return; } /*! @@ -671,7 +684,6 @@ class Connector const IntVector& ratio) { d_relationships.coarsenNeighbors(ratio); - return; } /*! @@ -684,7 +696,6 @@ class Connector const IntVector& ratio) { d_relationships.refineNeighbors(ratio); - return; } /*! @@ -697,7 +708,6 @@ class Connector const IntVector& growth) { d_relationships.growNeighbors(growth); - return; } //@} @@ -708,6 +718,13 @@ class Connector * * To be called after modifying a Connector's context through setBase, * setHead, or setWidth methods. + * + * @pre d_base_handle && d_head_handle + * @pre getBase().getGridGeometry() == getHead().getGridGeometry() + * @pre (getBase().getRefinementRatio() >= getHead().getRefinementRatio()) || + * (getBase().getRefinementRatio() <= getHead().getRefinementRatio()) + * @pre (getParallelState() == BoxLevel::DISTRIBUTED) || + * (getBase().getParallelState() == BoxLevel::GLOBALIZED) */ void finalizeContext(); @@ -719,6 +736,8 @@ class Connector * * @param new_base * @param finalize_context + * + * @pre new_base.isInitialized() */ void setBase( @@ -727,6 +746,8 @@ class Connector /*! * @brief Return a reference to the base BoxLevel. + * + * @pre isFinalized() */ const BoxLevel& getBase() const @@ -742,6 +763,8 @@ class Connector * * @param new_head * @param finalize_context + * + * @pre new_head.isInitialized() */ void setHead( @@ -750,6 +773,8 @@ class Connector /*! * @brief Return a reference to the head BoxLevel. + * + * @pre isFinalized() */ const BoxLevel& getHead() const @@ -765,6 +790,8 @@ class Connector * The ratio is the same regardless of which is the coarser of the two. * Use getHeadCoarserFlag() to determine which is coarser. If the ratio * cannot be represented by an IntVector, truncated. @see ratioIsExact(). + * + * @pre isFinalized() */ const IntVector& getRatio() const @@ -778,6 +805,8 @@ class Connector * * The ratio is exact if it can be represented by an IntVector. * @see getRatio(). + * + * @pre isFinalized() */ bool ratioIsExact() const @@ -789,6 +818,8 @@ class Connector /*! * @brief Return true if head BoxLevel is coarser than base * BoxLevel. + * + * @pre isFinalized() */ bool getHeadCoarserFlag() const @@ -812,28 +843,35 @@ class Connector } /*! - * @brief Initialize to the transpose of a given Connector object, - * assuming that all relationships are local (no remote neighbors). + * @brief Create and return this Connector's transpose, assuming that all + * relationships are local (no remote neighbors). * * If any remote neighbor is found an unrecoverable assertion is * thrown. * - * Non-periodic relationships in @c connector are simply reversed to get the - * transpose relationship. For each periodic relationships in @c connector, - * we create a periodic relationship incident from @c connector's unshifted - * head neighbor to @c connectors's shifted base neighbor. This is because - * all relationships must be incident from a real (unshifted) Box. + * Non-periodic relationships in are simply reversed to get the transpose + * relationship. For each periodic relationship we create a periodic + * relationship incident from the unshifted head neighbor to the shifted + * base neighbor. This is because all relationships must be incident from a + * real (unshifted) Box. + */ + virtual Connector * + createLocalTranspose() const; + + /*! + * @brief Create and return this Connector's transpose. * - * @param[in] connector + * Similar to createLocalTranspose(), but this method allows + * non-local edges. Global data is required, so this method + * is not scalable. */ - void - initializeToLocalTranspose( - const Connector& connector); + virtual Connector * + createTranspose() const; /*! * @brief Assignment operator */ - const Connector& + Connector& operator = ( const Connector& rhs); @@ -871,8 +909,8 @@ class Connector /*! * @brief Set the parallel distribution state. * - * Before a Connector can be in a GLOBALIZED state, The base - * BoxLevel given in initialize() must already be in + * Before a Connector can be in a GLOBALIZED state, the base + * BoxLevel given in setBase() must already be in * GLOBALIZED mode. The base BoxLevel should remain in * GLOBALIZED mode for compatibility with the Connector. * @@ -884,6 +922,8 @@ class Connector * cost for switching parallel states. * * @param[in] parallel_state + * + * @pre isFinalized() */ void setParallelState( @@ -901,12 +941,14 @@ class Connector /*! * @brief Returns the MPI communication object, which is always * that of the base BoxLevel. + * + * @pre isFinalized() */ const tbox::SAMRAI_MPI& getMPI() const { TBOX_ASSERT(isFinalized()); - return d_base_handle->getBoxLevel().getMPI(); + return getBase().getMPI(); } /*! @@ -916,6 +958,8 @@ class Connector * * @param new_width * @param finalize_context + * + * @pre new_width >= IntVector::getZero(new_width.getDim()) */ void setWidth( @@ -926,10 +970,12 @@ class Connector * @brief Return the Connector width associated with the relationships. * * For overlap Connectors, an relationship exists between a base and head - * Boxes if the base mapped_box, grown by this width, - * overlaps the head mapped_box. For mapping Connectors, the width + * Boxes if the base box, grown by this width, + * overlaps the head box. For mapping Connectors, the width * the amount that a pre-map box must grow to nest the post-map - * boxes. + * boxes + * + * @pre isFinalized(). */ const IntVector& getConnectorWidth() const @@ -943,6 +989,9 @@ class Connector * relationships as needed. * * @param[in] new_width + * + * @pre new_width <= getConnectorWidth() + * @pre getParallelState() == BoxLevel::DISTRIBUTED */ void shrinkWidth( @@ -964,7 +1013,7 @@ class Connector recursivePrint( std::ostream& os, const std::string& border, - int detail_depth = 0) const; + int detail_depth = 2) const; /*! * @brief Return true if two Connector objects are @@ -1001,25 +1050,28 @@ class Connector * * @param[in] base_refinement_ratio * @param[in] head_refinement_ratio - * @param[in] head_gcw The connector width in the head index space. + * @param[in] head_width The connector width in the head index space. * * @return A copy of the connector width converted to the base index * space. + * + * @pre (base_refinement_ratio >= head_refinement_ratio) || + * (base_refinement_ratio <= head_refinement_ratio) */ static IntVector convertHeadWidthToBase( const IntVector& base_refinement_ratio, const IntVector& head_refinement_ratio, - const IntVector& head_gcw); + const IntVector& head_width); // TODO: refactor use of size_t as return type. This could be // problematic. /*! * @brief Check for consistency between the relationship data and base - * mapped boxes, and return the number of consistency errors. + * boxes, and return the number of consistency errors. * * Consistency stipulates that each neighbor list must correspond to - * a base mapped box. + * a base box. * * relationship consistency errors should be treated as fatal because many * operations assume consistency. @@ -1045,6 +1097,8 @@ class Connector * globalized for checking, triggering communication. * * @return number of inconsistencies found. + * + * @pre getHead().getGlobalizedVersion().getParallelState() == BoxLevel::GLOBALIZED */ size_t @@ -1071,10 +1125,77 @@ class Connector */ static void computeNeighborhoodDifferences( - Connector& left_minus_right, + boost::shared_ptr& left_minus_right, const Connector& left_connector, const Connector& right_connector); + /*! + * @brief Returns true if the transpose of this Connector exists. + */ + bool + hasTranspose() const + { + return d_transpose; + } + + /*! + * @brief Returns the transpose of this Connector if it exists. + * + * @pre hasTranspose() + */ + Connector& + getTranspose() const + { + TBOX_ASSERT(hasTranspose()); + return *d_transpose; + } + + /*! + * @brief Sets this Connector's transpose and, if the transpose exists, + * sets its transpose to this Connector. If owns_transpose is true then + * this object will delete the transpose during its deletion. + * + * @note If owns_transpose is false, then client code is responsible for + * the deletion of the transpose. Similarly, if owns_transpose is true + * client code must never explicitly delete the transpose. + * + * @param[in] transpose + * @param[in] owns_transpose + */ + void + setTranspose( + Connector* transpose, + bool owns_transpose) + { + if (d_transpose && d_owns_transpose && + (d_transpose != transpose) && (d_transpose != this)) { + delete d_transpose; + } + d_transpose = transpose; + d_owns_transpose = owns_transpose; + if (d_transpose && d_transpose != this) { + d_transpose->d_transpose = this; + d_transpose->d_owns_transpose = false; + + if (d_ratio != IntVector::getOne(d_ratio.getDim())) { + if ((d_ratio * d_base_width) != d_transpose->d_base_width && + d_base_width != (d_ratio * d_transpose->d_base_width)) { + + TBOX_ERROR("Connector::setTranspose: Base width for \n" + "this Connector and its transpose are inconsistent.\n"); + + } + } else { + if (d_base_width != d_transpose->d_base_width) { + + TBOX_ERROR("Connector::setTranspose: Base width for \n" + "this Connector and its transpose are inconsistent.\n"); + + } + } + } + } + /*! * @brief Check that the relationships are a correct transpose of another * Connector and return the number of erroneous relationships. @@ -1094,7 +1215,7 @@ class Connector size_t checkTransposeCorrectness( const Connector& transpose, - const bool ignore_periodic_relationships = false) const; + bool ignore_periodic_relationships = false) const; /*! * @brief Run checkTransposeCorrectness. If any errors are found, @@ -1109,28 +1230,86 @@ class Connector const Connector& transpose, const bool ignore_periodic_relationships = false) const; - //@} + /*! + * Check that overlap data is correct (represents overlaps). + * + * Checking is done as follows: + * - Find overlap errors using @c findOverlapErrors(). + * - Report overlap errors to @c tbox::perr. + * - Return number of local errors. + * + * @note + * This is an expensive operation (it uses @b findOverlapErrors()) + * and should only be used for debugging. + * + * @see findOverlaps() + * + * @param[in] ignore_self_overlap Ignore a box's overlap with itself + * @param[in] assert_completeness If false, ignore missing overlaps. This + * will still look for overlaps that should not be there. + * @param[in] ignore_periodic_images If true, do not require neighbors + * that are periodic images. + * + * @return Number of overlap errors found locally. + * + * @pre (getBase().isInitialized()) && (getHead().isInitialized()) + * @pre !hasPeriodicLocalNeighborhoodBaseBoxes() + */ + int + checkOverlapCorrectness( + bool ignore_self_overlap = false, + bool assert_completeness = true, + bool ignore_periodic_images = false) const; /*! - * @brief Set the Connector type. + * @brief Assert overlap correctness. + * + * @par Assertions + * if an error is found, the method will write out diagnostic information + * and throw an an error on all processes. + * + * This is an expensive check. + * + * @see checkOverlapCorrectness(). * - * @param[in] connector_type + * @param[in] ignore_self_overlap + * @param[in] assert_completeness + * @param[in] ignore_periodic_images + * + * @pre (getBase().isInitialized()) && (getHead().isInitialized()) */ void - setConnectorType( - ConnectorType connector_type) - { - d_connector_type = connector_type; - } + assertOverlapCorrectness( + bool ignore_self_overlap = false, + bool assert_completeness = true, + bool ignore_periodic_images = false) const; /*! - * @brief Return the Connector type. + * @brief Find errors in overlap data of an overlap Connector. + * + * An error is either a missing overlap or an extra overlap. + * + * This is an expensive operation and should only be used for + * debugging. + * + * @par Assertions + * This version throws an assertion only if it finds inconsistent + * Connector data. Missing and extra overlaps are returned but do + * not cause an assertion. + * + * @param[out] missing + * @param[out] extra + * @param[in] ignore_self_overlap + * + * @pre (getBase().isInitialized()) && (getHead().isInitialized()) */ - ConnectorType - getConnectorType() const - { - return d_connector_type; - } + void + findOverlapErrors( + boost::shared_ptr& missing, + boost::shared_ptr& extra, + bool ignore_self_overlap = false) const; + + //@} /*! * @brief Return local number of neighbor sets. @@ -1157,6 +1336,8 @@ class Connector * been computed and cached. When communication is required, all * processors must call this method. To ensure that no * communication is needed, call cacheGlobalReducedData() first. + * + * @pre isFinalized() */ int getGlobalNumberOfNeighborSets() const @@ -1173,6 +1354,8 @@ class Connector * been computed and cached. When communication is required, all * processors must call this method. To ensure that no * communication is needed, call cacheGlobalReducedData() first. + * + * @pre isFinalized() */ int getGlobalNumberOfRelationships() const @@ -1192,34 +1375,22 @@ class Connector * changes. * * Sets d_global_data_up_to_date; - */ - void - cacheGlobalReducedData() const; - - /*! - * @brief Write the neighborhoods to a database. * - * @param[in] database + * @pre isFinalized() */ void - putNeighborhoodsToDatabase( - const boost::shared_ptr& database) - { - d_relationships.putUnregisteredToDatabase(database); - return; - } + cacheGlobalReducedData() const; /*! - * @brief Read the neighborhoods from a database. + * @brief Write the neighborhoods to a restart database. * - * @param[in] database + * @param[in] restart_db */ void - getNeighborhoodsFromDatabase( - tbox::Database& database) + putToRestart( + const boost::shared_ptr& restart_db) { - d_relationships.getFromDatabase(database); - return; + d_relationships.putToRestart(restart_db); } /*! @@ -1251,12 +1422,14 @@ class Connector const std::string& border) const; /*! - * @brief Writes the requested neighborhood to tbox::perr. + * @brief Writes the requested neighborhood to an output stream. * + * @param[in] os * @param[in] box_id */ void - writeNeighborhoodToErrorStream( + writeNeighborhoodToStream( + std::ostream& os, const BoxId& box_id) const; /*! @@ -1287,9 +1460,9 @@ class Connector Outputter( const Connector& connector, const std::string& border, - int detail_depth = 0, + int detail_depth = 2, bool output_statistics = false); - void + Outputter& operator = ( const Outputter& r); // Unimplemented private. const Connector& d_conn; @@ -1304,8 +1477,7 @@ class Connector * * Usage example: * @code - * cout << "my connector:\n" - * << connector.format(" ", 2) << endl; + * tbox::plog << "my connector:\n" << connector.format() << endl; * @endcode * * @param[in] border @@ -1314,7 +1486,7 @@ class Connector Outputter format( const std::string& border = std::string(), - int detail_depth = 0) const + int detail_depth = 2) const { return Outputter(*this, border, detail_depth); } @@ -1338,31 +1510,67 @@ class Connector return Outputter(*this, border, 0, true); } +protected: + /*! + * @brief Method to do the work of createLocalTranspose. + * + * @param transpose + * + * @pre transpose + */ + void + doLocalTransposeWork( + Connector* transpose) const; + + /*! + * @brief Method to do the work of createTranspose. + * + * @param transpose + * + * @pre transpose + */ + void + doTransposeWork( + Connector* transpose) const; + private: + // To access findOverlaps_rbbt(). + friend class OverlapConnectorAlgorithm; + /* * Static integer constant descibing class's version number. */ static const int HIER_CONNECTOR_VERSION; - enum { BAD_INT = (1 << (8 * sizeof(int) - 2)) }; + //! @brief Data structure for MPI reductions. + struct IntIntStruct { int i; + int rank; + }; + + /* + * Uninitialized default constructor. + */ + Connector(); /*! * @brief Return the globalized relationship data. * - * @par Assertions - * Throws an unrecoverable assertion if not in GLOBALIZED mode. + * @pre getParallelState() == BoxLevel::GLOBALIZED */ const BoxNeighborhoodCollection& getGlobalNeighborhoodSets() const { if (d_parallel_state == BoxLevel::DISTRIBUTED) { - TBOX_ERROR("Global connectivity unavailable in DISTRIBUTED state."); + TBOX_ERROR("Global connectivity unavailable in DISTRIBUTED state." << std::endl); } return d_global_relationships; } /*! * @brief Return the relationships appropriate to the parallel state. + * + * @pre (getParallelState() == BoxLevel::GLOBALIZED) || + * (box_id.getOwnerRank() == getMPI().getRank()) */ const BoxNeighborhoodCollection& getRelations( @@ -1385,6 +1593,8 @@ class Connector * change its state to GLOBALIZED. * * The returned object should be deleted to prevent memory leaks. + * + * @pre other.getParallelState() != BoxLevel::GLOBALIZED */ Connector * makeGlobalizedCopy( @@ -1424,6 +1634,8 @@ class Connector getTimer("hier::Connector::acquireRemoteNeighborhoods()"); t_cache_global_reduced_data = tbox::TimerManager::getManager()-> getTimer("hier::Connector::cacheGlobalReducedData()"); + t_find_overlaps_rbbt = tbox::TimerManager::getManager()-> + getTimer("hier::Connector::findOverlaps_rbbt()"); } /*! @@ -1436,11 +1648,49 @@ class Connector { t_acquire_remote_relationships.reset(); t_cache_global_reduced_data.reset(); + t_find_overlaps_rbbt.reset(); } - //@{ @name Private utilities. + /*! + * @brief Read the neighborhoods from a restart database. + * + * @param[in] restart_db + */ + void + getFromRestart( + tbox::Database& restart_db) + { + d_relationships.getFromRestart(restart_db); + } - //@} + /*! + * @brief Discover and add overlaps from base and externally + * provided head box_level. + * + * Relationships found are added to appropriate neighbor lists. No overlap + * is removed. If existing overlaps are invalid, remove them first. + * + * The provided head should be a globalized version of + * d_head_handle->getBoxLevel(). It should have the same + * refinement ratio as d_head_handle->getBoxLevel(). + * + * The ignore_self_overlap directs the method to not list + * a box as its own neighbor. This should be true only + * when the head and tail objects represent the same box_level + * (regardless of whether they are the same objects), and + * you want to disregard self-overlaps. + * Two boxes are considered the same if + * - The boxes are equal by comparison (they have the same + * owner and the same indices), and + * - They are from box_levels with the same refinement ratio. + * + * @pre head.getParallelState() == BoxLevel::GLOBALIZED + */ + void + findOverlaps_rbbt( + const BoxLevel& head, + bool ignore_self_overlap = false, + bool sanity_check_method_postconditions = false); /*! * @brief Handle for access to the base BoxLevel. @@ -1461,9 +1711,8 @@ class Connector /*! * @brief Connector width for the base BoxLevel. * - * This is the amount of growth applied to a mapped_box in the base BoxLevel - * before checking if the mapped_box overlaps a mapped_box in the head - * BoxLevel. + * This is the amount of growth applied to a box in the base BoxLevel + * before checking if the box overlaps a box in the head BoxLevel. */ IntVector d_base_width; @@ -1547,10 +1796,13 @@ class Connector */ mutable bool d_global_data_up_to_date; - ConnectorType d_connector_type; + Connector* d_transpose; + + bool d_owns_transpose; static boost::shared_ptr t_acquire_remote_relationships; static boost::shared_ptr t_cache_global_reduced_data; + static boost::shared_ptr t_find_overlaps_rbbt; static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ConnectorStatistics.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ConnectorStatistics.C index 94e302ad..3b648df0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ConnectorStatistics.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ConnectorStatistics.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Statistical characteristics of a Connector. * ************************************************************************/ -#ifndef included_hier_ConnectorStatistics_C -#define included_hier_ConnectorStatistics_C - #include "SAMRAI/hier/ConnectorStatistics.h" #include "SAMRAI/hier/BoxContainer.h" @@ -26,7 +23,6 @@ namespace SAMRAI { namespace hier { - std::string ConnectorStatistics::s_quantity_names[NUMBER_OF_QUANTITIES]; int ConnectorStatistics::s_longest_length; @@ -38,55 +34,53 @@ ConnectorStatistics::s_initialize_finalize_handler( ConnectorStatistics::finalizeCallback, tbox::StartupShutdownManager::priorityTimers); - /* -************************************************************************ -* Constructor. -************************************************************************ -*/ + ************************************************************************ + * Constructor. + ************************************************************************ + */ ConnectorStatistics::ConnectorStatistics( - const Connector &connector ) - : d_mpi(connector.getMPI()) + const Connector& connector): + d_mpi(connector.getMPI()) { if (!connector.isFinalized()) { TBOX_ERROR("ConnectorStatistics requires an finalized Connector."); } - computeLocalConnectorStatistics( connector ); + computeLocalConnectorStatistics(connector); reduceStatistics(); } - /* -************************************************************************ -************************************************************************ -*/ + ************************************************************************ + ************************************************************************ + */ ConnectorStatistics::StatisticalQuantities::StatisticalQuantities() { - for ( int i=0; itransformBox(neighbor, + base.getRefinementRatio(), + base_box.getBlockId(), + neighbor.getBlockId()); + } neighbor *= base_box; - const int size = neighbor.size(); + const size_t size = neighbor.size(); - d_sq.d_values[OVERLAP_SIZE] += size; - if ( neighbor.getOwnerRank() == mpi.getRank() ) { - d_sq.d_values[LOCAL_OVERLAP_SIZE] += size; - } - else { - d_sq.d_values[REMOTE_OVERLAP_SIZE] += size; + d_sq.d_values[OVERLAP_SIZE] += static_cast(size); + if (neighbor.getOwnerRank() == mpi.getRank()) { + d_sq.d_values[LOCAL_OVERLAP_SIZE] += static_cast(size); + } else { + d_sq.d_values[REMOTE_OVERLAP_SIZE] += static_cast(size); } } } - d_sq.d_values[NUMBER_OF_NEIGHBORS] = static_cast(visible_neighbors.size()); std::set remote_neighbor_owners; - for ( BoxContainer::const_iterator bi=visible_neighbors.begin(); - bi!=visible_neighbors.end(); ++bi ) { - const Box &neighbor = *bi; + for (BoxContainer::const_iterator bi = visible_neighbors.begin(); + bi != visible_neighbors.end(); ++bi) { + const Box& neighbor = *bi; d_sq.d_values[NUMBER_OF_LOCAL_NEIGHBORS] += neighbor.getOwnerRank() == mpi.getRank(); @@ -196,11 +192,8 @@ void ConnectorStatistics::computeLocalConnectorStatistics( const Connector &conn remote_neighbor_owners.erase(mpi.getRank()); d_sq.d_values[NUMBER_OF_REMOTE_NEIGHBOR_OWNERS] = static_cast(remote_neighbor_owners.size()); - - return; } - /* *********************************************************************** *********************************************************************** @@ -229,11 +222,8 @@ void ConnectorStatistics::reduceStatistics() d_rank_of_min[i] = d_rank_of_max[i] = 0; } } - - return; } - /* *********************************************************************** * Write out local and globally reduced statistics on the relationships. @@ -267,11 +257,8 @@ void ConnectorStatistics::printNeighborStats( << ' ' << std::setw(8) << std::right << d_sq_sum.d_values[i] / d_mpi.getSize() << '\n'; } - - return; } - /* *********************************************************************** *********************************************************************** @@ -281,20 +268,20 @@ void ConnectorStatistics::initializeCallback() { - s_quantity_names[NUMBER_OF_BASE_BOXES] = "num base boxes"; - s_quantity_names[NUMBER_OF_BASE_CELLS] = "num base cells"; + s_quantity_names[NUMBER_OF_BASE_BOXES] = "num base boxes"; + s_quantity_names[NUMBER_OF_BASE_CELLS] = "num base cells"; - s_quantity_names[HAS_ANY_NEIGHBOR_SETS] = "has any neighbor sets"; - s_quantity_names[NUMBER_OF_NEIGHBOR_SETS] = "num neighbor sets"; + s_quantity_names[HAS_ANY_NEIGHBOR_SETS] = "has any neighbor sets"; + s_quantity_names[NUMBER_OF_NEIGHBOR_SETS] = "num neighbor sets"; - s_quantity_names[HAS_ANY_RELATIONSHIPS] = "has any relationships"; - s_quantity_names[NUMBER_OF_RELATIONSHIPS] = "num relationships"; - s_quantity_names[MIN_NUMBER_OF_RELATIONSHIPS] = "min num relationships"; - s_quantity_names[MAX_NUMBER_OF_RELATIONSHIPS] = "max num relationships"; + s_quantity_names[HAS_ANY_RELATIONSHIPS] = "has any relationships"; + s_quantity_names[NUMBER_OF_RELATIONSHIPS] = "num relationships"; + s_quantity_names[MIN_NUMBER_OF_RELATIONSHIPS] = "min num relationships"; + s_quantity_names[MAX_NUMBER_OF_RELATIONSHIPS] = "max num relationships"; - s_quantity_names[NUMBER_OF_NEIGHBORS] = "num neighbors"; - s_quantity_names[NUMBER_OF_LOCAL_NEIGHBORS] = "num local neighbors"; - s_quantity_names[NUMBER_OF_REMOTE_NEIGHBORS] = "num remote neighbors"; + s_quantity_names[NUMBER_OF_NEIGHBORS] = "num neighbors"; + s_quantity_names[NUMBER_OF_LOCAL_NEIGHBORS] = "num local neighbors"; + s_quantity_names[NUMBER_OF_REMOTE_NEIGHBORS] = "num remote neighbors"; s_quantity_names[NUMBER_OF_REMOTE_NEIGHBOR_OWNERS] = "num remote neighbor owners"; s_quantity_names[OVERLAP_SIZE] = "overlap size"; @@ -302,9 +289,9 @@ ConnectorStatistics::initializeCallback() s_quantity_names[REMOTE_OVERLAP_SIZE] = "remote overlap size"; s_longest_length = 0; - for ( int i=0; i::Max( - s_longest_length, static_cast(s_quantity_names[i].length())); + s_longest_length, static_cast(s_quantity_names[i].length())); } } @@ -316,12 +303,11 @@ ConnectorStatistics::initializeCallback() void ConnectorStatistics::finalizeCallback() { - for ( int i=0; i= 0); + TBOX_ASSERT(coarsest_level <= finest_level); + TBOX_ASSERT(finest_level < num_levels); + + d_visible_boxes.resize(num_levels); + + LocalId local_id(0); + + for (int ln = finest_level; ln >= coarsest_level; --ln) { + const boost::shared_ptr& current_level = + hierarchy.getPatchLevel(ln); + + if (ln != finest_level) { + + const Connector& coarse_to_fine = + current_level->findConnector( + *(hierarchy.getPatchLevel(ln+1)), + IntVector::getOne(hierarchy.getDim()), + CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + const IntVector& connector_ratio = coarse_to_fine.getRatio(); + + for (PatchLevel::iterator ip(current_level->begin()); + ip != current_level->end(); ++ip) { + + const boost::shared_ptr& patch = *ip; + const Box& box = patch->getBox(); + const BlockId& block_id = box.getBlockId(); + const BoxId& box_id = box.getBoxId(); + BoxContainer& visible_boxes = d_visible_boxes[ln][box_id]; + + BoxContainer coarse_boxes(box); + + BoxContainer fine_nbr_boxes; + if (coarse_to_fine.hasNeighborSet(box_id)) { + coarse_to_fine.getNeighborBoxes(box_id, fine_nbr_boxes); + } + if (!fine_nbr_boxes.empty()) { + BoxContainer fine_boxes; + for (SAMRAI::hier::RealBoxConstIterator + nbr_itr = fine_nbr_boxes.realBegin(); + nbr_itr != fine_nbr_boxes.realEnd(); ++nbr_itr) { + if (nbr_itr->getBlockId() == block_id) { + fine_boxes.pushBack(*nbr_itr); + } + } + + fine_boxes.coarsen(connector_ratio); + + coarse_boxes.removeIntersections(fine_boxes); + coarse_boxes.coalesce(); + } + + for (BoxContainer::iterator itr = + coarse_boxes.begin(); itr != coarse_boxes.end(); ++itr) { + + Box new_box(*itr, local_id, box_id.getOwnerRank()); + ++local_id; + visible_boxes.insert(visible_boxes.end(), new_box); + } + } + } else { + for (PatchLevel::iterator ip(current_level->begin()); + ip != current_level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + const Box& box = patch->getBox(); + const BoxId& box_id = box.getBoxId(); + BoxContainer& visible_boxes = d_visible_boxes[ln][box_id]; + + Box new_box(box, local_id, box.getOwnerRank()); + ++local_id; + visible_boxes.insert(visible_boxes.end(), new_box); + } + } + } +} + +/* + ************************************************************************** + * Destructor + ************************************************************************** + */ + +FlattenedHierarchy::~FlattenedHierarchy() +{ +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/FlattenedHierarchy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/FlattenedHierarchy.h new file mode 100644 index 00000000..8c64b4a5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/FlattenedHierarchy.h @@ -0,0 +1,173 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: A flattened representation of a hierarchy + * + ************************************************************************/ + +#ifndef included_hier_FlattenedHierarchy +#define included_hier_FlattenedHierarchy + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/HierarchyNeighbors.h" +#include "SAMRAI/hier/PatchHierarchy.h" + +#include "boost/shared_ptr.hpp" +#include +#include + +namespace SAMRAI { +namespace hier { + +/*! + * @brief A flattened representation of a hierarchy. + * + * Class FlattenedHierarchy provides a way to view a PatchHierarchy or a + * subset of levels of PatchHierarchy in a "flattened" representation. In + * this representation, only the finest existing mesh is visible at any given + * location in the problem space. + * + * For any Patch in a PatchHierarchy, an associated container of visible boxes + * is created. If the Patch has no Patches from a finer level covering any + * of its index space, then the container will simply hold a box that is + * spatially equivalent to the Patch itself. If the Patch's index space is + * entirely covered by Patches on a finer level, the container will be empty. + * If the Patch's index space is partially covered by a finer level, then + * the container will hold boxes that compose the uncovered parts of the Patch. + */ +class FlattenedHierarchy +{ +public: + + /*! + * @brief Constructor of FlattenedHierarchy + * + * A FlattenedHierarchy is constructed based on the given PatchHierarchy + * and a range of levels. The range of levels may include the entire + * hierarchy or a subset of its levels. Any levels outside of the given + * range will be treated by this class as if they do not exist. + * + * If the coarsest and finest level numbers are equal, the flattened + * representation will be equivalent to the boxes of the level. + * + * @param hierarchy PatchHierarchy that will be represented + * @param coarsest_level The coarsest level that will be used + * @param finest_level The finest level that will be used + * + * @pre coarsest_level >= 0; + * @pre coarsest_level <= finest_level + * @pre finest_level < hierarchy->getNumberOfLevels() + */ + FlattenedHierarchy(const PatchHierarchy& hierarchy, + int coarsest_level, + int finest_level); + + /*! + * @brief Destructor + */ + ~FlattenedHierarchy(); + + /*! + * @brief Get the coarsest level number represented by this object + */ + int getCoarsestLevelNumber() const + { + return d_coarsest_level; + } + + /*! + * @brief Get the finest level number represented by this object + */ + int getFinestLevelNumber() const + { + return d_finest_level; + } + + /*! + * @brief Get the visible boxes for a given Box. + * + * The visible boxes represent the parts of the Box that cover space that + * is not covered by finer levels in the hierarchy. If the entire + * index space of the Box is covered by a finer level, the returned + * BoxContainer will be empty. + * + * @param box The Box for a local patch on the PatchLevel having + * level number ln. + * @param ln Level number of the box's level of resolution + * + * @pre ln <= d_finest_level && ln >= d_coarsest_level + */ + const BoxContainer& getVisibleBoxes(const Box& box, int ln) const + { + TBOX_ASSERT(ln <= d_finest_level && ln >= d_coarsest_level); + + std::map::const_iterator itr = + d_visible_boxes[ln].find(box.getBoxId()); + + if (itr == d_visible_boxes[ln].end()) { + TBOX_ERROR("FlattenedHierarchy::getVisibleBoxes error: Box " + << box << " does not exist locally on level " << ln << ".\n" + << "You must specify the Box of a current local patch."); + } + + return itr->second; + } + + /* + * @brief Get the PatchHierachy associated with this FlattenedHierarchy. + */ + const PatchHierarchy& getPatchHierarchy() const + { + return *d_patch_hierarchy; + } + + /*! + * @brief Returns an iterator to the first uncovered Box in this hierarchy. + */ + UncoveredBoxIterator + beginUncovered() + { + return UncoveredBoxIterator(this, true); + } + + /*! + * @brief Returns an iterator to the last uncovered Box in this hierarchy. + */ + UncoveredBoxIterator + endUncovered() + { + return UncoveredBoxIterator(this, false); + } + +private: + + /*! + * Level numbers for the range of levels represented in this object. + */ + int d_coarsest_level; + int d_finest_level; + + /*! + * @brief Container for the boxes in the flattened hierarchy representation + * + * The vector is indexed by level number, and for each level, the BoxId + * of a Patch is mapped to a BoxContainer holding the visible parts of + * that Patch's box. + */ + std::vector< std::map > d_visible_boxes; + + /*! + * @brief Pointer to the PatchHierarchy that was used to create this object. + */ + const PatchHierarchy* d_patch_hierarchy; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.C index dab29e90..8a4f24be 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Globally unique identifier that can be locally determined. * ************************************************************************/ -#ifndef included_hier_GlobalId_C -#define included_hier_GlobalId_C - #include "SAMRAI/hier/GlobalId.h" #include @@ -69,4 +66,3 @@ operator << ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.h index d4d6b229..e5f626aa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/GlobalId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Globally unique identifier that can be locally determined. * ************************************************************************/ @@ -49,10 +49,6 @@ class GlobalId * The object can be initialized using the assignment operator or * the non-const versions of the getOwnerRank() and getLocalId() methods. */ - /* - * TODO: Replace the magic number with a method returning the - * official invalid value. See artifact artf13924. - */ GlobalId(); /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.C new file mode 100644 index 00000000..7e58156b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.C @@ -0,0 +1,159 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: An AMR hierarchy of patch levels + * + ************************************************************************/ +#include "SAMRAI/hier/HierarchyNeighbors.h" + +#include "SAMRAI/hier/Connector.h" + +namespace SAMRAI { +namespace hier { + +/* + ************************************************************************** + * Constructor for HierarchyNeighbors + ************************************************************************** + */ + +HierarchyNeighbors::HierarchyNeighbors( + const PatchHierarchy& hierarchy, + int coarsest_level, + int finest_level, + bool do_same_level_nbrs, + int width) +: d_coarsest_level(coarsest_level), + d_finest_level(finest_level), + d_do_same_level_nbrs(do_same_level_nbrs), + d_neighbor_width(hierarchy.getDim(), width) +{ + int num_levels = hierarchy.getNumberOfLevels(); + TBOX_ASSERT(coarsest_level >= 0); + TBOX_ASSERT(coarsest_level <= finest_level); + TBOX_ASSERT(finest_level < num_levels); + TBOX_ASSERT(width >= 1); + + d_same_level_nbrs.resize(num_levels); + d_finer_level_nbrs.resize(num_levels); + d_coarser_level_nbrs.resize(num_levels); + + for (int ln = finest_level; ln >= coarsest_level; --ln) { + const boost::shared_ptr& current_level = + hierarchy.getPatchLevel(ln); + + /* + * If there is a finer level than ln, find the finer level neighbors + */ + if (ln != finest_level) { + + boost::shared_ptr finer_level( + hierarchy.getPatchLevel(ln+1)); + + hier::IntVector connector_width( + IntVector::getOne(hierarchy.getDim()), + hierarchy.getNumberBlocks()); + + if (d_neighbor_width != IntVector::getOne(hierarchy.getDim())) { + connector_width *= d_neighbor_width; + connector_width.ceilingDivide(finer_level->getRatioToCoarserLevel()); + } + + const Connector& coarse_to_fine = + current_level->findConnector( + *finer_level, + connector_width, + CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (PatchLevel::iterator ip(current_level->begin()); + ip != current_level->end(); ++ip) { + + const boost::shared_ptr& patch = *ip; + const Box& box = patch->getBox(); + const BoxId& box_id = box.getBoxId(); + BoxContainer& finer_nbrs = d_finer_level_nbrs[ln][box_id]; + + if (coarse_to_fine.hasNeighborSet(box_id)) { + coarse_to_fine.getNeighborBoxes(box_id, finer_nbrs); + } + } + } + + /* + * If there is a coarser level than ln, find the coarser level neighbors + */ + if (ln != coarsest_level) { + + boost::shared_ptr coarser_level( + hierarchy.getPatchLevel(ln-1)); + + const Connector& fine_to_coarse = + current_level->findConnector( + *coarser_level, + d_neighbor_width, + CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (PatchLevel::iterator ip(current_level->begin()); + ip != current_level->end(); ++ip) { + + const boost::shared_ptr& patch = *ip; + const Box& box = patch->getBox(); + const BoxId& box_id = box.getBoxId(); + BoxContainer& coarser_nbrs = d_coarser_level_nbrs[ln][box_id]; + + if (fine_to_coarse.hasNeighborSet(box_id)) { + fine_to_coarse.getNeighborBoxes(box_id, coarser_nbrs); + } + } + } + + /* + * Find the neighbors on the current level + */ + if (do_same_level_nbrs) { + const Connector& current_to_current = + current_level->findConnector( + *current_level, + d_neighbor_width, + CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (PatchLevel::iterator ip(current_level->begin()); + ip != current_level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + const Box& box = patch->getBox(); + const BoxId& box_id = box.getBoxId(); + BoxContainer& same_level_nbrs = d_same_level_nbrs[ln][box_id]; + + BoxContainer same_nbr_boxes; + if (current_to_current.hasNeighborSet(box_id)) { + current_to_current.getNeighborBoxes(box_id, same_nbr_boxes); + } + for (BoxContainer::iterator itr = + same_nbr_boxes.begin(); itr != same_nbr_boxes.end(); ++itr) { + if (box_id != itr->getBoxId()) { + same_level_nbrs.insert(same_level_nbrs.end(), *itr); + } + } + } + } + } +} + +/* + ************************************************************************** + * Destructor + ************************************************************************** + */ + +HierarchyNeighbors::~HierarchyNeighbors() +{ +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.h new file mode 100644 index 00000000..1a52b27d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/HierarchyNeighbors.h @@ -0,0 +1,243 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Basic neighbor information within a hierarchy + * + ************************************************************************/ + +#ifndef included_hier_HierarchyNeighbors +#define included_hier_HierarchyNeighbors + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/PatchHierarchy.h" + +#include "boost/shared_ptr.hpp" +#include + +namespace SAMRAI { +namespace hier { + +/*! + * @brief Class providing basic information about the neighors of a Patch + * within a PatchHierarchy. + * + * When a Patch exists within a PatchHierarchy, it is often useful to know + * what other Patches in the hierarchy are its neighbors--meaning + * those Patches on the same or an adjacent level that either overlap the + * first Patch in space or touch it along a Patch boundary. This class + * provides a basic interface for identifying the neightbors of a given + * local Patch. + * + * @see Connector + */ +class HierarchyNeighbors +{ +public: + + /*! + * @brief Constructor of HierarchyNeighbors + * + * HierarchyNeighbors is constructed based on the given PatchHierarchy + * and a range of levels. The range of levels may include the entire + * hierarchy or a subset of its levels. Any levels outside of the given + * range will be treated by this class as if they do not exist. + * + * The coarsest and finest level numbers may be equal, but when this is so, + * this class should only be used to find neighbors on the same level. + * + * The width argument can be used to specify a cell width such that the + * neighbors of a patch are defined as all patches closer in proximity to + * the patch than the given width. If the default value of 1 is used, then + * neighbors will be only those patches which overlap or touch at a patch + * boundary. + * + * If no intra-level neighbors information is desired, set the + * do_same_level_nbrs parameter to false. + * + * @param hierarchy PatchHierarchy that will be used + * @param coarsest_level The coarsest level that will be used + * @param finest_level The finest level that will be used + * @param do_same_level_numbers Find intra-level neigbhors as well as + * coarse-fine neighbors + * @param width Cell width to find neighbors + * + * @pre coarsest_level >= 0; + * @pre coarsest_level <= finest_level + * @pre finest_level < hierarchy->getNumberOfLevels() + * @pre width >= 1 + */ + HierarchyNeighbors(const PatchHierarchy& hierarchy, + int coarsest_level, + int finest_level, + bool do_same_level_nbrs = true, + int width = 1); + + /*! + * @brief Destructor + */ + ~HierarchyNeighbors(); + + /*! + * @brief Get the coarsest level number represented by this object + */ + int getCoarsestLevelNumber() const + { + return d_coarsest_level; + } + + /*! + * @brief Get the finest level number represented by this object + */ + int getFinestLevelNumber() const + { + return d_finest_level; + } + + /*! + * @brief Get neighbors from the next finer level. + * + * Given a Box from a local Patch on a given level, this + * returns a container holding the neighboring boxes on the next finer + * level. The container will be empty if the Patch has no neighbors on + * the finer level. + * + * An error will occur if the Box does not represent a local Patch on + * the given level. + * + * @param box Box representing a Patch + * @param ln Level number of the level holding the Patch. Both ln + * and ln+1 must be within the range of levels used to + * construct this object. + * + * @pre ln >= d_coarsest_level && ln < d_finest_level + */ + const BoxContainer& getFinerLevelNeighbors( + const Box& box, + int ln) const + { + TBOX_ASSERT(ln >= d_coarsest_level && ln < d_finest_level); + + std::map::const_iterator itr = + d_finer_level_nbrs[ln].find(box.getBoxId()); + + if (itr == d_finer_level_nbrs[ln].end()) { + TBOX_ERROR("HierarchyNeighbors::getFinerLevelNeighbors error: Box " + << box << " does not exist locally on level " << ln << ".\n" + << "You must specify the Box from a current local patch."); + } + + return itr->second; + } + + /*! + * @brief Get neighbors from the next coarser level. + * + * Given a Box from a local Patch on a given level, this + * returns a container holding the neighboring boxes on the next coarser + * level. + * + * An error will occur if the Box does not represent a local Patch on + * the given level. + * + * @param box Box representing a Patch + * @param ln Level number of the level holding the Patch. Both ln + * and ln-1 must be within the range of levels used to + * construct this object. + * + * @pre ln <= d_finest_level && ln >= d_coarsest_level + */ + const BoxContainer& getCoarserLevelNeighbors( + const Box& box, + int ln) const + { + TBOX_ASSERT(ln <= d_finest_level && ln > d_coarsest_level); + + std::map::const_iterator itr = + d_coarser_level_nbrs[ln].find(box.getBoxId()); + + if (itr == d_coarser_level_nbrs[ln].end()) { + TBOX_ERROR("HierarchyNeighbors::getCoarserLevelNeighbors error: Box " + << box << " does not exist locally on level " << ln << ".\n" + << "You must specify the Box from a current local patch."); + } + + return itr->second; + } + + /*! + * @brief Get neighbors from the same level. + * + * Given a Box which represents a local Patch on a given level, this + * returns a container holding the neighboring boxes on that level. + * The container will be empty if the Patch has no neighbors. + * + * An error will occur if the Box does not represent a local Patch on + * the given level. + * + * @param box Box representing a Patch + * @param ln Level number of the level holding the Patch + * + * @pre ln <= d_finest_level && ln >= d_coarsest_level + */ + const BoxContainer& getSameLevelNeighbors(const Box& box, int ln) const + { + TBOX_ASSERT(ln <= d_finest_level && ln >= d_coarsest_level); + + if (!d_do_same_level_nbrs) { + TBOX_ERROR("HierarchyNeighbors::getSameLevelNeighbors error: " + << "HierarchyNeighbors object was constructed with argument " + << "to not find same level neighbors." << std::endl); + } + + std::map::const_iterator itr = + d_same_level_nbrs[ln].find(box.getBoxId()); + + + if (itr == d_same_level_nbrs[ln].end()) { + TBOX_ERROR("HierarchyNeighbors::getSameLevelNeighbors error: Box " + << box << " does not exist locally on level " << ln << ".\n" + << "You must specify the BoxId of a current local patch." + << std::endl); + } + + return itr->second; + } + +private: + + /*! + * Level numbers for the range of levels represented in this object. + */ + int d_coarsest_level; + int d_finest_level; + + /*! + * Flag to tell whether this object has computed intra-level neighbors. + */ + bool d_do_same_level_nbrs; + + /*! + * @brief Containers for the neighbor boxes + * + * The vectors are indexed by level number, and for each level, the BoxId + * of a Patch is mapped to a BoxContainer holding the relevant neighbors of + * that Patch. + */ + std::vector< std::map > d_same_level_nbrs; + std::vector< std::map > d_coarser_level_nbrs; + std::vector< std::map > d_finer_level_nbrs; + + /*! + * @brief Cell width that defines proximity to search for neighbors. + */ + IntVector d_neighbor_width; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.C index 37434811..24c9ff4e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for the AMR Index object * ************************************************************************/ - -#ifndef included_hier_Index_C -#define included_hier_Index_C - #include "SAMRAI/hier/Index.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/StartupShutdownManager.h" @@ -18,11 +14,11 @@ namespace SAMRAI { namespace hier { -Index * Index::s_zeros[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; -Index * Index::s_ones[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +Index * Index::s_zeros[SAMRAI::MAX_DIM_VAL]; +Index * Index::s_ones[SAMRAI::MAX_DIM_VAL]; -Index * Index::s_mins[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; -Index * Index::s_maxs[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +Index * Index::s_mins[SAMRAI::MAX_DIM_VAL]; +Index * Index::s_maxs[SAMRAI::MAX_DIM_VAL]; tbox::StartupShutdownManager::Handler Index::s_initialize_finalize_handler( @@ -32,41 +28,43 @@ Index::s_initialize_finalize_handler( Index::finalizeCallback, tbox::StartupShutdownManager::priorityTimers); -Index::Index(): - IntVector() -{ -} - Index::Index( const tbox::Dimension& dim): - IntVector(dim) + d_dim(dim) { - // an explicit setting Invalid is allowed. - TBOX_DIM_ASSERT((!dim.isValid()) || ( - dim.getValue() > 0 && dim <= tbox::Dimension::getMaxDimension())); +#ifdef DEBUG_INITIALIZE_UNDEFINED + for (int i = 0; i < SAMRAI::MAX_DIM_VAL; ++i) { + d_index[i] = tbox::MathUtilities::getMin(); + } +#endif } Index::Index( const tbox::Dimension& dim, - const int i): - IntVector(dim, i) + const int value): + d_dim(dim) { - // an explicit setting Invalid is allowed. - TBOX_DIM_ASSERT((!dim.isValid()) || ( - dim >= tbox::Dimension(1) && dim <= tbox::Dimension::getMaxDimension())); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = value; + } + +#ifdef DEBUG_INITIALIZE_UNDEFINED + for (int i = d_dim.getValue(); i < SAMRAI::MAX_DIM_VAL; ++i) { + d_index[i] = tbox::MathUtilities::getMin(); + } +#endif } Index::Index( const int i, const int j): - IntVector(tbox::Dimension(2)) + d_dim(2) { - TBOX_DIM_ASSERT( - tbox::Dimension::getMaxDimension() >= tbox::Dimension(2)); + TBOX_DIM_ASSERT(tbox::Dimension::getMaxDimension() >= tbox::Dimension(2)); - (*this)[0] = i; - if (tbox::Dimension::MAXIMUM_DIMENSION_VALUE > 1) { - (*this)[1] = j; + d_index[0] = i; + if (SAMRAI::MAX_DIM_VAL > 1) { + d_index[1] = j; } } @@ -74,44 +72,64 @@ Index::Index( const int i, const int j, const int k): - IntVector(tbox::Dimension(3)) + d_dim(3) { TBOX_DIM_ASSERT(tbox::Dimension::getMaxDimension() >= tbox::Dimension(3)); - (*this)[0] = i; - if (tbox::Dimension::MAXIMUM_DIMENSION_VALUE > 1) { - (*this)[1] = j; + d_index[0] = i; + if (SAMRAI::MAX_DIM_VAL > 1) { + d_index[1] = j; } - if (tbox::Dimension::MAXIMUM_DIMENSION_VALUE > 2) { - (*this)[2] = k; + if (SAMRAI::MAX_DIM_VAL > 2) { + d_index[2] = k; } } Index::Index( - const tbox::Array& a): - IntVector(a) + const std::vector& a): + d_dim(static_cast(a.size())) { + TBOX_ASSERT(a.size() > 0); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = a[i]; + } + +#ifdef DEBUG_INITIALIZE_UNDEFINED + for (int i = d_dim.getValue(); i < SAMRAI::MAX_DIM_VAL; ++i) { + d_index[i] = tbox::MathUtilities::getMin(); + } +#endif } Index::Index( const tbox::Dimension& dim, const int array[]): - IntVector(dim, array) + d_dim(dim) { + for (int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = array[i]; + } } Index::Index( const Index& rhs): - IntVector(rhs) + d_dim(rhs.d_dim) { + for (int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = rhs.d_index[i]; + } } Index::Index( const IntVector& rhs): - IntVector(rhs) + d_dim(rhs.getDim()) { + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = rhs[i]; + } } Index::~Index() @@ -121,7 +139,7 @@ Index::~Index() void Index::initializeCallback() { - for (unsigned short d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (unsigned short d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { s_zeros[d] = new Index(tbox::Dimension(static_cast(d + 1)), 0); s_ones[d] = new Index(tbox::Dimension(static_cast(d + 1)), 1); @@ -135,7 +153,7 @@ Index::initializeCallback() void Index::finalizeCallback() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { delete s_zeros[d]; delete s_ones[d]; @@ -144,7 +162,40 @@ Index::finalizeCallback() } } +std::istream& +operator >> ( + std::istream& s, + Index& rhs) +{ + while (s.get() != '(') ; + + for (int i = 0; i < rhs.getDim().getValue(); ++i) { + s >> rhs(i); + if (i < rhs.getDim().getValue() - 1) + while (s.get() != ',') ; + } + + while (s.get() != ')') ; + + return s; } + +std::ostream& operator << ( + std::ostream& s, + const Index& rhs) +{ + s << '('; + + for (int i = 0; i < rhs.getDim().getValue(); ++i) { + s << rhs(i); + if (i < rhs.getDim().getValue() - 1) + s << ","; + } + s << ')'; + + return s; } -#endif + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.h index 354038bf..f3bb6c5f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Index.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for the AMR Index object * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/tbox/Utilities.h" namespace SAMRAI { @@ -24,39 +24,42 @@ namespace hier { * Class Index implements a simple n-dimensional integer vector in the * AMR index space. Index is used as lower and upper bounds when * creating a box and also when iterating over the cells in a box. An - * index is essentially an integer vector but it carries along the + * Index is essentially an integer vector but it carries along the * notion of indexing into AMR's abstract index space. * - * @see hier::Box - * @see hier::BoxIterator - * @see hier::IntVector + * @see Box + * @see BoxIterator + * @see IntVector */ -class Index:public IntVector +class Index { public: + + typedef tbox::Dimension::dir_t dir_t; + /** - * Creates an uninitialized vector. + * @brief Creates an uninitialized Index. */ explicit Index( const tbox::Dimension& dim); /** - * Construct an index with all components equal to the argument. + * @brief Construct an Index with all components equal to the argument. */ Index( const tbox::Dimension& dim, - const int i); + const int value); /** - * Construct a two-dimensional index with the value (i,j). + * @brief Construct a two-dimensional Index with the value (i,j). */ Index( const int i, const int j); /** - * Construct a three-dimensional index with the value (i,j,k). + * @brief Construct a three-dimensional Index with the value (i,j,k). */ Index( const int i, @@ -64,285 +67,577 @@ class Index:public IntVector const int k); /** - * Construct an n-dimensional index with the values copied - * from the integer tbox::Array i of size n. + * @brief Construct an n-dimensional Index with the values copied + * from the integer tbox::Array i of size n. + * + * The dimension of the constructed Index will be equal to the size of the + * argument vector. + * + * @pre i.size() > 0 */ explicit Index( - const tbox::Array& i); + const std::vector& i); /** - * The copy constructor creates an index equal to the argument. + * @brief The copy constructor creates an Index equal to the argument. */ Index( const Index& rhs); /** - * Construct an index equal to the argument IntVector. + * @brief Construct an Index equal to the argument IntVector. + * + * @pre rhs.getNumBlocks() == 1 */ explicit Index( const IntVector& rhs); /** - * Construct an index equal to the argument array. + * @brief Construct an Index equal to the argument array. */ Index( const tbox::Dimension& dim, const int array[]); /** - * The assignment operator sets the index equal to the argument. + * @brief The assignment operator sets the Index equal to the argument. * - * An assignment to an uninitialized Index is allowed but assigning - * from an uninitialized Index will result in an assert. + * @pre getDim() == rhs.getDim() */ Index& operator = ( const Index& rhs) { -#ifdef DEBUG_CHECK_ASSERTIONS - /* - * Allow assignment of to an uninitialized - * but do not allow assignment from an - * uninitialized. - */ - if (getDim().isValid()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - } else { - TBOX_DIM_ASSERT_CHECK_DIM(rhs.getDim()); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = rhs.d_index[i]; } -#endif - IntVector::operator = (rhs); return *this; } /** - * The assignment operator sets the index equal to the argument IntVector. + * @brief The assignment operator sets the Index equal to the argument + * IntVector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& operator = ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector::operator = (rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] = rhs[i]; + } return *this; } /** - * The index destructor does nothing interesting. + * @brief The Index destructor does nothing interesting. */ virtual ~Index(); /** - * Plus-equals operator for an index and an integer vector. + * @brief Returns true if all components are equal to a given integer. + */ + bool + operator == ( + const Index& rhs) const + { + bool result = true; + for (unsigned int i = 0; result && (i < getDim().getValue()); ++i) { + result = d_index[i] == rhs.d_index[i]; + } + return result; + } + + /** + * @brief Returns true if some components are not equal to a given integer. + */ + bool + operator != ( + const Index& rhs) const + { + return !(*this == rhs); + } + + /** + * @brief Plus-equals operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& operator += ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector::operator += (rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] += rhs[i]; + } return *this; } /** - * Plus operator for an index and an integer vector. + * @brief Plus operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index operator + ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + Index tmp = *this; + tmp += rhs; + return tmp; + } + + /** + * @brief Plus-equals operator for an Index + * + * @pre getDim() == rhs.getDim() + */ + Index& + operator += ( + const Index& rhs) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] += rhs.d_index[i]; + } + return *this; + } + + /** + * @brief Plus operator for an Index and an another Index + * + * @pre getDim() == rhs.getDim() + */ + Index + operator + ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); Index tmp = *this; tmp += rhs; return tmp; } /** - * Plus-equals operator for an index and an integer. + * @brief Plus-equals operator for an Index and an integer. */ Index& operator += ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - IntVector::operator += (rhs); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] += rhs; + } return *this; } /** - * Plus operator for an index and an integer. + * @brief Plus operator for an Index and an integer. */ Index operator + ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); Index tmp = *this; tmp += rhs; return tmp; } /** - * Minus-equals operator for an index and an integer vector. + * @brief Minus-equals operator for an Index + * + * @pre getDim() == rhs.getDim() + */ + Index& + operator -= ( + const Index& rhs) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] -= rhs.d_index[i]; + } + return *this; + } + + /** + * @brief Minus operator for an Index + * + * @pre getDim() == rhs.getDim() + */ + Index + operator - ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + Index tmp = *this; + tmp -= rhs; + return tmp; + } + + /** + * @brief Minus-equals operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& operator -= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector::operator -= (rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] -= rhs[i]; + } return *this; } /** - * Minus operator for an index and an integer vector. + * @brief Minus operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index operator - ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); Index tmp = *this; tmp -= rhs; return tmp; } /** - * Minus-equals operator for an index and an integer. + * @brief Minus-equals operator for an Index and an integer. */ Index& operator -= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - IntVector::operator -= (rhs); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_index[i] -= rhs; + } return *this; } /** - * Minus operator for an index and an integer. + * @brief Minus operator for an Index and an integer. */ Index operator - ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); Index tmp = *this; tmp -= rhs; return tmp; } /** - * Times-equals operator for an index and an integer vector. + * @brief Times-equals operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& operator *= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector::operator *= (rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_index[i] *= rhs[i]; + } return *this; } /** - * Times operator for an index and an integer vector. - */ + * @brief Times operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 + */ Index operator * ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); Index tmp = *this; tmp *= rhs; return tmp; } /** - * Times-equals operator for an index and an integer. + * @brief Times-equals operator for an Index and an integer. */ Index& operator *= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - IntVector::operator *= (rhs); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_index[i] *= rhs; + } return *this; } /** - * Times operator for an index and an integer. + * @brief Times operator for an Index and an integer. */ Index operator * ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); Index tmp = *this; tmp *= rhs; return tmp; } /** - * Assign-quotient operator for an index and an integer vector. + * @brief Assign-quotient operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& operator /= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector::operator /= (rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_index[i] /= rhs[i]; + } return *this; } /** - * Quotient operator for an index and an integer vector. + * @brief Quotient operator for an Index and an integer vector. + * + * @pre getDim() == rhs.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index operator / ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(rhs.getNumBlocks() == 1); Index tmp = *this; tmp /= rhs; return tmp; } /** - * Assign-quotient operator for an index and an integer. + * @brief Assign-quotient operator for an Index and an integer. */ Index& operator /= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); - IntVector::operator /= (rhs); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + d_index[i] /= rhs; + } return *this; } /** - * Quotient operator for an index and an integer. + * @brief Quotient operator for an Index and an integer. */ Index operator / ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(getDim()); Index tmp = *this; tmp /= rhs; return tmp; } + /** + * @brief Return the specified component of the Index. + * + * @pre (i >= 0) && (i < getDim().getValue()) + */ + int& + operator [] ( + const unsigned int i) + { + TBOX_ASSERT(i < getDim().getValue()); + return d_index[i]; + } + + /** + * @brief Return the specified component of the vector as a const reference. + * + * @pre (i >= 0) && (i < getDim().getValue()) + */ + const int& + operator [] ( + const unsigned int i) const + { + TBOX_ASSERT(i < getDim().getValue()); + return d_index[i]; + } + + /** + * @brief Return the specified component of the Index. + * + * @pre (i >= 0) && (i < getDim().getValue()) + */ + int& + operator () ( + const unsigned int i) + { + TBOX_ASSERT(i < getDim().getValue()); + return d_index[i]; + } + + /** + * @brief Return the specified component of the Index as a const reference. + * + * @pre (i >= 0) && (i < getDim().getValue()) + */ + const int& + operator () ( + const unsigned int i) const + { + TBOX_ASSERT(i < getDim().getValue()); + return d_index[i]; + } + + /** + * @brief Returns true if each integer in Index is greater than + * corresponding integer in comparison Index. + * + * @pre getDim() == rhs.getDim() + */ + bool + operator > ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + bool result = true; + for (unsigned int i = 0; result && (i < getDim().getValue()); ++i) { + result = result && (d_index[i] > rhs.d_index[i]); + } + return result; + } + + /** + * @brief Returns true if each integer in Index is greater or equal to + * corresponding integer in comparison Index. + * + * @pre getDim() == rhs.getDim() + */ + bool + operator >= ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + bool result = true; + for (unsigned int i = 0; result && (i < getDim().getValue()); ++i) { + result = result && (d_index[i] >= rhs.d_index[i]); + } + return result; + } + + /** + * @brief Returns true if each integer in Index is less than + * corresponding integer in comparison Index. + * + * @pre getDim() == rhs.getDim() + */ + bool + operator < ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + bool result = true; + for (unsigned int i = 0; result && (i < getDim().getValue()); ++i) { + result = result && (d_index[i] < rhs.d_index[i]); + } + return result; + } + + /** + * @brief Returns true if each integer in Index is less than or equal to + * corresponding integer in comparison Index. + * + * @pre getDim() == rhs.getDim() + */ + bool + operator <= ( + const Index& rhs) const + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + bool result = true; + for (unsigned int i = 0; result && (i < getDim().getValue()); ++i) { + result = result && (d_index[i] <= rhs.d_index[i]); + } + return result; + } + + /** + * @brief Set Index the component-wise minimum of two Index objects. + * + * @pre getDim() == rhs.getDim() + */ + void + min( + const Index& rhs) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + for (dir_t i = 0; i < getDim().getValue(); ++i) { + if (rhs.d_index[i] < d_index[i]) { + d_index[i] = rhs.d_index[i]; + } + } + } + + /** + * @brief Set Index the component-wise maximum of two Index objects. + * + * @pre getDim() == rhs.getDim() + */ + void + max( + const Index& rhs) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + if (rhs.d_index[i] > d_index[i]) { + d_index[i] = rhs.d_index[i]; + } + } + } + /*! * @brief Coarsen the Index by a given ratio. * * For positive indices, this is the same as dividing by the ratio. + * + * @pre getDim() == ratio.getDim() + * @pre rhs.getNumBlocks() == 1 */ Index& coarsen( const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ratio); - for (int d = 0; d < getDim().getValue(); ++d) { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ratio); + TBOX_ASSERT(ratio.getNumBlocks() == 1); + for (unsigned int d = 0; d < getDim().getValue(); ++d) { (*this)(d) = coarsen((*this)(d), ratio(d)); } return *this; @@ -402,26 +697,71 @@ class Index:public IntVector * @brief Coarsen an Index by a given ratio. * * For positive indices, this is the same as dividing by the ratio. + * + * @pre index.getDim() == ratio.getDim() + * @pre rhs.getNumBlocks() == 1 */ static Index coarsen( const Index& index, const IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS2(index, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY2(index, ratio); + TBOX_ASSERT(ratio.getNumBlocks() == 1); tbox::Dimension dim(index.getDim()); Index tmp(dim); - for (int d = 0; d < dim.getValue(); ++d) { + for (unsigned int d = 0; d < dim.getValue(); ++d) { tmp(d) = coarsen(index(d), ratio(d)); } return tmp; } -private: - friend class std::vector; + /*! + * @brief Get the Dimension of the Index + */ + const tbox::Dimension& + getDim() const + { + return d_dim; + } + + /** + * @brief Read an input stream into an Index. + */ + friend std::istream& + operator >> ( + std::istream& s, + Index& rhs); /** - * The default constructor for Index creates an uninitialized index. + * @brief Write an integer index into an output stream. The format for + * the output is (i0,...,in) for an n-dimensional index. + */ + friend std::ostream& + operator << ( + std::ostream& s, + const Index& rhs); + + + /** + * @brief Utility function to take the minimum of two Index objects. + * + * @pre a.getDim() == b.getDim() + */ + static Index + min( + const Index& a, + const Index& b) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(a, b); + Index tmp = a; + tmp.min(b); + return tmp; + } + +private: + /* + * Unimplemented default constructor */ Index(); @@ -451,15 +791,20 @@ class Index:public IntVector static void finalizeCallback(); - static Index* s_zeros[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static Index* s_ones[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static Index* s_zeros[SAMRAI::MAX_DIM_VAL]; + static Index* s_ones[SAMRAI::MAX_DIM_VAL]; - static Index* s_maxs[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static Index* s_mins[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static Index* s_maxs[SAMRAI::MAX_DIM_VAL]; + static Index* s_mins[SAMRAI::MAX_DIM_VAL]; static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; + tbox::Dimension d_dim; + + int d_index[SAMRAI::MAX_DIM_VAL]; + + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.C index 3b1ecba4..e04947c0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.C @@ -3,22 +3,21 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A n-dimensional integer vector * ************************************************************************/ - -#ifndef included_hier_IntVector_C -#define included_hier_IntVector_C - #include "SAMRAI/hier/IntVector.h" + +#include "SAMRAI/hier/Index.h" #include "SAMRAI/tbox/StartupShutdownManager.h" + namespace SAMRAI { namespace hier { -IntVector * IntVector::s_zeros[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; -IntVector * IntVector::s_ones[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +IntVector * IntVector::s_zeros[SAMRAI::MAX_DIM_VAL]; +IntVector * IntVector::s_ones[SAMRAI::MAX_DIM_VAL]; tbox::StartupShutdownManager::Handler IntVector::s_initialize_finalize_handler( @@ -28,120 +27,180 @@ IntVector::s_initialize_finalize_handler( IntVector::finalizeCallback, tbox::StartupShutdownManager::priorityTimers); -IntVector::IntVector(): - d_dim(tbox::Dimension::getInvalidDimension()) + +/* + * ************************************************************************* + * Constructors + * ************************************************************************* + */ + +IntVector::IntVector( + const tbox::Dimension& dim): + d_dim(dim), + d_num_blocks(1), + d_vector(dim.getValue()) { #ifdef DEBUG_INITIALIZE_UNDEFINED - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; i++) { + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { d_vector[i] = tbox::MathUtilities::getMin(); } #endif } IntVector::IntVector( + size_t num_blocks, const tbox::Dimension& dim): - d_dim(dim) + d_dim(dim), + d_num_blocks(num_blocks), + d_vector(dim.getValue()*num_blocks) { - // an explicit setting Invalid is allowed. - TBOX_DIM_ASSERT((!d_dim.isValid()) || - (d_dim >= tbox::Dimension(1) && d_dim <= tbox::Dimension::getMaxDimension())); - + TBOX_ASSERT(num_blocks >=1); #ifdef DEBUG_INITIALIZE_UNDEFINED - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; i++) { + for (unsigned int i = 0; i < num_blocks*dim.getValue(); ++i) { d_vector[i] = tbox::MathUtilities::getMin(); } #endif - } IntVector::IntVector( const tbox::Dimension& dim, - const int value): - d_dim(dim) + int value, + size_t num_blocks): + d_dim(dim), + d_num_blocks(num_blocks), + d_vector(dim.getValue()*num_blocks, value) { - // an explicit setting Invalid is allowed. - TBOX_DIM_ASSERT((!d_dim.isValid()) || - (d_dim >= tbox::Dimension(1) && d_dim <= tbox::Dimension::getMaxDimension())); - - if (d_dim.isValid()) { - for (int i = 0; i < d_dim.getValue(); i++) - d_vector[i] = value; + TBOX_ASSERT(num_blocks >=1); +} -#ifdef DEBUG_INITIALIZE_UNDEFINED - for (int i = d_dim.getValue(); i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; - i++) { - d_vector[i] = tbox::MathUtilities::getMin(); - } -#endif - } else { - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; i++) { - d_vector[i] = tbox::MathUtilities::getMin(); +IntVector::IntVector( + const std::vector& vec, + size_t num_blocks): + d_dim(static_cast(vec.size())), + d_num_blocks(num_blocks), + d_vector(vec.size()*num_blocks) +{ + TBOX_ASSERT(vec.size() >= 1); + for (BlockId::block_t b = 0; b < num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] = vec[i]; } } } IntVector::IntVector( - const tbox::Array& a): - d_dim(static_cast(a.getSize())) + const tbox::Dimension& dim, + const int array[], + size_t num_blocks): + d_dim(dim), + d_num_blocks(num_blocks), + d_vector(dim.getValue()*num_blocks) { - TBOX_DIM_ASSERT(a.getSize() > 1 && - a.getSize() <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); - - for (int i = 0; i < d_dim.getValue(); i++) - d_vector[i] = a[i]; - -#ifdef DEBUG_INITIALIZE_UNDEFINED - for (int i = d_dim.getValue(); i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; i++) { - d_vector[i] = tbox::MathUtilities::getMin(); + for (BlockId::block_t b = 0; b < num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] = array[i]; + } } -#endif } IntVector::IntVector( const IntVector& rhs): - d_dim(rhs.getDim()) + d_dim(rhs.getDim()), + d_num_blocks(rhs.d_num_blocks), + d_vector(rhs.d_vector) { - /* - * STL needs to be able to copy invalid values. - */ - if (rhs.getDim().isValid()) { - TBOX_DIM_ASSERT_CHECK_DIM(rhs.getDim()); + TBOX_ASSERT(d_num_blocks >= 1); +} - for (int i = 0; i < d_dim.getValue(); i++) - d_vector[i] = rhs.d_vector[i]; +IntVector::IntVector( + const IntVector& rhs, + size_t num_blocks): + d_dim(rhs.getDim()), + d_num_blocks(num_blocks), + d_vector(rhs.getDim().getValue() * num_blocks) +{ + TBOX_ASSERT(d_num_blocks >= 1); + TBOX_ASSERT(rhs.d_num_blocks == d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] = rhs.d_vector[i]; + } + } + } else { + d_vector = rhs.d_vector; } } IntVector::IntVector( - const tbox::Dimension& dim, - const int array[]): - d_dim(dim) + const Index& rhs, + size_t num_blocks): + d_dim(rhs.getDim()), + d_num_blocks(num_blocks), + d_vector(rhs.getDim().getValue() * num_blocks) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); - - for (int i = 0; i < d_dim.getValue(); i++) - d_vector[i] = array[i]; + TBOX_ASSERT(d_num_blocks >= 1); + for (BlockId::block_t b = 0; b < num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] = rhs[i]; + } + } } +/* + * ************************************************************************* + * Destructor + * ************************************************************************* + */ IntVector::~IntVector() { } +/* + * ************************************************************************* + * Assignment + * ************************************************************************* + */ +IntVector& +IntVector::operator = ( + const Index& rhs) +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + if (d_num_blocks != 1) { + d_num_blocks = 1; + d_vector.resize(d_dim.getValue()); + } + + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[i] = rhs[i]; + } + return *this; +} + +/* + * ************************************************************************* + * Streaming I/O + * ************************************************************************* + */ std::istream& operator >> ( std::istream& s, IntVector& rhs) { - while (s.get() != '(') ; - - for (int i = 0; i < rhs.getDim().getValue(); i++) { - s >> rhs(i); - if (i < rhs.getDim().getValue() - 1) - while (s.get() != ',') ; + for (BlockId::block_t b = 0; b < rhs.getNumBlocks(); ++b) { + while (s.get() != '(') ; + for (unsigned int i = 0; i < rhs.getDim().getValue(); ++i) { + s >> rhs(b,i); + if (static_cast(i) < rhs.getDim().getValue() - 1) + while (s.get() != ',') ; + } + while (s.get() != ')') ; } - while (s.get() != ')') ; - return s; } @@ -149,74 +208,100 @@ std::ostream& operator << ( std::ostream& s, const IntVector& rhs) { - s << '('; - for (int i = 0; i < rhs.getDim().getValue(); i++) { - s << rhs(i); - if (i < rhs.getDim().getValue() - 1) - s << ","; + for (BlockId::block_t b = 0; b < rhs.getNumBlocks(); ++b) { + s << '('; + for (unsigned int i = 0; i < rhs.getDim().getValue(); ++i) { + s << rhs(b,i); + if (static_cast(i) < rhs.getDim().getValue() - 1) + s << ","; + } + s << ')'; } - s << ')'; return s; } +/* + * ************************************************************************* + * Write/read for restart + * ************************************************************************* + */ void -IntVector::putUnregisteredToDatabase( - tbox::Database& database, +IntVector::putToRestart( + tbox::Database& restart_db, const std::string& name) const { - database.putIntegerArray(name, d_vector, d_dim.getValue()); + boost::shared_ptr intvec_db = + restart_db.putDatabase(name); + intvec_db->putInteger("d_num_blocks", static_cast(d_num_blocks)); + intvec_db->putIntegerVector("d_vector", + d_vector); + } void -IntVector::getFromDatabase( - tbox::Database& database, +IntVector::getFromRestart( + tbox::Database& restart_db, const std::string& name) { - int d = database.getArraySize(name); - d_dim = tbox::Dimension(static_cast(d)); - database.getIntegerArray(name, d_vector, d_dim.getValue()); + boost::shared_ptr intvec_db = + restart_db.getDatabase(name); + + d_num_blocks = static_cast(intvec_db->getInteger("d_num_blocks")); + d_vector = intvec_db->getIntegerVector("d_vector"); + + TBOX_ASSERT(d_num_blocks * d_dim.getValue() == d_vector.size()); + } /* ************************************************************************* - * Sort the sizes of the given IntVector from smallest to largest value. + * Sort the values of the given IntVector from smallest to largest value. ************************************************************************* */ void IntVector::sortIntVector( const IntVector& values) { - const IntVector num_cells = values; - - for (int d = 0; d < d_dim.getValue(); d++) { - d_vector[d] = d; - } - for (int d0 = 0; d0 < d_dim.getValue() - 1; d0++) { - for (int d1 = d0 + 1; d1 < d_dim.getValue(); d1++) { - if (values(d_vector[d0]) > values(d_vector[d1])) { - int tmp_d = d_vector[d0]; - d_vector[d0] = d_vector[d1]; - d_vector[d1] = tmp_d; + for (BlockId::block_t b = 0; b < d_num_blocks; ++b ) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + d_vector[offset + d] = static_cast(d); + } + for (unsigned int d0 = 0; + d0 < static_cast(d_dim.getValue() - 1); ++d0) { + for (unsigned int d1 = d0 + 1; d1 < d_dim.getValue(); ++d1) { + unsigned int v0 = static_cast(d_vector[offset + d0]); + unsigned int v1 = static_cast(d_vector[offset + d1]); + if (values(v0) > values(v1)) { + int tmp_d = d_vector[offset + d0]; + d_vector[offset + d0] = d_vector[offset + d1]; + d_vector[offset + d1] = tmp_d; + } } } - } #ifdef DEBUG_CHECK_ASSERTIONS - for (int d = 0; d < d_dim.getValue() - 1; d++) { - TBOX_ASSERT(values(d_vector[d]) <= values(d_vector[d + 1])); - } + for (unsigned int d = 0; + d < static_cast(d_dim.getValue() - 1); ++d) { + unsigned int v0 = static_cast(d_vector[offset + d]); + unsigned int v1 = static_cast(d_vector[offset + d + 1]); + TBOX_ASSERT(values(v0) <= values(v1)); + } #endif + } } +/* + * ************************************************************************* + * Callback routines + * ************************************************************************* + */ void IntVector::initializeCallback() { - for (unsigned short d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (unsigned short d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { s_zeros[d] = new IntVector(tbox::Dimension(static_cast(d + 1)), 0); - } - - for (unsigned short d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { s_ones[d] = new IntVector(tbox::Dimension(static_cast(d + 1)), 1); } } @@ -224,7 +309,7 @@ IntVector::initializeCallback() void IntVector::finalizeCallback() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { delete s_zeros[d]; delete s_ones[d]; } @@ -232,5 +317,3 @@ IntVector::finalizeCallback() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.h index 7002bcaa..83712f9c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/IntVector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A N-dimensional integer vector * ************************************************************************/ @@ -13,8 +13,8 @@ #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/BlockId.h" #include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Utilities.h" @@ -26,571 +26,927 @@ namespace SAMRAI { namespace hier { -/** - * Class IntVector implements a simple N-dimensional integer - * vector. This class is the base class for most of the simple indexing - * classes. +class Index; + +/*! + * @brief Simple integer vector class with size based on a dimension value + * + * Class IntVector implements a vector of integers that, depending on the usage + * context, has a length equal to the number of spatial dimensions being used + * or its length is the number of dimension multiplied by a certain number of + * blocks. + * + * The integers in IntVector are stored first in order of dimension, and then + * in order of block number. For a 3-dimensional IntVector on 4 blocks, the + * order would be: { i0, j0, k0, i1, j1, k1, i2, j2, k2, i3, j3, k3 }. * + * When used in the context of a single-block problem, the number of blocks + * for an IntVector is always 1. In a multiblock context, the number of + * blocks for an IntVector may be either 1 or the number of blocks being used + * in the problem. */ class IntVector { public: - /** - * Creates an uninitialized vector. + typedef tbox::Dimension::dir_t dir_t; + + /*! + * @brief Creates an uninitialized IntVector for 1 block. + * + * @param dim */ explicit IntVector( const tbox::Dimension& dim); - /** - * Construct an integer vector with all components equal to the argument. + /*! + * @brief Creates an uninitialized IntVector of a given number of blocks. + * + * @pre num_blocks >=1 + * + * @param num_blocks + * @param dim + */ + IntVector( + size_t num_blocks, + const tbox::Dimension& dim); + + /*! + * @brief Construct an IntVector with all components equal to the + * value argument. + * + * @pre num_blocks >=1 + * + * @param dim + * @param value + * @param num_blocks */ IntVector( const tbox::Dimension& dim, - const int i); + int value, + size_t num_blocks = 1); - /** - * Construct a n-dimensional integer vector with the value with - * values provided by the array. + /*! + * @brief Construct an IntVector with the values provided by + * an STL vector of ints. + * + * The dimension of the constructed IntVector will be the size of the + * vec argument. If num_blocks has a value greater than 1, then the + * IntVector will be constructed with the values held by vec duplicated for + * every block. * - * Dimension inferred from array size. + * @pre vec.size() >= 1 + * + * @param vec Vector of integers with a size equal to the desired dimension + * @param num_blocks */ - explicit IntVector( - const tbox::Array& a); + IntVector( + const std::vector& vec, + size_t num_blocks = 1); - /** - * Construct a n-dimensional integer vector with the value with - * values provided by the array. + /*! + * @brief Construct an IntVector with values provided by a raw array. + * + * This constructor assumes that the given array contains a number of values + * equal to the dimension value. As this constructor can do no error- + * checking that the array is properly allocated and initialized, it is + * up to the calling code to ensure that the array argument is valid. * + * If num_blocks has a value greater than 1, then the IntVector + * will be constructed with the values held by array duplicated for every + * block. + * + * @param dim + * @param array Array of ints that should be allocated and initialized + * at a length equal to dim.getValue() + * @param num_blocks */ IntVector( const tbox::Dimension& dim, - const int array[]); + const int array[], + size_t num_blocks = 1); - /** - * Construct an integer vector equal to the argument. + /*! + * @brief Copy constructor. + * + * @pre rhs.getNumBlocks() >= 1 */ IntVector( const IntVector& rhs); - /** - * The assignment operator sets the integer vector equal to the argument. + /*! + * @brief Construct an IntVector from another IntVector. * - * An assignment to an uninitialized Index is allowed but assigning - * from an uninitialized Index will result in an assert. + * The main use case for this constructor is to use an IntVector sized for + * one block to construct an IntVector sized for a larger number of blocks. + * When used in this way, the constructed IntVector will duplicate the + * contents of the argument for every block. + * + * If num_blocks is equal to the rhs argument's number of blocks, then this + * constructor is equivalent to the copy constructor. + * + * @pre num_blocks >=1 + * @pre (rhs.getNumBlocks() == num_blocks || rhs.getNumBlocks() == 1) + * + * @param rhs + * @param num_blocks + */ + IntVector( + const IntVector& rhs, + size_t num_blocks); + + /*! + * @brief Construct an IntVector from an Index. + * + * The constructed IntVector will have the same dimension value as the + * Index. If num_blocks is greater than 1, the values held by the Index + * argument will be duplicated for every block. + * + * @param rhs + * @param num_blocks + * + * @pre num_blocks >=1 + * + * @param rhs + * @param num_blocks + */ + IntVector( + const Index& rhs, + size_t num_blocks = 1); + + /*! + * @brief The assignment operator sets the IntVector equal to the + * argument. + * + * @pre getDim() == rhs.getDim() */ IntVector& operator = ( const IntVector& rhs) { - /* - * Allow assignment of to an uninitialized but do not allow - * assignment from an uninitialized. - */ - if (d_dim.isValid()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - } else { - TBOX_DIM_ASSERT_CHECK_DIM(rhs.getDim()); - d_dim = rhs.getDim(); - } - for (int i = 0; i < d_dim.getValue(); i++) { - d_vector[i] = rhs.d_vector[i]; - } -#ifdef DEBUG_INITIALIZE_UNDEFINED - for (int i = d_dim.getValue(); i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; i++) { - d_vector[i] = tbox::MathUtilities::getMin(); - } -#endif + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + d_num_blocks = rhs.d_num_blocks; + d_vector = rhs.d_vector; + return *this; } - /** - * The integer vector destructor does nothing interesting. + /*! + * @brief Assignment operator assigning the values of an Index to an + * IntVector. + * + * The assigned IntVector will be sized for one block. + * + * @pre getDim() == rhs.getDim() + */ + IntVector& + operator = ( + const Index& rhs); + + /*! + * @brief The IntVector destructor does nothing interesting. */ virtual ~IntVector(); - /** - * Return the specified component of the vector. No bounds checking. + /*! + * @brief Return the number of blocks for this IntVector + */ + size_t getNumBlocks() const + { + return d_num_blocks; + } + + /*! + * @brief Return an IntVector for one block extracted from a possibly + * larger IntVector + * + * This constructs an IntVector sized for one block using the int values + * associated with a given block. The constructed IntVector is returned + * by value. + * + * @pre block_id.getBlockValue() < getNumBlocks() + * + * @param block_id BlockId indicates which block is associated with + * the desired integer values. + * + * @return A constructed IntVector sized for one block + */ + IntVector getBlockVector(const BlockId& block_id) const + { + TBOX_ASSERT(block_id.getBlockValue() < d_num_blocks); + IntVector block_vec(d_dim, + &(d_vector[block_id.getBlockValue()*d_dim.getValue()])); + + return block_vec; + } + + /*! + * @brief Return reference to the specified component of the vector. This + * can only be used when the number of blocks is 1. + * + * @pre (i >= 0) && (i < getDim().getValue()) + * @pre getNumBlocks() == 1 */ int& operator [] ( - const int i) + const unsigned int i) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - TBOX_ASSERT(i >= 0 && i < d_dim.getValue()); + TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(d_num_blocks == 1); return d_vector[i]; } - /** - * Return the specified component of the vector as a const integer. - * No bounds checking. + /*! + * @brief Return the specified component of the vector as a const integer + * reference. This can only be used when the number of blocks is 1. + * + * @pre (i >= 0) && (i < getDim().getValue()) + * @pre getNumBlocks() == 1 */ const int& operator [] ( - const int i) const + const unsigned int i) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - TBOX_ASSERT(i >= 0 && i < d_dim.getValue()); + TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(d_num_blocks == 1); return d_vector[i]; } - - /** - * Return the specified component of the vector. No bounds checking. + /*! + * @brief Return reference to the specified component of the vector. This + * can only be used when the number of blocks is 1. + * + * @pre (i >= 0) && (i < getDim().getValue()) + * @pre getNumBlocks() == 1 */ int& operator () ( - const int i) + const unsigned int i) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - TBOX_ASSERT(i >= 0 && i < d_dim.getValue()); + TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(d_num_blocks == 1); return d_vector[i]; } - /** - * Return the specified component of the vector as a const integer. - * No bounds checking. + /*! + * @brief Return the specified component of the vector as a const integer + * reference. This can only be used when the number of blocks is 1. + * + * @pre (i >= 0) && (i < getDim().getValue()) + * @pre getNumBlocks() == 1 */ const int& operator () ( - const int i) const + const unsigned int i) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - TBOX_ASSERT(i >= 0 && i < d_dim.getValue()); + TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(d_num_blocks == 1); return d_vector[i]; } - /** - * Plus-equals operator for two integer vectors. + /*! + * @brief Return the specified component of the vector. + * + * @pre (b >= 0) && (b < getNumBlocks()) + * @pre (i >= 0) && (i < getDim().getValue()) + * + * The desired component is specified by the pair of the block number b + * and the dimensional index i. + */ + int& + operator () ( + const BlockId::block_t b, + const unsigned int i) + { + TBOX_ASSERT(b < d_num_blocks); + TBOX_ASSERT(i < d_dim.getValue()); + return d_vector[b*d_dim.getValue() + i]; + } + + /*! + * @brief Return the specified component of the vector as a const integer + * reference + * + * @pre (b >= 0) && (b < getNumBlocks()) + * @pre (i >= 0) && (i < getDim().getValue()) + * + * The desired component is specified by the pair of the block number b + * and the dimensional index i. + */ + const int& + operator () ( + const BlockId::block_t b, + const unsigned int i) const + { + TBOX_ASSERT(b < d_num_blocks); + TBOX_ASSERT(i < d_dim.getValue()); + return d_vector[b*d_dim.getValue() + i]; + } + + /*! + * @brief Plus-equals operator for two integer vectors. + * + * The following comments apply to most of the arithmetic operators and + * some related methods: + * + * The arithmetic operators and related methods such as ceilingDivide + * allow both full component-wise operations on IntVectors that have equal + * numbers of blocks, as well as operations between multiblock IntVectors and + * single-block IntVectors + * + * When an operator is invoked on a multiblock IntVector with a right-hand- + * side single-block IntVector, the values within the right-hand-side are + * applied to every block within the "this" IntVector. + * + * Assertion failures occur if operations are called using two multiblock + * IntVectors that have different numbers of blocks, or if the + * right-hand-side is a multiblock IntVector while "this" is single-block. + * + * There also are some operators that take a single integer as a right- + * hand-side, in which case that integer value is applied in the operation + * to every component of "this". + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ IntVector& operator += ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - d_vector[i] += rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] += rhs.d_vector[i]; + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + d_vector[i] += rhs.d_vector[i]; + } } return *this; } - /** - * Plus operator for two integer vectors. + /*! + * @brief Plus operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() */ IntVector operator + ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); IntVector tmp(*this); tmp += rhs; return tmp; } - /** - * Plus-equals operator for an integer vector and an integer. + /*! + * @brief Plus-equals operator for an integer vector and an integer. */ IntVector& operator += ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { d_vector[i] += rhs; } return *this; } - /** - * Plus operator for an integer vector and an integer. + /*! + * @brief Plus operator for an integer vector and an integer. */ IntVector operator + ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - IntVector tmp = *this; + IntVector tmp(*this); tmp += rhs; return tmp; } - /** - * Minus-equals operator for two integer vectors. + /*! + * @brief Minus-equals operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 + * */ IntVector& operator -= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - d_vector[i] -= rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] -= rhs.d_vector[i]; + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + d_vector[i] -= rhs.d_vector[i]; + } } return *this; } - /** - * Minus operator for two integer vectors. + /*! + * @brief Minus operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() */ IntVector operator - ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector tmp = *this; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + IntVector tmp(*this); tmp -= rhs; return tmp; } - /** - * Minus-equals operator for an integer vector and an integer. + /*! + * @brief Minus-equals operator for an integer vector and an integer. */ IntVector& operator -= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { d_vector[i] -= rhs; } return *this; } - /** - * Minus operator for an integer vector and an integer. + /*! + * @brief Minus operator for an integer vector and an integer. */ IntVector operator - ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - IntVector tmp = *this; + IntVector tmp(*this); tmp -= rhs; return tmp; } - /** - * Times-equals operator for two integer vectors. + /*! + * @brief Times-equals operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 + * */ IntVector& operator *= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - d_vector[i] *= rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] *= rhs.d_vector[i]; + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + d_vector[i] *= rhs.d_vector[i]; + } } return *this; } - /** - * Times operator for two integer vectors. + /*! + * @brief Times operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() */ IntVector operator * ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector tmp = *this; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + IntVector tmp(*this); tmp *= rhs; return tmp; } - /** - * Times-equals operator for an integer vector and an integer. + /*! + * @brief Times-equals operator for an integer vector and an integer. */ IntVector& operator *= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { d_vector[i] *= rhs; } return *this; } - /** - * Times operator for an integer vector and an integer. + /*! + * @brief Times operator for an integer vector and an integer. */ IntVector operator * ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - IntVector tmp = *this; + IntVector tmp(*this); tmp *= rhs; return tmp; } - /** - * Assign-quotient operator for two integer vectors. + /*! + * @brief Quotient-equals operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ IntVector& operator /= ( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - d_vector[i] /= rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] /= rhs.d_vector[i]; + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + d_vector[i] /= rhs.d_vector[i]; + } } return *this; } - /** - * Component-wise ceilingDivide quotient (integer divide with rounding up). - */ - void - ceilingDivide( - const IntVector& denominator) - { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, denominator); - for (int i = 0; i < getDim().getValue(); i++) { - /* - * This is the formula for integer divide, rounding away from - * zero. It is meant as an extension of the ceilingDivide quotient of - * 2 positive integers. - * - * The ceilingDivide is the integer divide plus 0, -1 or 1 representing - * the results of rounding. - * - Add zero if there's no remainder to round. - * - Round remainder to 1 if numerator and denominator has same sign. - * - Round remainder to -1 if numerator and denominator has opposite sign. - */ - d_vector[i] = (d_vector[i] / denominator[i]) + - ((d_vector[i] % denominator[i]) ? - ((d_vector[i] > 0) == (denominator[i] > 0) ? 1 : -1) : 0); - } - } - - /** - * Component-wise ceilingDivide quotient (integer divide with rounding up). - */ - static IntVector - ceilingDivide( - const IntVector& numerator, - const IntVector& denominator) - { - TBOX_DIM_ASSERT_CHECK_ARGS2(numerator, denominator); - IntVector rval(numerator.getDim()); - for (int i = 0; i < numerator.getDim().getValue(); i++) { - /* - * This is the formula for integer divide, rounding away from - * zero. It is meant as an extension of the ceilingDivide quotient of - * 2 positive integers. - * - * The ceilingDivide is the integer divide plus 0, -1 or 1 representing - * the results of rounding. - * - Add zero if there's no remainder to round. - * - Round remainder to 1 if numerator and denominator has same sign. - * - Round remainder to -1 if numerator and denominator has opposite sign. - */ - rval[i] = (numerator[i] / denominator[i]) + - ((numerator[i] % denominator[i]) ? - ((numerator[i] > 0) == (denominator[i] > 0) ? 1 : -1) : 0); - } - return rval; - } - - /** - * Quotient operator for two integer vectors. + /*! + * @brief Quotient operator for two integer vectors. + * + * @pre getDim() == rhs.getDim() */ IntVector operator / ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - IntVector tmp = *this; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + IntVector tmp(*this); tmp /= rhs; return tmp; } - /** - * Assign-quotient operator for an integer vector and an integer. + /*! + * @brief Quotient-equals operator for an integer vector and an integer. */ IntVector& operator /= ( const int rhs) { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { d_vector[i] /= rhs; } return *this; } - /** - * Quotient operator for an integer vector and an integer. + /*! + * @brief Quotient operator for an integer vector and an integer. */ IntVector operator / ( const int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - IntVector tmp = *this; + IntVector tmp(*this); tmp /= rhs; return tmp; } - /** - * Unary minus to negate an integer vector. + + /*! + * @brief Component-wise ceilingDivide quotient (integer divide with + * rounding up). + * + * @pre getDim() == denominator.getDim() + * @pre getNumBlocks() == denominator.getNumBlocks() || denominator.getNumBlocks() == 1 + */ + void + ceilingDivide( + const IntVector& denominator) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, denominator); + TBOX_ASSERT(d_num_blocks == denominator.d_num_blocks || + denominator.d_num_blocks == 1); + + /* + * This is the formula for integer divide, rounding away from + * zero. It is meant as an extension of the ceilingDivide quotient of + * 2 positive integers. + * + * The ceilingDivide is the integer divide plus 0, -1 or 1 representing + * the results of rounding. + * - Add zero if there's no remainder to round. + * - Round remainder to 1 if numerator and denominator has same sign. + * - Round remainder to -1 if numerator and denominator has opposite sign. + */ + if (denominator.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + d_vector[offset + i] = (d_vector[offset + i] / denominator[i]) + + ((d_vector[offset + i] % denominator[i]) ? + ((d_vector[offset + i] > 0) == (denominator[i] > 0) ? 1 : -1) : 0); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + d_vector[i] = (d_vector[i] / denominator.d_vector[i]) + + ((d_vector[i] % denominator.d_vector[i]) ? + ((d_vector[i] > 0) == (denominator.d_vector[i] > 0) ? 1 : -1) : 0); + } + } + } + + /*! + * @brief Component-wise ceilingDivide quotient (integer divide with + * rounding up). + * + * @pre numerator.getDim() == denominator.getDim() + * @pre numerator.getNumBlocks() == denominator.getNumBlocks() || denominator.getNumBlocks() == 1 + */ + static IntVector + ceilingDivide( + const IntVector& numerator, + const IntVector& denominator) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(numerator, denominator); + TBOX_ASSERT(numerator.d_num_blocks == denominator.d_num_blocks || + denominator.d_num_blocks == 1); + IntVector rval(numerator); + rval.ceilingDivide(denominator); + return rval; + } + + /*! + * @brief Unary minus to negate an integer vector. */ IntVector operator - () const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - IntVector tmp(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { - tmp.d_vector[i] = -d_vector[i]; - } + IntVector tmp(*this); + tmp *= -1; return tmp; } - /** - * Returns true if all components are equal to a given integer. + /*! + * @brief Returns true if all components are equal to a given integer. */ bool operator == ( int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { result = d_vector[i] == rhs; } return result; } - /** - * Returns true if some components are not equal to a given integer. + /*! + * @brief Returns true if some components are not equal to a given integer. */ bool operator != ( int rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); - bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = d_vector[i] != rhs; - } - return result; + return !(*this == rhs); } - /** - * Returns true if two vector objects are equal. All components - * must be the same for equality. + /*! + * @brief Returns true if two vector objects are equal. All components + * must be the same for equality. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ bool operator == ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = result && (d_vector[i] == rhs.d_vector[i]); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; result && b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; result && (i < d_dim.getValue()); ++i) { + result = result && (d_vector[offset + i] == rhs.d_vector[i]); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { + result = result && (d_vector[i] == rhs.d_vector[i]); + } } return result; } - /** - * Returns true if two vector objects are not equal. Any of - * the components may be different for inequality. + /*! + * @brief Returns true if two vector objects are not equal. Any of + * the components may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return !(*this == rhs); } - /** - * Returns true if each integer in vector is less than - * corresponding integer in comparison vector. + /*! + * @brief Returns true if each integer in vector is less than + * corresponding integer in comparison vector. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ bool operator < ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = result && (d_vector[i] < rhs.d_vector[i]); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; result && b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; result && (i < d_dim.getValue()); ++i) { + result = result && (d_vector[offset + i] < rhs.d_vector[i]); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { + result = result && (d_vector[i] < rhs.d_vector[i]); + } } return result; } - /** - * Returns true if each integer in vector is less or equal to - * corresponding integer in comparison vector. + /*! + * @brief Returns true if each integer in vector is less or equal to + * corresponding integer in comparison vector. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ bool operator <= ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = result && (d_vector[i] <= rhs.d_vector[i]); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; result && b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; result && (i < d_dim.getValue()); ++i) { + result = result && (d_vector[offset + i] <= rhs.d_vector[i]); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { + result = result && (d_vector[i] <= rhs.d_vector[i]); + } } return result; } - /** - * Returns true if each integer in vector is greater than - * corresponding integer in comparison vector. + /*! + * @brief Returns true if each integer in vector is greater than + * corresponding integer in comparison vector. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ bool operator > ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = result && (d_vector[i] > rhs.d_vector[i]); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; result && b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; result && (i < d_dim.getValue()); ++i) { + result = result && (d_vector[offset + i] > rhs.d_vector[i]); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { + result = result && (d_vector[i] > rhs.d_vector[i]); + } } return result; } - /** - * Returns true if each integer in vector is greater or equal to - * corresponding integer in comparison vector. + /*! + * @brief Returns true if each integer in vector is greater or equal to + * corresponding integer in comparison vector. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ bool operator >= ( const IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); bool result = true; - for (int i = 0; result && (i < d_dim.getValue()); i++) { - result = result && (d_vector[i] >= rhs.d_vector[i]); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; result && b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; result && (i < d_dim.getValue()); ++i) { + result = result && (d_vector[offset + i] >= rhs.d_vector[i]); + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; result && (i < length); ++i) { + result = result && (d_vector[i] >= rhs.d_vector[i]); + } } return result; } - /** - * Return the component-wise minimum of two integer vector objects. + /*! + * @brief Return the component-wise minimum of two integer vector objects. + * + * @pre getDim() == rhs.getDim() + * @pre getNumBlocks() == rhs.getNumBlocks() || rhs.getNumBlocks() == 1 */ void min( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - if (rhs.d_vector[i] < d_vector[i]) { - d_vector[i] = rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + if (rhs.d_vector[i] < d_vector[offset + i]) { + d_vector[offset + i] = rhs.d_vector[i]; + } + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + if (rhs.d_vector[i] < d_vector[i]) { + d_vector[i] = rhs.d_vector[i]; + } } } } - /** - * Return the minimum entry in an integer vector. + /*! + * @brief Return the minimum entry in an integer vector. */ int min() const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); int min = d_vector[0]; - for (int i = 1; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { if (d_vector[i] < min) { min = d_vector[i]; } @@ -598,30 +954,43 @@ class IntVector return min; } - /** - * Return the component-wise maximum of two integer vector objects. + /*! + * @brief Return the component-wise maximum of two integer vector objects. */ void max( const IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); - for (int i = 0; i < d_dim.getValue(); i++) { - if (rhs.d_vector[i] > d_vector[i]) { - d_vector[i] = rhs.d_vector[i]; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); + TBOX_ASSERT(d_num_blocks == rhs.d_num_blocks || rhs.d_num_blocks == 1); + if (rhs.d_num_blocks == 1 && d_num_blocks != 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + if (rhs.d_vector[i] > d_vector[offset + i]) { + d_vector[offset + i] = rhs.d_vector[i]; + } + } + } + } else { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { + if (rhs.d_vector[i] > d_vector[i]) { + d_vector[i] = rhs.d_vector[i]; + } } } } - /** - * Return the maximum entry in an integer vector. + /*! + * @brief Return the maximum entry in an integer vector. */ int max() const { - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); int max = d_vector[0]; - for (int i = 1; i < d_dim.getValue(); i++) { + size_t length = d_num_blocks * d_dim.getValue(); + for (unsigned int i = 0; i < length; ++i) { if (d_vector[i] > max) { max = d_vector[i]; } @@ -629,69 +998,121 @@ class IntVector return max; } - /** - * Utility function to take the minimum of two integer vector objects. + /*! + * @brief Utility function to take the minimum of two integer vector + * objects. + * + * @pre a.getDim() == b.getDim() */ static IntVector min( const IntVector& a, const IntVector& b) { - TBOX_DIM_ASSERT_CHECK_ARGS2(a, b); - IntVector tmp = a; + TBOX_ASSERT_OBJDIM_EQUALITY2(a, b); + IntVector tmp(a); tmp.min(b); return tmp; } - /** - * Utility function to take the maximum of two integer vector objects. + /*! + * @brief Utility function to take the maximum of two integer vector + * objects. + * + * @pre a.getDim() == b.getDim() */ static IntVector max( const IntVector& a, const IntVector& b) { - TBOX_DIM_ASSERT_CHECK_ARGS2(a, b); - IntVector tmp = a; + TBOX_ASSERT_OBJDIM_EQUALITY2(a, b); + IntVector tmp(a); tmp.max(b); return tmp; } - /** - * Return the product of the entries in the integer vector. + /*! + * @brief Set all block-wise components of an IntVector. + * + * If this IntVector and the argument IntVector are sized for the same + * number of blocks, this is the equivalent of a copy operation. If this + * IntVector is multiblock while the argument is single-block, then + * the values of the argument are copied to each block-wise component of + * this IntVector. + * + * An error will occur if the numbers of blocks are unequal and the argument + * IntVector is not single-block. + * + * @param vector Input IntVector */ - int - getProduct() const + void setAll(const IntVector& vector) + { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, vector); + if (vector.d_num_blocks == d_num_blocks) { + *this = vector; + } else if (d_num_blocks > 1 && vector.d_num_blocks == 1) { + for (BlockId::block_t b = 0; b < d_num_blocks; ++b) { + unsigned int offset = b*d_dim.getValue(); + for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + d_vector[offset + d] = vector[d]; + } + } + } else { + TBOX_ERROR("IntVector::setAll() attempted with argument of non-compatible num_blocks." << std::endl); + } + } + + /*! + * @brief Return the product of the entries in the integer vector + * + * If a BlockId argument is provided, the product of entries for that + * block will be computed. If no BlockId argument is provided, this + * IntVector must be single-block. + * + * @param block_id Optional block on which to compute the product. + */ + long int + getProduct(const BlockId& block_id = BlockId::invalidId()) const { - int prod = 1; - for (int i = 0; i < d_dim.getValue(); i++) { - prod *= d_vector[i]; +#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(block_id == BlockId::invalidId() || + block_id.getBlockValue() < d_num_blocks); + if (block_id == BlockId::invalidId()) { + TBOX_ASSERT(d_num_blocks == 1); + } +#endif + BlockId::block_t b = block_id == BlockId::invalidId() ? 0 : block_id.getBlockValue(); + unsigned int offset = b * d_dim.getValue(); + long int prod = 1; + for (unsigned int i = 0; i < getDim().getValue(); ++i) { + prod *= d_vector[offset + i]; } return prod; } - /** - * Store the object state to the specified database - * with the provided name. + /*! + * @brief Store the object state to the specified restart database + * with the provided name. * */ virtual void - putUnregisteredToDatabase( - tbox::Database& database, + putToRestart( + tbox::Database& restart_db, const std::string& name) const; - /** - * Restores the object state from the specified database - * with the provided name. + /*! + * @brief Restores the object giving it the provided name and getting its + * state from the specified restart database. * */ virtual void - getFromDatabase( - tbox::Database& database, + getFromRestart( + tbox::Database& restart_db, const std::string& name); - /** - * Return the dimension of this object. + /*! + * @brief Return the dimension of this object. */ const tbox::Dimension& getDim() const @@ -702,7 +1123,8 @@ class IntVector /*! * @brief Return an IntVector of zeros of the specified dimension. * - * Can be used to avoid object creation overheads. + * Can be used to avoid object creation overheads. The + * returned IntVector is sized for one block. */ static const IntVector& getZero( @@ -714,7 +1136,8 @@ class IntVector /*! * @brief Return an IntVector of ones of the specified dimension. * - * Can be used to avoid object creation overheads. + * Can be used to avoid object creation overheads. The + * returned IntVector is sized for one block. */ static const IntVector& getOne( @@ -723,46 +1146,46 @@ class IntVector return *(s_ones[dim.getValue() - 1]); } - /* - * @brief Sort the given IntVector the smallest to the largest value. + /*! + * @brief Set this IntVector to a sorted version of the given IntVector * - * Set the ith entry of this to the position of the ith largest - * value in the given IntVector. + * For an single-block IntVector, set the ith entry of this to the + * position of the ith smallest value in the argument IntVector. + * + * If the IntVectors are multilbock, each section of the IntVector + * associated with a block is sorted independently. */ void sortIntVector( const IntVector& values); - /** - * Read an integer vector from an input stream. The format for - * the input is (i0,...,in) for an n-dimensional vector. + /*! + * @brief Read an integer vector from an input stream. The format for + * the input is (i0,...,in) for an n-dimensional vector. */ friend std::istream& operator >> ( std::istream& s, IntVector& rhs); - /** - * Write an integer vector into an output stream. The format for - * the output is (i0,...,in) for an n-dimensional vector. + /*! + * @brief Write an integer vector into an output stream. The format for + * the output is (i0,...,in) for an n-dimensional vector. */ friend std::ostream& operator << ( std::ostream& s, const IntVector& rhs); - friend class std::vector; +private: -protected: - /** - * Default ctor for IntVector is protected to disallow normal use. - * This is needed by the poorly designed STL container library. - * - * + typedef struct MaxIntArray { int d_array[3]; } MaxIntArray; + + /* + * Unimplemented default constructor */ IntVector(); -private: /*! * @brief Initialize static objects and register shutdown routine. * @@ -782,10 +1205,12 @@ class IntVector tbox::Dimension d_dim; - int d_vector[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + size_t d_num_blocks; + + std::vector d_vector; - static IntVector* s_zeros[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static IntVector* s_ones[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static IntVector* s_zeros[SAMRAI::MAX_DIM_VAL]; + static IntVector* s_ones[SAMRAI::MAX_DIM_VAL]; static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.C index 2907c6f8..d88631b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generic identifier used on a single process. * ************************************************************************/ - -#ifndef included_hier_LocalId_C -#define included_hier_LocalId_C - #include "SAMRAI/hier/LocalId.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -70,10 +66,13 @@ operator << ( std::ostream& co, const LocalId& r) { - co << r.d_value; + if (r.isValid()) { + co << r.d_value; + } else { + co << 'X'; + } return co; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.h index a7d8815c..3fff99fa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/LocalId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generic identifier used on a single process. * ************************************************************************/ @@ -104,6 +104,15 @@ class LocalId return d_value; } + /*! + * @brief Whether value is a valid one (not equal to getInvalidId()). + */ + bool + isValid() const + { + return d_value != s_invalid_id.getValue(); + } + /*! * @brief Get the LocalId with a numerical value of zero. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.depend index 86be0457..f3463de3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -11,8 +11,106 @@ ## This file is automatically generated by depend.pl. -FILE_0=BaseConnectorAlgorithm.o +FILE_0=AssumedPartition.o DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartition.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h AssumedPartition.C + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=AssumedPartitionBox.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h AssumedPartitionBox.C + +DEPENDS_1 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=BaseConnectorAlgorithm.o +DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -42,6 +140,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ @@ -50,7 +149,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -63,8 +161,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -73,17 +171,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BaseConnectorAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} -FILE_1=BaseGridGeometry.o -DEPENDS_1:=\ +${FILE_2}: ${DEPENDS_2} + +FILE_3=BaseGridGeometry.o +DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -118,13 +214,13 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SingularityFinder.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -136,8 +232,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -147,37 +243,31 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BaseGridGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=BlockId.o -DEPENDS_2:=\ +${FILE_3}: ${DEPENDS_3} + +FILE_4=BlockId.o +DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BlockId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=BoundaryBox.o -DEPENDS_3:=\ +${FILE_4}: ${DEPENDS_4} + +FILE_5=BoundaryBox.o +DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -189,8 +279,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -200,21 +290,18 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoundaryBox.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} -FILE_4=BoundaryBoxUtils.o -DEPENDS_4:=\ +${FILE_5}: ${DEPENDS_5} + +FILE_6=BoundaryBoxUtils.o +DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -226,8 +313,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -237,25 +324,22 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoundaryBoxUtils.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} -FILE_5=BoundaryLookupTable.o -DEPENDS_5:=\ +${FILE_6}: ${DEPENDS_6} + +FILE_7=BoundaryLookupTable.o +DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryLookupTable.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -264,20 +348,17 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoundaryLookupTable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=Box.o -DEPENDS_6:=\ +${FILE_7}: ${DEPENDS_7} + +FILE_8=Box.o +DEPENDS_8:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -289,7 +370,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -299,21 +379,18 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Box.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} -FILE_7=BoxContainer.o -DEPENDS_7:=\ +${FILE_8}: ${DEPENDS_8} + +FILE_9=BoxContainer.o +DEPENDS_9:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -349,7 +426,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -360,24 +436,22 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxContainer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=BoxContainerSingleBlockIterator.o -DEPENDS_8:=\ +${FILE_9}: ${DEPENDS_9} + +FILE_10=BoxContainerSingleBlockIterator.o +DEPENDS_10:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -391,8 +465,8 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -403,23 +477,20 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ BoxContainerSingleBlockIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=BoxContainerSingleOwnerIterator.o -DEPENDS_9:=\ +${FILE_10}: ${DEPENDS_10} + +FILE_11=BoxContainerSingleOwnerIterator.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -433,8 +504,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -445,62 +516,32 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ BoxContainerSingleOwnerIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} -FILE_10=BoxContainerUtils.o -DEPENDS_10:=\ +${FILE_11}: ${DEPENDS_11} + +FILE_12=BoxContainerUtils.o +DEPENDS_12:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerUtils.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -511,8 +552,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ @@ -520,16 +559,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxContainerUtils.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=BoxGeometry.o -DEPENDS_11:=\ +${FILE_12}: ${DEPENDS_12} + +FILE_13=BoxGeometry.o +DEPENDS_13:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -544,8 +581,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -556,22 +593,19 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} -FILE_12=BoxId.o -DEPENDS_12:=\ +${FILE_13}: ${DEPENDS_13} + +FILE_14=BoxId.o +DEPENDS_14:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ @@ -585,15 +619,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ +DEPENDS_14 +=\ -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=BoxLevel.o -DEPENDS_13:=\ +${FILE_14}: ${DEPENDS_14} + +FILE_15=BoxLevel.o +DEPENDS_15:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -633,7 +666,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -644,8 +676,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -654,16 +686,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxLevel.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} -FILE_14=BoxLevelConnectorUtils.o -DEPENDS_14:=\ +${FILE_15}: ${DEPENDS_15} + +FILE_16=BoxLevelConnectorUtils.o +DEPENDS_16:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -686,6 +716,7 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -706,7 +737,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -716,11 +746,14 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -729,17 +762,15 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxLevelConnectorUtils.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_14 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} -FILE_15=BoxLevelHandle.o -DEPENDS_15:=\ +${FILE_16}: ${DEPENDS_16} + +FILE_17=BoxLevelHandle.o +DEPENDS_17:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -766,6 +797,7 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ @@ -774,7 +806,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -785,8 +816,8 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -795,16 +826,14 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxLevelHandle.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_15 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} -FILE_16=BoxLevelStatistics.o -DEPENDS_16:=\ +${FILE_17}: ${DEPENDS_17} + +FILE_18=BoxLevelStatistics.o +DEPENDS_18:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -832,6 +861,7 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -841,7 +871,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -852,8 +881,8 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -862,16 +891,14 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxLevelStatistics.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_16 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} -FILE_17=BoxNeighborhoodCollection.o -DEPENDS_17:=\ +${FILE_18}: ${DEPENDS_18} + +FILE_19=BoxNeighborhoodCollection.o +DEPENDS_19:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -885,8 +912,8 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -897,30 +924,26 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ BoxNeighborhoodCollection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_17 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} -FILE_18=BoxOverlap.o -DEPENDS_18:=\ +${FILE_19}: ${DEPENDS_19} + +FILE_20=BoxOverlap.o +DEPENDS_20:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -929,20 +952,17 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_18 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} -FILE_19=BoxTree.o -DEPENDS_19:=\ +${FILE_20}: ${DEPENDS_20} + +FILE_21=BoxTree.o +DEPENDS_21:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -955,8 +975,8 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -967,7 +987,6 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ @@ -977,31 +996,48 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxTree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_19 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} -FILE_20=BoxUtilities.o -DEPENDS_20:=\ +${FILE_21}: ${DEPENDS_21} + +FILE_22=BoxUtilities.o +DEPENDS_22:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1011,24 +1047,23 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxUtilities.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_20 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} -FILE_21=CoarseFineBoundary.o -DEPENDS_21:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ +${FILE_22}: ${DEPENDS_22} + +FILE_23=CoarseFineBoundary.o +DEPENDS_23:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1062,16 +1097,17 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1082,8 +1118,8 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1092,16 +1128,14 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CoarseFineBoundary.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_21 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} -FILE_22=CoarsenOperator.o -DEPENDS_22:=\ +${FILE_23}: ${DEPENDS_23} + +FILE_24=CoarsenOperator.o +DEPENDS_24:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1125,11 +1159,11 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1139,26 +1173,23 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CoarsenOperator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_22 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} -FILE_23=ComponentSelector.o -DEPENDS_23:=\ +${FILE_24}: ${DEPENDS_24} + +FILE_25=ComponentSelector.o +DEPENDS_25:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1167,22 +1198,19 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ComponentSelector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_23 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} -FILE_24=Connector.o -DEPENDS_24:=\ +${FILE_25}: ${DEPENDS_25} + +FILE_26=Connector.o +DEPENDS_26:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1196,6 +1224,7 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -1214,6 +1243,7 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -1221,8 +1251,8 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1232,8 +1262,10 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1242,16 +1274,14 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Connector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_24 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} -FILE_25=ConnectorStatistics.o -DEPENDS_25:=\ +${FILE_26}: ${DEPENDS_26} + +FILE_27=ConnectorStatistics.o +DEPENDS_27:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1281,6 +1311,7 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ @@ -1289,7 +1320,6 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1300,8 +1330,8 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1310,16 +1340,89 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ConnectorStatistics.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_25 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_25:X.o=${NDIM}.o}: ${DEPENDS_25} -FILE_26=GlobalId.o -DEPENDS_26:=\ +${FILE_27}: ${DEPENDS_27} + +FILE_28=FlattenedHierarchy.o +DEPENDS_28:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/FlattenedHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FlattenedHierarchy.C + +DEPENDS_28 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_28}: ${DEPENDS_28} + +FILE_29=GlobalId.o +DEPENDS_29:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ @@ -1330,19 +1433,91 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h GlobalId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_26 +=\ +DEPENDS_29 +=\ -endif -${FILE_26:X.o=${NDIM}.o}: ${DEPENDS_26} -FILE_27=Index.o -DEPENDS_27:=\ +${FILE_29}: ${DEPENDS_29} + +FILE_30=HierarchyNeighbors.o +DEPENDS_30:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HierarchyNeighbors.C + +DEPENDS_30 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_30}: ${DEPENDS_30} + +FILE_31=Index.o +DEPENDS_31:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1351,23 +1526,21 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Index.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_27 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_31 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_27:X.o=${NDIM}.o}: ${DEPENDS_27} -FILE_28=IntVector.o -DEPENDS_28:=\ +${FILE_31}: ${DEPENDS_31} + +FILE_32=IntVector.o +DEPENDS_32:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1376,41 +1549,98 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h IntVector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_28 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_32 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_28:X.o=${NDIM}.o}: ${DEPENDS_28} -FILE_29=LocalId.o -DEPENDS_29:=\ +${FILE_32}: ${DEPENDS_32} + +FILE_33=LocalId.o +DEPENDS_33:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h LocalId.C + +DEPENDS_33 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_33}: ${DEPENDS_33} + +FILE_34=MappingConnector.o +DEPENDS_34:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h LocalId.C + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MappingConnector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_29 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_29:X.o=${NDIM}.o}: ${DEPENDS_29} -FILE_30=MappingConnectorAlgorithm.o -DEPENDS_30:=\ +${FILE_34}: ${DEPENDS_34} + +FILE_35=MappingConnectorAlgorithm.o +DEPENDS_35:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1426,6 +1656,7 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -1433,9 +1664,9 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1443,6 +1674,7 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1452,7 +1684,6 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1468,8 +1699,8 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1479,17 +1710,15 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ MappingConnectorAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_30 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_35 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_30:X.o=${NDIM}.o}: ${DEPENDS_30} -FILE_31=MultiblockBoxTree.o -DEPENDS_31:=\ +${FILE_35}: ${DEPENDS_35} + +FILE_36=MultiblockBoxTree.o +DEPENDS_36:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1514,6 +1743,7 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -1521,7 +1751,6 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1532,25 +1761,25 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MultiblockBoxTree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_31 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_36 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_31:X.o=${NDIM}.o}: ${DEPENDS_31} -FILE_32=OverlapConnectorAlgorithm.o -DEPENDS_32:=\ +${FILE_36}: ${DEPENDS_36} + +FILE_37=OverlapConnectorAlgorithm.o +DEPENDS_37:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartition.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1565,6 +1794,7 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -1583,7 +1813,6 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -1591,7 +1820,6 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1607,8 +1835,8 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1618,17 +1846,15 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OverlapConnectorAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_32 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_32:X.o=${NDIM}.o}: ${DEPENDS_32} -FILE_33=Patch.o -DEPENDS_33:=\ +${FILE_37}: ${DEPENDS_37} + +FILE_38=Patch.o +DEPENDS_38:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1648,14 +1874,15 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1666,22 +1893,19 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Patch.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_33 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_38 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_33:X.o=${NDIM}.o}: ${DEPENDS_33} -FILE_34=PatchBoundaries.o -DEPENDS_34:=\ +${FILE_38}: ${DEPENDS_38} + +FILE_39=PatchBoundaries.o +DEPENDS_39:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1693,8 +1917,8 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1704,21 +1928,18 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchBoundaries.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_34 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_34:X.o=${NDIM}.o}: ${DEPENDS_34} -FILE_35=PatchData.o -DEPENDS_35:=\ +${FILE_39}: ${DEPENDS_39} + +FILE_40=PatchData.o +DEPENDS_40:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -1730,8 +1951,8 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1741,21 +1962,18 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_35 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_40 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_35:X.o=${NDIM}.o}: ${DEPENDS_35} -FILE_36=PatchDataFactory.o -DEPENDS_36:=\ +${FILE_40}: ${DEPENDS_40} + +FILE_41=PatchDataFactory.o +DEPENDS_41:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -1772,8 +1990,8 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1784,22 +2002,36 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_36 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_41 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_36:X.o=${NDIM}.o}: ${DEPENDS_36} -FILE_37=PatchDescriptor.o -DEPENDS_37:=\ +${FILE_41}: ${DEPENDS_41} + +FILE_42=PatchDataRestartManager.o +DEPENDS_42:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchDataRestartManager.C + +DEPENDS_42 +=\ + + + +${FILE_42}: ${DEPENDS_42} + +FILE_43=PatchDescriptor.o +DEPENDS_43:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -1817,8 +2049,8 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1829,23 +2061,20 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchDescriptor.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_37 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_43 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_37:X.o=${NDIM}.o}: ${DEPENDS_37} -FILE_38=PatchFactory.o -DEPENDS_38:=\ +${FILE_43}: ${DEPENDS_43} + +FILE_44=PatchFactory.o +DEPENDS_44:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1869,11 +2098,11 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1884,22 +2113,19 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_38 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_38:X.o=${NDIM}.o}: ${DEPENDS_38} -FILE_39=PatchGeometry.o -DEPENDS_39:=\ +${FILE_44}: ${DEPENDS_44} + +FILE_45=PatchGeometry.o +DEPENDS_45:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1913,8 +2139,8 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1924,21 +2150,18 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_39 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_45 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_39:X.o=${NDIM}.o}: ${DEPENDS_39} -FILE_40=PatchHierarchy.o -DEPENDS_40:=\ +${FILE_45}: ${DEPENDS_45} + +FILE_46=PatchHierarchy.o +DEPENDS_46:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1981,10 +2204,10 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1998,8 +2221,8 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -2009,17 +2232,15 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchHierarchy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_40 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_46 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_40:X.o=${NDIM}.o}: ${DEPENDS_40} -FILE_41=PatchLevel.o -DEPENDS_41:=\ +${FILE_46}: ${DEPENDS_46} + +FILE_47=PatchLevel.o +DEPENDS_47:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -2049,6 +2270,7 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ @@ -2059,7 +2281,6 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2070,8 +2291,8 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2080,16 +2301,14 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchLevel.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_41 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_47 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_41:X.o=${NDIM}.o}: ${DEPENDS_41} -FILE_42=PatchLevelFactory.o -DEPENDS_42:=\ +${FILE_47}: ${DEPENDS_47} + +FILE_48=PatchLevelFactory.o +DEPENDS_48:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -2120,6 +2339,7 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -2129,7 +2349,6 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2140,8 +2359,8 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2150,33 +2369,30 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchLevelFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_42 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_48 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_42:X.o=${NDIM}.o}: ${DEPENDS_42} -FILE_43=PeriodicId.o -DEPENDS_43:=\ +${FILE_48}: ${DEPENDS_48} + +FILE_49=PeriodicId.o +DEPENDS_49:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h PeriodicId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_43 +=\ +DEPENDS_49 +=\ -endif -${FILE_43:X.o=${NDIM}.o}: ${DEPENDS_43} -FILE_44=PeriodicShiftCatalog.o -DEPENDS_44:=\ +${FILE_49}: ${DEPENDS_49} + +FILE_50=PeriodicShiftCatalog.o +DEPENDS_50:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -2185,20 +2401,17 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PeriodicShiftCatalog.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_44 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_50 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_44:X.o=${NDIM}.o}: ${DEPENDS_44} -FILE_45=PersistentOverlapConnectors.o -DEPENDS_45:=\ +${FILE_50}: ${DEPENDS_50} + +FILE_51=PersistentOverlapConnectors.o +DEPENDS_51:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -2229,7 +2442,9 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -2237,7 +2452,6 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -2253,8 +2467,8 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2264,20 +2478,17 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PersistentOverlapConnectors.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_45 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_51 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_45:X.o=${NDIM}.o}: ${DEPENDS_45} -FILE_46=ProcessorMapping.o -DEPENDS_46:=\ +${FILE_51}: ${DEPENDS_51} + +FILE_52=ProcessorMapping.o +DEPENDS_52:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -2285,21 +2496,19 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ProcessorMapping.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_46 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_52 +=\ + -${FILE_46:X.o=${NDIM}.o}: ${DEPENDS_46} -FILE_47=RealBoxConstIterator.o -DEPENDS_47:=\ +${FILE_52}: ${DEPENDS_52} + +FILE_53=RealBoxConstIterator.o +DEPENDS_53:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -2312,9 +2521,9 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2325,22 +2534,19 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RealBoxConstIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_47 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_53 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_47:X.o=${NDIM}.o}: ${DEPENDS_47} -FILE_48=RefineOperator.o -DEPENDS_48:=\ +${FILE_53}: ${DEPENDS_53} + +FILE_54=RefineOperator.o +DEPENDS_54:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -2363,12 +2569,12 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2378,23 +2584,80 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RefineOperator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_48 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_54 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_48:X.o=${NDIM}.o}: ${DEPENDS_48} -FILE_49=TimeInterpolateOperator.o -DEPENDS_49:=\ +${FILE_54}: ${DEPENDS_54} + +FILE_55=SingularityFinder.o +DEPENDS_55:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SingularityFinder.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SingularityFinder.C + +DEPENDS_55 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_55}: ${DEPENDS_55} + +FILE_56=TimeInterpolateOperator.o +DEPENDS_56:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -2411,10 +2674,10 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2425,24 +2688,20 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TimeInterpolateOperator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_49 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_56 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_49:X.o=${NDIM}.o}: ${DEPENDS_49} -FILE_50=TransferOperatorRegistry.o -DEPENDS_50:=\ +${FILE_56}: ${DEPENDS_56} + +FILE_57=TransferOperatorRegistry.o +DEPENDS_57:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -2465,6 +2724,7 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -2472,7 +2732,6 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2483,25 +2742,22 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ TransferOperatorRegistry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_50 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_57 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_50:X.o=${NDIM}.o}: ${DEPENDS_50} -FILE_51=Transformation.o -DEPENDS_51:=\ +${FILE_57}: ${DEPENDS_57} + +FILE_58=Transformation.o +DEPENDS_58:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -2524,11 +2780,11 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2539,22 +2795,94 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Transformation.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_51 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_58 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_51:X.o=${NDIM}.o}: ${DEPENDS_51} -FILE_52=Variable.o -DEPENDS_52:=\ +${FILE_58}: ${DEPENDS_58} + +FILE_59=UncoveredBoxIterator.o +DEPENDS_59:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/FlattenedHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h UncoveredBoxIterator.C + +DEPENDS_59 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_59}: ${DEPENDS_59} + +FILE_60=Variable.o +DEPENDS_60:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -2571,9 +2899,9 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2584,22 +2912,19 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Variable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_52 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_60 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_52:X.o=${NDIM}.o}: ${DEPENDS_52} -FILE_53=VariableContext.o -DEPENDS_53:=\ +${FILE_60}: ${DEPENDS_60} + +FILE_61=VariableContext.o +DEPENDS_61:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ @@ -2607,15 +2932,14 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VariableContext.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_53 +=\ +DEPENDS_61 +=\ -endif -${FILE_53:X.o=${NDIM}.o}: ${DEPENDS_53} -FILE_54=VariableDatabase.o -DEPENDS_54:=\ +${FILE_61}: ${DEPENDS_61} + +FILE_62=VariableDatabase.o +DEPENDS_62:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -2634,11 +2958,11 @@ DEPENDS_54:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2649,17 +2973,14 @@ DEPENDS_54:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VariableDatabase.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_54 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_62 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_54:X.o=${NDIM}.o}: ${DEPENDS_54} + +${FILE_62}: ${DEPENDS_62} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.in index 374c6e85..39762bed 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI hier package ## ######################################################################### @@ -22,16 +22,20 @@ include $(OBJECT)/config/Makefile.config SUBDIRS = fortran OBJS = \ - LocalId.o \ + BaseGridGeometry.o \ BlockId.o \ - PeriodicId.o \ BoxContainer.o \ CoarseFineBoundary.o \ - BaseGridGeometry.o \ + LocalId.o \ PatchBoundaries.o \ PatchHierarchy.o \ + HierarchyNeighbors.o \ + FlattenedHierarchy.o \ PatchLevel.o \ PatchLevelFactory.o \ + PeriodicId.o \ + SingularityFinder.o \ + PatchDataRestartManager.o \ VariableDatabase.o \ Variable.o \ PatchDescriptor.o \ @@ -46,6 +50,7 @@ OBJS = \ OverlapConnectorAlgorithm.o \ MappingConnectorAlgorithm.o \ Connector.o \ + MappingConnector.o \ ConnectorStatistics.o \ BoxLevelHandle.o \ PeriodicShiftCatalog.o \ @@ -54,6 +59,8 @@ OBJS = \ BoxContainerSingleOwnerIterator.o \ BoxTree.o \ MultiblockBoxTree.o \ + AssumedPartitionBox.o \ + AssumedPartition.o \ BoxLevel.o \ BoxLevelStatistics.o \ PersistentOverlapConnectors.o \ @@ -76,12 +83,13 @@ OBJS = \ CoarsenOperator.o \ RefineOperator.o \ TimeInterpolateOperator.o \ - Transformation.o + Transformation.o \ + UncoveredBoxIterator.o library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.C new file mode 100644 index 00000000..5f6ce1f4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.C @@ -0,0 +1,332 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Set of edges incident from a box_level of a distributed + * box graph. + * + ************************************************************************/ +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +static const std::string dbgbord; + +namespace SAMRAI { +namespace hier { + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector::MappingConnector( + const tbox::Dimension& dim):Connector(dim) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector::MappingConnector( + const tbox::Dimension& dim, + tbox::Database& restart_db):Connector(dim, restart_db) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector::MappingConnector( + const MappingConnector& other):Connector(other) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector::MappingConnector( + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const BoxLevel::ParallelState parallel_state): + Connector(base_box_level, + head_box_level, + base_width, + parallel_state) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector::~MappingConnector() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +MappingConnector& +MappingConnector::operator = ( + const MappingConnector& rhs) +{ + Connector::operator = (rhs); + return *this; +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector * +MappingConnector::createLocalTranspose() const +{ + const IntVector transpose_gcw = convertHeadWidthToBase( + getHead().getRefinementRatio(), + getBase().getRefinementRatio(), + getConnectorWidth()); + + MappingConnector* transpose = new MappingConnector(getHead(), + getBase(), + transpose_gcw); + doLocalTransposeWork(transpose); + return transpose; +} + +/* + *********************************************************************** + *********************************************************************** + */ + +MappingConnector * +MappingConnector::createTranspose() const +{ + MappingConnector* transpose = + new MappingConnector(getHead(), + getBase(), + convertHeadWidthToBase(getBase().getRefinementRatio(), + getHead().getRefinementRatio(), + getConnectorWidth())); + + doTransposeWork(transpose); + return transpose; +} + +/* + *********************************************************************** + * Run findMappingErrors and assert that no errors are found. + *********************************************************************** + */ + +void +MappingConnector::assertMappingValidity( + MappingType map_type) const +{ + size_t nerr = findMappingErrors(map_type); + if (nerr != 0) { + tbox::perr << "MappingConnector::assertMappingValidity found\n" + << nerr << " errors.\n" + << "mapping connector:\n" << format("MAP: ", 2) + << "pre-map:\n" << getBase().format("PRE: ", 2) + << "post-map:\n" << getHead().format("POST: ", 2) + << std::endl; + TBOX_ERROR("MappingConnector::assertMappingValidity exiting due\n" + << "to above errors." << std::endl); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ + +size_t +MappingConnector::findMappingErrors( + MappingType map_type) const +{ + const tbox::SAMRAI_MPI& mpi(getMPI()); + const int my_rank = mpi.getRank(); + + // Need to know whether this is a local map. + if (map_type == UNKNOWN) { + if (mpi.getSize() > 1) { + for (Connector::ConstNeighborhoodIterator ei = begin(); + ei != end(); ++ei) { + for (Connector::ConstNeighborIterator ni = begin(ei); + ni != end(ei); ++ni) { + if ((*ni).getOwnerRank() != my_rank) { + map_type = NOT_LOCAL; + break; + } + } + if (map_type == NOT_LOCAL) { + break; + } + } + if (map_type == UNKNOWN) { + map_type = LOCAL; + } + int tmpi = map_type == LOCAL ? 0 : 1; + int tmpj; // For some reason, MPI_IN_PLACE is undeclared! + mpi.Allreduce(&tmpi, &tmpj, 1, MPI_INT, MPI_MAX); + if (tmpj > 0) { + map_type = NOT_LOCAL; + } + } else { + map_type = LOCAL; + } + } + + /* + * If not a local map, we need a globalized copy of the head. + */ + const BoxLevel& new_box_level = + map_type == LOCAL ? getHead() : + getHead().getGlobalizedVersion(); + + int error_count = 0; + + /* + * Find old Boxes that changed or disappeared on + * the new BoxLevel. There should be a mapping for each + * Box that changed or disappeared. + */ + const BoxContainer& old_boxes = getBase().getBoxes(); + for (RealBoxConstIterator ni(old_boxes.realBegin()); + ni != old_boxes.realEnd(); ++ni) { + const Box& old_box = *ni; + if (!new_box_level.hasBox(old_box)) { + // old_box disappeared. Require a mapping for old_box. + if (!hasNeighborSet(old_box.getBoxId())) { + ++error_count; + tbox::perr << "MappingConnector::findMappingErrors(" + << error_count + << "): old box " << old_box + << " disappeared without being mapped." << std::endl; + } + } else { + const Box& new_box = *(new_box_level.getBoxStrict(old_box)); + if (!new_box.isSpatiallyEqual(old_box)) { + // old_box has changed its box. A mapping must exist for it. + if (!hasNeighborSet(old_box.getBoxId())) { + ++error_count; + tbox::perr << "MappingConnector::findMappingErrors(" + << error_count + << "): old box " << old_box + << " changed to " << new_box + << " without being mapped." << std::endl; + } + } + } + } + + /* + * All mappings should point from a old Box to a new + * set of Boxes. + */ + for (Connector::ConstNeighborhoodIterator ei = begin(); + ei != end(); ++ei) { + + const BoxId& gid = *ei; + + if (!getBase().hasBox(gid)) { + // Mapping does not go from a old box. + ++error_count; + tbox::perr << "MappingConnector::findMappingErrors(" + << error_count + << "): mapping given for nonexistent index " << gid + << std::endl; + } else { + const Box& old_box = *(getBase().getBoxStrict(gid)); + + for (Connector::ConstNeighborIterator ni = begin(ei); + ni != end(ei); ++ni) { + const Box& nabr = *ni; + + if (!new_box_level.hasBox(nabr)) { + ++error_count; + tbox::perr << "MappingConnector::findMappingErrors(" + << error_count + << "): old box " << old_box + << " mapped to nonexistent new box " + << nabr << std::endl; + } else { + const Box& head_box = + *(new_box_level.getBoxStrict(nabr.getBoxId())); + if (!nabr.isSpatiallyEqual(head_box)) { + ++error_count; + tbox::perr << "MappingConnector::findMappingErrors(" + << error_count + << "): old box " << old_box + << " mapped to neighbor " << nabr + << ", which is inconsistent with head box " + << head_box << std::endl; + } + } + + } + } + } + + /* + * After-boxes should nest in before-boxes grown by the mapping + * width. + */ + + BoxLevelConnectorUtils blcu; + boost::shared_ptr bad_parts; + boost::shared_ptr pre_to_bad; + const Connector* transpose = createTranspose(); + blcu.computeExternalParts(bad_parts, + pre_to_bad, + *transpose, + getConnectorWidth()); + + if (pre_to_bad->getLocalNumberOfRelationships() > 0) { + tbox::perr << "MappingConnector::findMappingErrors() found bad nesting.\n" + << "Valid maps' head must nest in base, grown by\n" + << "the mapping Connector width.\n" + << "mapped boxes and their bad parts:\n" + << pre_to_bad->format() + << "mapping:\n" << format() + << "transpose mapping:\n" << transpose->format() + << std::endl; + error_count += pre_to_bad->getLocalNumberOfRelationships(); + } + + delete transpose; + + return error_count; +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.h new file mode 100644 index 00000000..c67ccc07 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnector.h @@ -0,0 +1,168 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Set of distributed box-graph relationships from one BoxLevel + * to another describing Box mappings. + * + ************************************************************************/ +#ifndef included_hier_MappingConnector +#define included_hier_MappingConnector + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/Connector.h" + +namespace SAMRAI { +namespace hier { + +/*! + * @brief A container which holds overlap relationship connections between two + * BoxLevels. + */ + +class MappingConnector:public Connector +{ +public: + /*! + * @brief Creates an uninitialized MappingConnector object in the + * distributed state. + * + * @param dim The dimension of the head and base BoxLevels that + * this object will eventually connect. + * + * @see setBase() + * @see setHead() + * @see setWidth() + */ + explicit MappingConnector( + const tbox::Dimension& dim); + + /*! + * @brief Creates an MappingConnector which is initialized from a restart + * database. + * + * @param dim The dimension of the head and base BoxLevels that + * this object will eventually connect. + * + * @param restart_db Restart Database written by a Connector. + * + * @see setBase() + * @see setHead() + * @see setWidth() + */ + MappingConnector( + const tbox::Dimension& dim, + tbox::Database& restart_db); + + /*! + * @brief Copy constructor. + * + * @param[in] other + */ + MappingConnector( + const MappingConnector& other); + + /*! + * @brief Initialize a MappingConnector with no defined relationships. + * + * The MappingConnector's relationships are initialized to a dummy state. + * + * @param[in] base_box_level + * @param[in] head_box_level + * @param[in] base_width + * @param[in] parallel_state + * + * @pre (base_box_level.getDim() == head_box_level.getDim()) && + * (base_box_level.getDim() == base_width.getDim()) + */ + MappingConnector( + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const BoxLevel::ParallelState parallel_state = BoxLevel::DISTRIBUTED); + + /*! + * @brief Destructor. + */ + ~MappingConnector(); + + /*! + * @brief Assignment operator + */ + MappingConnector& + operator = ( + const MappingConnector& rhs); + + /*! + * @brief Create and return this MappingConnector's transpose, assuming that + * all relationships are local (no remote neighbors). + * + * If any remote neighbor is found an unrecoverable assertion is + * thrown. + * + * Non-periodic relationships in are simply reversed to get the transpose + * relationship. For each periodic relationship we create a periodic + * relationship incident from the unshifted head neighbor to the shifted + * base neighbor. This is because all relationships must be incident from a + * real (unshifted) Box. + */ + MappingConnector * + createLocalTranspose() const; + + /*! + * @brief Create and return this MappingConnector's transpose. + * + * Similar to createLocalTranspose(), but this method allows + * non-local edges. Global data is required, so this method + * is not scalable. + */ + virtual MappingConnector * + createTranspose() const; + + /*! + * @brief Types of mappings for use in findMappingErrors() and + * assertMappingValidity(). + */ + enum MappingType { LOCAL, NOT_LOCAL, UNKNOWN }; + + /*! + * @brief Check if the MappingConnector has a valid mapping. + * + * This function can be called prior to calling modify(). It + * is intended to check the MappingConnector(s) argument(s) + * in modify() to determine if it has a valid mapping. + * In other words, it checks to see if the mapping can be used + * in modify() without logic errors. It does no other checks. + * + * @param[in] map_type LOCAL means assume the mapping is local. NOT_LOCAL + * means the mapping is not local. UNKNOWN means find out whether the + * map is local or not (communication required) and act + * accordingly. + * + * @return number of errors found. + */ + size_t + findMappingErrors( + MappingType map_type = UNKNOWN) const; + + /*! + * @brief Run findMappingErrors and abort if any errors are found. + * + * @param[in] map_type LOCAL means assume the mapping is local. NOT_LOCAL + * means the mapping is not local. UNKNOWN means find out whether the + * map is local or not (communication required) and act + * accordingly. + */ + void + assertMappingValidity( + MappingType map_type = UNKNOWN) const; + +}; + +} +} + +#endif // included_hier_MappingConnector diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.C index e98bb504..ac2ab2e3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.C @@ -3,16 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Algorithms for working with mapping Connectors. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Algorithms for working with MappingConnectors. * ************************************************************************/ -#ifndef included_hier_MappingConnectorAlgorithm_C -#define included_hier_MappingConnectorAlgorithm_C - #include "SAMRAI/hier/BoxContainerUtils.h" +#include "SAMRAI/hier/BoxUtilities.h" #include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/AsyncCommStage.h" @@ -26,13 +23,13 @@ namespace SAMRAI { namespace hier { -boost::shared_ptr MappingConnectorAlgorithm::t_modify; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_setup_comm; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_remove_and_cache; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_discover_and_send; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_receive_and_unpack; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_MPI_wait; -boost::shared_ptr MappingConnectorAlgorithm::t_modify_misc; +const std::string MappingConnectorAlgorithm::s_default_timer_prefix( + "hier::MappingConnectorAlgorithm"); +std::map MappingConnectorAlgorithm::s_static_timers; +char MappingConnectorAlgorithm::s_ignore_external_timer_prefix('n'); + +char MappingConnectorAlgorithm::s_print_steps = '\0'; const std::string MappingConnectorAlgorithm::s_dbgbord; @@ -43,9 +40,6 @@ int MappingConnectorAlgorithm::s_operation_mpi_tag = 0; * with reused tags anyway. */ -tbox::SAMRAI_MPI MappingConnectorAlgorithm::s_class_mpi( - tbox::SAMRAI_MPI::commNull); - tbox::StartupShutdownManager::Handler MappingConnectorAlgorithm::s_initialize_finalize_handler( MappingConnectorAlgorithm::initializeCallback, @@ -60,9 +54,15 @@ MappingConnectorAlgorithm::s_initialize_finalize_handler( */ MappingConnectorAlgorithm::MappingConnectorAlgorithm(): + d_mpi(MPI_COMM_NULL), + d_mpi_is_exclusive(false), + d_object_timers(NULL), + d_barrier_before_communication(false), d_sanity_check_inputs(false), d_sanity_check_outputs(false) { + getFromInput(); + setTimerPrefix(s_default_timer_prefix); } /* @@ -72,28 +72,63 @@ MappingConnectorAlgorithm::MappingConnectorAlgorithm(): MappingConnectorAlgorithm::~MappingConnectorAlgorithm() { + if (d_mpi_is_exclusive) { + d_mpi.freeCommunicator(); + d_mpi_is_exclusive = false; + } } /* *********************************************************************** *********************************************************************** */ -void -MappingConnectorAlgorithm::setSanityCheckMethodPreconditions( - bool do_check) +void MappingConnectorAlgorithm::setSAMRAI_MPI( + const tbox::SAMRAI_MPI& mpi, + bool make_duplicate) { - d_sanity_check_inputs = do_check; + if (d_mpi_is_exclusive) { + d_mpi.freeCommunicator(); + d_mpi_is_exclusive = false; + } + if (make_duplicate) { + d_mpi.dupCommunicator(mpi); + d_mpi_is_exclusive = true; + } else { + d_mpi = mpi; + } } /* *********************************************************************** *********************************************************************** */ + void -MappingConnectorAlgorithm::setSanityCheckMethodPostconditions( - bool do_check) +MappingConnectorAlgorithm::getFromInput() { - d_sanity_check_outputs = do_check; + if (s_print_steps == '\0') { + s_print_steps = 'n'; + if (tbox::InputManager::inputDatabaseExists()) { + boost::shared_ptr idb( + tbox::InputManager::getInputDatabase()); + if (idb->isDatabase("MappingConnectorAlgorithm")) { + boost::shared_ptr mca_db( + idb->getDatabase("MappingConnectorAlgorithm")); + s_print_steps = + mca_db->getCharWithDefault("DEV_print_modify_steps", 'n'); + if (!(s_print_steps == 'n' || s_print_steps == 'y')) { + INPUT_VALUE_ERROR("DEV_print_modify_steps"); + } + s_ignore_external_timer_prefix = + mca_db->getCharWithDefault("DEV_ignore_external_timer_prefix", + 'n'); + if (!(s_ignore_external_timer_prefix == 'n' || + s_ignore_external_timer_prefix == 'y')) { + INPUT_VALUE_ERROR("DEV_ignore_external_timer_prefix"); + } + } + } + } } /* @@ -104,71 +139,90 @@ MappingConnectorAlgorithm::setSanityCheckMethodPostconditions( void MappingConnectorAlgorithm::modify( Connector& anchor_to_mapped, - Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old, + const MappingConnector& old_to_new, BoxLevel* mutable_new, BoxLevel* mutable_old) const { + d_object_timers->t_modify_public->start(); + + Connector* old_to_anchor = 0; + if (anchor_to_mapped.hasTranspose()) { + old_to_anchor = &anchor_to_mapped.getTranspose(); + } else { + old_to_anchor = anchor_to_mapped.createLocalTranspose(); + } + Connector& mapped_to_anchor = *old_to_anchor; + + const MappingConnector* new_to_old = 0; + if (old_to_new.hasTranspose()) { + new_to_old = + static_cast(&old_to_new.getTranspose()); + } /* - * Ensure that Connectors incident to and from old agree on - * what the old mapped_box_level is. + * Ensure that head and base BoxLevels in argument agree with each + * other and that transpose Connectors are really transposes. */ const Connector& anchor_to_old = anchor_to_mapped; - const Connector& old_to_anchor = mapped_to_anchor; const BoxLevel* old = &old_to_new.getBase(); - if (old != &new_to_old.getHead() || + if (d_sanity_check_inputs) { + if (!d_mpi.hasNullCommunicator() && !d_mpi.isCongruentWith(old->getMPI())) { + TBOX_ERROR("MappingConnectorAlgorithm::modify input error: Input BoxLevel\n" + << "has SAMRAI_MPI that is incongruent with MappingConnectorAlgorithm's.\n" + << "See MappingConnectorAlgorithm::setSAMRAI_MPI.\n"); + } + } + + if ((new_to_old && (old != &new_to_old->getHead())) || old != &anchor_to_mapped.getHead() || old != &mapped_to_anchor.getBase()) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to base and head of modify are not incident\n" - << "from the same old in MappingConnectorAlgorithm::modify:\n" - << "anchor_to_old is TO " << &anchor_to_old.getHead() << "\n" - << "old_to_new is FROM " << &old_to_new.getBase() - << "\n" - << "new_to_old is TO " << &new_to_old.getHead() - << "\n" - << "old_to_anchor is FROM " << &old_to_anchor.getBase() << "\n" - ); + if (new_to_old) { + TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" + << "Given Connectors to base and head of modify are not incident\n" + << "from the same old in MappingConnectorAlgorithm::modify:\n" + << "anchor_to_old is TO " << &anchor_to_old.getHead() << "\n" + << "old_to_new is FROM " << &old_to_new.getBase() + << "\n" + << "new_to_old is TO " << &new_to_old->getHead() + << "\n" + << "old_to_anchor is FROM " << &old_to_anchor->getBase() << "\n"); + } else { + TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" + << "Given Connectors to base and head of modify are not incident\n" + << "from the same old in MappingConnectorAlgorithm::modify:\n" + << "anchor_to_old is TO " << &anchor_to_old.getHead() << "\n" + << "old_to_new is FROM " << &old_to_new.getBase() + << "\n" + << "old_to_anchor is FROM " << &old_to_anchor->getBase() << "\n"); + } } - /* - * Ensure that head and base mapped_box_levels in argument agree with - * head and base in the object. - */ - if (&anchor_to_old.getBase() != &old_to_anchor.getHead()) { + if (&anchor_to_old.getBase() != &old_to_anchor->getHead()) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to and from base of modify do not refer\n" - << "to the base of the modify in:\n" + << "Given Connectors to and from anchor of modify do not refer\n" + << "to the same BoxLevel:\n" << "anchor_to_old is FROM " << &anchor_to_old.getBase() << "\n" - << "old_to_anchor is TO " << &old_to_anchor.getHead() << "\n" - ); + << "old_to_anchor is TO " << &old_to_anchor->getHead() << "\n"); } - if (&old_to_new.getHead() != &new_to_old.getBase()) { + if (new_to_old && (&old_to_new.getHead() != &new_to_old->getBase())) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to and from head of modify do not refer\n" - << "to the head of the modify in MappingConnectorAlgorithm::modify:\n" - << "new_to_old is FROM " << &new_to_old.getBase() - << "\n" - << "old_to_new is TO " << &old_to_new.getHead() - << "\n" - ); + << "Given Connectors to and from new of modify do not refer\n" + << "to the same BoxLevel:\n" + << "new_to_old is FROM " << &new_to_old->getBase() << "\n" + << "old_to_new is TO " << &old_to_new.getHead() << "\n"); } - if (!anchor_to_old.isTransposeOf(old_to_anchor)) { + if (!anchor_to_old.isTransposeOf(*old_to_anchor)) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors between base and old of modify\n" + << "Given Connectors between anchor and old of modify\n" << "are not transposes of each other.\n" - << "See MappingConnectorAlgorithm::isTransposeOf().\n" - ); + << "See MappingConnectorAlgorithm::isTransposeOf().\n"); } - if (!new_to_old.isTransposeOf(old_to_new)) { + if (new_to_old && !new_to_old->isTransposeOf(old_to_new)) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors between head and old of modify\n" + << "Given Connectors between new and old of modify\n" << "are not transposes of each other.\n" - << "See MappingConnectorAlgorithm::isTransposeOf().\n" - ); + << "See MappingConnectorAlgorithm::isTransposeOf().\n"); } if (anchor_to_old.getParallelState() != BoxLevel::DISTRIBUTED) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" @@ -178,264 +232,68 @@ MappingConnectorAlgorithm::modify( if (s_print_steps == 'y') { tbox::plog - << "MappingConnectorAlgorithm::modify: old mapped_box_level:\n" - << old_to_new.getBase().format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: new mapped_box_level:\n" - << new_to_old.getBase().format(s_dbgbord, 2) + << "MappingConnectorAlgorithm::modify: old box_level:\n" + << old_to_new.getBase().format(s_dbgbord, 2); + if (new_to_old) { + tbox::plog + << "MappingConnectorAlgorithm::modify: new box_level:\n" + << new_to_old->getBase().format(s_dbgbord, 2); + } + tbox::plog << "MappingConnectorAlgorithm::modify: old_to_new:\n" - << old_to_new.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: new_to_old:\n" - << new_to_old.format(s_dbgbord, 2); + << old_to_new.format(s_dbgbord, 2); + if (new_to_old) { + tbox::plog + << "MappingConnectorAlgorithm::modify: new_to_old:\n" + << new_to_old->format(s_dbgbord, 2); + } } if (0) { // Expensive input checking. - const BoxLevel& anchor_mapped_box_level = anchor_to_old.getBase(); - const BoxLevel& old_mapped_box_level = old_to_new.getBase(); + const BoxLevel& anchor_box_level = anchor_to_old.getBase(); + const BoxLevel& old_box_level = old_to_new.getBase(); tbox::plog - << "anchor mapped_box_level:\n" << anchor_mapped_box_level.format(s_dbgbord, 2) + << "anchor box_level:\n" << anchor_box_level.format(s_dbgbord, 2) << "anchor_to_old:\n" << anchor_to_old.format(s_dbgbord, 2) - << "old mapped_box_level:\n" << old_mapped_box_level.format(s_dbgbord, 2) - << "old_to_new:\n" << old_to_new.format(s_dbgbord, 2) - << "new_to_old:\n" << new_to_old.format(s_dbgbord, 2); - - OverlapConnectorAlgorithm oca; - TBOX_ASSERT(oca.checkOverlapCorrectness(anchor_to_old) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(old_to_anchor) == 0); - TBOX_ASSERT(old_to_anchor.checkTransposeCorrectness(anchor_to_old, - true) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(old_to_new, true, false) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_old, true, false) == 0); - TBOX_ASSERT(old_to_new.checkTransposeCorrectness(new_to_old, + << "old box_level:\n" << old_box_level.format(s_dbgbord, 2) + << "old_to_new:\n" << old_to_new.format(s_dbgbord, 2); + if (new_to_old) { + tbox::plog + << "new_to_old:\n" << new_to_old->format(s_dbgbord, 2); + } + + TBOX_ASSERT(anchor_to_old.checkOverlapCorrectness() == 0); + TBOX_ASSERT(old_to_anchor->checkOverlapCorrectness() == 0); + TBOX_ASSERT(old_to_anchor->checkTransposeCorrectness(anchor_to_old, true) == 0); + TBOX_ASSERT(old_to_new.checkOverlapCorrectness(true, false) == 0); + TBOX_ASSERT(!new_to_old || + new_to_old->checkOverlapCorrectness(true, false) == 0); + TBOX_ASSERT(!new_to_old || + old_to_new.checkTransposeCorrectness(*new_to_old, true) == 0); } + d_object_timers->t_modify_public->stop(); privateModify(anchor_to_mapped, mapped_to_anchor, old_to_new, new_to_old, mutable_new, mutable_old); + d_object_timers->t_modify_public->start(); if (d_sanity_check_outputs) { anchor_to_mapped.assertTransposeCorrectness(mapped_to_anchor); mapped_to_anchor.assertTransposeCorrectness(anchor_to_mapped); } -} - -/* - ***************************************************************************** - * Version of modify requiring only the forward map - * and allows only local mappings. - * - * This version modifies two transpose Connectors. - ***************************************************************************** - */ - -void -MappingConnectorAlgorithm::modify( - Connector& anchor_to_mapped, - Connector& mapped_to_anchor, - const Connector& old_to_new, - BoxLevel* mutable_new, - BoxLevel* mutable_old) const -{ - -#ifdef DEBUG_CHECK_ASSERTIONS - /* - * Ensure that mapping has only local neighbors. - */ - for (Connector::ConstNeighborhoodIterator ci = old_to_new.begin(); - ci != old_to_new.end(); ++ci) { - for (Connector::ConstNeighborIterator na = old_to_new.begin(ci); - na != old_to_new.end(ci); ++na) { - if (na->getOwnerRank() != old_to_new.getMPI().getRank()) { - const Box find_box(na->getDim(), *ci); - const Box& mapped_box( - *old_to_new.getBase().getBoxes().find(find_box)); - TBOX_ERROR("MappingConnectorAlgorithm::modify: this version of modify\n" - "only allows local mappings. The local mapped_box\n" - << mapped_box << " has a non-local map to\n" - << *na << "\n" - << "To modify using non-local maps, the\n" - << "reverse mapping must be provide and\n" - << "the four-argument version of modify\n" - << "must be used."); - } - } - } -#endif - - const Connector& anchor_to_old = anchor_to_mapped; - const Connector& old_to_anchor = mapped_to_anchor; - - const BoxLevel* old = &old_to_new.getBase(); - - /* - * Ensure that Connectors incident to and from old agree on - * what the old mapped_box_level is. - */ - - if (old != &old_to_new.getBase() || - old != &anchor_to_old.getHead()) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to base and head of modify are not incident\n" - << "from the same old in MappingConnectorAlgorithm::modify:\n" - << "anchor_to_old is TO " << &anchor_to_old.getHead() << "\n" - << "old_to_anchor is FROM " << &old_to_anchor.getBase() << "\n" - << "old_to_new is FROM " << &old_to_new.getBase() - << "\n" - ); - } - /* - * Ensure that head and base mapped_box_levels in argument agree with - * head and base in the object. - */ - if (&anchor_to_old.getBase() != &old_to_anchor.getHead()) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to and from base of modify do not refer\n" - << "to the base of the modify in MappingConnectorAlgorithm::modify:\n" - << "anchor_to_old is FROM " << &anchor_to_old.getBase() << "\n" - << "old_to_anchor is TO " << &old_to_anchor.getHead() << "\n" - ); - } - if (!anchor_to_old.isTransposeOf(old_to_anchor)) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors between base and old of modify\n" - << "are not transposes of each other.\n" - << "See MappingConnectorAlgorithm::isTransposeOf().\n" - ); - } - if (anchor_to_old.getParallelState() != BoxLevel::DISTRIBUTED) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "modifying is currently set up for DISTRIBUTED\n" - << "mode only.\n"); - } - - if (s_print_steps == 'y') { - const BoxLevel& anchor_mapped_box_level = anchor_to_mapped.getBase(); - const BoxLevel& old_mapped_box_level = old_to_new.getBase(); - - tbox::plog - << "MappingConnectorAlgorithm::modify: anchor mapped_box_level:\n" - << anchor_mapped_box_level.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: anchor_to_old:\n" - << anchor_to_old.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: old mapped_box_level:\n" - << old_mapped_box_level.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: old_to_new:\n" - << old_to_new.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: No new_to_old.\n"; - } - - Connector dummy_new_to_old; - privateModify(anchor_to_mapped, - mapped_to_anchor, - old_to_new, - dummy_new_to_old, - mutable_new, - mutable_old); -} - -/* - ***************************************************************************** - * Version of modify requiring only the forward map - * and allows only local mappings. - * - * This version modifies just one Connector. - ***************************************************************************** - */ - -void -MappingConnectorAlgorithm::modify( - Connector& anchor_to_mapped, - const Connector& old_to_new, - BoxLevel* mutable_new, - BoxLevel* mutable_old) const -{ - /* - * Ensure that connectors incident to and from old agree on - * what the old mapped_box_level is. - */ - if (&anchor_to_mapped.getHead() != &old_to_new.getBase()) { - TBOX_ERROR( - "Bad input for MappingConnectorAlgorithm::modify:\n" - << "Input MappingConnectorAlgorithm do not agree on what the old mapped_box_level is.\n" - << "anchor_to_mapped is TO " << &anchor_to_mapped.getHead() << "\n" - << "old_to_new is FROM " << &old_to_new.getBase() - << "\n" - ); - } - - if (anchor_to_mapped.getParallelState() != BoxLevel::DISTRIBUTED) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "modifying is currently set up for DISTRIBUTED\n" - << "mode only.\n"); - } - -#ifdef DEBUG_CHECK_ASSERTIONS - /* - * Ensure that mapping has only local neighbors. - */ - for (Connector::ConstNeighborhoodIterator ci = old_to_new.begin(); - ci != old_to_new.end(); ++ci) { - for (Connector::ConstNeighborIterator na = old_to_new.begin(ci); - na != old_to_new.end(ci); ++na) { - if (na->getOwnerRank() != old_to_new.getMPI().getRank()) { - const Box& mapped_box( - *old_to_new.getBase().getBoxes(). - find(Box(na->getDim(), *ci))); - TBOX_ERROR("MappingConnectorAlgorithm::modify: this version of modify\n" - "only allows local mappings. The local mapped_box\n" - << mapped_box << " has a non-local map to\n" - << *na << "\n" - << "To modify using non-local maps, the\n" - << "reverse mapping must be provide and\n" - << "the four-argument version of modify\n" - << "must be used."); - } - } - } -#endif - - /* - * Generate temporary mapped_to_anchor needed by the modify - * operation. This step is the reason anchor_to_mapped - * may not have non-local neighbors. - * - * No need to check that anchor_to_mapped is strictly local, - * because initializeToLocalTranspose checks that. - */ - Connector mapped_to_anchor; - mapped_to_anchor.initializeToLocalTranspose(anchor_to_mapped); - - if (s_print_steps == 'y') { - const BoxLevel& anchor_mapped_box_level = anchor_to_mapped.getBase(); - const BoxLevel& old_mapped_box_level = old_to_new.getBase(); - const BoxLevel& new_mapped_box_level = - old_to_new.getHead(); - tbox::plog - << "MappingConnectorAlgorithm::modify: anchor mapped_box_level:\n" - << anchor_mapped_box_level.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: anchor_to_old:\n" - << anchor_to_mapped.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: old mapped_box_level:\n" - << old_mapped_box_level.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: old_to_new:\n" - << old_to_new.format(s_dbgbord, 2) - << "MappingConnectorAlgorithm::modify: new mapped_box_level:\n" - << new_mapped_box_level.format(s_dbgbord, 2); + if (!anchor_to_mapped.hasTranspose()) { + delete old_to_anchor; } - Connector dummy_new_to_old; - privateModify(anchor_to_mapped, - mapped_to_anchor, - old_to_new, - dummy_new_to_old, - mutable_new, - mutable_old); + d_object_timers->t_modify_public->stop(); } /* @@ -468,7 +326,7 @@ MappingConnectorAlgorithm::modify( * are shrunken by the width of the mapping. * * At this time, new_to_old is only used to determine the remote - * owners that must be notified of a local mapped_box being mapped. + * owners that must be notified of a local box being mapped. * The Connector object contains more info than required, so it can be * replaced by something more concise. However, requiring a transpose * Connector lets us use some canned sanity checks. The use of the @@ -480,13 +338,23 @@ void MappingConnectorAlgorithm::privateModify( Connector& anchor_to_mapped, Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old, + const MappingConnector& old_to_new, + const MappingConnector* new_to_old, BoxLevel* mutable_new, BoxLevel* mutable_old) const { - t_modify->barrierAndStart(); - t_modify_misc->start(); + const tbox::SAMRAI_MPI& mpi = d_mpi.hasNullCommunicator() ? + old_to_new.getBase().getMPI() : d_mpi; + + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Errant message detected."); + } + + if (d_barrier_before_communication) { + mpi.Barrier(); + } + d_object_timers->t_modify->start(); + d_object_timers->t_modify_misc->start(); if (s_print_steps == 'y') { tbox::plog @@ -495,9 +363,12 @@ MappingConnectorAlgorithm::privateModify( << "MappingConnectorAlgorithm::privateModify: mapped_to_anchor:\n" << mapped_to_anchor.format(s_dbgbord, 3) << "MappingConnectorAlgorithm::privateModify: old_to_new:\n" - << old_to_new.format(s_dbgbord, 3) - << "MappingConnectorAlgorithm::privateModify: new_to_old:\n" << old_to_new.format(s_dbgbord, 3); + if (new_to_old) { + tbox::plog + << "MappingConnectorAlgorithm::privateModify: new_to_old:\n" + << new_to_old->format(s_dbgbord, 3); + } } privateModify_checkParameters( @@ -529,14 +400,13 @@ MappingConnectorAlgorithm::privateModify( * ratios. */ const BoxLevel& old = old_to_anchor.getBase(); - const BoxLevel& anchor = anchor_to_new.getBase(); + const BoxLevel& anchor = anchor_to_old.getBase(); const BoxLevel& new_level = old_to_new.getHead(); const IntVector& old_ratio = old.getRefinementRatio(); const IntVector& anchor_ratio = anchor.getRefinementRatio(); const IntVector& new_ratio = new_level.getRefinementRatio(); const tbox::Dimension dim(old.getDim()); - const tbox::SAMRAI_MPI& mpi(old.getMPI()); /* * The width of old-->new indicates the maximum amount of box @@ -571,11 +441,11 @@ MappingConnectorAlgorithm::privateModify( << "too much. The growth may generate new overlaps\n" << "that cannot be detected by mapping algorithm, thus\n" << "causing output overlap Connectors to be incomplete.\n" - << "Mapping Connector:\n" << old_to_new.format("", 0) + << "MappingConnector:\n" << old_to_new.format("", 0) << "anchor--->mapped:\n" << anchor_to_new.format("", 0) << "Connector width of anchor--->mapped will shrink\n" << "by " << shrinkage_in_anchor_index_space << " which\n" - << "will result in a non-positive width."); + << "will result in a non-positive width." << std::endl); } const IntVector new_to_anchor_width = Connector::convertHeadWidthToBase( @@ -583,13 +453,16 @@ MappingConnectorAlgorithm::privateModify( anchor.getRefinementRatio(), anchor_to_new_width); - t_modify_misc->stop(); + anchor_to_new.shrinkWidth(anchor_to_new_width); + new_to_anchor.shrinkWidth(new_to_anchor_width); + + d_object_timers->t_modify_misc->stop(); /* * The essential modify algorithm is in this block. */ - t_modify_misc->start(); + d_object_timers->t_modify_misc->start(); /* * Initialize the output connectors with the correct new @@ -606,7 +479,9 @@ MappingConnectorAlgorithm::privateModify( old_to_anchor.getLocalOwners(outgoing_ranks); anchor_to_old.getLocalOwners(incoming_ranks); old_to_new.getLocalOwners(outgoing_ranks); - new_to_old.getLocalOwners(incoming_ranks); + if (new_to_old) { + new_to_old->getLocalOwners(incoming_ranks); + } // We don't need to communicate locally. incoming_ranks.erase(mpi.getRank()); @@ -652,25 +527,26 @@ MappingConnectorAlgorithm::privateModify( * Object for communicating relationship changes. */ tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer * all_comms(NULL); + tbox::AsyncCommPeer * all_comms(0); - t_modify_misc->stop(); + d_object_timers->t_modify_misc->stop(); /* * Set up communication mechanism (and post receives). */ - t_modify_setup_comm->start(); + d_object_timers->t_modify_setup_comm->start(); setupCommunication( all_comms, comm_stage, - anchor.getMPI(), + mpi, incoming_ranks, outgoing_ranks, - t_modify_MPI_wait, - s_operation_mpi_tag); + d_object_timers->t_modify_MPI_wait, + s_operation_mpi_tag, + s_print_steps == 'y'); - t_modify_setup_comm->stop(); + d_object_timers->t_modify_setup_comm->stop(); /* * There are three major parts to computing the new neighbors: @@ -689,19 +565,20 @@ MappingConnectorAlgorithm::privateModify( */ /* - * Data for caching relationship removal messages. This - * temporary object holds data computed when removing neighbors, - * to be used when sending out the relationship removal - * information. + * Messages for other processors describing removed and added relationships. */ - std::map > neighbor_removal_mesg; + std::map > send_mesgs; + for (std::set::const_iterator itr(outgoing_ranks.begin()); + itr != outgoing_ranks.end(); ++itr) { + send_mesgs[*itr]; + } /* * First step: Remove neighbor data for Boxes that are * going away and cache information to be sent out. */ privateModify_removeAndCache( - neighbor_removal_mesg, + send_mesgs, anchor_to_new, &new_to_anchor, old_to_new); @@ -712,7 +589,7 @@ MappingConnectorAlgorithm::privateModify( * or create. */ privateModify_discoverAndSend( - neighbor_removal_mesg, + send_mesgs, anchor_to_new, &new_to_anchor, incoming_ranks, @@ -737,11 +614,14 @@ MappingConnectorAlgorithm::privateModify( incoming_ranks, all_comms, comm_stage, - t_modify_receive_and_unpack); + d_object_timers->t_modify_receive_and_unpack, + s_print_steps == 'y'); - t_modify_misc->start(); + d_object_timers->t_modify_misc->start(); - delete[] all_comms; + if (all_comms) { + delete[] all_comms; + } /* * Now we have set up the NeighborhoodSets for anchor_to_new and @@ -757,9 +637,9 @@ MappingConnectorAlgorithm::privateModify( TBOX_WARNING("MappingConnectorAlgorithm::privateModify: generated\n" << "overlap Connectors with non-integer ratio between\n" << "the base and head. The results are not guaranteed\n" - << "to be complete overlap Connectors."); + << "to be complete overlap Connectors." << std::endl); } - t_modify_misc->stop(); + d_object_timers->t_modify_misc->stop(); /* * Optional in-place changes: @@ -772,7 +652,7 @@ MappingConnectorAlgorithm::privateModify( * BoxLevel, this method initializes it to the new * BoxLevel and uses it in the output Connectors. */ - t_modify_misc->start(); + d_object_timers->t_modify_misc->start(); if (mutable_new == &old_to_new.getBase() && mutable_old == &old_to_new.getHead()) { /* @@ -783,18 +663,22 @@ MappingConnectorAlgorithm::privateModify( new_to_anchor.setBase(*mutable_new, true); anchor_to_new.setHead(*mutable_new, true); } else { - if (mutable_new != NULL) { + if (mutable_new != 0) { *mutable_new = old_to_new.getHead(); new_to_anchor.setBase(*mutable_new, true); anchor_to_new.setHead(*mutable_new, true); } - if (mutable_old != NULL) { + if (mutable_old != 0) { *mutable_old = old_to_new.getBase(); } } - t_modify_misc->stop(); + d_object_timers->t_modify_misc->stop(); + + d_object_timers->t_modify->stop(); - t_modify->stop(); + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Errant message detected."); + } } /* @@ -807,8 +691,8 @@ void MappingConnectorAlgorithm::privateModify_checkParameters( const Connector& anchor_to_mapped, const Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old) const + const MappingConnector& old_to_new, + const MappingConnector* new_to_old) const { const BoxLevel& old = mapped_to_anchor.getBase(); @@ -816,23 +700,32 @@ MappingConnectorAlgorithm::privateModify_checkParameters( * Ensure that Connectors incident to and from the old agree on * what the old is. */ - if (&old != &old_to_new.getBase() || - (new_to_old.isFinalized() && &old != - &new_to_old.getHead()) || - &old != &anchor_to_mapped.getHead()) { - TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" - << "Given Connectors to anchor and new of modify are not incident\n" - << "from the same old in MappingConnectorAlgorithm::modify:\n" - << "anchor_to_mapped is TO " << &anchor_to_mapped.getHead() << "\n" - << "old_to_new is FROM " << &old_to_new.getBase() - << "\n" - << "new_to_old is TO " << &new_to_old.getHead() - << "\n" - << "mapped_to_anchor is FROM " << &mapped_to_anchor.getBase() << "\n" - ); + if ((&old != &old_to_new.getBase()) || + (new_to_old && new_to_old->isFinalized() && + (&old != &new_to_old->getHead())) || + (&old != &anchor_to_mapped.getHead())) { + if (new_to_old) { + TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" + << "Given Connectors to anchor and new of modify are not incident\n" + << "from the same old in MappingConnectorAlgorithm::modify:\n" + << "anchor_to_mapped is TO " << &anchor_to_mapped.getHead() << "\n" + << "old_to_new is FROM " << &old_to_new.getBase() + << "\n" + << "new_to_old is TO " << &new_to_old->getHead() + << "\n" + << "mapped_to_anchor is FROM " << &mapped_to_anchor.getBase() << "\n"); + } else { + TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" + << "Given Connectors to anchor and new of modify are not incident\n" + << "from the same old in MappingConnectorAlgorithm::modify:\n" + << "anchor_to_mapped is TO " << &anchor_to_mapped.getHead() << "\n" + << "old_to_new is FROM " << &old_to_new.getBase() + << "\n" + << "mapped_to_anchor is FROM " << &mapped_to_anchor.getBase() << "\n"); + } } /* - * Ensure that new and anchor mapped_box_levels in argument agree with + * Ensure that new and anchor box_levels in argument agree with * new and anchor in the object. */ if (&mapped_to_anchor.getHead() != &anchor_to_mapped.getBase()) { @@ -841,35 +734,31 @@ MappingConnectorAlgorithm::privateModify_checkParameters( << "to the anchor of the modify in MappingConnectorAlgorithm::modify:\n" << "anchor_to_mapped is FROM " << &anchor_to_mapped.getBase() << "\n" << "mapped_to_anchor is TO " << &mapped_to_anchor.getHead() << "\n" - << "anchor of modify is " << &anchor_to_mapped.getBase() << "\n" - ); + << "anchor of modify is " << &anchor_to_mapped.getBase() << "\n"); } - if (new_to_old.isFinalized() && &old_to_new.getHead() != - &new_to_old.getBase()) { + if (new_to_old && new_to_old->isFinalized() && + &old_to_new.getHead() != &new_to_old->getBase()) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" << "Given Connectors to and from new of modify do not refer\n" << "to the new of the modify in MappingConnectorAlgorithm::modify:\n" - << "new_to_old is FROM " << &new_to_old.getBase() + << "new_to_old is FROM " << &new_to_old->getBase() << "\n" << "old_to_new is TO " << &old_to_new.getHead() << "\n" - << "new of modify is " << &anchor_to_mapped.getHead() << "\n" - ); + << "new of modify is " << &anchor_to_mapped.getHead() << "\n"); } if (!anchor_to_mapped.isTransposeOf(mapped_to_anchor)) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" << "Given Connectors between anchor and mapped of modify\n" << "are not transposes of each other.\n" - << "See Connector::isTransposeOf().\n" - ); + << "See Connector::isTransposeOf().\n"); } - if (new_to_old.isFinalized() && - !new_to_old.isTransposeOf(old_to_new)) { + if (new_to_old && new_to_old->isFinalized() && + !new_to_old->isTransposeOf(old_to_new)) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" << "Given Connectors between new and old of modify\n" << "are not transposes of each other.\n" - << "See Connector::isTransposeOf().\n" - ); + << "See Connector::isTransposeOf().\n"); } if (anchor_to_mapped.getParallelState() != BoxLevel::DISTRIBUTED) { TBOX_ERROR("Bad input for MappingConnectorAlgorithm::modify:\n" @@ -886,18 +775,22 @@ MappingConnectorAlgorithm::privateModify_checkParameters( if (d_sanity_check_inputs) { anchor_to_mapped.assertTransposeCorrectness(mapped_to_anchor); mapped_to_anchor.assertTransposeCorrectness(anchor_to_mapped); - if (new_to_old.isFinalized()) { + if (new_to_old && new_to_old->isFinalized()) { /* * Not sure if the following are valid checks for modify operation. * Modify *may* have different restrictions on the mapping Connector. */ - new_to_old.assertTransposeCorrectness(old_to_new); - old_to_new.assertTransposeCorrectness(new_to_old); + new_to_old->assertTransposeCorrectness(old_to_new); + old_to_new.assertTransposeCorrectness(*new_to_old); } - size_t nerrs = findMappingErrors(old_to_new); + size_t nerrs = old_to_new.findMappingErrors(); if (nerrs != 0) { TBOX_ERROR("MappingConnectorUtil::privateModify: found errors in\n" - << "mapping Connector."); + << "mapping Connector.\n" + << "old:\n" << old_to_new.getBase().format("OLD: ") + << "new:\n" << old_to_new.getHead().format("NEW: ") + << "old_to_new:\n" << old_to_new.format("O->N: ") + << std::endl); } } } @@ -910,28 +803,29 @@ MappingConnectorAlgorithm::privateModify_checkParameters( */ void MappingConnectorAlgorithm::privateModify_removeAndCache( - std::map >& neighbor_removal_mesg, + std::map >& send_mesgs, Connector& anchor_to_new, Connector* new_to_anchor, - const Connector& old_to_new) const + const MappingConnector& old_to_new) const { - t_modify_remove_and_cache->start(); + d_object_timers->t_modify_remove_and_cache->start(); const tbox::Dimension& dim(old_to_new.getBase().getDim()); - const tbox::SAMRAI_MPI& mpi(old_to_new.getBase().getMPI()); + const tbox::SAMRAI_MPI& mpi = d_mpi.getCommunicator() == MPI_COMM_NULL ? + old_to_new.getBase().getMPI() : d_mpi; const int rank(mpi.getRank()); /* - * Remove relationships with old mapped_boxes (because + * Remove relationships with old boxes (because * they are going away). These are Boxes mapped by * old_to_new. * * Erase local old Boxes from new_to_anchor. * - * If the old mapped_boxes have neighbors in the anchor + * If the old boxes have neighbors in the anchor * BoxLevel, some relationships from anchor_eto_old should be - * erased also. For each neighbor from a remote anchor mapped_box to a - * local old mapped_box, add data to mesg_to_owners saying what + * erased also. For each neighbor from a remote anchor box to a + * local old box, add data to mesg_to_owners saying what * Box is disappearing and what anchor Box should * no longer reference it. */ @@ -939,7 +833,7 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( iold != old_to_new.end(); ++iold) { const BoxId& old_gid_gone = *iold; - const Box old_mapped_box_gone(dim, old_gid_gone); + const Box old_box_gone(dim, old_gid_gone); if (new_to_anchor->hasNeighborSet(old_gid_gone)) { // old_gid_gone exists in new_to_anchor. Remove it. @@ -948,12 +842,12 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( new_to_anchor->find(old_gid_gone); if (s_print_steps == 'y') { - tbox::plog << "Box " << old_mapped_box_gone + tbox::plog << "Box " << old_box_gone << " is gone." << std::endl; } for (Connector::ConstNeighborIterator ianchor = - new_to_anchor->begin(affected_anchor_nbrhd); + new_to_anchor->begin(affected_anchor_nbrhd); ianchor != new_to_anchor->end(affected_anchor_nbrhd); /* incremented in loop */) { if (s_print_steps == 'y') { @@ -967,25 +861,26 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( do { if (s_print_steps == 'y') { - tbox::plog << " Fixing affected mapped_box " << *ianchor + tbox::plog << " Fixing affected box " << *ianchor << std::endl; } - TBOX_ASSERT(anchor_to_new.hasNeighborSet(ianchor->getId())); + TBOX_ASSERT(anchor_to_new.hasNeighborSet(ianchor->getBoxId())); if (s_print_steps == 'y') { - anchor_to_new.writeNeighborhoodToErrorStream( - ianchor->getId()); + anchor_to_new.writeNeighborhoodToStream( + tbox::plog, + ianchor->getBoxId()); tbox::plog << std::endl; } - if (anchor_to_new.hasLocalNeighbor(ianchor->getId(), - old_mapped_box_gone)) { + if (anchor_to_new.hasLocalNeighbor(ianchor->getBoxId(), + old_box_gone)) { if (s_print_steps == 'y') { - tbox::plog << " Removing neighbor " << old_mapped_box_gone + tbox::plog << " Removing neighbor " << old_box_gone << " from list for " << *ianchor << std::endl; } - anchor_to_new.eraseNeighbor(old_mapped_box_gone, - ianchor->getId()); + anchor_to_new.eraseNeighbor(old_box_gone, + ianchor->getBoxId()); } ++ianchor; @@ -1000,8 +895,8 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( ianchor->getOwnerRank() == rank); } else { // Tell owner of nabr to erase references to old_gid_gone. - std::vector& mesg = neighbor_removal_mesg[anchor_nabr_owner]; - // mesg[0] is the counter for how many mapped_boxes are removed. + std::vector& mesg = send_mesgs[anchor_nabr_owner]; + // mesg[0] is the counter for how many boxes are removed. if (mesg.empty()) { mesg.insert(mesg.end(), 1); } else { @@ -1013,7 +908,8 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( mesg.insert(mesg.end(), 0); do { mesg.insert(mesg.end(), ianchor->getLocalId().getValue()); - mesg.insert(mesg.end(), ianchor->getBlockId().getBlockValue()); + mesg.insert(mesg.end(), + static_cast(ianchor->getBlockId().getBlockValue())); ++mesg[i_count]; if (s_print_steps == 'y') tbox::plog << " Request change " << mesg[i_count] @@ -1025,8 +921,8 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( } /* - * Erase relationships from old_mapped_box_gone to anchor - * mapped_box_level. + * Erase relationships from old_box_gone to anchor + * box_level. */ new_to_anchor->eraseLocalNeighborhood(old_gid_gone); @@ -1034,282 +930,343 @@ MappingConnectorAlgorithm::privateModify_removeAndCache( } - t_modify_remove_and_cache->stop(); + d_object_timers->t_modify_remove_and_cache->stop(); } /* *********************************************************************** - * Discover overlaps with new Boxes and send outgoing messages. - * We interlace discovery with sends rather than wait until all - * discovery is completed before sending. This makes sure sends are - * started asap to maximize communication and computation. + * Discover overlaps with new Boxes and send outgoing messages. We thread + * the discovery process for non-local overlaps and then send the overlap + * results. Then we discover the local overlaps and set them in the + * Connector(s). *********************************************************************** */ void MappingConnectorAlgorithm::privateModify_discoverAndSend( - std::map >& neighbor_removal_mesg, + std::map >& send_mesgs, Connector& anchor_to_new, Connector* new_to_anchor, - std::set& incoming_ranks, - std::set& outgoing_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + const std::set& outgoing_ranks, + tbox::AsyncCommPeer* all_comms, BoxContainer& visible_new_nabrs, BoxContainer& visible_anchor_nabrs, - InvertedNeighborhoodSet& anchor_eto_old, - InvertedNeighborhoodSet& new_eto_old, + const InvertedNeighborhoodSet& anchor_eto_old, + const InvertedNeighborhoodSet& new_eto_old, const Connector& old_to_anchor, const Connector& anchor_to_old, - const Connector& old_to_new) const + const MappingConnector& old_to_new) const { - if (!visible_anchor_nabrs.isEmpty() || !visible_new_nabrs.isEmpty()) { + if (visible_anchor_nabrs.empty() && visible_new_nabrs.empty()) { + return; + } - /* - * Discover overlaps. Overlaps are either locally stored or - * packed into a message for sending. - */ + /* + * Discover overlaps. Overlaps are either locally stored or + * packed into a message for sending. + */ - t_modify_discover_and_send->start(); + d_object_timers->t_modify_discover_and_send->start(); - const BoxLevel& old(old_to_new.getBase()); + const BoxLevel& old(old_to_new.getBase()); - const tbox::Dimension& dim(old.getDim()); - const int rank = old.getMPI().getRank(); - const int nproc = old.getMPI().getSize(); + const tbox::Dimension& dim(old.getDim()); + const tbox::SAMRAI_MPI& mpi = d_mpi.getCommunicator() == MPI_COMM_NULL ? + old_to_new.getBase().getMPI() : d_mpi; + const int rank = mpi.getRank(); - /* - * Iterators anchor_ni and new_ni point to the base/head - * Box whose neighbors are being sought. If we are not - * interested in the new-->anchor connector, then new_ni will - * be unused. - * - * Local process can find some neighbors for the (local and - * remote) Boxes in visible_anchor_nabrs and - * visible_new_nabrs. We loop through the visible_anchor_nabrs - * and compare each to visible_new_nabrs, looking for overlaps. - * Then vice versa. - * - * Looping through the NeighborSets is like looping through - * their owners, since they are ordered by owners first. As an - * optimization measure, start loop on the first owner with - * higher rank than the local rank. This avoid the higher-end - * ranks from having to wait for messages at the beginning and - * the lower-end ranks from having to wait for messages at the - * end. After the highest rank owner has been handled, continue - * at the beginning and do the remaining. (If local rank is - * highest of all owners of the visible Boxes, start at - * the begining.) - */ - const Box start_loop_here(dim, GlobalId(LocalId::getZero(), rank + 1)); - BoxContainer::iterator anchor_ni = - visible_anchor_nabrs.lowerBound(start_loop_here); - BoxContainer::iterator new_ni = - visible_new_nabrs.lowerBound(start_loop_here); - - if (anchor_ni == visible_anchor_nabrs.end() && - new_ni == visible_new_nabrs.end()) { - /* - * There are no visible mapped_boxes owned by rank higher than - * local process. So loop from the beginning. - */ - anchor_ni = visible_anchor_nabrs.begin(); - new_ni = visible_new_nabrs.begin(); - } + /* + * Local process can find some neighbors for the (local and + * remote) Boxes in visible_anchor_nabrs and visible_new_nabrs. + * Separate this into 2 parts: discovery of remote Boxes which + * may be threaded, and discovery of local Boxes can not be. + * In either case we loop through the visible_anchor_nabrs and + * compare each to visible_new_nabrs, looking for overlaps. + * Then vice versa. Since each of these NeighborSets is + * ordered by processor owner first and we know each non-local + * processor we can construct each non-local message in a + * separate thread and then find and set all the local overlaps. + * + * To do this we first separate visible_anchor_nabrs into 2 groups + * non-local and local neighbors. Also do the same for + * visible_new_nabrs. + */ + bool ordered = true; + BoxContainer visible_local_anchor_nabrs(ordered); + BoxContainer visible_local_new_nabrs(ordered); + const Box this_proc_start(dim, GlobalId(LocalId::getZero(), rank)); + BoxContainer::iterator anchor_ni = + visible_anchor_nabrs.lowerBound(this_proc_start); + BoxContainer::iterator new_ni = + visible_new_nabrs.lowerBound(this_proc_start); + while (anchor_ni != visible_anchor_nabrs.end() && + anchor_ni->getOwnerRank() == rank) { + visible_local_anchor_nabrs.insert(*anchor_ni); + visible_anchor_nabrs.erase(anchor_ni++); + } + while (new_ni != visible_new_nabrs.end() && + new_ni->getOwnerRank() == rank) { + visible_local_new_nabrs.insert(*new_ni); + visible_new_nabrs.erase(new_ni++); + } - /* - * Set send_comm_idx to reference the first outgoing rank in all_comms. - * It will be incremented to correpond to the peer whose overlaps - * are being searched for. - */ - int send_comm_idx = static_cast(incoming_ranks.size()); + // Discover all non-local overlaps. + int i = 0; + int imax = static_cast(outgoing_ranks.size()); + std::vector another_outgoing_ranks(outgoing_ranks.size()); + for (std::set::const_iterator outgoing_ranks_itr(outgoing_ranks.begin()); + outgoing_ranks_itr != outgoing_ranks.end(); ++outgoing_ranks_itr) { + another_outgoing_ranks[i++] = *outgoing_ranks_itr; + } +#ifdef HAVE_OPENMP +#pragma omp parallel private(i) num_threads(4) + { +#pragma omp for schedule(dynamic) nowait +#endif + for (i = 0; i < imax; ++i) { + BoxId outgoing_proc_start_id( + LocalId::getZero(), + another_outgoing_ranks[i]); + Box outgoing_proc_start(dim, outgoing_proc_start_id); + BoxContainer::const_iterator thread_anchor_ni = + visible_anchor_nabrs.lowerBound(outgoing_proc_start); + BoxContainer::const_iterator thread_new_ni = + visible_new_nabrs.lowerBound(outgoing_proc_start); + privateModify_discover( + send_mesgs[another_outgoing_ranks[i]], + anchor_to_new, + new_to_anchor, + visible_anchor_nabrs, + visible_new_nabrs, + thread_anchor_ni, + thread_new_ni, + another_outgoing_ranks[i], + dim, + rank, + anchor_eto_old, + new_eto_old, + old_to_anchor, + anchor_to_old, + old_to_new); + } +#ifdef HAVE_OPENMP +} +#endif + /* + * Send all non-local overlap messages. + * As an optimization, send to the next higher ranked process first followed + * by successively higher processes and finally looping around to process + * 0 through the next lower ranked process. This spreads out the sends more + * evenly and prevents everyone from sending to the same processor (like + * process 0) at the same time. + */ + int num_outgoing_ranks = static_cast(outgoing_ranks.size()); + int num_incoming_ranks = static_cast(incoming_ranks.size()); + int num_comms = num_outgoing_ranks + num_incoming_ranks; + std::set::const_iterator outgoing_ranks_itr( + outgoing_ranks.lower_bound(rank + 1)); + if (outgoing_ranks_itr == outgoing_ranks.end()) { + outgoing_ranks_itr = outgoing_ranks.begin(); + } + int comm_offset = num_incoming_ranks; + for ( ; comm_offset < num_comms; ++comm_offset) { + if (all_comms[comm_offset].getPeerRank() == *outgoing_ranks_itr) { + break; + } + } + TBOX_ASSERT(num_outgoing_ranks == 0 || comm_offset < num_comms); + for (int outgoing_ranks_ctr = 0; + outgoing_ranks_ctr < num_outgoing_ranks; ++outgoing_ranks_ctr) { + std::vector& send_mesg = send_mesgs[*outgoing_ranks_itr]; + tbox::AsyncCommPeer& outgoing_comm = all_comms[comm_offset]; + outgoing_comm.beginSend( + &send_mesg[0], + static_cast(send_mesg.size())); + ++comm_offset; + ++outgoing_ranks_itr; + TBOX_ASSERT((outgoing_ranks_itr == outgoing_ranks.end()) == + (comm_offset == num_comms)); + if (outgoing_ranks_itr == outgoing_ranks.end()) { + outgoing_ranks_itr = outgoing_ranks.begin(); + } + if (comm_offset == num_comms) { + comm_offset = num_incoming_ranks; + } if (s_print_steps == 'y') { - tbox::plog << "visible_anchor_nabrs:" << std::endl; - for (BoxContainer::const_iterator na = visible_anchor_nabrs.begin(); - na != visible_anchor_nabrs.end(); ++na) { - tbox::plog << " " << *na << std::endl; - } - tbox::plog << "visible_new_nabrs:" << std::endl; - for (BoxContainer::const_iterator na = visible_new_nabrs.begin(); - na != visible_new_nabrs.end(); ++na) { - tbox::plog << " " << *na << std::endl; - } + tbox::plog << "Sent to " << outgoing_comm.getPeerRank() << std::endl; + } + } + + // Discover all local overlaps and store them in the Connector(s). + BoxContainer::const_iterator anchor_local_ni = + visible_local_anchor_nabrs.lowerBound(this_proc_start); + BoxContainer::const_iterator new_local_ni = + visible_local_new_nabrs.lowerBound(this_proc_start); + privateModify_discover( + send_mesgs[rank], + anchor_to_new, + new_to_anchor, + visible_local_anchor_nabrs, + visible_local_new_nabrs, + anchor_local_ni, + new_local_ni, + rank, + dim, + rank, + anchor_eto_old, + new_eto_old, + old_to_anchor, + anchor_to_old, + old_to_new); + + d_object_timers->t_modify_discover_and_send->stop(); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +MappingConnectorAlgorithm::privateModify_discover( + std::vector& send_mesg, + Connector& anchor_to_new, + Connector* new_to_anchor, + const BoxContainer& visible_anchor_nabrs, + const BoxContainer& visible_new_nabrs, + BoxContainer::const_iterator& anchor_ni, + BoxContainer::const_iterator& new_ni, + int curr_owner, + const tbox::Dimension& dim, + int rank, + const InvertedNeighborhoodSet& anchor_eto_old, + const InvertedNeighborhoodSet& new_eto_old, + const Connector& old_to_anchor, + const Connector& anchor_to_old, + const MappingConnector& old_to_new) const +{ + if (s_print_steps == 'y') { + tbox::plog << "visible_anchor_nabrs:" << std::endl; + for (BoxContainer::const_iterator na = visible_anchor_nabrs.begin(); + na != visible_anchor_nabrs.end(); ++na) { + tbox::plog << " " << *na << std::endl; + } + tbox::plog << "visible_new_nabrs:" << std::endl; + for (BoxContainer::const_iterator na = visible_new_nabrs.begin(); + na != visible_new_nabrs.end(); ++na) { + tbox::plog << " " << *na << std::endl; } + } #ifdef DEBUG_CHECK_ASSERTIONS - // Owners that we have sent messages to. Used for debugging. - std::set owners_sent_to; + // Owners that we have sent messages to. Used for debugging. + std::set owners_sent_to; #endif - /* - * Loop until all visible neighbors have their neighbors - * searched for. But only do this for the new Boxes if - * we are actively seeking neighbor data for them. - */ - while ((anchor_ni != visible_anchor_nabrs.end()) || - (new_ni != visible_new_nabrs.end())) { + TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); - /* - * curr_owner is the owner whose neighbors is currently being - * searched for. It should be the owner of the next anchor or - * new Box in our cyclic-type looping. - */ - int curr_owner = nproc; // Start with invalid value. - if (anchor_ni != visible_anchor_nabrs.end() && - curr_owner > (*anchor_ni).getOwnerRank()) { - curr_owner = (*anchor_ni).getOwnerRank(); - } - if (new_ni != visible_new_nabrs.end() && - curr_owner > (*new_ni).getOwnerRank()) { - curr_owner = (*new_ni).getOwnerRank(); - } + /* + * Set up send_message to contain info discovered + * locally and should be sent to curr_owner. + * + * Content of send_mesg: + * - neighbor-removal section cached in send_mesg. + * - offset to the reference section (see below) + * - number of anchor boxes for which neighbors are found + * - number of new boxes for which neighbors are found + * - id of base/head box + * - number of neighbors found for base/head box. + * - BoxId of neighbors found. + * Boxes of found neighbors are given in the + * reference section of the message. + * - reference section: all the boxes referenced as + * neighbors (accumulated in referenced_anchor_nabrs + * and referenced_new_nabrs). + * - number of referenced base neighbors + * - number of referenced head neighbors + * - referenced base neighbors + * - referenced head neighbors + * + * The purpose of factoring out info on the neighbors referenced + * is to reduce redundant data that can eat up lots of memory + * and message passing bandwidth when there are lots of Boxes + * with the same neighbors. + */ - TBOX_ASSERT(curr_owner < nproc); - TBOX_ASSERT(curr_owner > -1); - TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); + /* + * The first section of the send_mesg is the remote neighbor-removal + * section (computed above). + */ + if (curr_owner != rank && send_mesg.empty()) { + // No neighbor-removal data found for curr_owner. + send_mesg.insert(send_mesg.end(), 0); + } - /* - * Set up send_message to contain info discovered - * locally and should be sent to curr_owner. - * - * Content of send_mesg: - * - neighbor-removal section cached in neighbor_removal_mesg. - * - offset to the reference section (see below) - * - number of anchor mapped_boxes for which neighbors are found - * - number of new mapped_boxes for which neighbors are found - * - id of base/head mapped_box - * - number of neighbors found for base/head mapped_box. - * - BoxId of neighbors found. - * Boxes of found neighbors are given in the - * reference section of the message. - * - reference section: all the mapped_boxes referenced as - * neighbors (accumulated in referenced_anchor_nabrs - * and referenced_new_nabrs). - * - number of referenced base neighbors - * - number of referenced head neighbors - * - referenced base neighbors - * - referenced head neighbors - * - * The purpose of factoring out info on the neighbors referenced - * is to reduce redundant data that can eat up lots of memory - * and message passing bandwidth when there are lots of Boxes - * with the same neighbors. - */ - std::vector send_mesg; + // Indices of certain positions in send_mesg. + const int idx_offset_to_ref = static_cast(send_mesg.size()); + const int idx_num_anchor_boxes = idx_offset_to_ref + 1; + const int idx_num_new_boxes = idx_offset_to_ref + 2; + send_mesg.insert(send_mesg.end(), 3, 0); - /* - * The first section of the send_mesg is the remote neighbor-removal - * section (computed above). - */ - if (curr_owner != rank) { - // swap( send_mesg, neighbor_removal_mesg[curr_owner] ); - // We could use swap, but assign instead to leave data for debugging. - send_mesg = neighbor_removal_mesg[curr_owner]; - if (send_mesg.empty()) { - // No neighbor-removal data found for curr_owner. - send_mesg.insert(send_mesg.end(), 0); - } - } + // Boxes referenced in the message, used when adding ref section. + BoxContainer referenced_anchor_nabrs; + BoxContainer referenced_new_nabrs; - // Indices of certain positions in send_mesg. - const int idx_offset_to_ref = static_cast(send_mesg.size()); - const int idx_num_anchor_mapped_boxes = idx_offset_to_ref + 1; - const int idx_num_new_mapped_boxes = idx_offset_to_ref + 2; - send_mesg.insert(send_mesg.end(), 3, 0); + /* + * Find locally visible new neighbors for all anchor Boxes owned by + * curr_owner. + */ + privateModify_findOverlapsForOneProcess( + curr_owner, + visible_anchor_nabrs, + anchor_ni, + send_mesg, + idx_num_anchor_boxes, + anchor_to_new, + referenced_new_nabrs, + anchor_to_old, + old_to_anchor, + old_to_new, + anchor_eto_old, + old_to_new.getHead().getRefinementRatio()); - // Mapped_boxes referenced in the message, used when adding ref section. - BoxContainer referenced_anchor_nabrs; // Referenced neighbors in anchor. - BoxContainer referenced_new_nabrs; // Referenced neighbors in new. + /* + * Find locally visible anchor neighbors for all new Boxes owned by + * curr_owner. + */ + privateModify_findOverlapsForOneProcess( + curr_owner, + visible_new_nabrs, + new_ni, + send_mesg, + idx_num_new_boxes, + *new_to_anchor, + referenced_anchor_nabrs, + *new_to_anchor, + anchor_to_new, + old_to_anchor, + new_eto_old, + old_to_anchor.getHead().getRefinementRatio()); - /* - * Find locally visible new neighbors for all base - * Boxes owned by owner_rank. - */ - privateModify_findOverlapsForOneProcess( - curr_owner, - visible_anchor_nabrs, - anchor_ni, - send_mesg, - idx_num_anchor_mapped_boxes, - anchor_to_new, - referenced_new_nabrs, - anchor_to_old, - old_to_anchor, - old_to_new, - anchor_eto_old, - old.getRefinementRatio()); + if (curr_owner != rank) { + /* + * If this discovery is off processor then the send message must be + * filled with the referenced neighbors. + */ - /* - * Find locally visible anchor neighbors for all new - * Boxes owned by curr_owner. - */ - privateModify_findOverlapsForOneProcess( - curr_owner, - visible_new_nabrs, - new_ni, - send_mesg, - idx_num_new_mapped_boxes, - *new_to_anchor, - referenced_anchor_nabrs, - *new_to_anchor, - anchor_to_new, - old_to_anchor, - new_eto_old, - old_to_new.getHead().getRefinementRatio()); - - if (curr_owner != rank) { - /* - * Send discoveries to the curr_owner. - */ + packReferencedNeighbors( + send_mesg, + idx_offset_to_ref, + referenced_new_nabrs, + referenced_anchor_nabrs, + dim, + s_print_steps == 'y'); - /* - * Find the communication object by increasing send_comm_idx - * (cyclically) until it corresponds to curr_owner. - */ - while (all_comms[send_comm_idx].getPeerRank() != curr_owner) { - ++send_comm_idx; - if (send_comm_idx == static_cast(incoming_ranks.size() + - outgoing_ranks.size())) - send_comm_idx -= static_cast(outgoing_ranks.size()); - } - tbox::AsyncCommPeer& outgoing_comm = all_comms[send_comm_idx]; - TBOX_ASSERT(outgoing_comm.getPeerRank() == curr_owner); - - sendDiscoveryToOneProcess( - send_mesg, - idx_offset_to_ref, - referenced_new_nabrs, - referenced_anchor_nabrs, - outgoing_comm, - dim); - - TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); #ifdef DEBUG_CHECK_ASSERTIONS - owners_sent_to.insert(curr_owner); + owners_sent_to.insert(curr_owner); #endif - } - - /* - * If we come to the end of visible mapped_boxes, go back and - * work on the mapped_boxes owned by processors with lower rank - * than the local rank. (This is part of the optimization to - * reduce communication time.) - */ - if (anchor_ni == visible_anchor_nabrs.end() && - new_ni == visible_new_nabrs.end()) { - /* - * There are no mapped_boxes that are owned by rank higher - * than local process and that we want to find neighbors for. - * So loop from the beginning. - */ - anchor_ni = visible_anchor_nabrs.begin(); - new_ni = visible_new_nabrs.begin(); - } - - } - - t_modify_discover_and_send->stop(); - } + } // Block to send discoveries to curr_owner. } /* @@ -1318,36 +1275,39 @@ MappingConnectorAlgorithm::privateModify_discoverAndSend( * Find overlaps from visible_base_nabrs to head_rbbt. Find only * overlaps for Boxes owned by owner_rank. * - * On input, base_ni points to the first Box in visible_base_nabrs + * On entry, base_ni points to the first Box in visible_base_nabrs * owned by owner_rank. Increment base_ni past those Boxes * processed and remove them from visible_base_nabrs. * * Save local and semilocal overlaps in bridging_connector. For * remote overlaps, pack in send_mesg, add head Box to * referenced_head_nabrs and increment - * send_mesg[remote_mapped_box_counter_index]. + * send_mesg[remote_box_counter_index]. * *********************************************************************** */ void MappingConnectorAlgorithm::privateModify_findOverlapsForOneProcess( const int owner_rank, - BoxContainer& visible_base_nabrs, - BoxContainer::iterator& base_ni, + const BoxContainer& visible_base_nabrs, + BoxContainer::const_iterator& base_ni, std::vector& send_mesg, - const int remote_box_counter_index, + int remote_box_counter_index, Connector& mapped_connector, BoxContainer& referenced_head_nabrs, const Connector& unmapped_connector, const Connector& unmapped_connector_transpose, const Connector& mapping_connector, - InvertedNeighborhoodSet& inverted_nbrhd, - const IntVector& refinement_ratio) const + const InvertedNeighborhoodSet& inverted_nbrhd, + const IntVector& head_refinement_ratio) const { + d_object_timers->t_modify_find_overlaps_for_one_process->start(); + const BoxLevel& old = mapping_connector.getBase(); const boost::shared_ptr& grid_geometry( old.getGridGeometry()); - const int rank = old.getMPI().getRank(); + const tbox::SAMRAI_MPI& mpi = d_mpi.getCommunicator() == MPI_COMM_NULL ? old.getMPI() : d_mpi; + const int rank = mpi.getRank(); while (base_ni != visible_base_nabrs.end() && base_ni->getOwnerRank() == owner_rank) { @@ -1357,48 +1317,75 @@ MappingConnectorAlgorithm::privateModify_findOverlapsForOneProcess( << base_box << std::endl; } Box compare_box = base_box; - compare_box.grow(mapped_connector.getConnectorWidth()); - if (unmapped_connector.getHeadCoarserFlag()) { - compare_box.coarsen(unmapped_connector.getRatio()); - } - else if (unmapped_connector_transpose.getHeadCoarserFlag()) { - compare_box.refine(unmapped_connector_transpose.getRatio()); - } + BoxContainer compare_boxes; - BlockId compare_box_block_id(base_box.getBlockId()); - Box transformed_compare_box(compare_box); + if (grid_geometry->getNumberBlocks() == 1 || + grid_geometry->hasIsotropicRatios()) { + compare_box.grow(mapped_connector.getConnectorWidth()); + if (unmapped_connector.getHeadCoarserFlag()) { + compare_box.coarsen(unmapped_connector.getRatio()); + } + else if (unmapped_connector_transpose.getHeadCoarserFlag()) { + compare_box.refine(unmapped_connector_transpose.getRatio()); + } + compare_boxes.push_back(compare_box); + } else { + TBOX_ASSERT(unmapped_connector.getRatio() == + unmapped_connector_transpose.getRatio()); + BoxUtilities::growAndAdjustAcrossBlockBoundary( + compare_boxes, + compare_box, + grid_geometry, + mapped_connector.getBase().getRefinementRatio(), + unmapped_connector.getRatio(), + mapped_connector.getConnectorWidth(), + unmapped_connector_transpose.getHeadCoarserFlag(), + unmapped_connector.getHeadCoarserFlag()); + } std::vector found_nabrs; - const BoxIdSet& old_indices = inverted_nbrhd[base_box]; - - for (BoxIdSet::const_iterator na = old_indices.begin(); - na != old_indices.end(); ++na) { - Connector::ConstNeighborhoodIterator nbrhd = - mapping_connector.findLocal(*na); - if (nbrhd != mapping_connector.end()) { - /* - * There are anchor Boxes with relationships to - * the old Box identified by *na. - */ - for (Connector::ConstNeighborIterator naa = - mapping_connector.begin(nbrhd); - naa != mapping_connector.end(nbrhd); ++naa) { - const Box& new_nabr(*naa); - if (compare_box_block_id != new_nabr.getBlockId()) { - // Re-transform compare_box and note its new BlockId. - transformed_compare_box = compare_box; - compare_box_block_id = new_nabr.getBlockId(); - if (compare_box_block_id != base_box.getBlockId()) { - grid_geometry->transformBox( - transformed_compare_box, - refinement_ratio, - new_nabr.getBlockId(), - base_box.getBlockId()); + for (BoxContainer::iterator c_itr = compare_boxes.begin(); + c_itr != compare_boxes.end(); ++c_itr) { + const Box& comp_box = *c_itr; + BlockId compare_box_block_id(comp_box.getBlockId()); + Box transformed_compare_box(comp_box); + + InvertedNeighborhoodSet::const_iterator ini = + inverted_nbrhd.find(base_box); + if (ini != inverted_nbrhd.end()) { + const BoxIdSet& old_indices = ini->second; + + for (BoxIdSet::const_iterator na = old_indices.begin(); + na != old_indices.end(); ++na) { + Connector::ConstNeighborhoodIterator nbrhd = + mapping_connector.findLocal(*na); + if (nbrhd != mapping_connector.end()) { + /* + * There are anchor Boxes with relationships to + * the old Box identified by *na. + */ + for (Connector::ConstNeighborIterator naa = + mapping_connector.begin(nbrhd); + naa != mapping_connector.end(nbrhd); ++naa) { + const Box& new_nabr(*naa); + transformed_compare_box = comp_box; + bool do_intersect = true; + if (compare_box_block_id != new_nabr.getBlockId()) { + // Re-transform compare_box and note its new BlockId. + do_intersect = + grid_geometry->transformBox( + transformed_compare_box, + head_refinement_ratio, + new_nabr.getBlockId(), + compare_box_block_id); + } + if (do_intersect) { + if (transformed_compare_box.intersects(new_nabr)) { + found_nabrs.insert(found_nabrs.end(), *naa); + } + } } } - if (transformed_compare_box.intersects(new_nabr)) { - found_nabrs.insert(found_nabrs.end(), *naa); - } } } } @@ -1419,17 +1406,17 @@ MappingConnectorAlgorithm::privateModify_findOverlapsForOneProcess( send_mesg.insert(send_mesg.end(), subsize, -1); int* submesg = &send_mesg[send_mesg.size() - subsize]; *(submesg++) = base_box.getLocalId().getValue(); - *(submesg++) = base_box.getBlockId().getBlockValue(); + *(submesg++) = static_cast( + base_box.getBlockId().getBlockValue()); *(submesg++) = static_cast(found_nabrs.size()); for (std::vector::const_iterator na = found_nabrs.begin(); na != found_nabrs.end(); ++na) { const Box& nabr = *na; referenced_head_nabrs.insert(nabr); - nabr.getId().putToIntBuffer(submesg); + nabr.getBoxId().putToIntBuffer(submesg); submesg += BoxId::commBufferSize(); } - } - else { + } else { /* * Save neighbor info locally. * @@ -1438,7 +1425,7 @@ MappingConnectorAlgorithm::privateModify_findOverlapsForOneProcess( */ if (!found_nabrs.empty()) { Connector::NeighborhoodIterator base_box_itr = - mapped_connector.makeEmptyLocalNeighborhood(base_box.getId()); + mapped_connector.makeEmptyLocalNeighborhood(base_box.getBoxId()); for (std::vector::const_iterator na = found_nabrs.begin(); na != found_nabrs.end(); ++na) { mapped_connector.insertLocalNeighbor(*na, base_box_itr); @@ -1449,270 +1436,98 @@ MappingConnectorAlgorithm::privateModify_findOverlapsForOneProcess( if (s_print_steps == 'y') { tbox::plog << "Erasing visible base nabr " << (*base_ni) << std::endl; } - visible_base_nabrs.erase(base_ni++); + ++base_ni; if (s_print_steps == 'y') { if (base_ni == visible_base_nabrs.end()) { tbox::plog << "Next base nabr: end" << std::endl; - } - else { + } else { tbox::plog << "Next base nabr: " << *base_ni << std::endl; } } } + + d_object_timers->t_modify_find_overlaps_for_one_process->stop(); } /* *********************************************************************** - * Run findMappingErrors and assert that no errors are found. *********************************************************************** */ void -MappingConnectorAlgorithm::assertMappingValidity( - const Connector& connector, - char is_local_map) const +MappingConnectorAlgorithm::initializeCallback() { - size_t nerr = findMappingErrors(connector, is_local_map); - if (nerr != 0) { - tbox::perr << "MappingConnectorAlgorithm::assertMappingValidity found\n" - << nerr << " errors.\n" - << "mapping connector:\n" << connector.format("MAP: ", 2) - << "pre-map:\n" << connector.getBase().format("PRE: ", 2) - << "post-map:\n" << connector.getHead().format("POST: ", 2) - << std::endl; - TBOX_ERROR("MappingConnectorAlgorithm::assertMappingValidity exiting due\n" - << "to above errors."); - } + // Initialize timers with default prefix. + getAllTimers(s_default_timer_prefix, + s_static_timers[s_default_timer_prefix]); + } /* - *********************************************************************** - *********************************************************************** + *************************************************************************** + * Free statics. To be called by shutdown registry to make sure + * memory for statics do not leak. + *************************************************************************** */ -size_t -MappingConnectorAlgorithm::findMappingErrors( - const Connector& connector, - char is_local_map) const +void +MappingConnectorAlgorithm::finalizeCallback() { - const tbox::SAMRAI_MPI& mpi(connector.getMPI()); - - // Need to know whether this is a local map. - if (is_local_map == '\0') { - if (mpi.getSize() > 1) { - for (Connector::ConstNeighborhoodIterator ei = connector.begin(); - ei != connector.end(); ++ei) { - for (Connector::ConstNeighborIterator ni = connector.begin(ei); - ni != connector.end(ei); ++ni) { - if ((*ni).getOwnerRank() != connector.getMPI().getRank()) { - is_local_map = 'n'; - break; - } - } - if (is_local_map == 'n') { - break; - } - } - if (is_local_map != 'n') { - is_local_map = 'y'; - } - int tmpi = is_local_map == 'y' ? 0 : 1; - int tmpj; // For some reason, MPI_IN_PLACE is undeclared! - mpi.Allreduce(&tmpi, &tmpj, 1, MPI_INT, MPI_MAX); - if (tmpj > 0) is_local_map = 'n'; - } else { - is_local_map = 'y'; - } - } - - /* - * If not a local map, we need a globalized copy of the head. - */ - const BoxLevel& new_mapped_box_level = - is_local_map == 'y' ? connector.getHead() : - connector.getHead().getGlobalizedVersion(); - - int error_count = 0; - - /* - * Find old Boxes that changed or disappeared on - * the new BoxLevel. There should be a mapping for each - * Box that changed or disappeared. - */ - const BoxContainer& old_mapped_boxes = connector.getBase().getBoxes(); - for (RealBoxConstIterator ni(old_mapped_boxes.realBegin()); - ni != old_mapped_boxes.realEnd(); ++ni) { - const Box& old_mapped_box = *ni; - if (!new_mapped_box_level.hasBox(old_mapped_box)) { - // old_mapped_box disappeared. Require a mapping for old_mapped_box. - if (!connector.hasNeighborSet(old_mapped_box.getId())) { - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): old mapped_box " << old_mapped_box - << " disappeared without being mapped." << std::endl; - } - } else { - const Box& new_mapped_box = - *(new_mapped_box_level.getBoxStrict(old_mapped_box)); - if (!new_mapped_box.isSpatiallyEqual(old_mapped_box)) { - // old_mapped_box has changed its box. A mapping must exist for it. - if (!connector.hasNeighborSet(old_mapped_box.getId())) { - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): old mapped_box " << old_mapped_box - << " changed to " << new_mapped_box - << " without being mapped." << std::endl; - } - } - } - } - - /* - * All mappings should point from a old Box to a new - * set of Boxes. - */ - for (Connector::ConstNeighborhoodIterator ei = connector.begin(); - ei != connector.end(); ++ei) { - - const BoxId& gid = *ei; - - if (!connector.getBase().hasBox(gid)) { - // Mapping does not go from a old mapped_box. - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): mapping given for nonexistent index " << gid - << std::endl; - } else { - const Box& old_mapped_box = - *(connector.getBase().getBoxStrict(gid)); - - Box grown_box(old_mapped_box); - grown_box.grow(connector.getConnectorWidth()); - - for (Connector::ConstNeighborIterator ni = connector.begin(ei); - ni != connector.end(ei); ++ni) { - const Box& nabr = *ni; - - if (!grown_box.contains(nabr)) { - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): old mapped_box " << old_mapped_box - << " grown by " << connector.getConnectorWidth() - << " to " << grown_box << " does not contain neighbor " - << nabr << std::endl; - } - - if (!new_mapped_box_level.hasBox(nabr)) { - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): old mapped_box " << old_mapped_box - << " mapped to nonexistent new mapped_box " - << nabr << std::endl; - } else { - const Box& head_mapped_box = - *(new_mapped_box_level.getBoxStrict(nabr.getId())); - if (!nabr.isSpatiallyEqual(head_mapped_box)) { - ++error_count; - tbox::perr << "MappingConnectorAlgorithm::findMappingError (" - << error_count - << "): old mapped_box " << old_mapped_box - << " mapped to neighbor " << nabr - << " inconsistent new mapped_box " - << head_mapped_box << std::endl; - } - } - - } - } - } - - return error_count; + s_static_timers.clear(); } /* *********************************************************************** *********************************************************************** */ - void -MappingConnectorAlgorithm::initializeCallback() +MappingConnectorAlgorithm::setTimerPrefix( + const std::string& timer_prefix) { - /* - * While we figure out how to use multiple communicators in SAMRAI, - * we are still assuming that all communications use congruent - * communicators. This class just makes a duplicate communicator - * to protect itself from unrelated communications in shared - * communicators. - */ - if (tbox::SAMRAI_MPI::usingMPI()) { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - s_class_mpi.dupCommunicator(mpi); + std::string timer_prefix_used; + if (s_ignore_external_timer_prefix == 'y') { + timer_prefix_used = s_default_timer_prefix; + } else { + timer_prefix_used = timer_prefix; } - - /* - * - gets timers from the TimerManager. - * - sets up their deallocation. - * - sets up debugging flags. - */ - - if (s_print_steps == '\0') { - if (tbox::InputManager::inputDatabaseExists()) { - s_print_steps = 'n'; - boost::shared_ptr idb( - tbox::InputManager::getInputDatabase()); - if (idb->isDatabase("MappingConnectorAlgorithm")) { - boost::shared_ptr ocu_db( - idb->getDatabase("MappingConnectorAlgorithm")); - s_print_steps = ocu_db->getCharWithDefault("print_modify_steps", - s_print_steps); - } - } + std::map::iterator ti( + s_static_timers.find(timer_prefix_used)); + if (ti == s_static_timers.end()) { + d_object_timers = &s_static_timers[timer_prefix_used]; + getAllTimers(timer_prefix_used, *d_object_timers); + } else { + d_object_timers = &(ti->second); } - - t_modify = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::privateModify()"); - t_modify_setup_comm = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::setupCommunication()"); - t_modify_remove_and_cache = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::privateModify_removeAndCache()"); - t_modify_discover_and_send = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::privateModify_discoverAndSend()"); - t_modify_receive_and_unpack = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::receiveAndUnpack()"); - t_modify_MPI_wait = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::privateModify()_MPI_wait"); - t_modify_misc = tbox::TimerManager::getManager()-> - getTimer("hier::MappingConnectorAlgorithm::privateModify()_misc"); } /* - *************************************************************************** - * Free statics. To be called by shutdown registry to make sure - * memory for statics do not leak. - *************************************************************************** + *********************************************************************** + *********************************************************************** */ - void -MappingConnectorAlgorithm::finalizeCallback() +MappingConnectorAlgorithm::getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers) { - t_modify.reset(); - t_modify_setup_comm.reset(); - t_modify_remove_and_cache.reset(); - t_modify_discover_and_send.reset(); - t_modify_receive_and_unpack.reset(); - t_modify_MPI_wait.reset(); - t_modify_misc.reset(); - - if (s_class_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - s_class_mpi.freeCommunicator(); - } + timers.t_modify_public = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::modify()_public"); + timers.t_modify = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify()"); + timers.t_modify_setup_comm = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::setupCommunication()"); + timers.t_modify_remove_and_cache = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify_removeAndCache()"); + timers.t_modify_discover_and_send = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify_discoverAndSend()"); + timers.t_modify_find_overlaps_for_one_process = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify_findOverlapsForOneProcess()"); + timers.t_modify_receive_and_unpack = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::receiveAndUnpack()"); + timers.t_modify_MPI_wait = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify()_MPI_wait"); + timers.t_modify_misc = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateModify()_misc"); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.h index 5c388db4..5cf047d8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MappingConnectorAlgorithm.h @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Algorithms to work with maping Connectors. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Algorithms to work with MapingConnectors. * ************************************************************************/ #ifndef included_hier_MappingConnectorAlgorithm @@ -12,6 +12,8 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/BaseConnectorAlgorithm.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" #include #include @@ -20,12 +22,12 @@ namespace SAMRAI { namespace hier { /*! - * @brief Algorithms for using Connectors representing changes + * @brief Algorithms for using MappingConnectors representing changes * to a BoxLevel. * * MappingConnectorAlgorithm objects check and apply mappings. */ -class MappingConnectorAlgorithm : public BaseConnectorAlgorithm +class MappingConnectorAlgorithm:public BaseConnectorAlgorithm { public: @@ -42,6 +44,23 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm */ virtual ~MappingConnectorAlgorithm(); + /*! + * @brief Set whether to barrier before potential major + * communication. + * + * This developer feature makes sure all processes start major + * operations at the same time so that timers do not include the + * time waiting for slower processes to get to the starting point. + * + * @param[in] do_barrier + */ + void + setBarrierBeforeCommunication( + bool do_barrier) + { + d_barrier_before_communication = do_barrier; + } + /*! * @brief Set whether to run expensive sanity checks on input * parameters when at the beginning of certain methods. @@ -52,7 +71,10 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm */ void setSanityCheckMethodPreconditions( - bool do_check); + bool do_check) + { + d_sanity_check_inputs = do_check; + } /*! * @brief Set whether to run expensive sanity checks on outputs @@ -64,20 +86,42 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm */ void setSanityCheckMethodPostconditions( - bool do_check); + bool do_check) + { + d_sanity_check_outputs = do_check; + } + + /*! + * @brief Set the SAMRAI_MPI to use. + * + * If set, communication will use the specified SAMRAI_MPI instead + * of the SAMRAI_MPI from BoxLevels. This protects communication + * operations from accidentally interacting with unrelated + * communications, but it limits operations to work only with + * metadata objects with comptatible (congruent) SAMRAI_MPI + * objects. + * + * If make_duplicate is true, the specified SAMRAI_MPI will be + * duplicated for exclusise use. The duplicate will be freed upon + * object destruction. + */ + void + setSAMRAI_MPI( + const tbox::SAMRAI_MPI& mpi, + bool make_duplicate = true); /*! * @brief Most general version for modifying Connectors using - * mapping Connectors. Modification is the changing of existing - * Connectors when mapped_boxes in a BoxLevel changes according to specified - * mapping connectors. + * MappingConnectors. Modification is the changing of existing + * Connectors when boxes in a BoxLevel changes according to specified + * MappingConnectors. * * The change is represented by a the mapper @c old_to_new - * and its transpose @c new_to_old. The Connectors to be - * modified are @c anchor_to_mapped and @c mapped_to_anchor, which - * on input, go between a anchor (not mapped) BoxLevel and the old - * BoxLevel. On output, these Connectors will go from the anchor mapped_box_level - * to the new mapped_box_level. + * and its transpose, new_to_old. The Connectors to be + * modified are @c anchor_to_mapped and its transpose mapped_to_anchor, + * which on input, go between an anchor (not mapped) BoxLevel and the old + * BoxLevel. On output, these Connectors will go from the anchor box_level + * to the new box_level. * * @code * Input: @@ -88,7 +132,7 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm * mapped_to_anchor-> / / * / / <--anchor_to_mapped * / v - * mapped mapped_box_level: (old) ---------> (new) + * mapped box_level: (old) ---------> (new) * <--------- * * @@ -108,12 +152,12 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm * by the base and head of the mapping. No BoxLevel is modified, * other than the "mutable" BoxLevels in the argument. * - * An important constraint in the old_to_new Connectors is + * An important constraint in the old_to_new MappingConnectors is * that this method cannot handle multiple maps at once. For - * example, it cannot map mapped_box J to mapped_box K and at the - * same time map mapped_box I to mapped_box J. Box J in the - * old mapped_box_level and mapped_box J on the new - * mapped_box_level are considered entirely different mapped_boxes. + * example, it cannot map box J to box K and at the + * same time map box I to box J. Box J in the + * old box_level and box J on the new + * box_level are considered entirely different boxes. * * After modifying, the output Connectors that had referenced old * BoxLevels will be reset to reference the new @@ -142,191 +186,54 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm * * @param[in,out] anchor_to_mapped Connector to be modified. On input, this * points to the BoxLevel being mapped. - * @param[in,out] mapped_to_anchor Reverse (transpose) of anchor_to_mapped. - * points to the BoxLevel being mapped. * @param[in] old_to_new Mapping from the old BoxLevel to the * new BoxLevel. * The width of old-->new should indicate the maximum amount of box * growth caused by the change. A value of zero means no growth. - * @param[in] new_to_old Reverse (transpose) of old_to_new. * @param[in,out] mutable_new See comments. * @param[in,out] mutable_old See comments. - */ - void - modify( - Connector& anchor_to_mapped, - Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old, - BoxLevel* mutable_new = NULL, - BoxLevel* mutable_old = NULL) const; - - /*! - * @brief Version of modify requiring only the forward map - * and allows only local mappings. - * - * This version does not require the reverse mapping, but the - * mapping must be totally local, e.g. old_to_new must - * contain no remote neighbor. - * - * @code - * Input: - * - * (anchor) - * ^ / - * / / - * mapped_to_anchor-> / / - * / / <--anchor_to_mapped - * / v - * mapped mapped_box_level: (old) ---------> (new) - * - * - * Output: - * - * (anchor) - * \ ^ - * \ \ - * \ \ <-mapped_to_anchor - * anchor_to_mapped --> \ \ - * v \ - * (new) - * - * @endcode - * - * The modify methods support these optional steps as follows: If - * mutable versions of some BoxLevel are given, the output - * Connectors can be reset to reference these versions instead. - * - * If mutable_new points to the old BoxLevel and mutable_old - * points to the new, then do an in-place switch as follows: - * @li Swap the mutable_old and mutable_new BoxLevels. - * @li Use mutable_old (which actually the new BoxLevel after - * the swap) as the mapped BoxLevel in the output Connectors. - * Otherwise: - * @li If mutable_new is non-NULL, set it equal to new and use - * it as the mapped BoxLevel in the output Connectors. - * @li If mutable_old is non-NULL, set it equal to the old BoxLevel. * - * @param[in,out] anchor_to_mapped Connector to be modified. On input, this - * points to the BoxLevel being mapped. - * @param[in,out] mapped_to_anchor Reverse (transpose) of anchor_to_mapped. - * points to the BoxLevel being mapped. - * @param[in] old_to_new Mapping from the old BoxLevel to the - * new BoxLevel. - * The width of old-->new should indicate the maximum amount of box - * growth caused by the change. A value of zero means no growth. - * @param[in,out] mutable_new See comments. - * @param[in,out] mutable_old See comments. + * @pre (!old_to_new.hasTranspose() || + * (&old_to_new.getBase() == &old_to_new.getTranspose().getHead())) && + * (&old_to_new.getBase() == &anchor_to_mapped.getHead()) && + * (&old_to_new.getBase() == &mapped_to_anchor.getBase()) + * @pre &anchor_to_mapped.getBase() == &mapped_to_anchor.getHead() + * @pre (!old_to_new.hasTranspose() || + * (&old_to_new.getHead() == &old_to_new.getTranspose().getBase())) + * @pre anchor_to_mapped.isTransposeOf(mapped_to_anchor) + * @pre (!old_to_new.hasTranspose() || + * (old_to_new.getTranspose().isTransposeOf(old_to_new))) + * @pre anchor_to_mapped.getParallelState() == BoxLevel::DISTRIBUTED */ void modify( Connector& anchor_to_mapped, - Connector& mapped_to_anchor, - const Connector& old_to_new, - BoxLevel* mutable_new = NULL, - BoxLevel* mutable_old = NULL) const; + const MappingConnector& old_to_new, + BoxLevel* mutable_new = 0, + BoxLevel* mutable_old = 0) const; /*! - * @brief Version of modify requiring only the forward map - * and does not set the Connector from the mapped BoxLevel back - * to the anchor BoxLevel. - * - * This version does not require the reverse mapping, - * but the forward mapping must be totally local, e.g. - * old_to_new must contain no remote neighbor. - * - * This version does not update the Connector from - * the mapped mapped_box_level back to the anchor mapped_box_level. - * (This is implicit in the fact that mapped_to_anchor - * is absent from the interface.) - * - * @code - * Input: - * - * (anchor) - * / - * / - * / - * / <--anchor_to_mapped - * v - * mapped mapped_box_level: (old) ---------> (new) - * - * - * Output: - * - * (anchor) - * \ - * \ - * \ - * anchor_to_mapped --> \ - * v - * (new) - * - * @endcode - * - * - * If mutable_new points to the old BoxLevel and mutable_old - * points to the new, then do an in-place switch as follows: - * @li Swap the mutable_old and mutable_new BoxLevels. - * @li Use mutable_old (which actually the new BoxLevel after - * the swap) as the mapped BoxLevel in the output Connectors. - * Otherwise: - * @li If mutable_new is non-NULL, set it equal to new and use - * it as the mapped BoxLevel in the output Connectors. - * @li If mutable_old is non-NULL, set it equal to the old BoxLevel. - * - * @param[in,out] anchor_to_mapped Connector to be modified. On input, this - * points to the BoxLevel being mapped. - * @param[in,out] old_to_new Reverse (transpose) of anchor_to_mapped. - * points to the BoxLevel being mapped. - * @param[in,out] mutable_new See comments. - * @param[in,out] mutable_old See comments. - */ - void - modify( - Connector& anchor_to_mapped, - const Connector& old_to_new, - BoxLevel* mutable_new = NULL, - BoxLevel* mutable_old = NULL) const; - - // TODO: Create an enum to replace the char for clarity. - /*! - * @brief Check if the Connector has a valid mapping. - * - * This function can be called prior to calling modify(). It - * is intended to check the Connector that is the @c old_to_new - * argument in modify() to determine if it has a valid mapping. - * In other words, it checks to see if the mapping can be used - * in modify() without logic errors. It does no other checks. - * - * @param[in] connector - * @param[in] is_local_map 'y' means assume the mapping is local. 'n' - * means the mapping is not local. '\0' means find out whether the - * map is local or not (communication required) and act - * accordingly. - * - * @return number of errors found. + * @brief Get the name of this object. */ - size_t - findMappingErrors( - const Connector& connector, - char is_local_map = '\0') const; + const std::string + getObjectName() const + { + return "MappingConnectorAlgorithm"; + } /*! - * @brief Run findMappingErrors and abort if any errors are found. - * - * @param[in] connector - * @param[in] is_local_map 'y' means assume the mapping is local. 'n' - * means the mapping is not local. '\0' means find out whether the - * map is local or not (communication required) and act - * accordingly. + * @brief Setup names of timers. + * + * By default, timers are named + * "hier::MappingConnectorAlgorithm::*", where the third field is + * the specific steps performed by the MappingConnectorAlgorithm. + * You can override the first two fields with this method. + * Conforming to the timer naming convention, timer_prefix should + * have the form "*::*". */ void - assertMappingValidity( - const Connector& connector, - char is_local_map = '\0') const; - - //@} + setTimerPrefix( + const std::string& timer_prefix); private: /*! @@ -343,7 +250,7 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm /*! * @brief Most general version of method to modify existing - * Connectors objects by using another to map the head mapped_boxes. + * Connectors objects by using MappingConnectors to map the head boxes. * * This version does no checking of the inputs. The three * public versions do input checking and setting up temporaries @@ -366,8 +273,8 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm privateModify( Connector& anchor_to_mapped, Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old, + const MappingConnector& old_to_new, + const MappingConnector* new_to_old, BoxLevel* mutable_new, BoxLevel* mutable_old) const; @@ -378,8 +285,8 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm privateModify_checkParameters( const Connector& anchor_to_mapped, const Connector& mapped_to_anchor, - const Connector& old_to_new, - const Connector& new_to_old) const; + const MappingConnector& old_to_new, + const MappingConnector* new_to_old) const; /*! * @brief Relationship removal part of modify algorithm, caching @@ -387,30 +294,51 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm */ void privateModify_removeAndCache( - std::map >& neighbor_removal_mesg, + std::map >& send_mesgs, Connector& anchor_to_new, Connector* new_to_anchor, - const Connector& old_to_new) const; + const MappingConnector& old_to_new) const; /*! - * @brief Remove relationships made obsolete by mapping and send - * outgoing information. + * @brief Discover new relationships formed by mapping and send outgoing + * information. */ void privateModify_discoverAndSend( - std::map >& neighbor_removal_mesg, + std::map >& send_mesgs, Connector& anchor_to_new, Connector* new_to_anchor, - std::set& incoming_ranks, - std::set& outoing_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + const std::set& outoing_ranks, + tbox::AsyncCommPeer* all_comms, BoxContainer& visible_new_nabrs, BoxContainer& visible_anchor_nabrs, - InvertedNeighborhoodSet& anchor_eto_old, - InvertedNeighborhoodSet& new_eto_old, + const InvertedNeighborhoodSet& anchor_eto_old, + const InvertedNeighborhoodSet& new_eto_old, const Connector& old_to_anchor, const Connector& anchor_to_old, - const Connector& old_to_new) const; + const MappingConnector& old_to_new) const; + + /*! + * @brief Discover new relationships formed by mapping. + */ + void + privateModify_discover( + std::vector& send_mesg, + Connector& anchor_to_new, + Connector* new_to_anchor, + const BoxContainer& visible_anchor_nabrs, + const BoxContainer& visible_new_nabrs, + BoxContainer::const_iterator& anchor_ni, + BoxContainer::const_iterator& new_ni, + int curr_owner, + const tbox::Dimension& dim, + int rank, + const InvertedNeighborhoodSet& anchor_eto_old, + const InvertedNeighborhoodSet& new_eto_old, + const Connector& old_to_anchor, + const Connector& anchor_to_old, + const MappingConnector& old_to_new) const; /*! * @brief Find overlap and save in mapping connector or pack @@ -419,18 +347,24 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm void privateModify_findOverlapsForOneProcess( const int owner_rank, - BoxContainer& visible_base_nabrs, - BoxContainer::iterator& base_ni, + const BoxContainer& visible_base_nabrs, + BoxContainer::const_iterator& base_ni, std::vector& send_mesg, - const int remote_box_counter_index, + int remote_box_counter_index, Connector& mapped_connector, BoxContainer& referenced_head_nabrs, const Connector& unmapped_connector, const Connector& unmapped_connector_transpose, const Connector& mapping_connector, - InvertedNeighborhoodSet& inverted_nbrhd, + const InvertedNeighborhoodSet& inverted_nbrhd, const IntVector& refinement_ratio) const; + /*! + * @brief Read extra debugging flag from input database. + */ + void + getFromInput(); + /*! * @brief Set up things for the entire class. * @@ -447,23 +381,20 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm static void finalizeCallback(); + //! @brief SAMRAI_MPI for internal communications. + tbox::SAMRAI_MPI d_mpi; + + //! @brief Whether d_mpi was duplicated for exclusive use. + bool d_mpi_is_exclusive; + + // Extra checks independent of optimization/debug. + static char s_print_steps; + /* * @brief Border for debugging output. */ static const std::string s_dbgbord; - /*! - * @brief Private communicator object shared by all objects in class. - * Protects internal communication from mixing with external. - * - * For communication, we usually use the SAMRAI_MPI of the - * Connectors, and this object is mainly for debugging. If we - * suspect interference from unrelated communication calls, we - * resort to this exclusive SAMRAI_MPI object to rule out that - * possibility. - */ - static tbox::SAMRAI_MPI s_class_mpi; - /*! * @brief Tag to use (and increment) at begining of operations that * require nearest-neighbor communication, to aid in eliminating @@ -474,14 +405,59 @@ class MappingConnectorAlgorithm : public BaseConnectorAlgorithm */ static int s_operation_mpi_tag; - static boost::shared_ptr t_modify; - static boost::shared_ptr t_modify_setup_comm; - static boost::shared_ptr t_modify_remove_and_cache; - static boost::shared_ptr t_modify_discover_and_send; - static boost::shared_ptr t_modify_receive_and_unpack; - static boost::shared_ptr t_modify_MPI_wait; - static boost::shared_ptr t_modify_misc; + //@{ + //! @name Timer data for this class. + + /* + * @brief Structure of timers used by this class. + * + * Each object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_modify; + boost::shared_ptr t_modify_public; + boost::shared_ptr t_modify_setup_comm; + boost::shared_ptr t_modify_remove_and_cache; + boost::shared_ptr t_modify_discover_and_send; + boost::shared_ptr t_modify_find_overlaps_for_one_process; + boost::shared_ptr t_modify_receive_and_unpack; + boost::shared_ptr t_modify_MPI_wait; + boost::shared_ptr t_modify_misc; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + static char s_ignore_external_timer_prefix; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + /*! + * @brief Get all the timers defined in TimerStruct. The timers + * are named with the given prefix. + */ + static void + getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers); + + //@} + + bool d_barrier_before_communication; bool d_sanity_check_inputs; bool d_sanity_check_outputs; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.C index cc1ad2ff..7f420e2c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Multiblock binary trees of Boxes for overlap searches. * ************************************************************************/ - -#ifndef included_hier_MultiblockBoxTree_C -#define included_hier_MultiblockBoxTree_C - #include "SAMRAI/hier/MultiblockBoxTree.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BaseGridGeometry.h" -#include +#include "boost/make_shared.hpp" #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* @@ -37,14 +33,14 @@ namespace hier { MultiblockBoxTree::MultiblockBoxTree( const BoxContainer& boxes, const BaseGridGeometry* grid_geometry, - int min_number) - : d_grid_geometry(grid_geometry) + int min_number): + d_grid_geometry(grid_geometry) { /* * Group Boxes by their BlockId and * create a tree for each BlockId. */ - std::map > single_block_boxes; + std::map > single_block_boxes; for (BoxContainer::const_iterator bi = boxes.begin(); bi != boxes.end(); ++bi) { TBOX_ASSERT((*bi).getBlockId().isValid()); @@ -52,12 +48,12 @@ MultiblockBoxTree::MultiblockBoxTree( single_block_boxes[block_id].push_back(&(*bi)); } - for (std::map >::iterator blocki = - single_block_boxes.begin(); + for (std::map >::iterator blocki = + single_block_boxes.begin(); blocki != single_block_boxes.end(); ++blocki) { d_single_block_trees[blocki->first].reset(new BoxTree(blocki->second, - min_number)); + min_number)); } } @@ -82,7 +78,7 @@ MultiblockBoxTree::hasOverlap( if (getNumberBlocksInTree() != 1) { TBOX_ERROR("Single block version of hasOverlap called on search tree with multiple blocks."); } - + if (hasBoxInBlock(box.getBlockId())) { return d_single_block_trees.begin()->second->hasOverlap(box); } else { @@ -90,7 +86,6 @@ MultiblockBoxTree::hasOverlap( } } - /* ************************************************************************** * Fills the vector with pointers to Boxes that intersect the arguement @@ -103,17 +98,17 @@ MultiblockBoxTree::findOverlapBoxes( const IntVector& refinement_ratio, bool include_singularity_block_neighbors) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*d_grid_geometry, box, refinement_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*d_grid_geometry, box, refinement_ratio); - const BlockId &block_id = box.getBlockId(); - TBOX_ASSERT(block_id.getBlockValue() >= 0 && - block_id.getBlockValue() < d_grid_geometry->getNumberBlocks()); + const BlockId& block_id = box.getBlockId(); + TBOX_ASSERT(block_id.getBlockValue() < d_grid_geometry->getNumberBlocks()); /* * Search in the index space of block_id for overlaps. */ - std::map >::const_iterator blocki(d_single_block_trees.find(block_id)); + std::map >::const_iterator blocki(d_single_block_trees.find( + block_id)); if (blocki != d_single_block_trees.end()) { blocki->second->findOverlapBoxes(overlap_boxes, box); @@ -123,12 +118,9 @@ MultiblockBoxTree::findOverlapBoxes( * Search in the index spaces neighboring block_id for overlaps. */ - const std::list& block_neighbors( - d_grid_geometry->getNeighbors(block_id)); - - for (std::list::const_iterator ni = - block_neighbors.begin(); - ni != block_neighbors.end(); ni++) { + for (BaseGridGeometry::ConstNeighborIterator ni = + d_grid_geometry->begin(block_id); + ni != d_grid_geometry->end(block_id); ++ni) { const BaseGridGeometry::Neighbor& neighbor(*ni); @@ -168,17 +160,17 @@ MultiblockBoxTree::findOverlapBoxes( const IntVector& refinement_ratio, bool include_singularity_block_neighbors) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*d_grid_geometry, box, refinement_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*d_grid_geometry, box, refinement_ratio); - const BlockId &block_id = box.getBlockId(); - TBOX_ASSERT(block_id.getBlockValue() >= 0 && - block_id.getBlockValue() < d_grid_geometry->getNumberBlocks()); + const BlockId& block_id = box.getBlockId(); + TBOX_ASSERT(block_id.getBlockValue() < d_grid_geometry->getNumberBlocks()); /* * Search in the index space of block_id for overlaps. */ - std::map >::const_iterator blocki(d_single_block_trees.find(block_id)); + std::map >::const_iterator blocki(d_single_block_trees.find( + block_id)); if (blocki != d_single_block_trees.end()) { blocki->second->findOverlapBoxes(overlap_boxes, box); @@ -188,12 +180,9 @@ MultiblockBoxTree::findOverlapBoxes( * Search in the index spaces neighboring block_id for overlaps. */ - const std::list& block_neighbors( - d_grid_geometry->getNeighbors(block_id)); - - for (std::list::const_iterator ni = - block_neighbors.begin(); - ni != block_neighbors.end(); ni++) { + for (BaseGridGeometry::ConstNeighborIterator ni = + d_grid_geometry->begin(block_id); + ni != d_grid_geometry->end(block_id); ++ni) { const BaseGridGeometry::Neighbor& neighbor(*ni); @@ -232,7 +221,8 @@ MultiblockBoxTree::findOverlapBoxes( const Box& box) const { if (getNumberBlocksInTree() != 1) { - TBOX_ERROR("Single block version of findOverlapBoxes called on search tree with multiple blocks."); + TBOX_ERROR( + "Single block version of findOverlapBoxes called on search tree with multiple blocks."); } if (hasBoxInBlock(box.getBlockId())) { @@ -253,7 +243,8 @@ MultiblockBoxTree::findOverlapBoxes( const Box& box) const { if (getNumberBlocksInTree() != 1) { - TBOX_ERROR("Single block version of findOverlapBoxes called on search tree with multiple blocks."); + TBOX_ERROR( + "Single block version of findOverlapBoxes called on search tree with multiple blocks."); } if (hasBoxInBlock(box.getBlockId())) { @@ -273,5 +264,3 @@ MultiblockBoxTree::findOverlapBoxes( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.h index 02ef4275..edffe583 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/MultiblockBoxTree.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Multiblock binary trees of Boxes for overlap searches. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/BoxTree.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -38,29 +38,31 @@ class BoxContainer; class MultiblockBoxTree { -friend class BoxContainer; + friend class BoxContainer; public: - /*! * @brief Destructor. */ ~MultiblockBoxTree(); private: - /*! * @brief Constructs a MultiblockBoxTree from set of Boxes. * - * @param[in] boxes. No empty boxes are allowed. + * @param[in] boxes No empty boxes are allowed. + * + * @param[in] grid_geometry GridGeometry associated with boxes in tree. * * @param[in] min_number Split up sets of boxes while the number of * boxes in a subset is greater than this value. Setting to a * larger value tends to make tree building faster but tree * searching slower, and vice versa. @b Default: 10 + * + * @pre for each box in boxes, box.getBlockId().isValid() */ MultiblockBoxTree( - const BoxContainer& boxes, + const BoxContainer& boxes, const BaseGridGeometry* grid_geometry, const int min_number = 10); @@ -90,7 +92,7 @@ friend class BoxContainer; return static_cast(d_single_block_trees.size()); } - const BaseGridGeometry* + const BaseGridGeometry * getGridGeometry() const { return d_grid_geometry; @@ -107,7 +109,6 @@ friend class BoxContainer; d_single_block_trees.clear(); } - //@{ //! @name Overlap checks @@ -117,10 +118,13 @@ friend class BoxContainer; * tree. * * @param[in] box The box must have the same BlockId as all Boxes in the - * tree. + * tree. + * + * @pre getNumberBlocksInTree() == 1 */ bool - hasOverlap(const Box& box) const; + hasOverlap( + const Box& box) const; /*! * @brief Find all boxes that intersect with a given box. @@ -135,10 +139,12 @@ friend class BoxContainer; * @param[out] overlap_boxes * * @param[in] box + * + * @pre getNumberBlocksInTree() == 1 */ void findOverlapBoxes( - std::vector& overlap_boxes, + std::vector& overlap_boxes, const Box& box) const; /*! @@ -156,13 +162,18 @@ friend class BoxContainer; * @param[in] box * * @param[in] refinement_ratio All boxes in this BoxContainer - * are assumed to exist in index space that has this refinement ratio + * are assumed to exist in index space that has this refinement ratio * relative to the coarse-level domain stored in the grid geometry. * * @param[in] include_singularity_block_neighbors If true, intersections * with neighboring blocks that touch only across an enhanced connectivity * singularity will be added to output. If false, those intersections are * ignored. + * + * @pre (getGridGeometry().getDim() == box.getDim()) && + * (getGridGeometry().getDim() == refinement_ratio.getDim()) + * @pre (box.getBlockId().getBlockValue() >= 0) && + * (box.getBlockId().getBlockValue() < getGridGeometry()->getNumberBlocks()) */ void findOverlapBoxes( @@ -185,6 +196,8 @@ friend class BoxContainer; * @param[out] overlap_boxes * * @param[in] box + * + * @pre getNumberBlocksInTree() == 1 */ void findOverlapBoxes( @@ -207,13 +220,18 @@ friend class BoxContainer; * @param[in] box * * @param[in] refinement_ratio All boxes in this BoxContainer - * are assumed to exist in index space that has this refinement ratio + * are assumed to exist in index space that has this refinement ratio * relative to the coarse-level domain stored in the grid geometry. * * @param[in] include_singularity_block_neighbors If true, intersections * with neighboring blocks that touch only across an enhanced connectivity * singularity will be added to output. If false, those intersections are * ignored. + * + * @pre (getGridGeometry().getDim() == box.getDim()) && + * (getGridGeometry().getDim() == refinement_ratio.getDim()) + * @pre (box.getBlockId().getBlockValue() >= 0) && + * (box.getBlockId().getBlockValue() < getGridGeometry()->getNumberBlocks()) */ void findOverlapBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.C index bfa625c6..21df0cc4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.C @@ -3,18 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Algorithms for working with overlap Connectors. * ************************************************************************/ -#ifndef included_hier_OverlapConnectorAlgorithm_C -#define included_hier_OverlapConnectorAlgorithm_C - #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/AssumedPartition.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxContainerUtils.h" +#include "SAMRAI/hier/BoxUtilities.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" -#include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/AsyncCommStage.h" #include "SAMRAI/tbox/AsyncCommPeer.h" #include "SAMRAI/tbox/InputManager.h" @@ -33,19 +31,13 @@ namespace SAMRAI { namespace hier { -boost::shared_ptr OverlapConnectorAlgorithm::t_find_overlaps_rbbt; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_setup_comm; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_remove_and_cache; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_discover; -boost::shared_ptr OverlapConnectorAlgorithm:: -t_bridge_discover_get_neighbors; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_discover_form_rbbt; -boost::shared_ptr OverlapConnectorAlgorithm:: -t_bridge_discover_find_overlaps; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_share; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_receive_and_unpack; -boost::shared_ptr OverlapConnectorAlgorithm::t_bridge_MPI_wait; +const std::string OverlapConnectorAlgorithm::s_default_timer_prefix( + "hier::OverlapConnectorAlgorithm"); +std::map OverlapConnectorAlgorithm::s_static_timers; +char OverlapConnectorAlgorithm::s_ignore_external_timer_prefix('n'); + +char OverlapConnectorAlgorithm::s_print_steps = '\0'; int OverlapConnectorAlgorithm::s_operation_mpi_tag = 0; /* @@ -54,9 +46,6 @@ int OverlapConnectorAlgorithm::s_operation_mpi_tag = 0; * with reused tags anyway. */ -tbox::SAMRAI_MPI OverlapConnectorAlgorithm::s_class_mpi( - tbox::SAMRAI_MPI::commNull); - tbox::StartupShutdownManager::Handler OverlapConnectorAlgorithm::s_initialize_finalize_handler( OverlapConnectorAlgorithm::initializeCallback, @@ -71,23 +60,16 @@ OverlapConnectorAlgorithm::s_initialize_finalize_handler( */ OverlapConnectorAlgorithm::OverlapConnectorAlgorithm(): + d_mpi(MPI_COMM_NULL), + d_mpi_is_exclusive(false), + d_object_timers(0), + d_print_steps(s_print_steps == 'y'), + d_barrier_before_communication(false), d_sanity_check_method_preconditions(false), d_sanity_check_method_postconditions(false) { - /* - * While we figure out how to use multiple communicators in SAMRAI, - * we are still assuming that all communications use congruent - * communicators. This class just makes a duplicate communicator - * to protect itself from unrelated communications in shared - * communicators. - */ - if (s_class_mpi.getCommunicator() == tbox::SAMRAI_MPI::commNull) { - if (tbox::SAMRAI_MPI::usingMPI()) { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - s_class_mpi.dupCommunicator(mpi); - } - } - + getFromInput(); + setTimerPrefix(s_default_timer_prefix); } /* @@ -97,28 +79,63 @@ OverlapConnectorAlgorithm::OverlapConnectorAlgorithm(): OverlapConnectorAlgorithm::~OverlapConnectorAlgorithm() { + if (d_mpi_is_exclusive) { + d_mpi.freeCommunicator(); + d_mpi_is_exclusive = false; + } } /* *********************************************************************** *********************************************************************** */ -void -OverlapConnectorAlgorithm::setSanityCheckMethodPreconditions( - bool do_check) +void OverlapConnectorAlgorithm::setSAMRAI_MPI( + const tbox::SAMRAI_MPI& mpi, + bool make_duplicate) { - d_sanity_check_method_preconditions = do_check; + if (d_mpi_is_exclusive) { + d_mpi.freeCommunicator(); + d_mpi_is_exclusive = false; + } + if (make_duplicate) { + d_mpi.dupCommunicator(mpi); + d_mpi_is_exclusive = true; + } else { + d_mpi = mpi; + } } /* *********************************************************************** *********************************************************************** */ + void -OverlapConnectorAlgorithm::setSanityCheckMethodPostconditions( - bool do_check) +OverlapConnectorAlgorithm::getFromInput() { - d_sanity_check_method_postconditions = do_check; + if (s_print_steps == '\0') { + s_print_steps = 'n'; + if (tbox::InputManager::inputDatabaseExists()) { + boost::shared_ptr idb( + tbox::InputManager::getInputDatabase()); + if (idb->isDatabase("OverlapConnectorAlgorithm")) { + boost::shared_ptr oca_db( + idb->getDatabase("OverlapConnectorAlgorithm")); + s_print_steps = + oca_db->getCharWithDefault("DEV_print_bridge_steps", 'n'); + if (!(s_print_steps == 'n' || s_print_steps == 'y')) { + INPUT_VALUE_ERROR("DEV_print_bridge_steps"); + } + s_ignore_external_timer_prefix = + oca_db->getCharWithDefault("DEV_ignore_external_timer_prefix", + 'n'); + if (!(s_ignore_external_timer_prefix == 'n' || + s_ignore_external_timer_prefix == 'y')) { + INPUT_VALUE_ERROR("DEV_ignore_external_timer_prefix"); + } + } + } + } } /* @@ -130,33 +147,29 @@ void OverlapConnectorAlgorithm::extractNeighbors( NeighborSet& neighbors, const Connector& connector, - const BoxId& mapped_box_id, - const IntVector& gcw) const + const BoxId& box_id, + const IntVector& width) const { - const tbox::Dimension& dim(gcw.getDim()); + const tbox::Dimension& dim(width.getDim()); #ifdef DEBUG_CHECK_ASSERTIONS - if (!(gcw <= connector.getConnectorWidth())) { - TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot provide neighbors for\n" - << "a wider ghost cell width that used to initialize it.\n"); + if (!(width <= connector.getConnectorWidth())) { + TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot provide\n" + << "neighbors for a wider ghost cell width that used to initialize it.\n"); } if (connector.getParallelState() != BoxLevel::GLOBALIZED && - mapped_box_id.getOwnerRank() != connector.getMPI().getRank()) { - TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot get neighbor data\n" - << "for a remote mapped_box unless in GLOBALIZED mode.\n"); + box_id.getOwnerRank() != connector.getMPI().getRank()) { + TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot get\n" + << "neighbor data for a remote box unless in GLOBALIZED mode.\n"); } - if (!connector.getBase().hasBox(mapped_box_id)) { + if (!connector.getBase().hasBox(box_id)) { std::string dbgbord; TBOX_ERROR( - "\nOverlapConnectorAlgorithm::extractNeighbors: mapped_box_id " << mapped_box_id - << - " is not in the base of the mapped_box_level.\n" - << "base:\n" - << connector.getBase().format(dbgbord, 2) - << "head:\n" - << connector.getHead().format(dbgbord, 2) - << "connector:\n" - << connector.format(dbgbord, 2)); + "\nOverlapConnectorAlgorithm::extractNeighbors: box_id " << box_id + << " is not in the base of the box_level.\n" + << "base:\n" << connector.getBase().format(dbgbord, 2) + << "head:\n" << connector.getHead().format(dbgbord, 2) + << "connector:\n" << connector.format(dbgbord, 2)); } #endif @@ -165,43 +178,74 @@ OverlapConnectorAlgorithm::extractNeighbors( * method functionality is not much used and prrobably should be * removed. */ - TBOX_ASSERT(mapped_box_id.getOwnerRank() == connector.getMPI().getRank()); + TBOX_ASSERT(box_id.getOwnerRank() == connector.getMPI().getRank()); const boost::shared_ptr& grid_geom( connector.getBase().getGridGeometry()); - const Box& mapped_box(*connector.getBase().getBox(Box(dim, mapped_box_id))); + const Box& box(*connector.getBase().getBox(Box(dim, box_id))); Connector::ConstNeighborhoodIterator ins = - connector.findLocal(mapped_box_id); + connector.findLocal(box_id); neighbors.clear(); if (ins != connector.end()) { - if (gcw == connector.getConnectorWidth()) { + if (width == connector.getConnectorWidth()) { for (Connector::ConstNeighborIterator ni = connector.begin(ins); ni != connector.end(ins); ++ni) { neighbors.insert(neighbors.end(), *ni); } } else { - Box grown_mapped_box = mapped_box; - grown_mapped_box.grow(gcw); - if (connector.getHeadCoarserFlag() == false) { - grown_mapped_box.refine(connector.getRatio()); - } - for (Connector::ConstNeighborIterator ni = connector.begin(ins); - ni != connector.end(ins); ++ni) { - const Box& neighbor(*ni); - Box nabr_box(neighbor); - if (neighbor.getBlockId() != mapped_box.getBlockId()) { - grid_geom->transformBox(nabr_box, - connector.getHead().getRefinementRatio(), - mapped_box.getBlockId(), - neighbor.getBlockId()); + BoxContainer grown_boxes; + if (grid_geom->getNumberBlocks() == 1 || + grid_geom->hasIsotropicRatios()) { + Box grown_box = box; + grown_box.grow(width); + if (connector.getHeadCoarserFlag() == false) { + grown_box.refine(connector.getRatio()); } - if (connector.getHeadCoarserFlag() == true) { - nabr_box.refine(connector.getRatio()); + grown_boxes.pushBack(grown_box); + } else { + bool head_is_finer = false; + bool base_is_finer = false; + if (connector.getRatio() != 1) { + if (connector.getHeadCoarserFlag()) { + base_is_finer = true; + } else { + head_is_finer = true; + } } - if (grown_mapped_box.intersects(nabr_box)) { - neighbors.insert(neighbors.end(), neighbor); + BoxUtilities::growAndAdjustAcrossBlockBoundary( + grown_boxes, + box, + grid_geom, + connector.getBase().getRefinementRatio(), + connector.getRatio(), + width, + head_is_finer, + base_is_finer); + } + for (BoxContainer::iterator g_itr = grown_boxes.begin(); + g_itr != grown_boxes.end(); ++g_itr) { + + const Box& g_box = *g_itr; + const BlockId& g_block_id = g_box.getBlockId(); + for (Connector::ConstNeighborIterator ni = connector.begin(ins); + ni != connector.end(ins); ++ni) { + const Box& neighbor(*ni); + Box nabr_box(neighbor); + bool do_intersect = true; + if (neighbor.getBlockId() != g_block_id) { + do_intersect = + grid_geom->transformBox(nabr_box, + connector.getHead().getRefinementRatio(), + g_block_id, + neighbor.getBlockId()); + } + if (do_intersect) { + if (g_box.intersects(nabr_box)) { + neighbors.insert(neighbors.end(), neighbor); + } + } } } } @@ -217,40 +261,40 @@ void OverlapConnectorAlgorithm::extractNeighbors( Connector& other, const Connector& connector, - const IntVector& gcw) const + const IntVector& width) const { +#ifdef DEBUG_CHECK_ASSERTIONS + if (!(width <= connector.getConnectorWidth())) { + TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot provide\n" + << "neighbors for a wider ghost cell width that used to initialize it.\n"); + } +#endif + other.clearNeighborhoods(); for (Connector::ConstNeighborhoodIterator ni = connector.begin(); ni != connector.end(); ++ni) { - const BoxId& mapped_box_id = *ni; + const BoxId& box_id = *ni; Connector::NeighborhoodIterator base_box_itr = - other.makeEmptyLocalNeighborhood(mapped_box_id); + other.makeEmptyLocalNeighborhood(box_id); - const tbox::Dimension& dim(gcw.getDim()); + const tbox::Dimension& dim(width.getDim()); #ifdef DEBUG_CHECK_ASSERTIONS - if (!(gcw <= connector.getConnectorWidth())) { - TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot provide neighbors for\n" - << "a wider ghost cell width that used to initialize it.\n"); - } if (connector.getParallelState() != BoxLevel::GLOBALIZED && - mapped_box_id.getOwnerRank() != connector.getMPI().getRank()) { - TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot get neighbor data\n" - << "for a remote mapped_box unless in GLOBALIZED mode.\n"); + box_id.getOwnerRank() != connector.getMPI().getRank()) { + TBOX_ERROR("OverlapConnectorAlgorithm::extractNeighbors cannot get\n" + << "neighbor data for a remote box unless in GLOBALIZED mode.\n"); } - if (!connector.getBase().hasBox(mapped_box_id)) { + if (!connector.getBase().hasBox(box_id)) { std::string dbgbord; TBOX_ERROR( - "\nOverlapConnectorAlgorithm::extractNeighbors: mapped_box_id " << mapped_box_id - << - " is not in the base of the mapped_box_level.\n" - << "base:\n" - << connector.getBase().format(dbgbord, 2) - << "head:\n" - << connector.getHead().format(dbgbord, 2) - << "connector:\n" - << connector.format(dbgbord, 2)); + "\nOverlapConnectorAlgorithm::extractNeighbors: box_id " << box_id + << + " is not in the base of the box_level.\n" + << "base:\n" << connector.getBase().format(dbgbord, 2) + << "head:\n" << connector.getHead().format(dbgbord, 2) + << "connector:\n" << connector.format(dbgbord, 2)); } #endif @@ -259,40 +303,71 @@ OverlapConnectorAlgorithm::extractNeighbors( * method functionality is not much used and prrobably should be * removed. */ - TBOX_ASSERT(mapped_box_id.getOwnerRank() == connector.getMPI().getRank()); + TBOX_ASSERT(box_id.getOwnerRank() == connector.getMPI().getRank()); - const boost::shared_ptr& grid_geom ( + const boost::shared_ptr& grid_geom( connector.getBase().getGridGeometry()); - const Box& mapped_box = - *connector.getBase().getBox(Box(dim, mapped_box_id)); + const Box& box = *connector.getBase().getBox(Box(dim, box_id)); - if (gcw == connector.getConnectorWidth()) { + if (width == connector.getConnectorWidth()) { for (Connector::ConstNeighborIterator si = connector.begin(ni); si != connector.end(ni); ++si) { other.insertLocalNeighbor(*si, base_box_itr); } } else { - Box grown_mapped_box = mapped_box; - grown_mapped_box.grow(gcw); - if (connector.getHeadCoarserFlag() == false) { - grown_mapped_box.refine(connector.getRatio()); - } - for (Connector::ConstNeighborIterator si = connector.begin(ni); - si != connector.end(ni); ++si) { - const Box& neighbor = *si; - Box nabr_box(neighbor); - if (neighbor.getBlockId() != mapped_box.getBlockId()) { - grid_geom->transformBox(nabr_box, - connector.getHead().getRefinementRatio(), - mapped_box.getBlockId(), - neighbor.getBlockId()); + BoxContainer grown_boxes; + if (grid_geom->getNumberBlocks() == 1 || + grid_geom->hasIsotropicRatios()) { + + Box grown_box = box; + grown_box.grow(width); + if (connector.getHeadCoarserFlag()) { + grown_box.coarsen(connector.getRatio()); + } else { + grown_box.refine(connector.getRatio()); } - if (connector.getHeadCoarserFlag() == true) { - nabr_box.refine(connector.getRatio()); + grown_boxes.pushBack(grown_box); + } else { + bool head_is_finer = false; + bool base_is_finer = false; + if (connector.getRatio() != 1) { + if (connector.getHeadCoarserFlag()) { + base_is_finer = true; + } else { + head_is_finer = true; + } } - if (grown_mapped_box.intersects(nabr_box)) { - other.insertLocalNeighbor(neighbor, base_box_itr); + BoxUtilities::growAndAdjustAcrossBlockBoundary( + grown_boxes, + box, + grid_geom, + connector.getBase().getRefinementRatio(), + connector.getRatio(), + width, + head_is_finer, + base_is_finer); + } + for (BoxContainer::iterator g_itr = grown_boxes.begin(); + g_itr != grown_boxes.end(); ++g_itr) { + const Box& g_box = *g_itr; + const BlockId& g_block_id = g_box.getBlockId(); + for (Connector::ConstNeighborIterator si = connector.begin(ni); + si != connector.end(ni); ++si) { + const Box& neighbor = *si; + Box nabr_box(neighbor); + bool do_intersect = true; + if (neighbor.getBlockId() != g_block_id) { + do_intersect = grid_geom->transformBox(nabr_box, + connector.getHead().getRefinementRatio(), + g_block_id, + neighbor.getBlockId()); + } + if (do_intersect) { + if (g_box.intersects(nabr_box)) { + other.insertLocalNeighbor(neighbor, base_box_itr); + } + } } } } @@ -307,12 +382,54 @@ OverlapConnectorAlgorithm::extractNeighbors( void OverlapConnectorAlgorithm::findOverlaps( - Connector& connector, + boost::shared_ptr& connector, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const BoxLevel::ParallelState parallel_state, + const bool ignore_self_overlap) const +{ + connector.reset(new Connector(base_box_level, + head_box_level, + base_width, + parallel_state)); + findOverlaps(*connector, + head_box_level.getGlobalizedVersion(), + ignore_self_overlap); + if (&base_box_level == &head_box_level) { + connector->setTranspose(connector.get(), false); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ + +void +OverlapConnectorAlgorithm::findOverlapsWithTranspose( + boost::shared_ptr& connector, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const IntVector& transpose_base_width, + const BoxLevel::ParallelState parallel_state, const bool ignore_self_overlap) const { findOverlaps(connector, - connector.getHead().getGlobalizedVersion(), + base_box_level, + head_box_level, + base_width, + parallel_state, ignore_self_overlap); + if (&base_box_level != &head_box_level) { + Connector* transpose = new Connector(head_box_level, + base_box_level, + transpose_base_width, + parallel_state); + findOverlaps(*transpose, ignore_self_overlap); + connector->setTranspose(transpose, true); + } } /* @@ -323,165 +440,222 @@ OverlapConnectorAlgorithm::findOverlaps( void OverlapConnectorAlgorithm::findOverlaps( Connector& connector, - const BoxLevel& globalized_head, const bool ignore_self_overlap) const { - findOverlaps_rbbt(connector, globalized_head, ignore_self_overlap); + findOverlaps(connector, + connector.getHead().getGlobalizedVersion(), + ignore_self_overlap); } /* *********************************************************************** - * ignore_self_overlap should be set to true only if - * - the base and head mapped_box_levels represent the same mapped_box_level. - * Two different mapped_box_level objects may represent the same - * mapped_box_level if they are of the same refinement ratio. - * - you want to ignore overlaps between a mapped_box and itself. *********************************************************************** */ void -OverlapConnectorAlgorithm::findOverlaps_rbbt( +OverlapConnectorAlgorithm::findOverlaps( Connector& connector, - const BoxLevel& head, + const BoxLevel& globalized_head, const bool ignore_self_overlap) const { - const tbox::Dimension dim(head.getDim()); - - t_find_overlaps_rbbt->start(); + d_object_timers->t_find_overlaps_rbbt->start(); + connector.findOverlaps_rbbt(globalized_head, + ignore_self_overlap, + d_sanity_check_method_postconditions); + d_object_timers->t_find_overlaps_rbbt->stop(); +} - /* - * Finding overlaps for this object, using - * an externally provided head BoxLevel - * meant to represent d_head. We allow the - * substitution of an external head because - * we require the head is GLOBALIZED. The - * user may have a GLOBALIZED version already, - * in which case we want to avoid the expense - * of creating a temporary GLOBALIZED version. - * - * Global mapped_boxes provided by head are sorted in a BoxContainer - * so they can be quickly searched to see which intersects the - * boxes in this object. - */ - if (head.getParallelState() != BoxLevel::GLOBALIZED) { - TBOX_ERROR("OverlapConnectorAlgorithm::findOverlaps_rbbt() requires given head\n" - << "to be GLOBALIZED.\n"); +/* + *********************************************************************** + * Find overlaps using the assumed partition algorithm. In SAMRAI + * terms, we create a center BoxLevel from the assumed partition, + * connect the base and head BoxLevels to it, then bridge across the + * assumed partition center to get base<==>head. + * + * 1. Get bounding boxes for base or head, which ever has smaller + * bounding boxes. + * + * 2. Create a reasonably balanced center BoxLevel from an + * AssumedPartition of the bounding boxes. + * + * 3. Populate head--->center and base--->center. + * + * 4. Get transposes center--->head and center--->base. This is + * implemented in the Connector's computeTransposeOf() method. + * + * 5. Bridge base<==>center<==>head. + *********************************************************************** + */ +void +OverlapConnectorAlgorithm::findOverlaps_assumedPartition( + Connector& conn) const +{ + if (d_print_steps) { + tbox::plog << "OverlapConnectorAlgorithm::findOverlaps_assumedPartition: entered.\n"; + } + d_object_timers->t_find_overlaps_assumed_partition->start(); + + const BoxLevel& base = conn.getBase(); + const BoxLevel& head = conn.getHead(); + const BoxContainer& head_boxes = head.getBoxes(); + const BoxContainer& base_boxes = base.getBoxes(); + + const IntVector& width_in_base_resolution = conn.getConnectorWidth(); + const IntVector width_in_head_resolution = + Connector::convertHeadWidthToBase(head.getRefinementRatio(), + base.getRefinementRatio(), + width_in_base_resolution); + + const tbox::Dimension& dim = base.getDim(); + const tbox::SAMRAI_MPI& mpi = d_mpi.hasNullCommunicator() ? base.getMPI() : d_mpi; + const boost::shared_ptr& geom = base.getGridGeometry(); + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("OverlapConnectorAlgorithm::findOverlaps_assumedPartition: not starting\n" + << "clean of receivable MPI messages."); } - /* - * The nomenclature "base" refers to the *this mapped_box_level - * and "head" refer to the mapped_box_level in the argument. - */ - const BoxLevel& base(connector.getBase()); - - /* - * Determine relationship between base and head index spaces. - */ - const bool head_is_finer = - head.getRefinementRatio() >= base.getRefinementRatio() && - head.getRefinementRatio() != base.getRefinementRatio(); - const bool base_is_finer = - base.getRefinementRatio() >= head.getRefinementRatio() && - base.getRefinementRatio() != head.getRefinementRatio(); - - /* - * Create single container of visible head mapped_boxes - * to generate the search tree. - */ - const BoxContainer& rbbt = head.getGlobalBoxes(); - rbbt.makeTree(head.getGridGeometry().get()); - - /* - * A neighbor of a Box would be discarded if - * - ignore_self_overlap is true, - * - the two are equal by comparison, and - * - they are from mapped_box_levels with the same refinement ratio - * (we cannot compare mapped_box mapped_box_level pointers because that - * does not work when a mapped_box mapped_box_level is a temporary globalized object) - */ - const bool discard_self_overlap = - ignore_self_overlap && - (connector.getBase().getRefinementRatio() == head.getRefinementRatio()); + if (d_sanity_check_method_preconditions) { + if (!d_mpi.hasNullCommunicator() && !d_mpi.isCongruentWith(base.getMPI())) { + TBOX_ERROR("OverlapConnectorAlgorithm::findOverlaps_assumedPartition input error: Input\n" + << "has SAMRAI_MPI that is incongruent with OverlapConnectorAlgorithm's.\n" + << "See OverlapConnectorAlgorithm::setSAMRAI_MPI.\n"); + } + } - /* - * Discard current overlaps in connector (if any). - */ - connector.clearNeighborhoods(); + d_object_timers->t_find_overlaps_assumed_partition_get_ap->barrierAndStart(); /* - * Use BoxTree to find local base Boxes intersecting head Boxes. + * Set up center BoxLevel. We can use either the base or head to + * construct the center. We choose the smaller one because we + * don't need to cover the bigger region. There are no overlaps + * away from the smaller BoxLevel anyway. + * + * As an optimization, try to make an AssumedPartition with about + * 1 partition per rank, or fewer if the base or head have fewer boxes. + * This avoids having more many more assumed partitions than boxes, + * which can scale poorly. */ - NeighborSet nabrs_for_box; - const BoxContainer& base_mapped_boxes = base.getBoxes(); - for (RealBoxConstIterator ni(base_mapped_boxes.realBegin()); - ni != base_mapped_boxes.realEnd(); ++ni) { - - const Box& base_mapped_box = *ni; - - // Grow the base_mapped_box and put it in the head refinement ratio. - Box box = base_mapped_box; - box.grow(connector.getConnectorWidth()); - if (head_is_finer) { - box.refine(connector.getRatio()); - } else if (base_is_finer) { - box.coarsen(connector.getRatio()); - } - - // Add found overlaps to neighbor set for mapped_box. - rbbt.findOverlapBoxes(nabrs_for_box, - box, - // base_mapped_box.getBlockId(), - head.getRefinementRatio(), - true); - if (discard_self_overlap) { - nabrs_for_box.order(); - nabrs_for_box.erase(base_mapped_box); + BoxContainer base_bounding_boxes, head_bounding_boxes; + size_t base_bounding_cell_count = 0, head_bounding_cell_count = 0; + for (BlockId::block_t bn = 0; bn < geom->getNumberBlocks(); ++bn) { + BlockId block_id(bn); + base_bounding_boxes.push_back(base.getGlobalBoundingBox(block_id)); + head_bounding_boxes.push_back(head.getGlobalBoundingBox(block_id)); + base_bounding_cell_count += base_bounding_boxes.back().size(); + head_bounding_cell_count += head_bounding_boxes.back().size(); + } + size_t num_parts = head.getGlobalNumberOfBoxes() < base.getGlobalNumberOfBoxes() ? + head.getGlobalNumberOfBoxes() : base.getGlobalNumberOfBoxes(); + num_parts = static_cast(mpi.getSize()) < num_parts ? + static_cast(mpi.getSize()) : num_parts; + const AssumedPartition center_ap( + head_bounding_cell_count < base_bounding_cell_count ? head_bounding_boxes : base_bounding_boxes, + 0, mpi.getSize(), 0, static_cast(num_parts)/mpi.getSize() ); + base_bounding_boxes.clear(); + head_bounding_boxes.clear(); + + BoxContainer center_boxes; + center_ap.getAllBoxes(center_boxes, mpi.getRank()); + const IntVector& center_refinement_ratio = head_bounding_cell_count < base_bounding_cell_count ? + head.getRefinementRatio() : base.getRefinementRatio(); + const BoxLevel center( center_boxes, center_refinement_ratio, geom, mpi ); + + d_object_timers->t_find_overlaps_assumed_partition_get_ap->barrierAndStop(); + + d_object_timers->t_find_overlaps_assumed_partition_connect_to_ap->barrierAndStart(); + + // Set up base<==>center + Connector base_to_center(base, center, width_in_base_resolution); + BoxContainer base_boxes_mod(base_boxes); + base_boxes_mod.grow(width_in_base_resolution); + if (base.getRefinementRatio() != center_refinement_ratio) { + if (base.getRefinementRatio() >= center_refinement_ratio) { + base_boxes_mod.refine(conn.getRatio()); + } else { + base_boxes_mod.coarsen(conn.getRatio()); } - if (!nabrs_for_box.isEmpty()) { - connector.insertNeighbors(nabrs_for_box, base_mapped_box.getId()); - nabrs_for_box.clear(); + } + for (BoxContainer::const_iterator bi = base_boxes_mod.begin(); bi != base_boxes_mod.end(); + ++bi) { + const Box& compare_box = *bi; + BoxContainer neighbors; + center_ap.findOverlaps(neighbors, compare_box, *geom, center_refinement_ratio); + base_to_center.insertNeighbors(neighbors, bi->getBoxId()); + } + base_boxes_mod.clear(); + + // Set up head<==>center + Connector head_to_center(head, center, width_in_head_resolution); + BoxContainer head_boxes_mod(head_boxes); + head_boxes_mod.grow(width_in_head_resolution); + if (head.getRefinementRatio() != center_refinement_ratio) { + if (head.getRefinementRatio() >= center_refinement_ratio) { + head_boxes_mod.refine(conn.getRatio()); + } else { + head_boxes_mod.coarsen(conn.getRatio()); } - } - connector.setConnectorType(Connector::COMPLETE_OVERLAP); + for (BoxContainer::const_iterator bi = head_boxes_mod.begin(); bi != head_boxes_mod.end(); + ++bi) { + Box compare_box = *bi; + BoxContainer neighbors; + center_ap.findOverlaps(neighbors, compare_box, *geom, center_refinement_ratio); + head_to_center.insertNeighbors(neighbors, bi->getBoxId()); + } + head_boxes_mod.clear(); - if (d_sanity_check_method_postconditions) { - connector.assertConsistencyWithBase(); - connector.assertConsistencyWithHead(); + d_object_timers->t_find_overlaps_assumed_partition_connect_to_ap->barrierAndStop(); + + d_object_timers->t_find_overlaps_assumed_partition_transpose->start(); + if (d_print_steps) { + tbox::plog + << "OverlapConnectorAlgorithm::findOverlaps_assumedPartition: getting transposes.\n"; + } + Connector center_to_base(dim), center_to_head(dim); + center_to_base.computeTransposeOf(base_to_center, mpi); + center_to_head.computeTransposeOf(head_to_center, mpi); + d_object_timers->t_find_overlaps_assumed_partition_transpose->barrierAndStop(); + + // Bridge for base<==>head + base_to_center.setTranspose(¢er_to_base, false); + head_to_center.setTranspose(¢er_to_head, false); + const IntVector center_growth_to_nest_base( + dim, + head_bounding_cell_count < + base_bounding_cell_count ? tbox::MathUtilities::getMax() : 0); + const IntVector center_growth_to_nest_head( + dim, + head_bounding_cell_count < base_bounding_cell_count ? 0 : tbox::MathUtilities::getMax()); + boost::shared_ptr tmp_conn; + if (d_print_steps) { + tbox::plog << "OverlapConnectorAlgorithm::findOverlaps_assumedPartition: bridging.\n"; + } + bridgeWithNesting(tmp_conn, + base_to_center, + center_to_head, + center_growth_to_nest_base, + center_growth_to_nest_head, + IntVector(dim, -1), + false); + conn.clear(); + conn.setBase(tmp_conn->getBase()); + conn.setHead(tmp_conn->getHead()); + conn.setWidth(tmp_conn->getConnectorWidth(), true); + for (Connector::NeighborhoodIterator ni = tmp_conn->begin(); ni != tmp_conn->end(); ++ni) { + for (Connector::NeighborIterator na = tmp_conn->begin(ni); na != tmp_conn->end(ni); ++na) { + conn.insertLocalNeighbor(*na, *ni); + } } - t_find_overlaps_rbbt->stop(); -} + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("OverlapConnectorAlgorithm::findOverlaps_assumedPartition: not finishing\n" + << "clean of receivable MPI messages."); + } -/* - *********************************************************************** - *********************************************************************** - */ -void -OverlapConnectorAlgorithm::bridge( - Connector& west_to_east, - Connector& east_to_west, - const Connector& west_to_cent, - const Connector& cent_to_east, - const Connector& east_to_cent, - const Connector& cent_to_west) const -{ - const IntVector& zero_vector( - IntVector::getZero(cent_to_east.getConnectorWidth().getDim())); - const IntVector connector_width_limit( - cent_to_east.getConnectorWidth().getDim(), -1); // No user-imposed limit. - privateBridge( - west_to_east, - &east_to_west == &west_to_east ? NULL : &east_to_west, - west_to_cent, - cent_to_east, - east_to_cent, - cent_to_west, - false, - zero_vector, - false, - zero_vector, - connector_width_limit); + d_object_timers->t_find_overlaps_assumed_partition->stop(); + if (d_print_steps) { + tbox::plog << "OverlapConnectorAlgorithm::findOverlaps_assumedPartition: leaving.\n"; + } } /* @@ -490,28 +664,72 @@ OverlapConnectorAlgorithm::bridge( */ void OverlapConnectorAlgorithm::bridgeWithNesting( - Connector& west_to_east, - Connector& east_to_west, + boost::shared_ptr& west_to_east, const Connector& west_to_cent, const Connector& cent_to_east, - const Connector& east_to_cent, - const Connector& cent_to_west, const IntVector& cent_growth_to_nest_west, const IntVector& cent_growth_to_nest_east, - const IntVector& connector_width_limit) const + const IntVector& connector_width_limit, + bool compute_transpose) const { - privateBridge( - west_to_east, - &east_to_west == &west_to_east ? NULL : &east_to_west, + const tbox::SAMRAI_MPI& mpi = + d_mpi.hasNullCommunicator() ? west_to_cent.getBase().getMPI() : d_mpi; + + if (d_barrier_before_communication) { + mpi.Barrier(); + } + d_object_timers->t_bridge->start(); + + TBOX_ASSERT(west_to_cent.hasTranspose()); + TBOX_ASSERT(cent_to_east.hasTranspose()); + const tbox::Dimension& dim(connector_width_limit.getDim()); + IntVector west_to_east_width(dim); + IntVector east_to_west_width(dim); + std::set incoming_ranks, outgoing_ranks; + bool ordered = true; + NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); + privateBridge_prologue( west_to_cent, cent_to_east, - east_to_cent, - cent_to_west, + cent_to_east.getTranspose(), + west_to_cent.getTranspose(), (cent_growth_to_nest_west(0) >= 0), cent_growth_to_nest_west, (cent_growth_to_nest_east(0) >= 0), cent_growth_to_nest_east, - connector_width_limit); + connector_width_limit, + compute_transpose, + west_to_east_width, + east_to_west_width, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + Connector* east_to_west = 0; + west_to_east.reset(new Connector(west_to_cent.getBase(), + cent_to_east.getHead(), + west_to_east_width)); + if (compute_transpose) { + east_to_west = new Connector(cent_to_east.getHead(), + west_to_cent.getBase(), + east_to_west_width); + } + privateBridge( + *west_to_east, + east_to_west, + cent_to_east, + compute_transpose, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + if (compute_transpose) { + west_to_east->setTranspose(east_to_west, true); + } else if (&west_to_east->getHead() == &west_to_east->getBase()) { + west_to_east->setTranspose(west_to_east.get(), false); + } + + d_object_timers->t_bridge->stop(); } /* @@ -520,28 +738,71 @@ OverlapConnectorAlgorithm::bridgeWithNesting( */ void OverlapConnectorAlgorithm::bridge( - Connector& west_to_east, - Connector& east_to_west, + boost::shared_ptr& west_to_east, const Connector& west_to_cent, const Connector& cent_to_east, - const Connector& east_to_cent, - const Connector& cent_to_west, - const IntVector& connector_width_limit) const + const IntVector& connector_width_limit, + bool compute_transpose) const { - const IntVector& zero_vector( - IntVector::getZero(cent_to_east.getConnectorWidth().getDim())); - privateBridge( - west_to_east, - &east_to_west == &west_to_east ? NULL : &east_to_west, + const tbox::SAMRAI_MPI& mpi = + d_mpi.hasNullCommunicator() ? west_to_cent.getBase().getMPI() : d_mpi; + + if (d_barrier_before_communication) { + mpi.Barrier(); + } + d_object_timers->t_bridge->start(); + + TBOX_ASSERT(west_to_cent.hasTranspose()); + TBOX_ASSERT(cent_to_east.hasTranspose()); + const tbox::Dimension& dim(connector_width_limit.getDim()); + const IntVector& zero_vector(IntVector::getZero(dim)); + IntVector west_to_east_width(dim); + IntVector east_to_west_width(dim); + std::set incoming_ranks, outgoing_ranks; + bool ordered = true; + NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); + privateBridge_prologue( west_to_cent, cent_to_east, - east_to_cent, - cent_to_west, + cent_to_east.getTranspose(), + west_to_cent.getTranspose(), false, zero_vector, false, zero_vector, - connector_width_limit); + connector_width_limit, + compute_transpose, + west_to_east_width, + east_to_west_width, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + Connector* east_to_west = 0; + west_to_east.reset(new Connector(west_to_cent.getBase(), + cent_to_east.getHead(), + west_to_east_width)); + if (compute_transpose) { + east_to_west = new Connector(cent_to_east.getHead(), + west_to_cent.getBase(), + east_to_west_width); + } + privateBridge( + *west_to_east, + east_to_west, + cent_to_east, + compute_transpose, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + if (compute_transpose) { + west_to_east->setTranspose(east_to_west, true); + } else if (&west_to_east->getHead() == &west_to_east->getBase()) { + west_to_east->setTranspose(west_to_east.get(), false); + } + + d_object_timers->t_bridge->stop(); } /* @@ -550,24 +811,71 @@ OverlapConnectorAlgorithm::bridge( */ void OverlapConnectorAlgorithm::bridge( - Connector& west_to_cent, + boost::shared_ptr& west_to_east, + const Connector& west_to_cent, const Connector& cent_to_east, - const Connector& east_to_cent, - Connector& cent_to_west, - const IntVector& connector_width_limit) const + bool compute_transpose) const { - const IntVector& zero_vector( - IntVector::getZero(cent_to_east.getConnectorWidth().getDim())); - privateBridge( + const tbox::SAMRAI_MPI& mpi = + d_mpi.hasNullCommunicator() ? west_to_cent.getBase().getMPI() : d_mpi; + + if (d_barrier_before_communication) { + mpi.Barrier(); + } + d_object_timers->t_bridge->start(); + + TBOX_ASSERT(west_to_cent.hasTranspose()); + TBOX_ASSERT(cent_to_east.hasTranspose()); + const tbox::Dimension& dim(cent_to_east.getConnectorWidth().getDim()); + const IntVector& zero_vector(IntVector::getZero(dim)); + const IntVector connector_width_limit(dim, -1); // No user-imposed limit. + IntVector west_to_east_width(dim); + IntVector east_to_west_width(dim); + std::set incoming_ranks, outgoing_ranks; + bool ordered = true; + NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); + privateBridge_prologue( west_to_cent, cent_to_east, - east_to_cent, - cent_to_west, + cent_to_east.getTranspose(), + west_to_cent.getTranspose(), false, zero_vector, false, zero_vector, - connector_width_limit); + connector_width_limit, + compute_transpose, + west_to_east_width, + east_to_west_width, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + Connector* east_to_west = 0; + west_to_east.reset(new Connector(west_to_cent.getBase(), + cent_to_east.getHead(), + west_to_east_width)); + if (compute_transpose) { + east_to_west = new Connector(cent_to_east.getHead(), + west_to_cent.getBase(), + east_to_west_width); + } + privateBridge( + *west_to_east, + east_to_west, + cent_to_east, + compute_transpose, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + if (compute_transpose) { + west_to_east->setTranspose(east_to_west, true); + } else if (&west_to_east->getHead() == &west_to_east->getBase()) { + west_to_east->setTranspose(west_to_east.get(), false); + } + + d_object_timers->t_bridge->stop(); } /* @@ -576,85 +884,76 @@ OverlapConnectorAlgorithm::bridge( */ void OverlapConnectorAlgorithm::bridge( - Connector& west_to_east, - const Connector& west_to_cent, + Connector& west_to_cent, const Connector& cent_to_east, - const Connector& east_to_cent, - const Connector& cent_to_west, const IntVector& connector_width_limit) const { + const tbox::SAMRAI_MPI& mpi = + d_mpi.hasNullCommunicator() ? cent_to_east.getBase().getMPI() : d_mpi; + + if (d_barrier_before_communication) { + mpi.Barrier(); + } + d_object_timers->t_bridge->start(); + + TBOX_ASSERT(west_to_cent.hasTranspose()); + TBOX_ASSERT(cent_to_east.hasTranspose()); + Connector& cent_to_west = west_to_cent.getTranspose(); + const tbox::Dimension& dim(connector_width_limit.getDim()); const IntVector& zero_vector( IntVector::getZero(cent_to_east.getConnectorWidth().getDim())); - privateBridge( - west_to_east, - NULL, + IntVector west_to_east_width(dim); + IntVector east_to_west_width(dim); + std::set incoming_ranks, outgoing_ranks; + bool ordered = true; + NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); + bool compute_transpose = &west_to_cent != &west_to_cent.getTranspose(); + privateBridge_prologue( west_to_cent, cent_to_east, - east_to_cent, - cent_to_west, + cent_to_east.getTranspose(), + west_to_cent.getTranspose(), false, zero_vector, false, zero_vector, - connector_width_limit); -} - -/* - *********************************************************************** - *********************************************************************** - */ -void -OverlapConnectorAlgorithm::bridge( - Connector& west_to_east, - const Connector& west_to_cent, - const Connector& cent_to_east, - const Connector& east_to_cent, - const Connector& cent_to_west) const -{ - const IntVector& zero_vector( - IntVector::getZero(cent_to_east.getConnectorWidth().getDim())); - const IntVector connector_width_limit( - cent_to_east.getConnectorWidth().getDim(), -1); // No user-imposed limit. + connector_width_limit, + compute_transpose, + west_to_east_width, + east_to_west_width, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + west_to_cent.clearNeighborhoods(); + west_to_cent.setBase(west_to_cent.getBase()); + west_to_cent.setHead(cent_to_east.getHead()); + west_to_cent.setWidth(west_to_east_width, true); + if (compute_transpose) { + cent_to_west.clearNeighborhoods(); + cent_to_west.setBase(cent_to_east.getHead()); + cent_to_west.setHead(west_to_cent.getBase()); + cent_to_west.setWidth(east_to_west_width, true); + } privateBridge( - west_to_east, - NULL, west_to_cent, + ¢_to_west, cent_to_east, - east_to_cent, - cent_to_west, - false, - zero_vector, - false, - zero_vector, - connector_width_limit); + compute_transpose, + incoming_ranks, + outgoing_ranks, + visible_west_nabrs, + visible_east_nabrs); + + d_object_timers->t_bridge->stop(); } /* *********************************************************************** - * - * west to east - * (west mapped_box_level) ------------------> (east mapped_box_level) - * ^ <------------------ ^ - * \ east to west / - * \ / - * center to west \ / center to east - * \ / - * \ / - * (center mapped_box_level) - * - * Bridge operation is in two phases, discovery and - * sharing. The discovery phase loops through local - * Boxes in the center and comparing the west and east neighbors - * for overlaps. Local overlaps are stored immediately. - * Remote overlaps are placed in messages to be sent to appropriate - * processors by the sharing phase. *********************************************************************** */ - void -OverlapConnectorAlgorithm::privateBridge( - Connector& west_to_east, - Connector* east_to_west, +OverlapConnectorAlgorithm::privateBridge_prologue( const Connector& west_to_cent, const Connector& cent_to_east, const Connector& east_to_cent, @@ -663,11 +962,17 @@ OverlapConnectorAlgorithm::privateBridge( const IntVector& cent_growth_to_nest_west, bool east_nesting_is_known, const IntVector& cent_growth_to_nest_east, - const IntVector& connector_width_limit) const + const IntVector& connector_width_limit, + bool compute_transpose, + IntVector& west_to_east_width, + IntVector& east_to_west_width, + std::set& incoming_ranks, + std::set& outgoing_ranks, + NeighborSet& visible_west_nabrs, + NeighborSet& visible_east_nabrs) const { - t_bridge->barrierAndStart(); - if (s_print_steps == 'y') { + if (d_print_steps) { std::string dbgbord("bridge-> "); tbox::plog << "bridge west:\n" << west_to_cent.getBase().format(dbgbord, 3) @@ -676,7 +981,7 @@ OverlapConnectorAlgorithm::privateBridge( << "bridge west_to_cent:\n" << west_to_cent.format(dbgbord, 3) << "bridge cent_to_west:\n" << cent_to_west.format(dbgbord, 3) << "bridge cent_to_east:\n" << cent_to_east.format(dbgbord, 3) - << "bridge east_to_cent:\n" << cent_to_east.format(dbgbord, 3); + << "bridge east_to_cent:\n" << east_to_cent.format(dbgbord, 3); } privateBridge_checkParameters( @@ -693,7 +998,6 @@ OverlapConnectorAlgorithm::privateBridge( const IntVector& east_refinement_ratio = east.getRefinementRatio(); const tbox::Dimension& dim(connector_width_limit.getDim()); - const tbox::SAMRAI_MPI& mpi(cent.getMPI()); const IntVector& zero_vector(IntVector::getZero(dim)); @@ -702,6 +1006,17 @@ OverlapConnectorAlgorithm::privateBridge( cent_refinement_ratio, IntVector::max(west_refinement_ratio, east_refinement_ratio)); + const size_t num_blocks = cent_refinement_ratio.getNumBlocks(); + + IntVector width_limit(connector_width_limit); + if (width_limit.getNumBlocks() == 1 && num_blocks != 1) { + if (width_limit.max() == width_limit.min()) { + width_limit = IntVector(width_limit, num_blocks); + } else { + TBOX_ERROR("Anisotropic width limit argument for bridge must be of size equal to the number of blocks." << std::endl); + } + } + /* * Using the bridge theorem, compute the largest bridge width for * which we can guarantee discovering all the overlaps (when @@ -711,7 +1026,8 @@ OverlapConnectorAlgorithm::privateBridge( * neither is known, we assume that both east and west nest in * center, and just to do something reasonable. */ - IntVector output_width1(dim, 0), output_width2(dim, 0); + IntVector output_width1(zero_vector, num_blocks); + IntVector output_width2(zero_vector, num_blocks); if (west_nesting_is_known || east_nesting_is_known) { if (west_nesting_is_known) { output_width1 = @@ -722,7 +1038,7 @@ OverlapConnectorAlgorithm::privateBridge( cent_to_west.getConnectorWidth() - cent_growth_to_nest_east; } if (!(output_width1 >= zero_vector || output_width2 >= zero_vector)) { - TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge:\n" + TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge_prologue:\n" << "Useless nesting specifications!\n" << "Neither west nor east BoxLevel nest with enough\n" << "margin to guarantee finding all overlaps.\n" @@ -746,53 +1062,47 @@ OverlapConnectorAlgorithm::privateBridge( * that the width limit is specified in the coarser of the east and * west refinement ratios. */ - if (connector_width_limit >= IntVector::getZero(dim)) { + if (width_limit >= zero_vector) { const IntVector coarser_refinement_ratio = IntVector::min(west_refinement_ratio, east_refinement_ratio); const IntVector width_limit_in_finest_refinement_ratio( - connector_width_limit * finest_refinement_ratio / coarser_refinement_ratio); - if (width_limit_in_finest_refinement_ratio > output_width_in_finest_refinement_ratio) { + width_limit * finest_refinement_ratio / coarser_refinement_ratio); + if (!(width_limit_in_finest_refinement_ratio <= output_width_in_finest_refinement_ratio)) { /* * If user specifies a width limit, he is probably assuming - * that the bridge's allowable width is bigger. If that is - * not the case, this method won't crash, but it will give - * bad results that result in elusive bugs. Therefore, we - * catch it immediately. + * that the bridge's allowable width is no smaller. If that + * is not the case, this method will not crash, but it will + * give bad results that result in elusive bugs. Therefore, + * we catch it immediately. */ - TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge found input error:\n" - << "The given connector width limit, " << connector_width_limit - << " (" << width_limit_in_finest_refinement_ratio << " in finest index space)\n" - << "is smaller than the width of the bridge, " - << output_width_in_finest_refinement_ratio << " (in finest index space)."); + TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge_prologue input error:\n" + << "The given connector width limit, " << width_limit + << " (" << width_limit_in_finest_refinement_ratio + << " in finest index space)\n" + << "is not <= the maximum width of the bridge, " + << output_width_in_finest_refinement_ratio + << " (in finest index space)."); } - output_width_in_finest_refinement_ratio.min(width_limit_in_finest_refinement_ratio); + output_width_in_finest_refinement_ratio.min( + width_limit_in_finest_refinement_ratio); } - const IntVector west_to_east_width = IntVector::ceilingDivide( + west_to_east_width = IntVector::ceilingDivide( output_width_in_finest_refinement_ratio, finest_refinement_ratio / west_refinement_ratio); - const IntVector east_to_west_width = IntVector::ceilingDivide( + east_to_west_width = IntVector::ceilingDivide( output_width_in_finest_refinement_ratio, finest_refinement_ratio / east_refinement_ratio); - - const int rank = mpi.getRank(); - - /* - * Compute the reverse bridge (east_to_west) if it is given and is - * distinct. - */ - const bool compute_reverse = - (east_to_west != NULL && east_to_west != &west_to_east); + const int rank = cent.getMPI().getRank(); /* * Owners we have to exchange information with are the ones * owning east/west Boxes visible to the local process. */ - std::set incoming_ranks, outgoing_ranks; cent_to_west.getLocalOwners(outgoing_ranks); west_to_cent.getLocalOwners(incoming_ranks); - if (compute_reverse && ¢_to_west != ¢_to_east) { + if (compute_transpose && ¢_to_west != ¢_to_east) { cent_to_east.getLocalOwners(outgoing_ranks); east_to_cent.getLocalOwners(incoming_ranks); } @@ -800,138 +1110,28 @@ OverlapConnectorAlgorithm::privateBridge( incoming_ranks.erase(rank); /* - * Create BoxContainers which will later be used to initialize the search trees - * for visible east and west neighbors: + * Create BoxContainers which will later be used to initialize the search + * trees for visible east and west neighbors: * visible_west_nabrs and visible_east_nabrs. */ - t_bridge_discover_get_neighbors->start(); - bool ordered = true; - NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); + d_object_timers->t_bridge_discover_get_neighbors->start(); cent_to_west.getLocalNeighbors(visible_west_nabrs); cent_to_east.getLocalNeighbors(visible_east_nabrs); - t_bridge_discover_get_neighbors->stop(); - - /* - * Setup the output Connectors' head, base, width and type. Add - * overlaps below as they are discovered or received from other procs. - */ - west_to_east.clearNeighborhoods(); - west_to_east.setConnectorType(Connector::UNKNOWN); - west_to_east.setBase(west); - west_to_east.setHead(east); - west_to_east.setWidth(west_to_east_width, true); - if (compute_reverse) { - east_to_west->clearNeighborhoods(); - east_to_west->setConnectorType(Connector::UNKNOWN); - east_to_west->setBase(east); - east_to_west->setHead(west); - east_to_west->setWidth(east_to_west_width, true); -#ifdef DEBUG_CHECK_ASSERTIONS - if (west_refinement_ratio / east_refinement_ratio * east_refinement_ratio == west_refinement_ratio || - east_refinement_ratio / west_refinement_ratio * west_refinement_ratio == east_refinement_ratio) { - /* - * If it's possible to make west<==>east transposes, it - * should happen. The requirement is that one refinement ratio is - * an IntVector times the other. - */ - west_to_east.isTransposeOf(*east_to_west); - east_to_west->isTransposeOf(west_to_east); - } -#endif - } - - - /* - * Set up communication mechanism and post receives. - * Note that in all_comms, all the incoming_comm come - * first, the outgoing_comm later. - */ - - tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer* all_comms(NULL); - - t_bridge_share->start(); - t_bridge_setup_comm->start(); - - setupCommunication( - all_comms, - comm_stage, - mpi, - incoming_ranks, - outgoing_ranks, - t_bridge_MPI_wait, - s_operation_mpi_tag); - - t_bridge_setup_comm->stop(); - t_bridge_share->stop(); - - /* - * Data for caching relationship removal messages. This - * temporary object holds data computed when removing neighbors, - * to be used when sending out the relationship removal - * information. - */ - std::map > neighbor_removal_mesg; - - /* - * First step: Remove neighbor data for Boxes that are - * going away and cache information to be sent out. - */ - privateModify_removeAndCache( - neighbor_removal_mesg, - west_to_east, - east_to_west, - cent_to_east); - - privateBridge_discoverAndSend( - neighbor_removal_mesg, - west_to_east, - east_to_west, - incoming_ranks, - outgoing_ranks, - all_comms, - visible_west_nabrs, - visible_east_nabrs); - - t_bridge_share->start(); - - receiveAndUnpack( - west_to_east, - east_to_west, - incoming_ranks, - all_comms, - comm_stage, - t_bridge_receive_and_unpack); - - t_bridge_share->stop(); - - delete[] all_comms; - - if (d_sanity_check_method_postconditions) { - west_to_east.assertConsistencyWithBase(); - west_to_east.assertConsistencyWithHead(); - if (compute_reverse) { - east_to_west->assertConsistencyWithBase(); - east_to_west->assertConsistencyWithHead(); - east_to_west->assertTransposeCorrectness(west_to_east, true); - } - } - - t_bridge->stop(); + d_object_timers->t_bridge_discover_get_neighbors->stop(); } /* *********************************************************************** * * west to east - * (west mapped_box_level) ------------------> (east mapped_box_level) + * (west box_level) ------------------> (east box_level) * ^ <------------------ ^ * \ east to west / * \ / * center to west \ / center to east * \ / * \ / - * (center mapped_box_level) + * (center box_level) * * Bridge operation is in two phases, discovery and * sharing. The discovery phase loops through local @@ -944,190 +1144,35 @@ OverlapConnectorAlgorithm::privateBridge( void OverlapConnectorAlgorithm::privateBridge( - Connector& west_to_cent, + Connector& west_to_east, + Connector* east_to_west, const Connector& cent_to_east, - const Connector& east_to_cent, - Connector& cent_to_west, - bool west_nesting_is_known, - const IntVector& cent_growth_to_nest_west, - bool east_nesting_is_known, - const IntVector& cent_growth_to_nest_east, - const IntVector& connector_width_limit) const + bool compute_transpose, + const std::set& incoming_ranks, + const std::set& outgoing_ranks, + NeighborSet& visible_west_nabrs, + NeighborSet& visible_east_nabrs) const { - t_bridge->barrierAndStart(); - - if (s_print_steps == 'y') { - std::string dbgbord("bridge-> "); - tbox::plog - << "bridge west:\n" << west_to_cent.getBase().format(dbgbord, 3) - << "bridge east:\n" << east_to_cent.getBase().format(dbgbord, 3) - << "bridge center:\n" << cent_to_west.getBase().format(dbgbord, 3) - << "bridge west_to_cent:\n" << west_to_cent.format(dbgbord, 3) - << "bridge cent_to_west:\n" << cent_to_west.format(dbgbord, 3) - << "bridge cent_to_east:\n" << cent_to_east.format(dbgbord, 3) - << "bridge east_to_cent:\n" << east_to_cent.format(dbgbord, 3); - } - - privateBridge_checkParameters( - west_to_cent, - cent_to_east, - east_to_cent, - cent_to_west); - - const BoxLevel& cent = cent_to_west.getBase(); - const BoxLevel& west = cent_to_west.getHead(); - const BoxLevel& east = cent_to_east.getHead(); - const IntVector& cent_refinement_ratio = cent.getRefinementRatio(); - const IntVector& west_refinement_ratio = west.getRefinementRatio(); - const IntVector& east_refinement_ratio = east.getRefinementRatio(); - - const tbox::Dimension& dim(connector_width_limit.getDim()); - const tbox::SAMRAI_MPI& mpi(cent.getMPI()); - - const IntVector& zero_vector(IntVector::getZero(dim)); - - const IntVector finest_refinement_ratio = - IntVector::max( - cent_refinement_ratio, - IntVector::max(west_refinement_ratio, east_refinement_ratio)); - - /* - * Using the bridge theorem, compute the largest bridge width for - * which we can guarantee discovering all the overlaps (when - * nesting is satisfied). If either the east or west - * BoxLevel's nesting in the center is known, compute the - * output width by the bridge theorem, and use the bigger one. If - * neither is known, we assume that both east and west nest in - * center, and just to do something reasonable. - */ - IntVector output_width1(dim, 0), output_width2(dim, 0); - if (west_nesting_is_known || east_nesting_is_known) { - if (west_nesting_is_known) { - output_width1 = - cent_to_east.getConnectorWidth() - cent_growth_to_nest_west; - } - if (east_nesting_is_known) { - output_width2 = - cent_to_west.getConnectorWidth() - cent_growth_to_nest_east; - } - if (!(output_width1 >= zero_vector || output_width2 >= zero_vector)) { - TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge:\n" - << "Useless nesting specifications!\n" - << "Neither west nor east BoxLevel nest with enough\n" - << "margin to guarantee finding all overlaps.\n" - << "To ensure you understand completness is not guaranteed,\n" - << "this is considered an error. To proceed anyway and live\n" - << "with potential incompleteness, use a bridge interface\n" - << "that does not claim any nesting. Or, you can specify\n" - << "a different nesting claim (but don't enable sanity\n" - << "checking, which will catch your fib).\n"); - } - } else { - output_width1 = cent_to_east.getConnectorWidth(); - output_width2 = cent_to_west.getConnectorWidth(); - } - IntVector output_width_in_finest_refinement_ratio = - IntVector::max(output_width1, output_width2) * - finest_refinement_ratio / cent_refinement_ratio; - - /* - * Reduce the output width to the user-specified width limit. Note - * that the width limit is specified in the coarser of the east and - * west refinement ratios. - */ - if (connector_width_limit >= IntVector::getZero(dim)) { - const IntVector coarser_refinement_ratio = - IntVector::min(west_refinement_ratio, east_refinement_ratio); - const IntVector width_limit_in_finest_refinement_ratio( - connector_width_limit * finest_refinement_ratio / coarser_refinement_ratio); - if (width_limit_in_finest_refinement_ratio > output_width_in_finest_refinement_ratio) { - /* - * If user specifies a width limit, he is probably assuming - * that the bridge's allowable width is bigger. If that is - * not the case, this method won't crash, but it will give - * bad results that result in elusive bugs. Therefore, we - * catch it immediately. - */ - TBOX_ERROR("OverlapConnectorAlgorithm::privateBridge found input error:\n" - << "The given connector width limit, " << connector_width_limit - << " (" << width_limit_in_finest_refinement_ratio << " in finest index space)\n" - << "is smaller than the width of the bridge, " - << output_width_in_finest_refinement_ratio << " (in finest index space)."); - } - output_width_in_finest_refinement_ratio.min(width_limit_in_finest_refinement_ratio); - } - - const IntVector west_to_east_width = IntVector::ceilingDivide( - output_width_in_finest_refinement_ratio, - finest_refinement_ratio / west_refinement_ratio); - const IntVector east_to_west_width = IntVector::ceilingDivide( - output_width_in_finest_refinement_ratio, - finest_refinement_ratio / east_refinement_ratio); - - - const int rank = mpi.getRank(); - - - /* - * Compute the reverse bridge (east_to_west) if it is given and is - * distinct. - */ - const bool compute_reverse = (¢_to_west != &west_to_cent); - - /* - * Owners we have to exchange information with are the ones - * owning east/west Boxes visible to the local process. - */ - std::set incoming_ranks, outgoing_ranks; - cent_to_west.getLocalOwners(outgoing_ranks); - west_to_cent.getLocalOwners(incoming_ranks); - if (compute_reverse && ¢_to_west != ¢_to_east) { - cent_to_east.getLocalOwners(outgoing_ranks); - east_to_cent.getLocalOwners(incoming_ranks); - } - outgoing_ranks.erase(rank); - incoming_ranks.erase(rank); - - /* - * Create BoxContainers which will later be used to initialize the search trees - * for visible east and west neighbors: - * visible_west_nabrs and visible_east_nabrs. - */ - t_bridge_discover_get_neighbors->start(); - bool ordered = true; - NeighborSet visible_west_nabrs(ordered), visible_east_nabrs(ordered); - cent_to_west.getLocalNeighbors(visible_west_nabrs); - cent_to_east.getLocalNeighbors(visible_east_nabrs); - t_bridge_discover_get_neighbors->stop(); - - /* - * Initialize the output Connectors without overlaps. Add overlaps - * below as they are discovered or received from other procs. - */ - west_to_cent.clearNeighborhoods(); - west_to_cent.setConnectorType(Connector::UNKNOWN); - west_to_cent.setBase(west); - west_to_cent.setHead(east); - west_to_cent.setWidth(west_to_east_width, true); - if (compute_reverse) { - cent_to_west.clearNeighborhoods(); - cent_to_west.setConnectorType(Connector::UNKNOWN); - cent_to_west.setBase(east); - cent_to_west.setHead(west); - cent_to_west.setWidth(east_to_west_width, true); #ifdef DEBUG_CHECK_ASSERTIONS - if (west_refinement_ratio / east_refinement_ratio * east_refinement_ratio == west_refinement_ratio || - east_refinement_ratio / west_refinement_ratio * west_refinement_ratio == east_refinement_ratio) { + if (compute_transpose) { + const IntVector& west_refinement_ratio = + west_to_east.getBase().getRefinementRatio(); + const IntVector& east_refinement_ratio = + west_to_east.getHead().getRefinementRatio(); + if (west_refinement_ratio / east_refinement_ratio * east_refinement_ratio == + west_refinement_ratio || + east_refinement_ratio / west_refinement_ratio * west_refinement_ratio == + east_refinement_ratio) { /* * If it's possible to make west<==>east transposes, it * should happen. The requirement is that one refinement ratio is * an IntVector times the other. */ - TBOX_ASSERT(west_to_cent.isTransposeOf(cent_to_west)); - TBOX_ASSERT(cent_to_west.isTransposeOf(west_to_cent)); + TBOX_ASSERT(west_to_east.isTransposeOf(*east_to_west)); + TBOX_ASSERT(east_to_west->isTransposeOf(west_to_east)); } -#endif } +#endif /* @@ -1137,10 +1182,25 @@ OverlapConnectorAlgorithm::privateBridge( */ tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer* all_comms(NULL); + tbox::AsyncCommPeer * all_comms(0); - t_bridge_share->start(); - t_bridge_setup_comm->start(); + d_object_timers->t_bridge_share->start(); + d_object_timers->t_bridge_setup_comm->start(); + + if (d_sanity_check_method_preconditions) { + if (!d_mpi.hasNullCommunicator() && + !d_mpi.isCongruentWith(west_to_east.getBase().getMPI())) { + TBOX_ERROR("OverlapConnectorAlgorithm::findOverlaps_assumedPartition input error: Input\n" + << "has SAMRAI_MPI that is incongruent with OverlapConnectorAlgorithm's.\n" + << "See OverlapConnectorAlgorithm::setSAMRAI_MPI.\n"); + } + } + + const tbox::SAMRAI_MPI& mpi = + d_mpi.hasNullCommunicator() ? west_to_east.getBase().getMPI() : d_mpi; + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Errant message detected."); + } setupCommunication( all_comms, @@ -1148,65 +1208,72 @@ OverlapConnectorAlgorithm::privateBridge( mpi, incoming_ranks, outgoing_ranks, - t_bridge_MPI_wait, - s_operation_mpi_tag); + d_object_timers->t_bridge_MPI_wait, + s_operation_mpi_tag, + d_print_steps); - t_bridge_setup_comm->stop(); - t_bridge_share->stop(); + d_object_timers->t_bridge_setup_comm->stop(); + d_object_timers->t_bridge_share->stop(); /* - * Data for caching relationship removal messages. This - * temporary object holds data computed when removing neighbors, - * to be used when sending out the relationship removal - * information. + * Messages for other processors describing removed and added relationships. */ - std::map > neighbor_removal_mesg; + std::map > send_mesgs; + for (std::set::const_iterator itr(outgoing_ranks.begin()); + itr != outgoing_ranks.end(); ++itr) { + send_mesgs[*itr]; + } /* * First step: Remove neighbor data for Boxes that are * going away and cache information to be sent out. */ - privateModify_removeAndCache( - neighbor_removal_mesg, - west_to_cent, - ¢_to_west, + privateBridge_removeAndCache( + send_mesgs, + west_to_east, + east_to_west, cent_to_east); privateBridge_discoverAndSend( - neighbor_removal_mesg, - west_to_cent, - ¢_to_west, + send_mesgs, + west_to_east, + east_to_west, incoming_ranks, outgoing_ranks, all_comms, visible_west_nabrs, visible_east_nabrs); - t_bridge_share->start(); + d_object_timers->t_bridge_share->start(); receiveAndUnpack( - west_to_cent, - ¢_to_west, + west_to_east, + east_to_west, incoming_ranks, all_comms, comm_stage, - t_bridge_receive_and_unpack); + d_object_timers->t_bridge_receive_and_unpack, + d_print_steps); - t_bridge_share->stop(); + d_object_timers->t_bridge_share->stop(); - delete[] all_comms; + if (all_comms) { + delete[] all_comms; + } if (d_sanity_check_method_postconditions) { - west_to_cent.assertConsistencyWithBase(); - west_to_cent.assertConsistencyWithHead(); - if (compute_reverse) { - cent_to_west.assertConsistencyWithBase(); - cent_to_west.assertConsistencyWithHead(); - cent_to_west.assertTransposeCorrectness(west_to_cent, true); + west_to_east.assertConsistencyWithBase(); + west_to_east.assertConsistencyWithHead(); + if (compute_transpose) { + east_to_west->assertConsistencyWithBase(); + east_to_west->assertConsistencyWithHead(); + east_to_west->assertTransposeCorrectness(west_to_east, true); } } - t_bridge->stop(); + if (mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Errant message detected."); + } } /* @@ -1231,9 +1298,10 @@ OverlapConnectorAlgorithm::privateBridge_checkParameters( if (cent != cent_to_east.getBase() || cent != east_to_cent.getHead() || cent != west_to_cent.getHead()) { - TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::bridge:\n" + TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "Given Connectors to base and head of bridge are not incident\n" - << "from the same center in OverlapConnectorAlgorithm::bridge:\n" + << "from the same center in\n" + << "OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "west_to_cent is TO " << &west_to_cent.getHead() << "\n" << "cent_to_east is FROM " << ¢_to_east.getBase() << "\n" << "east_to_cent is TO " << &east_to_cent.getHead() << "\n" @@ -1241,34 +1309,36 @@ OverlapConnectorAlgorithm::privateBridge_checkParameters( ); } /* - * Ensure that head and base mapped_box_levels in argument agree with + * Ensure that head and base box_levels in argument agree with * head and base in the object. */ if (cent_to_west.getHead() != west_to_cent.getBase()) { - TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::bridge:\n" + TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "Given Connectors to and from base of bridge do not refer\n" - << "to the base of the bridge in OverlapConnectorAlgorithm::bridge:\n" + << "to the base of the bridge in\n" + << "OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "west_to_cent is FROM " << &west_to_cent.getBase() << "\n" << "cent_to_west is TO " << ¢_to_west.getHead() << "\n" ); } if (cent_to_east.getHead() != east_to_cent.getBase()) { - TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::bridge:\n" + TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "Given Connectors to and from head of bridge do not refer\n" - << "to the head of the bridge in OverlapConnectorAlgorithm::bridge:\n" + << "to the head of the bridge in\n" + << "OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "east_to_cent is FROM " << &east_to_cent.getBase() << "\n" << "cent_to_east is TO " << ¢_to_east.getHead() << "\n" ); } if (!west_to_cent.isTransposeOf(cent_to_west)) { - TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::bridge:\n" + TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "Given Connectors between base and center of bridge\n" << "are not transposes of each other.\n" << "See OverlapConnectorAlgorithm::isTransposeOf().\n" ); } if (!east_to_cent.isTransposeOf(cent_to_east)) { - TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::bridge:\n" + TBOX_ERROR("Bad input for OverlapConnectorAlgorithm::privateBridge_checkParameters:\n" << "Given Connectors between head and center of bridge\n" << "are not transposes of each other.\n" << "See OverlapConnectorAlgorithm::isTransposeOf().\n" @@ -1277,6 +1347,14 @@ OverlapConnectorAlgorithm::privateBridge_checkParameters( // Expensive sanity checks: if (d_sanity_check_method_preconditions) { + west_to_cent.assertConsistencyWithBase(); + west_to_cent.assertConsistencyWithHead(); + cent_to_east.assertConsistencyWithBase(); + cent_to_east.assertConsistencyWithHead(); + east_to_cent.assertConsistencyWithBase(); + east_to_cent.assertConsistencyWithHead(); + cent_to_west.assertConsistencyWithBase(); + cent_to_west.assertConsistencyWithHead(); west_to_cent.assertTransposeCorrectness(cent_to_west); cent_to_west.assertTransposeCorrectness(west_to_cent); east_to_cent.assertTransposeCorrectness(cent_to_east); @@ -1288,26 +1366,29 @@ OverlapConnectorAlgorithm::privateBridge_checkParameters( *********************************************************************** * Remove relationships from resulting overlap. Cache outgoing * information in message buffers. + * + * TODO: This method is a no-op. Is it a place holder for something? + * Maybe it should be removed. artf19532. *********************************************************************** */ void -OverlapConnectorAlgorithm::privateModify_removeAndCache( - std::map >& neighbor_removal_mesg, +OverlapConnectorAlgorithm::privateBridge_removeAndCache( + std::map >& send_mesgs, Connector& overlap_connector, Connector* overlap_connector_transpose, const Connector& misc_connector) const { - t_bridge_remove_and_cache->start(); - - NULL_USE(neighbor_removal_mesg); - NULL_USE(overlap_connector); - NULL_USE(overlap_connector_transpose); - NULL_USE(misc_connector); - /* - * As the overlap relationships are empty to start there are never any - * that need to be deleted. - */ - t_bridge_remove_and_cache->stop(); + d_object_timers->t_bridge_remove_and_cache->start(); + + NULL_USE(send_mesgs); + NULL_USE(overlap_connector); + NULL_USE(overlap_connector_transpose); + NULL_USE(misc_connector); + /* + * As the overlap relationships are empty to start there are never any + * that need to be deleted. + */ + d_object_timers->t_bridge_remove_and_cache->stop(); return; } @@ -1317,289 +1398,331 @@ OverlapConnectorAlgorithm::privateModify_removeAndCache( */ void OverlapConnectorAlgorithm::privateBridge_discoverAndSend( - std::map > neighbor_removal_mesg, + std::map >& send_mesgs, Connector& west_to_east, Connector* east_to_west, - std::set& incoming_ranks, - std::set& outgoing_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + const std::set& outgoing_ranks, + tbox::AsyncCommPeer* all_comms, NeighborSet& visible_west_nabrs, NeighborSet& visible_east_nabrs) const { - if (!visible_west_nabrs.isEmpty() || !visible_east_nabrs.isEmpty()) { + if (visible_west_nabrs.empty() && visible_east_nabrs.empty()) { + return; + } - /* - * Discover overlaps. Overlaps are either locally stored or - * packed into a message for sending. - */ + /* + * Discover overlaps. Overlaps are either locally stored or + * packed into a message for sending. + */ - t_bridge_discover->start(); + d_object_timers->t_bridge_discover_and_send->start(); + + if (d_print_steps) { + tbox::plog << "Before building RBBTs:\n" + << "visible_west_nabrs:" + << visible_west_nabrs.format("\n ") + << "visible_east_nabrs:" + << visible_east_nabrs.format("\n "); + tbox::plog << "\nincoming ranks (" << incoming_ranks.size() << "): "; + copy(incoming_ranks.begin(), incoming_ranks.end(), std::ostream_iterator(tbox::plog, " ")); + tbox::plog << "\noutgoing ranks (" << outgoing_ranks.size() << "): "; + copy(outgoing_ranks.begin(), outgoing_ranks.end(), std::ostream_iterator(tbox::plog, " ")); + tbox::plog << std::endl; + } - if (s_print_steps == 'y') { - tbox::plog << "Before building RBBTs:\n" - << "visible_west_nabrs:" << visible_west_nabrs.format("\n ") - << "visible_east_nabrs:" << visible_east_nabrs.format("\n ") - << std::endl; - } + bool compute_transpose = + (east_to_west != 0 && east_to_west != &west_to_east); - bool compute_reverse = - (east_to_west != NULL && east_to_west != &west_to_east); + const BoxLevel& east(west_to_east.getBase()); + const boost::shared_ptr& grid_geometry( + east.getGridGeometry()); - const BoxLevel& east(west_to_east.getBase()); - const boost::shared_ptr &grid_geometry( - east.getGridGeometry()); + const tbox::SAMRAI_MPI& mpi = d_mpi.hasNullCommunicator() ? east.getMPI() : d_mpi; - const tbox::Dimension& dim(east.getDim()); - const int rank = east.getMPI().getRank(); - const int nproc = east.getMPI().getSize(); + const tbox::Dimension& dim(east.getDim()); + const int rank = mpi.getRank(); - t_bridge_discover_form_rbbt->start(); - const BoxContainer east_rbbt(visible_east_nabrs); - east_rbbt.makeTree(grid_geometry.get()); - // Note: west_rbbt only needed when compute_reverse is true. - BoxContainer empty_nabrs(true); - const BoxContainer west_rbbt(compute_reverse ? visible_west_nabrs : empty_nabrs); - west_rbbt.makeTree(grid_geometry.get()); - t_bridge_discover_form_rbbt->stop(); + d_object_timers->t_bridge_discover_form_rbbt->start(); + const BoxContainer east_rbbt(visible_east_nabrs); + east_rbbt.makeTree(grid_geometry.get()); + // Note: west_rbbt only needed when compute_transpose is true. + BoxContainer empty_nabrs(true); + const BoxContainer west_rbbt( + compute_transpose ? visible_west_nabrs : empty_nabrs); + west_rbbt.makeTree(grid_geometry.get()); + d_object_timers->t_bridge_discover_form_rbbt->stop(); - /* - * Iterators west_ni and east_ni point to the west/east - * Box whose neighbors are being sought. If we are not - * interested in the east-->west connector, then east_ni will - * be unused. - */ - NeighborSet::iterator west_ni(visible_west_nabrs); - NeighborSet::iterator east_ni(visible_east_nabrs); - /* - * Local process can find some neighbors for the (local and - * remote) Boxes in visible_west_nabrs and - * visible_east_nabrs. We loop through the visible_west_nabrs - * and compare each to visible_east_nabrs, looking for overlaps. - * Then vice versa. - * - * Looping through the NeighborSets is like looping through - * their owners, since they are ordered by owners first. As an - * optimization measure, start loop on the first owner with - * higher rank than the local rank. This avoid the higher-end - * ranks from having to wait for messages at the beginning and - * the lower-end ranks from having to wait for messages at the - * end. After the highest rank owner has been handled, continue - * at the beginning and do the remaining. (If local rank is - * highest of all owners of the visible Boxes, start at - * the beginning.) - */ - const Box start_loop_here(dim, GlobalId(LocalId::getZero(), rank + 1)); - west_ni = visible_west_nabrs.lowerBound(start_loop_here); - if (compute_reverse) { - east_ni = visible_east_nabrs.lowerBound(start_loop_here); - } + /* + * Local process can find some neighbors for the (local and + * remote) Boxes in visible_west_nabrs and visible_east_nabrs. + * Separate this into 2 parts: discovery of remote Boxes which + * may be threaded, and discovery of local Boxes can not be. + * In either case we loop through the visible_west_nabrs and + * compare each to visible_east_nabrs, looking for overlaps. + * Then vice versa. Since each of these NeighborSets is + * ordered by processor owner first and we know each non-local + * processor we can construct each non-local message in a + * separate thread and then find and set all the local overlaps. + * + * To do this we first separate visible_west_nabrs into 2 groups + * non-local and local neighbors. Also do the same for + * visible_east_nabrs. + */ + bool ordered = true; + NeighborSet visible_local_west_nabrs(ordered); + NeighborSet visible_local_east_nabrs(ordered); + const Box this_proc_start(dim, GlobalId(LocalId::getZero(), rank)); + NeighborSet::iterator west_ni = + visible_west_nabrs.lowerBound(this_proc_start); + NeighborSet::iterator east_ni = + visible_east_nabrs.lowerBound(this_proc_start); + while (west_ni != visible_west_nabrs.end() && + west_ni->getOwnerRank() == rank) { + visible_local_west_nabrs.insert(*west_ni); + visible_west_nabrs.erase(west_ni++); + } + while (east_ni != visible_east_nabrs.end() && + east_ni->getOwnerRank() == rank) { + visible_local_east_nabrs.insert(*east_ni); + visible_east_nabrs.erase(east_ni++); + } - if (west_ni == visible_west_nabrs.end() && - (!compute_reverse || east_ni == visible_east_nabrs.end())) { - /* - * There are no visible Boxes owned by rank higher than - * local process. So loop from the beginning. - */ - west_ni = visible_west_nabrs.begin(); - east_ni = visible_east_nabrs.begin(); + // Discover all non-local overlaps. + int i = 0; + int imax = static_cast(outgoing_ranks.size()); + std::vector another_outgoing_ranks(outgoing_ranks.size()); + for (std::set::const_iterator outgoing_ranks_itr(outgoing_ranks.begin()); + outgoing_ranks_itr != outgoing_ranks.end(); ++outgoing_ranks_itr) { + another_outgoing_ranks[i++] = *outgoing_ranks_itr; + } +#ifdef HAVE_OPENMP +#pragma omp parallel private(i) num_threads(4) + { +#pragma omp for schedule(dynamic) nowait +#endif + for (i = 0; i < imax; ++i) { + BoxId outgoing_proc_start_id( + LocalId::getZero(), + another_outgoing_ranks[i]); + Box outgoing_proc_start(dim, outgoing_proc_start_id); + NeighborSet::const_iterator thread_west_ni = + visible_west_nabrs.lowerBound(outgoing_proc_start); + NeighborSet::const_iterator thread_east_ni = + visible_east_nabrs.lowerBound(outgoing_proc_start); + privateBridge_discover( + send_mesgs[another_outgoing_ranks[i]], + west_to_east, + east_to_west, + visible_west_nabrs, + visible_east_nabrs, + thread_west_ni, + thread_east_ni, + another_outgoing_ranks[i], + east_rbbt, + west_rbbt, + dim, + compute_transpose, + rank); + } +#ifdef HAVE_OPENMP +} +#endif + + /* + * Send all non-local overlap messages. + * As an optimization, send to the next higher ranked process first followed + * by successively higher processes and finally looping around to process + * 0 through the next lower ranked process. This spreads out the sends more + * evenly and prevents everyone from sending to the same processor (like + * process 0) at the same time. + */ + int num_outgoing_ranks = static_cast(outgoing_ranks.size()); + int num_incoming_ranks = static_cast(incoming_ranks.size()); + int num_comms = num_outgoing_ranks + num_incoming_ranks; + std::set::const_iterator outgoing_ranks_itr( + outgoing_ranks.lower_bound(rank + 1)); + if (outgoing_ranks_itr == outgoing_ranks.end()) { + outgoing_ranks_itr = outgoing_ranks.begin(); + } + int comm_offset = num_incoming_ranks; + for ( ; comm_offset < num_comms; ++comm_offset) { + if (all_comms[comm_offset].getPeerRank() == *outgoing_ranks_itr) { + break; + } + } + TBOX_ASSERT(num_outgoing_ranks == 0 || comm_offset < num_comms); + for (int outgoing_ranks_ctr = 0; + outgoing_ranks_ctr < num_outgoing_ranks; ++outgoing_ranks_ctr) { + std::vector& send_mesg = send_mesgs[*outgoing_ranks_itr]; + tbox::AsyncCommPeer& outgoing_comm = all_comms[comm_offset]; + outgoing_comm.beginSend( + &send_mesg[0], + static_cast(send_mesg.size())); + ++comm_offset; + ++outgoing_ranks_itr; + TBOX_ASSERT((outgoing_ranks_itr == outgoing_ranks.end()) == + (comm_offset == num_comms)); + if (outgoing_ranks_itr == outgoing_ranks.end()) { + outgoing_ranks_itr = outgoing_ranks.begin(); + } + if (comm_offset == num_comms) { + comm_offset = num_incoming_ranks; + } + if (s_print_steps == 'y') { + tbox::plog << "Sent to " << outgoing_comm.getPeerRank() << std::endl; } + } - /* - * Set send_comm_idx to reference the first outgoing rank in all_comms. - * It will be incremented to correpond to the rank whose overlaps - * are being searched for. - */ - int send_comm_idx = static_cast(incoming_ranks.size()); + // Discover all local overlaps and store them in the Connector(s). + NeighborSet::const_iterator west_local_ni = + visible_local_west_nabrs.lowerBound(this_proc_start); + NeighborSet::const_iterator east_local_ni = + visible_local_east_nabrs.lowerBound(this_proc_start); + privateBridge_discover( + send_mesgs[rank], + west_to_east, + east_to_west, + visible_local_west_nabrs, + visible_local_east_nabrs, + west_local_ni, + east_local_ni, + rank, + east_rbbt, + west_rbbt, + dim, + compute_transpose, + rank); + + d_object_timers->t_bridge_discover_and_send->stop(); +} +/* + *********************************************************************** + *********************************************************************** + */ +void +OverlapConnectorAlgorithm::privateBridge_discover( + std::vector& send_mesg, + Connector& west_to_east, + Connector* east_to_west, + const NeighborSet& visible_west_nabrs, + const NeighborSet& visible_east_nabrs, + NeighborSet::const_iterator& west_ni, + NeighborSet::const_iterator& east_ni, + int curr_owner, + const BoxContainer& east_rbbt, + const BoxContainer& west_rbbt, + const tbox::Dimension& dim, + bool compute_transpose, + int rank) const +{ #ifdef DEBUG_CHECK_ASSERTIONS - // Owners that we have sent messages to. Used for debugging. - std::set owners_sent_to; + // Owners that we have sent messages to. Used for debugging. + std::set owners_sent_to; #endif - /* - * Loop until all visible neighbors have their neighbors - * searched for. But only do this for the east Boxes if - * we are actively seeking neighbor data for them. - */ - while ((west_ni != visible_west_nabrs.end()) || - (compute_reverse && east_ni != visible_east_nabrs.end())) { + TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); - /* - * curr_owner is the owner whose neighbors is currently - * being searched for. It should be the owner of the - * next west or east Box in our cyclic-type looping. - */ - int curr_owner = nproc; // Start with invalid value. - if (west_ni != visible_west_nabrs.end() && - curr_owner > west_ni->getOwnerRank()) { - curr_owner = west_ni->getOwnerRank(); - } - if (compute_reverse) { - if (east_ni != visible_east_nabrs.end() && - curr_owner > east_ni->getOwnerRank()) { - curr_owner = east_ni->getOwnerRank(); - } - } - if (s_print_steps == 'y') { - tbox::plog << "cur_owner set to " << curr_owner << std::endl; - } + /* + * Set up send_message to contain info discovered + * locally but needed by curr_owner. + * + * Content of send_mesg: + * - neighbor-removal section cached in send_mesg. + * - offset to the reference section (see below) + * - number of west boxes for which neighbors are found + * - number of east boxes for which neighbors are found + * - id of west/east box + * - number of neighbors found for west/east box. + * - BoxId of neighbors found. + * Boxes of these found neighbors are given in the + * reference section of the message. + * - reference section: all the Boxes referenced as + * neighbors (accumulated in referenced_west_nabrs + * and referenced_east_nabrs). + * - number of referenced west neighbors + * - number of referenced east neighbors + * - referenced west neighbors + * - referenced east neighbors + * + * The purpose of factoring out info on the neighbors referenced + * is to reduce redundant data that can eat up lots of memory + * and message passing bandwidth when there are lots of Boxes + * with the same neighbors. + */ - TBOX_ASSERT(curr_owner < nproc); - TBOX_ASSERT(curr_owner > -1); - TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); + /* + * The first section of the send_mesg is the remote neighbor-removal + * section (computed above). + */ + if (curr_owner != rank && send_mesg.empty()) { + // No neighbor-removal data found for curr_owner. + send_mesg.insert(send_mesg.end(), 0); + } - /* - * Set up send_message to contain info discovered - * locally but needed by curr_owner. - * - * Content of send_mesg: - * - neighbor-removal section cached in neighbor_removal_mesg. - * - offset to the reference section (see below) - * - number of west mapped_boxes for which neighbors are found - * - number of east mapped_boxes for which neighbors are found - * - id of west/east mapped_box - * - number of neighbors found for west/east mapped_box. - * - BoxId of neighbors found. - * Boxes of these found neighbors are given in the - * reference section of the message. - * - reference section: all the Boxes referenced as - * neighbors (accumulated in referenced_west_nabrs - * and referenced_east_nabrs). - * - number of referenced west neighbors - * - number of referenced east neighbors - * - referenced west neighbors - * - referenced east neighbors - * - * The purpose of factoring out info on the neighbors referenced - * is to reduce redundant data that can eat up lots of memory - * and message passing bandwidth when there are lots of Boxes - * with the same neighbors. - */ - std::vector send_mesg; + // Indices of certain positions in send_mesg. + const int idx_offset_to_ref = static_cast(send_mesg.size()); + const int idx_num_west_boxes = idx_offset_to_ref + 1; + const int idx_num_east_boxes = idx_offset_to_ref + 2; + send_mesg.insert(send_mesg.end(), 3, 0); - /* - * The first section of the send_mesg is the remote neighbor-removal - * section (computed above). - */ - if (curr_owner != rank) { - // swap( send_mesg, neighbor_removal_mesg[curr_owner] ); - // We could use swap, but assign instead to leave data for debugging. - send_mesg = neighbor_removal_mesg[curr_owner]; - if (send_mesg.empty()) { - // No neighbor-removal data found for curr_owner. - send_mesg.insert(send_mesg.end(), 0); - } - } + // Boxes referenced in the message, used when adding ref section. + BoxContainer referenced_west_nabrs; + BoxContainer referenced_east_nabrs; - // Indices of certain positions in send_mesg. - const int idx_offset_to_ref = static_cast(send_mesg.size()); - const int idx_num_west_mapped_boxes = idx_offset_to_ref + 1; - const int idx_num_east_mapped_boxes = idx_offset_to_ref + 2; - send_mesg.insert(send_mesg.end(), 3, 0); + if (s_print_steps == 'y') { + tbox::plog << "Finding west --> east overlaps for owner " + << curr_owner << std::endl; + } - // Mapped_boxes referenced in the message, used when adding ref section. - BoxContainer referenced_west_nabrs; - BoxContainer referenced_east_nabrs; + // Find neighbors for all west boxes owned by curr_owner. + privateBridge_findOverlapsForOneProcess( + curr_owner, + visible_west_nabrs, + west_ni, + send_mesg, + idx_num_west_boxes, + west_to_east, + referenced_east_nabrs, + east_rbbt); - t_bridge_discover_find_overlaps->start(); + // Find neighbors for all east boxes owned by curr_owner. + if (compute_transpose) { + if (s_print_steps == 'y') { + tbox::plog << "Finding west <-- east overlaps for owner " + << curr_owner << std::endl; + } + privateBridge_findOverlapsForOneProcess( + curr_owner, + visible_east_nabrs, + east_ni, + send_mesg, + idx_num_east_boxes, + *east_to_west, + referenced_west_nabrs, + west_rbbt); + } - if (s_print_steps == 'y') { - tbox::plog << "Finding west --> east overlaps for owner " - << curr_owner << std::endl; - } + if (curr_owner != rank) { + /* + * If this discovery is off processor then the send message must be + * filled with the referenced neighbors. + */ - // Find neighbors for all west mapped_boxes owned by curr_owner. - privateBridge_findOverlapsForOneProcess( - curr_owner, - visible_west_nabrs, - west_ni, - send_mesg, - idx_num_west_mapped_boxes, - west_to_east, - referenced_east_nabrs, - east_rbbt); - - // Find neighbors for all east mapped_boxes owned by curr_owner. - if (compute_reverse) { - if (s_print_steps == 'y') { - tbox::plog << "Finding west <-- east overlaps for owner " - << curr_owner << std::endl; - } - privateBridge_findOverlapsForOneProcess( - curr_owner, - visible_east_nabrs, - east_ni, - send_mesg, - idx_num_east_mapped_boxes, - *east_to_west, - referenced_west_nabrs, - west_rbbt); - } + packReferencedNeighbors( + send_mesg, + idx_offset_to_ref, + referenced_east_nabrs, + referenced_west_nabrs, + dim, + s_print_steps == 'y'); - t_bridge_discover_find_overlaps->stop(); - - if (curr_owner != rank) { - /* - * Send discoveries to the curr_owner. - */ - - t_bridge_discover->stop(); - t_bridge_share->start(); - - /* - * Find the communication object by increasing send_comm_idx - * (cyclically) until it corresponds to curr_owner. - */ - while (all_comms[send_comm_idx].getPeerRank() != curr_owner) { - ++send_comm_idx; - if (send_comm_idx == static_cast(incoming_ranks.size() + - outgoing_ranks.size())) { - send_comm_idx -= static_cast(outgoing_ranks.size()); - } - } - tbox::AsyncCommPeer& outgoing_comm = all_comms[send_comm_idx]; - TBOX_ASSERT(outgoing_comm.getPeerRank() == curr_owner); - - sendDiscoveryToOneProcess( - send_mesg, - idx_offset_to_ref, - referenced_east_nabrs, - referenced_west_nabrs, - outgoing_comm, - dim); - - TBOX_ASSERT(owners_sent_to.find(curr_owner) == owners_sent_to.end()); #ifdef DEBUG_CHECK_ASSERTIONS - owners_sent_to.insert(curr_owner); + owners_sent_to.insert(curr_owner); #endif - t_bridge_share->stop(); - t_bridge_discover->start(); - - } // Block to send discoveries to curr_owner. - - /* - * If we come to the end of visible Boxes, go back and - * work on the Boxes owned by processors with lower rank - * than the local rank. (This is part of the optimization - * to reduce communication time.) - */ - if (west_ni == visible_west_nabrs.end() && - (!compute_reverse || east_ni == visible_east_nabrs.end())) { - /* - * There are no Boxes that owned by rank higher than - * local process and that we still need to find neighbors - * for. So loop from the beginning. - */ - west_ni = visible_west_nabrs.begin(); - east_ni = visible_east_nabrs.begin(); - } - - } // Loop through visible neighbors. - - t_bridge_discover->stop(); - - } + } // Block to send discoveries to curr_owner. } /* @@ -1608,14 +1731,14 @@ OverlapConnectorAlgorithm::privateBridge_discoverAndSend( * Find overlaps from visible_base_nabrs to head_rbbt. Find only * overlaps for Boxes owned by owner_rank. * - * On input, base_ni points to the first Box in visible_base_nabrs + * On entry, base_ni points to the first Box in visible_base_nabrs * owned by owner_rank. Increment base_ni past those Boxes * processed and remove them from visible_base_nabrs. * * Save local and semilocal overlaps in bridging_connector. For * remote overlaps, pack in send_mesg, add head Box to * referenced_head_nabrs and increment - * send_mesg[remote_mapped_box_counter_index]. + * send_mesg[remote_box_counter_index]. * *********************************************************************** */ @@ -1623,15 +1746,19 @@ OverlapConnectorAlgorithm::privateBridge_discoverAndSend( void OverlapConnectorAlgorithm::privateBridge_findOverlapsForOneProcess( const int owner_rank, - NeighborSet& visible_base_nabrs, - NeighborSet::iterator& base_ni, + const NeighborSet& visible_base_nabrs, + NeighborSet::const_iterator& base_ni, std::vector& send_mesg, - const int remote_mapped_box_counter_index, + const int remote_box_counter_index, Connector& bridging_connector, NeighborSet& referenced_head_nabrs, const BoxContainer& head_rbbt) const { - const IntVector &head_refinement_ratio(bridging_connector.getHead().getRefinementRatio()); + const IntVector& head_refinement_ratio( + bridging_connector.getHead().getRefinementRatio()); + + const BaseGridGeometry& grid_geom = + *bridging_connector.getBase().getGridGeometry(); bool refine_base = false; bool coarsen_base = false; @@ -1650,81 +1777,103 @@ OverlapConnectorAlgorithm::privateBridge_findOverlapsForOneProcess( } #ifdef DEBUG_CHECK_ASSERTIONS else { - TBOX_ERROR("Can't coarsen in one dimension and refine in another"); + TBOX_ERROR("Can't coarsen in one direction and refine in another"); } #endif - //std::vector found_nabrs, scratch_found_nabrs; // Should be made a member to avoid repetitive alloc/dealloc. Reserve in privateBridge and used here. - BoxContainer found_nabrs, scratch_found_nabrs; // Should be made a member to avoid repetitive alloc/dealloc. Reserve in privateBridge and used here. + const PeriodicShiftCatalog& shift_catalog = + bridging_connector.getHead().getGridGeometry()->getPeriodicShiftCatalog(); + // Should be made a member to avoid repetitive alloc/dealloc. + // Reserve in privateBridge and used here. + BoxContainer found_nabrs, scratch_found_nabrs; while (base_ni != visible_base_nabrs.end() && base_ni->getOwnerRank() == owner_rank) { - const Box& base_mapped_box = *base_ni; - if (s_print_steps == 'y') { - tbox::plog << "Finding neighbors for non-periodic base_mapped_box " - << base_mapped_box << std::endl; + const Box& visible_base_nabrs_box = *base_ni; + if (d_print_steps) { + tbox::plog << "Finding neighbors for non-periodic visible_base_nabrs_box " + << visible_base_nabrs_box << std::endl; } - Box base_box = base_mapped_box; - base_box.grow(bridging_connector.getConnectorWidth()); - if (refine_base) { - base_box.refine(bridging_connector.getRatio()); - } - else if (coarsen_base) { - base_box.coarsen(bridging_connector.getRatio()); + BoxContainer grown_boxes; + if (grid_geom.getNumberBlocks() == 1 || grid_geom.hasIsotropicRatios()) { + Box base_box = visible_base_nabrs_box; + base_box.grow(bridging_connector.getConnectorWidth()); + if (refine_base) { + base_box.refine(bridging_connector.getRatio()); + } + else if (coarsen_base) { + base_box.coarsen(bridging_connector.getRatio()); + } + grown_boxes.pushBack(base_box); + } else { + BoxUtilities::growAndAdjustAcrossBlockBoundary( + grown_boxes, + visible_base_nabrs_box, + bridging_connector.getBase().getGridGeometry(), + bridging_connector.getBase().getRefinementRatio(), + bridging_connector.getRatio(), + bridging_connector.getConnectorWidth(), + refine_base, + coarsen_base); } + found_nabrs.clear(); - head_rbbt.findOverlapBoxes(found_nabrs, base_box, // base_box.getBlockId(), - head_refinement_ratio, - true /* include singularity block neighbors */ ); - if (s_print_steps == 'y') { + for (BoxContainer::iterator g_itr = grown_boxes.begin(); + g_itr != grown_boxes.end(); ++g_itr) { + + head_rbbt.findOverlapBoxes(found_nabrs, *g_itr, + head_refinement_ratio, + true /* include singularity block neighbors */ ); + } + if (d_print_steps) { tbox::plog << "Found " << found_nabrs.size() << " neighbors:"; found_nabrs.print(tbox::plog); //BoxContainerUtils::recursivePrintBoxVector(found_nabrs, tbox::plog, "\n "); tbox::plog << std::endl; } - if (!found_nabrs.isEmpty()) { - if (base_mapped_box.isPeriodicImage()) { + if (!found_nabrs.empty()) { + if (visible_base_nabrs_box.isPeriodicImage()) { privateBridge_unshiftOverlappingNeighbors( - base_mapped_box, + visible_base_nabrs_box, found_nabrs, scratch_found_nabrs, - bridging_connector.getHead().getRefinementRatio()); + bridging_connector.getHead().getRefinementRatio(), + shift_catalog); } if (owner_rank != bridging_connector.getMPI().getRank()) { // Pack up info for sending. - ++send_mesg[remote_mapped_box_counter_index]; - const int subsize = 3 + - BoxId::commBufferSize() * static_cast(found_nabrs.size()); + ++send_mesg[remote_box_counter_index]; + const int subsize = 3 + + BoxId::commBufferSize() * static_cast(found_nabrs.size()); send_mesg.insert(send_mesg.end(), subsize, -1); int* submesg = &send_mesg[send_mesg.size() - subsize]; - *(submesg++) = base_mapped_box.getLocalId().getValue(); - *(submesg++) = base_mapped_box.getBlockId().getBlockValue(); + *(submesg++) = visible_base_nabrs_box.getLocalId().getValue(); + *(submesg++) = static_cast( + visible_base_nabrs_box.getBlockId().getBlockValue()); *(submesg++) = static_cast(found_nabrs.size()); for (BoxContainer::const_iterator na = found_nabrs.begin(); na != found_nabrs.end(); ++na) { const Box& head_nabr = *na; referenced_head_nabrs.insert(head_nabr); - head_nabr.getId().putToIntBuffer(submesg); + head_nabr.getBoxId().putToIntBuffer(submesg); submesg += BoxId::commBufferSize(); } - } - else { + } else { // Save neighbor info locally. - BoxId unshifted_base_mapped_box_id; - if (!base_mapped_box.isPeriodicImage()) { - unshifted_base_mapped_box_id = base_mapped_box.getId(); - } - else { - unshifted_base_mapped_box_id.initialize( - base_mapped_box.getLocalId(), - base_mapped_box.getOwnerRank(), + BoxId unshifted_base_box_id; + if (!visible_base_nabrs_box.isPeriodicImage()) { + unshifted_base_box_id = visible_base_nabrs_box.getBoxId(); + } else { + unshifted_base_box_id.initialize( + visible_base_nabrs_box.getLocalId(), + visible_base_nabrs_box.getOwnerRank(), PeriodicId::zero()); } - // Add found neighbors for base_mapped_box. - if (!found_nabrs.isEmpty()) { + // Add found neighbors for visible_base_nabrs_box. + if (!found_nabrs.empty()) { Connector::NeighborhoodIterator base_box_itr = bridging_connector.makeEmptyLocalNeighborhood( - unshifted_base_mapped_box_id); + unshifted_base_box_id); for (BoxContainer::const_iterator na = found_nabrs.begin(); na != found_nabrs.end(); ++na) { bridging_connector.insertLocalNeighbor(*na, base_box_itr); @@ -1732,15 +1881,14 @@ OverlapConnectorAlgorithm::privateBridge_findOverlapsForOneProcess( } } } - if (s_print_steps == 'y') { + if (d_print_steps) { tbox::plog << "Erasing visible base nabr " << (*base_ni) << std::endl; } - visible_base_nabrs.erase(base_ni++); + ++base_ni; if (s_print_steps == 'y') { if (base_ni == visible_base_nabrs.end()) { tbox::plog << "Next base nabr: end" << std::endl; - } - else { + } else { tbox::plog << "Next base nabr: " << *base_ni << std::endl; } } @@ -1751,22 +1899,20 @@ OverlapConnectorAlgorithm::privateBridge_findOverlapsForOneProcess( /* *********************************************************************** * Shift neighbors by amount equal and opposite of a Box's shift so that - * they become neighbors of the unshifed mapped_box. If this results in a + * they become neighbors of the unshifed box. If this results in a * neighbor shift that is not in the shift catalog, discard the neighbor. *********************************************************************** */ void OverlapConnectorAlgorithm::privateBridge_unshiftOverlappingNeighbors( - const Box& mapped_box, + const Box& box, BoxContainer& neighbors, BoxContainer& scratch_space, - const IntVector& neighbor_refinement_ratio) const + const IntVector& neighbor_refinement_ratio, + const PeriodicShiftCatalog& shift_catalog) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(mapped_box, neighbor_refinement_ratio); - - const PeriodicShiftCatalog* shift_catalog = - PeriodicShiftCatalog::getCatalog(mapped_box.getDim()); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, neighbor_refinement_ratio); scratch_space.clear(); // scratch_space.reserve(neighbors.size()); @@ -1774,11 +1920,16 @@ OverlapConnectorAlgorithm::privateBridge_unshiftOverlappingNeighbors( na != neighbors.end(); ++na) { Box& nabr = *na; IntVector sum_shift = - shift_catalog->shiftNumberToShiftDistance(nabr.getPeriodicId()) - - shift_catalog->shiftNumberToShiftDistance(mapped_box.getPeriodicId()); - const PeriodicId new_shift_number = shift_catalog->shiftDistanceToShiftNumber(sum_shift); - if (new_shift_number.getPeriodicValue() != shift_catalog->getInvalidShiftNumber()) { - nabr.initialize(nabr, new_shift_number, neighbor_refinement_ratio); + shift_catalog.shiftNumberToShiftDistance(nabr.getPeriodicId()) + - shift_catalog.shiftNumberToShiftDistance(box.getPeriodicId()); + const PeriodicId new_shift_number = + shift_catalog.shiftDistanceToShiftNumber(sum_shift); + if (new_shift_number.getPeriodicValue() != + shift_catalog.getInvalidShiftNumber()) { + nabr.initialize(nabr, + new_shift_number, + neighbor_refinement_ratio, + shift_catalog); scratch_space.pushBack(nabr); } } @@ -1790,417 +1941,51 @@ OverlapConnectorAlgorithm::privateBridge_unshiftOverlappingNeighbors( /* *********************************************************************** - * Checking is done as follows: - * - Rebuild the overlap containers using findOverlaps(). - * Note that the rebuilt overlap set is complete. - * - Check the current overlap set against the rebuilt overlap set - * to find missing overlaps and extra overlaps. - * - * Currently, the rebuilt overlaps are rebuilt using findOverlaps(). - * Thus, it may be pointless to use this method as a check for that - * method. *********************************************************************** */ - void -OverlapConnectorAlgorithm::findOverlapErrors( - const Connector& connector, - Connector& missing, - Connector& extra, - bool ignore_self_overlap) const +OverlapConnectorAlgorithm::initializeCallback() { -#ifdef DEBUG_CHECK_ASSERTIONS - if (!connector.getBase().isInitialized() || - !connector.getHead().isInitialized()) { - TBOX_ERROR( - "OverlapConnectorAlgorithm::findOverlapErrors: Cannot check overlaps\n" - << "when base or head mapped_box_level is uninitialized."); - } -#endif - - /* - * Obtain a globalized version of the head for checking. - */ - const BoxLevel& head = connector.getHead().getGlobalizedVersion(); - -#ifdef DEBUG_CHECK_ASSERTIONS - /* - * Before checking on overlap errors, make sure the user gave a - * valid Connector. - * - * Each neighbor set should correspond to a base mapped box. - * - * Each referenced neighbor should exist in the head. - */ - size_t num_base_consistency_errors = connector.checkConsistencyWithBase(); - size_t num_head_consistency_errors = connector.checkConsistencyWithHead(); - if (num_base_consistency_errors > 0) { - tbox::perr - << "OverlapConnectorAlgorithm::findOverlapErrors: cannot check overlap errors\n" - << "for inconsistent base data.\n"; - } - if (num_head_consistency_errors > 0) { - tbox::perr - << "OverlapConnectorAlgorithm::findOverlapErrors: cannot check overlap errors\n" - << "for inconsistent head data.\n"; - } - if (num_base_consistency_errors || num_head_consistency_errors) { - TBOX_ERROR( - "OverlapConnectorAlgorithm::findOverlapErrors exiting due to\n" - << "inconsistent data.\n" - << "Base:\n" << connector.getBase().format("B->", 2) - << "Head:\n" << connector.getHead().format("H->", 2) - << "Connector:\n" << connector.format("C->", 3)); - } -#endif - - /* - * Rebuild the overlap Connector for checking. - */ - Connector rebuilt( - connector.getBase(), - connector.getHead(), - connector.getConnectorWidth()); - findOverlaps_rbbt(rebuilt, head, ignore_self_overlap); - - /* - * Check that the rebuilt overlaps match the existing overlaps. - * - * Currently, we use findOverlaps to rebuild the overlaps. - * Thus, it may be pointless to use this method - * as a check for that method. - */ - Connector::computeNeighborhoodDifferences( - extra, - connector, - rebuilt); - TBOX_ASSERT(&extra.getBase() == &connector.getBase()); - TBOX_ASSERT(&extra.getHead() == &connector.getHead()); - Connector::computeNeighborhoodDifferences( - missing, - rebuilt, - connector); - TBOX_ASSERT(&missing.getBase() == &connector.getBase()); - TBOX_ASSERT(&missing.getHead() == &connector.getHead()); + // Initialize timers with default prefix. + getAllTimers(s_default_timer_prefix, + s_static_timers[s_default_timer_prefix]); } /* - *********************************************************************** - *********************************************************************** + *************************************************************************** + * Release static timers. To be called by shutdown registry to make sure + * memory for timers does not leak. + *************************************************************************** */ void -OverlapConnectorAlgorithm::assertOverlapCorrectness( - const Connector& connector, - bool ignore_self_overlap, - bool assert_completeness, - bool ignore_periodic_images) const +OverlapConnectorAlgorithm::finalizeCallback() { -#ifdef DEBUG_CHECK_ASSERTIONS - if (!connector.getBase().isInitialized() || - !connector.getHead().isInitialized()) { - TBOX_ERROR( - "OverlapConnectorAlgorithm::findOverlapErrors: Cannot check overlaps\n" - << "when base or head mapped_box_level is uninitialized."); - - } -#endif - - int local_error_count = - checkOverlapCorrectness(connector, - ignore_self_overlap, - assert_completeness, - ignore_periodic_images); - - const tbox::SAMRAI_MPI& mpi(connector.getMPI()); - int max_error_count = local_error_count; - int rank_of_max = mpi.getRank(); - if (mpi.getSize() > 1) { - IntIntStruct send, recv; - send.rank = recv.rank = mpi.getRank(); - send.i = local_error_count; - mpi.Allreduce(&send, &recv, 1, MPI_2INT, MPI_MAXLOC); - max_error_count = recv.i; - rank_of_max = recv.rank; - } - if (max_error_count > 0) { - std::string dbgbord; - TBOX_ERROR( - "OverlapConnectorAlgorithm::assertOverlapCorrectness found missing and/or extra overlaps." - << "Error in connector, " << local_error_count - << " local errors, " - << max_error_count << " max errors on proc " << rank_of_max - << ":\n" - << connector.format(dbgbord, 2) - << "base mapped_box_level:\n" << connector.getBase().format(dbgbord, 2) - << "head mapped_box_level:\n" << connector.getHead().format(dbgbord, 2)); - } + s_static_timers.clear(); } /* *********************************************************************** - * Return number of missing and number of extra overlaps. *********************************************************************** */ - -int -OverlapConnectorAlgorithm::checkOverlapCorrectness( - const Connector& connector, - bool ignore_self_overlap, - bool assert_completeness, - bool ignore_periodic_images) const +void +OverlapConnectorAlgorithm::setTimerPrefix( + const std::string& timer_prefix) { -#ifdef DEBUG_CHECK_ASSERTIONS - if (!connector.getBase().isInitialized() || - !connector.getHead().isInitialized()) { - TBOX_ERROR( - "OverlapConnectorAlgorithm::findOverlapErrors: Cannot check overlaps when\n" - << "base or head mapped_box_level is uninitialized."); - - } -#endif - TBOX_ASSERT(!connector.hasPeriodicLocalNeighborhoodBaseBoxes()); - - Connector missing, extra; - findOverlapErrors(connector, missing, extra, ignore_self_overlap); - - if (!assert_completeness) { - // Disregard missing overlaps by resetting missing to empty. - missing.clearNeighborhoods(); - } else if (ignore_periodic_images) { - // Disregard missing overlaps if they are incident on a periodic box. - missing.removePeriodicLocalNeighbors(); - missing.eraseEmptyNeighborSets(); + std::string timer_prefix_used; + if (s_ignore_external_timer_prefix == 'y') { + timer_prefix_used = s_default_timer_prefix; + } else { + timer_prefix_used = timer_prefix; } - - const BoxId dummy_mapped_box_id; - - /* - * Report the errors found, ordered by the Box where the - * error appears. In order to do this, we have to loop through - * the neighborhoods of missing and extra at the same time. - */ - - Connector::ConstNeighborhoodIterator im = missing.begin(); - Connector::ConstNeighborhoodIterator ie = extra.begin(); - for (; im != missing.end() || ie != extra.end(); - /* incremented in loop */) { - - const BoxId& global_id_missing = - im == missing.end() ? dummy_mapped_box_id : *im; - const BoxId& global_id_extra = - ie == extra.end() ? dummy_mapped_box_id : *ie; - - if (im != missing.end() && ie != extra.end() && - *im == *ie) { - - /* - * im and ie are pointing at the same Box. Report the - * error for this Box. - */ - - const Box& mapped_box = *connector.getBase().getBoxStrict( - global_id_missing); - tbox::perr << "Found " << missing.numLocalNeighbors(*im) - << " missing and " - << extra.numLocalNeighbors(*ie) - << " extra overlaps for " - << mapped_box << std::endl; - Connector::ConstNeighborhoodIterator it = - connector.findLocal(global_id_missing); - if (it == connector.end()) { - tbox::perr << " Current Neighbors (no neighbor set)." << std::endl; - } else { - tbox::perr << " Current Neighbors (" - << connector.numLocalNeighbors(*it) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = connector.begin(it); - na != connector.end(it); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - { - tbox::perr << " Missing Neighbors (" - << missing.numLocalNeighbors(*im) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = missing.begin(im); - na != missing.end(im); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - { - tbox::perr << " Extra Neighbors (" - << extra.numLocalNeighbors(*ie) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = extra.begin(ie); - na != extra.end(ie); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - ++im; - ++ie; - - } else if ((ie == extra.end()) || - (im != missing.end() && *im < *ie)) { - - /* - * im goes before ie (or ie has reached the end). Report the - * errors for the Box at im. - */ - - const Box& mapped_box = *connector.getBase().getBoxStrict( - global_id_missing); - tbox::perr << "Found " << missing.numLocalNeighbors(*im) - << " missing overlaps for " << mapped_box << std::endl; - Connector::ConstNeighborhoodIterator it = - connector.findLocal(global_id_missing); - if (it == connector.end()) { - tbox::perr << " Current Neighbors (no neighbor set)." - << std::endl; - } else { - tbox::perr << " Current Neighbors (" - << connector.numLocalNeighbors(*it) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = connector.begin(it); - na != connector.end(it); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - { - tbox::perr << " Missing Neighbors (" - << missing.numLocalNeighbors(*im) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = missing.begin(im); - na != missing.end(im); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - ++im; - } else if ((im == missing.end()) || - (ie != extra.end() && *ie < *im)) { - - /* - * ie goes before im (or im has reached the end). Report the - * errors for the Box at ie. - */ - - const Box& mapped_box = *connector.getBase().getBoxStrict( - global_id_extra); - tbox::perr << "Found " << extra.numLocalNeighbors(*ie) - << " extra overlaps for " << mapped_box << std::endl; - Connector::ConstNeighborhoodIterator it = - connector.findLocal(global_id_extra); - if (it == connector.end()) { - tbox::perr << " Current Neighbors (no neighbor set)." << std::endl; - } else { - tbox::perr << " Current Neighbors (" - << connector.numLocalNeighbors(*it) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = connector.begin(it); - na != connector.end(it); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - { - tbox::perr << " Extra Neighbors (" - << extra.numLocalNeighbors(*ie) << "):" - << std::endl; - Box ghost_box = mapped_box; - ghost_box.grow(connector.getConnectorWidth()); - for (Connector::ConstNeighborIterator na = extra.begin(ie); - na != extra.end(ie); ++na) { - const Box& nabr = *na; - Box nabr_box = nabr; - if (connector.getHeadCoarserFlag()) { - nabr_box.refine(connector.getRatio()); - } else if (connector.getRatio() != 1) { - nabr_box.coarsen(connector.getRatio()); - } - Box ovlap = ghost_box * nabr_box; - tbox::perr << " " << nabr << '_' << nabr.numberCells() - << "\tov" << ovlap << '_' << ovlap.numberCells() - << std::endl; - } - } - ++ie; - } - + std::map::iterator ti( + s_static_timers.find(timer_prefix_used)); + if (ti == s_static_timers.end()) { + d_object_timers = &s_static_timers[timer_prefix_used]; + getAllTimers(timer_prefix_used, *d_object_timers); + } else { + d_object_timers = &(ti->second); } - - return missing.getLocalNumberOfNeighborSets() + - extra.getLocalNumberOfNeighborSets(); } /* @@ -2208,76 +1993,42 @@ OverlapConnectorAlgorithm::checkOverlapCorrectness( *********************************************************************** */ void -OverlapConnectorAlgorithm::initializeCallback() +OverlapConnectorAlgorithm::getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers) { - - if (s_print_steps == '\0') { - if (tbox::InputManager::inputDatabaseExists()) { - s_print_steps = 'n'; - boost::shared_ptr idb( - tbox::InputManager::getInputDatabase()); - if (idb->isDatabase("OverlapConnectorAlgorithm")) { - boost::shared_ptr ocu_db( - idb->getDatabase("OverlapConnectorAlgorithm")); - s_print_steps = ocu_db->getCharWithDefault("print_bridge_steps", - s_print_steps); - } - } - } - - t_find_overlaps_rbbt = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::findOverlaps_rbbt()"); - t_bridge = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::privateBridge()"); - t_bridge_setup_comm = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::setupCommunication()"); - t_bridge_remove_and_cache = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::privateBridge_removeAndCache()"); - t_bridge_discover = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::privateBridge()_discover"); - t_bridge_discover_get_neighbors = tbox::TimerManager::getManager()-> - getTimer( - "hier::OverlapConnectorAlgorithm::privateBridge()_discover_get_neighbors"); - t_bridge_discover_form_rbbt = tbox::TimerManager::getManager()-> + timers.t_find_overlaps_rbbt = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::findOverlaps_rbbt()"); + + timers.t_find_overlaps_assumed_partition = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::findOverlaps_assumedPartition()"); + timers.t_find_overlaps_assumed_partition_connect_to_ap = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::findOverlaps_assumedPartition()_connect_to_ap"); + timers.t_find_overlaps_assumed_partition_get_ap = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::findOverlaps_assumedPartition()_get_ap"); + timers.t_find_overlaps_assumed_partition_transpose = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::findOverlaps_assumedPartition()_transpose"); + + timers.t_bridge = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateBridge()"); + timers.t_bridge_setup_comm = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::setupCommunication()"); + timers.t_bridge_remove_and_cache = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateBridge_removeAndCache()"); + timers.t_bridge_discover_and_send = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateBridge()_discoverAndSend"); + timers.t_bridge_discover_get_neighbors = tbox::TimerManager::getManager()-> getTimer( - "hier::OverlapConnectorAlgorithm::privateBridge()_discover_form_rbbt"); - t_bridge_discover_find_overlaps = tbox::TimerManager::getManager()-> + timer_prefix + "::privateBridge()_discover_get_neighbors"); + timers.t_bridge_discover_form_rbbt = tbox::TimerManager::getManager()-> getTimer( - "hier::OverlapConnectorAlgorithm::privateBridge()_discover_find_overlaps"); - t_bridge_share = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::privateBridge()_share"); - t_bridge_receive_and_unpack = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::receiveAndUnpack"); - t_bridge_MPI_wait = tbox::TimerManager::getManager()-> - getTimer("hier::OverlapConnectorAlgorithm::privateBridge()_MPI_wait"); -} - -/* - *************************************************************************** - * Release static timers. To be called by shutdown registry to make sure - * memory for timers does not leak. - *************************************************************************** - */ - -void -OverlapConnectorAlgorithm::finalizeCallback() -{ - t_find_overlaps_rbbt.reset(); - t_bridge.reset(); - t_bridge_setup_comm.reset(); - t_bridge_remove_and_cache.reset(); - t_bridge_discover.reset(); - t_bridge_discover_get_neighbors.reset(); - t_bridge_discover_form_rbbt.reset(); - t_bridge_discover_find_overlaps.reset(); - t_bridge_share.reset(); - t_bridge_receive_and_unpack.reset(); - t_bridge_MPI_wait.reset(); - - if (s_class_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - s_class_mpi.freeCommunicator(); - } - + timer_prefix + "::privateBridge()_discover_form_rbbt"); + timers.t_bridge_share = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateBridge()_share"); + timers.t_bridge_receive_and_unpack = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::receiveAndUnpack"); + timers.t_bridge_MPI_wait = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::privateBridge()_MPI_wait"); } } @@ -2290,5 +2041,3 @@ OverlapConnectorAlgorithm::finalizeCallback() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.h index efe2cec0..b1d14c45 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/OverlapConnectorAlgorithm.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Algorithms for working with overlap Connectors. * ************************************************************************/ @@ -12,8 +12,10 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/BaseConnectorAlgorithm.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" #include +#include namespace SAMRAI { namespace hier { @@ -31,7 +33,7 @@ namespace hier { * OverlapConnectorAlgorithm objects create, check and operate on overlap * Connectors. */ -class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm +class OverlapConnectorAlgorithm:public BaseConnectorAlgorithm { public: @@ -45,6 +47,67 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm */ virtual ~OverlapConnectorAlgorithm(); + /*! + * @brief Read extra debugging flag from input database. + */ + void + getFromInput(); + + /*! + * @brief Create overlap Connector then discover and add overlaps from base + * to head to it. + * + * The Connector's neighbor information is modified. + * + * If the Connector's head is not GLOBALIZED, a copy is made and + * globalized. Once a globalized head is obtained, this method + * simply calls findOverlaps(const BoxLevel &globalized_head). + * + * @param[in,out] connector + * @param[in] base_box_level + * @param[in] head_box_level + * @param[in] base_width + * @param[in] parallel_state + * @param[in] ignore_self_overlap + */ + void + findOverlaps( + boost::shared_ptr& connector, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const BoxLevel::ParallelState parallel_state = BoxLevel::DISTRIBUTED, + const bool ignore_self_overlap = false) const; + + /*! + * @brief Create overlap Connector with its transpose then discover and add + * overlaps from base to head to it and overlaps from head to base to + * transpose. + * + * The Connector's neighbor information is modified. + * + * If the Connector's head is not GLOBALIZED, a copy is made and + * globalized. Once a globalized head is obtained, this method + * simply calls findOverlaps(const BoxLevel &globalized_head). + * + * @param[in,out] connector + * @param[in] base_box_level + * @param[in] head_box_level + * @param[in] base_width + * @param[in] transpose_base_width + * @param[in] parallel_state + * @param[in] ignore_self_overlap + */ + void + findOverlapsWithTranspose( + boost::shared_ptr& connector, + const BoxLevel& base_box_level, + const BoxLevel& head_box_level, + const IntVector& base_width, + const IntVector& transpose_base_width, + const BoxLevel::ParallelState parallel_state = BoxLevel::DISTRIBUTED, + const bool ignore_self_overlap = false) const; + /*! * @brief Discover and add overlaps from base to head for an * overlap Connector. @@ -82,6 +145,16 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm const BoxLevel& globalized_head, const bool ignore_self_overlap = false) const; + /* + * @brief Populate overlap relationships for the given Connector by + * using the assumed partition algorithm to find overlaps. + * + * For the assumed partition algorithm, see Allison Baker's paper. + */ + void + findOverlaps_assumedPartition( + Connector& connector) const; + /*! * @brief For a given Connector, get the subset of overlapping neighbors * defined by the given Connector width. @@ -96,15 +169,20 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * * @param[out] neighbors * @param[in] connector - * @param[in] mapped_box_id - * @param[in] connector_width + * @param[in] box_id + * @param[in] width + * + * @pre width <= connector.getConnectorWidth() + * @pre (connector.getParallelState() == BoxLevel::GLOBALIZED) || + * (box_id.getOwnerRank() == connector.getMPI().getRank()) + * @pre connector.getBase().hasBox(box_id) */ void extractNeighbors( Connector::NeighborSet& neighbors, const Connector& connector, - const BoxId& mapped_box_id, - const IntVector& connector_width) const; + const BoxId& box_id, + const IntVector& width) const; /*! * @brief Like extractNeighbors above except that it computes all @@ -112,13 +190,20 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * * @param[out] other * @param[in] connector - * @param[in] connector_width + * @param[in] width + * + * @pre width <= connector.getConnectorWidth() + * @pre for the box_id of each neighborhood base box in connector, + * (connector.getParallelState() == BoxLevel::GLOBALIZED) || + * (box_id.getOwnerRank() == connector.getMPI().getRank()) + * @pre for the box_id of each neighborhood base box in connector, + * connector.getBase().hasBox(box_id) */ void extractNeighbors( Connector& other, const Connector& connector, - const IntVector& connector_width) const; + const IntVector& width) const; /*! * @brief Compute the overlap Connectors between BoxLevels @@ -158,21 +243,17 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * refer to the west, and two refer to the east. The center, east * and west BoxLevels must be the same regardless of what * Connector is used to get them. For example, - * ¢er_to_west.getHead() == &west_to_center.getBase() must + * &west_to_center.getTranspose().getHead() == &west_to_center.getBase() must * be true. * - * - @c west_to_center and @c center_to_west must be mutual transposes. - * - * - @c east_to_center and @c center_to_east must be mutual transposes. - * * Postconditions: * * @li @c west and @c east, as referenced by the output Connectors - * are heads of @c center_to_west and @c center_to_east. + * are heads of west_to_center's transpose and @c center_to_east. * * @li Widths of the output Connectors will be either @c * center_to_east's width reduced by @c center_growth_to_nest_west - * or @c center_to_west's width reduced by @c + * or west_to_center's transpose's width reduced by @c * center_growth_to_nest_east, which ever is greater. Output * Connector widths are still limited by the @c * connector_width_limit argument. All comparisons are done after @@ -186,7 +267,7 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * * @li The bridge operation works in the degenerate case where @c * east and @c west are the same object. In that case, @c - * west_to_east and @c east_to_west should also be the same object. + * west_to_east and its transpose should also be the same object. * * @li Bridging finds as many overlaps as it can, given the inputs, * but can only guarantee that the output Connectors are complete @@ -210,11 +291,8 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * using BoxLevelConnectorUtils. * * @param[out] west_to_east - * @param[out] east_to_west * @param[in] west_to_center * @param[in] center_to_east - * @param[in] east_to_center - * @param[in] center_to_west * * @param center_growth_to_nest_west The amount by which the center * BoxLevel must grow to nest the west BoxLevel. @@ -226,29 +304,33 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * @param center_growth_to_nest_east The amount by which the center * BoxLevel must grow to nest the east BoxLevel. * Bridging guarantees completeness if the width of @b - * center_to_west exceeds this amount. If unknown, set to negative - * value if unknown so it won't be considered when computing the + * west_to_center's transpose exceeds this amount. If unknown, set to + * negative value if unknown so it won't be considered when computing the * output Connector widths. * * @param connector_width_limit specifies the maximum Connector * width to compute overlaps for. The connector_width should be in * the coarser of the east and west indices. If * connector_width_limit is negative, use the default - * connector_width, which is the larger of the center_to_west and - * center_to_east Connectors', coarsened into the coarser of east + * connector_width, which is the larger of the west_to_center's transpose + * and center_to_east Connectors', coarsened into the coarser of east * and west indices. + * + * @param compute_transpose true if west_to_east's transpose should be + * computed + * + * @pre west_to_cent.hasTranspose() + * @pre cent_to_east.hasTranspose() */ void bridgeWithNesting( - Connector& west_to_east, - Connector& east_to_west, + boost::shared_ptr& west_to_east, const Connector& west_to_center, const Connector& center_to_east, - const Connector& east_to_center, - const Connector& center_to_west, const IntVector& center_growth_to_nest_west, const IntVector& center_growth_to_nest_east, - const IntVector& connector_width_limit) const; + const IntVector& connector_width_limit, + bool compute_transpose) const; /*! * @brief A version of bridge without any guarantee of nesting. @@ -262,116 +344,92 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * index space, of course). * * @param[out] west_to_east - * @param[out] east_to_west * @param[in] west_to_center * @param[in] center_to_east - * @param[in] east_to_center - * @param[in] center_to_west * @param[in] connector_width_limit + * @param compute_transpose true if west_to_east's transpose should be + * computed * - * @see bridgeWithNesting( Connector& west_to_east, Connector& east_to_west, const Connector& west_to_center, const Connector& center_to_east, const Connector& east_to_center, const Connector& center_to_west, const IntVector& center_growth_to_nest_west, const IntVector& center_growth_to_nest_east, const IntVector& connector_width_limit) const; - */ - void - bridge( - Connector& west_to_east, - Connector& east_to_west, - const Connector& west_to_center, - const Connector& center_to_east, - const Connector& east_to_center, - const Connector& center_to_west, - const IntVector& connector_width_limit) const; - - /*! - * @brief A version of bridge without computing the reverse bridge. + * @pre west_to_cent.hasTranspose() + * @pre cent_to_east.hasTranspose() * - * @param[out] west_to_east - * @param[in] west_to_center - * @param[in] center_to_east - * @param[in] east_to_center - * @param[in] center_to_west - * @param[in] connector_width_limit - * - * @see bridge( Connector& west_to_east, Connector& east_to_west, const Connector& west_to_center, const Connector& center_to_east, const Connector& east_to_center, const Connector& center_to_west, const IntVector& connector_width_limit) const; + * @see bridgeWithNesting( Connector& west_to_east, const Connector& west_to_center, const Connector& center_to_east, const IntVector& center_growth_to_nest_west, const IntVector& center_growth_to_nest_east, const IntVector& connector_width_limit, bool compute_transpose) const; */ void bridge( - Connector& west_to_east, + boost::shared_ptr& west_to_east, const Connector& west_to_center, const Connector& center_to_east, - const Connector& east_to_center, - const Connector& center_to_west, - const IntVector& connector_width_limit) const; + const IntVector& connector_width_limit, + bool compute_transpose) const; /*! - * @brief A version of bridge without limiting the connector_width of the result. + * @brief A version of bridge without limiting the connector_width of the + * result. * * @param[out] west_to_east - * @param[out] east_to_west * @param[in] west_to_center * @param[in] center_to_east - * @param[in] east_to_center - * @param[in] center_to_west - * - * @see bridge( Connector& west_to_east, Connector& east_to_west, const Connector& west_to_center, const Connector& center_to_east, const Connector& east_to_center, const Connector& center_to_west, const IntVector& connector_width_limit) const; - */ - void - bridge( - Connector& west_to_east, - Connector& east_to_west, - const Connector& west_to_center, - const Connector& center_to_east, - const Connector& east_to_center, - const Connector& center_to_west) const; - - /*! - * @brief A version of bridge without computing the reverse bridge - * and without limiting the connector_width of the result. + * @param compute_transpose true if west_to_east's transpose should be + * computed * - * @param[out] west_to_east - * @param[in] west_to_center - * @param[in] center_to_east - * @param[in] east_to_center - * @param[in] center_to_west + * @pre west_to_cent.hasTranspose() + * @pre cent_to_east.hasTranspose() * - * @see bridge( Connector& west_to_east, Connector& east_to_west, const Connector& west_to_center, const Connector& center_to_east, const Connector& east_to_center, const Connector& center_to_west, const IntVector& connector_width_limit) const; + * @see bridge( Connector& west_to_east, const Connector& west_to_center, const Connector& center_to_east, const IntVector& connector_width_limit, bool compute_transpose) const; */ void bridge( - Connector& west_to_east, + boost::shared_ptr& west_to_east, const Connector& west_to_center, const Connector& center_to_east, - const Connector& east_to_center, - const Connector& center_to_west) const; + bool compute_transpose) const; /*! * @brief A version of bridge without any guarantee of nesting in which - * one pair of input connectors is modified to form the resulting bridge - * connectors. + * an input connector and its transpose are modified to form the resulting + * bridge connectors. * * The east and west BoxLevels are assumed * to nest in the center BoxLevel. If they do not, * the results are not guaranteed to be complete. * * The output Connector widths are the greater of the widths of @c - * center_to_east and @c center_to_west (converted into the proper + * center_to_east and west_to_center's transpose (converted into the proper * index space, of course). * * @param[in,out] west_to_center * @param[in] center_to_east - * @param[in] east_to_center - * @param[in,out] center_to_west * @param[in] connector_width_limit * - * @see bridgeWithNesting( Connector& west_to_east, Connector& east_to_west, const Connector& west_to_center, const Connector& center_to_east, const Connector& east_to_center, const Connector& center_to_west, const IntVector& center_growth_to_nest_west, const IntVector& center_growth_to_nest_east, const IntVector& connector_width_limit) const; + * @pre west_to_cent.hasTranspose() + * @pre cent_to_east.hasTranspose() + * + * @see bridgeWithNesting( Connector& west_to_east, const Connector& west_to_center, const Connector& center_to_east, const IntVector& center_growth_to_nest_west, const IntVector& center_growth_to_nest_east, const IntVector& connector_width_limit, bool compute_transpose) const; */ void bridge( Connector& west_to_center, const Connector& center_to_east, - const Connector& east_to_center, - Connector& center_to_west, const IntVector& connector_width_limit) const; + /*! + * @brief Set whether to barrier before potential major + * communication. + * + * This developer feature makes sure all processes start major + * operations at the same time so that timers do not include the + * time waiting for slower processes to get to the starting point. + * + * @param[in] do_barrier + */ + void + setBarrierBeforeCommunication( + bool do_barrier) + { + d_barrier_before_communication = do_barrier; + } + /*! * @brief When @c do_check is true, turn on sanity checks for input * parameters. @@ -384,7 +442,10 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm */ void setSanityCheckMethodPreconditions( - bool do_check); + bool do_check) + { + d_sanity_check_method_preconditions = do_check; + } /*! * @brief When @c do_check is true, turn on sanity checks for outputs @@ -397,123 +458,75 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm */ void setSanityCheckMethodPostconditions( - bool do_check); + bool do_check) + { + d_sanity_check_method_postconditions = do_check; + } /*! - * Check that overlap data is correct (represents overlaps) for the - * given Connector. - * - * Checking is done as follows: - * - Find overlap errors using @c findOverlapErrors(). - * - Report overlap errors to @c tbox::perr. - * - Return number of local errors. - * - * @note - * This is an expensive operation (it uses @b findOverlapErrors()) - * and should only be used for debugging. - * - * @see findOverlaps() - * - * @param[in] connector - * @param[in] ignore_self_overlap Ignore a mapped_box's overlap with itself - * @param[in] assert_completeness If false, ignore missing overlaps. This will - * still look for overlaps that should not be there. - * @param[in] ignore_periodic_images If true, do not require neighbors - * that are periodic images. - * - * @return Number of overlap errors found locally. + * @brief Set the SAMRAI_MPI to use. + * + * If set, communication will use the specified SAMRAI_MPI instead + * of the SAMRAI_MPI from BoxLevels. This protects communication + * operations from accidentally interacting with unrelated + * communications, but it limits operations to work only with + * metadata objects with comptatible (congruent) SAMRAI_MPI + * objects. + * + * If make_duplicate is true, the specified SAMRAI_MPI will be + * duplicated for exclusise use. The duplicate will be freed upon + * object destruction. */ - int - checkOverlapCorrectness( - const Connector& connector, - bool ignore_self_overlap = false, - bool assert_completeness = true, - bool ignore_periodic_images = false) const; + void + setSAMRAI_MPI( + const tbox::SAMRAI_MPI& mpi, + bool make_duplicate = true); /*! - * @brief Assert overlap correctness. - * - * @par Assertions - * if an error is found, the method will write out diagnostic information - * and throw an an error on all processes. + * @brief When @c print_steps is true, print what the code is + * doing. * - * This is an expensive check. - * - * @see checkOverlapCorrectness(). + * @note Step printing may be expensive and and is meant mainly for + * debugging. * - * @param[in] connector - * @param[in] ignore_self_overlap - * @param[in] assert_completeness - * @param[in] ignore_periodic_images + * @param[in] print_steps */ void - assertOverlapCorrectness( - const Connector& connector, - bool ignore_self_overlap = false, - bool assert_completeness = true, - bool ignore_periodic_images = false) const; + setPrintSteps( + bool print_steps) + { + d_print_steps = print_steps; + } /*! - * @brief Find errors in overlap data of an overlap Connector. - * - * An error is either a missing overlap or an extra overlap. - * - * This is an expensive operation and should only be used for - * debugging. - * - * @par Assertions - * This version throws an assertion only if it finds inconsistent - * Connector data. Missing and extra overlaps are returned but do - * not cause an assertion. - * - * @param[in] connector - * @param[out] missing - * @param[out] extra - * @param[in] ignore_self_overlap + * @brief Setup names of timers. + * + * By default, timers are named + * "hier::OverlapConnectorAlgorithm::*", where the third field is + * the specific steps performed by the MappingConnectorAlgorithm. + * You can override the first two fields with this method. + * Conforming to the timer naming convention, timer_prefix should + * have the form "*::*". */ void - findOverlapErrors( - const Connector& connector, - Connector& missing, - Connector& extra, - bool ignore_self_overlap = false) const; + setTimerPrefix( + const std::string& timer_prefix); + + /*! + * @brief Get the name of this object. + */ + const std::string + getObjectName() const + { + return "OverlapConnectorAlgorithm"; + } private: // Internal shorthand. typedef Connector::NeighborSet NeighborSet; - //! @brief Data structure for MPI reductions. - struct IntIntStruct { int i; - int rank; - }; - - /*! - * @brief This is where the bridge algorithm is implemented. - * All public bridge interfaces which do not perform an "in place" bridge - * call this method underneath. - * - * @param west_nesting_is_known Whether we know how west nests in - * center. - * - * @param cent_growth_to_nest_west Amount center BoxLevel has - * to grow to nest west BoxLevel (if known). - * - * @param east_nesting_is_known Whether we know how east nests in - * center. - * - * @param cent_growth_to_nest_east Amount center BoxLevel has - * to grow to nest east BoxLevel (if known). - * - * @param connector_width_limit specifies the maximum Connector - * width to compute overlaps for (negative if unlimited). If - * connector_width_limit is negative, do not apply any limit. The - * connector_width should be in the coarser of the east and west - * indices. - */ void - privateBridge( - Connector& west_to_east, - Connector* east_to_west, + privateBridge_prologue( const Connector& west_to_cent, const Connector& cent_to_east, const Connector& east_to_cent, @@ -522,42 +535,46 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm const IntVector& cent_growth_to_nest_west, bool east_nesting_is_known, const IntVector& cent_growth_to_nest_east, - const IntVector& connector_width_limit) const; + const IntVector& connector_width_limit, + bool compute_transpose, + IntVector& west_to_east_width, + IntVector& east_to_west_width, + std::set& incoming_ranks, + std::set& outgoing_ranks, + NeighborSet& visible_west_nabrs, + NeighborSet& visible_east_nabrs) const; /*! * @brief This is where the bridge algorithm is implemented. - * All public bridge interfaces which perform an "in place" bridge call - * this method underneath. + * All public bridge interfaces which do not perform an "in place" bridge + * call this method underneath. * - * @param west_nesting_is_known Whether we know how west nests in - * center. + * @param west_to_east * - * @param cent_growth_to_nest_west Amount center BoxLevel has - * to grow to nest west BoxLevel (if known). + * @param east_to_west * - * @param east_nesting_is_known Whether we know how east nests in - * center. + * @param cent_to_east * - * @param cent_growth_to_nest_east Amount center BoxLevel has - * to grow to nest east BoxLevel (if known). + * @param compute_transpose true if east_to_west should be computed * - * @param connector_width_limit specifies the maximum Connector - * width to compute overlaps for (negative if unlimited). If - * connector_width_limit is negative, do not apply any limit. The - * connector_width should be in the coarser of the east and west - * indices. + * @param incoming_ranks + * + * @param outgoing_ranks + * + * @param visible_west_nabrs + * + * @param visible_east_nabrs */ void privateBridge( - Connector& west_to_cent, + Connector& west_to_east, + Connector* east_to_west, const Connector& cent_to_east, - const Connector& east_to_cent, - Connector& cent_to_west, - bool west_nesting_is_known, - const IntVector& cent_growth_to_nest_west, - bool east_nesting_is_known, - const IntVector& cent_growth_to_nest_east, - const IntVector& connector_width_limit) const; + bool compute_transpose, + const std::set& incoming_ranks, + const std::set& outgoing_ranks, + NeighborSet& visible_west_nabrs, + NeighborSet& visible_east_nabrs) const; /* * @brief Perform checks on the arguments of bridge. @@ -574,27 +591,46 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm * outgoing information in message buffers. */ void - privateModify_removeAndCache( - std::map >& neighbor_removal_mesg, + privateBridge_removeAndCache( + std::map >& send_mesgs, Connector& overlap_connector, Connector* overlap_connector_transpose, const Connector& misc_connector) const; /*! - *@brief Find all relationships in the Connector(s) to be computed and send + * @brief Find all relationships in the Connector(s) to be computed and send * outgoing information. */ void privateBridge_discoverAndSend( - std::map > neighbor_removal_mesg, + std::map >& send_mesgs, Connector& west_to_east, Connector* east_to_west, - std::set& incoming_ranks, - std::set& outgoing_ranks, - tbox::AsyncCommPeer all_comms[], + const std::set& incoming_ranks, + const std::set& outgoing_ranks, + tbox::AsyncCommPeer* all_comms, NeighborSet& visible_west_nabrs, NeighborSet& visible_east_nabrs) const; + /*! + * @brief Find all relationships in the Connector(s) to be computed. + */ + void + privateBridge_discover( + std::vector& send_mesg, + Connector& west_to_east, + Connector* east_to_west, + const NeighborSet& visible_west_nabrs, + const NeighborSet& visible_east_nabrs, + NeighborSet::const_iterator& west_ni, + NeighborSet::const_iterator& east_ni, + int curr_owner, + const BoxContainer& east_rbbt, + const BoxContainer& west_rbbt, + const tbox::Dimension& dim, + bool compute_transpose, + int rank) const; + /*! * @brief Find overlap and save in bridging connector or pack * into send message, used in privateBridge(). @@ -602,50 +638,24 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm void privateBridge_findOverlapsForOneProcess( const int curr_owner, - NeighborSet& visible_base_nabrs, - NeighborSet::iterator& base_ni, + const NeighborSet& visible_base_nabrs, + NeighborSet::const_iterator& base_ni, std::vector& send_mesg, - const int remote_mapped_box_counter_index, + const int remote_box_counter_index, Connector& bridging_connector, NeighborSet& referenced_head_nabrs, const BoxContainer& head_rbbt) const; - //! @brief Utility used in privateBridge() + /*! + * @brief Utility used in privateBridge() + */ void privateBridge_unshiftOverlappingNeighbors( - const Box& mapped_box, + const Box& box, BoxContainer& neighbors, BoxContainer& scratch_space, - //std::vector& neighbors, - //std::vector& scratch_space, - const IntVector& neighbor_refinement_ratio) const; - - /*! - * @brief Discover and add overlaps from base and externally - * provided head mapped_box_level. - * - * Relationships found are added to appropriate neighbor lists. No overlap is - * removed. If existing overlaps are invalid, remove them first. - * - * The provided head should be like d_head, but if necessary, - * it may be a globalized version of d_head. It should have - * the same refinement ratio as d_head. - * - * The ignore_self_overlap directs the method to not list - * a mapped_box as its own neighbor. This should be true only - * when the head and tail objects represent the same mapped_box_level - * (regardless of whether they are the same objects), and - * you want to disregard self-overlaps. - * Two mapped_boxes are considered the same if - * - The mapped_boxes are equal by comparison (they have the same - * owner and the same indices), and - * - They are from mapped_box_levels with the same refinement ratio. - */ - void - findOverlaps_rbbt( - Connector& connector, - const BoxLevel& head, - const bool ignore_self_overlap = false) const; + const IntVector& neighbor_refinement_ratio, + const PeriodicShiftCatalog& shift_catalog) const; /*! * @brief Set up things for the entire class. @@ -663,17 +673,14 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm static void finalizeCallback(); - /*! - * @brief Private communicator object shared by all objects in class, - * protecting internal communication from mixing with external. - * - * For communication, we usually use the SAMRAI_MPI of the - * Connectors, and this object is mainly for debugging. If we - * suspect interference from unrelated communication calls, we - * resort to this exclusive SAMRAI_MPI object to rule out that - * possibility. - */ - static tbox::SAMRAI_MPI s_class_mpi; + //! @brief SAMRAI_MPI for internal communications. + tbox::SAMRAI_MPI d_mpi; + + //! @brief Whether d_mpi was duplicated for exclusive use. + bool d_mpi_is_exclusive; + + // Extra checks independent of optimization/debug. + static char s_print_steps; /*! * @brief Tag to use (and increment) at begining of operations that @@ -685,19 +692,66 @@ class OverlapConnectorAlgorithm : public BaseConnectorAlgorithm */ static int s_operation_mpi_tag; - static boost::shared_ptr t_find_overlaps_rbbt; - static boost::shared_ptr t_bridge; - static boost::shared_ptr t_bridge_setup_comm; - static boost::shared_ptr t_bridge_remove_and_cache; - static boost::shared_ptr t_bridge_discover; - static boost::shared_ptr t_bridge_discover_get_neighbors; - static boost::shared_ptr t_bridge_discover_form_rbbt; - static boost::shared_ptr t_bridge_discover_find_overlaps; - static boost::shared_ptr t_bridge_share; - static boost::shared_ptr t_bridge_receive_and_unpack; - static boost::shared_ptr t_bridge_MPI_wait; + //@{ + //! @name Timer data for this class. + + /* + * @brief Structure of timers used by this class. + * + * Each object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_find_overlaps_rbbt; + boost::shared_ptr t_find_overlaps_assumed_partition; + boost::shared_ptr t_find_overlaps_assumed_partition_get_ap; + boost::shared_ptr t_find_overlaps_assumed_partition_connect_to_ap; + boost::shared_ptr t_find_overlaps_assumed_partition_transpose; + + boost::shared_ptr t_bridge; + boost::shared_ptr t_bridge_setup_comm; + boost::shared_ptr t_bridge_remove_and_cache; + boost::shared_ptr t_bridge_discover_and_send; + boost::shared_ptr t_bridge_discover_get_neighbors; + boost::shared_ptr t_bridge_discover_form_rbbt; + boost::shared_ptr t_bridge_share; + boost::shared_ptr t_bridge_receive_and_unpack; + boost::shared_ptr t_bridge_MPI_wait; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + static char s_ignore_external_timer_prefix; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + /*! + * @brief Get all the timers defined in TimerStruct. The timers + * are named with the given prefix. + */ + static void + getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers); + + //@} + bool d_print_steps; + bool d_barrier_before_communication; bool d_sanity_check_method_preconditions; bool d_sanity_check_method_postconditions; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.C index 1053fe62..658012f5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.C @@ -3,15 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Patch container class for patch data objects * ************************************************************************/ - -#ifndef included_hier_Patch_C -#define included_hier_Patch_C - #include "SAMRAI/hier/Patch.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include #include @@ -30,15 +27,15 @@ const int Patch::HIER_PATCH_VERSION = 2; */ Patch::Patch( - const Box& mapped_box, + const Box& box, const boost::shared_ptr& descriptor): - d_mapped_box(mapped_box), + d_box(box), d_descriptor(descriptor), d_patch_data(d_descriptor->getMaxNumberRegisteredComponents()), d_patch_level_number(-1), d_patch_in_hierarchy(false) { - TBOX_ASSERT(mapped_box.getLocalId() >= 0); + TBOX_ASSERT(box.getLocalId() >= 0); } /* @@ -71,9 +68,9 @@ Patch::getSizeOfPatchData( size_t size = 0; const int max_set_component = components.getMaxIndex(); - for (int i = 0; i < max_set_component && components.isSet(i); i++) { + for (int i = 0; i < max_set_component && components.isSet(i); ++i) { size += d_descriptor->getPatchDataFactory(i)->getSizeOfMemory( - d_mapped_box); + d_box); } return size; @@ -96,8 +93,8 @@ Patch::allocatePatchData( TBOX_ASSERT((id >= 0) && (id < ncomponents)); - if (ncomponents > d_patch_data.getSize()) { - d_patch_data.resizeArray(ncomponents); + if (ncomponents > static_cast(d_patch_data.size())) { + d_patch_data.resize(ncomponents); } if (!checkAllocated(id)) { @@ -113,11 +110,11 @@ Patch::allocatePatchData( const double time) { const int ncomponents = d_descriptor->getMaxNumberRegisteredComponents(); - if (ncomponents > d_patch_data.getSize()) { - d_patch_data.resizeArray(ncomponents); + if (ncomponents > static_cast(d_patch_data.size())) { + d_patch_data.resize(ncomponents); } - for (int i = 0; i < ncomponents; i++) { + for (int i = 0; i < ncomponents; ++i) { if (components.isSet(i)) { if (!checkAllocated(i)) { d_patch_data[i] = @@ -140,8 +137,8 @@ void Patch::deallocatePatchData( const ComponentSelector& components) { - const int ncomponents = d_patch_data.getSize(); - for (int i = 0; i < ncomponents; i++) { + const int ncomponents = static_cast(d_patch_data.size()); + for (int i = 0; i < ncomponents; ++i) { if (components.isSet(i)) { d_patch_data[i].reset(); } @@ -161,8 +158,8 @@ Patch::setTime( const double timestamp, const ComponentSelector& components) { - const int ncomponents = d_patch_data.getSize(); - for (int i = 0; i < ncomponents; i++) { + const int ncomponents = static_cast(d_patch_data.size()); + for (int i = 0; i < ncomponents; ++i) { if (components.isSet(i) && d_patch_data[i]) { d_patch_data[i]->setTime(timestamp); } @@ -173,8 +170,8 @@ void Patch::setTime( const double timestamp) { - const int ncomponents = d_patch_data.getSize(); - for (int i = 0; i < ncomponents; i++) { + const int ncomponents = static_cast(d_patch_data.size()); + for (int i = 0; i < ncomponents; ++i) { if (d_patch_data[i]) { d_patch_data[i]->setTime(timestamp); } @@ -192,81 +189,78 @@ Patch::setTime( */ void -Patch::getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector) +Patch::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("HIER_PATCH_VERSION"); + int ver = restart_db->getInteger("HIER_PATCH_VERSION"); if (ver != HIER_PATCH_VERSION) { - TBOX_ERROR("Patch::getFromDatabase() error...\n" + TBOX_ERROR("Patch::getFromRestart() error...\n" << " Restart file version different than class version" << std::endl); } - Box box(database->getDatabaseBox("d_box")); - const LocalId patch_local_id(database->getInteger("d_patch_local_id")); - int patch_owner = database->getInteger("d_patch_owner"); - int block_id = database->getInteger("d_block_id"); + Box box(restart_db->getDatabaseBox("d_box")); + const LocalId patch_local_id(restart_db->getInteger("d_patch_local_id")); + int patch_owner = restart_db->getInteger("d_patch_owner"); + int block_id = restart_db->getInteger("d_block_id"); box.setBlockId(BlockId(block_id)); - d_mapped_box.initialize(box, + d_box.initialize(box, patch_local_id, patch_owner); - d_patch_level_number = database->getInteger("d_patch_level_number"); - d_patch_in_hierarchy = database->getBool("d_patch_in_hierarchy"); + d_patch_level_number = restart_db->getInteger("d_patch_level_number"); + d_patch_in_hierarchy = restart_db->getBool("d_patch_in_hierarchy"); - d_patch_data.resizeArray(d_descriptor->getMaxNumberRegisteredComponents()); + d_patch_data.resize(d_descriptor->getMaxNumberRegisteredComponents()); - int namelist_count = database->getInteger("patch_data_namelist_count"); - tbox::Array patch_data_namelist; + int namelist_count = restart_db->getInteger("patch_data_namelist_count"); + std::vector patch_data_namelist; if (namelist_count) { - patch_data_namelist = database->getStringArray("patch_data_namelist"); + patch_data_namelist = restart_db->getStringVector("patch_data_namelist"); } - ComponentSelector local_selector(component_selector); + PatchDataRestartManager* pdrm = PatchDataRestartManager::getManager(); + ComponentSelector patch_data_read; - for (int i = 0; i < patch_data_namelist.getSize(); i++) { - std::string patch_data_name; + for (int i = 0; i < static_cast(patch_data_namelist.size()); ++i) { + std::string& patch_data_name = patch_data_namelist[i]; int patch_data_index; - patch_data_name = patch_data_namelist[i]; - - if (!database->isDatabase(patch_data_name)) { - TBOX_ERROR("Patch::getFromDatabase() error...\n" + if (!restart_db->isDatabase(patch_data_name)) { + TBOX_ERROR("Patch::getFromRestart() error...\n" << " patch data" << patch_data_name - << " not found in database" << std::endl); + << " not found in restart database" << std::endl); } boost::shared_ptr patch_data_database( - database->getDatabase(patch_data_name)); + restart_db->getDatabase(patch_data_name)); patch_data_index = d_descriptor->mapNameToIndex(patch_data_name); if ((patch_data_index >= 0) && - (local_selector.isSet(patch_data_index))) { + (pdrm->isPatchDataRegisteredForRestart(patch_data_index))) { boost::shared_ptr patch_data_factory( d_descriptor->getPatchDataFactory(patch_data_index)); d_patch_data[patch_data_index] = patch_data_factory->allocate(*this); - d_patch_data[patch_data_index]->getFromDatabase(patch_data_database); - - local_selector.clrFlag(patch_data_index); + d_patch_data[patch_data_index]->getFromRestart(patch_data_database); + patch_data_read.setFlag(patch_data_index); } } - if (local_selector.any()) { - TBOX_WARNING("Patch::getFromDatabase() warning...\n" + if (!pdrm->registeredPatchDataMatches(patch_data_read)) { + TBOX_WARNING("Patch::getFromRestart() warning...\n" << " Some requested patch data components not " - << "found in database" << std::endl); + << "found in restart database" << std::endl); } } /* ************************************************************************* * - * Write out the class version number to database. Then, - * writes out data to database and have each patch_data item write - * itself out to the database. The following data - * members are written out: d_mapped_box, d_patch_number, + * Write out the class version number to restart database. Then, + * writes out data to restart database and have each patch_data item write + * itself out to the restart database. The following data + * members are written out: d_box, d_patch_number, * d_patch_level_number, * d_patch_in_hierarchy, d_patch_data[]. * The database key for all data members is identical to the @@ -275,54 +269,52 @@ Patch::getFromDatabase( * are stored by the patch descriptor. In addition a list of the * patch_data names ("patch_data_namelist") and the number of patch data * items saved ("namelist_count") are also written to the database. - * The patchdata_write_table determines which patchdata are written to + * The PatchDataRestartManager determines which patchdata are written to * the database. * ************************************************************************* */ void -Patch::putUnregisteredToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const +Patch::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); int i; - database->putInteger("HIER_PATCH_VERSION", HIER_PATCH_VERSION); - database->putDatabaseBox("d_box", d_mapped_box); - database->putInteger("d_patch_local_id", - d_mapped_box.getLocalId().getValue()); - database->putInteger("d_patch_owner", - d_mapped_box.getOwnerRank()); - database->putInteger("d_block_id", - d_mapped_box.getBlockId().getBlockValue()); - database->putInteger("d_patch_level_number", d_patch_level_number); - database->putBool("d_patch_in_hierarchy", d_patch_in_hierarchy); + restart_db->putInteger("HIER_PATCH_VERSION", HIER_PATCH_VERSION); + restart_db->putDatabaseBox("d_box", d_box); + restart_db->putInteger("d_patch_local_id", d_box.getLocalId().getValue()); + restart_db->putInteger("d_patch_owner", d_box.getOwnerRank()); + restart_db->putInteger("d_block_id", + static_cast(d_box.getBlockId().getBlockValue())); + restart_db->putInteger("d_patch_level_number", d_patch_level_number); + restart_db->putBool("d_patch_in_hierarchy", d_patch_in_hierarchy); int namelist_count = 0; - for (i = 0; i < d_patch_data.getSize(); i++) { - if (patchdata_write_table.isSet(i) && checkAllocated(i)) { - namelist_count++; + const PatchDataRestartManager* pdrm = PatchDataRestartManager::getManager(); + for (i = 0; i < static_cast(d_patch_data.size()); ++i) { + if (pdrm->isPatchDataRegisteredForRestart(i) && checkAllocated(i)) { + ++namelist_count; } } std::string patch_data_name; - tbox::Array patch_data_namelist(namelist_count); + std::vector patch_data_namelist(namelist_count); namelist_count = 0; - for (i = 0; i < d_patch_data.getSize(); i++) { - if (patchdata_write_table.isSet(i) && checkAllocated(i)) { + for (i = 0; i < static_cast(d_patch_data.size()); ++i) { + if (pdrm->isPatchDataRegisteredForRestart(i) && checkAllocated(i)) { patch_data_namelist[namelist_count++] = patch_data_name = d_descriptor->mapIndexToName(i); boost::shared_ptr patch_data_database( - database->putDatabase(patch_data_name)); - (d_patch_data[i])->putUnregisteredToDatabase(patch_data_database); + restart_db->putDatabase(patch_data_name)); + (d_patch_data[i])->putToRestart(patch_data_database); } } - database->putInteger("patch_data_namelist_count", namelist_count); + restart_db->putInteger("patch_data_namelist_count", namelist_count); if (namelist_count > 0) { - database->putStringArray("patch_data_namelist", patch_data_namelist); + restart_db->putStringVector("patch_data_namelist", patch_data_namelist); } } @@ -342,16 +334,16 @@ Patch::recursivePrint( { NULL_USE(depth); - const tbox::Dimension& dim(d_mapped_box.getDim()); + const tbox::Dimension& dim(d_box.getDim()); os << border - << d_mapped_box - << "\tdims: " << d_mapped_box.numberCells(0) + << d_box + << "\tdims: " << d_box.numberCells(0) ; - for (int i = 1; i < dim.getValue(); ++i) { - os << " X " << d_mapped_box.numberCells(i); + for (tbox::Dimension::dir_t i = 1; i < dim.getValue(); ++i) { + os << " X " << d_box.numberCells(i); } - os << "\tsize: " << d_mapped_box.size() + os << "\tsize: " << d_box.size() << "\n"; return 0; } @@ -361,16 +353,16 @@ operator << ( std::ostream& s, const Patch& patch) { - s << "Patch::mapped_box = " - << patch.d_mapped_box << std::endl << std::flush; + const int ncomponents = static_cast(patch.d_patch_data.size()); + s << "Patch::box = " + << patch.d_box << std::endl << std::flush; s << "Patch::patch_level_number = " << patch.d_patch_level_number << std::endl << std::flush; s << "Patch::patch_in_hierarchy = " << patch.d_patch_in_hierarchy << std::endl << std::flush; - s << "Patch::number_components = " << patch.d_patch_data.getSize() + s << "Patch::number_components = " << ncomponents << std::endl << std::flush; - const int ncomponents = patch.d_patch_data.getSize(); - for (int i = 0; i < ncomponents; i++) { + for (int i = 0; i < ncomponents; ++i) { s << "Component(" << i << ")="; if (!patch.d_patch_data[i]) { s << "NULL\n"; @@ -384,4 +376,3 @@ operator << ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.h index 8a95f2a5..d8d680a7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Patch.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Patch container class for patch data objects * ************************************************************************/ @@ -22,11 +22,11 @@ #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" +#include namespace SAMRAI { namespace hier { @@ -50,12 +50,11 @@ namespace hier { * patch data components that live on the patch. Individual components or sets * of components can be created or destroyed via patch member functions. * - * @see hier::Box - * @see hier::Box - * @see hier::PatchDescriptor - * @see hier::PatchData - * @see hier::PatchDataFactory - * @see hier::PatchGeometry + * @see Box + * @see PatchDescriptor + * @see PatchData + * @see PatchDataFactory + * @see PatchGeometry */ class Patch { @@ -66,11 +65,13 @@ class Patch * @note * Patch data components are not allocated/instantiated. * - * @param[in] mapped_box + * @param[in] box * @param[in] descriptor + * + * @pre box.getLocalId() >= 0 */ Patch( - const Box& mapped_box, + const Box& box, const boost::shared_ptr& descriptor); /*! @@ -90,7 +91,7 @@ class Patch const Box& getBox() const { - return d_mapped_box; + return d_box; } /*! @@ -105,7 +106,7 @@ class Patch const GlobalId& getGlobalId() const { - return d_mapped_box.getGlobalId(); + return d_box.getGlobalId(); } /*! @@ -119,7 +120,7 @@ class Patch const LocalId& getLocalId() const { - return d_mapped_box.getLocalId(); + return d_box.getLocalId(); } /*! @@ -148,12 +149,14 @@ class Patch * identifier. * * @param[in] id + * + * @pre (id >= 0) && (id < numPatchData()) */ boost::shared_ptr getPatchData( const int id) const { - TBOX_ASSERT((id >= 0) && (id < d_patch_data.getSize())); + TBOX_ASSERT((id >= 0) && (id < numPatchData())); return d_patch_data[id]; } @@ -171,16 +174,19 @@ class Patch * * @param[in] variable * @param[in] context + * + * @pre getDim() == variable->getDim() + * @pre (id >= 0) && (id < numPatchData()) */ boost::shared_ptr getPatchData( const boost::shared_ptr& variable, const boost::shared_ptr& context) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *variable); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *variable); int id = VariableDatabase::getDatabase()-> mapVariableAndContextToIndex(variable, context); - TBOX_ASSERT((id >= 0) && (id < d_patch_data.getSize())); + TBOX_ASSERT((id >= 0) && (id < numPatchData())); return d_patch_data[id]; } @@ -199,14 +205,17 @@ class Patch * * @param[in] id * @param[out] data + * + * @pre getDim() == data->getDim(); + * @pre (id >= 0) && (id < numPatchData()) */ void setPatchData( const int id, const boost::shared_ptr& data) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *data); - TBOX_ASSERT((id >= 0) && (id < d_patch_data.getSize())); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *data); + TBOX_ASSERT((id >= 0) && (id < numPatchData())); d_patch_data[id] = data; } @@ -221,7 +230,7 @@ class Patch checkAllocated( const int id) const { - return (id < d_patch_data.getSize()) && d_patch_data[id]; + return (id < numPatchData()) && d_patch_data[id]; } /*! @@ -235,8 +244,7 @@ class Patch getSizeOfPatchData( const int id) const { - return d_descriptor->getPatchDataFactory(id)->getSizeOfMemory( - d_mapped_box); + return getPatchDescriptor()->getPatchDataFactory(id)->getSizeOfMemory(d_box); } /*! @@ -259,6 +267,8 @@ class Patch * * @param[in] id * @param[in] time + * + * @pre (id >= 0) && (id < getPatchDescriptor()->getMaxNumberRegisteredComponents()) */ void allocatePatchData( @@ -286,14 +296,16 @@ class Patch * This component will need to be reallocated before its next use. * * @param[in] id + * + * @pre (id >= 0) && (id < getPatchDescriptor()->getMaxNumberRegisteredComponents()) */ void deallocatePatchData( const int id) { TBOX_ASSERT((id >= 0) && - (id < d_descriptor->getMaxNumberRegisteredComponents())); - if (id < d_patch_data.getSize()) { + (id < getPatchDescriptor()->getMaxNumberRegisteredComponents())); + if (id < numPatchData()) { d_patch_data[id].reset(); } } @@ -339,13 +351,16 @@ class Patch * * @param[in] timestamp * @param[in] id + * + * @pre (id >= 0) && (id < numPatchData()) + * @pre getPatchData(id) */ void setTime( const double timestamp, const int id) { - TBOX_ASSERT((id >= 0) && (id < d_patch_data.getSize())); + TBOX_ASSERT((id >= 0) && (id < numPatchData())); TBOX_ASSERT(d_patch_data[id]); d_patch_data[id]->setTime(timestamp); } @@ -437,47 +452,45 @@ class Patch } /*! - * @brief Get the patch data items from the database. + * @brief Get the patch data items from the restart database. * * Patch state is read in from the database and all patch - * data objects specified in the component_selector are created. + * data objects specified in the PatchDataRestartManager are created. * * The class version and restart file version must be equal. * * @par Assertions - * Checks that the database is a non-null boost::shared_ptr, - * that data retrieved from the database are of the type + * Checks that data retrieved from the database are of the type * expected, and that the patch_number read in from the database * matches the patch number assigned to this Patch. * @note - * A warning will be printed to the log file if - * some patch data components that were requested through the - * component_selector are not found in the database. + * A warning will be printed to the log file if some patch data components + * that were requested through the PatchDataRestartManager are not found in + * the database. * - * @param[in] database - * @param[in] component_selector + * @param[in] restart_db + * + * @pre restart_db */ void - getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector); + getFromRestart( + const boost::shared_ptr& restart_db); /*! - * @brief Write patch data and other patch information to the database. + * @brief Write patch data and other patch information to the restart + * database. * * Class version number and the state of the patch object are written. - * Patch data objects specified in the component selector are also written. - * @par Assertions - * Check that database is a non-null boost::shared_ptr. + * Patch data objects specified in the PatchDataRestartManager are also + * written. * - * @param[in] database - * @param[in] patchdata_write_table The ComponentSelector specifying the - * patch data components to write. + * @param[in] restart_db + * + * @pre restart_db */ void - putUnregisteredToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * @brief Print a patch (for debugging). @@ -504,7 +517,7 @@ class Patch const tbox::Dimension& getDim() const { - return d_mapped_box.getDim(); + return d_box.getDim(); } /*! @@ -518,6 +531,15 @@ class Patch std::ostream& s, const Patch& patch); + /*! + * @brief Number of PatchData objects defined on this Patch. + */ + int + numPatchData() const + { + return static_cast(d_patch_data.size()); + } + private: /* * Static integer constant describing class's version number. @@ -529,20 +551,20 @@ class Patch */ Patch( const Patch&); - void + Patch& operator = ( const Patch&); /* * The box defining the extent of this patch. */ - Box d_mapped_box; + Box d_box; boost::shared_ptr d_descriptor; boost::shared_ptr d_patch_geometry; - tbox::Array > d_patch_data; + std::vector > d_patch_data; int d_patch_level_number; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.C index 65e8ff5e..ba6067a8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.C @@ -3,32 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Describes boundaries for a patch * ************************************************************************/ - -#ifndef included_hier_PatchBoundaries_C -#define included_hier_PatchBoundaries_C - #include "SAMRAI/hier/PatchBoundaries.h" namespace SAMRAI { namespace hier { -/* - ************************************************************************* - * - * Default constructor - * - ************************************************************************* - */ -PatchBoundaries::PatchBoundaries(): - d_dim(tbox::Dimension::getInvalidDimension()), - d_array_of_bboxes(0) -{ -} - /* ************************************************************************* * @@ -62,5 +45,3 @@ PatchBoundaries::PatchBoundaries( } // SAMRAI namespace } // hier namespace - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.h index 062b9ce7..4ec071f8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchBoundaries.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Describes boundaries for a patch * ************************************************************************/ @@ -14,10 +14,10 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include +#include #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* @@ -34,7 +34,7 @@ namespace hier { * @brief Class PatchBoundaries is a container class for storing * BoundaryBox objects for a single patch. * - * @see hier::BoundaryBox + * @see BoundaryBox */ class PatchBoundaries @@ -61,75 +61,77 @@ class PatchBoundaries * * @param[in] r Patchboundaries object to be copied in assignment. */ - const PatchBoundaries& + PatchBoundaries& operator = ( const PatchBoundaries& r) { - for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + for (unsigned int d = 0; d < getDim().getValue(); ++d) { d_array_of_bboxes[d] = r.d_array_of_bboxes[d]; } return *this; } /*! - * @brief Array access operator. + * @brief Vector access operator. * - * @param[in] i Array index. + * @param[in] i Vector index. + * + * @pre i < getDim().getValue() */ - tbox::Array& + std::vector& operator [] ( unsigned int i) { - TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(i < getDim().getValue()); return d_array_of_bboxes[i]; } /*! - * @brief Const Array access operator. + * @brief Const Vector access operator. + * + * @param[in] i Vector index. * - * @param[in] i Array index. + * @pre i < getDim().getValue() */ - const tbox::Array& + const std::vector& operator [] ( unsigned int i) const { - TBOX_ASSERT(i < d_dim.getValue()); + TBOX_ASSERT(i < getDim().getValue()); return d_array_of_bboxes[i]; } /*! - * @brief Get copy of the internal arrays. + * @brief Get copy of the internal vectors. * - * @return Copy of the internal arrays. + * @return Copy of the internal vectors. */ - tbox::Array > - getArrays() + std::vector >& + getVectors() { return d_array_of_bboxes; } /*! - * @brief Get const copy of the internal arrays. + * @brief Get const copy of the internal vectors. * - * @return Const copy of the internal arrays. + * @return Const copy of the internal vectors. */ - const tbox::Array > - getArrays() const + const std::vector >& + getVectors() const { return d_array_of_bboxes; } - /*! - * @brief friend declaration - */ - friend class::std::map; + const tbox::Dimension& + getDim() const + { + return d_dim; + } private: - /*! - * @brief Private default constructor. - * - * This constructor is need by the brain dead STL and should not be used - * for any other purpose. + /* + * Unimplemented default constructor. */ PatchBoundaries(); @@ -141,7 +143,7 @@ class PatchBoundaries /* * @brief Internal arrays of BoundaryBox */ - tbox::Array > d_array_of_bboxes; + std::vector > d_array_of_bboxes; }; } // SAMRAI namespace diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.C index 7bdbc1fa..390e0775 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for patch data objects * ************************************************************************/ - -#ifndef included_hier_PatchData_C -#define included_hier_PatchData_C - #include "SAMRAI/hier/PatchData.h" namespace SAMRAI { @@ -26,7 +22,7 @@ PatchData::PatchData( d_ghosts(ghosts), d_timestamp(0.0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(domain, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(domain, ghosts); d_ghost_box.grow(ghosts); } @@ -38,59 +34,54 @@ PatchData::~PatchData() /* ************************************************************************* * - * Checks that clas and restart file version number are same. If so, - * reads in data members common to all patch data and then invoke - * getSpecializedFromDatabase() to read in data particular to the - * specific derived class. + * Checks that class and restart file version number are same. If so, + * reads in data members common to all patch data from restart database. * ************************************************************************* */ void -PatchData::getFromDatabase( - const boost::shared_ptr& database) +PatchData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("HIER_PATCH_DATA_VERSION"); + int ver = restart_db->getInteger("HIER_PATCH_DATA_VERSION"); if (ver != HIER_PATCH_DATA_VERSION) { - TBOX_ERROR("PatchData::getFromDatabase() error...\n" + TBOX_ERROR("PatchData::getFromRestart() error...\n" << " Restart file version different than class version" << std::endl); } - d_box = database->getDatabaseBox("d_box"); - d_ghost_box = database->getDatabaseBox("d_ghost_box"); - database->getIntegerArray("d_ghosts", &d_ghosts[0], d_ghosts.getDim().getValue()); - d_timestamp = database->getDouble("d_timestamp"); - - getSpecializedFromDatabase(database); + d_box = restart_db->getDatabaseBox("d_box"); + d_ghost_box = restart_db->getDatabaseBox("d_ghost_box"); + d_timestamp = restart_db->getDouble("d_timestamp"); + restart_db->getIntegerArray("d_ghosts", + &d_ghosts[0], + d_ghosts.getDim().getValue()); } /* ************************************************************************* * - * Write out data members common to all patch data and then invoke - * putSpecializedToDatabase() to write out data particular to the - * specific derived class. + * Write to restart database data members common to all patch data. * ************************************************************************* */ void -PatchData::putUnregisteredToDatabase( - const boost::shared_ptr& database) const +PatchData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); - - database->putInteger("HIER_PATCH_DATA_VERSION", HIER_PATCH_DATA_VERSION); - database->putDatabaseBox("d_box", d_box); - database->putDatabaseBox("d_ghost_box", d_ghost_box); - database->putDouble("d_timestamp", d_timestamp); - database->putIntegerArray("d_ghosts", &d_ghosts[0], d_ghosts.getDim().getValue()); - - putSpecializedToDatabase(database); + TBOX_ASSERT(restart_db); + + restart_db->putInteger("HIER_PATCH_DATA_VERSION", HIER_PATCH_DATA_VERSION); + restart_db->putDatabaseBox("d_box", d_box); + restart_db->putDatabaseBox("d_ghost_box", d_ghost_box); + restart_db->putDouble("d_timestamp", d_timestamp); + restart_db->putIntegerArray("d_ghosts", + &d_ghosts[0], + d_ghosts.getDim().getValue()); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.h index 94d08271..3c55268d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for patch data objects * ************************************************************************/ @@ -47,11 +47,11 @@ namespace hier { * on a particular processor. Patch data factories are guaranteed to * exist on all processors independent of the patch-to-processor mapping. * - * @see hier::BoxOverlap - * @see hier::BoxGeometry - * @see hier::Patch - * @see hier::PatchDataFactory - * @see hier::PatchDescriptor + * @see BoxOverlap + * @see BoxGeometry + * @see Patch + * @see PatchDataFactory + * @see PatchDescriptor */ class PatchData @@ -61,6 +61,8 @@ class PatchData * The constructor for a patch data object. Patch data objects will * manage the interior box over which they are defined and the associated * ghost cell width. + * + * @pre domain.getDim() == ghosts.getDim() */ PatchData( const Box& domain, @@ -190,7 +192,7 @@ class PatchData * will be allocated according to these values, and excess buffer * space will waste memory resources. */ - virtual int + virtual size_t getDataStreamSize( const BoxOverlap& overlap) const = 0; @@ -216,42 +218,27 @@ class PatchData /** * Checks that class version and restart file version are equal. If so, - * reads in the data members common to all patch data types from database. - * This method then calls the getSpecializedFromDatabase() method - * to retrieve the data special to the concrete patch data type. - */ - virtual void - getFromDatabase( - const boost::shared_ptr& database); - - /** - * Writes out the class version number to the database. Then, - * writes the data members common to all patch data types from database. - * After the common data is written to the database, the - * putSpecializedToDatabase() method is invoked. - */ - virtual void - putUnregisteredToDatabase( - const boost::shared_ptr& database) const; - - /** - * This pure abstract method is used by concrete patch data subclasses - * to retrieve from the database data special to the concrete class. + * reads in the data members common to all patch data types from restart + * database. + * + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database) = 0; + getFromRestart( + const boost::shared_ptr& restart_db); /** - * This pure abstract method is used by concrete patch data subclasses - * to put to the database data special to the concrete class. + * Writes out the class version number to the restart database. Then, + * writes the data members common to all patch data types to database. + * + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const = 0; + putToRestart( + const boost::shared_ptr& restart_db) const; /** - * Return the dimension of this object. + * @brief Return the dimension of this object. */ const tbox::Dimension& getDim() const @@ -269,12 +256,15 @@ class PatchData * * This function is included to treat some special cases for concrete * patch data types and should be used with caution. + * + * @pre getDim() == ghost_box.getDim() + * @pre (ghost_box * getBox()).isSpatiallyEqual(getBox()) */ void setGhostBox( const Box& ghost_box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, ghost_box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, ghost_box); TBOX_ASSERT((ghost_box * d_box).isSpatiallyEqual(d_box)); d_ghost_box = ghost_box; } @@ -287,7 +277,7 @@ class PatchData PatchData( const PatchData&); // not implemented - void + PatchData& operator = ( const PatchData&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.C index a93c9e38..15f3bbd1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory abstract base class for creating patch data objects * ************************************************************************/ - -#ifndef included_hier_PatchDataFactory_C -#define included_hier_PatchDataFactory_C - #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Utilities.h" @@ -36,9 +32,8 @@ PatchDataFactory::~PatchDataFactory() MultiblockDataTranslator * PatchDataFactory::getMultiblockDataTranslator() { - return (MultiblockDataTranslator *)NULL; + return 0; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.h index 4ac33027..110792c3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory abstract base class for creating patch data objects * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/PatchData.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace hier { @@ -61,9 +61,9 @@ class MultiblockDataTranslator; * processors independent of the mapping of patches to processors. Patch * data is guaranteed to exist only on those patches local to a processor. * - * @see hier::BoxGeometry - * @see hier::PatchData - * @see hier::PatchDescriptor + * @see BoxGeometry + * @see PatchData + * @see PatchDescriptor */ class PatchDataFactory @@ -74,6 +74,8 @@ class PatchDataFactory * * @param ghosts ghost cell width for concrete classes created from * the factory. + * + * @pre ghosts.min() >= 0 */ explicit PatchDataFactory( const IntVector& ghosts); @@ -193,7 +195,7 @@ class PatchDataFactory private: PatchDataFactory( const PatchDataFactory&); // not implemented - void + PatchDataFactory& operator = ( const PatchDataFactory&); // not implemented PatchDataFactory(); // not implemented, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.C new file mode 100644 index 00000000..0b4e8dd0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.C @@ -0,0 +1,78 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: An restart manager singleton class + * + ************************************************************************/ + +#include "SAMRAI/hier/PatchDataRestartManager.h" + +namespace SAMRAI { +namespace hier { + +PatchDataRestartManager * PatchDataRestartManager::s_manager_instance = 0; + +tbox::StartupShutdownManager::Handler +PatchDataRestartManager::s_shutdown_handler( + 0, + 0, + PatchDataRestartManager::shutdownCallback, + 0, + tbox::StartupShutdownManager::priorityRestartManager); + +/* + ************************************************************************* + * + * Basic singleton classes to create, set, and destroy the manager + * instance. + * + ************************************************************************* + */ + +PatchDataRestartManager * +PatchDataRestartManager::getManager() +{ + if (!s_manager_instance) { + s_manager_instance = new PatchDataRestartManager; + } + return s_manager_instance; +} + +void +PatchDataRestartManager::shutdownCallback() +{ + if (s_manager_instance) { + delete s_manager_instance; + s_manager_instance = 0; + } +} + +/* + ************************************************************************* + * + * The constructor and destructor are protected and call only be called + * by the singleton class or its subclasses. + * + ************************************************************************* + */ + +PatchDataRestartManager::PatchDataRestartManager() +{ +} + +/* + ************************************************************************* + * + * Destructor + * + ************************************************************************* + */ +PatchDataRestartManager::~PatchDataRestartManager() +{ +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.h new file mode 100644 index 00000000..f9c025f4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDataRestartManager.h @@ -0,0 +1,144 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: An restart manager singleton class + * + ************************************************************************/ + +#ifndef included_hier_PatchDataRestartManager +#define included_hier_PatchDataRestartManager + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/ComponentSelector.h" +#include "SAMRAI/tbox/StartupShutdownManager.h" + +namespace SAMRAI { +namespace hier { + +/** + * Class PatchDataRestartManager handles registration of PatchData for restart. + */ + +class PatchDataRestartManager +{ +public: + /** + * Return a pointer to the single instance of the PatchDataRestartManager. + * All access to the PatchDataRestartManager object is through getManager(). + * + * Note that when the manager is accessed for the first time, the + * Singleton instance is registered with the StartupShutdownManager + * class which destroys such objects at program completion. Thus, + * users of this class do not explicitly allocate or deallocate the + * Singleton instance. + */ + static PatchDataRestartManager * + getManager(); + + /** + * @brief Check whether given patch data index is registered with the + * manager for restart. + * + * @param[in] index Integer patch data index to check. + * + * @return Boolean true if the patch data with the given index + * is registered for restart; otherwise false. + * + */ + bool + isPatchDataRegisteredForRestart( + int index) const + { + return d_patchdata_restart_table.isSet(index); + } + + /** + * Registers a patch data index for restart. + * + * @param[in] index Integer patch data index to check. + */ + void + registerPatchDataForRestart( + int index) + { + d_patchdata_restart_table.setFlag(index); + } + + /** + * Unregisters a patch data index for restart. + * + * @param[in] index Integer patch data index to check. + */ + void + unregisterPatchDataForRestart( + int index) + { + d_patchdata_restart_table.clrFlag(index); + } + + /** + * Returns true if the patch data components selected by "selected" are + * identical to the components registered in the manager and vice-versa. + * + * @param[in] selected The patch data components that have been selected. + */ + bool + registeredPatchDataMatches(const ComponentSelector& selected) + { + return selected == d_patchdata_restart_table; + } + +private: + /** + * The constructor for PatchDataRestartManager is private. + * Consistent with the definition of a Singleton class, only the + * manager object has access to the constructor for the class. + * + * The constructor for PatchDataRestartManager initializes the root + * data base to a NullDatabase and sets the restart flag to false. + */ + PatchDataRestartManager(); + + /** + * The destructor for the restart manager is protected, since only the + * singleton class and subclasses may destroy the manager objects. + */ + ~PatchDataRestartManager(); + + // Unimplemented copy constructor. + PatchDataRestartManager( + const PatchDataRestartManager& other); + + // Unimplemented assignment operator. + PatchDataRestartManager& + operator = ( + const PatchDataRestartManager& rhs); + + /** + * Deallocate the restart manager instance. It is not necessary to call + * this routine at program termination, since it is automatically called + * by the StartupShutdownManager class. + */ + static void + shutdownCallback(); + + static PatchDataRestartManager* s_manager_instance; + + /* + * ComponentSelector holds bits that determine which patch data items need + * to be written to the restart database. The bit in position j corresponds + * to the patch data associated with the j-th index of the patch descriptor + * object. + */ + ComponentSelector d_patchdata_restart_table; + + static tbox::StartupShutdownManager::Handler s_shutdown_handler; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.C index fa736591..93835f5b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for patch data objects that live on a patch * ************************************************************************/ - -#ifndef included_hier_PatchDescriptor_C -#define included_hier_PatchDescriptor_C - #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/tbox/SAMRAIManager.h" @@ -45,18 +41,19 @@ const int PatchDescriptor::INDEX_UNDEFINED = -1; */ PatchDescriptor::PatchDescriptor(): - d_min_gcw(tbox::Dimension::MAXIMUM_DIMENSION_VALUE) + d_min_gcw() { const int max_num_patch_data_components_allowed = tbox::SAMRAIManager::getMaxNumberPatchDataEntries(); d_max_number_registered_components = 0; - d_names.resizeArray(max_num_patch_data_components_allowed); - d_factories.resizeArray(max_num_patch_data_components_allowed); - for (int i = 0; i < max_num_patch_data_components_allowed; i++) { + d_names.resize(max_num_patch_data_components_allowed); + d_factories.resize(max_num_patch_data_components_allowed); + for (int i = 0; i < max_num_patch_data_components_allowed; ++i) { d_free_indices.push_back(i); } - for (unsigned short d = 0; d < d_min_gcw.size(); ++d) { - d_min_gcw[d] = IntVector::getZero(tbox::Dimension(static_cast(d + 1))); + for (unsigned short d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { + d_min_gcw.push_back( + IntVector::getZero(tbox::Dimension(static_cast(d + 1)))); } } @@ -82,23 +79,27 @@ PatchDescriptor::definePatchDataComponent( TBOX_ASSERT(!name.empty()); TBOX_ASSERT(factory); - int ret_index = INDEX_UNDEFINED; if (d_free_indices.empty()) { - TBOX_ERROR( - "PatchDescriptor::definePatchDataComponent error...\n" - << "No available patch data component indices left.\n" - << "Application must be restarted and size must be increased.\n" - << "See tbox::SAMRAIManager utility for more information." - << std::endl); - } else { - ret_index = d_free_indices.front(); - d_free_indices.pop_front(); - if (d_max_number_registered_components < ret_index + 1) { - d_max_number_registered_components = ret_index + 1; + int old_size = static_cast(d_names.size()); + int new_size = old_size + + tbox::SAMRAIManager::getMaxNumberPatchDataEntries(); + TBOX_ASSERT(new_size > old_size); + d_names.resize(new_size); + d_factories.resize(new_size); + for (int i = old_size; i < new_size; ++i) { + d_free_indices.push_back(i); } - d_factories[ret_index] = factory; - d_names[ret_index] = name; + tbox::SAMRAIManager::setMaxNumberPatchDataEntries(new_size); + } + + int ret_index = d_free_indices.front(); + d_free_indices.pop_front(); + if (d_max_number_registered_components < ret_index + 1) { + d_max_number_registered_components = ret_index + 1; } + d_factories[ret_index] = factory; + d_names[ret_index] = name; + return ret_index; } @@ -167,7 +168,7 @@ PatchDescriptor::mapNameToIndex( if (name == d_names[id]) { ret_index = id; } - id++; + ++id; } return ret_index; } @@ -192,7 +193,7 @@ PatchDescriptor::printClassData( << d_max_number_registered_components << std::endl; stream << "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; - for (int i = 0; i < d_max_number_registered_components; i++) { + for (int i = 0; i < d_max_number_registered_components; ++i) { stream << "Patch Data Index=" << i << std::endl; if (d_factories[i]) { stream << " Patch Data Factory Name = " @@ -219,7 +220,7 @@ PatchDescriptor::getMaxGhostWidth( const tbox::Dimension& dim) const { IntVector max_gcw(d_min_gcw[dim.getValue() - 1]); - for (int i = 0; i < d_max_number_registered_components; i++) { + for (int i = 0; i < d_max_number_registered_components; ++i) { if (d_factories[i] && (d_factories[i]->getDim() == dim)) { max_gcw.max(d_factories[i]->getGhostCellWidth()); } @@ -227,6 +228,19 @@ PatchDescriptor::getMaxGhostWidth( return max_gcw; } +/* + ************************************************************************* + * Return the dimension of the data for the given data_id. + ************************************************************************* + */ + +tbox::Dimension +PatchDescriptor::getPatchDataDim( + int patch_id) const +{ + return d_factories[patch_id]->getDim(); +} + } } @@ -237,5 +251,3 @@ PatchDescriptor::getMaxGhostWidth( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.h index 4d4b8f51..565baae5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchDescriptor.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for patch data objects that live on a patch * ************************************************************************/ @@ -16,13 +16,13 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include +#include namespace SAMRAI { namespace hier { @@ -33,27 +33,30 @@ namespace hier { * constructed on each patch in an AMR hierarchy. The factory mechanism is * used to create new instances of concrete patch data objects without knowing * their actual types. See the Design Patterns book by Gamma {\em et al.} - * for more details about the Abstract Factory pattern. Generally, a PatchDescriptor - * object is intended to be shared among all patches (which are distributed across - * processors) so that they store patch data objects in the same way. + * for more details about the Abstract Factory pattern. Generally, a + * PatchDescriptor object is intended to be shared among all patches (which are + * distributed across processors) so that they store patch data objects in the + * same way. * - * Patch data factory objects (and associated names) are explicitly added to the - * PatchDescriptor using the definePatchDataComponent() member function. This function - * returns an integer index that can be used to identify the corresponding patch data - * on a a patch. Factories can be removed from the PatchDescriptor using the - * removePatchDataComponent() member function, which returns the integer index associated - * with the removed factory to a "free list" so that it can be used again. At any time, - * the valid range of indices is >= 0 and < getMaxNumberRegisteredComponents(). + * Patch data factory objects (and associated names) are explicitly added to + * the PatchDescriptor using the definePatchDataComponent() member function. + * This function returns an integer index that can be used to identify the + * corresponding patch data on a a patch. Factories can be removed from the + * PatchDescriptor using the removePatchDataComponent() member function, which + * returns the integer index associated with the removed factory to a "free + * list" so that it can be used again. At any time, the valid range of indices + * is >= 0 and < getMaxNumberRegisteredComponents(). * - * Note that the SAMRAIManager utility establishes a maximum number of patch data - * object that may live on a Patch object which, for consistency, must be the same as - * the number of patch data factories a PatchDescriptor will hold. See the documentation - * of the SAMRAIManager utility for information about changing this maximum value. + * Note that the SAMRAIManager utility establishes a maximum number of patch + * data object that may live on a Patch object which, for consistency, must be + * the same as the number of patch data factories a PatchDescriptor will hold. + * See the documentation of the SAMRAIManager utility for information about + * changing this maximum value. * * @see tbox::SAMRAIManager - * @see hier::PatchDataFactory - * @see hier::PatchDataData - * @see hier::Patch + * @see PatchDataFactory + * @see PatchDataData + * @see Patch */ class PatchDescriptor @@ -77,12 +80,16 @@ class PatchDescriptor * unique for the mapNameToIndex() function to execute as expected. However, * there is no internal checking done to ensure that names are unique. * - * @return int index assigned to given patch data factory in patch descriptor. + * @return int index assigned to given patch data factory in patch + * descriptor. * - * @param name std::string name to be associated in name list with given factory, - * which must be non-empty when assertion checking is active. - * @param factory pointer to factory to add to patch descriptor, which must - * be non-null when assertion checking is active. + * @param name std::string name to be associated in name list with + * given factory + * @param factory pointer to factory to add to patch descriptor + * + * @pre !name.empty() + * @pre factory + * @pre !d_free_indices.empty() */ int definePatchDataComponent( @@ -90,11 +97,11 @@ class PatchDescriptor const boost::shared_ptr& factory); /*! - * Deallocate the patch data factory in the patch descriptor identified by the - * given index. The index may be assigned to another factory in the future. - * However, index will be invalid as a patch data index until it is re-allocated - * by the definePatchDataComponent() member function. An invalid id value - * passed to this function is silently ignored. + * Deallocate the patch data factory in the patch descriptor identified by + * the given index. The index may be assigned to another factory in the + * future. However, index will be invalid as a patch data index until it is + * re-allocated by the definePatchDataComponent() member function. An + * invalid id value passed to this function is silently ignored. * * @param id int index of factory to remove from patch descriptor. */ @@ -103,14 +110,17 @@ class PatchDescriptor int id); /*! - * Retrieve a patch data factory by integer index identifier. The identifier - * is the one previously returned by definePatchDataComponent(). Note that the - * factory pointer will be null if the index is is not currently assigned. + * Retrieve a patch data factory by integer index identifier. The + * identifier is the one previously returned by definePatchDataComponent(). + * Note that the factory pointer will be null if the index is is not + * currently assigned. * * @return pointer to patch data factory assigned to given index. * * @param id int index of factory to return, which must be >= 0 and * < the return value of getMaxNumberRegisteredComponents(); + * + * @pre (id >= 0) && (id < getMaxNumberRegisteredComponents()) */ boost::shared_ptr getPatchDataFactory( @@ -121,8 +131,8 @@ class PatchDescriptor } /*! - * Retrieve a patch data factory by name std::string identifier. Recall that - * uniqueness of names is not strictly enforced. So if more than one + * Retrieve a patch data factory by name std::string identifier. Recall + * that uniqueness of names is not strictly enforced. So if more than one * factory matches the given name, then only one of them is returned. If no * matching factory is found, then a null pointer is returned. * @@ -154,10 +164,10 @@ class PatchDescriptor } /*! - * Lookup a factory by std::string name and return its integer index identifier. - * Note that more than one factory may have the same name. In this case, the - * identifier of one of the factories is chosen. If no matching factory is found, - * then an invalid negative index is returned. + * Lookup a factory by std::string name and return its integer index + * identifier. Note that more than one factory may have the same name. In + * this case, the identifier of one of the factories is chosen. If no + * matching factory is found, then an invalid negative index is returned. */ int mapNameToIndex( @@ -165,6 +175,8 @@ class PatchDescriptor /*! * Lookup a factory by identifier and return its name. + * + * @pre (id >= 0) && (id < getMaxNumberRegisteredComponents()) */ const std::string& mapIndexToName( @@ -175,8 +187,8 @@ class PatchDescriptor } /*! - * Return the IntVector indicating the maximum ghost cell width of all registered - * patch data components for the provided dimension. + * Return the IntVector indicating the maximum ghost cell width of all + * registered patch data components for the provided dimension. * * If no components have been registered returns the value set by * setMinGhostWidth(), which is zero by default. @@ -207,6 +219,15 @@ class PatchDescriptor d_min_gcw[min_value.getDim().getValue() - 1] = min_value; } + /*! + * @brief Return the Dimension of the data for the given data_id. + * + * @param[in] data_id + */ + tbox::Dimension + getPatchDataDim( + int data_id) const; + /*! * Print patch descriptor data to given output stream (plog by default). */ @@ -222,13 +243,13 @@ class PatchDescriptor PatchDescriptor( const PatchDescriptor&); // not implemented - void + PatchDescriptor& operator = ( const PatchDescriptor&); // not implemented int d_max_number_registered_components; - tbox::Array d_names; - tbox::Array > d_factories; + std::vector d_names; + std::vector > d_factories; std::list d_free_indices; /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.C index d4d3e7d0..9ec3d6f1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.C @@ -3,17 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract factory class for creating patch classes * ************************************************************************/ - -#ifndef included_hier_PatchFactory_C -#define included_hier_PatchFactory_C - #include "SAMRAI/hier/PatchFactory.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace hier { @@ -28,12 +24,11 @@ PatchFactory::~PatchFactory() boost::shared_ptr PatchFactory::allocate( - const Box& mapped_box_level_mapped_box, + const Box& box_level_box, const boost::shared_ptr& descriptor) const { - return boost::make_shared(mapped_box_level_mapped_box, descriptor); + return boost::make_shared(box_level_box, descriptor); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.h index 8433b24f..4634df02 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract factory class for creating patch classes * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace hier { @@ -30,7 +30,7 @@ namespace hier { * be no direct calls to the patch constructor (other than through the * patch factory). * - * @see hier::Patch + * @see Patch */ class PatchFactory @@ -51,13 +51,13 @@ class PatchFactory */ virtual boost::shared_ptr allocate( - const Box& mapped_box_level_mapped_box, + const Box& box_level_box, const boost::shared_ptr& descriptor) const; private: PatchFactory( const PatchFactory&); // not implemented - void + PatchFactory& operator = ( const PatchFactory&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.C index 77a24494..20765fb2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management on patches * ************************************************************************/ - -#ifndef included_hier_PatchGeometry_C -#define included_hier_PatchGeometry_C - #include "SAMRAI/hier/PatchGeometry.h" #include "SAMRAI/hier/BoundaryLookupTable.h" @@ -29,37 +25,31 @@ namespace hier { PatchGeometry::PatchGeometry( const IntVector& ratio_to_level_zero, const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry): + const BlockId& block_id): d_dim(ratio_to_level_zero.getDim()), d_ratio_to_level_zero(ratio_to_level_zero), d_patch_boundaries(ratio_to_level_zero.getDim()), - d_touches_regular_bdry(ratio_to_level_zero.getDim()) + d_touches_regular_bdry(ratio_to_level_zero.getDim()), + d_block_id(block_id) { -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(touches_periodic_bdry); -#endif - - TBOX_DIM_ASSERT_CHECK_ARGS3(ratio_to_level_zero, - touches_regular_bdry, - touches_periodic_bdry); + TBOX_ASSERT_OBJDIM_EQUALITY2(ratio_to_level_zero, touches_regular_bdry); #ifdef DEBUG_CHECK_ASSERTIONS /* - * All components of ratio must me nonzero. Additionally, all components + * All components of ratio must be nonzero. Additionally, all components * of ratio not equal to 1 must have the same sign. */ - int i; - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT(ratio_to_level_zero(i) != 0); - } + TBOX_ASSERT(ratio_to_level_zero != 0); if (d_dim.getValue() > 1) { - for (i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT((ratio_to_level_zero(i) - * ratio_to_level_zero((i + 1) % d_dim.getValue()) > 0) - || (ratio_to_level_zero(i) == 1) - || (ratio_to_level_zero((i + 1) % d_dim.getValue()) == 1)); + BlockId::block_t b = block_id.getBlockValue(); + for (unsigned int i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = d_ratio_to_level_zero(b,i) > 0; + bool pos1 = d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (d_ratio_to_level_zero(b,i) == 1) + || (d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); } } #endif @@ -67,8 +57,8 @@ PatchGeometry::PatchGeometry( d_has_regular_boundary = false; d_has_periodic_boundary = false; - for (int axis = 0; axis < d_dim.getValue(); axis++) { - for (int dir = 0; dir < 2; dir++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + for (int dir = 0; dir < 2; ++dir) { d_touches_regular_bdry(axis, dir) = touches_regular_bdry(axis, dir); if (d_touches_regular_bdry(axis, dir)) { @@ -89,10 +79,10 @@ PatchGeometry::getBoundaryFillBox( const IntVector& gcw) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(bbox, patch_box, gcw); + TBOX_ASSERT_OBJDIM_EQUALITY3(bbox, patch_box, gcw); #ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { TBOX_ASSERT(gcw(i) >= 0); } #endif @@ -108,16 +98,16 @@ PatchGeometry::getBoundaryFillBox( blut = BoundaryLookupTable::getLookupTable(d_dim); #ifdef DEBUG_CHECK_ASSERTIONS - const tbox::Array& location_index_max = blut->getMaxLocationIndices(); + const std::vector& location_index_max = blut->getMaxLocationIndices(); +#endif TBOX_ASSERT(bdry_type > 0); TBOX_ASSERT(bdry_type <= d_dim.getValue()); TBOX_ASSERT(location_index >= 0); -#endif if (!fill_box.empty()) { // Loop over codimension (a.k.a. boundary type) - for (int codim = 1; codim <= d_dim.getValue(); codim++) { + for (tbox::Dimension::dir_t codim = 1; codim <= d_dim.getValue(); ++codim) { // When we get a match on the boundary type if (bdry_type == codim) { @@ -126,11 +116,11 @@ PatchGeometry::getBoundaryFillBox( // Get the directions involved in this boundary type from the // lookup table. - const tbox::Array& dir = + const std::vector& dir = blut->getDirections(location_index, codim); // For each direction, identify this as an upper or lower boundary. - for (int i = 0; i < codim; i++) { + for (tbox::Dimension::dir_t i = 0; i < codim; ++i) { if (blut->isUpper(location_index, codim, i)) { fill_box.growUpper(dir[i], gcw(dir[i]) - 1); } else { @@ -149,30 +139,30 @@ PatchGeometry::getBoundaryFillBox( void PatchGeometry::setCodimensionBoundaries( - const tbox::Array& bdry_boxes, + const std::vector& bdry_boxes, int codim) { #ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < bdry_boxes.size(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { TBOX_ASSERT(bdry_boxes[i].getBoundaryType() == codim); } +#endif TBOX_ASSERT(codim <= d_dim.getValue()); TBOX_ASSERT(codim > 0); -#endif - d_patch_boundaries[codim - 1].resizeArray(bdry_boxes.size(), - BoundaryBox(d_dim)); + d_patch_boundaries[codim - 1].clear(); + d_patch_boundaries[codim - 1].reserve(bdry_boxes.size()); - for (int b = 0; b < bdry_boxes.size(); b++) { - d_patch_boundaries[codim - 1][b] = bdry_boxes[b]; + for (int b = 0; b < static_cast(bdry_boxes.size()); ++b) { + d_patch_boundaries[codim - 1].push_back(bdry_boxes[b]); } } void PatchGeometry::setBoundaryBoxesOnPatch( - const tbox::Array > bdry) + const std::vector >& bdry) { - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { setCodimensionBoundaries(bdry[i], i + 1); } } @@ -186,27 +176,21 @@ PatchGeometry::printClassData( stream << "d_has_regular_boundary = " << d_has_regular_boundary << std::endl; stream << "Boundary boxes for patch..." << std::endl; - for (int d = 0; d < d_dim.getValue(); d++) { - const int n = d_patch_boundaries[d].getSize(); + for (int d = 0; d < d_dim.getValue(); ++d) { + const int n = static_cast(d_patch_boundaries[d].size()); stream << "Boundary box array " << d << " has " << n << " boxes" << std::endl; - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { stream << "box " << i << " = " << d_patch_boundaries[d][i].getBox() << std::endl; } } } -PatchGeometry::TwoDimBool::TwoDimBool(): - d_dim(tbox::Dimension::getInvalidDimension()) -{ -} - PatchGeometry::TwoDimBool::TwoDimBool( const tbox::Dimension& dim): d_dim(dim) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); setAll(false); } @@ -230,5 +214,3 @@ PatchGeometry::TwoDimBool::TwoDimBool( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.h index 89589886..60643714 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for geometry management on patches * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/LocalId.h" @@ -22,6 +21,7 @@ #include #include +#include namespace SAMRAI { namespace hier { @@ -35,8 +35,8 @@ namespace hier { * spaces. The boundary information for patches is actually computed by * the BaseGridGeometry class. * - * @see hier::BoundaryBox - * @see hier::BaseGridGeometry + * @see BoundaryBox + * @see BaseGridGeometry */ class PatchGeometry @@ -95,25 +95,28 @@ class PatchGeometry return d_dim; } - friend class::std::map; - private: /* - * Needed by brain dead STL. Don't use for other purposes. + * Unimplemented default constructor. */ TwoDimBool(); const tbox::Dimension d_dim; - bool d_data[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + bool d_data[2 * SAMRAI::MAX_DIM_VAL]; }; /** - * The default constructor for the patch geometry base class. + * The constructor for the patch geometry base class. + * + * @pre (ratio_to_level_zero.getDim() == touches_regular_bdry.getDim()) + * @pre all components of ratio_to_level_zero must be nonzero and all + * components of ratio_to_level_zero not equal to 1 must have the same + * sign */ PatchGeometry( const IntVector& ratio_to_level_zero, const TwoDimBool& touches_regular_bdry, - const TwoDimBool& touches_periodic_bdry); + const BlockId& block_id); /** * The virtual destructor for the patch geometry base class. @@ -123,23 +126,23 @@ class PatchGeometry /** * Return const reference to patch boundary information. */ - const tbox::Array > + const std::vector >& getPatchBoundaries() const { - return d_patch_boundaries.getArrays(); + return d_patch_boundaries.getVectors(); } /*! - * @brief Set the boundary box arrays for this patch geometry. + * @brief Set the boundary box vectors for this patch geometry. * - * An array of length DIM of tbox::Array< BoundaryBox > is passed + * A vector of length DIM of std::vector is passed * in to be stored as the boundary boxes for this patch geometry. * - * @param bdry The array of BoundaryBox arrays. + * @param bdry The vector of BoundaryBox vectors. */ void setBoundaryBoxesOnPatch( - const tbox::Array > bdry); + const std::vector >& bdry); /** * Return const reference to ratio to level zero index space. @@ -167,28 +170,27 @@ class PatchGeometry } /** - * Return array of boundary box components for patch each of which + * Return vector of boundary box components for patch each of which * intersects the patch at a single point (i.e., 0-dim intersection * between cells in patch and cells in boundary box). */ - const tbox::Array& + const std::vector& getNodeBoundaries() const { - return d_patch_boundaries[d_dim.getValue() - 1]; + return d_patch_boundaries[getDim().getValue() - 1]; } /** - * Return array of boundary box components for patch each of which + * Return vector of boundary box components for patch each of which * intersects the patch along a 1-dim edge (i.e., 1-dim intersection * between cells in patch and cells in boundary box). * - * When assertion checking is active, this routine throws an assertion - * when DIM < 2. + * @pre getDim().getValue() >= 2 */ - const tbox::Array& + const std::vector& getEdgeBoundaries() const { - if (d_dim.getValue() < 2) { + if (getDim().getValue() < 2) { TBOX_ERROR("PatchGeometry error in getEdgeBoundary...\n" << "DIM < 2 not supported." << std::endl); } @@ -196,21 +198,20 @@ class PatchGeometry // The "funny" indexing prevents a warning when compiling for // DIM < 2. This code is only reached if DIM >= 2 when // executing. - return d_patch_boundaries[d_dim.getValue() < 2 ? 0 : d_dim.getValue() - 2]; + return d_patch_boundaries[getDim().getValue() < 2 ? 0 : getDim().getValue() - 2]; } /** - * Return array of boundary box components for patch each of which + * Return vector of boundary box components for patch each of which * intersects the patch along a 2-dim face (i.e., 2-dim intersection * between cells in patch and cells in boundary box). * - * When assertion checking is active, this routine throws an assertion - * when DIM < 3. + * @pre getDim().getValue() >= 3 */ - const tbox::Array& + const std::vector& getFaceBoundaries() const { - if (d_dim.getValue() < 3) { + if (getDim().getValue() < 3) { TBOX_ERROR("PatchGeometry error in getFaceBoundary...\n" << "DIM < 3 not supported." << std::endl); } @@ -218,11 +219,11 @@ class PatchGeometry // The "funny" indexing prevents a warning when compiling for // DIM < 3. This code is only reached if DIM >= 3 when // executing. - return d_patch_boundaries[d_dim.getValue() < 3 ? 0 : d_dim.getValue() - 3]; + return d_patch_boundaries[getDim().getValue() < 3 ? 0 : getDim().getValue() - 3]; } /** - * Return array of boundary box components for patch each of which + * Return vector of boundary box components for patch each of which * intersects the patch as a (DIM - codim)-dimensional object. * That is, * @@ -235,24 +236,27 @@ class PatchGeometry * (codim == 2) => same components as getEdgeBoundaries. * (codim == 3) => same components as getNodeBoundaries. * - * When assertion checking is active, this routine throws an assertion + * @pre (codim > 0) && (codim <= getDim().getValue()) * when codim < 0 or codim > DIM. */ - const tbox::Array& + const std::vector& getCodimensionBoundaries( const int codim) const { - TBOX_ASSERT((codim > 0) && (codim <= d_dim.getValue())); + TBOX_ASSERT((codim > 0) && (codim <= getDim().getValue())); return d_patch_boundaries[codim - 1]; } /** - * Set the array of boundary box components of the given codimension + * Set the vector of boundary box components of the given codimension * for a patch. + * + * @pre (codim > 0) && (codim <= getDim().getValue()) + * @pre for each boundary_box in bdry_boxes, getBoundaryType() == codim */ void setCodimensionBoundaries( - const tbox::Array& bdry_boxes, + const std::vector& bdry_boxes, const int codim); /*! @@ -266,6 +270,10 @@ class PatchGeometry * @param bbox BoundaryBox representing location and type of boundary * @param patch_box The box for the patch where data is being filled * @param gcw ghost cell width to fill + * + * @pre bbox.getDim() == patch_box.getDim() + * @pre bbox.getDim() == gcw.getDim() + * @pre all components of gcw are >= 0 */ Box getBoundaryFillBox( @@ -306,13 +314,16 @@ class PatchGeometry * @param axis Axis direction normal to the side being checked * @param upperlower Flag should be 0 if checking the lower side in the * axis direction, or 1 if checking the upper side. + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (upperlower == 0) || (upperlower == 1) */ bool getTouchesRegularBoundary( int axis, int upperlower) const { - TBOX_ASSERT(axis >= 0 && axis < d_dim.getValue()); + TBOX_ASSERT(axis >= 0 && axis < getDim().getValue()); TBOX_ASSERT(upperlower == 0 || upperlower == 1); return d_touches_regular_bdry(axis, upperlower); } @@ -324,6 +335,12 @@ class PatchGeometry printClassData( std::ostream& stream) const; + const tbox::Dimension& + getDim() const + { + return d_dim; + } + private: const tbox::Dimension d_dim; @@ -333,6 +350,7 @@ class PatchGeometry PatchBoundaries d_patch_boundaries; TwoDimBool d_touches_regular_bdry; + BlockId d_block_id; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.C index b2f3efe1..e142b8d3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.C @@ -3,23 +3,20 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An AMR hierarchy of patch levels * ************************************************************************/ - -#ifndef included_hier_PatchHierarchy_C -#define included_hier_PatchHierarchy_C - #include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace hier { @@ -30,8 +27,8 @@ std::vector PatchHierarchy::s_class_cwrs; tbox::StartupShutdownManager::Handler -PatchHierarchy::s_initialize_finalize_handler( - PatchHierarchy::initializeCallback, +PatchHierarchy::s_finalize_handler( + 0, 0, 0, PatchHierarchy::finalizeCallback, @@ -49,65 +46,59 @@ PatchHierarchy::s_initialize_finalize_handler( PatchHierarchy::PatchHierarchy( const std::string& object_name, const boost::shared_ptr& geometry, - const boost::shared_ptr& database, - bool register_for_restart): - + const boost::shared_ptr& input_db): d_dim(geometry->getDim()), - + d_number_levels(0), + d_patch_descriptor(VariableDatabase::getDatabase()->getPatchDescriptor()), + d_patch_factory(new PatchFactory), + d_patch_level_factory(new PatchLevelFactory), d_max_levels(1), - d_ratio_to_coarser(1, IntVector(d_dim, 1)), + d_ratio_to_coarser(1, IntVector(IntVector::getOne(d_dim), geometry->getNumberBlocks())), d_proper_nesting_buffer(d_max_levels - 1, 1), d_smallest_patch_size(1, IntVector(d_dim, 1)), d_largest_patch_size(1, IntVector(d_dim, tbox::MathUtilities::getMax())), d_allow_patches_smaller_than_ghostwidth(false), d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps(false), - d_self_connector_widths(), - d_fine_connector_widths(), - d_connector_widths_are_computed(false), - d_individual_cwrs(), - d_domain_mapped_box_level(d_dim) + d_self_connector_widths(1, IntVector(IntVector::getOne(d_dim), geometry->getNumberBlocks())), + d_fine_connector_widths(1, IntVector(IntVector::getOne(d_dim), geometry->getNumberBlocks())), + d_connector_widths_committed(false), + d_individual_cwrs() { TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(geometry); d_object_name = object_name; - d_registered_for_restart = register_for_restart; - d_number_levels = 0; d_grid_geometry = geometry; - d_patch_descriptor = VariableDatabase::getDatabase()-> - getPatchDescriptor(); - d_patch_factory.reset(new PatchFactory); - d_patch_level_factory.reset(new PatchLevelFactory); d_number_blocks = d_grid_geometry->getNumberBlocks(); /* * Grab the physical domain (including periodic images) from the * grid geometry and set up domain data dependent on it. */ - d_domain_mapped_box_level.initialize( - IntVector::getOne(d_dim), + d_domain_box_level.reset(new BoxLevel( + d_ratio_to_coarser[0], getGridGeometry(), tbox::SAMRAI_MPI::getSAMRAIWorld(), - BoxLevel::GLOBALIZED); - d_grid_geometry->computePhysicalDomain(d_domain_mapped_box_level, - IntVector::getOne(d_dim)); - d_domain_mapped_box_level.finalize(); + BoxLevel::GLOBALIZED)); + d_grid_geometry->computePhysicalDomain(*d_domain_box_level, + d_ratio_to_coarser[0]); + d_domain_box_level->finalize(); d_individual_cwrs = s_class_cwrs; - if (database) { - getFromInput(database); - } else { - /* - * Without input database, the default is single-level with no - * patch size constraints. - */ + /* + * Without input database, the default is single-level with no + * patch size constraints. + */ + bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); + if (is_from_restart) { + getFromRestart(); } + getFromInput(input_db, is_from_restart); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } + d_grid_geometry->setUpRatios(d_ratio_to_coarser); + + tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); } /* @@ -122,9 +113,7 @@ PatchHierarchy::PatchHierarchy( PatchHierarchy::~PatchHierarchy() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); } /* @@ -137,114 +126,331 @@ PatchHierarchy::~PatchHierarchy() void PatchHierarchy::getFromInput( - const boost::shared_ptr& db) + const boost::shared_ptr& input_db, + bool is_from_restart) { - TBOX_ASSERT(db); + if (input_db) { + if (!is_from_restart) { - /* - * Read input for maximum number of levels. - */ + /* + * Read input for maximum number of levels. + */ - d_max_levels = db->getIntegerWithDefault("max_levels", d_max_levels); + d_max_levels = + input_db->getIntegerWithDefault("max_levels", 1); + if (!(d_max_levels >= 1)) { + INPUT_RANGE_ERROR("max_levels"); + } - if (d_max_levels != int(d_ratio_to_coarser.size())) { - d_ratio_to_coarser.resize(d_max_levels, d_ratio_to_coarser.back()); - d_smallest_patch_size.resize(d_max_levels, d_smallest_patch_size.back()); - d_largest_patch_size.resize(d_max_levels, d_largest_patch_size.back()); - } + if (d_max_levels != int(d_ratio_to_coarser.size())) { + d_ratio_to_coarser.resize(d_max_levels, d_ratio_to_coarser.back()); + d_smallest_patch_size.resize(d_max_levels, + d_smallest_patch_size.back()); + d_largest_patch_size.resize(d_max_levels, + d_largest_patch_size.back()); + } - std::vector level_names(d_max_levels, std::string("level_")); - for (int ln = 0; ln < d_max_levels; ++ln) { - level_names[ln] += tbox::Utilities::intToString(ln); - } - - // Read in ratio_to_coarser. - if (db->isDatabase("ratio_to_coarser")) { - const boost::shared_ptr tmp_db( - db->getDatabase("ratio_to_coarser")); - for (int ln = 1; ln < d_max_levels; ++ln) { - if (tmp_db->isInteger(level_names[ln])) { - tmp_db->getIntegerArray(level_names[ln], - &d_ratio_to_coarser[ln][0], - d_dim.getValue()); - } else { - d_ratio_to_coarser[ln] = d_ratio_to_coarser[ln - 1]; + std::vector level_names(d_max_levels, + std::string("level_")); + for (int ln = 0; ln < d_max_levels; ++ln) { + level_names[ln] += tbox::Utilities::intToString(ln); } - } - } - // Read in smallest_patch_size. - if (db->isDatabase("smallest_patch_size")) { - const boost::shared_ptr tmp_db( - db->getDatabase("smallest_patch_size")); - for (int ln = 0; ln < d_max_levels; ++ln) { - if (tmp_db->isInteger(level_names[ln])) { - tmp_db->getIntegerArray(level_names[ln], - &d_smallest_patch_size[ln][0], - d_dim.getValue()); + // Read in ratio_to_coarser. + d_ratio_to_coarser[0].setAll(IntVector::getOne(d_dim)); + if (d_number_blocks == 1) { + if (input_db->isDatabase("ratio_to_coarser")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("ratio_to_coarser")); + for (int ln = 1; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + IntVector read_vector(d_dim); + tmp_db->getIntegerArray(level_names[ln], + &read_vector[0], + //&d_ratio_to_coarser[ln].getBlockVector(BlockId(0))[0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(read_vector[i] > 0)) { + INPUT_RANGE_ERROR("ratio_to_coarser"); + } + } + d_ratio_to_coarser[ln].setAll(read_vector); + } else { + d_ratio_to_coarser[ln] = d_ratio_to_coarser[ln - 1]; + } + } + } } else { - d_smallest_patch_size[ln] = d_smallest_patch_size[ln - 1]; + std::vector< std::vector > block_ratio(d_max_levels); + for (int ln = 1; ln < d_max_levels; ++ln) { + block_ratio[ln].resize(d_number_blocks, IntVector::getZero(d_dim)); + } + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + std::string ratio_name("ratio_to_coarser_"); + ratio_name += tbox::Utilities::intToString(static_cast(b)); + if (input_db->isDatabase(ratio_name)) { + const boost::shared_ptr tmp_db( + input_db->getDatabase(ratio_name)); + for (int ln = 1; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &block_ratio[ln][b][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(block_ratio[ln][b][i] > 0)) { + INPUT_RANGE_ERROR(ratio_name); + } + } + } else { + block_ratio[ln][b] = block_ratio[ln-1][b]; + } + } + } else if (input_db->isDatabase("ratio_to_coarser")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("ratio_to_coarser")); + for (int ln = 1; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &block_ratio[ln][b][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(block_ratio[ln][b][i] > 0)) { + INPUT_RANGE_ERROR(ratio_name); + } + } + } else { + block_ratio[ln][b] = block_ratio[ln-1][b]; + } + } + } + } + for (int ln = 1; ln < d_max_levels; ++ln) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int i = 0; i < d_dim.getValue(); ++i) { + d_ratio_to_coarser[ln](b,i) = block_ratio[ln][b][i]; + } + } + } + } + + // Read in smallest_patch_size. + if (input_db->isDatabase("smallest_patch_size")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("smallest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &d_smallest_patch_size[ln][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (d_smallest_patch_size[ln][i] <= 0) { + INPUT_RANGE_ERROR("smallest_patch_size"); + } + } + } else { + d_smallest_patch_size[ln] = d_smallest_patch_size[ln - 1]; + } + } } - } - } - // Read in largest_patch_size. - if (db->isDatabase("largest_patch_size")) { - const boost::shared_ptr tmp_db( - db->getDatabase("largest_patch_size")); - for (int ln = 0; ln < d_max_levels; ++ln) { - if (tmp_db->isInteger(level_names[ln])) { - tmp_db->getIntegerArray(level_names[ln], - &d_largest_patch_size[ln][0], - d_dim.getValue()); - } else { - d_largest_patch_size[ln] = d_largest_patch_size[ln - 1]; + // Read in largest_patch_size. + if (input_db->isDatabase("largest_patch_size")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("largest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &d_largest_patch_size[ln][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_largest_patch_size[ln][i] < 0 || + d_largest_patch_size[ln][i] >= d_smallest_patch_size[ln][i])) { + INPUT_RANGE_ERROR("largest_patch_size"); + } + /* + * If largest patch size is input as negative, that means + * no largest size restriction is desired. We store + * an INT_MAX value in this case. + */ + if (d_largest_patch_size[ln][i] < 0) { + d_largest_patch_size[ln][i] = + tbox::MathUtilities::getMax(); + } + } + } else { + d_largest_patch_size[ln] = d_largest_patch_size[ln - 1]; + } + } } - } - } - tbox::Array proper_nesting_buffer(1, 1); - if (db->isInteger("proper_nesting_buffer")) { - proper_nesting_buffer = db->getIntegerArray("proper_nesting_buffer"); - } - d_proper_nesting_buffer.clear(); - for (int ln = 0; ln < d_max_levels - 1; ++ln) { - if (ln < proper_nesting_buffer.size()) { - d_proper_nesting_buffer.push_back(int(proper_nesting_buffer[ln])); + std::vector proper_nesting_buffer(1, 1); + if (input_db->isInteger("proper_nesting_buffer")) { + proper_nesting_buffer = input_db->getIntegerVector( + "proper_nesting_buffer"); + } + d_proper_nesting_buffer.clear(); + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + if (ln < static_cast(proper_nesting_buffer.size())) { + d_proper_nesting_buffer.push_back(proper_nesting_buffer[ln]); + } else { + d_proper_nesting_buffer.push_back(d_proper_nesting_buffer[ln - 1]); + } + } + for (size_t ln = 0; ln < d_proper_nesting_buffer.size(); ++ln) { + if (d_proper_nesting_buffer[ln] < 0) { + TBOX_ERROR( + d_object_name << ": " + << "Key data `proper_nesting_buffer' has values < 0." + << std::endl); + } + if (d_proper_nesting_buffer[ln] == 0) { + TBOX_WARNING( + d_object_name << ": " + << "Using zero `proper_nesting_buffer' values." + << std::endl); + } + } + + d_allow_patches_smaller_than_ghostwidth = + input_db->getBoolWithDefault("allow_patches_smaller_than_ghostwidth", false); + + d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = + input_db->getBoolWithDefault( + "allow_patches_smaller_than_minimum_size_to_prevent_overlaps", + false); + if (d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps) { + TBOX_WARNING( + d_object_name << ": " + << "Allowing patches smaller than the given " + << "smallest patch size to prevent overlaps.\n" + << "Note: If periodic " + << "boundary conditions are used, this flag is " + << "ignored in the periodic directions." + << std::endl); + } } else { - d_proper_nesting_buffer.push_back(int(d_proper_nesting_buffer[ln - 1])); - } - } - for (size_t ln = 0; ln < d_proper_nesting_buffer.size(); ln++) { - if (d_proper_nesting_buffer[ln] < 0) { - TBOX_ERROR( - d_object_name << ": " - << "Key data `proper_nesting_buffer' has values < 0."); - } - if (d_proper_nesting_buffer[ln] == 0) { - TBOX_WARNING( - d_object_name << ": " - << "Using zero `proper_nesting_buffer' values."); - } - } + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + if (!read_on_restart) { + return; + } - d_allow_patches_smaller_than_ghostwidth = - db->getBoolWithDefault("allow_patches_smaller_than_ghostwidth", - d_allow_patches_smaller_than_ghostwidth); + /* + * Read input for maximum number of levels. + */ - d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = - db->getBoolWithDefault( - "allow_patches_smaller_than_minimum_size_to_prevent_overlaps", - d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps); - if (d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps) { - TBOX_WARNING( - d_object_name << ": " - << "Allowing patches smaller than the given " - << "smallest patch size. Note: If periodic " - << "boundary conditions are used, this flag is " - << "ignored in the periodic directions."); - } + int new_max_levels = + input_db->getIntegerWithDefault("max_levels", d_max_levels); + if (new_max_levels > d_max_levels) { + TBOX_ERROR("PatchHierarchy::getFromInput error...\n" + << "max_levels must not increase on restart." << std::endl); + } + d_max_levels = new_max_levels; + + if (d_max_levels != int(d_ratio_to_coarser.size())) { + d_ratio_to_coarser.resize(d_max_levels, d_ratio_to_coarser.back()); + d_smallest_patch_size.resize(d_max_levels, + d_smallest_patch_size.back()); + d_largest_patch_size.resize(d_max_levels, + d_largest_patch_size.back()); + } + + std::vector level_names(d_max_levels, + std::string("level_")); + for (int ln = 0; ln < d_max_levels; ++ln) { + level_names[ln] += tbox::Utilities::intToString(ln); + } + + // Read in smallest_patch_size. + if (input_db->isDatabase("smallest_patch_size")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("smallest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &d_smallest_patch_size[ln][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (d_smallest_patch_size[ln][i] < 1) { + TBOX_ERROR("PatchHierarchy::getFromInput error...\n" + << "smallest_patch_size must be > 0." << std::endl); + } + } + } else { + d_smallest_patch_size[ln] = d_smallest_patch_size[ln - 1]; + } + } + } + + // Read in largest_patch_size. + if (input_db->isDatabase("largest_patch_size")) { + const boost::shared_ptr tmp_db( + input_db->getDatabase("largest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + if (tmp_db->isInteger(level_names[ln])) { + tmp_db->getIntegerArray(level_names[ln], + &d_largest_patch_size[ln][0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (d_largest_patch_size[ln][i] >= 0 && + d_largest_patch_size[ln][i] < + d_smallest_patch_size[ln][i]) { + TBOX_ERROR("PatchHierarchy::getFromInput error...\n" + << "largest_patch_size must be >= smallest_patch_size." + << std::endl); + } + /* + * If largest patch size is input as negative, that means + * no largest size restriction is desired. We store + * an INT_MAX value in this case. + */ + if (d_largest_patch_size[ln][i] < 0) { + d_largest_patch_size[ln][i] = + tbox::MathUtilities::getMax(); + } + + } + } else { + d_largest_patch_size[ln] = d_largest_patch_size[ln - 1]; + } + } + } + if (input_db->keyExists("proper_nesting_buffer")) { + std::vector proper_nesting_buffer(1, 1); + proper_nesting_buffer = input_db->getIntegerVector( + "proper_nesting_buffer"); + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + int val; + if (ln < static_cast(proper_nesting_buffer.size())) { + val = proper_nesting_buffer[ln]; + } else { + val = proper_nesting_buffer[static_cast(proper_nesting_buffer.size()) - 1]; + } + if (val != d_proper_nesting_buffer[ln]) { + TBOX_WARNING("PatchHierarchy::getFromInput warning...\n" + << "proper_nesting_buffer may not be changed on restart." + << std::endl); + break; + } + } + } + + if (input_db->keyExists("allow_patches_smaller_than_ghostwidth")) { + bool tmp = input_db->getBool("allow_patches_smaller_than_ghostwidth"); + if (tmp != d_allow_patches_smaller_than_ghostwidth) { + TBOX_WARNING("PatchHierarchy::getFromInput warning...\n" + << "allow_patches_smaller_than_ghostwidth\n" + << "may not be changed on restart." << std::endl); + } + } + + d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = + input_db->getBoolWithDefault( + "allow_patches_smaller_than_minimum_size_to_prevent_overlaps", + d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps); + } + } } /* @@ -257,12 +463,13 @@ void PatchHierarchy::registerConnectorWidthRequestor( const ConnectorWidthRequestorStrategy& cwrs) { - if (d_connector_widths_are_computed) { + if (d_connector_widths_committed) { TBOX_ERROR("PatchHierarchy::registerConnectorWidthRequestor:\n" - << "Registering a new ConnectorWidthRequestorStrategy after\n" - << "calling getRequiredConnectorWidth() is disallowed because\n" - << "it may cause getRequiredConnectorWidth() to return\n" - << "conflicting requirements."); + << "Registering a new ConnectorWidthRequestorStrategy is not\n" + << "allowed for this hierarchy because some code has called\n" + << "getRequiredConnectorWidth() with commit = true. See the\n" + << "documentation for getRequiredConnectorWidth()." + << std::endl); } size_t i; @@ -309,7 +516,7 @@ void PatchHierarchy::finalizeCallback() { for (int i = 0; i < int(s_class_cwrs.size()); ++i) { - s_class_cwrs[i] = NULL; + s_class_cwrs[i] = 0; } s_class_cwrs.clear(); /* @@ -326,62 +533,20 @@ PatchHierarchy::finalizeCallback() IntVector PatchHierarchy::getRequiredConnectorWidth( int base_ln, - int head_ln) const + int head_ln, + bool commit) const { TBOX_ASSERT(head_ln >= 0); TBOX_ASSERT(head_ln < d_max_levels); TBOX_ASSERT(base_ln >= 0); TBOX_ASSERT(base_ln < d_max_levels); + TBOX_ASSERT(abs(base_ln - head_ln) <= 1); - if (!d_connector_widths_are_computed) { - - const IntVector& zero_vector(IntVector::getZero(d_dim)); - d_self_connector_widths.clear(); - d_self_connector_widths.insert(d_self_connector_widths.begin(), - d_max_levels, - zero_vector); - d_fine_connector_widths.clear(); - if (d_max_levels > 1) { - d_fine_connector_widths.insert(d_fine_connector_widths.begin(), - d_max_levels - 1, - zero_vector); - } - - /* - * Get the required widths satisfying all registered - * ConnectorWidthRequestorStrategy objects. - */ - - std::vector self_connector_widths; - std::vector fine_connector_widths; - for (size_t i = 0; i < d_individual_cwrs.size(); ++i) { - d_individual_cwrs[i]->computeRequiredConnectorWidths( - self_connector_widths, - fine_connector_widths, - *this); - TBOX_ASSERT(self_connector_widths.size() == static_cast(d_max_levels)); - TBOX_ASSERT(fine_connector_widths.size() == static_cast(d_max_levels - 1)); - for (int ln = 0; ln < d_max_levels; ++ln) { - d_self_connector_widths[ln].max(self_connector_widths[ln]); - } - for (int ln = 0; ln < d_max_levels - 1; ++ln) { - d_fine_connector_widths[ln].max(fine_connector_widths[ln]); - } + if (!d_connector_widths_committed) { + computeRequiredConnectorWidths(); + if (commit) { + d_connector_widths_committed = true; } - - /* - * Make sure the self connector widths are at least as big as - * the fine. This is required because self Connectors at the - * tag level is used to compute the fine Connectors. This - * requirement is due to the GriddingAlgorithm, so perhaps it - * should be moved there! On the other hand, GriddingAlgorithm - * cannot be expected know about fine_connector_width - * requirements of other width requestors. - */ - for (int ln = 0; ln < d_max_levels - 1; ++ln) { - d_self_connector_widths[ln].max(d_fine_connector_widths[ln]); - } - d_connector_widths_are_computed = true; } if (base_ln != head_ln) { @@ -394,37 +559,72 @@ PatchHierarchy::getRequiredConnectorWidth( } TBOX_ERROR("PatchHierarchy::getRequiredConnectorWidth: base_ln and\n" << "head_ln should differ by at most 1.\n" - << "base_ln=" << base_ln << " head_ln=" << head_ln); + << "base_ln=" << base_ln << " head_ln=" << head_ln << std::endl); } return d_self_connector_widths[base_ln]; } /* ************************************************************************* - * Get the Connector between 2 levels in the hierarchy. - * The levels must be the same or adjacent levels. - * The Connector will have the width required by the hierarchy. - * - * This is primarily a convenience. Its functionality can be duplicated - * by getting the required Connector widths and getting the Connector - * with that width from the PatchLevels' BoxLevels. + * Compute required Connector widths using all the registered + * ConnectorWidthRequestorStrategy objects. ************************************************************************* */ -const Connector& -PatchHierarchy::getConnector( - const int base_ln, - const int head_ln) const +void +PatchHierarchy::computeRequiredConnectorWidths() const { - TBOX_ASSERT(base_ln >= 0); - TBOX_ASSERT(base_ln < d_number_levels); - TBOX_ASSERT(head_ln >= 0); - TBOX_ASSERT(head_ln < d_number_levels); - const BoxLevel& base(*d_patch_levels[base_ln]->getBoxLevel()); - const BoxLevel& head(*d_patch_levels[head_ln]->getBoxLevel()); - const IntVector width(getRequiredConnectorWidth(base_ln, head_ln)); - const Connector& con = base.getPersistentOverlapConnectors(). - findConnector(head, width); - return con; + IntVector zero_vector(d_dim, 0, d_number_blocks); + d_self_connector_widths.clear(); + d_self_connector_widths.resize(d_max_levels, zero_vector); + for (int ln = 0; ln < d_max_levels; ++ln) { + d_self_connector_widths[ln].setAll(zero_vector); + } + d_fine_connector_widths.clear(); + if (d_max_levels > 1) { + d_fine_connector_widths.resize(d_max_levels - 1, zero_vector); + for (int ln = 0; ln < d_max_levels-1; ++ln) { + d_fine_connector_widths[ln].setAll(zero_vector); + } + } + + /* + * Get the required widths satisfying all registered + * ConnectorWidthRequestorStrategy objects. + */ + + + std::vector self_connector_widths(0, d_self_connector_widths[0]); + std::vector fine_connector_widths(0, d_fine_connector_widths[0]); + for (size_t i = 0; i < d_individual_cwrs.size(); ++i) { + d_individual_cwrs[i]->computeRequiredConnectorWidths( + self_connector_widths, + fine_connector_widths, + *this); + TBOX_ASSERT(self_connector_widths.size() == static_cast(d_max_levels)); + TBOX_ASSERT(fine_connector_widths.size() == static_cast(d_max_levels - 1)); + for (int ln = 0; ln < d_max_levels; ++ln) { + d_self_connector_widths[ln].max(self_connector_widths[ln]); + } + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + d_fine_connector_widths[ln].max(fine_connector_widths[ln]); + } + } + } + + /* + * Make sure the self connector widths are at least as big as + * the fine. This is required because self Connectors at the + * tag level is used to compute the fine Connectors. This + * requirement is due to the GriddingAlgorithm, so perhaps it + * should be moved there! On the other hand, GriddingAlgorithm + * cannot be expected know about fine_connector_width + * requirements of other width requestors. + */ + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + d_self_connector_widths[ln].max(d_fine_connector_widths[ln]); + } + } /* @@ -439,10 +639,9 @@ PatchHierarchy::getConnector( boost::shared_ptr PatchHierarchy::makeRefinedPatchHierarchy( const std::string& fine_hierarchy_name, - const IntVector& refine_ratio, - bool register_for_restart) const + const IntVector& refine_ratio) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, refine_ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, refine_ratio); TBOX_ASSERT(!fine_hierarchy_name.empty()); TBOX_ASSERT(fine_hierarchy_name != d_object_name); TBOX_ASSERT(refine_ratio > IntVector::getZero(refine_ratio.getDim())); @@ -450,17 +649,16 @@ PatchHierarchy::makeRefinedPatchHierarchy( boost::shared_ptr fine_geometry( d_grid_geometry->makeRefinedGridGeometry( fine_hierarchy_name + "GridGeometry", - refine_ratio, - register_for_restart)); + refine_ratio)); PatchHierarchy* fine_hierarchy = new PatchHierarchy(fine_hierarchy_name, fine_geometry, - boost::shared_ptr(), - register_for_restart); + boost::shared_ptr()); // Set hierarchy parameters. + fine_hierarchy->d_number_blocks = d_number_blocks; fine_hierarchy->d_max_levels = d_max_levels; fine_hierarchy->d_ratio_to_coarser = d_ratio_to_coarser; fine_hierarchy->d_smallest_patch_size = d_smallest_patch_size; @@ -471,27 +669,22 @@ PatchHierarchy::makeRefinedPatchHierarchy( d_allow_patches_smaller_than_ghostwidth; fine_hierarchy->d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps; - - for (int ln = 0; ln < d_number_levels; ln++) { - - // SGS TODOD why isn't this a ctor with more args and not all this setting of new_level? - // What happened to ctor is initialization? - boost::shared_ptr new_level( - boost::make_shared(d_dim)); - new_level->setRefinedPatchLevel(d_patch_levels[ln], - refine_ratio, - fine_geometry); - - new_level->setLevelNumber(ln); - new_level->setNextCoarserHierarchyLevelNumber(ln - 1); - new_level->setLevelInHierarchy(true); - new_level->setRatioToCoarserLevel( - d_patch_levels[ln]->getRatioToCoarserLevel()); - if (ln >= fine_hierarchy->d_number_levels) { - fine_hierarchy->d_number_levels = ln + 1; - fine_hierarchy->d_patch_levels.resizeArray(d_number_levels); - } - fine_hierarchy->d_patch_levels[ln] = new_level; + fine_hierarchy->d_grid_geometry->setUpRatios(d_ratio_to_coarser); + + for (int ln = 0; ln < d_number_levels; ++ln) { + BoxContainer refined_boxes(d_patch_levels[ln]->getBoxLevel()->getBoxes()); + refined_boxes.refine(refine_ratio); + boost::shared_ptr refined_box_level( + boost::make_shared( + d_patch_levels[ln]->getBoxLevel()->getRefinementRatio(), + fine_geometry, + d_patch_levels[ln]->getBoxLevel()->getMPI())); + refined_box_level->swapInitialize( + refined_boxes, + d_patch_levels[ln]->getBoxLevel()->getRefinementRatio(), + fine_geometry, + d_patch_levels[ln]->getBoxLevel()->getMPI()); + fine_hierarchy->makeNewPatchLevel(ln, refined_box_level); } return boost::shared_ptr(fine_hierarchy); @@ -510,10 +703,9 @@ PatchHierarchy::makeRefinedPatchHierarchy( boost::shared_ptr PatchHierarchy::makeCoarsenedPatchHierarchy( const std::string& coarse_hierarchy_name, - const IntVector& coarsen_ratio, - bool register_for_restart) const + const IntVector& coarsen_ratio) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, coarsen_ratio); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, coarsen_ratio); TBOX_ASSERT(!coarse_hierarchy_name.empty()); TBOX_ASSERT(coarse_hierarchy_name != d_object_name); TBOX_ASSERT(coarsen_ratio > IntVector::getZero(coarsen_ratio.getDim())); @@ -521,39 +713,38 @@ PatchHierarchy::makeCoarsenedPatchHierarchy( boost::shared_ptr coarse_geometry( d_grid_geometry->makeCoarsenedGridGeometry( coarse_hierarchy_name + "GridGeometry", - coarsen_ratio, - register_for_restart)); + coarsen_ratio)); PatchHierarchy* coarse_hierarchy = new PatchHierarchy(coarse_hierarchy_name, coarse_geometry, - boost::shared_ptr(), - register_for_restart); + boost::shared_ptr()); // Set hierarchy parameters. + coarse_hierarchy->d_number_blocks = d_number_blocks; coarse_hierarchy->d_max_levels = d_max_levels; coarse_hierarchy->d_ratio_to_coarser = d_ratio_to_coarser; coarse_hierarchy->d_smallest_patch_size = d_smallest_patch_size; coarse_hierarchy->d_largest_patch_size = d_largest_patch_size; coarse_hierarchy->d_individual_cwrs = d_individual_cwrs; coarse_hierarchy->d_proper_nesting_buffer = d_proper_nesting_buffer; - - for (int ln = 0; ln < d_number_levels; ln++) { - boost::shared_ptr new_level(new PatchLevel(d_dim)); - new_level->setCoarsenedPatchLevel(d_patch_levels[ln], - coarsen_ratio, - coarse_geometry); - new_level->setLevelNumber(ln); - new_level->setNextCoarserHierarchyLevelNumber(ln - 1); - new_level->setLevelInHierarchy(true); - new_level->setRatioToCoarserLevel( - d_patch_levels[ln]->getRatioToCoarserLevel()); - if (ln >= coarse_hierarchy->d_number_levels) { - coarse_hierarchy->d_number_levels = ln + 1; - coarse_hierarchy->d_patch_levels.resizeArray(d_number_levels); - } - coarse_hierarchy->d_patch_levels[ln] = new_level; + coarse_hierarchy->d_grid_geometry->setUpRatios(d_ratio_to_coarser); + + for (int ln = 0; ln < d_number_levels; ++ln) { + BoxContainer coarsened_boxes(d_patch_levels[ln]->getBoxLevel()->getBoxes()); + coarsened_boxes.coarsen(coarsen_ratio); + boost::shared_ptr coarsened_box_level( + boost::make_shared( + d_patch_levels[ln]->getBoxLevel()->getRefinementRatio(), + coarse_geometry, + d_patch_levels[ln]->getBoxLevel()->getMPI())); + coarsened_box_level->swapInitialize( + coarsened_boxes, + d_patch_levels[ln]->getBoxLevel()->getRefinementRatio(), + coarse_geometry, + d_patch_levels[ln]->getBoxLevel()->getMPI()); + coarse_hierarchy->makeNewPatchLevel(ln, coarsened_box_level); } return boost::shared_ptr(coarse_hierarchy); @@ -571,16 +762,86 @@ PatchHierarchy::makeCoarsenedPatchHierarchy( void PatchHierarchy::makeNewPatchLevel( const int ln, - const BoxLevel& new_mapped_box_level) + const BoxLevel& new_box_level) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, new_mapped_box_level); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, new_box_level); TBOX_ASSERT(ln >= 0); - for (int i = 0; i < d_dim.getValue(); i++) { - TBOX_ASSERT( - new_mapped_box_level.getRefinementRatio() > IntVector::getZero(d_dim)); + TBOX_ASSERT(new_box_level.getRefinementRatio() > IntVector::getZero(d_dim)); + TBOX_ASSERT(new_box_level.getGridGeometry() == d_grid_geometry); + TBOX_ASSERT(d_domain_box_level->getGridGeometry() == d_grid_geometry); + + /* + * Make sure the level conforms to certain parameters preset + * for the hierarchy. We are not (yet) checking everything we + * should. + */ + if (ln >= d_max_levels) { + TBOX_ERROR("PatchHierarchy::makeNewPatchLevel: Cannot make\n" + << "level " << ln << " in a PatchHierarchy with a\n" + << "max of " << d_max_levels << ".\n" + << "Use setMaxNumberOfLevels() to change the max.\n"); + } + + if (ln > 0) { + const IntVector expected_ratio( + d_ratio_to_coarser[ln] * (d_patch_levels[ln - 1]->getRatioToLevelZero())); + if (new_box_level.getRefinementRatio() != expected_ratio) { + TBOX_ERROR("PatchHierarchy::makeNewPatchLevel: patch level " + << ln << " has refinement ratio " + << new_box_level.getRefinementRatio() + << ", it should be " << expected_ratio << std::endl); + } + } + if (static_cast(d_patch_levels.size()) > ln && + d_patch_levels[ln].get() != 0) { + TBOX_ERROR("PatchHierarchy::makeNewPatchLevel: patch level " + << ln << " already exists. " + << "Remove old level from the hierarchy before making " + << "a new level in its place." << std::endl); + } + + if (ln >= d_number_levels) { + d_number_levels = ln + 1; + d_patch_levels.resize(d_number_levels); } -#endif + + d_patch_levels[ln] = d_patch_level_factory->allocate( + new_box_level, + d_grid_geometry, + d_patch_descriptor, + d_patch_factory); + d_patch_levels[ln]->getBoxLevel()->cacheGlobalReducedData(); + + d_patch_levels[ln]->setLevelNumber(ln); + d_patch_levels[ln]->setNextCoarserHierarchyLevelNumber(ln - 1); + d_patch_levels[ln]->setLevelInHierarchy(true); + + if ((ln > 0) && d_patch_levels[ln - 1]) { + IntVector ratio = d_patch_levels[ln]->getRatioToLevelZero() / + d_patch_levels[ln-1]->getRatioToLevelZero(); + d_patch_levels[ln]->setRatioToCoarserLevel(ratio); + } + +} + +/* + ************************************************************************* + * * + * Create a new patch level in the hierarchy. * + * * + ************************************************************************* + */ + +void +PatchHierarchy::makeNewPatchLevel( + const int ln, + const boost::shared_ptr new_box_level) +{ + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *new_box_level); + TBOX_ASSERT(ln >= 0); + TBOX_ASSERT(new_box_level->getRefinementRatio() > IntVector::getZero(d_dim)); + TBOX_ASSERT(new_box_level->getGridGeometry() == d_grid_geometry); + TBOX_ASSERT(d_domain_box_level->getGridGeometry() == d_grid_geometry); /* * Make sure the level conforms to certain parameters preset @@ -596,23 +857,31 @@ PatchHierarchy::makeNewPatchLevel( if (ln > 0) { const IntVector expected_ratio( d_ratio_to_coarser[ln] * (d_patch_levels[ln - 1]->getRatioToLevelZero())); - if (ln > 0 && - (new_mapped_box_level.getRefinementRatio() != expected_ratio)) { + if (new_box_level->getRefinementRatio() != expected_ratio) { TBOX_ERROR("PatchHierarchy::makeNewPatchLevel: patch level " << ln << " has refinement ratio " - << new_mapped_box_level.getRefinementRatio() - << ", it should be " << expected_ratio); + << new_box_level->getRefinementRatio() + << ", it should be " << expected_ratio << std::endl); } } + if (static_cast(d_patch_levels.size()) > ln && + d_patch_levels[ln].get() != 0) { + TBOX_ERROR("PatchHierarchy::makeNewPatchLevel: patch level " + << ln << " already exists. " + << "Remove old level from the hierarchy before making " + << "a new level in its place." << std::endl); + } if (ln >= d_number_levels) { d_number_levels = ln + 1; - d_patch_levels.resizeArray(d_number_levels); + d_patch_levels.resize(d_number_levels); } d_patch_levels[ln] = d_patch_level_factory->allocate( - new_mapped_box_level, - d_grid_geometry, d_patch_descriptor, d_patch_factory); + new_box_level, + d_grid_geometry, + d_patch_descriptor, + d_patch_factory); d_patch_levels[ln]->getBoxLevel()->cacheGlobalReducedData(); d_patch_levels[ln]->setLevelNumber(ln); @@ -620,9 +889,9 @@ PatchHierarchy::makeNewPatchLevel( d_patch_levels[ln]->setLevelInHierarchy(true); if ((ln > 0) && d_patch_levels[ln - 1]) { - d_patch_levels[ln]->setRatioToCoarserLevel( - d_patch_levels[ln]->getRatioToLevelZero() - / (d_patch_levels[ln - 1]->getRatioToLevelZero())); + IntVector ratio = d_patch_levels[ln]->getRatioToLevelZero() / + d_patch_levels[ln-1]->getRatioToLevelZero(); + d_patch_levels[ln]->setRatioToCoarserLevel(ratio); } } @@ -643,59 +912,117 @@ PatchHierarchy::removePatchLevel( d_patch_levels[l].reset(); if (d_number_levels == l + 1) { - d_number_levels--; + --d_number_levels; } } /* ************************************************************************* - * - * Writes out the class version number and the number of levels in the - * hierarchy and has each patch_level write itself out. - * The database keys for the patch levels are given by - * "level#" where # is the level number for the patch_level. - * The patchdata that are written to the database are determined by - * which those bits in the VariableDatabase restart table. - * - * Asserts that the database pointer passed in is not NULL. - * + * Log the given level, its peer connector and if requested, the + * connectors to the next finer and next coarser levels. Connectors + * logged will have width required by the hierarchy. ************************************************************************* */ - void -PatchHierarchy::putToDatabase( - const boost::shared_ptr& database) const +PatchHierarchy::logMetadataStatistics( + const char* note, + int ln, + int cycle, + double level_time, + bool log_fine_connector, + bool log_coarse_connector) const { - putToDatabase(database, - VariableDatabase::getDatabase()->getPatchDataRestartTable()); + const std::string name("L" + tbox::Utilities::levelToString(ln)); + const boost::shared_ptr level = + getPatchLevel(ln); + const BoxLevel& box_level = *level->getBoxLevel(); + + tbox::plog << "PatchHierarchy metadata statistics '" + << note << "', at cycle " << cycle + << ", time " << level_time << ", added " + << name << ":\n" + << box_level.format("\t", 0) + << '\t' << name << " statistics:\n" + << box_level.formatStatistics("\t\t"); + + const Connector& peer_conn = + level->findConnector(*level, + getRequiredConnectorWidth(ln, ln), + CONNECTOR_CREATE, + true); + tbox::plog << "\tL" << ln + << " Peer connector:\n" << peer_conn.format("\t\t", 0) + << "\tL" + << ln << " peer Connector statistics:\n" << peer_conn.formatStatistics("\t\t"); + + if (log_fine_connector) { + const Connector& to_fine = + level->findConnector(*getPatchLevel(ln + 1), + getRequiredConnectorWidth(ln, ln + 1), + CONNECTOR_CREATE, + true); + tbox::plog << "\tL" << ln << "->L" << ln + 1 + << " Connector:\n" << to_fine.format("\t\t", 0) + << "\tL" << ln << "->L" << ln + 1 + << " Connector statistics:\n" << to_fine.formatStatistics("\t\t"); + const Connector& from_fine = + getPatchLevel(ln + 1)->findConnector(*level, + getRequiredConnectorWidth(ln + 1, ln), + CONNECTOR_CREATE, + true); + tbox::plog << "\tL" << ln + 1 << "->L" << ln + << " Connector:\n" << from_fine.format("\t\t", 0) + << "\tL" << ln + 1 << "->L" << ln + << " Connector statistics:\n" << from_fine.formatStatistics("\t\t"); + } + + if (log_coarse_connector) { + const Connector& to_crse = + level->findConnector(*getPatchLevel(ln - 1), + getRequiredConnectorWidth(ln, ln - 1), + CONNECTOR_CREATE, + true); + tbox::plog << "\tL" << ln << "->L" << ln - 1 + << " Connector:\n" << to_crse.format("\t\t", 0) + << "\tL" << ln << "->L" << ln - 1 + << " Connector statistics:\n" << to_crse.formatStatistics("\t\t"); + const Connector& from_crse = + getPatchLevel(ln - 1)->findConnector(*level, + getRequiredConnectorWidth(ln - 1, ln), + CONNECTOR_CREATE, + true); + tbox::plog << "\tL" << ln - 1 << "->L" << ln + << " Connector:\n" << from_crse.format("\t\t", 0) + << "\tL" << ln - 1 << "->L" << ln + << " Connector statistics:\n" << from_crse.formatStatistics("\t\t"); + } } /* ************************************************************************* * - * Writes out the class version number and the number of levels in the - * hierarchy and has each patch_level write itself out. - * The database keys for the patch levels are given by - * "level#" where # is the level number for the patch_level. + * Writes the class version number and the number of levels in the + * hierarchy to the restart database. Each patch_level write itself out + * to the restart database. The database keys for the patch levels are + * given by "level#" where # is the level number for the patch_level. * The patchdata that are written to the database are determined by - * which those bits in the specified ComponentSelector that are - * set. + * which those bits in the VariableDatabase restart table. * - * Asserts that the database pointer passed in is not NULL. + * Asserts that the restart_db pointer passed in is not NULL. * ************************************************************************* */ void -PatchHierarchy::putToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const +PatchHierarchy::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - database->putInteger("HIER_PATCH_HIERARCHY_VERSION", + restart_db->putInteger("HIER_PATCH_HIERARCHY_VERSION", HIER_PATCH_HIERARCHY_VERSION); - database->putInteger("d_number_levels", d_number_levels); + + restart_db->putInteger("d_number_levels", d_number_levels); std::vector level_names(d_max_levels); const std::string prefix("level_"); @@ -706,65 +1033,92 @@ PatchHierarchy::putToDatabase( /* * Write hierarchy parameters. */ - database->putInteger("d_max_levels", d_max_levels); - database->putBool("d_allow_patches_smaller_than_ghostwidth", - d_allow_patches_smaller_than_ghostwidth); - database->putBool("d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps", - d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps); - if (d_max_levels > 1) { - database->putIntegerArray("d_proper_nesting_buffer", - &d_proper_nesting_buffer[0], - static_cast(d_proper_nesting_buffer.size())); - } + restart_db->putInteger("max_levels", d_max_levels); boost::shared_ptr ratio_to_coarser_db( - database->putDatabase("d_ratio_to_coarser")); - for (unsigned int ln = 0; ln < d_ratio_to_coarser.size(); ln++) { - const int* tmp_array = &d_ratio_to_coarser[ln][0]; - ratio_to_coarser_db->putIntegerArray(level_names[ln], tmp_array, + restart_db->putDatabase("ratio_to_coarser")); + for (int ln = 0; ln < d_max_levels; ++ln) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + std::vector ratio_vec(d_dim.getValue()); + for (int d = 0; d < d_dim.getValue(); ++d) { + ratio_vec[d] = (d_ratio_to_coarser[ln](b,d)); + } + std::string level_block_name(level_names[ln]); + level_block_name += "_"; + level_block_name += tbox::Utilities::intToString(static_cast(b)); + ratio_to_coarser_db->putIntegerArray(level_block_name, + &ratio_vec[0], + d_dim.getValue()); + } + } + + boost::shared_ptr smallest_patch_db( + restart_db->putDatabase("smallest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + smallest_patch_db->putIntegerArray(level_names[ln], + &d_smallest_patch_size[ln][0], d_dim.getValue()); } boost::shared_ptr largest_patch_db( - database->putDatabase("d_largest_patch_size")); - for (unsigned int ln = 0; ln < d_largest_patch_size.size(); ln++) { - const int* tmp_array = &d_largest_patch_size[ln][0]; - largest_patch_db->putIntegerArray(level_names[ln], tmp_array, + restart_db->putDatabase("largest_patch_size")); + for (int ln = 0; ln < d_max_levels; ++ln) { + largest_patch_db->putIntegerArray(level_names[ln], + &d_largest_patch_size[ln][0], d_dim.getValue()); } - boost::shared_ptr smallest_patch_db( - database->putDatabase("d_smallest_patch_size")); - for (unsigned int ln = 0; ln < d_smallest_patch_size.size(); ln++) { - const int* tmp_array = &d_smallest_patch_size[ln][0]; - smallest_patch_db->putIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + if (d_max_levels > 1) { + restart_db->putIntegerVector("proper_nesting_buffer", + d_proper_nesting_buffer); } + restart_db->putBool("allow_patches_smaller_than_ghostwidth", + d_allow_patches_smaller_than_ghostwidth); + + restart_db->putBool("allow_patches_smaller_than_minimum_size_to_prevent_overlaps", + d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps); + boost::shared_ptr self_connector_widths_db( - database->putDatabase("d_self_connector_widths")); - for (unsigned int ln = 0; ln < d_self_connector_widths.size(); ln++) { - int* tmp_array = &d_self_connector_widths[ln][0]; - self_connector_widths_db->putIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + restart_db->putDatabase("d_self_connector_widths")); + d_self_connector_widths.resize(d_max_levels, IntVector(d_dim, 1, d_number_blocks)); + for (int ln = 0; ln < d_max_levels; ++ln) { + + std::vector put_self_widths(d_number_blocks * d_dim.getValue()); + int ic = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + put_self_widths[ic] = d_self_connector_widths[ln](b,d); + ++ic; + } + } + self_connector_widths_db->putIntegerVector(level_names[ln], + put_self_widths); } boost::shared_ptr fine_connector_widths_db( - database->putDatabase("d_fine_connector_widths")); - for (unsigned int ln = 0; ln < d_fine_connector_widths.size(); ln++) { - int* tmp_array = &d_fine_connector_widths[ln][0]; - fine_connector_widths_db->putIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + restart_db->putDatabase("d_fine_connector_widths")); + d_fine_connector_widths.resize(d_max_levels-1, IntVector(d_dim, 1, d_number_blocks)); + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + + std::vector put_fine_widths(d_number_blocks * d_dim.getValue()); + int ic = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + put_fine_widths[ic] = d_self_connector_widths[ln](b,d); + ++ic; + } + } + fine_connector_widths_db->putIntegerVector(level_names[ln], + put_fine_widths); } - for (int i = 0; i < d_number_levels; i++) { + for (int i = 0; i < d_number_levels; ++i) { - boost::shared_ptr level_database( - database->putDatabase(level_names[i])); + boost::shared_ptr level_database( + restart_db->putDatabase(level_names[i])); - d_patch_levels[i]->putUnregisteredToDatabase( - level_database, - patchdata_write_table); + d_patch_levels[i]->putToRestart(level_database); } } @@ -783,8 +1137,7 @@ PatchHierarchy::putToDatabase( void PatchHierarchy::getFromRestart() { - - boost::shared_ptr restart_db( + boost::shared_ptr restart_db( tbox::RestartManager::getManager()->getRootDatabase()); if (!restart_db->isDatabase(d_object_name)) { @@ -795,6 +1148,10 @@ PatchHierarchy::getFromRestart() boost::shared_ptr database( restart_db->getDatabase(d_object_name)); + /* + * Read hierarchy paremeters. + */ + int ver = database->getInteger("HIER_PATCH_HIERARCHY_VERSION"); if (ver != HIER_PATCH_HIERARCHY_VERSION) { TBOX_ERROR("PatchHierarchy::getFromRestart error...\n" @@ -802,29 +1159,14 @@ PatchHierarchy::getFromRestart() << " : Restart file version different than class version" << std::endl); } - getFromDatabase( - database, - VariableDatabase::getDatabase()->getPatchDataRestartTable()); -} - -void -PatchHierarchy::getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector) -{ - TBOX_ASSERT(database); - d_number_levels = database->getInteger("d_number_levels"); if (d_number_levels <= 0) { - TBOX_ERROR("PatchHierarchy::getFromDatabase error ...\n" + TBOX_ERROR("PatchHierarchy::getFromRestart error ...\n" << " object name = " << d_object_name - << " : `d_number_levels' is <= zero in restart file"); + << " : `d_number_levels' is <= zero in restart file" << std::endl); } - d_number_levels = tbox::MathUtilities::Min(d_number_levels, - d_max_levels); - - d_patch_levels.resizeArray(d_number_levels); + d_max_levels = database->getInteger("max_levels"); std::vector level_names(d_max_levels); const std::string prefix("level_"); @@ -832,94 +1174,140 @@ PatchHierarchy::getFromDatabase( level_names[ln] = prefix + tbox::Utilities::levelToString(ln); } - /* - * Read hierarchy paremeters. - */ - if (d_max_levels > 0) { - d_max_levels = tbox::MathUtilities::Min( - d_max_levels, database->getInteger("d_max_levels")); - } else { - d_max_levels = database->getInteger("d_max_levels"); - } - - d_allow_patches_smaller_than_ghostwidth = database->getBool( - "d_allow_patches_smaller_than_ghostwidth"); - d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = database->getBool( - "d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps"); - d_proper_nesting_buffer.resize(d_max_levels - 1, 0); - if (d_max_levels > 1) { - database->getIntegerArray("d_proper_nesting_buffer", - &d_proper_nesting_buffer[0], - d_max_levels - 1); + boost::shared_ptr ratio_to_coarser_db( + database->getDatabase("ratio_to_coarser")); + d_ratio_to_coarser.resize(d_max_levels, d_ratio_to_coarser.back()); + for (int ln = 0; ln < d_max_levels; ++ln) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + std::string level_block_name(level_names[ln]); + level_block_name += "_"; + level_block_name += tbox::Utilities::intToString(static_cast(b)); + std::vector ratio_vec(d_dim.getValue()); + ratio_to_coarser_db->getIntegerArray(level_block_name, + &ratio_vec[0], + d_dim.getValue()); + for (int d = 0; d < d_dim.getValue(); ++d) { + d_ratio_to_coarser[ln](b,d) = ratio_vec[d]; + } + } } - boost::shared_ptr ratio_to_coarser_db( - database->getDatabase("d_ratio_to_coarser")); - for (unsigned int ln = 0; ln < d_ratio_to_coarser.size(); ln++) { - int* tmp_array = &d_ratio_to_coarser[ln][0]; - ratio_to_coarser_db->getIntegerArray(level_names[ln], tmp_array, + boost::shared_ptr smallest_patch_db( + database->getDatabase("smallest_patch_size")); + d_smallest_patch_size.resize(d_max_levels, d_smallest_patch_size.back()); + for (int ln = 0; ln < d_max_levels; ++ln) { + smallest_patch_db->getIntegerArray(level_names[ln], + &d_smallest_patch_size[ln][0], d_dim.getValue()); } boost::shared_ptr largest_patch_db( - database->getDatabase("d_largest_patch_size")); - for (unsigned int ln = 0; ln < d_largest_patch_size.size(); ln++) { - int* tmp_array = &d_largest_patch_size[ln][0]; - largest_patch_db->getIntegerArray(level_names[ln], tmp_array, + database->getDatabase("largest_patch_size")); + d_largest_patch_size.resize(d_max_levels, d_largest_patch_size.back()); + for (int ln = 0; ln < d_max_levels; ++ln) { + largest_patch_db->getIntegerArray(level_names[ln], + &d_largest_patch_size[ln][0], d_dim.getValue()); } - boost::shared_ptr smallest_patch_db( - database->getDatabase("d_smallest_patch_size")); - for (unsigned int ln = 0; ln < d_smallest_patch_size.size(); ln++) { - int* tmp_array = &d_smallest_patch_size[ln][0]; - smallest_patch_db->getIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + d_proper_nesting_buffer.resize(d_max_levels - 1, 0); + if (d_max_levels > 1) { + d_proper_nesting_buffer = + database->getIntegerVector("proper_nesting_buffer"); + } + + d_allow_patches_smaller_than_ghostwidth = database->getBool( + "allow_patches_smaller_than_ghostwidth"); + + d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps = + database->getBool( + "allow_patches_smaller_than_minimum_size_to_prevent_overlaps"); + if (d_allow_patches_smaller_than_minimum_size_to_prevent_overlaps) { + TBOX_WARNING( + d_object_name << ": " + << "Allowing patches smaller than the given " + << "smallest patch size. Note: If periodic " + << "boundary conditions are used, this flag is " + << "ignored in the periodic directions." << std::endl); } boost::shared_ptr self_connector_widths_db( database->getDatabase("d_self_connector_widths")); - for (unsigned int ln = 0; ln < d_self_connector_widths.size(); ln++) { - int* tmp_array = &d_self_connector_widths[ln][0]; - self_connector_widths_db->getIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + d_self_connector_widths.resize(d_max_levels, IntVector(d_dim, 1, d_number_blocks)); + for (int ln = 0; ln < d_max_levels; ++ln) { + std::vector get_self_widths = + self_connector_widths_db->getIntegerVector(level_names[ln]); + + d_self_connector_widths[ln] = IntVector(d_dim, 0, d_number_blocks); + int ic = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + d_self_connector_widths[ln](b,d) = get_self_widths[ic]; + ++ic; + } + } } boost::shared_ptr fine_connector_widths_db( database->getDatabase("d_fine_connector_widths")); - for (unsigned int ln = 0; ln < d_fine_connector_widths.size(); ln++) { - int* tmp_array = &d_fine_connector_widths[ln][0]; - fine_connector_widths_db->getIntegerArray(level_names[ln], tmp_array, - d_dim.getValue()); + d_fine_connector_widths.resize(d_max_levels - 1, IntVector(d_dim, 1, d_number_blocks)); + for (int ln = 0; ln < d_max_levels - 1; ++ln) { + std::vector get_fine_widths = + fine_connector_widths_db->getIntegerVector(level_names[ln]); + + d_fine_connector_widths[ln] = IntVector(d_dim, 0, d_number_blocks); + int ic = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + d_fine_connector_widths[ln](b,d) = get_fine_widths[ic]; + ++ic; + } + } + } +} + +void +PatchHierarchy::initializeHierarchy() +{ + boost::shared_ptr restart_db( + tbox::RestartManager::getManager()->getRootDatabase()); + + if (!restart_db->isDatabase(d_object_name)) { + TBOX_ERROR("PatchHierarchy::initializeHierarchy() error...\n" + << " Restart database with name " + << d_object_name << " not found in restart file" << std::endl); } + boost::shared_ptr database( + restart_db->getDatabase(d_object_name)); - for (int i = 0; i < d_number_levels; i++) { + d_patch_levels.resize(d_number_levels); + for (int i = 0; i < d_number_levels; ++i) { + std::string level_name = "level_" + tbox::Utilities::levelToString(i); - boost::shared_ptr level_database( - database->getDatabase(level_names[i])); + boost::shared_ptr level_database( + database->getDatabase(level_name)); d_patch_levels[i] = d_patch_level_factory->allocate( level_database, d_grid_geometry, d_patch_descriptor, - component_selector, d_patch_factory, false); } /* * Compute Connectors. - * BTNG FIXME: This should be replaced by writing edges to + * BTNG TODO: This should be replaced by writing edges to * restart and reading them back. */ for (int i = 0; i < d_number_levels; ++i) { - for (int j = i - 1; j <= i + 1; ++j) { - if (j >= 0 && j < d_number_levels) { - const IntVector connector_width = getRequiredConnectorWidth(i, j); - d_patch_levels[i]->getBoxLevel()-> - getPersistentOverlapConnectors().findOrCreateConnector( - *d_patch_levels[j]->getBoxLevel(), - connector_width); - } + d_patch_levels[i]->findConnector(*d_patch_levels[i], + getRequiredConnectorWidth(i, i), + CONNECTOR_CREATE); + if (i < d_number_levels - 1) { + d_patch_levels[i]->findConnectorWithTranspose(*d_patch_levels[i + 1], + getRequiredConnectorWidth(i, i + 1), + getRequiredConnectorWidth(i + 1, i), + CONNECTOR_CREATE); } } @@ -931,10 +1319,10 @@ PatchHierarchy::recursivePrint( const std::string& border, int depth) { - int totl_npatches = 0; - int totl_ncells = 0; + size_t totl_npatches = 0; + size_t totl_ncells = 0; int nlevels = getNumberOfLevels(); - os << border << "Domain of hierarchy:\n" << d_domain_mapped_box_level.format(border, 2) << '\n' + os << border << "Domain of hierarchy:\n" << d_domain_box_level->format(border, 2) << '\n' << border << "Number of levels = " << nlevels << '\n'; if (depth > 0) { int ln; @@ -957,5 +1345,3 @@ PatchHierarchy::ConnectorWidthRequestorStrategy::~ConnectorWidthRequestorStrateg } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.h index 8462ee5a..6a09f294 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchHierarchy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An AMR hierarchy of patch levels * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/ComponentSelector.h" #include "SAMRAI/hier/BaseGridGeometry.h" @@ -22,12 +21,15 @@ #include "SAMRAI/hier/PatchFactory.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/PatchLevelFactory.h" +#include "SAMRAI/hier/PersistentOverlapConnectors.h" +#include "SAMRAI/hier/UncoveredBoxIterator.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace hier { @@ -36,79 +38,137 @@ namespace hier { * @brief Class PatchHierarchy maintains the patch levels that * define the AMR hierarchy. * - * The following describes the input file keys and data types. For each - * input key that involves input for levels in the hierarchy, assume that - * we have N levels, numbered coarsest to finest as 0,..., N-1. For such - * input, the value for a level must be given as ``level_n = value'' where + * Input Parameters
    + * For ratio_to_coarser, smallest_patch_size, and largest_patch_size assume + * that we have N levels numbered coarsest to finest as 0,..., N-1. For these + * inputs, the value for a level must be given as ``level_n = value'' where * n is the level number. When more values are given than needed for the * maximum number of levels, extra values are ignored. When fewer values * are given, the last value provided will be used on each level without a * specified input value. See example input below. * + * Definitions: * - \b max_levels - * Integer value specifying maximum number of levels - * allowed in the AMR patch hierarchy. + * specifies maximum number of levels allowed in the AMR patch hierarchy. * * - \b ratio_to_coarser - * A set of max_levels - 1 integer vectors (each has length = DIM), - * each of which indicates the ratio of the index space of a patch - * level to that of the next coarser level in the hierarchy. The - * input is given for each level n, where n (= 1, 2,..., N-1) is the - * level number. - * - * - \b largest_patch_size - * A set of max_levels integer vectors (each has length = DIM) each of - * which indicates the dimensions of largest patch allowed on the level - * in the hierarchy. Non-positive values for patch size corresponds to - * no upper limit on patch size. The input is given for each level n, - * where n (= 0, 1,..., N-1) is the level number. + * A set of max_levels - 1 integer arrays each with length = DIM, each of + * which indicates the ratio of the index space of a patch level to that + * of the next coarser level in the hierarchy. The input is given for + * each level n, where n (= 1, 2,..., N-1) is the level number. * * - \b smallest_patch_size - * A set of max_levels integer vectors (each has length = DIM) each of - * which indicates the dimensions of smallest patch allowed on the level - * in the hierarchy. The smallest patch allowed must be at least as - * large as the maximum ghost cell width for all variables in the problem. - * If some smaller patch size is given in input, then it will be - * overridden by the maximum ghost width. If no input is given, a - * default of the maximum ghost cell width over all variables is used. - * The input is given for each level n, where n (= 0, 1,..., N-1) is - * the level number. + * A set of max_levels integer vectors each with length = DIM, each of + * which indicates the size of smallest patch allowed on the level in the + * hierarchy. The smallest patch allowed must be at least as large as the + * maximum ghost cell width for all variables in the problem. If some + * smaller patch size is given in input, then it will be overridden by the + * maximum ghost width. If no input is given, a default of the maximum + * ghost cell width over all variables is used. The input is given for + * each level n, where n (= 0, 1,..., N-1) is the level number. + * + * - \b largest_patch_size + * A set of max_levels integer vectors each with length = DIM, each of + * which indicates the size of largest patch allowed on the level in the + * hierarchy. Negative values for patch size corresponds to no upper + * limit on patch size. The input is given for each level n, where + * n (= 0, 1,..., N-1) is the level number. * * - \b proper_nesting_buffer - * A set of max_levels - 1 integer values specifying the number of - * coarse cells by which the next finer level is nested within the - * interior of the union of the patches on the next coarser level. - * The input is given for each level n, where n (= 0, 1,..., N-2) is - * the level number. + * A set of max_levels - 1 integer values specifying the number of coarse + * cells by which the next finer level is nested within the interior of + * the union of the patches on the next coarser level. The input is given + * for each level n, where n (= 0, 1,..., N-2) is the level number. * * - \b allow_patches_smaller_than_ghostwidth - * A boolean value ("TRUE" or "FALSE") indicating whether patches - * are allowed that are smaller than the maximum variable ghost width - * along some coordinate direction. Recall that when a smallest - * patch size provided in the input file is smaller than the maximum - * ghost width of all the registered variables, then by default the - * smallest patch size will be set to the maximum ghost width. Set this - * flag to TRUE to override this default behavior and to allow the + * indicates whether patches are allowed that are smaller than the maximum + * variable ghost width along some coordinate direction. Recall that when + * a smallest patch size provided in the input file is smaller than the + * maximum ghost width of all the registered variables, then by default + * the smallest patch size will be set to the maximum ghost width. Set + * this flag to TRUE to override this default behavior and to allow the * smallest patch size given in the input to remain in effect. - * The default value is FALSE. * * - \b allow_patches_smaller_than_minimum_size_to_prevent_overlaps - * A boolean value ("TRUE" or "FALSE") indicating whether patches - * are allowed to be smaller than the minimum patch size to prevent - * overlapping patches. In order to enforce minimum patch size - * restrictions, boxes may be grown during adaptive gridding operations. - * This may lead to patches whose boxes overlap. This may be a problem - * for some applications. If overlaps are undesirable and you are - * willing to relax the minimum size constraints, set this parameter - * TRUE. By default, it is FALSE. + * indicates whether patches are allowed to be smaller than the minimum + * patch size to prevent overlapping patches. In order to enforce minimum + * patch size restrictions, boxes may be grown during adaptive gridding + * operations. This may lead to patches whose boxes overlap. This may be + * a problem for some applications. If overlaps are undesirable and you + * are willing to relax the minimum size constraints, set this parameter + * TRUE. * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. + * Details: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    max_levelsint>01optMay be made smaller by input db on restart
    ratio_to_coarsermax_levels-1 int[]all values 1all values >0optMay not be modified by input db on restart
    smallest_patch_sizemax_levels int[]all values 1all values >0optParameter read from restart db may be overridden by input db
    largest_patch_sizemax_levels int[]all values max inteach value >=0 must be >= corresponding smallest_patch_size valueoptParameter read from restart db may be overridden by input db
    proper_nesting_bufferint[]all values 1all values >=0optMay not be modified by input db on restart
    allow_patches_smaller_than_ghostwidthboolFALSETRUE, FALSEoptMay not be modified by input db on restart
    allow_patches_smaller_than_minimum_size_to_prevent_overlapboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
    * * The following represents sample input data for a three-dimensional problem: * * @code - * * // Required input: maximum number of levels in patch hierarchy * max_levels = 4 * @@ -134,18 +194,17 @@ namespace hier { * * // Optional input: buffer of one cell used on each level * proper_nesting_buffer = 1 - * * @endcode * - * @see hier::PatchLevel - * @see hier::PatchDescriptor + * @see PatchLevel + * @see PatchDescriptor */ class PatchHierarchy:public tbox::Serializable { public: /* - * TODO: There must be a better way to do what this base class + * TODO: There must be a better way to do what this class * provides. If not, then we need to make this documentation clearer. * Specifically, it is not clear how one actually determines the * correct width information to provide. Also, the documentation @@ -169,7 +228,7 @@ class PatchHierarchy:public tbox::Serializable * or if the code building the hierarchy does not provide Connectors * of sufficient widths, SAMRAI will still work but will not scale * well. The mechanism for generating missing Connectors as needed - * is in the class PersistentOverlapConnector. + * is in the class PersistentOverlapConnectors. * * The user of a PatchHierarchy object registers implementations of * this strategy class with the PatchHierarchy. See @@ -253,25 +312,20 @@ class PatchHierarchy:public tbox::Serializable * * The constructor for the PatchHierarchy initializes the number of * levels to zero, sets the geometry for the PatchHierarchy, and - * registers the PatchHierarchy for restart with the specified name - * by default. - * - * @par Errors/Assertions - * Passing in an empty std::string or a null grid geometry pointer - * will result in an unrecoverable assertion when assertion checking is - * active. + * registers the PatchHierarchy for restart with the specified name. * * @param[in] object_name * @param[in] geometry - * @param[in] database Database specifying hierarchy parameters. - * @param[in] register_for_restart @b Default: true + * @param[in] input_db Input database specifying hierarchy parameters. + * + * @pre !object_name.empty() + * @pre geometry */ PatchHierarchy( const std::string& object_name, const boost::shared_ptr& geometry, - const boost::shared_ptr& database = - boost::shared_ptr(), - bool register_for_restart = true); + const boost::shared_ptr& input_db = + boost::shared_ptr()); /*! * @brief Destructor for PatchHierarchy. @@ -298,13 +352,16 @@ class PatchHierarchy:public tbox::Serializable * * @param[in] fine_hierarchy_name * @param[in] refine_ratio - * @param[in] register_for_restart + * + * @pre getDim() == refine_ratio.getDim() + * @pre !fine_hierarchy_name.empty() + * @pre fine_hierarchy_name != getObjectName() + * @pre refine_ratio > IntVector::getZero(refine_ratio.getDim()) */ boost::shared_ptr makeRefinedPatchHierarchy( const std::string& fine_hierarchy_name, - const IntVector& refine_ratio, - bool register_for_restart) const; + const IntVector& refine_ratio) const; /*! * @brief Create a coarsened version of this patch hierarchy. @@ -327,31 +384,66 @@ class PatchHierarchy:public tbox::Serializable * * @param[in] coarse_hierarchy_name * @param[in] coarsen_ratio - * @param[in] register_for_restart + * + * @pre getDim() == coarsen_ratio.getDim() + * @pre !coarse_hierarchy_name.empty() + * @pre coarse_hierarchy_name != getObjectName() + * @pre coarsen_ratio > IntVector::getZero(coarsen_ratio.getDim()) */ boost::shared_ptr makeCoarsenedPatchHierarchy( const std::string& coarse_hierarchy_name, - const IntVector& coarsen_ratio, - bool register_for_restart) const; + const IntVector& coarsen_ratio) const; -/* - * TODO: Is it an error to call this method when a level with the given - * level number already exists? Are some preconditions assumed? - */ -/*! - * @brief Construct new PatchLevel in hierarchy at given level number. - * - * Boxes, their mappings and the refinement ratio are obtained from - * @c new_mapped_box_level. - * - * @param[in] level_number - * @param[in] new_mapped_box_level - */ - void + /*! + * @brief Construct new PatchLevel in hierarchy at given level number. + * + * This method results in the new PatchLevel making a COPY of the supplied + * BoxLevel. If the caller intends to modify the supplied BoxLevel for + * other purposes after making the new PatchLevel, then this method must be + * used rather than the method taking a boost::shared_ptr. + * + * Boxes, their mappings and the refinement ratio are obtained from + * @c new_box_level. + * + * @param[in] level_number + * @param[in] new_box_level + * + * @pre getDim() == new_box_level.getDim() + * @pre level_number >= 0 && ln < getMaxNumberOfLevels() + * @pre new_box_level.getRefinementRatio() > IntVector::getZero(getDim()) + */ + virtual void + makeNewPatchLevel( + const int level_number, + const BoxLevel& new_box_level); + + /*! + * @brief Construct new PatchLevel in hierarchy at given level number. + * + * This method results in the new PatchLevel ACQUIRING the supplied + * BoxLevel. If the caller will not modify the supplied BoxLevel for other + * purposes after making the new PatchLevel, then this method may be used + * rather than the method taking a BoxLevel&. Use of this method where + * permitted is more efficient as it avoids copying an entire BoxLevel. + * Note that this method results in the supplied BoxLevel being locked so + * that any attempt by the caller to modify it after calling this method + * will result in an unrecoverable error. + * + * Boxes, their mappings and the refinement ratio are obtained from + * @c new_box_level. + * + * @param[in] level_number + * @param[in] new_box_level + * + * @pre getDim() == new_box_level->getDim() + * @pre level_number >= 0 && ln < getMaxNumberOfLevels() + * @pre new_box_level->getRefinementRatio() > IntVector::getZero(getDim()) + */ + virtual void makeNewPatchLevel( const int level_number, - const BoxLevel& new_mapped_box_level); + const boost::shared_ptr new_box_level); /*! * @brief Remove a patch level @@ -360,8 +452,10 @@ class PatchHierarchy:public tbox::Serializable * accordingly. * * @param[in] level + * + * @pre (level >= 0) && (level < getNumberOfLevels()) */ - void + virtual void removePatchLevel( const int level); @@ -371,12 +465,14 @@ class PatchHierarchy:public tbox::Serializable * @return a pointer to the specified patch level. * * @param[in] level + * + * @pre (level >= 0) && (level < getNumberOfLevels()) */ boost::shared_ptr getPatchLevel( const int level) const { - TBOX_ASSERT((level >= 0) && (level < d_number_levels)); + TBOX_ASSERT((level >= 0) && (level < getNumberOfLevels())); return d_patch_levels[level]; } @@ -404,7 +500,7 @@ class PatchHierarchy:public tbox::Serializable levelExists( const int level) const { - return (level < d_number_levels) && d_patch_levels[level]; + return (level < getNumberOfLevels()) && d_patch_levels[level]; } /*! @@ -420,7 +516,7 @@ class PatchHierarchy:public tbox::Serializable finerLevelExists( const int level) const { - return (level + 1 < d_number_levels) && d_patch_levels[level + 1]; + return (level + 1 < getNumberOfLevels()) && d_patch_levels[level + 1]; } /*! @@ -443,15 +539,23 @@ class PatchHierarchy:public tbox::Serializable int getFinestLevelNumber() const { - return d_number_levels - 1; + return getNumberOfLevels() - 1; } + size_t + getNumberBlocks() const + { + return d_number_blocks; + } + /*! * @brief Check whether specified level can be refined. * * @return true if level associated with the specified level number can * be refined; i.e., the level number is less than that of the finest * level allowed in the hierarchy. Otherwise, false is returned. + * + * @pre level_number >= 0 */ bool levelCanBeRefined( @@ -475,24 +579,6 @@ class PatchHierarchy:public tbox::Serializable return d_patch_levels[level]->getBoxLevel(); } - /*! - * @brief Get the connector between two levels - * - * Get const access to the Connector between two given BoxLevels - * between two given levels in the hierarchy. - * - * @return Connector between the two given level numbers. - * - * @param[in] base_ln The base level indicating one end of the - * connector. - * @param[in] head_ln The head level indicating the other end of - * the connector. - */ - const Connector& - getConnector( - const int base_ln, - const int head_ln) const; - //@{ //! @name Connector width coordination between hierarchy builders and users. @@ -510,11 +596,9 @@ class PatchHierarchy:public tbox::Serializable * All registrations must occur before the first call to * getRequiredConnectorWidth(). * - * @par Errors/Assertions - * Calling this method after the first getRequiredConnectorWidth() - * results in an unrecoverable assertion. - * * @param[in] cwrs The connector width requester strategy instance. + * + * @pre d_connector_widths_committed */ void registerConnectorWidthRequestor( @@ -526,15 +610,30 @@ class PatchHierarchy:public tbox::Serializable * * The two level numbers must differ by no more than one. * + * The @b commit flag tells the hierarchy whether the calling code + * is commiting to the required widths in such a way that would + * break if this method later returns a bigger value. Once this + * method is called with commit = true, the hierarchy will always + * return the same width for the same pair of level numbers. Thus + * the hierarchy would not allow any changes that could result in + * changing the required widths. + * * @return The widths required from the base to head levels. * * @param[in] base_ln * @param[in] head_ln + * @param[in] commit Set to true if you want all future + * return values to be the same for the same level numbers. + * + * @pre (head_ln >= 0) && (head_ln < getMaxNumberOfLevels()) + * @pre (base_ln >= 0) && (base_ln < getMaxNumberOfLevels()) + * @pre abs(base_ln - head_ln) <= 1 */ IntVector getRequiredConnectorWidth( int base_ln, - int head_ln) const; + int head_ln, + bool commit = false) const; /*! * @brief Add a ConnectorWidthRequestorStrategy implementation to @@ -558,14 +657,14 @@ class PatchHierarchy:public tbox::Serializable * @brief Access the domain description as a BoxLevel. * * The domain BoxLevel is maintained in Globalized mode with - * processor 0 owning all mapped boxes. + * processor 0 owning all boxes. * * @return The domain description as a BoxLevel */ const BoxLevel& getDomainBoxLevel() const { - return d_domain_mapped_box_level; + return *d_domain_box_level; } /*! @@ -575,7 +674,7 @@ class PatchHierarchy:public tbox::Serializable const tbox::SAMRAI_MPI& getMPI() const { - return d_domain_mapped_box_level.getMPI(); + return d_domain_box_level->getMPI(); } //@{ @@ -610,7 +709,7 @@ class PatchHierarchy:public tbox::Serializable d_proper_nesting_buffer.resize( d_max_levels - 1, d_proper_nesting_buffer.empty() ? - 1 : d_proper_nesting_buffer.back()); + 1 : d_proper_nesting_buffer.back()); } } @@ -632,13 +731,15 @@ class PatchHierarchy:public tbox::Serializable * * @param[in] ratio Refinement ratio in each direction * @param[in] level + * + * @pre (level > 0) && (level < getMaxNumberOfLevels()) */ void setRatioToCoarserLevel( const IntVector& ratio, int level) { - TBOX_ASSERT(level > 0 && level < d_max_levels); + TBOX_ASSERT(level > 0 && level < getMaxNumberOfLevels()); d_ratio_to_coarser[level] = ratio; } @@ -648,12 +749,14 @@ class PatchHierarchy:public tbox::Serializable * @return The ratio between specified @c level and @ level-1 * * @param[in] level + * + * @pre level < getMaxNumberOfLevels() */ const IntVector& getRatioToCoarserLevel( int level) const { - TBOX_ASSERT(level < d_max_levels); + TBOX_ASSERT(level < getMaxNumberOfLevels()); return d_ratio_to_coarser[level]; } @@ -662,13 +765,15 @@ class PatchHierarchy:public tbox::Serializable * * @param[in] size Smallest size in each direction * @param[in] level + * + * @pre (level >= 0) && (level < getMaxNumberOfLevels()) */ void setSmallestPatchSize( const IntVector& size, int level) { - TBOX_ASSERT(level >= 0 && level < d_max_levels); + TBOX_ASSERT(level >= 0 && level < getMaxNumberOfLevels()); d_smallest_patch_size[level] = size; } @@ -678,12 +783,14 @@ class PatchHierarchy:public tbox::Serializable * @return The smallest patch size allowed on the given level. * * @param[in] level + * + * @pre (level >= 0) && (level < getMaxNumberOfLevels()) */ const IntVector& getSmallestPatchSize( int level) const { - TBOX_ASSERT(level >= 0 && level < d_max_levels); + TBOX_ASSERT(level >= 0 && level < getMaxNumberOfLevels()); return d_smallest_patch_size[level]; } @@ -692,13 +799,15 @@ class PatchHierarchy:public tbox::Serializable * * @param[in] size Largest size in each direction. * @param[in] level + * + * @pre (level >= 0) && (level < getMaxNumberOfLevels()) */ void setLargestPatchSize( const IntVector& size, int level) { - TBOX_ASSERT(level >= 0 && level < d_max_levels); + TBOX_ASSERT(level >= 0 && level < getMaxNumberOfLevels()); d_largest_patch_size[level] = size; } @@ -708,12 +817,14 @@ class PatchHierarchy:public tbox::Serializable * @return The largest patch size allowed on the given level. * * @param[in] level + * + * @pre (level >= 0) && (level < getMaxNumberOfLevels()) */ const IntVector& getLargestPatchSize( int level) const { - TBOX_ASSERT(level >= 0 && level < d_max_levels); + TBOX_ASSERT(level >= 0 && level < getMaxNumberOfLevels()); return d_largest_patch_size[level]; } @@ -730,13 +841,15 @@ class PatchHierarchy:public tbox::Serializable * @return The proper nesting buffer * * @param[in] ln + * + * @pre (ln >= 0) && (ln < getMaxNumberOfLevels()) */ int getProperNestingBuffer( int ln) const { - TBOX_ASSERT(ln >= 0 && ln < d_max_levels); - return (ln < d_max_levels - 1) ? d_proper_nesting_buffer[ln] : -1; + TBOX_ASSERT(ln >= 0 && ln < getMaxNumberOfLevels()); + return (ln < getMaxNumberOfLevels() - 1) ? d_proper_nesting_buffer[ln] : -1; } /*! @@ -805,9 +918,32 @@ class PatchHierarchy:public tbox::Serializable return d_grid_geometry; } + /*! + * @brief Log metadata statistics. + * + * This is for diagnostic purposes, to be used by developers. Log + * the statistics for a given level in the hierarchy and Connectors + * from it. + * + * @param note Note to be written out. + * @param ln Level number to log + * @param cycle + * @param level_time + * @param log_fine_connector + * @param log_coarse_connector + */ + void + logMetadataStatistics( + const char* note, + int ln, + int cycle, + double level_time, + bool log_fine_connector, + bool log_coarse_connector) const; + /*! * @brief Writes the state of the PatchHierarchy object and the PatchLevels - * it contains to the database. + * it contains to the restart database. * * @note * Only those patch data which have been registered for restart with @@ -815,43 +951,17 @@ class PatchHierarchy:public tbox::Serializable * This method implements the pure virtual method in tbox::Serializable * class which is used by the tbox::RestartManager for writing the * PatchHierarchy to a restart file. - * @par Assertions - * When assertion checking is active, the database pointer must be non-null. * - * @param[out] database - */ - void - putToDatabase( - const boost::shared_ptr& database) const; - - /*! - * @brief Read in the entire hierarchy from the restart file. - * - * The database from which the restart data is read is determined by the - * object_name specified in the constructor. + * @param[out] restart_db * - * @note - *
      - *
    • This method handles the memory allocation for each PatchLevel - * it reads in. - *
    • The number of levels read in is the minimum of the d_max_levels - * and the number of levels stored in the database. - *
    - * - * @par Assertions - * When assertion checking is active, @c d_max_levels must be - * greater than zero. An unrecoverable assertion will result if the - * database cannot be found in the restart file or the data in the - * restart file is erroneous. + * @pre restart_db */ void - getFromRestart(); + putToRestart( + const boost::shared_ptr& restart_db) const; /*! - * @brief Read in the entire hierarchy from the specified database. - * - * The component_selector specifies which patch data components - * to read in from the database. + * @brief Read in the entire hierarchy from the restart database. * * @note *
      @@ -865,17 +975,11 @@ class PatchHierarchy:public tbox::Serializable * @par Assertions * *
        - *
      • The database argument must not be null. *
      • The number of levels (if given) must be greater than zero. *
      - * - * @param[in] database - * @param[in] component_selector */ void - getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector); + initializeHierarchy(); /*! * @brief Get the dimension of this object. @@ -925,55 +1029,63 @@ class PatchHierarchy:public tbox::Serializable return d_object_name; } + /*! + * @brief Returns an iterator to the first uncovered Box in this hierarchy. + */ + UncoveredBoxIterator + beginUncovered() + { + return UncoveredBoxIterator(this, true); + } + + /*! + * @brief Returns an iterator to the last uncovered Box in this hierarchy. + */ + UncoveredBoxIterator + endUncovered() + { + return UncoveredBoxIterator(this, false); + } + private: /* * Static integer constant describing class's version number. */ static const int HIER_PATCH_HIERARCHY_VERSION; - /*! - * @brief Writes the state of the PatchHierarchy object and the PatchLevels - * it contains to the database. - * - * Only those patch data indicated in the ComponentSelector are written to - * the specified database. - * - * @par Assertions - * When assertion checking is active, the database pointer must be non-null. - * - * @param[out] database - * @param[in] patchdata_write_table + /* + * Compute required Connector widths using all the registered + * ConnectorWidthRequestorStrategy objects. */ void - putToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const; + computeRequiredConnectorWidths() const; /*! * @brief Read input data from specified database and initialize * class members. * - * When assertion checking is active, the database pointer must be - * non-null. - * - * @param[in] database Input database + * @param[in] input_db Input database + * @param[in] is_from_restart True is being invoked on restart */ void getFromInput( - const boost::shared_ptr& database); + const boost::shared_ptr& input_db, + bool is_from_restart); /*! - * @brief Set up things for the entire class. + * @brief Read in the entire hierarchy from the restart file. * - * Only called by StartupShutdownManager. + * The database from which the restart data is read is determined by the + * object_name specified in the constructor. + * + * @par Assertions + * When assertion checking is active, @c d_max_levels must be + * greater than zero. An unrecoverable assertion will result if the + * database cannot be found in the restart file or the data in the + * restart file is erroneous. */ - static void - initializeCallback() - { - /* - * No-op. This class doesn't - */ - } + void + getFromRestart(); /*! * @brief Free static timers. @@ -993,22 +1105,20 @@ class PatchHierarchy:public tbox::Serializable */ const tbox::Dimension d_dim; - /*! - * @brief Boolean telling if object is registered for restart - */ - bool d_registered_for_restart; - /*! * @brief Number of levels currently in the hierarchy */ int d_number_levels; - int d_number_blocks; + /*! + * @brief Number of blocks in the grid represented by the hierarchy. + */ + size_t d_number_blocks; /*! * @brief Array of pointers to PatchLevels that make up the hierarchy */ - tbox::Array > d_patch_levels; + std::vector > d_patch_levels; /*! * @brief BaseGridGeometry that was used to construct the hierarchy @@ -1106,7 +1216,7 @@ class PatchHierarchy:public tbox::Serializable * * This is mutable because it may have to be updated by * getRequiredConnectorWidth(), which is a const method. - * + * * See registerConnectorWidthRequestor() and getRequiredConnectorWidth(). */ mutable std::vector d_self_connector_widths; @@ -1126,12 +1236,16 @@ class PatchHierarchy:public tbox::Serializable mutable std::vector d_fine_connector_widths; /*! - * @brief Whether Connector widths have been computed. + * @brief Whether Connector widths have been cached. * * This is mutable because it is computed as required by the const - * method getConnectorWidth(). + * method getRequiredConnectorWidth(). Once someone indicates that + * the results of getRequiredConnectorWidth() has been cached, this + * flag becomes true and the hierarchy will not recompute the + * required widths or allow more ConnectorWidthRequestorStrategy + * registration so that the cached value would not be invalidated. */ - mutable bool d_connector_widths_are_computed; + mutable bool d_connector_widths_committed; /*! * @brief Vector of all ConnectorWidthRequestorStrategy objects registered @@ -1155,8 +1269,7 @@ class PatchHierarchy:public tbox::Serializable /*! * @brief Shutdown handler for clearing out static registry. */ - static tbox::StartupShutdownManager::Handler - s_initialize_finalize_handler; + static tbox::StartupShutdownManager::Handler s_finalize_handler; //@} @@ -1167,7 +1280,7 @@ class PatchHierarchy:public tbox::Serializable /* * TODO: These things (if really needed) should be moved to the * BaseGridGeometry class. However, the BaseGridGeometry object cannot own a - * MappedBoxLevel because the BaseGridGeometry object is incapable of creating + * BoxLevel because the BaseGridGeometry object is incapable of creating * a boost::shared_ptr to itself. Might need to change BoxLevel to take a raw * pointer to BaseGridGeometry. */ @@ -1175,13 +1288,13 @@ class PatchHierarchy:public tbox::Serializable /*! * @brief Physical domain BoxLevel. * - * All mapped_boxes in the domain + * All boxes in the domain * BoxLevel are owned by process 0. * * The physical domain BoxLevel is maintained in GLOBALIZED - * mode with processor 0 owning all mapped boxes. + * mode with processor 0 owning all boxes. */ - BoxLevel d_domain_mapped_box_level; + boost::shared_ptr d_domain_box_level; //@} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.C index ebc48cf4..085b9c35 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A collection of patches at one level of the AMR hierarchy * ************************************************************************/ - -#ifndef included_hier_PatchLevel_C -#define included_hier_PatchLevel_C - #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -19,7 +15,7 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/RealBoxConstIterator.h" -#include +#include "boost/make_shared.hpp" #include #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -35,13 +31,13 @@ namespace hier { const int PatchLevel::HIER_PATCH_LEVEL_VERSION = 3; -static boost::shared_ptr t_level_constructor; -static boost::shared_ptr t_constructor_setup; -static boost::shared_ptr t_constructor_phys_domain; -static boost::shared_ptr t_constructor_touch_boundaries; -static boost::shared_ptr t_constructor_set_geometry; -static boost::shared_ptr t_set_patch_touches; -static boost::shared_ptr t_constructor_compute_shifts; +boost::shared_ptr PatchLevel::t_level_constructor; +boost::shared_ptr PatchLevel::t_constructor_setup; +boost::shared_ptr PatchLevel::t_constructor_phys_domain; +boost::shared_ptr PatchLevel::t_constructor_touch_boundaries; +boost::shared_ptr PatchLevel::t_constructor_set_geometry; +boost::shared_ptr PatchLevel::t_set_patch_touches; +boost::shared_ptr PatchLevel::t_constructor_compute_shifts; tbox::StartupShutdownManager::Handler PatchLevel::s_initialize_finalize_handler( @@ -89,45 +85,43 @@ PatchLevel::PatchLevel( */ PatchLevel::PatchLevel( - const BoxLevel& mapped_box_level, + const BoxLevel& box_level, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory, bool defer_boundary_box_creation): d_dim(grid_geometry->getDim()), - d_mapped_box_level(boost::make_shared(mapped_box_level)), + d_box_level(boost::make_shared(box_level)), d_has_globalized_data(false), - d_ratio_to_level_zero(d_mapped_box_level->getRefinementRatio()), + d_ratio_to_level_zero(d_box_level->getRefinementRatio()), d_factory(factory ? factory : boost::make_shared()), d_physical_domain(grid_geometry->getNumberBlocks()), - d_ratio_to_coarser_level(grid_geometry->getDim(), 0) - + d_ratio_to_coarser_level(grid_geometry->getDim(), 0, grid_geometry->getNumberBlocks()) { d_number_blocks = grid_geometry->getNumberBlocks(); - TBOX_DIM_ASSERT_CHECK_ARGS2(mapped_box_level, *grid_geometry); + TBOX_ASSERT_OBJDIM_EQUALITY2(box_level, *grid_geometry); t_level_constructor->start(); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(grid_geometry); TBOX_ASSERT(descriptor); /* * All components of ratio must be nonzero. Additionally, all components * of ratio not equal to 1 must have the same sign. */ - TBOX_ASSERT(mapped_box_level.getRefinementRatio() != - IntVector::getZero(getDim())); - - if (getDim().getValue() > 1) { - for (int i = 0; i < getDim().getValue(); i++) { - TBOX_ASSERT((mapped_box_level.getRefinementRatio() (i) - * mapped_box_level.getRefinementRatio() ((i - + 1) - % getDim().getValue()) > 0) - || (mapped_box_level.getRefinementRatio() (i) == 1) - || (mapped_box_level.getRefinementRatio() ((i + 1) % getDim().getValue()) == - 1)); + TBOX_ASSERT(box_level.getRefinementRatio() != 0); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_dim.getValue() > 1) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = d_ratio_to_level_zero(b,i) > 0; + bool pos1 = d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (d_ratio_to_level_zero(b,i) == 1) + || (d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } } } #endif @@ -135,7 +129,7 @@ PatchLevel::PatchLevel( t_constructor_setup->start(); d_local_number_patches = - static_cast(d_mapped_box_level->getLocalNumberOfBoxes()); + static_cast(d_box_level->getLocalNumberOfBoxes()); d_descriptor = descriptor; d_geometry = grid_geometry; @@ -144,22 +138,23 @@ PatchLevel::PatchLevel( d_next_coarser_level_number = -1; d_in_hierarchy = false; - const BoxContainer& mapped_boxes = d_mapped_box_level->getBoxes(); - for (RealBoxConstIterator ni(mapped_boxes.realBegin()); - ni != mapped_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - const BoxId& ip = mapped_box.getId(); + const BoxContainer& boxes = d_box_level->getBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { + const Box& box = *ni; + const BoxId& ip = box.getBoxId(); boost::shared_ptr& patch(d_patches[ip]); - patch = d_factory->allocate(mapped_box, d_descriptor); + patch = d_factory->allocate(box, d_descriptor); patch->setPatchLevelNumber(d_level_number); patch->setPatchInHierarchy(d_in_hierarchy); + d_patch_vector.push_back(patch); } d_boundary_boxes_created = false; t_constructor_setup->stop(); t_constructor_phys_domain->start(); - for (int nb = 0; nb < d_number_blocks; nb++) { + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { grid_geometry->computePhysicalDomain(d_physical_domain[nb], d_ratio_to_level_zero, BlockId(nb)); } @@ -178,8 +173,119 @@ PatchLevel::PatchLevel( grid_geometry->setGeometryOnPatches( *this, d_ratio_to_level_zero, + touches_regular_bdry, + defer_boundary_box_creation); + t_constructor_set_geometry->stop(); + + if (!defer_boundary_box_creation) { + d_boundary_boxes_created = true; + } + + t_level_constructor->stop(); +} + +/* + ************************************************************************* + * + * Create a new patch level using the specified boxes and processor + * mapping. Only those patches that are local to the processor are + * allocated. Allocate patches using the specified patch factory or + * the standard patch factory if none is explicitly specified. + * + ************************************************************************* + */ + +PatchLevel::PatchLevel( + const boost::shared_ptr box_level, + const boost::shared_ptr& grid_geometry, + const boost::shared_ptr& descriptor, + const boost::shared_ptr& factory, + bool defer_boundary_box_creation): + d_dim(grid_geometry->getDim()), + d_box_level(box_level), + d_has_globalized_data(false), + d_ratio_to_level_zero(d_box_level->getRefinementRatio()), + d_factory(factory ? factory : boost::make_shared()), + d_physical_domain(grid_geometry->getNumberBlocks()), + d_ratio_to_coarser_level(grid_geometry->getDim(), 0, grid_geometry->getNumberBlocks()) +{ + d_box_level->lock(); + d_number_blocks = grid_geometry->getNumberBlocks(); + + TBOX_ASSERT_OBJDIM_EQUALITY2(*box_level, *grid_geometry); + + t_level_constructor->start(); + + TBOX_ASSERT(grid_geometry); + TBOX_ASSERT(descriptor); + /* + * All components of ratio must be nonzero. Additionally, all components + * of ratio not equal to 1 must have the same sign. + */ + TBOX_ASSERT(box_level->getRefinementRatio() != 0); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_dim.getValue() > 1) { + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + int i; + for (i = 0; i < d_dim.getValue(); ++i) { + bool pos0 = d_ratio_to_level_zero(b,i) > 0; + bool pos1 = d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) > 0; + TBOX_ASSERT(pos0 == pos1 + || (d_ratio_to_level_zero(b,i) == 1) + || (d_ratio_to_level_zero(b,(i + 1) % d_dim.getValue()) == 1)); + } + } + } +#endif + + t_constructor_setup->start(); + + d_local_number_patches = + static_cast(d_box_level->getLocalNumberOfBoxes()); + d_descriptor = descriptor; + + d_geometry = grid_geometry; + + d_level_number = -1; + d_next_coarser_level_number = -1; + d_in_hierarchy = false; + + const BoxContainer& boxes = d_box_level->getBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { + const Box& box = *ni; + const BoxId& ip = box.getBoxId(); + boost::shared_ptr& patch(d_patches[ip]); + patch = d_factory->allocate(box, d_descriptor); + patch->setPatchLevelNumber(d_level_number); + patch->setPatchInHierarchy(d_in_hierarchy); + d_patch_vector.push_back(patch); + } + + d_boundary_boxes_created = false; + t_constructor_setup->stop(); + + t_constructor_phys_domain->start(); + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { + grid_geometry->computePhysicalDomain(d_physical_domain[nb], + d_ratio_to_level_zero, BlockId(nb)); + } + t_constructor_phys_domain->stop(); + + t_constructor_touch_boundaries->start(); + std::map touches_regular_bdry; + std::map touches_periodic_bdry; + grid_geometry->findPatchesTouchingBoundaries( touches_regular_bdry, touches_periodic_bdry, + *this); + t_constructor_touch_boundaries->stop(); + + t_constructor_set_geometry->start(); + grid_geometry->setGeometryOnPatches( + *this, + d_ratio_to_level_zero, + touches_regular_bdry, defer_boundary_box_creation); t_constructor_set_geometry->stop(); @@ -199,24 +305,25 @@ PatchLevel::PatchLevel( */ PatchLevel::PatchLevel( - const boost::shared_ptr& level_database, + const boost::shared_ptr& restart_database, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory, - const ComponentSelector& component_selector, bool defer_boundary_box_creation): d_dim(grid_geometry->getDim()), d_has_globalized_data(false), - d_ratio_to_level_zero(IntVector(grid_geometry->getDim(), - tbox::MathUtilities::getMax())), + d_ratio_to_level_zero(grid_geometry->getDim(), + tbox::MathUtilities::getMax(), + grid_geometry->getNumberBlocks()), d_factory(factory ? factory : boost::make_shared()), d_physical_domain(grid_geometry->getNumberBlocks()), - d_ratio_to_coarser_level(IntVector(grid_geometry->getDim(), - tbox::MathUtilities::getMax())) + d_ratio_to_coarser_level(grid_geometry->getDim(), + tbox::MathUtilities::getMax(), + grid_geometry->getNumberBlocks()) { d_number_blocks = grid_geometry->getNumberBlocks(); - TBOX_ASSERT(level_database); + TBOX_ASSERT(restart_database); TBOX_ASSERT(grid_geometry); TBOX_ASSERT(descriptor); @@ -225,7 +332,7 @@ PatchLevel::PatchLevel( d_geometry = grid_geometry; d_descriptor = descriptor; - getFromDatabase(level_database, component_selector); + getFromRestart(restart_database); d_boundary_boxes_created = false; @@ -243,7 +350,6 @@ PatchLevel::PatchLevel( *this, d_ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry, defer_boundary_box_creation); t_constructor_set_geometry->stop(); @@ -275,14 +381,19 @@ PatchLevel::setRefinedPatchLevel( bool defer_boundary_box_creation) { TBOX_ASSERT(coarse_level); - TBOX_ASSERT(refine_ratio > IntVector::getZero(getDim())); + TBOX_ASSERT(refine_ratio != 0); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, *coarse_level, refine_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, *coarse_level, refine_ratio); if (fine_grid_geometry) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *fine_grid_geometry); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *fine_grid_geometry); } #endif + d_number_blocks = coarse_level->d_number_blocks; + if (d_ratio_to_level_zero.getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero = IntVector(d_dim, 0, d_number_blocks); + } + /* * The basic state of the new patch level is initialized from the state of * the given existing patch level. @@ -308,21 +419,22 @@ PatchLevel::setRefinedPatchLevel( d_geometry = coarse_level->d_geometry; const IntVector& coarse_ratio = coarse_level->getRatioToLevelZero(); - for (int i = 0; i < getDim().getValue(); i++) { - int coarse_rat = coarse_ratio(i); - int refine_rat = refine_ratio(i); - if (coarse_rat < 0) { - if (tbox::MathUtilities::Abs(coarse_rat) >= refine_rat) { - d_ratio_to_level_zero(i) = - -(tbox::MathUtilities::Abs(coarse_rat / refine_rat)); + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int i = 0; i < getDim().getValue(); ++i) { + int coarse_rat = coarse_ratio(b,i); + int refine_rat = refine_ratio(b,i); + if (coarse_rat < 0) { + if (tbox::MathUtilities::Abs(coarse_rat) >= refine_rat) { + d_ratio_to_level_zero(b,i) = + -(tbox::MathUtilities::Abs(coarse_rat / refine_rat)); + } else { + d_ratio_to_level_zero(b,i) = + tbox::MathUtilities::Abs(refine_rat / coarse_rat); + } } else { - d_ratio_to_level_zero(i) = - tbox::MathUtilities::Abs(refine_rat / coarse_rat); + d_ratio_to_level_zero(b,i) = coarse_rat * refine_rat; } - } else { - d_ratio_to_level_zero(i) = coarse_rat * refine_rat; } - } } else { @@ -341,22 +453,21 @@ PatchLevel::setRefinedPatchLevel( d_boxes.refine(refine_ratio); { - d_mapped_box_level.reset( + d_box_level.reset( new BoxLevel( d_ratio_to_level_zero, d_geometry, - coarse_level->d_mapped_box_level->getMPI())); - coarse_level->d_mapped_box_level->refineBoxes( - *d_mapped_box_level, + coarse_level->d_box_level->getMPI())); + coarse_level->d_box_level->refineBoxes( + *d_box_level, refine_ratio, d_ratio_to_level_zero); - d_mapped_box_level->finalize(); + d_box_level->finalize(); } d_local_number_patches = coarse_level->getLocalNumberOfPatches(); - d_number_blocks = coarse_level->d_number_blocks; - d_physical_domain.resizeArray(d_number_blocks); - for (int nb = 0; nb < d_number_blocks; nb++) { + d_physical_domain.resize(d_number_blocks); + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { d_physical_domain[nb] = coarse_level->d_physical_domain[nb]; d_physical_domain[nb].refine(refine_ratio); } @@ -367,48 +478,38 @@ PatchLevel::setRefinedPatchLevel( * domain information. */ - const BoxContainer& mapped_boxes = d_mapped_box_level->getBoxes(); - for (RealBoxConstIterator ni(mapped_boxes.realBegin()); - ni != mapped_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - const BoxId& mapped_box_id = mapped_box.getId(); - d_patches[mapped_box_id] = d_factory->allocate(mapped_box, d_descriptor); - d_patches[mapped_box_id]->setPatchLevelNumber(d_level_number); - d_patches[mapped_box_id]->setPatchInHierarchy(d_in_hierarchy); + const BoxContainer& boxes = d_box_level->getBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { + const Box& box = *ni; + const BoxId& box_id = box.getBoxId(); + d_patches[box_id] = d_factory->allocate(box, d_descriptor); + d_patches[box_id]->setPatchLevelNumber(d_level_number); + d_patches[box_id]->setPatchInHierarchy(d_in_hierarchy); + d_patch_vector.push_back(d_patches[box_id]); } std::map touches_regular_bdry; - std::map touches_periodic_bdry; - for (iterator ip(coarse_level->begin()); ip != coarse_level->end(); ip++) { + for (iterator ip(coarse_level->begin()); ip != coarse_level->end(); ++ip) { boost::shared_ptr coarse_pgeom((*ip)->getPatchGeometry()); /* If map does not contain values create them */ std::map::iterator iter_touches_regular_bdry( - touches_regular_bdry.find(ip->getBox().getId())); + touches_regular_bdry.find(ip->getBox().getBoxId())); if (iter_touches_regular_bdry == touches_regular_bdry.end()) { iter_touches_regular_bdry = touches_regular_bdry.insert( iter_touches_regular_bdry, - std::pair(ip->getBox().getId(), - PatchGeometry::TwoDimBool(getDim()))); - } - - std::map::iterator iter_touches_periodic_bdry( - touches_periodic_bdry.find(ip->getBox().getId())); - if (iter_touches_periodic_bdry == touches_periodic_bdry.end()) { - iter_touches_periodic_bdry = touches_periodic_bdry.insert( - iter_touches_periodic_bdry, - std::pair(ip->getBox().getId(), + std::pair(ip->getBox().getBoxId(), PatchGeometry::TwoDimBool(getDim()))); } PatchGeometry::TwoDimBool& touches_regular_bdry_ip((*iter_touches_regular_bdry).second); - for (int axis = 0; axis < getDim().getValue(); axis++) { - for (int side = 0; side < 2; side++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { + for (int side = 0; side < 2; ++side) { touches_regular_bdry_ip(axis, side) = coarse_pgeom->getTouchesRegularBoundary(axis, side); } @@ -419,7 +520,6 @@ PatchLevel::setRefinedPatchLevel( *this, d_ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry, defer_boundary_box_creation); if (!defer_boundary_box_creation) { @@ -445,12 +545,12 @@ PatchLevel::setCoarsenedPatchLevel( bool defer_boundary_box_creation) { TBOX_ASSERT(fine_level); - TBOX_ASSERT(coarsen_ratio > IntVector::getZero(getDim())); + TBOX_ASSERT(coarsen_ratio != 0); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, *fine_level, coarsen_ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, *fine_level, coarsen_ratio); if (coarse_grid_geom) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *coarse_grid_geom); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *coarse_grid_geom); } #endif @@ -464,6 +564,11 @@ PatchLevel::setCoarsenedPatchLevel( d_factory = fine_level->d_factory; // d_mapping.setProcessorMapping( (fine_level->d_mapping).getProcessorMapping() ); + d_number_blocks = fine_level->d_number_blocks; + if (d_ratio_to_level_zero.getNumBlocks() != d_number_blocks) { + d_ratio_to_level_zero = IntVector(d_dim, 0, d_number_blocks); + } + /* * Compute the ratio to coarsest level (reference level in hierarchy -- * usually level zero) and set grid geometry for this (coarse) level. If @@ -480,20 +585,21 @@ PatchLevel::setCoarsenedPatchLevel( const IntVector& fine_ratio = fine_level->d_ratio_to_level_zero; - - for (int i = 0; i < getDim().getValue(); i++) { - int fine_rat = fine_ratio(i); - int coarsen_rat = coarsen_ratio(i); - if (fine_rat > 0) { - if (fine_rat >= coarsen_rat) { - d_ratio_to_level_zero(i) = fine_rat / coarsen_rat; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int i = 0; i < getDim().getValue(); ++i) { + int fine_rat = fine_ratio(b,i); + int coarsen_rat = coarsen_ratio(b,i); + if (fine_rat > 0) { + if (fine_rat >= coarsen_rat) { + d_ratio_to_level_zero(b,i) = fine_rat / coarsen_rat; + } else { + d_ratio_to_level_zero(b,i) = + -(tbox::MathUtilities::Abs(coarsen_rat / fine_rat)); + } } else { - d_ratio_to_level_zero(i) = - -(tbox::MathUtilities::Abs(coarsen_rat / fine_rat)); + d_ratio_to_level_zero(b,i) = + -(tbox::MathUtilities::Abs(fine_rat * coarsen_rat)); } - } else { - d_ratio_to_level_zero(i) = - -(tbox::MathUtilities::Abs(fine_rat * coarsen_rat)); } } @@ -513,29 +619,27 @@ PatchLevel::setCoarsenedPatchLevel( d_boxes.coarsen(coarsen_ratio); /* - * Set coarse mapped_box_level to be the coarsened version of fine mapped_box_level. + * Set coarse box_level to be the coarsened version of fine box_level. * * NOTE: Some parts of SAMRAI (CoarsenSchedule in particular) - * assumes that the mapped_box identities are the same between the + * assumes that the box identities are the same between the * fine and coarsened levels. */ - const BoxLevel& fine_mapped_box_level = - *fine_level->d_mapped_box_level; - d_mapped_box_level.reset( + const BoxLevel& fine_box_level = *fine_level->d_box_level; + d_box_level.reset( new BoxLevel( d_ratio_to_level_zero, d_geometry, - fine_mapped_box_level.getMPI())); - fine_level->d_mapped_box_level->coarsenBoxes( - *d_mapped_box_level, + fine_box_level.getMPI())); + fine_level->d_box_level->coarsenBoxes( + *d_box_level, coarsen_ratio, d_ratio_to_level_zero); - d_mapped_box_level->finalize(); + d_box_level->finalize(); d_local_number_patches = fine_level->getNumberOfPatches(); - d_number_blocks = fine_level->d_number_blocks; - d_physical_domain.resizeArray(d_number_blocks); - for (int nb = 0; nb < d_number_blocks; nb++) { + d_physical_domain.resize(d_number_blocks); + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { d_physical_domain[nb] = fine_level->d_physical_domain[nb]; d_physical_domain[nb].coarsen(coarsen_ratio); } @@ -546,50 +650,40 @@ PatchLevel::setCoarsenedPatchLevel( * domain information. */ - const BoxContainer& mapped_boxes = d_mapped_box_level->getBoxes(); - for (RealBoxConstIterator ni(mapped_boxes.realBegin()); - ni != mapped_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - const BoxId& mapped_box_id = mapped_box.getId(); - d_patches[mapped_box_id] = d_factory->allocate(mapped_box, d_descriptor); - d_patches[mapped_box_id]->setPatchLevelNumber(d_level_number); - d_patches[mapped_box_id]->setPatchInHierarchy(d_in_hierarchy); + const BoxContainer& boxes = d_box_level->getBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { + const Box& box = *ni; + const BoxId& box_id = box.getBoxId(); + d_patches[box_id] = d_factory->allocate(box, d_descriptor); + d_patches[box_id]->setPatchLevelNumber(d_level_number); + d_patches[box_id]->setPatchInHierarchy(d_in_hierarchy); + d_patch_vector.push_back(d_patches[box_id]); } d_boundary_boxes_created = false; std::map touches_regular_bdry; - std::map touches_periodic_bdry; - for (iterator ip(fine_level->begin()); ip != fine_level->end(); ip++) { + for (iterator ip(fine_level->begin()); ip != fine_level->end(); ++ip) { boost::shared_ptr fine_pgeom((*ip)->getPatchGeometry()); /* If map does not contain values create them */ std::map::iterator iter_touches_regular_bdry( - touches_regular_bdry.find(ip->getBox().getId())); + touches_regular_bdry.find(ip->getBox().getBoxId())); if (iter_touches_regular_bdry == touches_regular_bdry.end()) { iter_touches_regular_bdry = touches_regular_bdry.insert( iter_touches_regular_bdry, - std::pair(ip->getBox().getId(), - PatchGeometry::TwoDimBool(getDim()))); - } - - std::map::iterator iter_touches_periodic_bdry( - touches_periodic_bdry.find(ip->getBox().getId())); - if (iter_touches_periodic_bdry == touches_periodic_bdry.end()) { - iter_touches_periodic_bdry = touches_periodic_bdry.insert( - iter_touches_periodic_bdry, - std::pair(ip->getBox().getId(), + std::pair(ip->getBox().getBoxId(), PatchGeometry::TwoDimBool(getDim()))); } PatchGeometry::TwoDimBool& touches_regular_bdry_ip((*iter_touches_regular_bdry).second); - for (int axis = 0; axis < getDim().getValue(); axis++) { - for (int side = 0; side < 2; side++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { + for (int side = 0; side < 2; ++side) { touches_regular_bdry_ip(axis, side) = fine_pgeom->getTouchesRegularBoundary(axis, side); } @@ -600,7 +694,6 @@ PatchLevel::setCoarsenedPatchLevel( *this, d_ratio_to_level_zero, touches_regular_bdry, - touches_periodic_bdry, defer_boundary_box_creation); if (!defer_boundary_box_creation) { @@ -623,11 +716,11 @@ PatchLevel::getBoxes( } boxes.clear(); - const BoxContainer& global_mapped_boxes = - d_mapped_box_level->getGlobalizedVersion().getGlobalBoxes(); + const BoxContainer& global_boxes = + d_box_level->getGlobalizedVersion().getGlobalBoxes(); - for (BoxContainerSingleBlockIterator gi(global_mapped_boxes.begin(block_id)); - gi != global_mapped_boxes.end(block_id); ++gi) { + for (BoxContainerSingleBlockIterator gi(global_boxes.begin(block_id)); + gi != global_boxes.end(block_id); ++gi) { boxes.pushBack(*gi); } } @@ -636,98 +729,121 @@ PatchLevel::getBoxes( * ************************************************************************ * * Check that class version and restart file number are the same. If - * so, read in data from database and build patch level from data. + * so, read in data from restart database and build patch level from data. * * ************************************************************************ */ void -PatchLevel::getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector) +PatchLevel::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("HIER_PATCH_LEVEL_VERSION"); + int ver = restart_db->getInteger("HIER_PATCH_LEVEL_VERSION"); if (ver != HIER_PATCH_LEVEL_VERSION) { - TBOX_ERROR("PatchLevel::getFromDatabase() error...\n" + TBOX_ERROR("PatchLevel::getFromRestart() error...\n" << " Restart file version different than class version."); } - if (database->keyExists("d_boxes")) { - d_boxes = database->getDatabaseBoxArray("d_boxes"); + if (restart_db->keyExists("d_boxes")) { + std::vector db_box_vector = + restart_db->getDatabaseBoxVector("d_boxes"); + d_boxes = db_box_vector; } - int* temp_ratio = &d_ratio_to_level_zero[0]; - database->getIntegerArray( - "d_ratio_to_level_zero", - temp_ratio, - getDim().getValue()); + std::vector temp_ratio = + restart_db->getIntegerVector("d_ratio_to_level_zero"); + TBOX_ASSERT(temp_ratio.size() == d_number_blocks * d_dim.getValue()); + + int i = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + d_ratio_to_level_zero(b,d) = temp_ratio[i]; + ++i; + } + } - d_number_blocks = database->getInteger("d_number_blocks"); + d_number_blocks = + static_cast(restart_db->getInteger("d_number_blocks")); - d_physical_domain.resizeArray(d_number_blocks); - for (int nb = 0; nb < d_number_blocks; nb++) { + d_physical_domain.resize(d_number_blocks); + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { std::string domain_name = "d_physical_domain_" - + tbox::Utilities::blockToString(nb); - d_physical_domain[nb] = database->getDatabaseBoxArray(domain_name); + + tbox::Utilities::blockToString(static_cast(nb)); + std::vector db_box_vector = + restart_db->getDatabaseBoxVector(domain_name); + d_physical_domain[nb] = db_box_vector; for (BoxContainer::iterator bi = d_physical_domain[nb].begin(); bi != d_physical_domain[nb].end(); ++bi) { bi->setBlockId(BlockId(nb)); } } - d_level_number = database->getInteger("d_level_number"); + d_level_number = restart_db->getInteger("d_level_number"); d_next_coarser_level_number = - database->getInteger("d_next_coarser_level_number"); - d_in_hierarchy = database->getBool("d_in_hierarchy"); + restart_db->getInteger("d_next_coarser_level_number"); + d_in_hierarchy = restart_db->getBool("d_in_hierarchy"); - temp_ratio = &d_ratio_to_coarser_level[0]; - database->getIntegerArray( - "d_ratio_to_coarser_level", - temp_ratio, - getDim().getValue()); + temp_ratio.clear(); + temp_ratio = restart_db->getIntegerVector("d_ratio_to_coarser_level"); + TBOX_ASSERT(temp_ratio.size() == d_number_blocks * d_dim.getValue()); /* - * Put local patches in database. + * Make sure d_ratio_to_coarser_level is of the correct size before + * initializing values. + */ + if (d_ratio_to_coarser_level.getNumBlocks() != d_number_blocks) { + d_ratio_to_coarser_level = IntVector(d_dim, 0, d_number_blocks); + } + + i = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + d_ratio_to_coarser_level(b,d) = temp_ratio[i]; + ++i; + } + } + + + /* + * Put local patches in restart database. */ - boost::shared_ptr mbl_database( - database->getDatabase("mapped_box_level")); - boost::shared_ptr mapped_box_level( - boost::make_shared(getDim())); boost::shared_ptr grid_geometry(getGridGeometry()); - mapped_box_level->getFromDatabase(*mbl_database, grid_geometry); - d_mapped_box_level = mapped_box_level; + boost::shared_ptr mbl_database( + restart_db->getDatabase("mapped_box_level")); + d_box_level.reset(new BoxLevel(getDim(), *mbl_database, grid_geometry)); d_patches.clear(); + d_patch_vector.clear(); - const BoxContainer& mapped_boxes = d_mapped_box_level->getBoxes(); - for (RealBoxConstIterator ni(mapped_boxes.realBegin()); - ni != mapped_boxes.realEnd(); ++ni) { - const Box& mapped_box = *ni; - const LocalId& local_id = mapped_box.getLocalId(); - const BoxId& mapped_box_id = mapped_box.getId(); + const BoxContainer& boxes = d_box_level->getBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { + const Box& box = *ni; + const LocalId& local_id = box.getLocalId(); + const BoxId& box_id = box.getBoxId(); std::string patch_name = "level_" + tbox::Utilities::levelToString( d_level_number) - + "-patch_" + tbox::Utilities::patchToString(local_id.getValue()) + + "-patch_" + + tbox::Utilities::patchToString(local_id.getValue()) + "-block_" + tbox::Utilities::blockToString( - mapped_box.getBlockId().getBlockValue()); - if (!(database->isDatabase(patch_name))) { - TBOX_ERROR("PatchLevel::getFromDatabase() error...\n" + static_cast(box.getBlockId().getBlockValue())); + if (!(restart_db->isDatabase(patch_name))) { + TBOX_ERROR("PatchLevel::getFromRestart() error...\n" << " patch name " << patch_name - << " not found in database" << std::endl); + << " not found in restart database" << std::endl); } - boost::shared_ptr& patch(d_patches[mapped_box_id]); - patch = d_factory->allocate(mapped_box, d_descriptor); + boost::shared_ptr& patch(d_patches[box_id]); + patch = d_factory->allocate(box, d_descriptor); patch->setPatchLevelNumber(d_level_number); patch->setPatchInHierarchy(d_in_hierarchy); - patch->getFromDatabase( - database->getDatabase(patch_name), - component_selector); + patch->getFromRestart(restart_db->getDatabase(patch_name)); + d_patch_vector.push_back(patch); } } @@ -736,8 +852,9 @@ PatchLevel::getFromDatabase( * ************************************************************************ * * Write out class version number and patch_level data members to the - * database, then has each patch on the local processor write itself - * to the database. The following are written out to the database: + * restart database, then has each patch on the local processor write itself + * to the restart database. The following are written out to the restart + * database: * d_physical_domain, d_ratio_to_level_zero, d_boxes, d_mapping, * d_global_number_patches, d_level_number, d_next_coarser_level_number, * d_in_hierarchy, d_patches[]. @@ -749,55 +866,68 @@ PatchLevel::getFromDatabase( * ************************************************************************ */ void -PatchLevel::putUnregisteredToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const +PatchLevel::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - database->putInteger("HIER_PATCH_LEVEL_VERSION", HIER_PATCH_LEVEL_VERSION); + restart_db->putInteger("HIER_PATCH_LEVEL_VERSION", + HIER_PATCH_LEVEL_VERSION); - database->putBool("d_is_patch_level", true); + // This appears to be used in the RedistributedRestartUtility. + restart_db->putBool("d_is_patch_level", true); - tbox::Array temp_boxes = d_boxes; - if (temp_boxes.getSize() > 0) { - database->putDatabaseBoxArray("d_boxes", temp_boxes); + std::vector temp_boxes = d_boxes; + if (temp_boxes.size() > 0) { + restart_db->putDatabaseBoxVector("d_boxes", temp_boxes); } - // database->putInteger("d_global_number_patches",d_global_number_patches); - - // database->putIntegerArray("d_mapping", d_mapping.getProcessorMapping()); - - const int* temp_ratio_to_level_zero = &d_ratio_to_level_zero[0]; - database->putIntegerArray("d_ratio_to_level_zero", - temp_ratio_to_level_zero, getDim().getValue()); + std::vector temp_ratio_to_level_zero( + d_number_blocks * getDim().getValue()); + int i = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + temp_ratio_to_level_zero[i] = d_ratio_to_level_zero(b,d); + ++i; + } + } + restart_db->putIntegerVector("d_ratio_to_level_zero", + temp_ratio_to_level_zero); - database->putInteger("d_number_blocks", d_number_blocks); + restart_db->putInteger("d_number_blocks", static_cast(d_number_blocks)); - for (int nb = 0; nb < d_number_blocks; nb++) { - tbox::Array temp_domain = d_physical_domain[nb]; + for (BlockId::block_t nb = 0; nb < d_number_blocks; ++nb) { + std::vector temp_domain = d_physical_domain[nb]; std::string domain_name = "d_physical_domain_" - + tbox::Utilities::blockToString(nb); - database->putDatabaseBoxArray(domain_name, temp_domain); + + tbox::Utilities::blockToString(static_cast(nb)); + restart_db->putDatabaseBoxVector(domain_name, temp_domain); } - database->putInteger("d_level_number", d_level_number); - database->putInteger("d_next_coarser_level_number", + restart_db->putInteger("d_level_number", d_level_number); + restart_db->putInteger("d_next_coarser_level_number", d_next_coarser_level_number); - database->putBool("d_in_hierarchy", d_in_hierarchy); - - const int* temp_ratio_to_coarser_level = &d_ratio_to_coarser_level[0]; - database->putIntegerArray("d_ratio_to_coarser_level", - temp_ratio_to_coarser_level, getDim().getValue()); + restart_db->putBool("d_in_hierarchy", d_in_hierarchy); + + std::vector temp_ratio_to_coarser_level( + d_number_blocks * getDim().getValue()); + i = 0; + for (BlockId::block_t b = 0; b < d_number_blocks; ++b) { + for (int d = 0; d < d_dim.getValue(); ++d) { + temp_ratio_to_coarser_level[i] = d_ratio_to_coarser_level(b,d); + ++i; + } + } + restart_db->putIntegerVector("d_ratio_to_coarser_level", + temp_ratio_to_coarser_level); /* - * Put local patches in database. + * Put local patches in restart_db. */ boost::shared_ptr mbl_database( - database->putDatabase("mapped_box_level")); - d_mapped_box_level->putUnregisteredToDatabase(mbl_database); + restart_db->putDatabase("mapped_box_level")); + d_box_level->putToRestart(mbl_database); - for (iterator ip(begin()); ip != end(); ip++) { + for (iterator ip(begin()); ip != end(); ++ip) { std::string patch_name = "level_" + tbox::Utilities::levelToString( d_level_number) @@ -805,11 +935,9 @@ PatchLevel::putUnregisteredToDatabase( + tbox::Utilities::patchToString(ip->getLocalId().getValue()) + "-block_" + tbox::Utilities::blockToString( - ip->getBox().getBlockId().getBlockValue()); + static_cast(ip->getBox().getBlockId().getBlockValue())); - ip->putUnregisteredToDatabase( - database->putDatabase(patch_name), - patchdata_write_table); + ip->putToRestart(restart_db->putDatabase(patch_name)); } } @@ -834,7 +962,7 @@ PatchLevel::recursivePrint( os << getBoxLevel()->format(border, 2) << std::endl; if (depth > 0) { - for (iterator pi(begin()); pi != end(); pi++) { + for (iterator pi(begin()); pi != end(); ++pi) { const boost::shared_ptr& patch = *pi; os << border << "Patch " << patch->getLocalId() << '/' << npatch << "\n"; patch->recursivePrint(os, border + "\t", depth - 1); @@ -854,27 +982,26 @@ PatchLevel::initializeGlobalizedBoxLevel() const { if (!d_has_globalized_data) { - const BoxLevel& globalized_mapped_box_level( - d_mapped_box_level->getGlobalizedVersion()); + const BoxLevel& globalized_box_level( + d_box_level->getGlobalizedVersion()); - const int nboxes = globalized_mapped_box_level.getGlobalNumberOfBoxes(); + const int nboxes = globalized_box_level.getGlobalNumberOfBoxes(); d_boxes.clear(); d_mapping.setMappingSize(nboxes); /* * Backward compatibility with things requiring global sequential * indices (such as the VisIt writer) is provided by the implicit - * ordering of the mapped_boxes in the nested loops below. + * ordering of the boxes in the nested loops below. * * Due to this necessary renumbering, the patch number obtained * by the PatchLevel::Iterator does not correspond to the * global sequential index. */ int count = 0; - const BoxContainer& mapped_boxes = - globalized_mapped_box_level.getGlobalBoxes(); - for (RealBoxConstIterator ni(mapped_boxes.realBegin()); - ni != mapped_boxes.realEnd(); + const BoxContainer& boxes = globalized_box_level.getGlobalBoxes(); + for (RealBoxConstIterator ni(boxes.realBegin()); + ni != boxes.realEnd(); ++ni) { d_mapping.setProcessorAssignment(count, ni->getOwnerRank()); d_boxes.pushBack(*ni); @@ -936,7 +1063,7 @@ PatchLevel::finalizeCallback() PatchLevel::Iterator::Iterator( const PatchLevel::Iterator& r): d_iterator(r.d_iterator), - d_patches(NULL /* Unused since not backward compatibility not needed */) + d_patches(0 /* Unused since not backward compatibility not needed */) { } @@ -945,7 +1072,7 @@ PatchLevel::Iterator::Iterator( const PatchLevel* patch_level, bool begin): d_iterator(begin ? patch_level->d_patches.begin() : - patch_level->d_patches.end()), + patch_level->d_patches.end()), d_patches(&patch_level->d_patches) { } @@ -960,5 +1087,3 @@ PatchLevel::Iterator::Iterator( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.h index 9d1fb99d..c3829a65 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevel.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A collection of patches at one level of the AMR hierarchy * ************************************************************************/ @@ -19,8 +19,9 @@ #include "SAMRAI/hier/ProcessorMapping.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace hier { @@ -38,12 +39,12 @@ class BaseGridGeometry; * To iterate over the local patches in a patch level, use the patch * level iterator class (PatchLevel::Iterator). * - * @see hier::BasePatchLevel - * @see hier::Patch - * @see hier::PatchDescriptor - * @see hier::PatchFactory - * @see hier::PatchLevelFactory - * @see hier::PatchLevel::Iterator + * @see BasePatchLevel + * @see Patch + * @see PatchDescriptor + * @see PatchFactory + * @see PatchLevelFactory + * @see PatchLevel::Iterator */ class PatchLevel @@ -59,6 +60,11 @@ class PatchLevel /*! * @brief Construct a new patch level given a BoxLevel. * + * This constructor makes a COPY of the supplied BoxLevel. If the caller + * intends to modify the supplied BoxLevel for other purposes after creating + * this PatchLevel, then this constructor must be used rather than the + * constructor taking a boost::shared_ptr. + * * The BoxLevel provides refinement ratio information, establishing * the ratio between the index space of the new level and some reference * level (typically level zero) in some patch hierarchy. @@ -67,13 +73,51 @@ class PatchLevel * by the grid geometry instance to initialize geometry information * of both the level and the patches on that level. * - * @par Error conditions - * When assertion checking is active, an unrecoverable assertion results - * if either the grid geometry pointer or patch descriptor pointer is - * null, or if the number of boxes in the array does not match the - * mapping array. + * @param[in] box_level + * @param[in] grid_geometry + * @param[in] descriptor The PatchDescriptor used to allocate patch data + * on the local processor + * @param[in] factory Optional PatchFactory. If none specified, a default + * (standard) patch factory will be used. + * @param[in] defer_boundary_box_creation Flag to indicate suppressing + * construction of the boundary boxes. + * + * @pre grid_geometry + * @pre descriptor + * @pre box_level.getDim() == grid_geometry->getDim() + * @pre box_level.getRefinementRatio() != IntVector::getZero(getDim()) + * @pre all components of box_level's refinement ratio must be nonzero and, + * all components not equal to 1 must have the same sign + */ + PatchLevel( + const BoxLevel& box_level, + const boost::shared_ptr& grid_geometry, + const boost::shared_ptr& descriptor, + const boost::shared_ptr& factory = + boost::shared_ptr(), + bool defer_boundary_box_creation = false); + + /*! + * @brief Construct a new patch level given a BoxLevel. + * + * This constructor ACQUIRES the supplied BoxLevel. If the caller will not + * modify the supplied BoxLevel for other purposes after creating this + * PatchLevel, then this constructor may be used rather than the constructor + * taking a BoxLevel&. Use of this constructor where permitted is more + * efficient as it avoids copying an entire BoxLevel. Note that this + * constructor locks the supplied BoxLevel so that any attempt by the caller + * to modify it after calling this constructor will result in an + * unrecoverable error. + * + * The BoxLevel provides refinement ratio information, establishing + * the ratio between the index space of the new level and some reference + * level (typically level zero) in some patch hierarchy. + * + * The ratio information provided by the BoxLevel is also used + * by the grid geometry instance to initialize geometry information + * of both the level and the patches on that level. * - * @param[in] mapped_box_level + * @param[in] box_level * @param[in] grid_geometry * @param[in] descriptor The PatchDescriptor used to allocate patch data * on the local processor @@ -82,9 +126,15 @@ class PatchLevel * @param[in] defer_boundary_box_creation Flag to indicate suppressing * construction of the boundary boxes. * + * @pre grid_geometry + * @pre descriptor + * @pre box_level.getDim() == grid_geometry->getDim() + * @pre box_level.getRefinementRatio() != IntVector::getZero(getDim()) + * @pre all components of box_level's refinement ratio must be nonzero and, + * all components not equal to 1 must have the same sign */ PatchLevel( - const BoxLevel& mapped_box_level, + const boost::shared_ptr box_level, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory = @@ -92,38 +142,30 @@ class PatchLevel bool defer_boundary_box_creation = false); /*! - * @brief Construct a new patch level from the specified PatchLevel database. + * @brief Construct a new patch level from the specified PatchLevel + * restart database. * * The box, mapping, and ratio to level zero data which are normally * passed in during the construction of a new patch level are - * retrieved from the specified database. The component_selector - * argument specifies which patch data components should be allocated - * and read in from the level_database. By default, all bits in the - * component selector are set to false so that no patch data are - * allocated. - * - * @par Error conditions - * When assertion checking is turned on, the level_database, - * grid_geometry, and descriptor are checked to make sure that - * they are not null. If null, an unrecoverable assertion will result. - * - * @param[in] level_database + * retrieved from the specified restart database. + * + * @param[in] restart_database * @param[in] grid_geometry * @param[in] descriptor The PatchDescriptor used to allocate patch * data. * @param[in] factory - * @param[in] component_selector Optional ComponentSelector. @b Default: - * a ComponentSelector with all elements set to false * @param[in] defer_boundary_box_creation Flag to indicate suppressing * construction of the boundary boxes. @b Default: false + * + * @pre restart_database + * @pre grid_geometry + * @pre descriptor */ PatchLevel( - const boost::shared_ptr& level_database, + const boost::shared_ptr& restart_database, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory, - const ComponentSelector& component_selector = - *(new ComponentSelector(false)), bool defer_boundary_box_creation = false); /*! @@ -162,7 +204,7 @@ class PatchLevel const int level) { d_level_number = level; - for (Iterator p(begin()); p != end(); p++) { + for (Iterator p(begin()); p != end(); ++p) { p->setPatchLevelNumber(d_level_number); } } @@ -224,7 +266,7 @@ class PatchLevel bool in_hierarchy) { d_in_hierarchy = in_hierarchy; - for (Iterator p(begin()); p != end(); p++) { + for (Iterator p(begin()); p != end(); ++p) { p->setPatchInHierarchy(d_in_hierarchy); } } @@ -246,7 +288,7 @@ class PatchLevel int getLocalNumberOfPatches() const { - return static_cast(d_mapped_box_level->getLocalNumberOfBoxes()); + return static_cast(d_box_level->getLocalNumberOfBoxes()); } /*! @@ -255,7 +297,7 @@ class PatchLevel int getGlobalNumberOfPatches() const { - return d_mapped_box_level->getGlobalNumberOfBoxes(); + return d_box_level->getGlobalNumberOfBoxes(); } /*! @@ -264,16 +306,16 @@ class PatchLevel int getLocalNumberOfCells() const { - return static_cast(d_mapped_box_level->getLocalNumberOfCells()); + return static_cast(d_box_level->getLocalNumberOfCells()); } /*! * @brief Get the global number of cells */ - int + long int getGlobalNumberOfCells() const { - return d_mapped_box_level->getGlobalNumberOfCells(); + return d_box_level->getGlobalNumberOfCells(); } /*! @@ -289,7 +331,11 @@ class PatchLevel { BoxId mbid(gid); PatchContainer::const_iterator it = d_patches.find(mbid); - TBOX_ASSERT(it != d_patches.end()); + if (it == d_patches.end()) { + TBOX_ERROR("PatchLevel::getPatch error: GlobalId " + << gid << " does not exist locally.\n" + << "You must specify the GlobalId of a current local patch."); + } return it->second; } @@ -299,21 +345,39 @@ class PatchLevel * @param[in] mbid * * @return A boost::shared_ptr to the Patch indicated by the BoxId. + * + * @pre d_patches.find(mbid) != d_patches.end() */ boost::shared_ptr getPatch( const BoxId& mbid) const { const PatchContainer::const_iterator mi = d_patches.find(mbid); -#ifdef DEBUG_CHECK_ASSERTIONS if (mi == d_patches.end()) { - TBOX_ERROR("PatchLevel::getPatch(" << mbid - << "): patch does not exist locally."); + TBOX_ERROR("PatchLevel::getPatch error: BoxId " + << mbid << " does not exist locally.\n" + << "You must specify the BoxId of a current local box" + << " that is not a periodic image."); } -#endif return (*mi).second; } + /*! + * @brief Get a patch using a random access index. + * + * The index specifies the position of the patch as would be + * encountered when iterating through the patches. + */ + const boost::shared_ptr& getPatch(size_t index) const + { + if (index >= d_patch_vector.size()) { + TBOX_ERROR("PatchLevel::getPatch error: index " + << index << " is too big.\n" + << "There are only " << d_patch_vector.size() << " patches."); + } + return d_patch_vector[index]; + } + /*! * @brief Get the PatchDescriptor * @@ -387,6 +451,12 @@ class PatchLevel * @param[in] fine_grid_geometry @b Default: boost::shared_ptr to a null * grid geometry * @param[in] defer_boundary_box_creation @b Default: false + * + * @pre coarse_level + * @pre refine_ratio > IntVector::getZero(getDim()) + * @pre (getDim() == coarse_level->getDim()) && + * (getDim() == refine_ratio.getDim()) + * @pre !fine_grid_geometry || getDim() == fine_grid_geometry->getDim() */ void setRefinedPatchLevel( @@ -435,6 +505,12 @@ class PatchLevel * @param[in] coarse_grid_geom @b Default: boost::shared_ptr to a null * grid geometry * @param[in] defer_boundary_box_creation @b Default: false + * + * @pre fine_level + * @pre coarsen_ratio > IntVector::getZero(getDim()) + * @pre (getDim() == fine_level->getDim()) && + * (getDim() == coarsen_ratio.getDim()) + * @pre !coarse_grid_geom || getDim() == coarse_grid_geom->getDim() */ void setCoarsenedPatchLevel( @@ -470,7 +546,7 @@ class PatchLevel * @return A const reference to the box array that defines * the extent of the index space on the level. */ - const tbox::Array& + const std::vector& getPhysicalDomainArray() const { return d_physical_domain; @@ -526,7 +602,7 @@ class PatchLevel const boost::shared_ptr& getBoxLevel() const { - return d_mapped_box_level; + return d_box_level; } /*! @@ -546,7 +622,7 @@ class PatchLevel if (!d_has_globalized_data) { initializeGlobalizedBoxLevel(); } - return d_mapped_box_level->getGlobalizedVersion(); + return d_box_level->getGlobalizedVersion(); } /*! @@ -614,22 +690,22 @@ class PatchLevel * @return the processor that owns the specified patch. The patches * are numbered starting at zero. * - * @param[in] mapped_box_id Patch's BoxId + * @param[in] box_id Patch's BoxId */ int getMappingForPatch( - const BoxId& mapped_box_id) const + const BoxId& box_id) const { // Note: p is required to be a local index. /* * This must be for backward compatability, because if p is a local - * index, the mapping is always to d_mapped_box_level->getRank(). + * index, the mapping is always to d_box_level->getRank(). * Here is the old code: * - * return d_mapped_box_level->getBoxStrict(p)->getOwnerRank(); + * return d_box_level->getBoxStrict(p)->getOwnerRank(); */ - NULL_USE(mapped_box_id); - return d_mapped_box_level->getMPI().getRank(); + NULL_USE(box_id); + return d_box_level->getMPI().getRank(); } /*! @@ -637,33 +713,35 @@ class PatchLevel * * @return The box for the specified patch. * - * @param[in] mapped_box_id Patch's BoxId + * @param[in] box_id Patch's BoxId + * + * @pre box_id.getOwnerRank() == getBoxLevel()->getMPI().getRank() */ const Box& getBoxForPatch( - const BoxId& mapped_box_id) const + const BoxId& box_id) const { - TBOX_ASSERT(mapped_box_id.getOwnerRank() == - d_mapped_box_level->getMPI().getRank()); - return getPatch(mapped_box_id)->getBox(); + TBOX_ASSERT(box_id.getOwnerRank() == d_box_level->getMPI().getRank()); + return getPatch(box_id)->getBox(); } /*! * @brief Determine if the patch is adjacent to a non-periodic * physical domain boundary. * - * @param[in] mapped_box_id Patch's BoxId + * @param[in] box_id Patch's BoxId * * @return True if patch with given number is adjacent to a non-periodic * physical domain boundary. Otherwise, false. + * + * @pre box_id.getOwnerRank() == getBoxLevel()->getMPI().getRank() */ bool patchTouchesRegularBoundary( - const BoxId& mapped_box_id) const + const BoxId& box_id) const { - TBOX_ASSERT(mapped_box_id.getOwnerRank() == - d_mapped_box_level->getMPI().getRank()); - return getPatch(mapped_box_id)->getPatchGeometry()->getTouchesRegularBoundary(); + TBOX_ASSERT(box_id.getOwnerRank() == d_box_level->getMPI().getRank()); + return getPatch(box_id)->getPatchGeometry()->getTouchesRegularBoundary(); } /*! @@ -677,7 +755,7 @@ class PatchLevel const int id, const double timestamp = 0.0) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->allocatePatchData(id, timestamp); } } @@ -694,7 +772,7 @@ class PatchLevel const ComponentSelector& components, const double timestamp = 0.0) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->allocatePatchData(components, timestamp); } } @@ -706,7 +784,7 @@ class PatchLevel * (2) all of the patches have allocated the patch data component, * otherwise false. * - * @param[in] id The patch identifier. + * @param[in] id The patch data identifier. */ bool checkAllocated( @@ -725,13 +803,13 @@ class PatchLevel * * This component will need to be reallocated before its next use. * - * @param[in] id The patch identifier + * @param[in] id The patch data identifier */ void deallocatePatchData( const int id) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->deallocatePatchData(id); } } @@ -748,7 +826,7 @@ class PatchLevel deallocatePatchData( const ComponentSelector& components) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->deallocatePatchData(components); } } @@ -775,7 +853,7 @@ class PatchLevel const double timestamp, const int id) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->setTime(timestamp, id); } } @@ -792,7 +870,7 @@ class PatchLevel const double timestamp, const ComponentSelector& components) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->setTime(timestamp, components); } } @@ -806,14 +884,191 @@ class PatchLevel setTime( const double timestamp) { - for (Iterator ip(begin()); ip != end(); ip++) { + for (Iterator ip(begin()); ip != end(); ++ip) { ip->setTime(timestamp); } } /*! - * @brief Use the PatchLevel database to set the state of the PatchLevel - * and to create all patches on the local processor. + * @brief Find an overlap Connector with the given PatchLevel's BoxLevel as + * its head and minimum Connector width. If the specified Connector is not + * found, take the specified action. + * + * If multiple Connectors fit the criteria, the one with the + * smallest ghost cell width (based on the algebraic sum of the + * components) is selected. + * + * @param[in] head Find the overlap Connector with this PatchLevel's + * BoxLevel as the head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum Connector width. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. + * + * @return The Connector which matches the search criterion. + * + * @pre getBoxLevel()->isInitialized() + * @pre head.getBoxLevel()->isInitialized() + */ + const Connector& + findConnector( + const PatchLevel& head, + const IntVector& min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true) const + { + return getBoxLevel()->findConnector(*head.getBoxLevel(), + min_connector_width, + not_found_action, + exact_width_only); + } + + /*! + * @brief Find an overlap Connector with its transpose with the given + * PatchLevel's BoxLevel as its head and minimum Connector widths. If the + * specified Connector is not found, take the specified action. + * + * If multiple Connectors fit the criteria, the one with the + * smallest ghost cell width (based on the algebraic sum of the + * components) is selected. + * + * @param[in] head Find the overlap Connector with this PatchLevel's + * BoxLevel as the head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum Connector width. + * @param[in] transpose_min_connector_width Find the transpose overlap + * Connector satisfying this minimum Connector width. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. + * @return The Connector which matches the search criterion. + * + * @pre getBoxLevel()->isInitialized() + * @pre head.getBoxLevel()->isInitialized() + */ + const Connector& + findConnectorWithTranspose( + const PatchLevel& head, + const IntVector& min_connector_width, + const IntVector& transpose_min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true) const + { + return getBoxLevel()->findConnectorWithTranspose(*head.getBoxLevel(), + min_connector_width, + transpose_min_connector_width, + not_found_action, + exact_width_only); + } + + /*! + * @brief Create an overlap Connector, computing relationships by + * globalizing data. + * + * The base will be this PatchLevel's BoxLevel. + * Find Connector relationships using a (non-scalable) global search. + * + * @see Connector + * @see Connector::initialize() + * + * @param[in] head This PatchLevel's BoxLevel will be the head. + * @param[in] connector_width + * + * @return A const reference to the newly created overlap Connector. + * + * @pre getBoxLevel()->isInitialized() + * @pre head.getBoxLevel()->isInitialized() + */ + const Connector& + createConnector( + const PatchLevel& head, + const IntVector& connector_width) const + { + return getBoxLevel()->createConnector(*head.getBoxLevel(), + connector_width); + } + + /*! + * @brief Create an overlap Connector with its transpose, computing + * relationships by globalizing data. + * + * The base will be this PatchLevel's BoxLevel. + * Find Connector relationships using a (non-scalable) global search. + * + * @see Connector + * @see Connector::initialize() + * + * @param[in] head This PatchLevel's BoxLevel will be the head. + * @param[in] connector_width + * @param[in] transpose_connector_width + * + * @return A const reference to the newly created overlap Connector. + * + * @pre getBoxLevel()->isInitialized() + * @pre head.getBoxLevel()->isInitialized() + */ + const Connector& + createConnectorWithTranspose( + const PatchLevel& head, + const IntVector& connector_width, + const IntVector& transpose_connector_width) const + { + return getBoxLevel()->createConnectorWithTranspose(*head.getBoxLevel(), + connector_width, + transpose_connector_width); + } + + /*! + * @brief Cache the supplied overlap Connector and its transpose + * if it exists. + * + * @param[in] connector + * + * @pre connector + * @pre getBoxLevel()->isInitialized() + * @pre getBoxLevel() == connector->getBase() + */ + void + cacheConnector( + boost::shared_ptr& connector) const + { + return getBoxLevel()->cacheConnector(connector); + } + + /*! + * @brief Returns whether the object has overlap Connectors with the given + * PatchLevel's BoxLevel as the head and minimum Connector width. + * + * TODO: does the following comment mean that this must be called + * before the call to findConnector? + * + * If this returns true, the Connector fitting the specification + * exists and findConnector() will not throw an assertion. + * + * @param[in] head Find the overlap Connector with this PatchLevel's + * BoxLevel as the head. + * @param[in] min_connector_width Find the overlap Connector satisfying + * this minimum ghost cell width. + * + * @return True if a Connector is found, otherwise false. + */ + bool + hasConnector( + const PatchLevel& head, + const IntVector& min_connector_width) const + { + return getBoxLevel()->hasConnector(*head.getBoxLevel(), + min_connector_width); + } + + /*! + * @brief Use the PatchLevel restart database to set the state of the + * PatchLevel and to create all patches on the local processor. * * @par Assertions * Assertions will check that database is a non-null boost::shared_ptr, @@ -823,32 +1078,28 @@ class PatchLevel * same, and that the number of patches and the number of boxes on the * level are equal. * - * @param[in,out] database - * @param[in] component_selector + * @param[in,out] restart_db + * + * @pre restart_db */ void - getFromDatabase( - const boost::shared_ptr& database, - const ComponentSelector& component_selector); + getFromRestart( + const boost::shared_ptr& restart_db); /*! - * @brief Write data to the database. + * @brief Write data to the restart database. * - * Writes the data from the PatchLevel to the database. + * Writes the data from the PatchLevel to the restart database. * Also tells all local patches to write out their state to - * the database. + * the restart database. * - * @par Assertions - * Check that database is a non-null boost::shared_ptr. + * @param[in,out] restart_db * - * @param[in,out] database - * @param[in] patchdata_write_table The ComponentSelector specifying - * which patch data to write to the database + * @pre restart_db */ void - putUnregisteredToDatabase( - const boost::shared_ptr& database, - const ComponentSelector& patchdata_write_table) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * @brief Print a patch level to varying details. @@ -875,17 +1126,21 @@ class PatchLevel /* * @brief Container of distributed patches on level. - * */ typedef std::map > PatchContainer; + /* + * @brief Vector of local patches on level. + */ + typedef std::vector > PatchVector; + public: /*! * @brief Iterator for looping through local patches. */ class Iterator { -friend class PatchLevel; + friend class PatchLevel; public: /*! @@ -980,7 +1235,7 @@ friend class PatchLevel; * @param[in] patch_level * @param[in] begin */ - explicit Iterator( + Iterator( const PatchLevel* patch_level, bool begin); @@ -1049,21 +1304,21 @@ friend class PatchLevel; /*! * @brief Number of blocks that can be represented by this level. */ - int d_number_blocks; + size_t d_number_blocks; /*! * Primary metadata describing the PatchLevel. */ - boost::shared_ptr d_mapped_box_level; + boost::shared_ptr d_box_level; /* - * Whether we have a globalized version of d_mapped_box_level. + * Whether we have a globalized version of d_box_level. */ mutable bool d_has_globalized_data; /* * Boxes for all level patches. * - * d_boxes is slave to d_mapped_box_level and computed only if getBoxes() is called. + * d_boxes is slave to d_box_level and computed only if getBoxes() is called. * This means that the first getBoxes() has to be called by all processors, * because it requires communication. */ @@ -1100,7 +1355,7 @@ friend class PatchLevel; /* * Extent of the index space. */ - tbox::Array d_physical_domain; + std::vector d_physical_domain; /* * The ratio to coarser level applies only when the level resides @@ -1134,6 +1389,13 @@ friend class PatchLevel; */ PatchContainer d_patches; + /*! + * @brief Vector holding the same patches in d_patches, in the same order. + * + * This allows random access to the patches. + */ + PatchVector d_patch_vector; + /* * Flag to indicate boundary boxes are created. */ @@ -1152,6 +1414,14 @@ friend class PatchLevel; static bool initialize(); + static boost::shared_ptr t_level_constructor; + static boost::shared_ptr t_constructor_setup; + static boost::shared_ptr t_constructor_phys_domain; + static boost::shared_ptr t_constructor_touch_boundaries; + static boost::shared_ptr t_constructor_set_geometry; + static boost::shared_ptr t_set_patch_touches; + static boost::shared_ptr t_constructor_compute_shifts; + static tbox::StartupShutdownManager::Handler s_initialize_finalize_handler; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.C index 4fdedc54..10fac385 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.C @@ -3,17 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract factory class for creating patch level objects * ************************************************************************/ - -#ifndef included_hier_PatchLevelFactory_C -#define included_hier_PatchLevelFactory_C - #include "SAMRAI/hier/PatchLevelFactory.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace hier { @@ -28,15 +24,32 @@ PatchLevelFactory::~PatchLevelFactory() boost::shared_ptr PatchLevelFactory::allocate( - const BoxLevel& mapped_box_level, + const BoxLevel& box_level, + const boost::shared_ptr& grid_geometry, + const boost::shared_ptr& descriptor, + const boost::shared_ptr& factory) const +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(box_level, *grid_geometry); + boost::shared_ptr pl( + boost::make_shared( + box_level, + grid_geometry, + descriptor, + factory)); + return pl; +} + +boost::shared_ptr +PatchLevelFactory::allocate( + const boost::shared_ptr box_level, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(mapped_box_level, *grid_geometry); + TBOX_ASSERT_OBJDIM_EQUALITY2(*box_level, *grid_geometry); boost::shared_ptr pl( boost::make_shared( - mapped_box_level, + box_level, grid_geometry, descriptor, factory)); @@ -48,7 +61,6 @@ PatchLevelFactory::allocate( const boost::shared_ptr& database, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, - const ComponentSelector& component_selector, const boost::shared_ptr& factory, const bool defer_boundary_box_creation) const { @@ -58,11 +70,9 @@ PatchLevelFactory::allocate( grid_geometry, descriptor, factory, - component_selector, defer_boundary_box_creation)); return pl; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.h index a97dbcc4..5fd9b5c4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PatchLevelFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract factory class for creating patch level objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace hier { @@ -30,7 +30,7 @@ namespace hier { * New types of patch level objects can be introduced into SAMRAI by deriving * from PatchLevelFactory and re-defining allocate. * - * @see hier::PatchLevel + * @see PatchLevel */ class PatchLevelFactory { @@ -46,21 +46,62 @@ class PatchLevelFactory virtual ~PatchLevelFactory(); /*! - * @brief Allocate a patch level with the specified boxes and processor mappings. + * @brief Allocate a patch level with the specified boxes and processor + * mappings. + * + * This method results in the allocated PatchLevel making a COPY of the + * supplied BoxLevel. If the caller intends to modify the supplied BoxLevel + * for other purposes after allocating the new PatchLevel, then this method + * must be used rather than the method taking a boost::shared_ptr. * * Redefine this function to change the method for creating patch levels. * * @return A boost::shared_ptr to the newly created PatchLevel. * - * @param[in] mapped_box_level + * @param[in] box_level * @param[in] grid_geometry * @param[in] descriptor * @param[in] factory @b Default: a boost::shared_ptr to the standard * PatchFactory + * + * @pre box_level.getDim() == grid_geometry->getDim() */ virtual boost::shared_ptr allocate( - const BoxLevel& mapped_box_level, + const BoxLevel& box_level, + const boost::shared_ptr& grid_geometry, + const boost::shared_ptr& descriptor, + const boost::shared_ptr& factory = + boost::shared_ptr()) const; + + /*! + * @brief Allocate a patch level with the specified boxes and processor + * mappings. + * + * This method results in the allocated PatchLevel ACQUIRING the supplied + * BoxLevel. If the caller will not modify the supplied BoxLevel for other + * purposes after allocating the new PatchLevel, then this method may be + * used rather than the method taking a BoxLevel&. Use of this method where + * permitted is more efficient as it avoids copying an entire BoxLevel. + * Note that this method results in the supplied BoxLevel being locked so + * that any attempt by the caller to modify it after calling this method + * will result in an unrecoverable error. + * + * Redefine this function to change the method for creating patch levels. + * + * @return A boost::shared_ptr to the newly created PatchLevel. + * + * @param[in] box_level + * @param[in] grid_geometry + * @param[in] descriptor + * @param[in] factory @b Default: a boost::shared_ptr to the standard + * PatchFactory + * + * @pre box_level.getDim() == grid_geometry->getDim() + */ + virtual boost::shared_ptr + allocate( + const boost::shared_ptr box_level, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, const boost::shared_ptr& factory = @@ -70,12 +111,6 @@ class PatchLevelFactory * @brief Allocate a patch level using the data from the database to * initialize it. * - * The component_selector argument is used to specify which patch data - * components to allocate and read in from the database. - * @note - * If desired, pass a ComponentSelector with all bits set to false to - * indicate that no patch data components are read/allocated. - * * Redefine this function to change the method for creating * patch levels from a database. * @@ -84,7 +119,6 @@ class PatchLevelFactory * @param[in] database * @param[in] grid_geometry * @param[in] descriptor - * @param[in] component_selector * @param[in] factory @b Default: a boost::shared_ptr to the standard * PatchFactory * @param[in] defer_boundary_box_creation @b Default: false @@ -94,7 +128,6 @@ class PatchLevelFactory const boost::shared_ptr& database, const boost::shared_ptr& grid_geometry, const boost::shared_ptr& descriptor, - const ComponentSelector& component_selector, const boost::shared_ptr& factory = boost::shared_ptr(), const bool defer_boundary_box_creation = false) const; @@ -105,7 +138,7 @@ class PatchLevelFactory */ PatchLevelFactory( const PatchLevelFactory&); - void + PatchLevelFactory& operator = ( const PatchLevelFactory&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.C index a2ccdb62..d5ee2158 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Periodic shift identifier in periodic domain. * ************************************************************************/ - -#ifndef included_hier_PeriodicId_C -#define included_hier_PeriodicId_C - #include "SAMRAI/hier/PeriodicId.h" #include @@ -73,4 +69,3 @@ operator << ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.h index cbe9f193..6f05ea02 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Periodic shift identifier in periodic domain. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.C index a83023d5..d23257e8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.C @@ -3,16 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Set of edges incident from a mapped_box_level of a distributed box graph. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Set of edges incident from a box_level of a distributed box graph. * ************************************************************************/ -#ifndef included_hier_PeriodicShiftCatalog_C -#define included_hier_PeriodicShiftCatalog_C - #include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/StartupShutdownManager.h" #include @@ -27,47 +23,6 @@ namespace SAMRAI { namespace hier { -PeriodicShiftCatalog * PeriodicShiftCatalog::s_periodic_shift_catalog_instance[ - tbox::Dimension::MAXIMUM_DIMENSION_VALUE] = { 0 }; - -tbox::StartupShutdownManager::Handler -PeriodicShiftCatalog::s_finalize_handler( - 0, - 0, - 0, - PeriodicShiftCatalog::finalizeCallback, - 40); - -/* - *********************************************************************** - *********************************************************************** - */ - -const PeriodicShiftCatalog* -PeriodicShiftCatalog::getCatalog( - const tbox::Dimension& dim) -{ - if (s_periodic_shift_catalog_instance[dim.getValue() - 1] == NULL) { - s_periodic_shift_catalog_instance[dim.getValue() - 1] = new PeriodicShiftCatalog(dim); - } - return s_periodic_shift_catalog_instance[dim.getValue() - 1]; -} - -/* - *********************************************************************** - *********************************************************************** - */ - -void -PeriodicShiftCatalog::finalizeCallback() -{ - for (int i = 0; i < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++i) { - if (s_periodic_shift_catalog_instance[i] != NULL) { - delete s_periodic_shift_catalog_instance[i]; - s_periodic_shift_catalog_instance[i] = NULL; - } - } -} /* *********************************************************************** @@ -76,7 +31,6 @@ PeriodicShiftCatalog::finalizeCallback() PeriodicShiftCatalog::PeriodicShiftCatalog( const tbox::Dimension& dim): - d_dim(dim), d_shifts(1, IntVector::getZero(dim)), d_opposite_number(1), d_zero_shift_number(0) @@ -103,17 +57,13 @@ PeriodicShiftCatalog::setShifts( const tbox::Dimension& dim, const std::vector& shifts) { - getCatalog(dim); // Causes singleton object creation if it does not yet exist. - - const int dim_index(dim.getValue() - 1); - std::vector tmp_shifts; - s_periodic_shift_catalog_instance[dim_index]->d_opposite_number.clear(); + d_opposite_number.clear(); const IntVector& zero_shift(IntVector::getZero(dim)); // The first position is the zero-shift and its own opposite. - s_periodic_shift_catalog_instance[dim_index]->d_opposite_number.push_back( + d_opposite_number.push_back( static_cast(static_cast(tmp_shifts.size()))); tmp_shifts.push_back(zero_shift); @@ -137,38 +87,36 @@ PeriodicShiftCatalog::setShifts( */ PeriodicId tmpId1(static_cast(tmp_shifts.size())); PeriodicId tmpId2(static_cast(tmp_shifts.size() + 1)); - s_periodic_shift_catalog_instance[dim_index]->d_opposite_number.push_back(tmpId2); - s_periodic_shift_catalog_instance[dim_index]->d_opposite_number.push_back(tmpId1); + d_opposite_number.push_back(tmpId2); + d_opposite_number.push_back(tmpId1); tmp_shifts.push_back(*vi); tmp_shifts.push_back(-(*vi)); } } - s_periodic_shift_catalog_instance[dim_index]->d_shifts = tmp_shifts; - s_periodic_shift_catalog_instance[dim_index]->d_zero_shift_number = 0; - - if (1) { - // Write out the shift catalog to log file. - tbox::plog << "\n\nPeriodicShiftCatalog has " - << s_periodic_shift_catalog_instance[dim_index]->d_shifts.size() - << " shifts:\n"; - tbox::plog << "Shift Opposite\n"; - tbox::plog << "Number Shift Shift\n"; - for (size_t i = 0; - i < s_periodic_shift_catalog_instance[dim_index]->d_shifts.size(); - ++i) { - tbox::plog << std::setw(3) << i << " " - << std::setw(3) - << s_periodic_shift_catalog_instance[dim_index]->d_opposite_number[i] - << " " - << s_periodic_shift_catalog_instance[dim_index]->d_shifts[i] << "\n"; - } - tbox::plog << "\n\n"; + d_shifts = tmp_shifts; + d_zero_shift_number = 0; + + // Write out the shift catalog to log file. + tbox::plog << "\n\nPeriodicShiftCatalog has " + << d_shifts.size() + << " shifts:\n"; + tbox::plog << "Shift Opposite Shift\n"; + tbox::plog << "Number Shift Vector\n"; + for (size_t i = 0; + i < d_shifts.size(); + ++i) { + tbox::plog << std::setw(3) << i << " " + << std::setw(3) + << d_opposite_number[i] + << " " + << d_shifts[i] << "\n"; } + tbox::plog << "\n\n"; - TBOX_ASSERT(s_periodic_shift_catalog_instance[dim_index]->d_shifts.size() == - s_periodic_shift_catalog_instance[dim_index]->d_opposite_number.size()); + TBOX_ASSERT(d_shifts.size() == + d_opposite_number.size()); } /* @@ -227,5 +175,3 @@ PeriodicShiftCatalog::initializeShiftsByIndexDirections( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.h index 87101a2f..0e19f466 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PeriodicShiftCatalog.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility for cataloging periodic shift directions. * ************************************************************************/ @@ -23,8 +23,7 @@ namespace SAMRAI { namespace hier { /*! - * @brief Singleton for cataloging periodic shifts and assigning - * each one a unique "shift number". + * @brief Catalogs periodic shifts and assigns each one a unique PeriodicId * * In a periodic domain, a Box location (or rather its images) * can appear to be in many places. We define the "shift distance" as @@ -33,7 +32,7 @@ namespace hier { * * This class catalogs all possible shifts for a periodic * configuration and assigns an integer index to each shift. A shift - * can be referenced by a single "shift number" rather than its IntVector + * can be referenced by a single PeriodicId rather than its IntVector * distance. * * TODO: Periodic shift definition and management should probably be @@ -44,20 +43,26 @@ namespace hier { class PeriodicShiftCatalog { public: + /*! - * @brief Get the singleton object. + * @brief Constructs uninitialized object. * - * @param[in] dim Get the catalog for this dimension. + * After construction, the object should be populated with periodic + * shifts, if any exist, using initializeShiftsByIndexDirections(). */ - static const PeriodicShiftCatalog * - getCatalog( + explicit PeriodicShiftCatalog( const tbox::Dimension& dim); + ~PeriodicShiftCatalog(); + /*! * @brief Return the shift distance corresponding to the given * shift number. * * @param[in] shift_number + * + * @pre shift_number.isValid() + * @pre shift_number.getPeriodicValue() < getNumberOfShifts() */ const IntVector& shiftNumberToShiftDistance( @@ -107,6 +112,9 @@ class PeriodicShiftCatalog * the shift distance of the given shift number. * * @param[in] shift_number + * + * @pre shift_number.isValid() + * @pre shift_number.getPeriodicValue() < getNumberOfShifts() */ const PeriodicId& getOppositeShiftNumber( @@ -165,25 +173,12 @@ class PeriodicShiftCatalog * * @param[in] shift_distance_along_index_directions The periodic * shift distance in each index direction. - * - * TODO: possible refactor? This method should probably be changed - * to a regular member method, for conformity to other singletons. */ - static void + void initializeShiftsByIndexDirections( const IntVector& shift_distance_along_index_directions); private: - /*! - * @brief Constructs uninitialized object. - * - * After construction, the object should be populated with periodic - * shifts using initializeShiftsByIndexDirections(). - */ - explicit PeriodicShiftCatalog( - const tbox::Dimension& dim); - - ~PeriodicShiftCatalog(); /*! * @brief Set the shifts. @@ -198,24 +193,11 @@ class PeriodicShiftCatalog * * @param[in] shifts All possible shifts. */ - static void + void setShifts( const tbox::Dimension& dim, const std::vector& shifts); - /*! - * @brief Free the singleton object. - */ - static void - finalizeCallback(); - - const tbox::Dimension d_dim; - - static PeriodicShiftCatalog* s_periodic_shift_catalog_instance[tbox:: - Dimension:: - MAXIMUM_DIMENSION_VALUE - ]; - std::vector d_shifts; /*! @@ -231,8 +213,6 @@ class PeriodicShiftCatalog */ unsigned int d_zero_shift_number; - static tbox::StartupShutdownManager::Handler - s_finalize_handler; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.C index e799287c..cb26ad8e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.C @@ -3,25 +3,27 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Registry of PersistentOverlapConnectorss incident from a common BoxLevel. * ************************************************************************/ -#ifndef included_hier_PersistentOverlapConnectors_C -#define included_hier_PersistentOverlapConnectors_C - #include "SAMRAI/hier/PersistentOverlapConnectors.h" #include "SAMRAI/hier/Connector.h" #include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/InputManager.h" +#include + namespace SAMRAI { namespace hier { char PersistentOverlapConnectors::s_check_created_connectors('\0'); char PersistentOverlapConnectors::s_check_accessed_connectors('\0'); -bool PersistentOverlapConnectors::s_always_create_missing_connector(true); +bool PersistentOverlapConnectors::s_create_empty_neighbor_containers(false); +char PersistentOverlapConnectors::s_implicit_connector_creation_rule('w'); +size_t PersistentOverlapConnectors::s_num_implicit_global_searches(0); /* ************************************************************************ @@ -30,30 +32,10 @@ bool PersistentOverlapConnectors::s_always_create_missing_connector(true); ************************************************************************ */ PersistentOverlapConnectors::PersistentOverlapConnectors( - const BoxLevel& my_mapped_box_level): - d_my_mapped_box_level(my_mapped_box_level) + const BoxLevel& my_box_level): + d_my_box_level(my_box_level) { - if (s_check_created_connectors == '\0') { - boost::shared_ptr idb( - tbox::InputManager::getInputDatabase()); - if (idb && idb->isDatabase("PersistentOverlapConnectors")) { - boost::shared_ptr rsdb( - idb->getDatabase("PersistentOverlapConnectors")); - - const bool check_created_connectors( - rsdb->getBoolWithDefault("check_created_connectors", false)); - s_check_created_connectors = check_created_connectors ? 'y' : 'n'; - - const bool check_accessed_connectors( - rsdb->getBoolWithDefault("check_accessed_connectors", false)); - s_check_accessed_connectors = check_accessed_connectors ? 'y' : 'n'; - - s_always_create_missing_connector = - rsdb->getBoolWithDefault("always_create_missing_connector", - s_always_create_missing_connector); - } - - } + getFromInput(); } /* @@ -66,6 +48,54 @@ PersistentOverlapConnectors::~PersistentOverlapConnectors() clear(); } +/* + ************************************************************************ + * Read input parameters. + ************************************************************************ + */ +void +PersistentOverlapConnectors::getFromInput() +{ + if (s_check_created_connectors == '\0') { + s_check_created_connectors = 'n'; + s_check_accessed_connectors = 'n'; + if (tbox::InputManager::inputDatabaseExists()) { + boost::shared_ptr input_db( + tbox::InputManager::getInputDatabase()); + if (input_db->isDatabase("PersistentOverlapConnectors")) { + boost::shared_ptr pocdb( + input_db->getDatabase("PersistentOverlapConnectors")); + + const bool check_created_connectors( + pocdb->getBoolWithDefault("DEV_check_created_connectors", false)); + s_check_created_connectors = check_created_connectors ? 'y' : 'n'; + + const bool check_accessed_connectors( + pocdb->getBoolWithDefault("DEV_check_accessed_connectors", false)); + s_check_accessed_connectors = + check_accessed_connectors ? 'y' : 'n'; + + if (pocdb->isString("implicit_connector_creation_rule")) { + + std::string implicit_connector_creation_rule = + pocdb->getString("implicit_connector_creation_rule"); + + if (implicit_connector_creation_rule != "ERROR" && + implicit_connector_creation_rule != "WARN" && + implicit_connector_creation_rule != "SILENT") { + TBOX_ERROR("PersistentOverlapConnectors::getFromInput error:\n" + << "implicit_connector_creation_rule must be set to\n" + << "\"ERROR\", \"WARN\" or \"SILENT\".\n"); + } + + s_implicit_connector_creation_rule = + char(tolower(implicit_connector_creation_rule[0])); + } + } + } + } +} + /* ************************************************************************ * Create Connector using global search for edges. @@ -76,25 +106,36 @@ PersistentOverlapConnectors::createConnector( const BoxLevel& head, const IntVector& connector_width) { - TBOX_ASSERT(d_my_mapped_box_level.isInitialized()); + TBOX_ASSERT(d_my_box_level.isInitialized()); TBOX_ASSERT(head.isInitialized()); - for (int i = 0; i < d_cons_from_me.size(); ++i) { + const size_t num_blocks = head.getRefinementRatio().getNumBlocks(); + IntVector width(connector_width); + if (width.getNumBlocks() == 1 && num_blocks != 1) { + if (width.max() == width.min()) { + width = IntVector(width, num_blocks); + } else { + TBOX_ERROR("Anisotropic head width argument for PersistentOverlapConnectors::createConnector must be of size equal to the number of blocks." << std::endl); + } + } + + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { if (&d_cons_from_me[i]->getHead() == &head && - d_cons_from_me[i]->getConnectorWidth() == connector_width) { + d_cons_from_me[i]->getConnectorWidth() == width) { TBOX_ERROR( "PersistentOverlapConnectors::createConnector:\n" << "Cannot create duplicate Connectors."); } } - Connector* new_connector = new Connector( - d_my_mapped_box_level, - head, - connector_width, - BoxLevel::DISTRIBUTED); + boost::shared_ptr new_connector; OverlapConnectorAlgorithm oca; - oca.findOverlaps(*new_connector, head.getGlobalizedVersion()); + oca.findOverlaps(new_connector, + d_my_box_level, + head, + width); + + postprocessForEmptyNeighborContainers(*new_connector); d_cons_from_me.push_back(new_connector); head.getPersistentOverlapConnectors().d_cons_to_me.push_back(new_connector); @@ -104,102 +145,225 @@ PersistentOverlapConnectors::createConnector( /* ************************************************************************ - * Create Connector with user-provided for edges. + * Create Connector and with transpose using global search for edges. ************************************************************************ */ const Connector& -PersistentOverlapConnectors::createConnector( +PersistentOverlapConnectors::createConnectorWithTranspose( const BoxLevel& head, const IntVector& connector_width, - const Connector& relationships) + const IntVector& transpose_connector_width) { - TBOX_ASSERT(d_my_mapped_box_level.isInitialized()); + TBOX_ASSERT(d_my_box_level.isInitialized()); TBOX_ASSERT(head.isInitialized()); - for (int i = 0; i < d_cons_from_me.size(); ++i) { - TBOX_ASSERT(d_cons_from_me[i]->isFinalized()); - TBOX_ASSERT(d_cons_from_me[i]->getBase().isInitialized()); - TBOX_ASSERT(d_cons_from_me[i]->getHead().isInitialized()); - TBOX_ASSERT(d_cons_from_me[i]->getBase().getBoxLevelHandle()); - TBOX_ASSERT(d_cons_from_me[i]->getHead().getBoxLevelHandle()); - TBOX_ASSERT(&d_cons_from_me[i]->getBase() == - &d_cons_from_me[i]->getBase().getBoxLevelHandle()-> - getBoxLevel()); - TBOX_ASSERT(&d_cons_from_me[i]->getHead() == - &d_cons_from_me[i]->getHead().getBoxLevelHandle()-> - getBoxLevel()); - if (&(d_cons_from_me[i]->getHead()) == &head && - d_cons_from_me[i]->getConnectorWidth() == connector_width) { - TBOX_ERROR( - "PersistentOverlapConnectors::createConnector:\n" - << "Cannot create duplicate Connectors."); + const Connector& forward = createConnector(head, connector_width); + if (&d_my_box_level != &head) { + head.createConnector(d_my_box_level, transpose_connector_width); + d_cons_from_me.back()->setTranspose( + head.getPersistentOverlapConnectors().d_cons_from_me.back().get(), + false); + } + + return forward; +} + +/* + ************************************************************************ + * Cache the user-provided Connector and its transpose if it exists. + ************************************************************************ + */ +void +PersistentOverlapConnectors::cacheConnector( + boost::shared_ptr& connector) +{ + TBOX_ASSERT(connector); + TBOX_ASSERT(d_my_box_level.isInitialized()); + TBOX_ASSERT(d_my_box_level == connector->getBase()); + + const BoxLevel& head = connector->getHead(); + doCacheConnectorWork(head, connector); + if (connector->hasTranspose()) { + if (connector.get() != &connector->getTranspose()) { + boost::shared_ptr transpose(&connector->getTranspose()); + head.getPersistentOverlapConnectors().doCacheConnectorWork( + d_my_box_level, + transpose); } + connector->setTranspose(&connector->getTranspose(), false); + } else { + connector->setTranspose(0, false); } +} - Connector* new_connector = new Connector(relationships); - new_connector->setBase(d_my_mapped_box_level); - new_connector->setHead(head); - new_connector->setWidth(connector_width, true); - if (s_check_created_connectors == 'y') { - OverlapConnectorAlgorithm oca; - TBOX_ASSERT(oca.checkOverlapCorrectness(*new_connector) == 0); +/* + ************************************************************************ + * + ************************************************************************ + */ +const Connector& +PersistentOverlapConnectors::findConnector( + const BoxLevel& head, + const IntVector& min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only) +{ + TBOX_ASSERT(d_my_box_level.isInitialized()); + TBOX_ASSERT(head.isInitialized()); + + boost::shared_ptr found = doFindConnectorWork(head, + min_connector_width, + not_found_action, + exact_width_only); + if (found->hasTranspose()) { + found->setTranspose(&found->getTranspose(), false); + } else { + if (&d_my_box_level == &head) { + found->setTranspose(found.get(), false); + } else { + found->setTranspose(0, false); + } } + return *found; +} - d_cons_from_me.push_back(new_connector); - head.getPersistentOverlapConnectors().d_cons_to_me.push_back(new_connector); +/* + ************************************************************************ + * + ************************************************************************ + */ +const Connector& +PersistentOverlapConnectors::findConnectorWithTranspose( + const BoxLevel& head, + const IntVector& min_connector_width, + const IntVector& transpose_min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only) +{ + TBOX_ASSERT(d_my_box_level.isInitialized()); + TBOX_ASSERT(head.isInitialized()); - new_connector = NULL; // Help Insure++ avoid false positive dangling pointer. + boost::shared_ptr forward = doFindConnectorWork(head, + min_connector_width, + not_found_action, + exact_width_only); + if (&d_my_box_level != &head) { + boost::shared_ptr transpose = + head.getPersistentOverlapConnectors().doFindConnectorWork( + d_my_box_level, + transpose_min_connector_width, + not_found_action, + exact_width_only); + forward->setTranspose(transpose.get(), false); + } else { + forward->setTranspose(forward.get(), false); + } - return *d_cons_from_me.back(); + return *forward; } /* ************************************************************************ - * Cache the user-provided Connector. + * ************************************************************************ */ -void -PersistentOverlapConnectors::cacheConnector( +bool +PersistentOverlapConnectors::hasConnector( const BoxLevel& head, - Connector* connector) + const IntVector& min_connector_width) const { - TBOX_ASSERT(d_my_mapped_box_level.isInitialized()); - - for (int i = 0; i < d_cons_from_me.size(); ++i) { - TBOX_ASSERT(d_cons_from_me[i]->isFinalized()); - TBOX_ASSERT(d_cons_from_me[i]->getBase().isInitialized()); - TBOX_ASSERT(d_cons_from_me[i]->getHead().isInitialized()); - TBOX_ASSERT(d_cons_from_me[i]->getBase().getBoxLevelHandle()); - TBOX_ASSERT(d_cons_from_me[i]->getHead().getBoxLevelHandle()); - TBOX_ASSERT(&d_cons_from_me[i]->getBase() == - &d_cons_from_me[i]->getBase().getBoxLevelHandle()-> - getBoxLevel()); - TBOX_ASSERT(&d_cons_from_me[i]->getHead() == - &d_cons_from_me[i]->getHead().getBoxLevelHandle()-> - getBoxLevel()); - if (&(d_cons_from_me[i]->getHead()) == &head && - d_cons_from_me[i]->getConnectorWidth() == connector->getConnectorWidth()) { - TBOX_ERROR( - "PersistentOverlapConnectors::createConnector:\n" - << "Cannot create duplicate Connectors."); + const size_t num_blocks = head.getRefinementRatio().getNumBlocks(); + IntVector min_width(min_connector_width); + if (min_width.getNumBlocks() == 1 && num_blocks != 1) { + if (min_width.max() == min_width.min()) { + min_width = IntVector(min_width, num_blocks); + } else { + TBOX_ERROR("Anisotropic head width argument for PersistentOverlapConnectors::doFindConnectorWork must be of size equal to the number of blocks." << std::endl); + } + } + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { + if (&d_cons_from_me[i]->getHead() == &head && + d_cons_from_me[i]->getConnectorWidth() >= min_width) { + return true; } } + return false; +} - connector->setBase(d_my_mapped_box_level); - connector->setHead(head, true); +/* + ************************************************************************ + * + ************************************************************************ + */ +void +PersistentOverlapConnectors::clear() +{ + if (d_cons_from_me.empty() && d_cons_to_me.empty()) { + return; + } - if (s_check_created_connectors == 'y') { - OverlapConnectorAlgorithm oca; - if (oca.checkOverlapCorrectness(*connector) != 0) { - TBOX_ERROR("PersistentOverlapConnectors::cacheConnector errror:\n" - <<"Bad overlap Connector found."); + /* + * Delete Connectors from me. + */ + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { + + const Connector* delete_me = d_cons_from_me[i].get(); + + ConVect& cons_at_head = + delete_me->getHead().getPersistentOverlapConnectors().d_cons_to_me; + + for (ConVect::iterator j = cons_at_head.begin(); + j != cons_at_head.end(); ++j) { + if (j->get() == delete_me) { + j->reset(); + cons_at_head.erase(j); + break; + } } + +#ifdef DEBUG_CHECK_ASSERTIONS + + for (int j = 0; j < static_cast(cons_at_head.size()); ++j) { + TBOX_ASSERT(cons_at_head[j].get() != delete_me); + } +#endif + + d_cons_from_me[i].reset(); } + d_cons_from_me.clear(); - d_cons_from_me.push_back(connector); - head.getPersistentOverlapConnectors().d_cons_to_me.push_back(connector); + /* + * Delete Connectors to me. + */ + for (int i = 0; i < static_cast(d_cons_to_me.size()); ++i) { + + const Connector* delete_me = d_cons_to_me[i].get(); + + // Remove reference held by other end of Connector. + ConVect& cons_at_base = + delete_me->getBase().getPersistentOverlapConnectors().d_cons_from_me; - return; + for (ConVect::iterator j = cons_at_base.begin(); + j != cons_at_base.end(); ++j) { + if (j->get() == delete_me) { + j->reset(); + cons_at_base.erase(j); + break; + } + } + +#ifdef DEBUG_CHECK_ASSERTIONS + + for (int j = 0; j < static_cast(cons_at_base.size()); ++j) { + TBOX_ASSERT(cons_at_base[j].get() != delete_me); + } + +#endif + + d_cons_to_me[i].reset(); + + } + d_cons_to_me.clear(); } /* @@ -207,21 +371,25 @@ PersistentOverlapConnectors::cacheConnector( * ************************************************************************ */ -const Connector& -PersistentOverlapConnectors::findConnector( +boost::shared_ptr +PersistentOverlapConnectors::doFindConnectorWork( const BoxLevel& head, const IntVector& min_connector_width, + ConnectorNotFoundAction not_found_action, bool exact_width_only) { - if (s_always_create_missing_connector) { - return findOrCreateConnector(head, min_connector_width, exact_width_only); + const size_t num_blocks = head.getRefinementRatio().getNumBlocks(); + IntVector min_width(min_connector_width); + if (min_width.getNumBlocks() == 1 && num_blocks != 1) { + if (min_width.max() == min_width.min()) { + min_width = IntVector(min_width, num_blocks); + } else { + TBOX_ERROR("Anisotropic head width argument for PersistentOverlapConnectors::doFindConnectorWork must be of size equal to the number of blocks." << std::endl); + } } - TBOX_ASSERT(d_my_mapped_box_level.isInitialized()); - TBOX_ASSERT(head.isInitialized()); - - const Connector* found = NULL; - for (int i = 0; i < d_cons_from_me.size(); ++i) { + boost::shared_ptr found; + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { TBOX_ASSERT(d_cons_from_me[i]->isFinalized()); TBOX_ASSERT(d_cons_from_me[i]->getBase().isInitialized()); TBOX_ASSERT(d_cons_from_me[i]->getHead().isInitialized()); @@ -235,47 +403,85 @@ PersistentOverlapConnectors::findConnector( getBoxLevel()); if (&(d_cons_from_me[i]->getHead()) == &head) { - if (d_cons_from_me[i]->getConnectorWidth() >= min_connector_width) { - if (found == NULL) { + if (d_cons_from_me[i]->getConnectorWidth() >= min_width) { + if (!found) { found = d_cons_from_me[i]; } else { IntVector vdiff = d_cons_from_me[i]->getConnectorWidth() - found->getConnectorWidth(); - TBOX_ASSERT(vdiff != IntVector::getZero(vdiff.getDim())); + TBOX_ASSERT(vdiff != 0); + size_t nblocks = head.getGridGeometry()->getNumberBlocks(); int diff = 0; - for (int j = 0; j < vdiff.getDim().getValue(); ++j) { - diff += vdiff(j); + for (BlockId::block_t b = 0; b < nblocks; ++b) { + for (unsigned int j = 0; j < vdiff.getDim().getValue(); ++j) { + diff += vdiff(b,j); + } } if (diff < 0) { found = d_cons_from_me[i]; } } - if (found->getConnectorWidth() == min_connector_width) { + if (found->getConnectorWidth() == min_width) { break; } } } } - OverlapConnectorAlgorithm oca; - - if (found == NULL) { - - TBOX_ERROR( - "PersistentOverlapConnectors::findConnector: Failed to find Connector\n" - << &d_my_mapped_box_level << "--->" << &head + bool fail = false; + bool warn = false; + bool create = false; + if (not_found_action == CONNECTOR_ERROR) { + fail = true; + } else if (not_found_action == CONNECTOR_CREATE) { + create = true; + } else if (s_implicit_connector_creation_rule == 'e') { + fail = true; + } else if (s_implicit_connector_creation_rule == 'w') { + warn = true; + create = true; + } else if (s_implicit_connector_creation_rule == 's') { + create = true; + } + if (!found) { + if (fail) { + tbox::perr + << "PersistentOverlapConnectors::findConnector: Failed to find Connector\n" + << &d_my_box_level << "--->" << &head << " with " << (exact_width_only ? "exact" : "min") - << " width of " << min_connector_width << ".\n" - << "base:\n" << d_my_mapped_box_level.format("B: ") + << " width of " << min_width << ".\n" + << "base:\n" << d_my_box_level.format("B: ") << "head:\n" << head.format("H: ") - << "To automatically create the missing\n" - << "connector, use findOrCreateConnector."); + << "\nThe available Connectors have these widths:\n"; + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { + if (&(d_cons_from_me[i]->getHead()) == &head) { + tbox::perr << "\t" << d_cons_from_me[i]->getConnectorWidth() + << '\n'; + } + } + TBOX_ERROR("To automatically create the missing " + << "connector, call findConnector with CREATE or call\n" + << "with IMPLICIT_CREATION_RULE and\n" + << "implicit_connector_creation_rule = \"WARN\" in the\n" + << "PersistentOverlapConnectors input database."); + } else if (create) { + ++s_num_implicit_global_searches; + if (warn) { + TBOX_WARNING("PersistentOverlapConnectors::findConnector is resorting\n" + << "to a global search to find overlaps between " + << &d_my_box_level << " and " << &head << ".\n" + << "This relies on unscalable data or triggers unscalable operations.\n" + << "Number of implicit global searches: " << s_num_implicit_global_searches << '\n'); + } + createConnector( head, min_width ); + found = d_cons_from_me.back(); + } } else if (exact_width_only && - found->getConnectorWidth() != min_connector_width) { + found->getConnectorWidth() != min_width) { /* * Found a sufficient Connector, but it is too wide. Extract @@ -283,16 +489,14 @@ PersistentOverlapConnectors::findConnector( * width. This is scalable! */ - Connector* new_connector = new Connector( - d_my_mapped_box_level, + OverlapConnectorAlgorithm oca; + boost::shared_ptr new_connector(boost::make_shared( + d_my_box_level, head, - min_connector_width); - oca.extractNeighbors(*new_connector, *found, min_connector_width); - /* - * Remove empty neighborhood sets. They are not essential to an - * overlap Connector. - */ - new_connector->eraseEmptyNeighborSets(); + min_width)); + oca.extractNeighbors(*new_connector, *found, min_width); + + postprocessForEmptyNeighborContainers(*new_connector); d_cons_from_me.push_back(new_connector); head.getPersistentOverlapConnectors().d_cons_to_me.push_back( @@ -303,13 +507,12 @@ PersistentOverlapConnectors::findConnector( } if (s_check_accessed_connectors == 'y') { - if (oca.checkOverlapCorrectness(*found) != 0) { + if (found->checkOverlapCorrectness() != 0) { TBOX_ERROR("PersistentOverlapConnectors::findConnector errror:\n" - <<"Bad overlap Connector found."); + << "Bad overlap Connector found."); } } - - return *found; + return found; } /* @@ -317,17 +520,12 @@ PersistentOverlapConnectors::findConnector( * ************************************************************************ */ -const Connector& -PersistentOverlapConnectors::findOrCreateConnector( +void +PersistentOverlapConnectors::doCacheConnectorWork( const BoxLevel& head, - const IntVector& min_connector_width, - bool exact_width_only) + boost::shared_ptr& connector) { - TBOX_ASSERT(d_my_mapped_box_level.isInitialized()); - TBOX_ASSERT(head.isInitialized()); - - const Connector* found = NULL; - for (int i = 0; i < d_cons_from_me.size(); ++i) { + for (int i = 0; i < static_cast(d_cons_from_me.size()); ++i) { TBOX_ASSERT(d_cons_from_me[i]->isFinalized()); TBOX_ASSERT(d_cons_from_me[i]->getBase().isInitialized()); TBOX_ASSERT(d_cons_from_me[i]->getHead().isInitialized()); @@ -339,190 +537,63 @@ PersistentOverlapConnectors::findOrCreateConnector( TBOX_ASSERT(&d_cons_from_me[i]->getHead() == &d_cons_from_me[i]->getHead().getBoxLevelHandle()-> getBoxLevel()); - - if (&(d_cons_from_me[i]->getHead()) == &head) { - if (d_cons_from_me[i]->getConnectorWidth() >= min_connector_width) { - if (found == NULL) { - found = d_cons_from_me[i]; - } else { - IntVector vdiff = - d_cons_from_me[i]->getConnectorWidth() - - found->getConnectorWidth(); - - TBOX_ASSERT(vdiff != IntVector::getZero(vdiff.getDim())); - - int diff = 0; - for (int j = 0; j < vdiff.getDim().getValue(); ++j) { - diff += vdiff(j); - } - if (diff < 0) { - found = d_cons_from_me[i]; - } - } - if (found->getConnectorWidth() == min_connector_width) { - break; - } - } + if (&(d_cons_from_me[i]->getHead()) == &head && + d_cons_from_me[i]->getConnectorWidth() == connector->getConnectorWidth()) { + TBOX_ERROR( + "PersistentOverlapConnectors::createConnector:\n" + << "Cannot create duplicate Connectors."); } } - OverlapConnectorAlgorithm oca; - - if (found == NULL) { - - Connector* new_connector = new Connector( - d_my_mapped_box_level, - head, - min_connector_width, - BoxLevel::DISTRIBUTED); - oca.findOverlaps(*new_connector, head.getGlobalizedVersion()); - found = new_connector; - - d_cons_from_me.push_back(new_connector); - head.getPersistentOverlapConnectors().d_cons_to_me.push_back( - new_connector); - - } else if (exact_width_only && - found->getConnectorWidth() != min_connector_width) { - - /* - * Found a sufficient Connector, but it is too wide. Extract - * relevant neighbors from it to make a Connector with the exact - * width. This is scalable! - */ - - Connector* new_connector = new Connector( - d_my_mapped_box_level, - head, - min_connector_width); - oca.extractNeighbors(*new_connector, *found, min_connector_width); - /* - * Remove empty neighborhood sets. They are not essential to an - * overlap Connector. - */ - new_connector->eraseEmptyNeighborSets(); - - d_cons_from_me.push_back(new_connector); - head.getPersistentOverlapConnectors().d_cons_to_me.push_back( - new_connector); - - found = new_connector; + connector->setBase(d_my_box_level); + connector->setHead(head, true); - } + postprocessForEmptyNeighborContainers(*connector); - if (s_check_accessed_connectors == 'y') { - if (oca.checkOverlapCorrectness(*found) != 0) { - TBOX_ERROR("PersistentOverlapConnectors::findOrCreateConnector errror:\n" - <<"Bad overlap Connector found."); + if (s_check_created_connectors == 'y') { + if (connector->checkOverlapCorrectness() != 0) { + TBOX_ERROR("PersistentOverlapConnectors::cacheConnector errror:\n" + << "Bad overlap Connector found."); } } - return *found; + d_cons_from_me.push_back(connector); + head.getPersistentOverlapConnectors().d_cons_to_me.push_back(connector); } /* ************************************************************************ - * ************************************************************************ */ -bool -PersistentOverlapConnectors::hasConnector( - const BoxLevel& head, - const IntVector& min_connector_width, - bool exact_width_only) const +void +PersistentOverlapConnectors::setCreateEmptyNeighborContainers( + bool create_empty_neighbor_containers) { - if (exact_width_only) { - for (int i = 0; i < d_cons_from_me.size(); ++i) { - if (&d_cons_from_me[i]->getHead() == &head && - d_cons_from_me[i]->getConnectorWidth() == min_connector_width) { - return true; - } - } - } else { - for (int i = 0; i < d_cons_from_me.size(); ++i) { - if (&d_cons_from_me[i]->getHead() == &head && - d_cons_from_me[i]->getConnectorWidth() >= min_connector_width) { - return true; - } - } - } - return false; + s_create_empty_neighbor_containers = create_empty_neighbor_containers; } /* ************************************************************************ - * ************************************************************************ */ void -PersistentOverlapConnectors::clear() +PersistentOverlapConnectors::postprocessForEmptyNeighborContainers( + Connector& connector) { - if (d_cons_from_me.empty() && d_cons_to_me.empty()) { - return; - } - - /* - * Delete Connectors from me. - */ - for (int i = 0; i < d_cons_from_me.size(); ++i) { - - const Connector* delete_me = d_cons_from_me[i]; - - ConVect& cons_at_head = - delete_me->getHead().getPersistentOverlapConnectors().d_cons_to_me; - - for (int j = 0; j < cons_at_head.size(); ++j) { - if (cons_at_head[j] == delete_me) { - cons_at_head.erase(j); - break; - } - } - -#ifdef DEBUG_CHECK_ASSERTIONS - - for (int j = 0; j < cons_at_head.size(); ++j) { - TBOX_ASSERT(cons_at_head[j] != delete_me); - } -#endif - - delete d_cons_from_me[i]; - d_cons_from_me[i] = NULL; - } - d_cons_from_me.clear(); - - /* - * Delete Connectors to me. - */ - for (int i = 0; i < d_cons_to_me.size(); ++i) { - - const Connector* delete_me = d_cons_to_me[i]; - - // Remove reference held by other end of Connector. - ConVect& cons_at_base = - delete_me->getBase().getPersistentOverlapConnectors().d_cons_from_me; - - for (int j = 0; j < cons_at_base.size(); ++j) { - if (cons_at_base[j] == delete_me) { - cons_at_base.erase(j); - break; - } + if (s_create_empty_neighbor_containers) { + const BoxContainer& base_boxes = connector.getBase().getBoxes(); + for (RealBoxConstIterator bi(base_boxes.realBegin()); + bi != base_boxes.realEnd(); ++bi) { + connector.makeEmptyLocalNeighborhood(bi->getBoxId()); } - -#ifdef DEBUG_CHECK_ASSERTIONS - - for (int j = 0; j < cons_at_base.size(); ++j) { - TBOX_ASSERT(cons_at_base[j] != delete_me); - } - -#endif - - delete d_cons_to_me[i]; - d_cons_to_me[i] = NULL; - + } else { + /* + * Remove empty neighborhood sets. They are not essential to an + * overlap Connector. + */ + connector.eraseEmptyNeighborSets(); } - d_cons_to_me.clear(); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.h index ad79d21a..6a649a4b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/PersistentOverlapConnectors.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager of Connectors incident from a common BoxLevel. * ************************************************************************/ @@ -18,6 +18,18 @@ namespace SAMRAI { namespace hier { +/*! + * @brief Action to take when Connectors between BoxLevels are not found. + */ +enum ConnectorNotFoundAction { + CONNECTOR_ERROR, // If the Connector is not found then error + CONNECTOR_CREATE, // If the Connector is not found silently + // create it + CONNECTOR_IMPLICIT_CREATION_RULE // If the Connector is not found take + // action specified by + // s_implicit_connector_creation_rule +}; + class Connector; class BoxLevel; @@ -36,38 +48,65 @@ class BoxLevel; * and copied into the collection. Connectors can also be * automatically computed using a non-scalable global search. * - * If the input database contains a PersistentOverlapConnectors database, - * the following inputs are recognized: + * Input Parameters * - * bool check_created_connectors: When true, checks Connectors when - * they are created. The check is an non-scalable operation and is - * meant for debugging. + * Definitions: * - * bool check_accessed_connectors: When true, check Connectors when - * they are accessed. The check is an non-scalable operation and is - * meant for debugging. + * - \b implicit_connector_creation_rule + * How to proceed when findConnector() cannot find any suitable overlap + * Connector. Values can be "ERROR", "WARN" (default) or "SILENT". If + * "SILENT", silently get a globalized version of the head BoxLevel and + * look for overlaps. If "WARN", do the same thing but write a warning to + * the log. If "ERROR", exit with an error. * - * bool always_create_missing_connector: When true, override - * findConnector() to behave like findOrCreateConnector(). This - * essentially ensures that any Connectors sought are always found. + * Details:
      + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      parametertypedefaultrangeopt/reqbehavior on restart
      implicit_connector_creation_rulestring"WARN""ERROR", "WARN", "SILENT"optNot read from restart
      * - * @note - * Creating Connectors this way (setting always_create_missing_connector - * to true) is non-scalable. Nevertheless, the default is true, so that - * application writers need not to worry about creating Connectors in - * a scalable way. For performance, this should be set to false. To - * selectively enable automatic Connector generation, set this to false and - * use findOrCreateConnector() instead of findConnector() where one is - * unsure if the Connector has been created. + * @note Creating overlap Connectors by global search is not scalable + * Nevertheless, the default for implicit_connector_creation_rule is "WARN", + * so that application development need not worry about missing overlap + * Connectors. To selectively enable automatic Connector generation, set this + * input paramter to "ERROR" and call findConnector() with "CREATE" where you + * are unsure if the Connector has been created. * * @see findConnector() - * @see findOrCreateConnector() - * @see hier::Connector + * @see Connector */ class PersistentOverlapConnectors { public: + /*! + * @brief Set whether to create empty neighbor containers when a + * base Box has no neighbor. + * + * Setting a value of true means that all Connectors returned will + * have a neighbor container for each base box. False means that + * base boxes with no neighbors will not have a neighbor container. + * The default is false. + */ + static void + setCreateEmptyNeighborContainers( + bool create_empty_neighbor_containers); + +private: /*! * @brief Deletes all Connectors to and from this object */ @@ -80,13 +119,16 @@ class PersistentOverlapConnectors * The base will be the BoxLevel that owns this object. * Find Connector relationships using a (non-scalable) global search. * - * @see hier::Connector - * @see hier::Connector::initialize() + * @see Connector + * @see Connector::initialize() * * @param[in] head * @param[in] connector_width * * @return A const reference to the newly created overlap Connector. + * + * @pre myBoxLevel().isInitialized() + * @pre head.isInitialized() */ const Connector& createConnector( @@ -94,96 +136,129 @@ class PersistentOverlapConnectors const IntVector& connector_width); /*! - * @brief Create an overlap Connector using externally - * computed relationships. + * @brief Create an overlap Connector with its transpose, computing + * relationships by globalizing data. * - * Create the Connector initialized with the arguments. * The base will be the BoxLevel that owns this object. + * Find Connector relationships using a (non-scalable) global search. * - * @see hier::Connector - * @see hier::Connector::initialize() + * @see Connector + * @see Connector::initialize() * * @param[in] head * @param[in] connector_width - * @param[in] relationships + * @param[in] transpose_connector_width + * + * @return A const reference to the newly created overlap Connector. + * + * @pre myBoxLevel().isInitialized() + * @pre head.isInitialized() */ const Connector& - createConnector( + createConnectorWithTranspose( const BoxLevel& head, const IntVector& connector_width, - const Connector& relationships); + const IntVector& transpose_connector_width); /*! - * @brief Cache the supplied overlap Connector. - * - * The head will be the supplied head and the base will be the - * BoxLevel that owns this object. + * @brief Cache the supplied overlap Connector and its transpose + * if it exists. * - * @param[in] head * @param[in] connector + * + * @pre connector + * @pre myBoxLevel().isInitialized() + * @pre myBoxLevel() == connector->getBase() */ void cacheConnector( - const BoxLevel& head, - Connector* connector); + boost::shared_ptr& connector); /*! * @brief Find an overlap Connector with the given head and minimum - * Connector width. + * Connector width. If the specified Connector is not found, take the + * specified action. * * If multiple Connectors fit the criteria, the one with the * smallest ghost cell width (based on the algebraic sum of the * components) is selected. * - * TODO: The criterion for selecting a single Connector is - * arbitrary and should be re-examined. - * * @par Assertions - * If no Connector fits the criteria and @c - * always_create_missing_connector is false, an assertion is - * thrown. To automatically create the Connector instead, use - * findOrCreateConnector() or set @c - * always_create_missing_connector to true. + * If no Connector fits the criteria and not_found_action == ERROR, an + * unrecoverable error will be generated. If not_found_action == CREATE, + * the Connector will be generated using an unscalable algorithm. If + * not_found_action == IMPLICIT_CREATION_RULE, the behavior will be + * determined by the @c implicit_connector_creation_rule input parameter. + * If it is "ERROR", an unrecoverable error will be generated. If it is + * "WARN" or "SILENT" the Connector will be generated using an unscalable + * algorithm and either a warning will be generated or not. * * @param[in] head Find the overlap Connector with this specified head. * @param[in] min_connector_width Find the overlap Connector satisfying * this minimum Connector width. - * @param[in] exact_width_only If true, reject Connectors that do not - * match the requested width exactly. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. * * @return The Connector which matches the search criterion. + * + * @pre myBoxLevel().isInitialized() + * @pre head.isInitialized() */ const Connector& findConnector( const BoxLevel& head, const IntVector& min_connector_width, - bool exact_width_only = false); + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true); /*! - * @brief Find or create an overlap Connectors with the - * given head and minimum Connector width. + * @brief Find an overlap Connector with its transpose with the given head + * and minimum Connector widths. If the specified Connector is not found, + * take the specified action. * * If multiple Connectors fit the criteria, the one with the * smallest ghost cell width (based on the algebraic sum of the * components) is selected. * - * TODO: The criterion for selecting a - * single Connector is arbitrary and should be re-examined. + * TODO: The criterion for selecting a single Connector is + * arbitrary and should be re-examined. * - * If no Connector fits the criteria, a new one is created using - * global search for edges. + * @par Assertions + * If no Connector fits the criteria and not_found_action == ERROR, an + * unrecoverable error will be generated. If not_found_action == CREATE, + * the Connector will be generated using an unscalable algorithm. If + * not_found_action == IMPLICIT_CREATION_RULE, the behavior will be + * determined by the @c implicit_connector_creation_rule input parameter. + * If it is "ERROR", an unrecoverable error will be generated. If it is + * "WARN" or "SILENT" the Connector will be generated using an unscalable + * algorithm and either a warning will be generated or not. * * @param[in] head Find the overlap Connector with this specified head. * @param[in] min_connector_width Find the overlap Connector satisfying - * this minimum ghost cell width. - * @param[in] exact_width_only If true, reject Connectors that do not - * match the requested width exactly. + * this minimum Connector width. + * @param[in] transpose_min_connector_width Find the transpose overlap + * Connector satisfying this minimum Connector width. + * @param[in] not_found_action Action to take if Connector is not found. + * @param[in] exact_width_only If true, the returned Connector will + * have exactly the requested connector width. If only a Connector + * with a greater width is found, a connector of the requested width + * will be generated. + * + * @return The Connector which matches the search criterion. + * + * @pre myBoxLevel().isInitialized() + * @pre head.isInitialized() */ const Connector& - findOrCreateConnector( + findConnectorWithTranspose( const BoxLevel& head, const IntVector& min_connector_width, - bool exact_width_only = false); + const IntVector& transpose_min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only = true); /*! * @brief Returns whether the object has overlap @@ -199,16 +274,13 @@ class PersistentOverlapConnectors * @param[in] head Find the overlap Connector with this specified head. * @param[in] min_connector_width Find the overlap Connector satisfying * this minimum ghost cell width. - * @param[in] exact_width_only If true, reject Connectors that do not - * match the requested width exactly. * * @return True if a Connector is found, otherwise false. */ bool hasConnector( const BoxLevel& head, - const IntVector& min_connector_width, - bool exact_width_only = false) const; + const IntVector& min_connector_width) const; /*! * @brief Delete stored Connectors. @@ -216,18 +288,59 @@ class PersistentOverlapConnectors void clear(); -private: + const BoxLevel& + myBoxLevel() + { + return d_my_box_level; + } + + // Unimplemented default constructor. + PersistentOverlapConnectors(); + //@{ @name Methods meant only for BoxLevel to use. /*! * @brief Constructor, to be called from the BoxLevel * allocating the object. * - * @param my_mapped_box_level The BoxLevel served by this + * @param my_box_level The BoxLevel served by this * object. */ explicit PersistentOverlapConnectors( - const BoxLevel& my_mapped_box_level); + const BoxLevel& my_box_level); + + /* + * Read from the input database. + */ + void + getFromInput(); + + /* + * Method which does work of findConnector and findConnectorWithTranspose. + */ + boost::shared_ptr + doFindConnectorWork( + const BoxLevel& head, + const IntVector& min_connector_width, + ConnectorNotFoundAction not_found_action, + bool exact_width_only); + + /* + * Method which does work of cacheConnector. + */ + void + doCacheConnectorWork( + const BoxLevel& head, + boost::shared_ptr& connector); + + /* + * @brief Make sure all base boxes have a neighbor set or remove + * empty neighbor sets, depending on + * s_create_empty_neighbor_containers. + */ + void + postprocessForEmptyNeighborContainers( + Connector& connector); //@} @@ -239,7 +352,7 @@ class PersistentOverlapConnectors friend class BoxLevel; //@} - typedef tbox::Array ConVect; + typedef std::vector > ConVect; /*! * @brief Persistent overlap Connectors incident from me. @@ -254,7 +367,7 @@ class PersistentOverlapConnectors /*! * @brief Reference to the BoxLevel served by this object. */ - const BoxLevel& d_my_mapped_box_level; + const BoxLevel& d_my_box_level; /*! * @brief Whether to check overlap Connectors when they are created. @@ -266,11 +379,24 @@ class PersistentOverlapConnectors */ static char s_check_accessed_connectors; + /*! + * @brief Whether to create empty neighbor containers when a base + * Box has no neighbor. + */ + static bool s_create_empty_neighbor_containers; + /*! * @brief Whether to force Connector finding functions to create * connectors that are missing. + * + * See input parameter implicit_connector_creation_rule. + */ + static char s_implicit_connector_creation_rule; + + /* + * @brief Count of how many times we have done implicit global searches. */ - static bool s_always_create_missing_connector; + static size_t s_num_implicit_global_searches; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.C index e270f9bc..5e4a850f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: tbox * ************************************************************************/ @@ -36,7 +36,7 @@ ProcessorMapping::ProcessorMapping( const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); d_my_rank = mpi.getRank(); d_nodes = mpi.getSize(); - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { d_mapping[i] = 0; } } @@ -45,20 +45,20 @@ ProcessorMapping::ProcessorMapping( const ProcessorMapping& mapping): d_my_rank(-1), d_nodes(-1), - d_mapping(mapping.d_mapping.getSize()), + d_mapping(mapping.d_mapping.size()), d_local_id_count(-1) { const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); d_my_rank = mpi.getRank(); d_nodes = mpi.getSize(); - const int n = d_mapping.getSize(); - for (int i = 0; i < n; i++) { + const int n = static_cast(d_mapping.size()); + for (int i = 0; i < n; ++i) { d_mapping[i] = mapping.d_mapping[i]; } } ProcessorMapping::ProcessorMapping( - const tbox::Array& mapping): + const std::vector& mapping): d_my_rank(-1), d_nodes(-1), d_local_id_count(-1) @@ -75,11 +75,11 @@ ProcessorMapping::~ProcessorMapping() void ProcessorMapping::setMappingSize( - const int n) + const size_t n) { - d_mapping.resizeArray(n); + d_mapping.resize(n); - for (int i = 0; i < n; i++) { + for (size_t i = 0; i < n; ++i) { d_mapping[i] = 0; } d_local_id_count = -1; @@ -87,11 +87,11 @@ ProcessorMapping::setMappingSize( void ProcessorMapping::setProcessorMapping( - const tbox::Array& mapping) + const std::vector& mapping) { - d_mapping.resizeArray(mapping.getSize()); + d_mapping.resize(mapping.size()); - for (int i = 0; i < d_mapping.getSize(); i++) { + for (int i = 0; i < static_cast(d_mapping.size()); ++i) { // (mapping[i] % d_nodes) keeps patches from being assigned // non-existent processors. setProcessorAssignment(i, mapping[i] % d_nodes); @@ -110,10 +110,10 @@ ProcessorMapping::computeLocalIndices() const * first, count the number of local indices, * so we can set the array size. */ - const int n = d_mapping.getSize(); + const int n = static_cast(d_mapping.size()); d_local_id_count = 0; - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { if (d_mapping[i] == d_my_rank) { ++d_local_id_count; } @@ -122,9 +122,9 @@ ProcessorMapping::computeLocalIndices() const /* * second, resize the array and fill in the data */ - d_local_indices.resizeArray(d_local_id_count); + d_local_indices.resize(d_local_id_count); int idx = 0; - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { if (d_mapping[i] == d_my_rank) { d_local_indices[idx++] = i; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.h index 871a653d..908c165c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/ProcessorMapping.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: tbox * ************************************************************************/ @@ -12,9 +12,10 @@ #define included_hier_ProcessorMapping #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" +#include + namespace SAMRAI { namespace hier { @@ -53,10 +54,10 @@ class ProcessorMapping /** * Create a new processor mapping and get processor assignments - * from the the tbox::Array argument. + * from the the std::vector argument. */ explicit ProcessorMapping( - const tbox::Array& mapping); + const std::vector& mapping); /** * The destructor simply releases the storage for the mapping. @@ -69,13 +70,13 @@ class ProcessorMapping */ void setMappingSize( - const int n); + const size_t n); /** - * Sets the number of mapped_boxes to n. + * Sets the number of boxes to n. * IMPORTANT NOTE: This method should only be used for * testing purposes. Under normal circumstances, the number of - * mapped_boxes is set by a call to tbox::SAMRAI_MPI::getNodes() and should NOT + * boxes is set by a call to tbox::SAMRAI_MPI::getNodes() and should NOT * be changed. */ void @@ -87,46 +88,51 @@ class ProcessorMapping /** * Return the processor assignment for the specified patch index. + * + * @pre (i >= 0) && (i < getProcessorMapping().size()) */ int getProcessorAssignment( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_mapping.getSize())); + TBOX_ASSERT((i >= 0) && (i < static_cast(d_mapping.size()))); return d_mapping[i]; } /** * Set the processor assignment (second argument) for the specified * patch index (first argument). + * + * @pre (i >= 0) && (i < getProcessorMapping().size()) + * @pre (p >= 0) && (p < d_nodes) */ void setProcessorAssignment( const int i, const int p) { - TBOX_ASSERT((i >= 0) && (i < d_mapping.getSize())); + TBOX_ASSERT((i >= 0) && (i < static_cast(d_mapping.size()))); TBOX_ASSERT((p >= 0) && (p < d_nodes)); d_mapping[i] = p % d_nodes; } /** - * Return an tbox::Array of the processor mappings. + * Return an std::vector of the processor mappings. */ - tbox::Array + const std::vector& getProcessorMapping() const { return d_mapping; } /** - * Sets the processor mappings from an tbox::Array. Remaps the + * Sets the processor mappings from an std::vector. Remaps the * processors so that patches are not accidentally mapped to - * non-existent mapped_boxes. + * non-existent boxes. */ void setProcessorMapping( - const tbox::Array& mapping); + const std::vector& mapping); /** * Return the number of local indices (that is, those indices mapped to @@ -140,10 +146,10 @@ class ProcessorMapping } /** - * Return an array containing the local indices (that is, + * Return a vector containing the local indices (that is, * those indices mapped to the local processor). */ - const tbox::Array& + const std::vector& getLocalIndices() const { computeLocalIndices(); @@ -156,18 +162,20 @@ class ProcessorMapping int getSizeOfMappingArray() const { - return d_mapping.getSize(); + return static_cast(d_mapping.size()); } /** * Check whether the specified index is a local index (that is, mapped * to the local processor). + * + * @pre (i >= 0) && (i < getProcessorMapping().size()) */ bool isMappingLocal( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_mapping.getSize())); + TBOX_ASSERT((i >= 0) && (i < static_cast(d_mapping.size()))); return d_mapping[i] == d_my_rank; } @@ -178,15 +186,15 @@ class ProcessorMapping void computeLocalIndices() const; - void + ProcessorMapping& operator = ( const ProcessorMapping&); // not implemented int d_my_rank; int d_nodes; - tbox::Array d_mapping; + std::vector d_mapping; mutable int d_local_id_count; - mutable tbox::Array d_local_indices; + mutable std::vector d_local_indices; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.C index 033da355..007a635b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.C @@ -3,27 +3,23 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator over real Boxes in a BoxContainer. * ************************************************************************/ -#ifndef included_hier_RealBoxConstIterator_C -#define included_hier_RealBoxConstIterator_C - #include "SAMRAI/hier/RealBoxConstIterator.h" namespace SAMRAI { namespace hier { RealBoxConstIterator::RealBoxConstIterator( - const BoxContainer& mapped_boxes, + const BoxContainer& boxes, bool begin): - d_mapped_boxes(&mapped_boxes), - d_ni(begin ? d_mapped_boxes->begin() : d_mapped_boxes->end()) + d_boxes(&boxes), + d_ni(begin ? d_boxes->begin() : d_boxes->end()) { - if (begin) - { - while (d_ni != d_mapped_boxes->end() && d_ni->isPeriodicImage()) { + if (begin) { + while (d_ni != d_boxes->end() && d_ni->isPeriodicImage()) { ++d_ni; } } @@ -31,7 +27,7 @@ RealBoxConstIterator::RealBoxConstIterator( RealBoxConstIterator::~RealBoxConstIterator() { - d_mapped_boxes = NULL; + d_boxes = 0; } /* @@ -45,7 +41,7 @@ RealBoxConstIterator::operator ++ () { do { ++d_ni; - } while (d_ni != d_mapped_boxes->end() && d_ni->isPeriodicImage()); + } while (d_ni != d_boxes->end() && d_ni->isPeriodicImage()); return *this; } @@ -62,10 +58,9 @@ RealBoxConstIterator::operator ++ ( RealBoxConstIterator saved = *this; do { ++d_ni; - } while (d_ni != d_mapped_boxes->end() && d_ni->isPeriodicImage()); + } while (d_ni != d_boxes->end() && d_ni->isPeriodicImage()); return saved; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.h index 5f6a8556..e56a6aef 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RealBoxConstIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator over real Boxes in a BoxContainer. * ************************************************************************/ @@ -17,7 +17,6 @@ namespace SAMRAI { namespace hier { - /* * TODO: Do we really need a separate class for this? Couldn't we just * add an argument to the BoxContainer iterator construction that @@ -35,16 +34,17 @@ namespace hier { * * Example usage: * @verbatim - * BoxContainer mapped_boxes; - * // fill in mapped_boxes - * for ( RealBoxConstIterator ni(mapped_boxes); ni.isValid(); ++ni ) { + * BoxContainer boxes; + * // fill in boxes + * for ( RealBoxConstIterator ni(boxes.realBegin()); + * ni != boxes.realEnd()(); ++ni ) { * TBOX_ASSERT( ! ni->isPeriodicImage() ); * } * @endverbatim */ class RealBoxConstIterator { -friend class BoxContainer; + friend class BoxContainer; public: /*! @@ -59,7 +59,7 @@ friend class BoxContainer; operator = ( const RealBoxConstIterator& r) { - d_mapped_boxes = r.d_mapped_boxes; + d_boxes = r.d_boxes; d_ni = r.d_ni; return *this; } @@ -89,7 +89,7 @@ friend class BoxContainer; operator == ( const RealBoxConstIterator& r) const { - return d_mapped_boxes == r.d_mapped_boxes && d_ni == r.d_ni; + return d_boxes == r.d_boxes && d_ni == r.d_ni; } /*! @@ -99,7 +99,7 @@ friend class BoxContainer; operator != ( const RealBoxConstIterator& r) const { - return d_mapped_boxes != r.d_mapped_boxes || d_ni != r.d_ni; + return d_boxes != r.d_boxes || d_ni != r.d_ni; } /*! @@ -125,19 +125,19 @@ friend class BoxContainer; /*! * @brief Construct the iterator for the given BoxContainer. * - * The iterator will iterate through the items in mapped_boxes. + * The iterator will iterate through the items in boxes. * - * @param[in] mapped_boxes + * @param[in] boxes * @param[in] begin */ - explicit RealBoxConstIterator( - const BoxContainer& mapped_boxes, + RealBoxConstIterator( + const BoxContainer& boxes, bool begin); /*! * @brief BoxContainer being iterated through. */ - const BoxContainer* d_mapped_boxes; + const BoxContainer* d_boxes; /*! * @brief The iterator. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.C index 9721b75a..bc2e3b68 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.C @@ -3,36 +3,33 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for spatial refinement operators. * ************************************************************************/ - -#ifndef included_hier_RefineOperator_C -#define included_hier_RefineOperator_C - #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/tbox/StartupShutdownManager.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" + namespace SAMRAI { namespace hier { std::multimap RefineOperator::s_lookup_table; +TBOX_omp_lock_t RefineOperator::l_lookup_table; tbox::StartupShutdownManager::Handler RefineOperator::s_finalize_handler( - 0, + RefineOperator::initializeCallback, 0, 0, RefineOperator::finalizeCallback, tbox::StartupShutdownManager::priorityList); RefineOperator::RefineOperator( - const tbox::Dimension& dim, const std::string& name): - d_name(name), - d_dim(dim) + d_name(name) { registerInLookupTable(name); } @@ -42,15 +39,26 @@ RefineOperator::~RefineOperator() removeFromLookupTable(d_name); } +void +RefineOperator::registerInLookupTable( + const std::string& name) +{ + TBOX_omp_set_lock(&l_lookup_table); + s_lookup_table.insert( + std::pair(name, this)); + TBOX_omp_unset_lock(&l_lookup_table); +} + void RefineOperator::removeFromLookupTable( const std::string& name) { /* * The lookup table might be empty if static RefineOperator's are used - * in which case the table will have been removed before the statics + * in which case the table will have been cleared before the statics * are destroyed. */ + TBOX_omp_set_lock(&l_lookup_table); if (!s_lookup_table.empty()) { std::multimap::iterator mi = s_lookup_table.find(name); @@ -61,9 +69,10 @@ RefineOperator::removeFromLookupTable( } TBOX_ASSERT(mi->first == name); TBOX_ASSERT(mi->second == this); - mi->second = NULL; + mi->second = 0; s_lookup_table.erase(mi); } + TBOX_omp_unset_lock(&l_lookup_table); } /* @@ -78,17 +87,37 @@ RefineOperator::getMaxRefineOpStencilWidth( { IntVector max_width(dim, 0); + TBOX_omp_set_lock(&l_lookup_table); for (std::multimap::const_iterator mi = s_lookup_table.begin(); mi != s_lookup_table.end(); ++mi) { const RefineOperator* op = mi->second; - if (op->getDim() == dim) { - max_width.max(op->getStencilWidth()); - } + max_width.max(op->getStencilWidth(dim)); } + TBOX_omp_unset_lock(&l_lookup_table); return max_width; } +/* + ************************************************************************* + ************************************************************************* + */ +void +RefineOperator::initializeCallback() +{ + TBOX_omp_init_lock(&l_lookup_table); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +RefineOperator::finalizeCallback() +{ + s_lookup_table.clear(); + TBOX_omp_destroy_lock(&l_lookup_table); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.h index b1c92dce..073271cf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/RefineOperator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for spatial refinement operators. * ************************************************************************/ @@ -17,6 +17,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/Variable.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include #include @@ -25,7 +26,7 @@ namespace SAMRAI { namespace hier { /** - * Class RefineOperator is an abstract base class for each + * Class RefineOperator is an abstract base class for each * spatial refinement operator used in the SAMRAI framework. This class * defines the interface between numerical refinement routines and the * rest of the framework. Each concrete refinement operator subclass @@ -58,7 +59,7 @@ namespace hier { * and data type as well as the mesh coordinate system, they are defined * in the geometry package. * - * @see hier::TransferOperatorRegistry + * @see TransferOperatorRegistry */ class RefineOperator @@ -66,15 +67,14 @@ class RefineOperator public: /*! * @brief Construct the object with a name to allow the - * hier::TransferOperatorRegistry class to look up the object using a + * TransferOperatorRegistry class to look up the object using a * string. * * The constructor must be given a name. The object will be - * registered under this name with the hier::TransferOperatorRegistry class. + * registered under this name with the TransferOperatorRegistry class. * The name must be unique, as duplicate names are not allowed. */ RefineOperator( - const tbox::Dimension& dim, const std::string& name); /** @@ -106,9 +106,12 @@ class RefineOperator * The SAMRAI transfer routines guarantee that the source patch will * contain sufficient ghost cell data surrounding the interior to * satisfy the stencil width requirements for each refinement operator. + * If your implementation doesn't work with the given dimension, return + * zero. */ virtual IntVector - getStencilWidth() const = 0; + getStencilWidth( + const tbox::Dimension& dim) const = 0; /** * Refine the source component on the coarse patch to the destination @@ -136,19 +139,10 @@ class RefineOperator getMaxRefineOpStencilWidth( const tbox::Dimension& dim); - /** - * Return the dimension of this object. - */ - const tbox::Dimension& - getDim() const - { - return d_dim; - } - private: RefineOperator( const RefineOperator&); // not implemented - void + RefineOperator& operator = ( const RefineOperator&); // not implemented @@ -165,11 +159,7 @@ class RefineOperator */ void registerInLookupTable( - const std::string& name) - { - s_lookup_table.insert( - std::pair(name, this)); - } + const std::string& name); /*! * @brief Remove the operator with the given name. @@ -179,20 +169,22 @@ class RefineOperator removeFromLookupTable( const std::string& name); + /*! + * @brief Method registered with ShutdownManager to initialize statics. + */ + static void + initializeCallback(); + /*! * @brief Method registered with ShutdownManager to cleanup statics. */ static void - finalizeCallback() - { - s_lookup_table.clear(); - } + finalizeCallback(); const std::string d_name; - const tbox::Dimension d_dim; - static std::multimap s_lookup_table; + static TBOX_omp_lock_t l_lookup_table; static tbox::StartupShutdownManager::Handler s_finalize_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SequentialLocalIdGenerator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SequentialLocalIdGenerator.h new file mode 100644 index 00000000..9eb7b5f8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SequentialLocalIdGenerator.h @@ -0,0 +1,115 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Generator of sequential LocalIds. + * + ************************************************************************/ + +#ifndef included_hier_SequentialLocalIdGenerator +#define included_hier_SequentialLocalIdGenerator + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/MessageStream.h" + +#include + +namespace SAMRAI { +namespace hier { + +/*! + * @brief Class for generating sequential LocalId. + * + * Objects of this class generate new LocalId by increasing the last + * generated value by a constant increment (1 by default). It is + * possible to set both the last generated value and the increment. + */ +class SequentialLocalIdGenerator +{ + +public: + /*! + * @brief Default constructor. + * + * Construct an object generating sequential values starting with zero. + */ + SequentialLocalIdGenerator(): + d_last_value(-1), + d_increment(1) { + } + + /*! + * @brief Constructor. + * + * Construct an object with user-defined last value and increment. + */ + SequentialLocalIdGenerator( + const LocalId& last_value, + const LocalId& increment = LocalId(1)): + d_last_value(last_value), + d_increment(increment) { + } + + /*! + * @brief Destructor. + */ + ~SequentialLocalIdGenerator() { + } + + /*! + * @brief Return a LocalId that is greater than the previous + * value by the increment value. + */ + LocalId nextValue() { + d_last_value += d_increment; + return d_last_value; + } + + /* + * @brief Reset the last value. + * + * @param [in] value + */ + void setLastValue(const LocalId& last_value) { + d_last_value = last_value; + } + + /* + * @brief Set the increment value + * + * @param [in] increment + */ + void setIncrement(const LocalId& increment) { + d_increment = increment; + } + + //! @brief Pack into a MessageStream. + friend tbox::MessageStream& operator << ( + tbox::MessageStream& msg, + const SequentialLocalIdGenerator& id_gen) + { + msg << id_gen.d_last_value << id_gen.d_increment; + return msg; + } + + //! @brief Unpack from a MessageStream. + friend tbox::MessageStream& operator >> ( + tbox::MessageStream& msg, + SequentialLocalIdGenerator& id_gen) + { + msg >> id_gen.d_last_value >> id_gen.d_increment; + return msg; + } + +private: + LocalId d_last_value; + LocalId d_increment; + +}; + +} +} + +#endif // included_hier_SequentialLocalIdGenerator diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.C new file mode 100644 index 00000000..73a0aae0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.C @@ -0,0 +1,850 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Class for finding multiblockSingularities + * + ************************************************************************/ +#include "SAMRAI/hier/SingularityFinder.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace hier { + +std::vector > SingularityFinder::s_face_edges; +std::vector > SingularityFinder::s_face_nodes; + +/* + * ************************************************************************ + * + * Constructor + * + * ************************************************************************ + */ + +SingularityFinder::SingularityFinder( + const tbox::Dimension& dim): + d_dim(dim) +{ + + if (d_dim.getValue() == 3 && s_face_edges.empty()) { + std::vector edges; + edges.resize(4); + edges[0] = 0; + edges[1] = 2; + edges[2] = 4; + edges[3] = 6; + s_face_edges.push_back(edges); + edges[0] = 1; + edges[1] = 3; + edges[2] = 5; + edges[3] = 7; + s_face_edges.push_back(edges); + edges[0] = 0; + edges[1] = 1; + edges[2] = 8; + edges[3] = 10; + s_face_edges.push_back(edges); + edges[0] = 2; + edges[1] = 3; + edges[2] = 9; + edges[3] = 11; + s_face_edges.push_back(edges); + edges[0] = 4; + edges[1] = 5; + edges[2] = 8; + edges[3] = 9; + s_face_edges.push_back(edges); + edges[0] = 6; + edges[1] = 7; + edges[2] = 10; + edges[3] = 11; + s_face_edges.push_back(edges); + } + + if (s_face_nodes.empty()) { + std::vector nodes; + if (d_dim.getValue() == 3) { + nodes.resize(4); + nodes[0] = 0; + nodes[1] = 2; + nodes[2] = 4; + nodes[3] = 6; + s_face_nodes.push_back(nodes); + nodes[0] = 1; + nodes[1] = 3; + nodes[2] = 5; + nodes[3] = 7; + s_face_nodes.push_back(nodes); + nodes[0] = 0; + nodes[1] = 1; + nodes[2] = 4; + nodes[3] = 5; + s_face_nodes.push_back(nodes); + nodes[0] = 2; + nodes[1] = 3; + nodes[2] = 6; + nodes[3] = 7; + s_face_nodes.push_back(nodes); + nodes[0] = 0; + nodes[1] = 1; + nodes[2] = 2; + nodes[3] = 3; + s_face_nodes.push_back(nodes); + nodes[0] = 4; + nodes[1] = 5; + nodes[2] = 6; + nodes[3] = 7; + s_face_nodes.push_back(nodes); + } else if (d_dim.getValue() == 2) { + nodes.resize(2); + nodes[0] = 0; + nodes[1] = 2; + s_face_nodes.push_back(nodes); + nodes[0] = 1; + nodes[1] = 3; + s_face_nodes.push_back(nodes); + nodes[0] = 0; + nodes[1] = 1; + s_face_nodes.push_back(nodes); + nodes[0] = 2; + nodes[1] = 3; + s_face_nodes.push_back(nodes); + } + } +} + +/* + * ************************************************************************ + * + * Destructor + * + * ************************************************************************ + */ + +SingularityFinder::~SingularityFinder() +{ +} + +/* + * ************************************************************************ + * + * Find the singularities. + * + * ************************************************************************ + */ + +void +SingularityFinder::findSingularities( + std::set >& singularity_blocks, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry, + const std::map >& face_neighbors) +{ + if (face_neighbors.empty()) return; + + if (grid_geometry.getNumberBlocks() == 1) return; + + TBOX_ASSERT(singularity_blocks.empty()); + + std::map > unprocessed = face_neighbors; + std::list to_be_processed; + to_be_processed.push_back(face_neighbors.begin()->first); + + do { + BoxId base_id = *(to_be_processed.begin()); + to_be_processed.pop_front(); + + if (unprocessed.find(base_id) == unprocessed.end()) continue; + + TBOX_ASSERT(face_neighbors.find(base_id) != face_neighbors.end()); + const std::map& nbr_ids = face_neighbors.find(base_id)->second; + for (std::map::const_iterator nbr_itr = nbr_ids.begin(); + nbr_itr != nbr_ids.end(); ++nbr_itr) { + + const std::pair& nbr_face = *nbr_itr; + const BoxId& nbr_id = nbr_face.first; + int facea = nbr_face.second; + + TBOX_ASSERT(face_neighbors.find(nbr_id) != face_neighbors.end()); + const std::map& nbr_of_nbr = face_neighbors.find(nbr_id)->second; + TBOX_ASSERT(nbr_of_nbr.find(base_id) != nbr_of_nbr.end()); + int faceb = nbr_of_nbr.find(base_id)->second; + + if (unprocessed[base_id].find(nbr_id) != unprocessed[base_id].end()) { + connect(base_id, nbr_id, facea, faceb, domain_boxes, grid_geometry); + + to_be_processed.push_back(nbr_id); + + unprocessed[nbr_id].erase(base_id); + if (unprocessed[nbr_id].empty()) { + unprocessed.erase(nbr_id); + } + unprocessed[base_id].erase(nbr_id); + if (unprocessed[base_id].empty()) { + unprocessed.erase(base_id); + break; + } + } + } + } while (!unprocessed.empty()); + + findBoundaryFaces(); + + std::set > sing_set; + + for (std::list >::iterator e_itr = d_edges.begin(); + e_itr != d_edges.end(); ++e_itr) { + if ((**e_itr).d_bdry) continue; + int nblocks = static_cast((**e_itr).d_blocks.size()); + bool enhanced = false; + bool reduced = false; + if (nblocks < 4) { + reduced = true; + } else if (nblocks > 4) { + enhanced = true; + } + + if (reduced || enhanced) { + std::set sing_set; + for (std::set::iterator s_itr = (**e_itr).d_blocks.begin(); + s_itr != (**e_itr).d_blocks.end(); ++s_itr) { + BoxId box_id(LocalId(*s_itr), 0); + const BlockId& block_id = + domain_boxes.find(Box(d_dim, box_id))->getBlockId(); + sing_set.insert(block_id); + } + singularity_blocks.insert(sing_set); + } + } + + for (std::list >::iterator p_itr = d_points.begin(); + p_itr != d_points.end(); ++p_itr) { + if ((**p_itr).d_bdry) continue; + int nblocks = static_cast((**p_itr).d_blocks.size()); + bool enhanced = false; + bool reduced = false; + if (nblocks < (1 << d_dim.getValue())) { + reduced = true; + } else if (nblocks > (1 << d_dim.getValue())) { + enhanced = true; + } + + if (reduced || enhanced) { + std::set sing_set; + for (std::set::iterator s_itr = (**p_itr).d_blocks.begin(); + s_itr != (**p_itr).d_blocks.end(); ++s_itr) { + BoxId box_id(LocalId(*s_itr), 0); + const BlockId& block_id = + domain_boxes.find(Box(d_dim, box_id))->getBlockId(); + sing_set.insert(block_id); + } + singularity_blocks.insert(sing_set); + } + } + +} + +/* + * ************************************************************************ + * + * Figure out the connection between Box A and Box B + * + * ************************************************************************ + */ + +void +SingularityFinder::connect(const BoxId& id_a, + const BoxId& id_b, + int facea, + int faceb, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry) +{ + + boost::shared_ptr face = boost::make_shared(); + d_faces.push_back(face); + + if (d_blocks.empty()) { + d_blocks.resize(domain_boxes.size()); + } + + int a = id_a.getLocalId().getValue(); + int b = id_b.getLocalId().getValue(); + if (d_blocks[a].get() == 0) { + d_blocks[a] = boost::make_shared(d_dim); + } + if (d_blocks[b].get() == 0) { + d_blocks[b] = boost::make_shared(d_dim); + } + + d_blocks[a]->d_face[facea] = face; + d_blocks[b]->d_face[faceb] = face; + face->d_block_to_face[a] = facea; + face->d_block_to_face[b] = faceb; + + /* + * Map from edge on 'a' to edge on 'b' + */ + std::map map_of_edges; + if (d_dim.getValue() == 3) { + findCoincidentEdges(map_of_edges, + id_a, + id_b, + facea, + faceb, + domain_boxes, + grid_geometry); + } + + for (std::map::const_iterator e_itr = map_of_edges.begin(); + e_itr != map_of_edges.end(); ++e_itr) { + + boost::shared_ptr& edgea = d_blocks[a]->d_edge[e_itr->first]; + boost::shared_ptr& edgeb = d_blocks[b]->d_edge[e_itr->second]; + + if (edgea.get() == 0 && edgeb.get() == 0) { + edgea.reset(new Edge()); + edgeb = edgea; + d_edges.push_back(edgea); + } else if (edgea.get() != 0 && edgeb.get() == 0) { + edgeb = edgea; + } else if (edgeb.get() != 0 && edgea.get() == 0) { + edgea = edgeb; + } else if (edgea.get() == edgeb.get()) { + // nothing needed + } else { + TBOX_ASSERT(edgea.get() != 0 && edgeb.get() != 0); + for (std::set::iterator b_itr = edgeb->d_blocks.begin(); + b_itr != edgeb->d_blocks.end(); ++b_itr) { + edgea->d_blocks.insert(*b_itr); + edgea->d_block_to_edge[*b_itr] = edgeb->d_block_to_edge[*b_itr]; + if (*b_itr != a && *b_itr != b) { + d_blocks[*b_itr]->d_edge[edgea->d_block_to_edge[*b_itr]] = edgea; + } + } + for (std::list >::iterator e_itr = + d_edges.begin(); e_itr != d_edges.end(); ++e_itr) { + if (e_itr->get() == edgeb.get()) { + d_edges.erase(e_itr); + break; + } + } + edgeb = edgea; + } + + edgea->d_blocks.insert(a); + edgea->d_blocks.insert(b); + edgea->d_block_to_edge[a] = e_itr->first; + edgea->d_block_to_edge[b] = e_itr->second; + } + + std::map map_of_points; + findCoincidentPoints(map_of_points, + id_a, + id_b, + facea, + domain_boxes, + grid_geometry); + + for (std::map::const_iterator e_itr = map_of_points.begin(); + e_itr != map_of_points.end(); ++e_itr) { + + boost::shared_ptr& pointa = d_blocks[a]->d_point[e_itr->first]; + boost::shared_ptr& pointb = d_blocks[b]->d_point[e_itr->second]; + + if (pointa.get() == 0 && pointb.get() == 0) { + pointa.reset(new Point()); + pointb = pointa; + d_points.push_back(pointa); + } else if (pointa.get() != 0 && pointb.get() == 0) { + pointb = pointa; + } else if (pointb.get() != 0 && pointa.get() == 0) { + pointa = pointb; + } else if (pointa.get() == pointb.get()) { + // nothing needed + } else { + TBOX_ASSERT(pointa.get() != 0 && pointb.get() != 0); + for (std::set::iterator b_itr = pointb->d_blocks.begin(); + b_itr != pointb->d_blocks.end(); ++b_itr) { + pointa->d_blocks.insert(*b_itr); + pointa->d_block_to_point[*b_itr] = + pointb->d_block_to_point[*b_itr]; + if (*b_itr != a && *b_itr != b) { + d_blocks[*b_itr]->d_point[pointa->d_block_to_point[*b_itr]] = + pointa; + } + } + for (std::list >::iterator e_itr = + d_points.begin(); e_itr != d_points.end(); ++e_itr) { + if (e_itr->get() == pointb.get()) { + d_points.erase(e_itr); + break; + } + } + pointb = pointa; + } + + pointa->d_blocks.insert(a); + pointa->d_blocks.insert(b); + pointa->d_block_to_point[a] = e_itr->first; + pointa->d_block_to_point[b] = e_itr->second; + } + +} + +/* + * ************************************************************************ + * + * Figure the boundary faces, those not shared between blocks or boxes + * + * ************************************************************************ + */ + +void +SingularityFinder::findBoundaryFaces() +{ + for (int iblock = 0; iblock < static_cast(d_blocks.size()); ++iblock) { + + boost::shared_ptr& block = d_blocks[iblock]; + + for (int iface = 0; iface < 2 * d_dim.getValue(); ++iface) { + + boost::shared_ptr& face = block->d_face[iface]; + + if (face.get() == 0) { + + face.reset(new Face()); + d_faces.push_back(face); + face->d_bdry = true; + face->d_blocks.insert(iblock); + + if (d_dim.getValue() > 2) { + for (int iedge = 0; iedge < 4; ++iedge) { + int edge_idx = s_face_edges[iface][iedge]; + if (!block->d_edge[edge_idx]) { + boost::shared_ptr edge = boost::make_shared(); + d_edges.push_back(edge); + edge->d_blocks.insert(iblock); + block->d_edge[edge_idx] = edge; + } + block->d_edge[edge_idx]->d_bdry = true; + } + } + + int num_pts = 1 << (d_dim.getValue() - 1); + for (int ipoint = 0; ipoint < num_pts; ++ipoint) { + int point_idx = s_face_nodes[iface][ipoint]; + if (!block->d_point[point_idx]) { + boost::shared_ptr point = boost::make_shared(); + point->d_blocks.insert(iblock); + block->d_point[point_idx] = point; + } + block->d_point[point_idx]->d_bdry = true; + } + } + } + } +} + +/* + * ************************************************************************ + * + * Given two boxes that are face neighbors, find their shared edges + * + * ************************************************************************ + */ + +void +SingularityFinder::findCoincidentEdges( + std::map& map_of_edges, + const BoxId& id_a, + const BoxId& id_b, + int facea, + int faceb, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry) +{ + if (d_dim.getValue() != 3) return; + + TBOX_ASSERT(map_of_edges.empty()); + + Box a_box = *(domain_boxes.find(Box(d_dim, id_a))); + Box b_box = *(domain_boxes.find(Box(d_dim, id_b))); + + for (int d = 0; d < d_dim.getValue(); ++d) { + if (a_box.lower() (d) == a_box.upper() (d)) { + a_box.setLower(static_cast(d), + a_box.lower(static_cast(d)) - 1); + a_box.setUpper(static_cast(d), + a_box.upper(static_cast(d)) + 1); + } + if (b_box.lower() (d) == b_box.upper() (d)) { + b_box.setLower(static_cast(d), + b_box.lower(static_cast(d)) - 1); + b_box.setUpper(static_cast(d), + b_box.upper(static_cast(d)) + 1); + } + } + + Box b_node_box(b_box); + b_node_box.setUpper(b_node_box.upper() + IntVector::getOne(d_dim)); + IntVector b_box_size(b_node_box.numberCells()); + BoxContainer b_edge_boxes; + + int nedges_per_face = 4; + + for (int i = 0; i < nedges_per_face; ++i) { + + int edgea_idx = s_face_edges[facea][i]; + int edgeb_idx = -1; + + Box edge_box(a_box); + + switch (edgea_idx) { + + case 0: + edge_box.setUpper(0, edge_box.lower(0)); + edge_box.setUpper(1, edge_box.lower(1)); + break; + case 1: + edge_box.setLower(0, edge_box.upper(0)); + edge_box.setUpper(1, edge_box.lower(1)); + break; + case 2: + edge_box.setUpper(0, edge_box.lower(0)); + edge_box.setLower(1, edge_box.upper(1)); + break; + case 3: + edge_box.setLower(0, edge_box.upper(0)); + edge_box.setLower(1, edge_box.upper(1)); + break; + case 4: + edge_box.setUpper(0, edge_box.lower(0)); + edge_box.setUpper(2, edge_box.lower(2)); + break; + case 5: + edge_box.setLower(0, edge_box.upper(0)); + edge_box.setUpper(2, edge_box.lower(2)); + break; + case 6: + edge_box.setUpper(0, edge_box.lower(0)); + edge_box.setLower(2, edge_box.upper(2)); + break; + case 7: + edge_box.setLower(0, edge_box.upper(0)); + edge_box.setLower(2, edge_box.upper(2)); + break; + case 8: + edge_box.setUpper(1, edge_box.lower(1)); + edge_box.setUpper(2, edge_box.lower(2)); + break; + case 9: + edge_box.setLower(1, edge_box.upper(1)); + edge_box.setUpper(2, edge_box.lower(2)); + break; + case 10: + edge_box.setUpper(1, edge_box.lower(1)); + edge_box.setLower(2, edge_box.upper(2)); + break; + case 11: + edge_box.setLower(1, edge_box.upper(1)); + edge_box.setLower(2, edge_box.upper(2)); + break; + default: + break; + } + + if (a_box.getBlockId() != b_box.getBlockId()) { + bool transformed = grid_geometry.transformBox(edge_box, + 0, + b_box.getBlockId(), + a_box.getBlockId()); +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(transformed); +#endif + TBOX_ASSERT(transformed); + } + edge_box.setUpper(edge_box.upper() + IntVector::getOne(d_dim)); + Box b_edge(edge_box * b_node_box); + + IntVector b_edge_dirs(b_edge.numberCells()); + int num_zero_dirs = 0; + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + TBOX_ASSERT(b_edge_dirs[d] >= 1); + if (b_edge_dirs[d] == b_box_size[d]) { + b_edge_dirs[d] = 0; + ++num_zero_dirs; + } else if (b_edge.lower() (d) == b_node_box.lower(d)) { + b_edge_dirs[d] = -1; + } else if (b_edge.upper() (d) == b_node_box.upper(d)) { + b_edge_dirs[d] = 1; + } else { + TBOX_ERROR( + "SingularityFinder::findCoincidentEdges: Transformed box is not at the edge of the reference box."); + } + } + + if (num_zero_dirs != 1) { + if (b_edge_boxes.empty()) { + for (int e = 0; e < nedges_per_face; ++e) { + + int edge_idx = s_face_edges[faceb][e]; + + Box add_box(b_box); + add_box.setUpper(add_box.upper() + IntVector::getOne(d_dim)); + + switch (edge_idx) { + + case 0: + add_box.setUpper(0, add_box.lower(0)); + add_box.setUpper(1, add_box.lower(1)); + break; + case 1: + add_box.setLower(0, add_box.upper(0)); + add_box.setUpper(1, add_box.lower(1)); + break; + case 2: + add_box.setUpper(0, add_box.lower(0)); + add_box.setLower(1, add_box.upper(1)); + break; + case 3: + add_box.setLower(0, add_box.upper(0)); + add_box.setLower(1, add_box.upper(1)); + break; + case 4: + add_box.setUpper(0, add_box.lower(0)); + add_box.setUpper(2, add_box.lower(2)); + break; + case 5: + add_box.setLower(0, add_box.upper(0)); + add_box.setUpper(2, add_box.lower(2)); + break; + case 6: + add_box.setUpper(0, add_box.lower(0)); + add_box.setLower(2, add_box.upper(2)); + break; + case 7: + add_box.setLower(0, add_box.upper(0)); + add_box.setLower(2, add_box.upper(2)); + break; + case 8: + add_box.setUpper(1, add_box.lower(1)); + add_box.setUpper(2, add_box.lower(2)); + break; + case 9: + add_box.setLower(1, add_box.upper(1)); + add_box.setUpper(2, add_box.lower(2)); + break; + case 10: + add_box.setUpper(1, add_box.lower(1)); + add_box.setLower(2, add_box.upper(2)); + break; + case 11: + add_box.setLower(1, add_box.upper(1)); + add_box.setLower(2, add_box.upper(2)); + break; + default: + break; + + } + + b_edge_boxes.pushBack(add_box); + } + } + + BoxContainer b_edge_cntnr(b_edge); + b_edge_cntnr.intersectBoxes(b_edge_boxes); + b_edge_cntnr.coalesce(); + TBOX_ASSERT(b_edge_cntnr.size() == 1); + + b_edge = *(b_edge_cntnr.begin()); + b_edge_dirs = b_edge.numberCells(); + num_zero_dirs = 0; + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + TBOX_ASSERT(b_edge_dirs[d] >= 1); + if (b_edge_dirs[d] == b_box_size[d]) { + b_edge_dirs[d] = 0; + ++num_zero_dirs; + } else if (b_edge.lower() (d) == b_node_box.lower(d)) { + b_edge_dirs[d] = -1; + } else if (b_edge.upper() (d) == b_node_box.upper(d)) { + b_edge_dirs[d] = 1; + } else { + TBOX_ERROR( + "SingularityFinder::findCoincidentEdges: Transformed box is not at the edge of the reference box."); + } + } + + TBOX_ASSERT(num_zero_dirs == 1); + } + + if (b_edge_dirs[0] == 0) { + TBOX_ASSERT(b_edge_dirs[1] != 0 && b_edge_dirs[2] != 0); + if (b_edge_dirs[1] == -1) { + if (b_edge_dirs[2] == -1) { + edgeb_idx = 8; + } else { + edgeb_idx = 10; + } + } else { + if (b_edge_dirs[2] == -1) { + edgeb_idx = 9; + } else { + edgeb_idx = 11; + } + } + } else if (b_edge_dirs[1] == 0) { + TBOX_ASSERT(b_edge_dirs[0] != 0 && b_edge_dirs[2] != 0); + if (b_edge_dirs[0] == -1) { + if (b_edge_dirs[2] == -1) { + edgeb_idx = 4; + } else { + edgeb_idx = 6; + } + } else { + if (b_edge_dirs[2] == -1) { + edgeb_idx = 5; + } else { + edgeb_idx = 7; + } + } + } else if (b_edge_dirs[2] == 0) { + TBOX_ASSERT(b_edge_dirs[0] != 0 && b_edge_dirs[1] != 0); + if (b_edge_dirs[0] == -1) { + if (b_edge_dirs[1] == -1) { + edgeb_idx = 0; + } else { + edgeb_idx = 2; + } + } else { + if (b_edge_dirs[1] == -1) { + edgeb_idx = 1; + } else { + edgeb_idx = 3; + } + } + } else { + TBOX_ERROR("SingularityFinder::findCoincidentEdges failed to find location of edges."); + } + + TBOX_ASSERT(edgeb_idx >= 0); + + map_of_edges[edgea_idx] = edgeb_idx; + + } + +} + +/* + * ************************************************************************ + * + * Given two boxes that are face neighbors, find their shared corner points + * + * ************************************************************************ + */ + +void +SingularityFinder::findCoincidentPoints( + std::map& map_of_points, + const BoxId& id_a, + const BoxId& id_b, + int facea, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry) +{ + + Box a_box = *(domain_boxes.find(Box(d_dim, id_a))); + Box b_box = *(domain_boxes.find(Box(d_dim, id_b))); + + for (int d = 0; d < d_dim.getValue(); ++d) { + if (a_box.lower() (d) == a_box.upper() (d)) { + a_box.setLower(static_cast(d), + a_box.lower(static_cast(d)) - 1); + a_box.setUpper(static_cast(d), + a_box.upper(static_cast(d)) + 1); + } + if (b_box.lower() (d) == b_box.upper() (d)) { + b_box.setLower(static_cast(d), + b_box.lower(static_cast(d)) - 1); + b_box.setUpper(static_cast(d), + b_box.upper(static_cast(d)) + 1); + } + } + + Box b_node_box(b_box); + b_node_box.setUpper(b_node_box.upper() + IntVector::getOne(d_dim)); + IntVector b_box_size(b_node_box.numberCells()); + + int npoints_per_face = 1 << (d_dim.getValue() - 1); + + for (int i = 0; i < npoints_per_face; ++i) { + + int pointa_idx = s_face_nodes[facea][i]; + + Box point_box(a_box); + + IntVector corner_dirs(d_dim, 0); + corner_dirs[0] = (pointa_idx % 2 == 0) ? -1 : 1; + if (d_dim.getValue() > 1) { + corner_dirs[1] = ((pointa_idx / 2) % 2 == 0) ? -1 : 1; + } + if (d_dim.getValue() > 2) { + corner_dirs[2] = ((pointa_idx / 4) % 2 == 0) ? -1 : 1; + } + + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + TBOX_ASSERT(corner_dirs[d] == -1 || corner_dirs[d] == 1); + if (corner_dirs[d] == -1) { + point_box.setUpper(d, point_box.lower(d)); + } else { + point_box.setLower(d, point_box.upper(d)); + } + } + + if (a_box.getBlockId() != b_box.getBlockId()) { + bool transformed = grid_geometry.transformBox(point_box, + 0, + b_box.getBlockId(), + a_box.getBlockId()); +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(transformed); +#endif + TBOX_ASSERT(transformed); + } + + point_box.setUpper(point_box.upper() + IntVector::getOne(d_dim)); + Box b_point(point_box * b_node_box); + + IntVector b_point_dirs(d_dim, 0); + for (int d = 0; d < d_dim.getValue(); ++d) { + if (b_point.lower() (d) == b_node_box.lower() (d)) { + b_point_dirs[d] = -1; + } else if (b_point.upper() (d) == b_node_box.upper() (d)) { + b_point_dirs[d] = 1; + } else { + TBOX_ERROR( + "SingularityFinder::findCoincidentPoints: Transformed box is not located at the corner of the reference box"); + } + } + + int pointb_idx = 0; + for (int d = 0; d < d_dim.getValue(); ++d) { + if (b_point_dirs[d] == 1) { + pointb_idx += (1 << d); + } + } + + TBOX_ASSERT(pointb_idx >= 0); + + map_of_points[pointa_idx] = pointb_idx; + + } + +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.h new file mode 100644 index 00000000..837977bd --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/SingularityFinder.h @@ -0,0 +1,261 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Class for finding multiblock singularities + * + ************************************************************************/ + +#ifndef included_hier_SingularityFinder +#define included_hier_SingularityFinder + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/BaseGridGeometry.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace hier { + +/*! + * @brief Class SingularityFinder implements an algorithm to find + * multiblock singularities based on the relationships between blocks that + * touch on an entire face. + */ + +class SingularityFinder +{ +public: + SingularityFinder( + const tbox::Dimension& dim); + + /*! + * @brief Destructor + */ + ~SingularityFinder(); + + /*! + * @brief Find the singularities based on the relationship between + * face neighbors. + * + * The singularity information is computed based on the face_neighbors + * input. In the nested map of maps face_neighbors, the key for the outer + * map is a BoxId of a Box in the domain_boxes input (the reference Box). + * For each reference Box,the inner map contains information about all its + * face neighbors. + * + * Each face neighbor has a BoxId as its identifying key and + * an integer to indicate which face of the reference Box the neighbor + * touches. The formula for the integer identifier is: For each normal + * direction D = 0,...,NDIM-1, the lower face identifier is 2*D and the + * upper face identifier is 2*D+1. + * + * The domain_boxes input is a representation of the physical domain that + * must be set up such that all face neighbor relationships between + * Boxes touch each other across the entirety of each Box face. + * + * @param[out] singularity_blocks Output for the computed singularities. + * The outer set is the container of all + * singularities, while each inner set + * contains all of the BlockIds for the + * blocks that touch one singularity. + * @param[in] domain_boxes Representation of the physical domain. + * @param[in] grid_geometry The grid geometry describing the multiblock + * layout. + * @param[in] face_neighbors Input information about face neighbor + * relationships, described above. + */ + void + findSingularities( + std::set >& singularity_blocks, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry, + const std::map >& face_neighbors); + +private: + struct Block; + struct Face; + struct Edge; + struct Point; + + /*! + * @brief Private struct Block holds inforation about all + * the faces, edges, and corner points of a block. + */ + struct Block { + Block( + const tbox::Dimension& dim) { + + if (dim.getValue() == 1) { + d_nfaces = 2; + d_nedges = 0; + d_npoints = 0; + } else if (dim.getValue() == 2) { + d_nfaces = 4; + d_nedges = 0; + d_npoints = 4; + } else if (dim.getValue() == 3) { + d_nfaces = 6; + d_nedges = 12; + d_npoints = 8; + } else { + d_nfaces = 0; + d_nedges = 0; + d_npoints = 0; + } + + if (d_nfaces) { + d_face.resize(d_nfaces); + } + if (d_nedges) { + d_edge.resize(d_nedges); + } + if (d_npoints) { + d_point.resize(d_npoints); + } + + } + + int d_nfaces; + int d_nedges; + int d_npoints; + std::vector > d_face; + std::vector > d_edge; + std::vector > d_point; + }; + + /*! + * @brief Private struct Face + * + * Each block face is represented by this struct. When a face is shared by + * two blocks, a single instance of this struct is shared by both blocks. + */ + struct Face { + + Face() { + d_bdry = false; + } + + bool d_bdry; + std::set d_blocks; + std::map d_block_to_face; + }; + + /*! + * @brief Private struct Edge + * + * In 3D, each block edge is represented by this struct. When an edge is + * shared by multiple blocks, a single instance of this struct is shared by + * all of the blocks. + */ + struct Edge { + + Edge() { + d_bdry = false; + } + + bool d_bdry; + std::set d_blocks; + std::map d_block_to_edge; + }; + + /*! + * @brief Private struct Point + * + * Each corner point of a block is represented by this struct. When a + * point is shared by multiple blocks, a single instance of this struct is + * shared by all of the blocks. + */ + struct Point { + + Point() { + d_bdry = false; + } + + bool d_bdry; + std::set d_blocks; + std::map d_block_to_point; + }; + + /* + * Unimplemented default constructor. + */ + SingularityFinder(); + + /*! + * @brief Find all shared information between two Boxes. + * + * Given two BoxIds representing two Boxes that share a face, + * compute all the information about shared points and edges. + * + * @param[in] id_a ID of Box A + * @param[in] id_b ID of Box B + * @param[in] face_a Face of Box A that touches Box B + * @param[in] face_b Face of Box B that touches Box A + * @param[in] domain_boxes Boxes for the physical domain + * @param[in] grid_geometry + */ + void + connect( + const BoxId& id_a, + const BoxId& id_b, + int face_a, + int face_b, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry); + + /*! + * @brief Determine which block faces are not shared by two blocks. These + * are boundary faces and must be excluded from the singularity computation. + */ + void + findBoundaryFaces(); + + /*! + * @brief Determine which edges are shared between two boxes. + */ + void + findCoincidentEdges( + std::map& map_of_edges, + const BoxId& id_a, + const BoxId& id_b, + int facea, + int faceb, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry); + + /*! + * @brief Determine which corner points are shared between two boxes. + */ + void + findCoincidentPoints( + std::map& map_of_points, + const BoxId& id_a, + const BoxId& id_b, + int facea, + const BoxContainer& domain_boxes, + const BaseGridGeometry& grid_geometry); + + tbox::Dimension d_dim; + + std::vector > d_blocks; + std::vector > d_faces; + std::list > d_edges; + std::list > d_points; + + /*! + * @brief Static vectors that serve as a table to map face identifiers + * to edge and node integer identifiers. + */ + static std::vector > s_face_edges; + static std::vector > s_face_nodes; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.C index ae477e4e..a46b2cc6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for time interpolation operators. * ************************************************************************/ - -#ifndef included_hier_TimeInterpolateOperator_C -#define included_hier_TimeInterpolateOperator_C - #include "SAMRAI/hier/TimeInterpolateOperator.h" namespace SAMRAI { namespace hier { TimeInterpolateOperator::TimeInterpolateOperator( - const std::string& name) : + const std::string& name): d_name(name) { } @@ -28,4 +24,3 @@ TimeInterpolateOperator::~TimeInterpolateOperator() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.h index b18bab1f..f90e145e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TimeInterpolateOperator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for time interpolation operators. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -45,13 +45,13 @@ namespace hier { * subclass must implement the interpolation operation in the timeInterpolate() * function. Then, the new operator must be added to the operator list * for the appropriate transfer geometry object using the - * Geometry::addTimeInterpolateOperator() function. + * BaseGridGeometry::addTimeInterpolateOperator() function. * * Although time interpolation operators usually depend only on patch data * centering and data type and not the mesh coordinate system, they are * defined in the @em geometry package. * - * @see hier::TransferOperatorRegistry + * @see TransferOperatorRegistry */ class TimeInterpolateOperator @@ -97,7 +97,7 @@ class TimeInterpolateOperator // Neither of these is implemented. TimeInterpolateOperator( const TimeInterpolateOperator&); - void + TimeInterpolateOperator& operator = ( const TimeInterpolateOperator&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.C index 1ea408ce..d7bc209e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.C @@ -3,16 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton registry for all tranfer operators. * ************************************************************************/ - -#ifndef included_hier_TransferOperatorRegistry_C -#define included_hier_TransferOperatorRegistry_C - #include "SAMRAI/hier/TransferOperatorRegistry.h" -#include "SAMRAI/hier/BaseGridGeometry.h" #include @@ -30,7 +25,6 @@ namespace hier { TransferOperatorRegistry::TransferOperatorRegistry( const tbox::Dimension& dim): d_min_stencil_width(dim, 0), - d_dim(dim), d_max_op_stencil_width_req(false) { } @@ -52,21 +46,26 @@ TransferOperatorRegistry::addCoarsenOperator( const char* var_type_name, const boost::shared_ptr& coarsen_op) { - if (d_max_op_stencil_width_req && - (coarsen_op->getStencilWidth() > getMaxTransferOpStencilWidth())) { - TBOX_WARNING( - "Adding coarsen operator " << coarsen_op->getOperatorName() - << "\nwith stencil width greater than current maximum\n" - << "after call to getMaxTransferOpStencilWidth.\n"); + if (d_max_op_stencil_width_req) { + for (short unsigned int d(1); d <= SAMRAI::MAX_DIM_VAL; ++d) { + if (coarsen_op->getStencilWidth(tbox::Dimension(d)) > + getMaxTransferOpStencilWidth(tbox::Dimension(d))) { + TBOX_WARNING( + "Adding coarsen operator " << coarsen_op->getOperatorName() + << "\nwith stencil width greater than current maximum\n" + << "after call to getMaxTransferOpStencilWidth.\n"); + } + } } boost::unordered_map > >::iterator coarsen_ops = - d_coarsen_operators.find(coarsen_op->getOperatorName()); + boost::shared_ptr > >:: + iterator coarsen_ops = + d_coarsen_operators.find(coarsen_op->getOperatorName()); if (coarsen_ops == d_coarsen_operators.end()) { coarsen_ops = d_coarsen_operators.insert( - std::make_pair(coarsen_op->getOperatorName(), - boost::unordered_map >(0))).first; + std::make_pair(coarsen_op->getOperatorName(), + boost::unordered_map >(0))).first; } coarsen_ops->second.insert(std::make_pair(var_type_name, coarsen_op)); } @@ -76,21 +75,26 @@ TransferOperatorRegistry::addRefineOperator( const char* var_type_name, const boost::shared_ptr& refine_op) { - if (d_max_op_stencil_width_req && - (refine_op->getStencilWidth() > getMaxTransferOpStencilWidth())) { - TBOX_WARNING( - "Adding refine operator " << refine_op->getOperatorName() - << "\nwith stencil width greater than current maximum\n" - << "after call to getMaxTransferOpStencilWidth.\n"); + if (d_max_op_stencil_width_req) { + for (short unsigned int d(1); d <= SAMRAI::MAX_DIM_VAL; ++d) { + if (refine_op->getStencilWidth(tbox::Dimension(d)) > + getMaxTransferOpStencilWidth(tbox::Dimension(d))) { + TBOX_WARNING( + "Adding refine operator " << refine_op->getOperatorName() + << "\nwith stencil width greater than current maximum\n" + << "after call to getMaxTransferOpStencilWidth.\n"); + } + } } boost::unordered_map > >::iterator refine_ops = - d_refine_operators.find(refine_op->getOperatorName()); + boost::shared_ptr > >:: + iterator refine_ops = + d_refine_operators.find(refine_op->getOperatorName()); if (refine_ops == d_refine_operators.end()) { refine_ops = d_refine_operators.insert( - std::make_pair(refine_op->getOperatorName(), - boost::unordered_map >(0))).first; + std::make_pair(refine_op->getOperatorName(), + boost::unordered_map >(0))).first; } refine_ops->second.insert(std::make_pair(var_type_name, refine_op)); } @@ -101,13 +105,14 @@ TransferOperatorRegistry::addTimeInterpolateOperator( const boost::shared_ptr& time_op) { boost::unordered_map > >::iterator time_ops = - d_time_operators.find(time_op->getOperatorName()); + boost::shared_ptr > > + ::iterator time_ops = + d_time_operators.find(time_op->getOperatorName()); if (time_ops == d_time_operators.end()) { time_ops = d_time_operators.insert( - std::make_pair(time_op->getOperatorName(), - boost::unordered_map >(0))).first; + std::make_pair(time_op->getOperatorName(), + boost::unordered_map >(0))).first; } time_ops->second.insert(std::make_pair(var_type_name, time_op)); } @@ -122,41 +127,37 @@ TransferOperatorRegistry::addTimeInterpolateOperator( boost::shared_ptr TransferOperatorRegistry::lookupCoarsenOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name) { TBOX_ASSERT(var); - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *var); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_min_stencil_width, *var); boost::shared_ptr coarsen_op; if ((op_name == "NO_COARSEN") || (op_name == "USER_DEFINED_COARSEN") || (op_name.empty())) { - } - else { - if (d_coarsen_operators.empty()) { - grid_geometry.buildOperators(); - } + } else { boost::unordered_map > >::iterator coarsen_ops = - d_coarsen_operators.find(op_name); + boost::shared_ptr > > + ::iterator coarsen_ops = + d_coarsen_operators.find(op_name); if (coarsen_ops == d_coarsen_operators.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupCoarsenOperator" << - " could not find any operators with name " << op_name << - std::endl); + "TransferOperatorRegistry::lookupCoarsenOperator" + << " could not find any operators with name " << op_name + << std::endl); } boost::unordered_map >::iterator the_op = - coarsen_ops->second.find(typeid(*var).name()); + boost::shared_ptr >::iterator the_op = + coarsen_ops->second.find(typeid(*var).name()); if (the_op == coarsen_ops->second.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupCoarsenOperator" << - " could not find operator with name " << op_name << - " for variable named " << typeid(*var).name() << std::endl); + "TransferOperatorRegistry::lookupCoarsenOperator" + << " could not find operator with name " << op_name + << " for variable named " << typeid(*var).name() << std::endl); } coarsen_op = the_op->second; } @@ -166,41 +167,37 @@ TransferOperatorRegistry::lookupCoarsenOperator( boost::shared_ptr TransferOperatorRegistry::lookupRefineOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name) { TBOX_ASSERT(var); - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *var); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_min_stencil_width, *var); boost::shared_ptr refine_op; if ((op_name == "NO_REFINE") || (op_name == "USER_DEFINED_REFINE") || (op_name.empty())) { - } - else { - if (d_refine_operators.empty()) { - grid_geometry.buildOperators(); - } + } else { boost::unordered_map > >::iterator refine_ops = - d_refine_operators.find(op_name); + boost::shared_ptr > > + ::iterator refine_ops = + d_refine_operators.find(op_name); if (refine_ops == d_refine_operators.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupRefineOperator" << - " could not find any operators with name " << op_name << - std::endl); + "TransferOperatorRegistry::lookupRefineOperator" + << " could not find any operators with name " << op_name + << std::endl); } boost::unordered_map >::iterator the_op = - refine_ops->second.find(typeid(*var).name()); + boost::shared_ptr >::iterator the_op = + refine_ops->second.find(typeid(*var).name()); if (the_op == refine_ops->second.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupRefineOperator" << - " could not find operator with name " << op_name << - " for variable named " << typeid(*var).name() << std::endl); + "TransferOperatorRegistry::lookupRefineOperator" + << " could not find operator with name " << op_name + << " for variable named " << typeid(*var).name() << std::endl); } refine_op = the_op->second; } @@ -210,40 +207,37 @@ TransferOperatorRegistry::lookupRefineOperator( boost::shared_ptr TransferOperatorRegistry::lookupTimeInterpolateOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name) { TBOX_ASSERT(var); - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *var); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_min_stencil_width, *var); boost::shared_ptr time_op; if ((op_name == "NO_TIME_INTERPOLATE") || (op_name.empty())) { - } - else { - if (d_time_operators.empty()) { - grid_geometry.buildOperators(); - } + } else { boost::unordered_map > >::iterator time_ops = - d_time_operators.find(op_name); + boost::shared_ptr< + TimeInterpolateOperator> > >:: + iterator time_ops = + d_time_operators.find(op_name); if (time_ops == d_time_operators.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupTimeInterpolateOperator" << - " could not find any operators with name " << op_name << - std::endl); + "TransferOperatorRegistry::lookupTimeInterpolateOperator" + << " could not find any operators with name " << op_name + << std::endl); } boost::unordered_map >::iterator the_op = - time_ops->second.find(typeid(*var).name()); + boost::shared_ptr >::iterator the_op = + time_ops->second.find(typeid(*var).name()); if (the_op == time_ops->second.end()) { TBOX_ERROR( - "TransferOperatorRegistry::lookupTimeInterpolateOperator" << - " could not find operator with name " << op_name << - " for variable named " << typeid(*var).name() << std::endl); + "TransferOperatorRegistry::lookupTimeInterpolateOperator" + << " could not find operator with name " << op_name + << " for variable named " << typeid(*var).name() << std::endl); } time_op = the_op->second; } @@ -258,11 +252,14 @@ TransferOperatorRegistry::lookupTimeInterpolateOperator( ************************************************************************* */ IntVector -TransferOperatorRegistry::getMaxTransferOpStencilWidth() +TransferOperatorRegistry::getMaxTransferOpStencilWidth(const tbox::Dimension& dim) { - IntVector max_width(d_min_stencil_width); - max_width.max(RefineOperator::getMaxRefineOpStencilWidth(getDim())); - max_width.max(CoarsenOperator::getMaxCoarsenOpStencilWidth(getDim())); + IntVector max_width(dim, 0); + if (d_min_stencil_width.getDim() == dim) { + max_width.max(d_min_stencil_width); + } + max_width.max(RefineOperator::getMaxRefineOpStencilWidth(dim)); + max_width.max(CoarsenOperator::getMaxCoarsenOpStencilWidth(dim)); d_max_op_stencil_width_req = true; return max_width; } @@ -285,13 +282,14 @@ TransferOperatorRegistry::printClassData( os << "Coarsen operators: " << std::endl; boost::unordered_map > >::const_iterator cop = - d_coarsen_operators.begin(); + boost::shared_ptr > >:: + const_iterator cop = + d_coarsen_operators.begin(); while (cop != d_coarsen_operators.end()) { os << cop->first << std::endl; boost::unordered_map >::const_iterator ccop = - cop->second.begin(); + boost::shared_ptr >::const_iterator ccop = + cop->second.begin(); while (ccop != cop->second.end()) { os << ccop->second.get() << std::endl; ++ccop; @@ -301,13 +299,14 @@ TransferOperatorRegistry::printClassData( os << "Refine operators: " << std::endl; boost::unordered_map > >::const_iterator rop = - d_refine_operators.begin(); + boost::shared_ptr > >:: + const_iterator rop = + d_refine_operators.begin(); while (rop != d_refine_operators.end()) { os << rop->first << std::endl; boost::unordered_map >::const_iterator rrop = - rop->second.begin(); + boost::shared_ptr >::const_iterator rrop = + rop->second.begin(); while (rrop != rop->second.end()) { os << rrop->second.get() << std::endl; ++rrop; @@ -317,13 +316,14 @@ TransferOperatorRegistry::printClassData( os << "Time interpolate operators: " << std::endl; boost::unordered_map > >::const_iterator top = - d_time_operators.begin(); + boost::shared_ptr > > + ::const_iterator top = + d_time_operators.begin(); while (top != d_time_operators.end()) { os << top->first << std::endl; boost::unordered_map >::const_iterator ttop = - top->second.begin(); + boost::shared_ptr >::const_iterator ttop = + top->second.begin(); while (ttop != top->second.end()) { os << ttop->second.get() << std::endl; ++ttop; @@ -334,4 +334,3 @@ TransferOperatorRegistry::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.h index 3f819158..36bdfe1d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/TransferOperatorRegistry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton registry for all transfer operators. * ************************************************************************/ @@ -22,30 +22,28 @@ #include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include BEGIN_BOOST_WARNING_SUPPRESSION -#include +#include "boost/unordered_map.hpp" END_BOOST_WARNING_SUPPRESSION namespace SAMRAI { namespace hier { -class BaseGridGeometry; - /*! * @brief Class TransferOperatorRegistry is intended to serve as the registry * for SAMRAI transfer operators. It will be a singleton object held by class - * hier::BaseGridGeometry. + * BaseGridGeometry. * - * This hier::TransferOperatorRegistry class provides a lookup mechanism to + * This TransferOperatorRegistry class provides a lookup mechanism to * search for time interpolation and spatial coarsening/refining operators. * That is, algorithms and applications that manage communication on an - * AMR hierarchy may query the hier::TransferOperatorRegistry object for + * AMR hierarchy may query the TransferOperatorRegistry object for * operators that may be applied to specific variables. * - * Typically, the operators are assigned to the hier::TrnasferOperatorRegistry + * Typically, the operators are assigned to the TransferOperatorRegistry * object in the constructor of the geometry object that defines the mesh * coordinate system. * @@ -62,16 +60,16 @@ class BaseGridGeometry; * either new patch data types or new operators for pre-existing patch data * types. * - * @see hier::BaseGridGeometry - * @see hier::RefineOperator - * @see hier::CoarsenOperator - * @see hier::TimeInterpolateOperator + * @see BaseGridGeometry + * @see RefineOperator + * @see CoarsenOperator + * @see TimeInterpolateOperator */ class TransferOperatorRegistry { public: /*! - * @brief Set the state of the hier::TransferOperatorRegistry members. + * @brief Set the state of the TransferOperatorRegistry members. * * @param[in] dim */ @@ -130,15 +128,15 @@ class TransferOperatorRegistry * pointer to it will be returned. Otherwise, an unrecoverable error * will result and the program will abort. * - * @param[in] grid_geometry The grid geometry with which the operator - * being looked up is associated. * @param[in] var The Variable for which the corresponding coarsening * operator should match. * @param[in] op_name The string identifier of the coarsening operator. + * + * @pre var + * @pre getMinTransferOpStencilWidth().getDim() == var->getDim() */ boost::shared_ptr lookupCoarsenOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name); @@ -150,15 +148,15 @@ class TransferOperatorRegistry * pointer to it will be returned. Otherwise, an unrecoverable * error will result and the program will abort. * - * @param[in] grid_geometry The grid geometry with which the operator - * being looked up is associated. * @param[in] var The Variable for which the corresponding refinement * operator should match. * @param[in] op_name The string identifier of the refinement operator. + * + * @pre var + * @pre getMinTransferOpStencilWidth().getDim() == var->getDim() */ boost::shared_ptr lookupRefineOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name); @@ -170,16 +168,16 @@ class TransferOperatorRegistry * pointer to it will be returned. Otherwise, an unrecoverable * error will result and the program will abort. * - * @param[in] grid_geometry The grid geometry with which the operator - * being looked up is associated. * @param[in] var The Variable for which the corresponding time * interpolation operator should match. * @param[in] op_name The string identifier of the time interpolation * operator. \b Default: STD_LINEAR_TIME_INTERPOLATE + * + * @pre var + * @pre getMinTransferOpStencilWidth().getDim() == var->getDim() */ boost::shared_ptr lookupTimeInterpolateOperator( - BaseGridGeometry& grid_geometry, const boost::shared_ptr& var, const std::string& op_name = "STD_LINEAR_TIME_INTERPOLATE"); @@ -194,12 +192,13 @@ class TransferOperatorRegistry * @return The max stencil width computed from all registered * operators. * - * @see hier::BaseGridGeometry::getMaxTransferOpStencilWidth(). - * @see hier::RefineOperator::getMaxRefineOpStencilWidth(). - * @see hier::CoarsenOperator::getMaxCoarsenOpStencilWidth(). + * @see BaseGridGeometry::getMaxTransferOpStencilWidth(). + * @see RefineOperator::getMaxRefineOpStencilWidth(). + * @see CoarsenOperator::getMaxCoarsenOpStencilWidth(). */ IntVector - getMaxTransferOpStencilWidth(); + getMaxTransferOpStencilWidth( + const tbox::Dimension& dim); /*! * @brief Set a minimum value on the value returned by @@ -212,25 +211,32 @@ class TransferOperatorRegistry * in getMaxTransferOpStencilWidth(). * * @param[in] min_value The minimum value to set. + * + * @pre getMinTransferOpStencilWidth().getDim() == min_value.getDim() */ void setMinTransferOpStencilWidth( const IntVector& min_value) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_min_stencil_width, min_value); + TBOX_ASSERT_OBJDIM_EQUALITY2(getMinTransferOpStencilWidth(), min_value); d_min_stencil_width = min_value; } + const IntVector& + getMinTransferOpStencilWidth() const + { + return d_min_stencil_width; + } + /*! - * @brief Get the dimension of the hier::BaseGridGeometry holding this - * object. - * - * @return The dimension of the hier::BaseGridGeometry holding this object. + * @brief */ - const tbox::Dimension& - getDim() const + bool + hasOperators() { - return d_dim; + return !d_refine_operators.empty() || + !d_coarsen_operators.empty() || + !d_time_operators.empty(); } /*! @@ -246,46 +252,44 @@ class TransferOperatorRegistry /* * The hash maps of spatial coarsening operators is maintained to lookup * operators for specific variables as requested by algorithms and/or - * applications using the hier::BaseGridGeometry holding this object. + * applications using the BaseGridGeometry holding this object. * Standard concrete coarsening operators can be found in the patchdata * package. Additional operators may be added to this hash map at any time * (see addCoarsenOperator() function). */ boost::unordered_map > > d_coarsen_operators; + boost::shared_ptr > > + d_coarsen_operators; /* * The hash map of spatial refinement operators is maintained to lookup * operators for specific variables as requested by algorithms and/or - * applications using the hier::BaseGridGeometry holding this object. + * applications using the BaseGridGeometry holding this object. * Standard concrete refinement operators can be found in the patchdata * package. Additional operators may be added to this hash map at any time * (see addRefineOperator() function). */ boost::unordered_map > > d_refine_operators; + boost::shared_ptr > > + d_refine_operators; /* * The hash map of time interpolation operators is maintained to lookup * operators for specific variables as requested by algorithms and/or - * applications using the hier::BaseGridGeometry holding this object. + * applications using the BaseGridGeometry holding this object. * Standard concrete time interpolation operators can be found in the * patchdata package. Additional operators may be added to this hash map at * any time (see addTimeInterpolateOperator() function). */ boost::unordered_map > > d_time_operators; + boost::shared_ptr > > + d_time_operators; /*! * @brief Value set by setMinTransferOpStencilWidth(). */ IntVector d_min_stencil_width; - /*! - * @brief The dimension of the grid geometry holding this object. - */ - tbox::Dimension d_dim; - /*! * @brief true if a call to getMaxTransferOpStencilWidth has been made. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.C index 5d998b93..f5083710 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class for managing transformations between index spaces in * an AMR hierarchy. * ************************************************************************/ - -#ifndef included_hier_Transformation_C -#define included_hier_Transformation_C - #include "SAMRAI/hier/Transformation.h" #include "SAMRAI/hier/Patch.h" @@ -82,7 +78,7 @@ void Transformation::transform(Box& box) const { TBOX_ASSERT(box.getBlockId() == d_begin_block || - d_begin_block == BlockId::invalidId()); + d_begin_block == BlockId::invalidId()); box.rotate(d_rotation); box.shift(d_offset); if (d_begin_block != d_end_block) { @@ -102,7 +98,7 @@ Transformation::inverseTransform( Box& box) const { TBOX_ASSERT(box.getBlockId() == d_end_block || - d_end_block == BlockId::invalidId()); + d_end_block == BlockId::invalidId()); IntVector reverse_offset(d_offset.getDim()); calculateReverseShift(reverse_offset, d_offset, d_rotation); @@ -113,6 +109,29 @@ Transformation::inverseTransform( } } +/* + * ************************************************************************ + * + * Get Transformation object that is the inverse of 'this'. + * + * ************************************************************************ + */ +Transformation +Transformation::getInverseTransformation() const +{ + const tbox::Dimension& dim = d_offset.getDim(); + IntVector inv_offset(dim); + calculateReverseShift(inv_offset, d_offset, d_rotation); + + RotationIdentifier inv_rotate = + getReverseRotationIdentifier(d_rotation, dim); + + return Transformation(inv_rotate, + inv_offset, + d_end_block, + d_begin_block); +} + /* * ************************************************************************ * @@ -123,15 +142,27 @@ Transformation::inverseTransform( Transformation::RotationIdentifier Transformation::getRotationIdentifier( - const tbox::Array& rotation_string, + const std::vector& rotation_string, const tbox::Dimension& dim) { - TBOX_ASSERT(rotation_string.getSize() == dim.getValue()); + TBOX_ASSERT(static_cast(rotation_string.size()) == dim.getValue()); RotationIdentifier id = NO_ROTATE; bool is_error = false; - if (dim.getValue() == 2) { + if (dim.getValue() == 1) { + if (rotation_string[0] == "I_UP") { + id = IUP; //0; + } else if (rotation_string[0] == "I_DOWN") { + id = IDOWN; //1; + } else { + is_error = true; + } + if (is_error) { + TBOX_ERROR("Rotation_input " << rotation_string[0] + << " is invalid.\n"); + } + } else if (dim.getValue() == 2) { if (rotation_string[0] == "I_UP") { if (rotation_string[1] == "J_UP") { id = IUP_JUP; //0; @@ -156,11 +187,14 @@ Transformation::getRotationIdentifier( } else { is_error = true; } + } else { + is_error = true; } if (is_error) { - TBOX_ERROR("Rotation_input " << rotation_string[0] << " " - << rotation_string[1] << " " - << " is invalid.\n"); + TBOX_ERROR("Transformation::getRotationIdentifier " + << rotation_string[0] << " " + << rotation_string[1] << " " + << " is invalid.\n"); } } else if (dim.getValue() == 3) { @@ -337,13 +371,15 @@ Transformation::getRotationIdentifier( } if (is_error) { - TBOX_ERROR("Rotation_input " << rotation_string[0] << " " - << rotation_string[1] << " " << rotation_string[2] - << " is invalid.\n"); + TBOX_ERROR("Transformation::getRotationIdentifier " + << rotation_string[0] << " " + << rotation_string[1] << " " + << rotation_string[2] + << " is invalid.\n"); } } else { TBOX_ERROR( - "Transformation::RotationIdentifier : DIM = 1 or > 3 not implemented"); + "Transformation::getRotationIdentifier : DIM > 3 not implemented"); } return id; @@ -364,7 +400,11 @@ Transformation::getReverseRotationIdentifier( { RotationIdentifier reverse_id = (RotationIdentifier)0; - if (dim.getValue() == 2) { + if (rotation == NO_ROTATE) { + reverse_id = rotation; + } else if (dim.getValue() == 1) { + reverse_id = rotation; + } else if (dim.getValue() == 2) { reverse_id = (RotationIdentifier)((4 - (int)rotation) % 4); } else if (dim.getValue() == 3) { switch (rotation) { @@ -473,6 +513,9 @@ Transformation::getReverseRotationIdentifier( reverse_id = IUP_JUP_KUP; break; } + } else { + TBOX_ERROR( + "Transformation::getReverseRotationIdentifier : DIM > 3 with rotation not implemented"); } return reverse_id; @@ -492,11 +535,22 @@ Transformation::calculateReverseShift( const IntVector& shift, const RotationIdentifier rotation) { - TBOX_DIM_ASSERT_CHECK_ARGS2(back_shift, shift); + TBOX_ASSERT_OBJDIM_EQUALITY2(back_shift, shift); const tbox::Dimension& dim(back_shift.getDim()); - if (dim.getValue() == 2) { + if (rotation == NO_ROTATE) { + back_shift = -shift; + } else if (dim.getValue() == 1) { + if (rotation == IUP) { + back_shift = -shift; + } else if (rotation == IDOWN) { + back_shift = shift; + } else { + TBOX_ERROR("Transformation::calculateReverseShift error...\n" + << " Invalid RotationIdentifier value given" << std::endl); + } + } else if (dim.getValue() == 2) { if (rotation == IUP_JUP) { back_shift = -shift; @@ -617,6 +671,8 @@ Transformation::calculateReverseShift( TBOX_ERROR("Transformation::calculateReverseShift error...\n" << " Invalid RotationIdentifier value given" << std::endl); } + } else { + TBOX_ERROR("Transformation::calculateReverseShift : DIM > 3 with rotation not implemented"); } } @@ -634,10 +690,16 @@ Transformation::rotateIndex( const tbox::Dimension& dim, const RotationIdentifier rotation) { - if (dim.getValue() == 2) { - int num_rotations = (int)rotation; + if (dim.getValue() == 1) { + if (rotation == IUP) { + return; + } else if (rotation == IDOWN) { + index[0] = -index[0] - 1; + } + } else if (dim.getValue() == 2) { + int num_rotations = static_cast(rotation); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { int tmp_in[2]; tmp_in[0] = index[0]; tmp_in[1] = index[1]; @@ -711,7 +773,7 @@ Transformation::rotateIndex( rotateAboutAxis(dim, index, 0, 1); } } else { - TBOX_ERROR("Transformation::rotateIndex : DIM = 1 or > 3 not implemented"); + TBOX_ERROR("Transformation::rotateIndex : DIM > 3 not implemented"); } } @@ -737,7 +799,7 @@ Transformation::rotateAboutAxis( const int a = (axis + 1) % dim.getValue(); const int b = (axis + 2) % dim.getValue(); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { int tmp_in[3] = { index[0], index[1], index[2] }; index[a] = tmp_in[b]; index[b] = -tmp_in[a] - 1; @@ -747,5 +809,3 @@ Transformation::rotateAboutAxis( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.h index 2335291c..eaa85057 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Transformation.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class for managing tanssformations between index spaces in * an AMR hierarchy. * @@ -17,10 +17,10 @@ #include "SAMRAI/hier/BlockId.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Index.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Dimension.h" #include +#include namespace SAMRAI { namespace hier { @@ -63,6 +63,8 @@ class Transformation */ enum RotationIdentifier { NO_ROTATE = 0, + IUP = 0, + IDOWN = 1, IUP_JUP = 0, JUP_IDOWN = 1, IDOWN_JDOWN = 2, @@ -162,6 +164,9 @@ class Transformation * @brief Transform the Box in the way defined by this object * * @param[in,out] box The Box will be transformed + * + * @pre (box.getBlockId() == getBeginBlock()) || + * (getBeginBlock() == BlockId::invalidId()) */ void transform( @@ -174,11 +179,21 @@ class Transformation * a Box, the Box will end up in its original state. * * @param[in,out] box + * + * @pre (box.getBlockId() == getBeginBlock()) || + * (getBeginBlock() == BlockId::invalidId()) */ void inverseTransform( Box& box) const; + /*! + * @brief Get a Tranformation object that defines the inverse of this + * tranformation. + */ + Transformation + getInverseTransformation() const; + /*! * @brief Assignment operator */ @@ -193,6 +208,22 @@ class Transformation return *this; } + /*! + * @brief Get the BlockId for the Box before transformation. + */ + const BlockId& getBeginBlock() const + { + return d_begin_block; + } + + /*! + * @brief Get the BlockId for the Box after transformation. + */ + const BlockId& getEndBlock() const + { + return d_end_block; + } + /*! * @brief Map a string-based identifier of a rotation operation to a * RotationIdentifier value. @@ -204,19 +235,21 @@ class Transformation * See the comments for the RotationIdentifier definition for the * explanation of the meaning of the RotationIdentifier values. * - * An assertion failure will occur if the array length is not equal to - * the dimension of the hierarchy. A run-time error will occur if the - * strings do not match the format needed to create a valid - * Transformation::RotationIdentifier value. + * A run-time error will occur if the strings do not match the format + * needed to create a valid Transformation::RotationIdentifier value. * * @return RotationIdentifier determined by the strings. * * @param[in] rotation_string * @param[in] dim + * + * @pre rotation_string.size() == dim.getValue() + * @pre (dim.getValue() == 1) || (dim.getValue() == 2) || + * (dim.getValue() == 3) */ static RotationIdentifier getRotationIdentifier( - const tbox::Array& rotation_string, + const std::vector& rotation_string, const tbox::Dimension& dim); /*! @@ -231,6 +264,9 @@ class Transformation * * @param[in] rotation Rotation for which the reverse rotation is sought * @param[in] dim Dimension being used + * + * @pre (dim.getValue() == 1) || (dim.getValue() == 2) || + * (dim.getValue() == 3) */ static RotationIdentifier getReverseRotationIdentifier( @@ -248,6 +284,10 @@ class Transformation * @param[out] back_shift * @param[in] shift * @param[in] rotation + * + * @pre back_shift.getDim() == shift.getDim() + * @pre (dim.getValue() == 1) || (dim.getValue() == 2) || + * (dim.getValue() == 3) */ static void calculateReverseShift( @@ -256,18 +296,21 @@ class Transformation const RotationIdentifier rotation); /*! - * @brief rotate an index from one index space to another + * @brief rotate a cell centered index from one index space to another * * The parameter index is an int pointer with points to an array of - * int data, length DIM. It signifies an ijk location in an index - * space. According to the rotation number, the location will be + * int data, length DIM. It signifies an ijk location in a cell centered + * index space. According to the rotation number, the location will be * rotated around the origin, with the new values overwriting the original * values in the array pointed to by index. * - * @param index array identifying a point in index space + * @param index array identifying a cell centered point in index space * @param dim Dimension of the index and the hierarchy where it is located * @param rotation identifier of the rotation that will be applied * to index + * + * @pre (dim.getValue() == 1) || (dim.getValue() == 2) || + * (dim.getValue() == 3) */ static void rotateIndex( @@ -276,13 +319,13 @@ class Transformation const RotationIdentifier rotation); /*! - * @brief rotate an index from one index space to another + * @brief rotate a cell centered index from one index space to another * - * According to the rotation number, the location of the given Index will - * be rotated around the origin, overwriting the original value of the - * Index. + * According to the rotation number, the location of the given cell centered + * Index will be rotated around the origin, overwriting the original value + * of the Index. * - * @param index a point in index space + * @param index a cell centered point in index space * @param rotation identifier of the rotation that will be applied * to index */ @@ -296,15 +339,18 @@ class Transformation private: /*! - * @brief private routine to rotate an index around an axis + * @brief private routine to rotate a cell centered index around an axis * - * In 3D, rotation of an index about the origin is decomposed into a - * series of rotations about an axis. This function performs one such - * rotation. + * In 3D, rotation of a cell centered index about the origin is decomposed + * into a series of rotations about an axis. This function performs one + * such rotation. * - * @param index array identifying a point in index space + * @param dim space associated rotation performed in + * @param index array identifying a cell centered point in index space * @param axis axis around which index will be rotated * @param num_rotations number of 90-degree rotations around the axis + * + * @pre (dim.getValue() != 3) || (axis < dim.getValue()) */ static void rotateAboutAxis( @@ -313,9 +359,8 @@ class Transformation const int axis, const int num_rotations); - /*! - * @brief For now there is no need to construct/destroy this class as it - * only holds static functions. + /* + * Unimplemented default constructor. */ Transformation(); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.C new file mode 100644 index 00000000..cde7a9ad --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.C @@ -0,0 +1,403 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: A container of boxes with basic domain calculus operations + * + ************************************************************************/ +#include "SAMRAI/hier/UncoveredBoxIterator.h" +#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/FlattenedHierarchy.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" + +namespace SAMRAI { +namespace hier { + +UncoveredBoxIterator::UncoveredBoxIterator( + const PatchHierarchy* hierarchy, + bool begin): + d_hierarchy(hierarchy), + d_uncovered_boxes_itr(BoxContainer().begin()), + d_uncovered_boxes_itr_end(BoxContainer().end()), + d_item(0) +{ + TBOX_ASSERT(hierarchy); + + d_finest_level_num = d_hierarchy->getFinestLevelNumber(); + if (begin) { + d_level_num = -1; + d_flattened_hierarchy = new FlattenedHierarchy(*d_hierarchy, 0, d_finest_level_num); + d_allocated_flattened_hierarchy = true; + findFirstUncoveredBox(); + } else { + d_level_num = d_finest_level_num + 1; + d_flattened_hierarchy = 0; + d_allocated_flattened_hierarchy = false; + } +} + + +UncoveredBoxIterator::UncoveredBoxIterator( + const FlattenedHierarchy* flattened_hierarchy, + bool begin): + d_hierarchy(&(flattened_hierarchy->getPatchHierarchy())), + d_uncovered_boxes_itr(BoxContainer().begin()), + d_uncovered_boxes_itr_end(BoxContainer().end()), + d_item(0) +{ + TBOX_ASSERT(flattened_hierarchy); + + d_finest_level_num = d_hierarchy->getFinestLevelNumber(); + if (begin) { + d_level_num = -1; + d_flattened_hierarchy = flattened_hierarchy; + d_allocated_flattened_hierarchy = false; + findFirstUncoveredBox(); + } else { + d_level_num = d_finest_level_num + 1; + d_flattened_hierarchy = 0; + d_allocated_flattened_hierarchy = false; + } +} + +UncoveredBoxIterator::UncoveredBoxIterator( + const UncoveredBoxIterator& other): + d_hierarchy(other.d_hierarchy), + d_flattened_hierarchy(0), + d_allocated_flattened_hierarchy(false), + d_level_num(other.d_level_num), + d_current_patch_id(other.d_current_patch_id), + d_uncovered_boxes_itr(other.d_uncovered_boxes_itr), + d_uncovered_boxes_itr_end(other.d_uncovered_boxes_itr_end), + d_item(0), + d_finest_level_num(other.d_finest_level_num) +{ + if (other.d_item) { + d_item = new std::pair, Box>(*other.d_item); + } + if (other.d_flattened_hierarchy) { + d_flattened_hierarchy = + new FlattenedHierarchy(*other.d_flattened_hierarchy); + d_allocated_flattened_hierarchy = true; + if (d_level_num <= d_finest_level_num) { + TBOX_ASSERT(d_item); + const Box& patch_box = d_item->first->getBox(); + const BoxContainer& visible_boxes = + d_flattened_hierarchy->getVisibleBoxes(patch_box, d_level_num); + + BoxContainer::const_iterator itr = visible_boxes.begin(); + for( ; itr != visible_boxes.end(); ++itr) { + + if (itr->getBoxId() == d_item->second.getBoxId() && + itr->isSpatiallyEqual(d_item->second)) { + + d_uncovered_boxes_itr = itr; + d_uncovered_boxes_itr_end = visible_boxes.end(); + break; + } + } + + if (itr == visible_boxes.end()) { + d_uncovered_boxes_itr = itr; + d_uncovered_boxes_itr_end = itr; + } + } + } +} + +UncoveredBoxIterator::~UncoveredBoxIterator() +{ + if (d_item) { + delete d_item; + } + if (d_flattened_hierarchy && d_allocated_flattened_hierarchy) { + delete d_flattened_hierarchy; + } +} + +UncoveredBoxIterator& +UncoveredBoxIterator::operator = ( + const UncoveredBoxIterator& rhs) +{ + if (this != &rhs) { + d_hierarchy = rhs.d_hierarchy; + d_level_num = rhs.d_level_num; + d_uncovered_boxes_itr = rhs.d_uncovered_boxes_itr; + d_uncovered_boxes_itr_end = rhs.d_uncovered_boxes_itr_end; + d_current_patch_id = rhs.d_current_patch_id; + if (d_item) { + delete d_item; + } + if (rhs.d_item) { + d_item = new std::pair, Box>(*rhs.d_item); + d_item->first = rhs.d_item->first; + d_item->second = rhs.d_item->second; + } else { + d_item = 0; + } + d_finest_level_num = rhs.d_finest_level_num; + if (d_flattened_hierarchy && d_allocated_flattened_hierarchy) { + delete d_flattened_hierarchy; + } + d_flattened_hierarchy = 0; + d_allocated_flattened_hierarchy = false; + if (rhs.d_flattened_hierarchy) { + d_flattened_hierarchy = + new FlattenedHierarchy(*rhs.d_flattened_hierarchy); + d_allocated_flattened_hierarchy = true; + if (d_level_num <= d_finest_level_num) { + TBOX_ASSERT(d_item); + const Box& patch_box = d_item->first->getBox(); + const BoxContainer& visible_boxes = + d_flattened_hierarchy->getVisibleBoxes(patch_box, d_level_num); + + BoxContainer::const_iterator itr = visible_boxes.begin(); + for( ; itr != visible_boxes.end(); ++itr) { + + if (itr->getBoxId() == d_item->second.getBoxId() && + itr->isSpatiallyEqual(d_item->second)) { + + d_uncovered_boxes_itr = itr; + d_uncovered_boxes_itr_end = visible_boxes.end(); + break; + } + } + + if (itr == visible_boxes.end()) { + d_uncovered_boxes_itr = itr; + d_uncovered_boxes_itr_end = itr; + } + } + } + } + + return *this; +} + +const std::pair, Box>& +UncoveredBoxIterator::operator * () const +{ + return *d_item; +} + +const std::pair, Box> * +UncoveredBoxIterator::operator -> () const +{ + return d_item; +} + +bool +UncoveredBoxIterator::operator == ( + const UncoveredBoxIterator& rhs) const +{ + // Frist check and see if the iterators are working on the same hierarchies + // and levels. If not then they are not equal. + bool result = d_hierarchy == rhs.d_hierarchy && + d_level_num == rhs.d_level_num; + + if (d_flattened_hierarchy == 0 && rhs.d_flattened_hierarchy != 0) { + result = false; + } + if (d_flattened_hierarchy != 0 && rhs.d_flattened_hierarchy == 0) { + result = false; + } + if (d_item == 0 && rhs.d_item != 0) { + result = false; + } + if (d_item != 0 && rhs.d_item == 0) { + result = false; + } + if (result) { + if (d_item == 0 && rhs.d_item == 0) { + result = true; + } + if (d_item && rhs.d_item) { + if (d_item->second.isIdEqual(rhs.d_item->second) && + d_item->second.isSpatiallyEqual(rhs.d_item->second) && + d_item->first->getBox().isIdEqual(rhs.d_item->first->getBox()) && + d_item->first->getBox().isSpatiallyEqual(rhs.d_item->first->getBox())) { + result = true; + } else { + result = false; + } + } + } + + return result; +} + +bool +UncoveredBoxIterator::operator != ( + const UncoveredBoxIterator& rhs) const +{ + return !(*this == rhs); +} + +UncoveredBoxIterator& +UncoveredBoxIterator::operator ++ () +{ + incrementIterator(); + return *this; +} + +UncoveredBoxIterator +UncoveredBoxIterator::operator ++ ( + int) +{ + // Save the state of the iterator. + UncoveredBoxIterator tmp(*this); + + incrementIterator(); + + // Return iterator in original state. + return tmp; +} + +void +UncoveredBoxIterator::incrementIterator() +{ + /* + * Increment the iterator over the uncovered boxes for the current patch. + * If we reach the end of the uncovered boxes for the current patch, + * look for the next patch with uncovered boxes, moving to finer levels if + * necessary + */ + ++d_uncovered_boxes_itr; + if (d_uncovered_boxes_itr != d_uncovered_boxes_itr_end) { + d_current_patch_id = d_item->first->getBox().getBoxId(); + setIteratorItem(); + } else { + + bool id_found = false; + + bool new_level = false; + while (d_level_num <= d_finest_level_num) { + + boost::shared_ptr this_level = + d_hierarchy->getPatchLevel(d_level_num); + + const BoxContainer& this_level_boxes = + this_level->getBoxLevel()->getBoxes(); + + for (RealBoxConstIterator this_itr = this_level_boxes.realBegin(); + this_itr != this_level_boxes.realEnd(); ++this_itr) { + + if (!new_level && + this_itr->getBoxId() <= d_item->first->getBox().getBoxId()) { + continue; + } + const BoxContainer& uncovered_boxes = + d_flattened_hierarchy->getVisibleBoxes(*this_itr, d_level_num); + + if (!uncovered_boxes.empty()) { + d_uncovered_boxes_itr = uncovered_boxes.begin(); + d_uncovered_boxes_itr_end = uncovered_boxes.end(); + d_current_patch_id = this_itr->getBoxId(); + id_found = true; + break; + } + } + if (id_found) { + break; + } else { + ++d_level_num; + new_level = true; + } + } + + if (id_found) { + setIteratorItem(); + } else { + if (d_flattened_hierarchy && d_allocated_flattened_hierarchy) { + delete d_flattened_hierarchy; + } + d_flattened_hierarchy = 0; + if (d_item) { + delete d_item; + d_item = 0; + } + } + } +} + +void +UncoveredBoxIterator::findFirstUncoveredBox() +{ + ++d_level_num; + boost::shared_ptr this_level = + d_hierarchy->getPatchLevel(d_level_num); + + bool id_found = false; + + while (d_level_num <= d_finest_level_num) { + + boost::shared_ptr this_level = + d_hierarchy->getPatchLevel(d_level_num); + + const BoxContainer& this_level_boxes = + this_level->getBoxLevel()->getBoxes(); + + for (RealBoxConstIterator this_itr = this_level_boxes.realBegin(); + this_itr != this_level_boxes.realEnd(); ++this_itr) { + const BoxContainer& uncovered_boxes = + d_flattened_hierarchy->getVisibleBoxes(*this_itr, d_level_num); + + if (!uncovered_boxes.empty()) { + d_uncovered_boxes_itr = uncovered_boxes.begin(); + d_uncovered_boxes_itr_end = uncovered_boxes.end(); + d_current_patch_id = this_itr->getBoxId(); + id_found = true; + break; + } + } + if (id_found) { + break; + } else { + ++d_level_num; + } + } + + if (id_found) { + setIteratorItem(); + } else { + if (d_item) { + delete d_item; + d_item = 0; + } + if (d_flattened_hierarchy && d_allocated_flattened_hierarchy) { + delete d_flattened_hierarchy; + } + d_flattened_hierarchy = 0; + if (d_item) { + delete d_item; + d_item = 0; + } + } +} + +void +UncoveredBoxIterator::setIteratorItem() +{ + // Get the current uncovered box. + const Box& cur_box = *d_uncovered_boxes_itr; + boost::shared_ptr this_level = + d_hierarchy->getPatchLevel(d_level_num); + + // Update item with the current originating patch and the current box. + if (d_item) { + d_item->first = + this_level->getPatch(d_current_patch_id); + d_item->second = cur_box; + } else { + d_item = + new std::pair, Box>( + this_level->getPatch(d_current_patch_id), + cur_box); + } +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.h new file mode 100644 index 00000000..f69f08ed --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/UncoveredBoxIterator.h @@ -0,0 +1,181 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: A container of boxes with basic domain calculus operations + * + ************************************************************************/ + +#ifndef included_hier_UncoveredBoxIterator +#define included_hier_UncoveredBoxIterator + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/BoxContainer.h" + +#include "boost/shared_ptr.hpp" +#include +#include + +namespace SAMRAI { +namespace hier { + +class Patch; +class PatchHierarchy; +class FlattenedHierarchy; + +/*! + * @brief An iterator over the uncovered Boxes in a hierarhcy. + * + * This iterator points to a pair consisting of the current uncovered Box and + * the Patch with which it is associated. Note that in the case of overlapping + * Patches in which the overlap is uncovered, the overlapping region will + * appear multiple times in the iteration. The number of appearances is equal + * to the number of Patches that overlap that region. + */ +class UncoveredBoxIterator +{ + friend class PatchHierarchy; + friend class FlattenedHierarchy; + +public: + /*! + * @brief Copy constructor. + * + * @param[in] other The iterator being copied. + */ + UncoveredBoxIterator( + const UncoveredBoxIterator& other); + + /*! + * Destructor. + */ + ~UncoveredBoxIterator(); + + /*! + * @brief Assignment operator. + * + * @param[in] rhs The right hand side of the assignment. + */ + UncoveredBoxIterator& + operator = ( + const UncoveredBoxIterator& rhs); + + /*! + * @brief Dereference operator mimicking a pointer dereference. + */ + const std::pair, Box>& + operator * () const; + + /*! + * @brief Dereference operator mimicking a pointer dereference. + */ + const std::pair, Box> * + operator -> () const; + + /*! + * @brief Equality comparison. + * + * @param[in] rhs The right hand side of the comparison. + */ + bool + operator == ( + const UncoveredBoxIterator& rhs) const; + + /*! + * @brief Inequality comparison. + * + * @param[in] rhs The right hand side of the comparison. + */ + bool + operator != ( + const UncoveredBoxIterator& rhs) const; + + /*! + * @brief Pre-increment iterator. + * + * Pre-increment increment the iterator and returns the incremented + * state. + */ + UncoveredBoxIterator& + operator ++ (); + + /*! + * @brief Post-increment iterator. + * + * Post-increment saves the iterator, increments it and returns the + * saved iterator. + */ + UncoveredBoxIterator + operator ++ ( + int); + +private: + /*! + * @brief Unimplemented default constructor. + */ + UncoveredBoxIterator(); + + /*! + * @brief Constructor. + * + * @param[in] hierarchy The hierarchy over which the iteration will occur. + * @param[in] begin If true the iteration starts from the beginning. + */ + UncoveredBoxIterator( + const PatchHierarchy* hierarchy, + bool begin); + + UncoveredBoxIterator( + const FlattenedHierarchy* hierarchy, + bool begin); + + /*! + * @brief Private method to do work common to both pre and post increments. + */ + void + incrementIterator(); + + /*! + * @brief Private method to find first uncovered box + */ + void + findFirstUncoveredBox(); + + /*! + * @brief Set the item based on the current patch id and uncovered box. + */ + void + setIteratorItem(); + + /* The PatchHierarchy on which this iterator operates. */ + const PatchHierarchy* d_hierarchy; + const FlattenedHierarchy* d_flattened_hierarchy; + + bool d_allocated_flattened_hierarchy; + + /* The current level in the PatchHierarchy. */ + int d_level_num; + + /* The id of the current patch */ + BoxId d_current_patch_id; + + /* The iterator over the uncovered boxes for the current patch. */ + BoxContainer::const_iterator d_uncovered_boxes_itr; + + /* The iterator at the end of the uncovered boxes for the current patch. */ + BoxContainer::const_iterator d_uncovered_boxes_itr_end; + + /* The current item in the iteration. */ + std::pair, Box>* d_item; + + /* The number of the finest level in the hierarchy. */ + int d_finest_level_num; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.C index 67fb2857..7bab3296 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for application-level variables * ************************************************************************/ - -#ifndef included_hier_Variable_C -#define included_hier_Variable_C - #include "SAMRAI/hier/Variable.h" namespace SAMRAI { @@ -45,4 +41,3 @@ Variable::~Variable() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.h index 20e087d3..d9847453 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/Variable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for application-level variables * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -62,7 +62,7 @@ namespace hier { * by the fineBoundaryRepresentsVariable() function. Each concrete variable subclass * defines the behavior of this function. * - * @see hier::PatchDataFactory + * @see PatchDataFactory */ class Variable @@ -133,12 +133,14 @@ class Variable * Set the patch data factory object. Normally, the factory is set in * the constructor, but this member function enables the factory to be * changed later in the lifetime of the variable. + * + * @pre getDim() == factory->getDim() */ void setPatchDataFactory( const boost::shared_ptr& factory) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *factory); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *factory); d_factory = factory; } @@ -165,7 +167,7 @@ class Variable private: Variable( const Variable&); // not implemented - void + Variable& operator = ( const Variable&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.C index bad2904d..57f31d50 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple integer id and namestring variable context * ************************************************************************/ - -#ifndef included_hier_VariableContext_C -#define included_hier_VariableContext_C - #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/tbox/Utilities.h" @@ -46,5 +42,3 @@ VariableContext::~VariableContext() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.h index 6405332e..74f7b0cc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableContext.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple integer id and namestring variable context * ************************************************************************/ @@ -46,7 +46,7 @@ namespace hier { * * \endverbatim * - * @see hier::VariableDatabase + * @see VariableDatabase */ class VariableContext @@ -68,8 +68,7 @@ class VariableContext * The variable context constructor creates a context with the given * name and increments the context index counter. * - * When assertion checking is active, an unrecoverable assertion results - * when the name std::string is empty. + * @pre !name.empty() */ explicit VariableContext( const std::string& name); @@ -112,7 +111,7 @@ class VariableContext private: VariableContext( const VariableContext&); // not implemented - void + VariableContext& operator = ( const VariableContext&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.C b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.C index 9271e8b5..f9ed2c33 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.C @@ -3,31 +3,26 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for variables used in a SAMRAI application. * ************************************************************************/ - -#ifndef included_hier_VariableDatabase_C -#define included_hier_VariableDatabase_C - #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/StartupShutdownManager.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace hier { -VariableDatabase * -VariableDatabase::s_variable_database_instance = NULL; +VariableDatabase * VariableDatabase::s_variable_database_instance(0); -int VariableDatabase::s_context_array_alloc_size = 10; -int VariableDatabase::s_variable_array_alloc_size = 100; -int VariableDatabase::s_descriptor_array_alloc_size = 200; +const int VariableDatabase::s_context_array_alloc_size(10); +const int VariableDatabase::s_variable_array_alloc_size(100); +const int VariableDatabase::s_descriptor_array_alloc_size(200); tbox::StartupShutdownManager::Handler VariableDatabase::s_shutdown_handler( @@ -45,7 +40,7 @@ VariableDatabase::s_shutdown_handler( ************************************************************************* */ -VariableDatabase* +VariableDatabase * VariableDatabase::getDatabase() { if (!s_variable_database_instance) { @@ -60,7 +55,7 @@ VariableDatabase::shutdownCallback() if (s_variable_database_instance) { delete s_variable_database_instance; } - s_variable_database_instance = ((VariableDatabase *)NULL); + s_variable_database_instance = 0; } /* @@ -72,7 +67,7 @@ VariableDatabase::shutdownCallback() ************************************************************************* */ -VariableDatabase::VariableDatabase() : +VariableDatabase::VariableDatabase(): d_patch_descriptor(boost::make_shared()) { d_max_variable_id = idUndefined(); @@ -129,41 +124,6 @@ VariableDatabase::getNumberOfRegisteredVariableContexts() const return d_max_context_id + 1; } -/* - ************************************************************************* - * - * Accessory functions to manage patch data ids for restart. - * - ************************************************************************* - */ - -ComponentSelector -VariableDatabase::getPatchDataRestartTable() const -{ - return d_patchdata_restart_table; -} - -bool -VariableDatabase::isPatchDataRegisteredForRestart( - int index) const -{ - return d_patchdata_restart_table.isSet(index); -} - -void -VariableDatabase::registerPatchDataForRestart( - int index) -{ - d_patchdata_restart_table.setFlag(index); -} - -void -VariableDatabase::unregisterPatchDataForRestart( - int index) -{ - d_patchdata_restart_table.clrFlag(index); -} - /* ************************************************************************* * @@ -426,10 +386,10 @@ VariableDatabase::removePatchDataIndex( if (variable) { - tbox::Array& indx_array = + std::vector& indx_array = d_variable_context2index_map[variable->getInstanceIdentifier()]; - int array_size = indx_array.getSize(); - for (int i = 0; i < array_size; i++) { + int array_size = static_cast(indx_array.size()); + for (int i = 0; i < array_size; ++i) { if (indx_array[i] == data_id) { indx_array[i] = idUndefined(); break; @@ -439,14 +399,14 @@ VariableDatabase::removePatchDataIndex( d_patch_descriptor->removePatchDataComponent(data_id); if (d_index2variable_map[data_id]) { - d_num_registered_patch_data_ids--; + --d_num_registered_patch_data_ids; } d_index2variable_map[data_id].reset(); if (data_id == d_max_descriptor_id) { - for (int id = d_max_descriptor_id; id >= 0; id--) { + for (int id = d_max_descriptor_id; id >= 0; --id) { if (!d_index2variable_map[id]) { - d_max_descriptor_id--; + --d_max_descriptor_id; } else { break; } @@ -580,7 +540,7 @@ VariableDatabase::mapVariableAndContextToIndex( int ctxt_id = context->getIndex(); if ((var_id <= d_max_variable_id) && - (ctxt_id < d_variable_context2index_map[var_id].getSize())) { + (ctxt_id < static_cast(d_variable_context2index_map[var_id].size()))) { index = d_variable_context2index_map[var_id][ctxt_id]; @@ -611,7 +571,7 @@ VariableDatabase::mapIndexToVariable( variable = d_index2variable_map[index]; } - return variable; + return variable.get(); } /* @@ -641,10 +601,10 @@ VariableDatabase::mapIndexToVariableAndContext( if (variable) { - const tbox::Array& var_indx_array = + const std::vector& var_indx_array = d_variable_context2index_map[variable->getInstanceIdentifier()]; - int arr_size = var_indx_array.getSize(); - for (int i = 0; i < arr_size; i++) { + int arr_size = static_cast(var_indx_array.size()); + for (int i = 0; i < arr_size; ++i) { if (var_indx_array[i] == index) { found = true; context = d_contexts[i]; @@ -682,7 +642,7 @@ VariableDatabase::printClassData( os << "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; os << "Variable Contexts registered with database:"; - for (i = 0; i <= d_max_context_id; i++) { + for (i = 0; i <= d_max_context_id; ++i) { os << "\nContext id = " << i; if (d_contexts[i]) { os << " : Context name = " << d_contexts[i]->getName(); @@ -693,7 +653,7 @@ VariableDatabase::printClassData( os << "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl << std::flush; os << "Variables registered with database:"; - for (i = 0; i <= d_max_variable_id; i++) { + for (i = 0; i <= d_max_variable_id; ++i) { os << "\nVariable instance = " << i; if (d_variables[i]) { os << "\n"; @@ -712,15 +672,16 @@ VariableDatabase::printClassData( os << "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl << std::flush; os << "Variable-Context pairs mapping to Patch Data Indices in database:"; - for (i = 0; i <= d_max_variable_id; i++) { + for (i = 0; i <= d_max_variable_id; ++i) { if (d_variables[i]) { if (!print_only_user_defined_variables || (print_only_user_defined_variables && d_is_user_variable[i])) { os << "\nVariable name = " << d_variables[i]->getName(); - int nctxts = d_variable_context2index_map[i].getSize(); + int nctxts = + static_cast(d_variable_context2index_map[i].size()); if (nctxts > 0) { - for (int j = 0; j < nctxts; j++) { + for (int j = 0; j < nctxts; ++j) { if (d_variable_context2index_map[i][j] != idUndefined()) { os << "\n context id = " << j << ", name = " << d_contexts[j]->getName() @@ -740,7 +701,7 @@ VariableDatabase::printClassData( os << "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl << std::flush; os << "Mapping from Patch Data Indices to Variables:"; - for (i = 0; i <= d_max_descriptor_id; i++) { + for (i = 0; i <= d_max_descriptor_id; ++i) { os << "\nPatch data id = " << i << " -- "; if (!d_index2variable_map[i]) { os << "UNDEFINED in database"; @@ -859,7 +820,7 @@ VariableDatabase::getVariableId( int ret_id = idUndefined(); if (!name.empty()) { - for (int i = 0; i <= d_max_variable_id; i++) { + for (int i = 0; i <= d_max_variable_id; ++i) { if (d_variables[i] && (d_variables[i]->getName() == name)) { ret_id = i; @@ -887,7 +848,7 @@ VariableDatabase::getContextId_Private( int ret_id = idUndefined(); if (!name.empty()) { - for (int i = 0; i <= d_max_context_id; i++) { + for (int i = 0; i <= d_max_context_id; ++i) { if (d_contexts[i] && (d_contexts[i]->getName() == name)) { ret_id = i; @@ -904,13 +865,13 @@ VariableDatabase::addContext_Private( const boost::shared_ptr& context) { int new_id = context->getIndex(); - int oldsize = d_contexts.getSize(); + int oldsize = static_cast(d_contexts.size()); int newsize = new_id + 1; if (oldsize < newsize) { newsize = tbox::MathUtilities::Max(oldsize + s_context_array_alloc_size, newsize); - d_contexts.resizeArray(newsize); + d_contexts.resize(newsize); } d_contexts[new_id] = context; d_max_context_id = tbox::MathUtilities::Max(d_max_context_id, new_id); @@ -941,16 +902,16 @@ VariableDatabase::addVariablePatchDataIndexPairToDatabase_Private( << std::endl); } - int oldsize = d_index2variable_map.getSize(); + int oldsize = static_cast(d_index2variable_map.size()); if (data_id >= oldsize) { - d_index2variable_map.resizeArray( + d_index2variable_map.resize( tbox::MathUtilities::Max(oldsize + s_descriptor_array_alloc_size, data_id + 1)); } if (!d_index2variable_map[data_id] && variable) { - d_num_registered_patch_data_ids++; + ++d_num_registered_patch_data_ids; } d_index2variable_map[data_id] = variable; @@ -982,8 +943,9 @@ VariableDatabase::removeVariable( if (var_id != idUndefined()) { d_is_user_variable[var_id] = false; - tbox::Array index_array = d_variable_context2index_map[var_id]; - for (int context_id = 0; context_id < index_array.size(); ++context_id) { + std::vector& index_array = d_variable_context2index_map[var_id]; + for (int context_id = 0; + context_id < static_cast(index_array.size()); ++context_id) { if (index_array[context_id] != idUndefined()) { int desc_id = index_array[context_id]; removePatchDataIndex(desc_id); @@ -1021,8 +983,8 @@ VariableDatabase::addVariable_Private( bool var_found = false; bool grow_array = false; - if (var_id < d_variables.getSize()) { - var_found = d_variables[var_id]; + if (var_id < static_cast(d_variables.size())) { + var_found = d_variables[var_id].get(); } else { grow_array = true; } @@ -1037,15 +999,15 @@ VariableDatabase::addVariable_Private( if (grow_array) { const int newsize = - tbox::MathUtilities::Max(d_variables.getSize() + tbox::MathUtilities::Max(static_cast(d_variables.size()) + s_variable_array_alloc_size, var_id + 1); - d_variables.resizeArray(newsize); - d_variable_context2index_map.resizeArray(newsize); + d_variables.resize(newsize); + d_variable_context2index_map.resize(newsize); - const int oldsize = d_is_user_variable.getSize(); - d_is_user_variable.resizeArray(newsize); - for (int i = oldsize; i < newsize; i++) { + const int oldsize = static_cast(d_is_user_variable.size()); + d_is_user_variable.resize(newsize); + for (int i = oldsize; i < newsize; ++i) { d_is_user_variable[i] = false; } } @@ -1118,12 +1080,12 @@ VariableDatabase::registerVariableAndContext_Private( // Check for valid variable_id, and get the // associated context to index map if valid. if (variable_id <= d_max_variable_id) { - tbox::Array& test_indx_array = + std::vector& test_indx_array = d_variable_context2index_map[variable_id]; // Check for valid context id and get the patch // descriptor id if valid. - if (context_id < test_indx_array.getSize()) { + if (context_id < static_cast(test_indx_array.size())) { desc_id = test_indx_array[context_id]; // Check the descriptor id. If valid, get the associated @@ -1151,7 +1113,7 @@ VariableDatabase::registerVariableAndContext_Private( } } } // if (desc_id != idUndefined()) - } // if (context_id < test_indx_array.getSize()) + } // if (context_id < test_indx_array.size()) } // if (variable_id <= d_max_variable_id) // Create the new factory if necessary @@ -1171,13 +1133,13 @@ VariableDatabase::registerVariableAndContext_Private( desc_id, user_variable); - tbox::Array& var_indx_array = + std::vector& var_indx_array = d_variable_context2index_map[variable_id]; - int oldsize = var_indx_array.getSize(); + int oldsize = static_cast(var_indx_array.size()); int newsize = context_id + 1; if (oldsize < newsize) { - var_indx_array.resizeArray(newsize); - for (int i = oldsize; i < newsize; i++) { + var_indx_array.resize(newsize); + for (int i = oldsize; i < newsize; ++i) { var_indx_array[i] = idUndefined(); } } @@ -1191,4 +1153,3 @@ VariableDatabase::registerVariableAndContext_Private( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.h index 262d647b..a80249c9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/VariableDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton database class for managing variables and contexts. * ************************************************************************/ @@ -18,11 +18,11 @@ #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" #include #include +#include namespace SAMRAI { namespace hier { @@ -166,10 +166,10 @@ namespace hier { *
    * * - * @see hier::PatchDescriptor - * @see hier::VariableContext - * @see hier::Variable - * @see hier::Patch + * @see PatchDescriptor + * @see VariableContext + * @see Variable + * @see Patch */ class VariableDatabase @@ -247,9 +247,9 @@ class VariableDatabase * error will be logged and the program will abort. This prevents * multiple Variables being associated with the same name. * - * @param[in] variable boost::shared_ptr to variable. When assertion - * checking is active, an assertion will result if the - * variable pointer is null. + * @param[in] variable boost::shared_ptr to variable + * + * @pre variable */ virtual void addVariable( @@ -304,8 +304,7 @@ class VariableDatabase * * @param[in] variable boost::shared_ptr to @c Variable. If the variable * is unknown to the database, then an invalid patch data index - * (< 0) will be returned. When assertion checking is active, - * an assertion will result when the variable pointer is null. + * (< 0) will be returned * @param[in] old_id Integer patch data index currently associated with * variable. If this value is not a valid patch data index * (< 0) or does not map to patch data matching the @@ -314,6 +313,9 @@ class VariableDatabase * * @return New integer patch data index. If new patch data not added, * return value is an invalid (undefined) patch data index (< 0). + * + * @pre variable + * @pre checkVariablePatchDataIndex(variable, old_id) */ virtual int registerClonedPatchDataIndex( @@ -346,9 +348,7 @@ class VariableDatabase * routine registerInternalSAMRAIVariable() must be used for that * case. *
- * @param[in] variable boost::shared_ptr to Variable. When assertion - * checking is active, an assertion will result when - * the variable pointer is null. + * @param[in] variable boost::shared_ptr to Variable * @param[in] data_id Optional integer patch data index to be added * (along with variable) to the database. If the value * is unspecified (default case), the default variable @@ -359,6 +359,9 @@ class VariableDatabase * * @return New integer patch data index. If new patch data index not * added, return value is an invalid patch data index (< 0). + * + * @pre variable + * @pre data_id == idUndefined() || checkVariablePatchDataIndex(variable, data_id) */ virtual int registerPatchDataIndex( @@ -378,9 +381,7 @@ class VariableDatabase * with the integer index. * * @param[in] data_id Integer patch data index to be removed from - * the database. When assertion checking is active, - * an assertion will result when the patch data index - * is invalid (i.e., < 0). + * the database */ virtual void removePatchDataIndex( @@ -390,16 +391,15 @@ class VariableDatabase * @brief Check whether the given variable is mapped to the given patch data * index in the database. * - * @param[in] variable boost::shared_ptr to variable. When assertion checking - * is active, an unrecoverable assertion will result if - * the variable pointer is null. - * @param[in] data_id Integer patch data index. When assertion checking - * is active, an unrecoverable assertion will result if - * the value is an invalid identifier (either < 0 or - * larger than the maximum allowed patch data id). + * @param[in] variable boost::shared_ptr to variable + * @param[in] data_id Integer patch data index * * @return Boolean true if the variable is mapped the given patch * data index; false otherwise. + * + * @pre variable + * @pre (data_id >= 0) && + * (data_id < getPatchDescriptor()->getMaxNumberRegisteredComponents()) */ virtual bool checkVariablePatchDataIndex( @@ -410,16 +410,15 @@ class VariableDatabase * @brief Check whether the given variable matches the patch data type * associated with the given patch data index in the database. * - * @param[in] variable boost::shared_ptr to variable. When assertion - * checking is active, an unrecoverable assertion will - * result if the variable pointer is null. - * @param[in] data_id Integer patch data index. When assertion checking - * is active, an unrecoverable assertion will result if - * the value is an invalid identifier (either < 0 or - * larger than the maximum allowed patch data id). + * @param[in] variable boost::shared_ptr to variable + * @param[in] data_id Integer patch data index * * @return Boolean true if the type of the variable matches the type of * the patch data at the given patch data index; false otherwise. + * + * @pre variable + * @pre (data_id >= 0) && + * (data_id < getPatchDescriptor()->getMaxNumberRegisteredComponents()) */ virtual bool checkVariablePatchDataIndexType( @@ -455,20 +454,16 @@ class VariableDatabase * in this case. * * - * @param[in] variable boost::shared_ptr to variable. When assertion - * checking is active, an unrecoverable assertion will - * result if the variable pointer is null. - * @param[in] context boost::shared_ptr to variable context. When - * assertion checking is active, an unrecoverable - * assertion will result if the context pointer is null. + * @param[in] variable boost::shared_ptr to variable + * @param[in] context boost::shared_ptr to variable context * @param[in] ghosts Optional ghost width for patch data associated - * with variable-context pair. If the ghost width - * is given, all entries of the vector must be >= 0. - * When assertion checking is active, an unrecoverable - * assertion will result if the ghost width vector - * contains a negative entry. + * with variable-context pair. * * @return Integer patch data index of variable-context pair in database. + * + * @pre variable + * @pre context + * @pre ghosts.min() >= 0 */ virtual int registerVariableAndContext( @@ -494,17 +489,15 @@ class VariableDatabase * associated with the variable will not be returned. See the other * map...() functions declared in this class. * - * @param[in] variable boost::shared_ptr to variable. When assertion - * checking is active, an unrecoverable assertion will - * result if the variable pointer is null. - * @param[in] context boost::shared_ptr to variable context. When - * assertion checking is active, an unrecoverable - * assertion will result if the variable context pointer - * is null. + * @param[in] variable boost::shared_ptr to variable + * @param[in] context boost::shared_ptr to variable context * * @return Integer patch data index of variable-context pair in database. * If the variable-context pair was not registered with the * database, then an invalid data index (< 0) will be returned. + * + * @pre variable + * @pre context */ virtual int mapVariableAndContextToIndex( @@ -515,10 +508,8 @@ class VariableDatabase * @brief Map patch data index to variable associated with the data, if * possible, and set the variable pointer to the variable in the database. * - * @param[in] index Integer patch data index. When assertion checking - * is active, an unrecoverable assertion will if the index - * is invalid (i.e., < 0). - * @param[out] variable boost::shared_ptr to variable that maps to patch + * @param[in] index Integer patch data index + * @param[out] variable boost::shared_ptr to variable that maps to patch * data index in database. If there is no index in the * database matching the index input value, then the * variable pointer is set to null. @@ -561,50 +552,6 @@ class VariableDatabase boost::shared_ptr& variable, boost::shared_ptr& context) const; - /*! - * @brief Return copy of component selector that holds information about - * which patch data entries are written to restart. - * - * @return Component selector describing patch data items registered - * for restart. That is, the flags set in the component - * selector will correspond to the patch data indices - * that have been registered for restart. - */ - virtual ComponentSelector - getPatchDataRestartTable() const; - - /*! - * @brief Check whether given patch data index is registered with database - * for restart. - * - * @param[in] index Integer patch data index to check. - * - * @return Boolean true if the patch data with the given index - * is registered for restart; otherwise false. - * - */ - virtual bool - isPatchDataRegisteredForRestart( - int index) const; - - /*! - * @brief Register the given patch data index for restart. - * - * @param[in] index Integer patch data index to set. - */ - virtual void - registerPatchDataForRestart( - int index); - - /*! - * @brief Unregister the given patch data index for restart. - * - * @param[in] index Integer patch data index to unset. - */ - virtual void - unregisterPatchDataForRestart( - int index); - /*! * @brief Print variable, context, and patch descriptor information * contained in the database to the specified output stream. @@ -646,16 +593,14 @@ class VariableDatabase * SAMRAI variables. * * - * @param[in] variable boost::shared_ptr to variable. When assertion - * checking is active, an unrecoverable assertion will - * result if the variable pointer is null. + * @param[in] variable boost::shared_ptr to variable * @param[in] ghosts Ghost width for patch data associated with the - * variable. All entries of the vector must be >= 0. - * When assertion checking is active, an unrecoverable - * assertion results if the vector contains a negative - * entry. + * variable * @return Integer patch data index of variable-ghost width pair * in database. + * + * @pre variable + * @pre ghosts.min() >= 0 */ virtual int registerInternalSAMRAIVariable( @@ -737,6 +682,8 @@ class VariableDatabase * @brief Initialize Singleton instance with instance of subclass. This * function is used to make the singleton object unique when inheriting * from this base class. + * + * @pre !s_variable_database_instance */ void registerSingletonSubclassInstance( @@ -811,9 +758,9 @@ class VariableDatabase /* * Static data members used to control allocation of arrays. */ - static int s_context_array_alloc_size; - static int s_variable_array_alloc_size; - static int s_descriptor_array_alloc_size; + static const int s_context_array_alloc_size; + static const int s_variable_array_alloc_size; + static const int s_descriptor_array_alloc_size; /* * Data members that store variable, context, patch data index information. @@ -825,44 +772,36 @@ class VariableDatabase int d_num_registered_patch_data_ids; /* - * Array of VariableContext pointers is indexed as + * Vector of VariableContext pointers is indexed as * d_contexts[ ] */ int d_max_context_id; - tbox::Array > d_contexts; + std::vector > d_contexts; /* - * Array of Variable pointers is indexed as d_variables[ ] + * Vector of Variable pointers is indexed as d_variables[ ] */ int d_max_variable_id; - tbox::Array > d_variables; + std::vector > d_variables; /* - * Array of VariableContext to patch descriptor indices is indexed as + * Vector of VariableContext to patch descriptor indices is indexed as * d_variable_context2index_map[ ] */ - tbox::Array > d_variable_context2index_map; + std::vector > d_variable_context2index_map; /* - * Array of patch descriptor indices to Variables is indexed as + * Vector of patch descriptor indices to Variables is indexed as * d_index2variable_map[ ] */ int d_max_descriptor_id; - tbox::Array > d_index2variable_map; + std::vector > d_index2variable_map; /* - * Array of user variable booleans is indexed as + * Vector of user variable booleans is indexed as * d_is_user_variable[ ] */ - tbox::Array d_is_user_variable; - - /* - * ComponentSelector holds bits that determine which patch data - * items need to be written to the restart database. The - * bit in position j corresponds to the patch data associated with - * the j-th index of the patch descriptor object. - */ - ComponentSelector d_patchdata_restart_table; + std::vector d_is_user_variable; static tbox::StartupShutdownManager::Handler s_shutdown_handler; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual.dox index 45ffb792..52739321 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_boxes.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_boxes.dox index 0687094c..d38d90b9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_boxes.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_boxes.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_dlbg.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_dlbg.dox index c86ed2f7..0e645773 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_dlbg.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_dlbg.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_patches.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_patches.dox index 5c9fc87c..86ff6f57 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_patches.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_patches.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_transfer_interfaces.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_transfer_interfaces.dox index 66154351..90c9ae4e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_transfer_interfaces.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_transfer_interfaces.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_variables.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_variables.dox index 53ad3262..ea01d7d2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_variables.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/hier/dox/manual_variables.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mainpage.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mainpage.dox index 33638ee7..55d91e0b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mainpage.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mainpage.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ @@ -23,7 +23,7 @@ to samrai@llnl.gov. The SAMRAI framework source code is partitioned into a number of software - ``packages". Each package contains a collection of classes that are + "packages". Each package contains a collection of classes that are logically-related with respect to the role they play in structured AMR applications. Organizing the SAMRAI library in this fashion aids in understanding the overall software design and helps to maintain the integrity diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.C index b2b25296..e219c2f8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated opertions for array data. * ************************************************************************/ @@ -30,31 +30,6 @@ ArrayDataBasicOps::~ArrayDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -ArrayDataBasicOps::ArrayDataBasicOps( - const ArrayDataBasicOps& foo) -{ - NULL_USE(foo); // not implemented (but needed by some compilers) -} - -template -void -ArrayDataBasicOps::operator = ( - const ArrayDataBasicOps& foo) -{ - NULL_USE(foo); // not implemented (but needed by some compilers) -} - /* ************************************************************************* * @@ -76,16 +51,16 @@ ArrayDataBasicOps::scale( #pragma warning (disable:1572) #endif - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); if (alpha == tbox::MathUtilities::getZero()) { dst.fillAll(alpha, box); } else if (alpha == tbox::MathUtilities::getOne()) { dst.copy(src, box); } else { - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src.getDepth()); @@ -95,51 +70,51 @@ ArrayDataBasicOps::scale( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = alpha * sd[src_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -152,16 +127,16 @@ ArrayDataBasicOps::scale( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } @@ -188,14 +163,14 @@ ArrayDataBasicOps::addScalar( #pragma warning (disable:1572) #endif - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); if (alpha == tbox::MathUtilities::getZero()) { dst.copy(src, box); } else { - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src.getDepth()); @@ -205,51 +180,51 @@ ArrayDataBasicOps::addScalar( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = alpha + sd[src_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -262,16 +237,16 @@ ArrayDataBasicOps::addScalar( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } @@ -293,11 +268,11 @@ ArrayDataBasicOps::add( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -308,12 +283,12 @@ ArrayDataBasicOps::add( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -321,47 +296,47 @@ ArrayDataBasicOps::add( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = s1d[src1_counter + i0] + s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -375,7 +350,7 @@ ArrayDataBasicOps::add( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -384,10 +359,10 @@ ArrayDataBasicOps::add( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -409,11 +384,11 @@ ArrayDataBasicOps::subtract( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -424,12 +399,12 @@ ArrayDataBasicOps::subtract( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -437,47 +412,47 @@ ArrayDataBasicOps::subtract( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = s1d[src1_counter + i0] - s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -491,7 +466,7 @@ ArrayDataBasicOps::subtract( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -500,10 +475,10 @@ ArrayDataBasicOps::subtract( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -525,10 +500,10 @@ ArrayDataBasicOps::multiply( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -539,12 +514,12 @@ ArrayDataBasicOps::multiply( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -552,47 +527,47 @@ ArrayDataBasicOps::multiply( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = s1d[src1_counter + i0] * s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -606,7 +581,7 @@ ArrayDataBasicOps::multiply( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -615,10 +590,10 @@ ArrayDataBasicOps::multiply( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -640,10 +615,10 @@ ArrayDataBasicOps::divide( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -654,12 +629,12 @@ ArrayDataBasicOps::divide( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -667,44 +642,44 @@ ArrayDataBasicOps::divide( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = s1d[src1_counter + i0] / s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -718,7 +693,7 @@ ArrayDataBasicOps::divide( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -727,10 +702,10 @@ ArrayDataBasicOps::divide( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -751,10 +726,10 @@ ArrayDataBasicOps::reciprocal( const pdat::ArrayData& src, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); - int dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src.getDepth()); @@ -764,52 +739,52 @@ ArrayDataBasicOps::reciprocal( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = tbox::MathUtilities::getOne() / sd[src_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -822,16 +797,16 @@ ArrayDataBasicOps::reciprocal( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } @@ -859,10 +834,10 @@ ArrayDataBasicOps::linearSum( #pragma warning (disable:1572) #endif - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); - const int ddepth = dst.getDepth(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -891,12 +866,12 @@ ArrayDataBasicOps::linearSum( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -904,47 +879,47 @@ ArrayDataBasicOps::linearSum( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = alpha * s1d[src1_counter + i0] + beta * s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -958,7 +933,7 @@ ArrayDataBasicOps::linearSum( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -967,10 +942,10 @@ ArrayDataBasicOps::linearSum( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -994,9 +969,9 @@ ArrayDataBasicOps::axpy( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); if (alpha == tbox::MathUtilities::getZero()) { dst.copy(src2, box); @@ -1005,7 +980,7 @@ ArrayDataBasicOps::axpy( } else if (alpha == -tbox::MathUtilities::getOne()) { subtract(dst, src2, src1, box); } else { - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -1016,12 +991,12 @@ ArrayDataBasicOps::axpy( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -1029,47 +1004,47 @@ ArrayDataBasicOps::axpy( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = alpha * s1d[src1_counter + i0] + s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1083,7 +1058,7 @@ ArrayDataBasicOps::axpy( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -1092,10 +1067,10 @@ ArrayDataBasicOps::axpy( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -1119,16 +1094,16 @@ ArrayDataBasicOps::axmy( const pdat::ArrayData& src2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src1, src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src1, src2, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); if (alpha == tbox::MathUtilities::getZero()) { scale(dst, -tbox::MathUtilities::getOne(), src2, box); } else if (alpha == tbox::MathUtilities::getOne()) { subtract(dst, src1, src2, box); } else { - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TBOX_ASSERT(ddepth == src1.getDepth() && ddepth == src2.getDepth()); @@ -1139,12 +1114,12 @@ ArrayDataBasicOps::axmy( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src1_w[SAMRAI::MAX_DIM_VAL]; + int src2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src1_w[i] = src1_box.numberCells(i); @@ -1152,47 +1127,47 @@ ArrayDataBasicOps::axmy( dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src1_offset = src1.getOffset(); - const int src2_offset = src2.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src1_offset = src1.getOffset(); + const size_t src2_offset = src2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src1_begin = src1_box.offset(ibox.lower()); - int src2_begin = src2_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src1_begin = src1_box.offset(ibox.lower()); + size_t src2_begin = src2_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* s1d = src1.getPointer(); const TYPE* s2d = src2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src1_counter = src1_begin; - int src2_counter = src2_begin; + size_t dst_counter = dst_begin; + size_t src1_counter = src1_begin; + size_t src2_counter = src2_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src1_b[nd] = src1_counter; - src2_b[nd] = src2_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src1_b[SAMRAI::MAX_DIM_VAL]; + int src2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src1_b[nd] = static_cast(src1_counter); + src2_b[nd] = static_cast(src2_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = alpha * s1d[src1_counter + i0] - s2d[src2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1206,7 +1181,7 @@ ArrayDataBasicOps::axmy( int dst_step = 1; int src1_step = 1; int src2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src1_step *= src1_w[k]; src2_step *= src2_w[k]; @@ -1215,10 +1190,10 @@ ArrayDataBasicOps::axmy( src1_counter = src1_b[dim_jump - 1] + src1_step; src2_counter = src2_b[dim_jump - 1] + src2_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src1_b[m] = src1_counter; - src2_b[m] = src2_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src1_b[m] = static_cast(src1_counter); + src2_b[m] = static_cast(src2_counter); } } @@ -1239,52 +1214,52 @@ ArrayDataBasicOps::min( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); TYPE minval = tbox::MathUtilities::getMax(); const hier::Box d_box = data.getBox(); const hier::Box ibox = box * d_box; if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = data.getDepth(); + const unsigned int ddepth = data.getDepth(); const TYPE* dd = data.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { minval = tbox::MathUtilities::Min(minval, dd[d_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1295,13 +1270,13 @@ ArrayDataBasicOps::min( } if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } @@ -1319,9 +1294,9 @@ ArrayDataBasicOps::max( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); TYPE maxval = -(tbox::MathUtilities::getMax()); const hier::Box d_box = data.getBox(); @@ -1329,43 +1304,43 @@ ArrayDataBasicOps::max( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = data.getDepth(); + const unsigned int ddepth = data.getDepth(); const TYPE* dd = data.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { maxval = tbox::MathUtilities::Max(maxval, dd[d_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1376,13 +1351,13 @@ ArrayDataBasicOps::max( } if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } @@ -1402,50 +1377,50 @@ ArrayDataBasicOps::setRandomValues( const TYPE& low, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst, box); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); const hier::Box d_box = dst.getBox(); const hier::Box ibox = box * d_box; if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = dst.getOffset(); + const size_t d_offset = dst.getOffset(); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = dst.getDepth(); + const unsigned int ddepth = dst.getDepth(); TYPE* dd = dst.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[d_counter + i0] = tbox::MathUtilities::Rand(low, width); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1456,13 +1431,13 @@ ArrayDataBasicOps::setRandomValues( } if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.h index 450e0b67..70bf64ba 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated operations for array data. * ************************************************************************/ @@ -21,7 +21,7 @@ namespace math { /** * Class ArrayDataBasicOps implements a set of basic operations - * that apply to numerical data maintained as pdat::ArrayData objects. + * that apply to numerical data maintained as pdat::ArrayData objects. * These operations include simple arithmetic operations as well as min * and max, etc. This class provides a single implementation of these * operations that may used to manipulate any of the standard array-based @@ -29,7 +29,7 @@ namespace math { * accepts a box argument which specifies the portion of the array data * on which the associated operation is performed. The actual index * region on which the operation occurs is the intersection of this box - * and the boxes of all the pdat::ArrayData objects involved. + * and the boxes of all the pdat::ArrayData objects involved. * * These operations typically apply only to the numerical standard built-in * types, such as double, float, and int, and the complex type (which may or @@ -57,6 +57,11 @@ class ArrayDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre (alpha == tbox::MathUtilities::getZero()) || + * (alpha == tbox::MathUtilities::getOne()) || + * (dst.getDepth() == src.getDepth()) */ void scale( @@ -67,6 +72,10 @@ class ArrayDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre (alpha == tbox::MathUtilities::getZero()) || + * (dst.getDepth() == src.getDepth()) */ void addScalar( @@ -77,6 +86,11 @@ class ArrayDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth()) */ void add( @@ -87,6 +101,11 @@ class ArrayDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth()) */ void subtract( @@ -97,6 +116,11 @@ class ArrayDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth()) */ void multiply( @@ -107,6 +131,11 @@ class ArrayDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth()) */ void divide( @@ -117,6 +146,9 @@ class ArrayDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void reciprocal( @@ -126,6 +158,11 @@ class ArrayDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth()) */ void linearSum( @@ -138,6 +175,14 @@ class ArrayDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (alpha == tbox::MathUtilities::getZero()) || + * (alpha == tbox::MathUtilities::getOne()) || + * (alpha == -tbox::MathUtilities::getOne()) || + * ((dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth())) */ void axpy( @@ -149,6 +194,13 @@ class ArrayDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre (dst.getDim() == src1.getDim()) && + * (dst.getDim() == src2.getDim()) && (dst.getDim() == box.getDim()) + * @pre (alpha == tbox::MathUtilities::getZero()) || + * (alpha == tbox::MathUtilities::getOne()) || + * ((dst.getDepth() == src1.getDepth()) && + * (dst.getDepth() == src2.getDepth())) */ void axmy( @@ -161,6 +213,8 @@ class ArrayDataBasicOps /** * Return the minimum array data entry. If data is complex, return the * array data entry with the minimum norm. + * + * @pre data.getDim() == box.getDim() */ TYPE min( @@ -170,6 +224,8 @@ class ArrayDataBasicOps /** * Return the maximum array data entry. If data is complex, return the * array data entry with the maximum norm. + * + * @pre data.getDim() == box.getDim() */ TYPE max( @@ -183,6 +239,8 @@ class ArrayDataBasicOps * data is complex, each element of dst is set as dst = dcomplex(rval, ival), * where rval = real(width) * drand48() + real(low), and * ival = imag(width) * drand48() + imag(low). + * + * @pre dst.getDim() == box.getDim() */ void setRandomValues( @@ -194,10 +252,10 @@ class ArrayDataBasicOps private: // The following are not implemented: ArrayDataBasicOps( - const ArrayDataBasicOps&); - void + const ArrayDataBasicOps&); + ArrayDataBasicOps& operator = ( - const ArrayDataBasicOps&); + const ArrayDataBasicOps&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C index 9c886119..1ba5f14d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Miscellaneous templated operations for real array data * ************************************************************************/ @@ -28,31 +28,6 @@ ArrayDataMiscellaneousOpsReal::~ArrayDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -ArrayDataMiscellaneousOpsReal::ArrayDataMiscellaneousOpsReal( - const ArrayDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -ArrayDataMiscellaneousOpsReal::operator = ( - const ArrayDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -69,10 +44,10 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(data1, data2, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(data1, data2, cvol, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); int test = 1; @@ -86,12 +61,12 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( const int cvdepth = cvol.getDepth(); TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); @@ -99,38 +74,38 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const TYPE* dd1 = data1.getPointer(); const TYPE* dd2 = data2.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; - int cv_counter = cv_begin; + int d1_counter = static_cast(d1_begin); + int d2_counter = static_cast(d2_begin); + int cv_counter = static_cast(cv_begin); - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d1_b[nd] = d1_counter; d2_b[nd] = d2_counter; cv_b[nd] = cv_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (cvd[cv_counter + i0] > 0.0) { if (tbox::MathUtilities::Abs(dd2[d2_counter + i0]) > 0.0 @@ -143,7 +118,7 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -157,7 +132,7 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( int d1_step = 1; int d2_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; cv_step *= cv_w[k]; @@ -166,7 +141,7 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPosWithControlVolume( d2_counter = d2_b[dim_jump - 1] + d1_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d1_b[m] = d1_counter; d2_b[m] = d2_counter; cv_b[m] = cv_counter; @@ -192,10 +167,10 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPos( const pdat::ArrayData& data2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data1, data2, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data1, data2, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); int test = 1; @@ -206,43 +181,43 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPos( if (!ibox.empty()) { const int ddepth = data1.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); const TYPE* dd1 = data1.getPointer(); const TYPE* dd2 = data2.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; + int d1_counter = static_cast(d1_begin); + int d2_counter = static_cast(d2_begin); - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d1_b[nd] = d1_counter; d2_b[nd] = d2_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (tbox::MathUtilities::Abs(dd2[d2_counter + i0]) > 0.0 && (dd1[d1_counter + i0] * dd2[d2_counter + i0] <= 0.0)) { test = 0; @@ -251,7 +226,7 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPos( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -264,14 +239,14 @@ ArrayDataMiscellaneousOpsReal::computeConstrProdPos( if (dim_jump > 0) { int d1_step = 1; int d2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; } d1_counter = d1_b[dim_jump - 1] + d1_step; d2_counter = d2_b[dim_jump - 1] + d1_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d1_b[m] = d1_counter; d2_b[m] = d2_counter; } @@ -297,10 +272,10 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src, cvol, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); const hier::Box d_box = dst.getBox(); const hier::Box s_box = src.getBox(); @@ -313,12 +288,12 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int s_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); s_w[i] = s_box.numberCells(i); @@ -326,38 +301,38 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( dim_counter[i] = 0; } - const int d_offset = dst.getOffset(); - const int s_offset = src.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = dst.getOffset(); + const size_t s_offset = src.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int s_begin = s_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t s_begin = s_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int s_counter = s_begin; - int cv_counter = cv_begin; + int d_counter = static_cast(d_begin); + int s_counter = static_cast(s_begin); + int cv_counter = static_cast(cv_begin); - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d_b[SAMRAI::MAX_DIM_VAL]; + int s_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d_b[nd] = d_counter; s_b[nd] = s_counter; cv_b[nd] = cv_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (cvd[cv_counter + i0] > 0.0) { dd[d_counter + i0] = ( @@ -369,7 +344,7 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -383,7 +358,7 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( int d_step = 1; int s_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; s_step *= s_w[k]; cv_step *= cv_w[k]; @@ -392,7 +367,7 @@ ArrayDataMiscellaneousOpsReal::compareToScalarWithControlVolume( s_counter = s_b[dim_jump - 1] + s_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d_b[m] = d_counter; s_b[m] = s_counter; cv_b[m] = cv_counter; @@ -416,10 +391,10 @@ ArrayDataMiscellaneousOpsReal::compareToScalar( const TYPE& alpha, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); const hier::Box d_box = dst.getBox(); const hier::Box s_box = src.getBox(); @@ -429,43 +404,43 @@ ArrayDataMiscellaneousOpsReal::compareToScalar( const int ddepth = dst.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int s_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); s_w[i] = s_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = dst.getOffset(); - const int s_offset = src.getOffset(); + const size_t d_offset = dst.getOffset(); + const size_t s_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int s_begin = s_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t s_begin = s_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int s_counter = s_begin; + size_t d_counter = d_begin; + size_t s_counter = s_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - s_b[nd] = s_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int s_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + s_b[nd] = static_cast(s_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[d_counter + i0] = ( (tbox::MathUtilities::Abs(sd[s_counter + i0]) >= alpha) @@ -474,7 +449,7 @@ ArrayDataMiscellaneousOpsReal::compareToScalar( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -487,16 +462,16 @@ ArrayDataMiscellaneousOpsReal::compareToScalar( if (dim_jump > 0) { int d_step = 1; int s_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; s_step *= s_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; s_counter = s_b[dim_jump - 1] + s_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - s_b[m] = s_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + s_b[m] = static_cast(s_counter); } } } @@ -516,7 +491,7 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src, cvol, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); // Ignore Intel warning about floating point comparisons @@ -524,7 +499,7 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( #pragma warning (disable:1572) #endif - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); int test = 1; @@ -539,12 +514,12 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int s_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); s_w[i] = s_box.numberCells(i); @@ -552,38 +527,38 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( dim_counter[i] = 0; } - const int d_offset = dst.getOffset(); - const int s_offset = src.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = dst.getOffset(); + const size_t s_offset = src.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int s_begin = s_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t s_begin = s_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int s_counter = s_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t s_counter = s_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - s_b[nd] = s_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int s_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + s_b[nd] = static_cast(s_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (cvd[cv_counter + i0] > 0.0) { if (sd[s_counter + i0] == 0.0) { test = 0; @@ -596,7 +571,7 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -609,7 +584,7 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( int d_step = 1; int s_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; s_step *= s_w[k]; cv_step *= cv_w[k]; @@ -618,10 +593,10 @@ ArrayDataMiscellaneousOpsReal::testReciprocalWithControlVolume( s_counter = s_b[dim_jump - 1] + s_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - s_b[m] = s_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + s_b[m] = static_cast(s_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -648,10 +623,10 @@ ArrayDataMiscellaneousOpsReal::testReciprocal( #pragma warning (disable:1572) #endif - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); int test = 1; @@ -662,43 +637,43 @@ ArrayDataMiscellaneousOpsReal::testReciprocal( if (!ibox.empty()) { const int ddepth = dst.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int s_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); s_w[i] = s_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = dst.getOffset(); - const int s_offset = src.getOffset(); + const size_t d_offset = dst.getOffset(); + const size_t s_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int s_begin = s_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t s_begin = s_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int s_counter = s_begin; + int d_counter = static_cast(d_begin); + int s_counter = static_cast(s_begin); - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int s_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d_b[SAMRAI::MAX_DIM_VAL]; + int s_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d_b[nd] = d_counter; s_b[nd] = s_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (sd[s_counter + i0] == 0.0) { test = 0; dd[d_counter + i0] = 0.0F; @@ -709,7 +684,7 @@ ArrayDataMiscellaneousOpsReal::testReciprocal( int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -721,14 +696,14 @@ ArrayDataMiscellaneousOpsReal::testReciprocal( if (dim_jump > 0) { int d_step = 1; int s_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; s_step *= s_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; s_counter = s_b[dim_jump - 1] + s_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d_b[m] = d_counter; s_b[m] = s_counter; } @@ -751,10 +726,10 @@ ArrayDataMiscellaneousOpsReal::maxPointwiseDivide( const pdat::ArrayData& denom, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(numer, denom, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(numer, denom, box); TBOX_ASSERT(denom.getDepth() == numer.getDepth()); - int dimVal = numer.getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer.getDim().getValue(); TYPE max = 0.0, quot; @@ -765,43 +740,43 @@ ArrayDataMiscellaneousOpsReal::maxPointwiseDivide( if (!ibox.empty()) { const int ddepth = denom.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int n_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int n_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); n_w[i] = n_box.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int n_offset = numer.getOffset(); - const int d_offset = denom.getOffset(); + const size_t n_offset = numer.getOffset(); + const size_t d_offset = denom.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int n_begin = n_box.offset(ibox.lower()); - int d_begin = d_box.offset(ibox.lower()); + size_t n_begin = n_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); const TYPE* nd = numer.getPointer(); const TYPE* dd = denom.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int n_counter = n_begin; - int d_counter = d_begin; + size_t n_counter = n_begin; + size_t d_counter = d_begin; - int n_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nm = 0; nm < dimVal; nm++) { - n_b[nm] = n_counter; - d_b[nm] = d_counter; + int n_b[SAMRAI::MAX_DIM_VAL]; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nm = 0; nm < dimVal; ++nm) { + n_b[nm] = static_cast(n_counter); + d_b[nm] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (dd[d_counter + i0] == 0.0) { quot = tbox::MathUtilities::Abs(nd[n_counter + i0]); } else { @@ -812,7 +787,7 @@ ArrayDataMiscellaneousOpsReal::maxPointwiseDivide( } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -825,16 +800,16 @@ ArrayDataMiscellaneousOpsReal::maxPointwiseDivide( if (dim_jump > 0) { int n_step = 1; int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { n_step *= n_w[k]; d_step *= d_w[k]; } n_counter = n_b[dim_jump - 1] + n_step; d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - n_b[m] = n_counter; - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + n_b[m] = static_cast(n_counter); + d_b[m] = static_cast(d_counter); } } } @@ -855,10 +830,10 @@ ArrayDataMiscellaneousOpsReal::minPointwiseDivide( const pdat::ArrayData& denom, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(numer, denom, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(numer, denom, box); TBOX_ASSERT(denom.getDepth() == numer.getDepth()); - int dimVal = numer.getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer.getDim().getValue(); TYPE min = tbox::MathUtilities::getMax(); TYPE quot = tbox::MathUtilities::getMax(); @@ -870,43 +845,43 @@ ArrayDataMiscellaneousOpsReal::minPointwiseDivide( if (!ibox.empty()) { const int ddepth = denom.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int n_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int n_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); n_w[i] = n_box.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int n_offset = numer.getOffset(); - const int d_offset = denom.getOffset(); + const size_t n_offset = numer.getOffset(); + const size_t d_offset = denom.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int n_begin = n_box.offset(ibox.lower()); - int d_begin = d_box.offset(ibox.lower()); + size_t n_begin = n_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); const TYPE* nd = numer.getPointer(); const TYPE* dd = denom.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int n_counter = n_begin; - int d_counter = d_begin; + size_t n_counter = n_begin; + size_t d_counter = d_begin; - int n_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nm = 0; nm < dimVal; nm++) { - n_b[nm] = n_counter; - d_b[nm] = d_counter; + int n_b[SAMRAI::MAX_DIM_VAL]; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nm = 0; nm < dimVal; ++nm) { + n_b[nm] = static_cast(n_counter); + d_b[nm] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (dd[d_counter + i0] != 0.0) { quot = nd[n_counter + i0] / dd[d_counter + i0]; } @@ -914,7 +889,7 @@ ArrayDataMiscellaneousOpsReal::minPointwiseDivide( } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -927,16 +902,16 @@ ArrayDataMiscellaneousOpsReal::minPointwiseDivide( if (dim_jump > 0) { int n_step = 1; int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { n_step *= n_w[k]; d_step *= d_w[k]; } n_counter = n_b[dim_jump - 1] + n_step; d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - n_b[m] = n_counter; - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + n_b[m] = static_cast(n_counter); + d_b[m] = static_cast(d_counter); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h index d6927f42..5632f92e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Miscellaneous templated operations for real array data * ************************************************************************/ @@ -21,9 +21,10 @@ namespace math { /** * Class ArrayDataMiscellaneousOpsReal provides various operations that * may be applied to arrays of real (double and float) numerical data - * values maintained using pdat::ArrayData objects. These operations are + * values maintained using pdat::ArrayData objects. These operations are * sufficiently different from basic arithmetic and norm operations that we - * chose to implement them in a separate class. However, as in the case of the * more common operations, the intent of this class is to provide a single + * chose to implement them in a separate class. However, as in the case of the + * more common operations, the intent of this class is to provide a single * implementation of the operations as they are needed by objects that * manipulate standard array-based patch data types (i.e., cell-centered, * face-centered, node-centered). Each operation is implemented in two @@ -33,13 +34,14 @@ namespace math { * operations are used in vector kernels where the data resides over multiple * levels of spatial resolution in an AMR hierarchy. The actual index * region on which each operation occurs is the intersection of this box - * and the boxes of all the pdat::ArrayData objects involved. + * and the boxes of all the pdat::ArrayData objects involved. * * Since these operations are used only by the vector kernels for the KINSOL * and CVODE solver packages at this time, they are intended to be instantiated * for the standard built-in types double and float (since those solvers only * treat double and float data). To extend this class to other data types or - * to include other operations, the member functions must be specialized or the * new operations must be added. + * to include other operations, the member functions must be specialized or the + * new operations must be added. * * @see pdat::ArrayData */ @@ -58,6 +60,10 @@ class ArrayDataMiscellaneousOpsReal /** * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == cvol.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth() == data2.getDepth() */ int computeConstrProdPosWithControlVolume( @@ -69,6 +75,9 @@ class ArrayDataMiscellaneousOpsReal /** * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region. Otherwise return 0. + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth() == data2.getDepth() */ int computeConstrProdPos( @@ -79,6 +88,10 @@ class ArrayDataMiscellaneousOpsReal /** * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == cvol.getDim()) && + * (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void compareToScalarWithControlVolume( @@ -90,6 +103,9 @@ class ArrayDataMiscellaneousOpsReal /** * Set \f$dst_i = 1\f$ if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void compareToScalar( @@ -102,6 +118,10 @@ class ArrayDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1/src_i\f$ if * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == cvol.getDim()) && + * (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ int testReciprocalWithControlVolume( @@ -113,6 +133,9 @@ class ArrayDataMiscellaneousOpsReal /** * Set \f$dst_i = 1/src_i\f$ if \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ int testReciprocal( @@ -132,6 +155,10 @@ class ArrayDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre (numer.getDim() == denom.getDim()) && + * (numer.getDim() == box.getDim()) + * @pre numer.getDepth() == denom.getDepth() */ TYPE maxPointwiseDivide( @@ -152,6 +179,10 @@ class ArrayDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre (numer.getDim() == denom.getDim()) && + * (numer.getDim() == box.getDim()) + * @pre numer.getDepth() == denom.getDepth() */ TYPE minPointwiseDivide( @@ -162,10 +193,10 @@ class ArrayDataMiscellaneousOpsReal private: // The following are not implemented: ArrayDataMiscellaneousOpsReal( - const ArrayDataMiscellaneousOpsReal&); - void + const ArrayDataMiscellaneousOpsReal&); + ArrayDataMiscellaneousOpsReal& operator = ( - const ArrayDataMiscellaneousOpsReal&); + const ArrayDataMiscellaneousOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.C index 496d7933..b525cb59 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.C @@ -3,18 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex data arrays. * ************************************************************************/ - -#ifndef included_math_ArrayDataNormOpsComplex_C -#define included_math_ArrayDataNormOpsComplex_C - #include "SAMRAI/math/ArrayDataNormOpsComplex.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + namespace SAMRAI { namespace math { @@ -40,10 +38,10 @@ ArrayDataNormOpsComplex::abs( const pdat::ArrayData& src, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); const hier::Box dst_box = dst.getBox(); const hier::Box src_box = src.getBox(); @@ -51,50 +49,50 @@ ArrayDataNormOpsComplex::abs( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); double* dd = dst.getPointer(); const dcomplex* sd = src.getPointer(); const int ddepth = dst.getDepth(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = sqrt(norm(sd[src_counter + i0])); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -107,16 +105,16 @@ ArrayDataNormOpsComplex::abs( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } } @@ -134,9 +132,9 @@ ArrayDataNormOpsComplex::sumControlVolumes( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double sum = 0.0; @@ -146,44 +144,44 @@ ArrayDataNormOpsComplex::sumControlVolumes( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int cv_offset = cvol.getOffset(); + const size_t cv_offset = cvol.getOffset(); - int cv_begin = cv_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = cvol.getDepth(); + const unsigned int ddepth = cvol.getDepth(); TBOX_ASSERT((ddepth == data.getDepth()) || (ddepth == 1)); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int cv_counter = cv_begin; + int cv_counter = static_cast(cv_begin); - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { cv_b[nd] = cv_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { sum += cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -194,12 +192,12 @@ ArrayDataNormOpsComplex::sumControlVolumes( } if (dim_jump > 0) { int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { cv_step *= cv_w[k]; } cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { cv_b[m] = cv_counter; } } @@ -220,9 +218,9 @@ ArrayDataNormOpsComplex::L1NormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double l1norm = 0.0; @@ -236,48 +234,48 @@ ArrayDataNormOpsComplex::L1NormWithControlVolume( TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - int d_begin = d_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); const dcomplex* dd = data.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { l1norm += sqrt(norm(dd[d_counter + i0])) * cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -290,16 +288,16 @@ ArrayDataNormOpsComplex::L1NormWithControlVolume( if (dim_jump > 0) { int d_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; cv_step *= cv_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -317,9 +315,9 @@ ArrayDataNormOpsComplex::L1Norm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double l1norm = 0.0; @@ -328,42 +326,42 @@ ArrayDataNormOpsComplex::L1Norm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); const int ddepth = data.getDepth(); const dcomplex* dd = data.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { l1norm += sqrt(norm(dd[d_counter + i0])); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -375,13 +373,13 @@ ArrayDataNormOpsComplex::L1Norm( if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } @@ -400,10 +398,10 @@ ArrayDataNormOpsComplex::dotWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(data1, data2, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(data1, data2, cvol, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); dcomplex dprod = dcomplex(0.0, 0.0); @@ -413,18 +411,18 @@ ArrayDataNormOpsComplex::dotWithControlVolume( const hier::Box ibox = box * d1_box * d2_box * cv_box; if (!ibox.empty()) { - const int d1depth = data1.getDepth(); - const int cvdepth = cvol.getDepth(); + const unsigned int d1depth = data1.getDepth(); + const unsigned int cvdepth = cvol.getDepth(); TBOX_ASSERT(d1depth == data2.getDepth()); TBOX_ASSERT((d1depth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); @@ -432,44 +430,44 @@ ArrayDataNormOpsComplex::dotWithControlVolume( dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const dcomplex* dd1 = data1.getPointer(); const dcomplex* dd2 = data2.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < d1depth; d++) { + for (unsigned int d = 0; d < d1depth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; - int cv_counter = cv_begin; + size_t d1_counter = d1_begin; + size_t d2_counter = d2_begin; + size_t cv_counter = cv_begin; - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d1_b[nd] = d1_counter; - d2_b[nd] = d2_counter; - cv_b[nd] = cv_counter; + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d1_b[nd] = static_cast(d1_counter); + d2_b[nd] = static_cast(d2_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dprod += dd1[d1_counter + i0] * conj(dd2[d2_counter + i0]) * cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -483,7 +481,7 @@ ArrayDataNormOpsComplex::dotWithControlVolume( int d1_step = 1; int d2_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; cv_step *= cv_w[k]; @@ -492,10 +490,10 @@ ArrayDataNormOpsComplex::dotWithControlVolume( d2_counter = d2_b[dim_jump - 1] + d2_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d1_b[m] = d1_counter; - d2_b[m] = d2_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d1_b[m] = static_cast(d1_counter); + d2_b[m] = static_cast(d2_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -517,10 +515,10 @@ ArrayDataNormOpsComplex::dot( const pdat::ArrayData& data2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data1, data2, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data1, data2, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); dcomplex dprod = dcomplex(0.0, 0.0); @@ -529,52 +527,52 @@ ArrayDataNormOpsComplex::dot( const hier::Box ibox = box * d1_box * d2_box; if (!ibox.empty()) { - const int d1depth = data1.getDepth(); + const unsigned int d1depth = data1.getDepth(); TBOX_ASSERT(d1depth == data2.getDepth()); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); const dcomplex* dd1 = data1.getPointer(); const dcomplex* dd2 = data2.getPointer(); - for (int d = 0; d < d1depth; d++) { + for (unsigned int d = 0; d < d1depth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; + size_t d1_counter = d1_begin; + size_t d2_counter = d2_begin; - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d1_b[nd] = d1_counter; - d2_b[nd] = d2_counter; + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d1_b[nd] = static_cast(d1_counter); + d2_b[nd] = static_cast(d2_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dprod += dd1[d1_counter + i0] * conj(dd2[d2_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -587,16 +585,16 @@ ArrayDataNormOpsComplex::dot( if (dim_jump > 0) { int d1_step = 1; int d2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; } d1_counter = d1_b[dim_jump - 1] + d1_step; d2_counter = d2_b[dim_jump - 1] + d2_step; - for (int m = 0; m < dim_jump; m++) { - d1_b[m] = d1_counter; - d2_b[m] = d2_counter; + for (int m = 0; m < dim_jump; ++m) { + d1_b[m] = static_cast(d1_counter); + d2_b[m] = static_cast(d2_counter); } } } @@ -617,9 +615,9 @@ ArrayDataNormOpsComplex::integral( const pdat::ArrayData& vol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, vol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, vol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); dcomplex integral = dcomplex(0.0, 0.0); @@ -633,48 +631,48 @@ ArrayDataNormOpsComplex::integral( TBOX_ASSERT((ddepth == vdepth) || (vdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int v_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int v_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); v_w[i] = v_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int v_offset = ((vdepth == 1) ? 0 : vol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t v_offset = ((vdepth == 1) ? 0 : vol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int v_begin = v_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t v_begin = v_box.offset(ibox.lower()); const dcomplex* dd = data.getPointer(); const double* vd = vol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int v_counter = v_begin; + size_t d_counter = d_begin; + size_t v_counter = v_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int v_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - v_b[nd] = v_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int v_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + v_b[nd] = static_cast(v_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { integral += dd[d_counter + i0] * vd[v_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -687,16 +685,16 @@ ArrayDataNormOpsComplex::integral( if (dim_jump > 0) { int d_step = 1; int v_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; v_step *= v_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; v_counter = v_b[dim_jump - 1] + v_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - v_b[m] = v_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + v_b[m] = static_cast(v_counter); } } } @@ -716,10 +714,10 @@ ArrayDataNormOpsComplex::weightedL2NormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(data, wgt, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(data, wgt, cvol, box); TBOX_ASSERT(data.getDepth() == wgt.getDepth()); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double wl2norm = 0.0; @@ -734,12 +732,12 @@ ArrayDataNormOpsComplex::weightedL2NormWithControlVolume( TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int w_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); w_w[i] = w_box.numberCells(i); d_w[i] = d_box.numberCells(i); @@ -747,44 +745,44 @@ ArrayDataNormOpsComplex::weightedL2NormWithControlVolume( dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int w_offset = wgt.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t w_offset = wgt.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int w_begin = w_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t w_begin = w_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const dcomplex* dd = data.getPointer(); const dcomplex* wd = wgt.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int w_counter = w_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t w_counter = w_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - w_b[nd] = w_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int w_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + w_b[nd] = static_cast(w_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dcomplex val = dd[d_counter + i0] * wd[w_counter + i0]; wl2norm += real(val * conj(val)) * cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -798,7 +796,7 @@ ArrayDataNormOpsComplex::weightedL2NormWithControlVolume( int d_step = 1; int w_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; w_step *= w_w[k]; cv_step *= cv_w[k]; @@ -807,10 +805,10 @@ ArrayDataNormOpsComplex::weightedL2NormWithControlVolume( w_counter = w_b[dim_jump - 1] + w_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - w_b[m] = w_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + w_b[m] = static_cast(w_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -830,10 +828,10 @@ ArrayDataNormOpsComplex::weightedL2Norm( const pdat::ArrayData& wgt, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, wgt, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, wgt, box); TBOX_ASSERT(data.getDepth() == wgt.getDepth()); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double wl2norm = 0.0; @@ -843,50 +841,50 @@ ArrayDataNormOpsComplex::weightedL2Norm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int w_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); w_w[i] = w_box.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int w_offset = wgt.getOffset(); + const size_t d_offset = data.getOffset(); + const size_t w_offset = wgt.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int w_begin = w_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t w_begin = w_box.offset(ibox.lower()); const dcomplex* dd = data.getPointer(); const dcomplex* wd = wgt.getPointer(); const int ddepth = data.getDepth(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int w_counter = w_begin; + size_t d_counter = d_begin; + size_t w_counter = w_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - w_b[nd] = w_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int w_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + w_b[nd] = static_cast(w_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dcomplex val = dd[d_counter + i0] * wd[w_counter + i0]; wl2norm += real(val * conj(val)); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -899,16 +897,16 @@ ArrayDataNormOpsComplex::weightedL2Norm( if (dim_jump > 0) { int d_step = 1; int w_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; w_step *= w_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; w_counter = w_b[dim_jump - 1] + w_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - w_b[m] = w_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + w_b[m] = static_cast(w_counter); } } } @@ -927,9 +925,9 @@ ArrayDataNormOpsComplex::maxNormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double maxnorm = 0.0; @@ -943,43 +941,43 @@ ArrayDataNormOpsComplex::maxNormWithControlVolume( TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const dcomplex* dd = data.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (cvd[cv_counter + i0] > 0.0) { maxnorm = tbox::MathUtilities::Max(maxnorm, norm(dd[d_counter + i0])); @@ -987,7 +985,7 @@ ArrayDataNormOpsComplex::maxNormWithControlVolume( } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1000,16 +998,16 @@ ArrayDataNormOpsComplex::maxNormWithControlVolume( if (dim_jump > 0) { int d_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; cv_step *= cv_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -1027,9 +1025,9 @@ ArrayDataNormOpsComplex::maxNorm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double maxnorm = 0.0; @@ -1038,42 +1036,42 @@ ArrayDataNormOpsComplex::maxNorm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); const dcomplex* dd = data.getPointer(); const int ddepth = data.getDepth(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + int d_counter = static_cast(d_begin); - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d_b[nd] = d_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { maxnorm = tbox::MathUtilities::Max(maxnorm, norm(dd[d_counter + i0])); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1085,12 +1083,12 @@ ArrayDataNormOpsComplex::maxNorm( if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d_b[m] = d_counter; } } @@ -1105,4 +1103,3 @@ ArrayDataNormOpsComplex::maxNorm( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.h index 78aabb7d..446fbac0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex data arrays. * ************************************************************************/ @@ -17,13 +17,15 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" +#include + namespace SAMRAI { namespace math { /** * Class ArrayDataNormOpsComplex provides a set of common norm * operations that may be applied to arrays of complex data values - * maintained as pdat::ArrayData objects. The intent of this class is to + * maintained as pdat::ArrayData objects. The intent of this class is to * provide a single implementation of these operations as they are needed * by objects that perform these operations on the standard array-based patch * data types (i.e., cell-centered, face-centered, node-centered). Each of @@ -34,7 +36,7 @@ namespace math { * vector kernels where the data resides over multiple levels in an AMR * hierarchy. Note also that each operation will be performed on the * intersection of the box in the function argument list and the boxes - * associated with all pdat::ArrayData objects. + * associated with all pdat::ArrayData objects. * * Note that a similar set of norm operations is implemented for real array * data (double and float) in the class ArrayDataNormOpsReal. @@ -56,6 +58,9 @@ class ArrayDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void abs( @@ -65,6 +70,8 @@ class ArrayDataNormOpsComplex /** * Return sum of entries in control volume array. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double sumControlVolumes( @@ -76,6 +83,8 @@ class ArrayDataNormOpsComplex * Return discrete \f$L_1\f$-norm of the data using the control volume to * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}} cvol_i )\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double L1NormWithControlVolume( @@ -86,6 +95,8 @@ class ArrayDataNormOpsComplex /** * Return discrete \f$L_1\f$-norm of the data. That is, the return value is * the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre (data.getDim() == box.getDim() */ double L1Norm( @@ -97,6 +108,8 @@ class ArrayDataNormOpsComplex * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sqrt{ \sum_i ( * data_i * \bar{data_i} cvol_i ) }\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double L2NormWithControlVolume( @@ -104,7 +117,7 @@ class ArrayDataNormOpsComplex const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); return sqrt(real(dotWithControlVolume(data, data, cvol, box))); } @@ -112,13 +125,15 @@ class ArrayDataNormOpsComplex * Return discrete \f$L_2\f$-norm of the data using the control volume to * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data.getDim() == box.getDim() */ double L2Norm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); return sqrt(real(dot(data, data, box))); } @@ -127,6 +142,10 @@ class ArrayDataNormOpsComplex * volume to weight the contribution of the data and weight entries to * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre (data.getDim() == wgt.getDim()) && + * (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) + * @pre data.getDepth() == wgt.getDepth() */ double weightedL2NormWithControlVolume( @@ -139,6 +158,9 @@ class ArrayDataNormOpsComplex * Return discrete weighted \f$L_2\f$-norm of the data. That is, the return * value is the sum \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre (data.getDim() == wgt.getDim()) && (data.getDim() == box.getDim()) + * @pre data.getDepth() == wgt.getDepth() */ double weightedL2Norm( @@ -151,6 +173,8 @@ class ArrayDataNormOpsComplex * the contribution of each data entry to the maximum. That is, the return * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double maxNormWithControlVolume( @@ -161,6 +185,8 @@ class ArrayDataNormOpsComplex /** * Return the \f$\max\f$-norm of the data. That is, the return value is * \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data.getDim() == box.getDim() */ double maxNorm( @@ -171,6 +197,11 @@ class ArrayDataNormOpsComplex * Return the dot product of the two data arrays using the control volume * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. + * + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == cvol.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth() == data2.getDepth() */ dcomplex dotWithControlVolume( @@ -182,6 +213,10 @@ class ArrayDataNormOpsComplex /** * Return the dot product of the two data arrays. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} )\f$. + * + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth() == data2.getDepth() */ dcomplex dot( @@ -192,6 +227,8 @@ class ArrayDataNormOpsComplex /** * Return the integral of the function based on the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre (data.getDim() == vol.getDim()) && (data.getDim() == box.getDim()) */ dcomplex integral( @@ -203,7 +240,7 @@ class ArrayDataNormOpsComplex // The following are not implemented: ArrayDataNormOpsComplex( const ArrayDataNormOpsComplex&); - void + ArrayDataNormOpsComplex& operator = ( const ArrayDataNormOpsComplex&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.C index bacf18f4..b31452db 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for integer data arrays. * ************************************************************************/ - -#ifndef included_math_ArrayDataNormOpsInteger_C -#define included_math_ArrayDataNormOpsInteger_C - #include "SAMRAI/math/ArrayDataNormOpsInteger.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -42,7 +38,7 @@ ArrayDataNormOpsInteger::abs( const pdat::ArrayData& src, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); int dimVal = dst.getDim().getValue(); @@ -53,51 +49,51 @@ ArrayDataNormOpsInteger::abs( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); int* dd = dst.getPointer(); const int* sd = src.getPointer(); const int ddepth = dst.getDepth(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (int nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = tbox::MathUtilities::Abs(sd[src_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (int j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -110,16 +106,16 @@ ArrayDataNormOpsInteger::abs( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } } @@ -133,4 +129,3 @@ ArrayDataNormOpsInteger::abs( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.h index cdad79fd..0ed05699 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real data arrays. * ************************************************************************/ @@ -21,13 +21,13 @@ namespace math { /** * Class ArrayDataNormOpsInteger provides a set of common norm * operations that may be applied to arrays of integer data values - * maintained as pdat::ArrayData objects. The intent of this class + * maintained as pdat::ArrayData objects. The intent of this class * is to provide a single implementation of these operations as they are needed * by objects that perform these operations on the standard array-based patch * data types (i.e., cell-centered, face-centered, node-centered). * Note that each operation is performed on the intersection of the box in * the function argument list and the boxes associated with all - * pdat::ArrayData objects. Currently, the only norm operation implemented + * pdat::ArrayData objects. Currently, the only norm operation implemented * in this class is the absolute value operation. * * @see pdat::ArrayData @@ -46,6 +46,9 @@ class ArrayDataNormOpsInteger /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void abs( @@ -57,7 +60,7 @@ class ArrayDataNormOpsInteger // The following are not implemented: ArrayDataNormOpsInteger( const ArrayDataNormOpsInteger&); - void + ArrayDataNormOpsInteger& operator = ( const ArrayDataNormOpsInteger&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.C index 8bded887..dec2ab5b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated array data norm operations. * ************************************************************************/ @@ -15,6 +15,8 @@ #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Utilities.h" +#include + namespace SAMRAI { namespace math { @@ -28,31 +30,6 @@ ArrayDataNormOpsReal::~ArrayDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -ArrayDataNormOpsReal::ArrayDataNormOpsReal( - const ArrayDataNormOpsReal& foo) -{ - NULL_USE(foo); // not implemented (but needed by some compilers) -} - -template -void -ArrayDataNormOpsReal::operator = ( - const ArrayDataNormOpsReal& foo) -{ - NULL_USE(foo); // not implemented (but needed by some compilers) -} - /* ************************************************************************* * @@ -68,10 +45,10 @@ ArrayDataNormOpsReal::abs( const pdat::ArrayData& src, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(dst, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(dst, src, box); TBOX_ASSERT(dst.getDepth() == src.getDepth()); - int dimVal = dst.getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst.getDim().getValue(); const hier::Box dst_box = dst.getBox(); const hier::Box src_box = src.getBox(); @@ -79,51 +56,51 @@ ArrayDataNormOpsReal::abs( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { - box_w[i] = ibox.numberCells(i); - dst_w[i] = dst_box.numberCells(i); - src_w[i] = src_box.numberCells(i); + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { + box_w[i] = static_cast(ibox.numberCells(i)); + dst_w[i] = static_cast(dst_box.numberCells(i)); + src_w[i] = static_cast(src_box.numberCells(i)); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int dst_begin = dst_box.offset(ibox.lower()); - int src_begin = src_box.offset(ibox.lower()); + size_t dst_begin = dst_box.offset(ibox.lower()); + size_t src_begin = src_box.offset(ibox.lower()); TYPE* dd = dst.getPointer(); const TYPE* sd = src.getPointer(); - const int ddepth = dst.getDepth(); - for (int d = 0; d < ddepth; d++) { + const unsigned int ddepth = dst.getDepth(); + for (unsigned int d = 0; d < ddepth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - dst_b[nd] = dst_counter; - src_b[nd] = src_counter; + int dst_b[SAMRAI::MAX_DIM_VAL]; + int src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + dst_b[nd] = static_cast(dst_counter); + src_b[nd] = static_cast(src_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dd[dst_counter + i0] = tbox::MathUtilities::Abs(sd[src_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -136,16 +113,16 @@ ArrayDataNormOpsReal::abs( if (dim_jump > 0) { int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { - dst_b[m] = dst_counter; - src_b[m] = src_counter; + for (int m = 0; m < dim_jump; ++m) { + dst_b[m] = static_cast(dst_counter); + src_b[m] = static_cast(src_counter); } } } @@ -164,9 +141,9 @@ ArrayDataNormOpsReal::sumControlVolumes( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double sum = 0.0; @@ -176,44 +153,44 @@ ArrayDataNormOpsReal::sumControlVolumes( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int cv_offset = cvol.getOffset(); + const size_t cv_offset = cvol.getOffset(); - int cv_begin = cv_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = cvol.getDepth(); + const unsigned int ddepth = cvol.getDepth(); TBOX_ASSERT((ddepth == data.getDepth()) || (ddepth == 1)); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int cv_counter = cv_begin; + size_t cv_counter = cv_begin; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - cv_b[nd] = cv_counter; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { sum += cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -224,13 +201,13 @@ ArrayDataNormOpsReal::sumControlVolumes( } if (dim_jump > 0) { int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { cv_step *= cv_w[k]; } cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + cv_b[m] = static_cast(cv_counter); } } } @@ -251,9 +228,9 @@ ArrayDataNormOpsReal::L1NormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double l1norm = 0.0; @@ -262,54 +239,54 @@ ArrayDataNormOpsReal::L1NormWithControlVolume( const hier::Box ibox = box * d_box * cv_box; if (!ibox.empty()) { - const int ddepth = data.getDepth(); - const int cvdepth = cvol.getDepth(); + const unsigned int ddepth = data.getDepth(); + const unsigned int cvdepth = cvol.getDepth(); TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - int d_begin = d_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); const TYPE* dd = data.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { l1norm += tbox::MathUtilities::Abs(dd[d_counter + i0]) * cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -322,16 +299,16 @@ ArrayDataNormOpsReal::L1NormWithControlVolume( if (dim_jump > 0) { int d_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; cv_step *= cv_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -350,9 +327,9 @@ ArrayDataNormOpsReal::L1Norm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double l1norm = 0.0; @@ -361,42 +338,42 @@ ArrayDataNormOpsReal::L1Norm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - const int ddepth = data.getDepth(); + const unsigned int ddepth = data.getDepth(); const TYPE* dd = data.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { l1norm += tbox::MathUtilities::Abs(dd[d_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -408,13 +385,13 @@ ArrayDataNormOpsReal::L1Norm( if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } @@ -433,7 +410,7 @@ ArrayDataNormOpsReal::L2NormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); return sqrt(ArrayDataNormOpsReal:: dotWithControlVolume(data, data, cvol, box)); @@ -445,7 +422,7 @@ ArrayDataNormOpsReal::L2Norm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); return sqrt(ArrayDataNormOpsReal::dot(data, data, box)); } @@ -458,10 +435,10 @@ ArrayDataNormOpsReal::weightedL2NormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(data, weight, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(data, weight, cvol, box); TBOX_ASSERT(data.getDepth() == weight.getDepth()); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double wl2norm = 0.0; @@ -471,17 +448,17 @@ ArrayDataNormOpsReal::weightedL2NormWithControlVolume( const hier::Box ibox = box * d_box * w_box * cv_box; if (!ibox.empty()) { - const int ddepth = data.getDepth(); - const int cvdepth = cvol.getDepth(); + const unsigned int ddepth = data.getDepth(); + const unsigned int cvdepth = cvol.getDepth(); TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int w_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); w_w[i] = w_box.numberCells(i); d_w[i] = d_box.numberCells(i); @@ -489,44 +466,44 @@ ArrayDataNormOpsReal::weightedL2NormWithControlVolume( dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int w_offset = weight.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t w_offset = weight.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int w_begin = w_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t w_begin = w_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const TYPE* dd = data.getPointer(); const TYPE* wd = weight.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int w_counter = w_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t w_counter = w_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - w_b[nd] = w_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int w_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + w_b[nd] = static_cast(w_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { TYPE val = dd[d_counter + i0] * wd[w_counter + i0]; wl2norm += val * val * cvd[cv_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -540,7 +517,7 @@ ArrayDataNormOpsReal::weightedL2NormWithControlVolume( int d_step = 1; int w_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; w_step *= w_w[k]; cv_step *= cv_w[k]; @@ -549,10 +526,10 @@ ArrayDataNormOpsReal::weightedL2NormWithControlVolume( w_counter = w_b[dim_jump - 1] + w_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - w_b[m] = w_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + w_b[m] = static_cast(w_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -573,10 +550,10 @@ ArrayDataNormOpsReal::weightedL2Norm( const pdat::ArrayData& weight, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, weight, box); TBOX_ASSERT(data.getDepth() == weight.getDepth()); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double wl2norm = 0.0; @@ -586,50 +563,50 @@ ArrayDataNormOpsReal::weightedL2Norm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int w_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); w_w[i] = w_box.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int w_offset = weight.getOffset(); + const size_t d_offset = data.getOffset(); + const size_t w_offset = weight.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int w_begin = w_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t w_begin = w_box.offset(ibox.lower()); const TYPE* dd = data.getPointer(); const TYPE* wd = weight.getPointer(); - const int ddepth = data.getDepth(); + const unsigned int ddepth = data.getDepth(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int w_counter = w_begin; + size_t d_counter = d_begin; + size_t w_counter = w_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int w_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - w_b[nd] = w_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int w_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + w_b[nd] = static_cast(w_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { TYPE val = dd[d_counter + i0] * wd[w_counter + i0]; wl2norm += val * val; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -642,16 +619,16 @@ ArrayDataNormOpsReal::weightedL2Norm( if (dim_jump > 0) { int d_step = 1; int w_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; w_step *= w_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; w_counter = w_b[dim_jump - 1] + w_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - w_b[m] = w_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + w_b[m] = static_cast(w_counter); } } } @@ -671,9 +648,9 @@ ArrayDataNormOpsReal::maxNormWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, cvol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double maxnorm = 0.0; @@ -682,48 +659,48 @@ ArrayDataNormOpsReal::maxNormWithControlVolume( const hier::Box ibox = box * d_box * cv_box; if (!ibox.empty()) { - const int ddepth = data.getDepth(); - const int cvdepth = cvol.getDepth(); + const unsigned int ddepth = data.getDepth(); + const unsigned int cvdepth = cvol.getDepth(); TBOX_ASSERT((ddepth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); cv_w[i] = cv_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d_offset = data.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const TYPE* dd = data.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; - int cv_counter = cv_begin; + size_t d_counter = d_begin; + size_t cv_counter = cv_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; - cv_b[nd] = cv_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { if (cvd[cv_counter + i0] > 0.0) { maxnorm = tbox::MathUtilities::Max( @@ -733,7 +710,7 @@ ArrayDataNormOpsReal::maxNormWithControlVolume( } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -746,16 +723,16 @@ ArrayDataNormOpsReal::maxNormWithControlVolume( if (dim_jump > 0) { int d_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; cv_step *= cv_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -774,9 +751,9 @@ ArrayDataNormOpsReal::maxNorm( const pdat::ArrayData& data, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(data, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); double maxnorm = 0.0; @@ -785,43 +762,43 @@ ArrayDataNormOpsReal::maxNorm( if (!ibox.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); + const size_t d_offset = data.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); + size_t d_begin = d_box.offset(ibox.lower()); const TYPE* dd = data.getPointer(); - const int ddepth = data.getDepth(); - for (int d = 0; d < ddepth; d++) { + const unsigned int ddepth = data.getDepth(); + for (unsigned int d = 0; d < ddepth; ++d) { - int d_counter = d_begin; + size_t d_counter = d_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d_b[nd] = d_counter; + int d_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d_b[nd] = static_cast(d_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { maxnorm = tbox::MathUtilities::Max( maxnorm, tbox::MathUtilities::Abs(dd[d_counter + i0])); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -833,13 +810,13 @@ ArrayDataNormOpsReal::maxNorm( if (dim_jump > 0) { int d_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; - for (int m = 0; m < dim_jump; m++) { - d_b[m] = d_counter; + for (int m = 0; m < dim_jump; ++m) { + d_b[m] = static_cast(d_counter); } } } @@ -859,7 +836,7 @@ ArrayDataNormOpsReal::dotWithControlVolume( const pdat::ArrayData& cvol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(data1, data2, cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(data1, data2, cvol, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); // Disable Intel warning about conversions @@ -867,7 +844,7 @@ ArrayDataNormOpsReal::dotWithControlVolume( #pragma warning (disable:810) #endif - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); TYPE dprod = 0.0; @@ -877,18 +854,18 @@ ArrayDataNormOpsReal::dotWithControlVolume( const hier::Box ibox = box * d1_box * d2_box * cv_box; if (!ibox.empty()) { - const int d1depth = data1.getDepth(); - const int cvdepth = cvol.getDepth(); + const unsigned int d1depth = data1.getDepth(); + const unsigned int cvdepth = cvol.getDepth(); TBOX_ASSERT(d1depth == data2.getDepth()); TBOX_ASSERT((d1depth == cvdepth) || (cvdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int cv_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); @@ -896,44 +873,44 @@ ArrayDataNormOpsReal::dotWithControlVolume( dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); - const int cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); + const size_t cv_offset = ((cvdepth == 1) ? 0 : cvol.getOffset()); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); - int cv_begin = cv_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); + size_t cv_begin = cv_box.offset(ibox.lower()); const TYPE* dd1 = data1.getPointer(); const TYPE* dd2 = data2.getPointer(); const double* cvd = cvol.getPointer(); - for (int d = 0; d < d1depth; d++) { + for (unsigned int d = 0; d < d1depth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; - int cv_counter = cv_begin; + size_t d1_counter = d1_begin; + size_t d2_counter = d2_begin; + size_t cv_counter = cv_begin; - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int cv_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d1_b[nd] = d1_counter; - d2_b[nd] = d2_counter; - cv_b[nd] = cv_counter; + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + int cv_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d1_b[nd] = static_cast(d1_counter); + d2_b[nd] = static_cast(d2_counter); + cv_b[nd] = static_cast(cv_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dprod += static_cast(dd1[d1_counter + i0] * dd2[d2_counter + i0] * cvd[cv_counter + i0]); } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -947,7 +924,7 @@ ArrayDataNormOpsReal::dotWithControlVolume( int d1_step = 1; int d2_step = 1; int cv_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; cv_step *= cv_w[k]; @@ -956,10 +933,10 @@ ArrayDataNormOpsReal::dotWithControlVolume( d2_counter = d2_b[dim_jump - 1] + d2_step; cv_counter = cv_b[dim_jump - 1] + cv_step; - for (int m = 0; m < dim_jump; m++) { - d1_b[m] = d1_counter; - d2_b[m] = d2_counter; - cv_b[m] = cv_counter; + for (int m = 0; m < dim_jump; ++m) { + d1_b[m] = static_cast(d1_counter); + d2_b[m] = static_cast(d2_counter); + cv_b[m] = static_cast(cv_counter); } } } @@ -982,10 +959,10 @@ ArrayDataNormOpsReal::dot( const pdat::ArrayData& data2, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data1, data2, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data1, data2, box); TBOX_ASSERT(data1.getDepth() == data2.getDepth()); - int dimVal = data1.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1.getDim().getValue(); TYPE dprod = 0.0; @@ -994,52 +971,52 @@ ArrayDataNormOpsReal::dot( const hier::Box ibox = box * d1_box * d2_box; if (!ibox.empty()) { - const int d1depth = data1.getDepth(); + const unsigned int d1depth = data1.getDepth(); TBOX_ASSERT(d1depth == data2.getDepth()); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d1_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d1_w[SAMRAI::MAX_DIM_VAL]; + int d2_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d1_w[i] = d1_box.numberCells(i); d2_w[i] = d2_box.numberCells(i); dim_counter[i] = 0; } - const int d1_offset = data1.getOffset(); - const int d2_offset = data2.getOffset(); + const size_t d1_offset = data1.getOffset(); + const size_t d2_offset = data2.getOffset(); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d1_begin = d1_box.offset(ibox.lower()); - int d2_begin = d2_box.offset(ibox.lower()); + size_t d1_begin = d1_box.offset(ibox.lower()); + size_t d2_begin = d2_box.offset(ibox.lower()); const TYPE* dd1 = data1.getPointer(); const TYPE* dd2 = data2.getPointer(); - for (int d = 0; d < d1depth; d++) { + for (unsigned int d = 0; d < d1depth; ++d) { - int d1_counter = d1_begin; - int d2_counter = d2_begin; + size_t d1_counter = d1_begin; + size_t d2_counter = d2_begin; - int d1_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d2_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { - d1_b[nd] = d1_counter; - d2_b[nd] = d2_counter; + int d1_b[SAMRAI::MAX_DIM_VAL]; + int d2_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + d1_b[nd] = static_cast(d1_counter); + d2_b[nd] = static_cast(d2_counter); } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dprod += dd1[d1_counter + i0] * dd2[d2_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1052,16 +1029,16 @@ ArrayDataNormOpsReal::dot( if (dim_jump > 0) { int d1_step = 1; int d2_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d1_step *= d1_w[k]; d2_step *= d2_w[k]; } d1_counter = d1_b[dim_jump - 1] + d1_step; d2_counter = d2_b[dim_jump - 1] + d2_step; - for (int m = 0; m < dim_jump; m++) { - d1_b[m] = d1_counter; - d2_b[m] = d2_counter; + for (int m = 0; m < dim_jump; ++m) { + d1_b[m] = static_cast(d1_counter); + d2_b[m] = static_cast(d2_counter); } } } @@ -1083,9 +1060,9 @@ ArrayDataNormOpsReal::integral( const pdat::ArrayData& vol, const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(data, vol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(data, vol, box); - int dimVal = data.getDim().getValue(); + tbox::Dimension::dir_t dimVal = data.getDim().getValue(); TYPE integral = 0.0; @@ -1099,48 +1076,49 @@ ArrayDataNormOpsReal::integral( TBOX_ASSERT((ddepth == vdepth) || (vdepth == 1)); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int v_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dimVal; i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int d_w[SAMRAI::MAX_DIM_VAL]; + int v_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dimVal; ++i) { box_w[i] = ibox.numberCells(i); d_w[i] = d_box.numberCells(i); v_w[i] = v_box.numberCells(i); dim_counter[i] = 0; } - const int d_offset = data.getOffset(); - const int v_offset = ((vdepth == 1) ? 0 : vol.getOffset()); + const int d_offset = static_cast(data.getOffset()); + const int v_offset = + ((vdepth == 1) ? 0 : static_cast(vol.getOffset())); - const int num_d0_blocks = ibox.size() / box_w[0]; + const int num_d0_blocks = static_cast(ibox.size() / box_w[0]); - int d_begin = d_box.offset(ibox.lower()); - int v_begin = v_box.offset(ibox.lower()); + int d_begin = static_cast(d_box.offset(ibox.lower())); + int v_begin = static_cast(v_box.offset(ibox.lower())); const TYPE* dd = data.getPointer(); const double* vd = vol.getPointer(); - for (int d = 0; d < ddepth; d++) { + for (int d = 0; d < ddepth; ++d) { int d_counter = d_begin; int v_counter = v_begin; - int d_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int v_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dimVal; nd++) { + int d_b[SAMRAI::MAX_DIM_VAL]; + int v_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { d_b[nd] = d_counter; v_b[nd] = v_counter; } - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { integral += dd[d_counter + i0] * vd[v_counter + i0]; } int dim_jump = 0; - for (int j = 1; j < dimVal; j++) { + for (tbox::Dimension::dir_t j = 1; j < dimVal; ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1153,14 +1131,14 @@ ArrayDataNormOpsReal::integral( if (dim_jump > 0) { int d_step = 1; int v_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { d_step *= d_w[k]; v_step *= v_w[k]; } d_counter = d_b[dim_jump - 1] + d_step; v_counter = v_b[dim_jump - 1] + v_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { d_b[m] = d_counter; v_b[m] = v_counter; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.h index 6f9e6360..368ae58a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/ArrayDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real data arrays. * ************************************************************************/ @@ -21,7 +21,7 @@ namespace math { /** * Class ArrayDataNormOpsReal provides a set of common norm operations * that may be applied to arrays of real data values (either float or double) - * maintained as pdat::ArrayData objects. The intent of this class + * maintained as pdat::ArrayData objects. The intent of this class * is to provide a single implementation of these operations as they are needed * by objects that perform these operations on the standard array-based patch * data types (i.e., cell-centered, face-centered, node-centered). Each of @@ -32,7 +32,7 @@ namespace math { * vector kernels where the data resides over multiple levels in an AMR * hierarchy. Note also that each operation will be performed on the * intersection of the box in the function argument list and the boxes - * associated with all pdat::ArrayData objects. + * associated with all pdat::ArrayData objects. * * These operations typically apply only to the numerical standard built-in * types, such as double, float, and the complex type (which may or may not @@ -57,6 +57,8 @@ class ArrayDataNormOpsReal /** * Return sum of entries in control volume array. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double sumControlVolumes( @@ -67,6 +69,9 @@ class ArrayDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre (dst.getDim() == src.getDim()) && (dst.getDim() == box.getDim()) + * @pre dst.getDepth() == src.getDepth() */ void abs( @@ -78,6 +83,8 @@ class ArrayDataNormOpsReal * Return discrete \f$L_1\f$-norm of the data using the control volume to * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double L1NormWithControlVolume( @@ -88,6 +95,8 @@ class ArrayDataNormOpsReal /** * Return discrete \f$L_1\f$-norm of the data. That is, the return value is * the sum \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data.getDim() == box.getDim() */ double L1Norm( @@ -98,6 +107,8 @@ class ArrayDataNormOpsReal * Return discrete \f$L_2\f$-norm of the data using the control volume to * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double L2NormWithControlVolume( @@ -109,6 +120,8 @@ class ArrayDataNormOpsReal * Return discrete \f$L_2\f$-norm of the data using the control volume to * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data.getDim() == box.getDim() */ double L2Norm( @@ -120,6 +133,10 @@ class ArrayDataNormOpsReal * volume to weight the contribution of the data and weight entries to * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. + * + * @pre (data.getDim() == weight.getDim()) && + * (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) + * @pre data.getDepth() == weight.getDepth() */ double weightedL2NormWithControlVolume( @@ -131,6 +148,10 @@ class ArrayDataNormOpsReal /** * Return discrete weighted \f$L_2\f$-norm of the data. That is, the return * value is the sum \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre (data.getDim() == weight.getDim()) && + * (data.getDim() == box.getDim()) + * @pre data.getDepth() == weight.getDepth() */ double weightedL2Norm( @@ -143,6 +164,8 @@ class ArrayDataNormOpsReal * the contribution of each data entry to the maximum. That is, the return * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. + * + * @pre (data.getDim() == cvol.getDim()) && (data.getDim() == box.getDim()) */ double maxNormWithControlVolume( @@ -153,6 +176,8 @@ class ArrayDataNormOpsReal /** * Return the \f$\max\f$-norm of the data. That is, the return value is * \f$\max_i ( \| data_i \| )\f$. + * + * @pre data.getDim() == box.getDim() */ double maxNorm( @@ -163,6 +188,11 @@ class ArrayDataNormOpsReal * Return the dot product of the two data arrays using the control volume * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. + * + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == cvol.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth == data2.getDepth() */ TYPE dotWithControlVolume( @@ -174,6 +204,10 @@ class ArrayDataNormOpsReal /** * Return the dot product of the two data arrays. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i )\f$. + * + * @pre (data1.getDim() == data2.getDim()) && + * (data1.getDim() == box.getDim()) + * @pre data1.getDepth == data2.getDepth() */ TYPE dot( @@ -184,6 +218,8 @@ class ArrayDataNormOpsReal /** * Return the integral of the function based on the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre (data.getDim() == vol.getDim()) && (data.getDim() == box.getDim()) */ TYPE integral( @@ -194,10 +230,10 @@ class ArrayDataNormOpsReal private: // The following are not implemented: ArrayDataNormOpsReal( - const ArrayDataNormOpsReal&); - void + const ArrayDataNormOpsReal&); + ArrayDataNormOpsReal& operator = ( - const ArrayDataNormOpsReal&); + const ArrayDataNormOpsReal&); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.C index b850f17b..31e1104d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex cell data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyCellDataOpsComplex_C -#define included_math_HierarchyCellDataOpsComplex_C - #include "SAMRAI/math/HierarchyCellDataOpsComplex.h" #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/pdat/CellDataFactory.h" @@ -105,7 +101,7 @@ HierarchyCellDataOpsComplex::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -113,13 +109,14 @@ HierarchyCellDataOpsComplex::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -135,12 +132,12 @@ HierarchyCellDataOpsComplex::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -151,7 +148,7 @@ HierarchyCellDataOpsComplex::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -179,7 +176,7 @@ HierarchyCellDataOpsComplex::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -188,8 +185,8 @@ HierarchyCellDataOpsComplex::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -211,7 +208,7 @@ HierarchyCellDataOpsComplex::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -219,8 +216,8 @@ HierarchyCellDataOpsComplex::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -251,7 +248,7 @@ HierarchyCellDataOpsComplex::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -259,13 +256,14 @@ HierarchyCellDataOpsComplex::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -286,7 +284,7 @@ HierarchyCellDataOpsComplex::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -294,13 +292,14 @@ HierarchyCellDataOpsComplex::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -321,7 +320,7 @@ HierarchyCellDataOpsComplex::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -329,16 +328,18 @@ HierarchyCellDataOpsComplex::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -359,7 +360,7 @@ HierarchyCellDataOpsComplex::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -367,16 +368,18 @@ HierarchyCellDataOpsComplex::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -397,7 +400,7 @@ HierarchyCellDataOpsComplex::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -405,16 +408,18 @@ HierarchyCellDataOpsComplex::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -435,7 +440,7 @@ HierarchyCellDataOpsComplex::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -443,16 +448,18 @@ HierarchyCellDataOpsComplex::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -472,7 +479,7 @@ HierarchyCellDataOpsComplex::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -480,13 +487,14 @@ HierarchyCellDataOpsComplex::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -509,7 +517,7 @@ HierarchyCellDataOpsComplex::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -517,16 +525,18 @@ HierarchyCellDataOpsComplex::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -548,7 +558,7 @@ HierarchyCellDataOpsComplex::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -556,16 +566,18 @@ HierarchyCellDataOpsComplex::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -587,7 +599,7 @@ HierarchyCellDataOpsComplex::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -595,16 +607,18 @@ HierarchyCellDataOpsComplex::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -624,7 +638,7 @@ HierarchyCellDataOpsComplex::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -632,13 +646,14 @@ HierarchyCellDataOpsComplex::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -659,7 +674,7 @@ HierarchyCellDataOpsComplex::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -667,8 +682,8 @@ HierarchyCellDataOpsComplex::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -687,7 +702,7 @@ HierarchyCellDataOpsComplex::setRandomValues( ************************************************************************* */ -int +size_t HierarchyCellDataOpsComplex::numberOfEntries( const int data_id, const bool interior_only) const @@ -699,9 +714,9 @@ HierarchyCellDataOpsComplex::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -709,8 +724,8 @@ HierarchyCellDataOpsComplex::numberOfEntries( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -722,9 +737,9 @@ HierarchyCellDataOpsComplex::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } return global_entries; } @@ -744,7 +759,7 @@ HierarchyCellDataOpsComplex::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -752,12 +767,13 @@ HierarchyCellDataOpsComplex::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(d); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -787,7 +803,7 @@ HierarchyCellDataOpsComplex::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -795,22 +811,22 @@ HierarchyCellDataOpsComplex::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -849,7 +865,7 @@ HierarchyCellDataOpsComplex::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -857,25 +873,26 @@ HierarchyCellDataOpsComplex::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -933,7 +950,7 @@ HierarchyCellDataOpsComplex::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -941,22 +958,22 @@ HierarchyCellDataOpsComplex::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -984,7 +1001,7 @@ HierarchyCellDataOpsComplex::dot( dcomplex dprod = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -992,34 +1009,46 @@ HierarchyCellDataOpsComplex::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } - dcomplex global_dot = dprod; if (mpi.getSize() > 1) { - mpi.Allreduce(&dprod, &global_dot, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = dprod.real(); + double imag_part = dprod.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_dot(global_real_part, global_imag_part); + return global_dot; + } else { + return dprod; } - return global_dot; } dcomplex @@ -1036,7 +1065,7 @@ HierarchyCellDataOpsComplex::integral( dcomplex local_integral = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1044,11 +1073,11 @@ HierarchyCellDataOpsComplex::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1059,13 +1088,23 @@ HierarchyCellDataOpsComplex::integral( } } - dcomplex global_integral = local_integral; if (mpi.getSize() > 1) { - mpi.Allreduce(&local_integral, &global_integral, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = local_integral.real(); + double imag_part = local_integral.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_integral(global_real_part, global_imag_part); + return global_integral; + } else { + return local_integral; } - return global_integral; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.h index 5aee865a..ffcb9693 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex cell data on multiple levels. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyCellDataOpsReal and HierarchyCellDataOpsInteger, * respectively. * - * @see math::PatchCellDataOpsComplex + * @see PatchCellDataOpsComplex */ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex @@ -68,6 +68,8 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyCellDataOpsComplex( const boost::shared_ptr& hierarchy, @@ -81,6 +83,8 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -88,7 +92,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * The levels must exist in the hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -103,6 +110,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -112,6 +123,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -120,6 +135,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -129,6 +148,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -138,6 +161,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -148,6 +175,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -158,6 +189,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -169,6 +204,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -179,6 +218,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -190,6 +233,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -201,6 +248,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -212,6 +263,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -226,6 +281,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -239,6 +298,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +315,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * Set destination data to absolute value of source data, pointwise. * Note that the source data must be dcomplex and the destination must * be double. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -263,6 +330,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -277,17 +348,26 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * elements will be summed over patch interiors. If the boolean argument * is false, all elements will be counted (including ghost values) * over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -300,6 +380,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is undefined (vol_id < 0), the * return value is \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -326,6 +410,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is undefined (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -365,6 +453,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * over the data elements where \f$cvol_i > 0\f$. If the control volume is * undefined (vol_id < 0), it is ignored during the computation of the * maximum. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -377,6 +469,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex dot( @@ -387,6 +483,10 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex integral( @@ -397,7 +497,7 @@ class HierarchyCellDataOpsComplex:public HierarchyDataOpsComplex // The following are not implemented HierarchyCellDataOpsComplex( const HierarchyCellDataOpsComplex&); - void + HierarchyCellDataOpsComplex& operator = ( const HierarchyCellDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.C index 6f2298ce..57f6c6f6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer cell data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyCellDataOpsInteger_C -#define included_math_HierarchyCellDataOpsInteger_C - #include "SAMRAI/math/HierarchyCellDataOpsInteger.h" #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/pdat/CellDataFactory.h" @@ -95,7 +91,7 @@ HierarchyCellDataOpsInteger::getPatchHierarchy() const ************************************************************************* */ -int +size_t HierarchyCellDataOpsInteger::numberOfEntries( const int data_id, const bool interior_only) const @@ -107,9 +103,9 @@ HierarchyCellDataOpsInteger::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -117,8 +113,8 @@ HierarchyCellDataOpsInteger::numberOfEntries( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -130,9 +126,9 @@ HierarchyCellDataOpsInteger::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } return global_entries; } @@ -148,7 +144,7 @@ HierarchyCellDataOpsInteger::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -156,13 +152,14 @@ HierarchyCellDataOpsInteger::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -178,12 +175,12 @@ HierarchyCellDataOpsInteger::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -194,7 +191,7 @@ HierarchyCellDataOpsInteger::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -222,7 +219,7 @@ HierarchyCellDataOpsInteger::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -231,8 +228,8 @@ HierarchyCellDataOpsInteger::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -254,7 +251,7 @@ HierarchyCellDataOpsInteger::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -262,8 +259,8 @@ HierarchyCellDataOpsInteger::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -294,7 +291,7 @@ HierarchyCellDataOpsInteger::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -302,13 +299,14 @@ HierarchyCellDataOpsInteger::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -329,7 +327,7 @@ HierarchyCellDataOpsInteger::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -337,13 +335,14 @@ HierarchyCellDataOpsInteger::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -364,7 +363,7 @@ HierarchyCellDataOpsInteger::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -372,16 +371,18 @@ HierarchyCellDataOpsInteger::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -402,7 +403,7 @@ HierarchyCellDataOpsInteger::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -410,16 +411,18 @@ HierarchyCellDataOpsInteger::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -440,7 +443,7 @@ HierarchyCellDataOpsInteger::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -448,16 +451,18 @@ HierarchyCellDataOpsInteger::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -478,7 +483,7 @@ HierarchyCellDataOpsInteger::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -486,16 +491,18 @@ HierarchyCellDataOpsInteger::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -515,7 +522,7 @@ HierarchyCellDataOpsInteger::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -523,13 +530,14 @@ HierarchyCellDataOpsInteger::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -552,7 +560,7 @@ HierarchyCellDataOpsInteger::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -560,16 +568,18 @@ HierarchyCellDataOpsInteger::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -591,7 +601,7 @@ HierarchyCellDataOpsInteger::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -599,16 +609,18 @@ HierarchyCellDataOpsInteger::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -630,7 +642,7 @@ HierarchyCellDataOpsInteger::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -638,16 +650,18 @@ HierarchyCellDataOpsInteger::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -667,7 +681,7 @@ HierarchyCellDataOpsInteger::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -675,13 +689,14 @@ HierarchyCellDataOpsInteger::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -704,7 +719,7 @@ HierarchyCellDataOpsInteger::min( int minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -712,8 +727,8 @@ HierarchyCellDataOpsInteger::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -745,7 +760,7 @@ HierarchyCellDataOpsInteger::max( int maxval = -(tbox::MathUtilities::getMax()); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -753,8 +768,8 @@ HierarchyCellDataOpsInteger::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -784,7 +799,7 @@ HierarchyCellDataOpsInteger::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -792,8 +807,8 @@ HierarchyCellDataOpsInteger::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -806,4 +821,3 @@ HierarchyCellDataOpsInteger::setRandomValues( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.h index ff3b8722..238d5fa0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer cell data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -51,7 +51,7 @@ namespace math { * HierarchyCellDataOpsReal and HierarchyCellDataOpsComplex, * respectively. * - * @see math::PatchCellDataOpsInteger + * @see PatchCellDataOpsInteger */ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger @@ -67,6 +67,8 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyCellDataOpsInteger( const boost::shared_ptr& hierarchy, @@ -80,6 +82,8 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -87,7 +91,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * The levels must exist in the hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -106,14 +113,22 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * elements will be summed over patch interiors. If the boolean argument * is false, all elements will be counted (including ghost values) * over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -123,6 +138,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -131,6 +150,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -140,6 +163,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -149,6 +176,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -159,6 +190,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -169,6 +204,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -180,6 +219,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -190,6 +233,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -201,6 +248,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -212,6 +263,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -223,6 +278,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -237,6 +296,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -250,6 +313,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -261,6 +328,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -270,6 +341,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int min( @@ -278,6 +353,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int max( @@ -288,6 +367,10 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -300,7 +383,7 @@ class HierarchyCellDataOpsInteger:public HierarchyDataOpsInteger // The following are not implemented HierarchyCellDataOpsInteger( const HierarchyCellDataOpsInteger&); - void + HierarchyCellDataOpsInteger& operator = ( const HierarchyCellDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.C index 000eb071..95a90978 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real cell data on multiple levels. * ************************************************************************/ @@ -92,32 +92,6 @@ HierarchyCellDataOpsReal::getPatchHierarchy() const return d_hierarchy; } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchyCellDataOpsReal::HierarchyCellDataOpsReal( - const HierarchyCellDataOpsReal& foo): - HierarchyDataOpsReal() -{ - NULL_USE(foo); -} - -template -void -HierarchyCellDataOpsReal::operator = ( - const HierarchyCellDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -138,7 +112,7 @@ HierarchyCellDataOpsReal::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -146,13 +120,14 @@ HierarchyCellDataOpsReal::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -169,12 +144,12 @@ HierarchyCellDataOpsReal::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -185,7 +160,7 @@ HierarchyCellDataOpsReal::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -214,7 +189,7 @@ HierarchyCellDataOpsReal::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -223,8 +198,8 @@ HierarchyCellDataOpsReal::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -247,7 +222,7 @@ HierarchyCellDataOpsReal::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -255,8 +230,8 @@ HierarchyCellDataOpsReal::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -288,7 +263,7 @@ HierarchyCellDataOpsReal::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -296,13 +271,14 @@ HierarchyCellDataOpsReal::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -324,7 +300,7 @@ HierarchyCellDataOpsReal::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -332,13 +308,14 @@ HierarchyCellDataOpsReal::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -360,7 +337,7 @@ HierarchyCellDataOpsReal::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -368,16 +345,18 @@ HierarchyCellDataOpsReal::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -399,7 +378,7 @@ HierarchyCellDataOpsReal::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -407,16 +386,18 @@ HierarchyCellDataOpsReal::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -438,7 +419,7 @@ HierarchyCellDataOpsReal::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -446,16 +427,18 @@ HierarchyCellDataOpsReal::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -477,7 +460,7 @@ HierarchyCellDataOpsReal::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -485,16 +468,18 @@ HierarchyCellDataOpsReal::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -515,7 +500,7 @@ HierarchyCellDataOpsReal::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -523,13 +508,14 @@ HierarchyCellDataOpsReal::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -553,7 +539,7 @@ HierarchyCellDataOpsReal::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -561,16 +547,18 @@ HierarchyCellDataOpsReal::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -593,7 +581,7 @@ HierarchyCellDataOpsReal::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -601,16 +589,18 @@ HierarchyCellDataOpsReal::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -633,7 +623,7 @@ HierarchyCellDataOpsReal::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -641,16 +631,18 @@ HierarchyCellDataOpsReal::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -671,7 +663,7 @@ HierarchyCellDataOpsReal::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -679,13 +671,14 @@ HierarchyCellDataOpsReal::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -707,7 +700,7 @@ HierarchyCellDataOpsReal::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -715,8 +708,8 @@ HierarchyCellDataOpsReal::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(data); @@ -736,7 +729,7 @@ HierarchyCellDataOpsReal::setRandomValues( */ template -int +size_t HierarchyCellDataOpsReal::numberOfEntries( const int data_id, const bool interior_only) const @@ -748,9 +741,9 @@ HierarchyCellDataOpsReal::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -758,8 +751,8 @@ HierarchyCellDataOpsReal::numberOfEntries( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -771,9 +764,9 @@ HierarchyCellDataOpsReal::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } return global_entries; } @@ -794,7 +787,7 @@ HierarchyCellDataOpsReal::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -802,12 +795,13 @@ HierarchyCellDataOpsReal::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(data); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -839,7 +833,7 @@ HierarchyCellDataOpsReal::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -847,22 +841,22 @@ HierarchyCellDataOpsReal::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(data, box, cv); } } @@ -908,7 +902,7 @@ HierarchyCellDataOpsReal::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -916,25 +910,26 @@ HierarchyCellDataOpsReal::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > weight( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + TBOX_ASSERT(weight); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(data, weight, box, cv); norm_squared += pnorm * pnorm; @@ -996,7 +991,7 @@ HierarchyCellDataOpsReal::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1004,22 +999,22 @@ HierarchyCellDataOpsReal::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(data, box, cv)); } @@ -1052,7 +1047,7 @@ HierarchyCellDataOpsReal::dot( TYPE dprod = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1060,25 +1055,26 @@ HierarchyCellDataOpsReal::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(data1, data2, box, cv); } } @@ -1106,7 +1102,7 @@ HierarchyCellDataOpsReal::integral( TYPE local_integral = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1114,11 +1110,11 @@ HierarchyCellDataOpsReal::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1160,7 +1156,7 @@ HierarchyCellDataOpsReal::computeConstrProdPos( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1168,25 +1164,26 @@ HierarchyCellDataOpsReal::computeConstrProdPos( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min( test, d_patch_ops.computeConstrProdPos(data1, data2, box, cv)); @@ -1213,7 +1210,7 @@ HierarchyCellDataOpsReal::compareToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1221,25 +1218,26 @@ HierarchyCellDataOpsReal::compareToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); d_patch_ops.compareToScalar(dst, src, alpha, box, cv); } } @@ -1261,7 +1259,7 @@ HierarchyCellDataOpsReal::testReciprocal( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1269,25 +1267,26 @@ HierarchyCellDataOpsReal::testReciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min( test, d_patch_ops.testReciprocal(dst, src, box, cv)); @@ -1317,7 +1316,7 @@ HierarchyCellDataOpsReal::maxPointwiseDivide( TYPE max = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1325,11 +1324,14 @@ HierarchyCellDataOpsReal::maxPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1362,7 +1364,7 @@ HierarchyCellDataOpsReal::minPointwiseDivide( TYPE min = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1370,11 +1372,14 @@ HierarchyCellDataOpsReal::minPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1406,7 +1411,7 @@ HierarchyCellDataOpsReal::min( TYPE minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1414,8 +1419,8 @@ HierarchyCellDataOpsReal::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -1447,7 +1452,7 @@ HierarchyCellDataOpsReal::max( TYPE maxval = -tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1455,8 +1460,8 @@ HierarchyCellDataOpsReal::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.h index b5a2a42e..c8c3a5bf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyCellDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real cell data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyCellDataOpsComplex and HierarchyCellDataOpsInteger, * respectively. * - * @see math::PatchCellDataOpsReal + * @see PatchCellDataOpsReal */ template @@ -69,6 +69,8 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyCellDataOpsReal( const boost::shared_ptr& hierarchy, @@ -82,6 +84,8 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -89,7 +93,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * The levels must exist in the hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -104,6 +111,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -113,6 +124,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -121,6 +136,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -130,6 +149,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -139,6 +162,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -149,6 +176,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -159,6 +190,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -170,6 +205,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -180,6 +219,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -191,6 +234,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -202,6 +249,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -213,6 +264,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -227,6 +282,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -240,6 +299,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -251,6 +314,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -260,6 +327,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE min( @@ -268,6 +339,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE max( @@ -278,6 +353,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * Set data entries to random values. See the operations in the * array data operation classes for each data type for details on the * generation of the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -292,17 +371,26 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * elements will be summed over patch interiors. If the boolean argument * is false, all elements will be counted (including ghost values) * over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >=0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -317,6 +405,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * \f$\sum_i ( \| data_i \| )\f$. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -346,6 +438,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is not defined * (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -386,6 +482,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * (vol_id < 0), it is ignored during the computation of the maximum. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -400,6 +500,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE dot( @@ -411,6 +515,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE integral( @@ -422,6 +530,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * any \f$i\f$ in the set of patch data indices, where \f$cvol_i > 0\f$. Otherwise, * return 0. If the control volume is undefined (vol_id < 0), all values * on the patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int computeConstrProdPos( @@ -434,6 +546,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is undefined (vol_id < 0), all values on the patch interiors * are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void compareToScalar( @@ -448,6 +564,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. * If the control volume is undefined (vol_id < 0), all values on the * patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int testReciprocal( @@ -467,6 +587,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE maxPointwiseDivide( @@ -487,6 +611,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE minPointwiseDivide( @@ -497,10 +625,10 @@ class HierarchyCellDataOpsReal:public HierarchyDataOpsReal private: // The following are not implemented HierarchyCellDataOpsReal( - const HierarchyCellDataOpsReal&); - void + const HierarchyCellDataOpsReal&); + HierarchyCellDataOpsReal& operator = ( - const HierarchyCellDataOpsReal&); + const HierarchyCellDataOpsReal&); boost::shared_ptr d_hierarchy; int d_coarsest_level; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.C index 93df2354..57a3d5fd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to operations for complex data on hierarchy. * ************************************************************************/ - -#ifndef included_math_HierarchyDataOpsComplex_C -#define included_math_HierarchyDataOpsComplex_C - #include "SAMRAI/math/HierarchyDataOpsComplex.h" namespace SAMRAI { @@ -26,4 +22,3 @@ HierarchyDataOpsComplex::~HierarchyDataOpsComplex() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.h index 5669534d..a8c7c4b4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to operations for complex data on hierarchy. * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -66,7 +66,6 @@ class HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * Typically, levels must exist in hierarchy or an assertion will result. */ virtual void resetLevels( @@ -255,14 +254,14 @@ class HierarchyDataOpsComplex * is false, all elements will be counted (including ghost values) * over all patches. */ - virtual int + virtual size_t numberOfEntries( const int data_id, const bool interior_only = true) const = 0; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. */ @@ -365,7 +364,7 @@ class HierarchyDataOpsComplex // The following are not implemented HierarchyDataOpsComplex( const HierarchyDataOpsComplex&); - void + HierarchyDataOpsComplex& operator = ( const HierarchyDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.C index 9dad7033..01e690f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to operations for integer data on hierarchy. * ************************************************************************/ - -#ifndef included_math_HierarchyDataOpsInteger_C -#define included_math_HierarchyDataOpsInteger_C - #include "SAMRAI/math/HierarchyDataOpsInteger.h" namespace SAMRAI { @@ -26,4 +22,3 @@ HierarchyDataOpsInteger::~HierarchyDataOpsInteger() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.h index e5f69375..e51de57f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to operations for integer data on hierarchy. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -66,7 +66,6 @@ class HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * Typically, levels must exist in hierarchy or an assertion will result. */ virtual void resetLevels( @@ -87,7 +86,7 @@ class HierarchyDataOpsInteger * is false, all elements will be counted (including ghost values) * over all patches. */ - virtual int + virtual size_t numberOfEntries( const int data_id, const bool interior_only = true) const = 0; @@ -280,7 +279,7 @@ class HierarchyDataOpsInteger // The following are not implemented HierarchyDataOpsInteger( const HierarchyDataOpsInteger&); - void + HierarchyDataOpsInteger& operator = ( const HierarchyDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.C index cbacab3b..576febbb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton manager for hierarchy data operation objects. * ************************************************************************/ - -#ifndef included_math_HierarchyDataOpsManager_C -#define included_math_HierarchyDataOpsManager_C - #include "SAMRAI/math/HierarchyDataOpsManager.h" #include "SAMRAI/math/HierarchyCellDataOpsReal.h" @@ -51,8 +47,7 @@ namespace math { */ HierarchyDataOpsManager * -HierarchyDataOpsManager::s_pdat_op_manager_instance = - ((HierarchyDataOpsManager *)NULL); +HierarchyDataOpsManager::s_pdat_op_manager_instance = 0; tbox::StartupShutdownManager::Handler HierarchyDataOpsManager::s_shutdown_handler( @@ -92,28 +87,28 @@ HierarchyDataOpsManager::~HierarchyDataOpsManager() boost::shared_ptr > HierarchyDataOpsManager::getOperationsDouble( const boost::shared_ptr& variable, - boost::shared_ptr& hierarchy, + const boost::shared_ptr& hierarchy, bool get_unique) { TBOX_ASSERT(variable); TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_ARGS2(*variable, *hierarchy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, *hierarchy); const boost::shared_ptr > cellvar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > facevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > nodevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > sidevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > edgevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); boost::shared_ptr > ops; @@ -122,7 +117,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (get_unique) { ops.reset(new HierarchyCellDataOpsReal(hierarchy)); } else { - const int n = d_cell_ops_double.getSize(); + const int n = static_cast(d_cell_ops_double.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_cell_ops_double[i]->getPatchHierarchy()) continue; @@ -132,7 +127,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyCellDataOpsReal(hierarchy)); - d_cell_ops_double.resizeArray(n + 1); + d_cell_ops_double.resize(n + 1); d_cell_ops_double[n] = ops; } } @@ -142,7 +137,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (get_unique) { ops.reset(new HierarchyFaceDataOpsReal(hierarchy)); } else { - const int n = d_face_ops_double.getSize(); + const int n = static_cast(d_face_ops_double.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_face_ops_double[i]->getPatchHierarchy()) continue; @@ -152,7 +147,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyFaceDataOpsReal(hierarchy)); - d_face_ops_double.resizeArray(n + 1); + d_face_ops_double.resize(n + 1); d_face_ops_double[n] = ops; } } @@ -162,7 +157,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (get_unique) { ops.reset(new HierarchyNodeDataOpsReal(hierarchy)); } else { - const int n = d_node_ops_double.getSize(); + const int n = static_cast(d_node_ops_double.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_node_ops_double[i]->getPatchHierarchy()) continue; @@ -172,7 +167,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyNodeDataOpsReal(hierarchy)); - d_node_ops_double.resizeArray(n + 1); + d_node_ops_double.resize(n + 1); d_node_ops_double[n] = ops; } } @@ -182,7 +177,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (get_unique) { ops.reset(new HierarchySideDataOpsReal(hierarchy)); } else { - const int n = d_side_ops_double.getSize(); + const int n = static_cast(d_side_ops_double.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_side_ops_double[i]->getPatchHierarchy()) continue; @@ -192,7 +187,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchySideDataOpsReal(hierarchy)); - d_side_ops_double.resizeArray(n + 1); + d_side_ops_double.resize(n + 1); d_side_ops_double[n] = ops; } } @@ -202,7 +197,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (get_unique) { ops.reset(new HierarchyEdgeDataOpsReal(hierarchy)); } else { - const int n = d_edge_ops_double.getSize(); + const int n = static_cast(d_edge_ops_double.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_edge_ops_double[i]->getPatchHierarchy()) continue; @@ -212,7 +207,7 @@ HierarchyDataOpsManager::getOperationsDouble( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyEdgeDataOpsReal(hierarchy)); - d_edge_ops_double.resizeArray(n + 1); + d_edge_ops_double.resize(n + 1); d_edge_ops_double[n] = ops; } } @@ -242,28 +237,28 @@ HierarchyDataOpsManager::getOperationsDouble( boost::shared_ptr > HierarchyDataOpsManager::getOperationsFloat( const boost::shared_ptr& variable, - boost::shared_ptr& hierarchy, + const boost::shared_ptr& hierarchy, bool get_unique) { TBOX_ASSERT(variable); TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_ARGS2(*variable, *hierarchy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, *hierarchy); const boost::shared_ptr > cellvar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > facevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > nodevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > sidevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > edgevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); boost::shared_ptr > ops; @@ -272,7 +267,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (get_unique) { ops.reset(new HierarchyCellDataOpsReal(hierarchy)); } else { - const int n = d_cell_ops_float.getSize(); + const int n = static_cast(d_cell_ops_float.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_cell_ops_float[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -281,7 +276,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyCellDataOpsReal(hierarchy)); - d_cell_ops_float.resizeArray(n + 1); + d_cell_ops_float.resize(n + 1); d_cell_ops_float[n] = ops; } } @@ -291,7 +286,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (get_unique) { ops.reset(new HierarchyFaceDataOpsReal(hierarchy)); } else { - const int n = d_face_ops_float.getSize(); + const int n = static_cast(d_face_ops_float.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_face_ops_float[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -300,7 +295,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyFaceDataOpsReal(hierarchy)); - d_face_ops_float.resizeArray(n + 1); + d_face_ops_float.resize(n + 1); d_face_ops_float[n] = ops; } } @@ -310,7 +305,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (get_unique) { ops.reset(new HierarchyNodeDataOpsReal(hierarchy)); } else { - const int n = d_node_ops_float.getSize(); + const int n = static_cast(d_node_ops_float.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_node_ops_float[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -319,7 +314,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyNodeDataOpsReal(hierarchy)); - d_node_ops_float.resizeArray(n + 1); + d_node_ops_float.resize(n + 1); d_node_ops_float[n] = ops; } } @@ -329,7 +324,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (get_unique) { ops.reset(new HierarchySideDataOpsReal(hierarchy)); } else { - const int n = d_side_ops_float.getSize(); + const int n = static_cast(d_side_ops_float.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_side_ops_float[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -338,7 +333,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchySideDataOpsReal(hierarchy)); - d_side_ops_float.resizeArray(n + 1); + d_side_ops_float.resize(n + 1); d_side_ops_float[n] = ops; } } @@ -348,7 +343,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (get_unique) { ops.reset(new HierarchyEdgeDataOpsReal(hierarchy)); } else { - const int n = d_edge_ops_float.getSize(); + const int n = static_cast(d_edge_ops_float.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_edge_ops_float[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -357,7 +352,7 @@ HierarchyDataOpsManager::getOperationsFloat( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyEdgeDataOpsReal(hierarchy)); - d_edge_ops_float.resizeArray(n + 1); + d_edge_ops_float.resize(n + 1); d_edge_ops_float[n] = ops; } } @@ -387,28 +382,28 @@ HierarchyDataOpsManager::getOperationsFloat( boost::shared_ptr HierarchyDataOpsManager::getOperationsComplex( const boost::shared_ptr& variable, - boost::shared_ptr& hierarchy, + const boost::shared_ptr& hierarchy, bool get_unique) { TBOX_ASSERT(variable); TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_ARGS2(*variable, *hierarchy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, *hierarchy); const boost::shared_ptr > cellvar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > facevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > nodevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > sidevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > edgevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); boost::shared_ptr ops; @@ -417,7 +412,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (get_unique) { ops.reset(new HierarchyCellDataOpsComplex(hierarchy)); } else { - const int n = d_cell_ops_double.getSize(); + const int n = static_cast(d_cell_ops_complex.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_cell_ops_complex[i]->getPatchHierarchy()) continue; @@ -427,7 +422,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyCellDataOpsComplex(hierarchy)); - d_cell_ops_complex.resizeArray(n + 1); + d_cell_ops_complex.resize(n + 1); d_cell_ops_complex[n] = ops; } } @@ -437,7 +432,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (get_unique) { ops.reset(new HierarchyFaceDataOpsComplex(hierarchy)); } else { - const int n = d_face_ops_complex.getSize(); + const int n = static_cast(d_face_ops_complex.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_face_ops_complex[i]->getPatchHierarchy()) continue; @@ -447,7 +442,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyFaceDataOpsComplex(hierarchy)); - d_face_ops_complex.resizeArray(n + 1); + d_face_ops_complex.resize(n + 1); d_face_ops_complex[n] = ops; } } @@ -457,7 +452,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (get_unique) { ops.reset(new HierarchyNodeDataOpsComplex(hierarchy)); } else { - const int n = d_node_ops_complex.getSize(); + const int n = static_cast(d_node_ops_complex.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_node_ops_complex[i]->getPatchHierarchy()) continue; @@ -467,7 +462,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyNodeDataOpsComplex(hierarchy)); - d_node_ops_complex.resizeArray(n + 1); + d_node_ops_complex.resize(n + 1); d_node_ops_complex[n] = ops; } } @@ -477,7 +472,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (get_unique) { ops.reset(new HierarchySideDataOpsComplex(hierarchy)); } else { - const int n = d_side_ops_complex.getSize(); + const int n = static_cast(d_side_ops_complex.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_side_ops_complex[i]->getPatchHierarchy()) continue; @@ -487,7 +482,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchySideDataOpsComplex(hierarchy)); - d_side_ops_complex.resizeArray(n + 1); + d_side_ops_complex.resize(n + 1); d_side_ops_complex[n] = ops; } } @@ -497,7 +492,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (get_unique) { ops.reset(new HierarchyEdgeDataOpsComplex(hierarchy)); } else { - const int n = d_edge_ops_complex.getSize(); + const int n = static_cast(d_edge_ops_complex.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_edge_ops_complex[i]->getPatchHierarchy()) continue; @@ -507,7 +502,7 @@ HierarchyDataOpsManager::getOperationsComplex( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyEdgeDataOpsComplex(hierarchy)); - d_edge_ops_complex.resizeArray(n + 1); + d_edge_ops_complex.resize(n + 1); d_edge_ops_complex[n] = ops; } } @@ -537,28 +532,28 @@ HierarchyDataOpsManager::getOperationsComplex( boost::shared_ptr HierarchyDataOpsManager::getOperationsInteger( const boost::shared_ptr& variable, - boost::shared_ptr& hierarchy, + const boost::shared_ptr& hierarchy, bool get_unique) { TBOX_ASSERT(variable); TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_ARGS2(*variable, *hierarchy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, *hierarchy); const boost::shared_ptr > cellvar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > facevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > nodevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > sidevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); const boost::shared_ptr > edgevar( - variable, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::Variable>(variable)); boost::shared_ptr ops; @@ -567,7 +562,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (get_unique) { ops.reset(new HierarchyCellDataOpsInteger(hierarchy)); } else { - const int n = d_cell_ops_int.getSize(); + const int n = static_cast(d_cell_ops_int.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_cell_ops_int[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -576,7 +571,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyCellDataOpsInteger(hierarchy)); - d_cell_ops_int.resizeArray(n + 1); + d_cell_ops_int.resize(n + 1); d_cell_ops_int[n] = ops; } } @@ -586,7 +581,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (get_unique) { ops.reset(new HierarchyFaceDataOpsInteger(hierarchy)); } else { - const int n = d_face_ops_int.getSize(); + const int n = static_cast(d_face_ops_int.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_face_ops_int[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -595,7 +590,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyFaceDataOpsInteger(hierarchy)); - d_face_ops_int.resizeArray(n + 1); + d_face_ops_int.resize(n + 1); d_face_ops_int[n] = ops; } } @@ -605,7 +600,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (get_unique) { ops.reset(new HierarchyNodeDataOpsInteger(hierarchy)); } else { - const int n = d_node_ops_int.getSize(); + const int n = static_cast(d_node_ops_int.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_node_ops_int[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -614,7 +609,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyNodeDataOpsInteger(hierarchy)); - d_node_ops_int.resizeArray(n + 1); + d_node_ops_int.resize(n + 1); d_node_ops_int[n] = ops; } } @@ -624,7 +619,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (get_unique) { ops.reset(new HierarchySideDataOpsInteger(hierarchy)); } else { - const int n = d_side_ops_int.getSize(); + const int n = static_cast(d_side_ops_int.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_side_ops_int[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -633,7 +628,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchySideDataOpsInteger(hierarchy)); - d_side_ops_int.resizeArray(n + 1); + d_side_ops_int.resize(n + 1); d_side_ops_int[n] = ops; } } @@ -643,7 +638,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (get_unique) { ops.reset(new HierarchyEdgeDataOpsInteger(hierarchy)); } else { - const int n = d_edge_ops_int.getSize(); + const int n = static_cast(d_edge_ops_int.size()); for (int i = 0; i < n && !ops; ++i) { if (hierarchy != d_edge_ops_int[i]->getPatchHierarchy()) continue; // A compatible operator has been found at i. @@ -652,7 +647,7 @@ HierarchyDataOpsManager::getOperationsInteger( if (!ops) { // No compatible operator has been found. ops.reset(new HierarchyEdgeDataOpsInteger(hierarchy)); - d_edge_ops_int.resizeArray(n + 1); + d_edge_ops_int.resize(n + 1); d_edge_ops_int[n] = ops; } } @@ -670,4 +665,3 @@ HierarchyDataOpsManager::getOperationsInteger( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.h index 789d632b..3a400726 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton manager for hierarchy data operation objects. * ************************************************************************/ @@ -17,10 +17,10 @@ #include "SAMRAI/math/HierarchyDataOpsReal.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/Variable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" +#include namespace SAMRAI { namespace math { @@ -55,9 +55,9 @@ namespace math { * See the Design Patterns book by Gamma {\em et al.} for more information * about the singleton pattern. * - * @see math::HierarchyDataOpsComplex - * @see math::HierarchyDataOpsInteger - * @see math::HierarchyDataOpsReal + * @see HierarchyDataOpsComplex + * @see HierarchyDataOpsInteger + * @see HierarchyDataOpsReal */ class HierarchyDataOpsManager @@ -102,53 +102,73 @@ class HierarchyDataOpsManager /*! * \brief Return pointer to operation object for a double variable * on the given hierarchy. + * + * @pre variable + * @pre hierarchy + * @pre variable->getDim() == hierarchy.getDim() + * @post returned value not NULL */ virtual boost::shared_ptr > getOperationsDouble( /*! operation should correspond to this variable */ - const boost::shared_ptr& variable - , /*! operation should correspond to this hierarchy */ - boost::shared_ptr& hierarchy - , /*! Whether a unique operator is requested */ + const boost::shared_ptr& variable, + /*! operation should correspond to this hierarchy */ + const boost::shared_ptr& hierarchy, + /*! Whether a unique operator is requested */ bool get_unique = false); /*! * \brief Return pointer to operation object for a float variable * on the given hierarchy. + * + * @pre variable + * @pre hierarchy + * @pre variable->getDim() == hierarchy.getDim() + * @post returned value not NULL */ virtual boost::shared_ptr > getOperationsFloat( /*! operation should correspond to this variable */ - const boost::shared_ptr& variable - , /*! operation should correspond to this hierarchy */ - boost::shared_ptr& hierarchy - , /*! Whether a unique operator is requested */ + const boost::shared_ptr& variable, + /*! operation should correspond to this hierarchy */ + const boost::shared_ptr& hierarchy, + /*! Whether a unique operator is requested */ bool get_unique = false); /*! * \brief Return pointer to operation object for a complex variable * on the given hierarchy. + * + * @pre variable + * @pre hierarchy + * @pre variable->getDim() == hierarchy.getDim() + * @post returned value not NULL */ virtual boost::shared_ptr getOperationsComplex( /*! operation should correspond to this variable */ - const boost::shared_ptr& variable - , /*! operation should correspond to this hierarchy */ - boost::shared_ptr& hierarchy - , /*! Whether a unique operator is requested */ + const boost::shared_ptr& variable, + /*! operation should correspond to this hierarchy */ + const boost::shared_ptr& hierarchy, + /*! Whether a unique operator is requested */ bool get_unique = false); /*! * \brief Return pointer to operation object for a integer variable * on the given hierarchy. + * + * @pre variable + * @pre hierarchy + * @pre variable->getDim() == hierarchy.getDim() + * @post returned value not NULL */ virtual boost::shared_ptr getOperationsInteger( /*! operation should correspond to this variable */ - const boost::shared_ptr& variable - , /*! operation should correspond to this hierarchy */ - boost::shared_ptr& hierarchy - , /*! Whether a unique operator is requested */ + const boost::shared_ptr& variable, + /*! operation should correspond to this hierarchy */ + const boost::shared_ptr& hierarchy, + /*! Whether a unique operator is requested */ bool get_unique = false); //@} @@ -170,6 +190,8 @@ class HierarchyDataOpsManager * Initialize Singleton instance with instance of subclass. This function * is used to make the singleton object unique when inheriting from this * base class. + * + * @pre !s_pdat_op_manager_instance */ void registerSingletonSubclassInstance( @@ -196,54 +218,54 @@ class HierarchyDataOpsManager if (s_pdat_op_manager_instance) { delete s_pdat_op_manager_instance; } - s_pdat_op_manager_instance = ((HierarchyDataOpsManager *)NULL); + s_pdat_op_manager_instance = 0; } static HierarchyDataOpsManager* s_pdat_op_manager_instance; //@{ \name Operations for data of various types. - tbox::Array > > + std::vector > > d_cell_ops_double; - tbox::Array > > + std::vector > > d_face_ops_double; - tbox::Array > > + std::vector > > d_node_ops_double; - tbox::Array > > + std::vector > > d_side_ops_double; - tbox::Array > > + std::vector > > d_edge_ops_double; - tbox::Array > > + std::vector > > d_cell_ops_float; - tbox::Array > > + std::vector > > d_face_ops_float; - tbox::Array > > + std::vector > > d_side_ops_float; - tbox::Array > > + std::vector > > d_node_ops_float; - tbox::Array > > + std::vector > > d_edge_ops_float; - tbox::Array > + std::vector > d_cell_ops_complex; - tbox::Array > + std::vector > d_face_ops_complex; - tbox::Array > + std::vector > d_side_ops_complex; - tbox::Array > + std::vector > d_node_ops_complex; - tbox::Array > + std::vector > d_edge_ops_complex; - tbox::Array > + std::vector > d_cell_ops_int; - tbox::Array > + std::vector > d_face_ops_int; - tbox::Array > + std::vector > d_side_ops_int; - tbox::Array > + std::vector > d_node_ops_int; - tbox::Array > + std::vector > d_edge_ops_int; //@} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.C index ccb6dab9..6d55dcba 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to templated operations for real data on hierarchy. * ************************************************************************/ @@ -26,31 +26,6 @@ HierarchyDataOpsReal::~HierarchyDataOpsReal() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchyDataOpsReal::HierarchyDataOpsReal( - const HierarchyDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -HierarchyDataOpsReal::operator = ( - const HierarchyDataOpsReal& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.h index 5978d1af..e4a874fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to templated operations for real data on hierarchy. * ************************************************************************/ @@ -15,7 +15,7 @@ #include -#include +#include "boost/shared_ptr.hpp" #include "SAMRAI/hier/PatchHierarchy.h" namespace SAMRAI { @@ -68,7 +68,6 @@ class HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * Typically, levels must exist in hierarchy or an assertion will result. */ virtual void resetLevels( @@ -273,14 +272,14 @@ class HierarchyDataOpsReal * is false, all elements will be counted (including ghost values) * over all patches. */ - virtual int + virtual size_t numberOfEntries( const int data_id, const bool interior_only = true) const = 0; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. */ @@ -468,10 +467,10 @@ class HierarchyDataOpsReal private: // The following are not implemented HierarchyDataOpsReal( - const HierarchyDataOpsReal&); - void + const HierarchyDataOpsReal&); + HierarchyDataOpsReal& operator = ( - const HierarchyDataOpsReal&); + const HierarchyDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.C index 08a7c1cf..a65b4f74 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex edge data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyEdgeDataOpsComplex_C -#define included_math_HierarchyEdgeDataOpsComplex_C - #include "SAMRAI/math/HierarchyEdgeDataOpsComplex.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" @@ -83,18 +79,18 @@ HierarchyEdgeDataOpsComplex::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_edge_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_edge_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer edge_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (int nd = 0; nd < dimVal; ++nd) { edge_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(edge_boxes); + for (hier::BoxContainer::iterator i = edge_boxes.begin(); i != edge_boxes.end(); ++i) { *i = pdat::EdgeGeometry::toEdgeBox(*i, nd); } @@ -130,7 +126,7 @@ HierarchyEdgeDataOpsComplex::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -138,13 +134,14 @@ HierarchyEdgeDataOpsComplex::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -160,12 +157,12 @@ HierarchyEdgeDataOpsComplex::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -176,7 +173,7 @@ HierarchyEdgeDataOpsComplex::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -204,17 +201,17 @@ HierarchyEdgeDataOpsComplex::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; - boost::shared_ptr level( + boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -236,7 +233,7 @@ HierarchyEdgeDataOpsComplex::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -244,8 +241,8 @@ HierarchyEdgeDataOpsComplex::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -276,7 +273,7 @@ HierarchyEdgeDataOpsComplex::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -284,13 +281,14 @@ HierarchyEdgeDataOpsComplex::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -311,7 +309,7 @@ HierarchyEdgeDataOpsComplex::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -319,13 +317,14 @@ HierarchyEdgeDataOpsComplex::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -346,7 +345,7 @@ HierarchyEdgeDataOpsComplex::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -354,16 +353,18 @@ HierarchyEdgeDataOpsComplex::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -384,7 +385,7 @@ HierarchyEdgeDataOpsComplex::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -392,16 +393,18 @@ HierarchyEdgeDataOpsComplex::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -422,7 +425,7 @@ HierarchyEdgeDataOpsComplex::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -430,16 +433,18 @@ HierarchyEdgeDataOpsComplex::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -460,7 +465,7 @@ HierarchyEdgeDataOpsComplex::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -468,16 +473,18 @@ HierarchyEdgeDataOpsComplex::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -497,7 +504,7 @@ HierarchyEdgeDataOpsComplex::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -505,13 +512,14 @@ HierarchyEdgeDataOpsComplex::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -534,7 +542,7 @@ HierarchyEdgeDataOpsComplex::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -542,16 +550,18 @@ HierarchyEdgeDataOpsComplex::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -573,7 +583,7 @@ HierarchyEdgeDataOpsComplex::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -581,16 +591,18 @@ HierarchyEdgeDataOpsComplex::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -612,7 +624,7 @@ HierarchyEdgeDataOpsComplex::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -620,16 +632,18 @@ HierarchyEdgeDataOpsComplex::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -649,7 +663,7 @@ HierarchyEdgeDataOpsComplex::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -657,13 +671,14 @@ HierarchyEdgeDataOpsComplex::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -684,7 +699,7 @@ HierarchyEdgeDataOpsComplex::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -692,8 +707,8 @@ HierarchyEdgeDataOpsComplex::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -712,7 +727,7 @@ HierarchyEdgeDataOpsComplex::setRandomValues( ************************************************************************* */ -int +size_t HierarchyEdgeDataOpsComplex::numberOfEntries( const int data_id, const bool interior_only) const @@ -725,32 +740,32 @@ HierarchyEdgeDataOpsComplex::numberOfEntries( int dimVal = d_hierarchy->getDim().getValue(); const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; if (interior_only) { - boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > dfact( + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_edge_boxes[nd][ln].getSize()); + for (int nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_edge_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { - for (int eb = 0; eb < dimVal; eb++) { + for (int eb = 0; eb < dimVal; ++eb) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_edge_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_edge_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -761,14 +776,14 @@ HierarchyEdgeDataOpsComplex::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -776,9 +791,9 @@ HierarchyEdgeDataOpsComplex::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -802,7 +817,7 @@ HierarchyEdgeDataOpsComplex::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -810,12 +825,13 @@ HierarchyEdgeDataOpsComplex::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(d); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -845,7 +861,7 @@ HierarchyEdgeDataOpsComplex::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -853,22 +869,22 @@ HierarchyEdgeDataOpsComplex::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -907,7 +923,7 @@ HierarchyEdgeDataOpsComplex::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -915,25 +931,26 @@ HierarchyEdgeDataOpsComplex::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -991,7 +1008,7 @@ HierarchyEdgeDataOpsComplex::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -999,22 +1016,22 @@ HierarchyEdgeDataOpsComplex::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -1042,7 +1059,7 @@ HierarchyEdgeDataOpsComplex::dot( dcomplex dprod = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1050,34 +1067,46 @@ HierarchyEdgeDataOpsComplex::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } - dcomplex global_dot = dprod; if (mpi.getSize() > 1) { - mpi.Allreduce(&dprod, &global_dot, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = dprod.real(); + double imag_part = dprod.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_dot(global_real_part, global_imag_part); + return global_dot; + } else { + return dprod; } - return global_dot; } dcomplex @@ -1094,7 +1123,7 @@ HierarchyEdgeDataOpsComplex::integral( dcomplex local_integral = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1102,11 +1131,11 @@ HierarchyEdgeDataOpsComplex::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1117,13 +1146,23 @@ HierarchyEdgeDataOpsComplex::integral( } } - dcomplex global_integral = local_integral; if (mpi.getSize() > 1) { - mpi.Allreduce(&local_integral, &global_integral, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = local_integral.real(); + double imag_part = local_integral.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_integral(global_real_part, global_imag_part); + return global_integral; + } else { + return local_integral; } - return global_integral; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.h index dcf2bd74..80cc077c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex edge data on multiple levels. * ************************************************************************/ @@ -19,8 +19,9 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace math { @@ -52,7 +53,7 @@ namespace math { * HierarchyEdgeDataOpsReal and HierarchyEdgeDataOpsInteger, * respectively. * - * @see math::PatchEdgeDataOpsComplex + * @see PatchEdgeDataOpsComplex */ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex @@ -68,6 +69,8 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyEdgeDataOpsComplex( const boost::shared_ptr& hierarchy, @@ -81,6 +84,8 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -88,7 +93,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -103,6 +111,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -112,6 +124,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -120,6 +136,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -129,6 +149,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -138,6 +162,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -148,6 +176,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -158,6 +190,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -169,6 +205,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -179,6 +219,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -190,6 +234,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -201,6 +249,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -212,6 +264,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -226,6 +282,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -239,6 +299,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +316,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * Set destination data to absolute value of source data, pointwise. * Note that the source data must be dcomplex and the destination must * be double. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -263,6 +331,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -278,16 +350,25 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) * hierarchy levels. */ double @@ -301,6 +382,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is undefined (vol_id < 0), the * return value is \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -327,6 +412,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is undefined (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -366,6 +455,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * over the data elements where \f$cvol_i > 0\f$. If the control volume is * undefined (vol_id < 0), it is ignored during the computation of the * maximum. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -378,6 +471,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex dot( @@ -388,6 +485,10 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex integral( @@ -398,18 +499,15 @@ class HierarchyEdgeDataOpsComplex:public HierarchyDataOpsComplex // The following are not implemented HierarchyEdgeDataOpsComplex( const HierarchyEdgeDataOpsComplex&); - void + HierarchyEdgeDataOpsComplex& operator = ( const HierarchyEdgeDataOpsComplex&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_edge_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_edge_boxes[SAMRAI::MAX_DIM_VAL]; PatchEdgeDataOpsComplex d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.C index 1f6e8ca4..6729deda 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer edge data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyEdgeDataOpsInteger_C -#define included_math_HierarchyEdgeDataOpsInteger_C - #include "SAMRAI/math/HierarchyEdgeDataOpsInteger.h" #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/BoxContainer.h" @@ -84,18 +80,18 @@ HierarchyEdgeDataOpsInteger::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_edge_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_edge_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer edge_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (int nd = 0; nd < dimVal; ++nd) { edge_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(edge_boxes); + for (hier::BoxContainer::iterator i = edge_boxes.begin(); i != edge_boxes.end(); ++i) { *i = pdat::EdgeGeometry::toEdgeBox(*i, nd); } @@ -120,7 +116,7 @@ HierarchyEdgeDataOpsInteger::getPatchHierarchy() const ************************************************************************* */ -int +size_t HierarchyEdgeDataOpsInteger::numberOfEntries( const int data_id, const bool interior_only) const @@ -131,34 +127,34 @@ HierarchyEdgeDataOpsInteger::numberOfEntries( && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int dimVal = d_hierarchy->getDim().getValue(); + tbox::Dimension::dir_t dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_edge_boxes[nd][ln].getSize()); + for (int nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_edge_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { - for (int eb = 0; eb < dimVal; eb++) { + for (int eb = 0; eb < dimVal; ++eb) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_edge_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_edge_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -169,14 +165,14 @@ HierarchyEdgeDataOpsInteger::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -184,9 +180,9 @@ HierarchyEdgeDataOpsInteger::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -206,7 +202,7 @@ HierarchyEdgeDataOpsInteger::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -214,13 +210,14 @@ HierarchyEdgeDataOpsInteger::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -236,12 +233,12 @@ HierarchyEdgeDataOpsInteger::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -252,7 +249,7 @@ HierarchyEdgeDataOpsInteger::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -280,7 +277,7 @@ HierarchyEdgeDataOpsInteger::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -289,8 +286,8 @@ HierarchyEdgeDataOpsInteger::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -312,7 +309,7 @@ HierarchyEdgeDataOpsInteger::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -320,8 +317,8 @@ HierarchyEdgeDataOpsInteger::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -352,7 +349,7 @@ HierarchyEdgeDataOpsInteger::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -360,13 +357,14 @@ HierarchyEdgeDataOpsInteger::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -387,7 +385,7 @@ HierarchyEdgeDataOpsInteger::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -395,13 +393,14 @@ HierarchyEdgeDataOpsInteger::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -422,7 +421,7 @@ HierarchyEdgeDataOpsInteger::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -430,16 +429,18 @@ HierarchyEdgeDataOpsInteger::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -460,7 +461,7 @@ HierarchyEdgeDataOpsInteger::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -468,16 +469,18 @@ HierarchyEdgeDataOpsInteger::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -498,7 +501,7 @@ HierarchyEdgeDataOpsInteger::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -506,16 +509,18 @@ HierarchyEdgeDataOpsInteger::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -536,7 +541,7 @@ HierarchyEdgeDataOpsInteger::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -544,16 +549,18 @@ HierarchyEdgeDataOpsInteger::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -573,7 +580,7 @@ HierarchyEdgeDataOpsInteger::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -581,13 +588,14 @@ HierarchyEdgeDataOpsInteger::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -610,7 +618,7 @@ HierarchyEdgeDataOpsInteger::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -618,16 +626,18 @@ HierarchyEdgeDataOpsInteger::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -649,7 +659,7 @@ HierarchyEdgeDataOpsInteger::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -657,16 +667,18 @@ HierarchyEdgeDataOpsInteger::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -688,7 +700,7 @@ HierarchyEdgeDataOpsInteger::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -696,16 +708,18 @@ HierarchyEdgeDataOpsInteger::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -725,7 +739,7 @@ HierarchyEdgeDataOpsInteger::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -733,13 +747,14 @@ HierarchyEdgeDataOpsInteger::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -762,7 +777,7 @@ HierarchyEdgeDataOpsInteger::min( int minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -770,8 +785,8 @@ HierarchyEdgeDataOpsInteger::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -803,7 +818,7 @@ HierarchyEdgeDataOpsInteger::max( int maxval = -(tbox::MathUtilities::getMax()); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -811,8 +826,8 @@ HierarchyEdgeDataOpsInteger::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -842,7 +857,7 @@ HierarchyEdgeDataOpsInteger::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -850,8 +865,8 @@ HierarchyEdgeDataOpsInteger::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -864,4 +879,3 @@ HierarchyEdgeDataOpsInteger::setRandomValues( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.h index 5873b2ad..f6bb1767 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer edge data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -51,7 +51,7 @@ namespace math { * HierarchyEdgeDataOpsReal and HierarchyEdgeDataOpsComplex, * respectively. * - * @see math::PatchEdgeDataOpsInteger + * @see PatchEdgeDataOpsInteger */ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger @@ -67,6 +67,8 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyEdgeDataOpsInteger( const boost::shared_ptr& hierarchy, @@ -80,6 +82,8 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -87,7 +91,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -107,14 +114,22 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -124,6 +139,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -132,6 +151,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -141,6 +164,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -150,6 +177,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -160,6 +191,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -170,6 +205,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -181,6 +220,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -191,6 +234,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -202,6 +249,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -213,6 +264,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -224,6 +279,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -238,6 +297,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -251,6 +314,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -262,6 +329,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -271,6 +342,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int min( @@ -279,6 +354,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int max( @@ -289,6 +368,10 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -301,18 +384,15 @@ class HierarchyEdgeDataOpsInteger:public HierarchyDataOpsInteger // The following are not implemented HierarchyEdgeDataOpsInteger( const HierarchyEdgeDataOpsInteger&); - void + HierarchyEdgeDataOpsInteger& operator = ( const HierarchyEdgeDataOpsInteger&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_edge_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_edge_boxes[SAMRAI::MAX_DIM_VAL]; PatchEdgeDataOpsInteger d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.C index a1dc449e..100b2a5f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real edge data on multiple levels. * ************************************************************************/ @@ -87,16 +87,16 @@ HierarchyEdgeDataOpsReal::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_edge_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_edge_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer edge_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (int nd = 0; nd < dimVal; ++nd) { edge_boxes = level->getBoxes(); for (hier::BoxContainer::iterator i = edge_boxes.begin(); i != edge_boxes.end(); ++i) { @@ -116,32 +116,6 @@ HierarchyEdgeDataOpsReal::getPatchHierarchy() const return d_hierarchy; } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchyEdgeDataOpsReal::HierarchyEdgeDataOpsReal( - const HierarchyEdgeDataOpsReal& foo): - HierarchyDataOpsReal() -{ - NULL_USE(foo); -} - -template -void -HierarchyEdgeDataOpsReal::operator = ( - const HierarchyEdgeDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -162,7 +136,7 @@ HierarchyEdgeDataOpsReal::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -170,13 +144,14 @@ HierarchyEdgeDataOpsReal::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -193,12 +168,12 @@ HierarchyEdgeDataOpsReal::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -209,7 +184,7 @@ HierarchyEdgeDataOpsReal::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -238,7 +213,7 @@ HierarchyEdgeDataOpsReal::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -247,8 +222,8 @@ HierarchyEdgeDataOpsReal::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -271,7 +246,7 @@ HierarchyEdgeDataOpsReal::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -279,8 +254,8 @@ HierarchyEdgeDataOpsReal::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -312,7 +287,7 @@ HierarchyEdgeDataOpsReal::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -320,13 +295,14 @@ HierarchyEdgeDataOpsReal::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -348,7 +324,7 @@ HierarchyEdgeDataOpsReal::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -356,13 +332,14 @@ HierarchyEdgeDataOpsReal::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -384,7 +361,7 @@ HierarchyEdgeDataOpsReal::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -392,16 +369,18 @@ HierarchyEdgeDataOpsReal::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -423,7 +402,7 @@ HierarchyEdgeDataOpsReal::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -431,16 +410,18 @@ HierarchyEdgeDataOpsReal::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -462,7 +443,7 @@ HierarchyEdgeDataOpsReal::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -470,16 +451,18 @@ HierarchyEdgeDataOpsReal::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -501,7 +484,7 @@ HierarchyEdgeDataOpsReal::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -509,16 +492,18 @@ HierarchyEdgeDataOpsReal::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -539,7 +524,7 @@ HierarchyEdgeDataOpsReal::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -547,13 +532,14 @@ HierarchyEdgeDataOpsReal::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -577,7 +563,7 @@ HierarchyEdgeDataOpsReal::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -585,16 +571,18 @@ HierarchyEdgeDataOpsReal::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -617,7 +605,7 @@ HierarchyEdgeDataOpsReal::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -625,16 +613,18 @@ HierarchyEdgeDataOpsReal::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -657,7 +647,7 @@ HierarchyEdgeDataOpsReal::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -665,16 +655,18 @@ HierarchyEdgeDataOpsReal::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -695,7 +687,7 @@ HierarchyEdgeDataOpsReal::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -703,13 +695,14 @@ HierarchyEdgeDataOpsReal::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -731,7 +724,7 @@ HierarchyEdgeDataOpsReal::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -739,8 +732,8 @@ HierarchyEdgeDataOpsReal::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(data); @@ -760,7 +753,7 @@ HierarchyEdgeDataOpsReal::setRandomValues( */ template -int +size_t HierarchyEdgeDataOpsReal::numberOfEntries( const int data_id, const bool interior_only) const @@ -773,32 +766,32 @@ HierarchyEdgeDataOpsReal::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_edge_boxes[nd][ln].getSize()); + for (int nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_edge_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { - for (int eb = 0; eb < dimVal; eb++) { - hier::BoxContainer::const_iterator lb = + for (int eb = 0; eb < dimVal; ++eb) { + hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_edge_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_edge_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -809,14 +802,14 @@ HierarchyEdgeDataOpsReal::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -824,9 +817,9 @@ HierarchyEdgeDataOpsReal::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -851,7 +844,7 @@ HierarchyEdgeDataOpsReal::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -859,12 +852,13 @@ HierarchyEdgeDataOpsReal::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(data); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -896,7 +890,7 @@ HierarchyEdgeDataOpsReal::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -904,22 +898,22 @@ HierarchyEdgeDataOpsReal::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(data, box, cv); } } @@ -965,7 +959,7 @@ HierarchyEdgeDataOpsReal::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -973,25 +967,26 @@ HierarchyEdgeDataOpsReal::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > weight( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + TBOX_ASSERT(weight); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(data, weight, box, cv); norm_squared += pnorm * pnorm; @@ -1053,7 +1048,7 @@ HierarchyEdgeDataOpsReal::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1061,22 +1056,22 @@ HierarchyEdgeDataOpsReal::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(data, box, cv)); } @@ -1109,7 +1104,7 @@ HierarchyEdgeDataOpsReal::dot( TYPE dprod = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1117,25 +1112,26 @@ HierarchyEdgeDataOpsReal::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(data1, data2, box, cv); } } @@ -1163,7 +1159,7 @@ HierarchyEdgeDataOpsReal::integral( TYPE local_integral = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1171,11 +1167,11 @@ HierarchyEdgeDataOpsReal::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1217,7 +1213,7 @@ HierarchyEdgeDataOpsReal::computeConstrProdPos( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1225,25 +1221,26 @@ HierarchyEdgeDataOpsReal::computeConstrProdPos( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.computeConstrProdPos(data1, data2, box, cv)); } @@ -1269,7 +1266,7 @@ HierarchyEdgeDataOpsReal::compareToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1277,25 +1274,26 @@ HierarchyEdgeDataOpsReal::compareToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); d_patch_ops.compareToScalar(dst, src, alpha, box, cv); } } @@ -1317,7 +1315,7 @@ HierarchyEdgeDataOpsReal::testReciprocal( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1325,25 +1323,26 @@ HierarchyEdgeDataOpsReal::testReciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.testReciprocal(dst, src, box, cv)); } @@ -1372,7 +1371,7 @@ HierarchyEdgeDataOpsReal::maxPointwiseDivide( TYPE max = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1380,11 +1379,14 @@ HierarchyEdgeDataOpsReal::maxPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1417,7 +1419,7 @@ HierarchyEdgeDataOpsReal::minPointwiseDivide( TYPE min = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1425,11 +1427,14 @@ HierarchyEdgeDataOpsReal::minPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1461,7 +1466,7 @@ HierarchyEdgeDataOpsReal::min( TYPE minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1469,8 +1474,8 @@ HierarchyEdgeDataOpsReal::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -1502,7 +1507,7 @@ HierarchyEdgeDataOpsReal::max( TYPE maxval = -tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1510,8 +1515,8 @@ HierarchyEdgeDataOpsReal::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.h index f442b9cc..f50e4373 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyEdgeDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real edge data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyEdgeDataOpsComplex and HierarchyEdgeDataOpsInteger, * respectively. * - * @see math::PatchEdgeDataOpsReal + * @see PatchEdgeDataOpsReal */ template @@ -69,6 +69,8 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyEdgeDataOpsReal( const boost::shared_ptr& hierarchy, @@ -82,6 +84,8 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -89,7 +93,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -104,6 +111,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -113,6 +124,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -121,6 +136,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -130,6 +149,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -139,6 +162,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -149,6 +176,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -159,6 +190,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -170,6 +205,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -180,6 +219,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -191,6 +234,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -202,6 +249,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -213,6 +264,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -227,6 +282,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -240,6 +299,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -251,6 +314,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -260,6 +327,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE min( @@ -268,6 +339,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE max( @@ -278,6 +353,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * Set data entries to random values. See the operations in the * array data operation classes for each data type for details on the * generation of the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -293,17 +372,26 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -318,6 +406,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * \f$\sum_i ( \| data_i \| )\f$. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -347,6 +439,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is not defined * (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -387,6 +483,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * (vol_id < 0), it is ignored during the computation of the maximum. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -401,6 +501,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE dot( @@ -412,6 +516,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE integral( @@ -423,6 +531,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * any \f$i\f$ in the set of patch data indices, where \f$cvol_i > 0\f$. Otherwise, * return 0. If the control volume is undefined (vol_id < 0), all values * on the patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int computeConstrProdPos( @@ -435,6 +547,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is undefined (vol_id < 0), all values on the patch interiors * are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void compareToScalar( @@ -449,6 +565,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. * If the control volume is undefined (vol_id < 0), all values on the * patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int testReciprocal( @@ -468,6 +588,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE maxPointwiseDivide( @@ -488,6 +612,10 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE minPointwiseDivide( @@ -498,18 +626,16 @@ class HierarchyEdgeDataOpsReal:public HierarchyDataOpsReal private: // The following are not implemented HierarchyEdgeDataOpsReal( - const HierarchyEdgeDataOpsReal&); - void + const HierarchyEdgeDataOpsReal&); + HierarchyEdgeDataOpsReal& operator = ( - const HierarchyEdgeDataOpsReal&); + const HierarchyEdgeDataOpsReal&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_edge_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE]; + std::vector > + d_nonoverlapping_edge_boxes[SAMRAI::MAX_DIM_VAL]; PatchEdgeDataOpsReal d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.C index c2b97e81..92609d5f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex face data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyFaceDataOpsComplex_C -#define included_math_HierarchyFaceDataOpsComplex_C - #include "SAMRAI/math/HierarchyFaceDataOpsComplex.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" @@ -83,18 +79,18 @@ HierarchyFaceDataOpsComplex::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_face_boxes[d].resizeArray(d_finest_level + 1); + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { + d_nonoverlapping_face_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer face_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { face_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(face_boxes); + for (hier::BoxContainer::iterator i = face_boxes.begin(); i != face_boxes.end(); ++i) { *i = pdat::FaceGeometry::toFaceBox(*i, nd); } @@ -130,7 +126,7 @@ HierarchyFaceDataOpsComplex::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -138,13 +134,14 @@ HierarchyFaceDataOpsComplex::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -160,12 +157,12 @@ HierarchyFaceDataOpsComplex::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -176,7 +173,7 @@ HierarchyFaceDataOpsComplex::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -204,7 +201,7 @@ HierarchyFaceDataOpsComplex::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -213,8 +210,8 @@ HierarchyFaceDataOpsComplex::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -236,7 +233,7 @@ HierarchyFaceDataOpsComplex::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -244,8 +241,8 @@ HierarchyFaceDataOpsComplex::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -276,7 +273,7 @@ HierarchyFaceDataOpsComplex::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -284,13 +281,14 @@ HierarchyFaceDataOpsComplex::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -311,7 +309,7 @@ HierarchyFaceDataOpsComplex::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -319,13 +317,14 @@ HierarchyFaceDataOpsComplex::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -346,7 +345,7 @@ HierarchyFaceDataOpsComplex::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -354,16 +353,18 @@ HierarchyFaceDataOpsComplex::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -384,7 +385,7 @@ HierarchyFaceDataOpsComplex::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -392,16 +393,18 @@ HierarchyFaceDataOpsComplex::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -422,7 +425,7 @@ HierarchyFaceDataOpsComplex::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -430,16 +433,18 @@ HierarchyFaceDataOpsComplex::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -460,7 +465,7 @@ HierarchyFaceDataOpsComplex::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -468,16 +473,18 @@ HierarchyFaceDataOpsComplex::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -497,7 +504,7 @@ HierarchyFaceDataOpsComplex::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -505,13 +512,14 @@ HierarchyFaceDataOpsComplex::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -534,7 +542,7 @@ HierarchyFaceDataOpsComplex::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -542,16 +550,18 @@ HierarchyFaceDataOpsComplex::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -573,7 +583,7 @@ HierarchyFaceDataOpsComplex::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -581,16 +591,18 @@ HierarchyFaceDataOpsComplex::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -612,7 +624,7 @@ HierarchyFaceDataOpsComplex::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -620,16 +632,18 @@ HierarchyFaceDataOpsComplex::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -649,7 +663,7 @@ HierarchyFaceDataOpsComplex::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -657,13 +671,14 @@ HierarchyFaceDataOpsComplex::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -684,7 +699,7 @@ HierarchyFaceDataOpsComplex::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -692,8 +707,8 @@ HierarchyFaceDataOpsComplex::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -712,7 +727,7 @@ HierarchyFaceDataOpsComplex::setRandomValues( ************************************************************************* */ -int +size_t HierarchyFaceDataOpsComplex::numberOfEntries( const int data_id, const bool interior_only) const @@ -724,31 +739,31 @@ HierarchyFaceDataOpsComplex::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { - boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > dfact( + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_face_boxes[nd][ln].getSize()); + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_face_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (int eb = 0; eb < dimVal; ++eb) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_face_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_face_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -759,14 +774,14 @@ HierarchyFaceDataOpsComplex::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -774,9 +789,9 @@ HierarchyFaceDataOpsComplex::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -799,7 +814,7 @@ HierarchyFaceDataOpsComplex::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -807,12 +822,13 @@ HierarchyFaceDataOpsComplex::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(d); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -842,7 +858,7 @@ HierarchyFaceDataOpsComplex::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -850,22 +866,22 @@ HierarchyFaceDataOpsComplex::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -904,7 +920,7 @@ HierarchyFaceDataOpsComplex::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -912,25 +928,26 @@ HierarchyFaceDataOpsComplex::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -988,7 +1005,7 @@ HierarchyFaceDataOpsComplex::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -996,22 +1013,22 @@ HierarchyFaceDataOpsComplex::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -1039,7 +1056,7 @@ HierarchyFaceDataOpsComplex::dot( dcomplex dprod = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1047,34 +1064,46 @@ HierarchyFaceDataOpsComplex::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } - dcomplex global_dot = dprod; if (mpi.getSize() > 1) { - mpi.Allreduce(&dprod, &global_dot, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = dprod.real(); + double imag_part = dprod.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_dot(global_real_part, global_imag_part); + return global_dot; + } else { + return dprod; } - return global_dot; } dcomplex @@ -1091,7 +1120,7 @@ HierarchyFaceDataOpsComplex::integral( dcomplex local_integral = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1099,11 +1128,11 @@ HierarchyFaceDataOpsComplex::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1114,13 +1143,23 @@ HierarchyFaceDataOpsComplex::integral( } } - dcomplex global_integral = local_integral; if (mpi.getSize() > 1) { - mpi.Allreduce(&local_integral, &global_integral, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = local_integral.real(); + double imag_part = local_integral.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_integral(global_real_part, global_imag_part); + return global_integral; + } else { + return local_integral; } - return global_integral; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.h index b260c636..0058dfe0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex face data on multiple levels. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyFaceDataOpsReal and HierarchyFaceDataOpsInteger, * respectively. * - * @see math::PatchFaceDataOpsComplex + * @see PatchFaceDataOpsComplex */ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex @@ -68,6 +68,8 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyFaceDataOpsComplex( const boost::shared_ptr& hierarchy, @@ -81,6 +83,8 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -88,7 +92,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -103,6 +110,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -112,6 +123,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -120,6 +135,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -129,6 +148,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -138,6 +161,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -148,6 +175,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -158,6 +189,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -169,6 +204,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -179,6 +218,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -190,6 +233,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -201,6 +248,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -212,6 +263,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -226,6 +281,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -239,6 +298,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +315,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * Set destination data to absolute value of source data, pointwise. * Note that the source data must be dcomplex and the destination must * be double. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -263,6 +330,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -278,17 +349,26 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -301,6 +381,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is undefined (vol_id < 0), the * return value is \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -327,6 +411,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is undefined (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -366,6 +454,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * over the data elements where \f$cvol_i > 0\f$. If the control volume is * undefined (vol_id < 0), it is ignored during the computation of the * maximum. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -378,6 +470,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex dot( @@ -388,6 +484,10 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex integral( @@ -398,18 +498,15 @@ class HierarchyFaceDataOpsComplex:public HierarchyDataOpsComplex // The following are not implemented HierarchyFaceDataOpsComplex( const HierarchyFaceDataOpsComplex&); - void + HierarchyFaceDataOpsComplex& operator = ( const HierarchyFaceDataOpsComplex&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_face_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_face_boxes[SAMRAI::MAX_DIM_VAL]; PatchFaceDataOpsComplex d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.C index cf526979..c9c91d3a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer face data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyFaceDataOpsInteger_C -#define included_math_HierarchyFaceDataOpsInteger_C - #include "SAMRAI/math/HierarchyFaceDataOpsInteger.h" #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/BoxContainer.h" @@ -84,18 +80,18 @@ HierarchyFaceDataOpsInteger::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_face_boxes[d].resizeArray(d_finest_level + 1); + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { + d_nonoverlapping_face_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer face_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { face_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(face_boxes); + for (hier::BoxContainer::iterator i = face_boxes.begin(); i != face_boxes.end(); ++i) { *i = pdat::FaceGeometry::toFaceBox(*i, nd); } @@ -120,7 +116,7 @@ HierarchyFaceDataOpsInteger::getPatchHierarchy() const ************************************************************************* */ -int +size_t HierarchyFaceDataOpsInteger::numberOfEntries( const int data_id, const bool interior_only) const @@ -133,31 +129,31 @@ HierarchyFaceDataOpsInteger::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_face_boxes[nd][ln].getSize()); + for (int nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_face_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (tbox::Dimension::dir_t eb = 0; eb < dimVal; ++eb) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_face_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_face_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -168,14 +164,14 @@ HierarchyFaceDataOpsInteger::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -183,9 +179,9 @@ HierarchyFaceDataOpsInteger::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&global_entries, &entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&global_entries, &entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -205,7 +201,7 @@ HierarchyFaceDataOpsInteger::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -213,13 +209,14 @@ HierarchyFaceDataOpsInteger::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -235,12 +232,12 @@ HierarchyFaceDataOpsInteger::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -251,7 +248,7 @@ HierarchyFaceDataOpsInteger::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -279,7 +276,7 @@ HierarchyFaceDataOpsInteger::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -288,8 +285,8 @@ HierarchyFaceDataOpsInteger::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -311,7 +308,7 @@ HierarchyFaceDataOpsInteger::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -319,8 +316,8 @@ HierarchyFaceDataOpsInteger::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -351,7 +348,7 @@ HierarchyFaceDataOpsInteger::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -359,13 +356,14 @@ HierarchyFaceDataOpsInteger::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -386,7 +384,7 @@ HierarchyFaceDataOpsInteger::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -394,13 +392,14 @@ HierarchyFaceDataOpsInteger::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -421,7 +420,7 @@ HierarchyFaceDataOpsInteger::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -429,16 +428,18 @@ HierarchyFaceDataOpsInteger::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -459,7 +460,7 @@ HierarchyFaceDataOpsInteger::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -467,16 +468,18 @@ HierarchyFaceDataOpsInteger::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -497,7 +500,7 @@ HierarchyFaceDataOpsInteger::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -505,16 +508,18 @@ HierarchyFaceDataOpsInteger::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -535,7 +540,7 @@ HierarchyFaceDataOpsInteger::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -543,16 +548,18 @@ HierarchyFaceDataOpsInteger::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -572,7 +579,7 @@ HierarchyFaceDataOpsInteger::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -580,13 +587,14 @@ HierarchyFaceDataOpsInteger::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -609,7 +617,7 @@ HierarchyFaceDataOpsInteger::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -617,16 +625,18 @@ HierarchyFaceDataOpsInteger::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -648,7 +658,7 @@ HierarchyFaceDataOpsInteger::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -656,16 +666,18 @@ HierarchyFaceDataOpsInteger::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -687,7 +699,7 @@ HierarchyFaceDataOpsInteger::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -695,16 +707,18 @@ HierarchyFaceDataOpsInteger::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -724,7 +738,7 @@ HierarchyFaceDataOpsInteger::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -732,13 +746,14 @@ HierarchyFaceDataOpsInteger::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -761,7 +776,7 @@ HierarchyFaceDataOpsInteger::min( int minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -769,8 +784,8 @@ HierarchyFaceDataOpsInteger::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -802,7 +817,7 @@ HierarchyFaceDataOpsInteger::max( int maxval = -(tbox::MathUtilities::getMax()); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -810,8 +825,8 @@ HierarchyFaceDataOpsInteger::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -841,7 +856,7 @@ HierarchyFaceDataOpsInteger::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -849,8 +864,8 @@ HierarchyFaceDataOpsInteger::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -863,4 +878,3 @@ HierarchyFaceDataOpsInteger::setRandomValues( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.h index 89cca500..b6e7be28 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer face data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -51,7 +51,7 @@ namespace math { * HierarchyFaceDataOpsReal and HierarchyFaceDataOpsComplex, * respectively. * - * @see math::PatchFaceDataOpsInteger + * @see PatchFaceDataOpsInteger */ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger @@ -67,6 +67,8 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyFaceDataOpsInteger( const boost::shared_ptr& hierarchy, @@ -80,6 +82,8 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -87,7 +91,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -107,14 +114,22 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -124,6 +139,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -132,6 +151,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -141,6 +164,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -150,6 +177,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -160,6 +191,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -170,6 +205,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -181,6 +220,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -191,6 +234,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -202,6 +249,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -213,6 +264,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -224,6 +279,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -238,6 +297,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -251,6 +314,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -262,6 +329,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -271,6 +342,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int min( @@ -279,6 +354,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int max( @@ -289,6 +368,10 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -301,18 +384,15 @@ class HierarchyFaceDataOpsInteger:public HierarchyDataOpsInteger // The following are not implemented HierarchyFaceDataOpsInteger( const HierarchyFaceDataOpsInteger&); - void + HierarchyFaceDataOpsInteger& operator = ( const HierarchyFaceDataOpsInteger&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_face_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_face_boxes[SAMRAI::MAX_DIM_VAL]; PatchFaceDataOpsInteger d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.C index d9c3aeb7..708b002f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real face data on multiple levels. * ************************************************************************/ @@ -87,18 +87,18 @@ HierarchyFaceDataOpsReal::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_face_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_face_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer face_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { face_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(face_boxes); + for (hier::BoxContainer::iterator i = face_boxes.begin(); i != face_boxes.end(); ++i) { *i = pdat::FaceGeometry::toFaceBox(*i, nd); } @@ -116,32 +116,6 @@ HierarchyFaceDataOpsReal::getPatchHierarchy() const return d_hierarchy; } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchyFaceDataOpsReal::HierarchyFaceDataOpsReal( - const HierarchyFaceDataOpsReal& foo): - HierarchyDataOpsReal() -{ - NULL_USE(foo); -} - -template -void -HierarchyFaceDataOpsReal::operator = ( - const HierarchyFaceDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -162,7 +136,7 @@ HierarchyFaceDataOpsReal::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -170,13 +144,14 @@ HierarchyFaceDataOpsReal::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -193,12 +168,12 @@ HierarchyFaceDataOpsReal::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -209,7 +184,7 @@ HierarchyFaceDataOpsReal::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -238,7 +213,7 @@ HierarchyFaceDataOpsReal::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -247,8 +222,8 @@ HierarchyFaceDataOpsReal::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -271,7 +246,7 @@ HierarchyFaceDataOpsReal::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -279,8 +254,8 @@ HierarchyFaceDataOpsReal::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -312,7 +287,7 @@ HierarchyFaceDataOpsReal::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -320,13 +295,14 @@ HierarchyFaceDataOpsReal::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -348,7 +324,7 @@ HierarchyFaceDataOpsReal::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -356,13 +332,14 @@ HierarchyFaceDataOpsReal::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -384,7 +361,7 @@ HierarchyFaceDataOpsReal::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -392,16 +369,18 @@ HierarchyFaceDataOpsReal::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -423,7 +402,7 @@ HierarchyFaceDataOpsReal::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -431,16 +410,18 @@ HierarchyFaceDataOpsReal::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -462,7 +443,7 @@ HierarchyFaceDataOpsReal::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -470,16 +451,18 @@ HierarchyFaceDataOpsReal::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -501,7 +484,7 @@ HierarchyFaceDataOpsReal::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -509,16 +492,18 @@ HierarchyFaceDataOpsReal::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -539,7 +524,7 @@ HierarchyFaceDataOpsReal::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -547,13 +532,14 @@ HierarchyFaceDataOpsReal::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -577,7 +563,7 @@ HierarchyFaceDataOpsReal::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -585,16 +571,18 @@ HierarchyFaceDataOpsReal::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -617,7 +605,7 @@ HierarchyFaceDataOpsReal::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -625,16 +613,18 @@ HierarchyFaceDataOpsReal::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -657,7 +647,7 @@ HierarchyFaceDataOpsReal::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -665,16 +655,18 @@ HierarchyFaceDataOpsReal::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -695,7 +687,7 @@ HierarchyFaceDataOpsReal::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -703,13 +695,14 @@ HierarchyFaceDataOpsReal::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -731,7 +724,7 @@ HierarchyFaceDataOpsReal::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -739,8 +732,8 @@ HierarchyFaceDataOpsReal::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(data); @@ -760,7 +753,7 @@ HierarchyFaceDataOpsReal::setRandomValues( */ template -int +size_t HierarchyFaceDataOpsReal::numberOfEntries( const int data_id, const bool interior_only) const @@ -772,33 +765,33 @@ HierarchyFaceDataOpsReal::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int dimVal = d_hierarchy->getDim().getValue(); + tbox::Dimension::dir_t dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int nd = 0; nd < dimVal; nd++) { - TBOX_ASSERT(npatches == d_nonoverlapping_face_boxes[nd][ln].getSize()); + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_face_boxes[nd][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (int eb = 0; eb < dimVal; ++eb) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_face_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_face_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -809,14 +802,14 @@ HierarchyFaceDataOpsReal::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -824,9 +817,9 @@ HierarchyFaceDataOpsReal::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -851,7 +844,7 @@ HierarchyFaceDataOpsReal::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -859,12 +852,13 @@ HierarchyFaceDataOpsReal::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(data); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -896,7 +890,7 @@ HierarchyFaceDataOpsReal::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -904,22 +898,22 @@ HierarchyFaceDataOpsReal::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(data, box, cv); } } @@ -965,7 +959,7 @@ HierarchyFaceDataOpsReal::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -973,25 +967,26 @@ HierarchyFaceDataOpsReal::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > weight( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + TBOX_ASSERT(weight); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(data, weight, box, cv); norm_squared += pnorm * pnorm; @@ -1053,7 +1048,7 @@ HierarchyFaceDataOpsReal::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1061,22 +1056,22 @@ HierarchyFaceDataOpsReal::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(data, box, cv)); } @@ -1109,7 +1104,7 @@ HierarchyFaceDataOpsReal::dot( TYPE dprod = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1117,25 +1112,26 @@ HierarchyFaceDataOpsReal::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(data1, data2, box, cv); } } @@ -1163,7 +1159,7 @@ HierarchyFaceDataOpsReal::integral( TYPE local_integral = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1171,11 +1167,11 @@ HierarchyFaceDataOpsReal::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1217,7 +1213,7 @@ HierarchyFaceDataOpsReal::computeConstrProdPos( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1225,25 +1221,26 @@ HierarchyFaceDataOpsReal::computeConstrProdPos( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.computeConstrProdPos(data1, data2, box, cv)); } @@ -1269,7 +1266,7 @@ HierarchyFaceDataOpsReal::compareToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1277,25 +1274,26 @@ HierarchyFaceDataOpsReal::compareToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); d_patch_ops.compareToScalar(dst, src, alpha, box, cv); } } @@ -1317,7 +1315,7 @@ HierarchyFaceDataOpsReal::testReciprocal( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1325,25 +1323,26 @@ HierarchyFaceDataOpsReal::testReciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.testReciprocal(dst, src, box, cv)); } @@ -1372,7 +1371,7 @@ HierarchyFaceDataOpsReal::maxPointwiseDivide( TYPE max = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1380,11 +1379,14 @@ HierarchyFaceDataOpsReal::maxPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1417,7 +1419,7 @@ HierarchyFaceDataOpsReal::minPointwiseDivide( TYPE min = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1425,11 +1427,14 @@ HierarchyFaceDataOpsReal::minPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1461,7 +1466,7 @@ HierarchyFaceDataOpsReal::min( TYPE minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1469,8 +1474,8 @@ HierarchyFaceDataOpsReal::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -1502,7 +1507,7 @@ HierarchyFaceDataOpsReal::max( TYPE maxval = -tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1510,8 +1515,8 @@ HierarchyFaceDataOpsReal::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.h index d48ae350..2134e5a7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyFaceDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real face data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyFaceDataOpsComplex and HierarchyFaceDataOpsInteger, * respectively. * - * @see math::PatchFaceDataOpsReal + * @see PatchFaceDataOpsReal */ template @@ -69,6 +69,8 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyFaceDataOpsReal( const boost::shared_ptr& hierarchy, @@ -82,6 +84,8 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -89,7 +93,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -104,6 +111,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -113,6 +124,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -121,6 +136,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -130,6 +149,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -139,6 +162,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -149,6 +176,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -159,6 +190,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -170,6 +205,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -180,6 +219,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -191,6 +234,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -202,6 +249,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -213,6 +264,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -227,6 +282,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -240,6 +299,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -251,6 +314,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -260,6 +327,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE min( @@ -268,6 +339,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE max( @@ -278,6 +353,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * Set data entries to random values. See the operations in the * array data operation classes for each data type for details on the * generation of the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -293,17 +372,26 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -318,6 +406,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * \f$\sum_i ( \| data_i \| )\f$. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -347,6 +439,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is not defined * (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -387,6 +483,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * (vol_id < 0), it is ignored during the computation of the maximum. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -401,6 +501,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE dot( @@ -412,6 +516,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE integral( @@ -423,6 +531,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * any \f$i\f$ in the set of patch data indices, where \f$cvol_i > 0\f$. Otherwise, * return 0. If the control volume is undefined (vol_id < 0), all values * on the patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int computeConstrProdPos( @@ -435,6 +547,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is undefined (vol_id < 0), all values on the patch interiors * are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void compareToScalar( @@ -449,6 +565,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. * If the control volume is undefined (vol_id < 0), all values on the * patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int testReciprocal( @@ -468,6 +588,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE maxPointwiseDivide( @@ -488,6 +612,10 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE minPointwiseDivide( @@ -498,18 +626,16 @@ class HierarchyFaceDataOpsReal:public HierarchyDataOpsReal private: // The following are not implemented HierarchyFaceDataOpsReal( - const HierarchyFaceDataOpsReal&); - void + const HierarchyFaceDataOpsReal&); + HierarchyFaceDataOpsReal& operator = ( - const HierarchyFaceDataOpsReal&); + const HierarchyFaceDataOpsReal&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_face_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE]; + std::vector > + d_nonoverlapping_face_boxes[SAMRAI::MAX_DIM_VAL]; PatchFaceDataOpsReal d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.C index 91dc7c3a..cf11ac2d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex node data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyNodeDataOpsComplex_C -#define included_math_HierarchyNodeDataOpsComplex_C - #include "SAMRAI/math/HierarchyNodeDataOpsComplex.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" @@ -31,7 +27,7 @@ HierarchyNodeDataOpsComplex::HierarchyNodeDataOpsComplex( const int coarsest_level, const int finest_level): HierarchyDataOpsComplex(), - d_hierarchy (hierarchy) + d_hierarchy(hierarchy) { TBOX_ASSERT(hierarchy); @@ -81,14 +77,14 @@ HierarchyNodeDataOpsComplex::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - d_nonoverlapping_node_boxes.resizeArray(d_finest_level + 1); + d_nonoverlapping_node_boxes.resize(d_finest_level + 1); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer node_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(node_boxes); + for (hier::BoxContainer::iterator i = node_boxes.begin(); i != node_boxes.end(); ++i) { *i = pdat::NodeGeometry::toNodeBox(*i); } @@ -123,7 +119,7 @@ HierarchyNodeDataOpsComplex::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -131,13 +127,14 @@ HierarchyNodeDataOpsComplex::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -153,12 +150,12 @@ HierarchyNodeDataOpsComplex::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -169,7 +166,7 @@ HierarchyNodeDataOpsComplex::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -197,7 +194,7 @@ HierarchyNodeDataOpsComplex::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -206,8 +203,8 @@ HierarchyNodeDataOpsComplex::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -229,7 +226,7 @@ HierarchyNodeDataOpsComplex::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -237,8 +234,8 @@ HierarchyNodeDataOpsComplex::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -269,7 +266,7 @@ HierarchyNodeDataOpsComplex::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -277,13 +274,14 @@ HierarchyNodeDataOpsComplex::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -304,7 +302,7 @@ HierarchyNodeDataOpsComplex::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -312,13 +310,14 @@ HierarchyNodeDataOpsComplex::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -339,7 +338,7 @@ HierarchyNodeDataOpsComplex::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -347,16 +346,18 @@ HierarchyNodeDataOpsComplex::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -377,7 +378,7 @@ HierarchyNodeDataOpsComplex::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -385,16 +386,18 @@ HierarchyNodeDataOpsComplex::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -415,7 +418,7 @@ HierarchyNodeDataOpsComplex::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -423,16 +426,18 @@ HierarchyNodeDataOpsComplex::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -453,7 +458,7 @@ HierarchyNodeDataOpsComplex::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -461,16 +466,18 @@ HierarchyNodeDataOpsComplex::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -490,7 +497,7 @@ HierarchyNodeDataOpsComplex::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -498,13 +505,14 @@ HierarchyNodeDataOpsComplex::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -527,7 +535,7 @@ HierarchyNodeDataOpsComplex::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -535,16 +543,18 @@ HierarchyNodeDataOpsComplex::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -566,7 +576,7 @@ HierarchyNodeDataOpsComplex::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -574,16 +584,18 @@ HierarchyNodeDataOpsComplex::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -605,7 +617,7 @@ HierarchyNodeDataOpsComplex::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -613,16 +625,18 @@ HierarchyNodeDataOpsComplex::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -642,7 +656,7 @@ HierarchyNodeDataOpsComplex::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -650,13 +664,14 @@ HierarchyNodeDataOpsComplex::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -677,7 +692,7 @@ HierarchyNodeDataOpsComplex::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -685,8 +700,8 @@ HierarchyNodeDataOpsComplex::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -705,7 +720,7 @@ HierarchyNodeDataOpsComplex::setRandomValues( ************************************************************************* */ -int +size_t HierarchyNodeDataOpsComplex::numberOfEntries( const int data_id, const bool interior_only) const @@ -717,24 +732,25 @@ HierarchyNodeDataOpsComplex::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); - TBOX_ASSERT(npatches == d_nonoverlapping_node_boxes[ln].getSize()); + TBOX_ASSERT(npatches == + static_cast(d_nonoverlapping_node_boxes[ln].size())); - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_node_boxes[ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_node_boxes[ln])[il]).end(); ++lb) { @@ -747,14 +763,14 @@ HierarchyNodeDataOpsComplex::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -762,9 +778,9 @@ HierarchyNodeDataOpsComplex::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -787,7 +803,7 @@ HierarchyNodeDataOpsComplex::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -795,12 +811,13 @@ HierarchyNodeDataOpsComplex::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(d); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -830,7 +847,7 @@ HierarchyNodeDataOpsComplex::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -838,22 +855,22 @@ HierarchyNodeDataOpsComplex::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -892,7 +909,7 @@ HierarchyNodeDataOpsComplex::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -900,25 +917,26 @@ HierarchyNodeDataOpsComplex::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -976,7 +994,7 @@ HierarchyNodeDataOpsComplex::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -984,22 +1002,22 @@ HierarchyNodeDataOpsComplex::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -1027,7 +1045,7 @@ HierarchyNodeDataOpsComplex::dot( dcomplex dprod = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1035,34 +1053,46 @@ HierarchyNodeDataOpsComplex::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } - dcomplex global_dot = dprod; if (mpi.getSize() > 1) { - mpi.Allreduce(&dprod, &global_dot, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = dprod.real(); + double imag_part = dprod.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_dot(global_real_part, global_imag_part); + return global_dot; + } else { + return dprod; } - return global_dot; } dcomplex @@ -1079,7 +1109,7 @@ HierarchyNodeDataOpsComplex::integral( dcomplex local_integral = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1087,11 +1117,11 @@ HierarchyNodeDataOpsComplex::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1102,13 +1132,23 @@ HierarchyNodeDataOpsComplex::integral( } } - dcomplex global_integral = local_integral; if (mpi.getSize() > 1) { - mpi.Allreduce(&local_integral, &global_integral, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = local_integral.real(); + double imag_part = local_integral.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_integral(global_real_part, global_imag_part); + return global_integral; + } else { + return local_integral; } - return global_integral; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.h index dfc0467b..8f56de0f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex node data on multiple levels. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchyNodeDataOpsReal and HierarchyNodeDataOpsInteger, * respectively. * - * @see math::PatchNodeDataOpsComplex + * @see PatchNodeDataOpsComplex */ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex @@ -68,6 +68,8 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyNodeDataOpsComplex( const boost::shared_ptr& hierarchy, @@ -81,6 +83,8 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -88,7 +92,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -103,6 +110,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -112,6 +123,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -120,6 +135,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -129,6 +148,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -138,6 +161,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -148,6 +175,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -158,6 +189,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -169,6 +204,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -179,6 +218,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -190,6 +233,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -201,6 +248,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -212,6 +263,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -226,6 +281,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -239,6 +298,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +315,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * Set destination data to absolute value of source data, pointwise. * Note that the source data must be dcomplex and the destination must * be double. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -263,6 +330,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -278,17 +349,26 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -301,6 +381,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is undefined (vol_id < 0), the * return value is \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -327,6 +411,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is undefined (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -366,6 +454,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * over the data elements where \f$cvol_i > 0\f$. If the control volume is * undefined (vol_id < 0), it is ignored during the computation of the * maximum. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -378,6 +470,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex dot( @@ -388,6 +484,10 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex integral( @@ -398,14 +498,14 @@ class HierarchyNodeDataOpsComplex:public HierarchyDataOpsComplex // The following are not implemented HierarchyNodeDataOpsComplex( const HierarchyNodeDataOpsComplex&); - void + HierarchyNodeDataOpsComplex& operator = ( const HierarchyNodeDataOpsComplex&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_node_boxes; + std::vector > d_nonoverlapping_node_boxes; PatchNodeDataOpsComplex d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.C index f5e91946..722a132d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer node data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchyNodeDataOpsInteger_C -#define included_math_HierarchyNodeDataOpsInteger_C - #include "SAMRAI/math/HierarchyNodeDataOpsInteger.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" @@ -82,13 +78,13 @@ HierarchyNodeDataOpsInteger::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - d_nonoverlapping_node_boxes.resizeArray(d_finest_level + 1); + d_nonoverlapping_node_boxes.resize(d_finest_level + 1); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer node_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(node_boxes); + for (hier::BoxContainer::iterator i = node_boxes.begin(); i != node_boxes.end(); ++i) { *i = pdat::NodeGeometry::toNodeBox(*i); } @@ -112,7 +108,7 @@ HierarchyNodeDataOpsInteger::getPatchHierarchy() const ************************************************************************* */ -int +size_t HierarchyNodeDataOpsInteger::numberOfEntries( const int data_id, const bool interior_only) const @@ -124,24 +120,25 @@ HierarchyNodeDataOpsInteger::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); - TBOX_ASSERT(npatches == d_nonoverlapping_node_boxes[ln].getSize()); + TBOX_ASSERT(npatches == + static_cast(d_nonoverlapping_node_boxes[ln].size())); - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_node_boxes[ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_node_boxes[ln])[il]).end(); ++lb) { @@ -154,14 +151,14 @@ HierarchyNodeDataOpsInteger::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -169,9 +166,9 @@ HierarchyNodeDataOpsInteger::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -191,7 +188,7 @@ HierarchyNodeDataOpsInteger::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -199,13 +196,14 @@ HierarchyNodeDataOpsInteger::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -221,12 +219,12 @@ HierarchyNodeDataOpsInteger::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -237,7 +235,7 @@ HierarchyNodeDataOpsInteger::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -265,7 +263,7 @@ HierarchyNodeDataOpsInteger::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -274,8 +272,8 @@ HierarchyNodeDataOpsInteger::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -297,7 +295,7 @@ HierarchyNodeDataOpsInteger::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -305,8 +303,8 @@ HierarchyNodeDataOpsInteger::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -337,7 +335,7 @@ HierarchyNodeDataOpsInteger::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -345,13 +343,14 @@ HierarchyNodeDataOpsInteger::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -372,7 +371,7 @@ HierarchyNodeDataOpsInteger::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -380,13 +379,14 @@ HierarchyNodeDataOpsInteger::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -407,7 +407,7 @@ HierarchyNodeDataOpsInteger::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -415,16 +415,18 @@ HierarchyNodeDataOpsInteger::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -445,7 +447,7 @@ HierarchyNodeDataOpsInteger::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -453,16 +455,18 @@ HierarchyNodeDataOpsInteger::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -483,7 +487,7 @@ HierarchyNodeDataOpsInteger::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -491,16 +495,18 @@ HierarchyNodeDataOpsInteger::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -521,7 +527,7 @@ HierarchyNodeDataOpsInteger::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -529,16 +535,18 @@ HierarchyNodeDataOpsInteger::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -558,7 +566,7 @@ HierarchyNodeDataOpsInteger::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -566,13 +574,14 @@ HierarchyNodeDataOpsInteger::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -595,7 +604,7 @@ HierarchyNodeDataOpsInteger::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -603,16 +612,18 @@ HierarchyNodeDataOpsInteger::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -634,7 +645,7 @@ HierarchyNodeDataOpsInteger::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -642,16 +653,18 @@ HierarchyNodeDataOpsInteger::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -673,7 +686,7 @@ HierarchyNodeDataOpsInteger::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -681,16 +694,18 @@ HierarchyNodeDataOpsInteger::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -710,7 +725,7 @@ HierarchyNodeDataOpsInteger::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -718,13 +733,14 @@ HierarchyNodeDataOpsInteger::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -747,7 +763,7 @@ HierarchyNodeDataOpsInteger::min( int minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -755,8 +771,8 @@ HierarchyNodeDataOpsInteger::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -788,7 +804,7 @@ HierarchyNodeDataOpsInteger::max( int maxval = -(tbox::MathUtilities::getMax()); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -796,8 +812,8 @@ HierarchyNodeDataOpsInteger::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -827,7 +843,7 @@ HierarchyNodeDataOpsInteger::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -835,8 +851,8 @@ HierarchyNodeDataOpsInteger::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -849,4 +865,3 @@ HierarchyNodeDataOpsInteger::setRandomValues( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.h index 9dceb4d3..0862ebcb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer node data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -51,7 +51,7 @@ namespace math { * HierarchyNodeDataOpsReal and HierarchyNodeDataOpsComplex, * respectively. * - * @see math::PatchNodeDataOpsInteger + * @see PatchNodeDataOpsInteger */ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger @@ -67,6 +67,8 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyNodeDataOpsInteger( const boost::shared_ptr& hierarchy, @@ -80,6 +82,8 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -87,7 +91,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -107,14 +114,22 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -124,6 +139,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -132,6 +151,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -141,6 +164,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -150,6 +177,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -160,6 +191,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -170,6 +205,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -181,6 +220,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -191,6 +234,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -202,6 +249,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -213,6 +264,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -224,6 +279,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -238,6 +297,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -251,6 +314,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -262,6 +329,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -271,6 +342,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int min( @@ -279,6 +354,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int max( @@ -289,6 +368,10 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -301,14 +384,14 @@ class HierarchyNodeDataOpsInteger:public HierarchyDataOpsInteger // The following are not implemented HierarchyNodeDataOpsInteger( const HierarchyNodeDataOpsInteger&); - void + HierarchyNodeDataOpsInteger& operator = ( const HierarchyNodeDataOpsInteger&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_node_boxes; + std::vector > d_nonoverlapping_node_boxes; PatchNodeDataOpsInteger d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.C index 7b1f1d10..b242c62b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real node data on multiple levels. * ************************************************************************/ @@ -85,13 +85,13 @@ HierarchyNodeDataOpsReal::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - d_nonoverlapping_node_boxes.resizeArray(d_finest_level + 1); + d_nonoverlapping_node_boxes.resize(d_finest_level + 1); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer node_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(node_boxes); + for (hier::BoxContainer::iterator i = node_boxes.begin(); i != node_boxes.end(); ++i) { *i = pdat::NodeGeometry::toNodeBox(*i); } @@ -108,32 +108,6 @@ HierarchyNodeDataOpsReal::getPatchHierarchy() const return d_hierarchy; } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchyNodeDataOpsReal::HierarchyNodeDataOpsReal( - const HierarchyNodeDataOpsReal& foo): - HierarchyDataOpsReal() -{ - NULL_USE(foo); -} - -template -void -HierarchyNodeDataOpsReal::operator = ( - const HierarchyNodeDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -154,7 +128,7 @@ HierarchyNodeDataOpsReal::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -162,13 +136,14 @@ HierarchyNodeDataOpsReal::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -186,12 +161,12 @@ HierarchyNodeDataOpsReal::swapData( #ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(d_hierarchy); boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); @@ -200,7 +175,7 @@ HierarchyNodeDataOpsReal::swapData( && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); #endif - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -229,7 +204,7 @@ HierarchyNodeDataOpsReal::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -238,8 +213,8 @@ HierarchyNodeDataOpsReal::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -262,7 +237,7 @@ HierarchyNodeDataOpsReal::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -270,8 +245,8 @@ HierarchyNodeDataOpsReal::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -303,7 +278,7 @@ HierarchyNodeDataOpsReal::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -311,13 +286,14 @@ HierarchyNodeDataOpsReal::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -339,7 +315,7 @@ HierarchyNodeDataOpsReal::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -347,13 +323,14 @@ HierarchyNodeDataOpsReal::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -375,7 +352,7 @@ HierarchyNodeDataOpsReal::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -383,16 +360,18 @@ HierarchyNodeDataOpsReal::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -414,7 +393,7 @@ HierarchyNodeDataOpsReal::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -422,16 +401,18 @@ HierarchyNodeDataOpsReal::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -453,7 +434,7 @@ HierarchyNodeDataOpsReal::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -461,16 +442,18 @@ HierarchyNodeDataOpsReal::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -492,7 +475,7 @@ HierarchyNodeDataOpsReal::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -500,16 +483,18 @@ HierarchyNodeDataOpsReal::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -530,7 +515,7 @@ HierarchyNodeDataOpsReal::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -538,13 +523,14 @@ HierarchyNodeDataOpsReal::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -568,7 +554,7 @@ HierarchyNodeDataOpsReal::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -576,16 +562,18 @@ HierarchyNodeDataOpsReal::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -608,7 +596,7 @@ HierarchyNodeDataOpsReal::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -616,16 +604,18 @@ HierarchyNodeDataOpsReal::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -648,7 +638,7 @@ HierarchyNodeDataOpsReal::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -656,16 +646,18 @@ HierarchyNodeDataOpsReal::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -686,7 +678,7 @@ HierarchyNodeDataOpsReal::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -694,13 +686,14 @@ HierarchyNodeDataOpsReal::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -722,7 +715,7 @@ HierarchyNodeDataOpsReal::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -730,8 +723,8 @@ HierarchyNodeDataOpsReal::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(data); @@ -751,7 +744,7 @@ HierarchyNodeDataOpsReal::setRandomValues( */ template -int +size_t HierarchyNodeDataOpsReal::numberOfEntries( const int data_id, const bool interior_only) const @@ -763,24 +756,25 @@ HierarchyNodeDataOpsReal::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); - int entries = 0; + size_t entries = 0; if (interior_only) { - boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > dfact( + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); - TBOX_ASSERT(npatches == d_nonoverlapping_node_boxes[ln].getSize()); + TBOX_ASSERT(npatches == + static_cast(d_nonoverlapping_node_boxes[ln].size())); - for (int il = 0; il < npatches; il++) { + for (int il = 0; il < npatches; ++il) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_node_boxes[ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_node_boxes[ln])[il]).end(); ++lb) { @@ -793,14 +787,14 @@ HierarchyNodeDataOpsReal::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -808,9 +802,9 @@ HierarchyNodeDataOpsReal::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -834,7 +828,7 @@ HierarchyNodeDataOpsReal::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -842,12 +836,13 @@ HierarchyNodeDataOpsReal::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(data); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -879,7 +874,7 @@ HierarchyNodeDataOpsReal::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -887,22 +882,22 @@ HierarchyNodeDataOpsReal::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -948,7 +943,7 @@ HierarchyNodeDataOpsReal::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -956,25 +951,26 @@ HierarchyNodeDataOpsReal::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -1036,7 +1032,7 @@ HierarchyNodeDataOpsReal::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1044,22 +1040,22 @@ HierarchyNodeDataOpsReal::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -1092,7 +1088,7 @@ HierarchyNodeDataOpsReal::dot( TYPE dprod = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1100,25 +1096,26 @@ HierarchyNodeDataOpsReal::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } @@ -1146,7 +1143,7 @@ HierarchyNodeDataOpsReal::integral( TYPE local_integral = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1154,11 +1151,11 @@ HierarchyNodeDataOpsReal::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1200,7 +1197,7 @@ HierarchyNodeDataOpsReal::computeConstrProdPos( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1208,25 +1205,26 @@ HierarchyNodeDataOpsReal::computeConstrProdPos( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.computeConstrProdPos(d1, d2, box, cv)); } @@ -1252,7 +1250,7 @@ HierarchyNodeDataOpsReal::compareToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1260,25 +1258,26 @@ HierarchyNodeDataOpsReal::compareToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); d_patch_ops.compareToScalar(dst, src, alpha, box, cv); } } @@ -1300,7 +1299,7 @@ HierarchyNodeDataOpsReal::testReciprocal( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1308,25 +1307,26 @@ HierarchyNodeDataOpsReal::testReciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.testReciprocal(dst, src, box, cv)); } @@ -1355,7 +1355,7 @@ HierarchyNodeDataOpsReal::maxPointwiseDivide( TYPE max = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1363,11 +1363,14 @@ HierarchyNodeDataOpsReal::maxPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1400,7 +1403,7 @@ HierarchyNodeDataOpsReal::minPointwiseDivide( TYPE min = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1408,11 +1411,14 @@ HierarchyNodeDataOpsReal::minPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1444,7 +1450,7 @@ HierarchyNodeDataOpsReal::min( TYPE minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1452,8 +1458,8 @@ HierarchyNodeDataOpsReal::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -1485,7 +1491,7 @@ HierarchyNodeDataOpsReal::max( TYPE maxval = -tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1493,8 +1499,8 @@ HierarchyNodeDataOpsReal::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.h index e4814d7c..d62d0343 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchyNodeDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real node data on multiple levels. * ************************************************************************/ @@ -17,9 +17,8 @@ #include "SAMRAI/math/PatchNodeDataOpsReal.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -53,7 +52,7 @@ namespace math { * HierarchyNodeDataOpsComplex and HierarchyNodeDataOpsInteger, * respectively. * - * @see math::PatchNodeDataOpsReal + * @see PatchNodeDataOpsReal */ template @@ -70,6 +69,8 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchyNodeDataOpsReal( const boost::shared_ptr& hierarchy, @@ -83,6 +84,8 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -90,7 +93,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -105,6 +111,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -114,6 +124,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -122,6 +136,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -131,6 +149,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -140,6 +162,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -150,6 +176,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -160,6 +190,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -171,6 +205,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -181,6 +219,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -192,6 +234,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -203,6 +249,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -214,6 +264,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -228,6 +282,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -241,6 +299,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +314,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -261,6 +327,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE min( @@ -269,6 +339,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE max( @@ -279,6 +353,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * Set data entries to random values. See the operations in the * array data operation classes for each data type for details on the * generation of the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -294,17 +372,26 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -319,6 +406,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * \f$\sum_i ( \| data_i \| )\f$. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -348,6 +439,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is not defined * (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -388,6 +483,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * (vol_id < 0), it is ignored during the computation of the maximum. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -402,6 +501,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE dot( @@ -413,6 +516,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE integral( @@ -424,6 +531,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * any \f$i\f$ in the set of patch data indices, where \f$cvol_i > 0\f$. Otherwise, * return 0. If the control volume is undefined (vol_id < 0), all values * on the patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int computeConstrProdPos( @@ -436,6 +547,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is undefined (vol_id < 0), all values on the patch interiors * are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void compareToScalar( @@ -450,6 +565,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. * If the control volume is undefined (vol_id < 0), all values on the * patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int testReciprocal( @@ -469,6 +588,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE maxPointwiseDivide( @@ -489,6 +612,10 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE minPointwiseDivide( @@ -498,15 +625,15 @@ class HierarchyNodeDataOpsReal:public HierarchyDataOpsReal private: // The following are not implemented HierarchyNodeDataOpsReal( - const HierarchyNodeDataOpsReal&); - void + const HierarchyNodeDataOpsReal&); + HierarchyNodeDataOpsReal& operator = ( - const HierarchyNodeDataOpsReal&); + const HierarchyNodeDataOpsReal&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_node_boxes; + std::vector > d_nonoverlapping_node_boxes; PatchNodeDataOpsReal d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.C index 4e077374..3218f1b3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex side data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchySideDataOpsComplex_C -#define included_math_HierarchySideDataOpsComplex_C - #include "SAMRAI/math/HierarchySideDataOpsComplex.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" @@ -83,18 +79,18 @@ HierarchySideDataOpsComplex::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_side_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_side_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer side_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { side_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(side_boxes); + for (hier::BoxContainer::iterator i = side_boxes.begin(); i != side_boxes.end(); ++i) { *i = pdat::SideGeometry::toSideBox(*i, nd); } @@ -130,7 +126,7 @@ HierarchySideDataOpsComplex::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -138,13 +134,14 @@ HierarchySideDataOpsComplex::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -160,12 +157,12 @@ HierarchySideDataOpsComplex::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == @@ -178,7 +175,7 @@ HierarchySideDataOpsComplex::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -206,7 +203,7 @@ HierarchySideDataOpsComplex::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -215,8 +212,8 @@ HierarchySideDataOpsComplex::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -238,7 +235,7 @@ HierarchySideDataOpsComplex::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -246,8 +243,8 @@ HierarchySideDataOpsComplex::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -278,7 +275,7 @@ HierarchySideDataOpsComplex::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -286,13 +283,14 @@ HierarchySideDataOpsComplex::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -313,7 +311,7 @@ HierarchySideDataOpsComplex::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -321,13 +319,14 @@ HierarchySideDataOpsComplex::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -348,7 +347,7 @@ HierarchySideDataOpsComplex::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -356,16 +355,18 @@ HierarchySideDataOpsComplex::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -386,7 +387,7 @@ HierarchySideDataOpsComplex::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -394,16 +395,18 @@ HierarchySideDataOpsComplex::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -424,7 +427,7 @@ HierarchySideDataOpsComplex::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -432,16 +435,18 @@ HierarchySideDataOpsComplex::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -462,7 +467,7 @@ HierarchySideDataOpsComplex::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -470,16 +475,18 @@ HierarchySideDataOpsComplex::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -499,7 +506,7 @@ HierarchySideDataOpsComplex::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -507,13 +514,14 @@ HierarchySideDataOpsComplex::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -536,7 +544,7 @@ HierarchySideDataOpsComplex::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -544,16 +552,18 @@ HierarchySideDataOpsComplex::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -575,7 +585,7 @@ HierarchySideDataOpsComplex::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -583,16 +593,18 @@ HierarchySideDataOpsComplex::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -614,7 +626,7 @@ HierarchySideDataOpsComplex::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -622,16 +634,18 @@ HierarchySideDataOpsComplex::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -651,7 +665,7 @@ HierarchySideDataOpsComplex::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -659,13 +673,14 @@ HierarchySideDataOpsComplex::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -686,7 +701,7 @@ HierarchySideDataOpsComplex::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -694,8 +709,8 @@ HierarchySideDataOpsComplex::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -714,7 +729,7 @@ HierarchySideDataOpsComplex::setRandomValues( ************************************************************************* */ -int +size_t HierarchySideDataOpsComplex::numberOfEntries( const int data_id, const bool interior_only) const @@ -727,34 +742,34 @@ HierarchySideDataOpsComplex::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); const hier::IntVector& directions = dfact->getDirectionVector(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int dc = 0; dc < dimVal; dc++) { - TBOX_ASSERT(npatches == d_nonoverlapping_side_boxes[dc][ln].getSize()); + for (int dc = 0; dc < dimVal; ++dc) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_side_boxes[dc][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (int eb = 0; eb < dimVal; ++eb) { if (directions(eb)) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_side_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_side_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -766,14 +781,14 @@ HierarchySideDataOpsComplex::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -781,9 +796,9 @@ HierarchySideDataOpsComplex::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -807,7 +822,7 @@ HierarchySideDataOpsComplex::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -815,12 +830,13 @@ HierarchySideDataOpsComplex::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(d); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -850,7 +866,7 @@ HierarchySideDataOpsComplex::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -858,22 +874,22 @@ HierarchySideDataOpsComplex::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(d, box, cv); } } @@ -912,7 +928,7 @@ HierarchySideDataOpsComplex::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -920,25 +936,26 @@ HierarchySideDataOpsComplex::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > w( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + TBOX_ASSERT(w); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(d, w, box, cv); norm_squared += pnorm * pnorm; @@ -996,7 +1013,7 @@ HierarchySideDataOpsComplex::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1004,22 +1021,22 @@ HierarchySideDataOpsComplex::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(d); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d); - box = d->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(d, box, cv)); } @@ -1047,7 +1064,7 @@ HierarchySideDataOpsComplex::dot( dcomplex dprod = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1055,34 +1072,46 @@ HierarchySideDataOpsComplex::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > d1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > d2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(d1); + TBOX_ASSERT(d2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(d1); - box = d1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(d1, d2, box, cv); } } - dcomplex global_dot = dprod; if (mpi.getSize() > 1) { - mpi.Allreduce(&dprod, &global_dot, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = dprod.real(); + double imag_part = dprod.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_dot(global_real_part, global_imag_part); + return global_dot; + } else { + return dprod; } - return global_dot; } dcomplex @@ -1099,7 +1128,7 @@ HierarchySideDataOpsComplex::integral( dcomplex local_integral = dcomplex(0.0, 0.0); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1107,11 +1136,11 @@ HierarchySideDataOpsComplex::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1122,13 +1151,23 @@ HierarchySideDataOpsComplex::integral( } } - dcomplex global_integral = local_integral; if (mpi.getSize() > 1) { - mpi.Allreduce(&local_integral, &global_integral, 1, MPI_DOUBLE_COMPLEX, MPI_SUM); + // It should be possible to do this with a single Allreduce and a + // datatype of MPI_C_DOUBLE_COMPLEX. However, while recent versions of + // openmpi define this datatype their implementations of Allreduce do not + // recognize it. + double real_part = local_integral.real(); + double imag_part = local_integral.imag(); + double global_real_part; + double global_imag_part; + mpi.Allreduce(&real_part, &global_real_part, 1, MPI_DOUBLE, MPI_SUM); + mpi.Allreduce(&imag_part, &global_imag_part, 1, MPI_DOUBLE, MPI_SUM); + dcomplex global_integral(global_real_part, global_imag_part); + return global_integral; + } else { + return local_integral; } - return global_integral; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.h index eaf7685c..508450be 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex side data on multiple levels. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,7 +52,7 @@ namespace math { * HierarchySideDataOpsReal and HierarchySideDataOpsInteger, * respectively. * - * @see math::PatchSideDataOpsComplex + * @see PatchSideDataOpsComplex */ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex @@ -68,6 +68,8 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchySideDataOpsComplex( const boost::shared_ptr& hierarchy, @@ -81,6 +83,8 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -88,7 +92,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -103,6 +110,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -112,6 +123,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -120,6 +135,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -129,6 +148,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -138,6 +161,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -148,6 +175,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -158,6 +189,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -169,6 +204,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -179,6 +218,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -190,6 +233,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -201,6 +248,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -212,6 +263,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -226,6 +281,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -239,6 +298,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +315,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * Set destination data to absolute value of source data, pointwise. * Note that the source data must be dcomplex and the destination must * be double. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -263,6 +330,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -278,17 +349,26 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of * hierarchy levels. + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double sumControlVolumes( @@ -301,6 +381,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is undefined (vol_id < 0), the * return value is \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -327,6 +411,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is undefined (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -366,6 +454,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * over the data elements where \f$cvol_i > 0\f$. If the control volume is * undefined (vol_id < 0), it is ignored during the computation of the * maximum. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -378,6 +470,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex dot( @@ -388,6 +484,10 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ dcomplex integral( @@ -398,18 +498,15 @@ class HierarchySideDataOpsComplex:public HierarchyDataOpsComplex // The following are not implemented HierarchySideDataOpsComplex( const HierarchySideDataOpsComplex&); - void + HierarchySideDataOpsComplex& operator = ( const HierarchySideDataOpsComplex&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_side_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_side_boxes[SAMRAI::MAX_DIM_VAL]; PatchSideDataOpsComplex d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.C index 70ebe129..c3ee1abd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer side data on multiple levels. * ************************************************************************/ - -#ifndef included_math_HierarchySideDataOpsInteger_C -#define included_math_HierarchySideDataOpsInteger_C - #include "SAMRAI/math/HierarchySideDataOpsInteger.h" #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/BoxContainer.h" @@ -84,18 +80,18 @@ HierarchySideDataOpsInteger::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_side_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_side_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer side_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { side_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(side_boxes); + for (hier::BoxContainer::iterator i = side_boxes.begin(); i != side_boxes.end(); ++i) { *i = pdat::SideGeometry::toSideBox(*i, nd); } @@ -120,7 +116,7 @@ HierarchySideDataOpsInteger::getPatchHierarchy() const ************************************************************************* */ -int +size_t HierarchySideDataOpsInteger::numberOfEntries( const int data_id, const bool interior_only) const @@ -133,34 +129,34 @@ HierarchySideDataOpsInteger::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); const hier::IntVector& directions = dfact->getDirectionVector(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int dc = 0; dc < dimVal; dc++) { - TBOX_ASSERT(npatches == d_nonoverlapping_side_boxes[dc][ln].getSize()); + for (int dc = 0; dc < dimVal; ++dc) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_side_boxes[dc][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (int eb = 0; eb < dimVal; ++eb) { if (directions(eb)) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_side_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_side_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -172,14 +168,14 @@ HierarchySideDataOpsInteger::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -187,9 +183,9 @@ HierarchySideDataOpsInteger::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -209,7 +205,7 @@ HierarchySideDataOpsInteger::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -217,13 +213,14 @@ HierarchySideDataOpsInteger::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -239,12 +236,12 @@ HierarchySideDataOpsInteger::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); TBOX_ASSERT(d1fact->getGhostCellWidth() == @@ -257,7 +254,7 @@ HierarchySideDataOpsInteger::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -285,7 +282,7 @@ HierarchySideDataOpsInteger::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -294,8 +291,8 @@ HierarchySideDataOpsInteger::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -317,7 +314,7 @@ HierarchySideDataOpsInteger::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -325,8 +322,8 @@ HierarchySideDataOpsInteger::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -357,7 +354,7 @@ HierarchySideDataOpsInteger::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -365,13 +362,14 @@ HierarchySideDataOpsInteger::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -392,7 +390,7 @@ HierarchySideDataOpsInteger::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -400,13 +398,14 @@ HierarchySideDataOpsInteger::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -427,7 +426,7 @@ HierarchySideDataOpsInteger::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -435,16 +434,18 @@ HierarchySideDataOpsInteger::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -465,7 +466,7 @@ HierarchySideDataOpsInteger::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -473,16 +474,18 @@ HierarchySideDataOpsInteger::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -503,7 +506,7 @@ HierarchySideDataOpsInteger::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -511,16 +514,18 @@ HierarchySideDataOpsInteger::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -541,7 +546,7 @@ HierarchySideDataOpsInteger::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -549,16 +554,18 @@ HierarchySideDataOpsInteger::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -578,7 +585,7 @@ HierarchySideDataOpsInteger::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -586,13 +593,14 @@ HierarchySideDataOpsInteger::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -615,7 +623,7 @@ HierarchySideDataOpsInteger::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -623,16 +631,18 @@ HierarchySideDataOpsInteger::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -654,7 +664,7 @@ HierarchySideDataOpsInteger::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -662,16 +672,18 @@ HierarchySideDataOpsInteger::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -693,7 +705,7 @@ HierarchySideDataOpsInteger::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -701,16 +713,18 @@ HierarchySideDataOpsInteger::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > s1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > s2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(d); + TBOX_ASSERT(s1); + TBOX_ASSERT(s2); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -730,7 +744,7 @@ HierarchySideDataOpsInteger::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -738,13 +752,14 @@ HierarchySideDataOpsInteger::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(d); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : d->getGhostBox()); @@ -767,7 +782,7 @@ HierarchySideDataOpsInteger::min( int minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -775,8 +790,8 @@ HierarchySideDataOpsInteger::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -808,7 +823,7 @@ HierarchySideDataOpsInteger::max( int maxval = -(tbox::MathUtilities::getMax()); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -816,8 +831,8 @@ HierarchySideDataOpsInteger::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -847,7 +862,7 @@ HierarchySideDataOpsInteger::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -855,8 +870,8 @@ HierarchySideDataOpsInteger::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -869,4 +884,3 @@ HierarchySideDataOpsInteger::setRandomValues( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.h index f4e0f41d..2ade57a9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer side data on multiple levels. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -51,7 +51,7 @@ namespace math { * HierarchySideDataOpsReal and HierarchySideDataOpsComplex, * respectively. * - * @see math::PatchSideDataOpsInteger + * @see PatchSideDataOpsInteger */ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger @@ -67,6 +67,8 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchySideDataOpsInteger( const boost::shared_ptr& hierarchy, @@ -80,6 +82,8 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -87,7 +91,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -107,14 +114,22 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -124,6 +139,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -132,6 +151,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -141,6 +164,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -150,6 +177,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -160,6 +191,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -170,6 +205,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -181,6 +220,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -191,6 +234,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -202,6 +249,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -213,6 +264,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -224,6 +279,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -238,6 +297,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -251,6 +314,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -262,6 +329,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -271,6 +342,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int min( @@ -279,6 +354,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int max( @@ -289,6 +368,10 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger * Set data entries to random values. See the operations in the * array data operation classes for details on the generation of * the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -301,18 +384,15 @@ class HierarchySideDataOpsInteger:public HierarchyDataOpsInteger // The following are not implemented HierarchySideDataOpsInteger( const HierarchySideDataOpsInteger&); - void + HierarchySideDataOpsInteger& operator = ( const HierarchySideDataOpsInteger&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_side_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE - ]; + std::vector > + d_nonoverlapping_side_boxes[SAMRAI::MAX_DIM_VAL]; PatchSideDataOpsInteger d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.C index e9784d2b..aab51793 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real side data on multiple levels. * ************************************************************************/ @@ -86,18 +86,18 @@ HierarchySideDataOpsReal::resetLevels( d_coarsest_level = coarsest_level; d_finest_level = finest_level; - for (int d = 0; d < dimVal; d++) { - d_nonoverlapping_side_boxes[d].resizeArray(d_finest_level + 1); + for (int d = 0; d < dimVal; ++d) { + d_nonoverlapping_side_boxes[d].resize(d_finest_level + 1); } - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); hier::BoxContainer side_boxes; - for (int nd = 0; nd < dimVal; nd++) { + for (tbox::Dimension::dir_t nd = 0; nd < dimVal; ++nd) { side_boxes = level->getBoxes(); - for (hier::BoxContainer::iterator i(side_boxes); + for (hier::BoxContainer::iterator i = side_boxes.begin(); i != side_boxes.end(); ++i) { *i = pdat::SideGeometry::toSideBox(*i, nd); } @@ -115,32 +115,6 @@ HierarchySideDataOpsReal::getPatchHierarchy() const return d_hierarchy; } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -HierarchySideDataOpsReal::HierarchySideDataOpsReal( - const HierarchySideDataOpsReal& foo): - HierarchyDataOpsReal() -{ - NULL_USE(foo); -} - -template -void -HierarchySideDataOpsReal::operator = ( - const HierarchySideDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -161,7 +135,7 @@ HierarchySideDataOpsReal::copyData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -169,13 +143,14 @@ HierarchySideDataOpsReal::copyData( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -192,16 +167,15 @@ HierarchySideDataOpsReal::swapData( { #ifdef DEBUG_CHECK_ASSERTIONS boost::shared_ptr > d1fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data1_id))); TBOX_ASSERT(d1fact); boost::shared_ptr > d2fact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data2_id))); TBOX_ASSERT(d2fact); TBOX_ASSERT(d1fact->getDepth() == d2fact->getDepth()); - TBOX_ASSERT(d1fact->getGhostCellWidth() == - d2fact->getGhostCellWidth()); + TBOX_ASSERT(d1fact->getGhostCellWidth() == d2fact->getGhostCellWidth()); TBOX_ASSERT(d1fact->getDirectionVector() == d2fact->getDirectionVector()); #endif @@ -210,7 +184,7 @@ HierarchySideDataOpsReal::swapData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -239,7 +213,7 @@ HierarchySideDataOpsReal::printData( getPatchDataFactory(data_id)).name() << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Level number = " << ln << std::endl; boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); @@ -248,8 +222,8 @@ HierarchySideDataOpsReal::printData( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -272,7 +246,7 @@ HierarchySideDataOpsReal::setToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -280,8 +254,8 @@ HierarchySideDataOpsReal::setToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -313,7 +287,7 @@ HierarchySideDataOpsReal::scale( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -321,13 +295,14 @@ HierarchySideDataOpsReal::scale( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -349,7 +324,7 @@ HierarchySideDataOpsReal::addScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -357,13 +332,14 @@ HierarchySideDataOpsReal::addScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -385,7 +361,7 @@ HierarchySideDataOpsReal::add( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -393,16 +369,18 @@ HierarchySideDataOpsReal::add( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -424,7 +402,7 @@ HierarchySideDataOpsReal::subtract( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -432,16 +410,18 @@ HierarchySideDataOpsReal::subtract( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -463,7 +443,7 @@ HierarchySideDataOpsReal::multiply( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -471,16 +451,18 @@ HierarchySideDataOpsReal::multiply( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -502,7 +484,7 @@ HierarchySideDataOpsReal::divide( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -510,16 +492,18 @@ HierarchySideDataOpsReal::divide( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -540,7 +524,7 @@ HierarchySideDataOpsReal::reciprocal( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -548,13 +532,14 @@ HierarchySideDataOpsReal::reciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -578,7 +563,7 @@ HierarchySideDataOpsReal::linearSum( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -586,16 +571,18 @@ HierarchySideDataOpsReal::linearSum( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -618,7 +605,7 @@ HierarchySideDataOpsReal::axpy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -626,16 +613,18 @@ HierarchySideDataOpsReal::axpy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -658,7 +647,7 @@ HierarchySideDataOpsReal::axmy( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -666,16 +655,18 @@ HierarchySideDataOpsReal::axmy( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src1( - p->getPatchData(src1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src1_id))); boost::shared_ptr > src2( - p->getPatchData(src2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src2_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src1); + TBOX_ASSERT(src2); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -696,7 +687,7 @@ HierarchySideDataOpsReal::abs( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -704,13 +695,14 @@ HierarchySideDataOpsReal::abs( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); TBOX_ASSERT(dst); + TBOX_ASSERT(src); hier::Box box = (interior_only ? p->getBox() : dst->getGhostBox()); @@ -732,7 +724,7 @@ HierarchySideDataOpsReal::setRandomValues( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -740,8 +732,8 @@ HierarchySideDataOpsReal::setRandomValues( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(data); @@ -761,7 +753,7 @@ HierarchySideDataOpsReal::setRandomValues( */ template -int +size_t HierarchySideDataOpsReal::numberOfEntries( const int data_id, const bool interior_only) const @@ -773,34 +765,34 @@ HierarchySideDataOpsReal::numberOfEntries( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); int dimVal = d_hierarchy->getDim().getValue(); - int entries = 0; + size_t entries = 0; if (interior_only) { boost::shared_ptr > dfact( - d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchDataFactory>( + d_hierarchy->getPatchDescriptor()->getPatchDataFactory(data_id))); TBOX_ASSERT(dfact); const hier::IntVector& directions = dfact->getDirectionVector(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); const int npatches = level->getNumberOfPatches(); #ifdef DEBUG_CHECK_ASSERTIONS - for (int dc = 0; dc < dimVal; dc++) { - TBOX_ASSERT(npatches == d_nonoverlapping_side_boxes[dc][ln].getSize()); + for (int dc = 0; dc < dimVal; ++dc) { + TBOX_ASSERT(npatches == static_cast(d_nonoverlapping_side_boxes[dc][ln].size())); } #endif - for (int il = 0; il < npatches; il++) { - for (int eb = 0; eb < dimVal; eb++) { + for (int il = 0; il < npatches; ++il) { + for (int eb = 0; eb < dimVal; ++eb) { if (directions(eb)) { hier::BoxContainer::const_iterator lb = ((d_nonoverlapping_side_boxes[eb][ln])[il]).begin(); for ( ; lb != ((d_nonoverlapping_side_boxes[eb][ln])[il]).end(); - ++lb) { + ++lb) { entries += lb->size(); } } @@ -812,14 +804,14 @@ HierarchySideDataOpsReal::numberOfEntries( } else { - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { boost::shared_ptr > d( - (*ip)->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + (*ip)->getPatchData(data_id))); TBOX_ASSERT(d); @@ -827,9 +819,9 @@ HierarchySideDataOpsReal::numberOfEntries( } } - int global_entries = entries; + unsigned long int global_entries = entries; if (mpi.getSize() > 1) { - mpi.Allreduce(&entries, &global_entries, 1, MPI_INT, MPI_SUM); + mpi.Allreduce(&entries, &global_entries, 1, MPI_UNSIGNED_LONG, MPI_SUM); } entries = global_entries; @@ -854,7 +846,7 @@ HierarchySideDataOpsReal::sumControlVolumes( double sum = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -862,12 +854,13 @@ HierarchySideDataOpsReal::sumControlVolumes( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > cv( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); + TBOX_ASSERT(data); TBOX_ASSERT(cv); hier::Box box = cv->getGhostBox(); @@ -899,7 +892,7 @@ HierarchySideDataOpsReal::L1Norm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -907,22 +900,22 @@ HierarchySideDataOpsReal::L1Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm += d_patch_ops.L1Norm(data, box, cv); } } @@ -968,7 +961,7 @@ HierarchySideDataOpsReal::weightedL2Norm( double norm_squared = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -976,25 +969,26 @@ HierarchySideDataOpsReal::weightedL2Norm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > weight( - p->getPatchData(wgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(wgt_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + TBOX_ASSERT(weight); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); double pnorm = d_patch_ops.weightedL2Norm(data, weight, box, cv); norm_squared += pnorm * pnorm; @@ -1056,7 +1050,7 @@ HierarchySideDataOpsReal::maxNorm( double norm = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1064,22 +1058,22 @@ HierarchySideDataOpsReal::maxNorm( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr pd; + TBOX_ASSERT(data); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data); - box = data->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); norm = tbox::MathUtilities::Max(norm, d_patch_ops.maxNorm(data, box, cv)); } @@ -1112,7 +1106,7 @@ HierarchySideDataOpsReal::dot( TYPE dprod = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1120,25 +1114,26 @@ HierarchySideDataOpsReal::dot( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); dprod += d_patch_ops.dot(data1, data2, box, cv); } } @@ -1166,7 +1161,7 @@ HierarchySideDataOpsReal::integral( TYPE local_integral = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1174,11 +1169,11 @@ HierarchySideDataOpsReal::integral( const boost::shared_ptr& p = *ip; boost::shared_ptr > data( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); boost::shared_ptr > vol( - p->getPatchData(vol_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(vol_id))); TBOX_ASSERT(data); TBOX_ASSERT(vol); @@ -1220,7 +1215,7 @@ HierarchySideDataOpsReal::computeConstrProdPos( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1228,25 +1223,26 @@ HierarchySideDataOpsReal::computeConstrProdPos( const boost::shared_ptr& p = *ip; boost::shared_ptr > data1( - p->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data1_id))); boost::shared_ptr > data2( - p->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data2_id))); boost::shared_ptr pd; + TBOX_ASSERT(data1); + TBOX_ASSERT(data2); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(data1); - box = data1->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.computeConstrProdPos(data1, data2, box, cv)); } @@ -1272,7 +1268,7 @@ HierarchySideDataOpsReal::compareToScalar( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1280,25 +1276,26 @@ HierarchySideDataOpsReal::compareToScalar( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); d_patch_ops.compareToScalar(dst, src, alpha, box, cv); } } @@ -1320,7 +1317,7 @@ HierarchySideDataOpsReal::testReciprocal( int test = 1; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1328,25 +1325,26 @@ HierarchySideDataOpsReal::testReciprocal( const boost::shared_ptr& p = *ip; boost::shared_ptr > dst( - p->getPatchData(dst_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(dst_id))); boost::shared_ptr > src( - p->getPatchData(src_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(src_id))); boost::shared_ptr pd; + TBOX_ASSERT(dst); + TBOX_ASSERT(src); + hier::Box box = p->getBox(); if (vol_id >= 0) { - TBOX_ASSERT(dst); - box = dst->getGhostBox(); pd = p->getPatchData(vol_id); } boost::shared_ptr > cv( - pd, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(pd)); test = tbox::MathUtilities::Min(test, d_patch_ops.testReciprocal(dst, src, box, cv)); } @@ -1375,7 +1373,7 @@ HierarchySideDataOpsReal::maxPointwiseDivide( TYPE max = 0.0; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1383,11 +1381,14 @@ HierarchySideDataOpsReal::maxPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1420,7 +1421,7 @@ HierarchySideDataOpsReal::minPointwiseDivide( TYPE min = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1428,11 +1429,14 @@ HierarchySideDataOpsReal::minPointwiseDivide( const boost::shared_ptr& p = *ip; boost::shared_ptr > numer( - p->getPatchData(numer_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(numer_id))); boost::shared_ptr > denom( - p->getPatchData(denom_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(denom_id))); + + TBOX_ASSERT(numer); + TBOX_ASSERT(denom); hier::Box box = p->getBox(); @@ -1464,7 +1468,7 @@ HierarchySideDataOpsReal::min( TYPE minval = tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1472,8 +1476,8 @@ HierarchySideDataOpsReal::min( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); @@ -1505,7 +1509,7 @@ HierarchySideDataOpsReal::max( TYPE maxval = -tbox::MathUtilities::getMax(); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -1513,8 +1517,8 @@ HierarchySideDataOpsReal::max( const boost::shared_ptr& p = *ip; boost::shared_ptr > d( - p->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + p->getPatchData(data_id))); TBOX_ASSERT(d); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.h index 961f8289..487207fc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/HierarchySideDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real side data on multiple levels. * ************************************************************************/ @@ -20,7 +20,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -53,7 +53,7 @@ namespace math { * HierarchySideDataOpsComplex and HierarchySideDataOpsInteger, * respectively. * - * @see math::PatchSideDataOpsReal + * @see PatchSideDataOpsReal */ template @@ -70,6 +70,8 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * be performed are those already existing in the hierarchy. If the * hierarchy level configuration changes, the operations must be explicitly * reset by calling the resetLevels() function. + * + * @pre hierarchy */ explicit HierarchySideDataOpsReal( const boost::shared_ptr& hierarchy, @@ -83,6 +85,8 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Reset patch hierarchy over which operations occur. + * + * @pre hierarchy */ void setPatchHierarchy( @@ -90,7 +94,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Reset range of patch levels over which operations occur. - * Levels must exist in hierarchy or an assertion will result. + * + * @pre getPatchHierarchy() + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void resetLevels( @@ -105,6 +112,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Copy source data to destination data. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void copyData( @@ -114,6 +125,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Swap data pointers (i.e., storage) between two data components. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void swapData( @@ -122,6 +137,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Print data over multiple levels to specified output stream. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void printData( @@ -131,6 +150,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set data component to given scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setToScalar( @@ -140,6 +163,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set destination to source multiplied by given scalar, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void scale( @@ -150,6 +177,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Add scalar to each entry in source data and set destination to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void addScalar( @@ -160,6 +191,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set destination to sum of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void add( @@ -171,6 +206,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Subtract second source component from first source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void subtract( @@ -181,6 +220,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set destination component to product of two source components, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void multiply( @@ -192,6 +235,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Divide first data component by second source component pointwise * and set destination data component to result. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void divide( @@ -203,6 +250,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set each entry of destination component to reciprocal of corresponding * source data component entry. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void reciprocal( @@ -214,6 +265,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + \beta s_2\f$, where \f$d\f$ is the destination patch * data component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha, \beta\f$ are scalar values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void linearSum( @@ -228,6 +283,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 + s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axpy( @@ -241,6 +300,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * Set \f$d = \alpha s_1 - s_2\f$, where \f$d\f$ is the destination patch data * component and \f$s_1, s_2\f$ are the first and second source components, * respectively. Here \f$\alpha\f$ is a scalar. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void axmy( @@ -252,6 +315,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Set destination data to absolute value of source data, pointwise. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void abs( @@ -261,6 +328,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Return minimum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE min( @@ -269,6 +340,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Return maximum data value over all patches in the collection of levels. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE max( @@ -279,6 +354,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * Set data entries to random values. See the operations in the * array data operation classes for each data type for details on the * generation of the random values. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void setRandomValues( @@ -294,16 +373,25 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * avoids multiple counting of redundant values (recall the definition * of node points on a patch interior). If the boolean argument is false, * all elements will be counted (including ghost values) over all patches. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ - int + size_t numberOfEntries( const int data_id, const bool interior_only = true) const; /** * Return sum of the control volumes associated with the data component. - * Note that if the ontrol volumes are set propery, this is equivalent to + * Note that if the control volumes are set properly, this is equivalent to * integrating a data component containing all ones over the collection of + * + * @pre vol_id >= 0 + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) * hierarchy levels. */ double @@ -319,6 +407,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * \f$\sum_i ( \| data_i \| )\f$. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double L1Norm( @@ -348,6 +440,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is not defined * (vol_id < 0), the return value is * \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double weightedL2Norm( @@ -388,6 +484,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * (vol_id < 0), it is ignored during the computation of the maximum. * If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ double maxNorm( @@ -402,6 +502,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * If the control volume is undefined (vol_id < 0), it is ignored during * the summation. If local_only is true, the global reduction is not * performed (thus each process will get only local results). + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE dot( @@ -413,6 +517,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE integral( @@ -424,6 +532,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * any \f$i\f$ in the set of patch data indices, where \f$cvol_i > 0\f$. Otherwise, * return 0. If the control volume is undefined (vol_id < 0), all values * on the patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int computeConstrProdPos( @@ -436,6 +548,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is undefined (vol_id < 0), all values on the patch interiors * are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ void compareToScalar( @@ -450,6 +566,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * If \f$dst_i = 0\f$ anywhere, 0 is the return value. Otherwise 1 is returned. * If the control volume is undefined (vol_id < 0), all values on the * patch interiors are considered. + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ int testReciprocal( @@ -469,6 +589,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE maxPointwiseDivide( @@ -489,6 +613,10 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre getPatchHierarchy() + * @pre (d_coarsest_level >= 0) && (d_finest_level >= d_coarsest_level) && + * (d_finest_level <= getPatchHierarchy()->getFinestLevelNumber()) */ TYPE minPointwiseDivide( @@ -499,18 +627,16 @@ class HierarchySideDataOpsReal:public HierarchyDataOpsReal private: // The following are not implemented HierarchySideDataOpsReal( - const HierarchySideDataOpsReal&); - void + const HierarchySideDataOpsReal&); + HierarchySideDataOpsReal& operator = ( - const HierarchySideDataOpsReal&); + const HierarchySideDataOpsReal&); boost::shared_ptr d_hierarchy; int d_coarsest_level; int d_finest_level; - tbox::Array > d_nonoverlapping_side_boxes[tbox:: - Dimension - :: - MAXIMUM_DIMENSION_VALUE]; + std::vector > + d_nonoverlapping_side_boxes[SAMRAI::MAX_DIM_VAL]; PatchSideDataOpsReal d_patch_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.depend index a80c2646..2d6d4bf0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -25,6 +25,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ @@ -33,7 +34,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -45,23 +45,20 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=ArrayDataMiscellaneousOpsReal.o DEPENDS_1:=\ @@ -77,6 +74,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ @@ -85,7 +83,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -97,24 +94,21 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ ArrayDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=ArrayDataNormOpsComplex.o DEPENDS_2:=\ @@ -130,6 +124,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ @@ -137,7 +132,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -149,23 +143,20 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=ArrayDataNormOpsInteger.o DEPENDS_3:=\ @@ -181,6 +172,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsInteger.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ @@ -188,7 +180,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -200,23 +191,20 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataNormOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=ArrayDataNormOpsReal.o DEPENDS_4:=\ @@ -232,6 +220,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ @@ -240,7 +229,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -252,23 +240,20 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=HierarchyCellDataOpsComplex.o DEPENDS_5:=\ @@ -303,12 +288,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -330,7 +317,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -342,8 +328,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -353,7 +339,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyCellDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ @@ -363,11 +348,10 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=HierarchyCellDataOpsInteger.o DEPENDS_6:=\ @@ -402,12 +386,14 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -428,7 +414,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -440,8 +425,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -451,7 +436,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyCellDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ @@ -461,11 +445,10 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=HierarchyCellDataOpsReal.o DEPENDS_7:=\ @@ -500,12 +483,14 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -530,7 +515,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -542,8 +526,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -553,7 +537,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyCellDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -569,11 +552,10 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=HierarchyDataOpsComplex.o DEPENDS_8:=\ @@ -608,17 +590,18 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -629,8 +612,8 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -639,13 +622,11 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HierarchyDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_8}: ${DEPENDS_8} FILE_9=HierarchyDataOpsInteger.o DEPENDS_9:=\ @@ -680,17 +661,18 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsInteger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -701,8 +683,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -711,13 +693,11 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HierarchyDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} + +${FILE_9}: ${DEPENDS_9} FILE_10=HierarchyDataOpsManager.o DEPENDS_10:=\ @@ -753,12 +733,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -873,7 +855,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -885,8 +866,8 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -895,7 +876,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HierarchyDataOpsManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -953,11 +933,10 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} + +${FILE_10}: ${DEPENDS_10} FILE_11=HierarchyDataOpsReal.o DEPENDS_11:=\ @@ -992,18 +971,19 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1014,8 +994,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1024,13 +1004,11 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HierarchyDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} + +${FILE_11}: ${DEPENDS_11} FILE_12=HierarchyEdgeDataOpsComplex.o DEPENDS_12:=\ @@ -1066,12 +1044,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1096,7 +1076,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1108,8 +1087,8 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1119,7 +1098,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyEdgeDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ @@ -1131,11 +1109,10 @@ DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} + +${FILE_12}: ${DEPENDS_12} FILE_13=HierarchyEdgeDataOpsInteger.o DEPENDS_13:=\ @@ -1171,12 +1148,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1200,7 +1179,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1212,8 +1190,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1223,7 +1201,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyEdgeDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ @@ -1235,11 +1212,10 @@ DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_13}: ${DEPENDS_13} FILE_14=HierarchyEdgeDataOpsReal.o DEPENDS_14:=\ @@ -1275,12 +1251,14 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1308,7 +1286,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1320,8 +1297,8 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1331,7 +1308,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyEdgeDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1349,11 +1325,10 @@ DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_14}: ${DEPENDS_14} FILE_15=HierarchyFaceDataOpsComplex.o DEPENDS_15:=\ @@ -1389,12 +1364,14 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1419,7 +1396,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1431,8 +1407,8 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1442,7 +1418,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyFaceDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ @@ -1454,11 +1429,10 @@ DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} + +${FILE_15}: ${DEPENDS_15} FILE_16=HierarchyFaceDataOpsInteger.o DEPENDS_16:=\ @@ -1494,12 +1468,14 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1523,7 +1499,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1535,8 +1510,8 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1546,7 +1521,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyFaceDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ @@ -1558,11 +1532,10 @@ DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} + +${FILE_16}: ${DEPENDS_16} FILE_17=HierarchyFaceDataOpsReal.o DEPENDS_17:=\ @@ -1598,12 +1571,14 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1631,7 +1606,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1643,8 +1617,8 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1654,7 +1628,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyFaceDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1672,11 +1645,10 @@ DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} + +${FILE_17}: ${DEPENDS_17} FILE_18=HierarchyNodeDataOpsComplex.o DEPENDS_18:=\ @@ -1712,12 +1684,14 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1742,7 +1716,6 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1754,8 +1727,8 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1765,7 +1738,6 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyNodeDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ @@ -1777,11 +1749,10 @@ DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} + +${FILE_18}: ${DEPENDS_18} FILE_19=HierarchyNodeDataOpsInteger.o DEPENDS_19:=\ @@ -1817,12 +1788,14 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1846,7 +1819,6 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1858,8 +1830,8 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1869,7 +1841,6 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyNodeDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ @@ -1881,11 +1852,10 @@ DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} + +${FILE_19}: ${DEPENDS_19} FILE_20=HierarchyNodeDataOpsReal.o DEPENDS_20:=\ @@ -1921,12 +1891,14 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1954,7 +1926,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1966,8 +1937,8 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1977,7 +1948,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchyNodeDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1995,11 +1965,10 @@ DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} + +${FILE_20}: ${DEPENDS_20} FILE_21=HierarchySideDataOpsComplex.o DEPENDS_21:=\ @@ -2035,12 +2004,14 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2065,7 +2036,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2077,8 +2047,8 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2088,7 +2058,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchySideDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -2100,11 +2069,10 @@ DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} + +${FILE_21}: ${DEPENDS_21} FILE_22=HierarchySideDataOpsInteger.o DEPENDS_22:=\ @@ -2140,12 +2108,14 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2169,7 +2139,6 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2181,8 +2150,8 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2192,7 +2161,6 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchySideDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -2204,11 +2172,10 @@ DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} + +${FILE_22}: ${DEPENDS_22} FILE_23=HierarchySideDataOpsReal.o DEPENDS_23:=\ @@ -2244,12 +2211,14 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2277,7 +2246,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2289,8 +2257,8 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2300,7 +2268,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ HierarchySideDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2318,11 +2285,10 @@ DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} + +${FILE_23}: ${DEPENDS_23} FILE_24=PatchCellDataBasicOps.o DEPENDS_24:=\ @@ -2341,6 +2307,7 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ @@ -2355,7 +2322,6 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2367,13 +2333,13 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchCellDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2381,11 +2347,10 @@ DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} + +${FILE_24}: ${DEPENDS_24} FILE_25=PatchCellDataMiscellaneousOpsReal.o DEPENDS_25:=\ @@ -2404,6 +2369,7 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ @@ -2418,7 +2384,6 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2430,14 +2395,14 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchCellDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2445,11 +2410,10 @@ DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_25:X.o=${NDIM}.o}: ${DEPENDS_25} + +${FILE_25}: ${DEPENDS_25} FILE_26=PatchCellDataNormOpsComplex.o DEPENDS_26:=\ @@ -2468,6 +2432,7 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsComplex.h \ @@ -2481,7 +2446,6 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2493,25 +2457,24 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchCellDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_26:X.o=${NDIM}.o}: ${DEPENDS_26} + +${FILE_26}: ${DEPENDS_26} FILE_27=PatchCellDataNormOpsReal.o DEPENDS_27:=\ @@ -2530,6 +2493,7 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ @@ -2544,7 +2508,6 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2556,14 +2519,14 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchCellDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2571,11 +2534,10 @@ DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_27:X.o=${NDIM}.o}: ${DEPENDS_27} + +${FILE_27}: ${DEPENDS_27} FILE_28=PatchCellDataOpsComplex.o DEPENDS_28:=\ @@ -2601,6 +2563,7 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2620,7 +2583,6 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2632,13 +2594,13 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchCellDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_28 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ @@ -2647,11 +2609,10 @@ DEPENDS_28 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_28:X.o=${NDIM}.o}: ${DEPENDS_28} + +${FILE_28}: ${DEPENDS_28} FILE_29=PatchCellDataOpsInteger.o DEPENDS_29:=\ @@ -2677,6 +2638,7 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2695,7 +2657,6 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2707,13 +2668,13 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchCellDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_29 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ @@ -2722,11 +2683,10 @@ DEPENDS_29 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_29:X.o=${NDIM}.o}: ${DEPENDS_29} + +${FILE_29}: ${DEPENDS_29} FILE_30=PatchCellDataOpsReal.o DEPENDS_30:=\ @@ -2752,6 +2712,7 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2774,7 +2735,6 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2786,13 +2746,13 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchCellDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2805,11 +2765,10 @@ DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_30:X.o=${NDIM}.o}: ${DEPENDS_30} + +${FILE_30}: ${DEPENDS_30} FILE_31=PatchEdgeDataBasicOps.o DEPENDS_31:=\ @@ -2828,6 +2787,7 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ @@ -2842,7 +2802,6 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2854,13 +2813,11 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchEdgeDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_31 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2868,11 +2825,10 @@ DEPENDS_31 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_31:X.o=${NDIM}.o}: ${DEPENDS_31} + +${FILE_31}: ${DEPENDS_31} FILE_32=PatchEdgeDataMiscellaneousOpsReal.o DEPENDS_32:=\ @@ -2891,6 +2847,7 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ @@ -2905,7 +2862,6 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2917,14 +2873,12 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchEdgeDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_32 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2932,11 +2886,10 @@ DEPENDS_32 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_32:X.o=${NDIM}.o}: ${DEPENDS_32} + +${FILE_32}: ${DEPENDS_32} FILE_33=PatchEdgeDataNormOpsComplex.o DEPENDS_33:=\ @@ -2955,6 +2908,7 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsComplex.h \ @@ -2968,7 +2922,6 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2980,25 +2933,22 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchEdgeDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_33 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_33:X.o=${NDIM}.o}: ${DEPENDS_33} + +${FILE_33}: ${DEPENDS_33} FILE_34=PatchEdgeDataNormOpsReal.o DEPENDS_34:=\ @@ -3017,6 +2967,7 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ @@ -3031,7 +2982,6 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3043,14 +2993,12 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchEdgeDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3058,11 +3006,10 @@ DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_34:X.o=${NDIM}.o}: ${DEPENDS_34} + +${FILE_34}: ${DEPENDS_34} FILE_35=PatchEdgeDataOpsComplex.o DEPENDS_35:=\ @@ -3088,6 +3035,7 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3107,7 +3055,6 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3119,13 +3066,11 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchEdgeDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_35 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ @@ -3134,11 +3079,10 @@ DEPENDS_35 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_35:X.o=${NDIM}.o}: ${DEPENDS_35} + +${FILE_35}: ${DEPENDS_35} FILE_36=PatchEdgeDataOpsInteger.o DEPENDS_36:=\ @@ -3164,6 +3108,7 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3182,7 +3127,6 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3194,13 +3138,11 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchEdgeDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_36 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ @@ -3209,11 +3151,10 @@ DEPENDS_36 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_36:X.o=${NDIM}.o}: ${DEPENDS_36} + +${FILE_36}: ${DEPENDS_36} FILE_37=PatchEdgeDataOpsReal.o DEPENDS_37:=\ @@ -3239,6 +3180,7 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3261,7 +3203,6 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3273,13 +3214,11 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchEdgeDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -3292,11 +3231,10 @@ DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_37:X.o=${NDIM}.o}: ${DEPENDS_37} + +${FILE_37}: ${DEPENDS_37} FILE_38=PatchFaceDataBasicOps.o DEPENDS_38:=\ @@ -3315,6 +3253,7 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ @@ -3329,7 +3268,6 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3341,13 +3279,11 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchFaceDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_38 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3355,11 +3291,10 @@ DEPENDS_38 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_38:X.o=${NDIM}.o}: ${DEPENDS_38} + +${FILE_38}: ${DEPENDS_38} FILE_39=PatchFaceDataMiscellaneousOpsReal.o DEPENDS_39:=\ @@ -3378,6 +3313,7 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ @@ -3392,7 +3328,6 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3404,14 +3339,12 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchFaceDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3419,11 +3352,10 @@ DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_39:X.o=${NDIM}.o}: ${DEPENDS_39} + +${FILE_39}: ${DEPENDS_39} FILE_40=PatchFaceDataNormOpsComplex.o DEPENDS_40:=\ @@ -3442,6 +3374,7 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsComplex.h \ @@ -3455,7 +3388,6 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3467,25 +3399,22 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchFaceDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_40 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_40:X.o=${NDIM}.o}: ${DEPENDS_40} + +${FILE_40}: ${DEPENDS_40} FILE_41=PatchFaceDataNormOpsReal.o DEPENDS_41:=\ @@ -3504,6 +3433,7 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ @@ -3518,7 +3448,6 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3530,14 +3459,12 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchFaceDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_41 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3545,11 +3472,10 @@ DEPENDS_41 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_41:X.o=${NDIM}.o}: ${DEPENDS_41} + +${FILE_41}: ${DEPENDS_41} FILE_42=PatchFaceDataOpsComplex.o DEPENDS_42:=\ @@ -3575,6 +3501,7 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3594,7 +3521,6 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3606,13 +3532,11 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchFaceDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_42 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ @@ -3621,11 +3545,10 @@ DEPENDS_42 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_42:X.o=${NDIM}.o}: ${DEPENDS_42} + +${FILE_42}: ${DEPENDS_42} FILE_43=PatchFaceDataOpsInteger.o DEPENDS_43:=\ @@ -3651,6 +3574,7 @@ DEPENDS_43:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3669,7 +3593,6 @@ DEPENDS_43:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3681,13 +3604,11 @@ DEPENDS_43:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchFaceDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_43 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ @@ -3696,11 +3617,10 @@ DEPENDS_43 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_43:X.o=${NDIM}.o}: ${DEPENDS_43} + +${FILE_43}: ${DEPENDS_43} FILE_44=PatchFaceDataOpsReal.o DEPENDS_44:=\ @@ -3726,6 +3646,7 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3748,7 +3669,6 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3760,13 +3680,11 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchFaceDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -3779,11 +3697,10 @@ DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_44:X.o=${NDIM}.o}: ${DEPENDS_44} + +${FILE_44}: ${DEPENDS_44} FILE_45=PatchNodeDataBasicOps.o DEPENDS_45:=\ @@ -3802,6 +3719,7 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ @@ -3816,7 +3734,6 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3828,13 +3745,11 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchNodeDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_45 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3842,11 +3757,10 @@ DEPENDS_45 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_45:X.o=${NDIM}.o}: ${DEPENDS_45} + +${FILE_45}: ${DEPENDS_45} FILE_46=PatchNodeDataMiscellaneousOpsReal.o DEPENDS_46:=\ @@ -3865,6 +3779,7 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ @@ -3879,7 +3794,6 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3891,14 +3805,12 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchNodeDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_46 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -3906,11 +3818,10 @@ DEPENDS_46 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_46:X.o=${NDIM}.o}: ${DEPENDS_46} + +${FILE_46}: ${DEPENDS_46} FILE_47=PatchNodeDataNormOpsComplex.o DEPENDS_47:=\ @@ -3929,6 +3840,7 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsComplex.h \ @@ -3942,7 +3854,6 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3954,25 +3865,22 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchNodeDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_47 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_47:X.o=${NDIM}.o}: ${DEPENDS_47} + +${FILE_47}: ${DEPENDS_47} FILE_48=PatchNodeDataNormOpsReal.o DEPENDS_48:=\ @@ -3991,6 +3899,7 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ @@ -4005,7 +3914,6 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4017,14 +3925,12 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchNodeDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_48 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -4032,11 +3938,10 @@ DEPENDS_48 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_48:X.o=${NDIM}.o}: ${DEPENDS_48} + +${FILE_48}: ${DEPENDS_48} FILE_49=PatchNodeDataOpsComplex.o DEPENDS_49:=\ @@ -4062,6 +3967,7 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4081,7 +3987,6 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4093,13 +3998,11 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchNodeDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_49 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ @@ -4108,11 +4011,10 @@ DEPENDS_49 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_49:X.o=${NDIM}.o}: ${DEPENDS_49} + +${FILE_49}: ${DEPENDS_49} FILE_50=PatchNodeDataOpsInteger.o DEPENDS_50:=\ @@ -4138,6 +4040,7 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4156,7 +4059,6 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4168,13 +4070,11 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchNodeDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_50 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ @@ -4183,11 +4083,10 @@ DEPENDS_50 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_50:X.o=${NDIM}.o}: ${DEPENDS_50} + +${FILE_50}: ${DEPENDS_50} FILE_51=PatchNodeDataOpsReal.o DEPENDS_51:=\ @@ -4213,6 +4112,7 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4235,7 +4135,6 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4247,13 +4146,11 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchNodeDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_51 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -4266,11 +4163,10 @@ DEPENDS_51 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_51:X.o=${NDIM}.o}: ${DEPENDS_51} + +${FILE_51}: ${DEPENDS_51} FILE_52=PatchSideDataBasicOps.o DEPENDS_52:=\ @@ -4289,6 +4185,7 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -4303,7 +4200,6 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4315,13 +4211,11 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchSideDataBasicOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_52 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -4329,11 +4223,10 @@ DEPENDS_52 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_52:X.o=${NDIM}.o}: ${DEPENDS_52} + +${FILE_52}: ${DEPENDS_52} FILE_53=PatchSideDataMiscellaneousOpsReal.o DEPENDS_53:=\ @@ -4352,6 +4245,7 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ @@ -4366,7 +4260,6 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4378,14 +4271,12 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchSideDataMiscellaneousOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_53 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -4393,11 +4284,10 @@ DEPENDS_53 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_53:X.o=${NDIM}.o}: ${DEPENDS_53} + +${FILE_53}: ${DEPENDS_53} FILE_54=PatchSideDataNormOpsComplex.o DEPENDS_54:=\ @@ -4416,6 +4306,7 @@ DEPENDS_54:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsComplex.h \ @@ -4429,7 +4320,6 @@ DEPENDS_54:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4441,25 +4331,22 @@ DEPENDS_54:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchSideDataNormOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_54 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_54:X.o=${NDIM}.o}: ${DEPENDS_54} + +${FILE_54}: ${DEPENDS_54} FILE_55=PatchSideDataNormOpsReal.o DEPENDS_55:=\ @@ -4478,6 +4365,7 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ @@ -4492,7 +4380,6 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4504,14 +4391,12 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ PatchSideDataNormOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_55 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -4519,11 +4404,10 @@ DEPENDS_55 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_55:X.o=${NDIM}.o}: ${DEPENDS_55} + +${FILE_55}: ${DEPENDS_55} FILE_56=PatchSideDataOpsComplex.o DEPENDS_56:=\ @@ -4549,6 +4433,7 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4568,7 +4453,6 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4580,13 +4464,11 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchSideDataOpsComplex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_56 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -4595,11 +4477,10 @@ DEPENDS_56 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_56:X.o=${NDIM}.o}: ${DEPENDS_56} + +${FILE_56}: ${DEPENDS_56} FILE_57=PatchSideDataOpsInteger.o DEPENDS_57:=\ @@ -4625,6 +4506,7 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4643,7 +4525,6 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4655,13 +4536,11 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchSideDataOpsInteger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_57 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -4670,11 +4549,10 @@ DEPENDS_57 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_57:X.o=${NDIM}.o}: ${DEPENDS_57} + +${FILE_57}: ${DEPENDS_57} FILE_58=PatchSideDataOpsReal.o DEPENDS_58:=\ @@ -4700,6 +4578,7 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4722,7 +4601,6 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4734,13 +4612,11 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchSideDataOpsReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_58 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -4753,9 +4629,8 @@ DEPENDS_58 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_58:X.o=${NDIM}.o}: ${DEPENDS_58} + +${FILE_58}: ${DEPENDS_58} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.in index 8b61c43f..2ea7523f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI math package ## ######################################################################### @@ -56,7 +56,7 @@ OBJS = \ library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.C index cf4446d3..1acd644b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated cell-centered patch data operations. * ************************************************************************/ @@ -27,31 +27,6 @@ PatchCellDataBasicOps::~PatchCellDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchCellDataBasicOps::PatchCellDataBasicOps( - const PatchCellDataBasicOps& foo) -{ - NULL_USE(foo); -} - -template -void -PatchCellDataBasicOps::operator = ( - const PatchCellDataBasicOps& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -69,7 +44,7 @@ PatchCellDataBasicOps::scale( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.scale(dst->getArrayData(), alpha, src->getArrayData(), @@ -85,7 +60,7 @@ PatchCellDataBasicOps::addScalar( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.addScalar(dst->getArrayData(), src->getArrayData(), alpha, @@ -101,7 +76,7 @@ PatchCellDataBasicOps::add( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.add(dst->getArrayData(), src1->getArrayData(), src2->getArrayData(), @@ -117,7 +92,7 @@ PatchCellDataBasicOps::subtract( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.subtract(dst->getArrayData(), src1->getArrayData(), src2->getArrayData(), @@ -133,7 +108,7 @@ PatchCellDataBasicOps::multiply( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.multiply(dst->getArrayData(), src1->getArrayData(), src2->getArrayData(), @@ -149,7 +124,7 @@ PatchCellDataBasicOps::divide( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.divide(dst->getArrayData(), src1->getArrayData(), src2->getArrayData(), @@ -164,7 +139,7 @@ PatchCellDataBasicOps::reciprocal( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.reciprocal(dst->getArrayData(), src->getArrayData(), @@ -182,7 +157,7 @@ PatchCellDataBasicOps::linearSum( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.linearSum(dst->getArrayData(), alpha, src1->getArrayData(), @@ -200,7 +175,7 @@ PatchCellDataBasicOps::axpy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.axpy(dst->getArrayData(), alpha, src1->getArrayData(), @@ -218,7 +193,7 @@ PatchCellDataBasicOps::axmy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); d_array_ops.axmy(dst->getArrayData(), alpha, src1->getArrayData(), @@ -233,7 +208,7 @@ PatchCellDataBasicOps::min( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); return d_array_ops.min(data->getArrayData(), box); } @@ -245,7 +220,7 @@ PatchCellDataBasicOps::max( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); return d_array_ops.max(data->getArrayData(), box); } @@ -259,7 +234,7 @@ PatchCellDataBasicOps::setRandomValues( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); d_array_ops.setRandomValues(dst->getArrayData(), width, low, box); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.h index 36e2b43c..db72c869 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated cell-centered patch data operations. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -27,11 +27,10 @@ namespace math { * Class PatchCellDataBasicOps provides access to a collection * of basic numerical operations that may be applied to numerical cell- * centered patch data. These operations include simple arithmetic - * operations as well as min and max, etc. The primary intent of this - * class is to provide the interface to these standard operations for - * an PatchCellDataOpsi object which provides access to a complete set - * of operations that may be used to manipulate cell-centered patch data - * objects. Each member function accepts a box argument indicating the + * operations as well as min and max, etc. This class provides a single + * implementation of these operations that may be used to manipulate any + * cell-centered patch data object. Each member function accepts a box + * argument indicating the * region of index space on which the operation should be performed. The * operation will be performed on the intersection of this box and those * boxes corresponding to the patch data objects involved. @@ -43,7 +42,7 @@ namespace math { * types as the template parameter. None of the operations are implemented * for any other type. * - * @see math::ArrayDataBasicOps + * @see ArrayDataBasicOps */ template @@ -59,6 +58,9 @@ class PatchCellDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void scale( @@ -69,6 +71,9 @@ class PatchCellDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void addScalar( @@ -79,6 +84,10 @@ class PatchCellDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void add( @@ -89,6 +98,10 @@ class PatchCellDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void subtract( @@ -99,6 +112,10 @@ class PatchCellDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void multiply( @@ -109,6 +126,10 @@ class PatchCellDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void divide( @@ -119,6 +140,9 @@ class PatchCellDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void reciprocal( @@ -128,6 +152,10 @@ class PatchCellDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void linearSum( @@ -140,6 +168,10 @@ class PatchCellDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axpy( @@ -151,6 +183,10 @@ class PatchCellDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axmy( @@ -163,6 +199,9 @@ class PatchCellDataBasicOps /** * Return the minimum patch data component entry When the data is * complex, the result is the data element with the smallest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE min( @@ -172,6 +211,9 @@ class PatchCellDataBasicOps /** * Return the maximum patch data component entry When the data is * complex, the result is the data element with the largest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE max( @@ -182,6 +224,9 @@ class PatchCellDataBasicOps * Set patch data to random values. See the operations in the * ArrayDataBasicOps class for details on the generation * of the random values for each data type. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setRandomValues( @@ -193,10 +238,10 @@ class PatchCellDataBasicOps private: // The following are not implemented: PatchCellDataBasicOps( - const PatchCellDataBasicOps&); - void + const PatchCellDataBasicOps&); + PatchCellDataBasicOps& operator = ( - const PatchCellDataBasicOps&); + const PatchCellDataBasicOps&); ArrayDataBasicOps d_array_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C index e1b41b58..4d1a0df1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real cell-centered data. * ************************************************************************/ @@ -27,31 +27,6 @@ PatchCellDataMiscellaneousOpsReal::~PatchCellDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchCellDataMiscellaneousOpsReal::PatchCellDataMiscellaneousOpsReal( - const PatchCellDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchCellDataMiscellaneousOpsReal::operator = ( - const PatchCellDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -69,7 +44,7 @@ PatchCellDataMiscellaneousOpsReal::computeConstrProdPos( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data1 && data2); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data1, *data2, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data1, *data2, box); int retval; if (!cvol) { @@ -77,7 +52,7 @@ PatchCellDataMiscellaneousOpsReal::computeConstrProdPos( data2->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data1, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data1, *cvol); retval = d_array_ops.computeConstrProdPosWithControlVolume( data1->getArrayData(), @@ -98,7 +73,7 @@ PatchCellDataMiscellaneousOpsReal::compareToScalar( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); if (!cvol) { d_array_ops.compareToScalar(dst->getArrayData(), @@ -106,7 +81,7 @@ PatchCellDataMiscellaneousOpsReal::compareToScalar( alpha, box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, *cvol); d_array_ops.compareToScalarWithControlVolume(dst->getArrayData(), src->getArrayData(), alpha, @@ -124,7 +99,7 @@ PatchCellDataMiscellaneousOpsReal::testReciprocal( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int retval; if (!cvol) { @@ -132,7 +107,7 @@ PatchCellDataMiscellaneousOpsReal::testReciprocal( src->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, *cvol); retval = d_array_ops.testReciprocalWithControlVolume( dst->getArrayData(), @@ -151,7 +126,7 @@ PatchCellDataMiscellaneousOpsReal::maxPointwiseDivide( const hier::Box& box) const { TBOX_ASSERT(numer && denom); - TBOX_DIM_ASSERT_CHECK_ARGS3(*numer, *denom, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*numer, *denom, box); TYPE retval; retval = d_array_ops.maxPointwiseDivide(numer->getArrayData(), @@ -169,7 +144,7 @@ PatchCellDataMiscellaneousOpsReal::minPointwiseDivide( { TBOX_ASSERT(numer && denom); - TBOX_DIM_ASSERT_CHECK_ARGS3(*numer, *denom, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*numer, *denom, box); TYPE retval; retval = d_array_ops.minPointwiseDivide(numer->getArrayData(), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h index 4665f8ee..c54e78d0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real cell-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataMiscellaneousOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * to include other operations, the member functions must be specialized or the * new operations must be added. * - * @see math::ArrayDataMiscellaneousOpsReal + * @see ArrayDataMiscellaneousOpsReal */ template @@ -69,6 +69,11 @@ class PatchCellDataMiscellaneousOpsReal * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. * If the control volume is NULL, all values in the index set are used. + * + * @pre data1 && data2 + * @pre (data1->getDim() == data2->getDim()) && + * (data1->getDim() == box.getDim()) + * @pre !cvol || (data1->getDim() == cvol->getDim()) */ int computeConstrProdPos( @@ -82,6 +87,11 @@ class PatchCellDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is NULL, all values in the index set are considered. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && + * (dst->getDim() == box.getDim()) + * @pre !cvol || (dst->getDim() == cvol->getDim()) */ void compareToScalar( @@ -97,6 +107,11 @@ class PatchCellDataMiscellaneousOpsReal * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. If the control volume * all values in the index set are considered. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && + * (dst->getDim() == box.getDim()) + * @pre !cvol || (dst->getDim() == cvol->getDim()) */ int testReciprocal( @@ -118,6 +133,10 @@ class PatchCellDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre numer && denom + * @pre (numer->getDim() == denom->getDim()) && + * (numer->getDim() == box.getDim()) */ TYPE maxPointwiseDivide( @@ -138,6 +157,10 @@ class PatchCellDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre numer && denom + * @pre (numer->getDim() == denom->getDim()) && + * (numer->getDim() == box.getDim()) */ TYPE minPointwiseDivide( @@ -148,10 +171,10 @@ class PatchCellDataMiscellaneousOpsReal private: // The following are not implemented: PatchCellDataMiscellaneousOpsReal( - const PatchCellDataMiscellaneousOpsReal&); - void + const PatchCellDataMiscellaneousOpsReal&); + PatchCellDataMiscellaneousOpsReal& operator = ( - const PatchCellDataMiscellaneousOpsReal&); + const PatchCellDataMiscellaneousOpsReal&); ArrayDataMiscellaneousOpsReal d_array_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.C index 744548b7..a295e4c4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.C @@ -3,16 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex cell-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchCellDataNormOpsComplex_C -#define included_math_PatchCellDataNormOpsComplex_C - #include "SAMRAI/math/PatchCellDataNormOpsComplex.h" +#include + namespace SAMRAI { namespace math { @@ -31,13 +29,13 @@ PatchCellDataNormOpsComplex::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; if (!cvol) { retval = d_array_ops.L1Norm(data->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L1NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -53,13 +51,13 @@ PatchCellDataNormOpsComplex::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; if (!cvol) { retval = d_array_ops.L2Norm(data->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L2NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -76,7 +74,7 @@ PatchCellDataNormOpsComplex::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); double retval; if (!cvol) { @@ -84,7 +82,7 @@ PatchCellDataNormOpsComplex::weightedL2Norm( weight->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(), @@ -102,13 +100,13 @@ PatchCellDataNormOpsComplex::RMSNorm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval = L2Norm(data, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval /= sqrt(sumControlVolumes(data, cvol, box)); } @@ -123,13 +121,13 @@ PatchCellDataNormOpsComplex::weightedRMSNorm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); double retval = weightedL2Norm(data, weight, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval /= sqrt(sumControlVolumes(data, cvol, box)); } @@ -143,13 +141,13 @@ PatchCellDataNormOpsComplex::maxNorm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; if (!cvol) { retval = d_array_ops.maxNorm(data->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.maxNormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -166,7 +164,7 @@ PatchCellDataNormOpsComplex::dot( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data1 && data2); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data1, *data2, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data1, *data2, box); dcomplex retval; if (!cvol) { @@ -174,7 +172,7 @@ PatchCellDataNormOpsComplex::dot( data2->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data1, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data1, *cvol); retval = d_array_ops.dotWithControlVolume( data1->getArrayData(), @@ -187,4 +185,3 @@ PatchCellDataNormOpsComplex::dot( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.h index 2fa29ca6..5129d61b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex cell-centered data. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -48,7 +48,7 @@ namespace math { * Note that a similar set of norm operations is implemented for real * patch data (double and float) in the class PatchCellDataNormOpsReal. * - * @see math::ArrayDataNormOpsComplex + * @see ArrayDataNormOpsComplex */ class PatchCellDataNormOpsComplex @@ -64,19 +64,26 @@ class PatchCellDataNormOpsComplex /** * Return the number of data values for the cell-centered data object * in the given box. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); return ((box * data->getGhostBox()).size()) * data->getDepth(); } /** * Return sum of control volume entries for the cell-centered data object. + * + * @pre data && cvol + * @pre (data->getDim() == cvol->getDim() && + * (data->getDim() == box.getDim()) */ double sumControlVolumes( @@ -85,7 +92,7 @@ class PatchCellDataNormOpsComplex const hier::Box& box) const { TBOX_ASSERT(data && cvol); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *cvol, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *cvol, box); return d_array_ops.sumControlVolumes(data->getArrayData(), cvol->getArrayData(), box); @@ -95,6 +102,10 @@ class PatchCellDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim() && + * (dst->getDim() == box.getDim()) */ void abs( @@ -103,7 +114,7 @@ class PatchCellDataNormOpsComplex const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.abs(dst->getArrayData(), src->getArrayData(), box); @@ -115,6 +126,10 @@ class PatchCellDataNormOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is NULL, the return value is * \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -130,6 +145,10 @@ class PatchCellDataNormOpsComplex * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -145,6 +164,11 @@ class PatchCellDataNormOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -160,6 +184,10 @@ class PatchCellDataNormOpsComplex * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double RMSNorm( @@ -174,6 +202,11 @@ class PatchCellDataNormOpsComplex * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedRMSNorm( @@ -189,6 +222,10 @@ class PatchCellDataNormOpsComplex * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. If the control volume is * NULL, it is ignored during the computation of the maximum. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double maxNorm( @@ -202,6 +239,11 @@ class PatchCellDataNormOpsComplex * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 + * @pre (data1->getDim() == data2->getDim()) && + * (data1->getDim() == box.getDim()) + * @pre !cvol || (data1->getDim() == cvol->getDim()) */ dcomplex dot( @@ -214,6 +256,10 @@ class PatchCellDataNormOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data && vol + * @pre (data->getDim() == vol->getDim() && + * (data->getDim() == box.getDim()) */ dcomplex integral( @@ -223,7 +269,7 @@ class PatchCellDataNormOpsComplex { TBOX_ASSERT(data); TBOX_ASSERT(vol); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, box, *vol); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, box, *vol); return d_array_ops.integral( data->getArrayData(), vol->getArrayData(), @@ -234,7 +280,7 @@ class PatchCellDataNormOpsComplex // The following are not implemented: PatchCellDataNormOpsComplex( const PatchCellDataNormOpsComplex&); - void + PatchCellDataNormOpsComplex& operator = ( const PatchCellDataNormOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.C index 622ed842..aa098485 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real cell-centered patch data. * ************************************************************************/ @@ -14,6 +14,8 @@ #include "SAMRAI/math/PatchCellDataNormOpsReal.h" #include "SAMRAI/tbox/Utilities.h" +#include + namespace SAMRAI { namespace math { @@ -27,31 +29,6 @@ PatchCellDataNormOpsReal::~PatchCellDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchCellDataNormOpsReal::PatchCellDataNormOpsReal( - const PatchCellDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchCellDataNormOpsReal::operator = ( - const PatchCellDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -61,16 +38,16 @@ PatchCellDataNormOpsReal::operator = ( */ template -int +size_t PatchCellDataNormOpsReal::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); const hier::Box ibox = box * data->getGhostBox(); - int retval = (ibox.size() * data->getDepth()); + size_t retval = (ibox.size() * data->getDepth()); return retval; } @@ -90,7 +67,7 @@ PatchCellDataNormOpsReal::sumControlVolumes( const hier::Box& box) const { TBOX_ASSERT(data && cvol); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); return d_array_ops.sumControlVolumes(data->getArrayData(), cvol->getArrayData(), @@ -105,7 +82,7 @@ PatchCellDataNormOpsReal::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.abs(dst->getArrayData(), src->getArrayData(), @@ -120,13 +97,13 @@ PatchCellDataNormOpsReal::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; if (!cvol) { retval = d_array_ops.L1Norm(data->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L1NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -143,13 +120,13 @@ PatchCellDataNormOpsReal::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; if (!cvol) { retval = d_array_ops.L2Norm(data->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L2NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -167,7 +144,7 @@ PatchCellDataNormOpsReal::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); double retval; if (!cvol) { @@ -175,7 +152,7 @@ PatchCellDataNormOpsReal::weightedL2Norm( weight->getArrayData(), box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.h index fd0f9752..bf97332e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real cell-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataNormOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * implemented for complex patch data in the class * PatchCellDataNormOpsComplex. * - * @see math::ArrayDataNormOpsReal + * @see ArrayDataNormOpsReal */ template @@ -68,14 +68,20 @@ class PatchCellDataNormOpsReal /** * Return the number of data values for the cell-centered data object * in the given box. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the cell-centered data object. + * + * @pre data && cvol + * @pre data->getDim() == box.getDim() */ double sumControlVolumes( @@ -86,6 +92,10 @@ class PatchCellDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre data && src + * @pre (data->getDim() == src->getDim()) && + * (data->getDim() == box.getDim()) */ void abs( @@ -98,6 +108,10 @@ class PatchCellDataNormOpsReal * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. If the * control volume is NULL, the return value is \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -112,6 +126,10 @@ class PatchCellDataNormOpsReal * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -126,6 +144,11 @@ class PatchCellDataNormOpsReal * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is NULL, * the return value is \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -141,6 +164,8 @@ class PatchCellDataNormOpsReal * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -155,6 +180,8 @@ class PatchCellDataNormOpsReal * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -170,6 +197,8 @@ class PatchCellDataNormOpsReal * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. If the control volume is NULL, it is * ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -183,6 +212,8 @@ class PatchCellDataNormOpsReal * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ TYPE dot( @@ -195,6 +226,8 @@ class PatchCellDataNormOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ TYPE integral( @@ -205,10 +238,10 @@ class PatchCellDataNormOpsReal private: // The following are not implemented: PatchCellDataNormOpsReal( - const PatchCellDataNormOpsReal&); - void + const PatchCellDataNormOpsReal&); + PatchCellDataNormOpsReal& operator = ( - const PatchCellDataNormOpsReal&); + const PatchCellDataNormOpsReal&); ArrayDataNormOpsReal d_array_ops; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.C index ffa0d91e..1bb7c43c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex cell-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchCellDataOpsComplex_C -#define included_math_PatchCellDataOpsComplex_C - #include "SAMRAI/math/PatchCellDataOpsComplex.h" namespace SAMRAI { @@ -41,11 +37,11 @@ PatchCellDataOpsComplex::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -58,4 +54,3 @@ PatchCellDataOpsComplex::swapData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.h index e95e9af4..eb96b00b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex cell-centered patch data. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,8 @@ namespace math { * integer patch data in the classes PatchCellDataOpsReal and * PatchCellDataOpsInteger, respectively. * - * @see math::PatchCellDataBasicOps - * @see math::PatchCellDataNormOpsComplex + * @see PatchCellDataBasicOps + * @see PatchCellDataNormOpsComplex */ class PatchCellDataOpsComplex: @@ -60,6 +60,9 @@ class PatchCellDataOpsComplex: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -68,13 +71,19 @@ class PatchCellDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); dst->getArrayData().copy(src->getArrayData(), box); } /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +93,9 @@ class PatchCellDataOpsComplex: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -92,7 +104,7 @@ class PatchCellDataOpsComplex: std::ostream& s = tbox::plog) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); s << "\n"; @@ -100,6 +112,9 @@ class PatchCellDataOpsComplex: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -108,7 +123,7 @@ class PatchCellDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } @@ -116,7 +131,7 @@ class PatchCellDataOpsComplex: // The following are not implemented: PatchCellDataOpsComplex( const PatchCellDataOpsComplex&); - void + PatchCellDataOpsComplex& operator = ( const PatchCellDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.C index 4c55b154..713ffbc6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer cell-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchCellDataOpsInteger_C -#define included_math_PatchCellDataOpsInteger_C - #include "SAMRAI/math/PatchCellDataOpsInteger.h" namespace SAMRAI { @@ -41,11 +37,11 @@ PatchCellDataOpsInteger::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -58,4 +54,3 @@ PatchCellDataOpsInteger::swapData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.h index b15ec7d7..9462e71e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer cell-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,7 +39,7 @@ namespace math { * float) and complex patch data in the classes PatchCellDataOpsReal * and PatchCellDataOpsComplex, respectively. * - * @see math::PatchCellDataBasicOps + * @see PatchCellDataBasicOps */ class PatchCellDataOpsInteger: @@ -56,19 +56,25 @@ class PatchCellDataOpsInteger: /** * Return the number of data values for the cell-centered data object * in the given box. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); return ((box * data->getGhostBox()).size()) * data->getDepth(); } /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -77,13 +83,19 @@ class PatchCellDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); dst->getArrayData().copy(src->getArrayData(), box); } /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -93,6 +105,9 @@ class PatchCellDataOpsInteger: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -101,7 +116,7 @@ class PatchCellDataOpsInteger: std::ostream& s = tbox::plog) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); s << "\n"; @@ -109,6 +124,9 @@ class PatchCellDataOpsInteger: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -117,13 +135,16 @@ class PatchCellDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -132,7 +153,7 @@ class PatchCellDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.abs(dst->getArrayData(), src->getArrayData(), box); @@ -142,7 +163,7 @@ class PatchCellDataOpsInteger: // The following are not implemented: PatchCellDataOpsInteger( const PatchCellDataOpsInteger&); - void + PatchCellDataOpsInteger& operator = ( const PatchCellDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.C index e50908b8..68da7d57 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real cell-centered patch data. * ************************************************************************/ @@ -33,31 +33,6 @@ PatchCellDataOpsReal::~PatchCellDataOpsReal() } #endif -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchCellDataOpsReal::PatchCellDataOpsReal( - const PatchCellDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchCellDataOpsReal::operator = ( - const PatchCellDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -76,11 +51,11 @@ PatchCellDataOpsReal::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -99,7 +74,7 @@ PatchCellDataOpsReal::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -114,7 +89,7 @@ PatchCellDataOpsReal::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); (dst->getArrayData()).copy(src->getArrayData(), box); } @@ -127,7 +102,7 @@ PatchCellDataOpsReal::setToScalar( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.h index 49f4cc27..c7d0fe57 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchCellDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real cell-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -44,9 +44,9 @@ namespace math { * PatchCellDataOpsComplex and PatchCellDataOpsInteger, * respectively. * - * @see math::PatchCellDataBasicOps - * @see math::PatchCellDataMiscellaneousOpsReal - * @see math::PatchCellDataNormOpsReal + * @see PatchCellDataBasicOps + * @see PatchCellDataMiscellaneousOpsReal + * @see PatchCellDataNormOpsReal */ template @@ -66,6 +66,9 @@ class PatchCellDataOpsReal: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -76,6 +79,13 @@ class PatchCellDataOpsReal: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -85,6 +95,9 @@ class PatchCellDataOpsReal: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -94,6 +107,9 @@ class PatchCellDataOpsReal: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -104,10 +120,10 @@ class PatchCellDataOpsReal: private: // The following are not implemented: PatchCellDataOpsReal( - const PatchCellDataOpsReal&); - void + const PatchCellDataOpsReal&); + PatchCellDataOpsReal& operator = ( - const PatchCellDataOpsReal&); + const PatchCellDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.C index eccfa0d5..113dcda2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated edge-centered patch data operations. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchEdgeDataBasicOps::~PatchEdgeDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchEdgeDataBasicOps::PatchEdgeDataBasicOps( - const PatchEdgeDataBasicOps& foo) -{ - NULL_USE(foo); -} - -template -void -PatchEdgeDataBasicOps::operator = ( - const PatchEdgeDataBasicOps& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -71,11 +46,11 @@ PatchEdgeDataBasicOps::scale( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.scale(dst->getArrayData(d), alpha, src->getArrayData(d), @@ -92,11 +67,11 @@ PatchEdgeDataBasicOps::addScalar( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.addScalar(dst->getArrayData(d), src->getArrayData(d), alpha, @@ -113,11 +88,11 @@ PatchEdgeDataBasicOps::add( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.add(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -134,11 +109,11 @@ PatchEdgeDataBasicOps::subtract( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.subtract(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -155,11 +130,11 @@ PatchEdgeDataBasicOps::multiply( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.multiply(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -176,11 +151,11 @@ PatchEdgeDataBasicOps::divide( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.divide(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -196,11 +171,11 @@ PatchEdgeDataBasicOps::reciprocal( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.reciprocal(dst->getArrayData(d), src->getArrayData(d), @@ -219,11 +194,11 @@ PatchEdgeDataBasicOps::linearSum( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.linearSum(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -242,11 +217,11 @@ PatchEdgeDataBasicOps::axpy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.axpy(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -265,11 +240,11 @@ PatchEdgeDataBasicOps::axmy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.axmy(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -287,11 +262,11 @@ PatchEdgeDataBasicOps::setRandomValues( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.setRandomValues(dst->getArrayData(d), width, low, edge_box); @@ -305,12 +280,12 @@ PatchEdgeDataBasicOps::min( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); TYPE minval = tbox::MathUtilities::getMax(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); minval = tbox::MathUtilities::Min( minval, d_array_ops.min(data->getArrayData(d), edge_box)); @@ -325,12 +300,12 @@ PatchEdgeDataBasicOps::max( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); TYPE maxval = -tbox::MathUtilities::getMax(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); maxval = tbox::MathUtilities::Max( maxval, d_array_ops.max(data->getArrayData(d), edge_box)); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.h index c61265c7..24d03476 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated edge-centered patch data operations. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/math/ArrayDataBasicOps.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -27,11 +27,10 @@ namespace math { * Class PatchEdgeDataBasicOps provides access to a collection * of basic numerical operations that may be applied to numerical edge- * centered patch data. These operations include simple arithmetic - * operations as well as min and max, etc. The primary intent of this - * class is to provide the interface to these standard operations for - * an PatchEdgeDataOps object which provides access to a complete set - * of operations that may be used to manipulate edge-centered patch data - * objects. Each member function accepts a box argument indicating the + * operations as well as min and max, etc. This class provides a single + * implementation of these operations that may be used to manipulate any + * edge-centered patch data object. Each member function accepts a box + * argument indicating the * region of index space on which the operation should be performed. The * operation will be performed on the intersection of this box and those * boxes corresponding to the patch data objects involved. @@ -43,7 +42,7 @@ namespace math { * types as the template parameter. None of the operations are implemented * for any other type. * - * @see math::ArrayDataBasicOps + * @see ArrayDataBasicOps */ template @@ -59,6 +58,9 @@ class PatchEdgeDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void scale( @@ -69,6 +71,9 @@ class PatchEdgeDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void addScalar( @@ -79,6 +84,11 @@ class PatchEdgeDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void add( @@ -89,6 +99,11 @@ class PatchEdgeDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void subtract( @@ -99,6 +114,11 @@ class PatchEdgeDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void multiply( @@ -109,6 +129,11 @@ class PatchEdgeDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void divide( @@ -119,6 +144,9 @@ class PatchEdgeDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void reciprocal( @@ -128,6 +156,11 @@ class PatchEdgeDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void linearSum( @@ -140,6 +173,11 @@ class PatchEdgeDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void axpy( @@ -151,6 +189,11 @@ class PatchEdgeDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && + * (dst->getDim() == box.getDim()) */ void axmy( @@ -163,6 +206,9 @@ class PatchEdgeDataBasicOps /** * Return the minimum patch data component entry When the data is * complex, the result is the data element with the smallest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE min( @@ -172,6 +218,9 @@ class PatchEdgeDataBasicOps /** * Return the maximum patch data component entry When the data is * complex, the result is the data element with the largest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE max( @@ -182,6 +231,9 @@ class PatchEdgeDataBasicOps * Set patch data to random values. See the operations in the * ArrayDataBasicOps class for details on the generation * of the random values for each data type. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setRandomValues( @@ -193,10 +245,10 @@ class PatchEdgeDataBasicOps private: // The following are not implemented: PatchEdgeDataBasicOps( - const PatchEdgeDataBasicOps&); - void + const PatchEdgeDataBasicOps&); + PatchEdgeDataBasicOps& operator = ( - const PatchEdgeDataBasicOps&); + const PatchEdgeDataBasicOps&); ArrayDataBasicOps d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C index dc785b8d..f4cb6e2a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real edge-centered data. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchEdgeDataMiscellaneousOpsReal::~PatchEdgeDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchEdgeDataMiscellaneousOpsReal::PatchEdgeDataMiscellaneousOpsReal( - const PatchEdgeDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchEdgeDataMiscellaneousOpsReal::operator = ( - const PatchEdgeDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -76,7 +51,7 @@ PatchEdgeDataMiscellaneousOpsReal::computeConstrProdPos( int retval = 1; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -86,7 +61,7 @@ PatchEdgeDataMiscellaneousOpsReal::computeConstrProdPos( edge_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -114,7 +89,7 @@ PatchEdgeDataMiscellaneousOpsReal::compareToScalar( int dimVal = dst->getDim().getValue(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.compareToScalar(dst->getArrayData(d), src->getArrayData(d), @@ -122,7 +97,7 @@ PatchEdgeDataMiscellaneousOpsReal::compareToScalar( edge_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.compareToScalarWithControlVolume(dst->getArrayData(d), src->getArrayData(d), @@ -147,7 +122,7 @@ PatchEdgeDataMiscellaneousOpsReal::testReciprocal( int retval = 1; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -157,7 +132,7 @@ PatchEdgeDataMiscellaneousOpsReal::testReciprocal( edge_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -183,7 +158,7 @@ PatchEdgeDataMiscellaneousOpsReal::maxPointwiseDivide( int dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); TYPE dirval = d_array_ops.maxPointwiseDivide(numer->getArrayData(d), denom->getArrayData(d), @@ -205,7 +180,7 @@ PatchEdgeDataMiscellaneousOpsReal::minPointwiseDivide( int dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); TYPE dirval = d_array_ops.minPointwiseDivide(numer->getArrayData(d), denom->getArrayData(d), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h index ef844504..6923d236 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real edge-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataMiscellaneousOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * to include other operations, the member functions must be specialized or the * new operations must be added. * - * @see math::ArrayDataMiscellaneousOpsReal + * @see ArrayDataMiscellaneousOpsReal */ template @@ -69,6 +69,8 @@ class PatchEdgeDataMiscellaneousOpsReal * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. * If the control volume is NULL, all values in the index set are used. + * + * @pre data1 && data2 */ int computeConstrProdPos( @@ -82,6 +84,8 @@ class PatchEdgeDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is NULL, all values in the index set are considered. + * + * @pre dst && src */ void compareToScalar( @@ -97,6 +101,8 @@ class PatchEdgeDataMiscellaneousOpsReal * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. If the control volume * all values in the index set are considered. + * + * @pre dst && src */ int testReciprocal( @@ -118,6 +124,8 @@ class PatchEdgeDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE maxPointwiseDivide( @@ -138,6 +146,8 @@ class PatchEdgeDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE minPointwiseDivide( @@ -148,10 +158,10 @@ class PatchEdgeDataMiscellaneousOpsReal private: // The following are not implemented: PatchEdgeDataMiscellaneousOpsReal( - const PatchEdgeDataMiscellaneousOpsReal&); - void + const PatchEdgeDataMiscellaneousOpsReal&); + PatchEdgeDataMiscellaneousOpsReal& operator = ( - const PatchEdgeDataMiscellaneousOpsReal&); + const PatchEdgeDataMiscellaneousOpsReal&); ArrayDataMiscellaneousOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.C index 2d7b7429..fd656c3e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex edge-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchEdgeDataNormOpsComplex_C -#define included_math_PatchEdgeDataNormOpsComplex_C - #include "SAMRAI/math/PatchEdgeDataNormOpsComplex.h" #include "SAMRAI/pdat/EdgeGeometry.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -33,19 +29,19 @@ PatchEdgeDataNormOpsComplex::~PatchEdgeDataNormOpsComplex() ************************************************************************* */ -int +size_t PatchEdgeDataNormOpsComplex::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); - int retval = 0; + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); + size_t retval = 0; const hier::Box ibox = box * data->getGhostBox(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { retval += (pdat::EdgeGeometry::toEdgeBox(ibox, d).size() * data_depth); } return retval; @@ -69,10 +65,10 @@ PatchEdgeDataNormOpsComplex::sumControlVolumes( int dimVal = box.getDim().getValue(); double retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { retval += d_array_ops.sumControlVolumes(data->getArrayData(d), - cvol->getArrayData(d), - pdat::EdgeGeometry::toEdgeBox(box, d)); + cvol->getArrayData(d), + pdat::EdgeGeometry::toEdgeBox(box, d)); } return retval; } @@ -84,10 +80,10 @@ PatchEdgeDataNormOpsComplex::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), pdat::EdgeGeometry::toEdgeBox(box, d)); @@ -101,20 +97,20 @@ PatchEdgeDataNormOpsComplex::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), edge_box); } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), cvol->getArrayData(d), @@ -131,21 +127,21 @@ PatchEdgeDataNormOpsComplex::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), edge_box); retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( data->getArrayData(d), @@ -165,13 +161,13 @@ PatchEdgeDataNormOpsComplex::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); int dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), weight->getArrayData(d), @@ -179,9 +175,9 @@ PatchEdgeDataNormOpsComplex::weightedL2Norm( retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(d), @@ -238,14 +234,14 @@ PatchEdgeDataNormOpsComplex::maxNorm( double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Max(retval, d_array_ops.maxNorm(data->getArrayData(d), edge_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Max(retval, @@ -268,14 +264,14 @@ PatchEdgeDataNormOpsComplex::dot( dcomplex retval = dcomplex(0.0, 0.0); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), data2->getArrayData(d), edge_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.dotWithControlVolume( data1->getArrayData(d), @@ -297,7 +293,7 @@ PatchEdgeDataNormOpsComplex::integral( int dimVal = box.getDim().getValue(); dcomplex retval = dcomplex(0.0, 0.0); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { retval += d_array_ops.integral( data->getArrayData(d), vol->getArrayData(d), @@ -308,4 +304,3 @@ PatchEdgeDataNormOpsComplex::integral( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.h index c80e1661..e210f1e5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex edge-centered data. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -48,7 +48,7 @@ namespace math { * Note that a similar set of norm operations is implemented for real * patch data (double and float) in the class PatchEdgeDataNormOpsReal. * - * @see math::ArrayDataNormOpsComplex + * @see ArrayDataNormOpsComplex */ class PatchEdgeDataNormOpsComplex @@ -65,14 +65,19 @@ class PatchEdgeDataNormOpsComplex * Return the number of data values for the edge-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the edge-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -84,6 +89,9 @@ class PatchEdgeDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -97,6 +105,10 @@ class PatchEdgeDataNormOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is NULL, the return value is * \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -112,6 +124,10 @@ class PatchEdgeDataNormOpsComplex * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +143,11 @@ class PatchEdgeDataNormOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +163,8 @@ class PatchEdgeDataNormOpsComplex * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -156,6 +179,8 @@ class PatchEdgeDataNormOpsComplex * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +196,8 @@ class PatchEdgeDataNormOpsComplex * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. If the control volume is * NULL, it is ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -184,6 +211,8 @@ class PatchEdgeDataNormOpsComplex * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ dcomplex dot( @@ -196,6 +225,8 @@ class PatchEdgeDataNormOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ dcomplex integral( @@ -207,7 +238,7 @@ class PatchEdgeDataNormOpsComplex // The following are not implemented: PatchEdgeDataNormOpsComplex( const PatchEdgeDataNormOpsComplex&); - void + PatchEdgeDataNormOpsComplex& operator = ( const PatchEdgeDataNormOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.C index 8255ef1e..d03f1f01 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real edge-centered patch data. * ************************************************************************/ @@ -17,6 +17,8 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/pdat/EdgeGeometry.h" +#include + namespace SAMRAI { namespace math { @@ -30,31 +32,6 @@ PatchEdgeDataNormOpsReal::~PatchEdgeDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchEdgeDataNormOpsReal::PatchEdgeDataNormOpsReal( - const PatchEdgeDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchEdgeDataNormOpsReal::operator = ( - const PatchEdgeDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -64,19 +41,19 @@ PatchEdgeDataNormOpsReal::operator = ( */ template -int +size_t PatchEdgeDataNormOpsReal::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); - int retval = 0; + size_t retval = 0; const hier::Box ibox = box * data->getGhostBox(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box dbox = pdat::EdgeGeometry::toEdgeBox(ibox, d); retval += (dbox.size() * data->getDepth()); } @@ -100,10 +77,10 @@ PatchEdgeDataNormOpsReal::sumControlVolumes( { TBOX_ASSERT(data && cvol); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.sumControlVolumes(data->getArrayData(d), cvol->getArrayData(d), @@ -120,11 +97,11 @@ PatchEdgeDataNormOpsReal::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), @@ -140,20 +117,20 @@ PatchEdgeDataNormOpsReal::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), edge_box); } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), cvol->getArrayData(d), @@ -171,21 +148,21 @@ PatchEdgeDataNormOpsReal::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), edge_box); retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( data->getArrayData(d), @@ -206,13 +183,13 @@ PatchEdgeDataNormOpsReal::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), weight->getArrayData(d), @@ -220,9 +197,9 @@ PatchEdgeDataNormOpsReal::weightedL2Norm( retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(d), @@ -281,18 +258,18 @@ PatchEdgeDataNormOpsReal::maxNorm( { TBOX_ASSERT(data); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Max(retval, d_array_ops.maxNorm(data->getArrayData(d), edge_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval = tbox::MathUtilities::Max(retval, @@ -315,18 +292,18 @@ PatchEdgeDataNormOpsReal::dot( { TBOX_ASSERT(data1 && data2); - int dimVal = data1->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1->getDim().getValue(); TYPE retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), data2->getArrayData(d), edge_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.dotWithControlVolume( data1->getArrayData(d), @@ -347,11 +324,11 @@ PatchEdgeDataNormOpsReal::integral( { TBOX_ASSERT(data); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box side_box = pdat::EdgeGeometry::toEdgeBox(box, d); retval += d_array_ops.integral( data->getArrayData(d), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.h index 8900921e..5e8f6987 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real edge-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataNormOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * implemented for complex patch data in the class * PatchEdgeDataNormOpsComplex. * - * @see math::ArrayDataNormOpsReal + * @see ArrayDataNormOpsReal */ template @@ -69,14 +69,19 @@ class PatchEdgeDataNormOpsReal * Return the number of data values for the edge-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the edge-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -87,6 +92,9 @@ class PatchEdgeDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -99,6 +107,10 @@ class PatchEdgeDataNormOpsReal * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. If the * control volume is NULL, the return value is \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -113,6 +125,10 @@ class PatchEdgeDataNormOpsReal * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +143,11 @@ class PatchEdgeDataNormOpsReal * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is NULL, * the return value is \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +163,8 @@ class PatchEdgeDataNormOpsReal * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -156,6 +179,8 @@ class PatchEdgeDataNormOpsReal * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +196,8 @@ class PatchEdgeDataNormOpsReal * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. If the control volume is NULL, it is * ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -184,6 +211,8 @@ class PatchEdgeDataNormOpsReal * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ TYPE dot( @@ -196,6 +225,8 @@ class PatchEdgeDataNormOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ TYPE integral( @@ -206,10 +237,10 @@ class PatchEdgeDataNormOpsReal private: // The following are not implemented: PatchEdgeDataNormOpsReal( - const PatchEdgeDataNormOpsReal&); - void + const PatchEdgeDataNormOpsReal&); + PatchEdgeDataNormOpsReal& operator = ( - const PatchEdgeDataNormOpsReal&); + const PatchEdgeDataNormOpsReal&); ArrayDataNormOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.C index 0edbe4ef..9aa3fb38 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex edge-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchEdgeDataOpsComplex_C -#define included_math_PatchEdgeDataOpsComplex_C - #include "SAMRAI/math/PatchEdgeDataOpsComplex.h" #include "SAMRAI/pdat/EdgeGeometry.h" @@ -42,11 +38,11 @@ PatchEdgeDataOpsComplex::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -64,7 +60,7 @@ PatchEdgeDataOpsComplex::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -78,10 +74,10 @@ PatchEdgeDataOpsComplex::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::EdgeGeometry::toEdgeBox(box, d)); } @@ -89,4 +85,3 @@ PatchEdgeDataOpsComplex::copyData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.h index c69eb114..7f998bc4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex edge-centered patch data. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,8 @@ namespace math { * integer patch data in the classes PatchEdgeDataOpsReal and * PatchEdgeDataOpsInteger, repsectively. * - * @see math::PatchEdgeDataBasicOps - * @see math::PatchEdgeDataNormOpsComplex + * @see PatchEdgeDataBasicOps + * @see PatchEdgeDataNormOpsComplex */ class PatchEdgeDataOpsComplex: @@ -60,6 +60,9 @@ class PatchEdgeDataOpsComplex: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -70,6 +73,13 @@ class PatchEdgeDataOpsComplex: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -79,6 +89,9 @@ class PatchEdgeDataOpsComplex: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -88,6 +101,9 @@ class PatchEdgeDataOpsComplex: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -96,7 +112,7 @@ class PatchEdgeDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } @@ -104,7 +120,7 @@ class PatchEdgeDataOpsComplex: // The following are not implemented: PatchEdgeDataOpsComplex( const PatchEdgeDataOpsComplex&); - void + PatchEdgeDataOpsComplex& operator = ( const PatchEdgeDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.C index 08c14e0f..d15f9884 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer edge-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchEdgeDataOpsInteger_C -#define included_math_PatchEdgeDataOpsInteger_C - #include "SAMRAI/math/PatchEdgeDataOpsInteger.h" #include "SAMRAI/pdat/EdgeGeometry.h" @@ -39,14 +35,14 @@ PatchEdgeDataOpsInteger::numberOfEntries( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); int retval = 0; const hier::Box ibox = box * data->getGhostBox(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { - retval += ((pdat::EdgeGeometry::toEdgeBox(ibox, d).size()) * data_depth); + for (int d = 0; d < dimVal; ++d) { + retval += static_cast((pdat::EdgeGeometry::toEdgeBox(ibox, d).size()) * data_depth); } return retval; } @@ -68,11 +64,11 @@ PatchEdgeDataOpsInteger::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -90,7 +86,7 @@ PatchEdgeDataOpsInteger::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -104,10 +100,10 @@ PatchEdgeDataOpsInteger::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::EdgeGeometry::toEdgeBox(box, d)); } @@ -120,10 +116,10 @@ PatchEdgeDataOpsInteger::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (int d = 0; d < dimVal; ++d) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), pdat::EdgeGeometry::toEdgeBox(box, d)); @@ -132,4 +128,3 @@ PatchEdgeDataOpsInteger::abs( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.h index cd013a2e..f1679366 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer edge-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,7 +39,7 @@ namespace math { * float) and complex patch data in the classes PatchEdgeDataOpsReal * and PatchEdgeDataOpsComplex, repsectively. * - * @see math::PatchEdgeDataBasicOps + * @see PatchEdgeDataBasicOps */ class PatchEdgeDataOpsInteger: @@ -57,6 +57,9 @@ class PatchEdgeDataOpsInteger: * Return the number of data values for the edge-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ int numberOfEntries( @@ -65,6 +68,9 @@ class PatchEdgeDataOpsInteger: /** * Copy dst data to src data over given box. + * + * @pre dst + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -75,6 +81,13 @@ class PatchEdgeDataOpsInteger: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +97,9 @@ class PatchEdgeDataOpsInteger: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -93,6 +109,9 @@ class PatchEdgeDataOpsInteger: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -101,13 +120,16 @@ class PatchEdgeDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -119,7 +141,7 @@ class PatchEdgeDataOpsInteger: // The following are not implemented: PatchEdgeDataOpsInteger( const PatchEdgeDataOpsInteger&); - void + PatchEdgeDataOpsInteger& operator = ( const PatchEdgeDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.C index 29293df0..66b10826 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real edge-centered patch data. * ************************************************************************/ @@ -34,31 +34,6 @@ PatchEdgeDataOpsReal::~PatchEdgeDataOpsReal() } #endif -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchEdgeDataOpsReal::PatchEdgeDataOpsReal( - const PatchEdgeDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchEdgeDataOpsReal::operator = ( - const PatchEdgeDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -77,11 +52,11 @@ PatchEdgeDataOpsReal::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -100,7 +75,7 @@ PatchEdgeDataOpsReal::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -115,7 +90,7 @@ PatchEdgeDataOpsReal::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); @@ -133,7 +108,7 @@ PatchEdgeDataOpsReal::setToScalar( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.h index 4a2cb3e3..8faab980 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchEdgeDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real edge-centered patch data. * ************************************************************************/ @@ -20,7 +20,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -43,9 +43,9 @@ namespace math { * PatchEdgeDataOpsComplex and PatchEdgeDataOpsInteger, * repsectively. * - * @see math::PatchEdgeDataBasicOps - * @see math::PatchEdgeDataMiscellaneousOpsReal - * @see math::PatchEdgeDataNormOpsReal + * @see PatchEdgeDataBasicOps + * @see PatchEdgeDataMiscellaneousOpsReal + * @see PatchEdgeDataNormOpsReal */ template @@ -65,6 +65,9 @@ class PatchEdgeDataOpsReal: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -75,6 +78,13 @@ class PatchEdgeDataOpsReal: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +94,9 @@ class PatchEdgeDataOpsReal: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -93,6 +106,9 @@ class PatchEdgeDataOpsReal: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -103,10 +119,10 @@ class PatchEdgeDataOpsReal: private: // The following are not implemented: PatchEdgeDataOpsReal( - const PatchEdgeDataOpsReal&); - void + const PatchEdgeDataOpsReal&); + PatchEdgeDataOpsReal& operator = ( - const PatchEdgeDataOpsReal&); + const PatchEdgeDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.C index 4aee7b78..9cc5b61f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated face-centered patch data operations. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchFaceDataBasicOps::~PatchFaceDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchFaceDataBasicOps::PatchFaceDataBasicOps( - const PatchFaceDataBasicOps& foo) -{ - NULL_USE(foo); -} - -template -void -PatchFaceDataBasicOps::operator = ( - const PatchFaceDataBasicOps& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -71,11 +46,11 @@ PatchFaceDataBasicOps::scale( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.scale(dst->getArrayData(d), alpha, src->getArrayData(d), @@ -92,11 +67,11 @@ PatchFaceDataBasicOps::addScalar( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.addScalar(dst->getArrayData(d), src->getArrayData(d), alpha, @@ -113,11 +88,11 @@ PatchFaceDataBasicOps::add( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.add(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -134,11 +109,11 @@ PatchFaceDataBasicOps::subtract( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.subtract(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -155,11 +130,11 @@ PatchFaceDataBasicOps::multiply( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.multiply(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -176,11 +151,11 @@ PatchFaceDataBasicOps::divide( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.divide(dst->getArrayData(d), src1->getArrayData(d), src2->getArrayData(d), @@ -196,11 +171,11 @@ PatchFaceDataBasicOps::reciprocal( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.reciprocal(dst->getArrayData(d), src->getArrayData(d), @@ -219,11 +194,11 @@ PatchFaceDataBasicOps::linearSum( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.linearSum(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -242,11 +217,11 @@ PatchFaceDataBasicOps::axpy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.axpy(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -265,11 +240,11 @@ PatchFaceDataBasicOps::axmy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.axmy(dst->getArrayData(d), alpha, src1->getArrayData(d), @@ -287,11 +262,11 @@ PatchFaceDataBasicOps::setRandomValues( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); int dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.setRandomValues(dst->getArrayData(d), width, low, face_box); @@ -305,12 +280,12 @@ PatchFaceDataBasicOps::min( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = data->getDim().getValue(); TYPE minval = tbox::MathUtilities::getMax(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); minval = tbox::MathUtilities::Min( minval, d_array_ops.min(data->getArrayData(d), face_box)); @@ -325,12 +300,12 @@ PatchFaceDataBasicOps::max( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = data->getDim().getValue(); TYPE maxval = -tbox::MathUtilities::getMax(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); maxval = tbox::MathUtilities::Max( maxval, d_array_ops.max(data->getArrayData(d), face_box)); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.h index 5ddb07c1..79031a71 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated face-centered patch data operations. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -27,11 +27,10 @@ namespace math { * Class PatchFaceDataBasicOps provides access to a collection * of basic numerical operations that may be applied to numerical face- * centered patch data. These operations include simple arithmetic - * operations as well as min and max, etc. The primary intent of this - * class is to provide the interface to these standard operations for - * an PatchFaceDataOps object which provides access to a complete set - * of operations that may be used to manipulate face-centered patch data - * objects. Each member function accepts a box argument indicating the + * operations as well as min and max, etc. This class provides a single + * implementation of these operations that may be used to manipulate any + * face-centered patch data object. Each member function accepts a box + * argument indicating the * region of index space on which the operation should be performed. The * operation will be performed on the intersection of this box and those * boxes corresponding to the patch data objects involved. @@ -43,7 +42,7 @@ namespace math { * types as the template parameter. None of the operations are implemented * for any other type. * - * @see math::ArrayDataBasicOps + * @see ArrayDataBasicOps */ template @@ -59,6 +58,9 @@ class PatchFaceDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim() */ void scale( @@ -69,6 +71,9 @@ class PatchFaceDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim() */ void addScalar( @@ -79,6 +84,10 @@ class PatchFaceDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void add( @@ -89,6 +98,10 @@ class PatchFaceDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void subtract( @@ -99,6 +112,10 @@ class PatchFaceDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void multiply( @@ -109,6 +126,10 @@ class PatchFaceDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void divide( @@ -119,6 +140,9 @@ class PatchFaceDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim() */ void reciprocal( @@ -128,6 +152,10 @@ class PatchFaceDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void linearSum( @@ -140,6 +168,10 @@ class PatchFaceDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void axpy( @@ -151,6 +183,10 @@ class PatchFaceDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim() */ void axmy( @@ -163,6 +199,9 @@ class PatchFaceDataBasicOps /** * Return the minimum patch data component entry When the data is * complex, the result is the data element with the smallest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE min( @@ -172,6 +211,9 @@ class PatchFaceDataBasicOps /** * Return the maximum patch data component entry When the data is * complex, the result is the data element with the largest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE max( @@ -182,6 +224,9 @@ class PatchFaceDataBasicOps * Set patch data to random values. See the operations in the * ArrayDataBasicOps class for details on the generation * of the random values for each data type. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setRandomValues( @@ -193,10 +238,10 @@ class PatchFaceDataBasicOps private: // The following are not implemented: PatchFaceDataBasicOps( - const PatchFaceDataBasicOps&); - void + const PatchFaceDataBasicOps&); + PatchFaceDataBasicOps& operator = ( - const PatchFaceDataBasicOps&); + const PatchFaceDataBasicOps&); ArrayDataBasicOps d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C index c05ae28c..d9ee60b3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real face-centered data. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchFaceDataMiscellaneousOpsReal::~PatchFaceDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchFaceDataMiscellaneousOpsReal::PatchFaceDataMiscellaneousOpsReal( - const PatchFaceDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchFaceDataMiscellaneousOpsReal::operator = ( - const PatchFaceDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -72,11 +47,11 @@ PatchFaceDataMiscellaneousOpsReal::computeConstrProdPos( { TBOX_ASSERT(data1 && data2); - int dimVal = data1->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1->getDim().getValue(); int retval = 1; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -86,7 +61,7 @@ PatchFaceDataMiscellaneousOpsReal::computeConstrProdPos( face_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -111,10 +86,10 @@ PatchFaceDataMiscellaneousOpsReal::compareToScalar( { TBOX_ASSERT(dst && src); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.compareToScalar(dst->getArrayData(d), src->getArrayData(d), @@ -122,7 +97,7 @@ PatchFaceDataMiscellaneousOpsReal::compareToScalar( face_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.compareToScalarWithControlVolume(dst->getArrayData(d), src->getArrayData(d), @@ -143,11 +118,11 @@ PatchFaceDataMiscellaneousOpsReal::testReciprocal( { TBOX_ASSERT(dst && src); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); int retval = 1; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -157,7 +132,7 @@ PatchFaceDataMiscellaneousOpsReal::testReciprocal( face_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Min(retval, @@ -180,10 +155,10 @@ PatchFaceDataMiscellaneousOpsReal::maxPointwiseDivide( { TBOX_ASSERT(numer && denom); - int dimVal = numer->getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); TYPE dirval = d_array_ops.maxPointwiseDivide(numer->getArrayData(d), @@ -203,10 +178,10 @@ PatchFaceDataMiscellaneousOpsReal::minPointwiseDivide( { TBOX_ASSERT(numer && denom); - int dimVal = numer->getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); TYPE dirval = d_array_ops.minPointwiseDivide(numer->getArrayData(d), denom->getArrayData(d), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h index bf4bf97c..d41a22b7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real face-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataMiscellaneousOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * to include other operations, the member functions must be specialized or the * new operations must be added. * - * @see math::ArrayDataMiscellaneousOpsReal + * @see ArrayDataMiscellaneousOpsReal */ template @@ -69,6 +69,8 @@ class PatchFaceDataMiscellaneousOpsReal * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. * If the control volume is NULL, all values in the index set are used. + * + * @pre data1 && data2 */ int computeConstrProdPos( @@ -82,6 +84,8 @@ class PatchFaceDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is NULL, all values in the index set are considered. + * + * @pre dst && src */ void compareToScalar( @@ -97,6 +101,8 @@ class PatchFaceDataMiscellaneousOpsReal * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. If the control volume * all values in the index set are considered. + * + * @pre dst && src */ int testReciprocal( @@ -118,6 +124,8 @@ class PatchFaceDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE maxPointwiseDivide( @@ -138,6 +146,8 @@ class PatchFaceDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE minPointwiseDivide( @@ -148,10 +158,10 @@ class PatchFaceDataMiscellaneousOpsReal private: // The following are not implemented: PatchFaceDataMiscellaneousOpsReal( - const PatchFaceDataMiscellaneousOpsReal&); - void + const PatchFaceDataMiscellaneousOpsReal&); + PatchFaceDataMiscellaneousOpsReal& operator = ( - const PatchFaceDataMiscellaneousOpsReal&); + const PatchFaceDataMiscellaneousOpsReal&); ArrayDataMiscellaneousOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.C index 466ab1f5..2670a78e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.C @@ -3,18 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex face-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchFaceDataNormOpsComplex_C -#define included_math_PatchFaceDataNormOpsComplex_C - #include "SAMRAI/math/PatchFaceDataNormOpsComplex.h" #include "SAMRAI/pdat/FaceGeometry.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + namespace SAMRAI { namespace math { @@ -36,18 +34,18 @@ PatchFaceDataNormOpsComplex::~PatchFaceDataNormOpsComplex() int PatchFaceDataNormOpsComplex::numberOfEntries( - const boost::shared_ptr >& data, - const hier::Box& box) const + const boost::shared_ptr >& data, + const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); int retval = 0; const hier::Box ibox = box * data->getGhostBox(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { - retval += ((pdat::FaceGeometry::toFaceBox(ibox, d).size()) * data_depth); + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { + retval += static_cast((pdat::FaceGeometry::toFaceBox(ibox, d).size()) * data_depth); } return retval; } @@ -68,9 +66,9 @@ PatchFaceDataNormOpsComplex::sumControlVolumes( { TBOX_ASSERT(data && cvol); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); double retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { retval += d_array_ops.sumControlVolumes(data->getArrayData(d), cvol->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); @@ -85,10 +83,10 @@ PatchFaceDataNormOpsComplex::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); @@ -102,20 +100,20 @@ PatchFaceDataNormOpsComplex::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), face_box); } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), cvol->getArrayData(d), @@ -132,21 +130,21 @@ PatchFaceDataNormOpsComplex::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), face_box); retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( data->getArrayData(d), @@ -166,13 +164,13 @@ PatchFaceDataNormOpsComplex::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), weight->getArrayData(d), @@ -180,9 +178,9 @@ PatchFaceDataNormOpsComplex::weightedL2Norm( retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(d), @@ -238,18 +236,18 @@ PatchFaceDataNormOpsComplex::maxNorm( { TBOX_ASSERT(data); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Max(retval, d_array_ops.maxNorm(data->getArrayData(d), face_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Max(retval, @@ -269,18 +267,18 @@ PatchFaceDataNormOpsComplex::dot( { TBOX_ASSERT(data1 && data2); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); dcomplex retval = dcomplex(0.0, 0.0); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), data2->getArrayData(d), face_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.dotWithControlVolume( data1->getArrayData(d), @@ -300,9 +298,9 @@ PatchFaceDataNormOpsComplex::integral( { TBOX_ASSERT(data); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); dcomplex retval = dcomplex(0.0, 0.0); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { retval += d_array_ops.integral(data->getArrayData(d), vol->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); @@ -312,4 +310,3 @@ PatchFaceDataNormOpsComplex::integral( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.h index 958be24c..4c428554 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex face-centered data. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -48,7 +48,7 @@ namespace math { * Note that a similar set of norm operations is implemented for real * patch data (double and float) in the class PatchFaceDataNormOpsReal. * - * @see math::ArrayDataNormOpsComplex + * @see ArrayDataNormOpsComplex */ class PatchFaceDataNormOpsComplex @@ -65,6 +65,9 @@ class PatchFaceDataNormOpsComplex * Return the number of data values for the face-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ int numberOfEntries( @@ -73,6 +76,8 @@ class PatchFaceDataNormOpsComplex /** * Return sum of control volume entries for the face-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -84,6 +89,9 @@ class PatchFaceDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -97,6 +105,10 @@ class PatchFaceDataNormOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is NULL, the return value is * \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -112,6 +124,10 @@ class PatchFaceDataNormOpsComplex * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +143,11 @@ class PatchFaceDataNormOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +163,8 @@ class PatchFaceDataNormOpsComplex * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -156,6 +179,8 @@ class PatchFaceDataNormOpsComplex * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +196,8 @@ class PatchFaceDataNormOpsComplex * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. If the control volume is * NULL, it is ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -184,6 +211,8 @@ class PatchFaceDataNormOpsComplex * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ dcomplex dot( @@ -196,6 +225,8 @@ class PatchFaceDataNormOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ dcomplex integral( @@ -207,7 +238,7 @@ class PatchFaceDataNormOpsComplex // The following are not implemented: PatchFaceDataNormOpsComplex( const PatchFaceDataNormOpsComplex&); - void + PatchFaceDataNormOpsComplex& operator = ( const PatchFaceDataNormOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.C index 2f6cc997..a92915d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real face-centered patch data. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchFaceDataNormOpsReal::~PatchFaceDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchFaceDataNormOpsReal::PatchFaceDataNormOpsReal( - const PatchFaceDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchFaceDataNormOpsReal::operator = ( - const PatchFaceDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -63,19 +38,19 @@ PatchFaceDataNormOpsReal::operator = ( */ template -int +size_t PatchFaceDataNormOpsReal::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); - int retval = 0; + size_t retval = 0; const hier::Box ibox = box * data->getGhostBox(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box dbox = pdat::FaceGeometry::toFaceBox(ibox, d); retval += (dbox.size() * data->getDepth()); } @@ -99,10 +74,10 @@ PatchFaceDataNormOpsReal::sumControlVolumes( { TBOX_ASSERT(data && cvol); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.sumControlVolumes(data->getArrayData(d), cvol->getArrayData(d), @@ -119,11 +94,11 @@ PatchFaceDataNormOpsReal::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), @@ -139,20 +114,20 @@ PatchFaceDataNormOpsReal::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), face_box); } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), cvol->getArrayData(d), @@ -170,21 +145,21 @@ PatchFaceDataNormOpsReal::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), face_box); retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( data->getArrayData(d), @@ -205,13 +180,13 @@ PatchFaceDataNormOpsReal::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), weight->getArrayData(d), @@ -219,9 +194,9 @@ PatchFaceDataNormOpsReal::weightedL2Norm( retval += aval * aval; } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(d), @@ -280,18 +255,18 @@ PatchFaceDataNormOpsReal::maxNorm( { TBOX_ASSERT(data); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Max(retval, d_array_ops.maxNorm(data->getArrayData(d), face_box)); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval = tbox::MathUtilities::Max(retval, @@ -314,18 +289,18 @@ PatchFaceDataNormOpsReal::dot( { TBOX_ASSERT(data1 && data2); - int dimVal = data1->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1->getDim().getValue(); TYPE retval = 0.0; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), data2->getArrayData(d), face_box); } } else { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.dotWithControlVolume( data1->getArrayData(d), @@ -346,11 +321,11 @@ PatchFaceDataNormOpsReal::integral( { TBOX_ASSERT(data); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); retval += d_array_ops.integral(data->getArrayData(d), vol->getArrayData(d), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.h index ebbe77c8..c49cf362 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real face-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataNormOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * implemented for complex patch data in the class * PatchFaceDataNormOpsComplex. * - * @see math::ArrayDataNormOpsReal + * @see ArrayDataNormOpsReal */ template @@ -69,14 +69,19 @@ class PatchFaceDataNormOpsReal * Return the number of data values for the face-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the face-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -87,6 +92,9 @@ class PatchFaceDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -99,6 +107,10 @@ class PatchFaceDataNormOpsReal * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. If the * control volume is NULL, the return value is \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -113,6 +125,10 @@ class PatchFaceDataNormOpsReal * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +143,11 @@ class PatchFaceDataNormOpsReal * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is NULL, * the return value is \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +163,8 @@ class PatchFaceDataNormOpsReal * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -156,6 +179,8 @@ class PatchFaceDataNormOpsReal * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +196,8 @@ class PatchFaceDataNormOpsReal * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. If the control volume is NULL, it is * ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -184,6 +211,8 @@ class PatchFaceDataNormOpsReal * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ TYPE dot( @@ -196,6 +225,8 @@ class PatchFaceDataNormOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ TYPE integral( @@ -206,10 +237,10 @@ class PatchFaceDataNormOpsReal private: // The following are not implemented: PatchFaceDataNormOpsReal( - const PatchFaceDataNormOpsReal&); - void + const PatchFaceDataNormOpsReal&); + PatchFaceDataNormOpsReal& operator = ( - const PatchFaceDataNormOpsReal&); + const PatchFaceDataNormOpsReal&); ArrayDataNormOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.C index 86656867..86200a67 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex face-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchFaceDataOpsComplex_C -#define included_math_PatchFaceDataOpsComplex_C - #include "SAMRAI/math/PatchFaceDataOpsComplex.h" #include "SAMRAI/pdat/FaceGeometry.h" @@ -42,11 +38,11 @@ PatchFaceDataOpsComplex::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -64,7 +60,7 @@ PatchFaceDataOpsComplex::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -78,10 +74,10 @@ PatchFaceDataOpsComplex::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); } @@ -89,4 +85,3 @@ PatchFaceDataOpsComplex::copyData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.h index eb368b98..d01e9645 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex face-centered patch data. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,8 @@ namespace math { * integer patch data in the classes PatchFaceDataOpsReal and * PatchFaceDataOpsInteger, repsectively. * - * @see math::PatchFaceDataBasicOps - * @see math::PatchFaceDataNormOpsComplex + * @see PatchFaceDataBasicOps + * @see PatchFaceDataNormOpsComplex */ class PatchFaceDataOpsComplex: @@ -60,6 +60,10 @@ class PatchFaceDataOpsComplex: /** * Copy dst data to src data over given box. + * + * @pre data && src + * @pre (data->getDim() == src->getDim()) && + * (data->getDim() == box.getDim()) */ void copyData( @@ -70,6 +74,13 @@ class PatchFaceDataOpsComplex: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -79,6 +90,9 @@ class PatchFaceDataOpsComplex: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -88,6 +102,9 @@ class PatchFaceDataOpsComplex: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -96,7 +113,7 @@ class PatchFaceDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } @@ -104,7 +121,7 @@ class PatchFaceDataOpsComplex: // The following are not implemented: PatchFaceDataOpsComplex( const PatchFaceDataOpsComplex&); - void + PatchFaceDataOpsComplex& operator = ( const PatchFaceDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.C index db5d284e..70b8a971 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer face-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchFaceDataOpsInteger_C -#define included_math_PatchFaceDataOpsInteger_C - #include "SAMRAI/math/PatchFaceDataOpsInteger.h" #include "SAMRAI/pdat/FaceGeometry.h" @@ -35,18 +31,20 @@ PatchFaceDataOpsInteger::~PatchFaceDataOpsInteger() int PatchFaceDataOpsInteger::numberOfEntries( - const boost::shared_ptr >& data, - const hier::Box& box) const + const boost::shared_ptr >& data, + const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); int retval = 0; const hier::Box ibox = box * data->getGhostBox(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { - retval += ((pdat::FaceGeometry::toFaceBox(ibox, d).size()) * data_depth); + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { + retval += + static_cast((pdat::FaceGeometry::toFaceBox(ibox, + d).size()) * data_depth); } return retval; } @@ -68,11 +66,11 @@ PatchFaceDataOpsInteger::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -85,12 +83,12 @@ PatchFaceDataOpsInteger::swapData( void PatchFaceDataOpsInteger::printData( - const boost::shared_ptr >& data, - const hier::Box& box, - std::ostream& s) const + const boost::shared_ptr >& data, + const hier::Box& box, + std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -104,10 +102,10 @@ PatchFaceDataOpsInteger::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); } @@ -120,10 +118,10 @@ PatchFaceDataOpsInteger::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), pdat::FaceGeometry::toFaceBox(box, d)); @@ -132,4 +130,3 @@ PatchFaceDataOpsInteger::abs( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.h index 19bef4db..64efa0e1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer face-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,7 +39,7 @@ namespace math { * float) and complex patch data in the classes PatchFaceDataOpsReal * and PatchFaceDataOpsComplex, repsectively. * - * @see math::PatchFaceDataBasicOps + * @see PatchFaceDataBasicOps */ class PatchFaceDataOpsInteger: @@ -57,6 +57,9 @@ class PatchFaceDataOpsInteger: * Return the number of data values for the face-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ int numberOfEntries( @@ -65,6 +68,9 @@ class PatchFaceDataOpsInteger: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -75,6 +81,13 @@ class PatchFaceDataOpsInteger: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +97,9 @@ class PatchFaceDataOpsInteger: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -93,6 +109,9 @@ class PatchFaceDataOpsInteger: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -101,13 +120,16 @@ class PatchFaceDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -119,7 +141,7 @@ class PatchFaceDataOpsInteger: // The following are not implemented: PatchFaceDataOpsInteger( const PatchFaceDataOpsInteger&); - void + PatchFaceDataOpsInteger& operator = ( const PatchFaceDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.C index bd3adabe..00bb8087 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real face-centered patch data. * ************************************************************************/ @@ -34,31 +34,6 @@ PatchFaceDataOpsReal::~PatchFaceDataOpsReal() } #endif -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchFaceDataOpsReal::PatchFaceDataOpsReal( - const PatchFaceDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchFaceDataOpsReal::operator = ( - const PatchFaceDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -77,11 +52,11 @@ PatchFaceDataOpsReal::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -100,7 +75,7 @@ PatchFaceDataOpsReal::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -115,11 +90,11 @@ PatchFaceDataOpsReal::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, d); (dst->getArrayData(d)).copy(src->getArrayData(d), face_box); } @@ -133,7 +108,7 @@ PatchFaceDataOpsReal::setToScalar( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.h index 7dab9d10..fbc67236 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchFaceDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real face-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -44,9 +44,9 @@ namespace math { * PatchFaceDataOpsComplex and PatchFaceDataOpsInteger, * repsectively. * - * @see math::PatchFaceDataBasicOps - * @see math::PatchFaceDataMiscellaneousOpsReal - * @see math::PatchFaceDataNormOpsReal + * @see PatchFaceDataBasicOps + * @see PatchFaceDataMiscellaneousOpsReal + * @see PatchFaceDataNormOpsReal */ template @@ -66,6 +66,9 @@ class PatchFaceDataOpsReal: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -76,6 +79,13 @@ class PatchFaceDataOpsReal: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -85,6 +95,9 @@ class PatchFaceDataOpsReal: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -94,6 +107,9 @@ class PatchFaceDataOpsReal: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -104,10 +120,10 @@ class PatchFaceDataOpsReal: private: // The following are not implemented: PatchFaceDataOpsReal( - const PatchFaceDataOpsReal&); - void + const PatchFaceDataOpsReal&); + PatchFaceDataOpsReal& operator = ( - const PatchFaceDataOpsReal&); + const PatchFaceDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.C index 2fa8bec4..5b7d7729 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated node-centered patch data operations. * ************************************************************************/ @@ -28,31 +28,6 @@ PatchNodeDataBasicOps::~PatchNodeDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchNodeDataBasicOps::PatchNodeDataBasicOps( - const PatchNodeDataBasicOps& foo) -{ - NULL_USE(foo); -} - -template -void -PatchNodeDataBasicOps::operator = ( - const PatchNodeDataBasicOps& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -70,7 +45,7 @@ PatchNodeDataBasicOps::scale( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.scale(dst->getArrayData(), @@ -87,7 +62,7 @@ PatchNodeDataBasicOps::addScalar( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.addScalar(dst->getArrayData(), @@ -104,7 +79,7 @@ PatchNodeDataBasicOps::add( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.add(dst->getArrayData(), @@ -121,7 +96,7 @@ PatchNodeDataBasicOps::subtract( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.subtract(dst->getArrayData(), @@ -138,7 +113,7 @@ PatchNodeDataBasicOps::multiply( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.multiply(dst->getArrayData(), @@ -155,7 +130,7 @@ PatchNodeDataBasicOps::divide( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.divide(dst->getArrayData(), @@ -171,7 +146,7 @@ PatchNodeDataBasicOps::reciprocal( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.reciprocal(dst->getArrayData(), @@ -190,7 +165,7 @@ PatchNodeDataBasicOps::linearSum( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.linearSum(dst->getArrayData(), @@ -209,7 +184,7 @@ PatchNodeDataBasicOps::axpy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.axpy(dst->getArrayData(), @@ -228,7 +203,7 @@ PatchNodeDataBasicOps::axmy( const hier::Box& box) const { TBOX_ASSERT(dst && src1 && src2); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.axmy(dst->getArrayData(), @@ -244,7 +219,7 @@ PatchNodeDataBasicOps::min( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); return d_array_ops.min(data->getArrayData(), node_box); @@ -257,7 +232,7 @@ PatchNodeDataBasicOps::max( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); return d_array_ops.max(data->getArrayData(), node_box); @@ -272,7 +247,7 @@ PatchNodeDataBasicOps::setRandomValues( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.setRandomValues(dst->getArrayData(), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.h index d60409df..fc826390 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated node-centered patch data operations. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/NodeData.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -27,11 +27,10 @@ namespace math { * Class PatchNodeDataBasicOps provides access to a collection * of basic numerical operations that may be applied to numerical node- * centered patch data. These operations include simple arithmetic - * operations as well as minand max, etc. The primary intent of this - * class is to provide the interface to these standard operations for - * an PatchNodeDataOps object which provides access to a complete set - * of operations that may be used to manipulate node-centered patch data - * objects. Each member function accepts a box argument indicating the + * operations as well as minand max, etc. This class provides a single + * implementation of these operations that may be used to manipulate any + * node-centered patch data object. Each member function accepts a box + * argument indicating the * region of index space on which the operation should be performed. The * operation will be performed on the intersection of this box and those * boxes corresponding to the patch data objects involved. @@ -43,7 +42,7 @@ namespace math { * types as the template parameter. None of the operations are implemented * for any other type. * - * @see math::ArrayDataBasicOps + * @see ArrayDataBasicOps */ template @@ -59,6 +58,9 @@ class PatchNodeDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void scale( @@ -69,6 +71,9 @@ class PatchNodeDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void addScalar( @@ -79,6 +84,10 @@ class PatchNodeDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void add( @@ -89,6 +98,10 @@ class PatchNodeDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void subtract( @@ -99,6 +112,10 @@ class PatchNodeDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void multiply( @@ -109,6 +126,10 @@ class PatchNodeDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void divide( @@ -119,6 +140,9 @@ class PatchNodeDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void reciprocal( @@ -128,6 +152,10 @@ class PatchNodeDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void linearSum( @@ -140,6 +168,10 @@ class PatchNodeDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axpy( @@ -151,6 +183,10 @@ class PatchNodeDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axmy( @@ -163,6 +199,9 @@ class PatchNodeDataBasicOps /** * Return the minimum patch data component entry When the data is * complex, the result is the data element with the smallest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE min( @@ -172,6 +211,9 @@ class PatchNodeDataBasicOps /** * Return the maximum patch data component entry When the data is * complex, the result is the data element with the largest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE max( @@ -182,6 +224,9 @@ class PatchNodeDataBasicOps * Set patch data to random values. See the operations in the * ArrayDataBasicOps class for details on the generation * of the random values for each data type. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setRandomValues( @@ -193,10 +238,10 @@ class PatchNodeDataBasicOps private: // The following are not implemented: PatchNodeDataBasicOps( - const PatchNodeDataBasicOps&); - void + const PatchNodeDataBasicOps&); + PatchNodeDataBasicOps& operator = ( - const PatchNodeDataBasicOps&); + const PatchNodeDataBasicOps&); ArrayDataBasicOps d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C index a7530984..899410d3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real node-centered data. * ************************************************************************/ @@ -28,31 +28,6 @@ PatchNodeDataMiscellaneousOpsReal::~PatchNodeDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchNodeDataMiscellaneousOpsReal::PatchNodeDataMiscellaneousOpsReal( - const PatchNodeDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchNodeDataMiscellaneousOpsReal::operator = ( - const PatchNodeDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h index 96571ab9..7f2a7f0b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real node-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/NodeData.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * to include other operations, the member functions must be specialized or the * new operations must be added. * - * @see math::ArrayDataMiscellaneousOpsReal + * @see ArrayDataMiscellaneousOpsReal */ template @@ -69,6 +69,8 @@ class PatchNodeDataMiscellaneousOpsReal * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. * If the control volume is NULL, all values in the index set are used. + * + * @pre data1 && data2 */ int computeConstrProdPos( @@ -82,6 +84,8 @@ class PatchNodeDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is NULL, all values in the index set are considered. + * + * @pre dst && src */ void compareToScalar( @@ -97,6 +101,8 @@ class PatchNodeDataMiscellaneousOpsReal * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. If the control volume * all values in the index set are considered. + * + * @pre dst && src */ int testReciprocal( @@ -118,6 +124,8 @@ class PatchNodeDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE maxPointwiseDivide( @@ -138,6 +146,8 @@ class PatchNodeDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE minPointwiseDivide( @@ -148,10 +158,10 @@ class PatchNodeDataMiscellaneousOpsReal private: // The following are not implemented: PatchNodeDataMiscellaneousOpsReal( - const PatchNodeDataMiscellaneousOpsReal&); - void + const PatchNodeDataMiscellaneousOpsReal&); + PatchNodeDataMiscellaneousOpsReal& operator = ( - const PatchNodeDataMiscellaneousOpsReal&); + const PatchNodeDataMiscellaneousOpsReal&); ArrayDataMiscellaneousOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.C index 0287da35..8c333cc9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.C @@ -3,17 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex node-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchNodeDataNormOpsComplex_C -#define included_math_PatchNodeDataNormOpsComplex_C - #include "SAMRAI/math/PatchNodeDataNormOpsComplex.h" #include "SAMRAI/pdat/NodeGeometry.h" +#include + namespace SAMRAI { namespace math { @@ -32,14 +30,14 @@ PatchNodeDataNormOpsComplex::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); if (!cvol) { retval = d_array_ops.L1Norm(data->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L1NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -55,14 +53,14 @@ PatchNodeDataNormOpsComplex::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); if (!cvol) { retval = d_array_ops.L2Norm(data->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L2NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -79,7 +77,7 @@ PatchNodeDataNormOpsComplex::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); @@ -88,7 +86,7 @@ PatchNodeDataNormOpsComplex::weightedL2Norm( weight->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(), @@ -181,4 +179,3 @@ PatchNodeDataNormOpsComplex::dot( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.h index 5b9c2e80..ef7cb26b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex node-centered data. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -48,7 +48,7 @@ namespace math { * Note that a similar set of norm operations is implemented for real * patch data (double and float) in the class PatchNodeDataNormOpsReal. * - * @see math::ArrayDataNormOpsComplex + * @see ArrayDataNormOpsComplex */ class PatchNodeDataNormOpsComplex @@ -65,20 +65,25 @@ class PatchNodeDataNormOpsComplex * Return the number of data values for the node-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); - return (pdat::NodeGeometry::toNodeBox(box * data->getGhostBox())).size() * - data->getDepth(); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); + return (pdat::NodeGeometry::toNodeBox(box * data->getGhostBox())).size() + * data->getDepth(); } /** * Return sum of control volume entries for the node-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -96,6 +101,9 @@ class PatchNodeDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -104,7 +112,7 @@ class PatchNodeDataNormOpsComplex const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.abs(dst->getArrayData(), src->getArrayData(), pdat::NodeGeometry::toNodeBox(box)); @@ -116,6 +124,10 @@ class PatchNodeDataNormOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is NULL, the return value is * \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -131,6 +143,10 @@ class PatchNodeDataNormOpsComplex * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -146,6 +162,11 @@ class PatchNodeDataNormOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -161,6 +182,8 @@ class PatchNodeDataNormOpsComplex * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -175,6 +198,8 @@ class PatchNodeDataNormOpsComplex * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -190,6 +215,8 @@ class PatchNodeDataNormOpsComplex * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. If the control volume is * NULL, it is ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -203,6 +230,8 @@ class PatchNodeDataNormOpsComplex * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ dcomplex dot( @@ -215,6 +244,8 @@ class PatchNodeDataNormOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ dcomplex integral( @@ -233,7 +264,7 @@ class PatchNodeDataNormOpsComplex // The following are not implemented: PatchNodeDataNormOpsComplex( const PatchNodeDataNormOpsComplex&); - void + PatchNodeDataNormOpsComplex& operator = ( const PatchNodeDataNormOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.C index 57552faf..25ad54a3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real node-centered patch data. * ************************************************************************/ @@ -15,6 +15,8 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/pdat/NodeGeometry.h" +#include + namespace SAMRAI { namespace math { @@ -28,31 +30,6 @@ PatchNodeDataNormOpsReal::~PatchNodeDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchNodeDataNormOpsReal::PatchNodeDataNormOpsReal( - const PatchNodeDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchNodeDataNormOpsReal::operator = ( - const PatchNodeDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -62,17 +39,17 @@ PatchNodeDataNormOpsReal::operator = ( */ template -int +size_t PatchNodeDataNormOpsReal::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); const hier::Box ibox = pdat::NodeGeometry::toNodeBox(box * data->getGhostBox()); - int retval = ibox.size() * data->getDepth(); + size_t retval = ibox.size() * data->getDepth(); return retval; } @@ -107,7 +84,7 @@ PatchNodeDataNormOpsReal::abs( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); d_array_ops.abs(dst->getArrayData(), @@ -123,14 +100,14 @@ PatchNodeDataNormOpsReal::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); if (!cvol) { retval = d_array_ops.L1Norm(data->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L1NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -147,14 +124,14 @@ PatchNodeDataNormOpsReal::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); if (!cvol) { retval = d_array_ops.L2Norm(data->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.L2NormWithControlVolume(data->getArrayData(), cvol->getArrayData(), @@ -172,7 +149,7 @@ PatchNodeDataNormOpsReal::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); double retval; const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); @@ -181,7 +158,7 @@ PatchNodeDataNormOpsReal::weightedL2Norm( weight->getArrayData(), node_box); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval = d_array_ops.weightedL2NormWithControlVolume( data->getArrayData(), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.h index 0e03331b..0c091a45 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real node-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataNormOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * implemented for complex patch data in the class * PatchNodeDataNormOpsComplex. * - * @see math::ArrayDataNormOpsReal + * @see ArrayDataNormOpsReal */ template @@ -69,14 +69,19 @@ class PatchNodeDataNormOpsReal * Return the number of data values for the node-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the node-centered data object. + * + * @pre data && cvol */ double sumControlVolumes( @@ -87,6 +92,9 @@ class PatchNodeDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -99,6 +107,10 @@ class PatchNodeDataNormOpsReal * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. If the * control volume is NULL, the return value is \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -113,6 +125,10 @@ class PatchNodeDataNormOpsReal * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +143,11 @@ class PatchNodeDataNormOpsReal * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is NULL, * the return value is \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +163,8 @@ class PatchNodeDataNormOpsReal * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -156,6 +179,8 @@ class PatchNodeDataNormOpsReal * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +196,8 @@ class PatchNodeDataNormOpsReal * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. If the control volume is NULL, it is * ignored during the computation of the maximum. + * + * @pre data */ double maxNorm( @@ -184,6 +211,8 @@ class PatchNodeDataNormOpsReal * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 */ TYPE dot( @@ -196,6 +225,8 @@ class PatchNodeDataNormOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data */ TYPE integral( @@ -206,10 +237,10 @@ class PatchNodeDataNormOpsReal private: // The following are not implemented: PatchNodeDataNormOpsReal( - const PatchNodeDataNormOpsReal&); - void + const PatchNodeDataNormOpsReal&); + PatchNodeDataNormOpsReal& operator = ( - const PatchNodeDataNormOpsReal&); + const PatchNodeDataNormOpsReal&); ArrayDataNormOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.C index 33fbd052..f643e2f3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex node-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchNodeDataOpsComplex_C -#define included_math_PatchNodeDataOpsComplex_C - #include "SAMRAI/math/PatchNodeDataOpsComplex.h" #include "SAMRAI/pdat/NodeGeometry.h" @@ -42,11 +38,11 @@ PatchNodeDataOpsComplex::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -64,7 +60,7 @@ PatchNodeDataOpsComplex::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -73,4 +69,3 @@ PatchNodeDataOpsComplex::printData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.h index 9e4e8c64..5d2b1939 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex node-centered patch data. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,8 @@ namespace math { * integer patch data in the classes PatchNodeDataOpsReal and * PatchNodeDataOpsInteger, repsectively. * - * @see math::PatchNodeDataBasicOps - * @see math::PatchNodeDataNormOpsComplex + * @see PatchNodeDataBasicOps + * @see PatchNodeDataNormOpsComplex */ class PatchNodeDataOpsComplex: @@ -60,6 +60,9 @@ class PatchNodeDataOpsComplex: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -68,7 +71,7 @@ class PatchNodeDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); dst->getArrayData().copy(src->getArrayData(), pdat::NodeGeometry::toNodeBox(box)); } @@ -76,6 +79,13 @@ class PatchNodeDataOpsComplex: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -85,6 +95,9 @@ class PatchNodeDataOpsComplex: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -94,6 +107,9 @@ class PatchNodeDataOpsComplex: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -102,7 +118,7 @@ class PatchNodeDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } @@ -110,7 +126,7 @@ class PatchNodeDataOpsComplex: // The following are not implemented: PatchNodeDataOpsComplex( const PatchNodeDataOpsComplex&); - void + PatchNodeDataOpsComplex& operator = ( const PatchNodeDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.C index ef04b8d0..053b0ffe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer node-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchNodeDataOpsInteger_C -#define included_math_PatchNodeDataOpsInteger_C - #include "SAMRAI/math/PatchNodeDataOpsInteger.h" #include "SAMRAI/pdat/NodeGeometry.h" @@ -42,11 +38,11 @@ PatchNodeDataOpsInteger::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -64,7 +60,7 @@ PatchNodeDataOpsInteger::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -73,4 +69,3 @@ PatchNodeDataOpsInteger::printData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.h index 370abc17..1bc5273b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer node-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,7 +39,7 @@ namespace math { * float) and complex patch data in the classes PatchNodeDataOpsReal * and PatchNodeDataOpsComplex, repsectively. * - * @see math::PatchNodeDataBasicOps + * @see PatchNodeDataBasicOps */ class PatchNodeDataOpsInteger: @@ -57,20 +57,26 @@ class PatchNodeDataOpsInteger: * Return the number of data values for the node-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); - return (pdat::NodeGeometry::toNodeBox(box * data->getGhostBox()).size()) * - data->getDepth(); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); + return (pdat::NodeGeometry::toNodeBox(box * data->getGhostBox()).size()) + * data->getDepth(); } /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -79,14 +85,21 @@ class PatchNodeDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); dst->getArrayData().copy(src->getArrayData(), pdat::NodeGeometry::toNodeBox(box)); } /** - * Swap pointers for patch data objects. Objects are checked for + * Swap pointers for patch data objects. Objects iare checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -96,6 +109,9 @@ class PatchNodeDataOpsInteger: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -105,6 +121,9 @@ class PatchNodeDataOpsInteger: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -113,13 +132,16 @@ class PatchNodeDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -128,7 +150,7 @@ class PatchNodeDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); d_array_ops.abs(dst->getArrayData(), src->getArrayData(), pdat::NodeGeometry::toNodeBox(box)); @@ -138,7 +160,7 @@ class PatchNodeDataOpsInteger: // The following are not implemented: PatchNodeDataOpsInteger( const PatchNodeDataOpsInteger&); - void + PatchNodeDataOpsInteger& operator = ( const PatchNodeDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.C index 23dd218c..e34051cb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real node-centered patch data. * ************************************************************************/ @@ -35,31 +35,6 @@ PatchNodeDataOpsReal::~PatchNodeDataOpsReal() } #endif -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchNodeDataOpsReal::PatchNodeDataOpsReal( - const PatchNodeDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchNodeDataOpsReal::operator = ( - const PatchNodeDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -78,11 +53,11 @@ PatchNodeDataOpsReal::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -101,7 +76,7 @@ PatchNodeDataOpsReal::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -116,7 +91,7 @@ PatchNodeDataOpsReal::copyData( const hier::Box& box) const { TBOX_ASSERT(dst && src); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); const hier::Box node_box = pdat::NodeGeometry::toNodeBox(box); (dst->getArrayData()).copy(src->getArrayData(), node_box); @@ -130,7 +105,7 @@ PatchNodeDataOpsReal::setToScalar( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.h index fc050c4b..648b5f30 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchNodeDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real node-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -44,9 +44,9 @@ namespace math { * PatchNodeDataOpsComplex and PatchNodeDataOpsInteger, * repsectively. * - * @see math::PatchNodeDataBasicOps - * @see math::PatchNodeDataMiscellaneousOpsReal - * @see math::PatchNodeDataNormOpsReal + * @see PatchNodeDataBasicOps + * @see PatchNodeDataMiscellaneousOpsReal + * @see PatchNodeDataNormOpsReal */ template @@ -66,6 +66,9 @@ class PatchNodeDataOpsReal: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -76,6 +79,13 @@ class PatchNodeDataOpsReal: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -85,6 +95,9 @@ class PatchNodeDataOpsReal: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -94,6 +107,9 @@ class PatchNodeDataOpsReal: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -104,10 +120,10 @@ class PatchNodeDataOpsReal: private: // The following are not implemented: PatchNodeDataOpsReal( - const PatchNodeDataOpsReal&); - void + const PatchNodeDataOpsReal&); + PatchNodeDataOpsReal& operator = ( - const PatchNodeDataOpsReal&); + const PatchNodeDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.C index dc8e86df..68189f7f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated side-centered patch data operations. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchSideDataBasicOps::~PatchSideDataBasicOps() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchSideDataBasicOps::PatchSideDataBasicOps( - const PatchSideDataBasicOps& foo) -{ - NULL_USE(foo); -} - -template -void -PatchSideDataBasicOps::operator = ( - const PatchSideDataBasicOps& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -72,12 +47,12 @@ PatchSideDataBasicOps::scale( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.scale(dst->getArrayData(d), @@ -97,12 +72,12 @@ PatchSideDataBasicOps::addScalar( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.addScalar(dst->getArrayData(d), @@ -123,12 +98,12 @@ PatchSideDataBasicOps::add( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.add(dst->getArrayData(d), @@ -149,12 +124,12 @@ PatchSideDataBasicOps::subtract( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.subtract(dst->getArrayData(d), @@ -175,12 +150,12 @@ PatchSideDataBasicOps::multiply( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.multiply(dst->getArrayData(d), @@ -201,12 +176,12 @@ PatchSideDataBasicOps::divide( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.divide(dst->getArrayData(d), @@ -225,12 +200,12 @@ PatchSideDataBasicOps::reciprocal( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.reciprocal(dst->getArrayData(d), @@ -253,12 +228,12 @@ PatchSideDataBasicOps::linearSum( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.linearSum(dst->getArrayData(d), @@ -281,12 +256,12 @@ PatchSideDataBasicOps::axpy( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.axpy(dst->getArrayData(d), @@ -309,12 +284,12 @@ PatchSideDataBasicOps::axmy( TBOX_ASSERT(dst && src1 && src2); TBOX_ASSERT(dst->getDirectionVector() == src1->getDirectionVector()); TBOX_ASSERT(dst->getDirectionVector() == src2->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst, *src1, *src2, box); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst, *src1, *src2, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.axmy(dst->getArrayData(d), @@ -334,12 +309,12 @@ PatchSideDataBasicOps::setRandomValues( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); int dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.setRandomValues(dst->getArrayData(d), @@ -355,13 +330,13 @@ PatchSideDataBasicOps::min( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = data->getDim().getValue(); TYPE minval = tbox::MathUtilities::getMax(); const hier::IntVector& directions = data->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); minval = tbox::MathUtilities::Min( @@ -378,13 +353,13 @@ PatchSideDataBasicOps::max( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = data->getDim().getValue(); TYPE maxval = -tbox::MathUtilities::getMax(); const hier::IntVector& directions = data->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); maxval = tbox::MathUtilities::Max( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.h index d362a167..227c12bc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataBasicOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Basic templated side-centered patch data operations. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -27,11 +27,10 @@ namespace math { * Class PatchSideDataBasicOps provides access to a collection * of basic numerical operations that may be applied to numerical side- * centered patch data. These operations include simple arithmetic - * operations as well as min and max, etc. The primary intent of this - * class is to provide the interface to these standard operations for - * an PatchSideDataOps object which provides access to a complete set - * of operations that may be used to manipulate side-centered patch data - * objects. Each member function accepts a box argument indicating the + * operations as well as min and max, etc. This class provides a single + * implementation of these operations that may be used to manipulate any + * side-centered patch data objects. Each member function accepts a box + * argument indicating the * region of index space on which the operation should be performed. The * operation will be performed on the intersection of this box and those * boxes corresponding to the patch data objects involved. @@ -43,7 +42,7 @@ namespace math { * types as the template parameter. None of the operations are implemented * for any other type. * - * @see math::ArrayDataBasicOps + * @see ArrayDataBasicOps */ template @@ -59,6 +58,10 @@ class PatchSideDataBasicOps /** * Set dst = alpha * src, elementwise. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void scale( @@ -69,6 +72,10 @@ class PatchSideDataBasicOps /** * Set dst = src + alpha, elementwise. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void addScalar( @@ -79,6 +86,12 @@ class PatchSideDataBasicOps /** * Set dst = src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void add( @@ -89,6 +102,12 @@ class PatchSideDataBasicOps /** * Set dst = src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void subtract( @@ -99,6 +118,12 @@ class PatchSideDataBasicOps /** * Set dst = src1 * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void multiply( @@ -109,6 +134,12 @@ class PatchSideDataBasicOps /** * Set dst = src1 / src2, elementwise. No check for division by zero. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void divide( @@ -119,6 +150,10 @@ class PatchSideDataBasicOps /** * Set dst = 1 / src, elementwise. No check for division by zero. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void reciprocal( @@ -128,6 +163,12 @@ class PatchSideDataBasicOps /** * Set dst = alpha * src1 + beta * src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void linearSum( @@ -140,6 +181,12 @@ class PatchSideDataBasicOps /** * Set dst = alpha * src1 + src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axpy( @@ -151,6 +198,12 @@ class PatchSideDataBasicOps /** * Set dst = alpha * src1 - src2, elementwise. + * + * @pre dst && src1 && src2 + * @pre (dst->getDirectionVector() == src1->getDirectionVector()) && + * (dst->getDirectionVector() == src2->getDirectionVector()) + * @pre (dst->getDim() == src1->getDim()) && + * (dst->getDim() == src2->getDim()) && (dst->getDim() == box.getDim()) */ void axmy( @@ -163,6 +216,9 @@ class PatchSideDataBasicOps /** * Return the minimum patch data component entry When the data is * complex, the result is the data element with the smallest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE min( @@ -172,6 +228,9 @@ class PatchSideDataBasicOps /** * Return the maximum patch data component entry When the data is * complex, the result is the data element with the largest norm. + * + * @pre data + * @pre data->getDim() == box.getDim() */ TYPE max( @@ -182,6 +241,9 @@ class PatchSideDataBasicOps * Set patch data to random values. See the operations in the * ArrayDataBasicOps class for details on the generation * of the random values for each data type. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setRandomValues( @@ -193,10 +255,10 @@ class PatchSideDataBasicOps private: // The following are not implemented: PatchSideDataBasicOps( - const PatchSideDataBasicOps&); - void + const PatchSideDataBasicOps&); + PatchSideDataBasicOps& operator = ( - const PatchSideDataBasicOps&); + const PatchSideDataBasicOps&); ArrayDataBasicOps d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C index baa85bce..521040b3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real side-centered data. * ************************************************************************/ @@ -29,31 +29,6 @@ PatchSideDataMiscellaneousOpsReal::~PatchSideDataMiscellaneousOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchSideDataMiscellaneousOpsReal::PatchSideDataMiscellaneousOpsReal( - const PatchSideDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchSideDataMiscellaneousOpsReal::operator = ( - const PatchSideDataMiscellaneousOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -74,11 +49,11 @@ PatchSideDataMiscellaneousOpsReal::computeConstrProdPos( TBOX_ASSERT(data1->getDirectionVector() == data2->getDirectionVector()); int retval = 1; - int dimVal = data1->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1->getDim().getValue(); const hier::IntVector& directions = data1->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -93,7 +68,7 @@ PatchSideDataMiscellaneousOpsReal::computeConstrProdPos( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -121,11 +96,11 @@ PatchSideDataMiscellaneousOpsReal::compareToScalar( TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.compareToScalar(dst->getArrayData(d), @@ -138,7 +113,7 @@ PatchSideDataMiscellaneousOpsReal::compareToScalar( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.compareToScalarWithControlVolume(dst->getArrayData(d), @@ -162,12 +137,12 @@ PatchSideDataMiscellaneousOpsReal::testReciprocal( TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); int retval = 1; if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -182,7 +157,7 @@ PatchSideDataMiscellaneousOpsReal::testReciprocal( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -207,10 +182,10 @@ PatchSideDataMiscellaneousOpsReal::maxPointwiseDivide( { TBOX_ASSERT(numer && denom); - int dimVal = numer->getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); TYPE dirval = d_array_ops.maxPointwiseDivide(numer->getArrayData(d), @@ -230,10 +205,10 @@ PatchSideDataMiscellaneousOpsReal::minPointwiseDivide( { TBOX_ASSERT(numer && denom); - int dimVal = numer->getDim().getValue(); + tbox::Dimension::dir_t dimVal = numer->getDim().getValue(); TYPE retval = 0.0; - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); TYPE dirval = d_array_ops.minPointwiseDivide(numer->getArrayData(d), denom->getArrayData(d), diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h index 39789d8d..535ad2af 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated miscellaneous operations for real side-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataMiscellaneousOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * to include other operations, the member functions must be specialized or the * new operations must be added. * - * @see math::ArrayDataMiscellaneousOpsReal + * @see ArrayDataMiscellaneousOpsReal */ template @@ -69,6 +69,10 @@ class PatchSideDataMiscellaneousOpsReal * Return 1 if \f$\|data2_i\| > 0\f$ and \f$data1_i * data2_i \leq 0\f$, for * any \f$i\f$ in the index region, where \f$cvol_i > 0\f$. Otherwise return 0. * If the control volume is NULL, all values in the index set are used. + * + * @pre data1 && data2 + * @pre data1->getDirectionVector() == data2->getDirectionVector() + * @pre !cvol || (data1->getDirectionVector() == hier::IntVector::min(data1->getDirectionVector(), cvol->getDirectionVector())) */ int computeConstrProdPos( @@ -82,6 +86,10 @@ class PatchSideDataMiscellaneousOpsReal * Wherever \f$cvol_i > 0\f$ in the index region, set \f$dst_i = 1\f$ * if \f$\|src_i\| > \alpha\f$, and \f$dst_i = 0\f$ otherwise. If the control * volume is NULL, all values in the index set are considered. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre !cvol || (dst->getDirectionVector() == hier::IntVector::min(dst->getDirectionVector(), cvol->getDirectionVector())) */ void compareToScalar( @@ -97,6 +105,10 @@ class PatchSideDataMiscellaneousOpsReal * \f$src_i \neq 0\f$, and \f$dst_i = 0\f$ otherwise. If \f$dst_i = 0\f$ anywhere, * 0 is the return value. Otherwise 1 is returned. If the control volume * all values in the index set are considered. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre !cvol || (dst->getDirectionVector() == hier::IntVector::min(dst->getDirectionVector(), cvol->getDirectionVector())) */ int testReciprocal( @@ -118,6 +130,8 @@ class PatchSideDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * PETSc-2.1.6 vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE maxPointwiseDivide( @@ -138,6 +152,8 @@ class PatchSideDataMiscellaneousOpsReal * * @b Note: This method is currently intended to support the * SUNDIALS vector wrapper only. Please do not use it! + * + * @pre numer && denom */ TYPE minPointwiseDivide( @@ -148,10 +164,10 @@ class PatchSideDataMiscellaneousOpsReal private: // The following are not implemented: PatchSideDataMiscellaneousOpsReal( - const PatchSideDataMiscellaneousOpsReal&); - void + const PatchSideDataMiscellaneousOpsReal&); + PatchSideDataMiscellaneousOpsReal& operator = ( - const PatchSideDataMiscellaneousOpsReal&); + const PatchSideDataMiscellaneousOpsReal&); ArrayDataMiscellaneousOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.C index e99f5098..7d54e1f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.C @@ -3,18 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex side-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchSideDataNormOpsComplex_C -#define included_math_PatchSideDataNormOpsComplex_C - #include "SAMRAI/math/PatchSideDataNormOpsComplex.h" #include "SAMRAI/pdat/SideGeometry.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + namespace SAMRAI { namespace math { @@ -36,21 +34,21 @@ PatchSideDataNormOpsComplex::~PatchSideDataNormOpsComplex() int PatchSideDataNormOpsComplex::numberOfEntries( - const boost::shared_ptr >& data, - const hier::Box& box) const + const boost::shared_ptr >& data, + const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); int retval = 0; const hier::Box ibox = box * data->getGhostBox(); const hier::IntVector& directions = data->getDirectionVector(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { retval += - ((pdat::SideGeometry::toSideBox(ibox, d).size()) * data_depth); + static_cast((pdat::SideGeometry::toSideBox(ibox, d).size()) * data_depth); } } return retval; @@ -79,7 +77,7 @@ PatchSideDataNormOpsComplex::sumControlVolumes( hier::IntVector::min(directions, cvol->getDirectionVector())); int dimVal = box.getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { retval += d_array_ops.sumControlVolumes(data->getArrayData(d), cvol->getArrayData(d), @@ -97,11 +95,11 @@ PatchSideDataNormOpsComplex::abs( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), @@ -117,14 +115,14 @@ PatchSideDataNormOpsComplex::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), side_box); @@ -133,9 +131,9 @@ PatchSideDataNormOpsComplex::L1Norm( } else { TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), @@ -154,14 +152,14 @@ PatchSideDataNormOpsComplex::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), side_box); @@ -171,9 +169,9 @@ PatchSideDataNormOpsComplex::L2Norm( } else { TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( @@ -195,7 +193,7 @@ PatchSideDataNormOpsComplex::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); int dimVal = box.getDim().getValue(); @@ -206,7 +204,7 @@ PatchSideDataNormOpsComplex::weightedL2Norm( hier::IntVector::min(directions, weight->getDirectionVector())); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), @@ -218,9 +216,9 @@ PatchSideDataNormOpsComplex::weightedL2Norm( } else { TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( @@ -283,7 +281,7 @@ PatchSideDataNormOpsComplex::maxNorm( double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -295,7 +293,7 @@ PatchSideDataNormOpsComplex::maxNorm( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -324,7 +322,7 @@ PatchSideDataNormOpsComplex::dot( dcomplex retval = dcomplex(0.0, 0.0); const hier::IntVector& directions = data1->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), @@ -336,7 +334,7 @@ PatchSideDataNormOpsComplex::dot( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.dotWithControlVolume( @@ -365,12 +363,12 @@ PatchSideDataNormOpsComplex::integral( TBOX_ASSERT(directions == hier::IntVector::min(directions, vol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { retval += d_array_ops.integral( - data->getArrayData(d), - vol->getArrayData(d), - pdat::SideGeometry::toSideBox(box, d)); + data->getArrayData(d), + vol->getArrayData(d), + pdat::SideGeometry::toSideBox(box, d)); } } return retval; @@ -378,4 +376,3 @@ PatchSideDataNormOpsComplex::integral( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.h index 1cd7a03d..6b36f29f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Norm operations for complex side-centered data. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -48,7 +48,7 @@ namespace math { * Note that a similar set of norm operations is implemented for real * patch data (double and float) in the class PatchSideDataNormOpsReal. * - * @see math::ArrayDataNormOpsComplex + * @see ArrayDataNormOpsComplex */ class PatchSideDataNormOpsComplex @@ -65,6 +65,9 @@ class PatchSideDataNormOpsComplex * Return the number of data values for the side-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ int numberOfEntries( @@ -73,6 +76,9 @@ class PatchSideDataNormOpsComplex /** * Return sum of control volume entries for the side-centered data object. + * + * @pre data && cvol + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector()) */ double sumControlVolumes( @@ -84,6 +90,10 @@ class PatchSideDataNormOpsComplex * Set destination component to norm of source component. That is, * each destination entry is set to * \f$d_i = \sqrt{ {real(s_i)}^2 + {imag(s_i)}^2 }\f$. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -97,6 +107,11 @@ class PatchSideDataNormOpsComplex * return value is the sum \f$\sum_i ( \sqrt{data_i * \bar{data_i}}*cvol_i )\f$. * If the control volume is NULL, the return value is * \f$\sum_i ( \sqrt{data_i * \bar{data_i}} )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L1Norm( @@ -112,6 +127,11 @@ class PatchSideDataNormOpsComplex * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( data_i * \bar{data_i} ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double L2Norm( @@ -127,6 +147,13 @@ class PatchSideDataNormOpsComplex * (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. If the control * volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i * wgt_i) * \bar{(data_i * wgt_i)} cvol_i ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), weight->getDirectionVector()) + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedL2Norm( @@ -142,6 +169,8 @@ class PatchSideDataNormOpsComplex * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data */ double RMSNorm( @@ -154,8 +183,10 @@ class PatchSideDataNormOpsComplex * Return discrete weighted root mean squared norm of the data. If the * control volume is not NULL, the return value is the weighted \f$L_2\f$-norm * divided by the square root of the sum of the control volumes. Otherwise, - * the return value is the weighted \f$L_2\f$-norm divided by the square root - * of the number of data entries. + * the return value is the weighted \f$L_2\f$-norm divided by the square + * root of the number of data entries. + * + * @pre data && weight */ double weightedRMSNorm( @@ -171,6 +202,9 @@ class PatchSideDataNormOpsComplex * value is \f$\max_i ( \sqrt{data_i * \bar{data_i}} )\f$, where the max is * over the data elements where \f$cvol_i > 0\f$. If the control volume is * NULL, it is ignored during the computation of the maximum. + * + * @pre data + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) */ double maxNorm( @@ -184,6 +218,10 @@ class PatchSideDataNormOpsComplex * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * \bar{data2_i} * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 + * @pre data1->getDirectionVector() == data2->getDirectionVector() + * @pre !cvol || (data1->getDirectionVector() == hier::IntVector::min(data1->getDirectionVector(), cvol->getDirectionVector())) */ dcomplex dot( @@ -196,6 +234,9 @@ class PatchSideDataNormOpsComplex /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), vol->getDirectionVector()) */ dcomplex integral( @@ -207,7 +248,7 @@ class PatchSideDataNormOpsComplex // The following are not implemented: PatchSideDataNormOpsComplex( const PatchSideDataNormOpsComplex&); - void + PatchSideDataNormOpsComplex& operator = ( const PatchSideDataNormOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.C index 7ffdd4f1..ae06d983 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real side-centered patch data. * ************************************************************************/ @@ -16,6 +16,8 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/pdat/SideGeometry.h" +#include + namespace SAMRAI { namespace math { @@ -29,31 +31,6 @@ PatchSideDataNormOpsReal::~PatchSideDataNormOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchSideDataNormOpsReal::PatchSideDataNormOpsReal( - const PatchSideDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchSideDataNormOpsReal::operator = ( - const PatchSideDataNormOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -63,20 +40,20 @@ PatchSideDataNormOpsReal::operator = ( */ template -int +size_t PatchSideDataNormOpsReal::numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); - int retval = 0; + size_t retval = 0; const hier::Box ibox = box * data->getGhostBox(); const hier::IntVector& directions = data->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box dbox = pdat::SideGeometry::toSideBox(ibox, d); retval += (dbox.size() * data->getDepth()); @@ -108,9 +85,9 @@ PatchSideDataNormOpsReal::sumControlVolumes( TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.sumControlVolumes(data->getArrayData(d), @@ -130,12 +107,12 @@ PatchSideDataNormOpsReal::abs( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = dst->getDim().getValue(); + tbox::Dimension::dir_t dimVal = dst->getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); d_array_ops.abs(dst->getArrayData(d), @@ -153,25 +130,25 @@ PatchSideDataNormOpsReal::L1Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.L1Norm(data->getArrayData(d), side_box); } } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.L1NormWithControlVolume(data->getArrayData(d), @@ -191,14 +168,14 @@ PatchSideDataNormOpsReal::L2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.L2Norm(data->getArrayData(d), side_box); @@ -206,11 +183,11 @@ PatchSideDataNormOpsReal::L2Norm( } } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.L2NormWithControlVolume( @@ -233,9 +210,9 @@ PatchSideDataNormOpsReal::weightedL2Norm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, *weight, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, *weight, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); @@ -244,7 +221,7 @@ PatchSideDataNormOpsReal::weightedL2Norm( hier::IntVector::min(directions, weight->getDirectionVector())); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.weightedL2Norm(data->getArrayData(d), @@ -254,11 +231,11 @@ PatchSideDataNormOpsReal::weightedL2Norm( } } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); double aval = d_array_ops.weightedL2NormWithControlVolume( @@ -288,7 +265,7 @@ PatchSideDataNormOpsReal::RMSNorm( if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval /= sqrt(sumControlVolumes(data, cvol, box)); } return retval; @@ -303,13 +280,13 @@ PatchSideDataNormOpsReal::weightedRMSNorm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data && weight); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); double retval = weightedL2Norm(data, weight, box, cvol); if (!cvol) { retval /= sqrt((double)numberOfEntries(data, box)); } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); retval /= sqrt(sumControlVolumes(data, cvol, box)); } return retval; @@ -323,14 +300,14 @@ PatchSideDataNormOpsReal::maxNorm( const boost::shared_ptr >& cvol) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); double retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -339,11 +316,11 @@ PatchSideDataNormOpsReal::maxNorm( } } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, *cvol); TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); @@ -369,12 +346,12 @@ PatchSideDataNormOpsReal::dot( TBOX_ASSERT(data1 && data2); TBOX_ASSERT(data1->getDirectionVector() == data2->getDirectionVector()); - int dimVal = data1->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data1->getDim().getValue(); TYPE retval = 0.0; const hier::IntVector& directions = data1->getDirectionVector(); if (!cvol) { - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.dot(data1->getArrayData(d), @@ -383,11 +360,11 @@ PatchSideDataNormOpsReal::dot( } } } else { - TBOX_DIM_ASSERT_CHECK_ARGS2(*data1, *cvol); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data1, *cvol); TBOX_ASSERT(directions == hier::IntVector::min(directions, cvol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.dotWithControlVolume( @@ -410,9 +387,9 @@ PatchSideDataNormOpsReal::integral( { TBOX_ASSERT(data); TBOX_ASSERT(vol); - TBOX_DIM_ASSERT_CHECK_ARGS3(*data, box, *vol); + TBOX_ASSERT_OBJDIM_EQUALITY3(*data, box, *vol); - int dimVal = data->getDim().getValue(); + tbox::Dimension::dir_t dimVal = data->getDim().getValue(); TYPE retval = 0.0; const hier::IntVector& directions = data->getDirectionVector(); @@ -420,7 +397,7 @@ PatchSideDataNormOpsReal::integral( TBOX_ASSERT(directions == hier::IntVector::min(directions, vol->getDirectionVector())); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); retval += d_array_ops.integral( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.h index 64be337d..69c6f92b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataNormOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated norm operations for real side-centered data. * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/math/ArrayDataNormOpsReal.h" #include "SAMRAI/hier/Box.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace math { @@ -51,7 +51,7 @@ namespace math { * implemented for complex patch data in the class * PatchSideDataNormOpsComplex. * - * @see math::ArrayDataNormOpsReal + * @see ArrayDataNormOpsReal */ template @@ -69,14 +69,20 @@ class PatchSideDataNormOpsReal * Return the number of data values for the side-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ - int + size_t numberOfEntries( const boost::shared_ptr >& data, const hier::Box& box) const; /** * Return sum of control volume entries for the side-centered data object. + * + * @pre data && cvol + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector()) */ double sumControlVolumes( @@ -87,6 +93,10 @@ class PatchSideDataNormOpsReal /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -99,6 +109,11 @@ class PatchSideDataNormOpsReal * weight the contribution of each data entry to the sum. That is, the * return value is the sum \f$\sum_i ( \| data_i \| cvol_i )\f$. If the * control volume is NULL, the return value is \f$\sum_i ( \| data_i \| )\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) */ double L1Norm( @@ -113,6 +128,11 @@ class PatchSideDataNormOpsReal * return value is the sum \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. * If the control volume is NULL, the return value is * \f$\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }\f$. + * + * @pre data + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) */ double L2Norm( @@ -127,6 +147,13 @@ class PatchSideDataNormOpsReal * the sum. That is, the return value is the sum \f$\sqrt{ \sum_i ( * (data_i * weight_i)^2 cvol_i ) }\f$. If the control volume is NULL, * the return value is \f$\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }\f$. + * + * @pre data && weight + * @pre (data->getDim() == weight->getDim()) && + * (data->getDim() == box.getDim()) + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), weight->getDirectionVector()) + * @pre !cvol || (data->getDim() == cvol->getDim()) + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) */ double weightedL2Norm( @@ -142,6 +169,9 @@ class PatchSideDataNormOpsReal * the square root of the sum of the control volumes. Otherwise, the * return value is the \f$L_2\f$-norm divided by the square root of the * number of data entries. + * + * @pre data + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double RMSNorm( @@ -156,6 +186,10 @@ class PatchSideDataNormOpsReal * divided by the square root of the sum of the control volumes. Otherwise, * the return value is the weighted \f$L_2\f$-norm divided by the square root * of the number of data entries. + * + * @pre data && weight + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) */ double weightedRMSNorm( @@ -171,6 +205,11 @@ class PatchSideDataNormOpsReal * value is \f$\max_i ( \| data_i \| )\f$, where the max is over the data * elements where \f$cvol_i > 0\f$. If the control volume is NULL, it is * ignored during the computation of the maximum. + * + * @pre data && weight + * @pre data->getDim() == box.getDim() + * @pre !cvol || (data->getDim() == cvol->getDim()) + * @pre !cvol || (data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), cvol->getDirectionVector())) */ double maxNorm( @@ -184,6 +223,11 @@ class PatchSideDataNormOpsReal * to weight the contribution of each product to the sum. That is, the * return value is the sum \f$\sum_i ( data1_i * data2_i * cvol_i )\f$. * If the control volume is NULL, it is ignored during the summation. + * + * @pre data1 && data2 + * @pre data1->getDirectionVector() == data2->getDirectionVector() + * @pre !cvol || (data1->getDim() == cvol->getDim()) + * @pre !cvol || (data1->getDirectionVector() == hier::IntVector::min(data1->getDirectionVector(), cvol->getDirectionVector())) */ TYPE dot( @@ -196,6 +240,11 @@ class PatchSideDataNormOpsReal /** * Return the integral of the function represented by the data array. * The return value is the sum \f$\sum_i ( data_i * vol_i )\f$. + * + * @pre data && vol + * @pre (data->getDim() == vol->getDim()) && + * (data->getDim() == box.getDim()) + * @pre data->getDirectionVector() == hier::IntVector::min(data->getDirectionVector(), vol->getDirectionVector()) */ TYPE integral( @@ -206,10 +255,10 @@ class PatchSideDataNormOpsReal private: // The following are not implemented: PatchSideDataNormOpsReal( - const PatchSideDataNormOpsReal&); - void + const PatchSideDataNormOpsReal&); + PatchSideDataNormOpsReal& operator = ( - const PatchSideDataNormOpsReal&); + const PatchSideDataNormOpsReal&); ArrayDataNormOpsReal d_array_ops; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.C index f1dfe6d4..e3a870af 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex side-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchSideDataOpsComplex_C -#define included_math_PatchSideDataOpsComplex_C - #include "SAMRAI/math/PatchSideDataOpsComplex.h" #include "SAMRAI/pdat/SideGeometry.h" @@ -42,11 +38,11 @@ PatchSideDataOpsComplex::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -65,7 +61,7 @@ PatchSideDataOpsComplex::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -80,11 +76,11 @@ PatchSideDataOpsComplex::copyData( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::SideGeometry::toSideBox(box, d)); @@ -94,4 +90,3 @@ PatchSideDataOpsComplex::copyData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.h index 7f800e3f..ac8a64c8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsComplex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for complex side-centered patch data. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,8 @@ namespace math { * integer patch data in the classes PatchSideDataOpsReal and * PatchSideDataOpsInteger, repsectively. * - * @see math::PatchSideDataBasicOps - * @see math::PatchSideDataNormOpsComplex + * @see PatchSideDataBasicOps + * @see PatchSideDataNormOpsComplex */ class PatchSideDataOpsComplex: @@ -60,6 +60,10 @@ class PatchSideDataOpsComplex: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -70,6 +74,14 @@ class PatchSideDataOpsComplex: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getDirectionVector() == patch->getPatchData(data2_id)->getDirectionVector() + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -79,6 +91,9 @@ class PatchSideDataOpsComplex: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -88,6 +103,9 @@ class PatchSideDataOpsComplex: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -96,7 +114,7 @@ class PatchSideDataOpsComplex: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } @@ -104,7 +122,7 @@ class PatchSideDataOpsComplex: // The following are not implemented: PatchSideDataOpsComplex( const PatchSideDataOpsComplex&); - void + PatchSideDataOpsComplex& operator = ( const PatchSideDataOpsComplex&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.C index 00df10a2..ff764795 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer side-centered patch data. * ************************************************************************/ - -#ifndef included_math_PatchSideDataOpsInteger_C -#define included_math_PatchSideDataOpsInteger_C - #include "SAMRAI/math/PatchSideDataOpsInteger.h" #include "SAMRAI/pdat/SideGeometry.h" @@ -39,17 +35,17 @@ PatchSideDataOpsInteger::numberOfEntries( const hier::Box& box) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); int dimVal = box.getDim().getValue(); int retval = 0; const hier::Box ibox = box * data->getGhostBox(); const hier::IntVector& directions = data->getDirectionVector(); const int data_depth = data->getDepth(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { retval += - ((pdat::SideGeometry::toSideBox(ibox, d).size()) * data_depth); + static_cast((pdat::SideGeometry::toSideBox(ibox, d).size()) * data_depth); } } return retval; @@ -71,11 +67,11 @@ void PatchSideDataOpsInteger::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -94,7 +90,7 @@ PatchSideDataOpsInteger::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -109,11 +105,11 @@ PatchSideDataOpsInteger::copyData( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { dst->getArrayData(d).copy(src->getArrayData(d), pdat::SideGeometry::toSideBox(box, d)); @@ -128,11 +124,11 @@ PatchSideDataOpsInteger::abs( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); int dimVal = box.getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { d_array_ops.abs(dst->getArrayData(d), src->getArrayData(d), @@ -143,4 +139,3 @@ PatchSideDataOpsInteger::abs( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.h index 4345d05c..0745cce5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsInteger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operations for integer side-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,7 +39,7 @@ namespace math { * float) and complex patch data in the classes PatchSideDataOpsReal * and PatchSideDataOpsComplex, repsectively. * - * @see math::PatchSideDataBasicOps + * @see PatchSideDataBasicOps */ class PatchSideDataOpsInteger: @@ -57,6 +57,9 @@ class PatchSideDataOpsInteger: * Return the number of data values for the side-centered data object * in the given box. Note that it is assumed that the box refers to * the cell-centered index space corresponding to the patch hierarchy. + * + * @pre data + * @pre data->getDim() == box.getDim() */ int numberOfEntries( @@ -65,6 +68,10 @@ class PatchSideDataOpsInteger: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -75,6 +82,14 @@ class PatchSideDataOpsInteger: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getDirectionVector() == patch->getPatchData(data2_id)->getDirectionVector() + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +99,9 @@ class PatchSideDataOpsInteger: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -93,6 +111,9 @@ class PatchSideDataOpsInteger: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -101,13 +122,17 @@ class PatchSideDataOpsInteger: const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } /** * Set destination component to absolute value of source component. * That is, each destination entry is set to \f$d_i = \| s_i \|\f$. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void abs( @@ -119,7 +144,7 @@ class PatchSideDataOpsInteger: // The following are not implemented: PatchSideDataOpsInteger( const PatchSideDataOpsInteger&); - void + PatchSideDataOpsInteger& operator = ( const PatchSideDataOpsInteger&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.C index ea59a9d8..2016f0ab 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real side-centered patch data. * ************************************************************************/ @@ -28,31 +28,6 @@ PatchSideDataOpsReal::~PatchSideDataOpsReal() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -PatchSideDataOpsReal::PatchSideDataOpsReal( - const PatchSideDataOpsReal& foo) -{ - NULL_USE(foo); -} - -template -void -PatchSideDataOpsReal::operator = ( - const PatchSideDataOpsReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -71,11 +46,11 @@ PatchSideDataOpsReal::swapData( TBOX_ASSERT(patch); boost::shared_ptr > d1( - patch->getPatchData(data1_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data1_id))); boost::shared_ptr > d2( - patch->getPatchData(data2_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data2_id))); TBOX_ASSERT(d1 && d2); TBOX_ASSERT(d1->getDepth() && d2->getDepth()); @@ -95,7 +70,7 @@ PatchSideDataOpsReal::printData( std::ostream& s) const { TBOX_ASSERT(data); - TBOX_DIM_ASSERT_CHECK_ARGS2(*data, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*data, box); s << "Data box = " << box << std::endl; data->print(box, s); @@ -111,12 +86,12 @@ PatchSideDataOpsReal::copyData( { TBOX_ASSERT(dst && src); TBOX_ASSERT(dst->getDirectionVector() == src->getDirectionVector()); - TBOX_DIM_ASSERT_CHECK_ARGS3(*dst, *src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*dst, *src, box); - int dimVal = box.getDim().getValue(); + tbox::Dimension::dir_t dimVal = box.getDim().getValue(); const hier::IntVector& directions = dst->getDirectionVector(); - for (int d = 0; d < dimVal; d++) { + for (tbox::Dimension::dir_t d = 0; d < dimVal; ++d) { if (directions(d)) { const hier::Box side_box = pdat::SideGeometry::toSideBox(box, d); (dst->getArrayData(d)).copy(src->getArrayData(d), side_box); @@ -132,7 +107,7 @@ PatchSideDataOpsReal::setToScalar( const hier::Box& box) const { TBOX_ASSERT(dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst, box); dst->fillAll(alpha, box); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.h index 6dc0b5d8..5c37af92 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/PatchSideDataOpsReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated operations for real side-centered patch data. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -44,9 +44,9 @@ namespace math { * PatchSideDataOpsComplex and PatchSideDataOpsInteger, * repsectively. * - * @see math::PatchSideDataBasicOps - * @see math::PatchSideDataMiscellaneousOpsReal - * @see math::PatchSideDataNormOpsReal + * @see PatchSideDataBasicOps + * @see PatchSideDataMiscellaneousOpsReal + * @see PatchSideDataNormOpsReal */ template @@ -65,6 +65,10 @@ class PatchSideDataOpsReal: /** * Copy dst data to src data over given box. + * + * @pre dst && src + * @pre dst->getDirectionVector() == src->getDirectionVector() + * @pre (dst->getDim() == src->getDim()) && (dst->getDim() == box.getDim()) */ void copyData( @@ -75,6 +79,14 @@ class PatchSideDataOpsReal: /** * Swap pointers for patch data objects. Objects are checked for * consistency of depth, box, and ghost box. + * + * @pre patch + * @pre patch->getPatchData(data1_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data2_id) is actually a boost::shared_ptr > + * @pre patch->getPatchData(data1_id)->getDepth() == patch->getPatchData(data2_id)->getDepth() + * @pre patch->getPatchData(data1_id)->getBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getBox()) + * @pre patch->getPatchData(data1_id)->getDirectionVector() == patch->getPatchData(data2_id)->getDirectionVector() + * @pre patch->getPatchData(data1_id)->getGhostBox().isSpatiallyEqual(patch->getPatchData(data2_id)->getGhostBox()) */ void swapData( @@ -84,6 +96,9 @@ class PatchSideDataOpsReal: /** * Print data entries over given box to given output stream. + * + * @pre data + * @pre data->getDim() == box.getDim() */ void printData( @@ -93,6 +108,9 @@ class PatchSideDataOpsReal: /** * Initialize data to given scalar over given box. + * + * @pre dst + * @pre dst->getDim() == box.getDim() */ void setToScalar( @@ -103,10 +121,10 @@ class PatchSideDataOpsReal: private: // The following are not implemented: PatchSideDataOpsReal( - const PatchSideDataOpsReal&); - void + const PatchSideDataOpsReal&); + PatchSideDataOpsReal& operator = ( - const PatchSideDataOpsReal&); + const PatchSideDataOpsReal&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual.dox index 8397bb10..e5540518 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_array.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_array.dox index 6479663d..7a9651f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_array.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_array.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_cell.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_cell.dox index 4f769507..eca113b8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_cell.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_cell.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_hierarchy.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_hierarchy.dox index 89b6cd90..3813abd2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_hierarchy.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/math/dox/manual_hierarchy.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.C new file mode 100644 index 00000000..9660a8f7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.C @@ -0,0 +1,1322 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utilitiy for breaking boxes during partitioning. + * + ************************************************************************/ + +#ifndef included_mesh_BalanceBoxBreaker_C +#define included_mesh_BalanceBoxBreaker_C + +#include "SAMRAI/mesh/BalanceBoxBreaker.h" + +#include "SAMRAI/hier/BoxUtilities.h" +#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/tbox/TimerManager.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +// Round a to the nearest higher integer divisible by b. This should work even for a < 0. +#define ROUND_TO_HI(a, b) ((a) - ((((a) % (b)) - (b)) % (b))) +// Round a to the nearest lower integer divisible by b. This should work even for a < 0. +#define ROUND_TO_LO(a, b) ((a) - ((((a) % (b)) + (b)) % (b))) + +BalanceBoxBreaker::BalanceBoxBreaker( + const PartitioningParams& pparams, + bool print_break_steps): + d_pparams(&pparams), + d_print_break_steps(print_break_steps) +{ + setTimers(); +} + +BalanceBoxBreaker::BalanceBoxBreaker( + const BalanceBoxBreaker& other): + d_pparams(other.d_pparams), + d_print_break_steps(other.d_print_break_steps), + t_break_off_load(other.t_break_off_load), + t_find_bad_cuts(other.t_find_bad_cuts) +{ +} + +/* + ************************************************************************* + * Master method for breaking off a load. + * + * Try different heuristics and pick the "best" way to break off a + * load. The best is defined as the one with the lowest combined + * penalty. + * + * This method always return a breakage if at all possible, without + * considering whether the break should be used. For example, + * requesting breakage of 1 cell in a 100x100 box might return a + * breakage of a 100-cells sliver! + * + * Return whether a successful break was made. + ************************************************************************* + */ +bool +BalanceBoxBreaker::breakOffLoad( + hier::BoxContainer& breakoff, + hier::BoxContainer& leftover, + double& brk_load, + const hier::Box& box, + double box_load, + const std::vector& corner_weights, + double ideal_load_to_break, + double low_load, + double high_load, + double threshold_width) const +{ + TBOX_ASSERT(ideal_load_to_break > 0); + + /* + * NOTE: We need in this method a way to weigh the + * value of proximity to the ideal breakoff vs the + * increased area of the cuts. However, the weight + * given to area-optimized cuts should be considered + * only with real application performance data. + * + * NOTE: We can compute the amount of new box boundaries + * generated by computing the box boundary before and + * after, and subtracting. Easier than reconstructing + * the cuts from the box definitions. + * + * NOTE: We should weight negatively the production of + * high surface-to-volume boxes. + */ + + t_break_off_load->start(); + + breakoff.clear(); + leftover.clear(); + + /* + * To avoid repeated computations of bad cuts, + * we precompute bad_cuts here to provide to + * methods that actually use the information. + */ + std::vector > bad_cuts(box.getDim().getValue()); + t_find_bad_cuts->start(); + hier::BoxUtilities::findBadCutPoints( + bad_cuts, + box, + d_pparams->getDomainBoxes(box.getBlockId()), + d_pparams->getBadInterval()); + t_find_bad_cuts->stop(); + + // Penalty for not transfering ideal load. + brk_load = 0; + double best_balance_penalty = computeBalancePenalty(ideal_load_to_break); + double best_width_score = computeWidthScore(box.numberCells(), threshold_width); + + if (d_print_break_steps) { + tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); + tbox::plog.precision(6); + tbox::plog << " breakOffLoad: pre-break imbalance: " << ideal_load_to_break + << " balance penalty: " << best_balance_penalty + << " width score: " << best_width_score + << " threshold_width: " << threshold_width + << std::endl; + } + + TrialBreak best_trial(*d_pparams, threshold_width, + box, box_load, corner_weights, bad_cuts, + ideal_load_to_break, low_load, high_load); + + /* + * Try planar break. + */ + + TrialBreak planar_trial(*d_pparams, threshold_width, + box, box_load, corner_weights, bad_cuts, + ideal_load_to_break, low_load, high_load); + + if (breakOffLoad_planar(planar_trial)) { + + if (d_print_break_steps) { + // Should move this if-block into breakOffLoad_planar. + tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); + tbox::plog.precision(6); + tbox::plog << " breakOffLoad_planar broke off " + << planar_trial.d_breakoff_load << " / " << ideal_load_to_break + << " from " << box << '|' + << box.numberCells() << '|' + << box.size() << " into " + << planar_trial.d_breakoff.size() + << " breakoff: "; + for (hier::BoxContainer::const_iterator bi = + planar_trial.d_breakoff.begin(); + bi != planar_trial.d_breakoff.end(); + ++bi) { + tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' + << bi->size(); + } + tbox::plog << "\n and " << planar_trial.d_leftover.size() + << " leftover boxes:"; + for (hier::BoxContainer::const_iterator bi = + planar_trial.d_leftover.begin(); + bi != planar_trial.d_leftover.end(); + ++bi) { + tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' + << bi->size(); + } + tbox::plog << "\n imbalance: " + << (planar_trial.d_breakoff_load - ideal_load_to_break) + << planar_trial + << std::endl; + } + + if (planar_trial.improvesOver(best_trial)) { + best_trial.swap(planar_trial); + if (d_print_break_steps) { + tbox::plog << " breakOffLoad: chose the above trial break" << std::endl; + } + } + + } else { + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_planar could not break " + << ideal_load_to_break << " from " << box + << '/' << box.numberCells() + << '/' << box.numberCells().getProduct() + << std::endl; + } + } + + /* + * Try cubic break. + */ + + TrialBreak cubic_trial(*d_pparams, threshold_width, + box, box_load, corner_weights, bad_cuts, + ideal_load_to_break, low_load, high_load); + + if (breakOffLoad_cubic(cubic_trial)) { + + if (d_print_break_steps) { + // Should move this if-block into breakOffLoad_cubic. + tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); + tbox::plog.precision(6); + tbox::plog << " breakOffLoad_cubic broke off " + << cubic_trial.d_breakoff_load << " / " << ideal_load_to_break + << " from " << box << '|' + << box.numberCells() << '|' + << box.size() << " into " + << cubic_trial.d_breakoff.size() + << " breakoff: "; + for (hier::BoxContainer::const_iterator bi = + cubic_trial.d_breakoff.begin(); + bi != cubic_trial.d_breakoff.end(); + ++bi) { + tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' + << bi->size(); + } + tbox::plog << "\n and " << cubic_trial.d_leftover.size() + << " leftover boxes:"; + for (hier::BoxContainer::const_iterator bi = + cubic_trial.d_leftover.begin(); + bi != cubic_trial.d_leftover.end(); + ++bi) { + tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' + << bi->size(); + } + tbox::plog << "\n imbalance: " + << (cubic_trial.d_breakoff_load - ideal_load_to_break) + << cubic_trial + << std::endl; + } + + if (cubic_trial.improvesOver(best_trial)) { + best_trial.swap(cubic_trial); + if (d_print_break_steps) { + tbox::plog << " breakOffLoad: chose the above trial break" << std::endl; + } + } else { + if (d_print_break_steps) { + tbox::plog << " breakOffLoad: cubic break did not improve:" + << "\n cubic_trial:" << cubic_trial + << "\n best_trial:" << best_trial + << std::endl; + } + } + + } else { + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_cubic could not break " + << ideal_load_to_break << " from " << box + << '/' << box.numberCells() + << '/' << box.numberCells().getProduct() + << std::endl; + } + } + + if (d_print_break_steps) { + if (!best_trial.d_breakoff.empty()) { + tbox::plog << " breakOffLoad: broke:" + << best_trial << std::flush; + } else { + tbox::plog << " breakOffLoad: no break!" + << std::endl; + } + } + + if (!best_trial.d_breakoff.empty()) { + breakoff.swap(best_trial.d_breakoff); + leftover.swap(best_trial.d_leftover); + brk_load = best_trial.d_breakoff_load; + } + + t_break_off_load->stop(); + return !breakoff.empty(); +} + +/* + ************************************************************************* + * Break off a load from a box by making a single planar cut across + * the box's longest direction. + * + * Currently assuming uniform load of one unit per cell. + * + * Return whether a successful break was made. + ************************************************************************* + */ +bool +BalanceBoxBreaker::breakOffLoad_planar(TrialBreak& trial) const +{ + const tbox::Dimension dim(trial.d_whole_box.getDim()); + + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_planar attempting to break " + << trial.d_ideal_load << " from Box " + << trial.d_whole_box << trial.d_whole_box.numberCells() << '|' + << trial.d_whole_box.size() + << " min_size=" << d_pparams->getMinBoxSize() << std::endl; + } + + trial.d_breakoff.clear(); + trial.d_leftover.clear(); + + const hier::IntVector box_dims = trial.d_whole_box.numberCells(); + + const size_t box_vol = box_dims.getProduct(); + + if (trial.d_whole_box_load <= trial.d_ideal_load) { + // Easy: break off everything. + trial.computeBreakData(trial.d_whole_box); + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_planar broke off entire Box " + << trial.d_whole_box + << std::endl; + } + return true; + } + + /* + * Determine ordering of box_dims from shortest to longest. + */ + hier::IntVector sorted_dirs(dim); + sorted_dirs.sortIntVector(box_dims); + + bool sufficient_brk_load = false; + const hier::BlockId& block_id = trial.d_whole_box.getBlockId(); + hier::IntVector cut_factor( + d_pparams->getCutFactor().getBlockVector(block_id)); + + TrialBreak trial1(trial); + + for (tbox::Dimension::dir_t d1 = 1; d1 <= dim.getValue() && !sufficient_brk_load; ++d1) { + const tbox::Dimension::dir_t d = static_cast(dim.getValue() - d1); + + /* + * Search directions from longest to shortest because we prefer + * to break across longer directions. + */ + const tbox::Dimension::dir_t brk_dir = static_cast(sorted_dirs(d)); + + const size_t brk_area = box_vol / box_dims(brk_dir); + + const std::vector& bad = trial.d_bad_cuts[brk_dir]; + + const double ideal_fraction = static_cast(trial.d_ideal_load) / + static_cast(trial.d_whole_box_load); + const double ideal_cut_length = ideal_fraction * + static_cast(box_dims(brk_dir)); + + /* + * Try 4 different cuts for direction brk_dir: + * upper/lower: should we break off the upper end or lower end of the box. + * hi/lo: should we round the break plane to the high or low side. + * + * plane refers to the index of the mesh line where the cut is. + * + * offset refers to a cut plane index relative to the box's lower corner. + */ + + // Ideal cut planes, not necessarily coincident with a grid line. + const double ideal_upper_cut_offset = trial.d_whole_box.numberCells(brk_dir) + - ideal_cut_length; + const double ideal_lower_cut_offset = ideal_cut_length; + + // Compute valid cut planes on high and low sides of upper cut plane. + int lo_upper_cut_plane = trial.d_whole_box.lower() (brk_dir) + int(ideal_upper_cut_offset); + int hi_upper_cut_plane = trial.d_whole_box.lower() (brk_dir) + int(ideal_upper_cut_offset) + + 1; + lo_upper_cut_plane = ROUND_TO_LO(lo_upper_cut_plane, cut_factor(brk_dir)); + hi_upper_cut_plane = ROUND_TO_HI(hi_upper_cut_plane, cut_factor(brk_dir)); + while (lo_upper_cut_plane > trial.d_whole_box.lower() (brk_dir) && + bad[lo_upper_cut_plane - trial.d_whole_box.lower() (brk_dir)]) { + lo_upper_cut_plane -= cut_factor(brk_dir); + } + while (hi_upper_cut_plane < trial.d_whole_box.upper() (brk_dir) + 1 && + bad[hi_upper_cut_plane - trial.d_whole_box.lower() (brk_dir)]) { + hi_upper_cut_plane += cut_factor(brk_dir); + } + + // Compute valid cut planes on high and low sides of lower cut plane. + int lo_lower_cut_plane = trial.d_whole_box.lower() (brk_dir) + int(ideal_lower_cut_offset); + int hi_lower_cut_plane = trial.d_whole_box.lower() (brk_dir) + int(ideal_lower_cut_offset) + + 1; + lo_lower_cut_plane = ROUND_TO_LO(lo_lower_cut_plane, cut_factor(brk_dir)); + hi_lower_cut_plane = ROUND_TO_HI(hi_lower_cut_plane, cut_factor(brk_dir)); + while (lo_lower_cut_plane > trial.d_whole_box.lower() (brk_dir) && + bad[lo_lower_cut_plane - trial.d_whole_box.lower() (brk_dir)]) { + lo_lower_cut_plane -= cut_factor(brk_dir); + } + while (hi_lower_cut_plane < trial.d_whole_box.upper() (brk_dir) + 1 && + bad[hi_lower_cut_plane - trial.d_whole_box.lower() (brk_dir)]) { + hi_lower_cut_plane += cut_factor(brk_dir); + } + + if (d_print_break_steps) { + tbox::plog << "breakOffLoad_planar considering cuts along " << d << ": " + << " ideal_cut_length=" << ideal_cut_length + << " ideal_upper_cut_offset=" << ideal_upper_cut_offset + << " lo_lower_cut_plane=" << lo_lower_cut_plane + << " hi_lower_cut_plane=" << hi_lower_cut_plane + << " lo_upper_cut_plane=" << lo_upper_cut_plane + << " hi_upper_cut_plane=" << hi_upper_cut_plane + << std::endl; + } + + if (lo_lower_cut_plane - trial.d_whole_box.lower() (brk_dir) > + d_pparams->getMinBoxSize() (brk_dir) && + trial.d_whole_box.upper() (brk_dir) + 1 - lo_lower_cut_plane > + d_pparams->getMinBoxSize() (brk_dir)) { + + hier::Box brk_box(trial.d_whole_box); + brk_box.setUpper(brk_dir, lo_lower_cut_plane - 1); + trial1.computeBreakData(brk_box); + if (trial1.improvesOver(trial)) { + trial.swap(trial1); + if (d_print_break_steps) { + tbox::plog << "breakOffLoad_planar choosing dir " << brk_dir + << " lo_lower_cut_plane " << ":" << trial << std::endl; + } + } + } + + if ((hi_lower_cut_plane - trial.d_whole_box.lower() (brk_dir) > + d_pparams->getMinBoxSize() (brk_dir) && + trial.d_whole_box.upper() (brk_dir) + 1 - hi_lower_cut_plane > + d_pparams->getMinBoxSize() (brk_dir)) || + hi_lower_cut_plane >= trial.d_whole_box.upper() (brk_dir) + 1) { + + hier::Box brk_box(trial.d_whole_box); + brk_box.setUpper(brk_dir, + tbox::MathUtilities::Min(hi_lower_cut_plane - 1, + trial1.d_whole_box.upper(brk_dir))); + trial1.computeBreakData(brk_box); + if (trial1.improvesOver(trial)) { + trial.swap(trial1); + if (d_print_break_steps) { + tbox::plog << "breakOffLoad_planar choosing dir " << brk_dir + << " hi_lower_cut_plane " << ":" << trial << std::endl; + } + } + } + + if ((trial.d_whole_box.upper() (brk_dir) + 1 - lo_upper_cut_plane > + d_pparams->getMinBoxSize() (brk_dir) && + lo_upper_cut_plane - trial.d_whole_box.lower() (brk_dir) > + d_pparams->getMinBoxSize() (brk_dir)) || + lo_upper_cut_plane <= trial.d_whole_box.lower() (brk_dir)) { + + hier::Box brk_box(trial.d_whole_box); + brk_box.setLower(brk_dir, + tbox::MathUtilities::Max(lo_upper_cut_plane, + trial1.d_whole_box.lower(brk_dir))); + trial1.computeBreakData(brk_box); + if (trial1.improvesOver(trial)) { + trial.swap(trial1); + if (d_print_break_steps) { + tbox::plog << "breakOffLoad_planar choosing dir " << brk_dir + << " lo_upper_cut_plane " << ":" << trial << std::endl; + } + } + } + + if (trial.d_whole_box.upper() (brk_dir) + 1 - hi_upper_cut_plane > + d_pparams->getMinBoxSize() (brk_dir) && + hi_upper_cut_plane - trial.d_whole_box.lower() (brk_dir) > + d_pparams->getMinBoxSize() (brk_dir)) { + + hier::Box brk_box(trial.d_whole_box); + brk_box.setLower(brk_dir, hi_upper_cut_plane); + trial1.computeBreakData(brk_box); + if (trial1.improvesOver(trial)) { + trial.swap(trial1); + if (d_print_break_steps) { + tbox::plog << "breakOffLoad_planar choosing dir " << brk_dir + << " hi_upper_cut_plane " << ":" << trial << std::endl; + } + } + } + + sufficient_brk_load = (trial.d_breakoff_load >= trial.d_low_load) && + (trial.d_breakoff_load <= trial.d_high_load); + + } // d-loop + +#ifdef DEBUG_CHECK_ASSERTIONS + for (hier::BoxContainer::iterator bi = trial.d_breakoff.begin(); + bi != trial.d_breakoff.end(); + ++bi) { + const hier::Box& b = *bi; + const hier::IntVector s = b.numberCells(); + for (int d = 0; d < dim.getValue(); ++d) { + if (((s(d) < d_pparams->getMinBoxSize() (d)) && (s(d) != box_dims(d))) || + (s(d) > box_dims(d))) { + TBOX_ERROR("BalanceBoxBreaker library error:\n" + << "breakoff box " << b << ", size " << s + << "\nis not between the min size " << d_pparams->getMinBoxSize() + << "\nand the original box size " << box_dims << "\n" + << "break box size " << trial.d_breakoff.front().numberCells() << "\n" + << "ideal brk load " << trial.d_ideal_load); + } + } + } + for (hier::BoxContainer::iterator bi = trial.d_leftover.begin(); + bi != trial.d_leftover.end(); + ++bi) { + const hier::Box& b = *bi; + const hier::IntVector s = b.numberCells(); + for (int d = 0; d < dim.getValue(); ++d) { + if (((s(d) < d_pparams->getMinBoxSize() (d)) && (s(d) != box_dims(d))) || + (s(d) > box_dims(d))) { + TBOX_ERROR("BalanceBoxBreaker library error:\n" + << "leftover box " << b << ", size " << s + << "\nis not between the min size " << d_pparams->getMinBoxSize() + << "\nand the original box size " << box_dims << "\n" + << "break box size " << trial.d_breakoff.front().numberCells() << "\n" + << "ideal brk load " << trial.d_ideal_load); + } + } + } +#endif + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_planar returning." << std::endl; + } + + return !trial.d_breakoff.empty(); +} + +/* + ************************************************************************* + * Break off a load from a box by making a box cut that is as close + * to cubic as feasible. + * + * Currently assuming uniform load of one unit per cell. + * + * Return whether a successful break was made. + * + * Differs from breakOffLoad in that it will always + * performs a break and if needed, break off more than + * the ideal. The calling method should take this into + * account. + ************************************************************************* + */ +bool +BalanceBoxBreaker::breakOffLoad_cubic(TrialBreak& trial) const +{ + const tbox::Dimension dim(trial.d_whole_box.getDim()); + + const hier::IntVector box_dims(trial.d_whole_box.numberCells()); + + const size_t box_vol = box_dims.getProduct(); + + double box_load_ratio = trial.d_whole_box_load / + static_cast(box_vol); + + if (trial.d_ideal_load >= trial.d_whole_box_load) { + // Easy: break off everything. + trial.computeBreakData(trial.d_whole_box); + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_cubic broke off entire Box " + << trial.d_whole_box + << std::endl; + } + return true; + } + + if (trial.d_ideal_load > 0.5 * trial.d_whole_box_load && + !tbox::MathUtilities::equalEps(trial.d_ideal_load, 0.5 * trial.d_whole_box_load)) { + /* + * This algorithm is better when breaking off a small portion. + * Since the ideal is a bigger portion, switch breakoff with leftover. + */ + if (d_print_break_steps) { + tbox::plog + << " breakOffLoad_cubic reversing direction to break " + << (static_cast(box_dims.getProduct()) - trial.d_ideal_load) + << " instead of " << trial.d_ideal_load << " / " + << box_dims.getProduct() << std::endl; + } + TrialBreak reversed_trial(trial, true); + bool success = + breakOffLoad_cubic(reversed_trial); + if (success) { + trial.swapWithReversedTrial(reversed_trial); + } + return success; + } + + if (d_print_break_steps) { + tbox::plog << " breakOffLoad_cubic attempting to break " + << trial.d_ideal_load << " from Box " + << trial.d_whole_box << trial.d_whole_box.numberCells() << '|' + << trial.d_whole_box.size() + << " min_size=" << d_pparams->getMinBoxSize() << std::endl; + } + + trial.d_breakoff.clear(); + trial.d_leftover.clear(); + trial.d_breakoff_load = 0.0; + + const hier::IntVector& one_vec = hier::IntVector::getOne(dim); + const hier::IntVector& zero_vec = hier::IntVector::getZero(dim); + + hier::Box best_breakoff_box(dim); + hier::IntVector best_breakoff_size = zero_vec; + double best_breakoff_load = 0; + + const hier::BlockId& block_id = trial.d_whole_box.getBlockId(); + const hier::IntVector& cut_factor( + d_pparams->getCutFactor().getBlockVector(block_id)); + + /* + * We consider 2^dim boxes grown from the incoming box's corners. + * Imagine 2 cutting planes per dimension, perpendicular to each + * axis, an upper cut and a lower cut. The box is cut into 3 parts + * in each direction, so the 2*dim planes divide the box into 3^dim + * boxes. + * + * 2D example: + * + * +-----------------+ + * | | | | + * |----+--------+---| + * | | | | + * | | | | + * | | | | + * | | | | + * |----+--------+---| + * | | | | + * +-----------------+ + * + * upper_intersection is the point where all upper cuts intersect. + * lower_intersection is the point where all lower cuts intersect. + * We only consider the cut boxes that touch the incoming box's + * corners. Using the other boxes result in too much fragmentation + * of the incoming box. + */ + hier::IntVector brk_size(d_pparams->getMinBoxSize()); + brk_size.max(cut_factor); + brk_size.min(box_dims); + + /* + * Make sure brk_size is a multiple of cut_factor. + */ + for (int d = 0; d < dim.getValue(); ++d) { + if (brk_size(d) % cut_factor(d) != 0) { + brk_size(d) = ((brk_size(d) / cut_factor(d)) + 1) * cut_factor(d); + } + } + + /* + * Initialize the cut plane intersections. We will grow the + * corner boxes by gradually moving the intersections away + * from their initial location. + */ + hier::IntVector lower_intersection(trial.d_whole_box.lower() + d_pparams->getMinBoxSize()); + hier::IntVector upper_intersection( + trial.d_whole_box.upper() - d_pparams->getMinBoxSize() + one_vec); + for (int d = 0; d < dim.getValue(); ++d) { + lower_intersection(d) = ROUND_TO_HI(lower_intersection(d), + cut_factor(d)); + upper_intersection(d) = ROUND_TO_LO(upper_intersection(d), + cut_factor(d)); + } + + const int num_corners = 1 << dim.getValue(); + + for (int bn = 0; bn < num_corners; ++bn) { + + if (d_print_break_steps) { + tbox::plog << "Examining corner box " << bn << std::endl; + } + + /* + * Compute initial box at corner bn and its expansion rate. + */ + hier::Box corner_box(trial.d_whole_box); + hier::IntVector corner_box_size = zero_vec; + double corner_box_load = 0; + hier::IntVector expansion_rate(dim); + + for (int d = 0; d < dim.getValue(); ++d) { + + // In direction d, does corner_box touch the upper (vs lower) side of box: + int touches_upper_side = bn & (1 << d); + + if (touches_upper_side) { + corner_box.setLower(static_cast(d), + upper_intersection(d)); + if (corner_box.lower(static_cast(d)) + - trial.d_whole_box.lower(static_cast(d)) < + d_pparams->getMinBoxSize() (d)) { + corner_box.setLower(static_cast(d), + trial.d_whole_box.lower(static_cast(d))); + } + expansion_rate(d) = -cut_factor(d); + } + else { + corner_box.setUpper(static_cast(d), + lower_intersection(d) - 1); + if ( trial.d_whole_box.upper()(d) - corner_box.upper()(d) < d_pparams->getMinBoxSize()(d) ) { + corner_box.setUpper(static_cast(d), + trial.d_whole_box.upper(static_cast(d))); + } + expansion_rate(d) = cut_factor(d); + } + + } + + corner_box_size = corner_box.numberCells(); + corner_box_load = trial.computeBreakOffLoad(corner_box); + + if (d_print_break_steps) { + tbox::plog << "Initial corner box " << bn << " is " << corner_box + << corner_box.numberCells() << '|' << corner_box.size() << std::endl; + } + + int break_acceptance_flags[4] = { 0, 0, 0, 0 }; + + if (BalanceUtilities::compareLoads( + break_acceptance_flags, best_breakoff_load, + corner_box_load, trial.d_ideal_load, + trial.d_low_load, trial.d_high_load, *d_pparams)) { + best_breakoff_box = corner_box; + best_breakoff_size = corner_box_size; + best_breakoff_load = corner_box_load; + if (d_print_break_steps) { + tbox::plog << "best_breakoff_box is now box " << bn << " " << best_breakoff_box + << ", best_breakoff_size = " << best_breakoff_size + << ", best_breakoff_load = " << best_breakoff_load + << std::endl; + } + if (best_breakoff_load >= trial.d_ideal_load) { + break; + } + } + + /* + * growable: whether corner_box_size can be grown without + * breaking off too much. + */ + hier::IntVector growable(dim, 1); + for (int d = 0; d < dim.getValue(); ++d) { + growable[d] = corner_box_size[d] < box_dims[d]; + } + + while (corner_box_load < trial.d_ideal_load) { + /* + * The while loop gradually increases corner_box to bring + * its size closer to trial.d_ideal_load. Stop loop when + * its size is in the acceptable range or if increasing + * it only takes it farther from trial.d_ideal_load. + * + * Select inc_dir, the direction to expand corner_box. Use the + * smallest direction that is still allowed to grow. + */ + + int inc_dir = -1; + for (int d = 0; d < dim.getValue(); ++d) { + if (growable(d) && + (inc_dir == -1 || corner_box_size(d) < corner_box_size(inc_dir))) + inc_dir = d; + } + if (inc_dir == -1) break; // No growable direction. + + TBOX_ASSERT(corner_box_size(inc_dir) < box_dims(inc_dir)); + + /* + * Grow corner_box, but keep within boundary of box and + * prevent remainder from violating min size. Update growability. + */ + if (expansion_rate(inc_dir) > 0) { + corner_box.setUpper(static_cast(inc_dir), + tbox::MathUtilities::Min( + corner_box.upper(static_cast(inc_dir)) + expansion_rate(inc_dir), + trial.d_whole_box.upper(static_cast(inc_dir)))); + if (trial.d_whole_box.upper() (inc_dir) - corner_box.upper() (inc_dir) < + d_pparams->getMinBoxSize() (inc_dir)) { + corner_box.setUpper(static_cast(inc_dir), + trial.d_whole_box.upper(static_cast(inc_dir))); + } + growable(inc_dir) = corner_box.upper() (inc_dir) < trial.d_whole_box.upper() (inc_dir); + } else { + corner_box.setLower(static_cast(inc_dir), + tbox::MathUtilities::Max( + corner_box.lower(static_cast(inc_dir)) + expansion_rate(inc_dir), + trial.d_whole_box.lower(static_cast(inc_dir)))); + if (corner_box.lower() (inc_dir) - trial.d_whole_box.lower() (inc_dir) < + d_pparams->getMinBoxSize() (inc_dir)) { + corner_box.setLower(static_cast(inc_dir), + trial.d_whole_box.lower(static_cast(inc_dir))); + } + growable(inc_dir) = corner_box.lower() (inc_dir) > trial.d_whole_box.lower() (inc_dir); + } + corner_box_size = corner_box.numberCells(); + corner_box_load = trial.computeBreakOffLoad(corner_box); + + const bool accept_break = BalanceUtilities::compareLoads( + break_acceptance_flags, best_breakoff_load, corner_box_load, + trial.d_ideal_load, trial.d_low_load, trial.d_high_load, *d_pparams); + + if (accept_break) { + best_breakoff_box = corner_box; + best_breakoff_size = corner_box_size; + best_breakoff_load = corner_box_load; + } + + } // while loop + + if (d_print_break_steps) { + tbox::plog << "After corner #" << bn << ", best_breakoff_box is now box " + << bn << " " << best_breakoff_box + << ", best_breakoff_size = " << best_breakoff_size + << ", best_breakoff_load = " << best_breakoff_load + << std::endl; + } + + } // bn loop + + if (!best_breakoff_box.empty()) { + trial.computeBreakData(best_breakoff_box); + } + +#ifdef DEBUG_CHECK_ASSERTIONS + for (hier::BoxContainer::iterator bi = trial.d_breakoff.begin(); + bi != trial.d_breakoff.end(); + ++bi) { + const hier::Box& b = *bi; + const hier::IntVector s = b.numberCells(); + for (int d = 0; d < dim.getValue(); ++d) { + if (((s(d) < d_pparams->getMinBoxSize() (d)) && (s(d) != box_dims(d))) || + (s(d) > box_dims(d))) { + TBOX_ERROR("BalanceBoxBreaker library error:\n" + << "breakoff box " << b << ", with size " << s + << "\nis not between the min size " << d_pparams->getMinBoxSize() + << "\nand the original box size " << box_dims << "\n" + << "orig box " << trial.d_whole_box << "\n" + << "break box " << b << "\n" + << "break box size " << b.size() << "\n" + << "ideal brk load " << trial.d_ideal_load); + } + } + } + for (hier::BoxContainer::iterator bi = trial.d_leftover.begin(); + bi != trial.d_leftover.end(); + ++bi) { + const hier::Box& b = *bi; + const hier::IntVector s = b.numberCells(); + for (int d = 0; d < dim.getValue(); ++d) { + if (((s(d) < d_pparams->getMinBoxSize() (d)) && (s(d) != box_dims(d))) || + (s(d) > box_dims(d))) { + TBOX_ERROR("BalanceBoxBreaker library error:\n" + << "leftover box " << b << ", with size " << s + << "\nis not between the min size " << d_pparams->getMinBoxSize() + << "\nand the original box size " << box_dims << "\n" + << "orig box " << trial.d_whole_box << "\n" + << "break box " << b << "\n" + << "break box size " << b.size() << "\n" + << "ideal brk load " << trial.d_ideal_load); + } + } + } +#endif + + return !trial.d_breakoff.empty(); +} + +/* + ************************************************************************* + ************************************************************************* + */ + +void +BalanceBoxBreaker::burstBox( + hier::BoxContainer& boxes, + const hier::Box& bursty, + const hier::Box& solid) +{ + /* + * This method lacks logic to handle the case of solid not being + * completely inside bursty. That feature is not currently needed. + */ + TBOX_ASSERT(bursty.contains(solid)); + + const hier::IntVector solid_size = solid.numberCells(); + + boxes.clear(); + hier::Box cutme = bursty; + while (!cutme.isSpatiallyEqual(solid)) { + + int cut_dir = 999999; + bool cut_above_solid = false; // Whether to slice off the piece above solid (vs below). + /* + * Find direction and place to cut. To minimize slivers, cut + * from cutme the thickest slab (in direction normal to cut) + * possible. + */ + int slab_thickness = 0; + for (tbox::Dimension::dir_t d = 0; d < solid_size.getDim().getValue(); ++d) { + if (cutme.numberCells(d) > solid_size(d)) { + const int thickness_from_upper_cut = cutme.upper() (d) + - solid.upper() (d); + if (thickness_from_upper_cut > slab_thickness) { + slab_thickness = thickness_from_upper_cut; + cut_dir = d; + cut_above_solid = true; + } + const int thickness_from_lower_cut = solid.lower() (d) + - cutme.lower() (d); + if (thickness_from_lower_cut > slab_thickness) { + slab_thickness = thickness_from_lower_cut; + cut_dir = d; + cut_above_solid = false; + } + } + } + TBOX_ASSERT(cut_dir >= 0 && cut_dir < solid_size.getDim().getValue()); + + hier::Box removeme = cutme; + if (cut_above_solid) { + cutme.setUpper(static_cast(cut_dir), + solid.upper(static_cast(cut_dir))); + removeme.setLower(static_cast(cut_dir), + solid.upper(static_cast(cut_dir)) + 1); + } else { + cutme.setLower(static_cast(cut_dir), + solid.lower(static_cast(cut_dir))); + removeme.setUpper(static_cast(cut_dir), + solid.lower(static_cast(cut_dir)) - 1); + } + + boxes.push_back(removeme); + + } +} + +/* + ************************************************************************* + * Compute a box_size score that is low for box widths smaller than + * some threshold_width. Boxes longer than this are okay assuming + * that they can be broken down further. Boxes shorter than this are + * undesirable because they lead to excessive box count and/or aspect + * ratios. + ************************************************************************* + */ +double BalanceBoxBreaker::computeWidthScore( + const hier::IntVector& box_size, + double threshold_width) +{ + return tbox::MathUtilities::Min(box_size.min() / threshold_width, 1); +} + +/* + ************************************************************************* + * Compute a size score for multiple boxes. The combined score is the + * product of individual scores. + ************************************************************************* + */ +double BalanceBoxBreaker::computeWidthScore( + const hier::BoxContainer& boxes, + double threshold_width) +{ + double width_score = 1.0; + for (hier::BoxContainer::const_iterator bi = boxes.begin(); bi != boxes.end(); ++bi) { + width_score *= computeWidthScore(bi->numberCells(), threshold_width); + } + return width_score; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BalanceBoxBreaker::setTimers() +{ + t_break_off_load = tbox::TimerManager::getManager()-> + getTimer("mesh::BalanceBoxBreaker::breakOffLoad()"); + t_find_bad_cuts = tbox::TimerManager::getManager()-> + getTimer("mesh::BalanceBoxBreaker::find_bad_cuts"); +} + +/* + ************************************************************************* + * Set all members invariant with each trial break. + ************************************************************************* + */ +BalanceBoxBreaker::TrialBreak::TrialBreak( + const PartitioningParams& pparams, + double threshold_width, + const hier::Box& whole_box, + double whole_box_load, + const std::vector& corner_weights, + const std::vector >& bad_cuts, + double ideal_load, + double low_load, + double high_load): + d_breakoff_load(0.0), + d_breakoff(), + d_leftover(), + d_ideal_load(ideal_load), + d_low_load(low_load), + d_high_load(high_load), + d_width_score(1.0), + d_balance_penalty(0.0), + d_pparams(&pparams), + d_threshold_width(threshold_width), + d_whole_box(whole_box), + d_whole_box_load(whole_box_load), + d_corner_weights(corner_weights), + d_bad_cuts(bad_cuts) +{ + computeMerits(); // This is the merits of doing nothing. +} + +/* + ************************************************************************* + ************************************************************************* + */ +BalanceBoxBreaker::TrialBreak::TrialBreak( + const TrialBreak& orig, + bool make_reverse): + d_breakoff_load(0.0), + d_breakoff(), + d_leftover(), + d_ideal_load(orig.d_whole_box_load - orig.d_ideal_load), + d_low_load(orig.d_whole_box_load - orig.d_high_load), + d_high_load(orig.d_whole_box_load - orig.d_low_load), + d_width_score(orig.d_width_score), + d_balance_penalty(orig.d_balance_penalty), + d_pparams(orig.d_pparams), + d_threshold_width(orig.d_threshold_width), + d_whole_box(orig.d_whole_box), + d_whole_box_load(orig.d_whole_box_load), + d_corner_weights(orig.d_corner_weights), + d_bad_cuts(orig.d_bad_cuts) +{ + // make_reverse only prevents this from being mistaken for a copy constructor. + NULL_USE(make_reverse); + computeMerits(); // This is the merits of doing nothing. +} + +/* + ************************************************************************* + * Break box out of d_whole_box and store results. + ************************************************************************* + */ +void BalanceBoxBreaker::TrialBreak::computeBreakData( + const hier::Box& box) +{ + d_breakoff.clear(); + d_leftover.clear(); + burstBox(d_leftover, d_whole_box, box); + d_breakoff.push_back(box); + d_breakoff_load = computeBreakOffLoad(box); + computeMerits(); +} + +/* + ************************************************************************* + * Compute the load total represent by the Box if it is broken off of + * d_whole_box. + ************************************************************************* + */ +double BalanceBoxBreaker::TrialBreak::computeBreakOffLoad( + const hier::Box& box) +{ + double breakoff_load = 0.0; + + if (d_corner_weights.empty()) { + /* + * If there is no corner weight information, the breakoff load is + * box.size() multiplied by the ratio of the whole load to the whole + * box size. + */ + breakoff_load = (d_whole_box_load / + static_cast(d_whole_box.size())) * + static_cast(box.size()); + } else { + /* + * If their are corner weights, use them in the load computation. + */ + const tbox::Dimension& dim = box.getDim(); + hier::IntVector mid_point(d_whole_box.numberCells()/2); + hier::IntVector corner_id(hier::IntVector::getZero(dim)); + unsigned int i = 0; + /* + * loop over all the corners. + */ + do { + /* + * d_corner_box stores the corner boxes for repeated calls of this + * method. + */ + if (d_corner_box.size() == i) { + d_corner_box.push_back(d_whole_box); + hier::Box& current_box = d_corner_box[i]; + for (unsigned int d = 0; d < dim.getValue(); ++d) { + if (corner_id[d] == 0) { + current_box.setLower(d, d_whole_box.lower()[d]); + current_box.setUpper(d, d_whole_box.lower()[d] + mid_point[d] - 1); + } else { + current_box.setLower(d, d_whole_box.lower()[d] + mid_point[d]); + current_box.setUpper(d, d_whole_box.upper()[d]); + } + } + } + + /* + * Increment n-dimensional corner id + */ + for (unsigned int d = 0; d < dim.getValue(); ++d) { + if (corner_id[d] == 0) { + corner_id[d] = 1; + break; + } else { + corner_id[d] = 0; + } + } + + /* + * Compute the load for the intersection of the input box and + * the current corner box. If the intersection is equal to the + * input box, we don't need to look at any more corner boxes and + * can break out of the do-while loop. + */ + hier::Box intersection(box * d_corner_box[i]); + if (!intersection.empty()) { + double corner_load = d_corner_weights[i] * d_whole_box_load; + breakoff_load += (corner_load / + static_cast(d_corner_box[i].size())) * + static_cast(intersection.size()); + if (intersection.isSpatiallyEqual(box)) { + break; + } + } + ++i; + } while (corner_id != hier::IntVector::getZero(dim)); + } + return breakoff_load; +} + + +/* + ************************************************************************* + ************************************************************************* + */ +void BalanceBoxBreaker::TrialBreak::swapWithReversedTrial( + TrialBreak& reversed) +{ +#ifdef DEBUG_CHECK_ASSERTIONS + if (&d_whole_box != &reversed.d_whole_box || + &d_bad_cuts != &reversed.d_bad_cuts || + d_pparams != reversed.d_pparams || + d_threshold_width != reversed.d_threshold_width) { + TBOX_ERROR("BalanceBoxBreaker::TrialBreak::swapWithReversedTrial:" + << "\nIncompatible TrialBreaks:" + << "\nthis:\n" << *this + << "\nreversed:\n" << reversed); + } +#endif + + d_breakoff.swap(reversed.d_leftover); + d_leftover.swap(reversed.d_breakoff); + d_corner_box.swap(reversed.d_corner_box); + d_breakoff_load = d_whole_box_load - reversed.d_breakoff_load; + computeMerits(); +} + +/* + ************************************************************************* + ************************************************************************* + */ +bool BalanceBoxBreaker::TrialBreak::computeMerits() +{ + d_width_score = + (d_breakoff.empty() && d_leftover.empty()) ? + computeWidthScore(d_whole_box.numberCells(), d_threshold_width) : + computeWidthScore(d_breakoff, d_threshold_width) + * computeWidthScore(d_leftover, d_threshold_width); + + d_balance_penalty = BalanceBoxBreaker::computeBalancePenalty( + d_breakoff_load - d_ideal_load); + + return BalanceUtilities::compareLoads( + d_flags, 0, d_breakoff_load, + d_ideal_load, d_low_load, d_high_load, *d_pparams); +} + +/* + ************************************************************************* + * Determine if this TrialBreak is an improvement over another. If + * both are in-range, pick the one with the best width score. If only + * one is in-range, pick that one. If none are in range but both are + * better than not breaking, chose the one with better load. If only + * one is better than not breaking, choose that one. Else, choose + * none. + ************************************************************************* + */ +int BalanceBoxBreaker::TrialBreak::improvesOver( + const TrialBreak& other) const +{ + int improves = 0; + + if (this->d_flags[3] && other.d_flags[3]) { + improves = + (this->d_width_score > other.d_width_score) ? 1 : + (this->d_width_score < other.d_width_score) ? -1 : 0; + if (improves == 0) { + improves = + (this->d_balance_penalty < other.d_balance_penalty) ? 1 : + (this->d_balance_penalty > other.d_balance_penalty) ? -1 : 0; + // How about balance_score = -balance_penalty so everything is a "score." + } + } else if (this->d_flags[3]) { + improves = 1; + } else if (other.d_flags[3]) { + improves = -1; + } else if (this->d_flags[2] == 1 && other.d_flags[2] == 1) { + int flags[4] = { 0, 0, 0, 0 }; + improves = BalanceUtilities::compareLoads( + flags, other.d_breakoff_load, this->d_breakoff_load, + d_ideal_load, d_low_load, d_high_load, *d_pparams); + } else if (this->d_flags[2] == 1) { + improves = 1; + } else if (other.d_flags[2] == 1) { + improves = -1; + } + + return improves == 1; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BalanceBoxBreaker::TrialBreak::swap(TrialBreak& other) +{ + TBOX_ASSERT(&d_whole_box == &other.d_whole_box); + TBOX_ASSERT(&d_bad_cuts == &other.d_bad_cuts); + TBOX_ASSERT(d_pparams == other.d_pparams); + TBOX_ASSERT(d_ideal_load == other.d_ideal_load); + TBOX_ASSERT(d_low_load == other.d_low_load); + TBOX_ASSERT(d_high_load == other.d_high_load); + TBOX_ASSERT(d_threshold_width == other.d_threshold_width); + + d_breakoff.swap(other.d_breakoff); + d_leftover.swap(other.d_leftover); + d_corner_box.swap(other.d_corner_box); + + double tmpd; + + tmpd = d_breakoff_load; + d_breakoff_load = other.d_breakoff_load; + other.d_breakoff_load = tmpd; + + tmpd = d_width_score; + d_width_score = other.d_width_score; + other.d_width_score = tmpd; + + tmpd = d_balance_penalty; + d_balance_penalty = other.d_balance_penalty; + other.d_balance_penalty = tmpd; + + int tmpi; + for (int i = 0; i < 4; ++i) { + tmpi = d_flags[i]; + d_flags[i] = other.d_flags[i]; + other.d_flags[i] = tmpi; + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +std::ostream& operator << ( + std::ostream& co, + const BalanceBoxBreaker::TrialBreak& tb) +{ + co.unsetf(std::ios::fixed | std::ios::scientific); + co.precision(6); + co << "\n TrialBreak state: broke off " + << tb.d_breakoff_load << " / " << tb.d_ideal_load + << " [" << tb.d_low_load << ", " << tb.d_high_load + << "] from " << tb.d_whole_box << '|' + << tb.d_whole_box.numberCells() << '|' + << tb.d_whole_box.size() << " into:\n" + << " " << " breakoff boxes: " << tb.d_breakoff.format(" ") + << " " << " leftover boxes: " << tb.d_leftover.format(" ") + << " imbalance: " + << (tb.d_breakoff_load - tb.d_ideal_load) + << " d_balance_penalty: " << tb.d_balance_penalty + << " d_width_score: " << tb.d_width_score + << "\n d_flags:" + << " " << tb.d_flags[0] + << " " << tb.d_flags[1] + << " " << tb.d_flags[2] + << " " << tb.d_flags[3] + << std::endl; + return co; +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.h new file mode 100644 index 00000000..d21c5518 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceBoxBreaker.h @@ -0,0 +1,235 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utilitiy for breaking boxes during partitioning. + * + ************************************************************************/ + +#ifndef included_mesh_BalanceBoxBreaker +#define included_mesh_BalanceBoxBreaker + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/mesh/PartitioningParams.h" + +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Utilities for breaking up boxes during partitioning. + */ + +class BalanceBoxBreaker +{ + +public: + /*! + * @brief Constructor. + * + * @param[in] pparams + * + * @param[in] print_break_steps Flag for debugging this class. + */ + BalanceBoxBreaker( + const PartitioningParams& pparams, + bool print_break_steps = false); + + //! @brief Copy constructor. + BalanceBoxBreaker( + const BalanceBoxBreaker& other); + + /*! + * @brief Break off a given load size from a given Box. + * + * Attempt to break off the ideal_load, or at least a load + * inside the range [low_load, high_load]. + * + * @param[out] breakoff Boxes broken off (usually just one). + * + * @param[out] leftover Remainder of box after breakoff is gone. + * + * @param[out] brk_load The load broken off. + * + * @param[in] box Box to break. + * + * @param[in] corner_weights Fraction of the total load associated with + * each corner. + * + * @param[in] box_load Load of the box before breaking. + * + * @param[in] ideal_load Ideal load to break. + * + * @param[in] low_load + * + * @param[in] high_load + * + * @param[in] threshold_width Try to avoid making boxes thinner + * than this width in any direction. + * + * @return whether a successful break was made. + * + * @pre ideal_load_to_break > 0 + */ + bool + breakOffLoad( + hier::BoxContainer& breakoff, + hier::BoxContainer& leftover, + double& brk_load, + const hier::Box& box, + double box_load, + const std::vector& corner_weights, + double ideal_load, + double low_load, + double high_load, + double threshold_width) const; + + /*! + * @brief Set whether to print box breaking steps for debugging. + */ + void setPrintBreakSteps(bool print_break_steps) { + d_print_break_steps = print_break_steps; + } + + /*! + * @brief Break up box bursty against box solid and adds the pieces + * in the given container. + * + * This version differs from that in BoxContainer in that it tries + * to minimize slivers. + */ + static void + burstBox( + hier::BoxContainer& boxes, + const hier::Box& bursty, + const hier::Box& solid); + + /*! + * @brief Compute the penalty associated with an imbalance. + */ + static double + computeBalancePenalty(double imbalance) + { + return tbox::MathUtilities::Abs(imbalance); + } + + /*! + * @brief Compute a score that is low for box widths smaller than + * some threshold_width. + */ + static double + computeWidthScore( + const hier::IntVector& box_size, + double threshold_width); + + /*! + * @brief Compute a combined width score for multiple boxes. + */ + static double + computeWidthScore( + const hier::BoxContainer& boxes, + double threshold_width); + +private: + //! @brief Information regarding a potential way to break a box. + struct TrialBreak { + TrialBreak( + const PartitioningParams& pparams, + double threshold_width, + const hier::Box& whole_box, + double whole_box_load, + const std::vector& corner_weights, + const std::vector >& bad_cuts, + double ideal_load, + double low_load, + double high_load); + //! @brief Construct TrialBreak where breakoff and leftover are reversed. + TrialBreak( + const TrialBreak& orig, + bool make_reverse); + //! @brief Compute data for breaking box from whole and store results. + void + computeBreakData( + const hier::Box& box); + + //! @brief Compute load that would break off if the box is broken off. + double computeBreakOffLoad( + const hier::Box& box); + + void + swapWithReversedTrial( + TrialBreak& reversed); + //! @brief Compute merits vs doing nothing and return improvement flag. + bool + computeMerits(); + //! @brief Whether this improves over another (or degrades or leaves alone). + int + improvesOver( + const TrialBreak& other) const; + + //! @brief Swap this object with another. + void + swap( + TrialBreak& other); + + double d_breakoff_load; + hier::BoxContainer d_breakoff; + hier::BoxContainer d_leftover; + const double d_ideal_load; + //! Part of the target break-off range [d_low_load,d_high_load] + const double d_low_load; + //! Part of the target break-off range [d_low_load,d_high_load] + const double d_high_load; + double d_width_score; + double d_balance_penalty; + //! @brief Flags from comparing this trial vs doing nothing. + int d_flags[4]; + const PartitioningParams* d_pparams; + const double d_threshold_width; + const hier::Box& d_whole_box; + double d_whole_box_load; + const std::vector& d_corner_weights; + const std::vector >& d_bad_cuts; + std::vector d_corner_box; + }; + +private: + bool + breakOffLoad_planar( + TrialBreak& trial) const; + + bool + breakOffLoad_cubic( + TrialBreak& trial) const; + + void + setTimers(); + + const PartitioningParams * d_pparams; + + //@{ + //! @name Debugging and diagnostic data + + bool d_print_break_steps; + boost::shared_ptr t_break_off_load; + boost::shared_ptr t_find_bad_cuts; + + //@} + +public: + friend std::ostream& + operator << ( + std::ostream& os, + const TrialBreak& tb); + +}; + +} +} +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.C index 5889a8af..9c0f234f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: utility routines useful for load balancing operations * ************************************************************************/ @@ -15,6 +15,9 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxUtilities.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -34,6 +37,9 @@ namespace mesh { math::PatchCellDataNormOpsReal BalanceUtilities::s_norm_ops; +const int BalanceUtilities::BalanceUtilities_PREBALANCE0; +const int BalanceUtilities::BalanceUtilities_PREBALANCE1; + /* ************************************************************************* * @@ -46,8 +52,8 @@ math::PatchCellDataNormOpsReal BalanceUtilities::s_norm_ops; void BalanceUtilities::privateHeapify( - tbox::Array& permutation, - tbox::Array& workload, + std::vector& permutation, + std::vector& workload, const int index, const int heap_size) { @@ -72,8 +78,8 @@ BalanceUtilities::privateHeapify( void BalanceUtilities::privateHeapify( - tbox::Array& permutation, - tbox::Array& spatial_keys, + std::vector& permutation, + std::vector& spatial_keys, const int index, const int heap_size) { @@ -108,7 +114,7 @@ void BalanceUtilities::privateRecursiveProcAssign( const int wt_index_lo, const int wt_index_hi, - tbox::Array& weights, + std::vector& weights, const int proc_index_lo, const int proc_index_hi, hier::ProcessorMapping& mapping, @@ -126,7 +132,7 @@ BalanceUtilities::privateRecursiveProcAssign( * in the weight index range to the processor */ if (proc_index_hi == proc_index_lo) { - for (i = wt_index_lo; i <= wt_index_hi; i++) { + for (i = wt_index_lo; i <= wt_index_hi; ++i) { mapping.setProcessorAssignment(i, proc_index_lo); } } else { // otherwise recurse @@ -146,7 +152,7 @@ BalanceUtilities::privateRecursiveProcAssign( */ while ((cut_index <= wt_index_hi) && (acc_weight < cut_weight)) { acc_weight += weights[cut_index]; - cut_index++; + ++cut_index; } /* @@ -158,7 +164,7 @@ BalanceUtilities::privateRecursiveProcAssign( double prev_weight = acc_weight - weights[cut_index - 1]; if ((cut_index > wt_index_lo + 1) && ((acc_weight - cut_weight) > (cut_weight - prev_weight))) { - cut_index--; + --cut_index; } /* @@ -202,7 +208,7 @@ BalanceUtilities::privateRecursiveProcAssign( void BalanceUtilities::privatePrimeFactorization( const int N, - tbox::Array& p) + std::vector& p) { /* * Input: N @@ -216,7 +222,7 @@ BalanceUtilities::privatePrimeFactorization( int n = N; int q; int r; - if (p.getSize() < 1) p.resizeArray(1); + if (p.size() < 1) p.resize(1); p[0] = 1; // NOTE: d must hold the list of prime numbers up to sqrt(n). We @@ -243,8 +249,8 @@ BalanceUtilities::privatePrimeFactorization( // Step 5 - factor found. Increase t by 1, set p[t] = d[k], n = q. - t++; - p.resizeArray(t + 1); + ++t; + p.resize(t + 1); p[t] = d[k]; n = q; @@ -254,14 +260,14 @@ BalanceUtilities::privatePrimeFactorization( if (q > d[k]) { - k++; + ++k; } else { // Step 7 - n is prime. Increment t by 1, set p[t] = n, and terminate. - t++; - p.resizeArray(t + 1); + ++t; + p.resize(t + 1); p[t] = n; break; } @@ -274,28 +280,28 @@ BalanceUtilities::privatePrimeFactorization( void BalanceUtilities::privateResetPrimesArray( - tbox::Array& p) + std::vector& p) { // keep a copy of the original p in array "temp" - tbox::Array temp; - temp.resizeArray(p.getSize()); + std::vector temp; + temp.resize(static_cast(p.size())); int i; - for (i = 0; i < p.getSize(); i++) temp[i] = p[i]; + for (i = 0; i < static_cast(p.size()); ++i) temp[i] = p[i]; // resize p to only keep values > 1 int newsize = 0; - for (i = 0; i < p.getSize(); i++) { - if (p[i] > 1) newsize++; + for (i = 0; i < static_cast(p.size()); ++i) { + if (p[i] > 1) ++newsize; } - p.resizeArray(newsize); + p.resize(newsize); newsize = 0; // set values in the new p array - for (i = 0; i < temp.getSize(); i++) { + for (i = 0; i < static_cast(temp.size()); ++i) { if (temp[i] > 1) { p[newsize] = temp[i]; - newsize++; + ++newsize; } } } @@ -313,10 +319,24 @@ bool BalanceUtilities::privateBadCutPointsExist( const hier::BoxContainer& physical_domain) { - hier::BoxContainer bounding_box(physical_domain.getBoundingBox()); - bounding_box.removeIntersections(physical_domain); + bool bad_cuts_exist = false; + + std::map domain_by_blocks; + for (hier::BoxContainer::const_iterator itr = physical_domain.begin(); + itr != physical_domain.end(); ++itr) { + const hier::BlockId& block_id = itr->getBlockId(); + domain_by_blocks[block_id].pushBack(*itr); + } + for (std::map::iterator m_itr = + domain_by_blocks.begin(); m_itr != domain_by_blocks.end(); ++m_itr) { + hier::BoxContainer bounding_box(m_itr->second.getBoundingBox()); + bounding_box.removeIntersections(m_itr->second); + if (!bounding_box.empty()) { + bad_cuts_exist = true; + } + } - return bounding_box.size() > 0; + return bad_cuts_exist; } /* @@ -331,17 +351,17 @@ BalanceUtilities::privateBadCutPointsExist( void BalanceUtilities::privateInitializeBadCutPointsForBox( - tbox::Array >& bad_cut_points, + std::vector >& bad_cut_points, hier::Box& box, bool bad_domain_boundaries_exist, const hier::IntVector& bad_interval, const hier::BoxContainer& physical_domain) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, bad_interval); const tbox::Dimension dim(box.getDim()); - int ic, id; + tbox::Dimension::dir_t ic, id; bool set_dummy_cut_points = true; @@ -354,7 +374,7 @@ BalanceUtilities::privateInitializeBadCutPointsForBox( hier::BoxContainer bdry_list(box); bdry_list.grow(tmp_max_gcw); bdry_list.removeIntersections(physical_domain); - if (bdry_list.size() > 0) { + if (!bdry_list.empty()) { set_dummy_cut_points = false; } @@ -362,18 +382,18 @@ BalanceUtilities::privateInitializeBadCutPointsForBox( if (set_dummy_cut_points) { - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { const int ncells = box.numberCells(id); - bad_cut_points[id].resizeArray(ncells); - tbox::Array& arr_ref = bad_cut_points[id]; - for (ic = 0; ic < ncells; ic++) { + bad_cut_points[id].resize(ncells); + std::vector& arr_ref = bad_cut_points[id]; + for (ic = 0; ic < ncells; ++ic) { arr_ref[ic] = false; } } } else { - for (id = 0; id < dim.getValue(); id++) { + for (id = 0; id < dim.getValue(); ++id) { hier::BoxUtilities:: findBadCutPointsForDirection(id, bad_cut_points[id], @@ -389,12 +409,12 @@ BalanceUtilities::privateInitializeBadCutPointsForBox( /* ************************************************************************* * - * Internal function to determine best cut dimension for a box based + * Internal function to determine best cut direction for a box based * on constraints and adjust bad cut points as needed. Return - * value is true if some dimension can be cut; false, otherwise. - * If the box can be cut along some dimension, then cut_dim_out is - * set to the longest box dimension that can be cut; otherwise, - * cut_dim_out is set to -1 (an invalid box dimension. + * value is true if some direction can be cut; false, otherwise. + * If the box can be cut along some direction, then cut_dim_out is + * set to the longest box direction that can be cut; otherwise, + * cut_dim_out is set to the invalid value of SAMRAI::MAX_DIM_VAL. * Note no error checking is done. * ************************************************************************* @@ -402,38 +422,38 @@ BalanceUtilities::privateInitializeBadCutPointsForBox( bool BalanceUtilities::privateFindBestCutDimension( - int& cut_dim_out, + tbox::Dimension::dir_t& cut_dim_out, const hier::Box& in_box, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points) + std::vector >& bad_cut_points) { - TBOX_DIM_ASSERT_CHECK_ARGS3(in_box, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY3(in_box, min_size, cut_factor); const tbox::Dimension& dim(in_box.getDim()); bool can_cut_box = false; - cut_dim_out = -1; + cut_dim_out = SAMRAI::MAX_DIM_VAL; hier::Box size_test_box(in_box); - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { int ncells = in_box.numberCells(id); if ((ncells < 2 * min_size(id)) || (ncells % cut_factor(id))) { - size_test_box.lower(id) = size_test_box.upper(id); + size_test_box.setLower(id, size_test_box.upper(id)); } } if (size_test_box.size() > 1) { /* - * Find good cut points along some box dimension, starting with longest - * dimension, then trying next longest, etc., until good cut points found. + * Find good cut points along some box direction, starting with longest + * direction, then trying next longest, etc., until good cut points found. */ hier::Box test_box(size_test_box); - int cutdim = test_box.longestDimension(); + tbox::Dimension::dir_t cutdim = test_box.longestDirection(); int numcells = test_box.numberCells(cutdim); int cutfact = cut_factor(cutdim); int mincut = tbox::MathUtilities::Max(min_size(cutdim), cutfact); @@ -449,15 +469,15 @@ BalanceUtilities::privateFindBestCutDimension( * coordinate direction. */ - tbox::Array& bad_cuts_for_dir = bad_cut_points[cutdim]; + std::vector& bad_cuts_for_dir = bad_cut_points[cutdim]; - for (i = 0; i < mincut; i++) { + for (i = 0; i < mincut; ++i) { bad_cuts_for_dir[i] = true; } - for (i = (numcells - mincut + 1); i < numcells; i++) { + for (i = (numcells - mincut + 1); i < numcells; ++i) { bad_cuts_for_dir[i] = true; } - for (i = 0; i < numcells; i++) { + for (i = 0; i < numcells; ++i) { if (i % cutfact) { bad_cuts_for_dir[i] = true; } @@ -465,10 +485,10 @@ BalanceUtilities::privateFindBestCutDimension( } if (!found_cut_point) { - test_box.lower(cutdim) = test_box.upper(cutdim); + test_box.setLower(cutdim, test_box.upper(cutdim)); } - cutdim = test_box.longestDimension(); + cutdim = test_box.longestDirection(); numcells = test_box.numberCells(cutdim); cutfact = cut_factor(cutdim); mincut = tbox::MathUtilities::Max(min_size(cutdim), cutfact); @@ -489,7 +509,7 @@ BalanceUtilities::privateFindBestCutDimension( /* ************************************************************************* * - * Internal function to determine cut point for a single dimension + * Internal function to determine cut point for a single direction * given min cut, ideal workload, bad cut point constraints. * Note no error checking is done. * @@ -502,8 +522,8 @@ BalanceUtilities::privateFindCutPoint( double ideal_workload, int mincut, int numcells, - const tbox::Array& work_in_slice, - const tbox::Array& bad_cut_points) + const std::vector& work_in_slice, + const std::vector& bad_cut_points) { int cut_index = 0; @@ -520,13 +540,13 @@ BalanceUtilities::privateFindCutPoint( while (cut_index < mincut) { acc_work += work_in_slice[cut_index]; - cut_index++; + ++cut_index; } int last = numcells - mincut; while ((acc_work < work_cutpt) && (cut_index < last)) { acc_work += work_in_slice[cut_index]; - cut_index++; + ++cut_index; } /* @@ -541,14 +561,14 @@ BalanceUtilities::privateFindCutPoint( double l_work = acc_work; while ((bad_cut_points[l_index]) && (l_index > 2)) { l_work -= work_in_slice[l_index - 1]; - l_index--; + --l_index; } int r_index = cut_index; double r_work = acc_work; while ((bad_cut_points[r_index]) && (r_index < numcells - 1)) { r_work += work_in_slice[r_index]; - r_index++; + ++r_index; } if ((work_cutpt - l_work) < (r_work - work_cutpt)) { @@ -575,7 +595,7 @@ BalanceUtilities::privateFindCutPoint( ************************************************************************* * * Internal function to cut box in two at given cut point along given - * dimension. box_lo, box_hi will be new disjoint boxes whose union + * direction. box_lo, box_hi will be new disjoint boxes whose union * is the box to be cut (in_box). bad_cut_points_for_boxlo, and * bad_cut_points_for_boxhi are associated arrays of bad cut points * defined by given bad cut point arrays for in_box. @@ -587,50 +607,50 @@ BalanceUtilities::privateFindCutPoint( void BalanceUtilities::privateCutBoxesAndSetBadCutPoints( hier::Box& box_lo, - tbox::Array >& bad_cut_points_for_boxlo, + std::vector >& bad_cut_points_for_boxlo, hier::Box& box_hi, - tbox::Array >& bad_cut_points_for_boxhi, + std::vector >& bad_cut_points_for_boxhi, const hier::Box& in_box, - int cutdim, + tbox::Dimension::dir_t cutdim, int cut_index, - const tbox::Array >& bad_cut_points) + const std::vector >& bad_cut_points) { - TBOX_DIM_ASSERT_CHECK_ARGS3(box_lo, box_hi, in_box); + TBOX_ASSERT_OBJDIM_EQUALITY3(box_lo, box_hi, in_box); const tbox::Dimension& dim(box_lo.getDim()); box_lo = in_box; - box_lo.upper(cutdim) = cut_index - 1; + box_lo.setUpper(cutdim, cut_index - 1); box_hi = in_box; - box_hi.lower(cutdim) = cut_index; + box_hi.setLower(cutdim, cut_index); int i; - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { - const tbox::Array& arr_ref_in = bad_cut_points[id]; + const std::vector& arr_ref_in = bad_cut_points[id]; const int ncellslo = box_lo.numberCells(id); const int ncellshi = box_hi.numberCells(id); - bad_cut_points_for_boxlo[id].resizeArray(ncellslo); - bad_cut_points_for_boxhi[id].resizeArray(ncellshi); + bad_cut_points_for_boxlo[id].resize(ncellslo); + bad_cut_points_for_boxhi[id].resize(ncellshi); - tbox::Array& arr_ref_cutlo = bad_cut_points_for_boxlo[id]; - for (i = 0; i < ncellslo; i++) { + std::vector& arr_ref_cutlo = bad_cut_points_for_boxlo[id]; + for (i = 0; i < ncellslo; ++i) { arr_ref_cutlo[i] = arr_ref_in[i]; } - tbox::Array& arr_ref_cuthi = bad_cut_points_for_boxhi[id]; + std::vector& arr_ref_cuthi = bad_cut_points_for_boxhi[id]; if (id == cutdim) { int mark = box_lo.numberCells(cutdim); - for (i = 0; i < ncellshi; i++) { + for (i = 0; i < ncellshi; ++i) { arr_ref_cuthi[i] = arr_ref_in[i + mark]; } } else { - for (i = 0; i < ncellshi; i++) { + for (i = 0; i < ncellshi; ++i) { arr_ref_cuthi[i] = arr_ref_in[i]; } } @@ -660,9 +680,9 @@ BalanceUtilities::privateRecursiveBisectionUniformSingleBox( const double workload_tolerance, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points) + std::vector >& bad_cut_points) { - TBOX_DIM_ASSERT_CHECK_ARGS3(in_box, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY3(in_box, min_size, cut_factor); const tbox::Dimension dim(in_box.getDim()); @@ -674,10 +694,11 @@ BalanceUtilities::privateRecursiveBisectionUniformSingleBox( } else { /* - * Determine best dimension to chop box. + * Determine best direction to chop box. */ - int cut_dim; - bool can_cut_box = privateFindBestCutDimension(cut_dim, + tbox::Dimension::dir_t cut_dim; + bool can_cut_box = privateFindBestCutDimension( + cut_dim, in_box, min_size, cut_factor, @@ -692,18 +713,18 @@ BalanceUtilities::privateRecursiveBisectionUniformSingleBox( tbox::MathUtilities::Max(min_size(cut_dim), cut_factor(cut_dim)); /* - * Search for chop point along chosen dimension. + * Search for chop point along chosen direction. */ double work_in_single_slice = 1.0; - for (int id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { if (id != cut_dim) { work_in_single_slice *= (double)in_box.numberCells(id); } } - tbox::Array work_in_slices(numcells); - for (i = 0; i < numcells; i++) { + std::vector work_in_slices(numcells); + for (i = 0; i < numcells; ++i) { work_in_slices[i] = work_in_single_slice; } @@ -724,8 +745,8 @@ BalanceUtilities::privateRecursiveBisectionUniformSingleBox( hier::Box box_lo(dim); hier::Box box_hi(dim); - tbox::Array > bad_cut_points_for_boxlo(dim.getValue()); - tbox::Array > bad_cut_points_for_boxhi(dim.getValue()); + std::vector > bad_cut_points_for_boxlo(dim.getValue()); + std::vector > bad_cut_points_for_boxhi(dim.getValue()); privateCutBoxesAndSetBadCutPoints(box_lo, bad_cut_points_for_boxlo, @@ -798,10 +819,10 @@ BalanceUtilities::privateRecursiveBisectionNonuniformSingleBox( const double workload_tolerance, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points) + std::vector >& bad_cut_points) { TBOX_ASSERT(patch); - TBOX_DIM_ASSERT_CHECK_ARGS4(*patch, in_box, min_size, cut_factor); + TBOX_ASSERT_OBJDIM_EQUALITY4(*patch, in_box, min_size, cut_factor); const tbox::Dimension dim(in_box.getDim()); @@ -813,10 +834,11 @@ BalanceUtilities::privateRecursiveBisectionNonuniformSingleBox( } else { /* - * Determine best dimension to chop box. + * Determine best direction to chop box. */ - int cut_dim; - bool can_cut_box = privateFindBestCutDimension(cut_dim, + tbox::Dimension::dir_t cut_dim; + bool can_cut_box = privateFindBestCutDimension( + cut_dim, in_box, min_size, cut_factor, @@ -831,20 +853,20 @@ BalanceUtilities::privateRecursiveBisectionNonuniformSingleBox( tbox::MathUtilities::Max(min_size(cut_dim), cut_factor(cut_dim)); /* - * Search for chop point along chosen dimension. + * Search for chop point along chosen direction. */ hier::Box slice_box = in_box; - slice_box.upper(cut_dim) = slice_box.lower(cut_dim); + slice_box.setUpper(cut_dim, slice_box.lower(cut_dim)); - tbox::Array work_in_slices(numcells); - for (i = 0; i < numcells; i++) { + std::vector work_in_slices(numcells); + for (i = 0; i < numcells; ++i) { work_in_slices[i] = BalanceUtilities::computeNonUniformWorkload(patch, work_data_index, slice_box); - slice_box.lower(cut_dim) += 1; - slice_box.upper(cut_dim) = slice_box.lower(cut_dim); + slice_box.setLower(cut_dim, slice_box.lower(cut_dim) + 1); + slice_box.setUpper(cut_dim, slice_box.lower(cut_dim)); } @@ -865,8 +887,8 @@ BalanceUtilities::privateRecursiveBisectionNonuniformSingleBox( hier::Box box_lo(dim); hier::Box box_hi(dim); - tbox::Array > bad_cut_points_for_boxlo(dim.getValue()); - tbox::Array > bad_cut_points_for_boxhi(dim.getValue()); + std::vector > bad_cut_points_for_boxlo(dim.getValue()); + std::vector > bad_cut_points_for_boxhi(dim.getValue()); privateCutBoxesAndSetBadCutPoints(box_lo, bad_cut_points_for_boxlo, @@ -879,7 +901,7 @@ BalanceUtilities::privateRecursiveBisectionNonuniformSingleBox( const int box_lo_ncells = box_lo.numberCells(cut_dim); double box_lo_workload = 0.0; - for (i = 0; i < box_lo_ncells; i++) { + for (i = 0; i < box_lo_ncells; ++i) { box_lo_workload += work_in_slices[i]; } privateRecursiveBisectionNonuniformSingleBox(out_boxes, @@ -939,17 +961,100 @@ BalanceUtilities::computeNonUniformWorkload( const hier::Box& box) { TBOX_ASSERT(patch); - TBOX_DIM_ASSERT_CHECK_ARGS2(*patch, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*patch, box); const boost::shared_ptr > work_data( - patch->getPatchData(wrk_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(wrk_indx))); + + TBOX_ASSERT(work_data); double workload = s_norm_ops.L1Norm(work_data, box); return workload; } +/* + ************************************************************************* + * + * Compute workload in patch while storing corner weights. + * + ************************************************************************* + */ + +double +BalanceUtilities::computeNonUniformWorkloadOnCorners( + std::vector& corner_weights, + const boost::shared_ptr& patch, + int wrk_indx, + const hier::Box& box) +{ + TBOX_ASSERT(patch); + TBOX_ASSERT(box.getBlockId() == patch->getBox().getBlockId()); + TBOX_ASSERT(box.isSpatiallyEqual(patch->getBox()) || + box.isSpatiallyEqual(box * patch->getBox())); + + if (!corner_weights.empty()) { + TBOX_ERROR("BalanceUtilities::computeNonUniformWorkloadOnCorners received a non-empty corner weights argument."); + } + + double workload = 0.0; + hier::Box work_box(box); + hier::IntVector box_width(box.numberCells()); + hier::IntVector mid_point(box_width/2); + const tbox::Dimension& dim = box.getDim(); + + hier::IntVector corner_id(hier::IntVector::getZero(dim)); + do { + // Set work_box to current corner. + for (unsigned int d = 0; d < dim.getValue(); ++d) { + if (corner_id[d] == 0) { + work_box.setLower(d, box.lower()[d]); + work_box.setUpper(d, box.lower()[d] + mid_point[d] - 1); + } else { + work_box.setLower(d, box.lower()[d] + mid_point[d]); + work_box.setUpper(d, box.upper()[d]); + } + } + + // Increment n-dimensional corner id + for (unsigned int d = 0; d < dim.getValue(); ++d) { + if (corner_id[d] == 0) { + corner_id[d] = 1; + break; + } else { + corner_id[d] = 0; + } + } + + // Compute workload for current corner + corner_weights.push_back( + computeNonUniformWorkload(patch, wrk_indx, work_box)); + + // End loop when all corners have been evaluated. + } while (corner_id != hier::IntVector::getZero(dim)); + + /* + * Corner weights currently hold absolute workload. The sum is the + * the patch. + */ + for (std::vector::const_iterator itr = corner_weights.begin(); + itr != corner_weights.end(); ++itr) { + workload += *itr; + } + + /* + * Change the corner weights to the fractions of the total workload. + */ + for (std::vector::iterator itr = corner_weights.begin(); + itr != corner_weights.end(); ++itr) { + *itr /= workload; + } + + return workload; +} + + /* ************************************************************************* * @@ -963,7 +1068,7 @@ BalanceUtilities::computeNonUniformWorkload( double BalanceUtilities::binPack( hier::ProcessorMapping& mapping, - tbox::Array& weights, + std::vector& weights, const int nproc) { TBOX_ASSERT(nproc > 0); @@ -972,30 +1077,30 @@ BalanceUtilities::binPack( * Create the mapping array, find the average workload, and zero weights */ - const int nboxes = weights.getSize(); + const int nboxes = static_cast(weights.size()); mapping.setMappingSize(nboxes); double avg_work = 0.0; - for (int w = 0; w < nboxes; w++) { + for (int w = 0; w < nboxes; ++w) { TBOX_ASSERT(weights[w] >= 0.0); avg_work += weights[w]; } avg_work /= nproc; - tbox::Array work(nproc); - for (int p = 0; p < nproc; p++) { + std::vector work(nproc); + for (int p = 0; p < nproc; ++p) { work[p] = 0.0; } /* * Assign each box to the processor with the lowest workload */ - for (int b = 0; b < nboxes; b++) { + for (int b = 0; b < nboxes; ++b) { const double weight = weights[b]; int proc = 0; double diff = avg_work - (work[0] + weight); - for (int p = 1; p < nproc; p++) { + for (int p = 1; p < nproc; ++p) { const double d = avg_work - (work[p] + weight); if (((diff > 0.0) && (d >= 0.0) && (d < diff)) || ((diff < 0.0) && (d > diff))) { @@ -1013,7 +1118,7 @@ BalanceUtilities::binPack( */ double max_work = 0.0; - for (int iw = 0; iw < nproc; iw++) { + for (int iw = 0; iw < nproc; ++iw) { if (work[iw] > max_work) max_work = work[iw]; } @@ -1043,12 +1148,12 @@ BalanceUtilities::binPack( double BalanceUtilities::spatialBinPack( hier::ProcessorMapping& mapping, - tbox::Array& weights, + std::vector& weights, hier::BoxContainer& boxes, const int nproc) { TBOX_ASSERT(nproc > 0); - TBOX_ASSERT(weights.getSize() == boxes.size()); + TBOX_ASSERT(static_cast(weights.size()) == boxes.size()); const int nboxes = boxes.size(); @@ -1056,23 +1161,24 @@ BalanceUtilities::spatialBinPack( * compute offset which guarantees that the index space for all boxes * is positive. */ - hier::IntVector offset(boxes.front().lower()); - for (hier::BoxContainer::iterator itr(boxes); itr != boxes.end(); ++itr) { + hier::Index offset(boxes.front().lower()); + for (hier::BoxContainer::iterator itr = boxes.begin(); + itr != boxes.end(); ++itr) { offset.min(itr->lower()); } /* construct array of spatialKeys */ - tbox::Array spatial_keys(nboxes); + std::vector spatial_keys(nboxes); int i = 0; if (nboxes > 0) { const tbox::Dimension& dim = boxes.front().getDim(); - for (hier::BoxContainer::iterator itr(boxes); + for (hier::BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { /* compute center of box */ - hier::IntVector center = (itr->upper() + itr->lower()) / 2; + hier::Index center = (itr->upper() + itr->lower()) / 2; if (dim == tbox::Dimension(1)) { spatial_keys[i].setKey(center(0) - offset(0)); @@ -1093,16 +1199,16 @@ BalanceUtilities::spatialBinPack( * Sort boxes according to their spatial keys using a heapsort. */ - tbox::Array permutation(nboxes); + std::vector permutation(nboxes); - for (i = 0; i < nboxes; i++) { + for (i = 0; i < nboxes; ++i) { permutation[i] = i; } - for (i = nboxes / 2 - 1; i >= 0; i--) { + for (i = nboxes / 2 - 1; i >= 0; --i) { privateHeapify(permutation, spatial_keys, i, nboxes); } - for (i = nboxes - 1; i >= 1; i--) { + for (i = nboxes - 1; i >= 1; --i) { const int tmp = permutation[0]; permutation[0] = permutation[i]; permutation[i] = tmp; @@ -1115,11 +1221,11 @@ BalanceUtilities::spatialBinPack( if (nboxes > 0) { const tbox::Dimension& dim = boxes.front().getDim(); - tbox::Array unsorted_boxes(nboxes, hier::Box(dim)); - tbox::Array unsorted_weights(nboxes); + std::vector unsorted_boxes(nboxes, hier::Box(dim)); + std::vector unsorted_weights(nboxes); i = 0; - for (hier::BoxContainer::iterator itr(boxes); + for (hier::BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { unsorted_boxes[i] = *itr; unsorted_weights[i] = weights[i]; @@ -1127,7 +1233,7 @@ BalanceUtilities::spatialBinPack( } i = 0; - for (hier::BoxContainer::iterator itr(boxes); + for (hier::BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { *itr = unsorted_boxes[permutation[i]]; weights[i] = unsorted_weights[permutation[i]]; @@ -1139,27 +1245,26 @@ BalanceUtilities::spatialBinPack( * Verify that the spatial keys are sorted in non-decreasing order */ - tbox::Array unsorted_keys(nboxes); - for (i = 0; i < nboxes; i++) { + std::vector unsorted_keys(nboxes); + for (i = 0; i < nboxes; ++i) { unsorted_keys[i] = spatial_keys[i]; } - for (i = 0; i < nboxes; i++) { + for (i = 0; i < nboxes; ++i) { spatial_keys[i] = unsorted_keys[permutation[i]]; } - for (i = 0; i < nboxes - 1; i++) { + for (i = 0; i < nboxes - 1; ++i) { TBOX_ASSERT(spatial_keys[i] <= spatial_keys[i + 1]); } #endif } - /* Find average workload */ double avg_work = 0.0; - for (i = 0; i < nboxes; i++) { + for (i = 0; i < nboxes; ++i) { TBOX_ASSERT(weights[i] >= 0.0); avg_work += weights[i]; } @@ -1180,11 +1285,11 @@ BalanceUtilities::spatialBinPack( } /* compute work load for each processor */ - tbox::Array work(nproc); - for (i = 0; i < nproc; i++) { + std::vector work(nproc); + for (i = 0; i < nproc; ++i) { work[i] = 0.0; } - for (i = 0; i < nboxes; i++) { + for (i = 0; i < nboxes; ++i) { work[mapping.getProcessorAssignment(i)] += weights[i]; } @@ -1193,7 +1298,7 @@ BalanceUtilities::spatialBinPack( */ double max_work = 0.0; - for (i = 0; i < nproc; i++) { + for (i = 0; i < nproc; ++i) { if (work[i] > max_work) max_work = work[i]; } @@ -1228,7 +1333,7 @@ BalanceUtilities::recursiveBisectionUniform( const hier::IntVector& bad_interval, const hier::BoxContainer& physical_domain) { - TBOX_DIM_ASSERT_CHECK_ARGS3(min_size, cut_factor, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY3(min_size, cut_factor, bad_interval); const tbox::Dimension dim(min_size.getDim()); @@ -1237,7 +1342,7 @@ BalanceUtilities::recursiveBisectionUniform( TBOX_ASSERT(min_size > hier::IntVector::getZero(dim)); TBOX_ASSERT(cut_factor > hier::IntVector::getZero(dim)); TBOX_ASSERT(bad_interval >= hier::IntVector::getZero(dim)); - TBOX_ASSERT(physical_domain.size() > 0); + TBOX_ASSERT(!physical_domain.empty()); out_boxes.clear(); out_workloads.clear(); @@ -1245,14 +1350,14 @@ BalanceUtilities::recursiveBisectionUniform( bool bad_domain_boundaries_exist = privateBadCutPointsExist(physical_domain); - for (hier::BoxContainer::const_iterator ib(in_boxes); + for (hier::BoxContainer::const_iterator ib = in_boxes.begin(); ib != in_boxes.end(); ++ib) { hier::Box box2chop = *ib; TBOX_ASSERT(!box2chop.empty()); - double boxwork = (double)box2chop.size(); + double boxwork = static_cast(box2chop.size()); if (boxwork <= ((1.0 + workload_tolerance) * ideal_workload)) { @@ -1261,7 +1366,7 @@ BalanceUtilities::recursiveBisectionUniform( } else { - tbox::Array > bad_cut_points(dim.getValue()); + std::vector > bad_cut_points(dim.getValue()); privateInitializeBadCutPointsForBox(bad_cut_points, box2chop, @@ -1269,6 +1374,13 @@ BalanceUtilities::recursiveBisectionUniform( bad_interval, physical_domain); + hier::IntVector box_cut_factor(cut_factor.getDim()); + if (cut_factor.getNumBlocks() == 1) { + box_cut_factor = cut_factor; + } else { + box_cut_factor = cut_factor.getBlockVector(box2chop.getBlockId()); + } + hier::BoxContainer tempboxes; std::list temploads; privateRecursiveBisectionUniformSingleBox( @@ -1279,7 +1391,7 @@ BalanceUtilities::recursiveBisectionUniform( ideal_workload, workload_tolerance, min_size, - cut_factor, + box_cut_factor, bad_cut_points); out_boxes.spliceBack(tempboxes); @@ -1315,7 +1427,7 @@ BalanceUtilities::recursiveBisectionNonuniform( const hier::IntVector& bad_interval, const hier::BoxContainer& physical_domain) { - TBOX_DIM_ASSERT_CHECK_ARGS3(min_size, cut_factor, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY3(min_size, cut_factor, bad_interval); const tbox::Dimension dim(min_size.getDim()); @@ -1324,7 +1436,7 @@ BalanceUtilities::recursiveBisectionNonuniform( TBOX_ASSERT(min_size > hier::IntVector::getZero(dim)); TBOX_ASSERT(cut_factor > hier::IntVector::getZero(dim)); TBOX_ASSERT(bad_interval >= hier::IntVector::getZero(dim)); - TBOX_ASSERT(physical_domain.size() > 0); + TBOX_ASSERT(!physical_domain.empty()); out_boxes.clear(); out_workloads.clear(); @@ -1349,7 +1461,7 @@ BalanceUtilities::recursiveBisectionNonuniform( } else { - tbox::Array > bad_cut_points(dim.getValue()); + std::vector > bad_cut_points(dim.getValue()); privateInitializeBadCutPointsForBox(bad_cut_points, box2chop, @@ -1357,6 +1469,13 @@ BalanceUtilities::recursiveBisectionNonuniform( bad_interval, physical_domain); + hier::IntVector box_cut_factor(cut_factor.getDim()); + if (cut_factor.getNumBlocks() == 1) { + box_cut_factor = cut_factor; + } else { + box_cut_factor = cut_factor.getBlockVector(box2chop.getBlockId()); + } + hier::BoxContainer tempboxes; std::list temploads; privateRecursiveBisectionNonuniformSingleBox( @@ -1369,7 +1488,7 @@ BalanceUtilities::recursiveBisectionNonuniform( ideal_workload, workload_tolerance, min_size, - cut_factor, + box_cut_factor, bad_cut_points); out_boxes.spliceBack(tempboxes); @@ -1384,7 +1503,7 @@ BalanceUtilities::recursiveBisectionNonuniform( ************************************************************************* * * Computes processor layout that corresponds, as closely as possible, - * to the dimensions of the supplied box. + * to the size of the supplied box. * * Inputs: * num_procs - number of processors @@ -1401,14 +1520,14 @@ BalanceUtilities::computeDomainDependentProcessorLayout( int num_procs, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(proc_dist, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(proc_dist, box); const tbox::Dimension& dim(proc_dist.getDim()); - int i; -#ifdef DEBUG_CHECK_ASSERTIONS + tbox::Dimension::dir_t i; TBOX_ASSERT(num_procs > 0); - for (i = 0; i < dim.getValue(); i++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (i = 0; i < dim.getValue(); ++i) { TBOX_ASSERT(box.numberCells(i) > 0); } #endif @@ -1420,17 +1539,17 @@ BalanceUtilities::computeDomainDependentProcessorLayout( * - set proc_dist[] = 1 in each direction * - set pnew[] (recomputed set of primes) initially to p */ - tbox::Array p; + std::vector p; privatePrimeFactorization(num_procs, p); hier::IntVector d = box.numberCells(); - for (i = 0; i < dim.getValue(); i++) { + for (i = 0; i < dim.getValue(); ++i) { proc_dist(i) = 1; } - tbox::Array pnew; - pnew.resizeArray(p.getSize()); - for (i = 0; i < p.getSize(); i++) { + std::vector pnew; + pnew.resize(static_cast(p.size())); + for (i = 0; i < static_cast(p.size()); ++i) { pnew[i] = p[i]; } privateResetPrimesArray(pnew); @@ -1440,24 +1559,24 @@ BalanceUtilities::computeDomainDependentProcessorLayout( * factors until # processors is reached * or we have run out of prime factors. * NOTE: infinite loop conditions occur if no - * box dimensions can be divided by any of the prime factors + * box directions can be divided by any of the prime factors * of num_procs. Adding a counter prevents this condition. */ int counter = 0; while ((proc_dist.getProduct() < num_procs) && - (pnew.getSize() > 0) && (counter < num_procs)) { + (pnew.size() > 0) && (counter < num_procs)) { // Loop over prime factors - largest to smallest - for (int k = pnew.getSize() - 1; k >= 0; k--) { + for (int k = static_cast(pnew.size()) - 1; k >= 0; --k) { // determine i - direction in which d is largest i = 0; int nx = d[i]; - for (int j = 0; j < dim.getValue(); j++) { + for (tbox::Dimension::dir_t j = 0; j < dim.getValue(); ++j) { if (d[j] > nx) i = j; } - // Divide the dimension by the largest possible prime + // Divide the length by the largest possible prime // factor and update processors accordingly. Remove the // chosen prime factor from the prime factors array. if (d[i] % pnew[k] == 0) { @@ -1477,12 +1596,12 @@ BalanceUtilities::computeDomainDependentProcessorLayout( } // loop over prime factors - counter++; + ++counter; } // while loop /* * This routine can fail under certain circumstances, such as - * when no box dimension exactly divides by any of the prime factors. + * when no box direction exactly divides by any of the prime factors. * In this case, revert to the less stringent routine which simply * breaks up the domain into prime factors. */ @@ -1500,7 +1619,7 @@ BalanceUtilities::computeDomainDependentProcessorLayout( * * Computes processor layout that simply uses largest prime factors in * the decomposition. The box is only used to determine the largest - * dimensions in each direction. The processor decomposition will NOT + * size in each direction. The processor decomposition will NOT * necessarily correspond to box dimensions. * ************************************************************************* @@ -1512,14 +1631,14 @@ BalanceUtilities::computeDomainIndependentProcessorLayout( int num_procs, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(proc_dist, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(proc_dist, box); - int i; + tbox::Dimension::dir_t i; const tbox::Dimension& dim(proc_dist.getDim()); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(num_procs > 0); - for (i = 0; i < dim.getValue(); i++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (i = 0; i < dim.getValue(); ++i) { TBOX_ASSERT(box.numberCells(i) > 0); } #endif @@ -1538,17 +1657,17 @@ BalanceUtilities::computeDomainIndependentProcessorLayout( * - set pnew[] (recomputed set of primes) initially to p */ - tbox::Array p; + std::vector p; privatePrimeFactorization(num_procs, p); hier::IntVector d = box.numberCells(); - for (i = 0; i < dim.getValue(); i++) { + for (i = 0; i < dim.getValue(); ++i) { proc_dist(i) = 1; } - tbox::Array pnew; - pnew.resizeArray(p.getSize()); - for (i = 0; i < p.getSize(); i++) pnew[i] = p[i]; + std::vector pnew; + pnew.resize(static_cast(p.size())); + for (i = 0; i < static_cast(p.size()); ++i) pnew[i] = p[i]; privateResetPrimesArray(pnew); /* @@ -1556,18 +1675,17 @@ BalanceUtilities::computeDomainIndependentProcessorLayout( * factors until # processors is reached * or we have run out of prime factors. */ - while ((proc_dist.getProduct() < num_procs) && - (pnew.getSize() > 0)) { + while ((proc_dist.getProduct() < num_procs) && (pnew.size() > 0)) { // determine i - direction in which d is largest i = 0; int nx = d[i]; - for (int j = 0; j < dim.getValue(); j++) { + for (tbox::Dimension::dir_t j = 0; j < dim.getValue(); ++j) { if (d[j] > nx) i = j; } // Set proc_dist(i) to the largest prime factor - int k = pnew.getSize() - 1; + int k = static_cast(pnew.size()) - 1; d[i] = d[i] / pnew[k]; proc_dist[i] = proc_dist[i] * pnew[k]; @@ -1606,18 +1724,18 @@ BalanceUtilities::computeDomainIndependentProcessorLayout( void BalanceUtilities::sortDescendingBoxWorkloads( hier::BoxContainer& boxes, - tbox::Array& workload) + std::vector& workload) { - TBOX_ASSERT(boxes.size() == workload.getSize()); + TBOX_ASSERT(boxes.size() == static_cast(workload.size())); /* * Create the permutation array that represents indices in sorted order */ - const int nboxes = workload.getSize(); - tbox::Array permutation(nboxes); + const int nboxes = static_cast(workload.size()); + std::vector permutation(nboxes); - for (int i = 0; i < nboxes; i++) { + for (int i = 0; i < nboxes; ++i) { permutation[i] = i; } @@ -1625,10 +1743,10 @@ BalanceUtilities::sortDescendingBoxWorkloads( * Execute the heapsort using static member function privateHeapify() */ - for (int j = nboxes / 2 - 1; j >= 0; j--) { + for (int j = nboxes / 2 - 1; j >= 0; --j) { privateHeapify(permutation, workload, j, nboxes); } - for (int k = nboxes - 1; k >= 1; k--) { + for (int k = nboxes - 1; k >= 1; --k) { const int tmp = permutation[0]; permutation[0] = permutation[k]; permutation[k] = tmp; @@ -1641,11 +1759,11 @@ BalanceUtilities::sortDescendingBoxWorkloads( if (nboxes > 0) { const tbox::Dimension& dim(boxes.front().getDim()); - tbox::Array unsorted_boxes(nboxes, hier::Box(dim)); - tbox::Array unsorted_workload(nboxes); + std::vector unsorted_boxes(nboxes, hier::Box(dim)); + std::vector unsorted_workload(nboxes); int l = 0; - for (hier::BoxContainer::iterator itr(boxes); + for (hier::BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { unsorted_boxes[l] = *itr; unsorted_workload[l] = workload[l]; @@ -1653,7 +1771,7 @@ BalanceUtilities::sortDescendingBoxWorkloads( } int m = 0; - for (hier::BoxContainer::iterator itr(boxes); + for (hier::BoxContainer::iterator itr = boxes.begin(); itr != boxes.end(); ++itr) { *itr = unsorted_boxes[permutation[m]]; workload[m] = unsorted_workload[permutation[m]]; @@ -1665,7 +1783,7 @@ BalanceUtilities::sortDescendingBoxWorkloads( * Verify that the workload is sorted in nonincreasing order */ - for (int n = 0; n < nboxes - 1; n++) { + for (int n = 0; n < nboxes - 1; ++n) { TBOX_ASSERT(workload[n] >= workload[n + 1]); } #endif @@ -1696,9 +1814,9 @@ BalanceUtilities::computeLoadBalanceEfficiency( const hier::ProcessorMapping& mapping = level->getProcessorMapping(); const int nprocs = mpi.getSize(); - tbox::Array work(nprocs); + std::vector work(nprocs); - for (i = 0; i < nprocs; i++) { + for (i = 0; i < nprocs; ++i) { work[i] = 0.0; } @@ -1707,7 +1825,7 @@ BalanceUtilities::computeLoadBalanceEfficiency( for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { work[mapping.getProcessorAssignment(ip->getLocalId().getValue())] += - (*ip)->getBox().size(); + static_cast((*ip)->getBox().size()); } } else { @@ -1716,8 +1834,10 @@ BalanceUtilities::computeLoadBalanceEfficiency( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > weight( - patch->getPatchData(workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(workload_data_id))); + + TBOX_ASSERT(weight); work[mapping.getProcessorAssignment(ip->getLocalId().getValue())] += s_norm_ops.L1Norm(weight, patch->getBox()); @@ -1726,12 +1846,12 @@ BalanceUtilities::computeLoadBalanceEfficiency( } if (mpi.getSize() > 1) { - mpi.AllReduce(work.getPointer(), 1, MPI_SUM); + mpi.AllReduce(&work[0], 1, MPI_SUM); } double max_work = 0.0; double total_work = 0.0; - for (i = 0; i < nprocs; i++) { + for (i = 0; i < nprocs; ++i) { total_work += work[i]; if (work[i] > max_work) max_work = work[i]; } @@ -1742,84 +1862,133 @@ BalanceUtilities::computeLoadBalanceEfficiency( } - - /* ************************************************************************* - * Gather and report load balance for a single balancing. ************************************************************************* */ + void -BalanceUtilities::gatherAndReportLoadBalance( - double local_load, - const tbox::SAMRAI_MPI& mpi, - std::ostream& os) +BalanceUtilities::findSmallBoxesInPostbalance( + std::ostream& co, + const std::string& border, + const hier::MappingConnector& post_to_pre, + const hier::IntVector& min_width, + size_t min_cells) { - int nproc = mpi.getSize(); - std::vector workloads(nproc); - if (mpi.getSize() > 1) { - mpi.Allgather(&local_load, - 1, - MPI_DOUBLE, - &workloads[0], - 1, - MPI_DOUBLE); - } else { - workloads[0] = local_load; + const hier::BoxLevel& post = post_to_pre.getBase(); + const hier::BoxContainer& post_boxes = post.getBoxes(); + + int local_new_min_count = 0; + for (hier::BoxContainer::const_iterator bi = post_boxes.begin(); bi != post_boxes.end(); ++bi) { + + const hier::Box& post_box = *bi; + + if (post_box.numberCells() >= min_width && static_cast(post_box.size()) >= + min_cells) { + continue; + } + + if (post_to_pre.hasNeighborSet(post_box.getBoxId())) { + hier::BoxContainer pre_neighbors; + post_to_pre.getLocalNeighbors(pre_neighbors); + + bool small_width = true; + bool small_cells = true; + for (hier::BoxContainer::const_iterator na = pre_neighbors.begin(); + na != pre_neighbors.end(); ++na) { + if (!(na->numberCells() >= min_width)) { + small_width = false; + } + if (!(static_cast(na->size()) >= min_cells)) { + small_cells = false; + } + } + if (small_width || small_cells) { + ++local_new_min_count; + co << border << "Post-box small_width=" << small_width + << " small_cells=" << small_cells + << ": " << post_box + << post_box.numberCells() << '|' << post_box.size() + << " from " << pre_neighbors.format(border, 2); + } + + } + } - reportLoadBalance(workloads, os); -} + int global_new_min_count = local_new_min_count; + post.getMPI().AllReduce(&global_new_min_count, 1, MPI_SUM); + co << border + << " Total of " << local_new_min_count << " / " + << global_new_min_count << " new minimums." << std::endl; +} /* ************************************************************************* - * Gather and report load balance for multiple balancings. ************************************************************************* */ + void -BalanceUtilities::gatherAndReportLoadBalance( - const std::vector& local_loads, - const tbox::SAMRAI_MPI& mpi, - std::ostream& os) +BalanceUtilities::findSmallBoxesInPostbalance( + std::ostream& co, + const std::string& border, + const hier::BoxLevel& post, + const hier::BoxLevel& pre, + const hier::IntVector& min_width, + size_t min_cells) { - if (mpi.getSize() > 1) { - int nproc = mpi.getSize(); - std::vector mutable_local_loads(local_loads); - std::vector global_workloads(nproc * local_loads.size()); - mpi.Allgather(&mutable_local_loads[0], - static_cast(local_loads.size()), - MPI_DOUBLE, - &global_workloads[0], - static_cast(local_loads.size()), - MPI_DOUBLE); - std::vector workloads_at_seq_i(nproc); - for (size_t i = 0; i < local_loads.size(); ++i) { - for (int n = 0; n < nproc; ++n) { - workloads_at_seq_i[n] = global_workloads[i + n * local_loads.size()]; - } - os << "================ Sequence " << i << " ===============\n"; - reportLoadBalance(workloads_at_seq_i, os); - } - } else { - std::vector workloads(1); - workloads[0] = local_loads[0]; - reportLoadBalance(workloads, os); - } + hier::MappingConnector post_to_pre(post, pre, hier::IntVector::getZero(post.getDim())); + hier::OverlapConnectorAlgorithm oca; + oca.findOverlaps(post_to_pre); + findSmallBoxesInPostbalance(co, border, post_to_pre, min_width, min_cells); } +/* + ************************************************************************* + ************************************************************************* + */ + +bool +BalanceUtilities::compareLoads( + int flags[], + double cur_load, + double new_load, + double ideal_load, + double low_load, + double high_load, + const PartitioningParams& pparams) +{ + double cur_range_miss = cur_load >= high_load ? cur_load - high_load : + (cur_load <= low_load ? low_load - cur_load : 0.0); + double new_range_miss = new_load >= high_load ? new_load - high_load : + (new_load <= low_load ? low_load - new_load : 0.0); + flags[0] = new_range_miss < (cur_range_miss - pparams.getLoadComparisonTol()) ? 1 : + (new_range_miss > cur_range_miss ? -1 : 0); + + double cur_diff = tbox::MathUtilities::Abs(cur_load - ideal_load); + double new_diff = tbox::MathUtilities::Abs(new_load - ideal_load); + + flags[1] = new_diff < (cur_diff - pparams.getLoadComparisonTol()) ? 1 : + (new_diff > cur_diff ? -1 : 0); + + flags[2] = flags[0] != 0 ? flags[0] : (flags[1] != 0 ? flags[1] : 0); + + flags[3] = (new_load <= high_load && new_load >= low_load); + return flags[2] == 1; +} /* ************************************************************************* ************************************************************************* */ void -BalanceUtilities::reportLoadBalance( - const std::vector& workloads, +BalanceUtilities::reduceAndReportLoadBalance( + const std::vector& loads, + const tbox::SAMRAI_MPI& mpi, std::ostream& os) { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); const double demarks[] = { 0.50, @@ -1835,78 +2004,82 @@ BalanceUtilities::reportLoadBalance( 2.00 }; const int ndemarks = 11; - TBOX_ASSERT((int)workloads.size() == nproc); + // Compute total, avg, min and max loads. - RankAndLoad* rank_and_load = new RankAndLoad[nproc]; + std::vector min_loads(loads); + std::vector min_ranks(loads.size()); + mpi.AllReduce(&min_loads[0], static_cast(min_loads.size()), MPI_MINLOC, &min_ranks[0]); - double total_load = 0.0; + std::vector max_loads(loads); + std::vector max_ranks(loads.size()); + mpi.AllReduce(&max_loads[0], static_cast(max_loads.size()), MPI_MAXLOC, &max_ranks[0]); - for (int i = 0; i < nproc; ++i) { - rank_and_load[i].rank = i; - rank_and_load[i].load = workloads[i]; - total_load += workloads[i]; + std::vector total_loads(loads); + mpi.AllReduce(&total_loads[0], static_cast(total_loads.size()), MPI_SUM); + + const int n_population_zones = ndemarks + 1; + std::vector population(loads.size() * n_population_zones, 0); + for (size_t iload = 0; iload < loads.size(); ++iload) { + int izone; + for (izone = 0; izone < ndemarks; ++izone) { + if (loads[iload] / total_loads[iload] * mpi.getSize() < demarks[izone]) { + break; + } + } + population[iload * n_population_zones + izone] = 1; } - qsort((void *)rank_and_load, - nproc, - sizeof(RankAndLoad), - qsortRankAndLoadCompareAscending); + mpi.AllReduce(&population[0], static_cast(population.size()), MPI_SUM); - const double avg_load = total_load / nproc; - const double min_load = rank_and_load[0].load; - const int r_min_load = rank_and_load[0].rank; - const double max_load = rank_and_load[nproc - 1].load; - const int r_max_load = rank_and_load[nproc - 1].rank; + for (size_t iload = 0; iload < loads.size(); ++iload) { - os << "total/avg loads: " - << total_load << " / " - << avg_load << "\n"; + const double total_load = total_loads[iload]; + const double avg_load = total_loads[iload] / mpi.getSize(); + const double min_load = min_loads[iload]; + const int r_min_load = min_ranks[iload]; + const double max_load = max_loads[iload]; + const int r_max_load = max_ranks[iload]; + + os << "================ Sequence " << iload << " ===============\n"; + os << "total/avg loads: " + << total_load << " / " + << avg_load << "\n"; #ifdef __INTEL_COMPILER #pragma warning (disable:1572) #endif - os << std::setprecision(2) - << "min/max loads: " - << min_load << " @ P" << r_min_load << " / " - << max_load << " @ P" << r_max_load << " " - << "diffs: " - << min_load - avg_load << " / " - << max_load - avg_load << " " - << std::setprecision(3) - << "normalized: " - << (avg_load != 0 ? min_load / avg_load : 0.0) << " / " - << (avg_load != 0 ? max_load / avg_load : 0.0) << "\n"; - - const char bars[] = "----"; - const char space[] = " "; - os.setf(std::ios_base::fixed); - os << bars; - for (int n = 0; n < ndemarks; ++n) { - os << std::setw(4) << std::setprecision(2) << demarks[n] << bars; - } - os << '\n'; - - double population; - int irank = 0; + os << std::setprecision(6) + << "min/max loads: " + << min_load << " @ P" << r_min_load << " / " + << max_load << " @ P" << r_max_load << " " + << "diffs: " + << min_load - avg_load << " / " + << max_load - avg_load << " " + << std::setprecision(4) + << "normalized: " + << (avg_load != 0 ? min_load / avg_load : 0.0) << " / " + << (avg_load != 0 ? max_load / avg_load : 0.0) << "\n"; + + const char bars[] = "----"; + const char space[] = " "; + os.setf(std::ios_base::fixed); + os << bars; + for (int izone = 0; izone < ndemarks; ++izone) { + os << std::setw(4) << std::setprecision(2) << demarks[izone] << bars; + } + os << '\n'; + #ifdef __INTEL_COMPILER #pragma warning (disable:1572) #endif - for (int n = 0; n < ndemarks; ++n) { - double top = demarks[n]; - int old_irank = irank; - for ( ; irank < nproc; ++irank) - if (avg_load == 0 || - rank_and_load[irank].load / avg_load > top) break; - int nrank = irank - old_irank; - population = 100.0 * nrank / nproc; - os << std::setw(5) << population << space; - } - population = 100.0 * (nproc - irank) / nproc; - os << population << space; - os << '\n'; - - delete[] rank_and_load; -} + for (int izone = 0; izone < n_population_zones; ++izone) { + const int nrank = population[iload * n_population_zones + izone]; + const double percentage = 100.0 * nrank / nproc; + os << std::setw(5) << percentage << space; + } + os << '\n'; + } +} /* ************************************************************************* @@ -1931,8 +2104,6 @@ BalanceUtilities::qsortRankAndLoadCompareDescending( return 0; } - - /* ************************************************************************* * for use when sorting loads using the C-library qsort @@ -1956,6 +2127,418 @@ BalanceUtilities::qsortRankAndLoadCompareAscending( return 0; } +/* + ************************************************************************* + * Constrain maximum box sizes in the given BoxLevel and + * update given Connectors to the changed BoxLevel. + ************************************************************************* + */ +void +BalanceUtilities::constrainMaxBoxSizes( + hier::BoxLevel& box_level, + hier::Connector* anchor_to_level, + const PartitioningParams& pparams) +{ + TBOX_ASSERT(!anchor_to_level || anchor_to_level->hasTranspose()); + + const hier::IntVector& zero_vector(hier::IntVector::getZero(box_level.getDim())); + + hier::BoxLevel constrained(box_level.getRefinementRatio(), + box_level.getGridGeometry(), + box_level.getMPI()); + hier::MappingConnector unconstrained_to_constrained(box_level, + constrained, + zero_vector); + + const hier::BoxContainer& unconstrained_boxes = box_level.getBoxes(); + + hier::LocalId next_available_index = box_level.getLastLocalId() + 1; + + for (hier::BoxContainer::const_iterator ni = unconstrained_boxes.begin(); + ni != unconstrained_boxes.end(); ++ni) { + + const hier::Box& box = *ni; + + const hier::IntVector box_size = box.numberCells(); + + /* + * If box already conform to max size constraint, keep it. + * Else chop it up and keep the parts. + */ + + if (box_size <= pparams.getMaxBoxSize()) { + + constrained.addBox(box); + + } else { + + hier::BoxContainer chopped(box); + hier::BoxUtilities::chopBoxes( + chopped, + pparams.getMaxBoxSize(), + pparams.getMinBoxSize(), + pparams.getCutFactor(), + pparams.getBadInterval(), + pparams.getDomainBoxes(box.getBlockId())); + TBOX_ASSERT(!chopped.empty()); + + if (chopped.size() != 1) { + + hier::Connector::NeighborhoodIterator base_box_itr = + unconstrained_to_constrained.makeEmptyLocalNeighborhood( + box.getBoxId()); + + for (hier::BoxContainer::iterator li = chopped.begin(); + li != chopped.end(); ++li) { + + const hier::Box fragment = *li; + + const hier::Box new_box(fragment, + next_available_index++, + box_level.getMPI().getRank()); + TBOX_ASSERT(new_box.getBlockId() == ni->getBlockId()); + + constrained.addBox(new_box); + + unconstrained_to_constrained.insertLocalNeighbor( + new_box, + base_box_itr); + + } + + } else { + TBOX_ASSERT(box.isSpatiallyEqual(chopped.front())); + constrained.addBox(box); + } + + } + + } + + if (anchor_to_level && anchor_to_level->isFinalized()) { + // Modify anchor<==>level Connectors and swap box_level with constrained. + hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix("mesh::BalanceUtilities"); + mca.modify(*anchor_to_level, + unconstrained_to_constrained, + &box_level, + &constrained); + } else { + // Swap box_level and constrained without touching anchor<==>level. + hier::BoxLevel::swap(box_level, constrained); + } + +} + +/* + ************************************************************************** + * Move Boxes in balance_box_level from ranks outside of + * rank_group to ranks inside rank_group. Modify the given connectors + * to make them correct following this moving of boxes. + ************************************************************************** + */ + +void +BalanceUtilities::prebalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, + const tbox::RankGroup& rank_group) +{ + + if (balance_to_anchor) { + TBOX_ASSERT(balance_to_anchor->hasTranspose()); + TBOX_ASSERT(balance_to_anchor->getTranspose().checkTransposeCorrectness( + *balance_to_anchor) == 0); + TBOX_ASSERT(balance_to_anchor->checkTransposeCorrectness( + balance_to_anchor->getTranspose()) == 0); + } + + /* + * tmp_box_level will contain the same boxes as + * balance_box_level, but all will live on the processors + * specified in rank_group. + */ + hier::BoxLevel tmp_box_level(balance_box_level.getRefinementRatio(), + balance_box_level.getGridGeometry(), + balance_box_level.getMPI()); + + /* + * If a rank is not in rank_group it is called a "sending" rank, as + * it will send any Boxes it has to a rank in rank_group. + */ + bool is_sending_rank = rank_group.isMember(balance_box_level.getMPI().getRank()) ? false : true; + + int output_nproc = rank_group.size(); + + /* + * the send and receive comm objects + */ + tbox::AsyncCommStage comm_stage; + tbox::AsyncCommPeer* box_send = 0; + tbox::AsyncCommPeer* box_recv = 0; + tbox::AsyncCommPeer* id_send = 0; + tbox::AsyncCommPeer* id_recv = 0; + + /* + * A sending rank will send its Boxes to a receiving rank, and + * that receiving processor will add it to its local set of Boxes. + * When the box is added on the receiving processor, it will receive + * a new LocalId. This LocalId value needs to be sent back to + * the sending processor, in order to construct the mapping connectors. + * + * Therefore the sending ranks construct comm objects for sending boxes + * and receiving LocalIdes. + * + * Sending processors send to ranks in the rank_group determined by + * a modulo heuristic. + */ + if (is_sending_rank) { + box_send = new tbox::AsyncCommPeer; + box_send->initialize(&comm_stage); + box_send->setPeerRank(rank_group.getMappedRank(balance_box_level.getMPI().getRank() + % output_nproc)); + box_send->setMPI(balance_box_level.getMPI()); + box_send->setMPITag(BalanceUtilities_PREBALANCE0 + 2 * balance_box_level.getMPI().getRank(), + BalanceUtilities_PREBALANCE1 + 2 * balance_box_level.getMPI().getRank()); + + id_recv = new tbox::AsyncCommPeer; + id_recv->initialize(&comm_stage); + id_recv->setPeerRank(rank_group.getMappedRank(balance_box_level.getMPI().getRank() + % output_nproc)); + id_recv->setMPI(balance_box_level.getMPI()); + id_recv->setMPITag(BalanceUtilities_PREBALANCE0 + 2 * balance_box_level.getMPI().getRank(), + BalanceUtilities_PREBALANCE1 + 2 * balance_box_level.getMPI().getRank()); + } + + /* + * The receiving ranks construct comm objects for receiving boxes + * and sending LocalIdes. + */ + int num_recvs = 0; + if (rank_group.isMember(balance_box_level.getMPI().getRank())) { + std::list recv_ranks; + for (int i = 0; i < balance_box_level.getMPI().getSize(); ++i) { + if (!rank_group.isMember(i) && + rank_group.getMappedRank(i % output_nproc) == balance_box_level.getMPI().getRank()) { + recv_ranks.push_back(i); + } + } + num_recvs = static_cast(recv_ranks.size()); + if (num_recvs > 0) { + box_recv = new tbox::AsyncCommPeer[num_recvs]; + id_send = new tbox::AsyncCommPeer[num_recvs]; + int recv_count = 0; + for (std::list::const_iterator ri(recv_ranks.begin()); + ri != recv_ranks.end(); ++ri) { + const int rank = *ri; + box_recv[recv_count].initialize(&comm_stage); + box_recv[recv_count].setPeerRank(rank); + box_recv[recv_count].setMPI(balance_box_level.getMPI()); + box_recv[recv_count].setMPITag(BalanceUtilities_PREBALANCE0 + 2 * rank, + BalanceUtilities_PREBALANCE1 + 2 * rank); + + id_send[recv_count].initialize(&comm_stage); + id_send[recv_count].setPeerRank(rank); + id_send[recv_count].setMPI(balance_box_level.getMPI()); + id_send[recv_count].setMPITag(BalanceUtilities_PREBALANCE0 + 2 * rank, + BalanceUtilities_PREBALANCE1 + 2 * rank); + + ++recv_count; + } + TBOX_ASSERT(num_recvs == recv_count); + } + } + + /* + * Construct the mapping Connectors which describe the mapping from the box + * configuration of the given balance_box_level, to the new + * configuration stored in tmp_box_level. These mapping Connectors + * are necessary to modify the two Connectors given in the argument list, + * so that on return from this method, they will be correct for the new + * balance_box_level. + */ + const hier::IntVector& zero_vector(hier::IntVector::getZero(balance_box_level.getDim())); + hier::MappingConnector balance_to_tmp( + balance_box_level, + tmp_box_level, + zero_vector); + + hier::MappingConnector tmp_to_balance( + tmp_box_level, + balance_box_level, + zero_vector); + + balance_to_tmp.setTranspose(&tmp_to_balance, false); + + /* + * Where Boxes already exist on ranks in rank_group, + * move them directly to tmp_box_level. + */ + if (!is_sending_rank) { + const hier::BoxContainer& unchanged_boxes = + balance_box_level.getBoxes(); + + for (hier::BoxContainer::const_iterator ni = unchanged_boxes.begin(); + ni != unchanged_boxes.end(); ++ni) { + + const hier::Box& box = *ni; + tmp_box_level.addBox(box); + } + } + + const int buf_size = hier::Box::commBufferSize(balance_box_level.getDim()); + + /* + * On sending ranks, pack the Boxes into buffers and send. + */ + if (is_sending_rank) { + const hier::BoxContainer& sending_boxes = + balance_box_level.getBoxes(); + const int num_sending_boxes = + static_cast(sending_boxes.size()); + + int* buffer = 0; + if (num_sending_boxes > 0) { + buffer = new int[buf_size * num_sending_boxes]; + } + int box_count = 0; + for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); + ni != sending_boxes.end(); ++ni) { + + const hier::Box& box = *ni; + + box.putToIntBuffer(&buffer[box_count * buf_size]); + ++box_count; + } + box_send->beginSend(buffer, buf_size * num_sending_boxes); + + if (buffer) { + delete[] buffer; + } + } + + /* + * On receiving ranks, complete the receives, add the boxes to local + * tmp_box_level, insert boxes into tmp_to_balance, and then + * send the new LocalIdes back to the sending processors. + */ + if (!is_sending_rank && num_recvs > 0) { + for (int i = 0; i < num_recvs; ++i) { + box_recv[i].beginRecv(); + } + int num_completed_recvs = 0; + std::vector completed(num_recvs, false); + while (num_completed_recvs < num_recvs) { + for (int i = 0; i < num_recvs; ++i) { + if (!completed[i] && box_recv[i].checkRecv()) { + ++num_completed_recvs; + completed[i] = true; + const int num_boxes = box_recv[i].getRecvSize() / buf_size; + const int* buffer = box_recv[i].getRecvData(); + int* id_buffer = 0; + if (num_boxes > 0) { + id_buffer = new int[num_boxes]; + } + + for (int b = 0; b < num_boxes; ++b) { + hier::Box box(balance_box_level.getDim()); + + box.getFromIntBuffer(&buffer[b * buf_size]); + + hier::BoxContainer::const_iterator tmp_iter = + tmp_box_level.addBox(box, + box.getBlockId()); + + hier::BoxId tmp_box_id = tmp_iter->getBoxId(); + + tmp_to_balance.insertLocalNeighbor(box, tmp_box_id); + + id_buffer[b] = tmp_box_id.getLocalId().getValue(); + } + id_send[i].beginSend(id_buffer, num_boxes); + + if (id_buffer) { + delete[] id_buffer; + } + } + } + } + for (int i = 0; i < num_recvs; ++i) { + if (!id_send[i].checkSend()) { + id_send[i].completeCurrentOperation(); + } + } + } + + /* + * On sending ranks, receive the LocalIds, and add the edges + * to balance_to_tmp. + */ + if (is_sending_rank) { + if (!box_send->checkSend()) { + box_send->completeCurrentOperation(); + } + + id_recv->beginRecv(); + + if (!id_recv->checkRecv()) { + id_recv->completeCurrentOperation(); + } + const int* buffer = id_recv->getRecvData(); + + const hier::BoxContainer& sending_boxes = + balance_box_level.getBoxes(); + TBOX_ASSERT(static_cast(id_recv->getRecvSize()) == sending_boxes.size()); + + int box_count = 0; + for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); + ni != sending_boxes.end(); ++ni) { + + hier::Box new_box( + *ni, + (hier::LocalId)buffer[box_count], + rank_group.getMappedRank(balance_box_level.getMPI().getRank() % output_nproc)); + + balance_to_tmp.insertLocalNeighbor(new_box, (*ni).getBoxId()); + ++box_count; + } + } + + if (balance_to_anchor && balance_to_anchor->hasTranspose()) { + /* + * This modify operation copies tmp_box_level to + * balance_box_level, and changes balance_to_anchor and + * its transpose such that they are correct for the new state + * of balance_box_level. + */ + hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix("mesh::BalanceUtilities"); + mca.modify(balance_to_anchor->getTranspose(), + balance_to_tmp, + &balance_box_level, + &tmp_box_level); + + TBOX_ASSERT(balance_to_anchor->getTranspose().checkTransposeCorrectness( + *balance_to_anchor) == 0); + TBOX_ASSERT(balance_to_anchor->checkTransposeCorrectness( + balance_to_anchor->getTranspose()) == 0); + } else { + hier::BoxLevel::swap(balance_box_level, tmp_box_level); + } + + /* + * Clean up raw pointer allocation. + */ + if (is_sending_rank) { + delete box_send; + delete id_recv; + } + if (num_recvs) { + delete[] box_recv; + delete[] id_send; + } +} + } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.h index 90b088bc..61b1df10 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BalanceUtilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: utility routines useful for load balancing operations * ************************************************************************/ @@ -14,13 +14,18 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/BaseGridGeometry.h" +#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/MappingConnector.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/ProcessorMapping.h" #include "SAMRAI/math/PatchCellDataNormOpsReal.h" +#include "SAMRAI/mesh/PartitioningParams.h" #include "SAMRAI/mesh/SpatialKey.h" +#include "SAMRAI/tbox/RankGroup.h" #include #include +#include namespace SAMRAI { namespace mesh { @@ -42,13 +47,16 @@ struct BalanceUtilities { * (ranges from zero to one hundred percent) * * @param mapping Output processor mapping. - * @param weights tbox::Array of double-valued weights to distribute. + * @param weights std::vector of double-valued weights to distribute. * @param nproc Integer number of processors, must be > 0. + * + * @pre nproc > 0 + * @pre for each memeber of weights, w, w >=0 */ static double binPack( hier::ProcessorMapping& mapping, - tbox::Array& weights, + std::vector& weights, int nproc); /*! @@ -66,16 +74,17 @@ struct BalanceUtilities { * (ranges from zero to one hundred percent) * * @param mapping Output processor mapping. - * @param weights tbox::Array of double-valued box weights to distribute. - * @param boxes tbox::Array of boxes to distribute to processors. + * @param weights std::vector of double-valued box weights to distribute. + * @param boxes hier::BoxContainer of boxes to distribute to processors. * @param nproc Integer number of processors, must be > 0. * - * Note that the wight and box arrrays must be the same size. + * @pre nproc > 0 + * @pre weights.size() == boxes.size() */ static double spatialBinPack( hier::ProcessorMapping& mapping, - tbox::Array& weights, + std::vector& weights, hier::BoxContainer& boxes, const int nproc); @@ -93,11 +102,11 @@ struct BalanceUtilities { * @param in_boxes Input boxlist for chopping. * @param ideal_workload Input double ideal box workload, must be > 0. * @param workload_tolerance Input double workload tolerance, must be >= 0 and < 1.0 - * @param min_size Input integer vector of minimum dimensions for + * @param min_size Input integer vector of minimum sizes for * output boxes. All entries must be > 0. * @param cut_factor Input integer vector used to create boxes with - * correct dimensions. The length of each box - * dimension will be an integer multiple of the + * correct sizes. The box size in each + * direction will be an integer multiple of the * corresponding cut factor vector entry. All * vector entries must be > 0. See hier::BoxUtilities * documentation for more details. @@ -115,9 +124,18 @@ struct BalanceUtilities { * will be either in the domain interior or outside * the domain. All entries must be >= 0. See * hier::BoxUtilities documentation for more details. - * @param physical_domain tbox::Array of boxes describing the physical extent of - * the index space associated with the in_boxes. - * This box array cannot be empty. + * @param physical_domain hier::BoxContainer of boxes describing the + * physical extent of the index space associated with + * the in_boxes. This box array cannot be empty. + * + * @pre (min_size.getDim() == cut_factor.getDim()) && + * (min_size.getDim() == bad_interval.getDim()) + * @pre ideal_workload > 0 + * @pre (workload_tolerance >= 0) && (workload_tolerance < 1.0) + * @pre min_size > hier::IntVector::getZero(min_size.getDim()) + * @pre cut_factor > hier::IntVector::getZero(min_size.getDim()) + * @pre bad_interval >= hier::IntVector::getZero(min_size.getDim()) + * @pre !physical_domain.empty() */ static void recursiveBisectionUniform( @@ -150,11 +168,11 @@ struct BalanceUtilities { * double work estimate for each cell. * @param ideal_workload Input double ideal box workload, must be > 0. * @param workload_tolerance Input double workload tolerance, must be >= 0 and < 1.0 - * @param min_size Input integer vector of minimum dimensions for + * @param min_size Input integer vector of minimum sizes for * output boxes. All entries must be > 0. * @param cut_factor Input integer vector used to create boxes with - * correct dimensions. The length of each box - * dimension will be an integer multiple of the + * correct sizes. The box size in each + * direction will be an integer multiple of the * corresponding cut factor vector entry. All * vector entries must be > 0. See hier::BoxUtilities * documentation for more details. @@ -172,9 +190,18 @@ struct BalanceUtilities { * will be either in the domain interior or outside * the domain. All entries must be >= 0. See * hier::BoxUtilities documentation for more details. - * @param physical_domain tbox::Array of boxes describing the physical extent of - * the index space associated with the in_boxes. - * This box array cannot be empty. + * @param physical_domain hier::BoxContainer of boxes describing the + * physical extent of the index space associated with + * the in_boxes. This box array cannot be empty. + * + * @pre (min_size.getDim() == cut_factor.getDim()) && + * (min_size.getDim() == bad_interval.getDim()) + * @pre ideal_workload > 0 + * @pre (workload_tolerance >= 0) && (workload_tolerance < 1.0) + * @pre min_size > hier::IntVector::getZero(min_size.getDim()) + * @pre cut_factor > hier::IntVector::getZero(min_size.getDim()) + * @pre bad_interval >= hier::IntVector::getZero(min_size.getDim()) + * @pre !physical_domain.empty() */ static void recursiveBisectionNonuniform( @@ -191,12 +218,16 @@ struct BalanceUtilities { /*! * Compute factorization of processors corresponding to - * dimensions of given box. + * size of given box. * * @param proc_dist Output number of processors for each * coordinate direction. * @param num_procs Input integer number of processors, must be > 0. * @param box Input box to be distributed. + * + * @pre proc_dist.getDim() == box.getDim() + * @pre num_procs > 0 + * @pre for each dimension, i, box.numberCells(i) > 0 */ static void computeDomainDependentProcessorLayout( @@ -216,6 +247,10 @@ struct BalanceUtilities { * coordinate direction. * @param num_procs Input integer number of processors, must be > 0. * @param box Input box to be distributed. + * + * @pre proc_dist.getDim() == box.getDim() + * @pre num_procs > 0 + * @pre for each dimension, i, box.numberCells(i) > 0 */ static void computeDomainIndependentProcessorLayout( @@ -234,12 +269,12 @@ struct BalanceUtilities { * @param boxes Boxes to be sorted based on workload array. * @param workload Workloads to use for sorting boxes. * - * Note that both arrays must be the same size. + * @pre boxes.size() == workload.size() */ static void sortDescendingBoxWorkloads( hier::BoxContainer& boxes, - tbox::Array& workload); + std::vector& workload); /*! * Compute total workload in region of argument box based on patch @@ -247,13 +282,16 @@ struct BalanceUtilities { * intersection of argument box and box over which data associated with * workload is defined. * - * @return Double-valued sum of workload values in box region. + * @return Sum of workload values in box region. * * @param patch Input patch on which workload data is defined. * @param wrk_indx Input integer patch data identifier for work data. * @param box Input box region * * Note that wrk_indx must refer to a valid cell-centered patch data entry. + * + * @pre patch + * @pre patch->getDim() == box.getDim() */ static double computeNonUniformWorkload( @@ -261,6 +299,113 @@ struct BalanceUtilities { int wrk_indx, const hier::Box& box); + /*! + * @brief Compute total workload in region of argument box based on patch + * data defined by given integer index, while also associating weights with + * corners of the box. + * + * The corner weights are fractional values that identify how much of the + * workload is located in each quadrant or octant of the box. + * + * @return Sum of workload values in the box. + * + * @param[out] corner_weights Fraction of weights associated with + * each corner of the patch. Vector must be + * empty on input. + * @param[in] patch Patch on which workload data is defined. + * @param[in] wrk_indx Patch data identifier for work data. + * @param[in] box Box on which workload is computed + * + * @pre box.getBlockId() == patch->getBox().getBlockId() + * @pre box.isSpatiallyEqual(box * patch->getBox()) + */ + static double + computeNonUniformWorkloadOnCorners( + std::vector& corner_weights, + const boost::shared_ptr& patch, + int wrk_indx, + const hier::Box& box); + + /*! + * @brief Find small boxes in a post-balance BoxLevel that are not + * in a pre-balance BoxLevel. + * + * @param co Stream to report findings + * + * @param border Left border in report output + * + * @param [in] post_to_pre + * + * @param [in] min_width Report post-balance boxes smaller than + * min_width in any direction. + * + * @param [in] min_vol Report post-balance boxes with fewer cells + * than this. + */ + static void + findSmallBoxesInPostbalance( + std::ostream& co, + const std::string& border, + const hier::MappingConnector& post_to_pre, + const hier::IntVector& min_width, + size_t min_vol); + + /*! + * @brief Find small boxes in a post-balance BoxLevel that are not + * in a pre-balance BoxLevel. + * + * This method does not scale. It acquires and processes + * globalized data. + * + * @param co Stream to report findings + * + * @param border Left border in report output + * + * @param [in] pre Pre-balance BoxLevel + * + * @param [in] post Post-balance BoxLevel + * + * @param [in] min_width Report post-balance boxes smaller than + * min_width in any direction. + * + * @param [in] min_vol Report post-balance boxes with fewer cells + * than this. + */ + static void + findSmallBoxesInPostbalance( + std::ostream& co, + const std::string& border, + const hier::BoxLevel& pre, + const hier::BoxLevel& post, + const hier::IntVector& min_width, + size_t min_vol); + + /*! + * @brief Evaluate whether a new load is an improvement over a + * current load based on their proximity to an ideal value or range + * of acceptable values. + * + * There is a slight bias toward current load. The new_load is better + * only if it improves by at least pparams.getLoadComparisonTol(). + * + * Return values in flags: + * - [0]: -1, 0 or 1: degrades, leave-alone or improves in-range + * - [1]: -1, 0 or 1: degrades, leave-alone or improves balance + * - [2]: -1, 0 or 1: degrades, leave-alone or improves overall + * - [3]: 0 or 1: whether new_load is within the range of [low, high] + * + * Return whether new_load is an improvement over current_load. + */ + static bool + compareLoads( + int flags[], + double current_load, + double new_load, + double ideal_load, + double low_load, + double high_load, + const PartitioningParams &pparams); + /*! * Compute and return load balance efficiency for a level. * @@ -273,6 +418,8 @@ struct BalanceUtilities { * @param workload_data_id (Optional) Input integer id for workload * data on level. If no value is given, the * calculation assumes spatially-uniform load. + * + * @pre level */ static double computeLoadBalanceEfficiency( @@ -285,34 +432,14 @@ struct BalanceUtilities { //! @name Load balance reporting. /*! - * @brief Gather workloads in an MPI group and write out a summary - * of load balance efficiency. - * - * To be used for performance evaluation. Not recommended for general use. - * - * @param[in] local_workload Workload of the local process - * - * @param[in] mpi Represents all processes involved in the load balancing. - * - * @param[in] output_stream - * - * TODO: This method is a utility that doesn't strictly belong in a - * strategy design pattern. It should be moved elsewhere. - */ - static void - gatherAndReportLoadBalance( - double local_workload, - const tbox::SAMRAI_MPI& mpi, - std::ostream& output_stream = tbox::plog); - - /*! - * @brief Gather a sequence of workloads in an MPI group and write - * out a summary of load balance efficiency. + * @brief Globally reduce a sequence of workloads in an MPI group + * and write out a summary of load balance efficiency. * * Each value in the sequence of workloads represent a certain load * the local process had over a sequence of load balancings. * - * To be used for performance evaluation. Not recommended for general use. + * To be used for performance evaluation. Not recommended for + * general use. * * @param[in] local_loads Sequence of workloads of the local * process. The size of @c local_loads is the number times load @@ -324,32 +451,44 @@ struct BalanceUtilities { * @param[in] output_stream */ static void - gatherAndReportLoadBalance( + reduceAndReportLoadBalance( const std::vector& local_loads, const tbox::SAMRAI_MPI& mpi, std::ostream& output_stream = tbox::plog); - /*! - * @brief Write out a short report of how well load is balanced. - * - * Given the workloads of a number of processes, format and write - * out a brief report for assessing how well balanced the workloads - * are. - * - * @param[in] workloads One value for each process. The number of - * processes is taken to be the size of this container. + //@} + + /* + * Constrain maximum box sizes in the given BoxLevel and + * update given Connectors to the changed BoxLevel. * - * @param[in] output_stream + * @pre !anchor_to_level || anchor_to_level->hasTranspose() */ static void - reportLoadBalance( - const std::vector& workloads, - std::ostream& output_stream); + constrainMaxBoxSizes( + hier::BoxLevel& box_level, + hier::Connector* anchor_to_level, + const PartitioningParams& pparams); - //@} + static const int BalanceUtilities_PREBALANCE0 = 5; + static const int BalanceUtilities_PREBALANCE1 = 6; -private: + /*! + * Move Boxes in balance_box_level from ranks outside of + * rank_group to ranks inside rank_group. Modify the given connectors + * to make them correct following this moving of boxes. + * + * @pre !balance_to_anchor || balance_to_anchor->hasTranspose() + * @pre !balance_to_anchor || (balance_to_anchor->getTranspose().checkTransposeCorrectness(*balance_to_anchor) == 0) + * @pre !balance_to_anchor || (balance_to_anchor->checkTransposeCorrectness(balance_to_anchor->getTranspose()) == 0) + */ + static void + prebalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, + const tbox::RankGroup& rank_group); +private: struct RankAndLoad { int rank; double load; @@ -369,15 +508,15 @@ struct BalanceUtilities { static void privateHeapify( - tbox::Array& permutation, - tbox::Array& workload, + std::vector& permutation, + std::vector& workload, const int index, const int heap_size); static void privateHeapify( - tbox::Array& permutation, - tbox::Array& spatial_keys, + std::vector& permutation, + std::vector& spatial_keys, const int index, const int heap_size); @@ -385,7 +524,7 @@ struct BalanceUtilities { privateRecursiveProcAssign( const int wt_index_lo, const int wt_index_hi, - tbox::Array& weights, + std::vector& weights, const int proc_index_lo, const int proc_index_hi, hier::ProcessorMapping& mapping, @@ -394,11 +533,11 @@ struct BalanceUtilities { static void privatePrimeFactorization( const int N, - tbox::Array& p); + std::vector& p); static void privateResetPrimesArray( - tbox::Array& p); + std::vector& p); static bool privateBadCutPointsExist( @@ -406,7 +545,7 @@ struct BalanceUtilities { static void privateInitializeBadCutPointsForBox( - tbox::Array >& bad_cut_points, + std::vector >& bad_cut_points, hier::Box& box, bool bad_domain_boundaries_exist, const hier::IntVector& bad_interval, @@ -414,11 +553,11 @@ struct BalanceUtilities { static bool privateFindBestCutDimension( - int& cut_dim_out, + tbox::Dimension::dir_t& cut_dim_out, const hier::Box& in_box, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points); + std::vector >& bad_cut_points); static int privateFindCutPoint( @@ -426,19 +565,19 @@ struct BalanceUtilities { double ideal_workload, int mincut, int numcells, - const tbox::Array& work_in_slice, - const tbox::Array& bad_cut_points); + const std::vector& work_in_slice, + const std::vector& bad_cut_points); static void privateCutBoxesAndSetBadCutPoints( hier::Box& box_lo, - tbox::Array >& bad_cut_points_for_boxlo, + std::vector >& bad_cut_points_for_boxlo, hier::Box& box_hi, - tbox::Array >& bad_cut_points_for_boxhi, + std::vector >& bad_cut_points_for_boxhi, const hier::Box& in_box, - int cutdim, + tbox::Dimension::dir_t cutdim, int cut_index, - const tbox::Array >& bad_cut_points); + const std::vector >& bad_cut_points); static void privateRecursiveBisectionUniformSingleBox( @@ -450,7 +589,7 @@ struct BalanceUtilities { const double workload_tolerance, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points); + std::vector >& bad_cut_points); static void privateRecursiveBisectionNonuniformSingleBox( @@ -464,7 +603,7 @@ struct BalanceUtilities { const double workload_tolerance, const hier::IntVector& min_size, const hier::IntVector& cut_factor, - tbox::Array >& bad_cut_points); + std::vector >& bad_cut_points); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.C index c4b19175..78d517e4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.C @@ -3,21 +3,18 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Asynchronous Berger-Rigoutsos algorithm wrapper * ************************************************************************/ -#ifndef included_mesh_BergerRigoutsos_C -#define included_mesh_BergerRigoutsos_C - #include #include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/mesh/BergerRigoutsosNode.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" #include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/StartupShutdownManager.h" @@ -26,20 +23,9 @@ namespace SAMRAI { namespace mesh { -boost::shared_ptr BergerRigoutsos::t_barrier_before; -boost::shared_ptr BergerRigoutsos::t_barrier_after; -boost::shared_ptr BergerRigoutsos::t_find_boxes_with_tags; -boost::shared_ptr BergerRigoutsos::t_run_abr; -boost::shared_ptr BergerRigoutsos::t_global_reductions; -boost::shared_ptr BergerRigoutsos::t_sort_output_nodes; - -tbox::StartupShutdownManager::Handler -BergerRigoutsos::s_initialize_finalize_handler( - BergerRigoutsos::initializeCallback, - 0, - 0, - BergerRigoutsos::finalizeCallback, - tbox::StartupShutdownManager::priorityTimers); +const std::string BergerRigoutsos::s_default_timer_prefix("mesh::BergerRigoutsos"); +std::map BergerRigoutsos::s_static_timers; +char BergerRigoutsos::s_ignore_external_timer_prefix('n'); /* ************************************************************************ @@ -49,81 +35,83 @@ BergerRigoutsos::s_initialize_finalize_handler( */ BergerRigoutsos::BergerRigoutsos( const tbox::Dimension& dim, - const boost::shared_ptr& database): + const boost::shared_ptr& input_db): + d_dim(dim), - d_mpi(tbox::SAMRAI_MPI::commNull), - d_max_box_size(hier::IntVector(d_dim, tbox::MathUtilities::getMax())), - d_max_lap_cut_from_center(1.0), - d_laplace_cut_threshold_ar(0.0), + + // Parameters from clustering algorithm interface ... + d_tag_data_index(-1), + d_tag_val(1), + d_min_box(hier::IntVector::getZero(dim)), + d_tag_to_new_width(hier::IntVector::getZero(dim)), + + d_tag_level(), + d_new_box_level(), + d_tag_to_new(), + d_root_boxes(), + + // Parameters not from clustering algorithm interface ... + d_max_box_size(hier::IntVector(dim, tbox::MathUtilities::getMax())), + d_max_inflection_cut_from_center(1.0), + d_inflection_cut_threshold_ar(0.0), + d_algo_advance_mode(ADVANCE_SOME), + d_owner_mode(MOST_OVERLAP), + + // Implementation flags and data... + d_compute_relationships(2), + d_sort_output_nodes(false), + d_build_zero_width_connector(false), + d_efficiency_tolerance(1, 0.8), + d_combine_efficiency(1, 0.8), + d_relaunch_queue(), + d_comm_stage(), + d_min_box_size_from_cutting(dim, 0), + d_relationship_senders(), + d_relationship_messages(), + + // Communication parameters ... + d_mpi(MPI_COMM_NULL), + d_tag_upper_bound(-1), + d_available_mpi_tag(-1), + + // Analysis support ... + d_log_do_loop(false), d_log_node_history(false), d_log_cluster_summary(false), d_log_cluster(false), - d_owner_mode("MOST_OVERLAP"), - d_algo_advance_mode("ADVANCE_SOME"), - d_sort_output_nodes(false), d_check_min_box_size('w'), + d_num_tags_in_all_nodes(0), + d_max_tags_owned(0), + d_num_nodes_constructed(0), + d_num_nodes_existing(0), + d_max_nodes_existing(0), + d_num_nodes_active(0), + d_max_nodes_active(0), + d_num_nodes_owned(0), + d_max_nodes_owned(0), + d_num_nodes_commwait(0), + d_max_nodes_commwait(0), + d_num_nodes_completed(0), + d_max_generation(0), + d_num_boxes_generated(0), + d_num_conts_to_complete(0), + d_max_conts_to_complete(0), + + // Performance timing... d_barrier_before(false), - d_barrier_after(false) + d_barrier_after(false), + d_object_timers(0) { + getFromInput(input_db); + setTimerPrefix(s_default_timer_prefix); - /* - * Set database-dependent parameters or cache them for use - * when we construct a dendogram root. - */ - if (database) { - if (database->isInteger("max_box_size")) { - database->getIntegerArray("max_box_size", &d_max_box_size[0], d_dim.getValue()); - } - d_max_lap_cut_from_center = - database->getDoubleWithDefault("max_lap_cut_from_center", - d_max_lap_cut_from_center); - d_laplace_cut_threshold_ar = - database->getDoubleWithDefault("laplace_cut_threshold_ar", - d_laplace_cut_threshold_ar); - d_log_node_history = - database->getBoolWithDefault("log_node_history", - d_log_node_history); - d_log_cluster_summary = - database->getBoolWithDefault("log_cluster_summary", - d_log_cluster_summary); - d_log_cluster = - database->getBoolWithDefault("log_cluster", - d_log_cluster); - d_algo_advance_mode = - database->getStringWithDefault("algo_advance_mode", - d_algo_advance_mode); - d_owner_mode = - database->getStringWithDefault("owner_mode", - d_owner_mode); - d_sort_output_nodes = - database->getBoolWithDefault("sort_output_nodes", - d_sort_output_nodes); - - std::string tmp_str; - - tmp_str = database->getStringWithDefault("check_min_box_size", - std::string("WARN")); - d_check_min_box_size = char(tolower(*tmp_str.c_str())); - if (d_check_min_box_size != 'i' && - d_check_min_box_size != 'w' && - d_check_min_box_size != 'e') { - TBOX_ERROR("BergerRigoutsos: input parameter check_min_box_size\n" - << "can only be \"IGNORE\", \"WARN\" or \"ERROR\""); - } - - d_barrier_before = - database->getBoolWithDefault("barrier_before", - d_barrier_before); - d_barrier_after = - database->getBoolWithDefault("barrier_after", - d_barrier_after); - } - + TBOX_omp_init_lock(&l_relaunch_queue); } BergerRigoutsos::~BergerRigoutsos() { - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { + TBOX_omp_destroy_lock(&l_relaunch_queue); + if (d_mpi.getCommunicator() != MPI_COMM_NULL) { // Free the private communicator (if SAMRAI_MPI has not been finalized). int flag; tbox::SAMRAI_MPI::Finalized(&flag); @@ -133,20 +121,114 @@ BergerRigoutsos::~BergerRigoutsos() } } -/* - ************************************************************************* - * Set the MPI communicator. - ************************************************************************* - */ void -BergerRigoutsos::setMPI( - const tbox::SAMRAI_MPI& mpi) +BergerRigoutsos::getFromInput( + const boost::shared_ptr& input_db) { - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - d_mpi.freeCommunicator(); - } - if (mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - d_mpi.dupCommunicator(mpi); + if (input_db) { + + s_ignore_external_timer_prefix = + input_db->getCharWithDefault("DEV_ignore_external_timer_prefix", + 'n'); + if (!(s_ignore_external_timer_prefix == 'n' || + s_ignore_external_timer_prefix == 'y')) { + INPUT_VALUE_ERROR("DEV_ignore_external_timer_prefix"); + } + + if (input_db->isInteger("max_box_size")) { + input_db->getIntegerArray("max_box_size", + &d_max_box_size[0], + d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_max_box_size[i] > 0)) { + INPUT_RANGE_ERROR("max_box_size"); + } + } + } + + d_max_inflection_cut_from_center = + input_db->getDoubleWithDefault("DEV_max_inflection_cut_from_center", + d_max_inflection_cut_from_center); + d_inflection_cut_threshold_ar = + input_db->getDoubleWithDefault("DEV_inflection_cut_threshold_ar", + d_inflection_cut_threshold_ar); + if (input_db->isInteger("DEV_min_box_size_from_cutting")) { + input_db->getIntegerArray("DEV_min_box_size_from_cutting", + &d_min_box_size_from_cutting[0], + d_dim.getValue()); + } + d_build_zero_width_connector = + input_db->getBoolWithDefault("DEV_build_zero_width_connector", + d_build_zero_width_connector); + d_log_do_loop = + input_db->getBoolWithDefault("DEV_log_do_loop", false); + d_log_node_history = + input_db->getBoolWithDefault("DEV_log_node_history", false); + d_log_cluster_summary = + input_db->getBoolWithDefault("DEV_log_cluster_summary", false); + d_log_cluster = + input_db->getBoolWithDefault("DEV_log_cluster", false); + + std::string algo_advance_mode = + input_db->getStringWithDefault("DEV_algo_advance_mode", "ADVANCE_SOME"); + setAlgorithmAdvanceMode(algo_advance_mode); + + std::string owner_mode = + input_db->getStringWithDefault("DEV_owner_mode", "MOST_OVERLAP"); + setOwnerMode(owner_mode); + + d_sort_output_nodes = + input_db->getBoolWithDefault("sort_output_nodes", false); + + /* + * Read input for efficiency tolerance. + */ + + if (input_db->keyExists("efficiency_tolerance")) { + d_efficiency_tolerance = + input_db->getDoubleVector("efficiency_tolerance"); + + int efficiency_tolerance_size = + static_cast(d_efficiency_tolerance.size()); + for (int ln = 0; ln < efficiency_tolerance_size; ++ln) { + if (!((d_efficiency_tolerance[ln] > 0.0e0) && + (d_efficiency_tolerance[ln] < 1.0e0))) { + INPUT_RANGE_ERROR("efficiency_tolerance"); + } + } + } + + /* + * Read input for combine efficiency. + */ + + if (input_db->keyExists("combine_efficiency")) { + d_combine_efficiency = + input_db->getDoubleVector("combine_efficiency"); + + int combine_efficiency_size = + static_cast(d_combine_efficiency.size()); + for (int ln = 0; ln < combine_efficiency_size; ++ln) { + if (!((d_combine_efficiency[ln] > 0.0e0) && + (d_combine_efficiency[ln] < 1.0e0))) { + INPUT_RANGE_ERROR("combine_efficiency"); + } + } + } + + std::string tmp_str; + + tmp_str = + input_db->getStringWithDefault("check_min_box_size", std::string("WARN")); + if (!(tmp_str == "IGNORE" || tmp_str == "WARN" || tmp_str == "ERROR")) { + INPUT_VALUE_ERROR("check_min_box_size"); + } + d_check_min_box_size = char(tolower(*tmp_str.c_str())); + + d_barrier_before = + input_db->getBoolWithDefault("DEV_barrier_before", false); + d_barrier_after = + input_db->getBoolWithDefault("DEV_barrier_after", false); } } @@ -156,10 +238,9 @@ BergerRigoutsos::setMPI( * Implement the BoxGeneratorStrategy interface method using * the asynchronous Berger-Rigoutsos implementation. * - * Create objects for using the ABR recursion tree, set options for - * using the ABR implementation, then run it. + * Set options for using the ABR implementation, then run it. * - * The output boxes from the dendogram root is in the form of a + * The output boxes from the tree root is in the form of a * BoxLevel. This method postprocess that data to * convert the output to the box list form required by the * box clustering strategy interface. @@ -168,111 +249,110 @@ BergerRigoutsos::setMPI( */ void BergerRigoutsos::findBoxesContainingTags( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, const boost::shared_ptr& tag_level, const int tag_data_index, const int tag_val, - const hier::Box& bound_box, + const hier::BoxContainer& bound_boxes, const hier::IntVector& min_box, - const double efficiency_tol, - const double combine_tol, - const hier::IntVector& max_gcw, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id) const + const hier::IntVector& tag_to_new_width) { - TBOX_DIM_ASSERT_CHECK_ARGS5(new_mapped_box_level, - *tag_level, - bound_box, + TBOX_ASSERT(!bound_boxes.empty()); + TBOX_ASSERT_OBJDIM_EQUALITY4(*tag_level, + *(bound_boxes.begin()), min_box, - max_gcw); + tag_to_new_width); + TBOX_ASSERT(tag_to_new_width >= hier::IntVector::getZero(tag_to_new_width.getDim())); tbox::SAMRAI_MPI mpi(tag_level->getBoxLevel()->getMPI()); - if (!(bound_box.numberCells() >= min_box)) { - if (d_check_min_box_size == 'e') { - TBOX_ERROR("BergerRigoutsos::findBoxesContainingTags input error:\n" - << "Input box " << bound_box << " has size " << bound_box.numberCells() - << "\nwhich is already smaller than the minimum box size\n" - << min_box << "\n\n" - << "To ignore or just issue a warning, see the input parameter\n" - << "check_min_box_size.\n"); - } else if (d_check_min_box_size == 'w') { - TBOX_WARNING("BergerRigoutsos::findBoxesContainingTags input warning:\n" - << "Input box " << bound_box << " has size " << bound_box.numberCells() - << "\nwhich is already smaller than the minimum box size\n" - << min_box << "\n\n" - << "To ignore or issue error, see the input parameter\n" - << "check_min_box_size.\n"); + for (hier::BoxContainer::const_iterator bb_itr = bound_boxes.begin(); + bb_itr != bound_boxes.end(); ++bb_itr) { + if (!(bb_itr->numberCells() >= + min_box.getBlockVector(bb_itr->getBlockId()))) { + if (d_check_min_box_size == 'e') { + TBOX_ERROR("BergerRigoutsos::findBoxesContainingTags input error:\n" + << "Input box " << *bb_itr << " has size " << bb_itr->numberCells() + << "\nwhich is already smaller than the minimum box size\n" + << min_box << "\n\n" + << "To ignore or just issue a warning, see the input parameter\n" + << "check_min_box_size.\n"); + } else if (d_check_min_box_size == 'w') { + TBOX_WARNING("BergerRigoutsos::findBoxesContainingTags input warning:\n" + << "Input box " << *bb_itr << " has size " << bb_itr->numberCells() + << "\nwhich is already smaller than the minimum box size\n" + << min_box << "\n\n" + << "To ignore or issue error, see the input parameter\n" + << "check_min_box_size.\n"); + } + } + if (bb_itr->empty()) { + TBOX_ERROR("BergerRigoutsos: empty bounding box not allowed."); } } if (d_barrier_before) { - t_barrier_before->start(); + d_object_timers->t_barrier_before->start(); mpi.Barrier(); - t_barrier_before->stop(); + d_object_timers->t_barrier_before->stop(); } - if (bound_box.empty()) { - TBOX_ERROR("BergerRigoutsos: empty bounding box not allowed."); - } + d_object_timers->t_find_boxes_containing_tags->start(); - const hier::BoxLevel& tag_mapped_box_level = - *tag_level->getBoxLevel(); + /* + * Set up some internal data then call + * clusterAndComputeRelationships run the clustering algorithm. + */ + + resetCounters(); /* - * If using a duplicate MPI communicator, check that the duplicate - * and the communicator of the tag_mapped_box_level are congruent. + * Set parameters received from findBoxesContainingTags() virtual + * interface. */ - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - tbox::SAMRAI_MPI mpi1(d_mpi); - tbox::SAMRAI_MPI mpi2(tag_mapped_box_level.getMPI()); - TBOX_ASSERT(mpi1.getSize() == mpi2.getSize()); - TBOX_ASSERT(mpi1.getRank() == mpi2.getRank()); - if (mpi1.getSize() > 1) { - int compare_result; - tbox::SAMRAI_MPI::Comm_compare( - d_mpi.getCommunicator(), - tag_mapped_box_level.getMPI().getCommunicator(), - &compare_result); - if (compare_result != MPI_CONGRUENT) { - TBOX_ERROR("BergerRigoutsos set-up error: MPI communicator\n" - << "set by setMPI() (" << d_mpi.getCommunicator() - << ") and the communicator of the input tag_mapped_box_level (" - << tag_mapped_box_level.getMPI().getCommunicator() << ") are not congruent."); - } - } - } - t_find_boxes_with_tags->start(); + d_tag_data_index = tag_data_index; + d_tag_val = tag_val; + d_min_box = min_box; + d_level_number = tag_level->getLevelNumber(); - BergerRigoutsosNode root_node(d_dim, block_id, first_local_id); + d_tag_to_new_width = d_build_zero_width_connector ? + hier::IntVector::getZero(tag_to_new_width.getDim()) + : tag_to_new_width; - // Set standard Berger-Rigoutsos clustering parameters. - root_node.setClusteringParameters(tag_data_index, - tag_val, - min_box, - efficiency_tol, - combine_tol, - d_max_box_size, - d_max_lap_cut_from_center, - d_laplace_cut_threshold_ar); - - // Set the parallel algorithm and DLBG parameters. - root_node.setAlgorithmAdvanceMode(d_algo_advance_mode); - root_node.setOwnerMode(d_owner_mode); - root_node.setComputeRelationships("BIDIRECTIONAL", max_gcw); - - // Set debugging/verbosity parameters. - root_node.setLogNodeHistory(d_log_node_history); - - root_node.clusterAndComputeRelationships(new_mapped_box_level, - tag_to_new, - new_to_tag, - bound_box, - tag_level, - d_mpi); + setComputeRelationships("BIDIRECTIONAL"); + + d_tag_level = tag_level; + d_root_boxes = bound_boxes; + + /* + * If d_mpi has not been set, then user wants to do use the + * MPI in tag_level (nothing special). If it has been set, it is a + * duplicate MPI, so don't change it. + */ + if (d_mpi.getCommunicator() == MPI_COMM_NULL) { + d_mpi = d_tag_level->getBoxLevel()->getMPI(); + setupMPIDependentData(); + } +#if defined(DEBUG_CHECK_ASSERTIONS) + else { + if (!checkMPICongruency()) { + TBOX_ERROR("BergerRigoutsos::findBoxesContainingTags():\n" + << "The communicator of the input tag BoxLevel (" + << d_tag_level->getBoxLevel()->getMPI().getCommunicator() + << " is not congruent with the MPI communicator (" + << d_mpi.getCommunicator() + << " duplicated in the call to useDuplicateMPI().\n" + << "If you call useDuplicateMPI(), you are restricted\n" + << "to using SAMRAI_MPI objects that are congruent with\n" + << "the duplicated object." + << std::endl); + } + } +#endif + + clusterAndComputeRelationships(); if (d_sort_output_nodes == true) { /* @@ -283,179 +363,672 @@ BergerRigoutsos::findBoxesContainingTags( * clustering algorithm is non-deterministic because * it depends on the order of asynchronous messages.) */ - sortOutputBoxes(new_mapped_box_level, - tag_to_new, - new_to_tag); + sortOutputBoxes(); } /* * Get some global parameters. Do it before logging to prevent * the logging flag from having an undue side effect on performance. */ - t_global_reductions->start(); - new_mapped_box_level.getGlobalNumberOfBoxes(); - new_mapped_box_level.getGlobalNumberOfCells(); - new_mapped_box_level.getGlobalBoundingBox(block_id.getBlockValue()); - t_global_reductions->stop(); + d_object_timers->t_global_reductions->start(); + d_new_box_level->getGlobalNumberOfBoxes(); + d_new_box_level->getGlobalNumberOfCells(); + for (hier::BoxContainer::const_iterator bi = bound_boxes.begin(); + bi != bound_boxes.end(); ++bi) { + d_new_box_level->getGlobalBoundingBox(bi->getBlockId()); + } + d_object_timers->t_global_reductions->stop(); if (d_log_cluster) { + d_object_timers->t_logging->start(); tbox::plog << "BergerRigoutsos cluster log:\n" - << "\tNew mapped_box_level clustered by BergerRigoutsos:\n" << new_mapped_box_level.format("", + << "\tNew box_level clustered by BergerRigoutsos:\n" << d_new_box_level->format("", 2) - << "\tBergerRigoutsos tag_to_new:\n" << tag_to_new.format("", 2) - << "\tBergerRigoutsos new_to_tag:\n" << new_to_tag.format("", 2); + << "\tBergerRigoutsos tag_to_new:\n" << d_tag_to_new->format("", 2) + << "\tBergerRigoutsos new_to_tag:\n" << d_tag_to_new->getTranspose().format("", 2); + d_object_timers->t_logging->stop(); } if (d_log_cluster_summary) { /* - * Log summary of clustering and dendogram. + * Log summary of clustering and tree. */ + d_object_timers->t_logging->start(); tbox::plog << "BergerRigoutsos summary:\n" << "\tAsync BR on proc " << mpi.getRank() << " owned " - << root_node.getMaxOwnership() << " participating in " - << root_node.getMaxNodes() << " nodes (" - << (double)root_node.getMaxOwnership() / root_node.getMaxNodes() - << ") in " << root_node.getMaxGeneration() << " generations," - << " " << root_node.getNumBoxesGenerated() + << d_num_nodes_owned << " participating in " + << d_num_nodes_constructed << " nodes (" + << double(d_num_nodes_owned) / d_num_nodes_constructed + << ") in " << d_max_generation << " generations," + << " " << d_num_boxes_generated << " boxes generated.\n\t" - << root_node.getMaxTagsOwned() << " locally owned tags on new BoxLevel.\n\t" - << "Initial bounding box = " << bound_box << ", " - << bound_box.size() << " cells, " - << "final global bounding box = " - << new_mapped_box_level.getGlobalBoundingBox(block_id.getBlockValue()) - << ", " - << new_mapped_box_level.getGlobalBoundingBox(block_id.getBlockValue()).size() - << " cells\n\t" - << "Final output has " << root_node.getNumTags() + << d_max_tags_owned << " locally owned tags on new BoxLevel.\n\t"; + + for (hier::BoxContainer::const_iterator bi = bound_boxes.begin(); + bi != bound_boxes.end(); ++bi) { + const hier::BlockId bid = bi->getBlockId(); + tbox::plog << "Block " << static_cast(bid.getBlockValue()) + << " initial bounding box = " << *bi << ", " + << bi->size() << " cells, " + << "final global bounding box = " + << d_new_box_level->getGlobalBoundingBox(bid) + << ", " + << d_new_box_level->getGlobalBoundingBox(bid).size() + << " cells.\n\t"; + } + + tbox::plog << "Final output has " << d_num_tags_in_all_nodes << " tags in " - << new_mapped_box_level.getGlobalNumberOfCells() - << " global cells [" << new_mapped_box_level.getMinNumberOfCells() - << "-" << new_mapped_box_level.getMaxNumberOfCells() << "], " - << new_mapped_box_level.getGlobalNumberOfBoxes() - << " global mapped boxes [" << new_mapped_box_level.getMinNumberOfBoxes() - << "-" << new_mapped_box_level.getMaxNumberOfBoxes() << "]\n\t" + << d_new_box_level->getGlobalNumberOfCells() + << " global cells [" << d_new_box_level->getMinNumberOfCells() + << "-" << d_new_box_level->getMaxNumberOfCells() << "], " + << "over-refinement " << double(d_new_box_level->getGlobalNumberOfCells()) + / d_num_tags_in_all_nodes - 1 << ", " + << d_new_box_level->getGlobalNumberOfBoxes() + << " global boxes [" << d_new_box_level->getMinNumberOfBoxes() + << "-" << d_new_box_level->getMaxNumberOfBoxes() << "]\n\t" << "Number of continuations: avg = " - << root_node.getAvgNumberOfCont() - << " max = " << root_node.getMaxNumberOfCont() << '\n' - << "\tBergerRigoutsos new_level summary:\n" << new_mapped_box_level.format("\t\t",0) - << "\tBergerRigoutsos new_level statistics:\n" << new_mapped_box_level.formatStatistics("\t\t") - << "\tBergerRigoutsos new_to_tag summary:\n" << new_to_tag.format("\t\t",0) - << "\tBergerRigoutsos new_to_tag statistics:\n" << new_to_tag.formatStatistics("\t\t") - << "\tBergerRigoutsos tag_to_new summary:\n" << tag_to_new.format("\t\t",0) - << "\tBergerRigoutsos tag_to_new statistics:\n" << tag_to_new.formatStatistics("\t\t") + << (d_num_nodes_completed > 0 ? double(d_num_conts_to_complete) + / d_num_nodes_completed : 0) + << " max = " << d_max_conts_to_complete << '\n' + << "\tBergerRigoutsos new_level summary:\n" << d_new_box_level->format("\t\t", 0) + << "\tBergerRigoutsos new_level statistics:\n" + << d_new_box_level->formatStatistics("\t\t") + << "\tBergerRigoutsos new_to_tag summary:\n" + << d_tag_to_new->getTranspose().format("\t\t", 0) + << "\tBergerRigoutsos new_to_tag statistics:\n" + << d_tag_to_new->getTranspose().formatStatistics("\t\t") + << "\tBergerRigoutsos tag_to_new summary:\n" << d_tag_to_new->format("\t\t", 0) + << "\tBergerRigoutsos tag_to_new statistics:\n" << d_tag_to_new->formatStatistics( + "\t\t") << "\n"; + d_object_timers->t_logging->stop(); } -#ifdef DEBUG_CHECK_ASSERTIONS - assertNoMessageForPrivateCommunicator(); -#endif + if (d_mpi == d_tag_level->getBoxLevel()->getMPI()) { + /* + * We have been using an external SAMRAI_MPI. + * Reset it to avoid mistaking it for an internal one. + */ + d_mpi.setCommunicator(MPI_COMM_NULL); + } + + /* + * Set outputs. Clear temporary parameters that are only used + * during active clustering. + */ + new_box_level = d_new_box_level; + tag_to_new = d_tag_to_new; + d_new_box_level.reset(); + d_tag_to_new.reset(); + d_tag_level.reset(); if (d_barrier_after) { - t_barrier_after->start(); + d_object_timers->t_barrier_after->start(); mpi.Barrier(); - t_barrier_after->stop(); + d_object_timers->t_barrier_after->stop(); } - t_find_boxes_with_tags->stop(); + d_object_timers->t_find_boxes_containing_tags->stop(); } /* - *********************************************************************** - *********************************************************************** + ******************************************************************** + ******************************************************************** + */ +void +BergerRigoutsos::clusterAndComputeRelationships() +{ + d_object_timers->t_cluster_and_compute_relationships->start(); + + /* + * During the algorithm, we kept the results in primitive + * containers to avoid the overhead of fine-grain changes to the + * output objects. Now initialize the outputs using those + * primitive containers. + */ + + d_new_box_level.reset(new hier::BoxLevel( + d_tag_level->getRatioToLevelZero(), + d_tag_level->getGridGeometry(), + d_tag_level->getBoxLevel()->getMPI())); + + if (d_compute_relationships >= 1) { + d_tag_to_new.reset(new hier::Connector(*d_tag_level->getBoxLevel(), + *d_new_box_level, + d_tag_to_new_width)); + } + if (d_compute_relationships >= 2) { + hier::Connector* new_to_tag = + new hier::Connector(*d_new_box_level, + *d_tag_level->getBoxLevel(), + d_tag_to_new_width); + d_tag_to_new->setTranspose(new_to_tag, true); + } + + d_object_timers->t_cluster->start(); + + /* + * Clear out accumulated communication data or it will mess up this + * clustering run. + */ + d_relationship_senders.clear(); + d_relationship_messages.clear(); + + if (d_compute_relationships > 0) { + /* + * Create empty neighbor lists for nodes on tag level. As new + * nodes are finalized, they will be added to these lists. + */ + const hier::BoxContainer& tag_boxes = d_tag_level->getBoxLevel()->getBoxes(); + for (hier::RealBoxConstIterator ni(tag_boxes.realBegin()); + ni != tag_boxes.realEnd(); ++ni) { + d_tag_to_new->makeEmptyLocalNeighborhood(ni->getBoxId()); + } + TBOX_ASSERT( + static_cast(d_tag_level->getBoxLevel()->getLocalNumberOfBoxes()) == + d_tag_to_new->getLocalNumberOfNeighborSets()); + } + + { + + /* + * Create a BergerRigoutsosNode for each incoming root box and + * push into the relaunch queue for execution. + * + * We use extent data from each incoming root box but do not + * assume its id is properly set, because the interface did not + * guarantee they would be. + */ + hier::LocalId root_box_local_id(0); + int root_box_owner = 0; + std::list > block_nodes_to_delete; + for (hier::BoxContainer::const_iterator rb = d_root_boxes.begin(); + rb != d_root_boxes.end(); ++rb) { + if (rb->empty()) continue; + + // TODO: can build block_box in the node instead of here! + const hier::Box block_box(*rb, + root_box_local_id, + root_box_owner); + + BergerRigoutsosNode * block_node( + new BergerRigoutsosNode(this, block_box)); + + d_relaunch_queue.push_back(block_node); + + block_nodes_to_delete.push_back(boost::shared_ptr(block_node)); + } + + int n_comm_group_completed = 0; + do { + + // Continue nodes in launch queue. + d_object_timers->t_compute->start(); + while (!d_relaunch_queue.empty()) { + BergerRigoutsosNode* node_for_relaunch = d_relaunch_queue.front(); + d_relaunch_queue.pop_front(); + if (d_log_do_loop) { + tbox::plog << "Continuing from queue "; + node_for_relaunch->printNodeState(tbox::plog); + tbox::plog << std::endl; + } + node_for_relaunch->continueAlgorithm(); + if (d_log_do_loop) { + tbox::plog << "Exited continueAlgorithm "; + node_for_relaunch->printNodeState(tbox::plog); + tbox::plog << std::endl; + } + } + d_object_timers->t_compute->stop(); + + // Wait for some incoming messages. + d_object_timers->t_comm_wait->start(); + d_comm_stage.advanceSome(); + if (d_log_do_loop) { + n_comm_group_completed = + static_cast(d_comm_stage.numberOfCompletedMembers()); + } + d_object_timers->t_comm_wait->stop(); + + // Continue nodes with completed messages. + d_object_timers->t_compute->start(); + while (d_comm_stage.hasCompletedMembers()) { + BergerRigoutsosNode* node_for_relaunch = + (BergerRigoutsosNode *)(d_comm_stage.popCompletionQueue()->getHandler()); + if (d_log_do_loop) { + tbox::plog << "Continuing from stage "; + node_for_relaunch->printNodeState(tbox::plog); + tbox::plog << std::endl; + } + node_for_relaunch->continueAlgorithm(); + if (d_log_do_loop) { + tbox::plog << "Exited continueAlgorithm "; + node_for_relaunch->printNodeState(tbox::plog); + tbox::plog << std::endl; + } + } + d_object_timers->t_compute->stop(); + + if (d_log_do_loop) { + tbox::plog << "relaunch_queue size " + << d_relaunch_queue.size() + << " groups completed: " << n_comm_group_completed + << std::endl; + tbox::plog << "Stage has " << d_comm_stage.numberOfMembers() + << " members, " + << d_comm_stage.numberOfPendingMembers() + << " pending members, " + << d_comm_stage.numberOfPendingRequests() + << " pending requests." << std::endl; + } + } while (!d_relaunch_queue.empty() || d_comm_stage.hasPendingRequests()); + + } + + TBOX_ASSERT(d_relaunch_queue.empty()); + TBOX_ASSERT(!d_comm_stage.hasPendingRequests()); + +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_compute_relationships > 2) { + // Each new node should have its own neighbor list. + TBOX_ASSERT(d_new_box_level->getBoxes().size() == + d_tag_to_new->getTranspose().getLocalNumberOfNeighborSets()); + } +#endif + + // Barrier to separate clustering cost from relationship sharing cost. + d_mpi.Barrier(); + + d_object_timers->t_cluster->stop(); + + /* + * Share relationships with owners, if requested. + * This is a one-time operation that is not considered a part + * of continueAlgorithm(), so it lies outside that timimg. + */ + if (d_compute_relationships > 1) { + shareNewNeighborhoodSetsWithOwners(); + d_relationship_senders.clear(); + d_relationship_messages.clear(); + } + + d_object_timers->t_cluster_and_compute_relationships->stop(); + + d_new_box_level->finalize(); + + TBOX_ASSERT(d_tag_to_new->checkConsistencyWithBase() == 0); + TBOX_ASSERT(d_tag_to_new->checkConsistencyWithHead() == 0); + TBOX_ASSERT(d_tag_to_new->getTranspose().checkConsistencyWithBase() == 0); + TBOX_ASSERT(d_tag_to_new->getTranspose().checkConsistencyWithHead() == 0); + +#ifdef DEBUG_CHECK_ASSERTIONS + assertNoMessageForPrivateCommunicator(); +#endif + +} + +/* + ********************************************************************** + * + * Send new relationships found by local process to owners of the new nodes + * associated with those relationships. Receive similar data from other + * processes. + * + * Messages to be sent out were placed in d_relationship_messages by + * computeNewNeighborhoodSets(). This method sends out these messages + * and receives anticipated messages from processes listed in + * d_relationship_senders. Received messages are unpacked to get + * data on new relationships. + * + ********************************************************************** */ void -BergerRigoutsos::sortOutputBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag) const +BergerRigoutsos::shareNewNeighborhoodSetsWithOwners() { + tbox::SAMRAI_MPI mpi(d_mpi); + if (mpi.getSize() == 1) { + return; + } + + d_object_timers->t_share_new_relationships->start(); + + const int ints_per_box = hier::Box::commBufferSize(getDim()); + + int ierr; + tbox::SAMRAI_MPI::Status mpi_status; + + // Nonblocking send of relationship data. + d_object_timers->t_share_new_relationships_send->start(); + std::vector mpi_request( + d_relationship_messages.size()); + std::map::iterator send_i; + int nsend = 0; + for (send_i = d_relationship_messages.begin(), nsend = 0; + send_i != d_relationship_messages.end(); + ++send_i, ++nsend) { + const int& owner = (*send_i).first; + VectorOfInts& msg = (*send_i).second; + ierr = mpi.Isend(&msg[0], + static_cast(msg.size()), + MPI_INT, + owner, + d_tag_upper_bound, + &mpi_request[nsend]); +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(ierr); +#endif + TBOX_ASSERT(ierr == MPI_SUCCESS); + } + d_object_timers->t_share_new_relationships_send->stop(); - t_sort_output_nodes->start(); + /* + * The rest of this method assumes current process is NOT in + * d_relationship_senders, so remove it. For efficiency, + * BergerRigoutsosNode::computeNewNeighborhoodSets(), which + * populated the d_relationship_senders, did not remove it. + */ + d_relationship_senders.erase(d_mpi.getRank()); + + /* + * Create set recved_from which is to contain ranks of + * processes from which we've received the expected relationship data. + * The while loop goes until all expected messages have + * been received from d_relationship_senders. + * + * In the while loop: + * - Probe for an incomming message. + * - Determine its size allocate memory for receiving the message. + * - Receive the message. + * - Get relationship data from the message. + */ + IntSet recved_from; + while (recved_from.size() < d_relationship_senders.size()) { - hier::OverlapConnectorAlgorithm oca; + d_object_timers->t_share_new_relationships_recv->start(); + ierr = mpi.Probe(MPI_ANY_SOURCE, + d_tag_upper_bound, + &mpi_status); + TBOX_ASSERT(ierr == MPI_SUCCESS); + + const int sender = mpi_status.MPI_SOURCE; + int mesg_size = -1; + tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &mesg_size); + TBOX_ASSERT(d_relationship_senders.find(sender) != d_relationship_senders.end()); + TBOX_ASSERT(recved_from.find(sender) == recved_from.end()); + TBOX_ASSERT(mesg_size >= 0); + + std::vector buf(static_cast(mesg_size)); + int* ptr = &buf[0]; + ierr = mpi.Recv(ptr, + mesg_size, + MPI_INT, + sender, + d_tag_upper_bound, + &mpi_status); + TBOX_ASSERT(ierr == MPI_SUCCESS); + d_object_timers->t_share_new_relationships_recv->stop(); - if (0) { - // Check inputs. - int errs = 0; - if (oca.checkOverlapCorrectness(tag_to_new, false, true)) { - ++errs; - tbox::perr << "Error found in tag_to_new!\n"; + d_object_timers->t_share_new_relationships_unpack->start(); + int consumed = 0; + while (ptr < &buf[0] + buf.size()) { + const hier::LocalId new_local_id(*(ptr++)); + hier::BoxId box_id(new_local_id, d_mpi.getRank()); + int n_new_relationships = *(ptr++); + TBOX_ASSERT(d_tag_to_new->getTranspose().hasNeighborSet(box_id)); + if (n_new_relationships > 0) { + hier::Connector::NeighborhoodIterator base_box_itr = + d_tag_to_new->getTranspose().makeEmptyLocalNeighborhood(box_id); + for (int n = 0; n < n_new_relationships; ++n) { + hier::Box node(getDim()); + node.getFromIntBuffer(ptr); + ptr += ints_per_box; + d_tag_to_new->getTranspose().insertLocalNeighbor(node, base_box_itr); + } + } + consumed += 2 + n_new_relationships * ints_per_box; } - if (oca.checkOverlapCorrectness(new_to_tag, false, true)) { - ++errs; - tbox::perr << "Error found in new_to_tag!\n"; + recved_from.insert(sender); + d_object_timers->t_share_new_relationships_unpack->stop(); + } + + if (nsend > 0) { + // Make sure all nonblocking sends completed. + d_object_timers->t_share_new_relationships_send->start(); + std::vector mpi_statuses( + static_cast(d_relationship_messages.size())); + ierr = tbox::SAMRAI_MPI::Waitall(static_cast(d_relationship_messages.size()), + &mpi_request[0], + &mpi_statuses[0]); + TBOX_ASSERT(ierr == MPI_SUCCESS); + d_object_timers->t_share_new_relationships_send->stop(); + } + + d_object_timers->t_share_new_relationships->stop(); + +} + +/* + ********************************************************************** + * + * Methods for setting algorithm parameters before running. + * + ********************************************************************** + */ + +void +BergerRigoutsos::setAlgorithmAdvanceMode( + const std::string& mode) +{ + if (mode == "ADVANCE_ANY") { + d_algo_advance_mode = ADVANCE_ANY; + } else if (mode == "ADVANCE_SOME") { + d_algo_advance_mode = ADVANCE_SOME; + } else if (mode == "SYNCHRONOUS") { + d_algo_advance_mode = SYNCHRONOUS; + } else { + TBOX_ERROR("No such algorithm choice: " << mode << "\n"); + } +} + +void +BergerRigoutsos::setOwnerMode( + const std::string& mode) +{ + if (mode == "SINGLE_OWNER") { + d_owner_mode = SINGLE_OWNER; + } else if (mode == "MOST_OVERLAP") { + d_owner_mode = MOST_OVERLAP; + } else if (mode == "FEWEST_OWNED") { + d_owner_mode = FEWEST_OWNED; + } else if (mode == "LEAST_ACTIVE") { + d_owner_mode = LEAST_ACTIVE; + } else { + TBOX_ERROR("BergerRigoutsos: Unrecognized owner mode request: " + << mode << std::endl); + } +} + +void +BergerRigoutsos::setComputeRelationships( + const std::string mode) +{ + if (mode == "NONE") { + d_compute_relationships = 0; + } else if (mode == "TAG_TO_NEW") { + d_compute_relationships = 1; + } else if (mode == "BIDIRECTIONAL") { + d_compute_relationships = 2; + } else { + TBOX_ERROR("BergerRigoutsos::setComputeRelationships error:\n" + << "bad mode '" << mode << "' specified.\n" + << "Should be one of NONE, TAG_TO_NEW, BIDIRECTIONAL" << std::endl); + } +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +BergerRigoutsos::resetCounters() +{ + d_num_tags_in_all_nodes = 0; + d_max_tags_owned = 0; + d_num_nodes_constructed = 0; + d_num_nodes_existing = 0; + d_max_nodes_existing = 0; + d_num_nodes_active = 0; + d_max_nodes_active = 0; + d_num_nodes_owned = 0; + d_max_nodes_owned = 0; + d_num_nodes_commwait = 0; + d_max_nodes_commwait = 0; + d_num_nodes_completed = 0; + d_max_generation = 0; + d_num_boxes_generated = 0; + d_num_conts_to_complete = 0; + d_max_conts_to_complete = 0; + d_num_nodes_existing = 0; +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +BergerRigoutsos::writeCounters() { + tbox::plog << d_num_nodes_existing << "-exist " + << d_num_nodes_active << "-act " + << d_num_nodes_owned << "-owned " + << d_num_nodes_completed << "-done " + << d_relaunch_queue.size() << "-qd " + << d_num_nodes_commwait << "-wait "; +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +BergerRigoutsos::useDuplicateMPI( + const tbox::SAMRAI_MPI& mpi_object) +{ + TBOX_ASSERT(!d_tag_level); // Setting MPI during clustering makes a mess. + + // If needed, free current private communicator. + if (d_mpi.getCommunicator() != MPI_COMM_NULL) { + d_mpi.freeCommunicator(); + TBOX_ASSERT(d_mpi.getCommunicator() == MPI_COMM_NULL); + } + + if (mpi_object.getCommunicator() != MPI_COMM_NULL) { + d_mpi.dupCommunicator(mpi_object); + } + + setupMPIDependentData(); +} + +/* + ************************************************************************** + * Check the congruency between d_mpi and d_tag_level's MPI. + * Returns whether the two are congruent. Congruency checks + * may be expensive. + * + * Note: Sequential runs (no MPI or MPI with 1 process) always means + * congruency. d_mpi with a Null communicator indicates that we will + * use the d_tag_level's MPI, so that is also automatically congruent. + ************************************************************************** + */ +bool +BergerRigoutsos::checkMPICongruency() const +{ + if (!tbox::SAMRAI_MPI::usingMPI() || + (d_mpi.getCommunicator() == MPI_COMM_NULL) || + (d_mpi.getSize() == 1 && + d_tag_level->getBoxLevel()->getMPI().getSize() == 1)) { + return true; + } + return d_mpi.isCongruentWith(d_tag_level->getBoxLevel()->getMPI()); +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +BergerRigoutsos::setupMPIDependentData() +{ + /* + * Reserve the tag upper bound for the relationship-sharing phase. + * Divide the rest into tag pools divided among all processes. + */ + if (tbox::SAMRAI_MPI::usingMPI()) { + /* + * For some MPI implementations, I cannot get the attribute for + * any communicator except for MPI_COMM_WORLD. Assuming the tag + * upper bound is the same for all communicators, I will try + * some other communicators to get it. + */ + int* tag_upper_bound_ptr, flag; + d_mpi.Attr_get( + MPI_TAG_UB, + &tag_upper_bound_ptr, + &flag); + if (tag_upper_bound_ptr == 0) { + tbox::SAMRAI_MPI::getSAMRAIWorld().Attr_get( + MPI_TAG_UB, + &tag_upper_bound_ptr, + &flag); } - if (errs != 0) { - TBOX_ERROR( - "Errors found before sorting nodes." - << "new_mapped_box_level:\n" << new_mapped_box_level.format("", 2) - << "tag mapped_box_level:\n" << tag_to_new.getBase().format("", 2) - << "tag_to_new:\n" << tag_to_new.format("", 2) - << "new_to_tag:\n" << new_to_tag.format("", 2)); + if (tag_upper_bound_ptr == 0) { + tbox::SAMRAI_MPI mpi1(MPI_COMM_WORLD); + mpi1.Attr_get( + MPI_TAG_UB, + &tag_upper_bound_ptr, + &flag); } + TBOX_ASSERT(tag_upper_bound_ptr != 0); + d_tag_upper_bound = *tag_upper_bound_ptr; + + } else { + // MPI not used, so choose a sufficiently big tag upper bound. + d_tag_upper_bound = 1000000; } + // Divide the rest into tag pools divided among all processes. + d_available_mpi_tag = + d_tag_upper_bound / d_mpi.getSize() * d_mpi.getRank(); + +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BergerRigoutsos::sortOutputBoxes() +{ + d_object_timers->t_sort_output_nodes->start(); + /* * Sort local indices by corners to make the output deterministic. */ - hier::Connector sorting_map; - hier::BoxLevel sorted_mapped_box_level(d_dim); + boost::shared_ptr sorting_map; + boost::shared_ptr sorted_box_level; hier::BoxLevelConnectorUtils dlbg_edge_utils; dlbg_edge_utils.makeSortingMap( - sorted_mapped_box_level, + sorted_box_level, sorting_map, - new_mapped_box_level, + *d_new_box_level, true /* sort nodes by corners */, false /* don't sequentialize indices globally */); - if (0) { - tbox::plog - << "tag mapped_box_level:\n" << tag_to_new.getBase().format("", 2) - << "tag_to_new:\n" << tag_to_new.format("", 2) - << "new_to_tag:\n" << new_to_tag.format("", 2) - << "Sorting map:\n" << sorting_map.format("", 2); - } - if (0) { - // Check sorting_map before using it. - int errs = 0; - if (oca.checkOverlapCorrectness(sorting_map, false, true)) { - ++errs; - tbox::perr << "Error found in sorting_map!\n"; - } - if (errs != 0) { - TBOX_ERROR( - "Errors in load balance mapping found." - << "presorted mapped_box_level:\n" << new_mapped_box_level.format("", 2) - << "sorted mapped_box_level:\n" << sorted_mapped_box_level.format("", 2) - << "sorting_map:\n" << sorting_map.format("", 2)); - } - } hier::MappingConnectorAlgorithm mca; - mca.modify(tag_to_new, - new_to_tag, - sorting_map, - &new_mapped_box_level); - if (0) { - // Check result of mapping. - int errs = 0; - if (oca.checkOverlapCorrectness(tag_to_new, false, true)) { - ++errs; - tbox::perr << "Error found in tag_to_new!\n"; - } - if (oca.checkOverlapCorrectness(new_to_tag, false, true)) { - ++errs; - tbox::perr << "Error found in new_to_tag!\n"; - } - if (errs != 0) { - TBOX_ERROR( - "Errors found after sorting nodes." - << "new_mapped_box_level:\n" << new_mapped_box_level.format("", 2) - << "tag mapped_box_level:\n" << tag_to_new.getBase().format("", 2) - << "tag_to_new:\n" << tag_to_new.format("", 2) - << "new_to_tag:\n" << new_to_tag.format("", 2)); - } - } + mca.modify(*d_tag_to_new, + *sorting_map, + d_new_box_level.get()); - t_sort_output_nodes->stop(); + d_object_timers->t_sort_output_nodes->stop(); } /* @@ -472,22 +1045,15 @@ BergerRigoutsos::assertNoMessageForPrivateCommunicator() const * that there is no messages in transit, but it can find * messages that have arrived but not received. */ - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - int flag; + if (d_mpi.getCommunicator() != MPI_COMM_NULL && + d_mpi != d_tag_level->getBoxLevel()->getMPI()) { tbox::SAMRAI_MPI::Status mpi_status; - int mpi_err = d_mpi.Iprobe(MPI_ANY_SOURCE, - MPI_ANY_TAG, - &flag, - &mpi_status); - if (mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error probing for possible lost messages."); - } - if (flag == true) { + if (d_mpi.hasReceivableMessage(&mpi_status)) { int count = -1; - mpi_err = tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); + tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); TBOX_ERROR("Library error!\n" << "BergerRigoutsos detected before or after\n" - << "running BergerRigoutsosNode that there\n" + << "the clustering algorithm that there\n" << "is a message yet to be received. This is\n" << "an error because all messages using the\n" << "private communicator should have been\n" @@ -504,42 +1070,86 @@ BergerRigoutsos::assertNoMessageForPrivateCommunicator() const *********************************************************************** */ void -BergerRigoutsos::initializeCallback() +BergerRigoutsos::setTimerPrefix( + const std::string& timer_prefix) { - TBOX_ASSERT(!t_global_reductions); - t_run_abr = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::run_abr"); - t_find_boxes_with_tags = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::find_boxes_with_tags"); - t_global_reductions = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::global_reductions"); - t_sort_output_nodes = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::sort_output_nodes"); - t_barrier_before = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::barrier_before"); - t_barrier_after = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsos::barrier_after"); -} + std::string timer_prefix_used; + if (s_ignore_external_timer_prefix == 'y') { + timer_prefix_used = s_default_timer_prefix; + } else { + timer_prefix_used = timer_prefix; + } + std::map::iterator ti( + s_static_timers.find(timer_prefix_used)); -/* - *************************************************************************** - * - * Release static timers. To be called by shutdown registry to make sure - * memory for timers does not leak. - * - *************************************************************************** - */ -void -BergerRigoutsos::finalizeCallback() -{ - t_barrier_before.reset(); - t_barrier_after.reset(); - t_find_boxes_with_tags.reset(); - t_run_abr.reset(); - t_global_reductions.reset(); - t_sort_output_nodes.reset(); + if (ti != s_static_timers.end()) { + d_object_timers = &(ti->second); + } else { + + d_object_timers = &s_static_timers[timer_prefix_used]; + + tbox::TimerManager* tm = tbox::TimerManager::getManager(); + + d_object_timers->t_find_boxes_containing_tags = tm-> + getTimer(timer_prefix + "::findBoxesContainingTags()"); + + d_object_timers->t_cluster = tm-> + getTimer(timer_prefix_used + "::cluster"); + d_object_timers->t_cluster_and_compute_relationships = tm-> + getTimer(timer_prefix_used + "::clusterAndComputeRelationships()"); + d_object_timers->t_continue_algorithm = tm-> + getTimer(timer_prefix_used + "::continueAlgorithm()"); + + d_object_timers->t_compute = tm-> + getTimer(timer_prefix_used + "::compute"); + d_object_timers->t_comm_wait = tm-> + getTimer(timer_prefix_used + "::Comm_wait"); + d_object_timers->t_MPI_wait = tm-> + getTimer(timer_prefix_used + "::MPI_wait"); + + d_object_timers->t_compute_new_neighborhood_sets = tm-> + getTimer(timer_prefix_used + "::computeNewNeighborhoodSets()"); + d_object_timers->t_share_new_relationships = tm-> + getTimer(timer_prefix_used + "::shareNewNeighborhoodSetsWithOwners()"); + d_object_timers->t_share_new_relationships_send = tm-> + getTimer(timer_prefix_used + "::shareNewNeighborhoodSetsWithOwners()_send"); + d_object_timers->t_share_new_relationships_recv = tm-> + getTimer(timer_prefix_used + "::shareNewNeighborhoodSetsWithOwners()_recv"); + d_object_timers->t_share_new_relationships_unpack = tm-> + getTimer(timer_prefix_used + "::shareNewNeighborhoodSetsWithOwners()_unpack"); + + d_object_timers->t_local_histogram = tm-> + getTimer(timer_prefix_used + "::makeLocalTagHistogram()"); + d_object_timers->t_local_tasks = tm-> + getTimer(timer_prefix_used + "::continueAlgorithm()_local_tasks"); + + // Multi-stage timers + d_object_timers->t_reduce_histogram = tm-> + getTimer(timer_prefix_used + "::reduce_histogram"); + d_object_timers->t_bcast_acceptability = tm-> + getTimer(timer_prefix_used + "::bcast_acceptability"); + d_object_timers->t_gather_grouping_criteria = tm-> + getTimer(timer_prefix_used + "::gather_grouping_criteria"); + d_object_timers->t_bcast_child_groups = tm-> + getTimer(timer_prefix_used + "::bcast_child_groups"); + d_object_timers->t_bcast_to_dropouts = tm-> + getTimer(timer_prefix_used + "::bcast_to_dropouts"); + + // Pre- and post-processing timers. + d_object_timers->t_barrier_before = tm-> + getTimer(timer_prefix + "::barrier_before"); + d_object_timers->t_barrier_after = tm-> + getTimer(timer_prefix + "::barrier_after"); + d_object_timers->t_global_reductions = tm-> + getTimer(timer_prefix + "::global_reductions"); + d_object_timers->t_sort_output_nodes = tm-> + getTimer(timer_prefix + "::sort_output_nodes"); + d_object_timers->t_logging = tm-> + getTimer(timer_prefix + "::logging"); + } + + d_comm_stage.setCommunicationWaitTimer(d_object_timers->t_MPI_wait); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.h index abf7ee1c..28ca4831 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsos.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Asynchronous Berger-Rigoutsos clustering algorithm. * ************************************************************************/ @@ -16,18 +16,22 @@ #include "SAMRAI/hier/Connector.h" #include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/tbox/AsyncCommStage.h" #include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace mesh { +class BergerRigoutsosNode; + /*! * @brief Asynchronous Berger-Rigoutsos implementation. * This class is derived from the abstract base class - * mesh::BoxGeneratorStrategy. Thus, it serves as a concrete + * BoxGeneratorStrategy. Thus, it serves as a concrete * implementation of the box generator Strategy pattern interface. * * This class uses the BergerRigoutsosNode class @@ -39,59 +43,170 @@ namespace mesh { * - Sorts the output data (if user requests). * - Performs some additional error checking. * For more details on the parallel implementation, - * see mesh::BergerRigoutsosNode. - * - * User inputs (default): - * - string @b algo_advance_mode ("ADVANCE_SOME"): - * Asynchronous algorithm advance mode. The default has been - * empirically determined to scale best to higher numbers of - * processors and work adequately for lower numbers of processors. - * - std::string @b owner_mode ("MOST_OVERLAP"): - * How to chose the owner from a dendogram node group. - * This std::string is used in BergerRigoutsosNode::setOwnerMode(). - * - bool @b sort_output_nodes (false): - * Whether to sort the output. This makes the normally - * non-deterministic ordering deterministic and the results repeatable. - * - bool @b max_box_size: - * The maximum cluster dimension allowed. This parameter is not - * critical to clustering but limiting the cluster size may improve - * performance of load balancing algorithms (due to the excessive work - * required by the owner of huge clusters). - * - bool @b check_min_box_size: - * A flag to control how to resolve an initial box that violates the - * minimum box size. Set to one of these strings: - * @b "IGNORE" - violations will be quietly disregarded. - * @b "WARN" - violations will cause a warning but the - * code will continue anyway. - * @b "ERROR" - violations will cause an unrecoverable assertion. - * The default is "WARN". - * - double @b max_lap_cut_from_center (1.0): Limit the Laplace cut to this - * fraction of the distance from the center plane to the end. - * Zero means cut only at the center plane. One means unlimited. - * Under most situations, one is fine. A lower setting helps prevent - * parallel slivers. - * - laplace_cut_threshold_ar (0.0): specifies the mininum box - * thickness that can be cut, as a ratio to the thinnest box - * direction. If the box doesn't have any direction thick - * enough, then it has a reasonable aspect ratio, so we can - * cut it in any direction. - * Degenerate values of laplace_cut_threshold_ar: - * 1: cut any direction except the thinnest. - * (0,1) and huge values: cut any direction. - * 0: Not a degenerate case but a special case meaning always - * cut the thickest direction. This leads to more cubic - * boxes but may prevent cutting at important feature - * changes. - * - * Debugging inputs (default): - * - bool @b log_node_history (false): - * Whether to log what certain actions of nodes in the dendogram. - * This degrades the performance but is a very useful debugging - * tool. - * - bool @b log_cluster_summary (false): - * Whether to briefly log the results of the clustering. - * - bool @b log_cluster (false): - * Whether to log the results of the clustering. + * see BergerRigoutsosNode. + * + * Input Parameters + * + * Definitions: + * - \b max_box_size + * The maximum cluster size allowed. This parameter is not critical to + * clustering but limiting the cluster size may improve performance of + * load balancing algorithms (due to the excessive work required by the + * owner of huge clusters). + * + * - \b sort_output_nodes + * Whether to sort the output. This makes the normally non-deterministic + * ordering deterministic and the results repeatable. + * + * - \b check_min_box_size + * A flag to control how to resolve an initial box that violates the + * minimum box size. Set to one of these strings:
+ * \b "IGNORE" - violations will be quietly disregarded.
+ * \b "WARN" - violations will cause a warning but the code will + * continue anyway.
+ * \b "ERROR" - violations will cause an unrecoverable assertion. + * + * - \b efficiency_tolerance + * each value specifies the minimum fraction of tagged cells to total + * cells in boxes used to construct patches on a new level. If the ratio + * is below the tolerance value, the box may be split into smaller boxes + * and pieces removed until the ratio becomes greater than or equal to + * the tolerance. This tolerance helps users control the amount of extra + * refined cells created (beyond those tagged explicitly) that is typical + * in patch-based AMR computations. The index of the value in the array + * corresponds to the number of the level to which the tolerance value + * applies. If more values are given than the maximum number of levels + * allowed in the hierarchy, extra values will be ignored. If fewer + * values are given, then the last value given will be used for each + * level without a specified input value. For example, if only a single + * value is specified, then that value will be used on all levels. + * + * - \b combine_efficiency + * each value serves as a threshold for the ratio of the total number of + * cells in two boxes into which a box may be split and the number of + * cells in the original box. If that ratio is greater than the combine + * efficiency, the box will not be split. This tolerance helps users + * avoids splitting up portions of the domain into into very small + * patches which can increase the overhead of AMR operations. Multiple + * values in the array are handled similar to efficiency_tolerance. + * + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
max_box_sizeint[]all values max intall values > 0optNot written to restart. Value in input db used.
sort_output_nodesboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
check_min_box_sizestring"WARN""WARN", "IGNORE", "ERROR"optNot written to restart. Value in input db used.
efficiency_tolerancearray of doubles0.8 for each levelall values > 0.0 && < 1.0optNot written to restart. Value in input db used.
combine_efficiencyarray of doubles0.8 for each levelall values > 0.0 && < 1.0optNot written to restart. Value in input db used.
+ * + * + * @internal The following are developer inputs useful for experimentation. + * Defaults are listed in parenthesis: + * + * @internal DEV_algo_advance_mode ("ADVANCE_SOME") + * string + * Asynchronous algorithm advance mode. The default has been empirically + * determined to scale best to higher numbers of processors and work + * adequately for lower numbers of processors. + * + * @internal DEV_owner_mode ("MOST_OVERLAP") + * string + * How to chose the owner from a node group. + * This string is used in BergerRigoutsosNode::setOwnerMode(). + * + * @internal DEV_min_box_size_from_cutting (all members are 0.0) + * int[] + * This is an alternative minimum box size. It helps reduce excessive box + * cutting. If used, a good value is a box with about 3-4 times the volume + * of the minimum size specified by the findBoxesContainingTags() interface. + * + * @internal DEV_max_inflection_cut_from_center (1.0) + * double + * Limit the Laplace cut to this fraction of the distance from the center + * plane to the end. Zero means cut only at the center plane. One means + * unlimited. Under most situations, one is fine. A lower setting helps + * prevent parallel slivers. + * + * @internal DEV_inflection_cut_threshold_ar (0.0) + * double + * Specifies the mininum box thickness that can be cut, as a ratio to the + * thinnest box direction. If the box doesn't have any direction thick + * enough, then it has a reasonable aspect ratio, so we can cut it in any + * direction. + * Degenerate values of DEV_inflection_cut_threshold_ar: + * 1: cut any direction except the thinnest. + * (0,1) and huge values: cut any direction. + * 0: Not a degenerate case but a special case meaning always cut the + * thickest direction. This leads to more cubic boxes but may + * prevent cutting at important feature changes. + * + * @internal The following are developer inputs for debugging. Defaults listed + * in parenthesis: + * + * @internal DEV_log_node_history (false) + * bool + * Whether to log what certain actions of nodes in the tree. + * This degrades the performance but is a very useful debugging tool. + * + * @internal DEV_log_cluster_summary (false) + * bool + * Whether to briefly log the results of the clustering. + * + * @internal DEV_log_cluster (false) + * bool + * Whether to log the results of the clustering. + * + * @internal DEV_build_zero_width_connector (false): + * Build Connectors with zero between the tag level and the new level, + * regardless of the width requested by in the interface + * findBoxesContainingTags(). This forces the calling method to + * recompute the Connectors with the correct width. Using this option + * has some consequences for performance, but whether it is a net gain + * or loss has not been generally established. */ class BergerRigoutsos:public BoxGeneratorStrategy { @@ -102,7 +217,7 @@ class BergerRigoutsos:public BoxGeneratorStrategy */ explicit BergerRigoutsos( const tbox::Dimension& dim, - const boost::shared_ptr& database = + const boost::shared_ptr& input_db = boost::shared_ptr()); /*! @@ -113,32 +228,7 @@ class BergerRigoutsos:public BoxGeneratorStrategy virtual ~BergerRigoutsos(); /*! - * @brief Set the MPI communication object. - * - * Duplicate the communicator in the given for private use. A private - * communicator isolates the complex communications used by the - * asynchronous algorithm from other communications. Duplicating - * the communicator is expensive but should only be need once. All - * processes in the communicator must participate. The duplicate - * communicator is active until this object is destructed. - * Using a duplicated MPI communicator is optional but recommended. - * When a duplicate MPI communicator is in use, it must be congruent - * with the communicator associated with the tag level. - * - * If the communicator is not set, the parallel clustering - * algorithm uses the communicator of the input tag - * mapped_box_level. If it is set, then the algorithm only works - * for input tag mapped_box_levels with a congruent communicator. - * - * If communicator is SAMRAI_MPI::commNull, it is the same as not - * using a duplicate communicator. - */ - void - setMPI( - const tbox::SAMRAI_MPI& mpi); - - /*! - * @brief Implement the mesh::BoxGeneratorStrategy interface + * @brief Implement the BoxGeneratorStrategy interface * method of the same name. * * Create a set of boxes that covers all integer tags on @@ -146,71 +236,535 @@ class BergerRigoutsos:public BoxGeneratorStrategy * Each box will be at least as large as the given minimum * size and the tolerances will be met. * - * The efficiency tolerance is a threshold value for the percentage of - * tagged cells in each box. If this percentage is below the tolerance, - * the box will continue to be split into smaller boxes. - * - * The combine tolerance is a threshold value for the sum of the volumes - * of two boxes into which a box may be potentially split. If ratio of - * that sum and the volume of the original box, the box will not be split. + * @pre !bound_boxes.empty() + * @pre (tag_level->getDim() == (*(bound_boxes.begin())).getDim()) && + * (tag_level->getDim() == min_box.getDim()) && + * (tag_level->getDim() == tag_to_new_width.getDim()) */ void findBoxesContainingTags( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, const boost::shared_ptr& tag_level, const int tag_data_index, const int tag_val, - const hier::Box& bound_box, + const hier::BoxContainer& bound_boxes, const hier::IntVector& min_box, - const double efficiency_tol, - const double combine_tol, - const hier::IntVector& max_gcw, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id) const; + const hier::IntVector& tag_to_new_width); + + /*! + * @brief Duplicate the MPI communication object for private internal use. + * + * A private communicator isolates the complex communications used + * by the asynchronous algorithm from other communications, + * protecting this algorithm from un-related communication bugs. + * Using a duplicated MPI communicator is optional but recommended. + * + * Duplicating the communicator is expensive but need only be done + * once. All processes in the communicator must participate. The + * duplicate communicator is active until this object is destructed + * or you call this method with MPI_COMM_NULL. + * + * When a duplicate MPI communicator is in use, the SAMRAI_MPI object + * from the tag level must be congruent with it. + */ + void + useDuplicateMPI( + const tbox::SAMRAI_MPI& mpi); + + /*! + * @brief Setup names of timers. + * + * By default, timers are named + * "mesh::BergerRigoutsosNode::*", where the third field is + * the specific steps performed by the BergerRigoutsosNode. + * You can override the first two fields with this method. + * Conforming to the timer naming convention, timer_prefix should + * have the form "*::*". + */ + void + setTimerPrefix( + const std::string& timer_prefix); + + /*! + * @brief Get the name of this object. + */ + const std::string + getObjectName() const + { + return "BergerRigoutsos"; + } + + /*! + * @brief Set efficiency tolerance for clustering tags on level. + * + * @param[in] efficiency_tolerance + * @param[in] level_number + * + * @pre level_number >= 0 + * @pre (efficiency_tolerance >= 0) && (efficiency_tolerance <= 1.0) + */ + void + setEfficiencyTolerance( + const double efficiency_tolerance, + const int level_number) + { + TBOX_ASSERT(level_number >= 0); + TBOX_ASSERT((efficiency_tolerance >= 0) && + (efficiency_tolerance <= 1.0)); + int size = static_cast(d_efficiency_tolerance.size()); + if (level_number >= size) { + d_efficiency_tolerance.resize(level_number + 1); + for (int i = size; i < level_number; ++i) { + d_efficiency_tolerance[i] = d_efficiency_tolerance[size - 1]; + } + } + d_efficiency_tolerance[level_number] = efficiency_tolerance; + } + + /*! + * @brief Return efficiency tolerance for clustering tags on level. + * + * @return efficiency tolerance for clustering tags on level. + * + * @pre level_number >= 0 + */ + double + getEfficiencyTolerance( + const int level_number) const + { + TBOX_ASSERT(level_number >= 0); + int size = static_cast(d_efficiency_tolerance.size()); + return (level_number < size) ? + d_efficiency_tolerance[level_number] : + d_efficiency_tolerance[size - 1]; + } + + /*! + * @brief Set combine efficiency for clustering tags on level. + * + * @param[in] combine_efficiency + * @param[in] level_number + * + * @pre level_number >= 0 + * @pre (combine_efficiency >= 0) && (combine_efficiency <= 1.0) + */ + void + setCombineEfficiency( + const double combine_efficiency, + const int level_number) + { + TBOX_ASSERT(level_number >= 0); + TBOX_ASSERT((combine_efficiency >= 0) && (combine_efficiency <= 1.0)); + int size = static_cast(d_combine_efficiency.size()); + if (level_number >= size) { + d_combine_efficiency.resize(level_number + 1); + for (int i = size; i < level_number; ++i) { + d_combine_efficiency[i] = d_combine_efficiency[size - 1]; + } + } + d_combine_efficiency[level_number] = combine_efficiency; + } + + /*! + * @brief Return combine efficiency for clustering tags on level. + * + * @return combine efficiency for clustering tags on level. + * + * @pre level_number >= 0 + */ + double + getCombineEfficiency( + const int level_number) const + { + TBOX_ASSERT(level_number >= 0); + int size = static_cast(d_combine_efficiency.size()); + return (level_number < size) ? + d_combine_efficiency[level_number] : + d_combine_efficiency[size - 1]; + } + +protected: + /*! + * @brief Read parameters from input database. + * + * @param input_db Input Database. + */ + void + getFromInput( + const boost::shared_ptr& input_db); private: - const tbox::Dimension d_dim; + /* + * BergerRigoutsos and BergerRigoutsosNode are tightly coupled. + * Technically, BergerRigoutsosNode can be made a private subclass + * of BergerRigoutsos. BergerRigoutsos has the common parts of the + * data and algorithm. BergerRigoutsosNode has the node-specific + * parts. + */ + friend class BergerRigoutsosNode; + + /*! + * @brief How to choose owner for a new box. + */ + enum OwnerMode { SINGLE_OWNER = 0, + MOST_OVERLAP = 1, + FEWEST_OWNED = 2, + LEAST_ACTIVE = 3 }; + + /*! + * @brief Method for advancing the algorithm. + * + * Each corresponds to a choice permitted by setAlgorithmAdvanceMode(). + */ + enum AlgoAdvanceMode { ADVANCE_ANY, + ADVANCE_SOME, + SYNCHRONOUS }; + + typedef std::set IntSet; + + typedef std::vector VectorOfInts; + + //@{ + //! @name Algorithm mode settings + + /*! + * @brief Set the mode for advancing the asynchronous implementation. + * + * Choices are: + * - @b "SYNCHRONOUS" --> wait for each communication stage to complete + * before moving on, thus resulting in synchronous execution. + * - @b "ADVANCE_ANY" --> advance a node through its + * communication stage by using tbox::AsyncCommStage::advanceAny(). + * - @b "ADVANCE_SOME" --> advance a node through its + * communication stage by using tbox::AsyncCommStage::advanceSome(). + * + * The default is "ADVANCE_SOME". + * + * Asynchronous modes are NOT guaranteed to compute the output + * nodes in any particular order. The order depends on + * the ordering of message completion, which is not deterministic. + * If you require consistent outputs, we suggest you have a scheme + * for reordering the output boxes. + * + * @pre (algo_advance_mode == "ADVANCE_ANY") || + * (algo_advance_mode == "ADVANCE_SOME") || + * (algo_advance_mode == "SYNCHRONOUS") + */ + void + setAlgorithmAdvanceMode( + const std::string& algo_advance_mode); + + /*! + * @brief Set the method for choosing the owner. + * Choices: + * - "MOST_OVERLAP" + * Ownership is given to the processor with the most + * overlap on the candidate box. Default. + * - "SINGLE_OWNER" + * In single-owner mode, the initial owner (process 0) + * always participates and owns all nodes. + * - "FEWEST_OWNED" + * Choose the processor that owns the fewest + * nodes when the choice is made. This is meant to + * relieve bottle-necks caused by excessive ownership. + * This option may lead to non-deterministic ownerships. + * - "LEAST_ACTIVE" + * Choose the processor that participates in the fewest + * number of nodes when the choice is made. + * This is meant to relieve bottle-necks caused by + * excessive participation. This option may lead to + * non-deterministic ownerships. + * + * Experiments show that "MOST_OVERLAP" gives the best + * clustering speed, while "SINGLE_OWNER" may give a faster + * output globalization (since you don't need an all-gather). + * + * @pre (mode == "SINGLE_OWNER") ||(mode == "MOST_OVERLAP") || + * (mode == "FEWEST_OWNED") ||(mode == "LEAST_ACTIVE") + */ + void + setOwnerMode( + const std::string& mode); + + //@} + + /*! + * @brief Check the congruency between d_mpi and d_tag_level's MPI. + */ + bool + checkMPICongruency() const; + + /*! + * @brief Set up data that depend on the MPI communicator being + * used. + */ + void + setupMPIDependentData(); + + /*! + * @brief Run the clustering algorithm to generate the new BoxLevel + * and compute relationships (if specified by setComputeRelationships()). + * + * Sets d_new_box_level and d_tag_to_new. + */ + void + clusterAndComputeRelationships(); + //! @brief Participants send new relationship data to node owners. + void + shareNewNeighborhoodSetsWithOwners(); + + const tbox::Dimension& getDim() const { + return d_tag_level->getDim(); + } + + /*! + * @brief Relationship computation flag. + * + * Valid mode values to set are: + * + * - "NONE" = No relationship computation. + * + * - "TAG_TO_NEW": Compute tag--->new. + * + * - "BIDIRECTIONAL": Compute both tag<==>new. + * + * @pre (mode == "NONE") || (mode == "TAG_TO_NEW") || + * (mode == "BIDIRECTIONAL") + */ + void + setComputeRelationships( + const std::string mode); + + /*! + * @brief Sort boxes in d_new_box_level and update d_tag_to_new. + */ + void + sortOutputBoxes(); + + /*! + * @brief Sanity check on the private communicator, if it is used. + * + * @see useDuplicateMPI(). + */ void assertNoMessageForPrivateCommunicator() const; + //@{ + //! @name Counter methods. + // TODO: Should lock counters while changing them. + + void + resetCounters(); void - sortOutputBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag) const; + writeCounters(); + + void incNumNodesConstructed() { + ++d_num_nodes_constructed; + } + + void incNumNodesExisting() { + ++d_num_nodes_existing; + d_max_nodes_existing = + tbox::MathUtilities::Max(d_num_nodes_existing, d_max_nodes_existing); + } + void incNumNodesActive() { + ++d_num_nodes_active; + d_max_nodes_active = + tbox::MathUtilities::Max(d_num_nodes_active, d_max_nodes_active); + } + void incNumNodesOwned() { + ++d_num_nodes_owned; + d_max_nodes_owned = + tbox::MathUtilities::Max(d_num_nodes_owned, d_max_nodes_owned); + } + void incNumNodesCommWait() { + ++d_num_nodes_commwait; + d_max_nodes_commwait = + tbox::MathUtilities::Max(d_num_nodes_commwait, d_max_nodes_commwait); + } + void incNumNodesCompleted() { + ++d_num_nodes_completed; + } + void incNumContinues(int num_continues) { + d_num_conts_to_complete += num_continues; + d_max_conts_to_complete = + tbox::MathUtilities::Max(d_max_conts_to_complete, num_continues); + } + + void decNumNodesConstructed() { + --d_num_nodes_constructed; + } + void decNumNodesExisting() { + --d_num_nodes_existing; + } + void decNumNodesActive() { + --d_num_nodes_active; + } + void decNumNodesOwned() { + --d_num_nodes_owned; + } + void decNumNodesCommWait() { + --d_num_nodes_commwait; + } + + //@} + + void prependQueue(BergerRigoutsosNode* nodea, + BergerRigoutsosNode* nodeb = 0) + { + TBOX_omp_set_lock(&l_relaunch_queue); + d_relaunch_queue.push_front(nodea); + if (nodeb) { + d_relaunch_queue.push_front(nodeb); + } + TBOX_omp_unset_lock(&l_relaunch_queue); + } + + const tbox::Dimension d_dim; + + //@{ + //@name Parameters from clustering algorithm virtual interface + int d_tag_data_index; + int d_tag_val; + int d_level_number; + hier::IntVector d_min_box; + hier::IntVector d_tag_to_new_width; + //@} /*! - * @brief Set up things for the entire class. + * @brief Level where tags live. + */ + boost::shared_ptr d_tag_level; + + /*! + * @brief New BoxLevel generated by BR. + * + * This is where we store the boxes as we progress in the BR algorithm. * - * Only called by StartupShutdownManager. + * This is set in the public clusterAndComputeRelationships() method. */ - static void - initializeCallback(); + boost::shared_ptr d_new_box_level; /*! - * @brief Free static timers. + * @brief Connector from tag_box_level to new_box_level. * - * Only called by StartupShutdownManager. + * This is where we store the relationships resulting from the BR + * algorithm. The relationships are created locally for local nodes in + * tag_box_level. + * + * This is set in the public clusterAndComputeRelationships method. */ - static void - finalizeCallback(); + boost::shared_ptr d_tag_to_new; - //! @brief Communication object. - tbox::SAMRAI_MPI d_mpi; + //! @brief Initial boxes for top-down clustering. + hier::BoxContainer d_root_boxes; - //! @brief Max box size constraint used by BergerRigoutsosNode. + //! @brief Max box size constraint. hier::IntVector d_max_box_size; - //! @brief Max distance from center for Laplace cut. - double d_max_lap_cut_from_center; + //! @brief Max distance from center for inflection cut. + double d_max_inflection_cut_from_center; + + //! @brief Threshold for avoiding thinner directions for Laplace cut. + double d_inflection_cut_threshold_ar; + + //! @brief How to advance asynchronously. + AlgoAdvanceMode d_algo_advance_mode; + + //! @brief How to chose the group's owner. + OwnerMode d_owner_mode; + + /*! + * @brief Relationship computation flag. + * + * See setComputeRelationships(). + * - 0 = NONE + * - 1 = TAG_TO_NEW + * - 2 = BIDIRECTIONAL + */ + int d_compute_relationships; + + //! @brief Whether to sort results to make them deterministic. + bool d_sort_output_nodes; + + /*! + * @brief Whether to build tag<==>new Connectors width of zero, + * disregarding the width specified in findBoxesContainingTags(). + */ + bool d_build_zero_width_connector; + + /*! + * @brief Efficiency tolerance during clustering. + * + * See input parameter efficiency_tolerance. + */ + std::vector d_efficiency_tolerance; + + /* + * @brief Combine efficiency during clustering. + * + * See input parameter combine_efficiency. + */ + std::vector d_combine_efficiency; + + /*! + * @brief Queue on which to append jobs to be + * launched or relaunched. + */ + std::list d_relaunch_queue; + TBOX_omp_lock_t l_relaunch_queue; - //! @brief Threshold for avoiding thinner dimensions for Laplace cut. - double d_laplace_cut_threshold_ar; + /*! + * @brief Stage handling multiple asynchronous communication groups. + */ + tbox::AsyncCommStage d_comm_stage; - //! @brief Whether to log execution node allocation and deallocation. + /*! + * @brief Alternate minimum box size applying to inflection + * point cuts. + * + * This size can be greater than the absolute min_size + * specified by the + * BoxGeneratorStrategy::findBoxesContainingTags() abstract + * interface. + */ + hier::IntVector d_min_box_size_from_cutting; + + /*! + * @brief List of processes that will send neighbor data + * for locally owned boxes after the BR algorithm completes. + */ + IntSet d_relationship_senders; + + /*! + * @brief Outgoing messages to be sent to node owners + * describing new relationships found by local process. + */ + std::map d_relationship_messages; + + //@{ + //! @name Communication parameters + /*! + * @brief MPI communicator used in communications by the algorithm. + * + * @see useDuplicateMPI(). + */ + tbox::SAMRAI_MPI d_mpi; + //! @brief Upperbound of valid tags. + int d_tag_upper_bound; + //! @brief Smallest unclaimed MPI tag in pool given to local process. + int d_available_mpi_tag; + //@} + + //@{ + //! @name Auxiliary data for analysis and debugging. + + //! @brief Whether to log major actions of primary do loop. + bool d_log_do_loop; + + //! @brief Whether to log major actions of nodes. bool d_log_node_history; //! @brief Whether to briefly log cluster summary. @@ -219,17 +773,54 @@ class BergerRigoutsos:public BoxGeneratorStrategy //! @brief Whether to log cluster summary. bool d_log_cluster; - //! @brief How to select the owner of a node. - std::string d_owner_mode; + //! @brief How to resolve initial boxes smaller than min box size. + char d_check_min_box_size; - //! @brief Asynchronous mode for advancing algorithm. - std::string d_algo_advance_mode; + //! @brief Number of tags. + int d_num_tags_in_all_nodes; - //! @brief Whether to sort results to make them deterministic. - bool d_sort_output_nodes; + //! @brief Max number of tags owned. + int d_max_tags_owned; - //! @brief How to resolve initial boxes smaller than min box size. - char d_check_min_box_size; + //! @brief Number of nodes constructed. + int d_num_nodes_constructed; + + //! @brief Current number of nodes existing. + int d_num_nodes_existing; + //! @brief Highest number of nodes existing. + int d_max_nodes_existing; + + //! @brief Current number of nodes active. + int d_num_nodes_active; + //! @brief Highest number of nodes active. + int d_max_nodes_active; + + //! @brief Current number of nodes owned. + int d_num_nodes_owned; + //! @brief Highest number of nodes owned. + int d_max_nodes_owned; + + //! @brief Current number of nodes in communication wait. + int d_num_nodes_commwait; + //! @brief Highest number of nodes in communication wait. + int d_max_nodes_commwait; + + //! @brief Current number of completed. + int d_num_nodes_completed; + + //! @brief Highest number of generation. + int d_max_generation; + + //! @brief Current number of boxes generated. + int d_num_boxes_generated; + + //! @brief Number of continueAlgorithm calls for to complete nodes. + int d_num_conts_to_complete; + + //! @brief Highest number of continueAlgorithm calls to complete nodes. + int d_max_conts_to_complete; + + //@} //@{ //! @name Used for evaluating performance; @@ -237,15 +828,71 @@ class BergerRigoutsos:public BoxGeneratorStrategy bool d_barrier_after; //@} - static boost::shared_ptr t_barrier_before; - static boost::shared_ptr t_barrier_after; - static boost::shared_ptr t_find_boxes_with_tags; - static boost::shared_ptr t_run_abr; - static boost::shared_ptr t_global_reductions; - static boost::shared_ptr t_sort_output_nodes; + //@{ + //! @name Performance timer data for this class. - static tbox::StartupShutdownManager::Handler - s_initialize_finalize_handler; + /* + * @brief Structure of timers used by this class. + * + * Each object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_barrier_before; + boost::shared_ptr t_barrier_after; + + boost::shared_ptr t_find_boxes_containing_tags; + boost::shared_ptr t_cluster; + boost::shared_ptr t_cluster_and_compute_relationships; + boost::shared_ptr t_continue_algorithm; + boost::shared_ptr t_compute; + boost::shared_ptr t_comm_wait; + boost::shared_ptr t_MPI_wait; + boost::shared_ptr t_compute_new_neighborhood_sets; + boost::shared_ptr t_share_new_relationships; + boost::shared_ptr t_share_new_relationships_send; + boost::shared_ptr t_share_new_relationships_recv; + boost::shared_ptr t_share_new_relationships_unpack; + boost::shared_ptr t_local_tasks; + boost::shared_ptr t_local_histogram; + /* + * Multi-stage timers. These are used in continueAlgorithm() + * instead of the methods they time, because what they time may + * include waiting for messages. They are included in the + * timer t_continue_algorithm. They provide timing breakdown + * for the different stages. + */ + boost::shared_ptr t_reduce_histogram; + boost::shared_ptr t_bcast_acceptability; + boost::shared_ptr t_gather_grouping_criteria; + boost::shared_ptr t_bcast_child_groups; + boost::shared_ptr t_bcast_to_dropouts; + + boost::shared_ptr t_global_reductions; + boost::shared_ptr t_logging; + boost::shared_ptr t_sort_output_nodes; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + static char s_ignore_external_timer_prefix; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + //@} }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.C index a88602e7..ab6f2bd4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.C @@ -3,22 +3,21 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Node in asynchronous Berger-Rigoutsos dendogram + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Node in asynchronous Berger-Rigoutsos tree * ************************************************************************/ -#ifndef included_mesh_BergerRigoutsosNode_C -#define included_mesh_BergerRigoutsosNode_C - #include -#include #include #include "SAMRAI/mesh/BergerRigoutsosNode.h" +#include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxUtilities.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" @@ -36,119 +35,98 @@ namespace mesh { const int BergerRigoutsosNode::BAD_INTEGER = -9999999; -tbox::StartupShutdownManager::Handler -BergerRigoutsosNode::s_initialize_handler( - BergerRigoutsosNode::initializeCallback, - 0, - 0, - BergerRigoutsosNode::finalizeCallback, - tbox::StartupShutdownManager::priorityTimers); - -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_cluster; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_cluster_and_compute_relationships; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_continue_algorithm; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_compute; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_comm_wait; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_MPI_wait; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_compute_new_graph_relationships; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_share_new_relationships; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_share_new_relationships_send; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_share_new_relationships_recv; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_share_new_relationships_unpack; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_local_tasks; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_local_histogram; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_reduce_histogram; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_bcast_acceptability; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_gather_grouping_criteria; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_bcast_child_groups; -boost::shared_ptr BergerRigoutsosNode::CommonParams::t_bcast_to_dropouts; - /* ******************************************************************* - * Construct root node of the dendogram. + * Construct root node for a single block. ******************************************************************* */ BergerRigoutsosNode::BergerRigoutsosNode( - const tbox::Dimension& dim, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id): - d_dim(dim), + BergerRigoutsos* common, + const hier::Box& box): d_pos(1), - d_common(new CommonParams(d_dim)), - d_parent(NULL), - d_lft_child(NULL), - d_rht_child(NULL), - d_box(d_dim), - d_owner(0), + d_common(common), + d_parent(0), + d_lft_child(0), + d_rht_child(0), + d_box(box), d_group(0), + d_min_box_size(common->d_min_box.getBlockVector(box.getBlockId())), d_mpi_tag(-1), - d_overlap(-1), + d_overlap(tbox::MathUtilities::getMax()), d_box_acceptance(undetermined), - d_mapped_box(d_dim), - d_mapped_box_iterator(hier::BoxContainer().end()), + d_box_iterator(hier::BoxContainer().end()), d_wait_phase(to_be_launched), d_send_msg(), d_recv_msg(), - d_comm_group(NULL), - d_block_id(block_id), - d_first_local_id(first_local_id), + d_comm_group(0), d_generation(1), d_n_cont(0) { + if (box.empty()) { + TBOX_ERROR("BergerRigoutsosNode: Library error: constructing\n" + << "root node with an empty box."); + } + + d_common->incNumNodesConstructed(); + d_common->incNumNodesExisting(); + if (d_box.getOwnerRank() == d_common->d_mpi.getRank()) { + d_common->incNumNodesOwned(); + } + + if (d_common->d_max_generation < d_generation) { + d_common->d_max_generation = d_generation; + } + + if (d_common->d_mpi.getRank() == 0) { + claimMPITag(); + } else { + d_mpi_tag = 0; + } - ++(d_common->num_nodes_owned); - ++(d_common->max_nodes_owned); - ++(d_common->num_nodes_allocated); - ++(d_common->max_nodes_allocated); - if (d_common->max_generation < d_generation) { - d_common->max_generation = d_generation; + /* + * Set the processor group. + */ + d_group.resize(d_common->d_mpi.getSize(), BAD_INTEGER); + for (unsigned int i = 0; i < d_group.size(); ++i) { + d_group[i] = i; } - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Construct " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Construct root " << d_generation << ':' << d_pos + << ' ' << d_box << ".\n"; } } /* ******************************************************************* - * Construct non-root node of the dendogram. This is private! - * Public constructors are only for root nodes. + * Construct non-root node of the tree. ******************************************************************* */ BergerRigoutsosNode::BergerRigoutsosNode( - CommonParams* common_params, + BergerRigoutsos* common_params, BergerRigoutsosNode* parent, - const int child_number, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id): - d_dim(parent->d_dim), + const int child_number): d_pos((parent->d_pos > 0 && parent->d_pos < tbox::MathUtilities::getMax() / 2) ? 2 * parent->d_pos + child_number : (child_number == 0 ? -1 : -2)), d_common(common_params), d_parent(parent), - d_lft_child(NULL), - d_rht_child(NULL), - d_box(d_dim), - d_owner(-1), + d_lft_child(0), + d_rht_child(0), + d_box(common_params->getDim()), d_group(0), + d_min_box_size(d_parent->d_min_box_size), d_mpi_tag(-1), - d_overlap(-1), + d_overlap(tbox::MathUtilities::getMax()), d_box_acceptance(undetermined), - d_mapped_box(d_dim), - d_mapped_box_iterator(hier::BoxContainer().end()), + d_box_iterator(hier::BoxContainer().end()), d_wait_phase(for_data_only), d_send_msg(), d_recv_msg(), - d_comm_group(NULL), - d_block_id(block_id), - d_first_local_id(first_local_id), + d_comm_group(0), d_generation(d_parent->d_generation + 1), d_n_cont(0) { @@ -165,24 +143,22 @@ BergerRigoutsosNode::BergerRigoutsosNode( #endif #ifdef DEBUG_CHECK_ASSERTIONS - d_mapped_box_iterator = BoxContainer().end(); + d_box_iterator = hier::BoxContainer().end(); #endif - ++(d_common->num_nodes_allocated); - ++(d_common->max_nodes_allocated); - if (d_common->max_generation < d_generation) { - d_common->max_generation = d_generation; + d_common->incNumNodesConstructed(); + d_common->incNumNodesExisting(); + + if (d_common->d_max_generation < d_generation) { + d_common->d_max_generation = d_generation; } - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Construct " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Construct " << d_generation << ':' << d_pos << ", child of " << d_parent->d_generation << ':' << d_parent->d_pos - << " " << d_parent->d_mapped_box + << " " << d_parent->d_box << ".\n"; } } @@ -201,399 +177,32 @@ BergerRigoutsosNode::~BergerRigoutsosNode() d_wait_phase != completed) { TBOX_ERROR("Should not delete a node that is currently running\n" << "the Berger-Rigoutsos algorithm because there\n" - << "may be pending communications."); + << "may be pending communications." << std::endl); } #endif - if (d_comm_group != NULL) { + if (d_comm_group != 0) { if (!d_comm_group->isDone()) { TBOX_ERROR("Library error: Destructing a node with an unfinished\n" << "communication tree is bad because it leaves\n" - << "pending MPI messages."); + << "pending MPI messages." << std::endl); } delete d_comm_group; - d_comm_group = NULL; + d_comm_group = 0; } - --(d_common->num_nodes_allocated); - - if (d_parent != NULL && d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Destruct " << d_generation << ':' << d_pos - << " " << d_mapped_box + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Destruct " << d_generation << ':' << d_pos << " " << d_box << ".\n"; } - if (d_parent == NULL) { - delete d_common; - } + d_common->decNumNodesExisting(); d_wait_phase = deallocated; } -/* - ******************************************************************** - ******************************************************************** - */ -void -BergerRigoutsosNode::setClusteringParameters( - const int tag_data_index, - const int tag_val, - const hier::IntVector min_box, - const double efficiency_tol, - const double combine_tol, - const hier::IntVector& max_box_size, - const double max_lap_cut_from_center, - const double laplace_cut_threshold_ar) -{ - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, min_box, max_box_size); - - d_common->tag_data_index = tag_data_index; - d_common->tag_val = tag_val; - d_common->min_box = min_box; - d_common->efficiency_tol = efficiency_tol; - d_common->combine_tol = combine_tol; - d_common->max_box_size = max_box_size; - d_common->max_lap_cut_from_center = max_lap_cut_from_center; - d_common->laplace_cut_threshold_ar = laplace_cut_threshold_ar; -} - -/* - ******************************************************************** - ******************************************************************** - */ -void -BergerRigoutsosNode::clusterAndComputeRelationships( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - const hier::Box& bound_box, - const boost::shared_ptr& tag_level, - const tbox::SAMRAI_MPI& mpi_object) -{ - TBOX_ASSERT(d_parent == NULL); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, - new_mapped_box_level, - bound_box, - *tag_level); - - d_common->tag_level = tag_level; - d_common->tag_mapped_box_level = tag_level->getBoxLevel().get(); - - setMPI(mpi_object); - - d_box = bound_box; - - /* - * During the algorithm, we kept the results in primitive - * containers to avoid the overhead of fine-grain changes to the - * output objects. Now initialize the outputs using those - * primitive containers. - */ - - new_mapped_box_level.initialize( - d_common->tag_level->getRatioToLevelZero(), - d_common->tag_level->getGridGeometry(), - d_common->tag_mapped_box_level->getMPI(), - hier::BoxLevel::DISTRIBUTED); - - if (d_common->compute_relationships >= 1) { - tag_to_new.clearNeighborhoods(); - tag_to_new.setBase(*tag_level->getBoxLevel()); - tag_to_new.setHead(new_mapped_box_level); - tag_to_new.setWidth(d_common->max_gcw, true); - } - if (d_common->compute_relationships >= 2) { - new_to_tag.clearNeighborhoods(); - new_to_tag.setBase(new_mapped_box_level); - new_to_tag.setHead(*tag_level->getBoxLevel()); - new_to_tag.setWidth(d_common->max_gcw, true); - } - - d_common->new_mapped_box_level = &new_mapped_box_level; - d_common->tag_to_new = &tag_to_new; - d_common->new_to_tag = &new_to_tag; - - clusterAndComputeRelationships(); - - new_mapped_box_level.finalize(); - - /* - * Clear temporary parameters that are only used during active - * clustering. - */ - d_common->new_mapped_box_level = NULL; - d_common->tag_to_new = NULL; - d_common->new_to_tag = NULL; - d_common->tag_mapped_box_level = NULL; - d_common->tag_level.reset(); -} - -/* - ******************************************************************** - * Preprocess, run the asynchronous algorithm and postprocess. - ******************************************************************** - */ -void -BergerRigoutsosNode::clusterAndComputeRelationships() -{ - TBOX_ASSERT(d_parent == NULL); - tbox::SAMRAI_MPI mpi(d_common->mpi_object); - - d_common->t_cluster_and_compute_relationships->start(); - d_common->t_cluster->start(); - - /* - * If compute_relationships == 1: - * - Compute relationships from tagged level to new levels. - * These relationships are organized around the tagged nodes. - * They do not need to be shared with the owners of the - * new nodes. - * - * If compute_relationships == 2: - * - Compute relationships as in compute_relationships == 1 case. - * - Owners of new relationships send new relationship data to owners - * of new nodes. This creates the neighbor data - * organized around the new nodes. - */ - - if (d_common->compute_relationships > 0) { - - /* - * Create empty neighbor lists for nodes on tagged mapped_box_level. - * As new nodes are finalized, they will be added to - * these lists. - */ - const BoxContainer& tag_mapped_boxes = - d_common->tag_mapped_box_level->getBoxes(); - for (hier::RealBoxConstIterator ni(tag_mapped_boxes.realBegin()); - ni != tag_mapped_boxes.realEnd(); ++ni) { - d_common->tag_to_new->makeEmptyLocalNeighborhood(ni->getId()); - } - TBOX_ASSERT( - static_cast(d_common->tag_mapped_box_level->getLocalNumberOfBoxes()) == - d_common->tag_to_new->getLocalNumberOfNeighborSets()); - - } - - TBOX_ASSERT(d_common->algo_advance_mode == ADVANCE_SOME || - d_common->algo_advance_mode == ADVANCE_ANY || - d_common->algo_advance_mode == SYNCHRONOUS); // No other supported currently. - { - int n_comm_group_completed = 0; - // d_common->relaunch_queue.appendItem(this); - d_common->relaunch_queue.push_back(this); - - - do { - - d_common->t_compute->start(); - while (!d_common->relaunch_queue.empty()) { - BergerRigoutsosNode* node_for_relaunch = d_common->relaunch_queue.front(); - d_common->relaunch_queue.pop_front(); - if (0) { - tbox::plog << "Continuing from queue "; - node_for_relaunch->printState(tbox::plog); - tbox::plog << std::endl; - } - node_for_relaunch->continueAlgorithm(); - if (0) { - tbox::plog << "Exiting continueAlgorithm "; - node_for_relaunch->printState(tbox::plog); - tbox::plog << std::endl; - } - } - d_common->t_compute->stop(); - - d_common->t_comm_wait->start(); - n_comm_group_completed = - static_cast(d_common->comm_stage.advanceSome()); - d_common->t_comm_wait->stop(); - - d_common->t_compute->start(); - while ( d_common->comm_stage.numberOfCompletedMembers() > 0 ) { - BergerRigoutsosNode* node_for_relaunch = - (BergerRigoutsosNode *)(d_common->comm_stage.popCompletionQueue()->getHandler()); - if (0) { - tbox::plog << "Continuing from stage "; - node_for_relaunch->printState(tbox::plog); - tbox::plog << std::endl; - } - node_for_relaunch->continueAlgorithm(); - if (0) { - tbox::plog << "Exiting continueAlgorithm "; - node_for_relaunch->printState(tbox::plog); - tbox::plog << std::endl; - } - } - d_common->t_compute->stop(); - - if (0) { - tbox::plog << "relaunch_queue size " - << d_common->relaunch_queue.size() - << " groups completed: " << n_comm_group_completed - << std::endl; - tbox::plog << "Stage has " << d_common->comm_stage.numberOfMembers() - << " members, " - << d_common->comm_stage.numberOfPendingMembers() - << " pending members, " - << d_common->comm_stage.numberOfPendingRequests() - << " pending requests." << std::endl; - } - } while ( !d_common->relaunch_queue.empty() || d_common->comm_stage.hasPendingRequests() ); - - } - -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_wait_phase != completed) { - printDendogramState(tbox::plog, "ERR->"); - TBOX_ERROR( - "Root node finished but d_wait_phase is not set to completed.\n" - << "d_wait_phase=" << d_wait_phase); - } - if (d_common->compute_relationships > 2) { - // Each new node should have its own neighbor list. - TBOX_ASSERT(d_common->new_mapped_box_level->getBoxes().size() == - d_common->new_to_tag->getLocalNumberOfNeighborSets()); - } -#endif - - // Barrier to separate clustering cost from relationship sharing cost. - mpi.Barrier(); - - d_common->t_cluster->stop(); - - /* - * Share relationships with owners, if requested. - * This is a one-time operation that is not considered a part - * of continueAlgorithm(), so it lies outside that timimg. - */ - if (d_common->compute_relationships > 1) { - shareNewNeighborhoodSetsWithOwners(); - } - - d_common->t_cluster_and_compute_relationships->stop(); -} - -/* - ************************************************************************** - * This private method sets multiple internal data and presumes that - * d_common->tag_level has been set. - ************************************************************************** - */ -void -BergerRigoutsosNode::setMPI( - const tbox::SAMRAI_MPI& mpi_object) -{ - TBOX_ASSERT(d_parent == NULL); - TBOX_ASSERT(d_common->tag_mapped_box_level != NULL); - - /* - * If a valid MPI communicator is given, use it instead of the - * tag_mapped_box_level's communicator. It must be congruent with - * the tag_mapped_box_level's. - */ - if (mpi_object.getCommunicator() != tbox::SAMRAI_MPI::commNull) { -#if defined(DEBUG_CHECK_ASSERTIONS) - /* - * If user supply a communicator to use, make sure it is - * compatible with the BoxLevel involved. - */ - tbox::SAMRAI_MPI mpi1(mpi_object); - tbox::SAMRAI_MPI mpi2(d_common->tag_mapped_box_level->getMPI()); - TBOX_ASSERT(mpi1.getSize() == mpi2.getSize()); - TBOX_ASSERT(mpi1.getRank() == mpi2.getRank()); - if (mpi1.getSize() > 1) { - int compare_result; - tbox::SAMRAI_MPI::Comm_compare( - mpi_object.getCommunicator(), - d_common->tag_mapped_box_level->getMPI().getCommunicator(), - &compare_result); - if (compare_result != MPI_CONGRUENT) { - TBOX_ERROR("BergerRigoutsosNode::setMPI:\n" - << "MPI communicator (" << mpi_object.getCommunicator() - << ") and the communicator of the input tag_mapped_box_level (" - << d_common->tag_mapped_box_level->getMPI().getCommunicator() - << ") are not congruent."); - } - } -#endif - d_common->mpi_object = mpi_object; - } else { - d_common->mpi_object = - d_common->tag_mapped_box_level->getMPI(); - } - - tbox::SAMRAI_MPI mpi(d_common->mpi_object); - - /* - * Reserve the tag upper bound for the relationship-sharing phase. - * Divide the rest into tag pools divided among all processes. - */ - if (tbox::SAMRAI_MPI::usingMPI()) { - /* - * For some MPI implementations, I cannot get the attribute for - * any communicator except for MPI_COMM_WORLD. Assuming the tag - * upper bound is the same for all communicators, I will try - * some other communicators to get it. - */ - int* tag_upper_bound_ptr, flag; - mpi.Attr_get(MPI_TAG_UB, - &tag_upper_bound_ptr, - &flag); - if (tag_upper_bound_ptr == NULL) { - tbox::SAMRAI_MPI mpi1(tbox::SAMRAI_MPI::getSAMRAIWorld().getCommunicator()); - mpi1.Attr_get(MPI_TAG_UB, - &tag_upper_bound_ptr, - &flag); - } - if (tag_upper_bound_ptr == NULL) { - tbox::SAMRAI_MPI mpi1(tbox::SAMRAI_MPI::commWorld); - mpi1.Attr_get(MPI_TAG_UB, - &tag_upper_bound_ptr, - &flag); - } - TBOX_ASSERT(tag_upper_bound_ptr != NULL); - d_common->tag_upper_bound = *tag_upper_bound_ptr; - - } else { - d_common->tag_upper_bound = 1000000; - } - - d_common->nproc = mpi.getSize(); - d_common->rank = mpi.getRank(); - - d_common->available_mpi_tag = - d_common->tag_upper_bound / d_common->nproc * d_common->rank; - - // Divide the rest into tag pools divided among all processes. - d_common->available_mpi_tag = d_common->tag_upper_bound / d_common->nproc - * d_common->rank; - - if (d_common->rank == 0) { - claimMPITag(); - } else { - d_mpi_tag = 0; - } - /* - * Even though owner has different way of getting MPI tag, - * all processes should start with the same mpi tag. - */ - TBOX_ASSERT(d_mpi_tag == 0); - - /* - * Set the processor group (for the root dendogram node). - */ - d_group.resize(d_common->nproc, BAD_INTEGER); - for (unsigned int i = 0; i < d_group.size(); ++i) { - d_group[i] = i; - } -} - /* ******************************************************************** * This method looks messy, but it is just the BR agorithm, @@ -608,12 +217,11 @@ BergerRigoutsosNode::setMPI( BergerRigoutsosNode::WaitPhase BergerRigoutsosNode::continueAlgorithm() { - d_common->t_continue_algorithm->start(); + d_common->d_object_timers->t_continue_algorithm->start(); ++d_n_cont; - TBOX_ASSERT(d_parent == NULL || d_parent->d_wait_phase != completed); - // TBOX_ASSERT( ! inRelaunchQueue(this) ); - TBOX_ASSERT(inRelaunchQueue(this) == d_common->relaunch_queue.end()); + TBOX_ASSERT(d_parent == 0 || d_parent->d_wait_phase != completed); + TBOX_ASSERT(inRelaunchQueue(this) == d_common->d_relaunch_queue.end()); /* * Skip right to where we left off, @@ -621,7 +229,8 @@ BergerRigoutsosNode::continueAlgorithm() */ switch (d_wait_phase) { case for_data_only: - TBOX_ERROR("Library error: Attempt to execute data-only node."); + TBOX_ERROR("Library error: Attempt to execute data-only node." + << std::endl); case to_be_launched: goto TO_BE_LAUNCHED; case reduce_histogram: @@ -637,9 +246,10 @@ BergerRigoutsosNode::continueAlgorithm() case bcast_to_dropouts: goto BCAST_TO_DROPOUTS; case completed: - TBOX_ERROR("Library error: Senseless continuation of completed node."); + TBOX_ERROR("Library error: Senseless continuation of completed node." + << std::endl); default: - TBOX_ERROR("Library error: Nonexistent phase."); + TBOX_ERROR("Library error: Nonexistent phase." << std::endl); } bool sub_completed; @@ -655,37 +265,32 @@ BergerRigoutsosNode::continueAlgorithm() TO_BE_LAUNCHED: - ++(d_common->num_nodes_active); - if (d_common->max_nodes_active < d_common->num_nodes_active) { - d_common->max_nodes_active = d_common->num_nodes_active; - } + d_common->incNumNodesActive(); - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Commence " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Commence " << d_generation << ':' << d_pos << " " << d_box << " accept=" << d_box_acceptance << " ovlap=" << d_overlap - << " owner=" << d_owner + << " owner=" << d_box.getOwnerRank() << " gsize=" << d_group.size() << ".\n"; } - if (d_parent == NULL || d_overlap > 0 || d_common->rank == d_owner) { + if (d_parent == 0 || d_overlap > 0 || d_common->d_mpi.getRank() == d_box.getOwnerRank()) { TBOX_ASSERT(inGroup(d_group)); // Set up communication group for operations in participating group. d_comm_group = new tbox::AsyncCommGroup( computeCommunicationTreeDegree(static_cast(d_group.size())), - &d_common->comm_stage, + &d_common->d_comm_stage, this); - d_comm_group->setGroupAndRootRank(d_common->mpi_object, - &d_group[0], static_cast(d_group.size()), d_owner); - if (d_parent == NULL) { + d_comm_group->setUseBlockingSendToParent(false); + d_comm_group->setGroupAndRootRank(d_common->d_mpi, + &d_group[0], static_cast(d_group.size()), d_box.getOwnerRank()); + if (d_parent == 0) { /* * For the global group, MPI collective functions are presumably * faster than the peer-to-peer collective implementation in @@ -699,35 +304,37 @@ TO_BE_LAUNCHED: d_comm_group->setUseMPICollectiveForFullGroups(true); } - d_common->t_local_tasks->start(); + d_common->d_object_timers->t_local_tasks->start(); makeLocalTagHistogram(); - d_common->t_local_tasks->stop(); + d_common->d_object_timers->t_local_tasks->stop(); if (d_group.size() > 1) { - d_common->t_reduce_histogram->start(); + d_common->d_object_timers->t_reduce_histogram->start(); reduceHistogram_start(); + d_common->incNumNodesCommWait(); REDUCE_HISTOGRAM: - if (!d_common->t_reduce_histogram->isRunning()) - d_common->t_reduce_histogram->start(); - if (d_common->algo_advance_mode == SYNCHRONOUS) { + if (!d_common->d_object_timers->t_reduce_histogram->isRunning()) + d_common->d_object_timers->t_reduce_histogram->start(); + if (d_common->d_algo_advance_mode == BergerRigoutsos::SYNCHRONOUS) { d_comm_group->completeCurrentOperation(); } sub_completed = reduceHistogram_check(); - d_common->t_reduce_histogram->stop(); + d_common->d_object_timers->t_reduce_histogram->stop(); if (!sub_completed) { d_wait_phase = reduce_histogram; goto RETURN; } + d_common->decNumNodesCommWait(); } - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { /* * The owner node saves the tag count. Participant nodes get * tag count from broadcastAcceptability(). This data is just for * analysis (not required) and I expect it to have trivial cost. */ int narrowest_dir = 0; - for (int d = 0; d < d_dim.getValue(); ++d) { + for (int d = 0; d < d_common->getDim().getValue(); ++d) { if (d_histogram[d].size() < d_histogram[narrowest_dir].size()) narrowest_dir = d; } @@ -740,21 +347,21 @@ REDUCE_HISTOGRAM: * If this is the root node, d_num_tags is the total tag count * in all nodes. */ - if (d_parent == NULL) { - d_common->num_tags_in_all_nodes = d_num_tags; + if (d_parent == 0) { + d_common->d_num_tags_in_all_nodes += d_num_tags; } } - if (d_common->rank == d_owner) { - d_common->t_local_tasks->start(); + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { + d_common->d_object_timers->t_local_tasks->start(); computeMinimalBoundingBoxForTags(); acceptOrSplitBox(); - d_common->t_local_tasks->stop(); + d_common->d_object_timers->t_local_tasks->stop(); TBOX_ASSERT(boxAccepted() || boxRejected() || (boxHasNoTag() && d_parent == 0)); if (!boxHasNoTag()) { /* - * A mapped_box_level node is created even if box is not acceptable, + * A box_level node is created even if box is not acceptable, * so that the children can reference its local index in case * the box is later accepted based on the combined tolerance * of the children. The node would be erased later if @@ -765,23 +372,25 @@ REDUCE_HISTOGRAM: } if (d_group.size() > 1) { - d_common->t_bcast_acceptability->start(); + d_common->d_object_timers->t_bcast_acceptability->start(); broadcastAcceptability_start(); + d_common->incNumNodesCommWait(); BCAST_ACCEPTABILITY: - if (!d_common->t_bcast_acceptability->isRunning()) - d_common->t_bcast_acceptability->start(); - if (d_common->algo_advance_mode == SYNCHRONOUS) { + if (!d_common->d_object_timers->t_bcast_acceptability->isRunning()) + d_common->d_object_timers->t_bcast_acceptability->start(); + if (d_common->d_algo_advance_mode == BergerRigoutsos::SYNCHRONOUS) { d_comm_group->completeCurrentOperation(); } sub_completed = broadcastAcceptability_check(); - d_common->t_bcast_acceptability->stop(); + d_common->d_object_timers->t_bcast_acceptability->stop(); if (!sub_completed) { d_wait_phase = bcast_acceptability; goto RETURN; } + d_common->decNumNodesCommWait(); } #ifdef DEBUG_CHECK_ASSERTIONS - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { TBOX_ASSERT(d_box_acceptance == accepted_by_calculation || d_box_acceptance == rejected_by_calculation || d_box_acceptance == hasnotag_by_owner); @@ -796,8 +405,8 @@ BCAST_ACCEPTABILITY: * If this is the root node, d_num_tags is the total tag count * in all nodes. */ - if (d_parent == NULL && d_common->rank != d_owner) { - d_common->num_tags_in_all_nodes = d_num_tags; + if (d_parent == 0 && d_common->d_mpi.getRank() != d_box.getOwnerRank()) { + d_common->d_num_tags_in_all_nodes += d_num_tags; } if (boxRejected()) { @@ -806,57 +415,59 @@ BCAST_ACCEPTABILITY: * Compute children groups and owners without assuming * entire mesh structure is known locally. */ - d_common->t_local_tasks->start(); + d_common->d_object_timers->t_local_tasks->start(); countOverlapWithLocalPatches(); - d_common->t_local_tasks->stop(); + d_common->d_object_timers->t_local_tasks->stop(); if (d_group.size() > 1) { - d_common->t_gather_grouping_criteria->start(); + d_common->d_object_timers->t_gather_grouping_criteria->start(); gatherGroupingCriteria_start(); + d_common->incNumNodesCommWait(); GATHER_GROUPING_CRITERIA: - if (!d_common->t_gather_grouping_criteria->isRunning()) - d_common->t_gather_grouping_criteria->start(); - if (d_common->algo_advance_mode == SYNCHRONOUS) { + if (!d_common->d_object_timers->t_gather_grouping_criteria->isRunning()) + d_common->d_object_timers->t_gather_grouping_criteria->start(); + if (d_common->d_algo_advance_mode == BergerRigoutsos::SYNCHRONOUS) { d_comm_group->completeCurrentOperation(); } sub_completed = gatherGroupingCriteria_check(); - d_common->t_gather_grouping_criteria->stop(); + d_common->d_object_timers->t_gather_grouping_criteria->stop(); if (!sub_completed) { d_wait_phase = gather_grouping_criteria; goto RETURN; } + d_common->decNumNodesCommWait(); } - if (d_common->rank == d_owner) { - d_common->t_local_tasks->start(); + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { + d_common->d_object_timers->t_local_tasks->start(); formChildGroups(); - d_common->t_local_tasks->stop(); + d_common->d_object_timers->t_local_tasks->stop(); } if (d_group.size() > 1) { - d_common->t_bcast_child_groups->start(); + d_common->d_object_timers->t_bcast_child_groups->start(); broadcastChildGroups_start(); + d_common->incNumNodesCommWait(); BCAST_CHILD_GROUPS: - if (!d_common->t_bcast_child_groups->isRunning()) - d_common->t_bcast_child_groups->start(); - if (d_common->algo_advance_mode == SYNCHRONOUS) { + if (!d_common->d_object_timers->t_bcast_child_groups->isRunning()) + d_common->d_object_timers->t_bcast_child_groups->start(); + if (d_common->d_algo_advance_mode == BergerRigoutsos::SYNCHRONOUS) { d_comm_group->completeCurrentOperation(); } sub_completed = broadcastChildGroups_check(); - d_common->t_bcast_child_groups->stop(); + d_common->d_object_timers->t_bcast_child_groups->stop(); if (!sub_completed) { d_wait_phase = bcast_child_groups; goto RETURN; } + d_common->decNumNodesCommWait(); } - if (d_lft_child->d_owner == d_common->rank) { - ++(d_common->num_nodes_owned); - ++(d_common->max_nodes_owned); + if (d_lft_child->d_box.getOwnerRank() == d_common->d_mpi.getRank()) { + d_common->incNumNodesOwned(); } - if (d_rht_child->d_owner == d_common->rank) { - ++(d_common->num_nodes_owned); - ++(d_common->max_nodes_owned); + if (d_rht_child->d_box.getOwnerRank() == d_common->d_mpi.getRank()) { + d_common->incNumNodesOwned(); } runChildren_start(); @@ -867,8 +478,8 @@ RUN_CHILDREN: goto RETURN; } } else if (boxAccepted()) { - if (d_common->rank == d_owner) { - ++(d_common->num_boxes_generated); + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { + ++(d_common->d_num_boxes_generated); } } else { // Box has no tag. @@ -876,17 +487,17 @@ RUN_CHILDREN: // All done with communication within participating group. delete d_comm_group; - d_comm_group = NULL; + d_comm_group = 0; } else { /* * This process is not in the group that decides on the box for - * this dendogram node. + * this node. */ TBOX_ASSERT(!inGroup(d_group)); } - if (d_parent == NULL) { + if (d_parent == 0) { /* * Compute relationships and set up relationship sharing data. * This is usually done by a node's parent in the @@ -895,20 +506,20 @@ RUN_CHILDREN: * kept or recombined with the sibling. * But the root node must do this itself because it has no parent. */ - if (d_common->compute_relationships > 0 && boxAccepted()) { + if (d_common->d_compute_relationships > 0 && boxAccepted()) { computeNewNeighborhoodSets(); } } - TBOX_ASSERT(d_lft_child == NULL); - TBOX_ASSERT(d_rht_child == NULL); + TBOX_ASSERT(d_lft_child == 0); + TBOX_ASSERT(d_rht_child == 0); // TBOX_ASSERT( ! inRelaunchQueue(this) ); - TBOX_ASSERT(inRelaunchQueue(this) == d_common->relaunch_queue.end()); + TBOX_ASSERT(inRelaunchQueue(this) == d_common->d_relaunch_queue.end()); /* * Broadcast the result to dropouts. * Dropout processes are those that participated in the - * parent but not in this dendogram node. They need the + * parent but not in this node. They need the * result to perform combined efficiency check for the * parent. * @@ -925,105 +536,96 @@ RUN_CHILDREN: * know results to do recombination check, to determine * if parent box is preferred. * - * - This is NOT the root dendogram node. The root node + * - This is NOT the root node. The root node * has no parent and no corresponding dropout group. * * - Dropout group is not empty. Number of dropouts * is the difference between parent group size and this * group size. */ - if (d_overlap == 0 || d_common->rank == d_owner) { + if (d_overlap == 0 || d_common->d_mpi.getRank() == d_box.getOwnerRank()) { - if ((d_common->owner_mode != SINGLE_OWNER || - d_common->compute_relationships > 0) && - d_parent != NULL && + if ((d_common->d_owner_mode != BergerRigoutsos::SINGLE_OWNER || + d_common->d_compute_relationships > 0) && + d_parent != 0 && d_parent->d_group.size() > d_group.size()) { - d_common->t_bcast_to_dropouts->start(); + d_common->d_object_timers->t_bcast_to_dropouts->start(); { // Create the communication group for the dropouts. - VectorOfInts dropouts(0); - d_common->t_local_tasks->start(); + BergerRigoutsos::VectorOfInts dropouts(0); + d_common->d_object_timers->t_local_tasks->start(); computeDropoutGroup(d_parent->d_group, d_group, dropouts, - d_owner); + d_box.getOwnerRank()); d_comm_group = new tbox::AsyncCommGroup( computeCommunicationTreeDegree( static_cast(d_group.size())), - &d_common->comm_stage, + &d_common->d_comm_stage, this); - d_comm_group->setGroupAndRootIndex(d_common->mpi_object, + d_comm_group->setUseBlockingSendToParent(false); + d_comm_group->setGroupAndRootIndex(d_common->d_mpi, &dropouts[0], static_cast(dropouts.size()), 0); - d_common->t_local_tasks->stop(); + d_common->d_object_timers->t_local_tasks->stop(); } broadcastToDropouts_start(); + d_common->incNumNodesCommWait(); BCAST_TO_DROPOUTS: - if (!d_common->t_bcast_to_dropouts->isRunning()) - d_common->t_bcast_to_dropouts->start(); + if (!d_common->d_object_timers->t_bcast_to_dropouts->isRunning()) + d_common->d_object_timers->t_bcast_to_dropouts->start(); sub_completed = broadcastToDropouts_check(); - d_common->t_bcast_to_dropouts->stop(); + d_common->d_object_timers->t_bcast_to_dropouts->stop(); if (!sub_completed) { d_wait_phase = bcast_to_dropouts; goto RETURN; } - if (d_common->log_node_history && d_common->rank != d_owner) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "DO Recv " << d_generation << ':' << d_pos - << " " << d_mapped_box + d_common->decNumNodesCommWait(); + + if (d_common->d_log_node_history && d_common->d_mpi.getRank() != d_box.getOwnerRank()) { + d_common->writeCounters(); + tbox::plog << "DO Recv " << d_generation << ':' << d_pos + << " " << d_box << " accept=" << d_box_acceptance << ".\n"; } delete d_comm_group; - d_comm_group = NULL; + d_comm_group = 0; } } d_wait_phase = completed; - if (d_comm_group != NULL) { + if (d_comm_group != 0) { // No further communication. Deallocate the communication group. delete d_comm_group; - d_comm_group = NULL; + d_comm_group = 0; } - TBOX_ASSERT(d_common->num_nodes_owned >= 0); + TBOX_ASSERT(d_common->d_num_nodes_owned >= 0); // Adjust counters. - --(d_common->num_nodes_active); - ++(d_common->num_nodes_completed); - if (d_owner == d_common->rank) { - TBOX_ASSERT(d_common->num_nodes_owned > 0); - --(d_common->num_nodes_owned); - TBOX_ASSERT(d_common->num_nodes_owned >= 0); - } - d_common->num_conts_to_complete += d_n_cont; - if (d_common->max_conts_to_complete < d_n_cont) { - d_common->max_conts_to_complete = d_n_cont; - } - - TBOX_ASSERT(d_common->num_nodes_owned >= 0); - - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Complete " << d_generation << ':' << d_pos - << " " << d_mapped_box + d_common->decNumNodesActive(); + d_common->incNumNodesCompleted(); + if (d_box.getOwnerRank() == d_common->d_mpi.getRank()) { + d_common->decNumNodesOwned(); + } + d_common->incNumContinues(d_n_cont); + + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Complete " << d_generation << ':' << d_pos + << " " << d_box << " accept=" << d_box_acceptance << ".\n"; } /* - * Recall that an dendogram node waiting for its children + * Recall that a tree node waiting for its children * is not placed in the relaunch queue (because it is * pointless to relaunch it until the children are completed). * Therefore, to eventually continue that node, its last @@ -1032,20 +634,17 @@ BCAST_TO_DROPOUTS: * queue to be checked immediately (required for synchronous * mode). */ - if (d_parent != NULL && + if (d_parent != 0 && d_parent->d_lft_child->d_wait_phase == completed && d_parent->d_rht_child->d_wait_phase == completed) { TBOX_ASSERT(d_parent->d_wait_phase == run_children); // TBOX_ASSERT( ! inRelaunchQueue(d_parent) ); - TBOX_ASSERT(inRelaunchQueue(d_parent) == d_common->relaunch_queue.end()); - // d_common->relaunch_queue.addItem(d_parent); - d_common->relaunch_queue.push_front(d_parent); - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Parent " << d_parent->d_generation << ':' + TBOX_ASSERT(inRelaunchQueue(d_parent) == d_common->d_relaunch_queue.end()); + // d_common->d_relaunch_queue.push_front(d_parent); + d_common->prependQueue(d_parent); + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Parent " << d_parent->d_generation << ':' << d_parent->d_pos << " awoken by last child of " << d_parent->d_lft_child->d_generation << ':' @@ -1053,7 +652,7 @@ BCAST_TO_DROPOUTS: << ", " << d_parent->d_rht_child->d_generation << ':' << d_parent->d_rht_child->d_pos - << " queue size " << d_common->relaunch_queue.size() + << " queue size " << d_common->d_relaunch_queue.size() << ".\n"; } } @@ -1063,15 +662,15 @@ RETURN: #ifdef DEBUG_CHECK_ASSERTIONS if (d_wait_phase != completed && d_wait_phase != run_children) { TBOX_ASSERT(!d_comm_group->isDone()); - TBOX_ASSERT(d_common->comm_stage.hasPendingRequests()); + TBOX_ASSERT(d_common->d_comm_stage.hasPendingRequests()); } if (d_wait_phase == run_children) { - // TBOX_ASSERT( ! d_common->relaunch_queue.isEmpty() ); - TBOX_ASSERT(!d_common->relaunch_queue.empty()); + // TBOX_ASSERT( ! d_relaunch_queue.empty() ); + TBOX_ASSERT(!d_common->d_relaunch_queue.empty()); } #endif - d_common->t_continue_algorithm->stop(); + d_common->d_object_timers->t_continue_algorithm->stop(); return d_wait_phase; } @@ -1105,11 +704,11 @@ BergerRigoutsosNode::runChildren_start() * of the right to more closely match the * progression of the recursive BR (not essential). */ - d_common->relaunch_queue.push_front(d_rht_child); - d_common->relaunch_queue.push_front(d_lft_child); + // d_common->d_relaunch_queue.push_front(d_rht_child); + // d_common->d_relaunch_queue.push_front(d_lft_child); + d_common->prependQueue(d_rht_child, d_lft_child); } - /* ******************************************************************** * Check for combined tolerance. @@ -1127,53 +726,53 @@ BergerRigoutsosNode::runChildren_check() return false; } + const double combine_reduction = + double(d_lft_child->d_box.size() + + d_rht_child->d_box.size()) / static_cast(d_box.size()); if (d_lft_child->boxAccepted() && d_rht_child->boxAccepted() && - d_box.numberCells() <= d_common->max_box_size && - (d_lft_child->d_box.size() + d_rht_child->d_box.size() >= - d_common->combine_tol * d_box.size())) { + d_box.numberCells() <= d_common->d_max_box_size && + (combine_reduction >= d_common->getCombineEfficiency(d_common->d_level_number))) { // Discard childrens' graph nodes in favor of recombination. d_box_acceptance = accepted_by_recombination; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Recombine " << d_generation << ':' << d_pos - << " " << d_mapped_box - << " <= " << d_lft_child->d_mapped_box - << " + " << d_rht_child->d_mapped_box + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Recombine " << d_generation << ':' << d_pos + << " insufficient reduction of " << combine_reduction + << " " << d_box + << " <= " << d_lft_child->d_box + << " + " << d_rht_child->d_box << " " << "accept=" << d_box_acceptance << ".\n"; } - if (d_lft_child->d_owner == d_common->rank) { + if (d_lft_child->d_box.getOwnerRank() == d_common->d_mpi.getRank()) { d_lft_child->eraseBox(); d_lft_child->d_box_acceptance = rejected_by_recombination; - --(d_common->num_boxes_generated); + --(d_common->d_num_boxes_generated); } - if (d_rht_child->d_owner == d_common->rank) { + if (d_rht_child->d_box.getOwnerRank() == d_common->d_mpi.getRank()) { d_rht_child->eraseBox(); d_rht_child->d_box_acceptance = rejected_by_recombination; - --(d_common->num_boxes_generated); + --(d_common->d_num_boxes_generated); } - if (d_owner == d_common->rank) { - ++(d_common->num_boxes_generated); + if (d_box.getOwnerRank() == d_common->d_mpi.getRank()) { + ++(d_common->d_num_boxes_generated); } } else { // Accept childrens' results, discarding graph node. - if (d_owner == d_common->rank) { + if (d_box.getOwnerRank() == d_common->d_mpi.getRank()) { eraseBox(); } - if (d_common->compute_relationships > 0) { + if (d_common->d_compute_relationships > 0) { if (d_lft_child->boxAccepted() && d_lft_child->d_box_acceptance != accepted_by_dropout_bcast) { d_lft_child->computeNewNeighborhoodSets(); @@ -1182,15 +781,12 @@ BergerRigoutsosNode::runChildren_check() d_rht_child->d_box_acceptance != accepted_by_dropout_bcast) { d_rht_child->computeNewNeighborhoodSets(); } - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Discard " << d_generation << ':' << d_pos - << " " << d_mapped_box - << " => " << d_lft_child->d_mapped_box - << " + " << d_rht_child->d_mapped_box + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Discard " << d_generation << ':' << d_pos + << " " << d_box + << " => " << d_lft_child->d_box + << " + " << d_rht_child->d_box << " " << "accept=" << d_box_acceptance << ".\n"; } @@ -1209,55 +805,6 @@ BergerRigoutsosNode::runChildren_check() return true; } -BergerRigoutsosNode::CommonParams::CommonParams( - const tbox::Dimension& dim): - d_dim(dim), - tag_level((hier::PatchLevel*)NULL), - tag_mapped_box_level(NULL), - new_mapped_box_level(NULL), - tag_to_new(NULL), - new_to_tag(NULL), - // Parameters not from clustering algorithm interface ... - max_lap_cut_from_center(1.0), - laplace_cut_threshold_ar(0.0), - max_box_size(d_dim, tbox::MathUtilities::getMax()), - // Parameters from clustering algorithm interface ... - tag_data_index(-1), - tag_val(0), - min_box(d_dim, 1), - efficiency_tol(tbox::MathUtilities::getMax()), - combine_tol(tbox::MathUtilities::getMax()), - // Implementation flags and data... - compute_relationships(2), - relationship_senders(), - relationship_messages(), - max_gcw(d_dim, 1), - owner_mode(MOST_OVERLAP), - // Communication parameters ... - mpi_object(tbox::SAMRAI_MPI::commNull), - rank(-1), - nproc(-1), - available_mpi_tag(-1), - // Analysis support ... - log_node_history(false), - num_tags_in_all_nodes(0), - max_tags_owned(0), - num_nodes_allocated(0), - max_nodes_allocated(0), - num_nodes_active(0), - max_nodes_active(0), - num_nodes_owned(0), - max_nodes_owned(0), - num_nodes_completed(0), - max_generation(0), - num_boxes_generated(0), - num_conts_to_complete(0), - max_conts_to_complete(0) -{ - // Set the timer for the communication stage's MPI waiting. - comm_stage.setCommunicationWaitTimer(t_MPI_wait); -} - /* ******************************************************************** * @@ -1276,7 +823,7 @@ BergerRigoutsosNode::reduceHistogram_start() } d_comm_group->setMPITag(d_mpi_tag + reduce_histogram_tag); const int hist_size = getHistogramBufferSize(d_box); - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { d_recv_msg.resize(hist_size, BAD_INTEGER); putHistogramToBuffer(&d_recv_msg[0]); d_comm_group->beginSumReduce(&d_recv_msg[0], hist_size); @@ -1294,7 +841,7 @@ BergerRigoutsosNode::reduceHistogram_check() return true; } d_comm_group->proceedToNextWait(); - if (d_comm_group->isDone() && d_common->rank == d_owner) { + if (d_comm_group->isDone() && d_common->d_mpi.getRank() == d_box.getOwnerRank()) { getHistogramFromBuffer(&d_recv_msg[0]); } return d_comm_group->isDone(); @@ -1321,15 +868,15 @@ BergerRigoutsosNode::broadcastAcceptability_start() const int buffer_size = 1 // Number of tags in candidate + 1 // Acceptability flag. + 1 // Local index of node. - + d_dim.getValue() * 2 // Box. - + d_dim.getValue() * 4 // Children boxes. + + getDim().getValue() * 2 // Box. + + getDim().getValue() * 4 // Children boxes. + 2 // Children MPI tags ; - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { TBOX_ASSERT(d_box_acceptance == rejected_by_calculation || d_box_acceptance == accepted_by_calculation || - (d_parent == NULL && d_box_acceptance == hasnotag_by_owner)); + (d_parent == 0 && d_box_acceptance == hasnotag_by_owner)); d_send_msg.resize(buffer_size, BAD_INTEGER); int* ptr = &d_send_msg[0]; *(ptr++) = d_num_tags; @@ -1337,7 +884,7 @@ BergerRigoutsosNode::broadcastAcceptability_start() d_box_acceptance + 2 /* indicate remote decision */ : d_box_acceptance; if (!boxHasNoTag()) { - *(ptr++) = d_mapped_box.getLocalId().getValue(); + *(ptr++) = d_box.getLocalId().getValue(); ptr = putBoxToBuffer(d_box, ptr); if (boxRejected()) { ptr = putBoxToBuffer(d_lft_child->d_box, ptr); @@ -1369,32 +916,25 @@ BergerRigoutsosNode::broadcastAcceptability_check() return true; } d_comm_group->checkBcast(); - if (d_comm_group->isDone() && d_common->rank != d_owner) { + if (d_comm_group->isDone() && d_common->d_mpi.getRank() != d_box.getOwnerRank()) { int* ptr = &d_recv_msg[0]; + d_num_tags = *(ptr++); - if (d_parent == NULL) { - d_common->num_tags_in_all_nodes = d_num_tags; - } + d_box_acceptance = intToBoxAcceptance(*(ptr++)); TBOX_ASSERT(boxAccepted() || boxRejected() || - (boxHasNoTag() && d_parent == NULL)); + (boxHasNoTag() && d_parent == 0)); if (!boxHasNoTag()) { - const hier::LocalId node_local_id(*(ptr++)); + const hier::LocalId accepted_box_local_id(*(ptr++)); ptr = getBoxFromBuffer(d_box, ptr); - d_mapped_box = hier::Box(d_box, node_local_id, d_owner); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(d_mapped_box.getBlockId() == d_block_id); - TBOX_ASSERT(d_mapped_box.getLocalId() >= 0); - if (d_parent != NULL) { - /* - * Do not check for min_box violation in root node. That - * check should be done outside of this class in order to - * have flexibility regarding how to handle it. - */ - TBOX_ASSERT(d_box.numberCells() >= d_common->min_box); - } -#endif + d_box.initialize(d_box, accepted_box_local_id, d_box.getOwnerRank()); // Reset local id. + /* + * Do not check for min_box violation in root node. That + * check should be done outside of this class in order to + * have flexibility regarding how to handle it. + */ + TBOX_ASSERT(d_parent == 0 || d_box.numberCells() >= d_min_box_size); } if (boxRejected()) { @@ -1406,49 +946,38 @@ BergerRigoutsosNode::broadcastAcceptability_check() * the d_box_acceptance flag indicates that further * branching is required. */ - d_lft_child = new BergerRigoutsosNode(d_common, - this, - 0, - d_block_id, - d_first_local_id); - d_rht_child = new BergerRigoutsosNode(d_common, - this, - 1, - d_block_id, - d_first_local_id); + d_lft_child = new BergerRigoutsosNode(d_common, this, 0); + d_rht_child = new BergerRigoutsosNode(d_common, this, 1); ptr = getBoxFromBuffer(d_lft_child->d_box, ptr); ptr = getBoxFromBuffer(d_rht_child->d_box, ptr); - d_lft_child->d_box.setBlockId(d_block_id); - d_rht_child->d_box.setBlockId(d_block_id); + d_lft_child->d_box.setBlockId(d_box.getBlockId()); + d_rht_child->d_box.setBlockId(d_box.getBlockId()); d_lft_child->d_mpi_tag = *(ptr++); d_rht_child->d_mpi_tag = *(ptr++); - TBOX_ASSERT(d_lft_child->d_box.numberCells() >= d_common->min_box); - TBOX_ASSERT(d_rht_child->d_box.numberCells() >= d_common->min_box); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_box.numberCells() >= d_min_box_size) { + TBOX_ASSERT(d_lft_child->d_box.numberCells() >= d_min_box_size); + TBOX_ASSERT(d_rht_child->d_box.numberCells() >= d_min_box_size); + } +#endif TBOX_ASSERT(d_lft_child->d_mpi_tag > -1); TBOX_ASSERT(d_rht_child->d_mpi_tag > -1); - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Rm Split " << d_generation << ':' << d_pos - << " " << d_mapped_box + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Rm Split " << d_generation << ':' << d_pos + << " " << d_box << " => " << d_lft_child->d_box << " + " << d_rht_child->d_box << ".\n"; } - } - else { - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Rm Accepted " << d_generation << ':' << d_pos + } else { + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Rm Accepted " << d_generation << ':' << d_pos << " " << d_box << " accept=" << d_box_acceptance << ".\n"; } @@ -1465,16 +994,17 @@ BergerRigoutsosNode::gatherGroupingCriteria_start() } d_comm_group->setMPITag(d_mpi_tag + gather_grouping_criteria_tag); - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { d_recv_msg.resize(4 * d_group.size(), BAD_INTEGER); d_comm_group->beginGather(&d_recv_msg[0], 4); } else { d_send_msg.resize(4, BAD_INTEGER); - d_send_msg[0] = d_lft_child->d_overlap; - d_send_msg[1] = d_rht_child->d_overlap; + // TODO: Change message buffers to MessageStream to avoid limiting d_overlap to integer size. + d_send_msg[0] = static_cast(d_lft_child->d_overlap); + d_send_msg[1] = static_cast(d_rht_child->d_overlap); // Use negative burden measures for uniformity of criteria comparison. - d_send_msg[2] = -d_common->num_nodes_owned; - d_send_msg[3] = -d_common->num_nodes_active; + d_send_msg[2] = -d_common->d_num_nodes_owned; + d_send_msg[3] = -d_common->d_num_nodes_active; d_comm_group->beginGather(&d_send_msg[0], 4); } } @@ -1492,36 +1022,36 @@ BergerRigoutsosNode::broadcastChildGroups_start() */ d_comm_group->setMPITag(d_mpi_tag + bcast_child_groups_tag); - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { /* - * When d_parent == NULL, use d_comm_group's MPI collective call option. + * When d_parent == 0, use d_comm_group's MPI collective call option. * The option uses MPI_Bcast, which requires the buffer size is the same * on all processors. When this is not the case, use the child group * sizes to save memory and possibly improve performance. */ const int buffer_size = 2 // Left/right owners. + 2 // Left/right group sizes. - + (d_parent == NULL ? static_cast(d_group.size()) + + (d_parent == 0 ? static_cast(d_group.size()) : static_cast(d_lft_child->d_group.size())) // Left group. - + (d_parent == NULL ? static_cast(d_group.size()) + + (d_parent == 0 ? static_cast(d_group.size()) : static_cast(d_rht_child->d_group.size())) // Right group. ; d_send_msg.resize(buffer_size, BAD_INTEGER); int* ptr = &d_send_msg[0]; - *(ptr++) = d_lft_child->d_owner; + *(ptr++) = d_lft_child->d_box.getOwnerRank(); *(ptr++) = static_cast(d_lft_child->d_group.size()); for (size_t i = 0; i < d_lft_child->d_group.size(); ++i) { *(ptr++) = d_lft_child->d_group[i]; } - *(ptr++) = d_rht_child->d_owner; + *(ptr++) = d_rht_child->d_box.getOwnerRank(); *(ptr++) = static_cast(d_rht_child->d_group.size()); for (size_t i = 0; i < d_rht_child->d_group.size(); ++i) { *(ptr++) = d_rht_child->d_group[i]; } - if (d_parent == NULL) { + if (d_parent == 0) { // Initialize unused data to avoid warnings and weird numbers. for (size_t i = (d_lft_child->d_group.size() + d_rht_child->d_group.size()); @@ -1549,26 +1079,32 @@ BergerRigoutsosNode::broadcastChildGroups_check() return true; } d_comm_group->checkBcast(); - if (d_comm_group->isDone() && d_common->rank != d_owner) { + if (d_comm_group->isDone() && d_common->d_mpi.getRank() != d_box.getOwnerRank()) { int* ptr = &d_recv_msg[0]; - d_lft_child->d_owner = *(ptr++); + int lft_owner = *(ptr++); d_lft_child->d_group.resize(*(ptr++), BAD_INTEGER); for (size_t i = 0; i < d_lft_child->d_group.size(); ++i) { d_lft_child->d_group[i] = *(ptr++); } - d_rht_child->d_owner = *(ptr++); + int rht_owner = *(ptr++); d_rht_child->d_group.resize(*(ptr++), BAD_INTEGER); for (size_t i = 0; i < d_rht_child->d_group.size(); ++i) { d_rht_child->d_group[i] = *(ptr++); } - TBOX_ASSERT(d_lft_child->d_owner >= 0); + d_lft_child->d_box.initialize(d_lft_child->d_box, + d_lft_child->d_box.getLocalId(), + lft_owner); + d_rht_child->d_box.initialize(d_rht_child->d_box, + d_rht_child->d_box.getLocalId(), + rht_owner); + TBOX_ASSERT(d_lft_child->d_box.getOwnerRank() >= 0); TBOX_ASSERT(d_lft_child->d_group.size() > 0); TBOX_ASSERT((d_lft_child->d_overlap > 0) == inGroup(d_lft_child->d_group)); - TBOX_ASSERT(d_rht_child->d_owner >= 0); + TBOX_ASSERT(d_rht_child->d_box.getOwnerRank() >= 0); TBOX_ASSERT(d_rht_child->d_group.size() > 0); TBOX_ASSERT((d_rht_child->d_overlap > 0) == inGroup(d_rht_child->d_group)); @@ -1581,19 +1117,19 @@ BergerRigoutsosNode::broadcastChildGroups_check() void BergerRigoutsosNode::broadcastToDropouts_start() { - TBOX_ASSERT(d_common->rank == d_owner || d_overlap == 0); + TBOX_ASSERT(d_common->d_mpi.getRank() == d_box.getOwnerRank() || d_overlap == 0); d_comm_group->setMPITag(d_mpi_tag + bcast_to_dropouts_tag); const int buffer_size = 1 // d_box_acceptance + 1 // local index of graph node - + d_dim.getValue() * 2 // d_box (in case it got reduced) + + d_common->getDim().getValue() * 2 // d_box (in case it got reduced) ; d_send_msg.clear(); d_recv_msg.clear(); - if (d_common->rank == d_owner) { + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { d_send_msg.resize(buffer_size, BAD_INTEGER); d_send_msg[0] = d_box_acceptance; - d_send_msg[1] = d_mapped_box.getLocalId().getValue(); + d_send_msg[1] = d_box.getLocalId().getValue(); putBoxToBuffer(d_box, &d_send_msg[2]); d_comm_group->beginBcast(&d_send_msg[0], buffer_size); @@ -1607,36 +1143,31 @@ BergerRigoutsosNode::broadcastToDropouts_start() bool BergerRigoutsosNode::broadcastToDropouts_check() { - TBOX_ASSERT(d_common->rank == d_owner || d_overlap == 0); + TBOX_ASSERT(d_common->d_mpi.getRank() == d_box.getOwnerRank() || d_overlap == 0); d_comm_group->checkBcast(); if (d_comm_group->isDone()) { - if (d_common->rank != d_owner) { + if (d_common->d_mpi.getRank() != d_box.getOwnerRank()) { /* * We check for the case of the box having no tags, * to keeps things explicit and help detect bugs. * But in fact, having no tags is impossible * in the broadcastToDropout step, because it is - * only possible for the root dendogram node, + * only possible for the root node, * which has no dropout group. */ TBOX_ASSERT(d_recv_msg[0] >= 0); d_box_acceptance = intToBoxAcceptance((d_recv_msg[0] % 2) + rejected_by_dropout_bcast); - const hier::LocalId local_id(d_recv_msg[1]); + const hier::LocalId accepted_box_local_id(d_recv_msg[1]); getBoxFromBuffer(d_box, &d_recv_msg[2]); -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_parent != NULL) { - /* - * Do not check for min_box violation in root node. That - * check should be done outside of this class in order to - * have flexibility regarding how to handle it. - */ - TBOX_ASSERT(d_box.numberCells() >= d_common->min_box); - } -#endif - d_mapped_box = hier::Box(d_box, local_id, d_owner); - TBOX_ASSERT(d_mapped_box.getBlockId() == d_block_id); + /* + * Do not check for min_box violation in root node. That + * check should be done outside of this class in order to + * have flexibility regarding how to handle it. + */ + TBOX_ASSERT(d_parent == 0 || d_box.numberCells() >= d_min_box_size); + d_box.initialize( d_box, accepted_box_local_id, d_box.getOwnerRank() ); // Reset local id. } } return d_comm_group->isDone(); @@ -1651,12 +1182,12 @@ BergerRigoutsosNode::broadcastToDropouts_check() void BergerRigoutsosNode::makeLocalTagHistogram() { - d_common->t_local_histogram->start(); + d_common->d_object_timers->t_local_histogram->start(); /* * Compute the histogram size and allocate space for it. */ - for (int d = 0; d < d_dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < d_common->getDim().getValue(); ++d) { TBOX_ASSERT(d_box.numberCells(d) > 0); d_histogram[d].clear(); d_histogram[d].insert(d_histogram[d].end(), d_box.numberCells(d), 0); @@ -1665,31 +1196,33 @@ BergerRigoutsosNode::makeLocalTagHistogram() /* * Accumulate tag counts in the histogram variable. */ - const hier::PatchLevel& tag_level = *d_common->tag_level; + const hier::PatchLevel& tag_level = *d_common->d_tag_level; for (hier::PatchLevel::iterator ip(tag_level.begin()); ip != tag_level.end(); ++ip) { hier::Patch& patch = **ip; const hier::BlockId& block_id = patch.getBox().getBlockId(); - if (block_id == d_block_id) { + if (block_id == d_box.getBlockId()) { const hier::Box intersection = patch.getBox() * d_box; - const hier::IntVector& lower = d_box.lower(); + const hier::Index& lower = d_box.lower(); if (!(intersection.empty())) { boost::shared_ptr > tag_data_( - patch.getPatchData(d_common->tag_data_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_common->d_tag_data_index))); + + TBOX_ASSERT(tag_data_); pdat::CellData& tag_data = *tag_data_; - pdat::CellIterator ciend(intersection, false); - for (pdat::CellIterator ci(intersection, true); + pdat::CellIterator ciend(pdat::CellGeometry::end(intersection)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(intersection)); ci != ciend; ++ci) { - if (tag_data(*ci) == d_common->tag_val) { - const hier::IntVector& idx = *ci; - for (int d = 0; d < d_dim.getValue(); ++d) { + if (tag_data(*ci) == d_common->d_tag_val) { + const hier::Index& idx = *ci; + for (int d = 0; d < d_common->getDim().getValue(); ++d) { ++(d_histogram[d][idx(d) - lower(d)]); } } @@ -1697,7 +1230,7 @@ BergerRigoutsosNode::makeLocalTagHistogram() } } } - d_common->t_local_histogram->stop(); + d_common->d_object_timers->t_local_histogram->stop(); } /* @@ -1711,12 +1244,10 @@ BergerRigoutsosNode::computeMinimalBoundingBoxForTags() { TBOX_ASSERT(!d_box.empty()); - int d; - hier::Index new_lower = d_box.lower(); hier::Index new_upper = d_box.upper(); - const hier::IntVector& min_box = d_common->min_box; + const hier::IntVector& min_box = d_min_box_size; hier::IntVector box_size = d_box.numberCells(); /* @@ -1724,7 +1255,7 @@ BergerRigoutsosNode::computeMinimalBoundingBoxForTags() * Bring the upper side of the box down past untagged index planes. * Do not make the box smaller than the min_box requirement. */ - for (d = 0; d < d_dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < d_common->getDim().getValue(); ++d) { TBOX_ASSERT(d_histogram[d].size() != 0); int* histogram_beg = &d_histogram[d][0]; int* histogram_end = histogram_beg + d_box.numberCells(d) - 1; @@ -1742,26 +1273,22 @@ BergerRigoutsosNode::computeMinimalBoundingBoxForTags() } } - const hier::Box new_box(new_lower, new_upper, d_block_id); + const hier::Box new_box(new_lower, new_upper, d_box.getBlockId()); const hier::IntVector new_size = new_box.numberCells(); if (!new_box.isSpatiallyEqual(d_box)) { -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_parent != NULL) { - /* - * Do not check for min_box violation in root node. That - * check should be done outside of this class in order to - * have flexibility regarding how to handle it. - */ - TBOX_ASSERT(new_box.numberCells() >= d_common->min_box); - } -#endif + /* + * Do not check for min_box violation in root node. That + * check should be done outside of this class in order to + * have flexibility regarding how to handle it. + */ + TBOX_ASSERT(d_parent == 0 || new_box.numberCells() >= min_box); /* * Save tagged part of the current histogram and reset the box. * Is this step really required? No, we can just keep the * shift in a hier::IntVector and adjust. */ - for (d = 0; d < d_dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < d_common->getDim().getValue(); ++d) { VectorOfInts& h = d_histogram[d]; const int shift = new_lower(d) - d_box.lower() (d); if (shift > 0) { @@ -1772,16 +1299,13 @@ BergerRigoutsosNode::computeMinimalBoundingBoxForTags() } h.resize(new_size(d), BAD_INTEGER); } - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Shrunken " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Shrunken " << d_generation << ':' << d_pos << " " << d_box << " -> " << new_box << ".\n"; } - d_box = new_box; + d_box.initialize(new_box, d_box.getLocalId(), d_box.getOwnerRank()); } } @@ -1795,15 +1319,15 @@ BergerRigoutsosNode::acceptOrSplitBox() { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_owner != d_common->rank) { + if (d_box.getOwnerRank() != d_common->d_mpi.getRank()) { TBOX_ERROR("Only the owner can determine\n" "whether to accept or split a box.\n"); } - TBOX_ASSERT(d_box_acceptance == undetermined); #endif + TBOX_ASSERT(d_box_acceptance == undetermined); const hier::IntVector boxdims(d_box.numberCells()); - const hier::IntVector oversize(boxdims - d_common->max_box_size); + const hier::IntVector oversize(boxdims - d_common->d_max_box_size); /* * Box d_box is acceptable if @@ -1820,15 +1344,10 @@ BergerRigoutsosNode::acceptOrSplitBox() * - create left and right children * - set children boxes * - claim MPI tags for communication by children nodes - * - * Instead of writing from scratch, - * the code to find the split plane was copied - * from mesh::BergerRigoutsos::splitTagBoundBox() - * and modified. */ if (d_box_acceptance == undetermined) { - if (oversize <= hier::IntVector::getZero(d_dim)) { + if (oversize <= hier::IntVector::getZero(d_common->getDim())) { /* * See if d_box should be accepted based on efficiency. */ @@ -1836,35 +1355,29 @@ BergerRigoutsosNode::acceptOrSplitBox() for (size_t i = 0; i < d_histogram[0].size(); ++i) { num_tagged += d_histogram[0][i]; } - int boxsize = d_box.size(); + size_t boxsize = d_box.size(); double efficiency = (boxsize == 0 ? 1.e0 : - ((double)num_tagged) / boxsize); + ((double)num_tagged) / static_cast(boxsize)); - if (d_common->max_tags_owned < num_tagged) { - d_common->max_tags_owned = num_tagged; + if (d_common->d_max_tags_owned < num_tagged) { + d_common->d_max_tags_owned = num_tagged; } - if (efficiency >= d_common->efficiency_tol) { + if (efficiency >= d_common->getEfficiencyTolerance(d_common->d_level_number)) { d_box_acceptance = accepted_by_calculation; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Accepted " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Accepted " << d_generation << ':' << d_pos << " " << d_box << " by sufficient efficiency of " << efficiency << " accept=" << d_box_acceptance << ".\n"; } } else if (num_tagged == 0) { - // No tags! This should be caught at the dendogram root. - TBOX_ASSERT(d_parent == NULL); + // No tags! This should be caught at the root. + TBOX_ASSERT(d_parent == 0); d_box_acceptance = hasnotag_by_owner; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "HasNoTag " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "HasNoTag " << d_generation << ':' << d_pos << " " << d_box << ".\n"; } @@ -1873,35 +1386,37 @@ BergerRigoutsosNode::acceptOrSplitBox() } /* + * If d_box cannot be split without violating min_size, it should + * be accepted. + * * If cut_margin is negative in any direction, we cannot cut d_box * across that direction without violating min_box. */ - const hier::IntVector cut_margin = boxdims - (d_common->min_box) * 2; + hier::IntVector min_size(d_min_box_size); + min_size.max( d_common->d_min_box_size_from_cutting ); + const hier::IntVector cut_margin = boxdims - min_size * 2; if (d_box_acceptance == undetermined) { - /* - * If d_box cannot be split without violating min_box, it should - * be accepted. - */ - if (cut_margin < hier::IntVector::getZero(d_dim)) { + if (cut_margin < hier::IntVector::getZero(d_common->getDim())) { d_box_acceptance = accepted_by_calculation; } } - hier::IntVector sorted_margins(d_dim); + hier::IntVector sorted_margins(d_common->getDim()); if (d_box_acceptance == undetermined) { /* - * Sort the bounding box dimensions from largest to smallest cut + * Sort the bounding box directions from largest to smallest cut * margin. If there are multiple cuttable directions, we will * favor the direction with the greatest cut_margin. */ - int dim; - for (dim = 0; dim < d_dim.getValue(); dim++) { + for (tbox::Dimension::dir_t dim = 0; dim < d_common->getDim().getValue(); ++dim) { sorted_margins(dim) = dim; } - for (int d0 = 0; d0 < d_dim.getValue() - 1; d0++) { - for (int d1 = d0 + 1; d1 < d_dim.getValue(); d1++) { + for (tbox::Dimension::dir_t d0 = 0; d0 < d_common->getDim().getValue() - 1; ++d0) { + for (tbox::Dimension::dir_t d1 = static_cast(d0 + 1); + d1 < d_common->getDim().getValue(); + ++d1) { if (cut_margin(sorted_margins(d0)) < cut_margin(sorted_margins(d1))) { int tmp_dim = sorted_margins(d0); @@ -1911,7 +1426,7 @@ BergerRigoutsosNode::acceptOrSplitBox() } } #ifdef DEBUG_CHECK_ASSERTIONS - for (dim = 0; dim < d_dim.getValue() - 1; dim++) { + for (tbox::Dimension::dir_t dim = 0; dim < d_common->getDim().getValue() - 1; ++dim) { TBOX_ASSERT(cut_margin(sorted_margins(dim)) >= cut_margin(sorted_margins(dim + 1))); } @@ -1919,7 +1434,7 @@ BergerRigoutsosNode::acceptOrSplitBox() } const int max_margin_dir = sorted_margins(0); - const int min_margin_dir = sorted_margins(d_dim.getValue()-1); + const int min_margin_dir = sorted_margins(d_common->getDim().getValue() - 1); int num_cuttable_dim = 0; @@ -1928,8 +1443,8 @@ BergerRigoutsosNode::acceptOrSplitBox() * Determine number of coordinate directions that are cuttable * according to the cut_margin. */ - for (num_cuttable_dim = 0; num_cuttable_dim < d_dim.getValue(); - num_cuttable_dim++) { + for (num_cuttable_dim = 0; num_cuttable_dim < d_common->getDim().getValue(); + ++num_cuttable_dim) { if (cut_margin(sorted_margins(num_cuttable_dim)) < 0) { break; } @@ -1947,29 +1462,26 @@ BergerRigoutsosNode::acceptOrSplitBox() int cut_lo, cut_hi; int cut_pt = -(tbox::MathUtilities::getMax()); - int cut_dir = -1; - int dir = -1; - const hier::Index box_lo(d_box.lower()); - const hier::Index box_hi(d_box.upper()); + tbox::Dimension::dir_t cut_dir = 0; + tbox::Dimension::dir_t dir = 0; + const hier::Index& box_lo(d_box.lower()); + const hier::Index& box_hi(d_box.upper()); hier::Index lft_hi(box_hi); hier::Index rht_lo(box_lo); - for (dir = 0; dir < d_dim.getValue(); dir++) { - cut_dir = sorted_margins(dir); + for (dir = 0; dir < d_common->getDim().getValue(); ++dir) { + cut_dir = static_cast(sorted_margins(dir)); if (cut_margin(cut_dir) < 0) { continue; // This direction is too small to cut. } if (findZeroCutSwath(cut_lo, cut_hi, cut_dir)) { - // Split bound box at cut_pt; cut_dir is splitting dimension. + // Split bound box at cut_pt; cut_dir is splitting direction. TBOX_ASSERT(cut_hi - cut_lo >= 0); lft_hi(cut_dir) = cut_lo - 1; rht_lo(cut_dir) = cut_hi + 1; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "HoleCut " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "HoleCut " << d_generation << ':' << d_pos << " " << d_box << " d=" << cut_dir << " at " << cut_lo << '-' << cut_hi << ".\n"; @@ -1979,19 +1491,19 @@ BergerRigoutsosNode::acceptOrSplitBox() } /* - * If no zero point found, try Laplacian cut. + * If no zero point found, try inflection cut. */ - if (dir == d_dim.getValue()) { + if (dir == d_common->getDim().getValue()) { /* - * laplace_cut_threshold_ar specifies the mininum box + * inflection_cut_threshold_ar specifies the mininum box * thickness that can be cut, as a ratio to the thinnest box * direction. If the box doesn't have any direction thick * enough, then it has a reasonable aspect ratio, so we can * cut it in any direction. * - * Degenerate values of laplace_cut_threshold_ar: + * Degenerate values of inflection_cut_threshold_ar: * * 1: cut any direction except the thinnest. * @@ -2001,11 +1513,15 @@ BergerRigoutsosNode::acceptOrSplitBox() * only the thickest direction. This leads to more cubic * boxes but can miss feature edges aligned across other * directions. + * + * Experiments show that a value of 4 works well. */ int max_box_length_to_leave = boxdims(max_margin_dir) - 1; - if ( d_common->laplace_cut_threshold_ar > 0.0 ) { - max_box_length_to_leave = static_cast(0.5 + boxdims(min_margin_dir)*d_common->laplace_cut_threshold_ar); - if ( max_box_length_to_leave >= boxdims(max_margin_dir) ) { + if (d_common->d_inflection_cut_threshold_ar > 0.0) { + max_box_length_to_leave = + static_cast(0.5 + boxdims(min_margin_dir) + * d_common->d_inflection_cut_threshold_ar); + if (max_box_length_to_leave >= boxdims(max_margin_dir)) { /* * Box aspect ratio is not too bad. Disable preference * for cutting longer dirs. @@ -2014,31 +1530,28 @@ BergerRigoutsosNode::acceptOrSplitBox() } } - int diff_laplace = -1; - for ( int d=0; dgetDim().getValue(); ++d) { + if (cut_margin(d) < 0 || boxdims(d) <= max_box_length_to_leave) { continue; // Direction d is too small to cut. } - int try_cut_pt, try_diff_laplace; - cutAtLaplacian(try_cut_pt, try_diff_laplace, d); - if ( diff_laplace < try_diff_laplace || - ( diff_laplace == try_diff_laplace && cut_margin(d) > cut_margin(cut_dir) ) ) { + int try_cut_pt, try_inflection; + cutAtInflection(try_cut_pt, try_inflection, d); + if (inflection < try_inflection || + (inflection == try_inflection && cut_margin(d) > cut_margin(cut_dir))) { cut_dir = d; cut_pt = try_cut_pt; - diff_laplace = try_diff_laplace; + inflection = try_inflection; } } - TBOX_ASSERT( cut_dir >= 0 && cut_dir < d_dim.getValue() ); + TBOX_ASSERT(cut_dir < d_common->getDim().getValue()); - // Split bound box at cut_pt; cut_dir is splitting dimension. + // Split bound box at cut_pt; cut_dir is splitting direction. lft_hi(cut_dir) = cut_pt - 1; rht_lo(cut_dir) = cut_pt; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "LapCut " << d_generation << ':' << d_pos + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "LapCut " << d_generation << ':' << d_pos << " " << d_box << " d=" << cut_dir << " at " << cut_pt << ".\n"; @@ -2051,25 +1564,26 @@ BergerRigoutsosNode::acceptOrSplitBox() * Contributors create the children when they receive * the d_box_acceptance flag from the owner. */ - d_lft_child = new BergerRigoutsosNode(d_common, this, 0, d_block_id, d_first_local_id); - d_rht_child = new BergerRigoutsosNode(d_common, this, 1, d_block_id, d_first_local_id); + d_lft_child = new BergerRigoutsosNode(d_common, this, 0); + d_rht_child = new BergerRigoutsosNode(d_common, this, 1); - d_lft_child->d_box = hier::Box(box_lo, lft_hi, d_block_id); - d_rht_child->d_box = hier::Box(rht_lo, box_hi, d_block_id); - TBOX_ASSERT(d_lft_child->d_box.numberCells() >= d_common->min_box); - TBOX_ASSERT(d_rht_child->d_box.numberCells() >= d_common->min_box); + d_lft_child->d_box = hier::Box(box_lo, lft_hi, d_box.getBlockId()); + d_rht_child->d_box = hier::Box(rht_lo, box_hi, d_box.getBlockId()); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_box.numberCells() >= d_min_box_size) { + TBOX_ASSERT(d_lft_child->d_box.numberCells() >= d_min_box_size); + TBOX_ASSERT(d_rht_child->d_box.numberCells() >= d_min_box_size); + } +#endif d_lft_child->claimMPITag(); d_rht_child->claimMPITag(); d_box_acceptance = rejected_by_calculation; - if (d_common->log_node_history) { - tbox::plog << d_common->num_nodes_allocated << "-allocated " - << d_common->num_nodes_active << "-active " - << d_common->num_nodes_owned << "-owned " - << d_common->num_nodes_completed << "-completed " - << "Lc Split " + if (d_common->d_log_node_history) { + d_common->writeCounters(); + tbox::plog << "Lc Split " << d_generation << ':' << d_pos << " " << d_box << " => " << d_lft_child->d_generation << ':' << d_lft_child->d_pos << d_lft_child->d_box @@ -2094,6 +1608,19 @@ BergerRigoutsosNode::acceptOrSplitBox() * If a hole is found, cut_lo and cut_hi are set to the * range of zero tag cells. * + * Optimization note: There seems to be no reason to look for a single + * zero swath. If there are multiple zero swaths in the signature, + * why not cut through them all and produce multiple children? We may + * have to change d_lft_child and d_rgt_child to d_children[]. If + * we don't cut all the signatures we see, we'd just force the + * children to recompose those signatures themselves. Making multiple + * cuts in the box can significantly reduce the amount of data + * communication in the children nodes. The downside is that we have + * to spend more time finding these cuts before we can notify the + * children. However, if we don't find the cuts when we have the + * chance, the children would have to spend their time looking. + * + * ******************************************************************** */ @@ -2101,13 +1628,13 @@ bool BergerRigoutsosNode::findZeroCutSwath( int& cut_lo, int& cut_hi, - const int dim) + const tbox::Dimension::dir_t dim) { const int lo = d_box.lower(dim); const int hi = d_box.upper(dim); // Compute the limit for the swath. - const int cut_lo_lim = lo + d_common->min_box(dim); - const int cut_hi_lim = hi - d_common->min_box(dim); + const int cut_lo_lim = lo + d_min_box_size(dim); + const int cut_hi_lim = hi - d_min_box_size(dim); /* * Start in the middle of the box. @@ -2127,10 +1654,10 @@ BergerRigoutsosNode::findZeroCutSwath( (d_histogram[dim][cut_lo - lo - 1] == 0)) { --cut_lo; } -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cut_hi >= cut_lo); - TBOX_ASSERT(cut_lo - lo >= d_common->min_box(dim)); - TBOX_ASSERT(hi - cut_hi >= d_common->min_box(dim)); + TBOX_ASSERT(cut_lo - lo >= d_min_box_size(dim)); + TBOX_ASSERT(hi - cut_hi >= d_min_box_size(dim)); +#ifdef DEBUG_CHECK_ASSERTIONS for (int i = cut_lo; i <= cut_hi; ++i) { TBOX_ASSERT(d_histogram[dim][i - lo] == 0); } @@ -2146,10 +1673,10 @@ BergerRigoutsosNode::findZeroCutSwath( (d_histogram[dim][cut_hi - lo + 1] == 0)) { ++cut_hi; } -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cut_hi >= cut_lo); - TBOX_ASSERT(cut_lo - lo >= d_common->min_box(dim)); - TBOX_ASSERT(hi - cut_hi >= d_common->min_box(dim)); + TBOX_ASSERT(cut_lo - lo >= d_min_box_size(dim)); + TBOX_ASSERT(hi - cut_hi >= d_min_box_size(dim)); +#ifdef DEBUG_CHECK_ASSERTIONS for (int i = cut_lo; i <= cut_hi; ++i) { TBOX_ASSERT(d_histogram[dim][i - lo] == 0); } @@ -2170,7 +1697,7 @@ BergerRigoutsosNode::findZeroCutSwath( * inflection point in the histogram for that direction. Note that the * cut point is kept more than a minimium distance from the endpoints * of the index interval (lo, hi). Also, the box must have at least - * three cells along a side to apply the Laplacian test. If no + * three cells along a side to apply the inflection test. If no * inflection point is found, the mid-point of the interval is * returned as the cut point. * @@ -2180,14 +1707,14 @@ BergerRigoutsosNode::findZeroCutSwath( */ void -BergerRigoutsosNode::cutAtLaplacian( +BergerRigoutsosNode::cutAtInflection( int& cut_pt, - int& diff_laplace, - const int dim) + int& inflection, + const tbox::Dimension::dir_t dim) { /* - * New implementation prefers and possibly restricts the Laplace cut - * to the center part of the box. + * New implementation prefers and possibly restricts the inflection + * cut to the center part of the box. * * The cuts refer to face indices, not cell indices. * @@ -2201,9 +1728,9 @@ BergerRigoutsosNode::cutAtLaplacian( TBOX_ASSERT(hist_size >= 2); /* - * Laplacian cut requires at least 4 cells of histogram, so it can - * compare at 2 Laplacians. Without 4 cells, we just cut across the - * largest change in the histogram. + * Inflection cut requires at least 4 cells of histogram, so it can + * compute an inflection value. Without 4 cells, we just cut + * across the largest change in the histogram. */ if (hist_size < 4) { cut_pt = 1; @@ -2214,58 +1741,60 @@ BergerRigoutsosNode::cutAtLaplacian( } } cut_pt += d_box.lower() (dim); - diff_laplace = 0; // Did not use any Laplace values. + inflection = 0; // Not necessarily an inflection point. return; } + const int min_box_size = + tbox::MathUtilities::Max( d_min_box_size(dim), + d_common->d_min_box_size_from_cutting(dim) ); + const int box_lo = 0; const int box_hi = hist_size - 1; const int max_dist_from_center = - int(d_common->max_lap_cut_from_center * hist_size / 2); + int(d_common->d_max_inflection_cut_from_center * hist_size / 2); const int box_mid = (box_lo + box_hi + 1) / 2; const int cut_lo_lim = tbox::MathUtilities::Max( - box_lo + d_common->min_box(dim), - box_mid - max_dist_from_center); + box_lo + min_box_size, box_mid - max_dist_from_center); const int cut_hi_lim = tbox::MathUtilities::Min( - box_hi - d_common->min_box(dim) + 1, - box_mid + max_dist_from_center); + box_hi - min_box_size + 1, box_mid + max_dist_from_center); /* - * Initial cut point and differences between the Laplaces on either - * side of it. We want to cut where this difference is biggest. + * Initial cut point and differences between the Laplacian on + * either side of it. We want to cut where the difference between + * the two Laplacians is greatest and they have oposite signs. */ cut_pt = box_mid; - diff_laplace = + inflection = (hist[cut_pt - 1] - 2 * hist[cut_pt] + hist[cut_pt + 1]) - (hist[cut_pt - 2] - 2 * hist[cut_pt - 1] + hist[cut_pt]); - diff_laplace = tbox::MathUtilities::Abs(diff_laplace); + inflection = tbox::MathUtilities::Abs(inflection); - int ic = 1; - int cut_lo = box_mid - ic; - int cut_hi = box_mid + ic; + int cut_lo = box_mid - 1; + int cut_hi = box_mid + 1; while (cut_lo > cut_lo_lim || cut_hi < cut_hi_lim) { if (cut_lo > cut_lo_lim) { const int la = (hist[cut_lo - 1] - 2 * hist[cut_lo] + hist[cut_lo + 1]); const int lb = (hist[cut_lo - 2] - 2 * hist[cut_lo - 1] + hist[cut_lo]); - if ( la*lb <= 0 ) { - const int try_diff_laplace = tbox::MathUtilities::Abs(la-lb); - if (try_diff_laplace > diff_laplace) { + if (la * lb <= 0) { + const int try_inflection = tbox::MathUtilities::Abs(la - lb); + if (try_inflection > inflection) { cut_pt = cut_lo; - diff_laplace = try_diff_laplace; + inflection = try_inflection; } } } if (cut_hi < cut_hi_lim) { const int la = (hist[cut_hi - 1] - 2 * hist[cut_hi] + hist[cut_hi + 1]); const int lb = (hist[cut_hi - 2] - 2 * hist[cut_hi - 1] + hist[cut_hi]); - if ( la*lb <= 0 ) { - const int try_diff_laplace = tbox::MathUtilities::Abs(la-lb); - if (try_diff_laplace > diff_laplace) { + if (la * lb <= 0) { + const int try_inflection = tbox::MathUtilities::Abs(la - lb); + if (try_inflection > inflection) { cut_pt = cut_hi; - diff_laplace = try_diff_laplace; + inflection = try_inflection; } } } @@ -2278,33 +1807,36 @@ BergerRigoutsosNode::cutAtLaplacian( /* ******************************************************************** - * Create a DLBG Box in d_common->new_mapped_box_level, + * Create a DLBG Box in d_new_box_level, * where the output boxes of the algorithm is saved. * - * Only the owner should create the mapped_box_level node this way. - * Other processes build mapped_box_level node using data from owner. + * Only the owner should create the box_level node this way. + * Other processes build box_level node using data from owner. + * + * TODO: this should be renamed putBoxInBoxLevel. ******************************************************************** */ void BergerRigoutsosNode::createBox() { - TBOX_ASSERT(d_common->rank == d_owner); + TBOX_ASSERT(d_common->d_mpi.getRank() == d_box.getOwnerRank()); hier::LocalId last_index = - d_common->new_mapped_box_level->getBoxes().isEmpty() ? d_first_local_id : - d_common->new_mapped_box_level->getBoxes().back().getLocalId(); + d_common->d_new_box_level->getBoxes().empty() ? hier::LocalId(-1) : + d_common->d_new_box_level->getBoxes().back().getLocalId(); - hier::Box new_box(d_box, last_index + 1, d_common->rank); - TBOX_ASSERT(new_box.getBlockId() == d_block_id); - d_common->new_mapped_box_level->addBoxWithoutUpdate(new_box); - d_mapped_box_iterator = d_common->new_mapped_box_level->getBox(new_box); + hier::Box new_box(d_box, last_index + 1, d_common->d_mpi.getRank()); + TBOX_ASSERT(new_box.getBlockId() == d_box.getBlockId()); + d_common->d_new_box_level->addBoxWithoutUpdate(new_box); + d_box_iterator = d_common->d_new_box_level->getBox(new_box); - d_mapped_box = *d_mapped_box_iterator; + TBOX_ASSERT(d_box_iterator->isSpatiallyEqual(d_box)); + d_box = *d_box_iterator; } /* ******************************************************************** * Discard the Box. On the owner, this Box is a part of - * d_common->new_mapped_box_level where it must be removed. On + * d_new_box_level where it must be removed. On * contributors the Box can just be ignored. To prevent bugs, * the node and its iterator are set to unusable values. ******************************************************************** @@ -2312,13 +1844,12 @@ BergerRigoutsosNode::createBox() void BergerRigoutsosNode::eraseBox() { - if (d_common->rank == d_owner) { - d_common->new_mapped_box_level->eraseBoxWithoutUpdate( - *d_mapped_box_iterator); + if (d_common->d_mpi.getRank() == d_box.getOwnerRank()) { + d_common->d_new_box_level->eraseBoxWithoutUpdate( + *d_box_iterator); } #ifdef DEBUG_CHECK_ASSERTIONS - d_mapped_box_iterator = BoxContainer().end(); - d_mapped_box = hier::Box(d_dim); + d_box_iterator = hier::BoxContainer().end(); #endif } @@ -2331,21 +1862,21 @@ BergerRigoutsosNode::countOverlapWithLocalPatches() * Remove the child if it has zero overlap. */ hier::Box lft_grown_box = d_lft_child->d_box; - lft_grown_box.grow(d_common->max_gcw); + lft_grown_box.grow(d_common->d_tag_to_new_width); hier::Box rht_grown_box = d_rht_child->d_box; - rht_grown_box.grow(d_common->max_gcw); - int& lft_overlap = d_lft_child->d_overlap; - int& rht_overlap = d_rht_child->d_overlap; + rht_grown_box.grow(d_common->d_tag_to_new_width); + size_t& lft_overlap = d_lft_child->d_overlap; + size_t& rht_overlap = d_rht_child->d_overlap; lft_overlap = rht_overlap = 0; - const hier::PatchLevel& tag_level = *d_common->tag_level; + const hier::PatchLevel& tag_level = *d_common->d_tag_level; for (hier::PatchLevel::iterator ip(tag_level.begin()); ip != tag_level.end(); ++ip) { - const hier::BlockId& block_id = (*ip)->getBox().getBlockId(); + const hier::Box& patch_box = (*ip)->getBox(); + const hier::BlockId& block_id = patch_box.getBlockId(); - if (block_id == d_block_id) { - const hier::Box& patch_box = (*ip)->getBox(); + if (block_id == d_box.getBlockId()) { hier::Box lft_intersection = patch_box * lft_grown_box; lft_overlap += lft_intersection.size(); @@ -2353,6 +1884,23 @@ BergerRigoutsosNode::countOverlapWithLocalPatches() hier::Box rht_intersection = patch_box * rht_grown_box; rht_overlap += rht_intersection.size(); + } else { + + hier::Box transform_box(patch_box); + bool transformed = + d_common->d_tag_level->getGridGeometry()->transformBox( + transform_box, + d_common->d_tag_level->getLevelNumber(), + d_box.getBlockId(), + block_id); + + if (transformed) { + hier::Box lft_intersection = transform_box * lft_grown_box; + lft_overlap += lft_intersection.size(); + + hier::Box rht_intersection = transform_box * rht_grown_box; + rht_overlap += rht_intersection.size(); + } } } } @@ -2378,8 +1926,12 @@ BergerRigoutsosNode::formChildGroups() d_rht_child->d_group.resize(1, BAD_INTEGER); d_lft_child->d_group[0] = d_group[0]; d_rht_child->d_group[0] = d_group[0]; - d_lft_child->d_owner = d_owner; - d_rht_child->d_owner = d_owner; + d_lft_child->d_box.initialize(d_lft_child->d_box, + d_lft_child->d_box.getLocalId(), + d_box.getOwnerRank()); + d_rht_child->d_box.initialize(d_rht_child->d_box, + d_rht_child->d_box.getLocalId(), + d_box.getOwnerRank()); return; } @@ -2390,48 +1942,49 @@ BergerRigoutsosNode::formChildGroups() /* * Only owner process should be here. */ - if (d_common->rank != d_owner) { - TBOX_ERROR("Library error!"); + if (d_common->d_mpi.getRank() != d_box.getOwnerRank()) { + TBOX_ERROR("Library error!" << std::endl); } - TBOX_ASSERT(d_recv_msg.size() == 4 * d_group.size()); #endif + TBOX_ASSERT(d_recv_msg.size() == 4 * d_group.size()); int* lft_overlap = &d_recv_msg[0]; int* rht_overlap = &d_recv_msg[1]; - const int imyself = findOwnerInGroup(d_common->rank, d_group); - lft_overlap[imyself * 4] = d_lft_child->d_overlap; - rht_overlap[imyself * 4] = d_rht_child->d_overlap; + const int imyself = findOwnerInGroup(d_common->d_mpi.getRank(), d_group); + // TODO: Use MessageStream instead of int* for buffer to pass values greater than int. + lft_overlap[imyself * 4] = static_cast(d_lft_child->d_overlap); + rht_overlap[imyself * 4] = static_cast(d_rht_child->d_overlap); - int* lft_criteria = NULL; - int* rht_criteria = NULL; - switch (d_common->owner_mode) { - case SINGLE_OWNER: + int* lft_criteria = 0; + int* rht_criteria = 0; + switch (d_common->d_owner_mode) { + case BergerRigoutsos::SINGLE_OWNER: lft_criteria = &d_recv_msg[0]; rht_criteria = &d_recv_msg[1]; lft_criteria[imyself * 4] = tbox::MathUtilities::getMax(); rht_criteria[imyself * 4] = tbox::MathUtilities::getMax(); break; - case MOST_OVERLAP: + case BergerRigoutsos::MOST_OVERLAP: lft_criteria = &d_recv_msg[0]; rht_criteria = &d_recv_msg[1]; - lft_criteria[imyself * 4] = d_lft_child->d_overlap; - rht_criteria[imyself * 4] = d_rht_child->d_overlap; + lft_criteria[imyself * 4] = static_cast(d_lft_child->d_overlap); + rht_criteria[imyself * 4] = static_cast(d_rht_child->d_overlap); break; - case FEWEST_OWNED: + case BergerRigoutsos::FEWEST_OWNED: lft_criteria = &d_recv_msg[2]; rht_criteria = &d_recv_msg[2]; - lft_criteria[imyself * 4] = -d_common->num_nodes_owned; - rht_criteria[imyself * 4] = -d_common->num_nodes_owned; + lft_criteria[imyself * 4] = -d_common->d_num_nodes_owned; + rht_criteria[imyself * 4] = -d_common->d_num_nodes_owned; break; - case LEAST_ACTIVE: + case BergerRigoutsos::LEAST_ACTIVE: lft_criteria = &d_recv_msg[3]; rht_criteria = &d_recv_msg[3]; - lft_criteria[imyself * 4] = -d_common->num_nodes_active; - rht_criteria[imyself * 4] = -d_common->num_nodes_active; + lft_criteria[imyself * 4] = -d_common->d_num_nodes_active; + rht_criteria[imyself * 4] = -d_common->d_num_nodes_active; break; default: - TBOX_ERROR("LIBRARY error"); + TBOX_ERROR("LIBRARY error" << std::endl); break; } @@ -2447,52 +2000,60 @@ BergerRigoutsosNode::formChildGroups() * owner of the left/right sides. For efficiency in some searches * through d_groups, make sure that d_group is ordered. */ + int lft_owner = -1; + int rht_owner = -1; for (unsigned int i = 0; i < d_group.size(); ++i) { int i4 = i * 4; if (lft_overlap[i4] != 0) { d_lft_child->d_group[n_lft++] = d_group[i]; if (lft_criteria[i4] > lft_owner_score) { - d_lft_child->d_owner = d_group[i]; + lft_owner = d_group[i]; lft_owner_score = lft_criteria[i4]; } } if (rht_overlap[i4] != 0) { d_rht_child->d_group[n_rht++] = d_group[i]; if (rht_criteria[i4] > rht_owner_score) { - d_rht_child->d_owner = d_group[i]; + rht_owner = d_group[i]; rht_owner_score = rht_criteria[i4]; } } } + d_lft_child->d_box.initialize(d_lft_child->d_box, + d_lft_child->d_box.getLocalId(), + lft_owner); + d_rht_child->d_box.initialize(d_rht_child->d_box, + d_rht_child->d_box.getLocalId(), + rht_owner); d_lft_child->d_group.resize(n_lft, BAD_INTEGER); d_rht_child->d_group.resize(n_rht, BAD_INTEGER); -#ifdef DEBUG_CHECK_ASSERTIONS // Recall that only the owner should execute this code. - TBOX_ASSERT(d_lft_child->d_owner >= 0); + TBOX_ASSERT(d_lft_child->d_box.getOwnerRank() >= 0); TBOX_ASSERT(d_lft_child->d_group.size() > 0); TBOX_ASSERT(d_lft_child->d_group.size() <= d_group.size()); - TBOX_ASSERT(d_common->owner_mode == SINGLE_OWNER || + TBOX_ASSERT(d_common->d_owner_mode == BergerRigoutsos::SINGLE_OWNER || ((d_lft_child->d_overlap == 0) != inGroup(d_lft_child->d_group))); - TBOX_ASSERT(d_rht_child->d_owner >= 0); + TBOX_ASSERT(d_rht_child->d_box.getOwnerRank() >= 0); TBOX_ASSERT(d_rht_child->d_group.size() > 0); TBOX_ASSERT(d_rht_child->d_group.size() <= d_group.size()); - TBOX_ASSERT(d_common->owner_mode == SINGLE_OWNER || + TBOX_ASSERT(d_common->d_owner_mode == BergerRigoutsos::SINGLE_OWNER || ((d_rht_child->d_overlap == 0) != inGroup(d_rht_child->d_group))); - if (d_common->owner_mode == SINGLE_OWNER) { - TBOX_ASSERT(inGroup(d_lft_child->d_group, d_owner)); - TBOX_ASSERT(inGroup(d_rht_child->d_group, d_owner)); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_common->d_owner_mode == BergerRigoutsos::SINGLE_OWNER) { + TBOX_ASSERT(inGroup(d_lft_child->d_group, d_box.getOwnerRank())); + TBOX_ASSERT(inGroup(d_rht_child->d_group, d_box.getOwnerRank())); } for (size_t i = 0; i < d_group.size(); ++i) { TBOX_ASSERT(i == 0 || d_group[i] > d_group[i - 1]); TBOX_ASSERT((lft_overlap[i * 4] > 0 || - (d_group[i] == d_lft_child->d_owner)) + (d_group[i] == d_lft_child->d_box.getOwnerRank())) == inGroup(d_lft_child->d_group, d_group[i])); TBOX_ASSERT((rht_overlap[i * 4] > 0 || - (d_group[i] == d_rht_child->d_owner)) + (d_group[i] == d_rht_child->d_box.getOwnerRank())) == inGroup(d_rht_child->d_group, d_group[i])); } #endif @@ -2507,7 +2068,7 @@ BergerRigoutsosNode::formChildGroups() * Note that the relationship data may be duplicated in two objects. * - tag_to_new stores the relationships organized around each node * in the tagged level. For each node on the tagged level, - * we store a container of neighbors on the new mapped_box_level. + * we store a container of neighbors on the new box_level. * - new_to_tag stores the relationships organized around each NEW node. * For each new node we store a container of neighbors on the * tagged level. @@ -2526,47 +2087,59 @@ BergerRigoutsosNode::formChildGroups() void BergerRigoutsosNode::computeNewNeighborhoodSets() { - d_common->t_compute_new_graph_relationships->start(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(d_common->compute_relationships > 0); - TBOX_ASSERT(d_mapped_box.getLocalId() >= 0); + d_common->d_object_timers->t_compute_new_neighborhood_sets->start(); + TBOX_ASSERT(d_common->d_compute_relationships > 0); TBOX_ASSERT(boxAccepted()); TBOX_ASSERT(d_box_acceptance != accepted_by_dropout_bcast); - if (d_parent != NULL) { - /* - * Do not check for min_box violation in root node. That - * check should be done outside of this class in order to - * have flexibility regarding how to handle it. - */ - TBOX_ASSERT(d_box.numberCells() >= d_common->min_box); - } + /* + * Do not check for min_box violation in root node. That + * check should be done outside of this class in order to + * have flexibility regarding how to handle it. + */ + TBOX_ASSERT(d_parent == 0 || d_box.numberCells() >= d_min_box_size); /* * We should not compute nabrs if we got the node * by a dropout broadcast because we already know * there is no overlap! */ TBOX_ASSERT(d_box_acceptance != accepted_by_dropout_bcast); -#endif // Create an expanded box for intersection check. hier::Box grown_box = d_box; - grown_box.grow(d_common->max_gcw); + grown_box.grow(d_common->d_tag_to_new_width); + hier::BoxContainer grown_boxes; + if (d_common->d_tag_level->getGridGeometry()->getNumberBlocks() == 1 || + d_common->d_tag_level->getGridGeometry()->hasIsotropicRatios()) { + grown_boxes.pushBack(d_box); + grown_boxes.grow(d_common->d_tag_to_new_width); + } else { + hier::BoxUtilities::growAndAdjustAcrossBlockBoundary( + grown_boxes, + d_box, + d_common->d_tag_level->getGridGeometry(), + d_common->d_tag_to_new->getBase().getRefinementRatio(), + d_common->d_tag_to_new->getRatio(), + d_common->d_tag_to_new_width, + false, + false); + } /* * On the owner process, we store the neighbors of the new node. * This data is NOT required on other processes. */ - bool on_owner_process = d_common->rank == d_owner; + bool on_owner_process = d_common->d_mpi.getRank() == d_box.getOwnerRank(); if (on_owner_process) { - d_common->new_to_tag->makeEmptyLocalNeighborhood(d_mapped_box.getId()); + d_common->d_tag_to_new->getTranspose().makeEmptyLocalNeighborhood(d_box.getBoxId()); } - // Data to send to d_owner regarding new relationships found by local process. - VectorOfInts* relationship_message = NULL; - if (d_common->compute_relationships > 1 && d_common->rank != d_owner) { + // Data to send to owner regarding new relationships found by local process. + VectorOfInts* relationship_message = 0; + if (d_common->d_compute_relationships > 1 && d_common->d_mpi.getRank() != + d_box.getOwnerRank()) { /* - * Will have to send to d_owner the relationships found locally for - * graph node d_mapped_box. + * Will have to send to owner the relationships found locally for + * d_box. * Label the id of the new node and the (yet unknown) number * of relationship found for it. * @@ -2576,214 +2149,81 @@ BergerRigoutsosNode::computeNewNeighborhoodSets() * - number of relationships found for the new node * - index of nodes on the tagged level overlapping new node. */ - relationship_message = &d_common->relationship_messages[d_owner]; - relationship_message->insert(relationship_message->end(), d_mapped_box.getLocalId().getValue()); + relationship_message = &d_common->d_relationship_messages[d_box.getOwnerRank()]; + relationship_message->insert(relationship_message->end(), d_box.getLocalId().getValue()); relationship_message->insert(relationship_message->end(), 0); } const int index_of_counter = - (relationship_message != NULL ? static_cast(relationship_message->size()) : 0) - 1; - const int ints_per_node = hier::Box::commBufferSize(d_dim); - - const BoxContainer& tag_mapped_boxes = - d_common->tag_mapped_box_level->getBoxes(); - - for (hier::RealBoxConstIterator ni(tag_mapped_boxes.realBegin()); - ni != tag_mapped_boxes.realEnd(); ++ni) { - - const hier::Box& tag_mapped_box = *ni; - - if (tag_mapped_box.getBlockId() == d_block_id) { - hier::Box intersection = tag_mapped_box * grown_box; + (relationship_message != 0 ? static_cast(relationship_message->size()) : 0) - 1; + const int ints_per_node = hier::Box::commBufferSize(d_common->getDim()); + + const hier::BoxContainer& tag_boxes = d_common->d_tag_level->getBoxLevel()->getBoxes(); + + for (hier::RealBoxConstIterator ni(tag_boxes.realBegin()); + ni != tag_boxes.realEnd(); ++ni) { + + const hier::Box& tag_box = *ni; + + bool intersection = false; + for (hier::BoxContainer::const_iterator b_itr = grown_boxes.begin(); + !intersection && b_itr != grown_boxes.end(); ++b_itr) { + if (tag_box.getBlockId() == b_itr->getBlockId()) { + intersection = tag_box.intersects(*b_itr); + } else { + hier::Box transform_box(tag_box); + bool transformed = + d_common->d_tag_level->getGridGeometry()->transformBox( + transform_box, + d_common->d_tag_level->getRatioToLevelZero(), + b_itr->getBlockId(), + tag_box.getBlockId()); + if (transformed) { + intersection = transform_box.intersects(*b_itr); + } + } + } - if (!intersection.empty()) { + if (intersection) { - // Add d_mapped_box as a neighbor of tag_mapped_box. - d_common->tag_to_new->insertLocalNeighbor(d_mapped_box, - tag_mapped_box.getId()); + // Add d_box as a neighbor of tag_box. + d_common->d_tag_to_new->insertLocalNeighbor(d_box, + tag_box.getBoxId()); - if (on_owner_process) { - // Owner adds tag_mapped_box as a neighbor of d_mapped_box. - d_common->new_to_tag->insertLocalNeighbor(tag_mapped_box, - d_mapped_box.getId()); - } + if (on_owner_process) { + // Owner adds tag_box as a neighbor of d_box. + d_common->d_tag_to_new->getTranspose().insertLocalNeighbor(tag_box, + d_box.getBoxId()); + } - if (relationship_message != NULL) { - /* Non-owners put found relationship in the message - * to (eventually) send to d_owner. - */ - relationship_message->insert(relationship_message->end(), ints_per_node, 0); - int* ptr = &(*relationship_message)[relationship_message->size() - ints_per_node]; - tag_mapped_box.putToIntBuffer(ptr); - ++(*relationship_message)[index_of_counter]; - } + if (relationship_message != 0) { + /* Non-owners put found relationship in the message + * to (eventually) send to owner. + */ + relationship_message->insert(relationship_message->end(), ints_per_node, 0); + int* ptr = &(*relationship_message)[relationship_message->size() - ints_per_node]; + tag_box.putToIntBuffer(ptr); + ++(*relationship_message)[index_of_counter]; } } } - if (d_common->compute_relationships > 1 && - d_common->rank == d_owner) { + if (d_common->d_compute_relationships > 1 && + d_common->d_mpi.getRank() == d_box.getOwnerRank()) { /* * If box was accepted, the owner should remember * which process will be sending relationship data. * Update the list of relationship senders to make sure * it includes all processes in the group. - * We use this list in shareNewNeighborhoodSetsWithOwners to + * We use this list in + * BergerRigoutsos::shareNewNeighborhoodSetsWithOwners to * tell us which processors are sending us new relationships. * The relationship senders are the participants of the group. */ - d_common->relationship_senders.insert(d_group.begin(), d_group.end()); + d_common->d_relationship_senders.insert(d_group.begin(), d_group.end()); } - d_common->t_compute_new_graph_relationships->stop(); -} - -/* - ********************************************************************** - * - * Send new relationships found by local process to owners of the new nodes - * associated with those relationships. Receive similar data from other - * processes. - * - * Messages to be sent out were placed in d_common->relationship_messages by - * computeNewNeighborhoodSets(). This method sends out these messages - * and receives anticipated messages from processes listed in - * d_common->relationship_senders. Received messages are unpacked to get - * data on new relationships. - * - ********************************************************************** - */ -void -BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners() -{ - tbox::SAMRAI_MPI mpi(d_common->mpi_object); - if (mpi.getSize() == 1) { - return; - } - - d_common->t_share_new_relationships->start(); - - IntSet relationship_senders = d_common->relationship_senders; - std::map& relationship_messages = d_common->relationship_messages; - - const int ints_per_node = hier::Box::commBufferSize(d_dim); - - int ierr; - tbox::SAMRAI_MPI::Status mpi_status; - - // Nonblocking send of relationship data. - d_common->t_share_new_relationships_send->start(); - tbox::Array mpi_request( - static_cast(relationship_messages.size())); - std::map::iterator send_i; - int nsend = 0; - for (send_i = relationship_messages.begin(), nsend = 0; - send_i != relationship_messages.end(); - ++send_i, ++nsend) { - const int& owner = (*send_i).first; - VectorOfInts& msg = (*send_i).second; - ierr = mpi.Isend(&msg[0], - static_cast(msg.size()), - MPI_INT, - owner, - d_common->tag_upper_bound, - &mpi_request[nsend]); -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(ierr); -#endif - TBOX_ASSERT(ierr == MPI_SUCCESS); - } - d_common->t_share_new_relationships_send->stop(); - - { - /* - * The rest of this method assumes current process is NOT - * in relationship_senders, so remove it. For efficiency, method - * computeNewNeighborhoodSets() (which created the relationship senders) - * did not remove it. - */ - IntSet::iterator local = relationship_senders.find(d_common->rank); - if (local != relationship_senders.end()) { - relationship_senders.erase(local); - } - } - - /* - * Create set recved_from which is to contain ranks of - * processes from which we've received the expected relationship data. - * The while loop goes until all expected messages have - * been received from relationship_senders. - * - * In the while loop: - * - Probe for an incomming message. - * - Determine its size allocate memory for receiving the message. - * - Receive the message. - * - Get relationship data from the message. - */ - IntSet recved_from; - while (recved_from.size() < relationship_senders.size()) { - - d_common->t_share_new_relationships_recv->start(); - ierr = mpi.Probe(MPI_ANY_SOURCE, - d_common->tag_upper_bound, - &mpi_status); - TBOX_ASSERT(ierr == MPI_SUCCESS); - - const int sender = mpi_status.MPI_SOURCE; - int mesg_size = -1; - mpi.Get_count(&mpi_status, MPI_INT, &mesg_size); - TBOX_ASSERT(relationship_senders.find(sender) != relationship_senders.end()); - TBOX_ASSERT(recved_from.find(sender) == recved_from.end()); - TBOX_ASSERT(mesg_size >= 0); - - tbox::Array buf(mesg_size); - int* ptr = buf.getPointer(); - ierr = mpi.Recv(ptr, - mesg_size, - MPI_INT, - sender, - d_common->tag_upper_bound, - &mpi_status); - TBOX_ASSERT(ierr == MPI_SUCCESS); - d_common->t_share_new_relationships_recv->stop(); - - d_common->t_share_new_relationships_unpack->start(); - int consumed = 0; - while (ptr < buf.getPointer() + buf.size()) { - const hier::LocalId new_local_id(*(ptr++)); - hier::BoxId box_id(new_local_id, d_common->rank); - int n_new_relationships = *(ptr++); - TBOX_ASSERT(d_common->new_to_tag->hasNeighborSet(box_id)); - if (n_new_relationships > 0) { - hier::Connector::NeighborhoodIterator base_box_itr = - d_common->new_to_tag->makeEmptyLocalNeighborhood(box_id); - for (int n = 0; n < n_new_relationships; ++n) { - hier::Box node(d_dim); - node.getFromIntBuffer(ptr); - ptr += ints_per_node; - d_common->new_to_tag->insertLocalNeighbor(node, base_box_itr); - } - } - consumed += 2 + n_new_relationships * ints_per_node; - } - recved_from.insert(sender); - d_common->t_share_new_relationships_unpack->stop(); - } - - if (nsend > 0) { - // Make sure all nonblocking sends completed. - d_common->t_share_new_relationships_send->start(); - tbox::Array mpi_statuses( - static_cast(relationship_messages.size())); - ierr = mpi.Waitall(static_cast(relationship_messages.size()), - mpi_request.getPointer(), - mpi_statuses.getPointer()); - TBOX_ASSERT(ierr == MPI_SUCCESS); - d_common->t_share_new_relationships_send->stop(); - } - - d_common->t_share_new_relationships->stop(); - + d_common->d_object_timers->t_compute_new_neighborhood_sets->stop(); } /* @@ -2792,12 +2232,12 @@ BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners() ******************************************************************** */ -int* +int * BergerRigoutsosNode::putHistogramToBuffer( - int* buffer) + int* buffer) { - int dim_val = d_dim.getValue(); - for (int d = 0; d < dim_val; ++d) { + int dim_val = d_common->getDim().getValue(); + for (tbox::Dimension::dir_t d = 0; d < dim_val; ++d) { d_histogram[d].resize(d_box.numberCells(d), BAD_INTEGER); memcpy(buffer, &d_histogram[d][0], @@ -2807,12 +2247,12 @@ BergerRigoutsosNode::putHistogramToBuffer( return buffer; } -int* +int * BergerRigoutsosNode::getHistogramFromBuffer( - int* buffer) + int* buffer) { - unsigned int dim_val = d_dim.getValue(); - for (unsigned int d = 0; d < dim_val; ++d) { + tbox::Dimension::dir_t dim_val = d_common->getDim().getValue(); + for (tbox::Dimension::dir_t d = 0; d < dim_val; ++d) { TBOX_ASSERT((int)d_histogram[d].size() == d_box.numberCells(d)); // d_histogram[d].resizeArray( d_box.numberCells(d) ); memcpy(&d_histogram[d][0], @@ -2823,14 +2263,14 @@ BergerRigoutsosNode::getHistogramFromBuffer( return buffer; } -int* -BergerRigoutsosNode:: putBoxToBuffer( - const hier::Box& box, - int* buffer) const +int * +BergerRigoutsosNode::putBoxToBuffer( + const hier::Box& box, + int* buffer) const { - const hier::IntVector& l = box.lower(); - const hier::IntVector& u = box.upper(); - int dim_val = d_dim.getValue(); + const hier::Index& l = box.lower(); + const hier::Index& u = box.upper(); + int dim_val = d_common->getDim().getValue(); for (int d = 0; d < dim_val; ++d) { *(buffer++) = l(d); *(buffer++) = u(d); @@ -2838,17 +2278,15 @@ BergerRigoutsosNode:: putBoxToBuffer( return buffer; } -int* +int * BergerRigoutsosNode::getBoxFromBuffer( hier::Box& box, int* buffer) const { - hier::IntVector& l = box.lower(); - hier::IntVector& u = box.upper(); - int dim_val = d_dim.getValue(); + int dim_val = d_common->getDim().getValue(); for (int d = 0; d < dim_val; ++d) { - l(d) = *(buffer++); - u(d) = *(buffer++); + box.setLower(static_cast(d), *(buffer++)); + box.setUpper(static_cast(d), *(buffer++)); } return buffer; } @@ -2906,17 +2344,18 @@ void BergerRigoutsosNode::claimMPITag() { /* - * Each dendogram node should claim no more than one MPI tag + * Each node should claim no more than one MPI tag * so make sure it does not already have one. */ TBOX_ASSERT(d_mpi_tag < 0); - d_mpi_tag = d_common->available_mpi_tag; - d_common->available_mpi_tag = d_mpi_tag + total_phase_tags; + d_mpi_tag = d_common->d_available_mpi_tag; + d_common->d_available_mpi_tag = d_mpi_tag + total_phase_tags; if (d_mpi_tag + total_phase_tags - 1 > - d_common->tag_upper_bound / (d_common->nproc) * (d_common->rank + 1)) { + d_common->d_tag_upper_bound / (d_common->d_mpi.getSize()) + * (d_common->d_mpi.getRank() + 1)) { /* - * Each process is alloted tag_upper_bound/(d_common->nproc) + * Each process is alloted tag_upper_bound/(d_common->d_mpi.getSize()) * tag values. If it needs more than this, it will encroach * on the tag pool of the next process and may lead to using * non-unique tags. @@ -2924,11 +2363,13 @@ BergerRigoutsosNode::claimMPITag() TBOX_ERROR("Out of MPI tag values need to ensure that\n" << "messages are properly differentiated." << "\nd_mpi_tag = " << d_mpi_tag - << "\ntag_upper_bound = " << d_common->tag_upper_bound - << "\nmber of nodes = " << d_common->nproc + << "\ntag_upper_bound = " << d_common->d_tag_upper_bound + << "\nmber of nodes = " << d_common->d_mpi.getSize() << "\nmax tag required = " << d_mpi_tag + total_phase_tags - 1 << "\nmax tag available = " - << d_common->tag_upper_bound / (d_common->nproc) * (d_common->rank + 1)); + << d_common->d_tag_upper_bound / (d_common->d_mpi.getSize()) + * (d_common->d_mpi.getRank() + 1) + << std::endl); /* * It is probably safe to recycle tags if we run out of MPI tags. * This is not implemented because thus far, there is no need for it. @@ -2981,223 +2422,30 @@ BergerRigoutsosNode::intToBoxAcceptance( return undetermined; } -void -BergerRigoutsosNode::printClassData( - std::ostream& os, - int detail_level) const -{ - os << "ID " << d_pos << " owner=" << d_owner << " box=" - << d_box - ; - if (detail_level > 0) { - os << "\nfamily " << (d_parent == NULL ? 0 : d_parent->d_pos) - << ' ' << (d_lft_child ? (d_lft_child->d_pos) : -1) - << ' ' << (d_rht_child ? (d_rht_child->d_pos) : -1) - ; - } - if (detail_level > 1) { - os << "\nthis " << this - << "\ngeneration " << d_generation << " place=" - << ((d_pos % 2) ? 'r' : 'l') - << "\nnode " << d_mapped_box - << "\nbox_acceptance " << d_box_acceptance - << "\noverlap " << d_overlap - << "\ngroup " << d_group.size() << ':' - ; - for (size_t i = 0; i < d_group.size(); ++i) { - os << ' ' << d_group[i]; - } - os << std::endl; - } -} - /* ********************************************************************** - * - * Methods for setting algorithm parameters before running. - * ********************************************************************** */ - void -BergerRigoutsosNode::setAlgorithmAdvanceMode( - const std::string& mode) -{ - if (mode == "ADVANCE_ANY") { - d_common->algo_advance_mode = ADVANCE_ANY; - } else if (mode == "ADVANCE_SOME") { - d_common->algo_advance_mode = ADVANCE_SOME; - } else if (mode == "SYNCHRONOUS") { - d_common->algo_advance_mode = SYNCHRONOUS; - } else { - TBOX_ERROR("No such algorithm choice: " << mode << "\n"); - } -} - -void -BergerRigoutsosNode::setOwnerMode( - const std::string& mode) -{ - if (mode == "SINGLE_OWNER") { - d_common->owner_mode = SINGLE_OWNER; - } else if (mode == "MOST_OVERLAP") { - d_common->owner_mode = MOST_OVERLAP; - } else if (mode == "FEWEST_OWNED") { - d_common->owner_mode = FEWEST_OWNED; - } else if (mode == "LEAST_ACTIVE") { - d_common->owner_mode = LEAST_ACTIVE; - } else { - TBOX_ERROR("BergerRigoutsosNode: Unrecognized owner mode request: " - << mode); - } -} - -void -BergerRigoutsosNode::setComputeRelationships( - const std::string mode, - const hier::IntVector& ghost_cell_width) -{ - if (mode == "NONE") { - d_common->compute_relationships = 0; - } else if (mode == "TAG_TO_NEW") { - d_common->compute_relationships = 1; - } else if (mode == "BIDIRECTIONAL") { - d_common->compute_relationships = 2; - } else { - TBOX_ERROR("BergerRigoutsosNode::setComputeRelationships error:\n" - << "bad mode '" << mode << "' specified.\n" - << "Should be one of NONE, TAG_TO_NEW, BIDIRECTIONAL"); - } - TBOX_ASSERT(ghost_cell_width >= hier::IntVector::getZero(d_dim)); - d_common->max_gcw = ghost_cell_width; -} - -/* - ********************************************************************** - * - * Methods for collecting data on dendogram after it completes. - * - ********************************************************************** - */ - -void -BergerRigoutsosNode::printDendogramState( - std::ostream& co, - const std::string& border) const -{ - co << border; - for (int i = 0; i < d_generation; ++i) { - co << " "; - } - printState(co); - co << std::endl; - if (d_lft_child) { - d_lft_child->printDendogramState(co, border); - } - if (d_rht_child) { - d_rht_child->printDendogramState(co, border); - } -} - -void -BergerRigoutsosNode::printState( +BergerRigoutsosNode::printNodeState( std::ostream& co) const { - co << d_generation << ':' << d_pos << '=' << d_mapped_box - << " o=" << d_owner << ',' << (d_common->rank == d_owner) + co << d_generation << ':' << d_pos << '=' << d_box + << " o=" << d_box.getOwnerRank() << ',' << (d_common->d_mpi.getRank() == d_box.getOwnerRank()) << " a=" << d_box_acceptance << " w=" << d_wait_phase << '/' << bool(d_comm_group) << (d_comm_group ? d_comm_group->isDone() : true) << " t=" << d_num_tags; if (d_lft_child) { co << " l=" << d_lft_child->d_generation << ':' << d_lft_child->d_pos - << '=' << d_lft_child->d_mapped_box; + << '=' << d_lft_child->d_box; } if (d_rht_child) { co << " r=" << d_rht_child->d_generation << ':' << d_rht_child->d_pos - << '=' << d_rht_child->d_mapped_box; + << '=' << d_rht_child->d_box; } } -/* - ************************************************************************* - ************************************************************************* - */ -void -BergerRigoutsosNode::initializeCallback() -{ - // Timers - CommonParams::t_cluster = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::cluster"); - CommonParams::t_cluster_and_compute_relationships = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::clusterAndComputeRelationships()"); - CommonParams::t_continue_algorithm = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::continueAlgorithm()"); - - CommonParams::t_compute = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::compute"); - CommonParams::t_comm_wait = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::Comm_wait"); - CommonParams::t_MPI_wait = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::MPI_wait"); - - CommonParams::t_compute_new_graph_relationships = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::computeNewNeighborhoodSets()"); - CommonParams::t_share_new_relationships = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners()"); - CommonParams::t_share_new_relationships_send = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners()_send"); - CommonParams::t_share_new_relationships_recv = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners()_recv"); - CommonParams::t_share_new_relationships_unpack = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::shareNewNeighborhoodSetsWithOwners()_unpack"); - - CommonParams::t_local_histogram = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::makeLocalTagHistogram()"); - CommonParams::t_local_tasks = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::continueAlgorithm()_local_tasks"); - - // Multi-stage timers. - CommonParams::t_reduce_histogram = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::reduce_histogram"); - CommonParams::t_bcast_acceptability = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::bcast_acceptability"); - CommonParams::t_gather_grouping_criteria = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::gather_grouping_criteria"); - CommonParams::t_bcast_child_groups = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::bcast_child_groups"); - CommonParams::t_bcast_to_dropouts = tbox::TimerManager::getManager()-> - getTimer("mesh::BergerRigoutsosNode::bcast_to_dropouts"); - -} - -/* - ************************************************************************* - ************************************************************************* - */ -void -BergerRigoutsosNode::finalizeCallback() -{ - CommonParams::t_cluster.reset(); - CommonParams::t_cluster_and_compute_relationships.reset(); - CommonParams::t_continue_algorithm.reset(); - CommonParams::t_compute.reset(); - CommonParams::t_comm_wait.reset(); - CommonParams::t_MPI_wait.reset(); - CommonParams::t_compute_new_graph_relationships.reset(); - CommonParams::t_share_new_relationships.reset(); - CommonParams::t_share_new_relationships_send.reset(); - CommonParams::t_share_new_relationships_recv.reset(); - CommonParams::t_share_new_relationships_unpack.reset(); - CommonParams::t_local_tasks.reset(); - CommonParams::t_local_histogram.reset(); - CommonParams::t_reduce_histogram.reset(); - CommonParams::t_bcast_acceptability.reset(); - CommonParams::t_gather_grouping_criteria.reset(); - CommonParams::t_bcast_child_groups.reset(); - CommonParams::t_bcast_to_dropouts.reset(); -} - } } @@ -3208,5 +2456,3 @@ BergerRigoutsosNode::finalizeCallback() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.h index 73cdfcd6..5cad214e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BergerRigoutsosNode.h @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Node in asynchronous Berger-Rigoutsos dendogram + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Node in asynchronous Berger-Rigoutsos tree * ************************************************************************/ #ifndef included_mesh_BergerRigoutsosNode @@ -12,6 +12,7 @@ #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/tbox/AsyncCommGroup.h" #include "SAMRAI/hier/BlockId.h" #include "SAMRAI/hier/BoxLevel.h" @@ -26,7 +27,7 @@ namespace SAMRAI { namespace mesh { /*! - * @brief Node in the asynchronous Berger-Rigoutsos (BR) dendogram. + * @brief Node in the asynchronous Berger-Rigoutsos (BR) tree. * Do not directly use this class; for clustering, use BergerRigoutsos * instead. * @@ -35,31 +36,15 @@ namespace mesh { * This algorithm is described in Berger and Rigoutsos, * IEEE Trans. on Sys, Man, and Cyber (21)5:1278-1286. * - * This class implements the BR algorithm to execute - * in a non-recursive way, in order to improve parallel - * efficiency over recursive implementations. - * To facilitate a non-recursive implementation, - * data in the recursive tree is maintained in a "BR dendogram", - * nodes of which are instances of this class. - * - * Clarification on the uses of the word "node": - * - Dendogram node: Node in the BR dendogram (this class). - * - Graph node: Node in a box graph. The box graph is the form - * of the outputs of this class. Each output graph node - * corresponds to a box generated by the BR algorithm. - * - Processor: MPI process id. This is called a node in some - * context. For clarity, we avoid this use of "node". - * - * Each dendogram node is associated with a candidate box, + * Each tree node is associated with a candidate box, * an owner process coordinating distributed computations on the box * and a group of processors participating in those computations. * Should the candidate box be one of the final output boxes, * the owner also owns the graph node associated with the box. * * To use this class: - * -# Construct the root dendogram node, an object of type + * -# Construct the root node, an object of type * BergerRigoutsosNode. - * -# Set the clustering parameters using setClusteringParameters(). * -# Finetune the algorithm settings using the methods under * "Algorithm settings". * -# Start clustering by calling clusterAndComputeRelationships(). @@ -81,513 +66,45 @@ class BergerRigoutsosNode: { public: - enum OwnerMode { SINGLE_OWNER = 0, - MOST_OVERLAP = 1, - FEWEST_OWNED = 2, - LEAST_ACTIVE = 3 }; - - /*! - * @brief Method for advancing the algorithm. - * - * Each corresponds to a choice permitted by setAlgorithmAdvanceMode(). - */ - enum AlgoAdvanceMode { ADVANCE_ANY, - ADVANCE_SOME, - SYNCHRONOUS }; - - /*! - * @brief Construct the root node of a BR dendogram. - * - * The root node is used to run the BR algorithm and - * obtain outputs. - */ - BergerRigoutsosNode( - const tbox::Dimension& dim, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id); - /*! * @brief Destructor. - * - * Deallocate internal data. */ virtual ~BergerRigoutsosNode(); - /*! - * @brief Set parameters for (our slight variation of) the - * Berger-Rigoutsos algorithm. - * - * These parameters are not specific to the asynchronous algorithm - * or DLBG. - * - * @param[in] tag_data_index - * @param[in] tag_val - * @param[in] min_box - * @param[in] efficiency_tol - * @param[in] combine_tol - * @param[in] max_box_size - * @param[in] max_lap_cut_from_center Limit the Laplace cut to this - * fraction of the distance from the center plane to the end. - * Zero means cut only at the center plane. One means unlimited. - * Under most situations, one is fine. - * - * @param[in] laplace_cut_threshold_ar - */ - void - setClusteringParameters( - const int tag_data_index, - const int tag_val, - const hier::IntVector min_box, - const double efficiency_tol, - const double combine_tol, - const hier::IntVector& max_box_size, - const double max_lap_cut_from_center, - const double laplace_cut_threshold_ar); - - //@{ - //! @name Algorithm mode settings - - /*! - * @brief Set the mode for advancing the asynchronous implementation. - * - * Choices are: - * - @b "SYNCHRONOUS" --> wait for each communication stage to complete - * before moving on, thus resulting in synchronous execution. - * - @b "ADVANCE_ANY" --> advance an dendogram node through its - * communication stage by using tbox::AsyncCommStage::advanceAny(). - * - @b "ADVANCE_SOME" --> advance an dendogram node through its - * communication stage by using tbox::AsyncCommStage::advanceSome(). - * - * The default is "ADVANCE_SOME". - * - * Asynchronous modes are NOT guaranteed to compute the output - * graph nodes in any particular order. The order depends on - * the ordering of message completion, which is not deterministic. - * If you require consistent outputs, we suggest you have a scheme - * for reordering the output boxes. - */ - void - setAlgorithmAdvanceMode( - const std::string& algo_advance_mode); - - /*! - * @brief Set the method for choosing the owner. - * Choices: - * - "MOST_OVERLAP" - * Ownership is given to the processor with the most - * overlap on the candidate box. Default. - * - "SINGLE_OWNER" - * In single-owner mode, the initial owner (process 0) - * always participates and owns all dendogram nodes. - * - "FEWEST_OWNED" - * Choose the processor that owns the fewest dendogram - * nodes when the choice is made. This is meant to - * relieve bottle-necks caused by excessive ownership. - * This option may lead to non-deterministic ownerships. - * - "LEAST_ACTIVE" - * Choose the processor that participates in the fewest - * number of dendogram nodes when the choice is made. - * This is meant to relieve bottle-necks caused by - * excessive participation. This option may lead to - * non-deterministic ownerships. - * - * Experiments show that "MOST_OVERLAP" gives the best - * clustering speed, while "SINGLE_OWNER" may give a faster - * output globalization (since you don't need an all-gather). - */ - void - setOwnerMode( - const std::string& mode); - - /*! - * @brief Relationship computation flag. - * - * Valid mode values to set are: - * - * - "NONE" = No relationship computation. - * - * - "TAG_TO_NEW": Compute directed relationships from input (tagged) to - * output (new) graph nodes. With this option, it is possible to - * determine output nodes neighboring any input nodes, but not - * possible to determine input nodes neighboring a specific output - * node. - * - * - "BIDIRECTIONAL": Compute directed relationships from input (tagged) to - * output (new) graph nodes as well as the reverse. With this - * option, it is possible to determine output nodes neighboring any - * input nodes, as well as input nodes neighboring any output node. - * This is accomplished using an additional relationship-sharing - * communication after all graph nodes have been created. - * - * The ghost_cell_width specifies the growth for the overlap - * checks. Overlap checking is done to determine nearest-neighbor - * relationships when generating connectivity to new graph nodes. - * If a box grown by this ammount intersects another box, the two - * boxes are considered neighbors. - * - * By default, compute bidirectional relationships with a ghost cell width - * of 1. - */ - void - setComputeRelationships( - const std::string mode, - const hier::IntVector& ghost_cell_width); - - //@} - +private: /* - * @brief Run the clustering algorithm to generate the new BoxLevel - * and compute relationships (if specified by setComputeRelationships()). - * - * If relationships computation is not specified, the Connectors are - * unchanged. - * - * @param mpi_communicator Alternative MPI communicator. If given, - * must be congruent with the tag mapped_box_level's MPI communicator. - * Specify tbox::SAMRAI_MPI::commNull if unused. Highly recommend - * using an isolated communicator to prevent message mix-ups. + * BergerRigoutsos and BergerRigoutsosNode are tightly coupled. + * Technically, BergerRigoutsosNode can be made a private subclass + * of BergerRigoutsos. BergerRigoutsos has the common parts of the + * data and algorithm. BergerRigoutsosNode has the node-specific + * parts. */ - void - clusterAndComputeRelationships( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - const hier::Box& bound_box, - const boost::shared_ptr& tag_level, - const tbox::SAMRAI_MPI& mpi_object); - - //@{ - - //! @name Developer's methods for analysis and debugging this class. - virtual void - printClassData( - std::ostream& os, - int detail_level = 0) const; - - //! @brief Global number of tags in clusters. - int - getNumTags() const - { - return d_common->num_tags_in_all_nodes; - } - - //! @brief Max number of tags owned. - int - getMaxTagsOwned() const - { - return d_common->max_tags_owned; - } - - //! @brief Max number of local nodes for dendogram. - int - getMaxNodes() const - { - return d_common->max_nodes_allocated; - } - - //! @brief max generation count for the local nodes in the dendogram. - int - getMaxGeneration() const - { - return d_common->max_generation; - } - - //! @brief Max number of locally owned nodes in the dendogram. - int - getMaxOwnership() const - { - return d_common->max_nodes_owned; - } - - //! @brief Average number of continuations for local nodes in dendogram. - double - getAvgNumberOfCont() const - { - if (d_common->num_nodes_completed > 0) { - return (double)d_common->num_conts_to_complete - / d_common->num_nodes_completed; - } - return 0; - } - - //! @brief Max number of continuations for local nodes in dendogram. - int - getMaxNumberOfCont() const - { - return d_common->max_conts_to_complete; - } + friend class BergerRigoutsos; /*! - * @brief Number of boxes generated (but not necessarily owned) - * on the local process. + * @brief Construct a root node for a single block. + * + * @param common_params Parameters shares by all nodes in clustering + * @param box Global bounding box for a single block */ - int - getNumBoxesGenerated() const - { - return d_common->num_boxes_generated; - } + BergerRigoutsosNode( + BergerRigoutsos* common_params, + const hier::Box& box); - /*! - * @brief Set whether to log dendogram node action history - * (useful for debugging). - */ - void - setLogNodeHistory( - bool flag) - { - d_common->log_node_history = flag; + const tbox::Dimension& getDim() const { + return d_box.getDim(); } - //@} - -private: /* * Static integer constant defining value corresponding to a bad integer. */ static const int BAD_INTEGER; - /*! - * @brief Shorthand for the box-graph node corresponding - * to boxes. - */ - typedef hier::Box Box; - - //! @brief Shorthand for a container of graph-nodes. - typedef hier::BoxContainer BoxContainer; - - //! @brief Shorthand for a sorted, possibly incontiguous, set of integers. - typedef std::set IntSet; - /*! * @brief Shorthand for std::vector for internal use. */ typedef std::vector VectorOfInts; - /*! - * @brief Parameters shared among all dendogram nodes in - * a dendogram and collectively managed by those nodes. - * - * In the implementation of the BR algorithm, some parameters - * are to be shared among all nodes in the dendogram, - * either for efficiency or coordinating the dendogram nodes. - * All such parameters are contained in a single CommonParams - * object. - */ - class CommonParams - { -public: - explicit CommonParams( - const tbox::Dimension& dim); - - const tbox::Dimension d_dim; - - /*! - * @brief Queue on which to append jobs to be - * launched or relaunched. - * - * What is placed on the queue depends on the version of - * clusterAndComputeRelationships_...() used. - * - * We use void* to avoid having to explicitly instantiate - * multiple types, although we only place BergerRigoutsosNode - * pointers in the relaunch_queue. - */ - std::list relaunch_queue; - - /*! - * @brief Stage handling multiple asynchronous communication groups. - */ - tbox::AsyncCommStage comm_stage; - - AlgoAdvanceMode algo_advance_mode; - - /*! - * @brief Level where tags live. - */ - boost::shared_ptr tag_level; - - /*! - * @brief BoxLevel associated with tag_level. - * - * If relationships are computed (see setComputeRelationships()), the - * relationships go between the graph nodes on the tagged level and the - * generated graph nodes. - */ - const hier::BoxLevel* tag_mapped_box_level; - - /*! - * @brief New BoxLevel generated by BR. - * - * This is where we store the boxes as we progress in the BR algorithm. - * - * This is set in the public clusterAndComputeRelationships method. - */ - hier::BoxLevel* new_mapped_box_level; - - /*! - * @brief Connector from tag_mapped_box_level to new_mapped_box_level. - * - * This is where we store the relationships resulting from the BR - * algorithm. The relationships are created locally for local nodes in - * tag_mapped_box_level. - * - * This is set in the public clusterAndComputeRelationships method. - */ - hier::Connector* tag_to_new; - - /*! - * @brief Connector from new_mapped_box_level to tag_mapped_box_level. - * - * The relationships are created when the owners of nodes in - * tag_mapped_box_level share relationship data with owners of nodes in - * new_mapped_box_level. - * - * This is set in the public clusterAndComputeRelationships method. - */ - hier::Connector* new_to_tag; - - /*! - * @brief - */ - double max_lap_cut_from_center; - - /* - * @brief Threshold for favoring thicker directions for Laplace - * cuts. - * - * The higher the value, the more we tolerate high aspect - * ratios. Box directions corresponding to aspect ratios lower - * than this will not be subject to Laplace cuts (except for the - * thickest direction). Set to 0 to always cut the thickest - * direction. Set to huge value to disregard high aspect - * ratios. - */ - double laplace_cut_threshold_ar; - - /*! - * @brief If a candidate box does not fit in this limit, - * it will be split. - * - * Boxes will not be recombined (@see combine_tol) if the - * combination breaks this limit. - * - * This is meant to prevent huge boxes that degrades worst-case - * performances in when later processing the box. - */ - hier::IntVector max_box_size; - - //@{ - //@name Parameters from clustering algorithm interface - int tag_data_index; - int tag_val; - hier::IntVector min_box; - double efficiency_tol; - double combine_tol; - //@} - - /*! - * @brief Relationship computation flag. - * - * See setComputeRelationships(). - */ - int compute_relationships; - - /*! - * @brief List of processes that will send neighbor data - * for locally owned boxes after the BR algorithm completes. - */ - IntSet relationship_senders; - - /*! - * @brief Outgoing messages to be sent to graph node owners - * describing new relationships found by local process. - */ - std::map relationship_messages; - - //! @brief Ammount to grow a box when checking for overlap. - hier::IntVector max_gcw; - - //! @brief How to chose the group's owner. - OwnerMode owner_mode; - - //@{ - //! @name Communication parameters - /*! - * @brief MPI communicator used in all communications in - * the dendogram. - */ - tbox::SAMRAI_MPI mpi_object; - int rank; - int nproc; - //! @brief Upperbound of valid tags. - int tag_upper_bound; - //! @brief Smallest unclaimed MPI tag in pool given to local process. - int available_mpi_tag; - //@} - - //@{ - //! @name Performance monitors - static boost::shared_ptr t_cluster; - static boost::shared_ptr t_cluster_and_compute_relationships; - static boost::shared_ptr t_continue_algorithm; - static boost::shared_ptr t_compute; - static boost::shared_ptr t_comm_wait; - static boost::shared_ptr t_MPI_wait; - static boost::shared_ptr t_compute_new_graph_relationships; - static boost::shared_ptr t_share_new_relationships; - static boost::shared_ptr t_share_new_relationships_send; - static boost::shared_ptr t_share_new_relationships_recv; - static boost::shared_ptr t_share_new_relationships_unpack; - static boost::shared_ptr t_local_tasks; - static boost::shared_ptr t_local_histogram; - /* - * Multi-stage timers. These are used in continueAlgorithm() - * instead of the methods they time, because what they time may - * include waiting for messages. They are included in the - * timer t_continue_algorithm. They provide timing breakdown - * for the different stages. - */ - static boost::shared_ptr t_reduce_histogram; - static boost::shared_ptr t_bcast_acceptability; - static boost::shared_ptr t_gather_grouping_criteria; - static boost::shared_ptr t_bcast_child_groups; - static boost::shared_ptr t_bcast_to_dropouts; - //@} - - //@{ - //! @name Auxiliary data for analysis and debugging. - - //! @brief Whether to log major actions of dendogram node. - bool log_node_history; - //! @brief Number of tags. - int num_tags_in_all_nodes; - //! @brief Max number of tags owned. - int max_tags_owned; - //! @brief Current number of dendogram nodes allocated. - int num_nodes_allocated; - //! @brief Highest number of dendogram nodes. - int max_nodes_allocated; - //! @brief Current number of dendogram nodes active. - int num_nodes_active; - //! @brief Highest number of dendogram nodes active. - int max_nodes_active; - //! @brief Current number of dendogram nodes owned. - int num_nodes_owned; - //! @brief Highest number of dendogram nodes owned. - int max_nodes_owned; - //! @brief Current number of dendogram nodes completed. - int num_nodes_completed; - //! @brief Highest number of generation. - int max_generation; - //! @brief Current number of boxes generated. - int num_boxes_generated; - //! @brief Number of continueAlgorithm calls for to complete nodes. - int num_conts_to_complete; - //! @brief Highest number of continueAlgorithm calls to complete nodes. - int max_conts_to_complete; - //@} - }; - /*! * @brief Construct a non-root node. * @@ -596,34 +113,15 @@ class BergerRigoutsosNode: * only meant for internal use by the recursion mechanism. */ BergerRigoutsosNode( - CommonParams* common_params, + BergerRigoutsos* common_params, BergerRigoutsosNode* parent, - const int child_number, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id); - - /* - * @brief Duplicate given MPI communicator for private use - * and various dependent parameters. - * - * Requires that d_common->tag_mapped_box_level is already set! - */ - void - setMPI( - const tbox::SAMRAI_MPI& mpi); - - /*! - * @brief Run the BR algorithm to find boxes, then generate the relationships - * between the tag mapped_box_level and the new mapped_box_level. - */ - void - clusterAndComputeRelationships(); + const int child_number); /*! * @brief Names of algorithmic phases while outside of * continueAlgorithm(). * - * "For_data_only" phase is when the dendogram node is only used to + * "For_data_only" phase is when the node is only used to * store data. If the node is to be executed, it enters the * "to_be_launched" phase. * @@ -638,7 +136,7 @@ class BergerRigoutsosNode: * This is where the recursive implementation would return. * * The "deallocated" phase is for debugging. This phase is - * set by the destructor, just to help find dendogram nodes that + * set by the destructor, just to help find nodes that * are deallocated but somehow was referenced. */ enum WaitPhase { for_data_only, @@ -689,6 +187,9 @@ class BergerRigoutsosNode: * the leaf queue to be checked for completion later. * * @return The communication phase currently running. + * + * @pre (d_parent == 0) || (d_parent->d_wait_phase != completed) + * @pre inRelaunchQueue(this) == d_common->d_relaunch_queue.end() */ WaitPhase continueAlgorithm(); @@ -706,7 +207,7 @@ class BergerRigoutsosNode: * Meaning of values: * - "hasnotag_by_owner": histogram is truly empty (after sum reduction). * We don't accept the box, but we don't split it either. - * (This can only happen at the root dendogram node, as child + * (This can only happen at the root node, as child * boxes are guaranteed to have tags.) * - "(rejected|accepted)_by_calculation": decision by calculation * on the owner process. @@ -773,6 +274,8 @@ class BergerRigoutsosNode: } //! @brief Form child groups from gathered overlap counts. + // @pre d_common->d_rank == d_owner + // @pre d_recv_msg.size() == 4 * d_group.size() void formChildGroups(); @@ -802,12 +305,13 @@ class BergerRigoutsosNode: eraseBox(); //! @brief Compute new graph relationships touching local tag nodes. + // @pre d_common->d_compute_relationships > 0 + // @pre boxAccepted() + // @pre d_box_acceptance != accepted_by_dropout_bcast + // @pre (d_parent == 0) || (d_box.numberCells() >= d_common->d_min_box) + // @pre d_box_acceptance != accepted_by_dropout_bcast void computeNewNeighborhoodSets(); - - //! @brief Participants send new relationship data to graph node owners. - void - shareNewNeighborhoodSetsWithOwners(); //@} //@{ @@ -828,6 +332,7 @@ class BergerRigoutsosNode: } //! @brief Claim a unique tag from process's available tag pool. + // @pre d_mpi_tag < 0 void claimMPITag(); @@ -848,25 +353,28 @@ class BergerRigoutsosNode: return tree_deg; } + void + computeGlobalTagDependentVariables(); + bool findZeroCutSwath( int& cut_lo, int& cut_hi, - const int dim); + const tbox::Dimension::dir_t dim); void - cutAtLaplacian( + cutAtInflection( int& cut_pt, - int& diff_laplace, - const int dim); + int& inflection, + const tbox::Dimension::dir_t dim); int getHistogramBufferSize( const hier::Box& box) const { int size = box.numberCells(0); - int dim_val = d_dim.getValue(); - for (int d = 1; d < dim_val; ++d) { + int dim_val = d_common->getDim().getValue(); + for (tbox::Dimension::dir_t d = 1; d < dim_val; ++d) { size += box.numberCells(d); } return size; @@ -891,6 +399,7 @@ class BergerRigoutsosNode: int* buffer) const; //! @brief Compute list of non-participating processes. + // @pre main_group.size() >= sub_group.size() void computeDropoutGroup( const VectorOfInts& main_group, @@ -928,8 +437,8 @@ class BergerRigoutsosNode: BergerRigoutsosNode* node_ptr) const { std::list::const_iterator li = - std::find(d_common->relaunch_queue.begin(), - d_common->relaunch_queue.end(), + std::find(d_common->d_relaunch_queue.begin(), + d_common->d_relaunch_queue.end(), node_ptr); return li; } @@ -940,7 +449,7 @@ class BergerRigoutsosNode: int rank = -1) const { if (rank < 0) { - rank = d_common->rank; + rank = d_common->d_mpi.getRank(); } for (size_t i = 0; i < group.size(); ++i) { if (rank == group[i]) { @@ -950,39 +459,15 @@ class BergerRigoutsosNode: return false; } + //! @name Developer's methods for analysis and debugging this class. void - printState( + printNodeState( std::ostream& co) const; - void - printDendogramState( - std::ostream& co, - const std::string& border) const; - //@} - /*! - * @brief Initialize static objects and register shutdown routine. + * @brief Unique id in the binary tree. * - * Only called by StartupShutdownManager. - */ - static void - initializeCallback(); - - /*! - * @brief Method registered with ShutdownRegister to cleanup statics. - * - * Only called by StartupShutdownManager. - */ - static void - finalizeCallback(); - - // TODO: d_dim is unneeded. Dimension is already in d_common. - const tbox::Dimension d_dim; - - /*! - * @brief Unique id in the binary dendogram. - * - * - To have succinct formula, the root dendogram node has d_pos of 1. + * - To have succinct formula, the root node has d_pos of 1. * - Parent id is d_pos/2 * - Left child id is 2*d_pos * - Right child id is 2*d_pos+1 @@ -1003,7 +488,7 @@ class BergerRigoutsosNode: * Only the root of the tree allocates the common parameters. * For all others, this pointer is set by the parent. */ - CommonParams* d_common; + BergerRigoutsos* d_common; //@{ /*! @@ -1031,7 +516,6 @@ class BergerRigoutsosNode: */ hier::Box d_box; - int d_owner; /*! * @name Id of participating processes. @@ -1039,7 +523,12 @@ class BergerRigoutsosNode: VectorOfInts d_group; /*! - * @brief MPI tag for message within a dendogram node. + * Minimum size of a Box that d_box can potentially be chopped into. + */ + hier::IntVector d_min_box_size; + + /*! + * @brief MPI tag for message within a node. * * The tag is determined by on the process that owns the parent * when the parent decides to split its box. The tags are broadcasted @@ -1050,7 +539,7 @@ class BergerRigoutsosNode: /*! * @brief Overlap count with d_box. */ - int d_overlap; + size_t d_overlap; /*! * @brief Whether and how box is accepted. @@ -1060,38 +549,28 @@ class BergerRigoutsosNode: BoxAcceptance d_box_acceptance; /*! - * @brief Histogram for all dimensions of box d_box. + * @brief Histogram for all directions of box d_box. * - * If local process is d_owner, this is initially the + * If local process is owner, this is initially the * local histogram, then later, the reduced histogram. * If not, it is just the local histogram. */ - VectorOfInts d_histogram[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + VectorOfInts d_histogram[SAMRAI::MAX_DIM_VAL]; /*! * @brief Number of tags in the candidate box. */ int d_num_tags; - /*! - * @brief Distributed graph node corresponding to an accepted box. - * - * On the owner process, this belongs in a hier::BoxLevel - * object. On contributor nodes, this is used to identify the - * Box assigned by the owner. The Box is important for - * computing neighbor data. - */ - hier::Box d_mapped_box; - /*! * @brief Box iterator corresponding to an accepted box on * the owner. * - * This is relevant only on the owner, where the d_mapped_box is + * This is relevant only on the owner, where the d_box is * in a container. On contributors, the graph node is non-local * and stands alone. */ - BoxContainer::const_iterator d_mapped_box_iterator; + hier::BoxContainer::const_iterator d_box_iterator; /*! * @brief Name of wait phase when continueAlgorithm() @@ -1114,9 +593,6 @@ class BergerRigoutsosNode: tbox::AsyncCommGroup* d_comm_group; //@} - hier::BlockId d_block_id; - hier::LocalId d_first_local_id; - //@{ //! @name Deubgging aid @@ -1132,17 +608,9 @@ class BergerRigoutsosNode: int d_n_cont; //@} - - /* - * Static initialization and cleanup handler. - */ - - static tbox::StartupShutdownManager::Handler - s_initialize_handler; }; } } - #endif // included_mesh_BergerRigoutsosNode diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.C index 29fe8257..75be8188 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for box generation routines. * ************************************************************************/ - -#ifndef included_mesh_BoxGeneratorStrategy_C -#define included_mesh_BoxGeneratorStrategy_C - #include "SAMRAI/mesh/BoxGeneratorStrategy.h" namespace SAMRAI { @@ -34,5 +30,3 @@ BoxGeneratorStrategy::~BoxGeneratorStrategy() } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.h index b462db53..924177e8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxGeneratorStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for box generation routines. * ************************************************************************/ @@ -43,28 +43,38 @@ class BoxGeneratorStrategy /*! * @brief Cluster tags using the DLBG interfaces. + * + * @param tag_to_new_width [in] Width that tag_to_new should have. + * If implementation does not provide this width for tag_to_new, + * then it should set the width to zero. + * + * @param[out] new_box_level BoxLevel containing Boxes of clustered tagged + * cells. + * @param[out] tag_to_new Connector from the tagged to the new BoxLevels. + * @param[in] tag_level Tagged PatchLevel. + * @param[in] tag_data_index Index of PatchData used to denote tagging. + * @param[in] tag_val Value of PatchData indicating a tagged cell. + * @param[in] bound_boxes Collection of Boxes describing the bounding box + * of each block in the tag level. + * @param[in] min_box Smallest box size resulting from clustering. + * @param[in] tag_to_new_width Width of tag_to_new Connector. */ virtual void findBoxesContainingTags( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, const boost::shared_ptr& tag_level, const int tag_data_index, const int tag_val, - const hier::Box& bound_box, + const hier::BoxContainer& bound_boxes, const hier::IntVector& min_box, - const double efficiency_tol, - const double combine_tol, - const hier::IntVector& max_gcw, - const hier::BlockId& block_id, - const hier::LocalId& first_local_id) const = 0; + const hier::IntVector& tag_to_new_width) = 0; private: // The following are not implemented: BoxGeneratorStrategy( const BoxGeneratorStrategy&); - void + BoxGeneratorStrategy& operator = ( const BoxGeneratorStrategy&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxInTransit.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxInTransit.h new file mode 100644 index 00000000..01a4ab1c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxInTransit.h @@ -0,0 +1,218 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Implementation of TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_BoxInTransit +#define included_mesh_BoxInTransit + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/mesh/TransitLoad.h" +#include "SAMRAI/tbox/Dimension.h" +#include "SAMRAI/tbox/MessageStream.h" + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief A Box moving around during load balancing. + * + * The purpose of the BoxInTransit is to associate extra data with + * a Box as it is broken up and passed from process to process. A + * BoxInTransit is a Box going through these changes. It has a + * current work load and an orginating Box. + */ +struct BoxInTransit { + + /*! + * @brief Constructor + * + * @param[in] dim + */ + explicit BoxInTransit( + const tbox::Dimension& dim): + d_box(dim), + d_orig_box(dim) { + } + + /*! + * @brief Construct a new BoxInTransit from an originating box. + * + * @param[in] origin + */ + BoxInTransit( + const hier::Box& origin): + d_box(origin), + d_orig_box(origin), + d_boxload(static_cast(origin.size())) + { + d_boxsize = d_boxload; + } + + /*! + * @brief Construct new object like an existing object but with a new ID. + * + * @param[in] other + * @param[in] box + * @param[in] rank + * @param[in] local_id + * + * @param[in] load Box load. If omitted, set to box's volume. + */ + BoxInTransit( + const BoxInTransit& other, + const hier::Box& box, + int rank, + hier::LocalId local_id, + double load = -1.): + d_box(box, local_id, rank), + d_orig_box(other.d_orig_box), + d_boxsize(static_cast(d_box.size())) + { + d_boxload = load >= 0 ? load : other.d_boxload; + if (d_boxload > 0) { + d_corner_weights = other.d_corner_weights; + } + } + + /*! + * @brief Assignment operator + * + * @param[in] other + */ + BoxInTransit& operator = (const BoxInTransit& other) { + d_box = other.d_box; + d_orig_box = other.d_orig_box; + d_boxload = other.d_boxload; + d_boxsize = other.d_boxsize; + d_corner_weights = other.d_corner_weights; + return *this; + } + + //! @brief Return the owner rank. + int getOwnerRank() const { + return d_box.getOwnerRank(); + } + + //! @brief Return the LocalId. + hier::LocalId getLocalId() const { + return d_box.getLocalId(); + } + + //! @brief Return the Box. + hier::Box& getBox() { + return d_box; + } + + //! @brief Return the Box. + const hier::Box& getBox() const { + return d_box; + } + + //! @brief Return the original Box. + hier::Box& getOrigBox() { + return d_orig_box; + } + + //! @brief Return the original Box. + const hier::Box& getOrigBox() const { + return d_orig_box; + } + + //! @brief Return the Box load. + double getLoad() const { + return d_boxload; + } + + //! @brief Set the Box load. + void setLoad(double boxload) { + d_boxload = boxload; + } + + //! @brief Set the corner weights vector + void setCornerWeights(const std::vector& corner_weights) { + d_corner_weights = corner_weights; + } + + //! @brief Get the box size + double getSize() const { + return d_boxsize; + } + + //! @brief Get reference to the corner weights vector + const std::vector& getCornerWeights() const { + return d_corner_weights; + } + + //! @brief Return whether this is an original box. + bool isOriginal() const { + return d_box.isIdEqual(d_orig_box); + } + + //! @brief Put self into a MessageStream. + void putToMessageStream(tbox::MessageStream& mstream) const { + d_box.putToMessageStream(mstream); + d_orig_box.putToMessageStream(mstream); + mstream << d_boxload; + mstream << d_boxsize; + int num_corners = static_cast(d_corner_weights.size()); + mstream << num_corners; + for (int nc = 0; nc < num_corners; ++nc) { + mstream << d_corner_weights[nc]; + } + } + + //! @brief Set attributes according to data in a MessageStream. + void getFromMessageStream(tbox::MessageStream& mstream) { + d_box.getFromMessageStream(mstream); + d_orig_box.getFromMessageStream(mstream); + mstream >> d_boxload; + mstream >> d_boxsize; + int num_corners = 0; + mstream >> num_corners; + d_corner_weights.resize(num_corners); + for (int nc = 0; nc < num_corners; ++nc) { + mstream >> d_corner_weights[nc]; + } + } + + /*! + * @brief Insert BoxInTransit into an output stream. + */ + friend std::ostream& operator << (std::ostream& co, + const BoxInTransit& r) { + co << r.d_box + << r.d_box.numberCells() << '|' << r.d_box.size() << '-' + << r.d_orig_box + << r.d_orig_box.numberCells() << '|' << r.d_orig_box.size(); + return co; + } + +private: + + //! @brief Current Box + hier::Box d_box; + + //! @brief Originating Box (the oldest one leading to this one). + hier::Box d_orig_box; + + //! @brief Work load in this box. + double d_boxload; + + //! @brief Size of this box + double d_boxsize; + + //! @brief Vector holding fractional workload weighting for each corner + std::vector d_corner_weights; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.C new file mode 100644 index 00000000..0aaf409b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.C @@ -0,0 +1,1807 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Implementation of TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_BoxTransitSet_C +#define included_mesh_BoxTransitSet_C + +#include "SAMRAI/mesh/BoxTransitSet.h" +#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/AsyncCommPeer.h" +#include "SAMRAI/tbox/AsyncCommStage.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +const int BoxTransitSet::BoxTransitSet_EDGETAG0; +const int BoxTransitSet::BoxTransitSet_EDGETAG1; +const int BoxTransitSet::BoxTransitSet_FIRSTDATALEN; + +const std::string BoxTransitSet::s_default_timer_prefix("mesh::BoxTransitSet"); +std::map BoxTransitSet::s_static_timers; + +tbox::StartupShutdownManager::Handler +BoxTransitSet::s_initialize_finalize_handler( + BoxTransitSet::initializeCallback, + 0, + 0, + BoxTransitSet::finalizeCallback, + tbox::StartupShutdownManager::priorityTimers); + +/* + ************************************************************************* + ************************************************************************* + */ +BoxTransitSet::BoxTransitSet( + const PartitioningParams& pparams): + TransitLoad(), + d_set(), + d_sumload(0.0), + d_sumsize(0.0), + d_pparams(&pparams), + d_box_breaker(pparams), + d_print_steps(false), + d_print_pop_steps(false), + d_print_swap_steps(false), + d_print_break_steps(false), + d_print_edge_steps(false), + d_object_timers(0) +{ + TBOX_ASSERT(&pparams != 0); + getFromInput(); + setTimerPrefix(s_default_timer_prefix); + d_box_breaker.setPrintBreakSteps(d_print_break_steps); +} + +/* + ************************************************************************* + ************************************************************************* + */ +BoxTransitSet::BoxTransitSet( + const BoxTransitSet& other, + bool copy_load): + TransitLoad(other), + d_set(), + d_sumload(0.0), + d_sumsize(0.0), + d_pparams(other.d_pparams), + d_box_breaker(other.d_box_breaker), + d_print_steps(other.d_print_steps), + d_print_pop_steps(other.d_print_pop_steps), + d_print_swap_steps(other.d_print_swap_steps), + d_print_break_steps(other.d_print_break_steps), + d_print_edge_steps(other.d_print_edge_steps), + d_object_timers(other.d_object_timers) +{ + if (copy_load) { + d_set = other.d_set; + d_sumload = other.d_sumload; + d_sumsize = other.d_sumsize; + } + d_box_breaker.setPrintBreakSteps(d_print_break_steps); +} + +/* + ************************************************************************* + * Initialize sets to a new (empty) container but retains current + * supplemental data such as control and diagnostic parameters. + ************************************************************************* + */ +void BoxTransitSet::initialize() +{ + d_set.clear(); + d_sumload = 0.0; + d_sumsize = 0.0; +} + +/* + ************************************************************************* + * Allocate a new object exactly like this, but empty. + ************************************************************************* + */ +BoxTransitSet *BoxTransitSet::clone() const +{ + BoxTransitSet* new_object = new BoxTransitSet(*this, false); + return new_object; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BoxTransitSet::insertAll(const hier::BoxContainer& other) +{ + size_t old_size = d_set.size(); + for (hier::BoxContainer::const_iterator bi = other.begin(); bi != other.end(); ++bi) { + BoxInTransit new_box(*bi); + d_set.insert(new_box); + d_sumload += new_box.getLoad(); + d_sumsize += new_box.getSize(); + } + if (d_set.size() != old_size + other.size()) { + TBOX_ERROR("BoxTransitSet's insertAll currently can't weed out duplicates."); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BoxTransitSet::insertAll(TransitLoad& other_transit_load) +{ + const BoxTransitSet& other = recastTransitLoad(other_transit_load); + size_t old_size = d_set.size(); + d_set.insert(other.d_set.begin(), other.d_set.end()); + d_sumload += other.d_sumload; + d_sumsize += other.d_sumsize; + if (d_set.size() != old_size + other.size()) { + TBOX_ERROR("BoxTransitSet's insertAll currently can't weed out duplicates."); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BoxTransitSet::insertAllWithExistingLoads( + const hier::BoxContainer& other) +{ + std::set tmp_set; + + for (iterator si = begin(); si != end(); ++si) { + hier::BoxContainer::const_iterator itr = other.find(si->getBox()); + if (itr != other.end()) { + BoxInTransit new_box(*itr); + new_box.setLoad(si->getLoad()); + new_box.setCornerWeights(si->getCornerWeights()); + tmp_set.insert(new_box); + } else { + TBOX_ERROR("BoxTransitSet::insertAllWithExistingLoads requires that the BoxContainer input contains the same boxes as this BoxTransitSet"); + } + } + d_set.swap(tmp_set); + +} + +/* + ************************************************************************* + ************************************************************************* + */ +void BoxTransitSet::setWorkload( + const hier::PatchLevel& patch_level, + const int work_data_id) +{ + /* + * Set the workload for all the BoxInTransit members of d_set based + * on the data represented by the work_data_id. Since we cannot + * change the members of a set in place, we construct a temporary set + * and then swap. + */ + std::set tmp_set; + LoadType sumload = 0.0; + for (iterator si = begin(); si != end(); ++si) { + const hier::BoxId& box_id = si->getBox().getBoxId(); + const boost::shared_ptr& patch = + patch_level.getPatch(box_id); + BoxInTransit new_transit_box(*si); + std::vector corner_weights; + new_transit_box.setLoad( + BalanceUtilities::computeNonUniformWorkloadOnCorners(corner_weights, + patch, + work_data_id, + patch->getBox())); + new_transit_box.setCornerWeights(corner_weights); + sumload += new_transit_box.getLoad(); + tmp_set.insert(new_transit_box); + } + d_set.swap(tmp_set); + d_sumload = sumload; +} + +/* + ************************************************************************* + ************************************************************************* + */ +size_t BoxTransitSet::getNumberOfItems() const +{ + return size(); +} + +/* + ************************************************************************* + ************************************************************************* + */ +size_t BoxTransitSet::getNumberOfOriginatingProcesses() const +{ + std::set originating_procs; + for (const_iterator si = begin(); si != end(); ++si) { + originating_procs.insert(si->getOrigBox().getOwnerRank()); + } + return originating_procs.size(); +} + +/* + ************************************************************************* + * Assign boxes to local process (put them in the balanced_box_level + * and put edges in balanced<==>unbalanced Connector). + * + * We can generate balanced--->unbalanced edges for all boxes because + * we have their origin info. If the box originated locally, we can + * generate the unbalanced--->balanced edge for them as well. + * However, we can't generate these edges for boxes originating + * remotely. They are generated in + * constructSemilocalUnbalancedToBalanced, which uses communication. + */ +void +BoxTransitSet::assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi) +{ + NULL_USE(flexible_load_tol); + + d_object_timers->t_assign_to_local_process_and_populate_maps->start(); + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::assignToLocalAndPopulateMaps: entered." << std::endl; + } + + assignToLocal(balanced_box_level, unbalanced_to_balanced.getBase(), flexible_load_tol); + populateMaps(balanced_to_unbalanced, unbalanced_to_balanced, alt_mpi); + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::assignToLocalAndPopulateMaps: exiting." << std::endl; + } + + d_object_timers->t_assign_to_local_process_and_populate_maps->stop(); +} + +/* + ************************************************************************* + * Assign boxes to local process (put them in the balanced_box_level). + */ +void +BoxTransitSet::assignToLocal( + hier::BoxLevel& balanced_box_level, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi) +{ + NULL_USE(flexible_load_tol); + NULL_USE(alt_mpi); + /* + * Reassign contents to local process, assigning IDs that don't + * conflict with current Boxes. + */ + hier::SequentialLocalIdGenerator id_gen( + unbalanced_box_level.getLastLocalId()); + reassignOwnership(id_gen, balanced_box_level.getMPI().getRank()); + + putInBoxLevel(balanced_box_level); +} + +/* + ************************************************************************* + * We can generate balanced--->unbalanced edges for all boxes because + * we have their origin info. If the box originated locally, we can + * generate the unbalanced--->balanced edge for them as well. + * However, we can't generate these edges for boxes originating + * remotely. They are generated in + * constructSemilocalUnbalancedToBalanced, which uses communication. + */ +void +BoxTransitSet::populateMaps( + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + const tbox::SAMRAI_MPI& alt_mpi) const +{ + d_object_timers->t_populate_maps->start(); + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::populateMaps: entered." << std::endl; + } + + generateLocalBasedMapEdges(unbalanced_to_balanced, balanced_to_unbalanced); + + constructSemilocalUnbalancedToBalanced( + unbalanced_to_balanced, + alt_mpi.getCommunicator() == MPI_COMM_NULL ? + unbalanced_to_balanced.getBase().getMPI() : alt_mpi); + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::populateMaps: exiting." << std::endl; + } + + d_object_timers->t_populate_maps->stop(); +} + +/* + ************************************************************************* + * Communicate semilocal relationships in unbalanced--->balanced + * Connectors. These relationships must be represented by this + * object. Semilocal means the local process owns either d_box or + * getOrigBox() (not both!) of each item in this BoxTransitSet. The + * owner of the other doesn't have this data, so this method does the + * necessary P2P communication to set up the transpose edges. + * + * Each process already knows the data in its BoxTransitSet, + * obviously. The idea is to acquire relevant data from other + * processes. + ************************************************************************* + */ +void +BoxTransitSet::constructSemilocalUnbalancedToBalanced( + hier::MappingConnector& unbalanced_to_balanced, + const tbox::SAMRAI_MPI& mpi) const +{ + d_object_timers->t_construct_semilocal->start(); + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::constructSemilocalUnbalancedToBalanced: entered." + << std::endl; + } + + const hier::BoxLevel& unbalanced_box_level = unbalanced_to_balanced.getBase(); + const hier::BoxLevel& balanced_box_level = unbalanced_to_balanced.getHead(); + + size_t num_cells_imported = 0; + + // Pack the imported boxes into buffers by their original owners. + d_object_timers->t_pack_edge->start(); + std::map > outgoing_messages; + for (const_iterator bi = begin(); bi != end(); ++bi) { + const BoxInTransit& bit = *bi; + TBOX_ASSERT(bit.getBox().getOwnerRank() == mpi.getRank()); + if (bit.getOrigBox().getOwnerRank() == mpi.getRank()) { + // Not imported. + continue; + } + num_cells_imported += bit.getBox().size(); + boost::shared_ptr& mstream = + outgoing_messages[bit.getOrigBox().getOwnerRank()]; + if (!mstream) { + mstream.reset(new tbox::MessageStream); + } + bit.putToMessageStream(*mstream); + } + d_object_timers->t_pack_edge->stop(); + + /* + * Send outgoing_messages. Optimization for mitigating contention: + * Start by sending to the first recipient with a rank higher than + * the local rank. + */ + + std::map >::iterator recip_itr = + outgoing_messages.upper_bound(mpi.getRank()); + if (recip_itr == outgoing_messages.end()) { + recip_itr = outgoing_messages.begin(); + } + + size_t outgoing_messages_size = static_cast(outgoing_messages.size()); + std::vector + send_requests(outgoing_messages_size, MPI_REQUEST_NULL); + + d_object_timers->t_construct_semilocal_send_edges->start(); + for (size_t send_number = 0; send_number < outgoing_messages_size; ++send_number) { + + int recipient = recip_itr->first; + tbox::MessageStream& mstream = *recip_itr->second; + + if (d_print_edge_steps) { + tbox::plog << "Accounting for cells on proc " << recipient << std::endl; + } + + mpi.Isend( + (void *)(mstream.getBufferStart()), + static_cast(mstream.getCurrentSize()), + MPI_CHAR, + recipient, + BoxTransitSet_EDGETAG0, + &send_requests[send_number]); + + ++recip_itr; + if (recip_itr == outgoing_messages.end()) { + recip_itr = outgoing_messages.begin(); + } + + } + d_object_timers->t_construct_semilocal_send_edges->stop(); + + TBOX_ASSERT(unbalanced_box_level.getLocalNumberOfCells() + num_cells_imported + >= balanced_box_level.getLocalNumberOfCells()); + + size_t num_unaccounted_cells = + unbalanced_box_level.getLocalNumberOfCells() + - balanced_box_level.getLocalNumberOfCells() + + num_cells_imported; + + if (d_print_edge_steps) { + tbox::plog << num_unaccounted_cells << " unaccounted cells." << std::endl; + } + + /* + * Receive info about exported cells from processes that now own + * those cells. Receive until all cells are accounted for. + * This gives us all missing semilocal unbalanced--->balanced. + */ + + std::vector incoming_message; + BoxInTransit balanced_box_in_transit(unbalanced_box_level.getDim()); + + while (num_unaccounted_cells > 0) { + + d_object_timers->t_construct_semilocal_comm_wait->start(); + tbox::SAMRAI_MPI::Status status; + mpi.Probe(MPI_ANY_SOURCE, BoxTransitSet_EDGETAG0, &status); + + int source = status.MPI_SOURCE; + int count = -1; + tbox::SAMRAI_MPI::Get_count(&status, MPI_CHAR, &count); + incoming_message.resize(count, -1); + + mpi.Recv( + static_cast(&incoming_message[0]), + count, + MPI_CHAR, + source, + BoxTransitSet_EDGETAG0, + &status); + d_object_timers->t_construct_semilocal_comm_wait->stop(); + + tbox::MessageStream msg(incoming_message.size(), + tbox::MessageStream::Read, + static_cast(&incoming_message[0]), + false); + const size_t old_count = num_unaccounted_cells; + d_object_timers->t_unpack_edge->start(); + while (!msg.endOfData()) { + balanced_box_in_transit.getFromMessageStream(msg); + TBOX_ASSERT(balanced_box_in_transit.getBox().size() <= num_unaccounted_cells); + unbalanced_to_balanced.insertLocalNeighbor( + balanced_box_in_transit.getBox(), + balanced_box_in_transit.getOrigBox().getBoxId()); + TBOX_ASSERT(num_unaccounted_cells >= balanced_box_in_transit.getBox().size()); + num_unaccounted_cells -= balanced_box_in_transit.getBox().size(); + } + d_object_timers->t_unpack_edge->stop(); + + if (d_print_edge_steps) { + tbox::plog << "Process " << source << " accounted for " + << (old_count - num_unaccounted_cells) << " cells, leaving " + << num_unaccounted_cells << " unaccounted." << std::endl; + } + + incoming_message.clear(); + } + TBOX_ASSERT(num_unaccounted_cells == 0); + + // Wait for the sends to complete before clearing outgoing_messages. + if (send_requests.size() > 0) { + std::vector status(send_requests.size()); + d_object_timers->t_construct_semilocal_comm_wait->start(); + tbox::SAMRAI_MPI::Waitall( + static_cast(send_requests.size()), + &send_requests[0], + &status[0]); + d_object_timers->t_construct_semilocal_comm_wait->stop(); + outgoing_messages.clear(); + } + + if (d_print_steps || d_print_edge_steps) { + tbox::plog << "BoxTransitSet::constructSemilocalUnbalancedToBalanced: exiting." + << std::endl; + } + + d_object_timers->t_construct_semilocal->stop(); +} + +/* + ************************************************************************* + * Reassign the boxes to the new owner. Any box that isn't already + * owned by the new owner or doesn't have a valid LocalId, is given one + * by the SequentialLocalIdGenerator. + ************************************************************************* + */ +void +BoxTransitSet::reassignOwnership( + hier::SequentialLocalIdGenerator& id_gen, + int new_owner_rank) +{ + std::set tmp_set; + + for (const_iterator bi = begin(); bi != end(); ++bi) { + if (bi->getOwnerRank() != new_owner_rank || + !bi->getLocalId().isValid()) { + BoxInTransit reassigned_box( + *bi, bi->getBox(), new_owner_rank, id_gen.nextValue()); + tmp_set.insert(tmp_set.end(), reassigned_box); + } else { + tmp_set.insert(tmp_set.end(), *bi); + } + } + d_set.swap(tmp_set); + +} + +/* + ************************************************************************* + * Put all local d_box into a BoxLevel. + * Each d_box must have a valid BoxId. + ************************************************************************* + */ +void +BoxTransitSet::putInBoxLevel( + hier::BoxLevel& box_level) const +{ + for (iterator ni = begin(); ni != end(); ++ni) { + TBOX_ASSERT(ni->getBox().getBoxId().isValid()); + if (ni->getBox().getOwnerRank() == box_level.getMPI().getRank()) { + box_level.addBox(ni->getBox()); + } + } +} + +/* + ************************************************************************* + * Generate all d_box<==>getOrigBox() mapping edges, except for those + * that cannot be set up without communication. These semilocal edges + * have either a remote d_box or a remote getOrigBox(). + * + * Each d_box must have a valid BoxId. + ************************************************************************* + */ +void +BoxTransitSet::generateLocalBasedMapEdges( + hier::MappingConnector& unbalanced_to_balanced, + hier::MappingConnector& balanced_to_unbalanced) const +{ + + tbox::SAMRAI_MPI mpi = balanced_to_unbalanced.getBase().getMPI(); + + for (iterator ni = begin(); ni != end(); ++ni) { + + const BoxInTransit& added_box = *ni; + + if (!added_box.isOriginal()) { + // ID changed means mapping needed, but store only for local boxes. + + if (added_box.getBox().getOwnerRank() == mpi.getRank()) { + balanced_to_unbalanced.insertLocalNeighbor( + added_box.getOrigBox(), + added_box.getBox().getBoxId()); + } + + if (added_box.getOrigBox().getOwnerRank() == mpi.getRank()) { + unbalanced_to_balanced.insertLocalNeighbor( + added_box.getBox(), + added_box.getOrigBox().getBoxId()); + } + + } + + } +} + +/* + ************************************************************************* + * + * This method adjusts the load in this BoxTransitSet by + * moving work between it (main_bin) and a holding_bin. It tries to bring + * main_bin's load to the specified ideal_load. + * + * The high_load and low_load define an acceptable range around the + * ideal_load. As soon as the main load falls in this range, no + * further change is tried, even if it may bring the load closer to + * the ideal. + * + * This method makes a best effort and returns the amount of load + * moved. It can move BoxInTransits between given sets and, if needed, + * break some BoxInTransits up to move part of the work. + * + * This method is purely local--it reassigns the load but does not + * communicate the change to any remote process. + * + * Return amount of load moved to main_bin from hold_bin. Negative + * amount means load moved from main_bin to hold_bin. + * + ************************************************************************* + */ +BoxTransitSet::LoadType +BoxTransitSet::adjustLoad( + TransitLoad& transit_load_hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) +{ + BoxTransitSet& main_bin(*this); + BoxTransitSet& hold_bin(recastTransitLoad(transit_load_hold_bin)); + + if (d_print_steps) { + tbox::plog << " BoxTransitSet::adjustLoad attempting to bring main load from " + << main_bin.getSumLoad() << " to " << ideal_load + << " or within [" << low_load << ", " << high_load << "]." + << std::endl; + } + TBOX_ASSERT(low_load <= ideal_load); + TBOX_ASSERT(high_load >= ideal_load); + + LoadType actual_transfer = 0; + + if ((main_bin.empty() && ideal_load <= 0) || + (hold_bin.empty() && main_bin.getSumLoad() < ideal_load)) { + return actual_transfer; + } + + d_object_timers->t_adjust_load->start(); + + actual_transfer = adjustLoadByPopping( + hold_bin, + ideal_load, + low_load, + high_load); + + if (d_print_steps) { + double balance_penalty = computeBalancePenalty( + (main_bin.getSumLoad() - ideal_load)); + tbox::plog << " Balance penalty after adjustLoadByPopping = " + << balance_penalty + << ", needs " << (ideal_load - main_bin.getSumLoad()) + << " more with " << main_bin.size() << " main_bin and " + << hold_bin.size() << " hold_bin Boxes remaining." + << "\n main_bin now has " << main_bin.getSumLoad() + << " in " << main_bin.size() << " boxes." + << std::endl; + } + + /* + * The algorithm cycles through a do-loop. Each time around, we + * try to swap some BoxInTransit between main_bin and hold_bin + * until we have main_bin's load in [low_load,high_load] or we + * cannot improve the actual_transfer any further. Then, we try + * breaking up a BoxInTransit to improve the results. If we break + * some BoxInTransit, we generate some more swapping options that + * were not there before, so we loop back to try swapping again. + * + * If a break phase does not break any Box (and does not generate + * more swap options), the loop will stop making changes. We break + * the loop at that point (and whenever we get main_bin's load in + * the correct range). We also break out if there is no improvement, + * which can happen when the swp and break steps undo each other's + * work (due to round-off errors). + * + * TODO: This should be a while loop. We don't need to enter it + * if already in range. + */ + do { + + const LoadType old_distance_to_ideal = ideal_load - main_bin.getSumLoad(); + + /* + * Try to balance load through swapping. + */ + LoadType swap_transfer = adjustLoadBySwapping( + hold_bin, + ideal_load, + low_load, + high_load); + + actual_transfer += swap_transfer; + + if (d_print_steps) { + double balance_penalty = computeBalancePenalty( + (main_bin.getSumLoad() - ideal_load)); + tbox::plog << " Balance penalty after adjustLoadBySwapping = " + << balance_penalty + << ", needs " << (ideal_load - main_bin.getSumLoad()) + << " more with " << main_bin.size() << " main_bin and " + << hold_bin.size() << " hold_bin Boxes remaining." + << "\n main_bin now has " << main_bin.getSumLoad() + << " in " << main_bin.size() << " boxes." + << std::endl; + } + + // Skip breaking if already in range. + if (main_bin.getSumLoad() <= high_load && main_bin.getSumLoad() >= low_load) break; + + /* + * Skip breaking if adding/subtracting the min load overshoots the range and worsens distance to range. + */ + if (tbox::MathUtilities::Abs(main_bin.getSumLoad() - 0.5 * (high_load + low_load)) <= + 0.5 * d_pparams->getMinLoad()) { + break; + } + + if (getAllowBoxBreaking()) { + /* + * Assuming that we did the best we could, swapping + * some BoxInTransit without breaking any, we now break up a Box + * in the overloaded side for partial transfer to the + * underloaded side. + */ + LoadType brk_transfer = adjustLoadByBreaking( + hold_bin, + ideal_load, + low_load, + high_load); + actual_transfer += brk_transfer; + + if (d_print_steps) { + double balance_penalty = computeBalancePenalty( + (main_bin.getSumLoad() - ideal_load)); + tbox::plog << " Balance penalty after adjustLoadByBreaking = " + << balance_penalty + << ", needs " << (ideal_load - main_bin.getSumLoad()) + << " more with " << main_bin.size() << " main_bin and " + << hold_bin.size() << " hold_bin Boxes remaining." + << "\n main_bin now has " << main_bin.getSumLoad() + << " in " << main_bin.size() << " boxes." + << std::endl; + } + if (brk_transfer == 0) { + /* + * If no box can be broken to improve the actual_transfer, + * there is nothing further we can do. The swap phase, tried + * before the break phase, also generated no transfer, so + * there's no point trying again. Break out now to save + * retrying the swap phase. + */ + if (d_print_steps) { + tbox::plog << " adjustLoad stopping due to unsuccessful break." + << std::endl; + } + break; + } + } + + LoadType improvement = + tbox::MathUtilities::Abs(old_distance_to_ideal + - (ideal_load - main_bin.getSumLoad())); + if (improvement < d_pparams->getLoadComparisonTol()) { + break; + } + + /* + * Now that we have broken up a Box, redo this loop to + * see if swapping can produce a better result. + */ + } while ((main_bin.getSumLoad() >= high_load) || + (main_bin.getSumLoad() <= low_load)); + + if (d_print_steps) { + const LoadType point_miss = main_bin.getSumLoad() - ideal_load; + const LoadType range_miss = + main_bin.getSumLoad() > high_load ? main_bin.getSumLoad() - high_load : + main_bin.getSumLoad() < low_load ? low_load - main_bin.getSumLoad() : 0; + tbox::plog << " adjustLoad point_miss=" << point_miss + << " range_miss=" + << (range_miss > 0 ? " " : "") // Add space if missed range + << (range_miss > 0.5 + * static_cast(d_pparams->getMinBoxSize().getProduct()) ? " " : "") // Add space if missed range by a lot + << range_miss + << " " << main_bin.getSumLoad() << '/' + << ideal_load << " [" << low_load << ',' << high_load << ']' + << std::endl; + } + + d_object_timers->t_adjust_load->stop(); + + return actual_transfer; +} + +/* + ************************************************************************* + * Attempt bring main_bin to within a specific load range by moving + * one box to/from it from/to hold_bin. This method is allowed to break + * the box and move parts of it. + ************************************************************************* + */ +BoxTransitSet::LoadType +BoxTransitSet::adjustLoadByBreaking( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) +{ + LoadType actual_transfer = 0; + + if (d_print_steps) { + tbox::plog << " Attempting to bring this bin from " + << getSumLoad() << " to " << ideal_load + << " [" << low_load << ',' << high_load + << "] by breaking." + << std::endl; + } + + if (getSumLoad() > high_load) { + if (d_print_steps) { + tbox::plog << " BoxTransitSet::adjustLoadByBreaking reversing direction." + << std::endl; + } + // The logic below does not handle bi-directional transfers, so handle it here. + actual_transfer = -hold_bin.adjustLoadByBreaking( + *this, + hold_bin.getSumLoad() - (ideal_load - getSumLoad()), + hold_bin.getSumLoad() - (high_load - getSumLoad()), + hold_bin.getSumLoad() - (low_load - getSumLoad())); + return actual_transfer; + } + + BoxTransitSet& main_bin(*this); + + TBOX_ASSERT(low_load <= ideal_load); + TBOX_ASSERT(ideal_load <= high_load); + TBOX_ASSERT(main_bin.getSumLoad() <= high_load); + + TBOX_ASSERT(main_bin.size() + hold_bin.size() > 0); + + d_object_timers->t_shift_loads_by_breaking->start(); + + const LoadType ideal_transfer = ideal_load - main_bin.getSumLoad(); + const LoadType high_transfer = high_load - main_bin.getSumLoad(); + const LoadType low_transfer = low_load - main_bin.getSumLoad(); + + if (d_print_steps) { + tbox::plog << " adjustLoadByBreaking asked to break off " + << ideal_transfer << " [" << low_transfer << ',' + << high_transfer << "] from one of " << hold_bin.size() + << " Boxes to add to set of " << main_bin.size() + << " Boxes." + << std::endl; + } + + // Data for the best cutting results so far: + hier::BoxContainer breakoff; + hier::BoxContainer leftover; + double breakoff_amt = 0.0; + BoxInTransit breakbox(d_pparams->getMinBoxSize().getDim()); + + int break_acceptance_flags[4] = { 0, 0, 0, 0 }; + int& found_breakage = break_acceptance_flags[2]; + + /* + * Find best box to break. Loop in reverse because smaller boxes + * are cheaper to analyze for bad cuts. + */ + for (reverse_iterator si = hold_bin.rbegin(); si != hold_bin.rend(); ++si) { + + /* + * Skip boxes smaller than ideal_transfer. If we called + * adjustLoadBySwapping before entering this method, there + * should not be any such boxes. + */ + if (si->getLoad() < ideal_transfer) { + continue; + } + + const BoxInTransit& candidate = *si; + + if (d_print_steps) { + tbox::plog << " Considering break candidate " << candidate + << std::endl; + } + + hier::BoxContainer trial_breakoff; + hier::BoxContainer trial_leftover; + double trial_breakoff_amt; + + d_box_breaker.breakOffLoad( + trial_breakoff, + trial_leftover, + trial_breakoff_amt, + candidate.getBox(), + candidate.getLoad(), + candidate.getCornerWeights(), + ideal_transfer, + low_transfer, + high_transfer, + getThresholdWidth()); + + if (!trial_breakoff.empty()) { + + const bool accept_break = BalanceUtilities::compareLoads( + break_acceptance_flags, breakoff_amt, trial_breakoff_amt, + ideal_transfer, low_transfer, high_transfer, *d_pparams); + if (d_print_break_steps) { + tbox::plog << " adjustLoadByBreaking sees potential to replace " + << candidate << " with " + << trial_breakoff.size() << " breakoff Boxes and " + << trial_leftover.size() << " leftover Boxes." + << " break amount = " << trial_breakoff_amt + << "\n Break evaluation:" + << " " << break_acceptance_flags[0] + << " " << break_acceptance_flags[1] + << " " << break_acceptance_flags[2] + << " " << break_acceptance_flags[3] + << std::endl; + } + + if (accept_break) { + breakbox = candidate; + breakoff_amt = trial_breakoff_amt; + breakoff.swap(trial_breakoff); + leftover.swap(trial_leftover); + if (break_acceptance_flags[0] == 1) { + // We are in the [low,high] range. That is sufficient. + break; + } + } + + } else { + if (d_print_break_steps) { + tbox::plog << " Break step could not break " << ideal_transfer + << " from hold_bin box " << candidate + << std::endl; + } + } + + } + + if (found_breakage == 1) { + + int work_data_id = d_pparams->getWorkloadDataId(); + + /* + * Remove the chosen candidate. Put its breakoff parts + * in main_bin and its leftover parts back into hold_bin. + */ + hold_bin.erase(breakbox); + size_t breakoff_size = breakoff.getTotalSizeOfBoxes(); + for (hier::BoxContainer::const_iterator bi = breakoff.begin(); + bi != breakoff.end(); + ++bi) { + /* + * The breakoff load (breakoff_amt) is apportioned proportionally + * according to box size to the boxes in the breakoff container. + * No corner weight information is stored in the resulting + * BoxInTransits. + * + * When uniform load balancing is being used, all the loads should + * be equal to the box zone counts. + */ + BoxInTransit give_box_in_transit( + breakbox, + *bi, + breakbox.getOwnerRank(), + hier::LocalId::getInvalidId()); + + if (work_data_id >= 0 && d_pparams->usingVouchers()) { + const hier::BoxId& orig_box_id = + give_box_in_transit.getOrigBox().getBoxId(); + const boost::shared_ptr& patch = + d_pparams->getWorkloadPatchLevel().getPatch(orig_box_id); + + std::vector corner_weights; + give_box_in_transit.setLoad( + BalanceUtilities::computeNonUniformWorkloadOnCorners( + corner_weights, + patch, + work_data_id, + give_box_in_transit.getBox())); + give_box_in_transit.setCornerWeights(corner_weights); + } else { + double load_frac = static_cast(bi->size()) / + static_cast(breakoff_size); + give_box_in_transit.setLoad(load_frac * breakoff_amt); + give_box_in_transit.setCornerWeights(std::vector(0)); + } + main_bin.insert(give_box_in_transit); + actual_transfer += give_box_in_transit.getLoad(); + } + LoadType leftover_amt = breakbox.getLoad() - + static_cast(breakoff_amt); + size_t leftover_size = leftover.getTotalSizeOfBoxes(); + for (hier::BoxContainer::const_iterator bi = leftover.begin(); + bi != leftover.end(); + ++bi) { + /* + * The leftover load (origial load minus breakoff_amt) is + * aportioned proportionally according to box size to the boxes + * in the leftover container. No corner weight information is + * stored in the resulting BoxInTransits. + */ + BoxInTransit keep_box_in_transit( + breakbox, + *bi, + breakbox.getOwnerRank(), + hier::LocalId::getInvalidId()); + if (work_data_id >= 0 && d_pparams->usingVouchers()) { + const hier::BoxId& orig_box_id = + keep_box_in_transit.getOrigBox().getBoxId(); + const boost::shared_ptr& patch = + d_pparams->getWorkloadPatchLevel().getPatch(orig_box_id); + + std::vector corner_weights; + keep_box_in_transit.setLoad( + BalanceUtilities::computeNonUniformWorkloadOnCorners( + corner_weights, + patch, + work_data_id, + keep_box_in_transit.getBox())); + keep_box_in_transit.setCornerWeights(corner_weights); + } else { + double load_frac = static_cast(bi->size()) / + static_cast(leftover_size); + + keep_box_in_transit.setLoad(load_frac * leftover_amt); + keep_box_in_transit.setCornerWeights(std::vector(0)); + } + hold_bin.insert(keep_box_in_transit); + } + } + + d_object_timers->t_shift_loads_by_breaking->stop(); + return actual_transfer; +} + +/* + ************************************************************************* + * Attempt to adjust the load of a main_bin by swapping boxes with + * a hold_bin. + * + * Transfering a BoxInTransit from one BoxTransitSet to another + * is considered a degenerate "swap" (a BoxInTransit is + * swapped for nothing) handled by this function. + * + * This method can transfer load both ways. + * ideal_transfer > 0 means to raise the load of main_bin + * ideal_transfer < 0 means to raise the load of hold_bin + * The iterative do loop may overshoot the ideal_transfer + * and may have to swap to shift some of the load + * back. + * + * Return amount of load transfered. + ************************************************************************* + */ +BoxTransitSet::LoadType +BoxTransitSet::adjustLoadBySwapping( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) +{ + TBOX_ASSERT(high_load >= ideal_load); + TBOX_ASSERT(low_load <= ideal_load); + + d_object_timers->t_adjust_load_by_swapping->start(); + + BoxTransitSet& main_bin(*this); + + if (d_print_steps) { + tbox::plog << " Attempting to bring main_bin from " + << main_bin.getSumLoad() << " to " << ideal_load + << " [" << low_load << ',' << high_load + << "] by swapping." + << std::endl; + } + + bool found_swap; + + LoadType actual_transfer = 0; + + do { + + /* + * Ammount we seek to transfer from hi to lo + * (the "ideal" for this particular iteration). + * Unlike ideal_transfer and actual_transfer, this quantity is positive. + */ + LoadType rem_transfer = main_bin.getSumLoad() - ideal_load; + LoadType low_transfer = main_bin.getSumLoad() - high_load; + LoadType high_transfer = main_bin.getSumLoad() - low_load; + if (d_print_swap_steps) { + tbox::plog << " Swap progress: " << main_bin.getSumLoad() + << " / " << ideal_load << " remaining transfer = " + << rem_transfer << " [" << low_transfer << ',' + << high_transfer << ']' << std::endl; + } + + LoadType swap_transfer; + found_swap = swapLoadPair( + main_bin, + hold_bin, + swap_transfer, + rem_transfer, + low_transfer, + high_transfer); + swap_transfer = -swap_transfer; + + if (found_swap) { + actual_transfer += swap_transfer; + } + + } while (found_swap && + (main_bin.getSumLoad() < low_load || main_bin.getSumLoad() > high_load)); + + if (d_print_swap_steps) { + tbox::plog << " Final balance for adjustLoadBySwapping: " + << main_bin.getSumLoad() << " / " << ideal_load + << " Off by " << (main_bin.getSumLoad() - ideal_load) + << std::endl; + } + + d_object_timers->t_adjust_load_by_swapping->stop(); + + return actual_transfer; +} + +/* + ************************************************************************* + * Attempt to adjust the load of a main_bin by popping the biggest boxes + * from a source bin and moving them to a destination bin. + * + * This method should give results similar to adjustLoadBySwapping, + * but when the boxes are small in comparison to the load changed, it + * should be faster. + * + * This method can transfer load both ways. + * ideal_transfer > 0 means to raise the load of main_bin + * ideal_transfer < 0 means to raise the load of hold_bin + * + * Return amount of load transfered. + ************************************************************************* + */ +BoxTransitSet::LoadType +BoxTransitSet::adjustLoadByPopping( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) +{ + TBOX_ASSERT(high_load >= ideal_load); + TBOX_ASSERT(low_load <= ideal_load); + + d_object_timers->t_adjust_load_by_popping->start(); + + BoxTransitSet& main_bin(*this); + + /* + * Logic in this method assumes positive transfer from hold_bin + * (the source) to main_bin (the destination). When transfering + * the other way, switch the roles of main_bin and hold_bin. + */ + BoxTransitSet* src = &hold_bin; + BoxTransitSet* dst = &main_bin; + LoadType dst_ideal_load = ideal_load; + LoadType dst_low_load = low_load; + LoadType dst_high_load = high_load; + + if (main_bin.getSumLoad() > ideal_load) { + + dst_ideal_load = hold_bin.getSumLoad() + (main_bin.getSumLoad() - ideal_load); + dst_low_load = hold_bin.getSumLoad() + (main_bin.getSumLoad() - high_load); + dst_high_load = hold_bin.getSumLoad() + (main_bin.getSumLoad() - low_load); + + src = &main_bin; + dst = &hold_bin; + + } + + if (d_print_pop_steps) { + tbox::plog << " Attempting to bring main_bin from " + << main_bin.getSumLoad() << " to " << ideal_load + << " [" << low_load << ',' << high_load + << "] by popping." + << std::endl; + } + + LoadType actual_transfer = 0; + int acceptance_flags[4] = { 0, 0, 0, 0 }; + + size_t num_boxes_popped = 0; + + while (!src->empty()) { + + const BoxInTransit& candidate_box = *src->begin(); + + bool improved = BalanceUtilities::compareLoads( + acceptance_flags, dst->getSumLoad(), + dst->getSumLoad() + candidate_box.getLoad(), + dst_ideal_load, dst_low_load, dst_high_load, *d_pparams); + + if (improved) { + + if (d_print_pop_steps) { + tbox::plog << " adjustLoadByPopping pop #" << num_boxes_popped + << ", " << candidate_box; + } + + actual_transfer += candidate_box.getLoad(); + dst->insert(candidate_box); + src->erase(src->begin()); + ++num_boxes_popped; + + if (d_print_pop_steps) { + tbox::plog << ", main_bin load is " << main_bin.getSumLoad() << std::endl; + } + } + if ((dst->getSumLoad() >= dst_low_load && dst->getSumLoad() <= high_load) || + !improved) { + /* + * TODO: Popping a box is so inexpensive that we should + * really continue until !improved, instead of breaking out + * right when the dst is within the desired range. The only + * argument for exiting early here is to keep as much load + * off the transit lines as possible to avoid bandwith + * limitations. Experience shows that bandwidth is + * challenged by number of box sources rather than number of + * boxes. + */ + break; + } + } + + if (d_print_pop_steps) { + tbox::plog << " Final result in adjustLoadByPopping: " + << main_bin.getSumLoad() << " / " << ideal_load + << " Off by " << (main_bin.getSumLoad() - ideal_load) + << ". " << num_boxes_popped << " boxes popped." + << std::endl; + } + + d_object_timers->t_adjust_load_by_popping->stop(); + + return actual_transfer; +} + +/* + ************************************************************************* + * Find a BoxInTransit in src and a BoxInTransit in dst which when + * swapped results in shifting close to ideal_shift from src to dst. + * Make the swap. Return whether a swap pair was found. + ************************************************************************* + */ +bool +BoxTransitSet::swapLoadPair( + BoxTransitSet& src, + BoxTransitSet& dst, + LoadType& actual_transfer, + LoadType ideal_transfer, + LoadType low_transfer, + LoadType high_transfer) const +{ + if (ideal_transfer < 0) { + // The logic below does not handle bi-directional transfers, so handle it here. + bool rval = swapLoadPair( + dst, + src, + actual_transfer, + -ideal_transfer, + -high_transfer, + -low_transfer); + actual_transfer = -actual_transfer; + return rval; + } + + d_object_timers->t_find_swap_pair->start(); + + if (d_print_swap_steps) { + tbox::plog << " swapLoadPair looking for transfer of " + << ideal_transfer + << " between " << src.size() << "-box src and " + << dst.size() << "-box dst." << std::endl; + tbox::plog << " src (" << src.size() << "):" << std::endl; + if (src.size() < 10) { + for (iterator si = src.begin(); si != src.end(); ++si) { + tbox::plog << " " << *si << std::endl; + } + } + tbox::plog << " dst (" << dst.size() << "):" << std::endl; + if (dst.size() < 10) { + for (iterator si = dst.begin(); si != dst.end(); ++si) { + tbox::plog << " " << *si << std::endl; + } + } + } + + /* + * Look for two swap options. The "high side" option would + * transfer at least ideal_transfer. The "low side" option would + * transfer up to ideal_transfer. + * + * Each option is defined by a box from src and a box from dst, + * designated by the iterators src_hiside, dst_hiside, src_loside + * and dst_loside. src_hiside points to the box in the src for the + * high-side transfer, and similarly for dst_hiside. src_loside + * points to the box in the src for the low-side transfer, and + * similarly for dst_loside. + * + * Note that in the degenerate case, the dst box does not exist, + * and the swap degenerates to moving a box from the src to the + * dst. + * + * Compute the balance_penalty if high and low were swapped. Keep + * looking until we find the pair giving the lowest balance_penalty + * on swapping. + * + * isrc and idst point to the current best pair to swap. + * + * src_test and dst_test are trial pairs to check to see if we can + * improve on new_balance_penalty. + * + * We will look for two "best" pairs: + * + * TODO: This method was originally written to compute the best + * hiside and loside options separately and compare them at the + * end. That separation may not be needded anymore. It may be + * possible to simplify this method by keeping only the best option + * at any time. + */ + + // Initialization indicating no swap pair found yet. + iterator src_hiside = src.end(); + iterator dst_hiside = dst.end(); + iterator src_loside = src.end(); + iterator dst_loside = dst.end(); + + // A dummy BoxInTransit for set searches. + hier::Box dummy_box(d_pparams->getMinBoxSize().getDim()); + BoxInTransit dummy_search_target(d_pparams->getMinBoxSize().getDim()); + + // Difference between swap results and ideal, >= 0 + LoadType hiside_transfer = 0.0; + LoadType loside_transfer = 0.0; + + int loside_acceptance_flags[4] = { 0, 0, 0, 0 }; + int hiside_acceptance_flags[4] = { 0, 0, 0, 0 }; + + if (dst.empty()) { + /* + * There is no dst BoxInTransit, so the swap would + * degnerate to moving a box from src to dst. Find + * the best src BoxInTransit to move. + */ + dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); + dummy_search_target.setLoad(ideal_transfer); + const iterator src_test = src.lower_bound(dummy_search_target); + + if (d_print_swap_steps) { + tbox::plog << " swapLoadPair with empty dst: "; + } + + if (src_test != src.begin()) { + iterator src_test1 = src_test; + --src_test1; + if (BalanceUtilities::compareLoads( + hiside_acceptance_flags, hiside_transfer, + src_test1->getLoad(), ideal_transfer, + low_transfer, high_transfer, *d_pparams)) { + src_hiside = src_test1; + hiside_transfer = src_hiside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " hi src: " << (*src_hiside) + << " with transfer " << src_hiside->getLoad() + << ", off by " << hiside_transfer - ideal_transfer + << ", acceptance_flags=" << hiside_acceptance_flags[0] + << ',' << hiside_acceptance_flags[1] + << ',' << hiside_acceptance_flags[2] + << ',' << hiside_acceptance_flags[3]; + } + } + } + if (src_test != src.end()) { + if (BalanceUtilities::compareLoads( + loside_acceptance_flags, loside_transfer, + src_test->getLoad(), ideal_transfer, + low_transfer, high_transfer, *d_pparams)) { + src_loside = src_test; + loside_transfer = src_loside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " lo src: " << (*src_loside) + << " with transfer " << src_loside->getLoad() + << ", off by " << loside_transfer - ideal_transfer + << ", acceptance_flags=" << loside_acceptance_flags[0] + << ',' << loside_acceptance_flags[1] + << ',' << loside_acceptance_flags[2] + << ',' << loside_acceptance_flags[3]; + } + } + } + if (d_print_swap_steps) { + tbox::plog << std::endl; + } + + } else { + + /* + * Start search through src beginning with the box whose load + * exceeds the biggest dst box by at least ideal_transfer. + */ + dummy_search_target = *dst.begin(); + dummy_search_target.setLoad(dummy_search_target.getLoad() + ideal_transfer); + iterator src_beg = src.lower_bound(dummy_search_target); + + for (iterator src_test = src_beg; src_test != src.end(); ++src_test) { + + /* + * Set dst_test pointing to where we should start looking in dst. + * Look for a load less than the load of src_test by + * ideal_transfer. + */ + dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); + dummy_search_target.setLoad(tbox::MathUtilities::Max( + src_test->getLoad() - ideal_transfer, + 0)); + iterator dst_test = dst.lower_bound(dummy_search_target); + + if (dst_test != dst.end()) { + + /* + * lower_bound returned dst_test that would transfer >= + * ideal_transfer when swapped with src_test. Check + * transfererence between src_test and dst_test for the + * high-side transfer. Also check the next smaller box in + * dst for the low-side transfer. + */ + + BalanceUtilities::compareLoads( + hiside_acceptance_flags, hiside_transfer, + src_test->getLoad() - dst_test->getLoad(), + ideal_transfer, low_transfer, high_transfer, *d_pparams); + + if (hiside_acceptance_flags[2] == 1) { + src_hiside = src_test; + dst_hiside = dst_test; + hiside_transfer = src_hiside->getLoad() - dst_hiside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " new hi-swap pair: " << (*src_hiside) + << " & " << (*dst_hiside) << " with transfer " + << hiside_transfer + << " missing by " << hiside_transfer - ideal_transfer + << std::endl; + } + } + + if (dst_test != dst.begin()) { + --dst_test; // Now, src_test and dst_test transferer by *less* than ideal_transfer. + + BalanceUtilities::compareLoads( + loside_acceptance_flags, loside_transfer, + src_test->getLoad() - dst_test->getLoad(), + ideal_transfer, low_transfer, high_transfer, *d_pparams); + + if (loside_acceptance_flags[2] == 1) { + src_loside = src_test; + dst_loside = dst_test; + loside_transfer = src_loside->getLoad() - dst_loside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " new lo-swap pair: " << (*src_loside) + << " & " << (*dst_loside) << " with transfer " + << loside_transfer + << " missing by " << loside_transfer - ideal_transfer + << std::endl; + } + } + } + + } else { + + /* + * The ideal dst to swap is smaller than the smallest dst + * box. So the only choice is swapping src_test for nothing. + * Chech this against the current high- and low-side choices. + */ + if (src_test->getLoad() > ideal_transfer) { + // Moving src_test to dst is moving too much--hiside. + + BalanceUtilities::compareLoads( + hiside_acceptance_flags, hiside_transfer, + src_test->getLoad(), ideal_transfer, + low_transfer, high_transfer, *d_pparams); + + if (hiside_acceptance_flags[2] == 1) { + src_hiside = src_test; + dst_hiside = dst.end(); + hiside_transfer = src_hiside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " new hi-swap source: " << (*src_hiside) + << " & " << "no dst" << " with transfer " + << (src_hiside->getLoad()) + << " missing by " << hiside_transfer - ideal_transfer + << std::endl; + } + } + } else { + // Moving src_test to dst is moving (just right or) too little--loside. + + BalanceUtilities::compareLoads( + loside_acceptance_flags, loside_transfer, + src_test->getLoad(), ideal_transfer, + low_transfer, high_transfer, *d_pparams); + + if (loside_acceptance_flags[2] == 1) { + src_loside = src_test; + dst_loside = dst.end(); + loside_transfer = src_loside->getLoad(); + if (d_print_swap_steps) { + tbox::plog << " new lo-swap source: " << (*src_loside) + << " & " << "no dst" << " with transfer " + << (src_loside->getLoad()) + << " missing by " << loside_transfer - ideal_transfer + << std::endl; + } + } + /* + * Break out of the loop early because there is no + * point checking smaller src boxes. + */ + break; + } + } + + if ((low_transfer <= loside_transfer && loside_transfer <= high_transfer) || + (low_transfer <= hiside_transfer && hiside_transfer <= high_transfer)) { + // Found a transfer satisfying the range. Stop searching. + break; + } + + } + + } + + if (d_print_swap_steps) { + double balance_penalty_current = static_cast(ideal_transfer); + double balance_penalty_loside = static_cast(loside_transfer - ideal_transfer); + double balance_penalty_hiside = static_cast(hiside_transfer - ideal_transfer); + tbox::plog.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + tbox::plog.precision(8); + tbox::plog << " Swap candidates give penalties (unswap,lo,hi): " + << balance_penalty_current << " , " << balance_penalty_loside + << " , " << balance_penalty_hiside << std::endl; + } + + bool found_swap = false; + iterator isrc = src.end(); + iterator idst = dst.end(); + actual_transfer = 0; + + if (BalanceUtilities::compareLoads( + hiside_acceptance_flags, actual_transfer, + hiside_transfer, ideal_transfer, + low_transfer, high_transfer, *d_pparams)) { + isrc = src_hiside; + idst = dst_hiside; + actual_transfer = hiside_transfer; + found_swap = true; + if (d_print_swap_steps) { + tbox::plog << " Taking hiside." << std::endl; + } + } + + if (BalanceUtilities::compareLoads( + loside_acceptance_flags, actual_transfer, + loside_transfer, ideal_transfer, + low_transfer, high_transfer, *d_pparams)) { + isrc = src_loside; + idst = dst_loside; + actual_transfer = loside_transfer; + found_swap = true; + if (d_print_swap_steps) { + tbox::plog << " Taking loside." << std::endl; + } + } + + if (found_swap) { + + // We can improve balance_penalty by swapping isrc with idst. + if (d_print_swap_steps) { + tbox::plog << " Swapping " << actual_transfer << " units using "; + if (isrc != src.end()) tbox::plog << *isrc; + else tbox::plog << "X"; + tbox::plog << " <--> "; + if (idst != dst.end()) tbox::plog << *idst; + else tbox::plog << "X"; + tbox::plog << std::endl; + } + + if (isrc != src.end()) { + dst.insert(*isrc); + src.erase(isrc); + } + if (idst != dst.end()) { + src.insert(*idst); + dst.erase(idst); + } + + } else { + if (d_print_swap_steps) { + if (isrc == src.end()) { + tbox::plog << " Cannot find swap pair for " << ideal_transfer + << " units." << std::endl; + } else { + tbox::plog << " Keeping original (no swap)." << std::endl; + } + } + } + + d_object_timers->t_find_swap_pair->stop(); + return found_swap; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::setPrintFlags( + bool steps, bool pop_steps, bool swap_steps, bool break_steps, bool edge_steps) +{ + d_print_steps = steps; + d_print_pop_steps = pop_steps; + d_print_swap_steps = swap_steps; + d_print_break_steps = break_steps; + d_print_edge_steps = edge_steps; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::setTimerPrefix( + const std::string& timer_prefix) +{ + std::map::iterator ti( + s_static_timers.find(timer_prefix)); + if (ti == s_static_timers.end()) { + d_object_timers = &s_static_timers[timer_prefix]; + getAllTimers(timer_prefix, *d_object_timers); + } else { + d_object_timers = &(ti->second); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers) +{ + timers.t_adjust_load = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::adjustLoad()"); + timers.t_adjust_load_by_popping = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::adjustLoadByPopping()"); + timers.t_adjust_load_by_swapping = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::adjustLoadBySwapping()"); + timers.t_shift_loads_by_breaking = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::adjustLoadByBreaking()"); + timers.t_find_swap_pair = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::swapLoadPair()"); + + timers.t_assign_to_local_process_and_populate_maps = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::assignToLocalAndPopulateMaps()"); + + timers.t_populate_maps = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::populateMaps()"); + timers.t_construct_semilocal = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::constructSemilocalUnbalancedToBalanced()"); + timers.t_construct_semilocal_comm_wait = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::constructSemilocalUnbalancedToBalanced()_comm_wait"); + timers.t_construct_semilocal_send_edges = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::constructSemilocalUnbalancedToBalanced()_send_edges"); + + timers.t_pack_edge = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::pack_edge"); + timers.t_unpack_edge = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::unpack_edge"); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::putToMessageStream(tbox::MessageStream& msg) const +{ + msg << size(); + for (const_iterator ni = begin(); ni != end(); ++ni) { + const BoxInTransit& box_in_transit = *ni; + box_in_transit.putToMessageStream(msg); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::getFromMessageStream(tbox::MessageStream& msg) +{ + /* + * As we pull each BoxInTransit out, give it a new id that reflects + * its new owner. + */ + size_t num_boxes = 0; + msg >> num_boxes; + BoxInTransit received_box(d_pparams->getDim()); + for (size_t i = 0; i < num_boxes; ++i) { + received_box.getFromMessageStream(msg); + insert(received_box); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +BoxTransitSet::recursivePrint( + std::ostream& co, + const std::string& border, + int detail_depth) const +{ + co << border << getSumLoad() << " units in " << size() << " boxes"; + if (detail_depth > 0) { + size_t count = 0; + co << ":\n"; + for (BoxTransitSet::const_iterator bi = begin(); + bi != end() && count < 10; ++bi, ++count) { + tbox::plog << border << " " << *bi << '\n'; + } + } +} + +/* + ************************************************************************* + * Look for an input database called "BoxTransitSet" and read + * parameters if it exists. + ************************************************************************* + */ + +void +BoxTransitSet::getFromInput() +{ + if (!tbox::InputManager::inputDatabaseExists()) return; + + boost::shared_ptr input_db = tbox::InputManager::getInputDatabase(); + + if (input_db->isDatabase("BoxTransitSet")) { + + boost::shared_ptr my_db = input_db->getDatabase("BoxTransitSet"); + + d_print_steps = my_db->getBoolWithDefault("DEV_print_steps", d_print_steps); + d_print_break_steps = + my_db->getBoolWithDefault("DEV_print_break_steps", d_print_break_steps); + d_print_pop_steps = + my_db->getBoolWithDefault("DEV_print_pop_steps", d_print_pop_steps); + d_print_swap_steps = + my_db->getBoolWithDefault("DEV_print_swap_steps", d_print_swap_steps); + d_print_edge_steps = + my_db->getBoolWithDefault("DEV_print_edge_steps", d_print_edge_steps); + + } +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.h new file mode 100644 index 00000000..5075d7eb --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/BoxTransitSet.h @@ -0,0 +1,672 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Implementation of TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_BoxTransitSet +#define included_mesh_BoxTransitSet + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/hier/SequentialLocalIdGenerator.h" +#include "SAMRAI/mesh/BalanceBoxBreaker.h" +#include "SAMRAI/mesh/BoxInTransit.h" +#include "SAMRAI/mesh/PartitioningParams.h" +#include "SAMRAI/mesh/TransitLoad.h" +#include "SAMRAI/tbox/Dimension.h" +#include "SAMRAI/tbox/MessageStream.h" +#include "SAMRAI/tbox/StartupShutdownManager.h" + +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Implementation of TransitLoad, representing the load with a + * set of boxes, each of which represents a load and knows the origin + * of its load. + * + * As a container, this class is nearly identical to + * std::set. + */ + +class BoxTransitSet:public TransitLoad +{ + +public: + typedef double LoadType; + + //! @name Constructor + BoxTransitSet( + const PartitioningParams& pparams); + + /*! + * @name Copy constructor + * + * The content may be omitted from the copy, using the flag copy_load. + */ + BoxTransitSet( + const BoxTransitSet& other, + bool copy_load = true); + + //@{ + //! @name TransitLoad abstract interfaces + + //! @copydoc TransitLoad::clone() + BoxTransitSet * + clone() const; + + //! @copydoc TransitLoad::initialize() + void + initialize(); + + //! @copydoc TransitLoad::getSumLoad() + LoadType getSumLoad() const { + return d_sumload; + } + + //! @copydoc TransitLoad::insertAll( const hier::BoxContainer & ) + void + insertAll( + const hier::BoxContainer& box_container); + + //! @copydoc TransitLoad::insertAll( TransitLoad & ) + void + insertAll( + TransitLoad& other); + + //! @copydoc TransitLoad::insertAllWithExistingLoads( const hier::BoxContainer & ) + void + insertAllWithExistingLoads( + const hier::BoxContainer& box_container); + + /*! + * @brief Set workloads in the members of this BoxTransitSet. + * + * The BoxInTransit members of this BoxTransitSet will have their + * workload values set according to the data on the given patch level + * associated with the given data id + * + * @param[in] patch_level Level with boxes that are the same as those + * held in this BoxTransitSet + * @param[in] work_data_id Data id for the workload data that exists on + * the patch level + */ + void + setWorkload( + const hier::PatchLevel& patch_level, + const int work_data_id); + + //! @copydoc TransitLoad::getNumberOfItems() + size_t + getNumberOfItems() const; + + //! @copydoc TransitLoad::getNumberOfOriginatingProcesses() + size_t + getNumberOfOriginatingProcesses() const; + + //! @copydoc TransitLoad::putToMessageStream() + void + putToMessageStream( + tbox::MessageStream& msg) const; + + //! @copydoc TransitLoad::getFromMessageStream() + void + getFromMessageStream( + tbox::MessageStream& msg); + + /*! + * @copydoc TransitLoad::adjustLoad() + */ + LoadType + adjustLoad( + TransitLoad& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + /*! + * @copydoc TransitLoad::assignToLocal() + */ + void + assignToLocal( + hier::BoxLevel& balanced_box_level, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)); + + /*! + * @copydoc TransitLoad::assignToLocalAndPopulateMaps() + * + * This method uses communication to populate the map. + */ + void + assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)); + + //@} + + /* + * @brief Reassign the boxes to the new owner. + * + * Any box that isn't already owned by the new owner or doesn't + * have a valid LocalId, is given one by the + * SequentialLocalIdGenerator. + */ + void + reassignOwnership( + hier::SequentialLocalIdGenerator& id_gen, + int new_owner_rank); + + /*! + * @brief Put local Boxes into a BoxLevel. + */ + void + putInBoxLevel( + hier::BoxLevel& box_level) const; + + /*! + * @brief Generate unbalanced<==>balanced edges incident from + * local boxes. + * + * This method does no communication. Semilocal edges not incident + * from remote Boxes are not communicated. + */ + void + generateLocalBasedMapEdges( + hier::MappingConnector& unbalanced_to_balanced, + hier::MappingConnector& balanced_to_unbalanced) const; + + /*! + * @brief Setup names of timers. + * + * By default, timers are named "mesh::BoxTransitSet::*", + * where the third field is the specific steps performed + * by the Schedule. You can override the first two + * fields with this method. Conforming to the timer + * naming convention, timer_prefix should have the form + * "*::*". + */ + void + setTimerPrefix( + const std::string& timer_prefix); + + /*! + * @brief Set print flags for individual object. + */ + void + setPrintFlags( + bool steps, + bool pop_steps, + bool swap_steps, + bool break_steps, + bool edge_steps); + + void + recursivePrint( + std::ostream& co = tbox::plog, + const std::string& border = std::string(), + int detail_depth = 1) const; + + /*! + * @brief Intermediary between BoxTransitSet and output streams, + * adding ability to control the output. See + * BoxTransitSet::format(). + */ + class Outputter + { + + //! @brief Insert a BoxTransitSet to the stream according to Outputter settings. + friend std::ostream& + operator << (std::ostream& s, + const Outputter& f) + { + f.d_boxes.recursivePrint(s, f.d_border, f.d_detail_depth); + return s; + } + +private: + friend class BoxTransitSet; + /*! + * @brief Construct the Outputter with a BoxTransitSet and the + * parameters needed to output the BoxTransitSet to a stream. + */ + Outputter( + const BoxTransitSet& boxes, + const std::string& border, + int detail_depth = 2): + d_boxes(boxes), + d_border(border), + d_detail_depth(detail_depth) + { + } + + void + operator = ( + const Outputter& rhs); // Unimplemented private. + const BoxTransitSet& d_boxes; + const std::string d_border; + const int d_detail_depth; + }; + + /*! + * @brief Return a object to that can format the BoxTransitSet for + * inserting into output streams. + * + * Usage example (printing with a tab indentation): + * @verbatim + * cout << "my boxes:\n" << boxes.format("\t") << endl; + * @endverbatim + * + * @param[in] border Left border of the output + * + * @param[in] detail_depth How much detail to print. + */ + Outputter + format( + const std::string& border = std::string(), + int detail_depth = 2) const + { + return Outputter(*this, border, detail_depth); + } + + //@} + +private: + void + populateMaps( + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + const tbox::SAMRAI_MPI& alt_mpi) const; + + static const int BoxTransitSet_EDGETAG0 = 3; + static const int BoxTransitSet_EDGETAG1 = 4; + static const int BoxTransitSet_FIRSTDATALEN = 1000; + + /*! + * @brief Comparison functor for sorting BoxInTransit from more to + * less loads. + * + * Ties are broken by BlockId, then lexical comparison of the box's + * lower corner, then lexical comparison of the upper corner, then + * orginator BoxId. The comparison should not use the box's BoxId + * because some boxes may not have valid ones. + */ + struct BoxInTransitMoreLoad { + bool operator () ( + const BoxInTransit& a, + const BoxInTransit& b) const { + if (tbox::MathUtilities::Abs(a.getLoad() - b.getLoad()) > 1.0e-10) { + return a.getLoad() > b.getLoad(); + } + if (a.getBox().getBlockId() != b.getBox().getBlockId()) { + return a.getBox().getBlockId() < b.getBox().getBlockId(); + } + if (a.getBox().lower() != b.getBox().lower()) { + return lexicalIndexLessThan(a.getBox().lower(), b.getBox().lower()); + } + if (a.getBox().upper() != b.getBox().upper()) { + return lexicalIndexLessThan(a.getBox().upper(), b.getBox().upper()); + } + return a.getOrigBox().getBoxId() < b.getOrigBox().getBoxId(); + } +private: + bool lexicalIndexLessThan(const hier::Index& a, + const hier::Index& b) const { + for (hier::Index::dir_t i = 0; i < a.getDim().getValue(); ++i) { + if (a(i) != b(i)) return a(i) < b(i); + } + return false; + } + }; + +public: + //@{ + //! @name Interfaces like the C++ standard stl::set, to help readability. + typedef std::set::iterator iterator; + typedef std::set::const_iterator const_iterator; + typedef std::set::reverse_iterator reverse_iterator; + typedef std::set::key_type key_type; + typedef std::set::value_type value_type; + iterator begin() { + return d_set.begin(); + } + iterator end() { + return d_set.end(); + } + const_iterator begin() const { + return d_set.begin(); + } + const_iterator end() const { + return d_set.end(); + } + reverse_iterator rbegin() const { + return d_set.rbegin(); + } + reverse_iterator rend() const { + return d_set.rend(); + } + size_t size() const { + return d_set.size(); + } + std::pair insert(const value_type& x) { + std::pair rval = d_set.insert(x); + if (rval.second) d_sumload += x.getLoad(); + if (rval.second) d_sumsize += x.getSize(); + return rval; + } + void erase(iterator pos) { + d_sumload -= pos->getLoad(); + d_sumsize -= pos->getSize(); + d_set.erase(pos); + } + size_t erase(const key_type& k) { + const size_t num_erased = d_set.erase(k); + if (num_erased) d_sumload -= k.getLoad(); + if (num_erased) d_sumsize -= k.getSize(); + return num_erased; + } + bool empty() const { + return d_set.empty(); + } + void clear() { + d_sumload = 0; + d_sumsize = 0; + d_set.clear(); + } + void swap(BoxTransitSet& other) { + const LoadType tl = d_sumload; + const LoadType ts = d_sumsize; + d_sumload = other.d_sumload; + d_sumsize = other.d_sumsize; + other.d_sumload = tl; + other.d_sumsize = ts; + d_set.swap(other.d_set); + } + iterator lower_bound(const key_type& k) const { + return d_set.lower_bound(k); + } + iterator upper_bound(const key_type& k) const { + return d_set.upper_bound(k); + } + //@} + +private: + //@{ @name Load adjustment methods + + /*! + * @brief Adjust the load in this BoxTransitSet by moving the + * biggest between it and another BoxTransitSet. + * + * @param[in,out] hold_bin Holding bin for reserve load. + * + * @param[in] ideal_load The load that this bin should have. + * + * @param[in] low_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @param[in] high_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @return Net load added to this BoxTransitSet. If negative, load + * decreased. + */ + LoadType + adjustLoadByPopping( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + /*! + * @brief Adjust the load in this BoxTransitSet by swapping boxes + * between it and another BoxTransitSet. + * + * @param[in,out] hold_bin Holding bin for reserve load. + * + * @param[in] ideal_load The load that this bin should have. + * + * @param[in] low_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @param[in] high_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @return Net load added to this BoxTransitSet. If negative, load + * decreased. + */ + LoadType + adjustLoadBySwapping( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + /*! + * @brief Adjust the load in this BoxTransitSet by moving work + * between it and another BoxTransitSet. One box may be broken + * up to have a part of its load moved. + * + * @param[in,out] hold_bin Holding bin for reserve load. + * + * @param[in] ideal_load The load that this bin should have. + * + * @param[in] low_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @param[in] high_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @return Net load added to this BoxTransitSet. If negative, load + * decreased. + */ + LoadType + adjustLoadByBreaking( + BoxTransitSet& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + /*! + * @brief Find a BoxInTransit in each of the source and destination + * containers that, when swapped, effects a transfer of the given + * amount of work from the source to the destination. Swap the boxes. + * + * @param [in,out] src + * + * @param [in,out] dst + * + * @param actual_transfer [out] Amount of work transfered from src to + * dst. + * + * @param ideal_transfer [in] Amount of work to be transfered from + * src to dst. + * + * @param low_transfer + * + * @param high_transfer + */ + bool + swapLoadPair( + BoxTransitSet& src, + BoxTransitSet& dst, + LoadType& actual_transfer, + LoadType ideal_transfer, + LoadType low_transfer, + LoadType high_transfer) const; + + //@} + + /*! + * @brief Communicate semilocal relationships to load donors and + * fill in unbalanced--->balanced Connectors. + * + * These relationships must be represented by this object. + * Semilocal means the local process owns either Box or + * the orginal box (not both!) of each item in this BoxTransitSet. + * + * Recall that semi-local relationships are those where the base + * and head boxes are owned by different processes. These edges + * require communication to set up. + * + * @param [out] unbalanced_to_balanced + */ + void + constructSemilocalUnbalancedToBalanced( + hier::MappingConnector& unbalanced_to_balanced, + const tbox::SAMRAI_MPI& mpi) const; + + /*! + * @brief Re-cast a TransitLoad object to a BoxTransitSet. + */ + const BoxTransitSet& recastTransitLoad(const TransitLoad& transit_load) { + const BoxTransitSet* ptr = static_cast(&transit_load); + TBOX_ASSERT(ptr); + return *ptr; + } + + /*! + * @brief Re-cast a TransitLoad object to a BoxTransitSet. + */ + BoxTransitSet& recastTransitLoad(TransitLoad& transit_load) { + BoxTransitSet* ptr = static_cast(&transit_load); + TBOX_ASSERT(ptr); + return *ptr; + } + + /*! + * @brief Set up things for the entire class. + * + * Only called by StartupShutdownManager. + */ + static void initializeCallback() { + TimerStruct& timers(s_static_timers[s_default_timer_prefix]); + getAllTimers(s_default_timer_prefix, timers); + } + + /*! + * Free static timers. + * + * Only called by StartupShutdownManager. + */ + static void finalizeCallback() { + s_static_timers.clear(); + } + + //! @brief Compute the load for a Box. + double computeLoad(const hier::Box& box) const { + return static_cast(box.size()); + } + + /*! + * @brief Compute the load for the Box, restricted to where it + * intersects a given box. + */ + double computeLoad( + const hier::Box& box, + const hier::Box& restriction) const + { + return static_cast((box * restriction).size()); + } + + /*! + * @brief Look for an input database called "BoxTransitSet" and + * read parameters if it exists. + */ + void + getFromInput(); + + //! @brief Balance penalty is proportional to imbalance. + double computeBalancePenalty(double imbalance) const { + return tbox::MathUtilities::Abs(imbalance); + } + + std::set d_set; + LoadType d_sumload; + LoadType d_sumsize; + + const PartitioningParams* d_pparams; + + BalanceBoxBreaker d_box_breaker; + + //@{ + //! @name Debugging stuff. + bool d_print_steps; + bool d_print_pop_steps; + bool d_print_swap_steps; + bool d_print_break_steps; + bool d_print_edge_steps; + //@} + + //@{ + //! @name Timer data for Schedule class. + + /* + * @brief Structure of timers used by this class. + * + * Each Schedule object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_adjust_load; + boost::shared_ptr t_adjust_load_by_popping; + boost::shared_ptr t_adjust_load_by_swapping; + boost::shared_ptr t_shift_loads_by_breaking; + boost::shared_ptr t_find_swap_pair; + boost::shared_ptr t_assign_to_local_process_and_populate_maps; + boost::shared_ptr t_populate_maps; + boost::shared_ptr t_construct_semilocal; + boost::shared_ptr t_construct_semilocal_comm_wait; + boost::shared_ptr t_construct_semilocal_send_edges; + boost::shared_ptr t_pack_edge; + boost::shared_ptr t_unpack_edge; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + /*! + * @brief Get all the timers defined in TimerStruct. The timers + * are named with the given prefix. + */ + static void + getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers); + + //@} + + static tbox::StartupShutdownManager::Handler + s_initialize_finalize_handler; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.C new file mode 100644 index 00000000..6cc7f0be --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.C @@ -0,0 +1,1028 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using a "cascade" algorithm. + * + ************************************************************************/ + +#ifndef included_mesh_CascadePartitioner_C +#define included_mesh_CascadePartitioner_C + +#include "SAMRAI/mesh/CascadePartitioner.h" +#include "SAMRAI/mesh/BoxTransitSet.h" +#include "SAMRAI/mesh/VoucherTransitLoad.h" +#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/hier/BoxContainer.h" + +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/CellDataFactory.h" +#include "SAMRAI/pdat/CellDoubleConstantRefine.h" +#include "SAMRAI/xfer/RefineAlgorithm.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/AsyncCommStage.h" +#include "SAMRAI/tbox/AsyncCommGroup.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/TimerManager.h" + +#include +#include +#include +#include + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +const int CascadePartitioner::CascadePartitioner_LOADTAG0; +const int CascadePartitioner::CascadePartitioner_LOADTAG1; +const int CascadePartitioner::CascadePartitioner_FIRSTDATALEN; + +const int CascadePartitioner::s_default_data_id = -1; + +/* + ************************************************************************* + * CascadePartitioner constructor. + ************************************************************************* + */ + +CascadePartitioner::CascadePartitioner( + const tbox::Dimension& dim, + const std::string& name, + const boost::shared_ptr& input_db): + d_dim(dim), + d_object_name(name), + d_mpi(tbox::SAMRAI_MPI::commNull), + d_mpi_is_dupe(false), + d_master_workload_data_id(s_default_data_id), + d_workload_data_id(0), + d_tile_size(dim, 1), + d_max_spread_procs(500), + d_limit_supply_to_surplus(true), + d_reset_obligations(true), + d_flexible_load_tol(0.05), + d_use_vouchers(false), + d_mca(), + // Shared data. + d_workload_level(), + d_balance_box_level(0), + d_balance_to_reference(0), + d_global_work_sum(-1), + d_global_work_avg(-1), + d_min_load(-1), + d_num_initial_owners(0), + d_local_load(0), + d_shipment(0), + d_comm_stage(), + // Performance evaluation and diagnostics. + d_barrier_before(false), + d_barrier_after(false), + d_report_load_balance(false), + d_summarize_map(false), + d_print_steps(false), + d_print_child_steps(false), + d_check_connectivity(false), + d_check_map(false) +{ + for (int i = 0; i < 4; ++i) d_comm_peer[i].initialize(&d_comm_stage); + + TBOX_ASSERT(!name.empty()); + getFromInput(input_db); + setTimers(); + d_comm_stage.setCommunicationWaitTimer(t_communication_wait); + d_mca.setTimerPrefix(d_object_name); +} + +/* + ************************************************************************* + * CascadePartitioner constructor. + ************************************************************************* + */ + +CascadePartitioner::~CascadePartitioner() +{ + freeMPICommunicator(); +} + +/* + ************************************************************************* + * Accessory functions to get/set load balancing parameters. + ************************************************************************* + */ + +bool +CascadePartitioner::getLoadBalanceDependsOnPatchData( + int level_number) const +{ + return getWorkloadDataId(level_number) < 0 ? false : true; +} + +/* + ************************************************************************** + ************************************************************************** + */ +void +CascadePartitioner::setWorkloadPatchDataIndex( + int data_id, + int level_number) +{ + boost::shared_ptr > datafact( + BOOST_CAST, hier::PatchDataFactory>( + hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> + getPatchDataFactory(data_id))); + + TBOX_ASSERT(datafact); + + if (level_number >= 0) { + int asize = static_cast(d_workload_data_id.size()); + if (asize < level_number + 1) { + d_workload_data_id.resize(level_number + 1); + for (int i = asize; i < level_number - 1; i++) { + d_workload_data_id[i] = d_master_workload_data_id; + } + d_workload_data_id[level_number] = data_id; + } + } else { + d_master_workload_data_id = data_id; + for (int ln = 0; ln < static_cast(d_workload_data_id.size()); ln++) { + d_workload_data_id[ln] = d_master_workload_data_id; + } + } +} + +/* + ************************************************************************* + * This method implements the abstract LoadBalanceStrategy interface. + ************************************************************************* + */ +void +CascadePartitioner::loadBalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_reference, + const boost::shared_ptr& hierarchy, + const int level_number, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::BoxLevel& domain_box_level, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + const tbox::RankGroup& rank_group) const +{ + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(domain_box_level); + TBOX_ASSERT(!balance_to_reference || balance_to_reference->hasTranspose()); + TBOX_ASSERT(!balance_to_reference || + balance_to_reference->isTransposeOf(balance_to_reference->getTranspose())); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY6(d_dim, + balance_box_level, + min_size, + max_size, + domain_box_level, + bad_interval, + cut_factor); + if (hierarchy) { + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); + } + + if (d_mpi_is_dupe) { + /* + * If user has set the duplicate communicator, make sure it is + * compatible with the BoxLevel involved. + */ + TBOX_ASSERT(d_mpi.getSize() == balance_box_level.getMPI().getSize()); + TBOX_ASSERT(d_mpi.getRank() == balance_box_level.getMPI().getRank()); +#ifdef DEBUG_CHECK_ASSERTIONS + if (!d_mpi.isCongruentWith(balance_box_level.getMPI())) { + TBOX_ERROR("CascadePartitioner::loadBalanceBoxLevel:\n" + << "The input balance_box_level has a SAMRAI_MPI that is\n" + << "not congruent with the one set with setSAMRAI_MPI().\n" + << "You must use freeMPICommunicator() before balancing\n" + << "a BoxLevel with an incongruent SAMRAI_MPI."); + } +#endif + } else { + d_mpi = balance_box_level.getMPI(); + } + + if (d_print_steps) { + tbox::plog << d_object_name << "::loadBalanceBoxLevel called with:" + << "\n min_size = " << min_size + << "\n max_size = " << max_size + << "\n bad_interval = " << bad_interval + << "\n cut_factor = " << cut_factor + << "\n prebalance:\n" + << balance_box_level.format(" ", 2) + << std::flush; + } + + // Set effective_cut_factor to least common multiple of cut_factor and d_tile_size. + const size_t nblocks = hierarchy->getGridGeometry()->getNumberBlocks(); + hier::IntVector effective_cut_factor(cut_factor, nblocks); + if ( d_tile_size != hier::IntVector::getOne(d_dim) ) { + if (cut_factor.getNumBlocks() == 1) { + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for ( int d=0; d(balance_box_level.getBoxes().size())); + + if (d_print_steps) { + tbox::plog << "Post balanced:\n" << balance_box_level.format("", 2) + << std::flush; + } + + if (d_report_load_balance) { + tbox::plog << d_object_name << "::loadBalanceBoxLevel results:" << std::endl; + BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, local_load), balance_box_level.getMPI()); + } + + if (d_check_connectivity && balance_to_reference) { + hier::Connector& reference_to_balance = balance_to_reference->getTranspose(); + tbox::plog << "CascadePartitioner checking balance-reference connectivity." + << std::endl; + int errs = 0; + if (reference_to_balance.checkOverlapCorrectness(false, true, true)) { + ++errs; + tbox::perr << "Error found in reference_to_balance!" << std::endl; + } + if (balance_to_reference->checkOverlapCorrectness(false, true, true)) { + ++errs; + tbox::perr << "Error found in balance_to_reference!" << std::endl; + } + if (reference_to_balance.checkTransposeCorrectness(*balance_to_reference)) { + ++errs; + tbox::perr << "Error found in balance-reference transpose!" << std::endl; + } + if (errs != 0) { + TBOX_ERROR( + "Errors in load balance mapping found.\n" + << "reference_box_level:\n" << reference_to_balance.getBase().format("", 2) + << "balance_box_level:\n" << balance_box_level.format("", 2) + << "reference_to_balance:\n" << reference_to_balance.format("", 2) + << "balance_to_reference:\n" << balance_to_reference->format("", 2)); + } + tbox::plog << "CascadePartitioner checked balance-reference connectivity." + << std::endl; + } + + assertNoMessageForPrivateCommunicator(); +} + +/* + ************************************************************************* + * This method implements the cascade partitioner algorithm. + * + * It calls distributeLoad to do distribute the load then assigns the + * distributed the loads to their new owners and update Connectors. + ************************************************************************* + */ +void +CascadePartitioner::partitionByCascade( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_reference, + bool use_vouchers) const +{ + if (d_print_steps) { + tbox::plog << d_object_name << "::partitionByCascade: entered" << std::endl; + } + + boost::shared_ptr local_load; + boost::shared_ptr shipment; + if (use_vouchers) { + local_load = boost::make_shared(*d_pparams); + shipment = boost::make_shared(*d_pparams); + d_pparams->setUsingVouchers(true); + } else { + local_load = boost::make_shared(*d_pparams); + shipment = boost::make_shared(*d_pparams); + } + local_load->setAllowBoxBreaking(true); + local_load->setTimerPrefix(d_object_name); + shipment->setTimerPrefix(d_object_name); + + const double ideal_box_width = pow(d_global_work_avg, 1.0 / d_dim.getValue()); + local_load->setThresholdWidth(ideal_box_width); + shipment->setThresholdWidth(ideal_box_width); + + local_load->insertAll(balance_box_level.getBoxes()); + if (d_workload_level) { + local_load->setWorkload(*d_workload_level, + getWorkloadDataId(d_workload_level->getLevelNumber())); + } + + // Set up temporaries shared with the process groups. + d_balance_box_level = &balance_box_level; + d_balance_to_reference = balance_to_reference; + d_local_load = &(*local_load); + d_shipment = &(*shipment); + + CascadePartitionerTree groups(*this); + groups.distributeLoad(); + + d_balance_box_level = 0; + d_balance_to_reference = 0; + d_local_load = 0; + d_shipment = 0; + d_global_work_sum = -1; + d_global_work_avg = -1; + d_min_load = -1; + d_num_initial_owners = 0; + + if (d_print_steps) { + tbox::plog << d_object_name << "::partitionByCascade: leaving" << std::endl; + } +} + +/* + ************************************************************************* + * Update connectors according to the current boxes in d_local_load. + * Only point-to-point communication should be used. If there are not + * power-of-two processes in d_mpi and d_max_spread_procs is small enough + * to cause intermediate calls to updateConnectors, it is possible that + * a subset of processes will be calling updateConnectors(). So don't + * use collective MPI communications in this method! + ************************************************************************* + */ +void CascadePartitioner::updateConnectors() const +{ + t_update_connectors->start(); + + if (d_print_steps) { + tbox::plog + << d_object_name << "::updateConnectors constructing unbalanced<==>balanced." << std::endl; + } + + /* + * Initialize empty balanced_box_level and mappings so they are + * ready to be populated. + */ + hier::IntVector zero_vector(hier::IntVector::getZero(d_dim)); + hier::BoxLevel balanced_box_level( + d_balance_box_level->getRefinementRatio(), + d_balance_box_level->getGridGeometry(), + d_balance_box_level->getMPI()); + hier::MappingConnector balanced_to_unbalanced(balanced_box_level, + *d_balance_box_level, + hier::IntVector::getZero(d_dim)); + hier::MappingConnector unbalanced_to_balanced(*d_balance_box_level, + balanced_box_level, + hier::IntVector::getZero(d_dim)); + unbalanced_to_balanced.setTranspose(&balanced_to_unbalanced, false); + + t_assign_to_local_and_populate_maps->start(); + d_local_load->assignToLocalAndPopulateMaps( + balanced_box_level, + balanced_to_unbalanced, + unbalanced_to_balanced, + d_flexible_load_tol, + d_mpi); + t_assign_to_local_and_populate_maps->stop(); + + if (d_summarize_map) { + tbox::plog << d_object_name << "::updateConnectors unbalanced--->balanced map:" << std::endl + << unbalanced_to_balanced.format("\t", 0) + << "Map statistics:" << std::endl << unbalanced_to_balanced.formatStatistics("\t") + << d_object_name << "::updateConnectors balanced--->unbalanced map:" << std::endl + << balanced_to_unbalanced.format("\t", 0) + << "Map statistics:" << std::endl << balanced_to_unbalanced.formatStatistics("\t") + << std::endl; + } + + if (d_check_map) { + if (unbalanced_to_balanced.findMappingErrors() != 0) { + TBOX_ERROR( + d_object_name << "::updateConnectors Mapping errors found in unbalanced_to_balanced!"); + } + if (unbalanced_to_balanced.checkTransposeCorrectness( + balanced_to_unbalanced)) { + TBOX_ERROR( + d_object_name << "::updateConnectors Transpose errors found!"); + } + } + + if (d_summarize_map) { + tbox::plog << d_object_name << "::updateConnectors: unbalanced--->balanced map:" << std::endl + << unbalanced_to_balanced.format("\t", 0) + << "Map statistics:" << std::endl << unbalanced_to_balanced.formatStatistics("\t") + << d_object_name << "::updateConnectors: balanced--->unbalanced map:" << std::endl + << balanced_to_unbalanced.format("\t", 0) + << "Map statistics:" << std::endl << balanced_to_unbalanced.formatStatistics("\t") + << std::endl; + } + + if (d_balance_to_reference && d_balance_to_reference->hasTranspose()) { + if (d_print_steps) { + tbox::plog + << d_object_name << "::updateConnectors applying unbalanced<==>balanced." << std::endl; + } + t_use_map->start(); + d_mca.modify( + d_balance_to_reference->getTranspose(), + unbalanced_to_balanced, + d_balance_box_level, + &balanced_box_level); + t_use_map->stop(); + } else { + hier::BoxLevel::swap(*d_balance_box_level, balanced_box_level); + } + + d_local_load->insertAllWithExistingLoads(d_balance_box_level->getBoxes()); + + if (d_print_steps) { + tbox::plog + << d_object_name << "::updateConnectors leaving." << std::endl; + } + + t_update_connectors->stop(); +} + +/* + ************************************************************************* + * Set d_global_work_sum, d_local_work_max, d_num_initial_owners. + ************************************************************************* + */ +void CascadePartitioner::globalWorkReduction( + LoadType local_work, + bool has_any_load) const +{ + t_global_work_reduction->start(); + + d_global_work_sum = d_local_work_max = local_work; + d_num_initial_owners = static_cast(has_any_load); + + if (d_mpi.getSize() > 1) { + double dtmp[2], dtmp_sum[2], dtmp_max[2]; + + dtmp[0] = local_work; + dtmp[1] = static_cast(d_num_initial_owners); + + d_mpi.Allreduce(dtmp, dtmp_sum, 2, MPI_DOUBLE, MPI_SUM); + d_global_work_sum = dtmp_sum[0]; + d_num_initial_owners = static_cast(dtmp_sum[1]); + + d_mpi.Allreduce(dtmp, dtmp_max, 1, MPI_DOUBLE, MPI_MAX); + d_local_work_max = dtmp_max[0]; + } + + if (d_print_steps) { + tbox::plog.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + tbox::plog.precision(6); + tbox::plog << d_object_name << "::globalWorkReduction" + << " d_local_work_max=" << d_local_work_max + << " d_global_work_sum=" << d_global_work_sum + << " (initially born on " + << d_num_initial_owners << " procs) across all " + << d_mpi.getSize() + << " procs, averaging " << d_global_work_sum / d_mpi.getSize() + << " or " << pow(d_global_work_sum / d_mpi.getSize(), 1.0 / d_dim.getValue()) + << "^" << d_dim << " per proc." << std::endl; + } + + t_global_work_reduction->stop(); +} + +/* + ************************************************************************* + * Compute log-base-2 of integer, rounded up. + ************************************************************************* + */ +int CascadePartitioner::lgInt(int s) { + int lg_s = 0; + while ((1 << lg_s) < s) { + ++lg_s; + } + return lg_s; +} + +/* + ************************************************************************* + * Set the MPI commuicator. If there's a private communicator, free + * it first. It's safe to free the private communicator because no + * other code have access to it. + ************************************************************************* + */ +void +CascadePartitioner::setSAMRAI_MPI( + const tbox::SAMRAI_MPI& samrai_mpi) +{ + if (samrai_mpi.getCommunicator() == tbox::SAMRAI_MPI::commNull) { + TBOX_ERROR(d_object_name << "::setSAMRAI_MPI error: Given\n" + << "communicator is invalid."); + } + + if (d_mpi_is_dupe) { + d_mpi.freeCommunicator(); + } + + // Enable private communicator. + d_mpi.dupCommunicator(samrai_mpi); + d_mpi_is_dupe = true; + + d_mca.setSAMRAI_MPI(d_mpi); +} + +/* + ************************************************************************* + * Set the MPI commuicator. + ************************************************************************* + */ +void +CascadePartitioner::freeMPICommunicator() +{ + if (d_mpi_is_dupe && d_mpi.getCommunicator() != MPI_COMM_NULL) { + // Free the private communicator (if MPI has not been finalized). + int flag; + tbox::SAMRAI_MPI::Finalized(&flag); + if (!flag) { + d_mpi.freeCommunicator(); + } + } + d_mpi.setCommunicator(tbox::SAMRAI_MPI::commNull); + d_mpi_is_dupe = false; +} + +/* + ************************************************************************* + ************************************************************************* + */ +CascadePartitioner::LoadType +CascadePartitioner::computeLocalLoad( + const hier::BoxLevel& box_level) const +{ + double load = 0.0; + const hier::BoxContainer& boxes = box_level.getBoxes(); + for (hier::BoxContainer::const_iterator ni = boxes.begin(); + ni != boxes.end(); + ++ni) { + double box_load = static_cast(ni->size()); + load += box_load; + } + return static_cast(load); +} + +CascadePartitioner::LoadType +CascadePartitioner::computeNonUniformWorkLoad( + const hier::PatchLevel& patch_level) const +{ + double load = 0.0; + for (hier::PatchLevel::iterator ip(patch_level.begin()); + ip != patch_level.end(); ++ip) { + const boost::shared_ptr& patch = *ip; + + double patch_work = + BalanceUtilities::computeNonUniformWorkload(patch, + getWorkloadDataId(patch_level.getLevelNumber()), + patch->getBox()); + + load += patch_work; + } + return static_cast(load); +} + +/* + ************************************************************************* + * + * Read values (described in the class header) from input database. + * + ************************************************************************* + */ + +void +CascadePartitioner::getFromInput( + const boost::shared_ptr& input_db) +{ + + if (input_db) { + + d_print_steps = + input_db->getBoolWithDefault("DEV_print_steps", d_print_steps); + d_print_child_steps = + input_db->getBoolWithDefault("DEV_print_child_steps", d_print_child_steps); + d_check_connectivity = + input_db->getBoolWithDefault("DEV_check_connectivity", d_check_connectivity); + d_check_map = + input_db->getBoolWithDefault("DEV_check_map", d_check_map); + + d_summarize_map = input_db->getBoolWithDefault("DEV_summarize_map", + d_summarize_map); + + d_report_load_balance = input_db->getBoolWithDefault( + "DEV_report_load_balance", d_report_load_balance); + d_barrier_before = input_db->getBoolWithDefault("DEV_barrier_before", + d_barrier_before); + d_barrier_after = input_db->getBoolWithDefault("DEV_barrier_after", + d_barrier_after); + + d_max_spread_procs = + input_db->getIntegerWithDefault("max_spread_procs", + d_max_spread_procs); + + d_use_vouchers = + input_db->getBoolWithDefault("use_vouchers", false); + + d_limit_supply_to_surplus = + input_db->getBoolWithDefault("DEV_limit_supply_to_surplus", + d_limit_supply_to_surplus); + + d_reset_obligations = + input_db->getBoolWithDefault("DEV_reset_obligations", + d_reset_obligations); + + d_flexible_load_tol = + input_db->getDoubleWithDefault("flexible_load_tolerance", + d_flexible_load_tol); + + if (input_db->isInteger("tile_size")) { + input_db->getIntegerArray("tile_size", &d_tile_size[0], d_tile_size.getDim().getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_tile_size[i] >= 1)) { + TBOX_ERROR("CascadePartitioner tile_size must be >= 1 in all directions.\n" + << "Input tile_size is " << d_tile_size); + } + } + } + } +} + +/* + *************************************************************************** + * + *************************************************************************** + */ +void +CascadePartitioner::assertNoMessageForPrivateCommunicator() const +{ + /* + * If using a private communicator, double check to make sure + * there are no remaining messages. This is not a guarantee + * that there is no messages in transit, but it can find + * messages that have arrived but not received. + */ + if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { + tbox::SAMRAI_MPI::Status mpi_status; + if (d_mpi.hasReceivableMessage(&mpi_status)) { + int count = -1; + tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); + TBOX_ERROR( + "Library error!\n" + << "CascadePartitioner detected before or\n" + << "after using a private communicator that there\n" + << "is a message yet to be received. This is\n" + << "an error because all messages using the\n" + << "private communicator should have been\n" + << "accounted for. Message status:\n" + << "source " << mpi_status.MPI_SOURCE << '\n' + << "tag " << mpi_status.MPI_TAG << '\n' + << "count " << count << " (assuming integers)\n" + << "current tags: " + << ' ' << CascadePartitioner_LOADTAG0 << ' ' + << CascadePartitioner_LOADTAG1 + ); + } + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +CascadePartitioner::setTimers() +{ + /* + * The first constructor gets timers from the TimerManager. + * and sets up their deallocation. + */ + if (!t_load_balance_box_level) { + t_load_balance_box_level = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::loadBalanceBoxLevel()"); + + t_use_map = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::use_map"); + + t_update_connectors = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::updateConnectors()"); + + t_global_work_reduction = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::globalWorkReduction()"); + + t_assign_to_local_and_populate_maps = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::assign_to_local_and_populate_maps"); + + t_communication_wait = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::communication_wait"); + + // These timers are shared by CascadePartitionerTree. + t_distribute_load = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::distributeLoad()"); + t_combine_children = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::combineChildren()"); + t_balance_children = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::balanceChildren()"); + t_supply_work = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::supply_work"); + t_send_shipment = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::sendShipment()"); + t_receive_and_unpack_supplied_load = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::receiveAndUnpackSuppliedLoad()"); + + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +CascadePartitioner::printStatistics( + std::ostream& output_stream) const +{ + if (d_load_stat.empty()) { + output_stream << "No statistics for CascadePartitioner.\n"; + } else { + BalanceUtilities::reduceAndReportLoadBalance( + d_load_stat, + tbox::SAMRAI_MPI::getSAMRAIWorld(), + output_stream); + } +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.h new file mode 100644 index 00000000..f930919f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitioner.h @@ -0,0 +1,538 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using tree algorithm. + * + ************************************************************************/ + +#ifndef included_mesh_CascadePartitioner +#define included_mesh_CascadePartitioner + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/mesh/CascadePartitionerTree.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/mesh/LoadBalanceStrategy.h" +#include "SAMRAI/mesh/PartitioningParams.h" +#include "SAMRAI/mesh/TransitLoad.h" +#include "SAMRAI/tbox/AsyncCommPeer.h" +#include "SAMRAI/tbox/AsyncCommStage.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/RankGroup.h" +#include "SAMRAI/tbox/RankTreeStrategy.h" +#include "SAMRAI/tbox/Timer.h" +#include "SAMRAI/tbox/Utilities.h" + +#include "boost/shared_ptr.hpp" +#include +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Provides load balancing routines for AMR hierarchy by + * implemementing the LoadBalancerStrategy using the cascade partitioning algorithm. + * + * The algorithm is described in the article "Advances in Patch-Based + * Adaptive Mesh Refinement Scalability" submitted to JPDC. Scaling + * benchmark results are also in the article. + * + * This class can be used for both uniform or non-uniform load balancing. + * To enable non-uniform load balancing, a call must be made to the method + * setWorkloadPatchDataIndex to give this object a patch data id for + * cell-centered workload data that must be set on the hierarchy outside of + * this class. + * + * The default behavior of this class is to do uniform load balancing, treating + * all cells of a level as having equal load value. + * + * Input Parameters + * + * Definitions: + * + * - \b flexible_load_tolerance + * Fraction of ideal load a process can + * take on in order to reduce box cutting and load movement. Higher + * values often reduce partitioning time and box count but produce + * less balanced work loads. Surplus work greater than this + * tolerance can still result due to other constraints, such as + * minimum box size. + * + * - \b tile_size + * Tile size when using tile mode. Tile mode restricts box cuts + * to tile boundaries. Default is 1, which is equivalent to no restriction. + * + * - \b max_spread_procs + * This parameter limits how many processes may receive the load of one + * process before updating Connectors. If a process has too much + * initial load, this limit causes the Connector to be updated gradually, + * alleviating the bottle-neck of one process doing an excessive amount + * of Connector updates. + * + * - \b use_vouchers + * Boolean parameter to turn on the optional voucher method for passing + * around workload during the cascade algorithm. Note that non-uniform + * load balancing always uses the voucher method regardless of this + * parameter's value. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
flexible_load_tolerancedouble0.050-1optNot written to restart. Value in input db used.
tile_sizeIntVector11-optNot written to restart. Value in input db used.
max_spread_procsint500 > 1optNot written to restart. Value in input db used.
use_vouchersboolFALSETRUE or FALSEoptNot written to restart. Value in input db used.
+ * + * @internal The following are developer inputs. Defaults listed + * in parenthesis: + * + * @internal DEV_reset_obligations (true) + * bool + * Whether to reset load obligations within groups that cannot change its load average. + * + * @internal DEV_limit_supply_to_surplus (true) + * bool + * Whether limit work a process can supply to its surplus. The effects on partitioning + * speed and quality are not yet known. + * + * @see LoadBalanceStrategy + */ + +class CascadePartitioner: + public LoadBalanceStrategy +{ +public: + /*! + * @brief Initializing constructor sets object state to default or, + * if database provided, to parameters in database. + * + * @param[in] dim + * + * @param[in] name User-defined identifier used for error reporting + * and timer names. + * + * @param[in] input_db (optional) database pointer providing + * parameters from input file. This pointer may be null indicating + * no input is used. + * + * @pre !name.empty() + */ + CascadePartitioner( + const tbox::Dimension& dim, + const std::string& name, + const boost::shared_ptr& input_db = + boost::shared_ptr()); + + /*! + * @brief Virtual destructor releases all internal storage. + */ + virtual ~CascadePartitioner(); + + /*! + * @brief Set the internal SAMRAI_MPI to a duplicate of the given + * SAMRAI_MPI. + * + * The given SAMRAI_MPI must have a valid communicator. + * + * The given SAMRAI_MPI is duplicated for private use. This + * requires a global communication, so all processes in the + * communicator must call it. The advantage of a duplicate + * communicator is that it ensures the communications for the + * object won't accidentally interact with unrelated + * communications. + * + * If the duplicate SAMRAI_MPI it is set, the CascadePartitioner will + * only balance BoxLevels with congruent SAMRAI_MPI objects and + * will use the duplicate SAMRAI_MPI for communications. + * Otherwise, the SAMRAI_MPI of the BoxLevel will be used. The + * duplicate MPI communicator is freed when the object is + * destructed, or freeMPICommunicator() is called. + * + * @pre samrai_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull + */ + void + setSAMRAI_MPI( + const tbox::SAMRAI_MPI& samrai_mpi); + + /*! + * @brief Free the internal MPI communicator, if any has been set. + * + * This is automatically done by the destructor, if needed. + * + * @see setSAMRAI_MPI(). + */ + void + freeMPICommunicator(); + + /*! + * @copydoc LoadBalanceStrategy::loadBalanceBoxLevel() + * + * @pre !balance_to_anchor || balance_to_anchor->hasTranspose() + * @pre !balance_to_anchor || balance_to_anchor->isTransposeOf(balance_to_anchor->getTranspose()) + * @pre (d_dim == balance_box_level.getDim()) && + * (d_dim == min_size.getDim()) && (d_dim == max_size.getDim()) && + * (d_dim == domain_box_level.getDim()) && + * (d_dim == bad_interval.getDim()) && (d_dim == cut_factor.getDim()) + * @pre !hierarchy || (d_dim == hierarchy->getDim()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getSize()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getRank()) + */ + void + loadBalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, + const boost::shared_ptr& hierarchy, + const int level_number, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::BoxLevel& domain_box_level, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + const tbox::RankGroup& rank_group = tbox::RankGroup()) const; + + /*! + * @brief Write out statistics recorded for the most recent load + * balancing result. + * + * @param[in] output_stream + */ + void + printStatistics( + std::ostream& output_stream = tbox::plog) const; + + /*! + * @brief Get the name of this object. + */ + const std::string& + getObjectName() const + { + return d_object_name; + } + + /*! + * @brief Configure the load balancer to use the data stored + * in the hierarchy at the specified descriptor index + * for estimating the workload on each cell. + * + * @param data_id + * Integer value of patch data identifier for workload + * estimate on each cell. An invalid value (i.e., < 0) + * indicates that a spatially-uniform work estimate + * will be used. The default value is -1 (undefined) + * implying the uniform work estimate. + * + * @param level_number + * Optional integer number for level on which data id + * is used. If no value is given, the data will be + * used for all levels. + * + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(data_id) is actually a boost::shared_ptr > + */ + void + setWorkloadPatchDataIndex( + int data_id, + int level_number = -1); + + /*! + * @brief Return true if load balancing procedure for given level + * depends on patch data on mesh; otherwise return false. + * + * @param[in] level_number Integer patch level number. + */ + bool + getLoadBalanceDependsOnPatchData( + int level_number) const; + +private: + typedef double LoadType; + + /* + * Static integer constants. Tags are for isolating messages + * from different phases of the algorithm. + */ + static const int CascadePartitioner_LOADTAG0 = 1; + static const int CascadePartitioner_LOADTAG1 = 2; + static const int CascadePartitioner_FIRSTDATALEN = 500; + + // The following are not implemented, but are provided here for + // dumb compilers. + + CascadePartitioner( + const CascadePartitioner&); + + void + operator = ( + const CascadePartitioner&); + + /* + * @brief Check if there is any pending messages for the private + * communication and throw an error if there is. + */ + void + assertNoMessageForPrivateCommunicator() const; + + /* + * Read parameters from input database. + */ + void + getFromInput( + const boost::shared_ptr& input_db); + + /* + * Utility functions to determine parameter values for level. + */ + int + getWorkloadDataId( + int level_number) const + { + TBOX_ASSERT(level_number >= 0); + return level_number < static_cast(d_workload_data_id.size()) ? + d_workload_data_id[level_number] : + d_master_workload_data_id; + } + + /* + * Count the local workload. + */ + LoadType + computeLocalLoad( + const hier::BoxLevel& box_level) const; + + /* + * Compute the workload for the level based on a work function. + */ + LoadType + computeNonUniformWorkLoad( + const hier::PatchLevel& patch_level) const; + + /*! + * *@brief Implements the cascade partitioner algorithm. + */ + void + partitionByCascade( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_reference, + bool use_vouchers = false) const; + + /*! + * @brief Update Connectors balance_box_level<==>reference. + */ + void + updateConnectors() const; + + /*! + * @brief Determine globally reduced work parameters. + */ + void + globalWorkReduction( + LoadType local_work, + bool has_any_load) const; + + //! @brief Compute log-base-2 of integer, rounded up. + static int + lgInt( + int s); + + /*! + * @brief Set up timers for the object. + */ + void + setTimers(); + + /* + * CascadePartitioner and CascadePartitionerTree are tightly + * coupled. CascadePartitioner has the common parts of the data + * and algorithm. CascadePartitionerTree has the group-specific + * parts. CascadePartitionerTree can be made a private subclass + * of CascadePartitioner, but that would make a big file. + */ + friend class CascadePartitionerTree; + + /* + * Object dimension. + */ + const tbox::Dimension d_dim; + + /* + * String identifier for load balancer object. + */ + std::string d_object_name; + + //! @brief Duplicated communicator object. See setSAMRAI_MPI(). + mutable tbox::SAMRAI_MPI d_mpi; + + //! @brief Whether d_mpi is an internal duplicate. See setSAMRAI_MPI(). + bool d_mpi_is_dupe; + + /* + * Values for workload estimate data, workload factor, and bin pack method + * used on individual levels when specified as such. + */ + std::vector d_workload_data_id; + + int d_master_workload_data_id; + + /*! + * @brief Tile size, when restricting cuts to tile boundaries, + * Set to 1 when not restricting. + */ + hier::IntVector d_tile_size; + + /*! + * @brief Max number of processes the a single process may spread + * load before updating Connectors. + */ + int d_max_spread_procs; + + /*! + * @brief Whether to limit what a process can give to its surplus. + */ + bool d_limit_supply_to_surplus; + + /*! + * @brief Whether to reset load obligations within groups that + * cannot change its load average. + * + * This option helps reduce imbalances but makes imbalances + * caused by bugs more difficult to find. + * + * See input parameter "DEV_reset_obligations". + */ + bool d_reset_obligations; + + /*! + * @brief Fraction of ideal load a process can accept over and above + * the ideal. + * + * See input parameter "flexible_load_tolerance". + */ + double d_flexible_load_tol; + + /*! + * @brief Boolean to determine whether to use vouchers for transferring load. + */ + bool d_use_vouchers; + + /*! + * @brief Metadata operations with timers set according to this object. + */ + hier::MappingConnectorAlgorithm d_mca; + + /*! + * @brief Level holding workload data + */ + mutable boost::shared_ptr d_workload_level; + + //@{ + //! @name Shared temporaries, used only when actively partitioning. + mutable hier::BoxLevel* d_balance_box_level; + mutable hier::Connector* d_balance_to_reference; + mutable boost::shared_ptr d_pparams; + mutable LoadType d_global_work_sum; + mutable LoadType d_global_work_avg; + mutable LoadType d_local_work_max; + mutable LoadType d_min_load; + mutable size_t d_num_initial_owners; + + //! @brief Local load subject to change. + mutable TransitLoad* d_local_load; + //! @brief Load shipment for sending and receiving. + mutable TransitLoad* d_shipment; + //! @brief High-level communication stage. + mutable tbox::AsyncCommStage d_comm_stage; + //! @brief High-level peer-to-peer communication object (2 receives, 2 sends). + mutable tbox::AsyncCommPeer d_comm_peer[4]; + //@} + + static const int s_default_data_id; + + //@{ + //! @name Used for evaluating peformance. + + bool d_barrier_before; + bool d_barrier_after; + + /*! + * @brief Whether to immediately report the results of the load + * balancing cycles in the log files. + */ + bool d_report_load_balance; + + /*! + * @brief See "summarize_map" input parameter. + */ + char d_summarize_map; + + /* + * Performance timers. + */ + boost::shared_ptr t_load_balance_box_level; + boost::shared_ptr t_assign_to_local_and_populate_maps; + boost::shared_ptr t_use_map; + boost::shared_ptr t_communication_wait; + boost::shared_ptr t_distribute_load; + boost::shared_ptr t_update_connectors; + boost::shared_ptr t_global_work_reduction; + boost::shared_ptr t_combine_children; + boost::shared_ptr t_balance_children; + boost::shared_ptr t_supply_work; + boost::shared_ptr t_send_shipment; + boost::shared_ptr t_receive_and_unpack_supplied_load; + + //@} + + // Extra checks independent of optimization/debug. + char d_print_steps; + char d_print_child_steps; + char d_check_connectivity; + char d_check_map; + + mutable std::vector d_load_stat; + mutable std::vector d_box_count_stat; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.C new file mode 100644 index 00000000..6d914c13 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.C @@ -0,0 +1,804 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using tree algorithm. + * + ************************************************************************/ + +#ifndef included_mesh_CascadePartitionerTree_C +#define included_mesh_CascadePartitionerTree_C + +#include "SAMRAI/mesh/CascadePartitionerTree.h" +#include "SAMRAI/mesh/CascadePartitioner.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +/* + * Construct the tree for the given CascadePartitioner by constructing + * the root and recursively constructing its children. + * + * Only children relevant to local process is actually constructed. + * These are the groups containing the local processes and their + * sibling groups. + */ +CascadePartitionerTree::CascadePartitionerTree( + const CascadePartitioner& partitioner): + d_common(&partitioner), + d_gen_num(0), + + d_begin(0), + d_end(partitioner.d_mpi.getSize()), + + d_parent(0), + d_near(0), + d_far(0), + d_leaf(0), + + d_work(partitioner.d_local_load->getSumLoad()), + d_obligation(d_common->d_global_work_avg * d_common->d_mpi.getSize()), + d_group_may_supply(false) +{ + d_children[0] = d_children[1] = 0; + d_contact[0] = d_contact[1] = -1; + d_process_may_supply[0] = d_process_may_supply[1] = false; + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::root constructor: entered generation " + << d_gen_num << " ranks " << d_begin << '-' << d_end << std::endl; + } + + makeChildren(); + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::root constructor: leaving" << std::endl; + printClassData(tbox::plog, "\t"); + } +} + +/* + * Construct a child group. Child group has either the lower half or + * the upper half of the parent group, indicated by group_position. + * If parent group has odd number of processes, the extra process is + * placed in the upper group. + * + * Assign contacts by pairing this process with the process having the + * same relative rank in the sibling group. If upper group has an + * extra rank, pair it with the last rank in lower group (giving last + * rank in lower group two contacts). + */ +CascadePartitionerTree::CascadePartitionerTree( + CascadePartitionerTree& parent, + Position group_position): + d_common(parent.d_common), + d_gen_num(1 + parent.d_gen_num), + + d_begin(parent.d_begin), + d_end(parent.d_end), + + d_parent(&parent), + d_near(0), + d_far(0), + d_leaf(0), + + d_work(-1.0), + d_obligation(-1.0), + d_group_may_supply(false) +{ + if (d_common->d_print_steps && d_common->d_print_child_steps) { + tbox::plog << d_common->d_object_name << "::non-root constructor: entered generation " + << d_gen_num << " parent ranks " << d_begin << '-' << d_end + << " position " << group_position << std::endl; + } + + d_children[0] = d_children[1] = 0; + d_contact[0] = d_contact[1] = -1; + d_process_may_supply[0] = d_process_may_supply[1] = false; + + const int upper_begin = (d_parent->d_begin + d_parent->d_end) / 2; + + if (group_position == Lower) { + d_end = upper_begin; + const int relative_rank = d_common->d_mpi.getRank() - d_parent->d_begin; + d_contact[0] = relative_rank + upper_begin; + + if ((d_parent->d_end - d_parent->d_begin) % 2 && + d_common->d_mpi.getRank() == upper_begin - 1) { + d_contact[1] = 1 + d_contact[0]; + } + } else { + d_begin = upper_begin; + const int relative_rank = d_common->d_mpi.getRank() - upper_begin; + d_contact[0] = tbox::MathUtilities::Min( + relative_rank + d_parent->d_begin, upper_begin - 1); + } + + d_obligation = d_common->d_global_work_avg * (d_end - d_begin); + + if (containsRank(d_common->d_mpi.getRank())) { + makeChildren(); + } + + if (d_common->d_print_steps && d_common->d_print_child_steps) { + tbox::plog << d_common->d_object_name << "::non-root constructor: leaving" << std::endl; + printClassData(tbox::plog, "\t"); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +CascadePartitionerTree::makeChildren() +{ + if (size() > 1) { + + d_children[0] = new CascadePartitionerTree(*this, Lower); + d_children[1] = new CascadePartitionerTree(*this, Upper); + + const bool in_upper_branch = d_children[1]->containsRank(d_common->d_mpi.getRank()); + d_near = d_children[in_upper_branch]; + d_far = d_children[!in_upper_branch]; + + d_leaf = d_near->d_leaf; + } else { + if (d_begin == d_common->d_mpi.getRank()) { + d_leaf = this; + } + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +CascadePartitionerTree::~CascadePartitionerTree() +{ + if (d_children[0]) delete d_children[0]; + if (d_children[1]) delete d_children[1]; + d_children[0] = 0; + d_children[1] = 0; + d_near = 0; + d_far = 0; + d_leaf = 0; + d_common = 0; +} + +/* + ************************************************************************* + * This method contains the looping structure required to balance all + * groups. The outer loop (top_group) cycles from the largest group + * to the smallest, balancing the two halves of each group. The inner + * loop (current_group) cycles from the leaf to the current top_group, + * combining groups to build a sufficient global picture of top_group, + * then balance its two halves. + ************************************************************************* + */ +void CascadePartitionerTree::distributeLoad() +{ + d_common->t_distribute_load->start(); + + const double connector_update_interval = computeConnectorUpdateInterval(); + + const int tree_depth = CascadePartitioner::lgInt(d_common->d_mpi.getSize()); + + CascadePartitionerTree* top_group = this; + + for (int top_gen_number = 0; top_gen_number < tree_depth; ++top_gen_number) { + + /* + * This block combines and balances child branches. Each time through: + * - Compute group weight by combining descendant group weights. + * - Reset obligations of processes based on group weight. + * - Balance the two children group. + * + * For certain top groups, update Connectors. All nodes must + * participate in updating Connectors (or the step will hang + * when diagnostic barriers are used). + */ + TBOX_ASSERT(top_group->d_gen_num == top_gen_number); + + if (top_group != d_leaf) { + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::distributeLoad balancing outer top_group " + << top_group->d_gen_num + << " with exact local_load=" << d_common->d_local_load->getSumLoad() + << std::endl; + tbox::plog << "\ttop_group:" << std::endl; + top_group->printClassData(tbox::plog, "\t"); + tbox::plog << "\tchild 0:" << std::endl; + top_group->d_children[0]->printClassData(tbox::plog, "\t"); + tbox::plog << "\tchild 1:" << std::endl; + top_group->d_children[1]->printClassData(tbox::plog, "\t"); + } + + d_leaf->recomputeLeafData(); + + /* + * Loop from leaf's parent toward current_group, combining + * group weights. + */ + for ( CascadePartitionerTree *current_group = d_leaf->d_parent; + current_group != 0 && current_group->d_near != top_group; + current_group = current_group->d_parent ) { + + current_group->combineChildren(); + if (d_common->d_print_steps && d_common->d_print_child_steps) { + tbox::plog << d_common->d_object_name << "::distributeLoad outer top_group " + << top_group->d_gen_num << " combined generation " + << current_group->d_gen_num << ". All d_work values are exact." + << std::endl; + tbox::plog << "\tcurrent_group:" << std::endl; + current_group->printClassData(tbox::plog, "\t"); + tbox::plog << "\tchild 0:" << std::endl; + current_group->d_children[0]->printClassData(tbox::plog, "\t"); + tbox::plog << "\tchild 1:" << std::endl; + current_group->d_children[1]->printClassData(tbox::plog, "\t"); + } + + } // Inner loop, current_group + + /* + * Non-root groups may have average weights different than the + * global average. Reset the obligation to the group average + * if option is on. + */ + if ( d_common->d_reset_obligations && top_group->d_gen_num != 0 ) { + const double old_obligation = top_group->d_obligation; + top_group->resetObligation( top_group->d_work/static_cast(top_group->size()) ); + if ( d_common->d_print_steps ) { + tbox::plog << d_common->d_object_name << "::distributeLoad generation " + << top_group->d_gen_num << " reset obligation from " + << old_obligation << " to " << top_group->d_obligation + << std::endl; + } + } + + /* + * Balance between children of the top_group. + */ + top_group->balanceChildren(); + if ( d_common->d_print_steps ) { + tbox::plog << d_common->d_object_name << "::distributeLoad outer top_group " + << top_group->d_gen_num << " shuffled generation " + << top_group->d_gen_num << ". d_work is exact, but childrens' are estimates." + << std::endl; + tbox::plog << "\ttop_group:" << std::endl; + top_group->printClassData( tbox::plog, "\t" ); + tbox::plog << "\tchild 0:" << std::endl; + top_group->d_children[0]->printClassData( tbox::plog, "\t" ); + tbox::plog << "\tchild 1:" << std::endl; + top_group->d_children[1]->printClassData( tbox::plog, "\t" ); + } + + if ( d_common->d_print_steps ) { + tbox::plog << d_common->d_object_name << "::distributeLoad completed inner loop for generation " + << top_group->d_gen_num << std::endl; + } + + } + + /* + * Update Connectors at appropriate intervals or if this is the + * last time through the loop. + */ + if ( static_cast(top_gen_number/connector_update_interval) != + static_cast((top_gen_number+1)/connector_update_interval) || + (top_gen_number == tree_depth-2 && !d_common->d_pparams->usingVouchers()) ) { + if ( d_common->d_print_steps ) { + tbox::plog << d_common->d_object_name << "::distributeLoad updating Connectors after balancing generation " + << top_group->d_gen_num << std::endl; + } + d_common->t_distribute_load->stop(); + d_common->updateConnectors(); + d_common->t_distribute_load->start(); + if (top_group != d_leaf->d_parent) { + d_common->d_local_load->insertAllWithExistingLoads( + d_common->d_balance_box_level->getBoxes()); + } + } + + top_group = top_group->d_near; + + } // Outer loop, top_group + + d_common->t_distribute_load->stop(); +} + +/* + ************************************************************************* + * Combine near and far children data (using communication) to compute + * work-related data for this group. Update work-related values in + * this group and its far child. + * + * After combining children, d_work, d_near->d_work and d_far->d_work + * are exact. d_near->d_work and d_far->d_work remain exact until + * balanceChildren(), when we just estimate transfers by remote ranks + * in this group. d_work remains exact longer--until the next bigger + * group calls balanceChildren(). + * + * NOTE: This method can probably be re-organized as if there's only + * one contact. We only need to exchange data with the second contact + * if the the far group may supply and the near group has a deficit. + ************************************************************************* + */ +void +CascadePartitionerTree::combineChildren() +{ + d_common->t_combine_children->start(); + + tbox::MessageStream send_msg; + send_msg << d_near->d_work << d_near->d_group_may_supply << d_near->d_process_may_supply[0]; + + for (int i = 0; i < 2; ++i) { + if (d_near->d_contact[i] >= 0) { + + d_common->d_comm_peer[i].setPeerRank(d_near->d_contact[i]); + d_common->d_comm_peer[i].setMPITag(CascadePartitionerTree_TAG_InfoExchange0, + CascadePartitionerTree_TAG_InfoExchange1); + d_common->d_comm_peer[i].limitFirstDataLength(send_msg.getCurrentSize()); + d_common->d_comm_peer[i].beginRecv(true); + + d_common->d_comm_peer[2 + i].setPeerRank(d_near->d_contact[i]); + d_common->d_comm_peer[2 + i].setMPITag(CascadePartitionerTree_TAG_InfoExchange0, + CascadePartitionerTree_TAG_InfoExchange1); + d_common->d_comm_peer[2 + i].limitFirstDataLength(send_msg.getCurrentSize()); + d_common->d_comm_peer[2 + i].beginSend(static_cast(send_msg.getBufferStart()), + static_cast(send_msg.getCurrentSize()), true); + + } + } + + d_far->d_work = 0.0; + d_far->d_group_may_supply = true; + while (d_common->d_comm_stage.numberOfCompletedMembers() > 0 || + d_common->d_comm_stage.advanceAny()) { + + tbox::AsyncCommPeer* completed = static_cast *>( + d_common->d_comm_stage.popCompletionQueue()); + + const int i = static_cast(completed - d_common->d_comm_peer); + TBOX_ASSERT(i >= 0 && i < 4); + if (i < 2) { + // This was a receive. + tbox::MessageStream recv_msg(completed->getRecvSize(), + tbox::MessageStream::Read, + completed->getRecvData(), + false); + recv_msg >> d_far->d_work >> d_far->d_group_may_supply >> d_far->d_process_may_supply[i]; + } + } + TBOX_ASSERT(d_common->d_comm_stage.numberOfPendingMembers() == 0); + + d_work = d_children[0]->d_work + d_children[1]->d_work; + d_group_may_supply = estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol(); + + // If process still may supply for near child, it may supply for this group. + d_process_may_supply[0] = d_near->d_process_may_supply[0]; + + d_common->t_combine_children->stop(); +} + +/* + ************************************************************************* + * If one child has a positive surplus and the other has a negative + * surplus, the former supplies work to the latter. Amount supplied + * is ideally the minimum of the supplier's surplus and the + * requestor's deficit. (Actual ammounts are affected by load cutting + * restrictions.) Note that only children groups will be balanced + * (not all descendents). + * + * This method records estimates of the work changes to the groups it + * knows about. It doesn't record the actual work changes because + * that happens remotely. Each process in the supply group send a + * message received by its contact(s) on the requesting group. The + * messages has the actual work to be transfered. + * + * Note: This method balances only the children groups (the lower + * child and upper), not all descendents. To balance the near grand + * child, call d_near->balanceChildren(). + ************************************************************************* + */ +void +CascadePartitionerTree::balanceChildren() +{ + d_common->t_balance_children->start(); + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren: entered" << std::endl; + } + + TBOX_ASSERT(d_common->d_shipment->empty()); + + if (d_near->estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol() && + d_far->estimatedSurplus() < -d_common->d_pparams->getLoadComparisonTol()) { + // Outgoing work, from near child to far child. + + if (d_near->d_process_may_supply[0]) { + + d_common->t_supply_work->start(); + double work_supplied = d_near->supplyWork(-d_far->estimatedSurplus(), d_near->d_contact[0]); + d_common->t_supply_work->stop(); + + // Record work taken by the far child. + d_far->d_work += work_supplied; + d_far->d_group_may_supply = d_far->d_process_may_supply[0] = + d_far->d_process_may_supply[1] = false; + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren:" + << " record outgoing shipment of " << work_supplied + << " from our half to far half. Send to " << d_near->d_contact[0] + << std::endl; + } + + TBOX_ASSERT(d_near->d_contact[0] >= 0); + sendShipment(d_near->d_contact[0]); // If 2 contacts in far group, send to the first one only. + } + } else if (d_far->estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol() && + d_near->estimatedSurplus() < -d_common->d_pparams->getLoadComparisonTol()) { + // Incoming work, from far child to near child. + + /* + * Even when a group may supply, it will not supply to a + * redundant_demand. It will supply to its first contact + * everything it wants to send to the group. A redundant_demand + * is one from the second contact in the same group. Local + * demand is redundant if the near group is bigger than the far + * group and local process is the last rank in its group. + */ + const bool redundant_demand = d_near->size() > d_far->size() && + d_common->d_mpi.getRank() == d_end - 1; + + if (d_far->d_group_may_supply && !redundant_demand) { + if (d_far->d_process_may_supply[0]) { + d_common->d_comm_peer[0].setPeerRank(d_near->d_contact[0]); + d_common->d_comm_peer[0].setMPITag(CascadePartitionerTree_TAG_LoadTransfer0, + CascadePartitionerTree_TAG_LoadTransfer1); + d_common->d_comm_peer[0].beginRecv(true); + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren:" + << " expecting shipment from first contact " << d_near->d_contact[0] + << " redundant_demand=" << redundant_demand + << " d_near->size()=" << d_near->size() + << " d_far->size()=" << d_far->size() + << " d_end=" << d_end + << " d_common->d_mpi.getRank()=" << d_common->d_mpi.getRank() + << std::endl; + } + } + if (d_far->d_process_may_supply[1]) { + d_common->d_comm_peer[1].setPeerRank(d_near->d_contact[1]); + d_common->d_comm_peer[1].setMPITag(CascadePartitionerTree_TAG_LoadTransfer0, + CascadePartitionerTree_TAG_LoadTransfer1); + d_common->d_comm_peer[1].beginRecv(true); + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren:" + << " expecting shipment from second contact " << d_near->d_contact[1] + << " redundant_demand=" << redundant_demand + << " d_near->size()=" << d_near->size() + << " d_far->size()=" << d_far->size() + << " d_end=" << d_end + << " d_common->d_mpi.getRank()=" << d_common->d_mpi.getRank() + << std::endl; + } + } + } + + d_common->t_supply_work->start(); + double work_supplied = d_far->supplyWork(-d_near->estimatedSurplus(), d_common->d_mpi.getRank()); + d_common->t_supply_work->stop(); + + // Record work taken by near child group. + d_near->d_work += work_supplied; + d_near->d_group_may_supply = d_near->d_process_may_supply[0] = false; + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren:" + << " recorded incoming shipment of " << work_supplied + << " from far half to our half." << std::endl; + } + + if (d_far->d_process_may_supply[0] || d_far->d_process_may_supply[1]) { + receiveAndUnpackSuppliedLoad(); + } + } else { + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name + << "::balanceChildren: not supplying or demanding" << std::endl; + } + } + + // Complete the load send, if there was any. + d_common->d_comm_stage.advanceAll(); + while (d_common->d_comm_stage.numberOfCompletedMembers() > 0) { + d_common->d_comm_stage.popCompletionQueue(); + } + + d_common->t_balance_children->stop(); + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::balanceChildren: leaving" << std::endl; + } +} + +/* + ************************************************************************* + * Supply work_requested to another group requesting work. Any load + * supplied by local process will be sent to the designated taker, a + * process in the requesting group. Give priority to supplies closest + * to the taker in rank space. + * + * 1. If this is a leaf, remove load from d_common->d_local_load + * and put it in d_common->d_shipment. + * 2. Else: + * A: Remove load from the child group closer to the taker. + * B: If step A didn't supply enough, remove some from the other child. + * + * This method recurses into descendent groups, estimating changes + * needed to supply the work_requested. Estimation is necessary + * because most of the changes take place remotely. If the recursion + * reaches the leaf group containing the local process, it sets aside + * the work that the local process supplies. + ************************************************************************* + */ +double +CascadePartitionerTree::supplyWork(double work_requested, int taker) +{ + TBOX_ASSERT(work_requested > 0.0); + TBOX_ASSERT(!containsRank(taker)); + TBOX_ASSERT(containsRank(d_common->d_mpi.getRank()) || d_children[0] == 0); // Only near groups should store children. + TBOX_ASSERT(d_group_may_supply == + (estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol())); + + if (d_common->d_print_steps && d_common->d_print_child_steps) { + tbox::plog << d_common->d_object_name << "::supplyWork generation " + << d_gen_num << " [" << d_begin << ',' << d_end << ')' + << " attempting to supply " << work_requested << " to " << taker + << std::endl; + } + + double est_work_supplied = 0.0; // Estimate of work supplied by this group. + + if (d_group_may_supply) { + + const double allowed_supply = tbox::MathUtilities::Min( + work_requested, d_common->d_limit_supply_to_surplus ? estimatedSurplus() : d_work); + TBOX_ASSERT(allowed_supply >= 0.0); + + if (d_children[0] != 0) { + // This is a near group but not a leaf: Recursively supply load from children. + const int priority = taker >= d_begin; + est_work_supplied = d_children[priority]->supplyWork(allowed_supply, taker); + if (est_work_supplied < allowed_supply) { + est_work_supplied += + d_children[!priority]->supplyWork(allowed_supply - est_work_supplied, taker); + } + } else { + // This is a leaf and/or a far group. No children, and no recursion. + est_work_supplied = allowed_supply; + + if (containsRank(d_common->d_mpi.getRank())) { + // This is a near leaf group: apportion the load shipment. + TBOX_ASSERT(size() == 1); + const double tolerance = d_common->d_flexible_load_tol * d_common->d_global_work_avg; + d_common->d_shipment->adjustLoad( + *d_common->d_local_load, + est_work_supplied, + est_work_supplied - tolerance, + est_work_supplied + tolerance); + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::supplyWork giving to " << taker << ": "; + d_common->d_shipment->recursivePrint(); + tbox::plog << d_common->d_object_name << "::supplyWork keeping: "; + d_common->d_local_load->recursivePrint(); + if (d_common->d_shipment->getSumLoad() > est_work_supplied + tolerance || + d_common->d_shipment->getSumLoad() < est_work_supplied - tolerance) { + tbox::plog << " shipment missed range: target shipment " + << d_common->d_shipment->getSumLoad() << " / " << est_work_supplied + << " [" << est_work_supplied - tolerance << ',' + << est_work_supplied + tolerance << "] by " + << d_common->d_shipment->getSumLoad() - est_work_supplied + << " units. kept: " + << d_common->d_local_load->getSumLoad() + << std::endl; + } + } + + d_process_may_supply[0] = + d_common->d_local_load->getSumLoad() - d_obligation > + d_common->d_pparams->getLoadComparisonTol(); + } + } + + d_group_may_supply = estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol(); + + d_work -= est_work_supplied; + + } // d_group_may_supply + + if (d_common->d_print_steps && d_common->d_print_child_steps) { + tbox::plog << d_common->d_object_name << "::supplyWork generation " + << d_gen_num << " [" << d_begin << ',' << d_end << ')' + << " supplied estimated " << est_work_supplied << " to " << taker + << std::endl; + } + return est_work_supplied; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +CascadePartitionerTree::sendShipment(int taker) +{ + d_common->t_send_shipment->start(); + + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::sendMyShipment: sending to " << taker << ' '; + d_common->d_shipment->recursivePrint(tbox::plog, "", 0); + tbox::plog << " leaving d_local_load with "; + d_common->d_local_load->recursivePrint(tbox::plog, "", 0); + tbox::plog << std::endl; + } + tbox::MessageStream msg; + msg << *d_common->d_shipment; + d_common->d_comm_peer[0].setPeerRank(taker); + d_common->d_comm_peer[0].setMPITag(CascadePartitionerTree_TAG_LoadTransfer0, + CascadePartitionerTree_TAG_LoadTransfer1); + d_common->d_comm_peer[0].beginSend(static_cast(msg.getBufferStart()), + static_cast(msg.getCurrentSize()), true); + d_common->d_shipment->clear(); + + d_common->t_send_shipment->stop(); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +CascadePartitionerTree::receiveAndUnpackSuppliedLoad() +{ + d_common->t_receive_and_unpack_supplied_load->start(); + + while (d_common->d_comm_stage.numberOfCompletedMembers() > 0 || + d_common->d_comm_stage.advanceAny()) { + tbox::AsyncCommStage::Member* completed = d_common->d_comm_stage.popCompletionQueue(); + tbox::AsyncCommPeer* comm_peer = static_cast *>(completed); + tbox::MessageStream recv_msg(comm_peer->getRecvSize(), + tbox::MessageStream::Read, + comm_peer->getRecvData(), + true); + recv_msg >> *d_common->d_shipment; + d_common->d_local_load->insertAll(*d_common->d_shipment); + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::receiveAndUnpackSuppliedLoad: received "; + d_common->d_shipment->recursivePrint(tbox::plog, "", 0); + tbox::plog << " from process " << comm_peer->getPeerRank() + << " and updated d_local_load to "; + d_common->d_local_load->recursivePrint(tbox::plog, "", 0); + tbox::plog << std::endl; + } + d_common->d_shipment->clear(); + } + + d_common->t_receive_and_unpack_supplied_load->stop(); +} + +/* + ************************************************************************* + * Should only be called for leaves. For bigger groups, communication + * is required and is determined as part of work exchange. + ************************************************************************* + */ +void +CascadePartitionerTree::recomputeLeafData() +{ + TBOX_ASSERT(this == d_leaf); // Should only be called for leaves. + d_work = d_common->d_local_load->getSumLoad(); + d_group_may_supply = d_process_may_supply[0] = + estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol(); +} + +/* + ************************************************************************* + * Reset the obligation of this group and its descendents based on the + * given avg_load. + * + * This method is needed after a group balances its children, and the + * children are stuck with their load, which may be higher than the + * global average. Because we are stuck with this work, we try to + * distribute it evenly rather than have one process absorb all the + * extra work. + ************************************************************************* + */ +void +CascadePartitionerTree::resetObligation(double avg_load) +{ + d_obligation = avg_load * static_cast(size()); + d_group_may_supply = estimatedSurplus() > d_common->d_pparams->getLoadComparisonTol(); + + if (d_children[0]) { + d_children[0]->resetObligation(avg_load); + d_children[1]->resetObligation(avg_load); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +double +CascadePartitionerTree::computeConnectorUpdateInterval() const +{ + const double fanout_size = d_common->d_global_work_avg > + d_common->d_pparams->getLoadComparisonTol() ? + d_common->d_local_work_max / d_common->d_global_work_avg : 1.0; + const int number_of_updates = + static_cast(ceil(log(fanout_size) / log(static_cast(d_common->d_max_spread_procs)))); + const int tree_depth = CascadePartitioner::lgInt(d_common->d_mpi.getSize()); + const double update_interval = static_cast(tree_depth) / number_of_updates; + if (d_common->d_print_steps) { + tbox::plog << d_common->d_object_name << "::computeConnectorUpdateInterval" + << " max_spread_procs=" << d_common->d_max_spread_procs + << " fanout_size=" << fanout_size + << " number_of_updates=" << number_of_updates + << " update_interval=" << update_interval + << std::endl; + } + return update_interval; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +CascadePartitionerTree::printClassData(std::ostream& co, const std::string& border) const +{ + const std::string indent(border + std::string(d_gen_num, ' ') + std::string(d_gen_num, ' ')); + const int cycle_num = CascadePartitioner::lgInt(d_common->d_mpi.getSize()) - d_gen_num; + co << indent << "gen_num=" << d_gen_num << " cycle=" << cycle_num + << " [" << d_begin << ',' << d_end << ") group_size=" << d_end - d_begin + << " local leaf=" << (this == d_leaf) << " this=" << this + << " near=" << d_near << " far=" << d_far + << '\n' << indent + << "contact=" << d_contact[0] << ',' << d_contact[1] + << " work=" << d_work << '/' << d_obligation << " (" << size() * d_common->d_global_work_avg + << ") estimated surplus=" << estimatedSurplus() + << " (" << d_work - (size() * d_common->d_global_work_avg) + << ") local_load=" << d_common->d_local_load->getSumLoad() + << '\n' << indent + << "group_may_supply=" << d_group_may_supply + << " process_may_supply=" << d_process_may_supply[0] << ',' << d_process_may_supply[1] + << '\n'; +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.h new file mode 100644 index 00000000..45986673 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/CascadePartitionerTree.h @@ -0,0 +1,262 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using a "cascade" algorithm. + * + ************************************************************************/ + +#ifndef included_mesh_CascadePartitionerTree +#define included_mesh_CascadePartitionerTree + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/mesh/PartitioningParams.h" +#include "SAMRAI/mesh/TransitLoad.h" +#include "SAMRAI/tbox/AsyncCommPeer.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/Utilities.h" +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace mesh { + +class CascadePartitioner; + +/*! + * @brief A binary-tree of process groups in the CascadePartitioner + * algorithm. This class is used internally in the CascadePartioner + * class. It should not be used otherwise. + * + * In cascade partitioner, the MPI ranks are recursively split into + * groups, forming the nodes of a binary tree. The root branch + * contains all ranks. The leaves are single-process groups. Each + * group is represented by a CascadePartitionerTree. + * + * @b Terminology: The root group includes all ranks. It splits into + * lower and upper groups (also called branches). The lower branch + * has the lower ranks. If the group has an odd number of ranks, the + * upper branch has one rank more than the lower. The branch + * containing the local process is also known as the "near branch"; + * the one not containing the local process is the "far branch". + */ +class CascadePartitionerTree +{ + +public: + /*! + * @brief Construct the tree for the given CascadePartitioner by + * constructing the root and recursively constructing its children. + */ + CascadePartitionerTree( + const CascadePartitioner& partitioner); + + ~CascadePartitionerTree(); + + /*! + * @brief Distribute the load using the cascade algorithm. + */ + void + distributeLoad(); + + void + printClassData( + std::ostream& co, + const std::string& border) const; + + //! @brief Generation number (generation 0 contains all ranks). + int generationNum() const { + return d_gen_num; + } + + //! @brief Size of group (number of processes in it). + size_t size() const { + return d_end - d_begin; + } + + //! @brief Whether group contains a given rank. + bool containsRank(int rank) const { + return d_begin <= rank && rank < d_end; + } + +private: + //! @brief Where a group falls in the next larger group. + enum Position { Lower = 0, Upper = 1 }; + + /* + * Static integer constants. Tags are for distinguishing messages + * from different phases of the algorithm. + */ + static const int CascadePartitionerTree_TAG_InfoExchange0 = 1000; + static const int CascadePartitionerTree_TAG_InfoExchange1 = 1001; + static const int CascadePartitionerTree_TAG_LoadTransfer0 = 1002; + static const int CascadePartitionerTree_TAG_LoadTransfer1 = 1003; + + /*! + * @brief Construct child node based on its position in the parent. + * + * @param parent + * @param group_position Position of this group in its parent. + */ + CascadePartitionerTree( + CascadePartitionerTree& parent, + Position group_position); + + /*! + * @brief Allocate and set up the group's children, if any. + */ + void + makeChildren(); + + /*! + * @brief Combine near and far data for children group to compute + * work-related data for this group. + */ + void + combineChildren(); + + /*! + * @brief Improve balance of the children of this group by + * supplying load from overloaded child to underloaded child. + */ + void + balanceChildren(); + + //! @brief Estimated surplus of the group. + double estimatedSurplus() const { + return d_work - d_obligation; + } + + /*! + * @brief Try to supply the requested amount of work by removing + * it from this group, and return the (estimated) amount supplied. + * + * The return value is an estimate of the supplied work, because + * the group almost always contains remote ranks whose exact + * actions are not known. Single-process groups set aside any work + * it personally gives up. + * + * @param work_requested + * + * @param taker Representative of the group getting this work. + * + * @return Estimate of the amount supplied based on available work + * and assuming perfect load cutting. + */ + double + supplyWork( + double work_requested, + int taker); + + void + sendShipment( + int taker); + void + receiveAndUnpackSuppliedLoad(); + + //! @brief Recompute work-related data for a leaf group. + void + recomputeLeafData(); + + /*! + * @brief Reset obligation recursively for all descendents, based + * on given average load. + */ + void + resetObligation( + double avg_load); + + /*! + * @brief Compute interval for updating Connector during load + * distribution. + */ + double + computeConnectorUpdateInterval() const; + + //! @brief Data the main CascadePartitioner shares with all parts of the tree. + const CascadePartitioner* d_common; + + //@{ + //! @brief Group specification + + //! @brief Generation number. (Generation 0 contains all ranks.) + int d_gen_num; + + //! @brief First rank in group. + int d_begin; + + //! @brief One past last rank in group. + int d_end; + + /*! + * @brief Rank of contacts in sibling branch. + * + * Communication between sibling groups occurs between processes in + * one group and their respective contacts in the sibling group. + * + * Most processes have just one contact in the sibling group. The + * only processes to have 2 contacts are in the lower sibling of a + * parent that has an odd number of ranks. In these cases, the + * upper sibling has one more rank than the lower. The last rank + * of the lower sibling contacts the last 2 ranks in the upper. + */ + int d_contact[2]; + + //! @brief Parent group. + CascadePartitionerTree* d_parent; + + /*! + * @brief Lower and upper children branches. + * + * Children are allocated iff this is a near group and not a leaf. + */ + CascadePartitionerTree* d_children[2]; + + //! @brief Near child branch (branch containing local process). + CascadePartitionerTree* d_near; + + //! @brief Far child branch (branch not containing local process). + CascadePartitionerTree* d_far; + + //! @brief Group containing just the local process. + CascadePartitionerTree* d_leaf; + + //@} + + //@{ + //! @name Work measures + + //! @brief Estimated or actual amount of work in this branch. + double d_work; + + //! @brief Amount of work the group obligated to have. + double d_obligation; + + //@} + + //@{ + //! @name For determining participation in certain group activities. + + //! @brief Whether this group may supply work to its sibling. + bool d_group_may_supply; + + /*! + * @brief Whether local process (if this is a near group) or + * contact processes (if this is a far group) may supply load. + * + * If this is a near group, first value specifies whether the local + * process may supply work and second value is unused. If this is + * a far group, the two values correspond to whether the two + * contacts (d_contact) may supply work. + */ + bool d_process_may_supply[2]; + + //@} + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.C index b3b321c0..266ffd96 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Load balance routines for uniform and non-uniform workloads. * ************************************************************************/ - -#ifndef included_mesh_ChopAndPackLoadBalancer_C -#define included_mesh_ChopAndPackLoadBalancer_C - #define ChopAndPackLoadBalancer_MARKLOADFORPOSTPROCESSING #include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" @@ -27,14 +23,13 @@ #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/xfer/RefineAlgorithm.h" #include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" #include #include #include @@ -42,21 +37,6 @@ namespace SAMRAI { namespace mesh { -tbox::StartupShutdownManager::Handler -ChopAndPackLoadBalancer::s_initialize_handler( - ChopAndPackLoadBalancer::initializeCallback, - 0, - 0, - ChopAndPackLoadBalancer::finalizeCallback, - tbox::StartupShutdownManager::priorityTimers); - -boost::shared_ptr ChopAndPackLoadBalancer::t_load_balance_boxes; -boost::shared_ptr ChopAndPackLoadBalancer::t_load_balance_boxes_remove_intersection; -boost::shared_ptr ChopAndPackLoadBalancer::t_bin_pack_boxes; -boost::shared_ptr ChopAndPackLoadBalancer::t_bin_pack_boxes_sort; -boost::shared_ptr ChopAndPackLoadBalancer::t_bin_pack_boxes_pack; -boost::shared_ptr ChopAndPackLoadBalancer::t_chop_boxes; - /* ************************************************************************* * @@ -77,16 +57,12 @@ ChopAndPackLoadBalancer::ChopAndPackLoadBalancer( d_master_workload_data_id(-1), d_master_max_workload_factor(1.0), d_master_workload_tolerance(0.0), - d_master_bin_pack_method("SPATIAL") + d_master_bin_pack_method("SPATIAL"), + d_tile_size(dim, 1) { TBOX_ASSERT(!name.empty()); - - d_workload_data_id.resizeArray(0); - d_max_workload_factor.resizeArray(0); - d_workload_tolerance.resizeArray(0); - d_bin_pack_method.resizeArray(0); - getFromInput(input_db); + setupTimers(); } ChopAndPackLoadBalancer::ChopAndPackLoadBalancer( @@ -96,21 +72,16 @@ ChopAndPackLoadBalancer::ChopAndPackLoadBalancer( d_object_name("ChopAndPackLoadBalancer"), d_processor_layout_specified(false), d_processor_layout(hier::IntVector::getZero(d_dim)), + d_ignore_level_box_union_is_single_box(false), d_master_workload_data_id(-1), d_master_max_workload_factor(1.0), d_master_workload_tolerance(0.0), - d_master_bin_pack_method("SPATIAL") + d_master_bin_pack_method("SPATIAL"), + d_tile_size(dim, 1) { - - d_workload_data_id.resizeArray(0); - d_max_workload_factor.resizeArray(0); - d_workload_tolerance.resizeArray(0); - d_bin_pack_method.resizeArray(0); - - d_ignore_level_box_union_is_single_box = false; - getFromInput(input_db); + setupTimers(); } ChopAndPackLoadBalancer::~ChopAndPackLoadBalancer() @@ -139,18 +110,17 @@ ChopAndPackLoadBalancer::setMaxWorkloadFactor( { TBOX_ASSERT(factor > 0.0); if (level_number >= 0) { - int asize = d_max_workload_factor.getSize(); + int asize = static_cast(d_max_workload_factor.size()); if (asize < level_number + 1) { - d_max_workload_factor.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_max_workload_factor[i] = - d_master_max_workload_factor; + d_max_workload_factor.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { + d_max_workload_factor[i] = d_master_max_workload_factor; } d_max_workload_factor[level_number] = factor; } } else { d_master_max_workload_factor = factor; - for (int ln = 0; ln < d_max_workload_factor.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_max_workload_factor.size()); ++ln) { d_max_workload_factor[ln] = d_master_max_workload_factor; } } @@ -163,18 +133,17 @@ ChopAndPackLoadBalancer::setWorkloadTolerance( { TBOX_ASSERT(tolerance > 0.0); if (level_number >= 0) { - int asize = d_workload_tolerance.getSize(); + int asize = static_cast(d_workload_tolerance.size()); if (asize < level_number + 1) { - d_workload_tolerance.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_workload_tolerance[i] = - d_master_workload_tolerance; + d_workload_tolerance.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { + d_workload_tolerance[i] = d_master_workload_tolerance; } d_workload_tolerance[level_number] = tolerance; } } else { d_master_workload_tolerance = tolerance; - for (int ln = 0; ln < d_workload_tolerance.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_workload_tolerance.size()); ++ln) { d_workload_tolerance[ln] = d_master_workload_tolerance; } } @@ -185,31 +154,24 @@ ChopAndPackLoadBalancer::setWorkloadPatchDataIndex( int data_id, int level_number) { - boost::shared_ptr > datafact( - hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> - getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); - if (!datafact) { - TBOX_ERROR( - d_object_name << " error: " - << "\n data_id " << data_id << " passed to " - << "setWorkloadPatchDataIndex()" - << " does not refer to cell-centered double patch data. " << std::endl); - } + boost::shared_ptr > datafact( + BOOST_CAST, hier::PatchDataFactory>( + hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> + getPatchDataFactory(data_id))); + TBOX_ASSERT(datafact); if (level_number >= 0) { - int asize = d_workload_data_id.getSize(); + int asize = static_cast(d_workload_data_id.size()); if (asize < level_number + 1) { - d_workload_data_id.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_workload_data_id[i] = - d_master_workload_data_id; + d_workload_data_id.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { + d_workload_data_id[i] = d_master_workload_data_id; } d_workload_data_id[level_number] = data_id; } } else { d_master_workload_data_id = data_id; - for (int ln = 0; ln < d_workload_data_id.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_workload_data_id.size()); ++ln) { d_workload_data_id[ln] = d_master_workload_data_id; } } @@ -220,18 +182,17 @@ ChopAndPackLoadBalancer::setUniformWorkload( int level_number) { if (level_number >= 0) { - int asize = d_workload_data_id.getSize(); + int asize = static_cast(d_workload_data_id.size()); if (asize < level_number + 1) { - d_workload_data_id.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_workload_data_id[i] = - d_master_workload_data_id; + d_workload_data_id.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { + d_workload_data_id[i] = d_master_workload_data_id; } d_workload_data_id[level_number] = -1; } } else { d_master_workload_data_id = -1; - for (int ln = 0; ln < d_workload_data_id.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_workload_data_id.size()); ++ln) { d_workload_data_id[ln] = d_master_workload_data_id; } } @@ -255,17 +216,17 @@ ChopAndPackLoadBalancer::setBinPackMethod( } if (level_number >= 0) { - int asize = d_bin_pack_method.getSize(); + int asize = static_cast(d_bin_pack_method.size()); if (asize < level_number + 1) { - d_bin_pack_method.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { + d_bin_pack_method.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { d_bin_pack_method[i] = d_master_bin_pack_method; } d_bin_pack_method[level_number] = method; } } else { d_master_bin_pack_method = method; - for (int ln = 0; ln < d_bin_pack_method.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_bin_pack_method.size()); ++ln) { d_bin_pack_method[ln] = d_master_bin_pack_method; } } @@ -277,31 +238,29 @@ ChopAndPackLoadBalancer::setBinPackMethod( */ void ChopAndPackLoadBalancer::loadBalanceBoxLevel( - hier::BoxLevel& balance_mapped_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, const boost::shared_ptr& hierarchy, const int level_number, - const hier::Connector& balance_to_attractor, - const hier::Connector& attractor_to_balance, const hier::IntVector& min_size, const hier::IntVector& max_size, - const hier::BoxLevel& domain_mapped_box_level, + const hier::BoxLevel& domain_box_level, const hier::IntVector& bad_interval, const hier::IntVector& cut_factor, const tbox::RankGroup& rank_group) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS6(d_dim, - balance_mapped_box_level, + TBOX_ASSERT(!balance_to_anchor || balance_to_anchor->hasTranspose()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY6(d_dim, + balance_box_level, min_size, max_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor); - NULL_USE(balance_to_attractor); - NULL_USE(attractor_to_balance); NULL_USE(rank_group); + t_load_balance_box_level->start(); + hier::IntVector actual_max_size = max_size; for (int d = 0; d < d_dim.getValue(); ++d) { if (actual_max_size(d) < 0) { @@ -309,21 +268,38 @@ ChopAndPackLoadBalancer::loadBalanceBoxLevel( } } - hier::BoxLevel globalized_input_mapped_box_level( - balance_mapped_box_level); - globalized_input_mapped_box_level.setParallelState( - hier::BoxLevel::GLOBALIZED); + const size_t nblocks = balance_box_level.getGridGeometry()->getNumberBlocks(); + + // Set effective_cut_factor to least common multiple of cut_factor and d_tile_size. + hier::IntVector effective_cut_factor(cut_factor, nblocks); + if (d_tile_size != hier::IntVector::getOne(d_dim)) { + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + while (effective_cut_factor(b,d) / d_tile_size[d] * d_tile_size[d] != + effective_cut_factor(b,d)) { + effective_cut_factor(b,d) += cut_factor[d]; + } + } + } + } + + t_get_global_boxes->barrierAndStart(); + hier::BoxLevel globalized_input_box_level(balance_box_level); + globalized_input_box_level.setParallelState(hier::BoxLevel::GLOBALIZED); + t_get_global_boxes->stop(); hier::BoxContainer in_boxes; - const hier::BoxContainer globalized_input_mapped_boxes( - globalized_input_mapped_box_level.getGlobalBoxes()); - for (hier::RealBoxConstIterator bi(globalized_input_mapped_boxes.realBegin()); - bi != globalized_input_mapped_boxes.realEnd(); ++bi) { + const hier::BoxContainer globalized_input_boxes( + globalized_input_box_level.getGlobalBoxes()); + for (hier::RealBoxConstIterator bi(globalized_input_boxes.realBegin()); + bi != globalized_input_boxes.realEnd(); ++bi) { in_boxes.pushBack(*bi); } + + hier::BoxContainer physical_domain; - domain_mapped_box_level.getGlobalBoxes(physical_domain); + domain_box_level.getGlobalBoxes(physical_domain); hier::BoxContainer out_boxes; hier::ProcessorMapping mapping; @@ -335,35 +311,43 @@ ChopAndPackLoadBalancer::loadBalanceBoxLevel( hierarchy, level_number, physical_domain, - balance_mapped_box_level.getRefinementRatio(), + balance_box_level.getRefinementRatio(), min_size, actual_max_size, - cut_factor, + effective_cut_factor, bad_interval); - // Build up balance_mapped_box_level from old-style data. - balance_mapped_box_level.initialize( - balance_mapped_box_level.getRefinementRatio(), - balance_mapped_box_level.getGridGeometry(), - balance_mapped_box_level.getMPI(), + // Build up balance_box_level from old-style data. + balance_box_level.initialize( + hier::BoxContainer(), + balance_box_level.getRefinementRatio(), + balance_box_level.getGridGeometry(), + balance_box_level.getMPI(), hier::BoxLevel::GLOBALIZED); int i = 0; - for (hier::BoxContainer::iterator itr(out_boxes); + for (hier::BoxContainer::iterator itr = out_boxes.begin(); itr != out_boxes.end(); ++itr, ++i) { hier::Box node(*itr, hier::LocalId(i), mapping.getProcessorAssignment(i)); - balance_mapped_box_level.addBox(node); + balance_box_level.addBox(node); } - // Reinitialize Connectors due to changed balance_mapped_box_level. - balance_to_anchor.clearNeighborhoods(); - balance_to_anchor.setBase(balance_mapped_box_level, true); - anchor_to_balance.clearNeighborhoods(); - anchor_to_balance.setHead(balance_mapped_box_level, true); - hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(balance_to_anchor); - oca.findOverlaps(anchor_to_balance, balance_mapped_box_level); - - balance_mapped_box_level.setParallelState(hier::BoxLevel::DISTRIBUTED); + // Reinitialize Connectors due to changed balance_box_level. + if (balance_to_anchor) { + hier::Connector& anchor_to_balance = balance_to_anchor->getTranspose(); + balance_to_anchor->clearNeighborhoods(); + balance_to_anchor->setBase(balance_box_level, true); + anchor_to_balance.clearNeighborhoods(); + anchor_to_balance.setHead(balance_box_level, true); + hier::OverlapConnectorAlgorithm oca; + oca.findOverlaps(*balance_to_anchor); + oca.findOverlaps(anchor_to_balance, balance_box_level); + balance_to_anchor->removePeriodicRelationships(); + anchor_to_balance.removePeriodicRelationships(); + } + + balance_box_level.setParallelState(hier::BoxLevel::DISTRIBUTED); + + t_load_balance_box_level->stop(); } /* @@ -434,7 +418,7 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( { t_load_balance_boxes->start(); - TBOX_DIM_ASSERT_CHECK_ARGS5(ratio_to_hierarchy_level_zero, + TBOX_ASSERT_OBJDIM_EQUALITY5(ratio_to_hierarchy_level_zero, min_size, max_size, cut_factor, @@ -442,17 +426,17 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( TBOX_ASSERT(hierarchy); TBOX_ASSERT(level_number >= 0); - TBOX_ASSERT(physical_domain.size() > 0); + TBOX_ASSERT(!physical_domain.empty()); TBOX_ASSERT(min_size > hier::IntVector::getZero(d_dim)); TBOX_ASSERT(max_size >= min_size); - TBOX_ASSERT(cut_factor > hier::IntVector::getZero(d_dim)); + TBOX_ASSERT(cut_factor > hier::IntVector(d_dim,0)); TBOX_ASSERT(bad_interval >= hier::IntVector::getZero(d_dim)); /* * This method assumes in_boxes is not empty and will fail * if it is. So shortcut it for empty in_boxes. */ - if (in_boxes.isEmpty()) { + if (in_boxes.empty()) { out_boxes = hier::BoxContainer(); return; } @@ -471,18 +455,19 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( int wrk_indx = getWorkloadDataId(level_number); - tbox::Array workloads; + std::vector workloads; if ((wrk_indx < 0) || (hierarchy->getNumberOfLevels() == 0)) { - if (!d_ignore_level_box_union_is_single_box) { + if (!d_ignore_level_box_union_is_single_box && + hierarchy->getGridGeometry()->getNumberBlocks() == 1) { hier::Box bbox = in_boxes.getBoundingBox(); hier::BoxContainer difference(bbox); t_load_balance_boxes_remove_intersection->start(); difference.removeIntersections(in_boxes); t_load_balance_boxes_remove_intersection->stop(); - if (difference.isEmpty()) { + if (difference.empty()) { t_chop_boxes->start(); chopUniformSingleBox(out_boxes, @@ -557,7 +542,7 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( */ #ifdef DEBUG_CHECK_ASSERTIONS const int nboxes = out_boxes.size(); - for (hier::BoxContainer::iterator ib(out_boxes); + for (hier::BoxContainer::iterator ib = out_boxes.begin(); ib != out_boxes.end(); ++ib) { hier::BoxUtilities::checkBoxConstraints(*ib, min_size, @@ -581,17 +566,32 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( t_load_balance_boxes->stop(); + int my_rank = mpi.getRank(); + std::vector mapping_vec = mapping.getProcessorMapping(); + int global_num_boxes = mapping_vec.size(); + double load = 0.0; + TBOX_ASSERT(workloads.size() == global_num_boxes); + for (int b = 0; b < global_num_boxes; ++b) { + if (mapping_vec[b] == my_rank) { + load += workloads[b]; + } else if (mapping_vec[b] > my_rank) { + break; + } + } + + d_load_stat.push_back(load); + #if 0 /* * For debugging, output load balance statistics * (assuming uniform load). */ - tbox::Array procloads(tbox::SAMRAI_MPI::getNodes()); - for (int i = 0; i < procloads.size(); ++i) { + std::vector procloads(tbox::SAMRAI_MPI::getNodes()); + for (int i = 0; i < static_cast(procloads.size()); ++i) { procloads[i] = 0; } int itrCt = 0; - for (hier::BoxContainer::iterator itr(out_boxes); + for (hier::BoxContainer::iterator itr = out_boxes.begin(); itr != out_boxes.end(); ++itr, ++itrCt) { int p = mapping.getProcessorAssignment(itrCt); procloads[p] += itr->size(); @@ -602,21 +602,22 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( #ifdef ChopAndPackLoadBalancer_MARKLOADFORPOSTPROCESSING // Performance: Output loads for global postprocessing. - const tbox::Array& local_indices = mapping.getLocalIndices(); + const std::vector& local_indices = mapping.getLocalIndices(); double local_load = 0; int local_indices_idx = 0; int idx = 0; - for (hier::BoxContainer::iterator itr(out_boxes); - itr != out_boxes.end() && local_indices_idx < local_indices.size(); + int num_local_indices = static_cast(local_indices.size()); + for (hier::BoxContainer::iterator itr = out_boxes.begin(); + itr != out_boxes.end() && local_indices_idx < num_local_indices; ++itr, ++idx) { if (local_indices[local_indices_idx] == idx) { - local_load += itr->size(); + local_load += static_cast(itr->size()); ++local_indices_idx; } } markLoadForPostprocessing(mpi.getSize(), local_load, - local_indices.size()); + num_local_indices); #endif } @@ -634,7 +635,7 @@ ChopAndPackLoadBalancer::loadBalanceBoxes( void ChopAndPackLoadBalancer::chopUniformSingleBox( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::Box& in_box, const hier::IntVector& min_size, const hier::IntVector& max_size, @@ -644,10 +645,10 @@ ChopAndPackLoadBalancer::chopUniformSingleBox( const tbox::SAMRAI_MPI& mpi) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(min_size, max_size, cut_factor, bad_interval); + TBOX_ASSERT_OBJDIM_EQUALITY4(min_size, max_size, cut_factor, bad_interval); /* - * Determine processor layout that corresponds to box dimensions. + * Determine processor layout that corresponds to box size. */ hier::IntVector processor_distribution(d_dim); @@ -661,14 +662,14 @@ ChopAndPackLoadBalancer::chopUniformSingleBox( } /* - * The ideal box size will be the dimensions of the input box divided + * The ideal box size will be the size of the input box divided * by the number of processors in each direction. Compute this * ideal size and then adjust as necessary to fit within min/max size * constraints. */ hier::IntVector ideal_box_size(d_dim); - for (int i = 0; i < d_dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { ideal_box_size(i) = (int)ceil((double)in_box.numberCells( i) / (double)processor_distribution(i)); @@ -699,9 +700,10 @@ ChopAndPackLoadBalancer::chopUniformSingleBox( out_boxes = tmp_box_list; const int nboxes = out_boxes.size(); - out_workloads.resizeArray(nboxes); + out_workloads.resize(nboxes); int ibCt = 0; - for (hier::BoxContainer::iterator ib(out_boxes); ib != out_boxes.end(); + for (hier::BoxContainer::iterator ib = out_boxes.begin(); + ib != out_boxes.end(); ++ib, ++ibCt) { out_workloads[ibCt] = (double)(ib->size()); } @@ -722,7 +724,7 @@ ChopAndPackLoadBalancer::chopUniformSingleBox( void ChopAndPackLoadBalancer::chopBoxesWithUniformWorkload( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::BoxContainer& in_boxes, const boost::shared_ptr& hierarchy, int level_number, @@ -734,7 +736,7 @@ ChopAndPackLoadBalancer::chopBoxesWithUniformWorkload( const tbox::SAMRAI_MPI& mpi) const { NULL_USE(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS5(d_dim, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY5(d_dim, *hierarchy, min_size, max_size, @@ -760,9 +762,9 @@ ChopAndPackLoadBalancer::chopBoxesWithUniformWorkload( physical_domain); double total_work = 0.0; - for (hier::BoxContainer::iterator ib0(tmp_in_boxes_list); + for (hier::BoxContainer::iterator ib0 = tmp_in_boxes_list.begin(); ib0 != tmp_in_boxes_list.end(); ++ib0) { - total_work += ib0->size(); + total_work += static_cast(ib0->size()); } double work_factor = getMaxWorkloadFactor(level_number); @@ -793,12 +795,12 @@ ChopAndPackLoadBalancer::chopBoxesWithUniformWorkload( out_boxes = tmp_box_list; - out_workloads.resizeArray(out_boxes.size()); + out_workloads.resize(out_boxes.size()); int i = 0; for (std::list::const_iterator il(tmp_work_list.begin()); - il != tmp_work_list.end(); il++) { + il != tmp_work_list.end(); ++il) { out_workloads[i] = *il; - i++; + ++i; } } @@ -817,7 +819,7 @@ ChopAndPackLoadBalancer::chopBoxesWithUniformWorkload( void ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::BoxContainer& in_boxes, const boost::shared_ptr& hierarchy, int level_number, @@ -831,7 +833,7 @@ ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( const tbox::SAMRAI_MPI& mpi) const { - TBOX_DIM_ASSERT_CHECK_ARGS5(ratio_to_hierarchy_level_zero, + TBOX_ASSERT_OBJDIM_EQUALITY5(ratio_to_hierarchy_level_zero, min_size, max_size, cut_factor, @@ -860,12 +862,12 @@ ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( hier::BoxContainer tmp_level_boxes(tmp_in_boxes_list); const int num_tmp_patches = tmp_level_boxes.size(); - tbox::Array tmp_level_workloads(num_tmp_patches); + std::vector tmp_level_workloads(num_tmp_patches); int idx = 0; - for (hier::BoxContainer::iterator i(tmp_level_boxes); + for (hier::BoxContainer::iterator i = tmp_level_boxes.begin(); i != tmp_level_boxes.end(); ++i, ++idx) { - tmp_level_workloads[idx] = i->size(); + tmp_level_workloads[idx] = static_cast(i->size()); } hier::ProcessorMapping tmp_level_mapping; @@ -875,31 +877,42 @@ ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( tmp_level_workloads, "GREEDY"); - boost::shared_ptr tmp_mapped_box_level( + boost::shared_ptr tmp_box_level( boost::make_shared( ratio_to_hierarchy_level_zero, hierarchy->getGridGeometry(), mpi, hier::BoxLevel::GLOBALIZED)); idx = 0; - for (hier::BoxContainer::iterator i(tmp_level_boxes); + for (hier::BoxContainer::iterator i = tmp_level_boxes.begin(); i != tmp_level_boxes.end(); ++i, ++idx) { hier::Box node(*i, hier::LocalId(idx), tmp_level_mapping.getProcessorAssignment(idx)); - tmp_mapped_box_level->addBox(node); + tmp_box_level->addBox(node); } boost::shared_ptr tmp_level( - boost::make_shared(*tmp_mapped_box_level, - hierarchy->getGridGeometry(), - hierarchy->getPatchDescriptor())); + boost::make_shared(*tmp_box_level, + hierarchy->getGridGeometry(), + hierarchy->getPatchDescriptor())); + + const hier::PatchLevel& hiercoarse = + *hierarchy->getPatchLevel(level_number - 1); + + if (level_number != 0) { + tmp_level->findConnectorWithTranspose(hiercoarse, + hierarchy->getRequiredConnectorWidth(level_number, level_number - 1), + hierarchy->getRequiredConnectorWidth(level_number - 1, level_number), + hier::CONNECTOR_CREATE, + true); + } tmp_level->allocatePatchData(wrk_indx); - xfer::RefineAlgorithm fill_work_algorithm(d_dim); + xfer::RefineAlgorithm fill_work_algorithm; boost::shared_ptr work_refine_op( - boost::make_shared(d_dim)); + boost::make_shared()); fill_work_algorithm.registerRefine(wrk_indx, wrk_indx, @@ -966,13 +979,13 @@ ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( hier::BoxContainer local_out_boxes(tmp_box_list); - tbox::Array local_out_workloads(local_out_boxes.size()); + std::vector local_out_workloads(local_out_boxes.size()); int i = 0; for (std::list::const_iterator il(tmp_work_list.begin()); - il != tmp_work_list.end(); il++) { + il != tmp_work_list.end(); ++il) { local_out_workloads[i] = *il; - i++; + ++i; } /* @@ -996,13 +1009,12 @@ ChopAndPackLoadBalancer::chopBoxesWithNonuniformWorkload( void ChopAndPackLoadBalancer::exchangeBoxContainersAndWeightArrays( const hier::BoxContainer& box_list_in, - const tbox::Array& weights_in, + std::vector& weights_in, hier::BoxContainer& box_list_out, - tbox::Array& weights_out, + std::vector& weights_out, const tbox::SAMRAI_MPI& mpi) const { - TBOX_ASSERT(box_list_in.size() == weights_in.getSize()); - + TBOX_ASSERT(box_list_in.size() == static_cast(weights_in.size())); /* * allocate send and receive buffers, and set array sizes @@ -1021,8 +1033,8 @@ ChopAndPackLoadBalancer::exchangeBoxContainersAndWeightArrays( } #endif - int buf_size_in = size_in * d_dim.getValue() * 2; - int buf_size_out = size_out * d_dim.getValue() * 2; + int buf_size_in = size_in * (d_dim.getValue() * 2 + 1); + int buf_size_out = size_out * (d_dim.getValue() * 2 + 1); int curr_box_list_out_size = box_list_out.size(); if (size_out > curr_box_list_out_size) { @@ -1034,35 +1046,36 @@ ChopAndPackLoadBalancer::exchangeBoxContainersAndWeightArrays( box_list_out.popBack(); } } - weights_out.resizeArray(size_out); + weights_out.resize(size_out); - tbox::Array buf_in(buf_size_in); - tbox::Array buf_out(buf_size_out); + std::vector buf_in(buf_size_in); + std::vector buf_out(buf_size_out); - int* buf_in_ptr = (int *)NULL; - int* buf_out_ptr = (int *)NULL; - const double* wgts_in_ptr = (const double *)NULL; - double* wgts_out_ptr = (double *)NULL; + int* buf_in_ptr = 0; + int* buf_out_ptr = 0; + double* wgts_in_ptr = 0; + double* wgts_out_ptr = 0; if (size_in > 0) { - buf_in_ptr = buf_in.getPointer(); - wgts_in_ptr = weights_in.getPointer(); + buf_in_ptr = &buf_in[0]; + wgts_in_ptr = &weights_in[0]; } if (size_out > 0) { - wgts_out_ptr = weights_out.getPointer(); - buf_out_ptr = buf_out.getPointer(); + wgts_out_ptr = &weights_out[0]; + buf_out_ptr = &buf_out[0]; } /* * populate the buffers with data for sending */ int offset = 0; - for (hier::BoxContainer::const_iterator x(box_list_in); + for (hier::BoxContainer::const_iterator x = box_list_in.begin(); x != box_list_in.end(); ++x) { - for (int i = 0; i < d_dim.getValue(); ++i) { + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { buf_in_ptr[offset++] = x->lower(i); buf_in_ptr[offset++] = x->upper(i); } + buf_in_ptr[offset++] = static_cast(x->getBlockId().getBlockValue()); } /* @@ -1077,17 +1090,17 @@ ChopAndPackLoadBalancer::exchangeBoxContainersAndWeightArrays( displs[i] = displs[i - 1] + counts[i - 1]; total_count += counts[i]; } - TBOX_ASSERT(static_cast(weights_out.size()) == total_count); + TBOX_ASSERT(weights_out.size() == total_count); - mpi.Allgatherv((void *)wgts_in_ptr, + mpi.Allgatherv(static_cast(wgts_in_ptr), size_in, - MPI_INT, + MPI_DOUBLE, wgts_out_ptr, &counts[0], &displs[0], - MPI_INT); + MPI_DOUBLE); - const int ints_per_box = d_dim.getValue() * 2; + const int ints_per_box = d_dim.getValue() * 2 + 1; for (size_t i = 0; i < displs.size(); ++i) { counts[i] *= ints_per_box; displs[i] *= ints_per_box; @@ -1098,12 +1111,13 @@ ChopAndPackLoadBalancer::exchangeBoxContainersAndWeightArrays( * assemble the output array of boxes */ offset = 0; - for (hier::BoxContainer::iterator b(box_list_out); + for (hier::BoxContainer::iterator b = box_list_out.begin(); b != box_list_out.end(); ++b) { - for (int j = 0; j < d_dim.getValue(); ++j) { - b->lower(j) = buf_out_ptr[offset++]; - b->upper(j) = buf_out_ptr[offset++]; + for (tbox::Dimension::dir_t j = 0; j < d_dim.getValue(); ++j) { + b->setLower(j, buf_out_ptr[offset++]); + b->setUpper(j, buf_out_ptr[offset++]); } + b->setBlockId(hier::BlockId(buf_out_ptr[offset++])); } } @@ -1140,22 +1154,22 @@ ChopAndPackLoadBalancer::printClassData( int ln; os << "d_workload_data_id..." << std::endl; - for (ln = 0; ln < d_workload_data_id.getSize(); ln++) { + for (ln = 0; ln < static_cast(d_workload_data_id.size()); ++ln) { os << " d_workload_data_id[" << ln << "] = " << d_workload_data_id[ln] << std::endl; } os << "d_max_workload_factor..." << std::endl; - for (ln = 0; ln < d_max_workload_factor.getSize(); ln++) { + for (ln = 0; ln < static_cast(d_max_workload_factor.size()); ++ln) { os << " d_max_workload_factor[" << ln << "] = " << d_max_workload_factor[ln] << std::endl; } os << "d_workload_tolerance..." << std::endl; - for (ln = 0; ln < d_workload_tolerance.getSize(); ln++) { + for (ln = 0; ln < static_cast(d_workload_tolerance.size()); ++ln) { os << " d_workload_tolerance[" << ln << "] = " << d_workload_tolerance[ln] << std::endl; } os << "d_bin_pack_method..." << std::endl; - for (ln = 0; ln < d_bin_pack_method.getSize(); ln++) { + for (ln = 0; ln < static_cast(d_bin_pack_method.size()); ++ln) { os << " d_bin_pack_method[" << ln << "] = " << d_bin_pack_method[ln] << std::endl; } @@ -1174,69 +1188,61 @@ ChopAndPackLoadBalancer::printClassData( void ChopAndPackLoadBalancer::getFromInput( - const boost::shared_ptr& db) + const boost::shared_ptr& input_db) { - if (db) { + if (input_db) { const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); d_master_bin_pack_method = - db->getStringWithDefault("bin_pack_method", - d_master_bin_pack_method); + input_db->getStringWithDefault("bin_pack_method", "SPATIAL"); if (!(d_master_bin_pack_method == "GREEDY" || d_master_bin_pack_method == "SPATIAL")) { - TBOX_WARNING( - d_object_name << ": " - << "Unknown 'bin_pack_method' " - << d_master_bin_pack_method - << " found in input. \nDefault 'GREEDY' will be used." << std::endl); - d_master_bin_pack_method = "GREEDY"; + INPUT_VALUE_ERROR("bin_pack_method"); } - if (db->keyExists("max_workload_factor")) { - d_max_workload_factor = db->getDoubleArray("max_workload_factor"); - for (int i = 0; i < d_max_workload_factor.getSize(); i++) { - if (d_max_workload_factor[i] < 0.0) { - TBOX_ERROR( - d_object_name - << "Max workload values should be greater than 0"); + if (input_db->keyExists("max_workload_factor")) { + d_max_workload_factor = + input_db->getDoubleVector("max_workload_factor"); + for (int i = 0; i < static_cast(d_max_workload_factor.size()); ++i) { + if (!(d_max_workload_factor[i] >= 0)) { + INPUT_RANGE_ERROR("max_workload_factor"); } } // Use last entry in array as value for finer levels d_master_max_workload_factor = - d_max_workload_factor[d_max_workload_factor.getSize() - 1]; + d_max_workload_factor[d_max_workload_factor.size() - 1]; } - if (db->keyExists("workload_tolerance")) { - d_workload_tolerance = db->getDoubleArray("workload_tolerance"); - for (int i = 0; i < d_workload_tolerance.getSize(); i++) { - if (d_workload_tolerance[i] < 0.0 || d_workload_tolerance[i] >= - 1.0) { - TBOX_ERROR( - d_object_name - << "Workload tolerance should be >= 0 and < 1.0"); + if (input_db->keyExists("workload_tolerance")) { + d_workload_tolerance = + input_db->getDoubleVector("workload_tolerance"); + for (int i = 0; i < static_cast(d_workload_tolerance.size()); ++i) { + if (!(d_workload_tolerance[i] >= 0.0 && + d_workload_tolerance[i] < 1.0)) { + INPUT_RANGE_ERROR("workload_tolerance"); } } // Use last entry in array as value for finer levels d_master_workload_tolerance = - d_workload_tolerance[d_workload_tolerance.getSize() - 1]; + d_workload_tolerance[d_workload_tolerance.size() - 1]; } d_ignore_level_box_union_is_single_box = - db->getBoolWithDefault("ignore_level_box_union_is_single_box", - d_ignore_level_box_union_is_single_box); + input_db->getBoolWithDefault("ignore_level_box_union_is_single_box", false); d_processor_layout_specified = false; - int temp_processor_layout[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - if (db->keyExists("processor_layout")) { - db->getIntegerArray("processor_layout", temp_processor_layout, d_dim.getValue()); + int temp_processor_layout[SAMRAI::MAX_DIM_VAL]; + if (input_db->keyExists("processor_layout")) { + input_db->getIntegerArray("processor_layout", + temp_processor_layout, d_dim.getValue()); /* consistency check */ int totprocs = 1; - for (int n = 0; n < d_dim.getValue(); n++) { + for (int n = 0; n < d_dim.getValue(); ++n) { totprocs *= temp_processor_layout[n]; } @@ -1248,16 +1254,22 @@ ChopAndPackLoadBalancer::getFromInput( << "\nbe generated when needed." << std::endl); } else { - for (int n = 0; n < d_dim.getValue(); n++) { + for (int n = 0; n < d_dim.getValue(); ++n) { d_processor_layout(n) = temp_processor_layout[n]; } d_processor_layout_specified = true; } } - d_ignore_level_box_union_is_single_box = - db->getBoolWithDefault("ignore_level_box_union_is_single_box", - d_ignore_level_box_union_is_single_box); + if (input_db->isInteger("tile_size")) { + input_db->getIntegerArray("tile_size", &d_tile_size[0], d_tile_size.getDim().getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_tile_size[i] >= 1)) { + TBOX_ERROR("CascadePartitioner tile_size must be >= 1 in all directions.\n" + << "Input tile_size is " << d_tile_size); + } + } + } } @@ -1276,7 +1288,7 @@ void ChopAndPackLoadBalancer::binPackBoxes( hier::BoxContainer& boxes, hier::ProcessorMapping& mapping, - tbox::Array& workloads, + std::vector& workloads, const std::string& bin_pack_method) const { const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -1299,14 +1311,14 @@ ChopAndPackLoadBalancer::binPackBoxes( t_bin_pack_boxes_pack->start(); if (bin_pack_method == "SPATIAL") { - (void)BalanceUtilities::spatialBinPack(mapping, + BalanceUtilities::spatialBinPack(mapping, workloads, boxes, num_procs); } else if (bin_pack_method == "GREEDY") { - (void)BalanceUtilities::binPack(mapping, + BalanceUtilities::binPack(mapping, workloads, num_procs); @@ -1328,39 +1340,40 @@ ChopAndPackLoadBalancer::binPackBoxes( ************************************************************************* */ void -ChopAndPackLoadBalancer::initializeCallback() +ChopAndPackLoadBalancer::setupTimers() { + t_load_balance_box_level = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::loadBalanceBoxLevel()"); + t_load_balance_boxes = tbox::TimerManager::getManager()-> - getTimer("mesh::ChopAndPackLoadBalancer::loadBalanceBoxes()"); - t_load_balance_boxes_remove_intersection = - tbox::TimerManager::getManager()-> - getTimer( - "mesh::ChopAndPackLoadBalancer::loadBalanceBoxes()_remove_intersection"); + getTimer(d_object_name + "::loadBalanceBoxes()"); + t_load_balance_boxes_remove_intersection = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::loadBalanceBoxes()_remove_intersection"); + t_get_global_boxes = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::get_global_boxes"); t_bin_pack_boxes = tbox::TimerManager::getManager()-> - getTimer("mesh::ChopAndPackLoadBalancer::binPackBoxes()"); + getTimer(d_object_name + "::binPackBoxes()"); t_bin_pack_boxes_sort = tbox::TimerManager::getManager()-> - getTimer("mesh::ChopAndPackLoadBalancer::binPackBoxes()_sort"); + getTimer(d_object_name + "::binPackBoxes()_sort"); t_bin_pack_boxes_pack = tbox::TimerManager::getManager()-> - getTimer("mesh::ChopAndPackLoadBalancer::binPackBoxes()_pack"); + getTimer(d_object_name + "::binPackBoxes()_pack"); t_chop_boxes = tbox::TimerManager::getManager()-> - getTimer("mesh::ChopAndPackLoadBalancer::chop_boxes"); + getTimer(d_object_name + "::chop_boxes"); } -/* - ************************************************************************* - ************************************************************************* - */ void -ChopAndPackLoadBalancer::finalizeCallback() +ChopAndPackLoadBalancer::printStatistics( + std::ostream& output_stream) const { - t_load_balance_boxes.reset(); - t_load_balance_boxes_remove_intersection.reset(); - t_bin_pack_boxes.reset(); - t_bin_pack_boxes_sort.reset(); - t_bin_pack_boxes_pack.reset(); - t_chop_boxes.reset(); + if (d_load_stat.empty()) { + output_stream << "No statistics for ChopAndPackLoadBalancer.\n"; + } else { + BalanceUtilities::reduceAndReportLoadBalance( + d_load_stat, + tbox::SAMRAI_MPI::getSAMRAIWorld(), + output_stream); + } } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.h index a7d1e4af..1c4e0cfc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/ChopAndPackLoadBalancer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Load balance routines for uniform and non-uniform workloads. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace mesh { @@ -39,18 +39,65 @@ namespace mesh { * behavior can be set at run-time via member functions, including * dynamic reconfiguration of balance operations. * - * Required input keys: NONE + * Input Parameters * - * Optional input keys, data types, and defaults: + * Definitions: + * - \b bin_pack_method + * String value indicating the type of bin packing to use to map patches + * to processors. Currently, two options are supported: "GREEDY" and + * "SPATIAL". The "GREEDY" method simply maps each patch (box) to the + * first processor (bin), in ascending tbox::MPI process number, whose + * difference between the average workload and its current workload is + * less than the workload of the patch in question. The "SPATIAL" method + * first constructs an ordering of the patches (boxes) by passing a + * Morton-type curve through the center of each box. Then, it attempts + * to map the patches to processors by assigning patches that are near + * each other on the curve to the same processor. If no input value is + * specified, a default value of "SPATIAL" is used. The input value + * will be used for all levels and will below. * - * - \b processor_layout Integer array (length = DIM) indicating - * the way in which the domain should be chopped when a level can - * be described as a single parallelepiped region (i.e., a box). If - * no input value is provided, or if the product of these entries - * does not equal the number of processors, then the processor - * layout computed will be computed from the dimensions of the - * domain box and the number of processors in use if necessary. + * - \b max_workload_factor + * Double array (length = number of levels) used during the box-splitting + * phase to determine which boxes to split. Specifically, boxes will be + * chopped if their estimated workload is greater than + * max_workload_factor * A, where A is the average workload + * (i.e., A = (total work)/(num processors)). The default value for this + * parameter is 1.0. It can be set to any value greater than zero, + * either in the input file or via the setMaxWorkloadFactor() member + * function below. * + * - \b workload_tolerance + * Double array (length = number of levels) used during the box-splitting + * phase to determine which boxes to split. The tolerance value can be + * use to prevent splitting of boxes when the computed box workload is + * close to the computed ideal workload. A box is split if:
+ * ( box_workload <= ( (1. + workload_tolerance) * ideal_workload ) )
+ * Tolerance values should be greater than or equal to 0.0 and less + * then 1.0. Large values will probably have undesirable results. + * It can be set either in the input file or via the + * setWorkloadTolerance() member function below.
+ * NOTE: If a length is less than max levels then finest value + * specified is use for finer levels. If length is greater + * than max levels, the values are ignored. + * + * - \b ignore_level_box_union_is_single_box + * Boolean flag to control chopping of level boxes when the union of the + * input boxes passed to the loadBalanceBoxes() routine is a single box. + * The default value is false, which means that the domain will be + * chopped to make patch boxes based on the (single box) union of the + * boxes describing the level regardless of the input boxes. When the + * value is set to true, either via the setIgnoreLevelDomainIsSingleBox() + * function or an input file, the domain will be chopped by chopping each + * of the input boxes. + * + * - \b processor_layout + * Integer array (length = DIM) indicating the way in which the domain + * should be chopped when a level can be described as a single + * parallelepiped region (i.e., a box). If no input value is provided, + * or if the product of these entries does not equal the number of + * processors, then the processor layout computed will be computed from + * the size of the domain box and the number of processors in use if + * necessary.
* NOTE: The largest patch size constraint specified in the * input for the GriddingAlgorithm object takes precedence * over the processor layout specification. That is, if the @@ -59,98 +106,85 @@ namespace mesh { * be ignored and boxes obeying the patch size constrint will * result. * - * - \b bin_pack_method String value indicating the type of bin - * packing to use to map patches to processors. Currently, two - * options are supported: "GREEDY", "SPATIAL". The "GREEDY" process - * simply maps each patch (box) to the first processor (bin), in - * ascending tbox::MPI process number, whose difference between the - * average workload and its current workload is less than the - * workload of the patch in question. The "SPATIAL" process first - * constructs an ordering of the patches (boxes) by passing a - * Morton-type curve through the center of each box. Then, it - * attempts to map the patches to processors by assigning patches - * that are near each other on the curve to the same processor. If - * no input value is specified, a default value of "SPATIAL" is - * used. The input value will be used for all levels and will - * remain so until reset via the setBinPackMethod() member function - * below. - * - * - \b max_workload_factor Double array (length = number of - * levels) used during the box-splitting phase to determine which - * boxes to split. Specifically, boxes will be chopped if their - * estimated workload is greater than max_workload_factor * A, - * where A is the average workload (i.e., A = (total work)/(nume - * processors)). The default value for this parameter is 1.0. It - * can be set to any value greater than zero, either in the input - * file or via the setMaxWorkloadFactor() member function below. - * - * Example input: - * - * max_workload_factor = 0.8 - * - * Sets the workload factor to 0.8 for all levels. - * - * max_workload_factor = 0.8 , 0.9 - * - * Sets the workload factor to 0.8 for level 0 and 0.9 for all - * other levels. - * - * NOTE: If a length is less than max levels then finest value - * specified is use for finer levels. If length is greater - * than max levels, the values are ignored. - * - * NOTE: Setting this value > 1.0 increases the splitting - * threshold which effectively reduces the total number of boxes - * generated. Setting it less than 1.0 decreases the splitting - * threshold and will generally increase the total number of - * boxes. - * - * - \b workload_tolerance Double array (length = number of levels) - * used during the box-splitting phase to determine which boxes to - * split. The tolerance value can be use to prevent splitting of - * boxes when the computed box workload is close to the computed - * ideal workload. A box is split if: - * - * ( box_workload <= ( (1. + workload_tolerance) * ideal_workload ) ) - * - * Tolerance values should be greater than or equal to 0.0 and less - * then 1.0. Large values will probably have undesirable results. - * The default value for this parameter is 0.0. It can be set to - * either in the input file or via the setWorkloadTolerance() - * member function below. - * - * NOTE: If a length is less than max levels then finest value - * specified is use for finer levels. If length is greater - * than max levels, the values are ignored. - * - * - \b ignore_level_box_union_is_single_box Boolean flag to - * control chopping of level boxes when the union of the input - * boxes passed to the loadBalanceBoxes() routine is a single box. - * The default value is false, which means that the domain will be - * chopped to make patch boxes based on the (single box) union of - * the boxes describing the level regardless of the input boxes. - * When the value is set to true, either via the - * setIgnoreLevelDomainIsSingleBox() function or an input file, the - * domain will be chopped by chopping each of the input boxes. + * - \b tile_size + * Tile size when using tile mode. Tile mode restricts box cuts + * to tile boundaries. * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
bin_pack_methodstring"SPATIAL""SPATIAL", "GREEDY"optNot written to restart. Value in input db used.
max_workload_factorarray of doublesnone0.0 <= all valuesoptNot written to restart. Value in input db used.
workload_tolerancearray of doublesnone0.0 <= all values < 1.0optNot written to restart. Value in input db used.
ignore_level_box_union_is_single_boxboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
processor_layoutint[]N/AN/AoptNot written to restart. Value in input db used.
tile_sizeIntVector11-optNot written to restart. Value in input db used.
* * A sample input file entry might look like: * - * \verbatim - * + * @code * processor_layout = 4 , 4 , 4 // number of processors is 64 * bin_pack = "GREEDY" * max_workload_factor = 0.9 * ignore_level_box_union_is_single_box = TRUE - * - * \endverbatim + * @endcode * * Performance warning: This class implements a sequential algorithm. * The time it takes to this balancer increases with processor count. * However, you can probably use this load balancer on up to 1K * processors before its performance degrades noticably. * - * @see mesh::LoadBalanceStrategy + * @see LoadBalanceStrategy */ class ChopAndPackLoadBalancer: @@ -168,6 +202,8 @@ class ChopAndPackLoadBalancer: * @param[in] input_db (optional) database pointer providing parameters from * input file. This pointer may be null indicating no * input will be read. + * + * @pre !name.empty() */ ChopAndPackLoadBalancer( const tbox::Dimension& dim, @@ -207,6 +243,8 @@ class ChopAndPackLoadBalancer: * @param level_number Optional integer number for level to which factor * is applied. If no value is given, the factor will * be used for all levels. + * + * @pre factor > 0.0 */ void setMaxWorkloadFactor( @@ -223,6 +261,8 @@ class ChopAndPackLoadBalancer: * @param level_number Optional integer number for level to which factor * is applied. If no value is given, the value will * be used for all levels. + * + * @pre tolerance > 0.0 */ void setWorkloadTolerance( @@ -238,6 +278,8 @@ class ChopAndPackLoadBalancer: * @param level_number Optional integer number for level on which data id * is used. If no value is given, the data will be * used for all levels. + * + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(data_id) is actually a boost::shared_ptr > */ void setWorkloadPatchDataIndex( @@ -268,6 +310,8 @@ class ChopAndPackLoadBalancer: * bin-packing method will be used. If no value is * given, the prescribed methods will be used on all * levels. + * + * @pre (method == "GREEDY") || (method == "SPATIAL") */ void setBinPackMethod( @@ -318,21 +362,18 @@ class ChopAndPackLoadBalancer: * function is pure virtual in the LoadBalanceStrategy base class. * * The load balancing algorithm should ignore any periodic image Boxes - * in the input balance_mapped_box_level. + * in the input balance_box_level. * - * @param balance_mapped_box_level + * @param balance_box_level * @param balance_to_anchor - * @param anchor_to_balance * @param hierarchy Input patch hierarchy in which level will reside. * @param level_number Input integer number of level in patch hierarchy. * This value must be >= 0. - * @param unbalanced_to_attractor - * @param attractor_to_unbalanced - * @param min_size Input integer vector of minimum dimensions for + * @param min_size Input integer vector of minimum sizes for * output boxes. All entries must be > 0. - * @param max_size Input integer vector of maximum dimensions for + * @param max_size Input integer vector of maximum sizes for * output boxes. All entries must be >= min_size. - * @param domain_mapped_box_level + * @param domain_box_level * @param bad_interval Input integer vector used to create boxes near * physical domain boundary with sufficient number * of cells. No box face will be closer to the @@ -348,28 +389,31 @@ class ChopAndPackLoadBalancer: * the domain. All entries must be >= 0. See * hier::BoxUtilities documentation for more details. * @param cut_factor Input integer vector used to create boxes with - * correct dimensions. The length of each box - * dimension will be an integer multiple of the + * correct sizes. The length of each box + * direction will be an integer multiple of the * corresponding cut factor vector entry. All * vector entries must be > 0. See hier::BoxUtilities * documentation for more details. * @param rank_group Needed for compatibility with parent class. * This argument is ignored. + * + * @pre !balance_to_anchor || balance_to_anchor->hasTranspose() + * @pre (d_dim == balance_box_level.getDim()) && + * (d_dim == min_size.getDim()) && (d_dim == max_size.getDim()) && + * (d_dim == domain_box_level.getDim()) && + * (d_dim == bad_interval.getDim()) && (d_dim == cut_factor.getDim()) */ void loadBalanceBoxLevel( - hier::BoxLevel& balance_mapped_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, const boost::shared_ptr& hierarchy, const int level_number, - const hier::Connector& unbalanced_to_attractor, - const hier::Connector& attractor_to_unbalanced, const hier::IntVector& min_size, const hier::IntVector& max_size, - const hier::BoxLevel& domain_mapped_box_level, + const hier::BoxLevel& domain_box_level, const hier::IntVector& bad_interval, - const hier::IntVector& cut_factor, // Default v2.x.x = hier::IntVector::getOne(tbox::Dimension(DIM)) + const hier::IntVector& cut_factor, const tbox::RankGroup& rank_group = tbox::RankGroup()) const; /*! @@ -379,6 +423,10 @@ class ChopAndPackLoadBalancer: printClassData( std::ostream& os) const; + void + printStatistics( + std::ostream& output_stream = tbox::plog) const; + /*! * Returns the name of this object. * @@ -395,7 +443,7 @@ class ChopAndPackLoadBalancer: // dumb compilers. ChopAndPackLoadBalancer( const ChopAndPackLoadBalancer&); - void + ChopAndPackLoadBalancer& operator = ( const ChopAndPackLoadBalancer&); @@ -404,7 +452,7 @@ class ChopAndPackLoadBalancer: */ void getFromInput( - const boost::shared_ptr& db); + const boost::shared_ptr& input_db); /*! * Given a list of boxes, representing the domain of a level in the AMR @@ -426,13 +474,13 @@ class ChopAndPackLoadBalancer: * @param ratio_to_hierarchy_level_zero Input integer vector indicating * ratio between index space of level to load balance * and hierarchy level 0 (i.e., coarsest hierarchy level). - * @param min_size Input integer vector of minimum dimensions for + * @param min_size Input integer vector of minimum sizes for * output boxes. All entries must be > 0. - * @param max_size Input integer vector of maximum dimensions for + * @param max_size Input integer vector of maximum sizes for * output boxes. All entries must be >= min_size. * @param cut_factor Input integer vector used to create boxes with - * correct dimensions. The length of each box - * dimension will be an integer multiple of the + * correct sizes. The length of each box + * direction will be an integer multiple of the * corresponding cut factor vector entry. All * vector entries must be > 0. See hier::BoxUtilities * documentation for more details. @@ -450,6 +498,18 @@ class ChopAndPackLoadBalancer: * will be either in the domain interior or outside * the domain. All entries must be >= 0. See * hier::BoxUtilities documentation for more details. + * + * @pre (ratio_to_hierarchy_level_zero.getDim() == min_size.getDim()) && + * (ratio_to_hierarchy_level_zero.getDim() == max_size.getDim()) && + * (ratio_to_hierarchy_level_zero.getDim() == cut_factor.getDim()) && + * (ratio_to_hierarchy_level_zero.getDim() == bad_interval.getDim()) + * @pre hierarchy + * @pre level_number >= 0 + * @pre !physical_domain.empty() + * @pre min_size > hier::IntVector::getZero(d_dim) + * @pre max_size >= min_size + * @pre cut_factor > hier::IntVector::getZero(d_dim) + * @pre bad_interval >= hier::IntVector::getZero(d_dim) */ void loadBalanceBoxes( @@ -471,7 +531,7 @@ class ChopAndPackLoadBalancer: void chopUniformSingleBox( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::Box& in_box, const hier::IntVector& min_size, const hier::IntVector& max_size, @@ -486,7 +546,7 @@ class ChopAndPackLoadBalancer: void chopBoxesWithUniformWorkload( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::BoxContainer& in_boxes, const boost::shared_ptr& hierarchy, int level_number, @@ -503,7 +563,7 @@ class ChopAndPackLoadBalancer: void chopBoxesWithNonuniformWorkload( hier::BoxContainer& out_boxes, - tbox::Array& out_workloads, + std::vector& out_workloads, const hier::BoxContainer& in_boxes, const boost::shared_ptr& hierarchy, int level_number, @@ -523,7 +583,7 @@ class ChopAndPackLoadBalancer: binPackBoxes( hier::BoxContainer& boxes, hier::ProcessorMapping& mapping, - tbox::Array& workloads, + std::vector& workloads, const std::string& bin_pack_method) const; /*! @@ -535,13 +595,15 @@ class ChopAndPackLoadBalancer: * by all processors, and their associated weights. * If all processors input arrays have zero length, an error * is thrown. + * + * @pre box_list_in.size() == weights_in.size() */ void exchangeBoxContainersAndWeightArrays( const hier::BoxContainer& box_list_in, - const tbox::Array& weights_in, + std::vector& weights_in, hier::BoxContainer& box_list_out, - tbox::Array& weights_out, + std::vector& weights_out, const tbox::SAMRAI_MPI& mpi) const; /* @@ -552,9 +614,9 @@ class ChopAndPackLoadBalancer: int level_number) const { TBOX_ASSERT(level_number >= 0); - return (level_number < d_workload_data_id.getSize() ? - d_workload_data_id[level_number] : - d_master_workload_data_id); + return level_number < static_cast(d_workload_data_id.size()) ? + d_workload_data_id[level_number] : + d_master_workload_data_id; } double @@ -562,9 +624,9 @@ class ChopAndPackLoadBalancer: int level_number) const { TBOX_ASSERT(level_number >= 0); - return (level_number < d_max_workload_factor.getSize() ? - d_max_workload_factor[level_number] : - d_master_max_workload_factor); + return level_number < static_cast(d_max_workload_factor.size()) ? + d_max_workload_factor[level_number] : + d_master_max_workload_factor; } double @@ -572,9 +634,9 @@ class ChopAndPackLoadBalancer: int level_number) const { TBOX_ASSERT(level_number >= 0); - return (level_number < d_workload_tolerance.getSize() ? - d_workload_tolerance[level_number] : - d_master_workload_tolerance); + return level_number < static_cast(d_workload_tolerance.size()) ? + d_workload_tolerance[level_number] : + d_master_workload_tolerance; } std::string @@ -582,26 +644,16 @@ class ChopAndPackLoadBalancer: int level_number) const { TBOX_ASSERT(level_number >= 0); - return (level_number < d_bin_pack_method.getSize() ? - d_bin_pack_method[level_number] : - d_master_bin_pack_method); + return level_number < static_cast(d_bin_pack_method.size()) ? + d_bin_pack_method[level_number] : + d_master_bin_pack_method; } /*! - * @brief Initialize static objects and register shutdown routine. - * - * Only called by StartupShutdownManager. - */ - static void - initializeCallback(); - - /*! - * @brief Method registered with ShutdownRegister to cleanup statics. - * - * Only called by StartupShutdownManager. + * @brief Set up timers. */ - static void - finalizeCallback(); + void + setupTimers(); /* * Object dimension. @@ -638,29 +690,32 @@ class ChopAndPackLoadBalancer: * Values for workload estimate data, workload factor, and bin pack method * used on individual levels when specified as such. */ - tbox::Array d_workload_data_id; - tbox::Array d_max_workload_factor; - tbox::Array d_workload_tolerance; - tbox::Array d_bin_pack_method; + std::vector d_workload_data_id; + std::vector d_max_workload_factor; + std::vector d_workload_tolerance; + std::vector d_bin_pack_method; bool d_opt_for_single_box; - /* - * Performance timers. + /*! + * @brief Tile size, when restricting cuts to tile boundaries, + * Set to 1 when not restricting. */ - static boost::shared_ptr t_load_balance_boxes; - static boost::shared_ptr t_load_balance_boxes_remove_intersection; - static boost::shared_ptr t_bin_pack_boxes; - static boost::shared_ptr t_bin_pack_boxes_sort; - static boost::shared_ptr t_bin_pack_boxes_pack; - static boost::shared_ptr t_chop_boxes; + hier::IntVector d_tile_size; + + mutable std::vector d_load_stat; /* - * Static initialization and cleanup handler. + * Performance timers. */ - - static tbox::StartupShutdownManager::Handler - s_initialize_handler; + boost::shared_ptr t_load_balance_box_level; + boost::shared_ptr t_load_balance_boxes; + boost::shared_ptr t_load_balance_boxes_remove_intersection; + boost::shared_ptr t_get_global_boxes; + boost::shared_ptr t_bin_pack_boxes; + boost::shared_ptr t_bin_pack_boxes_sort; + boost::shared_ptr t_bin_pack_boxes_pack; + boost::shared_ptr t_chop_boxes; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.C new file mode 100644 index 00000000..ae80156a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.C @@ -0,0 +1,1100 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using tree algorithm. + * + ************************************************************************/ +#include "SAMRAI/mesh/GraphLoadBalancer.h" + +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/BoxUtilities.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" + +#ifdef HAVE_PTSCOTCH +#include "ptscotch.h" +#endif + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +/* + ************************************************************************* + * GraphLoadBalancer constructor. + ************************************************************************* + */ + +GraphLoadBalancer::GraphLoadBalancer( + const tbox::Dimension& dim, + const std::string& name, + const boost::shared_ptr& input_db): + d_dim(dim), + d_object_name(name), + d_target_box_size(dim, 0), + d_coalesce_boxes(true), + d_tile_size(dim, 1), + d_min_size(dim), + d_cut_factor(dim), + d_bad_interval(dim) +{ +#ifndef HAVE_PTSCOTCH + TBOX_WARNING( + "SAMRAI configured without PT-Scotch. GraphLoadBalancer will not repartition boxes."); +#endif + + TBOX_ASSERT(!name.empty()); + getFromInput(input_db); + +} + +GraphLoadBalancer::~GraphLoadBalancer() +{ +} + +/* + ************************************************************************* + * Load balance and redistribute the level + ************************************************************************* + */ + +void +GraphLoadBalancer::loadBalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, + const boost::shared_ptr& hierarchy, + const int level_number, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::BoxLevel& domain_box_level, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + const tbox::RankGroup& rank_group) const +{ + NULL_USE(rank_group); + + // Set effective_cut_factor to least common multiple of cut_factor and d_tile_size. + hier::IntVector effective_cut_factor = cut_factor; + if ( d_tile_size != hier::IntVector::getOne(d_dim) ) { + const size_t nblocks = hierarchy->getGridGeometry()->getNumberBlocks(); + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for ( unsigned int d=0; dgetNumberBlocks(); + d_block_domain_boxes.resize(nblocks); + + if (nblocks == 1) { + domain_box_level.getGlobalBoxes(d_block_domain_boxes[0]); + d_block_domain_boxes[0].refine(balance_box_level.getRefinementRatio()); + } else { + for (int b = 0; b < nblocks; ++b) { + d_block_domain_boxes[b] = hier::BoxContainer( + domain_box_level.getGlobalBoxes(), hier::BlockId(b)); + + d_block_domain_boxes[b].refine(balance_box_level.getRefinementRatio()); + } + } + + /* + * Periodic image Box should be ignored during load balancing + * because they have no real work. The load-balanced results + * should contain no periodic images. + * + * To avoid need for special logic to skip periodic images while + * load balancing, we just remove periodic images in the + * balance_box_level and all periodic edges in + * anchor<==>balance. + */ + + balance_box_level.removePeriodicImageBoxes(); + if (balance_to_anchor) { + + balance_to_anchor->getTranspose().removePeriodicRelationships(); + balance_to_anchor->getTranspose().setHead(balance_box_level, true); + + balance_to_anchor->removePeriodicRelationships(); + balance_to_anchor->setBase(balance_box_level, true); + + } + + hier::Connector& anchor_to_balance = balance_to_anchor->getTranspose(); + + SCOTCH_Dgraph* graph = SCOTCH_dgraphAlloc(); + SCOTCH_dgraphInit(graph, balance_box_level.getMPI().getCommunicator()); + + const tbox::Dimension& dim = balance_box_level.getDim(); + + boost::shared_ptr balance_to_balance; + + int dont_do_graph = 0; + + const hier::BoxContainer& boxes = balance_box_level.getBoxes(); + const tbox::SAMRAI_MPI& my_mpi = balance_box_level.getMPI(); + + hier::IntVector target_size(dim); + + if (d_target_box_size == hier::IntVector::getZero(dim)) { + /* + * Heuristic to choose a target box size if none was given in + * input. + */ + for (int d = 0; d < dim.getValue(); ++d) { + std::set choices; + + choices.insert(min_size(d) * min_size(d)); + choices.insert(max_size(d) / 2); + choices.insert((min_size(d) + max_size(d)) / 2); + + std::set::iterator med_itr = choices.begin(); + ++med_itr; + target_size(d) = *med_itr; + } + } else { + target_size = d_target_box_size; + } + + for (int d = 0; d < dim.getValue(); ++d) { + if (target_size(d) > max_size(d)) target_size(d) = max_size(d); + if (target_size(d) < min_size(d)) target_size(d) = min_size(d); + } + + /* + * Chop boxes to be at or under target size. + */ + chopBoxes(balance_box_level, &anchor_to_balance, target_size); + + const hier::MappingConnectorAlgorithm mca; + + /* + * PT-Scotch requires globally sequenced LocalId values + */ + renumberBoxes(balance_box_level, + anchor_to_balance, + mca); + + const hier::OverlapConnectorAlgorithm oca; + + /* + * The balance_to_balance Connector describes adjacency within the + * level. The connector width should be nonzero if this load balancer + * is called from GriddingAlgorithm. If called from non-standard contexts, + * the non-scalable findOverlaps method may be called. + */ + if (balance_to_anchor->getConnectorWidth() > hier::IntVector::getZero(dim)) { + oca.bridgeWithNesting( + balance_to_balance, + *balance_to_anchor, + anchor_to_balance, + hier::IntVector::getZero(dim), + hier::IntVector::getZero(dim), + hier::IntVector::getOne(dim), + false); + } else { + balance_to_balance.reset(new hier::Connector(dim)); + balance_to_balance->clearNeighborhoods(); + balance_to_balance->setBase(balance_box_level); + balance_to_balance->setHead(balance_box_level); + balance_to_balance->setWidth(hier::IntVector::getOne(dim), true); + + oca.findOverlaps(*balance_to_balance); + } + + std::map has_nabrs; + for (hier::BoxContainer::const_iterator bi = boxes.begin(); + bi != boxes.end(); ++bi) { + const hier::BoxId& box_id = bi->getBoxId(); + + if (balance_to_balance->hasNeighborSet(box_id)) { + hier::Connector::ConstNeighborhoodIterator nh = + balance_to_balance->findLocal(box_id); + + bool has_non_trivial = false; + + for (hier::Connector::ConstNeighborIterator na = balance_to_balance->begin(nh); + na != balance_to_balance->end(nh); ++na) { + if (na->getBoxId() != box_id) { + has_non_trivial = true; + break; + } + } + + if (!has_non_trivial) { + has_nabrs[box_id] = false; + } else { + has_nabrs[box_id] = true; + } + + } else { + has_nabrs[box_id] = false; + } + } + + std::vector edgeloctab; + std::vector edloloctab; + std::vector vertloctab; + std::vector veloloctab; + std::vector vendloctab; + std::vector extra_nabrs; + + vertloctab.push_back(0); + + if (!boxes.empty()) { + const hier::BoxId& back_id = boxes.back().getBoxId(); + + for (hier::Connector::ConstNeighborhoodIterator ei = balance_to_balance->begin(); + ei != balance_to_balance->end(); ++ei) { + const hier::BoxId& box_id = *ei; + const hier::Box& box = *balance_box_level.getBox(box_id); + hier::Box node_box(box); + node_box.upper() += hier::IntVector::getOne(dim); + if (has_nabrs[box_id]) { + /* + * If the box has neighbors, create graph edges to the neighbors. + */ + for (hier::Connector::ConstNeighborIterator na = balance_to_balance->begin(ei); + na != balance_to_balance->end(ei); ++na) { + const hier::Box& nbr_box = *na; + if (nbr_box.getBoxId() != box_id) { + const hier::LocalId& local_id = nbr_box.getLocalId(); + edgeloctab.push_back(local_id.getValue()); + hier::Box node_nbr(nbr_box); + node_nbr.upper() += hier::IntVector::getOne(dim); + SCOTCH_Num edge_wgt = 1; + if (node_box.getBlockId() == node_nbr.getBlockId()) + edge_wgt = (node_box * node_nbr).size(); + edloloctab.push_back(edge_wgt); + } + } + if (box_id == back_id && !extra_nabrs.empty()) { + for (std::vector::const_iterator extra_itr = + extra_nabrs.begin(); extra_itr != extra_nabrs.end(); ++extra_itr) { + edgeloctab.push_back(*extra_itr); + edloloctab.push_back(1); + } + } + } else if (boxes.size() > 1) { + /* + * When the box has no neighbors, arbitrarily create an edge + * to connect it to the graph. + */ + if (back_id != box_id) { + edgeloctab.push_back(back_id.getLocalId().getValue()); + edloloctab.push_back(1); + extra_nabrs.push_back(box_id.getLocalId().getValue()); + } else { + SCOTCH_Num my_id = box_id.getLocalId().getValue(); + edgeloctab.push_back(my_id); + edloloctab.push_back(1); + vertloctab.pop_back(); + vendloctab.pop_back(); + vertloctab.push_back(edgeloctab.size()); + vendloctab.push_back(edgeloctab.size()); + + for (std::vector::const_iterator extra_itr = + extra_nabrs.begin(); extra_itr != extra_nabrs.end(); ++extra_itr) { + if (*extra_itr != my_id - 1) { + edgeloctab.push_back(*extra_itr); + edloloctab.push_back(1); + } + } + + } + } + + vertloctab.push_back(edgeloctab.size()); + vendloctab.push_back(edgeloctab.size()); + veloloctab.push_back(box.size()); + } + } + vertloctab.pop_back(); + if (vertloctab.empty()) { + vertloctab.push_back(0); + } + if (veloloctab.empty()) { + veloloctab.push_back(0); + } + if (vendloctab.empty()) { + vendloctab.push_back(0); + } + int edgelocsize = edgeloctab.size(); + if (edgeloctab.empty()) { + edgeloctab.push_back(0); + } + if (edloloctab.empty()) { + edloloctab.push_back(0); + } + + SCOTCH_Num* vertloc_ptr; + SCOTCH_Num* veloloc_ptr; + SCOTCH_Num* vendloc_ptr; + SCOTCH_Num* edgeloc_ptr; + SCOTCH_Num* edloloc_ptr; + if (!vertloctab.empty()) { + vertloc_ptr = &vertloctab[0]; + } else { + vertloc_ptr = 0; + } + if (!veloloctab.empty()) { + veloloc_ptr = &veloloctab[0]; + } else { + veloloc_ptr = 0; + } + if (!vendloctab.empty()) { + vendloc_ptr = &vendloctab[0]; + } else { + vendloc_ptr = 0; + } + if (!edgeloctab.empty()) { + edgeloc_ptr = &edgeloctab[0]; + } else { + edgeloc_ptr = 0; + } + if (!edloloctab.empty()) { + edloloc_ptr = &edloloctab[0]; + } else { + edloloc_ptr = 0; + } + + SCOTCH_Num baseval = 0; + + int nlocvert = vertloctab.size(); //-1; + if (nlocvert < 0) nlocvert = 0; + if (boxes.empty()) nlocvert = 0; + + SCOTCH_dgraphBuild(graph, + baseval, + nlocvert, + nlocvert, + vertloc_ptr, + vendloc_ptr, + veloloc_ptr, // (node weights + 0, // vlblocltab (labels) + edgelocsize, // zero if local proc has no nodes + edgeloctab.size(), + edgeloc_ptr, + 0, // edgegsttab (ghosts) + edloloc_ptr); // edge weights + + SCOTCH_Num partloctab[nlocvert]; + + SCOTCH_Strat stradat; + SCOTCH_stratInit(&stradat); + SCOTCH_stratDgraphMapBuild(&stradat, + SCOTCH_STRATBALANCE, + balance_box_level.getMPI().getSize(), + 0, + 0.00); + + int err2 = SCOTCH_dgraphPart(graph, + balance_box_level.getMPI().getSize(), + &stradat, + partloctab); + + int num_ranks = my_mpi.getSize(); + int my_rank = my_mpi.getRank(); + int boxes_on_rank[num_ranks]; + for (int rank = 0; rank < num_ranks; ++rank) { + if (rank != my_rank) { + boxes_on_rank[rank] = 0; + } else { + boxes_on_rank[rank] = boxes.size(); + } + } + + my_mpi.AllReduce(boxes_on_rank, + num_ranks, + MPI_SUM); + + int start_box = 0; + for (int rank = 0; rank < my_rank; ++rank) { + start_box += boxes_on_rank[rank]; + } + +#ifdef DEBUG_CHECK_ASSERTIONS + if (!boxes.empty()) { + TBOX_ASSERT(start_box == boxes.begin()->getLocalId().getValue()); + } +#endif + + int global_num_boxes = balance_box_level.getGlobalNumberOfBoxes(); + + int old_global_partition[global_num_boxes]; + int new_global_partition[global_num_boxes]; + for (int b = 0; b < global_num_boxes; ++b) { + old_global_partition[b] = 0; + new_global_partition[b] = 0; + } + for (int b = start_box; b < start_box + nlocvert; ++b) { + old_global_partition[b] = my_rank; + new_global_partition[b] = partloctab[b - start_box]; + } + + my_mpi.AllReduce(old_global_partition, + global_num_boxes, + MPI_SUM); + my_mpi.AllReduce(new_global_partition, + global_num_boxes, + MPI_SUM); + + hier::BoxLevel graph_level(balance_box_level.getRefinementRatio(), + balance_box_level.getGridGeometry(), + balance_box_level.getMPI(), + hier::BoxLevel::DISTRIBUTED); + + tbox::AsyncCommStage send_stage; + std::map *> send_comms; + std::set send_procs; + tbox::AsyncCommStage recv_stage; + std::map *> recv_comms; + + setupAsyncCommObjects( + send_stage, + send_comms, + send_procs, + recv_stage, + recv_comms, + old_global_partition, + new_global_partition, + global_num_boxes, + my_rank, + my_mpi); + + for (std::map *>::iterator ri = + recv_comms.begin(); ri != recv_comms.end(); ++ri) { + tbox::AsyncCommPeer *& recv_peer = ri->second; + recv_peer->beginRecv(); + if (recv_peer->isDone()) { + recv_peer->pushToCompletionQueue(); + } + } + + /* + * Boxes that stay on the local process are added to graph_level. + * Otherwise BoxInTransit objecst are set up to be communicated. + */ + std::list transit_boxes; + for (hier::BoxContainer::const_iterator itr = boxes.begin(); + itr != boxes.end(); ++itr) { + const int& local_id = itr->getLocalId().getValue(); + TBOX_ASSERT(old_global_partition[local_id] == my_rank); + + if (new_global_partition[local_id] == my_rank) { + graph_level.addBoxWithoutUpdate(*itr); + } else { + transit_boxes.push_back(BoxInTransit(*itr, + *itr, + new_global_partition[local_id], + hier::LocalId(local_id))); + } + } + + /* + * Determine number of boxes to send. + */ + int num_send_boxes[num_ranks]; + for (int rank = 0; rank < num_ranks; ++rank) { + num_send_boxes[rank] = 0; + } + for (int b = 0; b < global_num_boxes; ++b) { + if (old_global_partition[b] == my_rank && + new_global_partition[b] != my_rank) { + ++num_send_boxes[new_global_partition[b]]; + } + } + + tbox::MessageStream* mstreams = new tbox::MessageStream[num_ranks]; + for (int rank = 0; rank < num_ranks; ++rank) { + if (num_send_boxes[rank]) { + mstreams[rank] << num_send_boxes[rank]; + } + } + + /* + * Place transit boxes in stream and send. + */ + for (std::list::const_iterator ti = transit_boxes.begin(); + ti != transit_boxes.end(); ++ti) { + const BoxInTransit& transit_box = *ti; + const int send_rank = transit_box.d_box.getOwnerRank(); + if (send_rank != transit_box.d_orig_box.getOwnerRank()) { + + transit_box.putToMessageStream(mstreams[send_rank]); + + } + } + + int send_ct = static_cast(send_procs.size()); + std::set::const_iterator si = send_procs.lower_bound(my_rank + 1); + for (int num_sent = 0; num_sent < send_ct; ++num_sent) { + if (si == send_procs.end()) { + si = send_procs.begin(); + } + int send_rank = *si; + tbox::AsyncCommPeer *& send_peer = send_comms[send_rank]; + const tbox::MessageStream& msg = mstreams[send_rank]; + send_peer->beginSend(static_cast(msg.getBufferStart()), + static_cast(msg.getCurrentSize())); + ++si; + } + + for (si = send_procs.begin(); si != send_procs.end(); ++si) { + + tbox::AsyncCommPeer *& send_peer = send_comms[*si]; + send_peer->completeCurrentOperation(); + } + + delete[] mstreams; + + hier::MappingConnector balance_to_graph(dim); + hier::MappingConnector graph_to_balance(dim); + + balance_to_graph.clearNeighborhoods(); + balance_to_graph.setBase(balance_box_level); + balance_to_graph.setHead(graph_level); + balance_to_graph.setWidth(hier::IntVector::getZero(dim), true); + graph_to_balance.clearNeighborhoods(); + graph_to_balance.setBase(graph_level); + graph_to_balance.setHead(balance_box_level); + graph_to_balance.setWidth(hier::IntVector::getZero(dim), true); + + /* + * balance_to_graph connector set up based on the boxes that were sent. + */ + for (std::list::iterator ti = transit_boxes.begin(); + ti != transit_boxes.end(); ++ti) { + + const BoxInTransit& sent_box = *ti; + + hier::Connector::NeighborhoodIterator base_box_itr = + balance_to_graph.makeEmptyLocalNeighborhood( + sent_box.d_orig_box.getBoxId()); + + balance_to_graph.insertLocalNeighbor( + sent_box.getBox(), + base_box_itr); + } + + /* + * Complete receives and unpack streams. + */ + std::list received_transit_boxes; + while (recv_stage.hasCompletedMembers() || recv_stage.advanceSome()) { + + tbox::AsyncCommPeer* recv_peer = + CPP_CAST *>(recv_stage.popCompletionQueue()); + + TBOX_ASSERT(recv_peer != 0); + + tbox::MessageStream mstream(recv_peer->getRecvSize(), + tbox::MessageStream::Read, + recv_peer->getRecvData(), + false); + + int stream_size = static_cast(mstream.getCurrentSize()); + int num_boxes = 0; + mstream >> num_boxes; + + BoxInTransit received_box(d_dim); + for (int i = 0; i < num_boxes; ++i) { + received_box.getFromMessageStream(mstream); + received_transit_boxes.push_back(received_box); + } + } + + TBOX_ASSERT(!recv_stage.hasPendingRequests()); + + /* + * Add received boxes to graph_level and add graph_to_balance neighbors. + */ + for (std::list::iterator ri = received_transit_boxes.begin(); + ri != received_transit_boxes.end(); ++ri) { + + const BoxInTransit& received_box = *ri; + graph_level.addBoxWithoutUpdate(received_box.getBox()); + + hier::Connector::NeighborhoodIterator base_box_itr = + graph_to_balance.makeEmptyLocalNeighborhood( + received_box.getBox().getBoxId()); + + graph_to_balance.insertLocalNeighbor( + received_box.d_orig_box, + base_box_itr); + } + + graph_level.finalize(); + + balance_to_graph.setTranspose(&graph_to_balance, false); + + /* + * balance_box_level modified to become the graph-based partition. + */ + mca.modify(anchor_to_balance, + balance_to_graph, + &balance_box_level); + + if (d_coalesce_boxes) { + /* + * Coalesce local boxes and then chop to enforce max size. + */ + + coalesceBoxLevel(balance_box_level, + anchor_to_balance, + mca); + + hier::IntVector maxvector(d_dim, tbox::MathUtilities::getMax()); + if (max_size != maxvector) { + chopBoxes(balance_box_level, &anchor_to_balance, max_size); + } + } + + for (std::map *>::iterator c_itr = send_comms.begin(); + c_itr != send_comms.end(); + ++c_itr) { + + if (c_itr->second) + delete c_itr->second; + + } + for (std::map *>::iterator c_itr = recv_comms.begin(); + c_itr != recv_comms.end(); + ++c_itr) { + + if (c_itr->second) + delete c_itr->second; + + } + +#else + NULL_USE(balance_box_level); + NULL_USE(balance_to_anchor); + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(min_size); + NULL_USE(max_size); + NULL_USE(domain_box_level); + NULL_USE(bad_interval); + NULL_USE(cut_factor); + TBOX_WARNING( + "SAMRAI configured without PT-Scotch library: GraphLoadBalancer calls will do nothing"); + +#endif + +} + +/* + * *********************************************************************** + * 0 to N-1 renumbering of all boxes on the level + * *********************************************************************** + */ +void +GraphLoadBalancer::renumberBoxes( + hier::BoxLevel& new_box_level, + hier::Connector& anchor_to_balance, + const hier::MappingConnectorAlgorithm& mca) const +{ + boost::shared_ptr sorting_map; + boost::shared_ptr seq_box_level; + hier::BoxLevelConnectorUtils dlbg_edge_utils; + dlbg_edge_utils.makeSortingMap( + seq_box_level, + sorting_map, + new_box_level, + false, //sort_by_corners = false + true); //sequentialize_global_indices = true + + mca.modify(anchor_to_balance, + *sorting_map, + &new_box_level); + +} + +/* + * *********************************************************************** + * Coalesce local boxes + * *********************************************************************** + */ +void +GraphLoadBalancer::coalesceBoxLevel( + hier::BoxLevel& level, + hier::Connector& anchor_to_level, + const hier::MappingConnectorAlgorithm& mca) const +{ + const hier::BoxContainer& level_boxes = level.getBoxes(); + + hier::BoxLevel coalesced(level.getRefinementRatio(), + level.getGridGeometry(), + level.getMPI()); + hier::MappingConnector level_to_coalesced(level, + coalesced, + hier::IntVector::getZero(d_dim)); + + if (!level_boxes.empty()) { + + const int my_rank = level_boxes.begin()->getOwnerRank(); + + size_t nblocks = level.getGridGeometry()->getNumberBlocks(); + hier::LocalId local_id(0); + + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + hier::BlockId block_id(b); + + hier::BoxContainer block_boxes(level_boxes, block_id); + + if (!block_boxes.empty()) { + block_boxes.unorder(); + block_boxes.coalesce(); + + for (hier::BoxContainer::iterator bi = block_boxes.begin(); + bi != block_boxes.end(); ++bi) { + + const hier::Box new_box(*bi, + local_id++, + my_rank); + + coalesced.addBoxWithoutUpdate(new_box); + + } + } + } + } + + coalesced.finalize(); + + const hier::BoxContainer& coalesced_boxes = coalesced.getBoxes(); + + int was_coalesced = 0; + if (coalesced_boxes.size() != level_boxes.size()) { + was_coalesced = 1; + } + const tbox::SAMRAI_MPI& mpi = level.getMPI(); + mpi.AllReduce(&was_coalesced, + 1, + MPI_SUM); + + if (was_coalesced != 0) { + + for (hier::BoxContainer::const_iterator li = level_boxes.begin(); + li != level_boxes.end(); ++li) { + + const hier::Box& old_box = *li; + const hier::BlockId& block_id = old_box.getBlockId(); + + hier::Connector::NeighborhoodIterator base_box_itr = + level_to_coalesced.makeEmptyLocalNeighborhood( + old_box.getBoxId()); + + for (hier::BoxContainer::const_iterator bi = coalesced_boxes.begin(); + bi != coalesced_boxes.end(); ++bi) { + if (bi->getBlockId() == block_id) { + + if (old_box.intersects(*bi)) { + + level_to_coalesced.insertLocalNeighbor( + *bi, + base_box_itr); + + } + } + } + } + + mca.modify(anchor_to_level, + level_to_coalesced, + &level); + } +} + +/* + * *********************************************************************** + * Chop boxes which are greater than max_size + * *********************************************************************** + */ + +void +GraphLoadBalancer::chopBoxes( + hier::BoxLevel& box_level, + hier::Connector* anchor_to_level, + const hier::IntVector& max_size) const +{ + const tbox::Dimension& dim = max_size.getDim(); + TBOX_ASSERT(!anchor_to_level || anchor_to_level->hasTranspose()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, box_level); + + const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); + + hier::BoxLevel constrained(box_level.getRefinementRatio(), + box_level.getGridGeometry(), + box_level.getMPI()); + hier::MappingConnector unconstrained_to_constrained(box_level, + constrained, + zero_vector); + + const hier::BoxContainer& unconstrained_boxes = box_level.getBoxes(); + + hier::LocalId next_available_index = box_level.getLastLocalId() + 1; + + for (hier::BoxContainer::const_iterator ni = unconstrained_boxes.begin(); + ni != unconstrained_boxes.end(); ++ni) { + + const hier::Box& box = *ni; + + const hier::IntVector box_size = box.numberCells(); + + /* + * If box already conform to max size constraint, keep it. + * Else chop it up and keep the parts. + */ + + if (box_size <= max_size) { + + constrained.addBoxWithoutUpdate(box); + + } else { + + hier::BoxContainer chopped(box); + hier::BoxUtilities::chopBoxes( + chopped, + max_size, + d_min_size, + d_cut_factor, + d_bad_interval, + d_block_domain_boxes[box.getBlockId().getBlockValue()]); + TBOX_ASSERT(!chopped.empty()); + + if (chopped.size() != 1) { + + hier::Connector::NeighborhoodIterator base_box_itr = + unconstrained_to_constrained.makeEmptyLocalNeighborhood( + box.getBoxId()); + + for (hier::BoxContainer::iterator li = chopped.begin(); + li != chopped.end(); ++li) { + + const hier::Box new_box(*li, + next_available_index++, + box.getOwnerRank()); + TBOX_ASSERT(new_box.getBlockId() == ni->getBlockId()); + + constrained.addBoxWithoutUpdate(new_box); + + unconstrained_to_constrained.insertLocalNeighbor( + new_box, + base_box_itr); + + } + + } else { + TBOX_ASSERT(box.isSpatiallyEqual(chopped.front())); + constrained.addBoxWithoutUpdate(box); + } + + } + + } + + constrained.finalize(); + + int was_chopped = 0; + if (constrained.getBoxes().size() != box_level.getBoxes().size()) { + was_chopped = 1; + } + const tbox::SAMRAI_MPI& mpi = box_level.getMPI(); + mpi.AllReduce(&was_chopped, + 1, + MPI_SUM); + + if (was_chopped != 0) { + hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix(d_object_name); + mca.modify(*anchor_to_level, + unconstrained_to_constrained, + &box_level); + } +} + +/* + * *********************************************************************** + * BoxInTransit constructors + * *********************************************************************** + */ + +GraphLoadBalancer::BoxInTransit::BoxInTransit( + const tbox::Dimension& dim): + d_box(dim), + d_orig_box(dim) +{ +} + +GraphLoadBalancer::BoxInTransit::BoxInTransit( + const hier::Box& other, + const hier::Box& box, + int rank, + hier::LocalId local_id): + d_box(box, local_id, rank), + d_orig_box(other) +{ +} + +/* + * *********************************************************************** + * Set up communications + * *********************************************************************** + */ + +void +GraphLoadBalancer::setupAsyncCommObjects( + tbox::AsyncCommStage& send_stage, + std::map *>& send_comms, + std::set& send_procs, + tbox::AsyncCommStage& recv_stage, + std::map *>& recv_comms, + const int* old_partition, + const int* new_partition, + const int num_boxes, + const int my_rank, + const tbox::SAMRAI_MPI& mpi) const +{ + std::set recv_procs; + for (int b = 0; b < num_boxes; ++b) { + if (old_partition[b] == my_rank && + new_partition[b] != my_rank) { + send_procs.insert(new_partition[b]); + if (send_comms[new_partition[b]] == 0) { + send_comms[new_partition[b]] = new tbox::AsyncCommPeer(); + } + } + if (old_partition[b] != my_rank && + new_partition[b] == my_rank) { + recv_procs.insert(old_partition[b]); + if (recv_comms[old_partition[b]] == 0) { + recv_comms[old_partition[b]] = new tbox::AsyncCommPeer(); + } + } + } + + const int num_sends = static_cast(send_procs.size()); + const int num_recvs = static_cast(recv_procs.size()); + + if (num_sends > 0) { + + for (std::set::const_iterator s_itr = send_procs.begin(); + s_itr != send_procs.end(); ++s_itr) { + int send_num = *s_itr; + send_comms[send_num]->initialize(&send_stage); + send_comms[send_num]->setPeerRank(*s_itr); + send_comms[send_num]->setMPI(mpi); + send_comms[send_num]->setMPITag(GraphLoadBalancer_LOADTAG0, + GraphLoadBalancer_LOADTAG1); + send_comms[send_num]->limitFirstDataLength( + sizeof(BoxInTransit) * GraphLoadBalancer_FIRSTDATALEN); + + } + } + + if (num_recvs > 0) { + + for (std::set::const_iterator s_itr = recv_procs.begin(); + s_itr != recv_procs.end(); ++s_itr) { + + int recv_num = *s_itr; + recv_comms[recv_num]->initialize(&recv_stage); + recv_comms[recv_num]->setPeerRank(*s_itr); + recv_comms[recv_num]->setMPI(mpi); + recv_comms[recv_num]->setMPITag(GraphLoadBalancer_LOADTAG0, + GraphLoadBalancer_LOADTAG1); + recv_comms[recv_num]->limitFirstDataLength( + sizeof(BoxInTransit) * GraphLoadBalancer_FIRSTDATALEN); + + } + + } + +} + +/* + * *********************************************************************** + * BoxInTransit stream methods + * *********************************************************************** + */ + +void +GraphLoadBalancer::BoxInTransit::putToMessageStream( + tbox::MessageStream& mstream) const +{ + d_box.putToMessageStream(mstream); + d_orig_box.putToMessageStream(mstream); +} + +void +GraphLoadBalancer::BoxInTransit::getFromMessageStream( + tbox::MessageStream& mstream) +{ + d_box.getFromMessageStream(mstream); + d_orig_box.getFromMessageStream(mstream); +} + +/* + * *********************************************************************** + * Read from input + * *********************************************************************** + */ + +void +GraphLoadBalancer::getFromInput( + const boost::shared_ptr& input_db) +{ + + if (input_db) { + + if (input_db->isInteger("target_box_size")) { + int target_box_size[d_dim.getValue()]; + input_db->getIntegerArray("target_box_size", + target_box_size, + d_dim.getValue()); + d_target_box_size = hier::IntVector(d_dim, target_box_size); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (d_target_box_size[i] <= 0) { + INPUT_RANGE_ERROR("target_box_size"); + } + } + } + + d_coalesce_boxes = input_db->getBoolWithDefault("coalesce_boxes", true); + + if (input_db->isInteger("tile_size")) { + input_db->getIntegerArray("tile_size", &d_tile_size[0], d_tile_size.getDim().getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_tile_size[i] >= 1)) { + TBOX_ERROR("CascadePartitioner tile_size must be >= 1 in all directions.\n" + << "Input tile_size is " << d_tile_size); + } + } + } + + } +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.h new file mode 100644 index 00000000..043236b5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GraphLoadBalancer.h @@ -0,0 +1,452 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Scalable load balancer using tree algorithm. + * + ************************************************************************/ + +#ifndef included_mesh_GraphLoadBalancer +#define included_mesh_GraphLoadBalancer + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/mesh/LoadBalanceStrategy.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/tbox/AsyncCommPeer.h" +#include "SAMRAI/tbox/AsyncCommStage.h" +#include "SAMRAI/tbox/CommGraphWriter.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/RankGroup.h" +#include "SAMRAI/tbox/Statistic.h" +#include "SAMRAI/tbox/Statistician.h" +#include "SAMRAI/tbox/Timer.h" +#include "SAMRAI/tbox/Utilities.h" + +#include "boost/shared_ptr.hpp" +#include +#include +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief A graph-based load balance using PT-Scotch to partition patches + * on a level. + * + * This class load balances by treating input boxes as weighted nodes on a + * graph. The PT-Scotch graph partitioning library is used to distribute these + * nodes across all the processors. + * + * If SAMRAI is not configured with PT-Scotch, this class will still compile, + * but the load balancing calls will effectively be no-ops. + * + * This class is primarily intended to be used as a load balancing option + * within the TilePartitioner class after clustering has been executed by + * the TileClustering class, though it is not required to be used in that + * context. + * + * Currently, only uniform load balancing is supported. + * + * - \b target_box_size + * The boxes that are recevied by this load balancer as input may be very + * large, and may need to be chopped in order to provide a sufficient number + * of nodes on the graph that is used to partition the level. The load + * balancer will attempt to chop any boxes larger than this size into + * pieces as close to this size as possible. When used in conjunction with + * the TileClustering box generator, the recommended size is the tile size + * times the refinement ratio. If no input is given for this entry, an + * internal heuristic will choose a target box size, but the chosen value + * may not be well-suited to any particular problem. + * + * - \b coalesce_boxes + * After load balancing, coalesce boxes on each local processor wherever + * possible if this boolean is true. If coalescing is turned off, the + * load balancer may result in levels containing a large number of small + * boxes. This option can be invoked to spatially merge those boxes where + * possible. + * + * - \b tile_size + * Tile size when using tile mode. Tile mode restricts box cuts + * to tile boundaries. Default is 1, which is equivalent to no restriction. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
target_box_sizeint[]default computed by internal heuristicall values > 0optNot written to restart. Value in input db used.
coalesce_boxesbooltruetrue/falseoptNot written to restart. Value in input db used.
tile_sizeIntVector11-optNot written to restart. Value in input db used.
+ * + * @see LoadBalanceStrategy + */ + +class GraphLoadBalancer: + public LoadBalanceStrategy +{ +public: + /*! + * @brief Initializing constructor sets object state to default or, + * if database provided, to parameters in database. + * + * @param[in] dim + * + * @param[in] name User-defined std::string identifier used for error + * reporting and timer names. If omitted, "GraphLoadBalancer" + * is used. + * + * @param[in] input_db (optional) database pointer providing + * parameters from input file. This pointer may be null indicating + * no input is used. + * + * @pre !name.empty() + */ + GraphLoadBalancer( + const tbox::Dimension& dim, + const std::string& name, + const boost::shared_ptr& input_db = + boost::shared_ptr()); + + /*! + * @brief Virtual destructor releases all internal storage. + */ + virtual ~GraphLoadBalancer(); + + /*! + * @brief Configure the load balancer to use the data stored + * in the hierarchy at the specified descriptor index + * for estimating the workload on each cell. + * + * Note: This method currently does not affect the results because + * this class does not yet support uniform load balancing. + * + * @param data_id + * Integer value of patch data identifier for workload + * estimate on each cell. An invalid value (i.e., < 0) + * indicates that a spatially-uniform work estimate + * will be used. The default value is -1 (undefined) + * implying the uniform work estimate. + * + * @param level_number + * Optional integer number for level on which data id + * is used. If no value is given, the data will be + * used for all levels. + * + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(data_id) is actually a boost::shared_ptr > + */ + void + setWorkloadPatchDataIndex( + int data_id, + int level_number = -1) {} + + /*! + * @brief Return true if load balancing procedure for given level + * depends on patch data on mesh; otherwise return false. + * + * @param[in] level_number Integer patch level number. + */ + bool + getLoadBalanceDependsOnPatchData( + int level_number) const + { + NULL_USE(level_number); + return false; + } + + /*! + * @copydoc LoadBalanceStrategy::loadBalanceBoxLevel() + * + * Note: This implementation does not yet support non-uniform load + * balancing. + * + * @pre !balance_to_anchor || balance_to_anchor->hasTranspose() + * @pre !balance_to_anchor || balance_to_anchor->isTransposeOf(balance_to_anchor->getTranspose()) + * @pre (d_dim == balance_box_level.getDim()) && + * (d_dim == min_size.getDim()) && (d_dim == max_size.getDim()) && + * (d_dim == domain_box_level.getDim()) && + * (d_dim == bad_interval.getDim()) && (d_dim == cut_factor.getDim()) + * @pre !hierarchy || (d_dim == hierarchy->getDim()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getSize()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getRank()) + */ + void + loadBalanceBoxLevel( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, + const boost::shared_ptr& hierarchy, + const int level_number, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::BoxLevel& domain_box_level, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + const tbox::RankGroup& rank_group = tbox::RankGroup()) const; + + /*! + * @brief Get the name of this object. + */ + const std::string& + getObjectName() const + { + return d_object_name; + } + +private: + /*! + * @brief Struct to store state of a box before and after communication. + */ + + struct BoxInTransit { + + /*! + * @brief Constructor + * + * BoxInTransit will be constructed with empty Boxes. + * + * @param[in] dim + */ + explicit BoxInTransit( + const tbox::Dimension& dim); + + /*! + * @brief Construct new object having the history an existing + * object but is otherwise different. + * + * @param[in] orig_box Original box before communication + * + * @param[in] box Provides spatial coordinates for new box + * + * @param[in] rank Rank of new box + * + * @param[in] local_id LocalId for new box + */ + BoxInTransit( + const hier::Box& orig_box, + const hier::Box& box, + int rank, + hier::LocalId local_id); + + /*! + * @brief Assignment operator + * + * @param[in] other + */ + BoxInTransit& + operator = ( + const BoxInTransit& other) + { + d_box = other.d_box; + d_orig_box = other.d_orig_box; + return *this; + } + + //! @brief Return the owner rank. + int + getOwnerRank() const + { + return d_box.getOwnerRank(); + } + + //! @brief Return the LocalId + hier::LocalId + getLocalId() const + { + return d_box.getLocalId(); + } + + //! @brief Return the Box + hier::Box& + getBox() + { + return d_box; + } + + //! @brief Return the Box + const hier::Box& + getBox() const + { + return d_box; + } + + /*! + * @brief Put self into a MessageStream. + * + * This is the opposite of getFromMessageStream(). + */ + void + putToMessageStream( + tbox::MessageStream& msg) const; + + /*! + * @brief Set attributes according to data in a MessageStream. + * + * This is the opposite of putToMessageStream(). + */ + void + getFromMessageStream( + tbox::MessageStream& msg); + + hier::Box d_box; + hier::Box d_orig_box; + }; + + static const int GraphLoadBalancer_LOADTAG0 = 1; + static const int GraphLoadBalancer_LOADTAG1 = 2; + static const int GraphLoadBalancer_FIRSTDATALEN = 500; + + /*! + * @brief Renumber Boxes in a BoxLevel. + * + * This method renumbers Boxes to give them globally + * sequential LocalIds. Modifies the given Connector to account for the + * change in the level's state. + * + * @param[in,out] balance_box_level + * + * @param[in,out] anchor_to_balance + * + * @param[in] mca MappingConnectorAlgorithm with timer set + * in the calling context. + */ + void + renumberBoxes( + hier::BoxLevel& balance_box_level, + hier::Connector& anchor_to_balance, + const hier::MappingConnectorAlgorithm& mca) const; + + /*! + * @brief Chop Boxes in a box_level. + * + * If any boxes are greater than the given max_size, attempt to chop them + * to be below the max_size. Modifies the given Connector to account for the + * change in the level's state. + * + * @param[in,out] box_level + * + * @param[in,out] anchor_to_level + * + * @param[in] mca MappingConnectorAlgorithm with timer set + * in the calling context. + */ + void + chopBoxes( + hier::BoxLevel& box_level, + hier::Connector* anchor_to_level, + const hier::IntVector& max_size) const; + + /*! + * @brief Coalesce Boxes in a box_level. + * + * Attempts to coalesce the local boxes on the given level. Modifies + * the given Connector to account for the change int eh level's state. + * + * @param[in,out] box_level + * + * @param[in,out] anchor_to_level + * + * @param[in] mca MappingConnectorAlgorithm with timer set + * in the calling context. + */ + void + coalesceBoxLevel( + hier::BoxLevel& box_level, + hier::Connector& anchor_to_level, + const hier::MappingConnectorAlgorithm& mca) const; + + /*! + * @brief Set up the asynchronous communication objects for communicating + * Boxes from pre-balanced to post-balanced processors. + * + * Based on a conceptual process tree with num_children children, + * set the AsyncCommPeer objects for communication with children + * and parent. + * + * @param [out] send_stage Stage for sending operations + * @param [out] send_comms Maps ranks for sending to AsyncCommPeer objects + * @param [out] send_procs Ranks of processes sent to + * @param [out] recv_stage Stage for receive operations + * @param [out] recv_comms Maps ranks for receiving to AsyncCommPeer objects + * @param [in] old_partition array describing pre-balance partition + * @param [in] new_partition array describing post-balance partition + * @param [in] new_boxes global number of boxes + * @param [in] my_rank + * @param [in] mpi + */ + void + setupAsyncCommObjects( + tbox::AsyncCommStage& send_stage, + std::map *>& send_comms, + std::set& send_procs, + tbox::AsyncCommStage& recv_stage, + std::map *>& recv_comms, + const int* old_partition, + const int* new_partition, + const int num_boxes, + const int my_rank, + const tbox::SAMRAI_MPI& mpi) const; + + /* + * Read parameters from input database. + */ + void + getFromInput( + const boost::shared_ptr& input_db); + + tbox::Dimension d_dim; + + std::string d_object_name; + + hier::IntVector d_target_box_size; + + bool d_coalesce_boxes; + + /*! + * @brief Tile size, when restricting cuts to tile boundaries, + * Set to 1 when not restricting. + */ + hier::IntVector d_tile_size; + + mutable hier::IntVector d_min_size; + mutable hier::IntVector d_cut_factor; + mutable hier::IntVector d_bad_interval; + mutable std::vector d_block_domain_boxes; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.C index a9c00381..7ddcb77e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.C @@ -3,29 +3,24 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR hierarchy generation and regridding routines. * ************************************************************************/ - -#ifndef included_mesh_GriddingAlgorithm_C -#define included_mesh_GriddingAlgorithm_C - #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/tbox/IEEE.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxLevelConnectorUtils.h" #include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/PeriodicShiftCatalog.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/math/PatchCellDataBasicOps.h" -#include "SAMRAI/math/PatchCellDataOpsInteger.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" +#include "SAMRAI/pdat/CellIntegerConstantRefine.h" +#include "SAMRAI/xfer/PatchInteriorVariableFillPattern.h" +#include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" #include #include @@ -45,32 +40,9 @@ namespace mesh { const int GriddingAlgorithm::ALGS_GRIDDING_ALGORITHM_VERSION = 3; -/* - ************************************************************************* - * - * Initialize the static data members. - * - ************************************************************************* - */ - -tbox::Array * GriddingAlgorithm::s_tag_indx = 0; -tbox::Array * GriddingAlgorithm::s_buf_tag_indx = 0; - -tbox::StartupShutdownManager::Handler -GriddingAlgorithm::s_startup_shutdown_handler( - 0, - GriddingAlgorithm::startupCallback, - GriddingAlgorithm::shutdownCallback, - 0, - tbox::StartupShutdownManager::priorityListElements); - -tbox::StartupShutdownManager::Handler -GriddingAlgorithm::s_initialize_handler( - GriddingAlgorithm::initializeCallback, - 0, - 0, - GriddingAlgorithm::finalizeCallback, - tbox::StartupShutdownManager::priorityTimers); +const int GriddingAlgorithm::EXISTING_FINE_PATCHES_TAG_VAL = 1; +const int GriddingAlgorithm::NEW_FINE_PATCHES_TAG_VAL = -4; +const int GriddingAlgorithm::BUFFER_TAG_VAL = -9; /* ************************************************************************* @@ -86,32 +58,40 @@ GriddingAlgorithm::GriddingAlgorithm( const boost::shared_ptr& tag_init_strategy, const boost::shared_ptr& generator, const boost::shared_ptr& balancer, - const boost::shared_ptr& balancer0, - bool register_for_restart): + const boost::shared_ptr& balancer0): GriddingAlgorithmStrategy(), d_hierarchy(hierarchy), d_connector_width_requestor(), - d_dim(hierarchy->getDim()), - d_buf_tag_ghosts(d_dim, 0), + d_buf_tag_ghosts(hierarchy->getDim(), 1), d_object_name(object_name), - d_registered_for_restart(register_for_restart), d_tag_init_strategy(tag_init_strategy), d_box_generator(generator), d_load_balancer(balancer), d_load_balancer0(balancer0 ? balancer0 : balancer), - d_mb_tagger_strategy(NULL), + d_mb_tagger_strategy(0), d_true_tag(1), d_false_tag(0), + d_from_fine_pretag(EXISTING_FINE_PATCHES_TAG_VAL), + d_from_fine_tag(NEW_FINE_PATCHES_TAG_VAL), + d_buffer_tag(BUFFER_TAG_VAL), d_base_ln(-1), + d_tag_to_cluster_width(), d_check_nonrefined_tags('w'), d_check_overlapping_patches('w'), d_check_nonnesting_user_boxes('e'), d_check_boundary_proximity_violation('e'), d_sequentialize_patch_indices(true), d_log_metadata_statistics(false), + d_oca(), + d_mca(), + d_blcu(), + d_oca0(), + d_mca0(), + d_blcu0(), d_enforce_proper_nesting(true), d_extend_to_domain_boundary(true), d_load_balance(true), + d_save_tag_data(false), d_barrier_and_time(false), d_check_overflow_nesting(false), d_check_proper_nesting(false), @@ -120,19 +100,18 @@ GriddingAlgorithm::GriddingAlgorithm( { TBOX_ASSERT(hierarchy); TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(input_db); TBOX_ASSERT(tag_init_strategy); TBOX_ASSERT(generator); TBOX_ASSERT(balancer); - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } + tbox::RestartManager::getManager()-> + registerRestartItem(d_object_name, this); d_hierarchy->registerConnectorWidthRequestor( d_connector_width_requestor); + const tbox::Dimension& dim = hierarchy->getDim(); + /* * Construct integer tag variables and add to variable database. * Note that variables and patch data indices are shared among @@ -142,90 +121,100 @@ GriddingAlgorithm::GriddingAlgorithm( * function call. Note that variables are registered and patch data * indices are made only for the first time through the constructor. */ - hier::VariableDatabase* var_db = - hier::VariableDatabase::getDatabase(); + hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); std::string tag_interior_variable_name("GriddingAlgorithm__tag-interior"); + std::string tag_saved_variable_name("GriddingAlgorithm__tag-saved"); + std::string tag_algorithm_variable_name("GriddingAlgorithm__tag-algorithm"); std::string tag_buffer_variable_name("GriddingAlgorithm__tag-buffer"); std::ostringstream dim_extension; - dim_extension << "_" << d_dim.getValue(); + dim_extension << "_" << dim.getValue(); tag_interior_variable_name += dim_extension.str(); + tag_saved_variable_name += dim_extension.str(); + tag_algorithm_variable_name += dim_extension.str(); tag_buffer_variable_name += dim_extension.str(); - d_tag = boost::dynamic_pointer_cast, hier::Variable>( - var_db->getVariable(tag_interior_variable_name)); - if (!d_tag) { - d_tag.reset( - new pdat::CellVariable(d_dim, tag_interior_variable_name, 1)); + d_user_tag = boost::dynamic_pointer_cast, hier::Variable>( + var_db->getVariable(tag_interior_variable_name)); + if (!d_user_tag) { + d_user_tag.reset( + new pdat::CellVariable(dim, tag_interior_variable_name, 1)); } - d_buf_tag = boost::dynamic_pointer_cast, hier::Variable>( - var_db->getVariable(tag_buffer_variable_name)); - if (!d_buf_tag) { - d_buf_tag.reset(new pdat::CellVariable(d_dim, - tag_buffer_variable_name, - 1)); + d_saved_tag = boost::dynamic_pointer_cast, hier::Variable>( + var_db->getVariable(tag_saved_variable_name)); + if (!d_saved_tag) { + d_saved_tag.reset( + new pdat::CellVariable(dim, tag_saved_variable_name, 1)); } - if ((*s_tag_indx)[d_dim.getValue() - 1] < 0) { - (*s_tag_indx)[d_dim.getValue() - 1] = - var_db->registerInternalSAMRAIVariable(d_tag, - hier::IntVector::getZero(d_dim)); + d_boolean_tag = boost::dynamic_pointer_cast, hier::Variable>( + var_db->getVariable(tag_algorithm_variable_name)); + if (!d_boolean_tag) { + d_boolean_tag.reset( + new pdat::CellVariable(dim, tag_algorithm_variable_name, 1)); } - if ((*s_buf_tag_indx)[d_dim.getValue() - 1] < 0) { - (*s_buf_tag_indx)[d_dim.getValue() - 1] = - var_db->registerInternalSAMRAIVariable(d_buf_tag, - hier::IntVector::getOne(d_dim)); - d_buf_tag_ghosts = hier::IntVector::getOne(d_dim); + + d_buf_tag = boost::dynamic_pointer_cast, hier::Variable>( + var_db->getVariable(tag_buffer_variable_name)); + if (!d_buf_tag) { + d_buf_tag.reset(new pdat::CellVariable(dim, + tag_buffer_variable_name, + 1)); } - d_tag_indx = (*s_tag_indx)[d_dim.getValue() - 1]; - d_buf_tag_indx = (*s_buf_tag_indx)[d_dim.getValue() - 1]; + d_user_tag_indx = var_db->registerInternalSAMRAIVariable(d_user_tag, + hier::IntVector::getZero(dim)); + d_saved_tag_indx = var_db->registerInternalSAMRAIVariable(d_saved_tag, + hier::IntVector::getZero(dim)); + d_boolean_tag_indx = var_db->registerInternalSAMRAIVariable(d_boolean_tag, + hier::IntVector::getZero(dim)); + d_buf_tag_indx = var_db->registerInternalSAMRAIVariable(d_buf_tag, + hier::IntVector::getOne(dim)); + d_buf_tag_ghosts = hier::IntVector::getOne(dim); if (d_hierarchy->getGridGeometry()->getNumberBlocks() > 1) { - d_mb_tagger_strategy = new MultiblockGriddingTagger(d_dim); + d_mb_tagger_strategy = new MultiblockGriddingTagger(); d_mb_tagger_strategy->setScratchTagPatchDataIndex(d_buf_tag_indx); } /* * Initialize communication algorithm for exchanging buffered tag data. */ - d_bdry_fill_tags.reset(new xfer::RefineAlgorithm(d_dim)); + d_bdry_fill_tags.reset(new xfer::RefineAlgorithm()); - d_bdry_fill_tags-> - registerRefine(d_buf_tag_indx, + d_bdry_fill_tags->registerRefine(d_buf_tag_indx, d_buf_tag_indx, d_buf_tag_indx, boost::shared_ptr()); - d_efficiency_tolerance.resizeArray(d_hierarchy->getMaxNumberOfLevels()); - d_combine_efficiency.resizeArray(d_hierarchy->getMaxNumberOfLevels()); + d_fill_saved_tags.reset(new xfer::RefineAlgorithm()); - for (int ln = 0; ln < d_hierarchy->getMaxNumberOfLevels(); ln++) { - d_efficiency_tolerance[ln] = 0.8e0; - d_combine_efficiency[ln] = 0.8e0; - } + d_fill_saved_tags->registerRefine(d_saved_tag_indx, + d_user_tag_indx, + d_saved_tag_indx, + boost::shared_ptr(new pdat::CellIntegerConstantRefine()), + boost::shared_ptr(new xfer::PatchInteriorVariableFillPattern(dim))); - d_proper_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels(), - hier::BoxLevel(d_dim)); + d_proper_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels()); d_to_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels()); - d_from_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels()); /* * Initialize object with data read from input and restart databases. */ bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (is_from_restart && d_registered_for_restart) { + if (is_from_restart) { getFromRestart(); } getFromInput(input_db, is_from_restart); if (d_hierarchy->getMaxNumberOfLevels() > 1) { - tbox::Array ratio_to_coarser(d_hierarchy->getMaxNumberOfLevels(), - hier::IntVector::getOne(d_dim)); + std::vector ratio_to_coarser( + d_hierarchy->getMaxNumberOfLevels(), + hier::IntVector(dim,1)); for (int ln = 0; ln < d_hierarchy->getMaxNumberOfLevels(); ++ln) { ratio_to_coarser[ln] = d_hierarchy->getRatioToCoarserLevel(ln); } @@ -234,15 +223,20 @@ GriddingAlgorithm::GriddingAlgorithm( } if (d_tag_init_strategy->getErrorCoarsenRatio() > 1) { boost::shared_ptr std_tag_init( - d_tag_init_strategy, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast( + d_tag_init_strategy)); if (std_tag_init) { d_hierarchy->registerConnectorWidthRequestor( std_tag_init->getConnectorWidthRequestor()); } } - d_bdry_sched_tags.resizeArray(d_hierarchy->getMaxNumberOfLevels()); + d_bdry_sched_tags.resize(d_hierarchy->getMaxNumberOfLevels()); + + d_oca.setSAMRAI_MPI(d_hierarchy->getDomainBoxLevel().getMPI(), true); + d_mca.setSAMRAI_MPI(d_hierarchy->getDomainBoxLevel().getMPI(), true); + d_oca0.setSAMRAI_MPI(d_hierarchy->getDomainBoxLevel().getMPI(), true); + d_mca0.setSAMRAI_MPI(d_hierarchy->getDomainBoxLevel().getMPI(), true); warnIfDomainTooSmallInPeriodicDir(); @@ -250,9 +244,9 @@ GriddingAlgorithm::GriddingAlgorithm( #ifdef GA_RECORD_STATS - d_boxes_stat.resizeArray(d_hierarchy->getMaxNumberOfLevels()); - d_cells_stat.resizeArray(d_hierarchy->getMaxNumberOfLevels()); - d_timestamp_stat.resizeArray(d_hierarchy->getMaxNumberOfLevels()); + d_boxes_stat.resize(d_hierarchy->getMaxNumberOfLevels()); + d_cells_stat.resize(d_hierarchy->getMaxNumberOfLevels()); + d_timestamp_stat.resize(d_hierarchy->getMaxNumberOfLevels()); for (int ln = 0; ln < d_hierarchy->getMaxNumberOfLevels(); ++ln) { std::string ln_text = tbox::Utilities::intToString(ln, 2); @@ -267,6 +261,13 @@ GriddingAlgorithm::GriddingAlgorithm( getStatistic(timestamp_str, "PROC_STAT"); } + d_oca.setTimerPrefix("mesh::GriddingAlgorithm"); + d_mca.setTimerPrefix("mesh::GriddingAlgorithm"); + d_blcu.setTimerPrefix("mesh::GriddingAlgorithm"); + d_oca0.setTimerPrefix("mesh::GriddingAlgorithm0"); + d_mca0.setTimerPrefix("mesh::GriddingAlgorithm0"); + d_blcu0.setTimerPrefix("mesh::GriddingAlgorithm0"); + #endif } @@ -281,11 +282,9 @@ GriddingAlgorithm::GriddingAlgorithm( */ GriddingAlgorithm::~GriddingAlgorithm() { - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); delete d_mb_tagger_strategy; - d_mb_tagger_strategy = NULL; + d_mb_tagger_strategy = 0; } boost::shared_ptr @@ -306,6 +305,12 @@ GriddingAlgorithm::getLoadBalanceStrategyZero() const return d_load_balancer0; } +boost::shared_ptr +GriddingAlgorithm::getPatchHierarchy() const +{ + return d_hierarchy; +} + /* ************************************************************************* * @@ -331,16 +336,23 @@ void GriddingAlgorithm::makeCoarsestLevel( const double level_time) { + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: entered with getNumberOfLevels = " + << d_hierarchy->getNumberOfLevels() << "\n"; + } - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *d_hierarchy); + const tbox::Dimension& dim = d_hierarchy->getDim(); if (d_barrier_and_time) { t_make_coarsest->barrierAndStart(); } - const hier::IntVector& zero_vec(hier::IntVector::getZero(d_dim)); + if (d_tag_to_cluster_width.empty()) { + computeTagToClusterWidths(); + } - const hier::BoxLevelConnectorUtils dlbg_edge_utils; + const hier::IntVector& zero_vec(hier::IntVector::getZero(dim)); + const size_t num_blocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); TBOX_ASSERT(d_hierarchy->getMaxNumberOfLevels() > 0); @@ -355,11 +367,11 @@ GriddingAlgorithm::makeCoarsestLevel( } } - hier::IntVector smallest_patch(d_dim); - hier::IntVector largest_patch(d_dim); - hier::IntVector extend_ghosts(d_dim); + hier::IntVector smallest_patch(dim); + hier::IntVector largest_patch(dim); + hier::IntVector extend_ghosts(dim); { - hier::IntVector smallest_box_to_refine(d_dim); + hier::IntVector smallest_box_to_refine(dim, 0, num_blocks); // "false" argument: for_building_finer level = false getGriddingParameters( smallest_patch, @@ -375,8 +387,7 @@ GriddingAlgorithm::makeCoarsestLevel( * for violations of user constraints. */ if (!level_zero_exists) { - for (int b = 0; b < d_hierarchy->getGridGeometry()->getNumberBlocks(); - b++) { + for (unsigned int b = 0; b < num_blocks; ++b) { hier::BoxContainer domain_boxes( d_hierarchy->getGridGeometry()->getPhysicalDomain(), hier::BlockId(b)); @@ -384,7 +395,9 @@ GriddingAlgorithm::makeCoarsestLevel( } } - const hier::BoxLevel& domain_mapped_box_level(d_hierarchy->getDomainBoxLevel()); + const hier::BoxLevel& domain_box_level(d_hierarchy->getDomainBoxLevel()); + + TBOX_ASSERT(!domain_box_level.getMPI().hasReceivableMessage()); // Check errant messages. t_make_domain->stop(); @@ -395,27 +408,27 @@ GriddingAlgorithm::makeCoarsestLevel( * domain_to_domain is fast and does not require communication. */ - hier::Connector domain_to_domain( - domain_mapped_box_level, - domain_mapped_box_level, - hier::IntVector::max( - hier::IntVector::getOne(d_dim), - d_hierarchy->getRequiredConnectorWidth(0, 0))); + boost::shared_ptr domain_to_domain; + + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: finding domain<==>domain.\n"; + } - const hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(domain_to_domain); + d_oca0.findOverlaps(domain_to_domain, + domain_box_level, + domain_box_level, + hier::IntVector::max( + d_hierarchy->getRequiredConnectorWidth(0, 0, true), + hier::IntVector::getOne(dim))); if (d_barrier_and_time) { t_load_balance0->barrierAndStart(); } - t_load_balance_setup->start(); - - // hier::IntVector patch_cut_factor(d_tag_init_strategy-> getErrorCoarsenRatio()); - const hier::IntVector patch_cut_factor(d_dim, 1); + hier::IntVector patch_cut_factor(dim, d_tag_init_strategy->getErrorCoarsenRatio()); /* - * FIXME: The code for generating the coarsest level's boxes is not + * TODO: The code for generating the coarsest level's boxes is not * scalable because we use the domain BoxLevel in bridges and * Connector modifications, forcing proc 0 (which owns all domain * nodes) to do all of the searches. This problem will show up in @@ -423,25 +436,28 @@ GriddingAlgorithm::makeCoarsestLevel( * regularly. */ - hier::BoxLevel new_mapped_box_level(domain_mapped_box_level); - hier::Connector domain_to_new(domain_to_domain); - domain_to_new.setHead(new_mapped_box_level, true); - hier::Connector new_to_domain(domain_to_domain); - new_to_domain.setBase(new_mapped_box_level, true); + boost::shared_ptr new_box_level( + boost::make_shared(domain_box_level)); + hier::Connector domain_to_new(*domain_to_domain); + domain_to_new.setHead(*new_box_level, true); + hier::Connector new_to_domain(*domain_to_domain); + new_to_domain.setBase(*new_box_level, true); + new_to_domain.setTranspose(&domain_to_new, false); + + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: partitioning domain.\n"; + } - t_load_balance_setup->stop(); + TBOX_ASSERT(!new_box_level->getMPI().hasReceivableMessage()); // Check errant messages. d_load_balancer0->loadBalanceBoxLevel( - new_mapped_box_level, - new_to_domain, - domain_to_new, + *new_box_level, + 0, d_hierarchy, ln, - hier::Connector(), - hier::Connector(), smallest_patch, largest_patch, - domain_mapped_box_level, + domain_box_level, extend_ghosts, patch_cut_factor); @@ -450,28 +466,27 @@ GriddingAlgorithm::makeCoarsestLevel( } if (d_sequentialize_patch_indices) { - renumberBoxes(new_mapped_box_level, - domain_to_new, - new_to_domain, - false /* sort_by_corners */, - true /* sequentialize_global_indices */); + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: renumbering boxes.\n"; + } + renumberBoxes(*new_box_level, 0, false, true); } - dlbg_edge_utils.addPeriodicImagesAndRelationships( - new_mapped_box_level, - new_to_domain, - domain_to_new, + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: adding periodic images.\n"; + } + d_blcu0.addPeriodicImages( + *new_box_level, d_hierarchy->getGridGeometry()->getDomainSearchTree(), - domain_to_domain); + hier::IntVector::max( + d_hierarchy->getRequiredConnectorWidth(0, 0, true), + hier::IntVector::getOne(dim))); - if (d_check_connectors) { - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_domain) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(domain_to_new) == 0); - } + TBOX_ASSERT(!new_box_level->getMPI().hasReceivableMessage()); // Check errant messages. - hier::Connector* new_to_new = new hier::Connector; - if (domain_mapped_box_level.getLocalNumberOfBoxes(0) == - (size_t)domain_mapped_box_level.getGlobalNumberOfBoxes()) { + boost::shared_ptr new_to_new; + if (domain_box_level.getLocalNumberOfBoxes(0) == + domain_box_level.getGlobalNumberOfBoxes()) { /* * If proc 0 owns all new boxes, it is faster find new<==>new by * globalizing the new boxes. @@ -485,10 +500,12 @@ GriddingAlgorithm::makeCoarsestLevel( t_find_new_to_new->barrierAndStart(); } - new_to_new->setBase(new_mapped_box_level); - new_to_new->setHead(new_mapped_box_level); - new_to_new->setWidth(d_hierarchy->getRequiredConnectorWidth(0, 0), true); - oca.findOverlaps(*new_to_new); + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: finding new<==>new." << std::endl; + } + new_to_new.reset(new hier::Connector(*new_box_level, *new_box_level, + d_hierarchy->getRequiredConnectorWidth(0, 0, true))); + d_oca0.findOverlaps_assumedPartition(*new_to_new); if (d_barrier_and_time) { t_find_new_to_new->stop(); @@ -500,16 +517,17 @@ GriddingAlgorithm::makeCoarsestLevel( t_bridge_new_to_new->barrierAndStart(); } - oca.bridgeWithNesting( - *new_to_new, - *new_to_new, - new_to_domain, - domain_to_new, + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: bridging for domain<==>domain.\n"; + } + d_oca0.bridgeWithNesting( + new_to_new, new_to_domain, domain_to_new, zero_vec, zero_vec, - d_hierarchy->getRequiredConnectorWidth(0, 0)); + d_hierarchy->getRequiredConnectorWidth(0, 0, true), + false); if (d_barrier_and_time) { t_bridge_new_to_new->stop(); @@ -517,8 +535,8 @@ GriddingAlgorithm::makeCoarsestLevel( TBOX_ASSERT(new_to_new->getConnectorWidth() == d_hierarchy->getRequiredConnectorWidth(0, 0)); - TBOX_ASSERT(&new_to_new->getBase() == &new_mapped_box_level); - TBOX_ASSERT(&new_to_new->getHead() == &new_mapped_box_level); + TBOX_ASSERT(&new_to_new->getBase() == new_box_level.get()); + TBOX_ASSERT(&new_to_new->getHead() == new_box_level.get()); } @@ -526,25 +544,28 @@ GriddingAlgorithm::makeCoarsestLevel( checkOverlappingPatches(*new_to_new); } + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: making level 0.\n"; + } t_make_new->start(); if (!level_zero_exists) { - d_hierarchy->makeNewPatchLevel(ln, - new_mapped_box_level); + d_hierarchy->makeNewPatchLevel(ln, new_box_level); /* * Add computed Connectors to new level's collection of * persistent overlap Connectors. */ - boost::shared_ptr new_level( - d_hierarchy->getPatchLevel(ln)); - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - new_to_new); + if (!new_box_level->hasConnector(new_to_new->getHead(), + new_to_new->getConnectorWidth())) { + new_box_level->cacheConnector(new_to_new); + } d_hierarchy->getGridGeometry()->adjustMultiblockPatchLevelBoundaries( - *d_hierarchy->getPatchLevel(0)); + *d_hierarchy->getPatchLevel(ln)); + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: initializing data on level 0 (a).\n"; + } // "true" argument: const bool initial_time = true; d_tag_init_strategy->initializeLevelData(d_hierarchy, ln, @@ -557,33 +578,34 @@ GriddingAlgorithm::makeCoarsestLevel( /* * Save old data before they are overwritten by the new BoxLevel. */ - hier::BoxLevel old_mapped_box_level = *d_hierarchy->getBoxLevel(0); - boost::shared_ptr old_level( d_hierarchy->getPatchLevel(ln)); - d_hierarchy->removePatchLevel(ln); - - d_hierarchy->makeNewPatchLevel(ln, - new_mapped_box_level); - /* * Compute old<==>new. Doing it this way is not scalable, but * we only do this for the coarsest level. The old approach of * bridging across the domain BoxLevel is probably not - * scalable anyway, because the domain isusually owned by just + * scalable anyway, because the domain is usually owned by just * one processor. */ - old_mapped_box_level.getPersistentOverlapConnectors().createConnector( - new_mapped_box_level, - d_hierarchy->getRequiredConnectorWidth(0, 0)); - new_mapped_box_level.getPersistentOverlapConnectors().createConnector( - old_mapped_box_level, - d_hierarchy->getRequiredConnectorWidth(0, 0)); + old_level->getBoxLevel()->createConnectorWithTranspose(*new_box_level, + d_hierarchy->getRequiredConnectorWidth(0, 0, true), + d_hierarchy->getRequiredConnectorWidth(0, 0, true)); + + d_tag_init_strategy->processHierarchyBeforeAddingNewLevel(d_hierarchy, + ln, + new_box_level); + + d_hierarchy->removePatchLevel(ln); + + d_hierarchy->makeNewPatchLevel(ln, new_box_level); d_hierarchy->getGridGeometry()->adjustMultiblockPatchLevelBoundaries( - *d_hierarchy->getPatchLevel(0)); + *d_hierarchy->getPatchLevel(ln)); + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: initializing data on level 0 (b).\n"; + } // "false" argument: const bool initial_time = false; d_tag_init_strategy->initializeLevelData(d_hierarchy, ln, @@ -595,6 +617,16 @@ GriddingAlgorithm::makeCoarsestLevel( old_level.reset(); } + + boost::shared_ptr new_level( + d_hierarchy->getPatchLevel(ln)); + + new_level->allocatePatchData(d_saved_tag_indx); + fillTags(d_false_tag, new_level, d_saved_tag_indx); + + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: made level 0.\n"; + } t_make_new->stop(); if (d_barrier_and_time) { @@ -606,7 +638,7 @@ GriddingAlgorithm::makeCoarsestLevel( } if (d_log_metadata_statistics) { - logMetadataStatistics("makeCoarsestLevel", 0, false, false); + d_hierarchy->logMetadataStatistics("makeCoarsestLevel", 0, 0, level_time, false, false); } #ifdef GA_RECORD_STATS @@ -616,6 +648,10 @@ GriddingAlgorithm::makeCoarsestLevel( if (d_barrier_and_time) { t_make_coarsest->stop(); } + + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::makeCoarsestLevel: returning.\n"; + } } /* @@ -647,39 +683,40 @@ GriddingAlgorithm::makeCoarsestLevel( void GriddingAlgorithm::makeFinerLevel( - const double level_time, - const bool initial_time, const int tag_buffer, + const bool initial_cycle, + const int cycle, + const double level_time, const double regrid_start_time) { if (d_print_steps) { tbox::plog - << "GriddingAlgorithm::makeFinerLevel entered with finest ln = " + << "GriddingAlgorithm::makeFinerLevel: entered with finest ln = " << d_hierarchy->getFinestLevelNumber() << "\n"; } TBOX_ASSERT(d_hierarchy); TBOX_ASSERT(d_hierarchy->getPatchLevel( - d_hierarchy->getFinestLevelNumber())); + d_hierarchy->getFinestLevelNumber())); TBOX_ASSERT(tag_buffer >= 0); if (d_barrier_and_time) { t_make_finer->barrierAndStart(); } - const hier::OverlapConnectorAlgorithm oca; + if (d_tag_to_cluster_width.empty()) { + computeTagToClusterWidths(); + } - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); + const tbox::Dimension& dim = d_hierarchy->getDim(); - const hier::BoxLevelConnectorUtils dlbg_edge_utils; + const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); const int tag_ln = d_hierarchy->getFinestLevelNumber(); const int new_ln = tag_ln + 1; if (d_hierarchy->levelCanBeRefined(tag_ln)) { - t_make_finer_setup->start(); - /* * d_base_ln is used by private methods during regrid. */ @@ -689,15 +726,14 @@ GriddingAlgorithm::makeFinerLevel( * Compute nesting data at d_base_ln for use in constructing * level d_base_ln+1; */ - computeProperNestingData(d_base_ln); + computeProperNestingData(d_base_ln, d_oca); const boost::shared_ptr tag_level( d_hierarchy->getPatchLevel(tag_ln)); - hier::BoxLevel new_mapped_box_level(d_dim); - hier::Connector* tag_to_new = new hier::Connector; - hier::Connector* new_to_tag = new hier::Connector; - hier::Connector* new_to_new = new hier::Connector; + boost::shared_ptr new_box_level; + boost::shared_ptr tag_to_new; + hier::Connector* new_to_tag = 0; /* * The boolean "do_tagging" specifies whether or not tagging will @@ -709,8 +745,9 @@ GriddingAlgorithm::makeFinerLevel( * are NOT necessary so do_tagging will be set to false. */ bool do_tagging = true; - if (d_tag_init_strategy->refineUserBoxInputOnly()) do_tagging = false; - t_make_finer_setup->stop(); + if (d_tag_init_strategy->refineUserBoxInputOnly(cycle, level_time)) { + do_tagging = false; + } /* * Tag cells, determine refine boxes from tagged regions, and @@ -718,23 +755,21 @@ GriddingAlgorithm::makeFinerLevel( */ if (do_tagging) { - t_make_finer_tagging->start(); - /* * Initialize integer tag arrays on level to false. */ - tag_level->allocatePatchData(d_tag_indx); - fillTags(d_false_tag, tag_level, d_tag_indx); + tag_level->allocatePatchData(d_user_tag_indx, level_time); + fillTags(d_false_tag, tag_level, d_user_tag_indx); /* * Perform pre-processing of error estimation data. */ - d_tag_init_strategy-> - preprocessErrorEstimation(d_hierarchy, + d_tag_init_strategy->preprocessErrorEstimation(d_hierarchy, tag_ln, + cycle, level_time, regrid_start_time, - initial_time); + initial_cycle); /* * Determine cells needing refinement on level and set tags to true. @@ -742,22 +777,29 @@ GriddingAlgorithm::makeFinerLevel( * the coarsest_sync_level argument is always false. */ bool coarsest_sync_level = false; - d_tag_init_strategy-> - tagCellsForRefinement(d_hierarchy, + d_tag_init_strategy->tagCellsForRefinement(d_hierarchy, tag_ln, + cycle, level_time, - d_tag_indx, - initial_time, + d_user_tag_indx, + initial_cycle, coarsest_sync_level, d_hierarchy->levelCanBeRefined(tag_ln), regrid_start_time); + /* + * Set algorithmic tags to false/true values that will be understood + * in the buffering and clustering steps. + */ + tag_level->allocatePatchData(d_boolean_tag_indx, level_time); + setBooleanTagData(tag_level, false); + /* * Check for user-tagged cells that violate proper nesting. * except if user specified that the violating tags be ignored. */ if (d_check_nonrefined_tags != 'i') { - checkNonrefinedTags(*tag_level, tag_ln); + checkNonrefinedTags(*tag_level, tag_ln, d_oca); } /* @@ -766,7 +808,7 @@ GriddingAlgorithm::makeFinerLevel( * of the level occurs. */ hier::IntVector max_descriptor_ghosts( - d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_dim)); + d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(dim)); /* * If the tag buffer value passed into this method is greater than the @@ -787,11 +829,9 @@ GriddingAlgorithm::makeFinerLevel( d_bdry_fill_tags->createSchedule(tag_level, d_mb_tagger_strategy); t_bdry_fill_tags_create->stop(); - - tag_level->allocatePatchData(d_buf_tag_indx); + tag_level->allocatePatchData(d_buf_tag_indx, level_time); bufferTagsOnLevel(d_true_tag, tag_level, tag_buffer); tag_level->deallocatePatchData(d_buf_tag_indx); - t_make_finer_tagging->stop(); /* * We cannot leave this method with the tag buffering data having @@ -806,12 +846,22 @@ GriddingAlgorithm::makeFinerLevel( /* * Determine Boxes for new fine level. */ - findRefinementBoxes(new_mapped_box_level, - *tag_to_new, - *new_to_tag, + findRefinementBoxes(new_box_level, + tag_to_new, tag_ln); - if (new_mapped_box_level.isInitialized()) { + /* + * Callback to user code to check user tags on the tag level. + */ + d_tag_init_strategy->checkUserTagData(d_hierarchy, + tag_ln, + cycle, + level_time, + d_user_tag_indx); + + if (new_box_level && new_box_level->isInitialized()) { + + new_to_tag = &tag_to_new->getTranspose(); if (d_check_proper_nesting) { /* @@ -826,9 +876,9 @@ GriddingAlgorithm::makeFinerLevel( * except where L(n) touches physical boundary. */ - hier::IntVector required_nesting(d_dim); + hier::IntVector required_nesting(dim); if (tag_ln > 0) { - required_nesting = hier::IntVector(d_dim, + required_nesting = hier::IntVector(dim, d_hierarchy->getProperNestingBuffer(tag_ln)); } else { required_nesting = max_descriptor_ghosts; @@ -836,9 +886,9 @@ GriddingAlgorithm::makeFinerLevel( bool locally_nests = false; const bool new_nests_in_tag = - dlbg_edge_utils.baseNestsInHead( + d_blcu0.baseNestsInHead( &locally_nests, - new_mapped_box_level, + *new_box_level, *d_hierarchy->getBoxLevel(tag_ln), required_nesting, zero_vector, @@ -846,15 +896,14 @@ GriddingAlgorithm::makeFinerLevel( &d_hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); if (!new_nests_in_tag) { - hier::BoxLevel violator(d_dim); - hier::Connector new_to_violator; - hier::BoxLevelConnectorUtils edge_utils; + boost::shared_ptr violator; + boost::shared_ptr new_to_violator; t_compute_external_parts->start(); - edge_utils.computeExternalParts( + d_blcu0.computeExternalParts( violator, new_to_violator, *new_to_tag, - hier::IntVector(d_dim, -d_hierarchy->getProperNestingBuffer(tag_ln)), + hier::IntVector(dim, -d_hierarchy->getProperNestingBuffer(tag_ln)), d_hierarchy->getGridGeometry()->getDomainSearchTree()); t_compute_external_parts->stop(); @@ -862,27 +911,28 @@ GriddingAlgorithm::makeFinerLevel( "Internal library error: Failed to produce proper nesting." << "GriddingAlgorithm::makeFinerLevel:\n" << "tag_ln=" << tag_ln << ":\n" - << "new mapped_box_level does not properly nest\n" - << "in tag mapped_box_level by the required nesting buffer of " + << "new box_level does not properly nest\n" + << "in tag box_level by the required nesting buffer of " << d_hierarchy->getProperNestingBuffer(tag_ln) << ".\nLocal nestingness: " << locally_nests - << ".\nProper nesting violation with new_mapped_box_level of\n" - << new_mapped_box_level.format("N->", 2) - << "Proper nesting violation with tag mapped_box_level of\n" + << ".\nProper nesting violation with new_box_level of\n" + << new_box_level->format("N->", 2) + << "Proper nesting violation with tag box_level of\n" << d_hierarchy->getBoxLevel(tag_ln)->format("F->", 2) << "tag_to_new:\n" << tag_to_new->format("N->", 2) << "new_to_tag:\n" << new_to_tag->format("N->", 2) - << "violator:\n" << violator.format("N->", 2) - << "new_to_violator:\n" << new_to_violator.format("N->", 2)); + << "violator:\n" << violator->format("N->", 2) + << "new_to_violator:\n" << new_to_violator->format("N->", 2) + << std::endl); } } } /* - * Deallocate tag arrays and schedule -- no longer needed. + * Deallocate algorithm tag arrays and schedule--no longer needed. */ - tag_level->deallocatePatchData(d_tag_indx); + tag_level->deallocatePatchData(d_boolean_tag_indx); d_bdry_sched_tags[tag_ln].reset(); } else { /* do_tagging == false */ @@ -894,13 +944,15 @@ GriddingAlgorithm::makeFinerLevel( * constructing the finer level. */ bool remove_old_fine_level = false; - readLevelBoxes(new_mapped_box_level, - *tag_to_new, - *new_to_tag, + readLevelBoxes(new_box_level, + tag_to_new, tag_ln, level_time, + cycle, remove_old_fine_level); + new_to_tag = &tag_to_new->getTranspose(); + /* * Check for user-specified boxes that violate nesting requirements. */ @@ -912,59 +964,47 @@ GriddingAlgorithm::makeFinerLevel( } if (d_check_boundary_proximity_violation != 'i') { - checkBoundaryProximityViolation(tag_ln, new_mapped_box_level); + checkBoundaryProximityViolation(tag_ln, *new_box_level); } } /* do_tagging == false */ - if (new_mapped_box_level.isInitialized()) { + if (new_box_level && new_box_level->isInitialized()) { /* - * If we made a new_mapped_box_level, proceed to make a + * If we made a new_box_level, proceed to make a * PatchLevel from it. */ // Bridge for new<==>new. - t_bridge_links->start(); - t_bridge_new_to_new->start(); - oca.bridgeWithNesting( - *new_to_new, - *new_to_new, - *new_to_tag, - *tag_to_new, + if (d_barrier_and_time) { + t_bridge_new_to_new->barrierAndStart(); + } + boost::shared_ptr new_to_new; + d_oca.bridgeWithNesting( + new_to_new, *new_to_tag, *tag_to_new, zero_vector, zero_vector, - d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln)); - t_bridge_new_to_new->stop(); - t_bridge_links->stop(); + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln, true), + false); + if (d_barrier_and_time) { + t_bridge_new_to_new->barrierAndStop(); + } + + new_box_level->cacheConnector(new_to_new); + tag_level->cacheConnector(tag_to_new); if (d_check_overlapping_patches != 'i') { checkOverlappingPatches(*new_to_new); } - t_make_finer_create->start(); - - d_hierarchy->makeNewPatchLevel(new_ln, new_mapped_box_level); - - boost::shared_ptr new_level( - d_hierarchy->getPatchLevel(new_ln)); - - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - new_to_new); - - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *tag_level->getBoxLevel(), - new_to_tag); + d_tag_init_strategy->processHierarchyBeforeAddingNewLevel(d_hierarchy, + new_ln, + new_box_level); - tag_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - tag_to_new); + d_hierarchy->makeNewPatchLevel(new_ln, new_box_level); d_hierarchy->getGridGeometry()->adjustMultiblockPatchLevelBoundaries( *d_hierarchy->getPatchLevel(new_ln)); @@ -973,23 +1013,49 @@ GriddingAlgorithm::makeFinerLevel( new_ln, level_time, d_hierarchy->levelCanBeRefined(new_ln), - initial_time); + initial_cycle); t_reset_hier->barrierAndStart(); d_tag_init_strategy->resetHierarchyConfiguration(d_hierarchy, new_ln, new_ln); t_reset_hier->stop(); - t_make_finer_create->stop(); + + /* + * Optionally refine and store user tag values on the new level. + */ + if (new_ln > 0 && do_tagging && d_save_tag_data) { + + boost::shared_ptr new_level( + d_hierarchy->getPatchLevel(new_ln)); + + new_level->allocatePatchData(d_saved_tag_indx); + + d_saved_tags_sched = + d_fill_saved_tags->createSchedule( + boost::shared_ptr( + new xfer::PatchLevelInteriorFillPattern()), + new_level, + boost::shared_ptr(), + new_ln-1, + d_hierarchy); + + d_saved_tags_sched->fillData(level_time, false); + + d_tag_init_strategy->checkNewLevelTagData(d_hierarchy, + new_ln, + d_saved_tag_indx); + + } if (d_log_metadata_statistics) { - logMetadataStatistics("makeFinerLevel", d_hierarchy->getFinestLevelNumber(), false, true); + d_hierarchy->logMetadataStatistics("makeFinerLevel", + d_hierarchy->getFinestLevelNumber(), cycle, level_time, false, true); } } - else { - delete tag_to_new; - delete new_to_tag; - delete new_to_new; + + if (do_tagging) { + tag_level->deallocatePatchData(d_user_tag_indx); } d_base_ln = -1; @@ -1020,17 +1086,19 @@ GriddingAlgorithm::makeFinerLevel( void GriddingAlgorithm::regridAllFinerLevels( const int level_number, - const double regrid_time, - const tbox::Array& tag_buffer, - const tbox::Array regrid_start_time, + const std::vector& tag_buffer, + const int cycle, + const double level_time, + const std::vector& regrid_start_time, const bool level_is_coarsest_sync_level) { TBOX_ASSERT((level_number >= 0) && (level_number <= d_hierarchy->getFinestLevelNumber())); TBOX_ASSERT(d_hierarchy->getPatchLevel(level_number)); - TBOX_ASSERT(tag_buffer.getSize() >= level_number + 1); + TBOX_ASSERT(static_cast(tag_buffer.size()) >= level_number + 1); #ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < tag_buffer.getSize(); i++) { + int array_size = static_cast(tag_buffer.size()); + for (int i = 0; i < array_size; ++i) { TBOX_ASSERT(tag_buffer[i] >= 0); } #endif @@ -1038,7 +1106,10 @@ GriddingAlgorithm::regridAllFinerLevels( if (d_barrier_and_time) { t_regrid_all_finer->barrierAndStart(); } - t_misc5->start(); + + if (d_tag_to_cluster_width.empty()) { + computeTagToClusterWidths(); + } if (d_hierarchy->levelCanBeRefined(level_number)) { @@ -1058,22 +1129,24 @@ GriddingAlgorithm::regridAllFinerLevels( * Perform pre-processing of error estimation data, if * appropriate. */ - if (d_tag_init_strategy->usesTimeIntegration()) { + if (d_tag_init_strategy->usesTimeIntegration(cycle, level_time)) { for (int ln = level_number; - ln <= d_hierarchy->getFinestLevelNumber(); ln++) { + ln <= d_hierarchy->getFinestLevelNumber(); ++ln) { if (d_hierarchy->levelCanBeRefined(ln)) { bool initial_time = false; double level_regrid_start_time = 0.; - if (regrid_start_time.getSize() < ln + 1) { - tbox::IEEE::setNaN(level_regrid_start_time); + if (static_cast(regrid_start_time.size()) < ln + 1) { + TBOX_ERROR("GriddingAlgorithm::regridAllFinerLevels()...\n" + << "no regrid_start_time specified for level " << ln + << "." << std::endl); } else { level_regrid_start_time = regrid_start_time[ln]; } - d_tag_init_strategy-> - preprocessErrorEstimation(d_hierarchy, + d_tag_init_strategy->preprocessErrorEstimation(d_hierarchy, ln, - regrid_time, + cycle, + level_time, level_regrid_start_time, initial_time); } @@ -1081,21 +1154,19 @@ GriddingAlgorithm::regridAllFinerLevels( } t_process_error->stop(); - t_misc5->stop(); /* * Recursively regrid each finer level. */ const int finest_level_not_regridded = level_number; regridFinerLevel( level_number, - regrid_time, + level_time, + cycle, finest_level_not_regridded, level_is_coarsest_sync_level, tag_buffer, regrid_start_time); - t_misc5->start(); - /* * Invoke application-specific routines to reset information for those * levels which have been modified. @@ -1123,7 +1194,6 @@ GriddingAlgorithm::regridAllFinerLevels( } } // if level cannot be refined, the routine drops through... - else { if (d_print_steps) { tbox::plog @@ -1134,11 +1204,9 @@ GriddingAlgorithm::regridAllFinerLevels( #ifdef GA_RECORD_STATS // Verified that this does not use much time. - recordStatistics(regrid_time); + recordStatistics(level_time); #endif - t_misc5->stop(); - if (d_barrier_and_time) { t_regrid_all_finer->stop(); } @@ -1183,39 +1251,33 @@ void GriddingAlgorithm::regridFinerLevel( const int tag_ln, const double regrid_time, + const int regrid_cycle, const int finest_level_not_regridded, const bool level_is_coarsest_sync_level, - const tbox::Array& tag_buffer, - const tbox::Array& regrid_start_time) + const std::vector& tag_buffer, + const std::vector& regrid_start_time) { TBOX_ASSERT((tag_ln >= 0) && (tag_ln <= d_hierarchy->getFinestLevelNumber())); TBOX_ASSERT(d_hierarchy->getPatchLevel(tag_ln)); TBOX_ASSERT(finest_level_not_regridded >= 0 && finest_level_not_regridded <= tag_ln); - TBOX_ASSERT(tag_buffer.getSize() >= tag_ln + 1); + TBOX_ASSERT(static_cast(tag_buffer.size()) >= tag_ln + 1); #ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < tag_buffer.getSize(); i++) { + int array_size = static_cast(tag_buffer.size()); + for (int i = 0; i < array_size; ++i) { TBOX_ASSERT(tag_buffer[i] >= 0); } #endif - const hier::OverlapConnectorAlgorithm oca; - if (d_print_steps) { tbox::plog << "GriddingAlgorithm::regridFinerLevel: entered with tag_ln = " << tag_ln << "\n"; } - hier::BoxLevelConnectorUtils dlbg_edge_utils; - if (d_hierarchy->levelCanBeRefined(tag_ln)) { - if (d_barrier_and_time) { - t_misc4->start(); - } - int new_ln = tag_ln + 1; boost::shared_ptr tag_level( @@ -1225,7 +1287,7 @@ GriddingAlgorithm::regridFinerLevel( * Compute nesting data at tag_ln for use in constructing * level tag_ln+1; */ - computeProperNestingData(tag_ln); + computeProperNestingData(tag_ln, d_oca); /* * The boolean "do_tagging" specifies whether or not tagging will @@ -1244,27 +1306,24 @@ GriddingAlgorithm::regridFinerLevel( * be removed. */ bool do_tagging = true; - if (d_tag_init_strategy->refineUserBoxInputOnly()) do_tagging = false; + if (d_tag_init_strategy->refineUserBoxInputOnly(regrid_cycle, + regrid_time)) { + do_tagging = false; + } bool remove_old_fine_level = true; - hier::BoxLevel new_mapped_box_level(d_dim); - hier::Connector* tag_to_new = new hier::Connector; - hier::Connector* new_to_tag = new hier::Connector; - - if (d_barrier_and_time) { - t_misc4->stop(); - } + boost::shared_ptr new_box_level; + boost::shared_ptr tag_to_new; /* * tag_to_finer is [tag_ln]->[tag_ln+2]. - * finer_to_tag is [tag_ln+2]->[tag_ln]. * * These are declared in this scope, computed and cached if * [tag_ln+2] exists. They are used to tag the footprint of * [tag_ln+2] on level tag_ln. Later on, they are used to * bridge for [new_ln] <-> [tag_ln+2]. */ - hier::Connector tag_to_finer, finer_to_tag; + boost::shared_ptr tag_to_finer; /* * Tag cells, determine refine boxes from tagged regions, and @@ -1279,7 +1338,8 @@ GriddingAlgorithm::regridFinerLevel( tag_ln, level_is_coarsest_sync_level, regrid_start_time, - regrid_time); + regrid_time, + regrid_cycle); /* * Perform regridding recursively on finer levels, if appropriate. @@ -1296,6 +1356,7 @@ GriddingAlgorithm::regridFinerLevel( regridFinerLevel( new_ln, regrid_time, + regrid_cycle, finest_level_not_regridded, false, tag_buffer, @@ -1314,31 +1375,32 @@ GriddingAlgorithm::regridFinerLevel( */ regridFinerLevel_doTaggingAfterRecursiveRegrid( tag_to_finer, - finer_to_tag, tag_ln, - tag_buffer); + tag_buffer, + regrid_time); /* * Determine boxes containing cells on level with a true tag * value. */ findRefinementBoxes( - new_mapped_box_level, - *tag_to_new, - *new_to_tag, + new_box_level, + tag_to_new, tag_ln); - if (d_barrier_and_time) { - t_misc3->start(); - } + d_tag_init_strategy->checkUserTagData(d_hierarchy, + tag_ln, + regrid_cycle, + regrid_time, + d_user_tag_indx); if (d_print_steps) { - if (new_mapped_box_level.isInitialized()) { + if (new_box_level && new_box_level->isInitialized()) { tbox::plog - << "GriddingAlgorithm::regridFinerLevel got inititalized new_mapped_box_level\n"; + << "GriddingAlgorithm::regridFinerLevel: got inititalized new_box_level\n"; } else { tbox::plog - << "GriddingAlgorithm::regridFinerLevel got un-inititalized new_mapped_box_level\n"; + << "GriddingAlgorithm::regridFinerLevel: got un-inititalized new_box_level\n"; } } @@ -1347,13 +1409,9 @@ GriddingAlgorithm::regridFinerLevel( * level. */ - tag_level->deallocatePatchData(d_tag_indx); + tag_level->deallocatePatchData(d_boolean_tag_indx); d_bdry_sched_tags[tag_ln].reset(); - if (d_barrier_and_time) { - t_misc3->stop(); - } - } else { /* do_tagging == false */ if (d_hierarchy->finerLevelExists(tag_ln) @@ -1361,6 +1419,7 @@ GriddingAlgorithm::regridFinerLevel( regridFinerLevel( new_ln, regrid_time, + regrid_cycle, finest_level_not_regridded, false, tag_buffer, @@ -1372,11 +1431,11 @@ GriddingAlgorithm::regridFinerLevel( * need to access the user-supplied refine boxes, and load * balance them before constructing the finer level. */ - readLevelBoxes(new_mapped_box_level, - *tag_to_new, - *new_to_tag, + readLevelBoxes(new_box_level, + tag_to_new, tag_ln, regrid_time, + regrid_cycle, remove_old_fine_level); } /* end do_tagging == false */ @@ -1386,23 +1445,26 @@ GriddingAlgorithm::regridFinerLevel( * next finer level if it is no longer needed. */ - if (new_mapped_box_level.isInitialized()) { + if (new_box_level && new_box_level->isInitialized()) { /* - * Create the new PatchLevel from the new_mapped_box_level. + * Create the new PatchLevel from the new_box_level. */ regridFinerLevel_createAndInstallNewLevel( tag_ln, regrid_time, tag_to_new, - new_to_tag, tag_to_finer, - finer_to_tag); + new_box_level); if (d_log_metadata_statistics) { // Don't log the coarse Connector, if the coarse level will be updated. - logMetadataStatistics("regridFinerLevel", new_ln, new_lngetFinestLevelNumber(), tag_ln==d_base_ln); - tbox::plog << "GriddingAlgorithm::regridFinerLevel finished logging level stats." << std::endl; + d_hierarchy->logMetadataStatistics("regridFinerLevel", + new_ln, + regrid_cycle, + regrid_time, + new_ln < d_hierarchy->getFinestLevelNumber(), + true); } } else { @@ -1414,14 +1476,20 @@ GriddingAlgorithm::regridFinerLevel( if (d_hierarchy->finerLevelExists(tag_ln) && remove_old_fine_level) { + d_tag_init_strategy->processLevelBeforeRemoval( + d_hierarchy, + new_ln, + d_hierarchy->getPatchLevel(new_ln)); d_hierarchy->removePatchLevel(new_ln); } - delete tag_to_new; - delete new_to_tag; - } // if we are not re-regenerating level new_ln. + if (do_tagging) { + tag_level->deallocatePatchData(d_user_tag_indx); + } + + } // if level cannot be refined, the routine drops through... } @@ -1435,16 +1503,21 @@ void GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( const int tag_ln, const bool level_is_coarsest_sync_level, - const tbox::Array& regrid_start_time, - const double regrid_time) + const std::vector& regrid_start_time, + const double regrid_time, + const int regrid_cycle) { if (d_print_steps) { tbox::plog - << "GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid: entered with tag_ln = " + << + "GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid: entered with tag_ln = " << tag_ln << "\n"; } - const hier::IntVector& zero_vec(hier::IntVector::getZero(d_dim)); + t_regrid_finer_do_tagging_before->start(); + + const hier::IntVector& zero_vec(hier::IntVector::getZero(d_hierarchy->getDim())); + const boost::shared_ptr& tag_level( d_hierarchy->getPatchLevel(tag_ln)); @@ -1453,12 +1526,8 @@ GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( * false. */ - if (d_barrier_and_time) { - t_misc1->start(); - } - - tag_level->allocatePatchData(d_tag_indx); - fillTags(d_false_tag, tag_level, d_tag_indx); + tag_level->allocatePatchData(d_user_tag_indx, regrid_time); + fillTags(d_false_tag, tag_level, d_user_tag_indx); /* * Set tags to true for cells that currently cover next finer level. @@ -1475,12 +1544,17 @@ GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( if (d_hierarchy->finerLevelExists(tag_ln)) { fillTagsFromBoxLevel( - d_true_tag, + d_from_fine_pretag, tag_level, - d_tag_indx, - d_hierarchy->getConnector(tag_ln, tag_ln + 1), + d_user_tag_indx, + d_hierarchy->getPatchLevel(tag_ln)->findConnector( + *d_hierarchy->getPatchLevel(tag_ln + 1), + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln + 1, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false), true, - zero_vec); + zero_vec, + false); } /* @@ -1502,24 +1576,24 @@ GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( bool initial_time = false; double level_regrid_start_time = 0.; - if (regrid_start_time.getSize() < tag_ln + 1) { - tbox::IEEE::setNaN(level_regrid_start_time); - } else { - level_regrid_start_time = regrid_start_time[tag_ln]; - } - - if (d_barrier_and_time) { - t_misc1->stop(); + if (d_tag_init_strategy->usesTimeIntegration(regrid_cycle, regrid_time)) { + if (static_cast(regrid_start_time.size()) < tag_ln + 1) { + TBOX_ERROR("GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid:\n" + << "no regrid_start_time specified for level " << tag_ln + << "." << std::endl); + } else { + level_regrid_start_time = regrid_start_time[tag_ln]; + } } if (d_barrier_and_time) { t_tag_cells_for_refinement->barrierAndStart(); } - d_tag_init_strategy-> - tagCellsForRefinement(d_hierarchy, + d_tag_init_strategy->tagCellsForRefinement(d_hierarchy, tag_ln, + regrid_cycle, regrid_time, - d_tag_indx, + d_user_tag_indx, initial_time, coarsest_sync_level, d_hierarchy->levelCanBeRefined(tag_ln), @@ -1533,8 +1607,13 @@ GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( * except if user specified that the violating tags be ignored. */ if (d_check_nonrefined_tags != 'i') { - checkNonrefinedTags(*tag_level, tag_ln); + checkNonrefinedTags(*tag_level, tag_ln, d_oca); } + + tag_level->allocatePatchData(d_boolean_tag_indx, regrid_time); + setBooleanTagData(tag_level, false); + + t_regrid_finer_do_tagging_before->stop(); } /* @@ -1544,26 +1623,23 @@ GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid( */ void GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid( - hier::Connector& tag_to_finer, - hier::Connector& finer_to_tag, + boost::shared_ptr& tag_to_finer, const int tag_ln, - const tbox::Array& tag_buffer) + const std::vector& tag_buffer, + double regrid_time) { if (d_print_steps) { tbox::plog - << "GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid: entered with tag_ln = " + << + "GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid: entered with tag_ln = " << tag_ln << "\n"; } + t_regrid_finer_do_tagging_after->start(); + const int new_ln = tag_ln + 1; const boost::shared_ptr& tag_level( d_hierarchy->getPatchLevel(tag_ln)); - const hier::OverlapConnectorAlgorithm oca; - const hier::BoxLevelConnectorUtils mblc_utils; - - if (d_barrier_and_time) { - t_misc2->barrierAndStart(); - } /* * Buffer true tagged cells by specified amount which should be @@ -1572,14 +1648,14 @@ GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid( */ hier::IntVector max_descriptor_ghosts( - d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_dim)); + d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_hierarchy->getDim())); /* * If the tag buffer value passed into this method is greater than the * current ghost width of the data that handles tag buffering, then the * call to resetTagBufferingData resets that data to have a ghost width * equal to the tag buffer. - */ + */ if (tag_buffer[tag_ln] > d_buf_tag_ghosts.max()) { resetTagBufferingData(tag_buffer[tag_ln]); } @@ -1589,7 +1665,7 @@ GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid( d_bdry_fill_tags->createSchedule(tag_level, d_mb_tagger_strategy); t_bdry_fill_tags_create->stop(); - tag_level->allocatePatchData(d_buf_tag_indx); + tag_level->allocatePatchData(d_buf_tag_indx, regrid_time); bufferTagsOnLevel(d_true_tag, tag_level, tag_buffer[tag_ln]); /* @@ -1618,53 +1694,63 @@ GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid( t_second_finer_tagging->start(); } - const hier::Connector& tag_to_old = d_hierarchy->getConnector(tag_ln, new_ln); - const hier::Connector& old_to_finer = d_hierarchy->getConnector(new_ln, new_ln + 1); - const hier::Connector& finer_to_old = d_hierarchy->getConnector(new_ln + 1, new_ln); - const hier::Connector& old_to_tag = d_hierarchy->getConnector(new_ln, tag_ln); - oca.bridge( + const hier::Connector& tag_to_old = + d_hierarchy->getPatchLevel(tag_ln)->findConnectorWithTranspose( + *d_hierarchy->getPatchLevel(new_ln), + d_hierarchy->getRequiredConnectorWidth(tag_ln, new_ln, true), + d_hierarchy->getRequiredConnectorWidth(new_ln, tag_ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); + const hier::Connector& old_to_finer = + d_hierarchy->getPatchLevel(new_ln)->findConnectorWithTranspose( + *d_hierarchy->getPatchLevel(new_ln + 1), + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln + 1, true), + d_hierarchy->getRequiredConnectorWidth(new_ln + 1, new_ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); + d_oca.bridge( tag_to_finer, - finer_to_tag, tag_to_old, old_to_finer, - finer_to_old, - old_to_tag); + true); // Nesting buffer in resolution of level new_ln+1. const hier::IntVector nesting_buffer = d_hierarchy->getRatioToCoarserLevel(new_ln + 1) * d_hierarchy->getProperNestingBuffer(tag_ln + 1); -#ifdef DEBUG_CHECK_ASSERTIONS - oca.assertOverlapCorrectness(tag_to_finer, false, true, true); - oca.assertOverlapCorrectness(finer_to_tag, false, true, true); TBOX_ASSERT( - tag_to_finer.getConnectorWidth() + tag_to_finer->getConnectorWidth() * d_hierarchy->getRatioToCoarserLevel(tag_ln + 1) * d_hierarchy->getRatioToCoarserLevel(new_ln + 1) >= nesting_buffer); -#endif // Add periodic relationships in tag_to_finer. - hier::BoxLevel dummy_finer_mapped_box_level = finer_to_old.getBase(); - mblc_utils.addPeriodicImagesAndRelationships( - dummy_finer_mapped_box_level, - finer_to_tag, - tag_to_finer, + hier::BoxLevel dummy_finer_box_level = + old_to_finer.getTranspose().getBase(); + d_blcu.addPeriodicImagesAndRelationships( + dummy_finer_box_level, + tag_to_finer->getTranspose(), d_hierarchy->getGridGeometry()->getDomainSearchTree(), - d_hierarchy->getConnector(tag_ln, tag_ln)); - -#ifdef DEBUG_CHECK_ASSERTIONS - oca.assertOverlapCorrectness(tag_to_finer, false, true, false); - oca.assertOverlapCorrectness(finer_to_tag, false, true, false); -#endif + d_hierarchy->getPatchLevel(tag_ln)->findConnector( + *d_hierarchy->getPatchLevel(tag_ln), + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false)); fillTagsFromBoxLevel( - d_true_tag, + d_from_fine_tag, tag_level, - d_tag_indx, - tag_to_finer, + d_user_tag_indx, + *tag_to_finer, true, - nesting_buffer); + nesting_buffer, + true); + /* + * New tags may have been added to user tags via the above step. + * Here we set algorithmic tags at those new locations without + * overwriting any algorithmic tags that already exist. + */ + setBooleanTagData(tag_level, true); if (d_barrier_and_time) { t_second_finer_tagging->stop(); @@ -1674,9 +1760,7 @@ GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid( tag_level->deallocatePatchData(d_buf_tag_indx); - if (d_barrier_and_time) { - t_misc2->stop(); - } + t_regrid_finer_do_tagging_after->stop(); } /* @@ -1689,47 +1773,60 @@ void GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel( const int tag_ln, const double regrid_time, - hier::Connector* tag_to_new, - hier::Connector* new_to_tag, - const hier::Connector& tag_to_finer, - const hier::Connector& finer_to_tag) + boost::shared_ptr& tag_to_new, + boost::shared_ptr tag_to_finer, + boost::shared_ptr new_box_level) { - /* - * Compute self-Connector for the new level. - */ +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(tag_to_finer); +#endif + TBOX_ASSERT(tag_to_new && tag_to_new->hasTranspose()); + TBOX_ASSERT(new_box_level); + if (d_print_steps) { tbox::plog - << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: bridge links\n"; + << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: starting\n"; } + t_regrid_finer_create_and_install->start(); + + hier::Connector& new_to_tag = tag_to_new->getTranspose(); + + /* + * Compute self-Connector for the new level. + */ + + const tbox::Dimension& dim = d_hierarchy->getDim(); + const int new_ln = tag_ln + 1; + TBOX_ASSERT(!d_hierarchy->levelExists(new_ln + 1) || tag_to_finer); + TBOX_ASSERT(!d_hierarchy->levelExists(new_ln + 1) || tag_to_finer->hasTranspose()); const boost::shared_ptr& tag_level( d_hierarchy->getPatchLevel(tag_ln)); - const hier::BoxLevel& new_mapped_box_level(tag_to_new->getHead()); - const hier::OverlapConnectorAlgorithm oca; - const hier::BoxLevelConnectorUtils mblc_utils; - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); + const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); - hier::Connector* new_to_new = new hier::Connector; + boost::shared_ptr new_to_new; - t_bridge_links->start(); - t_bridge_new_to_new->start(); + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: bridging for new<==>new\n"; + } - oca.bridgeWithNesting( - *new_to_new, - *new_to_new, - *new_to_tag, - *tag_to_new, - *new_to_tag, + if (d_barrier_and_time) { + t_bridge_new_to_new->barrierAndStart(); + } + d_oca.bridgeWithNesting( + new_to_new, + new_to_tag, *tag_to_new, zero_vector, zero_vector, - d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln)); - new_to_new->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - - t_bridge_new_to_new->stop(); - t_bridge_links->stop(); + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln, true), + false); + if (d_barrier_and_time) { + t_bridge_new_to_new->barrierAndStop(); + } TBOX_ASSERT(new_to_new->getConnectorWidth() == d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln)); @@ -1739,8 +1836,9 @@ GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel( } if (d_barrier_and_time) { - t_regrid_finer_create->barrierAndStart(); + new_box_level->getMPI().Barrier(); } + t_regrid_finer_create->start(); /* * Either remove pre-existing fine level from hierarchy and make @@ -1753,202 +1851,217 @@ GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel( */ boost::shared_ptr old_fine_level; - boost::shared_ptr old_mapped_box_level; - const hier::Connector* old_to_tag = NULL; - const hier::Connector* tag_to_old = NULL; + boost::shared_ptr old_box_level; + const hier::Connector* old_to_tag = 0; hier::IntVector ratio(tag_level->getRatioToLevelZero() * d_hierarchy->getRatioToCoarserLevel(new_ln)); if (d_hierarchy->finerLevelExists(tag_ln)) { - old_mapped_box_level = d_hierarchy->getBoxLevel(new_ln); - old_to_tag = &d_hierarchy->getConnector(new_ln, tag_ln); - tag_to_old = &d_hierarchy->getConnector(tag_ln, new_ln); + old_box_level = d_hierarchy->getBoxLevel(new_ln); + old_to_tag = + &d_hierarchy->getPatchLevel(new_ln)->findConnectorWithTranspose( + *d_hierarchy->getPatchLevel(tag_ln), + d_hierarchy->getRequiredConnectorWidth(new_ln, tag_ln, true), + d_hierarchy->getRequiredConnectorWidth(tag_ln, new_ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); old_fine_level = d_hierarchy->getPatchLevel(new_ln); - d_hierarchy->removePatchLevel(new_ln); - // ratio = old_fine_level->getRatioToLevelZero(); TBOX_ASSERT(ratio == old_fine_level->getRatioToLevelZero()); } - if (d_hierarchy->levelExists(new_ln + 1)) { - if (d_check_proper_nesting) { + if (d_check_proper_nesting && d_hierarchy->levelExists(new_ln + 1)) { + /* + * Check that the new_box_level nests the next finer + * level (new_ln+1). + */ - /* - * Check that the new_mapped_box_level nests the next finer - * level (new_ln+1). - */ + hier::IntVector required_nesting(dim, d_hierarchy->getProperNestingBuffer(new_ln)); + required_nesting *= d_hierarchy->getRatioToCoarserLevel(new_ln + 1); - hier::IntVector required_nesting(d_dim, d_hierarchy->getProperNestingBuffer(new_ln)); - required_nesting *= d_hierarchy->getRatioToCoarserLevel(new_ln + 1); - - bool locally_nests = false; - const bool finer_nests_in_new = - mblc_utils.baseNestsInHead( - &locally_nests, - *d_hierarchy->getBoxLevel(new_ln + 1), - new_mapped_box_level, - required_nesting, - zero_vector, - zero_vector, - &d_hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); - - if (!finer_nests_in_new) { - - tbox::perr << "GriddingAlgorithm: new mapped_box_level\n" - << "at ln=" << new_ln - << " does not properly nest\n" - << "existing finer mapped_box_level at ln=" - << new_ln + 1 - << " by the required nesting buffer of " - << required_nesting << " in fine resolution.\n" - << "Local nestingness: " << locally_nests - << ".\nWriting BoxLevels out to log file." - << std::endl; - tbox::plog - << "Proper nesting violation with new_mapped_box_level of\n" - << new_mapped_box_level.format("N->", 2) - << "Proper nesting violation with finer mapped_box_level of\n" + bool locally_nests = false; + const bool finer_nests_in_new = + d_blcu.baseNestsInHead( + &locally_nests, + *d_hierarchy->getBoxLevel(new_ln + 1), + *new_box_level, + required_nesting, + zero_vector, + zero_vector, + &d_hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); + + if (!finer_nests_in_new) { + + tbox::perr + << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: new box_level\n" + << "at ln=" << new_ln + << " does not properly nest\n" + << "existing finer box_level at ln=" + << new_ln + 1 + << " by the required nesting buffer of " + << required_nesting << " in fine resolution.\n" + << "Local nestingness: " << locally_nests + << ".\nWriting BoxLevels out to log file." + << std::endl; + tbox::plog + << "Proper nesting violation with new_box_level of\n" + << new_box_level->format("N->", 2) + << "Proper nesting violation with finer box_level of\n" << d_hierarchy->getBoxLevel(new_ln + 1)->format("F->", 2); - hier::BoxLevel external(d_dim); - hier::Connector finer_to_external; - hier::Connector finer_to_new( - *d_hierarchy->getBoxLevel(new_ln + 1), - new_mapped_box_level, - required_nesting); - const hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(finer_to_new); - tbox::plog << "Finer to new:\n" << finer_to_new.format("FN->", 3); - mblc_utils.computeExternalParts( - external, - finer_to_external, - finer_to_new, - -required_nesting, - d_hierarchy->getGridGeometry()->getDomainSearchTree()); - tbox::plog << "External parts:\n" << finer_to_external.format("FE->", 3); - - TBOX_ERROR( - "Internal library error: Failed to produce proper nesting."); + boost::shared_ptr external; + boost::shared_ptr finer_to_external; + boost::shared_ptr finer_to_new; + d_oca.findOverlaps(finer_to_new, + *d_hierarchy->getBoxLevel(new_ln + 1), + *new_box_level, + required_nesting); + tbox::plog << "Finer to new:\n" << finer_to_new->format("FN->", 3); + d_blcu.computeExternalParts( + external, + finer_to_external, + *finer_to_new, + -required_nesting, + d_hierarchy->getGridGeometry()->getDomainSearchTree()); + tbox::plog << "External parts:\n" << finer_to_external->format("FE->", 3); - } /* !finer_nests_in_new */ - - } /* d_check_proper_nesting */ + TBOX_ERROR( + "Internal library error: Failed to produce proper nesting." + << std::endl); - } /* d_hierarchy->levelExists(new_ln + 1) */ + } /* !finer_nests_in_new */ - d_hierarchy->makeNewPatchLevel(new_ln, new_mapped_box_level); + } /* d_check_proper_nesting */ /* * Cache Connectors for new level. */ - boost::shared_ptr new_level( - d_hierarchy->getPatchLevel(new_ln)); - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - new_to_new); - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *tag_level->getBoxLevel(), - new_to_tag); - tag_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - tag_to_new); + new_box_level->cacheConnector(new_to_new); + tag_level->cacheConnector(tag_to_new); + + boost::shared_ptr old_to_new; + if (old_box_level) { - if (d_hierarchy->levelExists(new_ln + 1)) { + /* + * Connect old to new by bridging. + * + * Cache these Connectors for use when creating schedules to + * transfer data from old to new. + */ + + if (d_print_steps) { + tbox::plog + << + "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: bridging for new<==>old\n"; + } + + if (d_barrier_and_time) { + t_bridge_new_to_old->barrierAndStart(); + } + d_oca.bridgeWithNesting( + old_to_new, + *old_to_tag, + d_hierarchy->getPatchLevel(tag_ln)->getBoxLevel()->findConnectorWithTranspose( + *new_box_level, + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln + 1, true), + d_hierarchy->getRequiredConnectorWidth(tag_ln + 1, tag_ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false), + zero_vector, + zero_vector, + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln, true), + true); + if (d_barrier_and_time) { + t_bridge_new_to_old->barrierAndStop(); + } + + old_fine_level->cacheConnector(old_to_new); + + } + + if (d_hierarchy->levelExists(new_ln + 1)) { /* * There is a level finer than new_ln. Connect the new level to * the finer level. */ - hier::Connector* new_to_finer = new hier::Connector; - hier::Connector* finer_to_new = new hier::Connector; - - t_bridge_new_to_finer->start(); - oca.bridgeWithNesting( - *new_to_finer, - *finer_to_new, - *new_to_tag, - tag_to_finer, - finer_to_tag, - *tag_to_new, + + if (d_print_steps) { + tbox::plog + << + "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: bridging for new<==>finer\n"; + } + + const hier::Connector& old_to_finer = + d_hierarchy->getPatchLevel(new_ln)->getBoxLevel()->findConnectorWithTranspose( + *d_hierarchy->getPatchLevel(new_ln + 1)->getBoxLevel(), + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln + 1), + d_hierarchy->getRequiredConnectorWidth(new_ln + 1, new_ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE); + boost::shared_ptr new_to_finer; + + if (d_barrier_and_time) { + t_bridge_new_to_finer->barrierAndStart(); + } + d_oca.bridgeWithNesting( + new_to_finer, + old_to_new->getTranspose(), + old_to_finer, + -hier::IntVector::getOne(dim), zero_vector, - -hier::IntVector::getOne(d_dim), - d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln + 1)); - new_to_finer->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - finer_to_new->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - t_bridge_new_to_finer->stop(); + d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln + 1, true), + true); + if (d_barrier_and_time) { + t_bridge_new_to_finer->barrierAndStop(); + } + +#ifdef DEBUG_CHECK_ASSERTIONS + hier::Connector& finer_to_new = new_to_finer->getTranspose(); +#endif TBOX_ASSERT( new_to_finer->getConnectorWidth() == d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln + 1)); TBOX_ASSERT( - finer_to_new->getConnectorWidth() == + finer_to_new.getConnectorWidth() == d_hierarchy->getRequiredConnectorWidth(new_ln + 1, new_ln)); #ifdef DEBUG_CHECK_ASSERTIONS - oca.assertOverlapCorrectness(*new_to_finer, false, true, true); - oca.assertOverlapCorrectness(*finer_to_new, false, true, true); + new_to_finer->assertOverlapCorrectness(false, true, true); + finer_to_new.assertOverlapCorrectness(false, true, true); #endif boost::shared_ptr finer_level( d_hierarchy->getPatchLevel(new_ln + 1)); - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *finer_level->getBoxLevel(), - new_to_finer); - - finer_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - finer_to_new); + new_box_level->cacheConnector(new_to_finer); } - if (old_mapped_box_level) { - - /* - * Connect old to new by bridging. - * - * Cache these Connectors for use when creating schedules to - * transfer data from old to new. - */ - - hier::Connector* old_to_new = new hier::Connector; - hier::Connector* new_to_old = new hier::Connector; - t_bridge_new_to_old->start(); - oca.bridgeWithNesting( - *old_to_new, - *new_to_old, - *old_to_tag, - d_hierarchy->getConnector(tag_ln, tag_ln + 1), - d_hierarchy->getConnector(tag_ln + 1, tag_ln), - *tag_to_old, - zero_vector, - zero_vector, - d_hierarchy->getRequiredConnectorWidth(new_ln, new_ln)); - old_to_new->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - new_to_old->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - t_bridge_new_to_old->stop(); - - new_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *old_fine_level->getBoxLevel(), - new_to_old); - old_fine_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *new_level->getBoxLevel(), - old_to_new); + d_tag_init_strategy->processHierarchyBeforeAddingNewLevel(d_hierarchy, + new_ln, + new_box_level); + if (old_box_level) { + d_hierarchy->removePatchLevel(new_ln); } + d_hierarchy->makeNewPatchLevel(new_ln, new_box_level); d_hierarchy->getGridGeometry()->adjustMultiblockPatchLevelBoundaries( *d_hierarchy->getPatchLevel(new_ln)); + t_regrid_finer_create->stop(); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: initializing level data\n"; + } + + if (d_barrier_and_time) { + t_initialize_level_data->barrierAndStart(); + } // "false" argument": const bool initial_time = false; d_tag_init_strategy->initializeLevelData(d_hierarchy, new_ln, @@ -1956,14 +2069,116 @@ GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel( d_hierarchy->levelCanBeRefined(new_ln), false, old_fine_level); + if (d_barrier_and_time) { + t_initialize_level_data->barrierAndStop(); + } + + if (new_ln > 0 && d_save_tag_data) { + boost::shared_ptr new_level( + d_hierarchy->getPatchLevel(new_ln)); + + new_level->allocatePatchData(d_saved_tag_indx); + + d_saved_tags_sched = + d_fill_saved_tags->createSchedule( + boost::shared_ptr( + new xfer::PatchLevelInteriorFillPattern()), + d_hierarchy->getPatchLevel(new_ln), + boost::shared_ptr(), + new_ln-1, + d_hierarchy); + + d_saved_tags_sched->fillData(regrid_time, false); + + d_tag_init_strategy->checkNewLevelTagData(d_hierarchy, + new_ln, + d_saved_tag_indx); + + } /* * Destroy old patch level, if such a level existed prior to regrid. */ old_fine_level.reset(); - if (d_barrier_and_time) { - t_regrid_finer_create->stop(); + + t_regrid_finer_create_and_install->stop(); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel: returning\n"; + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +GriddingAlgorithm::computeTagToClusterWidths() +{ + TBOX_ASSERT(d_tag_to_cluster_width.empty()); // Never recompute. + + const tbox::Dimension& dim = d_hierarchy->getDim(); + + d_tag_to_cluster_width.resize(d_hierarchy->getMaxNumberOfLevels() - 1, + hier::IntVector::getZero(dim)); + + const size_t nblocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); + + for (int ln = d_hierarchy->getMaxNumberOfLevels() - 2; ln >= 0; --ln) { + /* + * Construct list of boxes covering the true tags on the level. + * Note that box list will be contained in the bounding box + * but will not be contained in the list of proper nesting boxes, + * in general. So we intersect the box list against the list of + * nesting boxes. Note that this may produce boxes which are too + * small. Thus, boxes are regrown later. + */ + + hier::IntVector smallest_patch(dim); + hier::IntVector smallest_box_to_refine(dim, 0, nblocks); + hier::IntVector largest_patch(dim); + hier::IntVector extend_ghosts(dim); + // "true" argument: for_building_finer level = true + getGriddingParameters(smallest_patch, + smallest_box_to_refine, + largest_patch, + extend_ghosts, + ln + 1, + true); + const hier::IntVector extend_ghosts_in_tag_space = + hier::IntVector::ceilingDivide(extend_ghosts, + d_hierarchy->getRatioToCoarserLevel(ln + 1)); + + /* + * Compute the width for tag<==>cluster. This width be wide enough to + * guarantee completeness for tag<==>new when we massage the + * cluster into the new level. In the massage step, we grow the new boxes. + * The width of tag<==>cluster must be big enough to see new overlaps + * generated by the growths. + */ + d_tag_to_cluster_width[ln] = + d_hierarchy->getRequiredConnectorWidth(ln, ln + 1); + + // For width of d_tag_to_cluster_width[ln+1] in bridge new<==>tag<==>new + if (ln + 1 < static_cast(d_tag_to_cluster_width.size())) { + d_tag_to_cluster_width[ln].max( + hier::IntVector::ceilingDivide(d_tag_to_cluster_width[ln + 1], + d_hierarchy->getRatioToCoarserLevel(ln + 1))); + } + + if (d_extend_to_domain_boundary) { + // For extending boxes to domain boundary by amount of extend_ghosts_in_tag_space. + d_tag_to_cluster_width[ln] += extend_ghosts_in_tag_space; + } + // For growing within domain by amount of smallest_box_to_refine. + d_tag_to_cluster_width[ln] += smallest_box_to_refine; } + + d_connector_width_requestor.setTagToClusterWidth(d_tag_to_cluster_width); + + // Commit to computing the widths required by the hierarchy. + d_hierarchy->getRequiredConnectorWidth(0, 0, true); } /* @@ -1975,7 +2190,7 @@ GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel( */ size_t GriddingAlgorithm::checkBoundaryProximityViolation( - const hier::BoxLevel& mapped_box_level, + const hier::BoxLevel& box_level, const hier::IntVector& extend_ghosts) const { /* @@ -1989,42 +2204,46 @@ GriddingAlgorithm::checkBoundaryProximityViolation( */ const hier::BaseGridGeometry& grid_geometry( - *d_hierarchy->getGridGeometry()); + *d_hierarchy->getGridGeometry()); const hier::BoxContainer& periodic_domain_search_tree( grid_geometry.getPeriodicDomainSearchTree()); hier::BoxContainer refined_periodic_domain_search_tree( periodic_domain_search_tree); - refined_periodic_domain_search_tree.refine(mapped_box_level.getRefinementRatio()); + refined_periodic_domain_search_tree.refine(box_level.getRefinementRatio()); refined_periodic_domain_search_tree.makeTree(&grid_geometry); size_t nerr(0); - for (hier::RealBoxConstIterator bi(mapped_box_level.getBoxes().realBegin()); - bi != mapped_box_level.getBoxes().realEnd(); ++bi) { + const tbox::Dimension& dim = d_hierarchy->getDim(); + for (hier::RealBoxConstIterator bi(box_level.getBoxes().realBegin()); + bi != box_level.getBoxes().realEnd(); ++bi) { hier::BoxContainer external_parts(*bi); external_parts.grow(extend_ghosts); external_parts.removeIntersections( - mapped_box_level.getRefinementRatio(), + box_level.getRefinementRatio(), refined_periodic_domain_search_tree); - for (hier::BoxContainer::iterator bli(external_parts); + for (hier::BoxContainer::iterator bli = external_parts.begin(); bli != external_parts.end(); ++bli) { - hier::IntVector leftover_size((*bli).numberCells()); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (leftover_size(d) != 0 && leftover_size(d) < extend_ghosts(d)) { + hier::IntVector extend( + extend_ghosts.getBlockVector(bli->getBlockId())); + hier::IntVector leftover_size(bli->numberCells()); + for (int d = 0; d < dim.getValue(); ++d) { + if (leftover_size(d) != 0 && leftover_size(d) < extend(d)) { ++nerr; - TBOX_WARNING("GriddingAlgorithm::makeFinerLevel:\n" + TBOX_WARNING("GriddingAlgorithm::checkBoundaryProximityViolation:\n" << "User-specified box (refined) " << *bi << " violates boundary proximity.\n" - << "In dimension " << d << ", it is " - << extend_ghosts(d) - leftover_size(d) + << "In direction " << d << ", it is " + << extend(d) - leftover_size(d) << " cells from a physical domain boundary.\n" - << "All boxes must be at least " << extend_ghosts - << " from physical boundaries or touching the physical boundary."); + << "All boxes must be at least " << extend + << " from physical boundaries or touching the physical boundary." + << std::endl); } } } @@ -2041,12 +2260,15 @@ GriddingAlgorithm::checkBoundaryProximityViolation( */ void GriddingAlgorithm::checkDomainBoxes(const hier::BoxContainer& domain_boxes) const { + const tbox::Dimension& dim = d_hierarchy->getDim(); - hier::IntVector smallest_patch(d_dim); - hier::IntVector largest_patch(d_dim); - hier::IntVector extend_ghosts(d_dim); + const size_t nblocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); + + hier::IntVector smallest_patch(dim); + hier::IntVector largest_patch(dim); + hier::IntVector extend_ghosts(dim); { - hier::IntVector smallest_box_to_refine(d_dim); + hier::IntVector smallest_box_to_refine(dim, 0, nblocks); // "false" argument: for_building_finer level = false getGriddingParameters( smallest_patch, @@ -2061,11 +2283,11 @@ GriddingAlgorithm::checkDomainBoxes(const hier::BoxContainer& domain_boxes) cons * Check minimum size violations. */ int i = 0; - for (hier::BoxContainer::const_iterator itr(domain_boxes); + for (hier::BoxContainer::const_iterator itr = domain_boxes.begin(); itr != domain_boxes.end(); ++itr, ++i) { hier::Box test_box = *itr; - for (int dir = 0; dir < d_dim.getValue(); dir++) { + for (tbox::Dimension::dir_t dir = 0; dir < dim.getValue(); ++dir) { if (test_box.numberCells(dir) < smallest_patch(dir)) { @@ -2092,8 +2314,9 @@ GriddingAlgorithm::checkDomainBoxes(const hier::BoxContainer& domain_boxes) cons << "\ndomain Box " << i << ", " << test_box << ", violates the minimum patch size constraints." << "\nVerify that boxes are larger than" - << "the maximum ghost width and/or" - << "\nthe specified minimum patch size." + << " the maximum ghost width and/or" + << "\nthe specified minimum patch size, " + << smallest_patch << "." << std::endl); } } @@ -2102,12 +2325,12 @@ GriddingAlgorithm::checkDomainBoxes(const hier::BoxContainer& domain_boxes) cons /* * Check for overlapping boxes. - * TODO: This check only works for single-block. */ if (domain_boxes.boxesIntersect()) { TBOX_ERROR(d_object_name << ": " << "Boxes specified for coarsest level " - << "contain intersections with each other!"); + << "contain intersections with each other!" + << std::endl); } /* @@ -2117,7 +2340,8 @@ GriddingAlgorithm::checkDomainBoxes(const hier::BoxContainer& domain_boxes) cons && (!d_tag_init_strategy->coarsestLevelBoxesOK(domain_boxes))) { TBOX_ERROR(d_object_name << ": " << "level gridding strategy encountered" - << " a problem with the domain boxes!"); + << " a problem with the domain boxes!" + << std::endl); } } @@ -2132,39 +2356,39 @@ GriddingAlgorithm::checkNonnestingUserBoxes( const hier::IntVector& nesting_buffer) const { - const hier::BoxLevel& new_mapped_box_level(new_to_tag.getBase()); + const hier::BoxLevel& new_box_level(new_to_tag.getBase()); - hier::BoxLevel violating_parts(d_dim); - hier::Connector new_to_violating_parts; + boost::shared_ptr violating_parts; + boost::shared_ptr new_to_violating_parts; - hier::BoxLevelConnectorUtils mblc_utils; - mblc_utils.computeExternalParts( + d_blcu.computeExternalParts( violating_parts, new_to_violating_parts, new_to_tag, -nesting_buffer, d_hierarchy->getGridGeometry()->getDomainSearchTree()); - if (violating_parts.getGlobalNumberOfBoxes() > 0) { + if (violating_parts->getGlobalNumberOfBoxes() > 0) { - tbox::perr << "GriddingAlgorihtm: user-specified refinement boxes\n" - << "violates nesting requirement. Diagnostics will be\n" - << "writen to log files." << std::endl; + tbox::perr + << "GriddingAlgorihtm::checkNonnestingUserBoxes: user-specified refinement boxes\n" + << "violates nesting requirement. Diagnostics will be\n" + << "writen to log files." << std::endl; const std::string left_margin("ERR: "); tbox::plog << left_margin << "Tag BoxLevel:\n" << new_to_tag.getHead().format(left_margin, 2) - << left_margin << "User-specified boxes:\n" << new_mapped_box_level.format(left_margin, 2) - << left_margin << "Violating parts:\n" << violating_parts.format(left_margin, 2) + << left_margin << "User-specified boxes:\n" << new_box_level.format(left_margin, 2) + << left_margin << "Violating parts:\n" << violating_parts->format(left_margin, 2) << left_margin << "User-specified boxes and their violating parts:\n" - << new_to_violating_parts.format(left_margin, 2); + << new_to_violating_parts->format(left_margin, 2); if (d_check_nonnesting_user_boxes == 'e') { - TBOX_ERROR("Exiting due to above error"); + TBOX_ERROR("Exiting due to above error" << std::endl); } if (d_check_nonnesting_user_boxes == 'w') { TBOX_WARNING("Proceeding with nesting violation as requested.\n" << "SAMRAI is not guaranteed to work with nesting" - << "violations!"); + << "violations!" << std::endl); } } @@ -2178,12 +2402,15 @@ GriddingAlgorithm::checkNonnestingUserBoxes( void GriddingAlgorithm::checkBoundaryProximityViolation( const int tag_ln, - const hier::BoxLevel& new_mapped_box_level) const + const hier::BoxLevel& new_box_level) const { - hier::IntVector extend_ghosts(d_dim); - hier::IntVector smallest_patch(d_dim); - hier::IntVector smallest_box_to_refine(d_dim); - hier::IntVector largest_patch(d_dim); + const size_t nblocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); + + const tbox::Dimension& dim = d_hierarchy->getDim(); + hier::IntVector extend_ghosts(dim); + hier::IntVector smallest_patch(dim); + hier::IntVector smallest_box_to_refine(dim, 0, nblocks); + hier::IntVector largest_patch(dim); getGriddingParameters(smallest_patch, smallest_box_to_refine, largest_patch, @@ -2193,14 +2420,15 @@ GriddingAlgorithm::checkBoundaryProximityViolation( const size_t nerr( checkBoundaryProximityViolation( - new_mapped_box_level, + new_box_level, extend_ghosts)); if (nerr > 0 && d_check_boundary_proximity_violation == 'e') { - TBOX_ERROR("GriddingAlgorithm::makeFinerLevel: User error:\n" + TBOX_ERROR("GriddingAlgorithm::checkBoundaryProximityViolation: User error:\n" << "Making level " << tag_ln + 1 << ".\n" << "New boxes violate boundary proximity.\n" << "All boxes must be at least " << extend_ghosts - << " from physical boundaries or touching the physical boundary."); + << " from physical boundaries or touching the physical boundary." + << std::endl); } } @@ -2268,44 +2496,45 @@ GriddingAlgorithm::printStatistics( } s << - " Seq# SimTime C-Sum C-Avg C-Min -> C-Max C-NormDiff B-Sum B-Avg B-Min -> B-Max B-NormDiff C/B-Avg\n"; + "Seq# SimTime C-Sum C-Avg C-Min -> C-Max C-Max/Avg B-Sum B-Avg B-Min -> B-Max B-Max/Avg C/B-Avg\n"; #ifdef __INTEL_COMPILER #pragma warning (disable:1572) #endif for (int sn = 0; sn < cstat.getStatSequenceLength(); ++sn) { - double csum = statn->getGlobalProcStatSum(cstat.getInstanceId(), sn); - double cmax = statn->getGlobalProcStatMax(cstat.getInstanceId(), sn); - double cmin = statn->getGlobalProcStatMin(cstat.getInstanceId(), sn); - double cdiffnorm = cmax != 0 ? 1.0 - cmin / cmax : 0; - double bsum = statn->getGlobalProcStatSum(bstat.getInstanceId(), sn); - double bmax = statn->getGlobalProcStatMax(bstat.getInstanceId(), sn); - double bmin = statn->getGlobalProcStatMin(bstat.getInstanceId(), sn); - double bdiffnorm = bmax != 0 ? 1.0 - bmin / bmax : 0; - double stime = statn->getGlobalProcStatMin( + const double csum = statn->getGlobalProcStatSum(cstat.getInstanceId(), sn); + const double cmax = statn->getGlobalProcStatMax(cstat.getInstanceId(), sn); + const double cmin = statn->getGlobalProcStatMin(cstat.getInstanceId(), sn); + const double cavg = csum / mpi.getSize(); + const double cmaxnorm = cavg != 0 ? cmax / cavg : 1; + const double bsum = statn->getGlobalProcStatSum(bstat.getInstanceId(), sn); + const double bmax = statn->getGlobalProcStatMax(bstat.getInstanceId(), sn); + const double bmin = statn->getGlobalProcStatMin(bstat.getInstanceId(), sn); + const double bavg = bsum / mpi.getSize(); + const double bmaxnorm = bavg != 0 ? bmax / bavg : 1; + const double stime = statn->getGlobalProcStatMin( tstat.getInstanceId(), sn); - s << std::setw(3) << sn << " " - << std::scientific << std::setprecision(6) << std::setw(12) - << stime - << " " - << std::fixed << std::setprecision(0) - << std::setw(10) << csum << " " - << std::setw(10) << csum / mpi.getSize() << " " - << std::setw(10) << cmin << " -> " - << std::setw(10) << cmax - << " " << std::setw(4) << std::setprecision(4) << cdiffnorm - << " " - << std::fixed << std::setprecision(0) - << std::setw(6) << bsum << " " - << std::setw(5) << bsum / mpi.getSize() << " " - << std::setw(5) << bmin << " ->" - << std::setw(5) << bmax - << " " << std::setw(4) << std::setprecision(4) << bdiffnorm - << std::setw(10) << std::setprecision(0) - << (bsum != 0 ? csum / bsum : 0) + s << std::setw(4) << sn + << " " << std::scientific << std::setprecision(6) << std::setw(12) << stime + << " " << std::fixed << std::setprecision(0) << std::setw(12) << csum + << " " << std::setw(7) << cavg + << " " << std::setw(7) << cmin + << " -> " << std::setw(10) << cmax + << " " << std::setw(9) << std::setprecision(2) << cmaxnorm + << " " << std::fixed << std::setprecision(0) + << std::setw(9) << bsum + << " " << std::fixed << std::setprecision(2) + << std::setw(7) << bavg + << " " << std::fixed << std::setprecision(0) + << std::setw(3) << bmin + << " -> " << std::setw(5) << bmax + << " " << std::setw(8) << std::setprecision(2) << bmaxnorm + << " " << std::setw(6) << std::setprecision(0) << (bsum != 0 ? csum / bsum : 0) << std::endl; } } } +#else + s << "GriddingAlgorithm statistics is disabled. See GA_RECORD_STATS in GriddingAlgorithm.h\n"; #endif } @@ -2323,39 +2552,48 @@ GriddingAlgorithm::printStatistics( void GriddingAlgorithm::checkNonrefinedTags( const hier::PatchLevel& level, - int tag_ln) const + int tag_ln, + const hier::OverlapConnectorAlgorithm& oca) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, level); +#ifdef DEBUG_CHECK_ASSERTIONS + const tbox::Dimension& dim = d_hierarchy->getDim(); +#endif + + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, level); - const hier::BoxLevel& tag_mapped_box_level = *d_hierarchy->getBoxLevel(tag_ln); - hier::BoxLevel violator(d_dim); - hier::Connector tag_to_violator; - const hier::Connector& tag_mapped_box_level_to_self = d_hierarchy->getConnector(tag_ln, - tag_ln); + const hier::BoxLevel& tag_box_level = *d_hierarchy->getBoxLevel(tag_ln); + boost::shared_ptr violator; + boost::shared_ptr tag_to_violator; + const hier::Connector& tag_box_level_to_self = + d_hierarchy->getPatchLevel(tag_ln)->findConnector( + *d_hierarchy->getPatchLevel(tag_ln), + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); computeNestingViolator( violator, tag_to_violator, - tag_mapped_box_level, - tag_mapped_box_level_to_self, - tag_mapped_box_level_to_self, - tag_ln); + tag_box_level, + tag_box_level_to_self, + tag_ln, + oca); /* * Check for user-tagged cells in the violating parts of the tag level. */ math::PatchCellDataBasicOps dataop; - math::PatchCellDataOpsInteger dataopi; int maxval = 0; - for (hier::Connector::ConstNeighborhoodIterator ei = tag_to_violator.begin(); - ei != tag_to_violator.end(); ++ei) { - const hier::BoxId& mapped_box_id = *ei; + for (hier::Connector::ConstNeighborhoodIterator ei = tag_to_violator->begin(); + ei != tag_to_violator->end(); ++ei) { + const hier::BoxId& box_id = *ei; boost::shared_ptr > tag_data( - level.getPatch(mapped_box_id)->getPatchData(d_tag_indx), - boost::detail::dynamic_cast_tag()); - for (hier::Connector::ConstNeighborIterator na = tag_to_violator.begin(ei); - na != tag_to_violator.end(ei); ++na) { - const hier::Box& vio_mapped_box = *na; - maxval = dataop.max(tag_data, vio_mapped_box); + BOOST_CAST, hier::PatchData>( + level.getPatch(box_id)->getPatchData(d_user_tag_indx))); + TBOX_ASSERT(tag_data); + for (hier::Connector::ConstNeighborIterator na = tag_to_violator->begin(ei); + na != tag_to_violator->end(ei); ++na) { + const hier::Box& vio_box = *na; + maxval = dataop.max(tag_data, vio_box); if (maxval > 0) { break; } @@ -2364,7 +2602,7 @@ GriddingAlgorithm::checkNonrefinedTags( break; } } - const tbox::SAMRAI_MPI mpi(tag_mapped_box_level.getMPI()); + const tbox::SAMRAI_MPI mpi(tag_box_level.getMPI()); if (mpi.getSize() > 1) { mpi.AllReduce(&maxval, 1, MPI_MAX); } @@ -2391,12 +2629,13 @@ GriddingAlgorithm::checkNonrefinedTags( void GriddingAlgorithm::resetTagBufferingData(const int tag_buffer) { - d_buf_tag_ghosts = hier::IntVector(d_dim, tag_buffer); + const tbox::Dimension& dim = d_hierarchy->getDim(); + + d_buf_tag_ghosts = hier::IntVector(dim, tag_buffer); d_bdry_fill_tags.reset(); - hier::VariableDatabase* var_db = - hier::VariableDatabase::getDatabase(); + hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); /* * Remove d_buf_tag from the VariableDatabase and re-register it with @@ -2404,18 +2643,15 @@ void GriddingAlgorithm::resetTagBufferingData(const int tag_buffer) */ var_db->removeInternalSAMRAIVariablePatchDataIndex(d_buf_tag_indx); - (*s_buf_tag_indx)[d_dim.getValue() - 1] = - var_db->registerInternalSAMRAIVariable(d_buf_tag, + d_buf_tag_indx = var_db->registerInternalSAMRAIVariable(d_buf_tag, d_buf_tag_ghosts); - d_buf_tag_indx = (*s_buf_tag_indx)[d_dim.getValue() - 1]; - if (d_hierarchy->getGridGeometry()->getNumberBlocks() > 1) { - TBOX_ASSERT(d_mb_tagger_strategy); + TBOX_ASSERT(d_mb_tagger_strategy); d_mb_tagger_strategy->setScratchTagPatchDataIndex(d_buf_tag_indx); } - d_bdry_fill_tags.reset(new xfer::RefineAlgorithm(d_dim)); + d_bdry_fill_tags.reset(new xfer::RefineAlgorithm()); d_bdry_fill_tags-> registerRefine(d_buf_tag_indx, @@ -2430,34 +2666,50 @@ void GriddingAlgorithm::resetTagBufferingData(const int tag_buffer) */ void GriddingAlgorithm::checkOverlappingPatches( - const hier::Connector& mapped_box_level_to_self) const + const hier::BoxLevel& box_level) const +{ + hier::Connector box_level_to_self( + box_level, + box_level, + hier::IntVector::getZero(box_level.getDim())); + hier::OverlapConnectorAlgorithm oca; + oca.findOverlaps_assumedPartition(box_level_to_self); + checkOverlappingPatches(box_level_to_self); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void +GriddingAlgorithm::checkOverlappingPatches( + const hier::Connector& box_level_to_self) const { bool has_overlap = false; - const hier::BoxLevel& mapped_box_level = mapped_box_level_to_self.getBase(); - const hier::BaseGridGeometry& grid_geom = - *mapped_box_level.getGridGeometry(); - const hier::IntVector& ratio = mapped_box_level.getRefinementRatio(); + const hier::BoxLevel& box_level = box_level_to_self.getBase(); + const hier::BaseGridGeometry& grid_geom = *box_level.getGridGeometry(); + const hier::IntVector& ratio = box_level.getRefinementRatio(); - for (hier::Connector::ConstNeighborhoodIterator ei = mapped_box_level_to_self.begin(); - ei != mapped_box_level_to_self.end() && !has_overlap; ++ei) { + for (hier::Connector::ConstNeighborhoodIterator ei = box_level_to_self.begin(); + ei != box_level_to_self.end() && !has_overlap; ++ei) { - const hier::Box& mapped_box = *mapped_box_level.getBoxStrict(*ei); + const hier::Box& box = *box_level.getBoxStrict(*ei); - for (hier::Connector::ConstNeighborIterator na = mapped_box_level_to_self.begin(ei); - na != mapped_box_level_to_self.end(ei) && !has_overlap; + for (hier::Connector::ConstNeighborIterator na = box_level_to_self.begin(ei); + na != box_level_to_self.end(ei) && !has_overlap; ++na) { const hier::Box& nabr = *na; - if (!nabr.isIdEqual(mapped_box)) { - if (nabr.getBlockId() == mapped_box.getBlockId()) { - has_overlap = nabr.intersects(mapped_box); + if (!nabr.isIdEqual(box)) { + if (nabr.getBlockId() == box.getBlockId()) { + has_overlap = nabr.intersects(box); } else { hier::Box nabr_box(nabr); grid_geom.transformBox(nabr_box, ratio, - mapped_box.getBlockId(), + box.getBlockId(), nabr.getBlockId()); - has_overlap = nabr_box.intersects(mapped_box); + has_overlap = nabr_box.intersects(box); } } } @@ -2494,20 +2746,19 @@ GriddingAlgorithm::checkOverlappingPatches( */ void GriddingAlgorithm::readLevelBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& coarser_to_new, - hier::Connector& new_to_coarser, + boost::shared_ptr& new_box_level, + boost::shared_ptr& coarser_to_new, const int tag_ln, const double regrid_time, + const int regrid_cycle, bool& remove_old_fine_level) { - TBOX_ASSERT((tag_ln >= 0) - && (tag_ln <= d_hierarchy->getFinestLevelNumber())); + TBOX_ASSERT((tag_ln >= 0) && + (tag_ln <= d_hierarchy->getFinestLevelNumber())); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *d_hierarchy, new_mapped_box_level); + const tbox::Dimension& dim = d_hierarchy->getDim(); - const hier::BoxLevel& coarser_mapped_box_level = *d_hierarchy->getBoxLevel( - tag_ln); + const hier::BoxLevel& coarser_box_level = *d_hierarchy->getBoxLevel(tag_ln); int fine_level_number = tag_ln + 1; hier::BoxContainer boxes_to_refine; @@ -2520,11 +2771,12 @@ GriddingAlgorithm::readLevelBoxes( * it returns true. If they are unchanged, it returns false. */ bool new_level_has_new_boxes = true; - if (d_tag_init_strategy->refineUserBoxInputOnly()) { + if (d_tag_init_strategy->refineUserBoxInputOnly(regrid_cycle, regrid_time)) { new_level_has_new_boxes = d_tag_init_strategy-> getUserSuppliedRefineBoxes(boxes_to_refine, tag_ln, + regrid_cycle, regrid_time); } @@ -2549,7 +2801,7 @@ GriddingAlgorithm::readLevelBoxes( */ if (d_load_balancer->getLoadBalanceDependsOnPatchData(fine_level_number) - && boxes_to_refine.size() > 0) { + && !boxes_to_refine.empty()) { compute_load_balanced_level_boxes = true; remove_old_fine_level = true; } @@ -2560,52 +2812,44 @@ GriddingAlgorithm::readLevelBoxes( * constructed. In this case, avoid load balance steps and * specify that we want to remove the old fine level. */ - if (boxes_to_refine.size() == 0) { + if (boxes_to_refine.empty()) { compute_load_balanced_level_boxes = false; remove_old_fine_level = true; } if (compute_load_balanced_level_boxes) { - hier::BoxLevel unbalanced_mapped_box_level(d_dim); - unbalanced_mapped_box_level.initialize( - coarser_mapped_box_level.getRefinementRatio(), - coarser_mapped_box_level.getGridGeometry(), + hier::BoxLevel unbalanced_box_level( + coarser_box_level.getRefinementRatio(), + coarser_box_level.getGridGeometry(), d_hierarchy->getMPI(), hier::BoxLevel::GLOBALIZED); hier::LocalId i(0); - for (hier::BoxContainer::iterator itr(boxes_to_refine); + for (hier::BoxContainer::iterator itr = boxes_to_refine.begin(); itr != boxes_to_refine.end(); ++itr, ++i) { - hier::Box unbalanced_mapped_box(*itr, i, 0); - unbalanced_mapped_box.setBlockId(hier::BlockId(0)); - unbalanced_mapped_box_level.addBox(unbalanced_mapped_box); + hier::Box unbalanced_box(*itr, i, 0); + unbalanced_box_level.addBox(unbalanced_box); } const hier::IntVector& ratio = d_hierarchy->getRatioToCoarserLevel(fine_level_number); - new_mapped_box_level = unbalanced_mapped_box_level; - coarser_to_new.clearNeighborhoods(); - coarser_to_new.setBase(coarser_mapped_box_level); - coarser_to_new.setHead(new_mapped_box_level); - coarser_to_new.setWidth( - d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln + 1), - true); - new_to_coarser.clearNeighborhoods(); - new_to_coarser.setBase(new_mapped_box_level); - new_to_coarser.setHead(coarser_mapped_box_level); - new_to_coarser.setWidth(hier::IntVector::ceilingDivide( - d_hierarchy->getRequiredConnectorWidth(tag_ln + 1, tag_ln), ratio), - true); - const hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(coarser_to_new); - oca.findOverlaps(new_to_coarser); + new_box_level.reset(new hier::BoxLevel(unbalanced_box_level)); + d_oca0.findOverlapsWithTranspose(coarser_to_new, + coarser_box_level, + *new_box_level, + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln + 1, true), + hier::IntVector::ceilingDivide( + d_hierarchy->getRequiredConnectorWidth(tag_ln + 1, tag_ln, true), ratio)); + + hier::Connector& new_to_coarser = coarser_to_new->getTranspose(); - hier::IntVector smallest_patch(d_dim); - hier::IntVector largest_patch(d_dim); - hier::IntVector extend_ghosts(d_dim); + size_t num_blocks = new_box_level->getGridGeometry()->getNumberBlocks(); + hier::IntVector smallest_patch(dim); + hier::IntVector largest_patch(dim); + hier::IntVector extend_ghosts(dim); { - hier::IntVector smallest_box_to_refine(d_dim); + hier::IntVector smallest_box_to_refine(dim, 0, num_blocks); // "false" argument: for_building_finer level = false getGriddingParameters(smallest_patch, smallest_box_to_refine, @@ -2615,17 +2859,22 @@ GriddingAlgorithm::readLevelBoxes( false); } - hier::IntVector patch_cut_factor(d_dim, 1); + refineNewBoxLevel(*new_box_level, + *coarser_to_new, + ratio); + + hier::IntVector patch_cut_factor( + dim, + d_tag_init_strategy->getErrorCoarsenRatio(), + num_blocks); + patch_cut_factor.max(ratio); t_load_balance0->start(); d_load_balancer0->loadBalanceBoxLevel( - new_mapped_box_level, - new_to_coarser, - coarser_to_new, + *new_box_level, + &new_to_coarser, d_hierarchy, tag_ln, - hier::Connector(), - hier::Connector(), smallest_patch, largest_patch, d_hierarchy->getDomainBoxLevel(), @@ -2633,39 +2882,17 @@ GriddingAlgorithm::readLevelBoxes( patch_cut_factor); t_load_balance0->stop(); - refineNewBoxLevel(new_mapped_box_level, - coarser_to_new, - new_to_coarser, - ratio); if (d_sequentialize_patch_indices) { - renumberBoxes(new_mapped_box_level, - coarser_to_new, - new_to_coarser, - false, - true); + renumberBoxes(*new_box_level, coarser_to_new.get(), false, true); } - oca.findOverlaps(coarser_to_new); - oca.findOverlaps(new_to_coarser); - - /* - * Periodic relationships exist in new_to_coarser, but are not - * complete because new doesn't have any periodic images yet. - * Remove these relationships to make new<==>coarser proper - * transposes. - */ - new_to_coarser.removePeriodicRelationships(); - - const hier::Connector& coarser_to_coarser = - d_hierarchy->getConnector(tag_ln, tag_ln); - const hier::BoxLevelConnectorUtils dlbg_edge_utils; - dlbg_edge_utils.addPeriodicImagesAndRelationships( - new_mapped_box_level, - new_to_coarser, - coarser_to_new, + d_blcu0.addPeriodicImages( + *new_box_level, d_hierarchy->getGridGeometry()->getDomainSearchTree(), - coarser_to_coarser); - new_mapped_box_level.finalize(); + new_to_coarser.getConnectorWidth()); + d_oca0.findOverlaps(*coarser_to_new); + d_oca0.findOverlaps(new_to_coarser); + } } @@ -2683,8 +2910,9 @@ GriddingAlgorithm::fillTags( { TBOX_ASSERT((tag_value == d_true_tag) || (tag_value == d_false_tag)); TBOX_ASSERT(tag_level); - TBOX_ASSERT(tag_index == d_tag_indx || tag_index == d_buf_tag_indx); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *tag_level); + TBOX_ASSERT(tag_index == d_user_tag_indx || tag_index == d_buf_tag_indx + || tag_index == d_boolean_tag_indx + || tag_index == d_saved_tag_indx); t_fill_tags->start(); @@ -2693,8 +2921,8 @@ GriddingAlgorithm::fillTags( const boost::shared_ptr& patch = *ip; boost::shared_ptr > tag_data( - patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_index))); TBOX_ASSERT(tag_data); tag_data->fill(tag_value); @@ -2717,52 +2945,54 @@ GriddingAlgorithm::fillTagsFromBoxLevel( const int tag_value, const boost::shared_ptr& tag_level, const int tag_index, - const hier::Connector& tag_level_to_fill_mapped_box_level, + const hier::Connector& tag_level_to_fill_box_level, const bool interior_only, - const hier::IntVector& fill_box_growth) const + const hier::IntVector& fill_box_growth, + const bool preserve_existing_tags) const { - TBOX_ASSERT((tag_value == d_true_tag) || (tag_value == d_false_tag)); + TBOX_ASSERT((tag_value == d_from_fine_tag) || + (tag_value == d_from_fine_pretag)); TBOX_ASSERT(tag_level); - TBOX_ASSERT(tag_index == d_tag_indx || tag_index == d_buf_tag_indx); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *tag_level, fill_box_growth); + TBOX_ASSERT(tag_index == d_user_tag_indx || tag_index == d_buf_tag_indx || + tag_index == d_boolean_tag_indx + || tag_index == d_saved_tag_indx); /* * This method assumes fill is finer than tag, but that is easy to * change, if needed. */ - TBOX_ASSERT(tag_level_to_fill_mapped_box_level.getHeadCoarserFlag() == false); + TBOX_ASSERT(tag_level_to_fill_box_level.getHeadCoarserFlag() == false); t_fill_tags->start(); - const hier::OverlapConnectorAlgorithm oca; - const boost::shared_ptr& grid_geom( d_hierarchy->getGridGeometry()); - const hier::IntVector& ratio = tag_level_to_fill_mapped_box_level.getRatio(); + const hier::IntVector& ratio = tag_level_to_fill_box_level.getRatio(); - const hier::IntVector growth_in_tag_resolution = - hier::IntVector::ceilingDivide(fill_box_growth, - tag_level_to_fill_mapped_box_level.getRatio()); + hier::IntVector growth_in_tag_resolution(fill_box_growth, + grid_geom->getNumberBlocks()); + growth_in_tag_resolution.ceilingDivide( + tag_level_to_fill_box_level.getRatio()); for (hier::PatchLevel::iterator ip(tag_level->begin()); ip != tag_level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > tag_data( - patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_index))); TBOX_ASSERT(tag_data); - const hier::BoxId& mapped_box_id(patch->getBox().getId()); + const hier::BoxId& box_id(patch->getBox().getBoxId()); NeighborSet neighbors; - oca.extractNeighbors( + d_oca.extractNeighbors( neighbors, - tag_level_to_fill_mapped_box_level, - mapped_box_id, + tag_level_to_fill_box_level, + box_id, growth_in_tag_resolution); for (NeighborSet::const_iterator @@ -2773,20 +3003,71 @@ GriddingAlgorithm::fillTagsFromBoxLevel( box.coarsen(ratio); if (neighbor.getBlockId() != patch->getBox().getBlockId()) { grid_geom->transformBox(box, - tag_level->getRatioToLevelZero(), + tag_level->getLevelNumber(), patch->getBox().getBlockId(), neighbor.getBlockId()); } if (interior_only) { - box = box * tag_data->getBox(); + box *= tag_data->getBox(); + } + if (!preserve_existing_tags) { + tag_data->fill(tag_value, box); + } else { + pdat::CellIterator icend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(box)); + ic != icend; ++ic) { + if ((*tag_data)(*ic) == d_false_tag) { + (*tag_data)(*ic) = tag_value; + } + } } - tag_data->fill(tag_value, box); } } t_fill_tags->stop(); } + +/* + ************************************************************************* + * Interprets user tags and sets up algorithmic tags, which will have only + * values of d_false_tag or d_true_tag, as required by box generator + * algorithms. + ************************************************************************* + */ +void GriddingAlgorithm::setBooleanTagData( + const boost::shared_ptr& tag_level, + bool preserve_existing_tags) const +{ + for (hier::PatchLevel::iterator ip(tag_level->begin()); + ip != tag_level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + + boost::shared_ptr > user_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_user_tag_indx))); + boost::shared_ptr > boolean_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_boolean_tag_indx))); + + if (!preserve_existing_tags) { + boolean_tag_data->fillAll(d_false_tag); + } + + size_t data_length = boolean_tag_data->getGhostBox().size(); + TBOX_ASSERT(data_length == user_tag_data->getGhostBox().size()); + + const int* user_tag_ptr = user_tag_data->getPointer(); + int* boolean_tag_ptr = boolean_tag_data->getPointer(); + + for (unsigned int i = 0; i < data_length; ++i) { + if (user_tag_ptr[i] != d_false_tag) { + boolean_tag_ptr[i] = d_true_tag; + } + } + } +} + /* ************************************************************************* * @@ -2812,10 +3093,12 @@ GriddingAlgorithm::bufferTagsOnLevel( << level->getLevelNumber() << "\n"; } + const tbox::Dimension& dim = d_hierarchy->getDim(); + TBOX_ASSERT((tag_value == d_true_tag) || (tag_value == d_false_tag)); TBOX_ASSERT(level); TBOX_ASSERT(buffer_size >= 0); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *level); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, *level); /* * Start timer for this method. */ @@ -2831,19 +3114,23 @@ GriddingAlgorithm::bufferTagsOnLevel( const boost::shared_ptr& patch = *ip1; boost::shared_ptr > buf_tag_data( - patch->getPatchData(d_buf_tag_indx), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch->getPatchData(d_tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_buf_tag_indx))); + boost::shared_ptr > boolean_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_boolean_tag_indx))); + + TBOX_ASSERT(buf_tag_data); + TBOX_ASSERT(boolean_tag_data); buf_tag_data->fillAll(not_tag); const hier::Box& interior(patch->getBox()); - pdat::CellIterator icend(interior, false); - for (pdat::CellIterator ic(interior, true); ic != icend; ++ic) { - if ((*tag_data)(*ic) == tag_value) { + pdat::CellIterator icend(pdat::CellGeometry::end(interior)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(interior)); + ic != icend; ++ic) { + if ((*boolean_tag_data)(*ic) == tag_value) { (*buf_tag_data)(*ic) = d_true_tag; } } @@ -2867,31 +3154,65 @@ GriddingAlgorithm::bufferTagsOnLevel( const boost::shared_ptr& patch = *ip2; boost::shared_ptr > buf_tag_data( - patch->getPatchData(d_buf_tag_indx), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch->getPatchData(d_tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_buf_tag_indx))); + boost::shared_ptr > boolean_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_boolean_tag_indx))); + + TBOX_ASSERT(buf_tag_data); + TBOX_ASSERT(boolean_tag_data); - const hier::Box& tag_box(tag_data->getBox()); + const hier::Box& tag_box(boolean_tag_data->getBox()); const hier::BlockId& tag_box_block_id = tag_box.getBlockId(); hier::Box buf_tag_box(tag_box); - buf_tag_box.grow(hier::IntVector(d_dim, buffer_size)); + buf_tag_box.grow(hier::IntVector(dim, buffer_size)); - tag_data->fillAll(not_tag); + boolean_tag_data->fillAll(not_tag); - pdat::CellIterator icend(buf_tag_box, false); - for (pdat::CellIterator ic(buf_tag_box, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(buf_tag_box)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(buf_tag_box)); + ic != icend; ++ic) { if ((*buf_tag_data)(*ic) == d_true_tag) { hier::Box buf_box(*ic - buffer_size, - *ic + buffer_size, - tag_box_block_id); - tag_data->fill(tag_value, buf_box); + *ic + buffer_size, + tag_box_block_id); + boolean_tag_data->fill(tag_value, buf_box); } } } + /* + * If a cell has a true boolean tag and a false user tag, the tag is + * a result of buffering and is set to the d_buffer_tag value in the + * user tags. + */ + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + + boost::shared_ptr > user_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_user_tag_indx))); + boost::shared_ptr > boolean_tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_boolean_tag_indx))); + + size_t data_length = boolean_tag_data->getGhostBox().size(); + TBOX_ASSERT(data_length == user_tag_data->getGhostBox().size()); + + int* user_tag_ptr = user_tag_data->getPointer(); + const int* boolean_tag_ptr = boolean_tag_data->getPointer(); + + for (unsigned int i = 0; i < data_length; ++i) { + if (boolean_tag_ptr[i] == d_true_tag && + user_tag_ptr[i] == d_false_tag) { + user_tag_ptr[i] = d_buffer_tag; + } + } + } + t_buffer_tags->stop(); } @@ -2914,25 +3235,22 @@ GriddingAlgorithm::bufferTagsOnLevel( void GriddingAlgorithm::findRefinementBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, const int tag_ln) const { - TBOX_ASSERT((tag_ln >= 0) - && (tag_ln <= d_hierarchy->getFinestLevelNumber())); + TBOX_ASSERT((tag_ln >= 0) && + (tag_ln <= d_hierarchy->getFinestLevelNumber())); TBOX_ASSERT(d_hierarchy->getPatchLevel(tag_ln)); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, new_mapped_box_level, *d_hierarchy); + + const tbox::Dimension& dim = d_hierarchy->getDim(); if (d_print_steps) { tbox::plog - << "GriddingAlgorithm::findRefinementBoxes entered with tag_ln = " + << "GriddingAlgorithm::findRefinementBoxes: entered with tag_ln = " << tag_ln << "\n"; } - const hier::OverlapConnectorAlgorithm oca; - const hier::BoxLevelConnectorUtils dlbg_edge_utils; - /* * Start timer for this method. */ @@ -2940,7 +3258,7 @@ GriddingAlgorithm::findRefinementBoxes( t_find_refinement->barrierAndStart(); } - const hier::BoxLevel& tag_mapped_box_level = *d_hierarchy->getBoxLevel(tag_ln); + const hier::BoxLevel& tag_box_level = *d_hierarchy->getBoxLevel(tag_ln); const int new_ln = tag_ln + 1; @@ -2952,11 +3270,12 @@ GriddingAlgorithm::findRefinementBoxes( * nesting boxes. Note that this may produce boxes which are too * small. Thus, boxes are regrown later. */ + const size_t nblocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); - hier::IntVector smallest_patch(d_dim); - hier::IntVector smallest_box_to_refine(d_dim); - hier::IntVector largest_patch(d_dim); - hier::IntVector extend_ghosts(d_dim); + hier::IntVector smallest_patch(dim); + hier::IntVector smallest_box_to_refine(dim, 0, nblocks); + hier::IntVector largest_patch(dim); + hier::IntVector extend_ghosts(dim); // "true" argument: for_building_finer level = true getGriddingParameters(smallest_patch, smallest_box_to_refine, @@ -2965,13 +3284,9 @@ GriddingAlgorithm::findRefinementBoxes( new_ln, true); - const hier::IntVector smallest_patch_in_tag_space = - hier::IntVector::ceilingDivide(smallest_patch, - d_hierarchy->getRatioToCoarserLevel(new_ln)); - const hier::IntVector largest_patch_in_tag_space = - largest_patch / d_hierarchy->getRatioToCoarserLevel(new_ln); const hier::IntVector extend_ghosts_in_tag_space = - hier::IntVector::ceilingDivide(extend_ghosts, + hier::IntVector::ceilingDivide( + extend_ghosts, d_hierarchy->getRatioToCoarserLevel(new_ln)); boost::shared_ptr level( @@ -2984,113 +3299,33 @@ GriddingAlgorithm::findRefinementBoxes( t_find_boxes_containing_tags->barrierAndStart(); hier::IntVector ratio = d_hierarchy->getRatioToCoarserLevel(new_ln); - /* - * Compute the width for tag<==>cluster. This width be wide enough to - * guarantee completeness for tag<==>new when we massage the - * cluster into the new level. In the massage step, we grow the new boxes. - * The width of tag<==>cluster must be big enough to see new overlaps - * generated by the growths. - */ - hier::IntVector tag_to_cluster_width = - d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln + 1); - if (d_extend_to_domain_boundary) { - // For extending boxes to domain boundary by amount of extend_ghosts_in_tag_space. - tag_to_cluster_width += extend_ghosts_in_tag_space; - } - // For growing within domain by amount of smallest_box_to_refine. - tag_to_cluster_width += smallest_box_to_refine; - - const int nblocks = d_hierarchy->getGridGeometry()->getNumberBlocks(); - if (nblocks == 1) { - hier::Box bounding_box(d_dim); + hier::BoxContainer bounding_container; + for (hier::BlockId::block_t bn = 0; bn < nblocks; ++bn) { + hier::BlockId block_id(bn); + hier::Box bounding_box(dim); bounding_box = - d_hierarchy->getBoxLevel(tag_ln)->getGlobalBoundingBox(0); - d_box_generator->findBoxesContainingTags( - new_mapped_box_level, - tag_to_new, - new_to_tag, - level, d_tag_indx, d_true_tag, bounding_box, - smallest_box_to_refine, - getEfficiencyTolerance(tag_ln), - getCombineEfficiency(tag_ln), - tag_to_cluster_width, - hier::BlockId(0), - hier::LocalId(0)); - } else { - /* - * TODO: The following loop is an inefficient work-around to - * handle multiple blocks through the single-block - * findBoxesContainingTags interface. The interfaces should be - * changed to support multiblock. - */ - hier::BoxContainer accumulated_mapped_boxes; - hier::LocalId first_local_id(0); - for (int bn = 0; bn < nblocks; ++bn) { - /* - * Determine single smallest bounding box for all nesting boxes. - */ - hier::Box bounding_box(d_dim); - bounding_box = - d_hierarchy->getBoxLevel(tag_ln)->getGlobalBoundingBox(bn); - - if (!bounding_box.isEmpty()) { - d_box_generator->findBoxesContainingTags( - new_mapped_box_level, - tag_to_new, - new_to_tag, - level, d_tag_indx, d_true_tag, bounding_box, - smallest_box_to_refine, - getEfficiencyTolerance(tag_ln), - getCombineEfficiency(tag_ln), - tag_to_cluster_width, - hier::BlockId(bn), - first_local_id); - accumulated_mapped_boxes.insert( - new_mapped_box_level.getBoxes().begin(), - new_mapped_box_level.getBoxes().end()); - if (accumulated_mapped_boxes.size() > 0) { - first_local_id = - accumulated_mapped_boxes.back().getId().getLocalId() + 1; - } - } - + d_hierarchy->getBoxLevel(tag_ln)->getGlobalBoundingBox(block_id); + if (!bounding_box.empty()) { + bounding_container.pushBack(bounding_box); } -#ifdef DEBUG_CHECK_ASSERTIONS - std::set local_ids; - for (hier::BoxContainer::iterator - ac_itr = accumulated_mapped_boxes.begin(); - ac_itr != accumulated_mapped_boxes.end(); ++ac_itr) { - local_ids.insert(ac_itr->getId().getLocalId().getValue()); - } - TBOX_ASSERT(static_cast(local_ids.size()) == accumulated_mapped_boxes.size()); -#endif - const hier::BoxLevel& tag_mapped_box_level(tag_to_new.getBase()); - new_mapped_box_level.swapInitialize( - accumulated_mapped_boxes, - new_mapped_box_level.getRefinementRatio(), - new_mapped_box_level.getGridGeometry(), - new_mapped_box_level.getMPI()); + } - /* - * Set up tag<==>new Connectors. We cannot use the neighborhood sets - * from findBoxesContainingTags because those do not include cross-block - * neighbors. - */ - tag_to_new.clearNeighborhoods(); - tag_to_new.setBase(tag_mapped_box_level); - tag_to_new.setHead(new_mapped_box_level); - tag_to_new.setWidth(tag_to_cluster_width, true); - new_to_tag.clearNeighborhoods(); - new_to_tag.setBase(new_mapped_box_level); - new_to_tag.setHead(tag_mapped_box_level); - new_to_tag.setWidth(tag_to_cluster_width, true); - oca.findOverlaps(tag_to_new); - oca.findOverlaps(new_to_tag); + hier::LocalId first_local_id(0); + if (!bounding_container.empty()) { + d_box_generator->findBoxesContainingTags( + new_box_level, + tag_to_new, + level, d_boolean_tag_indx, d_true_tag, bounding_container, + smallest_box_to_refine, + d_tag_to_cluster_width[tag_ln]); } t_find_boxes_containing_tags->stop(); - if (new_mapped_box_level.getGlobalNumberOfBoxes() > 0) { + const hier::PeriodicShiftCatalog& shift_catalog = + d_hierarchy->getGridGeometry()->getPeriodicShiftCatalog(); + + if (new_box_level && new_box_level->getGlobalNumberOfBoxes() > 0) { if (d_check_connectors) { /* @@ -3102,215 +3337,57 @@ GriddingAlgorithm::findRefinementBoxes( << "GriddingAlgorithm::findRefinementBoxes: checking new-->tag from findBoxesContainingTags\n"; } - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_tag, - false, - true, - true) == 0); + TBOX_ASSERT(tag_to_new->getTranspose().checkOverlapCorrectness(false, true, true) == 0); if (d_print_steps) { tbox::plog << "GriddingAlgorithm::findRefinementBoxes: checking tag-->new from findBoxesContainingTags\n"; } - TBOX_ASSERT(oca.checkOverlapCorrectness(tag_to_new, - false, - true, - true) == 0); - } - - t_box_massage->start(); - - { - if (d_print_steps) { - tbox::plog - << "GriddingAlgorithm::findRefinementBoxes: enforcing overflow nesting\n"; - } - - if (d_barrier_and_time) { - t_limit_overflow->barrierAndStart(); - } - /* - * Do not allow the new mapped_box_level to overflow the tag mapped_box_level. - * If we want to allow the overflow, we have to add the - * overflow ammount to width of tag->new. Such additions - * may make the ABR algorithm slower, because more - * non-contributing processors would have to be included - * in the contributing group (unless ABR keep track of - * the non-contributing processors and don't seek tag - * histogram from them). - */ - hier::BoxLevel nested_mapped_box_level(d_dim); - hier::Connector unnested_to_nested; - makeOverflowNestingMap( - nested_mapped_box_level, - unnested_to_nested, - new_mapped_box_level, - new_to_tag); - if (d_print_steps) { - tbox::plog - << "GriddingAlgorithm::findRefinementBoxes applying overflow nesting map." - << std::endl; - tbox::plog << "Overflow nesting map:\n" << unnested_to_nested.format("", 3); - } - t_use_overflow_map->start(); - t_modify_connector->start(); - hier::MappingConnectorAlgorithm mca; - mca.modify(tag_to_new, - new_to_tag, - unnested_to_nested, - &new_mapped_box_level); - t_modify_connector->stop(); - t_use_overflow_map->stop(); - if (d_barrier_and_time) { - t_limit_overflow->stop(); - } - if (d_print_steps) { - tbox::plog - << "GriddingAlgorithm::findRefinementBoxes finished applying overflow nesting map." - << std::endl; - } - - if (d_check_overflow_nesting) { - if (d_print_steps) { - tbox::plog << "GriddingAlgorithm::findRefinementBoxes checking overflow." - << std::endl; - } - bool locally_nested = false; - bool nested = dlbg_edge_utils.baseNestsInHead( - &locally_nested, - new_mapped_box_level, - tag_mapped_box_level, - hier::IntVector::getZero(d_dim), - hier::IntVector::getZero(d_dim), - hier::IntVector::getZero(d_dim), - &d_hierarchy->getGridGeometry()->getDomainSearchTree()); - if (!nested) { - TBOX_ERROR( - "Failed overflow nesting: new mapped_box_level does not nest in tagged mapped_box_level.\n" - << "Local nestedness = " << locally_nested << std::endl - << "tag_mapped_box_level:\n" << tag_mapped_box_level.format("", 2) - << "new_mapped_box_level:\n" << new_mapped_box_level.format("", 2) - << "tag_to_new:\n" << tag_to_new.format("", 2) - << "new_to_tag:\n" << new_to_tag.format("", 2)); - } - } + TBOX_ASSERT(tag_to_new->checkOverlapCorrectness(false, true, true) == 0); } - if (d_enforce_proper_nesting) { - - if (d_print_steps) { - tbox::plog - << "GriddingAlgorithm::findRefinementBoxes: enforcing proper nesting\n"; - } - if (d_barrier_and_time) { - t_enforce_nesting->barrierAndStart(); - } - - hier::Connector unnested_to_nested; - hier::BoxLevel nested_mapped_box_level(d_dim); - - makeProperNestingMap( - nested_mapped_box_level, - unnested_to_nested, - new_mapped_box_level, - tag_to_new, - new_to_tag, - new_ln); - if (d_print_steps) { - tbox::plog << "GriddingAlgorithm::findRefinementBoxes applying proper nesting map.\n" - << "Proper nesting map:\n" << unnested_to_nested.format("", 3); - } - t_use_nesting_map->start(); - t_modify_connector->start(); - const hier::MappingConnectorAlgorithm mca; - mca.modify(tag_to_new, - new_to_tag, - unnested_to_nested, - &new_mapped_box_level); - t_modify_connector->stop(); - t_use_nesting_map->stop(); + enforceOverflowNesting(*new_box_level, *tag_to_new); - if (d_barrier_and_time) { - t_enforce_nesting->stop(); - } - - if (tag_ln == d_base_ln && d_check_proper_nesting) { - /* - * Tag level will be regridded when we exit the current - * recursion if tag_ln is not d_base_ln, so do not check - * proper nesting in that case. - * - * Check that the new mapped_box_level nest in the tag - * level (tag_ln). - */ - hier::IntVector required_nesting(d_dim); - if (tag_ln > 0) { - required_nesting = - hier::IntVector(d_dim, d_hierarchy->getProperNestingBuffer(tag_ln)); - } else { - required_nesting = - d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_dim); - } - bool locally_nests = false; - const bool new_nests_in_tag = - dlbg_edge_utils.baseNestsInHead( - &locally_nests, - new_mapped_box_level, - tag_mapped_box_level, - required_nesting, - hier::IntVector::getZero(d_dim), - hier::IntVector::getZero(d_dim), - &d_hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); - if (!new_nests_in_tag) { - tbox::perr << "GriddingAlgorithm: new BoxLevel\n" - << "at ln=" << new_ln - << " does not properly nest in\n" - << "tag level at tag_ln=" << tag_ln - << " by the required nesting buffer of " - << required_nesting - << ".\nLocal nestingness: " << locally_nests - << ".\nWriting BoxLevels out to log file." - << std::endl; - tbox::plog - << "Proper nesting violation with new BoxLevel of\n" - << new_mapped_box_level.format("N->", 2) - << "Proper nesting violation with tag BoxLevel of\n" - << tag_mapped_box_level.format("T->", 2); - hier::BoxLevel external(d_dim); - hier::Connector tmp_new_to_tag( - new_mapped_box_level, - tag_mapped_box_level, - required_nesting); - oca.findOverlaps(tmp_new_to_tag); - tbox::plog << "tmp_new_to_tag:\n" << tmp_new_to_tag.format("NT->", 3); - hier::Connector new_to_external; - dlbg_edge_utils.computeExternalParts( - external, - new_to_external, - tmp_new_to_tag, - -required_nesting, - d_hierarchy->getGridGeometry()->getDomainSearchTree()); - tbox::plog << "External parts:\n" << new_to_external.format("NE->", 3); - TBOX_ERROR( - "Internal library error: Failed to produce proper nesting."); - } + /* + * If clustering implementation didn't provide the requested width, + * recompute the tag<==>new with the right width now. + * + * The bridge generates some periodic edges that we don't need just + * yet, so remove them. + */ + if (tag_to_new->getConnectorWidth() != d_tag_to_cluster_width[tag_ln]) { + t_fix_zero_width_clustering->barrierAndStart(); + const hier::Connector& tag_to_tag = + tag_box_level.findConnectorWithTranspose( + tag_box_level, + d_tag_to_cluster_width[tag_ln], + d_tag_to_cluster_width[tag_ln], + hier::CONNECTOR_IMPLICIT_CREATION_RULE); + d_oca.bridgeWithNesting( + tag_to_new, + tag_to_tag, + hier::Connector(*tag_to_new), + hier::IntVector::getZero(dim), + hier::IntVector::getZero(dim), + d_tag_to_cluster_width[tag_ln], + true); + if (shift_catalog.isPeriodic()) { + tag_to_new->removePeriodicRelationships(); + tag_to_new->getTranspose().removePeriodicRelationships(); } + t_fix_zero_width_clustering->barrierAndStop(); } - if (d_extend_to_domain_boundary) { - - if (d_print_steps) { - tbox::plog - << "GriddingAlgorithm::findRefinementBoxes: extending nodes\n"; - } + if (d_enforce_proper_nesting) { + enforceProperNesting(*new_box_level, *tag_to_new, tag_ln); + } - t_extend_to_domain_boundary->barrierAndStart(); + if (d_extend_to_domain_boundary) { extendBoxesToDomainBoundary( - new_mapped_box_level, - tag_to_new, - new_to_tag, + *new_box_level, + *tag_to_new, level->getPhysicalDomainArray(), extend_ghosts_in_tag_space); - t_extend_to_domain_boundary->stop(); } bool allow_patches_smaller_than_minimum_size_to_prevent_overlaps = @@ -3324,32 +3401,31 @@ GriddingAlgorithm::findRefinementBoxes( } t_extend_within_domain->start(); growBoxesWithinNestingDomain( - new_mapped_box_level, - tag_to_new, - new_to_tag, + *new_box_level, + *tag_to_new, smallest_box_to_refine, tag_ln); t_extend_within_domain->stop(); } else { const hier::IntVector periodic_dirs( d_hierarchy->getGridGeometry()->getPeriodicShift( - hier::IntVector::getOne(d_dim))); + hier::IntVector::getOne(dim))); bool need_to_grow = false; - hier::IntVector min_size(hier::IntVector::getOne(d_dim)); - for (int i = 0; i < d_dim.getValue(); i++) { + hier::IntVector min_size(hier::IntVector::getOne(dim)); + for (int i = 0; i < dim.getValue(); ++i) { if (periodic_dirs(i)) { need_to_grow = true; - min_size(i) = smallest_box_to_refine(i); + min_size(i) = + smallest_box_to_refine(0,i); } } if (need_to_grow) { t_extend_within_domain->start(); growBoxesWithinNestingDomain( - new_mapped_box_level, - tag_to_new, - new_to_tag, + *new_box_level, + *tag_to_new, min_size, tag_ln); t_extend_within_domain->stop(); @@ -3359,23 +3435,36 @@ GriddingAlgorithm::findRefinementBoxes( * We must manually shrink the widths as if we used the growing map * (matching the result of an empty map). */ - tag_to_new.shrinkWidth( - tag_to_new.getConnectorWidth() - smallest_box_to_refine); - new_to_tag.shrinkWidth( - new_to_tag.getConnectorWidth() - smallest_box_to_refine); + tag_to_new->shrinkWidth( + tag_to_new->getConnectorWidth() - smallest_box_to_refine); + tag_to_new->getTranspose().shrinkWidth( + tag_to_new->getTranspose().getConnectorWidth() - + smallest_box_to_refine); } } #ifdef DEBUG_CHECK_ASSERTIONS std::set new_local_ids; - const hier::BoxContainer& new_boxes = new_mapped_box_level.getBoxes(); + const hier::BoxContainer& new_boxes = new_box_level->getBoxes(); for (hier::BoxContainer::const_iterator new_itr = new_boxes.begin(); new_itr != new_boxes.end(); ++new_itr) { - new_local_ids.insert(new_itr->getId().getLocalId().getValue()); + new_local_ids.insert(new_itr->getBoxId().getLocalId().getValue()); } TBOX_ASSERT(static_cast(new_local_ids.size()) == new_boxes.size()); #endif - t_box_massage->stop(); + /* + * We have been working with new_box_level in the + * tag_box_level's index space. Now, refine it so we can + * build the new level. + */ + refineNewBoxLevel(*new_box_level, + *tag_to_new, + ratio); + + if (d_check_connectors) { + TBOX_ASSERT(tag_to_new->getTranspose().checkOverlapCorrectness(false, true, true) == 0); + TBOX_ASSERT(tag_to_new->checkOverlapCorrectness(false, true, true) == 0); + } if (d_load_balance) { if (d_print_steps) { @@ -3384,116 +3473,96 @@ GriddingAlgorithm::findRefinementBoxes( } t_load_balance->barrierAndStart(); - t_load_balance_setup->start(); - hier::IntVector patch_cut_factor(d_dim, 1); - - t_load_balance_setup->stop(); + const hier::IntVector& patch_cut_factor = ratio; d_load_balancer->loadBalanceBoxLevel( - new_mapped_box_level, - new_to_tag, - tag_to_new, + *new_box_level, + &tag_to_new->getTranspose(), d_hierarchy, new_ln, - new_to_tag, // FIXME: try using finer as the attractor. - tag_to_new, // FIXME: try using finer as the attractor. - smallest_patch_in_tag_space, - largest_patch_in_tag_space, + smallest_patch, + largest_patch, d_hierarchy->getDomainBoxLevel(), - extend_ghosts_in_tag_space, + extend_ghosts, patch_cut_factor); t_load_balance->stop(); if (d_check_connectors) { - tbox::plog << "GriddingAlgorithm checking new-tag" << std::endl; + tbox::plog << "GriddingAlgorithm::findRefinementBoxes: checking new-tag" << std::endl; int errs = 0; - if (oca.checkOverlapCorrectness(new_to_tag, false, true, true)) { + if (tag_to_new->getTranspose().checkOverlapCorrectness(false, true, true)) { ++errs; - tbox::perr << "Error found in new_to_tag!\n"; + tbox::perr << "Overlap error found in new_to_tag!\n"; } - if (oca.checkOverlapCorrectness(tag_to_new, false, true, true)) { + if (tag_to_new->checkOverlapCorrectness(false, true, true)) { ++errs; - tbox::perr << "Error found in tag_to_new!\n"; + tbox::perr << "Overlap error found in tag_to_new!\n"; } - if (new_to_tag.checkTransposeCorrectness(tag_to_new)) { + if (tag_to_new->getTranspose().checkTransposeCorrectness(*tag_to_new, true)) { ++errs; - tbox::perr << "Error found in new-tag transpose!\n"; + tbox::perr << "Transpose error found in new-tag transpose!\n"; } if (errs != 0) { TBOX_ERROR( "Errors found after using load balance map." - << "new_mapped_box_level:\n" << new_mapped_box_level.format("", 2) - << "tag_mapped_box_level:\n" << tag_mapped_box_level.format("", 2) - << "new_to_tag:\n" << new_to_tag.format("", 2) - << "tag_to_new:\n" << tag_to_new.format("", 2)); + << "new_box_level:\n" << new_box_level->format("", 2) + << "tag_box_level:\n" << tag_box_level.format("", 2) + << "new_to_tag:\n" << tag_to_new->getTranspose().format("", 2) + << "tag_to_new:\n" << tag_to_new->format("", 2) + << std::endl); } } } if (d_sequentialize_patch_indices) { if (d_print_steps) { - tbox::plog << "GriddingAlgorithm begin sorting nodes." << std::endl; + tbox::plog << "GriddingAlgorithm::findRefinementBoxes: begin sorting boxes." + << std::endl; } - renumberBoxes(new_mapped_box_level, - tag_to_new, - new_to_tag, - false, - true); + renumberBoxes(*new_box_level, tag_to_new.get(), false, true); if (d_print_steps) { - tbox::plog << "GriddingAlgorithm end sorting nodes." << std::endl; + tbox::plog << "GriddingAlgorithm::findRefinementBoxes: end sorting boxes." << std::endl; } } /* - * Add periodic image Boxes to new_mapped_box_level and add edges + * Add periodic image Boxes to new_box_level and add edges * incident on those nodes. */ const hier::Connector& tag_to_tag = - d_hierarchy->getConnector(tag_ln, tag_ln); + d_hierarchy->getPatchLevel(tag_ln)->findConnector( + *d_hierarchy->getPatchLevel(tag_ln), + d_hierarchy->getRequiredConnectorWidth(tag_ln, tag_ln, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); if (d_print_steps) { - tbox::plog << "GriddingAlgorithm begin adding periodic images." + tbox::plog << "GriddingAlgorithm::findRefinementBoxes: begin adding periodic images." << std::endl; } - dlbg_edge_utils.addPeriodicImagesAndRelationships( - new_mapped_box_level, - new_to_tag, - tag_to_new, + d_blcu.addPeriodicImagesAndRelationships( + *new_box_level, + tag_to_new->getTranspose(), d_hierarchy->getGridGeometry()->getDomainSearchTree(), tag_to_tag); if (d_print_steps) { - tbox::plog << "GriddingAlgorithm begin adding periodic images." + tbox::plog << "GriddingAlgorithm::findRefinementBoxes: finished adding periodic images." << std::endl; } if (d_check_connectors) { - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_tag) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(tag_to_new) == 0); - } - - /* - * We have been working with new_mapped_box_level in the - * tag_mapped_box_level's index space. Now, refine it so we can - * build the new level. - */ - refineNewBoxLevel(new_mapped_box_level, - tag_to_new, - new_to_tag, - ratio); - - if (d_check_connectors) { - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_tag) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(tag_to_new) == 0); + TBOX_ASSERT(tag_to_new->getTranspose().checkOverlapCorrectness() == 0); + TBOX_ASSERT(tag_to_new->checkOverlapCorrectness() == 0); } - } else { + } else if (new_box_level && new_box_level->getGlobalNumberOfBoxes() == 0) { /* - * On return, new_mapped_box_level should be initialized if we + * On return, new_box_level should be initialized if we * generated boxes, deallocated if we didnt. */ - new_mapped_box_level.clear(); + new_box_level->clear(); } @@ -3502,6 +3571,12 @@ GriddingAlgorithm::findRefinementBoxes( if (d_barrier_and_time) { t_find_refinement->stop(); } + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::findRefinementBoxes: leaving with tag_ln = " + << tag_ln << "\n"; + } } /* @@ -3510,36 +3585,64 @@ GriddingAlgorithm::findRefinementBoxes( */ void GriddingAlgorithm::renumberBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + hier::BoxLevel& new_box_level, + hier::Connector* ref_to_new, bool sort_by_corners, bool sequentialize_global_indices) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, new_mapped_box_level); +#ifdef DEBUG_CHECK_ASSERTIONS + const tbox::Dimension& dim = d_hierarchy->getDim(); +#endif + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, new_box_level); - t_sort_nodes->start(); + t_renumber_boxes->barrierAndStart(); - hier::MappingConnectorAlgorithm mca; + const hier::OverlapConnectorAlgorithm* oca = &d_oca; + const hier::MappingConnectorAlgorithm* mca = &d_mca; + const hier::BoxLevelConnectorUtils* blcu = &d_blcu; + if (ref_to_new && &ref_to_new->getBase() == &d_hierarchy->getDomainBoxLevel()) { + oca = &d_oca0; + mca = &d_mca0; + blcu = &d_blcu0; + } - hier::Connector sorting_map; - hier::BoxLevel seq_mapped_box_level(d_dim); - hier::BoxLevelConnectorUtils dlbg_edge_utils; - dlbg_edge_utils.makeSortingMap( - seq_mapped_box_level, + boost::shared_ptr sorting_map; + boost::shared_ptr seq_box_level; + blcu->makeSortingMap( + seq_box_level, sorting_map, - new_mapped_box_level, + new_box_level, sort_by_corners, sequentialize_global_indices); - t_modify_connector->start(); - mca.modify(tag_to_new, - new_to_tag, - sorting_map, - &new_mapped_box_level); - t_modify_connector->stop(); + /* + * Modify works well in most cases, but if ref is actually the + * domain its cost is O(N^2). In such a case, recompute instead + * of modify. + */ + if (ref_to_new == 0) { + hier::BoxLevel::swap(new_box_level, *seq_box_level); + } else if (&ref_to_new->getBase() != &d_hierarchy->getDomainBoxLevel()) { + mca->modify(*ref_to_new, *sorting_map, &new_box_level); + } else { + hier::BoxLevel::swap(new_box_level, *seq_box_level); + ref_to_new->clearNeighborhoods(); + ref_to_new->getTranspose().clearNeighborhoods(); + ref_to_new->setHead(new_box_level, true); + ref_to_new->getTranspose().setBase(new_box_level, true); + oca->findOverlaps_assumedPartition(*ref_to_new); + ref_to_new->removePeriodicRelationships(); + hier::Connector* new_to_ref = new hier::Connector(ref_to_new->getHead(), + ref_to_new->getBase(), + hier::Connector::convertHeadWidthToBase( + ref_to_new->getHead().getRefinementRatio(), + ref_to_new->getBase().getRefinementRatio(), + ref_to_new->getConnectorWidth())); + oca->findOverlaps(*new_to_ref); + ref_to_new->setTranspose(new_to_ref, true); + } - t_sort_nodes->stop(); + t_renumber_boxes->stop(); } /* @@ -3548,30 +3651,137 @@ GriddingAlgorithm::renumberBoxes( */ void GriddingAlgorithm::refineNewBoxLevel( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, const hier::IntVector& ratio) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, new_mapped_box_level, ratio); + TBOX_ASSERT(tag_to_new.hasTranspose()); - new_mapped_box_level.refineBoxes(new_mapped_box_level, + hier::Connector& new_to_tag = tag_to_new.getTranspose(); + + new_box_level.refineBoxes(new_box_level, ratio, - new_mapped_box_level.getRefinementRatio()*ratio); - new_mapped_box_level.finalize(); + new_box_level.getRefinementRatio() * ratio); + new_box_level.finalize(); - const hier::IntVector& new_to_tag_width = + hier::IntVector new_to_tag_width = ratio * new_to_tag.getConnectorWidth(); - new_to_tag.setBase(new_mapped_box_level); + new_to_tag.setBase(new_box_level); new_to_tag.setWidth(new_to_tag_width, true); - tag_to_new.setHead(new_mapped_box_level, true); + tag_to_new.setHead(new_box_level, true); tag_to_new.refineLocalNeighbors(ratio); -#if 0 - const hier::OverlapConnectorAlgorithm oca; - TBOX_ASSERT(oca.checkOverlapCorrectness(tag_to_new) == 0); - TBOX_ASSERT(oca.checkOverlapCorrectness(new_to_tag) == 0); -#endif +} + +/* + ************************************************************************* + ************************************************************************* + */ + +void +GriddingAlgorithm::enforceProperNesting( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new, + int tag_ln) const +{ + if (d_barrier_and_time) { + t_enforce_proper_nesting->barrierAndStart(); + } + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::enforceProperNesting: entered.\n"; + } + + const int new_ln = tag_ln + 1; + + boost::shared_ptr unnested_to_nested; + boost::shared_ptr nested_box_level; + + makeProperNestingMap( + nested_box_level, + unnested_to_nested, + new_box_level, + tag_to_new.getTranspose(), + new_ln, + d_oca); + + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::enforceProperNesting: applying proper nesting map.\n"; + } + + t_use_nesting_map->start(); + d_mca.modify(tag_to_new, + *unnested_to_nested, + &new_box_level); + t_use_nesting_map->stop(); + + if (tag_ln == d_base_ln && d_check_proper_nesting) { + /* + * Tag level will be regridded when we exit the current + * recursion if tag_ln is not d_base_ln, so do not check + * proper nesting in that case. + * + * Check that the new box_level nest in the tag + * level (tag_ln). + */ + hier::IntVector required_nesting(d_hierarchy->getDim()); + if (tag_ln > 0) { + required_nesting = + hier::IntVector(d_hierarchy->getDim(), d_hierarchy->getProperNestingBuffer(tag_ln)); + } else { + required_nesting = + d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_hierarchy->getDim()); + } + bool locally_nests = false; + const bool new_nests_in_tag = + d_blcu.baseNestsInHead( + &locally_nests, + new_box_level, + tag_to_new.getBase(), + required_nesting, + hier::IntVector::getZero(d_hierarchy->getDim()), + hier::IntVector::getZero(d_hierarchy->getDim()), + &d_hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); + if (!new_nests_in_tag) { + tbox::perr << "GriddingAlgorithm" "enforceProperNesting: new BoxLevel\n" + << "at ln=" << new_ln + << " does not properly nest in\n" + << "tag level at tag_ln=" << tag_ln + << " by the required nesting buffer of " + << required_nesting + << ".\nLocal nestingness: " << locally_nests + << ".\nWriting BoxLevels out to log file." + << std::endl; + tbox::plog + << "Proper nesting violation with new BoxLevel of\n" + << new_box_level.format("N->", 2) + << "Proper nesting violation with tag BoxLevel of\n" + << tag_to_new.getBase().format("T->", 2); + boost::shared_ptr external; + boost::shared_ptr tmp_new_to_tag; + d_oca.findOverlaps(tmp_new_to_tag, + new_box_level, + tag_to_new.getBase(), + required_nesting); + tbox::plog << "tmp_new_to_tag:\n" << tmp_new_to_tag->format("NT->", 3); + boost::shared_ptr new_to_external; + d_blcu.computeExternalParts( + external, + new_to_external, + *tmp_new_to_tag, + -required_nesting, + d_hierarchy->getGridGeometry()->getDomainSearchTree()); + tbox::plog << "External parts:\n" << new_to_external->format("NE->", 3); + TBOX_ERROR( + "Internal library error: Failed to produce proper nesting." + << std::endl); + } + } + + if (d_barrier_and_time) { + t_enforce_proper_nesting->barrierAndStop(); + } } /* @@ -3582,15 +3792,21 @@ GriddingAlgorithm::refineNewBoxLevel( void GriddingAlgorithm::extendBoxesToDomainBoundary( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - const tbox::Array& physical_domain_array, + const std::vector& physical_domain_array, const hier::IntVector& extend_ghosts) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, new_mapped_box_level); + TBOX_ASSERT(tag_to_new.hasTranspose()); + + t_extend_to_domain_boundary->barrierAndStart(); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::extendBoxesToDomainBoundary: extending boxes to boundary\n"; + } - tbox::SAMRAI_MPI mpi(new_mapped_box_level.getMPI()); + tbox::SAMRAI_MPI mpi(new_box_level.getMPI()); /* * Extend boxes to domain boundary if they are too close to one. I @@ -3603,45 +3819,108 @@ GriddingAlgorithm::extendBoxesToDomainBoundary( * to live in the small gap across which the Box is being extended. */ const hier::BoxContainer& before_nodes = - new_mapped_box_level.getBoxes(); + new_box_level.getBoxes(); - hier::BoxLevel after_mapped_box_level(d_dim); - after_mapped_box_level.initialize( - new_mapped_box_level.getRefinementRatio(), - new_mapped_box_level.getGridGeometry(), - new_mapped_box_level.getMPI()); + hier::BoxLevel after_box_level( + new_box_level.getRefinementRatio(), + new_box_level.getGridGeometry(), + new_box_level.getMPI()); - hier::Connector before_to_after( - new_mapped_box_level, - after_mapped_box_level, + hier::MappingConnector before_to_after( + new_box_level, + after_box_level, extend_ghosts); - before_to_after.setConnectorType(hier::Connector::MAPPING); for (hier::BoxContainer::const_iterator nn = before_nodes.begin(); nn != before_nodes.end(); ++nn) { - const hier::Box& before_mapped_box = *nn; - hier::Box after_mapped_box = before_mapped_box; + const hier::Box& before_box = *nn; + hier::Box after_box = before_box; hier::BoxUtilities::extendBoxToDomainBoundary( - after_mapped_box, - physical_domain_array[before_mapped_box.getBlockId().getBlockValue()], + after_box, + physical_domain_array[before_box.getBlockId().getBlockValue()], extend_ghosts); - after_mapped_box_level.addBox(after_mapped_box); + after_box_level.addBox(after_box); before_to_after.insertLocalNeighbor( - after_mapped_box, - before_mapped_box.getId()); + after_box, + before_box.getBoxId()); } - const hier::MappingConnectorAlgorithm mca; - mca.modify(tag_to_new, - new_to_tag, + d_mca.modify(tag_to_new, before_to_after, - &new_mapped_box_level); + &new_box_level); -#if 0 - TBOX_WARNING("Performing extensive error checking due to using new code!"); - TBOX_ASSERT(new_to_tag.checkOverlapCorrectness() == 0); - TBOX_ASSERT(tag_to_new.checkOverlapCorrectness() == 0); -#endif + t_extend_to_domain_boundary->barrierAndStop(); +} + +/* + ************************************************************************* + * Enforce overflow nesting by removing new cells that are outside the + * tag level. + ************************************************************************* + */ + +void +GriddingAlgorithm::enforceOverflowNesting( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new) const +{ + if (d_barrier_and_time) { + t_enforce_overflow_nesting->barrierAndStart(); + } + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::enforceOverflowNesting: enforcing overflow nesting\n"; + } + + /* + * Do not allow the new box_level to overflow the tag box_level. + * If we want to allow the overflow, we have to add the overflow + * ammount to width of tag->new. Such additions may make + * clustering slower. + */ + boost::shared_ptr nested_box_level; + boost::shared_ptr unnested_to_nested; + makeOverflowNestingMap( + nested_box_level, + unnested_to_nested, + new_box_level, + tag_to_new.getTranspose()); + t_use_overflow_map->start(); + d_mca.modify(tag_to_new, + *unnested_to_nested, + &new_box_level); + t_use_overflow_map->stop(); + + if (d_check_overflow_nesting) { + if (d_print_steps) { + tbox::plog << "GriddingAlgorithm::enforceOverflowNesting: checking overflow." + << std::endl; + } + bool locally_nested = false; + bool nested = d_blcu.baseNestsInHead( + &locally_nested, + new_box_level, + tag_to_new.getBase(), + hier::IntVector::getZero(d_hierarchy->getDim()), + hier::IntVector::getZero(d_hierarchy->getDim()), + hier::IntVector::getZero(d_hierarchy->getDim()), + &d_hierarchy->getGridGeometry()->getDomainSearchTree()); + if (!nested) { + TBOX_ERROR( + "Failed overflow nesting: new box_level does not nest in tagged box_level.\n" + << "Local nestedness = " << locally_nested << std::endl + << "tag_box_level:\n" << tag_to_new.getBase().format("", 2) + << "new_box_level:\n" << new_box_level.format("", 2) + << "tag_to_new:\n" << tag_to_new.format("", 2) + << "new_to_tag:\n" << tag_to_new.getTranspose().format("", 2) + << std::endl); + } + } + + if (d_barrier_and_time) { + t_enforce_overflow_nesting->barrierAndStop(); + } } /* @@ -3652,50 +3931,45 @@ GriddingAlgorithm::extendBoxesToDomainBoundary( void GriddingAlgorithm::makeOverflowNestingMap( - hier::BoxLevel& nested_mapped_box_level, - hier::Connector& unnested_to_nested, - const hier::BoxLevel& unnested_mapped_box_level, + boost::shared_ptr& nested_box_level, + boost::shared_ptr& unnested_to_nested, + const hier::BoxLevel& unnested_box_level, const hier::Connector& unnested_to_reference) const { #ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(unnested_mapped_box_level); + NULL_USE(unnested_box_level); #endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, - unnested_mapped_box_level, - nested_mapped_box_level); + const tbox::Dimension& dim = d_hierarchy->getDim(); + + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, unnested_box_level); t_make_overflow_map->start(); - hier::BoxLevel violator_mapped_box_level(d_dim); - hier::Connector unnested_to_violator; + boost::shared_ptr violator_box_level; + boost::shared_ptr unnested_to_violator; if (d_print_steps) { tbox::plog << " GriddingAlgorithm::makeOverflowNestingMap computing external parts." << std::endl; } - t_make_overflow_map_compute->start(); - hier::BoxLevelConnectorUtils edge_utils; t_compute_external_parts->start(); - edge_utils.computeExternalParts( - violator_mapped_box_level, + d_blcu.computeExternalParts( + violator_box_level, unnested_to_violator, unnested_to_reference, - hier::IntVector::getZero(d_dim), + hier::IntVector::getZero(dim), d_hierarchy->getGridGeometry()->getDomainSearchTree()); t_compute_external_parts->stop(); - t_make_overflow_map_compute->stop(); - TBOX_ASSERT(unnested_to_violator.isLocal()); + TBOX_ASSERT(unnested_to_violator->isLocal()); if (d_print_steps) { tbox::plog << " GriddingAlgorithm::makeOverflowNestingMap making remainer map." << std::endl; } - t_make_overflow_map_convert->start(); - edge_utils.makeRemainderMap( - nested_mapped_box_level, + d_blcu.makeRemainderMap( + nested_box_level, unnested_to_nested, - unnested_to_violator); - t_make_overflow_map_convert->stop(); + *unnested_to_violator); t_make_overflow_map->stop(); if (d_print_steps) { @@ -3706,52 +3980,59 @@ GriddingAlgorithm::makeOverflowNestingMap( /* ************************************************************************* * Make a map that can be used to enforce proper nesting. - * @param unnested_ln Level number for refinenement ratio of unnested_mapped_box_level. + * @param unnested_ln Level number for refinenement ratio of unnested_box_level. ************************************************************************* */ void GriddingAlgorithm::makeProperNestingMap( - hier::BoxLevel& nested_mapped_box_level, - hier::Connector& unnested_to_nested, - const hier::BoxLevel& unnested_mapped_box_level, - const hier::Connector& hierarchy_to_unnested, + boost::shared_ptr& nested_box_level, + boost::shared_ptr& unnested_to_nested, + const hier::BoxLevel& unnested_box_level, const hier::Connector& unnested_to_hierarchy, - const int unnested_ln) const + const int unnested_ln, + const hier::OverlapConnectorAlgorithm& oca) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, - unnested_mapped_box_level, - nested_mapped_box_level, - nested_mapped_box_level); + TBOX_ASSERT(unnested_to_hierarchy.hasTranspose()); +#ifdef DEBUG_CHECK_ASSERTIONS + const tbox::Dimension& dim = d_hierarchy->getDim(); +#endif + + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, unnested_box_level); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::makeProperNesingMap: entered.\n"; + } t_make_nesting_map->start(); - hier::Connector unnested_to_violator; - hier::BoxLevel violator(d_dim); - t_make_nesting_map_compute->start(); + boost::shared_ptr unnested_to_violator; + boost::shared_ptr violator; computeNestingViolator( violator, unnested_to_violator, - unnested_mapped_box_level, + unnested_box_level, unnested_to_hierarchy, - hierarchy_to_unnested, - unnested_ln - 1); - t_make_nesting_map_compute->stop(); + unnested_ln - 1, + oca); /* * unnested_to_violator is the Connector from the nodes * that violate nesting to their violating parts. * Convert it to the mapping from unnested to nested. */ - const hier::BoxLevelConnectorUtils edge_utils; - t_make_nesting_map_convert->start(); - edge_utils.makeRemainderMap( - nested_mapped_box_level, + d_blcu.makeRemainderMap( + nested_box_level, unnested_to_nested, - unnested_to_violator); - t_make_nesting_map_convert->stop(); + *unnested_to_violator); t_make_nesting_map->stop(); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::makeProperNesingMap: exiting.\n"; + } } /* @@ -3766,48 +4047,59 @@ GriddingAlgorithm::makeProperNestingMap( */ void GriddingAlgorithm::computeNestingViolator( - hier::BoxLevel& violator, - hier::Connector& candidate_to_violator, + boost::shared_ptr& violator, + boost::shared_ptr& candidate_to_violator, const hier::BoxLevel& candidate, const hier::Connector& candidate_to_hierarchy, - const hier::Connector& hierarchy_to_candidate, - const int tag_ln) const + const int tag_ln, + const hier::OverlapConnectorAlgorithm& oca) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, candidate, violator); + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::computeNestingViolator: entered.\n"; + } + + const tbox::Dimension& dim = d_hierarchy->getDim(); - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); + TBOX_ASSERT(candidate_to_hierarchy.hasTranspose()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, candidate); + + hier::IntVector zero_vector(hier::IntVector::getZero(dim)); // Check requirements on arguments. - TBOX_ASSERT(candidate_to_hierarchy.getRatio() == - hier::IntVector::getOne(d_dim)); - TBOX_ASSERT(hierarchy_to_candidate.getRatio() == - hier::IntVector::getOne(d_dim)); + TBOX_ASSERT(candidate_to_hierarchy.getRatio() == 1); + TBOX_ASSERT(candidate_to_hierarchy.getTranspose().getRatio() == 1); const hier::BaseGridGeometry& grid_geometry( *d_hierarchy->getGridGeometry()); t_compute_nesting_violator->start(); - const hier::BoxLevelConnectorUtils edge_utils; - const hier::OverlapConnectorAlgorithm oca; - - const hier::BoxContainer& candidate_mapped_boxes = candidate.getBoxes(); + const hier::BoxContainer& candidate_boxes = candidate.getBoxes(); /* * Bridge candidate to d_nesting_complement. Any part of the * candidate BoxLevel that overlaps d_nesting_complement * violates nesting. */ - hier::Connector candidate_to_complement; + boost::shared_ptr candidate_to_complement; + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::computeNestingViolator: bridging for candidate_to_complement.\n"; + } oca.bridge(candidate_to_complement, candidate_to_hierarchy, - d_to_nesting_complement[tag_ln], - d_from_nesting_complement[tag_ln], - hierarchy_to_candidate); + *d_to_nesting_complement[tag_ln], + false); + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::computeNestingViolator: bridged for candidate_to_complement.\n"; + } - edge_utils.computeInternalParts( + d_blcu.computeInternalParts( violator, candidate_to_violator, - candidate_to_complement, + *candidate_to_complement, zero_vector, grid_geometry.getDomainSearchTree()); /* @@ -3821,20 +4113,20 @@ GriddingAlgorithm::computeNestingViolator( refined_domain_search_tree.refine(candidate.getRefinementRatio()); refined_domain_search_tree.makeTree(&grid_geometry); - for (hier::BoxContainer::const_iterator ni = candidate_mapped_boxes.begin(); - ni != candidate_mapped_boxes.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = candidate_boxes.begin(); + ni != candidate_boxes.end(); ++ni) { const hier::Box& cmb = *ni; hier::BoxContainer addl_violators(cmb); addl_violators.removeIntersections( candidate.getRefinementRatio(), refined_domain_search_tree); - if (!addl_violators.isEmpty()) { + if (!addl_violators.empty()) { /* * Non-periodic BoxId needed for NeighborhoodSet::find() */ hier::BoxId cmb_non_per_id(cmb.getGlobalId(), hier::PeriodicId::zero()); - if (candidate_to_violator.hasNeighborSet(cmb_non_per_id)) { + if (candidate_to_violator->hasNeighborSet(cmb_non_per_id)) { /* * Remove parts that we already know, through * candidate_to_violator, are non-nesting. Leftovers are @@ -3842,20 +4134,21 @@ GriddingAlgorithm::computeNestingViolator( * candidate_to_complement. */ hier::Connector::NeighborhoodIterator base_box_itr = - candidate_to_violator.makeEmptyLocalNeighborhood(cmb_non_per_id); + candidate_to_violator->makeEmptyLocalNeighborhood(cmb_non_per_id); hier::Connector::ConstNeighborhoodIterator current_violators = - candidate_to_violator.find(cmb_non_per_id); - for (hier::Connector::ConstNeighborIterator na = candidate_to_violator.begin(current_violators); - na != candidate_to_violator.end(current_violators) && !addl_violators.isEmpty(); + candidate_to_violator->find(cmb_non_per_id); + for (hier::Connector::ConstNeighborIterator na = + candidate_to_violator->begin(current_violators); + na != candidate_to_violator->end(current_violators) && !addl_violators.empty(); ++na) { addl_violators.removeIntersections(*na); } - if (!addl_violators.isEmpty()) { - for (hier::BoxContainer::iterator bi(addl_violators); + if (!addl_violators.empty()) { + for (hier::BoxContainer::iterator bi = addl_violators.begin(); bi != addl_violators.end(); ++bi) { - hier::BoxContainer::const_iterator new_violator = violator.addBox( + hier::BoxContainer::const_iterator new_violator = violator->addBox( *bi, cmb.getBlockId()); - candidate_to_violator.insertLocalNeighbor(*new_violator, + candidate_to_violator->insertLocalNeighbor(*new_violator, base_box_itr); } } @@ -3864,6 +4157,11 @@ GriddingAlgorithm::computeNestingViolator( } t_compute_nesting_violator->stop(); + + if (d_print_steps) { + tbox::plog + << "GriddingAlgorithm::computeNestingViolator: exiting.\n"; + } } /* @@ -3872,7 +4170,7 @@ GriddingAlgorithm::computeNestingViolator( * with level number ln, to be used for constructing level number ln+1. * * Data computed: d_proper_nesting_complement[ln], - * d_from_nesting_complement[ln], d_to_proper_nesting_complement[ln]. + * d_to_proper_nesting_complement[ln] and its transpose. * * If ln > d_base_ln, assume data at ln-1 is already set. ************************************************************************* @@ -3880,40 +4178,62 @@ GriddingAlgorithm::computeNestingViolator( void GriddingAlgorithm::computeProperNestingData( - const int ln) + const int ln, + const hier::OverlapConnectorAlgorithm& oca) { + t_compute_proper_nesting_data->start(); + TBOX_ASSERT(d_base_ln >= 0 && ln >= d_base_ln); - const hier::BoxLevelConnectorUtils edge_utils; - const hier::OverlapConnectorAlgorithm oca; + const tbox::Dimension& dim = d_hierarchy->getDim(); if (ln == d_base_ln) { /* * At the base level, nesting domain is level d_base_ln, * shrunken by d_proper_nesting_buffer[d_base_ln]. */ - hier::BoxLevel& proper_nesting_complement = - d_proper_nesting_complement[ln]; const hier::Connector& self_connector = - d_hierarchy->getConnector(ln, ln); + d_hierarchy->getPatchLevel(ln)->findConnector( + *d_hierarchy->getPatchLevel(ln), + d_hierarchy->getRequiredConnectorWidth(ln, ln, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); // This assert shoud pass due to GriddingAlgorithmConnectorWidthRequestor. - TBOX_ASSERT( self_connector.getConnectorWidth() >= - hier::IntVector(d_dim, -d_hierarchy->getProperNestingBuffer(ln)) ); + TBOX_ASSERT(self_connector.getConnectorWidth() >= + hier::IntVector(dim, -d_hierarchy->getProperNestingBuffer(ln))); - edge_utils.computeExternalParts( - proper_nesting_complement, - d_to_nesting_complement[ln], + boost::shared_ptr to_nesting_complement; + d_blcu.computeExternalParts( + d_proper_nesting_complement[ln], + to_nesting_complement, self_connector, - hier::IntVector(d_dim, -d_hierarchy->getProperNestingBuffer(ln)), + hier::IntVector(dim, -d_hierarchy->getProperNestingBuffer(ln)), d_hierarchy->getGridGeometry()->getDomainSearchTree()); - d_from_nesting_complement[ln].initializeToLocalTranspose( - d_to_nesting_complement[ln]); + /* + * Change to_nesting_complement from a mapping to an overlap Connector + * by adding trivial edges normally omitted from mapping Connectors. + */ + const hier::BoxContainer& tag_level_boxes = self_connector.getBase().getBoxes(); + for (hier::BoxContainer::const_iterator bi = tag_level_boxes.begin(); + bi != tag_level_boxes.end(); + ++bi) { + if (!to_nesting_complement->hasNeighborSet(bi->getBoxId())) { + to_nesting_complement->insertLocalNeighbor(*bi, bi->getBoxId()); + } + } + + d_to_nesting_complement[ln] = + boost::static_pointer_cast( + to_nesting_complement); + d_to_nesting_complement[ln]->setTranspose( + d_to_nesting_complement[ln]->createLocalTranspose(), + true); } else { - TBOX_ASSERT(d_to_nesting_complement[ln - 1].isFinalized()); + TBOX_ASSERT(d_to_nesting_complement[ln - 1]->isFinalized()); /* * How to build d_proper_nesting_complement[ln] and connect it to level ln: @@ -3965,63 +4285,70 @@ GriddingAlgorithm::computeProperNestingData( * 1. Build the complement at ln (d_proper_nesting_complement[ln]) * from the complement at ln-1 (d_proper_nesting_complement[ln-1]). */ - d_proper_nesting_complement[ln].initialize( - d_hierarchy->getBoxLevel(ln)->getRefinementRatio(), - d_hierarchy->getGridGeometry(), - d_to_nesting_complement[ln - 1].getMPI()); - const hier::BoxContainer& lnm1_complement_mapped_boxes = - d_proper_nesting_complement[ln - 1].getBoxes(); + d_proper_nesting_complement[ln].reset(new hier::BoxLevel( + d_hierarchy->getBoxLevel(ln)->getRefinementRatio(), + d_hierarchy->getGridGeometry(), + d_to_nesting_complement[ln - 1]->getMPI())); + const hier::BoxContainer& lnm1_complement_boxes = + d_proper_nesting_complement[ln - 1]->getBoxes(); for (hier::BoxContainer::const_iterator ni = - lnm1_complement_mapped_boxes.begin(); - ni != lnm1_complement_mapped_boxes.end(); ++ni) { - hier::Box tmp_mapped_box = *ni; - TBOX_ASSERT(!tmp_mapped_box.isPeriodicImage()); - tmp_mapped_box.refine(d_hierarchy->getRatioToCoarserLevel(ln)); - tmp_mapped_box.grow( - hier::IntVector(d_dim, d_hierarchy->getProperNestingBuffer(ln))); - d_proper_nesting_complement[ln].addBox(tmp_mapped_box); + lnm1_complement_boxes.begin(); + ni != lnm1_complement_boxes.end(); ++ni) { + hier::Box tmp_box = *ni; + TBOX_ASSERT(!tmp_box.isPeriodicImage()); + tmp_box.refine(d_hierarchy->getRatioToCoarserLevel(ln)); + tmp_box.grow( + hier::IntVector(dim, d_hierarchy->getProperNestingBuffer(ln))); + d_proper_nesting_complement[ln]->addBox(tmp_box); } /* * 2. Temporarily connect level ln-1 and d_proper_nesting_complement[ln]. */ - hier::Connector lnm1_to_ln_complement( - *d_hierarchy->getBoxLevel(ln - 1), - d_proper_nesting_complement[ln], - d_to_nesting_complement[ln - 1].getConnectorWidth()); + hier::Connector lnm1_to_ln_complement(*d_hierarchy->getBoxLevel(ln - 1), + *d_proper_nesting_complement[ln], + d_to_nesting_complement[ln - 1]->getConnectorWidth()); for (hier::Connector::ConstNeighborhoodIterator ei = - d_to_nesting_complement[ln - 1].begin(); - ei != d_to_nesting_complement[ln - 1].end(); ++ei) { + d_to_nesting_complement[ln - 1]->begin(); + ei != d_to_nesting_complement[ln - 1]->end(); ++ei) { for (hier::Connector::ConstNeighborIterator na = - d_to_nesting_complement[ln - 1].begin(ei); - na != d_to_nesting_complement[ln - 1].end(ei); ++na) { - hier::Box tmp_mapped_box = *na; - tmp_mapped_box.refine(d_hierarchy->getRatioToCoarserLevel(ln)); - tmp_mapped_box.grow( - hier::IntVector(d_dim, d_hierarchy->getProperNestingBuffer(ln))); - lnm1_to_ln_complement.insertLocalNeighbor(tmp_mapped_box, *ei); + d_to_nesting_complement[ln - 1]->begin(ei); + na != d_to_nesting_complement[ln - 1]->end(ei); ++na) { + hier::Box tmp_box = *na; + tmp_box.refine(d_hierarchy->getRatioToCoarserLevel(ln)); + tmp_box.grow( + hier::IntVector(dim, d_hierarchy->getProperNestingBuffer(ln))); + lnm1_to_ln_complement.insertLocalNeighbor(tmp_box, *ei); } } - hier::Connector ln_complement_to_lnm1(d_from_nesting_complement[ln - 1]); - ln_complement_to_lnm1.setBase(d_proper_nesting_complement[ln]); + hier::Connector& from_nesting_complement = + d_to_nesting_complement[ln - 1]->getTranspose(); + hier::Connector ln_complement_to_lnm1(from_nesting_complement); + ln_complement_to_lnm1.setBase(*d_proper_nesting_complement[ln]); ln_complement_to_lnm1.setHead(*d_hierarchy->getBoxLevel(ln - 1)); ln_complement_to_lnm1.setWidth( - d_from_nesting_complement[ln - 1].getConnectorWidth() * - d_hierarchy->getRatioToCoarserLevel(ln), + from_nesting_complement.getConnectorWidth() + * d_hierarchy->getRatioToCoarserLevel(ln), true); + lnm1_to_ln_complement.setTranspose(&ln_complement_to_lnm1, false); /* * 3. Bridge for Connector between level ln and d_proper_nesting_complement[ln]. */ oca.bridge( d_to_nesting_complement[ln], - d_from_nesting_complement[ln], - d_hierarchy->getConnector(ln, ln - 1), + d_hierarchy->getPatchLevel(ln)->findConnectorWithTranspose( + *d_hierarchy->getPatchLevel(ln - 1), + d_hierarchy->getRequiredConnectorWidth(ln, ln - 1, true), + d_hierarchy->getRequiredConnectorWidth(ln - 1, ln), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false), lnm1_to_ln_complement, - ln_complement_to_lnm1, - d_hierarchy->getConnector(ln - 1, ln), - d_hierarchy->getRequiredConnectorWidth(ln - 1, ln)); + d_hierarchy->getRequiredConnectorWidth(ln - 1, ln, true), + true); } + + t_compute_proper_nesting_data->stop(); } /* @@ -4036,27 +4363,30 @@ GriddingAlgorithm::computeProperNestingData( void GriddingAlgorithm::growBoxesWithinNestingDomain( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, const hier::IntVector& min_size, const int tag_ln) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, - new_mapped_box_level, + TBOX_ASSERT(tag_to_new.hasTranspose()); + + const tbox::Dimension& dim = d_hierarchy->getDim(); + + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, + new_box_level, min_size); - const hier::OverlapConnectorAlgorithm oca; + hier::Connector& new_to_tag = tag_to_new.getTranspose(); const hier::BaseGridGeometry& grid_geometry( *d_hierarchy->getGridGeometry()); - const int nblocks = grid_geometry.getNumberBlocks(); - hier::IntVector current_min_size(d_dim, tbox::MathUtilities::getMax()); - for (int bn = 0; bn < nblocks; ++bn) { - current_min_size.min(new_mapped_box_level.getGlobalMinBoxSize(bn)); + const size_t nblocks = grid_geometry.getNumberBlocks(); + hier::IntVector current_min_size(dim, tbox::MathUtilities::getMax()); + for (hier::BlockId::block_t bn = 0; bn < nblocks; ++bn) { + current_min_size.min(new_box_level.getGlobalMinBoxSize(hier::BlockId(bn))); } - if (current_min_size >= min_size) { + if (min_size <= current_min_size) { /* * No box growing is needed. Just shrink the Connector widths * to mimic expected the side-effect of applying a map with a @@ -4068,17 +4398,13 @@ GriddingAlgorithm::growBoxesWithinNestingDomain( return; } - const hier::BoxContainer& new_mapped_boxes = - new_mapped_box_level.getBoxes(); + const hier::BoxContainer& new_boxes = new_box_level.getBoxes(); const hier::Connector& tag_to_nesting_complement = - d_to_nesting_complement[tag_ln]; - - const hier::Connector& nesting_complement_to_tag = - d_from_nesting_complement[tag_ln]; + *d_to_nesting_complement[tag_ln]; /* - * Connect new_mapped_box_level to the nesting complement so we + * Connect new_box_level to the nesting complement so we * know where it cannot exist. Use a Connector width of zero * because we don't need it any bigger and we don't want * inter-block neighbors. (The new Boxes are already confined to @@ -4086,38 +4412,36 @@ GriddingAlgorithm::growBoxesWithinNestingDomain( * Connector width eliminates inter-block neighbors.) */ - hier::Connector new_to_nesting_complement; - oca.bridge( + boost::shared_ptr new_to_nesting_complement; + d_oca.bridge( new_to_nesting_complement, new_to_tag, tag_to_nesting_complement, - nesting_complement_to_tag, - tag_to_new, - hier::IntVector::getZero(d_dim)); + min_size - 1, + false); /* - * Set up the empty grown_mapped_box_level to be populated as we + * Set up the empty grown_box_level to be populated as we * determine whether each box needs to be grown. */ - hier::BoxLevel grown_mapped_box_level( - new_mapped_box_level.getRefinementRatio(), - new_mapped_box_level.getGridGeometry(), - new_mapped_box_level.getMPI()); + hier::BoxLevel grown_box_level( + new_box_level.getRefinementRatio(), + new_box_level.getGridGeometry(), + new_box_level.getMPI()); // Create the mapping Connector from new to grown. - hier::Connector new_to_grown( - new_mapped_box_level, - grown_mapped_box_level, + hier::MappingConnector new_to_grown( + new_box_level, + grown_box_level, min_size); - new_to_grown.setConnectorType(hier::Connector::MAPPING); hier::BoxContainer refined_domain_search_tree( grid_geometry.getDomainSearchTree()); - refined_domain_search_tree.refine(new_mapped_box_level.getRefinementRatio()); + refined_domain_search_tree.refine(new_box_level.getRefinementRatio()); refined_domain_search_tree.makeTree(&grid_geometry); - std::vector tmp_mapped_box_vector; - tmp_mapped_box_vector.reserve(10); + std::vector tmp_box_vector; + tmp_box_vector.reserve(10); /* * Loop through the new Boxes and grow if needed. For each @@ -4126,48 +4450,31 @@ GriddingAlgorithm::growBoxesWithinNestingDomain( * Box minus parts removed to satisfy nesting requirements. */ - for (hier::BoxContainer::const_iterator ni = new_mapped_boxes.begin(); - ni != new_mapped_boxes.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = new_boxes.begin(); + ni != new_boxes.end(); ++ni) { const hier::Box& omb = *ni; TBOX_ASSERT(!omb.isPeriodicImage()); - if (omb.numberCells() <= min_size) { + if (omb.numberCells() >= min_size.getBlockVector(omb.getBlockId())) { // This box does not need growing. - grown_mapped_box_level.addBox(omb); + grown_box_level.addBox(omb); continue; } - hier::BoxContainer nesting_domain; - - refined_domain_search_tree.findOverlapBoxes( - nesting_domain, - omb, - new_mapped_box_level.getRefinementRatio()); - - if (new_to_nesting_complement.hasNeighborSet(omb.getId())) { - hier::Connector::ConstNeighborhoodIterator neighbors = - new_to_nesting_complement.find(omb.getId()); - for (hier::Connector::ConstNeighborIterator na = new_to_nesting_complement.begin(neighbors); - na != new_to_nesting_complement.end(neighbors); ++na) { - nesting_domain.removeIntersections(*na); - } - } - - hier::Box grown_mapped_box = omb; - hier::BoxUtilities::growBoxWithinDomain( - grown_mapped_box, - nesting_domain, - min_size); - - /* - * If the box is grown, generate the mapping for it. If not, - * keep the old box and don't generate a mapping. - */ - if (!omb.isSpatiallyEqual(grown_mapped_box)) { - grown_mapped_box_level.addBox(grown_mapped_box); - new_to_grown.insertLocalNeighbor(grown_mapped_box, omb.getId()); + if (new_to_nesting_complement->hasNeighborSet(omb.getBoxId())) { + // Box omb is near the nesting boundary and may touch it. + hier::BoxContainer nearby_nesting_boundary; + new_to_nesting_complement->getNeighborBoxes(omb.getBoxId(), nearby_nesting_boundary); + hier::Box grown_box = omb; + hier::BoxUtilities::growBoxWithinDomain( + grown_box, + nearby_nesting_boundary, + min_size.getBlockVector(omb.getBlockId())); + grown_box_level.addBox(grown_box); + new_to_grown.insertLocalNeighbor(grown_box, omb.getBoxId()); } else { - grown_mapped_box_level.addBox(omb); + // Box omb is not near the nesting boundary and need not be grown. + grown_box_level.addBox(omb); } } @@ -4176,13 +4483,9 @@ GriddingAlgorithm::growBoxesWithinNestingDomain( * Use the mapping Connector. */ - t_modify_connector->start(); - const hier::MappingConnectorAlgorithm mca; - mca.modify(tag_to_new, - new_to_tag, + d_mca.modify(tag_to_new, new_to_grown, - &new_mapped_box_level); - t_modify_connector->stop(); + &new_box_level); } void @@ -4194,7 +4497,9 @@ GriddingAlgorithm::getGriddingParameters( const int level_number, const bool for_building_finer) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, + const tbox::Dimension& dim = d_hierarchy->getDim(); + + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(dim, smallest_patch, smallest_box_to_refine, largest_patch, @@ -4215,17 +4520,17 @@ GriddingAlgorithm::getGriddingParameters( d_hierarchy->allowPatchesSmallerThanGhostWidth(); hier::IntVector max_ghosts( - d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(d_dim)); + d_hierarchy->getPatchDescriptor()->getMaxGhostWidth(dim)); max_ghosts = max_ghosts * d_tag_init_strategy->getErrorCoarsenRatio(); smallest_patch = d_hierarchy->getSmallestPatchSize(level_number); if (!allow_patches_smaller_than_ghost_width) { smallest_patch.max(max_ghosts); } else { const hier::IntVector periodic_dirs( - d_hierarchy->getGridGeometry()->getPeriodicShift(hier::IntVector::getOne( - d_dim))); + d_hierarchy->getGridGeometry()->getPeriodicShift( + hier::IntVector::getOne(dim))); - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { if (periodic_dirs(i)) { smallest_patch(i) = tbox::MathUtilities::Max(smallest_patch(i), max_ghosts(i)); @@ -4240,10 +4545,9 @@ GriddingAlgorithm::getGriddingParameters( /* * Following if-check prevents changing a negative largest_patch - * bacause TreeLoadBalancer interprets the non-negative value as - * dissabling the upper limit on patch size. + * because a negative value dissables the upper limit on patch size. */ - if (largest_patch > hier::IntVector::getZero(d_dim)) { + if (largest_patch > hier::IntVector::getZero(dim)) { largest_patch.max(smallest_patch); } @@ -4260,7 +4564,7 @@ GriddingAlgorithm::getGriddingParameters( */ if (for_building_finer) { - smallest_box_to_refine = smallest_patch; + smallest_box_to_refine.setAll(smallest_patch); /* * Shouldn't this division be rounded up because it @@ -4279,12 +4583,16 @@ GriddingAlgorithm::getGriddingParameters( * sz = max ghosts on Richardson-coarsened level_number+1, as * seen on level_number. */ - const hier::IntVector sz(hier::IntVector::ceilingDivide(max_ghosts, den)); + hier::IntVector multi_max_ghosts(max_ghosts, + d_hierarchy->getNumberBlocks()); + + const hier::IntVector sz(hier::IntVector::ceilingDivide( + multi_max_ghosts, den)); smallest_box_to_refine.max(sz); } else { - smallest_box_to_refine = hier::IntVector(d_dim, -1); + smallest_box_to_refine.setAll(hier::IntVector(dim, -1)); } @@ -4292,8 +4600,13 @@ GriddingAlgorithm::getGriddingParameters( * Determine number of cells box may be extended to physical * domain boundary to accomodate ghost cells. */ - extend_ghosts = max_ghosts; - + if (extend_ghosts.getNumBlocks() == 1 && + d_hierarchy->getNumberBlocks() > 1) { + extend_ghosts = hier::IntVector(max_ghosts, + d_hierarchy->getNumberBlocks()); + } else { + extend_ghosts.setAll(max_ghosts); + } } /* @@ -4304,18 +4617,20 @@ GriddingAlgorithm::getGriddingParameters( void GriddingAlgorithm::warnIfDomainTooSmallInPeriodicDir() const { - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(d_dim); + const tbox::Dimension& dim = d_hierarchy->getDim(); + + const hier::PeriodicShiftCatalog& shift_catalog = + d_hierarchy->getGridGeometry()->getPeriodicShiftCatalog(); - if (shift_catalog->isPeriodic()) { + if (shift_catalog.isPeriodic()) { hier::IntVector periodic_shift( d_hierarchy->getGridGeometry()->getPeriodicShift( - hier::IntVector::getOne(d_dim))); + hier::IntVector::getOne(dim))); hier::IntVector domain_bounding_box_size( d_hierarchy->getDomainBoxLevel(). - getGlobalBoundingBox(0).numberCells()); + getGlobalBoundingBox(hier::BlockId(0)).numberCells()); for (int ln = 0; ln < d_hierarchy->getNumberOfLevels(); ++ln) { @@ -4324,10 +4639,10 @@ GriddingAlgorithm::warnIfDomainTooSmallInPeriodicDir() const domain_bounding_box_size *= d_hierarchy->getRatioToCoarserLevel(ln); } - hier::IntVector smallest_patch_size(d_dim); - hier::IntVector largest_patch_size(d_dim); - hier::IntVector extend_ghosts(d_dim); - hier::IntVector smallest_box_to_refine(d_dim); + hier::IntVector smallest_patch_size(dim); + hier::IntVector largest_patch_size(dim); + hier::IntVector extend_ghosts(dim); + hier::IntVector smallest_box_to_refine(dim, 0); // "false" argument: for_building_finer level = false getGriddingParameters( smallest_patch_size, @@ -4337,14 +4652,15 @@ GriddingAlgorithm::warnIfDomainTooSmallInPeriodicDir() const ln, false); - for (int d = 0; d < d_dim.getValue(); ++d) { + for (int d = 0; d < dim.getValue(); ++d) { if (periodic_shift(d) > 0 && domain_bounding_box_size(d) < smallest_patch_size(d)) { - TBOX_WARNING("GriddingAlgorithm: domain bounding box size\n" + TBOX_WARNING( + "GriddingAlgorithm::warnIfDomainTooSmallInPeriodicDir: domain bounding box size\n" << domain_bounding_box_size << " is smaller\n" << "than the smallest patch size " << smallest_patch_size << " on level " - << ln << " in dimension " << d << "\n"); + << ln << " in direction " << d << "\n"); break; } } @@ -4367,13 +4683,6 @@ GriddingAlgorithm::printClassData( std::ostream& os) const { os << "\nGriddingAlgorithm::printClassData..." << std::endl; - os << " static data members:" << std::endl; - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; d++) { - os << " (*s_tag_indx)[" << d << "] = " - << (*s_tag_indx)[d] << std::endl; - os << " (*s_buf_tag_indx)[" << d << "] = " - << (*s_buf_tag_indx)[d] << std::endl; - } os << "GriddingAlgorithm: this = " << (GriddingAlgorithm *)this << std::endl; os << "d_object_name = " << d_object_name << std::endl; @@ -4385,50 +4694,59 @@ GriddingAlgorithm::printClassData( << d_load_balancer.get() << std::endl; os << "d_load_balancer0 = " << d_load_balancer0.get() << std::endl; - os << "d_tag = " << d_tag.get() << std::endl; - os << "d_tag_indx = " << d_tag_indx << std::endl; + os << "d_user_tag = " << d_user_tag.get() << std::endl; + os << "d_user_tag_indx = " << d_user_tag_indx << std::endl; + os << "d_saved_tag = " << d_user_tag.get() << std::endl; + os << "d_saved_tag_indx = " << d_user_tag_indx << std::endl; + os << "d_boolean_tag = " << d_boolean_tag.get() << std::endl; + os << "d_boolean_tag_indx = " << d_boolean_tag_indx << std::endl; os << "d_buf_tag_indx = " << d_buf_tag_indx << std::endl; os << "d_true_tag = " << d_true_tag << std::endl; os << "d_false_tag = " << d_false_tag << std::endl; - - int ln; - - os << "d_efficiency_tolerance..." << std::endl; - for (ln = 0; ln < d_efficiency_tolerance.getSize(); ln++) { - os << " d_efficiency_tolerance[" << ln << "] = " - << d_efficiency_tolerance[ln] << std::endl; - } - os << "d_combine_efficiency..." << std::endl; - for (ln = 0; ln < d_combine_efficiency.getSize(); ln++) { - os << " d_combine_efficiency[" << ln << "] = " - << d_combine_efficiency[ln] << std::endl; - } } /* ************************************************************************* * - * Write out class version number and data members to database. + * Write out class version number and data members to restart database. * ************************************************************************* */ void -GriddingAlgorithm::putToDatabase( - const boost::shared_ptr& db) const +GriddingAlgorithm::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("ALGS_GRIDDING_ALGORITHM_VERSION", + restart_db->putInteger("ALGS_GRIDDING_ALGORITHM_VERSION", ALGS_GRIDDING_ALGORITHM_VERSION); - db->putInteger("d_true_tag", d_true_tag); - db->putInteger("d_false_tag", d_false_tag); + restart_db->putBool("check_overflow_nesting", d_check_overflow_nesting); + restart_db->putBool("check_proper_nesting", d_check_proper_nesting); + restart_db->putBool("DEV_check_connectors", d_check_connectors); + restart_db->putBool("DEV_print_steps", d_print_steps); + restart_db->putBool("DEV_log_metadata_statistics", d_log_metadata_statistics); + + restart_db->putChar("check_nonrefined_tags", d_check_nonrefined_tags); + restart_db->putChar("check_overlapping_patches", + d_check_overlapping_patches); + restart_db->putChar("check_nonnesting_user_boxes", + d_check_nonnesting_user_boxes); + restart_db->putChar("DEV_check_boundary_proximity_violation", + d_check_boundary_proximity_violation); - db->putDoubleArray("d_efficiency_tolerance", d_efficiency_tolerance); - db->putDoubleArray("d_combine_efficiency", d_combine_efficiency); + restart_db->putBool("sequentialize_patch_indices", + d_sequentialize_patch_indices); - db->putBool("d_sequentialize_patch_indices", d_sequentialize_patch_indices); + restart_db->putBool("enforce_proper_nesting", d_enforce_proper_nesting); + restart_db->putBool("DEV_extend_to_domain_boundary", + d_extend_to_domain_boundary); + restart_db->putBool("DEV_load_balance", d_load_balance); + + restart_db->putBool("DEV_barrier_and_time", d_barrier_and_time); + + restart_db->putBool("save_tag_data", d_save_tag_data); } /* @@ -4443,137 +4761,169 @@ GriddingAlgorithm::putToDatabase( void GriddingAlgorithm::getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart) { - NULL_USE(is_from_restart); + if (input_db) { + if (!is_from_restart) { + + d_check_overflow_nesting = + input_db->getBoolWithDefault("check_overflow_nesting", false); + d_check_proper_nesting = + input_db->getBoolWithDefault("check_proper_nesting", false); + d_check_connectors = + input_db->getBoolWithDefault("DEV_check_connectors", false); + d_print_steps = + input_db->getBoolWithDefault("DEV_print_steps", false); + d_log_metadata_statistics = + input_db->getBoolWithDefault("DEV_log_metadata_statistics", false); + + std::string tmp_str; + + tmp_str = + input_db->getStringWithDefault("check_nonrefined_tags", std::string("WARN")); + if (!(tmp_str == "IGNORE" || tmp_str == "WARN" || tmp_str == "ERROR")) { + INPUT_VALUE_ERROR("check_nonrefined_tags"); + } + d_check_nonrefined_tags = char(tolower(*tmp_str.c_str())); - TBOX_ASSERT(db); + tmp_str = + input_db->getStringWithDefault("check_overlapping_patches", std::string("IGNORE")); + if (!(tmp_str == "IGNORE" || tmp_str == "WARN" || tmp_str == "ERROR")) { + INPUT_VALUE_ERROR("check_overlapping_patches"); + } + d_check_overlapping_patches = char(tolower(*tmp_str.c_str())); - d_check_overflow_nesting = - db->getBoolWithDefault("check_overflow_nesting", d_check_overflow_nesting); - d_check_proper_nesting = - db->getBoolWithDefault("check_proper_nesting", d_check_proper_nesting); - d_check_connectors = - db->getBoolWithDefault("check_connectors", d_check_connectors); - d_print_steps = - db->getBoolWithDefault("print_steps", d_print_steps); - d_log_metadata_statistics = - db->getBoolWithDefault("log_metadata_statistics", d_log_metadata_statistics); + tmp_str = + input_db->getStringWithDefault("check_nonnesting_user_boxes", std::string("ERROR")); + if (!(tmp_str == "IGNORE" || tmp_str == "WARN" || tmp_str == "ERROR")) { + INPUT_VALUE_ERROR("check_nonnesting_user_boxes"); + } + d_check_nonnesting_user_boxes = char(tolower(*tmp_str.c_str())); - /* - * Read input for efficiency tolerance. - */ + tmp_str = + input_db->getStringWithDefault("DEV_check_boundary_proximity_violation", + std::string("ERROR")); + if (!(tmp_str == "IGNORE" || tmp_str == "WARN" || tmp_str == "ERROR")) { + INPUT_VALUE_ERROR("DEV_check_boundary_proximity_violation"); + } + d_check_boundary_proximity_violation = char(tolower(*tmp_str.c_str())); + + d_sequentialize_patch_indices = + input_db->getBoolWithDefault("sequentialize_patch_indices", true); + + d_enforce_proper_nesting = + input_db->getBoolWithDefault("enforce_proper_nesting", true); + d_extend_to_domain_boundary = + input_db->getBoolWithDefault("DEV_extend_to_domain_boundary", true); + d_load_balance = + input_db->getBoolWithDefault("DEV_load_balance", true); + + d_barrier_and_time = + input_db->getBoolWithDefault("DEV_barrier_and_time", false); - if (db->keyExists("efficiency_tolerance")) { - tbox::Array efficiency_tolerance = db->getDoubleArray("efficiency_tolerance"); - - int ln; - for (ln = 0; - ln < efficiency_tolerance.getSize() && ln < d_hierarchy->getMaxNumberOfLevels(); - ++ln) { - if ((efficiency_tolerance[ln] <= 0.0e0) || - (efficiency_tolerance[ln] >= 1.0e0)) { - TBOX_ERROR(d_object_name << ": " - << "Key data `efficiency_tolerance' has values" - << " out of range 0.0 < tol < 1.0."); + d_save_tag_data = + input_db->getBoolWithDefault("save_tag_data", false); + + } else { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + if (!read_on_restart) { + return; } - d_efficiency_tolerance[ln] = efficiency_tolerance[ln]; - } - for ( ; ln < d_hierarchy->getMaxNumberOfLevels(); ++ln) { - d_efficiency_tolerance[ln] = efficiency_tolerance.back(); - } - } + d_check_overflow_nesting = + input_db->getBoolWithDefault("check_overflow_nesting", + d_check_overflow_nesting); + d_check_proper_nesting = + input_db->getBoolWithDefault("check_proper_nesting", + d_check_proper_nesting); + d_check_connectors = + input_db->getBoolWithDefault("DEV_check_connectors", + d_check_connectors); + d_print_steps = + input_db->getBoolWithDefault("DEV_print_steps", d_print_steps); + d_log_metadata_statistics = + input_db->getBoolWithDefault("DEV_log_metadata_statistics", + d_log_metadata_statistics); + + std::string tmp_str; + + if (input_db->keyExists("check_nonrefined_tags")) { + tmp_str = input_db->getString("check_nonrefined_tags"); + d_check_nonrefined_tags = char(tolower(*tmp_str.c_str())); + if (d_check_nonrefined_tags != 'i' && + d_check_nonrefined_tags != 'w' && + d_check_nonrefined_tags != 'e') { + TBOX_ERROR( + "GriddingAlgorithm::getFromInput: input parameter check_nonrefined_tags\n" + << "can only be \"IGNORE\", \"WARN\" or \"ERROR\"" + << std::endl); + } + } - /* - * Read input for combine efficiency. - */ + if (input_db->keyExists("check_overlapping_patches")) { + tmp_str = input_db->getString("check_overlapping_patches"); + d_check_overlapping_patches = char(tolower(*tmp_str.c_str())); + if (d_check_overlapping_patches != 'i' && + d_check_overlapping_patches != 'w' && + d_check_overlapping_patches != 'e') { + TBOX_ERROR( + "GriddingAlgorithm::getFromInput: input parameter check_overlapping_patches\n" + << "can only be \"IGNORE\", \"WARN\" or \"ERROR\"" + << std::endl); + } + } - if (db->keyExists("combine_efficiency")) { - tbox::Array combine_efficiency = db->getDoubleArray("combine_efficiency"); - - int ln; - for (ln = 0; - ln < combine_efficiency.getSize() && ln < d_hierarchy->getMaxNumberOfLevels(); - ++ln) { - if ((combine_efficiency[ln] <= 0.0e0) || - (combine_efficiency[ln] >= 1.0e0)) { - TBOX_ERROR( - d_object_name << ": " - << "Key data `combine_efficiency' has values" - << " out of range 0.0 < tol < 1.0."); + if (input_db->keyExists("check_nonnesting_user_boxes")) { + tmp_str = input_db->getString("check_nonnesting_user_boxes"); + d_check_nonnesting_user_boxes = char(tolower(*tmp_str.c_str())); + if (d_check_nonnesting_user_boxes != 'i' && + d_check_nonnesting_user_boxes != 'w' && + d_check_nonnesting_user_boxes != 'e') { + TBOX_ERROR( + "GriddingAlgorithm::getFromInput: input parameter check_nonnesting_user_boxes\n" + << "can only be \"IGNORE\", \"WARN\" or \"ERROR\"" + << std::endl); + } } - d_combine_efficiency[ln] = combine_efficiency[ln]; - } - for ( ; ln < d_hierarchy->getMaxNumberOfLevels(); ++ln) { - d_combine_efficiency[ln] = combine_efficiency.back(); - } - } + if (input_db->keyExists("DEV_check_boundary_proximity_violation")) { + tmp_str = + input_db->getString("DEV_check_boundary_proximity_violation"); + d_check_boundary_proximity_violation = + char(tolower(*tmp_str.c_str())); + if (d_check_boundary_proximity_violation != 'i' && + d_check_boundary_proximity_violation != 'w' && + d_check_boundary_proximity_violation != 'e') { + TBOX_ERROR( + "GriddingAlgorithm::getFromInput: input parameter check_boundary_proximity_violation\n" + << "can only be \"IGNORE\", \"WARN\" or \"ERROR\"" + << std::endl); + } + } - d_proper_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels(), - hier::BoxLevel(d_dim)); - d_to_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels()); - d_from_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels()); - - std::string tmp_str; - - tmp_str = db->getStringWithDefault("check_nonrefined_tags", - std::string("WARN")); - d_check_nonrefined_tags = char(tolower(*tmp_str.c_str())); - if (d_check_nonrefined_tags != 'i' && - d_check_nonrefined_tags != 'w' && - d_check_nonrefined_tags != 'e') { - TBOX_ERROR("GriddingAlgorithm: input parameter check_nonrefined_tags\n" - << "can only be \"IGNORE\", \"WARN\" or \"ERROR\""); - } - - tmp_str = db->getStringWithDefault("check_overlapping_patches", - std::string("IGNORE")); - d_check_overlapping_patches = char(tolower(*tmp_str.c_str())); - if (d_check_overlapping_patches != 'i' && - d_check_overlapping_patches != 'w' && - d_check_overlapping_patches != 'e') { - TBOX_ERROR( - "GriddingAlgorithm: input parameter check_overlapping_patches\n" - << "can only be \"IGNORE\", \"WARN\" or \"ERROR\""); - } - - tmp_str = db->getStringWithDefault("check_nonnesting_user_boxes", - std::string("ERROR")); - d_check_nonnesting_user_boxes = char(tolower(*tmp_str.c_str())); - if (d_check_nonnesting_user_boxes != 'i' && - d_check_nonnesting_user_boxes != 'w' && - d_check_nonnesting_user_boxes != 'e') { - TBOX_ERROR("GriddingAlgorithm: input parameter check_nonnesting_user_boxes\n" - << "can only be \"IGNORE\", \"WARN\" or \"ERROR\""); - } - - tmp_str = db->getStringWithDefault("check_boundary_proximity_violation", - std::string("ERROR")); - d_check_boundary_proximity_violation = char(tolower(*tmp_str.c_str())); - if (d_check_boundary_proximity_violation != 'i' && - d_check_boundary_proximity_violation != 'w' && - d_check_boundary_proximity_violation != 'e') { - TBOX_ERROR("GriddingAlgorithm: input parameter check_boundary_proximity_violation\n" - << "can only be \"IGNORE\", \"WARN\" or \"ERROR\""); - } - - d_sequentialize_patch_indices = - db->getBoolWithDefault("sequentialize_patch_indices", - d_sequentialize_patch_indices); - - d_enforce_proper_nesting = - db->getBoolWithDefault("enforce_proper_nesting", d_enforce_proper_nesting); - d_extend_to_domain_boundary = - db->getBoolWithDefault("extend_to_domain_boundary", - d_extend_to_domain_boundary); - d_load_balance = - db->getBoolWithDefault("load_balance", d_load_balance); - - d_barrier_and_time = - db->getBoolWithDefault("barrier_and_time", d_barrier_and_time); + d_sequentialize_patch_indices = + input_db->getBoolWithDefault("sequentialize_patch_indices", + d_sequentialize_patch_indices); + + d_enforce_proper_nesting = + input_db->getBoolWithDefault("enforce_proper_nesting", + d_enforce_proper_nesting); + d_extend_to_domain_boundary = + input_db->getBoolWithDefault("DEV_extend_to_domain_boundary", + d_extend_to_domain_boundary); + d_load_balance = + input_db->getBoolWithDefault("DEV_load_balance", d_load_balance); + + d_barrier_and_time = + input_db->getBoolWithDefault("DEV_barrier_and_time", + d_barrier_and_time); + + d_save_tag_data = + input_db->getBoolWithDefault("save_tag_data", false); + } + } } /* @@ -4596,7 +4946,7 @@ GriddingAlgorithm::getFromRestart() if (!root_db->isDatabase(d_object_name)) { TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file."); + << d_object_name << " not found in restart file." << std::endl); } boost::shared_ptr db(root_db->getDatabase(d_object_name)); @@ -4604,62 +4954,31 @@ GriddingAlgorithm::getFromRestart() if (ver != ALGS_GRIDDING_ALGORITHM_VERSION) { TBOX_ERROR( d_object_name << ": " - << "Restart file version different than class version."); + << "Restart file version different than class version." + << std::endl); } - d_proper_nesting_complement.resize(d_hierarchy->getMaxNumberOfLevels(), - hier::BoxLevel(d_dim)); - - d_efficiency_tolerance = db->getDoubleArray("d_efficiency_tolerance"); - d_combine_efficiency = db->getDoubleArray("d_combine_efficiency"); - - d_sequentialize_patch_indices = db->getBool("d_sequentialize_patch_indices"); - -} + d_check_overflow_nesting = db->getBool("check_overflow_nesting"); + d_check_proper_nesting = db->getBool("check_proper_nesting"); + d_check_connectors = db->getBool("DEV_check_connectors"); + d_print_steps = db->getBool("DEV_print_steps"); + d_log_metadata_statistics = db->getBool("DEV_log_metadata_statistics"); -/* - ************************************************************************* - * Log metadata statistics after generating a new level. - * - * Log the given level, its peer connector and if requested, the - * connectors to the next finer and next coarser levels. Connectors - * logged will have unit width. - ************************************************************************* - */ -void -GriddingAlgorithm::logMetadataStatistics( - const char *caller_name, - int ln, - bool log_fine_connector, - bool log_coarse_connector) const -{ - const std::string name("L" + tbox::Utilities::levelToString(ln)); - const hier::BoxLevel &level = *d_hierarchy->getPatchLevel(ln)->getBoxLevel(); - hier::PersistentOverlapConnectors &poc = level.getPersistentOverlapConnectors(); - const hier::IntVector &one_vector = hier::IntVector::getOne(d_dim); + d_check_nonrefined_tags = db->getChar("check_nonrefined_tags"); + d_check_overlapping_patches = db->getChar("check_overlapping_patches"); + d_check_nonnesting_user_boxes = db->getChar("check_nonnesting_user_boxes"); + d_check_boundary_proximity_violation = + db->getChar("DEV_check_boundary_proximity_violation"); - tbox::plog << "GriddingAlgorithm::" << caller_name << " added " << name << ":\n" - << level.format("\t",0) - << name << " statistics:\n" - << level.formatStatistics("\t"); + d_sequentialize_patch_indices = db->getBool("sequentialize_patch_indices"); - const hier::Connector &peer_conn = poc.findOrCreateConnector(level, one_vector, true); - tbox::plog << "Peer connector:\n" << peer_conn.format("\t",0) - << "Peer connector statistics:\n" << peer_conn.formatStatistics("\t"); + d_enforce_proper_nesting = db->getBool("enforce_proper_nesting"); + d_extend_to_domain_boundary = db->getBool("DEV_extend_to_domain_boundary"); + d_load_balance = db->getBool("DEV_load_balance"); - if ( log_fine_connector ) { - const hier::BoxLevel &fine_level = *d_hierarchy->getPatchLevel(ln+1)->getBoxLevel(); - const hier::Connector &fine_conn = poc.findOrCreateConnector(fine_level, one_vector, true); - tbox::plog << "Fine connector:\n" << fine_conn.format("\t",0) - << "Fine connector statistics:\n" << fine_conn.formatStatistics("\t"); - } + d_barrier_and_time = db->getBool("DEV_barrier_and_time"); - if ( log_coarse_connector ) { - const hier::BoxLevel &crse_level = *d_hierarchy->getPatchLevel(ln-1)->getBoxLevel(); - const hier::Connector &crse_conn = poc.findOrCreateConnector(crse_level, one_vector, true); - tbox::plog << "Coarse connector:\n" << crse_conn.format("\t",0) - << "Coarse connector statistics:\n" << crse_conn.formatStatistics("\t"); - } + d_save_tag_data = db->getBool("save_tag_data"); } /* @@ -4677,28 +4996,28 @@ GriddingAlgorithm::allocateTimers() getTimer("mesh::GriddingAlgorithm::load_balance"); t_load_balance0 = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::load_balance0"); - t_load_balance_setup = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::load_balance_setup"); t_bdry_fill_tags_create = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::bdry_fill_tags_create"); t_make_coarsest = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeCoarsestLevel()"); t_make_finer = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeFinerLevel()"); - t_make_finer_setup = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeFinerLevel()_setup"); - t_make_finer_tagging = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeFinerLevel()_tagging"); - t_make_finer_create = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeFinerLevel()_create"); t_regrid_all_finer = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::regridAllFinerLevels()"); + t_regrid_finer_do_tagging_before = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::regridFinerLevel_doTaggingBeforeRecursiveRegrid()"); + t_regrid_finer_do_tagging_after = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::regridFinerLevel_doTaggingAfterRecursiveRegrid()"); + t_regrid_finer_create_and_install = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::regridFinerLevel_createAndInstallNewLevel()"); t_regrid_finer_create = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::regridFinerLevel()_create"); t_fill_tags = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::fillTagsFromBoxLevel()"); t_tag_cells_for_refinement = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::tag_cells_for_refinement"); + t_initialize_level_data = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::initialize_level_data"); t_buffer_tags = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::bufferTagsOnLevel()"); t_second_finer_tagging = tbox::TimerManager::getManager()-> @@ -4709,22 +5028,18 @@ GriddingAlgorithm::allocateTimers() getTimer("mesh::GriddingAlgorithm::findRefinementBoxes()"); t_find_boxes_containing_tags = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::find_boxes_containing_tags"); - t_enforce_nesting = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::enforce_nesting"); + t_fix_zero_width_clustering = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::fix_zero_width_clustering"); + t_compute_proper_nesting_data = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::computeProperNestingData()"); + t_enforce_proper_nesting = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::enforceProperNesting()"); t_make_nesting_map = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeProperNestingMap()"); - t_make_nesting_map_compute = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeProperNestingMap()_compute"); - t_make_nesting_map_convert = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeProperNestingMap()_convert"); t_use_nesting_map = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::use_nesting_map"); t_make_overflow_map = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeOverflowNestingMap()"); - t_make_overflow_map_compute = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeOverflowNestingMap()_compute"); - t_make_overflow_map_convert = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::makeOverflowNestingMap()_convert"); t_use_overflow_map = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::use_overflow_map"); t_compute_external_parts = tbox::TimerManager::getManager()-> @@ -4732,53 +5047,31 @@ GriddingAlgorithm::allocateTimers() t_compute_nesting_violator = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::computeNestingViolator()"); t_extend_to_domain_boundary = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::extend_to_domain_boundary"); + getTimer("mesh::GriddingAlgorithm::extendBoxesToDomainBoundary()"); t_extend_within_domain = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::extend_within_domain"); t_grow_boxes_within_domain = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::grow_boxes_within_domain"); - t_sort_nodes = tbox::TimerManager::getManager()-> + t_renumber_boxes = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::renumberBoxes()"); t_find_new_to_new = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::find_new_to_new"); t_bridge_new_to_new = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::bridge_new_to_new"); - t_bridge_new_to_coarser = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::bridge_new_to_coarser"); t_bridge_new_to_finer = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::bridge_new_to_finer"); t_bridge_new_to_old = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::bridge_new_to_old"); - t_bridge_links = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::bridge_links"); - t_modify_connector = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::modify_connector"); t_make_domain = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeCoarsestLevel()_make_domain"); - t_get_balance = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::get_balance"); - t_use_balance = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::use_balance"); t_make_new = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::makeCoarsestLevel()_make_new"); t_process_error = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::process_error"); t_reset_hier = tbox::TimerManager::getManager()-> getTimer("mesh::GriddingAlgorithm::reset_hierarchy_config"); - t_misc1 = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::misc1"); - t_misc2 = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::misc2"); - t_misc3 = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::misc3"); - t_misc4 = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::misc4"); - t_misc5 = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::misc5"); - t_limit_overflow = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::limit_overflow"); - t_box_massage = tbox::TimerManager::getManager()-> - getTimer("mesh::GriddingAlgorithm::box_massage"); + t_enforce_overflow_nesting = tbox::TimerManager::getManager()-> + getTimer("mesh::GriddingAlgorithm::enforceOverflowNesting()"); } } @@ -4791,5 +5084,3 @@ GriddingAlgorithm::allocateTimers() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.h index c9a8d29c..81cd3897 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithm.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR hierarchy generation and regridding routines. * ************************************************************************/ @@ -20,13 +20,15 @@ #include "SAMRAI/mesh/MultiblockGriddingTagger.h" #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" #include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -87,134 +89,145 @@ namespace mesh { * BoxGeneratorStrategy argument. Routines that load balance patches * on a level are provided by the LoadBalanceStrategy constructor argument. * - * Initialization of a GriddingAlgorithm object is performed via a - * combination of default parameters and values read from an input - * database. Data read from input is summarized as follows: + * Input Parameters * - * Optional input keys, data types, and defaults: + * Definitions: + * - \b check_overflow_nesting * - * - \b efficiency_tolerance - * An array of double values, each of which specifies the minimum - * fraction of tagged cells to total cells in boxes used to - * construct patches on a new level. If the ratio is below the - * tolerance value, the box may be split into smaller boxes and - * pieces removed until the ratio becomes greater than or equal to - * the tolerance. This tolerance helps users control the amount - * of extra refined cells created (beyond those tagged explicitly) - * that is typical in patch-based AMR computations. - * If no input values are given, a default of 0.8 is - * used. See sample input below for input file format. - * The index of the value in the array corresponds to the number - * of the level to which the tolerance value applies. If more - * values are given than the maximum number of levels allowed in - * the hierarchy, extra values will be ignored. If fewer values - * are given, then the last value given will be used for each - * level without a specified input value. For example, if only a - * single value is specified, then that value will be used on all - * levels. - * - * - \b combine_efficiency - * An array of double values, each of which serves as a threshold - * for the ratio of the total number of cells in two boxes into which - * a box may be split and the number of cells in the original box. - * If that ratio is greater than the combine efficiency, the box will not - * be split. This tolerance helps users avoids splitting up portions - * of the domain into into very small patches which can increase - * the overhead of AMR operations. - * If no input values are given, a default of 0.8 is - * used. See sample input below for input file format. - * Multiple values in the array are handled similar to - * efficiency_tolerance. - * - * - @b check_nonnesting_user_boxes - * A flag to control how user-specified refinement boxes that violate - * proper nesting are handled. - * Set to one of these strings: - * @b "IGNORE" - nesting violations will be quietly disregarded. - * @b "WARN" - nesting violations will cause a warning but the - * code will continue anyway. - * @b "ERROR" - nesting violations will cause an unrecoverable - * assertion. - * The default is "ERROR". We highly recommend making nesting violation - * an error. The code may work anyway, but there are no guarantees. - * - * - @b check_boundary_proximity_violation - * A flag to control how to resolve refinement boxes that violate - * boundary proximity (are less than the max ghost cell width of - * physical boundaries without touching the boundary). - * Set to one of these strings: - * @b "IGNORE" - violations will be quietly disregarded. - * @b "WARN" - violations will cause a warning but the - * code will continue anyway. - * @b "ERROR" - violations will cause an unrecoverable - * assertion. - * The default is "ERROR". We highly recommend making boundary - * proximity violation an error. The code may work anyway, but there - * are no guarantees. + * - \b check_proper_nesting * * - \b check_nonrefined_tags - * A flag to control how to resolve user-specified tags that violate - * proper nesting. - * - * If a tag violates the nesting requirements, its location in index space - * will not be refined when creating the finer level. This flag allows the - * user to determine what to do when this occurs - * - * Set to one of these strings: - * @b "IGNORE" - violating tags will be quietly disregarded. - * @b "WARN" - violating tags will cause a warning and be - * disregarded. - * @b "ERROR" - violating tags will cause an unrecoverable - * assertion. - * The default is "WARN". It is fastest to ignore non-nesting tags - * because no checking has to be done. + * controls how to resolve user-specified tags that violate proper + * nesting. If a tag violates the nesting requirements, its location in + * index space will not be refined when creating the finer level. This + * flag allows the user to determine what to do when this occurs.
+ * Set to one of these characters:
+ * @b 'i' - violating tags will be quietly disregarded.
+ * @b 'w' - violating tags will cause a warning and be disregarded.
+ * @b 'e' - violating tags will cause an unrecoverable assertion.
+ * It is fastest to ignore non-nesting tags because no checking has to be + * done. * * - \b check_overlapping_patches - * A flag to control checking for overlapping patches on a new level. - * Set to one of these strings: - * @b "IGNORE" - there is no check for overlapping patches, - * and they will be quietly disregarded. - * @b "WARN" - overlapping patches will cause a warning and be - * disregarded. - * @b "ERROR" - violating tags will cause an unrecoverable - * assertion. - * The default is "WARN". The check for overlapping patches may be - * and should be bypassed by application that can tolerate overlaps. - * To prevent the creation of levels with overlapping patches, see - * the input flag - * "allow_patches_smaller_than_minimum_size_to_prevent_overlaps" - * - * - \b sequentialize_patch_indices - * A flag to specify whether patch indices will be globally sequentialized. - * This is not scalable, but is required for writing correct VisIt files. - * Due to the current VisIt requirement, this is currently true by default. - * It will evetually be set back to false after we remove the VisIt - * requirement. - * - * - @b log_metadata_statistics = FALSE - * Whether to log metadata statistics after generating a new level. - * This flag writes out data that would be of interest to analyzing - * how metadata statistics affects performance. - * + * controls checking for overlapping patches on a new level.
+ * Set to one of these characters:
+ * @b 'i' - there is no check for overlapping patches, and they will be + * quietly disregarded.
+ * @b 'w' - overlapping patches will cause a warning and be + * disregarded.
+ * @b 'e' - violating tags will cause an unrecoverable assertion.
+ * The check for overlapping patches may be and should be bypassed by + * applications that can tolerate overlaps. To prevent the creation of + * levels with overlapping patches, see the PatchHierarchy input flag + * "allow_patches_smaller_than_minimum_size_to_prevent_overlaps". * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. + * - \b check_nonnesting_user_boxes + * controls how user-specified refinement boxes that violate proper + * nesting are handled.
+ * Set to one of these characters:
+ * @b 'i' - nesting violations will be quietly disregarded.
+ * @b 'w' - nesting violations will cause a warning but the code will + * continue anyway.
+ * @b 'e' - nesting violations will cause an unrecoverable assertion
+ * We highly recommend making nesting violation an error. The code may + * work anyway, but there are no guarantees. * - * The following represents sample input data for a three-level problem: + * - \b sequentialize_patch_indices + * whether patch indices will be globally sequentialized. + * This is required for writing correct VisIt files, and + * due to the current VisIt requirement, this is currently true by + * default. It will evetually be set back to false after we remove the + * VisIt requirement. * - * \verbatim + * - \b enforce_proper_nesting + * + * - \b save_tag_data + * This is an option to save the tags that are used to create a new + * fine level in CellData on that level. * - * // Optional input: different efficiency tolerance for each coarser level - * efficiency_tolerance = 0.80e0, 0.85e0, 0.90e0 + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
check_overflow_nestingboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
check_proper_nestingboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
check_nonrefined_tagsstring"WARN""WARN", "IGNORE", "ERROR"optParameter read from restart db may be overridden by input db
check_overlapping_patchesstring"IGNORE""WARN", "IGNORE", "ERROR"optParameter read from restart db may be overridden by input db
check_nonnesting_user_boxesstring"ERROR""WARN", "IGNORE", "ERROR"optParameter read from restart db may be overridden by input db
sequentialize_patch_indicesboolTRUETRUE, FALSEoptParameter read from restart db may be overridden by input db
enforce_proper_nestingboolTRUETRUE, FALSEoptParameter read from restart db may be overridden by input db
save_tag_databoolFALSETRUE, FALSEoptParameter read from restart db will not be overridden by input db
* - * // Optional input: combine efficiency is same for all levels. - * combine_efficiency = 0.95e0 + * All values read in from a restart database may be overriden by input + * database values. If no new input database value is given, the restart + * database value is used. * - * \endverbatim - * - * @see mesh::TagAndInitializeStrategy - * @see mesh::LoadBalanceStrategy - * @see mesh::BoxGeneratorStrategy + * @see TagAndInitializeStrategy + * @see LoadBalanceStrategy + * @see BoxGeneratorStrategy */ class GriddingAlgorithm: @@ -222,6 +235,35 @@ class GriddingAlgorithm: public tbox::Serializable { public: + + /*! + * @brief static symbols to hold special tag values for user tags + * + * These symbols are used to hold special values that are added to the + * user tag data when the GriddingAlgorithm adds tags for algorithmic + * reasons. + * + * EXISTING_FINE_PATCHES_TAG_VAL: This value is placed in all cells + * of the tag level than intersect the existing next finest level. + * This value is added before calling the application's tagging methods, + * so that the application code can take into account the location + * of an existing finer level if it is relevant to its tagging criteria. + * + * NEW_FINE_PATCHES_TAG_VAL: This value is placed in all cells of the + * tag level that intersect the level that is two levels finer, if such + * a level exists. This value is added after the application's tagging + * methods are invoked, and is used to ensure that all finer levels of + * a hierarchy are nested inside coarser levels. + * + * BUFFER_TAG_VAL: This value is added to cells that are tagged due to + * the buffering operation of the GriddingAlgorithm, according to the + * tag buffer arguments that are passed into certain methods of this + * class. + */ + static const int EXISTING_FINE_PATCHES_TAG_VAL; + static const int NEW_FINE_PATCHES_TAG_VAL; + static const int BUFFER_TAG_VAL; + /*! * @brief The constructor for GriddingAlgorithm configures the * gridding algorithm with the patch hierarchy and concrete algorithm @@ -229,14 +271,7 @@ class GriddingAlgorithm: * * Gridding parameters are initialized from values provided in the * specified input and in the restart database corresponding to the - * specified object_name argument. The constructor also registers - * this object for restart using the specified object name when the - * boolean argument is true (default). - * - * If assertion checking is turned on, an unrecoverable assertion - * will result if any of the required pointer arguments is null. - * Assertions may also be thrown if any checks for consistency - * among input parameters fail. + * specified object_name argument. * * @param[in] hierarchy The hierarchy that this GriddingAlgorithm will * work on. The pointer is cached. All hierarchy operations will @@ -256,7 +291,11 @@ class GriddingAlgorithm: * @param[in] balancer_zero Special load balancer to use for level * zero. If omitted, will use @c balancer instead. * - * @param[in] register_for_restart + * @pre hierarchy + * @pre !object_name.empty() + * @pre tag_init_strategy + * @pre generator + * @pre balancer */ GriddingAlgorithm( const boost::shared_ptr& hierarchy, @@ -266,8 +305,7 @@ class GriddingAlgorithm: const boost::shared_ptr& generator, const boost::shared_ptr& balancer, const boost::shared_ptr& balancer_zero = - boost::shared_ptr(), - bool register_for_restart = true); + boost::shared_ptr()); /*! * @brief Destructor @@ -297,6 +335,8 @@ class GriddingAlgorithm: * cells for refinement, whereas the other routine does. * * @param[in] level_time Simulation time. + * + * @pre d_hierarchy->getMaxNumberOfLevels() > 0 */ void makeCoarsestLevel( @@ -319,21 +359,28 @@ class GriddingAlgorithm: * evolve before regridding occurs (e.g., number of timesteps * taken) when calculating the tag_buffer. * - * @param[in] level_time See above text. + * @param[in] tag_buffer See above text. + * + * @param[in] initial_cycle See above text * - * @param[in] initial_time See above text. + * @param[in] cycle See above text. * - * @param[in] tag_buffer See above text. + * @param[in] level_time See above text.. * * @param[in] regrid_start_time The simulation time when the * regridding operation began (this parameter is ignored except * when using Richardson extrapolation) + * + * @pre d_hierarchy + * @pre d_hierarchy->getPatchLevel(d_hierarchy->getFinestLevelNumber()) + * @pre tag_buffer >= 0 */ void makeFinerLevel( - const double level_time, - const bool initial_time, const int tag_buffer, + const bool initial_cycle, + const int cycle, + const double level_time, const double regrid_start_time = 0.0); /*! @@ -353,33 +400,36 @@ class GriddingAlgorithm: * This constraint, though seemingly restrictive makes the * process of maintaining properly nested levels much easier. * - * Important note: If assertion checking is activated, several - * checks are applied to the functions arguments. If any check is - * violated, an unrecoverable assertion will result. In - * particular, the given level number must match that of of some - * level in the hierarchy. Also, the tag buffer array must contain - * a positive value for each level in the hierarchy. - * * @param[in] level_number Coarsest level on which cells will be * tagged for refinement * - * @param[in] regrid_time Simulaition time when regridding occurs - * * @param[in] tag_buffer Size of buffer on each level around tagged * cells that will be covered by the next finer level * + * @param[in] cycle Simulaition cycle when regridding occurs + * + * @param[in] level_time Simulation time of the level corresponding to + * level_num when regridding occurs + * * @param[in] regrid_start_time The simulation time when the * regridding operation began on each level (this parameter is * ignored except when using Richardson extrapolation) * * @param[in] level_is_coarsest_to_sync Level is the coarsest to sync + * + * @pre (level_number >= 0) && + * (level_number <= d_hierarchy->getFinestLevelNumber()) + * @pre d_hierarchy->getPatchLevel(level_number) + * @pre tag_buffer.size() >= level_number + 1 + * @pre for each member, tb, of tag_buffer, tb >= 0 */ void regridAllFinerLevels( const int level_number, - const double regrid_time, - const tbox::Array& tag_buffer, - tbox::Array regrid_start_time = tbox::Array(), + const std::vector& tag_buffer, + const int cycle, + const double level_time, + const std::vector& regrid_start_time = std::vector(), const bool level_is_coarsest_to_sync = true); /*! @@ -413,72 +463,18 @@ class GriddingAlgorithm: getLoadBalanceStrategyZero() const; /*! - * @brief Set efficiency tolerance for clustering tags on level. - * - * @param[in] efficiency_tolerance - * @param[in] level_number - */ - void - setEfficiencyTolerance( - const double efficiency_tolerance, - const int level_number) - { - TBOX_ASSERT((level_number >= 0) && - (level_number < d_hierarchy->getMaxNumberOfLevels())); - TBOX_ASSERT((efficiency_tolerance >= 0) && - (efficiency_tolerance <= 1.0)); - d_efficiency_tolerance[level_number] = efficiency_tolerance; - } - - /*! - * @brief Return efficiency tolerance for clustering tags on level. - * - * @return efficiency tolerance for clustering tags on level. + * @brief Return pointer to PatchHierarchy data member. */ - double - getEfficiencyTolerance( - const int level_number) const - { - TBOX_ASSERT((level_number >= 0) && - (level_number < d_hierarchy->getMaxNumberOfLevels())); - int size = d_efficiency_tolerance.getSize(); - return (level_number < size) ? - d_efficiency_tolerance[level_number] : - d_efficiency_tolerance[size - 1]; - } + boost::shared_ptr + getPatchHierarchy() const; /*! - * @brief Set combine efficiency for clustering tags on level. - * - * @param[in] combine_efficiency - * @param[in] level_number + * @brief Return patch data index for tag data saved in the hierarchy. */ - void - setCombineEfficiency( - const double combine_efficiency, - const int level_number) + int + getSavedTagPatchDataIndex() const { - TBOX_ASSERT((level_number >= 0) && - (level_number < d_hierarchy->getMaxNumberOfLevels())); - TBOX_ASSERT((combine_efficiency >= 0) && (combine_efficiency <= 1.0)); - d_combine_efficiency[level_number] = combine_efficiency; - } - - /*! - * @brief Return combine efficiency for clustering tags on level. - * - * @return combine efficiency for clustering tags on level. - */ - double - getCombineEfficiency( - const int level_number) const - { - TBOX_ASSERT((level_number >= 0) && - (level_number < d_hierarchy->getMaxNumberOfLevels())); - int size = d_combine_efficiency.getSize(); - return (level_number < size) ? - d_combine_efficiency[level_number] : - d_combine_efficiency[size - 1]; + return d_saved_tag_indx; } /*! @@ -489,13 +485,13 @@ class GriddingAlgorithm: std::ostream& os) const; /*! - * @brief Write object state out to the gien database. + * @brief Write object state out to the given restart database. * - * When assertion checking is active, the database pointer must be non-null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /* * @brief Write out statistics recorded on numbers of cells and patches generated. @@ -504,6 +500,15 @@ class GriddingAlgorithm: printStatistics( std::ostream& s = tbox::plog) const; + /*! + * @brief Get the name of this object. + */ + const std::string& + getObjectName() const + { + return d_object_name; + } + private: /* * Static integer constant describing this class's version number. @@ -513,23 +518,21 @@ class GriddingAlgorithm: //! @brief Shorthand typedef. typedef hier::Connector::NeighborSet NeighborSet; - /* + /*! * @brief Read input data from specified database and initialize class members. * - * When assertion checking is active, the database pointer must be non-null. + * The database pointer must be non-null. * - * @param[in] db + * @param[in] input_db * - * @param[in] is_from_restart Should be set to true if the - * simulation is from restart. Otherwise, it should be set to - * false. + * @param[in] is_from_restart */ void getFromInput( - const boost::shared_ptr& db, + const boost::shared_ptr& input_db, bool is_from_restart); - /* + /*! * @brief Read object state from the restart file and initialize * class data members. * @@ -547,34 +550,44 @@ class GriddingAlgorithm: void getFromRestart(); - /* + /*! * @brief Recursively regrid the hierarchy level and all finer * levels in the hierarchy. * * This private member function is invoked by the * regridAllFinerLevels() routine. It may invoke recursively * invoke itself. + * + * @pre (level_number >= 0) && + * (level_number <= d_hierarchy->getFinestLevelNumber()) + * @pre d_hierarchy->getPatchLevel(level_number) + * @pre (finest_level_not_regridded >= 0) && + * (finest_level_not_regridded <= level_number) + * @pre tag_buffer.size() >= level_number + 1 + * @pre for each member, tb, of tag_buffer, tb >= 0 */ void regridFinerLevel( const int level_number, const double regrid_time, + const int regrid_cycle, const int finest_level_not_regridded, const bool level_is_coarsest_to_sync, - const tbox::Array& tag_buffer, - const tbox::Array& regrid_start_time = tbox::Array(0)); + const std::vector& tag_buffer, + const std::vector& regrid_start_time = std::vector(0)); - /* + /*! * @brief Tagging stuff before recursive regrid, called from regridFinerLevel. */ void regridFinerLevel_doTaggingBeforeRecursiveRegrid( const int tag_ln, const bool level_is_coarsest_sync_level, - const tbox::Array& regrid_start_time, - const double regrid_time); + const std::vector& regrid_start_time, + const double regrid_time, + const int regrid_cycle); - /* + /*! * @brief Tagging stuff after recursive regrid, called from regridFinerLevel. * * A side-effect of this method is setting the overlap Connectors @@ -583,32 +596,40 @@ class GriddingAlgorithm: */ void regridFinerLevel_doTaggingAfterRecursiveRegrid( - hier::Connector& tag_to_finer, - hier::Connector& finer_to_tag, + boost::shared_ptr& tag_to_finer, const int tag_ln, - const tbox::Array& tag_buffer); + const std::vector& tag_buffer, + double regrid_time); - /* + /*! * @brief Given the metadata describing the new level, this method * creates and installs new PatchLevel in the hierarchy. + * + * @pre tag_to_new && tag_to_new->hasTranspose() + * @pre new_box_level + * @pre !d_hierarchy->levelExists(tag_ln + 2) || tag_to_finer + * @pre !d_hierarchy->levelExists(tag_ln + 2) || tag_to_finer->hasTranspose() */ void regridFinerLevel_createAndInstallNewLevel( const int tag_ln, const double regrid_time, - hier::Connector* tag_to_new, - hier::Connector* new_to_tag, - const hier::Connector& tag_to_finer, - const hier::Connector& finer_to_tag); + boost::shared_ptr& tag_to_new, + boost::shared_ptr tag_to_finer, + boost::shared_ptr new_box_level); - /* + /*! * @brief Set all tags on a level to a given value. * * @param[in] tag_value * - * @param[in] level + * @param[in] tag_level * * @param[in] tag_index + * + * @pre (tag_value == d_true_tag) || (tag_value == d_false_tag) + * @pre tag_level + * @pre (tag_index == d_tag_indx) || (tag_index == d_buf_tag_indx) */ void fillTags( @@ -616,7 +637,7 @@ class GriddingAlgorithm: const boost::shared_ptr& tag_level, const int tag_index) const; - /* + /*! * @brief Set integer tags to specified value on intersection * between patch level and a BoxLevel * @@ -627,126 +648,173 @@ class GriddingAlgorithm: * * @param[in] tag_value * - * @param[in] level + * @param[in] tag_level * * @param[in] index * - * @param[in] level_to_fill_mapped_box_level Connector from the + * @param[in] tag_level_to_fill_box_level Connector from the * level with the tags to the BoxLevel describing where to * fill. * * @param[in] interior_only * - * @param fill_box_growth How much to grow fill boxes before using + * @param[in] fill_box_growth How much to grow fill boxes before using * them to tag. Must be in index space of level holding fill boxes. + * + * @param[in] preserve_existing_tags If set to true, only cells that + * have a value of d_false_tag on input will be changed to tag_value. If + * false, then all cells intersecting by the fill BoxLevel will be set to + * tag_value. + * + * @pre (tag_value == d_true_tag) || (tag_value == d_false_tag) + * @pre tag_level + * @pre (index == d_tag_indx || index == d_buf_tag_indx) + * @pre tag_level_to_fill_box_level.getHeadCoarserFlag() == false */ void fillTagsFromBoxLevel( const int tag_value, const boost::shared_ptr& tag_level, const int index, - const hier::Connector& tag_level_to_fill_mapped_box_level, + const hier::Connector& tag_level_to_fill_box_level, const bool interior_only, - const hier::IntVector& fill_box_growth) const; + const hier::IntVector& fill_box_growth, + const bool preserve_existing_tags) const; - /* + /*! + * @brief Enforce proper nesting. + * + * @param[in,out] new_box_level + * + * @param[in,out] tag_to_new + * + * @param[in] tag_ln + */ + void + enforceProperNesting( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new, + int tag_ln) const; + + /*! * @brief Make a map that, when applied to an improperly nested * BoxLevel, removes the nonnesting parts. * - * @param[out] nested_mapped_box_level The nesting parts of the + * @param[out] nested_box_level The nesting parts of the * unnested BoxLevel. * * @param[out] unnested_to_nested The mapping from the unnested * BoxLevel to the nested BoxLevel. * - * @param[in] unnested_mapped_box_level + * @param[in] unnested_box_level * * @param[in] tag_to_unnested Overlap Connector from the tag level - * to unnested_mapped_box_level. - * - * @param[in] unnested_to_tag Transpose of tag_to_unnested. + * to unnested_box_level. * * @param[in] unnested_ln Level number of PatchLevel being * generated (one more than the tag level number). + * + * @param[in] oca + * + * @pre tag_to_unnested.hasTranspose() + * @pre d_hierarchy->getDim() == unnested_box_level.getDim() */ void makeProperNestingMap( - hier::BoxLevel& nested_mapped_box_level, - hier::Connector& unnested_to_nested, - const hier::BoxLevel& unnested_mapped_box_level, + boost::shared_ptr& nested_box_level, + boost::shared_ptr& unnested_to_nested, + const hier::BoxLevel& unnested_box_level, const hier::Connector& tag_to_unnested, - const hier::Connector& unnested_to_tag, - const int unnested_ln) const; + const int unnested_ln, + const hier::OverlapConnectorAlgorithm& oca) const; - /* + /*! + * @brief Enforce overflow nesting. + * + * @param[in,out] new_box_level + * + * @param[in,out] tag_to_new + */ + void + enforceOverflowNesting( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new) const; + + /*! * @brief Make a map that, when applied to a BoxLevel that * extends outside of a reference BoxLevel, removes those * outside parts. * - * @param[out] nested_mapped_box_level The nesting parts of the - * unnested BoxLevel. + * @param[out] nested_box_level The nesting parts of the unnested BoxLevel. * * @param[out] unnested_to_nested The mapping from the unnested * BoxLevel to the nested BoxLevel. * - * @param[in] unnested_mapped_box_level + * @param[in] unnested_box_level * * @param[in] unnested_to_reference + * + * @pre d_hierarchy->getDim() == unnested_box_level.getDim() */ void makeOverflowNestingMap( - hier::BoxLevel& nested_mapped_box_level, - hier::Connector& unnested_to_nested, - const hier::BoxLevel& unnested_mapped_box_level, + boost::shared_ptr& nested_box_level, + boost::shared_ptr& unnested_to_nested, + const hier::BoxLevel& unnested_box_level, const hier::Connector& unnested_to_reference) const; /*! * @brief Make a map from a BoxLevel to parts of that BoxLevel * that violate proper nesting. * + * @param[out] violator BoxLevel containing violating parts of candidate. + * + * @param[in] candidate_to_violator Connector between candidate and violator. + * * @param[in] candidate BoxLevel being examined for nesting violation. * - * @param[out] violator BoxLevel containing violating parts of candidate. + * @param[in] candidate_to_hierarchy Connector to box_level number + * tag_ln in the hierarchy. * * @param[in] tag_ln Level number of the level that candidate should nest in. * - * @param[in] candidate_to_hierarchy Connector to mapped_box_level number - * tag_ln in the hierarchy. + * @param[in] oca * - * @param[in] hierarchy_to_candidate Connector from mapped_box_level number - * tag_ln in the hierarchy. + * @pre candidate_to_hierarchy.hasTranspose() + * @pre d_hierarchy->getDim() == candidate.getDim() + * @pre candidate_to_hierarchy.getRatio() == hier::IntVector::getOne(d_hierarchy->getDim()) + * @pre candidate_to_hierarchy.getTranspose().getRatio() == hier::IntVector::getOne(d_hierarchy->getDim()) */ void computeNestingViolator( - hier::BoxLevel& violator, - hier::Connector& candidate_to_violator, + boost::shared_ptr& violator, + boost::shared_ptr& candidate_to_violator, const hier::BoxLevel& candidate, const hier::Connector& candidate_to_hierarchy, - const hier::Connector& hierarchy_to_candidate, - const int tag_ln) const; + const int tag_ln, + const hier::OverlapConnectorAlgorithm& oca) const; - /* + /*! * @brief Extend Boxes to domain boundary if they they are too close. * * See hier::BoxUtilities::extendBoxToDomainBoundary(). * - * @param[in,out] new_mapped_box_level + * @param[in,out] new_box_level * * @param[in,out] tag_to_new * - * @param[in,out] new_to_tag - * - * @param[in] physical_domain_array Array holding domain for each block + * @param[in] physical_domain_array Vector holding domain for each block * * @param[in] extend_ghosts Extend the boxes to the boundary if * they less than extend_ghosts cells from the boundary. + * + * @pre tag_to_new.hasTranspose() */ void extendBoxesToDomainBoundary( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - const tbox::Array& physical_domain_array, + const std::vector& physical_domain_array, const hier::IntVector& extend_ghosts) const; /*! @@ -756,55 +824,61 @@ class GriddingAlgorithm: * constructing level number ln+1. * * @param[in] ln + * + * @param[in] oca + * + * @pre (d_base_ln >= 0) && (ln >= d_base_ln) + * @pre (ln == d_base_ln) || (d_to_nesting_complement[ln - 1]->isFinalized()) */ void computeProperNestingData( - const int ln); + const int ln, + const hier::OverlapConnectorAlgorithm& oca); /*! * @brief Attempt to fix boxes that are too small by growing them * within the nesting-restricted domain. * - * @param[in,out] new_mapped_box_level BoxLevel being formed + * @param[in,out] new_box_level BoxLevel being formed * into the new new level. * * @param[in,out] tag_to_new Connector to be updated. * - * @param[in,out] new_to_tag Connector to be updated. - * * @param[in] min_size * * @param[in] tag_ln Level number of the tag level. + * + * @pre tag_no_new.hasTranspose() + * @pre (d_hierarchy->getDim() == new_box_level.getDim()) && + * (d_hierarchy->getDim() == min_size.getDim()) */ void growBoxesWithinNestingDomain( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, const hier::IntVector& min_size, const int tag_ln) const; - /* + /*! * @brief Refine a BoxLevel from the resolution of the tag * level to the resolution of the level being created. * - * @param[in,out] new_mapped_box_level BoxLevel being formed + * @param[in,out] new_box_level BoxLevel being formed * into the new new level. * * @param[in,out] tag_to_new Connector to be updated. * - * @param[in,out] new_to_tag Connector to be updated. - * * @param[in] ratio + * + * @pre tag_to_new.hasTranspose() */ void refineNewBoxLevel( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, const hier::IntVector& ratio) const; - /* + /*! * @brief Renumber Boxes in a BoxLevel. * * This method renumbers Boxes to give them globally @@ -814,27 +888,31 @@ class GriddingAlgorithm: * approach. Sorting by box coordinates removes the randomness in * the ordering of boxes. * - * @param[in,out] new_mapped_box_level - * - * @param[in,out] tag_to_new + * @param[in,out] new_box_level * - * @param[in,out] new_to_tag + * @param[in,out] ref_to_new * * @param[in] sort_by_corners * * @param[in] sequentialize_global_indices + * + * @pre d_hierarchy->getDim() == new_box_level.getDim() */ void renumberBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + hier::BoxLevel& new_box_level, + hier::Connector* ref_to_new, bool sort_by_corners, bool sequentialize_global_indices) const; - /* + /*! * @brief Buffer each integer tag on patch level matching given tag * value with a border of matching tags. + * + * @pre (tag_value == d_true_tag) || (tag_value == d_false_tag) + * @pre level + * @pre buffer_size >= 0 + * @pre d_hierarchy->getDim() == level->getDim() */ void bufferTagsOnLevel( @@ -842,7 +920,7 @@ class GriddingAlgorithm: const boost::shared_ptr& level, const int buffer_size) const; - /* + /*! * @brief Set the new level boxes using information stored in a file. * * If cell tagging is not performed, the new level boxes may @@ -853,35 +931,40 @@ class GriddingAlgorithm: * parameter "remove_old_fine_level" which indicates whether * the level box configuration has changed and, consequently, * whether we need to remove the old level. + * + * @pre (level_number >= 0) && + * (level_number <= d_hierarchy->getFinestLevelNumber()) */ void readLevelBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& coarser_to_new, - hier::Connector& new_to_coarser, + boost::shared_ptr& new_box_level, + boost::shared_ptr& coarser_to_new, const int level_number, const double regrid_time, + const int regrid_cycle, bool& remove_old_fine_level); - /* + /*! * @brief Given the number for the level where cells are tagged for * refinement, compute a BoxLevel from which a refinement of * the level may be constructed. * * It is assumed that the integer tags that identify cells for * refinement have been set on the level before this routine is - * called. At the end of this function, new_mapped_box_level will + * called. At the end of this function, new_box_level will * represent the box extents of a new fine level on the given * block. + * + * @pre (tag_ln >= 0) && (tag_ln <= d_hierarchy->getFinestLevelNumber()) + * @pre d_hierarchy->getPatchLevel(tag_ln) */ void findRefinementBoxes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, const int tag_ln) const; - /* + /*! * @brief Set patch size and ghost cell information needed to * create new refinement levels. * @@ -904,6 +987,13 @@ class GriddingAlgorithm: * level, the smallest box to refine on the next coarser level, and the * number of cells that a patch may be extended to the boundary if it * sufficiently close to the boundary (extend_ghosts). + * + * @pre (d_hierarchy->getDim() == smallest_patch.getDim()) && + * (d_hierarchy->getDim() == smallest_box_to_refine.getDim()) && + * (d_hierarchy->getDim() == largest_patch.getDim()) && + * (d_hierarchy->getDim() == extend_ghosts.getDim()) + * @pre (level_number >= 0) && + * (level_number < d_hierarchy->getMaxNumberOfLevels()) */ void getGriddingParameters( @@ -914,6 +1004,12 @@ class GriddingAlgorithm: const int level_number, const bool for_building_finer) const; + /*! + * @brief Compute d_tag_to_cluster_width. + */ + void + computeTagToClusterWidths(); + /*! * @brief Check domain boxes for violations of certain constraints. */ @@ -937,7 +1033,7 @@ class GriddingAlgorithm: * intersect the boundary in weird ways, so we disallow it. This * method writes a warning describing each violation found. * - * @param[in] mapped_box_level + * @param[in] box_level * * @param[in] extend_ghosts * @@ -945,20 +1041,43 @@ class GriddingAlgorithm: */ size_t checkBoundaryProximityViolation( - const hier::BoxLevel& mapped_box_level, + const hier::BoxLevel& box_level, const hier::IntVector& extend_ghosts) const; /*! * @brief Check for boxes that are too close to the physical * boundary without touching it. * - * Compute the allowable distance from boxes in new_mapped_box_level + * Compute the allowable distance from boxes in new_box_level * to domain boundary and delegate the checking. */ void checkBoundaryProximityViolation( const int tag_ln, - const hier::BoxLevel& new_mapped_box_level) const; + const hier::BoxLevel& new_box_level) const; + + /*! + * @brief Set tag data that will be only have the values expected by + * the algorithms for box generation. + * + * Boolean tag data should have only values of d_true_tag or + * d_false_tag. This method interprets user tag data to set + * boolean tag data to these values. + * + * Note that the use of the term "boolean" does not mean that the bool + * type is used, but that the integer data will have only two possible + * values. + * + * @param[in] tag_level Level being tagged + * @param[in] preserve_existing_tags If set to true, any cells already + * set to d_true_tag in the algorthmic tag data will be guaranteed to + * remain so. If false, no current values of the boolean tag data + * will be guaranteed to be preserved. + */ + void + setBooleanTagData( + const boost::shared_ptr& tag_level, + bool preserve_existing_tags) const; /*! * @brief Check for user tags that violate proper nesting. @@ -966,13 +1085,18 @@ class GriddingAlgorithm: * @param tag_level Tag level * * @param tag_ln Tag level number + * + * @param oca + * + * @pre d_hierarchy->getDim() == tag_level.getDim() */ void checkNonrefinedTags( const hier::PatchLevel& tag_level, - int tag_ln) const; + int tag_ln, + const hier::OverlapConnectorAlgorithm& oca) const; - /* + /*! * @brief Reset data that handles tag buffering. * * Resets the tag buffering data so that it will be able to handle a @@ -981,16 +1105,26 @@ class GriddingAlgorithm: * @param tag_buffer The size of the buffer */ void - resetTagBufferingData(const int tag_buffer); + resetTagBufferingData( + const int tag_buffer); /*! - * @brief Check for overlapping patches within a level. + * @brief Check for overlapping patches within a level when you + * have the self Connector for the level. * - * @param[in] mapped_box_level_to_self + * @param[in] box_level_to_self */ void checkOverlappingPatches( - const hier::Connector& mapped_box_level_to_self) const; + const hier::Connector& box_level_to_self) const; + + /*! + * @brief Check for overlapping patches within the level when you + * do not have the self Connector for the level. + */ + void + checkOverlappingPatches( + const hier::BoxLevel& box_level) const; /*! * @brief Warn if the domain is too small any periodic direction. @@ -1005,61 +1139,12 @@ class GriddingAlgorithm: allocateTimers(); /*! - * @brief Log metadata statistics after generating a new level. + * @brief Assert that the given SAMRAI_MPI has no message waiting + * to be received. */ - void logMetadataStatistics( - const char *caller_name, - int ln, - bool log_fine_connector, - bool log_coarse_connector) const; - - /*! - * @brief Initialize static objects and register shutdown routine. - * - * Only called by StartupShutdownManager. - */ - static void - startupCallback() - { - s_tag_indx = new tbox::Array( - tbox::Dimension::MAXIMUM_DIMENSION_VALUE, - -1); - s_buf_tag_indx = new tbox::Array( - tbox::Dimension::MAXIMUM_DIMENSION_VALUE, - -1); - } - - /*! - * @brief Method registered with ShutdownRegister to cleanup statics. - * - * Only called by StartupShutdownManager. - */ - static void - shutdownCallback() - { - delete s_tag_indx; - delete s_buf_tag_indx; - } - - /*! - * @brief Initialize static objects and register shutdown routine. - * - * Only called by StartupShutdownManager. - */ - static void - initializeCallback() - { - } - - /*! - * @brief Method registered with ShutdownRegister to cleanup statics. - * - * Only called by StartupShutdownManager. - */ - static void - finalizeCallback() - { - } + void + assertNoMessageForCommunicator( + const tbox::SAMRAI_MPI& mpi) const; /* * @brief Record statistics on how many patches and cells were generated. @@ -1079,25 +1164,13 @@ class GriddingAlgorithm: */ GriddingAlgorithmConnectorWidthRequestor d_connector_width_requestor; - /* - * Static members for managing shared tag data among multiple - * GriddingAlgorithm objects. - */ - static tbox::Array * s_tag_indx; - static tbox::Array * s_buf_tag_indx; - - const tbox::Dimension d_dim; - hier::IntVector d_buf_tag_ghosts; /* * The object name is used for error reporting and accessing - * restart file information. Whether the object writes restart - * file data depends on the value of this boolean which is - * set in the constructor. + * restart file information. */ std::string d_object_name; - bool d_registered_for_restart; /* * Data members that manage application-specific level initialization @@ -1118,30 +1191,52 @@ class GriddingAlgorithm: */ MultiblockGriddingTagger * d_mb_tagger_strategy; - /* + /*! + * @brief Variables and patch data indices for tags. + * * Cell-centered integer variables use to tag cells for refinement. - * The descriptor index d_tag_indx is used to obtain tag information + * The descriptor index d_user_tag_indx is used to obtain tag information * from user-defined routines on patch interiors. The descriptor index * d_buf_tag_indx is used to buffer tags on patches that may be - * distributed across processors. The refine algorithm and schedule are - * used for interprocessor communication. - */ - boost::shared_ptr > d_tag; + * distributed across processors. d_boolean_tag_indx is used to put tag + * values in a standard format that will be understood by box generator + * implementations, and d_saved_tag_indx is used to preserve tag values + * on new levels after gridding operations are completed. Note that + * d_boolean_tag does not use the bool type, but rather its associated + * integer data is treated as a boolean with only two possible values. + */ + boost::shared_ptr > d_user_tag; + boost::shared_ptr > d_saved_tag; + boost::shared_ptr > d_boolean_tag; boost::shared_ptr > d_buf_tag; - int d_tag_indx; + int d_user_tag_indx; + int d_saved_tag_indx; + int d_boolean_tag_indx; int d_buf_tag_indx; boost::shared_ptr d_bdry_fill_tags; - tbox::Array > d_bdry_sched_tags; + std::vector > d_bdry_sched_tags; - /* - * True and false integer tag values set in constructor and used to - * set and compare integer tag values on the patch hierarchy. Generally, + /*! + * @brief Refine algorithm and schedule for filling saved tag data on new + * levels. + */ + boost::shared_ptr d_fill_saved_tags; + boost::shared_ptr d_saved_tags_sched; + + /*! + * @brief Tag values defined in the constructor. + * + * Tag values defined in the constructor and used to set and compare + * integer tag values on the patch hierarchy. Generally, these * these variables are easier to read in the code than integer constants, * such as 0 and 1. */ const int d_true_tag; const int d_false_tag; + const int d_from_fine_pretag; + const int d_from_fine_tag; + const int d_buffer_tag; /*! * @brief Finest level not changed during regrid. @@ -1152,19 +1247,10 @@ class GriddingAlgorithm: */ int d_base_ln; - /* - * @brief Efficiency tolerance during clustering. - * - * See input parameter efficiency_tolerance. - */ - tbox::Array d_efficiency_tolerance; - - /* - * @brief Combine efficiency during clustering. - * - * See input parameter combine_efficiency. + /*! + * @brief Connector widths to use when clustering. */ - tbox::Array d_combine_efficiency; + std::vector d_tag_to_cluster_width; /* * @brief When regridding level ln+1, the new level ln must not flow into @@ -1173,23 +1259,15 @@ class GriddingAlgorithm: * Has length d_hierarchy->getMaxNumberOfLevels(). The objects are * initialized only during gridding/regridding. */ - std::vector d_proper_nesting_complement; + std::vector > d_proper_nesting_complement; /* * @brief Connectors from the hierarchy to d_proper_nesting_complement. * * d_to_nesting_complement[ln] goes from level ln to - * d_proper_nesting_complelemt[ln]. - */ - std::vector d_to_nesting_complement; - - /* - * @brief Connectors from d_proper_nesting_complement to the hierarchy. - * - * d_from_nesting_complement[ln] goes from - * d_proper_nesting_complement[ln] to level ln. + * d_proper_nesting_complement[ln]. */ - std::vector d_from_nesting_complement; + std::vector > d_to_nesting_complement; /*! * @brief How to resolve user tags that violate nesting requirements. @@ -1234,6 +1312,42 @@ class GriddingAlgorithm: */ bool d_log_metadata_statistics; + /*! + * @brief OverlapConnectorAlgorithm object used for regrid. + */ + mutable hier::OverlapConnectorAlgorithm d_oca; + + /*! + * @brief MappingConnectorAlgorithm object used for regrid. + */ + mutable hier::MappingConnectorAlgorithm d_mca; + + /*! + * @brief BoxLevelConnectorUtils object used for regrid. + */ + mutable hier::BoxLevelConnectorUtils d_blcu; + + /*! + * @brief OverlapConnectorAlgorithm object used for initial mesh + * construction and other one-time operations that are not expected + * to scale well. + */ + mutable hier::OverlapConnectorAlgorithm d_oca0; + + /*! + * @brief MappingConnectorAlgorithm object used for initial mesh + * construction and other one-time operations that are not expected + * to scale well. + */ + mutable hier::MappingConnectorAlgorithm d_mca0; + + /*! + * @brief BoxLevelConnectorUtils object used for initial mesh + * construction and other one-time operations that are not expected + * to scale well. + */ + mutable hier::BoxLevelConnectorUtils d_blcu0; + /* * Switches for massaging boxes after clustering. Should be on for * most AMR applications. Turning off is mainly for debugging @@ -1243,6 +1357,11 @@ class GriddingAlgorithm: bool d_extend_to_domain_boundary; bool d_load_balance; + /* + * Flag to save tag data on new fine levels. + */ + bool d_save_tag_data; + //@{ //! @name Used for evaluating peformance. bool d_barrier_and_time; @@ -1254,71 +1373,58 @@ class GriddingAlgorithm: boost::shared_ptr t_find_domain_complement; boost::shared_ptr t_load_balance; boost::shared_ptr t_load_balance0; - boost::shared_ptr t_load_balance_setup; boost::shared_ptr t_bdry_fill_tags_create; boost::shared_ptr t_make_coarsest; boost::shared_ptr t_make_finer; - boost::shared_ptr t_make_finer_setup; - boost::shared_ptr t_make_finer_tagging; - boost::shared_ptr t_make_finer_create; boost::shared_ptr t_regrid_all_finer; + boost::shared_ptr t_regrid_finer_do_tagging_before; + boost::shared_ptr t_regrid_finer_do_tagging_after; + boost::shared_ptr t_regrid_finer_create_and_install; boost::shared_ptr t_regrid_finer_create; - boost::shared_ptr t_bridge_links; boost::shared_ptr t_fill_tags; boost::shared_ptr t_tag_cells_for_refinement; + boost::shared_ptr t_initialize_level_data; boost::shared_ptr t_buffer_tags; boost::shared_ptr t_bdry_fill_tags_comm; boost::shared_ptr t_second_finer_tagging; boost::shared_ptr t_find_refinement; boost::shared_ptr t_bridge_new_to_new; boost::shared_ptr t_find_new_to_new; - boost::shared_ptr t_bridge_new_to_coarser; boost::shared_ptr t_bridge_new_to_finer; boost::shared_ptr t_bridge_new_to_old; boost::shared_ptr t_find_boxes_containing_tags; - boost::shared_ptr t_enforce_nesting; + boost::shared_ptr t_fix_zero_width_clustering; + boost::shared_ptr t_enforce_proper_nesting; + boost::shared_ptr t_compute_proper_nesting_data; boost::shared_ptr t_make_nesting_map; - boost::shared_ptr t_make_nesting_map_compute; - boost::shared_ptr t_make_nesting_map_convert; boost::shared_ptr t_use_nesting_map; boost::shared_ptr t_make_overflow_map; - boost::shared_ptr t_make_overflow_map_compute; - boost::shared_ptr t_make_overflow_map_convert; boost::shared_ptr t_use_overflow_map; boost::shared_ptr t_compute_external_parts; boost::shared_ptr t_compute_nesting_violator; boost::shared_ptr t_extend_to_domain_boundary; boost::shared_ptr t_extend_within_domain; boost::shared_ptr t_grow_boxes_within_domain; - boost::shared_ptr t_sort_nodes; - boost::shared_ptr t_modify_connector; - boost::shared_ptr t_misc1; - boost::shared_ptr t_misc2; - boost::shared_ptr t_misc3; - boost::shared_ptr t_misc4; - boost::shared_ptr t_misc5; + boost::shared_ptr t_renumber_boxes; boost::shared_ptr t_make_domain; - boost::shared_ptr t_get_balance; - boost::shared_ptr t_use_balance; boost::shared_ptr t_make_new; boost::shared_ptr t_process_error; - boost::shared_ptr t_limit_overflow; + boost::shared_ptr t_enforce_overflow_nesting; boost::shared_ptr t_reset_hier; - boost::shared_ptr t_box_massage; #ifdef GA_RECORD_STATS /* * Statistics on number of cells and patches generated. */ - tbox::Array > d_boxes_stat; - tbox::Array > d_cells_stat; - tbox::Array > d_timestamp_stat; + std::vector > d_boxes_stat; + std::vector > d_cells_stat; + std::vector > d_timestamp_stat; #endif // The following are not yet implemented: GriddingAlgorithm( const GriddingAlgorithm&); - void + GriddingAlgorithm& operator = ( const GriddingAlgorithm&); @@ -1328,18 +1434,6 @@ class GriddingAlgorithm: bool d_check_connectors; bool d_print_steps; - /* - * Static initialization and cleanup handler. - */ - static tbox::StartupShutdownManager::Handler - s_initialize_handler; - - /* - * - */ - static tbox::StartupShutdownManager::Handler - s_startup_shutdown_handler; - }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.C index 7e09fea9..af999adb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: GriddingAlgorihtm's implementation of PatchHierarchy * ************************************************************************/ - -#ifndef included_mesh_GriddingAlgorithmConnectorWidthRequestor_C -#define included_mesh_GriddingAlgorithmConnectorWidthRequestor_C - #include "SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h" #include "SAMRAI/tbox/Utilities.h" @@ -46,6 +42,11 @@ GriddingAlgorithmConnectorWidthRequestor::computeRequiredConnectorWidths( std::vector& fine_connector_widths, const hier::PatchHierarchy& patch_hierarchy) const { + if (!d_tag_to_cluster_width.empty()) { + TBOX_ASSERT(static_cast(d_tag_to_cluster_width.size()) >= + patch_hierarchy.getMaxNumberOfLevels() - 1); + } + const tbox::Dimension& dim(patch_hierarchy.getDim()); const int max_levels(patch_hierarchy.getMaxNumberOfLevels()); @@ -53,10 +54,13 @@ GriddingAlgorithmConnectorWidthRequestor::computeRequiredConnectorWidths( patch_hierarchy.getPatchDescriptor()->getMaxGhostWidth(dim)); const hier::IntVector max_stencil_width( - patch_hierarchy.getGridGeometry()->getMaxTransferOpStencilWidth()); + patch_hierarchy.getGridGeometry()->getMaxTransferOpStencilWidth(dim)); + + fine_connector_widths.resize(max_levels - 1, + hier::IntVector::getZero(dim)); + self_connector_widths.resize(max_levels, + hier::IntVector::getZero(dim)); - fine_connector_widths.resize(max_levels - 1, hier::IntVector(dim)); - self_connector_widths.resize(max_levels, hier::IntVector(dim)); /* * Compute the Connector width needed to ensure all edges are found @@ -70,7 +74,7 @@ GriddingAlgorithmConnectorWidthRequestor::computeRequiredConnectorWidths( * computeCoarserLevelConnectorWidthsFromFines() once the finer * level's Connector widths are computed. */ - self_connector_widths[max_levels - 1] = max_ghost_width; + self_connector_widths[max_levels - 1].setAll(max_ghost_width); for (int ln = max_levels - 2; ln > -1; --ln) { computeCoarserLevelConnectorWidthsFromFines( @@ -86,7 +90,16 @@ GriddingAlgorithmConnectorWidthRequestor::computeRequiredConnectorWidths( * Must be big enough for GriddingAlgorithm::computeProperNestingData(). */ self_connector_widths[ln].max( - hier::IntVector(dim,patch_hierarchy.getProperNestingBuffer(ln))); + hier::IntVector(dim, patch_hierarchy.getProperNestingBuffer(ln))); + + /* + * Must be big enough for GriddingAlgorithm to guarantee that + * tag--->cluster width is at least d_tag_to_cluster_width[ln] + * when bridging cluster<==>tag<==>tag. + */ + if (!d_tag_to_cluster_width.empty()) { + self_connector_widths[ln].max(d_tag_to_cluster_width[ln]); + } } } @@ -126,7 +139,7 @@ GriddingAlgorithmConnectorWidthRequestor::computeCoarserLevelConnectorWidthsFrom #ifdef DEBUG_CHECK_DIM_ASSERTIONS const tbox::Dimension& dim(fine_to_fine_width.getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS7(dim, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY7(dim, coarse_to_fine_width, coarse_to_coarse_width, fine_to_fine_width, @@ -136,6 +149,8 @@ GriddingAlgorithmConnectorWidthRequestor::computeCoarserLevelConnectorWidthsFrom max_ghost_width_at_coarse); #endif + const size_t num_blocks = fine_to_coarse_ratio.getNumBlocks(); + /* * Coarse-to-fine width must be big enough to cover the width at the * finer level. For example, the coarse level is used to bridge for @@ -148,7 +163,7 @@ GriddingAlgorithmConnectorWidthRequestor::computeCoarserLevelConnectorWidthsFrom /* * Coarse-to-fine width must be big enough for the [ln] -> [ln+1] * Connector to see all the [ln+1] Boxes that are used to add - * tags to [ln-1] Boxes for ensuring [ln] properly nests + * tags to [ln-1] for ensuring [ln] properly nests * [ln+1] when [ln] is being regenerated. * * The rationale for this adjustment is illustrated by the following @@ -173,7 +188,9 @@ GriddingAlgorithmConnectorWidthRequestor::computeCoarserLevelConnectorWidthsFrom * be have at least a 2-cell GCW (in L2 index space). */ coarse_to_fine_width.max( - hier::IntVector::ceilingDivide(nesting_buffer_at_fine, fine_to_coarse_ratio)); + hier::IntVector::ceilingDivide( + hier::IntVector(nesting_buffer_at_fine, num_blocks), + fine_to_coarse_ratio)); /* * Coarse-to-coarse Connectors must cover all data that the finer @@ -187,7 +204,16 @@ GriddingAlgorithmConnectorWidthRequestor::computeCoarserLevelConnectorWidthsFrom coarse_to_coarse_width.max(max_ghost_width_at_coarse); } -} +/* + ************************************************************************** + ************************************************************************** + */ +void +GriddingAlgorithmConnectorWidthRequestor::setTagToClusterWidth( + std::vector& tag_to_cluster_width) +{ + d_tag_to_cluster_width = tag_to_cluster_width; } -#endif +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h index 9b18eccb..6d51b56d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: GriddingAlgorihtm's implementation of PatchHierarchy * ************************************************************************/ @@ -55,6 +55,16 @@ class GriddingAlgorithmConnectorWidthRequestor: std::vector& fine_connector_widths, const hier::PatchHierarchy& patch_hierarchy) const; + /*! + * @brief Plan to specify enough Connector width to support the + * given width between tag and cluster levels. + * + * This is only used by the GriddingAlgorithm that owns this object. + */ + void + setTagToClusterWidth( + std::vector& tag_to_cluster_width); + private: /*! * @brief Compute the Connector widths needed at a given level @@ -80,6 +90,14 @@ class GriddingAlgorithmConnectorWidthRequestor: * * @param[in] max_ghost_width_at_coarse The maximum ghost cell * width to be used on the coarse level. + * + * @pre (dim == coarse_to_fine_width.getDim()) && + * (dim == coarse_to_coarse_width.getDim()) && + * (dim == fine_to_fine_width.getDim()) && + * (dim == fine_to_coarse_ratio.getDim()) && + * (dim == nesting_buffer_at_fine.getDim()) && + * (dim == max_stencil_width_at_coarse.getDim()) && + * (dim == max_ghost_width_at_coarse.getDim()) */ void computeCoarserLevelConnectorWidthsFromFines( @@ -91,6 +109,8 @@ class GriddingAlgorithmConnectorWidthRequestor: const hier::IntVector& max_stencil_width_at_coarse, const hier::IntVector& max_ghost_width_at_coarse) const; + std::vector d_tag_to_cluster_width; + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.C index 7f2a61d5..5a26efa8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR hierarchy generation and regridding routines. * ************************************************************************/ - -#ifndef included_mesh_GriddingAlgorithmStrategy_C -#define included_mesh_GriddingAlgorithmStrategy_C - #include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" namespace SAMRAI { @@ -26,4 +22,3 @@ GriddingAlgorithmStrategy::~GriddingAlgorithmStrategy() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.h index 74c1a46d..e714afa7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/GriddingAlgorithmStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR hierarchy generation and regridding routines. * ************************************************************************/ @@ -16,7 +16,9 @@ #include "SAMRAI/mesh/TagAndInitializeStrategy.h" #include "SAMRAI/tbox/Serializable.h" -#include +#include "boost/shared_ptr.hpp" + +#include namespace SAMRAI { namespace mesh { @@ -29,7 +31,7 @@ namespace mesh { * hierarchies. The interfaces imply that the implementation of this * strategy class works on some hierarchy. * - * @see mesh::GriddingAlgorithm + * @see GriddingAlgorithm */ class GriddingAlgorithmStrategy @@ -63,8 +65,8 @@ class GriddingAlgorithmStrategy * selected for refinement, no new level should be added to the * hierarchy. * - * The boolean argument initial_time indicates whether the routine - * is called at the initial simulation time. If true, this routine + * The boolean argument initial_cycle indicates whether the routine + * is called at the initial simulation cycle. If true, this routine * is being used to build individual levels during the construction of * the AMR hierarchy at the initial simulation time. If false, the * routine is being used to add new levels to the hierarchy at some @@ -78,20 +80,22 @@ class GriddingAlgorithmStrategy * selected for refinement should be buffered before new finer * level boxes are constructed. * - * @param level_time Current simulation time. - * @param initial_time Must be true if level_time is the initial time - * of the simulation, false otherwise * @param tag_buffer Size of buffer around tagged cells that will be * covered by the fine level. Must be non-negative. + * @param initial_cycle Must be true if level_cycle is the initial cycle + * of the simulation, false otherwise + * @param cycle Current simulation cycle. + * @param level_time Current simulation time. * @param regrid_start_time The simulation time when the regridding * operation began (this parameter is ignored * except when using Richardson extrapolation) */ virtual void makeFinerLevel( - const double level_time, - const bool initial_time, const int tag_buffer, + const bool initial_cycle, + const int cycle, + const double level_time, const double regrid_start_time = 0.0) = 0; /*! @@ -121,9 +125,11 @@ class GriddingAlgorithmStrategy * * @param level_number Coarsest level on which cells will be tagged for * refinement - * @param regrid_time Simulation time when regridding occurs * @param tag_buffer See tag_buffer in makeFinerLevel. * There is one value per level in the hierarchy. + * @param cycle Simulation cycle when regridding occurs + * @param level_time Simulation time of the level corresponding to level_num + * when regridding occurs * @param regrid_start_time The simulation time when the regridding * operation began on each level (this parameter * is ignored except when using Richardson @@ -134,9 +140,10 @@ class GriddingAlgorithmStrategy virtual void regridAllFinerLevels( const int level_number, - const double regrid_time, - const tbox::Array& tag_buffer, - tbox::Array regrid_start_time = tbox::Array(), + const std::vector& tag_buffer, + const int cycle, + const double level_time, + const std::vector& regrid_start_time = std::vector(), const bool level_is_coarsest_to_sync = true) = 0; /*! @@ -146,6 +153,13 @@ class GriddingAlgorithmStrategy boost::shared_ptr getTagAndInitializeStrategy() const = 0; + /*! + * @brief Return pointer to PatchHierarchy data member. + */ + virtual + boost::shared_ptr + getPatchHierarchy() const = 0; + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.C index 989c7f57..2d4da576 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for box load balancing routines. * ************************************************************************/ - -#ifndef included_mesh_LoadBalanceStrategy_C -#define included_mesh_LoadBalanceStrategy_C - #include "SAMRAI/mesh/LoadBalanceStrategy.h" #include @@ -76,5 +72,3 @@ LoadBalanceStrategy::markLoadForPostprocessing( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.h index 50a06d71..67e134b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/LoadBalanceStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for box load balancing routines. * ************************************************************************/ @@ -14,10 +14,9 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/RankGroup.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace mesh { @@ -64,18 +63,18 @@ class LoadBalanceStrategy * patches for the level may be formed and update two Connectors * incident on the changed BoxLevel. * - * The union of the boxes in the balance_mapped_box_level is the same + * The union of the boxes in the balance_box_level is the same * before and after the the method call. * - * @param[in,out] balance_mapped_box_level Input BoxLevel. On input, this is the pre-balance + * @param[in,out] balance_box_level Input BoxLevel. On input, this is the pre-balance * BoxLevel. On output, it is the balanced BoxLevel. * - * @param[in,out] balance_to_anchor Connector between the balance_mapped_box_level and - * some given "anchor mapped_box_level". + * @param[in,out] balance_to_anchor Connector between the balance_box_level and + * some given "anchor box_level". * This must be accurate on input. On putput, connects the newly - * balanced balance_mapped_box_level to the anchor mapped_box_level. - * - * @param[in,out] anchor_to_balance Transpose of balance_to_anchor. + * balanced balance_box_level to the anchor box_level. + * If set to NULL, this parameter is ignored and Connector update + * is skipped. * * @param[in] hierarchy The hierarchy where the work distribution * data lives. @@ -83,19 +82,11 @@ class LoadBalanceStrategy * @param[in] level_number The number of the level where the work * distribution data lives. * - * @param[in] unbalanced_to_attractor Connector between the - * balance_mapped_box_level and an "attractor" BoxLevel. - * This data may be used to indicate preference for data locality. - * The implementation should try to maximize overlaps between - * attractor and balance cells owned by the same process. - * - * @param[in] attractor_to_unbalanced Transpose of unbalanced_to_attractor. - * * @param[in] min_size hier::IntVector representing mimimum box size. * * @param[in] max_size hier::IntVector representing maximum box size. * - * @param[in] domain_mapped_box_level Description of the domain. + * @param[in] domain_box_level Description of the domain. * * @param[in] bad_interval * hier::IntVector indicating the length of an interval @@ -122,25 +113,27 @@ class LoadBalanceStrategy * * @param[in] rank_group * Input tbox::RankGroup indicating a set of ranks on which all boxes - * in the output balance_mapped_box_level will be restricted. Some + * in the output balance_box_level will be restricted. Some * child classes may not make use of this argument. */ virtual void loadBalanceBoxLevel( - hier::BoxLevel& balance_mapped_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, + hier::BoxLevel& balance_box_level, + hier::Connector * balance_to_anchor, const boost::shared_ptr& hierarchy, const int level_number, - const hier::Connector& unbalanced_to_attractor, - const hier::Connector& attractor_to_unbalanced, const hier::IntVector& min_size, const hier::IntVector& max_size, - const hier::BoxLevel& domain_mapped_box_level, + const hier::BoxLevel& domain_box_level, const hier::IntVector& bad_interval, - const hier::IntVector& cut_factor, // Default v 2.x.x = hier::IntVector::getOne(tbox::Dimension(DIM)) + const hier::IntVector& cut_factor, // Default v 2.x.x = 1 const tbox::RankGroup& rank_group = tbox::RankGroup()) const = 0; + virtual void + setWorkloadPatchDataIndex( + int data_id, + int level_number = -1) = 0; + protected: /*! * Construct load balance strategy object. @@ -172,7 +165,7 @@ class LoadBalanceStrategy LoadBalanceStrategy( const LoadBalanceStrategy&); - void + LoadBalanceStrategy& operator = ( const LoadBalanceStrategy&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.depend index 791510ff..c4de0cb5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -11,7 +11,7 @@ ## This file is automatically generated by depend.pl. -FILE_0=BalanceUtilities.o +FILE_0=BalanceBoxBreaker.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -24,15 +24,18 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -43,6 +46,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -54,7 +58,9 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceBoxBreaker.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -66,7 +72,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -78,17 +83,17 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BalanceUtilities.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BalanceBoxBreaker.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ @@ -97,13 +102,12 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} -FILE_1=BergerRigoutsos.o +${FILE_0}: ${DEPENDS_0} + +FILE_1=BalanceUtilities.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ @@ -116,11 +120,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -128,6 +132,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -140,8 +145,110 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BalanceUtilities.C + +DEPENDS_1 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=BergerRigoutsos.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -152,7 +259,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsosNode.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ @@ -166,8 +272,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -176,17 +282,15 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BergerRigoutsos.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=BergerRigoutsosNode.o -DEPENDS_2:=\ +${FILE_2}: ${DEPENDS_2} + +FILE_3=BergerRigoutsosNode.o +DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -201,6 +305,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -218,6 +323,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ @@ -228,7 +334,9 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsosNode.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -239,7 +347,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -253,8 +360,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -263,21 +370,19 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BergerRigoutsosNode.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ +DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=BoxGeneratorStrategy.o -DEPENDS_3:=\ +${FILE_3}: ${DEPENDS_3} + +FILE_4=BoxGeneratorStrategy.o +DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -307,6 +412,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -317,7 +423,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -328,8 +433,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -338,18 +443,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxGeneratorStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} -FILE_4=ChopAndPackLoadBalancer.o -DEPENDS_4:=\ +${FILE_4}: ${DEPENDS_4} + +FILE_5=BoxTransitSet.o +DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -363,7 +465,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -371,8 +472,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -380,14 +481,13 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SequentialLocalIdGenerator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ @@ -396,23 +496,23 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceBoxBreaker.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxInTransit.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxTransitSet.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -422,50 +522,40 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - ChopAndPackLoadBalancer.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BoxTransitSet.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ +DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} -FILE_5=GriddingAlgorithm.o -DEPENDS_5:=\ +${FILE_5}: ${DEPENDS_5} + +FILE_6=CascadePartitioner.o +DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -477,12 +567,10 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -490,6 +578,7 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -507,41 +596,41 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SequentialLocalIdGenerator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsInteger.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsInteger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceBoxBreaker.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxInTransit.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxTransitSet.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/VoucherTransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -549,58 +638,723 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IEEE.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + CascadePartitioner.C + +DEPENDS_6 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=CascadePartitionerTree.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CascadePartitionerTree.C + +DEPENDS_7 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=ChopAndPackLoadBalancer.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + ChopAndPackLoadBalancer.C + +DEPENDS_8 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=GraphLoadBalancer.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GraphLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h GraphLoadBalancer.C + +DEPENDS_9 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=GriddingAlgorithm.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIntegerConstantRefine.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IEEE.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchInteriorVariableFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelInteriorFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + GriddingAlgorithm.C + +DEPENDS_10 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=GriddingAlgorithmConnectorWidthRequestor.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + GriddingAlgorithmConnectorWidthRequestor.C + +DEPENDS_11 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=GriddingAlgorithmStrategy.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + GriddingAlgorithmStrategy.C + +DEPENDS_12 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=LoadBalanceStrategy.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - GriddingAlgorithm.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h LoadBalanceStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ +DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=GriddingAlgorithmConnectorWidthRequestor.o -DEPENDS_6:=\ +${FILE_13}: ${DEPENDS_13} + +FILE_14=MultiblockGriddingTagger.o +DEPENDS_14:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -612,10 +1366,12 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ @@ -628,10 +1384,9 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -641,8 +1396,19 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -652,9 +1418,10 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -662,29 +1429,35 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - GriddingAlgorithmConnectorWidthRequestor.C + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + MultiblockGriddingTagger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_14 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} -FILE_7=GriddingAlgorithmStrategy.o -DEPENDS_7:=\ +${FILE_14}: ${DEPENDS_14} + +FILE_15=PartitioningParams.o +DEPENDS_15:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ @@ -699,14 +1472,9 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -714,9 +1482,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -727,27 +1493,33 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - GriddingAlgorithmStrategy.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PartitioningParams.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=LoadBalanceStrategy.o -DEPENDS_8:=\ +${FILE_15}: ${DEPENDS_15} + +FILE_16=SpatialKey.o +DEPENDS_16:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h SpatialKey.C + +DEPENDS_16 +=\ + + + +${FILE_16}: ${DEPENDS_16} + +FILE_17=StandardTagAndInitStrategy.o +DEPENDS_17:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -779,17 +1551,18 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -800,28 +1573,27 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h LoadBalanceStrategy.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + StandardTagAndInitStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=MultiblockGriddingTagger.o -DEPENDS_9:=\ +${FILE_17}: ${DEPENDS_17} + +FILE_18=StandardTagAndInitialize.o +DEPENDS_18:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -843,6 +1615,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -850,31 +1623,38 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIntegerConstantRefine.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -886,8 +1666,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -895,38 +1675,22 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - MultiblockGriddingTagger.C + StandardTagAndInitialize.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ +DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} - -FILE_10=SpatialKey.o -DEPENDS_10:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h SpatialKey.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ - -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} +${FILE_18}: ${DEPENDS_18} -FILE_11=StandardTagAndInitStrategy.o -DEPENDS_11:=\ +FILE_19=StandardTagAndInitializeConnectorWidthRequestor.o +DEPENDS_19:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -958,17 +1722,18 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -979,8 +1744,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -988,20 +1753,18 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - StandardTagAndInitStrategy.C + $(INCLUDE_SAM)/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h\ + StandardTagAndInitializeConnectorWidthRequestor.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} -FILE_12=StandardTagAndInitialize.o -DEPENDS_12:=\ +${FILE_19}: ${DEPENDS_19} + +FILE_20=TagAndInitializeStrategy.o +DEPENDS_20:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1012,18 +1775,15 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1035,33 +1795,18 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIntegerConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1071,10 +1816,9 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1082,25 +1826,18 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - StandardTagAndInitialize.C + TagAndInitializeStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ +DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=StandardTagAndInitializeConnectorWidthRequestor.o -DEPENDS_13:=\ +${FILE_20}: ${DEPENDS_20} + +FILE_21=TileClustering.o +DEPENDS_21:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1111,15 +1848,20 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1127,21 +1869,33 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SequentialLocalIdGenerator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1151,62 +1905,63 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h\ - StandardTagAndInitializeConnectorWidthRequestor.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TileClustering.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_21 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} -FILE_14=TagAndInitializeStrategy.o -DEPENDS_14:=\ +${FILE_21}: ${DEPENDS_21} + +FILE_22=TransitLoad.o +DEPENDS_22:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -1214,8 +1969,7 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1226,27 +1980,24 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - TagAndInitializeStrategy.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TransitLoad.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_14 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} -FILE_15=TreeLoadBalancer.o -DEPENDS_15:=\ +${FILE_22}: ${DEPENDS_22} + +FILE_23=TreeLoadBalancer.o +DEPENDS_23:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1262,7 +2013,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -1270,9 +2020,9 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1284,21 +2034,30 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SequentialLocalIdGenerator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceBoxBreaker.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxInTransit.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxTransitSet.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/VoucherTransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -1310,13 +2069,13 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1329,21 +2088,19 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TreeLoadBalancer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_15 +=\ +DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -1352,17 +2109,15 @@ DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} -FILE_16=TreeLoadBalancerOld.o -DEPENDS_16:=\ +${FILE_23}: ${DEPENDS_23} + +FILE_24=VoucherTransitLoad.o +DEPENDS_24:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1376,7 +2131,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ @@ -1384,9 +2138,8 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1394,13 +2147,13 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/SequentialLocalIdGenerator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ @@ -1409,26 +2162,24 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BalanceBoxBreaker.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxInTransit.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxTransitSet.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancerOld.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/VoucherTransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1443,33 +2194,27 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TreeLoadBalancerOld.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VoucherTransitLoad.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_16 +=\ +DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} + +${FILE_24}: ${DEPENDS_24} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.in index bfac687f..698046f0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI mesh package ## ######################################################################### @@ -32,18 +32,26 @@ OBJS = \ TagAndInitializeStrategy.o \ BalanceUtilities.o \ TreeLoadBalancer.o \ - TreeLoadBalancerOld.o \ + GraphLoadBalancer.o \ ChopAndPackLoadBalancer.o \ + CascadePartitioner.o \ + CascadePartitionerTree.o \ LoadBalanceStrategy.o \ + BalanceBoxBreaker.o \ + BoxTransitSet.o \ + VoucherTransitLoad.o \ + TransitLoad.o \ GriddingAlgorithmStrategy.o \ BergerRigoutsos.o \ BergerRigoutsosNode.o \ - MultiblockGriddingTagger.o + MultiblockGriddingTagger.o \ + TileClustering.o \ + PartitioningParams.o library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.C index 33c3fcdb..6f40552f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for refining AMR data. * ************************************************************************/ - -#ifndef included_mesh_MultiblockGriddingTagger_C -#define included_mesh_MultiblockGriddingTagger_C - #include "SAMRAI/mesh/MultiblockGriddingTagger.h" #include "SAMRAI/hier/Connector.h" @@ -19,6 +15,8 @@ #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/tbox/Utilities.h" +#include + #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* * Suppress XLC warnings @@ -39,10 +37,9 @@ namespace mesh { ************************************************************************* */ -MultiblockGriddingTagger::MultiblockGriddingTagger( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - d_dim(dim) +MultiblockGriddingTagger::MultiblockGriddingTagger(): + xfer::RefinePatchStrategy(), + xfer::SingularityPatchStrategy() { } @@ -51,9 +48,9 @@ MultiblockGriddingTagger::~MultiblockGriddingTagger() } hier::IntVector -MultiblockGriddingTagger::getRefineOpStencilWidth() const +MultiblockGriddingTagger::getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(d_dim); + return hier::IntVector::getOne(dim); } void @@ -73,15 +70,8 @@ MultiblockGriddingTagger::setScratchTagPatchDataIndex( << std::endl); } else { boost::shared_ptr > t_check_var( - check_var, - boost::detail::dynamic_cast_tag()); - if (!t_check_var) { - TBOX_ERROR( - "MultiblockGriddingTagger::setScratchTagPatchDataIndex error...\n" - << "Given patch data index = " << buf_tag_indx - << " does not map to cell-centered" - << "\ninteger data in VariableDatabase." << std::endl); - } + BOOST_CAST, hier::Variable>(check_var)); + TBOX_ASSERT(t_check_var); } d_buf_tag_indx = buf_tag_indx; @@ -93,13 +83,15 @@ MultiblockGriddingTagger::setPhysicalBoundaryConditions( const double fill_time, const hier::IntVector& ghost_width_to_fill) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, patch); - NULL_USE(fill_time); + const tbox::Dimension& dim = patch.getDim(); + const boost::shared_ptr > tag_data( - patch.getPatchData(d_buf_tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_buf_tag_indx))); + + TBOX_ASSERT(tag_data); hier::IntVector gcw = hier::IntVector::min(ghost_width_to_fill, @@ -107,12 +99,12 @@ MultiblockGriddingTagger::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { - tbox::Array bbox = + const std::vector& bbox = pgeom->getCodimensionBoundaries(d + 1); - for (int b = 0; b < bbox.size(); b++) { + for (int b = 0; b < static_cast(bbox.size()); ++b) { if (!bbox[b].getIsMultiblockSingularity()) { hier::Box fill_box = pgeom->getBoundaryFillBox(bbox[b], patch.getBox(), @@ -128,46 +120,44 @@ void MultiblockGriddingTagger::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) { - NULL_USE(fill_time); NULL_USE(boundary_box); NULL_USE(grid_geometry); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, patch, fill_box, boundary_box); + TBOX_ASSERT(!grid_geometry->hasEnhancedConnectivity() || dst_to_encon); + TBOX_ASSERT_OBJDIM_EQUALITY3(patch, fill_box, boundary_box); const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); const boost::shared_ptr > tag_data( - patch.getPatchData(d_buf_tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_buf_tag_indx))); + + TBOX_ASSERT(tag_data); hier::Box sing_fill_box(tag_data->getGhostBox() * fill_box); tag_data->fillAll(0, sing_fill_box); if (grid_geometry->hasEnhancedConnectivity()) { - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); const hier::BlockId& encon_blk_id = ei->getBlockId(); @@ -175,18 +165,13 @@ MultiblockGriddingTagger::fillSingularityBoundaryConditions( hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri = neighbors.begin(); nbri != neighbors.end(); nbri++) { - - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation( rotation, offset, encon_blk_id, patch_blk_id); hier::Box encon_patch_box(encon_patch->getBox()); @@ -206,15 +191,16 @@ MultiblockGriddingTagger::fillSingularityBoundaryConditions( hier::Transformation back_trans(back_rotate, back_shift, encon_fill_box.getBlockId(), - encon_patch->getBox().getBlockId()); - + encon_patch->getBox().getBlockId()); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_buf_tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData(d_buf_tag_indx))); + + TBOX_ASSERT(sing_data); - pdat::CellIterator ciend(encon_fill_box, false); - for (pdat::CellIterator ci(encon_fill_box, true); + pdat::CellIterator ciend(pdat::CellGeometry::end(encon_fill_box)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(encon_fill_box)); ci != ciend; ++ci) { pdat::CellIndex src_index(*ci); pdat::CellGeometry::transform(src_index, back_trans); @@ -250,7 +236,7 @@ MultiblockGriddingTagger::postprocessRefine( const hier::Box& fine_box, const hier::IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, fine, coarse, fine_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(fine, coarse, fine_box, ratio); NULL_USE(fine); NULL_USE(coarse); @@ -268,5 +254,3 @@ MultiblockGriddingTagger::postprocessRefine( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.h index 2f79f4e3..795d6295 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/MultiblockGriddingTagger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for refining AMR data. * ************************************************************************/ @@ -13,6 +13,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" +#include "SAMRAI/xfer/SingularityPatchStrategy.h" namespace SAMRAI { namespace mesh { @@ -25,26 +26,26 @@ namespace mesh { * This class is needed for the calls to RefineSchedule in * the GriddingAlgorithm. * - * This class implements the interface from RefinePatchStrategy for + * This class implements the interface from SingularityPatchStrategy for * fillSingularityBoundaryConditions(), so that boundary conditions for * tag data that abuts a singularity can be properly filled. Also * implemented are the interfaces for xfer::RefinePatchStrategy, needed * primarily for physical boundary filling. * - * @see mesh::GriddingAlgorithm + * @see GriddingAlgorithm * @see xfer::RefineSchedule * @see xfer::RefinePatchStrategy */ class MultiblockGriddingTagger: - public xfer::RefinePatchStrategy + public xfer::RefinePatchStrategy, + public xfer::SingularityPatchStrategy { public: /*! * @brief The constructor does nothing interesting. */ - explicit MultiblockGriddingTagger( - const tbox::Dimension& dim); + MultiblockGriddingTagger(); /*! * @brief The virtual destructor does nothing interesting. @@ -89,20 +90,22 @@ class MultiblockGriddingTagger: * @param encon_level Level representing enhanced connectivity ghost * regions * @param dst_to_encon Connector from destination level to encon_level - * @param fill_time Simulation time when filling occurs * @param fill_box All ghost data to be filled will be within * this box * @param boundary_box BoundaryBox object that stores information * about the type and location of the boundary * where ghost cells will be filled * @param grid_geometry + * + * @pre (patch.getDim() == fill_box.getDim()) && + * (patch.getDim() == boundary_box.getDim()) + * @pre !grid_geometry->hasEnhancedConnectivity() || dst_to_encon */ virtual void fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); @@ -115,7 +118,9 @@ class MultiblockGriddingTagger: * Always returns an IntVector of ones, because that is the maximum * stencil needed for the operations in GriddingAlgorithm */ - virtual hier::IntVector getRefineOpStencilWidth() const; + virtual hier::IntVector + getRefineOpStencilWidth( + const tbox::Dimension& dim) const; /*! * Perform user-defined refining operations. This member function @@ -133,7 +138,8 @@ class MultiblockGriddingTagger: * @param ratio Integer vector containing ratio relating index space * between coarse and fine patches. */ - virtual void preprocessRefine( + virtual void + preprocessRefine( hier::Patch& fine, const hier::Patch& coarse, const hier::Box& fine_box, @@ -154,6 +160,10 @@ class MultiblockGriddingTagger: * @param fine_box Box region on fine patch into which data is refined. * @param ratio Integer vector containing ratio relating index space * between coarse and fine patches. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == fine_box.getDim()) && + * (fine.getDim() == ratio.getDim()) */ virtual void postprocessRefine( @@ -163,8 +173,6 @@ class MultiblockGriddingTagger: const hier::IntVector& ratio); private: - const tbox::Dimension d_dim; - /* * Patch data index for */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.C new file mode 100644 index 00000000..e5ef7f89 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.C @@ -0,0 +1,79 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Parameters in load balancing. + * + ************************************************************************/ + +#ifndef included_mesh_PartitioningParams_C +#define included_mesh_PartitioningParams_C + +#include "SAMRAI/mesh/PartitioningParams.h" + +namespace SAMRAI { +namespace mesh { + +PartitioningParams::PartitioningParams( + const hier::BaseGridGeometry& grid_geometry, + const hier::IntVector& ratio_to_level_zero, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + double flexible_load_tol): + d_min_size(min_size), + d_max_size(max_size), + d_bad_interval(bad_interval, grid_geometry.getNumberBlocks()), + d_cut_factor(cut_factor), + d_flexible_load_tol(flexible_load_tol), + d_load_comparison_tol(1e-6), + d_using_vouchers(false), + d_work_data_id(-1) +{ + for (hier::BlockId::block_t bid(0); bid < grid_geometry.getNumberBlocks(); ++bid) { + grid_geometry.computePhysicalDomain( + d_block_domain_boxes[hier::BlockId(bid)], ratio_to_level_zero, hier::BlockId(bid)); + } +} + +PartitioningParams::PartitioningParams( + const PartitioningParams& other): + d_block_domain_boxes(other.d_block_domain_boxes), + d_min_size(other.d_min_size), + d_max_size(other.d_max_size), + d_bad_interval(other.d_bad_interval), + d_cut_factor(other.d_cut_factor), + d_load_comparison_tol(other.d_load_comparison_tol), + d_using_vouchers(other.d_using_vouchers), + d_work_data_id(other.d_work_data_id) +{ +} + +std::ostream& operator << ( + std::ostream& os, + const PartitioningParams& pp) +{ + os.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + os.precision(6); + os << "min_size=" << pp.d_min_size + << " max_size=" << pp.d_max_size + << " bad_interval=" << pp.d_bad_interval + << " cut_factor=" << pp.d_cut_factor + << " flexible_load_tol=" << pp.d_flexible_load_tol + << " load_comparison_tol=" << pp.d_load_comparison_tol + << " work_data_id=" << pp.d_work_data_id; + for (std::map::const_iterator mi = + pp.d_block_domain_boxes.begin(); + mi != pp.d_block_domain_boxes.end(); ++mi) { + os << ' ' << mi->first << ':' << mi->second.format(); + } + return os; +} + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.h new file mode 100644 index 00000000..59f05588 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/PartitioningParams.h @@ -0,0 +1,152 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Parameters in load balancing. + * + ************************************************************************/ + +#ifndef included_mesh_PartitioningParams +#define included_mesh_PartitioningParams + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/BaseGridGeometry.h" + +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Light weight class holding parameters generally used + * in partitioning. + */ + +class PartitioningParams +{ +public: + PartitioningParams( + const hier::BaseGridGeometry& grid_geometry, + const hier::IntVector& ratio_to_level_zero, + const hier::IntVector& min_size, + const hier::IntVector& max_size, + const hier::IntVector& bad_interval, + const hier::IntVector& cut_factor, + double flexible_load_tol); + + PartitioningParams( + const PartitioningParams& other); + + double getMinLoad() const { + return static_cast(d_min_size.getProduct()); + } + + const hier::IntVector& getMinBoxSize() const { + return d_min_size; + } + + const hier::IntVector& getMaxBoxSize() const { + return d_max_size; + } + + const hier::BoxContainer& getDomainBoxes(const hier::BlockId& bid) const { + return d_block_domain_boxes.find(bid)->second; + } + + const hier::IntVector& getBadInterval() const { + return d_bad_interval; + } + + const hier::IntVector& getCutFactor() const { + return d_cut_factor; + } + + const tbox::Dimension& getDim() const { + return d_min_size.getDim(); + } + + const double& getFlexibleLoadTol() const { + return d_flexible_load_tol; + } + + const double& getLoadComparisonTol() const { + return d_load_comparison_tol; + } + + const bool& usingVouchers() const { + return d_using_vouchers; + } + + void setUsingVouchers(bool using_vouchers) { + d_using_vouchers = using_vouchers; + } + + const int& getWorkloadDataId() const { + return d_work_data_id; + } + + void setWorkloadDataId(int work_data_id) { + TBOX_ASSERT(work_data_id >= 0); + d_work_data_id = work_data_id; + } + + const hier::PatchLevel& getWorkloadPatchLevel() const { + return *d_workload_level; + } + + void setWorkloadPatchLevel(boost::shared_ptr& level) { + TBOX_ASSERT(level.get()); + d_workload_level = level; + } + + + friend std::ostream& + operator << ( + std::ostream& os, + const PartitioningParams& pp); + +private: + std::map d_block_domain_boxes; + hier::IntVector d_min_size; + hier::IntVector d_max_size; + hier::IntVector d_bad_interval; + hier::IntVector d_cut_factor; + + /*! + * @brief Fraction of ideal load a process can accept over and + * above the ideal. + */ + double d_flexible_load_tol; + + /*! + * @brief Tolerance for comparing floating point loads. + * + * Should be set to at least possible rounding errors. + * Better if set between that and the greatest work value + * that would be considered "no work". + */ + double d_load_comparison_tol; + + /*! + * @brief Flag for using voucher method or not. + */ + bool d_using_vouchers; + + /*! + * @brief Patch data id for nonuniform workload + */ + int d_work_data_id; + + /*! + * @brief Pointer to level holding nonuniform workload + */ + boost::shared_ptr d_workload_level; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.C index 533f22a5..a322ea57 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Spatial Key used for generating space-filling curves. * ************************************************************************/ - -#ifndef included_mesh_SpatialKey_C -#define included_mesh_SpatialKey_C - #include "SAMRAI/mesh/SpatialKey.h" #include @@ -76,7 +72,7 @@ SpatialKey::SpatialKey( const SpatialKey& spatial_key) { d_bits_per_int = BITS_PER_BYTE * sizeof(unsigned int); - for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; i++) { + for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; ++i) { d_key[i] = spatial_key.d_key[i]; } } @@ -113,7 +109,7 @@ SpatialKey::operator < ( } else if (d_key[i] > spatial_key.d_key[i]) { return false; } - i--; + --i; } // the two spatial keys are equal, so return false @@ -140,7 +136,7 @@ operator << ( char* buf = new char[spatial_key.d_bits_per_int / SpatialKey::BITS_PER_HEX_CHAR * SpatialKey::NUM_COORDS_MIXED_FOR_SPATIAL_KEY + 1]; - for (int i = SpatialKey::NUM_COORDS_MIXED_FOR_SPATIAL_KEY - 1; i >= 0; i--) { + for (int i = SpatialKey::NUM_COORDS_MIXED_FOR_SPATIAL_KEY - 1; i >= 0; --i) { sprintf(&(buf[spatial_key.d_bits_per_int / SpatialKey::BITS_PER_HEX_CHAR * ((SpatialKey::NUM_COORDS_MIXED_FOR_SPATIAL_KEY - 1) - i)]), "%08x", spatial_key.d_key[i]); @@ -168,12 +164,11 @@ SpatialKey::blendOneCoord( { unsigned int shifted_coord = coord; - int bit_in_int; - for (bit_in_int = 0; bit_in_int < d_bits_per_int; bit_in_int++) { + for (size_t bit_in_int = 0; bit_in_int < d_bits_per_int; ++bit_in_int) { if (shifted_coord & ((unsigned int)1)) { - unsigned int bit_index; - int int_index; - int bit_offset; + size_t bit_index; + size_t int_index; + size_t bit_offset; bit_index = NUM_COORDS_MIXED_FOR_SPATIAL_KEY * bit_in_int + coord_offset; @@ -231,5 +226,3 @@ SpatialKey::setKey( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.h index 8b3acfee..9c66948d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/SpatialKey.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: spatial key used for generating space-filling curves. * ************************************************************************/ @@ -64,7 +64,7 @@ class SpatialKey operator = ( const SpatialKey& spatial_key) { - for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; i++) { + for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; ++i) { d_key[i] = spatial_key.d_key[i]; } return *this; @@ -79,7 +79,7 @@ class SpatialKey const SpatialKey& spatial_key) const { bool are_equal = true; - for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; i++) { + for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; ++i) { if (d_key[i] != spatial_key.d_key[i]) { are_equal = false; break; @@ -146,7 +146,7 @@ class SpatialKey void setToZero() { - for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; i++) { + for (int i = 0; i < NUM_COORDS_MIXED_FOR_SPATIAL_KEY; ++i) { d_key[i] = 0; } } @@ -155,7 +155,7 @@ class SpatialKey * Set this key from the index space coordinates and the level number. * * The values of i, j, and k default to 0 to handle cases - * where the number of dimensions in the problem is not 3. + * where the dimensions of the problem is not 3. * The default value of level_num is also 0. */ void @@ -209,7 +209,7 @@ class SpatialKey const unsigned int coord, const int coord_offset); - int d_bits_per_int; + size_t d_bits_per_int; unsigned int d_key[NUM_COORDS_MIXED_FOR_SPATIAL_KEY]; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.C index b832e575..a5f91420 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for Richardson extrapolation error detection. * ************************************************************************/ - -#ifndef included_mesh_StandardTagAndInitStrategy_C -#define included_mesh_StandardTagAndInitStrategy_C - #include "SAMRAI/mesh/StandardTagAndInitStrategy.h" #include "SAMRAI/tbox/Utilities.h" @@ -158,6 +154,27 @@ StandardTagAndInitStrategy::resetDataToPreadvanceState( << "\nthis method." << std::endl); } +void +StandardTagAndInitStrategy::processHierarchyBeforeAddingNewLevel( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& new_box_level) +{ + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(new_box_level); +} + +void +StandardTagAndInitStrategy::processLevelBeforeRemoval( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& old_level) +{ + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(old_level); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.h index 7b3ab54b..4d38bb78 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for Richardson Extrapolation algorithm. * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace mesh { @@ -46,7 +46,7 @@ namespace mesh { * coarsenDataForRichardsonExtrapolation(), getLevelDt(), advanceLevel(), * resetTimeDependentData(), and resetDataToPreadvanceState(). * - * @see mesh::StandardTagAndInitialize. + * @see StandardTagAndInitialize. */ class StandardTagAndInitStrategy @@ -329,6 +329,118 @@ class StandardTagAndInitStrategy const double coarsen_data_time, const bool before_advance); + /*! + * @brief Process a hierarchy before swapping old and new levels during + * regrid. + * + * During regrid, if user code needs to do any application-specific + * operations on the PatchHierarchy before a new level is added or + * an old level is swapped for a new level, this method provides a callback + * for the user to define such operations. The PatchHierarchy is provided + * in its state with the old level, if it exists, still in place, while the + * new BoxLevel is also provided so that the user code can know the boxes + * that will make up the new level. + * + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this processing step need not implement anything. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy being + * added or regridded. + * @param new_box_level BoxLevel containing the boxes for the new level + * + */ + virtual void + processHierarchyBeforeAddingNewLevel( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& new_box_level); + + /** + * In some cases user code may wish to process a PatchLevel before it is + * removed from the hierarchy. For example, data may exist only on a given + * PatchLevel such as the finest level. If that level were to be removed + * before this data is moved off of it then the data will be lost. This + * method is a user defined callback used by GriddingAlgorithm when a + * PatchLevel is to be removed. The callback performs any user actions on + * the level about to be removed. It is implemented by classes derived from + * StandardTagAndInitStrategy. + * + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this processing step need not implement anything. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy about to be + * removed. + * @param old_level The level in hierarchy about to be removed. + * + * @see GriddingAlgorithm + * @see StandardTagAndInitStrategy + */ + virtual void + processLevelBeforeRemoval( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& old_level = + boost::shared_ptr()); + + /*! + * @brief Check the tags on a tagged level. + * + * This virtual method provides an interface for a callback into + * application code to check the values held in user tag PatchData + * The tag data will contain the tags created by application code + * using the gradient detector or Richardson extrapolation methods, + * plus any tags added internally by the GriddingAlgorithm (for + * example, buffering). + * + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this callback need not implement anything. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the tagged level + * @param[in] tag_index Patch data index for user tags + */ + virtual void + checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(tag_index); + } + + /*! + * @brief Check the tags on a newly-created level. + * + * This virtual method provides an interface for a callback into + * application code to check the tag values that have been saved on + * a new level that has been created during intitialization or + * regridding. The tag values will be the values of the user tags + * on the coarser level, constant refined onto the cells of the new + * level. + * + * This is a virtual method with a no-op implementation provided, so that + * users who do not need this callback need not implement anything. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the new level + * @param[in] tag_index Patch data index for the new tags. + */ + virtual void + checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) const + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(tag_index); + } + + private: }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.C index 2335f31c..9888bf1c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for performing cell-tagging and initializing * a new level. * ************************************************************************/ - -#ifndef included_mesh_StandardTagAndInitialize_C -#define included_mesh_StandardTagAndInitialize_C - #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/pdat/CellIntegerConstantRefine.h" @@ -22,10 +18,9 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include -#include +#include "boost/shared_ptr.hpp" +#include "boost/make_shared.hpp" #include /* @@ -43,20 +38,20 @@ extern "C" { #pragma warning (disable:1419) #endif // in coarsentags1d.f: -void F77_FUNC(coarsentags1d, COARSENTAGS1D) (const int&, const int&, +void SAMRAI_F77_FUNC(coarsentags1d, COARSENTAGS1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in coarsentags2d.f: -void F77_FUNC(coarsentags2d, COARSENTAGS2D) (const int&, const int&, +void SAMRAI_F77_FUNC(coarsentags2d, COARSENTAGS2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in coarsentags3d.f: -void F77_FUNC(coarsentags3d, COARSENTAGS3D) (const int&, const int&, +void SAMRAI_F77_FUNC(coarsentags3d, COARSENTAGS3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -97,35 +92,26 @@ GCD( */ StandardTagAndInitialize::StandardTagAndInitialize( - const tbox::Dimension& dim, const std::string& object_name, StandardTagAndInitStrategy* tag_strategy, const boost::shared_ptr& input_db): - TagAndInitializeStrategy(dim, object_name) + TagAndInitializeStrategy(object_name), + d_tag_strategy(tag_strategy), + d_error_coarsen_ratio(1), + d_use_cycle_criteria(false), + d_use_time_criteria(false), + d_ever_uses_richardson_extrapolation(false), + d_ever_uses_gradient_detector(false), + d_ever_uses_refine_boxes(false), + d_boxes_changed(false), + d_old_cycle(-1) { TBOX_ASSERT(!object_name.empty()); - d_tag_strategy = tag_strategy; - - d_error_coarsen_ratio = 1; - - d_use_gradient_detector = false; - d_use_richardson_extrapolation = false; - d_use_refine_boxes = false; + getFromInput(input_db); - /* - * If no input database is provided, no criteria is set to tag cells - * so cell-tagging will not occur. Print a warning to indicate if - * this is the case. - */ - if (!input_db) { - TBOX_WARNING( - getObjectName() << ":constructor \n" - << "no input database specified - NO METHOD IS SPECIFIED TO TAG \n" - << "CELLS FOR REFINEMENT so no tagging is performed."); - } else { - getFromInput(input_db); - } + d_cur_time_criteria = d_time_criteria.begin(); + d_cur_cycle_criteria = d_cycle_criteria.begin(); /* * If the user wishes to only use the REFINE_BOXES tagging option, @@ -133,15 +119,15 @@ StandardTagAndInitialize::StandardTagAndInitialize( * the GRADIENT_DETECTOR or RICHARDSON_EXTRAPOLATION options, the * registered StandardTagAndInitStrategy must be non-NULL. */ - if (d_use_gradient_detector || d_use_richardson_extrapolation) { - if (tag_strategy == ((StandardTagAndInitStrategy *)NULL)) { - TBOX_ERROR( - getObjectName() << ":constructor " - << "\nThe supplied implementation of the " - << "\nStandardTagAndInitStrategy is NULL. It must be" - << "\nnon-NULL to use the GRADIENT_DETECTOR or" - << "\nRICHARDSON_EXTRAPOLATION tagging options." << std::endl); - } + if ((d_ever_uses_richardson_extrapolation || d_ever_uses_gradient_detector) && + tag_strategy == 0) { + TBOX_ERROR( + getObjectName() << ":constructor " + << "\nThe supplied implementation of the " + << "\nStandardTagAndInitStrategy is NULL. It must be" + << "\nnon-NULL to use the GRADIENT_DETECTOR or" + << "\nRICHARDSON_EXTRAPOLATION tagging options." + << std::endl); } } @@ -169,18 +155,13 @@ StandardTagAndInitialize::initializeLevelData( const boost::shared_ptr& old_level, const bool allocate_data) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } + TBOX_ASSERT(!old_level || level_number == old_level->getLevelNumber()); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); - if (d_tag_strategy != ((StandardTagAndInitStrategy *)NULL)) { + if (d_tag_strategy != 0) { d_tag_strategy->initializeLevelData(hierarchy, level_number, init_data_time, @@ -213,13 +194,12 @@ StandardTagAndInitialize::resetHierarchyConfiguration( && (coarsest_level <= finest_level) && (finest_level <= hierarchy->getFinestLevelNumber())); #ifdef DEBUG_CHECK_ASSERTIONS - for (int ln0 = 0; ln0 <= finest_level; ln0++) { + for (int ln0 = 0; ln0 <= finest_level; ++ln0) { TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); } #endif - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); - if (d_tag_strategy != ((StandardTagAndInitStrategy *)NULL)) { + if (d_tag_strategy != 0) { d_tag_strategy->resetHierarchyConfiguration(hierarchy, coarsest_level, finest_level); @@ -251,6 +231,7 @@ void StandardTagAndInitialize::tagCellsForRefinement( const boost::shared_ptr& hierarchy, const int level_number, + const int regrid_cycle, const double regrid_time, const int tag_index, const bool initial_time, @@ -263,11 +244,14 @@ StandardTagAndInitialize::tagCellsForRefinement( && (level_number <= hierarchy->getFinestLevelNumber())); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); TBOX_ASSERT(tag_index >= 0); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); - if (d_use_richardson_extrapolation) { + bool usesRichExtrap = + usesRichardsonExtrapolation(regrid_cycle, regrid_time); + + if (usesRichExtrap) { tagCellsUsingRichardsonExtrapolation(hierarchy, level_number, + regrid_cycle, regrid_time, regrid_start_time, tag_index, @@ -276,20 +260,16 @@ StandardTagAndInitialize::tagCellsForRefinement( can_be_refined); } - if (d_use_gradient_detector) { + if (usesGradientDetector(regrid_cycle, regrid_time)) { - NULL_USE(regrid_start_time); - NULL_USE(can_be_refined); - NULL_USE(coarsest_sync_level); - - TBOX_ASSERT(d_tag_strategy != ((StandardTagAndInitStrategy *)NULL)); + TBOX_ASSERT(d_tag_strategy != 0); d_tag_strategy->applyGradientDetector(hierarchy, level_number, regrid_time, tag_index, initial_time, - d_use_richardson_extrapolation); + usesRichExtrap); } /* @@ -297,10 +277,14 @@ StandardTagAndInitialize::tagCellsForRefinement( * from the TagAndInitializeStrategy class, from which this class is * derived. */ - if (d_use_refine_boxes) { + if (usesRefineBoxes(regrid_cycle, regrid_time)) { hier::BoxContainer refine_boxes; - getUserSuppliedRefineBoxes(refine_boxes, level_number, regrid_time); + getUserSuppliedRefineBoxes( + refine_boxes, + level_number, + regrid_cycle, + regrid_time); boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); @@ -310,14 +294,16 @@ StandardTagAndInitialize::tagCellsForRefinement( const boost::shared_ptr& patch = *ip; boost::shared_ptr > tag_data( - patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_index))); TBOX_ASSERT(tag_data); - for (hier::BoxContainer::iterator ib(refine_boxes); - ib != refine_boxes.end(); ++ib) { - hier::Box intersection = *ib * tag_data->getBox(); + const hier::Box& tag_data_box = tag_data->getBox(); + const hier::BlockId& tag_data_block_id = tag_data_box.getBlockId(); + for (hier::BoxContainerSingleBlockIterator ib = refine_boxes.begin(tag_data_block_id); + ib != refine_boxes.end(tag_data_block_id); ++ib) { + hier::Box intersection = *ib * tag_data_box; if (!(intersection.empty())) { tag_data->fill(1, intersection); } @@ -391,6 +377,7 @@ void StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( const boost::shared_ptr& hierarchy, const int level_number, + const int regrid_cycle, const double regrid_time, const double regrid_start_time, const int tag_index, @@ -398,11 +385,10 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( const bool coarsest_sync_level, const bool can_be_refined) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); TBOX_ASSERT(regrid_start_time <= regrid_time); - TBOX_ASSERT(d_tag_strategy != ((StandardTagAndInitStrategy *)NULL)); + TBOX_ASSERT(d_tag_strategy != 0); - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim = hierarchy->getDim(); boost::shared_ptr patch_level( hierarchy->getPatchLevel(level_number)); @@ -418,7 +404,7 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( * between the regrid_start_time and the regrid_time. */ double dt = (regrid_time - regrid_start_time) - / (double)(d_error_coarsen_ratio - 1); + / static_cast(d_error_coarsen_ratio - 1); /* * Determine number of advance steps for time integration on the level. @@ -448,7 +434,7 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( double start_time = regrid_time; double end_time = 0.0; - for (int step_cnt = 0; step_cnt < n_steps; step_cnt++) { + for (int step_cnt = 0; step_cnt < n_steps; ++step_cnt) { end_time = start_time + dt; bool last_step = (step_cnt == (n_steps - 1)); @@ -508,34 +494,34 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( boost::shared_ptr fine_patch( patch_level->getPatch(coarse_patch->getGlobalId())); boost::shared_ptr > ftags( - fine_patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine_patch->getPatchData(tag_index))); boost::shared_ptr > ctags( - coarse_patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse_patch->getPatchData(tag_index))); TBOX_ASSERT(ftags); TBOX_ASSERT(ctags); TBOX_ASSERT(ctags->getDepth() == ftags->getDepth()); - const hier::Index filo = ftags->getGhostBox().lower(); - const hier::Index fihi = ftags->getGhostBox().upper(); - const hier::Index cilo = ctags->getGhostBox().lower(); - const hier::Index cihi = ctags->getGhostBox().upper(); + const hier::Index& filo = ftags->getGhostBox().lower(); + const hier::Index& fihi = ftags->getGhostBox().upper(); + const hier::Index& cilo = ctags->getGhostBox().lower(); + const hier::Index& cihi = ctags->getGhostBox().upper(); - const hier::Index ifirstc = coarse_patch->getBox().lower(); - const hier::Index ilastc = coarse_patch->getBox().upper(); + const hier::Index& ifirstc = coarse_patch->getBox().lower(); + const hier::Index& ilastc = coarse_patch->getBox().upper(); - for (int d = 0; d < ctags->getDepth(); d++) { + for (int d = 0; d < ctags->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(coarsentags1d, COARSENTAGS1D) (ifirstc(0), ilastc(0), + SAMRAI_F77_FUNC(coarsentags1d, COARSENTAGS1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), &coarsen_ratio[0], ftags->getPointer(d), ctags->getPointer(d)); } else if ((dim == tbox::Dimension(2))) { - F77_FUNC(coarsentags2d, COARSENTAGS2D) (ifirstc(0), ifirstc(1), + SAMRAI_F77_FUNC(coarsentags2d, COARSENTAGS2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -543,7 +529,7 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( ftags->getPointer(d), ctags->getPointer(d)); } else if ((dim == tbox::Dimension(3))) { - F77_FUNC(coarsentags3d, COARSENTAGS3D) (ifirstc(0), ifirstc(1), + SAMRAI_F77_FUNC(coarsentags3d, COARSENTAGS3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -572,12 +558,12 @@ StandardTagAndInitialize::tagCellsUsingRichardsonExtrapolation( dt, d_error_coarsen_ratio, initial_time, - d_use_gradient_detector); + usesGradientDetector(regrid_cycle, regrid_time)); /* * Refine tags from coarser level to level. */ - pdat::CellIntegerConstantRefine copytags(dim); + pdat::CellIntegerConstantRefine copytags; for (hier::PatchLevel::iterator ip(coarser_level->begin()); ip != coarser_level->end(); ++ip) { @@ -618,6 +604,7 @@ void StandardTagAndInitialize::preprocessErrorEstimation( const boost::shared_ptr& hierarchy, const int level_number, + const int cycle, const double regrid_time, const double regrid_start_time, const bool initial_time) @@ -626,9 +613,8 @@ StandardTagAndInitialize::preprocessErrorEstimation( TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); - if (d_use_richardson_extrapolation) { + if (usesRichardsonExtrapolation(cycle, regrid_time)) { preprocessRichardsonExtrapolation(hierarchy, level_number, regrid_time, @@ -681,11 +667,10 @@ StandardTagAndInitialize::preprocessRichardsonExtrapolation( const bool initial_time) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(getDim(), *hierarchy); TBOX_ASSERT(regrid_start_time <= regrid_time); - TBOX_ASSERT(d_tag_strategy != ((StandardTagAndInitStrategy *)NULL)); + TBOX_ASSERT(d_tag_strategy != 0); - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim = hierarchy->getDim(); boost::shared_ptr patch_level( hierarchy->getPatchLevel(level_number)); @@ -701,7 +686,7 @@ StandardTagAndInitialize::preprocessRichardsonExtrapolation( * between the regrid_start_time and the regrid_time. */ double dt = (regrid_time - regrid_start_time) - / (double)(d_error_coarsen_ratio - 1); + / static_cast(d_error_coarsen_ratio - 1); /* * Determine start and end times for integration on the coarsened level. @@ -756,84 +741,74 @@ StandardTagAndInitialize::preprocessRichardsonExtrapolation( /* * Generate Connector patch_level<==>coarsened_level and * coarsened_level--->coarsened_level. To support recursive data - * transfer, these Connectors should have gcw equivalent to + * transfer, these Connectors should have widths equivalent to * patch_level<==>patch_level. */ - const hier::IntVector level_to_level_gcw = + const hier::IntVector level_to_level_width = hierarchy->getRequiredConnectorWidth(level_number, level_number); - const hier::Connector level_to_level = - patch_level->getBoxLevel()->getPersistentOverlapConnectors(). - findConnector( - *patch_level->getBoxLevel(), - level_to_level_gcw); - - hier::Connector coarsened_to_level = level_to_level; - coarsened_to_level.setBase(*coarsened_level->getBoxLevel()); - coarsened_to_level.setHead(*patch_level->getBoxLevel()); - coarsened_to_level.setWidth( - hier::IntVector::ceilingDivide(level_to_level_gcw, coarsen_ratio), - true); - - hier::Connector tmp_coarsened(level_to_level); - tmp_coarsened.setBase( *patch_level->getBoxLevel()); - tmp_coarsened.setHead(*coarsened_level->getBoxLevel(), true); - tmp_coarsened.coarsenLocalNeighbors(coarsen_ratio); - tmp_coarsened.setConnectorType(hier::Connector::COMPLETE_OVERLAP); - - const hier::Connector& level_to_coarsened = - patch_level->getBoxLevel()->getPersistentOverlapConnectors(). - createConnector( - *coarsened_level->getBoxLevel(), - level_to_level_gcw, - tmp_coarsened); - - coarsened_level->getBoxLevel()->getPersistentOverlapConnectors(). - createConnector( - *coarsened_level->getBoxLevel(), - hier::IntVector::ceilingDivide(level_to_level_gcw, coarsen_ratio), - tmp_coarsened); + const hier::Connector& level_to_level = + patch_level->findConnector(*patch_level, + level_to_level_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE); + + boost::shared_ptr tmp_coarsened( + boost::make_shared(level_to_level)); + tmp_coarsened->setBase(*coarsened_level->getBoxLevel()); + tmp_coarsened->setHead(*coarsened_level->getBoxLevel()); + tmp_coarsened->setWidth( + hier::IntVector::ceilingDivide(level_to_level_width, coarsen_ratio), true); + tmp_coarsened->coarsenLocalNeighbors(coarsen_ratio); + tmp_coarsened->setTranspose(0, false); + + boost::shared_ptr level_to_coarsened( + boost::make_shared(*tmp_coarsened)); + level_to_coarsened->setBase(*patch_level->getBoxLevel()); + level_to_coarsened->setHead(*coarsened_level->getBoxLevel()); + level_to_coarsened->setWidth(level_to_level_width, true); + level_to_coarsened->setTranspose(0, false); + + coarsened_level->cacheConnector(tmp_coarsened); if (level_number > 0) { /* * Get Connectors coarsened<==>coarser, which are used for recursive * refinement filling of the coarsened level's ghosts. */ - hier::Connector* coarsened_to_coarser = new hier::Connector; - hier::Connector* coarser_to_coarsened = new hier::Connector; + boost::shared_ptr coarser_to_coarsened; boost::shared_ptr coarser_level( hierarchy->getPatchLevel(level_number - 1)); - const hier::Connector& level_to_coarser = - patch_level->getBoxLevel()->getPersistentOverlapConnectors(). - findConnector( - *coarser_level->getBoxLevel(), - hierarchy->getRequiredConnectorWidth( - level_number, level_number - 1)); const hier::Connector& coarser_to_level = - coarser_level->getBoxLevel()->getPersistentOverlapConnectors() - .findConnector( - *patch_level->getBoxLevel(), + coarser_level->findConnectorWithTranspose(*patch_level, + hierarchy->getRequiredConnectorWidth( + level_number - 1, level_number, true), hierarchy->getRequiredConnectorWidth( - level_number - 1, level_number)); + level_number, level_number - 1, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE); + + // level_to_coarsened only needs its transpose set temporarily for this + // call to bridge. When it is cached later we don't want to also cache + // its transpose which is why the tranpose is set to a null shared_ptr a + // few lines below. + hier::Connector coarsened_to_level(level_to_level); + coarsened_to_level.setBase(*coarsened_level->getBoxLevel()); + coarsened_to_level.setHead(*patch_level->getBoxLevel()); + coarsened_to_level.setWidth( + hier::IntVector::ceilingDivide(level_to_level_width, coarsen_ratio), + true); + level_to_coarsened->setTranspose(&coarsened_to_level, false); + hier::OverlapConnectorAlgorithm oca; - oca.bridge(*coarsened_to_coarser, - *coarser_to_coarsened, - coarsened_to_level, - level_to_coarser, + oca.bridge(coarser_to_coarsened, coarser_to_level, - level_to_coarsened); - coarsened_to_coarser->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - coarser_to_coarsened->setConnectorType(hier::Connector::COMPLETE_OVERLAP); - coarsened_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *coarser_level->getBoxLevel(), - coarsened_to_coarser); - coarser_level->getBoxLevel()->getPersistentOverlapConnectors(). - cacheConnector( - *coarsened_level->getBoxLevel(), - coarser_to_coarsened); + *level_to_coarsened, + true); + coarser_level->cacheConnector(coarser_to_coarsened); + + level_to_coarsened->setTranspose(0, false); } + patch_level->cacheConnector(level_to_coarsened); bool before_advance = true; d_tag_strategy->coarsenDataForRichardsonExtrapolation(hierarchy, @@ -890,8 +865,8 @@ StandardTagAndInitialize::preprocessRichardsonExtrapolation( * Add the constructed coarsened level to the array of maintained * coarsened levels for Richardson extrapolation. */ - if (d_rich_extrap_coarsened_levels.getSize() < level_number + 1) { - d_rich_extrap_coarsened_levels.resizeArray(level_number + 1); + if (static_cast(d_rich_extrap_coarsened_levels.size()) < level_number + 1) { + d_rich_extrap_coarsened_levels.resize(level_number + 1); } d_rich_extrap_coarsened_levels[level_number] = coarsened_level; @@ -912,22 +887,24 @@ bool StandardTagAndInitialize::coarsestLevelBoxesOK( const hier::BoxContainer& boxes) const { - TBOX_ASSERT(boxes.size() > 0); + TBOX_ASSERT(!boxes.empty()); bool boxes_ok = true; - if (d_use_richardson_extrapolation) { + if (everUsesRichardsonExtrapolation()) { + + const tbox::Dimension& dim = boxes.begin()->getDim(); - for (hier::BoxContainer::const_iterator ib(boxes); + for (hier::BoxContainer::const_iterator ib = boxes.begin(); ib != boxes.end(); ++ib) { hier::IntVector n_cells = ib->numberCells(); - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { int error_coarsen_ratio = getErrorCoarsenRatio(); if (!((n_cells(i) % error_coarsen_ratio) == 0)) { tbox::perr << "Bad domain box: " << *ib << std::endl; TBOX_WARNING( - getObjectName() << "At least one box on the \n" + getObjectName() << "At least one box on the\n" << "coarsest level could not be coarsened by the ratio: " - << error_coarsen_ratio); + << error_coarsen_ratio << std::endl); boxes_ok = false; } } @@ -951,42 +928,43 @@ StandardTagAndInitialize::coarsestLevelBoxesOK( void StandardTagAndInitialize::checkCoarsenRatios( - const tbox::Array& ratio_to_coarser) + const std::vector& ratio_to_coarser) { - if (d_use_richardson_extrapolation) { + if (everUsesRichardsonExtrapolation()) { + const tbox::Dimension& dim = ratio_to_coarser[1].getDim(); /* - * Compute GCD on first dimension of level 1 + * Compute GCD on first coordinate direction of level 1 */ int error_coarsen_ratio = 0; - int gcd_level1 = ratio_to_coarser[1](0); + int gcd_level1 = ratio_to_coarser[1](0,0); if ((gcd_level1 % 2) == 0) { error_coarsen_ratio = 2; } else if ((gcd_level1 % 3) == 0) { error_coarsen_ratio = 3; } else { TBOX_ERROR("Unable to perform Richardson extrapolation algorithm " - << "with ratio_to_coarser[1](0) = " << gcd_level1); + << "with ratio_to_coarser[1](0) = " << gcd_level1 << std::endl); } /* * Iterate through levels and check the coarsen ratios to make sure the - * error coarsen ratios computed in every dimension on every + * error coarsen ratios computed in every coordinate direction on every * level are between the supported 2 or 3, and that the error coarsen * ratios are constant over the hierarchy. */ - for (int ln = 1; ln < ratio_to_coarser.getSize(); ln++) { + for (int ln = 1; ln < static_cast(ratio_to_coarser.size()); ++ln) { - for (int d = 0; d < getDim().getValue(); d++) { - int gcd = GCD(error_coarsen_ratio, ratio_to_coarser[ln](d)); + for (int d = 0; d < dim.getValue(); ++d) { + int gcd = GCD(error_coarsen_ratio, ratio_to_coarser[ln](0,d)); if ((gcd % error_coarsen_ratio) != 0) { - gcd = ratio_to_coarser[ln](d); + gcd = ratio_to_coarser[ln](0,d); TBOX_ERROR( getObjectName() << "\n" << "Unable to perform Richardson extrapolation because\n" << "the error coarsen ratio computed from the\n" << "ratio_to_coarser entries is not constant across all\n" - << "levels, in all dimensions, of the hierarchy. In\n" + << "levels, in all coordinate directions, of the hierarchy. In\n" << "order to use Richardson extrapolation, the minimum\n" << "divisor (> 1) of all the ratio_to_coarser entries must\n" << "be 2 -or- 3:\n" @@ -994,7 +972,8 @@ StandardTagAndInitialize::checkCoarsenRatios( << error_coarsen_ratio << "\n level " << ln << "(" << d << "):" - << ": ratio_to_coarser = " << gcd); + << ": ratio_to_coarser = " << gcd + << std::endl); } } } @@ -1005,10 +984,171 @@ StandardTagAndInitialize::checkCoarsenRatios( } +/* + ************************************************************************* + * Returns true if there is ever a tagging crtieria which advances the + * solution data in the regridding process. + ************************************************************************* + */ +bool +StandardTagAndInitialize::everUsesTimeIntegration() const +{ + return everUsesRichardsonExtrapolation(); +} + +/* + ************************************************************************* + * Returns true if the tagging crtieria for the supplied cycle/time + * advances the solution data in the regridding process. + ************************************************************************* + */ +bool +StandardTagAndInitialize::usesTimeIntegration( + int cycle, + double time) +{ + return usesRichardsonExtrapolation(cycle, time); +} + +/* + ************************************************************************* + * Returns true if there is ever a Richardson extrapolation tagging crtieria. + ************************************************************************* + */ +bool +StandardTagAndInitialize::everUsesRichardsonExtrapolation() const +{ + return d_ever_uses_richardson_extrapolation; +} + +/* + ************************************************************************* + * Returns true if there is a Richardson extrapolation tagging crtieria + * for the supplied cycle/time. + ************************************************************************* + */ +bool +StandardTagAndInitialize::usesRichardsonExtrapolation( + int cycle, + double time) +{ + TBOX_ASSERT(!d_use_cycle_criteria || !d_use_time_criteria); + + bool result = false; + + setCurrentTaggingCriteria(cycle, time); + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + result = true; + break; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + result = true; + break; + } + } + } + return result; +} + +/* + ************************************************************************* + * Returns true if there is ever a gradient detector tagging crtieria. + ************************************************************************* + */ bool -StandardTagAndInitialize::usesTimeIntegration() const +StandardTagAndInitialize::everUsesGradientDetector() const { - return d_use_richardson_extrapolation; + return d_ever_uses_gradient_detector; +} + +/* + ************************************************************************* + * Returns true if there is a gradient detector tagging crtieria for the + * supplied cycle/time. + ************************************************************************* + */ +bool +StandardTagAndInitialize::usesGradientDetector( + int cycle, + double time) +{ + TBOX_ASSERT(!d_use_cycle_criteria || !d_use_time_criteria); + + bool result = false; + + setCurrentTaggingCriteria(cycle, time); + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "GRADIENT_DETECTOR") { + result = true; + break; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "GRADIENT_DETECTOR") { + result = true; + break; + } + } + } + return result; +} + +/* + ************************************************************************* + * Returns true if there is ever a refine boxes tagging crtieria. + ************************************************************************* + */ +bool +StandardTagAndInitialize::everUsesRefineBoxes() const +{ + return d_ever_uses_refine_boxes; +} + +/* + ************************************************************************* + * Returns true if there is a refine boxes tagging crtieria for the + * supplied cycle/time. + ************************************************************************* + */ +bool +StandardTagAndInitialize::usesRefineBoxes( + int cycle, + double time) +{ + TBOX_ASSERT(!d_use_cycle_criteria || !d_use_time_criteria); + + bool result = false; + + setCurrentTaggingCriteria(cycle, time); + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "REFINE_BOXES") { + result = true; + break; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "REFINE_BOXES") { + result = true; + break; + } + } + } + return result; } int @@ -1018,12 +1158,15 @@ StandardTagAndInitialize::getErrorCoarsenRatio() const } bool -StandardTagAndInitialize::refineUserBoxInputOnly() const +StandardTagAndInitialize::refineUserBoxInputOnly( + int cycle, + double time) { bool use_only_refine_boxes = false; - if (d_use_refine_boxes) { + if (usesRefineBoxes(cycle, time)) { use_only_refine_boxes = true; - if (d_use_gradient_detector || d_use_richardson_extrapolation) { + if (usesGradientDetector(cycle, time) || + usesRichardsonExtrapolation(cycle, time)) { use_only_refine_boxes = false; } } @@ -1040,80 +1183,897 @@ StandardTagAndInitialize::refineUserBoxInputOnly() const void StandardTagAndInitialize::getFromInput( - const boost::shared_ptr& db) + const boost::shared_ptr& input_db) { - TBOX_ASSERT(db); + /* + * If no input database is provided, no criteria is set to tag cells + * so cell-tagging will not occur. Print a warning to indicate if + * this is the case. + */ + if (input_db) { - tbox::Array tagging_method; - if (db->keyExists("tagging_method")) { - tagging_method = db->getStringArray("tagging_method"); + /* + * Allow shortcut syntax. + */ + if (input_db->keyExists("tagging_method")) { + // Shortcut syntax read here. + + CycleTagCriteria this_cycle_crit; + TagCriteria this_tag_crit; + this_cycle_crit.d_cycle = 0; + std::string tagging_method = input_db->getString("tagging_method"); + if (!(tagging_method == "RICHARDSON_EXTRAPOLATION" || + tagging_method == "GRADIENT_DETECTOR" || + tagging_method == "REFINE_BOXES" || + tagging_method == "NONE")) { + INPUT_VALUE_ERROR("tagging_method"); + } + this_tag_crit.d_tagging_method = tagging_method; + if (tagging_method == "REFINE_BOXES") { + d_ever_uses_refine_boxes = true; + std::vector level_keys = input_db->getAllKeys(); + int n_level_keys = static_cast(level_keys.size()); + if (n_level_keys <= 1) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "No refine boxes supplied." + << std::endl); + } + for (int k = 0; k < n_level_keys; ++k) { + hier::BoxContainer level_boxes; + if (level_keys[k] == "tagging_method") { + continue; + } + if (level_keys[k].find("level_") != 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid syntax for level refine boxes." + << std::endl); + } + int level = atoi(level_keys[k].substr(6).c_str()); + boost::shared_ptr level_db( + input_db->getDatabase(level_keys[k])); + std::vector block_keys = level_db->getAllKeys(); + int n_block_keys = static_cast(block_keys.size()); + if (n_block_keys <= 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "No refine boxes supplied." + << std::endl); + } + if ((n_block_keys == 1) && (block_keys[0] == "boxes")) { + std::vector db_box_vector = + level_db->getDatabaseBoxVector("boxes"); + hier::BoxContainer boxes(db_box_vector); + for (hier::BoxContainer::iterator b = boxes.begin(); + b != boxes.end(); ++b) { + b->setBlockId(hier::BlockId(0)); + } + level_boxes.spliceBack(boxes); + } else { + for (int l = 0; l < n_block_keys; ++l) { + if (block_keys[l].find("block_") != 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid syntax for level refine boxes." + << std::endl); + } + int block = atoi(block_keys[l].substr(6).c_str()); + boost::shared_ptr block_db( + level_db->getDatabase(block_keys[l])); + std::vector db_box_vector = + block_db->getDatabaseBoxVector("boxes"); + hier::BoxContainer boxes(db_box_vector); + for (hier::BoxContainer::iterator b = boxes.begin(); + b != boxes.end(); ++b) { + b->setBlockId(hier::BlockId(block)); + } + level_boxes.spliceBack(boxes); + boxes.clear(); + } + } + this_tag_crit.d_level_refine_boxes.insert( + std::make_pair(level, level_boxes)); + level_boxes.clear(); + } + } else if (tagging_method == "RICHARDSON_EXTRAPOLATION") { + d_ever_uses_richardson_extrapolation = true; + } else if (tagging_method == "GRADIENT_DETECTOR") { + d_ever_uses_gradient_detector = true; + } else { + TBOX_WARNING( + getObjectName() << "::getFromInput\n" + << "NO METHOD IS SPECIFIED TO TAG CELLS FOR\n" + << "REFINEMENT so no tagging is performed." + << std::endl); + } + this_cycle_crit.d_tag_criteria.push_back(this_tag_crit); + d_cycle_criteria.insert(this_cycle_crit); + } else { + // Complete syntax read here. + + // Read the set of criteria for each cycle or time having tagging + // criteria. + int n_at_commands = static_cast(input_db->getAllKeys().size()); + for (int i = 0; i < n_at_commands; ++i) { + std::string at_name = "at_" + tbox::Utilities::intToString(i); + if (!input_db->keyExists(at_name)) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Missing tagging criteria " << i << "." + << std::endl); + } + boost::shared_ptr at_db( + input_db->getDatabase(at_name)); + + // Read information specific to a cycle or a time criteria. + CycleTagCriteria this_cycle_crit; + TimeTagCriteria this_time_crit; + bool is_cycle = false; + if (at_db->keyExists("cycle")) { + /* + * Read cycle tagging criteria. + */ + int cycle = at_db->getInteger("cycle"); + if (!(cycle >= 0)) { + INPUT_RANGE_ERROR("cycle"); + } + this_cycle_crit.d_cycle = cycle; + is_cycle = true; + } else if (at_db->keyExists("time")) { + /* + * Read time tagging criteria. + */ + double time = at_db->getDouble("time"); + if (!(time >= 0)) { + INPUT_RANGE_ERROR("time"); + } + this_time_crit.d_time = time; + } else { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid tagging period, must be 'cycle' or 'time'." + << std::endl); + } + + /* + * Read info common to cycle and time tagging criteria. + */ + int n_tag_keys = static_cast(at_db->getAllKeys().size()) - 1; + if (n_tag_keys <= 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "No tagging criteria supplied for tag " + << i << "." + << std::endl); + } + + // Read the set of criteria at this cycle or time. + for (int j = 0; j < n_tag_keys; ++j) { + TagCriteria this_tag_crit; + std::string tag_name = "tag_" + tbox::Utilities::intToString(j); + if (!at_db->keyExists(tag_name)) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Missing tag criteria." << std::endl); + } + boost::shared_ptr this_tag_db( + at_db->getDatabase(tag_name)); + std::string tagging_method = + this_tag_db->getString("tagging_method"); + if (tagging_method != "RICHARDSON_EXTRAPOLATION" && + tagging_method != "GRADIENT_DETECTOR" && + tagging_method != "REFINE_BOXES" && + tagging_method != "NONE") { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid tagging_method supplied." + << std::endl); + } + this_tag_crit.d_tagging_method = tagging_method; + + // If REFINE_BOXES is the method then the boxes for each level + // need to be read. + if (tagging_method == "REFINE_BOXES") { + d_ever_uses_refine_boxes = true; + std::vector level_keys = this_tag_db->getAllKeys(); + int n_level_keys = static_cast(level_keys.size()); + if (n_level_keys <= 1) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "No refine boxes supplied." + << std::endl); + } + + // For each level specified, read the refine boxes. + for (int k = 0; k < n_level_keys; ++k) { + hier::BoxContainer level_boxes; + if (level_keys[k] == "tagging_method") { + continue; + } + if (level_keys[k].find("level_") != 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid syntax for level refine boxes." + << std::endl); + } + int level = atoi(level_keys[k].substr(6).c_str()); + boost::shared_ptr level_db( + this_tag_db->getDatabase(level_keys[k])); + std::vector block_keys = + level_db->getAllKeys(); + int n_block_keys = static_cast(block_keys.size()); + if (n_block_keys <= 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "No refine boxes supplied." + << std::endl); + } + if ((n_block_keys == 1) && (block_keys[0] == "boxes")) { + std::vector db_box_vector = + level_db->getDatabaseBoxVector("boxes"); + hier::BoxContainer boxes(db_box_vector); + for (hier::BoxContainer::iterator b = boxes.begin(); + b != boxes.end(); ++b) { + b->setBlockId(hier::BlockId(0)); + } + level_boxes.spliceBack(boxes); + } else { + for (int l = 0; l < n_block_keys; ++l) { + if (block_keys[l].find("block_") != 0) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "Invalid syntax for level refine boxes." + << std::endl); + } + int block = atoi(block_keys[l].substr(6).c_str()); + boost::shared_ptr block_db( + level_db->getDatabase(block_keys[l])); + std::vector db_box_vector = + block_db->getDatabaseBoxVector("boxes"); + hier::BoxContainer boxes(db_box_vector); + for (hier::BoxContainer::iterator b = boxes.begin(); + b != boxes.end(); ++b) { + b->setBlockId(hier::BlockId(block)); + } + level_boxes.spliceBack(boxes); + boxes.clear(); + } + } + this_tag_crit.d_level_refine_boxes.insert( + std::make_pair(level, level_boxes)); + level_boxes.clear(); + } + } else if (tagging_method == "RICHARDSON_EXTRAPOLATION") { + d_ever_uses_richardson_extrapolation = true; + } else if (tagging_method == "GRADIENT_DETECTOR") { + d_ever_uses_gradient_detector = true; + } else if (n_tag_keys != 1) { + TBOX_ERROR( + getObjectName() << "::getFromInput \n" + << "A tagging method of NONE has been specified \n" + << "along with other tagging methods for the \n." + << "same cycle or time. This is contradictory." + << std::endl); + } + // Add the tagging criteria to the vector of criteria. + if (is_cycle) { + this_cycle_crit.d_tag_criteria.push_back(this_tag_crit); + } else { + this_time_crit.d_tag_criteria.push_back(this_tag_crit); + } + + // Clear the tagging criteria's boxes for the next criteria in + // the set. + this_tag_crit.d_level_refine_boxes.clear(); + } + + // Add the collection of tagging criteria for this cycle or time to + // the appropriate set. + if (is_cycle) { + d_cycle_criteria.insert(this_cycle_crit); + } else { + d_time_criteria.insert(this_time_crit); + } + + // Clear the collection of tagging criteria for the next cycle or + // time. + this_cycle_crit.d_tag_criteria.clear(); + } + } + + if (d_cycle_criteria.empty() && d_time_criteria.empty()) { + TBOX_WARNING( + getObjectName() << "::getFromInput\n" + << "NO METHOD IS SPECIFIED TO TAG CELLS FOR\n" + << "REFINEMENT so no tagging is performed." + << std::endl); + } + } else { + TBOX_WARNING( + getObjectName() << "::getFromInput\n" + << "no input database specified - NO METHOD IS SPECIFIED TO TAG\n" + << "CELLS FOR REFINEMENT so no tagging is performed." + << std::endl); } - if (tagging_method.getSize() > 3) { - TBOX_ERROR(getObjectName() << ":getFromInput\n" - << tagging_method.getSize() - << "entries specified" - << "in `tagging_method' input. Maximum allowable is 3."); +} + +/* + ************************************************************************* + * + * Sets refine boxes for case where refine region is specified by the + * user. The bool return value specifies whether or not the refine + * boxes have been reset from the last time the method was called + * (true = they are reset, false = they have NOT changed). + * + * Note that if any method which invokes tagging is performed there + * is always potential that the boxes have changed so this method will + * always return true in this case. + * + ************************************************************************* + */ +bool +StandardTagAndInitialize::getUserSuppliedRefineBoxes( + hier::BoxContainer& refine_boxes, + const int level_num, + const int cycle, + const double time) +{ + TBOX_ASSERT(refine_boxes.empty()); + TBOX_ASSERT(level_num >= 0); + TBOX_ASSERT(time >= 0.); + TBOX_ASSERT(!d_use_cycle_criteria || !d_use_time_criteria); + + setCurrentTaggingCriteria(cycle, time); + + /* + * Get the boxes to refine on the supplied level depending on whether we're + * using a scycle or a time criteria. + */ + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "REFINE_BOXES") { + std::map::const_iterator boxes = + i->d_level_refine_boxes.find(level_num); + if (boxes != i->d_level_refine_boxes.end()) { + refine_boxes = boxes->second; + } + break; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "REFINE_BOXES") { + std::map::const_iterator boxes = + i->d_level_refine_boxes.find(level_num); + if (boxes != i->d_level_refine_boxes.end()) { + refine_boxes = boxes->second; + } + break; + } + } } - d_use_gradient_detector = false; - d_use_richardson_extrapolation = false; - d_use_refine_boxes = false; + /* + * If the user has requested their own particular set of refine + * boxes (i.e. by calling resetRefineBoxes()), overwrite any previously + * determined refine boxes with their requested set. + */ + bool use_reset = false; + if (static_cast(d_refine_boxes_reset.size()) > level_num) { + if (d_refine_boxes_reset[level_num]) { + use_reset = true; + refine_boxes = d_reset_refine_boxes[level_num]; + } + } + + if (refine_boxes.empty()) { + TBOX_WARNING( + getObjectName() << ": getRefineBoxes\n" + << "No refine boxes specified on level " << level_num + << ".\n No refinement will be performed." + << std::endl); + } /* - * Check tagging method input. + * If we have reset the boxes or the boxes have changed due to a change in + * the tagging criteria from the last cycle/time then return "true". */ + bool modified_refine_boxes = false; + if (use_reset || d_boxes_changed) { + modified_refine_boxes = true; + } - bool found_method = false; - for (int i = 0; i < tagging_method.getSize(); i++) { + return modified_refine_boxes; - if (tagging_method[i] == "GRADIENT_DETECTOR") { +} - d_use_gradient_detector = true; - found_method = true; +/* + ************************************************************************* + * + * Resets refine boxes for specified level. + * + ************************************************************************* + */ +void +StandardTagAndInitialize::resetRefineBoxes( + const hier::BoxContainer& refine_boxes, + const int level_num) +{ + TBOX_ASSERT(level_num >= 0); + + int i = static_cast(d_reset_refine_boxes.size()); + if (i <= level_num) { + d_reset_refine_boxes.resize(level_num + 1); + d_refine_boxes_reset.resize(level_num + 1); + for ( ; i < static_cast(d_reset_refine_boxes.size()); ++i) { + d_refine_boxes_reset[i] = false; } + } - if (tagging_method[i] == "RICHARDSON_EXTRAPOLATION") { + d_refine_boxes_reset[level_num] = true; + d_reset_refine_boxes[level_num] = refine_boxes; - d_use_richardson_extrapolation = true; - found_method = true; +} +void +StandardTagAndInitialize::turnOnRefineBoxes( + double time) +{ + TimeTagCriteria search_for; + search_for.d_time = time; + std::set::iterator existing = + d_time_criteria.find(search_for); + if (existing == d_time_criteria.end()) { + TimeTagCriteria this_time_crit; + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "REFINE_BOXES"; + this_time_crit.d_time = time; + this_time_crit.d_tag_criteria.push_back(this_tag_crit); + d_cur_time_criteria = d_time_criteria.insert(this_time_crit).first; + } else { + bool refine_boxes_already_on = false; + for (std::vector::const_iterator i = existing->d_tag_criteria.begin(); + i != existing->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "REFINE_BOXES") { + refine_boxes_already_on = true; + break; + } } + if (!refine_boxes_already_on) { + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "REFINE_BOXES"; + std::vector& this_tag_criteria = + const_cast&>(existing->d_tag_criteria); + this_tag_criteria.push_back(this_tag_crit); + } + } +} - if (tagging_method[i] == "REFINE_BOXES") { +void +StandardTagAndInitialize::turnOffRefineBoxes( + double time) +{ + for (std::set::iterator i = d_time_criteria.begin(); + i != d_time_criteria.end(); ++i) { + if (i->d_time <= time) { + std::vector& tag_crits = + const_cast&>(i->d_tag_criteria); + std::vector::iterator j = tag_crits.begin(); + while (j != tag_crits.end()) { + if (j->d_tagging_method == "REFINE_BOXES") { + tag_crits.erase(j); + } else { + ++j; + } + } + break; + } + } +} - d_use_refine_boxes = true; - found_method = true; +void +StandardTagAndInitialize::turnOnGradientDetector( + double time) +{ + if (!d_tag_strategy) { + TBOX_ERROR("StandardTagAndInitialize::turnOnGradientDetector\n" + << "A tagging strategy must be defined if graient detector is used.\n"); + } + TimeTagCriteria search_for; + search_for.d_time = time; + std::set::iterator existing = + d_time_criteria.find(search_for); + if (existing == d_time_criteria.end()) { + TimeTagCriteria this_time_crit; + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "GRADIENT_DETECTOR"; + this_time_crit.d_time = time; + this_time_crit.d_tag_criteria.push_back(this_tag_crit); + d_cur_time_criteria = d_time_criteria.insert(this_time_crit).first; + } else { + bool grad_detect_already_on = false; + for (std::vector::const_iterator i = existing->d_tag_criteria.begin(); + i != existing->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "GRADIENT_DETECTOR") { + grad_detect_already_on = true; + break; + } + } + if (!grad_detect_already_on) { + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "GRADIENT_DETECTOR"; + std::vector& this_tag_criteria = + const_cast&>(existing->d_tag_criteria); + this_tag_criteria.push_back(this_tag_crit); } } +} - /* - * Check for valid entries - */ - if (!found_method) { - TBOX_WARNING( - getObjectName() << ":getFromInput \n" - << "No `tagging_method' entry specified, so cell tagging \n" - << "will NOT be performed. If you wish to invoke cell \n" - << "tagging, you must enter one or more valid tagging \n" - << "methods, of type GRADIENT_DETECTOR, " - << "RICHARDSON_EXTRAPOLATION, or REFINE_BOXES\n" - << "See class header for details.\n"); +void +StandardTagAndInitialize::turnOffGradientDetector( + double time) +{ + for (std::set::iterator i = d_time_criteria.begin(); + i != d_time_criteria.end(); ++i) { + if (i->d_time <= time) { + std::vector& tag_crits = + const_cast&>(i->d_tag_criteria); + std::vector::iterator j = tag_crits.begin(); + while (j != tag_crits.end()) { + if (j->d_tagging_method == "GRADIENT_DETECTOR") { + tag_crits.erase(j); + } else { + ++j; + } + } + break; + } } +} - /* - * If user-supplied refine boxes are to be used, get refine box information - * from input using the TagAndInitializeStrategy class, from which - * this class is derived. - */ - if (d_use_refine_boxes) { - TagAndInitializeStrategy::getFromInput(db); +void +StandardTagAndInitialize::turnOnRichardsonExtrapolation( + double time) +{ + if (!d_tag_strategy) { + TBOX_ERROR("StandardTagAndInitialize::turnOnRichardsonExtrapolation\n" + << "A tagging strategy must be defined if\n" + << "Richardson extrapolation is used.\n"); + } + + TimeTagCriteria search_for; + search_for.d_time = time; + std::set::iterator existing = + d_time_criteria.find(search_for); + if (existing == d_time_criteria.end()) { + TimeTagCriteria this_time_crit; + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "RICHARDSON_EXTRAPOLATION"; + this_time_crit.d_time = time; + this_time_crit.d_tag_criteria.push_back(this_tag_crit); + d_cur_time_criteria = d_time_criteria.insert(this_time_crit).first; + } else { + bool rich_extrap_already_on = false; + for (std::vector::const_iterator i = existing->d_tag_criteria.begin(); + i != existing->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + rich_extrap_already_on = true; + break; + } + } + if (!rich_extrap_already_on) { + TagCriteria this_tag_crit; + this_tag_crit.d_tagging_method = "RICHARDSON_EXTRAPOLATION"; + std::vector& this_tag_criteria = + const_cast&>(existing->d_tag_criteria); + this_tag_criteria.push_back(this_tag_crit); + } + } +} + +void +StandardTagAndInitialize::turnOffRichardsonExtrapolation( + double time) +{ + for (std::set::iterator i = d_time_criteria.begin(); + i != d_time_criteria.end(); ++i) { + if (i->d_time <= time) { + std::vector& tag_crits = + const_cast&>(i->d_tag_criteria); + std::vector::iterator j = tag_crits.begin(); + while (j != tag_crits.end()) { + if (j->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + tag_crits.erase(j); + } else { + ++j; + } + } + break; + } + } +} + +/* + ************************************************************************* + * Find the tagging criteria for the supplied time and cycle. If there + * are both cycle and time criteria for this cycle/time combination the + * time criteria has precedence. + ************************************************************************* + */ +void +StandardTagAndInitialize::setCurrentTaggingCriteria( + int cycle, + double time) +{ + TBOX_ASSERT(!d_use_cycle_criteria || !d_use_time_criteria); + + // Only change tagging criteria if the problem has advanced to a new + // cycle. We specifically do not change tagging criteria level by level + // due solely to changes in level simulation time. + if (d_old_cycle != cycle) { + d_old_cycle = cycle; + + // Cache information about the old (current) tagging criteria so that + // it can be determined if the tagged boxes have changed due to a change + // in tagging criteria. + bool old_use_cycle_criteria = d_use_cycle_criteria; + bool old_use_time_criteria = d_use_time_criteria; + std::set::iterator old_cur_cycle_criteria = + d_cur_cycle_criteria; + std::set::iterator old_cur_time_criteria = + d_cur_time_criteria; + bool old_use_re = false; + bool old_use_gd = false; + bool old_use_rb = false; + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = + d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + old_use_re = true; + } else if (i->d_tagging_method == "GRADIENT_DETECTOR") { + old_use_gd = true; + } else if (i->d_tagging_method == "REFINE_BOXES") { + old_use_rb = true; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = + d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + old_use_re = true; + } else if (i->d_tagging_method == "GRADIENT_DETECTOR") { + old_use_gd = true; + } else if (i->d_tagging_method == "REFINE_BOXES") { + old_use_rb = true; + } + } + } + + // Now set the new tagging criteria. If both cycle and time criteria + // are valid at the current cycle/time, the time criteria takes + // precedence. + if (!d_cycle_criteria.empty()) { + // Find the cycle criteria for the supplied cycle, if any. + for ( ; d_cur_cycle_criteria != d_cycle_criteria.end(); + ++d_cur_cycle_criteria) { + std::set::iterator next_cycle_criteria = + d_cur_cycle_criteria; + ++next_cycle_criteria; + if (next_cycle_criteria == d_cycle_criteria.end()) { + // This is the last cycle criteria so see if it's valid at this + // cycle and quit. + if (cycle >= d_cur_cycle_criteria->d_cycle) { + d_use_cycle_criteria = true; + d_use_time_criteria = false; + } + break; + } else if (cycle >= d_cur_cycle_criteria->d_cycle && + cycle < next_cycle_criteria->d_cycle) { + // This is not the last cycle criteria so see if it's valid and + // the next one isn't at this cycle. If so then quit. + d_use_cycle_criteria = true; + d_use_time_criteria = false; + break; + } else if (cycle < d_cur_cycle_criteria->d_cycle) { + // If this cycle criteria isn't valid yet then none of the + // others will be either so just quit looking. + break; + } + } + } + + if (!d_time_criteria.empty()) { + // Find the time criteria for the supplied time, if any. + for ( ; d_cur_time_criteria != d_time_criteria.end(); + ++d_cur_time_criteria) { + std::set::iterator next_time_criteria = + d_cur_time_criteria; + ++next_time_criteria; + if (next_time_criteria == d_time_criteria.end()) { + // This is the last time criteria so see if it's valid at + // this time and quit. + if (time >= d_cur_time_criteria->d_time) { + d_use_time_criteria = true; + d_use_cycle_criteria = false; + } + break; + } else if (time >= d_cur_time_criteria->d_time && + time < next_time_criteria->d_time) { + // This is not the last time criteria so see if it's valid + // and the next one isn't at this time. If so then quit. + d_use_time_criteria = true; + d_use_cycle_criteria = false; + break; + } else if (time < d_cur_time_criteria->d_time) { + // If this time criteria isn't valid yet then none of the + // others will be either so just quit looking. + break; + } + } + } + + // Now summarize information about the new tagging criteria for + // comparison with the information cached at the beginning of this + // method about the old tagging criteria. + bool new_use_re = false; + bool new_use_gd = false; + bool new_use_rb = false; + if (d_use_cycle_criteria) { + for (std::vector::const_iterator i = + d_cur_cycle_criteria->d_tag_criteria.begin(); + i != d_cur_cycle_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + new_use_re = true; + } else if (i->d_tagging_method == "GRADIENT_DETECTOR") { + new_use_gd = true; + } else if (i->d_tagging_method == "REFINE_BOXES") { + new_use_rb = true; + } + } + } else if (d_use_time_criteria) { + for (std::vector::const_iterator i = + d_cur_time_criteria->d_tag_criteria.begin(); + i != d_cur_time_criteria->d_tag_criteria.end(); ++i) { + if (i->d_tagging_method == "RICHARDSON_EXTRAPOLATION") { + new_use_re = true; + } else if (i->d_tagging_method == "GRADIENT_DETECTOR") { + new_use_gd = true; + } else if (i->d_tagging_method == "REFINE_BOXES") { + new_use_rb = true; + } + } + } + + // Compare the old and new tagging criteria to determine if the tagged + // boxes changed. + if ((old_use_re != new_use_re) || (old_use_gd != new_use_gd) || + (old_use_rb != new_use_rb)) { + // If one of the tagging methods which was used is now not used or + // vice-versa, then the tagged boxes have changed. + d_boxes_changed = true; + } else { + // The tagging methods are the same as they were last cycle. + if (new_use_re || new_use_gd) { + // If we're using either Richardson extrapolation or gradient + // detector we must assume that the boxes have changed. + d_boxes_changed = true; + } else if ((old_use_cycle_criteria != d_use_cycle_criteria) || + (old_use_time_criteria != d_use_time_criteria)) { + // Assume that switching from a cycle to a time criteria or a time + // to a cycle criteria results in different boxes. + d_boxes_changed = true; + } else if (d_use_cycle_criteria) { + // We're still using a cycle tagging criteria. If we're using a + // different cycle tagging criteria assume that the boxes have + // changed. + if (d_cur_cycle_criteria != old_cur_cycle_criteria) { + d_boxes_changed = true; + } else { + d_boxes_changed = false; + } + } else if (d_use_time_criteria) { + // We're still using a time tagging criteria. If we're using a + // different time tagging criteria assume that the boxes have + // changed. + if (d_cur_time_criteria != old_cur_time_criteria) { + d_boxes_changed = true; + } else { + d_boxes_changed = false; + } + } + } } +} + +void +StandardTagAndInitialize::processHierarchyBeforeAddingNewLevel( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& new_box_level) +{ + d_tag_strategy->processHierarchyBeforeAddingNewLevel(hierarchy, + level_number, + new_box_level); +} +void +StandardTagAndInitialize::processLevelBeforeRemoval( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& old_level) +{ + d_tag_strategy->processLevelBeforeRemoval(hierarchy, + level_number, + old_level); } + +/* + ************************************************************************* + * Pass to StandardTagAndInitStrategy to check user tags on a tagged + * level. Only calls into the strategy if using gradient detector or + * Richardson extrapolation at the curren time and cycle. + ************************************************************************* + */ +void +StandardTagAndInitialize::checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int regrid_cycle, + const double regrid_time, + const int tag_index) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(tag_index >= 0); + + if (usesGradientDetector(regrid_cycle, regrid_time) || + usesRichardsonExtrapolation(regrid_cycle, regrid_time)) { + + TBOX_ASSERT(d_tag_strategy != 0); + + d_tag_strategy->checkUserTagData(hierarchy, + level_number, + tag_index); + + } +} + +/* + ************************************************************************* + * Pass to StandardTagAndInitStrategy to check saved tags on a new level. + ************************************************************************* + */ +void +StandardTagAndInitialize::checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(tag_index >= 0); + TBOX_ASSERT(d_tag_strategy != 0); + + d_tag_strategy->checkNewLevelTagData(hierarchy, + level_number, + tag_index); + +} + + + + static int GCD( const int a, const int b) @@ -1142,4 +2102,3 @@ static int GCD( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.h index 9ead22ae..9e9cabc1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitialize.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Gridding routines and params for Richardson Extrapolation. * ************************************************************************/ @@ -16,7 +16,9 @@ #include "SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h" #include "SAMRAI/mesh/TagAndInitializeStrategy.h" -#include +#include "boost/shared_ptr.hpp" + +#include namespace SAMRAI { namespace mesh { @@ -25,7 +27,7 @@ namespace mesh { * Class StandardTagAndInitialize defines an implementation * for level initialization and cell tagging routines needed by * the GriddingAlgorithm class. This class is derived from - * the abstract base class TagAndInitializeStrategy. It invokes + * the abstract base class TagAndInitializeStrategy. It invokes * problem-specific level initialization routines after AMR patch * hierarchy levels change and routines for tagging cells for refinement * using one (or more) of the following methods: @@ -34,42 +36,128 @@ namespace mesh { * - Richardson Extrapolation * - Explicitly defined refine boxes * + * Tagging methods may be activated at specific cycles and/or times. * It is possible to use combinations of these three methods (e.g., * use gradient detection, Richardson extrapolation, and static refine boxes - * at the same time). The order in which they are executed is fixed ( - * Richardson extrapolation first, gradient detection second, and refine + * at the same cycle/time). The order in which they are executed is fixed + * (Richardson extrapolation first, gradient detection second, and refine * boxes third). An input entry for this class is optional. - * If none is provided, the class will by default not use any criteria - * to tag cells for refinement. + * If none is provided, the class will, by default, not use any criteria + * to tag cells for refinement and issue a warning. + * + * Input Parameters + * + * Definitions:
+ * The general input syntax is as follows: * - * Required input keys and data types: NONE + * - \b at_0 + * input section describing a set of tagging methods to apply to a + * cycle or time + * - \b cycle = integer cycle at which the set of tagging methods is + * activated + * one of cycle or time must be supplied + * - \b time = double time at which the set of tagging methods is + * activated + * one of cycle or time must be supplied + * - \b tag_0 + * first tagging method in this set of tagging methods + * - \b tagging_method = one of RICHARDSON_EXTRAPOLATION, + * GRADIENT_DETECTOR, REFINE_BOXES, NONE + * - \b level_m + * required if tagging_method is REFINE_BOXES, the static boxes + * for the mth level + * - \b block_m + * required description of refine boxes in the mth block + * of the level just specified + * - \b boxes = required box array specifying refine + * boxes + * - \b . . . + * - \b block_n + * - \b . . . + * - \b level_n + * - \b . . . + * - \b tag_n + * - \b . . . + * - \b at_n * - * Optional input keys, data types, and defaults: + * If both @b time or @b cycle entries are supplied, at any point + * where both a time and a cycle entry are active, the time entry + * takes precedence. * + * If the problem is single block one may omit the "block_0" database + * enclosing the boxes and simply include the boxes directly inside the + * "level_m" database. * - * - \b tagging_method - * std::string array specification of the type of cell-tagging used. Valid - * choices include: - * - ``GRADIENT_DETECTOR'' - * - ``RICHARDSON_EXTRAPOLATION'' - * - ``REFINE_BOXES'' - * - ``RICHARDSON_EXTRAPOLATION'', ``GRADIENT_DETECTOR'', - * ``REFINE_BOXES'' - * (i.e. a combination of any or all of the above - the choices may - * be placed in any order). If no input is given, no tagging will be - * performed. + * It is possible to use a "shortcut" input syntax for extremely + * simple tagging criteria. If you only want RICHARDSON_EXTRAPOLATION + * or GRADIENT_DETECTOR on for the entire simulation then an input + * of the following form may be used: * - * - \b input section describing the refine boxes for each level. - * (@see mesh::TagAndInitializeStrategy for details on format) + * @code + * tagging_method = RICHARDSON_EXTRAPOLATION + * @endcode * - * A sample input file entry might look like: + * A sample input file entry for a multi-block problem might look like: * - * \verbatim + * @code + * at_0 { + * cycle = 0 + * tag_0 { + * tagging_method = REFINE_BOXES + * level_0 { + * block_1 { + * boxes = [(5,5),(9,9)],[(12,15),(18,19)] + * } + * } + * level_1 { + * block_1 { + * boxes = [(25,30),(29,35)] + * } + * } + * level_2 { + * block_1 { + * boxes = [(60,70),(70,80)] + * } + * } + * } + * } * - * tagging_method = "GRADIENT_DETECTOR", "REFINE_BOXES" - * (@see mesh::TagAndInitializeStrategy) + * at_1 { + * cycle = 10 + * tag_0 { + * tagging_method = REFINE_BOXES + * level_0 { + * block_2 { + * boxes = [(7,7),(11,11)],[(14,17),(20,21)] + * } + * } + * } + * } * - * \endverbatim + * at_2 { + * time = 0.05 + * tag_0 { + * tagging_method = REFINE_BOXES + * level_1 { + * block_0 { + * boxes = [(30,35),(34,40)] + * } + * } + * } + * } + * + * at_3 { + * time = 0.10 + * tag_0 { + * tagging_method = REFINE_BOXES + * level_1 { + * block_1 { + * boxes = [(35,40),(39,45)] + * } + * } + * } + * } + * @endcode * * This class supplies the routines for tagging cells * and invoking problem-specific level initialization routines after AMR @@ -77,9 +165,9 @@ namespace mesh { * are performed in the StandardTagAndInitStrategy * data member, for which methods are specified in a derived subclass. * - * @see mesh::TagAndInitializeStrategy - * @see mesh::GriddingAlgorithm - * @see mesh::StandardTagAndInitStrategy + * @see TagAndInitializeStrategy + * @see GriddingAlgorithm + * @see StandardTagAndInitStrategy */ class StandardTagAndInitialize: @@ -91,9 +179,10 @@ class StandardTagAndInitialize: * may read inputs from the provided input_db. If no input * database is provided, the class interprets that no tagging * is desired so no cell-tagging will be performed. + * + * @pre !object_name.empty() */ StandardTagAndInitialize( - const tbox::Dimension& dim, const std::string& object_name, StandardTagAndInitStrategy* tag_strategy, const boost::shared_ptr& input_db = @@ -106,11 +195,72 @@ class StandardTagAndInitialize: /*! * Specifies whether the chosen method advances the solution data - * in the regridding process (Richardson extrapolation does, the - * others will not). + * in the regridding process at any cycle or time (Richardson + * extrapolation does, the others will not). + */ + bool + everUsesTimeIntegration() const; + + /*! + * Specifies whether the chosen method advances the solution data + * in the regridding process at the supplied cycle or time (Richardson + * extrapolation does, the others will not). + */ + bool + usesTimeIntegration( + int cycle, + double time); + + /*! + * Returns true if Richardson extrapolation is used at any cycle or + * time. + */ + bool + everUsesRichardsonExtrapolation() const; + + /*! + * Returns true if Richardson extrapolation is used at the supplied cycle + * and time. + * + * @pre !d_use_cycle_criteria || !d_use_time_criteria + */ + bool + usesRichardsonExtrapolation( + int cycle, + double time); + + /*! + * Returns true if gradient detector is used at any cycle or time. + */ + bool + everUsesGradientDetector() const; + + /*! + * Returns true if gradient detector is used at the supplied cycle and time. + * + * @pre !d_use_cycle_criteria || !d_use_time_criteria + */ + bool + usesGradientDetector( + int cycle, + double time); + + /*! + * Returns true if user supplied refine boxes is used at any cycle or time. + */ + bool + everUsesRefineBoxes() const; + + /*! + * Returns true if user supplied refine boxes is used at the supplied cycle + * and time. + * + * @pre !d_use_cycle_criteria || !d_use_time_criteria */ bool - usesTimeIntegration() const; + usesRefineBoxes( + int cycle, + double time); /*! * Return coarsen ratio used for applying cell tagging. An error @@ -125,7 +275,7 @@ class StandardTagAndInitialize: */ void checkCoarsenRatios( - const tbox::Array& ratio_to_coarser); + const std::vector& ratio_to_coarser); /*! * Pass the request to initialize the data on a new level in the @@ -138,6 +288,12 @@ class StandardTagAndInitialize: * must first be allocated. For more information on the operations that * must be performed, see the * TagAndInitializeStrategy::initializeLevelData() method. + * + * @pre hierarchy + * @pre (level_number >= 0) && + * (level_number <= hierarchy->getFinestLevelNumber()) + * @pre !old_level || (level_number == old_level->getLevelNumber()) + * @pre hierarchy->getPatchLevel(level_number) */ void initializeLevelData( @@ -156,6 +312,10 @@ class StandardTagAndInitialize: * For more information on the operations that must be performed, see * the TagAndInitializeStrategy::resetHierarchyConfiguration() * method. + * + * @pre hierarchy + * @pre (coarsest_level >= 0) && (coarsest_level <= finest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) */ void resetHierarchyConfiguration( @@ -168,12 +328,18 @@ class StandardTagAndInitialize: * before tagging cells, which is handled by this method. For more * information on the operations that must be performed, see the * TagAndInitializeStrategy::preprocessErrorEstimation() - * method + * method. + * + * @pre hierarchy + * @pre (level_number >= 0) && + * (level_number <= hierarchy->getFinestLevelNumber()) + * @pre hierarchy->getPatchLevel(level_number) */ void preprocessErrorEstimation( const boost::shared_ptr& hierarchy, const int level_number, + const int cycle, const double regrid_time, const double regrid_start_time, const bool initial_time); @@ -185,11 +351,18 @@ class StandardTagAndInitialize: * * For more information on the operations that must be performed, see the * TagAndInitializeStrategy::tagCellsForRefinement() routine. + * + * @pre level + * @pre (level_number >= 0) && + * (level_number <= level->getFinestLevelNumber()) + * @pre level->getPatchLevel(level_number) + * @pre tag_index >= 0 */ void tagCellsForRefinement( const boost::shared_ptr& level, const int level_number, + const int regrid_cycle, const double regrid_time, const int tag_index, const bool initial_time, @@ -202,6 +375,8 @@ class StandardTagAndInitialize: * for gridding strategy. Otherwise, return false. If false is returned, * it is useful to provide a detailed explanatory message describing the * problems with the boxes. + * + * @pre !boxes.empty() */ bool coarsestLevelBoxesOK( @@ -213,76 +388,198 @@ class StandardTagAndInitialize: * tagging, this will return false. */ bool - refineUserBoxInputOnly() const; + refineUserBoxInputOnly( + int cycle, + double time); + + const StandardTagAndInitializeConnectorWidthRequestor& + getConnectorWidthRequestor() const + { + return d_staicwri; + } + + /*! + * Return user supplied set of refine boxes for specified level number + * and time. The boolean return value specifies whether the boxes + * have been reset from the last time this method was called. If they + * have been reset, it returns true. If they are unchanged, it returns + * false. + * + * @pre refine_boxes.empty() + * @pre level_num >= 0 + * @pre time >= 0.0 + * @pre !d_use_cycle_criteria || !d_use_time_criteria + */ + bool + getUserSuppliedRefineBoxes( + hier::BoxContainer& refine_boxes, + const int level_number, + const int cycle, + const double time); /*! - * Turn on gradient detector to tag cells for refinement. + * Reset the static refine boxes for the specified level number in the + * hierarchy. The level number must be greater than or equal to zero. + * + * @pre level_num >= 0 */ void - turnOnGradientDetector() - { - d_use_gradient_detector = true; - } + resetRefineBoxes( + const hier::BoxContainer& refine_boxes, + const int level_number); /*! - * Turn off gradient detector. + * Turn on refine boxes criteria at the specified time programmatically. + * + * @param time Time to turn refine boxes criteria on. */ void - turnOffGradientDetector() - { - d_use_gradient_detector = false; - } + turnOnRefineBoxes( + double time); /*! - * Turn on Richardson extrapolation to tag cells for refinement. + * Turn off refine boxes criteria at the specified time programmatically. + * + * @param time Time to turn refine boxes criteria off. */ void - turnOnRichardsonExtrapolation() - { - d_use_richardson_extrapolation = true; - } + turnOffRefineBoxes( + double time); /*! - * Turn off Richardson extrapolation. + * Turn on gradient detector criteria at the specified time + * programmatically. + * + * @param time Time to turn gradient detector criteria on. + * + * @pre d_tag_strategy */ void - turnOffRichardsonExtrapolation() - { - d_use_richardson_extrapolation = false; - } + turnOnGradientDetector( + double time); /*! - * Turn on static refine box regions where refinement should occur. + * Turn off gradient detector criteria at the specified time + * programmatically. + * + * @param time Time to turn gradient detector criteria off. */ void - turnOnRefineBoxes() - { - d_use_refine_boxes = true; - } + turnOffGradientDetector( + double time); /*! - * Turn off static refine box regions. + * Turn on Richardson extrapolation criteria at the specified time + * programmatically. + * + * @param time Time to turn Richardson extrapolation on. + * + * @pre d_tag_strategy */ void - turnOffRefineBoxes() - { - d_use_refine_boxes = false; - } + turnOnRichardsonExtrapolation( + double time); /*! - * Read input values, indicated above, from given database. + * Turn off Richardson extrapolation criteria at the specified time + * programmatically. * - * When assertion checking is active, the database pointer must be non-null. + * @param time Time to turn Richardson extrapolation off. */ void - getFromInput( - const boost::shared_ptr& db); + turnOffRichardsonExtrapolation( + double time); - const StandardTagAndInitializeConnectorWidthRequestor& - getConnectorWidthRequestor() const - { - return d_staicwri; - } + /*! + * @brief Process a hierarchy before swapping old and new levels during + * regrid. + * + * During regrid, if user code needs to do any application-specific + * operations on the PatchHierarchy before a new level is added or + * an old level is swapped for a new level, this method provides a callback + * for the user to define such operations. The PatchHierarchy is provided + * in its state with the old level, if it exists, still in place, while the + * new BoxLevel is also provided so that the user code can know the boxes + * that will make up the new level. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy being + * added or regridded. + * @param new_box_level BoxLevel containing the boxes for the new level + * + */ + virtual void + processHierarchyBeforeAddingNewLevel( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& new_box_level); + + /*! + * In some cases user code may wish to process a PatchLevel before it is + * removed from the hierarchy. For example, data may exist only on a given + * PatchLevel such as the finest level. If that level were to be removed + * before this data is moved off of it then the data will be lost. This + * method is a user defined callback used by GriddingAlgorithm when a + * PatchLevel is to be removed. The callback performs any user actions on + * the level about to be removed. It is implemented by classes derived from + * StandardTagAndInitStrategy. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy about to be + * removed. + * @param old_level The level in hierarchy about to be removed. + * + * @see GriddingAlgorithm + * @see StandardTagAndInitStrategy + */ + void + processLevelBeforeRemoval( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& old_level = + boost::shared_ptr()); + + /*! + * @brief Check the tags on a tagged level. + * + * This is a callback that is used to check the values held in + * user tag PatchData. The tag data will contain the tags created + * by application code in tagCellsForRefinement as well as + * any tags added internally by the GriddingAlgorithm (for + * example, buffering). + * + * @param[in] hierarchy + * @param[in] level_number Level number of the tagged level + * @param[in] regrid_cycle + * @param[in] regrid_time + * @param[in] tag_index Patch data index for user tags + */ + void + checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int regrid_cycle, + const double regrid_time, + const int tag_index); + + /*! + * @brief Check the tags on a newly-created level. + * + * This is a callback that allow for checking tag values that + * have been saved on a new level that has been created during + * initialization or regridding. The tag values will be the values + * of the user tags on the coarser level, constant-refined onto the + * cells of the new level. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the new level + * @param[in] tag_index Patch data index for the new tags. + */ + void + checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index); private: /* @@ -303,6 +600,7 @@ class StandardTagAndInitialize: tagCellsUsingRichardsonExtrapolation( const boost::shared_ptr& hierarchy, const int level_number, + const int regrid_cycle, const double regrid_time, const double regrid_start_time, const int tag_index, @@ -311,12 +609,21 @@ class StandardTagAndInitialize: const bool can_be_refined); /* - * Booleans specifying the tagging method. Any combination of the - * three methods may be used. + * Set the tagging criteria for the supplied time and cycle. If there + * are both cycle and time criteria for this cycle/time combination the + * time criteria has precedence. + */ + void + setCurrentTaggingCriteria( + int cycle, + double time); + + /* + * Read input values, indicated above, from given database. */ - bool d_use_refine_boxes; - bool d_use_gradient_detector; - bool d_use_richardson_extrapolation; + void + getFromInput( + const boost::shared_ptr& input_db); /* * Concrete object that supplies problem-specific initialization @@ -336,10 +643,114 @@ class StandardTagAndInitialize: * tbox::Array of patch levels containing coarsened versions of the patch * levels, for use with Richardson extrapolation. */ - tbox::Array > d_rich_extrap_coarsened_levels; + std::vector > d_rich_extrap_coarsened_levels; StandardTagAndInitializeConnectorWidthRequestor d_staicwri; + /* + * Arrays to hold boxes that are specifically reset by the user (via the + * resetRefineBoxes() method). The boolean array specifies which levels + * have been reset while the box array specifies the new set of refine + * boxes for the level. + */ + std::vector d_refine_boxes_reset; + std::vector d_reset_refine_boxes; + + struct TagCriteria { + std::string d_tagging_method; + std::map d_level_refine_boxes; + }; + + struct CycleTagCriteria { + int d_cycle; + std::vector d_tag_criteria; + }; + + struct TimeTagCriteria { + double d_time; + std::vector d_tag_criteria; + }; + + struct cycle_tag_criteria_less { + bool + operator () (const CycleTagCriteria& c1, const CycleTagCriteria& c2) const + { + return c1.d_cycle < c2.d_cycle; + } + }; + + struct time_tag_criteria_less { + bool + operator () (const TimeTagCriteria& c1, const TimeTagCriteria& c2) const + { + return c1.d_time < c2.d_time; + } + }; + + /* + * User defined tagging criteria to be applied at specific cycles ordered + * by the application cycle. + */ + std::set d_cycle_criteria; + + /* + * User defined tagging criteria to be applied at specific times ordered + * by the application time. + */ + std::set d_time_criteria; + + /* + * Iterator pointing to the cycle tagging criteria in use if + * d_use_cycle_criteria is true. + */ + std::set::iterator + d_cur_cycle_criteria; + + /* + * Iterator pointing to the time tagging criteria in use if + * d_use_time_criteria is true. + */ + std::set::iterator + d_cur_time_criteria; + + /* + * Flag indicating if a cycle tagging criteria is now being used. At most + * one of d_use_cycle_criteria and d_use_time_criteria can be true. + */ + bool d_use_cycle_criteria; + + /* + * Flag indicating if a time tagging criteria is now being used. At most + * one of d_use_cycle_criteria and d_use_time_criteria can be true. + */ + bool d_use_time_criteria; + + /* + * Flag indicating if any tagging criteria is RICHARDSON_EXTRAPOLATION. + */ + bool d_ever_uses_richardson_extrapolation; + + /* + * Flag indicating if any tagging criteria is GRADIENT_DETECTOR. + */ + bool d_ever_uses_gradient_detector; + + /* + * Flag indicating if any tagging criteria is REFINE_BOXES. + */ + bool d_ever_uses_refine_boxes; + + /* + * Flag indicating if the tagged boxes have changed due to a change in the + * tagging criteria. + */ + bool d_boxes_changed; + + /* + * New tagging criteria are set only when the cycle advances. This tracks + * the last cycle so the code can tell when the cycle has advanced. + */ + int d_old_cycle; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.C index 4d7190a0..7f1dd3db 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: StandardTagAndInitialize's implementation of PatchHierarchy * ************************************************************************/ - -#ifndef included_mesh_StandardTagAndInitializeConnectorWidthRequestor_C -#define included_mesh_StandardTagAndInitializeConnectorWidthRequestor_C - #include "SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h" #include "SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h" @@ -100,13 +96,13 @@ StandardTagAndInitializeConnectorWidthRequestor::computeRequiredConnectorWidths( * by which StandardTagAndInitialize may coarsen a level in the * hierarchy. It is the growth factor for ghost data. */ - tbox::Array ratios_to_coarser( + std::vector ratios_to_coarser( patch_hierarchy.getMaxNumberOfLevels(), - hier::IntVector(dim)); + hier::IntVector::getZero(dim)); for (int ln = 0; ln < patch_hierarchy.getMaxNumberOfLevels(); ++ln) { ratios_to_coarser[ln] = patch_hierarchy.getRatioToCoarserLevel(ln); - } + } int error_coarsen_ratio = computeCoarsenRatio(ratios_to_coarser); @@ -136,14 +132,15 @@ StandardTagAndInitializeConnectorWidthRequestor::computeRequiredConnectorWidths( int StandardTagAndInitializeConnectorWidthRequestor::computeCoarsenRatio( - const tbox::Array& ratios_to_coarser) const + const std::vector& ratios_to_coarser) const { const tbox::Dimension& dim(ratios_to_coarser[0].getDim()); + /* - * Compute GCD on first dimension of level 1 + * Compute GCD on first coordinate direction of level 1 */ int error_coarsen_ratio = 0; - int gcd_level1 = ratios_to_coarser[1](0); + int gcd_level1 = ratios_to_coarser[1](0,0); if ((gcd_level1 % 2) == 0) { error_coarsen_ratio = 2; } else if ((gcd_level1 % 3) == 0) { @@ -158,22 +155,21 @@ StandardTagAndInitializeConnectorWidthRequestor::computeCoarsenRatio( /* * Iterate through levels and check the coarsen ratios to make sure the - * error coarsen ratios computed in every dimension on every + * error coarsen ratios computed in every coordinate direction on every * level are between the supported 2 or 3, and that the error coarsen * ratios are constant over the hierarchy. */ - for (int ln = 1; ln < ratios_to_coarser.getSize(); ln++) { - - for (int d = 0; d < dim.getValue(); d++) { - int gcd = GCD(error_coarsen_ratio, ratios_to_coarser[ln](d)); + for (int ln = 1; ln < static_cast(ratios_to_coarser.size()); ++ln) { + for (int d = 0; d < dim.getValue(); ++d) { + int gcd = GCD(error_coarsen_ratio, ratios_to_coarser[ln](0,d)); if ((gcd % error_coarsen_ratio) != 0) { - gcd = ratios_to_coarser[ln](d); + gcd = ratios_to_coarser[ln](0,d); TBOX_ERROR( "StandardTagAndInitializeConnectorWidthRequestor::computeCoarsenRatio:\n" << "Unable to perform Richardson extrapolation because\n" << "the error coarsen ratio computed from the\n" << "ratios_to_coarser entries is not constant across all\n" - << "levels, in all dimensions, of the hierarchy. In\n" + << "levels, in all coordinate directions, of the hierarchy. In\n" << "order to use Richardson extrapolation, the minimum\n" << "divisor (> 1) of all the ratios_to_coarser entries must\n" << "be 2 -or- 3:\n" @@ -194,4 +190,3 @@ StandardTagAndInitializeConnectorWidthRequestor::computeCoarsenRatio( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h index 7ce8a547..8cd841fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: StandardTagAndInitialize's implementation of PatchHierarchy * ************************************************************************/ @@ -70,10 +70,13 @@ class StandardTagAndInitializeConnectorWidthRequestor: * @param[in] ratios_to_coarser Refinement ratios in a hierarchy. * @c ratios_to_coarser[ln] is the ratio between level ln and level * ln-1. + * + * @pre (ratios_to_coarser[1](0) % 2 == 0) || + * (ratios_to_coarser[1](0) % 3 == 0) */ int computeCoarsenRatio( - const tbox::Array& ratio_to_coarser) const; + const std::vector& ratios_to_coarser) const; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.C index 218fd6da..d8fbbd55 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for params, tagging, init for gridding. * ************************************************************************/ - -#ifndef included_mesh_TagAndInitializeStrategy_C -#define included_mesh_TagAndInitializeStrategy_C - #include "SAMRAI/mesh/TagAndInitializeStrategy.h" #include "SAMRAI/tbox/Utilities.h" @@ -21,9 +17,7 @@ namespace SAMRAI { namespace mesh { TagAndInitializeStrategy::TagAndInitializeStrategy( - const tbox::Dimension& dim, const std::string& object_name): - d_dim(dim), d_object_name(object_name) { } @@ -32,366 +26,5 @@ TagAndInitializeStrategy::~TagAndInitializeStrategy() { } -/* - ************************************************************************* - * - * Sets refine boxes for case where refine region is specified by the - * user. The bool return value specifies whether or not the refine - * boxes have been reset from the last time the method was called - * (true = they are reset, false = they have NOT changed). - * - * Note that if any method which invokes tagging is performed there - * is always potential that the boxes have changed so this method will - * always return true in this case. - * - ************************************************************************* - */ -bool -TagAndInitializeStrategy::getUserSuppliedRefineBoxes( - hier::BoxContainer& refine_boxes, - const int level_num, - const double time) -{ - TBOX_ASSERT(level_num >= 0); - TBOX_ASSERT(time >= 0.); - - /* - * The cycle counter and boolean array specifying whether times - * are used are initialially set based on inputs. There could be - * circumstances where a set of refine boxes is requested for a - * level number greater than the number of entries the user - * supplied in input. If this occurs, resize the cycle counter - * and boolean times arrays and set appropriate defaults to - * avoid logic errors elsewhere. - */ - if (level_num >= d_refine_boxes_cycle_counter.getSize()) { - - d_refine_boxes_times.resizeArray(level_num + 1); - d_refine_boxes_cycles.resizeArray(level_num + 1); - d_refine_boxes_use_times.resizeArray(level_num + 1); - d_refine_boxes_cycle_counter.resizeArray(level_num + 1); - d_refine_boxes_old_seq_num.resizeArray(level_num + 1); - - d_refine_boxes_times[level_num].resizeArray(1); - d_refine_boxes_cycles[level_num].resizeArray(1); - d_refine_boxes_times[level_num][0] = 0.; - d_refine_boxes_cycles[level_num][0] = 0; - d_refine_boxes_use_times[level_num] = false; - d_refine_boxes_cycle_counter[level_num] = 0; - d_refine_boxes_old_seq_num[level_num] = -1; - - } - - /* - * Increment step counter. - */ - d_refine_boxes_cycle_counter[level_num]++; - - /* - * Determine which sequence entry in the refine_boxes box array - * to use. - */ - int seq_num = 0; - if (d_refine_boxes_use_times[level_num]) { - - /* - * If we are using times, the user has supplied an array - * times = {time1, time2, ...} that corresponds with the - * refine box array boxes = {boxarr1, boxarr2, ...}. Pick - * the appropriate sequence number based on the specified - * time. - */ - for (int i = 0; i < d_refine_boxes_times[level_num].getSize(); - i++) { - if (time > d_refine_boxes_times[level_num][i]) seq_num = i; - } - } else { - - /* - * If we are using steps, the user has supplied an array - * cycles = {cycle1, cycle2, ...} that corresponds with the - * refine box array boxes = {boxarr1, boxarr2, ...}. Pick - * the appropriate seq number based on the counter. - */ - for (int i = 0; i < d_refine_boxes_cycles[level_num].getSize(); - i++) { - if (d_refine_boxes_cycle_counter[level_num] > - d_refine_boxes_cycles[level_num][i]) - seq_num = i; - } - } - - /* - * Print some warnings if the user-supplied entries will not - * generate any refined boxes for the level. - */ - hier::BoxContainer empty_boxes; - if ((d_refine_boxes.getSize() <= level_num) || - (d_refine_boxes[level_num][seq_num].size() == 0)) { - - TBOX_WARNING( - d_object_name << ": getRefineBoxes\n" - << "No refine boxes specified for level " - << level_num); - refine_boxes = empty_boxes; - - } else if (d_refine_boxes[level_num].getSize() <= seq_num) { - - if (d_refine_boxes_use_times[level_num]) { - TBOX_WARNING( - d_object_name << ": getRefineBoxes\n" - << "No refine boxes specified for time sequence " - << seq_num << " on level " << level_num - << ".\n No refinement will be performed."); - } else { - TBOX_WARNING( - d_object_name << ": getRefineBoxes\n" - << "No refine boxes specified for step sequence " - << seq_num << " on level " << level_num - << ".\n No refinement will be performed."); - } - refine_boxes = empty_boxes; - - } else { - - refine_boxes = d_refine_boxes[level_num][seq_num]; - - } - - /* - * If the user has requested their own particular set of refine - * boxes (i.e. by calling resetRefineBoxes()), overwrite any previously - * determined refine boxes with their requested set. - */ - bool use_reset = false; - if (d_refine_boxes_reset.getSize() > level_num) { - if (d_refine_boxes_reset[level_num]) { - use_reset = true; - refine_boxes = d_reset_refine_boxes[level_num]; - } - } - - /* - * If we have not moved to a new sequence number, or otherwise reset - * boxes from the last time this method was called, then we return - * "false", indicating boxes have NOT been reset. If we have reset - * the boxes, return "true". - */ - bool modified_refine_boxes; - if (!use_reset && d_refine_boxes_old_seq_num[level_num] == seq_num) { - modified_refine_boxes = false; - } else { - d_refine_boxes_old_seq_num[level_num] = seq_num; - modified_refine_boxes = true; - } - - /* - * If one of the tagging methods (e.g. gradient detector or - * Richardson extrapolation) is used, the boxes may be modified - * even if they have not been modified by user input. - */ - if (!refineUserBoxInputOnly()) modified_refine_boxes = true; - - return modified_refine_boxes; - -} - -/* - ************************************************************************* - * - * Resets refine boxes for specified level. - * - ************************************************************************* - */ - -void -TagAndInitializeStrategy::resetRefineBoxes( - const hier::BoxContainer& refine_boxes, - const int level_num) -{ - TBOX_ASSERT(level_num >= 0); - - int i = d_reset_refine_boxes.getSize(); - if (i <= level_num) { - d_reset_refine_boxes.resizeArray(level_num + 1); - d_refine_boxes_reset.resizeArray(level_num + 1); - for ( ; i < d_reset_refine_boxes.getSize(); ++i) { - d_refine_boxes_reset[i] = false; - } - } - - d_refine_boxes_reset[level_num] = true; - d_reset_refine_boxes[level_num] = refine_boxes; - -} - -/* - ************************************************************************* - * - * Read specified refinement boxes, if any. - * - ************************************************************************* - */ - -void -TagAndInitializeStrategy::getFromInput( - const boost::shared_ptr& db) -{ - TBOX_ASSERT(db); - - /* - * Read refine boxes. - */ - if (!db->keyExists("RefineBoxes")) { - TBOX_ERROR("If REFINE_BOXES is used as a tagging_method, you must\n" - << "provide a `RefineBoxes' database entry in the input\n" - << "to specify the level boxes to be refined. See header\n" - << "for TagAndInitializeStrategy class for \n" - << "discussion of the entry format." << std::endl); - } - boost::shared_ptr refine_box_db( - db->getDatabase("RefineBoxes")); - tbox::Array box_keys = refine_box_db->getAllKeys(); - int nkeys = box_keys.getSize(); - - d_refine_boxes.resizeArray(nkeys); - d_refine_boxes_cycles.resizeArray(nkeys); - d_refine_boxes_times.resizeArray(nkeys); - d_refine_boxes_use_times.resizeArray(nkeys); - d_refine_boxes_cycle_counter.resizeArray(nkeys); - d_refine_boxes_old_seq_num.resizeArray(nkeys); - - /* - * Do a check here to see if we are using the "old" version of input - * (i.e. v1.3.1 or before) which only allows you to specify a single - * set of refine boxes, or the "new" input format which allows you - * to specify a specified sequence of refine boxes. - */ - bool use_new_input = false; - for (int ln = 0; ln < nkeys; ln++) { - std::string level_boxes_name = "level_" + tbox::Utilities::intToString(ln); - if (refine_box_db->isDatabase(level_boxes_name)) { - use_new_input = true; - } - } - - for (int ln = 0; ln < nkeys; ln++) { - /* - * Set counter for each level to zero. - */ - d_refine_boxes_cycle_counter[ln] = 0; - - /* - * Set old sequence number to -1, assuring it will always - * interpret a new sequence at initialization, when the - * counter is zero. - */ - d_refine_boxes_old_seq_num[ln] = -1; - } - - if (use_new_input) { - /* - * We are using the updated input format that allows multiple - * sequence entries. - */ - for (int ln = 0; ln < nkeys; ln++) { - std::string level_boxes_name = "level_" + tbox::Utilities::intToString( - ln); - if (!refine_box_db->keyExists(level_boxes_name)) { - TBOX_ERROR( - d_object_name << "\n" - << ": Expected sub-database level entries in the\n" - << " 'RefineBoxes' database to specify boxes for\n" - << " different time or cycle sequences: \n" - << " e.g. Level0 { boxes_0 = \n" - << " boxes_1 = \n" - << " ...} \n" - << " Level1 { boxes_0 = \n" - << " ...} \n" - << "See header for this class for further discussion\n" - << "of the expected input format." - << std::endl); - } - boost::shared_ptr level_refine_box_db( - refine_box_db->getDatabase(level_boxes_name)); - - /* - * Read cycles. - */ - bool use_cycles = false; - if (level_refine_box_db->keyExists("cycles")) { - d_refine_boxes_cycles[ln] = - level_refine_box_db->getIntegerArray("cycles"); - use_cycles = true; - } else { - d_refine_boxes_cycles[ln].resizeArray(1); - d_refine_boxes_cycles[ln][0] = 0; - } - - /* - * Read times. - */ - if (level_refine_box_db->keyExists("times")) { - d_refine_boxes_use_times[ln] = true; - d_refine_boxes_times[ln] = - level_refine_box_db->getDoubleArray("times"); - if (use_cycles) { - TBOX_WARNING( - d_object_name << ": You have entries for " - << "both 'cycles' and 'times' for level " << ln - << ".\n Because 'times' takes precedence, the " - << "'cycles' entries will be ignored." << std::endl); - } - } else { - d_refine_boxes_times[ln].resizeArray(1); - d_refine_boxes_times[ln][0] = 0.; - d_refine_boxes_use_times[ln] = false; - } - - /* - * Use the size of the "cycles" or "times" arrays to govern - * how many boxes entries there may be. - */ - int max_seq = 1; - if (d_refine_boxes_use_times[ln]) { - max_seq = d_refine_boxes_times[ln].getSize(); - } else { - max_seq = d_refine_boxes_cycles[ln].getSize(); - } - d_refine_boxes[ln].resizeArray(max_seq); - - /* - * Read boxes. - */ - for (int i = 0; i < max_seq; i++) { - std::string boxes_name = "boxes_" + tbox::Utilities::intToString(i); - if (level_refine_box_db->keyExists(boxes_name)) { - d_refine_boxes[ln][i] = - level_refine_box_db->getDatabaseBoxArray(boxes_name); - } - } - - } // loop over levels - } else { - - for (int ln = 0; ln < nkeys; ln++) { - std::string level_boxes_name = "level_" + tbox::Utilities::intToString( - ln); - d_refine_boxes[ln].resizeArray(1); - d_refine_boxes_cycles[ln].resizeArray(1); - d_refine_boxes_times[ln].resizeArray(1); - - if (refine_box_db->keyExists(level_boxes_name)) { - d_refine_boxes[ln][0] = - refine_box_db->getDatabaseBoxArray(level_boxes_name); - } - d_refine_boxes_cycles[ln][0] = 0; - d_refine_boxes_times[ln][0] = 0.; - d_refine_boxes_use_times[ln] = false; - } - } // not using new input format -} - } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.h index 1f9b5910..60095ac2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TagAndInitializeStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface for params, tagging, init for gridding. * ************************************************************************/ @@ -16,9 +16,8 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/BoxLevel.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace mesh { @@ -27,101 +26,26 @@ namespace mesh { * Class TagAndInitializeStrategy is a base class that defines a * Strategy pattern interface for level initialization and cell tagging * routines that are needed by the adaptive meshing algorithms provided - * by the class GriddingAlgorithm. The class - * maintains functionality to construct refined regions based on a - * user-supplied set of boxes, but its main role is to provide interfaces - * for level initialization and cell tagging operations. + * by the class GriddingAlgorithm. The class defines an interface to + * construct refined regions based on a user-supplied set of boxes, but + * its main role is to provide interfaces for level initialization and + * cell tagging operations. * - * The operations that identify mesh cells for refinement or initialize - * data on a new hierarchy level are problem-specific and must be - * supplied by a concrete sub-class of this base class. + * All methods defined by this class with the exception of getObjectName are + * abstract and must be supplied by a concrete sub-class of this base class. * * If user supplied refine boxes are used, they may be supplied through - * input. Alternatively, they may be supplied through the "resetRefineBoxes()" - * method. If they are supplied through input, the format is as follows: - * - * - \b RefineBoxes - * input section describing the refine boxes for each level. - * - \b level_0 - * input section providing the hier::Box arrays - * describing where user-specified refinement is to occur on - * Level 0. - * - \b level_1 - * input section providing the hier::Box arrays - * describing where user-specified refinement is to occur on - * Level 1. - * \b . . . - * - \b level_n - * input section providing the hier::Box arrays - * describing where user-specified refinement is to occur on - * Level N. - * - * For each level, the input section can have the following entries: - * - * - \b times = optional entry, a double array specifying times - * at which a particular set of boxes is to be used - * as a region of refinement. - * - \b cycles = optional entry, an integer array specifying - * regrid cycles at which a particular set of boxes - * is to be used as a region of refinement. - * - \b boxes_0 = box array specifying refine boxes for element - * 0 of the times or cycles array. - * - \b boxes_1 = box array specifying refine boxes for element - * 1 of the times or cycles array. - * - \b boxes_n = box array specifying refine boxes for element - * n of the times or cycles array. - * - * The @b times and @b cycles entries are optional. If neither - * is provided, a uniform set of refine boxes specified in the - * boxes_0 entry will be used over the entire calculation. If no - * boxes_0 entry is provided, no refinement will occur on that level. - * - * If both @b times or @b cycles entries are supplied, the times entry - * takes precedence so the cycles entry is ignored. The particular - * box array chosen during regridding is determined by a ``greater-than'' - * convention. That is, if boxes are accessed at regridding time t, - * where t is greater-than the specified times[n] entry, then the array - * given for boxes_n is used. Otherwise, the corresponding previous - * box array that satisfies the criteria is used. The same convention is - * followed for regridding cycles. To avoid errant behavior, the times - * and cycles entries should always be supplied in increasing order. - * - * The hier::BoxContainer entries withing each level's input section - * must be of the form ``boxes_n'' (where n is the corresponds to the - * elements of the times or cycles array), or the input parser will - * ignore the entry. If there is no ``boxes_n'' entry corresponding - * to element n of the times or cycles array, then no refinement will - * occur on that level at the given time or cycle. - * - * A sample input file entry might look like: - * - * \verbatim - * - * RefineBoxes { - * level_0 { - * cycles = 0, 10 - * boxes_0 = [(5,5),(9,9)],[(12,15),(18,19)] - * boxes_1 = [(7,7),(11,11)],[(14,17),(20,21)] - * } - * level_1 { - * times = 0., 0.05, 0.10 - * boxes_0 = [(25,30),(29,35)] - * boxes_1 = [(30,35),(34,40)] - * boxes_2 = [(35,40),(39,45)] - * } - * level_2 { - * boxes_0 = [(60,70),(70,80)] - * } - * } - * \endverbatim + * input as defined by specific, concrete sub-classes of this base class. + * Alternatively, they may be supplied through the "resetRefineBoxes()" + * method. * * The virtual methods in this class may place constraints on the patch - * hierarchy by the particluar error estimation procedure in use. Those + * hierarchy by the particular error estimation procedure in use. Those * constraints and operations must be honored in the concrete subclass * implementations of these methods. The constraints are discussed in * the method descriptions below. * - * @see mesh::GriddingAlgorithm + * @see GriddingAlgorithm */ class TagAndInitializeStrategy @@ -131,7 +55,6 @@ class TagAndInitializeStrategy * Empty constructor for TagAndInitializeStrategy. */ TagAndInitializeStrategy( - const tbox::Dimension& dim, const std::string& object_name); /*! @@ -146,20 +69,21 @@ class TagAndInitializeStrategy * have been reset, it returns true. If they are unchanged, it returns * false. */ - bool + virtual bool getUserSuppliedRefineBoxes( hier::BoxContainer& refine_boxes, const int level_number, - const double time); + const int cycle, + const double time) = 0; /*! * Reset the static refine boxes for the specified level number in the * hierarchy. The level number must be greater than or equal to zero. */ - void + virtual void resetRefineBoxes( const hier::BoxContainer& refine_boxes, - const int level_number); + const int level_number) = 0; /*! * Initialize data on a new level after it is inserted into an AMR patch @@ -255,7 +179,8 @@ class TagAndInitializeStrategy tagCellsForRefinement( const boost::shared_ptr& hierarchy, const int level_number, - const double error_data_time, + const int regrid_cycle, + const double regrid_time, const int tag_index, const bool initial_time, const bool coarsest_sync_level, @@ -277,16 +202,27 @@ class TagAndInitializeStrategy preprocessErrorEstimation( const boost::shared_ptr& hierarchy, const int level_number, + const int cycle, const double regrid_time, const double regrid_start_time, const bool initial_time) = 0; /*! * Return true if regridding process advances the data using some time - * integration procedure; otherwise, return false. + * integration procedure at the supplied cycle or time; otherwise, return + * false. */ virtual bool - usesTimeIntegration() const = 0; + usesTimeIntegration( + int cycle, + double time) = 0; + + /*! + * Return true if regridding process advances the data using some time + * integration procedure at any cycle or time; otherwise, return false. + */ + virtual bool + everUsesTimeIntegration() const = 0; /*! * Return true if boxes for coarsest hierarchy level are not appropriate @@ -313,7 +249,7 @@ class TagAndInitializeStrategy */ virtual void checkCoarsenRatios( - const tbox::Array& ratio_to_coarser) = 0; + const std::vector& ratio_to_coarser) = 0; /*! * Return whether refinement is being performed using ONLY @@ -321,24 +257,9 @@ class TagAndInitializeStrategy * tagging, this will return false. */ virtual bool - refineUserBoxInputOnly() const = 0; - - /*! - * Read user supplied refine boxes from the provided database. The - * database must be non-null, or an unrecoverable assertion will be thrown. - */ - void - getFromInput( - const boost::shared_ptr& db); - - /*! - * Return the dimension of this object. - */ - const tbox::Dimension& - getDim() const - { - return d_dim; - } + refineUserBoxInputOnly( + int cycle, + double time) = 0; /*! * Returns the object name. @@ -349,43 +270,125 @@ class TagAndInitializeStrategy return d_object_name; } -private: - const tbox::Dimension d_dim; + /*! + * @brief Process a hierarchy before swapping old and new levels during + * regrid. + * + * During regrid, if user code needs to do any application-specific + * operations on the PatchHierarchy before a new level is added or + * an old level is swapped for a new level, this method provides a callback + * for the user to define such operations. The PatchHierarchy is provided + * in its state with the old level, if it exists, still in place, while + * new BoxLevel is also provided so that the user code can know the boxes + * that will make up the new level. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy being + * added or regridded. + * @param new_box_level BoxLevel containing the boxes for the new level + * + */ + virtual void + processHierarchyBeforeAddingNewLevel( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& new_box_level) = 0; - std::string d_object_name; + /*! + * @brief Process a level before it is removed from the hierarchy during + * regrid. + * + * In some cases user code may wish to process a PatchLevel before it is + * removed from the hierarchy. For example, data may exist only on a given + * PatchLevel such as the finest level. If that level were to be removed + * before this data is moved off of it then the data will be lost. This + * method is a user defined callback used by GriddingAlgorithm when a + * PatchLevel is to be removed. The callback performs any user actions on + * the level about to be removed. It is implemented by classes derived from + * StandardTagAndInitStrategy. + * + * @param hierarchy The PatchHierarchy being modified. + * @param level_number The number of the PatchLevel in hierarchy about to be + * removed. + * @param old_level The level in hierarchy about to be removed. + * + * @see GriddingAlgorithm + * @see StandardTagAndInitStrategy + */ + virtual void + processLevelBeforeRemoval( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& old_level = + boost::shared_ptr()) = 0; - /* - * Arrays of data for user-specified refinement. The user controls - * the particular boxes to be used for refinement by specifying - * "cycles" -or- "times" and "refine_boxes". The arrays below hold - * hold entries for each level and seq number. The boolean array - * specifies whether to use time or cycles as the guiding criteria - * (by default, time is used). The integer cycle counter holds - * internally the number of times the getRefineBoxes() method has - * been accessed for each level. + /*! + * @brief Check the tags on a tagged level. + * + * This virtual interface provides application code a callback that + * allows for checking the values held in user tag PatchData. The + * tag data will contain the tags created by application code in + * tagCellsForRefinement as well as any tags added internally by + * the GriddingAlgorithm (for example, buffering). + * + * A no-op implementation is provided so that only applications that + * want to use this method need to implement it. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the tagged level + * @param[in] regrid_cycle + * @param[in] regrid_time + * @param[in] tag_index Patch data index for user tags */ - tbox::Array > d_refine_boxes; - tbox::Array > d_refine_boxes_cycles; - tbox::Array > d_refine_boxes_times; - tbox::Array d_refine_boxes_use_times; - tbox::Array d_refine_boxes_cycle_counter; + virtual void + checkUserTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int regrid_cycle, + const double regrid_time, + const int tag_index) + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(regrid_cycle); + NULL_USE(regrid_time); + NULL_USE(tag_index); + } - /* - * Arrays to hold boxes that are specifically reset by the user (via the - * resetRefineBoxes() method). The boolean array specifies which levels - * have been reset while the box array specifies the new set of refine - * boxes for the level. The int array holds the sequence number from - * the last time getRefineBoxes() was called, allowing us to - * determine when refine boxes change between steps. + /*! + * @brief Check the tags on a newly-created level. + * + * This virtual interface provides application code a callback that + * allow for checking tag values that have been saved on a new level + * that has been created during initialization or regridding. The + * tag values will be the values of the user tags on the coarser level, + * constant-refined onto the cells of the new level. + * + * A no-op implementation is provided so that only applications that + * want to use this method need to implement it. + * + * @param[in] hierarchy + * @param[in] level_number Level number of the new level + * @param[in] tag_index Patch data index for the new tags. */ - tbox::Array d_refine_boxes_reset; - tbox::Array d_reset_refine_boxes; - tbox::Array d_refine_boxes_old_seq_num; + virtual void + checkNewLevelTagData( + const boost::shared_ptr& hierarchy, + const int level_number, + const int tag_index) + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(tag_index); + } + +private: + std::string d_object_name; // The following are not implemented: TagAndInitializeStrategy( const TagAndInitializeStrategy&); - void + TagAndInitializeStrategy& operator = ( const TagAndInitializeStrategy&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.C new file mode 100644 index 00000000..e62f7edf --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.C @@ -0,0 +1,1549 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Tile clustering algorithm. + * + ************************************************************************/ +#ifndef included_mesh_TileClustering_C +#define included_mesh_TileClustering_C + +#include + +#include "SAMRAI/mesh/TileClustering.h" + +#include "SAMRAI/hier/SequentialLocalIdGenerator.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/TimerManager.h" + +namespace SAMRAI { +namespace mesh { + +const std::string TileClustering::s_default_timer_prefix("mesh::TileClustering"); +std::map TileClustering::s_static_timers; + +int TileClustering::s_primary_mpi_tag = 1234; +int TileClustering::s_secondary_mpi_tag = 1235; +int TileClustering::s_first_data_length = 1000; + +/* + ************************************************************************ + ************************************************************************ + */ +TileClustering::TileClustering( + const tbox::Dimension& dim, + const boost::shared_ptr& input_db): + d_dim(dim), + d_tile_size(hier::IntVector(d_dim, 8)), + d_allow_remote_tile_extent(true), + d_coalesce_boxes(true), + d_coalesce_boxes_from_same_patch(true), + d_recursive_coalesce_limit(20), + d_debug_checks(false), + d_log_cluster_summary(false), + d_log_cluster(false), + d_barrier_and_time(false), + d_print_steps(false) +{ +#ifndef _OPENMP + l_outputs = 0; + l_interm = 0; +#endif + TBOX_omp_init_lock(&l_outputs); + TBOX_omp_init_lock(&l_interm); + getFromInput(input_db); + setTimerPrefix(s_default_timer_prefix); + d_oca.setTimerPrefix(s_default_timer_prefix); + d_mca.setTimerPrefix(s_default_timer_prefix); +} + +TileClustering::~TileClustering() +{ + TBOX_omp_destroy_lock(&l_outputs); + TBOX_omp_destroy_lock(&l_interm); +} + +void +TileClustering::getFromInput( + const boost::shared_ptr& input_db) +{ + if (input_db) { + + if (input_db->isInteger("tile_size")) { + input_db->getIntegerArray("tile_size", + &d_tile_size[0], + d_dim.getValue()); + } + + d_coalesce_boxes = + input_db->getBoolWithDefault("coalesce_boxes", + d_coalesce_boxes); + + d_coalesce_boxes_from_same_patch = + input_db->getBoolWithDefault("coalesce_boxes_from_same_patch", + d_coalesce_boxes_from_same_patch); + + d_allow_remote_tile_extent = + input_db->getBoolWithDefault("allow_remote_tile_extent", + d_allow_remote_tile_extent); + + d_barrier_and_time = + input_db->getBoolWithDefault("DEV_barrier_and_time", + d_barrier_and_time); + + d_recursive_coalesce_limit = + input_db->getIntegerWithDefault("DEV_recursive_coalesce_limit", + d_recursive_coalesce_limit); + + d_log_cluster = + input_db->getBoolWithDefault("DEV_log_cluster", + d_log_cluster); + + d_log_cluster_summary = + input_db->getBoolWithDefault("DEV_log_cluster_summary", + d_log_cluster_summary); + + d_print_steps = + input_db->getBoolWithDefault("DEV_print_steps", + d_print_steps); + + d_debug_checks = + input_db->getBoolWithDefault("DEV_debug_checks", + d_debug_checks); + } +} + +/* + ************************************************************************ + ************************************************************************ + */ +void +TileClustering::findBoxesContainingTags( + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, + const boost::shared_ptr& tag_level, + const int tag_data_index, + const int tag_val, + const hier::BoxContainer& bound_boxes, + const hier::IntVector& min_box, + const hier::IntVector& max_gcw) +{ + NULL_USE(min_box); + NULL_USE(max_gcw); + + TBOX_ASSERT(!bound_boxes.empty()); + TBOX_ASSERT_OBJDIM_EQUALITY4( + *tag_level, + *(bound_boxes.begin()), + min_box, + max_gcw); + + if (d_barrier_and_time) { + d_object_timers->t_find_boxes_containing_tags->barrierAndStart(); + } + + d_object_timers->t_cluster->start(); + d_object_timers->t_cluster_setup->start(); + + const hier::IntVector& zero_vector = hier::IntVector::getZero(tag_level->getDim()); + + for (hier::BoxContainer::const_iterator bb_itr = bound_boxes.begin(); + bb_itr != bound_boxes.end(); ++bb_itr) { + if (bb_itr->empty()) { + TBOX_ERROR("TileClustering: empty bounding box not allowed."); + } + } + + const hier::BoxLevel& tag_box_level = *tag_level->getBoxLevel(); + + new_box_level.reset(new hier::BoxLevel( + tag_box_level.getRefinementRatio(), + tag_box_level.getGridGeometry(), + tag_box_level.getMPI())); + + tag_to_new.reset(new hier::Connector(*tag_level->getBoxLevel(), + *new_box_level, + zero_vector)); + hier::Connector* new_to_tag = new hier::Connector( + *new_box_level, + *tag_level->getBoxLevel(), + zero_vector); + tag_to_new->setTranspose(new_to_tag, true); + + tag_box_level.getBoxes().makeTree(tag_box_level.getGridGeometry().get()); + + d_object_timers->t_cluster_setup->stop(); + + int tiles_have_remote_extent = 0; + + if (d_allow_remote_tile_extent) { + + clusterWholeTiles( + *new_box_level, + tag_to_new, + tiles_have_remote_extent, + tag_level, + bound_boxes, + tag_data_index, + tag_val); + + if (new_box_level->getMPI().getSize() > 1) { + new_box_level->getMPI().AllReduce(&tiles_have_remote_extent, 1, MPI_MAX); + } + + if (tiles_have_remote_extent) { + detectSemilocalEdges(tag_to_new); + /* + * Remove duplicated new tiles. For each set of coinciding tiles, + * determine the process with the greatest tag overlap and keep only + * the copy from that process. Discard the others. + */ + removeDuplicateTiles(*new_box_level, *tag_to_new); + } + + shearTilesAtBlockBoundaries(*new_box_level, *tag_to_new); + + if (d_debug_checks) { + + tag_to_new->assertConsistencyWithBase(); + tag_to_new->assertConsistencyWithHead(); + tag_to_new->assertOverlapCorrectness(); + tag_to_new->getTranspose().assertConsistencyWithBase(); + tag_to_new->getTranspose().assertConsistencyWithHead(); + tag_to_new->getTranspose().assertOverlapCorrectness(); + tag_to_new->assertTransposeCorrectness(tag_to_new->getTranspose()); + + // There should be no overlaps. + hier::BoxContainer visible_tiles(true); + tag_to_new->getLocalNeighbors(visible_tiles); + visible_tiles.makeTree(tag_to_new->getBase().getGridGeometry().get()); + for (hier::BoxContainer::const_iterator bi = visible_tiles.begin(); + bi != visible_tiles.end(); ++bi) { + const hier::Box& tile = *bi; + hier::BoxContainer overlaps; + visible_tiles.findOverlapBoxes(overlaps, tile, + tag_to_new->getBase().getRefinementRatio(), + true); + TBOX_ASSERT(overlaps.size() == 1); + TBOX_ASSERT(overlaps.front().isIdEqual(tile)); + TBOX_ASSERT(overlaps.front().isSpatiallyEqual(tile)); + } + + } + + } else { + + clusterWithinProcessBoundaries( + *new_box_level, + *tag_to_new, + tag_level, + bound_boxes, + tag_data_index, + tag_val); + + } + + if (d_coalesce_boxes) { + + if (d_print_steps) { + tbox::plog << "TileClustering::findBoxesContainingTags: coalescing." << std::endl; + } + + coalesceClusters(*new_box_level, tag_to_new, tiles_have_remote_extent); + if (d_debug_checks) { + + tag_to_new->assertConsistencyWithBase(); + tag_to_new->assertConsistencyWithHead(); + tag_to_new->assertOverlapCorrectness(); + tag_to_new->getTranspose().assertConsistencyWithBase(); + tag_to_new->getTranspose().assertConsistencyWithHead(); + tag_to_new->getTranspose().assertOverlapCorrectness(); + tag_to_new->assertTransposeCorrectness(tag_to_new->getTranspose()); + + // There should be no overlaps. + hier::BoxContainer visible_tiles(true); + tag_to_new->getLocalNeighbors(visible_tiles); + visible_tiles.makeTree(tag_to_new->getBase().getGridGeometry().get()); + for (hier::BoxContainer::const_iterator bi = visible_tiles.begin(); + bi != visible_tiles.end(); ++bi) { + const hier::Box& tile = *bi; + hier::BoxContainer overlaps; + visible_tiles.findOverlapBoxes(overlaps, tile, + tag_to_new->getBase().getRefinementRatio(), + true); + TBOX_ASSERT(overlaps.size() == 1); + TBOX_ASSERT(overlaps.front().isIdEqual(tile)); + TBOX_ASSERT(overlaps.front().isSpatiallyEqual(tile)); + } + + } + } + + d_object_timers->t_cluster->barrierAndStop(); + + /* + * Get some global parameters. Do it before logging to prevent the + * logging flag from having a side-effect on performance timers. + */ + + d_object_timers->t_cluster_wrapup->start(); + + if (d_barrier_and_time) { + d_object_timers->t_global_reductions->start(); + } + new_box_level->getGlobalNumberOfBoxes(); + new_box_level->getGlobalNumberOfCells(); + if (d_barrier_and_time) { + d_object_timers->t_global_reductions->barrierAndStop(); + } + + if (d_log_cluster) { + tbox::plog << "TileClustering cluster log:\n" + << "\tNew box_level clustered by TileClustering:\n" << new_box_level->format( + "\t\t", + 2) + << "\tTileClustering tag_to_new:\n" << tag_to_new->format("\t\t", 2) + << "\tTileClustering new_to_tag:\n" << tag_to_new->getTranspose().format("\t\t", 2); + } + if (d_log_cluster_summary) { + /* + * Log summary of clustering. + */ + tbox::plog << "TileClustering summary:\n" + << "\tClustered with tile_size = " << d_tile_size << '\n'; + + for (hier::BoxContainer::const_iterator bi = bound_boxes.begin(); + bi != bound_boxes.end(); ++bi) { + const hier::BlockId& bid = bi->getBlockId(); + tbox::plog << "\tBlock " << static_cast(bid.getBlockValue()) + << " initial bounding box = " << *bi << ", " + << bi->size() << " cells, " + << "final global bounding box = " + << new_box_level->getGlobalBoundingBox(bid) + << ", " + << new_box_level->getGlobalBoundingBox(bid).size() + << " cells.\n\t"; + } + + tbox::plog << "Final output has " + << new_box_level->getGlobalNumberOfCells() + << " global cells [" << new_box_level->getMinNumberOfCells() + << "-" << new_box_level->getMaxNumberOfCells() << "], " + << new_box_level->getGlobalNumberOfBoxes() + << " global mapped boxes [" << new_box_level->getMinNumberOfBoxes() + << "-" << new_box_level->getMaxNumberOfBoxes() << "]\n" + << "\tTileClustering new_level summary:\n" << new_box_level->format("\t\t", 0) + << "\tTileClustering new_level statistics:\n" << new_box_level->formatStatistics( + "\t\t") + << "\tTileClustering new_to_tag summary:\n" << tag_to_new->getTranspose().format( + "\t\t", + 0) + << "\tTileClustering new_to_tag statistics:\n" + << tag_to_new->getTranspose().formatStatistics("\t\t") + << "\tTileClustering tag_to_new summary:\n" << tag_to_new->format("\t\t", 0) + << "\tTileClustering tag_to_new statistics:\n" << tag_to_new->formatStatistics( + "\t\t") + << "\n"; + } + + d_object_timers->t_cluster_wrapup->stop(); + + if (d_debug_checks) { + + tag_to_new->assertConsistencyWithBase(); + tag_to_new->assertConsistencyWithHead(); + tag_to_new->assertOverlapCorrectness(); + tag_to_new->getTranspose().assertConsistencyWithBase(); + tag_to_new->getTranspose().assertConsistencyWithHead(); + tag_to_new->getTranspose().assertOverlapCorrectness(); + tag_to_new->assertTransposeCorrectness(tag_to_new->getTranspose()); + + // There should be no overlaps. + hier::BoxContainer visible_tiles(true); + tag_to_new->getLocalNeighbors(visible_tiles); + visible_tiles.makeTree(tag_to_new->getBase().getGridGeometry().get()); + for (hier::BoxContainer::const_iterator bi = visible_tiles.begin(); + bi != visible_tiles.end(); ++bi) { + const hier::Box& tile = *bi; + hier::BoxContainer overlaps; + visible_tiles.findOverlapBoxes(overlaps, tile, + tag_to_new->getBase().getRefinementRatio(), + true); + TBOX_ASSERT(overlaps.size() == 1); + TBOX_ASSERT(overlaps.front().isIdEqual(tile)); + TBOX_ASSERT(overlaps.front().isSpatiallyEqual(tile)); + } + + } + + if (d_barrier_and_time) { + d_object_timers->t_find_boxes_containing_tags->barrierAndStop(); + } +} + +/* + *********************************************************************** + * Cluster tags into tiles, but limit tiles to lie within local process + * boundaries, so that no tiles extend past process boundaries. + *********************************************************************** + */ +void +TileClustering::clusterWithinProcessBoundaries( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_tile, + const boost::shared_ptr& tag_level, + const hier::BoxContainer& bound_boxes, + int tag_data_index, + int tag_val) +{ + d_object_timers->t_cluster_local->start(); + + // Determine max number of tiles any local patch can generate. + int max_tiles_for_any_patch = 0; + for (int pi = 0; pi < tag_level->getLocalNumberOfPatches(); ++pi) { + hier::Box coarsened_box = tag_level->getPatch(pi)->getBox(); + coarsened_box.coarsen(d_tile_size); + hier::IntVector number_tiles = coarsened_box.numberCells(); + number_tiles *= 3; // Possible merging of smaller tiles on either side of it. + max_tiles_for_any_patch = tbox::MathUtilities::Max( + max_tiles_for_any_patch, static_cast(number_tiles.getProduct())); + } + + hier::Connector& tile_to_tag = tag_to_tile.getTranspose(); + + /* + * Generate new_box_level and Connectors + */ +#ifdef _OPENMP +#pragma omp parallel if ( tag_level->getLocalNumberOfPatches() > 4*omp_get_max_threads() ) +#pragma omp for schedule(dynamic) +#endif + for (int pi = 0; pi < tag_level->getLocalNumberOfPatches(); ++pi) { + + hier::Patch& patch = *tag_level->getPatch(pi); + const hier::Box& patch_box = patch.getBox(); + const hier::BlockId& block_id = patch_box.getBlockId(); + + TBOX_ASSERT(bound_boxes.begin(block_id) != bound_boxes.end(block_id)); + const hier::Box& bounding_box = *bound_boxes.begin(block_id); + + if (patch.getBox().intersects(bounding_box)) { + + boost::shared_ptr > tag_data( + BOOST_CAST, hier::PatchData>(patch.getPatchData(tag_data_index))); + + hier::BoxContainer tiles; + int num_coarse_tags = + findTilesContainingTags(tiles, *tag_data, tag_val, + pi * max_tiles_for_any_patch); + + if (d_print_steps) { + tbox::plog << "Tile Clustering generated " << tiles.size() + << " clusters from " << num_coarse_tags + << " in patch " << patch.getBox().getBoxId() << '\n'; + } + + TBOX_omp_set_lock(&l_outputs); + for (hier::BoxContainer::iterator bi = tiles.begin(); bi != tiles.end(); ++bi) { + new_box_level.addBoxWithoutUpdate(*bi); + tile_to_tag.insertLocalNeighbor(patch_box, bi->getBoxId()); + tag_to_tile.insertLocalNeighbor(*bi, patch_box.getBoxId()); + } + TBOX_omp_unset_lock(&l_outputs); + + } // Patch is in bounding box + + } // Loop through tag level + + new_box_level.finalize(); + + d_object_timers->t_cluster_local->stop(); +} + +/* + *********************************************************************** + * Cluster tags into whole tiles. The tiles are not cut up, even where + * they cross process boundaries or level boundaries. + * + * This requires tag<==>tag to have a width of at least the tile size, + * but it doesn't require any communication. + * + * Any tile with a local tag will be added locally. If tile crosses + * patch boundaries, this method does not detect overlaps with remote + * tag boxes. If the tile has tags on multiple patches, the tile will + * be duplicated (with different BoxIds). tile--->tag will be complete + * (using info from tag--->tag), but tag--->tile will have missing + * edges. Missing edges and tile duplication must be corrected by a + * postprocessing step after this method. See detectSemilocalEdges() + * and removeDuplicateTiles(). + * + * This method does no communication. + * + * TODO: The algorithm used can produce boxes violating mininum patch + * size if the minimum patch size is bigger than the refinement ratio. + * This happens when there is a tile boundary within 1 coarse cell of + * the domain boundary. The box generated would be tile-sized, but + * when it's sheared off at the boundary (see + * shearTilesAtBlockBoundaries()), it would be 1 coarse-cell wide. If + * the minimum patch size is set larger than the refinement ratio then + * the 1 coarse-cell box would end up violating minimum box size. + *********************************************************************** + */ +void +TileClustering::clusterWholeTiles( + hier::BoxLevel& tile_box_level, + boost::shared_ptr& tag_to_tile, + int& local_tiles_have_remote_extent, + const boost::shared_ptr& tag_level, + const hier::BoxContainer& bound_boxes, + int tag_data_index, + int tag_val) +{ + d_object_timers->t_cluster_local->start(); + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: entered." << std::endl; + } + + const hier::BoxLevel& tag_box_level = *tag_level->getBoxLevel(); + // Possible bug: TileClustering should register a ConnectorWidthRequestorStrategy + // to make sure it can find a Connector with sufficient width without implicitly + // creating one. + const hier::Connector& tag_to_tag = tag_box_level.findConnector( + tag_box_level, + d_tile_size - hier::IntVector::getOne(d_dim), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, true); + + hier::BoxContainer visible_tag_boxes(true); // Ordering is precondition for removePeriodicImageBoxes. + tag_to_tag.getLocalNeighbors(visible_tag_boxes); + visible_tag_boxes.removePeriodicImageBoxes(); + visible_tag_boxes.makeTree(tag_box_level.getGridGeometry().get()); + + hier::Connector& tile_to_tag = tag_to_tile->getTranspose(); + + hier::SequentialLocalIdGenerator id_gen; + + /* + * Generate tile_box_level. To reduce box count and box aspect + * ratios, coalesce tiles associated with the same tag box (if + * coalescing is enabled). But don't coalesce tiles that are + * overlap multiple tag boxes, because they may have duplicates + * from other patches (which is resolved later). + */ + + local_tiles_have_remote_extent = 0; + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: creating whole tiles\n"; + } + + for (int pi = 0; pi < tag_level->getLocalNumberOfPatches(); ++pi) { + + hier::Patch& patch = *tag_level->getPatch(pi); + const hier::Box& patch_box = patch.getBox(); + const hier::BlockId& block_id = patch_box.getBlockId(); + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: working patch " << patch_box << "\n"; + } + + TBOX_ASSERT(bound_boxes.begin(block_id) != bound_boxes.end(block_id)); + const hier::Box& bounding_box = *bound_boxes.begin(block_id); + + if (!patch.getBox().intersects(bounding_box)) { + continue; + } + + boost::shared_ptr > tag_data( + BOOST_CAST, hier::PatchData>(patch.getPatchData(tag_data_index))); + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: making coarsened tags." << std::endl; + } + + boost::shared_ptr > coarsened_tag_data = + makeCoarsenedTagData(*tag_data, tag_val); + + const hier::Box& coarsened_tag_box = coarsened_tag_data->getBox(); + const size_t num_coarse_cells = coarsened_tag_box.size(); + + hier::BoxContainer coalescibles; // Hold space for coalescible tiles. + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: processing coarsened tags." << std::endl; + } + + for (size_t coarse_offset = 0; coarse_offset < num_coarse_cells; ++coarse_offset) { + const pdat::CellIndex coarse_cell_index(coarsened_tag_box.index(coarse_offset)); + + if ((*coarsened_tag_data)(coarse_cell_index) == tag_val) { + + hier::Box whole_tile(coarse_cell_index, coarse_cell_index, + patch_box.getBlockId()); + whole_tile.refine(d_tile_size); + + hier::BoxContainer overlapping_tag_boxes; + visible_tag_boxes.findOverlapBoxes(overlapping_tag_boxes, + whole_tile, + tag_box_level.getRefinementRatio()); + + // Leave overlapping multiple patches to be resolved by removeDuplicateTiles. + // Other tiles mby be coalesced. + if (overlapping_tag_boxes.size() == 1) { + coalescibles.pushBack(whole_tile); + } else { + + whole_tile.initialize(whole_tile, id_gen.nextValue(), + patch_box.getOwnerRank()); + tile_box_level.addBox(whole_tile); + + for (hier::BoxContainer::iterator bi = overlapping_tag_boxes.begin(); + bi != overlapping_tag_boxes.end(); ++bi) { + + tile_to_tag.insertLocalNeighbor(*bi, whole_tile.getBoxId()); + if (bi->getOwnerRank() == whole_tile.getOwnerRank()) { + tag_to_tile->insertLocalNeighbor(whole_tile, bi->getBoxId()); + } + + local_tiles_have_remote_extent |= bi->getOwnerRank() != patch_box.getOwnerRank(); + } + + std::set owners; + overlapping_tag_boxes.getOwners(owners); + if (owners.size() > 1 || *owners.begin() != patch_box.getOwnerRank()) { + local_tiles_have_remote_extent = true; + } + + } + + } + + } + + if (d_coalesce_boxes_from_same_patch && !coalescibles.empty()) { + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: coalesce tiles." << std::endl; + } + d_object_timers->t_coalesce->start(); + coalesceBoxes(coalescibles); + d_object_timers->t_coalesce->stop(); + } + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: creating tiles from coalescibles." + << std::endl; + } + for (hier::BoxContainer::iterator bi = coalescibles.begin(); + bi != coalescibles.end(); ++bi) { + + hier::Box& tile = *bi; + tile.initialize(tile, id_gen.nextValue(), patch_box.getOwnerRank()); + tile_box_level.addBox(tile); + + hier::BoxContainer overlapping_tag_boxes; + visible_tag_boxes.findOverlapBoxes(overlapping_tag_boxes, + tile, + tag_box_level.getRefinementRatio()); + + for (hier::BoxContainer::iterator bi = overlapping_tag_boxes.begin(); + bi != overlapping_tag_boxes.end(); ++bi) { + + tile_to_tag.insertLocalNeighbor(*bi, tile.getBoxId()); + if (bi->getOwnerRank() == tile.getOwnerRank()) { + tag_to_tile->insertLocalNeighbor(tile, bi->getBoxId()); + } + + } + + } + + } // Loop through tag level + + tile_box_level.finalize(); + + if (d_print_steps) { + tbox::plog << "TileClustering::clusterWholeTiles: leaving." << std::endl; + } + + d_object_timers->t_cluster_local->stop(); +} + +/* + *********************************************************************** + * Methods clusterWholeTiles() and detectSemilocalEdges(), preceding + * this one in execution order, may generate duplicate tiles when a + * tile crosses any tag box boundary. This methods removes the + * duplicates. + * + * This method does no communication. + *********************************************************************** + */ +void +TileClustering::removeDuplicateTiles( + hier::BoxLevel& tile_box_level, + hier::Connector& tag_to_tile) +{ + + if (d_print_steps) { + tbox::plog << "TileClustering::removeDuplicateTiles: entered." << std::endl; + } + + hier::Connector& tile_to_tag = tag_to_tile.getTranspose(); + + /* + * Get tiles_crossing_patch_boundaries. These are + * - local tiles with multiple tag neighbors, and + * - remote tiles visible locally (found by detectSemilocalEdges) + * + * The latter may not have multiple local tag neighbors. + */ + + hier::BoxContainer visible_tiles(true); + tag_to_tile.getLocalNeighbors(visible_tiles); + + hier::BoxContainer tiles_crossing_patch_boundaries; + for (hier::BoxContainer::const_iterator ti = visible_tiles.begin(); + ti != visible_tiles.end(); ++ti) { + const hier::Box& tile(*ti); + if (tile.getOwnerRank() != tile_to_tag.getMPI().getRank() || + tile_to_tag.numLocalNeighbors(tile.getBoxId()) > 1) { + tiles_crossing_patch_boundaries.pushBack(tile); + } + } + visible_tiles.clear(); // No longer needed. + + // Chosen tiles among all the duplicate tiles. + std::vector chosen_tiles; + // Map from a duplicate tile to (index of) the chosen tile. + std::map changes; + + /* + * Look for similar_tiles (tiles with same extents) and choose one + * from each group of similars. Chose the first in the group. + * Because similar_tiles are sorted, we are arbitrarily choosing + * the first in sorted order. An alternative is to choose one from + * the process with most overlap. + */ + while (!tiles_crossing_patch_boundaries.empty()) { + + hier::BoxContainer similar_tiles(tiles_crossing_patch_boundaries.front(), true); + tiles_crossing_patch_boundaries.popFront(); + + /* + * Search for tiles with same extent as the first one in + * similar_tiles. If the O(N) search for duplicates is too + * slow, it can be replaced by ordering the tiles by the lower + * corner and doing an O(lg N) search. + */ + for (hier::BoxContainer::iterator bi = tiles_crossing_patch_boundaries.begin(); + bi != tiles_crossing_patch_boundaries.end(); /* incremented in loop */) { + if (bi->isSpatiallyEqual(similar_tiles.front())) { + similar_tiles.insert(*bi); + changes[bi->getBoxId()] = chosen_tiles.size(); + tiles_crossing_patch_boundaries.erase(bi++); + } else { + ++bi; + } + } + + if (similar_tiles.size() > 1) { + chosen_tiles.push_back(*similar_tiles.begin()); + } + + } + + /* + * Change tile_box_level and Connectors based on the change map. + */ + + for (hier::BoxContainer::const_iterator tile_itr = tile_box_level.getBoxes().begin(); + tile_itr != tile_box_level.getBoxes().end(); /* incremented in loop */) { + + const hier::Box& possibly_duplicated_tile(*tile_itr); + + std::map::const_iterator chosen_box_itr = + changes.find(possibly_duplicated_tile.getBoxId()); + + if (chosen_box_itr != changes.end() && + !chosen_tiles[chosen_box_itr->second].isIdEqual(possibly_duplicated_tile)) { + + const hier::Box& unique_tile = chosen_tiles[chosen_box_itr->second]; + + // Add unique_tile if it's local. + if (unique_tile.getOwnerRank() == tile_box_level.getMPI().getRank()) { + tile_box_level.addBoxWithoutUpdate(unique_tile); + hier::Connector::ConstNeighborhoodIterator neighborhood = + tile_to_tag.find(possibly_duplicated_tile.getBoxId()); + for (hier::Connector::ConstNeighborIterator na = tile_to_tag.begin(neighborhood); + na != tile_to_tag.end(neighborhood); ++na) { + tile_to_tag.insertLocalNeighbor(*na, unique_tile.getBoxId()); + } + } + + // Remove duplicated tile. + tile_to_tag.eraseLocalNeighborhood(tile_itr->getBoxId()); + tile_box_level.eraseBoxWithoutUpdate(*(tile_itr++)); + + } else { + ++tile_itr; + } + + } + tile_box_level.finalize(); + tag_to_tile.setHead(tile_box_level, true); + tile_to_tag.setBase(tile_box_level, true); + tile_box_level.deallocateGlobalizedVersion(); + + for (hier::Connector::ConstNeighborhoodIterator ni = tag_to_tile.begin(); + ni != tag_to_tile.end(); ++ni) { + + for (hier::Connector::ConstNeighborIterator na = tag_to_tile.begin(ni); + na != tag_to_tile.end(ni); /* incremented in loop */) { + + std::map::const_iterator chosen_box_itr = + changes.find(na->getBoxId()); + + if (chosen_box_itr != changes.end()) { + tag_to_tile.insertLocalNeighbor(chosen_tiles[chosen_box_itr->second], *ni); + tag_to_tile.eraseNeighbor(*(na++), *ni); + } else { + ++na; + } + + } + } + + if (d_print_steps) { + tbox::plog << "TileClustering::removeDuplicateTiles: leaving." << std::endl; + } +} + +/* + *********************************************************************** + * Detect semilocal edges missing from the outputs of + * clusterWholeTiles(). + * + * Methods clusterWholeTiles(), preceding this one in execution order, + * may generate tile extending past local tag boxes. It doesn't + * generate any semilocal edges because it is a completely local + * algorithm. This method generates the missing semilocal edges. + * + * On entry, tile_to_tag must be complete, but tag_to_tile may be + * missing semilocal edges. On exit, both would be complete overlap + * Connectors. + * + * This method does a bridge communication. + *********************************************************************** + */ +void +TileClustering::detectSemilocalEdges( + boost::shared_ptr& tag_to_tile) +{ + + if (d_print_steps) { + tbox::plog << "TileClustering::detectSemilocalEdges: entered." << std::endl; + } + + const hier::BoxLevel& tag_box_level = tag_to_tile->getBase(); + hier::Connector tag_to_tag = tag_box_level.findConnector( + tag_box_level, + d_tile_size - hier::IntVector::getOne(d_dim), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, true); + /* + * We don't want to introduce periodic relationships yet, so remove + * them from the tag<==>tag leg of the bridge. tag_to_tag doesn't + * point to itself as its own transpose, but it could and should, + * and used to. + */ + tag_to_tag.removePeriodicRelationships(); + tag_to_tag.getTranspose().removePeriodicRelationships(); + + /* + * Bridge tag<==>tag<==>new to get the complete tag<==>new. + * Currently, tag boxes don't know about any remote new boxes that + * may overlap them. + * + * Note: Bridging is convenient but overkill. We can get same + * information with much lighter weight communication and no + * communication at all where no tiles cross process boundaries. + */ + d_oca.bridge(tag_to_tile, + tag_to_tag, + hier::Connector(*tag_to_tile), + hier::IntVector::getZero(d_dim), + true /* compute transpose */); + + if (d_print_steps) { + tbox::plog << "TileClustering::detectSemilocalEdges: leaving." << std::endl; + } +} + +/* + *********************************************************************** + * Shear tiles at tag level block boundaries. + * Remove interblock neighbors. + * Fix Connectors. + *********************************************************************** + */ +void +TileClustering::shearTilesAtBlockBoundaries( + hier::BoxLevel& tile_box_level, + hier::Connector& tag_to_tile) +{ + + if (d_print_steps) { + tbox::plog << "TileClustering::shearTilesAtBlockBoundaries: entered." << std::endl; + } + const hier::BoxContainer& tiles = tile_box_level.getBoxes(); + const hier::BoxLevel& tag_box_level = tag_to_tile.getBase(); + hier::Connector& tile_to_tag = tag_to_tile.getTranspose(); + + const boost::shared_ptr& grid_geom = + tag_box_level.getGridGeometry(); + + hier::LocalId last_used_id = tile_box_level.getLastLocalId(); + + std::map domain_blocks; + + // Map from changed tiles to their replacements. + std::map changes; + + hier::BoxLevel sheared_tile_box_level(tile_box_level.getRefinementRatio(), + tile_box_level.getGridGeometry()); + hier::MappingConnector tile_to_sheared(tile_box_level, + sheared_tile_box_level, + hier::IntVector::getZero(d_dim)); + + for (hier::BoxContainer::const_iterator ti = tiles.begin(); + ti != tiles.end(); ++ti) { + + const hier::Box tile = *ti; + + hier::BoxContainer& block_boxes = domain_blocks[tile.getBlockId()]; + if (block_boxes.empty()) { + grid_geom->computePhysicalDomain(block_boxes, + tile_box_level.getRefinementRatio(), + tile.getBlockId()); + block_boxes.makeTree(); + } + + hier::BoxContainer& inside_block = changes[tile.getLocalId()]; + inside_block.pushFront(tile); + inside_block.intersectBoxes(block_boxes); + + if (inside_block.front().isSpatiallyEqual(tile)) { + // No change to this tile. + TBOX_ASSERT(inside_block.size() == 1); + TBOX_ASSERT(inside_block.front().isIdEqual(tile)); + changes.erase(tile.getLocalId()); + sheared_tile_box_level.addBoxWithoutUpdate(tile); + } else { + inside_block.coalesce(); + hier::BoxContainer tag_neighbors; + tile_to_tag.getNeighborBoxes(tile.getBoxId(), tag_neighbors); + for (hier::BoxContainer::iterator ii = inside_block.begin(); + ii != inside_block.end(); ++ii) { + ii->setLocalId(++last_used_id); + tile_box_level.addBoxWithoutUpdate(*ii); + tile_to_sheared.insertNeighbors(inside_block, tile.getBoxId()); + } + } + + } + + sheared_tile_box_level.finalize(); + tile_box_level.deallocateGlobalizedVersion(); + + if (d_print_steps) { + tbox::plog << "TileClustering::shearTilesAtBlockBoundaries applying shearing map." + << std::endl; + } + + d_mca.modify(tag_to_tile, + tile_to_sheared, + &tile_box_level, + &sheared_tile_box_level); + + if (d_print_steps) { + tbox::plog << "TileClustering::shearTilesAtBlockBoundaries leaving." << std::endl; + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +int +TileClustering::findTilesContainingTags( + hier::BoxContainer& tiles, + const pdat::CellData& tag_data, + int tag_val, + int first_tile_index) +{ + tiles.clear(); + tiles.unorder(); + + hier::Box coarsened_box(tag_data.getBox()); + coarsened_box.coarsen(d_tile_size); + + const size_t num_coarse_cells = coarsened_box.size(); + +#ifdef _OPENMP +#pragma omp parallel +#pragma omp for schedule(dynamic) +#endif + for (size_t coarse_offset = 0; coarse_offset < num_coarse_cells; ++coarse_offset) { + const pdat::CellIndex coarse_cell_index(coarsened_box.index(coarse_offset)); + + /* + * Set the tile extent to cover the coarse cell and intersect + * with tag box to make it nest in the tag box. If any part + * extends outside local tag boxes, (1) the tile might + * overlap with remote clusters, (2) its overlap with remote + * tag boxes might not be detected and (3) it may extend + * outside the tag level. Tiles extending past non-local tag + * boxes can appear if the tag level patch boundaries do not + * coincide with the tile cuts. + */ + hier::Box tile_box(coarse_cell_index, coarse_cell_index, coarsened_box.getBlockId()); + tile_box.refine(d_tile_size); + tile_box *= tag_data.getBox(); + + /* + * Loop through fine cells in tile_box. If any is tagged, + * tile_box will be used as a cluster. + */ + pdat::CellIterator finecend(pdat::CellGeometry::end(tile_box)); + for (pdat::CellIterator fineci(pdat::CellGeometry::begin(tile_box)); + fineci != finecend; ++fineci) { + if (tag_data(*fineci) == tag_val) { + /* + * Make a cluster from tile_box. + * Choose a LocalId that is independent of ordering so that + * results are independent of multi-threading. + */ + hier::LocalId local_id(first_tile_index + static_cast(coarse_offset)); + if (local_id < hier::LocalId::getZero()) { + TBOX_ERROR("TileClustering code cannot compute a valid non-zero\n" + << "LocalId for a tile.\n"); + } + + tile_box.initialize(tile_box, + local_id, + coarsened_box.getOwnerRank()); + TBOX_omp_set_lock(&l_interm); + tiles.pushBack(tile_box); + TBOX_omp_unset_lock(&l_interm); + + break; + } + + } // Loop through fine cells in the tile. + + } // Loop through coarse cells (tiles). + + const int num_coarse_tags = tiles.size(); + + tiles.order(); + + if (d_coalesce_boxes_from_same_patch && !tiles.empty()) { + hier::LocalId last_used_id = tiles.back().getLocalId(); + // Coalesce the tiles in this patch and assign ids if they changed. + hier::BoxContainer unordered_tiles(tiles.begin(), tiles.end(), false); + coalesceBoxes(unordered_tiles); + if (unordered_tiles.size() != num_coarse_tags) { + tiles.clear(); + tiles.order(); + for (hier::BoxContainer::iterator bi = unordered_tiles.begin(); + bi != unordered_tiles.end(); + ++bi) { + bi->setLocalId(++last_used_id); + tiles.insert(*bi); + } + } + } + + return num_coarse_tags; +} + +/* + *********************************************************************** + *********************************************************************** + */ +boost::shared_ptr > +TileClustering::makeCoarsenedTagData(const pdat::CellData& tag_data, + int tag_val) const +{ + hier::Box coarsened_box(tag_data.getBox()); + coarsened_box.coarsen(d_tile_size); + + boost::shared_ptr > coarsened_tag_data( + new pdat::CellData(coarsened_box, + 1, + hier::IntVector::getZero(tag_data.getDim()))); + coarsened_tag_data->fill(0, 0); + + size_t coarse_tag_count = 0; + + const size_t num_coarse_cells = coarsened_box.size(); + for (size_t offset = 0; offset < num_coarse_cells; ++offset) { + const pdat::CellIndex coarse_cell_index(coarsened_box.index(offset)); + + hier::Box fine_cells_box(coarse_cell_index, coarse_cell_index, coarsened_box.getBlockId()); + fine_cells_box.refine(d_tile_size); + fine_cells_box *= tag_data.getBox(); + + pdat::CellIterator finecend(pdat::CellGeometry::end(fine_cells_box)); + for (pdat::CellIterator fineci(pdat::CellGeometry::begin(fine_cells_box)); + fineci != finecend; ++fineci) { + if (tag_data(*fineci) == tag_val) { + (*coarsened_tag_data)(coarse_cell_index) = tag_val; + ++coarse_tag_count; + break; + } + } + } + if (d_print_steps) { + tbox::plog << "TileClustering coarsened box " << tag_data.getBox() + << " to " << coarsened_box + << " (" << coarse_tag_count << " tags)." << std::endl; + } + + return coarsened_tag_data; +} + +/* + *********************************************************************** + * Coalesce tile clusters and update tag<==>tile. + * + * This method uses a modify operation to update tag<==>tile, but if + * tag<==>tile is local (tiles have no remote extent), the modify + * operation should properly degenerate to a local (non-communicating) + * operation. + *********************************************************************** + */ +void +TileClustering::coalesceClusters( + hier::BoxLevel& tile_box_level, + boost::shared_ptr& tag_to_tile, + int tiles_have_remote_extent) +{ + /* + * If tiles have no remote extent, we can make significant + * optimizations. + */ + if (!tiles_have_remote_extent) { + coalesceClusters(tile_box_level, tag_to_tile); + return; + } + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: entered with remote extent." << std::endl; + } + + /* + * Coalesce the boxes and give coalesced boxes unique ids. + */ + const hier::BoxContainer& pre_boxes = tile_box_level.getBoxes(); + hier::BoxContainer post_boxes(false); + std::map post_boxes_by_block; + for (hier::BoxContainer::const_iterator bi = pre_boxes.begin(); + bi != pre_boxes.end(); ++bi) { + post_boxes_by_block[bi->getBlockId()].pushBack(*bi); + } + + hier::LocalId last_used_id(tile_box_level.getLastLocalId()); + d_object_timers->t_coalesce->start(); + for (std::map::iterator mi = post_boxes_by_block.begin(); + mi != post_boxes_by_block.end(); ++mi) { + coalesceBoxes(mi->second); + for (hier::BoxContainer::iterator bi = mi->second.begin(); + bi != mi->second.end(); ++bi) { + bi->setId(hier::BoxId(++last_used_id, tile_box_level.getMPI().getRank())); + post_boxes.pushBack(*bi); + } + } + d_object_timers->t_coalesce->stop(); + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: coalesced " + << tile_box_level.getLocalNumberOfBoxes() + << " tiles into " << post_boxes.size() << "\n"; + } + + d_object_timers->t_coalesce_adjustment->start(); + + /* + * Build a map that represents the changes from pre- to post-coalesce. + */ + const hier::IntVector& zero_vector = hier::IntVector::getZero(d_dim); + hier::BoxLevel tmp_tile_box_level( + tile_box_level.getRefinementRatio(), + tile_box_level.getGridGeometry(), + tile_box_level.getMPI()); + + hier::MappingConnector pre_to_post( + tile_box_level, + tmp_tile_box_level, + zero_vector); + + pre_boxes.makeTree(tile_box_level.getGridGeometry().get()); + + for (hier::BoxContainer::const_iterator post_itr = post_boxes.begin(); + post_itr != post_boxes.end(); ++post_itr) { + + hier::BoxContainer tmp_overlap_boxes; + pre_boxes.findOverlapBoxes(tmp_overlap_boxes, *post_itr, + tile_box_level.getRefinementRatio()); + + TBOX_ASSERT(!tmp_overlap_boxes.empty()); + if (tmp_overlap_boxes.size() == 1) { + // pre- and post-box are the same. No mapping edge. + TBOX_ASSERT(tmp_overlap_boxes.front().isSpatiallyEqual(*post_itr)); + tmp_tile_box_level.addBoxWithoutUpdate(tmp_overlap_boxes.front()); + } else { + // Add coalesced box and edges to it. + tmp_tile_box_level.addBoxWithoutUpdate(*post_itr); + for (hier::BoxContainer::const_iterator pre_itr = tmp_overlap_boxes.begin(); + pre_itr != tmp_overlap_boxes.end(); ++pre_itr) { + TBOX_ASSERT(post_itr->getOwnerRank() == pre_itr->getOwnerRank()); + pre_to_post.insertLocalNeighbor(*post_itr, pre_itr->getBoxId()); + } + } + + } + + tmp_tile_box_level.finalize(); + TBOX_ASSERT(pre_to_post.isLocal()); + + /* + * Apply the modifications. + */ + if (d_debug_checks) { + d_mca.setSanityCheckMethodPreconditions(true); + d_mca.setSanityCheckMethodPostconditions(true); + } + d_mca.modify(*tag_to_tile, + pre_to_post, + &tile_box_level, + &tmp_tile_box_level); + d_mca.setSanityCheckMethodPreconditions(false); + d_mca.setSanityCheckMethodPostconditions(false); + + d_object_timers->t_coalesce_adjustment->stop(); + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: leaving with remote extent." << std::endl; + } +} + +/* + *********************************************************************** + * Coalesce boxes. This method uses a recursive bi-section algorithm + * to reduce the number of boxes given to the O(N^3) + * BoxContainer::coalesce method, which is very slow for large N. + * + * tiles must contain tiles with matching BlockId. + *********************************************************************** + */ +void +TileClustering::coalesceBoxes( + hier::BoxContainer &boxes ) +{ + if ( boxes.size() < d_recursive_coalesce_limit ) { + boxes.coalesce(); + return; + } + +#if 1 + /* + * Choose splitting direction to be that with largest ratio of + * bounding box size to average box size. This is intended to, on + * average, reduce the number of boxes that cross the splitting + * plane and favor generating low aspect ratio boxes. + */ + hier::Box bounding_box(boxes.front().getDim()); + hier::IntVector sum_box_size(boxes.front().getDim(), 0); + for ( hier::BoxContainer::const_iterator bi=boxes.begin(); bi!=boxes.end(); ++bi ) { + bounding_box += *bi; + sum_box_size += bi->numberCells(); + } + const hier::IntVector bounding_box_size = bounding_box.numberCells(); + double avg_box_size[SAMRAI::MAX_DIM_VAL]; + double ratio[SAMRAI::MAX_DIM_VAL]; + tbox::Dimension::dir_t split_dir = 0; + for ( tbox::Dimension::dir_t d=0; d(sum_box_size[d])/boxes.size(); + ratio[d] = bounding_box_size(d)/avg_box_size[d]; + if ( ratio[split_dir] < ratio[d] ) split_dir = d; + } +#else + + // Choose the longest direction for splitting. + const hier::Box bounding_box = boxes.getBoundingBox(); + const tbox::Dimension::dir_t split_dir = bounding_box.longestDirection(); +#endif + + int split_idx = (bounding_box.lower()(split_dir) + bounding_box.upper()(split_dir))/2; + size_t old_size = 0; + // Split boxes across the split_dir, into upper and lower groups. + hier::BoxContainer upper_boxes, lower_boxes; + hier::Box upper_bounding_box(boxes.front().getDim()), lower_bounding_box(boxes.front().getDim()); + for ( hier::BoxContainer::const_iterator bi=boxes.begin(); bi!=boxes.end(); ++bi ) { + ++old_size; + if ( (split_idx - bi->lower()(split_dir)) > (bi->upper()(split_dir) + 1 - split_idx) ) { + lower_boxes.push_back(*bi); + lower_bounding_box += *bi; + } else { + upper_boxes.push_back(*bi); + upper_bounding_box += *bi; + } + } + + /* + * Heuristic fix-up used when all boxes went into one side. + * (This logic is rarely needed but critical for avoiding infinite recursions.) + * Move boxes crossing split_idx into the side with no box. + * If that doesn't help, end the recursion. + */ + if ( lower_boxes.empty() || upper_boxes.empty() ) { + hier::BoxContainer &empty = lower_boxes.empty() ? lower_boxes : upper_boxes; + hier::BoxContainer &full = lower_boxes.empty() ? upper_boxes : lower_boxes; + for ( hier::BoxContainer::iterator bi=full.begin(); bi!=full.end(); /* incremented in loop */ ) { + if ( bi->upper()(split_dir) >= split_idx && + bi->lower()(split_dir) < split_idx ) { + empty.push_back(*bi); + full.erase(bi++); + } else { + ++bi; + } + } + if ( lower_boxes.empty() || upper_boxes.empty() ) { + boxes.coalesce(); + return; + } + lower_bounding_box = lower_boxes.getBoundingBox(); + upper_bounding_box = upper_boxes.getBoundingBox(); + } + + // Recursively coalesce each group. + coalesceBoxes(upper_boxes); + coalesceBoxes(lower_boxes); + + boxes.clear(); + + /* + * Put lower_boxes and upper_boxes back into boxes, except for + * boxes that touch the opposite bounding box. Try to coalesce + * those before placing in boxes. If coalescible.size() == boxes.size(), + * then the two are identical and we avoid using coalesceBoxes to + * prevent endless recursion. + */ + hier::BoxContainer coalescible; + for ( hier::BoxContainer::const_iterator bi=lower_boxes.begin(); bi!=lower_boxes.end(); ++bi ) { + bi->upper()(split_dir) < upper_bounding_box.lower()(split_dir)-1 ? + boxes.push_back(*bi) : coalescible.push_back(*bi); + } + for ( hier::BoxContainer::const_iterator bi=upper_boxes.begin(); bi!=upper_boxes.end(); ++bi ) { + bi->lower()(split_dir) > lower_bounding_box.upper()(split_dir)+1 ? + boxes.push_back(*bi) : coalescible.push_back(*bi); + } + if ( coalescible.size() == static_cast(old_size) ) { + coalescible.coalesce(); + } + else { + coalesceBoxes(coalescible); + } + + boxes.spliceBack(coalescible); + + return; +} + +/* + *********************************************************************** + * This method does no communication but requires that tiles don't + * cross process boundaries on the tag level. + * + *********************************************************************** + */ +void +TileClustering::coalesceClusters( + hier::BoxLevel& tile_box_level, + boost::shared_ptr& tag_to_tile) +{ + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: entered." << std::endl; + } + + /* + * Try to coalesce the boxes in tile_box_level. + */ + std::vector box_vector; + if (!tile_box_level.getBoxes().empty()) { + + d_object_timers->t_coalesce->start(); + + hier::LocalId local_id(0); + + const int nblocks = + static_cast(tile_box_level.getGridGeometry()->getNumberBlocks()); + + for (int b = 0; b < nblocks; ++b) { + hier::BlockId block_id(b); + + hier::BoxContainer block_boxes(tile_box_level.getBoxes(), block_id); + + if (!block_boxes.empty()) { + block_boxes.unorder(); + coalesceBoxes(block_boxes); + TBOX_omp_set_lock(&l_outputs); + box_vector.insert(box_vector.end(), block_boxes.begin(), block_boxes.end()); + TBOX_omp_unset_lock(&l_outputs); + } + } + + d_object_timers->t_coalesce->stop(); + + } + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: coalesced " + << tile_box_level.getLocalNumberOfBoxes() + << " tiles into " << box_vector.size() << "\n"; + } + + tile_box_level.deallocateGlobalizedVersion(); + + if (box_vector.size() != static_cast(tile_box_level.getLocalNumberOfBoxes())) { + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: starting coalesce adjustment." + << "\n"; + } + + d_object_timers->t_coalesce_adjustment->start(); + + /* + * Coalesce changed the tiles, so rebuild tile_box_level and + * Connectors. + */ + const hier::IntVector& zero_vector = hier::IntVector::getZero(d_dim); + tile_box_level.initialize(hier::BoxContainer(), + tile_box_level.getRefinementRatio(), + tile_box_level.getGridGeometry(), + tile_box_level.getMPI()); + tag_to_tile.reset(new hier::Connector(tag_to_tile->getBase(), + tile_box_level, + zero_vector)); + hier::Connector* tile_to_tag = new hier::Connector(tile_box_level, + tag_to_tile->getBase(), + zero_vector); + tag_to_tile->setTranspose(tile_to_tag, true); + + const hier::BoxContainer& tag_boxes = tag_to_tile->getBase().getBoxes(); + tag_boxes.makeTree(tag_to_tile->getBase().getGridGeometry().get()); + + /* + * Assign ids to coalesced boxes, add to BoxLevel and add + * tile--->tag edges. + */ + const int rank = tile_box_level.getMPI().getRank(); + for (size_t i = 0; i < box_vector.size(); ++i) { + + box_vector[i].setId(hier::BoxId(hier::LocalId(static_cast(i)), rank)); + + hier::BoxContainer tmp_overlap_boxes; + tag_boxes.findOverlapBoxes(tmp_overlap_boxes, + box_vector[i], + tag_to_tile->getBase().getRefinementRatio()); + + TBOX_omp_set_lock(&l_outputs); + tile_box_level.addBox(box_vector[i]); + tile_to_tag->insertNeighbors(tmp_overlap_boxes, box_vector[i].getBoxId()); + TBOX_omp_unset_lock(&l_outputs); + + } + tile_box_level.finalize(); + + /* + * Add tag--->tile edges. + */ + hier::BoxContainer tiles; + for (size_t i = 0; i < box_vector.size(); ++i) tiles.pushBack(box_vector[i]); + tiles.makeTree(tile_box_level.getGridGeometry().get()); + std::vector real_box_vector, periodic_image_box_vector; + tag_boxes.separatePeriodicImages( + real_box_vector, + periodic_image_box_vector, + tile_box_level.getGridGeometry()->getPeriodicShiftCatalog()); + + for (size_t ib = 0; ib < real_box_vector.size(); ++ib) { + + hier::BoxContainer tmp_overlap_boxes; + tiles.findOverlapBoxes(tmp_overlap_boxes, + real_box_vector[ib], + tag_to_tile->getBase().getRefinementRatio()); + + TBOX_omp_set_lock(&l_outputs); + tag_to_tile->insertNeighbors(tmp_overlap_boxes, + real_box_vector[ib].getBoxId()); + TBOX_omp_unset_lock(&l_outputs); + } + + d_object_timers->t_coalesce_adjustment->stop(); + + } + + if (d_print_steps) { + tbox::plog << "TileClustering::coalesceClusters: leaving." << std::endl; + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +TileClustering::setTimerPrefix( + const std::string& timer_prefix) +{ + std::map::iterator ti( + s_static_timers.find(timer_prefix)); + + if (ti != s_static_timers.end()) { + d_object_timers = &(ti->second); + } else { + + d_object_timers = &s_static_timers[timer_prefix]; + + tbox::TimerManager* tm = tbox::TimerManager::getManager(); + + d_object_timers->t_find_boxes_containing_tags = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()"); + d_object_timers->t_cluster = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_cluster"); + d_object_timers->t_cluster_local = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_cluster_local"); + d_object_timers->t_coalesce = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_coalesce"); + d_object_timers->t_coalesce_adjustment = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_coalesce_adjustment"); + d_object_timers->t_cluster_setup = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_setup"); + d_object_timers->t_cluster_wrapup = tm->getTimer( + timer_prefix + "::findBoxesContainingTags()_wrapup"); + d_object_timers->t_global_reductions = tm->getTimer( + timer_prefix + "::global_reductions"); + + } + +} + +} +} +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.h new file mode 100644 index 00000000..982019cc --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TileClustering.h @@ -0,0 +1,394 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Tile clustering algorithm. + * + ************************************************************************/ +#ifndef included_mesh_TileClustering +#define included_mesh_TileClustering + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/mesh/BoxGeneratorStrategy.h" +#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/BoxLevel.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" +#include "SAMRAI/tbox/Database.h" + +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Tiled patch clustering algorithm. + * + * Tiling generates clusters of a predetermined tile size. Tile size can + * be different on different levels, and mixing tiled and untiled levels + * is permitted. However, tiling is most efficient when tile boundaries + * coincide, which is achieved by setting Tc*R is divisible by Tf or vice + * versa, where Tc is the tile size on a coarser level, Tf is the tile size + * on the finer level and R is the refinement ratio between the two levels. + * Be sure to use a compatible tile size in the partitioning object. + * + * The algorithm is described in the article "Advances in Patch-Based + * Adaptive Mesh Refinement Scalability" submitted to JPDC. Scaling + * benchmark results are also in the article. + * + * Input Parameters + * + * Definitions: + * + * - \b tile_size + * Tile size in the index space of the tag level. + * + * - \b coalesce_boxes + * Whether to coalesce boxes after clustering. This can lead to + * clusters that are bigger than specified tile size. + * + * - \b coalesce_boxes_from_same_patch + * Whether to coalesce tiled-boxes that originate from the + * same tag patch. + * This can reduce number of tiles and lead to clusters bigger than + * tile size. + * + * - \b allow_remote_tile_extent + * Whether tile may extend to remote tag patches. + * If false, tiles will be cut at process boundaries, resulting in + * completely local tiles. If true, allow tiles to cross process + * boundaries where, resulting in less tile fragmentation. + * If false, clusters' extent can depend on how tag level + * is partitioned. + * + * - \b DEV_debug_checks + * Whether to run expensive checks for debugging. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
tile_sizeint[]all values are 8all values > 0optNot written to restart. Value in input db used.
coalesce_boxesbooltruefalse/trueoptNot written to restart. Value in input db used.
coalesce_boxes_from_same_patchboolfalsefalse/trueoptNot written to restart. Value in input db used.
allow_remote_tile_extentbooltruefalse/trueoptNot written to restart. Value in input db used.
DEV_debug_checksboolfalsefalse/trueoptNot written to restart. Value in input db used.
+ * + * @internal The following are developer inputs. + * Defaults are listed in parenthesis: + * + * @internal DEV_print_steps (FALSE) + * boolean + */ +class TileClustering:public BoxGeneratorStrategy +{ + +public: + /*! + * @brief Constructor. + */ + explicit TileClustering( + const tbox::Dimension& dim, + const boost::shared_ptr& input_db = + boost::shared_ptr()); + + /*! + * @brief Destructor. + * + * Deallocate internal data. + */ + virtual ~TileClustering(); + + /*! + * @brief Implement the BoxGeneratorStrategy interface + * method of the same name. + * + * Create a set of boxes that covers all integer tags on + * the patch level that match the specified tag value. + * Each box will be at least as large as the given minimum + * size and the tolerances will be met. + */ + void + findBoxesContainingTags( + boost::shared_ptr& new_box_level, + boost::shared_ptr& tag_to_new, + const boost::shared_ptr& tag_level, + const int tag_data_index, + const int tag_val, + const hier::BoxContainer& bound_boxes, + const hier::IntVector& min_box, + const hier::IntVector& max_gcw); + + /*! + * @brief Setup names of timers. + */ + void + setTimerPrefix( + const std::string& timer_prefix); + +protected: + /*! + * @brief Read parameters from input database. + * + * @param input_db Input Database. + */ + void + getFromInput( + const boost::shared_ptr& input_db); + +private: + /*! + * @brief Cluster, cutting off tiles at process boundaries. + * + * This is a special implementation for when we do now allow tiles + * to cross process boundaries. + */ + void + clusterWithinProcessBoundaries( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new, + const boost::shared_ptr& tag_level, + const hier::BoxContainer& bound_boxes, + int tag_data_index, + int tag_val); + + /*! + * @brief Create, populate and return a coarsened version of the + * given tag data. + * + * The coarse cell values are set to tag_data if any corresponding + * fine cell value is tag_value. Otherwise, the coarse cell value + * is set to zero. + */ + boost::shared_ptr > + makeCoarsenedTagData( + const pdat::CellData& tag_data, + int tag_value) const; + + /*! + * @brief Find tagged tiles in a single patch. + */ + int + findTilesContainingTags( + hier::BoxContainer& tiles, + const pdat::CellData& tag_data, + int tag_val, + int first_tile_index); + + /*! + * @brief Cluster tags into whole tiles. The tiles are not cut up, + * even where they cross process boundaries or level boundaries. + */ + void + clusterWholeTiles( + hier::BoxLevel& new_box_level, + boost::shared_ptr& tag_to_new, + int& local_tiles_have_remote_extent, + const boost::shared_ptr& tag_level, + const hier::BoxContainer& bound_boxes, + int tag_data_index, + int tag_val); + + /*! + * @brief Detect semilocal edges missing from the outputs of + * clusterWholeTiles(). + */ + void + detectSemilocalEdges( + boost::shared_ptr& tag_to_tile); + + /*! + * @brief Remove duplicate tiles created when a tile crosses a + * tag-level process boundary. + */ + void + removeDuplicateTiles( + hier::BoxLevel& tile_box_level, + hier::Connector& tag_to_tiles); + + /* + * @brief Shear tiles at block boundaries so they don't cross the boundaries. + */ + void + shearTilesAtBlockBoundaries( + hier::BoxLevel& tile_box_level, + hier::Connector& tag_to_tiles); + + /*! + * @brief Coalesce clusters (and update Connectors). + */ + void + coalesceClusters( + hier::BoxLevel& tile_box_level, + boost::shared_ptr& tag_to_tile, + int tiles_have_remote_extent); + + /*! + * @brief Special version of coalesceClusters. + * for use when tiles have no remote extent. + */ + void + coalesceClusters( + hier::BoxLevel& tile_box_level, + boost::shared_ptr& tag_to_tile); + + /*! + * @brief Recursive bi-section version of BoxContainer::coalesce, + * having O(N lg N) expected complexity. + */ + void + coalesceBoxes( + hier::BoxContainer &boxes ); + + const tbox::Dimension d_dim; + + //! @brief Tile size constraint. + hier::IntVector d_tile_size; + + /*! + * @brief Whether to allow tiles to have remote extents. + */ + bool d_allow_remote_tile_extent; + + /*! + * @brief Whether to coalesce all local tiled-boxes after + * clustering. + * + * This can reduce number of tiles and lead to clusters bigger than + * tile size. + */ + bool d_coalesce_boxes; + + /*! + * @brief Whether to coalesce tiled-boxes that originate from the + * same tag patch. + * + * This can reduce number of tiles and lead to clusters bigger than + * tile size. + */ + bool d_coalesce_boxes_from_same_patch; + + /*! + * @brief Number of boxes at which to use recursive, instead of + * simple, coalesce. + */ + int d_recursive_coalesce_limit; + + /*! + * @brief Thread locker for modifying clustering outputs with multi-threads. + */ + TBOX_omp_lock_t l_outputs; + + /*! + * @brief Thread locker for modifying intermediate data with multi-threads. + */ + TBOX_omp_lock_t l_interm; + + //@{ + //! @name Diagnostics and performance evaluation + bool d_debug_checks; + hier::OverlapConnectorAlgorithm d_oca; + hier::MappingConnectorAlgorithm d_mca; + bool d_log_cluster_summary; + bool d_log_cluster; + bool d_barrier_and_time; + bool d_print_steps; + //@} + + //@{ + //! @name Performance timer data for this class. + + /* + * @brief Structure of timers used by this class. + * + * Each object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_find_boxes_containing_tags; + boost::shared_ptr t_cluster; + boost::shared_ptr t_cluster_local; + boost::shared_ptr t_coalesce; + boost::shared_ptr t_coalesce_adjustment; + boost::shared_ptr t_global_reductions; + boost::shared_ptr t_cluster_setup; + boost::shared_ptr t_cluster_wrapup; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + static int s_primary_mpi_tag; + static int s_secondary_mpi_tag; + static int s_first_data_length; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + //@} + +}; + +} +} + +#endif // included_mesh_TileClustering diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.C new file mode 100644 index 00000000..4dd8da14 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.C @@ -0,0 +1,75 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Container of loads for TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_TransitLoad_C +#define included_mesh_TransitLoad_C + +#include "SAMRAI/mesh/TransitLoad.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +/* + *********************************************************************** + *********************************************************************** + */ +TransitLoad::TransitLoad(): + d_allow_box_breaking(true), + d_threshold_width(1.0e-12) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +TransitLoad::TransitLoad( + const TransitLoad& other): + d_allow_box_breaking(other.d_allow_box_breaking), + d_threshold_width(other.d_threshold_width) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +TransitLoad::recursivePrint( + std::ostream& co, + const std::string& border, + int detail_depth) const +{ + NULL_USE(detail_depth); + co << border + << getSumLoad() << " units in " << getNumberOfItems() << " items from " + << getNumberOfOriginatingProcesses() << " processes.\n"; +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.h new file mode 100644 index 00000000..4d28fc31 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TransitLoad.h @@ -0,0 +1,297 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Container of loads for TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_TransitLoad +#define included_mesh_TransitLoad + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxLevel.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/tbox/MessageStream.h" + +#include +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Base class for container of work in transit during + * partitioning. + * + * TransitLoad base class follows the prototype design pattern. + * Subclasses must implement clone(), initialize(), and a copy + * constructor according to this design pattern. + * + * TransitLoad has dual responsibilities. + * + * - First, it's a container of loads that move around. The + * implementation may represent the work however it wants and should + * be able to shift load from one container to another. See + * adjustLoad(). + * + * - Second, it generates the mappings between the pre- and + * post-balance BoxLevels. It must have this responsibility because + * the implementation alone knows how the work is represented. See + * assignToLocalAndPopulateMaps(). + * + * For usage examples, see TreeLoadBalancer. + */ + +class TransitLoad +{ + +public: + TransitLoad(); + + TransitLoad( + const TransitLoad& other); + + virtual ~TransitLoad() { + } + + //@{ + //! @name Methods required by prototype design pattern + + //! @brief Clone object according to design pattern. + virtual TransitLoad * + clone() const = 0; + + //! @brief Initialize object according to design pattern. + virtual void + initialize() = 0; + + //@} + + //@{ + //! @brief Container-like characteristics + + //! @brief Return the total load contained. + virtual double + getSumLoad() const = 0; + + //! @brief Insert all boxes from the given BoxContainer. + virtual void + insertAll( + const hier::BoxContainer& other) = 0; + + /*! + * @brief Insert all boxes from the given TransitLoad. + * + * Changes to other as an implementation side-effect is allowed. + * This and other are guaranteed to be the same concrete type. + * + * @param other [in] Other TransitLoad container whose + * implementation matches this one. + */ + virtual void + insertAll( + TransitLoad& other) = 0; + + /*! + * @brief Insert Boxes from the given container but preserve + * load values currently held by the TransitLoad. + */ + virtual void + insertAllWithExistingLoads( + const hier::BoxContainer& box_container) = 0; + + /*! + * @brief Set Workload values in the the TransitLoad object + * + * @param patch_level Level holding workload data + * @param work_data_id Patch data id for workload data + */ + virtual void + setWorkload( + const hier::PatchLevel& patch_level, + const int work_data_id) = 0; + + //! @brief Return number of items in this container. + virtual size_t + getNumberOfItems() const = 0; + + //! @brief Return number of processes contributing to the contents. + virtual size_t + getNumberOfOriginatingProcesses() const = 0; + + //! @brief Whether container is empty. + virtual bool empty() const { + return getNumberOfItems() == 0; + } + + //! @brief Empty the container. + virtual void + clear() = 0; + + //@} + + //@{ + //! @name Packing/unpacking for communication. + + //! @brief Put content into MessageStream. + virtual void + putToMessageStream( + tbox::MessageStream& msg) const = 0; + + //! @brief Add to content from MessageStream. + virtual void + getFromMessageStream( + tbox::MessageStream& msg) = 0; + + friend tbox::MessageStream& operator << ( + tbox::MessageStream& msg, const TransitLoad& transit_load) { + transit_load.putToMessageStream(msg); + return msg; + } + + friend tbox::MessageStream& operator >> ( + tbox::MessageStream& msg, TransitLoad& transit_load) { + transit_load.getFromMessageStream(msg); + return msg; + } + //@} + + /*! + * @brief Adjust the load in this TransitSet by moving work + * between it and another TransitSet. + * + * @param[in,out] hold_bin Holding bin for reserve load. hold_bin + * implementation is guaranteed to match this one. + * + * @param[in] ideal_load The load that this bin should have. + * + * @param[in] low_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @param[in] high_load Return when this bin's load is in the range + * [low_load,high_load] + * + * @return Net load added to this TransitSet. If negative, load + * decreased. + */ + virtual double + adjustLoad( + TransitLoad& hold_bin, + double ideal_load, + double low_load, + double high_load) = 0; + + /*! + * @brief Assign contents to local process. + * + * This method may use communication. + * + * @param [in,out] balanced_box_level Empty BoxLevel to populate with + * the contents of this TransitLoad. + * + * @param[in] unbalanced_box_level + * + * @param [in] flexible_load_tol + * + * @param [in] alt_mpi Alternate SAMRAI_MPI to use for communication if + * needed, overriding that in balanced_box_level. + */ + virtual void + assignToLocal( + hier::BoxLevel& balanced_box_level, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)) = 0; + + /*! + * @brief Assign contents to local process and populate the + * balanced<==>unbalanced maps. + * + * This method may use communication. + * + * @param [in,out] balanced_box_level Empty BoxLevel to populate with + * the contents of this TransitLoad. + * + * @param [in,out] balanced_to_unbalanced Empty Connector to populate + * with the balanced--->unbalanced edges. + * + * @param [in,out] unbalanced_to_balanced Empty Connector to populate + * with the unbalanced--->balanced edges. + * + * @param [in] flexible_load_tol + * + * @param [in] alt_mpi Alternate SAMRAI_MPI to use for communication if + * needed, overriding that in balanced_box_level. + */ + virtual void + assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)) = 0; + + //@{ + //! @name Parameters in box breaking + + //! @brief Whether to allow box breaking. + void setAllowBoxBreaking(bool allow_box_breaking) { + d_allow_box_breaking = allow_box_breaking; + } + + //! @brief Whether object may break up boxes. + bool getAllowBoxBreaking() const { + return d_allow_box_breaking; + } + + /*! + * @brief Set threshold for resisting small and thin boxes. + * + * This is not a hard limit, but implementations should use it to + * determine when a box is getting too small in any coordinate + * direction. Default initial threshold is very small (practically + * unlimited). + */ + void setThresholdWidth(double threshold_width) { + d_threshold_width = threshold_width; + } + + //! @brief Return the threshold width for resisting small and thin boxes. + double getThresholdWidth() const { + return d_threshold_width; + } + + //@} + + //@{ + //! @name Diagnostic support + + //! @brief Set prefix of internal diagnostic timer names. + virtual void + setTimerPrefix( + const std::string&) { + } + + //! @brief Object printing method to aid in debugging. + virtual void + recursivePrint( + std::ostream& co = tbox::plog, + const std::string& border = std::string(), + int detail_depth = 1) const; + + //@} + +private: + bool d_allow_box_breaking; + double d_threshold_width; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.C index 622d4e0b..85f5b930 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Scalable load balancer using tree algorithm. * ************************************************************************/ @@ -12,25 +12,21 @@ #define included_mesh_TreeLoadBalancer_C #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/BoxTransitSet.h" +#include "SAMRAI/mesh/VoucherTransitLoad.h" +#include "SAMRAI/mesh/BalanceUtilities.h" #include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/tbox/StartupShutdownManager.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" -#include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellDataFactory.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/CenteredRankTree.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/AsyncCommStage.h" #include "SAMRAI/tbox/AsyncCommGroup.h" #include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/Statistician.h" #include "SAMRAI/tbox/TimerManager.h" #include @@ -51,15 +47,9 @@ namespace mesh { const int TreeLoadBalancer::TreeLoadBalancer_LOADTAG0; const int TreeLoadBalancer::TreeLoadBalancer_LOADTAG1; -const int TreeLoadBalancer::TreeLoadBalancer_EDGETAG0; -const int TreeLoadBalancer::TreeLoadBalancer_EDGETAG1; -const int TreeLoadBalancer::TreeLoadBalancer_PREBALANCE0; -const int TreeLoadBalancer::TreeLoadBalancer_PREBALANCE1; const int TreeLoadBalancer::TreeLoadBalancer_FIRSTDATALEN; -const int TreeLoadBalancer::TreeLoadBalancer_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE; - -const int TreeLoadBalancer::d_default_data_id = -1; +const int TreeLoadBalancer::s_default_data_id = -1; /* ************************************************************************* @@ -70,45 +60,37 @@ const int TreeLoadBalancer::d_default_data_id = -1; TreeLoadBalancer::TreeLoadBalancer( const tbox::Dimension& dim, const std::string& name, - const boost::shared_ptr& input_db): + const boost::shared_ptr& input_db, + const boost::shared_ptr& rank_tree): d_dim(dim), d_object_name(name), d_mpi(tbox::SAMRAI_MPI::commNull), d_mpi_is_dupe(false), - d_n_root_cycles(-1), - d_degree(2), - d_master_workload_data_id(d_default_data_id), - d_min_load_fraction_per_box(0.03), - d_balance_penalty_wt(1.0), - d_surface_penalty_wt(1.0), - d_slender_penalty_wt(1.0), - d_slender_penalty_threshold(3.0), - d_precut_penalty_wt(1.0), - // Data shared during balancing. - d_min_size(d_dim), - d_max_size(d_dim), - d_bad_interval(d_dim), - d_cut_factor(d_dim), - // Output control. - d_report_load_balance(false), - d_summarize_map(false), + d_tile_size(dim, 1), + d_max_spread_procs(500), + d_voucher_mode(false), + d_allow_box_breaking(true), + d_rank_tree(rank_tree ? rank_tree : boost::shared_ptr(new tbox:: + CenteredRankTree)), + d_comm_graph_writer(), + d_master_workload_data_id(s_default_data_id), + d_flexible_load_tol(0.05), + d_mca(), // Performance evaluation. d_barrier_before(false), d_barrier_after(false), + d_report_load_balance(false), + d_summarize_map(false), d_print_steps(false), - d_print_break_steps(false), - d_print_swap_steps(false), - d_print_edge_steps(false), d_check_connectivity(false), d_check_map(false) { TBOX_ASSERT(!name.empty()); getFromInput(input_db); setTimers(); + d_mca.setTimerPrefix(d_object_name); } - - /* ************************************************************************* * TreeLoadBalancer constructor. @@ -120,8 +102,6 @@ TreeLoadBalancer::~TreeLoadBalancer() freeMPICommunicator(); } - - /* ************************************************************************* * Accessory functions to get/set load balancing parameters. @@ -135,74 +115,58 @@ TreeLoadBalancer::getLoadBalanceDependsOnPatchData( return getWorkloadDataId(level_number) < 0 ? false : true; } - - /* -************************************************************************** -************************************************************************** -*/ + ************************************************************************** + ************************************************************************** + */ void TreeLoadBalancer::setWorkloadPatchDataIndex( int data_id, int level_number) { boost::shared_ptr > datafact( - hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> - getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); - if (!datafact) { - TBOX_ERROR( - d_object_name << " error: " - << "\n data_id " << data_id << " passed to " - << "setWorkloadPatchDataIndex()" - << " does not refer to cell-centered double patch data. " << std::endl); - } + BOOST_CAST, hier::PatchDataFactory>( + hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> + getPatchDataFactory(data_id))); + + TBOX_ASSERT(datafact); if (level_number >= 0) { - int asize = d_workload_data_id.getSize(); + int asize = static_cast(d_workload_data_id.size()); if (asize < level_number + 1) { - d_workload_data_id.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_workload_data_id[i] = - d_master_workload_data_id; + d_workload_data_id.resize(level_number + 1); + for (int i = asize; i < level_number - 1; ++i) { + d_workload_data_id[i] = d_master_workload_data_id; } d_workload_data_id[level_number] = data_id; } } else { d_master_workload_data_id = data_id; - for (int ln = 0; ln < d_workload_data_id.getSize(); ln++) { + for (int ln = 0; ln < static_cast(d_workload_data_id.size()); ++ln) { d_workload_data_id[ln] = d_master_workload_data_id; } } } - - /* ************************************************************************* - * This method implements the abstract LoadBalanceStrategy interface, - * but it is not where the tree load balancer algorithm is implemented. + * This method implements the abstract LoadBalanceStrategy interface. * * This method does some preliminary setup then calls - * loadBalanceWithinRankGroup to compute the new balanced - * BoxLevel and the mapping Connectors between the old and the new. - * Then it applies the mapping to update the balance<==>anchor - * Connectors. It may do this multiple times, as specified by the - * cycling parameter. + * loadBalanceWithinRankGroup to do the work. The set-up includes + * determining how many cycles to use to gradually balance a severely + * unbalanced load. * * After load balancing, it enforces the maximum size restriction - * by breaking up large boxes and update balance<==>anchor again. + * by breaking up large boxes and update balance<==>reference again. ************************************************************************* */ void TreeLoadBalancer::loadBalanceBoxLevel( hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, + hier::Connector* balance_to_reference, const boost::shared_ptr& hierarchy, const int level_number, - const hier::Connector& balance_to_attractor, - const hier::Connector& attractor_to_balance, const hier::IntVector& min_size, const hier::IntVector& max_size, const hier::BoxLevel& domain_box_level, @@ -210,16 +174,15 @@ TreeLoadBalancer::loadBalanceBoxLevel( const hier::IntVector& cut_factor, const tbox::RankGroup& rank_group) const { - NULL_USE(balance_to_attractor); - NULL_USE(attractor_to_balance); +#ifndef DEBUG_CHECK_DIM_ASSERTIONS + NULL_USE(domain_box_level); +#endif NULL_USE(hierarchy); NULL_USE(level_number); - TBOX_ASSERT(anchor_to_balance.isFinalized() == - balance_to_anchor.isFinalized()); - if (anchor_to_balance.isFinalized()) { - TBOX_ASSERT(anchor_to_balance.isTransposeOf(balance_to_anchor)); - } - TBOX_DIM_ASSERT_CHECK_DIM_ARGS6(d_dim, + TBOX_ASSERT(!balance_to_reference || balance_to_reference->hasTranspose()); + TBOX_ASSERT(!balance_to_reference || + balance_to_reference->isTransposeOf(balance_to_reference->getTranspose())); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY6(d_dim, balance_box_level, min_size, max_size, @@ -227,11 +190,10 @@ TreeLoadBalancer::loadBalanceBoxLevel( bad_interval, cut_factor); if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); } - - if ( d_mpi_is_dupe ) { + if (d_mpi_is_dupe) { /* * If user has set the duplicate communicator, make sure it is * compatible with the BoxLevel involved. @@ -239,37 +201,55 @@ TreeLoadBalancer::loadBalanceBoxLevel( TBOX_ASSERT(d_mpi.getSize() == balance_box_level.getMPI().getSize()); TBOX_ASSERT(d_mpi.getRank() == balance_box_level.getMPI().getRank()); #ifdef DEBUG_CHECK_ASSERTIONS - if (d_mpi.getSize() > 1) { - int compare_result; - tbox::SAMRAI_MPI::Comm_compare( - d_mpi.getCommunicator(), - balance_box_level.getMPI().getCommunicator(), - &compare_result); - if (compare_result != MPI_CONGRUENT) { - TBOX_ERROR("TreeLoadBalancer::loadBalanceBoxLevel:\n" - << "The input balance_box_level has a SAMRAI_MPI that is\n" - << "not congruent with the one set with setSAMRAI_MPI().\n" - << "You must use freeMPICommunicator() before balancing\n" - << "a BoxLevel with an incongruent SAMRAI_MPI."); - } + if (!d_mpi.isCongruentWith(balance_box_level.getMPI())) { + TBOX_ERROR("TreeLoadBalancer::loadBalanceBoxLevel:\n" + << "The input balance_box_level has a SAMRAI_MPI that is\n" + << "not congruent with the one set with setSAMRAI_MPI().\n" + << "You must use freeMPICommunicator() before balancing\n" + << "a BoxLevel with an incongruent SAMRAI_MPI."); } #endif - } - else { + } else { d_mpi = balance_box_level.getMPI(); } - if (d_print_steps || - d_print_break_steps) { - tbox::plog << "TreeLoadBalancer::loadBalanceBoxLevel called with:" + if (d_print_steps) { + tbox::plog << d_object_name << "::loadBalanceBoxLevel called with:" << "\n min_size = " << min_size << "\n max_size = " << max_size << "\n bad_interval = " << bad_interval << "\n cut_factor = " << cut_factor - << std::endl << balance_box_level.format("", 2); + << "\n prebalance:\n" + << balance_box_level.format(" ", 2); + } + + // Set effective_cut_factor to least common multiple of cut_factor and d_tile_size. + const size_t nblocks = balance_box_level.getGridGeometry()->getNumberBlocks(); + hier::IntVector effective_cut_factor(cut_factor, nblocks); + if ( d_tile_size != hier::IntVector::getOne(d_dim) ) { + if (cut_factor.getNumBlocks() == 1) { + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for ( int d=0; dstart(); - double local_load = computeLocalLoads(balance_box_level); - t_compute_local_load->stop(); + LoadType global_sum_load = local_load; size_t nproc_with_initial_load = balance_box_level.getLocalNumberOfBoxes() > 0; - double global_sum_load; - - { - /* - * Determine the total load and number of processes that has any - * initial load. - * - * TODO: If there's more than one rank group, shouldn't this a - * global reduction for each rank group instead of a single one - * for all? - */ - t_compute_global_load->start(); - if (d_mpi.getSize() > 1) { - double dtmp[2], dtmp_sum[2]; - dtmp[0] = local_load; - dtmp[1] = static_cast(nproc_with_initial_load); - d_mpi.Allreduce(dtmp, - dtmp_sum, - 2, - MPI_DOUBLE, - MPI_SUM); - global_sum_load = dtmp_sum[0]; - nproc_with_initial_load = (size_t)dtmp_sum[1]; - } else { - global_sum_load = local_load; - } - t_compute_global_load->stop(); - if (d_print_steps) { - tbox::plog << "TreeLoadBalancer::loadBalanceBoxLevel balancing " - << global_sum_load << " (initially born on " - << nproc_with_initial_load << " procs) across all " - << d_mpi.getSize() - << " procs, averaging " << global_sum_load / d_mpi.getSize() - << " or " << pow(global_sum_load / d_mpi.getSize(), 1.0 / d_dim.getValue()) - << "^" << d_dim << " per proc." << std::endl; - } - } - + /* + * Determine the total load and number of processes that has any + * initial load. + */ + t_compute_global_load->start(); + if (d_mpi.getSize() > 1) { + double dtmp[2], dtmp_sum[2], dtmp_max[2]; - d_global_avg_load = global_sum_load / rank_group.size(); + dtmp[0] = local_load; + dtmp[1] = static_cast(nproc_with_initial_load); + d_mpi.Allreduce(dtmp, dtmp_sum, 2, MPI_DOUBLE, MPI_SUM); + global_sum_load = dtmp_sum[0]; + nproc_with_initial_load = (size_t)dtmp_sum[1]; - /* - * Add additional minimum box size restriction based on - * d_min_load_fraction_per_box: Should be no smaller than a cubic - * box that satisfies this work load. - */ - if ( d_min_load_fraction_per_box > 0.0 ) { - const hier::IntVector tmp_vec(d_min_size); + d_mpi.Allreduce(dtmp, dtmp_max, 1, MPI_DOUBLE, MPI_MAX); + max_local_load = dtmp_max[0]; - int box_size_for_min_load_restriction = - static_cast(pow(d_global_avg_load*d_min_load_fraction_per_box, - 1.0/d_dim.getValue())+ 0.5); - d_min_size.max( hier::IntVector( d_dim, box_size_for_min_load_restriction ) ); + } + t_compute_global_load->stop(); - if (d_print_steps) { - tbox::plog << "min_load_fraction_per_box changed min_size from " << tmp_vec; - tbox::plog << " to " << d_min_size << '\n'; - } + if (d_print_steps) { + tbox::plog.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + tbox::plog.precision(6); + tbox::plog << d_object_name << "::loadBalanceBoxLevel" + << " max_local_load=" << max_local_load + << " global_sum_load=" << global_sum_load + << " (initially born on " + << nproc_with_initial_load << " procs) across all " + << d_mpi.getSize() + << " procs, averaging " << global_sum_load / d_mpi.getSize() + << " or " << pow(global_sum_load / d_mpi.getSize(), 1.0 / d_dim.getValue()) + << "^" << d_dim << " per proc." << std::endl; } + d_global_avg_load = global_sum_load / rank_group.size(); /* - * User can set the number of cycles to use (see n_root_cycles - * input parameter), or leave it negative to let this class set it - * automatically using the following heuristic algorithm: - * - * If machine size is small enough to have negligible scaling - * issues (< TreeLoadBalancer_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE), use 1 cycle. + * Compute how many balancing cycles to use based on severity of + * imbalance, using formula + * d_max_spread_procs^number_of_cycles >= fanout_size. * - * Else if the initial load is sufficiently spread out (across at - * least sqrt(nproc)) processes, use 1 cycle. + * The objective of balancing over multiple cycles is to avoid + * unscalable performance in cases where just a few processes own + * most of the initial load. Each cycle spreads the load out a + * little more. By slowly spreading out the load, no process has + * to set up unbalanced<==>balanced with number of relationships + * that scales with the machine size. * - * Else use 2 cycles. + * Exception: If given a RankGroup with less than all ranks, we + * treat it as a specific user request to balance only within the + * RankGroup and just use the RankGroup as is. We are not set up + * to support such a request and multi-cycling simultaneously. */ - int number_of_cycles = d_n_root_cycles; - if (number_of_cycles < 0) { - // User requested automatic number of cycles. - if (balance_box_level.getMPI().getSize() < TreeLoadBalancer_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE ) { - number_of_cycles = 1; - } - else if ( int(nproc_with_initial_load * nproc_with_initial_load) >= - balance_box_level.getMPI().getSize() ) { - number_of_cycles = 1; - } else { - number_of_cycles = 2; - } + const double fanout_size = d_global_avg_load > d_pparams->getLoadComparisonTol() ? + max_local_load / d_global_avg_load : 1.0; + const int number_of_cycles = !rank_group.containsAllRanks() ? 1 : + int(ceil(log(fanout_size) / log(static_cast(d_max_spread_procs)))); + if (d_print_steps) { + tbox::plog << d_object_name << "::loadBalanceBoxLevel" + << " max_spread_procs=" << d_max_spread_procs + << " fanout_size=" << fanout_size + << " number_of_cycles=" << number_of_cycles + << std::endl; } - - /* * The icycle loop spreads out the work each time through. If * using more than one cycle, only the last one tries to balance - * across all of d_mpi. + * across all processes. */ - for (int icycle = 0; icycle < number_of_cycles; ++icycle) { + for (int icycle = number_of_cycles - 1; icycle >= 0; --icycle) { // If not the first cycle, local_load needs updating. - if (icycle > 0) { - t_compute_local_load->start(); - local_load = computeLocalLoads(balance_box_level); - t_compute_local_load->stop(); + if (icycle != number_of_cycles - 1) { + local_load = computeLocalLoad(balance_box_level); } if (d_report_load_balance) { // Debugging: check overall load balance at intermediate cycles. tbox::plog - << "TreeLoadBalancer::loadBalanceBoxLevel results before cycle " + << d_object_name << "::loadBalanceBoxLevel results before cycle " << icycle << ":" << std::endl; - BalanceUtilities::gatherAndReportLoadBalance( - local_load, + BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, local_load), balance_box_level.getMPI()); } - - const bool last_cycle = (icycle == number_of_cycles-1); + const bool last_cycle = (icycle == 0); /* - * Determine whether to use rank_group as is or subgroup it based - * on cycles. + * Determine whether to use rank_group as is or subgroup it for + * intemediate cycles. + * + * Set cycle_rank_group to either the input rank_group or a + * subgroup that is a function of the cycle number. */ - - const tbox::RankGroup *rank_group_in_use = &rank_group; int number_of_groups = 1; int group_num = 0; tbox::RankGroup cycle_rank_group(d_mpi); - if ( !last_cycle && rank_group.containsAllRanks() ) { + if (!last_cycle) { createBalanceRankGroupBasedOnCycles( cycle_rank_group, number_of_groups, group_num, - icycle, - number_of_cycles); - rank_group_in_use = &cycle_rank_group; + 1 - double(icycle) / number_of_cycles); } - /* - * Compute the load for the group. If this is the last cycle, - * the group must include all processes, and the group's load - * is the global sum load. Else, use all-reduce to get the - * group load. + * Compute the group's load. */ t_compute_tree_load->start(); double group_sum_load; - if (icycle == number_of_cycles - 1) { + if (last_cycle) { group_sum_load = global_sum_load; @@ -535,14 +438,14 @@ TreeLoadBalancer::loadBalanceBoxLevel( * Use MPI's vector all-reduce to get individual group loads. * This gives more info than the process needs, but because the * number of groups << number of procs, it is still faster - * (probably) than hand coded conmunication. + * (probably) than hand coded communication. */ std::vector group_loads(number_of_groups, 0.0); group_loads[group_num] = local_load; if (d_mpi.getSize() > 1) { d_mpi.AllReduce(&group_loads[0], - static_cast(group_loads.size()), - MPI_SUM); + static_cast(group_loads.size()), + MPI_SUM); } group_sum_load = group_loads[group_num]; @@ -552,17 +455,24 @@ TreeLoadBalancer::loadBalanceBoxLevel( t_compute_tree_load->stop(); + if (d_print_steps) { + tbox::plog << d_object_name << "::loadBalanceBoxLevel" + << " cycle number=" << icycle + << " number_of_groups=" << number_of_groups + << " my group_num=" << group_num + << " my group size=" << cycle_rank_group.size() + << " my group_sum_load=" << group_sum_load + << std::endl; + } - /* - * Compute the load-balancing map. - */ - + // Run the tree load balancing algorithm. + t_load_balance_for_cycle[icycle]->start(); loadBalanceWithinRankGroup( balance_box_level, - balance_to_anchor, - anchor_to_balance, - rank_group, - group_sum_load ); + balance_to_reference, + cycle_rank_group, + group_sum_load); + t_load_balance_for_cycle[icycle]->stop(); if (d_barrier_after) { t_barrier_after->start(); @@ -572,28 +482,20 @@ TreeLoadBalancer::loadBalanceBoxLevel( } - - /* - * Undo effects of min_load_fraction_per_box on d_min_size. We do - * not want that constraint during the remaining load balance - * steps. - */ - d_min_size = min_size; - - /* * If max_size is given (positive), constrain boxes to the given * max_size. If not given, skip the enforcement step to save some * communications. */ - if (max_size > hier::IntVector::getZero(d_dim)) { + hier::IntVector max_intvector(d_dim, tbox::MathUtilities::getMax()); + if (max_size != max_intvector) { - t_constrain_size->start(); - constrainMaxBoxSizes( + t_constrain_size->barrierAndStart(); + BalanceUtilities::constrainMaxBoxSizes( balance_box_level, - anchor_to_balance, - balance_to_anchor ); + balance_to_reference ? &balance_to_reference->getTranspose() : 0, + *d_pparams); t_constrain_size->stop(); if (d_print_steps) { @@ -603,61 +505,60 @@ TreeLoadBalancer::loadBalanceBoxLevel( } - /* * Finished load balancing. Clean up and wrap up. */ - d_min_size = hier::IntVector(d_dim, -1); - d_max_size = hier::IntVector(d_dim, -1); - d_block_domain_boxes.clear(); - d_bad_interval = hier::IntVector(d_dim, -1); - d_cut_factor = hier::IntVector(d_dim, -1); + d_pparams.reset(); t_load_balance_box_level->stop(); - local_load = computeLocalLoads(balance_box_level); + local_load = computeLocalLoad(balance_box_level); d_load_stat.push_back(local_load); d_box_count_stat.push_back( static_cast(balance_box_level.getBoxes().size())); + if (d_print_steps) { + tbox::plog << "Post balanced:\n" << balance_box_level.format("", 2); + } + if (d_report_load_balance) { t_report_loads->start(); tbox::plog - << "TreeLoadBalancer::loadBalanceBoxLevel results after " + << d_object_name << "::loadBalanceBoxLevel results after " << number_of_cycles << " cycles:" << std::endl; - BalanceUtilities::gatherAndReportLoadBalance(local_load, + BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, local_load), balance_box_level.getMPI()); t_report_loads->stop(); } - if (d_check_connectivity && anchor_to_balance.isFinalized()) { - hier::OverlapConnectorAlgorithm oca; - tbox::plog << "TreeLoadBalancer checking balance-anchor connectivity." + if (d_check_connectivity && balance_to_reference) { + hier::Connector& reference_to_balance = balance_to_reference->getTranspose(); + tbox::plog << "TreeLoadBalancer checking balance-reference connectivity." << std::endl; int errs = 0; - if (oca.checkOverlapCorrectness(anchor_to_balance, false, true, true)) { + if (reference_to_balance.checkOverlapCorrectness(false, true, true)) { ++errs; - tbox::perr << "Error found in anchor_to_balance!\n"; + tbox::perr << "Error found in reference_to_balance!\n"; } - if (oca.checkOverlapCorrectness(balance_to_anchor, false, true, true)) { + if (balance_to_reference->checkOverlapCorrectness(false, true, true)) { ++errs; - tbox::perr << "Error found in balance_to_anchor!\n"; + tbox::perr << "Error found in balance_to_reference!\n"; } - if (anchor_to_balance.checkTransposeCorrectness( - balance_to_anchor)) { + if (reference_to_balance.checkTransposeCorrectness(*balance_to_reference)) { ++errs; - tbox::perr << "Error found in balance-anchor transpose!\n"; + tbox::perr << "Error found in balance-reference transpose!\n"; } if (errs != 0) { TBOX_ERROR( - "Errors in load balance mapping found." - << "anchor_box_level:\n" << anchor_to_balance.getBase().format("", 2) + "Errors in load balance mapping found.\n" + << "reference_box_level:\n" << reference_to_balance.getBase().format("", 2) << "balance_box_level:\n" << balance_box_level.format("", 2) - << "anchor_to_balance:\n" << anchor_to_balance.format("", 2) - << "balance_to_anchor:\n" << balance_to_anchor.format("", 2)); + << "reference_to_balance:\n" << reference_to_balance.format("", 2) + << "balance_to_reference:\n" << balance_to_reference->format("", 2)); } - tbox::plog << "TreeLoadBalancer checked balance-anchor connectivity." + tbox::plog << "TreeLoadBalancer checked balance-reference connectivity." << std::endl; } @@ -669,245 +570,189 @@ TreeLoadBalancer::loadBalanceBoxLevel( } - - /* ************************************************************************* - * Constrain maximum box sizes in the given BoxLevel and - * update given Connectors to the changed BoxLevel. + * Given an "unbalanced" BoxLevel, load balance it within the given + * RankGroup using the tree load balancing algorithm and update + * Connectors. ************************************************************************* */ void -TreeLoadBalancer::constrainMaxBoxSizes( - hier::BoxLevel& box_level, - hier::Connector &anchor_to_level, - hier::Connector &level_to_anchor ) const +TreeLoadBalancer::loadBalanceWithinRankGroup( + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_reference, + const tbox::RankGroup& rank_group, + const double group_sum_load) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, box_level); + TBOX_ASSERT(!balance_to_reference || balance_to_reference->hasTranspose()); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, balance_box_level); - t_map_big_boxes->start(); - - if (d_print_break_steps) { - tbox::plog << "Mapping oversized boxes starting with " - << box_level.getBoxes().size() << " boxes." - << std::endl; - } - - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); - - hier::BoxLevel constrained(box_level.getDim()); - hier::Connector unconstrained_to_constrained; - - constrained.initialize( - box_level.getRefinementRatio(), - box_level.getGridGeometry(), - box_level.getMPI()); - unconstrained_to_constrained.clearNeighborhoods(); - unconstrained_to_constrained.setBase(box_level); - unconstrained_to_constrained.setHead(constrained); - unconstrained_to_constrained.setWidth(zero_vector, true); - - const hier::BoxContainer& unconstrained_boxes = box_level.getBoxes(); - - hier::LocalId next_available_index = box_level.getLastLocalId() + 1; - - for (hier::BoxContainer::const_iterator ni = unconstrained_boxes.begin(); - ni != unconstrained_boxes.end(); ++ni) { - - const hier::Box& box = *ni; + /* + * Initialize empty balanced_box_level and mappings so they are + * ready to be populated. + */ + hier::BoxLevel balanced_box_level( + balance_box_level.getRefinementRatio(), + balance_box_level.getGridGeometry(), + balance_box_level.getMPI()); + hier::MappingConnector balanced_to_unbalanced(balanced_box_level, + balance_box_level, + hier::IntVector::getZero(d_dim)); + hier::MappingConnector unbalanced_to_balanced(balance_box_level, + balanced_box_level, + hier::IntVector::getZero(d_dim)); + unbalanced_to_balanced.setTranspose(&balanced_to_unbalanced, false); - const hier::IntVector box_size = box.numberCells(); + t_get_map->start(); + if (!rank_group.isMember(d_mpi.getRank())) { /* - * If box already conform to max size constraint, keep it. - * Else chop it up and keep the parts. + * If the local process is not a member of the RankGroup, it + * does not participate in the work and just sets the output + * objects to be locally empty. + * + * The following assert should be guaranteed by an earlier call + * to prebalanceBoxLevel. Having boxes without being in the + * given rank group leads to undefined results. */ + TBOX_ASSERT(balance_box_level.getLocalNumberOfBoxes() == 0); - if (box_size <= d_max_size) { + t_post_load_distribution_barrier->start(); + d_mpi.Barrier(); + t_post_load_distribution_barrier->stop(); - if (d_print_break_steps) { - tbox::plog << " Not oversized: " << box - << box.numberCells() << "\n"; - } - constrained.addBox(box); + } else { + /* + * Create a concrete TransitLoad container to hold the work + * being redistributed. + */ + boost::shared_ptr balanced_work; + if (d_voucher_mode) { + balanced_work = boost::make_shared(*d_pparams); + balanced_work->setTimerPrefix(d_object_name + "::VoucherTransitLoad"); } else { + balanced_work = boost::make_shared(*d_pparams); + balanced_work->setTimerPrefix(d_object_name + "::BoxTransitSet"); + } - if (d_print_break_steps) { - tbox::plog << " Breaking oversized " << box - << box.numberCells() << " ->"; - } - hier::BoxContainer chopped(box); - hier::BoxUtilities::chopBoxes( - chopped, - d_max_size, - d_min_size, - d_cut_factor, - d_bad_interval, - d_block_domain_boxes[box.getBlockId().getBlockValue()]); - TBOX_ASSERT( chopped.size() != 0 ); - - if (chopped.size() != 1) { - - hier::Connector::NeighborhoodIterator base_box_itr = - unconstrained_to_constrained.makeEmptyLocalNeighborhood( - box.getId()); - - for (hier::BoxContainer::iterator li(chopped); - li != chopped.end(); ++li) { - - const hier::Box fragment = *li; - - const hier::Box new_box(fragment, - next_available_index++, - d_mpi.getRank()); - TBOX_ASSERT(new_box.getBlockId() == ni->getBlockId()); - - if (d_print_break_steps) { - tbox::plog << " " << new_box - << new_box.numberCells(); - } + distributeLoadAcrossRankGroup( + *balanced_work, + balance_box_level, + rank_group, + group_sum_load); - constrained.addBox(new_box); + t_post_load_distribution_barrier->start(); + d_mpi.Barrier(); + t_post_load_distribution_barrier->stop(); - unconstrained_to_constrained.insertLocalNeighbor( - new_box, - base_box_itr); + if (d_print_steps) { + tbox::plog << d_object_name + << "::loadBalanceWithinRankGroup constructing unbalanced<==>balanced.\n"; + } + t_assign_to_local_and_populate_maps->start(); + balanced_work->assignToLocalAndPopulateMaps( + balanced_box_level, + balanced_to_unbalanced, + unbalanced_to_balanced, + d_flexible_load_tol, + d_mpi); + t_assign_to_local_and_populate_maps->stop(); + if (d_print_steps) { + tbox::plog << d_object_name + << + "::loadBalanceWithinRankGroup finished constructing unbalanced<==>balanced.\n"; + } - } + } - if (d_print_break_steps) { - tbox::plog << "\n"; - } + t_get_map->stop(); - } else { - TBOX_ASSERT( box.isSpatiallyEqual( chopped.front() ) ); - if (d_print_break_steps) { - tbox::plog << " Unbreakable!" << "\n"; - } - constrained.addBox(box); - } + if (d_summarize_map) { + tbox::plog << d_object_name << "::loadBalanceWithinRankGroup unbalanced--->balanced map:\n" + << unbalanced_to_balanced.format("\t", 0) + << "Map statistics:\n" << unbalanced_to_balanced.formatStatistics("\t") + << d_object_name << "::loadBalanceWithinRankGroup balanced--->unbalanced map:\n" + << balanced_to_unbalanced.format("\t", 0) + << "Map statistics:\n" << balanced_to_unbalanced.formatStatistics("\t") + << '\n'; + } + if (d_check_map) { + if (unbalanced_to_balanced.findMappingErrors() != 0) { + TBOX_ERROR( + d_object_name + << "::loadBalanceWithinRankGroup Mapping errors found in unbalanced_to_balanced!"); + } + if (unbalanced_to_balanced.checkTransposeCorrectness( + balanced_to_unbalanced)) { + TBOX_ERROR( + d_object_name << "::loadBalanceWithinRankGroup Transpose errors found!"); } - } - unconstrained_to_constrained.setConnectorType(hier::Connector::MAPPING); - - if (d_print_steps) { - tbox::plog - << " TreeLoadBalancer::constrainMaxBoxSizes completed building unconstrained_to_constrained" - << "\n"; + if (d_summarize_map) { + tbox::plog << d_object_name << "::loadBalanceWithinRankGroup: unbalanced--->balanced map:\n" + << unbalanced_to_balanced.format("\t", 0) + << "Map statistics:\n" << unbalanced_to_balanced.formatStatistics("\t") + << d_object_name << "::loadBalanceWithinRankGroup: balanced--->unbalanced map:\n" + << balanced_to_unbalanced.format("\t", 0) + << "Map statistics:\n" << balanced_to_unbalanced.formatStatistics("\t") + << '\n'; } - if (anchor_to_level.isFinalized()) { - // Modify anchor<==>level Connectors and swap box_level with constrained. - const hier::MappingConnectorAlgorithm mca; - mca.modify(anchor_to_level, - level_to_anchor, - unconstrained_to_constrained, - &box_level, - &constrained); + if (balance_to_reference && balance_to_reference->hasTranspose()) { + t_use_map->barrierAndStart(); + d_mca.modify( + balance_to_reference->getTranspose(), + unbalanced_to_balanced, + &balance_box_level, + &balanced_box_level); + t_use_map->barrierAndStop(); } else { - // Swap box_level and constrained without touching anchor<==>level. - hier::BoxLevel::swap(box_level, constrained); + hier::BoxLevel::swap(balance_box_level, balanced_box_level); } - t_map_big_boxes->stop(); + if (d_print_steps) { + tbox::plog << d_object_name << "::LoadBalanceWithinRankGroup: returning" + << std::endl; + } } - - /* ************************************************************************* - * Given an "unbalanced" BoxLevel, compute the BoxLevel that is - * load-balanced and compute the mapping between the unbalanced and - * balanced BoxLevels. - * - * If given a RankGroup with less than all ranks, we treat it as a - * specific user request to balance only within the RankGroup and just - * use the RankGroup as is. Otherwise, we may generate sub-groups - * based on the cycle number and balance within the generated - * sub-group. - * - * The objective of balancing over multiple cycles is to avoid - * unscalable performance in the cases where just a few processes own - * all the initial load. By slowly spreading out the load, no process - * has to set up Connector unbalanced_to_balanced with number of - * relationships that scales with the machine size. - * - * If the local process is not a member of the RankGroup, it does not - * participate in the work and just sets the output objects to be - * locally empty. + * Distribute load on the tree and generate unbalanced<==>balanced + * maps. ************************************************************************* */ void -TreeLoadBalancer::loadBalanceWithinRankGroup( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, +TreeLoadBalancer::distributeLoadAcrossRankGroup( + TransitLoad& balanced_work, + const hier::BoxLevel& unbalanced_box_level, const tbox::RankGroup& rank_group, - const double group_sum_load ) const + double group_sum_load) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, - balance_box_level); - - double group_avg_load = group_sum_load / rank_group.size(); + t_distribute_load_across_rank_group->start(); + TBOX_ASSERT(balanced_work.getNumberOfItems() == 0); + TBOX_ASSERT(balanced_work.getSumLoad() <= d_pparams->getLoadComparisonTol()); - hier::BoxLevel balanced_box_level(balance_box_level.getDim()); - hier::Connector unbalanced_to_balanced; - hier::Connector balanced_to_unbalanced; + double group_avg_load = group_sum_load / rank_group.size(); - /* - * Initialize empty balanced_box_level and mappings. - */ - balanced_box_level.initialize( - balance_box_level.getRefinementRatio(), - balance_box_level.getGridGeometry(), - balance_box_level.getMPI()); - balanced_to_unbalanced.setConnectorType(hier::Connector::MAPPING); - balanced_to_unbalanced.clearNeighborhoods(); - balanced_to_unbalanced.setBase(balanced_box_level); - balanced_to_unbalanced.setHead(balance_box_level); - balanced_to_unbalanced.setWidth(hier::IntVector::getZero(d_dim), true); - unbalanced_to_balanced.setConnectorType(hier::Connector::MAPPING); - unbalanced_to_balanced.clearNeighborhoods(); - unbalanced_to_balanced.setBase(balance_box_level); - unbalanced_to_balanced.setHead(balanced_box_level); - unbalanced_to_balanced.setWidth(hier::IntVector::getZero(d_dim), true); - - - if ( !rank_group.isMember(d_mpi.getRank()) ) { - /* - * The following assert should be guaranteed by an earlier call - * to prebalanceBoxLevel. Having boxes without being in the - * given rank group leads to undefined results. - */ - TBOX_ASSERT( balance_box_level.getLocalNumberOfBoxes() == 0 ); - - if (anchor_to_balance.isFinalized()) { - const hier::MappingConnectorAlgorithm mca; - t_use_map->start(); - mca.modify( - anchor_to_balance, - balance_to_anchor, - unbalanced_to_balanced, - balanced_to_unbalanced, - &balance_box_level, - &balanced_box_level); - t_use_map->stop(); - } else { - hier::BoxLevel::swap(balance_box_level, balanced_box_level); - } - return; + if (d_print_steps) { + tbox::plog.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + tbox::plog.precision(6); + tbox::plog << d_object_name << "::LoadBalanceWithinRankGroup balancing " + << group_sum_load << " units in group of " + << rank_group.size() << " procs, averaging " << group_avg_load + << " or " << pow(group_avg_load, 1.0 / d_dim.getValue()) + << "^" << d_dim << " per proc." + << " Avg is " << group_avg_load + / static_cast(d_pparams->getMinBoxSize().getProduct()) + << " times min size of " << d_pparams->getMinBoxSize() + << std::endl; } - - t_get_map->start(); - - t_load_distribution->start(); - /* * Before the last cycle, it is possible for the group average load * to be below the global average, if the group just happens to have @@ -920,22 +765,39 @@ TreeLoadBalancer::loadBalanceWithinRankGroup( group_avg_load = tbox::MathUtilities::Max(group_avg_load, d_global_avg_load); + // Set parameters governing box breaking. + balanced_work.setAllowBoxBreaking(d_allow_box_breaking); + const double ideal_box_width = pow(group_avg_load, 1.0 / d_dim.getValue()); + balanced_work.setThresholdWidth(1.0 * ideal_box_width); + if (d_print_steps) { + tbox::plog << d_object_name << "::distributeLoadAcrossRankGroup: ideal_box_width = " + << ideal_box_width + << "\n Set threshold width to " << balanced_work.getThresholdWidth() + << std::endl; + } /* - * Arrange the group ranks in a BalancedDepthFirstTree in order to get + * Arrange the group ranks in a rank tree in order to get * the parent/children in the group. - * - * By the way, the BalancedDepthFirstTree currently assumes a binary - * tree, d_degree = 2. */ - TBOX_ASSERT(d_degree == 2); - // FIXME: BalancedDepthFirstTree could use a constructor that takes a RankGroup. - tbox::BalancedDepthFirstTree bdfs(0, - rank_group.size()-1, - rank_group.getMapIndex(d_mpi.getRank()), - true); - const int num_children = bdfs.getNumberOfChildren(); + d_rank_tree->setupTree(rank_group, d_mpi.getRank()); + if (d_print_steps) { + // Write local part of tree to log. + tbox::plog << "TreeLoadBalancer tree:\n" + << " Root rank: " << d_rank_tree->getRootRank() << '\n' + << " Child number: " << d_rank_tree->getChildNumber() << '\n' + << " Generation number: " << d_rank_tree->getGenerationNumber() << '\n' + << " Number of children: " << d_rank_tree->getNumberOfChildren() << '\n' + << " Local relatives: " + << " " << d_rank_tree->getParentRank() << " <- [" << d_rank_tree->getRank() + << "] -> {"; + for (unsigned int i = 0; i < d_rank_tree->getNumberOfChildren(); ++i) { + tbox::plog << ' ' << d_rank_tree->getChildRank(i); + } + tbox::plog << " }" << std::endl; + } + const int num_children = d_rank_tree->getNumberOfChildren(); /* * Communication objects for sending to/receiving from @@ -945,65 +807,58 @@ TreeLoadBalancer::loadBalanceWithinRankGroup( */ tbox::AsyncCommStage child_send_stage; - tbox::AsyncCommPeer* child_sends = NULL; + tbox::AsyncCommPeer* child_sends = 0; tbox::AsyncCommStage parent_send_stage; - tbox::AsyncCommPeer* parent_send = NULL; + tbox::AsyncCommPeer* parent_send = 0; setupAsyncCommObjects( child_send_stage, child_sends, parent_send_stage, parent_send, - rank_group, - bdfs ); + rank_group); child_send_stage.setCommunicationWaitTimer(t_child_send_wait); parent_send_stage.setCommunicationWaitTimer(t_parent_send_wait); tbox::AsyncCommStage child_recv_stage; - tbox::AsyncCommPeer* child_recvs = NULL; + tbox::AsyncCommPeer* child_recvs = 0; tbox::AsyncCommStage parent_recv_stage; - tbox::AsyncCommPeer* parent_recv = NULL; + tbox::AsyncCommPeer* parent_recv = 0; setupAsyncCommObjects( child_recv_stage, child_recvs, parent_recv_stage, parent_recv, - rank_group, - bdfs ); + rank_group); child_recv_stage.setCommunicationWaitTimer(t_child_recv_wait); parent_recv_stage.setCommunicationWaitTimer(t_parent_recv_wait); - - /* - * Outline of the tree load balancing algorithm as implemented: + * Essential outline of the tree load balancing algorithm as implemented: * * 1. For each child of the local process: - * Receive data from subtree rooted at child (number in - * subtree, excess work, remaining work in subtree, etc.). + * Receive data from branch rooted at child (nodes in + * branch, excess work, remaining work in branch, etc.). * - * 2. Compute data for subtree rooted at self by combining - * local data with children subtree data. + * 2. Compute data for branch rooted at self by combining + * local data with children branch data. * * 3. If parent exists: - * Send subtree info (number in subtree, excess work, - * remaining work in subtree, etc.) to parent. + * Send branch info to parent, including work, if any. * * 4. If parent exists and we need more work: * Receive additional work from parent. * - * 5. Partition additional work among children and self. - * - * 6. For each child: - * Send additional work (if any). + * 5. For each child who asked for more work: + * Partition requested work amount and send. */ /* * Step 1: * - * Post receive for data from subtree rooted at children. - * We have to do a few local setups, but post the receive + * Post receive for data from branch rooted at children. + * We have to do some local setup, but post the receive * now to overlap communication. */ t_get_load_from_children->start(); @@ -1017,480 +872,281 @@ TreeLoadBalancer::loadBalanceWithinRankGroup( } t_get_load_from_children->stop(); + // State of the tree, as seen by local process. + BranchData my_branch(*d_pparams, balanced_work); + my_branch.setTimerPrefix(d_object_name); + my_branch.setPrintSteps(d_print_steps); + std::vector child_branches(num_children, my_branch); /* * Step 2, local part: * - * The local process must generate indices for new and imported - * boxes. To do it deterministically, no generated index should - * depend on message arrival order. To achieve this, we maintain - * 2+d_degree values in next_available_index: one for the local - * process, one for the parent and one for each child. The first - * index given to a locally generated Box is some index unused by - * balance_box_level. The first index given to a Box - * from the parent is the same value plus 1. The first index given - * to a box from child 0 is the same value plus 2. And so on. - * Each time a value from next_available_index is used, we - * increment it by 2+d_degree so that the 2+d_degree available - * values can never be the same. Moreover, boxes from a certain - * source always take indices from its own set, independent of when - * boxes from other sources arrive. - */ - std::vector next_available_index(2 + d_degree); - next_available_index[0] = balance_box_level.getLastLocalId() + 1; - - /* - * The next line makes next_available_index[0] divisible by 2+d_degree. - * It is not strictly necessary but makes debugging much easier because - * we can quickly associate any value with the source of its Box. - */ - next_available_index[0] += - hier::LocalId(2+d_degree) - (next_available_index[0] % (2 + d_degree)); - - for (int c = 1; c < d_degree + 2; ++c) { - next_available_index[c] = next_available_index[0] + c; - } - - - /* - * Data for storing and transfering subtree info. + * unassigned is a container of loads that have been released by + * their owners and have not yet been assigned to another. First, + * put all initial local work in unassigned. Received loads are + * placed here before determining whether to keep them or send them + * to another part of the tree. + * + * unassigned is a reference to balanced_work, because at the end + * of the algorithm, everything left unassigned is actually the + * balanced load. */ - SubtreeLoadData* child_load_data = new SubtreeLoadData[num_children]; - SubtreeLoadData my_load_data; + TransitLoad& unassigned(balanced_work); + t_local_load_moves->start(); + unassigned.insertAll(unbalanced_box_level.getBoxes()); + t_local_load_moves->stop(); - /* - * Compute local proc's Boxes and loads and store in - * my_load_data. This will eventually include data for the subtree. - * We will add the rest of the subtree's work when we receive that - * data from the children. - */ - my_load_data.d_num_procs = 1; - my_load_data.d_total_work = static_cast(computeLocalLoads(balance_box_level)); + my_branch.setStartingLoad(group_avg_load, + unassigned.getSumLoad(), + group_avg_load * (1 + d_flexible_load_tol)); + if (d_print_steps) { + tbox::plog.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + tbox::plog.precision(6); + tbox::plog << "Initial local load: "; + unassigned.recursivePrint(tbox::plog, "", 1); + my_branch.recursivePrint(tbox::plog, "", 0); + tbox::plog << std::endl; + } /* - * unassigned is a container of BoxInTransit that has been released by - * a process and has not yet been assigned to another. First, put - * excess local work (if any) in unassigned. Imported - * BoxInTransits are placed here before determining whether to keep - * them or send them to another part of the tree. + * Step 2, remote part: + * + * Finish getting tree and load data from children, incorporate + * its data and add any imported work to unassigned bin. */ - TransitSet unassigned; + t_get_load_from_children->start(); + while (child_recv_stage.hasCompletedMembers() || + child_recv_stage.advanceSome()) { + tbox::AsyncCommPeer* child_recv = + CPP_CAST *>(child_recv_stage.popCompletionQueue()); + TBOX_ASSERT(child_recv != 0); + TBOX_ASSERT(child_recv >= child_recvs); + TBOX_ASSERT(child_recv < child_recvs + num_children); - t_local_balancing->start(); + const int cindex = static_cast(child_recv - child_recvs); + TBOX_ASSERT(cindex >= 0 && cindex < num_children); - if (my_load_data.d_total_work <= group_avg_load) { + // Extract data from the child and store in child_branches[cindex]. + tbox::MessageStream mstream(child_recv->getRecvSize(), + tbox::MessageStream::Read, + child_recv->getRecvData(), + false); - /* - * Local process is underloaded, so put all of balance_box_level into - * the balanced_box_level (and add more later). - */ - const hier::BoxContainer& unbalanced_boxes = - balance_box_level.getBoxes(); - for (hier::BoxContainer::const_iterator ni = unbalanced_boxes.begin(); - ni != unbalanced_boxes.end(); ++ni) { - balanced_box_level.addBox(*ni); + if (d_print_steps) { + tbox::plog << "Unpacking from child " + << cindex << ':' << d_rank_tree->getChildRank(cindex) << ":\n"; } + child_branches[cindex].unpackDataFromChild(mstream); - } else { - /* - * Local process is overloaded, so remove excess loads: - * - sort BoxInTransit by load - * - reassignLoads (put excess loads in unassigned container) and - * - put remainder in balanced_box_level. - * - * Note: This algorithm would also work if we put all local - * Boxes into unassigned (instead of just the excess load). In - * the end, all remaining unassigned Boxes get assigned to the - * local process anyway. In fact, having more Boxes in - * unassigned may let reassignLoads do a better job in - * reassigning loads to children and parents, because it would - * have more choices. The reason we place only the excess load - * into unassigned is to help preserve locality, assuming that - * current local Boxes may have more local neighbors. However, - * practical evidence so far suggest that the lost locality is - * not that bad, at least for explicit solvers. Transfering all - * local Boxes into unassigned at the start may affect the - * performance of this algorithms though, because it bypasses - * one reassignLoads call but makes the unassigned Box set - * bigger, which may make other calls to reassignLoads work - * harder. Which one is a bigger effect and whether there are - * any significant effects at all remains to be seen. - */ + t_local_load_moves->start(); + my_branch.incorporateChild(child_branches[cindex]); + child_branches[cindex].moveInboundLoadToReserve(unassigned); + t_local_load_moves->stop(); - const hier::BoxContainer& unbalanced_boxes = - balance_box_level.getBoxes(); - - int ideal_transfer = int(0.5 + my_load_data.d_total_work - group_avg_load); - - if (d_print_steps) { - tbox::plog << "Reassigning initial overload of " << ideal_transfer - << " to unassigned.\n"; - } - - TransitSet - local_loads(unbalanced_boxes.begin(), unbalanced_boxes.end()); - - int actual_transfer = reassignLoads( - local_loads, - unassigned, - next_available_index[d_degree], - ideal_transfer ); - - for (TransitSet::const_iterator - ni = local_loads.begin(); ni != local_loads.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - balanced_box_level.addBox(box_in_transit.d_box); - /* - * Create edges only for box_in_transit that changed. - */ - if (box_in_transit.d_box.getLocalId() != - box_in_transit.d_orig_box.getLocalId()) { - balanced_to_unbalanced.insertLocalNeighbor( - box_in_transit.d_orig_box, - box_in_transit.d_box.getId()); - unbalanced_to_balanced.insertLocalNeighbor( - box_in_transit.d_box, - box_in_transit.d_orig_box.getId()); - } - } - /* - * unassigned now contains boxes originating from unbalanced, so - * they need a neighborhood in unbalanced_to_balanced. We don't - * know where they'll end up, so we just leave the neighborhood - * empty for now. - */ - for (TransitSet::const_iterator ni=unassigned.begin(); ni!=unassigned.end(); ++ni ) { - unbalanced_to_balanced.makeEmptyLocalNeighborhood(ni->d_orig_box.getId()); - } - - if (d_print_steps) { - tbox::plog << " Unassigning " << unassigned.size() - << " boxes (" << actual_transfer << " / " - << ideal_transfer << " units):"; - for (TransitSet::const_iterator - ni = unassigned.begin(); ni != unassigned.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; - } - } - - t_local_balancing->stop(); + } + // We should have received everything by this point. + TBOX_ASSERT(!child_recv_stage.hasPendingRequests()); + size_t unassigned_highwater = unassigned.getNumberOfItems(); /* - * Step 2, remote part: - * - * Finish getting tree and load data from children. - * Add imported BoxInTransit to unassigned bin. + * TODO: Maybe this should be deficit() or + * max(deficit(),effDeficit()) instead of effDeficit(). The + * argument for using deficit() is: if a branch ends up underloaded + * (for any reason) its deficit should be kept within its parent's + * branch. The argument for using effDeficit() is: if part of the + * branch took more work, the rest of the branch should take the + * fair share because it can be done without aggravating overloads + * and it would help keeping the parent branch's work within the + * parent's branch (preserve locality). Not using deficit() to + * decide to get work from parent may be responsible for the 20% + * unbalance observed at 1M procs. There should be a corresponding + * change to computeSurplusPerEffectiveDescendent(). */ - t_get_load_from_children->start(); - while ( child_recv_stage.numberOfCompletedMembers() > 0 || - child_recv_stage.advanceSome() ) { - - tbox::AsyncCommPeer* child_recv = - dynamic_cast *>(child_recv_stage.popCompletionQueue()); - - TBOX_ASSERT(child_recv != NULL); - TBOX_ASSERT(child_recv >= child_recvs); - TBOX_ASSERT(child_recv < child_recvs + num_children); - - const int cindex = static_cast(child_recv - child_recvs); - - TBOX_ASSERT(cindex >= 0 && cindex < num_children); - - /* - * Extract data from the child cindex, storing it in - * child_load_data[cindex]. If child sent up any excess Box, - * put them in unassigned. - */ - int old_size = static_cast(unassigned.size()); - tbox::MessageStream mstream(child_recv->getRecvSize(), - tbox::MessageStream::Read, - child_recv->getRecvData(), - false); - unpackSubtreeLoadData( - child_load_data[cindex], - unassigned, - next_available_index[cindex], - mstream); - - child_load_data[cindex].d_ideal_work = - int(group_avg_load * child_load_data[cindex].d_num_procs + 0.5); - - if (d_print_steps) { - TransitSet::const_iterator - ni = unassigned.begin(); - for (int ii = 0; ii < old_size; ++ii) { ++ni; } - if (d_print_steps) { - tbox::plog << "Got " << unassigned.size() - old_size - << " boxes (" << child_load_data[cindex].d_load_imported - << " units) from child " - << child_recv->getPeerRank() << ":"; - for ( ; ni != unassigned.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - tbox::plog << " " << box_in_transit; - } - tbox::plog << std::endl; - } - } - - // Sum children load into my_load_data. - my_load_data.d_num_procs += child_load_data[cindex].d_num_procs; - my_load_data.d_total_work += - child_load_data[cindex].d_total_work - + child_load_data[cindex].d_load_imported; - + if (my_branch.effDeficit() > 0 && !d_rank_tree->isRoot()) { + my_branch.setWantsWorkFromParent(); } - - - // We should have received everything at this point. - TBOX_ASSERT(!child_recv_stage.hasPendingRequests()); - - my_load_data.d_ideal_work = int(group_avg_load * my_load_data.d_num_procs + 0.5); - if (d_print_steps) { - tbox::plog << "Received children subtree data." << std::endl; + tbox::plog << "Received children branch data." << std::endl; for (int c = 0; c < num_children; ++c) { - tbox::plog << "Child " << child_recvs[c].getPeerRank() - << " subtree data: " << child_load_data[c].d_total_work - << "/" << child_load_data[c].d_ideal_work - << " for " << child_load_data[c].d_num_procs << " procs averaging " - << child_load_data[c].d_total_work / child_load_data[c].d_num_procs - << " after sending up " << child_load_data[c].d_load_imported - << std::endl; + tbox::plog << "Child " + << c << ':' << d_rank_tree->getChildRank(c) + << " branch:\n"; + child_branches[c].recursivePrint(tbox::plog, " "); } - tbox::plog << "Initial subtree data: " << my_load_data.d_total_work - << " / " << my_load_data.d_ideal_work - << " for " << my_load_data.d_num_procs << " procs averaging " - << my_load_data.d_total_work / my_load_data.d_num_procs - << " before sending up anything." - << std::endl; + tbox::plog << "Initial branch:\n"; + my_branch.recursivePrint(tbox::plog, " "); + tbox::plog << "unassigned: "; + unassigned.recursivePrint(tbox::plog, " ", 1); } t_get_load_from_children->stop(); - - /* * Step 3: * - * Send subtree info and excess work (if any) up to parent. + * Send to parent (if any) branch info and excess work. */ t_send_load_to_parent->start(); - if (parent_send != NULL) { + if (parent_send != 0) { - /* - * Compute the excess work we want to send to parent. - * If it's positive, reassign some boxes to the parent. - */ - LoadType ideal_transfer = my_load_data.d_total_work > my_load_data.d_ideal_work ? - my_load_data.d_total_work - my_load_data.d_ideal_work : 0; + if (my_branch.effExcess() > 0) { - if (ideal_transfer > 0) { + /* + * Try to send work in the range of [effective excess,surplus]. + * Sending less than effective excess would overload this branch. + * Sending more than the surplus would overload its complement. + * + * It is possible to have effective excess > surplus. In + * these cases, don't send more than the surplus, because + * that would overload the complement of this branch. It is + * better to overload this branch than to progressively push + * unwanted load up the tree, making the root extremely + * overloaded. Keeping the overload in the branch also + * maintains some data locality. + */ + const LoadType export_load_low = tbox::MathUtilities::Min( + my_branch.effExcess(), my_branch.surplus()); + const LoadType export_load_high = my_branch.surplus(); + const LoadType export_load_ideal = my_branch.surplus(); if (d_print_steps) { - tbox::plog << "Attempting to reassign " << ideal_transfer - << " of unassigned load to parent.\n"; + tbox::plog << "Pushing to parent rank " + << d_rank_tree->getParentRank() << ' ' << export_load_ideal + << " [" << export_load_low << ", " << export_load_high << ']' + << std::endl; } - int actual_transfer = reassignLoads( + t_local_load_moves->start(); + my_branch.adjustOutboundLoad( unassigned, - my_load_data.d_for_export /* to parent */, - next_available_index[d_degree], - ideal_transfer ); - my_load_data.d_load_exported = actual_transfer; - my_load_data.d_total_work -= actual_transfer; - - if (d_print_steps) { - tbox::plog << "Giving " << my_load_data.d_for_export.size() - << " boxes (" << actual_transfer << " / " - << ideal_transfer << " units) to parent " - << parent_send->getPeerRank() << ":"; - for (TransitSet::const_iterator - ni = my_load_data.d_for_export.begin(); - ni != my_load_data.d_for_export.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; - } + export_load_ideal, + export_load_low, + export_load_high); + t_local_load_moves->stop(); } - /* - * Send local process's load info, along with any exported work, - * up to parent. - */ tbox::MessageStream mstream; - packSubtreeLoadData(mstream, my_load_data); + my_branch.packDataToParent(mstream); parent_send->setSendTimer(t_parent_send_wait); parent_send->setWaitTimer(t_parent_send_wait); - parent_send->beginSend(static_cast(mstream.getBufferStart()), - static_cast(mstream.getCurrentSize())); + parent_send->beginSend(static_cast(mstream.getBufferStart()), + static_cast(mstream.getCurrentSize())); } t_send_load_to_parent->stop(); - - /* * Step 4: * - * Finish the send-up. - * To preclude sending work in both directions, the parent - * will *not* send a work message down if we sent work up. + * Get work from parent, if any. */ - if (parent_send != NULL && my_load_data.d_load_exported == 0) { - t_parent_load_comm->start(); + if (my_branch.getWantsWorkFromParent()) { t_get_load_from_parent->start(); parent_recv->setRecvTimer(t_parent_recv_wait); parent_recv->setWaitTimer(t_parent_recv_wait); - parent_recv->beginRecv(); - - t_get_load_from_parent->stop(); - t_parent_load_comm->stop(); - } - - - /* - * May do some things here that do not depend on message from - * parents. Steve Smith suggested sending work down to underloaded - * children at this point, even if it makes the local process - * underloaded as a result. The local process can recover the - * correct amount of work when it comes down from the parent. This - * would allow some children subtrees to wait less, but it has - * other consequences. - */ - - - if (parent_recv != NULL && my_load_data.d_load_exported == 0) { - - /* - * Receive and unpack message from parent. Since we did not - * export work to parent, parent may import some to us. Put - * imported work in unassigned. - */ - t_get_load_from_parent->start(); + parent_recv->beginRecv(); parent_recv->completeCurrentOperation(); - int old_size = static_cast(unassigned.size()); - SubtreeLoadData parent_load_data; + if (d_print_steps) { + tbox::plog << "Received from parent " << d_rank_tree->getParentRank() + << "... Unpacking." << std::endl; + } + tbox::MessageStream mstream(parent_recv->getRecvSize(), tbox::MessageStream::Read, parent_recv->getRecvData(), false); - unpackSubtreeLoadData( - parent_load_data, - unassigned, - next_available_index[1 + d_degree], - mstream); - my_load_data.d_load_imported = parent_load_data.d_load_imported; - my_load_data.d_total_work += parent_load_data.d_load_imported; + my_branch.unpackDataFromParentAndIncorporate(mstream); - if (d_print_steps) { - TransitSet::const_iterator - ni = unassigned.begin(); - for (int i = 0; i < old_size; ++i) { - ++ni; - } - if (d_print_steps) { - tbox::plog << "Got " << unassigned.size() - old_size - << " boxes (" << parent_load_data.d_load_imported - << " units) from parent " - << parent_recv->getPeerRank() << ":"; - for ( ; ni != unassigned.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - tbox::plog << " " << box_in_transit; - } - tbox::plog << std::endl; - } + t_local_load_moves->start(); + my_branch.moveInboundLoadToReserve(unassigned); + t_local_load_moves->stop(); + + if (unassigned_highwater < unassigned.getNumberOfItems()) { + unassigned_highwater = unassigned.getNumberOfItems(); } t_get_load_from_parent->stop(); + } else { + if (d_print_steps) { + tbox::plog << "Did not request work from parent.\n"; + } } if (d_print_steps) { - tbox::plog << " After parent, my total work is " - << my_load_data.d_total_work << " / " - << my_load_data.d_ideal_work - << ", unassigned ammount is " - << sumWorkInBoxes(unassigned.begin(),unassigned.end()) - << std::endl; + tbox::plog << "Postparent branch:\n"; + my_branch.recursivePrint(tbox::plog, " "); + tbox::plog << "unassigned: "; + unassigned.recursivePrint(tbox::plog, " ", 1); } - /* - * Step 5 and 6: + * Step 5: * - * Reassign unassigned load to children subtrees as needed. + * Reassign and send work to each child that requested work. */ t_send_load_to_children->start(); for (int ichild = 0; ichild < num_children; ++ichild) { - SubtreeLoadData& recip_data = child_load_data[ichild]; + BranchData& recip_branch = child_branches[ichild]; - /* - * Note: To preclude unneeded messages, we do *not* send a work - * message down if the child sent work up to us. - */ - if (recip_data.d_load_imported == 0) { + if (recip_branch.getWantsWorkFromParent()) { - LoadType ideal_transfer = recip_data.d_ideal_work - recip_data.d_total_work; - LoadType actual_transfer = 0; + const LoadType surplus_per_eff_des = + computeSurplusPerEffectiveDescendent( + unassigned.getSumLoad(), + group_avg_load, + child_branches, + ichild); - if (d_print_steps) { - tbox::plog << "Attempting to reassign " << ideal_transfer - << " of unassigned load to child " - << child_sends[ichild].getPeerRank() << "\n"; - } + const LoadType export_load_ideal = recip_branch.effDeficit() + + (surplus_per_eff_des < 0.0 ? 0.0 : + surplus_per_eff_des * recip_branch.numProcsEffective()); - if (ideal_transfer > 0) { - actual_transfer = reassignLoads( - unassigned, - recip_data.d_for_export, - next_available_index[d_degree], - ideal_transfer ); - recip_data.d_load_exported += actual_transfer; - recip_data.d_total_work += actual_transfer; - } + const LoadType export_load_low = recip_branch.effDeficit() + + surplus_per_eff_des * recip_branch.numProcsEffective(); + + const LoadType export_load_high = + tbox::MathUtilities::Max(export_load_ideal, + recip_branch.effMargin()); if (d_print_steps) { - tbox::plog << "Giving " << recip_data.d_for_export.size() - << " boxes (" << actual_transfer << " / " << ideal_transfer - << " units) to child " << ichild << ':' - << child_sends[ichild].getPeerRank() << " for " - << recip_data.d_num_procs - << " procs:"; - for (TransitSet::const_iterator ni = recip_data.d_for_export.begin(); - ni != recip_data.d_for_export.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; + tbox::plog << "Pushing to child " << ichild << " (" + << d_rank_tree->getChildRank(ichild) << ") " << export_load_ideal + << " [" << export_load_low << ", " << export_load_high << ']' + << std::endl; } - tbox::MessageStream mstream; - packSubtreeLoadData(mstream, recip_data); - child_recvs[ichild].setSendTimer(t_child_send_wait); - child_recvs[ichild].setWaitTimer(t_child_send_wait); - child_sends[ichild].beginSend(static_cast(mstream.getBufferStart()), - static_cast(mstream.getCurrentSize())); + t_local_load_moves->start(); + recip_branch.adjustOutboundLoad( + unassigned, + export_load_ideal, + export_load_low, + export_load_high); + t_local_load_moves->stop(); if (d_print_steps) { - tbox::plog << " After child " << ichild - << ':' << child_sends[ichild].getPeerRank() - << ", unassigned ammount is " - << sumWorkInBoxes(unassigned.begin(),unassigned.end()) + tbox::plog << "Packing data to child " + << ichild << ':' << d_rank_tree->getChildRank(ichild) << std::endl; } + tbox::MessageStream mstream; + recip_branch.packDataToChild(mstream); + child_sends[ichild].setSendTimer(t_child_send_wait); + child_sends[ichild].setWaitTimer(t_child_send_wait); + child_sends[ichild].beginSend(static_cast(mstream.getBufferStart()), + static_cast(mstream.getCurrentSize())); } @@ -1498,613 +1154,302 @@ TreeLoadBalancer::loadBalanceWithinRankGroup( t_send_load_to_children->stop(); + if (d_print_steps) { + tbox::plog << "After settling parent and children, unassigned is: "; + unassigned.recursivePrint(tbox::plog, " ", 1); + tbox::plog << "Final local load (normalized) is " + << (balanced_work.getSumLoad() / group_avg_load) + << ", surplus = " << (balanced_work.getSumLoad() - group_avg_load) + << ", excess = " + << (balanced_work.getSumLoad() - (1 + d_flexible_load_tol) * group_avg_load) + << std::endl; + tbox::plog << "Final branch:\n"; + my_branch.recursivePrint(tbox::plog, " "); - /* - * All unassigned boxes should go into balanced_box_level. - * - * Put unassigned boxes into balanced_box_level and generate - * relationships in balanced<==>unbalanced mapping Connectors where - * required. - * - * We remove boxes from unassigned when we no longer need to keep - * track of them. We do leave behind boxes originating remotely so - * we can later notify the originating processes about where the - * box finally ended up. - */ - t_local_balancing->start(); - - for (TransitSet::iterator - ni = unassigned.begin(); - ni != unassigned.end(); /* incremented in loop */) { - - const BoxInTransit& box_in_transit = *ni; - balanced_box_level.addBox(box_in_transit.d_box); - - if (box_in_transit.d_box.isIdEqual(box_in_transit.d_orig_box)) { - // Unchanged box requires no mapping. Nothing else need to be done. - TBOX_ASSERT( unbalanced_to_balanced.isEmptyNeighborhood(ni->d_box.getId()) ); - unbalanced_to_balanced.eraseLocalNeighborhood(ni->d_box.getId()); - unassigned.erase(ni++); - } else { - - balanced_to_unbalanced.insertLocalNeighbor( - box_in_transit.d_orig_box, - box_in_transit.d_box.getId()); - - if (box_in_transit.d_orig_box.getOwnerRank() == d_mpi.getRank()) { - unbalanced_to_balanced.insertLocalNeighbor( - box_in_transit.d_box, - box_in_transit.d_orig_box.getId()); - unassigned.erase(ni++); - } - else { - // Leave this box in unassigned for notifying originating - // process of where it landed. - ++ni; - } + for (int ichild = 0; ichild < num_children; ++ichild) { + tbox::plog << "Final child " + << ichild << ":" << d_rank_tree->getChildRank(ichild) + << " branch:\n"; + child_branches[ichild].recursivePrint(tbox::plog, " "); } - } - t_local_balancing->stop(); - - t_load_distribution->stop(); - - /* * Finish messages before starting edge info exchange. * We have only sends to complete, so it should not take * long to advance them all to completion. */ + if (d_print_steps) { + tbox::plog << d_object_name + << "::loadBalanceWithinRankGroup: waiting for sends to complete.\n"; + } + t_finish_sends->start(); - child_send_stage.advanceAll(); parent_send_stage.advanceAll(); - t_finish_sends->stop(); - child_send_stage.clearCompletionQueue(); parent_send_stage.clearCompletionQueue(); + child_send_stage.advanceAll(); + child_send_stage.clearCompletionQueue(); + t_finish_sends->stop(); + #ifdef DEBUG_CHECK_ASSERTIONS for (int i = 0; i < num_children; ++i) { TBOX_ASSERT(child_sends[i].isDone()); TBOX_ASSERT(child_recvs[i].isDone()); } - if (parent_send != NULL) { + if (parent_send != 0) { TBOX_ASSERT(parent_send->isDone()); TBOX_ASSERT(parent_recv->isDone()); } #endif - - - constructSemilocalUnbalancedToBalanced( - unbalanced_to_balanced, - unassigned ); - - if ( d_summarize_map ) { - tbox::plog << "TreeLoadBalancer::loadBalanceWithinRankGroup unbalanced--->balanced map:\n" - << unbalanced_to_balanced.format("\t",0) - << "Map statistics:\n" << unbalanced_to_balanced.formatStatistics("\t") - << "TreeLoadBalancer::loadBalanceWithinRankGroup balanced--->unbalanced map:\n" - << balanced_to_unbalanced.format("\t",0) - << "Map statistics:\n" << balanced_to_unbalanced.formatStatistics("\t") - << '\n'; + if (d_print_steps) { + tbox::plog << d_object_name << "::loadBalanceWithinRankGroup: completed sends.\n"; } + if (d_comm_graph_writer) { + /* + * To evaluate performance of the algorithm, record these edges: + * - Two edges to parent: load shipped, and items shipped. + * - Same two edges from parent, plus one more for message size. + * - Two timer for edges from children, one from parent. + * Record these nodes: + * - Number of final boxes: + */ + d_comm_graph_writer->addRecord(d_mpi, size_t(10), size_t(7)); + + const int prank = (d_rank_tree->isRoot() ? -1 : d_rank_tree->getParentRank()); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(0), + "load up", + double(my_branch.getWantsWorkFromParent() ? 0 : my_branch.getShipmentLoad()), + tbox::CommGraphWriter::TO, + prank); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(1), + "items up", + double(my_branch.getWantsWorkFromParent() ? 0 : my_branch.getShipmentPackageCount()), + tbox::CommGraphWriter::TO, + prank); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(2), + "origins up", + double(my_branch.getWantsWorkFromParent() ? 0 : my_branch.getShipmentOriginatorCount()), + tbox::CommGraphWriter::TO, + prank); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(3), + "load down", + double(my_branch.getWantsWorkFromParent() ? my_branch.getShipmentLoad() : 0), + tbox::CommGraphWriter::FROM, + (my_branch.getWantsWorkFromParent() ? prank : -1)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(4), + "items down", + double(my_branch.getWantsWorkFromParent() ? my_branch.getShipmentPackageCount() : 0), + tbox::CommGraphWriter::FROM, + (my_branch.getWantsWorkFromParent() ? prank : -1)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(5), + "origins down", + double(my_branch.getWantsWorkFromParent() ? my_branch.getShipmentOriginatorCount() : 0), + tbox::CommGraphWriter::FROM, + (my_branch.getWantsWorkFromParent() ? prank : -1)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(6), + "bytes down", + double(my_branch.getWantsWorkFromParent() ? parent_recv->getRecvSize() : int(0)), + tbox::CommGraphWriter::FROM, + (my_branch.getWantsWorkFromParent() ? prank : -1)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(7), + "child wait", + t_child_recv_wait->getTotalWallclockTime(), + tbox::CommGraphWriter::FROM, + d_rank_tree->getChildRank(0)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(8), + "child wait", + t_child_recv_wait->getTotalWallclockTime(), + tbox::CommGraphWriter::FROM, + d_rank_tree->getChildRank(1)); + + d_comm_graph_writer->setEdgeInCurrentRecord( + size_t(9), + "parent wait", + t_parent_recv_wait->getTotalWallclockTime(), + tbox::CommGraphWriter::FROM, + (my_branch.getWantsWorkFromParent() ? prank : -1)); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(0), + "initial box count", + double(unbalanced_box_level.getLocalNumberOfBoxes())); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(1), + "initial load", + double(unbalanced_box_level.getLocalNumberOfCells()) / group_avg_load); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(2), + "final box count", + double(balanced_work.getNumberOfItems())); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(3), + "final load", + double(balanced_work.getSumLoad()) / group_avg_load); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(4), + "final surplus", + double(balanced_work.getSumLoad()) - group_avg_load); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(5), + "branch surplus", + double(my_branch.surplus())); + + d_comm_graph_writer->setNodeValueInCurrentRecord( + size_t(6), + "unassigned highwater", + double(unassigned_highwater)); - if (d_check_connectivity) { - const hier::OverlapConnectorAlgorithm oca; - tbox::plog - << "TreeLoadBalancer checking unbalanced-balanced connectivity." - << std::endl; - int errs = 0; - if (oca.checkOverlapCorrectness(unbalanced_to_balanced, true, true)) { - ++errs; - tbox::perr << "Error found in unbalanced_to_balanced!\n"; - } - if (oca.checkOverlapCorrectness(balanced_to_unbalanced, true, true)) { - ++errs; - tbox::perr << "Error found in balanced_to_unbalanced!\n"; - } - if (unbalanced_to_balanced.checkTransposeCorrectness( - balanced_to_unbalanced)) { - ++errs; - tbox::perr << "Error found in balanced-unbalanced transpose!\n"; - } - if (errs != 0) { - TBOX_ERROR( - "Errors in load balance mapping found." - << "balance_box_level:\n" << balance_box_level.format("", 2) - << "balanced_box_level:\n" << balanced_box_level.format("", 2) - << "unbalanced_to_balanced:\n" << unbalanced_to_balanced.format("", 2) - << "balanced_to_unbalanced:\n" << balanced_to_unbalanced.format("", 2)); - } - } - - if (d_check_map) { - const hier::MappingConnectorAlgorithm mca; - if (mca.findMappingErrors(unbalanced_to_balanced) != 0) { - TBOX_ERROR( - "TreeLoadBalancer::loadBalanceWithinRankGroup Mapping errors found in unbalanced_to_balanced!"); - } - if (unbalanced_to_balanced.checkTransposeCorrectness( - balanced_to_unbalanced)) { - TBOX_ERROR( - "TreeLoadBalancer::loadBalanceWithinRankGroup Transpose errors found!"); - } } - - delete[] child_load_data; destroyAsyncCommObjects(child_sends, parent_send); destroyAsyncCommObjects(child_recvs, parent_recv); - t_get_map->stop(); - - if (anchor_to_balance.isFinalized()) { - t_use_map->start(); - const hier::MappingConnectorAlgorithm mca; - mca.modify( - anchor_to_balance, - balance_to_anchor, - unbalanced_to_balanced, - balanced_to_unbalanced, - &balance_box_level, - &balanced_box_level); - t_use_map->stop(); - } else { - hier::BoxLevel::swap(balance_box_level, balanced_box_level); - } - - return; + t_distribute_load_across_rank_group->stop(); } - - /* ************************************************************************* + * Compute the surplus per descendent in the effective tree rooted at + * the local process. This surplus, if any, is the difference between + * the available load_for_descendents, spread over those descendents. * - * This is the tree load balancer's reassignment method, essentially a - * two-bin load balancer. Given two sets of BoxInTransit (the bins) - * and an amount of work to move from one set to the other, this - * method makes a best effort to effect the work transfer between the - * two bins. It can move BoxInTransit between given sets and, if - * needed, break some BoxInTransit up to move part of the work. - * - * This method is purely local--it reassigns the load but does not - * communicate the change to any remote process. - * + * Surplus per descendent will be zero if we don't need to push surplus + * work to children. ************************************************************************* */ TreeLoadBalancer::LoadType -TreeLoadBalancer::reassignLoads( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - LoadType ideal_transfer ) const +TreeLoadBalancer::computeSurplusPerEffectiveDescendent( + const LoadType& unassigned_load, + const LoadType& group_avg_load, + const std::vector& child_branches, + int first_child) const { - if (d_print_steps) { - tbox::plog << " reassignLoads attempting to reassign " - << ideal_transfer << " from src to dst." - << std::endl; - } - - int actual_transfer = 0; - - if ((ideal_transfer >= 0 && src.empty()) || - (ideal_transfer <= 0 && dst.empty())) { - return actual_transfer; - } + const LoadType load_for_me = group_avg_load * (1 + d_flexible_load_tol); - t_reassign_loads->start(); + const LoadType load_for_descendents = unassigned_load - load_for_me; - /* - * The algorithm cycles through a do-loop. Each time around, we try - * to swap some BoxInTransit between src and dst until we cannot improve the - * actual_transfer any further. Then, we try breaking up some BoxInTransit to - * improve the results. If we break some BoxInTransit, we generate some more - * swapping options that were not there before, so we loop back to - * try swapping again. - * - * If a break phase does not break any Box (and does not generate more - * swap options), the loop will stop making changes. We exit the loop - * at that point (and whenever we reached the ideal transfer). - */ - do { - - /* - * Try to balance load through swapping. - */ - int swap_transfer = shiftLoadsBySwapping( - src, - dst, - ideal_transfer - actual_transfer ); - - actual_transfer += swap_transfer; - - if (d_print_steps) { - double balance_penalty = computeBalancePenalty( - src, - dst, - actual_transfer - ideal_transfer); - tbox::plog << " Balance penalty after shiftLoadsBySwapping = " - << balance_penalty - << ", needs " << (ideal_transfer - actual_transfer) - << " more with " << src.size() << " source and " - << dst.size() << " dst Boxes remaining." - << std::endl; - } - - if (actual_transfer == ideal_transfer) break; - - /* - * Assuming that we did the best we could, swapping - * some BoxInTransit without breaking any, we now break up a Box - * in the overloaded side for partial transfer to the - * underloaded side. - */ - int brk_transfer = shiftLoadsByBreaking( - src, - dst, - next_available_index, - ideal_transfer - actual_transfer ); - actual_transfer += brk_transfer; - - if (d_print_steps) { - double balance_penalty = computeBalancePenalty( - src, - dst, - actual_transfer - ideal_transfer); - tbox::plog << " Balance penalty after shiftLoadsByBreaking = " - << balance_penalty - << ", needs " << (ideal_transfer - actual_transfer) - << " more with " << src.size() << " source and " - << dst.size() << " dst Boxes remaining." - << std::endl; - } - if (brk_transfer == 0) { - /* - * If no box can be broken to improve the actual_transfer, - * there is nothing further we can do. The swap phase, tried - * before the break phase, also generated no transfer, so - * there's no point trying again. Break out now to save - * retrying the swap phase. - */ - break; + LoadType ideal_export_to_children = 0.0; + int num_effective_des = 0; + for (size_t ichild = first_child; ichild < child_branches.size(); ++ichild) { + if (child_branches[ichild].getWantsWorkFromParent()) { + ideal_export_to_children += child_branches[ichild].effDeficit(); + num_effective_des += child_branches[ichild].numProcsEffective(); } + } - /* - * Now that we have broken up a Box, redo this loop to - * see if swapping can produce a better result. - */ - } while (ideal_transfer != actual_transfer); + const LoadType surplus_per_effective_descendent = + (load_for_descendents - ideal_export_to_children) / num_effective_des; - t_reassign_loads->stop(); + if (d_print_steps) { + tbox::plog << "load_for_me = " << load_for_me + << ", load_for_descendents = " << load_for_descendents + << ", num_effective_des = " << num_effective_des + << ", ideal_export_to_children = " << ideal_export_to_children + << ", surplus_per_effective_descendent " << surplus_per_effective_descendent + << std::endl; + } - return actual_transfer; + return surplus_per_effective_descendent; } - - /* ************************************************************************* + * Set the MPI commuicator. If there's a private communicator, free + * it first. It's safe to free the private communicator because no + * other code have access to it. ************************************************************************* */ void -TreeLoadBalancer::packSubtreeLoadData( - tbox::MessageStream& msg, - const SubtreeLoadData& load_data) const +TreeLoadBalancer::setSAMRAI_MPI( + const tbox::SAMRAI_MPI& samrai_mpi) { - t_pack_load->start(); - msg << load_data.d_num_procs; - msg << load_data.d_total_work; - msg << load_data.d_load_exported; - const TransitSet& for_export = load_data.d_for_export; - msg << static_cast(for_export.size()); - for (TransitSet::const_iterator - ni = for_export.begin(); ni != for_export.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - box_in_transit.putToMessageStream(msg); + if (samrai_mpi.getCommunicator() == tbox::SAMRAI_MPI::commNull) { + TBOX_ERROR(d_object_name << "::setSAMRAI_MPI error: Given\n" + << "communicator is invalid."); + } + + if (d_mpi_is_dupe) { + d_mpi.freeCommunicator(); } - t_pack_load->stop(); -} + // Enable private communicator. + d_mpi.dupCommunicator(samrai_mpi); + d_mpi_is_dupe = true; + d_mca.setSAMRAI_MPI(d_mpi, true); +} /* ************************************************************************* + * Set the MPI commuicator. ************************************************************************* */ void -TreeLoadBalancer::unpackSubtreeLoadData( - SubtreeLoadData& load_data, - TransitSet& receiving_bin, - hier::LocalId& next_available_index, - tbox::MessageStream &msg ) const +TreeLoadBalancer::freeMPICommunicator() { - t_unpack_load->start(); - int num_boxes = 0; - msg >> load_data.d_num_procs; - msg >> load_data.d_total_work; - msg >> load_data.d_load_imported; - msg >> num_boxes; - /* - * As we pull each BoxInTransit out, give it a new id that reflects - * its new owner. Place the BoxInTransits in the receiving_bin. - */ - BoxInTransit received_box(d_dim); - for (int i = 0; i < num_boxes; ++i) { - received_box.getFromMessageStream(msg); - BoxInTransit renamed_box(received_box, - received_box.getBox(), - d_mpi.getRank(), - next_available_index); - next_available_index += 2 + d_degree; - receiving_bin.insert(renamed_box); + if (d_mpi_is_dupe && d_mpi.getCommunicator() != MPI_COMM_NULL) { + // Free the private communicator (if MPI has not been finalized). + int flag; + tbox::SAMRAI_MPI::Finalized(&flag); + if (!flag) { + d_mpi.freeCommunicator(); + } } - t_unpack_load->stop(); + d_mpi.setCommunicator(tbox::SAMRAI_MPI::commNull); + d_mpi_is_dupe = false; } - - - - /* ************************************************************************* - * Construct semilocal relationships in unbalanced--->balanced - * Connector. + * Create cycle-dependent groups to partition within. Cycle fraction + * is how far along we are in the number of cycles. A value of 1 means + * the last cycle. Group size grows exponentially with cycle fraction + * and includes all processes when cycle fraction is 1 (thus partitioning + * is done across all prcesses). * - * Determine edges in unbalanced_to_balanced by sending balanced - * BoxInTransit back to the owners of the unbalanced Boxes that - * originated them. We don't know what ranks will send back the - * balanced boxes, so we keep receiving messages from any rank until - * we have accounted for all the cells in the unbalanced BoxLevel. - ************************************************************************* - */ -void -TreeLoadBalancer::constructSemilocalUnbalancedToBalanced( - hier::Connector &unbalanced_to_balanced, - const TreeLoadBalancer::TransitSet &kept_imports ) const -{ - t_construct_semilocal->start(); - - // Stuff the imported BoxInTransits into buffers by their original owners. - t_pack_edge->start(); - std::map > outgoing_messages; - for ( TransitSet::const_iterator bi=kept_imports.begin(); - bi!=kept_imports.end(); ++bi ) { - const BoxInTransit &bit = *bi; - boost::shared_ptr &mstream = outgoing_messages[bit.d_orig_box.getOwnerRank()]; - if ( !mstream ) { - mstream.reset(new tbox::MessageStream); - } - bit.putToMessageStream(*mstream); - } - t_pack_edge->stop(); - - - /* - * Send outgoing_messages. Optimization for mitigating contention: - * Start by sending to the first recipient with a rank higher than - * the local rank. - */ - - std::map >::iterator recip_itr = - outgoing_messages.upper_bound(d_mpi.getRank()); - if ( recip_itr == outgoing_messages.end() ) { - recip_itr = outgoing_messages.begin(); - } - - int outgoing_messages_size = static_cast(outgoing_messages.size()); - std::vector - send_requests( outgoing_messages_size, MPI_REQUEST_NULL ); - for ( int send_number = 0; send_number < outgoing_messages_size; ++send_number ) { - - int recipient = recip_itr->first; - tbox::MessageStream &mstream = *recip_itr->second; - - d_mpi.Isend( - (void*)(mstream.getBufferStart()), - static_cast(mstream.getCurrentSize()), - MPI_CHAR, - recipient, - TreeLoadBalancer_EDGETAG0, - &send_requests[send_number]); - - ++recip_itr; - if ( recip_itr == outgoing_messages.end() ) { - recip_itr = outgoing_messages.begin(); - } - - } - - - /* - * Determine number of cells in unbalanced that are not yet accounted - * for in balanced. - */ - int num_unaccounted_cells = static_cast( - unbalanced_to_balanced.getBase().getLocalNumberOfCells()); - - const hier::BoxContainer &unbalanced_boxes = unbalanced_to_balanced.getBase().getBoxes(); - for ( hier::BoxContainer::const_iterator bi=unbalanced_boxes.begin(); - bi!=unbalanced_boxes.end(); ++bi ) { - - const hier::Box &unbalanced_box = *bi; - - hier::Connector::ConstNeighborhoodIterator neighborhood_itr = - unbalanced_to_balanced.findLocal(unbalanced_box.getId()); - - if ( neighborhood_itr != unbalanced_to_balanced.end() ) { - - for ( hier::Connector::ConstNeighborIterator ni=unbalanced_to_balanced.begin(neighborhood_itr); - ni!=unbalanced_to_balanced.end(neighborhood_itr); ++ni ) { - TBOX_ASSERT( ni->getOwnerRank() == d_mpi.getRank() ); - num_unaccounted_cells -= ni->size(); - } - - } - else { - num_unaccounted_cells -= unbalanced_box.size(); - } - - } - - - /* - * Receive info about exported cells from processes that now own - * those cells. Receive until all cells are accounted for. - */ - - std::vector incoming_message; // Keep outside loop to avoid reconstructions. - BoxInTransit balanced_box_in_transit(d_dim); - while ( num_unaccounted_cells > 0 ) { - - t_construct_semilocal_comm_wait->start(); - tbox::SAMRAI_MPI::Status status; - d_mpi.Probe( MPI_ANY_SOURCE, - TreeLoadBalancer_EDGETAG0, - &status ); - - int source = status.MPI_SOURCE; - int count = -1; - tbox::SAMRAI_MPI::Get_count( &status, MPI_CHAR, &count ); - incoming_message.resize( count, -1 ); - - d_mpi.Recv( - static_cast(&incoming_message[0]), - count, - MPI_CHAR, - source, - TreeLoadBalancer_EDGETAG0, - &status ); - t_construct_semilocal_comm_wait->stop(); - - tbox::MessageStream msg( incoming_message.size(), - tbox::MessageStream::Read, - static_cast(&incoming_message[0]), - false ); - t_unpack_edge->start(); - while ( !msg.endOfData() ) { - - balanced_box_in_transit.getFromMessageStream(msg); - TBOX_ASSERT( balanced_box_in_transit.d_orig_box.getOwnerRank() == d_mpi.getRank() ); - unbalanced_to_balanced.insertLocalNeighbor( - balanced_box_in_transit.d_box, - balanced_box_in_transit.d_orig_box.getId() ); - num_unaccounted_cells -= balanced_box_in_transit.d_box.size(); - - } - t_unpack_edge->stop(); - - } - TBOX_ASSERT( num_unaccounted_cells == 0 ); - incoming_message.clear(); - - - // Wait for the sends to complete before clearing outgoing_messages. - std::vector status(send_requests.size()); - t_construct_semilocal_comm_wait->start(); - d_mpi.Waitall( - static_cast(send_requests.size()), - &send_requests[0], - &status[0]); - t_construct_semilocal_comm_wait->stop(); - outgoing_messages.clear(); - - t_construct_semilocal->stop(); - - return; -} - - - -/* - ************************************************************************* - * Set the MPI commuicator. If there's a private communicator, free - * it first. It's safe to free the private communicator because no - * other code have access to it. - ************************************************************************* - */ -void -TreeLoadBalancer::setSAMRAI_MPI( - const tbox::SAMRAI_MPI& samrai_mpi) -{ - if (samrai_mpi.getCommunicator() == tbox::SAMRAI_MPI::commNull) { - TBOX_ERROR("TreeLoadBalancer::setSAMRAI_MPI error: Given\n" - << "communicator is invalid."); - } - - if ( d_mpi_is_dupe ) { - d_mpi.freeCommunicator(); - } - - // Enable private communicator. - d_mpi.dupCommunicator(samrai_mpi); - d_mpi_is_dupe = true; -} - - - -/* - ************************************************************************* - * Set the MPI commuicator. - ************************************************************************* - */ -void -TreeLoadBalancer::freeMPICommunicator() -{ - if ( d_mpi_is_dupe ) { - // Free the private communicator (if MPI has not been finalized). - int flag; - tbox::SAMRAI_MPI::Finalized(&flag); - if (!flag) { - d_mpi.freeCommunicator(); - } - } - d_mpi.setCommunicator(tbox::SAMRAI_MPI::commNull); - d_mpi_is_dupe = false; -} - - - -/* - ************************************************************************* - * RankGroups load-balances within their membership and ignore other - * groups. When we balance over multiple cycles, the RankGroup for - * the local process depends on the cycle, as computed by this method. - * - * The RankGroup size increases exponentially with the cycle number - * such that for the last cycle the rank group includes all processes - * in d_mpi. It's a heuristic formula, as follows: + * We chose this formula: + * Group size = nprocs^cycle_fraction + * thus number of groups = nprocs^(1-cycle_fraction) * - * Partition all ranks into similar sized groups. With each cycle, - * the group size grows exponentially while the number of groups - * shrinks. The last cycle_number has a single group of - * d_mpi.getSize() processors. - * - * Let m = number of cycles - * i = cycle number, [0,m) - * p = communicator size - * - * The group size is p^((i+1)/m) + * To avoid tiny groups that cannot effectively spread out severely + * unbalanced load distribution, we round the number of groups down + * and group size up. ************************************************************************* */ void TreeLoadBalancer::createBalanceRankGroupBasedOnCycles( - tbox::RankGroup &rank_group, - int &number_of_groups, - int &group_num, - const int cycle_number, - const int number_of_cycles) const + tbox::RankGroup& rank_group, + int& number_of_groups, + int& group_num, + double cycle_fraction) const { - - /* - * Compute the number of group and, implicitly, the group sizes. - * Tiny groups tend to leave the members with possibly large - * overloads. In order to make all groups similar in size we round - * down the number of groups (and round up the group size). - */ number_of_groups = static_cast(pow(static_cast(d_mpi.getSize()), - 1.0 - double(cycle_number + 1) / number_of_cycles)); + 1.0 - cycle_fraction)); /* * All groups will have a base population count of @@ -2113,28 +1458,32 @@ TreeLoadBalancer::createBalanceRankGroupBasedOnCycles( * from group 0, so these groups will have one more than the base. */ const int base_group_size = d_mpi.getSize() / number_of_groups; + const int first_base_sized_group = d_mpi.getSize() % number_of_groups; + const int first_rank_in_base_sized_group = first_base_sized_group * (1 + base_group_size); if (d_mpi.getRank() < first_rank_in_base_sized_group) { + group_num = d_mpi.getRank() / (1 + base_group_size); - const int group_first_rank = group_num * (1 +base_group_size); - rank_group.setMinMax( group_first_rank, - group_first_rank + base_group_size ); + + const int group_first_rank = group_num * (1 + base_group_size); + + rank_group.setMinMax(group_first_rank, + group_first_rank + base_group_size); } else { + group_num = first_base_sized_group + (d_mpi.getRank() - first_rank_in_base_sized_group) / base_group_size; - const int group_first_rank = first_rank_in_base_sized_group + - (group_num - first_base_sized_group)*(1+base_group_size); - rank_group.setMinMax( group_first_rank, - group_first_rank + base_group_size - 1 ); - } - - return; -} + const int group_first_rank = first_rank_in_base_sized_group + + (group_num - first_base_sized_group) * base_group_size; + rank_group.setMinMax(group_first_rank, + group_first_rank + base_group_size - 1); + } +} /* ************************************************************************* @@ -2153,35 +1502,35 @@ TreeLoadBalancer::setupAsyncCommObjects( tbox::AsyncCommPeer *& child_comms, tbox::AsyncCommStage& parent_stage, tbox::AsyncCommPeer *& parent_comm, - const tbox::RankGroup &rank_group, - const tbox::BalancedDepthFirstTree &bdfs ) const + const tbox::RankGroup& rank_group) const { - child_comms = parent_comm = NULL; + child_comms = parent_comm = 0; - const int num_children = bdfs.getNumberOfChildren(); + const int num_children = d_rank_tree->getNumberOfChildren(); - if ( num_children > 0 ) { + if (num_children > 0) { child_comms = new tbox::AsyncCommPeer[num_children]; for (int child_num = 0; child_num < num_children; ++child_num) { - const int child_rank_in_grp = bdfs.getChildRank(child_num); + const int child_rank_in_grp = d_rank_tree->getChildRank(child_num); const int child_true_rank = rank_group.getMappedRank(child_rank_in_grp); child_comms[child_num].initialize(&child_stage); child_comms[child_num].setPeerRank(child_true_rank); child_comms[child_num].setMPI(d_mpi); child_comms[child_num].setMPITag(TreeLoadBalancer_LOADTAG0, - TreeLoadBalancer_LOADTAG1); - child_comms[child_num].limitFirstDataLength(TreeLoadBalancer_FIRSTDATALEN); + TreeLoadBalancer_LOADTAG1); + child_comms[child_num].limitFirstDataLength( + TreeLoadBalancer_FIRSTDATALEN); } } - if (bdfs.getParentRank() != bdfs.getInvalidRank()) { + if (d_rank_tree->getParentRank() != tbox::RankTreeStrategy::getInvalidRank()) { - const int parent_rank_in_grp = bdfs.getParentRank(); + const int parent_rank_in_grp = d_rank_tree->getParentRank(); int parent_true_rank = rank_group.getMappedRank(parent_rank_in_grp); parent_comm = new tbox::AsyncCommPeer; @@ -2190,15 +1539,12 @@ TreeLoadBalancer::setupAsyncCommObjects( parent_comm->setMPI(d_mpi); parent_comm->setMPITag(TreeLoadBalancer_LOADTAG0, TreeLoadBalancer_LOADTAG1); - parent_comm->limitFirstDataLength(TreeLoadBalancer_FIRSTDATALEN); + parent_comm->limitFirstDataLength( + TreeLoadBalancer_FIRSTDATALEN); } - - return; } - - /* ************************************************************************* ************************************************************************* @@ -2209,2485 +1555,520 @@ TreeLoadBalancer::destroyAsyncCommObjects( tbox::AsyncCommPeer *& parent_comm) const { if (d_mpi.getSize() == 1) { - TBOX_ASSERT(child_comms == NULL); - TBOX_ASSERT(parent_comm == NULL); + TBOX_ASSERT(child_comms == 0); + TBOX_ASSERT(parent_comm == 0); } else { - if ( child_comms != NULL ) { + if (child_comms != 0) { delete[] child_comms; } - if ( parent_comm != NULL ) { + if (parent_comm != 0) { delete parent_comm; } - child_comms = parent_comm = NULL; + child_comms = parent_comm = 0; } } - - /* ************************************************************************* - * Attempt to shift a specified ammount of load from one TransitSet to - * another by breaking a single box from the overloaded set. Examine - * multiple NodeInTransit and breakages to - * - * - filter out the ones that worsens the balance (see breakOffLoad) for - * reasons why this can happen. - * - * - find the one that results in the smallest combinedBreakingPenalty. - * - * Return whether any changes were made. ************************************************************************* */ TreeLoadBalancer::LoadType -TreeLoadBalancer::shiftLoadsByBreaking( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - const LoadType ideal_transfer ) const +TreeLoadBalancer::computeLocalLoad( + const hier::BoxLevel& box_level) const { - int actual_transfer = 0; - - if (ideal_transfer < 0) { - // The logic below does not handle bi-directional transfers, so handle it here. - actual_transfer = -shiftLoadsByBreaking( - dst, - src, - next_available_index, - -ideal_transfer ); - return actual_transfer; - } - - TBOX_ASSERT(src.size() + dst.size() > 0); - - t_shift_loads_by_breaking->start(); - - if (d_print_steps) { - tbox::plog << " shiftLoadsByBreaking asked to break off " - << ideal_transfer - << " from one of " << src.size() - << " source Boxes to add to set of " << dst.size() - << " Boxes." - << std::endl; - } - - /* - * The best results so far (from not transfering anything). - */ - TransitSet best_src = src; - TransitSet best_dst = dst; - int best_actual_transfer = 0; - - double best_balance_penalty = computeBalancePenalty(best_src, - best_dst, - static_cast(ideal_transfer) - best_actual_transfer); - double best_surface_penalty = computeSurfacePenalty(best_src, - best_dst); - double best_slender_penalty = computeSlenderPenalty(best_src, - best_dst); - double best_combined_penalty = combinedBreakingPenalty( - best_balance_penalty, - best_surface_penalty, - best_slender_penalty); - - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Uncut's imbalance: " - << (ideal_transfer - best_actual_transfer) - << " balance,surface,slender,combined penalty: " - << best_balance_penalty << ' ' - << best_surface_penalty << ' ' - << best_slender_penalty << ' ' - << best_combined_penalty - << std::endl; - } - - /* - * Scale the pre-cut penalty. Scaling makes this method more - * agressive about producing a cut. Sometimes the uncut penalty can - * be low enough to prevent a cut, but the cut may be required for - * reasonable balancing. The down side of agressive cutting is that - * it tends to produce more slivers (but not terribly many). - * This exchange of load balance and slivers may not be easily - * eliminated by the weights in the penalty functions. - */ - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Uncut penalty: " << best_combined_penalty - << " scaled by " << d_precut_penalty_wt << " to " - << best_combined_penalty * d_precut_penalty_wt - << std::endl; - } - best_combined_penalty *= d_precut_penalty_wt; - - bool found_breakage = false; - - std::vector breakoff; - std::vector leftover; - double breakoff_amt; - for (TransitSet::iterator si = src.begin(); - si != src.end() && - (!found_breakage || si->d_boxload >= ideal_transfer); ++si) { - - const BoxInTransit& candidate = *si; - - breakOffLoad( - breakoff, - leftover, - breakoff_amt, - candidate.d_box, - ideal_transfer ); - - if (!breakoff.empty()) { - - const BoxInTransit& brk_box_in_transit = *si; - - const bool improves_balance = - tbox::MathUtilities::Abs( - static_cast(ideal_transfer) - breakoff_amt) < - (ideal_transfer - tbox::MathUtilities::getEpsilon()); - - if (d_print_break_steps) { - tbox::plog << " Potential to replace " << brk_box_in_transit << " with " - << breakoff.size() << " breakoff Boxes and " - << leftover.size() << " leftover Boxes." - << " improves_balance=" << improves_balance - << std::endl; - } - - if (!improves_balance) { - // Reject. - continue; - } - - /* - * Trial modifications of src and dst, for evaluating - * combined penalties. - */ - TransitSet trial_src = src; - TransitSet trial_dst = dst; - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - LoadType trial_actual_transfer = actual_transfer; - trial_src.erase(candidate); - - /* - * Put breakoff in trial_dst and leftover back into trial_src. - */ - for (std::vector::const_iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - BoxInTransit give_box_in_transit( - brk_box_in_transit, - *bi, - d_mpi.getRank(), - next_available_index); - give_box_in_transit.d_boxload = static_cast(computeLoad( - give_box_in_transit.d_orig_box, - give_box_in_transit.getBox())); - next_available_index += 2 + d_degree; - trial_dst.insert(give_box_in_transit); - trial_actual_transfer += give_box_in_transit.d_boxload; - if (d_print_break_steps) { - tbox::plog << " Breakoff box " << *bi << bi->numberCells() - << '|' << bi->size() - << " -> " << give_box_in_transit - << std::endl; - } - } - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - for (std::vector::const_iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - BoxInTransit keep_box_in_transit( - brk_box_in_transit, - *bi, - d_mpi.getRank(), - next_available_index); - keep_box_in_transit.d_boxload = static_cast(computeLoad( - keep_box_in_transit.d_orig_box, - keep_box_in_transit.getBox())); - next_available_index += 2 + d_degree; - trial_src.insert(keep_box_in_transit); - if (d_print_break_steps) { - tbox::plog << " Leftover box " << *bi << " -> " << keep_box_in_transit - << std::endl; - } - } - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - trial_src.erase(brk_box_in_transit); - - /* - * Compute the new penalty to see if it improves our best result so far. - */ - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - double trial_balance_penalty = computeBalancePenalty(trial_src, - trial_dst, - static_cast(ideal_transfer) - trial_actual_transfer); - double trial_surface_penalty = computeSurfacePenalty(trial_src, - trial_dst); - double trial_slender_penalty = computeSlenderPenalty(trial_src, - trial_dst); - double trial_combined_penalty = combinedBreakingPenalty( - trial_balance_penalty, - trial_surface_penalty, - trial_slender_penalty); - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Trial's imbalance: " - << (ideal_transfer - trial_actual_transfer) - << " balance,surface,slender,combined penalty: " - << trial_balance_penalty << ' ' - << trial_surface_penalty << ' ' - << trial_slender_penalty << ' ' - << trial_combined_penalty - << std::endl; - } - - if (d_print_break_steps) { - if (trial_combined_penalty < best_combined_penalty) { - tbox::plog << " Keeping this trial." << std::endl; - } else { - tbox::plog << " Rejecting this trial." << std::endl; - } - } - - if (trial_combined_penalty < best_combined_penalty) { - found_breakage = true; - best_actual_transfer = static_cast(breakoff_amt); - best_src = trial_src; - best_dst = trial_dst; - best_balance_penalty = trial_balance_penalty; - best_surface_penalty = trial_surface_penalty; - best_slender_penalty = trial_slender_penalty; - best_combined_penalty = trial_combined_penalty; - } - - } else { - if (d_print_break_steps) { - tbox::plog << " Break step could not break " << ideal_transfer - << " from src box " << candidate - << std::endl; - } - } - - } - - if (found_breakage) { - src.swap(best_src); - dst.swap(best_dst); - actual_transfer = best_actual_transfer; + t_compute_local_load->start(); + double load = 0.0; + const hier::BoxContainer& boxes = box_level.getBoxes(); + for (hier::BoxContainer::const_iterator ni = boxes.begin(); + ni != boxes.end(); + ++ni) { + double box_load = computeLoad(*ni); + load += box_load; } - - t_shift_loads_by_breaking->stop(); - return actual_transfer; + t_compute_local_load->stop(); + return static_cast(load); } - - /* ************************************************************************* - * Attempt to swap some NodesInTransit between 2 sets of - * NodesInTransit (src and dst) to shift ideal_transfer work units. * - * Transfering a BoxInTransit from one TransitSet to another - * is considered a degenerate "swap" (a BoxInTransit is - * swapped for nothing) handled by this function. - * - * This method can transfer load both ways. - * ideal_transfer > 0 means to raise the load of dst - * ideal_transfer < 0 means to raise the load of src - * The iterative do loop may overshoot the ideal_transfer - * and may have to swap to shift some of the load - * back. + * Read values (described in the class header) from input database. * - * Return whether any changes were made. ************************************************************************* */ -TreeLoadBalancer::LoadType -TreeLoadBalancer::shiftLoadsBySwapping( - TransitSet& src, - TransitSet& dst, - LoadType ideal_transfer ) const + +void +TreeLoadBalancer::getFromInput( + const boost::shared_ptr& input_db) { - t_shift_loads_by_swapping->start(); - if (d_print_steps) { - tbox::plog << " Attempting to swap " << ideal_transfer << " work units." << std::endl; - } + if (input_db) { - bool found_swap; + d_print_steps = input_db->getBoolWithDefault("DEV_print_steps", false); + d_check_connectivity = + input_db->getBoolWithDefault("DEV_check_connectivity", d_check_connectivity); + d_check_map = + input_db->getBoolWithDefault("DEV_check_map", d_check_map); - LoadType actual_transfer = 0; + d_summarize_map = input_db->getBoolWithDefault("DEV_summarize_map", + d_summarize_map); - do { + d_report_load_balance = input_db->getBoolWithDefault( + "DEV_report_load_balance", d_report_load_balance); + d_barrier_before = input_db->getBoolWithDefault("DEV_barrier_before", + d_barrier_before); + d_barrier_after = input_db->getBoolWithDefault("DEV_barrier_after", + d_barrier_after); - /* - * Ammount we seek to transfer from hi to lo - * (the "ideal" for this particular iteration). - * Unlike ideal_transfer and actual_transfer, this quantity is positive. - */ - LoadType rem_transfer = ideal_transfer - actual_transfer; - if (d_print_swap_steps) { - tbox::plog << " Swap progress: " << actual_transfer - << " / " << ideal_transfer << " remaining transfer = " - << rem_transfer << std::endl; - } + d_max_spread_procs = + input_db->getIntegerWithDefault("max_spread_procs", + d_max_spread_procs); - found_swap = false; + d_flexible_load_tol = + input_db->getDoubleWithDefault("flexible_load_tolerance", + d_flexible_load_tol); - LoadType swap_transfer; - found_swap = swapLoadPair( - src, - dst, - swap_transfer, - rem_transfer ); + d_allow_box_breaking = + input_db->getBoolWithDefault("DEV_allow_box_breaking", + d_allow_box_breaking); - if (found_swap) { - actual_transfer += swap_transfer; - } + d_voucher_mode = + input_db->getBoolWithDefault("DEV_voucher_mode", + d_voucher_mode); - } while (found_swap && (actual_transfer != ideal_transfer)); + if (input_db->isInteger("tile_size")) { + input_db->getIntegerArray("tile_size", &d_tile_size[0], d_tile_size.getDim().getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + if (!(d_tile_size[i] >= 1)) { + TBOX_ERROR("TreeLoadBalancer tile_size must be >= 1 in all directions.\n" + << "Input tile_size is " << d_tile_size); + } + } + } - if (d_print_swap_steps) { - tbox::plog << " Final imbalance for swap " << ideal_transfer - - actual_transfer << std::endl; } - - t_shift_loads_by_swapping->stop(); - - return actual_transfer; } - - /* - ************************************************************************* - * Find a BoxInTransit in src and a BoxInTransit in dst which when swapped - * results in shifting close to ideal_shift from src to dst. - * Return whether a swap pair was found. + *************************************************************************** * - * If isrc is set but idst is not, it means that isrc should - * be moved to dst, but no dst should be moved back. This is - * the degenerate case of swapping isrc for a BoxInTransit with zero - * load. - ************************************************************************* + *************************************************************************** */ -bool -TreeLoadBalancer::swapLoadPair( - TransitSet& src, - TransitSet& dst, - LoadType& actual_transfer, - LoadType ideal_transfer ) const +void +TreeLoadBalancer::assertNoMessageForPrivateCommunicator() const { - if (ideal_transfer < 0) { - // The logic below does not handle bi-directional transfers, so handle it here. - bool rval = swapLoadPair( - dst, - src, - actual_transfer, - -ideal_transfer ); - actual_transfer = -actual_transfer; - return rval; - } - - t_find_swap_pair->start(); - - if (d_print_swap_steps) { - tbox::plog << " swapLoadPair looking for transfer of " - << ideal_transfer - << " between " << src.size() << "-BoxInTransit src and " - << dst.size() << "-BoxInTransit dst." << std::endl; - tbox::plog << " src (" << src.size() << "):" << std::endl; - for (TransitSet::iterator si = src.begin(); si != src.end(); ++si) { - tbox::plog << *si << std::endl; - } - tbox::plog << " dst (" << dst.size() << "):" << std::endl; - for (TransitSet::iterator si = dst.begin(); si != dst.end(); ++si) { - tbox::plog << *si << std::endl; - } - } - /* - * Look for two swap options. The "high side" option would - * transfer at least ideal_transfer. The "low side" option would - * transfer up to ideal_transfer. - * - * Each option is defined by a box from src and a box from dst, - * designated by the iterators src_hiside, dst_hiside, src_loside - * and dst_loside. src_hiside points to the box in the src for the - * high-side transfer, and similarly for dst_hiside. src_loside - * points to the box in the src for the low-side transfer, and - * similarly for dst_loside. - * - * Note that in the degenerate case, the dst box does not exist, - * and the swap degenerates to moving a box from the src to the - * dst. - * - * Compute the balance_penalty if high and low were swapped. Keep - * looking until we find the pair giving the lowest balance_penalty - * on swapping. - * - * isrc and idst point to the current best pair to swap. new_balance_penalty - * is the balance_penalty if we swap them. - * - * src_test and dst_test are trial pairs to check to see if we can improve on - * new_balance_penalty. - * - * We will look for two "best" pairs: + * If using a private communicator, double check to make sure + * there are no remaining messages. This is not a guarantee + * that there is no messages in transit, but it can find + * messages that have arrived but not received. */ - - // Initialization indicating no swap pair found yet. - TransitSet::iterator src_hiside = src.end(); - TransitSet::iterator dst_hiside = dst.end(); - TransitSet::iterator src_loside = src.end(); - TransitSet::iterator dst_loside = dst.end(); - - // A dummy BoxInTransit for set searches. - hier::Box dummy_box(d_dim); - BoxInTransit dummy_search_target(d_dim); - - // Difference between swap results and ideal, >= 0 - LoadType imbalance_loside = tbox::MathUtilities::getMax(); - LoadType imbalance_hiside = tbox::MathUtilities::getMax(); - - if (dst.empty()) { - /* - * There is no dst BoxInTransit, so the swap would - * degnerate to moving a box from src to dst. Find - * the best src BoxInTransit to move. - */ - dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); - dummy_search_target.d_boxload = ideal_transfer; - TransitSet::iterator src_test = src.lower_bound(dummy_search_target); - - if (d_print_swap_steps) { - tbox::plog << " swapLoadPair with empty dst: "; - } - - if (src_test != src.begin()) { - src_hiside = src_test; - --src_hiside; - imbalance_hiside = src_hiside->d_boxload - ideal_transfer; - if (d_print_swap_steps) { - tbox::plog << " hi src: " << (*src_hiside) - << " with transfer " << src_hiside->d_boxload - << ", off by " << imbalance_hiside; - } - } - if (src_test != src.end()) { - src_loside = src_test; - imbalance_loside = ideal_transfer - src_loside->d_boxload; - if (d_print_swap_steps) { - tbox::plog << " lo src: " << (*src_loside) - << " with transfer " << src_loside->d_boxload - << ", off by " << imbalance_loside; - } - } - if (d_print_swap_steps) { - tbox::plog << std::endl; - } - - } else { - - /* - * Start search through src beginning with the box whose load - * exceed the biggest dst box by at least ideal_transfer. - */ - dummy_search_target = *dst.begin(); - dummy_search_target.d_boxload += ideal_transfer; - TransitSet::iterator src_beg = src.lower_bound(dummy_search_target); - - for (TransitSet::iterator src_test = src_beg; src_test != src.end(); ++src_test) { - - /* - * Set dst_test pointing to where we should start looking in dst. - * Look for a load less than the load of src_test by - * ideal_transfer. - */ - dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); - dummy_search_target.d_boxload = tbox::MathUtilities::Max( - src_test->d_boxload - ideal_transfer, - 0); - TransitSet::iterator dst_test = dst.lower_bound(dummy_search_target); - - if (dst_test != dst.end()) { - - /* - * lower_bound returned dst_test that would transfer >= - * ideal_transfer when swapped with src_test. Check - * transfererence between src_test and dst_test for the - * high-side transfer. Also check the next smaller box in - * dst for the low-side transfer. - */ - - // tmp_miss is the difference between the test swap amount and ideal_transfer. - LoadType tmp_miss = (src_test->d_boxload - dst_test->d_boxload) - ideal_transfer; - TBOX_ASSERT(tmp_miss >= 0); - - if ((tmp_miss < imbalance_hiside)) { - src_hiside = src_test; - dst_hiside = dst_test; - imbalance_hiside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new hi-swap pair: " << (*src_hiside) - << " & " << (*dst_hiside) << " with transfer " - << (src_hiside->d_boxload - dst_hiside->d_boxload) - << " missing by " << imbalance_hiside - << std::endl; - } - } - - if (dst_test != dst.begin()) { - --dst_test; // Now, src_test and dst_test transferer by *less* than ideal_transfer. - tmp_miss = ideal_transfer - (src_test->d_boxload - dst_test->d_boxload); - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_loside) { - src_loside = src_test; - dst_loside = dst_test; - imbalance_loside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new lo-swap pair: " << (*src_loside) - << " & " << (*dst_loside) << " with transfer " - << (src_loside->d_boxload - dst_loside->d_boxload) - << " missing by " << imbalance_loside - << std::endl; - } - } - } - - } else { - - /* - * The ideal dst to swap is smaller than the smallest dst - * box. So the only choice is swapping src_test for nothing. - * Chech this against the current high- and low-side choices. - */ - if (src_test->d_boxload > ideal_transfer) { - // Moving src_test to src is moving too much--hiside. - LoadType tmp_miss = src_test->d_boxload - ideal_transfer; - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_hiside) { - src_hiside = src_test; - dst_hiside = dst.end(); - imbalance_hiside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new hi-swap source: " << (*src_hiside) - << " & " << "no dst" << " with transfer " - << (src_hiside->d_boxload) - << " missing by " << imbalance_hiside - << std::endl; - } - } - } else { - // Moving src_test to src is moving (just right or) too little--loside. - LoadType tmp_miss = ideal_transfer - src_test->d_boxload; - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_loside) { - src_loside = src_test; - dst_loside = dst.end(); - imbalance_loside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new lo-swap source: " << (*src_loside) - << " & " << "no dst" << " with transfer " - << (src_loside->d_boxload) - << " missing by " << imbalance_loside - << std::endl; - } - } - /* - * Break out of the loop early because there is no - * point checking smaller src boxes. - */ - break; - } - } - } - - } - - /* - * Swapping does not produce new cuts, so it is ok to omit the penalties - * arising from cutting. - */ - double current_balance_penalty = static_cast(ideal_transfer); - double balance_penalty_loside = static_cast(imbalance_loside); - double balance_penalty_hiside = static_cast(imbalance_hiside); - - if (d_print_swap_steps) { - tbox::plog << " Swap candidates give penalties (unswap,lo,hi): " - << current_balance_penalty << " , " << balance_penalty_loside - << " , " << balance_penalty_hiside << std::endl; - } - - bool found_swap = false; - TransitSet::iterator isrc; - TransitSet::iterator idst; - - if (balance_penalty_loside < current_balance_penalty && - balance_penalty_loside <= balance_penalty_hiside) { - isrc = src_loside; - idst = dst_loside; - found_swap = true; - if (d_print_swap_steps) { - tbox::plog << " Taking loside." << std::endl; - } - } else if (balance_penalty_hiside < current_balance_penalty && - balance_penalty_hiside <= balance_penalty_loside) { - isrc = src_hiside; - idst = dst_hiside; - found_swap = true; - if (d_print_swap_steps) { - tbox::plog << " Taking hiside." << std::endl; - } - } else { - if (d_print_swap_steps) { - tbox::plog << " Keeping original (no swap)." << std::endl; - } - } - - if (found_swap) { - actual_transfer = isrc->d_boxload; - if (idst != dst.end()) { - actual_transfer -= idst->d_boxload; - } - } - - if (found_swap) { - - // We can improve balance_penalty by swapping isrc with idst. - if (d_print_swap_steps) { - tbox::plog << " Swapping " << actual_transfer << " units using "; - if (isrc != src.end()) tbox::plog << *isrc; - else tbox::plog << "X"; - tbox::plog << " <--> "; - if (idst != dst.end()) tbox::plog << *idst; - else tbox::plog << "X"; - tbox::plog << std::endl; - } - - if (isrc != src.end()) { - dst.insert(*isrc); - src.erase(isrc); - } - if (idst != dst.end()) { - src.insert(*idst); - dst.erase(idst); + if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { + int flag; + tbox::SAMRAI_MPI::Status mpi_status; + int mpi_err = d_mpi.Iprobe(MPI_ANY_SOURCE, + MPI_ANY_TAG, + &flag, + &mpi_status); + if (mpi_err != MPI_SUCCESS) { + TBOX_ERROR("Error probing for possible lost messages."); } - - - } else { - if (d_print_swap_steps) { - tbox::plog << " Cannot find swap pair for " << ideal_transfer - << " units." << std::endl; + if (flag == true) { + int count = -1; + mpi_err = tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); + TBOX_ERROR( + "Library error!\n" + << "TreeLoadBalancer detected before or\n" + << "after using a private communicator that there\n" + << "is a message yet to be received. This is\n" + << "an error because all messages using the\n" + << "private communicator should have been\n" + << "accounted for. Message status:\n" + << "source " << mpi_status.MPI_SOURCE << '\n' + << "tag " << mpi_status.MPI_TAG << '\n' + << "count " << count << " (assuming integers)\n" + << "current tags: " + << ' ' << TreeLoadBalancer_LOADTAG0 << ' ' + << TreeLoadBalancer_LOADTAG1 + ); } } - - t_find_swap_pair->stop(); - return found_swap; } - - /* - ************************************************************************* - * Master method for breaking off a load. - * - * Try different heuristics and pick the "best" way to break off a - * load. The best is defined as the one with the lowest combined - * penalty. - * - * This method always return a breakage if at all possible, without - * considering whether the break should be used. For example, - * requesting breakage of 1 cell in a 100x100 box might return a - * breakage of a 100-cells sliver! - * - * Return whether a successful break was made. - ************************************************************************* + *********************************************************************** + *********************************************************************** */ -bool -TreeLoadBalancer::breakOffLoad( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break ) const +void +TreeLoadBalancer::setTimers() { - TBOX_ASSERT(ideal_load_to_break > 0); - /* - * NOTE: We need in this method a way to weigh the - * value of proximity to the ideal breakoff vs the - * increased area of the cuts. However, the weight - * given to area-optimized cuts should be considered - * only with real application performance data. - * - * NOTE: We can compute the amount of new box boundaries - * generated by computing the box boundary before and - * after, and subtracting. Easier than reconstructing - * the cuts from the box definitions. - * - * NOTE: We should weight negatively the production of - * high surface-to-volume boxes. + * The first constructor gets timers from the TimerManager. + * and sets up their deallocation. */ + if (!t_load_balance_box_level) { + t_load_balance_box_level = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::loadBalanceBoxLevel()"); - t_break_off_load->start(); + t_get_map = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::get_map"); + t_use_map = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::use_map"); - breakoff.clear(); - leftover.clear(); + t_constrain_size = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::constrain_size"); - if (ideal_load_to_break < d_min_size.getProduct()) { - /* - * Assuming uniform load balancing, there is no hope - * if breaking off a piece of the desired size. - */ - if (d_print_break_steps) { - tbox::plog << " ideal_load_to_break " << ideal_load_to_break - << " < " << d_min_size.getProduct() << d_min_size - << ": Cannot break Box " << box << std::endl; - } - t_break_off_load->stop(); - return false; - } + t_distribute_load_across_rank_group = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::distributeLoadAcrossRankGroup()"); - /* - * To avoid repeated computations of bad cuts, - * we precompute bad_cuts here to provide to - * methods that actually use the information. - */ - tbox::Array > bad_cuts(d_dim.getValue()); - t_find_bad_cuts->start(); - hier::BoxUtilities::findBadCutPoints(bad_cuts, - box, - d_block_domain_boxes[box.getBlockId().getBlockValue()], - d_bad_interval); - t_find_bad_cuts->stop(); - - // Penalty for not transfering ideal load. - double best_balance_penalty = computeBalancePenalty(box, - ideal_load_to_break); - // Penalty for new surfaces generated (none generated yet). - double best_surface_penalty = computeSurfacePenalty(box); - // Penalty for slender boxes. - double best_slender_penalty = computeSlenderPenalty(box); - - double best_combined_penalty = tbox::MathUtilities::getMax(); - - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " pre-break imbalance: " << ideal_load_to_break - << " balance,surface,slender,combined penalties: " - << best_balance_penalty << ", " << best_surface_penalty - << ", " - << best_slender_penalty << ", " << best_combined_penalty - << std::endl; - } + t_assign_to_local_and_populate_maps = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::assign_to_local_and_populate_maps"); - brk_load = 0; - bool found_any_break = false; - - { - std::vector planar_breakoff; - std::vector planar_leftover; - double planar_brk_load; - - bool found_this_break = breakOffLoad_planar( - planar_breakoff, - planar_leftover, - planar_brk_load, - box, - ideal_load_to_break, - bad_cuts ); - - if (found_this_break) { - found_any_break = true; - double planar_balance_penalty = computeBalancePenalty(planar_breakoff, - planar_leftover, - static_cast(planar_brk_load - ideal_load_to_break)); - double planar_surface_penalty = computeSurfacePenalty(planar_breakoff, - planar_leftover); - double planar_slender_penalty = computeSlenderPenalty(planar_breakoff, - planar_leftover); - double planar_combined_penalty = - combinedBreakingPenalty(planar_balance_penalty, - planar_surface_penalty, - planar_slender_penalty); - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Planar-break broke off " - << planar_brk_load << " / " << ideal_load_to_break - << " from " << box << '|' - << box.numberCells() << '|' - << box.size() << " into " - << planar_breakoff.size() - << " breakoff: "; - for (std::vector::const_iterator bi = - planar_breakoff.begin(); - bi != planar_breakoff.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n and " << planar_leftover.size() - << " leftover boxes:"; - for (std::vector::const_iterator bi = - planar_leftover.begin(); - bi != planar_leftover.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n imbalance: " - << (planar_brk_load - ideal_load_to_break) - << " balance,surface,slender,combined penalties: " - << planar_balance_penalty << ", " - << planar_surface_penalty << ", " - << planar_slender_penalty - << ", " << planar_combined_penalty << std::endl; - } - if (planar_combined_penalty < best_combined_penalty) { - if (d_print_break_steps) { - tbox::plog << " Keeping planar cut result." << std::endl; - } - breakoff.swap(planar_breakoff); - leftover.swap(planar_leftover); - brk_load = planar_brk_load; - best_balance_penalty = planar_balance_penalty; - best_surface_penalty = planar_surface_penalty; - best_slender_penalty = planar_slender_penalty; - best_combined_penalty = planar_combined_penalty; - } else { - if (d_print_break_steps) { - tbox::plog << " Rejecting planar cut result." << std::endl; - } - } - } - } + t_compute_local_load = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::computeLocalLoad"); + t_compute_global_load = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::compute_global_load"); + t_compute_tree_load = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::compute_tree_load"); - /* - * If above cut algorithms fail to break or improve the penalty, try - * more cutting algorithms. - */ - { - - std::vector cubic_breakoff; - std::vector cubic_leftover; - double cubic_brk_load; - - bool found_this_break = breakOffLoad_cubic( - cubic_breakoff, - cubic_leftover, - cubic_brk_load, - box, - ideal_load_to_break, - bad_cuts ); - - if (found_this_break) { - found_any_break = true; - double cubic_balance_penalty = computeBalancePenalty( - cubic_breakoff, - cubic_leftover, - static_cast(cubic_brk_load - ideal_load_to_break)); - double cubic_surface_penalty = computeSurfacePenalty(cubic_breakoff, - cubic_leftover); - double cubic_slender_penalty = computeSlenderPenalty(cubic_breakoff, - cubic_leftover); - double cubic_combined_penalty = - combinedBreakingPenalty(cubic_balance_penalty, - cubic_surface_penalty, - cubic_slender_penalty); - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Cubic-break broke off " - << cubic_brk_load << " / " << ideal_load_to_break - << " from " << box << '|' - << box.numberCells() << '|' - << box.size() << " into " - << cubic_breakoff.size() - << " breakoff: "; - for (std::vector::const_iterator bi = - cubic_breakoff.begin(); - bi != cubic_breakoff.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n and " << cubic_leftover.size() - << " leftover boxes:"; - for (std::vector::const_iterator bi = - cubic_leftover.begin(); - bi != cubic_leftover.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n imbalance: " - << (cubic_brk_load - ideal_load_to_break) - << " balance,surface,slender,combined penalties: " - << cubic_balance_penalty << ", " - << cubic_surface_penalty << ", " - << cubic_slender_penalty - << ", " << cubic_combined_penalty << std::endl; - } - if (cubic_combined_penalty < best_combined_penalty) { - if (d_print_break_steps) { - tbox::plog << " choosing breakOffLoad_cubic result." - << std::endl; - } - breakoff.swap(cubic_breakoff); - leftover.swap(cubic_leftover); - brk_load = cubic_brk_load; - best_balance_penalty = cubic_balance_penalty; - best_surface_penalty = cubic_surface_penalty; - best_slender_penalty = cubic_slender_penalty; - best_combined_penalty = cubic_combined_penalty; - } else { - if (d_print_break_steps) { - tbox::plog << " Rejecting cubic cut result." << std::endl; - } - } - } else { - if (d_print_break_steps) { - tbox::plog << " breakOffLoad_cubic could not break " - << ideal_load_to_break << " from " << box - << '/' << box.numberCells() - << '/' << box.numberCells().getProduct() - << std::endl; - } + const int max_cycles_to_time = 5; + t_compute_tree_load_for_cycle.resize(max_cycles_to_time, boost::shared_ptr()); + t_load_balance_for_cycle.resize(max_cycles_to_time, boost::shared_ptr()); + for (int i = 0; i < max_cycles_to_time; ++i) { + t_compute_tree_load_for_cycle[i] = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::compute_tree_load_for_cycle[" + + tbox::Utilities::intToString(i) + "]"); + t_load_balance_for_cycle[i] = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::load_balance_for_cycle[" + + tbox::Utilities::intToString(i) + "]"); } - } + t_local_load_moves = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::local_load_moves"); + + t_send_load_to_children = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::send_load_to_children"); + t_send_load_to_parent = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::send_load_to_parent"); + t_get_load_from_children = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::get_load_from_children"); + t_get_load_from_parent = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::get_load_from_parent"); - t_break_off_load->stop(); + t_post_load_distribution_barrier = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::post_load_distribution_barrier"); - return found_any_break; -} + t_report_loads = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::report_loads"); + t_finish_sends = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::finish_sends"); + + t_child_send_wait = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::child_send_wait"); + t_child_recv_wait = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::child_recv_wait"); + t_parent_send_wait = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::parent_send_wait"); + t_parent_recv_wait = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::parent_recv_wait"); + t_barrier_before = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::barrier_before"); + t_barrier_after = tbox::TimerManager::getManager()-> + getTimer(d_object_name + "::barrier_after"); + } +} /* ************************************************************************* - * Measuring surface area of boxes is used in penalizing - * the creation of new surfaces. ************************************************************************* */ - -double -TreeLoadBalancer::computeBoxSurfaceArea( - const std::vector& boxes) const +TreeLoadBalancer::BranchData::BranchData( + const PartitioningParams& pparams, + const TransitLoad& transit_load_prototype): + d_num_procs(0), + d_branch_load_current(0), + d_branch_load_ideal(-1), + d_branch_load_upperlimit(-1), + d_eff_num_procs(0), + d_eff_load_current(0), + d_eff_load_ideal(-1), + d_eff_load_upperlimit(-1), + d_shipment(transit_load_prototype.clone()), + d_wants_work_from_parent(false), + d_pparams(&pparams), + d_print_steps(false) { - int surface_area = 0; - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - ++bi) { - const hier::Box& box = *bi; - int volume = box.size(); - for (int d = 0; d < d_dim.getValue(); ++d) { - surface_area += volume / box.numberCells(d); - } - } - surface_area *= 2; - return surface_area; } - - /* ************************************************************************* - * Measuring surface area of boxes is used in penalizing - * the creation of new surfaces. ************************************************************************* */ - -int -TreeLoadBalancer::computeBoxSurfaceArea( - const hier::Box& box) const +TreeLoadBalancer::BranchData::BranchData( + const BranchData& other): + d_num_procs(other.d_num_procs), + d_branch_load_current(other.d_branch_load_current), + d_branch_load_ideal(other.d_branch_load_ideal), + d_branch_load_upperlimit(other.d_branch_load_upperlimit), + d_eff_num_procs(other.d_eff_num_procs), + d_eff_load_current(other.d_eff_load_current), + d_eff_load_ideal(other.d_eff_load_ideal), + d_eff_load_upperlimit(other.d_eff_load_upperlimit), + d_shipment(other.d_shipment->clone()), + d_wants_work_from_parent(other.d_wants_work_from_parent), + d_pparams(other.d_pparams), + t_pack_load(other.t_pack_load), + t_unpack_load(other.t_unpack_load), + d_print_steps(other.d_print_steps) { - int surface_area = 0; - int volume = box.size(); - for (int d = 0; d < d_dim.getValue(); ++d) { - surface_area += volume / box.numberCells(d); - } - surface_area *= 2; - return surface_area; } - - /* ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. + * Set the starting load, which includes only the local processor's + * contribution. The parent's and children's contributions would be + * added later. ************************************************************************* */ - -double -TreeLoadBalancer::computeSurfacePenalty( - const std::vector& a, - const std::vector& b) const +void TreeLoadBalancer::BranchData::setStartingLoad( + LoadType ideal, + LoadType current, + LoadType upperlimit) { - double surface_penalty = 0; - for (std::vector::const_iterator bi = a.begin(); - bi != a.end(); - ++bi) { - surface_penalty += computeSurfacePenalty(*bi); - } - for (std::vector::const_iterator bi = b.begin(); - bi != b.end(); - ++bi) { - surface_penalty += computeSurfacePenalty(*bi); - } - return surface_penalty; + d_num_procs = 1; + d_branch_load_ideal = ideal; + d_branch_load_current = current; + d_branch_load_upperlimit = upperlimit; + + d_eff_num_procs = d_num_procs; + d_eff_load_ideal = d_branch_load_ideal; + d_eff_load_current = d_branch_load_current; + d_eff_load_upperlimit = d_branch_load_upperlimit; } - - /* ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. + * Incorporate a child branch's data into this branch. ************************************************************************* */ - -double -TreeLoadBalancer::computeSurfacePenalty( - const TransitSet& a, - const TransitSet& b) const +void +TreeLoadBalancer::BranchData::incorporateChild( + const BranchData& child) { - double surface_penalty = 0; - for (TransitSet::const_iterator bi = a.begin(); bi != a.end(); ++bi) { - surface_penalty += computeSurfacePenalty(bi->d_box); - } - for (TransitSet::const_iterator bi = b.begin(); bi != b.end(); ++bi) { - surface_penalty += computeSurfacePenalty(bi->d_box); - } - return surface_penalty; -} + d_num_procs += child.d_num_procs; + d_branch_load_current += child.d_branch_load_current; + d_branch_load_upperlimit += child.d_branch_load_upperlimit; + d_branch_load_ideal += child.d_branch_load_ideal; + if (child.d_wants_work_from_parent) { + d_eff_num_procs += child.d_eff_num_procs; + d_eff_load_current += child.d_eff_load_current; + d_eff_load_upperlimit += child.d_eff_load_upperlimit; + d_eff_load_ideal += child.d_eff_load_ideal; + } + d_branch_load_current += child.d_shipment->getSumLoad(); + d_eff_load_current += child.d_shipment->getSumLoad(); +} /* ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. + * Incorporate a child branch's data into this branch. ************************************************************************* */ - -double -TreeLoadBalancer::computeSurfacePenalty( - const hier::Box& a) const +TreeLoadBalancer::LoadType TreeLoadBalancer::BranchData::adjustOutboundLoad( + TransitLoad& reserve, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) { - int boxvol = a.size(); - double surface_area = computeBoxSurfaceArea(a); - double best_surface = 2 * d_dim.getValue() * pow(static_cast(boxvol), - static_cast(d_dim.getValue() - 1) / d_dim.getValue()); - double surface_penalty = surface_area / best_surface - 1.0; - surface_penalty = surface_penalty * surface_penalty; // Make it blow up. - return surface_penalty; -} + LoadType actual_transfer = 0; + + if (low_load > d_pparams->getLoadComparisonTol()) { + + if (d_print_steps) { + tbox::plog << "BranchData::adjustOutboundLoad adjusting shipment to " + << ideal_load << " [" << low_load << ", " << high_load << "]\n"; + } + + actual_transfer = d_shipment->getSumLoad(); + + d_shipment->adjustLoad( + reserve, + ideal_load, + low_load, + high_load); + actual_transfer = d_shipment->getSumLoad() - actual_transfer; + + d_branch_load_current -= d_shipment->getSumLoad(); + d_eff_load_current -= d_shipment->getSumLoad(); + + if (d_print_steps) { + tbox::plog << "BranchData::adjustOutboundLoad: Assigned to shipment "; + d_shipment->recursivePrint(tbox::plog); + tbox::plog << std::endl; + tbox::plog << "Remaining in reserve: "; + reserve.recursivePrint(tbox::plog, " ", 0); + } + } + return actual_transfer; +} /* ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. + * We could empty d_shipment at the end of this method, because it + * is no longer essential. We keep its contents only for diagnostics. ************************************************************************* */ - -double -TreeLoadBalancer::computeSlenderPenalty( - const std::vector& a, - const std::vector& b) const +void TreeLoadBalancer::BranchData::moveInboundLoadToReserve( + TransitLoad& reserve) { - double slender_penalty = 0; - for (std::vector::const_iterator bi = a.begin(); - bi != a.end(); - ++bi) { - slender_penalty += computeSlenderPenalty(*bi); - } - for (std::vector::const_iterator bi = b.begin(); - bi != b.end(); - ++bi) { - slender_penalty += computeSlenderPenalty(*bi); - } - return slender_penalty; + reserve.insertAll(*d_shipment); } - - /* ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. ************************************************************************* */ - -double -TreeLoadBalancer::computeSlenderPenalty( - const TransitSet& a, - const TransitSet& b) const +void +TreeLoadBalancer::BranchData::packDataToParent( + tbox::MessageStream& msg) const { - double slender_penalty = 0; - for (TransitSet::const_iterator bi = a.begin(); bi != a.end(); ++bi) { - slender_penalty += computeSlenderPenalty(bi->d_box); - } - for (TransitSet::const_iterator bi = b.begin(); bi != b.end(); ++bi) { - slender_penalty += computeSlenderPenalty(bi->d_box); - } - return slender_penalty; + t_pack_load->start(); + msg << d_num_procs; + msg << d_branch_load_current; + msg << d_branch_load_ideal; + msg << d_branch_load_upperlimit; + msg << d_eff_num_procs; + msg << d_eff_load_current; + msg << d_eff_load_ideal; + msg << d_eff_load_upperlimit; + msg << d_wants_work_from_parent; + d_shipment->putToMessageStream(msg); + t_pack_load->stop(); } - - /* ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. ************************************************************************* */ - -double -TreeLoadBalancer::computeSlenderPenalty( - const hier::Box& a) const +void +TreeLoadBalancer::BranchData::unpackDataFromChild( + tbox::MessageStream& msg) { - const hier::IntVector boxdim = a.numberCells(); - double slender_penalty = static_cast(boxdim.max()) / boxdim.min() - 1.0; - slender_penalty = slender_penalty * slender_penalty; // Make it blow up. - return slender_penalty; + t_unpack_load->start(); + msg >> d_num_procs; + msg >> d_branch_load_current; + msg >> d_branch_load_ideal; + msg >> d_branch_load_upperlimit; + msg >> d_eff_num_procs; + msg >> d_eff_load_current; + msg >> d_eff_load_ideal; + msg >> d_eff_load_upperlimit; + msg >> d_wants_work_from_parent; + d_shipment->getFromMessageStream(msg); + t_unpack_load->stop(); } - - /* ************************************************************************* - * Break up box bursty against box solid and adds the pieces to list. - * This version differs from that in BoxContainer in that it tries to minimize - * slivers. ************************************************************************* */ - void -TreeLoadBalancer::burstBox( - std::vector& boxes, - const hier::Box& bursty, - const hier::Box& solid ) const +TreeLoadBalancer::BranchData::packDataToChild( + tbox::MessageStream& msg) const { - /* - * This method lacks logic to handle the case of solid not being - * completely inside bursty. That feature is not currently needed. - */ - TBOX_ASSERT(bursty.contains(solid)); - - const hier::IntVector solid_size = solid.numberCells(); - - boxes.clear(); - hier::Box cutme = bursty; - while (!cutme.isSpatiallyEqual(solid)) { - - int cut_dir = 999999; - bool cut_above_solid = false; // Whether to slice off the piece above solid (vs below). - /* - * Find direction and place to cut. To minimize slivers, cut - * from cutme the thickest slab (in direction normal to cut) - * possible. - */ - int slab_thickness = 0; - for (int d = 0; d < d_dim.getValue(); ++d) { - if (cutme.numberCells(d) > solid_size(d)) { - const int thickness_from_upper_cut = cutme.upper() (d) - - solid.upper() (d); - if (thickness_from_upper_cut > slab_thickness) { - slab_thickness = thickness_from_upper_cut; - cut_dir = d; - cut_above_solid = true; - } - const int thickness_from_lower_cut = solid.lower() (d) - - cutme.lower() (d); - if (thickness_from_lower_cut > slab_thickness) { - slab_thickness = thickness_from_lower_cut; - cut_dir = d; - cut_above_solid = false; - } - } - } - TBOX_ASSERT(cut_dir >= 0 && cut_dir < d_dim.getValue()); - - hier::Box removeme = cutme; - if (cut_above_solid) { - cutme.upper() (cut_dir) = solid.upper() (cut_dir); - removeme.lower() (cut_dir) = solid.upper() (cut_dir) + 1; - } else { - cutme.lower() (cut_dir) = solid.lower() (cut_dir); - removeme.upper() (cut_dir) = solid.lower() (cut_dir) - 1; - } - - boxes.push_back(removeme); - - } - - if (d_print_break_steps) { - tbox::plog << " burstBox: " << bursty << " = " << solid; - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - tbox::plog << " + " << *bi; - } - tbox::plog << std::endl; - } -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - for (std::vector::const_iterator bj = boxes.begin(); - bj != boxes.end(); - bj++) { - if (bi != bj) { - TBOX_ASSERT(!bi->intersects(*bj)); - } - } - } - hier::BoxContainer l1(bursty); - hier::BoxContainer l2(solid); - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - l2.pushFront(*bi); - } - l1.removeIntersections(l2); - TBOX_ASSERT(l1.size() == 0); - l2.removeIntersections(bursty); - TBOX_ASSERT(l2.size() == 0); -#endif + t_pack_load->start(); + d_shipment->putToMessageStream(msg); + t_pack_load->stop(); } - - /* ************************************************************************* ************************************************************************* */ -double -TreeLoadBalancer::computeLocalLoads( - const hier::BoxLevel& box_level) const -{ - // Count up workload. - double load = 0.0; - const hier::BoxContainer& boxes = box_level.getBoxes(); - for (hier::BoxContainer::const_iterator ni = boxes.begin(); - ni != boxes.end(); - ++ni) { - double box_load = computeLoad(*ni); - load += box_load; - } - return static_cast(load); -} - - - -/* - ************************************************************************* - * - * Print out all attributes of class instance for debugging. - * - ************************************************************************* - */ - void -TreeLoadBalancer::printClassData( - std::ostream& os) const +TreeLoadBalancer::BranchData::unpackDataFromParentAndIncorporate( + tbox::MessageStream& msg) { - os << "\nTreeLoadBalancer::printClassData..." << std::endl; - os << "\nTreeLoadBalancer: this = " - << (TreeLoadBalancer *)this << std::endl; - os << "d_object_name = " << d_object_name << std::endl; - - int ln; - - os << "d_workload_data_id..." << std::endl; - for (ln = 0; ln < d_workload_data_id.getSize(); ln++) { - os << " d_workload_data_id[" << ln << "] = " - << d_workload_data_id[ln] << std::endl; - } + t_unpack_load->start(); + d_shipment->getFromMessageStream(msg); + d_branch_load_current += d_shipment->getSumLoad(); + d_eff_load_current += d_shipment->getSumLoad(); + t_unpack_load->stop(); } - - /* - ************************************************************************* - * - * Read values (described in the class header) from input database. - * - ************************************************************************* + *********************************************************************** + *********************************************************************** */ - void -TreeLoadBalancer::getFromInput( - const boost::shared_ptr& db) +TreeLoadBalancer::BranchData::setTimerPrefix( + const std::string& timer_prefix) { - - if (db) { - - d_print_steps = - db->getBoolWithDefault("print_steps", - d_print_steps); - d_print_break_steps = - db->getBoolWithDefault("print_break_steps", - d_print_break_steps); - d_print_swap_steps = - db->getBoolWithDefault("print_swap_steps", - d_print_swap_steps); - d_print_edge_steps = - db->getBoolWithDefault("print_edge_steps", - d_print_edge_steps); - d_check_connectivity = - db->getBoolWithDefault("check_connectivity", - d_check_connectivity); - d_check_map = - db->getBoolWithDefault("check_map", - d_check_map); - - d_summarize_map = db->getBoolWithDefault("summarize_map", d_summarize_map); - - d_report_load_balance = db->getBoolWithDefault("report_load_balance", - d_report_load_balance); - d_barrier_before = db->getBoolWithDefault("barrier_before", - d_barrier_before); - d_barrier_after = db->getBoolWithDefault("barrier_after", - d_barrier_after); - - d_n_root_cycles = db->getIntegerWithDefault("n_root_cycles", - d_n_root_cycles); - - d_min_load_fraction_per_box = db->getDoubleWithDefault("min_load_fraction_per_box", - d_min_load_fraction_per_box); - if ( d_min_load_fraction_per_box >= 1.0 ) { - TBOX_ERROR("TreeLoadBalancer::getFromInput: min_load_fraction_per_box value of " - << d_min_load_fraction_per_box - << " is excessive. It should be on the order of 0.01."); - } - - d_balance_penalty_wt = db->getDoubleWithDefault("balance_penalty_wt", - d_balance_penalty_wt); - d_surface_penalty_wt = db->getDoubleWithDefault("surface_penalty_wt", - d_surface_penalty_wt); - d_slender_penalty_wt = db->getDoubleWithDefault("slender_penalty_wt", - d_slender_penalty_wt); - d_precut_penalty_wt = db->getDoubleWithDefault("precut_penalty_wt", - d_precut_penalty_wt); - - } + t_pack_load = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::pack_load"); + t_unpack_load = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::unpack_load"); } - - /* - *************************************************************************** - * - *************************************************************************** + *********************************************************************** + *********************************************************************** */ void -TreeLoadBalancer::assertNoMessageForPrivateCommunicator() const -{ - /* - * If using a private communicator, double check to make sure - * there are no remaining messages. This is not a guarantee - * that there is no messages in transit, but it can find - * messages that have arrived but not received. - */ - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - int flag; - tbox::SAMRAI_MPI::Status mpi_status; - int mpi_err = d_mpi.Iprobe(MPI_ANY_SOURCE, - MPI_ANY_TAG, - &flag, - &mpi_status); - if (mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error probing for possible lost messages."); - } - if (flag == true) { - int count = -1; - mpi_err = tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); - TBOX_ERROR( - "Library error!\n" - << "TreeLoadBalancer detected before or\n" - << "after using a private communicator that there\n" - << "is a message yet to be received. This is\n" - << "an error because all messages using the\n" - << "private communicator should have been\n" - << "accounted for. Message status:\n" - << "source " << mpi_status.MPI_SOURCE << '\n' - << "tag " << mpi_status.MPI_TAG << '\n' - << "count " << count << " (assuming integers)\n" - << "current tags: " - << ' ' << TreeLoadBalancer_LOADTAG0 << ' ' - << TreeLoadBalancer_LOADTAG1 - ); - } - } -} - - - -/* - ************************************************************************* - * Break off a load from a box by making a single planar cut across - * the box's longest dimension. - * - * Currently assuming uniform load of one unit per cell. - * - * Return whether a successful break was made. - ************************************************************************* - */ -bool -TreeLoadBalancer::breakOffLoad_planar( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const +TreeLoadBalancer::printStatistics( + std::ostream& output_stream) const { - - const tbox::Dimension dim(d_dim); - - if (d_print_break_steps) { - tbox::plog << " breakOffLoad_planar attempting to break " - << ideal_load_to_break << " from Box " << box - << " min_size=" << d_min_size << std::endl; - } - - brk_load = 0; - breakoff.clear(); - leftover.clear(); - - const hier::IntVector& box_dims = box.numberCells(); - - const int box_vol = box_dims.getProduct(); - - if (box_vol <= ideal_load_to_break) { - // Easy: break off everything. - breakoff.push_back(box); - brk_load = box_vol; - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar broke off entire Box " - << box - << std::endl; - } - return true; - } - - /* - * Determine ordering of box_dims from shortest to longest. - */ - hier::IntVector sorted_dirs(dim); - sorted_dirs.sortIntVector(box_dims); - - /* - * best_difference is the difference between the best cut found and - * ideal_load_to_break. Initialize it for zero breakoff. - */ - double best_difference = static_cast(ideal_load_to_break); - hier::Box best_breakoff_box(dim); - hier::Box best_leftover_box(dim); - best_breakoff_box.setBlockId(box.getBlockId()); - best_leftover_box.setBlockId(box.getBlockId()); - - for (int d = d_dim.getValue() - 1; d >= 0; --d) { - - /* - * Search directions from longest to shortest - * because we prefer to break across longest dir. - */ - const int brk_dir = sorted_dirs(d_dim.getValue() - 1); - - const int brk_area = box_vol / box_dims(brk_dir); - - const tbox::Array& bad = bad_cuts[brk_dir]; - - /* - * Try rounding the break length down (round==0) and up (round==1), - * looking for the best place to cut. - */ - for (int round = 0; round <= 1; ++round) { - - /* - * Rounding up or down must heed d_cut_factor, - * so brk_len must be an integer multiple of d_cut_factor. - */ - const int brk_len = - (static_cast(ideal_load_to_break / brk_area) - / d_cut_factor(brk_dir) + round) - * d_cut_factor(brk_dir); - - if (brk_len < d_min_size(brk_dir)) { - // Breakoff box violates minimum size. - continue; - } - - if (box_dims(brk_dir) - brk_len > 0 && - box_dims(brk_dir) - brk_len < d_min_size(brk_dir)) { - // Leftover box violates minimum size. - continue; - } - - const int brk_volume = brk_area * brk_len; - - /* - * Compute the difference between the current breakage - * and the ideal. - */ - const double difference = brk_volume <= ideal_load_to_break ? - static_cast(ideal_load_to_break - brk_volume) : - static_cast(brk_volume - ideal_load_to_break); - - if (difference < best_difference) { - // This cut gives better difference, if it can be done. - - TBOX_ASSERT(brk_len >= 0 && brk_len <= bad.size()); - - if (brk_len == box_dims(brk_dir) || - bad[brk_len] == false) { - // Cutting brk_len from low side is ok. - best_difference = difference; - best_breakoff_box = box; - best_breakoff_box.upper() (brk_dir) = - best_breakoff_box.lower() (brk_dir) + brk_len - 1; - best_leftover_box = box; - best_leftover_box.lower() (brk_dir) = - best_breakoff_box.upper() (brk_dir) + 1; - break; - } else if (bad[box_dims(brk_dir) - brk_len] == false) { - // Cutting brk_len from high side is ok. - best_difference = difference; - best_breakoff_box = box; - best_breakoff_box.lower() (brk_dir) = - best_breakoff_box.upper() (brk_dir) - brk_len + 1; - best_leftover_box = box; - best_leftover_box.upper() (brk_dir) = - best_breakoff_box.lower() (brk_dir) - 1; - break; - } - } - } - - } - - bool successful_break = false; - - if (!best_breakoff_box.empty()) { - breakoff.push_back(best_breakoff_box); - brk_load = best_breakoff_box.size(); - successful_break = true; - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar broke off box " << box - << " for breakoff box " << best_breakoff_box - << " and leftover " << best_leftover_box << std::endl; - } + if (d_load_stat.empty()) { + output_stream << "No statistics for TreeLoadBalancer.\n"; } else { - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar could not break " - << ideal_load_to_break << " from Box " << box - << std::endl; - } - } - if (!best_leftover_box.empty()) { - leftover.push_back(best_leftover_box); + BalanceUtilities::reduceAndReportLoadBalance( + d_load_stat, + tbox::SAMRAI_MPI::getSAMRAIWorld(), + output_stream); } - -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancer library error:\n" - << "breakoff box " << b << ", size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "break box size " << best_breakoff_box.numberCells() << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } - for (std::vector::iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancer library error:\n" - << "leftover box " << b << ", size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "break box size " << best_breakoff_box.numberCells() << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } -#endif - - return successful_break; } - - -/* - ************************************************************************* - * Break off a load from a box by making a box cut that is as close - * to cubic as feasible. - * - * Currently assuming uniform load of one unit per cell. - * - * Return whether a successful break was made. - * - * Differs from breakOffLoad in that it will always - * performs a break and if needed, break off more than - * the ideal. The calling method should take this into - * account. - ************************************************************************* - */ -bool -TreeLoadBalancer::breakOffLoad_cubic( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const -{ - - const hier::IntVector box_dims(box.numberCells()); - - const double box_load(box_dims.getProduct()); - - if (ideal_load_to_break >= box_load) { - // Easy: break off everything. - leftover.clear(); - breakoff.clear(); - breakoff.push_back(box); - brk_load = box_load; - if (d_print_break_steps) { - tbox::plog << " breakOffload_cubic broke off entire Box " - << box - << std::endl; - } - return true; - } - - if (ideal_load_to_break > 0.5 * box_load) { - /* - * This algorithm is better when breaking off a small portion. - * Since the ideal is a bigger portion, switch breakoff with leftover. - */ - if (d_print_break_steps) { - tbox::plog - << " breakOffload_cubic reversing direction to break " - << (box_dims.getProduct() - ideal_load_to_break) - << " instead of " << ideal_load_to_break << " / " - << box_dims.getProduct() << std::endl; - } - bool success = - breakOffLoad_cubic( - leftover, - breakoff, - brk_load, - box, - box_dims.getProduct() - ideal_load_to_break, - bad_cuts ); - if (success) { - brk_load = box_dims.getProduct() - brk_load; - } - return success; - } - - if (d_print_break_steps) { - tbox::plog << " breakOffload_cubic attempting to break " - << ideal_load_to_break << " from Box " << box - << " min_size=" << d_min_size << std::endl; - } - - breakoff.clear(); - leftover.clear(); - - /* - * brk_size is the size of the box we want to break off of - * box. We start with the smallest allowed brk_size that - * will not create remainders that violate size constraints. - * - * In the do loop below, we increase brk_size to bring brk_load - * closer to ideal_oad_to_break. - */ - hier::IntVector brk_size(d_min_size); - brk_size.max(d_cut_factor); - brk_size.min(box_dims); - /* - * If remainder is too small, zero it out to avoid - * having non-zero remainder smaller than d_min_size. - */ - for (int d = 0; d < d_dim.getValue(); ++d) { - if ((box_dims(d) - brk_size(d) > 0) && - (box_dims(d) - brk_size(d) < d_min_size(d))) { - brk_size(d) = box_dims(d); - } - } - brk_load = brk_size.getProduct(); - - if (d_print_break_steps) { - tbox::plog << " brk: " << std::flush; - tbox::plog << " " << brk_size << "->" << brk_load << std::flush; - } - - /* - * stop_growing: whether dimensions of brk_size is already - * big engough so that it cannot not be grown without breaking - * off too much. - */ - hier::IntVector stop_growing(d_dim, 0); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (brk_size[d] == box_dims[d]) stop_growing[d] = 1; - } - - if (brk_load < ideal_load_to_break) { - /* - * The do loop gradually increases brk_size to bring brk_load - * closer to ideal_load_to_break. - * - * Select dimension to increase in size, inc_dim. Use the - * smallest dimension that is still allowed to grow. - * - * Try a new break size that is bigger than the current brk_size - * by the minimal allowed amount. If this brings us closer to - * the ideal break amount, mark it. - * - * Exit the loop when we cannot grow anymore or we are already - * breaking off more than the ideal. - */ - do { - - int inc_dim = -1; - for (int d = 0; d < d_dim.getValue(); ++d) { - if (!stop_growing(d) && - (inc_dim == -1 || brk_size(inc_dim) > brk_size(d))) inc_dim = d; - } - if (inc_dim == -1) break; // No growable dimension. - - TBOX_ASSERT(brk_size(inc_dim) < box_dims(inc_dim)); - - hier::IntVector new_brk_size(brk_size); - new_brk_size(inc_dim) += d_cut_factor(inc_dim); - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "=>" << brk_load << std::flush; - } - - // Prevent remainder being smaller than d_min_size. - if (box_dims(inc_dim) - new_brk_size(inc_dim) < d_min_size(inc_dim)) { - new_brk_size(inc_dim) = box_dims(inc_dim); - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "==>" << brk_load - << std::flush; - } - } - - if (new_brk_size(inc_dim) == box_dims(inc_dim)) { - stop_growing(inc_dim) = 1; - } - - int new_brk_load = new_brk_size.getProduct(); - - if (new_brk_load <= ideal_load_to_break) { - /* - * new_brk_load is closer to ideal than current brk_load. - * Don't break out of the loop yet. We will grow it again - * and check. - */ - brk_size = new_brk_size; - brk_load = new_brk_load; - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "===>" << brk_load - << std::flush; - } - } else if ((new_brk_load - ideal_load_to_break) < - static_cast(ideal_load_to_break - brk_load)) { - /* - * new_brk_load is bigger than ideal but is still an - * improvement over brk_load. Accept it, but break out of - * the loop because further growing will not improve - * result. - */ - brk_size = new_brk_size; - brk_load = new_brk_load; - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "====>" << brk_load - << std::flush; - } - break; - } else { - /* - * Even though dimension inc_dim has not reached the box - * dimension, stop growing it because any further growth - * leads to too big a load. - */ - stop_growing(inc_dim) = 1; - } - - } while (true); - } - - if (d_print_break_steps) { - tbox::plog << std::endl; - } - - /* - * Find a place to put the break-off box so that it does not lie - * across a bad cut. If no such placement is found, set - * placement_impossible to true. - */ - hier::Box breakoff_box(d_dim); - breakoff_box.setBlockId(box.getBlockId()); - const hier::IntVector& lower(box.lower()); - const hier::IntVector& upper(box.upper()); - bool placement_impossible = false; - if (d_print_break_steps) { - tbox::plog << " Placing " << brk_size - << " to avoid bad cut points" << std::flush; - } - for (int d = 0; d < d_dim.getValue(); ++d) { - /* - * To minimize the number of boxes remaining after breakoff_box - * is removed, prefer to place breakoff_box against the upper or - * lower side of the Box. First try putting the breakoff_box - * along the upper side of dimension d. If it cuts the box at a - * bad point, try the lower side. If it still cuts at a bad - * points, slide the box toward the upper side until it does not - * cut at any bad points, being careful not to be so close to - * the box boundaries that we generate remainder boxes violating - * the minimum size. If no place can be found to put - * breakoff_box, set placement_impossible and give up. (We - * could go back and reshape the box at this point, but we won't - * because there is probably another box that would work without - * reshaping.) - */ - const tbox::Array& bad = bad_cuts[d]; - - int& gl = breakoff_box.lower()[d]; - int& gu = breakoff_box.upper()[d]; - - gu = upper[d]; - gl = gu - (brk_size[d] - 1); - if (!bad[gl - lower[d]]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " upper" << std::flush; - } - continue; - } - - gl = lower[d]; - gu = gl + (brk_size[d] - 1); - if (gu + 1 - lower[d] < bad.size() && !bad[gu + 1 - lower[d]]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " lower" << std::flush; - } - continue; - } - - gl = lower[d] + d_min_size[d]; - gu = gl + (brk_size[d] - 1); - while (gu <= upper[d] - d_min_size[d] && - (bad[gl - lower[d]] || bad[gu + 1 - lower[d]])) { - ++gl; - ++gu; - } - if (gu <= upper[d] - d_min_size[d]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " middle" << std::flush; - } - continue; - } - - if (d_print_break_steps) { - tbox::plog << " cannot place dim " << d - << " without creating bad cuts." - << std::flush; - } - placement_impossible = true; - /* - * Cannot find place for breakoff_box along dimension d. - * No point in looking at higher dimensions. - */ - break; - } - if (d_print_break_steps) { - tbox::plog << std::endl; - } - if (placement_impossible) { - return false; - } - - breakoff.clear(); - breakoff.push_back(breakoff_box); - - burstBox( - leftover, - box, - breakoff_box ); - -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancer library error:\n" - << "breakoff box " << b << ", with size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "orig box " << box << "\n" - << "break box " << breakoff_box << "\n" - << "break box size " << brk_size << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } - for (std::vector::iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancer library error:\n" - << "leftover box " << b << ", with size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "orig box " << box << "\n" - << "break box " << breakoff_box << "\n" - << "break box size " << brk_size << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } -#endif - - return true; -} - - - -/* -************************************************************************** -* Move Boxes in balance_box_level from ranks outside of -* rank_group to ranks inside rank_group. Modify the given connectors -* to make them correct following this moving of boxes. -************************************************************************** -*/ - -void -TreeLoadBalancer::prebalanceBoxLevel( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const tbox::RankGroup& rank_group) const -{ - - if (balance_to_anchor.isFinalized()) { - TBOX_ASSERT(anchor_to_balance.checkTransposeCorrectness(balance_to_anchor) == 0); - TBOX_ASSERT(balance_to_anchor.checkTransposeCorrectness(anchor_to_balance) == 0); - } - - /* - * tmp_box_level will contain the same boxes as - * balance_box_level, but all will live on the processors - * specified in rank_group. - */ - hier::BoxLevel tmp_box_level(d_dim); - tmp_box_level.initialize( - balance_box_level.getRefinementRatio(), - balance_box_level.getGridGeometry(), - balance_box_level.getMPI()); - - /* - * If a rank is not in rank_group it is called a "sending" rank, as - * it will send any Boxes it has to a rank in rank_group. - */ - bool is_sending_rank = rank_group.isMember(d_mpi.getRank()) ? false : true; - - int output_nproc = rank_group.size(); - - /* - * the send and receive comm objects - */ - tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer* box_send = NULL; - tbox::AsyncCommPeer* box_recv = NULL; - tbox::AsyncCommPeer* id_send = NULL; - tbox::AsyncCommPeer* id_recv = NULL; - - /* - * A sending rank will send its Boxes to a receiving rank, and - * that receiving processor will add it to its local set of Boxes. - * When the box is added on the receiving processor, it will receive - * a new LocalId. This LocalId value needs to be sent back to - * the sending processor, in order to construct the mapping connectors. - * - * Therefore the sending ranks construct comm objects for sending boxes - * and receiving LocalIdes. - * - * Sending processors send to ranks in the rank_group determined by - * a modulo heuristic. - */ - if (is_sending_rank) { - box_send = new tbox::AsyncCommPeer; - box_send->initialize(&comm_stage); - box_send->setPeerRank(rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - box_send->setMPI(d_mpi); - box_send->setMPITag(TreeLoadBalancer_PREBALANCE0 + 2 * d_mpi.getRank(), - TreeLoadBalancer_PREBALANCE1 + 2 * d_mpi.getRank()); - - id_recv = new tbox::AsyncCommPeer; - id_recv->initialize(&comm_stage); - id_recv->setPeerRank(rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - id_recv->setMPI(d_mpi); - id_recv->setMPITag(TreeLoadBalancer_PREBALANCE0 + 2 * d_mpi.getRank(), - TreeLoadBalancer_PREBALANCE1 + 2 * d_mpi.getRank()); - } - - /* - * The receiving ranks construct comm objects for receiving boxes - * and sending LocalIdes. - */ - int num_recvs = 0; - if (rank_group.isMember(d_mpi.getRank())) { - std::list recv_ranks; - for (int i = 0; i < d_mpi.getSize(); i++) { - if (!rank_group.isMember(i) && - rank_group.getMappedRank(i % output_nproc) == d_mpi.getRank()) { - recv_ranks.push_back(i); - } - } - num_recvs = static_cast(recv_ranks.size()); - if (num_recvs > 0) { - box_recv = new tbox::AsyncCommPeer[num_recvs]; - id_send = new tbox::AsyncCommPeer[num_recvs]; - int recv_count = 0; - for (std::list::const_iterator ri(recv_ranks.begin()); - ri != recv_ranks.end(); ri++) { - const int rank = *ri; - box_recv[recv_count].initialize(&comm_stage); - box_recv[recv_count].setPeerRank(rank); - box_recv[recv_count].setMPI(d_mpi); - box_recv[recv_count].setMPITag(TreeLoadBalancer_PREBALANCE0 + 2 * rank, - TreeLoadBalancer_PREBALANCE1 + 2 * rank); - - id_send[recv_count].initialize(&comm_stage); - id_send[recv_count].setPeerRank(rank); - id_send[recv_count].setMPI(d_mpi); - id_send[recv_count].setMPITag(TreeLoadBalancer_PREBALANCE0 + 2 * rank, - TreeLoadBalancer_PREBALANCE1 + 2 * rank); - - recv_count++; - } - TBOX_ASSERT(num_recvs == recv_count); - } - } - - /* - * Construct the mapping Connectors which describe the mapping from the box - * configuration of the given balance_box_level, to the new - * configuration stored in tmp_box_level. These mapping Connectors - * are necessary to modify the two Connectors given in the argument list, - * so that on return from this method, they will be correct for the new - * balance_box_level. - */ - hier::Connector balance_to_tmp(balance_box_level, - tmp_box_level, - hier::IntVector::getZero(d_dim)); - - hier::Connector tmp_to_balance(tmp_box_level, - balance_box_level, - hier::IntVector::getZero(d_dim)); - - /* - * Where Boxes already exist on ranks in rank_group, - * move them directly to tmp_box_level. - */ - if (!is_sending_rank) { - const hier::BoxContainer& unchanged_boxes = - balance_box_level.getBoxes(); - - for (hier::BoxContainer::const_iterator ni = unchanged_boxes.begin(); - ni != unchanged_boxes.end(); ++ni) { - - const hier::Box& box = *ni; - tmp_box_level.addBox(box); - } - } - - const int buf_size = hier::Box::commBufferSize(d_dim); - - /* - * On sending ranks, pack the Boxes into buffers and send. - */ - if (is_sending_rank) { - const hier::BoxContainer& sending_boxes = - balance_box_level.getBoxes(); - const int num_sending_boxes = - static_cast(sending_boxes.size()); - - int* buffer = new int[buf_size * num_sending_boxes]; - int box_count = 0; - for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); - ni != sending_boxes.end(); ++ni) { - - const hier::Box& box = *ni; - - box.putToIntBuffer(&buffer[box_count * buf_size]); - box_count++; - } - box_send->beginSend(buffer, buf_size * num_sending_boxes); - - delete[] buffer; - } - - /* - * On receiving ranks, complete the receives, add the boxes to local - * tmp_box_level, insert boxes into tmp_to_balance, and then - * send the new LocalIdes back to the sending processors. - */ - if (!is_sending_rank && num_recvs > 0) { - for (int i = 0; i < num_recvs; i++) { - box_recv[i].beginRecv(); - } - int num_completed_recvs = 0; - tbox::Array completed(num_recvs, false); - while (num_completed_recvs < num_recvs) { - for (int i = 0; i < num_recvs; i++) { - if (!completed[i] && box_recv[i].checkRecv()) { - num_completed_recvs++; - completed[i] = true; - const int num_boxes = box_recv[i].getRecvSize() / buf_size; - const int* buffer = box_recv[i].getRecvData(); - int* id_buffer = new int[num_boxes]; - - for (int b = 0; b < num_boxes; b++) { - hier::Box box(d_dim); - - box.getFromIntBuffer(&buffer[b * buf_size]); - - hier::BoxContainer::const_iterator tmp_iter = - tmp_box_level.addBox(box, - box.getBlockId()); - - hier::BoxId tmp_box_id = tmp_iter->getId(); - - tmp_to_balance.insertLocalNeighbor(box, tmp_box_id); - - id_buffer[b] = tmp_box_id.getLocalId().getValue(); - } - id_send[i].beginSend(id_buffer, num_boxes); - - delete[] id_buffer; - } - } - } - for (int i = 0; i < num_recvs; i++) { - if (!id_send[i].checkSend()) { - id_send[i].completeCurrentOperation(); - } - } - } - - /* - * On sending ranks, receive the LocalIds, and add the edges - * to balance_to_tmp. - */ - if (is_sending_rank) { - if (!box_send->checkSend()) { - box_send->completeCurrentOperation(); - } - - id_recv->beginRecv(); - - if (!id_recv->checkRecv()) { - id_recv->completeCurrentOperation(); - } - const int* buffer = id_recv->getRecvData(); - - const hier::BoxContainer& sending_boxes = - balance_box_level.getBoxes(); - TBOX_ASSERT(static_cast(id_recv->getRecvSize()) == sending_boxes.size()); - - int box_count = 0; - for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); - ni != sending_boxes.end(); ++ni) { - - hier::Box new_box( - *ni, - (hier::LocalId)buffer[box_count], - rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - - balance_to_tmp.insertLocalNeighbor(new_box, (*ni).getId()); - box_count++; - } - } - balance_to_tmp.setConnectorType(hier::Connector::MAPPING); - tmp_to_balance.setConnectorType(hier::Connector::MAPPING); - - if (anchor_to_balance.isFinalized()) { - /* - * This modify operation copies tmp_box_level to - * balance_box_level, and changes anchor_to_balance and - * balance_to_anchor such that they are correct for the new state - * of balance_box_level. - */ - const hier::MappingConnectorAlgorithm mca; - mca.modify(anchor_to_balance, - balance_to_anchor, - balance_to_tmp, - tmp_to_balance, - &balance_box_level, - &tmp_box_level); - - TBOX_ASSERT(anchor_to_balance.checkTransposeCorrectness(balance_to_anchor) == 0); - TBOX_ASSERT(balance_to_anchor.checkTransposeCorrectness(anchor_to_balance) == 0); - } else { - hier::BoxLevel::swap(balance_box_level, tmp_box_level); - } - - /* - * Clean up raw pointer allocation. - */ - if (is_sending_rank) { - delete box_send; - delete id_recv; - } - if (num_recvs) { - delete[] box_recv; - delete[] id_send; - } -} - - - -/* -************************************************************************** -************************************************************************** -*/ - -std::ostream& -operator << ( - std::ostream& co, - const TreeLoadBalancer::BoxInTransit& r) -{ - co << r.d_box - << r.d_box.numberCells() << '|' - << r.d_box.numberCells().getProduct(); - co << '-' << r.d_orig_box - << r.d_box.numberCells() << '|' - << r.d_box.numberCells().getProduct(); - return co; -} - - - /* *********************************************************************** *********************************************************************** */ void -TreeLoadBalancer::setTimers() -{ - /* - * The first constructor gets timers from the TimerManager. - * and sets up their deallocation. - */ - if (!t_load_balance_box_level) { - t_load_balance_box_level = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::loadBalanceBoxLevel()"); - t_get_map = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_map"); - t_use_map = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::use_map"); - t_constrain_size = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constrain_size"); - t_map_big_boxes = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::mapOversizedBoxes()"); - t_load_distribution = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::load_distribution"); - t_compute_local_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_local_load"); - t_compute_global_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_global_load"); - t_compute_tree_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_tree_load"); - - const int max_cycles_to_time = 4; - t_compute_tree_load_for_cycle.resize( - max_cycles_to_time, - boost::shared_ptr() ); - for ( int i=0; i - getTimer(d_object_name + "::compute_tree_load_for_cycle[" - + tbox::Utilities::intToString(i) + "]"); - } - - t_break_off_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::breakOffLoad()"); - t_find_bad_cuts = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::find_bad_cuts"); - t_reassign_loads = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::reassignLoads()"); - t_shift_loads_by_swapping = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::shiftLoadsBySwapping()"); - t_shift_loads_by_breaking = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::shiftLoadsByBreaking()"); - t_find_swap_pair = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::swapLoadPair()"); - t_send_load_to_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_load_to_children"); - t_send_load_to_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_load_to_parent"); - t_get_load_from_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_load_from_children"); - t_get_load_from_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_load_from_parent"); - t_construct_semilocal = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constructSemilocalUnbalancedToBalanced()"); - t_construct_semilocal_comm_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constructSemilocalUnbalancedToBalanced()_comm_wait"); - t_send_edge_to_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_edge_to_children"); - t_send_edge_to_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_edge_to_parent"); - t_get_edge_from_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_edge_from_children"); - t_get_edge_from_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_edge_from_parent"); - t_report_loads = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::report_loads"); - t_finish_sends = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::finish_sends"); - t_local_balancing = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::local_balancing"); - t_pack_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::pack_load"); - t_unpack_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::unpack_load"); - t_pack_edge = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::pack_edge"); - t_unpack_edge = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::unpack_edge"); - t_parent_load_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_load_comm"); - t_children_load_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::children_load_comm"); - t_parent_edge_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_edge_comm"); - t_children_edge_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::children_edge_comm"); - t_barrier_before = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::barrier_before"); - t_barrier_after = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::barrier_after"); - t_child_send_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::child_send_wait"); - t_child_recv_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::child_recv_wait"); - t_parent_send_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_send_wait"); - t_parent_recv_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_recv_wait"); - } -} - -/* - ************************************************************************* - ************************************************************************* - */ -TreeLoadBalancer::BoxInTransit::BoxInTransit( - const tbox::Dimension &dim) : - d_box(dim), - d_orig_box(dim) -{ -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -TreeLoadBalancer::BoxInTransit::BoxInTransit( - const hier::Box& origin): - d_box(origin), - d_orig_box(origin), - d_boxload(origin.size()) -{ -} - - - -/* - ************************************************************************* - * Construct a new BoxInTransit with the history of an existing box. - ************************************************************************* - */ -TreeLoadBalancer::BoxInTransit::BoxInTransit( - const BoxInTransit& other, - const hier::Box& box, - int rank, - hier::LocalId local_id): - d_box(box, local_id, rank), - d_orig_box(other.d_orig_box), - d_boxload(d_box.size()) -{ -} - -void -TreeLoadBalancer::BoxInTransit::putToMessageStream( - tbox::MessageStream &mstream ) const -{ - d_box.putToMessageStream(mstream); - d_orig_box.putToMessageStream(mstream); - mstream << d_boxload; - return; -} - -void -TreeLoadBalancer::BoxInTransit::getFromMessageStream( - tbox::MessageStream &mstream ) -{ - d_box.getFromMessageStream(mstream); - d_orig_box.getFromMessageStream(mstream); - mstream >> d_boxload; - return; -} - -TreeLoadBalancer::SubtreeLoadData::SubtreeLoadData(): - d_num_procs(0), - d_total_work(0), - d_load_exported(0), - d_load_imported(0) +TreeLoadBalancer::BranchData::recursivePrint( + std::ostream& os, + const std::string& border, + int detail_depth) const { + os.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + os.precision(6); + os << border + << "Full nproc = " << d_num_procs + << " current = " << d_branch_load_current + << " ideal = " << d_branch_load_ideal + << " ratio = " << (d_branch_load_current / d_branch_load_ideal) + << " avg = " << (d_branch_load_current / d_num_procs) + << " upperlimit = " << d_branch_load_upperlimit + << " surplus = " << surplus() + << " excess = " << excess() + << '\n' << border + << "Effective nproc = " << d_eff_num_procs + << " current = " << d_eff_load_current + << " ideal = " << d_eff_load_ideal + << " ratio = " << (d_eff_load_current / d_eff_load_ideal) + << " avg = " << (d_eff_load_current / d_eff_num_procs) + << " upperlimit = " << d_eff_load_upperlimit + << " surplus = " << effSurplus() + << " excess = " << effExcess() + << '\n' << border + << " wants work from parent = " << d_wants_work_from_parent + << '\n' << border + << " shipment: "; + d_shipment->recursivePrint(os, border + " ", detail_depth - 1); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.h index b9baeb0c..1c7499a3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Scalable load balancer using tree algorithm. * ************************************************************************/ @@ -12,31 +12,27 @@ #define included_mesh_TreeLoadBalancer #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" #include "SAMRAI/mesh/LoadBalanceStrategy.h" +#include "SAMRAI/mesh/PartitioningParams.h" +#include "SAMRAI/mesh/TransitLoad.h" #include "SAMRAI/tbox/AsyncCommPeer.h" #include "SAMRAI/tbox/AsyncCommStage.h" -#include "SAMRAI/tbox/BalancedDepthFirstTree.h" +#include "SAMRAI/tbox/CommGraphWriter.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/RankGroup.h" -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" +#include "SAMRAI/tbox/RankTreeStrategy.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include -#include namespace SAMRAI { namespace mesh { - - - - /*! * @brief Provides load balancing routines for AMR hierarchy by * implemementing the LoadBalancerStrategy. @@ -49,30 +45,78 @@ namespace mesh { * non-uniform load balancing should be supported. (Non-uniform load * balancing is supported by the CutAndPackLoadBalancer class.) * - * Inputs and their default values: + * Input Parameters + * + * Definitions: + * + * - \b flexible_load_tolerance + * Fraction of ideal load a process can + * take on in order to reduce box cutting and load movement. Higher + * values often reduce partitioning time and box count but produce + * less balanced work loads. Surplus work greater than this + * tolerance can still result due to other constraints, such as + * minimum box size. + * + * - \b tile_size + * Tile size when using tile mode. Tile mode restricts box cuts + * to tile boundaries. Default is 1, which is equivalent to no restriction. + * + * - \b max_spread_procs + * This parameter limits how many processes may receive the load of one + * process in a load distribution cycle. If a process has too much + * initial load, this limit causes the load to distribute the load over + * multiple cycles. It alleviates the bottle-neck of one process having + * to work with too many other processes in any cycle. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
flexible_load_tolerancedouble0.050-1optNot written to restart. Value in input db used.
tile_sizeIntVector11-optNot written to restart. Value in input db used.
max_spread_procsint500 > 1optNot written to restart. Value in input db used.
+ * + * @internal The following are developer inputs. Defaults listed + * in parenthesis: * - * No special inputs are required for this class. + * @internal DEV_voucher_mode (false) + * bool + * Whether to use experimental voucher mode. * - * @verbatim - * min_load_fraction_per_box = 0.03 - * // Additional restriction on box size. - * // Will not generate a box that has less - * // than this fraction of the global average - * // work load in order to move work load. - * // Set to negative to disable. - * report_load_balance = TRUE // Write out load balance report in log - * n_root_cycles = -1 // Number of steps over which to smoothly spread - * // out work load. This helps scalability when - * // initial work load is grossly unbalanced. - * // Usually 1 step is sufficient. - * // Can be set higher (2 or 3) to reduce negative - * // performance effects of extremely poor initial - * // load balance. Set to -1 (default) to compute - * // the number of cycles by a simple heuristic. - * // Set to zero to effectively bypass load balancing. - * @endverbatim + * @internal DEV_allow_box_breaking (true) + * bool + * Whether to allow box-breaking. Set to false when boxes have + * been pre-cut. * - * @see mesh::LoadBalanceStrategy + * @see LoadBalanceStrategy */ class TreeLoadBalancer: @@ -85,19 +129,25 @@ class TreeLoadBalancer: * * @param[in] dim * - * @param[in] name User-defined std::string identifier used for error - * reporting and timer names. If omitted, "TreeLoadBalancer" - * is used. + * @param[in] name User-defined identifier used for diagnostic reports + * and timer names. * * @param[in] input_db (optional) database pointer providing * parameters from input file. This pointer may be null indicating * no input is used. + * + * @param[in] rank_tree How to arange a contiguous range of MPI ranks + * into a tree. If omitted, we use a tbox::CenteredRankTree. + * + * @pre !name.empty() */ TreeLoadBalancer( const tbox::Dimension& dim, - const std::string& name = std::string("TreeLoadBalancer"), + const std::string& name, const boost::shared_ptr& input_db = - boost::shared_ptr()); + boost::shared_ptr(), + const boost::shared_ptr& rank_tree = + boost::shared_ptr()); /*! * @brief Virtual destructor releases all internal storage. @@ -114,7 +164,8 @@ class TreeLoadBalancer: * requires a global communication, so all processes in the * communicator must call it. The advantage of a duplicate * communicator is that it ensures the communications for the - * object won't accidentally interact with other communications. + * object won't accidentally interact with unrelated + * communications. * * If the duplicate SAMRAI_MPI it is set, the TreeLoadBalancer will * only balance BoxLevels with congruent SAMRAI_MPI objects and @@ -122,6 +173,8 @@ class TreeLoadBalancer: * Otherwise, the SAMRAI_MPI of the BoxLevel will be used. The * duplicate MPI communicator is freed when the object is * destructed, or freeMPICommunicator() is called. + * + * @pre samrai_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull */ void setSAMRAI_MPI( @@ -156,30 +209,14 @@ class TreeLoadBalancer: * Optional integer number for level on which data id * is used. If no value is given, the data will be * used for all levels. + * + * @pre hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataFactory(data_id) is actually a boost::shared_ptr > */ void setWorkloadPatchDataIndex( int data_id, int level_number = -1); - /*! - * @brief Configure the load balancer to load balance boxes by - * assuming all cells on the specified level or all hierarchy - * levels are weighted equally. - * - * @param level_number - * Optional integer number for level on which uniform - * workload estimate will be used. If the level - * number is not specified, a uniform workload - * estimate will be used on all levels. - */ - void - setUniformWorkload( - int level_number = -1) - { - d_workload_data_id[level_number] = -1; - } - /*! * @brief Return true if load balancing procedure for given level * depends on patch data on mesh; otherwise return false. @@ -195,568 +232,348 @@ class TreeLoadBalancer: * * Note: This implementation does not yet support non-uniform load * balancing. + * + * @pre !balance_to_anchor || balance_to_anchor->hasTranspose() + * @pre !balance_to_anchor || balance_to_anchor->isTransposeOf(balance_to_anchor->getTranspose()) + * @pre (d_dim == balance_box_level.getDim()) && + * (d_dim == min_size.getDim()) && (d_dim == max_size.getDim()) && + * (d_dim == domain_box_level.getDim()) && + * (d_dim == bad_interval.getDim()) && (d_dim == cut_factor.getDim()) + * @pre !hierarchy || (d_dim == hierarchy->getDim()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getSize()) + * @pre !d_mpi_is_dupe || (d_mpi.getSize() == balance_box_level.getMPI().getRank()) */ void loadBalanceBoxLevel( - hier::BoxLevel& balance_mapped_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, + hier::BoxLevel& balance_box_level, + hier::Connector* balance_to_anchor, const boost::shared_ptr& hierarchy, const int level_number, - const hier::Connector& unbalanced_to_attractor, - const hier::Connector& attractor_to_unbalanced, const hier::IntVector& min_size, const hier::IntVector& max_size, - const hier::BoxLevel& domain_mapped_box_level, + const hier::BoxLevel& domain_box_level, const hier::IntVector& bad_interval, const hier::IntVector& cut_factor, const tbox::RankGroup& rank_group = tbox::RankGroup()) const; /*! - * @brief Print out all members of the class instance to given - * output stream. + * @brief Write out statistics recorded for the most recent load + * balancing result. * * @param[in] output_stream */ - virtual void - printClassData( - std::ostream& output_stream) const; + void + printStatistics( + std::ostream& output_stream = tbox::plog) const; /*! - * @brief Write out statistics recorded for the most recent load - * balancing result. + * @brief Enable or disable saving of tree data for diagnostics. * - * @param[in] output_stream + * @param [in] comm_graph_writer + * External CommGraphWriter to save tree data to. + * Use 0 to disable saving. */ void - printStatistics( - std::ostream& output_stream = tbox::plog) const + setCommGraphWriter( + const boost::shared_ptr& comm_graph_writer) { - BalanceUtilities::gatherAndReportLoadBalance(d_load_stat, - tbox::SAMRAI_MPI::getSAMRAIWorld(), - output_stream); + d_comm_graph_writer = comm_graph_writer; } - + /*! + * @brief Get the name of this object. + */ + const std::string& + getObjectName() const + { + return d_object_name; + } private: + typedef double LoadType; + + /* + * Static integer constants. Tags are for isolating messages + * from different phases of the algorithm. + */ + static const int TreeLoadBalancer_LOADTAG0 = 1; + static const int TreeLoadBalancer_LOADTAG1 = 2; + static const int TreeLoadBalancer_FIRSTDATALEN = 500; + + // The following are not implemented, but are provided here for + // dumb compilers. + + TreeLoadBalancer( + const TreeLoadBalancer&); - typedef int LoadType; + TreeLoadBalancer& + operator = ( + const TreeLoadBalancer&); /*! - * @brief Data to save for each Box that gets passed along the tree - * edges. + * @brief Data to save for each sending/receiving process and the + * branch at that process. * - * The purpose of the BoxInTransit is to associate extra data with - * a Box as it is broken up and passed from process to process. A - * BoxInTransit is a Box going through these changes. It has a - * current work load and an orginating Box. + * Terminology: Parts of any tree may not be open to receiving work + * from their parents because they have enough work already. These + * parts are not counted in the "effective" tree for the purpose of + * distributing work on the branch. */ - struct BoxInTransit { - - /*! - * @brief Constructor - * - * @param[in] dim - */ - BoxInTransit(const tbox::Dimension& dim); + class BranchData + { - /*! - * @brief Construct a new BoxInTransit from an originating box. - * - * @param[in] other - */ - BoxInTransit(const hier::Box& origin); +public: + //! @brief Constructor. + BranchData( + const PartitioningParams& pparams, + const TransitLoad& transit_load_prototype); + //! @brief Copy constructor. + BranchData( + const BranchData& other); /*! - * @brief Construct new object having the history an existing - * object but is otherwise different. - * - * @param[in] other - * - * @param[in] box - * - * @param[in] rank - * - * @param[in] local_id + * @brief Set the starting ideal, current and upper limit of the + * load for the branch, which includes just the values from + * local process. */ - BoxInTransit( - const BoxInTransit& other, - const hier::Box& box, - int rank, - hier::LocalId local_id); + void + setStartingLoad( + LoadType ideal, + LoadType current, + LoadType upperlimit); - /*! - * @brief Assignment operator - * - * @param[in] other - */ - const BoxInTransit& - operator = (const BoxInTransit& other) + //! @brief Number of processes in branch. + int numProcs() const { - d_box = other.d_box; - d_orig_box = other.d_orig_box; - d_boxload = other.d_boxload; - return *this; + return d_num_procs; + } + //! @brief Number of processes in effective branch. + int numProcsEffective() const + { + return d_eff_num_procs; } - //! @brief Return the owner rank. - int - getOwnerRank() const + //@{ + //! @name Amount of work in branch, compared to various references. + // surplus and deficit are current load compared to ideal. + LoadType surplus() const + { + return d_branch_load_current - d_branch_load_ideal; + } + LoadType deficit() const + { + return d_branch_load_ideal - d_branch_load_current; + } + LoadType effSurplus() const + { + return d_eff_load_current - d_eff_load_ideal; + } + LoadType effDeficit() const + { + return d_eff_load_ideal - d_eff_load_current; + } + // excess and margin are current load compared to upper limit. + LoadType excess() const { - return d_box.getOwnerRank(); + return d_branch_load_current - d_branch_load_upperlimit; } + LoadType margin() const + { + return d_branch_load_upperlimit - d_branch_load_current; + } + LoadType effExcess() const + { + return d_eff_load_current - d_eff_load_upperlimit; + } + LoadType effMargin() const + { + return d_eff_load_upperlimit - d_eff_load_current; + } + //@} - //! @brief Return the LocalId. - hier::LocalId - getLocalId() const + //! @brief Tell this tree to eventually ask for work from its parent. + void setWantsWorkFromParent() { - return d_box.getLocalId(); + d_wants_work_from_parent = true; } - //! @brief Return the Box. - hier::Box& - getBox() + //! @brief Get whether this branch want work from its parents. + bool getWantsWorkFromParent() const { - return d_box; + return d_wants_work_from_parent; } - //! @brief Return the Box. - const hier::Box& - getBox() const + //@{ + //! @name Information on work shipped + //! @brief Get amount of work shipped. + LoadType getShipmentLoad() const + { + return d_shipment->getSumLoad(); + } + //! @brief Get count of work shipped. + size_t getShipmentPackageCount() const + { + return d_shipment->getNumberOfItems(); + } + //! @brief Get count of originators of the work shipped. + size_t getShipmentOriginatorCount() const { - return d_box; + return d_shipment->getNumberOfOriginatingProcesses(); } + //@} + //@{ + //! @name Methods supporting load import/export. /*! - * @brief Put self into a MessageStream. - * - * This is the opposite of getFromMessageStream(). + * @brief Adjust load to be sent away by taking work from or + * dumping work into a reserve container. */ + LoadType + adjustOutboundLoad( + TransitLoad& reserve, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + //! @brief Move inbound load to the given reserve container. void - putToMessageStream( - tbox::MessageStream &msg) const; + moveInboundLoadToReserve( + TransitLoad& reserve); /*! - * @brief Set attributes according to data in a MessageStream. - * - * This is the opposite of putToMessageStream(). + * @brief Incorporate child branch into this branch. */ void - getFromMessageStream( - tbox::MessageStream &msg); - - //! @brief The Box. - hier::Box d_box; - - //! @brief Originating Box. - hier::Box d_orig_box; - - //! @brief Work load in this box. - LoadType d_boxload; - }; - - - /*! - * @brief Insert BoxInTransit into an output stream. - */ - friend std::ostream& - operator << ( - std::ostream& co, - const BoxInTransit& r); - - - /*! - * @brief Comparison functor for sorting BoxInTransit from more to - * less loads. - */ - struct BoxInTransitMoreLoad { - /* - * @brief Compares two BoxInTransit for sorting them from more load - * to less load. - */ - bool - operator () ( - const BoxInTransit& a, - const BoxInTransit& b) const - { - if (a.getBox().size() != b.getBox().size()) { - return a.d_boxload > b.d_boxload; - } - return a.d_box.getId() < b.d_box.getId(); - } - }; - + incorporateChild( + const BranchData& child); + //@} + //@{ + //! @name Packing/unpacking for communication up and down the tree. - /* - * Static integer constants. Tags are for isolating messages - * from different phases of the algorithm. - */ - static const int TreeLoadBalancer_LOADTAG0 = 1; - static const int TreeLoadBalancer_LOADTAG1 = 2; - static const int TreeLoadBalancer_EDGETAG0 = 3; - static const int TreeLoadBalancer_EDGETAG1 = 4; - static const int TreeLoadBalancer_PREBALANCE0 = 5; - static const int TreeLoadBalancer_PREBALANCE1 = 6; - static const int TreeLoadBalancer_FIRSTDATALEN = 1000; + //! @brief Pack load/boxes for sending up to parent. + void + packDataToParent( + tbox::MessageStream& msg) const; - static const int TreeLoadBalancer_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE = 65; + //! @brief Unpack load/boxes received from child. + void + unpackDataFromChild( + tbox::MessageStream& msg); - // The following are not implemented, but are provided here for - // dumb compilers. + //! @brief Pack load/boxes for sending down to child. + void + packDataToChild( + tbox::MessageStream& msg) const; - TreeLoadBalancer( - const TreeLoadBalancer&); + //! @brief Unpack load/boxes received from parent. + void + unpackDataFromParentAndIncorporate( + tbox::MessageStream& msg); - void - operator = ( - const TreeLoadBalancer&); + //@} - /*! - * @brief A set of BoxInTransit, sorted from highest load to lowest load. - */ - typedef std::set TransitSet; + //! @brief Diagnostic printing. + void + recursivePrint( + std::ostream& os, + const std::string& border = std::string(), + int detail_depth = 2) const; + //! @brief Setup names of timers. + void + setTimerPrefix( + const std::string& timer_prefix); - /*! - * @brief Data to save for each sending/receiving process and the - * subtree at that process. - */ - struct SubtreeLoadData { - // @brief Constructor. - SubtreeLoadData(); + //! @brief Whether to print steps for debugging. + void setPrintSteps(bool print_steps) + { + d_print_steps = print_steps; + } +private: /*! - * @brief Number of processes in subtree + * @brief Number of processes in branch */ int d_num_procs; /*! - * @brief Current total work amount in the subtree + * @brief Current load in the branch, including local unassigned load. */ - LoadType d_total_work; + LoadType d_branch_load_current; /*! - * @brief Load exported (or to be exported) to nonlocal process. - * - * If the object is for the local process, load_exported means - * the load exported to the process's *parent*. + * @brief Ideal load for the branch */ - LoadType d_load_exported; + LoadType d_branch_load_ideal; /*! - * @brief Load imported from nonlocal process. - * - * If the object is for the local process, load_imported means - * the load imported from the process's *parent*. + * @brief Load the branch is willing to have, based on the load + * tolerance and upper limits of children. */ - LoadType d_load_imported; + LoadType d_branch_load_upperlimit; /*! - * @brief Ideal work amount for the subtree + * @brief Number of processes in branch after pruning. */ - LoadType d_ideal_work; + int d_eff_num_procs; /*! - * @brief Work to export. - * - * If the object is for the local process, for_export means for - * exporting to the process's *parent*. + * @brief Current load in the effective branch. */ - TransitSet d_for_export; - }; - - /* - * @brief Check if there is any pending messages for the private - * communication and throw an error if there is. - */ - void - assertNoMessageForPrivateCommunicator() const; - - /* - * Read parameters from input database. - */ - void - getFromInput( - const boost::shared_ptr& db); - - /*! - * Move Boxes in balance_box_level from ranks outside of - * rank_group to ranks inside rank_group. Modify the given connectors - * to make them correct following this moving of boxes. - */ - void - prebalanceBoxLevel( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const tbox::RankGroup& rank_group) const; + LoadType d_eff_load_current; - /*! - * @brief Reassign loads from one TransitSet to another. - * - * @param[i] ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @param[io] next_available_index Index for guaranteeing new - * Boxes are uniquely numbered. - * - * @return Amount of load transfered. If positive, work went from - * src to dst (if negative, from dst to src). - * - */ - LoadType - reassignLoads( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - LoadType ideal_transfer ) const; + /*! + * @brief Ideal load for the effective branch. + */ + LoadType d_eff_load_ideal; - /*! - * @brief Shift load from src to dst by swapping BoxInTransit - * between them. - * - * @param[io] src Source of work, for a positive ideal_transfer. - * - * @param[io] dst Destination of work, for a positive ideal_transfer. - * - * @param[i] ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @return Amount of load transfered. If positive, load went - * from src to dst (if negative, from dst to src). - */ - LoadType - shiftLoadsBySwapping( - TransitSet& src, - TransitSet& dst, - LoadType ideal_transfer ) const; + /*! + * @brief Load the effective branch is willing to have, which is + * a sum of the upper limits of its effective children. + */ + LoadType d_eff_load_upperlimit; - /*! - * @brief Shift load from src to dst by various box breaking strategies. - * choosing the break that gives the best overall penalty. - * - * @param[io] src Source of work, for a positive ideal_transfer. - * - * @param[io] dst Destination of work, for a positive ideal_transfer. - * - * @param next_available_index Index for guaranteeing new - * Boxes are uniquely numbered. - * - * @param ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @return Amount of load transfered. If positive, load went - * from src to dst (if negative, from dst to src). - */ - LoadType - shiftLoadsByBreaking( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - LoadType ideal_transfer ) const; + /*! + * @brief Load received or to be sent. + * + * If this object is for the local process, shipment is to or + * from the process's *parent*. + */ + boost::shared_ptr d_shipment; - /*! - * @brief Find a BoxInTransit in each of the source and destination - * containers that, when swapped, effects a transfer of the given - * amount of work from the source to the destination. Swap the boxes. - */ - bool - swapLoadPair( - TransitSet& src, - TransitSet& dst, - LoadType& actual_transfer, - LoadType ideal_transfer ) const; + /*! + * @brief Whether branch expects its parent to send work down. + */ + bool d_wants_work_from_parent; - /*! - * @brief Pack load/boxes for sending. - */ - void - packSubtreeLoadData( - std::vector& msg, - const SubtreeLoadData& load_data) const; + //! @brief Common partitioning parameters. + const PartitioningParams* d_pparams; - /*! - * @brief Unpack load/boxes received. - */ - void - unpackSubtreeLoadData( - SubtreeLoadData& proc_data, - TransitSet& receiving_bin, - hier::LocalId& next_available_index, - const int* received_data, - int received_data_length ) const; + //@{ + //! @name Debugging and diagnostic data. + boost::shared_ptr t_pack_load; + boost::shared_ptr t_unpack_load; + bool d_print_steps; + //@} - /*! - * @brief Pack load/boxes for sending. - */ - void - packSubtreeLoadData( - tbox::MessageStream &msg, - const SubtreeLoadData& load_data) const; + }; // BranchData declaration. /*! - * @brief Unpack load/boxes received. + * @brief Check if there is any pending messages for the private + * communication and throw an error if there is. */ void - unpackSubtreeLoadData( - SubtreeLoadData& proc_data, - TransitSet& receiving_bin, - hier::LocalId& next_available_index, - tbox::MessageStream &msg ) const; + assertNoMessageForPrivateCommunicator() const; /*! - * @brief Construct semilocal relationships in - * unbalanced--->balanced Connector. - * - * Constructing semilocal unbalanced--->balanced relationships - * require communication to determine where exported work ended up. - * This methods does the necessary communication and constructs - * these relationship in the given Connector. - * - * @param [o] unbalanced_to_balanced Connector to store - * relationships in. - * - * @param [i] kept_imports Work that was imported and locally kept. + * Read parameters from input database. */ void - constructSemilocalUnbalancedToBalanced( - hier::Connector &unbalanced_to_balanced, - const TreeLoadBalancer::TransitSet &kept_imports ) const; - - /*! - * @brief Break off a given load size from a given Box. - * - * @param[i] box Box to break. - * - * @param[i] ideal_load_to_break Ideal load to break. - * - * @param[o] breakoff Boxes broken off (usually just one). - * - * @param[o] leftover Remainder of Box after breakoff is gone. - * - * @param[o] brk_load The load broken off. - */ - bool - breakOffLoad( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break ) const; - - /*! - * @brief Computes surface area of a list of boxes. - */ - double - computeBoxSurfaceArea( - const std::vector& boxes) const; + getFromInput( + const boost::shared_ptr& input_db); /*! - * @brief Computes the surface area of a box. - */ - int - computeBoxSurfaceArea( - const hier::Box& box) const; - - double - combinedBreakingPenalty( - double balance_penalty, - double surface_penalty, - double slender_penalty) const - { - double combined_penalty = - d_balance_penalty_wt * balance_penalty * balance_penalty - + d_surface_penalty_wt * surface_penalty * surface_penalty - + d_slender_penalty_wt * slender_penalty * slender_penalty; - return combined_penalty; - } - - double - computeBalancePenalty( - const std::vector& a, - const std::vector& b, - double imbalance) const - { - NULL_USE(a); - NULL_USE(b); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeBalancePenalty( - const TransitSet& a, - const TransitSet& b, - double imbalance) const - { - NULL_USE(a); - NULL_USE(b); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeBalancePenalty( - const hier::Box& a, - double imbalance) const - { - NULL_USE(a); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeSurfacePenalty( - const std::vector& a, - const std::vector& b) const; - - double - computeSurfacePenalty( - const TransitSet& a, - const TransitSet& b) const; - - double - computeSurfacePenalty( - const hier::Box& a) const; - - double - computeSlenderPenalty( - const std::vector& a, - const std::vector& b) const; - - double - computeSlenderPenalty( - const TransitSet& a, - const TransitSet& b) const; - - double - computeSlenderPenalty( - const hier::Box& a) const; - - bool - breakOffLoad_planar( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const; - - bool - breakOffLoad_cubic( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_give, - const tbox::Array >& bad_cuts ) const; - - void - burstBox( - std::vector& boxes, - const hier::Box& bursty, - const hier::Box& solid ) const; - - /* * Utility functions to determine parameter values for level. */ int @@ -764,9 +581,9 @@ class TreeLoadBalancer: int level_number) const { TBOX_ASSERT(level_number >= 0); - return (level_number < d_workload_data_id.getSize() ? - d_workload_data_id[level_number] : - d_master_workload_data_id); + return level_number < static_cast(d_workload_data_id.size()) ? + d_workload_data_id[level_number] : + d_master_workload_data_id; } /*! @@ -778,9 +595,7 @@ class TreeLoadBalancer: { /* * Currently only for uniform loads, where the load is equal - * to the number of cells. For non-uniform loads, this method - * needs the patch data index for the load. It would summ up - * the individual cell loads in the cell. + * to the number of cells. */ return double(box.size()); } @@ -796,9 +611,7 @@ class TreeLoadBalancer: { /* * Currently only for uniform loads, where the load is equal - * to the number of cells. For non-uniform loads, this method - * needs the patch data index for the load. It would summ up - * the individual cell loads in the overlap region. + * to the number of cells. */ return double((box * restriction).size()); } @@ -806,32 +619,49 @@ class TreeLoadBalancer: /* * Count the local workload. */ - double - computeLocalLoads( + LoadType + computeLocalLoad( const hier::BoxLevel& box_level) const; /*! * @brief Given an "unbalanced" BoxLevel, compute the BoxLevel that - * is load-balanced within the given rank_group and compute the - * mapping between the unbalanced and balanced BoxLevels. + * is load-balanced within the given rank_group and update the + * Connector between it and a reference BoxLevel. + * + * @pre !balance_to_reference || balance_to_reference->hasTranspose() + * @pre d_dim == balance_box_level.getDim() */ void loadBalanceWithinRankGroup( hier::BoxLevel& balance_box_level, - hier::Connector &balance_to_anchor, - hier::Connector &anchor_to_balance, + hier::Connector* balance_to_reference, const tbox::RankGroup& rank_group, - const double group_sum_load ) const; + const double group_sum_load) const; /*! - * @brief Constrain maximum box sizes in the given BoxLevel and - * update given Connectors to the changed BoxLevel. + * @brief Distribute load across the rank group using the tree + * algorithm. + * + * Initial work is given in unbalanced_box_level. Put the final + * local work in balanced_work. */ void - constrainMaxBoxSizes( - hier::BoxLevel& box_level, - hier::Connector &anchor_to_level, - hier::Connector &level_to_anchor ) const; + distributeLoadAcrossRankGroup( + TransitLoad& balanced_work, + const hier::BoxLevel& unbalanced_box_level, + const tbox::RankGroup& rank_group, + double group_sum_load) const; + + /*! + * @brief Compute surplus load per descendent who is still waiting + * for load from parents. + */ + LoadType + computeSurplusPerEffectiveDescendent( + const LoadType& unassigned_load, + const LoadType& group_avg_load, + const std::vector& child_branches, + int first_child) const; /*! * @brief Create the cycle-based RankGroups the local process @@ -841,34 +671,28 @@ class TreeLoadBalancer: * number such that for the last cycle the rank group includes * all processes in d_mpi. * - * @param [o] rank_group - * @param [o] num_groups - * @param [o] group_num - * @param [i] cycle_number - * @param [i] number_of_cycles + * @param [out] rank_group + * @param [out] num_groups + * @param [out] group_num + * @param [in] cycle_fraction How far we are in the cycles. + * Value of 1 means the last cycle. */ void createBalanceRankGroupBasedOnCycles( - tbox::RankGroup &rank_group, - int &num_groups, - int &group_num, - const int cycle_number, - const int number_of_cycles) const; + tbox::RankGroup& rank_group, + int& num_groups, + int& group_num, + double cycle_fraction) const; /*! - * @brief Set up the asynchronous communication objects for the - * given RankGroup. - * - * Based on a conceptual process tree with num_children children, - * set the AsyncCommPeer objects for communication with children - * and parent. + * @brief Set the AsyncCommPeer objects for this process to + * communicate with its parent and children. * - * @param [o] child_stage - * @param [o] child_comms - * @param [o] parent_stage - * @param [o] parent_comm - * @param [i] rank_group - * @param [i] bdfs + * @param [out] child_stage + * @param [out] child_comms + * @param [out] parent_stage + * @param [out] parent_comm + * @param [in] rank_group */ void setupAsyncCommObjects( @@ -876,34 +700,18 @@ class TreeLoadBalancer: tbox::AsyncCommPeer *& child_comms, tbox::AsyncCommStage& parent_stage, tbox::AsyncCommPeer *& parent_comm, - const tbox::RankGroup &rank_group, - const tbox::BalancedDepthFirstTree &bdfs ) const; + const tbox::RankGroup& rank_group) const; /* * @brief Undo the set-up done by setupAsyncCommObjects. + * + * @pre (d_mpi.getSize() != 1) || ((child_comms == 0) && (parent_comms == 0)) */ void destroyAsyncCommObjects( tbox::AsyncCommPeer *& child_comms, tbox::AsyncCommPeer *& parent_comm) const; - /*! - * @brief Sum up the work in a sequence of boxes. - * - * @return Sum of work in [first,last) - */ - LoadType - sumWorkInBoxes( - const TransitSet::const_iterator &first, - const TransitSet::const_iterator &last ) const - { - LoadType sum = 0; - for ( TransitSet::const_iterator itr=first; itr!=last; ++itr ) { - sum += itr->d_boxload; - } - return sum; - } - /*! * @brief Set up timers for the object. */ @@ -926,76 +734,68 @@ class TreeLoadBalancer: //! @brief Whether d_mpi is an internal duplicate. See setSAMRAI_MPI(). bool d_mpi_is_dupe; - int d_n_root_cycles; + /*! + * @brief Tile size, when restricting cuts to tile boundaries, + * Set to 1 when not restricting. + */ + hier::IntVector d_tile_size; - //! @brief Degree of the tree. Two means binary tree. - const int d_degree; + //! @brief Max number of processes the a single process may spread load to per cycle. + int d_max_spread_procs; - /* - * Values for workload estimate data, workload factor, and bin pack method - * used on individual levels when specified as such. - */ - tbox::Array d_workload_data_id; + //! @brief Whether to move load via vouchers. + bool d_voucher_mode; - int d_master_workload_data_id; + //! @brief Whether to allow box breaking. + bool d_allow_box_breaking; - /*! - * @brief Additional minimum box size restriction. - * - * See input parameter "min_load_fraction_per_box". - */ - double d_min_load_fraction_per_box; + //! @brief How to arange a contiguous range of MPI ranks in a tree. + const boost::shared_ptr d_rank_tree; /*! - * @brief Weighting factor for penalizing imbalance. - * - * @see combinedBreakingPenalty(). + * @brief Utility to save data for communication graph output. */ - double d_balance_penalty_wt; + boost::shared_ptr d_comm_graph_writer; - /*! - * @brief Weighting factor for penalizing new suraces. - * - * @see combinedBreakingPenalty(). + /* + * Values for workload estimate data, workload factor, and bin pack method + * used on individual levels when specified as such. */ - double d_surface_penalty_wt; + std::vector d_workload_data_id; - /*! - * @brief Weighting factor for penalizing slenderness. - * - * @see combinedBreakingPenalty(). - */ - double d_slender_penalty_wt; + int d_master_workload_data_id; /*! - * @brief How high a slenderness ratio we can tolerate before penalizing. + * @brief Fraction of ideal load a process can accept over and above + * the ideal. + * + * See input parameter "flexible_load_tolerance". */ - double d_slender_penalty_threshold; + double d_flexible_load_tol; /*! - * @brief Extra penalty weighting applied before cutting. - * - * Set to range [1,ininity). - * Higher value forces more agressive cutting but can produce more slivers. + * @brief Metadata operations with timers set according to this object. */ - double d_precut_penalty_wt; + hier::MappingConnectorAlgorithm d_mca; //@{ //! @name Data shared with private methods during balancing. - mutable hier::IntVector d_min_size; - mutable hier::IntVector d_max_size; - mutable std::vector d_block_domain_boxes; - mutable hier::IntVector d_bad_interval; - mutable hier::IntVector d_cut_factor; - mutable double d_global_avg_load; + mutable boost::shared_ptr d_pparams; + mutable LoadType d_global_avg_load; + mutable LoadType d_min_load; //@} - mutable tbox::Array d_output_procs; - bool d_using_all_procs; + static const int s_default_data_id; + + //@{ + //! @name Used for evaluating peformance. + + bool d_barrier_before; + bool d_barrier_after; /*! - * @brief Whether to immediately report the results of the load balancing cycles - * in the log files. + * @brief Whether to immediately report the results of the load + * balancing cycles in the log files. */ bool d_report_load_balance; @@ -1004,14 +804,6 @@ class TreeLoadBalancer: */ char d_summarize_map; - //@{ - //! @name Used for evaluating peformance. - bool d_barrier_before; - bool d_barrier_after; - //@} - - static const int d_default_data_id; - /* * Performance timers. */ @@ -1019,39 +811,21 @@ class TreeLoadBalancer: boost::shared_ptr t_get_map; boost::shared_ptr t_use_map; boost::shared_ptr t_constrain_size; - boost::shared_ptr t_map_big_boxes; - boost::shared_ptr t_load_distribution; + boost::shared_ptr t_distribute_load_across_rank_group; boost::shared_ptr t_compute_local_load; boost::shared_ptr t_compute_global_load; boost::shared_ptr t_compute_tree_load; std::vector > t_compute_tree_load_for_cycle; - boost::shared_ptr t_reassign_loads; - boost::shared_ptr t_shift_loads_by_swapping; - boost::shared_ptr t_shift_loads_by_breaking; - boost::shared_ptr t_find_swap_pair; - boost::shared_ptr t_break_off_load; - boost::shared_ptr t_find_bad_cuts; + std::vector > t_load_balance_for_cycle; boost::shared_ptr t_send_load_to_children; boost::shared_ptr t_send_load_to_parent; boost::shared_ptr t_get_load_from_children; boost::shared_ptr t_get_load_from_parent; - boost::shared_ptr t_construct_semilocal; - boost::shared_ptr t_construct_semilocal_comm_wait; - boost::shared_ptr t_send_edge_to_children; - boost::shared_ptr t_send_edge_to_parent; - boost::shared_ptr t_get_edge_from_children; - boost::shared_ptr t_get_edge_from_parent; + boost::shared_ptr t_post_load_distribution_barrier; + boost::shared_ptr t_assign_to_local_and_populate_maps; boost::shared_ptr t_report_loads; - boost::shared_ptr t_local_balancing; + boost::shared_ptr t_local_load_moves; boost::shared_ptr t_finish_sends; - boost::shared_ptr t_pack_load; - boost::shared_ptr t_unpack_load; - boost::shared_ptr t_pack_edge; - boost::shared_ptr t_unpack_edge; - boost::shared_ptr t_children_load_comm; - boost::shared_ptr t_parent_load_comm; - boost::shared_ptr t_children_edge_comm; - boost::shared_ptr t_parent_edge_comm; boost::shared_ptr t_barrier_before; boost::shared_ptr t_barrier_after; boost::shared_ptr t_child_send_wait; @@ -1065,11 +839,10 @@ class TreeLoadBalancer: mutable std::vector d_load_stat; mutable std::vector d_box_count_stat; + //@} + // Extra checks independent of optimization/debug. char d_print_steps; - char d_print_break_steps; - char d_print_swap_steps; - char d_print_edge_steps; char d_check_connectivity; char d_check_map; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.C deleted file mode 100644 index 0720ebb1..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.C +++ /dev/null @@ -1,4721 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Scalable load balancer using tree algorithm. - * - ************************************************************************/ - -#ifndef included_mesh_TreeLoadBalancerOld_C -#define included_mesh_TreeLoadBalancerOld_C - -#include "SAMRAI/mesh/TreeLoadBalancerOld.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/tbox/StartupShutdownManager.h" - -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" -#include "SAMRAI/hier/BoxUtilities.h" -#include "SAMRAI/hier/PatchDescriptor.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellDataFactory.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/InputManager.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/AsyncCommStage.h" -#include "SAMRAI/tbox/AsyncCommGroup.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/Statistician.h" -#include "SAMRAI/tbox/TimerManager.h" - -#include -#include -#include -#include - -#if !defined(__BGL_FAMILY__) && defined(__xlC__) -/* - * Suppress XLC warnings - */ -#pragma report(disable, CPPC5334) -#pragma report(disable, CPPC5328) -#endif - -namespace SAMRAI { -namespace mesh { - -const int TreeLoadBalancerOld::TreeLoadBalancerOld_LOADTAG0; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_LOADTAG1; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_EDGETAG0; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_EDGETAG1; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_PREBALANCE0; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_PREBALANCE1; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_FIRSTDATALEN; -const int TreeLoadBalancerOld::TreeLoadBalancerOld_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE; - -const int TreeLoadBalancerOld::d_default_data_id = -1; - -/* - ************************************************************************* - * TreeLoadBalancerOld constructor. - ************************************************************************* - */ - -TreeLoadBalancerOld::TreeLoadBalancerOld( - const tbox::Dimension& dim, - const std::string& name, - const boost::shared_ptr& input_db): - d_dim(dim), - d_object_name(name), - d_mpi(tbox::SAMRAI_MPI::commNull), - d_mpi_is_dupe(false), - d_n_root_cycles(-1), - d_degree(2), - d_master_workload_data_id(d_default_data_id), - d_balance_penalty_wt(1.0), - d_surface_penalty_wt(1.0), - d_slender_penalty_wt(1.0), - d_slender_penalty_threshold(3.0), - d_precut_penalty_wt(1.0), - // Data shared during balancing. - d_min_size(d_dim), - d_max_size(d_dim), - d_bad_interval(d_dim), - d_cut_factor(d_dim), - // Output control. - d_report_load_balance(false), - // Performance evaluation. - d_barrier_before(false), - d_barrier_after(false), - d_print_steps(false), - d_print_break_steps(false), - d_print_swap_steps(false), - d_print_edge_steps(false), - d_check_connectivity(false), - d_check_map(false) -{ - TBOX_ASSERT(!name.empty()); - getFromInput(input_db); - setTimers(); -} - - - -/* - ************************************************************************* - * TreeLoadBalancerOld constructor. - ************************************************************************* - */ - -TreeLoadBalancerOld::~TreeLoadBalancerOld() -{ - freeMPICommunicator(); -} - - - -/* - ************************************************************************* - * Accessory functions to get/set load balancing parameters. - ************************************************************************* - */ - -bool -TreeLoadBalancerOld::getLoadBalanceDependsOnPatchData( - int level_number) const -{ - return getWorkloadDataId(level_number) < 0 ? false : true; -} - - - -/* -************************************************************************** -************************************************************************** -*/ -void -TreeLoadBalancerOld::setWorkloadPatchDataIndex( - int data_id, - int level_number) -{ - boost::shared_ptr > datafact( - hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> - getPatchDataFactory(data_id), - boost::detail::dynamic_cast_tag()); - if (!datafact) { - TBOX_ERROR( - d_object_name << " error: " - << "\n data_id " << data_id << " passed to " - << "setWorkloadPatchDataIndex()" - << " does not refer to cell-centered double patch data. " << std::endl); - } - - if (level_number >= 0) { - int asize = d_workload_data_id.getSize(); - if (asize < level_number + 1) { - d_workload_data_id.resizeArray(level_number + 1); - for (int i = asize; i < level_number - 1; i++) { - d_workload_data_id[i] = - d_master_workload_data_id; - } - d_workload_data_id[level_number] = data_id; - } - } else { - d_master_workload_data_id = data_id; - for (int ln = 0; ln < d_workload_data_id.getSize(); ln++) { - d_workload_data_id[ln] = d_master_workload_data_id; - } - } -} - - - -/* - ************************************************************************* - * This method implements the abstract LoadBalanceStrategy interface, - * but it is not where the tree load balancer algorithm is implemented. - * - * This method does some preliminary setup then calls - * loadBalanceWithinRankGroup to compute the new balanced - * BoxLevel and the mapping Connectors between the old and the new. - * Then it applies the mapping to update the balance<==>anchor - * Connectors. It may do this multiple times, as specified by the - * cycling parameter. - * - * After load balancing, it enforces the maximum size restriction - * by breaking up large boxes and update balance<==>anchor again. - ************************************************************************* - */ -void -TreeLoadBalancerOld::loadBalanceBoxLevel( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const boost::shared_ptr& hierarchy, - const int level_number, - const hier::Connector& balance_to_attractor, - const hier::Connector& attractor_to_balance, - const hier::IntVector& min_size, - const hier::IntVector& max_size, - const hier::BoxLevel& domain_box_level, - const hier::IntVector& bad_interval, - const hier::IntVector& cut_factor, - const tbox::RankGroup& rank_group) const -{ - NULL_USE(balance_to_attractor); - NULL_USE(attractor_to_balance); - NULL_USE(hierarchy); - NULL_USE(level_number); - TBOX_ASSERT(anchor_to_balance.isFinalized() == - balance_to_anchor.isFinalized()); - if (anchor_to_balance.isFinalized()) { - TBOX_ASSERT(anchor_to_balance.isTransposeOf(balance_to_anchor)); - } - TBOX_DIM_ASSERT_CHECK_DIM_ARGS6(d_dim, - balance_box_level, - min_size, - max_size, - domain_box_level, - bad_interval, - cut_factor); - if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); - } - - - if ( d_mpi_is_dupe ) { - /* - * If user has set the duplicate communicator, make sure it is - * compatible with the BoxLevel involved. - */ - TBOX_ASSERT(d_mpi.getSize() == balance_box_level.getMPI().getSize()); - TBOX_ASSERT(d_mpi.getRank() == balance_box_level.getMPI().getRank()); -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_mpi.getSize() > 1) { - int compare_result; - tbox::SAMRAI_MPI::Comm_compare( - d_mpi.getCommunicator(), - balance_box_level.getMPI().getCommunicator(), - &compare_result); - if (compare_result != MPI_CONGRUENT) { - TBOX_ERROR("TreeLoadBalancerOld::loadBalanceBoxLevel:\n" - << "The input balance_box_level has a SAMRAI_MPI that is\n" - << "not congruent with the one set with setSAMRAI_MPI().\n" - << "You must use freeMPICommunicator() before balancing\n" - << "a BoxLevel with an incongruent SAMRAI_MPI."); - } - } -#endif - } - else { - d_mpi = balance_box_level.getMPI(); - } - - if (d_print_steps || - d_print_break_steps) { - tbox::plog << "TreeLoadBalancerOld::loadBalanceBoxLevel called with:" - << "\n min_size = " << min_size - << "\n max_size = " << max_size - << "\n bad_interval = " << bad_interval - << "\n cut_factor = " << cut_factor - << std::endl << balance_box_level.format("", 2); - } - - - /* - * Periodic image Box should be ignored during load balancing - * because they have no real work. The load-balanced results - * should contain no periodic images. - * - * To avoid need for special logic to skip periodic images while - * load balancing, we just remove periodic images in the - * balance_box_level and all periodic edges in - * anchor<==>balance. - */ - - balance_box_level.removePeriodicImageBoxes(); - if (balance_to_anchor.isFinalized()) { - - anchor_to_balance.removePeriodicRelationships(); - anchor_to_balance.setHead(balance_box_level, true); - - balance_to_anchor.removePeriodicRelationships(); - balance_to_anchor.setBase(balance_box_level, true); - - } - - - if (d_barrier_before) { - t_barrier_before->start(); - d_mpi.Barrier(); - t_barrier_before->stop(); - } - - if (!rank_group.containsAllRanks()) { - prebalanceBoxLevel(balance_box_level, - balance_to_anchor, - anchor_to_balance, - rank_group); - } - - t_load_balance_box_level->start(); - - d_min_size = min_size; - d_max_size = max_size; - d_bad_interval = bad_interval; - d_cut_factor = cut_factor; - /* - * Domain boxes are used by breakOffLoad to determine where - * the bad cuts are. Computing domain_boxes from domain_box_level - * should be moved above the this method. - */ - - /* - * We expect the domain box_level to be in globalized state. - */ - TBOX_ASSERT( - domain_box_level.getParallelState() == - hier::BoxLevel::GLOBALIZED); - - d_block_domain_boxes.clear(); - int nblocks = - domain_box_level.getGridGeometry()->getNumberBlocks(); - d_block_domain_boxes.resize(nblocks); - - if (nblocks == 1) { - domain_box_level.getGlobalBoxes(d_block_domain_boxes[0]); - d_block_domain_boxes[0].refine(balance_box_level.getRefinementRatio()); - } else { - for (int b = 0; b < nblocks; ++b) { - d_block_domain_boxes[b] = hier::BoxContainer( - domain_box_level.getGlobalBoxes(), hier::BlockId(b)); - - d_block_domain_boxes[b].refine(balance_box_level.getRefinementRatio()); - } - } - - if (d_print_steps) { - tbox::plog << "Pre balanced:\n" << balance_box_level.format("", 2); - } - -#ifdef DEBUG_CHECK_ASSERTIONS - if (balance_to_attractor.isFinalized()) { - /* - * If balance_to_attractor is given, sanity-check it. - */ - if (&balance_box_level != &balance_to_attractor.getBase() && - !(balance_box_level == balance_to_attractor.getBase())) { - TBOX_ERROR( - "TreeLoadBalancerOld::loadBalanceBoxLevel: balance_box_level\n" - << "does not match the base of balance_to_attractor."); - } - if (!balance_to_attractor.isTransposeOf(attractor_to_balance)) { - TBOX_ERROR("TreeLoadBalancerOld::loadBalanceBoxLevel:\n" - << "attractor_to_balance and balance_to_attractor\n" - << "are not transposes of each other."); - } - } -#endif - - - t_compute_local_load->start(); - double local_load = computeLocalLoads(balance_box_level); - t_compute_local_load->stop(); - - size_t nproc_with_initial_load = - balance_box_level.getLocalNumberOfBoxes() > 0; - - double global_sum_load; - - { - /* - * Determine the total load and number of processes that has any - * initial load. - * - * TODO: If there's more than one rank group, shouldn't this a - * global reduction for each rank group instead of a single one - * for all? - */ - t_compute_global_load->start(); - if (d_mpi.getSize() > 1) { - double dtmp[2], dtmp_sum[2]; - dtmp[0] = local_load; - dtmp[1] = static_cast(nproc_with_initial_load); - d_mpi.Allreduce(dtmp, - dtmp_sum, - 2, - MPI_DOUBLE, - MPI_SUM); - global_sum_load = dtmp_sum[0]; - nproc_with_initial_load = (size_t)dtmp_sum[1]; - } else { - global_sum_load = local_load; - } - t_compute_global_load->stop(); - if (d_print_steps) { - tbox::plog << "TreeLoadBalancerOld::loadBalanceBoxLevel balancing " - << global_sum_load << " (initially born on " - << nproc_with_initial_load << " procs) across all " - << d_mpi.getSize() - << " procs, averaging " << global_sum_load / d_mpi.getSize() - << " or " << pow(global_sum_load / d_mpi.getSize(), 1.0 / d_dim.getValue()) - << "^" << d_dim << " per proc." << std::endl; - } - } - - - d_global_avg_load = global_sum_load / rank_group.size(); - - - /* - * User can set the number of cycles to use (see n_root_cycles - * input parameter), or leave it negative to let this class set it - * automatically using the following heuristic algorithm: - * - * If machine size is small enough to have negligible scaling - * issues (< TreeLoadBalancerOld_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE), use 1 cycle. - * - * Else if the initial load is sufficiently spread out (across at - * least sqrt(nproc)) processes, use 1 cycle. - * - * Else use 2 cycles. - */ - int number_of_cycles = d_n_root_cycles; - if (number_of_cycles < 0) { - // User requested automatic number of cycles. - if (balance_box_level.getMPI().getSize() < TreeLoadBalancerOld_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE ) { - number_of_cycles = 1; - } - else if ( int(nproc_with_initial_load * nproc_with_initial_load) >= - balance_box_level.getMPI().getSize() ) { - number_of_cycles = 1; - } else { - number_of_cycles = 2; - } - } - - - - /* - * The icycle loop spreads out the work each time through. If - * using more than one cycle, only the last one tries to balance - * across all of d_mpi. - */ - - for (int icycle = 0; icycle < number_of_cycles; ++icycle) { - - // If not the first cycle, local_load needs updating. - if (icycle > 0) { - t_compute_local_load->start(); - local_load = computeLocalLoads(balance_box_level); - t_compute_local_load->stop(); - } - - if (d_report_load_balance) { - // Debugging: check overall load balance at intermediate cycles. - tbox::plog - << "TreeLoadBalancerOld::loadBalanceBoxLevel results before cycle " - << icycle << ":" << std::endl; - BalanceUtilities::gatherAndReportLoadBalance( - local_load, - balance_box_level.getMPI()); - } - - - const bool last_cycle = (icycle == number_of_cycles-1); - - /* - * Determine whether to use rank_group as is or subgroup it based - * on cycles. - */ - - const tbox::RankGroup *rank_group_in_use = &rank_group; - int number_of_groups = 1; - int group_num = 0; - - tbox::RankGroup cycle_rank_group(d_mpi); - if ( !last_cycle && rank_group.containsAllRanks() ) { - createBalanceRankGroupBasedOnCycles( - cycle_rank_group, - number_of_groups, - group_num, - icycle, - number_of_cycles); - rank_group_in_use = &cycle_rank_group; - } - - - /* - * Compute the load for the group. If this is the last cycle, - * the group must include all processes, and the group's load - * is the global sum load. Else, use all-reduce to get the - * group load. - */ - t_compute_tree_load->start(); - - double group_sum_load; - - if (icycle == number_of_cycles - 1) { - - group_sum_load = global_sum_load; - - } else { - - t_compute_tree_load_for_cycle[icycle]->start(); - - /* - * Use MPI's vector all-reduce to get individual group loads. - * This gives more info than the process needs, but because the - * number of groups << number of procs, it is still faster - * (probably) than hand coded conmunication. - */ - std::vector group_loads(number_of_groups, 0.0); - group_loads[group_num] = local_load; - if (d_mpi.getSize() > 1) { - d_mpi.AllReduce(&group_loads[0], - static_cast(group_loads.size()), - MPI_SUM); - } - group_sum_load = group_loads[group_num]; - - t_compute_tree_load_for_cycle[icycle]->stop(); - - } - - t_compute_tree_load->stop(); - - - /* - * Compute the load-balancing map. - */ - - loadBalanceWithinRankGroup( - balance_box_level, - balance_to_anchor, - anchor_to_balance, - rank_group, - group_sum_load ); - - if (d_barrier_after) { - t_barrier_after->start(); - d_mpi.Barrier(); - t_barrier_after->stop(); - } - - } - - - /* - * If max_size is given (positive), constrain boxes to the given - * max_size. If not given, skip the enforcement step to save some - * communications. - */ - - if (max_size > hier::IntVector::getZero(d_dim)) { - - t_constrain_size->start(); - constrainMaxBoxSizes( - balance_box_level, - anchor_to_balance, - balance_to_anchor ); - t_constrain_size->stop(); - - if (d_print_steps) { - tbox::plog << " TreeLoadBalancerOld completed constraining box sizes." - << "\n"; - } - - } - - - /* - * Finished load balancing. Clean up and wrap up. - */ - - d_min_size = hier::IntVector(d_dim, -1); - d_max_size = hier::IntVector(d_dim, -1); - d_block_domain_boxes.clear(); - d_bad_interval = hier::IntVector(d_dim, -1); - d_cut_factor = hier::IntVector(d_dim, -1); - - t_load_balance_box_level->stop(); - - local_load = computeLocalLoads(balance_box_level); - d_load_stat.push_back(local_load); - d_box_count_stat.push_back( - static_cast(balance_box_level.getBoxes().size())); - - if (d_report_load_balance) { - t_report_loads->start(); - tbox::plog - << "TreeLoadBalancerOld::loadBalanceBoxLevel results after " - << number_of_cycles << " cycles:" << std::endl; - BalanceUtilities::gatherAndReportLoadBalance(local_load, - balance_box_level.getMPI()); - t_report_loads->stop(); - } - - if (d_check_connectivity && anchor_to_balance.isFinalized()) { - hier::OverlapConnectorAlgorithm oca; - tbox::plog << "TreeLoadBalancerOld checking balance-anchor connectivity." - << std::endl; - int errs = 0; - if (oca.checkOverlapCorrectness(anchor_to_balance, false, true, true)) { - ++errs; - tbox::perr << "Error found in anchor_to_balance!\n"; - } - if (oca.checkOverlapCorrectness(balance_to_anchor, false, true, true)) { - ++errs; - tbox::perr << "Error found in balance_to_anchor!\n"; - } - if (anchor_to_balance.checkTransposeCorrectness( - balance_to_anchor)) { - ++errs; - tbox::perr << "Error found in balance-anchor transpose!\n"; - } - if (errs != 0) { - TBOX_ERROR( - "Errors in load balance mapping found." - << "anchor_box_level:\n" << anchor_to_balance.getBase().format("", 2) - << "balance_box_level:\n" << balance_box_level.format("", 2) - << "anchor_to_balance:\n" << anchor_to_balance.format("", 2) - << "balance_to_anchor:\n" << balance_to_anchor.format("", 2)); - } - tbox::plog << "TreeLoadBalancerOld checked balance-anchor connectivity." - << std::endl; - } - - if (d_barrier_after) { - t_barrier_after->start(); - d_mpi.Barrier(); - t_barrier_after->stop(); - } - -} - - - -/* - ************************************************************************* - * Constrain maximum box sizes in the given BoxLevel and - * update given Connectors to the changed BoxLevel. - ************************************************************************* - */ -void -TreeLoadBalancerOld::constrainMaxBoxSizes( - hier::BoxLevel& box_level, - hier::Connector &anchor_to_level, - hier::Connector &level_to_anchor ) const -{ - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, box_level); - - t_map_big_boxes->start(); - - if (d_print_break_steps) { - tbox::plog << "Mapping oversized boxes starting with " - << box_level.getBoxes().size() << " boxes." - << std::endl; - } - - const hier::IntVector& zero_vector(hier::IntVector::getZero(d_dim)); - - hier::BoxLevel constrained(box_level.getDim()); - hier::Connector unconstrained_to_constrained; - - constrained.initialize( - box_level.getRefinementRatio(), - box_level.getGridGeometry(), - box_level.getMPI()); - unconstrained_to_constrained.clearNeighborhoods(); - unconstrained_to_constrained.setBase(box_level); - unconstrained_to_constrained.setHead(constrained); - unconstrained_to_constrained.setWidth(zero_vector, true); - - const hier::BoxContainer& unconstrained_boxes = box_level.getBoxes(); - - hier::LocalId next_available_index = box_level.getLastLocalId() + 1; - - for (hier::BoxContainer::const_iterator ni = unconstrained_boxes.begin(); - ni != unconstrained_boxes.end(); ++ni) { - - const hier::Box& box = *ni; - - const hier::IntVector box_size = box.numberCells(); - - /* - * If box already conform to max size constraint, keep it. - * Else chop it up and keep the parts. - */ - - if (box_size <= d_max_size) { - - if (d_print_break_steps) { - tbox::plog << " Not oversized: " << box - << box.numberCells() << "\n"; - } - constrained.addBox(box); - - } else { - - if (d_print_break_steps) { - tbox::plog << " Breaking oversized " << box - << box.numberCells() << " ->"; - } - hier::BoxContainer chopped(box); - hier::BoxUtilities::chopBoxes( - chopped, - d_max_size, - d_min_size, - d_cut_factor, - d_bad_interval, - d_block_domain_boxes[box.getBlockId().getBlockValue()]); - TBOX_ASSERT( chopped.size() != 0 ); - - if (chopped.size() != 1) { - - hier::Connector::NeighborhoodIterator base_box_itr = - unconstrained_to_constrained.makeEmptyLocalNeighborhood( - box.getId()); - - for (hier::BoxContainer::iterator li(chopped); - li != chopped.end(); ++li) { - - const hier::Box fragment = *li; - - const hier::Box new_box(fragment, - next_available_index++, - d_mpi.getRank()); - - if (d_print_break_steps) { - tbox::plog << " " << new_box - << new_box.numberCells(); - } - - constrained.addBox(new_box); - - unconstrained_to_constrained.insertLocalNeighbor( - new_box, - base_box_itr); - - } - - if (d_print_break_steps) { - tbox::plog << "\n"; - } - - } else { - TBOX_ASSERT( box.isSpatiallyEqual( chopped.front() ) ); - if (d_print_break_steps) { - tbox::plog << " Unbreakable!" << "\n"; - } - constrained.addBox(box); - } - - } - - } - - unconstrained_to_constrained.setConnectorType(hier::Connector::MAPPING); - - if (d_print_steps) { - tbox::plog - << " TreeLoadBalancerOld::constrainMaxBoxSizes completed building unconstrained_to_constrained" - << "\n"; - } - - if (anchor_to_level.isFinalized()) { - // Modify anchor<==>level Connectors and swap box_level with constrained. - const hier::MappingConnectorAlgorithm mca; - mca.modify(anchor_to_level, - level_to_anchor, - unconstrained_to_constrained, - &box_level, - &constrained); - } else { - // Swap box_level and constrained without touching anchor<==>level. - hier::BoxLevel::swap(box_level, constrained); - } - - t_map_big_boxes->stop(); -} - - - -/* - ************************************************************************* - * Given an "unbalanced" BoxLevel, compute the BoxLevel that is - * load-balanced and compute the mapping between the unbalanced and - * balanced BoxLevels. - * - * If given a RankGroup with less than all ranks, we treat it as a - * specific user request to balance only within the RankGroup and just - * use the RankGroup as is. Otherwise, we may generate sub-groups - * based on the cycle number and balance within the generated - * sub-group. - * - * The objective of balancing over multiple cycles is to avoid - * unscalable performance in the cases where just a few processes own - * all the initial load. By slowly spreading out the load, no process - * has to set up Connector unbalanced_to_balanced with number of - * relationships that scales with the machine size. - * - * If the local process is not a member of the RankGroup, it does not - * participate in the work and just sets the output objects to be - * locally empty. - ************************************************************************* - */ -void -TreeLoadBalancerOld::loadBalanceWithinRankGroup( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const tbox::RankGroup& rank_group, - const double group_sum_load ) const -{ - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, - balance_box_level); - - double group_avg_load = group_sum_load / rank_group.size(); - - - hier::BoxLevel balanced_box_level(balance_box_level.getDim()); - hier::Connector unbalanced_to_balanced; - hier::Connector balanced_to_unbalanced; - - /* - * Initialize empty balanced_box_level and mappings. - */ - balanced_box_level.initialize( - balance_box_level.getRefinementRatio(), - balance_box_level.getGridGeometry(), - balance_box_level.getMPI()); - balanced_to_unbalanced.setConnectorType(hier::Connector::MAPPING); - balanced_to_unbalanced.clearNeighborhoods(); - balanced_to_unbalanced.setBase(balanced_box_level); - balanced_to_unbalanced.setHead(balance_box_level); - balanced_to_unbalanced.setWidth(hier::IntVector::getZero(d_dim), true); - unbalanced_to_balanced.setConnectorType(hier::Connector::MAPPING); - unbalanced_to_balanced.clearNeighborhoods(); - unbalanced_to_balanced.setBase(balance_box_level); - unbalanced_to_balanced.setHead(balanced_box_level); - unbalanced_to_balanced.setWidth(hier::IntVector::getZero(d_dim), true); - - - if ( !rank_group.isMember(d_mpi.getRank()) ) { - /* - * The following assert should be guaranteed by an earlier call - * to prebalanceBoxLevel. Having boxes without being in the - * given rank group leads to undefined results. - */ - TBOX_ASSERT( balance_box_level.getLocalNumberOfBoxes() == 0 ); - - if (anchor_to_balance.isFinalized()) { - const hier::MappingConnectorAlgorithm mca; - t_use_map->start(); - mca.modify( - anchor_to_balance, - balance_to_anchor, - unbalanced_to_balanced, - balanced_to_unbalanced, - &balance_box_level, - &balanced_box_level); - t_use_map->stop(); - } else { - hier::BoxLevel::swap(balance_box_level, balanced_box_level); - } - return; - } - - - t_get_map->start(); - - t_load_distribution->start(); - - /* - * Before the last cycle, it is possible for the group average load - * to be below the global average, if the group just happens to have - * underloaded processors. However, there is no point in driving the - * processor loads down below the global average just to have it - * brought back up by the last cycle. It just unnecessarily fragments - * the boxes and costs more to do. To prevent this, reset the group - * average to the global average if it is below. - */ - group_avg_load = - tbox::MathUtilities::Max(group_avg_load, d_global_avg_load); - - - /* - * Arrange the group ranks in a BalancedDepthFirstTree in order to get - * the parent/children in the group. - * - * By the way, the BalancedDepthFirstTree currently assumes a binary - * tree, d_degree = 2. - */ - TBOX_ASSERT(d_degree == 2); - // FIXME: BalancedDepthFirstTree could use a constructor that takes a RankGroup. - tbox::BalancedDepthFirstTree bdfs(0, - rank_group.size()-1, - rank_group.getMapIndex(d_mpi.getRank()), - true); - const int num_children = bdfs.getNumberOfChildren(); - - - /* - * Communication objects for sending to/receiving from - * parent/children: We could combine all of these AsyncCommStages - * and most of the AsyncCommPeers, but we intentionally keep them - * separate to aid performance analysis. - */ - - tbox::AsyncCommStage child_send_stage; - tbox::AsyncCommPeer* child_sends = NULL; - tbox::AsyncCommStage parent_send_stage; - tbox::AsyncCommPeer* parent_send = NULL; - - setupAsyncCommObjects( - child_send_stage, - child_sends, - parent_send_stage, - parent_send, - rank_group, - bdfs ); - child_send_stage.setCommunicationWaitTimer(t_child_send_wait); - parent_send_stage.setCommunicationWaitTimer(t_parent_send_wait); - - tbox::AsyncCommStage child_recv_stage; - tbox::AsyncCommPeer* child_recvs = NULL; - tbox::AsyncCommStage parent_recv_stage; - tbox::AsyncCommPeer* parent_recv = NULL; - - setupAsyncCommObjects( - child_recv_stage, - child_recvs, - parent_recv_stage, - parent_recv, - rank_group, - bdfs ); - child_recv_stage.setCommunicationWaitTimer(t_child_recv_wait); - parent_recv_stage.setCommunicationWaitTimer(t_parent_send_wait); - - - - /* - * Outline of the tree load balancing algorithm as implemented: - * - * 1. For each child of the local process: - * Receive data from subtree rooted at child (number in - * subtree, excess work, remaining work in subtree, etc.). - * - * 2. Compute data for subtree rooted at self by combining - * local data with children subtree data. - * - * 3. If parent exists: - * Send subtree info (number in subtree, excess work, - * remaining work in subtree, etc.) to parent. - * - * 4. If parent exists and we need more work: - * Receive additional work from parent. - * - * 5. Partition additional work among children and self. - * - * 6. For each child: - * Send additional work (if any). - */ - - /* - * Step 1: - * - * Post receive for data from subtree rooted at children. - * We have to do a few local setups, but post the receive - * now to overlap communication. - */ - t_get_load_from_children->start(); - for (int c = 0; c < num_children; ++c) { - child_recvs[c].beginRecv(); - if (child_recvs[c].isDone()) { - child_recvs[c].pushToCompletionQueue(); - } - } - t_get_load_from_children->stop(); - - - /* - * Step 2, local part: - * - * The local process must generate indices for new and imported - * boxes. To do it deterministically, no generated index should - * depend on message arrival order. To achieve this, we maintain - * 2+d_degree values in next_available_index: one for the local - * process, one for the parent and one for each child. The first - * index given to a locally generated Box is some index unused by - * balance_box_level. The first index given to a Box - * from the parent is the same value plus 1. The first index given - * to a box from child 0 is the same value plus 2. And so on. - * Each time a value from next_available_index is used, we - * increment it by 2+d_degree so that the 2+d_degree available - * values can never be the same. Moreover, boxes from a certain - * source always take indices from its own set, independent of when - * boxes from other sources arrive. - */ - std::vector next_available_index(2 + d_degree); - next_available_index[0] = balance_box_level.getLastLocalId() + 1; - - /* - * The next line makes next_available_index[0] divisible by 2+d_degree. - * It is not strictly necessary but makes debugging much easier because - * we can quickly associate any value with the source of its Box. - */ - next_available_index[0] += - hier::LocalId(2+d_degree) - (next_available_index[0] % (2 + d_degree)); - - for (int c = 1; c < d_degree + 2; ++c) { - next_available_index[c] = next_available_index[0] + c; - } - - - /* - * Data for storing and transfering subtree info. - */ - SubtreeLoadData* child_load_data = new SubtreeLoadData[num_children]; - SubtreeLoadData my_load_data; - - - /* - * Compute local proc's Boxes and loads and store in - * my_load_data. This will eventually include data for the subtree. - * We will add the rest of the subtree's work when we receive that - * data from the children. - */ - my_load_data.d_num_procs = 1; - my_load_data.d_total_work = static_cast(computeLocalLoads(balance_box_level)); - - - /* - * unassigned is a container of BoxInTransit that has been released by - * a process and has not yet been assigned to another. First, put - * excess local work (if any) in unassigned. Imported - * BoxInTransits are placed here before determining whether to keep - * them or send them to another part of the tree. - */ - TransitSet unassigned; - - - t_local_balancing->start(); - - if (my_load_data.d_total_work <= group_avg_load) { - - /* - * Local process is underloaded, so put all of balance_box_level into - * the balanced_box_level (and add more later). - */ - const hier::BoxContainer& unbalanced_boxes = - balance_box_level.getBoxes(); - for (hier::BoxContainer::const_iterator ni = unbalanced_boxes.begin(); - ni != unbalanced_boxes.end(); ++ni) { - balanced_box_level.addBox(*ni); - } - - } else { - /* - * Local process is overloaded, so remove excess loads: - * - sort BoxInTransit by load - * - reassignLoads (put excess loads in unassigned container) and - * - put remainder in balanced_box_level. - * - * Note: This algorithm would also work if we put all local - * Boxes into unassigned (instead of just the excess load). In - * the end, all remaining unassigned Boxes get assigned to the - * local process anyway. In fact, having more Boxes in - * unassigned may let reassignLoads do a better job in - * reassigning loads to children and parents, because it would - * have more choices. The reason we place only the excess load - * into unassigned is to help preserve locality, assuming that - * current local Boxes may have more local neighbors. However, - * practical evidence so far suggest that the lost locality is - * not that bad, at least for explicit solvers. Transfering all - * local Boxes into unassigned at the start may affect the - * performance of this algorithms though, because it bypasses - * one reassignLoads call but makes the unassigned Box set - * bigger, which may make other calls to reassignLoads work - * harder. Which one is a bigger effect and whether there are - * any significant effects at all remains to be seen. - */ - - const hier::BoxContainer& unbalanced_boxes = - balance_box_level.getBoxes(); - - int ideal_transfer = int(0.5 + my_load_data.d_total_work - group_avg_load); - - if (d_print_steps) { - tbox::plog << " Reassigning initial overload of " << ideal_transfer - << " to unassigned.\n"; - } - - TransitSet - local_loads(unbalanced_boxes.begin(), unbalanced_boxes.end()); - - int actual_transfer = reassignLoads( - local_loads, - unassigned, - next_available_index[d_degree], - ideal_transfer ); - - for (TransitSet::const_iterator - ni = local_loads.begin(); ni != local_loads.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - balanced_box_level.addBox(box_in_transit.d_box); - /* - * Create edges only for box_in_transit that changed. - */ - if (box_in_transit.d_box.getLocalId() != - box_in_transit.d_orig_box.getLocalId()) { - balanced_to_unbalanced.insertLocalNeighbor( - box_in_transit.d_orig_box, - box_in_transit.d_box.getId()); - unbalanced_to_balanced.insertLocalNeighbor( - box_in_transit.d_box, - box_in_transit.d_orig_box.getId()); - } - } - - if (d_print_steps) { - tbox::plog << " Unassigning " << unassigned.size() - << " boxes (" << actual_transfer << " / " - << ideal_transfer << " units):"; - for (TransitSet::const_iterator - ni = unassigned.begin(); ni != unassigned.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; - } - } - - t_local_balancing->stop(); - - - - /* - * Step 2, remote part: - * - * Complete load-receive communications with children. - * Add imported BoxInTransit to unassigned bin. - */ - t_get_load_from_children->start(); - while ( child_recv_stage.numberOfCompletedMembers() > 0 || - child_recv_stage.advanceSome() ) { - - tbox::AsyncCommPeer* child_recv = - dynamic_cast *>(child_recv_stage.popCompletionQueue()); - - TBOX_ASSERT(child_recv != NULL); - TBOX_ASSERT(child_recv >= child_recvs); - TBOX_ASSERT(child_recv < child_recvs + num_children); - - const int cindex = static_cast(child_recv - child_recvs); - - TBOX_ASSERT(cindex >= 0 && cindex < num_children); - - /* - * Extract data from the child cindex, storing it in - * child_load_data[cindex]. If child sent up any excess Box, - * put them in unassigned. - */ - int old_size = static_cast(unassigned.size()); - unpackSubtreeLoadData( - child_load_data[cindex], - unassigned, - next_available_index[cindex], - child_recv->getRecvData(), - child_recv->getRecvSize() ); - - child_load_data[cindex].d_ideal_work = - int(group_avg_load * child_load_data[cindex].d_num_procs + 0.5); - - if (d_print_steps) { - TransitSet::const_iterator - ni = unassigned.begin(); - for (int ii = 0; ii < old_size; ++ii) { ++ni; } - if (d_print_steps) { - tbox::plog << " Got " << unassigned.size() - old_size - << " boxes (" << child_load_data[cindex].d_load_imported - << " units) from child " - << child_recv->getPeerRank() << ":"; - for ( ; ni != unassigned.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - tbox::plog << " " << box_in_transit; - } - tbox::plog << std::endl; - } - } - - // Sum children load into my_load_data. - my_load_data.d_num_procs += child_load_data[cindex].d_num_procs; - my_load_data.d_total_work += - child_load_data[cindex].d_total_work - + child_load_data[cindex].d_load_imported; - - } - - - - // We should have received everything at this point. - TBOX_ASSERT(!child_recv_stage.hasPendingRequests()); - - my_load_data.d_ideal_work = int(group_avg_load * my_load_data.d_num_procs + 0.5); - - if (d_print_steps) { - tbox::plog << "Received children subtree data." << std::endl; - for (int c = 0; c < num_children; ++c) { - tbox::plog << "Child " << child_recvs[c].getPeerRank() - << " subtree data: " << child_load_data[c].d_total_work - << "/" << child_load_data[c].d_ideal_work - << " for " << child_load_data[c].d_num_procs << " procs averaging " - << child_load_data[c].d_total_work / child_load_data[c].d_num_procs - << " after sending up " << child_load_data[c].d_load_imported - << std::endl; - } - tbox::plog << "Initial subtree data: " << my_load_data.d_total_work - << " / " << my_load_data.d_ideal_work - << " for " << my_load_data.d_num_procs << " procs averaging " - << my_load_data.d_total_work / my_load_data.d_num_procs - << " before sending up anything." - << std::endl; - } - - t_get_load_from_children->stop(); - - - - /* - * Step 3: - * - * Send subtree info and excess work (if any) up to parent. - */ - t_send_load_to_parent->start(); - if (parent_send != NULL) { - - /* - * Compute the excess work we want to send to parent. - * If it's positive, reassign some boxes to the parent. - */ - int ideal_transfer = my_load_data.d_total_work > my_load_data.d_ideal_work ? - my_load_data.d_total_work - my_load_data.d_ideal_work : 0; - - if (ideal_transfer > 0) { - - if (d_print_steps) { - tbox::plog << " Attempting to reassign " << ideal_transfer - << " of unassigned load to parent.\n"; - } - - int actual_transfer = reassignLoads( - unassigned, - my_load_data.d_for_export /* to parent */, - next_available_index[d_degree], - ideal_transfer ); - my_load_data.d_load_exported = actual_transfer; - my_load_data.d_total_work -= actual_transfer; - - if (d_print_steps) { - tbox::plog << " Giving " << my_load_data.d_for_export.size() - << " boxes (" << actual_transfer << " / " - << ideal_transfer << " units) to parent " - << parent_send->getPeerRank() << ":"; - for (TransitSet::const_iterator - ni = my_load_data.d_for_export.begin(); - ni != my_load_data.d_for_export.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; - } - - } - - /* - * Send local process's load info, along with any exported work, - * up to parent. - */ - std::vector msg; - packSubtreeLoadData(msg, my_load_data); - parent_send->beginSend(&msg[0], static_cast(msg.size())); - - } - t_send_load_to_parent->stop(); - - - - /* - * Step 4: - * - * Finish the send-up. - * To preclude sending work in both directions, the parent - * will *not* send a work message down if we sent work up. - */ - if (parent_send != NULL && my_load_data.d_load_exported == 0) { - t_parent_load_comm->start(); - t_get_load_from_parent->start(); - - parent_recv->beginRecv(); - - t_get_load_from_parent->stop(); - t_parent_load_comm->stop(); - } - - - /* - * May do some things here that do not depend on message from - * parents. Steve Smith suggested sending work down to underloaded - * children at this point, even if it makes the local process - * underloaded as a result. The local process can recover the - * correct amount of work when it comes down from the parent. This - * would allow some children subtrees to wait less, but it has - * other consequences. - */ - - - if (parent_recv != NULL && my_load_data.d_load_exported == 0) { - - /* - * Receive and unpack message from parent. Since we did not - * export work to parent, parent may import some to us. Put - * imported work in unassigned. - */ - t_get_load_from_parent->start(); - - t_parent_load_comm->start(); - parent_recv->completeCurrentOperation(); - t_parent_load_comm->stop(); - - int old_size = static_cast(unassigned.size()); - SubtreeLoadData parent_load_data; - unpackSubtreeLoadData( - parent_load_data, - unassigned, - next_available_index[1 + d_degree], - parent_recv->getRecvData(), - parent_recv->getRecvSize() ); - my_load_data.d_load_imported = parent_load_data.d_load_imported; - my_load_data.d_total_work += parent_load_data.d_load_imported; - - if (d_print_steps) { - TransitSet::const_iterator - ni = unassigned.begin(); - for (int i = 0; i < old_size; ++i) { - ++ni; - } - if (d_print_steps) { - tbox::plog << " Got " << unassigned.size() - old_size - << " boxes (" << parent_load_data.d_load_imported - << " units) from parent " - << parent_recv->getPeerRank() << ":"; - for ( ; ni != unassigned.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - tbox::plog << " " << box_in_transit; - } - tbox::plog << std::endl; - } - } - - t_get_load_from_parent->stop(); - } - - if (d_print_steps) { - tbox::plog << " After parent/children, my total work is " - << my_load_data.d_total_work << " / " - << my_load_data.d_ideal_work << std::endl; - } - - - /* - * Step 5 and 6: - * - * Reassign unassigned load to children subtrees as needed. - */ - - t_send_load_to_children->start(); - - for (int ichild = 0; ichild < num_children; ++ichild) { - - SubtreeLoadData& recip_data = child_load_data[ichild]; - - /* - * Note: To preclude unneeded messages, we do *not* send a work - * message down if the child sent work up to us. - */ - if (recip_data.d_load_imported == 0) { - - int ideal_transfer = recip_data.d_ideal_work - recip_data.d_total_work; - int actual_transfer = 0; - - if (d_print_steps) { - tbox::plog << " Attempting to reassign " << ideal_transfer - << " of unassigned load to child " - << child_sends[ichild].getPeerRank() << "\n"; - } - - if (ideal_transfer > 0) { - actual_transfer = reassignLoads( - unassigned, - recip_data.d_for_export, - next_available_index[d_degree], - ideal_transfer ); - recip_data.d_load_exported += actual_transfer; - recip_data.d_total_work += actual_transfer; - } - - if (d_print_steps) { - tbox::plog << " Giving " << recip_data.d_for_export.size() - << " boxes (" << actual_transfer << " / " << ideal_transfer - << " units) to child " << ichild << ':' - << child_sends[ichild].getPeerRank() << " for " - << recip_data.d_num_procs - << " procs:"; - for (TransitSet::const_iterator ni = recip_data.d_for_export.begin(); - ni != recip_data.d_for_export.end(); ++ni) { - tbox::plog << " " << *ni; - } - tbox::plog << std::endl; - } - - std::vector msg; - packSubtreeLoadData(msg, recip_data); - child_sends[ichild].beginSend(&msg[0], static_cast(msg.size())); - - } - - } - - t_send_load_to_children->stop(); - - - /* - * All unassigned boxes should go into balanced_box_level. - * - * Put unassigned boxes into balanced_box_level and generate - * relationships in balanced<==>unbalanced mapping Connectors where - * required. - * - * We remove boxes from unassigned when we no longer need to keep - * track of them. We do leave behind boxes originating remotely so - * we can later notify the originating processes about where the - * box finally ended up. - */ - t_local_balancing->start(); - - for (TransitSet::iterator - ni = unassigned.begin(); - ni != unassigned.end(); /* incremented in loop */) { - - const BoxInTransit& box_in_transit = *ni; - balanced_box_level.addBox(box_in_transit.d_box); - - if (box_in_transit.d_box.isIdEqual(box_in_transit.d_orig_box)) { - // Unchanged box requires no edge. Nothing else need to be done. - unassigned.erase(ni++); - } else { - - balanced_to_unbalanced.insertLocalNeighbor( - box_in_transit.d_orig_box, - box_in_transit.d_box.getId()); - - if (box_in_transit.d_orig_box.getOwnerRank() == d_mpi.getRank()) { - unbalanced_to_balanced.insertLocalNeighbor( - box_in_transit.d_box, - box_in_transit.d_orig_box.getId()); - unassigned.erase(ni++); - } - else { - // Leave this box in unassigned for notifying originating - // process of where it landed. - ++ni; - } - } - - } - - t_local_balancing->stop(); - - t_load_distribution->stop(); - - - /* - * Finish messages before starting edge info exchange. - * We have only sends to complete, so it should not take - * long to advance them all to completion. - */ - t_finish_sends->start(); - child_send_stage.advanceAll(); - parent_send_stage.advanceAll(); - t_finish_sends->stop(); -#ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < num_children; ++i) { - TBOX_ASSERT(child_sends[i].isDone()); - TBOX_ASSERT(child_recvs[i].isDone()); - } - if (parent_send != NULL) { - TBOX_ASSERT(parent_send->isDone()); - TBOX_ASSERT(parent_recv->isDone()); - } -#endif - - - /* - * Ranks that we exported work to and imported work from, for use - * when constructing semilocal unbalanced--->balanced - * relationships. - */ - std::vector exported_to; - std::vector imported_from; - - for ( int ichild=0; ichild 0 ) { - imported_from.push_back(child_recvs[ichild].getPeerRank()); - } - if ( child_load_data[ichild].d_load_exported > 0 ) { - exported_to.push_back(child_sends[ichild].getPeerRank()); - } - } - - if ( my_load_data.d_load_imported > 0 ) { - imported_from.push_back(parent_send->getPeerRank()); - } - if ( my_load_data.d_load_exported > 0 ) { - exported_to.push_back(parent_send->getPeerRank()); - } - - constructSemilocalUnbalancedToBalanced( - unbalanced_to_balanced, - exported_to, - imported_from, - unassigned ); - - - if (d_check_connectivity) { - const hier::OverlapConnectorAlgorithm oca; - tbox::plog - << "TreeLoadBalancerOld checking unbalanced-balanced connectivity." - << std::endl; - int errs = 0; - if (oca.checkOverlapCorrectness(unbalanced_to_balanced, true, true)) { - ++errs; - tbox::perr << "Error found in unbalanced_to_balanced!\n"; - } - if (oca.checkOverlapCorrectness(balanced_to_unbalanced, true, true)) { - ++errs; - tbox::perr << "Error found in balanced_to_unbalanced!\n"; - } - if (unbalanced_to_balanced.checkTransposeCorrectness( - balanced_to_unbalanced)) { - ++errs; - tbox::perr << "Error found in balanced-unbalanced transpose!\n"; - } - if (errs != 0) { - TBOX_ERROR( - "Errors in load balance mapping found." - << "balance_box_level:\n" << balance_box_level.format("", 2) - << "balanced_box_level:\n" << balanced_box_level.format("", 2) - << "unbalanced_to_balanced:\n" << unbalanced_to_balanced.format("", 2) - << "balanced_to_unbalanced:\n" << balanced_to_unbalanced.format("", 2)); - } - } - - if (d_check_map) { - const hier::MappingConnectorAlgorithm mca; - if (mca.findMappingErrors(unbalanced_to_balanced) != 0) { - TBOX_ERROR( - "TreeLoadBalancerOld::loadBalanceWithinRankGroup Mapping errors found in unbalanced_to_balanced!"); - } - if (unbalanced_to_balanced.checkTransposeCorrectness( - balanced_to_unbalanced)) { - TBOX_ERROR( - "TreeLoadBalancerOld::loadBalanceWithinRankGroup Transpose errors found!"); - } - } - - - delete[] child_load_data; - destroyAsyncCommObjects(child_sends, parent_send); - destroyAsyncCommObjects(child_recvs, parent_recv); - - t_get_map->stop(); - - if (anchor_to_balance.isFinalized()) { - t_use_map->start(); - const hier::MappingConnectorAlgorithm mca; - mca.modify( - anchor_to_balance, - balance_to_anchor, - unbalanced_to_balanced, - balanced_to_unbalanced, - &balance_box_level, - &balanced_box_level); - t_use_map->stop(); - } else { - hier::BoxLevel::swap(balance_box_level, balanced_box_level); - } - - return; -} - - - -/* - ************************************************************************* - * - * This is the tree load balancer's reassignment method, essentially a - * two-bin load balancer. Given two sets of BoxInTransit (the bins) - * and an amount of work to move from one set to the other, this - * method makes a best effort to effect the work transfer between the - * two bins. It can move BoxInTransit between given sets and, if - * needed, break some BoxInTransit up to move part of the work. - * - * This method is purely local--it reassigns the load but does not - * communicate the change to any remote process. - * - ************************************************************************* - */ -int -TreeLoadBalancerOld::reassignLoads( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - int ideal_transfer ) const -{ - if (d_print_steps) { - tbox::plog << " reassignLoads attempting to reassign " - << ideal_transfer << " from src to dst." - << std::endl; - } - - int actual_transfer = 0; - - if ((ideal_transfer >= 0 && src.empty()) || - (ideal_transfer <= 0 && dst.empty())) { - return actual_transfer; - } - - t_reassign_loads->start(); - - /* - * The algorithm cycles through a do-loop. Each time around, we try - * to swap some BoxInTransit between src and dst until we cannot improve the - * actual_transfer any further. Then, we try breaking up some BoxInTransit to - * improve the results. If we break some BoxInTransit, we generate some more - * swapping options that were not there before, so we loop back to - * try swapping again. - * - * If a break phase does not break any Box (and does not generate more - * swap options), the loop will stop making changes. We exit the loop - * at that point (and whenever we reached the ideal transfer). - */ - do { - - /* - * Try to balance load through swapping. - */ - int swap_transfer = shiftLoadsBySwapping( - src, - dst, - ideal_transfer - actual_transfer ); - - actual_transfer += swap_transfer; - - if (d_print_steps) { - double balance_penalty = computeBalancePenalty( - src, - dst, - actual_transfer - ideal_transfer); - tbox::plog << " Balance penalty after shiftLoadsBySwapping = " - << balance_penalty - << ", needs " << (ideal_transfer - actual_transfer) - << " more with " << src.size() << " source and " - << dst.size() << " dst Boxes remaining." - << std::endl; - } - - if (actual_transfer == ideal_transfer) break; - - /* - * Assuming that we did the best we could, swapping - * some BoxInTransit without breaking any, we now break up a Box - * in the overloaded side for partial transfer to the - * underloaded side. - */ - int brk_transfer = shiftLoadsByBreaking( - src, - dst, - next_available_index, - ideal_transfer - actual_transfer ); - actual_transfer += brk_transfer; - - if (d_print_steps) { - double balance_penalty = computeBalancePenalty( - src, - dst, - actual_transfer - ideal_transfer); - tbox::plog << " Balance penalty after shiftLoadsByBreaking = " - << balance_penalty - << ", needs " << (ideal_transfer - actual_transfer) - << " more with " << src.size() << " source and " - << dst.size() << " dst Boxes remaining." - << std::endl; - } - if (brk_transfer == 0) { - /* - * If no box can be broken to improve the actual_transfer, - * there is nothing further we can do. The swap phase, tried - * before the break phase, also generated no transfer, so - * there's no point trying again. Break out now to save - * retrying the swap phase. - */ - break; - } - - /* - * Now that we have broken up a Box, redo this loop to - * see if swapping can produce a better result. - */ - } while (ideal_transfer != actual_transfer); - - t_reassign_loads->stop(); - - return actual_transfer; -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -void -TreeLoadBalancerOld::packSubtreeLoadData( - std::vector& msg, - const SubtreeLoadData& load_data) const -{ - t_pack_load->start(); - msg.push_back(load_data.d_num_procs); - msg.push_back(load_data.d_total_work); - msg.push_back(load_data.d_load_exported); - const TransitSet& for_export = load_data.d_for_export; - msg.push_back( static_cast(for_export.size())); - for (TransitSet::const_iterator - ni = for_export.begin(); ni != for_export.end(); ++ni) { - const BoxInTransit& box_in_transit = *ni; - int i0 = static_cast(msg.size()); - msg.insert(msg.end(), box_in_transit.commBufferSize(), 0); - box_in_transit.putToIntBuffer(&msg[i0]); - } - t_pack_load->stop(); -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -void -TreeLoadBalancerOld::unpackSubtreeLoadData( - SubtreeLoadData& load_data, - TransitSet& receiving_bin, - hier::LocalId& next_available_index, - const int* received_data, - int received_data_length ) const -{ -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(received_data_length); -#endif - - t_unpack_load->start(); - const int *buffer = received_data; - load_data.d_num_procs = *(buffer++); - load_data.d_total_work = *(buffer++); - load_data.d_load_imported = *(buffer++); - const int num_boxes = *(buffer++); - /* - * As we pull each BoxInTransit out, give it a new id that reflects - * its new owner. Place all BoxInTransits in the receiving_bin. - */ - BoxInTransit received_box(d_dim); - for (int i = 0; i < num_boxes; ++i) { - buffer = received_box.getFromIntBuffer(buffer); - BoxInTransit renamed_box(received_box, - received_box.getBox(), - d_mpi.getRank(), - next_available_index); - next_available_index += 2 + d_degree; - receiving_bin.insert(renamed_box); - } - t_unpack_load->stop(); - TBOX_ASSERT( buffer == received_data + received_data_length ); -} - - - - - -/* - ************************************************************************* - * Construct semilocal relationships in unbalanced--->balanced - * Connector. Constructing these relationships require communication - * to determine where exported work ended up. - ************************************************************************* - */ -void -TreeLoadBalancerOld::constructSemilocalUnbalancedToBalanced( - hier::Connector &unbalanced_to_balanced, - const std::vector &export_dsts, - const std::vector &import_srcs, - const TreeLoadBalancerOld::TransitSet &kept_imports ) const -{ - t_construct_semilocal->start(); - - /* - * Determine edges from unbalanced to balanced BoxLevels by sending - * balanced Boxes back to the owners of the unbalanced Boxes that - * originated them. Use the proc_hist data from each balanced - * BoxInTransit to send it back along the path it took to get to - * the process that eventually kept it. - * - * Any process we exported work to should send back a message about - * where that work went. Any process we imported work from expects - * us to send a message about what happened to that work. So we - * receive messages from procs in export_dsts and send messages to - * procs in import_srcs. - * - * For work that originated locally, construct relationships when - * an incoming message tells us where that work ended up. For work - * that originated elsewhere, forward the information to the - * process that sent it to us. - * - * TODO: Implement alternate edge generation method where terminal - * owners send edge info directly back to initial owners. No need - * for trails. Initial owners receive from MPI_ANY and stops - * receiving when it can account for the number of cells it started - * with. We should retain both methods for edge generation because - * we don't know which is faster on any given machine. BTNG. - */ - - - /* - * Set up objects for asynchronous communication. - * - * NOTE: In the code review, it was suggested that the setting up - * of asynchronous communication objects can be factored out for - * reuse. - */ - tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer *importer_comms = import_srcs.empty() ? NULL : new tbox::AsyncCommPeer[import_srcs.size()]; - tbox::AsyncCommPeer *exporter_comms = export_dsts.empty() ? NULL : new tbox::AsyncCommPeer[export_dsts.size()]; - - for ( size_t i=0; i > outgoing_messages; - - - /* - * Prepare messages to tell processes that sent work to us about - * the work that we kept. - */ - for (TransitSet::const_iterator ni = kept_imports.begin(); - ni != kept_imports.end(); ++ni) { - const BoxInTransit &box_in_transit = *ni; - TBOX_ASSERT(!box_in_transit.d_proc_hist.empty()); - TBOX_ASSERT(box_in_transit.d_orig_box.getOwnerRank() != d_mpi.getRank()); - box_in_transit.packForPreviousOwner(outgoing_messages); - } - - /* - * Receive and unpack incoming messages. - */ - while ( comm_stage.numberOfCompletedMembers() > 0 || - comm_stage.advanceSome() ) { - - tbox::AsyncCommPeer* peer_comm = - dynamic_cast *>(comm_stage.popCompletionQueue()); - TBOX_ASSERT(peer_comm != NULL); - -#ifdef DEBUG_CHECK_ASSERTIONS - size_t j; - for ( j=0; jgetPeerRank() ) break; - } - TBOX_ASSERT( j < export_dsts.size() ); -#endif - - const int* received_data = peer_comm->getRecvData(); - int received_data_length = peer_comm->getRecvSize(); - unpackAndRouteNeighborhoodSets( - outgoing_messages, - unbalanced_to_balanced, - received_data, - received_data_length ); - } - - - - /* - * Send outgoing messages. - */ - TBOX_ASSERT( outgoing_messages.size() == import_srcs.size() ); - for ( size_t i=0; i &peer_comm = importer_comms[i]; - std::map >::const_iterator recip = - outgoing_messages.find(peer_comm.getPeerRank()); - TBOX_ASSERT( recip != outgoing_messages.end() ); - const std::vector &message = recip->second; - peer_comm.beginSend( &message[0], static_cast(message.size()) ); - } - - t_construct_semilocal_comm_wait->start(); - t_finish_sends->start(); - comm_stage.advanceAll(); - t_finish_sends->stop(); - t_construct_semilocal_comm_wait->stop(); - - delete [] importer_comms; - delete [] exporter_comms; - - t_construct_semilocal->stop(); - return; -} - - - - -/* - ************************************************************************* - * Unpack BoxInTransit objects from relationship message and either - * use data to set up local edges in unbalanced--->balanced or route - * data in the direction of the origin of the BoxInTransit. - ************************************************************************* - */ -void -TreeLoadBalancerOld::unpackAndRouteNeighborhoodSets( - std::map > &outgoing_messages, - hier::Connector& unbalanced_to_balanced, - const int* received_data, - int received_data_length ) const -{ - t_unpack_edge->start(); - - const int* beg = received_data; - const int* end = received_data + received_data_length; - - while (beg < end) { - - const BoxInTransit box_in_transit(beg, d_dim); - if (d_print_edge_steps) { - tbox::plog << "Unpacked edge " << box_in_transit << std::endl; - } - - TBOX_ASSERT(beg <= end); - - // Empty proc_hist must mean that local process is the originator. - TBOX_ASSERT(box_in_transit.d_proc_hist.empty() == - ( box_in_transit.d_orig_box.getOwnerRank() == - d_mpi.getRank() ) ); - - /* - * If the local process originated this box, generate the - * relationship here. Else, pack the box to forward to its - * previous owner (and eventually to its originator). - */ - - if (box_in_transit.d_orig_box.getOwnerRank() == d_mpi.getRank()) { - - if (d_print_edge_steps) { - tbox::plog << "Keeping edge " << box_in_transit << std::endl; - } - - unbalanced_to_balanced.insertLocalNeighbor( - box_in_transit.d_box, - box_in_transit.d_orig_box.getId()); - - } else { - box_in_transit.packForPreviousOwner(outgoing_messages); - } - } - t_unpack_edge->stop(); -} - - - -/* - ************************************************************************* - * Set the MPI commuicator. If there's a private communicator, free - * it first. It's safe to free the private communicator because no - * other code have access to it. - ************************************************************************* - */ -void -TreeLoadBalancerOld::setSAMRAI_MPI( - const tbox::SAMRAI_MPI& samrai_mpi) -{ - if (samrai_mpi.getCommunicator() == tbox::SAMRAI_MPI::commNull) { - TBOX_ERROR("TreeLoadBalancerOld::setSAMRAI_MPI error: Given\n" - << "communicator is invalid."); - } - - if ( d_mpi_is_dupe ) { - d_mpi.freeCommunicator(); - } - - // Enable private communicator. - d_mpi.dupCommunicator(samrai_mpi); - d_mpi_is_dupe = true; -} - - - -/* - ************************************************************************* - * Set the MPI commuicator. - ************************************************************************* - */ -void -TreeLoadBalancerOld::freeMPICommunicator() -{ - if ( d_mpi_is_dupe ) { - // Free the private communicator (if MPI has not been finalized). - int flag; - tbox::SAMRAI_MPI::Finalized(&flag); - if (!flag) { - d_mpi.freeCommunicator(); - } - } - d_mpi.setCommunicator(tbox::SAMRAI_MPI::commNull); - d_mpi_is_dupe = false; -} - - - -/* - ************************************************************************* - * RankGroups load-balances within their membership and ignore other - * groups. When we balance over multiple cycles, the RankGroup for - * the local process depends on the cycle, as computed by this method. - * - * The RankGroup size increases exponentially with the cycle number - * such that for the last cycle the rank group includes all processes - * in d_mpi. It's a heuristic formula, as follows: - * - * Partition all ranks into similar sized groups. With each cycle, - * the group size grows exponentially while the number of groups - * shrinks. The last cycle_number has a single group of - * d_mpi.getSize() processors. - * - * Let m = number of cycles - * i = cycle number, [0,m) - * p = communicator size - * - * The group size is p^((i+1)/m) - ************************************************************************* - */ -void -TreeLoadBalancerOld::createBalanceRankGroupBasedOnCycles( - tbox::RankGroup &rank_group, - int &number_of_groups, - int &group_num, - const int cycle_number, - const int number_of_cycles) const -{ - - /* - * Compute the number of group and, implicitly, the group sizes. - * Tiny groups tend to leave the members with possibly large - * overloads. In order to make all groups similar in size we round - * down the number of groups (and round up the group size). - */ - number_of_groups = - static_cast(pow(static_cast(d_mpi.getSize()), - 1.0 - double(cycle_number + 1) / number_of_cycles)); - - /* - * All groups will have a base population count of - * d_mpi.getSize()/number_of_groups. The remainder from the - * integer division is distributed to a subset of groups, starting - * from group 0, so these groups will have one more than the base. - */ - const int base_group_size = d_mpi.getSize() / number_of_groups; - const int first_base_sized_group = d_mpi.getSize() % number_of_groups; - const int first_rank_in_base_sized_group = - first_base_sized_group * (1 + base_group_size); - - if (d_mpi.getRank() < first_rank_in_base_sized_group) { - group_num = d_mpi.getRank() / (1 + base_group_size); - const int group_first_rank = group_num * (1 +base_group_size); - rank_group.setMinMax( group_first_rank, - group_first_rank + base_group_size ); - } else { - group_num = first_base_sized_group - + (d_mpi.getRank() - first_rank_in_base_sized_group) / base_group_size; - const int group_first_rank = first_rank_in_base_sized_group + - (group_num - first_base_sized_group)*(1+base_group_size); - rank_group.setMinMax( group_first_rank, - group_first_rank + base_group_size - 1 ); - } - - return; -} - - - -/* - ************************************************************************* - * Set up the asynchronous communication objects for the process tree - * containing ranks defined by the RankGroup. - * - * The process tree lay-out is defined by the BalancedDepthFirstTree - * class, thus defining parent and children of the local process. - * This method sets the AsyncCommPeer objects for communication with - * children and parent. - ************************************************************************* - */ -void -TreeLoadBalancerOld::setupAsyncCommObjects( - tbox::AsyncCommStage& child_stage, - tbox::AsyncCommPeer *& child_comms, - tbox::AsyncCommStage& parent_stage, - tbox::AsyncCommPeer *& parent_comm, - const tbox::RankGroup &rank_group, - const tbox::BalancedDepthFirstTree &bdfs ) const -{ - - child_comms = parent_comm = NULL; - - const int num_children = bdfs.getNumberOfChildren(); - - if ( num_children > 0 ) { - - child_comms = new tbox::AsyncCommPeer[num_children]; - - for (int child_num = 0; child_num < num_children; ++child_num) { - - const int child_rank_in_grp = bdfs.getChildRank(child_num); - const int child_true_rank = rank_group.getMappedRank(child_rank_in_grp); - - child_comms[child_num].initialize(&child_stage); - child_comms[child_num].setPeerRank(child_true_rank); - child_comms[child_num].setMPI(d_mpi); - child_comms[child_num].setMPITag(TreeLoadBalancerOld_LOADTAG0, - TreeLoadBalancerOld_LOADTAG1); - child_comms[child_num].limitFirstDataLength(TreeLoadBalancerOld_FIRSTDATALEN); - } - } - - if (bdfs.getParentRank() != bdfs.getInvalidRank()) { - - const int parent_rank_in_grp = bdfs.getParentRank(); - int parent_true_rank = rank_group.getMappedRank(parent_rank_in_grp); - - parent_comm = new tbox::AsyncCommPeer; - parent_comm->initialize(&parent_stage); - parent_comm->setPeerRank(parent_true_rank); - parent_comm->setMPI(d_mpi); - parent_comm->setMPITag(TreeLoadBalancerOld_LOADTAG0, - TreeLoadBalancerOld_LOADTAG1); - parent_comm->limitFirstDataLength(TreeLoadBalancerOld_FIRSTDATALEN); - - } - - return; -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -void -TreeLoadBalancerOld::destroyAsyncCommObjects( - tbox::AsyncCommPeer *& child_comms, - tbox::AsyncCommPeer *& parent_comm) const -{ - if (d_mpi.getSize() == 1) { - TBOX_ASSERT(child_comms == NULL); - TBOX_ASSERT(parent_comm == NULL); - } else { - if ( child_comms != NULL ) { - delete[] child_comms; - } - if ( parent_comm != NULL ) { - delete parent_comm; - } - child_comms = parent_comm = NULL; - } -} - - - -/* - ************************************************************************* - * Attempt to shift a specified ammount of load from one TransitSet to - * another by breaking a single box from the overloaded set. Examine - * multiple NodeInTransit and breakages to - * - * - filter out the ones that worsens the balance (see breakOffLoad) for - * reasons why this can happen. - * - * - find the one that results in the smallest combinedBreakingPenalty. - * - * Return whether any changes were made. - ************************************************************************* - */ -int -TreeLoadBalancerOld::shiftLoadsByBreaking( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - const int ideal_transfer ) const -{ - int actual_transfer = 0; - - if (ideal_transfer < 0) { - // The logic below does not handle bi-directional transfers, so handle it here. - actual_transfer = -shiftLoadsByBreaking( - dst, - src, - next_available_index, - -ideal_transfer ); - return actual_transfer; - } - - TBOX_ASSERT(src.size() + dst.size() > 0); - - t_shift_loads_by_breaking->start(); - - if (d_print_steps) { - tbox::plog << " shiftLoadsByBreaking asked to break off " - << ideal_transfer - << " from one of " << src.size() - << " source Boxes to add to set of " << dst.size() - << " Boxes." - << std::endl; - } - - /* - * The best results so far (from not transfering anything). - */ - TransitSet best_src = src; - TransitSet best_dst = dst; - int best_actual_transfer = 0; - - double best_combined_penalty = combinedBreakingPenalty( - computeBalancePenalty(best_src, best_dst, static_cast(ideal_transfer) - - best_actual_transfer), - computeSurfacePenalty(best_src, best_dst), - computeSlenderPenalty(best_src, best_dst)); - - /* - * Scale the pre-cut penalty. Scaling makes this method more - * agressive about producing a cut. Sometimes the uncut penalty can - * be low enough to prevent a cut, but the cut may be required for - * reasonable balancing. The down side of agressive cutting is that - * it tends to produce more slivers (but not terribly many). - * This exchange of load balance and slivers may not be easily - * eliminated by the weights in the penalty functions. - */ - if (d_print_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Uncut penalty: " << best_combined_penalty - << " scaled by " << d_precut_penalty_wt << " to " - << best_combined_penalty * d_precut_penalty_wt - << std::endl; - } - best_combined_penalty *= d_precut_penalty_wt; - - bool found_breakage = false; - - std::vector breakoff; - std::vector leftover; - double breakoff_amt; - for (TransitSet::iterator si = src.begin(); - si != src.end() && - (!found_breakage || si->d_load >= ideal_transfer); ++si) { - - const BoxInTransit& candidate = *si; - - breakOffLoad( - breakoff, - leftover, - breakoff_amt, - candidate.d_box, - ideal_transfer ); - - if (!breakoff.empty()) { - - const BoxInTransit& brk_box_in_transit = *si; - - const bool improves_balance = - tbox::MathUtilities::Abs( - static_cast(ideal_transfer) - breakoff_amt) < - (ideal_transfer - tbox::MathUtilities::getEpsilon()); - - if (d_print_steps) { - tbox::plog << " Potential to replace " << brk_box_in_transit << " with " - << breakoff.size() << " breakoff Boxes and " - << leftover.size() << " leftover Boxes." - << " improves_balance=" << improves_balance - << std::endl; - } - - if (!improves_balance) { - // Reject. - continue; - } - - /* - * Trial modifications of src and dst, for evaluating - * combined penalties. - */ - TransitSet trial_src = src; - TransitSet trial_dst = dst; - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - int trial_actual_transfer = actual_transfer; - trial_src.erase(candidate); - - /* - * Put breakoff in trial_dst and leftover back into trial_src. - */ - for (std::vector::const_iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - BoxInTransit give_box_in_transit( - brk_box_in_transit, - *bi, - d_mpi.getRank(), - next_available_index); - give_box_in_transit.d_load = static_cast(computeLoad( - give_box_in_transit.d_orig_box, - give_box_in_transit.getBox())); - next_available_index += 2 + d_degree; - trial_dst.insert(give_box_in_transit); - trial_actual_transfer += give_box_in_transit.d_load; - if (d_print_steps) { - tbox::plog << " Breakoff box " << *bi << bi->numberCells() - << '|' << bi->size() - << " -> " << give_box_in_transit - << std::endl; - } - } - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - for (std::vector::const_iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - BoxInTransit keep_box_in_transit( - brk_box_in_transit, - *bi, - d_mpi.getRank(), - next_available_index); - keep_box_in_transit.d_load = static_cast(computeLoad( - keep_box_in_transit.d_orig_box, - keep_box_in_transit.getBox())); - next_available_index += 2 + d_degree; - trial_src.insert(keep_box_in_transit); - if (d_print_steps) { - tbox::plog << " Leftover box " << *bi << " -> " << keep_box_in_transit - << std::endl; - } - } - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - trial_src.erase(brk_box_in_transit); - - /* - * Compute the new penalty to see if it improves our best result so far. - */ - TBOX_ASSERT(trial_src.size() + trial_dst.size() > 0); - double trial_balance_penalty = computeBalancePenalty(trial_src, - trial_dst, - static_cast(ideal_transfer) - trial_actual_transfer); - double trial_surface_penalty = computeSurfacePenalty(trial_src, - trial_dst); - double trial_slender_penalty = computeSlenderPenalty(trial_src, - trial_dst); - double trial_combined_penalty = combinedBreakingPenalty( - trial_balance_penalty, - trial_surface_penalty, - trial_slender_penalty); - if (d_print_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Trial's imbalance: " - << (ideal_transfer - trial_actual_transfer) - << " balance,surface,slender,combined penalty: " - << trial_balance_penalty << ' ' - << trial_surface_penalty << ' ' - << trial_slender_penalty << ' ' - << trial_combined_penalty - << std::endl; - } - - if (d_print_steps) { - if (trial_combined_penalty < best_combined_penalty) { - tbox::plog << " Keeping this trial." << std::endl; - } else { - tbox::plog << " Rejecting this trial." << std::endl; - } - } - - if (trial_combined_penalty < best_combined_penalty) { - found_breakage = true; - best_actual_transfer = static_cast(breakoff_amt); - best_src = trial_src; - best_dst = trial_dst; - best_combined_penalty = trial_combined_penalty; - } - - } else { - if (d_print_steps) { - tbox::plog << " Break step could not break " << ideal_transfer - << std::endl; - } - } - - } - - if (found_breakage) { - src.swap(best_src); - dst.swap(best_dst); - actual_transfer = best_actual_transfer; - } - - t_shift_loads_by_breaking->stop(); - return actual_transfer; -} - - - -/* - ************************************************************************* - * Attempt to swap some NodesInTransit between 2 sets of - * NodesInTransit (src and dst) to shift ideal_transfer work units. - * - * Transfering a BoxInTransit from one TransitSet to another - * is considered a degenerate "swap" (a BoxInTransit is - * swapped for nothing) handled by this function. - * - * This method can transfer load both ways. - * ideal_transfer > 0 means to raise the load of dst - * ideal_transfer < 0 means to raise the load of src - * The iterative do loop may overshoot the ideal_transfer - * and may have to swap to shift some of the load - * back. - * - * Return whether any changes were made. - ************************************************************************* - */ -int -TreeLoadBalancerOld::shiftLoadsBySwapping( - TransitSet& src, - TransitSet& dst, - int ideal_transfer ) const -{ - t_shift_loads_by_swapping->start(); - - if (d_print_steps) { - tbox::plog << " Attempting to swap " << ideal_transfer << std::endl; - } - - bool found_swap; - - int actual_transfer = 0; - - do { - - /* - * Ammount we seek to transfer from hi to lo - * (the "ideal" for this particular iteration). - * Unlike ideal_transfer and actual_transfer, this quantity is positive. - */ - int rem_transfer = ideal_transfer - actual_transfer; - if (d_print_steps) { - tbox::plog << " Swap progress: " << actual_transfer - << " / " << ideal_transfer << " remaining transfer = " - << rem_transfer << std::endl; - } - - found_swap = false; - - int swap_transfer; - found_swap = swapLoadPair( - src, - dst, - swap_transfer, - rem_transfer ); - - if (found_swap) { - actual_transfer += swap_transfer; - } - - } while (found_swap && (actual_transfer != ideal_transfer)); - - if (d_print_steps) { - tbox::plog << " Final imbalance for swap " << ideal_transfer - - actual_transfer << std::endl; - } - - t_shift_loads_by_swapping->stop(); - - return actual_transfer; -} - - - -/* - ************************************************************************* - * Find a BoxInTransit in src and a BoxInTransit in dst which when swapped - * results in shifting close to ideal_shift from src to dst. - * Return whether a swap pair was found. - * - * If isrc is set but idst is not, it means that isrc should - * be moved to dst, but no dst should be moved back. This is - * the degenerate case of swapping isrc for a BoxInTransit with zero - * load. - ************************************************************************* - */ -bool -TreeLoadBalancerOld::swapLoadPair( - TransitSet& src, - TransitSet& dst, - int& actual_transfer, - int ideal_transfer ) const -{ - if (ideal_transfer < 0) { - // The logic below does not handle bi-directional transfers, so handle it here. - bool rval = swapLoadPair( - dst, - src, - actual_transfer, - -ideal_transfer ); - actual_transfer = -actual_transfer; - return rval; - } - - t_find_swap_pair->start(); - - if (d_print_steps) { - tbox::plog << " swapLoadPair looking for transfer of " - << ideal_transfer - << " between " << src.size() << "-BoxInTransit src and " - << dst.size() << "-BoxInTransit dst." << std::endl; - } - if (d_print_swap_steps) { - tbox::plog << " src (" << src.size() << "):" << std::endl; - for (TransitSet::iterator si = src.begin(); si != src.end(); ++si) { - tbox::plog << *si << std::endl; - } - tbox::plog << " dst (" << dst.size() << "):" << std::endl; - for (TransitSet::iterator si = dst.begin(); si != dst.end(); ++si) { - tbox::plog << *si << std::endl; - } - } - - /* - * Look for two swap options. The "high side" option would - * transfer at least ideal_transfer. The "low side" option would - * transfer up to ideal_transfer. - * - * Each option is defined by a box from src and a box from dst, - * designated by the iterators src_hiside, dst_hiside, src_loside - * and dst_loside. src_hiside points to the box in the src for the - * high-side transfer, and similarly for dst_hiside. src_loside - * points to the box in the src for the low-side transfer, and - * similarly for dst_loside. - * - * Note that in the degenerate case, the dst box does not exist, - * and the swap degenerates to moving a box from the src to the - * dst. - * - * Compute the balance_penalty if high and low were swapped. Keep - * looking until we find the pair giving the lowest balance_penalty - * on swapping. - * - * isrc and idst point to the current best pair to swap. new_balance_penalty - * is the balance_penalty if we swap them. - * - * src_test and dst_test are trial pairs to check to see if we can improve on - * new_balance_penalty. - * - * We will look for two "best" pairs: - */ - - // Initialization indicating no swap pair found yet. - TransitSet::iterator src_hiside = src.end(); - TransitSet::iterator dst_hiside = dst.end(); - TransitSet::iterator src_loside = src.end(); - TransitSet::iterator dst_loside = dst.end(); - - // A dummy BoxInTransit for set searches. - hier::Box dummy_box(d_dim); - BoxInTransit dummy_search_target(d_dim); - - // Difference between swap results and ideal, >= 0 - int imbalance_loside = tbox::MathUtilities::getMax(); - int imbalance_hiside = tbox::MathUtilities::getMax(); - - if (dst.empty()) { - /* - * There is no dst BoxInTransit, so the swap would - * degnerate to moving a box from src to dst. Find - * the best src BoxInTransit to move. - */ - dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); - dummy_search_target.d_load = ideal_transfer; - TransitSet::iterator src_test = src.lower_bound(dummy_search_target); - - if (d_print_swap_steps) { - tbox::plog << " swapLoadPair with empty dst: "; - } - - if (src_test != src.begin()) { - src_hiside = src_test; - --src_hiside; - imbalance_hiside = src_hiside->d_load - ideal_transfer; - if (d_print_swap_steps) { - tbox::plog << " hi src: " << (*src_hiside) - << " with transfer " << src_hiside->d_load - << ", off by " << imbalance_hiside; - } - } - if (src_test != src.end()) { - src_loside = src_test; - imbalance_loside = ideal_transfer - src_loside->d_load; - if (d_print_swap_steps) { - tbox::plog << " lo src: " << (*src_loside) - << " with transfer " << src_loside->d_load - << ", off by " << imbalance_loside; - } - } - if (d_print_swap_steps) { - tbox::plog << std::endl; - } - - } else { - - /* - * Start search through src beginning with the box whose load - * exceed the biggest dst box by at least ideal_transfer. - */ - dummy_search_target = *dst.begin(); - dummy_search_target.d_load += ideal_transfer; - TransitSet::iterator src_beg = src.lower_bound(dummy_search_target); - - for (TransitSet::iterator src_test = src_beg; src_test != src.end(); ++src_test) { - - /* - * Set dst_test pointing to where we should start looking in dst. - * Look for a load less than the load of src_test by - * ideal_transfer. - */ - dummy_search_target = BoxInTransit(hier::Box(dummy_box, hier::LocalId::getZero(), 0)); - dummy_search_target.d_load = tbox::MathUtilities::Max( - src_test->d_load - ideal_transfer, - 0); - TransitSet::iterator dst_test = dst.lower_bound(dummy_search_target); - - if (dst_test != dst.end()) { - - /* - * lower_bound returned dst_test that would transfer >= - * ideal_transfer when swapped with src_test. Check - * transfererence between src_test and dst_test for the - * high-side transfer. Also check the next smaller box in - * dst for the low-side transfer. - */ - - // tmp_miss is the difference between the test swap amount and ideal_transfer. - int tmp_miss = (src_test->d_load - dst_test->d_load) - ideal_transfer; - TBOX_ASSERT(tmp_miss >= 0); - - if ((tmp_miss < imbalance_hiside)) { - src_hiside = src_test; - dst_hiside = dst_test; - imbalance_hiside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new hi-swap pair: " << (*src_hiside) - << " & " << (*dst_hiside) << " with transfer " - << (src_hiside->d_load - dst_hiside->d_load) - << " missing by " << imbalance_hiside - << std::endl; - } - } - - if (dst_test != dst.begin()) { - --dst_test; // Now, src_test and dst_test transferer by *less* than ideal_transfer. - tmp_miss = ideal_transfer - (src_test->d_load - dst_test->d_load); - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_loside) { - src_loside = src_test; - dst_loside = dst_test; - imbalance_loside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new lo-swap pair: " << (*src_loside) - << " & " << (*dst_loside) << " with transfer " - << (src_loside->d_load - dst_loside->d_load) - << " missing by " << imbalance_loside - << std::endl; - } - } - } - - } else { - - /* - * The ideal dst to swap is smaller than the smallest dst - * box. So the only choice is swapping src_test for nothing. - * Chech this against the current high- and low-side choices. - */ - if (src_test->d_load > ideal_transfer) { - // Moving src_test to src is moving too much--hiside. - int tmp_miss = src_test->d_load - ideal_transfer; - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_hiside) { - src_hiside = src_test; - dst_hiside = dst.end(); - imbalance_hiside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new hi-swap source: " << (*src_hiside) - << " & " << "no dst" << " with transfer " - << (src_hiside->d_load) - << " missing by " << imbalance_hiside - << std::endl; - } - } - } else { - // Moving src_test to src is moving (just right or) too little--loside. - int tmp_miss = ideal_transfer - src_test->d_load; - TBOX_ASSERT(tmp_miss >= 0); - if (tmp_miss < imbalance_loside) { - src_loside = src_test; - dst_loside = dst.end(); - imbalance_loside = tmp_miss; - if (d_print_swap_steps) { - tbox::plog << " new lo-swap source: " << (*src_loside) - << " & " << "no dst" << " with transfer " - << (src_loside->d_load) - << " missing by " << imbalance_loside - << std::endl; - } - } - /* - * Break out of the loop early because there is no - * point checking smaller src boxes. - */ - break; - } - } - } - - } - - /* - * Swapping does not produce new cuts, so it is ok to omit the penalties - * arising from cutting. - */ - double current_balance_penalty = static_cast(ideal_transfer); - double balance_penalty_loside = static_cast(imbalance_loside); - double balance_penalty_hiside = static_cast(imbalance_hiside); - - if (d_print_swap_steps) { - tbox::plog << " Swap candidates give penalties (unswap,lo,hi): " - << current_balance_penalty << " , " << balance_penalty_loside - << " , " << balance_penalty_hiside << std::endl; - } - - bool found_swap = false; - TransitSet::iterator isrc; - TransitSet::iterator idst; - - if (balance_penalty_loside < current_balance_penalty && - balance_penalty_loside <= balance_penalty_hiside) { - isrc = src_loside; - idst = dst_loside; - found_swap = true; - if (d_print_swap_steps) { - tbox::plog << " Taking loside." << std::endl; - } - } else if (balance_penalty_hiside < current_balance_penalty && - balance_penalty_hiside <= balance_penalty_loside) { - isrc = src_hiside; - idst = dst_hiside; - found_swap = true; - if (d_print_swap_steps) { - tbox::plog << " Taking hiside." << std::endl; - } - } else { - if (d_print_swap_steps) { - tbox::plog << " Keeping original (no swap)." << std::endl; - } - } - - if (found_swap) { - actual_transfer = isrc->d_load; - if (idst != dst.end()) { - actual_transfer -= idst->d_load; - } - } - - if (found_swap) { - - // We can improve balance_penalty by swapping isrc with idst. - if (d_print_steps) { - tbox::plog << " Swapping " << actual_transfer << " units using "; - if (isrc != src.end()) tbox::plog << *isrc; - else tbox::plog << "X"; - tbox::plog << " <--> "; - if (idst != dst.end()) tbox::plog << *idst; - else tbox::plog << "X"; - tbox::plog << std::endl; - } - - if (isrc != src.end()) { - dst.insert(*isrc); - src.erase(isrc); - } - if (idst != dst.end()) { - src.insert(*idst); - dst.erase(idst); - } - - - } else { - if (d_print_steps) { - tbox::plog << " Cannot find swap pair for " << ideal_transfer - << " units." << std::endl; - } - } - - t_find_swap_pair->stop(); - return found_swap; -} - - - -/* - ************************************************************************* - * Master method for breaking off a load. - * - * Try different heuristics and pick the "best" way to break off a - * load. The best is defined as the one with the lowest combined - * penalty. - * - * This method always return a breakage if at all possible, without - * considering whether the break should be used. For example, - * requesting breakage of 1 cell in a 100x100 box might return a - * breakage of a 100-cells sliver! - * - * Return whether a successful break was made. - ************************************************************************* - */ -bool -TreeLoadBalancerOld::breakOffLoad( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break ) const -{ - TBOX_ASSERT(ideal_load_to_break > 0); - - /* - * NOTE: We need in this method a way to weigh the - * value of proximity to the ideal breakoff vs the - * increased area of the cuts. However, the weight - * given to area-optimized cuts should be considered - * only with real application performance data. - * - * NOTE: We can compute the amount of new box boundaries - * generated by computing the box boundary before and - * after, and subtracting. Easier than reconstructing - * the cuts from the box definitions. - * - * NOTE: We should weight negatively the production of - * high surface-to-volume boxes. - */ - - t_break_off_load->start(); - - breakoff.clear(); - leftover.clear(); - - if (ideal_load_to_break < d_min_size.getProduct()) { - /* - * Assuming uniform load balancing, there is no hope - * if breaking off a piece of the desired size. - */ - if (d_print_break_steps) { - tbox::plog << " ideal_load_to_break " << ideal_load_to_break - << " < " << d_min_size.getProduct() << d_min_size - << ": Cannot break Box " << box << std::endl; - } - t_break_off_load->stop(); - return false; - } - - /* - * To avoid repeated computations of bad cuts, - * we precompute bad_cuts here to provide to - * methods that actually use the information. - */ - tbox::Array > bad_cuts(d_dim.getValue()); - t_find_bad_cuts->start(); - hier::BoxUtilities::findBadCutPoints(bad_cuts, - box, - d_block_domain_boxes[box.getBlockId().getBlockValue()], - d_bad_interval); - t_find_bad_cuts->stop(); - - // Penalty for not transfering ideal load. - double best_balance_penalty = computeBalancePenalty(box, - ideal_load_to_break); - // Penalty for new surfaces generated (none generated yet). - double best_surface_penalty = computeSurfacePenalty(box); - // Penalty for slender boxes. - double best_slender_penalty = computeSlenderPenalty(box); - - double best_combined_penalty = tbox::MathUtilities::getMax(); - - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " pre-break imbalance: " << ideal_load_to_break - << " balance,surface,slender,combined penalties: " - << best_balance_penalty << ", " << best_surface_penalty - << ", " - << best_slender_penalty << ", " << best_combined_penalty - << std::endl; - } - - brk_load = 0; - bool found_any_break = false; - - { - std::vector planar_breakoff; - std::vector planar_leftover; - double planar_brk_load; - - bool found_this_break = breakOffLoad_planar( - planar_breakoff, - planar_leftover, - planar_brk_load, - box, - ideal_load_to_break, - bad_cuts ); - - if (found_this_break) { - found_any_break = true; - double planar_balance_penalty = computeBalancePenalty(planar_breakoff, - planar_leftover, - static_cast(planar_brk_load - ideal_load_to_break)); - double planar_surface_penalty = computeSurfacePenalty(planar_breakoff, - planar_leftover); - double planar_slender_penalty = computeSlenderPenalty(planar_breakoff, - planar_leftover); - double planar_combined_penalty = - combinedBreakingPenalty(planar_balance_penalty, - planar_surface_penalty, - planar_slender_penalty); - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Planar-break broke off " - << planar_brk_load << " / " << ideal_load_to_break - << " from " << box << '|' - << box.numberCells() << '|' - << box.size() << " into " - << planar_breakoff.size() - << " breakoff: "; - for (std::vector::const_iterator bi = - planar_breakoff.begin(); - bi != planar_breakoff.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n and " << planar_leftover.size() - << " leftover boxes:"; - for (std::vector::const_iterator bi = - planar_leftover.begin(); - bi != planar_leftover.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n imbalance: " - << (planar_brk_load - ideal_load_to_break) - << " balance,surface,slender,combined penalties: " - << planar_balance_penalty << ", " - << planar_surface_penalty << ", " - << planar_slender_penalty - << ", " << planar_combined_penalty << std::endl; - } - if (planar_combined_penalty < best_combined_penalty) { - if (d_print_break_steps) { - tbox::plog << " Keeping planar cut result." << std::endl; - } - breakoff.swap(planar_breakoff); - leftover.swap(planar_leftover); - brk_load = planar_brk_load; - best_balance_penalty = planar_balance_penalty; - best_surface_penalty = planar_surface_penalty; - best_slender_penalty = planar_slender_penalty; - best_combined_penalty = planar_combined_penalty; - } else { - if (d_print_break_steps) { - tbox::plog << " Rejecting planar cut result." << std::endl; - } - } - } - } - - /* - * If above cut algorithms fail to break or improve the penalty, try - * more cutting algorithms. - */ - { - - std::vector cubic_breakoff; - std::vector cubic_leftover; - double cubic_brk_load; - - bool found_this_break = breakOffLoad_cubic( - cubic_breakoff, - cubic_leftover, - cubic_brk_load, - box, - ideal_load_to_break, - bad_cuts ); - - if (found_this_break) { - found_any_break = true; - double cubic_balance_penalty = computeBalancePenalty( - cubic_breakoff, - cubic_leftover, - static_cast(cubic_brk_load - ideal_load_to_break)); - double cubic_surface_penalty = computeSurfacePenalty(cubic_breakoff, - cubic_leftover); - double cubic_slender_penalty = computeSlenderPenalty(cubic_breakoff, - cubic_leftover); - double cubic_combined_penalty = - combinedBreakingPenalty(cubic_balance_penalty, - cubic_surface_penalty, - cubic_slender_penalty); - if (d_print_break_steps) { - tbox::plog.unsetf(std::ios::fixed | std::ios::scientific); - tbox::plog.precision(6); - tbox::plog << " Cubic-break broke off " - << cubic_brk_load << " / " << ideal_load_to_break - << " from " << box << '|' - << box.numberCells() << '|' - << box.size() << " into " - << cubic_breakoff.size() - << " breakoff: "; - for (std::vector::const_iterator bi = - cubic_breakoff.begin(); - bi != cubic_breakoff.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n and " << cubic_leftover.size() - << " leftover boxes:"; - for (std::vector::const_iterator bi = - cubic_leftover.begin(); - bi != cubic_leftover.end(); - ++bi) { - tbox::plog << " " << *bi << '|' << bi->numberCells() << '|' - << bi->size(); - } - tbox::plog << "\n imbalance: " - << (cubic_brk_load - ideal_load_to_break) - << " balance,surface,slender,combined penalties: " - << cubic_balance_penalty << ", " - << cubic_surface_penalty << ", " - << cubic_slender_penalty - << ", " << cubic_combined_penalty << std::endl; - } - if (cubic_combined_penalty < best_combined_penalty) { - if (d_print_break_steps) { - tbox::plog << " choosing breakOffLoad_cubic result." - << std::endl; - } - breakoff.swap(cubic_breakoff); - leftover.swap(cubic_leftover); - brk_load = cubic_brk_load; - best_balance_penalty = cubic_balance_penalty; - best_surface_penalty = cubic_surface_penalty; - best_slender_penalty = cubic_slender_penalty; - best_combined_penalty = cubic_combined_penalty; - } else { - if (d_print_break_steps) { - tbox::plog << " Rejecting cubic cut result." << std::endl; - } - } - } else { - if (d_print_break_steps) { - tbox::plog << " breakOffLoad_cubic could not break " - << ideal_load_to_break << " from " << box - << '/' << box.numberCells() - << '/' << box.numberCells().getProduct() - << std::endl; - } - } - - } - - t_break_off_load->stop(); - - return found_any_break; -} - - - -/* - ************************************************************************* - * Measuring surface area of boxes is used in penalizing - * the creation of new surfaces. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeBoxSurfaceArea( - const std::vector& boxes) const -{ - int surface_area = 0; - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - ++bi) { - const hier::Box& box = *bi; - int volume = box.size(); - for (int d = 0; d < d_dim.getValue(); ++d) { - surface_area += volume / box.numberCells(d); - } - } - surface_area *= 2; - return surface_area; -} - - - -/* - ************************************************************************* - * Measuring surface area of boxes is used in penalizing - * the creation of new surfaces. - ************************************************************************* - */ - -int -TreeLoadBalancerOld::computeBoxSurfaceArea( - const hier::Box& box) const -{ - int surface_area = 0; - int volume = box.size(); - for (int d = 0; d < d_dim.getValue(); ++d) { - surface_area += volume / box.numberCells(d); - } - surface_area *= 2; - return surface_area; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSurfacePenalty( - const std::vector& a, - const std::vector& b) const -{ - double surface_penalty = 0; - for (std::vector::const_iterator bi = a.begin(); - bi != a.end(); - ++bi) { - surface_penalty += computeSurfacePenalty(*bi); - } - for (std::vector::const_iterator bi = b.begin(); - bi != b.end(); - ++bi) { - surface_penalty += computeSurfacePenalty(*bi); - } - return surface_penalty; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSurfacePenalty( - const TransitSet& a, - const TransitSet& b) const -{ - double surface_penalty = 0; - for (TransitSet::const_iterator bi = a.begin(); bi != a.end(); ++bi) { - surface_penalty += computeSurfacePenalty(bi->d_box); - } - for (TransitSet::const_iterator bi = b.begin(); bi != b.end(); ++bi) { - surface_penalty += computeSurfacePenalty(bi->d_box); - } - return surface_penalty; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted surface penalty for a box. The - * reference zero penalty is for a box of equal sides having the same - * volume. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSurfacePenalty( - const hier::Box& a) const -{ - int boxvol = a.size(); - double surface_area = computeBoxSurfaceArea(a); - double best_surface = 2 * d_dim.getValue() * pow(static_cast(boxvol), - static_cast(d_dim.getValue() - 1) / d_dim.getValue()); - double surface_penalty = surface_area / best_surface - 1.0; - surface_penalty = surface_penalty * surface_penalty; // Make it blow up. - return surface_penalty; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSlenderPenalty( - const std::vector& a, - const std::vector& b) const -{ - double slender_penalty = 0; - for (std::vector::const_iterator bi = a.begin(); - bi != a.end(); - ++bi) { - slender_penalty += computeSlenderPenalty(*bi); - } - for (std::vector::const_iterator bi = b.begin(); - bi != b.end(); - ++bi) { - slender_penalty += computeSlenderPenalty(*bi); - } - return slender_penalty; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSlenderPenalty( - const TransitSet& a, - const TransitSet& b) const -{ - double slender_penalty = 0; - for (TransitSet::const_iterator bi = a.begin(); bi != a.end(); ++bi) { - slender_penalty += computeSlenderPenalty(bi->d_box); - } - for (TransitSet::const_iterator bi = b.begin(); bi != b.end(); ++bi) { - slender_penalty += computeSlenderPenalty(bi->d_box); - } - return slender_penalty; -} - - - -/* - ************************************************************************* - * Return non-dimensional volume-weighted slenderness penalty for two - * containers of boxes. The reference zero penalty refers to a box with - * all sides the same length. - ************************************************************************* - */ - -double -TreeLoadBalancerOld::computeSlenderPenalty( - const hier::Box& a) const -{ - const hier::IntVector boxdim = a.numberCells(); - double slender_penalty = static_cast(boxdim.max()) / boxdim.min() - 1.0; - slender_penalty = slender_penalty * slender_penalty; // Make it blow up. - return slender_penalty; -} - - - -/* - ************************************************************************* - * Break up box bursty against box solid and adds the pieces to list. - * This version differs from that in BoxContainer in that it tries to minimize - * slivers. - ************************************************************************* - */ - -void -TreeLoadBalancerOld::burstBox( - std::vector& boxes, - const hier::Box& bursty, - const hier::Box& solid ) const -{ - /* - * This method lacks logic to handle the case of solid not being - * completely inside bursty. That feature is not currently needed. - */ - TBOX_ASSERT(bursty.contains(solid)); - - const hier::IntVector solid_size = solid.numberCells(); - - boxes.clear(); - hier::Box cutme = bursty; - while (!cutme.isSpatiallyEqual(solid)) { - - int cut_dir = 999999; - bool cut_above_solid = false; // Whether to slice off the piece above solid (vs below). - /* - * Find direction and place to cut. To minimize slivers, cut - * from cutme the thickest slab (in direction normal to cut) - * possible. - */ - int slab_thickness = 0; - for (int d = 0; d < d_dim.getValue(); ++d) { - if (cutme.numberCells(d) > solid_size(d)) { - const int thickness_from_upper_cut = cutme.upper() (d) - - solid.upper() (d); - if (thickness_from_upper_cut > slab_thickness) { - slab_thickness = thickness_from_upper_cut; - cut_dir = d; - cut_above_solid = true; - } - const int thickness_from_lower_cut = solid.lower() (d) - - cutme.lower() (d); - if (thickness_from_lower_cut > slab_thickness) { - slab_thickness = thickness_from_lower_cut; - cut_dir = d; - cut_above_solid = false; - } - } - } - TBOX_ASSERT(cut_dir >= 0 && cut_dir < d_dim.getValue()); - - hier::Box removeme = cutme; - if (cut_above_solid) { - cutme.upper() (cut_dir) = solid.upper() (cut_dir); - removeme.lower() (cut_dir) = solid.upper() (cut_dir) + 1; - } else { - cutme.lower() (cut_dir) = solid.lower() (cut_dir); - removeme.upper() (cut_dir) = solid.lower() (cut_dir) - 1; - } - - boxes.push_back(removeme); - - } - - if (d_print_break_steps) { - tbox::plog << " burstBox: " << bursty << " = " << solid; - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - tbox::plog << " + " << *bi; - } - tbox::plog << std::endl; - } -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - for (std::vector::const_iterator bj = boxes.begin(); - bj != boxes.end(); - bj++) { - if (bi != bj) { - TBOX_ASSERT(!bi->intersects(*bj)); - } - } - } - hier::BoxContainer l1(bursty); - hier::BoxContainer l2(solid); - for (std::vector::const_iterator bi = boxes.begin(); - bi != boxes.end(); - bi++) { - l2.pushFront(*bi); - } - l1.removeIntersections(l2); - TBOX_ASSERT(l1.size() == 0); - l2.removeIntersections(bursty); - TBOX_ASSERT(l2.size() == 0); -#endif -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -double -TreeLoadBalancerOld::computeLocalLoads( - const hier::BoxLevel& box_level) const -{ - // Count up workload. - double load = 0.0; - const hier::BoxContainer& boxes = box_level.getBoxes(); - for (hier::BoxContainer::const_iterator ni = boxes.begin(); - ni != boxes.end(); - ++ni) { - double box_load = computeLoad(*ni); - load += box_load; - } - return static_cast(load); -} - - - -/* - ************************************************************************* - * - * Print out all attributes of class instance for debugging. - * - ************************************************************************* - */ - -void -TreeLoadBalancerOld::printClassData( - std::ostream& os) const -{ - os << "\nTreeLoadBalancerOld::printClassData..." << std::endl; - os << "\nTreeLoadBalancerOld: this = " - << (TreeLoadBalancerOld *)this << std::endl; - os << "d_object_name = " << d_object_name << std::endl; - - int ln; - - os << "d_workload_data_id..." << std::endl; - for (ln = 0; ln < d_workload_data_id.getSize(); ln++) { - os << " d_workload_data_id[" << ln << "] = " - << d_workload_data_id[ln] << std::endl; - } -} - - - -/* - ************************************************************************* - * - * Read values (described in the class header) from input database. - * - ************************************************************************* - */ - -void -TreeLoadBalancerOld::getFromInput( - const boost::shared_ptr& db) -{ - - if (db) { - - d_print_steps = - db->getBoolWithDefault("print_steps", - d_print_steps); - d_print_break_steps = - db->getBoolWithDefault("print_break_steps", - d_print_break_steps); - d_print_swap_steps = - db->getBoolWithDefault("print_swap_steps", - d_print_swap_steps); - d_print_edge_steps = - db->getBoolWithDefault("print_edge_steps", - d_print_edge_steps); - d_check_connectivity = - db->getBoolWithDefault("check_connectivity", - d_check_connectivity); - d_check_map = - db->getBoolWithDefault("check_map", - d_check_map); - - d_report_load_balance = db->getBoolWithDefault("report_load_balance", - d_report_load_balance); - d_barrier_before = db->getBoolWithDefault("barrier_before", - d_barrier_before); - d_barrier_after = db->getBoolWithDefault("barrier_after", - d_barrier_after); - - d_n_root_cycles = db->getIntegerWithDefault("n_root_cycles", - d_n_root_cycles); - - d_balance_penalty_wt = db->getDoubleWithDefault("balance_penalty_wt", - d_balance_penalty_wt); - d_surface_penalty_wt = db->getDoubleWithDefault("surface_penalty_wt", - d_surface_penalty_wt); - d_slender_penalty_wt = db->getDoubleWithDefault("slender_penalty_wt", - d_slender_penalty_wt); - d_precut_penalty_wt = db->getDoubleWithDefault("precut_penalty_wt", - d_precut_penalty_wt); - - } -} - - - -/* - *************************************************************************** - * - *************************************************************************** - */ -void -TreeLoadBalancerOld::assertNoMessageForPrivateCommunicator() const -{ - /* - * If using a private communicator, double check to make sure - * there are no remaining messages. This is not a guarantee - * that there is no messages in transit, but it can find - * messages that have arrived but not received. - */ - if (d_mpi.getCommunicator() != tbox::SAMRAI_MPI::commNull) { - int flag; - tbox::SAMRAI_MPI::Status mpi_status; - int mpi_err = d_mpi.Iprobe(MPI_ANY_SOURCE, - MPI_ANY_TAG, - &flag, - &mpi_status); - if (mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error probing for possible lost messages."); - } - if (flag == true) { - int count = -1; - mpi_err = tbox::SAMRAI_MPI::Get_count(&mpi_status, MPI_INT, &count); - TBOX_ERROR( - "Library error!\n" - << "TreeLoadBalancerOld detected before or\n" - << "after using a private communicator that there\n" - << "is a message yet to be received. This is\n" - << "an error because all messages using the\n" - << "private communicator should have been\n" - << "accounted for. Message status:\n" - << "source " << mpi_status.MPI_SOURCE << '\n' - << "tag " << mpi_status.MPI_TAG << '\n' - << "count " << count << " (assuming integers)\n" - << "current tags: " - << ' ' << TreeLoadBalancerOld_LOADTAG0 << ' ' - << TreeLoadBalancerOld_LOADTAG1 - ); - } - } -} - - - -/* - ************************************************************************* - * Break off a load from a box by making a single planar cut across - * the box's longest dimension. - * - * Currently assuming uniform load of one unit per cell. - * - * Return whether a successful break was made. - ************************************************************************* - */ -bool -TreeLoadBalancerOld::breakOffLoad_planar( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const -{ - - const tbox::Dimension dim(d_dim); - - if (d_print_break_steps) { - tbox::plog << " breakOffLoad_planar attempting to break " - << ideal_load_to_break << " from Box " << box - << " min_size=" << d_min_size << std::endl; - } - - brk_load = 0; - breakoff.clear(); - leftover.clear(); - - const hier::IntVector& box_dims = box.numberCells(); - - const int box_vol = box_dims.getProduct(); - - if (box_vol <= ideal_load_to_break) { - // Easy: break off everything. - breakoff.push_back(box); - brk_load = box_vol; - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar broke off entire Box " - << box - << std::endl; - } - return true; - } - - /* - * Determine ordering of box_dims from shortest to longest. - */ - hier::IntVector sorted_dirs(dim); - sorted_dirs.sortIntVector(box_dims); - - /* - * best_difference is the difference between the best cut found and - * ideal_load_to_break. Initialize it for zero breakoff. - */ - double best_difference = static_cast(ideal_load_to_break); - hier::Box best_breakoff_box(dim); - hier::Box best_leftover_box(dim); - - for (int d = d_dim.getValue() - 1; d >= 0; --d) { - - /* - * Search directions from longest to shortest - * because we prefer to break across longest dir. - */ - const int brk_dir = sorted_dirs(d_dim.getValue() - 1); - - const int brk_area = box_vol / box_dims(brk_dir); - - const tbox::Array& bad = bad_cuts[brk_dir]; - - /* - * Try rounding the break length down (round==0) and up (round==1), - * looking for the best place to cut. - */ - for (int round = 0; round <= 1; ++round) { - - /* - * Rounding up or down must heed d_cut_factor, - * so brk_len must be an integer multiple of d_cut_factor. - */ - const int brk_len = - (static_cast(ideal_load_to_break / brk_area) - / d_cut_factor(brk_dir) + round) - * d_cut_factor(brk_dir); - - if (brk_len < d_min_size(brk_dir)) { - // Breakoff box violates minimum size. - continue; - } - - if (box_dims(brk_dir) - brk_len > 0 && - box_dims(brk_dir) - brk_len < d_min_size(brk_dir)) { - // Leftover box violates minimum size. - continue; - } - - const int brk_volume = brk_area * brk_len; - - /* - * Compute the difference between the current breakage - * and the ideal. - */ - const double difference = brk_volume <= ideal_load_to_break ? - static_cast(ideal_load_to_break - brk_volume) : - static_cast(brk_volume - ideal_load_to_break); - - if (difference < best_difference) { - // This cut gives better difference, if it can be done. - - TBOX_ASSERT(brk_len >= 0 && brk_len <= bad.size()); - - if (brk_len == box_dims(brk_dir) || - bad[brk_len] == false) { - // Cutting brk_len from low side is ok. - best_difference = difference; - best_breakoff_box = box; - best_breakoff_box.upper() (brk_dir) = - best_breakoff_box.lower() (brk_dir) + brk_len - 1; - best_leftover_box = box; - best_leftover_box.lower() (brk_dir) = - best_breakoff_box.upper() (brk_dir) + 1; - break; - } else if (bad[box_dims(brk_dir) - brk_len] == false) { - // Cutting brk_len from high side is ok. - best_difference = difference; - best_breakoff_box = box; - best_breakoff_box.lower() (brk_dir) = - best_breakoff_box.upper() (brk_dir) - brk_len + 1; - best_leftover_box = box; - best_leftover_box.upper() (brk_dir) = - best_breakoff_box.lower() (brk_dir) - 1; - break; - } - } - } - - } - - bool successful_break = false; - - if (!best_breakoff_box.empty()) { - breakoff.push_back(best_breakoff_box); - brk_load = best_breakoff_box.size(); - successful_break = true; - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar broke off box " << box - << " for breakoff box " << best_breakoff_box - << " and leftover " << best_leftover_box << std::endl; - } - } else { - if (d_print_break_steps) { - tbox::plog << " breakOffload_planar could not break " - << ideal_load_to_break << " from Box " << box - << std::endl; - } - } - if (!best_leftover_box.empty()) { - leftover.push_back(best_leftover_box); - } - -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancerOld library error:\n" - << "breakoff box " << b << ", size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "break box size " << best_breakoff_box.numberCells() << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } - for (std::vector::iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancerOld library error:\n" - << "leftover box " << b << ", size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "break box size " << best_breakoff_box.numberCells() << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } -#endif - - return successful_break; -} - - - -/* - ************************************************************************* - * Break off a load from a box by making a box cut that is as close - * to cubic as feasible. - * - * Currently assuming uniform load of one unit per cell. - * - * Return whether a successful break was made. - * - * Differs from breakOffLoad in that it will always - * performs a break and if needed, break off more than - * the ideal. The calling method should take this into - * account. - ************************************************************************* - */ -bool -TreeLoadBalancerOld::breakOffLoad_cubic( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const -{ - - const hier::IntVector box_dims(box.numberCells()); - - const double box_load(box_dims.getProduct()); - - if (ideal_load_to_break >= box_load) { - // Easy: break off everything. - leftover.clear(); - breakoff.clear(); - breakoff.push_back(box); - brk_load = box_load; - if (d_print_break_steps) { - tbox::plog << " breakOffload_cubic broke off entire Box " - << box - << std::endl; - } - return true; - } - - if (ideal_load_to_break > 0.5 * box_load) { - /* - * This algorithm is better when breaking off a small portion. - * Since the ideal is a bigger portion, switch breakoff with leftover. - */ - if (d_print_break_steps) { - tbox::plog - << " breakOffload_cubic reversing direction to break " - << (box_dims.getProduct() - ideal_load_to_break) - << " instead of " << ideal_load_to_break << " / " - << box_dims.getProduct() << std::endl; - } - bool success = - breakOffLoad_cubic( - leftover, - breakoff, - brk_load, - box, - box_dims.getProduct() - ideal_load_to_break, - bad_cuts ); - if (success) { - brk_load = box_dims.getProduct() - brk_load; - } - return success; - } - - if (d_print_break_steps) { - tbox::plog << " breakOffload_cubic attempting to break " - << ideal_load_to_break << " from Box " << box - << " min_size=" << d_min_size << std::endl; - } - - breakoff.clear(); - leftover.clear(); - - /* - * brk_size is the size of the box we want to break off of - * box. We start with the smallest allowed brk_size that - * will not create remainders that violate size constraints. - * - * In the do loop below, we increase brk_size to bring brk_load - * closer to ideal_oad_to_break. - */ - hier::IntVector brk_size(d_min_size); - brk_size.max(d_cut_factor); - brk_size.min(box_dims); - /* - * If remainder is too small, zero it out to avoid - * having non-zero remainder smaller than d_min_size. - */ - for (int d = 0; d < d_dim.getValue(); ++d) { - if ((box_dims(d) - brk_size(d) > 0) && - (box_dims(d) - brk_size(d) < d_min_size(d))) { - brk_size(d) = box_dims(d); - } - } - brk_load = brk_size.getProduct(); - - if (d_print_break_steps) { - tbox::plog << " brk: " << std::flush; - tbox::plog << " " << brk_size << "->" << brk_load << std::flush; - } - - /* - * stop_growing: whether dimensions of brk_size is already - * big engough so that it cannot not be grown without breaking - * off too much. - */ - hier::IntVector stop_growing(d_dim, 0); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (brk_size[d] == box_dims[d]) stop_growing[d] = 1; - } - - if (brk_load < ideal_load_to_break) { - /* - * The do loop gradually increases brk_size to bring brk_load - * closer to ideal_load_to_break. - * - * Select dimension to increase in size, inc_dim. Use the - * smallest dimension that is still allowed to grow. - * - * Try a new break size that is bigger than the current brk_size - * by the minimal allowed amount. If this brings us closer to - * the ideal break amount, mark it. - * - * Exit the loop when we cannot grow anymore or we are already - * breaking off more than the ideal. - */ - do { - - int inc_dim = -1; - for (int d = 0; d < d_dim.getValue(); ++d) { - if (!stop_growing(d) && - (inc_dim == -1 || brk_size(inc_dim) > brk_size(d))) inc_dim = d; - } - if (inc_dim == -1) break; // No growable dimension. - - TBOX_ASSERT(brk_size(inc_dim) < box_dims(inc_dim)); - - hier::IntVector new_brk_size(brk_size); - new_brk_size(inc_dim) += d_cut_factor(inc_dim); - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "=>" << brk_load << std::flush; - } - - // Prevent remainder being smaller than d_min_size. - if (box_dims(inc_dim) - new_brk_size(inc_dim) < d_min_size(inc_dim)) { - new_brk_size(inc_dim) = box_dims(inc_dim); - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "==>" << brk_load - << std::flush; - } - } - - if (new_brk_size(inc_dim) == box_dims(inc_dim)) { - stop_growing(inc_dim) = 1; - } - - int new_brk_load = new_brk_size.getProduct(); - - if (new_brk_load <= ideal_load_to_break) { - /* - * new_brk_load is closer to ideal than current brk_load. - * Don't break out of the loop yet. We will grow it again - * and check. - */ - brk_size = new_brk_size; - brk_load = new_brk_load; - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "===>" << brk_load - << std::flush; - } - } else if ((new_brk_load - ideal_load_to_break) < - static_cast(ideal_load_to_break - brk_load)) { - /* - * new_brk_load is bigger than ideal but is still an - * improvement over brk_load. Accept it, but break out of - * the loop because further growing will not improve - * result. - */ - brk_size = new_brk_size; - brk_load = new_brk_load; - if (d_print_break_steps) { - tbox::plog << " " << brk_size << "====>" << brk_load - << std::flush; - } - break; - } else { - /* - * Even though dimension inc_dim has not reached the box - * dimension, stop growing it because any further growth - * leads to too big a load. - */ - stop_growing(inc_dim) = 1; - } - - } while (true); - } - - if (d_print_break_steps) { - tbox::plog << std::endl; - } - - /* - * Find a place to put the break-off box so that it does not lie - * across a bad cut. If no such placement is found, set - * placement_impossible to true. - */ - hier::Box breakoff_box(d_dim); - breakoff_box.setBlockId(box.getBlockId()); - const hier::IntVector& lower(box.lower()); - const hier::IntVector& upper(box.upper()); - bool placement_impossible = false; - if (d_print_break_steps) { - tbox::plog << " Placing " << brk_size - << " to avoid bad cut points" << std::flush; - } - for (int d = 0; d < d_dim.getValue(); ++d) { - /* - * To minimize the number of boxes remaining after breakoff_box - * is removed, prefer to place breakoff_box against the upper or - * lower side of the Box. First try putting the breakoff_box - * along the upper side of dimension d. If it cuts the box at a - * bad point, try the lower side. If it still cuts at a bad - * points, slide the box toward the upper side until it does not - * cut at any bad points, being careful not to be so close to - * the box boundaries that we generate remainder boxes violating - * the minimum size. If no place can be found to put - * breakoff_box, set placement_impossible and give up. (We - * could go back and reshape the box at this point, but we won't - * because there is probably another box that would work without - * reshaping.) - */ - const tbox::Array& bad = bad_cuts[d]; - - int& gl = breakoff_box.lower()[d]; - int& gu = breakoff_box.upper()[d]; - - gu = upper[d]; - gl = gu - (brk_size[d] - 1); - if (!bad[gl - lower[d]]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " upper" << std::flush; - } - continue; - } - - gl = lower[d]; - gu = gl + (brk_size[d] - 1); - if (gu + 1 - lower[d] < bad.size() && !bad[gu + 1 - lower[d]]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " lower" << std::flush; - } - continue; - } - - gl = lower[d] + d_min_size[d]; - gu = gl + (brk_size[d] - 1); - while (gu <= upper[d] - d_min_size[d] && - (bad[gl - lower[d]] || bad[gu + 1 - lower[d]])) { - ++gl; - ++gu; - } - if (gu <= upper[d] - d_min_size[d]) { - if (d_print_break_steps) { - tbox::plog << " d=" << d << " middle" << std::flush; - } - continue; - } - - if (d_print_break_steps) { - tbox::plog << " cannot place dim " << d - << " without creating bad cuts." - << std::flush; - } - placement_impossible = true; - /* - * Cannot find place for breakoff_box along dimension d. - * No point in looking at higher dimensions. - */ - break; - } - if (d_print_break_steps) { - tbox::plog << std::endl; - } - if (placement_impossible) { - return false; - } - - breakoff.clear(); - breakoff.push_back(breakoff_box); - - burstBox( - leftover, - box, - breakoff_box ); - -#ifdef DEBUG_CHECK_ASSERTIONS - for (std::vector::iterator bi = breakoff.begin(); - bi != breakoff.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancerOld library error:\n" - << "breakoff box " << b << ", with size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "orig box " << box << "\n" - << "break box " << breakoff_box << "\n" - << "break box size " << brk_size << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } - for (std::vector::iterator bi = leftover.begin(); - bi != leftover.end(); - ++bi) { - const hier::Box& b = *bi; - const hier::IntVector s = b.numberCells(); - for (int d = 0; d < d_dim.getValue(); ++d) { - if (((s(d) < d_min_size(d)) && (s(d) != box_dims(d))) || - (s(d) > box_dims(d))) { - TBOX_ERROR("TreeLoadBalancerOld library error:\n" - << "leftover box " << b << ", with size " << s - << "\nis not between the min size " << d_min_size - << "\nand the original box size " << box_dims << "\n" - << "orig box " << box << "\n" - << "break box " << breakoff_box << "\n" - << "break box size " << brk_size << "\n" - << "ideal brk load " << ideal_load_to_break); - } - } - } -#endif - - return true; -} - - - -/* -************************************************************************** -* Move Boxes in balance_box_level from ranks outside of -* rank_group to ranks inside rank_group. Modify the given connectors -* to make them correct following this moving of boxes. -************************************************************************** -*/ - -void -TreeLoadBalancerOld::prebalanceBoxLevel( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const tbox::RankGroup& rank_group) const -{ - - if (balance_to_anchor.isFinalized()) { - TBOX_ASSERT(anchor_to_balance.checkTransposeCorrectness(balance_to_anchor) == 0); - TBOX_ASSERT(balance_to_anchor.checkTransposeCorrectness(anchor_to_balance) == 0); - } - - /* - * tmp_box_level will contain the same boxes as - * balance_box_level, but all will live on the processors - * specified in rank_group. - */ - hier::BoxLevel tmp_box_level(d_dim); - tmp_box_level.initialize( - balance_box_level.getRefinementRatio(), - balance_box_level.getGridGeometry(), - balance_box_level.getMPI()); - - /* - * If a rank is not in rank_group it is called a "sending" rank, as - * it will send any Boxes it has to a rank in rank_group. - */ - bool is_sending_rank = rank_group.isMember(d_mpi.getRank()) ? false : true; - - int output_nproc = rank_group.size(); - - /* - * the send and receive comm objects - */ - tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer* box_send = NULL; - tbox::AsyncCommPeer* box_recv = NULL; - tbox::AsyncCommPeer* id_send = NULL; - tbox::AsyncCommPeer* id_recv = NULL; - - /* - * A sending rank will send its Boxes to a receiving rank, and - * that receiving processor will add it to its local set of Boxes. - * When the box is added on the receiving processor, it will receive - * a new LocalId. This LocalId value needs to be sent back to - * the sending processor, in order to construct the mapping connectors. - * - * Therefore the sending ranks construct comm objects for sending boxes - * and receiving LocalIdes. - * - * Sending processors send to ranks in the rank_group determined by - * a modulo heuristic. - */ - if (is_sending_rank) { - box_send = new tbox::AsyncCommPeer; - box_send->initialize(&comm_stage); - box_send->setPeerRank(rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - box_send->setMPI(d_mpi); - box_send->setMPITag(TreeLoadBalancerOld_PREBALANCE0 + 2 * d_mpi.getRank(), - TreeLoadBalancerOld_PREBALANCE1 + 2 * d_mpi.getRank()); - - id_recv = new tbox::AsyncCommPeer; - id_recv->initialize(&comm_stage); - id_recv->setPeerRank(rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - id_recv->setMPI(d_mpi); - id_recv->setMPITag(TreeLoadBalancerOld_PREBALANCE0 + 2 * d_mpi.getRank(), - TreeLoadBalancerOld_PREBALANCE1 + 2 * d_mpi.getRank()); - } - - /* - * The receiving ranks construct comm objects for receiving boxes - * and sending LocalIdes. - */ - int num_recvs = 0; - if (rank_group.isMember(d_mpi.getRank())) { - std::list recv_ranks; - for (int i = 0; i < d_mpi.getSize(); i++) { - if (!rank_group.isMember(i) && - rank_group.getMappedRank(i % output_nproc) == d_mpi.getRank()) { - recv_ranks.push_back(i); - } - } - num_recvs = static_cast(recv_ranks.size()); - if (num_recvs > 0) { - box_recv = new tbox::AsyncCommPeer[num_recvs]; - id_send = new tbox::AsyncCommPeer[num_recvs]; - int recv_count = 0; - for (std::list::const_iterator ri(recv_ranks.begin()); - ri != recv_ranks.end(); ri++) { - const int rank = *ri; - box_recv[recv_count].initialize(&comm_stage); - box_recv[recv_count].setPeerRank(rank); - box_recv[recv_count].setMPI(d_mpi); - box_recv[recv_count].setMPITag(TreeLoadBalancerOld_PREBALANCE0 + 2 * rank, - TreeLoadBalancerOld_PREBALANCE1 + 2 * rank); - - id_send[recv_count].initialize(&comm_stage); - id_send[recv_count].setPeerRank(rank); - id_send[recv_count].setMPI(d_mpi); - id_send[recv_count].setMPITag(TreeLoadBalancerOld_PREBALANCE0 + 2 * rank, - TreeLoadBalancerOld_PREBALANCE1 + 2 * rank); - - recv_count++; - } - TBOX_ASSERT(num_recvs == recv_count); - } - } - - /* - * Construct the mapping Connectors which describe the mapping from the box - * configuration of the given balance_box_level, to the new - * configuration stored in tmp_box_level. These mapping Connectors - * are necessary to modify the two Connectors given in the argument list, - * so that on return from this method, they will be correct for the new - * balance_box_level. - */ - hier::Connector balance_to_tmp(balance_box_level, - tmp_box_level, - hier::IntVector::getZero(d_dim)); - - hier::Connector tmp_to_balance(tmp_box_level, - balance_box_level, - hier::IntVector::getZero(d_dim)); - - /* - * Where Boxes already exist on ranks in rank_group, - * move them directly to tmp_box_level. - */ - if (!is_sending_rank) { - const hier::BoxContainer& unchanged_boxes = - balance_box_level.getBoxes(); - - for (hier::BoxContainer::const_iterator ni = - unchanged_boxes.begin(); - ni != unchanged_boxes.end(); ++ni) { - - const hier::Box& box = *ni; - tmp_box_level.addBox(box); - } - } - - const int buf_size = hier::Box::commBufferSize(d_dim); - - /* - * On sending ranks, pack the Boxes into buffers and send. - */ - if (is_sending_rank) { - const hier::BoxContainer& sending_boxes = - balance_box_level.getBoxes(); - const int num_sending_boxes = - static_cast(sending_boxes.size()); - - int* buffer = new int[buf_size * num_sending_boxes]; - int box_count = 0; - for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); - ni != sending_boxes.end(); ++ni) { - - const hier::Box& box = *ni; - - box.putToIntBuffer(&buffer[box_count * buf_size]); - box_count++; - } - box_send->beginSend(buffer, buf_size * num_sending_boxes); - - delete[] buffer; - } - - /* - * On receiving ranks, complete the receives, add the boxes to local - * tmp_box_level, insert boxes into tmp_to_balance, and then - * send the new LocalIdes back to the sending processors. - */ - if (!is_sending_rank && num_recvs > 0) { - for (int i = 0; i < num_recvs; i++) { - box_recv[i].beginRecv(); - } - int num_completed_recvs = 0; - tbox::Array completed(num_recvs, false); - while (num_completed_recvs < num_recvs) { - for (int i = 0; i < num_recvs; i++) { - if (!completed[i] && box_recv[i].checkRecv()) { - num_completed_recvs++; - completed[i] = true; - const int num_boxes = box_recv[i].getRecvSize() / buf_size; - const int* buffer = box_recv[i].getRecvData(); - int* id_buffer = new int[num_boxes]; - - for (int b = 0; b < num_boxes; b++) { - hier::Box box(d_dim); - - box.getFromIntBuffer(&buffer[b * buf_size]); - - hier::BoxContainer::const_iterator tmp_iter = - tmp_box_level.addBox(box, - box.getBlockId()); - - hier::BoxId tmp_box_id = tmp_iter->getId(); - - tmp_to_balance.insertLocalNeighbor(box, tmp_box_id); - - id_buffer[b] = tmp_box_id.getLocalId().getValue(); - } - id_send[i].beginSend(id_buffer, num_boxes); - - delete[] id_buffer; - } - } - } - for (int i = 0; i < num_recvs; i++) { - if (!id_send[i].checkSend()) { - id_send[i].completeCurrentOperation(); - } - } - } - - /* - * On sending ranks, receive the LocalIds, and add the edges - * to balance_to_tmp. - */ - if (is_sending_rank) { - if (!box_send->checkSend()) { - box_send->completeCurrentOperation(); - } - - id_recv->beginRecv(); - - if (!id_recv->checkRecv()) { - id_recv->completeCurrentOperation(); - } - const int* buffer = id_recv->getRecvData(); - - const hier::BoxContainer& sending_boxes = - balance_box_level.getBoxes(); - TBOX_ASSERT(static_cast(id_recv->getRecvSize()) == sending_boxes.size()); - - int box_count = 0; - for (hier::BoxContainer::const_iterator ni = sending_boxes.begin(); - ni != sending_boxes.end(); ++ni) { - - hier::Box new_box( - *ni, - (hier::LocalId)buffer[box_count], - rank_group.getMappedRank(d_mpi.getRank() % output_nproc)); - - balance_to_tmp.insertLocalNeighbor(new_box, (*ni).getId()); - box_count++; - } - } - balance_to_tmp.setConnectorType(hier::Connector::MAPPING); - tmp_to_balance.setConnectorType(hier::Connector::MAPPING); - - if (anchor_to_balance.isFinalized()) { - /* - * This modify operation copies tmp_box_level to - * balance_box_level, and changes anchor_to_balance and - * balance_to_anchor such that they are correct for the new state - * of balance_box_level. - */ - const hier::MappingConnectorAlgorithm mca; - mca.modify(anchor_to_balance, - balance_to_anchor, - balance_to_tmp, - tmp_to_balance, - &balance_box_level, - &tmp_box_level); - - TBOX_ASSERT(anchor_to_balance.checkTransposeCorrectness(balance_to_anchor) == 0); - TBOX_ASSERT(balance_to_anchor.checkTransposeCorrectness(anchor_to_balance) == 0); - } else { - hier::BoxLevel::swap(balance_box_level, tmp_box_level); - } - - /* - * Clean up raw pointer allocation. - */ - if (is_sending_rank) { - delete box_send; - delete id_recv; - } - if (num_recvs) { - delete[] box_recv; - delete[] id_send; - } -} - - - -/* -************************************************************************** -************************************************************************** -*/ - -std::ostream& -operator << ( - std::ostream& co, - const TreeLoadBalancerOld::BoxInTransit& r) -{ - co << r.d_box - << r.d_box.numberCells() << '|' - << r.d_box.numberCells().getProduct(); - for (int i = static_cast(r.d_proc_hist.size()) - 1; i >= 0; --i) { - co << '-' << r.d_proc_hist[i]; - } - co << '-' << r.d_orig_box - << r.d_box.numberCells() << '|' - << r.d_box.numberCells().getProduct(); - return co; -} - - - -/* - *********************************************************************** - *********************************************************************** - */ -void -TreeLoadBalancerOld::setTimers() -{ - /* - * The first constructor gets timers from the TimerManager. - * and sets up their deallocation. - */ - if (!t_load_balance_box_level) { - t_load_balance_box_level = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::loadBalanceBoxLevel()"); - t_get_map = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_map"); - t_use_map = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::use_map"); - t_constrain_size = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constrain_size"); - t_map_big_boxes = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::mapOversizedBoxes()"); - t_load_distribution = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::load_distribution"); - t_compute_local_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_local_load"); - t_compute_global_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_global_load"); - t_compute_tree_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::compute_tree_load"); - - const int max_cycles_to_time = 4; - t_compute_tree_load_for_cycle.resize( - max_cycles_to_time, - boost::shared_ptr() ); - for ( int i=0; i - getTimer(d_object_name + "::compute_tree_load_for_cycle[" - + tbox::Utilities::intToString(i) + "]"); - } - - t_break_off_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::breakOffLoad()"); - t_find_bad_cuts = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::find_bad_cuts"); - t_reassign_loads = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::reassignLoads()"); - t_shift_loads_by_swapping = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::shiftLoadsBySwapping()"); - t_shift_loads_by_breaking = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::shiftLoadsByBreaking()"); - t_find_swap_pair = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::swapLoadPair()"); - t_send_load_to_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_load_to_children"); - t_send_load_to_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_load_to_parent"); - t_get_load_from_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_load_from_children"); - t_get_load_from_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_load_from_parent"); - t_construct_semilocal = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constructSemilocalUnbalancedToBalanced()"); - t_construct_semilocal_comm_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::constructSemilocalUnbalancedToBalanced()_comm_wait"); - t_send_edge_to_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_edge_to_children"); - t_send_edge_to_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::send_edge_to_parent"); - t_get_edge_from_children = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_edge_from_children"); - t_get_edge_from_parent = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::get_edge_from_parent"); - t_report_loads = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::report_loads"); - t_finish_sends = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::finish_sends"); - t_local_balancing = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::local_balancing"); - t_pack_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::pack_load"); - t_unpack_load = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::unpack_load"); - t_unpack_edge = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::unpack_edge"); - t_parent_load_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_load_comm"); - t_children_load_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::children_load_comm"); - t_parent_edge_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_edge_comm"); - t_children_edge_comm = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::children_edge_comm"); - t_barrier_before = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::barrier_before"); - t_barrier_after = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::barrier_after"); - t_child_send_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::child_send_wait"); - t_child_recv_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::child_recv_wait"); - t_parent_send_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_send_wait"); - t_parent_recv_wait = tbox::TimerManager::getManager()-> - getTimer(d_object_name + "::parent_recv_wait"); - } -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -TreeLoadBalancerOld::BoxInTransit::BoxInTransit( - const tbox::Dimension &dim) : - d_box(dim), - d_orig_box(dim) -{ -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -TreeLoadBalancerOld::BoxInTransit::BoxInTransit( - const hier::Box& origin): - d_box(origin), - d_orig_box(origin), - d_load(origin.size()), - d_proc_hist() -{ -} - - - -/* - ************************************************************************* - ************************************************************************* - */ -TreeLoadBalancerOld::BoxInTransit::BoxInTransit( - const int *&ptr, - const tbox::Dimension &dim ): - d_box(dim), - d_orig_box(dim), - d_load(0), - d_proc_hist(0) -{ - getFromIntBuffer(ptr); - ptr += commBufferSize(); -} - - - -/* - ************************************************************************* - * Construct a new BoxInTransit with the history of an existing box. - ************************************************************************* - */ -TreeLoadBalancerOld::BoxInTransit::BoxInTransit( - const BoxInTransit& other, - const hier::Box& box, - int rank, - hier::LocalId local_id): - d_box(box, local_id, rank), - d_orig_box(other.d_orig_box), - d_load(d_box.size()), - d_proc_hist(other.d_proc_hist) -{ - if (rank != other.getOwnerRank()) { - d_proc_hist.push_back(other.getOwnerRank()); - } -} - -int* -TreeLoadBalancerOld::BoxInTransit::putToIntBuffer( - int* buffer, - bool skip_last_owner) const -{ - const int box_comm_buf_size = hier::Box::commBufferSize(d_box.getDim()); - d_box.putToIntBuffer(buffer); - buffer += box_comm_buf_size; - d_orig_box.putToIntBuffer(buffer); - buffer += box_comm_buf_size; - *(buffer++) = d_load; - if (skip_last_owner) { - TBOX_ASSERT( !d_proc_hist.empty() ); - } - *(buffer++) = static_cast(d_proc_hist.size()-skip_last_owner); - for (unsigned int i = 0; i < d_proc_hist.size()-skip_last_owner; ++i) { - *(buffer++) = d_proc_hist[i]; - } - return buffer; -} - -const int* -TreeLoadBalancerOld::BoxInTransit::getFromIntBuffer( - const int* buffer) -{ - const int box_comm_buf_size = hier::Box::commBufferSize(d_box.getDim()); - d_box.getFromIntBuffer(buffer); - buffer += box_comm_buf_size; - d_orig_box.getFromIntBuffer(buffer); - buffer += box_comm_buf_size; - d_load = *(buffer++); - d_proc_hist.clear(); - d_proc_hist.insert(d_proc_hist.end(), *(buffer++), 0); - for (unsigned int i = 0; i < d_proc_hist.size(); ++i) { - d_proc_hist[i] = *(buffer++); - } - return buffer; -} - -void -TreeLoadBalancerOld::BoxInTransit::packForPreviousOwner( - std::map > &outgoing_messages ) const -{ - const int prev_owner = d_proc_hist.back(); - std::vector &msg(outgoing_messages[prev_owner]); - const int cbs1 = commBufferSize()-1; - msg.insert(msg.end(), cbs1, 0); - putToIntBuffer(&msg[msg.size() - cbs1], true); -} - -TreeLoadBalancerOld::SubtreeLoadData::SubtreeLoadData(): - d_num_procs(0), - d_total_work(0), - d_load_exported(0), - d_load_imported(0) -{ -} - -} -} - -#if !defined(__BGL_FAMILY__) && defined(__xlC__) -/* - * Suppress XLC warnings - */ -#pragma report(enable, CPPC5334) -#pragma report(enable, CPPC5328) -#endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.h deleted file mode 100644 index 294b1d2e..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/TreeLoadBalancerOld.h +++ /dev/null @@ -1,1106 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Scalable load balancer using tree algorithm. - * - ************************************************************************/ - -#ifndef included_mesh_TreeLoadBalancerOld -#define included_mesh_TreeLoadBalancerOld - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/mesh/BalanceUtilities.h" -#include "SAMRAI/mesh/LoadBalanceStrategy.h" -#include "SAMRAI/tbox/AsyncCommPeer.h" -#include "SAMRAI/tbox/AsyncCommStage.h" -#include "SAMRAI/tbox/BalancedDepthFirstTree.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/RankGroup.h" -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" -#include "SAMRAI/tbox/Timer.h" -#include "SAMRAI/tbox/Utilities.h" - -#include -#include -#include -#include - -namespace SAMRAI { -namespace mesh { - - - - - -/*! - * @brief Provides load balancing routines for AMR hierarchy by - * implemementing the LoadBalancerStrategy. - * - * This class implements a tree-based load balancer. The MPI - * processes are arranged in a tree. Work load is transmitted from - * process to process along the edges of the tree. - * - * Currently, only uniform load balancing is supported. Eventually, - * non-uniform load balancing should be supported. (Non-uniform load - * balancing is supported by the CutAndPackLoadBalancer class.) - * - * Inputs and their default values: - * - * No special inputs are required for this class. - * - * @verbatim - * report_load_balance = TRUE // Write out load balance report in log - * n_root_cycles = -1 // Number of steps over which to smoothly spread - * // out work load. This helps scalability when - * // initial work load is grossly unbalanced. - * // Usually 1 step is sufficient. - * // Can be set higher (2 or 3) to reduce negative - * // performance effects of extremely poor initial - * // load balance. Set to -1 (default) to compute - * // the number of cycles by a simple heuristic. - * // Set to zero to effectively bypass load balancing. - * @endverbatim - * - * @see mesh::LoadBalanceStrategy - */ - -class TreeLoadBalancerOld: - public LoadBalanceStrategy -{ -public: - /*! - * @brief Initializing constructor sets object state to default or, - * if database provided, to parameters in database. - * - * @param[in] dim - * - * @param[in] name User-defined std::string identifier used for error - * reporting and timer names. If omitted, "TreeLoadBalancerOld" - * is used. - * - * @param[in] input_db (optional) database pointer providing - * parameters from input file. This pointer may be null indicating - * no input is used. - */ - TreeLoadBalancerOld( - const tbox::Dimension& dim, - const std::string& name = std::string("TreeLoadBalancerOld"), - const boost::shared_ptr& input_db = - boost::shared_ptr()); - - /*! - * @brief Virtual destructor releases all internal storage. - */ - virtual ~TreeLoadBalancerOld(); - - /*! - * @brief Set the internal SAMRAI_MPI to a duplicate of the given - * SAMRAI_MPI. - * - * The given SAMRAI_MPI must have a valid communicator. - * - * The given SAMRAI_MPI is duplicated for private use. This - * requires a global communication, so all processes in the - * communicator must call it. The advantage of a duplicate - * communicator is that it ensures the communications for the - * object won't accidentally interact with other communications. - * - * If the duplicate SAMRAI_MPI it is set, the TreeLoadBalancerOld will - * only balance BoxLevels with congruent SAMRAI_MPI objects and - * will use the duplicate SAMRAI_MPI for communications. - * Otherwise, the SAMRAI_MPI of the BoxLevel will be used. The - * duplicate MPI communicator is freed when the object is - * destructed, or freeMPICommunicator() is called. - */ - void - setSAMRAI_MPI( - const tbox::SAMRAI_MPI& samrai_mpi); - - /*! - * @brief Free the internal MPI communicator, if any has been set. - * - * This is automatically done by the destructor, if needed. - * - * @see setSAMRAI_MPI(). - */ - void - freeMPICommunicator(); - - /*! - * @brief Configure the load balancer to use the data stored - * in the hierarchy at the specified descriptor index - * for estimating the workload on each cell. - * - * Note: This method currently does not affect the results because - * this class does not yet support uniform load balancing. - * - * @param data_id - * Integer value of patch data identifier for workload - * estimate on each cell. An invalid value (i.e., < 0) - * indicates that a spatially-uniform work estimate - * will be used. The default value is -1 (undefined) - * implying the uniform work estimate. - * - * @param level_number - * Optional integer number for level on which data id - * is used. If no value is given, the data will be - * used for all levels. - */ - void - setWorkloadPatchDataIndex( - int data_id, - int level_number = -1); - - /*! - * @brief Configure the load balancer to load balance boxes by - * assuming all cells on the specified level or all hierarchy - * levels are weighted equally. - * - * @param level_number - * Optional integer number for level on which uniform - * workload estimate will be used. If the level - * number is not specified, a uniform workload - * estimate will be used on all levels. - */ - void - setUniformWorkload( - int level_number = -1) - { - d_workload_data_id[level_number] = -1; - } - - /*! - * @brief Return true if load balancing procedure for given level - * depends on patch data on mesh; otherwise return false. - * - * @param[in] level_number Integer patch level number. - */ - bool - getLoadBalanceDependsOnPatchData( - int level_number) const; - - /*! - * @copydoc LoadBalanceStrategy::loadBalanceBoxLevel() - * - * Note: This implementation does not yet support non-uniform load - * balancing. - */ - void - loadBalanceBoxLevel( - hier::BoxLevel& balance_mapped_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const boost::shared_ptr& hierarchy, - const int level_number, - const hier::Connector& unbalanced_to_attractor, - const hier::Connector& attractor_to_unbalanced, - const hier::IntVector& min_size, - const hier::IntVector& max_size, - const hier::BoxLevel& domain_mapped_box_level, - const hier::IntVector& bad_interval, - const hier::IntVector& cut_factor, - const tbox::RankGroup& rank_group = tbox::RankGroup()) const; - - /*! - * @brief Print out all members of the class instance to given - * output stream. - * - * @param[in] output_stream - */ - virtual void - printClassData( - std::ostream& output_stream) const; - - /*! - * @brief Write out statistics recorded for the most recent load - * balancing result. - * - * @param[in] output_stream - */ - void - printStatistics( - std::ostream& output_stream = tbox::plog) const - { - BalanceUtilities::gatherAndReportLoadBalance(d_load_stat, - tbox::SAMRAI_MPI::getSAMRAIWorld(), - output_stream); - } - - - -private: - - /*! - * @brief Data to save for each Box that gets passed along the tree - * edges. - * - * The purpose of the BoxInTransit is to associate extra data with - * a Box as it is broken up and passed from process to process. A - * BoxInTransit is a Box going through these changes. It has a - * current work load, an orginating Box and a history of the - * processes it passed through. - */ - struct BoxInTransit { - - /*! - * @brief Constructor - * - * @param[in] dim - */ - BoxInTransit(const tbox::Dimension& dim); - - /*! - * @brief Construct a new BoxInTransit from an originating box. - * - * @param[in] other - */ - BoxInTransit(const hier::Box& origin); - - /*! - * @brief Construct new object using integer data packed by - * putToIntBuffer(). - * - * @param[i/o] ptr Pointer to integer data in buffer. On return, - * @c ptr will be advanced past the data used by this object. - * - * @param[i] dim - */ - BoxInTransit( - const int *&ptr, - const tbox::Dimension &dim ); - - /*! - * @brief Construct new object having the history an existing - * object but is otherwise different. - * - * @param[in] other - * - * @param[in] box - * - * @param[in] rank - * - * @param[in] local_id - */ - BoxInTransit( - const BoxInTransit& other, - const hier::Box& box, - int rank, - hier::LocalId local_id); - - /*! - * @brief Assignment operator - * - * @param[in] other - */ - const BoxInTransit& - operator = (const BoxInTransit& other) - { - d_box = other.d_box; - d_orig_box = other.d_orig_box; - d_load = other.d_load; - d_proc_hist = other.d_proc_hist; - return *this; - } - - //! @brief Return the owner rank. - int - getOwnerRank() const - { - return d_box.getOwnerRank(); - } - - //! @brief Return the LocalId. - hier::LocalId - getLocalId() const - { - return d_box.getLocalId(); - } - - //! @brief Return the Box. - hier::Box& - getBox() - { - return d_box; - } - - //! @brief Return the Box. - const hier::Box& - getBox() const - { - return d_box; - } - - /*! - * @brief Return number of ints required for putting a putting the - * object in message passing buffer. - */ - int - commBufferSize() const - { - return 2 * hier::Box::commBufferSize(d_box.getDim()) + 2 + - static_cast(d_proc_hist.size()); - } - - /*! - * @brief Put self into a int buffer. - * - * This is the opposite of getFromIntBuffer(). Number of ints - * written is given by commBufferSize(), except when - * skip_last_owner is true. If skip_last_owner is true, and the - * last owner in proc_hist will be skipped (proc_hist must be - * non-empty) and the number of integers put in the buffer would be - * commBufferSize()-1. - * - * @return The next unwritten position in the buffer. - */ - int* - putToIntBuffer( - int* buffer, - bool skip_last_owner=false) const; - - /*! - * @brief Set attributes according to data in int buffer. - * - * This is the opposite of putToIntBuffer(). Number of ints read - * is given by what commBufferSize() AFTER this method is called. - * - * @return The next unread position in the buffer. - */ - const int* - getFromIntBuffer( - const int* buffer); - - /*! - * @brief Stuff into an outgoing message destined for the previous - * owner. - * - * prev_owner must not be empty. - * - * @param outgoing_messages Map of outgoing messages, indexed by - * recipient rank. On return, the message corresponding to the - * previous owner will be grown by commBufferSize()-1. - */ - void - packForPreviousOwner( - std::map > &outgoing_messages ) const; - - //! @brief The Box. - hier::Box d_box; - - //! @brief Originating Box. - hier::Box d_orig_box; - - //! @brief Work load. - int d_load; - - /*! - * @brief History of processors passed in transit. Each time a - * process receives a Box, it should append its rank to the - * proc_hist. - */ - std::vector d_proc_hist; - }; - - - /*! - * @brief Insert BoxInTransit into an output stream. - */ - friend std::ostream& - operator << ( - std::ostream& co, - const BoxInTransit& r); - - - /*! - * @brief Comparison functor for sorting BoxInTransit from more to - * less loads. - */ - struct BoxInTransitMoreLoad { - /* - * @brief Compares two BoxInTransit for sorting them from more load - * to less load. - */ - bool - operator () ( - const BoxInTransit& a, - const BoxInTransit& b) const - { - if (a.getBox().size() != b.getBox().size()) { - return a.d_load > b.d_load; - } - return a.d_box.getId() < b.d_box.getId(); - } - }; - - - - /* - * Static integer constants. Tags are for isolating messages - * from different phases of the algorithm. - */ - static const int TreeLoadBalancerOld_LOADTAG0 = 1212001; - static const int TreeLoadBalancerOld_LOADTAG1 = 1212002; - static const int TreeLoadBalancerOld_EDGETAG0 = 1212003; - static const int TreeLoadBalancerOld_EDGETAG1 = 1212004; - static const int TreeLoadBalancerOld_PREBALANCE0 = 1212005; - static const int TreeLoadBalancerOld_PREBALANCE1 = 1212006; - static const int TreeLoadBalancerOld_FIRSTDATALEN = 1000; - - static const int TreeLoadBalancerOld_MIN_NPROC_FOR_AUTOMATIC_MULTICYCLE = 65; - - // The following are not implemented, but are provided here for - // dumb compilers. - - TreeLoadBalancerOld( - const TreeLoadBalancerOld&); - - void - operator = ( - const TreeLoadBalancerOld&); - - /*! - * @brief A set of BoxInTransit, sorted from highest load to lowest load. - */ - typedef std::set TransitSet; - - - /*! - * @brief Data to save for each sending/receiving process and the - * subtree at that process. - */ - struct SubtreeLoadData { - // @brief Constructor. - SubtreeLoadData(); - - /*! - * @brief Number of processes in subtree - */ - int d_num_procs; - - /*! - * @brief Current total work amount in the subtree - */ - int d_total_work; - - /*! - * @brief Load exported (or to be exported) to nonlocal process. - * - * If the object is for the local process, load_exported means - * the load exported to the process's *parent*. - */ - int d_load_exported; - - /*! - * @brief Load imported from nonlocal process. - * - * If the object is for the local process, load_imported means - * the load imported from the process's *parent*. - */ - int d_load_imported; - - /*! - * @brief Ideal work amount for the subtree - */ - int d_ideal_work; - - /*! - * @brief Work to export. - * - * If the object is for the local process, for_export means for - * exporting to the process's *parent*. - */ - TransitSet d_for_export; - }; - - /* - * @brief Check if there is any pending messages for the private - * communication and throw an error if there is. - */ - void - assertNoMessageForPrivateCommunicator() const; - - /* - * Read parameters from input database. - */ - void - getFromInput( - const boost::shared_ptr& db); - - /*! - * Move Boxes in balance_box_level from ranks outside of - * rank_group to ranks inside rank_group. Modify the given connectors - * to make them correct following this moving of boxes. - */ - void - prebalanceBoxLevel( - hier::BoxLevel& balance_box_level, - hier::Connector& balance_to_anchor, - hier::Connector& anchor_to_balance, - const tbox::RankGroup& rank_group) const; - - /*! - * @brief Reassign loads from one TransitSet to another. - * - * @param[i] ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @param[io] next_available_index Index for guaranteeing new - * Boxes are uniquely numbered. - * - * @return Amount of load transfered. If positive, work went from - * src to dst (if negative, from dst to src). - * - */ - int - reassignLoads( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - int ideal_transfer ) const; - - /*! - * @brief Shift load from src to dst by swapping BoxInTransit - * between them. - * - * @param[io] src Source of work, for a positive ideal_transfer. - * - * @param[io] dst Destination of work, for a positive ideal_transfer. - * - * @param[i] ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @return Amount of load transfered. If positive, load went - * from src to dst (if negative, from dst to src). - */ - int - shiftLoadsBySwapping( - TransitSet& src, - TransitSet& dst, - int ideal_transfer ) const; - - /*! - * @brief Shift load from src to dst by various box breaking strategies. - * choosing the break that gives the best overall penalty. - * - * @param[io] src Source of work, for a positive ideal_transfer. - * - * @param[io] dst Destination of work, for a positive ideal_transfer. - * - * @param next_available_index Index for guaranteeing new - * Boxes are uniquely numbered. - * - * @param ideal_transfer Amount of load to reassign from src to - * dst. If negative, reassign the load from dst to src. - * - * @return Amount of load transfered. If positive, load went - * from src to dst (if negative, from dst to src). - */ - int - shiftLoadsByBreaking( - TransitSet& src, - TransitSet& dst, - hier::LocalId& next_available_index, - int ideal_transfer ) const; - - /*! - * @brief Find a BoxInTransit in each of the source and destination - * containers that, when swapped, effects a transfer of the given - * amount of work from the source to the destination. Swap the boxes. - */ - bool - swapLoadPair( - TransitSet& src, - TransitSet& dst, - int& actual_transfer, - int ideal_transfer ) const; - - /*! - * @brief Pack load/boxes for sending. - */ - void - packSubtreeLoadData( - std::vector& msg, - const SubtreeLoadData& load_data) const; - - /*! - * @brief Unpack load/boxes received. - */ - void - unpackSubtreeLoadData( - SubtreeLoadData& proc_data, - TransitSet& receiving_bin, - hier::LocalId& next_available_index, - const int* received_data, - int received_data_length ) const; - - /*! - * @brief Unpack and route neighborhood sets in - * unbalanced--->balanced Connector. - * - * Neighborhood sets for local boxes are directly stored in the - * Connector. Other neighborhood sets are packed into an outgoing - * message depending according to where they should be rerouted - * to get to their eventual owners. - */ - void - unpackAndRouteNeighborhoodSets( - std::map > &outgoing_messages, - hier::Connector& unbalanced_to_balanced, - const int* received_data, - int received_data_length ) const; - - /*! - * @brief Construct semilocal relationships in - * unbalanced--->balanced Connector. - * - * Constructing semilocal unbalanced--->balanced relationships - * require communication to determine where exported work ended up. - * This methods does the necessary communication and constructs - * these relationship in the given Connector. - * - * @param [o] unbalanced_to_balanced Connector to store - * relationships in. - * - * @param [i] exported_to Ranks of processes that the local process - * exported work to. - * - * @param [i] imported_from Ranks of processes that the local - * process imported work from. - * - * @param [i] kept_imports Work that was imported and locally kept. - */ - void constructSemilocalUnbalancedToBalanced( - hier::Connector &unbalanced_to_balanced, - const std::vector &exported_to, - const std::vector &imported_from, - const TreeLoadBalancerOld::TransitSet &kept_imports ) const; - - /*! - * @brief Break off a given load size from a given Box. - * - * @param[i] box Box to break. - * - * @param[i] ideal_load_to_break Ideal load to break. - * - * @param[o] breakoff Boxes broken off (usually just one). - * - * @param[o] leftover Remainder of Box after breakoff is gone. - * - * @param[o] brk_load The load broken off. - */ - bool - breakOffLoad( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break ) const; - - /*! - * @brief Computes surface area of a list of boxes. - */ - double - computeBoxSurfaceArea( - const std::vector& boxes) const; - - /*! - * @brief Computes the surface area of a box. - */ - int - computeBoxSurfaceArea( - const hier::Box& box) const; - - double - combinedBreakingPenalty( - double balance_penalty, - double surface_penalty, - double slender_penalty) const - { - double combined_penalty = - d_balance_penalty_wt * balance_penalty * balance_penalty - + d_surface_penalty_wt * surface_penalty * surface_penalty - + d_slender_penalty_wt * slender_penalty * slender_penalty; - return combined_penalty; - } - - double - computeBalancePenalty( - const std::vector& a, - const std::vector& b, - double imbalance) const - { - NULL_USE(a); - NULL_USE(b); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeBalancePenalty( - const TransitSet& a, - const TransitSet& b, - double imbalance) const - { - NULL_USE(a); - NULL_USE(b); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeBalancePenalty( - const hier::Box& a, - double imbalance) const - { - NULL_USE(a); - return tbox::MathUtilities::Abs(imbalance); - } - - double - computeSurfacePenalty( - const std::vector& a, - const std::vector& b) const; - - double - computeSurfacePenalty( - const TransitSet& a, - const TransitSet& b) const; - - double - computeSurfacePenalty( - const hier::Box& a) const; - - double - computeSlenderPenalty( - const std::vector& a, - const std::vector& b) const; - - double - computeSlenderPenalty( - const TransitSet& a, - const TransitSet& b) const; - - double - computeSlenderPenalty( - const hier::Box& a) const; - - bool - breakOffLoad_planar( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_break, - const tbox::Array >& bad_cuts ) const; - - bool - breakOffLoad_cubic( - std::vector& breakoff, - std::vector& leftover, - double& brk_load, - const hier::Box& box, - double ideal_load_to_give, - const tbox::Array >& bad_cuts ) const; - - void - burstBox( - std::vector& boxes, - const hier::Box& bursty, - const hier::Box& solid ) const; - - /* - * Utility functions to determine parameter values for level. - */ - int - getWorkloadDataId( - int level_number) const - { - TBOX_ASSERT(level_number >= 0); - return (level_number < d_workload_data_id.getSize() ? - d_workload_data_id[level_number] : - d_master_workload_data_id); - } - - /*! - * @brief Compute the load for a Box. - */ - double - computeLoad( - const hier::Box& box) const - { - /* - * Currently only for uniform loads, where the load is equal - * to the number of cells. For non-uniform loads, this method - * needs the patch data index for the load. It would summ up - * the individual cell loads in the cell. - */ - return double(box.size()); - } - - /*! - * @brief Compute the load for the Box, restricted to where it - * intersects a given box. - */ - double - computeLoad( - const hier::Box& box, - const hier::Box& restriction) const - { - /* - * Currently only for uniform loads, where the load is equal - * to the number of cells. For non-uniform loads, this method - * needs the patch data index for the load. It would summ up - * the individual cell loads in the overlap region. - */ - return double((box * restriction).size()); - } - - /* - * Count the local workload. - */ - double - computeLocalLoads( - const hier::BoxLevel& box_level) const; - - /*! - * @brief Given an "unbalanced" BoxLevel, compute the BoxLevel that - * is load-balanced within the given rank_group and compute the - * mapping between the unbalanced and balanced BoxLevels. - */ - void - loadBalanceWithinRankGroup( - hier::BoxLevel& balance_box_level, - hier::Connector &balance_to_anchor, - hier::Connector &anchor_to_balance, - const tbox::RankGroup& rank_group, - const double group_sum_load ) const; - - /*! - * @brief Constrain maximum box sizes in the given BoxLevel and - * update given Connectors to the changed BoxLevel. - */ - void - constrainMaxBoxSizes( - hier::BoxLevel& box_level, - hier::Connector &anchor_to_level, - hier::Connector &level_to_anchor ) const; - - /*! - * @brief Create the cycle-based RankGroups the local process - * belongs in. - * - * The RankGroup size increases exponentially with the cycle - * number such that for the last cycle the rank group includes - * all processes in d_mpi. - * - * @param [o] rank_group - * @param [o] num_groups - * @param [o] group_num - * @param [i] cycle_number - * @param [i] number_of_cycles - */ - void - createBalanceRankGroupBasedOnCycles( - tbox::RankGroup &rank_group, - int &num_groups, - int &group_num, - const int cycle_number, - const int number_of_cycles) const; - - /*! - * @brief Set up the asynchronous communication objects for the - * given RankGroup. - * - * Based on a conceptual process tree with num_children children, - * set the AsyncCommPeer objects for communication with children - * and parent. - * - * @param [o] child_stage - * @param [o] child_comms - * @param [o] parent_stage - * @param [o] parent_comm - * @param [i] rank_group - * @param [i] bdfs - */ - void - setupAsyncCommObjects( - tbox::AsyncCommStage& child_stage, - tbox::AsyncCommPeer *& child_comms, - tbox::AsyncCommStage& parent_stage, - tbox::AsyncCommPeer *& parent_comm, - const tbox::RankGroup &rank_group, - const tbox::BalancedDepthFirstTree &bdfs ) const; - - /* - * @brief Undo the set-up done by setupAsyncCommObjects. - */ - void - destroyAsyncCommObjects( - tbox::AsyncCommPeer *& child_comms, - tbox::AsyncCommPeer *& parent_comm) const; - - /*! - * @brief Set up timers for the object. - */ - void - setTimers(); - - /* - * Object dimension. - */ - const tbox::Dimension d_dim; - - /* - * String identifier for load balancer object. - */ - std::string d_object_name; - - //! @brief Duplicated communicator object. See setSAMRAI_MPI(). - mutable tbox::SAMRAI_MPI d_mpi; - - //! @brief Whether d_mpi is an internal duplicate. See setSAMRAI_MPI(). - bool d_mpi_is_dupe; - - int d_n_root_cycles; - - //! @brief Degree of the tree. Two means binary tree. - const int d_degree; - - /* - * Values for workload estimate data, workload factor, and bin pack method - * used on individual levels when specified as such. - */ - tbox::Array d_workload_data_id; - - int d_master_workload_data_id; - - /*! - * @brief Weighting factor for penalizing imbalance. - * - * @see combinedBreakingPenalty(). - */ - double d_balance_penalty_wt; - - /*! - * @brief Weighting factor for penalizing new suraces. - * - * @see combinedBreakingPenalty(). - */ - double d_surface_penalty_wt; - - /*! - * @brief Weighting factor for penalizing slenderness. - * - * @see combinedBreakingPenalty(). - */ - double d_slender_penalty_wt; - - /*! - * @brief How high a slenderness ratio we can tolerate before penalizing. - */ - double d_slender_penalty_threshold; - - /*! - * @brief Extra penalty weighting applied before cutting. - * - * Set to range [1,ininity). - * Higher value forces more agressive cutting but can produce more slivers. - */ - double d_precut_penalty_wt; - - //@{ - //! @name Data shared with private methods during balancing. - mutable hier::IntVector d_min_size; - mutable hier::IntVector d_max_size; - mutable std::vector d_block_domain_boxes; - mutable hier::IntVector d_bad_interval; - mutable hier::IntVector d_cut_factor; - mutable double d_global_avg_load; - //@} - - mutable tbox::Array d_output_procs; - bool d_using_all_procs; - - /*! - * @brief Whether to immediately report the results of the load balancing cycles - * in the log files. - */ - bool d_report_load_balance; - - //@{ - //! @name Used for evaluating peformance. - bool d_barrier_before; - bool d_barrier_after; - //@} - - static const int d_default_data_id; - - /* - * Performance timers. - */ - boost::shared_ptr t_load_balance_box_level; - boost::shared_ptr t_get_map; - boost::shared_ptr t_use_map; - boost::shared_ptr t_constrain_size; - boost::shared_ptr t_map_big_boxes; - boost::shared_ptr t_load_distribution; - boost::shared_ptr t_compute_local_load; - boost::shared_ptr t_compute_global_load; - boost::shared_ptr t_compute_tree_load; - std::vector > t_compute_tree_load_for_cycle; - boost::shared_ptr t_reassign_loads; - boost::shared_ptr t_shift_loads_by_swapping; - boost::shared_ptr t_shift_loads_by_breaking; - boost::shared_ptr t_find_swap_pair; - boost::shared_ptr t_break_off_load; - boost::shared_ptr t_find_bad_cuts; - boost::shared_ptr t_send_load_to_children; - boost::shared_ptr t_send_load_to_parent; - boost::shared_ptr t_get_load_from_children; - boost::shared_ptr t_get_load_from_parent; - boost::shared_ptr t_construct_semilocal; - boost::shared_ptr t_construct_semilocal_comm_wait; - boost::shared_ptr t_send_edge_to_children; - boost::shared_ptr t_send_edge_to_parent; - boost::shared_ptr t_get_edge_from_children; - boost::shared_ptr t_get_edge_from_parent; - boost::shared_ptr t_report_loads; - boost::shared_ptr t_local_balancing; - boost::shared_ptr t_finish_sends; - boost::shared_ptr t_pack_load; - boost::shared_ptr t_unpack_load; - boost::shared_ptr t_unpack_edge; - boost::shared_ptr t_children_load_comm; - boost::shared_ptr t_parent_load_comm; - boost::shared_ptr t_children_edge_comm; - boost::shared_ptr t_parent_edge_comm; - boost::shared_ptr t_barrier_before; - boost::shared_ptr t_barrier_after; - boost::shared_ptr t_child_send_wait; - boost::shared_ptr t_child_recv_wait; - boost::shared_ptr t_parent_send_wait; - boost::shared_ptr t_parent_recv_wait; - - /* - * Statistics on number of cells and patches generated. - */ - mutable std::vector d_load_stat; - mutable std::vector d_box_count_stat; - - // Extra checks independent of optimization/debug. - char d_print_steps; - char d_print_break_steps; - char d_print_swap_steps; - char d_print_edge_steps; - char d_check_connectivity; - char d_check_map; - -}; - -} -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.C b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.C new file mode 100644 index 00000000..4670d9f6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.C @@ -0,0 +1,1114 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Implementation of TransitLoad by vouchers. + * + ************************************************************************/ + +#ifndef included_mesh_VoucherTransitLoad_C +#define included_mesh_VoucherTransitLoad_C + +#include "SAMRAI/mesh/VoucherTransitLoad.h" +#include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/mesh/BoxTransitSet.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/TimerManager.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace mesh { + +const int VoucherTransitLoad::VoucherTransitLoad_DEMANDTAG; +const int VoucherTransitLoad::VoucherTransitLoad_SUPPLYTAG; + +const std::string VoucherTransitLoad::s_default_timer_prefix("mesh::VoucherTransitLoad"); +std::map VoucherTransitLoad::s_static_timers; + +tbox::StartupShutdownManager::Handler +VoucherTransitLoad::s_initialize_finalize_handler( + VoucherTransitLoad::initializeCallback, + 0, + 0, + VoucherTransitLoad::finalizeCallback, + tbox::StartupShutdownManager::priorityTimers); + +/* + ************************************************************************* + ************************************************************************* + */ +VoucherTransitLoad::VoucherTransitLoad( + const PartitioningParams& pparams): + TransitLoad(), + d_vouchers(), + d_sumload(0), + d_pparams(&pparams), + d_partition_work_supply_recursively(true), + d_flexible_load_tol(0.0), + d_reserve(pparams), + d_print_steps(false), + d_print_edge_steps(false), + d_object_timers(0) +{ + getFromInput(); + setTimerPrefix(s_default_timer_prefix); +} + +/* + ************************************************************************* + ************************************************************************* + */ +VoucherTransitLoad::VoucherTransitLoad( + const VoucherTransitLoad& other, + bool copy_load): + TransitLoad(other), + d_vouchers(), + d_sumload(0), + d_pparams(other.d_pparams), + d_partition_work_supply_recursively(other.d_partition_work_supply_recursively), + d_flexible_load_tol(other.d_flexible_load_tol), + d_reserve(*other.d_pparams), + d_print_steps(other.d_print_steps), + d_print_edge_steps(other.d_print_edge_steps), + d_object_timers(other.d_object_timers) +{ + if (copy_load) { + d_vouchers = other.d_vouchers; + d_sumload = other.d_sumload; + } +} + +/* + ************************************************************************* + * Initialize sets to a new (empty) container but retains current + * supplemental data such as control and diagnostic parameters. + ************************************************************************* + */ +void VoucherTransitLoad::initialize() +{ + d_vouchers.clear(); + d_sumload = 0.0; +} + +/* + ************************************************************************* + * Allocate a new object exactly like this, but empty. + ************************************************************************* + */ +VoucherTransitLoad *VoucherTransitLoad::clone() const +{ + VoucherTransitLoad* new_object = new VoucherTransitLoad(*this, false); + return new_object; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void VoucherTransitLoad::insertAll(const hier::BoxContainer& other) +{ + for (hier::BoxContainer::const_iterator bi = other.begin(); bi != other.end(); ++bi) { + insertCombine(Voucher(LoadType(bi->size()), bi->getOwnerRank())); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void VoucherTransitLoad::insertAll(TransitLoad& other_transit_load) +{ + const VoucherTransitLoad& other = recastTransitLoad(other_transit_load); + for (const_iterator si = other.d_vouchers.begin(); + si != other.d_vouchers.end(); ++si) { + TBOX_ASSERT(si->d_load >= d_pparams->getLoadComparisonTol()); + insertCombine(*si); + } +} + + +/* + ************************************************************************* + ************************************************************************* + */ +void VoucherTransitLoad::setWorkload( + const hier::PatchLevel& patch_level, + const int work_data_id) +{ + d_reserve.clear(); + d_reserve.setAllowBoxBreaking(getAllowBoxBreaking()); + d_reserve.setThresholdWidth(getThresholdWidth()); + + /* + */ + clear(); + LoadType sumload = 0.0; + for (hier::PatchLevel::iterator pi = patch_level.begin(); + pi != patch_level.end(); ++pi) { + const boost::shared_ptr& patch = *pi; + const hier::BoxId& box_id = patch->getBox().getBoxId(); + BoxInTransit new_transit_box(patch->getBox()); + std::vector corner_weights; + new_transit_box.setLoad( + BalanceUtilities::computeNonUniformWorkloadOnCorners(corner_weights, + patch, + work_data_id, + new_transit_box.getBox())); + new_transit_box.setCornerWeights(corner_weights); + sumload += new_transit_box.getLoad(); + d_reserve.insert(new_transit_box); + insertCombine(Voucher(LoadType(new_transit_box.getLoad()), + box_id.getOwnerRank())); + } + d_sumload = sumload; +} + + +/* + ************************************************************************* + ************************************************************************* + */ +size_t VoucherTransitLoad::getNumberOfItems() const +{ + return d_vouchers.size(); +} + +/* + ************************************************************************* + ************************************************************************* + */ +size_t VoucherTransitLoad::getNumberOfOriginatingProcesses() const +{ + return d_vouchers.size(); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +VoucherTransitLoad::putToMessageStream(tbox::MessageStream& msg) const +{ + msg << d_vouchers.size(); + for (const_iterator ni = d_vouchers.begin(); ni != d_vouchers.end(); ++ni) { + msg << *ni; + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +VoucherTransitLoad::getFromMessageStream(tbox::MessageStream& msg) +{ + size_t num_vouchers = 0; + msg >> num_vouchers; + Voucher v; + for (size_t i = 0; i < num_vouchers; ++i) { + msg >> v; + insert(v); + } +} + +/* + ************************************************************************* + * Assign boxes to local process (put them in the balanced_box_level). + ************************************************************************* + */ +void +VoucherTransitLoad::assignToLocal( + hier::BoxLevel& balanced_box_level, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi) +{ + d_object_timers->t_assign_to_local->start(); + // Delegate to assignToLocalAndPopulateMap but give it no map to work with. + assignToLocalAndPopulateMaps( + balanced_box_level, + 0, 0, + unbalanced_box_level, + flexible_load_tol, + alt_mpi); + d_object_timers->t_assign_to_local->stop(); +} + +/* + ************************************************************************* + * Assign boxes to local process (put them in the balanced_box_level + * and populate balanced<==>unbalanced). + */ +void +VoucherTransitLoad::assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi) +{ + // Delegate to the more general assignToLocalAndPopulateMap. + assignToLocalAndPopulateMaps( + balanced_box_level, + &balanced_to_unbalanced, + &unbalanced_to_balanced, + unbalanced_to_balanced.getBase(), + flexible_load_tol, + alt_mpi); +} + +/* + ************************************************************************* + * Assign boxes to local process (put them in the balanced_box_level + * and populate balanced<==>unbalanced). + * + * This method does two things: + * - Voucher redeemers request and receive work vouchers they hold. + * - Voucher fulfillers receive and fulfill redemption requests. + * The code is writen to let each process be both redeemers and + * fulfillers. Logic should drop through correctly on processes + * that plays just one role. + * + * There are four major steps, organized to overlap communication. + * 1. Request work for vouchers to be redeemed. + * 2. Receive redemption requests. + * 3. Fulfill redemption requests. + * 4. Receive work for redeemed vouchers. + * + * To combine communicating vouchers and map edges, this method does + * both at the same time. If the maps are omitted (NULL), populating + * maps is omitted. + */ +void +VoucherTransitLoad::assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector* balanced_to_unbalanced, + hier::MappingConnector* unbalanced_to_balanced, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi) +{ + d_object_timers->t_assign_to_local_and_populate_maps->start(); + + d_flexible_load_tol = flexible_load_tol; + + if (d_print_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps: entered." + << "\npparams: " << *d_pparams + << std::endl; + } + + const tbox::SAMRAI_MPI& mpi = alt_mpi.hasNullCommunicator() ? + unbalanced_box_level.getMPI() : alt_mpi; + + /* + * unaccounted_work is amount of work we started with, minus what + * we can still acount for (the part we still hold). The rest have + * been sent off in the form of vouchers and we don't know where + * they ended up. + */ + LoadType original_work; + if (d_reserve.empty()) { + original_work = LoadType(unbalanced_box_level.getLocalNumberOfCells()); + } else { + original_work = d_reserve.getSumLoad(); + } + LoadType unaccounted_work = original_work + - findVoucher(mpi.getRank()).d_load; + + if (d_print_edge_steps) { + tbox::plog << "unaccounted work is " << unaccounted_work << std::endl; + } + + // 1. Send work demands for vouchers we want to redeem. + + std::map redemptions_to_request; + std::map redemptions_to_fulfill; + + hier::LocalId local_id_offset = unbalanced_box_level.getLastLocalId(); + const hier::LocalId local_id_inc(static_cast(d_vouchers.size())); + + for (const_iterator si = d_vouchers.begin(); si != d_vouchers.end(); ++si) { + hier::SequentialLocalIdGenerator id_gen(++local_id_offset, local_id_inc); + if (si->d_issuer_rank != mpi.getRank()) { + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " sending demand for voucher " << *si << '.' + << std::endl; + } + redemptions_to_request[si->d_issuer_rank].sendWorkDemand( + si, id_gen, mpi); + } else { + // Locally fulfilled. Place in redemptions_to_fulfill for processing. + redemptions_to_fulfill[mpi.getRank()].setLocalRedemption(si, id_gen, mpi); + } + } + + // Set up the reserve for fulfilling incoming redemption requests. + if (d_reserve.empty()) { + d_reserve.clear(); + d_reserve.setAllowBoxBreaking(getAllowBoxBreaking()); + d_reserve.setThresholdWidth(getThresholdWidth()); + d_reserve.insertAll(unbalanced_box_level.getBoxes()); + } + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " reserve before redemption steps: " + << d_reserve.format(); + tbox::plog << std::endl; + } + + // 2. Receive work demands for voucher we generated but can't account for. + + /* + * If there is unaccounted work, then some processes must have our + * voucher. Reveive their demands for work until we've accounted + * for everything. Don't supply work until all demands are + * received, because that leads to non-deterministic results. + */ + + while (unaccounted_work > d_pparams->getLoadComparisonTol()) { + + tbox::SAMRAI_MPI::Status status; + mpi.Probe(MPI_ANY_SOURCE, VoucherTransitLoad_DEMANDTAG, &status); + + int source = status.MPI_SOURCE; + int count = -1; + tbox::SAMRAI_MPI::Get_count(&status, MPI_CHAR, &count); + + VoucherRedemption& vr = redemptions_to_fulfill[source]; + vr.recvWorkDemand(source, count, mpi); + unaccounted_work -= vr.d_voucher.d_load; + + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " received demand from " << source << " for voucher " + << vr.d_voucher << " leaving unaccounted_work = " << unaccounted_work + << std::endl; + } + + TBOX_ASSERT(unaccounted_work >= -d_pparams->getLoadComparisonTol()); + + } + + // 3. Supply work according to received demands. + + if (d_partition_work_supply_recursively) { + if (!redemptions_to_fulfill.empty()) { + recursiveSendWorkSupply( + redemptions_to_fulfill.begin(), + redemptions_to_fulfill.end(), + d_reserve); + + // Done fulfilling redemptions. The rest stay on local process. + for (std::map::const_iterator mi = redemptions_to_fulfill.begin(); + mi != redemptions_to_fulfill.end(); ++mi) { + mi->second.d_box_shipment->putInBoxLevel(balanced_box_level); + if (unbalanced_to_balanced) { + mi->second.d_box_shipment->generateLocalBasedMapEdges( + *unbalanced_to_balanced, + *balanced_to_unbalanced); + } + } + } + } else { + for (std::map::iterator mi = redemptions_to_fulfill.begin(); + mi != redemptions_to_fulfill.end(); ++mi) { + + VoucherRedemption& vr = mi->second; + if (vr.d_demander_rank != mpi.getRank()) { + vr.sendWorkSupply(d_reserve, flexible_load_tol, *d_pparams, false); + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " sent supply to " << mi->first << " for voucher " + << vr.d_voucher << ": " + << vr.d_box_shipment->format() + << std::endl; + } + + if (unbalanced_to_balanced) { + vr.d_box_shipment->generateLocalBasedMapEdges( + *unbalanced_to_balanced, + *balanced_to_unbalanced); + } + } else { + vr.fulfillLocalRedemption(d_reserve, *d_pparams, false); + vr.d_box_shipment->putInBoxLevel(balanced_box_level); + if (unbalanced_to_balanced) { + vr.d_box_shipment->generateLocalBasedMapEdges( + *unbalanced_to_balanced, + *balanced_to_unbalanced); + } + } + } + + // Anything left in d_reserve is kept locally. + hier::SequentialLocalIdGenerator id_gen(unbalanced_box_level.getLastLocalId(), local_id_inc); + d_reserve.reassignOwnership( + id_gen, + balanced_box_level.getMPI().getRank()); + } + + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " reserve after sending work supplies: " + << d_reserve.format() + << std::endl; + } + + d_reserve.putInBoxLevel(balanced_box_level); + if (unbalanced_to_balanced) { + d_reserve.generateLocalBasedMapEdges( + *unbalanced_to_balanced, + *balanced_to_unbalanced); + } + + // 4. Receive work according to the demands we sent. + + while (!redemptions_to_request.empty()) { + + tbox::SAMRAI_MPI::Status status; + mpi.Probe(MPI_ANY_SOURCE, VoucherTransitLoad_SUPPLYTAG, &status); + + int source = status.MPI_SOURCE; + int count = -1; + tbox::SAMRAI_MPI::Get_count(&status, MPI_CHAR, &count); + + VoucherRedemption& vr = redemptions_to_request[source]; + vr.recvWorkSupply(count, *d_pparams); + + vr.d_box_shipment->putInBoxLevel(balanced_box_level); + if (unbalanced_to_balanced) { + vr.d_box_shipment->generateLocalBasedMapEdges( + *unbalanced_to_balanced, + *balanced_to_unbalanced); + } + + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps:" + << " received supply from rank " << source << " for " << vr.d_voucher + << ": " << vr.d_box_shipment->format() + << std::endl; + } + + redemptions_to_request.erase(source); + } + + if (d_print_steps) { + tbox::plog << "VoucherTransitLoad::assignToLocalAndPopulateMaps: exiting." << std::endl; + } + + d_flexible_load_tol = 0.0; + + d_object_timers->t_assign_to_local_and_populate_maps->stop(); +} + +/* + ************************************************************************* + * Alternative option to recursively partition work supply. + * This version tries to avoid cutting small amounts out of big + * boxes, which unavoidablly generates slivers. + * + * This method splits the reserve into a left half and a right half. + * It gives the left side to demanders in first half of [begin,end) and + * the right side to the second half. + ************************************************************************* + */ +void VoucherTransitLoad::recursiveSendWorkSupply( + const std::map::iterator& begin, + const std::map::iterator& end, + BoxTransitSet& reserve) +{ + std::map::iterator left_begin = begin; + std::map::iterator left_end = begin; + ++left_end; + + std::map::iterator right_end = end; + std::map::iterator right_begin = end; + --right_begin; + + if (right_begin == left_begin) { + if (begin->second.d_demander_rank != begin->second.d_mpi.getRank()) { + begin->second.sendWorkSupply(reserve, d_flexible_load_tol, *d_pparams, true); + } else { + begin->second.fulfillLocalRedemption(reserve, *d_pparams, true); + } + + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::recursiveSendWorkSupply:" + << " sent supply to " << begin->first << " for voucher " + << begin->second.d_voucher << ": " + << begin->second.d_box_shipment->format(); + tbox::plog << std::endl; + } + + } else { + + double left_load = left_begin->second.d_voucher.d_load; + double right_load = right_begin->second.d_voucher.d_load; + + // Find midpoint, where left side ends and right side begins. + while (left_end != right_begin) { + left_load += left_end->second.d_voucher.d_load; + ++left_end; + if (left_end != right_begin) { + --right_begin; + right_load += right_begin->second.d_voucher.d_load; + } + } + + BoxTransitSet left_reserve(reserve, false); + double upper_lim = left_load * (1 + d_flexible_load_tol); + double lower_lim = left_load * (1 - d_flexible_load_tol); + lower_lim = tbox::MathUtilities::Max( + lower_lim, left_load - right_load * d_flexible_load_tol); + upper_lim = tbox::MathUtilities::Min( + upper_lim, left_load + right_load * d_flexible_load_tol); + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::recursiveSendWorkSupply: splitting reserve:" + << reserve.format() + << "to get left_load of " << left_load << " [" << lower_lim << ',' << upper_lim + << " and right_load of " << right_load << "\n"; + } + + left_reserve.adjustLoad(reserve, left_load, lower_lim, upper_lim); + + if (d_print_edge_steps) { + tbox::plog << "VoucherTransitLoad::recursiveSendWorkSupply split reserve into left: " + << left_reserve.format() << "and right: " << reserve.format() + << std::endl; + } + + recursiveSendWorkSupply(left_begin, left_end, left_reserve); + recursiveSendWorkSupply(right_begin, right_end, reserve); + + reserve.insertAll(left_reserve); + + } +} + +/* + ************************************************************************* + * Send a demand for work to the voucher issuer, starting the voucher + * redemption sequence of steps. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::sendWorkDemand( + const VoucherTransitLoad::const_iterator& voucher, + const hier::SequentialLocalIdGenerator& id_gen, + const tbox::SAMRAI_MPI& mpi) +{ + d_voucher = *voucher; + d_demander_rank = mpi.getRank(); + d_id_gen = id_gen; + d_mpi = mpi; + + d_msg = boost::make_shared(); + (*d_msg) << d_id_gen << d_voucher; + + d_mpi.Isend( + (void *)(d_msg->getBufferStart()), + static_cast(d_msg->getCurrentSize()), + MPI_CHAR, + d_voucher.d_issuer_rank, + VoucherTransitLoad_DEMANDTAG, + &d_mpi_request); +} + +/* + ************************************************************************* + * Receive a demand for work from a process holding a locally issued + * voucher. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::recvWorkDemand( + int demander_rank, + int message_length, + const tbox::SAMRAI_MPI& mpi) +{ + d_mpi = mpi; + d_demander_rank = demander_rank; + + std::vector incoming_message(message_length); + tbox::SAMRAI_MPI::Status status; + d_mpi.Recv( + static_cast(&incoming_message[0]), + message_length, + MPI_CHAR, + d_demander_rank, + VoucherTransitLoad_DEMANDTAG, + &status); + + d_msg = boost::make_shared( + message_length, tbox::MessageStream::Read, + static_cast(&incoming_message[0]), false); + (*d_msg) >> d_id_gen >> d_voucher; + TBOX_ASSERT(d_msg->endOfData()); + TBOX_ASSERT(d_voucher.d_issuer_rank == mpi.getRank()); + + d_msg.reset(); +} + +/* + ************************************************************************* + * Send a supply of work to the demander to fulfill a voucher. The + * work is taken from a reserve. Save mapping edges incident from + * local boxes. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::sendWorkSupply( + BoxTransitSet& reserve, + double flexible_load_tol, + const PartitioningParams& pparams, + bool send_all) +{ + d_pparams = &pparams; + d_box_shipment = boost::make_shared(pparams); + d_box_shipment->setAllowBoxBreaking(reserve.getAllowBoxBreaking()); + d_box_shipment->setThresholdWidth(reserve.getThresholdWidth()); + if (send_all) { + d_box_shipment->swap(reserve); + } else { + double upper_lim = d_voucher.d_load * (1 + flexible_load_tol); + double lower_lim = d_voucher.d_load * (1 - flexible_load_tol); + lower_lim = tbox::MathUtilities::Max( + lower_lim, + d_voucher.d_load - (reserve.getSumLoad() - d_voucher.d_load) * flexible_load_tol); + d_box_shipment->adjustLoad(reserve, + d_voucher.d_load, + lower_lim, + upper_lim); + } + d_box_shipment->reassignOwnership(d_id_gen, d_demander_rank); + + d_msg = boost::make_shared(); + d_box_shipment->putToMessageStream(*d_msg); + + d_mpi.Isend( + (void *)(d_msg->getBufferStart()), + static_cast(d_msg->getCurrentSize()), + MPI_CHAR, + d_demander_rank, + VoucherTransitLoad_SUPPLYTAG, + &d_mpi_request); +} + +/* + ************************************************************************* + * Receive work supply from the issuer of the voucher. Save mapping + * edges incident from local boxes. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::recvWorkSupply( + int message_length, + const PartitioningParams& pparams) +{ + std::vector incoming_message(message_length); + tbox::SAMRAI_MPI::Status status; + d_mpi.Recv(static_cast(&incoming_message[0]), + message_length, + MPI_CHAR, + d_voucher.d_issuer_rank, + VoucherTransitLoad_SUPPLYTAG, + &status); + + d_msg = boost::make_shared( + message_length, tbox::MessageStream::Read, + static_cast(&incoming_message[0]), false); + d_box_shipment = boost::make_shared(pparams); + d_box_shipment->getFromMessageStream(*d_msg); + d_msg.reset(); +} + +/* + ************************************************************************* + * Set a demand for a local redemption. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::setLocalRedemption( + const VoucherTransitLoad::const_iterator& voucher, + const hier::SequentialLocalIdGenerator& id_gen, + const tbox::SAMRAI_MPI& mpi) +{ + d_voucher = *voucher; + d_demander_rank = mpi.getRank(); + d_id_gen = id_gen; + d_mpi = mpi; +} + +/* + ************************************************************************* + * Supply work to fulfill local redemption. + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::fulfillLocalRedemption( + BoxTransitSet& reserve, + const PartitioningParams& pparams, + bool all) +{ + d_pparams = &pparams; + d_box_shipment = boost::shared_ptr(reserve.clone()); + if (all) { + d_box_shipment->swap(reserve); + } else { + d_box_shipment->adjustLoad(reserve, + d_voucher.d_load, + d_voucher.d_load, + d_voucher.d_load); + } + d_box_shipment->reassignOwnership(d_id_gen, d_demander_rank); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void VoucherTransitLoad::VoucherRedemption::finishSendRequest() +{ + if (d_mpi_request != MPI_REQUEST_NULL) { + tbox::SAMRAI_MPI::Status status; + tbox::SAMRAI_MPI::Wait(&d_mpi_request, &status); + } + TBOX_ASSERT(d_mpi_request == MPI_REQUEST_NULL); +} + +/* + ************************************************************************* + * Adjust the VoucherTransitLoad by moving work between it (main_bin) + * and another (hold_bin). Try to bring the load to the specified + * ideal. + * + * Move Vouchers between given bins and, if needed, break some Vouchers + * up to move part of the work. + * + * The high_load and low_load define an acceptable range around the + * ideal_load. Because vouchers can be cut to any arbitrary amount + * (unlike boxes), it only uses the ideal_load. + * + * This method is purely local--it reassigns the load but does not + * communicate the change to any remote process. + * + * Return amount of load moved to this object from hold_bin. Negative + * amount means load moved from this object to hold_bin. + ************************************************************************* + */ +VoucherTransitLoad::LoadType +VoucherTransitLoad::adjustLoad( + TransitLoad& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load) +{ + VoucherTransitLoad& main_bin(*this); + + if (d_print_steps) { + tbox::plog << " adjustLoad attempting to bring main load from " + << main_bin.getSumLoad() << " to " << ideal_load + << " or within [" << low_load << ", " << high_load << "]." + << std::endl; + } + TBOX_ASSERT(low_load <= ideal_load); + TBOX_ASSERT(high_load >= ideal_load); + + LoadType actual_transfer = 0; + + if ((main_bin.empty() && ideal_load <= d_pparams->getLoadComparisonTol()) || + (hold_bin.empty() && main_bin.getSumLoad() < ideal_load + + d_pparams->getLoadComparisonTol())) { + return actual_transfer; + } + + d_object_timers->t_adjust_load->start(); + + const LoadType change = ideal_load - main_bin.getSumLoad(); + + if (change > 0) { + // Move load to main_bin. + actual_transfer = + raiseDstLoad(recastTransitLoad(hold_bin), + main_bin, + ideal_load); + } else if (change < 0) { + // Move load to hold_bin. + actual_transfer = + -raiseDstLoad(main_bin, + recastTransitLoad(hold_bin), + hold_bin.getSumLoad() - change); + } + + if (d_print_steps) { + const LoadType point_miss = main_bin.getSumLoad() - ideal_load; + const LoadType range_miss = + main_bin.getSumLoad() > high_load ? main_bin.getSumLoad() - high_load : + main_bin.getSumLoad() < low_load ? low_load - main_bin.getSumLoad() : 0; + tbox::plog << " adjustLoad point_miss=" << point_miss + << " range_miss=" + << (range_miss > 0 ? " " : "") // Add space if missed range + << (range_miss > 0.5 + * static_cast(d_pparams->getMinBoxSize().getProduct()) ? " " : "") // Add space if missed range by a lot + << range_miss + << " " << main_bin.getSumLoad() << '/' + << ideal_load << " [" << low_load << ',' << high_load << ']' + << std::endl; + } + + d_object_timers->t_adjust_load->stop(); + + return actual_transfer; +} + +/* + ************************************************************************* + * Raise load of dst container by shifing load from src. + ************************************************************************* + */ +VoucherTransitLoad::LoadType +VoucherTransitLoad::raiseDstLoad( + VoucherTransitLoad& src, + VoucherTransitLoad& dst, + LoadType ideal_dst_load) +{ + TBOX_ASSERT(ideal_dst_load >= dst.getSumLoad()); + + if (src.empty()) { + return 0; + // No-op empty-container cases is not handled below. + } + + d_object_timers->t_raise_dst_load->start(); + + /* + * Decide whether to take work from the beginning or the end of + * src, whichever is closer to the dst. This is a minor + * optimization to better preserve locality when the issuer rank + * ranges of src and dst don't overlap much. + */ + bool take_from_src_end = true; + if (!dst.empty()) { + + const LoadType gap_at_src_end = + tbox::MathUtilities::Abs( + src.rbegin()->d_issuer_rank - dst.begin()->d_issuer_rank); + + const LoadType gap_at_src_begin = + tbox::MathUtilities::Abs( + dst.rbegin()->d_issuer_rank - src.begin()->d_issuer_rank); + + take_from_src_end = gap_at_src_end < gap_at_src_begin; + } + + LoadType old_dst_load = dst.getSumLoad(); + + int num_src_vouchers = src.getNumberOfItems(); + int num_iterations = -1; + while (dst.getSumLoad() < ideal_dst_load - dst.d_pparams->getLoadComparisonTol() && + !src.empty()) { + ++num_iterations; + LoadType give_load = ideal_dst_load - dst.getSumLoad(); + + iterator src_itr; + if (take_from_src_end) { + if (num_iterations < num_src_vouchers) { + src_itr = src.end(); + do { + --src_itr; + } while (((give_load < src_itr->d_load && 2.0*give_load > src_itr->d_load) || (src_itr->d_load < give_load && (give_load - src_itr->d_load) < 0.5*give_load)) && src_itr != src.begin()); + } else { + src_itr = src.end(); + --src_itr; + } + } else { + src_itr = src.begin(); + } + + Voucher free_voucher = *src_itr; + src.erase(src_itr); + + if (free_voucher.d_load < + (ideal_dst_load - dst.getSumLoad() + dst.d_pparams->getLoadComparisonTol())) { + dst.insert(free_voucher); + } else { + Voucher partial_voucher((ideal_dst_load - dst.getSumLoad()), free_voucher); + dst.insert(partial_voucher); + src.insert(free_voucher); + /* + * Breaking not strictly needed, except rounding error may + * cause adding another partial voucher from same issuer. + */ + break; + } + } + + d_object_timers->t_raise_dst_load->stop(); + return dst.getSumLoad() - old_dst_load; +} + +/* + *********************************************************************** + *********************************************************************** + */ +bool +VoucherTransitLoad::eraseIssuer(int issuer_rank) +{ + Voucher tmp_voucher(0.0, issuer_rank); + const_iterator vi = d_vouchers.lower_bound(tmp_voucher); + if (vi != d_vouchers.end() && vi->d_issuer_rank == issuer_rank) { +#ifdef DEBUG_CHECK_ASSERTIONS + const_iterator vi1 = vi; + ++vi1; + TBOX_ASSERT(vi1 == d_vouchers.end() || vi1->d_issuer_rank != issuer_rank); +#endif + d_sumload -= vi->d_load; + d_vouchers.erase(vi); + return true; + } + return false; +} + +/* + *********************************************************************** + *********************************************************************** + */ +VoucherTransitLoad::Voucher +VoucherTransitLoad::findVoucher(int issuer_rank) const +{ + Voucher tmp_voucher(0.0, issuer_rank); + const_iterator vi = d_vouchers.lower_bound(tmp_voucher); + if (vi != d_vouchers.end() && vi->d_issuer_rank == issuer_rank) { + tmp_voucher.d_load = vi->d_load; + } + return tmp_voucher; +} + +/* + *********************************************************************** + *********************************************************************** + */ +VoucherTransitLoad::Voucher +VoucherTransitLoad::yankVoucher(int issuer_rank) +{ + Voucher tmp_voucher(0.0, issuer_rank); + const_iterator vi = d_vouchers.lower_bound(tmp_voucher); + if (vi != d_vouchers.end() && vi->d_issuer_rank == issuer_rank) { + tmp_voucher.d_load = vi->d_load; + erase(vi); + } + return tmp_voucher; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +VoucherTransitLoad::setTimerPrefix( + const std::string& timer_prefix) +{ + std::map::iterator ti( + s_static_timers.find(timer_prefix)); + if (ti == s_static_timers.end()) { + d_object_timers = &s_static_timers[timer_prefix]; + getAllTimers(timer_prefix, *d_object_timers); + } else { + d_object_timers = &(ti->second); + } + d_reserve.setTimerPrefix(timer_prefix + "::redemption"); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +VoucherTransitLoad::getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers) +{ + timers.t_adjust_load = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::adjustLoad()"); + + timers.t_raise_dst_load = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::raiseDstLoad()"); + + timers.t_assign_to_local = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::assignToLocal()"); + + timers.t_assign_to_local_and_populate_maps = tbox::TimerManager::getManager()-> + getTimer(timer_prefix + "::assignToLocalAndPopulateMaps()"); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void +VoucherTransitLoad::recursivePrint( + std::ostream& co, + const std::string& border, + int detail_depth) const +{ + co << getSumLoad() << " units in " << size() << " vouchers"; + if (detail_depth > 0) { + size_t count = 0; + co << ":"; + for (VoucherTransitLoad::const_iterator vi = begin(); + vi != end() && count < 50; ++vi, ++count) { + co << border << " " << *vi; + } + co << '\n'; + } else { + co << ".\n"; + } + co.flush(); +} + +/* + ************************************************************************* + * Look for an input database called "VoucherTransitLoad" and read + * parameters if it exists. + ************************************************************************* + */ +void +VoucherTransitLoad::getFromInput() +{ + if (!tbox::InputManager::inputDatabaseExists()) return; + + boost::shared_ptr input_db = tbox::InputManager::getInputDatabase(); + + if (input_db->isDatabase("VoucherTransitLoad")) { + + boost::shared_ptr my_db = input_db->getDatabase("VoucherTransitLoad"); + + d_partition_work_supply_recursively = my_db->getBoolWithDefault( + "DEV_partition_work_supply_recursively", d_partition_work_supply_recursively); + + d_print_steps = my_db->getBoolWithDefault( + "DEV_print_steps", d_print_steps); + + d_print_edge_steps = my_db->getBoolWithDefault( + "DEV_print_edge_steps", d_print_edge_steps); + + } +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.h b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.h new file mode 100644 index 00000000..12b7e1e9 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/VoucherTransitLoad.h @@ -0,0 +1,619 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Implementation of TreeLoadBalancer. + * + ************************************************************************/ + +#ifndef included_mesh_VoucherTransitLoad +#define included_mesh_VoucherTransitLoad + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/MappingConnector.h" +#include "SAMRAI/hier/SequentialLocalIdGenerator.h" +#include "SAMRAI/mesh/PartitioningParams.h" +#include "SAMRAI/mesh/TransitLoad.h" +#include "SAMRAI/mesh/BoxTransitSet.h" +#include "SAMRAI/tbox/StartupShutdownManager.h" + +#include + +namespace SAMRAI { +namespace mesh { + +/*! + * @brief Implementation of TransitLoad, representing the load with a + * set of vouchers, each of which has a work value and the rank of the + * process that issued the voucher. + * + * As a container, this class is nearly identical to + * std::set. + * + * Terminology: To avoid confusing the sending and receiving of + * messages, the sending and receiving of work use the terms supply + * and demand. During redemption of vouchers, the holder of a voucher + * demands the work. The issuer of that voucher supplies the work. + * Both send and receive messages to accomplish this. + * + * @internal + * There are 2 private nested classes. Voucher encapsulates voucher info. + * VoucherRedemption encapsulates the process of redeeming a voucher. + */ + +class VoucherTransitLoad:public TransitLoad +{ + +public: + typedef double LoadType; + + //! @name Constructor + VoucherTransitLoad( + const PartitioningParams& pparams); + + //! @name Copy constructor + VoucherTransitLoad( + const VoucherTransitLoad& other, + bool copy_load = true); + + //@{ + //! @name TransitLoad abstract interfaces + + //! @copydoc TransitLoad::clone() + VoucherTransitLoad * + clone() const; + + //! @copydoc TransitLoad::initialize() + void + initialize(); + + //! @copydoc TransitLoad::getSumLoad() + LoadType getSumLoad() const { + return d_sumload; + } + + //! @copydoc TransitLoad::insertAll( const hier::BoxContainer & ) + void + insertAll( + const hier::BoxContainer& box_container); + + //! @copydoc TransitLoad::insertAll( TransitLoad & ) + void + insertAll( + TransitLoad& other); + + //! @copydoc TransitLoad::insertAllWithExisitngLoads( const hier::BoxContainer & ) + void + insertAllWithExistingLoads( + const hier::BoxContainer& box_container) + { + clear(); + insertAll(box_container); + } + + //! @copydoc TransitLoad::setWorkload( const hier::PatchLevel&, const int ) + void + setWorkload( + const hier::PatchLevel& patch_level, + const int work_data_id); + + //! @copydoc TransitLoad::getNumberOfItems() + size_t + getNumberOfItems() const; + + //! @copydoc TransitLoad::getNumberOfOriginatingProcesses() + size_t + getNumberOfOriginatingProcesses() const; + + //! @copydoc TransitLoad::putToMessageStream() + void + putToMessageStream( + tbox::MessageStream& msg) const; + + //! @copydoc TransitLoad::getFromMessageStream() + void + getFromMessageStream( + tbox::MessageStream& msg); + + /*! + * @copydoc TransitLoad::adjustLoad() + */ + LoadType + adjustLoad( + TransitLoad& hold_bin, + LoadType ideal_load, + LoadType low_load, + LoadType high_load); + + /*! + * @copydoc TransitLoad::assignToLocal() + * + * This method uses communication to redeem vouchers. + */ + void + assignToLocal( + hier::BoxLevel& balanced_box_level, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)); + + /*! + * @copydoc TransitLoad::assignToLocalAndPopulateMaps() + * + * This method uses communication to redeem vouchers and up the map. + */ + void + assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector& balanced_to_unbalanced, + hier::MappingConnector& unbalanced_to_balanced, + double flexible_load_tol = 0.0, + const tbox::SAMRAI_MPI& alt_mpi = tbox::SAMRAI_MPI(MPI_COMM_NULL)); + + //@} + + /*! + * @brief Setup names of timers. + * + * By default, timers are named "mesh::VoucherTransitLoad::*", + * where the third field is the specific steps performed + * by the Schedule. You can override the first two + * fields with this method. Conforming to the timer + * naming convention, timer_prefix should have the form + * "*::*". + */ + void + setTimerPrefix( + const std::string& timer_prefix); + + void + recursivePrint( + std::ostream& co = tbox::plog, + const std::string& border = std::string(), + int detail_depth = 1) const; + +private: + /*! + * @brief Real implementation of assignToLocalAndPopulateMaps, with + * slightly modified interface. + */ + void + assignToLocalAndPopulateMaps( + hier::BoxLevel& balanced_box_level, + hier::MappingConnector* balanced_to_unbalanced, + hier::MappingConnector* unbalanced_to_balanced, + const hier::BoxLevel& unbalanced_box_level, + double flexible_load_tol, + const tbox::SAMRAI_MPI& alt_mpi); + + //! @brief MPI tag for demand communication. + static const int VoucherTransitLoad_DEMANDTAG = 3; + //! @brief MPI tag for supply communication. + static const int VoucherTransitLoad_SUPPLYTAG = 4; + + //! @brief Voucher. + struct Voucher { + //! @brief Default constructor sets zero value and invalid issuer. + Voucher(): + d_issuer_rank(tbox::SAMRAI_MPI::getInvalidRank()), + d_load(0.0) { + } + //! @brief Initializing constructor sets voucher value and issuer. + Voucher( + const LoadType& load, + int issuer_rank): + d_issuer_rank(issuer_rank), + d_load(load) { + } + //! @brief Construct Voucher by combining two vouchers from the same issuer. + Voucher( + const Voucher& a, + const Voucher& b): + d_issuer_rank(a.d_issuer_rank), + d_load(a.d_load + b.d_load) { + if (a.d_issuer_rank != b.d_issuer_rank) { + TBOX_ERROR("VoucherTransitLoad: Cannot combine vouchers from different issuers."); + } + } + //@ @brief Construct Voucher by taking value from an existing Voucher. + Voucher( + LoadType load, + Voucher& src): + d_issuer_rank(src.d_issuer_rank), + d_load(load <= src.d_load ? load : src.d_load) { + src.d_load -= d_load; + } + friend std::ostream& operator << (std::ostream& co, const Voucher& v) { + co << v.d_issuer_rank << '|' << v.d_load; + return co; + } + friend tbox::MessageStream& operator << (tbox::MessageStream& ms, const Voucher& v) { + ms << v.d_issuer_rank << v.d_load; + return ms; + } + friend tbox::MessageStream& operator >> (tbox::MessageStream& ms, Voucher& v) { + ms >> v.d_issuer_rank >> v.d_load; + return ms; + } + /*! + * @brief Adjust load by taking work from or giving work to + * another Voucher. + * + * Similar to the interface defined in TransitLoad but working + * with individual vouchers instead of containers. + */ + LoadType + adjustLoad( + Voucher& other, + LoadType ideal_load); + int d_issuer_rank; + LoadType d_load; + }; + + //! @brief Comparison functor for sorting Vouchers by issuer rank and load. + struct VoucherRankCompare { + bool operator () (const Voucher& a, const Voucher& b) const { + if (a.d_issuer_rank != b.d_issuer_rank) { + return a.d_issuer_rank < b.d_issuer_rank; + } + return a.d_load < b.d_load; + } + }; + + //@{ + //! @name Interfaces like the C++ standard stl::set, to help readability. + typedef std::set RankOrderedVouchers; + typedef RankOrderedVouchers::iterator iterator; + typedef RankOrderedVouchers::const_iterator const_iterator; + typedef RankOrderedVouchers::reverse_iterator reverse_iterator; + typedef RankOrderedVouchers::key_type key_type; + typedef RankOrderedVouchers::value_type value_type; + iterator begin() { + return d_vouchers.begin(); + } + iterator end() { + return d_vouchers.end(); + } + const_iterator begin() const { + return d_vouchers.begin(); + } + const_iterator end() const { + return d_vouchers.end(); + } + reverse_iterator rbegin() { + return d_vouchers.rbegin(); + } + reverse_iterator rend() { + return d_vouchers.rend(); + } + size_t size() const { + return d_vouchers.size(); + } + bool empty() const { + return d_vouchers.empty(); + } + void clear() { + d_sumload = 0; + d_vouchers.clear(); + } + std::pair insert(const Voucher& v) { + TBOX_ASSERT(v.d_load >= d_pparams->getLoadComparisonTol()); + iterator itr = d_vouchers.lower_bound(Voucher(0, v.d_issuer_rank)); + if (itr != d_vouchers.end() && + itr->d_issuer_rank == v.d_issuer_rank) { + TBOX_ERROR( + "Cannot insert Voucher " << v + << ".\nExisting voucher " << *itr + << " is from the same issuer." + << "\nTo combine the vouchers, use insertCombine()."); + } + itr = d_vouchers.insert(itr, v); + d_sumload += v.d_load; + checkDupes(); + return std::pair(itr, true); + } + size_t erase(const Voucher& v) { + iterator vi = d_vouchers.lower_bound(v); + if (vi != d_vouchers.end()) { + d_sumload -= vi->d_load; + erase(vi); + return 1; + } + return 0; + } + void erase(iterator pos) { + d_sumload -= pos->d_load; +#ifdef DEBUG_CHECK_ASSERTIONS + size_t old_size = d_vouchers.size(); +#endif + d_vouchers.erase(pos); + TBOX_ASSERT(d_vouchers.size() == old_size - 1); + } + void swap(VoucherTransitLoad& other) { + const LoadType tmpload = d_sumload; + d_sumload = other.d_sumload; + other.d_sumload = tmpload; + d_vouchers.swap(other.d_vouchers); + } + //@} + + //! @brief Encapsulates voucher redemption for both demander and supplier. + struct VoucherRedemption { + VoucherRedemption(): + d_demander_rank(tbox::SAMRAI_MPI::getInvalidRank()), + d_pparams(0), + d_mpi(MPI_COMM_NULL), + d_mpi_request(MPI_REQUEST_NULL) { + } + ~VoucherRedemption() { + finishSendRequest(); + d_pparams = 0; + } + + //@{ + //! @name Demanding and supplying work based on a voucher. + void + sendWorkDemand( + const VoucherTransitLoad::const_iterator& voucher, + const hier::SequentialLocalIdGenerator& id_gen, + const tbox::SAMRAI_MPI& mpi); + + void + recvWorkDemand( + int demander_rank, + int message_length, + const tbox::SAMRAI_MPI& mpi); + + void + sendWorkSupply( + BoxTransitSet& reserve, + double flexible_load_tol, + const PartitioningParams& pparams, + bool send_all); + + void + recvWorkSupply( + int message_length, + const PartitioningParams& pparams); + + void + setLocalRedemption( + const VoucherTransitLoad::const_iterator& voucher, + const hier::SequentialLocalIdGenerator& id_gen, + const tbox::SAMRAI_MPI& mpi); + + void + fulfillLocalRedemption( + BoxTransitSet& reserve, + const PartitioningParams& pparams, + bool all); + //@} + + void + takeWorkFromReserve( + BoxTransitSet& work, + BoxTransitSet& reserve); + + void + finishSendRequest(); + + Voucher d_voucher; + int d_demander_rank; + //! @brief Demander-specified LocalId generator to avoid ID clashes. + hier::SequentialLocalIdGenerator d_id_gen; + //! @brief Shipment of work, as boxes, sent or received. + boost::shared_ptr d_box_shipment; + const PartitioningParams* d_pparams; + + boost::shared_ptr d_msg; + tbox::SAMRAI_MPI d_mpi; + tbox::SAMRAI_MPI::Request d_mpi_request; + }; + + /*! + * @brief Insert voucher, combining with existing voucher from same issuer. + */ + iterator insertCombine(const Voucher& v) { + iterator itr = d_vouchers.lower_bound(Voucher(0.0, v.d_issuer_rank)); + if (itr == d_vouchers.end() || + v.d_issuer_rank != itr->d_issuer_rank) { + // Safe to insert. + TBOX_ASSERT(v.d_load >= d_pparams->getLoadComparisonTol()); + itr = d_vouchers.insert(itr, v); + } else { + // Create combined voucher to replace existing one. + Voucher combined(*itr, v); + TBOX_ASSERT(combined.d_load >= d_pparams->getLoadComparisonTol()); + d_vouchers.erase(itr++); + itr = d_vouchers.insert(itr, combined); + } + d_sumload += v.d_load; + checkDupes(); + return itr; + } + + /*! + * @brief Erase voucher issued by the given process. + * + * @return Whether there was a Voucher to be erased. + */ + bool + eraseIssuer( + int issuer_rank); + + //! @brief Sanity check enforcing no-duplicate-issuer rule. + void checkDupes() const { + for (const_iterator i = begin(); i != end(); ++i) { + const_iterator i1 = i; + ++i1; + if (i1 != end() && i1->d_issuer_rank == i->d_issuer_rank) { + } + } + } + + //! @brief Sanity check catching extremely small vouchers. + void checkSmallVouchers() const { + for (const_iterator i = begin(); i != end(); ++i) { + if (i->d_load < d_pparams->getLoadComparisonTol()) { + TBOX_ERROR("Voucher " << *i << " is smaller than tolerance " + << d_pparams->getLoadComparisonTol()); + } + } + } + + /*! + * @brief Raise load of dst container by shifing load from src. + */ + LoadType + raiseDstLoad( + VoucherTransitLoad& src, + VoucherTransitLoad& dst, + LoadType ideal_dst_load); + + /*! + * @brief Assign a reserve to a set of VoucherRedemption. + * + * Alternative option to recursively partition work supply. + * + * On return, work assignments will be reflected in reserve. + */ + void + recursiveSendWorkSupply( + const std::map::iterator& begin, + const std::map::iterator& end, + BoxTransitSet& reserve); + + /*! + * @brief Re-cast a TransitLoad object to a VoucherTransitLoad. + */ + const VoucherTransitLoad& recastTransitLoad(const TransitLoad& transit_load) { + const VoucherTransitLoad* ptr = static_cast(&transit_load); + TBOX_ASSERT(ptr); + return *ptr; + } + + /*! + * @brief Re-cast a TransitLoad object to a VoucherTransitLoad. + */ + VoucherTransitLoad& recastTransitLoad(TransitLoad& transit_load) { + VoucherTransitLoad* ptr = static_cast(&transit_load); + TBOX_ASSERT(ptr); + return *ptr; + } + + /*! + * @brief Return the Voucher issued by the given process. If + * Voucher isn't there, return zero-valued Voucher. + */ + Voucher + findVoucher( + int issuer_rank) const; + + /*! + * @brief Yank out and return the Voucher issued by the given + * process. If Voucher isn't there, return zero-valued Voucher. + */ + Voucher + yankVoucher( + int issuer_rank); + + /*! + * @brief Look for an input database called "VoucherTransitLoad" + * and read parameters if it exists. + */ + void + getFromInput(); + + /*! + * @brief Set up things for the entire class. + * + * Only called by StartupShutdownManager. + */ + static void initializeCallback() { + TimerStruct& timers(s_static_timers[s_default_timer_prefix]); + getAllTimers(s_default_timer_prefix, timers); + } + + /*! + * Free static timers. + * + * Only called by StartupShutdownManager. + */ + static void finalizeCallback() { + s_static_timers.clear(); + } + + //! @brief Work load, sorted by issuer rank. + RankOrderedVouchers d_vouchers; + + LoadType d_sumload; + + const PartitioningParams* d_pparams; + + bool d_partition_work_supply_recursively; + + double d_flexible_load_tol; + + //! @brief Reserve load container used during redemption phase. + BoxTransitSet d_reserve; + + //@{ + //! @name Debugging stuff. + bool d_print_steps; + bool d_print_edge_steps; + //@} + + //@{ + //! @name Timer data for Schedule class. + + /* + * @brief Structure of timers used by this class. + * + * Each Schedule object can set its own timer names through + * setTimerPrefix(). This leads to many timer look-ups. Because + * it is expensive to look up timers, this class caches the timers + * that has been looked up. Each TimerStruct stores the timers + * corresponding to a prefix. + */ + struct TimerStruct { + boost::shared_ptr t_adjust_load; + boost::shared_ptr t_raise_dst_load; + boost::shared_ptr t_assign_to_local; + boost::shared_ptr t_assign_to_local_and_populate_maps; + }; + + //! @brief Default prefix for Timers. + static const std::string s_default_timer_prefix; + + /*! + * @brief Static container of timers that have been looked up. + */ + static std::map s_static_timers; + + /*! + * @brief Structure of timers in s_static_timers, matching this + * object's timer prefix. + */ + TimerStruct* d_object_timers; + + /*! + * @brief Get all the timers defined in TimerStruct. The timers + * are named with the given prefix. + */ + static void + getAllTimers( + const std::string& timer_prefix, + TimerStruct& timers); + + //@} + + static tbox::StartupShutdownManager::Handler + s_initialize_finalize_handler; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual.dox index 63a549fe..63945dc8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_clustering.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_clustering.dox index 582298dd..803e4756 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_clustering.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_clustering.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_gridding.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_gridding.dox index 23a4bd6f..dd6a6ee7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_gridding.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_gridding.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_load_balance.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_load_balance.dox index aa9f1c05..b637878f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_load_balance.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_load_balance.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_multiblock.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_multiblock.dox index dd7ac911..f1610616 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_multiblock.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/dox/manual_multiblock.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.depend index ca43ac96..e93c414a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -13,34 +13,37 @@ FILE_0=mesh_coarsentags1d.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h mesh_coarsentags1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + mesh_coarsentags1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=mesh_coarsentags2d.o DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h mesh_coarsentags2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + mesh_coarsentags2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=mesh_coarsentags3d.o DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h mesh_coarsentags3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + mesh_coarsentags3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.in index 90f1a2d8..a9c30130 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/Makefile.in @@ -3,29 +3,43 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for mesh directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/mesh/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. -# For classes that are non-dimensional. -OBJS= mesh_coarsentags1d.o mesh_coarsentags2d.o\ - mesh_coarsentags3d.o\ - - default: library include $(OBJECT)/config/Makefile.config -library: $(OBJS) +OBJS= mesh_coarsentags1d.o \ + mesh_coarsentags2d.o \ + mesh_coarsentags3d.o + +library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) + $(RM) *.f include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +mesh_coarsentags1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/mesh_coarsentags1d.m4 > mesh_coarsentags1d.f + $(F77) $(FFLAGS) -c mesh_coarsentags1d.f -o $@ + +mesh_coarsentags2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/mesh_coarsentags2d.m4 > mesh_coarsentags2d.f + $(F77) $(FFLAGS) -c mesh_coarsentags2d.f -o $@ + +mesh_coarsentags3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/mesh_coarsentags3d.m4 > mesh_coarsentags3d.f + $(F77) $(FFLAGS) -c mesh_coarsentags3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.f deleted file mode 100644 index 8a67f8fd..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.f +++ /dev/null @@ -1,64 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 1d integer tag values. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Constant averaging for 1d cell-centered int tag data. The operation -c uses the rule that if any value on the fine mesh contained in a cell of -c the coarse mesh is not equal to zero, the value on the coarse mesh is -c set to one. -c*********************************************************************** -c - subroutine coarsentags1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - integer zero, one - parameter (zero=0) - parameter (one=1) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - integer - & arrayf(filo0:fihi0), - & arrayc(cilo0:cihi0) - integer ic0,if0,ir0 -c -c*********************************************************************** -c - - do ic0=ifirstc0,ilastc0 - arrayc(ic0) = zero - enddo - - do ir0=0,ratio(0)-1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - if (arrayf(if0) .ne. zero) - & arrayc(ic0)=one - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.m4 index b8325317..2188c3e9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags1d.m4 @@ -1,15 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 1d integer tag values. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for coarsening 1d integer tag values. c define(NDIM,1)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl c c*********************************************************************** c Constant averaging for 1d cell-centered int tag data. The operation diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.f deleted file mode 100644 index c7ece021..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.f +++ /dev/null @@ -1,72 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 2d integer tag values. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Constant averaging for 2d cell-centered double data. The operation -c uses the rule that if any value on the fine mesh contained in a cell of -c the coarse mesh is not equal to zero, the value on the coarse mesh is -c set to one. -c*********************************************************************** -c - subroutine coarsentags2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - integer zero, one - parameter (zero=0) - parameter (one=1) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayf(filo0:fihi0, - & filo1:fihi1), - & arrayc(cilo0:cihi0, - & cilo1:cihi1) - integer ic0,ic1,if0,if1,ir0,ir1 -c -c*********************************************************************** -c - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1)=zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - if (arrayf(if0,if1) .ne. zero) - & arrayc(ic0,ic1)=one - enddo - enddo - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.m4 index 2e7fa831..8ab7d7f1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags2d.m4 @@ -1,15 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 2d integer tag values. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for coarsening 2d integer tag values. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c c*********************************************************************** c Constant averaging for 2d cell-centered double data. The operation diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.f deleted file mode 100644 index c595a59a..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.f +++ /dev/null @@ -1,82 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 3d integer tag values. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Constant averaging for 3d cell-centered double data. The operation -c uses the rule that if any value on the fine mesh contained in a cell of -c the coarse mesh is not equal to zero, the value on the coarse mesh is -c set to one. -c*********************************************************************** -c - subroutine coarsentags3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - integer zero, one - parameter (zero=0) - parameter (one=1) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - integer - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2), - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2) - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2 -c -c*********************************************************************** -c - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - arrayc(ic0,ic1,ic2)=zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - if (arrayf(if0,if1,if2) .ne. zero) - & arrayc(ic0,ic1,ic2) = one - enddo - enddo - enddo - enddo - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.m4 index 347ac61a..aa4909bb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/mesh/fortran/mesh_coarsentags3d.m4 @@ -1,15 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI mesh -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for coarsening 3d integer tag values. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for coarsening 3d integer tag values. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c c*********************************************************************** c Constant averaging for 3d cell-centered double data. The operation diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.C index 5c909ef3..3b2097f0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated array data structure supporting patch data types * ************************************************************************/ @@ -54,28 +54,11 @@ template size_t ArrayData::getSizeOfData( const hier::Box& box, - int depth) + unsigned int depth) { return tbox::MemoryUtilities::align(box.size() * depth * sizeof(TYPE)); } -/* - ************************************************************************* - * - * Default constructor creates an object that absolutely should - * not be used until it is initialized using initializeArray(). - * - ************************************************************************* - */ -template -ArrayData::ArrayData(): - d_dim(tbox::Dimension::getInvalidDimension()), - d_depth(0), - d_offset(0), - d_array(0) -{ -} - /* ************************************************************************* * @@ -89,8 +72,7 @@ ArrayData::ArrayData(): template ArrayData::ArrayData( const hier::Box& box, - int depth): - d_dim(box.getDim()), + unsigned int depth): d_depth(depth), d_offset(box.size()), d_box(box), @@ -108,93 +90,11 @@ ArrayData::~ArrayData() { } -/* - ************************************************************************* - * - * The const constructor and assignment operator are not actually used - * but are defined here for compilers that require an implementation for - * every declaration. - * - ************************************************************************* - */ - -template -ArrayData::ArrayData( - const ArrayData& foo): - d_dim(foo.d_dim), - d_depth(0), - d_offset(0), - d_box(d_dim), - d_array(0) -{ - /* - * Throw an assertion if this method is used. - */ - TBOX_ASSERT(true); - NULL_USE(foo); -} - -template -void -ArrayData::operator = ( - const ArrayData& foo) -{ - /* - * Throw an assertion if this method is used. - */ - TBOX_ASSERT(true); - NULL_USE(foo); -} - -/* - ************************************************************************* - * - * Initialize the array using the specified box, depth. - * - ************************************************************************* - */ - -template -void -ArrayData::initializeArray( - const hier::Box& box, - int depth) -{ - TBOX_ASSERT(depth > 0); - - d_dim = box.getDim(); - d_depth = depth; - d_offset = box.size(); - d_box = box; - - /* - * If array is a different size then create a new one, otherwise - * just use existing array; there is no reason to - * deallocate/allocate if existing is the correct size. - * - * Also note that the array is not initialized to anything. This is - * to avoid the performance hit of initializing but is potentially - * bad. In debug mode will explicitly initialize the array. - * - * Performance timing of some sample applications (LinAdv) showed - * the impact of initialization was significant. This is probably - * not the safest programming practice. - */ - if (d_array.size() != depth * d_offset) { - d_array = tbox::Array(depth * d_offset, - tbox::Array::UNINITIALIZED); - } - -#ifdef DEBUG_INITIALIZE_UNDEFINED - undefineData(); -#endif -} - template bool ArrayData::isInitialized() const { - return d_depth > 0; + return d_depth * d_offset > 0; } template @@ -205,69 +105,76 @@ ArrayData::getBox() const } template -int +unsigned int ArrayData::getDepth() const { return d_depth; } template -int +size_t ArrayData::getOffset() const { return d_offset; } template -TYPE* +size_t +ArrayData::getIndex( + const hier::Index& i, + unsigned int d) const +{ + TBOX_ASSERT((d < d_depth)); + + size_t index = d_box.offset(i) + d * d_offset; + + TBOX_ASSERT((index < d_depth * d_offset)); + + return index; +} + +template +TYPE * ArrayData::getPointer( - int d) + unsigned int d) { - TBOX_ASSERT((d >= 0) && (d < d_depth)); + TBOX_ASSERT((d < d_depth)); - return d_array.getPointer(d * d_offset); + return &d_array[d * d_offset]; } template -const TYPE* +const TYPE * ArrayData::getPointer( - int d) const + unsigned int d) const { - TBOX_ASSERT((d >= 0) && (d < d_depth)); + TBOX_ASSERT((d < d_depth)); - return d_array.getPointer(d * d_offset); + return &d_array[d * d_offset]; } template TYPE& ArrayData::operator () ( const hier::Index& i, - int d) + unsigned int d) { - TBOX_ASSERT((d >= 0) && (d < d_depth)); - - const int index = d_box.offset(i) + d * d_offset; + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); + TBOX_ASSERT((d < d_depth)); - TBOX_ASSERT((index >= 0) && (index < d_depth * d_offset)); - - return d_array[index]; + return d_array[getIndex(i, d)]; } template const TYPE& ArrayData::operator () ( const hier::Index& i, - int d) const + unsigned int d) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); - - TBOX_ASSERT((d >= 0) && (d < d_depth)); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); + TBOX_ASSERT((d < d_depth)); - const int index = d_box.offset(i) + d * d_offset; - - TBOX_ASSERT((index >= 0) && (index < d_depth * d_offset)); - - return d_array[index]; + return d_array[getIndex(i, d)]; } /* @@ -290,7 +197,7 @@ ArrayData::copy( const ArrayData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); CopyOperation copyop; @@ -302,10 +209,10 @@ ArrayData::copy( (d_box.isSpatiallyEqual(src.d_box)) && (box.isSpatiallyEqual(d_box))) { - TYPE * const dst_ptr = d_array.getPointer(); - const TYPE * const src_ptr = src.d_array.getPointer(); - const int n = d_offset * d_depth; - for (int i = 0; i < n; i++) { + TYPE * const dst_ptr = &d_array[0]; + const TYPE * const src_ptr = &src.d_array[0]; + const size_t n = d_offset * d_depth; + for (size_t i = 0; i < n; ++i) { copyop(dst_ptr[i], src_ptr[i]); } @@ -315,10 +222,10 @@ ArrayData::copy( if (!copybox.empty()) { - const int dst_start_depth = 0; - const int src_start_depth = 0; - const int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); - const hier::IntVector src_shift(d_dim, 0); + const unsigned int dst_start_depth = 0; + const unsigned int src_start_depth = 0; + const unsigned int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); + const hier::IntVector src_shift(box.getDim(), 0); ArrayDataOperationUtilities >:: doArrayDataOperationOnBox(*this, @@ -353,7 +260,7 @@ ArrayData::copy( const hier::IntVector& src_shift) { - if (src_shift == hier::IntVector::getZero(d_dim)) { + if (src_shift == hier::IntVector::getZero(box.getDim())) { copy(src, box); @@ -364,9 +271,9 @@ ArrayData::copy( if (!copybox.empty()) { - const int dst_start_depth = 0; - const int src_start_depth = 0; - const int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); + const unsigned int dst_start_depth = 0; + const unsigned int src_start_depth = 0; + const unsigned int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); CopyOperation copyop; @@ -394,7 +301,8 @@ ArrayData::copy( const hier::Transformation& transformation) { if (transformation.getRotation() == hier::Transformation::NO_ROTATE - && transformation.getOffset() == hier::IntVector::getZero(d_dim)) { + && transformation.getOffset() == hier::IntVector::getZero(box.getDim()) + && transformation.getBeginBlock() == transformation.getEndBlock()) { copy(src, box); @@ -407,9 +315,9 @@ ArrayData::copy( if (!copybox.empty()) { - const int dst_start_depth = 0; - const int src_start_depth = 0; - const int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); + const unsigned int dst_start_depth = 0; + const unsigned int src_start_depth = 0; + const unsigned int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); CopyOperation copyop; @@ -445,7 +353,8 @@ ArrayData::copy( const hier::BoxContainer& boxes, const hier::IntVector& src_shift) { - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { copy(src, *b, src_shift); } } @@ -457,7 +366,8 @@ ArrayData::copy( const hier::BoxContainer& boxes, const hier::Transformation& transformation) { - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { copy(src, *b, transformation); } } @@ -477,13 +387,13 @@ ArrayData::copy( template void ArrayData::copyDepth( - int dst_depth, + unsigned int dst_depth, const ArrayData& src, - int src_depth, + unsigned int src_depth, const hier::Box& box) { - TBOX_ASSERT((0 <= dst_depth) && (dst_depth <= d_depth)); - TBOX_ASSERT((0 <= src_depth) && (src_depth <= src.d_depth)); + TBOX_ASSERT((dst_depth <= d_depth)); + TBOX_ASSERT((src_depth <= src.d_depth)); CopyOperation copyop; @@ -493,12 +403,12 @@ ArrayData::copyDepth( if ((d_box.isSpatiallyEqual(src.d_box)) && (box.isSpatiallyEqual(d_box))) { - TYPE * const dst_ptr = d_array.getPointer(); - const TYPE * const src_ptr = src.d_array.getPointer(); + TYPE * const dst_ptr = &d_array[0]; + const TYPE * const src_ptr = &src.d_array[0]; TYPE * const dst_ptr_d = dst_ptr + dst_depth * d_offset; const TYPE * const src_ptr_d = src_ptr + src_depth * d_offset; - for (int i = 0; i < d_offset; i++) { + for (size_t i = 0; i < d_offset; ++i) { copyop(dst_ptr_d[i], src_ptr_d[i]); } @@ -508,10 +418,10 @@ ArrayData::copyDepth( if (!copybox.empty()) { - const int dst_start_depth = dst_depth; - const int src_start_depth = src_depth; - const int num_depth = 1; - const hier::IntVector src_shift(d_dim, 0); + const unsigned int dst_start_depth = dst_depth; + const unsigned int src_start_depth = src_depth; + const unsigned int num_depth = 1; + const hier::IntVector src_shift(box.getDim(), 0); ArrayDataOperationUtilities >:: doArrayDataOperationOnBox(*this, @@ -559,10 +469,10 @@ ArrayData::sum( (d_box.isSpatiallyEqual(src.d_box)) && (box.isSpatiallyEqual(d_box))) { - TYPE * const dst_ptr = d_array.getPointer(); - const TYPE * const src_ptr = src.d_array.getPointer(); - const int n = d_offset * d_depth; - for (int i = 0; i < n; i++) { + TYPE * const dst_ptr = &d_array[0]; + const TYPE * const src_ptr = &src.d_array[0]; + const size_t n = d_offset * d_depth; + for (size_t i = 0; i < n; ++i) { sumop(dst_ptr[i], src_ptr[i]); } @@ -572,10 +482,10 @@ ArrayData::sum( if (!copybox.empty()) { - const int dst_start_depth = 0; - const int src_start_depth = 0; - const int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); - const hier::IntVector src_shift(d_dim, 0); + const unsigned int dst_start_depth = 0; + const unsigned int src_start_depth = 0; + const unsigned int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); + const hier::IntVector src_shift(box.getDim(), 0); ArrayDataOperationUtilities >:: doArrayDataOperationOnBox(*this, @@ -610,7 +520,7 @@ ArrayData::sum( const hier::IntVector& src_shift) { - if (src_shift == hier::IntVector::getZero(d_dim)) { + if (src_shift == hier::IntVector::getZero(box.getDim())) { sum(src, box); @@ -621,9 +531,9 @@ ArrayData::sum( if (!copybox.empty()) { - const int dst_start_depth = 0; - const int src_start_depth = 0; - const int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); + const unsigned int dst_start_depth = 0; + const unsigned int src_start_depth = 0; + const unsigned int num_depth = (d_depth < src.d_depth ? d_depth : src.d_depth); SumOperation sumop; @@ -659,13 +569,14 @@ ArrayData::sum( const hier::BoxContainer& boxes, const hier::IntVector& src_shift) { - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { sum(src, *b, src_shift); } } template -int +size_t ArrayData::getDataStreamSize( const hier::BoxContainer& boxes, const hier::IntVector& source_shift) const @@ -674,9 +585,9 @@ ArrayData::getDataStreamSize( NULL_USE(source_shift); #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, source_shift); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, source_shift); - const int nelements = boxes.getTotalSizeOfBoxes(); + const size_t nelements = boxes.getTotalSizeOfBoxes(); if (typeid(TYPE) == typeid(bool)) { return tbox::MessageStream::getSizeof(d_depth * nelements); @@ -716,13 +627,12 @@ ArrayData::packStream( const hier::IntVector& src_shift) const { - const int size = d_depth * dest_box.size(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_box.size(); + std::vector buffer(size); - packBuffer(buffer.getPointer(), - hier::Box::shift(dest_box, -src_shift)); + packBuffer(&buffer[0], hier::Box::shift(dest_box, -src_shift)); - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } @@ -734,20 +644,19 @@ ArrayData::packStream( const hier::IntVector& src_shift) const { - const int size = d_depth * dest_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); - int ptr = 0; - for (hier::BoxContainer::const_iterator b(dest_boxes); + size_t ptr = 0; + for (hier::BoxContainer::const_iterator b = dest_boxes.begin(); b != dest_boxes.end(); ++b) { - packBuffer(buffer.getPointer(ptr), - hier::Box::shift(*b, -src_shift)); + packBuffer(&buffer[ptr], hier::Box::shift(*b, -src_shift)); ptr += d_depth * b->size(); } TBOX_ASSERT(ptr == size); - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } @@ -759,19 +668,18 @@ ArrayData::packStream( const hier::Transformation& transformation) const { - const int size = d_depth * dest_box.size(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_box.size(); + std::vector buffer(size); hier::Box pack_box(dest_box); transformation.inverseTransform(pack_box); - packBuffer(buffer.getPointer(), pack_box); + packBuffer(&buffer[0], pack_box); // hier::Box::shift(dest_box, -src_shift)); - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } - template void ArrayData::packStream( @@ -780,26 +688,25 @@ ArrayData::packStream( const hier::Transformation& transformation) const { - const int size = d_depth * dest_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); - int ptr = 0; - for (hier::BoxContainer::const_iterator b(dest_boxes); + size_t ptr = 0; + for (hier::BoxContainer::const_iterator b = dest_boxes.begin(); b != dest_boxes.end(); ++b) { hier::Box pack_box(*b); transformation.inverseTransform(pack_box); - packBuffer(buffer.getPointer(ptr), pack_box); + packBuffer(&buffer[ptr], pack_box); // hier::Box::shift(*b, -src_shift)); ptr += d_depth * b->size(); } TBOX_ASSERT(ptr == size); - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } - /* ************************************************************************* * @@ -822,11 +729,11 @@ ArrayData::unpackStream( NULL_USE(src_shift); - const int size = d_depth * dest_box.size(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_box.size(); + std::vector buffer(size); - stream.unpack(buffer.getPointer(), size); - unpackBuffer(buffer.getPointer(), dest_box); + stream.unpack(&buffer[0], size); + unpackBuffer(&buffer[0], dest_box); } @@ -840,15 +747,15 @@ ArrayData::unpackStream( NULL_USE(src_shift); - const int size = d_depth * dest_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); - stream.unpack(buffer.getPointer(), size); + stream.unpack(&buffer[0], size); - int ptr = 0; - for (hier::BoxContainer::const_iterator b(dest_boxes); + size_t ptr = 0; + for (hier::BoxContainer::const_iterator b = dest_boxes.begin(); b != dest_boxes.end(); ++b) { - unpackBuffer(buffer.getPointer(ptr), *b); + unpackBuffer(&buffer[ptr], *b); ptr += d_depth * b->size(); } @@ -877,11 +784,11 @@ ArrayData::unpackStreamAndSum( NULL_USE(src_shift); - const int size = d_depth * dest_box.size(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_box.size(); + std::vector buffer(size); - stream.unpack(buffer.getPointer(), size); - unpackBufferAndSum(buffer.getPointer(), dest_box); + stream.unpack(&buffer[0], size); + unpackBufferAndSum(&buffer[0], dest_box); } @@ -895,15 +802,15 @@ ArrayData::unpackStreamAndSum( NULL_USE(src_shift); - const int size = d_depth * dest_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = d_depth * dest_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); - stream.unpack(buffer.getPointer(), size); + stream.unpack(&buffer[0], size); - int ptr = 0; - for (hier::BoxContainer::const_iterator b(dest_boxes); + size_t ptr = 0; + for (hier::BoxContainer::const_iterator b = dest_boxes.begin(); b != dest_boxes.end(); ++b) { - unpackBufferAndSum(buffer.getPointer(ptr), *b); + unpackBufferAndSum(&buffer[ptr], *b); ptr += d_depth * b->size(); } @@ -925,9 +832,9 @@ ArrayData::fillAll( const TYPE& t) { if (!d_box.empty()) { - TYPE* ptr = d_array.getPointer(); - const int n = d_depth * d_offset; - for (int i = 0; i < n; i++) { + TYPE* ptr = &d_array[0]; + const size_t n = d_depth * d_offset; + for (size_t i = 0; i < n; ++i) { ptr[i] = t; } } @@ -939,7 +846,7 @@ ArrayData::fillAll( const TYPE& t, const hier::Box& box) { - for (int d = 0; d < d_depth; d++) { + for (tbox::Dimension::dir_t d = 0; d < d_depth; ++d) { fill(t, box, d); } } @@ -948,14 +855,14 @@ template void ArrayData::fill( const TYPE& t, - const int d) + const unsigned int d) { - TBOX_ASSERT((d >= 0) && (d < d_depth)); + TBOX_ASSERT((d < d_depth)); if (!d_box.empty()) { - TYPE* ptr = d_array.getPointer(d * d_offset); - const int n = d_offset; - for (int i = 0; i < n; i++) { + TYPE* ptr = &d_array[d * d_offset]; + const size_t n = d_offset; + for (size_t i = 0; i < n; ++i) { ptr[i] = t; } } @@ -966,42 +873,44 @@ void ArrayData::fill( const TYPE& t, const hier::Box& box, - const int d) + const unsigned int d) { - TBOX_ASSERT((d >= 0) && (d < d_depth)); + TBOX_ASSERT((d < d_depth)); const hier::Box ispace = d_box * box; if (!ispace.empty()) { - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < d_dim.getValue(); i++) { + const tbox::Dimension& dim = box.getDim(); + + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { box_w[i] = ispace.numberCells(i); dst_w[i] = d_box.numberCells(i); dim_counter[i] = 0; } - const int num_d0_blocks = ispace.size() / box_w[0]; + const int num_d0_blocks = static_cast(ispace.size() / box_w[0]); - int dst_counter = d_box.offset(ispace.lower()) + d * d_offset; + size_t dst_counter = d_box.offset(ispace.lower()) + d * d_offset; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < d_dim.getValue(); nd++) { + size_t dst_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dim.getValue(); ++nd) { dst_b[nd] = dst_counter; } - TYPE * const dst_ptr = d_array.getPointer(); + TYPE * const dst_ptr = &d_array[0]; - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { dst_ptr[dst_counter + i0] = t; } int dim_jump = 0; - for (int j = 1; j < d_dim.getValue(); j++) { + for (int j = 1; j < dim.getValue(); ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -1013,12 +922,12 @@ ArrayData::fill( if (dim_jump > 0) { int dst_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { dst_b[m] = dst_counter; } } @@ -1031,101 +940,70 @@ ArrayData::fill( * * Checks to make sure that class and restart file version numbers are * equal. If so, reads in d_depth, d_offset, and d_box from the - * database. Then calls getSpecializedFromDatabase() to read in the - * actual data. + * database. * ************************************************************************* */ template void -ArrayData::getFromDatabase( - const boost::shared_ptr& database) +ArrayData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("PDAT_ARRAYDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_ARRAYDATA_VERSION"); if (ver != PDAT_ARRAYDATA_VERSION) { - TBOX_ERROR("ArrayData::getFromDatabase error...\n" + TBOX_ERROR("ArrayData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); - d_offset = database->getInteger("d_offset"); - d_box = database->getDatabaseBox("d_box"); + d_depth = restart_db->getInteger("d_depth"); + d_offset = restart_db->getInteger("d_offset"); + d_box = restart_db->getDatabaseBox("d_box"); - getSpecializedFromDatabase(database); + restart_db->getVector("d_array", d_array); } /* ************************************************************************* * - * Write out the class version number, d_depth, d_offset, and d_box - * to the database. Then calls putSpecializedToDatabase() to write - * in the actual data. + * Write out the class version number, d_depth, d_offset, d_box, and + * d_array to the restart database. * ************************************************************************* */ template void -ArrayData::putUnregisteredToDatabase( - const boost::shared_ptr& database, - bool data_only) const +ArrayData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - if (!data_only) { - database->putInteger("PDAT_ARRAYDATA_VERSION", PDAT_ARRAYDATA_VERSION); + restart_db->putInteger("PDAT_ARRAYDATA_VERSION", PDAT_ARRAYDATA_VERSION); - database->putInteger("d_depth", d_depth); - database->putInteger("d_offset", d_offset); - database->putDatabaseBox("d_box", d_box); - } - - putSpecializedToDatabase(database); -} - -template -void -ArrayData::putSpecializedToDatabase( - const boost::shared_ptr& database) const -{ - database->putArray("d_array", d_array); -} + restart_db->putInteger("d_depth", d_depth); + restart_db->putInteger("d_offset", static_cast(d_offset)); + restart_db->putDatabaseBox("d_box", d_box); -template -void -ArrayData::getSpecializedFromDatabase( - const boost::shared_ptr& database) -{ - database->getArray("d_array", d_array); + restart_db->putVector("d_array", d_array); } template const tbox::Dimension& ArrayData::getDim() const { - return d_dim; -} - -template -void -ArrayData::invalidateArray( - const tbox::Dimension& dim) { - d_dim = dim; - d_depth = 0; - d_offset = 0; - d_box = hier::Box::getEmptyBox(dim); + return d_box.getDim(); } template bool ArrayData::isValid() { - return !d_box.isEmpty(); + return !d_box.empty(); } - + /* ************************************************************************* * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.h index 7228036e..8810deb0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated array data structure supporting patch data types * ************************************************************************/ @@ -18,17 +18,24 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/MemoryUtilities.h" #include "SAMRAI/tbox/MessageStream.h" #include +#include namespace SAMRAI { namespace pdat { +template +class OuteredgeData; +template +class OuternodeData; +template +class SideData; + /*! * @brief Class ArrayData is a basic templated array structure defined * over the index space of a box (with a specified depth) that provides @@ -52,11 +59,11 @@ class ArrayData { public: /*! - * Static member function that returns tru when the amount of buffer space in a - * message stream can be estimated from box only. For built-in types (bool, char, - * double, float, int, and dcomplex), this routine returns true. For other - * data types (template paramters) that may require special handling, - * a different implementation must be provided. + * Static member function that returns true when the amount of buffer space + * in a message stream can be estimated from box only. For built-in types + * (bool, char, double, float, int, and dcomplex), this routine returns + * true. For other data types (template paramters) that may require special + * handling, a different implementation must be provided. */ static bool canEstimateStreamSizeFromBox(); @@ -66,10 +73,11 @@ class ArrayData * store data of given depth on a box. * * Note that this function is only defined for the standard data types: - * bool, char, double, float, int, and dcomplex. It must be provided for other - * template parameter types. + * bool, char, double, float, int, and dcomplex. It must be provided for + * other template parameter types. * - * @return size_t value indicating the amount of memory space needed for the data. + * @return size_t value indicating the amount of memory space needed for the + * data. * * @param box Const reference to box object describing the spatial extents * of the array data index region of interest. @@ -79,14 +87,7 @@ class ArrayData static size_t getSizeOfData( const hier::Box& box, - int depth); - - /*! - * The default constructor creates an empty array data object. - * The initializeArray() member function must be called before the - * array can be used. - */ - ArrayData(); + unsigned int depth); /*! * Construct an array data object. @@ -95,10 +96,12 @@ class ArrayData * of the index space associated with the array data object. * @param depth Integer number of data values at each spatial location in * the array. + * + * @pre depth > 0 */ ArrayData( const hier::Box& box, - int depth); + unsigned int depth); /*! * The destructor for an array data object releases all memory allocated @@ -106,38 +109,20 @@ class ArrayData */ ~ArrayData(); - /*! - * Initialize the size of array data and depth. This method is - * somewhat poorly named as the data is NOT initialized to anything - * to avoid the performance cost of the data initialization. - * - * Use undefineData to initialize the data. - * - * @param box Const reference to box object describing the spatial extents - * of the index space associated with the array data object. - * @param depth Integer number of data values at each spatial location in - * the array. - */ - void - initializeArray( - const hier::Box& box, - int depth); - /*! * @brief Returns true when the array has been properly initialized * and storage has been allocated; otherwise, return false. * * Note: Only arrays that have been initialized can do anything useful. - * Initialize an uninitialized array by calling the initializeArray() method. */ bool isInitialized() const; /*! - * Set the array data to an ``undefined'' state appropriate for the data type. - * For example, for float and double, this means setting data to signaling NaNs - * that cause a floating point assertion when used in a numerical expression - * without being set to valid values. + * Set the array data to an ``undefined'' state appropriate for the data + * type. For example, for float and double, this means setting data to + * signaling NaNs that cause a floating point assertion when used in a + * numerical expression without being set to valid values. */ void undefineData(); @@ -152,49 +137,59 @@ class ArrayData * Return the depth (e.g., the number of data values at each spatial * location) of this array. */ - int + unsigned int getDepth() const; /*! * Return the offset (e.g., the number of data values for each * depth component) of this array. */ - int + size_t getOffset() const; /*! * Get a non-const pointer to the beginning of the given depth * component of this data array. + * + * @pre (d >= 0) && (d < getDepth()) */ TYPE * getPointer( - const int d = 0); + const unsigned int d = 0); /*! * Get a const pointer to the beginning of the given depth * component of this data array. + * + * @pre (d >= 0) && (d < getDepth()) */ const TYPE * getPointer( - const int d = 0) const; + const unsigned int d = 0) const; /*! * Return reference to value in this array associated with the given * box index and depth component. + * + * @pre getDim() == i.getDim() + * @pre (d >= 0) && (d < getDepth()) */ TYPE& operator () ( const hier::Index& i, - const int d); + const unsigned int d); /*! * Return const reference to value in this array associated with the given * box index and depth component. + * + * @pre getDim() == i.getDim() + * @pre (d >= 0) && (d < getDepth()) */ const TYPE& operator () ( const hier::Index& i, - const int d) const; + const unsigned int d) const; /*! * Copy data from the source array data object to this array data object @@ -207,9 +202,12 @@ class ArrayData * * @param src Const reference to source array data object. * @param box Const reference to box object describing the spatial extents - * of the index space region over which to perform the copy operation. - * Note: the box is in either the source or destination index space - * (which are assumed to be the same). + * of the index space region over which to perform the copy + * operation. + * Note: the box is in either the source or destination index + * space (which are assumed to be the same). + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copy( @@ -222,15 +220,17 @@ class ArrayData * * Note that this routine assumes that the source array box region must * be shifted to be consistent with the destination (this) array box region. - * This routine will intersect the specified box with the destination box and - * shifted source box to find the region of intersection. + * This routine will intersect the specified box with the destination box + * and shifted source box to find the region of intersection. * * @param src Const reference to source array data object. * @param box Const reference to box object describing the spatial extents - * of the index space region over which to perform the copy operation. + * of the index space region over which to perform the copy + * operation. * Note: the box is in the destination index space. * @param src_shift Const reference to shift vector used to put the source - * array data box into the index space region of this array data object. + * array data box into the index space region of this array + * data object. */ void copy( @@ -250,15 +250,17 @@ class ArrayData * * Note that this routine assumes that the source array box region must * be shifted to be consistent with the destination (this) array box region. - * This routine will intersect the specified boxes with the destination box and - * shifted source box to find the regions of intersection. + * This routine will intersect the specified boxes with the destination box + * and shifted source box to find the regions of intersection. * * @param src Const reference to source array data object. * @param boxes Const reference to box list describing the spatial extents - * of the index space regions over which to perform the copy operation. + * of the index space regions over which to perform the copy + * operation. * Note: the boxes are in the destination index space. * @param src_shift Const reference to shift vector used to put the source - * array data box into the index space region of this array data object. + * array data box into the index space region of this array + * data object. */ void copy( @@ -284,16 +286,20 @@ class ArrayData * @param dst_depth Integer depth of destination array. * @param src Const reference to source array data object. * @param src_depth Integer depth of source array. - * @param box Const reference to box object describing the spatial extents - * of the index space region over which to perform the copy operation. - * Note: the box is in either the source or destination index space - * (which are assumed to be the same). + * @param box Const reference to box object describing the spatial + * extents of the index space region over which to perform + * the copy operation. + * Note: the box is in either the source or destination + * index space (which are assumed to be the same). + * + * @pre (0 <= dst_depth) && (dst_depth <= getDepth())) + * @pre (0 <= src_depth) && (src_depth <= src.getDepth()) */ void copyDepth( - int dst_depth, + unsigned int dst_depth, const ArrayData& src, - int src_depth, + unsigned int src_depth, const hier::Box& box); /*! @@ -307,9 +313,10 @@ class ArrayData * * @param src Const reference to source array data object. * @param box Const reference to box object describing the spatial extents - * of the index space region over which to perform the sum operation. - * Note: the box is in either the source or destination index space - * (which are assumed to be the same). + * of the index space region over which to perform the sum + * operation. + * Note: the box is in either the source or destination index + * space (which are assumed to be the same). */ void sum( @@ -322,15 +329,17 @@ class ArrayData * * Note that this routine assumes that the source array box region must * be shifted to be consistent with the destination (this) array box region. - * This routine will intersect the specified box with the destination box and - * shifted source box to find the region of intersection. + * This routine will intersect the specified box with the destination box + * and shifted source box to find the region of intersection. * * @param src Const reference to source array data object. * @param box Const reference to box object describing the spatial extents - * of the index space region over which to perform the sum operation. + * of the index space region over which to perform the sum + * operation. * Note: the box is in the destination index space. * @param src_shift Const reference to shift vector used to put the source - * array data box into the index space region of this array data object. + * array data box into the index space region of this array + * data object. */ void sum( @@ -344,15 +353,17 @@ class ArrayData * * Note that this routine assumes that the source array box region must * be shifted to be consistent with the destination (this) array box region. - * This routine will intersect the specified boxes with the destination box and - * shifted source box to find the regions of intersection. + * This routine will intersect the specified boxes with the destination box + * and shifted source box to find the regions of intersection. * * @param src Const reference to source array data object. * @param boxes Const reference to box list describing the spatial extents - * of the index space regions over which to perform the sum operation. + * of the index space regions over which to perform the sum + * operation. * Note: the boxes are in the destination index space. * @param src_shift Const reference to shift vector used to put the source - * array data box into the index space region of this array data object. + * array data box into the index space region of this array + * data object. */ void sum( @@ -373,8 +384,10 @@ class ArrayData * @param src_shift Const reference to vector used to shift the given * boxes into the index space region of this array data object. * Note: this argument is currently ignored. + * + * @pre (getDim() == src_shift.getDim()) */ - int + size_t getDataStreamSize( const hier::BoxContainer& boxes, const hier::IntVector& src_shift) const; @@ -394,7 +407,8 @@ class ArrayData * * Note: The shifted box must lie completely within the index space of this * array data object. When assertion checking is active, the routine will - * abort if the box is not contained in the index space of this array. + * abort if the shifted box is not contained in the index space of this + * array. */ void packStream( @@ -418,12 +432,12 @@ class ArrayData * @param dest_boxes Const reference to boxes describing the spatial extents * of the destination index space regions of interest. * @param src_shift Const reference to vector used to shift the given - * boxes into the index space region of this (source) array data - * object. + * boxes into the index space region of this (source) array + * data object. * - * Note: The shifted boxes must lie completely within the index space of this - * array. If compiled with assertions enabled, the routine will abort if - * the shifted boxes are not contained in the index space of this array. + * Note: The shifted boxes must lie completely within the index space of + * this array. If compiled with assertions enabled, the routine will abort + * if the shifted boxes are not contained in the index space of this array. */ void packStream( @@ -461,11 +475,11 @@ class ArrayData * Unpack data from the stream into the index regions specified. * * @param stream Reference to stream from which to unpack data. - * @param dest_boxes Const reference to box list describing the spatial extents - * of the destination index space regions of interest. + * @param dest_boxes Const reference to box list describing the spatial + * extents of the destination index space regions of interest. * @param src_offset Const reference to vector used to offset the given - * boxes into the index space region of some (source) array data - * object. Currently, this argument is ignored. + * boxes into the index space region of some (source) array + * data object. Currently, this argument is ignored. * * Note: The given boxes must lie completely within the index space of this * array data object. When assertion checking is active, the routine will @@ -478,7 +492,8 @@ class ArrayData const hier::IntVector& src_offset); /*! - * Unpack data from the stream and add to the array in the index region specified. + * Unpack data from the stream and add to the array in the index region + * specified. * * @param stream Reference to stream from which to unpack data. * @param dest_box Const reference to box describing the spatial extent @@ -498,14 +513,15 @@ class ArrayData const hier::IntVector& src_offset); /*! - * Unpack data from the stream and ad to the array in the index region specified. + * Unpack data from the stream and ad to the array in the index region + * specified. * * @param stream Reference to stream from which to unpack data. - * @param dest_boxes Const reference to box list describing the spatial extents - * of the destination index space regions of interest. + * @param dest_boxes Const reference to box list describing the spatial + * extents of the destination index space regions of interest. * @param src_offset Const reference to vector used to offset the given - * boxes into the index space region of some (source) array data - * object. Currently, this argument is ignored. + * boxes into the index space region of some (source) array + * data object. Currently, this argument is ignored. * * Note: The given boxes must lie completely within the index space of this * array. If compiled with assertions enabled, the routine will abort if @@ -534,63 +550,44 @@ class ArrayData /*! * Fill all array values associated with depth component d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( const TYPE& t, - const int d = 0); + const unsigned int d = 0); /*! * Fill all array values associated with depth component d * within the box with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( const TYPE& t, const hier::Box& box, - const int d = 0); + const unsigned int d = 0); /*! * Check to make sure that the class version and restart file - * version are equal. If so, read in data from database. This - * routine calls getSpecializedFromDatabase() to read in the - * proper data type. + * version are equal. If so, read in data from restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ void - getFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! - * Write out array data object data to database. This - * routine calls putSpecializedToDatabase() to read in the - * proper data type. The default behavior (boolean argument is - * false) is to put all data members in database. Otherwise, only - * the array contents are written out. + * Write out array data object data to restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ void - putUnregisteredToDatabase( - const boost::shared_ptr& database, - bool data_only = false) const; - - /*! - * Use specialized template method to get the correct behavior - * when reading in the array of data. - */ - void - getSpecializedFromDatabase( - const boost::shared_ptr& database); - - /*! - * Use specialized template method to get the correct behavior - * when writing out the array of data. - */ - void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Return the dimension of this object. @@ -598,21 +595,8 @@ class ArrayData const tbox::Dimension& getDim() const; - /** - * @brief Invalidate an array as opposed to initializing it. - * - * The box associated with the array will be set to empty so - * intersections will be the empty set. - * - */ - void - invalidateArray( - const tbox::Dimension& dim); - /** * @brief Returns true if the array is valid. - * - * Invalid state can be set using the invalidateArray method. */ bool isValid(); @@ -625,11 +609,17 @@ class ArrayData typedef ArrayDataIterator iterator; private: + // Unimplemented default constructor. + ArrayData(); + + // Unimplemented copy constructor. ArrayData( - const ArrayData&); // not implemented - void + const ArrayData&); + + // Unimplemented assignment operator. + ArrayData& operator = ( - const ArrayData&); // not implemented + const ArrayData&); /* * Static integer constant describing this class's version number. @@ -661,12 +651,25 @@ class ArrayData const TYPE* buffer, const hier::Box& box); - tbox::Dimension d_dim; + /*! + * @brief Compte index into d_array for data at index i and depth d. + * + * @param i Index of data + * @param d depth of data + * + * @pre (d >= 0) && (d < getDepth()) + * + * @post (index >= 0) && (index < getDepth() * getOffset()) + */ + size_t + getIndex( + const hier::Index& i, + unsigned int d) const; - int d_depth; - int d_offset; + unsigned int d_depth; + size_t d_offset; hier::Box d_box; - tbox::Array d_array; + std::vector d_array; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.C index 8608e393..53e07252 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: * ************************************************************************/ @@ -23,9 +23,9 @@ access( int depth) { MDA_Access > r( - array_data.getPointer(depth), - (const int *)array_data.getBox().lower(), - (const int *)array_data.getBox().upper()); + array_data.getPointer(depth), + &array_data.getBox().lower()[0], + &array_data.getBox().upper()[0]); return r; } @@ -36,9 +36,9 @@ access( int depth) { MDA_AccessConst > r( - array_data.getPointer(depth), - (const int *)array_data.getBox().lower(), - (const int *)array_data.getBox().upper()); + array_data.getPointer(depth), + &array_data.getBox().lower()[0], + &array_data.getBox().upper()[0]); return r; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.h index 05a83764..386210da 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataAccess.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Light weight array class. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.C index 5977044a..16278f6a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for array patch data types * ************************************************************************/ - -#ifndef included_pdat_ArrayDataIterator_C -#define included_pdat_ArrayDataIterator_C - #include "SAMRAI/pdat/ArrayDataIterator.h" namespace SAMRAI { @@ -23,8 +19,8 @@ ArrayDataIterator::ArrayDataIterator( d_box(box) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -43,11 +39,11 @@ ArrayDataIterator& ArrayDataIterator::operator ++ () { const tbox::Dimension& dim(d_box.getDim()); - d_index(0)++; - for (int i = 0; i < dim.getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -61,11 +57,11 @@ ArrayDataIterator::operator ++ ( { ArrayDataIterator tmp = *this; const tbox::Dimension& dim(d_box.getDim()); - d_index(0)++; - for (int i = 0; i < dim.getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -75,5 +71,3 @@ ArrayDataIterator::operator ++ ( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.h index 0f751e14..73e7cfbd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for array patch data types * ************************************************************************/ @@ -38,7 +38,7 @@ namespace pdat { * depending on your compiler. Many compilers are not smart enough to * optimize the looping constructs and indexing operations. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::Index */ @@ -49,7 +49,7 @@ class ArrayDataIterator * Constructor for the array data iterator. The iterator will enumerate * the indices in the argument box. */ - explicit ArrayDataIterator( + ArrayDataIterator( const hier::Box& box, bool begin); @@ -89,7 +89,7 @@ class ArrayDataIterator * Extract pointer to the index corresponding to the iterator position in * the box. */ - const hier::Index* + const hier::Index * operator -> () const { return &d_index; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.C index d2eb9b20..e0638ff1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated array data looping operations supporting patch data types * ************************************************************************/ @@ -34,17 +34,14 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( const ArrayData& src, const hier::Box& opbox, const hier::IntVector& src_shift, - int dst_start_depth, - int src_start_depth, - int num_depth, + unsigned int dst_start_depth, + unsigned int src_start_depth, + unsigned int num_depth, const OP& op) { - TBOX_DIM_ASSERT_CHECK_ARGS4(dst, src, opbox, src_shift); - TBOX_ASSERT(num_depth >= 0); - TBOX_ASSERT((0 <= dst_start_depth) && - (dst_start_depth + num_depth <= dst.getDepth())); - TBOX_ASSERT((0 <= src_start_depth) && - (src_start_depth + num_depth <= src.getDepth())); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst, src, opbox, src_shift); + TBOX_ASSERT((dst_start_depth + num_depth <= dst.getDepth())); + TBOX_ASSERT((src_start_depth + num_depth <= src.getDepth())); const tbox::Dimension& dim(dst.getDim()); @@ -54,19 +51,19 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( const hier::Box& dst_box(dst.getBox()); const hier::Box& src_box(src.getBox()); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dst_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dim.getValue(); i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dst_w[SAMRAI::MAX_DIM_VAL]; + int src_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { box_w[i] = opbox.numberCells(i); dst_w[i] = dst_box.numberCells(i); src_w[i] = src_box.numberCells(i); dim_counter[i] = 0; } - const int dst_offset = dst.getOffset(); - const int src_offset = src.getOffset(); + const size_t dst_offset = dst.getOffset(); + const size_t src_offset = src.getOffset(); /* * Data on the opbox can be decomposed into a set of @@ -78,25 +75,25 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( * data items in each array section to be copied. */ - const int num_d0_blocks = opbox.size() / box_w[0]; + const int num_d0_blocks = static_cast(opbox.size() / box_w[0]); - int dst_begin = dst_box.offset(opbox.lower()) + size_t dst_begin = dst_box.offset(opbox.lower()) + dst_start_depth * dst_offset; - int src_begin = src_box.offset(opbox.lower() - src_shift) + size_t src_begin = src_box.offset(opbox.lower() - src_shift) + src_start_depth * src_offset; /* * Loop over the depth sections of the data arrays. */ - for (int d = 0; d < num_depth; ++d) { + for (unsigned int d = 0; d < num_depth; ++d) { - int dst_counter = dst_begin; - int src_counter = src_begin; + size_t dst_counter = dst_begin; + size_t src_counter = src_begin; - int dst_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int src_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dim.getValue(); nd++) { + size_t dst_b[SAMRAI::MAX_DIM_VAL]; + size_t src_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dim.getValue(); ++nd) { dst_b[nd] = dst_counter; src_b[nd] = src_counter; } @@ -105,9 +102,9 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { op(dst_ptr[dst_counter + i0], src_ptr[src_counter + i0]); } int dim_jump = 0; @@ -117,7 +114,7 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( * beginning array index for the next block. */ - for (int j = 1; j < dim.getValue(); j++) { + for (tbox::Dimension::dir_t j = 1; j < dim.getValue(); ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -131,14 +128,14 @@ void ArrayDataOperationUtilities::doArrayDataOperationOnBox( int dst_step = 1; int src_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dst_step *= dst_w[k]; src_step *= src_w[k]; } dst_counter = dst_b[dim_jump - 1] + dst_step; src_counter = src_b[dim_jump - 1] + src_step; - for (int m = 0; m < dim_jump; m++) { + for (int m = 0; m < dim_jump; ++m) { dst_b[m] = dst_counter; src_b[m] = src_counter; } @@ -177,8 +174,8 @@ void ArrayDataOperationUtilities::doArrayDataBufferOperationOnBox( bool src_is_buffer, const OP& op) { - TBOX_DIM_ASSERT_CHECK_ARGS2(arraydata, opbox); - TBOX_ASSERT(buffer != (const TYPE *)NULL); + TBOX_ASSERT_OBJDIM_EQUALITY2(arraydata, opbox); + TBOX_ASSERT(buffer != 0); TBOX_ASSERT(opbox.isSpatiallyEqual((opbox * arraydata.getBox()))); const tbox::Dimension& dim(arraydata.getDim()); @@ -190,19 +187,19 @@ void ArrayDataOperationUtilities::doArrayDataBufferOperationOnBox( (src_is_buffer ? buffer : arraydata.getPointer()); const hier::Box& array_d_box(arraydata.getBox()); - const int array_d_depth = arraydata.getDepth(); + const unsigned int array_d_depth = arraydata.getDepth(); - int box_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dat_w[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int dim_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dim.getValue(); i++) { + int box_w[SAMRAI::MAX_DIM_VAL]; + int dat_w[SAMRAI::MAX_DIM_VAL]; + int dim_counter[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { box_w[i] = opbox.numberCells(i); dat_w[i] = array_d_box.numberCells(i); dim_counter[i] = 0; } - const int dat_offset = arraydata.getOffset(); - const int buf_offset = box_w[0]; + const size_t dat_offset = arraydata.getOffset(); + const size_t buf_offset = box_w[0]; /* * Data on the opbox can be decomposed into a set of @@ -214,35 +211,35 @@ void ArrayDataOperationUtilities::doArrayDataBufferOperationOnBox( * data items in each array section to be copied. */ - const int num_d0_blocks = opbox.size() / box_w[0]; + const int num_d0_blocks = static_cast(opbox.size() / box_w[0]); - int dat_begin = array_d_box.offset(opbox.lower()); - int buf_begin = 0; + size_t dat_begin = array_d_box.offset(opbox.lower()); + size_t buf_begin = 0; /* * Loop over the depth sections of the data arrays. */ - for (int d = 0; d < array_d_depth; d++) { + for (unsigned int d = 0; d < array_d_depth; ++d) { - int dat_counter = dat_begin; - int buf_counter = buf_begin; + size_t dat_counter = dat_begin; + size_t buf_counter = buf_begin; - int& dst_counter = (src_is_buffer ? dat_counter : buf_counter); - int& src_counter = (src_is_buffer ? buf_counter : dat_counter); + size_t& dst_counter = (src_is_buffer ? dat_counter : buf_counter); + size_t& src_counter = (src_is_buffer ? buf_counter : dat_counter); - int dat_b[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int nd = 0; nd < dim.getValue(); nd++) { - dat_b[nd] = dat_counter; + int dat_b[SAMRAI::MAX_DIM_VAL]; + for (tbox::Dimension::dir_t nd = 0; nd < dim.getValue(); ++nd) { + dat_b[nd] = static_cast(dat_counter); } /* * Loop over each contiguous block of data. */ - for (int nb = 0; nb < num_d0_blocks; nb++) { + for (int nb = 0; nb < num_d0_blocks; ++nb) { - for (int i0 = 0; i0 < box_w[0]; i0++) { + for (int i0 = 0; i0 < box_w[0]; ++i0) { op(dst_ptr[dst_counter + i0], src_ptr[src_counter + i0]); } int dim_jump = 0; @@ -252,7 +249,7 @@ void ArrayDataOperationUtilities::doArrayDataBufferOperationOnBox( * beginning array index for the next block. */ - for (int j = 1; j < dim.getValue(); j++) { + for (int j = 1; j < dim.getValue(); ++j) { if (dim_counter[j] < box_w[j] - 1) { ++dim_counter[j]; dim_jump = j; @@ -265,13 +262,13 @@ void ArrayDataOperationUtilities::doArrayDataBufferOperationOnBox( if (dim_jump > 0) { int dat_step = 1; - for (int k = 0; k < dim_jump; k++) { + for (int k = 0; k < dim_jump; ++k) { dat_step *= dat_w[k]; } dat_counter = dat_b[dim_jump - 1] + dat_step; - for (int m = 0; m < dim_jump; m++) { - dat_b[m] = dat_counter; + for (int m = 0; m < dim_jump; ++m) { + dat_b[m] = static_cast(dat_counter); } } // if dim_jump > 0 diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.h index b46dbf13..c65c4d3c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/ArrayDataOperationUtilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated array data looping operations supporting patch data types * ************************************************************************/ @@ -23,9 +23,9 @@ template class ArrayData; /*! - * @brief Struct ArrayDataOperationUtilities provides + * @brief Struct ArrayDataOperationUtilities provides * generic looping operations for all array-based patch data types. - * The operations are templated on spatial dimension, data type, + * The operations are templated on data type * and the operation that will be performed on individual array * elements in the innermost loop. * @@ -37,24 +37,34 @@ class ArrayDataOperationUtilities { public: /*! - * Perform operation on a subset of data components of source and destination - * array data objects and put results in destination array data object. + * Perform operation on a subset of data components of source and + * destination array data objects and put results in destination array data + * object. * * @param dst Reference to destination array data object. * @param src Const reference to source array data object. - * @param opbox Const reference to Box indicating index space region of operation. - * @param src_shift Const reference to IntVector indicating shift required to put - * source index space region into destination index space region. + * @param opbox Const reference to Box indicating index space region of + * operation. + * @param src_shift Const reference to IntVector indicating shift required + * to put source index space region into destination index + * space region. * @param dst_start_depth Integer specifying starting depth component of * operation in destination array. * @param src_start_depth Integer specifying starting depth component of * operation in source array. - * @param num_depth Integer number of depth components on which to perform operation. - * @param op Const reference to object that performs operations on individual - * data array elements. + * @param num_depth Integer number of depth components on which to perform + * operation. + * @param op Const reference to object that performs operations on + * individual data array elements. * - * When assertion checking is active, assertion will result when any of the depth-related - * arguments are out-of-bounds for the given array data objects. + * @pre (dst.getDim() == src.getDim()) && + * (dst.getDim() == opbox.getDim()) && + * (dst.getDim() == src_shift.getDim()) + * @pre num_depth >= 0 + * @pre (0 <= dst_start_depth) && + * (dst_start_depth + num_depth <= dst.getDepth()) + * @pre (0 <= src_start_depth) && + * (src_start_depth + num_depth <= src.getDepth()) */ static void doArrayDataOperationOnBox( @@ -62,27 +72,30 @@ class ArrayDataOperationUtilities const ArrayData& src, const hier::Box& opbox, const hier::IntVector& src_shift, - int dst_start_depth, - int src_start_depth, - int num_depth, + unsigned int dst_start_depth, + unsigned int src_start_depth, + unsigned int num_depth, const OP& op); /*! - * Perform operation on all data components of array data object and corresponding - * buffer data, putting results in either the array data object or buffer. + * Perform operation on all data components of array data object and + * corresponding buffer data, putting results in either the array data + * object or buffer. * * @param arraydata Const reference to array data object. * @param buffer Const pointer to first element in buffer. * @param opbox Const reference to Box indicating operation region in * index space of array data object. - * @param src_is_buffer Boolean value indicating whether buffer is source data - * for operation; if true results will be placed in array - * data object, otherwise results will go in buffer. - * @param op Const reference to object that performs operations on individual - * data array elements. + * @param src_is_buffer Boolean value indicating whether buffer is source + * data for operation; if true results will be placed + * in array data object, otherwise results will go in + * buffer. + * @param op Const reference to object that performs operations on + * individual data array elements. * - * When assertion checking is active, assertion will result when buffer pointer - * is null or operation box is not the same as the array data box. + * @pre arraydata.getDim() == opbox.getDim() + * @pre buffer != 0 + * @pre opbox.isSpatiallyEqual(opbox * arraydata.getBox()) */ static void doArrayDataBufferOperationOnBox( @@ -96,10 +109,10 @@ class ArrayDataOperationUtilities ArrayDataOperationUtilities(); ~ArrayDataOperationUtilities(); ArrayDataOperationUtilities( - const ArrayDataOperationUtilities&); - void + const ArrayDataOperationUtilities&); + ArrayDataOperationUtilities& operator = ( - const ArrayDataOperationUtilities&); + const ArrayDataOperationUtilities&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.C index 9e224083..c9997983 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_CellComplexConstantRefine_C -#define included_pdat_CellComplexConstantRefine_C - #include "SAMRAI/pdat/CellComplexConstantRefine.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" @@ -37,14 +33,14 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefcellcplx1d, CONREFCELLCPLX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellcplx1d, CONREFCELLCPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine2d.f: -void F77_FUNC(conrefcellcplx2d, CONREFCELLCPLX2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellcplx2d, CONREFCELLCPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(conrefcellcplx2d, CONREFCELLCPLX2D) (const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine3d.f: -void F77_FUNC(conrefcellcplx3d, CONREFCELLCPLX3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellcplx3d, CONREFCELLCPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,9 +64,8 @@ void F77_FUNC(conrefcellcplx3d, CONREFCELLCPLX3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -CellComplexConstantRefine::CellComplexConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +CellComplexConstantRefine::CellComplexConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -86,9 +81,9 @@ CellComplexConstantRefine::getOperatorPriority() const } hier::IntVector -CellComplexConstantRefine::getStencilWidth() const +CellComplexConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -100,13 +95,13 @@ CellComplexConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const CellOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -126,41 +121,41 @@ CellComplexConstantRefine::refine( const hier::IntVector& ratio) const { boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, fine, coarse, fine_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(fine, coarse, fine_box, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conrefcellcplx1d, CONREFCELLCPLX1D) (ifirstc(0), ilastc(0), + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); + + for (int d = 0; d < fdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conrefcellcplx1d, CONREFCELLCPLX1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), filo(0), fihi(0), &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conrefcellcplx2d, CONREFCELLCPLX2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conrefcellcplx2d, CONREFCELLCPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -168,8 +163,8 @@ CellComplexConstantRefine::refine( &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conrefcellcplx3d, CONREFCELLCPLX3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conrefcellcplx3d, CONREFCELLCPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -191,4 +186,3 @@ CellComplexConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.h index cefce883..15d640d8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered complex data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -40,8 +40,7 @@ class CellComplexConstantRefine: /** * Uninteresting default constructor. */ - explicit CellComplexConstantRefine( - const tbox::Dimension& dim); + CellComplexConstantRefine(); /** * Uninteresting virtual destructor. @@ -60,7 +59,8 @@ class CellComplexConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -69,6 +69,8 @@ class CellComplexConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.C index ed71b8ac..39756d0b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered complex data. * ************************************************************************/ - -#ifndef included_pdat_CellComplexLinearTimeInterpolateOp_C -#define included_pdat_CellComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -21,7 +17,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -35,7 +31,7 @@ extern "C" { #pragma warning (disable:1419) #endif // in lintimint1d.f: -void F77_FUNC(lintimeintcellcmplx1d, LINTIMEINTCELLCMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellcmplx1d, LINTIMEINTCELLCMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -44,7 +40,7 @@ void F77_FUNC(lintimeintcellcmplx1d, LINTIMEINTCELLCMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintcellcmplx2d, LINTIMEINTCELLCMPLX2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellcmplx2d, LINTIMEINTCELLCMPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintcellcmplx2d, LINTIMEINTCELLCMPLX2D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintcellcmplx3d, LINTIMEINTCELLCMPLX3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellcmplx3d, LINTIMEINTCELLCMPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,30 +89,30 @@ CellComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const CellData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const CellData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); CellData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -135,9 +131,9 @@ CellComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintcellcmplx1d, LINTIMEINTCELLCMPLX1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellcmplx1d, LINTIMEINTCELLCMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -147,7 +143,7 @@ CellComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintcellcmplx2d, LINTIMEINTCELLCMPLX2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellcmplx2d, LINTIMEINTCELLCMPLX2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -157,7 +153,7 @@ CellComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintcellcmplx3d, LINTIMEINTCELLCMPLX3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellcmplx3d, LINTIMEINTCELLCMPLX3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -181,4 +177,3 @@ CellComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.h index c54e133a..1e59b446 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered complex data. * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -49,6 +49,18 @@ class CellComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.C index 606237ea..865d4f1a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated cell centered patch data type * ************************************************************************/ @@ -17,6 +17,7 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/pdat/CellOverlap.h" +#include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -33,6 +34,9 @@ namespace pdat { template const int CellData::PDAT_CELLDATA_VERSION = 1; +template +boost::shared_ptr CellData::t_copy; + /* ************************************************************************* * @@ -49,7 +53,7 @@ CellData::getSizeOfData( int depth, const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); const hier::Box ghost_box = hier::Box::grow(box, ghosts); @@ -71,46 +75,21 @@ CellData::CellData( int depth, const hier::IntVector& ghosts): hier::PatchData(box, ghosts), - d_depth(depth), - d_data() + d_depth(depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); - d_data.initializeArray(getGhostBox(), depth); -} + t_copy = tbox::TimerManager::getManager()-> + getTimer("pdat::CellData::copy"); -template -CellData::~CellData() -{ + d_data.reset(new ArrayData(getGhostBox(), depth)); } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - template -CellData::CellData( - const CellData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()), - d_data() -{ - NULL_USE(foo); -} - -template -void -CellData::operator = ( - const CellData& foo) +CellData::~CellData() { - NULL_USE(foo); } template @@ -121,23 +100,23 @@ CellData::getDepth() const } template -TYPE* +TYPE * CellData::getPointer( int depth) { TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data.getPointer(depth); + return d_data->getPointer(depth); } template -const TYPE* +const TYPE * CellData::getPointer( int depth) const { TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data.getPointer(depth); + return d_data->getPointer(depth); } template @@ -146,10 +125,10 @@ CellData::operator () ( const CellIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data(i, depth); + return (*d_data)(i, depth); } template @@ -158,24 +137,24 @@ CellData::operator () ( const CellIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data(i, depth); + return (*d_data)(i, depth); } template ArrayData& CellData::getArrayData() { - return d_data; + return *d_data; } template const ArrayData& CellData::getArrayData() const { - return d_data; + return *d_data; } /* @@ -192,16 +171,15 @@ void CellData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_data, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*d_data, src); - const CellData* t_src = - dynamic_cast *>(&src); - if (t_src == NULL) { + const CellData* t_src = dynamic_cast *>(&src); + if (t_src == 0) { src.copy2(*this); } else { - const hier::Box box = d_data.getBox() * t_src->d_data.getBox(); + const hier::Box box = d_data->getBox() * t_src->d_data->getBox(); if (!box.empty()) { - d_data.copy(t_src->d_data, box); + d_data->copy(*(t_src->d_data), box); } } } @@ -211,15 +189,15 @@ void CellData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_data, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*d_data, dst); - CellData* t_dst = dynamic_cast *>(&dst); + CellData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - const hier::Box box = d_data.getBox() * t_dst->d_data.getBox(); + const hier::Box box = d_data->getBox() * t_dst->d_data->getBox(); if (!box.empty()) { - t_dst->d_data.copy(d_data, box); + t_dst->d_data->copy(*d_data, box); } } @@ -238,24 +216,24 @@ CellData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - const CellData* t_src = - dynamic_cast *>(&src); + t_copy->start(); + const CellData* t_src = dynamic_cast *>(&src); - const CellOverlap* t_overlap = - dynamic_cast(&overlap); + const CellOverlap* t_overlap = dynamic_cast(&overlap); - if ((t_src == NULL) || (t_overlap == NULL)) { + if ((t_src == 0) || (t_overlap == 0)) { src.copy2(*this, overlap); } else { if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - d_data.copy(t_src->d_data, + d_data->copy(*(t_src->d_data), t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { copyWithRotation(*t_src, *t_overlap); } } + t_copy->stop(); } template @@ -264,17 +242,16 @@ CellData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - CellData* t_dst = dynamic_cast *>(&dst); - const CellOverlap* t_overlap = - dynamic_cast(&overlap); + CellData* t_dst = CPP_CAST *>(&dst); + const CellOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - t_dst->d_data.copy(d_data, + t_dst->d_data->copy(*d_data, t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { @@ -288,9 +265,8 @@ CellData::copyOnBox( const CellData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); - const hier::Box cell_box = CellGeometry::toCellBox(box); - d_data.copy(src.getArrayData(), cell_box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); + d_data->copy(src.getArrayData(), box); } template @@ -320,7 +296,7 @@ CellData::copyWithRotation( hier::Transformation::calculateReverseShift( back_shift, shift, rotate); - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -330,8 +306,8 @@ CellData::copyWithRotation( const int depth = ((getDepth() < src.getDepth()) ? getDepth() : src.getDepth()); - CellData::iterator ciend(copybox, false); - for (CellData::iterator ci(copybox, true); + CellData::iterator ciend(CellGeometry::end(copybox)); + for (CellData::iterator ci(CellGeometry::begin(copybox)); ci != ciend; ++ci) { const CellIndex& dst_index = *ci; @@ -339,8 +315,8 @@ CellData::copyWithRotation( hier::Transformation::rotateIndex(src_index, back_rotate); src_index += back_shift; - for (int d = 0; d < depth; d++) { - d_data(dst_index, d) = src.d_data(src_index, d); + for (int d = 0; d < depth; ++d) { + (*d_data)(dst_index, d) = (*src.d_data)(src_index, d); } } } @@ -364,11 +340,11 @@ CellData::copyDepth( const CellData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_data, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*d_data, src); - const hier::Box box = d_data.getBox() * src.d_data.getBox(); + const hier::Box box = d_data->getBox() * src.d_data->getBox(); if (!box.empty()) { - d_data.copyDepth(dst_depth, src.d_data, src_depth, box); + d_data->copyDepth(dst_depth, *(src.d_data), src_depth, box); } } @@ -389,16 +365,16 @@ CellData::canEstimateStreamSizeFromBox() const } template -int +size_t CellData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const CellOverlap* t_overlap = - dynamic_cast(&overlap); + const CellOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - return d_data.getDataStreamSize(t_overlap->getDestinationBoxContainer(), + return d_data->getDataStreamSize( + t_overlap->getDestinationBoxContainer(), t_overlap->getSourceOffset()); } @@ -417,14 +393,13 @@ CellData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const CellOverlap* t_overlap = - dynamic_cast(&overlap); + const CellOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - d_data.packStream(stream, t_overlap->getDestinationBoxContainer(), + d_data->packStream(stream, t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { packWithRotation(stream, *t_overlap); @@ -460,11 +435,11 @@ CellData::packWithRotation( const int depth = getDepth(); - const int size = depth * overlap_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = depth * overlap_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); int i = 0; - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -472,23 +447,23 @@ CellData::packWithRotation( if (!copybox.empty()) { - for (int d = 0; d < depth; d++) { - CellData::iterator ciend(copybox, false); - for (CellData::iterator ci(copybox, true); + for (int d = 0; d < depth; ++d) { + CellData::iterator ciend(CellGeometry::end(copybox)); + for (CellData::iterator ci(CellGeometry::begin(copybox)); ci != ciend; ++ci) { CellIndex src_index(*ci); hier::Transformation::rotateIndex(src_index, back_rotate); src_index += back_shift; - buffer[i] = d_data(src_index, d); - i++; + buffer[i] = (*d_data)(src_index, d); + ++i; } } } } - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } template @@ -497,13 +472,88 @@ CellData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { + const CellOverlap* t_overlap = CPP_CAST(&overlap); + + TBOX_ASSERT(t_overlap != 0); + + d_data->unpackStream(stream, t_overlap->getDestinationBoxContainer(), + t_overlap->getSourceOffset()); +} + +/* + ************************************************************************* + * * + * Add source data to the destination according to overlap descriptor. * + * * + ************************************************************************* + */ + +template +void CellData::sum( + const hier::PatchData& src, + const hier::BoxOverlap& overlap) +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); + const CellOverlap* t_overlap = dynamic_cast(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - d_data.unpackStream(stream, t_overlap->getDestinationBoxContainer(), - t_overlap->getSourceOffset()); + const CellData* t_onode_src = + dynamic_cast *>(&src); + + // NOTE: We assume this operation is only needed to + // copy and add data to another cell data + // object. If we ever need to provide this for node + // data or other flavors of the copy operation, we + // should refactor the routine similar to the way + // the regular copy operations are implemented. + if (t_onode_src == 0) { + TBOX_ERROR("CellData::sum error!\n" + << "Can copy and add only from CellData " + << "of the same dim and TYPE."); + } else { + + const hier::IntVector& src_offset(t_overlap->getSourceOffset()); + const hier::BoxContainer& box_container( + t_overlap->getDestinationBoxContainer()); + const ArrayData& src_array(*t_onode_src->d_data); + if (d_data->isInitialized()) { + d_data->sum(src_array, box_container, src_offset); + } + } +} + +/* + ************************************************************************* + * * + * Unpack data from the message stream and add to this cell data * + * object using the index space in the overlap descriptor. * + * * + ************************************************************************* + */ + +template +void CellData::unpackStreamAndSum( + tbox::MessageStream& stream, + const hier::BoxOverlap& overlap) +{ + const CellOverlap* t_overlap = + dynamic_cast(&overlap); + + TBOX_ASSERT(t_overlap != 0); + + const hier::BoxContainer& dst_boxes( + t_overlap->getDestinationBoxContainer()); + const hier::IntVector& src_offset(t_overlap->getSourceOffset()); + for (hier::BoxContainer::const_iterator dst_box(dst_boxes.begin()); + dst_box != dst_boxes.end(); ++dst_box) { + const hier::Box intersect(*dst_box * d_data->getBox()); + if (!intersect.empty()) { + d_data->unpackStreamAndSum(stream, intersect, src_offset); + } + } } template @@ -515,7 +565,7 @@ CellData::fill( TBOX_ASSERT((d >= 0) && (d < d_depth)); - d_data.fill(t, d); + d_data->fill(t, d); } template @@ -527,7 +577,7 @@ CellData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - d_data.fill(t, box, d); + d_data->fill(t, box, d); } template @@ -535,7 +585,7 @@ void CellData::fillAll( const TYPE& t) { - d_data.fillAll(t); + d_data->fillAll(t); } template @@ -544,8 +594,8 @@ CellData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - d_data.fillAll(t, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + d_data->fillAll(t, box); } /* @@ -564,9 +614,9 @@ CellData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; print(box, d, os, prec); } @@ -580,15 +630,15 @@ CellData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); os.precision(prec); - CellIterator iend(box, false); - for (CellIterator i(box, true); i != iend; ++i) { + CellIterator iend(CellGeometry::end(box)); + for (CellIterator i(CellGeometry::begin(box)); i != iend; ++i) { os << "array" << *i << " = " - << d_data(*i, depth) << std::endl << std::flush; + << (*d_data)(*i, depth) << std::endl << std::flush; os << std::flush; } } @@ -597,7 +647,7 @@ CellData::print( ************************************************************************* * * Checks that class version and restart file version are equal. If so, - * reads in the d_depth data member to the database. Then tells + * reads in the d_depth data member to the restart database. Then tells * d_data to read itself in from the database. * ************************************************************************* @@ -605,44 +655,48 @@ CellData::print( template void -CellData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +CellData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("PDAT_CELLDATA_VERSION"); + hier::PatchData::getFromRestart(restart_db); + + int ver = restart_db->getInteger("PDAT_CELLDATA_VERSION"); if (ver != PDAT_CELLDATA_VERSION) { - TBOX_ERROR("CellData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("CellData::getFromRestart error...\n" << "Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); - d_data.getFromDatabase(database->getDatabase("d_data")); + d_data->getFromRestart(restart_db->getDatabase("d_data")); } /* ************************************************************************* * * Write out the class version number, d_depth data member to the - * database. Then tells d_data to write itself to the database. + * restart database. Then tells d_data to write itself to the database. * ************************************************************************* */ template void -CellData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +CellData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_CELLDATA_VERSION", PDAT_CELLDATA_VERSION); + restart_db->putInteger("PDAT_CELLDATA_VERSION", PDAT_CELLDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); - d_data.putUnregisteredToDatabase(database->putDatabase("d_data")); + d_data->putToRestart(restart_db->putDatabase("d_data")); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.h index c63e47f2..30a1d611 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated cell centered patch data type * ************************************************************************/ @@ -16,18 +16,19 @@ #include "SAMRAI/pdat/ArrayData.h" #include "SAMRAI/pdat/CellIndex.h" #include "SAMRAI/pdat/CellIterator.h" +#include "SAMRAI/pdat/CellOverlap.h" #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class CellData provides an implementation for data defined + * @brief Class CellData provides an implementation for data defined * at cell centers on AMR patches. It is derived from the * hier::PatchData interface common to all SAMRAI patch data types. * Given a CELL-centered AMR index space box, a cell data object represents @@ -41,7 +42,7 @@ namespace pdat { * Memory allocation is in column-major ordering (e.g., Fortran style) * so that the leftmost index runs fastest in memory. For example, a * three-dimensional cell data object defined over a box - * [l0:u0,l1:u1,l2:u2] holds a data array dimensioned as + * [l0:u0,l1:u1,l2:u2] holds a data array sized as * \verbatim * * [ l0 : u0 , @@ -54,12 +55,12 @@ namespace pdat { * The data type TYPE must define a default constructor (i.e., taking no * arguments) and also the copy assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::CellDataFactory - * @see pdat::CellIndex - * @see pdat::CellIterator - * @see pdat::CellGeometry + * @see CellDataFactory + * @see CellIndex + * @see CellIterator + * @see CellGeometry */ template @@ -82,6 +83,9 @@ class CellData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the node data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 */ static size_t getSizeOfData( @@ -100,6 +104,10 @@ class CellData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the node data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ CellData( const hier::Box& box, @@ -121,6 +129,8 @@ class CellData:public hier::PatchData /*! * @brief Get a pointer to the beginning of a depth * component of the cell centered array. + * + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -129,6 +139,8 @@ class CellData:public hier::PatchData /*! * @brief Get a const pointer to the beginning of a depth * component of the cell centered array. + * + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -137,6 +149,9 @@ class CellData:public hier::PatchData /*! * @brief Return reference to cell data entry corresponding * to a given cell index and depth. + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -146,6 +161,9 @@ class CellData:public hier::PatchData /*! * @brief Return a const reference to cell data entry corresponding * to a given cell index and depth. + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -175,6 +193,8 @@ class CellData:public hier::PatchData * both the source and destination). Currently, source data must be * CellData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getArrayData().getDim() == src.getDim() */ virtual void copy( @@ -189,6 +209,9 @@ class CellData:public hier::PatchData * both the source and destination). Currently, destination data must be * CellData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getArrayData().getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -214,6 +237,9 @@ class CellData:public hier::PatchData * Currently, destination data must be CellData of the same DIM and TYPE * and the overlap must be a CellOverlap of the same DIM. * If not, then an unrecoverable error results. + * + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy2( @@ -223,6 +249,8 @@ class CellData:public hier::PatchData /*! * @brief Copy data from source to destination (i.e., this) * patch data object on the given CELL-centered AMR index box. + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copyOnBox( @@ -233,6 +261,8 @@ class CellData:public hier::PatchData * @brief Fast copy (i.e., source and this cell data objects are * defined over the same box) to this destination cell data object * from the given source cell data object at the specified depths. + * + * @pre getArrayData.getDim() == src.getDim() */ virtual void copyDepth( @@ -258,8 +288,10 @@ class CellData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -267,6 +299,8 @@ class CellData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be a * CellOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -277,14 +311,41 @@ class CellData:public hier::PatchData * @brief Unpack data from stream into this patch data object * over the specified box overlap region. The overlap must be a * CellOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap); + /*! + * @brief Add data from source to destination (i.e., this) + * patch data object on the given overlap. + * + * Currently, source data must be CellData of the same DIM and + * TYPE and the overlap must be an CellOverlap of the same DIM. + * If not, then an unrecoverable error results. + */ + virtual void + sum( + const hier::PatchData& src, + const hier::BoxOverlap& overlap); + + /*! + * @brief Unpack data from stream and add into this patch data object + * over the specified box overlap region. The overlap must be an + * CellOverlap of the same DIM. + */ + virtual void + unpackStreamAndSum( + tbox::MessageStream& stream, + const hier::BoxOverlap& overlap); + /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -293,6 +354,8 @@ class CellData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -309,6 +372,8 @@ class CellData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -324,10 +389,12 @@ class CellData:public hier::PatchData * and will be converted to cell index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -346,10 +413,13 @@ class CellData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -360,23 +430,23 @@ class CellData:public hier::PatchData /*! * Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * The cell iterator iterates over the elements of a cell @@ -391,11 +461,14 @@ class CellData:public hier::PatchData */ static const int PDAT_CELLDATA_VERSION; + // Unimplemented copy constructor CellData( - const CellData&); // not implemented - void + const CellData&); + + // Unimplemented assignment operator + CellData operator = ( - const CellData&); // not implemented + const CellData&); void copyWithRotation( @@ -408,7 +481,10 @@ class CellData:public hier::PatchData const CellOverlap& overlap) const; int d_depth; - ArrayData d_data; + + boost::shared_ptr > d_data; + + static boost::shared_ptr t_copy; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.C index 0a0ba098..60210b00 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating cell data objects * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* @@ -67,7 +67,7 @@ boost::shared_ptr CellDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >(d_depth, ghosts); } @@ -85,12 +85,12 @@ boost::shared_ptr CellDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_depth, - d_ghosts); + patch.getBox(), + d_depth, + d_ghosts); } /* @@ -106,7 +106,7 @@ boost::shared_ptr CellDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -131,7 +131,7 @@ size_t CellDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(CellData)); @@ -154,7 +154,7 @@ bool CellDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -162,8 +162,8 @@ CellDataFactory::validCopyTo( * Only valid option is CellData. */ boost::shared_ptr > cdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (cdf) { valid_copy = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.h index 69109b8f..67a7c4e8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating cell data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::CellData - * @see pdat::PatchDataFactory + * @see CellData + * @see PatchDataFactory */ template @@ -43,6 +43,9 @@ class CellDataFactory:public hier::PatchDataFactory * The default constructor for the cell data factory class. The ghost * cell width and depth (number of components) arguments give the defaults * for all cell data objects created with this factory. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ CellDataFactory( int depth, @@ -62,6 +65,8 @@ class CellDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -71,6 +76,8 @@ class CellDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete cell data object. * The default information about the object (e.g., ghost cell width) * is taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -80,6 +87,8 @@ class CellDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr @@ -96,6 +105,8 @@ class CellDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the cell data object, * including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -105,7 +116,7 @@ class CellDataFactory:public hier::PatchDataFactory * Return a boolean true value indicating that the cell data quantities will * always be treated as though fine values represent them on coarse-fine * interfaces. - * See the CellVariable class header file for more information. + * See the CellVariable class header file for more information. */ bool fineBoundaryRepresentsVariable() const; @@ -122,6 +133,8 @@ class CellDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this CellDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is a CellDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.C index 341f3336..ee45c761 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_CellDoubleConstantRefine_C -#define included_pdat_CellDoubleConstantRefine_C - #include "SAMRAI/pdat/CellDoubleConstantRefine.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" @@ -35,14 +31,14 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefcelldoub1d, CONREFCELLDOUB1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcelldoub1d, CONREFCELLDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in conrefine2d.f: -void F77_FUNC(conrefcelldoub2d, CONREFCELLDOUB2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcelldoub2d, CONREFCELLDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -50,7 +46,7 @@ void F77_FUNC(conrefcelldoub2d, CONREFCELLDOUB2D) (const int&, const int&, const int *, const double *, double *); // in conrefine3d.f: -void F77_FUNC(conrefcelldoub3d, CONREFCELLDOUB3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcelldoub3d, CONREFCELLDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,9 +62,8 @@ void F77_FUNC(conrefcelldoub3d, CONREFCELLDOUB3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -CellDoubleConstantRefine::CellDoubleConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +CellDoubleConstantRefine::CellDoubleConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -83,9 +78,9 @@ CellDoubleConstantRefine::getOperatorPriority() const } hier::IntVector -CellDoubleConstantRefine::getStencilWidth() const +CellDoubleConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -97,13 +92,13 @@ CellDoubleConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const CellOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -123,41 +118,41 @@ CellDoubleConstantRefine::refine( const hier::IntVector& ratio) const { boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, fine, coarse, fine_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(fine, coarse, fine_box, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conrefcelldoub1d, CONREFCELLDOUB1D) (ifirstc(0), ilastc(0), + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); + + for (int d = 0; d < fdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conrefcelldoub1d, CONREFCELLDOUB1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), filo(0), fihi(0), &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conrefcelldoub2d, CONREFCELLDOUB2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conrefcelldoub2d, CONREFCELLDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -165,8 +160,8 @@ CellDoubleConstantRefine::refine( &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conrefcelldoub3d, CONREFCELLDOUB3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conrefcelldoub3d, CONREFCELLDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -188,4 +183,3 @@ CellDoubleConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.h index dbce391a..0518a32e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CellDoubleConstantRefine: /** * Uninteresting default constructor. */ - explicit CellDoubleConstantRefine( - const tbox::Dimension& dim); + CellDoubleConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CellDoubleConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CellDoubleConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.C index 6715203e..848bf531 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered double patch data. * ************************************************************************/ - -#ifndef included_pdat_CellDoubleLinearTimeInterpolateOp_C -#define included_pdat_CellDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/pdat/CellData.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintcelldoub1d, LINTIMEINTCELLDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcelldoub1d, LINTIMEINTCELLDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintcelldoub1d, LINTIMEINTCELLDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintcelldoub2d, LINTIMEINTCELLDOUB2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcelldoub2d, LINTIMEINTCELLDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,7 +54,7 @@ void F77_FUNC(lintimeintcelldoub2d, LINTIMEINTCELLDOUB2D) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintcelldoub3d, LINTIMEINTCELLDOUB3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcelldoub3d, LINTIMEINTCELLDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,30 +90,30 @@ CellDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const CellData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const CellData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); CellData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -136,9 +132,9 @@ CellDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintcelldoub1d, LINTIMEINTCELLDOUB1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcelldoub1d, LINTIMEINTCELLDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -148,7 +144,7 @@ CellDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintcelldoub2d, LINTIMEINTCELLDOUB2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcelldoub2d, LINTIMEINTCELLDOUB2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -158,7 +154,7 @@ CellDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintcelldoub3d, LINTIMEINTCELLDOUB3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcelldoub3d, LINTIMEINTCELLDOUB3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -182,4 +178,3 @@ CellDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h index 9b813053..bb544b43 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered double patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class CellDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.C index 5f7d0ea1..006918b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_CellFloatConstantRefine_C -#define included_pdat_CellFloatConstantRefine_C - #include "SAMRAI/pdat/CellFloatConstantRefine.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" @@ -32,14 +28,14 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefcellflot1d, CONREFCELLFLOT1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellflot1d, CONREFCELLFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in conrefine2d.f: -void F77_FUNC(conrefcellflot2d, CONREFCELLFLOT2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellflot2d, CONREFCELLFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -47,7 +43,7 @@ void F77_FUNC(conrefcellflot2d, CONREFCELLFLOT2D) (const int&, const int&, const int *, const float *, float *); // in conrefine3d.f: -void F77_FUNC(conrefcellflot3d, CONREFCELLFLOT3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellflot3d, CONREFCELLFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,9 +59,8 @@ void F77_FUNC(conrefcellflot3d, CONREFCELLFLOT3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -CellFloatConstantRefine::CellFloatConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +CellFloatConstantRefine::CellFloatConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -80,9 +75,9 @@ CellFloatConstantRefine::getOperatorPriority() const } hier::IntVector -CellFloatConstantRefine::getStencilWidth() const +CellFloatConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -94,13 +89,13 @@ CellFloatConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const CellOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -120,41 +115,41 @@ CellFloatConstantRefine::refine( const hier::IntVector& ratio) const { boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, fine, coarse, fine_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(fine, coarse, fine_box, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conrefcellflot1d, CONREFCELLFLOT1D) (ifirstc(0), ilastc(0), + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); + + for (int d = 0; d < fdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conrefcellflot1d, CONREFCELLFLOT1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), filo(0), fihi(0), &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conrefcellflot2d, CONREFCELLFLOT2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conrefcellflot2d, CONREFCELLFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -162,8 +157,8 @@ CellFloatConstantRefine::refine( &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conrefcellflot3d, conrefcellflot3d) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conrefcellflot3d, CONREFCELLFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -185,4 +180,3 @@ CellFloatConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.h index 78d6c8ce..a644e0f2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class CellFloatConstantRefine: /** * Uninteresting default constructor. */ - explicit CellFloatConstantRefine( - const tbox::Dimension& dim); + CellFloatConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class CellFloatConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class CellFloatConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.C index ea4f8a2d..44e0e756 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered float patch data. * ************************************************************************/ - -#ifndef included_pdat_CellFloatLinearTimeInterpolateOp_C -#define included_pdat_CellFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintcellfloat1d, LINTIMEINTCELLFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellfloat1d, LINTIMEINTCELLFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintcellfloat1d, LINTIMEINTCELLFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintcellfloat2d, LINTIMEINTCELLFLOAT2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellfloat2d, LINTIMEINTCELLFLOAT2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,7 +54,7 @@ void F77_FUNC(lintimeintcellfloat2d, LINTIMEINTCELLFLOAT2D) (const int&, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintcellfloat3d, LINTIMEINTCELLFLOAT3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintcellfloat3d, LINTIMEINTCELLFLOAT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,30 +90,30 @@ CellFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const CellData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const CellData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); CellData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -136,9 +132,9 @@ CellFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintcellfloat1d, LINTIMEINTCELLFLOAT1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellfloat1d, LINTIMEINTCELLFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -148,7 +144,7 @@ CellFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintcellfloat2d, LINTIMEINTCELLFLOAT2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellfloat2d, LINTIMEINTCELLFLOAT2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -158,7 +154,7 @@ CellFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintcellfloat3d, LINTIMEINTCELLFLOAT3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintcellfloat3d, LINTIMEINTCELLFLOAT3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -181,4 +177,3 @@ CellFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.h index af10787b..b2c0a815 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for cell-centered float patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class CellFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.C index c73f2581..670921dd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.C @@ -3,15 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_CellGeometry_C -#define included_pdat_CellGeometry_C - #include "SAMRAI/pdat/CellGeometry.h" +#include "SAMRAI/pdat/CellIterator.h" #include "SAMRAI/pdat/CellOverlap.h" #include "SAMRAI/tbox/Utilities.h" @@ -32,7 +29,7 @@ CellGeometry::CellGeometry( d_box(box), d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -65,7 +62,7 @@ CellGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const CellGeometry* t_dst = dynamic_cast(&dst_geometry); @@ -73,7 +70,7 @@ CellGeometry::calculateOverlap( dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { + if ((t_src != 0) && (t_dst != 0)) { over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { @@ -88,7 +85,7 @@ CellGeometry::calculateOverlap( /* ************************************************************************* * - * Compute the boxes that will be used to contstruct an overlap object + * Compute the boxes that will be used to construct an overlap object * ************************************************************************* */ @@ -103,7 +100,7 @@ CellGeometry::computeDestinationBoxes( const hier::Transformation& transformation, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); // Translate the source box and grow the destination box by the ghost cells @@ -116,21 +113,17 @@ CellGeometry::computeDestinationBoxes( // Convert the boxes into cell space and compute the intersection - const hier::Box dst_cell(toCellBox(dst_ghost)); - const hier::Box src_cell(toCellBox(src_box)); - const hier::Box fill_cell(toCellBox(fill_box)); - const hier::Box together(dst_cell * src_cell * fill_cell); + const hier::Box together(dst_ghost * src_box * fill_box); if (!together.empty()) { if (!overwrite_interior) { - const hier::Box int_cell(toCellBox(d_box)); - dst_boxes.removeIntersections(together, int_cell); + dst_boxes.removeIntersections(together, d_box); } else { dst_boxes.pushBack(together); } } - if (dst_boxes.size() && dst_restrict_boxes.size()) { + if (!dst_boxes.empty() && !dst_restrict_boxes.empty()) { dst_boxes.intersectBoxes(dst_restrict_boxes); } } @@ -175,12 +168,25 @@ CellGeometry::transform( const hier::Transformation::RotationIdentifier& rotation = transformation.getRotation(); - if (dim.getValue() == 2) { + if (dim.getValue() == 1) { + const int rotation_num = static_cast(rotation); + if (rotation_num > 1) { + TBOX_ERROR("CellGeometry::transform invalid 1D RotationIdentifier."); + } + + if (rotation_num) { + CellIndex tmp_index(index); + index(0) = -tmp_index(0) - 1; + } + } else if (dim.getValue() == 2) { const int rotation_num = static_cast(rotation); + if (rotation_num > 3) { + TBOX_ERROR("CellGeometry::transform invalid 2D RotationIdentifier."); + } if (rotation_num) { CellIndex tmp_index(dim); - for (int r = 0; r < rotation_num; r++) { + for (int r = 0; r < rotation_num; ++r) { tmp_index = index; index(0) = tmp_index(1); index(1) = -tmp_index(0) - 1; @@ -321,13 +327,26 @@ CellGeometry::rotateAboutAxis(CellIndex& index, const int b = (axis + 2) % dim.getValue(); CellIndex tmp_index(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_index = index; index(a) = tmp_index(b); index(b) = -tmp_index(a) - 1; } } +CellIterator +CellGeometry::begin( + const hier::Box& box) +{ + return CellIterator(box, true); +} + +CellIterator +CellGeometry::end( + const hier::Box& box) +{ + return CellIterator(box, false); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.h index d13e9270..33a4e9e3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -20,23 +20,25 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include -#include +#include "boost/make_shared.hpp" +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { +class CellIterator; + /*! * Class CellGeometry manages the mapping between the AMR index space * and the cell-centered geometry index space. It is a subclass of * hier::BoxGeometry and it computes intersections between cell- * centered box geometries for communication operations. * - * See header file for CellData class for a more detailed + * See header file for CellData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::CellOverlap + * @see CellOverlap */ class CellGeometry:public hier::BoxGeometry @@ -72,9 +74,20 @@ class CellGeometry:public hier::BoxGeometry CellIndex& index, const hier::Transformation& transformation); + static CellIterator + begin( + const hier::Box& box); + + static CellIterator + end( + const hier::Box& box); + /*! * @brief Construct the cell geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim()== ghosts.getDim() + * @pre ghosts.min() >= 0 */ CellGeometry( const hier::Box& box, @@ -88,6 +101,8 @@ class CellGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in cell-centered index space between * the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -104,6 +119,8 @@ class CellGeometry:public hier::BoxGeometry * @brief Compute the cell-centered destination boxes that represent * the overlap between the source box geometry and the destination * box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ void computeDestinationBoxes( @@ -181,7 +198,7 @@ class CellGeometry:public hier::BoxGeometry CellGeometry( const CellGeometry&); // not implemented - void + CellGeometry& operator = ( const CellGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.C index e79df7ae..1c5753d0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_CellIndex_C -#define included_pdat_CellIndex_C - #include "SAMRAI/pdat/CellIndex.h" namespace SAMRAI { @@ -38,4 +34,3 @@ CellIndex::~CellIndex() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.h index 9d8e0c8b..cfceda7d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIndex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -26,9 +26,9 @@ namespace pdat { * index location in AMR index space and are identical to the AMR indices. * * @see hier::Index - * @see pdat::CellData - * @see pdat::CellGeometry - * @see pdat::CellIterator + * @see CellData + * @see CellGeometry + * @see CellIterator */ class CellIndex:public hier::Index @@ -55,12 +55,14 @@ class CellIndex:public hier::Index /** * The assignment operator sets the cell index equal to the argument. + * + * @pre getDim() == rhs.getDim() */ CellIndex& operator = ( const CellIndex& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator = (rhs); return *this; } @@ -72,24 +74,28 @@ class CellIndex:public hier::Index /** * Plus-equals operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex& operator += ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator += (rhs); return *this; } /** * Plus operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex operator + ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); CellIndex tmp = *this; tmp += rhs; return tmp; @@ -120,24 +126,28 @@ class CellIndex:public hier::Index /** * Minus-equals operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex& operator -= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator -= (rhs); return *this; } /** * Minus operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex operator - ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); CellIndex tmp = *this; tmp -= rhs; return tmp; @@ -168,24 +178,28 @@ class CellIndex:public hier::Index /** * Times-equals operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex& operator *= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator *= (rhs); return *this; } /** * Times operator for a cell index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ CellIndex operator * ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); CellIndex tmp = *this; tmp *= rhs; return tmp; @@ -217,24 +231,28 @@ class CellIndex:public hier::Index /** * Returns true if two cell index objects are equal. All components * must be the same for equality. + * + * @pre getDim() == rhs.getDim() */ bool operator == ( const CellIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator == (rhs); } /** * Returns true if two cell index objects are not equal. Any of * the components may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const CellIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator != (rhs); } }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.C index 7858961c..78b3a90b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered integer data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_CellIntegerConstantRefine_C -#define included_pdat_CellIntegerConstantRefine_C - #include "SAMRAI/pdat/CellIntegerConstantRefine.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" @@ -35,14 +31,14 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefcellintg1d, CONREFCELLINTG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellintg1d, CONREFCELLINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in conrefine2d.f: -void F77_FUNC(conrefcellintg2d, CONREFCELLINTG2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellintg2d, CONREFCELLINTG2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -50,7 +46,7 @@ void F77_FUNC(conrefcellintg2d, CONREFCELLINTG2D) (const int&, const int&, const int *, const int *, int *); // in conrefine3d.f: -void F77_FUNC(conrefcellintg3d, CONREFCELLINTG3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefcellintg3d, CONREFCELLINTG3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,9 +62,8 @@ void F77_FUNC(conrefcellintg3d, CONREFCELLINTG3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -CellIntegerConstantRefine::CellIntegerConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +CellIntegerConstantRefine::CellIntegerConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -84,9 +79,9 @@ CellIntegerConstantRefine::getOperatorPriority() const } hier::IntVector -CellIntegerConstantRefine::getStencilWidth() const +CellIntegerConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -98,13 +93,13 @@ CellIntegerConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const CellOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { refine(fine, coarse, dst_component, @@ -124,41 +119,41 @@ CellIntegerConstantRefine::refine( const hier::IntVector& ratio) const { boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, fine, coarse, fine_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(fine, coarse, fine_box, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conrefcellintg1d, CONREFCELLINTG1D) (ifirstc(0), ilastc(0), + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); + + for (int d = 0; d < fdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conrefcellintg1d, CONREFCELLINTG1D) (ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), filo(0), fihi(0), &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conrefcellintg2d, CONREFCELLINTG2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conrefcellintg2d, CONREFCELLINTG2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -166,8 +161,8 @@ CellIntegerConstantRefine::refine( &ratio[0], cdata->getPointer(d), fdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conrefcellintg3d, CONREFCELLINTG3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conrefcellintg3d, CONREFCELLINTG3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -189,4 +184,3 @@ CellIntegerConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.h index ed07ea61..7c2bbfa3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIntegerConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for cell-centered integer data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -40,8 +40,7 @@ class CellIntegerConstantRefine: /** * Uninteresting default constructor. */ - explicit CellIntegerConstantRefine( - const tbox::Dimension& dim); + CellIntegerConstantRefine(); /** * Uninteresting virtual destructor. @@ -60,7 +59,8 @@ class CellIntegerConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -69,6 +69,8 @@ class CellIntegerConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.C index 0e7f1e7c..e5fa38e3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for cell centered patch data types * ************************************************************************/ - -#ifndef included_pdat_CellIterator_C -#define included_pdat_CellIterator_C - #include "SAMRAI/pdat/CellIterator.h" namespace SAMRAI { @@ -23,8 +19,8 @@ CellIterator::CellIterator( d_box(box) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -42,11 +38,11 @@ CellIterator::~CellIterator() CellIterator& CellIterator::operator ++ () { - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -59,11 +55,11 @@ CellIterator::operator ++ ( int) { CellIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -73,4 +69,3 @@ CellIterator::operator ++ ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.h index 2e296278..add42e3b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for cell centered patch data types * ************************************************************************/ @@ -37,22 +37,14 @@ namespace pdat { * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see pdat::CellData - * @see pdat::CellGeometry - * @see pdat::CellIndex + * @see CellData + * @see CellGeometry + * @see CellIndex */ class CellIterator { public: - /** - * Constructor for the cell iterator. The iterator will enumerate - * the indices in the argument box. - */ - explicit CellIterator( - const hier::Box& box, - bool begin); - /** * Copy constructor for the cell iterator */ @@ -89,7 +81,7 @@ class CellIterator * Extract a pointer to the cell index corresponding to the iterator * position in the box. */ - const CellIndex* + const CellIndex * operator -> () const { return &d_index; @@ -115,6 +107,8 @@ class CellIterator operator == ( const CellIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index == iterator.d_index; } @@ -125,10 +119,30 @@ class CellIterator operator != ( const CellIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index != iterator.d_index; } private: + friend CellIterator + CellGeometry::begin( + const hier::Box& box); + friend CellIterator + CellGeometry::end( + const hier::Box& box); + + /** + * Constructor for the cell iterator. The iterator will enumerate + * the indices in the argument box. + */ + CellIterator( + const hier::Box& box, + bool begin); + + // Unimplemented default constructor. + CellIterator(); + CellIndex d_index; hier::Box d_box; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.C index 5ccaa123..27a538b9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_CellOverlap_C -#define included_pdat_CellOverlap_C - #include "SAMRAI/pdat/CellOverlap.h" #include "SAMRAI/hier/BoxContainer.h" @@ -21,7 +17,7 @@ namespace pdat { CellOverlap::CellOverlap( const hier::BoxContainer& boxes, const hier::Transformation& transformation): - d_is_overlap_empty(boxes.isEmpty()), + d_is_overlap_empty(boxes.empty()), d_transformation(transformation), d_dst_boxes(boxes) { @@ -43,6 +39,20 @@ CellOverlap::getDestinationBoxContainer() const return d_dst_boxes; } +void +CellOverlap::getSourceBoxContainer(hier::BoxContainer& src_boxes) const +{ + TBOX_ASSERT(src_boxes.empty()); + + src_boxes = d_dst_boxes; + if (!src_boxes.empty()) { + for (hier::BoxContainer::iterator bi = src_boxes.begin(); + bi != src_boxes.end(); ++bi) { + d_transformation.inverseTransform(*bi); + } + } +} + const hier::IntVector& CellOverlap::getSourceOffset() const { @@ -60,7 +70,7 @@ CellOverlap::print( std::ostream& os) const { os << "CellOverlap boxes:"; - for (hier::BoxContainer::const_iterator b(d_dst_boxes); + for (hier::BoxContainer::const_iterator b = d_dst_boxes.begin(); b != d_dst_boxes.end(); ++b) { const hier::Box& box = *b; os << " " << box << std::endl; @@ -69,4 +79,3 @@ CellOverlap::print( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.h index f56bd64a..5b9e8bbe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -33,7 +33,7 @@ namespace pdat { * represent an overlap previously computed. * * @see hier::BoxOverlap - * @see pdat::CellOverlap + * @see CellOverlap */ class CellOverlap:public hier::BoxOverlap @@ -71,6 +71,20 @@ class CellOverlap:public hier::BoxOverlap virtual const hier::BoxContainer& getDestinationBoxContainer() const; + /*! + * @brief Get a BoxContainer representing the source boxes of the overlap. + * + * The src_boxes container will be filled with the cell-centered source + * boxes of the overlap in the source coordinate space. + * + * @param[out] src_boxes + * + * @pre src_boxes.empty() + */ + virtual void + getSourceBoxContainer( + hier::BoxContainer& src_boxes) const; + /** * Return the offset between the destination and source index spaces. * The destination index space is the source index space shifted @@ -96,7 +110,6 @@ class CellOverlap:public hier::BoxOverlap bool d_is_overlap_empty; hier::Transformation d_transformation; hier::BoxContainer d_dst_boxes; - int d_count; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.C index 50d618e9..6e2e0aa6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -36,7 +36,7 @@ CellVariable::CellVariable( int depth): hier::Variable(name, boost::make_shared >(depth, - hier::IntVector::getZero(dim))) // default zero ghost cells + hier::IntVector::getZero(dim))) // default zero ghost cells { } @@ -50,7 +50,8 @@ int CellVariable::getDepth() const { boost::shared_ptr > cell_factory( - getPatchDataFactory()); + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(cell_factory); return cell_factory->getDepth(); } @@ -89,33 +90,6 @@ CellVariable::dataLivesOnPatchBorder() const return false; } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -CellVariable::CellVariable( - const CellVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void -CellVariable::operator = ( - const CellVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.h index e08d0a31..e2d82c53 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CellVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -22,16 +22,16 @@ namespace SAMRAI { namespace pdat { /*! - * Class CellVariable is a templated variable class used to define + * Class CellVariable is a templated variable class used to define * cell-centered quantities on an AMR mesh. It is a subclass of * hier::Variable and is templated on the type of the underlying data * (e.g., double, int, bool, etc.). * - * See header file for CellData class for a more detailed + * See header file for CellData class for a more detailed * description of the data layout. * - * @see pdat::CellData - * @see pdat::CellDataFactory + * @see CellData + * @see CellDataFactory * @see hier::Variable */ @@ -79,11 +79,14 @@ class CellVariable:public hier::Variable getDepth() const; private: + // Unimplemented copy constructor CellVariable( - const CellVariable&); // not implemented - void + const CellVariable&); + + // Unimplemented assignment operator + CellVariable& operator = ( - const CellVariable&); // not implemented + const CellVariable&); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.C index bce1a3de..635e89f1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Copy operation on single array data elements templated on data type * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.h index db9a4bd3..eb117f34 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/CopyOperation.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Copy operation on single array data elements templated on data type * ************************************************************************/ @@ -45,10 +45,10 @@ class CopyOperation private: CopyOperation( - const CopyOperation&); // not implemented - void + const CopyOperation&); // not implemented + CopyOperation& operator = ( - const CopyOperation&); // not implemented + const CopyOperation&); // not implemented }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.C index 66abf06c..16d2192b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.C @@ -3,12 +3,9 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * -* Copyright: (c) 1997 - 2011 Lawrence Livermore National Security, LLC +* Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat **********************************************************************/ -#ifndef included_pdat_DoubleAttributeId_C -#define included_pdat_DoubleAttributeId_C - #include "SAMRAI/pdat/DoubleAttributeId.h" namespace SAMRAI { @@ -49,4 +46,3 @@ DoubleAttributeId::~DoubleAttributeId() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.h index bec71617..eec1317a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/DoubleAttributeId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * -* Copyright: (c) 1997 - 2011 Lawrence Livermore National Security, LLC +* Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat **********************************************************************/ #ifndef included_pdat_DoubleAttributeId_h diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.C index e589feae..8f6aac53 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_EdgeComplexConstantRefine_C -#define included_pdat_EdgeComplexConstantRefine_C - #include "SAMRAI/pdat/EdgeComplexConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -34,21 +30,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefedgecplx1d, CONREFEDGECPLX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx1d, CONREFEDGECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine2d.f: -void F77_FUNC(conrefedgecplx2d0, CONREFEDGECPLX2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx2d0, CONREFEDGECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefedgecplx2d1, CONREFEDGECPLX2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx2d1, CONREFEDGECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -56,7 +52,7 @@ void F77_FUNC(conrefedgecplx2d1, CONREFEDGECPLX2D1) (const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine3d.f: -void F77_FUNC(conrefedgecplx3d0, CONREFEDGECPLX3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx3d0, CONREFEDGECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -67,7 +63,7 @@ void F77_FUNC(conrefedgecplx3d0, CONREFEDGECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefedgecplx3d1, CONREFEDGECPLX3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx3d1, CONREFEDGECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -78,7 +74,7 @@ void F77_FUNC(conrefedgecplx3d1, CONREFEDGECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefedgecplx3d2, CONREFEDGECPLX3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgecplx3d2, CONREFEDGECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,9 +90,8 @@ void F77_FUNC(conrefedgecplx3d2, CONREFEDGECPLX3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -EdgeComplexConstantRefine::EdgeComplexConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +EdgeComplexConstantRefine::EdgeComplexConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -111,9 +106,9 @@ EdgeComplexConstantRefine::getOperatorPriority() const } hier::IntVector -EdgeComplexConstantRefine::getStencilWidth() const +EdgeComplexConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -125,56 +120,55 @@ EdgeComplexConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (int axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefedgecplx1d, CONREFEDGECPLX1D) ( + SAMRAI_F77_FUNC(conrefedgecplx1d, CONREFEDGECPLX1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -184,7 +178,7 @@ EdgeComplexConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefedgecplx2d0, CONREFEDGECPLX2D0) ( + SAMRAI_F77_FUNC(conrefedgecplx2d0, CONREFEDGECPLX2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -193,7 +187,7 @@ EdgeComplexConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgecplx2d1, CONREFEDGECPLX2D1) ( + SAMRAI_F77_FUNC(conrefedgecplx2d1, CONREFEDGECPLX2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -204,7 +198,7 @@ EdgeComplexConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefedgecplx3d0, CONREFEDGECPLX3D0) ( + SAMRAI_F77_FUNC(conrefedgecplx3d0, CONREFEDGECPLX3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -217,7 +211,7 @@ EdgeComplexConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgecplx3d1, CONREFEDGECPLX3D1) ( + SAMRAI_F77_FUNC(conrefedgecplx3d1, CONREFEDGECPLX3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,7 +224,7 @@ EdgeComplexConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conrefedgecplx3d2, CONREFEDGECPLX3D2) ( + SAMRAI_F77_FUNC(conrefedgecplx3d2, CONREFEDGECPLX3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -255,4 +249,3 @@ EdgeComplexConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.h index fa796741..9a3f7c37 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered complex data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class EdgeComplexConstantRefine: /** * Uninteresting default constructor. */ - explicit EdgeComplexConstantRefine( - const tbox::Dimension& dim); + EdgeComplexConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class EdgeComplexConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class EdgeComplexConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.C index ac781363..d7b8f675 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered complex data. * ************************************************************************/ - -#ifndef included_pdat_EdgeComplexLinearTimeInterpolateOp_C -#define included_pdat_EdgeComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -21,7 +17,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -37,7 +33,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintedgecmplx1d, LINTIMEINTEDGECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx1d, LINTIMEINTEDGECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +42,7 @@ void F77_FUNC(lintimeintedgecmplx1d, LINTIMEINTEDGECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintedgecmplx2d0, LINTIMEINTEDGECMPLX2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx2d0, LINTIMEINTEDGECMPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,7 +54,7 @@ void F77_FUNC(lintimeintedgecmplx2d0, LINTIMEINTEDGECMPLX2D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintedgecmplx2d1, LINTIMEINTEDGECMPLX2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx2d1, LINTIMEINTEDGECMPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -71,7 +67,7 @@ void F77_FUNC(lintimeintedgecmplx2d1, LINTIMEINTEDGECMPLX2D1) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintedgecmplx3d0, LINTIMEINTEDGECMPLX3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx3d0, LINTIMEINTEDGECMPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -83,7 +79,7 @@ void F77_FUNC(lintimeintedgecmplx3d0, LINTIMEINTEDGECMPLX3D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintedgecmplx3d1, LINTIMEINTEDGECMPLX3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx3d1, LINTIMEINTEDGECMPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,7 +91,7 @@ void F77_FUNC(lintimeintedgecmplx3d1, LINTIMEINTEDGECMPLX3D1) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintedgecmplx3d2, LINTIMEINTEDGECMPLX3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgecmplx3d2, LINTIMEINTEDGECMPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -131,30 +127,30 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const EdgeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const EdgeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); EdgeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -173,9 +169,9 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintedgecmplx1d, LINTIMEINTEDGECMPLX1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx1d, LINTIMEINTEDGECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -185,7 +181,7 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintedgecmplx2d0, LINTIMEINTEDGECMPLX2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx2d0, LINTIMEINTEDGECMPLX2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -194,7 +190,7 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgecmplx2d1, LINTIMEINTEDGECMPLX2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx2d1, LINTIMEINTEDGECMPLX2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -204,7 +200,7 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintedgecmplx3d0, LINTIMEINTEDGECMPLX3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx3d0, LINTIMEINTEDGECMPLX3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -217,7 +213,7 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgecmplx3d1, LINTIMEINTEDGECMPLX3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx3d1, LINTIMEINTEDGECMPLX3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -230,7 +226,7 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintedgecmplx3d2, LINTIMEINTEDGECMPLX3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgecmplx3d2, LINTIMEINTEDGECMPLX3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -253,4 +249,3 @@ EdgeComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.h index 18a417e1..f258ec13 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered complex data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class EdgeComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.C index 965b09ac..2ca3c3e5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated edge centered patch data type * ************************************************************************/ @@ -42,15 +42,15 @@ EdgeData::EdgeData( hier::PatchData(box, ghosts), d_depth(depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::Box edge_box = EdgeGeometry::toEdgeBox(getGhostBox(), d); - d_data[d].initializeArray(edge_box, depth); + d_data[d].reset(new ArrayData(edge_box, depth)); } } @@ -59,32 +59,6 @@ EdgeData::~EdgeData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -EdgeData::EdgeData( - const EdgeData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -EdgeData::operator = ( - const EdgeData& foo) -{ - NULL_USE(foo); -} - template int EdgeData::getDepth() const @@ -93,7 +67,7 @@ EdgeData::getDepth() const } template -TYPE* +TYPE * EdgeData::getPointer( int axis, int depth) @@ -101,11 +75,11 @@ EdgeData::getPointer( TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis].getPointer(depth); + return d_data[axis]->getPointer(depth); } template -const TYPE* +const TYPE * EdgeData::getPointer( int axis, int depth) const @@ -113,7 +87,7 @@ EdgeData::getPointer( TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis].getPointer(depth); + return d_data[axis]->getPointer(depth); } template @@ -122,14 +96,14 @@ EdgeData::operator () ( const EdgeIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -138,14 +112,14 @@ EdgeData::operator () ( const EdgeIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -155,7 +129,7 @@ EdgeData::getArrayData( { TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); - return d_data[axis]; + return *(d_data[axis]); } template @@ -165,7 +139,7 @@ EdgeData::getArrayData( { TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); - return d_data[axis]; + return *(d_data[axis]); } /* @@ -182,17 +156,16 @@ void EdgeData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const EdgeData* t_src = - dynamic_cast *>(&src); - if (t_src == NULL) { + const EdgeData* t_src = dynamic_cast *>(&src); + if (t_src == 0) { src.copy2(*this); } else { - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * t_src->d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * t_src->d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copy(t_src->d_data[d], box); + d_data[d]->copy(*(t_src->d_data[d]), box); } } } @@ -203,17 +176,16 @@ void EdgeData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - EdgeData* t_dst = - dynamic_cast *>(&dst); + EdgeData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * t_dst->d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * t_dst->d_data[d]->getBox(); if (!box.empty()) { - t_dst->d_data[d].copy(d_data[d], box); + t_dst->d_data[d]->copy(*(d_data[d]), box); } } } @@ -233,15 +205,13 @@ EdgeData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const EdgeData* t_src = - dynamic_cast *>(&src); + const EdgeData* t_src = dynamic_cast *>(&src); - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = dynamic_cast(&overlap); - if ((t_src == NULL) || (t_overlap == NULL)) { + if ((t_src == 0) || (t_overlap == 0)) { src.copy2(*this, overlap); } else { if (t_overlap->getTransformation().getRotation() == @@ -249,9 +219,9 @@ EdgeData::copy( const hier::Transformation& transformation = t_overlap->getTransformation(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - d_data[d].copy(t_src->d_data[d], box_list, transformation); + d_data[d]->copy(*(t_src->d_data[d]), box_list, transformation); } } else { copyWithRotation(*t_src, *t_overlap); @@ -265,23 +235,21 @@ EdgeData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - EdgeData* t_dst = - dynamic_cast *>(&dst); - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + EdgeData* t_dst = CPP_CAST *>(&dst); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - t_dst->d_data[d].copy(d_data[d], box_list, src_offset); + t_dst->d_data[d]->copy(*(d_data[d]), box_list, src_offset); } } else { t_dst->copyWithRotation(*this, *t_overlap); @@ -294,11 +262,11 @@ EdgeData::copyOnBox( const EdgeData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { const hier::Box edge_box = EdgeGeometry::toEdgeBox(box, axis); - d_data[axis].copy(src.getArrayData(axis), edge_box); + d_data[axis]->copy(src.getArrayData(axis), edge_box); } } @@ -333,13 +301,12 @@ EdgeData::copyWithRotation( rotatebox.getBlockId(), getBox().getBlockId()); - - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); hier::Box edge_rotatebox(EdgeGeometry::toEdgeBox(rotatebox, i)); - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -349,15 +316,15 @@ EdgeData::copyWithRotation( const int depth = ((getDepth() < src.getDepth()) ? getDepth() : src.getDepth()); - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); ci != ciend; ++ci) { EdgeIndex dst_index(*ci, 0, 0); dst_index.setAxis(i); EdgeIndex src_index(dst_index); EdgeGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*this)(dst_index, d) = src(src_index, d); } } @@ -382,12 +349,12 @@ EdgeData::copyDepth( const EdgeData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * src.d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * src.d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copyDepth(dst_depth, src.d_data[d], src_depth, box); + d_data[d]->copyDepth(dst_depth, *(src.d_data[d]), src_depth, box); } } } @@ -409,20 +376,20 @@ EdgeData::canEstimateStreamSizeFromBox() const } template -int +size_t EdgeData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - int size = 0; - for (int d = 0; d < getDim().getValue(); d++) { - size += d_data[d].getDataStreamSize(t_overlap->getDestinationBoxContainer(d), + size_t size = 0; + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { + size += d_data[d]->getDataStreamSize( + t_overlap->getDestinationBoxContainer(d), offset); } return size; @@ -443,19 +410,18 @@ EdgeData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { const hier::Transformation& transformation = t_overlap->getTransformation(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].packStream(stream, boxes, transformation); + if (!boxes.empty()) { + d_data[d]->packStream(stream, boxes, transformation); } } } else { @@ -495,16 +461,16 @@ EdgeData::packWithRotation( const int depth = getDepth(); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); - const int size = depth * overlap_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = depth * overlap_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); hier::Box edge_rotatebox(EdgeGeometry::toEdgeBox(rotatebox, i)); int buf_count = 0; - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -512,22 +478,23 @@ EdgeData::packWithRotation( if (!copybox.empty()) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); + ci != ciend; ++ci) { EdgeIndex src_index(*ci, 0, 0); src_index.setAxis(i); EdgeGeometry::transform(src_index, back_trans); buffer[buf_count] = (*this)(src_index, d); - buf_count++; + ++buf_count; } } } } - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } } @@ -537,16 +504,15 @@ EdgeData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].unpackStream(stream, boxes, offset); + if (!boxes.empty()) { + d_data[d]->unpackStream(stream, boxes, offset); } } } @@ -567,12 +533,12 @@ EdgeData::getSizeOfData( int depth, const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); size_t size = 0; const hier::Box ghost_box = hier::Box::grow(box, ghosts); - for (int d = 0; d < box.getDim().getValue(); d++) { + for (int d = 0; d < box.getDim().getValue(); ++d) { const hier::Box edge_box = EdgeGeometry::toEdgeBox(ghost_box, d); size += ArrayData::getSizeOfData(edge_box, depth); } @@ -595,8 +561,8 @@ EdgeData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fill(t, d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fill(t, d); } } @@ -607,12 +573,12 @@ EdgeData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fill(t, EdgeGeometry::toEdgeBox(box, i), d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fill(t, EdgeGeometry::toEdgeBox(box, i), d); } } @@ -621,8 +587,8 @@ void EdgeData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fillAll(t); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fillAll(t); } } @@ -632,10 +598,10 @@ EdgeData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fillAll(t, EdgeGeometry::toEdgeBox(box, i)); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fillAll(t, EdgeGeometry::toEdgeBox(box, i)); } } @@ -655,7 +621,7 @@ EdgeData::print( std::ostream& os, int prec) const { - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { os << "Array axis = " << axis << std::endl; printAxis(axis, box, os, prec); } @@ -669,10 +635,10 @@ EdgeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { os << "Array axis = " << axis << std::endl; printAxis(axis, box, depth, os, prec); } @@ -686,10 +652,10 @@ EdgeData::printAxis( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxis(axis, box, d, os, prec); } @@ -704,14 +670,14 @@ EdgeData::printAxis( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); os.precision(prec); - EdgeIterator iend(box, axis, false); - for (EdgeIterator i(box, axis, true); i != iend; ++i) { - os << "array" << *i << " = " << d_data[axis](*i, depth) + EdgeIterator iend(EdgeGeometry::end(box, axis)); + for (EdgeIterator i(EdgeGeometry::begin(box, axis)); i != iend; ++i) { + os << "array" << *i << " = " << (*(d_data[axis]))(*i, depth) << std::endl << std::flush; } } @@ -721,31 +687,33 @@ EdgeData::printAxis( * * Checks that class version and restart file version are equal. If so, * reads in the d_depth data member to the database. Then tell - * d_data to read itself in from the database. + * d_data to read itself in from the restart database. * ************************************************************************* */ template void -EdgeData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +EdgeData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("PDAT_EDGEDATA_VERSION"); + hier::PatchData::getFromRestart(restart_db); + + int ver = restart_db->getInteger("PDAT_EDGEDATA_VERSION"); if (ver != PDAT_EDGEDATA_VERSION) { - TBOX_ERROR("EdgeData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("EdgeData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->getDatabase(array_name); - (d_data[i]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i]->getFromRestart(array_database); } } @@ -760,20 +728,22 @@ EdgeData::getSpecializedFromDatabase( template void -EdgeData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +EdgeData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_EDGEDATA_VERSION", PDAT_EDGEDATA_VERSION); + restart_db->putInteger("PDAT_EDGEDATA_VERSION", PDAT_EDGEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->putDatabase(array_name); - (d_data[i]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i]->putToRestart(array_database); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.h index e3cae1d8..37bb648d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated edge centered patch data type * ************************************************************************/ @@ -17,17 +17,18 @@ #include "SAMRAI/pdat/ArrayData.h" #include "SAMRAI/pdat/EdgeIndex.h" #include "SAMRAI/pdat/EdgeIterator.h" +#include "SAMRAI/pdat/EdgeOverlap.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class EdgeData provides an implementation for data defined + * @brief Class EdgeData provides an implementation for data defined * at cell edges on AMR patches. It is derived from the hier::PatchData * interface common to all SAMRAI patch data types. Given a CELL-centered * AMR index space box, an edge data object represents data of some template @@ -44,7 +45,7 @@ namespace pdat { * style) so that the leftmost index runs fastest in memory. * For example, a three-dimensional edge data object created over a * CELL-centered AMR index space [l0:u0,l1:u1,l2:u2] allocates three data - * arrays dimensioned as follows: + * arrays sized as follows: * \verbatim * * axis 0 @@ -71,12 +72,12 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::EdgeDataFactory - * @see pdat::EdgeIndex - * @see pdat::EdgeIterator - * @see pdat::EdgeGeometry + * @see EdgeDataFactory + * @see EdgeIndex + * @see EdgeIterator + * @see EdgeGeometry */ template @@ -99,6 +100,9 @@ class EdgeData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the edge data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 */ static size_t getSizeOfData( @@ -117,6 +121,10 @@ class EdgeData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the edge data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ EdgeData( const hier::Box& box, @@ -138,6 +146,9 @@ class EdgeData:public hier::PatchData /*! * @brief Get a pointer to the beginning of a particular axis and * depth component of the edge centered array. + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -147,6 +158,9 @@ class EdgeData:public hier::PatchData /*! * @brief Get a const pointer to the beginning of a particular axis and * depth component of the edge centered array. + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -156,6 +170,10 @@ class EdgeData:public hier::PatchData /*! * @brief Return a reference to the data entry corresponding * to a given edge index and depth. + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -165,6 +183,10 @@ class EdgeData:public hier::PatchData /*! * @brief Return a const reference to the data entry corresponding * to a given edge index and depth. + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -174,6 +196,8 @@ class EdgeData:public hier::PatchData /*! * @brief Return a reference to the array data object for the * given axis of the edge centered data object. + * + * @pre (axis >= 0) && (axis < getDim().getValue()) */ ArrayData& getArrayData( @@ -182,6 +206,8 @@ class EdgeData:public hier::PatchData /*! * @brief Return a const reference to the array data object for the * given axis of the edge centered data object. + * + * @pre (axis >= 0) && (axis < getDim().getValue()) */ const ArrayData& getArrayData( @@ -196,6 +222,8 @@ class EdgeData:public hier::PatchData * both the source and destination). Currently, source data must be * an EdgeData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -210,6 +238,9 @@ class EdgeData:public hier::PatchData * both the source and destination). Currently, destination data must be * an EdgeData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -222,6 +253,8 @@ class EdgeData:public hier::PatchData * Currently, source data must be EdgeData of the same DIM and TYPE * and the overlap must be a EdgeOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -235,6 +268,10 @@ class EdgeData:public hier::PatchData * Currently, destination data must be EdgeData of the same DIM and TYPE * and the overlap must be a EdgeOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy2( @@ -244,6 +281,8 @@ class EdgeData:public hier::PatchData /*! * @brief Copy data from source to destination (i.e., this) * patch data object on the given CELL-centered AMR index box. + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copyOnBox( @@ -254,6 +293,8 @@ class EdgeData:public hier::PatchData * @brief Fast copy (i.e., source and this edge data objects are * defined over the same box) to this destination edge data object * from the given source edge data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -279,8 +320,10 @@ class EdgeData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -288,6 +331,8 @@ class EdgeData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * EdgeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -298,6 +343,8 @@ class EdgeData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * EdgeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -306,6 +353,8 @@ class EdgeData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -314,6 +363,9 @@ class EdgeData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -330,6 +382,8 @@ class EdgeData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -345,8 +399,8 @@ class EdgeData:public hier::PatchData * and will be converted to edge index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. */ @@ -367,10 +421,13 @@ class EdgeData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -391,10 +448,13 @@ class EdgeData:public hier::PatchData * and will be converted to edge index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (axis >= 0) && (axis < getDim().getValue()) */ void printAxis( @@ -417,10 +477,14 @@ class EdgeData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (axis >= 0) && (axis < getDim().getValue()) */ void printAxis( @@ -432,23 +496,23 @@ class EdgeData:public hier::PatchData /*! * Check that class version and restart file version are equal. If so, - * read data members from the database. + * read data members from the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * The edge iterator iterates over the elements on one axis of an edge @@ -463,11 +527,14 @@ class EdgeData:public hier::PatchData */ static const int PDAT_EDGEDATA_VERSION; + // Unimplemented copy constructor EdgeData( - const EdgeData&); // not implemented - void + const EdgeData&); + + // Unimplemented assignment operator + EdgeData& operator = ( - const EdgeData&); // not implemented + const EdgeData&); void copyWithRotation( @@ -480,7 +547,8 @@ class EdgeData:public hier::PatchData const EdgeOverlap& overlap) const; int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL]; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.C index c845c324..cb16cb4b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating edge data objects * ************************************************************************/ @@ -20,7 +20,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/MemoryUtilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -64,12 +64,12 @@ boost::shared_ptr EdgeDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - d_depth, - ghosts, - d_fine_boundary_represents_var); + d_depth, + ghosts, + d_fine_boundary_represents_var); } /* @@ -85,12 +85,12 @@ boost::shared_ptr EdgeDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_depth, - d_ghosts); + patch.getBox(), + d_depth, + d_ghosts); } /* @@ -106,7 +106,7 @@ boost::shared_ptr EdgeDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -131,7 +131,7 @@ size_t EdgeDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(EdgeData)); @@ -154,7 +154,7 @@ bool EdgeDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -163,8 +163,8 @@ EdgeDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > edf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (edf) { valid_copy = true; } @@ -172,8 +172,9 @@ EdgeDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > oedf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (oedf) { valid_copy = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.h index fa634755..83a8ddda 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating edge data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::EdgeData - * @see pdat::PatchDataFactory + * @see EdgeData + * @see PatchDataFactory */ template @@ -40,10 +40,13 @@ class EdgeDataFactory:public hier::PatchDataFactory { public: /** - * The constructor for the edge data factory class. The ghost cell width, depth - * (number of components), and fine boundary representation arguments give the - * defaults for all edge data objects created with this factory. See - * the EdgeVariable class header file for more information. + * The constructor for the edge data factory class. The ghost cell width, + * depth (number of components), and fine boundary representation arguments + * give the defaults for all edge data objects created with this factory. + * See the EdgeVariable class header file for more information. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ EdgeDataFactory( int depth, @@ -64,6 +67,8 @@ class EdgeDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -73,6 +78,8 @@ class EdgeDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete edge data object. * The default information about the object (e.g., ghost cell width) * is taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr @@ -83,6 +90,8 @@ class EdgeDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -98,6 +107,8 @@ class EdgeDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the edge data object, * including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -106,7 +117,7 @@ class EdgeDataFactory:public hier::PatchDataFactory /** * Return a boolean value indicating how data for the edge quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the EdgeVariable class header file for more + * constructor. See the EdgeVariable class header file for more * information. */ bool @@ -123,6 +134,8 @@ class EdgeDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this EdgeDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is EdgeDataFactory or OuteredgeDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.C index 0ea5a926..b6b554e2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_EdgeDoubleConstantRefine_C -#define included_pdat_EdgeDoubleConstantRefine_C - #include "SAMRAI/pdat/EdgeDoubleConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefedgedoub1d, CONREFEDGEDOUB1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub1d, CONREFEDGEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in conrefine2d.f: -void F77_FUNC(conrefedgedoub2d0, CONREFEDGEDOUB2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub2d0, CONREFEDGEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefedgedoub2d1, CONREFEDGEDOUB2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub2d1, CONREFEDGEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conrefedgedoub2d1, CONREFEDGEDOUB2D1) (const int&, const int&, const int *, const double *, double *); // in conrefine3d.f: -void F77_FUNC(conrefedgedoub3d0, CONREFEDGEDOUB3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub3d0, CONREFEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conrefedgedoub3d0, CONREFEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefedgedoub3d1, CONREFEDGEDOUB3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub3d1, CONREFEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conrefedgedoub3d1, CONREFEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefedgedoub3d2, CONREFEDGEDOUB3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgedoub3d2, CONREFEDGEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conrefedgedoub3d2, CONREFEDGEDOUB3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -EdgeDoubleConstantRefine::EdgeDoubleConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +EdgeDoubleConstantRefine::EdgeDoubleConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ EdgeDoubleConstantRefine::getOperatorPriority() const } hier::IntVector -EdgeDoubleConstantRefine::getStencilWidth() const +EdgeDoubleConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,56 +119,55 @@ EdgeDoubleConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (int axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefedgedoub1d, CONREFEDGEDOUB1D) ( + SAMRAI_F77_FUNC(conrefedgedoub1d, CONREFEDGEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -183,7 +177,7 @@ EdgeDoubleConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefedgedoub2d0, CONREFEDGEDOUB2D0) ( + SAMRAI_F77_FUNC(conrefedgedoub2d0, CONREFEDGEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -192,7 +186,7 @@ EdgeDoubleConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgedoub2d1, CONREFEDGEDOUB2D1) ( + SAMRAI_F77_FUNC(conrefedgedoub2d1, CONREFEDGEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -203,7 +197,7 @@ EdgeDoubleConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefedgedoub3d0, CONREFEDGEDOUB3D0) ( + SAMRAI_F77_FUNC(conrefedgedoub3d0, CONREFEDGEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -216,7 +210,7 @@ EdgeDoubleConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgedoub3d1, CONREFEDGEDOUB3D1) ( + SAMRAI_F77_FUNC(conrefedgedoub3d1, CONREFEDGEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -229,7 +223,7 @@ EdgeDoubleConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conrefedgedoub3d2, CONREFEDGEDOUB3D2) ( + SAMRAI_F77_FUNC(conrefedgedoub3d2, CONREFEDGEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -254,4 +248,3 @@ EdgeDoubleConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.h index 092c014e..ab20d68d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class EdgeDoubleConstantRefine: /** * Uninteresting default constructor. */ - explicit EdgeDoubleConstantRefine( - const tbox::Dimension& dim); + EdgeDoubleConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class EdgeDoubleConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class EdgeDoubleConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.C index a1f861d2..ada1b032 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered double patch data. * ************************************************************************/ - -#ifndef included_pdat_EdgeDoubleLinearTimeInterpolateOp_C -#define included_pdat_EdgeDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintedgedoub1d, LINTIMEINTEDGEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub1d, LINTIMEINTEDGEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintedgedoub1d, LINTIMEINTEDGEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintedgedoub2d0, LINTIMEINTEDGEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub2d0, LINTIMEINTEDGEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintedgedoub2d0, LINTIMEINTEDGEDOUB2D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintedgedoub2d1, LINTIMEINTEDGEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub2d1, LINTIMEINTEDGEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintedgedoub2d1, LINTIMEINTEDGEDOUB2D1) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintedgedoub3d0, LINTIMEINTEDGEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub3d0, LINTIMEINTEDGEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintedgedoub3d0, LINTIMEINTEDGEDOUB3D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintedgedoub3d1, LINTIMEINTEDGEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub3d1, LINTIMEINTEDGEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintedgedoub3d1, LINTIMEINTEDGEDOUB3D1) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintedgedoub3d2, LINTIMEINTEDGEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgedoub3d2, LINTIMEINTEDGEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const EdgeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const EdgeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); EdgeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,9 +168,9 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintedgedoub1d, LINTIMEINTEDGEDOUB1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub1d, LINTIMEINTEDGEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -184,7 +180,7 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintedgedoub2d0, LINTIMEINTEDGEDOUB2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub2d0, LINTIMEINTEDGEDOUB2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -193,7 +189,7 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgedoub2d1, LINTIMEINTEDGEDOUB2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub2d1, LINTIMEINTEDGEDOUB2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -203,7 +199,7 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintedgedoub3d0, LINTIMEINTEDGEDOUB3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub3d0, LINTIMEINTEDGEDOUB3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -216,7 +212,7 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgedoub3d1, LINTIMEINTEDGEDOUB3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub3d1, LINTIMEINTEDGEDOUB3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -229,7 +225,7 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintedgedoub3d2, LINTIMEINTEDGEDOUB3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgedoub3d2, LINTIMEINTEDGEDOUB3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -252,4 +248,3 @@ EdgeDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.h index a0931e09..48f65d0b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered double patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class EdgeDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.C index 9aa83841..b6bb8f15 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_EdgeFloatConstantRefine_C -#define included_pdat_EdgeFloatConstantRefine_C - #include "SAMRAI/pdat/EdgeFloatConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefedgeflot1d, CONREFEDGEFLOT1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot1d, CONREFEDGEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in conrefine2d.f: -void F77_FUNC(conrefedgeflot2d0, CONREFEDGEFLOT2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot2d0, CONREFEDGEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefedgeflot2d1, CONREFEDGEFLOT2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot2d1, CONREFEDGEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conrefedgeflot2d1, CONREFEDGEFLOT2D1) (const int&, const int&, const int *, const float *, float *); // in conrefine3d.f: -void F77_FUNC(conrefedgeflot3d0, CONREFEDGEFLOT3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot3d0, CONREFEDGEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conrefedgeflot3d0, CONREFEDGEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefedgeflot3d1, CONREFEDGEFLOT3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot3d1, CONREFEDGEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conrefedgeflot3d1, CONREFEDGEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefedgeflot3d2, CONREFEDGEFLOT3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeflot3d2, CONREFEDGEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conrefedgeflot3d2, CONREFEDGEFLOT3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -EdgeFloatConstantRefine::EdgeFloatConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +EdgeFloatConstantRefine::EdgeFloatConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ EdgeFloatConstantRefine::getOperatorPriority() const } hier::IntVector -EdgeFloatConstantRefine::getStencilWidth() const +EdgeFloatConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,56 +119,55 @@ EdgeFloatConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (int axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefedgeflot1d, CONREFEDGEFLOT1D) ( + SAMRAI_F77_FUNC(conrefedgeflot1d, CONREFEDGEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -183,7 +177,7 @@ EdgeFloatConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefedgeflot2d0, CONREFEDGEFLOT2D0) ( + SAMRAI_F77_FUNC(conrefedgeflot2d0, CONREFEDGEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -192,7 +186,7 @@ EdgeFloatConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgeflot2d1, CONREFEDGEFLOT2D1) ( + SAMRAI_F77_FUNC(conrefedgeflot2d1, CONREFEDGEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -203,7 +197,7 @@ EdgeFloatConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefedgeflot3d0, CONREFEDGEFLOT3D0) ( + SAMRAI_F77_FUNC(conrefedgeflot3d0, CONREFEDGEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -216,7 +210,7 @@ EdgeFloatConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgeflot3d1, CONREFEDGEFLOT3D1) ( + SAMRAI_F77_FUNC(conrefedgeflot3d1, CONREFEDGEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -229,7 +223,7 @@ EdgeFloatConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conrefedgeflot3d2, CONREFEDGEFLOT3D2) ( + SAMRAI_F77_FUNC(conrefedgeflot3d2, CONREFEDGEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -254,4 +248,3 @@ EdgeFloatConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.h index 2c5f7d4a..d4cf1cae 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class EdgeFloatConstantRefine: /** * Uninteresting default constructor. */ - explicit EdgeFloatConstantRefine( - const tbox::Dimension& dim); + EdgeFloatConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class EdgeFloatConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class EdgeFloatConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.C index 08f384e0..d40b85f8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered float patch data. * ************************************************************************/ - -#ifndef included_pdat_EdgeFloatLinearTimeInterpolateOp_C -#define included_pdat_EdgeFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintedgefloat1d, LINTIMEINTEDGEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat1d, LINTIMEINTEDGEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintedgefloat1d, LINTIMEINTEDGEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintedgefloat2d0, LINTIMEINTEDGEFLOAT2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat2d0, LINTIMEINTEDGEFLOAT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintedgefloat2d0, LINTIMEINTEDGEFLOAT2D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintedgefloat2d1, LINTIMEINTEDGEFLOAT2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat2d1, LINTIMEINTEDGEFLOAT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintedgefloat2d1, LINTIMEINTEDGEFLOAT2D1) (const int&, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintedgefloat3d0, LINTIMEINTEDGEFLOAT3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat3d0, LINTIMEINTEDGEFLOAT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintedgefloat3d0, LINTIMEINTEDGEFLOAT3D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintedgefloat3d1, LINTIMEINTEDGEFLOAT3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat3d1, LINTIMEINTEDGEFLOAT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintedgefloat3d1, LINTIMEINTEDGEFLOAT3D1) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintedgefloat3d2, LINTIMEINTEDGEFLOAT3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintedgefloat3d2, LINTIMEINTEDGEFLOAT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const EdgeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const EdgeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); EdgeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,9 +168,9 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintedgefloat1d, LINTIMEINTEDGEFLOAT1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat1d, LINTIMEINTEDGEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -184,7 +180,7 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintedgefloat2d0, LINTIMEINTEDGEFLOAT2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat2d0, LINTIMEINTEDGEFLOAT2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -193,7 +189,7 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgefloat2d1, LINTIMEINTEDGEFLOAT2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat2d1, LINTIMEINTEDGEFLOAT2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -203,7 +199,7 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintedgefloat3d0, LINTIMEINTEDGEFLOAT3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat3d0, LINTIMEINTEDGEFLOAT3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -216,7 +212,7 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintedgefloat3d1, LINTIMEINTEDGEFLOAT3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat3d1, LINTIMEINTEDGEFLOAT3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -229,7 +225,7 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintedgefloat3d2, LINTIMEINTEDGEFLOAT3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintedgefloat3d2, LINTIMEINTEDGEFLOAT3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -252,4 +248,3 @@ EdgeFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.h index f7dfbdbc..d53f5843 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for edge-centered float patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class EdgeFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.C index 9957699e..c2a3efd1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.C @@ -3,20 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_EdgeGeometry_C -#define included_pdat_EdgeGeometry_C - #include "SAMRAI/pdat/EdgeGeometry.h" +#include "SAMRAI/pdat/EdgeIterator.h" #include "SAMRAI/pdat/EdgeOverlap.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -35,7 +32,7 @@ EdgeGeometry::EdgeGeometry( d_box(box), d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -68,7 +65,7 @@ EdgeGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const EdgeGeometry* t_dst = dynamic_cast(&dst_geometry); @@ -77,7 +74,7 @@ EdgeGeometry::calculateOverlap( boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { + if ((t_src != 0) && (t_dst != 0)) { over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { @@ -89,6 +86,76 @@ EdgeGeometry::calculateOverlap( return over; } +/* + ************************************************************************* + * + * Compute the boxes that will be used to construct an overlap object + * + ************************************************************************* + */ + +void +EdgeGeometry::computeDestinationBoxes( + std::vector& dst_boxes, + const EdgeGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes) const +{ + const tbox::Dimension& dim(src_mask.getDim()); + + // Perform a quick-and-dirty intersection to see if the boxes might overlap + + hier::Box src_shift( + hier::Box::grow(src_geometry.d_box, src_geometry.d_ghosts) * src_mask); + transformation.transform(src_shift); + hier::Box dst_ghost(d_box); + dst_ghost.grow(d_ghosts); + + // Compute the intersection (if any) for each of the edge directions + + const hier::IntVector one_vector(dim, 1); + + const hier::Box quick_check( + hier::Box::grow(src_shift, one_vector) + * hier::Box::grow(dst_ghost, one_vector)); + + if (!quick_check.empty()) { + + for (int d = 0; d < dim.getValue(); ++d) { + + const hier::Box dst_edge(toEdgeBox(dst_ghost, d)); + const hier::Box src_edge(toEdgeBox(src_shift, d)); + const hier::Box fill_edge(toEdgeBox(fill_box, d)); + const hier::Box together(dst_edge * src_edge * fill_edge); + + if (!together.empty()) { + + if (!overwrite_interior) { + const hier::Box int_edge(toEdgeBox(d_box, d)); + dst_boxes[d].removeIntersections(together, int_edge); + } else { + dst_boxes[d].pushBack(together); + } + + } // if (!together.empty()) + + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { + hier::BoxContainer edge_restrict_boxes; + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); + b != dst_restrict_boxes.end(); ++b) { + edge_restrict_boxes.pushBack(toEdgeBox(*b, d)); + } + dst_boxes[d].intersectBoxes(edge_restrict_boxes); + } + } // loop over dim + + } // if (!quick_check.empty()) + +} + /* ************************************************************************* * @@ -111,9 +178,9 @@ EdgeGeometry::toEdgeBox( if (!box.empty()) { edge_box = box; - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (axis != i) { - edge_box.upper(i) += 1; + edge_box.setUpper(i, edge_box.upper(i) + 1); } } } @@ -128,7 +195,7 @@ EdgeGeometry::toEdgeBox( * is fairly straight-forward. First, we perform a quick-and-dirty * intersection to see if the boxes might overlap. If that intersection * is not empty, then we need to do a better job calculating the overlap - * for each dimension. Note that the AMR index space boxes must be + * for each direction. Note that the AMR index space boxes must be * shifted into the edge centered space before we calculate the proper * intersections. * @@ -147,59 +214,15 @@ EdgeGeometry::doOverlap( { const tbox::Dimension& dim(src_mask.getDim()); - tbox::Array dst_boxes(dim.getValue()); - - // Perform a quick-and-dirty intersection to see if the boxes might overlap - - const hier::Box src_box( - hier::Box::grow(src_geometry.d_box, src_geometry.d_ghosts) * src_mask); - hier::Box src_shift(src_box); - transformation.transform(src_shift); - const hier::Box dst_ghost( - hier::Box::grow(dst_geometry.d_box, dst_geometry.d_ghosts)); + std::vector dst_boxes(dim.getValue()); - // Compute the intersection (if any) for each of the edge directions - - const hier::IntVector one_vector(dim, 1); - - const hier::Box quick_check = - hier::Box::grow(src_shift, one_vector) * hier::Box::grow(dst_ghost, - one_vector); - - if (!quick_check.empty()) { - - for (int d = 0; d < dim.getValue(); d++) { - - const hier::Box dst_edge(toEdgeBox(dst_ghost, d)); - const hier::Box src_edge(toEdgeBox(src_shift, d)); - const hier::Box fill_edge(toEdgeBox(fill_box, d)); - const hier::Box together(dst_edge * src_edge * fill_edge); - - if (!together.empty()) { - - dst_boxes[d].pushBack(together); - if (!overwrite_interior) { - const hier::Box int_edge(toEdgeBox(dst_geometry.d_box, d)); - dst_boxes[d].removeIntersections(together, int_edge); - } else { - dst_boxes[d].pushBack(together); - } - - } // if (!together.empty()) - - if (dst_restrict_boxes.size() && dst_boxes[d].size()) { - hier::BoxContainer edge_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); - b != dst_restrict_boxes.end(); ++b) { - edge_restrict_boxes.pushBack(toEdgeBox(*b, d)); - } - dst_boxes[d].intersectBoxes(edge_restrict_boxes); - } - } // loop over dim - - } // if (!quick_check.empty()) - - // Create the edge overlap data object using the boxes and source shift + dst_geometry.computeDestinationBoxes(dst_boxes, + src_geometry, + src_mask, + fill_box, + overwrite_interior, + transformation, + dst_restrict_boxes); return boost::make_shared(dst_boxes, transformation); } @@ -217,10 +240,11 @@ EdgeGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (int d = 0; d < dim.getValue(); ++d) { hier::Box edge_box(EdgeGeometry::toEdgeBox(*b, d)); dst_boxes[d].pushBack(edge_box); } @@ -257,126 +281,135 @@ EdgeGeometry::transform( const hier::Transformation::RotationIdentifier rotation = transformation.getRotation(); - for (int d = 0; d < dim.getValue(); d++) { - if (d != axis_direction) { - box.upper() (d) -= 1; - } - } - transformation.transform(box); - if (dim.getValue() == 2) { - const int rotation_num = static_cast(rotation); - if (rotation_num % 2) { - axis_direction = (axis_direction + 1) % 2; - } - } else if (dim.getValue() == 3) { - - if (axis_direction == 0) { - - switch (rotation) { - - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::IDOWN_KDOWN_JDOWN: - - axis_direction = 0; - break; + if (rotation == hier::Transformation::NO_ROTATE) { - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::JDOWN_IDOWN_KDOWN: + transformation.transform(box); - axis_direction = 1; - break; - - default: - - axis_direction = 2; - break; + } else { + for (int d = 0; d < dim.getValue(); ++d) { + if (d != axis_direction) { + box.setUpper(static_cast(d), + box.upper(static_cast(d)) - 1); } - - } else if (axis_direction == 1) { - - switch (rotation) { - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::JDOWN_IDOWN_KDOWN: - - axis_direction = 0; - break; - - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: - - axis_direction = 1; - break; - - default: - - axis_direction = 2; - break; + } + transformation.transform(box); + if (dim.getValue() == 2) { + const int rotation_num = static_cast(rotation); + if (rotation_num % 2) { + axis_direction = (axis_direction + 1) % 2; } - - } else if (axis_direction == 2) { - - switch (rotation) { - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: - - axis_direction = 0; - break; - - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::IDOWN_KDOWN_JDOWN: - - axis_direction = 1; - break; - - default: - - axis_direction = 2; - break; - + } else if (dim.getValue() == 3) { + + if (axis_direction == 0) { + + switch (rotation) { + + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::IDOWN_KDOWN_JDOWN: + + axis_direction = 0; + break; + + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::JDOWN_IDOWN_KDOWN: + + axis_direction = 1; + break; + + default: + + axis_direction = 2; + break; + + } + + } else if (axis_direction == 1) { + + switch (rotation) { + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::JDOWN_IDOWN_KDOWN: + + axis_direction = 0; + break; + + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + axis_direction = 1; + break; + + default: + + axis_direction = 2; + break; + } + + } else if (axis_direction == 2) { + + switch (rotation) { + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + axis_direction = 0; + break; + + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::IDOWN_KDOWN_JDOWN: + + axis_direction = 1; + break; + + default: + + axis_direction = 2; + break; + + } } } - } - for (int d = 0; d < dim.getValue(); d++) { - if (d != axis_direction) { - box.upper() (d) += 1; + for (int d = 0; d < dim.getValue(); ++d) { + if (d != axis_direction) { + box.setUpper(static_cast(d), + box.upper(static_cast(d)) + 1); + } } } } @@ -407,9 +440,9 @@ EdgeGeometry::transform( const int axis_direction = index.getAxis(); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { if (i == axis_direction && index(i) >= 0) { - index(i)++; + ++index(i); } } @@ -423,7 +456,7 @@ EdgeGeometry::transform( if (rotation_num) { EdgeIndex tmp_index(dim); - for (int r = 0; r < rotation_num; r++) { + for (int r = 0; r < rotation_num; ++r) { tmp_index = index; index(0) = tmp_index(1); index(1) = -tmp_index(0); @@ -556,9 +589,9 @@ EdgeGeometry::transform( } - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { if (i == new_axis_direction && index(i) > 0) { - index(i)--; + --index(i); } } @@ -575,7 +608,7 @@ EdgeGeometry::rotateAboutAxis(EdgeIndex& index, const int b = (axis + 2) % dim.getValue(); EdgeIndex tmp_index(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_index = index; index(a) = tmp_index(b); index(b) = -tmp_index(a); @@ -583,13 +616,28 @@ EdgeGeometry::rotateAboutAxis(EdgeIndex& index, int new_axis_direction = index.getAxis(); if (new_axis_direction != axis) { - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { new_axis_direction = new_axis_direction == a ? b : a; } } index.setAxis(new_axis_direction); } +EdgeIterator +EdgeGeometry::begin( + const hier::Box& box, + int axis) +{ + return EdgeIterator(box, axis, true); +} + +EdgeIterator +EdgeGeometry::end( + const hier::Box& box, + int axis) +{ + return EdgeIterator(box, axis, false); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.h index de3d3843..b530f724 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -20,22 +20,26 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" + +#include namespace SAMRAI { namespace pdat { +class EdgeIterator; + /*! * Class EdgeGeometry manages the mapping between the AMR index space * and the edge-centered geometry index space. It is a subclass of * hier::BoxGeometry and it computes intersections between edge- * centered box geometries for communication operations. * - * See header file for EdgeData class for a more detailed + * See header file for EdgeData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::EdgeOverlap + * @see EdgeOverlap */ class EdgeGeometry:public hier::BoxGeometry @@ -49,8 +53,10 @@ class EdgeGeometry:public hier::BoxGeometry /*! * @brief Convert an AMR index box space box into an edge geometry box. * An edge geometry box extends the given AMR index box space box - * by one in upper dimension for each coordinate direction not equal + * by one in upper end for each coordinate direction not equal * to the axis direction. + * + * @pre (0 <= axis) && (axis < box.getDim().getValue()) */ static hier::Box toEdgeBox( @@ -90,9 +96,22 @@ class EdgeGeometry:public hier::BoxGeometry EdgeIndex& index, const hier::Transformation& transformation); + static EdgeIterator + begin( + const hier::Box& box, + int axis); + + static EdgeIterator + end( + const hier::Box& box, + int axis); + /*! * @brief Construct the edge geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ EdgeGeometry( const hier::Box& box, @@ -106,6 +125,8 @@ class EdgeGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in edge-centered index space between * the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -118,6 +139,23 @@ class EdgeGeometry:public hier::BoxGeometry const bool retry, const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! + * @brief Compute the edge-centered destination boxes that represent + * the overlap between the source box geometry and the destination + * box geometry. + * + * @pre src_mask.getDim() == transformation.getOffset.getDim() + */ + void + computeDestinationBoxes( + std::vector& dst_boxes, + const EdgeGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! * @brief Set up a EdgeOverlap object based on the given boxes and the * transformation @@ -171,7 +209,7 @@ class EdgeGeometry:public hier::BoxGeometry EdgeGeometry( const EdgeGeometry&); // not implemented - void + EdgeGeometry& operator = ( const EdgeGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.C index 75205d63..04844e16 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_EdgeIndex_C -#define included_pdat_EdgeIndex_C - #include "SAMRAI/pdat/EdgeIndex.h" namespace SAMRAI { @@ -32,7 +28,7 @@ EdgeIndex::EdgeIndex( if (getDim() > tbox::Dimension(1)) { (*this)((d_axis + 1) % getDim().getValue()) += edge % 2; } - for (int j = 2; j < getDim().getValue(); j++) { + for (int j = 2; j < getDim().getValue(); ++j) { (*this)((d_axis + j) % getDim().getValue()) += (edge / (1 << (j - 1))) % 2; } } @@ -55,14 +51,14 @@ EdgeIndex::toCell( const tbox::Dimension& dim(getDim()); hier::Index index(dim); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { index(i) = (*this)(i); } if (dim > tbox::Dimension(1)) { index((d_axis + 1) % dim.getValue()) += ((edge % 2) - 1); } - for (int j = 2; j < dim.getValue(); j++) { + for (int j = 2; j < dim.getValue(); ++j) { index((d_axis + j) % dim.getValue()) += (((edge / (2 << (j - 1))) % 2) - 1); } return index; @@ -70,4 +66,3 @@ EdgeIndex::toCell( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.h index 08ee2df5..7ae0379a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIndex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -28,9 +28,9 @@ namespace pdat { * about the mapping between the AMR index space and the edge indices. * * @see hier::Index - * @see pdat::EdgeData - * @see pdat::EdgeGeometry - * @see pdat::EdgeIterator + * @see EdgeData + * @see EdgeGeometry + * @see EdgeIterator */ class EdgeIndex:public hier::Index @@ -103,7 +103,9 @@ class EdgeIndex:public hier::Index * For dimension 3, converts the edge index into the index on the lower * left (argument edge == 0), the lower right (argument edge == 1), * the upper left (argument edge == 2), or the upper right - * (argument edge == 3) of thw edge. + * (argument edge == 3) of the edge. + * + * TODO: I find the above comment confusing. */ hier::Index toCell( @@ -111,24 +113,28 @@ class EdgeIndex:public hier::Index /** * Plus-equals operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex& operator += ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator += (rhs); return *this; } /** * Plus operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex operator + ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); EdgeIndex tmp = *this; tmp += rhs; return tmp; @@ -159,24 +165,28 @@ class EdgeIndex:public hier::Index /** * Minus-equals operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex& operator -= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator -= (rhs); return *this; } /** * Minus operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex operator - ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); EdgeIndex tmp = *this; tmp -= rhs; return tmp; @@ -207,24 +217,28 @@ class EdgeIndex:public hier::Index /** * Times-equals operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex& operator *= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator *= (rhs); return *this; } /** * Times operator for a edge index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ EdgeIndex operator * ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); EdgeIndex tmp = *this; tmp *= rhs; return tmp; @@ -256,24 +270,28 @@ class EdgeIndex:public hier::Index /** * Returns true if two edge index objects are equal. All components * and the corresponding edge axes must be the same for equality. + * + * @pre getDim() == rhs.getDim() */ bool operator == ( const EdgeIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator == (rhs) && (d_axis == rhs.d_axis); } /** * Returns true if two edge index objects are not equal. Any of * the components or axes may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const EdgeIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator != (rhs) || (d_axis != rhs.d_axis); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.C index 1b5d23a8..d4d9f6eb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered int data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_EdgeIntegerConstantRefine_C -#define included_pdat_EdgeIntegerConstantRefine_C - #include "SAMRAI/pdat/EdgeIntegerConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefedgeintg1d, CONREFEDGEINTG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg1d, CONREFEDGEINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in conrefine2d.f: -void F77_FUNC(conrefedgeintg2d0, CONREFEDGEINTG2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg2d0, CONREFEDGEINTG2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefedgeintg2d1, CONREFEDGEINTG2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg2d1, CONREFEDGEINTG2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conrefedgeintg2d1, CONREFEDGEINTG2D1) (const int&, const int&, const int *, const int *, int *); // in conrefine3d.f: -void F77_FUNC(conrefedgeintg3d0, CONREFEDGEINTG3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg3d0, CONREFEDGEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conrefedgeintg3d0, CONREFEDGEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefedgeintg3d1, CONREFEDGEINTG3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg3d1, CONREFEDGEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conrefedgeintg3d1, CONREFEDGEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefedgeintg3d2, CONREFEDGEINTG3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefedgeintg3d2, CONREFEDGEINTG3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conrefedgeintg3d2, CONREFEDGEINTG3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -EdgeIntegerConstantRefine::EdgeIntegerConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +EdgeIntegerConstantRefine::EdgeIntegerConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ EdgeIntegerConstantRefine::getOperatorPriority() const } hier::IntVector -EdgeIntegerConstantRefine::getStencilWidth() const +EdgeIntegerConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,56 +119,55 @@ EdgeIntegerConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const EdgeOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (i != axis) { - fine_box.upper(i) -= 1; + fine_box.setUpper(i, fine_box.upper(i) - 1); } } const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefedgeintg1d, CONREFEDGEINTG1D) ( + SAMRAI_F77_FUNC(conrefedgeintg1d, CONREFEDGEINTG1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -183,7 +177,7 @@ EdgeIntegerConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefedgeintg2d0, CONREFEDGEINTG2D0) ( + SAMRAI_F77_FUNC(conrefedgeintg2d0, CONREFEDGEINTG2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -192,7 +186,7 @@ EdgeIntegerConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgeintg2d1, CONREFEDGEINTG2D1) ( + SAMRAI_F77_FUNC(conrefedgeintg2d1, CONREFEDGEINTG2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -203,7 +197,7 @@ EdgeIntegerConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefedgeintg3d0, CONREFEDGEINTG3D0) ( + SAMRAI_F77_FUNC(conrefedgeintg3d0, CONREFEDGEINTG3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -216,7 +210,7 @@ EdgeIntegerConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conrefedgeintg3d1, CONREFEDGEINTG3D1) ( + SAMRAI_F77_FUNC(conrefedgeintg3d1, CONREFEDGEINTG3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -229,7 +223,7 @@ EdgeIntegerConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conrefedgeintg3d2, CONREFEDGEINTG3D2) ( + SAMRAI_F77_FUNC(conrefedgeintg3d2, CONREFEDGEINTG3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -254,4 +248,3 @@ EdgeIntegerConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.h index a4954ceb..bda00e3f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIntegerConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for edge-centered integer data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class EdgeIntegerConstantRefine: /** * Uninteresting default constructor. */ - explicit EdgeIntegerConstantRefine( - const tbox::Dimension& dim); + EdgeIntegerConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class EdgeIntegerConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class EdgeIntegerConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.C index 0c9426b3..f91222ef 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for edge centered patch data types * ************************************************************************/ - -#ifndef included_pdat_EdgeIterator_C -#define included_pdat_EdgeIterator_C - #include "SAMRAI/pdat/EdgeIterator.h" namespace SAMRAI { @@ -24,8 +20,8 @@ EdgeIterator::EdgeIterator( d_box(EdgeGeometry::toEdgeBox(box, axis)) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -43,11 +39,11 @@ EdgeIterator::~EdgeIterator() EdgeIterator& EdgeIterator::operator ++ () { - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -60,11 +56,11 @@ EdgeIterator::operator ++ ( int) { EdgeIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -74,4 +70,3 @@ EdgeIterator::operator ++ ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.h index 379e5f5b..9015fba5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for edge centered patch data types * ************************************************************************/ @@ -37,23 +37,14 @@ namespace pdat { * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see pdat::EdgeData - * @see pdat::EdgeGeometry - * @see pdat::EdgeIndex + * @see EdgeData + * @see EdgeGeometry + * @see EdgeIndex */ class EdgeIterator { public: - /** - * Constructor for the edge iterator. The iterator will enumerate - * the indices in the argument box. - */ - EdgeIterator( - const hier::Box& box, - const int axis, - bool begin); - /** * Copy constructor for the edge iterator */ @@ -90,7 +81,7 @@ class EdgeIterator * Extract a pointer to the edge index corresponding to the iterator * position in the box. */ - const EdgeIndex* + const EdgeIndex * operator -> () const { return &d_index; @@ -116,6 +107,8 @@ class EdgeIterator operator == ( const EdgeIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index == iterator.d_index; } @@ -126,10 +119,33 @@ class EdgeIterator operator != ( const EdgeIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index != iterator.d_index; } private: + friend EdgeIterator + EdgeGeometry::begin( + const hier::Box& box, + int axis); + friend EdgeIterator + EdgeGeometry::end( + const hier::Box& box, + int axis); + + /** + * Constructor for the edge iterator. The iterator will enumerate + * the indices in the argument box. + */ + EdgeIterator( + const hier::Box& box, + const int axis, + bool begin); + + // Unimplemented default constructor. + EdgeIterator(); + EdgeIndex d_index; hier::Box d_box; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.C index d6b91ea6..10d1ae56 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.C @@ -3,31 +3,29 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_EdgeOverlap_C -#define included_pdat_EdgeOverlap_C - #include "SAMRAI/pdat/EdgeOverlap.h" +#include "SAMRAI/pdat/EdgeGeometry.h" + namespace SAMRAI { namespace pdat { EdgeOverlap::EdgeOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& transformation): d_is_overlap_empty(true), d_transformation(transformation) { const tbox::Dimension dim(transformation.getOffset().getDim()); - d_dst_boxes.resizeArray(boxes.getSize()); + d_dst_boxes.resize(boxes.size()); - for (int d = 0; d < boxes.getSize(); d++) { + for (int d = 0; d < static_cast(boxes.size()); ++d) { d_dst_boxes[d] = boxes[d]; - if (!d_dst_boxes[d].isEmpty()) d_is_overlap_empty = false; + if (!d_dst_boxes[d].empty()) d_is_overlap_empty = false; } } @@ -45,11 +43,40 @@ const hier::BoxContainer& EdgeOverlap::getDestinationBoxContainer( const int axis) const { - TBOX_ASSERT((axis >= 0) && (axis < d_dst_boxes.getSize())); + TBOX_ASSERT((axis >= 0) && (axis < static_cast(d_dst_boxes.size()))); return d_dst_boxes[axis]; } +void +EdgeOverlap::getSourceBoxContainer(hier::BoxContainer& src_boxes, + int& axis_direction) const +{ + TBOX_ASSERT(src_boxes.empty()); + TBOX_ASSERT(axis_direction >= 0 && + axis_direction < static_cast(d_dst_boxes.size())); + + src_boxes = d_dst_boxes[axis_direction]; + int transform_direction = axis_direction; + if (!src_boxes.empty()) { + hier::Transformation inverse_transform = + d_transformation.getInverseTransformation(); + for (hier::BoxContainer::iterator bi = src_boxes.begin(); + bi != src_boxes.end(); ++bi) { + transform_direction = axis_direction; + EdgeGeometry::transform(*bi, + transform_direction, + inverse_transform); + } + } + + axis_direction = transform_direction; + + TBOX_ASSERT(axis_direction >= 0 && + axis_direction < static_cast(d_dst_boxes.size())); + +} + const hier::IntVector& EdgeOverlap::getSourceOffset() const { @@ -64,4 +91,3 @@ EdgeOverlap::getTransformation() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.h index 804998c9..1d789329 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -30,7 +30,7 @@ namespace pdat { * with edge centered geometry. * * @see hier::BoxOverlap - * @see pdat::EdgeOverlap + * @see EdgeOverlap */ class EdgeOverlap:public hier::BoxOverlap @@ -42,7 +42,7 @@ class EdgeOverlap:public hier::BoxOverlap * in the generation of communication schedules. */ EdgeOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& transformation); /** @@ -64,14 +64,34 @@ class EdgeOverlap:public hier::BoxOverlap * constitute the intersection. The boxes are given in the * destination coordinate space and must be shifted by * -(getSourceOffset()) to lie in the source index space. The axis - * argument represents which axis is desired: X=0, Y=1, and - * Z=2. This method over-rides the virtual function in the - * hier::BoxOverlap base class. + * argument represents which axis is desired: X=0, Y=1, and Z=2. + * + * @pre (axis >= 0) && (axis < d_dst_boxes.size()) */ virtual const hier::BoxContainer& getDestinationBoxContainer( const int axis) const; + /*! + * @brief Get a BoxContainer representing the source boxes of the overlap. + * + * The src_boxes container will be filled with edge-centered source + * boxes of the overlap in the source coordinate space. The given + * axis direction is the axis in destination space on input and + * in source space on output. + * + * @param[out] src_boxes + * @param[in,out] axis_direction + * + * @pre src_boxes.empty() + * @pre axis_direction >= 0 && axis_direction < d_dst_boxes.size() + * @post axis_direction >= 0 && axis_direction < d_dst_boxes.size() + */ + virtual void + getSourceBoxContainer( + hier::BoxContainer& src_boxes, + int& axis_direction) const; + /** * Return the offset between the destination and source index spaces. * The destination index space is the source index space shifted @@ -86,7 +106,7 @@ class EdgeOverlap:public hier::BoxOverlap private: bool d_is_overlap_empty; hier::Transformation d_transformation; - tbox::Array d_dst_boxes; + std::vector d_dst_boxes; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.C index ab0c6f48..3ac7a7de 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/EdgeDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -52,37 +52,13 @@ EdgeVariable::~EdgeVariable() template int EdgeVariable::getDepth() const { - boost::shared_ptr > factory(getPatchDataFactory()); + boost::shared_ptr > factory( + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -EdgeVariable::EdgeVariable( - const EdgeVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void EdgeVariable::operator = ( - const EdgeVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.h index 63418b2c..4299dd87 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/EdgeVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -22,16 +22,16 @@ namespace SAMRAI { namespace pdat { /*! - * Class EdgeVariable is a templated variable class used to define + * Class EdgeVariable is a templated variable class used to define * edge-centered quantities on an AMR mesh. It is a subclass of * hier::Variable and is templated on the type of the underlying data * (e.g., double, int, bool, etc.). * - * See header file for EdgeData class for a more detailed + * See header file for EdgeData class for a more detailed * description of the data layout. * - * @see pdat::EdgeData - * @see pdat::EdgeDataFactory + * @see EdgeData + * @see EdgeDataFactory * @see hier::Variable */ @@ -86,11 +86,14 @@ class EdgeVariable:public hier::Variable private: bool d_fine_boundary_represents_var; + // Unimplemented copy constructor EdgeVariable( - const EdgeVariable&); // not implemented - void + const EdgeVariable&); + + // Unimplemented assignment operator + EdgeVariable& operator = ( - const EdgeVariable&); // not implemented + const EdgeVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.C index 15a3c112..82f65b44 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_FaceComplexConstantRefine_C -#define included_pdat_FaceComplexConstantRefine_C - #include "SAMRAI/pdat/FaceComplexConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in refine1d.f: -void F77_FUNC(conreffacecplx1d, CONREFFACECPLX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx1d, CONREFFACECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in refine2d.f: -void F77_FUNC(conreffacecplx2d0, CONREFFACECPLX2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx2d0, CONREFFACECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conreffacecplx2d1, CONREFFACECPLX2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx2d1, CONREFFACECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conreffacecplx2d1, CONREFFACECPLX2D1) (const int&, const int&, const int *, const dcomplex *, dcomplex *); // in refine3d.f: -void F77_FUNC(conreffacecplx3d0, CONREFFACECPLX3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx3d0, CONREFFACECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conreffacecplx3d0, CONREFFACECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conreffacecplx3d1, CONREFFACECPLX3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx3d1, CONREFFACECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conreffacecplx3d1, CONREFFACECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conreffacecplx3d2, CONREFFACECPLX3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacecplx3d2, CONREFFACECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conreffacecplx3d2, CONREFFACECPLX3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -FaceComplexConstantRefine::FaceComplexConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +FaceComplexConstantRefine::FaceComplexConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ FaceComplexConstantRefine::getOperatorPriority() const } hier::IntVector -FaceComplexConstantRefine::getStencilWidth() const +FaceComplexConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,58 +119,62 @@ FaceComplexConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conreffacecplx1d, CONREFFACECPLX1D) ( + SAMRAI_F77_FUNC(conreffacecplx1d, CONREFFACECPLX1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -185,7 +184,7 @@ FaceComplexConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conreffacecplx2d0, CONREFFACECPLX2D0) ( + SAMRAI_F77_FUNC(conreffacecplx2d0, CONREFFACECPLX2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -194,7 +193,7 @@ FaceComplexConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffacecplx2d1, CONREFFACECPLX2D1) ( + SAMRAI_F77_FUNC(conreffacecplx2d1, CONREFFACECPLX2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -205,7 +204,7 @@ FaceComplexConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conreffacecplx3d0, CONREFFACECPLX3D0) ( + SAMRAI_F77_FUNC(conreffacecplx3d0, CONREFFACECPLX3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -218,7 +217,7 @@ FaceComplexConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffacecplx3d1, CONREFFACECPLX3D1) ( + SAMRAI_F77_FUNC(conreffacecplx3d1, CONREFFACECPLX3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -231,7 +230,7 @@ FaceComplexConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conreffacecplx3d2, CONREFFACECPLX3D2) ( + SAMRAI_F77_FUNC(conreffacecplx3d2, CONREFFACECPLX3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -256,4 +255,3 @@ FaceComplexConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.h index c118697c..c75272d0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered complex data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class FaceComplexConstantRefine: /** * Uninteresting default constructor. */ - explicit FaceComplexConstantRefine( - const tbox::Dimension& dim); + FaceComplexConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class FaceComplexConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class FaceComplexConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.C index b8c1da60..01fd7e88 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered complex data. * ************************************************************************/ - -#ifndef included_pdat_FaceComplexLinearTimeInterpolateOp_C -#define included_pdat_FaceComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.h" #include "SAMRAI/pdat/FaceData.h" #include "SAMRAI/pdat/FaceVariable.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintfacecmplx1d, LINTIMEINTFACECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx1d, LINTIMEINTFACECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintfacecmplx1d, LINTIMEINTFACECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintfacecmplx2d0, LINTIMEINTFACECMPLX2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx2d0, LINTIMEINTFACECMPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintfacecmplx2d0, LINTIMEINTFACECMPLX2D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintfacecmplx2d1, LINTIMEINTFACECMPLX2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx2d1, LINTIMEINTFACECMPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintfacecmplx2d1, LINTIMEINTFACECMPLX2D1) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintfacecmplx3d0, LINTIMEINTFACECMPLX3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx3d0, LINTIMEINTFACECMPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintfacecmplx3d0, LINTIMEINTFACECMPLX3D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintfacecmplx3d1, LINTIMEINTFACECMPLX3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx3d1, LINTIMEINTFACECMPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintfacecmplx3d1, LINTIMEINTFACECMPLX3D1) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintfacecmplx3d2, LINTIMEINTFACECMPLX3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacecmplx3d2, LINTIMEINTFACECMPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const FaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const FaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); FaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,9 +168,9 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintfacecmplx1d, LINTIMEINTFACECMPLX1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx1d, LINTIMEINTFACECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -184,7 +180,7 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintfacecmplx2d0, LINTIMEINTFACECMPLX2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx2d0, LINTIMEINTFACECMPLX2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -193,7 +189,7 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacecmplx2d1, LINTIMEINTFACECMPLX2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx2d1, LINTIMEINTFACECMPLX2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -203,7 +199,7 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintfacecmplx3d0, LINTIMEINTFACECMPLX3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx3d0, LINTIMEINTFACECMPLX3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -216,7 +212,7 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacecmplx3d1, LINTIMEINTFACECMPLX3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx3d1, LINTIMEINTFACECMPLX3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -229,7 +225,7 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintfacecmplx3d2, LINTIMEINTFACECMPLX3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacecmplx3d2, LINTIMEINTFACECMPLX3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -252,4 +248,3 @@ FaceComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.h index fdd13796..33726e70 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered complex data. * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -49,6 +49,18 @@ class FaceComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.C index b5750c95..0bd7ad76 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated face centered patch data type * ************************************************************************/ @@ -44,13 +44,13 @@ FaceData::FaceData( hier::PatchData(box, ghosts), d_depth(depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); - for (int d = 0; d < getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { const hier::Box face = FaceGeometry::toFaceBox(getGhostBox(), d); - d_data[d].initializeArray(face, depth); + d_data[d].reset(new ArrayData(face, depth)); } } @@ -59,32 +59,6 @@ FaceData::~FaceData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -FaceData::FaceData( - const FaceData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -FaceData::operator = ( - const FaceData& foo) -{ - NULL_USE(foo); -} - template int FaceData::getDepth() const @@ -93,7 +67,7 @@ FaceData::getDepth() const } template -TYPE* +TYPE * FaceData::getPointer( int face_normal, int depth) @@ -101,11 +75,11 @@ FaceData::getPointer( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[face_normal].getPointer(depth); + return d_data[face_normal]->getPointer(depth); } template -const TYPE* +const TYPE * FaceData::getPointer( int face_normal, int depth) const @@ -113,7 +87,7 @@ FaceData::getPointer( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[face_normal].getPointer(depth); + return d_data[face_normal]->getPointer(depth); } template @@ -122,14 +96,14 @@ FaceData::operator () ( const FaceIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -138,14 +112,14 @@ FaceData::operator () ( const FaceIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -156,7 +130,7 @@ FaceData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); - return d_data[face_normal]; + return *(d_data[face_normal]); } template @@ -167,7 +141,7 @@ FaceData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); - return d_data[face_normal]; + return *(d_data[face_normal]); } /* @@ -184,18 +158,17 @@ void FaceData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const FaceData* t_src = - dynamic_cast *>(&src); + const FaceData* t_src = dynamic_cast *>(&src); - if (t_src == NULL) { + if (t_src == 0) { src.copy2(*this); } else { - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * t_src->d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * t_src->d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copy(t_src->d_data[d], box); + d_data[d]->copy(*(t_src->d_data[d]), box); } } } @@ -206,17 +179,16 @@ void FaceData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - FaceData* t_dst = - dynamic_cast *>(&dst); + FaceData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * t_dst->d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * t_dst->d_data[d]->getBox(); if (!box.empty()) { - t_dst->d_data[d].copy(d_data[d], box); + t_dst->d_data[d]->copy(*(d_data[d]), box); } } } @@ -236,23 +208,21 @@ FaceData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const FaceData* t_src = - dynamic_cast *>(&src); - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceData* t_src = dynamic_cast *>(&src); + const FaceOverlap* t_overlap = dynamic_cast(&overlap); - if ((t_src == NULL) || (t_overlap == NULL)) { + if ((t_src == 0) || (t_overlap == 0)) { src.copy2(*this, overlap); } else { if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(src_offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = src_offset((d + i) % getDim().getValue()); } } @@ -262,7 +232,7 @@ FaceData::copy( getBox().getBlockId()); const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - d_data[d].copy(t_src->d_data[d], box_list, transform); + d_data[d]->copy(*(t_src->d_data[d]), box_list, transform); } } else { copyWithRotation(*t_src, *t_overlap); @@ -276,30 +246,33 @@ FaceData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - FaceData* t_dst = - dynamic_cast *>(&dst); + FaceData* t_dst = CPP_CAST *>(&dst); - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(src_offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = src_offset((d + i) % getDim().getValue()); } } + hier::Transformation transform(hier::Transformation::NO_ROTATE, + face_offset, + getBox().getBlockId(), + t_dst->getBox().getBlockId()); + const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - t_dst->d_data[d].copy(d_data[d], box_list, face_offset); + t_dst->d_data[d]->copy(*(d_data[d]), box_list, transform); } } else { t_dst->copyWithRotation(*this, *t_overlap); @@ -312,11 +285,11 @@ FaceData::copyOnBox( const FaceData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { const hier::Box face_box = FaceGeometry::toFaceBox(box, axis); - d_data[axis].copy(src.getArrayData(axis), face_box); + d_data[axis]->copy(src.getArrayData(axis), face_box); } } @@ -351,12 +324,12 @@ FaceData::copyWithRotation( rotatebox.getBlockId(), getBox().getBlockId()); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); hier::Box face_rotatebox(FaceGeometry::toFaceBox(rotatebox, i)); - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -366,15 +339,16 @@ FaceData::copyWithRotation( const int depth = ((getDepth() < src.getDepth()) ? getDepth() : src.getDepth()); - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); + ci != ciend; ++ci) { FaceIndex dst_index(*ci, 0, 0); dst_index.setAxis(i); FaceIndex src_index(dst_index); FaceGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*this)(dst_index, d) = src(src_index, d); } } @@ -399,12 +373,12 @@ FaceData::copyDepth( const FaceData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - for (int d = 0; d < getDim().getValue(); d++) { - const hier::Box box = d_data[d].getBox() * src.d_data[d].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::Box box = d_data[d]->getBox() * src.d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copyDepth(dst_depth, src.d_data[d], src_depth, box); + d_data[d]->copyDepth(dst_depth, *(src.d_data[d]), src_depth, box); } } } @@ -426,26 +400,25 @@ FaceData::canEstimateStreamSizeFromBox() const } template -int +size_t FaceData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - int size = 0; - for (int d = 0; d < getDim().getValue(); d++) { + size_t size = 0; + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } - size += d_data[d].getDataStreamSize(t_overlap->getDestinationBoxContainer(d), + size += d_data[d]->getDataStreamSize(t_overlap->getDestinationBoxContainer(d), face_offset); } return size; @@ -466,24 +439,30 @@ FaceData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - if (t_overlap->getTransformation().getRotation() == + const hier::Transformation& transformation = + t_overlap->getTransformation(); + if (transformation.getRotation() == hier::Transformation::NO_ROTATE) { const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } + hier::Transformation transform(hier::Transformation::NO_ROTATE, + face_offset, + transformation.getBeginBlock(), + transformation.getEndBlock()); + const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].packStream(stream, boxes, face_offset); + if (!boxes.empty()) { + d_data[d]->packStream(stream, boxes, transform); } } } else { @@ -514,7 +493,6 @@ FaceData::packWithRotation( hier::Transformation::calculateReverseShift( back_shift, shift, rotate); - hier::Box rotatebox(getGhostBox()); overlap.getTransformation().transform(rotatebox); @@ -524,16 +502,16 @@ FaceData::packWithRotation( const int depth = getDepth(); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); - const int size = depth * overlap_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = depth * overlap_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); hier::Box face_rotatebox(FaceGeometry::toFaceBox(rotatebox, i)); int buf_count = 0; - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -541,22 +519,23 @@ FaceData::packWithRotation( if (!copybox.empty()) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); + ci != ciend; ++ci) { FaceIndex src_index(*ci, 0, 0); src_index.setAxis(i); FaceGeometry::transform(src_index, back_trans); buffer[buf_count] = (*this)(src_index, d); - buf_count++; + ++buf_count; } } } } - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } } @@ -566,22 +545,22 @@ FaceData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } + const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].unpackStream(stream, boxes, face_offset); + if (!boxes.empty()) { + d_data[d]->unpackStream(stream, boxes, face_offset); } } } @@ -602,13 +581,13 @@ FaceData::getSizeOfData( int depth, const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); size_t size = 0; const hier::Box ghost_box = hier::Box::grow(box, ghosts); - for (int d = 0; d < box.getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < box.getDim().getValue(); ++d) { const hier::Box face_box = FaceGeometry::toFaceBox(ghost_box, d); size += ArrayData::getSizeOfData(face_box, depth); } @@ -631,8 +610,8 @@ FaceData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fill(t, d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fill(t, d); } } @@ -643,12 +622,12 @@ FaceData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fill(t, FaceGeometry::toFaceBox(box, i), d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fill(t, FaceGeometry::toFaceBox(box, i), d); } } @@ -657,8 +636,8 @@ void FaceData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fillAll(t); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fillAll(t); } } @@ -668,10 +647,10 @@ FaceData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i].fillAll(t, FaceGeometry::toFaceBox(box, i)); + for (tbox::Dimension::dir_t i = 0; i < getDim().getValue(); ++i) { + d_data[i]->fillAll(t, FaceGeometry::toFaceBox(box, i)); } } @@ -691,9 +670,9 @@ FaceData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { os << "Array face normal = " << axis << std::endl; printAxis(axis, box, os, prec); } @@ -707,10 +686,10 @@ FaceData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { os << "Array face normal = " << axis << std::endl; printAxis(axis, box, d, os, prec); } @@ -719,15 +698,15 @@ FaceData::print( template void FaceData::printAxis( - int face_normal, + tbox::Dimension::dir_t face_normal, const hier::Box& box, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + TBOX_ASSERT((face_normal < getDim().getValue())); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxis(face_normal, box, d, os, prec); } @@ -736,21 +715,21 @@ FaceData::printAxis( template void FaceData::printAxis( - int face_normal, + tbox::Dimension::dir_t face_normal, const hier::Box& box, int depth, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); + TBOX_ASSERT((face_normal < getDim().getValue())); os.precision(prec); - FaceIterator iend(box, face_normal, false); - for (FaceIterator i(box, face_normal, true); i != iend; ++i) { + FaceIterator iend(FaceGeometry::end(box, face_normal)); + for (FaceIterator i(FaceGeometry::begin(box, face_normal)); i != iend; ++i) { os << "array" << *i << " = " - << d_data[face_normal](*i, depth) << std::endl << std::flush; + << (*(d_data[face_normal]))(*i, depth) << std::endl << std::flush; } } @@ -758,7 +737,7 @@ FaceData::printAxis( ************************************************************************* * * Checks that class version and restart file version are equal. If so, - * reads in the d_depth data member to the database. Then tells + * reads in the d_depth data member from the restart database. Then tells * d_data to read itself in from the database. * ************************************************************************* @@ -766,24 +745,26 @@ FaceData::printAxis( template void -FaceData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +FaceData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_FACEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_FACEDATA_VERSION"); if (ver != PDAT_FACEDATA_VERSION) { - TBOX_ERROR("FaceData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("FaceData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->getDatabase(array_name); - (d_data[i]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i]->getFromRestart(array_database); } } @@ -798,20 +779,22 @@ FaceData::getSpecializedFromDatabase( template void -FaceData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +FaceData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_FACEDATA_VERSION", PDAT_FACEDATA_VERSION); + restart_db->putInteger("PDAT_FACEDATA_VERSION", PDAT_FACEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->putDatabase(array_name); - (d_data[i]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i]->putToRestart(array_database); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.h index f96c3fe4..fd9d7f8b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated face centered patch data type * ************************************************************************/ @@ -16,18 +16,19 @@ #include "SAMRAI/pdat/ArrayData.h" #include "SAMRAI/pdat/FaceIndex.h" #include "SAMRAI/pdat/FaceIterator.h" +#include "SAMRAI/pdat/FaceOverlap.h" #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class FaceData provides an implementation for data defined + * @brief Class FaceData provides an implementation for data defined * at cell faces on AMR patches. It is derived from the hier::PatchData * interface common to all SAMRAI patch data types. Given a CELL-centered * AMR index space box, a face data object represents data of some template @@ -39,12 +40,12 @@ namespace pdat { * Face data is stored in DIM arrays, each of which contains the * data for the faces normal to a corresponding coordinate direction. * In addition, the array indices are permuted so that the fastest array - * dimension is the same as the normal direction of the face. + * direction is the same as the normal direction of the face. * Memory allocation is in column-major ordering (e.g., Fortran * style) so that the leftmost index runs fastest in memory. * For example, a three-dimensional face data object created over a * CELL-centered AMR index space [l0:u0,l1:u1,l2:u2] allocates three data - * arrays dimensioned as follows: + * arrays sized as follows: * \verbatim * * face normal 0 @@ -71,16 +72,16 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * IMPORTANT: The SideData class provides the same storage + * IMPORTANT: The SideData class provides the same storage * as this face data class, except that the coordinate directions of the * individual arrays are not permuted. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::FaceDataFactory - * @see pdat::FaceIndex - * @see pdat::FaceIterator - * @see pdat::FaceGeometry + * @see FaceDataFactory + * @see FaceIndex + * @see FaceIterator + * @see FaceGeometry */ template @@ -103,6 +104,9 @@ class FaceData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the face data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 */ static size_t getSizeOfData( @@ -121,6 +125,10 @@ class FaceData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the face data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ FaceData( const hier::Box& box, @@ -142,6 +150,9 @@ class FaceData:public hier::PatchData /*! * @brief Get a pointer to the beginning of a particular face normal and * depth component of the face centered array. + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -151,6 +162,9 @@ class FaceData:public hier::PatchData /*! * @brief Get a const pointer to the beginning of a particular face normal * and depth component of the face centered array. + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -160,6 +174,10 @@ class FaceData:public hier::PatchData /*! * @brief Return a reference to the data entry corresponding * to a given face index and depth. + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue())); + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -169,6 +187,10 @@ class FaceData:public hier::PatchData /*! * @brief Return a const reference to the data entry corresponding * to a given face index and depth. + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue())); + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -178,6 +200,8 @@ class FaceData:public hier::PatchData /*! * @brief Return a reference to the array data object for the * given face normal of the face centered data object. + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ ArrayData& getArrayData( @@ -186,6 +210,8 @@ class FaceData:public hier::PatchData /*! * @brief Return a const reference to the array data object for the * given face normal of the face centered data object. + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ const ArrayData& getArrayData( @@ -200,6 +226,8 @@ class FaceData:public hier::PatchData * both the source and destination). Currently, source data must be * an FaceData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -214,6 +242,9 @@ class FaceData:public hier::PatchData * both the source and destination). Currently, destination data must be * an FaceData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -226,6 +257,8 @@ class FaceData:public hier::PatchData * Currently, source data must be FaceData of the same DIM and TYPE * and the overlap must be a FaceOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -239,6 +272,10 @@ class FaceData:public hier::PatchData * Currently, destination data must be FaceData of the same DIM and TYPE * and the overlap must be a FaceOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy2( @@ -248,6 +285,8 @@ class FaceData:public hier::PatchData /*! * @brief Copy data from source to destination (i.e., this) * patch data object on the given CELL-centered AMR index box. + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copyOnBox( @@ -258,6 +297,8 @@ class FaceData:public hier::PatchData * @brief Fast copy (i.e., source and this face data objects are * defined over the same box) to this destination face data object * from the given source face data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -283,8 +324,10 @@ class FaceData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -292,6 +335,8 @@ class FaceData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * FaceOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -302,6 +347,8 @@ class FaceData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * FaceOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -310,6 +357,8 @@ class FaceData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -318,6 +367,9 @@ class FaceData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -334,6 +386,8 @@ class FaceData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -349,10 +403,12 @@ class FaceData:public hier::PatchData * and will be converted to face index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -371,10 +427,13 @@ class FaceData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -395,14 +454,17 @@ class FaceData:public hier::PatchData * and will be converted to face index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ void printAxis( - int face_normal, + tbox::Dimension::dir_t face_normal, const hier::Box& box, std::ostream& os = tbox::plog, int prec = 12) const; @@ -421,14 +483,18 @@ class FaceData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ void printAxis( - int face_normal, + tbox::Dimension::dir_t face_normal, const hier::Box& box, int depth, std::ostream& os = tbox::plog, @@ -436,23 +502,23 @@ class FaceData:public hier::PatchData /*! * Check that class version and restart file version are equal. If so, - * read data members from the database. + * read data members from the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * The face iterator iterates over the elements on one face normal of a face @@ -467,11 +533,14 @@ class FaceData:public hier::PatchData */ static const int PDAT_FACEDATA_VERSION; + // Unimplemented copy constructor FaceData( - const FaceData&); // not implemented - void + const FaceData&); + + // Unimplemented assignment operator + FaceData& operator = ( - const FaceData&); // not implemented + const FaceData&); void copyWithRotation( @@ -484,7 +553,8 @@ class FaceData:public hier::PatchData const FaceOverlap& overlap) const; int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL]; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.C index 40746320..e6347828 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating face data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/pdat/OuterfaceDataFactory.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -64,12 +64,12 @@ boost::shared_ptr FaceDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared( - d_depth, - ghosts, - d_fine_boundary_represents_var); + d_depth, + ghosts, + d_fine_boundary_represents_var); } /* @@ -85,12 +85,12 @@ boost::shared_ptr FaceDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_depth, - d_ghosts); + patch.getBox(), + d_depth, + d_ghosts); } /* @@ -106,7 +106,7 @@ boost::shared_ptr FaceDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -131,7 +131,7 @@ size_t FaceDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(FaceData)); @@ -154,7 +154,7 @@ bool FaceDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -163,8 +163,8 @@ FaceDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > fdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (fdf) { valid_copy = true; } @@ -172,8 +172,9 @@ FaceDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > ofdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (ofdf) { valid_copy = true; } @@ -185,7 +186,7 @@ FaceDataFactory::validCopyTo( /* * Return a boolean value indicating how data for the face quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the FaceVariable class header file for more + * constructor. See the FaceVariable class header file for more * information. */ template diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.h index ae6a724b..0c90227e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating face data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::FaceData - * @see pdat::PatchDataFactory + * @see FaceData + * @see PatchDataFactory */ template @@ -40,10 +40,13 @@ class FaceDataFactory:public hier::PatchDataFactory { public: /** - * The constructor for the face data factory class. The ghost cell width, depth - * (number of components), and fine boundary representation arguments give the - * defaults for all edge data objects created with this factory. See - * the FaceVariable class header file for more information. + * The constructor for the face data factory class. The ghost cell width, + * depth (number of components), and fine boundary representation arguments + * give the defaults for all edge data objects created with this factory. + * See the FaceVariable class header file for more information. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ FaceDataFactory( int depth, @@ -64,6 +67,8 @@ class FaceDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -73,6 +78,8 @@ class FaceDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete face data object. * The default information about the object (e.g., ghost cell width) * is taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -82,6 +89,8 @@ class FaceDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -97,6 +106,8 @@ class FaceDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the face data object, * including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -105,21 +116,25 @@ class FaceDataFactory:public hier::PatchDataFactory /** * Return a boolean value indicating how data for the face quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the FaceVariable class header file for more + * constructor. See the FaceVariable class header file for more * information. */ - bool fineBoundaryRepresentsVariable() const; + bool + fineBoundaryRepresentsVariable() const; /** * Return true since the face data index space extends beyond the interior * of patches. That is, face data lives on patch borders. */ - bool dataLivesOnPatchBorder() const; + bool + dataLivesOnPatchBorder() const; /** * Return whether it is valid to copy this FaceDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is FaceDataFactory and OuterfaceDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.C index b047c616..a70fbbcd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_FaceDoubleConstantRefine_C -#define included_pdat_FaceDoubleConstantRefine_C - #include "SAMRAI/pdat/FaceDoubleConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in refine1d.f: -void F77_FUNC(conreffacedoub1d, CONREFFACEDOUB1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub1d, CONREFFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in refine2d.f: -void F77_FUNC(conreffacedoub2d0, CONREFFACEDOUB2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub2d0, CONREFFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conreffacedoub2d1, CONREFFACEDOUB2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub2d1, CONREFFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conreffacedoub2d1, CONREFFACEDOUB2D1) (const int&, const int&, const int *, const double *, double *); // in refine3d.f: -void F77_FUNC(conreffacedoub3d0, CONREFFACEDOUB3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub3d0, CONREFFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conreffacedoub3d0, CONREFFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conreffacedoub3d1, CONREFFACEDOUB3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub3d1, CONREFFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conreffacedoub3d1, CONREFFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conreffacedoub3d2, CONREFFACEDOUB3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffacedoub3d2, CONREFFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conreffacedoub3d2, CONREFFACEDOUB3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -FaceDoubleConstantRefine::FaceDoubleConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +FaceDoubleConstantRefine::FaceDoubleConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ FaceDoubleConstantRefine::getOperatorPriority() const } hier::IntVector -FaceDoubleConstantRefine::getStencilWidth() const +FaceDoubleConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,58 +119,62 @@ FaceDoubleConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conreffacedoub1d, CONREFFACEDOUB1D) ( + SAMRAI_F77_FUNC(conreffacedoub1d, CONREFFACEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -185,7 +184,7 @@ FaceDoubleConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conreffacedoub2d0, CONREFFACEDOUB2D0) ( + SAMRAI_F77_FUNC(conreffacedoub2d0, CONREFFACEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -194,7 +193,7 @@ FaceDoubleConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffacedoub2d1, CONREFFACEDOUB2D1) ( + SAMRAI_F77_FUNC(conreffacedoub2d1, CONREFFACEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -205,7 +204,7 @@ FaceDoubleConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conreffacedoub3d0, CONREFFACEDOUB3D0) ( + SAMRAI_F77_FUNC(conreffacedoub3d0, CONREFFACEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -218,7 +217,7 @@ FaceDoubleConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffacedoub3d1, CONREFFACEDOUB3D1) ( + SAMRAI_F77_FUNC(conreffacedoub3d1, CONREFFACEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -231,7 +230,7 @@ FaceDoubleConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conreffacedoub3d2, CONREFFACEDOUB3D2) ( + SAMRAI_F77_FUNC(conreffacedoub3d2, CONREFFACEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -256,4 +255,3 @@ FaceDoubleConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.h index 2d98abda..37491005 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class FaceDoubleConstantRefine: /** * Uninteresting default constructor. */ - explicit FaceDoubleConstantRefine( - const tbox::Dimension& dim); + FaceDoubleConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class FaceDoubleConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class FaceDoubleConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.C index be8fc88a..0fb89aeb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered double patch data. * ************************************************************************/ - -#ifndef included_pdat_FaceDoubleLinearTimeInterpolateOp_C -#define included_pdat_FaceDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintfacedoub1d, LINTIMEINTFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub1d, LINTIMEINTFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintfacedoub1d, LINTIMEINTFACEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintfacedoub2d0, LINTIMEINTFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub2d0, LINTIMEINTFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintfacedoub2d0, LINTIMEINTFACEDOUB2D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintfacedoub2d1, LINTIMEINTFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub2d1, LINTIMEINTFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintfacedoub2d1, LINTIMEINTFACEDOUB2D1) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintfacedoub3d0, LINTIMEINTFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub3d0, LINTIMEINTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintfacedoub3d0, LINTIMEINTFACEDOUB3D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintfacedoub3d1, LINTIMEINTFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub3d1, LINTIMEINTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintfacedoub3d1, LINTIMEINTFACEDOUB3D1) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintfacedoub3d2, LINTIMEINTFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacedoub3d2, LINTIMEINTFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const FaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const FaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); FaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,9 +168,9 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintfacedoub1d, LINTIMEINTFACEDOUB1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub1d, LINTIMEINTFACEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -184,7 +180,7 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintfacedoub2d0, LINTIMEINTFACEDOUB2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub2d0, LINTIMEINTFACEDOUB2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -193,7 +189,7 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacedoub2d1, LINTIMEINTFACEDOUB2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub2d1, LINTIMEINTFACEDOUB2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -203,7 +199,7 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintfacedoub3d0, LINTIMEINTFACEDOUB3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub3d0, LINTIMEINTFACEDOUB3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -216,7 +212,7 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacedoub3d1, LINTIMEINTFACEDOUB3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub3d1, LINTIMEINTFACEDOUB3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -229,7 +225,7 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintfacedoub3d2, LINTIMEINTFACEDOUB3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacedoub3d2, LINTIMEINTFACEDOUB3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -252,4 +248,3 @@ FaceDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.h index bba3e885..bfbe808a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered double patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class FaceDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.C index c2934e33..6bc3ff55 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_FaceFloatConstantRefine_C -#define included_pdat_FaceFloatConstantRefine_C - #include "SAMRAI/pdat/FaceFloatConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in refine1d.f: -void F77_FUNC(conreffaceflot1d, CONREFFACEFLOT1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot1d, CONREFFACEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in refine2d.f: -void F77_FUNC(conreffaceflot2d0, CONREFFACEFLOT2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot2d0, CONREFFACEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conreffaceflot2d1, CONREFFACEFLOT2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot2d1, CONREFFACEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conreffaceflot2d1, CONREFFACEFLOT2D1) (const int&, const int&, const int *, const float *, float *); // in refine3d.f: -void F77_FUNC(conreffaceflot3d0, CONREFFACEFLOT3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot3d0, CONREFFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conreffaceflot3d0, CONREFFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conreffaceflot3d1, CONREFFACEFLOT3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot3d1, CONREFFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conreffaceflot3d1, CONREFFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conreffaceflot3d2, CONREFFACEFLOT3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceflot3d2, CONREFFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conreffaceflot3d2, CONREFFACEFLOT3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -FaceFloatConstantRefine::FaceFloatConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +FaceFloatConstantRefine::FaceFloatConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ FaceFloatConstantRefine::getOperatorPriority() const } hier::IntVector -FaceFloatConstantRefine::getStencilWidth() const +FaceFloatConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,58 +119,62 @@ FaceFloatConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conreffaceflot1d, CONREFFACEFLOT1D) ( + SAMRAI_F77_FUNC(conreffaceflot1d, CONREFFACEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -185,7 +184,7 @@ FaceFloatConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conreffaceflot2d0, CONREFFACEFLOT2D0) ( + SAMRAI_F77_FUNC(conreffaceflot2d0, CONREFFACEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -194,7 +193,7 @@ FaceFloatConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffaceflot2d1, CONREFFACEFLOT2D1) ( + SAMRAI_F77_FUNC(conreffaceflot2d1, CONREFFACEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -205,7 +204,7 @@ FaceFloatConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conreffaceflot3d0, CONREFFACEFLOT3D0) ( + SAMRAI_F77_FUNC(conreffaceflot3d0, CONREFFACEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -218,7 +217,7 @@ FaceFloatConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffaceflot3d1, CONREFFACEFLOT3D1) ( + SAMRAI_F77_FUNC(conreffaceflot3d1, CONREFFACEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -231,7 +230,7 @@ FaceFloatConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conreffaceflot3d2, CONREFFACEFLOT3D2) ( + SAMRAI_F77_FUNC(conreffaceflot3d2, CONREFFACEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -256,4 +255,3 @@ FaceFloatConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.h index 4ddc3de5..02bfd3b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class FaceFloatConstantRefine: /** * Uninteresting default constructor. */ - explicit FaceFloatConstantRefine( - const tbox::Dimension& dim); + FaceFloatConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class FaceFloatConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class FaceFloatConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.C index 05cef463..3360cd4e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered float patch data. * ************************************************************************/ - -#ifndef included_pdat_FaceFloatLinearTimeInterpolateOp_C -#define included_pdat_FaceFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintfacefloat1d, LINTIMEINTFACEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat1d, LINTIMEINTFACEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintfacefloat1d, LINTIMEINTFACEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintfacefloat2d0, LINTIMEINTFACEFLOAT2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat2d0, LINTIMEINTFACEFLOAT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintfacefloat2d0, LINTIMEINTFACEFLOAT2D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintfacefloat2d1, LINTIMEINTFACEFLOAT2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat2d1, LINTIMEINTFACEFLOAT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintfacefloat2d1, LINTIMEINTFACEFLOAT2D1) (const int&, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintfacefloat3d0, LINTIMEINTFACEFLOAT3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat3d0, LINTIMEINTFACEFLOAT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintfacefloat3d0, LINTIMEINTFACEFLOAT3D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintfacefloat3d1, LINTIMEINTFACEFLOAT3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat3d1, LINTIMEINTFACEFLOAT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintfacefloat3d1, LINTIMEINTFACEFLOAT3D1) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintfacefloat3d2, LINTIMEINTFACEFLOAT3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintfacefloat3d2, LINTIMEINTFACEFLOAT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const FaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const FaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); FaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,9 +168,9 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintfacefloat1d, LINTIMEINTFACEFLOAT1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat1d, LINTIMEINTFACEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -184,7 +180,7 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintfacefloat2d0, LINTIMEINTFACEFLOAT2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat2d0, LINTIMEINTFACEFLOAT2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -193,7 +189,7 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacefloat2d1, LINTIMEINTFACEFLOAT2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat2d1, LINTIMEINTFACEFLOAT2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -203,7 +199,7 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintfacefloat3d0, LINTIMEINTFACEFLOAT3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat3d0, LINTIMEINTFACEFLOAT3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -216,7 +212,7 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, d), new_dat->getPointer(0, d), dst_dat->getPointer(0, d)); - F77_FUNC(lintimeintfacefloat3d1, LINTIMEINTFACEFLOAT3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat3d1, LINTIMEINTFACEFLOAT3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -229,7 +225,7 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, d), new_dat->getPointer(1, d), dst_dat->getPointer(1, d)); - F77_FUNC(lintimeintfacefloat3d2, LINTIMEINTFACEFLOAT3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintfacefloat3d2, LINTIMEINTFACEFLOAT3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -252,4 +248,3 @@ FaceFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.h index 6f906c44..b1a4ce14 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for face-centered float patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class FaceFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.C index 0374bec4..4f0ec366 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.C @@ -3,19 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_FaceGeometry_C -#define included_pdat_FaceGeometry_C - #include "SAMRAI/pdat/FaceGeometry.h" +#include "SAMRAI/pdat/FaceIterator.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -34,7 +31,7 @@ FaceGeometry::FaceGeometry( d_box(box), d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -67,7 +64,7 @@ FaceGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const FaceGeometry* t_dst = dynamic_cast(&dst_geometry); @@ -75,7 +72,7 @@ FaceGeometry::calculateOverlap( dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { + if ((t_src != 0) && (t_dst != 0)) { over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { @@ -99,22 +96,23 @@ FaceGeometry::calculateOverlap( hier::Box FaceGeometry::toFaceBox( const hier::Box& box, - int face_normal) + tbox::Dimension::dir_t face_normal) { const tbox::Dimension& dim(box.getDim()); - TBOX_ASSERT((face_normal >= 0) && (face_normal < dim.getValue())); + TBOX_ASSERT((face_normal < dim.getValue())); hier::Box face_box(dim); if (!box.empty()) { - const int x = face_normal; - face_box.lower(0) = box.lower(x); - face_box.upper(0) = box.upper(x) + 1; - for (int i = 1; i < dim.getValue(); i++) { - const int y = (face_normal + i) % dim.getValue(); - face_box.lower(i) = box.lower(y); - face_box.upper(i) = box.upper(y); + const tbox::Dimension::dir_t x = face_normal; + face_box.setLower(0, box.lower(x)); + face_box.setUpper(0, box.upper(x) + 1); + for (tbox::Dimension::dir_t i = 1; i < dim.getValue(); ++i) { + const tbox::Dimension::dir_t y = + static_cast((face_normal + i) % dim.getValue()); + face_box.setLower(i, box.lower(y)); + face_box.setUpper(i, box.upper(y)); } face_box.setBlockId(box.getBlockId()); } @@ -125,30 +123,27 @@ FaceGeometry::toFaceBox( /* ************************************************************************* * - * Compute the overlap between two face centered boxes. The algorithm - * is fairly straight-forward. First, we perform a quick-and-dirty - * intersection to see if the boxes might overlap. If that intersection - * is not empty, then we need to do a better job calculating the overlap - * for each dimension. Note that the AMR index space boxes must be - * shifted into the face centered space before we calculate the proper - * intersections. + * Compute the boxes that will be used to construct an overlap object * ************************************************************************* */ -boost::shared_ptr -FaceGeometry::doOverlap( - const FaceGeometry& dst_geometry, +void +FaceGeometry::computeDestinationBoxes( + std::vector& dst_boxes, const FaceGeometry& src_geometry, const hier::Box& src_mask, const hier::Box& fill_box, const bool overwrite_interior, const hier::Transformation& transformation, - const hier::BoxContainer& dst_restrict_boxes) + const hier::BoxContainer& dst_restrict_boxes) const { - const tbox::Dimension& dim(src_mask.getDim()); +#ifdef DEBUG_CHECK_DIM_ASSERTIONS + const hier::IntVector& src_offset = transformation.getOffset(); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); +#endif - tbox::Array dst_boxes(dim.getValue()); + const tbox::Dimension& dim(src_mask.getDim()); // Perform a quick-and-dirty intersection to see if the boxes might overlap @@ -157,7 +152,7 @@ FaceGeometry::doOverlap( hier::Box src_shift(src_box); transformation.transform(src_shift); const hier::Box dst_ghost( - hier::Box::grow(dst_geometry.d_box, dst_geometry.d_ghosts)); + hier::Box::grow(d_box, d_ghosts)); // Compute the intersection (if any) for each of the face directions @@ -168,24 +163,23 @@ FaceGeometry::doOverlap( one_vector)); if (!quick_check.empty()) { - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { const hier::Box dst_face(toFaceBox(dst_ghost, d)); const hier::Box src_face(toFaceBox(src_shift, d)); const hier::Box fill_face(toFaceBox(fill_box, d)); const hier::Box together(dst_face * src_face * fill_face); if (!together.empty()) { - dst_boxes[d].pushBack(together); if (!overwrite_interior) { - const hier::Box int_face(toFaceBox(dst_geometry.d_box, d)); + const hier::Box int_face(toFaceBox(d_box, d)); dst_boxes[d].removeIntersections(together, int_face); } else { dst_boxes[d].pushBack(together); } } // if (!together.empty()) - if (dst_restrict_boxes.size() && dst_boxes[d].size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { hier::BoxContainer face_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { face_restrict_boxes.pushBack(toFaceBox(*b, d)); } @@ -193,6 +187,43 @@ FaceGeometry::doOverlap( } } // loop over dim } // !quick_check.empty() +} + +/* + ************************************************************************* + * + * Compute the overlap between two face centered boxes. The algorithm + * is fairly straight-forward. First, we perform a quick-and-dirty + * intersection to see if the boxes might overlap. If that intersection + * is not empty, then we need to do a better job calculating the overlap + * for each direction. Note that the AMR index space boxes must be + * shifted into the face centered space before we calculate the proper + * intersections. + * + ************************************************************************* + */ + +boost::shared_ptr +FaceGeometry::doOverlap( + const FaceGeometry& dst_geometry, + const FaceGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes) +{ + const tbox::Dimension& dim(src_mask.getDim()); + + std::vector dst_boxes(dim.getValue()); + + dst_geometry.computeDestinationBoxes(dst_boxes, + src_geometry, + src_mask, + fill_box, + overwrite_interior, + transformation, + dst_restrict_boxes); // Create the face overlap data object using the boxes and source shift @@ -212,10 +243,11 @@ FaceGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box face_box(FaceGeometry::toFaceBox(*b, d)); dst_boxes[d].pushBack(face_box); } @@ -252,132 +284,141 @@ FaceGeometry::transform( transformation.getRotation(); hier::Box cell_box(dim); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { int cell_dim = (normal_direction + d) % dim.getValue(); - cell_box.lower() (cell_dim) = box.lower() (d); - cell_box.upper() (cell_dim) = box.upper() (d); + cell_box.setLower(static_cast(cell_dim), + box.lower(static_cast(d))); + cell_box.setUpper(static_cast(cell_dim), + box.upper(static_cast(d))); } - cell_box.upper() (normal_direction) -= 1; + cell_box.setUpper(static_cast(normal_direction), + cell_box.upper(static_cast(normal_direction)) - 1); cell_box.setBlockId(box.getBlockId()); transformation.transform(cell_box); - if (dim.getValue() == 2) { - const int rotation_num = static_cast(rotation); - if (rotation_num % 2) { - normal_direction = (normal_direction + 1) % 2; - } - } else if (dim.getValue() == 3) { - - if (normal_direction == 0) { - - switch (rotation) { - - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::IDOWN_KDOWN_JDOWN: - - normal_direction = 0; - break; - - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::JDOWN_IDOWN_KDOWN: - - normal_direction = 1; - break; - - default: - - normal_direction = 2; - break; - } + if (rotation != hier::Transformation::NO_ROTATE) { - } else if (normal_direction == 1) { - - switch (rotation) { - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::JDOWN_IDOWN_KDOWN: - - normal_direction = 0; - break; - - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: - - normal_direction = 1; - break; - - default: - - normal_direction = 2; - break; + if (dim.getValue() == 2) { + const int rotation_num = static_cast(rotation); + if (rotation_num % 2) { + normal_direction = (normal_direction + 1) % 2; } - - } else if (normal_direction == 2) { - - switch (rotation) { - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: - - normal_direction = 0; - break; - - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::IDOWN_KDOWN_JDOWN: - - normal_direction = 1; - break; - - default: - - normal_direction = 2; - break; - + } else if (dim.getValue() == 3) { + + if (normal_direction == 0) { + + switch (rotation) { + + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::IDOWN_KDOWN_JDOWN: + + normal_direction = 0; + break; + + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::JDOWN_IDOWN_KDOWN: + + normal_direction = 1; + break; + + default: + + normal_direction = 2; + break; + + } + + } else if (normal_direction == 1) { + + switch (rotation) { + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::JDOWN_IDOWN_KDOWN: + + normal_direction = 0; + break; + + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + normal_direction = 1; + break; + + default: + + normal_direction = 2; + break; + } + + } else if (normal_direction == 2) { + + switch (rotation) { + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + normal_direction = 0; + break; + + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::IDOWN_KDOWN_JDOWN: + + normal_direction = 1; + break; + + default: + + normal_direction = 2; + break; + + } } } } - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { int cell_dim = (normal_direction + d) % dim.getValue(); - box.lower() (d) = cell_box.lower() (cell_dim); - box.upper() (d) = cell_box.upper() (cell_dim); + box.setLower(static_cast(d), + cell_box.lower(static_cast(cell_dim))); + box.setUpper(static_cast(d), + cell_box.upper(static_cast(cell_dim))); } - box.upper() (0) += 1; + box.setUpper(0, box.upper(0) + 1); box.setBlockId(cell_box.getBlockId()); } } @@ -408,11 +449,11 @@ FaceGeometry::transform( const int normal_direction = index.getAxis(); FaceIndex rotate_index(dim); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { int rotate_dim = (normal_direction + d) % dim.getValue(); rotate_index(rotate_dim) = index(d); if (d != 0 && rotate_index(rotate_dim) >= 0) { - rotate_index(rotate_dim)++; + ++rotate_index(rotate_dim); } } rotate_index.setAxis(normal_direction); @@ -426,7 +467,7 @@ FaceGeometry::transform( if (rotation_num) { hier::Index tmp_index(dim); - for (int r = 0; r < rotation_num; r++) { + for (int r = 0; r < rotation_num; ++r) { tmp_index = rotate_index; rotate_index(0) = tmp_index(1); rotate_index(1) = -tmp_index(0); @@ -556,14 +597,14 @@ FaceGeometry::transform( new_normal_direction = rotate_index.getAxis(); } - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { if (d != new_normal_direction && rotate_index(d) > 0) { - rotate_index(d)--; + --rotate_index(d); } } rotate_index += transformation.getOffset(); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { int rotate_dim = (new_normal_direction + d) % dim.getValue(); index(d) = rotate_index(rotate_dim); } @@ -582,7 +623,7 @@ FaceGeometry::rotateAboutAxis(FaceIndex& index, const int b = (axis + 2) % dim.getValue(); FaceIndex tmp_index(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_index = index; index(a) = tmp_index(b); index(b) = -tmp_index(a); @@ -590,13 +631,28 @@ FaceGeometry::rotateAboutAxis(FaceIndex& index, int new_normal_direction = index.getAxis(); if (new_normal_direction != axis) { - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { new_normal_direction = new_normal_direction == a ? b : a; } } index.setAxis(new_normal_direction); } +FaceIterator +FaceGeometry::begin( + const hier::Box& box, + tbox::Dimension::dir_t axis) +{ + return FaceIterator(box, axis, true); +} + +FaceIterator +FaceGeometry::end( + const hier::Box& box, + tbox::Dimension::dir_t axis) +{ + return FaceIterator(box, axis, false); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.h index 5ebe7f6b..3f424e61 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -20,22 +20,25 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" +#include namespace SAMRAI { namespace pdat { +class FaceIterator; + /*! * Class FaceGeometry manages the mapping between the AMR index space * and the face-centered geometry index space. It is a subclass of * hier::BoxGeometry and it computes intersections between face- * centered box geometries for communication operations. * - * See header file for FaceData class for a more detailed + * See header file for FaceData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::FaceOverlap + * @see FaceOverlap */ class FaceGeometry:public hier::BoxGeometry @@ -49,15 +52,17 @@ class FaceGeometry:public hier::BoxGeometry /*! * @brief Convert an AMR index box space box into an face geometry box. * An face geometry box extends the given AMR index box space box - * by one in upper dimension for the face normal coordinate direction. + * by one in upper end for the face normal coordinate direction. * * Recall that box indices are cyclically shifted such that the face normal * direction is the first coordinate index. See SideData header file. + * + * @pre (face_normal >= 0) && (face_normal < box.getDim().getValue()) */ static hier::Box toFaceBox( const hier::Box& box, - int face_normal); + tbox::Dimension::dir_t face_normal); /*! * @brief Transform a face-centered box. @@ -92,9 +97,22 @@ class FaceGeometry:public hier::BoxGeometry FaceIndex& index, const hier::Transformation& transformation); + static FaceIterator + begin( + const hier::Box& box, + tbox::Dimension::dir_t axis); + + static FaceIterator + end( + const hier::Box& box, + tbox::Dimension::dir_t axis); + /*! * @brief Construct the face geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ FaceGeometry( const hier::Box& box, @@ -108,6 +126,8 @@ class FaceGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in face-centered index space between * the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -120,6 +140,23 @@ class FaceGeometry:public hier::BoxGeometry const bool retry, const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! + * @brief Compute the face-centered destination boxes that represent + * the overlap between the source box geometry and the destination + * box geometry. + * + * @pre src_mask.getDim() == transformation.getOffset.getDim() + */ + void + computeDestinationBoxes( + std::vector& dst_boxes, + const FaceGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! * @brief Set up a FaceOverlap object based on the given boxes and the * transformation. @@ -173,7 +210,7 @@ class FaceGeometry:public hier::BoxGeometry FaceGeometry( const FaceGeometry&); // not implemented - void + FaceGeometry& operator = ( const FaceGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.C index ec80bb04..836b373e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_FaceIndex_C -#define included_pdat_FaceIndex_C - #include "SAMRAI/pdat/FaceIndex.h" namespace SAMRAI { @@ -30,7 +26,7 @@ FaceIndex::FaceIndex( d_axis(axis) { (*this)(0) = rhs(d_axis) + face; - for (int i = 1; i < getDim().getValue(); i++) { + for (int i = 1; i < getDim().getValue(); ++i) { (*this)(i) = rhs((d_axis + i) % getDim().getValue()); } } @@ -52,7 +48,7 @@ FaceIndex::toCell( { hier::Index index(getDim()); index(d_axis) = (*this)(0) + face - 1; - for (int i = 1; i < getDim().getValue(); i++) { + for (int i = 1; i < getDim().getValue(); ++i) { index((d_axis + i) % getDim().getValue()) = (*this)(i); } return index; @@ -60,4 +56,3 @@ FaceIndex::toCell( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.h index 71120272..667449c5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIndex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -28,9 +28,9 @@ namespace pdat { * about the mapping between the AMR index space and the face indices. * * @see hier::Index - * @see pdat::FaceData - * @see pdat::FaceGeometry - * @see pdat::FaceIterator + * @see FaceData + * @see FaceGeometry + * @see FaceIterator */ class FaceIndex:public hier::Index @@ -61,12 +61,14 @@ class FaceIndex:public hier::Index /** * The assignment operator sets the face index equal to the argument. + * + * @pre getDim() == rhs.getDim() */ FaceIndex& operator = ( const FaceIndex& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator = (rhs); d_axis = rhs.d_axis; return *this; @@ -106,24 +108,28 @@ class FaceIndex:public hier::Index /** * Plus-equals operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex& operator += ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator += (rhs); return *this; } /** * Plus operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex operator + ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); FaceIndex tmp = *this; tmp += rhs; return tmp; @@ -154,24 +160,28 @@ class FaceIndex:public hier::Index /** * Minus-equals operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex& operator -= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator -= (rhs); return *this; } /** * Minus operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex operator - ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); FaceIndex tmp = *this; tmp -= rhs; return tmp; @@ -202,24 +212,28 @@ class FaceIndex:public hier::Index /** * Times-equals operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex& operator *= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator *= (rhs); return *this; } /** * Times operator for a face index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ FaceIndex operator * ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); FaceIndex tmp = *this; tmp *= rhs; return tmp; @@ -251,24 +265,28 @@ class FaceIndex:public hier::Index /** * Returns true if two face index objects are equal. All components * and the corresponding face axes must be the same for equality. + * + * @pre getDim() == rhs.getDim() */ bool operator == ( const FaceIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator == (rhs) && (d_axis == rhs.d_axis); } /** * Returns true if two face index objects are not equal. Any of * the components or axes may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const FaceIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator != (rhs) || (d_axis != rhs.d_axis); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.C index 5ddb5f2b..66b3febd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered int data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_FaceIntegerConstantRefine_C -#define included_pdat_FaceIntegerConstantRefine_C - #include "SAMRAI/pdat/FaceIntegerConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,21 +29,21 @@ extern "C" { #endif // in refine1d.f: -void F77_FUNC(conreffaceintg1d, CONREFFACEINTG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg1d, CONREFFACEINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in refine2d.f: -void F77_FUNC(conreffaceintg2d0, CONREFFACEINTG2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg2d0, CONREFFACEINTG2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conreffaceintg2d1, CONREFFACEINTG2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg2d1, CONREFFACEINTG2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +51,7 @@ void F77_FUNC(conreffaceintg2d1, CONREFFACEINTG2D1) (const int&, const int&, const int *, const int *, int *); // in refine3d.f: -void F77_FUNC(conreffaceintg3d0, CONREFFACEINTG3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg3d0, CONREFFACEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -66,7 +62,7 @@ void F77_FUNC(conreffaceintg3d0, CONREFFACEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conreffaceintg3d1, CONREFFACEINTG3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg3d1, CONREFFACEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -77,7 +73,7 @@ void F77_FUNC(conreffaceintg3d1, CONREFFACEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conreffaceintg3d2, CONREFFACEINTG3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conreffaceintg3d2, CONREFFACEINTG3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -93,9 +89,8 @@ void F77_FUNC(conreffaceintg3d2, CONREFFACEINTG3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -FaceIntegerConstantRefine::FaceIntegerConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +FaceIntegerConstantRefine::FaceIntegerConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -110,9 +105,9 @@ FaceIntegerConstantRefine::getOperatorPriority() const } hier::IntVector -FaceIntegerConstantRefine::getStencilWidth() const +FaceIntegerConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -124,58 +119,62 @@ FaceIntegerConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conreffaceintg1d, CONREFFACEINTG1D) ( + SAMRAI_F77_FUNC(conreffaceintg1d, CONREFFACEINTG1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -185,7 +184,7 @@ FaceIntegerConstantRefine::refine( fdata->getPointer(0, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conreffaceintg2d0, CONREFFACEINTG2D0) ( + SAMRAI_F77_FUNC(conreffaceintg2d0, CONREFFACEINTG2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -194,7 +193,7 @@ FaceIntegerConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffaceintg2d1, CONREFFACEINTG2D1) ( + SAMRAI_F77_FUNC(conreffaceintg2d1, CONREFFACEINTG2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -205,7 +204,7 @@ FaceIntegerConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conreffaceintg3d0, CONREFFACEINTG3D0) ( + SAMRAI_F77_FUNC(conreffaceintg3d0, CONREFFACEINTG3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -218,7 +217,7 @@ FaceIntegerConstantRefine::refine( cdata->getPointer(0, d), fdata->getPointer(0, d)); } else if (axis == 1) { - F77_FUNC(conreffaceintg3d1, CONREFFACEINTG3D1) ( + SAMRAI_F77_FUNC(conreffaceintg3d1, CONREFFACEINTG3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -231,7 +230,7 @@ FaceIntegerConstantRefine::refine( cdata->getPointer(1, d), fdata->getPointer(1, d)); } else if (axis == 2) { - F77_FUNC(conreffaceintg3d2, CONREFFACEINTG3D2) ( + SAMRAI_F77_FUNC(conreffaceintg3d2, CONREFFACEINTG3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -256,4 +255,3 @@ FaceIntegerConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.h index 825abb3e..a41d681a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIntegerConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for face-centered integer data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -40,8 +40,7 @@ class FaceIntegerConstantRefine: /** * Uninteresting default constructor. */ - explicit FaceIntegerConstantRefine( - const tbox::Dimension& dim); + FaceIntegerConstantRefine(); /** * Uninteresting virtual destructor. @@ -60,7 +59,8 @@ class FaceIntegerConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -69,6 +69,8 @@ class FaceIntegerConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.C index 8afa637e..240a1e21 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for face centered patch data types * ************************************************************************/ - -#ifndef included_pdat_FaceIterator_C -#define included_pdat_FaceIterator_C - #include "SAMRAI/pdat/FaceIterator.h" namespace SAMRAI { @@ -18,14 +14,14 @@ namespace pdat { FaceIterator::FaceIterator( const hier::Box& box, - const int axis, + const tbox::Dimension::dir_t axis, bool begin): d_index(box.lower(), axis, FaceIndex::Lower), d_box(FaceGeometry::toFaceBox(box, axis)) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -43,11 +39,11 @@ FaceIterator::~FaceIterator() FaceIterator& FaceIterator::operator ++ () { - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -60,11 +56,11 @@ FaceIterator::operator ++ ( int) { FaceIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -74,4 +70,3 @@ FaceIterator::operator ++ ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.h index c8f1ac43..9016ea40 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for face centered patch data types * ************************************************************************/ @@ -37,23 +37,14 @@ namespace pdat { * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see pdat::FaceData - * @see pdat::FaceGeometry - * @see pdat::FaceIndex + * @see FaceData + * @see FaceGeometry + * @see FaceIndex */ class FaceIterator { public: - /** - * Constructor for the face iterator. The iterator will enumerate - * the indices in the argument box. - */ - FaceIterator( - const hier::Box& box, - const int axis, - bool begin); - /** * Copy constructor for the face iterator */ @@ -90,7 +81,7 @@ class FaceIterator * Extract a pointer to the face index corresponding to the iterator * position in the box. */ - const FaceIndex* + const FaceIndex * operator -> () const { return &d_index; @@ -116,6 +107,8 @@ class FaceIterator operator == ( const FaceIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index == iterator.d_index; } @@ -126,10 +119,33 @@ class FaceIterator operator != ( const FaceIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index != iterator.d_index; } private: + friend FaceIterator + FaceGeometry::begin( + const hier::Box& box, + tbox::Dimension::dir_t axis); + friend FaceIterator + FaceGeometry::end( + const hier::Box& box, + tbox::Dimension::dir_t axis); + + /** + * Constructor for the face iterator. The iterator will enumerate + * the indices in the argument box. + */ + FaceIterator( + const hier::Box& box, + const tbox::Dimension::dir_t axis, + bool begin); + + // Unimplemented default constructor. + FaceIterator(); + FaceIndex d_index; hier::Box d_box; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.C index 414146c6..484b4989 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.C @@ -3,31 +3,29 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_FaceOverlap_C -#define included_pdat_FaceOverlap_C - #include "SAMRAI/pdat/FaceOverlap.h" +#include "SAMRAI/pdat/FaceGeometry.h" + namespace SAMRAI { namespace pdat { FaceOverlap::FaceOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& transformation): d_is_overlap_empty(true), d_transformation(transformation) { const tbox::Dimension& dim = d_transformation.getOffset().getDim(); - d_dst_boxes.resizeArray(boxes.getSize()); + d_dst_boxes.resize(boxes.size()); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { d_dst_boxes[d] = boxes[d]; - if (!d_dst_boxes[d].isEmpty()) d_is_overlap_empty = false; + if (!d_dst_boxes[d].empty()) d_is_overlap_empty = false; } } @@ -46,11 +44,58 @@ const hier::BoxContainer& FaceOverlap::getDestinationBoxContainer( const int axis) const { - TBOX_ASSERT((axis >= 0) && (axis < d_dst_boxes.getSize())); + TBOX_ASSERT((axis >= 0) && (axis < static_cast(d_dst_boxes.size()))); return d_dst_boxes[axis]; } +void +FaceOverlap::getSourceBoxContainer(hier::BoxContainer& src_boxes, + int& normal_direction) const +{ + TBOX_ASSERT(src_boxes.empty()); + TBOX_ASSERT(normal_direction >= 0 && + normal_direction < static_cast(d_dst_boxes.size())); + + src_boxes = d_dst_boxes[normal_direction]; + int transform_normal = normal_direction; + if (!src_boxes.empty()) { + + hier::Transformation inverse_transform = + d_transformation.getInverseTransformation(); + + const tbox::Dimension& dim = src_boxes.begin()->getDim(); + + hier::IntVector face_inverse_offset(dim); + if (d_transformation.getRotation() == 0) { + const hier::IntVector& inverse_offset = + inverse_transform.getOffset(); + for (int d = 0; d < dim.getValue(); ++d) { + face_inverse_offset[d] = + inverse_offset[(normal_direction + d) % dim.getValue()]; + } + } + + for (hier::BoxContainer::iterator bi = src_boxes.begin(); + bi != src_boxes.end(); ++bi) { + if (d_transformation.getRotation() == 0) { + bi->shift(face_inverse_offset); + bi->setBlockId(d_transformation.getBeginBlock()); + } else { + transform_normal = normal_direction; + FaceGeometry::transform(*bi, + transform_normal, + inverse_transform); + } + } + } + + normal_direction = transform_normal; + TBOX_ASSERT(normal_direction >= 0 && + normal_direction < static_cast(d_dst_boxes.size())); + +} + const hier::IntVector& FaceOverlap::getSourceOffset() const { @@ -65,4 +110,3 @@ FaceOverlap::getTransformation() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.h index 71dabb59..a58929ee 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -17,7 +17,8 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" +#include namespace SAMRAI { namespace pdat { @@ -29,7 +30,7 @@ namespace pdat { * with face centered geometry. * * @see hier::BoxOverlap - * @see pdat::FaceOverlap + * @see FaceOverlap */ class FaceOverlap:public hier::BoxOverlap @@ -41,7 +42,7 @@ class FaceOverlap:public hier::BoxOverlap * in the generation of communication schedules. */ FaceOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& transformation); /** * The virtual destructor does nothing interesting except deallocate @@ -62,14 +63,34 @@ class FaceOverlap:public hier::BoxOverlap * constitute the intersection. The boxes are given in the * destination coordinate space and must be shifted by * -(getSourceOffset()) to lie in the source index space. The axis - * argument represents which axis is desired: X=0, Y=1, and - * Z=2. This method over-rides the virtual function in the - * hier::BoxOverlap base class. + * argument represents which axis is desired: X=0, Y=1, and Z=2. + * + * @pre (axis >= 0) && (axis < d_dst_boxes.size()) */ virtual const hier::BoxContainer& getDestinationBoxContainer( const int axis) const; + /*! + * @brief Get a BoxContainer representing the source boxes of the overlap. + * + * The src_boxes container will be filled with face-centered source + * boxes of the overlap in the source coordinate space. The given + * normal direction is the normal in destination space on input and + * in source space on output. + * + * @param[out] src_boxes + * @param[in,out] normal_direction + * + * @pre src_boxes.empty() + * @pre normal_direction >= 0 && normal_direction < d_dst_boxes.size() + * @post normal_direction >= 0 && normal_direction < d_dst_boxes.size() + */ + virtual void + getSourceBoxContainer( + hier::BoxContainer& src_boxes, + int& normal_direction) const; + /** * Return the offset between the destination and source index spaces. * The destination index space is the source index space shifted @@ -84,7 +105,7 @@ class FaceOverlap:public hier::BoxOverlap private: bool d_is_overlap_empty; hier::Transformation d_transformation; - tbox::Array d_dst_boxes; + std::vector d_dst_boxes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.C index fd7cb311..2ef0e101 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/FaceDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -52,37 +52,13 @@ FaceVariable::~FaceVariable() template int FaceVariable::getDepth() const { - boost::shared_ptr > factory(getPatchDataFactory()); + boost::shared_ptr > factory( + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -FaceVariable::FaceVariable( - const FaceVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void FaceVariable::operator = ( - const FaceVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.h index 2f2cb8bf..f91d6064 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FaceVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -21,23 +21,23 @@ namespace SAMRAI { namespace pdat { /*! - * Class FaceVariable is a templated variable class used to define + * Class FaceVariable is a templated variable class used to define * face-centered quantities on an AMR mesh. It is a subclass of * hier::Variable and is templated on the type of the underlying data * (e.g., double, int, bool, etc.). * * Note that the indices in the face data arrays are permuted so that * the leading index in each array corresponds to the associated face - * normal coordinate direction. See header file for FaceData class + * normal coordinate direction. See header file for FaceData class * for a more detailed description of the data layout. * - * IMPORTANT: The class SideVariable and associated "side data" classes + * IMPORTANT: The class SideVariable and associated "side data" classes * define the same storage as this face variable class, except that the * individual array indices are not permuted in the side data type. * - * @see pdat::FaceData - * @see pdat::FaceDataFactory - * @see pdat::FaceGeometry + * @see FaceData + * @see FaceDataFactory + * @see FaceGeometry * @see hier::Variable */ @@ -92,11 +92,14 @@ class FaceVariable:public hier::Variable private: bool d_fine_boundary_represents_var; + // Unimplemented copy constructor FaceVariable( - const FaceVariable&); // not implemented - void + const FaceVariable&); + + // Unimplemented assignment operator + FaceVariable& operator = ( - const FaceVariable&); // not implemented + const FaceVariable&); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.C index 3a4e532d..bcf0818e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_pdat_FirstLayerCellNoCornersVariableFillPattern_C -#define included_pdat_FirstLayerCellNoCornersVariableFillPattern_C - #include "SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h" #include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -70,7 +66,7 @@ FirstLayerCellNoCornersVariableFillPattern::calculateOverlap( const bool overwrite_interior, const hier::Transformation& transformation) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, dst_patch_box); @@ -127,15 +123,15 @@ FirstLayerCellNoCornersVariableFillPattern::computeStencilBoxes( const tbox::Dimension& dim = dst_box.getDim(); - for (unsigned short i = 0; i < dim.getValue(); i++) { + for (unsigned short i = 0; i < dim.getValue(); ++i) { hier::Box low_box(dst_box); - low_box.lower(i) = dst_box.lower(i) - 1; - low_box.upper(i) = low_box.lower(i); + low_box.setLower(i, dst_box.lower(i) - 1); + low_box.setUpper(i, low_box.lower(i)); stencil_boxes.pushFront(low_box); hier::Box high_box(dst_box); - high_box.lower(i) = dst_box.upper(i) + 1; - high_box.upper(i) = high_box.lower(i); + high_box.setLower(i, dst_box.upper(i) + 1); + high_box.setUpper(i, high_box.lower(i)); stencil_boxes.pushFront(high_box); } } @@ -151,11 +147,13 @@ FirstLayerCellNoCornersVariableFillPattern::computeStencilBoxes( boost::shared_ptr FirstLayerCellNoCornersVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const { NULL_USE(pdf); + NULL_USE(node_fill_boxes); hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, patch_box); @@ -165,10 +163,9 @@ FirstLayerCellNoCornersVariableFillPattern::computeFillBoxesOverlap( overlap_boxes.intersectBoxes(stencil_boxes); return boost::make_shared( - overlap_boxes, - hier::Transformation(hier::IntVector::getZero(patch_box.getDim()))); + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(patch_box.getDim()))); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h index 8ba00a08..eef1e01b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h @@ -3,12 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: First layer cell fill pattern class * ************************************************************************/ -#ifndef included_pdat_FirstLayerCellNoCornersFillPattern +#ifndef included_pdat_FirstLayerCellNoCornersVariableFillPattern #define included_pdat_FirstLayerCellNoCornersVariableFillPattern #include "SAMRAI/SAMRAI_config.h" @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -72,6 +72,8 @@ class FirstLayerCellNoCornersVariableFillPattern: * destination index space. * * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() */ boost::shared_ptr calculateOverlap( @@ -95,6 +97,7 @@ class FirstLayerCellNoCornersVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -106,6 +109,7 @@ class FirstLayerCellNoCornersVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -126,7 +130,7 @@ class FirstLayerCellNoCornersVariableFillPattern: private: FirstLayerCellNoCornersVariableFillPattern( const FirstLayerCellNoCornersVariableFillPattern&); // not implemented - void + FirstLayerCellNoCornersVariableFillPattern& operator = ( const FirstLayerCellNoCornersVariableFillPattern&); // not implemented @@ -139,6 +143,8 @@ class FirstLayerCellNoCornersVariableFillPattern: * * @param[out] stencil_boxes The computed stencil BoxContainer. * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == 0 */ void computeStencilBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.C index 70fcd8fd..cedd255d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_pdat_FirstLayerCellVariableFillPattern_C -#define included_pdat_FirstLayerCellVariableFillPattern_C - #include "SAMRAI/pdat/FirstLayerCellVariableFillPattern.h" #include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -67,7 +63,7 @@ FirstLayerCellVariableFillPattern::calculateOverlap( const bool overwrite_interior, const hier::Transformation& transformation) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, dst_patch_box); @@ -138,11 +134,13 @@ FirstLayerCellVariableFillPattern::computeStencilBoxes( boost::shared_ptr FirstLayerCellVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const { NULL_USE(pdf); + NULL_USE(node_fill_boxes); hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, patch_box); @@ -152,10 +150,9 @@ FirstLayerCellVariableFillPattern::computeFillBoxesOverlap( overlap_boxes.intersectBoxes(stencil_boxes); return boost::make_shared( - overlap_boxes, - hier::Transformation(hier::IntVector::getZero(patch_box.getDim()))); + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(patch_box.getDim()))); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.h index c98c54b8..35472f05 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerCellVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: 1Z fill pattern class * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -71,6 +71,8 @@ class FirstLayerCellVariableFillPattern: * destination index space. * * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() */ boost::shared_ptr calculateOverlap( @@ -94,6 +96,7 @@ class FirstLayerCellVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -105,6 +108,7 @@ class FirstLayerCellVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -124,7 +128,7 @@ class FirstLayerCellVariableFillPattern: private: FirstLayerCellVariableFillPattern( const FirstLayerCellVariableFillPattern&); // not implemented - void + FirstLayerCellVariableFillPattern& operator = ( const FirstLayerCellVariableFillPattern&); // not implemented @@ -136,6 +140,8 @@ class FirstLayerCellVariableFillPattern: * * @param[out] stencil_boxes The computed stencil BoxContainer. * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == 0 */ void computeStencilBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.C new file mode 100644 index 00000000..a45ec966 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.C @@ -0,0 +1,207 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fill pattern class to provide interface for stencils + * + ************************************************************************/ +#include "SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.h" + +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/pdat/EdgeGeometry.h" +#include "SAMRAI/tbox/Utilities.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace pdat { + +const std::string FirstLayerEdgeVariableFillPattern::s_name_id = + "FIRST_LAYER_EDGE_FILL_PATTERN"; + +/* + ************************************************************************* + * + * Constructor + * + ************************************************************************* + */ + +FirstLayerEdgeVariableFillPattern::FirstLayerEdgeVariableFillPattern( + const tbox::Dimension& dim): + d_dim(dim) +{ +} + +/* + ************************************************************************* + * + * Destructor + * + ************************************************************************* + */ + +FirstLayerEdgeVariableFillPattern::~FirstLayerEdgeVariableFillPattern() +{ +} + +/* + ************************************************************************* + * + * Calculate the overlap according to the desired pattern + * + ************************************************************************* + */ + +boost::shared_ptr +FirstLayerEdgeVariableFillPattern::calculateOverlap( + const hier::BoxGeometry& dst_geometry, + const hier::BoxGeometry& src_geometry, + const hier::Box& dst_patch_box, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation) const +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); + + const tbox::Dimension& dim = dst_patch_box.getDim(); + std::vector stencil_boxes(dim.getValue()); + computeStencilBoxes(stencil_boxes, dst_patch_box); + + std::vector dst_boxes(dim.getValue()); + + const EdgeGeometry* t_dst = + dynamic_cast(&dst_geometry); + const EdgeGeometry* t_src = + dynamic_cast(&src_geometry); + + TBOX_ASSERT(t_dst); + TBOX_ASSERT(t_src); + + t_dst->computeDestinationBoxes(dst_boxes, *t_src, src_mask, fill_box, + overwrite_interior, transformation); + + for (int d = 0; d < dim.getValue(); ++d) { + dst_boxes[d].intersectBoxes(stencil_boxes[d]); + } + + return boost::make_shared(dst_boxes, transformation); + +} + +/* + ************************************************************************* + * + * Return the stencil width (0) + * + ************************************************************************* + */ + +const hier::IntVector& +FirstLayerEdgeVariableFillPattern::getStencilWidth() +{ + return hier::IntVector::getZero(d_dim); +} + +/* + ************************************************************************* + * + * Return the string name identifier + * + ************************************************************************* + */ + +const std::string& +FirstLayerEdgeVariableFillPattern::getPatternName() const +{ + return s_name_id; +} + +/* + ************************************************************************* + * + * Compute the boxes for the stencil around a given patch box + * + ************************************************************************* + */ + +void +FirstLayerEdgeVariableFillPattern::computeStencilBoxes( + std::vector& stencil_boxes, + const hier::Box& dst_box) const +{ + const tbox::Dimension& dim = dst_box.getDim(); + TBOX_ASSERT(static_cast(stencil_boxes.size()) == dim.getValue()); + + for (int d = 0; d < dim.getValue(); ++d) { + hier::Box dst_edge_box(EdgeGeometry::toEdgeBox(dst_box, d)); + hier::Box interior_edge_box(dst_edge_box); + hier::IntVector shrink_vector(dim, -1); + shrink_vector[d] = 0; + interior_edge_box.grow(shrink_vector); + + stencil_boxes[d].removeIntersections(dst_edge_box, interior_edge_box); + } +} + +/* + ************************************************************************* + * + * Compute BoxOverlap that specifies data to be filled by refinement + * operator. + * + ************************************************************************* + */ + +boost::shared_ptr +FirstLayerEdgeVariableFillPattern::computeFillBoxesOverlap( + const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, + const hier::Box& patch_box, + const hier::Box& data_box, + const hier::PatchDataFactory& pdf) const +{ + NULL_USE(pdf); + NULL_USE(node_fill_boxes); + + const tbox::Dimension& dim = patch_box.getDim(); + + std::vector stencil_boxes(dim.getValue()); + computeStencilBoxes(stencil_boxes, patch_box); + + std::vector overlap_boxes(dim.getValue()); + for (int d = 0; d < dim.getValue(); ++d) { + + /* + * This is the equivalent of converting every box in overlap_boxes + * to a edge centering, which must be done before intersecting with + * stencil_boxes, which is edge-centered. + */ + for (hier::BoxContainer::const_iterator b = fill_boxes.begin(); + b != fill_boxes.end(); ++b) { + overlap_boxes[d].pushBack(EdgeGeometry::toEdgeBox(*b, d)); + } + + overlap_boxes[d].intersectBoxes(EdgeGeometry::toEdgeBox(data_box, d)); + + overlap_boxes[d].intersectBoxes(stencil_boxes[d]); + + /* + * We need to coalesce the boxes to prevent redundant edges in the + * overlap, which can produce erroneous results accumulation + * communication. + */ + + overlap_boxes[d].coalesce(); + } + + return boost::make_shared( + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(dim))); +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.h new file mode 100644 index 00000000..eb337bb4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.h @@ -0,0 +1,185 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: First layer edge fill pattern class + * + ************************************************************************/ + +#ifndef included_pdat_FirstLayerEdgeVariableFillPattern +#define included_pdat_FirstLayerEdgeVariableFillPattern + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/BoxGeometry.h" +#include "SAMRAI/hier/BoxOverlap.h" +#include "SAMRAI/xfer/VariableFillPattern.h" + +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace pdat { + +/*! + * @brief Class FirstLayerEdgeVariableFillPattern is a concrete + * implementation of the abstract base class VariableFillPattern. + * + * It is used to calculate overlaps according to a pattern which limits the + * overlaps to the first layer of boundary edges, that is the edges that + * lie on the patch boundary. + * + * In this diagram of a 2x2 patch with a ghost width of one, + are + * patch nodes, * are ghost nodes. i markes the i edges that will be + * filled using this pattern, and j marks the j edges that will be + * filled. + * + * *...*...*...*...* + * | | | | | + * *...+-i-+-i-+...* + * | j | j | + * *...+---+---+...* + * | j | j | + * *...+-i-+-i-+...* + * | | | | | + * *...*...*...*...* + */ + +class FirstLayerEdgeVariableFillPattern: + public xfer::VariableFillPattern +{ +public: + /*! + * @brief Constructor + * + * @param[in] dim Dimension + */ + explicit FirstLayerEdgeVariableFillPattern( + const tbox::Dimension& dim); + + /*! + * @brief Destructor + */ + virtual ~FirstLayerEdgeVariableFillPattern(); + + /*! + * @brief Calculate overlaps between the destination and source geometries + * according to the fill pattern. + * + * This will return the portion of the intersection of the edge geometries + * that lies on the boundary of the patch. The patch is identified by + * the argument dst_patch_box. The argument overwrite_interior should be + * set to true, since the stencil defined by this class consists of + * boundary edges, which SAMRAI by convention considers to be part of the + * patch interior. If overwrite_interior is false, then the returned + * BoxOverlap will be empty. + * + * @param[in] dst_geometry geometry object for destination box + * @param[in] src_geometry geometry object for source box + * @param[in] dst_patch_box box for the destination patch + * @param[in] src_mask the source mask, the box resulting from + * transforming the source box + * @param[in] fill_box the box to be filled + * @param[in] overwrite_interior controls whether or not to include the + * destination box interior in the overlap. + * @param[in] transformation the transformation from source to + * destination index space. + * + * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() + * @pre dynamic_cast(&dst_geometry) != 0 + * @pre dynamic_cast(&src_geometry) != 0 + */ + boost::shared_ptr + calculateOverlap( + const hier::BoxGeometry& dst_geometry, + const hier::BoxGeometry& src_geometry, + const hier::Box& dst_patch_box, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation) const; + + /*! + * @brief Computes a BoxOverlap object which defines the space to be filled + * by a refinement operation. + * + * For this implementation, that space is the edge-centered intersection + * between fill_boxes, (computed by the RefineSchedule), data_box, which + * specifies the extent of the destination data, and the boundary edges + * that define the stencil of this fill pattern. + * + * @param[in] fill_boxes list representing the all of the space on a patch + * or its ghost region that may be filled by a + * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes + * @param[in] patch_box box representing the patch where a refine operator + * will fill data. (cell-centered representation) + * @param[in] data_box box representing the full extent of the region + * covered by a patch data object, including all + * ghosts (cell-centered representation) + * @param[in] pdf patch data factory for the data that is to be + * filled + */ + boost::shared_ptr + computeFillBoxesOverlap( + const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, + const hier::Box& patch_box, + const hier::Box& data_box, + const hier::PatchDataFactory& pdf) const; + + /*! + * @brief Returns the stencil width of 0 in all directions. + */ + const hier::IntVector& + getStencilWidth(); + + /*! + * @brief Returns a string name identifier "FIRST_LAYER_EDGE_FILL_PATTERN". + */ + const std::string& + getPatternName() const; + +private: + FirstLayerEdgeVariableFillPattern( + const FirstLayerEdgeVariableFillPattern&); // not implemented + FirstLayerEdgeVariableFillPattern& + operator = ( + const FirstLayerEdgeVariableFillPattern&); // not implemented + + /*! + * @brief Computes a BoxContainer defining the stencil around a given box + * for this fill pattern + * + * The computed BoxContainers will consist of edge-centered boxes + * representing the edges on the boundary of the box. + * + * @param[out] stencil_boxes Vector of BoxContainers for the stencil boxes. + * One BoxContainer for each axis direction. + * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == d_dim.getValue() + */ + void + computeStencilBoxes( + std::vector& stencil_boxes, + const hier::Box& dst_box) const; + + /*! + * @brief The dimension of this object. + */ + const tbox::Dimension d_dim; + + /*! + * @brief Static string holding name identifier for this class. + */ + static const std::string s_name_id; + +}; + +} +} +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.C index 384e93e1..34ef9b17 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_pdat_FirstLayerNodeVariableFillPattern_C -#define included_pdat_FirstLayerNodeVariableFillPattern_C - #include "SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -69,17 +65,15 @@ FirstLayerNodeVariableFillPattern::calculateOverlap( const bool overwrite_interior, const hier::Transformation& transformation) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, dst_patch_box); hier::BoxContainer dst_boxes; - const NodeGeometry* t_dst = - dynamic_cast(&dst_geometry); - const NodeGeometry* t_src = - dynamic_cast(&src_geometry); + const NodeGeometry* t_dst = CPP_CAST(&dst_geometry); + const NodeGeometry* t_src = CPP_CAST(&src_geometry); TBOX_ASSERT(t_dst); TBOX_ASSERT(t_src); @@ -155,11 +149,13 @@ FirstLayerNodeVariableFillPattern::computeStencilBoxes( boost::shared_ptr FirstLayerNodeVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const { NULL_USE(pdf); + NULL_USE(node_fill_boxes); const tbox::Dimension& dim = patch_box.getDim(); @@ -173,7 +169,7 @@ FirstLayerNodeVariableFillPattern::computeFillBoxesOverlap( * to a node centering, which must be done before intersecting with * stencil_boxes, which is node-centered. */ - for (hier::BoxContainer::iterator b(overlap_boxes); + for (hier::BoxContainer::iterator b = overlap_boxes.begin(); b != overlap_boxes.end(); ++b) { b->growUpper(hier::IntVector::getOne(dim)); } @@ -191,10 +187,9 @@ FirstLayerNodeVariableFillPattern::computeFillBoxesOverlap( overlap_boxes.coalesce(); return boost::make_shared( - overlap_boxes, - hier::Transformation(hier::IntVector::getZero(dim))); + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(dim))); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h index e67e2a76..b601c749 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: First layer node fill pattern class * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -72,6 +72,10 @@ class FirstLayerNodeVariableFillPattern: * destination index space. * * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() + * @pre dynamic_cast(&dst_geometry) != 0 + * @pre dynamic_cast(&src_geometry) != 0 */ boost::shared_ptr calculateOverlap( @@ -95,6 +99,7 @@ class FirstLayerNodeVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -106,6 +111,7 @@ class FirstLayerNodeVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -125,7 +131,7 @@ class FirstLayerNodeVariableFillPattern: private: FirstLayerNodeVariableFillPattern( const FirstLayerNodeVariableFillPattern&); // not implemented - void + FirstLayerNodeVariableFillPattern& operator = ( const FirstLayerNodeVariableFillPattern&); // not implemented @@ -138,6 +144,8 @@ class FirstLayerNodeVariableFillPattern: * * @param[out] stencil_boxes The computed stencil BoxContainer. * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == 0 */ void computeStencilBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.C new file mode 100644 index 00000000..3df54e9f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.C @@ -0,0 +1,207 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Fill pattern class to provide interface for stencils + * + ************************************************************************/ +#include "SAMRAI/pdat/FirstLayerSideVariableFillPattern.h" + +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/pdat/SideGeometry.h" +#include "SAMRAI/tbox/Utilities.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace pdat { + +const std::string FirstLayerSideVariableFillPattern::s_name_id = + "FIRST_LAYER_SIDE_FILL_PATTERN"; + +/* + ************************************************************************* + * + * Constructor + * + ************************************************************************* + */ + +FirstLayerSideVariableFillPattern::FirstLayerSideVariableFillPattern( + const tbox::Dimension& dim): + d_dim(dim) +{ +} + +/* + ************************************************************************* + * + * Destructor + * + ************************************************************************* + */ + +FirstLayerSideVariableFillPattern::~FirstLayerSideVariableFillPattern() +{ +} + +/* + ************************************************************************* + * + * Calculate the overlap according to the desired pattern + * + ************************************************************************* + */ + +boost::shared_ptr +FirstLayerSideVariableFillPattern::calculateOverlap( + const hier::BoxGeometry& dst_geometry, + const hier::BoxGeometry& src_geometry, + const hier::Box& dst_patch_box, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation) const +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); + + const tbox::Dimension& dim = dst_patch_box.getDim(); + std::vector stencil_boxes(dim.getValue()); + computeStencilBoxes(stencil_boxes, dst_patch_box); + + std::vector dst_boxes(dim.getValue()); + + const SideGeometry* t_dst = + dynamic_cast(&dst_geometry); + const SideGeometry* t_src = + dynamic_cast(&src_geometry); + + TBOX_ASSERT(t_dst); + TBOX_ASSERT(t_src); + + t_dst->computeDestinationBoxes(dst_boxes, *t_src, src_mask, fill_box, + overwrite_interior, transformation); + + for (int d = 0; d < dim.getValue(); ++d) { + dst_boxes[d].intersectBoxes(stencil_boxes[d]); + } + + return boost::make_shared(dst_boxes, transformation); + +} + +/* + ************************************************************************* + * + * Return the stencil width (0) + * + ************************************************************************* + */ + +const hier::IntVector& +FirstLayerSideVariableFillPattern::getStencilWidth() +{ + return hier::IntVector::getZero(d_dim); +} + +/* + ************************************************************************* + * + * Return the string name identifier + * + ************************************************************************* + */ + +const std::string& +FirstLayerSideVariableFillPattern::getPatternName() const +{ + return s_name_id; +} + +/* + ************************************************************************* + * + * Compute the boxes for the stencil around a given patch box + * + ************************************************************************* + */ + +void +FirstLayerSideVariableFillPattern::computeStencilBoxes( + std::vector& stencil_boxes, + const hier::Box& dst_box) const +{ + const tbox::Dimension& dim = dst_box.getDim(); + TBOX_ASSERT(static_cast(stencil_boxes.size()) == dim.getValue()); + + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { + hier::Box dst_side_box(SideGeometry::toSideBox(dst_box, d)); + hier::Box interior_side_box(dst_side_box); + hier::IntVector shrink_vector(dim, 0); + shrink_vector[d] = -1; + interior_side_box.grow(shrink_vector); + + stencil_boxes[d].removeIntersections(dst_side_box, interior_side_box); + } +} + +/* + ************************************************************************* + * + * Compute BoxOverlap that specifies data to be filled by refinement + * operator. + * + ************************************************************************* + */ + +boost::shared_ptr +FirstLayerSideVariableFillPattern::computeFillBoxesOverlap( + const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, + const hier::Box& patch_box, + const hier::Box& data_box, + const hier::PatchDataFactory& pdf) const +{ + NULL_USE(pdf); + NULL_USE(node_fill_boxes); + + const tbox::Dimension& dim = patch_box.getDim(); + + std::vector stencil_boxes(dim.getValue()); + computeStencilBoxes(stencil_boxes, patch_box); + + std::vector overlap_boxes(dim.getValue()); + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { + + /* + * This is the equivalent of converting every box in overlap_boxes + * to a side centering, which must be done before intersecting with + * stencil_boxes, which is side-centered. + */ + for (hier::BoxContainer::const_iterator b = fill_boxes.begin(); + b != fill_boxes.end(); ++b) { + overlap_boxes[d].pushBack(SideGeometry::toSideBox(*b, d)); + } + + overlap_boxes[d].intersectBoxes(SideGeometry::toSideBox(data_box, d)); + + overlap_boxes[d].intersectBoxes(stencil_boxes[d]); + + /* + * We need to coalesce the boxes to prevent redundant sides in the + * overlap, which can produce erroneous results accumulation + * communication. + */ + + overlap_boxes[d].coalesce(); + } + + return boost::make_shared( + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(dim))); +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.h new file mode 100644 index 00000000..9a7488d4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/FirstLayerSideVariableFillPattern.h @@ -0,0 +1,170 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: First layer side fill pattern class + * + ************************************************************************/ + +#ifndef included_pdat_FirstLayerSideVariableFillPattern +#define included_pdat_FirstLayerSideVariableFillPattern + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/BoxGeometry.h" +#include "SAMRAI/hier/BoxOverlap.h" +#include "SAMRAI/xfer/VariableFillPattern.h" + +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace pdat { + +/*! + * @brief Class FirstLayerSideVariableFillPattern is a concrete + * implementation of the abstract base class VariableFillPattern. + * + * It is used to calculate overlaps according to a pattern which limits the + * overlaps to the first layer of boundary sides, that is the sides that + * lie on the patch boundary. + */ + +class FirstLayerSideVariableFillPattern: + public xfer::VariableFillPattern +{ +public: + /*! + * @brief Constructor + * + * @param[in] dim Dimension + */ + explicit FirstLayerSideVariableFillPattern( + const tbox::Dimension& dim); + + /*! + * @brief Destructor + */ + virtual ~FirstLayerSideVariableFillPattern(); + + /*! + * @brief Calculate overlaps between the destination and source geometries + * according to the fill pattern. + * + * This will return the portion of the intersection of the side geometries + * that lies on the boundary of the patch. The patch is identified by + * the argument dst_patch_box. The argument overwrite_interior should be + * set to true, since the stencil defined by this class consists of + * boundary sides, which SAMRAI by convention considers to be part of the + * patch interior. If overwrite_interior is false, then the returned + * BoxOverlap will be empty. + * + * @param[in] dst_geometry geometry object for destination box + * @param[in] src_geometry geometry object for source box + * @param[in] dst_patch_box box for the destination patch + * @param[in] src_mask the source mask, the box resulting from + * transforming the source box + * @param[in] fill_box the box to be filled + * @param[in] overwrite_interior controls whether or not to include the + * destination box interior in the overlap. + * @param[in] transformation the transformation from source to + * destination index space. + * + * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() + * @pre dynamic_cast(&dst_geometry) != 0 + * @pre dynamic_cast(&src_geometry) != 0 + */ + boost::shared_ptr + calculateOverlap( + const hier::BoxGeometry& dst_geometry, + const hier::BoxGeometry& src_geometry, + const hier::Box& dst_patch_box, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation) const; + + /*! + * @brief Computes a BoxOverlap object which defines the space to be filled + * by a refinement operation. + * + * For this implementation, that space is the side-centered intersection + * between fill_boxes, (computed by the RefineSchedule), data_box, which + * specifies the extent of the destination data, and the boundary sides + * that define the stencil of this fill pattern. + * + * @param[in] fill_boxes list representing the all of the space on a patch + * or its ghost region that may be filled by a + * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes + * @param[in] patch_box box representing the patch where a refine operator + * will fill data. (cell-centered representation) + * @param[in] data_box box representing the full extent of the region + * covered by a patch data object, including all + * ghosts (cell-centered representation) + * @param[in] pdf patch data factory for the data that is to be + * filled + */ + boost::shared_ptr + computeFillBoxesOverlap( + const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, + const hier::Box& patch_box, + const hier::Box& data_box, + const hier::PatchDataFactory& pdf) const; + + /*! + * @brief Returns the stencil width of 0 in all directions. + */ + const hier::IntVector& + getStencilWidth(); + + /*! + * @brief Returns a string name identifier "FIRST_LAYER_SIDE_FILL_PATTERN". + */ + const std::string& + getPatternName() const; + +private: + FirstLayerSideVariableFillPattern( + const FirstLayerSideVariableFillPattern&); // not implemented + FirstLayerSideVariableFillPattern& + operator = ( + const FirstLayerSideVariableFillPattern&); // not implemented + + /*! + * @brief Computes a BoxContainer defining the stencil around a given box + * for this fill pattern + * + * The computed BoxContainers will consist of side-centered boxes + * representing the sides on the boundary of the box. + * + * @param[out] stencil_boxes Vector of BoxContainers for the stencil boxes. + * One BoxContainer for each axis direction. + * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == d_dim.getValue() + */ + void + computeStencilBoxes( + std::vector& stencil_boxes, + const hier::Box& dst_box) const; + + /*! + * @brief The dimension of this object. + */ + const tbox::Dimension d_dim; + + /*! + * @brief Static string holding name identifier for this class. + */ + static const std::string s_name_id; + +}; + +} +} +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.C index 17d5a0e1..59f960e6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -33,16 +33,10 @@ namespace pdat { template const int IndexData::PDAT_INDEXDATA_VERSION = 1; -template -IndexDataNode::IndexDataNode(): - d_index(tbox::Dimension::getInvalidDimension()) -{ -} - template IndexDataNode::IndexDataNode( const hier::Index& index, - const int offset, + const size_t offset, TYPE& t, IndexDataNode* n, IndexDataNode* p): @@ -69,8 +63,8 @@ IndexIterator::getNode() template IndexIterator::IndexIterator( const IndexData& index_data, - bool begin) : - d_index_data(const_cast*>(&index_data)), + bool begin): + d_index_data(const_cast *>(&index_data)), d_node(begin ? d_index_data->d_list_head : 0) { } @@ -78,7 +72,7 @@ IndexIterator::IndexIterator( template IndexIterator::IndexIterator( IndexData* index_data, - IndexDataNode* node) : + IndexDataNode* node): d_index_data(index_data), d_node(node) { @@ -86,7 +80,7 @@ IndexIterator::IndexIterator( template IndexIterator::IndexIterator( - const IndexIterator& iter) : + const IndexIterator& iter): d_index_data(iter.d_index_data), d_node(iter.d_node) { @@ -129,14 +123,14 @@ IndexIterator::getIndex() const } template -TYPE* +TYPE * IndexIterator::operator -> () { return d_node->d_item; } template -const TYPE* +const TYPE * IndexIterator::operator -> () const { return d_node->d_item; @@ -218,11 +212,11 @@ IndexData::IndexData( hier::PatchData(box, ghosts), d_dim(box.getDim()), d_data(hier::PatchData::getGhostBox().size()), - d_list_head(NULL), - d_list_tail(NULL), + d_list_head(0), + d_list_tail(0), d_number_items(0) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); } template @@ -231,35 +225,6 @@ IndexData::~IndexData() removeAllItems(); } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -IndexData::IndexData( - const IndexData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()), - d_dim(foo.getDim()) -{ - - // private and not used (but included for some compilers) -} - -template -void -IndexData::operator = ( - const IndexData& foo) -{ - // private and not used (but included for some compilers) - NULL_USE(foo); -} - /* ************************************************************************* * @@ -272,12 +237,12 @@ void IndexData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const IndexData* t_src = - dynamic_cast *>(&src); + CPP_CAST *>(&src); - TBOX_ASSERT(t_src != NULL); + TBOX_ASSERT(t_src != 0); const hier::Box& src_ghost_box = t_src->getGhostBox(); removeInsideBox(src_ghost_box); @@ -297,7 +262,7 @@ void IndexData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copy(*this); } @@ -317,21 +282,21 @@ IndexData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const IndexData* t_src = - dynamic_cast *>(&src); + CPP_CAST *>(&src); const typename BOX_GEOMETRY::Overlap * t_overlap = - dynamic_cast(&overlap); + CPP_CAST(&overlap); - TBOX_ASSERT(t_src != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_src != 0); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset(t_overlap->getSourceOffset()); const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(); const hier::Box& src_ghost_box = t_src->getGhostBox(); - for (hier::BoxContainer::const_iterator b(box_list); + for (hier::BoxContainer::const_iterator b = box_list.begin(); b != box_list.end(); ++b) { const hier::Box& dst_box = *b; const hier::Box src_box(hier::Box::shift(*b, -src_offset)); @@ -359,7 +324,7 @@ IndexData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copy(*this, overlap); } @@ -381,32 +346,34 @@ IndexData::canEstimateStreamSizeFromBox() const } template -int +size_t IndexData::getDataStreamSize( const hier::BoxOverlap& overlap) const { const typename BOX_GEOMETRY::Overlap * t_overlap = - dynamic_cast(&overlap); - TBOX_ASSERT(t_overlap != NULL); + CPP_CAST(&overlap); + TBOX_ASSERT(t_overlap != 0); size_t bytes = 0; int num_items = 0; const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box box = hier::PatchData::getBox() * hier::Box::shift(*b, -(t_overlap->getSourceOffset())); - hier::Box::iterator indexend(box, false); - for (hier::Box::iterator index(box, true); index != indexend; ++index) { + hier::Box::iterator indexend(box.end()); + for (hier::Box::iterator index(box.begin()); + index != indexend; ++index) { TYPE* item = getItem(*index); if (item) { - num_items++; + ++num_items; bytes += item->getDataStreamSize(); } } } - const int index_size = d_dim.getValue() * tbox::MessageStream::getSizeof(); + const size_t index_size = d_dim.getValue() * tbox::MessageStream::getSizeof(); bytes += (num_items * index_size + tbox::MessageStream::getSizeof()); - return static_cast(bytes); + return bytes; } /* @@ -425,26 +392,28 @@ IndexData::packStream( const hier::BoxOverlap& overlap) const { const typename BOX_GEOMETRY::Overlap * t_overlap = - dynamic_cast(&overlap); - TBOX_ASSERT(t_overlap != NULL); + CPP_CAST(&overlap); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); int num_items = 0; - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box box = hier::PatchData::getBox() * hier::Box::shift(*b, -(t_overlap->getSourceOffset())); typename IndexData::iterator send(*this, false); for (typename IndexData::iterator s(*this, true); s != send; ++s) { if (box.contains(s.getNode().d_index)) { - num_items++; + ++num_items; } } } stream << num_items; - for (hier::BoxContainer::const_iterator c(boxes); c != boxes.end(); ++c) { + for (hier::BoxContainer::const_iterator c = boxes.begin(); + c != boxes.end(); ++c) { hier::Box box = hier::PatchData::getBox() * hier::Box::shift(*c, -(t_overlap->getSourceOffset())); typename IndexData::iterator tend(*this, false); @@ -452,10 +421,10 @@ IndexData::packStream( t != tend; ++t) { if (box.contains(t.getNode().d_index)) { TYPE* item = &(*t); - TBOX_ASSERT(item != NULL); + TBOX_ASSERT(item != 0); - int index_buf[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < d_dim.getValue(); i++) { + int index_buf[SAMRAI::MAX_DIM_VAL]; + for (int i = 0; i < d_dim.getValue(); ++i) { index_buf[i] = t.getNode().d_index(i); } stream.pack(index_buf, d_dim.getValue()); @@ -473,30 +442,36 @@ IndexData::unpackStream( const hier::BoxOverlap& overlap) { const typename BOX_GEOMETRY::Overlap * t_overlap = - dynamic_cast(&overlap); - TBOX_ASSERT(t_overlap != NULL); + CPP_CAST(&overlap); + TBOX_ASSERT(t_overlap != 0); int num_items; stream >> num_items; const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { removeInsideBox(*b); } int i; - TYPE* items = new TYPE[num_items]; - for (i = 0; i < num_items; i++) { - int index_buf[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + TYPE* items = 0; + if (num_items > 0) { + items = new TYPE[num_items]; + } + for (i = 0; i < num_items; ++i) { + int index_buf[SAMRAI::MAX_DIM_VAL]; stream.unpack(index_buf, d_dim.getValue()); hier::Index index(d_dim); - for (int j = 0; j < d_dim.getValue(); j++) { + for (int j = 0; j < d_dim.getValue(); ++j) { index(j) = index_buf[j]; } (items + i)->unpackStream(stream, t_overlap->getSourceOffset()); addItem(index + (t_overlap->getSourceOffset()), items[i]); } - delete[] items; + if (items) { + delete[] items; + } } /* @@ -513,18 +488,18 @@ IndexData::appendItem( const hier::Index& index, const TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); if (isElement(offset)) { removeItem(offset); } TYPE* new_item = new TYPE(); - TBOX_ASSERT(new_item != NULL); + TBOX_ASSERT(new_item != 0); *new_item = item; addItemToList(index, offset, *new_item); @@ -536,11 +511,11 @@ IndexData::appendItemPointer( const hier::Index& index, TYPE* item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); if (isElement(offset)) { removeItem(offset); @@ -554,17 +529,17 @@ IndexData::addItem( const hier::Index& index, const TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); if (isElement(offset)) { removeItem(offset); } TYPE* new_item = new TYPE(); - TBOX_ASSERT(new_item != NULL); + TBOX_ASSERT(new_item != 0); *new_item = item; addItemToList(index, offset, *new_item); @@ -576,11 +551,11 @@ IndexData::addItemPointer( const hier::Index& index, TYPE* item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); if (isElement(offset)) { removeItem(offset); @@ -594,20 +569,20 @@ IndexData::replaceAddItem( const hier::Index& index, const TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); IndexDataNode* node = d_data[offset]; TYPE* new_item = new TYPE(); - TBOX_ASSERT(new_item != NULL); + TBOX_ASSERT(new_item != 0); *new_item = item; - if (node == NULL) { + if (node == 0) { addItemToList(index, offset, *new_item); @@ -624,15 +599,15 @@ IndexData::replaceAddItemPointer( const hier::Index& index, TYPE* item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); IndexDataNode* node = d_data[offset]; - if (node == NULL) { + if (node == 0) { addItemToList(index, offset, *item); @@ -650,20 +625,20 @@ IndexData::replaceAppendItem( const hier::Index& index, const TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); IndexDataNode* node = d_data[offset]; TYPE* new_item = new TYPE(); - TBOX_ASSERT(new_item != NULL); + TBOX_ASSERT(new_item != 0); *new_item = item; - if (node == NULL) { + if (node == 0) { appendItemToList(index, offset, *new_item); @@ -680,15 +655,15 @@ IndexData::replaceAppendItemPointer( const hier::Index& index, TYPE* item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); IndexDataNode* node = d_data[offset]; - if (node == NULL) { + if (node == 0) { appendItemToList(index, offset, *item); @@ -705,11 +680,11 @@ void IndexData::removeItem( const hier::Index& index) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - int offset = hier::PatchData::getGhostBox().offset(index); - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + size_t offset = hier::PatchData::getGhostBox().offset(index); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); removeItem(offset); } @@ -717,9 +692,9 @@ IndexData::removeItem( template void IndexData::removeItem( - const int offset) + const size_t offset) { - TBOX_ASSERT(offset >= 0 && offset <= hier::PatchData::getGhostBox().size()); + TBOX_ASSERT(offset <= hier::PatchData::getGhostBox().size()); IndexDataNode* node = d_data[offset]; @@ -730,23 +705,23 @@ IndexData::removeItem( delete node->d_item; delete node; - d_data[offset] = NULL; + d_data[offset] = 0; } template void IndexData::addItemToList( const hier::Index& index, - const int offset, + const size_t offset, TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); IndexDataNode* new_node = new IndexDataNode(index, offset, item, d_list_head, - NULL); + 0); if (d_list_head) { d_list_head->d_prev = new_node; @@ -760,22 +735,22 @@ IndexData::addItemToList( d_data[offset] = new_node; - d_number_items++; + ++d_number_items; } template void IndexData::appendItemToList( const hier::Index& index, - const int offset, + const size_t offset, TYPE& item) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); IndexDataNode* new_node = new IndexDataNode(index, offset, item, - NULL, + 0, d_list_tail); if (d_list_tail) { @@ -790,7 +765,7 @@ IndexData::appendItemToList( d_data[offset] = new_node; - d_number_items++; + ++d_number_items; } template @@ -799,28 +774,28 @@ IndexData::removeNodeFromList( IndexDataNode* node) { if ((d_list_head == node) && (d_list_tail == node)) { - d_list_head = d_list_tail = NULL; + d_list_head = d_list_tail = 0; } else if (d_list_head == node) { d_list_head = node->d_next; - node->d_next->d_prev = NULL; + node->d_next->d_prev = 0; } else if (d_list_tail == node) { d_list_tail = node->d_prev; - node->d_prev->d_next = NULL; + node->d_prev->d_next = 0; } else { node->d_next->d_prev = node->d_prev; node->d_prev->d_next = node->d_next; } - d_data[node->d_offset] = NULL; + d_data[node->d_offset] = 0; - d_number_items--; + --d_number_items; } template -int +size_t IndexData::getNumberOfItems() const { return d_number_items; @@ -831,7 +806,7 @@ void IndexData::removeInsideBox( const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); typename IndexData::iterator l(*this, true); typename IndexData::iterator lend(*this, false); @@ -852,7 +827,7 @@ void IndexData::removeOutsideBox( const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); typename IndexData::iterator l(*this, true); typename IndexData::iterator lend(*this, false); @@ -887,18 +862,18 @@ bool IndexData::isElement( const hier::Index& index) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TBOX_ASSERT(hier::PatchData::getGhostBox().contains(index)); - return d_data[hier::PatchData::getGhostBox().offset(index)] != NULL; + return d_data[hier::PatchData::getGhostBox().offset(index)] != 0; } template bool IndexData::isElement( - int offset) const + size_t offset) const { - return d_data[offset] != NULL; + return d_data[offset] != 0; } /* @@ -912,14 +887,16 @@ IndexData::isElement( template void -IndexData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +IndexData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_INDEXDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_INDEXDATA_VERSION"); if (ver != PDAT_INDEXDATA_VERSION) { - TBOX_ERROR("IndexData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("IndexData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } @@ -931,20 +908,20 @@ IndexData::getSpecializedFromDatabase( item_count, 6); - if (database->isDatabase(index_keyword)) { + if (restart_db->isDatabase(index_keyword)) { boost::shared_ptr item_db( - database->getDatabase(index_keyword)); + restart_db->getDatabase(index_keyword)); - tbox::Array index_array = - item_db->getIntegerArray(index_keyword); + std::vector index_array = + item_db->getIntegerVector(index_keyword); hier::Index index(d_dim); - for (int j = 0; j < d_dim.getValue(); j++) { + for (int j = 0; j < d_dim.getValue(); ++j) { index(j) = index_array[j]; } TYPE item; - item.getFromDatabase(item_db); + item.getFromRestart(item_db); appendItem(index, item); @@ -952,7 +929,7 @@ IndexData::getSpecializedFromDatabase( item_found = false; } - item_count++; + ++item_count; } while (item_found); @@ -961,19 +938,21 @@ IndexData::getSpecializedFromDatabase( /* ************************************************************************* * - * Just writes out the class version number to the database. + * Just writes out the class version number to the restart database. * ************************************************************************* */ template void -IndexData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +IndexData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_INDEXDATA_VERSION", PDAT_INDEXDATA_VERSION); + restart_db->putInteger("PDAT_INDEXDATA_VERSION", PDAT_INDEXDATA_VERSION); int item_count = 0; typename IndexData::iterator send(*this, false); @@ -984,34 +963,36 @@ IndexData::putSpecializedToDatabase( item_count, 6); hier::Index index = s.getNode().d_index; - tbox::Array index_array(d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + std::vector index_array(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { index_array[i] = index(i); } boost::shared_ptr item_db( - database->putDatabase(index_keyword)); + restart_db->putDatabase(index_keyword)); - item_db->putIntegerArray(index_keyword, index_array); + item_db->putIntegerArray(index_keyword, + &index_array[0], + static_cast(index_array.size())); TYPE* item = getItem(index); - item->putUnregisteredToDatabase(item_db); + item->putToRestart(item_db); - item_count++; + ++item_count; } } template -TYPE* +TYPE * IndexData::getItem( const hier::Index& index) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, index); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, index); TYPE* item; if (!isElement(index)) { - item = NULL; + item = 0; } else { item = d_data[hier::PatchData::getGhostBox().offset(index)]->d_item; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.h index daf3b3ec..80107b33 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -60,7 +60,7 @@ class IndexIterator; * faster. * * The template parameter TYPE * defines the storage at each index - * location. IndexDaga is derived from * hier::PatchData. + * location. IndexData is derived from * hier::PatchData. * * The data type TYPE must define the following five methods which are * require by this class: @@ -77,9 +77,9 @@ class IndexIterator; * unpackStream(MessageStream\& stream, * const hier::IntVector\& offset) * - \b - Write to restart; - * putToDatabase(boost::shared_ptr\& database) + * putToRestart(boost::shared_ptr\& restart_db) * - \b - Retrieve from restart; - * getFromDatabase(boost::shared_ptr\& database) + * getFromRestart(boost::shared_ptr\& restart_db) * * The BOX_GEOMETRY template parameter defines the geometry. BOX_GEOMETRY must * have a nested class name Overlap that implements he following methods: @@ -91,12 +91,12 @@ class IndexIterator; * More information about the templated TYPE is provided in the IndexData * README file. * - * IndexData objects are created by the IndexDataFactory + * IndexData objects are created by the IndexDataFactory * factory object just as all other patch data types. * - * @see pdat::IndexData + * @see IndexData * @see hier::PatchData - * @see pdat::IndexDataFactory + * @see IndexDataFactory */ template @@ -112,6 +112,8 @@ class IndexData:public hier::PatchData * The constructor for an IndexData object. The box describes the interior * of the index space and the ghosts vector describes the ghost nodes in * each coordinate direction. + * + * @pre box.getDim() == ghosts.getDim() */ IndexData( const hier::Box& box, @@ -126,10 +128,21 @@ class IndexData:public hier::PatchData * A fast copy between the source and destination. All data is copied * from the source into the destination where there is overlap in the * index space. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast *>(&src) != 0 */ virtual void copy( const hier::PatchData& src); + + /** + * A fast copy between the source and destination. All data is copied + * from the source into the destination where there is overlap in the + * index space. + * + * @pre getDim() == dst.getDim() + */ virtual void copy2( hier::PatchData& dst) const; @@ -138,11 +151,23 @@ class IndexData:public hier::PatchData * Copy data from the source into the destination using the designated * overlap descriptor. The overlap description should have been computed * previously from computeIntersection(). + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast *>(&src) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy( const hier::PatchData& src, const hier::BoxOverlap& overlap); + + /** + * Copy data from the source into the destination using the designated + * overlap descriptor. The overlap description should have been computed + * previously from computeIntersection(). + * + * @pre getDim() == dst.getDim() + */ virtual void copy2( hier::PatchData& dst, @@ -158,13 +183,17 @@ class IndexData:public hier::PatchData /** * Calculate the number of bytes needed to stream the data lying * in the specified box domain. + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; /** * Pack data lying on the specified index set into the output stream. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -173,6 +202,8 @@ class IndexData:public hier::PatchData /** * Unpack data from the message stream into the specified index set. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -181,6 +212,11 @@ class IndexData:public hier::PatchData /** * Add a new item to the tail of the irregular index set. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void appendItem( @@ -197,6 +233,11 @@ class IndexData:public hier::PatchData * call. It should be used with caution, the caller MUST NOT * delete the referenced item. Think of this as giving up control * of the item to IndexData. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void appendItemPointer( @@ -205,6 +246,11 @@ class IndexData:public hier::PatchData /** * Add a new item to the head of the irregular index set + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void addItem( @@ -221,6 +267,11 @@ class IndexData:public hier::PatchData * call. It should be used with caution, the caller MUST NOT * delete the referenced item. Think of this as giving up control * of the item to IndexData. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void @@ -236,6 +287,11 @@ class IndexData:public hier::PatchData * * If an item does not already exist at index this is equivelent * to addItem. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void replaceAddItem( @@ -252,6 +308,11 @@ class IndexData:public hier::PatchData * to addItemPointer. * * See addItemPointer for additional comments on pointer semantics. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void replaceAddItemPointer( @@ -266,6 +327,11 @@ class IndexData:public hier::PatchData * * If an item does not already exist at index this is equivelent * to appendItem. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void replaceAppendItem( @@ -282,6 +348,11 @@ class IndexData:public hier::PatchData * to appendItemPointer. * * See addItemPointer for additional comments on pointer semantics. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) */ void replaceAppendItemPointer( @@ -292,6 +363,11 @@ class IndexData:public hier::PatchData * Remove (deallocate) the item in the irregular index set located at * the specified hier::Index. * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) + * @pre (hier::PatchData::getGhostBox().offset(index) >= 0) && + * (hier::PatchData::getGhostBox().offset(index) <= hier::PatchData::getGhostBox().size()) + * */ void removeItem( @@ -300,13 +376,18 @@ class IndexData:public hier::PatchData /** * Return the number of data items (i.e. the number of indices) in * the index data list. + * + * @pre offset >= 0 && offset <= hier::PatchData::getGhostBox().size() + * @pre d_data[offset] != 0 */ - int + size_t getNumberOfItems() const; /** * Remove (deallocate) any items in the irregular index set located in * the index space of the hier::Box. + * + * @pre getDim() == box.getDim() */ void removeInsideBox( @@ -315,6 +396,8 @@ class IndexData:public hier::PatchData /** * Remove (deallocate) any items in the irregular index set located * outside of the index space of the hier::Box. + * + * @pre getDim() == box.getDim() */ void removeOutsideBox( @@ -336,6 +419,9 @@ class IndexData:public hier::PatchData /** * Returns true if there is an element of the irregular index set at * the specified hier::Index. + * + * @pre getDim() == index.getDim() + * @pre hier::PatchData::getGhostBox().contains(index) */ bool isElement( @@ -344,6 +430,8 @@ class IndexData:public hier::PatchData /** * Given an index, return a pointer to the item located at that index. * If there is no item at the index, null is returned. + * + * @pre getDim() == index.getDim() */ TYPE * getItem( @@ -353,20 +441,20 @@ class IndexData:public hier::PatchData * Check to make sure that the class version number is the same * as the restart file version number. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /** - * Write out the class version number to the database. + * Write out the class version number to the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: friend class IndexIterator; @@ -381,7 +469,7 @@ class IndexData:public hier::PatchData */ bool isElement( - int offset) const; + size_t offset) const; /** * Remove (deallocate) the item in the irregular index set located at @@ -392,7 +480,7 @@ class IndexData:public hier::PatchData */ void removeItem( - const int offset); + const size_t offset); /** * Internal routine to append item to the linked list @@ -400,16 +488,28 @@ class IndexData:public hier::PatchData * * NOTE: Offset is not strictly necessary but was include to avoid * computing it repeatedly. + * + * @pre getDim() == index.getDim() */ void addItemToList( const hier::Index& index, - const int offset, + const size_t offset, TYPE& item); + + /** + * Internal routine to add item to the linked list + * representation. + * + * NOTE: Offset is not strictly necessary but was include to avoid + * computing it repeatedly. + * + * @pre getDim() == index.getDim() + */ void appendItemToList( const hier::Index& index, - const int offset, + const size_t offset, TYPE& item); /** @@ -419,11 +519,14 @@ class IndexData:public hier::PatchData removeNodeFromList( IndexDataNode * node); + // Unimplemented copy constructor IndexData( - const IndexData&); // not implemented - void + const IndexData&); + + // Unimplemented assignment operator + IndexData& operator = ( - const IndexData&); // not implemented + const IndexData&); const tbox::Dimension d_dim; @@ -451,11 +554,9 @@ class IndexDataNode friend class IndexData; friend class IndexIterator; - IndexDataNode(); - IndexDataNode( const hier::Index & index, - const int d_offset, + const size_t d_offset, TYPE & t, IndexDataNode* n, IndexDataNode* p); @@ -463,8 +564,11 @@ class IndexDataNode virtual ~IndexDataNode(); private: + // Unimplemented default constructor. + IndexDataNode(); + hier::Index d_index; - int d_offset; + size_t d_offset; TYPE* d_item; IndexDataNode* d_next; @@ -475,20 +579,20 @@ class IndexDataNode * Class IndexIterator is the iterator associated with the IndexData * This class provides methods for stepping through the * list that contains the irregular index set. The user should - * access this class through the name IndexData::iterator. + * access this class through the name IndexData::iterator. * * This iterator should be used as follows: * \verbatim - * IndexData data; + * IndexData data; * ... - * IndexData::iterator iterend(data, false); - * for (IndexData::iterator iter(data, true); iter != iterend; ++iter) { + * IndexData::iterator iterend(data, false); + * for (IndexData::iterator iter(data, true); iter != iterend; ++iter) { * ... = *iter; * } * \endverbatim * - * @see pdat::IndexData - * @see pdat::IndexIterator + * @see IndexData + * @see IndexIterator */ template @@ -499,7 +603,7 @@ class IndexIterator * Constructor for the index list iterator. The iterator will iterate * over the irregular index set of the argument data object. */ - explicit IndexIterator( + IndexIterator( const IndexData& data, bool begin); @@ -537,14 +641,14 @@ class IndexIterator /** * Return a pointer to the current item in the irregular index set. */ - TYPE* + TYPE * operator -> (); /** * Return a const pointer to the current item in the irregular * index set. */ - const TYPE* + const TYPE * operator -> () const; /** @@ -602,7 +706,8 @@ class IndexIterator IndexData* index_data, IndexDataNode* node); - IndexDataNode& getNode(); + IndexDataNode& + getNode(); IndexData* d_index_data; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.C index bf8cc330..9395945d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IndexDataFactory implementation * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MemoryUtilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -56,7 +56,7 @@ boost::shared_ptr IndexDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >(ghosts); } @@ -74,11 +74,11 @@ boost::shared_ptr IndexDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_ghosts); + patch.getBox(), + d_ghosts); } /* @@ -94,7 +94,7 @@ boost::shared_ptr IndexDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -112,7 +112,7 @@ size_t IndexDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); NULL_USE(box); return tbox::MemoryUtilities::align(sizeof(IndexData)); @@ -132,7 +132,7 @@ bool IndexDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -142,7 +142,8 @@ IndexDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > idf( - dst_pdf, boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (idf) { valid_copy = true; } @@ -156,8 +157,8 @@ IndexDataFactory::validCopyTo( * * Return a boolean true value indicating that the index data quantities * will always be treated as though fine values represent them on - * coarse-fine interfaces. See the IndexVariable class header file for - * more information. + * coarse-fine interfaces. See the IndexVariable class + * header file for more information. * ************************************************************************* */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.h index 28e554dc..c45ef7b5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IndexDataFactory * ************************************************************************/ @@ -19,18 +19,18 @@ #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/hier/PatchDataFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { /** - * Class IndexDataFactory is the factory class used to allocate - * new instances of IndexData objects. It is a subclass of the - * hier::PatchDataFactory base class. + * Class IndexDataFactory is the factory class used to + * allocate new instances of IndexData objects. It is a + * subclass of the hier::PatchDataFactory base class. * - * @see pdat::IndexData - * @see pdat::IndexVariable + * @see IndexData + * @see IndexVariable * @see hier::PatchDataFactory */ @@ -39,8 +39,8 @@ class IndexDataFactory:public hier::PatchDataFactory { public: /** - * The default constructor for the IndexDataFactory class. - * The ghost cell width argument gives the default width for all + * The default constructor for the IndexDataFactory + * class. The ghost cell width argument gives the default width for all * irregular data objects created with this factory. */ explicit IndexDataFactory( @@ -60,6 +60,8 @@ class IndexDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -69,6 +71,8 @@ class IndexDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete index data object. * The default information about the object (e.g., ghost cell width) is * taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -78,6 +82,8 @@ class IndexDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -89,6 +95,8 @@ class IndexDataFactory:public hier::PatchDataFactory * Because the irregular data list can grow and shrink, it would be * impossible to estimate the necessary amount of memory. Instead, * dynamic data is allocated via the standard new/free mechanisms. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -97,8 +105,8 @@ class IndexDataFactory:public hier::PatchDataFactory /** * Return a boolean true value indicating that the index data quantities * will always be treated as though fine values represent them on - * coarse-fine interfaces. See the IndexVariable class header file for - * more information. + * coarse-fine interfaces. See the IndexVariable class + * header file for more information. */ bool fineBoundaryRepresentsVariable() const; @@ -116,6 +124,8 @@ class IndexDataFactory:public hier::PatchDataFactory * supplied destination patch data factory. It will return true if * dst_pdf is an IndexDataFactory of the same type and dimension, * false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( @@ -123,10 +133,10 @@ class IndexDataFactory:public hier::PatchDataFactory private: IndexDataFactory( - const IndexDataFactory&); - void + const IndexDataFactory&); + IndexDataFactory& operator = ( - const IndexDataFactory&); + const IndexDataFactory&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.C index 8633edde..93652185 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IndexVariable implementation * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -46,34 +46,6 @@ IndexVariable::~IndexVariable() { } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -IndexVariable::IndexVariable( - const IndexVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - // not implemented - NULL_USE(foo); -} - -template -void IndexVariable::operator = ( - const IndexVariable& foo) -{ - // not implemented - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.h index a6cec48a..fe90e637 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IndexVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IndexVariable * ************************************************************************/ @@ -36,9 +36,9 @@ namespace pdat { * instructions on using this class to provide other irregular index set * types. * - * @see pdat::IndexData - * @see pdat::IndexDataFactory - * @see pdat::Variable + * @see IndexData + * @see IndexDataFactory + * @see Variable */ template @@ -77,11 +77,14 @@ class IndexVariable:public hier::Variable } private: + // Unimplemented copy constructor IndexVariable( - const IndexVariable&); // not implemented - void + const IndexVariable&); + + // Unimplemented assignment operator + IndexVariable& operator = ( - const IndexVariable&); // not implemented + const IndexVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.C index fbd1b77d..55fb3a72 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.C @@ -3,12 +3,9 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * -* Copyright: (c) 1997 - 2011 Lawrence Livermore National Security, LLC +* Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat **********************************************************************/ -#ifndef included_pdat_IntegerAttributeId_C -#define included_pdat_IntegerAttributeId_C - #include "SAMRAI/pdat/IntegerAttributeId.h" namespace SAMRAI { @@ -49,4 +46,3 @@ IntegerAttributeId::~IntegerAttributeId() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.h index e00d5527..4126846e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/IntegerAttributeId.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * -* Copyright: (c) 1997 - 2011 Lawrence Livermore National Security, LLC +* Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat **********************************************************************/ #ifndef included_pdat_IntegerAttributeId_h diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/MDA_Access.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/MDA_Access.h index e2e0f01d..691e3d9b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/MDA_Access.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/MDA_Access.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Light-weight array class * ************************************************************************/ @@ -72,12 +72,12 @@ class MDA_IndexRange /*! * @brief Type for the dimension counter. * - * Type dim_t could be "unsigned short" instead of "short", + * Type dir_t could be "unsigned short" instead of "short", * but using short causes the GNU compiler to issue unneeded * warnings about certain comparisons always being false * (when instantiating with MDA_DIM of 1). */ - typedef short dim_t; + typedef short dir_t; /*! * @brief Type for the index. */ @@ -109,10 +109,10 @@ class MDA_IndexRange * it is for the constructor taking final indices instead of sizes. */ MDA_IndexRange( - /*! Array sizes */const size_t* sz = ((size_t *)0), - /*! Array starting indices */const index_t* st = ((index_t *)0)) + /*! Array sizes */ const size_t* sz = ((size_t *)0), + /*! Array starting indices */ const index_t* st = ((index_t *)0)) { - dim_t i; + dir_t i; if (st) { for (i = 0; i < MDA_DIM; ++i) { d_start[i] = st[i]; @@ -145,8 +145,8 @@ class MDA_IndexRange * If @c sf is @c NULL, sizes are set to zero. */ MDA_IndexRange( - /*! Array of initial indices */const index_t* si, - /*! Array of final indices */const index_t* sf) + /*! Array of initial indices */ const index_t* si, + /*! Array of final indices */ const index_t* sf) { index_t i; if (si) { @@ -177,8 +177,8 @@ class MDA_IndexRange /*! Starting indices (NULL for no change) */ const index_t* st = ((index_t *)0)) { - if (sz) for (dim_t i = 0; i < MDA_DIM; ++i) d_size[i] = sz[i]; - if (st) for (dim_t i = 0; i < MDA_DIM; ++i) d_start[i] = st[i]; + if (sz) for (dir_t i = 0; i < MDA_DIM; ++i) d_size[i] = sz[i]; + if (st) for (dir_t i = 0; i < MDA_DIM; ++i) d_start[i] = st[i]; setDependentData(); } @@ -191,17 +191,17 @@ class MDA_IndexRange /*! Final valid indices (NULL for no change) */ const index_t final[ MDA_DIM]) { - if (first) for (dim_t i = 0; i < MDA_DIM; ++i) d_start[i] = first[i]; - if (final) for (dim_t i = 0; i < MDA_DIM; ++i) d_size[i] = final[i] + if (first) for (dir_t i = 0; i < MDA_DIM; ++i) d_start[i] = first[i]; + if (final) for (dir_t i = 0; i < MDA_DIM; ++i) d_size[i] = final[i] - first[i] + 1; setDependentData(); } /*! - * @brief Adjust the dimensions + * @brief Adjust the array sizes * * Adjust the first and final indices. - * Set the dimension to adjust to >= MDA_DIM to adjust @em all dimensions. + * Set the direction to adjust to >= MDA_DIM to adjust @em all dimensions. * @b Note: The third argument is the increment to the final index * and not the size. * @@ -211,12 +211,12 @@ class MDA_IndexRange * @return Adjusted MDA_IndexRange object */ const MDA_IndexRange& adjustDim( - /*! Dimension to adjust */ dim_t d, + /*! Direction to adjust */ dir_t d, /*! Increment to first index */ index_t first, /*! Increment to final index */ index_t final) { if (d >= MDA_DIM) { - dim_t i; + dir_t i; for (i = 0; i < MDA_DIM; ++i) { d_start[i] += first; d_size[i] += final - first; @@ -239,7 +239,7 @@ class MDA_IndexRange bool operator == ( const MDA_IndexRange& r) const { - dim_t d; + dir_t d; for (d = 0; d < MDA_DIM; ++d) { if (d_start[d] != r.d_start[d]) return false; @@ -267,7 +267,7 @@ class MDA_IndexRange std::ostream& os) const { os << MDA_DIM; - for (dim_t i = 0; i < MDA_DIM; ++i) + for (dir_t i = 0; i < MDA_DIM; ++i) os << ' ' << d_start[i] << ' ' << d_size[i]; return os; } @@ -277,10 +277,10 @@ class MDA_IndexRange std::istream& streamGet( std::istream& is) { - dim_t dim; + dir_t dim; is >> dim; assert(dim == MDA_DIM); - for (dim_t i = 0; i < MDA_DIM; ++i) + for (dir_t i = 0; i < MDA_DIM; ++i) is >> d_start[i] >> d_size[i]; return is; } @@ -300,39 +300,39 @@ class MDA_IndexRange //@{ @name Functions to facilitate looping /*! - * @brief Give starting index of a given dimension. + * @brief Give starting index of a given direction. */ const index_t& beg( - /*! index of dimension */ size_t i) const + /*! index of direction */ size_t i) const { return d_start[i]; } /*! * @brief Give ending index (one more than the last valid index) - * of a given dimension. + * of a given direction. */ const index_t& end( - /*! index of dimension */ size_t i) const + /*! index of direction */ size_t i) const { return d_stop[i]; } /*! - * @brief Give size along a given dimension. + * @brief Give size along a given direction. */ const size_t& size( - /*! index of dimension */ size_t i) const + /*! index of direction */ size_t i) const { return d_size[i]; } /*! - * @brief Give size for all dimensions. + * @brief Give size for all directions. */ size_t totalSize() const { - dim_t i = 0; + dir_t i = 0; size_t total_size = d_size[i]; for (i = 1; i < MDA_DIM; ++i) total_size *= d_size[i]; return total_size; @@ -425,7 +425,7 @@ class MDA_OrderRowMajor:private MDA_IndexRange public: typedef int index_t; typedef MDA_IndexRange range_t; - typedef typename range_t::dim_t dim_t; + typedef typename range_t::dir_t dir_t; protected: enum { D0 = range_t::D0, D1 = range_t::D1, @@ -496,7 +496,7 @@ class MDA_OrderRowMajor:private MDA_IndexRange } //! @brief Similar to MDA_IndexRange::adjustDim(). const MDA_OrderRowMajor& adjustDim( - dim_t d, + dir_t d, index_t first, index_t final) { @@ -585,7 +585,7 @@ class MDA_OrderRowMajor:private MDA_IndexRange } //@} /*! - * @brief Return the total size of subarray starting with dimension d + * @brief Return the total size of subarray starting with direction d */ size_t totalSize( unsigned short d) const @@ -594,7 +594,7 @@ class MDA_OrderRowMajor:private MDA_IndexRange } /*! * @brief Computes the order object and offset for reducing the slowest - * dimension. + * direction. * * A reduced array is the subarray resulting from fixing the slowest * (first) index. The reduced array has one fewer dimension, a different @@ -629,9 +629,9 @@ class MDA_OrderRowMajor:private MDA_IndexRange * @brief Total sizes of sub-dimensional arrays. * * @c d_total_size[i] is the size of the sub-matrix contained in the - * last (fast) i dimensions of the array. Incidentally, the stride - * size of dimension @c i is @c d_total_size[i+1] (and the stride size - * for dimension @c MDA_DIM-1 is 1. + * last (fast) i directions of the array. Incidentally, the stride + * size of direction @c i is @c d_total_size[i+1] (and the stride size + * for direction @c MDA_DIM-1 is 1. * * @c d_total_size[i] is really equal to * @f$ \prod_{j=i}^{MDA_DIM-1} size_j @f$ @@ -669,7 +669,7 @@ class MDA_OrderColMajor:private MDA_IndexRange public: typedef int index_t; typedef MDA_IndexRange range_t; - typedef typename range_t::dim_t dim_t; + typedef typename range_t::dir_t dir_t; protected: enum { D0 = range_t::D0, D1 = range_t::D1, @@ -741,7 +741,7 @@ class MDA_OrderColMajor:private MDA_IndexRange } //! @brief Similar to MDA_IndexRange::adjustDim(). const MDA_OrderColMajor& adjustDim( - dim_t d, + dir_t d, index_t first, index_t final) { @@ -833,7 +833,7 @@ class MDA_OrderColMajor:private MDA_IndexRange } //@} /*! - * @brief Return the total size of subarray starting with dimension d + * @brief Return the total size of subarray starting with direction d */ size_t totalSize( unsigned short d) const @@ -842,7 +842,7 @@ class MDA_OrderColMajor:private MDA_IndexRange } /*! * @brief Computes the order object and offset for reducing the slowest - * dimension. + * direction. * * A reduced array is the subarray resulting from fixing the slowest * (last) index. The reduced array has one fewer dimension, a different @@ -881,9 +881,9 @@ class MDA_OrderColMajor:private MDA_IndexRange * @brief Total sizes of sub-dimensional arrays. * * @c d_total_size[i] is the size of the sub-matrix contained in the - * first (fast) i+1 dimensions of the array. Incidentally, the stride - * size of dimension @c i is @c d_total_size[i-1] (and the stride size - * for dimension @c 0 is 1. + * first (fast) i+1 directions of the array. Incidentally, the stride + * size of direction @c i is @c d_total_size[i-1] (and the stride size + * for direction @c 0 is 1. * * @c d_total_size[i] is really equal to * @f$ \prod_{j=0}^{i} size_j @f$ @@ -951,7 +951,7 @@ class MDA_Access */ typedef MDA_TYPE value_t; typedef MDA_IndexRange range_t; - typedef typename range_t::dim_t dim_t; + typedef typename range_t::dir_t dir_t; typedef typename range_t::index_t index_t; typedef OrderType order_t; typedef typename OrderType::reduced_order_t reduced_order_t; @@ -1098,12 +1098,12 @@ class MDA_Access } /*! - * @brief Adjust the dimensions + * @brief Adjust the directions * * @see MDA_IndexRange::adjustDim. */ const range_t& adjustDim( - /*! Dimension to adjust */ dim_t d, + /*! Direction to adjust */ dir_t d, /*! Increment to first index */ index_t first, /*! Increment to final index */ index_t final) { @@ -1215,7 +1215,7 @@ class MDA_Access index_t i1, index_t i2, index_t i3) const - { + { return d_ptr[d_order.offset(i0, i1, i2, i3)]; } @@ -1243,7 +1243,7 @@ class MDA_Access //@{ @name Functions to extract reduced-dimensional arrays. /*! - * @brief Fix the index of the slowest dimension and return + * @brief Fix the index of the slowest direction and return * the corresponding sub-array. * * This function is meant to facilitate optimization when using @@ -1252,19 +1252,19 @@ class MDA_Access * constants. This leads to many many repeated integer arithmetics * operations that could be removed from the inner loop (but may * not be removed automatically by the compiler optimization). - * To do this, reduce the array dimensionality one dimension at a time, - * by fixing index corresponding to the slowest varying dimension. + * To do this, reduce the array dimensionality one direction at a time, + * by fixing index corresponding to the slowest varying direction. * (If you code is written to maximize cache data, this will NOT * be the index of the innermost loop.) * - * To reduce multiple dimensions, string these calls together, + * To reduce multiple directions, string these calls together, * i.e. @c array.reduce(i).reduce(j). However, since reduction * contains loops that cost O(MDA_DIM) and may be difficult for * compilers to optimize, you may want to save @c array.reduce(i) * and reuse it. * - * @param i Index in slowest dimension, which is the first - * dimension in a row-major array and the last dimension in a + * @param i Index in slowest direction, which is the first + * direction in a row-major array and the last direction in a * column-major array. * * @return The sub-array of dimension @c MDA_DIM-1, corresponding to @@ -1356,7 +1356,7 @@ class MDA_AccessConst:public MDA_Access */ typedef const MDA_TYPE value_t; typedef MDA_IndexRange range_t; - typedef typename range_t::dim_t dim_t; + typedef typename range_t::dir_t dir_t; typedef typename range_t::index_t index_t; typedef OrderType order_t; @@ -1405,7 +1405,8 @@ class MDA_AccessConst:public MDA_Access /*! * @brief Assign value from an object of the non-const version. */ - const MDA_AccessConst& operator = ( + const MDA_AccessConst& + operator = ( const MDA_Access& r) { (MDA_Access&)(*this) = r; return *this; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.depend index ca27160b..440965d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -25,6 +25,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ @@ -32,7 +33,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -44,22 +44,19 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=ArrayDataAccess.o DEPENDS_1:=\ @@ -75,6 +72,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -84,7 +82,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -96,23 +93,20 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataAccess.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=ArrayDataIterator.o DEPENDS_2:=\ @@ -125,9 +119,9 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -137,18 +131,15 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArrayDataIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=ArrayDataOperationUtilities.o DEPENDS_3:=\ @@ -164,6 +155,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -171,7 +163,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -183,23 +174,20 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ ArrayDataOperationUtilities.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=CellComplexConstantRefine.o DEPENDS_4:=\ @@ -225,6 +213,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -243,7 +232,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -254,15 +242,16 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellComplexConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -271,11 +260,10 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=CellComplexLinearTimeInterpolateOp.o DEPENDS_5:=\ @@ -301,6 +289,7 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -319,7 +308,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -331,14 +319,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -347,11 +335,10 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=CellData.o DEPENDS_6:=\ @@ -370,6 +357,7 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -382,7 +370,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -394,23 +381,22 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=CellDataFactory.o DEPENDS_7:=\ @@ -436,6 +422,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -452,7 +439,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -464,24 +450,23 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=CellDoubleConstantRefine.o DEPENDS_8:=\ @@ -507,6 +492,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -525,7 +511,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -536,15 +521,16 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellDoubleConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -553,11 +539,10 @@ DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_8}: ${DEPENDS_8} FILE_9=CellDoubleLinearTimeInterpolateOp.o DEPENDS_9:=\ @@ -583,6 +568,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -601,7 +587,6 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -613,14 +598,14 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -629,11 +614,10 @@ DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} + +${FILE_9}: ${DEPENDS_9} FILE_10=CellFloatConstantRefine.o DEPENDS_10:=\ @@ -659,6 +643,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -677,7 +662,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -688,14 +672,15 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellFloatConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -704,11 +689,10 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} + +${FILE_10}: ${DEPENDS_10} FILE_11=CellFloatLinearTimeInterpolateOp.o DEPENDS_11:=\ @@ -734,6 +718,7 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -752,7 +737,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -764,14 +748,14 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -780,11 +764,10 @@ DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} + +${FILE_11}: ${DEPENDS_11} FILE_12=CellGeometry.o DEPENDS_12:=\ @@ -802,11 +785,12 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -817,27 +801,24 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} + +${FILE_12}: ${DEPENDS_12} FILE_13=CellIndex.o DEPENDS_13:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -846,17 +827,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellIndex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_13}: ${DEPENDS_13} FILE_14=CellIntegerConstantRefine.o DEPENDS_14:=\ @@ -882,6 +860,7 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -900,7 +879,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -911,15 +889,16 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ CellIntegerConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -928,11 +907,10 @@ DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_14}: ${DEPENDS_14} FILE_15=CellIterator.o DEPENDS_15:=\ @@ -950,12 +928,12 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -966,19 +944,16 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_15 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} + +${FILE_15}: ${DEPENDS_15} FILE_16=CellOverlap.o DEPENDS_16:=\ @@ -995,9 +970,9 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1008,19 +983,16 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_16 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} + +${FILE_16}: ${DEPENDS_16} FILE_17=CellVariable.o DEPENDS_17:=\ @@ -1046,6 +1018,7 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1063,7 +1036,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1075,13 +1047,13 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1089,11 +1061,10 @@ DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} + +${FILE_17}: ${DEPENDS_17} FILE_18=CopyOperation.o DEPENDS_18:=\ @@ -1101,12 +1072,11 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h CopyOperation.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_18 +=\ -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} + +${FILE_18}: ${DEPENDS_18} FILE_19=DoubleAttributeId.o DEPENDS_19:=\ @@ -1114,12 +1084,11 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/pdat/DoubleAttributeId.h \ DoubleAttributeId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_19 +=\ -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} + +${FILE_19}: ${DEPENDS_19} FILE_20=EdgeComplexConstantRefine.o DEPENDS_20:=\ @@ -1145,6 +1114,7 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1166,7 +1136,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1177,15 +1146,14 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeComplexConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1196,11 +1164,10 @@ DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} + +${FILE_20}: ${DEPENDS_20} FILE_21=EdgeComplexLinearTimeInterpolateOp.o DEPENDS_21:=\ @@ -1226,6 +1193,7 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1247,7 +1215,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1259,14 +1226,12 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1277,11 +1242,10 @@ DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} + +${FILE_21}: ${DEPENDS_21} FILE_22=EdgeData.o DEPENDS_22:=\ @@ -1300,6 +1264,7 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -1312,7 +1277,6 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1324,23 +1288,20 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} + +${FILE_22}: ${DEPENDS_22} FILE_23=EdgeDataFactory.o DEPENDS_23:=\ @@ -1366,6 +1327,7 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1385,7 +1347,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1397,13 +1358,11 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1412,11 +1371,10 @@ DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} + +${FILE_23}: ${DEPENDS_23} FILE_24=EdgeDoubleConstantRefine.o DEPENDS_24:=\ @@ -1442,6 +1400,7 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1463,7 +1422,6 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1474,15 +1432,14 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeDoubleConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1493,11 +1450,10 @@ DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} + +${FILE_24}: ${DEPENDS_24} FILE_25=EdgeDoubleLinearTimeInterpolateOp.o DEPENDS_25:=\ @@ -1523,6 +1479,7 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1544,7 +1501,6 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1556,14 +1512,12 @@ DEPENDS_25:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1574,11 +1528,10 @@ DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_25:X.o=${NDIM}.o}: ${DEPENDS_25} + +${FILE_25}: ${DEPENDS_25} FILE_26=EdgeFloatConstantRefine.o DEPENDS_26:=\ @@ -1604,6 +1557,7 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1625,7 +1579,6 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1636,14 +1589,13 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeFloatConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1654,11 +1606,10 @@ DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_26:X.o=${NDIM}.o}: ${DEPENDS_26} + +${FILE_26}: ${DEPENDS_26} FILE_27=EdgeFloatLinearTimeInterpolateOp.o DEPENDS_27:=\ @@ -1684,6 +1635,7 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1705,7 +1657,6 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1717,14 +1668,12 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1735,11 +1684,10 @@ DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_27:X.o=${NDIM}.o}: ${DEPENDS_27} + +${FILE_27}: ${DEPENDS_27} FILE_28=EdgeGeometry.o DEPENDS_28:=\ @@ -1757,11 +1705,12 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1772,27 +1721,24 @@ DEPENDS_28:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_28 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_28:X.o=${NDIM}.o}: ${DEPENDS_28} + +${FILE_28}: ${DEPENDS_28} FILE_29=EdgeIndex.o DEPENDS_29:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1801,17 +1747,14 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeIndex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_29 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_29:X.o=${NDIM}.o}: ${DEPENDS_29} + +${FILE_29}: ${DEPENDS_29} FILE_30=EdgeIntegerConstantRefine.o DEPENDS_30:=\ @@ -1837,6 +1780,7 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -1858,7 +1802,6 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1869,15 +1812,14 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ EdgeIntegerConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1888,11 +1830,10 @@ DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_30:X.o=${NDIM}.o}: ${DEPENDS_30} + +${FILE_30}: ${DEPENDS_30} FILE_31=EdgeIterator.o DEPENDS_31:=\ @@ -1910,12 +1851,12 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1926,19 +1867,16 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_31 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_31:X.o=${NDIM}.o}: ${DEPENDS_31} + +${FILE_31}: ${DEPENDS_31} FILE_32=EdgeOverlap.o DEPENDS_32:=\ @@ -1946,6 +1884,7 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ @@ -1955,9 +1894,11 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1968,19 +1909,16 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_32 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_32:X.o=${NDIM}.o}: ${DEPENDS_32} + +${FILE_32}: ${DEPENDS_32} FILE_33=EdgeVariable.o DEPENDS_33:=\ @@ -2006,6 +1944,7 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2026,7 +1965,6 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2038,13 +1976,11 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h EdgeVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_33 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2054,11 +1990,10 @@ DEPENDS_33 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_33:X.o=${NDIM}.o}: ${DEPENDS_33} + +${FILE_33}: ${DEPENDS_33} FILE_34=FaceComplexConstantRefine.o DEPENDS_34:=\ @@ -2084,6 +2019,7 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2105,7 +2041,6 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2116,15 +2051,14 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceComplexConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2135,11 +2069,10 @@ DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_34:X.o=${NDIM}.o}: ${DEPENDS_34} + +${FILE_34}: ${DEPENDS_34} FILE_35=FaceComplexLinearTimeInterpolateOp.o DEPENDS_35:=\ @@ -2165,6 +2098,7 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2186,7 +2120,6 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2198,14 +2131,12 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_35 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2216,11 +2147,10 @@ DEPENDS_35 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_35:X.o=${NDIM}.o}: ${DEPENDS_35} + +${FILE_35}: ${DEPENDS_35} FILE_36=FaceData.o DEPENDS_36:=\ @@ -2239,6 +2169,7 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -2251,7 +2182,6 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2263,23 +2193,20 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_36 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_36:X.o=${NDIM}.o}: ${DEPENDS_36} + +${FILE_36}: ${DEPENDS_36} FILE_37=FaceDataFactory.o DEPENDS_37:=\ @@ -2305,6 +2232,7 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2324,7 +2252,6 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2336,13 +2263,11 @@ DEPENDS_37:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2351,11 +2276,10 @@ DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_37:X.o=${NDIM}.o}: ${DEPENDS_37} + +${FILE_37}: ${DEPENDS_37} FILE_38=FaceDoubleConstantRefine.o DEPENDS_38:=\ @@ -2381,6 +2305,7 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2402,7 +2327,6 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2413,15 +2337,14 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceDoubleConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_38 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2432,11 +2355,10 @@ DEPENDS_38 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_38:X.o=${NDIM}.o}: ${DEPENDS_38} + +${FILE_38}: ${DEPENDS_38} FILE_39=FaceDoubleLinearTimeInterpolateOp.o DEPENDS_39:=\ @@ -2462,6 +2384,7 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2483,7 +2406,6 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2495,14 +2417,12 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2513,11 +2433,10 @@ DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_39:X.o=${NDIM}.o}: ${DEPENDS_39} + +${FILE_39}: ${DEPENDS_39} FILE_40=FaceFloatConstantRefine.o DEPENDS_40:=\ @@ -2543,6 +2462,7 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2564,7 +2484,6 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2575,14 +2494,13 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceFloatConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_40 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2593,11 +2511,10 @@ DEPENDS_40 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_40:X.o=${NDIM}.o}: ${DEPENDS_40} + +${FILE_40}: ${DEPENDS_40} FILE_41=FaceFloatLinearTimeInterpolateOp.o DEPENDS_41:=\ @@ -2623,6 +2540,7 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2644,7 +2562,6 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2656,14 +2573,12 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_41 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2674,11 +2589,10 @@ DEPENDS_41 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_41:X.o=${NDIM}.o}: ${DEPENDS_41} + +${FILE_41}: ${DEPENDS_41} FILE_42=FaceGeometry.o DEPENDS_42:=\ @@ -2696,11 +2610,12 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2711,27 +2626,24 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_42 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_42:X.o=${NDIM}.o}: ${DEPENDS_42} + +${FILE_42}: ${DEPENDS_42} FILE_43=FaceIndex.o DEPENDS_43:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -2740,17 +2652,14 @@ DEPENDS_43:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceIndex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_43 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_43:X.o=${NDIM}.o}: ${DEPENDS_43} + +${FILE_43}: ${DEPENDS_43} FILE_44=FaceIntegerConstantRefine.o DEPENDS_44:=\ @@ -2776,6 +2685,7 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -2797,7 +2707,6 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2808,15 +2717,14 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ FaceIntegerConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2827,11 +2735,10 @@ DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_44:X.o=${NDIM}.o}: ${DEPENDS_44} + +${FILE_44}: ${DEPENDS_44} FILE_45=FaceIterator.o DEPENDS_45:=\ @@ -2849,12 +2756,12 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2865,19 +2772,16 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_45 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_45:X.o=${NDIM}.o}: ${DEPENDS_45} + +${FILE_45}: ${DEPENDS_45} FILE_46=FaceOverlap.o DEPENDS_46:=\ @@ -2885,6 +2789,7 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ @@ -2894,9 +2799,11 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2907,19 +2814,16 @@ DEPENDS_46:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_46 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_46:X.o=${NDIM}.o}: ${DEPENDS_46} + +${FILE_46}: ${DEPENDS_46} FILE_47=FaceVariable.o DEPENDS_47:=\ @@ -2945,6 +2849,7 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2965,7 +2870,6 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2977,13 +2881,11 @@ DEPENDS_47:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FaceVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_47 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -2993,11 +2895,10 @@ DEPENDS_47 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_47:X.o=${NDIM}.o}: ${DEPENDS_47} + +${FILE_47}: ${DEPENDS_47} FILE_48=FirstLayerCellNoCornersVariableFillPattern.o DEPENDS_48:=\ @@ -3017,12 +2918,12 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FirstLayerCellNoCornersVariableFillPattern.h\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3033,7 +2934,6 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -3041,13 +2941,11 @@ DEPENDS_48:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ FirstLayerCellNoCornersVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_48 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_48:X.o=${NDIM}.o}: ${DEPENDS_48} + +${FILE_48}: ${DEPENDS_48} FILE_49=FirstLayerCellVariableFillPattern.o DEPENDS_49:=\ @@ -3067,12 +2965,12 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FirstLayerCellVariableFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3083,7 +2981,6 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -3091,15 +2988,13 @@ DEPENDS_49:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ FirstLayerCellVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_49 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_49:X.o=${NDIM}.o}: ${DEPENDS_49} -FILE_50=FirstLayerNodeVariableFillPattern.o +${FILE_49}: ${DEPENDS_49} + +FILE_50=FirstLayerEdgeVariableFillPattern.o DEPENDS_50:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -3117,12 +3012,59 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FirstLayerEdgeVariableFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + FirstLayerEdgeVariableFillPattern.C + +DEPENDS_50 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_50}: ${DEPENDS_50} + +FILE_51=FirstLayerNodeVariableFillPattern.o +DEPENDS_51:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FirstLayerNodeVariableFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3133,7 +3075,6 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -3141,20 +3082,19 @@ DEPENDS_50:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ FirstLayerNodeVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_50 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_51 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_50:X.o=${NDIM}.o}: ${DEPENDS_50} -FILE_51=IndexData.o -DEPENDS_51:=\ +${FILE_51}: ${DEPENDS_51} + +FILE_52=FirstLayerSideVariableFillPattern.o +DEPENDS_52:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ @@ -3164,11 +3104,57 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FirstLayerSideVariableFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + FirstLayerSideVariableFillPattern.C + +DEPENDS_52 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_52}: ${DEPENDS_52} + +FILE_53=IndexData.o +DEPENDS_53:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3179,22 +3165,19 @@ DEPENDS_51:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h IndexData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_51 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_53 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_51:X.o=${NDIM}.o}: ${DEPENDS_51} -FILE_52=IndexDataFactory.o -DEPENDS_52:=\ +${FILE_53}: ${DEPENDS_53} + +FILE_54=IndexDataFactory.o +DEPENDS_54:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3217,6 +3200,7 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3224,7 +3208,6 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3236,23 +3219,20 @@ DEPENDS_52:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h IndexDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_52 +=\ +DEPENDS_54 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_52:X.o=${NDIM}.o}: ${DEPENDS_52} -FILE_53=IndexVariable.o -DEPENDS_53:=\ +${FILE_54}: ${DEPENDS_54} + +FILE_55=IndexVariable.o +DEPENDS_55:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3275,6 +3255,7 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3283,7 +3264,6 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3295,37 +3275,33 @@ DEPENDS_53:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h IndexVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_53 +=\ +DEPENDS_55 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_53:X.o=${NDIM}.o}: ${DEPENDS_53} -FILE_54=IntegerAttributeId.o -DEPENDS_54:=\ +${FILE_55}: ${DEPENDS_55} + +FILE_56=IntegerAttributeId.o +DEPENDS_56:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IntegerAttributeId.h \ IntegerAttributeId.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_54 +=\ +DEPENDS_56 +=\ -endif -${FILE_54:X.o=${NDIM}.o}: ${DEPENDS_54} -FILE_55=NodeComplexInjection.o -DEPENDS_55:=\ +${FILE_56}: ${DEPENDS_56} + +FILE_57=NodeComplexInjection.o +DEPENDS_57:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3349,6 +3325,7 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3369,7 +3346,6 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3380,15 +3356,14 @@ DEPENDS_55:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeComplexInjection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_55 +=\ +DEPENDS_57 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3398,14 +3373,13 @@ DEPENDS_55 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_55:X.o=${NDIM}.o}: ${DEPENDS_55} -FILE_56=NodeComplexLinearTimeInterpolateOp.o -DEPENDS_56:=\ +${FILE_57}: ${DEPENDS_57} + +FILE_58=NodeComplexLinearTimeInterpolateOp.o +DEPENDS_58:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3428,6 +3402,7 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -3449,7 +3424,6 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3461,15 +3435,13 @@ DEPENDS_56:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ NodeComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_56 +=\ +DEPENDS_58 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3479,14 +3451,13 @@ DEPENDS_56 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_56:X.o=${NDIM}.o}: ${DEPENDS_56} -FILE_57=NodeData.o -DEPENDS_57:=\ +${FILE_58}: ${DEPENDS_58} + +FILE_59=NodeData.o +DEPENDS_59:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -3502,6 +3473,7 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -3514,7 +3486,6 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3526,26 +3497,23 @@ DEPENDS_57:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_57 +=\ +DEPENDS_59 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_57:X.o=${NDIM}.o}: ${DEPENDS_57} -FILE_58=NodeDataFactory.o -DEPENDS_58:=\ +${FILE_59}: ${DEPENDS_59} + +FILE_60=NodeDataFactory.o +DEPENDS_60:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3568,6 +3536,7 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3587,7 +3556,6 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3599,14 +3567,12 @@ DEPENDS_58:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_58 +=\ +DEPENDS_60 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3614,14 +3580,13 @@ DEPENDS_58 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_58:X.o=${NDIM}.o}: ${DEPENDS_58} -FILE_59=NodeDoubleInjection.o -DEPENDS_59:=\ +${FILE_60}: ${DEPENDS_60} + +FILE_61=NodeDoubleInjection.o +DEPENDS_61:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3645,6 +3610,7 @@ DEPENDS_59:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3665,7 +3631,6 @@ DEPENDS_59:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3676,15 +3641,14 @@ DEPENDS_59:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeDoubleInjection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_59 +=\ +DEPENDS_61 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3694,14 +3658,13 @@ DEPENDS_59 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_59:X.o=${NDIM}.o}: ${DEPENDS_59} -FILE_60=NodeDoubleLinearTimeInterpolateOp.o -DEPENDS_60:=\ +${FILE_61}: ${DEPENDS_61} + +FILE_62=NodeDoubleLinearTimeInterpolateOp.o +DEPENDS_62:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3724,6 +3687,7 @@ DEPENDS_60:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -3745,7 +3709,6 @@ DEPENDS_60:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3757,15 +3720,13 @@ DEPENDS_60:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ NodeDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_60 +=\ +DEPENDS_62 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3775,14 +3736,13 @@ DEPENDS_60 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_60:X.o=${NDIM}.o}: ${DEPENDS_60} -FILE_61=NodeFloatInjection.o -DEPENDS_61:=\ +${FILE_62}: ${DEPENDS_62} + +FILE_63=NodeFloatInjection.o +DEPENDS_63:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3806,6 +3766,7 @@ DEPENDS_61:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -3826,7 +3787,6 @@ DEPENDS_61:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3837,15 +3797,14 @@ DEPENDS_61:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeFloatInjection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_61 +=\ +DEPENDS_63 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3855,14 +3814,13 @@ DEPENDS_61 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_61:X.o=${NDIM}.o}: ${DEPENDS_61} -FILE_62=NodeFloatLinearTimeInterpolateOp.o -DEPENDS_62:=\ +${FILE_63}: ${DEPENDS_63} + +FILE_64=NodeFloatLinearTimeInterpolateOp.o +DEPENDS_64:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -3885,6 +3843,7 @@ DEPENDS_62:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -3906,7 +3865,6 @@ DEPENDS_62:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3918,15 +3876,13 @@ DEPENDS_62:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ NodeFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_62 +=\ +DEPENDS_64 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -3936,14 +3892,13 @@ DEPENDS_62 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_62:X.o=${NDIM}.o}: ${DEPENDS_62} -FILE_63=NodeGeometry.o -DEPENDS_63:=\ +${FILE_64}: ${DEPENDS_64} + +FILE_65=NodeGeometry.o +DEPENDS_65:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -3958,11 +3913,12 @@ DEPENDS_63:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -3973,27 +3929,24 @@ DEPENDS_63:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_63 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_65 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_63:X.o=${NDIM}.o}: ${DEPENDS_63} -FILE_64=NodeIndex.o -DEPENDS_64:=\ +${FILE_65}: ${DEPENDS_65} + +FILE_66=NodeIndex.o +DEPENDS_66:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -4002,20 +3955,17 @@ DEPENDS_64:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeIndex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_64 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_66 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_64:X.o=${NDIM}.o}: ${DEPENDS_64} -FILE_65=NodeIntegerInjection.o -DEPENDS_65:=\ +${FILE_66}: ${DEPENDS_66} + +FILE_67=NodeIntegerInjection.o +DEPENDS_67:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4039,6 +3989,7 @@ DEPENDS_65:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4059,7 +4010,6 @@ DEPENDS_65:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4070,15 +4020,14 @@ DEPENDS_65:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeIntegerInjection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_65 +=\ +DEPENDS_67 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4088,14 +4037,13 @@ DEPENDS_65 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_65:X.o=${NDIM}.o}: ${DEPENDS_65} -FILE_66=NodeIterator.o -DEPENDS_66:=\ +${FILE_67}: ${DEPENDS_67} + +FILE_68=NodeIterator.o +DEPENDS_68:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -4110,12 +4058,12 @@ DEPENDS_66:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4126,22 +4074,19 @@ DEPENDS_66:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_66 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_68 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_66:X.o=${NDIM}.o}: ${DEPENDS_66} -FILE_67=NodeOverlap.o -DEPENDS_67:=\ +${FILE_68}: ${DEPENDS_68} + +FILE_69=NodeOverlap.o +DEPENDS_69:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -4155,9 +4100,9 @@ DEPENDS_67:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4168,22 +4113,19 @@ DEPENDS_67:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_67 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_69 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_67:X.o=${NDIM}.o}: ${DEPENDS_67} -FILE_68=NodeVariable.o -DEPENDS_68:=\ +${FILE_69}: ${DEPENDS_69} + +FILE_70=NodeVariable.o +DEPENDS_70:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4206,6 +4148,7 @@ DEPENDS_68:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4226,7 +4169,6 @@ DEPENDS_68:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4238,14 +4180,12 @@ DEPENDS_68:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NodeVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_68 +=\ +DEPENDS_70 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4254,14 +4194,13 @@ DEPENDS_68 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_68:X.o=${NDIM}.o}: ${DEPENDS_68} -FILE_69=OuteredgeData.o -DEPENDS_69:=\ +${FILE_70}: ${DEPENDS_70} + +FILE_71=OuteredgeData.o +DEPENDS_71:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -4277,6 +4216,7 @@ DEPENDS_69:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -4291,7 +4231,6 @@ DEPENDS_69:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4303,27 +4242,24 @@ DEPENDS_69:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuteredgeData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_69 +=\ +DEPENDS_71 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_69:X.o=${NDIM}.o}: ${DEPENDS_69} -FILE_70=OuteredgeDataFactory.o -DEPENDS_70:=\ +${FILE_71}: ${DEPENDS_71} + +FILE_72=OuteredgeDataFactory.o +DEPENDS_72:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4346,6 +4282,7 @@ DEPENDS_70:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4365,7 +4302,6 @@ DEPENDS_70:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4377,14 +4313,12 @@ DEPENDS_70:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuteredgeDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_70 +=\ +DEPENDS_72 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4392,14 +4326,13 @@ DEPENDS_70 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_70:X.o=${NDIM}.o}: ${DEPENDS_70} -FILE_71=OuteredgeGeometry.o -DEPENDS_71:=\ +${FILE_72}: ${DEPENDS_72} + +FILE_73=OuteredgeGeometry.o +DEPENDS_73:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -4414,12 +4347,12 @@ DEPENDS_71:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4430,22 +4363,19 @@ DEPENDS_71:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuteredgeGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_71 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_73 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_71:X.o=${NDIM}.o}: ${DEPENDS_71} -FILE_72=OuteredgeVariable.o -DEPENDS_72:=\ +${FILE_73}: ${DEPENDS_73} + +FILE_74=OuteredgeVariable.o +DEPENDS_74:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4468,6 +4398,7 @@ DEPENDS_72:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4488,7 +4419,6 @@ DEPENDS_72:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4500,14 +4430,12 @@ DEPENDS_72:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuteredgeVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_72 +=\ +DEPENDS_74 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4516,14 +4444,13 @@ DEPENDS_72 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_72:X.o=${NDIM}.o}: ${DEPENDS_72} -FILE_73=OuterfaceComplexConstantRefine.o -DEPENDS_73:=\ +${FILE_74}: ${DEPENDS_74} + +FILE_75=OuterfaceComplexConstantRefine.o +DEPENDS_75:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4546,6 +4473,7 @@ DEPENDS_73:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -4567,7 +4495,6 @@ DEPENDS_73:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4578,16 +4505,15 @@ DEPENDS_73:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceComplexConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_73 +=\ +DEPENDS_75 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4597,14 +4523,13 @@ DEPENDS_73 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_73:X.o=${NDIM}.o}: ${DEPENDS_73} -FILE_74=OuterfaceComplexLinearTimeInterpolateOp.o -DEPENDS_74:=\ +${FILE_75}: ${DEPENDS_75} + +FILE_76=OuterfaceComplexLinearTimeInterpolateOp.o +DEPENDS_76:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4627,6 +4552,7 @@ DEPENDS_74:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -4648,7 +4574,6 @@ DEPENDS_74:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4660,15 +4585,13 @@ DEPENDS_74:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_74 +=\ +DEPENDS_76 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4678,14 +4601,13 @@ DEPENDS_74 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_74:X.o=${NDIM}.o}: ${DEPENDS_74} -FILE_75=OuterfaceData.o -DEPENDS_75:=\ +${FILE_76}: ${DEPENDS_76} + +FILE_77=OuterfaceData.o +DEPENDS_77:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -4701,6 +4623,7 @@ DEPENDS_75:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -4714,7 +4637,6 @@ DEPENDS_75:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4726,27 +4648,24 @@ DEPENDS_75:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuterfaceData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_75 +=\ +DEPENDS_77 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_75:X.o=${NDIM}.o}: ${DEPENDS_75} -FILE_76=OuterfaceDataFactory.o -DEPENDS_76:=\ +${FILE_77}: ${DEPENDS_77} + +FILE_78=OuterfaceDataFactory.o +DEPENDS_78:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4769,6 +4688,7 @@ DEPENDS_76:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -4788,7 +4708,6 @@ DEPENDS_76:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4800,14 +4719,12 @@ DEPENDS_76:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuterfaceDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_76 +=\ +DEPENDS_78 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4815,14 +4732,13 @@ DEPENDS_76 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_76:X.o=${NDIM}.o}: ${DEPENDS_76} -FILE_77=OuterfaceDoubleConstantRefine.o -DEPENDS_77:=\ +${FILE_78}: ${DEPENDS_78} + +FILE_79=OuterfaceDoubleConstantRefine.o +DEPENDS_79:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4845,6 +4761,7 @@ DEPENDS_77:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -4866,7 +4783,6 @@ DEPENDS_77:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4877,16 +4793,15 @@ DEPENDS_77:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceDoubleConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_77 +=\ +DEPENDS_79 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4896,14 +4811,13 @@ DEPENDS_77 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_77:X.o=${NDIM}.o}: ${DEPENDS_77} -FILE_78=OuterfaceDoubleLinearTimeInterpolateOp.o -DEPENDS_78:=\ +${FILE_79}: ${DEPENDS_79} + +FILE_80=OuterfaceDoubleLinearTimeInterpolateOp.o +DEPENDS_80:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -4926,6 +4840,7 @@ DEPENDS_78:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -4947,7 +4862,6 @@ DEPENDS_78:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -4959,15 +4873,13 @@ DEPENDS_78:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_78 +=\ +DEPENDS_80 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -4977,14 +4889,13 @@ DEPENDS_78 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_78:X.o=${NDIM}.o}: ${DEPENDS_78} -FILE_79=OuterfaceFloatConstantRefine.o -DEPENDS_79:=\ +${FILE_80}: ${DEPENDS_80} + +FILE_81=OuterfaceFloatConstantRefine.o +DEPENDS_81:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5007,6 +4918,7 @@ DEPENDS_79:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -5028,7 +4940,6 @@ DEPENDS_79:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5039,16 +4950,15 @@ DEPENDS_79:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceFloatConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_79 +=\ +DEPENDS_81 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5058,14 +4968,13 @@ DEPENDS_79 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_79:X.o=${NDIM}.o}: ${DEPENDS_79} -FILE_80=OuterfaceFloatLinearTimeInterpolateOp.o -DEPENDS_80:=\ +${FILE_81}: ${DEPENDS_81} + +FILE_82=OuterfaceFloatLinearTimeInterpolateOp.o +DEPENDS_82:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5088,6 +4997,7 @@ DEPENDS_80:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -5109,7 +5019,6 @@ DEPENDS_80:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5121,15 +5030,13 @@ DEPENDS_80:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_80 +=\ +DEPENDS_82 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5139,14 +5046,13 @@ DEPENDS_80 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_80:X.o=${NDIM}.o}: ${DEPENDS_80} -FILE_81=OuterfaceGeometry.o -DEPENDS_81:=\ +${FILE_82}: ${DEPENDS_82} + +FILE_83=OuterfaceGeometry.o +DEPENDS_83:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -5161,12 +5067,12 @@ DEPENDS_81:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5177,22 +5083,19 @@ DEPENDS_81:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuterfaceGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_81 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_83 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_81:X.o=${NDIM}.o}: ${DEPENDS_81} -FILE_82=OuterfaceIntegerConstantRefine.o -DEPENDS_82:=\ +${FILE_83}: ${DEPENDS_83} + +FILE_84=OuterfaceIntegerConstantRefine.o +DEPENDS_84:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5215,6 +5118,7 @@ DEPENDS_82:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -5236,7 +5140,6 @@ DEPENDS_82:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceIntegerConstantRefine.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5247,16 +5150,15 @@ DEPENDS_82:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OuterfaceIntegerConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_82 +=\ +DEPENDS_84 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5266,14 +5168,13 @@ DEPENDS_82 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_82:X.o=${NDIM}.o}: ${DEPENDS_82} -FILE_83=OuterfaceVariable.o -DEPENDS_83:=\ +${FILE_84}: ${DEPENDS_84} + +FILE_85=OuterfaceVariable.o +DEPENDS_85:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5296,6 +5197,7 @@ DEPENDS_83:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -5316,7 +5218,6 @@ DEPENDS_83:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5328,14 +5229,12 @@ DEPENDS_83:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuterfaceVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_83 +=\ +DEPENDS_85 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5344,14 +5243,13 @@ DEPENDS_83 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_83:X.o=${NDIM}.o}: ${DEPENDS_83} -FILE_84=OuternodeData.o -DEPENDS_84:=\ +${FILE_85}: ${DEPENDS_85} + +FILE_86=OuternodeData.o +DEPENDS_86:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -5367,6 +5265,7 @@ DEPENDS_84:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -5380,7 +5279,6 @@ DEPENDS_84:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5392,27 +5290,24 @@ DEPENDS_84:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuternodeData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_84 +=\ +DEPENDS_86 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_84:X.o=${NDIM}.o}: ${DEPENDS_84} -FILE_85=OuternodeDataFactory.o -DEPENDS_85:=\ +${FILE_86}: ${DEPENDS_86} + +FILE_87=OuternodeDataFactory.o +DEPENDS_87:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5435,6 +5330,7 @@ DEPENDS_85:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -5454,7 +5350,6 @@ DEPENDS_85:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5466,14 +5361,12 @@ DEPENDS_85:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuternodeDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_85 +=\ +DEPENDS_87 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5481,14 +5374,13 @@ DEPENDS_85 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_85:X.o=${NDIM}.o}: ${DEPENDS_85} -FILE_86=OuternodeDoubleConstantCoarsen.o -DEPENDS_86:=\ +${FILE_87}: ${DEPENDS_87} + +FILE_88=OuternodeDoubleInjection.o +DEPENDS_88:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5512,6 +5404,7 @@ DEPENDS_86:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -5528,11 +5421,10 @@ DEPENDS_86:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDoubleInjection.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5543,16 +5435,15 @@ DEPENDS_86:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - OuternodeDoubleConstantCoarsen.C + OuternodeDoubleInjection.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_86 +=\ +DEPENDS_88 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5562,14 +5453,13 @@ DEPENDS_86 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_86:X.o=${NDIM}.o}: ${DEPENDS_86} -FILE_87=OuternodeGeometry.o -DEPENDS_87:=\ +${FILE_88}: ${DEPENDS_88} + +FILE_89=OuternodeGeometry.o +DEPENDS_89:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -5584,12 +5474,12 @@ DEPENDS_87:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5600,22 +5490,19 @@ DEPENDS_87:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuternodeGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_87 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_89 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_87:X.o=${NDIM}.o}: ${DEPENDS_87} -FILE_88=OuternodeVariable.o -DEPENDS_88:=\ +${FILE_89}: ${DEPENDS_89} + +FILE_90=OuternodeVariable.o +DEPENDS_90:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5638,6 +5525,7 @@ DEPENDS_88:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -5658,7 +5546,6 @@ DEPENDS_88:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5670,14 +5557,12 @@ DEPENDS_88:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OuternodeVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_88 +=\ +DEPENDS_90 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5686,14 +5571,13 @@ DEPENDS_88 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_88:X.o=${NDIM}.o}: ${DEPENDS_88} -FILE_89=OutersideComplexLinearTimeInterpolateOp.o -DEPENDS_89:=\ +${FILE_90}: ${DEPENDS_90} + +FILE_91=OutersideComplexLinearTimeInterpolateOp.o +DEPENDS_91:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5716,6 +5600,7 @@ DEPENDS_89:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -5737,7 +5622,6 @@ DEPENDS_89:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5749,15 +5633,13 @@ DEPENDS_89:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OutersideComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_89 +=\ +DEPENDS_91 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5767,14 +5649,13 @@ DEPENDS_89 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_89:X.o=${NDIM}.o}: ${DEPENDS_89} -FILE_90=OutersideData.o -DEPENDS_90:=\ +${FILE_91}: ${DEPENDS_91} + +FILE_92=OutersideData.o +DEPENDS_92:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -5790,6 +5671,7 @@ DEPENDS_90:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -5803,7 +5685,6 @@ DEPENDS_90:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5815,27 +5696,24 @@ DEPENDS_90:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OutersideData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_90 +=\ +DEPENDS_92 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_90:X.o=${NDIM}.o}: ${DEPENDS_90} -FILE_91=OutersideDataFactory.o -DEPENDS_91:=\ +${FILE_92}: ${DEPENDS_92} + +FILE_93=OutersideDataFactory.o +DEPENDS_93:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5858,6 +5736,7 @@ DEPENDS_91:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -5877,7 +5756,6 @@ DEPENDS_91:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5889,14 +5767,12 @@ DEPENDS_91:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OutersideDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_91 +=\ +DEPENDS_93 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5904,14 +5780,13 @@ DEPENDS_91 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_91:X.o=${NDIM}.o}: ${DEPENDS_91} -FILE_92=OutersideDoubleLinearTimeInterpolateOp.o -DEPENDS_92:=\ +${FILE_93}: ${DEPENDS_93} + +FILE_94=OutersideDoubleLinearTimeInterpolateOp.o +DEPENDS_94:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -5934,6 +5809,7 @@ DEPENDS_92:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -5955,7 +5831,6 @@ DEPENDS_92:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -5967,15 +5842,13 @@ DEPENDS_92:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OutersideDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_92 +=\ +DEPENDS_94 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -5985,14 +5858,13 @@ DEPENDS_92 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_92:X.o=${NDIM}.o}: ${DEPENDS_92} -FILE_93=OutersideFloatLinearTimeInterpolateOp.o -DEPENDS_93:=\ +${FILE_94}: ${DEPENDS_94} + +FILE_95=OutersideFloatLinearTimeInterpolateOp.o +DEPENDS_95:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6015,6 +5887,7 @@ DEPENDS_93:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6036,7 +5909,6 @@ DEPENDS_93:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6048,15 +5920,13 @@ DEPENDS_93:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ OutersideFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_93 +=\ +DEPENDS_95 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6066,14 +5936,13 @@ DEPENDS_93 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_93:X.o=${NDIM}.o}: ${DEPENDS_93} -FILE_94=OutersideGeometry.o -DEPENDS_94:=\ +${FILE_95}: ${DEPENDS_95} + +FILE_96=OutersideGeometry.o +DEPENDS_96:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -6088,12 +5957,12 @@ DEPENDS_94:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6104,22 +5973,19 @@ DEPENDS_94:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OutersideGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_94 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_96 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_94:X.o=${NDIM}.o}: ${DEPENDS_94} -FILE_95=OutersideVariable.o -DEPENDS_95:=\ +${FILE_96}: ${DEPENDS_96} + +FILE_97=OutersideVariable.o +DEPENDS_97:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6142,6 +6008,7 @@ DEPENDS_95:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -6162,7 +6029,6 @@ DEPENDS_95:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6174,14 +6040,12 @@ DEPENDS_95:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h OutersideVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_95 +=\ +DEPENDS_97 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6190,14 +6054,13 @@ DEPENDS_95 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_95:X.o=${NDIM}.o}: ${DEPENDS_95} -FILE_96=SecondLayerNodeNoCornersVariableFillPattern.o -DEPENDS_96:=\ +${FILE_97}: ${DEPENDS_97} + +FILE_98=SecondLayerNodeNoCornersVariableFillPattern.o +DEPENDS_98:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -6214,12 +6077,12 @@ DEPENDS_96:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6230,7 +6093,6 @@ DEPENDS_96:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -6238,16 +6100,14 @@ DEPENDS_96:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ SecondLayerNodeNoCornersVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_96 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_98 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_96:X.o=${NDIM}.o}: ${DEPENDS_96} -FILE_97=SecondLayerNodeVariableFillPattern.o -DEPENDS_97:=\ +${FILE_98}: ${DEPENDS_98} + +FILE_99=SecondLayerNodeVariableFillPattern.o +DEPENDS_99:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -6264,12 +6124,12 @@ DEPENDS_97:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6280,7 +6140,6 @@ DEPENDS_97:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -6288,16 +6147,14 @@ DEPENDS_97:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ SecondLayerNodeVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_97 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_99 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_97:X.o=${NDIM}.o}: ${DEPENDS_97} -FILE_98=SideComplexConstantRefine.o -DEPENDS_98:=\ +${FILE_99}: ${DEPENDS_99} + +FILE_100=SideComplexConstantRefine.o +DEPENDS_100:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6320,6 +6177,7 @@ DEPENDS_98:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6341,7 +6199,6 @@ DEPENDS_98:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6352,16 +6209,15 @@ DEPENDS_98:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideComplexConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_98 +=\ +DEPENDS_100 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6371,14 +6227,13 @@ DEPENDS_98 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_98:X.o=${NDIM}.o}: ${DEPENDS_98} -FILE_99=SideComplexLinearTimeInterpolateOp.o -DEPENDS_99:=\ +${FILE_100}: ${DEPENDS_100} + +FILE_101=SideComplexLinearTimeInterpolateOp.o +DEPENDS_101:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6401,6 +6256,7 @@ DEPENDS_99:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6422,7 +6278,6 @@ DEPENDS_99:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6434,15 +6289,13 @@ DEPENDS_99:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideComplexLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_99 +=\ +DEPENDS_101 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6452,14 +6305,13 @@ DEPENDS_99 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_99:X.o=${NDIM}.o}: ${DEPENDS_99} -FILE_100=SideData.o -DEPENDS_100:=\ +${FILE_101}: ${DEPENDS_101} + +FILE_102=SideData.o +DEPENDS_102:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -6475,6 +6327,7 @@ DEPENDS_100:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -6487,7 +6340,6 @@ DEPENDS_100:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6499,26 +6351,23 @@ DEPENDS_100:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_100 +=\ +DEPENDS_102 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_100:X.o=${NDIM}.o}: ${DEPENDS_100} -FILE_101=SideDataFactory.o -DEPENDS_101:=\ +${FILE_102}: ${DEPENDS_102} + +FILE_103=SideDataFactory.o +DEPENDS_103:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6541,6 +6390,7 @@ DEPENDS_101:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -6560,7 +6410,6 @@ DEPENDS_101:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6572,14 +6421,12 @@ DEPENDS_101:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_101 +=\ +DEPENDS_103 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6587,14 +6434,13 @@ DEPENDS_101 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_101:X.o=${NDIM}.o}: ${DEPENDS_101} -FILE_102=SideDoubleConstantRefine.o -DEPENDS_102:=\ +${FILE_103}: ${DEPENDS_103} + +FILE_104=SideDoubleConstantRefine.o +DEPENDS_104:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6617,6 +6463,7 @@ DEPENDS_102:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6638,7 +6485,6 @@ DEPENDS_102:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6649,16 +6495,15 @@ DEPENDS_102:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideDoubleConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_102 +=\ +DEPENDS_104 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6668,14 +6513,13 @@ DEPENDS_102 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_102:X.o=${NDIM}.o}: ${DEPENDS_102} -FILE_103=SideDoubleLinearTimeInterpolateOp.o -DEPENDS_103:=\ +${FILE_104}: ${DEPENDS_104} + +FILE_105=SideDoubleLinearTimeInterpolateOp.o +DEPENDS_105:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6698,6 +6542,7 @@ DEPENDS_103:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6719,7 +6564,6 @@ DEPENDS_103:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6731,15 +6575,13 @@ DEPENDS_103:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideDoubleLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_103 +=\ +DEPENDS_105 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6749,14 +6591,13 @@ DEPENDS_103 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_103:X.o=${NDIM}.o}: ${DEPENDS_103} -FILE_104=SideFloatConstantRefine.o -DEPENDS_104:=\ +${FILE_105}: ${DEPENDS_105} + +FILE_106=SideFloatConstantRefine.o +DEPENDS_106:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6779,6 +6620,7 @@ DEPENDS_104:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6800,7 +6642,6 @@ DEPENDS_104:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6811,15 +6652,14 @@ DEPENDS_104:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideFloatConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_104 +=\ +DEPENDS_106 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6829,14 +6669,13 @@ DEPENDS_104 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_104:X.o=${NDIM}.o}: ${DEPENDS_104} -FILE_105=SideFloatLinearTimeInterpolateOp.o -DEPENDS_105:=\ +${FILE_106}: ${DEPENDS_106} + +FILE_107=SideFloatLinearTimeInterpolateOp.o +DEPENDS_107:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -6859,6 +6698,7 @@ DEPENDS_105:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -6880,7 +6720,6 @@ DEPENDS_105:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6892,15 +6731,13 @@ DEPENDS_105:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideFloatLinearTimeInterpolateOp.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_105 +=\ +DEPENDS_107 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -6910,14 +6747,13 @@ DEPENDS_105 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_105:X.o=${NDIM}.o}: ${DEPENDS_105} -FILE_106=SideGeometry.o -DEPENDS_106:=\ +${FILE_107}: ${DEPENDS_107} + +FILE_108=SideGeometry.o +DEPENDS_108:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -6932,11 +6768,12 @@ DEPENDS_106:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -6947,27 +6784,24 @@ DEPENDS_106:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideGeometry.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_106 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_108 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_106:X.o=${NDIM}.o}: ${DEPENDS_106} -FILE_107=SideIndex.o -DEPENDS_107:=\ +${FILE_108}: ${DEPENDS_108} + +FILE_109=SideIndex.o +DEPENDS_109:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -6976,20 +6810,17 @@ DEPENDS_107:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideIndex.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_107 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_109 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_107:X.o=${NDIM}.o}: ${DEPENDS_107} -FILE_108=SideIntegerConstantRefine.o -DEPENDS_108:=\ +${FILE_109}: ${DEPENDS_109} + +FILE_110=SideIntegerConstantRefine.o +DEPENDS_110:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -7012,6 +6843,7 @@ DEPENDS_108:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ @@ -7033,7 +6865,6 @@ DEPENDS_108:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -7044,16 +6875,15 @@ DEPENDS_108:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ SideIntegerConstantRefine.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_108 +=\ +DEPENDS_110 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -7063,14 +6893,13 @@ DEPENDS_108 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_108:X.o=${NDIM}.o}: ${DEPENDS_108} -FILE_109=SideIterator.o -DEPENDS_109:=\ +${FILE_110}: ${DEPENDS_110} + +FILE_111=SideIterator.o +DEPENDS_111:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -7085,12 +6914,12 @@ DEPENDS_109:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -7101,26 +6930,24 @@ DEPENDS_109:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideIterator.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_109 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_111 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_109:X.o=${NDIM}.o}: ${DEPENDS_109} -FILE_110=SideOverlap.o -DEPENDS_110:=\ +${FILE_111}: ${DEPENDS_111} + +FILE_112=SideOverlap.o +DEPENDS_112:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ @@ -7130,9 +6957,11 @@ DEPENDS_110:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -7143,22 +6972,19 @@ DEPENDS_110:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideOverlap.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_110 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_112 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_110:X.o=${NDIM}.o}: ${DEPENDS_110} -FILE_111=SideVariable.o -DEPENDS_111:=\ +${FILE_112}: ${DEPENDS_112} + +FILE_113=SideVariable.o +DEPENDS_113:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -7181,6 +7007,7 @@ DEPENDS_111:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -7201,7 +7028,6 @@ DEPENDS_111:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -7213,14 +7039,12 @@ DEPENDS_111:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SideVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_111 +=\ +DEPENDS_113 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -7229,14 +7053,13 @@ DEPENDS_111 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_111:X.o=${NDIM}.o}: ${DEPENDS_111} -FILE_112=SparseData.o -DEPENDS_112:=\ +${FILE_113}: ${DEPENDS_113} + +FILE_114=SparseData.o +DEPENDS_114:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -7251,12 +7074,12 @@ DEPENDS_112:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/DoubleAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IntegerAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -7268,22 +7091,19 @@ DEPENDS_112:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SparseData.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_112 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_114 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_112:X.o=${NDIM}.o}: ${DEPENDS_112} -FILE_113=SparseDataFactory.o -DEPENDS_113:=\ +${FILE_114}: ${DEPENDS_114} + +FILE_115=SparseDataFactory.o +DEPENDS_115:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -7306,6 +7126,7 @@ DEPENDS_113:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -7315,7 +7136,6 @@ DEPENDS_113:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -7328,23 +7148,20 @@ DEPENDS_113:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SparseDataFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_113 +=\ +DEPENDS_115 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_113:X.o=${NDIM}.o}: ${DEPENDS_113} -FILE_114=SparseDataVariable.o -DEPENDS_114:=\ +${FILE_115}: ${DEPENDS_115} + +FILE_116=SparseDataVariable.o +DEPENDS_116:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -7367,6 +7184,7 @@ DEPENDS_114:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -7377,7 +7195,6 @@ DEPENDS_114:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataVariable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -7390,32 +7207,28 @@ DEPENDS_114:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SparseDataVariable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_114 +=\ +DEPENDS_116 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_114:X.o=${NDIM}.o}: ${DEPENDS_114} -FILE_115=SumOperation.o -DEPENDS_115:=\ +${FILE_116}: ${DEPENDS_116} + +FILE_117=SumOperation.o +DEPENDS_117:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h SumOperation.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_115 +=\ +DEPENDS_117 +=\ -endif -${FILE_115:X.o=${NDIM}.o}: ${DEPENDS_115} + +${FILE_117}: ${DEPENDS_117} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.in index 2ff5efc1..d9b77ffa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI pdat package ## ######################################################################### @@ -67,7 +67,7 @@ OBJS = \ NodeDoubleInjection.o \ NodeFloatInjection.o \ NodeIntegerInjection.o \ - OuternodeDoubleConstantCoarsen.o \ + OuternodeDoubleInjection.o \ CellIterator.o \ EdgeIterator.o \ FaceIterator.o \ @@ -95,7 +95,9 @@ OBJS = \ ArrayDataIterator.o \ FirstLayerCellVariableFillPattern.o \ FirstLayerCellNoCornersVariableFillPattern.o \ + FirstLayerEdgeVariableFillPattern.o \ FirstLayerNodeVariableFillPattern.o \ + FirstLayerSideVariableFillPattern.o \ SecondLayerNodeVariableFillPattern.o \ SecondLayerNodeNoCornersVariableFillPattern.o \ SparseData.o \ @@ -104,13 +106,11 @@ OBJS = \ IntegerAttributeId.o \ DoubleAttributeId.o - - library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.C index ee3ca01d..7ae0cea5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_NodeComplexInjection_C -#define included_pdat_NodeComplexInjection_C - #include "SAMRAI/pdat/NodeComplexInjection.h" #include "SAMRAI/tbox/Complex.h" @@ -36,20 +32,20 @@ extern "C" { #endif // in concoarsen1d.f: -void F77_FUNC(conavgnodecplx1d, CONAVGNODECPLX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodecplx1d, CONAVGNODECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in concoarsen2d.f: -void F77_FUNC(conavgnodecplx2d, CONAVGNODECPLX2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodecplx2d, CONAVGNODECPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in concoarsen3d.f: -void F77_FUNC(conavgnodecplx3d, CONAVGNODECPLX3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodecplx3d, CONAVGNODECPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -63,9 +59,8 @@ void F77_FUNC(conavgnodecplx3d, CONAVGNODECPLX3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -NodeComplexInjection::NodeComplexInjection( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSTANT_COARSEN") +NodeComplexInjection::NodeComplexInjection(): + hier::CoarsenOperator("CONSTANT_COARSEN") { } @@ -80,9 +75,9 @@ NodeComplexInjection::getOperatorPriority() const } hier::IntVector -NodeComplexInjection::getStencilWidth() const +NodeComplexInjection::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -94,45 +89,45 @@ NodeComplexInjection::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(coarse, fine, coarse_box, ratio); boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conavgnodecplx1d, CONAVGNODECPLX1D) (ifirstc(0), ilastc(0), + for (int d = 0; d < cdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conavgnodecplx1d, CONAVGNODECPLX1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conavgnodecplx2d, CONAVGNODECPLX2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conavgnodecplx2d, CONAVGNODECPLX2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conavgnodecplx3d, CONAVGNODECPLX3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conavgnodecplx3d, CONAVGNODECPLX3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -152,4 +147,3 @@ NodeComplexInjection::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.h index 0d73da47..16a3483c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexInjection.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered complex data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class NodeComplexInjection: /** * Uninteresting default constructor. */ - explicit NodeComplexInjection( - const tbox::Dimension& dim); + NodeComplexInjection(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class NodeComplexInjection: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -71,6 +71,10 @@ class NodeComplexInjection: * the destination patch and the coarse box. It is assumed that the * fine patch contains sufficient data for the stencil width of the * coarsening operator. + * + * @pre coarse.getDim == fine.getDim() && + * coarse.getDim == coarse_box.getDim() && + * coarse.getDim == ratio.getDim() */ void coarsen( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.C index 7abb25f4..f582926f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered complex data. * ************************************************************************/ - -#ifndef included_pdat_NodeComplexLinearTimeInterpolateOp_C -#define included_pdat_NodeComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -21,7 +17,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -37,7 +33,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintnodecmplx1d, LINTIMEINTNODECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodecmplx1d, LINTIMEINTNODECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,7 +42,7 @@ void F77_FUNC(lintimeintnodecmplx1d, LINTIMEINTNODECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintnodecmplx2d, LINTIMEINTNODECMPLX2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodecmplx2d, LINTIMEINTNODECMPLX2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -59,7 +55,7 @@ void F77_FUNC(lintimeintnodecmplx2d, LINTIMEINTNODECMPLX2D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintnodecmplx3d, LINTIMEINTNODECMPLX3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodecmplx3d, LINTIMEINTNODECMPLX3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,30 +91,30 @@ NodeComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const NodeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const NodeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); NodeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -137,9 +133,9 @@ NodeComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintnodecmplx1d, LINTIMEINTNODECMPLX1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodecmplx1d, LINTIMEINTNODECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -149,7 +145,7 @@ NodeComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintnodecmplx2d, LINTIMEINTNODECMPLX2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodecmplx2d, LINTIMEINTNODECMPLX2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -159,7 +155,7 @@ NodeComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintnodecmplx3d, LINTIMEINTNODECMPLX3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodecmplx3d, LINTIMEINTNODECMPLX3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -182,4 +178,3 @@ NodeComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.h index 3523811a..a9b1697f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered complex data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class NodeComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.C index 336d5280..e14fe349 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated node centered patch data type * ************************************************************************/ @@ -15,6 +15,7 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/pdat/NodeOverlap.h" #include "SAMRAI/tbox/Utilities.h" @@ -41,12 +42,12 @@ NodeData::NodeData( hier::PatchData(box, ghosts), d_depth(depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); const hier::Box node = NodeGeometry::toNodeBox(getGhostBox()); - d_data.initializeArray(node, depth); + d_data.reset(new ArrayData(node, depth)); } @@ -55,32 +56,6 @@ NodeData::~NodeData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -NodeData::NodeData( - const NodeData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -NodeData::operator = ( - const NodeData& foo) -{ - NULL_USE(foo); -} - template int NodeData::getDepth() const @@ -92,34 +67,34 @@ template ArrayData& NodeData::getArrayData() { - return d_data; + return *d_data; } template const ArrayData& NodeData::getArrayData() const { - return d_data; + return *d_data; } template -TYPE* +TYPE * NodeData::getPointer( int depth) { TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data.getPointer(depth); + return d_data->getPointer(depth); } template -const TYPE* +const TYPE * NodeData::getPointer( int depth) const { TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data.getPointer(depth); + return d_data->getPointer(depth); } template @@ -128,10 +103,10 @@ NodeData::operator () ( const NodeIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data(i, depth); + return (*d_data)(i, depth); } template @@ -140,10 +115,10 @@ NodeData::operator () ( const NodeIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data(i, depth); + return (*d_data)(i, depth); } /* @@ -160,16 +135,15 @@ void NodeData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const NodeData* t_src = - dynamic_cast *>(&src); - if (t_src == NULL) { + const NodeData* t_src = dynamic_cast *>(&src); + if (t_src == 0) { src.copy2(*this); } else { - const hier::Box box = d_data.getBox() * t_src->d_data.getBox(); + const hier::Box box = d_data->getBox() * t_src->d_data->getBox(); if (!box.empty()) { - d_data.copy(t_src->d_data, box); + d_data->copy(*(t_src->d_data), box); } } } @@ -179,16 +153,15 @@ void NodeData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - NodeData* t_dst = - dynamic_cast *>(&dst); + NodeData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - const hier::Box box = d_data.getBox() * t_dst->d_data.getBox(); + const hier::Box box = d_data->getBox() * t_dst->d_data->getBox(); if (!box.empty()) { - t_dst->d_data.copy(d_data, box); + t_dst->d_data->copy(*d_data, box); } } @@ -207,19 +180,17 @@ NodeData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const NodeData* t_src = - dynamic_cast *>(&src); - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeData* t_src = dynamic_cast *>(&src); + const NodeOverlap* t_overlap = dynamic_cast(&overlap); - if ((t_src == NULL) || (t_overlap == NULL)) { + if ((t_src == 0) || (t_overlap == 0)) { src.copy2(*this, overlap); } else { if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - d_data.copy(t_src->d_data, + d_data->copy(*(t_src->d_data), t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { @@ -234,19 +205,17 @@ NodeData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - NodeData* t_dst = - dynamic_cast *>(&dst); - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + NodeData* t_dst = CPP_CAST *>(&dst); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - t_dst->d_data.copy(d_data, + t_dst->d_data->copy(*d_data, t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { @@ -260,9 +229,9 @@ NodeData::copyOnBox( const NodeData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); const hier::Box node_box = NodeGeometry::toNodeBox(box); - d_data.copy(src.getArrayData(), node_box); + d_data->copy(src.getArrayData(), node_box); } template @@ -298,7 +267,7 @@ NodeData::copyWithRotation( node_rotatebox.getBlockId(), getBox().getBlockId()); - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -308,15 +277,15 @@ NodeData::copyWithRotation( const int depth = ((getDepth() < src.getDepth()) ? getDepth() : src.getDepth()); - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); ci != ciend; ++ci) { NodeIndex dst_index(*ci, hier::IntVector::getZero(dim)); NodeIndex src_index(dst_index); NodeGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { - d_data(dst_index, d) = src.d_data(src_index, d); + for (int d = 0; d < depth; ++d) { + (*d_data)(dst_index, d) = (*(src.d_data))(src_index, d); } } } @@ -339,11 +308,11 @@ NodeData::copyDepth( const NodeData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const hier::Box box = d_data.getBox() * src.d_data.getBox(); + const hier::Box box = d_data->getBox() * src.d_data->getBox(); if (!box.empty()) { - d_data.copyDepth(dst_depth, src.d_data, src_depth, box); + d_data->copyDepth(dst_depth, *(src.d_data), src_depth, box); } } @@ -364,16 +333,16 @@ NodeData::canEstimateStreamSizeFromBox() const } template -int +size_t NodeData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - return d_data.getDataStreamSize(t_overlap->getDestinationBoxContainer(), + return d_data->getDataStreamSize( + t_overlap->getDestinationBoxContainer(), t_overlap->getSourceOffset()); } @@ -392,14 +361,13 @@ NodeData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - d_data.packStream(stream, + d_data->packStream(stream, t_overlap->getDestinationBoxContainer(), t_overlap->getTransformation()); } else { @@ -442,11 +410,11 @@ NodeData::packWithRotation( const int depth = getDepth(); - const int size = depth * overlap_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = depth * overlap_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); int i = 0; - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -454,21 +422,21 @@ NodeData::packWithRotation( if (!copybox.empty()) { - for (int d = 0; d < depth; d++) { - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); ci != ciend; ++ci) { NodeIndex src_index(*ci, hier::IntVector::getZero(dim)); NodeGeometry::transform(src_index, back_trans); - buffer[i] = d_data(src_index, d); - i++; + buffer[i] = (*d_data)(src_index, d); + ++i; } } } } - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } template @@ -477,12 +445,11 @@ NodeData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - d_data.unpackStream(stream, + d_data->unpackStream(stream, t_overlap->getDestinationBoxContainer(), t_overlap->getSourceOffset()); } @@ -495,7 +462,7 @@ NodeData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - d_data.fill(t, d); + d_data->fill(t, d); } template @@ -505,10 +472,10 @@ NodeData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - d_data.fill(t, NodeGeometry::toNodeBox(box), d); + d_data->fill(t, NodeGeometry::toNodeBox(box), d); } template @@ -516,7 +483,7 @@ void NodeData::fillAll( const TYPE& t) { - d_data.fillAll(t); + d_data->fillAll(t); } template @@ -525,8 +492,8 @@ NodeData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - d_data.fillAll(t, NodeGeometry::toNodeBox(box)); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + d_data->fillAll(t, NodeGeometry::toNodeBox(box)); } /* @@ -545,7 +512,7 @@ NodeData::getSizeOfData( int depth, const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); const hier::Box ghost_box = hier::Box::grow(box, ghosts); @@ -568,9 +535,9 @@ NodeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; print(box, d, os, prec); } @@ -584,14 +551,14 @@ NodeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); os.precision(prec); - NodeIterator iend(box, false); - for (NodeIterator i(box, true); i != iend; ++i) { + NodeIterator iend(NodeGeometry::end(box)); + for (NodeIterator i(NodeGeometry::begin(box)); i != iend; ++i) { os << "array" << *i << " = " - << d_data(*i, depth) << std::endl << std::flush; + << (*d_data)(*i, depth) << std::endl << std::flush; } } @@ -600,51 +567,54 @@ NodeData::print( * * Checks to make sure that the class version and restart file * version are equal. If so, reads in d_depth and has d_data - * retrieve its own data from the database. + * retrieve its own data from the restart database. * ************************************************************************* */ template void -NodeData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +NodeData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_NODEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_NODEDATA_VERSION"); if (ver != PDAT_NODEDATA_VERSION) { - TBOX_ERROR("NodeData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("NodeData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); - d_data.getFromDatabase(database->getDatabase("d_data")); + d_data->getFromRestart(restart_db->getDatabase("d_data")); } /* ************************************************************************* * * Writes out the class version number and d_depth, Then has d_data - * write its own data to the database. + * write its own data to the restart database. * ************************************************************************* */ template void -NodeData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +NodeData::putToRestart( + const boost::shared_ptr& restart_db) const { + TBOX_ASSERT(restart_db); - TBOX_ASSERT(database); + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_NODEDATA_VERSION", PDAT_NODEDATA_VERSION); + restart_db->putInteger("PDAT_NODEDATA_VERSION", PDAT_NODEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); - d_data.putUnregisteredToDatabase(database->putDatabase("d_data")); + d_data->putToRestart(restart_db->putDatabase("d_data")); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.h index b3eef2f4..2238960c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated node centered patch data type * ************************************************************************/ @@ -16,18 +16,19 @@ #include "SAMRAI/pdat/ArrayData.h" #include "SAMRAI/pdat/NodeIndex.h" #include "SAMRAI/pdat/NodeIterator.h" +#include "SAMRAI/pdat/NodeOverlap.h" #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class NodeData provides an implementation for data defined + * @brief Class NodeData provides an implementation for data defined * at nodes on AMR patches. It is derived from the hier::PatchData * interface common to all SAMRAI patch data types. Given a CELL-centered * AMR index space box, a node data object represents data of some template @@ -42,7 +43,7 @@ namespace pdat { * so that the leftmost index runs fastest in memory. For example, a * three-dimensional node data object created over a CELL-centered * AMR index space box [l0:u0,l1:u1,l2:u2] allocates a data array - * dimensioned as + * sized as * \verbatim * * [ l0 : u0+1 , @@ -55,12 +56,12 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::NodeDataFactory - * @see pdat::NodeIndex - * @see pdat::NodeIterator - * @see pdat::NodeGeometry + * @see NodeDataFactory + * @see NodeIndex + * @see NodeIterator + * @see NodeGeometry */ template @@ -83,6 +84,9 @@ class NodeData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the node data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 */ static size_t getSizeOfData( @@ -101,6 +105,10 @@ class NodeData:public hier::PatchData * @param ghosts const IntVector reference indicating the width * of the ghost cell region around the box over which * the node data will be allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ NodeData( const hier::Box& box, @@ -122,6 +130,8 @@ class NodeData:public hier::PatchData /*! * @brief Get a pointer to the beginning of a particular depth * component of the node centered array. + * + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -130,6 +140,8 @@ class NodeData:public hier::PatchData /*! * @brief Get a const pointer to the beginning of a particular depth * component of the node centered array. + * + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -138,6 +150,9 @@ class NodeData:public hier::PatchData /*! * @brief Return a reference to the data entry corresponding * to a given node index and depth. + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -147,6 +162,9 @@ class NodeData:public hier::PatchData /*! * @brief Return a const reference to the data entry corresponding * to a given node index and depth. + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -176,6 +194,8 @@ class NodeData:public hier::PatchData * both the source and destination). Currently, source data must be * a NodeData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -190,6 +210,9 @@ class NodeData:public hier::PatchData * both the source and destination). Currently, destination data must be * a NodeData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -202,6 +225,8 @@ class NodeData:public hier::PatchData * Currently, source data must be NodeData of the same DIM and TYPE * and the overlap must be a NodeOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == src.getDim() */ virtual void copy( @@ -215,6 +240,10 @@ class NodeData:public hier::PatchData * Currently, destination data must be NodeData of the same DIM and TYPE * and the overlap must be a NodeOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy2( @@ -224,6 +253,8 @@ class NodeData:public hier::PatchData /*! * @brief Copy data from source to destination (i.e., this) * patch data object on the given CELL-centered AMR index box. + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copyOnBox( @@ -234,6 +265,8 @@ class NodeData:public hier::PatchData * @brief Fast copy (i.e., source and this node data objects are * defined over the same box) from the given node source data object to * this destination node data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -259,8 +292,10 @@ class NodeData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -268,6 +303,8 @@ class NodeData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be a * NodeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -278,6 +315,8 @@ class NodeData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be a * NodeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -286,6 +325,8 @@ class NodeData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -294,6 +335,9 @@ class NodeData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -310,6 +354,8 @@ class NodeData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -325,10 +371,12 @@ class NodeData:public hier::PatchData * and will be converted to node index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -347,10 +395,13 @@ class NodeData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -361,23 +412,23 @@ class NodeData:public hier::PatchData /*! * @brief Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * @brief Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * The node iterator iterates over the elements of a node @@ -392,11 +443,14 @@ class NodeData:public hier::PatchData */ static const int PDAT_NODEDATA_VERSION; + // Unimplemented copy constructor NodeData( - const NodeData&); // not implemented - void + const NodeData&); + + // Unimplemented assignment operator + NodeData& operator = ( - const NodeData&); // not implemented + const NodeData&); void copyWithRotation( @@ -409,7 +463,8 @@ class NodeData:public hier::PatchData const NodeOverlap& overlap) const; int d_depth; - ArrayData d_data; + + boost::shared_ptr > d_data; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.C index ff6969c8..be830e60 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating node data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/pdat/OuternodeDataFactory.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -63,12 +63,12 @@ boost::shared_ptr NodeDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - d_depth, - ghosts, - d_fine_boundary_represents_var); + d_depth, + ghosts, + d_fine_boundary_represents_var); } /* @@ -84,12 +84,12 @@ boost::shared_ptr NodeDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_depth, - d_ghosts); + patch.getBox(), + d_depth, + d_ghosts); } /* @@ -105,7 +105,7 @@ boost::shared_ptr NodeDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -130,7 +130,7 @@ size_t NodeDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(NodeData)); @@ -153,7 +153,7 @@ bool NodeDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -162,8 +162,8 @@ NodeDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > ndf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (ndf) { valid_copy = true; } @@ -171,8 +171,9 @@ NodeDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > ondf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (ondf) { valid_copy = true; } @@ -186,7 +187,7 @@ NodeDataFactory::validCopyTo( * * Return a boolean value indicating how data for the node quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the NodeVariable class header file for more + * constructor. See the NodeVariable class header file for more * information. * ************************************************************************* diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.h index 303bc62c..fb214e58 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating node data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::NodeData - * @see pdat::PatchDataFactory + * @see NodeData + * @see PatchDataFactory */ template @@ -40,10 +40,13 @@ class NodeDataFactory:public hier::PatchDataFactory { public: /** - * The constructor for the node data factory class. The ghost cell width, depth - * (number of components), and fine boundary representation arguments give the - * defaults for all edge data objects created with this factory. See - * the NodeVariable class header file for more information. + * The constructor for the node data factory class. The ghost cell width, + * depth (number of components), and fine boundary representation arguments + * give the defaults for all edge data objects created with this factory. + * See the NodeVariable class header file for more information. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ NodeDataFactory( int depth, @@ -64,6 +67,8 @@ class NodeDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -73,6 +78,8 @@ class NodeDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete node data object. * The default information about the object (e.g., ghost cell width) * is taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -82,6 +89,8 @@ class NodeDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr @@ -98,6 +107,8 @@ class NodeDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the node data object, * including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -106,7 +117,7 @@ class NodeDataFactory:public hier::PatchDataFactory /** * Return a boolean value indicating how data for the node quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the NodeVariable class header file for more + * constructor. See the NodeVariable class header file for more * information. */ bool @@ -123,6 +134,8 @@ class NodeDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this NodeDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is NodeDataFactory or OuternodeDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.C index 3c7b80f4..2ff70546 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_NodeDoubleInjection_C -#define included_pdat_NodeDoubleInjection_C - #include "SAMRAI/pdat/NodeDoubleInjection.h" #include @@ -35,20 +31,20 @@ extern "C" { #endif // in concoarsen1d.f: -void F77_FUNC(conavgnodedoub1d, CONAVGNODEDOUB1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodedoub1d, CONAVGNODEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in concoarsen2d.f: -void F77_FUNC(conavgnodedoub2d, CONAVGNODEDOUB2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodedoub2d, CONAVGNODEDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in concoarsen3d.f: -void F77_FUNC(conavgnodedoub3d, CONAVGNODEDOUB3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodedoub3d, CONAVGNODEDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -62,9 +58,8 @@ void F77_FUNC(conavgnodedoub3d, CONAVGNODEDOUB3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -NodeDoubleInjection::NodeDoubleInjection( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSTANT_COARSEN") +NodeDoubleInjection::NodeDoubleInjection(): + hier::CoarsenOperator("CONSTANT_COARSEN") { } @@ -79,9 +74,9 @@ NodeDoubleInjection::getOperatorPriority() const } hier::IntVector -NodeDoubleInjection::getStencilWidth() const +NodeDoubleInjection::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -94,43 +89,43 @@ NodeDoubleInjection::coarsen( const hier::IntVector& ratio) const { boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(coarse, fine, coarse_box, ratio); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conavgnodedoub1d, CONAVGNODEDOUB1D) (ifirstc(0), ilastc(0), + for (int d = 0; d < cdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conavgnodedoub1d, CONAVGNODEDOUB1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conavgnodedoub2d, CONAVGNODEDOUB2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conavgnodedoub2d, CONAVGNODEDOUB2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conavgnodedoub3d, CONAVGNODEDOUB3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conavgnodedoub3d, CONAVGNODEDOUB3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -150,4 +145,3 @@ NodeDoubleInjection::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.h index abca3d1b..0a90fefc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleInjection.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class NodeDoubleInjection: /** * Uninteresting default constructor. */ - explicit NodeDoubleInjection( - const tbox::Dimension& dim); + NodeDoubleInjection(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class NodeDoubleInjection: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.C index 79037c80..3c040490 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered double patch data. * ************************************************************************/ - -#ifndef included_pdat_NodeDoubleLinearTimeInterpolateOp_C -#define included_pdat_NodeDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintnodedoub1d, LINTIMEINTNODEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodedoub1d, LINTIMEINTNODEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintnodedoub1d, LINTIMEINTNODEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintnodedoub2d, LINTIMEINTNODEDOUB2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodedoub2d, LINTIMEINTNODEDOUB2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,7 +54,7 @@ void F77_FUNC(lintimeintnodedoub2d, LINTIMEINTNODEDOUB2D) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintnodedoub3d, LINTIMEINTNODEDOUB3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodedoub3d, LINTIMEINTNODEDOUB3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,30 +90,30 @@ NodeDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const NodeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const NodeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); NodeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -136,9 +132,9 @@ NodeDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintnodedoub1d, LINTIMEINTNODEDOUB1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodedoub1d, LINTIMEINTNODEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -148,7 +144,7 @@ NodeDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintnodedoub2d, LINTIMEINTNODEDOUB2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodedoub2d, LINTIMEINTNODEDOUB2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -158,7 +154,7 @@ NodeDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintnodedoub3d, LINTIMEINTNODEDOUB3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodedoub3d, LINTIMEINTNODEDOUB3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -181,4 +177,3 @@ NodeDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h index ead265a4..7bb837d4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered double patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class NodeDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.C index 66a23fdf..5a00dbc7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_NodeFloatInjection_C -#define included_pdat_NodeFloatInjection_C - #include "SAMRAI/pdat/NodeFloatInjection.h" #include @@ -35,20 +31,20 @@ extern "C" { #endif // in concoarsen1d.f: -void F77_FUNC(conavgnodeflot1d, CONAVGNODEFLOT1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeflot1d, CONAVGNODEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in concoarsen2d.f: -void F77_FUNC(conavgnodeflot2d, CONAVGNODEFLOT2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeflot2d, CONAVGNODEFLOT2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in concoarsen3d.f: -void F77_FUNC(conavgnodeflot3d, CONAVGNODEFLOT3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeflot3d, CONAVGNODEFLOT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -62,9 +58,8 @@ void F77_FUNC(conavgnodeflot3d, CONAVGNODEFLOT3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -NodeFloatInjection::NodeFloatInjection( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSTANT_COARSEN") +NodeFloatInjection::NodeFloatInjection(): + hier::CoarsenOperator("CONSTANT_COARSEN") { } @@ -80,9 +75,9 @@ NodeFloatInjection::getOperatorPriority() const } hier::IntVector -NodeFloatInjection::getStencilWidth() const +NodeFloatInjection::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -95,43 +90,43 @@ NodeFloatInjection::coarsen( const hier::IntVector& ratio) const { boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(coarse, fine, coarse_box, ratio); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conavgnodeflot1d, CONAVGNODEFLOT1D) (ifirstc(0), ilastc(0), + for (int d = 0; d < cdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conavgnodeflot1d, CONAVGNODEFLOT1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conavgnodeflot2d, CONAVGNODEFLOT2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conavgnodeflot2d, CONAVGNODEFLOT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conavgnodeflot3d, CONAVGNODEFLOT3D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conavgnodeflot3d, CONAVGNODEFLOT3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -151,4 +146,3 @@ NodeFloatInjection::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.h index faa3178d..82f87e7d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatInjection.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -42,8 +42,7 @@ class NodeFloatInjection: /** * Uninteresting default constructor. */ - explicit NodeFloatInjection( - const tbox::Dimension& dim); + NodeFloatInjection(); /** * Uninteresting virtual destructor. @@ -62,7 +61,8 @@ class NodeFloatInjection: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.C index 58ced5ca..540c92ad 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered float patch data. * ************************************************************************/ - -#ifndef included_pdat_NodeFloatLinearTimeInterpolateOp_C -#define included_pdat_NodeFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintnodefloat1d, LINTIMEINTNODEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodefloat1d, LINTIMEINTNODEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintnodefloat1d, LINTIMEINTNODEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintnodefloat2d, LINTIMEINTNODEFLOAT2D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodefloat2d, LINTIMEINTNODEFLOAT2D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,7 +54,7 @@ void F77_FUNC(lintimeintnodefloat2d, LINTIMEINTNODEFLOAT2D) (const int&, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintnodefloat3d, LINTIMEINTNODEFLOAT3D) (const int&, +void SAMRAI_F77_FUNC(lintimeintnodefloat3d, LINTIMEINTNODEFLOAT3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,30 +90,30 @@ NodeFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const NodeData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const NodeData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); NodeData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -136,9 +132,9 @@ NodeFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintnodefloat1d, LINTIMEINTNODEFLOAT1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodefloat1d, LINTIMEINTNODEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -148,7 +144,7 @@ NodeFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintnodefloat2d, LINTIMEINTNODEFLOAT2D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodefloat2d, LINTIMEINTNODEFLOAT2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -158,7 +154,7 @@ NodeFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(d), dst_dat->getPointer(d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintnodefloat3d, LINTIMEINTNODEFLOAT3D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintnodefloat3d, LINTIMEINTNODEFLOAT3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -181,4 +177,3 @@ NodeFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.h index 6d5479af..38c97e05 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for node-centered float patch data. * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -49,6 +49,18 @@ class NodeFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.C index 9b3dc847..9d68aeae 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.C @@ -3,15 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_NodeGeometry_C -#define included_pdat_NodeGeometry_C - #include "SAMRAI/pdat/NodeGeometry.h" +#include "SAMRAI/pdat/NodeIterator.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" @@ -32,7 +29,7 @@ NodeGeometry::NodeGeometry( d_box(box), d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -66,7 +63,7 @@ NodeGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const NodeGeometry* t_dst = dynamic_cast(&dst_geometry); @@ -74,7 +71,7 @@ NodeGeometry::calculateOverlap( dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { + if ((t_src != 0) && (t_dst != 0)) { over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { @@ -89,7 +86,7 @@ NodeGeometry::calculateOverlap( /* ************************************************************************* * - * Compute the boxes that will be used to contstruct an overlap object + * Compute the boxes that will be used to construct an overlap object * ************************************************************************* */ @@ -107,7 +104,7 @@ NodeGeometry::computeDestinationBoxes( #ifdef DEBUG_CHECK_DIM_ASSERTIONS const hier::IntVector& src_offset(transformation.getOffset()); #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); // Translate the source box and grow the destination box by the ghost cells @@ -134,9 +131,9 @@ NodeGeometry::computeDestinationBoxes( } } - if (dst_restrict_boxes.size() && dst_boxes.size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes.empty()) { hier::BoxContainer node_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { node_restrict_boxes.pushBack(toNodeBox(*b)); } @@ -158,7 +155,8 @@ NodeGeometry::setUpOverlap( { hier::BoxContainer dst_boxes; - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box node_box(NodeGeometry::toNodeBox(*b)); dst_boxes.pushBack(node_box); } @@ -187,9 +185,9 @@ NodeGeometry::transform( } if (!box.empty()) { - box.upper() -= hier::IntVector::getOne(box.getDim()); + box.setUpper(box.upper() - hier::IntVector::getOne(box.getDim())); transformation.transform(box); - box.upper() += hier::IntVector::getOne(box.getDim()); + box.setUpper(box.upper() + hier::IntVector::getOne(box.getDim())); } } @@ -215,12 +213,25 @@ NodeGeometry::transform( const hier::Transformation::RotationIdentifier& rotation = transformation.getRotation(); - if (dim.getValue() == 2) { + if (dim.getValue() == 1) { + const int rotation_num = static_cast(rotation); + if (rotation_num > 1) { + TBOX_ERROR("NodeGeometry::transform invalid 1D RotationIdentifier."); + } + + if (rotation_num) { + NodeIndex tmp_index(index); + index(0) = -tmp_index(0); + } + } else if (dim.getValue() == 2) { const int rotation_num = static_cast(rotation); + if (rotation_num > 3) { + TBOX_ERROR("NodeGeometry::transform invalid 2D RotationIdentifier."); + } if (rotation_num) { NodeIndex tmp_index(dim); - for (int r = 0; r < rotation_num; r++) { + for (int r = 0; r < rotation_num; ++r) { tmp_index = index; index(0) = tmp_index(1); index(1) = -tmp_index(0); @@ -359,13 +370,26 @@ NodeGeometry::rotateAboutAxis(NodeIndex& index, const int b = (axis + 2) % dim.getValue(); NodeIndex tmp_index(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_index = index; index(a) = tmp_index(b); index(b) = -tmp_index(a); } } +NodeIterator +NodeGeometry::begin( + const hier::Box& box) +{ + return NodeIterator(box, true); +} + +NodeIterator +NodeGeometry::end( + const hier::Box& box) +{ + return NodeIterator(box, false); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.h index d7174212..4b3bfc43 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -20,23 +20,25 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include -#include +#include "boost/make_shared.hpp" +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { +class NodeIterator; + /*! * Class NodeGeometry manages the mapping between the AMR index space * and the node-centered geometry index space. It is a subclass of * hier::BoxGeometry and it computes intersections between node- * centered box geometries for communication operations. * - * See header file for NodeData class for a more detailed + * See header file for NodeData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::NodeOverlap + * @see NodeOverlap */ class NodeGeometry:public hier::BoxGeometry @@ -50,7 +52,7 @@ class NodeGeometry:public hier::BoxGeometry /*! * @brief Convert an AMR index box space box into a node geometry box. * A node geometry box is extends the given AMR index box space box - * by one in upper dimension for each coordinate direction. + * by one at upper end for each coordinate direction. */ static hier::Box toNodeBox( @@ -76,6 +78,14 @@ class NodeGeometry:public hier::BoxGeometry hier::Box& box, const hier::Transformation& transformation); + static NodeIterator + begin( + const hier::Box& box); + + static NodeIterator + end( + const hier::Box& box); + /*! * @brief Transform a NodeIndex. * @@ -93,6 +103,9 @@ class NodeGeometry:public hier::BoxGeometry /*! * @brief Construct the node geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ NodeGeometry( const hier::Box& box, @@ -106,6 +119,8 @@ class NodeGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in node-centered index space between * the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -122,6 +137,8 @@ class NodeGeometry:public hier::BoxGeometry * @brief Compute the node-centered destination boxes that represent * the overlap between the source box geometry and the destination * box geometry. + * + * @pre src_mask.getDim() == transformation.getOffset.getDim() */ void computeDestinationBoxes( @@ -199,7 +216,7 @@ class NodeGeometry:public hier::BoxGeometry NodeGeometry( const NodeGeometry&); // not implemented - void + NodeGeometry& operator = ( const NodeGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.C index e5e04039..868de771 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.C @@ -3,22 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_NodeIndex_C -#define included_pdat_NodeIndex_C - #include "SAMRAI/pdat/NodeIndex.h" namespace SAMRAI { namespace pdat { -std::vector NodeIndex::s_offsets[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; -bool NodeIndex::s_offsets_are_set[tbox::Dimension::MAXIMUM_DIMENSION_VALUE] = { false }; +std::vector NodeIndex::s_offsets[SAMRAI::MAX_DIM_VAL]; +bool NodeIndex::s_offsets_are_set[SAMRAI::MAX_DIM_VAL] = { false }; NodeIndex::NodeIndex( const tbox::Dimension& dim): @@ -32,11 +27,11 @@ NodeIndex::NodeIndex( const Corner corner): hier::Index(rhs.getDim()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(* this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(* this, rhs); setOffsets(); - hier::IntVector::operator = ( - rhs + s_offsets[getDim().getValue() - 1][(int)corner]); + hier::Index::operator = ( + rhs + s_offsets[getDim().getValue() - 1][static_cast(corner)]); } NodeIndex::NodeIndex( @@ -44,15 +39,15 @@ NodeIndex::NodeIndex( const hier::IntVector& corner): hier::Index(rhs.getDim()) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); #ifdef DEBUG_CHECK_ASSERTIONS - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { TBOX_ASSERT(corner(i) == 0 || corner(i) == 1); } #endif setOffsets(); - hier::IntVector::operator = ( + hier::Index::operator = ( rhs + corner); } @@ -60,7 +55,7 @@ NodeIndex::NodeIndex( const NodeIndex& rhs): hier::Index(rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); setOffsets(); } @@ -76,13 +71,13 @@ NodeIndex::setOffsets() int dim_index = dim.getValue() - 1; if (!s_offsets_are_set[dim_index]) { s_offsets[dim_index] = std::vector( - 2 << tbox::Dimension::MAXIMUM_DIMENSION_VALUE, + 2 << SAMRAI::MAX_DIM_VAL, hier::IntVector(dim)); - for (int i = 0; i < (1 << dim.getValue()); i++) { + for (int i = 0; i < (1 << dim.getValue()); ++i) { hier::IntVector offset(dim, 0); offset(0) = i % 2; - for (int j = 1; j < dim.getValue(); j++) { + for (int j = 1; j < dim.getValue(); ++j) { offset(j) = (i / (1 << j)) % 2; } s_offsets[dim_index][i] = offset; @@ -93,4 +88,3 @@ NodeIndex::setOffsets() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.h index 40280191..5e80df45 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIndex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -26,13 +26,13 @@ namespace pdat { * vector for node centered variables. Given a hier::Box in the AMR abstract * index space, the index space for a node-centered variable runs from the * lower corner of the box to the upper corner of the box plus one in each - * dimension. See the node box geometry class for more information about + * direction. See the node box geometry class for more information about * the mapping between the AMR index space and the node indices. * * @see hier::Index - * @see pdat::NodeData - * @see pdat::NodeGeometry - * @see pdat::NodeIterator + * @see NodeData + * @see NodeGeometry + * @see NodeIterator */ class NodeIndex:public hier::Index @@ -64,18 +64,21 @@ class NodeIndex:public hier::Index * The Corner enumerated type is only defined for 3D or lower, so use * the next constructor with an hier::IntVector argument when using higher * dimensions. + * + * @pre getDim() == rhs.getDim() */ NodeIndex( const hier::Index& rhs, const Corner corner); /** - * Construct a node index from a regular index and an hier::IntVector. The - * hier::IntVector is binary--an assertion failure will result if it contains - * any values other than 0 or 1. For each dimension, if the hier::IntVector - * contains a 0, the node index will represent a lower bound in that - * dimensional direction, and if 1 will represent an upper bound in that - * direction. + * Construct a node index from a regular index and an hier::IntVector. For + * each direction, if the hier::IntVector contains a 0, the node index will + * represent a lower bound in that direction, and if 1 will represent an + * upper bound in that direction. + * + * @pre getDim() == rhs.getDim() + * @pre for each element of corner, e, e == 0 || e == 1 */ NodeIndex( const hier::Index& rhs, @@ -83,18 +86,22 @@ class NodeIndex:public hier::Index /** * The copy constructor creates a node index equal to the argument. + * + * @pre getDim() == rhs.getDim() */ NodeIndex( const NodeIndex& rhs); /** * The assignment operator sets the node index equal to the argument. + * + * @pre getDim() == rhs.getDim() */ NodeIndex& operator = ( const NodeIndex& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator = (rhs); return *this; } @@ -106,24 +113,28 @@ class NodeIndex:public hier::Index /** * Plus-equals operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex& operator += ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator += (rhs); return *this; } /** * Plus operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex operator + ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); NodeIndex tmp = *this; tmp += rhs; return tmp; @@ -154,24 +165,28 @@ class NodeIndex:public hier::Index /** * Minus-equals operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex& operator -= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator -= (rhs); return *this; } /** * Minus operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex operator - ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); NodeIndex tmp = *this; tmp -= rhs; return tmp; @@ -202,24 +217,28 @@ class NodeIndex:public hier::Index /** * Times-equals operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex& operator *= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator *= (rhs); return *this; } /** * Times operator for a node index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ NodeIndex operator * ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); NodeIndex tmp = *this; tmp *= rhs; return tmp; @@ -251,24 +270,28 @@ class NodeIndex:public hier::Index /** * Returns true if two node index objects are equal. * All components must be the same for equality. + * + * @pre getDim() == rhs.getDim() */ bool operator == ( const NodeIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator == (rhs); } /** * Returns true if two node index objects are not equal. * Any of the components may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const NodeIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator != (rhs); } @@ -279,9 +302,8 @@ class NodeIndex:public hier::Index void setOffsets(); - static std::vector s_offsets[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; - static bool s_offsets_are_set[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static std::vector s_offsets[SAMRAI::MAX_DIM_VAL]; + static bool s_offsets_are_set[SAMRAI::MAX_DIM_VAL]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.C index 4b8fbb24..a2bdf483 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered integer data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_NodeIntegerInjection_C -#define included_pdat_NodeIntegerInjection_C - #include "SAMRAI/pdat/NodeIntegerInjection.h" #include @@ -35,20 +31,20 @@ extern "C" { #endif // in concoarsen1d.f: -void F77_FUNC(conavgnodeintg1d, CONAVGNODEINTG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeintg1d, CONAVGNODEINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in concoarsen2d.f: -void F77_FUNC(conavgnodeintg2d, CONAVGNODEINTG2D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeintg2d, CONAVGNODEINTG2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in concoarsen3d.f: -void F77_FUNC(conavgnodeintg3d, CONAVGNODEINTG3D) (const int&, const int&, +void SAMRAI_F77_FUNC(conavgnodeintg3d, CONAVGNODEINTG3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -62,9 +58,8 @@ void F77_FUNC(conavgnodeintg3d, CONAVGNODEINTG3D) (const int&, const int&, namespace SAMRAI { namespace pdat { -NodeIntegerInjection::NodeIntegerInjection( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSTANT_COARSEN") +NodeIntegerInjection::NodeIntegerInjection(): + hier::CoarsenOperator("CONSTANT_COARSEN") { } @@ -79,9 +74,9 @@ NodeIntegerInjection::getOperatorPriority() const } hier::IntVector -NodeIntegerInjection::getStencilWidth() const +NodeIntegerInjection::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -94,43 +89,43 @@ NodeIntegerInjection::coarsen( const hier::IntVector& ratio) const { boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, coarse, fine, coarse_box, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY4(coarse, fine, coarse_box, ratio); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cdata->getGhostBox().lower(); + const hier::Index& cihi = cdata->getGhostBox().upper(); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(conavgnodeintg1d, CONAVGNODEINTG1D) (ifirstc(0), ilastc(0), + for (int d = 0; d < cdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conavgnodeintg1d, CONAVGNODEINTG1D) (ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(conavgnodeintg2d, CONAVGNODEINTG2D) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conavgnodeintg2d, CONAVGNODEINTG2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), &ratio[0], fdata->getPointer(d), cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(conavgnodeintg3d, conavgnodeintg3d) (ifirstc(0), ifirstc(1), + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conavgnodeintg3d, CONAVGNODEINTG3D) (ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -150,4 +145,3 @@ NodeIntegerInjection::coarsen( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.h index f9c43ae7..f4b476cf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIntegerInjection.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant averaging operator for node-centered integer data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/CoarsenOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class NodeIntegerInjection: /** * Uninteresting default constructor. */ - explicit NodeIntegerInjection( - const tbox::Dimension& dim); + NodeIntegerInjection(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class NodeIntegerInjection: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.C index aecf0c32..2c0a2d9c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for node centered patch data types * ************************************************************************/ - -#ifndef included_pdat_NodeIterator_C -#define included_pdat_NodeIterator_C - #include "SAMRAI/pdat/NodeIterator.h" namespace SAMRAI { @@ -23,8 +19,8 @@ NodeIterator::NodeIterator( d_box(NodeGeometry::toNodeBox(box)) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -42,11 +38,11 @@ NodeIterator::~NodeIterator() NodeIterator& NodeIterator::operator ++ () { - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -59,11 +55,11 @@ NodeIterator::operator ++ ( int) { NodeIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -73,4 +69,3 @@ NodeIterator::operator ++ ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.h index 747f1856..baacb5bb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for node centered patch data types * ************************************************************************/ @@ -37,22 +37,14 @@ namespace pdat { * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see pdat::NodeData - * @see pdat::NodeGeometry - * @see pdat::NodeIndex + * @see NodeData + * @see NodeGeometry + * @see NodeIndex */ class NodeIterator { public: - /** - * Constructor for the node iterator. The iterator will enumerate - * the indices in the argument box. - */ - explicit NodeIterator( - const hier::Box& box, - bool begin); - /** * Copy constructor for the node iterator */ @@ -89,7 +81,7 @@ class NodeIterator * Extract a pointer to the node index corresponding to the iterator * position in the box. */ - const NodeIndex* + const NodeIndex * operator -> () const { return &d_index; @@ -115,6 +107,8 @@ class NodeIterator operator == ( const NodeIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index == iterator.d_index; } @@ -125,10 +119,29 @@ class NodeIterator operator != ( const NodeIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index != iterator.d_index; } private: + friend NodeIterator + NodeGeometry::begin( + const hier::Box& box); + friend NodeIterator + NodeGeometry::end( + const hier::Box& box); + /** + * Constructor for the node iterator. The iterator will enumerate + * the indices in the argument box. + */ + NodeIterator( + const hier::Box& box, + bool begin); + + // Unimplemented default constructor. + NodeIterator(); + NodeIndex d_index; hier::Box d_box; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.C index 7d07b52d..58756bd2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_NodeOverlap_C -#define included_pdat_NodeOverlap_C - #include "SAMRAI/pdat/NodeOverlap.h" namespace SAMRAI { @@ -19,7 +15,7 @@ namespace pdat { NodeOverlap::NodeOverlap( const hier::BoxContainer& boxes, const hier::Transformation& transformation): - d_is_overlap_empty(boxes.isEmpty()), + d_is_overlap_empty(boxes.empty()), d_transformation(transformation), d_dst_boxes(boxes) { @@ -41,6 +37,23 @@ NodeOverlap::getDestinationBoxContainer() const return d_dst_boxes; } +void +NodeOverlap::getSourceBoxContainer(hier::BoxContainer& src_boxes) const +{ + TBOX_ASSERT(src_boxes.empty()); + + src_boxes = d_dst_boxes; + if (!src_boxes.empty()) { + const tbox::Dimension& dim = src_boxes.front().getDim(); + for (hier::BoxContainer::iterator bi = src_boxes.begin(); + bi != src_boxes.end(); ++bi) { + bi->setUpper(bi->upper() - hier::IntVector::getOne(dim)); + d_transformation.inverseTransform(*bi); + bi->setUpper(bi->upper() + hier::IntVector::getOne(dim)); + } + } +} + const hier::IntVector& NodeOverlap::getSourceOffset() const { @@ -55,4 +68,3 @@ NodeOverlap::getTransformation() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.h index 5e94e12a..a7a1b3dd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -30,7 +30,7 @@ namespace pdat { * with node centered geometry. * * @see hier::BoxOverlap - * @see pdat::NodeOverlap + * @see NodeOverlap */ class NodeOverlap:public hier::BoxOverlap @@ -63,13 +63,25 @@ class NodeOverlap:public hier::BoxOverlap * Return the list of boxes (in node centered index space) that * constitute the intersection. The boxes are given in the * destination coordinate space and must be shifted by - * -(getSourceOffset()) to lie in the source index space. This - * method over-rides the virtual function in the - * hier::BoxOverlap base class. + * -(getSourceOffset()) to lie in the source index space. */ virtual const hier::BoxContainer& getDestinationBoxContainer() const; + /*! + * @brief Get a BoxContainer representing the source boxes of the overlap. + * + * The src_boxes container will be filled with the node-centered source + * boxes of the overlap in the source coordinate space. + * + * @param[out] src_boxes + * + * @pre src_boxes.empty() + */ + virtual void + getSourceBoxContainer( + hier::BoxContainer& src_boxes) const; + /** * Return the offset between the destination and source index spaces. * The destination index space is the source index spaced shifted diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.C index a0c58556..80c6f1b6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/NodeDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -53,37 +53,13 @@ NodeVariable::~NodeVariable() template int NodeVariable::getDepth() const { - boost::shared_ptr > factory(getPatchDataFactory()); + boost::shared_ptr > factory( + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -NodeVariable::NodeVariable( - const NodeVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void NodeVariable::operator = ( - const NodeVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.h index 66e55681..bc916d2a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/NodeVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -22,16 +22,16 @@ namespace SAMRAI { namespace pdat { /*! - * Class NodeVariable is a templated variable class used to define + * Class NodeVariable is a templated variable class used to define * node-centered quantities on an AMR mesh. It is a subclass of * hier::Variable and is templated on the type of the underlying data * (e.g., double, int, bool, etc.). * - * See header file for NodeData class for a more detailed + * See header file for NodeData class for a more detailed * description of the data layout. * - * @see pdat::NodeData - * @see pdat::NodeDataFactory + * @see NodeData + * @see NodeDataFactory * @see hier::Variable */ @@ -86,11 +86,14 @@ class NodeVariable:public hier::Variable private: bool d_fine_boundary_represents_var; + // Unimplemented copy constructor NodeVariable( - const NodeVariable&); // not implemented - void + const NodeVariable&); + + // Unimplemented assignment operator + NodeVariable& operator = ( - const NodeVariable&); // not implemented + const NodeVariable&); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.C index ed94eec7..feebace9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outeredge centered patch data type * ************************************************************************/ @@ -46,9 +46,10 @@ OuteredgeData::OuteredgeData( { TBOX_ASSERT(depth > 0); - for (int axis = 0; axis < getDim().getValue(); ++axis) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { - for (int face_normal = 0; face_normal < getDim().getValue(); ++face_normal) { + for (tbox::Dimension::dir_t face_normal = 0; face_normal < getDim().getValue(); + ++face_normal) { if (face_normal != axis) { @@ -60,13 +61,8 @@ OuteredgeData::OuteredgeData( face_normal, side); - if (!oedge_data_box.empty()) { - d_data[axis][face_normal][side]. - initializeArray(oedge_data_box, depth); - } else { - d_data[axis][face_normal][side]. - invalidateArray(getDim()); - } + d_data[axis][face_normal][side].reset( + new ArrayData(oedge_data_box, depth)); } // iterate over lower/upper sides @@ -83,32 +79,6 @@ OuteredgeData::~OuteredgeData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -OuteredgeData::OuteredgeData( - const OuteredgeData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -OuteredgeData::operator = ( - const OuteredgeData& foo) -{ - NULL_USE(foo); -} - template int OuteredgeData::getDepth() const @@ -125,11 +95,11 @@ OuteredgeData::dataExists( TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); - return d_data[axis][face_normal][0].isInitialized(); + return d_data[axis][face_normal][0]->isInitialized(); } template -TYPE* +TYPE * OuteredgeData::getPointer( int axis, int face_normal, @@ -141,11 +111,11 @@ OuteredgeData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][face_normal][side].getPointer(depth); + return d_data[axis][face_normal][side]->getPointer(depth); } template -const TYPE* +const TYPE * OuteredgeData::getPointer( int axis, int face_normal, @@ -157,7 +127,7 @@ OuteredgeData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][face_normal][side].getPointer(depth); + return d_data[axis][face_normal][side]->getPointer(depth); } template @@ -166,7 +136,7 @@ OuteredgeData::operator () ( const EdgeIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -179,8 +149,8 @@ OuteredgeData::operator () ( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].getBox().contains(i)) { - return d_data[axis][face_normal][side](i, depth); + if (d_data[axis][face_normal][side]->getBox().contains(i)) { + return (*(d_data[axis][face_normal][side]))(i, depth); } } // iterate over lower/upper sides @@ -191,7 +161,7 @@ OuteredgeData::operator () ( TBOX_ERROR("Attempt to access OuteredgeData value with bad index" " edge index " << i << " with axis = " << axis << std::endl); - return d_data[0][0][0](i, depth); + return (*(d_data[0][0][0]))(i, depth); } template @@ -200,7 +170,7 @@ OuteredgeData::operator () ( const EdgeIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -213,8 +183,8 @@ OuteredgeData::operator () ( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].getBox().contains(i)) { - return d_data[axis][face_normal][side](i, depth); + if (d_data[axis][face_normal][side]->getBox().contains(i)) { + return (*(d_data[axis][face_normal][side]))(i, depth); } } // iterate over lower/upper sides @@ -225,7 +195,7 @@ OuteredgeData::operator () ( TBOX_ERROR("Attempt to access OuteredgeData value with bad index" " edge index " << i << " with axis = " << axis << std::endl); - return d_data[0][0][0](i, depth); + return (*(d_data[0][0][0]))(i, depth); } template @@ -239,7 +209,7 @@ OuteredgeData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[axis][face_normal][side]; + return *(d_data[axis][face_normal][side]); } template @@ -253,7 +223,7 @@ OuteredgeData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[axis][face_normal][side]; + return *(d_data[axis][face_normal][side]); } /* @@ -270,16 +240,16 @@ void OuteredgeData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const EdgeData * const t_edge_src = dynamic_cast *>(&src); const OuteredgeData * const t_oedge_src = dynamic_cast *>(&src); - if (t_edge_src != NULL) { + if (t_edge_src != 0) { copyFromEdge(*t_edge_src); - } else if (t_oedge_src != NULL) { + } else if (t_oedge_src != 0) { copyFromOuteredge(*t_oedge_src); } else { TBOX_ERROR("OuteredgeData::copy error!\n" @@ -295,16 +265,14 @@ void OuteredgeData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - EdgeData* t_edge_dst = - dynamic_cast *>(&dst); - OuteredgeData* t_oedge_dst = - dynamic_cast *>(&dst); + EdgeData* t_edge_dst = dynamic_cast *>(&dst); + OuteredgeData* t_oedge_dst = dynamic_cast *>(&dst); - if (t_edge_dst != NULL) { + if (t_edge_dst != 0) { copyToEdge(*t_edge_dst); - } else if (t_oedge_dst != NULL) { + } else if (t_oedge_dst != 0) { copyToOuteredge(*t_oedge_dst); } else { TBOX_ERROR("OuteredgeData::copy2 error!\n" @@ -329,21 +297,20 @@ OuteredgeData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const EdgeData* t_edge_src = dynamic_cast *>(&src); const OuteredgeData* t_oedge_src = dynamic_cast *>(&src); - if (t_edge_src != NULL) { + if (t_edge_src != 0) { copyFromEdge(*t_edge_src, *t_overlap); - } else if (t_oedge_src != NULL) { + } else if (t_oedge_src != 0) { copyFromOuteredge(*t_oedge_src, *t_overlap); } else { TBOX_ERROR("OuternodeData::copy error!\n" @@ -360,21 +327,18 @@ OuteredgeData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - EdgeData* t_edge_dst = - dynamic_cast *>(&dst); - OuteredgeData* t_oedge_dst = - dynamic_cast *>(&dst); + EdgeData* t_edge_dst = dynamic_cast *>(&dst); + OuteredgeData* t_oedge_dst = dynamic_cast *>(&dst); - if (t_edge_dst != NULL) { + if (t_edge_dst != 0) { copyToEdge(*t_edge_dst, *t_overlap); - } else if (t_oedge_dst != NULL) { + } else if (t_oedge_dst != 0) { copyToOuteredge(*t_oedge_dst, *t_overlap); } else { TBOX_ERROR("OuternodeData::copy2 error!\n" @@ -401,7 +365,7 @@ OuteredgeData::copyDepth( const EdgeData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -414,18 +378,12 @@ OuteredgeData::copyDepth( for (int side = 0; side < 2; ++side) { ArrayData& dst_oedge_array = - d_data[axis][face_normal][side]; - - /* - * Some d_data entries are not valid, don't try to copy - * them. - */ - if (dst_oedge_array.getDim().isValid()) { - dst_oedge_array.copyDepth(dst_depth, - src_edge_array, - src_depth, - dst_oedge_array.getBox()); - } + *(d_data[axis][face_normal][side]); + + dst_oedge_array.copyDepth(dst_depth, + src_edge_array, + src_depth, + dst_oedge_array.getBox()); } // iterate over lower/upper sides @@ -453,7 +411,7 @@ OuteredgeData::copyDepth2( EdgeData& dst, int src_depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -466,7 +424,7 @@ OuteredgeData::copyDepth2( for (int side = 0; side < 2; ++side) { const ArrayData& src_oedge_array = - d_data[axis][face_normal][side]; + *(d_data[axis][face_normal][side]); dst_edge_array.copyDepth(dst_depth, src_oedge_array, @@ -497,15 +455,16 @@ OuteredgeData::sum( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const OuteredgeData* t_oedge_src = - dynamic_cast *>(&src); + CPP_CAST *>(&src); + + TBOX_ASSERT(t_oedge_src != 0); // NOTE: We assume this operation is only needed to // copy and add data to another outeredge data @@ -513,67 +472,59 @@ OuteredgeData::sum( // data or other flavors of the copy operation, we // should refactor the routine similar to the way // the regular copy operations are implemented. - if (t_oedge_src == NULL) { - TBOX_ERROR("OuteredgeData::sum error!\n" - << "Can copy and add only from OuteredgeData " - << "of the same getDim() and TYPE."); - } else { - - const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - - for (int axis = 0; axis < getDim().getValue(); ++axis) { + const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - const hier::BoxContainer& box_list = - t_overlap->getDestinationBoxContainer(axis); + for (int axis = 0; axis < getDim().getValue(); ++axis) { - for (int src_face_normal = 0; - src_face_normal < getDim().getValue(); - ++src_face_normal) { + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(axis); - if (src_face_normal != axis) { + for (int src_face_normal = 0; + src_face_normal < getDim().getValue(); + ++src_face_normal) { - for (int src_side = 0; src_side < 2; ++src_side) { + if (src_face_normal != axis) { - if (t_oedge_src->d_data[axis][src_face_normal][src_side]. - isInitialized()) { + for (int src_side = 0; src_side < 2; ++src_side) { - const ArrayData& src_array = - t_oedge_src->d_data[axis][src_face_normal][src_side]; + if (t_oedge_src->d_data[axis][src_face_normal][src_side]-> + isInitialized()) { - for (int dst_face_normal = 0; - dst_face_normal < getDim().getValue(); ++dst_face_normal) { + const ArrayData& src_array = + *(t_oedge_src->d_data[axis][src_face_normal][src_side]); - if (dst_face_normal != axis) { + for (int dst_face_normal = 0; + dst_face_normal < getDim().getValue(); ++dst_face_normal) { - for (int dst_side = 0; dst_side < 2; ++dst_side) { + if (dst_face_normal != axis) { - if (d_data[axis][dst_face_normal][dst_side]. - isInitialized()) { + for (int dst_side = 0; dst_side < 2; ++dst_side) { - d_data[axis][dst_face_normal][dst_side]. - sum(src_array, - box_list, - src_offset); + if (d_data[axis][dst_face_normal][dst_side]-> + isInitialized()) { - } // if dst data array is initialized + d_data[axis][dst_face_normal][dst_side]-> + sum(src_array, + box_list, + src_offset); - } // iterate over dst lower/upper sides + } // if dst data array is initialized - } // dst data is undefined when axis == face_normal + } // iterate over dst lower/upper sides - } // iterate over dst face normal directions + } // dst data is undefined when axis == face_normal - } // if src data array is initialized + } // iterate over dst face normal directions - } // iterate over src lower/upper sides + } // if src data array is initialized - } // src data is undefined when axis == face_normal + } // iterate over src lower/upper sides - } // iterate over src face normal directions + } // src data is undefined when axis == face_normal - } // iterate over axis directions + } // iterate over src face normal directions - } // else t_oedge_src != NULL + } // iterate over axis directions } @@ -594,33 +545,33 @@ OuteredgeData::canEstimateStreamSizeFromBox() const } template -int +size_t OuteredgeData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - int size = 0; + size_t size = 0; const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int axis = 0; axis < getDim().getValue(); ++axis) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { const hier::BoxContainer& boxlist = t_overlap->getDestinationBoxContainer(axis); - for (int face_normal = 0; face_normal < getDim().getValue(); ++face_normal) { + for (tbox::Dimension::dir_t face_normal = 0; face_normal < getDim().getValue(); + ++face_normal) { if (face_normal != axis) { for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].isInitialized()) { + if (d_data[axis][face_normal][side]->isInitialized()) { - size += d_data[axis][face_normal][side]. + size += d_data[axis][face_normal][side]-> getDataStreamSize(boxlist, src_offset); } // if data arrays is initialized @@ -651,10 +602,9 @@ OuteredgeData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); @@ -663,7 +613,7 @@ OuteredgeData::packStream( const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { const hier::Box src_box = hier::Box::shift(*dst_box, @@ -676,11 +626,11 @@ OuteredgeData::packStream( for (int side = 0; side < 2; ++side) { const hier::Box intersection = - src_box * d_data[axis][face_normal][side].getBox(); + src_box * d_data[axis][face_normal][side]->getBox(); if (!intersection.empty()) { - d_data[axis][face_normal][side]. + d_data[axis][face_normal][side]-> packStream(stream, hier::Box::shift(intersection, src_offset), @@ -706,10 +656,9 @@ OuteredgeData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); @@ -718,7 +667,7 @@ OuteredgeData::unpackStream( const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { for (int face_normal = 0; face_normal < getDim().getValue(); ++face_normal) { @@ -728,11 +677,11 @@ OuteredgeData::unpackStream( for (int side = 0; side < 2; ++side) { const hier::Box intersection = - (*dst_box) * d_data[axis][face_normal][side].getBox(); + (*dst_box) * d_data[axis][face_normal][side]->getBox(); if (!intersection.empty()) { - d_data[axis][face_normal][side].unpackStream(stream, + d_data[axis][face_normal][side]->unpackStream(stream, intersection, src_offset); @@ -765,10 +714,9 @@ OuteredgeData::unpackStreamAndSum( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const EdgeOverlap* t_overlap = - dynamic_cast(&overlap); + const EdgeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); @@ -777,7 +725,7 @@ OuteredgeData::unpackStreamAndSum( const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { for (int face_normal = 0; face_normal < getDim().getValue(); ++face_normal) { @@ -787,11 +735,11 @@ OuteredgeData::unpackStreamAndSum( for (int side = 0; side < 2; ++side) { const hier::Box intersection = - (*dst_box) * d_data[axis][face_normal][side].getBox(); + (*dst_box) * d_data[axis][face_normal][side]->getBox(); if (!intersection.empty()) { - d_data[axis][face_normal][side]. + d_data[axis][face_normal][side]-> unpackStreamAndSum(stream, intersection, src_offset); @@ -829,9 +777,11 @@ OuteredgeData::getSizeOfData( size_t size = 0; - for (int axis = 0; axis < box.getDim().getValue(); ++axis) { + for (tbox::Dimension::dir_t axis = 0; axis < box.getDim().getValue(); ++axis) { - for (int face_normal = 0; face_normal < box.getDim().getValue(); ++face_normal) { + for (tbox::Dimension::dir_t face_normal = 0; + face_normal < box.getDim().getValue(); + ++face_normal) { if (face_normal != axis) { @@ -861,7 +811,7 @@ OuteredgeData::getSizeOfData( ************************************************************************* * * Compute the box of valid edge indices given values of - * dimension and side designating the set of data indices. + * direction and side designating the set of data indices. * ************************************************************************* */ @@ -903,8 +853,8 @@ OuteredgeData::fill( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].isInitialized()) { - d_data[axis][face_normal][side].fill(t, d); + if (d_data[axis][face_normal][side]->isInitialized()) { + d_data[axis][face_normal][side]->fill(t, d); } } // iterate over lower/upper sides @@ -924,7 +874,7 @@ OuteredgeData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -937,8 +887,8 @@ OuteredgeData::fill( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].isInitialized()) { - d_data[axis][face_normal][side].fill(t, databox, d); + if (d_data[axis][face_normal][side]->isInitialized()) { + d_data[axis][face_normal][side]->fill(t, databox, d); } } // iterate over lower/upper sides @@ -965,8 +915,8 @@ OuteredgeData::fillAll( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].isInitialized()) { - d_data[axis][face_normal][side].fillAll(t); + if (d_data[axis][face_normal][side]->isInitialized()) { + d_data[axis][face_normal][side]->fillAll(t); } } // iterate over lower/upper sides @@ -985,7 +935,7 @@ OuteredgeData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -997,8 +947,8 @@ OuteredgeData::fillAll( for (int side = 0; side < 2; ++side) { - if (d_data[axis][face_normal][side].isInitialized()) { - d_data[axis][face_normal][side].fillAll(t, databox); + if (d_data[axis][face_normal][side]->isInitialized()) { + d_data[axis][face_normal][side]->fillAll(t, databox); } } // iterate over lower/upper sides @@ -1025,7 +975,7 @@ void OuteredgeData::copyFromEdge( const EdgeData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -1038,7 +988,7 @@ OuteredgeData::copyFromEdge( for (int side = 0; side < 2; ++side) { ArrayData& dst_oedge_array = - d_data[axis][face_normal][side]; + *(d_data[axis][face_normal][side]); dst_oedge_array.copy(src_edge_array, dst_oedge_array.getBox()); @@ -1058,7 +1008,7 @@ void OuteredgeData::copyToEdge( EdgeData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -1071,7 +1021,7 @@ OuteredgeData::copyToEdge( for (int side = 0; side < 2; ++side) { const ArrayData& src_oedge_array = - d_data[axis][face_normal][side]; + *(d_data[axis][face_normal][side]); dst_edge_array.copy(src_oedge_array, src_oedge_array.getBox()); @@ -1101,7 +1051,7 @@ OuteredgeData::copyFromEdge( const EdgeData& src, const EdgeOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const hier::IntVector& src_offset = overlap.getSourceOffset(); @@ -1117,7 +1067,7 @@ OuteredgeData::copyFromEdge( for (int side = 0; side < 2; ++side) { ArrayData& dst_oedge_array = - d_data[axis][face_normal][side]; + *(d_data[axis][face_normal][side]); dst_oedge_array.copy(src_edge_array, box_list, @@ -1139,7 +1089,7 @@ OuteredgeData::copyToEdge( EdgeData& dst, const EdgeOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); const hier::IntVector& src_offset = overlap.getSourceOffset(); @@ -1155,7 +1105,7 @@ OuteredgeData::copyToEdge( for (int side = 0; side < 2; ++side) { const ArrayData& src_oedge_array = - d_data[axis][face_normal][side]; + *(d_data[axis][face_normal][side]); dst_edge_array.copy(src_oedge_array, box_list, @@ -1176,7 +1126,7 @@ void OuteredgeData::copyFromOuteredge( const OuteredgeData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -1189,7 +1139,7 @@ OuteredgeData::copyFromOuteredge( for (int src_side = 0; src_side < 2; ++src_side) { const ArrayData& src_oedge_array = - src.d_data[axis][src_face_normal][src_side]; + *(src.d_data[axis][src_face_normal][src_side]); for (int dst_face_normal = 0; dst_face_normal < getDim().getValue(); @@ -1200,7 +1150,7 @@ OuteredgeData::copyFromOuteredge( for (int dst_side = 0; dst_side < 2; ++dst_side) { ArrayData& dst_oedge_array = - d_data[axis][dst_face_normal][dst_side]; + *(d_data[axis][dst_face_normal][dst_side]); dst_oedge_array.copy(src_oedge_array, dst_oedge_array.getBox()); @@ -1227,7 +1177,7 @@ OuteredgeData::copyFromOuteredge( const OuteredgeData& src, const EdgeOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const hier::IntVector& src_offset = overlap.getSourceOffset(); @@ -1245,7 +1195,7 @@ OuteredgeData::copyFromOuteredge( for (int src_side = 0; src_side < 2; ++src_side) { const ArrayData& src_oedge_array = - src.d_data[axis][src_face_normal][src_side]; + *(src.d_data[axis][src_face_normal][src_side]); for (int dst_face_normal = 0; dst_face_normal < getDim().getValue(); @@ -1256,7 +1206,7 @@ OuteredgeData::copyFromOuteredge( for (int dst_side = 0; dst_side < 2; ++dst_side) { ArrayData& dst_oedge_array = - d_data[axis][dst_face_normal][dst_side]; + *(d_data[axis][dst_face_normal][dst_side]); dst_oedge_array.copy(src_oedge_array, box_list, @@ -1283,7 +1233,7 @@ void OuteredgeData::copyToOuteredge( OuteredgeData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copyFromOuteredge(*this); } @@ -1294,7 +1244,7 @@ OuteredgeData::copyToOuteredge( OuteredgeData& dst, const EdgeOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copyFromOuteredge(*this, overlap); } @@ -1314,9 +1264,9 @@ OuteredgeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { print(box, d, os, prec); } } @@ -1329,7 +1279,7 @@ OuteredgeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); for (int axis = 0; axis < getDim().getValue(); ++axis) { @@ -1365,12 +1315,12 @@ OuteredgeData::printAxisSide( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxisSide(axis, face_normal, side, box, d, os, prec); @@ -1389,7 +1339,7 @@ OuteredgeData::printAxisSide( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); @@ -1405,11 +1355,11 @@ OuteredgeData::printAxisSide( const hier::Box edgebox = EdgeGeometry::toEdgeBox(box, axis); const hier::Box region = - edgebox * d_data[axis][face_normal][side].getBox(); - hier::Box::iterator iiend(region, false); - for (hier::Box::iterator ii(region, true); ii != iiend; ++ii) { + edgebox * d_data[axis][face_normal][side]->getBox(); + hier::Box::iterator iiend(region.end()); + for (hier::Box::iterator ii(region.begin()); ii != iiend; ++ii) { os << "array" << *ii << " = " - << d_data[axis][face_normal][side](*ii, depth) << std::endl; + << (*(d_data[axis][face_normal][side]))(*ii, depth) << std::endl; os << std::flush; } @@ -1421,7 +1371,7 @@ OuteredgeData::printAxisSide( ************************************************************************* * * Checks that class version and restart file version are equal. - * If so, reads in d_depth from the database. + * If so, reads in d_depth from the restart database. * Then has each item in d_data read in its data from the database. * ************************************************************************* @@ -1429,19 +1379,21 @@ OuteredgeData::printAxisSide( template void -OuteredgeData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +OuteredgeData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_OUTEREDGEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_OUTEREDGEDATA_VERSION"); if (ver != PDAT_OUTEREDGEDATA_VERSION) { TBOX_ERROR( - "OuteredgeData::getSpecializedFromDatabase error...\n" + "OuteredgeData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; @@ -1456,8 +1408,8 @@ OuteredgeData::getSpecializedFromDatabase( axis) + "_" + tbox::Utilities::intToString(face_normal) + "_" + tbox::Utilities::intToString(side); - array_database = database->getDatabase(array_name); - (d_data[axis][face_normal][side]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[axis][face_normal][side]->getFromRestart(array_database); } // iterate over lower/upper sides @@ -1472,7 +1424,7 @@ OuteredgeData::getSpecializedFromDatabase( /* ************************************************************************* * - * Writes out class version number, d_depth to the database. + * Writes out class version number, d_depth to the restart database. * Then has each item in d_data write out its data to the database. * ************************************************************************* @@ -1480,15 +1432,17 @@ OuteredgeData::getSpecializedFromDatabase( template void -OuteredgeData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +OuteredgeData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_OUTEREDGEDATA_VERSION", + restart_db->putInteger("PDAT_OUTEREDGEDATA_VERSION", PDAT_OUTEREDGEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; @@ -1504,8 +1458,8 @@ OuteredgeData::putSpecializedToDatabase( axis) + "_" + tbox::Utilities::intToString(face_normal) + "_" + tbox::Utilities::intToString(side); - array_database = database->putDatabase(array_name); - (d_data[axis][face_normal][side]).putUnregisteredToDatabase( + array_database = restart_db->putDatabase(array_name); + d_data[axis][face_normal][side]->putToRestart( array_database); } // iterate over lower/upper sides diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.h index ad5c1f26..3758d408 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outeredge centered patch data type * ************************************************************************/ @@ -22,14 +22,14 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class OuteredgeData provides an implementation for data defined + * @brief Class OuteredgeData provides an implementation for data defined * at cell edges on the boundaries of AMR patches. It is derived from the * hier::PatchData interface common to all SAMRAI patch data types. Given * a CELL-centered AMR index space box, an outeredge data object represents @@ -39,20 +39,20 @@ namespace pdat { * between the standard SAMRAI cell-centered AMR index space and * outeredge-centered data. * - * Outeredge data is stored in 2*DIM*(DIM-2) arrays, each of which contains data - * associated with edge indices in a coordinate axis direction, an outward + * Outeredge data is stored in 2*DIM*(DIM-2) arrays, each of which contains + * data associated with edge indices in a coordinate axis direction, an outward * pointing face normal direction, and an upper or lower box face in the * face normal direction. The data layout in the outernode data arrays matches * the corresponding array sections provided by the node data implementation. - * Note that outeredge data is NOT defined when the axis and face normal are equal. - * This is consistent with the edge data representation. Where an edge index falls - * on more than one box face (patch boundary edges and corners), the outeredge - * data value belongs to only one data array so that there are no redundant data - * values. Specifically, when DIM > 2, outeredge data boxes are "trimmed" for each - * axis edge direction so that each edge index that lives on more than one - * face on the box boundary will be associated with the largest face normal - * direction and only that face. Within each array, data is stored in - * (i,...,k,d) order, where i,...,k indicates a spatial index and the + * Note that outeredge data is NOT defined when the axis and face normal are + * equal. This is consistent with the edge data representation. Where an edge + * index falls on more than one box face (patch boundary edges and corners), + * the outeredge data value belongs to only one data array so that there are no + * redundant data values. Specifically, when DIM > 2, outeredge data boxes are + * "trimmed" for each axis edge direction so that each edge index that lives on + * more than one face on the box boundary will be associated with the largest + * face normal direction and only that face. Within each array, data is stored + * in (i,...,k,d) order, where i,...,k indicates a spatial index and the * d indicates the component depth at that location. Memory allocation is * in column-major ordering (e.g., Fortran style) so that the leftmost * index runs fastest in memory. @@ -60,7 +60,8 @@ namespace pdat { * To illustrate the outeredge data layout, in particular the "box trimming" * that prevents redundant data values, we describe the data for a * three-dimensional outeredge data object instantiated over a - * box [l0:u0,l1:u1,l2:u2] in the standard SAMRAI cell-centered AMR index space. + * box [l0:u0,l1:u1,l2:u2] in the standard SAMRAI cell-centered AMR index + * space. * Note: no boxes are trimmed when DIM < 3. * * \verbatim @@ -116,12 +117,12 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::OuteredgeDataFactory - * @see pdat::OuteredgeGeometry - * @see pdat::EdgeIterator - * @see pdat::EdgeIndex + * @see OuteredgeDataFactory + * @see OuteredgeGeometry + * @see EdgeIterator + * @see EdgeIndex */ template @@ -142,6 +143,8 @@ class OuteredgeData:public hier::PatchData * Note: the ghost cell width is assumed to be zero. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ static size_t getSizeOfData( @@ -158,6 +161,8 @@ class OuteredgeData:public hier::PatchData * outeredge data object will be created. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ OuteredgeData( const hier::Box& box, @@ -183,6 +188,9 @@ class OuteredgeData:public hier::PatchData * must satisfy 0 <= axis < DIM * @param face_normal integer face normal direction for data, * must satisfy 0 <= face_normal < DIM + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ bool dataExists( @@ -220,6 +228,11 @@ class OuteredgeData:public hier::PatchData * data array * @param depth integer depth component, must satisfy * 0 <= depth < actual depth of data array + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -241,6 +254,11 @@ class OuteredgeData:public hier::PatchData * data array * @param depth integer depth component, must satisfy * 0 <= depth < actual depth of data array + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -257,6 +275,10 @@ class OuteredgeData:public hier::PatchData * an index on the outeredge of the box. * @param depth integer depth component, must satisfy * 0 <= depth < actual depth of data array + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -271,6 +293,10 @@ class OuteredgeData:public hier::PatchData * an index on the outeredge of the box. * @param depth integer depth component, must satisfy * 0 <= depth < actual depth of data array + * + * @pre getDim() == i.getDim() + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -288,6 +314,10 @@ class OuteredgeData:public hier::PatchData * must satisfy 0 <= face_normal < DIM * @param side integer lower (0) or upper (1) side of outeredge * data array + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ ArrayData& getArrayData( @@ -306,6 +336,10 @@ class OuteredgeData:public hier::PatchData * must satisfy 0 <= face_normal < DIM * @param side integer lower (0) or upper (1) side of outeredge * data array + * + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ const ArrayData& getArrayData( @@ -322,6 +356,10 @@ class OuteredgeData:public hier::PatchData * both the source and destination). Currently, source data must be * either EdgeData or OuteredgeData of the same DIM and TYPE. If not, * then an unrecoverable error results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast *>(&src) != 0 || + * dynamic_cast *>(&src) != 0 */ virtual void copy( @@ -336,6 +374,10 @@ class OuteredgeData:public hier::PatchData * both the source and destination). Currently, destination data must be * either EdgeData or OuteredgeData of the same DIM and TYPE. If not, * then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 || + * dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -349,6 +391,11 @@ class OuteredgeData:public hier::PatchData * of the same DIM and TYPE and the overlap must be an EdgeOverlap * of the same DIM. If not, then an unrecoverable error * results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre dynamic_cast *>(&src) != 0 || + * dynamic_cast *>(&src) != 0 */ virtual void copy( @@ -363,6 +410,11 @@ class OuteredgeData:public hier::PatchData * of the same DIM and TYPE and the overlap must be an EdgeOverlap * of the same DIM. If not, then an unrecoverable error * results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre dynamic_cast *>(&dst) != 0 || + * dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -373,6 +425,8 @@ class OuteredgeData:public hier::PatchData * @brief Fast copy (i.e., assumes edge and outeredge data objects are * defined over the same box) from the given edge source data object to * this destination outeredge data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -384,6 +438,8 @@ class OuteredgeData:public hier::PatchData * @brief Fast copy (i.e., assumes edge and outeredge data objects are * defined over the same box) to the given edge destination data object * from this source outeredge data object at the specified depths. + * + * @pre getDim() == dst.getDim() */ void copyDepth2( @@ -398,6 +454,10 @@ class OuteredgeData:public hier::PatchData * Currently, source data must be OuteredgeData of the same DIM and * TYPE and the overlap must be an EdgeOverlap of the same DIM. * If not, then an unrecoverable error results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre dynamic_cast *>(&src) != 0 */ virtual void sum( @@ -422,8 +482,10 @@ class OuteredgeData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -431,6 +493,8 @@ class OuteredgeData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * EdgeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -441,6 +505,8 @@ class OuteredgeData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * EdgeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -450,6 +516,8 @@ class OuteredgeData:public hier::PatchData /*! * @brief Unpack data from stream and add into this patch data object * over the specified box overlap region. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStreamAndSum( @@ -458,6 +526,8 @@ class OuteredgeData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -466,6 +536,9 @@ class OuteredgeData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -482,6 +555,8 @@ class OuteredgeData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -497,10 +572,12 @@ class OuteredgeData:public hier::PatchData * and will be converted to edge index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, - * and the default is 6 decimal places floats. For other types, this - * value is ignored. + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point + * numbers, and the default is 6 decimal places floats. For other + * types, this value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -519,10 +596,13 @@ class OuteredgeData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, - * and the default is 6 decimal places floats. For other types, this - * value is ignored. + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point + * numbers, and the default is 6 decimal places floats. For other + * types, this value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -547,10 +627,15 @@ class OuteredgeData:public hier::PatchData * and will be converted to edge index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, - * and the default is 6 decimal places floats. For other types, this - * value is ignored. + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point + * numbers, and the default is 6 decimal places floats. For other + * types, this value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( @@ -578,10 +663,16 @@ class OuteredgeData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, - * and the default is 6 decimal places floats. For other types, this - * value is ignored. + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point + * numbers, and the default is 6 decimal places floats. For other + * types, this value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (axis >= 0) && (axis < getDim().getValue()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( @@ -595,23 +686,23 @@ class OuteredgeData:public hier::PatchData /*! * @brief Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * @brief Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: /* @@ -619,10 +710,14 @@ class OuteredgeData:public hier::PatchData */ static const int PDAT_OUTEREDGEDATA_VERSION; - OuteredgeData(const OuteredgeData&); // not implemented - void + // Unimplemented copy constructor + OuteredgeData( + const OuteredgeData&); + + // Unimplemented assignment operator + OuteredgeData& operator = ( - const OuteredgeData&); // not implemented + const OuteredgeData&); //@{ //! @name Internal implementations for data copy operations. @@ -657,9 +752,9 @@ class OuteredgeData:public hier::PatchData //@} int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE][tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE - ][2]; + + boost::shared_ptr > + d_data[SAMRAI::MAX_DIM_VAL][SAMRAI::MAX_DIM_VAL][2]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.C index 50ed901d..ced8c5e5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outeredge data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/pdat/OuteredgeGeometry.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -61,11 +61,11 @@ boost::shared_ptr OuteredgeDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - ghosts.getDim(), - d_depth); + ghosts.getDim(), + d_depth); } /* @@ -81,7 +81,7 @@ boost::shared_ptr OuteredgeDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >(patch.getBox(), d_depth); } @@ -99,7 +99,7 @@ boost::shared_ptr OuteredgeDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const hier::IntVector& zero_vector(hier::IntVector::getZero(getDim())); @@ -126,7 +126,7 @@ size_t OuteredgeDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(OuteredgeData)); const size_t data = OuteredgeData::getSizeOfData(box, @@ -139,7 +139,7 @@ OuteredgeDataFactory::getSizeOfMemory( * * Return a boolean true value indicating that fine data for the outeredge * quantity will take precedence on coarse-fine interfaces. See the - * OuteredgeVariable class header file for more information. + * OuteredgeVariable class header file for more information. * ************************************************************************* */ @@ -178,7 +178,7 @@ bool OuteredgeDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -187,8 +187,8 @@ OuteredgeDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > edf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (edf) { valid_copy = true; } @@ -196,8 +196,9 @@ OuteredgeDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > oedf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (oedf) { valid_copy = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.h index 74322276..182b8ced 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outeredge data objects * ************************************************************************/ @@ -19,21 +19,21 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { /*! * @brief - * Class OuteredgeDataFactory is a factory class used to allocate new - * instances of OuteredgeData objects. It is a subclass of the patch + * Class OuteredgeDataFactory is a factory class used to allocate new + * instances of OuteredgeData objects. It is a subclass of the patch * data factory class and outeredge data is a subclass of patch data. Both * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::OuteredgeData - * @see pdat::PatchDataFactory + * @see OuteredgeData + * @see PatchDataFactory */ template @@ -46,6 +46,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * * The depth (number of components) gives the default for all of * the outeredge data objects created with this factory. + * + * @pre depth > 0 */ OuteredgeDataFactory( const tbox::Dimension& dim, @@ -66,6 +68,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -77,6 +81,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * * The default information about the object (e.g., depth) is taken from * the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -88,6 +94,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -107,6 +115,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * @brief * Calculate the amount of memory needed to store the outeredge data * object, including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -115,7 +125,7 @@ class OuteredgeDataFactory:public hier::PatchDataFactory /*! * Return a boolean true value indicating that fine data for the outeredge * quantity will take precedence on coarse-fine interfaces. See the - * OuteredgeVariable class header file for more information. + * OuteredgeVariable class header file for more information. */ bool fineBoundaryRepresentsVariable() const; @@ -131,6 +141,8 @@ class OuteredgeDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this OuteredgeDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is EdgeDataFactory or OuteredgeDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.C index 473bd9da..e8f6f246 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box geometry information for outeredge centered objects * ************************************************************************/ - -#ifndef included_pdat_OuteredgeGeometry_C -#define included_pdat_OuteredgeGeometry_C - #include "SAMRAI/pdat/OuteredgeGeometry.h" #include "SAMRAI/pdat/EdgeGeometry.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -37,7 +33,7 @@ OuteredgeGeometry::OuteredgeGeometry( d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -70,7 +66,7 @@ OuteredgeGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const EdgeGeometry* t_dst_edge = dynamic_cast(&dst_geometry); @@ -81,11 +77,11 @@ OuteredgeGeometry::calculateOverlap( boost::shared_ptr over; - if ((t_src != NULL) && (t_dst_edge != NULL)) { + if ((t_src != 0) && (t_dst_edge != 0)) { over = doOverlap(*t_dst_edge, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); - } else if ((t_src != NULL) && (t_dst_oedge != NULL)) { + } else if ((t_src != 0) && (t_dst_oedge != 0)) { over = doOverlap(*t_dst_oedge, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); @@ -119,7 +115,7 @@ OuteredgeGeometry::doOverlap( { const tbox::Dimension& dim(src_mask.getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); // Perform a quick-and-dirty intersection to see if the boxes might overlap @@ -139,7 +135,7 @@ OuteredgeGeometry::doOverlap( hier::Box::grow(dst_box, one_vector)); if (quick_boxes_intersect) { - for (int axis = 0; axis < dim.getValue(); ++axis) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::Box dst_edge_box( EdgeGeometry::toEdgeBox(dst_box, axis)); @@ -153,11 +149,13 @@ OuteredgeGeometry::doOverlap( const hier::Box fill_edge_box( EdgeGeometry::toEdgeBox(fill_box, axis)); - for (int face_normal = 0; face_normal < dim.getValue(); ++face_normal) { + for (tbox::Dimension::dir_t face_normal = 0; + face_normal < dim.getValue(); + ++face_normal) { if (face_normal != axis) { - for (int side = 0; side < 2; ++side) { + for (tbox::Dimension::dir_t side = 0; side < 2; ++side) { hier::Box outeredge_src_box( toOuteredgeBox(src_box_shifted, axis, @@ -184,9 +182,9 @@ OuteredgeGeometry::doOverlap( } // if source and destination edge boxes overlap in axis direction - if (dst_restrict_boxes.size() && dst_boxes[axis].size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes[axis].empty()) { hier::BoxContainer edge_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { edge_restrict_boxes.pushBack(EdgeGeometry::toEdgeBox(*b, axis)); } @@ -224,7 +222,7 @@ OuteredgeGeometry::doOverlap( const tbox::Dimension& dim(src_mask.getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); // Perform a quick-and-dirty intersection to see if the boxes might overlap @@ -244,7 +242,7 @@ OuteredgeGeometry::doOverlap( hier::Box::grow(dst_box, one_vector)); if (quick_boxes_intersect) { - for (int axis = 0; axis < dim.getValue(); ++axis) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::Box dst_edge_box( EdgeGeometry::toEdgeBox(dst_box, axis)); @@ -258,7 +256,7 @@ OuteredgeGeometry::doOverlap( const hier::Box fill_edge_box( EdgeGeometry::toEdgeBox(fill_box, axis)); - for (int src_face_normal = 0; + for (tbox::Dimension::dir_t src_face_normal = 0; src_face_normal < dim.getValue(); ++src_face_normal) { @@ -275,7 +273,7 @@ OuteredgeGeometry::doOverlap( src_face_normal, 1)); - for (int dst_face_normal = 0; + for (tbox::Dimension::dir_t dst_face_normal = 0; dst_face_normal < dim.getValue(); ++dst_face_normal) { @@ -336,9 +334,9 @@ OuteredgeGeometry::doOverlap( dst_boxes[axis].removeIntersections(interior_edges); } - if (dst_restrict_boxes.size() && dst_boxes[axis].size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes[axis].empty()) { hier::BoxContainer edge_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { edge_restrict_boxes.pushBack(EdgeGeometry::toEdgeBox(*b, axis)); } @@ -365,14 +363,14 @@ OuteredgeGeometry::doOverlap( hier::Box OuteredgeGeometry::toOuteredgeBox( const hier::Box& box, - int axis, - int face_normal, + tbox::Dimension::dir_t axis, + tbox::Dimension::dir_t face_normal, int side) { const tbox::Dimension& dim(box.getDim()); - TBOX_ASSERT(0 <= axis && axis < dim.getValue()); - TBOX_ASSERT(0 <= face_normal && face_normal < dim.getValue()); + TBOX_ASSERT(axis < dim.getValue()); + TBOX_ASSERT(face_normal < dim.getValue()); TBOX_ASSERT(face_normal != axis); TBOX_ASSERT(side == 0 || side == 1); @@ -391,17 +389,19 @@ OuteredgeGeometry::toOuteredgeBox( oedge_box = EdgeGeometry::toEdgeBox(box, axis); - for (int d = 0; d < dim.getValue(); ++d) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { if (d != axis) { // do not trim in axis direction - for (int dh = d + 1; dh < dim.getValue(); ++dh) { // trim in higher dimensions + for (tbox::Dimension::dir_t dh = static_cast(d + 1); + dh < dim.getValue(); + ++dh) { // trim higher directions if (dh != axis && dh != face_normal) { // do not trim in axis or face_normal direction - ++oedge_box.lower(dh); - --oedge_box.upper(dh); + oedge_box.setLower(dh, oedge_box.lower(dh) + 1); + oedge_box.setUpper(dh, oedge_box.upper(dh) - 1); } @@ -412,9 +412,9 @@ OuteredgeGeometry::toOuteredgeBox( } if (side == 0) { // lower side in face normal direction - oedge_box.upper(face_normal) = oedge_box.lower(face_normal); + oedge_box.setUpper(face_normal, oedge_box.lower(face_normal)); } else { // side == 1; upper side in face normal direction - oedge_box.lower(face_normal) = oedge_box.upper(face_normal); + oedge_box.setLower(face_normal, oedge_box.upper(face_normal)); } } @@ -435,10 +435,11 @@ OuteredgeGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (int d = 0; d < dim.getValue(); ++d) { hier::Box edge_box(EdgeGeometry::toEdgeBox(*b, d)); dst_boxes[d].pushBack(edge_box); } @@ -451,4 +452,3 @@ OuteredgeGeometry::setUpOverlap( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.h index 8a9e39d7..44f6eebc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Box geometry information for edge centered objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -33,12 +33,12 @@ class EdgeGeometry; * box geometries and edge or outeredge box geometries for communication * operations. * - * See header file for OuteredgeData class for a more detailed + * See header file for OuteredgeData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::EdgeGeometry - * @see pdat::EdgeOverlap + * @see EdgeGeometry + * @see EdgeOverlap */ class OuteredgeGeometry:public hier::BoxGeometry @@ -54,17 +54,25 @@ class OuteredgeGeometry:public hier::BoxGeometry * outeredge geometry box for the specified axis, face normal, and * lower/upper side. See OuteredgeData header file for a detailed * description of an outeredge box. + * + * @pre (0 <= axis) && (axis < dim.getValue()) + * @pre (0 <= face_normal) && (face_normal < dim.getValue()) + * @pre (face_normal != axis) + * @pre (side == 0) || (side == 1) */ static hier::Box toOuteredgeBox( const hier::Box& box, - int axis, - int face_normal, + tbox::Dimension::dir_t axis, + tbox::Dimension::dir_t face_normal, int side); /*! * @brief Construct an outeredge geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ OuteredgeGeometry( const hier::Box& box, @@ -78,6 +86,9 @@ class OuteredgeGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in edge-centered index space on the * boundaries of the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() + * @pre */ virtual boost::shared_ptr calculateOverlap( @@ -148,7 +159,7 @@ class OuteredgeGeometry:public hier::BoxGeometry OuteredgeGeometry( const OuteredgeGeometry&); // not implemented - void + OuteredgeGeometry& operator = ( const OuteredgeGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.C index 86b19392..8d5b20bc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Variable class for defining outeredge centered variables * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/OuteredgeDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -47,37 +47,12 @@ template int OuteredgeVariable::getDepth() const { boost::shared_ptr > factory( - getPatchDataFactory()); + BOOST_CAST, hier::PatchData>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -OuteredgeVariable::OuteredgeVariable( - const OuteredgeVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void OuteredgeVariable::operator = ( - const OuteredgeVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.h index 6235a97a..a506d18f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuteredgeVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Variable class for defining outeredge centered variables * ************************************************************************/ @@ -20,18 +20,18 @@ namespace SAMRAI { namespace pdat { /*! - * @brief Class OuteredgeVariable is a templated variable class + * @brief Class OuteredgeVariable is a templated variable class * used to define edge-centered data quantities only on patch boundaries. * It is a subclass of hier::Variable and is templated on the type * of the underlying data (e.g., double, int, bool, etc.). * * Note that the data layout in the outeredge data arrays matches the corresponding * array sections provided by the edge data implementation. See header file for - * the OuteredgeData class for a more detailed description of the data layout. + * the OuteredgeData class for a more detailed description of the data layout. * - * @see pdat::EdgeData - * @see pdat::OuteredgeData - * @see pdat::OuteredgeDataFactory + * @see EdgeData + * @see OuteredgeData + * @see OuteredgeDataFactory * @see hier::Variable */ @@ -82,10 +82,10 @@ class OuteredgeVariable:public hier::Variable private: // neither of the following functions are implemented OuteredgeVariable( - const OuteredgeVariable&); - void + const OuteredgeVariable&); + OuteredgeVariable& operator = ( - const OuteredgeVariable&); + const OuteredgeVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.C index 49c67d8f..1226e1d3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceComplexConstantRefine_C -#define included_pdat_OuterfaceComplexConstantRefine_C - #include "SAMRAI/pdat/OuterfaceComplexConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,7 +29,7 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefoutfacecplx1d, CONREFOUTFACECPLX1D) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx1d, CONREFOUTFACECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -41,7 +37,7 @@ void F77_FUNC(conrefoutfacecplx1d, CONREFOUTFACECPLX1D) (const int&, const int *, const dcomplex *, dcomplex *); // in conrefine2d.f: -void F77_FUNC(conrefoutfacecplx2d0, CONREFOUTFACECPLX2D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx2d0, CONREFOUTFACECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(conrefoutfacecplx2d0, CONREFOUTFACECPLX2D0) (const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefoutfacecplx2d1, CONREFOUTFACECPLX2D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx2d1, CONREFOUTFACECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +60,7 @@ void F77_FUNC(conrefoutfacecplx2d1, CONREFOUTFACECPLX2D1) (const int&, const int *, const dcomplex *, dcomplex *); // in conrefine3d.f: -void F77_FUNC(conrefoutfacecplx3d0, CONREFOUTFACECPLX3D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx3d0, CONREFOUTFACECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(conrefoutfacecplx3d0, CONREFOUTFACECPLX3D0) (const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefoutfacecplx3d1, CONREFOUTFACECPLX3D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx3d1, CONREFOUTFACECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -86,7 +82,7 @@ void F77_FUNC(conrefoutfacecplx3d1, CONREFOUTFACECPLX3D1) (const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefoutfacecplx3d2, CONREFOUTFACECPLX3D2) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacecplx3d2, CONREFOUTFACECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -102,9 +98,8 @@ void F77_FUNC(conrefoutfacecplx3d2, CONREFOUTFACECPLX3D2) (const int&, namespace SAMRAI { namespace pdat { -OuterfaceComplexConstantRefine::OuterfaceComplexConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +OuterfaceComplexConstantRefine::OuterfaceComplexConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -120,9 +115,9 @@ OuterfaceComplexConstantRefine::getOperatorPriority() const } hier::IntVector -OuterfaceComplexConstantRefine::getStencilWidth() const +OuterfaceComplexConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -134,60 +129,63 @@ OuterfaceComplexConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const FaceOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefoutfacecplx1d, CONREFOUTFACECPLX1D) ( + SAMRAI_F77_FUNC(conrefoutfacecplx1d, CONREFOUTFACECPLX1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -197,7 +195,7 @@ OuterfaceComplexConstantRefine::refine( fdata->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefoutfacecplx2d0, CONREFOUTFACECPLX2D0) ( + SAMRAI_F77_FUNC(conrefoutfacecplx2d0, CONREFOUTFACECPLX2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -206,7 +204,7 @@ OuterfaceComplexConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfacecplx2d1, CONREFOUTFACECPLX2D1) ( + SAMRAI_F77_FUNC(conrefoutfacecplx2d1, CONREFOUTFACECPLX2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -217,7 +215,7 @@ OuterfaceComplexConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefoutfacecplx3d0, CONREFOUTFACECPLX3D0) ( + SAMRAI_F77_FUNC(conrefoutfacecplx3d0, CONREFOUTFACECPLX3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,7 +228,7 @@ OuterfaceComplexConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfacecplx3d1, CONREFOUTFACECPLX3D1) ( + SAMRAI_F77_FUNC(conrefoutfacecplx3d1, CONREFOUTFACECPLX3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -243,7 +241,7 @@ OuterfaceComplexConstantRefine::refine( cdata->getPointer(1, i, d), fdata->getPointer(1, i, d)); } else if (axis == 2) { - F77_FUNC(conrefoutfacecplx3d2, CONREFOUTFACECPLX3D2) ( + SAMRAI_F77_FUNC(conrefoutfacecplx3d2, CONREFOUTFACECPLX3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -269,4 +267,3 @@ OuterfaceComplexConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.h index 929cdeae..c55d39fc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface complex data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class OuterfaceComplexConstantRefine: /** * Uninteresting default constructor. */ - explicit OuterfaceComplexConstantRefine( - const tbox::Dimension& dim); + OuterfaceComplexConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class OuterfaceComplexConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class OuterfaceComplexConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.C index d4bb4c48..acf56265 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for complex outerface data. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceComplexLinearTimeInterpolateOp_C -#define included_pdat_OuterfaceComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -21,7 +17,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -37,7 +33,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutfacecmplx1d, LINTIMEINTOUTFACECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx1d, LINTIMEINTOUTFACECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,8 +42,8 @@ void F77_FUNC(lintimeintoutfacecmplx1d, LINTIMEINTOUTFACECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutfacecmplx2d0, - LINTIMEINTOUTFACECMPLX2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx2d0, + LINTIMEINTOUTFACECMPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,8 +54,8 @@ void F77_FUNC(lintimeintoutfacecmplx2d0, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutfacecmplx2d1, - LINTIMEINTOUTFACECMPLX2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx2d1, + LINTIMEINTOUTFACECMPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -71,8 +67,8 @@ void F77_FUNC(lintimeintoutfacecmplx2d1, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutfacecmplx3d0, - LINTIMEINTOUTFACECMPLX3D0) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d0, + LINTIMEINTOUTFACECMPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -83,8 +79,8 @@ void F77_FUNC(lintimeintoutfacecmplx3d0, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutfacecmplx3d1, - LINTIMEINTOUTFACECMPLX3D1) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d1, + LINTIMEINTOUTFACECMPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,8 +91,8 @@ void F77_FUNC(lintimeintoutfacecmplx3d1, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutfacecmplx3d2, - LINTIMEINTOUTFACECMPLX3D2) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d2, + LINTIMEINTOUTFACECMPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -133,30 +129,30 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OuterfaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OuterfaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OuterfaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -175,11 +171,11 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutfacecmplx1d, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx1d, LINTIMEINTOUTFACECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -189,7 +185,7 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutfacecmplx2d0, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx2d0, LINTIMEINTOUTFACECMPLX2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -199,7 +195,7 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacecmplx2d1, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx2d1, LINTIMEINTOUTFACECMPLX2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -210,7 +206,7 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutfacecmplx3d0, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d0, LINTIMEINTOUTFACECMPLX3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -223,7 +219,7 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacecmplx3d1, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d1, LINTIMEINTOUTFACECMPLX3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -236,7 +232,7 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutfacecmplx3d2, + SAMRAI_F77_FUNC(lintimeintoutfacecmplx3d2, LINTIMEINTOUTFACECMPLX3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -260,4 +256,3 @@ OuterfaceComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.h index 57121659..7aeff572 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for complex outerface data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OuterfaceComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.C index 52d63002..47af26dc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outerface centered patch data type * ************************************************************************/ @@ -46,15 +46,15 @@ OuterfaceData::OuterfaceData( TBOX_ASSERT(depth > 0); - for (int d = 0; d < getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { const hier::Box& ghosts = getGhostBox(); const hier::Box facebox = FaceGeometry::toFaceBox(ghosts, d); hier::Box outerfacebox = facebox; - outerfacebox.upper(0) = facebox.lower(0); - d_data[d][0].initializeArray(outerfacebox, depth); - outerfacebox.lower(0) = facebox.upper(0); - outerfacebox.upper(0) = facebox.upper(0); - d_data[d][1].initializeArray(outerfacebox, depth); + outerfacebox.setUpper(0, facebox.lower(0)); + d_data[d][0].reset(new ArrayData(outerfacebox, depth)); + outerfacebox.setLower(0, facebox.upper(0)); + outerfacebox.setUpper(0, facebox.upper(0)); + d_data[d][1].reset(new ArrayData(outerfacebox, depth)); } } @@ -63,32 +63,6 @@ OuterfaceData::~OuterfaceData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -OuterfaceData::OuterfaceData( - const OuterfaceData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -OuterfaceData::operator = ( - const OuterfaceData& foo) -{ - NULL_USE(foo); -} - template int OuterfaceData::getDepth() const @@ -97,7 +71,7 @@ OuterfaceData::getDepth() const } template -TYPE* +TYPE * OuterfaceData::getPointer( int face_normal, int side, @@ -107,11 +81,11 @@ OuterfaceData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((d >= 0) && (d < d_depth)); - return d_data[face_normal][side].getPointer(d); + return d_data[face_normal][side]->getPointer(d); } template -const TYPE* +const TYPE * OuterfaceData::getPointer( int face_normal, int side, @@ -121,7 +95,7 @@ OuterfaceData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((d >= 0) && (d < d_depth)); - return d_data[face_normal][side].getPointer(d); + return d_data[face_normal][side]->getPointer(d); } template @@ -133,7 +107,7 @@ OuterfaceData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[face_normal][side]; + return *(d_data[face_normal][side]); } template @@ -145,7 +119,7 @@ OuterfaceData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[face_normal][side]; + return *(d_data[face_normal][side]); } template @@ -161,7 +135,7 @@ OuterfaceData::operator () ( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][side](i, depth); + return (*(d_data[axis][side]))(i, depth); } template @@ -171,7 +145,7 @@ OuterfaceData::operator () ( int side, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -179,7 +153,7 @@ OuterfaceData::operator () ( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][side](i, depth); + return (*(d_data[axis][side]))(i, depth); } /* @@ -196,17 +170,17 @@ void OuterfaceData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const FaceData * const t_src = - dynamic_cast *>(&src); + CPP_CAST *>(&src); - TBOX_ASSERT(t_src != NULL); + TBOX_ASSERT(t_src != 0); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { const ArrayData& face_array = t_src->getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - ArrayData& oface_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + ArrayData& oface_array = *(d_data[axis][loc]); oface_array.copy(face_array, oface_array.getBox()); } } @@ -217,16 +191,15 @@ void OuterfaceData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - FaceData* t_dst = - dynamic_cast *>(&dst); + FaceData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - for (int d = 0; d < getDim().getValue(); d++) { - t_dst->getArrayData(d).copy(d_data[d][0], d_data[d][0].getBox()); - t_dst->getArrayData(d).copy(d_data[d][1], d_data[d][1].getBox()); + for (int d = 0; d < getDim().getValue(); ++d) { + t_dst->getArrayData(d).copy(*(d_data[d][0]), d_data[d][0]->getBox()); + t_dst->getArrayData(d).copy(*(d_data[d][1]), d_data[d][1]->getBox()); } } @@ -245,11 +218,42 @@ OuterfaceData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - NULL_USE(src); - NULL_USE(overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); + + TBOX_ASSERT(t_overlap != 0); + + const OuterfaceData* t_oface_src = + dynamic_cast *>(&src); + const FaceData* t_face_src = + dynamic_cast *>(&src); + + TBOX_ASSERT(t_oface_src == 0 || t_face_src == 0); + TBOX_ASSERT(t_oface_src != 0 || t_face_src != 0); + + const hier::IntVector& src_offset = t_overlap->getSourceOffset(); + if (t_oface_src != 0) { + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(d); + d_data[d][0]->copy(t_oface_src->getArrayData(d, 0), box_list, src_offset); + d_data[d][0]->copy(t_oface_src->getArrayData(d, 1), box_list, src_offset); + d_data[d][1]->copy(t_oface_src->getArrayData(d, 0), box_list, src_offset); + d_data[d][1]->copy(t_oface_src->getArrayData(d, 1), box_list, src_offset); + } + } else if (t_face_src != 0) { + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(d); + d_data[d][0]->copy(t_face_src->getArrayData(d), box_list, src_offset); + d_data[d][1]->copy(t_face_src->getArrayData(d), box_list, src_offset); + } + } else { + TBOX_ERROR("OuterfaceData::copy error...\n" + << " : Cannot copy from type other than FaceData or OuterfaceData " << std::endl); + } - TBOX_ERROR("Copy with outerface as destination is not defined yet..."); } template @@ -258,24 +262,22 @@ OuterfaceData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - FaceData* t_dst = - dynamic_cast *>(&dst); - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + FaceData* t_dst = CPP_CAST *>(&dst); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); const hier::Transformation& transformation = t_overlap->getTransformation(); TBOX_ASSERT(transformation.getRotation() == hier::Transformation::NO_ROTATE); const hier::IntVector& src_offset = transformation.getOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { hier::IntVector face_offset(src_offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = src_offset((d + i) % getDim().getValue()); } } @@ -283,10 +285,10 @@ OuterfaceData::copy2( face_offset, getBox().getBlockId(), t_dst->getBox().getBlockId()); - + const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - t_dst->getArrayData(d).copy(d_data[d][0], box_list, face_transform); - t_dst->getArrayData(d).copy(d_data[d][1], box_list, face_transform); + t_dst->getArrayData(d).copy(*(d_data[d][0]), box_list, face_transform); + t_dst->getArrayData(d).copy(*(d_data[d][1]), box_list, face_transform); } } @@ -306,12 +308,12 @@ OuterfaceData::copyDepth( const FaceData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { const ArrayData& src_face_array = src.getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - ArrayData& dst_oface_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + ArrayData& dst_oface_array = *(d_data[axis][loc]); dst_oface_array.copyDepth(dst_depth, src_face_array, src_depth, @@ -336,12 +338,12 @@ OuterfaceData::copyDepth2( FaceData& dst, int src_depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { ArrayData& dst_face_array = dst.getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - const ArrayData& src_oface_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + const ArrayData& src_oface_array = *(d_data[axis][loc]); dst_face_array.copyDepth(dst_depth, src_oface_array, src_depth, @@ -367,28 +369,27 @@ OuterfaceData::canEstimateStreamSizeFromBox() const } template -int +size_t OuterfaceData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - int size = 0; - for (int d = 0; d < getDim().getValue(); d++) { + size_t size = 0; + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxlist = t_overlap->getDestinationBoxContainer(d); hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } - size += d_data[d][0].getDataStreamSize(boxlist, face_offset); - size += d_data[d][1].getDataStreamSize(boxlist, face_offset); + size += d_data[d][0]->getDataStreamSize(boxlist, face_offset); + size += d_data[d][1]->getDataStreamSize(boxlist, face_offset); } return size; } @@ -408,19 +409,18 @@ OuterfaceData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { + if (!boxes.empty()) { hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } @@ -430,15 +430,15 @@ OuterfaceData::packStream( getBox().getBlockId(), boxes.begin()->getBlockId()); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box src_box(*b); face_transform.inverseTransform(src_box); - for (int f = 0; f < 2; f++) { - hier::Box intersect(src_box * d_data[d][f].getBox()); + for (int f = 0; f < 2; ++f) { + hier::Box intersect(src_box * d_data[d][f]->getBox()); if (!intersect.empty()) { - face_transform.transform(intersect); - d_data[d][f].packStream(stream, + face_transform.transform(intersect); + d_data[d][f]->packStream(stream, intersect, face_transform); } @@ -455,27 +455,26 @@ OuterfaceData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const FaceOverlap* t_overlap = - dynamic_cast(&overlap); + const FaceOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); hier::IntVector face_offset(offset); if (d > 0) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { face_offset(i) = offset((d + i) % getDim().getValue()); } } - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { - for (int f = 0; f < 2; f++) { - const hier::Box intersect = (*b) * d_data[d][f].getBox(); + for (int f = 0; f < 2; ++f) { + const hier::Box intersect = (*b) * d_data[d][f]->getBox(); if (!intersect.empty()) { - d_data[d][f].unpackStream(stream, intersect, face_offset); + d_data[d][f]->unpackStream(stream, intersect, face_offset); } } } @@ -500,11 +499,11 @@ OuterfaceData::getSizeOfData( TBOX_ASSERT(depth > 0); size_t size = 0; - for (int d = 0; d < box.getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < box.getDim().getValue(); ++d) { hier::Box lower = FaceGeometry::toFaceBox(box, d); hier::Box upper = FaceGeometry::toFaceBox(box, d); - lower.upper(d) = box.lower(d); - upper.lower(d) = box.upper(d); + lower.setUpper(d, box.lower(d)); + upper.setLower(d, box.upper(d)); size += ArrayData::getSizeOfData(lower, depth); size += ArrayData::getSizeOfData(upper, depth); } @@ -527,9 +526,9 @@ OuterfaceData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fill(t, d); - d_data[i][1].fill(t, d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fill(t, d); + d_data[i][1]->fill(t, d); } } @@ -540,12 +539,12 @@ OuterfaceData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fill(t, FaceGeometry::toFaceBox(box, i), d); - d_data[i][1].fill(t, FaceGeometry::toFaceBox(box, i), d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fill(t, FaceGeometry::toFaceBox(box, i), d); + d_data[i][1]->fill(t, FaceGeometry::toFaceBox(box, i), d); } } @@ -554,9 +553,9 @@ void OuterfaceData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fillAll(t); - d_data[i][1].fillAll(t); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fillAll(t); + d_data[i][1]->fillAll(t); } } @@ -566,11 +565,11 @@ OuterfaceData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fillAll(t, FaceGeometry::toFaceBox(box, i)); - d_data[i][1].fillAll(t, FaceGeometry::toFaceBox(box, i)); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fillAll(t, FaceGeometry::toFaceBox(box, i)); + d_data[i][1]->fillAll(t, FaceGeometry::toFaceBox(box, i)); } } @@ -589,9 +588,9 @@ OuterfaceData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { print(box, d, os, prec); } } @@ -604,12 +603,13 @@ OuterfaceData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - for (int face_normal = 0; face_normal < getDim().getValue(); face_normal++) { + for (tbox::Dimension::dir_t face_normal = 0; + face_normal < getDim().getValue(); ++face_normal) { os << "Array face normal = " << face_normal << std::endl; - for (int side = 0; side < 2; side++) { + for (int side = 0; side < 2; ++side) { os << "side = " << ((side == 0) ? "lower" : "upper") << std::endl; printAxisFace(face_normal, side, box, depth, os, prec); } @@ -619,17 +619,17 @@ OuterfaceData::print( template void OuterfaceData::printAxisFace( - int face_normal, + tbox::Dimension::dir_t face_normal, int side, const hier::Box& box, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + TBOX_ASSERT(face_normal < getDim().getValue()); TBOX_ASSERT((side == 0) || (side == 1)); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxisFace(face_normal, side, box, d, os, prec); } @@ -638,27 +638,27 @@ OuterfaceData::printAxisFace( template void OuterfaceData::printAxisFace( - int face_normal, + tbox::Dimension::dir_t face_normal, int side, const hier::Box& box, int depth, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); + TBOX_ASSERT(face_normal < getDim().getValue()); TBOX_ASSERT((side == 0) || (side == 1)); const hier::Box facebox = FaceGeometry::toFaceBox(box, face_normal); const hier::Box region = - facebox * d_data[face_normal][side].getBox(); + facebox * d_data[face_normal][side]->getBox(); os.precision(prec); - hier::Box::iterator iend(region, false); - for (hier::Box::iterator i(region, true); i != iend; ++i) { + hier::Box::iterator iend(region.end()); + for (hier::Box::iterator i(region.begin()); i != iend; ++i) { os << "array" << *i << " = " - << d_data[face_normal][side](*i, depth) << std::endl; + << (*(d_data[face_normal][side]))(*i, depth) << std::endl; os << std::flush; } } @@ -667,7 +667,7 @@ OuterfaceData::printAxisFace( ************************************************************************* * * Checks that class version and restart file version are equal. If so, - * reads in d_depth from the database. Then has each item in d_data + * reads in d_depth from the restart database. Then has each item in d_data * read in its data from the database. * ************************************************************************* @@ -675,37 +675,39 @@ OuterfaceData::printAxisFace( template void -OuterfaceData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +OuterfaceData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("PDAT_OUTERFACEDATA_VERSION"); + hier::PatchData::getFromRestart(restart_db); + + int ver = restart_db->getInteger("PDAT_OUTERFACEDATA_VERSION"); if (ver != PDAT_OUTERFACEDATA_VERSION) { TBOX_ERROR( - "OuterfaceData::getSpecializedFromDatabase error...\n" + "OuterfaceData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - array_database = database->getDatabase(array_name); - (d_data[i][0]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i][0]->getFromRestart(array_database); array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; - array_database = database->getDatabase(array_name); - (d_data[i][1]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i][1]->getFromRestart(array_database); } } /* ************************************************************************* * - * Writes out class version number, d_depth to the database. + * Writes out class version number, d_depth to the restart database. * Then has each item in d_data write out its data to the database. * ************************************************************************* @@ -713,27 +715,29 @@ OuterfaceData::getSpecializedFromDatabase( template void -OuterfaceData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +OuterfaceData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_OUTERFACEDATA_VERSION", + restart_db->putInteger("PDAT_OUTERFACEDATA_VERSION", PDAT_OUTERFACEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - array_database = database->putDatabase(array_name); - (d_data[i][0]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i][0]->putToRestart(array_database); array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; - array_database = database->putDatabase(array_name); - (d_data[i][1]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i][1]->putToRestart(array_database); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.h index 32ca67cf..35943dfb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outerface centered patch data type * ************************************************************************/ @@ -20,14 +20,14 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class OuterfaceData provides an implementation for data defined + * @brief Class OuterfaceData provides an implementation for data defined * at cell faces on the boundaries of AMR patches. It is derived from the * hier::PatchData interface common to all SAMRAI patch data types. Given * a CELL-centered AMR index space box, an outerface data object represents @@ -39,14 +39,15 @@ namespace pdat { * * Outerface data is stored in 2*DIM arrays, each of which contains data * associated with face indices normal to a coordinate axis direction and an - * upper or lower box face in the face normal direction. The data layout in the - * outerface data arrays matches the corresponding array sections provided by the - * face data implementation. Specifically, within each array, the data indices are - * cyclically permuted to be consistent with the FaceData implementation. - * Also, in each of array, memory allocation is in column-major ordering - * (e.g., Fortran style) so that the leftmost index runs fastest in memory. - * For example, a three-dimensional outerface data object created over a CELL-centered - * AMR index space [l0:u0,l1:u1,l2:u2] allocates six data arrays dimensioned as follows: + * upper or lower box face in the face normal direction. The data layout in + * the outerface data arrays matches the corresponding array sections provided + * by the face data implementation. Specifically, within each array, the data + * indices are cyclically permuted to be consistent with the FaceData + * implementation. Also, in each of array, memory allocation is in + * column-major ordering (e.g., Fortran style) so that the leftmost index runs + * fastest in memory. For example, a three-dimensional outerface data object + * created over a CELL-centered AMR index space [l0:u0,l1:u1,l2:u2] allocates + * six data arrays sized as follows: * \verbatim * * face normal 0: @@ -70,17 +71,17 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * IMPORTANT: The OutersideData class provides the same storage + * IMPORTANT: The OutersideData class provides the same storage * as this outerface data class, except that the coordinate directions of the * individual arrays are not permuted; i.e., OutersideData is consistent * with the SideData implementation. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::OuterfaceDataFactory - * @see pdat::OuterfaceGeometry - * @see pdat::FaceIterator - * @see pdat::FaceIndex + * @see OuterfaceDataFactory + * @see OuterfaceGeometry + * @see FaceIterator + * @see FaceIndex */ template @@ -101,6 +102,8 @@ class OuterfaceData:public hier::PatchData * Note: the ghost cell width is assumed to be zero. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ static size_t getSizeOfData( @@ -117,6 +120,8 @@ class OuterfaceData:public hier::PatchData * outerface data object will be created. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ OuterfaceData( const hier::Box& box, @@ -139,12 +144,14 @@ class OuterfaceData:public hier::PatchData * face normal, side, and depth component of the outerface centered * array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outerface * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -157,12 +164,14 @@ class OuterfaceData:public hier::PatchData * face normal, side location, and depth component of the outerface * centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outerface * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -176,10 +185,12 @@ class OuterfaceData:public hier::PatchData * * @param i const reference to FaceIndex, @em MUST be * an index on the outerface of the box. - * @param side integer (lower/upper location of outerface data), - * must satisfy 0 <= side <= 1 - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param side integer (lower/upper location of outerface data) + * @param depth integer depth component + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -193,10 +204,12 @@ class OuterfaceData:public hier::PatchData * * @param i const reference to FaceIndex, @em MUST be * an index on the outerface of the box. - * @param side integer (lower/upper location of outerface data), - * must satisfy 0 <= side <= 1 - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param side integer (lower/upper location of outerface data) + * @param depth integer depth component + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -208,10 +221,12 @@ class OuterfaceData:public hier::PatchData * @brief Return a reference to the array data object for * face normal and side location of the outerface centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outerface * data array + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ ArrayData& getArrayData( @@ -222,10 +237,12 @@ class OuterfaceData:public hier::PatchData * @brief Return a const reference to the array data object for * face normal and side location of the outerface centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outerface * data array + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ const ArrayData& getArrayData( @@ -241,6 +258,9 @@ class OuterfaceData:public hier::PatchData * both the source and destination). Currently, source data must be * FaceData the same DIM and TYPE. If not, then an unrecoverable error * results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast *>(&src) != 0 */ virtual void copy( @@ -255,6 +275,9 @@ class OuterfaceData:public hier::PatchData * both the source and destination). Currently, destination data must be * FaceData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -278,6 +301,11 @@ class OuterfaceData:public hier::PatchData * Currently, destination data must be FaceData of the same DIM * and TYPE and the overlap must be a FaceOverlap of the same * DIM. If not, then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 + * @pre overlap.getTransformation().getRotation() == hier::Transformation::NO_ROTATE */ virtual void copy2( @@ -288,6 +316,8 @@ class OuterfaceData:public hier::PatchData * @brief Fast copy (i.e., assumes face and outerface data objects are * defined over the same box) from the given face source data object to * this destination outerface data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -299,6 +329,8 @@ class OuterfaceData:public hier::PatchData * @brief Fast copy (i.e., assumes face and outerface data objects are * defined over the same box) to the given face destination data object * from this source outerface data object at the specified depths. + * + * @pre getDim() == dst.getDim() */ void copyDepth2( @@ -324,8 +356,10 @@ class OuterfaceData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -333,6 +367,8 @@ class OuterfaceData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * FaceOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -343,6 +379,8 @@ class OuterfaceData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * FaceOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -351,6 +389,8 @@ class OuterfaceData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -359,6 +399,9 @@ class OuterfaceData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -375,6 +418,8 @@ class OuterfaceData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -390,10 +435,12 @@ class OuterfaceData:public hier::PatchData * and will be converted to face index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -412,10 +459,13 @@ class OuterfaceData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -438,14 +488,18 @@ class OuterfaceData:public hier::PatchData * and will be converted to face index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisFace( - int face_normal, + tbox::Dimension::dir_t face_normal, int side, const hier::Box& box, std::ostream& os = tbox::plog, @@ -466,14 +520,19 @@ class OuterfaceData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisFace( - int face_normal, + tbox::Dimension::dir_t face_normal, int side, const hier::Box& box, int depth, @@ -482,23 +541,23 @@ class OuterfaceData:public hier::PatchData /*! * @brief Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * @brief Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: /* @@ -506,14 +565,18 @@ class OuterfaceData:public hier::PatchData */ static const int PDAT_OUTERFACEDATA_VERSION; + // Unimplemented copy constructor OuterfaceData( - const OuterfaceData&); // not implemented - void + const OuterfaceData&); + + // Unimplemented assignment operator + OuterfaceData& operator = ( - const OuterfaceData&); // not implemented + const OuterfaceData&); int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE][2]; + + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL][2]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.C index c40f9eff..2e43ef42 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outerface data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/pdat/FaceDataFactory.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -61,11 +61,11 @@ boost::shared_ptr OuterfaceDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - ghosts.getDim(), - d_depth); + ghosts.getDim(), + d_depth); } /* @@ -81,7 +81,7 @@ boost::shared_ptr OuterfaceDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >(patch.getBox(), d_depth); } @@ -99,7 +99,7 @@ boost::shared_ptr OuterfaceDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const hier::IntVector zero_vector(hier::IntVector::getZero(getDim())); @@ -126,7 +126,7 @@ size_t OuterfaceDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(OuterfaceData)); const size_t data = OuterfaceData::getSizeOfData(box, d_depth); @@ -138,7 +138,7 @@ OuterfaceDataFactory::getSizeOfMemory( * * Return a boolean true value indicating that fine data for the outerface * quantity will take precedence on coarse-fine interfaces. See the - * OuterfaceVariable class header file for more information. + * OuterfaceVariable class header file for more information. * ************************************************************************* */ @@ -178,7 +178,7 @@ bool OuterfaceDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -187,8 +187,8 @@ OuterfaceDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > fdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (fdf) { valid_copy = true; } @@ -196,8 +196,9 @@ OuterfaceDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > ofdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (ofdf) { valid_copy = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.h index 64e0a2d0..04ae632e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outerface data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::OuterfaceData - * @see pdat::PatchDataFactory + * @see OuterfaceData + * @see PatchDataFactory */ template @@ -43,6 +43,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory * The default constructor for the outerface data factory class. * The depth (number of components) gives the default for all of * the outerface data objects created with this factory. + * + * @pre depth > 0 */ OuterfaceDataFactory( const tbox::Dimension& dim, @@ -62,6 +64,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -71,6 +75,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete outerface data object. * The default information about the object (e.g., depth) is taken from * the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -80,6 +86,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -95,6 +103,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the outerface data * object, including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -103,7 +113,7 @@ class OuterfaceDataFactory:public hier::PatchDataFactory /** * Return a boolean true value indicating that fine data for the outerface * quantity will take precedence on coarse-fine interfaces. See the - * OuterfaceVariable class header file for more information. + * OuterfaceVariable class header file for more information. */ bool fineBoundaryRepresentsVariable() const; @@ -119,6 +129,8 @@ class OuterfaceDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this OuterfaceDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is FaceDataFactory or OuterfaceDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.C index cbd99d40..b8cefbe8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceDoubleConstantRefine_C -#define included_pdat_OuterfaceDoubleConstantRefine_C - #include "SAMRAI/pdat/OuterfaceDoubleConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,7 +29,7 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefoutfacedoub1d, CONREFOUTFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub1d, CONREFOUTFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -41,7 +37,7 @@ void F77_FUNC(conrefoutfacedoub1d, CONREFOUTFACEDOUB1D) (const int&, const int *, const double *, double *); // in conrefine2d.f: -void F77_FUNC(conrefoutfacedoub2d0, CONREFOUTFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub2d0, CONREFOUTFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(conrefoutfacedoub2d0, CONREFOUTFACEDOUB2D0) (const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefoutfacedoub2d1, CONREFOUTFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub2d1, CONREFOUTFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +60,7 @@ void F77_FUNC(conrefoutfacedoub2d1, CONREFOUTFACEDOUB2D1) (const int&, const int *, const double *, double *); // in conrefine3d.f: -void F77_FUNC(conrefoutfacedoub3d0, CONREFOUTFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub3d0, CONREFOUTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(conrefoutfacedoub3d0, CONREFOUTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefoutfacedoub3d1, CONREFOUTFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub3d1, CONREFOUTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -86,7 +82,7 @@ void F77_FUNC(conrefoutfacedoub3d1, CONREFOUTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefoutfacedoub3d2, CONREFOUTFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(conrefoutfacedoub3d2, CONREFOUTFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -102,9 +98,8 @@ void F77_FUNC(conrefoutfacedoub3d2, CONREFOUTFACEDOUB3D2) (const int&, namespace SAMRAI { namespace pdat { -OuterfaceDoubleConstantRefine::OuterfaceDoubleConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +OuterfaceDoubleConstantRefine::OuterfaceDoubleConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -120,9 +115,9 @@ OuterfaceDoubleConstantRefine::getOperatorPriority() const } hier::IntVector -OuterfaceDoubleConstantRefine::getStencilWidth() const +OuterfaceDoubleConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -134,60 +129,63 @@ OuterfaceDoubleConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const FaceOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefoutfacedoub1d, CONREFOUTFACEDOUB1D) ( + SAMRAI_F77_FUNC(conrefoutfacedoub1d, CONREFOUTFACEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -197,7 +195,7 @@ OuterfaceDoubleConstantRefine::refine( fdata->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefoutfacedoub2d0, CONREFOUTFACEDOUB2D0) ( + SAMRAI_F77_FUNC(conrefoutfacedoub2d0, CONREFOUTFACEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -206,7 +204,7 @@ OuterfaceDoubleConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfacedoub2d1, CONREFOUTFACEDOUB2D1) ( + SAMRAI_F77_FUNC(conrefoutfacedoub2d1, CONREFOUTFACEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -217,7 +215,7 @@ OuterfaceDoubleConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefoutfacedoub3d0, CONREFOUTFACEDOUB3D0) ( + SAMRAI_F77_FUNC(conrefoutfacedoub3d0, CONREFOUTFACEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,7 +228,7 @@ OuterfaceDoubleConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfacedoub3d1, CONREFOUTFACEDOUB3D1) ( + SAMRAI_F77_FUNC(conrefoutfacedoub3d1, CONREFOUTFACEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -243,7 +241,7 @@ OuterfaceDoubleConstantRefine::refine( cdata->getPointer(1, i, d), fdata->getPointer(1, i, d)); } else if (axis == 2) { - F77_FUNC(conrefoutfacedoub3d2, CONREFOUTFACEDOUB3D2) ( + SAMRAI_F77_FUNC(conrefoutfacedoub3d2, CONREFOUTFACEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -269,4 +267,3 @@ OuterfaceDoubleConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.h index fd400bab..1b060c6b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class OuterfaceDoubleConstantRefine: /** * Uninteresting default constructor. */ - explicit OuterfaceDoubleConstantRefine( - const tbox::Dimension& dim); + OuterfaceDoubleConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class OuterfaceDoubleConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class OuterfaceDoubleConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.C index 46d06680..91013957 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for double outerface patch data. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceDoubleLinearTimeInterpolateOp_C -#define included_pdat_OuterfaceDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/pdat/OuterfaceData.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutfacedoub1d, LINTIMEINTOUTFACEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub1d, LINTIMEINTOUTFACEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintoutfacedoub1d, LINTIMEINTOUTFACEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutfacedoub2d0, LINTIMEINTOUTFACEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub2d0, LINTIMEINTOUTFACEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintoutfacedoub2d0, LINTIMEINTOUTFACEDOUB2D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutfacedoub2d1, LINTIMEINTOUTFACEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub2d1, LINTIMEINTOUTFACEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintoutfacedoub2d1, LINTIMEINTOUTFACEDOUB2D1) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutfacedoub3d0, LINTIMEINTOUTFACEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub3d0, LINTIMEINTOUTFACEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintoutfacedoub3d0, LINTIMEINTOUTFACEDOUB3D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutfacedoub3d1, LINTIMEINTOUTFACEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub3d1, LINTIMEINTOUTFACEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintoutfacedoub3d1, LINTIMEINTOUTFACEDOUB3D1) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutfacedoub3d2, LINTIMEINTOUTFACEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacedoub3d2, LINTIMEINTOUTFACEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OuterfaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OuterfaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OuterfaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,11 +168,11 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutfacedoub1d, + SAMRAI_F77_FUNC(lintimeintoutfacedoub1d, LINTIMEINTOUTFACEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -186,7 +182,7 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutfacedoub2d0, + SAMRAI_F77_FUNC(lintimeintoutfacedoub2d0, LINTIMEINTOUTFACEDOUB2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -196,7 +192,7 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacedoub2d1, + SAMRAI_F77_FUNC(lintimeintoutfacedoub2d1, LINTIMEINTOUTFACEDOUB2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -207,7 +203,7 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutfacedoub3d0, + SAMRAI_F77_FUNC(lintimeintoutfacedoub3d0, LINTIMEINTOUTFACEDOUB3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -220,7 +216,7 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacedoub3d1, + SAMRAI_F77_FUNC(lintimeintoutfacedoub3d1, LINTIMEINTOUTFACEDOUB3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -233,7 +229,7 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutfacedoub3d2, + SAMRAI_F77_FUNC(lintimeintoutfacedoub3d2, LINTIMEINTOUTFACEDOUB3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -257,4 +253,3 @@ OuterfaceDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.h index 38c326ab..f7edd0a2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for double outerface patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OuterfaceDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.C index 1f55e7d5..dc13b919 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceFloatConstantRefine_C -#define included_pdat_OuterfaceFloatConstantRefine_C - #include "SAMRAI/pdat/OuterfaceFloatConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,7 +29,7 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefoutfaceflot1d, CONREFOUTFACEFLOT1D) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot1d, CONREFOUTFACEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -41,7 +37,7 @@ void F77_FUNC(conrefoutfaceflot1d, CONREFOUTFACEFLOT1D) (const int&, const int *, const float *, float *); // in conrefine2d.f: -void F77_FUNC(conrefoutfaceflot2d0, CONREFOUTFACEFLOT2D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot2d0, CONREFOUTFACEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(conrefoutfaceflot2d0, CONREFOUTFACEFLOT2D0) (const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefoutfaceflot2d1, CONREFOUTFACEFLOT2D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot2d1, CONREFOUTFACEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +60,7 @@ void F77_FUNC(conrefoutfaceflot2d1, CONREFOUTFACEFLOT2D1) (const int&, const int *, const float *, float *); // in conrefine3d.f: -void F77_FUNC(conrefoutfaceflot3d0, CONREFOUTFACEFLOT3D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot3d0, CONREFOUTFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(conrefoutfaceflot3d0, CONREFOUTFACEFLOT3D0) (const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefoutfaceflot3d1, CONREFOUTFACEFLOT3D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot3d1, CONREFOUTFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -86,7 +82,7 @@ void F77_FUNC(conrefoutfaceflot3d1, CONREFOUTFACEFLOT3D1) (const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefoutfaceflot3d2, CONREFOUTFACEFLOT3D2) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceflot3d2, CONREFOUTFACEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -102,9 +98,8 @@ void F77_FUNC(conrefoutfaceflot3d2, CONREFOUTFACEFLOT3D2) (const int&, namespace SAMRAI { namespace pdat { -OuterfaceFloatConstantRefine::OuterfaceFloatConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +OuterfaceFloatConstantRefine::OuterfaceFloatConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -120,9 +115,9 @@ OuterfaceFloatConstantRefine::getOperatorPriority() const } hier::IntVector -OuterfaceFloatConstantRefine::getStencilWidth() const +OuterfaceFloatConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -134,60 +129,63 @@ OuterfaceFloatConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const FaceOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefoutfaceflot1d, CONREFOUTFACEFLOT1D) ( + SAMRAI_F77_FUNC(conrefoutfaceflot1d, CONREFOUTFACEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -197,7 +195,7 @@ OuterfaceFloatConstantRefine::refine( fdata->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefoutfaceflot2d0, CONREFOUTFACEFLOT2D0) ( + SAMRAI_F77_FUNC(conrefoutfaceflot2d0, CONREFOUTFACEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -206,7 +204,7 @@ OuterfaceFloatConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfaceflot2d1, CONREFOUTFACEFLOT2D1) ( + SAMRAI_F77_FUNC(conrefoutfaceflot2d1, CONREFOUTFACEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -217,7 +215,7 @@ OuterfaceFloatConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefoutfaceflot3d0, CONREFOUTFACEFLOT3D0) ( + SAMRAI_F77_FUNC(conrefoutfaceflot3d0, CONREFOUTFACEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,7 +228,7 @@ OuterfaceFloatConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfaceflot3d1, CONREFOUTFACEFLOT3D1) ( + SAMRAI_F77_FUNC(conrefoutfaceflot3d1, CONREFOUTFACEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -243,7 +241,7 @@ OuterfaceFloatConstantRefine::refine( cdata->getPointer(1, i, d), fdata->getPointer(1, i, d)); } else if (axis == 2) { - F77_FUNC(conrefoutfaceflot3d2, CONREFOUTFACEFLOT3D2) ( + SAMRAI_F77_FUNC(conrefoutfaceflot3d2, CONREFOUTFACEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -269,4 +267,3 @@ OuterfaceFloatConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.h index 89e2b202..b5a0c15b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class OuterfaceFloatConstantRefine: /** * Uninteresting default constructor. */ - explicit OuterfaceFloatConstantRefine( - const tbox::Dimension& dim); + OuterfaceFloatConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class OuterfaceFloatConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class OuterfaceFloatConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.C index 8a3d12b2..23e0a378 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for float outerface patch data. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceFloatLinearTimeInterpolateOp_C -#define included_pdat_OuterfaceFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.h" #include "SAMRAI/pdat/OuterfaceData.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutfacefloat1d, LINTIMEINTOUTFACEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat1d, LINTIMEINTOUTFACEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,8 +41,8 @@ void F77_FUNC(lintimeintoutfacefloat1d, LINTIMEINTOUTFACEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutfacefloat2d0, - LINTIMEINTOUTFACEFLOAT2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat2d0, + LINTIMEINTOUTFACEFLOAT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,8 +53,8 @@ void F77_FUNC(lintimeintoutfacefloat2d0, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutfacefloat2d1, - LINTIMEINTOUTFACEFLOAT2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat2d1, + LINTIMEINTOUTFACEFLOAT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,8 +66,8 @@ void F77_FUNC(lintimeintoutfacefloat2d1, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutfacefloat3d0, - LINTIMEINTOUTFACEFLOAT3D0) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat3d0, + LINTIMEINTOUTFACEFLOAT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,8 +78,8 @@ void F77_FUNC(lintimeintoutfacefloat3d0, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutfacefloat3d1, - LINTIMEINTOUTFACEFLOAT3D1) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat3d1, + LINTIMEINTOUTFACEFLOAT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,8 +90,8 @@ void F77_FUNC(lintimeintoutfacefloat3d1, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutfacefloat3d2, - LINTIMEINTOUTFACEFLOAT3D2) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutfacefloat3d2, + LINTIMEINTOUTFACEFLOAT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OuterfaceData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OuterfaceData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OuterfaceData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,11 +168,11 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutfacefloat1d, + SAMRAI_F77_FUNC(lintimeintoutfacefloat1d, LINTIMEINTOUTFACEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -186,7 +182,7 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutfacefloat2d0, + SAMRAI_F77_FUNC(lintimeintoutfacefloat2d0, LINTIMEINTOUTFACEFLOAT2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -196,7 +192,7 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacefloat2d1, + SAMRAI_F77_FUNC(lintimeintoutfacefloat2d1, LINTIMEINTOUTFACEFLOAT2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -207,7 +203,7 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutfacefloat3d0, + SAMRAI_F77_FUNC(lintimeintoutfacefloat3d0, LINTIMEINTOUTFACEFLOAT3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -220,7 +216,7 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutfacefloat3d1, + SAMRAI_F77_FUNC(lintimeintoutfacefloat3d1, LINTIMEINTOUTFACEFLOAT3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -233,7 +229,7 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutfacefloat3d2, + SAMRAI_F77_FUNC(lintimeintoutfacefloat3d2, LINTIMEINTOUTFACEFLOAT3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -257,4 +253,3 @@ OuterfaceFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.h index ab6460c4..da26d8a9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for float outerface patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OuterfaceFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.C index e428ddc9..10d89bf1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_OuterfaceGeometry_C -#define included_pdat_OuterfaceGeometry_C - #include "SAMRAI/pdat/OuterfaceGeometry.h" #include "SAMRAI/pdat/FaceGeometry.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -35,6 +31,7 @@ OuterfaceGeometry::OuterfaceGeometry( d_box(box), d_ghosts(ghosts) { + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -68,23 +65,34 @@ OuterfaceGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); - const FaceGeometry* t_dst = + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); + + const FaceGeometry* t_dst_face = dynamic_cast(&dst_geometry); + const OuterfaceGeometry* t_dst_oface = + dynamic_cast(&dst_geometry); const OuterfaceGeometry* t_src = dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { - over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, + + if ((t_src != 0) && (t_dst_face != 0)) { + over = doOverlap(*t_dst_face, *t_src, src_mask, fill_box, + overwrite_interior, + transformation, dst_restrict_boxes); + } else if ((t_src != 0) && (t_dst_oface != 0)) { + over = doOverlap(*t_dst_oface, *t_src, src_mask, fill_box, + overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { - over = src_geometry.calculateOverlap( - dst_geometry, src_geometry, src_mask, fill_box, - overwrite_interior, transformation, false, dst_restrict_boxes); + over = src_geometry.calculateOverlap(dst_geometry, src_geometry, + src_mask, fill_box, overwrite_interior, + transformation, false, + dst_restrict_boxes); } return over; + } /* @@ -110,7 +118,7 @@ OuterfaceGeometry::doOverlap( { const tbox::Dimension& dim(src_mask.getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); // Perform a quick-and-dirty intersection to see if the boxes might overlap @@ -134,7 +142,7 @@ OuterfaceGeometry::doOverlap( hier::Box mask_shift(src_mask); transformation.transform(mask_shift); - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { const hier::Box msk_face( FaceGeometry::toFaceBox(mask_shift, d)); @@ -151,16 +159,16 @@ OuterfaceGeometry::doOverlap( // Add lower face intersection (if any) to the box list hier::Box low_face(src_face); - low_face.upper(0) = low_face.lower(0); //+ghosts; + low_face.setUpper(0, low_face.lower(0)); //+ghosts; hier::Box low_overlap(low_face * msk_face * dst_face); - if (!low_overlap.empty()) { + if (!low_overlap.empty()) { dst_boxes[d].pushBack(low_overlap); } // Add upper face intersection (if any) to the box list hier::Box hig_face(src_face); - hig_face.lower(0) = hig_face.upper(0); //-ghosts; + hig_face.setLower(0, hig_face.upper(0)); //-ghosts; hier::Box hig_overlap(hig_face * msk_face * dst_face); if (!hig_overlap.empty()) { @@ -175,15 +183,138 @@ OuterfaceGeometry::doOverlap( } // if (!together.empty()) - if (dst_restrict_boxes.size() && dst_boxes[d].size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { + hier::BoxContainer face_restrict_boxes; + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); + b != dst_restrict_boxes.end(); ++b) { + face_restrict_boxes.pushBack(FaceGeometry::toFaceBox(*b, d)); + } + dst_boxes[d].intersectBoxes(face_restrict_boxes); + } + + } // loop over dim + + } // if (!quick_check.empty()) + + // Create the face overlap data object using the boxes and source shift + + return boost::make_shared(dst_boxes, transformation); +} +/* + ************************************************************************* + * + * Compute the overlap between a face geometry destination box and an + * outerface geometry source box. The intersection algorithm is similar + * the face geometry algorithm except that only the borders of source + * are used in the intersection computation. + * + ************************************************************************* + */ + +boost::shared_ptr +OuterfaceGeometry::doOverlap( + const OuterfaceGeometry& dst_geometry, + const OuterfaceGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes) +{ + const tbox::Dimension& dim(src_mask.getDim()); + + std::vector dst_boxes(dim.getValue()); + + // Perform a quick-and-dirty intersection to see if the boxes might overlap + + hier::Box src_box(src_geometry.d_box); + src_box.grow(src_geometry.d_ghosts); + src_box = src_box * src_mask; + transformation.transform(src_box); + hier::Box dst_ghost(dst_geometry.getBox()); + dst_ghost.grow(dst_geometry.getGhosts()); + + // Compute the intersection (if any) for each of the face directions + + const hier::IntVector one_vector(dim, 1); + + const hier::Box quick_check( + hier::Box::grow(src_box, one_vector) * hier::Box::grow(dst_ghost, + one_vector)); + + if (!quick_check.empty()) { + + hier::Box mask_shift(src_mask); + transformation.transform(mask_shift); + + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { + + const hier::Box dst_face( + FaceGeometry::toFaceBox(dst_geometry.getBox(), d)); + const hier::Box src_face( + FaceGeometry::toFaceBox(src_box, d)); + const hier::Box fill_face( + FaceGeometry::toFaceBox(fill_box, d)); + + const hier::Box together(dst_face * src_face * fill_face); + + if (!together.empty()) { + + const hier::Box msk_face( + FaceGeometry::toFaceBox(mask_shift, d)); + + hier::Box low_dst_face(dst_face); + low_dst_face.setUpper(0, low_dst_face.lower(0)); + hier::Box hig_dst_face(dst_face); + hig_dst_face.setLower(0, hig_dst_face.upper(0)); + + // Add lower face intersection (if any) to the box list + hier::Box low_src_face(src_face); + low_src_face.setUpper(0, low_src_face.lower(0)); + + hier::Box low_low_overlap(low_src_face * msk_face * low_dst_face); + if (!low_low_overlap.empty()) { + dst_boxes[d].pushBack(low_low_overlap); + } + + hier::Box low_hig_overlap(low_src_face * msk_face * hig_dst_face); + if (!low_hig_overlap.empty()) { + dst_boxes[d].pushBack(low_hig_overlap); + } + + // Add upper face intersection (if any) to the box list + hier::Box hig_src_face(src_face); + hig_src_face.setLower(0, hig_src_face.upper(0)); //-ghosts; + + hier::Box hig_low_overlap(hig_src_face * msk_face * low_dst_face); + if (!hig_low_overlap.empty()) { + dst_boxes[d].pushBack(hig_low_overlap); + } + + hier::Box hig_hig_overlap(hig_src_face * msk_face * hig_dst_face); + if (!hig_hig_overlap.empty()) { + dst_boxes[d].pushBack(hig_hig_overlap); + } + + // Take away the interior of over_write interior is not set + if (!overwrite_interior) { + dst_boxes[d].removeIntersections( + FaceGeometry::toFaceBox(dst_geometry.getBox(), d)); + } + + } // if (!together.empty()) + + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { hier::BoxContainer face_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { face_restrict_boxes.pushBack(FaceGeometry::toFaceBox(*b, d)); } dst_boxes[d].intersectBoxes(face_restrict_boxes); } + dst_boxes[d].coalesce(); + } // loop over dim } // if (!quick_check.empty()) @@ -206,10 +337,11 @@ OuterfaceGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box face_box(FaceGeometry::toFaceBox(*b, d)); dst_boxes[d].pushBack(face_box); } @@ -222,4 +354,3 @@ OuterfaceGeometry::setUpOverlap( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.h index 5175a5c9..f6fe3b79 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -33,12 +33,12 @@ class FaceGeometry; * box geometries and face or outerface box geometries for communication * operations. * - * See header file for OuterfaceData class for a more detailed + * See header file for OuterfaceData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::FaceGeometry - * @see pdat::FaceOverlap + * @see FaceGeometry + * @see FaceOverlap */ class OuterfaceGeometry:public hier::BoxGeometry @@ -52,6 +52,9 @@ class OuterfaceGeometry:public hier::BoxGeometry /*! * @brief Construct an outerface geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ OuterfaceGeometry( const hier::Box& box, @@ -65,6 +68,8 @@ class OuterfaceGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in face-centered index space on the * boundaries of the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -120,9 +125,19 @@ class OuterfaceGeometry:public hier::BoxGeometry const hier::Transformation& transformation, const hier::BoxContainer& dst_restrict_boxes); + static boost::shared_ptr + doOverlap( + const OuterfaceGeometry& dst_geometry, + const OuterfaceGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes); + OuterfaceGeometry( const OuterfaceGeometry&); // not implemented - void + OuterfaceGeometry& operator = ( const OuterfaceGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.C index 6ce10219..518b838b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface int data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_OuterfaceIntegerConstantRefine_C -#define included_pdat_OuterfaceIntegerConstantRefine_C - #include "SAMRAI/pdat/OuterfaceIntegerConstantRefine.h" #include "SAMRAI/tbox/Utilities.h" @@ -33,7 +29,7 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefoutfaceintg1d, CONREFOUTFACEINTG1D) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg1d, CONREFOUTFACEINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -41,7 +37,7 @@ void F77_FUNC(conrefoutfaceintg1d, CONREFOUTFACEINTG1D) (const int&, const int *, const int *, int *); // in conrefine2d.f: -void F77_FUNC(conrefoutfaceintg2d0, CONREFOUTFACEINTG2D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg2d0, CONREFOUTFACEINTG2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -52,7 +48,7 @@ void F77_FUNC(conrefoutfaceintg2d0, CONREFOUTFACEINTG2D0) (const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefoutfaceintg2d1, CONREFOUTFACEINTG2D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg2d1, CONREFOUTFACEINTG2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +60,7 @@ void F77_FUNC(conrefoutfaceintg2d1, CONREFOUTFACEINTG2D1) (const int&, const int *, const int *, int *); // in conrefine3d.f: -void F77_FUNC(conrefoutfaceintg3d0, CONREFOUTFACEINTG3D0) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg3d0, CONREFOUTFACEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -75,7 +71,7 @@ void F77_FUNC(conrefoutfaceintg3d0, CONREFOUTFACEINTG3D0) (const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefoutfaceintg3d1, CONREFOUTFACEINTG3D1) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg3d1, CONREFOUTFACEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -86,7 +82,7 @@ void F77_FUNC(conrefoutfaceintg3d1, CONREFOUTFACEINTG3D1) (const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefoutfaceintg3d2, CONREFOUTFACEINTG3D2) (const int&, +void SAMRAI_F77_FUNC(conrefoutfaceintg3d2, CONREFOUTFACEINTG3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -102,9 +98,8 @@ void F77_FUNC(conrefoutfaceintg3d2, CONREFOUTFACEINTG3D2) (const int&, namespace SAMRAI { namespace pdat { -OuterfaceIntegerConstantRefine::OuterfaceIntegerConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +OuterfaceIntegerConstantRefine::OuterfaceIntegerConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -120,9 +115,9 @@ OuterfaceIntegerConstantRefine::getOperatorPriority() const } hier::IntVector -OuterfaceIntegerConstantRefine::getStencilWidth() const +OuterfaceIntegerConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -134,60 +129,63 @@ OuterfaceIntegerConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const FaceOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const FaceOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box& face_box = *b; - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, face_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, face_box); hier::Box fine_box(dim); - for (int i = 0; i < dim.getValue(); i++) { - fine_box.lower((axis + i) % dim.getValue()) = face_box.lower(i); - fine_box.upper((axis + i) % dim.getValue()) = face_box.upper(i); + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { + fine_box.setLower( + static_cast((axis + i) % dim.getValue()), + face_box.lower(i)); + fine_box.setUpper( + static_cast((axis + i) % dim.getValue()), + face_box.upper(i)); } - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { // loop over lower and upper outerface arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(conrefoutfaceintg1d, CONREFOUTFACEINTG1D) ( + SAMRAI_F77_FUNC(conrefoutfaceintg1d, CONREFOUTFACEINTG1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -197,7 +195,7 @@ OuterfaceIntegerConstantRefine::refine( fdata->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { if (axis == 0) { - F77_FUNC(conrefoutfaceintg2d0, CONREFOUTFACEINTG2D0) ( + SAMRAI_F77_FUNC(conrefoutfaceintg2d0, CONREFOUTFACEINTG2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -206,7 +204,7 @@ OuterfaceIntegerConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfaceintg2d1, CONREFOUTFACEINTG2D1) ( + SAMRAI_F77_FUNC(conrefoutfaceintg2d1, CONREFOUTFACEINTG2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -217,7 +215,7 @@ OuterfaceIntegerConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0) { - F77_FUNC(conrefoutfaceintg3d0, CONREFOUTFACEINTG3D0) ( + SAMRAI_F77_FUNC(conrefoutfaceintg3d0, CONREFOUTFACEINTG3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -230,7 +228,7 @@ OuterfaceIntegerConstantRefine::refine( cdata->getPointer(0, i, d), fdata->getPointer(0, i, d)); } else if (axis == 1) { - F77_FUNC(conrefoutfaceintg3d1, CONREFOUTFACEINTG3D1) ( + SAMRAI_F77_FUNC(conrefoutfaceintg3d1, CONREFOUTFACEINTG3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -243,7 +241,7 @@ OuterfaceIntegerConstantRefine::refine( cdata->getPointer(1, i, d), fdata->getPointer(1, i, d)); } else if (axis == 2) { - F77_FUNC(conrefoutfaceintg3d2, CONREFOUTFACEINTG3D2) ( + SAMRAI_F77_FUNC(conrefoutfaceintg3d2, CONREFOUTFACEINTG3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -269,4 +267,3 @@ OuterfaceIntegerConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.h index d0e61a93..157f0fa9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceIntegerConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for outerface integer data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class OuterfaceIntegerConstantRefine: /** * Uninteresting default constructor. */ - explicit OuterfaceIntegerConstantRefine( - const tbox::Dimension& dim); + OuterfaceIntegerConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class OuterfaceIntegerConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class OuterfaceIntegerConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.C index fb3dfa43..6b61e2dd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/OuterfaceDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -47,37 +47,12 @@ template int OuterfaceVariable::getDepth() const { boost::shared_ptr > factory( - getPatchDataFactory()); + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -OuterfaceVariable::OuterfaceVariable( - const OuterfaceVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void OuterfaceVariable::operator = ( - const OuterfaceVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.h index 978e9bb4..1b0de709 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuterfaceVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -22,23 +22,23 @@ namespace SAMRAI { namespace pdat { /*! - * @brief Class OuterfaceVariable is a templated variable class + * @brief Class OuterfaceVariable is a templated variable class * used to define face-centered data quantities only on patch boundaries. * It is a subclass of hier::Variable and is templated on the type * of the underlying data (e.g., double, int, bool, etc.). * * Note that the data layout in the outerface data arrays matches the corresponding * array sections provided by the face data implementation. See header file for - * the OuterfaceData class for a more detailed description of the data layout. + * the OuterfaceData class for a more detailed description of the data layout. * - * IMPORTANT: The class OutersideVariable and associated "outerside + * IMPORTANT: The class OutersideVariable and associated "outerside * data" classes define the same storage as this outerface variable class, * except that the individual array indices are not permuted in the outerside * data type. * - * @see pdat::FaceData - * @see pdat::OuterfaceData - * @see pdat::OuterfaceDataFactory + * @see FaceData + * @see OuterfaceData + * @see OuterfaceDataFactory * @see hier::Variable */ @@ -89,10 +89,10 @@ class OuterfaceVariable:public hier::Variable private: // neither of the following functions are implemented OuterfaceVariable( - const OuterfaceVariable&); - void + const OuterfaceVariable&); + OuterfaceVariable& operator = ( - const OuterfaceVariable&); + const OuterfaceVariable&); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.C index c2f8e0f5..b575f52c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outernode centered patch data type * ************************************************************************/ @@ -47,14 +47,16 @@ OuternodeData::OuternodeData( const tbox::Dimension& dim(box.getDim()); - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box nodebox = NodeGeometry::toNodeBox(box); - for (int dh = d + 1; dh < dim.getValue(); dh++) { + for (tbox::Dimension::dir_t dh = static_cast(d + 1); + dh < dim.getValue(); + ++dh) { /* - * For dimensions higher than d, narrow the box down to avoid + * For directions higher than d, narrow the box down to avoid * representing edge and corner nodes multiple times. * * i.e. Y--Y--Y outernodeX0 defined on nodes (0,1) @@ -64,23 +66,19 @@ OuternodeData::OuternodeData( * Y--Y--Y * node box */ - nodebox.lower(dh) += 1; - nodebox.upper(dh) -= 1; + nodebox.setLower(dh, nodebox.lower(dh) + 1); + nodebox.setUpper(dh, nodebox.upper(dh) - 1); } hier::Box outernodebox = nodebox; - outernodebox.upper(d) = nodebox.lower(d); - outernodebox.lower(d) = nodebox.lower(d); - if (outernodebox.size() > 0) { - d_data[d][0].initializeArray(outernodebox, depth); - } else { - d_data[d][0].invalidateArray(dim); - } + outernodebox.setUpper(d, nodebox.lower(d)); + outernodebox.setLower(d, nodebox.lower(d)); + d_data[d][0].reset(new ArrayData(outernodebox, depth)); outernodebox = nodebox; - outernodebox.lower(d) = nodebox.upper(d); - outernodebox.upper(d) = nodebox.upper(d); - d_data[d][1].initializeArray(outernodebox, depth); + outernodebox.setLower(d, nodebox.upper(d)); + outernodebox.setUpper(d, nodebox.upper(d)); + d_data[d][1].reset(new ArrayData(outernodebox, depth)); } } @@ -90,33 +88,6 @@ OuternodeData::~OuternodeData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -OuternodeData::OuternodeData( - const OuternodeData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) - -{ - NULL_USE(foo); -} - -template -void -OuternodeData::operator = ( - const OuternodeData& foo) -{ - NULL_USE(foo); -} - template int OuternodeData::getDepth() const @@ -131,11 +102,11 @@ OuternodeData::dataExists( { TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); - return d_data[face_normal][0].isInitialized(); + return d_data[face_normal][0]->isInitialized(); } template -TYPE* +TYPE * OuternodeData::getPointer( int face_normal, int side, @@ -145,11 +116,11 @@ OuternodeData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[face_normal][side].getPointer(depth); + return d_data[face_normal][side]->getPointer(depth); } template -const TYPE* +const TYPE * OuternodeData::getPointer( int face_normal, int side, @@ -159,7 +130,7 @@ OuternodeData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[face_normal][side].getPointer(depth); + return d_data[face_normal][side]->getPointer(depth); } template @@ -171,7 +142,7 @@ OuternodeData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[face_normal][side]; + return *(d_data[face_normal][side]); } template @@ -183,7 +154,7 @@ OuternodeData::getArrayData( TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[face_normal][side]; + return *(d_data[face_normal][side]); } template @@ -192,12 +163,15 @@ OuternodeData::operator () ( const NodeIndex& i, int depth) { - for (int d = getDim().getValue() - 1; d >= 0; d--) { - if (i[d] == d_data[d][0].getBox().lower()[d]) { - return d_data[d][0](i, depth); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); + TBOX_ASSERT((depth >= 0) && (depth < d_depth)); + + for (int d = getDim().getValue() - 1; d >= 0; --d) { + if (i[d] == d_data[d][0]->getBox().lower()[d]) { + return (*(d_data[d][0]))(i, depth); } - if (i[d] == d_data[d][1].getBox().upper()[d]) { - return d_data[d][1](i, depth); + if (i[d] == d_data[d][1]->getBox().upper()[d]) { + return (*(d_data[d][1]))(i, depth); } } @@ -207,7 +181,7 @@ OuternodeData::operator () ( */ TBOX_ERROR("Bad index used to access outernode data\n" << "Given index is not an outernode of this instance.\n"); - return d_data[0][0](i, depth); + return (*(d_data[0][0]))(i, depth); } template @@ -216,14 +190,15 @@ OuternodeData::operator () ( const NodeIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); + TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - for (int d = getDim() - 1; d >= 0; d--) { - if (i[d] == d_data[d][0].getBox().lower()[d]) { - return d_data[d][0](i, depth); + for (int d = getDim() - 1; d >= 0; --d) { + if (i[d] == d_data[d][0]->getBox().lower()[d]) { + return (*(d_data[d][0]))(i, depth); } - if (i[d] == d_data[d][1].getBox().upper()[d]) { - return d_data[d][1](i, depth); + if (i[d] == d_data[d][1]->getBox().upper()[d]) { + return (*(d_data[d][1]))(i, depth); } } /* @@ -232,7 +207,7 @@ OuternodeData::operator () ( */ TBOX_ERROR("Bad index used to access outernode data\n" << "Given index is not an outernode of this instance.\n"); - return d_data[0][0](i, depth); + return (*(d_data[0][0]))(i, depth); } /* @@ -249,16 +224,16 @@ void OuternodeData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const NodeData * const t_node_src = dynamic_cast *>(&src); const OuternodeData * const t_onode_src = dynamic_cast *>(&src); - if (t_node_src != NULL) { + if (t_node_src != 0) { copyFromNode(*t_node_src); - } else if (t_onode_src != NULL) { + } else if (t_onode_src != 0) { copyFromOuternode(*t_onode_src); } else { TBOX_ERROR("OuternodeData::copy error!\n" @@ -274,16 +249,14 @@ void OuternodeData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - NodeData* t_node_dst = - dynamic_cast *>(&dst); - OuternodeData* t_onode_dst = - dynamic_cast *>(&dst); + NodeData* t_node_dst = dynamic_cast *>(&dst); + OuternodeData* t_onode_dst = dynamic_cast *>(&dst); - if (t_node_dst != NULL) { + if (t_node_dst != 0) { copyToNode(*t_node_dst); - } else if (t_onode_dst != NULL) { + } else if (t_onode_dst != 0) { copyToOuternode(*t_onode_dst); } else { TBOX_ERROR("OuternodeData::copy2 error!\n" @@ -308,21 +281,20 @@ OuternodeData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const NodeData* t_node_src = dynamic_cast *>(&src); const OuternodeData* t_onode_src = dynamic_cast *>(&src); - if (t_node_src != NULL) { + if (t_node_src != 0) { copyFromNode(*t_node_src, *t_overlap); - } else if (t_onode_src != NULL) { + } else if (t_onode_src != 0) { copyFromOuternode(*t_onode_src, *t_overlap); } else { TBOX_ERROR("OuternodeData::copy error!\n" @@ -339,21 +311,18 @@ OuternodeData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - NodeData* t_node_dst = - dynamic_cast *>(&dst); - OuternodeData* t_onode_dst = - dynamic_cast *>(&dst); + NodeData* t_node_dst = dynamic_cast *>(&dst); + OuternodeData* t_onode_dst = dynamic_cast *>(&dst); - if (t_node_dst != NULL) { + if (t_node_dst != 0) { copyToNode(*t_node_dst, *t_overlap); - } else if (t_onode_dst != NULL) { + } else if (t_onode_dst != 0) { copyToOuternode(*t_onode_dst, *t_overlap); } else { TBOX_ERROR("OuternodeData::copy2 error!\n" @@ -380,12 +349,12 @@ OuternodeData::copyDepth( const NodeData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const ArrayData& node_array = src.getArrayData(); - for (int d = 0; d < getDim().getValue(); d++) { - for (int loc = 0; loc < 2; loc++) { - ArrayData& onode_array = d_data[d][loc]; + for (int d = 0; d < getDim().getValue(); ++d) { + for (int loc = 0; loc < 2; ++loc) { + ArrayData& onode_array = *(d_data[d][loc]); onode_array.copyDepth(dst_depth, node_array, src_depth, @@ -410,12 +379,12 @@ OuternodeData::copyDepth2( NodeData& dst, int src_depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); ArrayData& node_array = dst.getArrayData(); - for (int d = 0; d < getDim().getValue(); d++) { - for (int loc = 0; loc < 2; loc++) { - const ArrayData& onode_array = d_data[d][loc]; + for (int d = 0; d < getDim().getValue(); ++d) { + for (int loc = 0; loc < 2; ++loc) { + const ArrayData& onode_array = *(d_data[d][loc]); node_array.copyDepth(dst_depth, onode_array, src_depth, @@ -438,15 +407,16 @@ OuternodeData::sum( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const OuternodeData* t_onode_src = - dynamic_cast *>(&src); + CPP_CAST *>(&src); + + TBOX_ASSERT(t_onode_src != 0); // NOTE: We assume this operation is only needed to // copy and add data to another outernode data @@ -454,36 +424,27 @@ OuternodeData::sum( // data or other flavors of the copy operation, we // should refactor the routine similar to the way // the regular copy operations are implemented. - if (t_onode_src == NULL) { - TBOX_ERROR("OuternodeData::sum error!\n" - << "Can copy and add only from OuternodeData " - << "of the same dim and TYPE."); - } else { - - const hier::IntVector& src_offset = t_overlap->getSourceOffset(); + const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int src_d = 0; src_d < getDim().getValue(); src_d++) { - for (int src_p = 0; src_p < 2; src_p++) { + for (int src_d = 0; src_d < getDim().getValue(); ++src_d) { + for (int src_p = 0; src_p < 2; ++src_p) { - const ArrayData& src_array = - t_onode_src->d_data[src_d][src_p]; - const hier::BoxContainer& box_list = - t_overlap->getDestinationBoxContainer(); + const ArrayData& src_array = + *(t_onode_src->d_data[src_d][src_p]); + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(); - for (int dst_d = 0; dst_d < getDim().getValue(); dst_d++) { - for (int dst_p = 0; dst_p < 2; dst_p++) { - if (d_data[dst_d][dst_p].isInitialized()) { - d_data[dst_d][dst_p].sum( - src_array, box_list, src_offset); - } + for (int dst_d = 0; dst_d < getDim().getValue(); ++dst_d) { + for (int dst_p = 0; dst_p < 2; ++dst_p) { + if (d_data[dst_d][dst_p]->isInitialized()) { + d_data[dst_d][dst_p]->sum( + src_array, box_list, src_offset); } } - } - } + } } - } /* @@ -503,21 +464,20 @@ OuternodeData::canEstimateStreamSizeFromBox() const } template -int +size_t OuternodeData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); - int size = 0; + size_t size = 0; const hier::BoxContainer& boxlist = t_overlap->getDestinationBoxContainer(); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { - size += d_data[d][0].getDataStreamSize(boxlist, src_offset); - size += d_data[d][1].getDataStreamSize(boxlist, src_offset); + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { + size += d_data[d][0]->getDataStreamSize(boxlist, src_offset); + size += d_data[d][1]->getDataStreamSize(boxlist, src_offset); } return size; } @@ -537,24 +497,23 @@ OuternodeData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { const hier::Box src_box = hier::Box::shift(*dst_box, -src_offset); - for (int d = 0; d < getDim().getValue(); d++) { - for (int loc = 0; loc < 2; loc++) { - const hier::Box intersect = src_box * d_data[d][loc].getBox(); + for (int d = 0; d < getDim().getValue(); ++d) { + for (int loc = 0; loc < 2; ++loc) { + const hier::Box intersect = src_box * d_data[d][loc]->getBox(); if (!intersect.empty()) { const hier::Box pack_box = hier::Box::shift(intersect, src_offset); - d_data[d][loc].packStream(stream, pack_box, src_offset); + d_data[d][loc]->packStream(stream, pack_box, src_offset); } } } @@ -567,21 +526,20 @@ OuternodeData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { - for (int d = 0; d < getDim().getValue(); d++) { - for (int f = 0; f < 2; f++) { + for (int d = 0; d < getDim().getValue(); ++d) { + for (int f = 0; f < 2; ++f) { const hier::Box intersect = - (*dst_box) * d_data[d][f].getBox(); + (*dst_box) * d_data[d][f]->getBox(); if (!intersect.empty()) { - d_data[d][f].unpackStream(stream, intersect, src_offset); + d_data[d][f]->unpackStream(stream, intersect, src_offset); } } } @@ -603,21 +561,20 @@ OuternodeData::unpackStreamAndSum( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const NodeOverlap* t_overlap = - dynamic_cast(&overlap); + const NodeOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::BoxContainer& dst_boxes = t_overlap->getDestinationBoxContainer(); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { - for (hier::BoxContainer::const_iterator dst_box(dst_boxes); + for (int d = 0; d < getDim().getValue(); ++d) { + for (hier::BoxContainer::const_iterator dst_box = dst_boxes.begin(); dst_box != dst_boxes.end(); ++dst_box) { - for (int f = 0; f < 2; f++) { + for (int f = 0; f < 2; ++f) { const hier::Box intersect = - (*dst_box) * d_data[d][f].getBox(); + (*dst_box) * d_data[d][f]->getBox(); if (!intersect.empty()) { - d_data[d][f].unpackStreamAndSum(stream, intersect, src_offset); + d_data[d][f]->unpackStreamAndSum(stream, intersect, src_offset); } } } @@ -642,24 +599,26 @@ OuternodeData::getSizeOfData( TBOX_ASSERT(depth > 0); size_t size = 0; - for (int d = 0; d < box.getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < box.getDim().getValue(); ++d) { hier::Box loc0 = NodeGeometry::toNodeBox(box); hier::Box loc1 = NodeGeometry::toNodeBox(box); - loc0.upper(d) = box.lower(d); - loc0.lower(d) = box.lower(d); - loc1.lower(d) = box.upper(d); - loc1.upper(d) = box.upper(d); + loc0.setUpper(d, box.lower(d)); + loc0.setLower(d, box.lower(d)); + loc1.setLower(d, box.upper(d)); + loc1.setUpper(d, box.upper(d)); - for (int dh = d + 1; dh < box.getDim().getValue(); dh++) { + for (tbox::Dimension::dir_t dh = static_cast(d + 1); + dh < box.getDim().getValue(); + ++dh) { /* - * For dimensions higher than d, narrow the box down to avoid + * For directions higher than d, narrow the box down to avoid * representing edge and corner nodes multiple times. */ - loc0.lower(dh) += 1; - loc0.upper(dh) -= 1; - loc1.lower(dh) += 1; - loc1.upper(dh) -= 1; + loc0.setLower(dh, loc0.lower(dh) + 1); + loc0.setUpper(dh, loc0.upper(dh) - 1); + loc1.setLower(dh, loc1.lower(dh) + 1); + loc1.setUpper(dh, loc1.upper(dh) - 1); } size += ArrayData::getSizeOfData(loc0, depth) + ArrayData::getSizeOfData(loc1, depth); @@ -670,8 +629,8 @@ OuternodeData::getSizeOfData( /* ************************************************************************* * - * Compute the box of valid node indices given values of - * dimension and side designating the set of data indices. + * Compute the box of valid node indices given + * direction and side designating the set of data indices. * ************************************************************************* */ @@ -679,10 +638,10 @@ OuternodeData::getSizeOfData( template hier::Box OuternodeData::getDataBox( - int face_normal, + tbox::Dimension::dir_t face_normal, int side) { - if (face_normal < 0 || face_normal >= getDim().getValue() || side < 0 || side > 1) { + if (face_normal >= getDim().getValue() || side < 0 || side > 1) { TBOX_ERROR("Bad values for face_normal and/or side in\n" "OuternodeData::getDataBox().\n"); } @@ -694,24 +653,26 @@ OuternodeData::getDataBox( hier::Box databox = NodeGeometry::toNodeBox(getBox()); const hier::IntVector& ghosts = getGhostCellWidth(); - for (int dh = face_normal + 1; dh < getDim().getValue(); dh++) { + for (tbox::Dimension::dir_t dh = static_cast(face_normal + 1); + dh < getDim().getValue(); + ++dh) { /* - * For dimensions higher than d, narrow the box down to avoid + * For directions higher than d, narrow the box down to avoid * representing edge and corner nodes multiple times. */ - databox.lower(dh) += 1; - databox.upper(dh) -= 1; + databox.setLower(dh, databox.lower(dh) + 1); + databox.setUpper(dh, databox.upper(dh) - 1); } if (side == 0) { - databox.upper(face_normal) = databox.lower(face_normal); - databox.lower(face_normal) = databox.lower(face_normal) - - ghosts(face_normal); + databox.setUpper(face_normal, databox.lower(face_normal)); + databox.setLower(face_normal, + databox.lower(face_normal) - ghosts(face_normal)); } else { // side == 1 - databox.lower(face_normal) = databox.upper(face_normal); - databox.upper(face_normal) = databox.upper(face_normal) - + ghosts(face_normal); + databox.setLower(face_normal, databox.upper(face_normal)); + databox.setUpper(face_normal, + databox.upper(face_normal) + ghosts(face_normal)); } return databox; } @@ -732,12 +693,12 @@ OuternodeData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - if (d_data[i][0].isInitialized()) { - d_data[i][0].fill(t, d); + for (int i = 0; i < getDim().getValue(); ++i) { + if (d_data[i][0]->isInitialized()) { + d_data[i][0]->fill(t, d); } - if (d_data[i][1].isInitialized()) { - d_data[i][1].fill(t, d); + if (d_data[i][1]->isInitialized()) { + d_data[i][1]->fill(t, d); } } } @@ -749,15 +710,15 @@ OuternodeData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - if (d_data[i][0].isInitialized()) { - d_data[i][0].fill(t, NodeGeometry::toNodeBox(box), d); + for (int i = 0; i < getDim().getValue(); ++i) { + if (d_data[i][0]->isInitialized()) { + d_data[i][0]->fill(t, NodeGeometry::toNodeBox(box), d); } - if (d_data[i][1].isInitialized()) { - d_data[i][1].fill(t, NodeGeometry::toNodeBox(box), d); + if (d_data[i][1]->isInitialized()) { + d_data[i][1]->fill(t, NodeGeometry::toNodeBox(box), d); } } } @@ -767,12 +728,12 @@ void OuternodeData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { - if (d_data[i][0].isInitialized()) { - d_data[i][0].fillAll(t); + for (int i = 0; i < getDim().getValue(); ++i) { + if (d_data[i][0]->isInitialized()) { + d_data[i][0]->fillAll(t); } - if (d_data[i][1].isInitialized()) { - d_data[i][1].fillAll(t); + if (d_data[i][1]->isInitialized()) { + d_data[i][1]->fillAll(t); } } } @@ -783,14 +744,14 @@ OuternodeData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int i = 0; i < getDim().getValue(); i++) { - if (d_data[i][0].isInitialized()) { - d_data[i][0].fillAll(t, NodeGeometry::toNodeBox(box)); + for (int i = 0; i < getDim().getValue(); ++i) { + if (d_data[i][0]->isInitialized()) { + d_data[i][0]->fillAll(t, NodeGeometry::toNodeBox(box)); } - if (d_data[i][1].isInitialized()) { - d_data[i][1].fillAll(t, NodeGeometry::toNodeBox(box)); + if (d_data[i][1]->isInitialized()) { + d_data[i][1]->fillAll(t, NodeGeometry::toNodeBox(box)); } } } @@ -809,12 +770,12 @@ void OuternodeData::copyFromNode( const NodeData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const ArrayData& node_array = src.getArrayData(); - for (int d = 0; d < getDim().getValue(); d++) { - for (int loc = 0; loc < 2; loc++) { - ArrayData& onode_array = d_data[d][loc]; + for (int d = 0; d < getDim().getValue(); ++d) { + for (int loc = 0; loc < 2; ++loc) { + ArrayData& onode_array = *(d_data[d][loc]); if (onode_array.isInitialized()) { onode_array.copy(node_array, onode_array.getBox()); } @@ -827,13 +788,13 @@ void OuternodeData::copyToNode( NodeData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); ArrayData& node_array = dst.getArrayData(); - for (int d = 0; d < getDim().getValue(); d++) { - for (int loc = 0; loc < 2; loc++) { - if (d_data[d][loc].isInitialized()) { - node_array.copy(d_data[d][loc], d_data[d][loc].getBox()); + for (int d = 0; d < getDim().getValue(); ++d) { + for (int loc = 0; loc < 2; ++loc) { + if (d_data[d][loc]->isInitialized()) { + node_array.copy(*(d_data[d][loc]), d_data[d][loc]->getBox()); } } } @@ -854,16 +815,16 @@ OuternodeData::copyFromNode( const NodeData& src, const NodeOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const hier::IntVector& src_offset = overlap.getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& box_list = overlap.getDestinationBoxContainer(); - if (d_data[d][0].isInitialized()) { - d_data[d][0].copy(src.getArrayData(), box_list, src_offset); + if (d_data[d][0]->isInitialized()) { + d_data[d][0]->copy(src.getArrayData(), box_list, src_offset); } - if (d_data[d][1].isInitialized()) { - d_data[d][1].copy(src.getArrayData(), box_list, src_offset); + if (d_data[d][1]->isInitialized()) { + d_data[d][1]->copy(src.getArrayData(), box_list, src_offset); } } } @@ -874,16 +835,16 @@ OuternodeData::copyToNode( NodeData& dst, const NodeOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); const hier::IntVector& src_offset = overlap.getSourceOffset(); const hier::BoxContainer& box_list = overlap.getDestinationBoxContainer(); - for (int d = 0; d < getDim().getValue(); d++) { - if (d_data[d][0].isInitialized()) { - dst.getArrayData().copy(d_data[d][0], box_list, src_offset); + for (int d = 0; d < getDim().getValue(); ++d) { + if (d_data[d][0]->isInitialized()) { + dst.getArrayData().copy(*(d_data[d][0]), box_list, src_offset); } - if (d_data[d][1].isInitialized()) { - dst.getArrayData().copy(d_data[d][1], box_list, src_offset); + if (d_data[d][1]->isInitialized()) { + dst.getArrayData().copy(*(d_data[d][1]), box_list, src_offset); } } } @@ -893,16 +854,16 @@ void OuternodeData::copyFromOuternode( const OuternodeData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - for (int src_d = 0; src_d < getDim().getValue(); src_d++) { - for (int src_p = 0; src_p < 2; src_p++) { + for (int src_d = 0; src_d < getDim().getValue(); ++src_d) { + for (int src_p = 0; src_p < 2; ++src_p) { - const ArrayData& src_array = src.d_data[src_d][src_p]; + const ArrayData& src_array = *(src.d_data[src_d][src_p]); - for (int dst_d = 0; dst_d < getDim().getValue(); dst_d++) { - for (int dst_p = 0; dst_p < 2; dst_p++) { - ArrayData& onode_array = d_data[dst_d][dst_p]; + for (int dst_d = 0; dst_d < getDim().getValue(); ++dst_d) { + for (int dst_p = 0; dst_p < 2; ++dst_p) { + ArrayData& onode_array = *(d_data[dst_d][dst_p]); if (onode_array.isInitialized()) { onode_array.copy(src_array, onode_array.getBox()); } @@ -918,19 +879,19 @@ OuternodeData::copyFromOuternode( const OuternodeData& src, const NodeOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const hier::IntVector& src_offset = overlap.getSourceOffset(); - for (int src_d = 0; src_d < getDim().getValue(); src_d++) { - for (int src_p = 0; src_p < 2; src_p++) { + for (int src_d = 0; src_d < getDim().getValue(); ++src_d) { + for (int src_p = 0; src_p < 2; ++src_p) { - const ArrayData& src_array = src.d_data[src_d][src_p]; + const ArrayData& src_array = *(src.d_data[src_d][src_p]); const hier::BoxContainer& box_list = overlap.getDestinationBoxContainer(); - for (int dst_d = 0; dst_d < getDim().getValue(); dst_d++) { - for (int dst_p = 0; dst_p < 2; dst_p++) { - if (d_data[dst_d][dst_p].isInitialized()) { - d_data[dst_d][dst_p].copy(src_array, box_list, src_offset); + for (int dst_d = 0; dst_d < getDim().getValue(); ++dst_d) { + for (int dst_p = 0; dst_p < 2; ++dst_p) { + if (d_data[dst_d][dst_p]->isInitialized()) { + d_data[dst_d][dst_p]->copy(src_array, box_list, src_offset); } } } @@ -943,18 +904,18 @@ void OuternodeData::copyToOuternode( OuternodeData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - for (int dst_d = 0; dst_d < getDim().getValue(); dst_d++) { - for (int dst_p = 0; dst_p < 2; dst_p++) { + for (int dst_d = 0; dst_d < getDim().getValue(); ++dst_d) { + for (int dst_p = 0; dst_p < 2; ++dst_p) { - ArrayData& dst_array = dst.d_data[dst_d][dst_p]; + ArrayData& dst_array = *(dst.d_data[dst_d][dst_p]); - for (int src_d = 0; src_d < getDim().getValue(); src_d++) { - for (int src_p = 0; src_p < 2; src_p++) { - if (d_data[src_d][src_p].isInitialized()) { - dst_array.copy(d_data[src_d][src_p], - d_data[src_d][src_p].getBox()); + for (int src_d = 0; src_d < getDim().getValue(); ++src_d) { + for (int src_p = 0; src_p < 2; ++src_p) { + if (d_data[src_d][src_p]->isInitialized()) { + dst_array.copy(*(d_data[src_d][src_p]), + d_data[src_d][src_p]->getBox()); } } } @@ -968,19 +929,19 @@ OuternodeData::copyToOuternode( OuternodeData& dst, const NodeOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); const hier::IntVector& src_offset = overlap.getSourceOffset(); const hier::BoxContainer& box_list = overlap.getDestinationBoxContainer(); - for (int dst_d = 0; dst_d < getDim().getValue(); dst_d++) { - for (int dst_p = 0; dst_p < 2; dst_p++) { + for (int dst_d = 0; dst_d < getDim().getValue(); ++dst_d) { + for (int dst_p = 0; dst_p < 2; ++dst_p) { - ArrayData& dst_array = dst.d_data[dst_d][dst_p]; - for (int src_d = 0; src_d < getDim().getValue(); src_d++) { - for (int src_p = 0; src_p < 2; src_p++) { - if (d_data[src_d][src_p].isInitialized()) { - dst_array.copy(d_data[src_d][src_p], box_list, src_offset); + ArrayData& dst_array = *(dst.d_data[dst_d][dst_p]); + for (int src_d = 0; src_d < getDim().getValue(); ++src_d) { + for (int src_p = 0; src_p < 2; ++src_p) { + if (d_data[src_d][src_p]->isInitialized()) { + dst_array.copy(*(d_data[src_d][src_p]), box_list, src_offset); } } } @@ -1003,9 +964,9 @@ OuternodeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { print(box, d, os, prec); } } @@ -1018,12 +979,12 @@ OuternodeData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { os << "Array axis = " << axis << std::endl; - for (int side = 0; side < 2; side++) { + for (int side = 0; side < 2; ++side) { os << "Side = " << ((side == 0) ? "lower" : "upper") << std::endl; printAxisSide(axis, side, box, depth, os, prec); } @@ -1039,11 +1000,11 @@ OuternodeData::printAxisSide( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxisSide(face_normal, side, box, d, os, prec); } @@ -1059,18 +1020,19 @@ OuternodeData::printAxisSide( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); TBOX_ASSERT((face_normal >= 0) && (face_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); const hier::Box nodebox = NodeGeometry::toNodeBox(box); - const hier::Box region = nodebox * d_data[face_normal][side].getBox(); + const hier::Box region = nodebox * d_data[face_normal][side]->getBox(); os.precision(prec); - hier::Box::iterator iend(region, false); - for (hier::Box::iterator i(region, true); i != iend; ++i) { + hier::Box::iterator iend(region.end()); + for (hier::Box::iterator i(region.begin()); i != iend; ++i) { os << "array" << *i << " = " - << d_data[face_normal][side](*i, depth) << std::endl << std::flush; + << (*(d_data[face_normal][side]))(*i, depth) << std::endl + << std::flush; } } @@ -1078,7 +1040,7 @@ OuternodeData::printAxisSide( ************************************************************************* * * Checks that class version and restart file version are equal. - * If so, reads in d_depth from the database. + * If so, reads in d_depth from the restart database. * Then has each item in d_data read in its data from the database. * ************************************************************************* @@ -1086,32 +1048,34 @@ OuternodeData::printAxisSide( template void -OuternodeData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +OuternodeData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - int ver = database->getInteger("PDAT_OUTERNODEDATA_VERSION"); + hier::PatchData::getFromRestart(restart_db); + + int ver = restart_db->getInteger("PDAT_OUTERNODEDATA_VERSION"); if (ver != PDAT_OUTERNODEDATA_VERSION) { - TBOX_ERROR("OuternodeData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("OuternodeData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - if (database->keyExists(array_name)) { - array_database = database->getDatabase(array_name); - (d_data[i][0]).getFromDatabase(array_database); + if (restart_db->keyExists(array_name)) { + array_database = restart_db->getDatabase(array_name); + d_data[i][0]->getFromRestart(array_database); } array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; - if (database->keyExists(array_name)) { - array_database = database->getDatabase(array_name); - (d_data[i][1]).getFromDatabase(array_database); + if (restart_db->keyExists(array_name)) { + array_database = restart_db->getDatabase(array_name); + d_data[i][1]->getFromRestart(array_database); } } } @@ -1119,7 +1083,7 @@ OuternodeData::getSpecializedFromDatabase( /* ************************************************************************* * - * Writes out class version number, d_depth to the database. + * Writes out class version number, d_depth to the restart database. * Then has each item in d_data write out its data to the database. * ************************************************************************* @@ -1127,28 +1091,30 @@ OuternodeData::getSpecializedFromDatabase( template void -OuternodeData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +OuternodeData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_OUTERNODEDATA_VERSION", + restart_db->putInteger("PDAT_OUTERNODEDATA_VERSION", PDAT_OUTERNODEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); std::string array_name; boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { - if (d_data[i][0].isInitialized()) { + for (int i = 0; i < getDim().getValue(); ++i) { + if (d_data[i][0]->isInitialized()) { array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - array_database = database->putDatabase(array_name); - (d_data[i][0]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i][0]->putToRestart(array_database); } - if (d_data[i][1].isInitialized()) { + if (d_data[i][1]->isInitialized()) { array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; - array_database = database->putDatabase(array_name); - (d_data[i][1]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i][1]->putToRestart(array_database); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.h index 96b48979..a47a1808 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outernode centered patch data type * ************************************************************************/ @@ -21,14 +21,14 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class OuternodeData provides an implementation for data defined + * @brief Class OuternodeData provides an implementation for data defined * at cell nodes on the boundaries of AMR patches. It is derived from the * hier::PatchData interface common to all SAMRAI patch data types. Given * a CELL-centered AMR index space box, an outernode data object represents @@ -69,7 +69,7 @@ namespace pdat { * Note: Boxes are trimmed at edges intersecting faces with * normal directions 1 and 2 so that node indices shared * with those faces appear in data arrays associated with - * higher dimension faces. + * higher direction faces. * * face normal 1: * lower [ l0 : u0+1 , l1 : l1 , l2+1 : u2 , d ] @@ -77,7 +77,7 @@ namespace pdat { * Note: Boxes are trimmed at edges intersecting faces with * normal direction 2 so that node indices shared * with those faces appear in data arrays associated with - * higher dimension faces. + * higher direction faces. * * face normal 2: * lower [ l0 : u0+1 , l1 : u1+1 , l2 : l2 , d ] @@ -90,12 +90,12 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::OuternodeDataFactory - * @see pdat::OuternodeGeometry - * @see pdat::NodeIterator - * @see pdat::NodeIndex + * @see OuternodeDataFactory + * @see OuternodeGeometry + * @see NodeIterator + * @see NodeIndex */ template @@ -116,6 +116,8 @@ class OuternodeData:public hier::PatchData * Note: the ghost cell width is assumed to be zero. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ static size_t getSizeOfData( @@ -132,6 +134,8 @@ class OuternodeData:public hier::PatchData * outernode data object will be created. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ OuternodeData( const hier::Box& box, @@ -153,8 +157,9 @@ class OuternodeData:public hier::PatchData * @brief Returns true if outernode data exists for the given * face normal direction; false otherwise. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) */ bool dataExists( @@ -165,26 +170,30 @@ class OuternodeData:public hier::PatchData * outernode data. Note: the returned box * will reside in the @em node index space. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outernode * data array + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ hier::Box getDataBox( - int face_normal, + tbox::Dimension::dir_t face_normal, int side); /*! * @brief Get a pointer to the beginning of a particular face normal, * side, and depth component of the outernode centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outernode * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -196,12 +205,14 @@ class OuternodeData:public hier::PatchData * @brief Get a const pointer to the beginning of a particular face * normal, side, and depth component of the outernode centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outernode * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -215,8 +226,10 @@ class OuternodeData:public hier::PatchData * * @param i const reference to NodeIndex, @em MUST be * an index on the outernode of the box. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -229,8 +242,10 @@ class OuternodeData:public hier::PatchData * * @param i const reference to NodeIndex, @em MUST be * an index on the outernode of the box. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre getDim() == i.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -241,10 +256,12 @@ class OuternodeData:public hier::PatchData * @brief Return a reference to the array data object for * face normal, and side index of the outernode centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outeredge * data array + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue())); + * @pre (side == 0) || (side == 1) */ ArrayData& getArrayData( @@ -255,10 +272,12 @@ class OuternodeData:public hier::PatchData * @brief Return a const reference to the array data object for * face normal, and side index of the outernode centered array. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outeredge * data array + * + * @pre (face_normal >= 0) && (face_normal < getDim().getValue())); + * @pre (side == 0) || (side == 1) */ const ArrayData& getArrayData( @@ -274,6 +293,10 @@ class OuternodeData:public hier::PatchData * both the source and destination). Currently, source data must be * either NodeData or OuternodeData of the same DIM and TYPE. If not, * then an unrecoverable error results. + * + * @pre getDim() == src.getDim() + * @pre (dynamic_cast *>(&src) != 0) || + * (dynamic_cast *>(&src) != 0) */ virtual void copy( @@ -288,6 +311,10 @@ class OuternodeData:public hier::PatchData * both the source and destination). Currently, destination data must be * either NodeData or OuternodeData of the same DIM and TYPE. If not, * then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre (dynamic_cast *>(&dst) != 0) || + * (dynamic_cast *>(&dst) != 0) */ virtual void copy2( @@ -301,6 +328,11 @@ class OuternodeData:public hier::PatchData * of the same DIM and TYPE and the overlap must be an NodeOverlap * of the same DIM. If not, then an unrecoverable error * results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre (dynamic_cast *>(&src) != 0) || + * (dynamic_cast *>(&src) != 0) */ virtual void copy( @@ -315,6 +347,11 @@ class OuternodeData:public hier::PatchData * of the same DIM and TYPE and the overlap must be an NodeOverlap * of the same DIM. If not, then an unrecoverable error * results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre (dynamic_cast *>(&dst) != 0) || + * (dynamic_cast *>(&dst) != 0) */ virtual void copy2( @@ -325,6 +362,8 @@ class OuternodeData:public hier::PatchData * @brief Fast copy (i.e., assumes node and outernode data objects are * defined over the same box) from the given node source data object to * this destination outernode data object at the specified depths. + * + * @pre getDim() == src.getDim() */ void copyDepth( @@ -336,6 +375,8 @@ class OuternodeData:public hier::PatchData * @brief Fast copy (i.e., assumes node and outernode data objects are * defined over the same box) to the given node destination data object * from this source outernode data object at the specified depths. + * + * @pre getDim() == dst.getDim() */ void copyDepth2( @@ -350,6 +391,10 @@ class OuternodeData:public hier::PatchData * Currently, source data must be OuternodeData of the same DIM and * TYPE and the overlap must be an EdgeOverlap of the same DIM. * If not, then an unrecoverable error results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast(&overlap) != 0 + * @pre dynamic_cast *>(&src) != 0 */ virtual void sum( @@ -374,8 +419,10 @@ class OuternodeData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -383,6 +430,8 @@ class OuternodeData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * NodeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -393,6 +442,8 @@ class OuternodeData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * NodeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -403,6 +454,8 @@ class OuternodeData:public hier::PatchData * @brief Unpack data from stream and add into this patch data object * over the specified box overlap region. The overlap must be an * NodeOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStreamAndSum( @@ -411,6 +464,8 @@ class OuternodeData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -419,6 +474,9 @@ class OuternodeData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -435,6 +493,8 @@ class OuternodeData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -450,10 +510,12 @@ class OuternodeData:public hier::PatchData * and will be converted to node index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -468,14 +530,16 @@ class OuternodeData:public hier::PatchData * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to node index space. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -489,8 +553,7 @@ class OuternodeData:public hier::PatchData * face_normal and side residing in the specified box. * If the depth of the data is greater than one, all depths are printed. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outernode * data array * @param box const reference to box over whioch to print data. Note box @@ -498,10 +561,14 @@ class OuternodeData:public hier::PatchData * and will be converted to node index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( @@ -515,21 +582,24 @@ class OuternodeData:public hier::PatchData * @brief Print all outernode centered data values for specified * face_normal, side, and depth residing in the specified box. * - * @param face_normal integer face normal direction for data, - * must satisfy 0 <= face_normal < DIM + * @param face_normal integer face normal direction for data * @param side integer lower (0) or upper (1) side of outernode * data array * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to node index space. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (face_normal >= 0) && (face_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( @@ -542,23 +612,23 @@ class OuternodeData:public hier::PatchData /*! * @brief Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * @brief Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: /* @@ -566,10 +636,14 @@ class OuternodeData:public hier::PatchData */ static const int PDAT_OUTERNODEDATA_VERSION; - OuternodeData(const OuternodeData&); // not implemented - void + // Unimplemented copy constructor + OuternodeData( + const OuternodeData&); + + // Unimplemented assignment operator + OuternodeData& operator = ( - const OuternodeData&); // not implemented + const OuternodeData&); //@ //! @name Internal implementations of data copy operations. @@ -604,7 +678,8 @@ class OuternodeData:public hier::PatchData //@ int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE][2]; + + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL][2]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.C index 5d6a2fcb..f7fb4539 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outernode data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/pdat/OuternodeGeometry.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -61,11 +61,11 @@ boost::shared_ptr OuternodeDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - ghosts.getDim(), - d_depth); + ghosts.getDim(), + d_depth); } /* @@ -81,7 +81,7 @@ boost::shared_ptr OuternodeDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >(patch.getBox(), d_depth); } @@ -99,7 +99,7 @@ boost::shared_ptr OuternodeDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const hier::IntVector& zero_vector(hier::IntVector::getZero(getDim())); @@ -126,7 +126,7 @@ size_t OuternodeDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(OuternodeData)); const size_t data = OuternodeData::getSizeOfData(box, @@ -148,7 +148,7 @@ bool OuternodeDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -157,8 +157,8 @@ OuternodeDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > ndf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (ndf) { valid_copy = true; } @@ -166,8 +166,9 @@ OuternodeDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > ondf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (ondf) { valid_copy = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.h index c8a4c64d..62bd35c3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outernode data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -32,8 +32,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::OuternodeData - * @see pdat::PatchDataFactory + * @see OuternodeData + * @see PatchDataFactory */ template @@ -41,19 +41,19 @@ class OuternodeDataFactory:public hier::PatchDataFactory { public: /*! - * @brief - * The default constructor for the outernode data factory class. + * @brief The constructor for the outernode data factory class. * * The depth (number of components) gives the default for all of * the outernode data objects created with this factory. + * + * @pre depth > 0 */ OuternodeDataFactory( const tbox::Dimension& dim, int depth); /*! - * @brief - * Virtual destructor for the outernode data factory class. + * @brief Virtual destructor for the outernode data factory class. */ virtual ~OuternodeDataFactory(); @@ -66,36 +66,40 @@ class OuternodeDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( const hier::IntVector& ghosts); /*! - * @brief - * Virtual factory function to allocate a concrete outernode data object. + * @brief Virtual factory function to allocate a concrete outernode data + * object. * * The default information about the object (e.g., depth) is taken from * the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( const hier::Patch& patch) const; /*! - * @brief - * Allocate the box geometry object associated with the patch data. + * @brief Allocate the box geometry object associated with the patch data. * * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( const hier::Box& box) const; /*! - * @brief - * Get the depth (number of components). + * @brief Get the depth (number of components). * * This is the depth that will be used in the instantiation of * outernode data objects. @@ -104,9 +108,10 @@ class OuternodeDataFactory:public hier::PatchDataFactory getDepth() const; /*! - * @brief - * Calculate the amount of memory needed to store the outernode data - * object, including object data and dynamically allocated data. + * @brief Calculate the amount of memory needed to store the outernode data + * object, including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -131,6 +136,8 @@ class OuternodeDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this OuternodeDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is NodeDataFactory or OuternodeDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.C deleted file mode 100644 index 7619b167..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.C +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: ConstantCoarsen averaging operator for outernode-centered - * double data on a mesh. - * - ************************************************************************/ - -#ifndef included_pdat_OuternodeDoubleConstantCoarsen_C -#define included_pdat_OuternodeDoubleConstantCoarsen_C - -#include "SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h" - -#include "SAMRAI/pdat/OuternodeData.h" -#include "SAMRAI/pdat/OuternodeVariable.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/tbox/Utilities.h" - -#include -#include - -/* - ************************************************************************* - * - * External declarations for FORTRAN routines. - * - ************************************************************************* - */ -extern "C" { - -#ifdef __INTEL_COMPILER -#pragma warning (disable:1419) -#endif - -// in pdat_concoarsen1d.f: -void F77_FUNC(conavgouternodedoub1d, CONAVGOUTERNODEDOUB1D) (const int&, - const int&, - const int&, const int&, - const int&, const int&, - const int *, - const double *, double *); -// in pdat_concoarsen2d.f: -void F77_FUNC(conavgouternodedoub2d0, CONAVGOUTERNODEDOUB2D0) (const int&, - const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, - const double *, double *); -void F77_FUNC(conavgouternodedoub2d1, CONAVGOUTERNODEDOUB2D1) (const int&, - const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, - const double *, double *); - -// in pdat_concoarsen3d.f: -void F77_FUNC(conavgouternodedoub3d0, CONAVGOUTERNODEDOUB3D0) (const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, - const double *, double *); -void F77_FUNC(conavgouternodedoub3d1, CONAVGOUTERNODEDOUB3D1) (const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, - const double *, double *); -void F77_FUNC(conavgouternodedoub3d2, CONAVGOUTERNODEDOUB3D2) (const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, - const double *, double *); -} - -namespace SAMRAI { -namespace pdat { - -OuternodeDoubleConstantCoarsen::OuternodeDoubleConstantCoarsen( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "CONSTANT_COARSEN") -{ -} - -OuternodeDoubleConstantCoarsen::~OuternodeDoubleConstantCoarsen() -{ -} - -int -OuternodeDoubleConstantCoarsen::getOperatorPriority() const -{ - return 0; -} - -hier::IntVector -OuternodeDoubleConstantCoarsen::getStencilWidth() const -{ - return hier::IntVector::getZero(getDim()); -} - -void -OuternodeDoubleConstantCoarsen::coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const -{ - const tbox::Dimension& dim(getDim()); - - boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); - - TBOX_ASSERT(fdata); - TBOX_ASSERT(cdata); - TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS5(*this, coarse, fine, coarse_box, ratio); - - const hier::Index filo = fine.getBox().lower(); - const hier::Index fihi = fine.getBox().upper(); - const hier::Index cilo = coarse.getBox().lower(); - const hier::Index cihi = coarse.getBox().upper(); - - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - - for (int i = 0; i < 2; i++) { - - for (int axis = 0; axis < dim.getValue(); axis++) { - - if (cdata->dataExists(axis)) { - - for (int d = 0; d < cdata->getDepth(); d++) { - - if (dim == tbox::Dimension(1)) { - F77_FUNC(conavgouternodedoub1d, - CONAVGOUTERNODEDOUB1D) (ifirstc(0), ilastc(0), - filo(0), fihi(0), - cilo(0), cihi(0), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } else if (dim == tbox::Dimension(2)) { - if (axis == 0) { - F77_FUNC(conavgouternodedoub2d0, - CONAVGOUTERNODEDOUB2D0) (ifirstc(0), ifirstc(1), - ilastc(0), ilastc(1), - filo(0), filo(1), - fihi(0), fihi(1), - cilo(0), cilo(1), - cihi(0), cihi(1), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } - - if (axis == 1) { - F77_FUNC(conavgouternodedoub2d1, - CONAVGOUTERNODEDOUB2D1) (ifirstc(0), ifirstc(1), - ilastc(0), ilastc(1), - filo(0), filo(1), - fihi(0), fihi(1), - cilo(0), cilo(1), - cihi(0), cihi(1), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } - } else if (dim == tbox::Dimension(3)) { - if (axis == 0) { - F77_FUNC(conavgouternodedoub3d0, - CONAVGOUTERNODEDOUB3D0) (ifirstc(0), ifirstc(1), - ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } - if (axis == 1) { - F77_FUNC(conavgouternodedoub3d1, - CONAVGOUTERNODEDOUB3D1) (ifirstc(0), ifirstc(1), - ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } - if (axis == 2) { - F77_FUNC(conavgouternodedoub3d2, - CONAVGOUTERNODEDOUB3D2) (ifirstc(0), ifirstc(1), - ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - fdata->getPointer(axis, i, d), - cdata->getPointer(axis, i, d)); - } - } - - } - } - } - } -} - -} -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h deleted file mode 100644 index 12c9305b..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleConstantCoarsen.h +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Constant averaging operator for node-centered double data on - * a mesh. - * - ************************************************************************/ - -#ifndef included_pdat_OuternodeDoubleConstantCoarsen -#define included_pdat_OuternodeDoubleConstantCoarsen - -#include "SAMRAI/SAMRAI_config.h" - -#include "SAMRAI/hier/CoarsenOperator.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" - -#include -#include - -namespace SAMRAI { -namespace pdat { - -/*! - * @brief - * Class OuternodeDoubleConstantCoarsen implements constant - * averaging (i.e., injection) for outernode-centered double patch data defined - * over a mesh. - * - * It is derived from the hier::CoarsenOperator base class. - * The numerical operations for the averaging use FORTRAN numerical - * routines. - * - * @see hier::CoarsenOperator - */ - -class OuternodeDoubleConstantCoarsen: - public hier::CoarsenOperator -{ -public: - /*! - * @brief Uninteresting default constructor. - */ - explicit OuternodeDoubleConstantCoarsen( - const tbox::Dimension& dim); - - /*! - * @brief Uninteresting virtual destructor. - */ - virtual ~OuternodeDoubleConstantCoarsen(); - - /*! - * @brief Give the operator priority. - * - * The priority of outernode-centered constant averaging is 0. - * It will be performed before any user-defined coarsen operations. - */ - int - getOperatorPriority() const; - - /*! - * @brief Give the operator stencil width. - * - * The stencil width of the constant averaging operator is the vector of - * zeros. That is, its stencil does not extend outside the fine box. - */ - hier::IntVector - getStencilWidth() const; - - /*! - * @brief Coarsen the source component on the fine patch to the destination - * component on the coarse patch using the outernode-centered double constant - * averaging operator. - * - * Coarsening is performed on the intersection of - * the destination patch and the coarse box. It is assumed that the - * fine patch contains sufficient data for the stencil width of the - * coarsening operator. - */ - void - coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const; -}; - -} -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.C new file mode 100644 index 00000000..f2c074be --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.C @@ -0,0 +1,237 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: ConstantCoarsen averaging operator for outernode-centered + * double data on a mesh. + * + ************************************************************************/ +#include "SAMRAI/pdat/OuternodeDoubleInjection.h" + +#include "SAMRAI/pdat/OuternodeData.h" +#include "SAMRAI/pdat/OuternodeVariable.h" +#include "SAMRAI/hier/Index.h" +#include "SAMRAI/tbox/Utilities.h" + +#include +#include + +/* + ************************************************************************* + * + * External declarations for FORTRAN routines. + * + ************************************************************************* + */ +extern "C" { + +#ifdef __INTEL_COMPILER +#pragma warning (disable:1419) +#endif + +// in pdat_concoarsen1d.f: +void SAMRAI_F77_FUNC(conavgouternodedoub1d, CONAVGOUTERNODEDOUB1D) (const int&, + const int&, + const int&, const int&, + const int&, const int&, + const int *, + const double *, double *); +// in pdat_concoarsen2d.f: +void SAMRAI_F77_FUNC(conavgouternodedoub2d0, CONAVGOUTERNODEDOUB2D0) (const int&, + const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int *, + const double *, double *); +void SAMRAI_F77_FUNC(conavgouternodedoub2d1, CONAVGOUTERNODEDOUB2D1) (const int&, + const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int *, + const double *, double *); + +// in pdat_concoarsen3d.f: +void SAMRAI_F77_FUNC(conavgouternodedoub3d0, CONAVGOUTERNODEDOUB3D0) (const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int *, + const double *, double *); +void SAMRAI_F77_FUNC(conavgouternodedoub3d1, CONAVGOUTERNODEDOUB3D1) (const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int *, + const double *, double *); +void SAMRAI_F77_FUNC(conavgouternodedoub3d2, CONAVGOUTERNODEDOUB3D2) (const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int *, + const double *, double *); +} + +namespace SAMRAI { +namespace pdat { + +OuternodeDoubleInjection::OuternodeDoubleInjection(): + hier::CoarsenOperator("CONSTANT_COARSEN") +{ +} + +OuternodeDoubleInjection::~OuternodeDoubleInjection() +{ +} + +int +OuternodeDoubleInjection::getOperatorPriority() const +{ + return 0; +} + +hier::IntVector +OuternodeDoubleInjection::getStencilWidth(const tbox::Dimension& dim) const +{ + return hier::IntVector::getZero(dim); +} + +void +OuternodeDoubleInjection::coarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const int dst_component, + const int src_component, + const hier::Box& coarse_box, + const hier::IntVector& ratio) const +{ + const tbox::Dimension& dim(fine.getDim()); + + boost::shared_ptr > fdata( + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); + boost::shared_ptr > cdata( + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); + + TBOX_ASSERT(fdata); + TBOX_ASSERT(cdata); + TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); + TBOX_ASSERT_OBJDIM_EQUALITY4(coarse, fine, coarse_box, ratio); + + const hier::Index& filo = fine.getBox().lower(); + const hier::Index& fihi = fine.getBox().upper(); + const hier::Index& cilo = coarse.getBox().lower(); + const hier::Index& cihi = coarse.getBox().upper(); + + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + + for (int i = 0; i < 2; ++i) { + + for (int axis = 0; axis < dim.getValue(); ++axis) { + + if (cdata->dataExists(axis)) { + + for (int d = 0; d < cdata->getDepth(); ++d) { + + if (dim == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(conavgouternodedoub1d, + CONAVGOUTERNODEDOUB1D) (ifirstc(0), ilastc(0), + filo(0), fihi(0), + cilo(0), cihi(0), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } else if (dim == tbox::Dimension(2)) { + if (axis == 0) { + SAMRAI_F77_FUNC(conavgouternodedoub2d0, + CONAVGOUTERNODEDOUB2D0) (ifirstc(0), ifirstc(1), + ilastc(0), ilastc(1), + filo(0), filo(1), + fihi(0), fihi(1), + cilo(0), cilo(1), + cihi(0), cihi(1), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } + + if (axis == 1) { + SAMRAI_F77_FUNC(conavgouternodedoub2d1, + CONAVGOUTERNODEDOUB2D1) (ifirstc(0), ifirstc(1), + ilastc(0), ilastc(1), + filo(0), filo(1), + fihi(0), fihi(1), + cilo(0), cilo(1), + cihi(0), cihi(1), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } + } else if (dim == tbox::Dimension(3)) { + if (axis == 0) { + SAMRAI_F77_FUNC(conavgouternodedoub3d0, + CONAVGOUTERNODEDOUB3D0) (ifirstc(0), ifirstc(1), + ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } + if (axis == 1) { + SAMRAI_F77_FUNC(conavgouternodedoub3d1, + CONAVGOUTERNODEDOUB3D1) (ifirstc(0), ifirstc(1), + ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } + if (axis == 2) { + SAMRAI_F77_FUNC(conavgouternodedoub3d2, + CONAVGOUTERNODEDOUB3D2) (ifirstc(0), ifirstc(1), + ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + &ratio[0], + fdata->getPointer(axis, i, d), + cdata->getPointer(axis, i, d)); + } + } + + } + } + } + } +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.h new file mode 100644 index 00000000..76a6915c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeDoubleInjection.h @@ -0,0 +1,97 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Constant averaging operator for node-centered double data on + * a mesh. + * + ************************************************************************/ + +#ifndef included_pdat_OuternodeDoubleInjection +#define included_pdat_OuternodeDoubleInjection + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/CoarsenOperator.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/Patch.h" + +#include "boost/shared_ptr.hpp" +#include + +namespace SAMRAI { +namespace pdat { + +/*! + * @brief + * Class OuternodeDoubleInjection implements constant + * averaging (i.e., injection) for outernode-centered double patch data defined + * over a mesh. + * + * It is derived from the hier::CoarsenOperator base class. + * The numerical operations for the averaging use FORTRAN numerical + * routines. + * + * @see hier::CoarsenOperator + */ + +class OuternodeDoubleInjection: + public hier::CoarsenOperator +{ +public: + /*! + * @brief Uninteresting default constructor. + */ + OuternodeDoubleInjection(); + + /*! + * @brief Uninteresting virtual destructor. + */ + virtual ~OuternodeDoubleInjection(); + + /*! + * @brief Give the operator priority. + * + * The priority of outernode-centered constant averaging is 0. + * It will be performed before any user-defined coarsen operations. + */ + int + getOperatorPriority() const; + + /*! + * @brief Give the operator stencil width. + * + * The stencil width of the constant averaging operator is the vector of + * zeros. That is, its stencil does not extend outside the fine box. + */ + hier::IntVector + getStencilWidth( + const tbox::Dimension& dim) const; + + /*! + * @brief Coarsen the source component on the fine patch to the destination + * component on the coarse patch using the outernode-centered double constant + * averaging operator. + * + * Coarsening is performed on the intersection of + * the destination patch and the coarse box. It is assumed that the + * fine patch contains sufficient data for the stencil width of the + * coarsening operator. + */ + void + coarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const int dst_component, + const int src_component, + const hier::Box& coarse_box, + const hier::IntVector& ratio) const; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.C index 4d16eb2f..72b0e697 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_OuternodeGeometry_C -#define included_pdat_OuternodeGeometry_C - #include "SAMRAI/pdat/OuternodeGeometry.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -36,7 +32,7 @@ OuternodeGeometry::OuternodeGeometry( d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -70,7 +66,7 @@ OuternodeGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const NodeGeometry* t_dst_node = dynamic_cast(&dst_geometry); @@ -82,15 +78,15 @@ OuternodeGeometry::calculateOverlap( dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src_onode != NULL) && (t_dst_node != NULL)) { + if ((t_src_onode != 0) && (t_dst_node != 0)) { over = doOverlap(*t_dst_node, *t_src_onode, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); - } else if ((t_dst_onode != NULL) && (t_src_node != NULL)) { + } else if ((t_dst_onode != 0) && (t_src_node != 0)) { over = doOverlap(*t_dst_onode, *t_src_node, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); - } else if ((t_src_onode != NULL) && (t_dst_onode != NULL)) { + } else if ((t_src_onode != 0) && (t_dst_onode != 0)) { over = doOverlap(*t_dst_onode, *t_src_onode, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); @@ -124,7 +120,7 @@ OuternodeGeometry::doOverlap( const hier::BoxContainer& dst_restrict_boxes) { const hier::IntVector& src_offset = transformation.getOffset(); - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); const tbox::Dimension& dim(src_mask.getDim()); @@ -151,34 +147,38 @@ OuternodeGeometry::doOverlap( const hier::Box fill_node_box( NodeGeometry::toNodeBox(fill_box)); - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box trimmed_src_node_box = src_node_box; - for (int dh = d + 1; dh < dim.getValue(); ++dh) { + for (tbox::Dimension::dir_t dh = static_cast(d + 1); + dh < dim.getValue(); + ++dh) { /* - * For dimensions higher than d, narrow the box down to avoid + * For directions higher than d, narrow the box down to avoid * representing edge and corner nodes multiple times. */ - ++trimmed_src_node_box.lower(dh); - --trimmed_src_node_box.upper(dh); + trimmed_src_node_box.setLower(dh, + trimmed_src_node_box.lower(dh) + 1); + trimmed_src_node_box.setUpper(dh, + trimmed_src_node_box.upper(dh) - 1); } // Add lower side intersection (if any) to the box list hier::Box low_node_box(trimmed_src_node_box); - low_node_box.upper(d) = low_node_box.lower(d); + low_node_box.setUpper(d, low_node_box.lower(d)); hier::Box low_overlap(low_node_box * msk_node_box * dst_node_box - * fill_node_box); + * fill_node_box); if (!low_overlap.empty()) { dst_boxes.pushBack(low_overlap); } // Add upper side intersection (if any) to the box list hier::Box hig_node_box(trimmed_src_node_box); - hig_node_box.lower(d) = hig_node_box.upper(d); + hig_node_box.setLower(d, hig_node_box.upper(d)); hier::Box hig_overlap(hig_node_box * msk_node_box * dst_node_box - * fill_node_box); + * fill_node_box); if (!hig_overlap.empty()) { dst_boxes.pushBack(hig_overlap); } @@ -192,9 +192,9 @@ OuternodeGeometry::doOverlap( } // loop over dim - if (dst_restrict_boxes.size() && dst_boxes.size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes.empty()) { hier::BoxContainer node_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { node_restrict_boxes.pushBack(NodeGeometry::toNodeBox(*b)); } @@ -230,7 +230,7 @@ OuternodeGeometry::doOverlap( const hier::BoxContainer& dst_restrict_boxes) { const hier::IntVector& src_offset = transformation.getOffset(); - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); const tbox::Dimension& dim(src_mask.getDim()); @@ -258,21 +258,25 @@ OuternodeGeometry::doOverlap( const hier::Box fill_node_box( NodeGeometry::toNodeBox(fill_box)); - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box trimmed_dst_node_box(dst_node_box * fill_node_box); - for (int dh = d + 1; dh < dim.getValue(); ++dh) { + for (tbox::Dimension::dir_t dh = static_cast(d + 1); + dh < dim.getValue(); + ++dh) { /* - * For dimensions higher than d, narrow the box down to avoid + * For directions higher than d, narrow the box down to avoid * representing edge and corner nodes multiple times. */ - ++trimmed_dst_node_box.lower(dh); - --trimmed_dst_node_box.upper(dh); + trimmed_dst_node_box.setLower(dh, + trimmed_dst_node_box.lower(dh) + 1); + trimmed_dst_node_box.setUpper(dh, + trimmed_dst_node_box.upper(dh) - 1); } // Add lower side intersection (if any) to the box list hier::Box low_node_box(trimmed_dst_node_box); - low_node_box.upper(d) = low_node_box.lower(d); + low_node_box.setUpper(d, low_node_box.lower(d)); hier::Box low_overlap(low_node_box * msk_node_box * src_node_box); if (!low_overlap.empty()) { @@ -281,7 +285,7 @@ OuternodeGeometry::doOverlap( // Add upper side intersection (if any) to the box list hier::Box hig_node_box(trimmed_dst_node_box); - hig_node_box.lower(d) = hig_node_box.upper(d); + hig_node_box.setLower(d, hig_node_box.upper(d)); hier::Box hig_overlap(hig_node_box * msk_node_box * src_node_box); if (!hig_overlap.empty()) { @@ -297,9 +301,9 @@ OuternodeGeometry::doOverlap( } // loop over dim - if (dst_restrict_boxes.size() && src_boxes.size()) { + if (!dst_restrict_boxes.empty() && !src_boxes.empty()) { hier::BoxContainer node_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { node_restrict_boxes.pushBack(NodeGeometry::toNodeBox(*b)); } @@ -335,7 +339,7 @@ OuternodeGeometry::doOverlap( const hier::BoxContainer& dst_restrict_boxes) { const hier::IntVector& src_offset = transformation.getOffset(); - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); const tbox::Dimension& dim(src_mask.getDim()); @@ -362,35 +366,43 @@ OuternodeGeometry::doOverlap( const hier::Box fill_node_box = NodeGeometry::toNodeBox(fill_box); - int dst_d, src_d; + tbox::Dimension::dir_t dst_d, src_d; for (dst_d = 0; dst_d < dim.getValue(); ++dst_d) { hier::Box trimmed_dst_node_box(dst_node_box * fill_node_box); - for (int dh = dst_d + 1; dh < dim.getValue(); ++dh) { - ++trimmed_dst_node_box.lower(dh); - --trimmed_dst_node_box.upper(dh); + for (tbox::Dimension::dir_t dh = static_cast(dst_d + 1); + dh < dim.getValue(); + ++dh) { + trimmed_dst_node_box.setLower(dh, + trimmed_dst_node_box.lower(dh) + 1); + trimmed_dst_node_box.setUpper(dh, + trimmed_dst_node_box.upper(dh) - 1); } hier::Box lo_dst_node_box = trimmed_dst_node_box; - lo_dst_node_box.upper(dst_d) = lo_dst_node_box.lower(dst_d); + lo_dst_node_box.setUpper(dst_d, lo_dst_node_box.lower(dst_d)); hier::Box hi_dst_node_box = trimmed_dst_node_box; - hi_dst_node_box.lower(dst_d) = hi_dst_node_box.upper(dst_d); + hi_dst_node_box.setLower(dst_d, hi_dst_node_box.upper(dst_d)); for (src_d = 0; src_d < dim.getValue(); ++src_d) { hier::Box trimmed_src_node_box = src_node_box; - for (int dh = src_d + 1; dh < dim.getValue(); ++dh) { - ++trimmed_src_node_box.lower(dh); - --trimmed_src_node_box.upper(dh); + for (tbox::Dimension::dir_t dh = static_cast(src_d + 1); + dh < dim.getValue(); + ++dh) { + trimmed_src_node_box.setLower(dh, + trimmed_src_node_box.lower(dh) + 1); + trimmed_src_node_box.setUpper(dh, + trimmed_src_node_box.upper(dh) - 1); } hier::Box lo_src_node_box = trimmed_src_node_box; - lo_src_node_box.upper(src_d) = lo_src_node_box.lower(src_d); + lo_src_node_box.setUpper(src_d, lo_src_node_box.lower(src_d)); hier::Box hi_src_node_box = trimmed_src_node_box; - hi_src_node_box.lower(src_d) = hi_src_node_box.upper(src_d); + hi_src_node_box.setLower(src_d, hi_src_node_box.upper(src_d)); hier::Box lo_lo_box( lo_src_node_box * msk_node_box * lo_dst_node_box); @@ -427,9 +439,9 @@ OuternodeGeometry::doOverlap( } // loop over dst dim - if (dst_restrict_boxes.size() && dst_boxes.size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes.empty()) { hier::BoxContainer node_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { node_restrict_boxes.pushBack(NodeGeometry::toNodeBox(*b)); } @@ -458,7 +470,8 @@ OuternodeGeometry::setUpOverlap( { hier::BoxContainer dst_boxes; - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { hier::Box node_box(NodeGeometry::toNodeBox(*b)); dst_boxes.pushBack(node_box); } @@ -470,4 +483,3 @@ OuternodeGeometry::setUpOverlap( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.h index d6b2defb..9761daa7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -33,12 +33,12 @@ class NodeGeometry; * box geometries and node or outernode box geometries for communication * operations. * - * See header file for OuternodeData class for a more detailed + * See header file for OuternodeData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::NodeGeometry - * @see pdat::NodeOverlap + * @see NodeGeometry + * @see NodeOverlap */ class OuternodeGeometry:public hier::BoxGeometry @@ -52,6 +52,9 @@ class OuternodeGeometry:public hier::BoxGeometry /*! * @brief Construct an outernode geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 */ OuternodeGeometry( const hier::Box& box, @@ -65,6 +68,8 @@ class OuternodeGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in node-centered index space on the * boundaries of the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -110,6 +115,8 @@ class OuternodeGeometry:public hier::BoxGeometry * Compute the overlap * between the source and destination objects, where the source * has outernode geometry and the destination node geometry. + * + * @pre src_mask.getDim() == transformation.getOffset().getDim() */ static boost::shared_ptr doOverlap( @@ -126,6 +133,8 @@ class OuternodeGeometry:public hier::BoxGeometry * Compute the overlap * between the source and destination objects, where the source * has node geometry and the destination outernode geometry. + * + * @pre src_mask.getDim() == transformation.getOffset().getDim() */ static boost::shared_ptr doOverlap( @@ -142,6 +151,8 @@ class OuternodeGeometry:public hier::BoxGeometry * Compute the overlap * between the source and destination objects, where the source * has outernode geometry and the destination outernode geometry. + * + * @pre src_mask.getDim() == transformation.getOffset().getDim() */ static boost::shared_ptr doOverlap( @@ -157,7 +168,7 @@ class OuternodeGeometry:public hier::BoxGeometry OuternodeGeometry( const OuternodeGeometry&); /*! Not implemented */ - void + OuternodeGeometry& operator = ( const OuternodeGeometry&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.C index c2189200..378f19ea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Variable class for defining outernode centered variables + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Variable class for defining outernode centered variables * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/OuternodeDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -47,37 +47,12 @@ template int OuternodeVariable::getDepth() const { boost::shared_ptr > factory( - getPatchDataFactory()); + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -OuternodeVariable::OuternodeVariable( - const OuternodeVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void OuternodeVariable::operator = ( - const OuternodeVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.h index a3d83c6b..f72456f6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OuternodeVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Variable class for defining outernode centered variables * ************************************************************************/ @@ -21,18 +21,18 @@ namespace SAMRAI { namespace pdat { /*! - * @brief Class OuternodeVariable is a templated variable class + * @brief Class OuternodeVariable is a templated variable class * used to define node-centered data quantities only on patch boundaries. * It is a subclass of hier::Variable and is templated on the type * of the underlying data (e.g., double, int, bool, etc.). * * Note that the data layout in the outernode data arrays matches the corresponding * array sections provided by the node data implementation. See header file for - * the OuternodeData class for a more detailed description of the data layout. + * the OuternodeData class for a more detailed description of the data layout. * - * @see NodeData - * @see OuternodeData - * @see OuternodeDataFactory + * @see NodeData + * @see OuternodeData + * @see OuternodeDataFactory * @see hier::Variable */ @@ -82,10 +82,11 @@ class OuternodeVariable:public hier::Variable private: // neither of the following functions are implemented - OuternodeVariable(const OuternodeVariable&); - void + OuternodeVariable( + const OuternodeVariable&); + OuternodeVariable& operator = ( - const OuternodeVariable&); + const OuternodeVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.C index 308691ac..663ee1fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for complex outerside data. * ************************************************************************/ - -#ifndef included_pdat_OutersideComplexLinearTimeInterpolateOp_C -#define included_pdat_OutersideComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -21,7 +17,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -37,7 +33,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutsidecmplx1d, LINTIMEINTOUTSIDECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx1d, LINTIMEINTOUTSIDECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -46,8 +42,8 @@ void F77_FUNC(lintimeintoutsidecmplx1d, LINTIMEINTOUTSIDECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutsidecmplx2d0, - LINTIMEINTOUTSIDECMPLX2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx2d0, + LINTIMEINTOUTSIDECMPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,8 +54,8 @@ void F77_FUNC(lintimeintoutsidecmplx2d0, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutsidecmplx2d1, - LINTIMEINTOUTSIDECMPLX2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx2d1, + LINTIMEINTOUTSIDECMPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -71,8 +67,8 @@ void F77_FUNC(lintimeintoutsidecmplx2d1, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutsidecmplx3d0, - LINTIMEINTOUTSIDECMPLX3D0) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d0, + LINTIMEINTOUTSIDECMPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -83,8 +79,8 @@ void F77_FUNC(lintimeintoutsidecmplx3d0, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutsidecmplx3d1, - LINTIMEINTOUTSIDECMPLX3D1) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d1, + LINTIMEINTOUTSIDECMPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,8 +91,8 @@ void F77_FUNC(lintimeintoutsidecmplx3d1, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintoutsidecmplx3d2, - LINTIMEINTOUTSIDECMPLX3D2) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d2, + LINTIMEINTOUTSIDECMPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -133,30 +129,30 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OutersideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OutersideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OutersideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -175,11 +171,11 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutsidecmplx1d, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx1d, LINTIMEINTOUTSIDECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -189,7 +185,7 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutsidecmplx2d0, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx2d0, LINTIMEINTOUTSIDECMPLX2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -199,7 +195,7 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidecmplx2d1, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx2d1, LINTIMEINTOUTSIDECMPLX2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -210,7 +206,7 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutsidecmplx3d0, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d0, LINTIMEINTOUTSIDECMPLX3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -223,7 +219,7 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidecmplx3d1, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d1, LINTIMEINTOUTSIDECMPLX3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -236,7 +232,7 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutsidecmplx3d2, + SAMRAI_F77_FUNC(lintimeintoutsidecmplx3d2, LINTIMEINTOUTSIDECMPLX3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -260,4 +256,3 @@ OutersideComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h index 9c44e001..e09b40eb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for complex outerside data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OutersideComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.C index 01b5a4d1..f084b5f8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outerside centered patch data type * ************************************************************************/ @@ -46,15 +46,15 @@ OutersideData::OutersideData( { TBOX_ASSERT(depth > 0); - for (int d = 0; d < getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { const hier::Box& ghosts = getGhostBox(); const hier::Box sidebox = SideGeometry::toSideBox(ghosts, d); hier::Box outersidebox = sidebox; - outersidebox.upper(d) = sidebox.lower(d); - d_data[d][0].initializeArray(outersidebox, depth); - outersidebox.lower(d) = sidebox.upper(d); - outersidebox.upper(d) = sidebox.upper(d); - d_data[d][1].initializeArray(outersidebox, depth); + outersidebox.setUpper(d, sidebox.lower(d)); + d_data[d][0].reset(new ArrayData(outersidebox, depth)); + outersidebox.setLower(d, sidebox.upper(d)); + outersidebox.setUpper(d, sidebox.upper(d)); + d_data[d][1].reset(new ArrayData(outersidebox, depth)); } } @@ -63,32 +63,6 @@ OutersideData::~OutersideData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -OutersideData::OutersideData( - const OutersideData& foo): - hier::PatchData(foo.getBox(), foo.getGhostCellWidth()) -{ - NULL_USE(foo); -} - -template -void -OutersideData::operator = ( - const OutersideData& foo) -{ - NULL_USE(foo); -} - template int OutersideData::getDepth() const @@ -97,7 +71,7 @@ OutersideData::getDepth() const } template -TYPE* +TYPE * OutersideData::getPointer( int side_normal, int side, @@ -107,11 +81,11 @@ OutersideData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[side_normal][side].getPointer(depth); + return d_data[side_normal][side]->getPointer(depth); } template -const TYPE* +const TYPE * OutersideData::getPointer( int side_normal, int side, @@ -121,7 +95,7 @@ OutersideData::getPointer( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[side_normal][side].getPointer(depth); + return d_data[side_normal][side]->getPointer(depth); } template @@ -133,7 +107,7 @@ OutersideData::getArrayData( TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[side_normal][side]; + return *(d_data[side_normal][side]); } template @@ -145,7 +119,7 @@ OutersideData::getArrayData( TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); TBOX_ASSERT((side == 0) || (side == 1)); - return d_data[side_normal][side]; + return *(d_data[side_normal][side]); } template @@ -161,7 +135,7 @@ OutersideData::operator () ( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][side](i, depth); + return (*(d_data[axis][side]))(i, depth); } template @@ -171,7 +145,7 @@ OutersideData::operator () ( int side, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -179,7 +153,7 @@ OutersideData::operator () ( TBOX_ASSERT((side == 0) || (side == 1)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis][side](i, depth); + return (*(d_data[axis][side]))(i, depth); } /* @@ -196,17 +170,16 @@ void OutersideData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - const SideData * const t_src = - dynamic_cast *>(&src); + const SideData * const t_src = CPP_CAST *>(&src); - TBOX_ASSERT(t_src != NULL); + TBOX_ASSERT(t_src != 0); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { const ArrayData& side_array = t_src->getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - ArrayData& oside_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + ArrayData& oside_array = *(d_data[axis][loc]); oside_array.copy(side_array, oside_array.getBox()); } } @@ -218,16 +191,15 @@ void OutersideData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - SideData* t_dst = - dynamic_cast *>(&dst); + SideData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); - for (int d = 0; d < getDim().getValue(); d++) { - t_dst->getArrayData(d).copy(d_data[d][0], d_data[d][0].getBox()); - t_dst->getArrayData(d).copy(d_data[d][1], d_data[d][1].getBox()); + for (int d = 0; d < getDim().getValue(); ++d) { + t_dst->getArrayData(d).copy(*(d_data[d][0]), d_data[d][0]->getBox()); + t_dst->getArrayData(d).copy(*(d_data[d][1]), d_data[d][1]->getBox()); } } @@ -246,10 +218,42 @@ OutersideData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - NULL_USE(src); - NULL_USE(overlap); - TBOX_ERROR("Copy with outerside as destination is not defined yet..."); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); + + const SideOverlap* t_overlap = CPP_CAST(&overlap); + + TBOX_ASSERT(t_overlap != 0); + + const OutersideData* t_oside_src = + dynamic_cast *>(&src); + const SideData* t_side_src = + dynamic_cast *>(&src); + + TBOX_ASSERT(t_oside_src == 0 || t_side_src == 0); + TBOX_ASSERT(t_oside_src != 0 || t_side_src != 0); + + const hier::IntVector& src_offset = t_overlap->getSourceOffset(); + if (t_oside_src != 0) { + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(d); + d_data[d][0]->copy(t_oside_src->getArrayData(d, 0), box_list, src_offset); + d_data[d][0]->copy(t_oside_src->getArrayData(d, 1), box_list, src_offset); + d_data[d][1]->copy(t_oside_src->getArrayData(d, 0), box_list, src_offset); + d_data[d][1]->copy(t_oside_src->getArrayData(d, 1), box_list, src_offset); + } + } else if (t_side_src != 0) { + for (int d = 0; d < getDim().getValue(); ++d) { + const hier::BoxContainer& box_list = + t_overlap->getDestinationBoxContainer(d); + d_data[d][0]->copy(t_side_src->getArrayData(d), box_list, src_offset); + d_data[d][1]->copy(t_side_src->getArrayData(d), box_list, src_offset); + } + } else { + TBOX_ERROR("OutersideData::copy error...\n" + << " : Cannot copy from type other than SideData or OutersideData " << std::endl); + } } template @@ -258,21 +262,19 @@ OutersideData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - SideData* t_dst = - dynamic_cast *>(&dst); - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + SideData* t_dst = CPP_CAST *>(&dst); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - t_dst->getArrayData(d).copy(d_data[d][0], box_list, src_offset); - t_dst->getArrayData(d).copy(d_data[d][1], box_list, src_offset); + t_dst->getArrayData(d).copy(*(d_data[d][0]), box_list, src_offset); + t_dst->getArrayData(d).copy(*(d_data[d][1]), box_list, src_offset); } } @@ -292,12 +294,12 @@ OutersideData::copyDepth( const SideData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { const ArrayData& src_side_array = src.getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - ArrayData& dst_oside_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + ArrayData& dst_oside_array = *(d_data[axis][loc]); dst_oside_array.copyDepth(dst_depth, src_side_array, src_depth, @@ -322,12 +324,12 @@ OutersideData::copyDepth2( SideData& dst, int src_depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { ArrayData& dst_side_array = dst.getArrayData(axis); - for (int loc = 0; loc < 2; loc++) { - const ArrayData& src_oside_array = d_data[axis][loc]; + for (int loc = 0; loc < 2; ++loc) { + const ArrayData& src_oside_array = *(d_data[axis][loc]); dst_side_array.copyDepth(dst_depth, src_oside_array, src_depth, @@ -353,22 +355,21 @@ OutersideData::canEstimateStreamSizeFromBox() const } template -int +size_t OutersideData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - int size = 0; - for (int d = 0; d < getDim().getValue(); d++) { + size_t size = 0; + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxlist = t_overlap->getDestinationBoxContainer(d); - size += d_data[d][0].getDataStreamSize(boxlist, src_offset); - size += d_data[d][1].getDataStreamSize(boxlist, src_offset); + size += d_data[d][0]->getDataStreamSize(boxlist, src_offset); + size += d_data[d][1]->getDataStreamSize(boxlist, src_offset); } return size; } @@ -388,21 +389,20 @@ OutersideData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { const hier::Box src_box = hier::Box::shift(*b, -src_offset); - for (int f = 0; f < 2; f++) { - const hier::Box intersect = src_box * d_data[d][f].getBox(); + for (int f = 0; f < 2; ++f) { + const hier::Box intersect = src_box * d_data[d][f]->getBox(); if (!intersect.empty()) { - d_data[d][f].packStream(stream, + d_data[d][f]->packStream(stream, hier::Box::shift(intersect, src_offset), src_offset); } @@ -417,20 +417,19 @@ OutersideData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { - for (int f = 0; f < 2; f++) { - const hier::Box intersect = (*b) * d_data[d][f].getBox(); + for (int f = 0; f < 2; ++f) { + const hier::Box intersect = (*b) * d_data[d][f]->getBox(); if (!intersect.empty()) { - d_data[d][f].unpackStream(stream, intersect, src_offset); + d_data[d][f]->unpackStream(stream, intersect, src_offset); } } } @@ -455,11 +454,11 @@ OutersideData::getSizeOfData( TBOX_ASSERT(depth > 0); size_t size = 0; - for (int d = 0; d < box.getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < box.getDim().getValue(); ++d) { hier::Box lower = SideGeometry::toSideBox(box, d); hier::Box upper = SideGeometry::toSideBox(box, d); - lower.upper(d) = box.lower(d); - upper.lower(d) = box.upper(d); + lower.setUpper(d, box.lower(d)); + upper.setLower(d, box.upper(d)); size += ArrayData::getSizeOfData(lower, depth); size += ArrayData::getSizeOfData(upper, depth); } @@ -482,9 +481,9 @@ OutersideData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fill(t, d); - d_data[i][1].fill(t, d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fill(t, d); + d_data[i][1]->fill(t, d); } } @@ -495,12 +494,12 @@ OutersideData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fill(t, SideGeometry::toSideBox(box, i), d); - d_data[i][1].fill(t, SideGeometry::toSideBox(box, i), d); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fill(t, SideGeometry::toSideBox(box, i), d); + d_data[i][1]->fill(t, SideGeometry::toSideBox(box, i), d); } } @@ -509,9 +508,9 @@ void OutersideData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fillAll(t); - d_data[i][1].fillAll(t); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fillAll(t); + d_data[i][1]->fillAll(t); } } @@ -521,11 +520,11 @@ OutersideData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int i = 0; i < getDim().getValue(); i++) { - d_data[i][0].fillAll(t, SideGeometry::toSideBox(box, i)); - d_data[i][1].fillAll(t, SideGeometry::toSideBox(box, i)); + for (int i = 0; i < getDim().getValue(); ++i) { + d_data[i][0]->fillAll(t, SideGeometry::toSideBox(box, i)); + d_data[i][1]->fillAll(t, SideGeometry::toSideBox(box, i)); } } @@ -544,9 +543,9 @@ OutersideData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { print(box, d, os, prec); } } @@ -559,12 +558,13 @@ OutersideData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - for (int side_normal = 0; side_normal < getDim().getValue(); side_normal++) { + for (tbox::Dimension::dir_t side_normal = 0; + side_normal < getDim().getValue(); ++side_normal) { os << "Array side normal = " << side_normal << std::endl; - for (int side = 0; side < 2; side++) { + for (int side = 0; side < 2; ++side) { os << "side = " << ((side == 0) ? "lower" : "upper") << std::endl; printAxisSide(side_normal, side, box, depth, os, prec); } @@ -574,17 +574,17 @@ OutersideData::print( template void OutersideData::printAxisSide( - int side_normal, + tbox::Dimension::dir_t side_normal, int side, const hier::Box& box, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); - TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); + TBOX_ASSERT(side_normal < getDim().getValue()); TBOX_ASSERT((side == 0) || (side == 1)); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; printAxisSide(side_normal, side, box, d, os, prec); } @@ -593,27 +593,27 @@ OutersideData::printAxisSide( template void OutersideData::printAxisSide( - int side_normal, + tbox::Dimension::dir_t side_normal, int side, const hier::Box& box, int depth, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); + TBOX_ASSERT(side_normal < getDim().getValue()); TBOX_ASSERT((side == 0) || (side == 1)); const hier::Box sidebox = SideGeometry::toSideBox(box, side_normal); const hier::Box region = - sidebox * d_data[side_normal][side].getBox(); + sidebox * d_data[side_normal][side]->getBox(); os.precision(prec); - hier::Box::iterator iend(region, false); - for (hier::Box::iterator i(region, true); i != iend; ++i) { + hier::Box::iterator iend(region.end()); + for (hier::Box::iterator i(region.begin()); i != iend; ++i) { os << "array" << *i << " = " - << d_data[side_normal][side](*i, depth) << std::endl; + << (*(d_data[side_normal][side]))(*i, depth) << std::endl; os << std::flush; } } @@ -622,7 +622,7 @@ OutersideData::printAxisSide( ************************************************************************* * * Checks that class version and restart file version are equal. If so, - * reads in d_depth from the database. Then has each item in d_data + * reads in d_depth from the restart database. Then has each item in d_data * read in its data from the database. * ************************************************************************* @@ -630,36 +630,38 @@ OutersideData::printAxisSide( template void -OutersideData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +OutersideData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_OUTERSIDEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_OUTERSIDEDATA_VERSION"); if (ver != PDAT_OUTERSIDEDATA_VERSION) { - TBOX_ERROR("OutersideData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("OutersideData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { std::string array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - array_database = database->getDatabase(array_name); - (d_data[i][0]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i][0]->getFromRestart(array_database); - array_name = "d_data%d_" + tbox::Utilities::intToString(i) + "_2"; - array_database = database->getDatabase(array_name); - (d_data[i][1]).getFromDatabase(array_database); + array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; + array_database = restart_db->getDatabase(array_name); + d_data[i][1]->getFromRestart(array_database); } } /* ************************************************************************* * - * Writes out class version number, d_depth to the database. + * Writes out class version number, d_depth to the restart database. * Then has each item in d_data write out its data to the database. * ************************************************************************* @@ -667,26 +669,28 @@ OutersideData::getSpecializedFromDatabase( template void -OutersideData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +OutersideData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); - database->putInteger("PDAT_OUTERSIDEDATA_VERSION", + hier::PatchData::putToRestart(restart_db); + + restart_db->putInteger("PDAT_OUTERSIDEDATA_VERSION", PDAT_OUTERSIDEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { - std::string array_name = "d_data%d_" + tbox::Utilities::intToString(i) + for (int i = 0; i < getDim().getValue(); ++i) { + std::string array_name = "d_data" + tbox::Utilities::intToString(i) + "_1"; - array_database = database->putDatabase(array_name); - (d_data[i][0]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i][0]->putToRestart(array_database); - array_name = "d_data%d_" + tbox::Utilities::intToString(i) + "_2"; - array_database = database->putDatabase(array_name); - (d_data[i][1]).putUnregisteredToDatabase(array_database); + array_name = "d_data" + tbox::Utilities::intToString(i) + "_2"; + array_database = restart_db->putDatabase(array_name); + d_data[i][1]->putToRestart(array_database); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.h index e3e81be7..05228115 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated outerside centered patch data type * ************************************************************************/ @@ -21,21 +21,21 @@ #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class OutersideData provides an implementation for data defined + * @brief Class OutersideData provides an implementation for data defined * at cell sides (faces) on the boundaries of AMR patches. It is derived from * the hier::PatchData interface common to all SAMRAI patch data types. Given * a CELL-centered AMR index space box, an outerside data object represents - * data of some template TYPE and depth on the cell sides (faces) on the boundary - * of the box. Here, depth indicates the number of data values at each face - * index location. The OuteredgsideGeometry class provides the translation - * between the standard SAMRAI cell-centered AMR index space and + * data of some template TYPE and depth on the cell sides (faces) on the + * boundary of the box. Here, depth indicates the number of data values at + * each face index location. The OuteredgsideGeometry class provides the + * translation between the standard SAMRAI cell-centered AMR index space and * outerside-centered data. * * Outerside data is stored in 2*DIM arrays, each of which contains data @@ -46,7 +46,7 @@ namespace pdat { * memory allocation is in column-major ordering (e.g., Fortran style) so that * the leftmost index runs fastest in memory. For example, a three-dimensional * outerside data object created over a CELL-centered AMR index space - * [l0:u0,l1:u1,l2:u2] allocates six data arrays dimensioned as follows: + * [l0:u0,l1:u1,l2:u2] allocates six data arrays sized as follows: * \verbatim * * face normal 0: @@ -70,17 +70,17 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * IMPORTANT: The OuterfaceData class provides the same storage + * IMPORTANT: The OuterfaceData class provides the same storage * as this outerside data class, except that the coordinate directions of the * individual arrays are permuted; i.e., OuterfaceData is consistent * with the FaceData implementation. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::OutersideDataFactory - * @see pdat::OutersideGeometry - * @see pdat::SideIterator - * @see pdat::SideIndex + * @see OutersideDataFactory + * @see OutersideGeometry + * @see SideIterator + * @see SideIndex */ template @@ -101,6 +101,8 @@ class OutersideData:public hier::PatchData * Note: the ghost cell width is assumed to be zero. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ static size_t getSizeOfData( @@ -117,6 +119,8 @@ class OutersideData:public hier::PatchData * outerside data object will be created. * @param depth gives the number of data values for each * spatial location in the array. + * + * @pre depth > 0 */ OutersideData( const hier::Box& box, @@ -139,12 +143,14 @@ class OutersideData:public hier::PatchData * side normal, side, and depth component of the outerside centered * array. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -157,12 +163,14 @@ class OutersideData:public hier::PatchData * side normal, side, and depth component of the outerside centered * array. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -176,10 +184,12 @@ class OutersideData:public hier::PatchData * * @param i const reference to SideIndex, @em MUST be * an index on the outerside of the box. - * @param side integer (lower/upper location of outerside data), - * must satisfy 0 <= side <= 1 - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param side integer (lower/upper location of outerside data) + * @param depth integer depth component + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -193,10 +203,12 @@ class OutersideData:public hier::PatchData * * @param i const reference to SideIndex, @em MUST be * an index on the outerside of the box. - * @param side integer (lower/upper location of outerside data), - * must satisfy 0 <= side <= 1 - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param side integer (lower/upper location of outerside data) + * @param depth integer depth component + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre (side == 0) || (side == 1) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -208,10 +220,12 @@ class OutersideData:public hier::PatchData * @brief Return a reference to the array data object for * side normal and side location of the outerside centered array. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ ArrayData& getArrayData( @@ -222,10 +236,12 @@ class OutersideData:public hier::PatchData * @brief Return a const reference to the array data object for * side normal and side location of the outerside centered array. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ const ArrayData& getArrayData( @@ -241,6 +257,9 @@ class OutersideData:public hier::PatchData * both the source and destination). Currently, source data must be * SideData the same DIM and TYPE. If not, then an unrecoverable error * results. + * + * @pre getDim() == src.getDim() + * @pre dynamic_cast *>(&src) != 0 */ virtual void copy( @@ -255,6 +274,9 @@ class OutersideData:public hier::PatchData * both the source and destination). Currently, destination data must be * SideData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 */ virtual void copy2( @@ -278,6 +300,10 @@ class OutersideData:public hier::PatchData * Currently, destination data must be SideData of the same DIM * and TYPE and the overlap must be a SideOverlap of the same * DIM. If not, then an unrecoverable error results. + * + * @pre getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 */ virtual void copy2( @@ -288,6 +314,8 @@ class OutersideData:public hier::PatchData * @brief Fast copy (i.e., assumes side and outerside data objects are * defined over the same box) from the given side source data object to * this destination outerside data object at the specified depths. + * + * @pre getDim == src.getDim() */ void copyDepth( @@ -299,6 +327,8 @@ class OutersideData:public hier::PatchData * @brief Fast copy (i.e., assumes side and outerside data objects are * defined over the same box) to the given side destination data object * from this source outerside data object at the specified depths. + * + * @pre getDim == dst.getDim() */ void copyDepth2( @@ -324,8 +354,10 @@ class OutersideData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -333,6 +365,8 @@ class OutersideData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * SideOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -343,6 +377,8 @@ class OutersideData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * SideOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -351,6 +387,8 @@ class OutersideData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -359,6 +397,9 @@ class OutersideData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -375,6 +416,8 @@ class OutersideData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDim() == box.getDim() */ void fillAll( @@ -390,10 +433,12 @@ class OutersideData:public hier::PatchData * and will be converted to side index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() */ void print( @@ -408,14 +453,16 @@ class OutersideData:public hier::PatchData * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to side index space. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -429,8 +476,7 @@ class OutersideData:public hier::PatchData * side_normal and side location residing in the specified box. * If the depth of the data is greater than one, all depths are printed. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array * @param box const reference to box over whioch to print data. Note box @@ -438,14 +484,18 @@ class OutersideData:public hier::PatchData * and will be converted to side index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( - int side_normal, + tbox::Dimension::dir_t side_normal, int side, const hier::Box& box, std::ostream& os = tbox::plog, @@ -455,25 +505,28 @@ class OutersideData:public hier::PatchData * @brief Print all outerside centered data values for specified * side_normal, side location, and depth residing in the specified box. * - * @param side_normal integer side normal direction for data, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal direction for data * @param side integer lower (0) or upper (1) side of outerside * data array * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to side index space. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre (side == 0) || (side == 1) */ void printAxisSide( - int side_normal, + tbox::Dimension::dir_t side_normal, int side, const hier::Box& box, int depth, @@ -482,23 +535,23 @@ class OutersideData:public hier::PatchData /*! * @brief Check that class version and restart file version are equal. - * If so, read data members from the database. + * If so, read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * @brief Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: /* @@ -506,14 +559,18 @@ class OutersideData:public hier::PatchData */ static const int PDAT_OUTERSIDEDATA_VERSION; + // Unimplemented copy constructor OutersideData( - const OutersideData&); // not implemented - void + const OutersideData&); + + // Unimplemented assignment operator + OutersideData& operator = ( - const OutersideData&); // not implemented + const OutersideData&); int d_depth; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE][2]; + + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL][2]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.C index 7deb9cb4..b3922cd8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outerside data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/pdat/SideDataFactory.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -61,11 +61,11 @@ boost::shared_ptr OutersideDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - ghosts.getDim(), - d_depth); + ghosts.getDim(), + d_depth); } /* @@ -81,7 +81,7 @@ boost::shared_ptr OutersideDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >(patch.getBox(), d_depth); } @@ -99,7 +99,7 @@ boost::shared_ptr OutersideDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const hier::IntVector& zero_vector(hier::IntVector::getZero(getDim())); @@ -126,7 +126,7 @@ size_t OutersideDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(OutersideData)); const size_t data = OutersideData::getSizeOfData(box, d_depth); @@ -147,7 +147,7 @@ bool OutersideDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -156,8 +156,8 @@ OutersideDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > sdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (sdf) { valid_copy = true; } @@ -165,8 +165,9 @@ OutersideDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > osdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (osdf) { valid_copy = true; } @@ -180,7 +181,7 @@ OutersideDataFactory::validCopyTo( * * Return a boolean true value indicating that fine data for the outerside * quantity will take precedence on coarse-fine interfaces. See the - * OutersideVariable class header file for more information. + * OutersideVariable class header file for more information. * ************************************************************************* */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.h index ca4ef5dd..82a09e7f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating outerside data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -31,8 +31,8 @@ namespace pdat { * the factory and data classes are templated on the type of the contained * object (e.g., double or int). * - * @see pdat::OutersideData - * @see pdat::PatchDataFactory + * @see OutersideData + * @see PatchDataFactory */ template @@ -43,6 +43,8 @@ class OutersideDataFactory:public hier::PatchDataFactory * The default constructor for the outerside data factory class. * The depth (number of components) gives the default for all of * the outerside data objects created with this factory. + * + * @pre depth > 0 */ OutersideDataFactory( const tbox::Dimension& dim, @@ -62,6 +64,8 @@ class OutersideDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -71,6 +75,8 @@ class OutersideDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete outerside data object. * The default information about the object (e.g., depth) is taken from * the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -80,6 +86,8 @@ class OutersideDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -95,6 +103,8 @@ class OutersideDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the outerside data * object, including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -103,7 +113,7 @@ class OutersideDataFactory:public hier::PatchDataFactory /** * Return a boolean true value indicating that fine data for the outerside * quantity will take precedence on coarse-fine interfaces. See the - * OutersideVariable class header file for more information. + * OutersideVariable class header file for more information. */ bool fineBoundaryRepresentsVariable() const; @@ -119,6 +129,8 @@ class OutersideDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this OutersideDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is SideDataFactory or OutersideDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.C index 956cc228..30f03c07 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for double outerside patch data. * ************************************************************************/ - -#ifndef included_pdat_OutersideDoubleLinearTimeInterpolateOp_C -#define included_pdat_OutersideDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutsidedoub1d, LINTIMEINTOUTSIDEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub1d, LINTIMEINTOUTSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintoutsidedoub1d, LINTIMEINTOUTSIDEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutsidedoub2d0, LINTIMEINTOUTSIDEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub2d0, LINTIMEINTOUTSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintoutsidedoub2d0, LINTIMEINTOUTSIDEDOUB2D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutsidedoub2d1, LINTIMEINTOUTSIDEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub2d1, LINTIMEINTOUTSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintoutsidedoub2d1, LINTIMEINTOUTSIDEDOUB2D1) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutsidedoub3d0, LINTIMEINTOUTSIDEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub3d0, LINTIMEINTOUTSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintoutsidedoub3d0, LINTIMEINTOUTSIDEDOUB3D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutsidedoub3d1, LINTIMEINTOUTSIDEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub3d1, LINTIMEINTOUTSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintoutsidedoub3d1, LINTIMEINTOUTSIDEDOUB3D1) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintoutsidedoub3d2, LINTIMEINTOUTSIDEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidedoub3d2, LINTIMEINTOUTSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OutersideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OutersideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OutersideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,11 +168,11 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutsidedoub1d, + SAMRAI_F77_FUNC(lintimeintoutsidedoub1d, LINTIMEINTOUTSIDEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -186,7 +182,7 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutsidedoub2d0, + SAMRAI_F77_FUNC(lintimeintoutsidedoub2d0, LINTIMEINTOUTSIDEDOUB2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -196,7 +192,7 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidedoub2d1, + SAMRAI_F77_FUNC(lintimeintoutsidedoub2d1, LINTIMEINTOUTSIDEDOUB2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -207,7 +203,7 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutsidedoub3d0, + SAMRAI_F77_FUNC(lintimeintoutsidedoub3d0, LINTIMEINTOUTSIDEDOUB3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -220,7 +216,7 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidedoub3d1, + SAMRAI_F77_FUNC(lintimeintoutsidedoub3d1, LINTIMEINTOUTSIDEDOUB3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -233,7 +229,7 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutsidedoub3d2, + SAMRAI_F77_FUNC(lintimeintoutsidedoub3d2, LINTIMEINTOUTSIDEDOUB3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -257,4 +253,3 @@ OutersideDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.h index 45ea0c80..dbfd6b9a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for double outerside patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OutersideDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.C index a50c3035..d8122270 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for float outerside patch data. * ************************************************************************/ - -#ifndef included_pdat_OutersideFloatLinearTimeInterpolateOp_C -#define included_pdat_OutersideFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintoutsidefloat1d, LINTIMEINTOUTSIDEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat1d, LINTIMEINTOUTSIDEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,8 +41,8 @@ void F77_FUNC(lintimeintoutsidefloat1d, LINTIMEINTOUTSIDEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintoutsidefloat2d0, - LINTIMEINTOUTSIDEFLOAT2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat2d0, + LINTIMEINTOUTSIDEFLOAT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,8 +53,8 @@ void F77_FUNC(lintimeintoutsidefloat2d0, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutsidefloat2d1, - LINTIMEINTOUTSIDEFLOAT2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat2d1, + LINTIMEINTOUTSIDEFLOAT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,8 +66,8 @@ void F77_FUNC(lintimeintoutsidefloat2d1, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintoutsidefloat3d0, - LINTIMEINTOUTSIDEFLOAT3D0) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat3d0, + LINTIMEINTOUTSIDEFLOAT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,8 +78,8 @@ void F77_FUNC(lintimeintoutsidefloat3d0, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutsidefloat3d1, - LINTIMEINTOUTSIDEFLOAT3D1) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat3d1, + LINTIMEINTOUTSIDEFLOAT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,8 +90,8 @@ void F77_FUNC(lintimeintoutsidefloat3d1, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintoutsidefloat3d2, - LINTIMEINTOUTSIDEFLOAT3D2) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(lintimeintoutsidefloat3d2, + LINTIMEINTOUTSIDEFLOAT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,30 +126,30 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const OutersideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const OutersideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); OutersideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -172,11 +168,11 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; ++i) { if (dim == tbox::Dimension(1)) { - F77_FUNC(lintimeintoutsidefloat1d, + SAMRAI_F77_FUNC(lintimeintoutsidefloat1d, LINTIMEINTOUTSIDEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -186,7 +182,7 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); } else if (dim == tbox::Dimension(2)) { - F77_FUNC(lintimeintoutsidefloat2d0, + SAMRAI_F77_FUNC(lintimeintoutsidefloat2d0, LINTIMEINTOUTSIDEFLOAT2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -196,7 +192,7 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidefloat2d1, + SAMRAI_F77_FUNC(lintimeintoutsidefloat2d1, LINTIMEINTOUTSIDEFLOAT2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), @@ -207,7 +203,7 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); } else if (dim == tbox::Dimension(3)) { - F77_FUNC(lintimeintoutsidefloat3d0, + SAMRAI_F77_FUNC(lintimeintoutsidefloat3d0, LINTIMEINTOUTSIDEFLOAT3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -220,7 +216,7 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(0, i, d), new_dat->getPointer(0, i, d), dst_dat->getPointer(0, i, d)); - F77_FUNC(lintimeintoutsidefloat3d1, + SAMRAI_F77_FUNC(lintimeintoutsidefloat3d1, LINTIMEINTOUTSIDEFLOAT3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -233,7 +229,7 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( old_dat->getPointer(1, i, d), new_dat->getPointer(1, i, d), dst_dat->getPointer(1, i, d)); - F77_FUNC(lintimeintoutsidefloat3d2, + SAMRAI_F77_FUNC(lintimeintoutsidefloat3d2, LINTIMEINTOUTSIDEFLOAT3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -257,4 +253,3 @@ OutersideFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.h index 4ea15a66..45e6b6d9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for float outerside patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -52,6 +52,18 @@ class OutersideFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.C index 35db4ee8..7bc17c46 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_OutersideGeometry_C -#define included_pdat_OutersideGeometry_C - #include "SAMRAI/pdat/OutersideGeometry.h" #include "SAMRAI/pdat/SideGeometry.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -36,7 +32,7 @@ OutersideGeometry::OutersideGeometry( d_ghosts(ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); } @@ -71,23 +67,33 @@ OutersideGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); - const SideGeometry* t_dst = + const SideGeometry* t_dst_side = dynamic_cast(&dst_geometry); + const OutersideGeometry* t_dst_oside = + dynamic_cast(&dst_geometry); const OutersideGeometry* t_src = dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { - over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, + + if ((t_src != 0) && (t_dst_side != 0)) { + over = doOverlap(*t_dst_side, *t_src, src_mask, fill_box, + overwrite_interior, + transformation, dst_restrict_boxes); + } else if ((t_src != 0) && (t_dst_oside != 0)) { + over = doOverlap(*t_dst_oside, *t_src, src_mask, fill_box, + overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { - over = src_geometry.calculateOverlap( - dst_geometry, src_geometry, src_mask, fill_box, - overwrite_interior, transformation, false, dst_restrict_boxes); + over = src_geometry.calculateOverlap(dst_geometry, src_geometry, + src_mask, fill_box, overwrite_interior, + transformation, false, + dst_restrict_boxes); } return over; + } /* @@ -113,14 +119,14 @@ OutersideGeometry::doOverlap( { #ifdef DEBUG_CHECK_DIM_ASSERTIONS const hier::IntVector& src_offset = transformation.getOffset(); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); const tbox::Dimension& dim(src_mask.getDim()); TBOX_ASSERT(dst_geometry.getDirectionVector() == hier::IntVector::getOne(dim)); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); // Perform a quick-and-dirty intersection to see if the boxes might overlap @@ -133,7 +139,7 @@ OutersideGeometry::doOverlap( // Compute the intersection (if any) for each of the side directions - const hier::IntVector one_vector(dim, 1); + const hier::IntVector& one_vector = hier::IntVector::getOne(dim); const hier::Box quick_check( hier::Box::grow(src_shift, one_vector) * hier::Box::grow(dst_ghost, @@ -144,24 +150,26 @@ OutersideGeometry::doOverlap( hier::Box mask_shift(src_mask); transformation.transform(mask_shift); - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { - const hier::Box msk_side( - SideGeometry::toSideBox(mask_shift, d)); const hier::Box dst_side( SideGeometry::toSideBox(dst_ghost, d)); const hier::Box src_side( SideGeometry::toSideBox(src_shift, d)); - const hier::Box fill_side( - SideGeometry::toSideBox(fill_box, d)); const hier::Box together(dst_side * src_side); if (!together.empty()) { + const hier::Box msk_side( + SideGeometry::toSideBox(mask_shift, d)); + + const hier::Box fill_side( + SideGeometry::toSideBox(fill_box, d)); + // Add lower side intersection (if any) to the box list hier::Box low_side(src_side); - low_side.upper(d) = low_side.lower(d); //+ghosts; + low_side.setUpper(d, low_side.lower(d)); //+ghosts; hier::Box low_overlap(low_side * msk_side * dst_side * fill_side); if (!low_overlap.empty()) { @@ -170,14 +178,14 @@ OutersideGeometry::doOverlap( // Add upper side intersection (if any) to the box list hier::Box hig_side(src_side); - hig_side.lower(d) = hig_side.upper(d); //-ghosts; + hig_side.setLower(d, hig_side.upper(d)); //-ghosts; hier::Box hig_overlap(hig_side * msk_side * dst_side * fill_side); if (!hig_overlap.empty()) { dst_boxes[d].pushBack(hig_overlap); } - // Take away the interior of over_write interior is not set + // Take away the interior if overwrite_interior is not set if (!overwrite_interior) { dst_boxes[d].removeIntersections( SideGeometry::toSideBox(dst_geometry.getBox(), d)); @@ -185,9 +193,9 @@ OutersideGeometry::doOverlap( } // if (!together.empty()) - if (dst_restrict_boxes.size() && dst_boxes[d].size()) { + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { hier::BoxContainer side_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); b != dst_restrict_boxes.end(); ++b) { side_restrict_boxes.pushBack(SideGeometry::toSideBox(*b, d)); } @@ -203,6 +211,140 @@ OutersideGeometry::doOverlap( return boost::make_shared(dst_boxes, transformation); } +/* + ************************************************************************* + * + * Compute the overlap between two outerside centered boxes. + * The algorithm is similar to the standard side intersection algorithm + * except we operate only on the boundaries of the source box. + * + ************************************************************************* + */ + +boost::shared_ptr +OutersideGeometry::doOverlap( + const OutersideGeometry& dst_geometry, + const OutersideGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes) +{ + +#ifdef DEBUG_CHECK_DIM_ASSERTIONS + const hier::IntVector& src_offset = transformation.getOffset(); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); +#endif + + const tbox::Dimension& dim(src_mask.getDim()); + + std::vector dst_boxes(dim.getValue()); + + // Perform a quick-and-dirty intersection to see if the boxes might overlap + + const hier::Box src_box( + hier::Box::grow(src_geometry.d_box, src_geometry.d_ghosts) * src_mask); + hier::Box src_shift(src_box); + transformation.transform(src_shift); + const hier::Box dst_ghost( + hier::Box::grow(dst_geometry.getBox(), dst_geometry.getGhosts())); + + // Compute the intersection (if any) for each of the side directions + + const hier::IntVector& one_vector = hier::IntVector::getOne(dim); + + const hier::Box quick_check( + hier::Box::grow(src_shift, one_vector) * hier::Box::grow(dst_ghost, + one_vector)); + + if (!quick_check.empty()) { + + hier::Box mask_shift(src_mask); + transformation.transform(mask_shift); + + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { + + const hier::Box dst_side( + SideGeometry::toSideBox(dst_geometry.getBox(), d)); + const hier::Box src_side( + SideGeometry::toSideBox(src_shift, d)); + + const hier::Box together(dst_side * src_side); + + if (!together.empty()) { + + const hier::Box msk_side( + SideGeometry::toSideBox(mask_shift, d)); + + const hier::Box fill_side( + SideGeometry::toSideBox(fill_box, d)); + + hier::Box low_dst_side(dst_side); + low_dst_side.setUpper(d, low_dst_side.lower(d)); + hier::Box hig_dst_side(dst_side); + hig_dst_side.setLower(d, hig_dst_side.upper(d)); + + // Add lower side intersection (if any) to the box list + hier::Box low_src_side(src_side); + low_src_side.setUpper(d, low_src_side.lower(d)); + + hier::Box low_low_overlap(low_src_side * msk_side + * low_dst_side * fill_side); + if (!low_low_overlap.empty()) { + dst_boxes[d].pushBack(low_low_overlap); + } + + hier::Box low_hig_overlap(low_src_side * msk_side + * hig_dst_side * fill_side); + if (!low_hig_overlap.empty()) { + dst_boxes[d].pushBack(low_hig_overlap); + } + + // Add upper side intersection (if any) to the box list + hier::Box hig_src_side(src_side); + hig_src_side.setLower(d, hig_src_side.upper(d)); + + hier::Box hig_low_overlap(hig_src_side * msk_side + * low_dst_side * fill_side); + if (!hig_low_overlap.empty()) { + dst_boxes[d].pushBack(hig_low_overlap); + } + + hier::Box hig_hig_overlap(hig_src_side * msk_side + * hig_dst_side * fill_side); + if (!hig_hig_overlap.empty()) { + dst_boxes[d].pushBack(hig_hig_overlap); + } + + // Take away the interior if overwrite_interior is not set + if (!overwrite_interior) { + dst_boxes[d].removeIntersections( + SideGeometry::toSideBox(dst_geometry.getBox(), d)); + } + + } // if (!together.empty()) + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { + hier::BoxContainer side_restrict_boxes; + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); + b != dst_restrict_boxes.end(); ++b) { + side_restrict_boxes.pushBack(SideGeometry::toSideBox(*b, d)); + } + dst_boxes[d].intersectBoxes(side_restrict_boxes); + } + + dst_boxes[d].coalesce(); + + } // loop over dim + + } // if (!quick_check.empty()) + + // Create the side overlap data object using the boxes and source shift + + return boost::make_shared(dst_boxes, transformation); + +} + /* ************************************************************************* * @@ -216,10 +358,11 @@ OutersideGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box side_box(SideGeometry::toSideBox(*b, d)); dst_boxes[d].pushBack(side_box); } @@ -232,4 +375,3 @@ OutersideGeometry::setUpOverlap( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.h index 487963e7..40be086e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -33,12 +33,12 @@ class SideGeometry; * box geometries and side or outerside box geometries for communication * operations. * - * See header file for OutersideData class for a more detailed + * See header file for OutersideData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::SideGeometry - * @see pdat::SideOverlap + * @see SideGeometry + * @see SideOverlap */ class OutersideGeometry:public hier::BoxGeometry @@ -52,6 +52,9 @@ class OutersideGeometry:public hier::BoxGeometry /*! * @brief Construct an outerside geometry object given an AMR index * space box and ghost cell width. + * + * @pre box.getDim() == ghosts.getDim + * @pre ghosts.min() >= 0 */ OutersideGeometry( const hier::Box& box, @@ -65,6 +68,8 @@ class OutersideGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in side-centered index space on the * boundaries of the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -109,6 +114,9 @@ class OutersideGeometry:public hier::BoxGeometry * Function doOverlap() is the function that computes the overlap * between the source and destination objects, where the source * has outerside geometry and the destination side geometry. + * + * @pre src_mask.getDim() == transformation.getOffset().getDim() + * @pre dst_geometry.getDirectionVector() == hier::IntVector::getOne(src_mask.getDim()) */ static boost::shared_ptr doOverlap( @@ -120,9 +128,19 @@ class OutersideGeometry:public hier::BoxGeometry const hier::Transformation& transformation, const hier::BoxContainer& dst_restrict_boxes); + static boost::shared_ptr + doOverlap( + const OutersideGeometry& dst_geometry, + const OutersideGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes); + OutersideGeometry( const OutersideGeometry&); // not implemented - void + OutersideGeometry& operator = ( const OutersideGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.C index d5a7a26e..5d24db44 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/pdat/OutersideDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -47,37 +47,12 @@ template int OutersideVariable::getDepth() const { boost::shared_ptr > factory( - getPatchDataFactory()); + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -OutersideVariable::OutersideVariable( - const OutersideVariable& foo): - hier::Variable(NULL, - boost::shared_ptr()) -{ - NULL_USE(foo); -} - -template -void OutersideVariable::operator = ( - const OutersideVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.h index ad936b4c..ace14650 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/OutersideVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -22,23 +22,23 @@ namespace SAMRAI { namespace pdat { /*! - * @brief Class OutersideVariable is a templated variable class + * @brief Class OutersideVariable is a templated variable class * used to define side-centered data quantities only on patch boundaries. * It is a subclass of hier::Variable and is templated on the type * of the underlying data (e.g., double, int, bool, etc.). * * Note that the data layout in the outerside data arrays matches the corresponding * array sections provided by the side data implementation. See header file for - * the OutersideData class for a more detailed description of the data layout. + * the OutersideData class for a more detailed description of the data layout. * - * IMPORTANT: The class OuterfaceVariable and associated "outerface + * IMPORTANT: The class OuterfaceVariable and associated "outerface * data" classes define the same storage as this outerside variable class, * except that the individual array indices are permuted in the outerface * data type. * - * @see pdat::SideData - * @see pdat::OutersideData - * @see pdat::OutersideDataFactory + * @see SideData + * @see OutersideData + * @see OutersideDataFactory * @see hier::Variable */ @@ -89,10 +89,10 @@ class OutersideVariable:public hier::Variable private: // neither of the following functions are implemented OutersideVariable( - const OutersideVariable&); - void + const OutersideVariable&); + OutersideVariable& operator = ( - const OutersideVariable&); + const OutersideVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.C index 94569310..bf80187a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_pdat_SecondLayerNodeNoCornersVariableFillPattern_C -#define included_pdat_SecondLayerNodeNoCornersVariableFillPattern_C - #include "SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -71,7 +67,7 @@ SecondLayerNodeNoCornersVariableFillPattern::calculateOverlap( const bool overwrite_interior, const hier::Transformation& transformation) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); NULL_USE(overwrite_interior); hier::BoxContainer dst_boxes; @@ -79,26 +75,21 @@ SecondLayerNodeNoCornersVariableFillPattern::calculateOverlap( hier::Box dst_node_box(NodeGeometry::toNodeBox(dst_patch_box)); hier::Box src_node_mask(NodeGeometry::toNodeBox(src_mask)); - bool corner_overlap = ((dst_node_box * src_node_mask).size() == 1) - ? true : false; - - if (!corner_overlap) { - hier::BoxContainer stencil_boxes; - computeStencilBoxes(stencil_boxes, dst_patch_box); + hier::BoxContainer stencil_boxes; + computeStencilBoxes(stencil_boxes, dst_patch_box); - const NodeGeometry* t_dst = - dynamic_cast(&dst_geometry); - const NodeGeometry* t_src = - dynamic_cast(&src_geometry); + const NodeGeometry* t_dst = + CPP_CAST(&dst_geometry); + const NodeGeometry* t_src = + CPP_CAST(&src_geometry); - TBOX_ASSERT(t_dst); - TBOX_ASSERT(t_src); + TBOX_ASSERT(t_dst); + TBOX_ASSERT(t_src); - t_dst->computeDestinationBoxes(dst_boxes, *t_src, src_mask, fill_box, - false, transformation); + t_dst->computeDestinationBoxes(dst_boxes, *t_src, src_mask, fill_box, + false, transformation); - dst_boxes.intersectBoxes(stencil_boxes); - } + dst_boxes.intersectBoxes(stencil_boxes); return boost::make_shared(dst_boxes, transformation); @@ -150,15 +141,15 @@ SecondLayerNodeNoCornersVariableFillPattern::computeStencilBoxes( const tbox::Dimension& dim = dst_box.getDim(); hier::Box dst_node_box(NodeGeometry::toNodeBox(dst_box)); - for (unsigned short i = 0; i < dim.getValue(); i++) { + for (unsigned short i = 0; i < dim.getValue(); ++i) { hier::Box low_box(dst_node_box); - low_box.lower(i) = dst_node_box.lower(i) - 1; - low_box.upper(i) = low_box.lower(i); + low_box.setLower(i, dst_node_box.lower(i) - 1); + low_box.setUpper(i, low_box.lower(i)); stencil_boxes.pushFront(low_box); hier::Box high_box(dst_node_box); - high_box.lower(i) = dst_node_box.upper(i) + 1; - high_box.upper(i) = high_box.lower(i); + high_box.setLower(i, dst_node_box.upper(i) + 1); + high_box.setUpper(i, high_box.lower(i)); stencil_boxes.pushFront(high_box); } } @@ -175,6 +166,7 @@ SecondLayerNodeNoCornersVariableFillPattern::computeStencilBoxes( boost::shared_ptr SecondLayerNodeNoCornersVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const @@ -192,7 +184,7 @@ SecondLayerNodeNoCornersVariableFillPattern::computeFillBoxesOverlap( * to a node centering, which must be done before intersecting with * stencil_boxes, which is node-centered. */ - for (hier::BoxContainer::iterator b(overlap_boxes); + for (hier::BoxContainer::iterator b = overlap_boxes.begin(); b != overlap_boxes.end(); ++b) { b->growUpper(hier::IntVector::getOne(dim)); } @@ -200,14 +192,14 @@ SecondLayerNodeNoCornersVariableFillPattern::computeFillBoxesOverlap( overlap_boxes.intersectBoxes(NodeGeometry::toNodeBox(data_box)); overlap_boxes.intersectBoxes(stencil_boxes); + overlap_boxes.intersectBoxes(node_fill_boxes); overlap_boxes.coalesce(); return boost::make_shared( - overlap_boxes, - hier::Transformation(hier::IntVector::getZero(dim))); + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(dim))); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h index 4eab0f53..29b47762 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Second layer node fill pattern class * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -75,6 +75,8 @@ class SecondLayerNodeNoCornersVariableFillPattern: * destination index space. * * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() */ boost::shared_ptr calculateOverlap( @@ -98,6 +100,7 @@ class SecondLayerNodeNoCornersVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -109,6 +112,7 @@ class SecondLayerNodeNoCornersVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -129,7 +133,7 @@ class SecondLayerNodeNoCornersVariableFillPattern: private: SecondLayerNodeNoCornersVariableFillPattern( const SecondLayerNodeNoCornersVariableFillPattern&); // not implemented - void + SecondLayerNodeNoCornersVariableFillPattern& operator = ( const SecondLayerNodeNoCornersVariableFillPattern&); // not implemented @@ -143,6 +147,8 @@ class SecondLayerNodeNoCornersVariableFillPattern: * * @param[out] stencil_boxes The computed stencil BoxContainer. * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == 0 */ void computeStencilBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.C index 1d38f7f6..0779a022 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_pdat_SecondLayerNodeVariableFillPattern_C -#define included_pdat_SecondLayerNodeVariableFillPattern_C - #include "SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/pdat/NodeGeometry.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -69,38 +65,21 @@ SecondLayerNodeVariableFillPattern::calculateOverlap( const bool overwrite_interior, const hier::Transformation& transformation) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); NULL_USE(overwrite_interior); const tbox::Dimension dim(dst_patch_box.getDim()); hier::Box dst_node_box(NodeGeometry::toNodeBox(dst_patch_box)); hier::Box src_node_mask(NodeGeometry::toNodeBox(src_mask)); - bool corner_overlap = ((dst_node_box * src_node_mask).size() == 1) - ? true : false; hier::BoxContainer stencil_boxes; computeStencilBoxes(stencil_boxes, dst_patch_box); - if (corner_overlap) { - hier::IntVector grow_vec(dim, 0); - hier::Box grow_box(dim); - hier::BoxContainer remove_list; - for (unsigned int i = 0; i < dim.getValue(); i++) { - grow_box = dst_node_box; - grow_vec(i) = 1; - grow_box.grow(grow_vec); - remove_list.pushFront(grow_box); - grow_vec(i) = 0; - } - stencil_boxes.removeIntersections(remove_list); - } hier::BoxContainer dst_boxes; - const NodeGeometry* t_dst = - dynamic_cast(&dst_geometry); - const NodeGeometry* t_src = - dynamic_cast(&src_geometry); + const NodeGeometry* t_dst = CPP_CAST(&dst_geometry); + const NodeGeometry* t_src = CPP_CAST(&src_geometry); TBOX_ASSERT(t_dst); TBOX_ASSERT(t_src); @@ -162,6 +141,7 @@ SecondLayerNodeVariableFillPattern::computeStencilBoxes( hier::Box ghost_box(dst_node_box); ghost_box.grow(hier::IntVector::getOne(dst_box.getDim())); stencil_boxes.removeIntersections(ghost_box, dst_node_box); + stencil_boxes.coalesce(); } /* @@ -176,6 +156,7 @@ SecondLayerNodeVariableFillPattern::computeStencilBoxes( boost::shared_ptr SecondLayerNodeVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const @@ -194,7 +175,7 @@ SecondLayerNodeVariableFillPattern::computeFillBoxesOverlap( * to a node centering, which must be done before intersecting with * stencil_boxes, which is node-centered. */ - for (hier::BoxContainer::iterator b(overlap_boxes); + for (hier::BoxContainer::iterator b = overlap_boxes.begin(); b != overlap_boxes.end(); ++b) { b->growUpper(hier::IntVector::getOne(patch_box.getDim())); } @@ -202,14 +183,14 @@ SecondLayerNodeVariableFillPattern::computeFillBoxesOverlap( overlap_boxes.intersectBoxes(NodeGeometry::toNodeBox(data_box)); overlap_boxes.intersectBoxes(stencil_boxes); + overlap_boxes.intersectBoxes(node_fill_boxes); overlap_boxes.coalesce(); return boost::make_shared( - overlap_boxes, - hier::Transformation(hier::IntVector::getZero(dim))); + overlap_boxes, + hier::Transformation(hier::IntVector::getZero(dim))); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h index 6eef06a5..3e44391d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Second layer node fill pattern class * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -73,6 +73,10 @@ class SecondLayerNodeVariableFillPattern: * destination index space. * * @return boost::shared_ptr to the calculated overlap object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() + * @pre dynamic_cast(&dst_geometry) != 0 + * @pre dynamic_cast(&src_geometry) != 0 */ boost::shared_ptr calculateOverlap( @@ -96,6 +100,7 @@ class SecondLayerNodeVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered represenation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -107,6 +112,7 @@ class SecondLayerNodeVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -126,7 +132,7 @@ class SecondLayerNodeVariableFillPattern: private: SecondLayerNodeVariableFillPattern( const SecondLayerNodeVariableFillPattern&); // not implemented - void + SecondLayerNodeVariableFillPattern& operator = ( const SecondLayerNodeVariableFillPattern&); // not implemented @@ -139,6 +145,8 @@ class SecondLayerNodeVariableFillPattern: * * @param[out] stencil_boxes The computed stencil BoxContainer. * @param[in] dst_box Input box around which stencil is computed. + * + * @pre stencil_boxes.size() == 0 */ void computeStencilBoxes( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.C index 15be1c3d..4135659e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered complex data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_SideComplexConstantRefine_C -#define included_pdat_SideComplexConstantRefine_C - #include "SAMRAI/pdat/SideComplexConstantRefine.h" #include @@ -35,21 +31,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefsidecplx1d, CONREFSIDECPLX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx1d, CONREFSIDECPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine2d.f: -void F77_FUNC(conrefsidecplx2d0, CONREFSIDECPLX2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx2d0, CONREFSIDECPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefsidecplx2d1, CONREFSIDECPLX2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx2d1, CONREFSIDECPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(conrefsidecplx2d1, CONREFSIDECPLX2D1) (const int&, const int&, const int *, const dcomplex *, dcomplex *); // in conrefine3d.f: -void F77_FUNC(conrefsidecplx3d0, CONREFSIDECPLX3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx3d0, CONREFSIDECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,7 +64,7 @@ void F77_FUNC(conrefsidecplx3d0, CONREFSIDECPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefsidecplx3d1, CONREFSIDECPLX3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx3d1, CONREFSIDECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -79,7 +75,7 @@ void F77_FUNC(conrefsidecplx3d1, CONREFSIDECPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const dcomplex *, dcomplex *); -void F77_FUNC(conrefsidecplx3d2, CONREFSIDECPLX3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidecplx3d2, CONREFSIDECPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,9 +91,8 @@ void F77_FUNC(conrefsidecplx3d2, CONREFSIDECPLX3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -SideComplexConstantRefine::SideComplexConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +SideComplexConstantRefine::SideComplexConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -112,9 +107,9 @@ SideComplexConstantRefine::getOperatorPriority() const } hier::IntVector -SideComplexConstantRefine::getStencilWidth() const +SideComplexConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void SideComplexConstantRefine::refine( @@ -125,58 +120,57 @@ void SideComplexConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const SideOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); const hier::IntVector& directions = fdata->getDirectionVector(); TBOX_ASSERT(directions == hier::IntVector::min(directions, cdata->getDirectionVector())); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(axis)) { - F77_FUNC(conrefsidecplx1d, CONREFSIDECPLX1D) ( + SAMRAI_F77_FUNC(conrefsidecplx1d, CONREFSIDECPLX1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -187,7 +181,7 @@ void SideComplexConstantRefine::refine( } } else if (dim == tbox::Dimension(2)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsidecplx2d0, CONREFSIDECPLX2D0) ( + SAMRAI_F77_FUNC(conrefsidecplx2d0, CONREFSIDECPLX2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -197,7 +191,7 @@ void SideComplexConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsidecplx2d1, CONREFSIDECPLX2D1) ( + SAMRAI_F77_FUNC(conrefsidecplx2d1, CONREFSIDECPLX2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -208,7 +202,7 @@ void SideComplexConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsidecplx3d0, CONREFSIDECPLX3D0) ( + SAMRAI_F77_FUNC(conrefsidecplx3d0, CONREFSIDECPLX3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -222,7 +216,7 @@ void SideComplexConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsidecplx3d1, CONREFSIDECPLX3D1) ( + SAMRAI_F77_FUNC(conrefsidecplx3d1, CONREFSIDECPLX3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -236,7 +230,7 @@ void SideComplexConstantRefine::refine( fdata->getPointer(1, d)); } if (axis == 2 && directions(2)) { - F77_FUNC(conrefsidecplx3d2, CONREFSIDECPLX3D2) ( + SAMRAI_F77_FUNC(conrefsidecplx3d2, CONREFSIDECPLX3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -261,4 +255,3 @@ void SideComplexConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.h index 6c819c0d..e5a528a0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered complex data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -40,8 +40,7 @@ class SideComplexConstantRefine: /** * Uninteresting default constructor. */ - explicit SideComplexConstantRefine( - const tbox::Dimension& dim); + SideComplexConstantRefine(); /** * Uninteresting virtual destructor. @@ -60,7 +59,8 @@ class SideComplexConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -69,6 +69,8 @@ class SideComplexConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.C index 5751d5d9..63c66aa9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered complex data. * ************************************************************************/ - -#ifndef included_pdat_SideComplexLinearTimeInterpolateOp_C -#define included_pdat_SideComplexLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.h" #include "SAMRAI/tbox/Complex.h" @@ -22,7 +18,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -38,7 +34,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintsidecmplx1d, LINTIMEINTSIDECMPLX1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx1d, LINTIMEINTSIDECMPLX1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -47,7 +43,7 @@ void F77_FUNC(lintimeintsidecmplx1d, LINTIMEINTSIDECMPLX1D) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint2d.f: -void F77_FUNC(lintimeintsidecmplx2d0, LINTIMEINTSIDECMPLX2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx2d0, LINTIMEINTSIDECMPLX2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -59,7 +55,7 @@ void F77_FUNC(lintimeintsidecmplx2d0, LINTIMEINTSIDECMPLX2D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintsidecmplx2d1, LINTIMEINTSIDECMPLX2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx2d1, LINTIMEINTSIDECMPLX2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -72,7 +68,7 @@ void F77_FUNC(lintimeintsidecmplx2d1, LINTIMEINTSIDECMPLX2D1) (const int&, const dcomplex *, const dcomplex *, dcomplex *); // in lintimint3d.f: -void F77_FUNC(lintimeintsidecmplx3d0, LINTIMEINTSIDECMPLX3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx3d0, LINTIMEINTSIDECMPLX3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -84,7 +80,7 @@ void F77_FUNC(lintimeintsidecmplx3d0, LINTIMEINTSIDECMPLX3D0) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintsidecmplx3d1, LINTIMEINTSIDECMPLX3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx3d1, LINTIMEINTSIDECMPLX3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -96,7 +92,7 @@ void F77_FUNC(lintimeintsidecmplx3d1, LINTIMEINTSIDECMPLX3D1) (const int&, const double&, const dcomplex *, const dcomplex *, dcomplex *); -void F77_FUNC(lintimeintsidecmplx3d2, LINTIMEINTSIDECMPLX3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidecmplx3d2, LINTIMEINTSIDECMPLX3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -132,19 +128,19 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const SideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const SideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); SideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); const hier::IntVector& directions = dst_dat->getDirectionVector(); @@ -153,16 +149,16 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( TBOX_ASSERT(directions == hier::IntVector::min(directions, new_dat->getDirectionVector())); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -181,10 +177,10 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(0)) { - F77_FUNC(lintimeintsidecmplx1d, LINTIMEINTSIDECMPLX1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx1d, LINTIMEINTSIDECMPLX1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -196,7 +192,7 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(2)) { if (directions(0)) { - F77_FUNC(lintimeintsidecmplx2d0, LINTIMEINTSIDECMPLX2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx2d0, LINTIMEINTSIDECMPLX2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -207,7 +203,7 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidecmplx2d1, LINTIMEINTSIDECMPLX2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx2d1, LINTIMEINTSIDECMPLX2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -219,7 +215,7 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(3)) { if (directions(0)) { - F77_FUNC(lintimeintsidecmplx3d0, LINTIMEINTSIDECMPLX3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx3d0, LINTIMEINTSIDECMPLX3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -234,7 +230,7 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidecmplx3d1, LINTIMEINTSIDECMPLX3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx3d1, LINTIMEINTSIDECMPLX3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -249,7 +245,7 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(lintimeintsidecmplx3d2, LINTIMEINTSIDECMPLX3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidecmplx3d2, LINTIMEINTSIDECMPLX3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -273,4 +269,3 @@ SideComplexLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.h index ee61096c..7e8db7f7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideComplexLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered complex data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class SideComplexLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.C index ffc8165d..a2a9da39 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated side centered patch data type * ************************************************************************/ @@ -44,20 +44,19 @@ SideData::SideData( d_depth(depth), d_directions(directions) { - TBOX_DIM_ASSERT_CHECK_ARGS3(box, ghosts, directions); + TBOX_ASSERT_OBJDIM_EQUALITY3(box, ghosts, directions); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); TBOX_ASSERT(directions.min() >= 0); const tbox::Dimension& dim(box.getDim()); - for (int d = 0; d < getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { - const hier::Box side = - SideGeometry::toSideBox(getGhostBox(), d); - d_data[d].initializeArray(side, depth); + const hier::Box side = SideGeometry::toSideBox(getGhostBox(), d); + d_data[d].reset(new ArrayData(side, depth)); } else { - d_data[d].invalidateArray(dim); + d_data[d].reset(new ArrayData(hier::Box::getEmptyBox(dim), depth)); } } } @@ -72,21 +71,14 @@ SideData::SideData( d_depth(depth), d_directions(hier::IntVector::getOne(box.getDim())) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); TBOX_ASSERT(d_directions.min() >= 0); - const tbox::Dimension& dim(box.getDim()); - - for (int d = 0; d < getDim().getValue(); d++) { - if (d_directions(d)) { - const hier::Box side = - SideGeometry::toSideBox(getGhostBox(), d); - d_data[d].initializeArray(side, depth); - } else { - d_data[d].invalidateArray(dim); - } + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { + const hier::Box side = SideGeometry::toSideBox(getGhostBox(), d); + d_data[d].reset(new ArrayData(side, depth)); } } @@ -95,34 +87,6 @@ SideData::~SideData() { } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -SideData::SideData( - const SideData& foo): - hier::PatchData(foo.getBox(), - foo.getGhostCellWidth()), - d_directions(tbox::Dimension(getDim())) -{ - NULL_USE(foo); -} - -template -void -SideData::operator = ( - const SideData& foo) -{ - NULL_USE(foo); -} - template const hier::IntVector& SideData::getDirectionVector() const @@ -138,7 +102,7 @@ SideData::getDepth() const } template -TYPE* +TYPE * SideData::getPointer( int side_normal, int depth) @@ -147,11 +111,11 @@ SideData::getPointer( TBOX_ASSERT(d_directions(side_normal)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[side_normal].getPointer(depth); + return d_data[side_normal]->getPointer(depth); } template -const TYPE* +const TYPE * SideData::getPointer( int side_normal, int depth) const @@ -160,7 +124,7 @@ SideData::getPointer( TBOX_ASSERT(d_directions(side_normal)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[side_normal].getPointer(depth); + return d_data[side_normal]->getPointer(depth); } template @@ -169,7 +133,7 @@ SideData::operator () ( const SideIndex& i, int depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -177,7 +141,7 @@ SideData::operator () ( TBOX_ASSERT(d_directions(axis)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -186,7 +150,7 @@ SideData::operator () ( const SideIndex& i, int depth) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, i); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, i); const int axis = i.getAxis(); @@ -194,7 +158,7 @@ SideData::operator () ( TBOX_ASSERT(d_directions(axis)); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - return d_data[axis](i, depth); + return (*(d_data[axis]))(i, depth); } template @@ -205,7 +169,7 @@ SideData::getArrayData( TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); TBOX_ASSERT(d_directions(side_normal)); - return d_data[side_normal]; + return *(d_data[side_normal]); } template @@ -216,7 +180,7 @@ SideData::getArrayData( TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); TBOX_ASSERT(d_directions(side_normal)); - return d_data[side_normal]; + return *(d_data[side_normal]); } /* @@ -233,23 +197,22 @@ void SideData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, src); - const SideData* t_src = - dynamic_cast *>(&src); + const SideData* t_src = dynamic_cast *>(&src); - if (t_src == NULL) { + if (t_src == 0) { src.copy2(*this); } else { TBOX_ASSERT(t_src->getDirectionVector() == d_directions); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { const hier::Box box = - d_data[d].getBox() * t_src->d_data[d].getBox(); + d_data[d]->getBox() * t_src->d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copy(t_src->d_data[d], box); + d_data[d]->copy(*(t_src->d_data[d]), box); } } } @@ -261,19 +224,18 @@ void SideData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, dst); - SideData* t_dst = - dynamic_cast *>(&dst); + SideData* t_dst = CPP_CAST *>(&dst); - TBOX_ASSERT(t_dst != NULL); + TBOX_ASSERT(t_dst != 0); TBOX_ASSERT(t_dst->getDirectionVector() == d_directions); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { - const hier::Box box = d_data[d].getBox() * t_dst->d_data[d].getBox(); + const hier::Box box = d_data[d]->getBox() * t_dst->d_data[d]->getBox(); if (!box.empty()) { - t_dst->d_data[d].copy(d_data[d], box); + t_dst->d_data[d]->copy(*(d_data[d]), box); } } } @@ -294,28 +256,26 @@ SideData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, src); - const SideData* t_src = - dynamic_cast *>(&src); - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideData* t_src = dynamic_cast *>(&src); + const SideOverlap* t_overlap = dynamic_cast(&overlap); - if ((t_src == NULL) || (t_overlap == NULL)) { + if ((t_src == 0) || (t_overlap == 0)) { src.copy2(*this, overlap); } else { TBOX_ASSERT(t_src->getDirectionVector() == d_directions); const hier::Transformation& transformation = - t_overlap->getTransformation(); + t_overlap->getTransformation(); if (transformation.getRotation() == hier::Transformation::NO_ROTATE) { - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - d_data[d].copy(t_src->d_data[d], box_list, transformation); + d_data[d]->copy(*(t_src->d_data[d]), box_list, transformation); } } } else { @@ -330,25 +290,23 @@ SideData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, dst); - SideData* t_dst = - dynamic_cast *>(&dst); - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + SideData* t_dst = CPP_CAST *>(&dst); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_dst != NULL); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_dst != 0); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(t_dst->getDirectionVector() == d_directions); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { const hier::IntVector& src_offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { const hier::BoxContainer& box_list = t_overlap->getDestinationBoxContainer(d); - t_dst->d_data[d].copy(d_data[d], box_list, src_offset); + t_dst->d_data[d]->copy(*(d_data[d]), box_list, src_offset); } } } else { @@ -362,11 +320,11 @@ SideData::copyOnBox( const SideData& src, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, src, box); + TBOX_ASSERT_OBJDIM_EQUALITY3(*this, src, box); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { const hier::Box side_box = SideGeometry::toSideBox(box, axis); - d_data[axis].copy(src.getArrayData(axis), side_box); + d_data[axis]->copy(src.getArrayData(axis), side_box); } } @@ -401,13 +359,13 @@ SideData::copyWithRotation( rotatebox.getBlockId(), getBox().getBlockId()); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (d_directions(i)) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); hier::Box side_rotatebox(SideGeometry::toSideBox(rotatebox, i)); - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -417,15 +375,16 @@ SideData::copyWithRotation( const int depth = ((getDepth() < src.getDepth()) ? getDepth() : src.getDepth()); - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); + ci != ciend; ++ci) { SideIndex dst_index(*ci, 0, 0); dst_index.setAxis(i); SideIndex src_index(dst_index); SideGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*this)(dst_index, d) = src(src_index, d); } } @@ -451,14 +410,14 @@ SideData::copyDepth( const SideData& src, int src_depth) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, src); TBOX_ASSERT(src.d_directions == d_directions); - for (int d = 0; d < getDim().getValue(); d++) { + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { - const hier::Box box = d_data[d].getBox() * src.d_data[d].getBox(); + const hier::Box box = d_data[d]->getBox() * src.d_data[d]->getBox(); if (!box.empty()) { - d_data[d].copyDepth(dst_depth, src.d_data[d], src_depth, box); + d_data[d]->copyDepth(dst_depth, *(src.d_data[d]), src_depth, box); } } } @@ -481,22 +440,22 @@ SideData::canEstimateStreamSizeFromBox() const } template -int +size_t SideData::getDataStreamSize( const hier::BoxOverlap& overlap) const { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - int size = 0; - for (int d = 0; d < getDim().getValue(); d++) { + size_t size = 0; + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { size += - d_data[d].getDataStreamSize(t_overlap->getDestinationBoxContainer(d), + d_data[d]->getDataStreamSize( + t_overlap->getDestinationBoxContainer(d), offset); } } @@ -518,20 +477,19 @@ SideData::packStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) const { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); if (t_overlap->getTransformation().getRotation() == hier::Transformation::NO_ROTATE) { - const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + const hier::Transformation& transformation = t_overlap->getTransformation(); + for (int d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].packStream(stream, boxes, offset); + if (!boxes.empty()) { + d_data[d]->packStream(stream, boxes, transformation); } } } @@ -570,19 +528,19 @@ SideData::packWithRotation( rotatebox.getBlockId(), getBox().getBlockId()); - const int depth = getDepth(); + const unsigned int depth = getDepth(); - for (int i = 0; i < dim.getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < dim.getValue(); ++i) { if (d_directions(i)) { const hier::BoxContainer& overlap_boxes = overlap.getDestinationBoxContainer(i); - const int size = depth * overlap_boxes.getTotalSizeOfBoxes(); - tbox::Array buffer(size); + const size_t size = depth * overlap_boxes.getTotalSizeOfBoxes(); + std::vector buffer(size); hier::Box side_rotatebox(SideGeometry::toSideBox(rotatebox, i)); int buf_count = 0; - for (hier::BoxContainer::const_iterator bi(overlap_boxes); + for (hier::BoxContainer::const_iterator bi = overlap_boxes.begin(); bi != overlap_boxes.end(); ++bi) { const hier::Box& overlap_box = *bi; @@ -590,22 +548,23 @@ SideData::packWithRotation( if (!copybox.empty()) { - for (int d = 0; d < depth; d++) { + for (unsigned int d = 0; d < depth; ++d) { - hier::Box::iterator ciend(copybox, false); - for (hier::Box::iterator ci(copybox, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(copybox.end()); + for (hier::Box::iterator ci(copybox.begin()); + ci != ciend; ++ci) { SideIndex src_index(*ci, 0, 0); src_index.setAxis(i); SideGeometry::transform(src_index, back_trans); buffer[buf_count] = (*this)(src_index, d); - buf_count++; + ++buf_count; } } } } - stream.pack(buffer.getPointer(), size); + stream.pack(&buffer[0], size); } } } @@ -616,17 +575,16 @@ SideData::unpackStream( tbox::MessageStream& stream, const hier::BoxOverlap& overlap) { - const SideOverlap* t_overlap = - dynamic_cast(&overlap); + const SideOverlap* t_overlap = CPP_CAST(&overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); const hier::IntVector& offset = t_overlap->getSourceOffset(); - for (int d = 0; d < getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < getDim().getValue(); ++d) { if (d_directions(d)) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(d); - if (boxes.size() > 0) { - d_data[d].unpackStream(stream, boxes, offset); + if (!boxes.empty()) { + d_data[d]->unpackStream(stream, boxes, offset); } } } @@ -649,13 +607,13 @@ SideData::getSizeOfData( const hier::IntVector& ghosts, const hier::IntVector& directions) { - TBOX_DIM_ASSERT_CHECK_ARGS3(box, ghosts, directions); + TBOX_ASSERT_OBJDIM_EQUALITY3(box, ghosts, directions); TBOX_ASSERT(depth > 0); TBOX_ASSERT(directions.min() >= 0); size_t size = 0; const hier::Box ghost_box = hier::Box::grow(box, ghosts); - for (int d = 0; d < box.getDim().getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < box.getDim().getValue(); ++d) { if (directions(d)) { const hier::Box side_box = SideGeometry::toSideBox(ghost_box, d); size += ArrayData::getSizeOfData(side_box, depth); @@ -680,9 +638,9 @@ SideData::fill( { TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { - d_data[i].fill(t, d); + d_data[i]->fill(t, d); } } } @@ -694,12 +652,12 @@ SideData::fill( const hier::Box& box, int d) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { - d_data[i].fill(t, SideGeometry::toSideBox(box, i), d); + d_data[i]->fill(t, SideGeometry::toSideBox(box, i), d); } } } @@ -709,9 +667,9 @@ void SideData::fillAll( const TYPE& t) { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { - d_data[i].fillAll(t); + d_data[i]->fillAll(t); } } } @@ -722,11 +680,11 @@ SideData::fillAll( const TYPE& t, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); - for (int i = 0; i < getDim().getValue(); i++) { + for (tbox::Dimension::dir_t i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { - d_data[i].fillAll(t, SideGeometry::toSideBox(box, i)); + d_data[i]->fillAll(t, SideGeometry::toSideBox(box, i)); } } } @@ -747,9 +705,9 @@ SideData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < getDim().getValue(); ++axis) { os << "Array side normal = " << axis << std::endl; printAxis(axis, box, os, prec); } @@ -763,10 +721,10 @@ SideData::print( std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); TBOX_ASSERT((d >= 0) && (d < d_depth)); - for (int axis = 0; axis < getDim().getValue(); axis++) { + for (int axis = 0; axis < getDim().getValue(); ++axis) { os << "Array side normal = " << axis << std::endl; printAxis(axis, box, d, os, prec); } @@ -775,39 +733,40 @@ SideData::print( template void SideData::printAxis( - int axis, + tbox::Dimension::dir_t side_normal, const hier::Box& box, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); - TBOX_ASSERT((axis >= 0) && (axis < getDim().getValue())); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); + TBOX_ASSERT((side_normal < getDim().getValue())); - for (int d = 0; d < d_depth; d++) { + for (int d = 0; d < d_depth; ++d) { os << "Array depth = " << d << std::endl; - printAxis(axis, box, d, os, prec); + printAxis(side_normal, box, d, os, prec); } } template void SideData::printAxis( - int side_normal, + tbox::Dimension::dir_t side_normal, const hier::Box& box, int depth, std::ostream& os, int prec) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_directions, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_directions, box); TBOX_ASSERT((depth >= 0) && (depth < d_depth)); - TBOX_ASSERT((side_normal >= 0) && (side_normal < getDim().getValue())); + TBOX_ASSERT((side_normal < getDim().getValue())); os.precision(prec); if (d_directions(side_normal)) { - SideIterator iend(box, side_normal, false); - for (SideIterator i(box, side_normal, true); i != iend; ++i) { + SideIterator iend(SideGeometry::end(box, side_normal)); + for (SideIterator i(SideGeometry::begin(box, side_normal)); + i != iend; ++i) { os << "array" << *i << " = " - << d_data[side_normal](*i, depth) << std::endl << std::flush; + << (*(d_data[side_normal]))(*i, depth) << std::endl << std::flush; } } else { os << "No side data in " << side_normal << " side normal direction" @@ -819,7 +778,7 @@ SideData::printAxis( ************************************************************************* * * Checks that class version and restart file version are equal. If so, - * reads in the d_depth data member to the database. Then tells + * reads in the d_depth data member to the restart database. Then tells * d_data to read itself in from the database. * ************************************************************************* @@ -827,25 +786,27 @@ SideData::printAxis( template void -SideData::getSpecializedFromDatabase( - const boost::shared_ptr& database) +SideData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); - int ver = database->getInteger("PDAT_SIDEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_SIDEDATA_VERSION"); if (ver != PDAT_SIDEDATA_VERSION) { - TBOX_ERROR("SideData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("SideData::getFromRestart error...\n" << " : Restart file version different than class version" << std::endl); } - d_depth = database->getInteger("d_depth"); + d_depth = restart_db->getInteger("d_depth"); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->getDatabase(array_name); - (d_data[i]).getFromDatabase(array_database); + array_database = restart_db->getDatabase(array_name); + d_data[i]->getFromRestart(array_database); } } } @@ -861,21 +822,23 @@ SideData::getSpecializedFromDatabase( template void -SideData::putSpecializedToDatabase( - const boost::shared_ptr& database) const +SideData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(database); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); - database->putInteger("PDAT_SIDEDATA_VERSION", PDAT_SIDEDATA_VERSION); + restart_db->putInteger("PDAT_SIDEDATA_VERSION", PDAT_SIDEDATA_VERSION); - database->putInteger("d_depth", d_depth); + restart_db->putInteger("d_depth", d_depth); boost::shared_ptr array_database; - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < getDim().getValue(); ++i) { if (d_directions(i)) { std::string array_name = "d_data" + tbox::Utilities::intToString(i); - array_database = database->putDatabase(array_name); - (d_data[i]).putUnregisteredToDatabase(array_database); + array_database = restart_db->putDatabase(array_name); + d_data[i]->putToRestart(array_database); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.h index 35c1d22b..077ca79d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Templated side centered patch data type * ************************************************************************/ @@ -17,26 +17,27 @@ #include "SAMRAI/pdat/ArrayData.h" #include "SAMRAI/pdat/SideIndex.h" #include "SAMRAI/pdat/SideIterator.h" +#include "SAMRAI/pdat/SideOverlap.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { namespace pdat { /*! - * @brief Class SideData provides an implementation for data defined - * at cell sides (faces) on AMR patches. It is derived from the hier::PatchData - * interface common to all SAMRAI patch data types. Given a CELL-centered - * AMR index space box, a side data object represents data of some template - * TYPE and depth on the sides (faces) of the cells in the box. Here, depth - * indicates the number of data values at each side index location. The - * SideGeometry class provides the translation between the standard SAMRAI + * @brief Class SideData provides an implementation for data defined + * at cell sides (faces) on AMR patches. It is derived from the + * hier::PatchData interface common to all SAMRAI patch data types. Given a + * CELL-centered AMR index space box, a side data object represents data of + * some template TYPE and depth on the sides (faces) of the cells in the box. + * Here, depth indicates the number of data values at each side index location. + * The SideGeometry class provides the translation between the standard SAMRAI * cell-centered AMR index space and side-centered data. * - * IMPORTANT: The FaceData class provides the same storage + * IMPORTANT: The FaceData class provides the same storage * as this side data class, except that the coordinate directions of the * individual arrays are permuted in the face data implementation. * @@ -46,7 +47,7 @@ namespace pdat { * style) so that the leftmost index runs fastest in memory. * For example, a three-dimensional side data object created over a * CELL-centered AMR index space [l0:u0,l1:u1,l2:u2] allocates three data - * arrays dimensioned as follows: + * arrays sized as follows: * \verbatim * * side normal 0 @@ -78,12 +79,12 @@ namespace pdat { * The data type TYPE must define a default constructor (that takes no * arguments) and also the assignment operator. * - * @see pdat::ArrayData + * @see ArrayData * @see hier::PatchData - * @see pdat::SideDataFactory - * @see pdat::SideIndex - * @see pdat::SideIterator - * @see pdat::SideGeometry + * @see SideDataFactory + * @see SideIndex + * @see SideIterator + * @see SideGeometry */ template @@ -109,6 +110,11 @@ class SideData:public hier::PatchData * @param directions const IntVector reference indicating which * coordinate directions are assumed to have data * for the purposes of the calculation. + * + * @pre (box.getDim() == ghosts.getDim()) && + * (box.getDim() == directions.getDim()) + * @pre depth > 0 + * @pre directions.min() >= 0 */ static size_t getSizeOfData( @@ -131,6 +137,12 @@ class SideData:public hier::PatchData * @param directions const IntVector reference indicating which * coordinate directions will have data associated * with them. + * + * @pre (box.getDim() == ghosts.getDim()) && + * (box.getDim() == directions.getDim()) + * @pre depth > 0 + * @pre ghosts.min() >= 0 + * @pre directions.min() >= 0 */ SideData( const hier::Box& box, @@ -142,6 +154,10 @@ class SideData:public hier::PatchData * @brief Same as previous constructor but with directions * vector of 1's. * + * @pre box.getDim() == ghosts.getDim() + * @pre depth > 0 + * @pre ghosts.min() >= 0 + * */ SideData( const hier::Box& box, @@ -175,6 +191,10 @@ class SideData:public hier::PatchData /*! * @brief Get a pointer to the beginning of a particular side normal and * depth component of the side centered array. + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre getDirectionVector()(side_normal) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE * getPointer( @@ -184,6 +204,10 @@ class SideData:public hier::PatchData /*! * @brief Get a const pointer to the beginning of a particular side normal * and depth component of the side centered array. + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre getDirectionVector()(side_normal) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE * getPointer( @@ -193,6 +217,10 @@ class SideData:public hier::PatchData /*! * @brief Return a reference to the data entry corresponding * to a given side index and depth. + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre getDirectionVector()(i.getAxis()) + * @pre (depth >= 0) && (depth < getDepth()) */ TYPE& operator () ( @@ -202,6 +230,10 @@ class SideData:public hier::PatchData /*! * @brief Return a const reference to the data entry corresponding * to a given side index and depth. + * + * @pre (i.getAxis() >= 0) && (i.getAxis() < getDim().getValue()) + * @pre getDirectionVector()(i.getAxis()) + * @pre (depth >= 0) && (depth < getDepth()) */ const TYPE& operator () ( @@ -211,6 +243,9 @@ class SideData:public hier::PatchData /*! * @brief Return a reference to the array data object for the * given side normal of the side centered data object. + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre getDirectionVector()(side_normal) */ ArrayData& getArrayData( @@ -219,6 +254,9 @@ class SideData:public hier::PatchData /*! * @brief Return a const reference to the array data object for the * given side normal of the side centered data object. + * + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) + * @pre getDirectionVector()(side_normal) */ const ArrayData& getArrayData( @@ -233,6 +271,8 @@ class SideData:public hier::PatchData * both the source and destination). Currently, source data must be * an SideData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDirectionVector().getDim() == src.getDim() */ virtual void copy( @@ -247,6 +287,10 @@ class SideData:public hier::PatchData * both the source and destination). Currently, destination data must be * an SideData of the same DIM and TYPE. If not, then an unrecoverable * error results. + * + * @pre getDirectionVector().getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre (dynamic_cast *>(&dst))->getDirectionVector() == getDirectionVector() */ virtual void copy2( @@ -259,6 +303,8 @@ class SideData:public hier::PatchData * Currently, source data must be SideData of the same DIM and TYPE * and the overlap must be a SideOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDirectionVector().getDim() == src.getDim() */ virtual void copy( @@ -272,6 +318,11 @@ class SideData:public hier::PatchData * Currently, destination data must be SideData of the same DIM and TYPE * and the overlap must be a SideOverlap of the same DIM. If not, * then an unrecoverable error results. + * + * @pre getDirectionVector().getDim() == dst.getDim() + * @pre dynamic_cast *>(&dst) != 0 + * @pre dynamic_cast(&overlap) != 0 + * @pre (dynamic_cast *>(&dst))->getDirectionVector() == getDirectionVector() */ virtual void copy2( @@ -281,6 +332,8 @@ class SideData:public hier::PatchData /*! * @brief Copy data from source to destination (i.e., this) * patch data object on the given CELL-centered AMR index box. + * + * @pre (getDim() == src.getDim()) && (getDim() == box.getDim()) */ void copyOnBox( @@ -291,6 +344,9 @@ class SideData:public hier::PatchData * @brief Fast copy (i.e., source and this side data objects are * defined over the same box) to this destination side data object * from the given source side data object at the specified depths. + * + * @pre getDirectionVector.getDim() == src.getDim() + * @pre src.getDirectionVector() == getDirectionVector() */ void copyDepth( @@ -316,8 +372,10 @@ class SideData:public hier::PatchData * * This routine is defined for the standard types (bool, char, * double, float, int, and dcomplex). + * + * @pre dynamic_cast(&overlap) != 0 */ - virtual int + virtual size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; @@ -325,6 +383,8 @@ class SideData:public hier::PatchData * @brief Pack data in this patch data object lying in the specified * box overlap region into the stream. The overlap must be an * SideOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void packStream( @@ -335,6 +395,8 @@ class SideData:public hier::PatchData * @brief Unpack data from stream into this patch data object over * the specified box overlap region. The overlap must be an * SideOverlap of the same DIM. + * + * @pre dynamic_cast(&overlap) != 0 */ virtual void unpackStream( @@ -343,6 +405,8 @@ class SideData:public hier::PatchData /*! * @brief Fill all values at depth d with the value t. + * + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -351,6 +415,9 @@ class SideData:public hier::PatchData /*! * @brief Fill all values at depth d within the box with the value t. + * + * @pre getDirectionVector().getDim() == box.getDim() + * @pre (d >= 0) && (d < getDepth()) */ void fill( @@ -367,6 +434,8 @@ class SideData:public hier::PatchData /*! * @brief Fill all depth components within the box with value t. + * + * @pre getDirectionVector().getDim() == box.getDim() */ void fillAll( @@ -382,10 +451,12 @@ class SideData:public hier::PatchData * and will be converted to side index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDirectionVector().getDim() == box.getDim() */ void print( @@ -400,14 +471,16 @@ class SideData:public hier::PatchData * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to side index space. - * @param depth integer depth component, must satisfy - * 0 <= depth < actual depth of data array + * @param depth integer depth component * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDirectionVector().getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) */ void print( @@ -421,21 +494,23 @@ class SideData:public hier::PatchData * direction residing in the specified box. If the depth of the data is * greater than one, all depths are printed. * - * @param side_normal integer side normal coordinate direction, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal coordinate direction * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to side index space. * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDirectionVector().getDim() == box.getDim() + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) */ void printAxis( - int side_normal, + tbox::Dimension::dir_t side_normal, const hier::Box& box, std::ostream& os = tbox::plog, int prec = 12) const; @@ -445,8 +520,7 @@ class SideData:public hier::PatchData * direction residing in the specified box. If the depth of the data is * greater than one, all depths are printed. * - * @param side_normal integer side normal coordinate direction, - * must satisfy 0 <= side_normal < DIM + * @param side_normal integer side normal coordinate direction * @param box const reference to box over whioch to print data. Note box * is assumed to reside in standard cell-centered index space * and will be converted to side index space. @@ -454,14 +528,18 @@ class SideData:public hier::PatchData * 0 <= depth < actual depth of data array * @param os reference to output stream. * @param prec integer precision for printing floating point numbers - * (i.e., TYPE = float, double, or dcomplex). The default - * is 12 decimal places for double and complex floating point numbers, + * (i.e., TYPE = float, double, or dcomplex). The default is 12 + * decimal places for double and complex floating point numbers, * and the default is 6 decimal places floats. For other types, this * value is ignored. + * + * @pre getDirectionVector().getDim() == box.getDim() + * @pre (depth >= 0) && (depth < getDepth()) + * @pre (side_normal >= 0) && (side_normal < getDim().getValue()) */ void printAxis( - int side_normal, + tbox::Dimension::dir_t side_normal, const hier::Box& box, int depth, std::ostream& os = tbox::plog, @@ -469,23 +547,23 @@ class SideData:public hier::PatchData /*! * Check that class version and restart file version are equal. If so, - * read data members from the database. + * read data members from the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! * Write out the class version number and other data members to - * the database. + * the restart database. * - * Assertions: database must be a non-null pointer. + * @pre restart_db */ virtual void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * The side iterator iterates over the elements on one axis of a side @@ -500,11 +578,14 @@ class SideData:public hier::PatchData */ static const int PDAT_SIDEDATA_VERSION; + // Unimplemented copy constructor SideData( - const SideData&); // not implemented - void + const SideData&); + + // Unimplemented assignment operator + SideData& operator = ( - const SideData&); // not implemented + const SideData&); void copyWithRotation( @@ -519,7 +600,7 @@ class SideData:public hier::PatchData int d_depth; hier::IntVector d_directions; - ArrayData d_data[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + boost::shared_ptr > d_data[SAMRAI::MAX_DIM_VAL]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.C index 4e6c3493..fbf4be3e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating side data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/pdat/OutersideDataFactory.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -32,26 +32,17 @@ namespace pdat { ************************************************************************* */ -// SGS DODIM TODO -// WARNING! WARNING! WARNING! WARNING! -// This was hacked to replicate a bug in the SAMRAI. The direction vector -// should not be all ones but not having this causes the tests to fail -// WARNING! WARNING! WARNING! WARNING! - template SideDataFactory::SideDataFactory( - const int depth, + int depth, const hier::IntVector& ghosts, bool fine_boundary_represents_var, const hier::IntVector& directions): hier::PatchDataFactory(ghosts), d_depth(depth), d_fine_boundary_represents_var(fine_boundary_represents_var), - d_directions(hier::IntVector::getOne(ghosts.getDim())) + d_directions(directions) { -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(directions); -#endif TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); TBOX_ASSERT(directions.min() >= 0); @@ -59,13 +50,13 @@ SideDataFactory::SideDataFactory( template SideDataFactory::SideDataFactory( - const int depth, + int depth, const hier::IntVector& ghosts, bool fine_boundary_represents_var): hier::PatchDataFactory(ghosts), d_depth(depth), d_fine_boundary_represents_var(fine_boundary_represents_var), - d_directions(ghosts.getDim(), 1) + d_directions(hier::IntVector::getOne(ghosts.getDim())) { TBOX_ASSERT(depth > 0); TBOX_ASSERT(ghosts.min() >= 0); @@ -89,13 +80,13 @@ boost::shared_ptr SideDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - d_depth, - ghosts, - d_fine_boundary_represents_var, - d_directions); + d_depth, + ghosts, + d_fine_boundary_represents_var, + d_directions); } /* @@ -111,13 +102,13 @@ boost::shared_ptr SideDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_depth, - d_ghosts, - d_directions); + patch.getBox(), + d_depth, + d_ghosts, + d_directions); } /* @@ -133,12 +124,12 @@ boost::shared_ptr SideDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared( - box, - d_ghosts, - d_directions); + box, + d_ghosts, + d_directions); } template @@ -168,7 +159,7 @@ size_t SideDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); const size_t obj = tbox::MemoryUtilities::align(sizeof(SideData)); @@ -191,7 +182,7 @@ bool SideDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; @@ -200,8 +191,8 @@ SideDataFactory::validCopyTo( */ if (!valid_copy) { boost::shared_ptr > sdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (sdf) { valid_copy = true; } @@ -209,8 +200,9 @@ SideDataFactory::validCopyTo( if (!valid_copy) { boost::shared_ptr > osdf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>( + dst_pdf)); if (osdf) { valid_copy = true; } @@ -224,7 +216,7 @@ SideDataFactory::validCopyTo( * * Return a boolean value indicating how data for the side quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the FaceVariable class header file for more + * constructor. See the FaceVariable class header file for more * information. * ************************************************************************* @@ -251,7 +243,6 @@ SideDataFactory::dataLivesOnPatchBorder() const return true; } - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.h index b648f74e..739b5d1d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Factory class for creating side data objects * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/tbox/Complex.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -35,39 +35,55 @@ namespace pdat { * and manage data for cell sides associated with a single coordinate * direction only. See the constructor for more information. * - * @see pdat::SideData - * @see pdat::PatchDataFactory + * @see SideData + * @see PatchDataFactory */ template class SideDataFactory:public hier::PatchDataFactory { public: - /** - * The constructor for the side data factory class. The ghost cell - * width, depth (number of components), and fine boundary representation arguments - * give the defaults for all edge data objects created with this factory. - * Also, the default data allocation scheme is to generate storage for sides - * in all coordinate directions (default integer vector of all 1's). To - * use this factory to manage side data objects for sides associated - * with a single direction only, provide the directions vector argument. - * A zero entry indicates that data for that direction is not wanted. - * Otherwise, data will be created for that direction. See the - * SideVariable class header file for more information. + /*! + * @brief The constructor for the side data factory class. + * + * The ghost cell width, depth (number of components), and fine boundary + * representation arguments give the defaults for all edge data objects + * created with this factory. + * + * The directions vector describes the coordinate directions for which + * data will be allocated on the sides of cells in the grid. A value of + * 1 indicates that data will be allocated for that coordinate direction, + * while a value of zero means data for that direction is not wanted. + * To allocate data in all directions, provide an IntVector that is + * 1 in all directions, or use the other constructor, which assumes by + * default that all directions are desired. See the + * SideVariable class header file for more information. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 + * @pre directions.min() >= 0 */ SideDataFactory( int depth, const hier::IntVector& ghosts, - bool fine_boundary_represents_var); + bool fine_boundary_represents_var, + const hier::IntVector& directions); - /** - * Same as previous constructor but with directions vector of 1's + /*! + * @brief Constructor for the side data factory class setting up allocation + * of data in all coordinate directions. + * + * This constructor works the same as the other constructor, but + * it takes no direcions argument, meaning that all directions are going + * to be allocated. + * + * @pre depth > 0 + * @pre ghosts.min() >= 0 */ SideDataFactory( int depth, const hier::IntVector& ghosts, - bool fine_boundary_represents_var, - const hier::IntVector& directions); + bool fine_boundary_represents_var); /** * Virtual destructor for the side data factory class. @@ -83,6 +99,8 @@ class SideDataFactory:public hier::PatchDataFactory * * @param ghosts default ghost cell width for concrete classes created from * the factory. + * + * @pre getDim() == ghosts.getDim() */ virtual boost::shared_ptr cloneFactory( @@ -92,6 +110,8 @@ class SideDataFactory:public hier::PatchDataFactory * Virtual factory function to allocate a concrete side data object. * The default information about the object (e.g., ghost cell width) * is taken from the factory. + * + * @pre getDim() == patch.getDim() */ virtual boost::shared_ptr allocate( @@ -101,6 +121,8 @@ class SideDataFactory:public hier::PatchDataFactory * Allocate the box geometry object associated with the patch data. * This information will be used in the computation of intersections * and data dependencies between objects. + * + * @pre getDim() == box.getDim() */ virtual boost::shared_ptr getBoxGeometry( @@ -127,6 +149,8 @@ class SideDataFactory:public hier::PatchDataFactory /** * Calculate the amount of memory needed to store the side data object, * including object data and dynamically allocated data. + * + * @pre getDim() == box.getDim() */ virtual size_t getSizeOfMemory( @@ -135,7 +159,7 @@ class SideDataFactory:public hier::PatchDataFactory /** * Return a boolean value indicating how data for the side quantity will be * treated on coarse-fine interfaces. This value is passed into the - * constructor. See the FaceVariable class header file for more + * constructor. See the FaceVariable class header file for more * information. */ bool @@ -152,6 +176,8 @@ class SideDataFactory:public hier::PatchDataFactory * Return whether it is valid to copy this SideDataFactory to the * supplied destination patch data factory. It will return true if * dst_pdf is SideDataFactory or OutersideDataFactory, false otherwise. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.C index bb05a7f0..db5202f0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered double data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_SideDoubleConstantRefine_C -#define included_pdat_SideDoubleConstantRefine_C - #include "SAMRAI/pdat/SideDoubleConstantRefine.h" #include @@ -35,21 +31,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefsidedoub1d, CONREFSIDEDOUB1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub1d, CONREFSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); // in conrefine2d.f: -void F77_FUNC(conrefsidedoub2d0, CONREFSIDEDOUB2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub2d0, CONREFSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefsidedoub2d1, CONREFSIDEDOUB2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub2d1, CONREFSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(conrefsidedoub2d1, CONREFSIDEDOUB2D1) (const int&, const int&, const int *, const double *, double *); // in conrefine3d.f: -void F77_FUNC(conrefsidedoub3d0, CONREFSIDEDOUB3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub3d0, CONREFSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,7 +64,7 @@ void F77_FUNC(conrefsidedoub3d0, CONREFSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefsidedoub3d1, CONREFSIDEDOUB3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub3d1, CONREFSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -79,7 +75,7 @@ void F77_FUNC(conrefsidedoub3d1, CONREFSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const double *, double *); -void F77_FUNC(conrefsidedoub3d2, CONREFSIDEDOUB3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsidedoub3d2, CONREFSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,9 +91,8 @@ void F77_FUNC(conrefsidedoub3d2, CONREFSIDEDOUB3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -SideDoubleConstantRefine::SideDoubleConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +SideDoubleConstantRefine::SideDoubleConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -112,9 +107,9 @@ SideDoubleConstantRefine::getOperatorPriority() const } hier::IntVector -SideDoubleConstantRefine::getStencilWidth() const +SideDoubleConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -126,58 +121,58 @@ SideDoubleConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); const SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); const hier::IntVector& directions = fdata->getDirectionVector(); TBOX_ASSERT(directions == hier::IntVector::min(directions, cdata->getDirectionVector())); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(axis)) { - F77_FUNC(conrefsidedoub1d, CONREFSIDEDOUB1D) ( + SAMRAI_F77_FUNC(conrefsidedoub1d, CONREFSIDEDOUB1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -188,7 +183,7 @@ SideDoubleConstantRefine::refine( } } else if (dim == tbox::Dimension(2)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsidedoub2d0, CONREFSIDEDOUB2D0) ( + SAMRAI_F77_FUNC(conrefsidedoub2d0, CONREFSIDEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -198,7 +193,7 @@ SideDoubleConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsidedoub2d1, CONREFSIDEDOUB2D1) ( + SAMRAI_F77_FUNC(conrefsidedoub2d1, CONREFSIDEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -209,7 +204,7 @@ SideDoubleConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsidedoub3d0, CONREFSIDEDOUB3D0) ( + SAMRAI_F77_FUNC(conrefsidedoub3d0, CONREFSIDEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -223,7 +218,7 @@ SideDoubleConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsidedoub3d1, CONREFSIDEDOUB3D1) ( + SAMRAI_F77_FUNC(conrefsidedoub3d1, CONREFSIDEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -237,7 +232,7 @@ SideDoubleConstantRefine::refine( fdata->getPointer(1, d)); } if (axis == 2 && directions(2)) { - F77_FUNC(conrefsidedoub3d2, CONREFSIDEDOUB3D2) ( + SAMRAI_F77_FUNC(conrefsidedoub3d2, CONREFSIDEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -262,4 +257,3 @@ SideDoubleConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.h index 52527455..5ac2c1d2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered double data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class SideDoubleConstantRefine: /** * Uninteresting default constructor. */ - explicit SideDoubleConstantRefine( - const tbox::Dimension& dim); + SideDoubleConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class SideDoubleConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class SideDoubleConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.C index 85712f53..95cc2c2a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered double patch data. * ************************************************************************/ - -#ifndef included_pdat_SideDoubleLinearTimeInterpolateOp_C -#define included_pdat_SideDoubleLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintsidedoub1d, LINTIMEINTSIDEDOUB1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub1d, LINTIMEINTSIDEDOUB1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintsidedoub1d, LINTIMEINTSIDEDOUB1D) (const int&, const double *, const double *, double *); // in lintimint2d.f: -void F77_FUNC(lintimeintsidedoub2d0, LINTIMEINTSIDEDOUB2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub2d0, LINTIMEINTSIDEDOUB2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintsidedoub2d0, LINTIMEINTSIDEDOUB2D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintsidedoub2d1, LINTIMEINTSIDEDOUB2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub2d1, LINTIMEINTSIDEDOUB2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintsidedoub2d1, LINTIMEINTSIDEDOUB2D1) (const int&, const double *, const double *, double *); // in lintimint3d.f: -void F77_FUNC(lintimeintsidedoub3d0, LINTIMEINTSIDEDOUB3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub3d0, LINTIMEINTSIDEDOUB3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintsidedoub3d0, LINTIMEINTSIDEDOUB3D0) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintsidedoub3d1, LINTIMEINTSIDEDOUB3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub3d1, LINTIMEINTSIDEDOUB3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintsidedoub3d1, LINTIMEINTSIDEDOUB3D1) (const int&, const double&, const double *, const double *, double *); -void F77_FUNC(lintimeintsidedoub3d2, LINTIMEINTSIDEDOUB3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidedoub3d2, LINTIMEINTSIDEDOUB3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,19 +126,19 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const SideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const SideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); SideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); const hier::IntVector& directions = dst_dat->getDirectionVector(); @@ -151,16 +147,16 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( TBOX_ASSERT(directions == hier::IntVector::min(directions, new_dat->getDirectionVector())); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -179,10 +175,10 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(0)) { - F77_FUNC(lintimeintsidedoub1d, LINTIMEINTSIDEDOUB1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub1d, LINTIMEINTSIDEDOUB1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -194,7 +190,7 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(2)) { if (directions(0)) { - F77_FUNC(lintimeintsidedoub2d0, LINTIMEINTSIDEDOUB2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub2d0, LINTIMEINTSIDEDOUB2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -205,7 +201,7 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidedoub2d1, LINTIMEINTSIDEDOUB2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub2d1, LINTIMEINTSIDEDOUB2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -217,7 +213,7 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(3)) { if (directions(0)) { - F77_FUNC(lintimeintsidedoub3d0, LINTIMEINTSIDEDOUB3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub3d0, LINTIMEINTSIDEDOUB3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -232,7 +228,7 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidedoub3d1, LINTIMEINTSIDEDOUB3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub3d1, LINTIMEINTSIDEDOUB3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -247,7 +243,7 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(lintimeintsidedoub3d2, LINTIMEINTSIDEDOUB3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidedoub3d2, LINTIMEINTSIDEDOUB3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -271,4 +267,3 @@ SideDoubleLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.h index a14f61ed..9f5b8703 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideDoubleLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered double patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class SideDoubleLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.C index cfbc33b6..e360f575 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered float data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_SideFloatConstantRefine_C -#define included_pdat_SideFloatConstantRefine_C - #include "SAMRAI/pdat/SideFloatConstantRefine.h" #include @@ -35,21 +31,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefsideflot1d, CONREFSIDEFLOT1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot1d, CONREFSIDEFLOT1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); // in conrefine2d.f: -void F77_FUNC(conrefsideflot2d0, CONREFSIDEFLOT2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot2d0, CONREFSIDEFLOT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefsideflot2d1, CONREFSIDEFLOT2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot2d1, CONREFSIDEFLOT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(conrefsideflot2d1, CONREFSIDEFLOT2D1) (const int&, const int&, const int *, const float *, float *); // in conrefine3d.f: -void F77_FUNC(conrefsideflot3d0, CONREFSIDEFLOT3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot3d0, CONREFSIDEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,7 +64,7 @@ void F77_FUNC(conrefsideflot3d0, CONREFSIDEFLOT3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefsideflot3d1, CONREFSIDEFLOT3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot3d1, CONREFSIDEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -79,7 +75,7 @@ void F77_FUNC(conrefsideflot3d1, CONREFSIDEFLOT3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const float *, float *); -void F77_FUNC(conrefsideflot3d2, CONREFSIDEFLOT3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideflot3d2, CONREFSIDEFLOT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,9 +91,8 @@ void F77_FUNC(conrefsideflot3d2, CONREFSIDEFLOT3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -SideFloatConstantRefine::SideFloatConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +SideFloatConstantRefine::SideFloatConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -112,9 +107,9 @@ SideFloatConstantRefine::getOperatorPriority() const } hier::IntVector -SideFloatConstantRefine::getStencilWidth() const +SideFloatConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -126,58 +121,57 @@ SideFloatConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const SideOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); const hier::IntVector& directions = fdata->getDirectionVector(); TBOX_ASSERT(directions == hier::IntVector::min(directions, cdata->getDirectionVector())); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(axis)) { - F77_FUNC(conrefsideflot1d, CONREFSIDEFLOT1D) ( + SAMRAI_F77_FUNC(conrefsideflot1d, CONREFSIDEFLOT1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -188,7 +182,7 @@ SideFloatConstantRefine::refine( } } else if (dim == tbox::Dimension(2)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsideflot2d0, CONREFSIDEFLOT2D0) ( + SAMRAI_F77_FUNC(conrefsideflot2d0, CONREFSIDEFLOT2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -198,7 +192,7 @@ SideFloatConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsideflot2d1, CONREFSIDEFLOT2D1) ( + SAMRAI_F77_FUNC(conrefsideflot2d1, CONREFSIDEFLOT2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -209,7 +203,7 @@ SideFloatConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsideflot3d0, CONREFSIDEFLOT3D0) ( + SAMRAI_F77_FUNC(conrefsideflot3d0, CONREFSIDEFLOT3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -223,7 +217,7 @@ SideFloatConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsideflot3d1, CONREFSIDEFLOT3D1) ( + SAMRAI_F77_FUNC(conrefsideflot3d1, CONREFSIDEFLOT3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -237,7 +231,7 @@ SideFloatConstantRefine::refine( fdata->getPointer(1, d)); } if (axis == 2 && directions(2)) { - F77_FUNC(conrefsideflot3d2, CONREFSIDEFLOT3D2) ( + SAMRAI_F77_FUNC(conrefsideflot3d2, CONREFSIDEFLOT3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -262,4 +256,3 @@ SideFloatConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.h index 72181283..ea99fbff 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered float data on * a mesh. * @@ -19,7 +19,7 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,8 +41,7 @@ class SideFloatConstantRefine: /** * Uninteresting default constructor. */ - explicit SideFloatConstantRefine( - const tbox::Dimension& dim); + SideFloatConstantRefine(); /** * Uninteresting virtual destructor. @@ -61,7 +60,8 @@ class SideFloatConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -70,6 +70,8 @@ class SideFloatConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.C index ae9770e2..25f8d29e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered float patch data. * ************************************************************************/ - -#ifndef included_pdat_SideFloatLinearTimeInterpolateOp_C -#define included_pdat_SideFloatLinearTimeInterpolateOp_C - #include "SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.h" #include "SAMRAI/hier/Box.h" @@ -20,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" /* ************************************************************************* @@ -36,7 +32,7 @@ extern "C" { #endif // in lintimint1d.f: -void F77_FUNC(lintimeintsidefloat1d, LINTIMEINTSIDEFLOAT1D) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat1d, LINTIMEINTSIDEFLOAT1D) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +41,7 @@ void F77_FUNC(lintimeintsidefloat1d, LINTIMEINTSIDEFLOAT1D) (const int&, const float *, const float *, float *); // in lintimint2d.f: -void F77_FUNC(lintimeintsidefloat2d0, LINTIMEINTSIDEFLOAT2D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat2d0, LINTIMEINTSIDEFLOAT2D0) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(lintimeintsidefloat2d0, LINTIMEINTSIDEFLOAT2D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintsidefloat2d1, LINTIMEINTSIDEFLOAT2D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat2d1, LINTIMEINTSIDEFLOAT2D1) (const int&, const int&, const int&, const int&, const int&, const int&, @@ -70,7 +66,7 @@ void F77_FUNC(lintimeintsidefloat2d1, LINTIMEINTSIDEFLOAT2D1) (const int&, const float *, const float *, float *); // in lintimint3d.f: -void F77_FUNC(lintimeintsidefloat3d0, LINTIMEINTSIDEFLOAT3D0) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat3d0, LINTIMEINTSIDEFLOAT3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -82,7 +78,7 @@ void F77_FUNC(lintimeintsidefloat3d0, LINTIMEINTSIDEFLOAT3D0) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintsidefloat3d1, LINTIMEINTSIDEFLOAT3D1) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat3d1, LINTIMEINTSIDEFLOAT3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -94,7 +90,7 @@ void F77_FUNC(lintimeintsidefloat3d1, LINTIMEINTSIDEFLOAT3D1) (const int&, const double&, const float *, const float *, float *); -void F77_FUNC(lintimeintsidefloat3d2, LINTIMEINTSIDEFLOAT3D2) (const int&, +void SAMRAI_F77_FUNC(lintimeintsidefloat3d2, LINTIMEINTSIDEFLOAT3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,19 +126,19 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( const tbox::Dimension& dim(where.getDim()); const SideData* old_dat = - dynamic_cast *>(&src_data_old); + CPP_CAST *>(&src_data_old); const SideData* new_dat = - dynamic_cast *>(&src_data_new); + CPP_CAST *>(&src_data_new); SideData* dst_dat = - dynamic_cast *>(&dst_data); + CPP_CAST *>(&dst_data); - TBOX_ASSERT(old_dat != NULL); - TBOX_ASSERT(new_dat != NULL); - TBOX_ASSERT(dst_dat != NULL); + TBOX_ASSERT(old_dat != 0); + TBOX_ASSERT(new_dat != 0); + TBOX_ASSERT(dst_dat != 0); TBOX_ASSERT((where * old_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * new_dat->getGhostBox()).isSpatiallyEqual(where)); TBOX_ASSERT((where * dst_dat->getGhostBox()).isSpatiallyEqual(where)); - TBOX_DIM_ASSERT_CHECK_ARGS4(dst_data, where, src_data_old, src_data_new); + TBOX_ASSERT_OBJDIM_EQUALITY4(dst_data, where, src_data_old, src_data_new); const hier::IntVector& directions = dst_dat->getDirectionVector(); @@ -151,16 +147,16 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( TBOX_ASSERT(directions == hier::IntVector::min(directions, new_dat->getDirectionVector())); - const hier::Index old_ilo = old_dat->getGhostBox().lower(); - const hier::Index old_ihi = old_dat->getGhostBox().upper(); - const hier::Index new_ilo = new_dat->getGhostBox().lower(); - const hier::Index new_ihi = new_dat->getGhostBox().upper(); + const hier::Index& old_ilo = old_dat->getGhostBox().lower(); + const hier::Index& old_ihi = old_dat->getGhostBox().upper(); + const hier::Index& new_ilo = new_dat->getGhostBox().lower(); + const hier::Index& new_ihi = new_dat->getGhostBox().upper(); - const hier::Index dst_ilo = dst_dat->getGhostBox().lower(); - const hier::Index dst_ihi = dst_dat->getGhostBox().upper(); + const hier::Index& dst_ilo = dst_dat->getGhostBox().lower(); + const hier::Index& dst_ihi = dst_dat->getGhostBox().upper(); - const hier::Index ifirst = where.lower(); - const hier::Index ilast = where.upper(); + const hier::Index& ifirst = where.lower(); + const hier::Index& ilast = where.upper(); const double old_time = old_dat->getTime(); const double new_time = new_dat->getTime(); @@ -179,10 +175,10 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( tfrac = 0.0; } - for (int d = 0; d < dst_dat->getDepth(); d++) { + for (int d = 0; d < dst_dat->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(0)) { - F77_FUNC(lintimeintsidefloat1d, LINTIMEINTSIDEFLOAT1D) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat1d, LINTIMEINTSIDEFLOAT1D) (ifirst(0), ilast(0), old_ilo(0), old_ihi(0), new_ilo(0), new_ihi(0), @@ -194,7 +190,7 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(2)) { if (directions(0)) { - F77_FUNC(lintimeintsidefloat2d0, LINTIMEINTSIDEFLOAT2D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat2d0, LINTIMEINTSIDEFLOAT2D0) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -205,7 +201,7 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidefloat2d1, LINTIMEINTSIDEFLOAT2D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat2d1, LINTIMEINTSIDEFLOAT2D1) (ifirst(0), ifirst(1), ilast(0), ilast(1), old_ilo(0), old_ilo(1), old_ihi(0), old_ihi(1), new_ilo(0), new_ilo(1), new_ihi(0), new_ihi(1), @@ -217,7 +213,7 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( } } else if (dim == tbox::Dimension(3)) { if (directions(0)) { - F77_FUNC(lintimeintsidefloat3d0, LINTIMEINTSIDEFLOAT3D0) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat3d0, LINTIMEINTSIDEFLOAT3D0) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -232,7 +228,7 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(0, d)); } if (directions(1)) { - F77_FUNC(lintimeintsidefloat3d1, LINTIMEINTSIDEFLOAT3D1) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat3d1, LINTIMEINTSIDEFLOAT3D1) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -247,7 +243,7 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( dst_dat->getPointer(1, d)); } if (directions(2)) { - F77_FUNC(lintimeintsidefloat3d2, LINTIMEINTSIDEFLOAT3D2) (ifirst(0), + SAMRAI_F77_FUNC(lintimeintsidefloat3d2, LINTIMEINTSIDEFLOAT3D2) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), old_ilo(0), old_ilo(1), old_ilo(2), @@ -271,4 +267,3 @@ SideFloatLinearTimeInterpolateOp::timeInterpolate( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.h index 737f1716..af6099bd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideFloatLinearTimeInterpolateOp.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Linear time interp operator for side-centered float patch data. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/hier/TimeInterpolateOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -50,6 +50,18 @@ class SideFloatLinearTimeInterpolateOp: * Time interpolation is performed on the intersection of the destination * patch data and the input box. The time to which data is interpolated * is provided by the destination data. + * + * @pre dynamic_cast *>(&src_data_old) != 0 + * @pre dynamic_cast *>(&src_data_new) != 0 + * @pre dynamic_cast *>(&dst_data) != 0 + * @pre (where * src_data_old->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * src_data_new->getGhostBox()).isSpatiallyEqual(where) + * @pre (where * dst_data->getGhostBox()).isSpatiallyEqual(where) + * @pre (dst_data.getDim() == where.getDim()) && + * (dst_data.getDim() == src_data_old.getDim()) && + * (dst_data.getDim() == src_data_new.getDim()) + * @pre direction vector of dst_data is smaller than that of src_data_old or + * src_data_new */ void timeInterpolate( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.C index 43a7871a..d7e193ea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.C @@ -3,19 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_SideGeometry_C -#define included_pdat_SideGeometry_C - #include "SAMRAI/pdat/SideGeometry.h" +#include "SAMRAI/pdat/SideIterator.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -38,11 +35,30 @@ SideGeometry::SideGeometry( d_directions(directions) { - TBOX_DIM_ASSERT_CHECK_ARGS2(box, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); TBOX_ASSERT(ghosts.min() >= 0); TBOX_ASSERT(directions.min() >= 0); } +/* + ************************************************************************* + * + * Create a side geometry object given the box and ghost cell width + * + ************************************************************************* + */ + +SideGeometry::SideGeometry( + const hier::Box& box, + const hier::IntVector& ghosts): + d_box(box), + d_ghosts(ghosts), + d_directions(hier::IntVector::getOne(ghosts.getDim())) +{ + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); + TBOX_ASSERT(ghosts.min() >= 0); +} + SideGeometry::~SideGeometry() { } @@ -72,7 +88,7 @@ SideGeometry::calculateOverlap( const bool retry, const hier::BoxContainer& dst_restrict_boxes) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(d_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask); const SideGeometry* t_dst = dynamic_cast(&dst_geometry); @@ -80,7 +96,7 @@ SideGeometry::calculateOverlap( dynamic_cast(&src_geometry); boost::shared_ptr over; - if ((t_src != NULL) && (t_dst != NULL)) { + if ((t_src != 0) && (t_dst != 0)) { over = doOverlap(*t_dst, *t_src, src_mask, fill_box, overwrite_interior, transformation, dst_restrict_boxes); } else if (retry) { @@ -92,6 +108,80 @@ SideGeometry::calculateOverlap( return over; } +/* + ************************************************************************* + * + * Compute the boxes that will be used to construct an overlap object + * + ************************************************************************* + */ + +void +SideGeometry::computeDestinationBoxes( + std::vector& dst_boxes, + const SideGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes) const +{ +#ifdef DEBUG_CHECK_DIM_ASSERTIONS + const hier::IntVector& src_offset = transformation.getOffset(); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); +#endif + TBOX_ASSERT( + getDirectionVector() == src_geometry.getDirectionVector()); + + const tbox::Dimension& dim(src_mask.getDim()); + + // Perform a quick-and-dirty intersection to see if the boxes might overlap + hier::Box src_shift( + hier::Box::grow(src_geometry.d_box, src_geometry.d_ghosts) * src_mask); + transformation.transform(src_shift); + hier::Box dst_ghost(d_box); + dst_ghost.grow(d_ghosts); + + // Compute the intersection (if any) for each of the side directions + const hier::IntVector one_vector(dim, 1); + + const hier::Box quick_check( + hier::Box::grow(src_shift, one_vector) + * hier::Box::grow(dst_ghost, one_vector)); + + if (!quick_check.empty()) { + + const hier::IntVector& dirs = src_geometry.getDirectionVector(); + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { + if (dirs(d)) { + const hier::Box dst_side(toSideBox(dst_ghost, d)); + const hier::Box src_side(toSideBox(src_shift, d)); + const hier::Box fill_side(toSideBox(fill_box, d)); + const hier::Box together(dst_side * src_side * fill_side); + if (!together.empty()) { + if (!overwrite_interior) { + const hier::Box int_side(toSideBox(d_box, d)); + dst_boxes[d].removeIntersections(together, int_side); + } else { + dst_boxes[d].pushBack(together); + } + } // if (!together.empty()) + } // if (dirs(d)) + + if (!dst_restrict_boxes.empty() && !dst_boxes[d].empty()) { + hier::BoxContainer side_restrict_boxes; + for (hier::BoxContainer::const_iterator b = dst_restrict_boxes.begin(); + b != dst_restrict_boxes.end(); ++b) { + side_restrict_boxes.pushBack(toSideBox(*b, d)); + } + dst_boxes[d].intersectBoxes(side_restrict_boxes); + } + + } // loop over dim && dirs(d) + + } // if (!quick_check.empty()) +} + /* ************************************************************************* * @@ -104,17 +194,17 @@ SideGeometry::calculateOverlap( hier::Box SideGeometry::toSideBox( const hier::Box& box, - int side_normal) + tbox::Dimension::dir_t side_normal) { const tbox::Dimension& dim(box.getDim()); - TBOX_ASSERT((side_normal >= 0) && (side_normal < dim.getValue())); + TBOX_ASSERT((side_normal < dim.getValue())); hier::Box side_box(dim); if (!box.empty()) { side_box = box; - side_box.upper(side_normal) += 1; + side_box.setUpper(side_normal, side_box.upper(side_normal) + 1); } return side_box; @@ -127,7 +217,7 @@ SideGeometry::toSideBox( * is fairly straight-forward. First, we perform a quick-and-dirty * intersection to see if the boxes might overlap. If that intersection * is not empty, then we need to do a better job calculating the overlap - * for each dimension. Note that the AMR index space boxes must be + * for each direction. Note that the AMR index space boxes must be * shifted into the side centered space before we calculate the proper * intersections. * @@ -144,65 +234,24 @@ SideGeometry::doOverlap( const hier::Transformation& transformation, const hier::BoxContainer& dst_restrict_boxes) { -#ifdef DEBUG_CHECK_DIM_ASSERTIONS +#ifdef DEBUG_CHECK_DIM_ASSERTIONS const hier::IntVector& src_offset = transformation.getOffset(); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_mask, src_offset); #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(src_mask, src_offset); TBOX_ASSERT( dst_geometry.getDirectionVector() == src_geometry.getDirectionVector()); const tbox::Dimension& dim(src_mask.getDim()); - tbox::Array dst_boxes(dim.getValue()); - - // Perform a quick-and-dirty intersection to see if the boxes might overlap - - const hier::Box src_box( - hier::Box::grow(src_geometry.d_box, src_geometry.d_ghosts) * src_mask); - hier::Box src_shift(src_box); - transformation.transform(src_shift); - const hier::Box dst_ghost( - hier::Box::grow(dst_geometry.d_box, dst_geometry.d_ghosts)); - - // Compute the intersection (if any) for each of the side directions - const hier::IntVector one_vector(dim, 1); - - const hier::Box quick_check( - hier::Box::grow(src_shift, one_vector) * hier::Box::grow(dst_ghost, - one_vector)); + std::vector dst_boxes(dim.getValue()); - if (!quick_check.empty()) { - - const hier::IntVector& dirs = src_geometry.getDirectionVector(); - for (int d = 0; d < dim.getValue(); d++) { - if (dirs(d)) { - const hier::Box dst_side(toSideBox(dst_ghost, d)); - const hier::Box src_side(toSideBox(src_shift, d)); - const hier::Box fill_side(toSideBox(fill_box, d)); - const hier::Box together(dst_side * src_side * fill_side); - if (!together.empty()) { - dst_boxes[d].pushBack(together); - if (!overwrite_interior) { - const hier::Box int_side(toSideBox(dst_geometry.d_box, d)); - dst_boxes[d].removeIntersections(together, int_side); - } else { - dst_boxes[d].pushBack(together); - } - } // if (!together.empty()) - } // if (dirs(d)) - - if (dst_restrict_boxes.size() && dst_boxes[d].size()) { - hier::BoxContainer side_restrict_boxes; - for (hier::BoxContainer::const_iterator b(dst_restrict_boxes); - b != dst_restrict_boxes.end(); ++b) { - side_restrict_boxes.pushBack(toSideBox(*b, d)); - } - dst_boxes[d].intersectBoxes(side_restrict_boxes); - } - - } // loop over dim && dirs(d) - - } // if (!quick_check.empty()) + dst_geometry.computeDestinationBoxes(dst_boxes, + src_geometry, + src_mask, + fill_box, + overwrite_interior, + transformation, + dst_restrict_boxes); // Create the side overlap data object using the boxes and source shift @@ -222,10 +271,11 @@ SideGeometry::setUpOverlap( const hier::Transformation& transformation) const { const tbox::Dimension& dim(transformation.getOffset().getDim()); - tbox::Array dst_boxes(dim.getValue()); + std::vector dst_boxes(dim.getValue()); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - for (int d = 0; d < dim.getValue(); d++) { + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box side_box(SideGeometry::toSideBox(*b, d)); dst_boxes[d].pushBack(side_box); } @@ -262,120 +312,129 @@ SideGeometry::transform( const hier::Transformation::RotationIdentifier rotation = transformation.getRotation(); - box.upper() (normal_direction) -= 1; - transformation.transform(box); - if (dim.getValue() == 2) { - const int rotation_num = static_cast(rotation); - if (rotation_num % 2) { - normal_direction = (normal_direction + 1) % 2; - } - } else if (dim.getValue() == 3) { + if (rotation == hier::Transformation::NO_ROTATE) { - if (normal_direction == 0) { + transformation.transform(box); - switch (rotation) { + } else { - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::IDOWN_KDOWN_JDOWN: + box.setUpper(static_cast(normal_direction), + box.upper(static_cast(normal_direction)) - 1); + transformation.transform(box); + if (dim.getValue() == 2) { + const int rotation_num = static_cast(rotation); + if (rotation_num % 2) { + normal_direction = (normal_direction + 1) % 2; + } + } else if (dim.getValue() == 3) { - normal_direction = 0; - break; + if (normal_direction == 0) { - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::JDOWN_IDOWN_KDOWN: + switch (rotation) { - normal_direction = 1; - break; + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::IDOWN_KDOWN_JDOWN: - default: + normal_direction = 0; + break; - normal_direction = 2; - break; + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::JDOWN_IDOWN_KDOWN: - } + normal_direction = 1; + break; - } else if (normal_direction == 1) { - - switch (rotation) { - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::JUP_IDOWN_KUP: - case hier::Transformation::JUP_IUP_KDOWN: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::JDOWN_IUP_KUP: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::JDOWN_IDOWN_KDOWN: - - normal_direction = 0; - break; - - case hier::Transformation::IUP_JUP_KUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::IDOWN_JUP_KDOWN: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::IDOWN_JDOWN_KUP: - case hier::Transformation::IUP_JDOWN_KDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: - - normal_direction = 1; - break; - - default: - - normal_direction = 2; - break; - } + default: - } else if (normal_direction == 2) { + normal_direction = 2; + break; - switch (rotation) { - case hier::Transformation::KUP_IUP_JUP: - case hier::Transformation::KUP_JUP_IDOWN: - case hier::Transformation::KDOWN_JUP_IUP: - case hier::Transformation::KDOWN_IDOWN_JUP: - case hier::Transformation::KUP_JDOWN_IUP: - case hier::Transformation::KUP_IDOWN_JDOWN: - case hier::Transformation::KDOWN_IUP_JDOWN: - case hier::Transformation::KDOWN_JDOWN_IDOWN: + } - normal_direction = 0; - break; + } else if (normal_direction == 1) { + + switch (rotation) { + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::JUP_IDOWN_KUP: + case hier::Transformation::JUP_IUP_KDOWN: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::JDOWN_IUP_KUP: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::JDOWN_IDOWN_KDOWN: + + normal_direction = 0; + break; + + case hier::Transformation::IUP_JUP_KUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::IDOWN_JUP_KDOWN: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::IDOWN_JDOWN_KUP: + case hier::Transformation::IUP_JDOWN_KDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + normal_direction = 1; + break; + + default: + + normal_direction = 2; + break; + } + + } else if (normal_direction == 2) { + + switch (rotation) { + case hier::Transformation::KUP_IUP_JUP: + case hier::Transformation::KUP_JUP_IDOWN: + case hier::Transformation::KDOWN_JUP_IUP: + case hier::Transformation::KDOWN_IDOWN_JUP: + case hier::Transformation::KUP_JDOWN_IUP: + case hier::Transformation::KUP_IDOWN_JDOWN: + case hier::Transformation::KDOWN_IUP_JDOWN: + case hier::Transformation::KDOWN_JDOWN_IDOWN: + + normal_direction = 0; + break; - case hier::Transformation::JUP_KUP_IUP: - case hier::Transformation::IDOWN_KUP_JUP: - case hier::Transformation::IUP_KDOWN_JUP: - case hier::Transformation::JUP_KDOWN_IDOWN: - case hier::Transformation::IUP_KUP_JDOWN: - case hier::Transformation::JDOWN_KUP_IDOWN: - case hier::Transformation::JDOWN_KDOWN_IUP: - case hier::Transformation::IDOWN_KDOWN_JDOWN: + case hier::Transformation::JUP_KUP_IUP: + case hier::Transformation::IDOWN_KUP_JUP: + case hier::Transformation::IUP_KDOWN_JUP: + case hier::Transformation::JUP_KDOWN_IDOWN: + case hier::Transformation::IUP_KUP_JDOWN: + case hier::Transformation::JDOWN_KUP_IDOWN: + case hier::Transformation::JDOWN_KDOWN_IUP: + case hier::Transformation::IDOWN_KDOWN_JDOWN: - normal_direction = 1; - break; + normal_direction = 1; + break; - default: + default: - normal_direction = 2; - break; + normal_direction = 2; + break; + } } } - } - box.upper() (normal_direction) += 1; + box.setUpper(static_cast(normal_direction), + box.upper(static_cast(normal_direction)) + 1); + } } } @@ -404,9 +463,9 @@ SideGeometry::transform( const int normal_direction = index.getAxis(); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { if (i != normal_direction && index(i) >= 0) { - index(i)++; + ++index(i); } } @@ -419,7 +478,7 @@ SideGeometry::transform( if (rotation_num) { SideIndex tmp_index(dim); - for (int r = 0; r < rotation_num; r++) { + for (int r = 0; r < rotation_num; ++r) { tmp_index = index; index(0) = tmp_index(1); index(1) = -tmp_index(0); @@ -549,9 +608,9 @@ SideGeometry::transform( new_normal_direction = index.getAxis(); } - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { if (i != new_normal_direction && index(i) > 0) { - index(i)--; + --index(i); } } @@ -560,15 +619,15 @@ SideGeometry::transform( void SideGeometry::rotateAboutAxis(SideIndex& index, - const int axis, - const int num_rotations) + const tbox::Dimension::dir_t axis, + const int num_rotations) { const tbox::Dimension& dim = index.getDim(); const int a = (axis + 1) % dim.getValue(); const int b = (axis + 2) % dim.getValue(); SideIndex tmp_index(dim); - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { tmp_index = index; index(a) = tmp_index(b); index(b) = -tmp_index(a); @@ -576,13 +635,28 @@ SideGeometry::rotateAboutAxis(SideIndex& index, int new_normal_direction = index.getAxis(); if (new_normal_direction != axis) { - for (int j = 0; j < num_rotations; j++) { + for (int j = 0; j < num_rotations; ++j) { new_normal_direction = new_normal_direction == a ? b : a; } } index.setAxis(new_normal_direction); } +SideIterator +SideGeometry::begin( + const hier::Box& box, + tbox::Dimension::dir_t axis) +{ + return SideIterator(box, axis, true); +} + +SideIterator +SideGeometry::end( + const hier::Box& box, + tbox::Dimension::dir_t axis) +{ + return SideIterator(box, axis, false); +} + } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.h index 4e56d279..cdb09782 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -20,22 +20,25 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" +#include namespace SAMRAI { namespace pdat { +class SideIterator; + /*! * Class SideGeometry manages the mapping between the AMR index space * and the side-centered geometry index space. It is a subclass of * hier::BoxGeometry and it computes intersections between side- * centered box geometries for communication operations. * - * See header file for SideData class for a more detailed + * See header file for SideData class for a more detailed * description of the data layout. * * @see hier::BoxGeometry - * @see pdat::SideOverlap + * @see SideOverlap */ class SideGeometry:public hier::BoxGeometry @@ -48,13 +51,15 @@ class SideGeometry:public hier::BoxGeometry /*! * @brief Convert an AMR index box space box into an side geometry box. - * An side geometry box extends the given AMR index box space box - * by one in upper dimension for the side normal coordinate direction. + * An side geometry box extends the given AMR index space box + * by one at upper end for the side normal coordinate direction. + * + * @pre (side_normal >= 0) && (side_normal < box.getDim().getValue()) */ static hier::Box toSideBox( const hier::Box& box, - int side_normal); + tbox::Dimension::dir_t side_normal); /*! * @brief Transform a side-centered box. @@ -89,16 +94,44 @@ class SideGeometry:public hier::BoxGeometry SideIndex& index, const hier::Transformation& transformation); + static SideIterator + begin( + const hier::Box& box, + tbox::Dimension::dir_t axis); + + static SideIterator + end( + const hier::Box& box, + tbox::Dimension::dir_t axis); + /*! * @brief Construct the side geometry object given an AMR index * space box, ghost cell width and directions vector indicating * which coordinate directions are allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 + * @pre directions.min() >= 0 */ SideGeometry( const hier::Box& box, const hier::IntVector& ghosts, const hier::IntVector& directions); + /*! + * @brief Construct the side geometry object given an AMR index + * space box and ghost cell width. + * + * No directions vector is provided, so it is assumed that all + * coordinate directions are allocated. + * + * @pre box.getDim() == ghosts.getDim() + * @pre ghosts.min() >= 0 + */ + SideGeometry( + const hier::Box& box, + const hier::IntVector& ghosts); + /*! * @brief The virtual destructor does nothing interesting. */ @@ -107,6 +140,8 @@ class SideGeometry:public hier::BoxGeometry /*! * @brief Compute the overlap in side-centered index space between * the source box geometry and the destination box geometry. + * + * @pre getBox().getDim() == src_mask.getDim() */ virtual boost::shared_ptr calculateOverlap( @@ -119,6 +154,23 @@ class SideGeometry:public hier::BoxGeometry const bool retry, const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! + * @brief Compute the side-centered destination boxes that represent + * the overlap between the source box geometry and the destination + * box geometry. + * + * @pre src_mask.getDim() == transformation.getOffset.getDim() + */ + void + computeDestinationBoxes( + std::vector& dst_boxes, + const SideGeometry& src_geometry, + const hier::Box& src_mask, + const hier::Box& fill_box, + const bool overwrite_interior, + const hier::Transformation& transformation, + const hier::BoxContainer& dst_restrict_boxes = hier::BoxContainer()) const; + /*! * @brief Set up a SideOverlap object based on the given boxes and the * transformation. @@ -167,6 +219,9 @@ class SideGeometry:public hier::BoxGeometry * Function doOverlap() is the function that computes the overlap * between the source and destination objects, where both box geometry * objects are guaranteed to have side centered geometry. + * + * @pre src_mask.getDim() == transformation.getOffset().getDim() + * @pre dst_geometry.getDirectionVector() == src_geometry.getDirectionVector() */ static boost::shared_ptr doOverlap( @@ -181,12 +236,12 @@ class SideGeometry:public hier::BoxGeometry static void rotateAboutAxis( SideIndex& index, - const int axis, + const tbox::Dimension::dir_t axis, const int num_rotations); SideGeometry( const SideGeometry&); // not implemented - void + SideGeometry& operator = ( const SideGeometry&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.C index a4e6afeb..34eadbd6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_SideIndex_C -#define included_pdat_SideIndex_C - #include "SAMRAI/pdat/SideIndex.h" namespace SAMRAI { @@ -51,7 +47,7 @@ SideIndex::toCell( hier::Index index(dim); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { index(i) = (*this)(i); } @@ -62,4 +58,3 @@ SideIndex::toCell( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.h index 28300e9b..d67b45ca 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIndex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -28,9 +28,9 @@ namespace pdat { * about the mapping between the AMR index space and the side indices. * * @see hier::Index - * @see pdat::SideData - * @see pdat::SideGeometry - * @see pdat::SideIterator + * @see SideData + * @see SideGeometry + * @see SideIterator */ class SideIndex:public hier::Index @@ -61,12 +61,14 @@ class SideIndex:public hier::Index /** * The assignment operator sets the side index equal to the argument. + * + * @pre getDim() == rhs.getDim() */ SideIndex& operator = ( const SideIndex& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator = (rhs); d_axis = rhs.d_axis; return *this; @@ -106,24 +108,28 @@ class SideIndex:public hier::Index /** * Plus-equals operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex& operator += ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator += (rhs); return *this; } /** * Plus operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex operator + ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); SideIndex tmp = *this; tmp += rhs; return tmp; @@ -154,24 +160,28 @@ class SideIndex:public hier::Index /** * Minus-equals operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex& operator -= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator -= (rhs); return *this; } /** * Minus operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex operator - ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); SideIndex tmp = *this; tmp -= rhs; return tmp; @@ -202,24 +212,28 @@ class SideIndex:public hier::Index /** * Times-equals operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex& operator *= ( const hier::IntVector& rhs) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); hier::Index::operator *= (rhs); return *this; } /** * Times operator for a side index and an integer vector. + * + * @pre getDim() == rhs.getDim() */ SideIndex operator * ( const hier::IntVector& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); SideIndex tmp = *this; tmp *= rhs; return tmp; @@ -251,24 +265,28 @@ class SideIndex:public hier::Index /** * Returns true if two side index objects are equal. All components * and the corresponding side axes must be the same for equality. + * + * @pre getDim() == rhs.getDim() */ bool operator == ( const SideIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator == (rhs) && (d_axis == rhs.d_axis); } /** * Returns true if two side index objects are not equal. Any of * the components or axes may be different for inequality. + * + * @pre getDim() == rhs.getDim() */ bool operator != ( const SideIndex& rhs) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, rhs); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, rhs); return ((hier::Index *)this)->operator != (rhs) || (d_axis != rhs.d_axis); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.C index bcb93133..ff334fce 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered int data on * a mesh. * ************************************************************************/ - -#ifndef included_pdat_SideIntegerConstantRefine_C -#define included_pdat_SideIntegerConstantRefine_C - #include "SAMRAI/pdat/SideIntegerConstantRefine.h" #include @@ -35,21 +31,21 @@ extern "C" { #endif // in conrefine1d.f: -void F77_FUNC(conrefsideintg1d, CONREFSIDEINTG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg1d, CONREFSIDEINTG1D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); // in conrefine2d.f: -void F77_FUNC(conrefsideintg2d0, CONREFSIDEINTG2D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg2d0, CONREFSIDEINTG2D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefsideintg2d1, CONREFSIDEINTG2D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg2d1, CONREFSIDEINTG2D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -57,7 +53,7 @@ void F77_FUNC(conrefsideintg2d1, CONREFSIDEINTG2D1) (const int&, const int&, const int *, const int *, int *); // in conrefine3d.f: -void F77_FUNC(conrefsideintg3d0, CONREFSIDEINTG3D0) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg3d0, CONREFSIDEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,7 +64,7 @@ void F77_FUNC(conrefsideintg3d0, CONREFSIDEINTG3D0) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefsideintg3d1, CONREFSIDEINTG3D1) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg3d1, CONREFSIDEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -79,7 +75,7 @@ void F77_FUNC(conrefsideintg3d1, CONREFSIDEINTG3D1) (const int&, const int&, const int&, const int&, const int&, const int *, const int *, int *); -void F77_FUNC(conrefsideintg3d2, CONREFSIDEINTG3D2) (const int&, const int&, +void SAMRAI_F77_FUNC(conrefsideintg3d2, CONREFSIDEINTG3D2) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -95,9 +91,8 @@ void F77_FUNC(conrefsideintg3d2, CONREFSIDEINTG3D2) (const int&, const int&, namespace SAMRAI { namespace pdat { -SideIntegerConstantRefine::SideIntegerConstantRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "CONSTANT_REFINE") +SideIntegerConstantRefine::SideIntegerConstantRefine(): + hier::RefineOperator("CONSTANT_REFINE") { } @@ -112,9 +107,9 @@ SideIntegerConstantRefine::getOperatorPriority() const } hier::IntVector -SideIntegerConstantRefine::getStencilWidth() const +SideIntegerConstantRefine::getStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(getDim()); + return hier::IntVector::getZero(dim); } void @@ -126,58 +121,57 @@ SideIntegerConstantRefine::refine( const hier::BoxOverlap& fine_overlap, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); + const tbox::Dimension& dim(fine.getDim()); boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); - const SideOverlap* t_overlap = - dynamic_cast(&fine_overlap); + const SideOverlap* t_overlap = CPP_CAST(&fine_overlap); - TBOX_ASSERT(t_overlap != NULL); + TBOX_ASSERT(t_overlap != 0); TBOX_ASSERT(cdata); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - TBOX_DIM_ASSERT_CHECK_ARGS4(*this, fine, coarse, ratio); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); const hier::IntVector& directions = fdata->getDirectionVector(); TBOX_ASSERT(directions == hier::IntVector::min(directions, cdata->getDirectionVector())); - const hier::Box cgbox(cdata->getGhostBox()); + const hier::Box& cgbox(cdata->getGhostBox()); - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index& cilo = cgbox.lower(); + const hier::Index& cihi = cgbox.upper(); + const hier::Index& filo = fdata->getGhostBox().lower(); + const hier::Index& fihi = fdata->getGhostBox().upper(); - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(axis); - for (hier::BoxContainer::const_iterator b(boxes); + for (hier::BoxContainer::const_iterator b = boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, fine_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, fine_box); - fine_box.upper(axis) -= 1; + fine_box.setUpper(axis, fine_box.upper(axis) - 1); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); + const hier::Index& ifirstc = coarse_box.lower(); + const hier::Index& ilastc = coarse_box.upper(); + const hier::Index& ifirstf = fine_box.lower(); + const hier::Index& ilastf = fine_box.upper(); - for (int d = 0; d < fdata->getDepth(); d++) { + for (int d = 0; d < fdata->getDepth(); ++d) { if (dim == tbox::Dimension(1)) { if (directions(axis)) { - F77_FUNC(conrefsideintg1d, CONREFSIDEINTG1D) ( + SAMRAI_F77_FUNC(conrefsideintg1d, CONREFSIDEINTG1D) ( ifirstc(0), ilastc(0), ifirstf(0), ilastf(0), cilo(0), cihi(0), @@ -188,7 +182,7 @@ SideIntegerConstantRefine::refine( } } else if (dim == tbox::Dimension(2)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsideintg2d0, CONREFSIDEINTG2D0) ( + SAMRAI_F77_FUNC(conrefsideintg2d0, CONREFSIDEINTG2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -198,7 +192,7 @@ SideIntegerConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsideintg2d1, CONREFSIDEINTG2D1) ( + SAMRAI_F77_FUNC(conrefsideintg2d1, CONREFSIDEINTG2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -209,7 +203,7 @@ SideIntegerConstantRefine::refine( } } else if (dim == tbox::Dimension(3)) { if (axis == 0 && directions(0)) { - F77_FUNC(conrefsideintg3d0, CONREFSIDEINTG3D0) ( + SAMRAI_F77_FUNC(conrefsideintg3d0, CONREFSIDEINTG3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -223,7 +217,7 @@ SideIntegerConstantRefine::refine( fdata->getPointer(0, d)); } if (axis == 1 && directions(1)) { - F77_FUNC(conrefsideintg3d1, CONREFSIDEINTG3D1) ( + SAMRAI_F77_FUNC(conrefsideintg3d1, CONREFSIDEINTG3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -237,7 +231,7 @@ SideIntegerConstantRefine::refine( fdata->getPointer(1, d)); } if (axis == 2 && directions(2)) { - F77_FUNC(conrefsideintg3d2, CONREFSIDEINTG3D2) ( + SAMRAI_F77_FUNC(conrefsideintg3d2, CONREFSIDEINTG3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -262,4 +256,3 @@ SideIntegerConstantRefine::refine( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.h index c5342234..920f1380 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIntegerConstantRefine.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Constant refine operator for side-centered integer data on * a mesh. * @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/RefineOperator.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -40,8 +40,7 @@ class SideIntegerConstantRefine: /** * Uninteresting default constructor. */ - explicit SideIntegerConstantRefine( - const tbox::Dimension& dim); + SideIntegerConstantRefine(); /** * Uninteresting virtual destructor. @@ -60,7 +59,8 @@ class SideIntegerConstantRefine: * of zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination @@ -69,6 +69,8 @@ class SideIntegerConstantRefine: * of the destination patch and the boxes contained in fine_overlap. * It is assumed that the coarse patch contains sufficient data for the * stencil width of the refinement operator. + * + * @pre dynamic_cast(&fine_overlap) != 0 */ void refine( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.C index d4d38fb3..17b0f063 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.C @@ -3,29 +3,26 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for side centered patch data types * ************************************************************************/ - -#ifndef included_pdat_SideIterator_C -#define included_pdat_SideIterator_C - #include "SAMRAI/pdat/SideIterator.h" +#include "SAMRAI/pdat/SideGeometry.h" namespace SAMRAI { namespace pdat { SideIterator::SideIterator( const hier::Box& box, - const int axis, + const tbox::Dimension::dir_t axis, bool begin): d_index(box.lower(), axis, SideIndex::Lower), d_box(SideGeometry::toSideBox(box, axis)) { if (!d_box.empty() && !begin) { - d_index(d_box.getDim().getValue()-1) = - d_box.upper(d_box.getDim().getValue()-1) + 1; + d_index(d_box.getDim().getValue() - 1) = + d_box.upper(static_cast(d_box.getDim().getValue() - 1)) + 1; } } @@ -43,11 +40,11 @@ SideIterator::~SideIterator() SideIterator& SideIterator::operator ++ () { - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -60,11 +57,11 @@ SideIterator::operator ++ ( int) { SideIterator tmp = *this; - d_index(0)++; - for (int i = 0; i < d_box.getDim().getValue() - 1; i++) { + ++d_index(0); + for (tbox::Dimension::dir_t i = 0; i < d_box.getDim().getValue() - 1; ++i) { if (d_index(i) > d_box.upper(i)) { d_index(i) = d_box.lower(i); - d_index(i + 1)++; + ++d_index(i + 1); } else { break; } @@ -74,4 +71,3 @@ SideIterator::operator ++ ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.h index 3fe2c8aa..bd2596be 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideIterator.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Iterator for side centered patch data types * ************************************************************************/ @@ -37,23 +37,14 @@ namespace pdat { * on your compiler. Many compilers are not smart enough to optimize the * looping constructs and indexing operations. * - * @see pdat::SideData - * @see pdat::SideGeometry - * @see pdat::SideIndex + * @see SideData + * @see SideGeometry + * @see SideIndex */ class SideIterator { public: - /** - * Constructor for the side iterator. The iterator will enumerate - * the indices in the argument box. - */ - SideIterator( - const hier::Box& box, - const int axis, - bool begin); - /** * Copy constructor for the side iterator */ @@ -90,7 +81,7 @@ class SideIterator * Extract a pointer to the side index corresponding to the iterator * position in the box. */ - const SideIndex* + const SideIndex * operator -> () const { return &d_index; @@ -116,6 +107,8 @@ class SideIterator operator == ( const SideIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index == iterator.d_index; } @@ -126,10 +119,33 @@ class SideIterator operator != ( const SideIterator& iterator) const { + TBOX_ASSERT(d_box.isSpatiallyEqual(iterator.d_box)); + TBOX_ASSERT(d_box.isIdEqual(iterator.d_box)); return d_index != iterator.d_index; } private: + friend SideIterator + SideGeometry::begin( + const hier::Box& box, + tbox::Dimension::dir_t axis); + friend SideIterator + SideGeometry::end( + const hier::Box& box, + tbox::Dimension::dir_t axis); + + /** + * Constructor for the side iterator. The iterator will enumerate + * the indices in the argument box. + */ + SideIterator( + const hier::Box& box, + const tbox::Dimension::dir_t axis, + bool begin); + + // Unimplemented default constructor. + SideIterator(); + SideIndex d_index; hier::Box d_box; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.C index c3c9d5ba..621824fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.C @@ -3,31 +3,29 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ - -#ifndef included_pdat_SideOverlap_C -#define included_pdat_SideOverlap_C - #include "SAMRAI/pdat/SideOverlap.h" +#include "SAMRAI/pdat/SideGeometry.h" + namespace SAMRAI { namespace pdat { SideOverlap::SideOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& transformation): d_is_overlap_empty(true), d_transformation(transformation) { const tbox::Dimension& dim = d_transformation.getOffset().getDim(); - d_dst_boxes.resizeArray(boxes.getSize()); + d_dst_boxes.resize(boxes.size()); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { d_dst_boxes[d] = boxes[d]; - if (!d_dst_boxes[d].isEmpty()) d_is_overlap_empty = false; + if (!d_dst_boxes[d].empty()) d_is_overlap_empty = false; } } @@ -45,11 +43,47 @@ const hier::BoxContainer& SideOverlap::getDestinationBoxContainer( const int axis) const { - TBOX_ASSERT((axis >= 0) && (axis < d_dst_boxes.getSize())); + TBOX_ASSERT((axis >= 0) && (axis < static_cast(d_dst_boxes.size()))); return d_dst_boxes[axis]; } +void +SideOverlap::getSourceBoxContainer(hier::BoxContainer& src_boxes, + int& normal_direction) const +{ + TBOX_ASSERT(src_boxes.empty()); + TBOX_ASSERT(normal_direction >= 0 && + normal_direction < static_cast(d_dst_boxes.size())); + + src_boxes = d_dst_boxes[normal_direction]; + int transform_normal = normal_direction; + if (!src_boxes.empty()) { + hier::Transformation inverse_transform = + d_transformation.getInverseTransformation(); + for (hier::BoxContainer::iterator bi = src_boxes.begin(); + bi != src_boxes.end(); ++bi) { + if (d_transformation.getRotation() == 0) { + bi->setUpper(static_cast(normal_direction), + bi->upper(static_cast(normal_direction)) - 1); + inverse_transform.transform(*bi); + bi->setUpper(static_cast(normal_direction), + bi->upper(static_cast(normal_direction)) + 1); + } else { + transform_normal = normal_direction; + SideGeometry::transform(*bi, + transform_normal, + inverse_transform); + } + } + } + normal_direction = transform_normal; + + TBOX_ASSERT(normal_direction >= 0 && + normal_direction < static_cast(d_dst_boxes.size())); + +} + const hier::IntVector& SideOverlap::getSourceOffset() const { @@ -64,4 +98,3 @@ SideOverlap::getTransformation() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.h index 8b256cab..0cf6fc5c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideOverlap.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -30,7 +30,7 @@ namespace pdat { * with side centered geometry. * * @see hier::BoxOverlap - * @see pdat::SideOverlap + * @see SideOverlap */ class SideOverlap:public hier::BoxOverlap @@ -42,7 +42,7 @@ class SideOverlap:public hier::BoxOverlap * in the generation of communication schedules. */ SideOverlap( - const tbox::Array& boxes, + const std::vector& boxes, const hier::Transformation& Transformation); /** @@ -65,13 +65,33 @@ class SideOverlap:public hier::BoxOverlap * destination coordinate space and must be shifted by * -(getSourceOffset()) to lie in the source index space. The axis * argument represents which axis is desired: X=0, Y=1, and Z=2. - * This method over-rides the virtual function in the - * hier::BoxOverlap base class. + * + * @pre (axis >= 0) && (axis < d_dst_boxes.size()) */ virtual const hier::BoxContainer& getDestinationBoxContainer( const int axis) const; + /*! + * @brief Get a BoxContainer representing the source boxes of the overlap. + * + * The src_boxes container will be filled with side-centered source + * boxes of the overlap in the source coordinate space. The given + * normal direction is the normal in destination space on input and + * in source space on output. + * + * @param[out] src_boxes + * @param[in,out] normal_direction + * + * @pre src_boxes.empty() + * @pre normal_direction >= 0 && normal_direction < d_dst_boxes.size() + * @post normal_direction >= 0 && normal_direction < d_dst_boxes.size() + */ + virtual void + getSourceBoxContainer( + hier::BoxContainer& src_boxes, + int& normal_direction) const; + /** * Return the offset between the destination and source index spaces. * The destination index space is the source index space shifted @@ -86,7 +106,7 @@ class SideOverlap:public hier::BoxOverlap private: bool d_is_overlap_empty; hier::Transformation d_transformation; - tbox::Array d_dst_boxes; + std::vector d_dst_boxes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.C index 7e87bbe2..b6311104 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -15,14 +15,11 @@ #include "SAMRAI/pdat/SideDataFactory.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { -template -const int SideVariable::ALL_DIRECTIONS = -1; - /* ************************************************************************* * @@ -35,34 +32,38 @@ template SideVariable::SideVariable( const tbox::Dimension& dim, const std::string& name, + const hier::IntVector& directions, int depth, - bool fine_boundary_represents_var, - int direction): + bool fine_boundary_represents_var): hier::Variable(name, boost::make_shared >( depth, // default zero ghost cells hier::IntVector::getZero(dim), - fine_boundary_represents_var)), + fine_boundary_represents_var, + directions)), d_fine_boundary_represents_var(fine_boundary_represents_var), - d_directions(dim) + d_directions(directions) { - TBOX_ASSERT((direction >= ALL_DIRECTIONS) && (direction < getDim().getValue())); + TBOX_ASSERT(directions.getDim() == getDim()); +} - d_directions = hier::IntVector::getOne(getDim()); - if ((direction != ALL_DIRECTIONS)) { - // SGS this loop seems stupid, why not just set directions(direction) = 1? - for (int id = 0; id < getDim().getValue(); id++) { - d_directions(id) = ((direction == id) ? 1 : 0); - } - const hier::IntVector& zero_vector(hier::IntVector::getZero(getDim())); - setPatchDataFactory( - boost::make_shared >( - depth, - zero_vector, - fine_boundary_represents_var, - d_directions)); - } +template +SideVariable::SideVariable( + const tbox::Dimension& dim, + const std::string& name, + int depth, + bool fine_boundary_represents_var): + hier::Variable(name, + boost::make_shared >( + depth, + // default zero ghost cells + hier::IntVector::getZero(dim), + fine_boundary_represents_var, + hier::IntVector::getOne(dim))), + d_fine_boundary_represents_var(fine_boundary_represents_var), + d_directions(hier::IntVector::getOne(dim)) +{ } template @@ -79,37 +80,13 @@ const hier::IntVector& SideVariable::getDirectionVector() const template int SideVariable::getDepth() const { - boost::shared_ptr > factory(getPatchDataFactory()); + boost::shared_ptr > factory( + BOOST_CAST, hier::PatchDataFactory>( + getPatchDataFactory())); TBOX_ASSERT(factory); return factory->getDepth(); } -/* - ************************************************************************* - * - * These are private and should not be used. They are defined here - * because some template instantiation methods fail if some member - * functions are left undefined. - * - ************************************************************************* - */ - -template -SideVariable::SideVariable( - const SideVariable& foo): - hier::Variable(NULL, boost::shared_ptr()), - d_directions(hier::IntVector(foo.getDim())) -{ - NULL_USE(foo); -} - -template -void SideVariable::operator = ( - const SideVariable& foo) -{ - NULL_USE(foo); -} - } } #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.h index af22601c..7c6d42fb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SideVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: hier * ************************************************************************/ @@ -23,23 +23,23 @@ namespace SAMRAI { namespace pdat { /*! - * Class SideVariable is a templated variable class used to define + * Class SideVariable is a templated variable class used to define * side-centered quantities on an AMR mesh. It is a subclass of * hier::Variable and is templated on the type of the underlying data - * (e.g., double, int, bool, etc.). See header file for SideData class + * (e.g., double, int, bool, etc.). See header file for SideData class * for a more detailed description of the data layout. * * Note that it is possible to create a side data object for managing * data at cell sides associated with a single coordinate direction only. * See the constructor for more information. * - * IMPORTANT: The class FaceVariable and associated "face data" classes + * IMPORTANT: The class FaceVariable and associated "face data" classes * define the same storage as this side variable class, except that the * individual array indices are permuted in the face data type. * - * @see pdat::SideData - * @see pdat::SideDataFactory - * @see pdat::SideGeometry + * @see SideData + * @see SideDataFactory + * @see SideGeometry * @see hier::Variable */ @@ -50,24 +50,33 @@ class SideVariable:public hier::Variable /*! * @brief Create an side-centered variable object with the given name and * depth (i.e., number of data values at each edge index location). + * * A default depth of one is provided. The fine boundary representation * boolean argument indicates which values (either coarse or fine) take * precedence at coarse-fine mesh boundaries during coarsen and refine * operations. The default is that fine data values take precedence * on coarse-fine interfaces. + */ + SideVariable( + const tbox::Dimension& dim, + const std::string& name, + const hier::IntVector& directions, + int depth = 1, + bool fine_boundary_represents_var = true); + + /*! + * @brief Constructor that will assume a directions vector of 1 in + * all coordinate directions. * - * The default data allocation scheme is that side data will - * be allocated for all side normal coordinate directions. If this is - * desired, then the direction argument may be omitted. If an integer - * direction argument is specified, the only data for the given - * side normal direction will be maintained and managed for this variable. + * Constructs a SideVariable the same as the first constructor, except + * there is no directions argument, meaning that data is expected to + * exist on the sides in all coordinate directions. */ SideVariable( const tbox::Dimension& dim, const std::string& name, int depth = 1, - bool fine_boundary_represents_var = true, - int direction = -1); + bool fine_boundary_represents_var = true); /*! * @brief Virtual destructor for side variable objects. @@ -112,20 +121,17 @@ class SideVariable:public hier::Variable getDepth() const; private: - /* - * Static integer constant describing the value indicating that all - * directions are relevent. - */ - static const int ALL_DIRECTIONS; - bool d_fine_boundary_represents_var; hier::IntVector d_directions; + // Unimplemented copy constructor SideVariable( - const SideVariable&); // not implemented - void + const SideVariable&); + + // Unimplemented assignment operator + SideVariable& operator = ( - const SideVariable&); // not implemented + const SideVariable&); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.C index ae5aada0..78755811 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat * ************************************************************************/ @@ -19,13 +19,15 @@ #include "SAMRAI/tbox/PIO.h" // used for boost::to_lower -#include +#include "boost/algorithm/string.hpp" #include +#ifdef __GNUC__ #if __GNUC__ == 4 && __GNUC_MINOR__ == 1 #define GNUC_VERSION_412 412 #endif +#endif namespace SAMRAI { namespace pdat { @@ -81,7 +83,7 @@ SparseData::Attributes::~Attributes() template typename SparseData::Attributes& SparseData::Attributes::operator = ( - const SparseData::Attributes& rhs) + const typename SparseData::Attributes& rhs) { if (this != &rhs) { d_dbl_attrs = rhs.d_dbl_attrs; @@ -115,13 +117,13 @@ SparseData::Attributes::add( * non-modifying operations **********************************************************************/ template -const double* +const double * SparseData::Attributes::getDoubleAttributes() const { return &d_dbl_attrs[0]; } template -const int* +const int * SparseData::Attributes::getIntAttributes() const { return &d_int_attrs[0]; } @@ -234,6 +236,7 @@ SparseData::SparseData( d_dbl_attr_size(static_cast(dbl_names.size())), d_int_attr_size(static_cast(int_names.size())) { + TBOX_ASSERT_OBJDIM_EQUALITY2(box, ghosts); std::vector::const_iterator name_iter; int val(0); @@ -271,12 +274,12 @@ void SparseData::copy( const hier::PatchData& src) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const SparseData* tmp_src = - static_cast *>(&src); + CPP_CAST *>(&src); - TBOX_ASSERT(tmp_src != NULL); + TBOX_ASSERT(tmp_src != 0); const hier::Box& src_ghost_box = tmp_src->getGhostBox(); _removeInsideBox(src_ghost_box); @@ -301,7 +304,7 @@ void SparseData::copy2( hier::PatchData& dst) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copy(*this); } @@ -314,22 +317,22 @@ SparseData::copy( const hier::PatchData& src, const hier::BoxOverlap& overlap) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, src); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, src); const SparseData* tmp_src = - static_cast *>(&src); + CPP_CAST *>(&src); const typename BOX_GEOMETRY::Overlap * tmp_overlap = - static_cast(&overlap); + CPP_CAST(&overlap); - TBOX_ASSERT(tmp_src != NULL); - TBOX_ASSERT(tmp_overlap != NULL); + TBOX_ASSERT(tmp_src != 0); + TBOX_ASSERT(tmp_overlap != 0); const hier::IntVector& src_offset(tmp_overlap->getSourceOffset()); const hier::BoxContainer& box_list = tmp_overlap->getDestinationBoxContainer(); const hier::Box& src_ghost_box = tmp_src->getGhostBox(); - for (hier::BoxContainer::const_iterator overlap_box(box_list); + for (hier::BoxContainer::const_iterator overlap_box = box_list.begin(); overlap_box != box_list.end(); ++overlap_box) { const hier::Box& dst_box = *overlap_box; @@ -350,7 +353,7 @@ SparseData::copy( } // if (src_ghost_box.contains(... } // for (; src_index_map_iter != ... - } // for (hier::BoxContainer::const_iterator overlap_box(... + } // for (hier::BoxContainer::const_iterator overlap_box = ... } /********************************************************************** @@ -362,7 +365,7 @@ SparseData::copy2( hier::PatchData& dst, const hier::BoxOverlap& overlap) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, dst); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, dst); dst.copy(*this, overlap); } @@ -380,14 +383,14 @@ SparseData::canEstimateStreamSizeFromBox() const * getDataStreamSize(overlap) *********************************************************************/ template -int +size_t SparseData::getDataStreamSize( const hier::BoxOverlap& overlap) const { const typename BOX_GEOMETRY::Overlap * tmp_overlap = - static_cast(&overlap); + CPP_CAST(&overlap); - TBOX_ASSERT(tmp_overlap != NULL); + TBOX_ASSERT(tmp_overlap != 0); size_t bytes = 0; int num_items = 0; @@ -397,7 +400,7 @@ SparseData::getDataStreamSize( // first count up the number of items that we'll need to deal // with - for (hier::BoxContainer::const_iterator overlap_box(boxes); + for (hier::BoxContainer::const_iterator overlap_box = boxes.begin(); overlap_box != boxes.end(); ++overlap_box) { const hier::Box& box = hier::PatchData::getBox() @@ -454,7 +457,7 @@ SparseData::getDataStreamSize( } // for ( ; inames ... // record the size of the Indexes - const int index_size = + const size_t index_size = d_dim.getValue() * tbox::MessageStream::getSizeof(); bytes += (num_items * index_size + tbox::MessageStream::getSizeof()); @@ -468,7 +471,7 @@ SparseData::getDataStreamSize( * tbox::MessageStream::getSizeof(); } // if (num_item > 0) - return static_cast(bytes); + return bytes; } /********************************************************************** @@ -481,8 +484,8 @@ SparseData::packStream( const hier::BoxOverlap& overlap) const { const typename BOX_GEOMETRY::Overlap * tmp_overlap = - dynamic_cast(&overlap); - TBOX_ASSERT(tmp_overlap != NULL); + CPP_CAST(&overlap); + TBOX_ASSERT(tmp_overlap != 0); // Calculate the number of matching items const hier::BoxContainer& boxes = tmp_overlap->getDestinationBoxContainer(); @@ -490,7 +493,7 @@ SparseData::packStream( int num_items = 0; int num_attributes = 0; - for (hier::BoxContainer::const_iterator overlap_box(boxes); + for (hier::BoxContainer::const_iterator overlap_box = boxes.begin(); overlap_box != boxes.end(); ++overlap_box) { hier::Box box = hier::PatchData::getBox() * hier::Box::shift(*overlap_box, -(tmp_overlap->getSourceOffset())); @@ -554,7 +557,7 @@ SparseData::packStream( } // pack the individual items - for (hier::BoxContainer::const_iterator overlap_box(boxes); + for (hier::BoxContainer::const_iterator overlap_box = boxes.begin(); overlap_box != boxes.end(); ++overlap_box) { hier::Box box = hier::PatchData::getBox() @@ -603,7 +606,7 @@ SparseData::packStream( } } // if (box.contains(... } // for (; index_map_iter - } // for (hier::BoxContainer::const_iterator overlap_box(... + } // for (hier::BoxContainer::const_iterator overlap_box = ... } /********************************************************************** @@ -616,8 +619,8 @@ SparseData::unpackStream( const hier::BoxOverlap& overlap) { const typename BOX_GEOMETRY::Overlap * tmp_overlap = - dynamic_cast(&overlap); - TBOX_ASSERT(tmp_overlap != NULL); + CPP_CAST(&overlap); + TBOX_ASSERT(tmp_overlap != 0); int num_items; // unpack total number of items @@ -672,7 +675,7 @@ SparseData::unpackStream( } const hier::BoxContainer& boxes = tmp_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator overlap_box(boxes); + for (hier::BoxContainer::const_iterator overlap_box = boxes.begin(); overlap_box != boxes.end(); ++overlap_box) { _removeInsideBox(*overlap_box); @@ -695,8 +698,8 @@ SparseData::unpackStream( // unpack the number of attributes stream >> num_attrs; - double dvals[d_dbl_attr_size]; - int ivals[d_int_attr_size]; + double dvals[static_cast(d_dbl_attr_size)]; + int ivals[static_cast(d_int_attr_size)]; for (int count = 0; count < num_attrs; ++count) { stream.unpack(dvals, d_dbl_attr_size); stream.unpack(ivals, d_int_attr_size); @@ -706,65 +709,79 @@ SparseData::unpackStream( } /********************************************************************** - * getSpecializedFromDatabase(database) + * getFromRestart(database) *********************************************************************/ template void -SparseData::getSpecializedFromDatabase( - const boost::shared_ptr& db) +SparseData::getFromRestart( + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); + + hier::PatchData::getFromRestart(restart_db); // get and check the version - int ver = db->getInteger("PDAT_SPARSEDATA_VERSION"); + int ver = restart_db->getInteger("PDAT_SPARSEDATA_VERSION"); if (ver != PDAT_SPARSEDATA_VERSION) { - TBOX_ERROR("SparseData::getSpecializedFromDatabase error...\n" + TBOX_ERROR("SparseData::getFromRestart error...\n" << " : Restart file version is " << "different than class version" << std::endl); } // Number of elements in this SparseData object - int count = db->getInteger("sparse_data_count"); + int count = restart_db->getInteger("sparse_data_count"); // number of double node item attributes - TBOX_ASSERT(db->getInteger("dbl_attr_item_count") == d_dbl_attr_size); + TBOX_ASSERT(restart_db->getInteger("dbl_attr_item_count") == + d_dbl_attr_size); // get the registered double keys and their associated id. - std::string* keys = new std::string[d_dbl_attr_size]; - int* ids = new int[d_dbl_attr_size]; - db->getStringArray("sparse_data_dbl_keys", keys, d_dbl_attr_size); - db->getIntegerArray("sparse_data_dbl_ids", ids, d_dbl_attr_size); + std::string* keys = 0; + int* ids = 0; + if (d_dbl_attr_size > 0) { + keys = new std::string[d_dbl_attr_size]; + ids = new int[d_dbl_attr_size]; + } + restart_db->getStringArray("sparse_data_dbl_keys", keys, d_dbl_attr_size); + restart_db->getIntegerArray("sparse_data_dbl_ids", ids, d_dbl_attr_size); d_dbl_names.clear(); for (int i = 0; i < d_dbl_attr_size; ++i) { d_dbl_names.insert( - std::make_pair( - keys[i], DoubleAttributeId(ids[i]))); + std::make_pair(keys[i], DoubleAttributeId(ids[i]))); } - delete[] keys; - delete[] ids; + if (d_dbl_attr_size > 0) { + delete[] keys; + keys = 0; + delete[] ids; + ids = 0; + } // number of double node item attributes - TBOX_ASSERT(db->getInteger("int_attr_item_count") == d_int_attr_size); + TBOX_ASSERT(restart_db->getInteger("int_attr_item_count") == + d_int_attr_size); // get the registered integer keys and their associated id. - keys = new std::string[d_int_attr_size]; - ids = new int[d_int_attr_size]; - db->getStringArray("sparse_data_int_keys", keys, d_int_attr_size); - db->getIntegerArray("sparse_data_int_ids", ids, d_int_attr_size); + if (d_int_attr_size > 0) { + keys = new std::string[d_int_attr_size]; + ids = new int[d_int_attr_size]; + } + restart_db->getStringArray("sparse_data_int_keys", keys, d_int_attr_size); + restart_db->getIntegerArray("sparse_data_int_ids", ids, d_int_attr_size); d_int_names.clear(); for (int i = 0; i < d_int_attr_size; ++i) { d_int_names.insert( - std::make_pair( - keys[i], IntegerAttributeId(ids[i]))); + std::make_pair(keys[i], IntegerAttributeId(ids[i]))); } - delete[] keys; - keys = NULL; - delete[] ids; - ids = NULL; + if (d_int_attr_size > 0) { + delete[] keys; + keys = 0; + delete[] ids; + ids = 0; + } // get the data for each node in this sparse data object for (int curr_item = 0; curr_item < count; ++curr_item) { @@ -773,13 +790,13 @@ SparseData::getSpecializedFromDatabase( "attr_index_data_" + tbox::Utilities::intToString(curr_item, 6); // get the next item - if (db->isDatabase(index_keyword)) { + if (restart_db->isDatabase(index_keyword)) { boost::shared_ptr item_db( - db->getDatabase(index_keyword)); + restart_db->getDatabase(index_keyword)); // unpack the index - tbox::Array index_array = - item_db->getIntegerArray(index_keyword); + std::vector index_array = + item_db->getIntegerVector(index_keyword); hier::Index index(d_dim); for (int j = 0; j < d_dim.getValue(); ++j) { index(j) = index_array[j]; @@ -801,10 +818,10 @@ SparseData::getSpecializedFromDatabase( + tbox::Utilities::intToString(curr_item, 6); int dbl_ary_size = d_dbl_attr_size * list_size; - double dvalues[dbl_ary_size]; + double dvalues[static_cast(dbl_ary_size)]; int int_ary_size = d_int_attr_size * list_size; - int ivalues[int_ary_size]; + int ivalues[static_cast(int_ary_size)]; item_db->getDoubleArray(dvalues_keyword, dvalues, (dbl_ary_size)); @@ -832,31 +849,42 @@ SparseData::getSpecializedFromDatabase( doffset += d_dbl_attr_size; ioffset += d_int_attr_size; } // for (int curr_list ... - } // if (db->isDatabase(... + } // if (restart_db->isDatabase(... + else { + TBOX_ERROR("SparseData::getFromRestart error...\n" + << " : Restart database missing data for attribute index " + << index_keyword << std::endl); + } } // for (int curr_item = ... } /********************************************************************** - * putSpecializedToDatabase(database) + * putToRestart(database) *********************************************************************/ template void -SparseData::putSpecializedToDatabase( - const boost::shared_ptr& db) const +SparseData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); + + hier::PatchData::putToRestart(restart_db); // record the version - db->putInteger("PDAT_SPARSEDATA_VERSION", PDAT_SPARSEDATA_VERSION); + restart_db->putInteger("PDAT_SPARSEDATA_VERSION", PDAT_SPARSEDATA_VERSION); // record the number of sparse data elements - db->putInteger("sparse_data_count", + restart_db->putInteger("sparse_data_count", static_cast(d_index_to_attribute_map.size())); - db->putInteger("dbl_attr_item_count", d_dbl_attr_size); + restart_db->putInteger("dbl_attr_item_count", d_dbl_attr_size); // record the keys for the attributes - std::string* keys = new std::string[d_dbl_attr_size]; - int* ids = new int[d_dbl_attr_size]; + std::string* keys = 0; + int* ids = 0; + if (d_dbl_attr_size > 0) { + keys = new std::string[d_dbl_attr_size]; + ids = new int[d_dbl_attr_size]; + } typename DoubleAttrNameMap::const_iterator dbl_name_iter = d_dbl_names.begin(); @@ -865,17 +893,23 @@ SparseData::putSpecializedToDatabase( ids[i] = dbl_name_iter->second(); } - db->putStringArray("sparse_data_dbl_keys", keys, d_dbl_attr_size); - db->putIntegerArray("sparse_data_dbl_ids", ids, d_dbl_attr_size); + restart_db->putStringArray("sparse_data_dbl_keys", keys, d_dbl_attr_size); + restart_db->putIntegerArray("sparse_data_dbl_ids", ids, d_dbl_attr_size); - delete[] keys; - delete[] ids; + if (d_dbl_attr_size > 0) { + delete[] keys; + keys = 0; + delete[] ids; + ids = 0; + } // record the keys for the attributes - db->putInteger("int_attr_item_count", d_int_attr_size); + restart_db->putInteger("int_attr_item_count", d_int_attr_size); - keys = new std::string[d_int_attr_size]; - ids = new int[d_int_attr_size]; + if (d_int_attr_size > 0) { + keys = new std::string[d_int_attr_size]; + ids = new int[d_int_attr_size]; + } typename IntAttrNameMap::const_iterator int_name_iter = d_int_names.begin(); for (int i = 0; i < d_int_attr_size; ++i, ++int_name_iter) { @@ -883,13 +917,15 @@ SparseData::putSpecializedToDatabase( ids[i] = int_name_iter->second(); } - db->putStringArray("sparse_data_int_keys", keys, d_int_attr_size); - db->putIntegerArray("sparse_data_int_ids", ids, d_int_attr_size); + restart_db->putStringArray("sparse_data_int_keys", keys, d_int_attr_size); + restart_db->putIntegerArray("sparse_data_int_ids", ids, d_int_attr_size); - delete[] keys; - keys = NULL; - delete[] ids; - ids = NULL; + if (d_int_attr_size > 0) { + delete[] keys; + keys = 0; + delete[] ids; + ids = 0; + } // record the actual data for each element int curr_item(0); @@ -905,15 +941,15 @@ SparseData::putSpecializedToDatabase( // First deal with the Index const hier::Index& index = index_iter->first; - tbox::Array index_array(d_dim.getValue()); + std::vector index_array(d_dim.getValue()); for (int i = 0; i < d_dim.getValue(); ++i) { index_array[i] = index(i); } boost::shared_ptr item_db( - db->putDatabase(index_keyword)); + restart_db->putDatabase(index_keyword)); - item_db->putIntegerArray(index_keyword, index_array); + item_db->putIntegerVector(index_keyword, index_array); // Next get the node and record the double attribute data typename SparseData::AttributeIterator attributes( @@ -927,8 +963,8 @@ SparseData::putSpecializedToDatabase( + tbox::Utilities::intToString(curr_item, 6); item_db->putInteger(list_size_keyword, list_size); - double dvalues[d_dbl_attr_size * list_size]; - int ivalues[d_int_attr_size * list_size]; + double dvalues[static_cast(d_dbl_attr_size * list_size)]; + int ivalues[static_cast(d_int_attr_size * list_size)]; // pack all the data together. int doffset(0), ioffset(0); @@ -971,7 +1007,7 @@ SparseData::getDblAttributeId( { DoubleAttributeId id(-1); // stupid need -#if GNUC_VERSION_412 +#ifdef GNUC_VERSION_412 DoubleAttrNameMap::const_iterator iter = d_dbl_names.find(attribute); if (iter != d_dbl_names.end()) { id = iter->second; @@ -996,7 +1032,7 @@ SparseData::getIntAttributeId( const std::string& attribute) const { IntegerAttributeId id(-1); -#if GNUC_VERSION_412 +#ifdef GNUC_VERSION_412 IntAttrNameMap::const_iterator iter = d_int_names.find(attribute); if (iter != d_int_names.end()) { id = iter->second; @@ -1206,16 +1242,16 @@ SparseData::operator != ( } template -typename SparseData::AttributeList& -SparseData::_get( +typename SparseData::AttributeList +& SparseData::_get( const hier::Index & index) const { - typename SparseData::AttributeList * list = NULL; + typename SparseData::AttributeList * list = 0; try { list = &d_index_to_attribute_map.at(index); } catch (std::out_of_range e) { - TBOX_ASSERT_MSG(list != NULL, + TBOX_ASSERT_MSG(list != 0, "The index was not found in this sparse data object"); } return *list; @@ -1241,7 +1277,7 @@ void SparseData::_removeInsideBox( const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); typename IndexMap::iterator index_map_iter = d_index_to_attribute_map.begin(); @@ -1264,7 +1300,7 @@ SparseData::_removeInsideBox( *********************************************************************/ template SparseDataIterator::SparseDataIterator(): - d_data(NULL) + d_data(0) { } @@ -1322,7 +1358,7 @@ template SparseDataIterator::~SparseDataIterator() { d_iterator = d_data->d_index_to_attribute_map.end(); - d_data = NULL; + d_data = 0; } /********************************************************************** @@ -1334,7 +1370,7 @@ SparseDataIterator::operator = ( const SparseDataIterator& rhs) { if (this != &rhs) { - d_data = NULL; + d_data = 0; d_data = rhs.d_data; d_iterator = rhs.d_iterator; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.h index 7117b1b2..f867a6c5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: pdat * ************************************************************************/ @@ -27,7 +27,7 @@ #include "SAMRAI/tbox/Boost.h" BEGIN_BOOST_WARNING_SUPPRESSION -#include +#include "boost/unordered_map.hpp" END_BOOST_WARNING_SUPPRESSION #include @@ -125,8 +125,8 @@ operator << ( * SparseDataFactory. * * @see hier::PatchData - * @see pdat::SparseDataFactory - * @see pdat::SparseDataVariable + * @see SparseDataFactory + * @see SparseDataVariable */ template class SparseData:public hier::PatchData @@ -156,14 +156,13 @@ class SparseData:public hier::PatchData * will be stored in Index attributes in this instance. Once the * instance is constructed, no other attribute (names) can be added. * - * ASSERTIONS: - * The dimensions must be valid and equal between the box - * and ghosts. - * * @param [in] box Describes the interior of the index space - * @param [in] ghosts Describes the ghost nodes in each coordinate direction. + * @param [in] ghosts Describes the ghost nodes in each coordinate + * direction. * @param [in] dbl_attributes The double (named) attributes * @param [in] int_attributes The integer (named) attributes + * + * @pre box.getDim() == ghosts.getDim() */ SparseData( const hier::Box& box, @@ -184,12 +183,10 @@ class SparseData:public hier::PatchData * All data is copied from the source into the destination where there is * overlap in the index space. * - * ASSERTIONS: - * The dimensions of the src and this must be the same and - * valid. src must not be NULL - * - * * @param [in] src The source PatchData from which to copy. + * + * @pre getDim() == ghosts.getDim() + * @pre dynamic_cast *>(&src) != 0 */ void copy( @@ -202,11 +199,9 @@ class SparseData:public hier::PatchData * overlap in the index space. This copy does not change the state of * this * - * ASSERTIONS: - * The dimensions of the src and this must be the same and - * valid. src must not be NULL - * * @param [in] dst The destination PatchData + * + * @pre getDim() == dst.getDim() */ void copy2( @@ -215,12 +210,12 @@ class SparseData:public hier::PatchData /*! * @brief Copy data from the source using the designated overlap descriptor. * - * ASSERTIONS: - * The dimensions of the src and this must be the same and - * valid. src and overlap must not be NULL. - * * @param [in] src The source PatchData from which to copy. * @param [in] overlap The overlap description + * + * @pre getDim() == ghosts.getDim() + * @pre dynamic_cast *>(&src) != 0 + * @pre dynamic_cast(&overlap) != 0 */ void copy( @@ -230,14 +225,12 @@ class SparseData:public hier::PatchData /*! * @brief Copy data to the destination using the overlap descriptor. * - * ASSERTIONS: - * The dimensions of the src and this must be the same and - * valid. src and overlap must not be NULL. - * * All data is copied from this to the destination, without * changing the state of this. * @param [in] dst The destination PatchData * @param [in] overlap The overlap description + * + * @pre getDim() == dst.getDim() */ void copy2( @@ -255,23 +248,21 @@ class SparseData:public hier::PatchData /*! * @brief Calculate the number of bytes needed to stream the data. * - * ASSERTION - * overlap must not be NULL. - * * @param [in] overlap + * + * @pre dynamic_cast(&overlap) != 0 */ - int + size_t getDataStreamSize( const hier::BoxOverlap& overlap) const; /*! * @brief Pack data residing on the specified index space. * - * ASSERTION - * overlap must not be NULL. - * * @param [out] stream The message stream * @param [in] overlap + * + * @pre dynamic_cast(&overlap) */ void packStream( @@ -281,11 +272,10 @@ class SparseData:public hier::PatchData /*! * @brief Unpack data from the message stream * - * ASSERTION - * overlap must not be NULL. - * * @param [in,out] stream The message stream * @param [in] overlap + * + * @pre dynamic_cast(&overlap) != 0 */ void unpackStream( @@ -294,33 +284,30 @@ class SparseData:public hier::PatchData /*! * @brief Obtain the specific information for this SparseData object - * from the Database. + * from the restart Database. * * The parent PatchData part of this class will call this function * to get the parts of it specified within this concrete child. It * will check the version number of this instance to ensure that * it is valid. * - * ASSERTIONS: - * The database must be a non-null pointer. - * The version must match with the class-specified version + * @pre restart_db */ void - getSpecializedFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + const boost::shared_ptr& restart_db); /*! - * @brief Write out the specialized data to the Database. + * @brief Write out the specialized data to the restart Database. * * A version number is written out as well, in order to maintain * validity across runs. * - * ASSERTION: - * The database must be a non-null pointer. + * @pre restart_db */ void - putSpecializedToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * @brief Returns the attribute ID associated with the named @@ -613,8 +600,8 @@ class SparseData:public hier::PatchData **********************************************************************/ void add( - const double* dvals, - const int* ivals); + const double * dvals, + const int * ivals); void add( const std::vector& dvals, @@ -623,9 +610,9 @@ class SparseData:public hier::PatchData /********************************************************************** * non-modifying operations **********************************************************************/ - const double* + const double * getDoubleAttributes() const; - const int* + const int * getIntAttributes() const; /********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.C index fcf5648e..f863a865 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Implementation for SparseDataFactory * ************************************************************************/ @@ -18,8 +18,8 @@ #include "SAMRAI/pdat/SparseData.h" #include "SAMRAI/tbox/MemoryUtilities.h" -#include -#include +#include "boost/shared_ptr.hpp" +#include "boost/make_shared.hpp" namespace SAMRAI { namespace pdat { @@ -51,11 +51,11 @@ boost::shared_ptr SparseDataFactory::cloneFactory( const hier::IntVector& ghosts) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, ghosts); return boost::make_shared >( - ghosts, - d_dbl_attributes, - d_int_attributes); + ghosts, + d_dbl_attributes, + d_int_attributes); } template @@ -63,12 +63,12 @@ boost::shared_ptr SparseDataFactory::allocate( const hier::Patch& patch) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, patch); return boost::make_shared >( - patch.getBox(), - d_ghosts, - d_dbl_attributes, - d_int_attributes); + patch.getBox(), + d_ghosts, + d_dbl_attributes, + d_int_attributes); } template @@ -76,7 +76,7 @@ boost::shared_ptr SparseDataFactory::getBoxGeometry( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); return boost::make_shared(box, d_ghosts); } @@ -85,7 +85,7 @@ size_t SparseDataFactory::getSizeOfMemory( const hier::Box& box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, box); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, box); NULL_USE(box); return tbox::MemoryUtilities::align( sizeof(SparseData)); @@ -96,14 +96,14 @@ bool SparseDataFactory::validCopyTo( const boost::shared_ptr& dst_pdf) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_pdf); + TBOX_ASSERT_OBJDIM_EQUALITY2(*this, *dst_pdf); bool valid_copy = false; if (!valid_copy) { boost::shared_ptr > idf( - dst_pdf, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchDataFactory>(dst_pdf)); if (idf) { valid_copy = true; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.h index 5c184df8..ccd8c544 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SparseDataFactory * ************************************************************************/ @@ -26,7 +26,7 @@ #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/hier/PatchDataFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace pdat { @@ -34,8 +34,8 @@ namespace pdat { /*! * @brief Factory class used to allocate new instances of SparseData objects. * - * @see pdat::SparseData - * @see pdat::SparseDataVariable + * @see SparseData + * @see SparseDataVariable * @see hier::PatchDataFactory */ template @@ -68,6 +68,8 @@ class SparseDataFactory:public hier::PatchDataFactory * @return a cloned factory with the same properties which can * then be changed without modifying the original. * @param [in] ghosts + * + * @pre getDim() == ghosts.getDim() */ boost::shared_ptr cloneFactory( @@ -80,6 +82,8 @@ class SparseDataFactory:public hier::PatchDataFactory * is provided by the factory. * * @param [in] patch + * + * @pre getDim() == patch.getDim() */ boost::shared_ptr allocate( @@ -92,6 +96,8 @@ class SparseDataFactory:public hier::PatchDataFactory * and data dependencies between objects. * * @param [in] box + * + * @pre getDim() == box.getDim() */ boost::shared_ptr getBoxGeometry( @@ -103,6 +109,8 @@ class SparseDataFactory:public hier::PatchDataFactory * * The calculation includes object data, and does not include dynamically * allocated data. + * + * @pre getDim() == box.getDim() */ size_t getSizeOfMemory( @@ -137,6 +145,8 @@ class SparseDataFactory:public hier::PatchDataFactory * * If the destination PatchDataFactory is of the same type and dimension, * a valid copy can be made. + * + * @pre getDim() == dst_pdf->getDim() */ bool validCopyTo( @@ -148,11 +158,11 @@ class SparseDataFactory:public hier::PatchDataFactory * ensure the compiler does not create a default implementation. */ SparseDataFactory( - const SparseDataFactory& rhs); + const SparseDataFactory& other); - SparseDataFactory& + SparseDataFactory& operator = ( - const SparseDataFactory& rhs); + const SparseDataFactory& rhs); std::vector d_dbl_attributes; std::vector d_int_attributes; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.C index 1d514764..84013b66 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SparseDataVariable * ************************************************************************/ @@ -13,7 +13,7 @@ #include "SAMRAI/pdat/SparseDataVariable.h" -#include +#include "boost/make_shared.hpp" #ifdef HAVE_BOOST_HEADERS diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.h index f0a8b1b4..3175db80 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SparseDataVariable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SparseDataVariable * ************************************************************************/ @@ -85,11 +85,11 @@ class SparseDataVariable:public hier::Variable * compiler from generating a default. */ SparseDataVariable( - const SparseDataVariable& rhs); + const SparseDataVariable& rhs); - SparseDataVariable& + SparseDataVariable& operator = ( - const SparseDataVariable& rhs); + const SparseDataVariable& rhs); }; // end class SparseDataVariable. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.C b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.C index 81a3d1c8..d1ad7b02 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Sum operation on single array data elements templated on data type * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.h b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.h index 704dfdec..7761d07f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/SumOperation.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Sum operation on single array data elements templated on data type * ************************************************************************/ @@ -45,10 +45,10 @@ class SumOperation private: SumOperation( - const SumOperation&); // not implemented - void + const SumOperation&); // not implemented + SumOperation& operator = ( - const SumOperation&); // not implemented + const SumOperation&); // not implemented }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual.dox index 4fb19a30..cca1ff7a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_array.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_array.dox index a6eed755..583d8a49 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_array.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_array.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_boxgeometry.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_boxgeometry.dox index 546cae11..490eb81a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_boxgeometry.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_boxgeometry.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_cell.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_cell.dox index cfcad4a4..5838c467 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_cell.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_cell.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_edge.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_edge.dox index 79155358..5a37da76 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_edge.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_edge.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_face.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_face.dox index 24ae05a7..677ac7b1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_face.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_face.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_fortran.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_fortran.dox index acf12d70..2770402c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_fortran.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_fortran.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_index.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_index.dox index 9b3cb3af..92762aea 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_index.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_index.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_multiblock.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_multiblock.dox index 0f810eb6..767daaf2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_multiblock.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_multiblock.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_node.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_node.dox index 076196be..326f1181 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_node.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_node.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators.dox index 60fdbebb..0c7c2e3c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_cell.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_cell.dox index f769eabe..1e11ea2b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_cell.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_cell.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_outernode.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_outernode.dox index e8d75786..426a7b0c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_outernode.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_constant_outernode.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate.dox index 69dd4ed7..1a80031b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_cell.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_cell.dox index 19e2df33..6c73fc66 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_cell.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_cell.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_fortran.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_fortran.dox index 30f4a577..ec1ca9ce 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_fortran.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_operators_time_interpolate_fortran.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outeredge.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outeredge.dox index 9d193af1..b8ab27e0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outeredge.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outeredge.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerface.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerface.dox index a21e62f7..54976b67 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerface.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerface.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outernode.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outernode.dox index 73bff71a..542dc1e8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outernode.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outernode.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerside.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerside.dox index 4f7e2d81..4411d775 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerside.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_outerside.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_side.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_side.dox index a78dfc31..7cf3de01 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_side.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/dox/manual_side.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.depend index f629baab..70540f79 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -13,133 +13,160 @@ FILE_0=pdat_concoarsen1d.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_concoarsen1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4concoarsenops1d.i \ + pdat_concoarsen1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=pdat_concoarsen2d.o DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_concoarsen2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4concoarsenops2d.i \ + pdat_concoarsen2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=pdat_concoarsen3d.o DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_concoarsen3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4concoarsenops3d.i \ + pdat_concoarsen3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=pdat_conrefine1d.o DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_conrefine1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conopstuff.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conrefineops1d.i \ + pdat_conrefine1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=pdat_conrefine2d.o DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_conrefine2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conopstuff.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conrefineops2d.i \ + pdat_conrefine2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=pdat_conrefine3d.o DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_conrefine3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conopstuff.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4conrefineops3d.i \ + pdat_conrefine3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=pdat_dbugfort1d.o DEPENDS_6:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_dbugfort1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_dbugstuff1d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + pdat_dbugfort1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=pdat_dbugfort2d.o DEPENDS_7:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_dbugfort2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_dbugstuff2d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + pdat_dbugfort2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=pdat_dbugfort3d.o DEPENDS_8:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_dbugfort3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_dbugstuff3d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + pdat_dbugfort3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_8}: ${DEPENDS_8} FILE_9=pdat_lintimint1d.o DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_lintimint1d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4lintimeintops1d.i \ + pdat_lintimint1d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_9 +=\ -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} + +${FILE_9}: ${DEPENDS_9} FILE_10=pdat_lintimint2d.o DEPENDS_10:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_lintimint2d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4lintimeintops2d.i \ + pdat_lintimint2d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_10 +=\ -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} + +${FILE_10}: ${DEPENDS_10} FILE_11=pdat_lintimint3d.o DEPENDS_11:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h pdat_lintimint3d.f + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4lintimeintops3d.i \ + pdat_lintimint3d.m4 -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_11 +=\ -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} + +${FILE_11}: ${DEPENDS_11} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.in index 24b6eb40..807ac19e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/Makefile.in @@ -3,31 +3,88 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for pdat directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/pdat/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. -# For classes that are non-dimensional. -OBJS= pdat_dbugfort1d.o pdat_dbugfort2d.o pdat_dbugfort3d.o\ - pdat_concoarsen1d.o pdat_concoarsen3d.o pdat_conrefine2d.o\ - pdat_concoarsen2d.o pdat_conrefine1d.o pdat_conrefine3d.o\ - pdat_lintimint1d.o pdat_lintimint2d.o pdat_lintimint3d.o\ - - default: library include $(OBJECT)/config/Makefile.config +OBJS= pdat_concoarsen1d.o \ + pdat_concoarsen2d.o \ + pdat_concoarsen3d.o \ + pdat_conrefine1d.o \ + pdat_conrefine2d.o \ + pdat_conrefine3d.o \ + pdat_dbugfort1d.o \ + pdat_dbugfort2d.o \ + pdat_dbugfort3d.o \ + pdat_lintimint1d.o \ + pdat_lintimint2d.o \ + pdat_lintimint3d.o + library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) + $(RM) *.f include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +pdat_concoarsen1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_concoarsen1d.m4 > pdat_concoarsen1d.f + $(F77) $(FFLAGS) -c pdat_concoarsen1d.f -o $@ + +pdat_concoarsen2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_concoarsen2d.m4 > pdat_concoarsen2d.f + $(F77) $(FFLAGS) -c pdat_concoarsen2d.f -o $@ + +pdat_concoarsen3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_concoarsen3d.m4 > pdat_concoarsen3d.f + $(F77) $(FFLAGS) -c pdat_concoarsen3d.f -o $@ + +pdat_conrefine1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_conrefine1d.m4 > pdat_conrefine1d.f + $(F77) $(FFLAGS) -c pdat_conrefine1d.f -o $@ + +pdat_conrefine2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_conrefine2d.m4 > pdat_conrefine2d.f + $(F77) $(FFLAGS) -c pdat_conrefine2d.f -o $@ + +pdat_conrefine3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_conrefine3d.m4 > pdat_conrefine3d.f + $(F77) $(FFLAGS) -c pdat_conrefine3d.f -o $@ + +pdat_dbugfort1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_dbugfort1d.m4 > pdat_dbugfort1d.f + $(F77) $(FFLAGS) -c pdat_dbugfort1d.f -o $@ + +pdat_dbugfort2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_dbugfort2d.m4 > pdat_dbugfort2d.f + $(F77) $(FFLAGS) -c pdat_dbugfort2d.f -o $@ + +pdat_dbugfort3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_dbugfort3d.m4 > pdat_dbugfort3d.f + $(F77) $(FFLAGS) -c pdat_dbugfort3d.f -o $@ + +pdat_lintimint1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_lintimint1d.m4 > pdat_lintimint1d.f + $(F77) $(FFLAGS) -c pdat_lintimint1d.f -o $@ + +pdat_lintimint2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_lintimint2d.m4 > pdat_lintimint2d.f + $(F77) $(FFLAGS) -c pdat_lintimint2d.f -o $@ + +pdat_lintimint3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/pdat_lintimint3d.m4 > pdat_lintimint3d.f + $(F77) $(FFLAGS) -c pdat_lintimint3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.f deleted file mode 100644 index aeefd8ea..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.f +++ /dev/null @@ -1,295 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 1d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d constant coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c -c -c - -c - -c -c*********************************************************************** -c Constant coarsening for 1d node-centered double data -c*********************************************************************** -c - subroutine conavgnodedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 1d node-centered float data -c*********************************************************************** -c - subroutine conavgnodeflot1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - real - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 1d node-centered complex data -c*********************************************************************** -c - subroutine conavgnodecplx1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double complex - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 1d node-centered integer data -c*********************************************************************** -c - subroutine conavgnodeintg1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - integer - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ie0 -c -c*********************************************************************** -c - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0)=arrayf(ie0*ratio(0)) - enddo -c - return - end -c - -c*********************************************************************** -c Constant coarsening for 1d outernode-centered double data -c*********************************************************************** -c - subroutine conavgouternodedoub1d( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - double precision - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) - - return - end - -c*********************************************************************** -c Constant coarsening for 1d outernode-centered float data -c*********************************************************************** -c - subroutine conavgouternodeflot1d0( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - real - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) - - return - end - -c -c*********************************************************************** -c Constant coarsening for 1d outernode-centered complex data -c*********************************************************************** -c - subroutine conavgouternodecplx1d0( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - complex - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) - - return - end - -c -c*********************************************************************** -c Constant coarsening for 1d outernode-centered integer data -c*********************************************************************** -c - subroutine conavgouternodeint1d0( - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ilastc0, - & filo0,fihi0, - & cilo0,cihi0 - integer ratio(0:1-1) - integer - & arrayf(1), - & arrayc(1) -c -c*********************************************************************** -c - arrayc(1)=arrayf(1) - - return - end - - - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.m4 index a0634da0..39ffe579 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen1d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 1d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4concoarsenops1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 1d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4concoarsenops1d.i)dnl c c*********************************************************************** c Constant coarsening for 1d node-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.f deleted file mode 100644 index 18d8af10..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.f +++ /dev/null @@ -1,455 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 2d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c -c -c - - -c -c*********************************************************************** -c Constant coarsening for 2d node-centered double data -c*********************************************************************** -c - subroutine conavgnodedoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ie0,ie1,if1 -c -c*********************************************************************** -c - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1)=arrayf(ie0*ratio(0),if1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 2d node-centered float data -c*********************************************************************** -c - subroutine conavgnodeflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ie0,ie1,if1 -c -c*********************************************************************** -c - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1)=arrayf(ie0*ratio(0),if1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 2d node-centered complex data -c*********************************************************************** -c - subroutine conavgnodecplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ie0,ie1,if1 -c -c*********************************************************************** -c - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1)=arrayf(ie0*ratio(0),if1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 2d node-centered integer data -c*********************************************************************** -c - subroutine conavgnodeintg2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ie0,ie1,if1 -c -c*********************************************************************** -c - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1)=arrayf(ie0*ratio(0),if1) - enddo - enddo -c - return - end -c -c - -c*********************************************************************** -c Constant coarsening for 2d outernode-centered double data -c*********************************************************************** -c - subroutine conavgouternodedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayf(filo1+1:fihi1), - & arrayc(cilo1+1:cihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1)=arrayf(if1) - enddo - - return - end - - subroutine conavgouternodedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ic0,if0 -c -c*********************************************************************** -c - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0)=arrayf(if0) - enddo - - return - end - -c*********************************************************************** -c Constant coarsening for 2d outernode-centered float data -c*********************************************************************** -c - subroutine conavgouternodeflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayf(filo1+1:fihi1), - & arrayc(cilo1+1:cihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1)=arrayf(if1) - enddo - - return - end - - subroutine conavgouternodeflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ic0,if0 -c -c*********************************************************************** -c - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0)=arrayf(if0) - enddo - - return - end - -c -c*********************************************************************** -c Constant coarsening for 2d outernode-centered complex data -c*********************************************************************** -c - subroutine conavgouternodecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - complex - & arrayf(filo1+1:fihi1), - & arrayc(cilo1+1:cihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1)=arrayf(if1) - enddo - - return - end - - subroutine conavgouternodecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - complex - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ic0,if0 -c -c*********************************************************************** -c - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0)=arrayf(if0) - enddo - - return - end - -c -c*********************************************************************** -c Constant coarsening for 2d outernode-centered integer data -c*********************************************************************** -c - subroutine conavgouternodeint2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayf(filo1+1:fihi1), - & arrayc(cilo1+1:cihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1)=arrayf(if1) - enddo - - return - end - - subroutine conavgouternodeint2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayf(filo0:fihi0+1), - & arrayc(cilo0:cihi0+1) - integer ic0,if0 -c -c*********************************************************************** -c - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0)=arrayf(if0) - enddo - - return - end - -c - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.m4 index 0bb842fd..80e57030 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen2d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 2d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4concoarsenops2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 2d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4concoarsenops2d.i)dnl c c*********************************************************************** c Constant coarsening for 2d node-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.f deleted file mode 100644 index 254f60cc..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.f +++ /dev/null @@ -1,659 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 3d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian coarsen operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c - -c - - -c -c*********************************************************************** -c Constant coarsening for 3d node-centered double data -c*********************************************************************** -c - subroutine conavgnodedoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ie0,ie1,ie2,if1,if2 -c -c*********************************************************************** -c - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1,ie2)=arrayf(ie0*ratio(0),if1,if2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 3d node-centered float data -c*********************************************************************** -c - subroutine conavgnodeflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ie0,ie1,ie2,if1,if2 -c -c*********************************************************************** -c - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1,ie2)=arrayf(ie0*ratio(0),if1,if2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 3d node-centered complex data -c*********************************************************************** -c - subroutine conavgnodecplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ie0,ie1,ie2,if1,if2 -c -c*********************************************************************** -c - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1,ie2)=arrayf(ie0*ratio(0),if1,if2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant coarsening for 3d node-centered integer data -c*********************************************************************** -c - subroutine conavgnodeintg3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - integer - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2+1) - integer ie0,ie1,ie2,if1,if2 -c -c*********************************************************************** -c - do ie2=ifirstc2,ilastc2+1 - if2=ie2*ratio(2) - do ie1=ifirstc1,ilastc1+1 - if1=ie1*ratio(1) - do ie0=ifirstc0,ilastc0+1 - arrayc(ie0,ie1,ie2)=arrayf(ie0*ratio(0),if1,if2) - enddo - enddo - enddo -c - return - end -c - -c*********************************************************************** -c Constant coarsening for 3d outernode-centered double data -c*********************************************************************** -c - subroutine conavgouternodedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & arrayf(filo1+1:fihi1, - & filo2+1:fihi2), - & arrayc(cilo1+1:cihi1, - & cilo2+1:cihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1,ic2)=arrayf(if1,if2) - enddo - enddo - - return - end - - subroutine conavgouternodedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo2+1:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo2+1:cihi2) - integer ic0,ic2,if0,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic2)=arrayf(if0,if2) - enddo - enddo - - return - end - - subroutine conavgouternodedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - double precision - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayf(if0,if1) - enddo - enddo - - return - end - -c*********************************************************************** -c Constant coarsening for 3d outernode-centered float data -c*********************************************************************** -c - subroutine conavgouternodeflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - real - & arrayf(filo1+1:fihi1, - & filo2+1:fihi2), - & arrayc(cilo1+1:cihi1, - & cilo2+1:cihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1,ic2)=arrayf(if1,if2) - enddo - enddo - - return - end - - subroutine conavgouternodeflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo2+1:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo2+1:cihi2) - integer ic0,ic2,if0,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic2)=arrayf(if0,if2) - enddo - enddo - - return - end - - subroutine conavgouternodeflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - real - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayf(if0,if1) - enddo - enddo - - return - end - -c -c*********************************************************************** -c Constant coarsening for 3d outernode-centered complex data -c*********************************************************************** -c - subroutine conavgouternodecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - complex - & arrayf(filo1+1:fihi1, - & filo2+1:fihi2), - & arrayc(cilo1+1:cihi1, - & cilo2+1:cihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1,ic2)=arrayf(if1,if2) - enddo - enddo - - return - end - - subroutine conavgouternodecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - complex - & arrayf(filo0:fihi0+1, - & filo2+1:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo2+1:cihi2) - integer ic0,ic2,if0,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic2)=arrayf(if0,if2) - enddo - enddo - - return - end - - subroutine conavgouternodecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - complex - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayf(if0,if1) - enddo - enddo - - return - end - - -c -c*********************************************************************** -c Constant coarsening for 3d outernode-centered integer data -c*********************************************************************** -c - subroutine conavgouternodeint3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - integer - & arrayf(filo1+1:fihi1, - & filo2+1:fihi2), - & arrayc(cilo1+1:cihi1, - & cilo2+1:cihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic1=ifirstc1+1,ilastc1 - if1=ic1*ratio(1) - arrayc(ic1,ic2)=arrayf(if1,if2) - enddo - enddo - - return - end - - subroutine conavgouternodeint3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - integer - & arrayf(filo0:fihi0+1, - & filo2+1:fihi2), - & arrayc(cilo0:cihi0+1, - & cilo2+1:cihi2) - integer ic0,ic2,if0,if2 -c -c*********************************************************************** -c - do ic2=ifirstc2+1,ilastc2 - if2=ic2*ratio(2) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic2)=arrayf(if0,if2) - enddo - enddo - - return - end - - subroutine conavgouternodeint3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio, - & arrayf,arrayc) -c*********************************************************************** - implicit none - double precision zero - parameter (zero=0.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:3-1) - integer - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1), - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do ic1=ifirstc1,ilastc1+1 - if1=ic1*ratio(1) - do ic0=ifirstc0,ilastc0+1 - if0=ic0*ratio(0) - arrayc(ic0,ic1)=arrayf(if0,if1) - enddo - enddo - - return - end - - - diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.m4 index 5c4514e4..fa36be6e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_concoarsen3d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial coarsening of 3d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4concoarsenops3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial coarsening of 3d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4concoarsenops3d.i)dnl c c*********************************************************************** c Constant coarsening for 3d node-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.f deleted file mode 100644 index e565ec70..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.f +++ /dev/null @@ -1,851 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 1d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for constant patchdata transfer routines. -c -c -c -c -c -c -c -c*********************************************************************** -c Constant interpolation for 1d cell-centered double data -c*********************************************************************** -c - subroutine conrefcelldoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d cell-centered float data -c*********************************************************************** -c - subroutine conrefcellflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d cell-centered complex data -c*********************************************************************** -c - subroutine conrefcellcplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double complex - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d cell-centered integer data -c*********************************************************************** -c - subroutine conrefcellintg1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - integer - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d edge-centered double data -c*********************************************************************** -c - subroutine conrefedgedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ie0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d edge-centered float data -c*********************************************************************** -c - subroutine conrefedgeflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ie0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d edge-centered complex data -c*********************************************************************** -c - subroutine conrefedgecplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double complex - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ie0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d edge-centered integer data -c*********************************************************************** -c - subroutine conrefedgeintg1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - integer - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ie0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d face-centered double data -c*********************************************************************** -c - subroutine conreffacedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d face-centered float data -c*********************************************************************** -c - subroutine conreffaceflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d face-centered complex data -c*********************************************************************** -c - subroutine conreffacecplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double complex - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d face-centered integer data -c*********************************************************************** -c - subroutine conreffaceintg1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - integer - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d outerface double data -c*********************************************************************** -c - subroutine conrefoutfacedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & arrayc(1), - & arrayf(1) -c -c*********************************************************************** -c - arrayf(1)=arrayc(1) -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d outerface float data -c*********************************************************************** -c - subroutine conrefoutfaceflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - real - & arrayc(1), - & arrayf(1) -c -c*********************************************************************** -c - arrayf(1)=arrayc(1) -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d outerface complex data -c*********************************************************************** -c - subroutine conrefoutfacecplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double complex - & arrayc(1), - & arrayf(1) -c -c*********************************************************************** -c - arrayf(1)=arrayc(1) -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d outerface integer data -c*********************************************************************** -c - subroutine conrefoutfaceintg1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - integer - & arrayc(1), - & arrayf(1) -c -c*********************************************************************** -c - arrayf(1)=arrayc(1) -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d side-centered double data -c*********************************************************************** -c - subroutine conrefsidedoub1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double precision - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d side-centered float data -c*********************************************************************** -c - subroutine conrefsideflot1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - real - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d side-centered complex data -c*********************************************************************** -c - subroutine conrefsidecplx1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - double complex - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 1d side-centered integer data -c*********************************************************************** -c - subroutine conrefsideintg1d( - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ilastc0, - & ifirstf0,ilastf0, - & cilo0,cihi0, - & filo0,fihi0 - integer ratio(0:1-1) - integer - & arrayc(cilo0:cihi0+1), - & arrayf(filo0:fihi0+1) - integer ie0,if0,it -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0+1 - it=2*if0+ratio(0) - if (it.le.0) then - ie0=it/(2*ratio(0))-1 - else - ie0=(it-1)/(2*ratio(0)) - endif - arrayf(if0)=arrayc(ie0) - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.m4 index 56cd4224..18f65826 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine1d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 1d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4conrefineops1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 1d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4conrefineops1d.i)dnl c c*********************************************************************** c Constant interpolation for 1d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.f deleted file mode 100644 index 0294089d..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.f +++ /dev/null @@ -1,1737 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 2d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d constant refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for constant patchdata transfer routines. -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Constant interpolation for 2d cell-centered double data -c*********************************************************************** -c - subroutine conrefcelldoub2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d cell-centered float data -c*********************************************************************** -c - subroutine conrefcellflot2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d cell-centered complex data -c*********************************************************************** -c - subroutine conrefcellcplx2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d cell-centered integer data -c*********************************************************************** -c - subroutine conrefcellintg2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d edge-centered double data -c*********************************************************************** -c - subroutine conrefedgedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefedgedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d edge-centered float data -c*********************************************************************** -c - subroutine conrefedgeflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefedgeflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d edge-centered complex data -c*********************************************************************** - - subroutine conrefedgecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefedgecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d edge-centered integer data -c*********************************************************************** -c - subroutine conrefedgeintg2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefedgeintg2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d face-centered double data -c*********************************************************************** -c - subroutine conreffacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ie0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ie0,ic1) - enddo - enddo -c - return - end -c - subroutine conreffacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0) - integer ie1,ic0,if1,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if0)=arrayc(ie1,ic0) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d face-centered float data -c*********************************************************************** -c - subroutine conreffaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ie0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ie0,ic1) - enddo - enddo -c - return - end -c - subroutine conreffaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0) - integer ie1,ic0,if1,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if0)=arrayc(ie1,ic0) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d face-centered complex data -c*********************************************************************** - - subroutine conreffacecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ie0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ie0,ic1) - enddo - enddo -c - return - end -c - subroutine conreffacecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0) - integer ie1,ic0,if1,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if0)=arrayc(ie1,ic0) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d face-centered integer data -c*********************************************************************** -c - subroutine conreffaceintg2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ie0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ie0,ic1) - enddo - enddo -c - return - end -c - subroutine conreffaceintg2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo1:cihi1+1, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo0:fihi0) - integer ie1,ic0,if1,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if0)=arrayc(ie1,ic0) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d outerface double data -c*********************************************************************** -c - subroutine conrefoutfacedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1)=arrayc(ic1) - enddo -c - return - end -c - subroutine conrefoutfacedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d outerface float data -c*********************************************************************** -c - subroutine conrefoutfaceflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1)=arrayc(ic1) - enddo -c - return - end -c - subroutine conrefoutfaceflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d outerface complex data -c*********************************************************************** - - subroutine conrefoutfacecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1)=arrayc(ic1) - enddo -c - return - end -c - subroutine conrefoutfacecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d outerface integer data -c*********************************************************************** -c - subroutine conrefoutfaceintg2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo1:cihi1), - & arrayf(filo1:fihi1) - integer ic1,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1)=arrayc(ic1) - enddo -c - return - end -c - subroutine conrefoutfaceintg2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0), - & arrayf(filo0:fihi0) - integer ic0,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0)=arrayc(ic0) - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d side-centered double data -c*********************************************************************** -c - subroutine conrefsidedoub2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefsidedoub2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d side-centered float data -c*********************************************************************** -c - subroutine conrefsideflot2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefsideflot2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d side-centered complex data -c*********************************************************************** - - subroutine conrefsidecplx2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefsidecplx2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 2d side-centered integer data -c*********************************************************************** -c - subroutine conrefsideintg2d0( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+0 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c - subroutine conrefsideintg2d1( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:2-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.m4 index b4d60603..05df1e77 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine2d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 2d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4conrefineops2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 2d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4conrefineops2d.i)dnl c c*********************************************************************** c Constant interpolation for 2d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.f deleted file mode 100644 index 8c0a6dbb..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.f +++ /dev/null @@ -1,3113 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 3d patch data -c on a regular Cartesian mesh. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian refine operators -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for constant patchdata transfer routines. -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Constant interpolation for 3d cell-centered double data -c*********************************************************************** -c - subroutine conrefcelldoub3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d cell-centered float data -c*********************************************************************** -c - subroutine conrefcellflot3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d cell-centered complex data -c*********************************************************************** -c - subroutine conrefcellcplx3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d cell-centered integer data -c*********************************************************************** -c - subroutine conrefcellintg3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d edge-centered double data -c*********************************************************************** -c - subroutine conrefedgedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d edge-centered float data -c*********************************************************************** -c - subroutine conrefedgeflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgeflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgeflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d edge-centered complex data -c*********************************************************************** -c - subroutine conrefedgecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d edge-centered integer data -c*********************************************************************** -c - subroutine conrefedgeintg3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgeintg3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefedgeintg3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d face-centered double data -c*********************************************************************** -c - subroutine conreffacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ie0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c - subroutine conreffacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0) - integer ie1,ic2,ic0,if1,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - enddo - enddo - enddo -c - return - end -c - subroutine conreffacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1) - integer ie2,ic0,ic1,if2,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d face-centered float data -c*********************************************************************** -c - subroutine conreffaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ie0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c - subroutine conreffaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0) - integer ie1,ic2,ic0,if1,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - enddo - enddo - enddo -c - return - end -c - subroutine conreffaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1) - integer ie2,ic0,ic1,if2,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d face-centered complex data -c*********************************************************************** -c - subroutine conreffacecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ie0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c - subroutine conreffacecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0) - integer ie1,ic2,ic0,if1,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - enddo - enddo - enddo -c - return - end -c - subroutine conreffacecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1) - integer ie2,ic0,ic1,if2,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d face-centered integer data -c*********************************************************************** -c - subroutine conreffaceintg3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ie0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ie0=(if0+1)/ratio(0)-1 - else - ie0=if0/ratio(0) - endif - arrayf(if0,if1,if2)=arrayc(ie0,ic1,ic2) - enddo - enddo - enddo -c - return - end -c - subroutine conreffaceintg3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo1:cihi1+1, - & cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo1:fihi1+1, - & filo2:fihi2, - & filo0:fihi0) - integer ie1,ic2,ic0,if1,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ie1=(if1+1)/ratio(1)-1 - else - ie1=if1/ratio(1) - endif - arrayf(if1,if2,if0)=arrayc(ie1,ic2,ic0) - enddo - enddo - enddo -c - return - end -c - subroutine conreffaceintg3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo2:cihi2+1, - & cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo2:fihi2+1, - & filo0:fihi0, - & filo1:fihi1) - integer ie2,ic0,ic1,if2,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ie2=(if2+1)/ratio(2)-1 - else - ie2=if2/ratio(2) - endif - arrayf(if2,if0,if1)=arrayc(ie2,ic0,ic1) - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d outerface double data -c*********************************************************************** -c - subroutine conrefoutfacedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1,if2)=arrayc(ic1,ic2) - enddo - enddo -c - return - end -c - subroutine conrefoutfacedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0) - integer ic2,ic0,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - arrayf(if2,if0)=arrayc(ic2,ic0) - enddo - enddo -c - return - end -c - subroutine conrefoutfacedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d outerface float data -c*********************************************************************** -c - subroutine conrefoutfaceflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1,if2)=arrayc(ic1,ic2) - enddo - enddo -c - return - end -c - subroutine conrefoutfaceflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0) - integer ic2,ic0,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - arrayf(if2,if0)=arrayc(ic2,ic0) - enddo - enddo -c - return - end -c - subroutine conrefoutfaceflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d outerface complex data -c*********************************************************************** -c - subroutine conrefoutfacecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1,if2)=arrayc(ic1,ic2) - enddo - enddo -c - return - end -c - subroutine conrefoutfacecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0) - integer ic2,ic0,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - arrayf(if2,if0)=arrayc(ic2,ic0) - enddo - enddo -c - return - end -c - subroutine conrefoutfacecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d outerface integer data -c*********************************************************************** -c - subroutine conrefoutfaceintg3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo1:fihi1, - & filo2:fihi2) - integer ic1,ic2,if1,if2 -c -c*********************************************************************** -c - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - arrayf(if1,if2)=arrayc(ic1,ic2) - enddo - enddo -c - return - end -c - subroutine conrefoutfaceintg3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo2:cihi2, - & cilo0:cihi0), - & arrayf(filo2:fihi2, - & filo0:fihi0) - integer ic2,ic0,if2,if0 -c -c*********************************************************************** -c - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - arrayf(if2,if0)=arrayc(ic2,ic0) - enddo - enddo -c - return - end -c - subroutine conrefoutfaceintg3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1), - & arrayf(filo0:fihi0, - & filo1:fihi1) - integer ic0,ic1,if0,if1 -c -c*********************************************************************** -c - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - arrayf(if0,if1)=arrayc(ic0,ic1) - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d side-centered double data -c*********************************************************************** -c - subroutine conrefsidedoub3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsidedoub3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsidedoub3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double precision - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d side-centered float data -c*********************************************************************** -c - subroutine conrefsideflot3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsideflot3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsideflot3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - real - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d side-centered complex data -c*********************************************************************** -c - subroutine conrefsidecplx3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsidecplx3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsidecplx3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - double complex - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Constant interpolation for 3d side-centered integer data -c*********************************************************************** -c - subroutine conrefsideintg3d0( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0+1, - & cilo1:cihi1, - & cilo2:cihi2), - & arrayf(filo0:fihi0+1, - & filo1:fihi1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0+1 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsideintg3d1( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1+1, - & cilo2:cihi2), - & arrayf(filo0:fihi0, - & filo1:fihi1+1, - & filo2:fihi2) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1+1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c - subroutine conrefsideintg3d2( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio, - & arrayc,arrayf) -c*********************************************************************** - implicit none - double precision half,one - parameter (half=0.5d0) - parameter (one=1.0d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:3-1) - integer - & arrayc(cilo0:cihi0, - & cilo1:cihi1, - & cilo2:cihi2+1), - & arrayf(filo0:fihi0, - & filo1:fihi1, - & filo2:fihi2+1) - integer ic0,ic1,ic2,if0,if1,if2 -c -c*********************************************************************** -c - - - do if2=ifirstf2,ilastf2+1 - if (if2.lt.0) then - ic2=(if2+1)/ratio(2)-1 - else - ic2=if2/ratio(2) - endif - - - do if1=ifirstf1,ilastf1 - if (if1.lt.0) then - ic1=(if1+1)/ratio(1)-1 - else - ic1=if1/ratio(1) - endif - - - do if0=ifirstf0,ilastf0 - if (if0.lt.0) then - ic0=(if0+1)/ratio(0)-1 - else - ic0=if0/ratio(0) - endif - - arrayf(if0,if1,if2)=arrayc(ic0,ic1,ic2) - - enddo - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.m4 index e9e42b76..48b3ca99 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_conrefine3d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for spatial refining of 3d patch data -c on a regular Cartesian mesh. -c -include(pdat_m4conrefineops3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for spatial refining of 3d patch data +c on a regular Cartesian mesh. +c +include(PDAT_FORTDIR/pdat_m4conrefineops3d.i)dnl c c*********************************************************************** c Constant interpolation for 3d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.f deleted file mode 100644 index 50fa8832..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.f +++ /dev/null @@ -1,418 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 1d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d patchdata debugging routines -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c -c -c*********************************************************************** -c Debugging routines for 1d cell-centered data -c*********************************************************************** -c - subroutine dbugcelldoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugcellflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugcellcplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d face-centered data -c*********************************************************************** -c - subroutine dbugfacedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d node-centered data -c*********************************************************************** -c - subroutine dbugnodedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugnodeflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugnodecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d outerface data -c*********************************************************************** -c - subroutine dbugoutfacedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c - subroutine dbugoutfaceflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c - subroutine dbugoutfacecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d outerside data -c*********************************************************************** -c - subroutine dbugoutsidedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c - subroutine dbugoutsideflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c - subroutine dbugoutsidecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(1) -c ============================================================= - - write(6,*) "array[",1,"] = ",array(1) - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d side-centered data -c*********************************************************************** -c - subroutine dbugsidedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(fi0-ng:la0+1+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 1d edge-centered data -c*********************************************************************** -c - subroutine dbugedgedoub1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double precision - & array(fi0-ng:la0+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - real - & array(fi0-ng:la0+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx1d( - & fi0,la0,ng,ibeg0,iend0,array) -c ============================================================= - implicit none - integer fi0,la0,ng,ibeg0,iend0 - double complex - & array(fi0-ng:la0+ng) - integer ie0 -c ============================================================= - - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,"] = ",array(ie0) - enddo - - call flush(6) - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.m4 index ed98d113..e2a1c663 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort1d.m4 @@ -1,11 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 1d patch data types. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -include(pdat_dbugstuff1d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for debugging 1d patch data types. +c +include(PDAT_FORTDIR/pdat_dbugstuff1d.i)dnl c c*********************************************************************** c Debugging routines for 1d cell-centered data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.f deleted file mode 100644 index a28c516b..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.f +++ /dev/null @@ -1,850 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 2d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d patchdata debugging routines -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c -c -c*********************************************************************** -c Debugging routines for 2d cell-centered data -c*********************************************************************** -c - subroutine dbugcelldoub2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ",array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugcellflot2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ",array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugcellcplx2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ",array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d face-centered data -c*********************************************************************** -c - subroutine dbugfacedoub2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacedoub2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi1-ng:la1+1+ng, - & fi0-ng:la0+ng) - integer ie1,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic0,"] = ",array(ie1,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi1-ng:la1+1+ng, - & fi0-ng:la0+ng) - integer ie1,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic0,"] = ",array(ie1,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi1-ng:la1+1+ng, - & fi0-ng:la0+ng) - integer ie1,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic0,"] = ",array(ie1,ic0) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d node-centered data -c*********************************************************************** -c - subroutine dbugnodedoub2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng) - integer ie0,ie1 -c ============================================================= - - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,"] = ",array(ie0,ie1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugnodeflot2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng) - integer ie0,ie1 -c ============================================================= - - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,"] = ",array(ie0,ie1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugnodecplx2d( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng) - integer ie0,ie1 -c ============================================================= - - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,"] = ",array(ie0,ie1) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d outerface data -c*********************************************************************** -c - subroutine dbugoutfacedoub2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacedoub2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugoutfaceflot2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutfaceflot2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacecplx2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacecplx2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d outerside data -c*********************************************************************** -c - subroutine dbugoutsidedoub2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidedoub2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugoutsideflot2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutsideflot2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidecplx2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi1-ng:la1+ng) - integer ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,"] = ",array(ic1) - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidecplx2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+ng) - integer ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,"] = ",array(ic0) - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d side-centered data -c*********************************************************************** -c - subroutine dbugsidedoub2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidedoub2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 2d edge-centered data -c*********************************************************************** -c - subroutine dbugedgedoub2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgedoub2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx2d0( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+0 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx2d1( - & fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,ng, - & ibeg0,iend0,ibeg1,iend1 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng) - integer ie0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1+0 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,"] = ",array(ie0,ic1) - enddo - enddo - - call flush(6) - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.m4 index 0c40cbe0..3ac5e3c7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort2d.m4 @@ -1,11 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 2d patch data types. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -include(pdat_dbugstuff2d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for debugging 2d patch data types. +c +include(PDAT_FORTDIR/pdat_dbugstuff2d.i)dnl c c*********************************************************************** c Debugging routines for 2d cell-centered data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.f deleted file mode 100644 index a985c2d3..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.f +++ /dev/null @@ -1,1383 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 3d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d patchdata debugging routines -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c - - -c -c*********************************************************************** -c Debugging routines for 3d cell-centered data -c*********************************************************************** -c - subroutine dbugcelldoub3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,",",ic2,"] = ", - & array(ic0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugcellflot3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,",",ic2,"] = ", - & array(ic0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugcellcplx3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,",",ic2,"] = ", - & array(ic0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d face-centered data -c*********************************************************************** -c - subroutine dbugfacedoub3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacedoub3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi1-ng:la1+1+ng, - & fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ie1,ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic2,",",ic0,"] = ", - & array(ie1,ic2,ic0) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacedoub3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi2-ng:la2+1+ng, - & fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ie2,ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do ie2=ibeg2,iend2+1 - write(6,*) "array[",ie2,",",ic0,",",ic1,"] = ", - & array(ie2,ic0,ic1) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi1-ng:la1+1+ng, - & fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ie1,ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic2,",",ic0,"] = ", - & array(ie1,ic2,ic0) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfaceflot3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi2-ng:la2+1+ng, - & fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ie2,ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do ie2=ibeg2,iend2+1 - write(6,*) "array[",ie2,",",ic0,",",ic1,"] = ", - & array(ie2,ic0,ic1) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi1-ng:la1+1+ng, - & fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ie1,ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - do ie1=ibeg1,iend1+1 - write(6,*) "array[",ie1,",",ic2,",",ic0,"] = ", - & array(ie1,ic2,ic0) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugfacecplx3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi2-ng:la2+1+ng, - & fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ie2,ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do ie2=ibeg2,iend2+1 - write(6,*) "array[",ie2,",",ic0,",",ic1,"] = ", - & array(ie2,ic0,ic1) - enddo - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d node-centered data -c*********************************************************************** -c - subroutine dbugnodedoub3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ie1,ie2 -c ============================================================= - - do ie2=ibeg2,iend2+1 - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,",",ie2,"] = ", - & array(ie0,ie1,ie2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugnodeflot3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ie1,ie2 -c ============================================================= - - do ie2=ibeg2,iend2+1 - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,",",ie2,"] = ", - & array(ie0,ie1,ie2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugnodecplx3d( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ie1,ie2 -c ============================================================= - - do ie2=ibeg2,iend2+1 - do ie1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ie1,",",ie2,"] = ", - & array(ie0,ie1,ie2) - enddo - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d outerface data -c*********************************************************************** -c - subroutine dbugoutfacedoub3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacedoub3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacedoub3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfaceflot3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfaceflot3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfaceflot3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacecplx3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacecplx3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi2-ng:la2+ng, - & fi0-ng:la0+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutfacecplx3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d outerside data -c*********************************************************************** -c - subroutine dbugoutsidedoub3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidedoub3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi2-ng:la2+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidedoub3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsideflot3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsideflot3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi2-ng:la2+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsideflot3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidecplx3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - write(6,*) "array[",ic1,",",ic2,"] = ", - & array(ic1,ic2) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidecplx3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi2-ng:la2+ng) - integer ic2,ic0 -c ============================================================= - - do ic0=ibeg0,iend0 - do ic2=ibeg2,iend2 - write(6,*) "array[",ic2,",",ic0,"] = ", - & array(ic2,ic0) - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugoutsidecplx3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng) - integer ic0,ic1 -c ============================================================= - - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - write(6,*) "array[",ic0,",",ic1,"] = ", - & array(ic0,ic1) - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d side-centered data -c*********************************************************************** -c - subroutine dbugsidedoub3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidedoub3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidedoub3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsideflot3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugsidecplx3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c -c -c*********************************************************************** -c Debugging routines for 3d edge-centered data -c*********************************************************************** -c - subroutine dbugedgedoub3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgedoub3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgedoub3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double precision - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgeflot3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - real - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx3d0( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx3d1( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+ng, - & fi2-ng:la2+1+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2+1 - do ic1=ibeg1,iend1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c - subroutine dbugedgecplx3d2( - & fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2,array) -c ============================================================= - implicit none - integer fi0,la0,fi1,la1,fi2,la2,ng, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - double complex - & array(fi0-ng:la0+1+ng, - & fi1-ng:la1+1+ng, - & fi2-ng:la2+ng) - integer ie0,ic1,ic2 -c ============================================================= - - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1+1 - do ie0=ibeg0,iend0+1 - write(6,*) "array[",ie0,",",ic1,",",ic2,"] = ", - & array(ie0,ic1,ic2) - enddo - enddo - enddo - - call flush(6) - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.m4 index 0c8838f4..eb5367ba 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugfort3d.m4 @@ -1,11 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for debugging 3d patch data types. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -include(pdat_dbugstuff3d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for debugging 3d patch data types. +c +include(PDAT_FORTDIR/pdat_dbugstuff3d.i)dnl c c*********************************************************************** c Debugging routines for 3d cell-centered data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff1d.i index 1e900ffa..6d5f1cb2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff1d.i @@ -1,12 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d patchdata debugging routines +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d patchdata debugging routines. +c +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl c define(pdat_debug_subroutine_head_1d,`dnl & fi0,la0,ng,ibeg0,iend0,array) diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff2d.i index 74b1198d..a5b32cd3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff2d.i @@ -1,12 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d patchdata debugging routines +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d patchdata debugging routines. +c +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c define(pdat_debug_subroutine_head_2d,`dnl & fi0,la0,fi1,la1,ng, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff3d.i index a38bf506..f55deafb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_dbugstuff3d.i @@ -1,12 +1,11 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d patchdata debugging routines +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d patchdata debugging routines. +c +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c define(pdat_debug_subroutine_head_3d,`dnl & fi0,la0,fi1,la1,fi2,la2,ng, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.f deleted file mode 100644 index 5bb5d58b..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.f +++ /dev/null @@ -1,895 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 1d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for standard 1d time interpolation operators. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Linear time interpolation for 1d cell-centered double data -c*********************************************************************** -c - subroutine lintimeintcelldoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d cell-centered float data -c*********************************************************************** -c - subroutine lintimeintcellfloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d cell-centered complex data -c*********************************************************************** -c - subroutine lintimeintcellcmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d edge-centered double data -c*********************************************************************** -c - subroutine lintimeintedgedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d edge-centered float data -c*********************************************************************** -c - subroutine lintimeintedgefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d edge-centered complex data -c*********************************************************************** -c - subroutine lintimeintedgecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d face-centered double data -c*********************************************************************** -c - subroutine lintimeintfacedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d face-centered float data -c*********************************************************************** -c - subroutine lintimeintfacefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d face-centered complex data -c*********************************************************************** -c - subroutine lintimeintfacecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d node-centered double data -c*********************************************************************** -c - subroutine lintimeintnodedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d node-centered float data -c*********************************************************************** -c - subroutine lintimeintnodefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d node-centered complex data -c*********************************************************************** -c - subroutine lintimeintnodecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerface double data -c*********************************************************************** -c - subroutine lintimeintoutfacedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerface float data -c*********************************************************************** -c - subroutine lintimeintoutfacefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerface complex data -c*********************************************************************** -c - subroutine lintimeintoutfacecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerside double data -c*********************************************************************** -c - subroutine lintimeintoutsidedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerside float data -c*********************************************************************** -c - subroutine lintimeintoutsidefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d outerside complex data -c*********************************************************************** -c - subroutine lintimeintoutsidecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(1), - & arraynew(1), - & arraydst(1) -c -c*********************************************************************** -c - oldfrac=one-tfrac - - arraydst(1)=arrayold(1)*oldfrac - & +arraynew(1)*tfrac -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d side-centered double data -c*********************************************************************** -c - subroutine lintimeintsidedoub1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d side-centered float data -c*********************************************************************** -c - subroutine lintimeintsidefloat1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 1d side-centered complex data -c*********************************************************************** -c - subroutine lintimeintsidecmplx1d( - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ilast0, - & oilo0,oihi0, - & nilo0,nihi0, - & dilo0,dihi0 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1), - & arraynew(nilo0:nihi0+1), - & arraydst(dilo0:dihi0+1) - integer ie0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie0=ifirst0,ilast0+1 - arraydst(ie0)=arrayold(ie0)*oldfrac - & +arraynew(ie0)*tfrac - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.m4 index 6268e016..1dd69824 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint1d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 1d patch data types. -c -include(pdat_m4lintimeintops1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for standard linear time interpolation +c of 1d patch data types. +c +include(PDAT_FORTDIR/pdat_m4lintimeintops1d.i)dnl c c*********************************************************************** c Linear time interpolation for 1d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.f deleted file mode 100644 index d818d322..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.f +++ /dev/null @@ -1,1603 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 2d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d std linear time interpolation operators. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Linear time interpolation for 2d cell-centered double data -c*********************************************************************** -c - subroutine lintimeintcelldoub2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d cell-centered float data -c*********************************************************************** -c - subroutine lintimeintcellfloat2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d cell-centered complex data -c*********************************************************************** -c - subroutine lintimeintcellcmplx2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d edge-centered double data -c*********************************************************************** -c - subroutine lintimeintedgedoub2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintedgedoub2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d edge-centered float data -c*********************************************************************** -c - subroutine lintimeintedgefloat2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintedgefloat2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d edge-centered complex data -c*********************************************************************** -c - subroutine lintimeintedgecmplx2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintedgecmplx2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d face-centered double data -c*********************************************************************** -c - subroutine lintimeintfacedoub2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1)=arrayold(ie0,ic1)*oldfrac - & +arraynew(ie0,ic1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintfacedoub2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1+1, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo0:dihi0) - integer ie1,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic0)=arrayold(ie1,ic0)*oldfrac - & +arraynew(ie1,ic0)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d face-centered float data -c*********************************************************************** -c - subroutine lintimeintfacefloat2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1)=arrayold(ie0,ic1)*oldfrac - & +arraynew(ie0,ic1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintfacefloat2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1+1, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo0:dihi0) - integer ie1,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic0)=arrayold(ie1,ic0)*oldfrac - & +arraynew(ie1,ic0)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d face-centered complex data -c*********************************************************************** -c - subroutine lintimeintfacecmplx2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1)=arrayold(ie0,ic1)*oldfrac - & +arraynew(ie0,ic1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintfacecmplx2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1+1, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo0:dihi0) - integer ie1,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic0)=arrayold(ie1,ic0)*oldfrac - & +arraynew(ie1,ic0)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d node-centered double data -c*********************************************************************** -c - subroutine lintimeintnodedoub2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d node-centered float data -c*********************************************************************** -c - subroutine lintimeintnodefloat2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d node-centered complex data -c*********************************************************************** -c - subroutine lintimeintnodecmplx2d( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerface double data -c*********************************************************************** -c - subroutine lintimeintoutfacedoub2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutfacedoub2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerface float data -c*********************************************************************** -c - subroutine lintimeintoutfacefloat2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutfacefloat2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerface complex data -c*********************************************************************** -c - subroutine lintimeintoutfacecmplx2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutfacecmplx2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerside double data -c*********************************************************************** -c - subroutine lintimeintoutsidedoub2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutsidedoub2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerside float data -c*********************************************************************** -c - subroutine lintimeintoutsidefloat2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutsidefloat2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d outerside complex data -c*********************************************************************** -c - subroutine lintimeintoutsidecmplx2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1), - & arraynew(nilo1:nihi1), - & arraydst(dilo1:dihi1) - integer ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - arraydst(ic1)=arrayold(ic1)*oldfrac - & +arraynew(ic1)*tfrac - enddo -c - return - end -c - subroutine lintimeintoutsidecmplx2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0), - & arraynew(nilo0:nihi0), - & arraydst(dilo0:dihi0) - integer ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - arraydst(ic0)=arrayold(ic0)*oldfrac - & +arraynew(ic0)*tfrac - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d side-centered double data -c*********************************************************************** -c - subroutine lintimeintsidedoub2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintsidedoub2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d side-centered float data -c*********************************************************************** -c - subroutine lintimeintsidefloat2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintsidefloat2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 2d side-centered complex data -c*********************************************************************** -c - subroutine lintimeintsidecmplx2d0( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+0 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintsidecmplx2d1( - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ilast0,ilast1, - & oilo0,oilo1,oihi0,oihi1, - & nilo0,nilo1,nihi0,nihi1, - & dilo0,dilo1,dihi0,dihi1 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1) - integer ie0,ie1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+0 - arraydst(ie0,ie1)=arrayold(ie0,ie1)*oldfrac - & +arraynew(ie0,ie1)*tfrac - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.m4 index fa8a8dbe..c41217d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint2d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 2d patch data types. -c -include(pdat_m4lintimeintops2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for standard linear time interpolation +c of 2d patch data types. +c +include(PDAT_FORTDIR/pdat_m4lintimeintops2d.i)dnl c c*********************************************************************** c Linear time interpolation for 2d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.f deleted file mode 100644 index aca91186..00000000 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.f +++ /dev/null @@ -1,2507 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI gerometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 3d patch data types. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d std linear time interpolation operators. -c -c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c -c -c -c -c -c -c -c -c -c*********************************************************************** -c Linear time interpolation for 3d cell-centered double data -c*********************************************************************** -c - subroutine lintimeintcelldoub3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2) - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1,ic2)= - & +arrayold(ic0,ic1,ic2)*oldfrac - & +arraynew(ic0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d cell-centered float data -c*********************************************************************** -c - subroutine lintimeintcellfloat3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2) - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1,ic2)= - & +arrayold(ic0,ic1,ic2)*oldfrac - & +arraynew(ic0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d cell-centered complex data -c*********************************************************************** -c - subroutine lintimeintcellcmplx3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2) - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1,ic2)= - & +arrayold(ic0,ic1,ic2)*oldfrac - & +arraynew(ic0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d edge-centered double data -c*********************************************************************** -c - subroutine lintimeintedgedoub3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgedoub3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgedoub3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d edge-centered float data -c*********************************************************************** -c - subroutine lintimeintedgefloat3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgefloat3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgefloat3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d edge-centered complex data -c*********************************************************************** -c - subroutine lintimeintedgecmplx3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgecmplx3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintedgecmplx3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d face-centered double data -c*********************************************************************** -c - subroutine lintimeintfacedoub3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1,ic2)= - & +arrayold(ie0,ic1,ic2)*oldfrac - & +arraynew(ie0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacedoub3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1+1, - & oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo2:dihi2, - & dilo0:dihi0) - integer ie1,ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic2,ic0)= - & +arrayold(ie1,ic2,ic0)*oldfrac - & +arraynew(ie1,ic2,ic0)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacedoub3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo2:oihi2+1, - & oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo2:nihi2+1, - & nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo2:dihi2+1, - & dilo0:dihi0, - & dilo1:dihi1) - integer ie2,ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - do ie2=ifirst2,ilast2+1 - arraydst(ie2,ic0,ic1)= - & +arrayold(ie2,ic0,ic1)*oldfrac - & +arraynew(ie2,ic0,ic1)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d face-centered float data -c*********************************************************************** -c - subroutine lintimeintfacefloat3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1,ic2)= - & +arrayold(ie0,ic1,ic2)*oldfrac - & +arraynew(ie0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacefloat3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1+1, - & oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo2:dihi2, - & dilo0:dihi0) - integer ie1,ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic2,ic0)= - & +arrayold(ie1,ic2,ic0)*oldfrac - & +arraynew(ie1,ic2,ic0)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacefloat3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo2:oihi2+1, - & oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo2:nihi2+1, - & nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo2:dihi2+1, - & dilo0:dihi0, - & dilo1:dihi1) - integer ie2,ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - do ie2=ifirst2,ilast2+1 - arraydst(ie2,ic0,ic1)= - & +arrayold(ie2,ic0,ic1)*oldfrac - & +arraynew(ie2,ic0,ic1)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d face-centered complex data -c*********************************************************************** -c - subroutine lintimeintfacecmplx3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ic1,ic2)= - & +arrayold(ie0,ic1,ic2)*oldfrac - & +arraynew(ie0,ic1,ic2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacecmplx3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1+1, - & oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo1:nihi1+1, - & nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo1:dihi1+1, - & dilo2:dihi2, - & dilo0:dihi0) - integer ie1,ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - arraydst(ie1,ic2,ic0)= - & +arrayold(ie1,ic2,ic0)*oldfrac - & +arraynew(ie1,ic2,ic0)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintfacecmplx3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo2:oihi2+1, - & oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo2:nihi2+1, - & nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo2:dihi2+1, - & dilo0:dihi0, - & dilo1:dihi1) - integer ie2,ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - do ie2=ifirst2,ilast2+1 - arraydst(ie2,ic0,ic1)= - & +arrayold(ie2,ic0,ic1)*oldfrac - & +arraynew(ie2,ic0,ic1)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d node-centered double data -c*********************************************************************** -c - subroutine lintimeintnodedoub3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d node-centered float data -c*********************************************************************** -c - subroutine lintimeintnodefloat3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d node-centered complex data -c*********************************************************************** -c - subroutine lintimeintnodecmplx3d( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1+1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1+1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1+1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerface double data -c*********************************************************************** -c - subroutine lintimeintoutfacedoub3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacedoub3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo2:dihi2, - & dilo0:dihi0) - integer ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - arraydst(ic2,ic0)=arrayold(ic2,ic0)*oldfrac - & +arraynew(ic2,ic0)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacedoub3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerface float data -c*********************************************************************** -c - subroutine lintimeintoutfacefloat3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacefloat3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo2:dihi2, - & dilo0:dihi0) - integer ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - arraydst(ic2,ic0)=arrayold(ic2,ic0)*oldfrac - & +arraynew(ic2,ic0)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacefloat3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerface complex data -c*********************************************************************** -c - subroutine lintimeintoutfacecmplx3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacecmplx3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo2:oihi2, - & oilo0:oihi0), - & arraynew(nilo2:nihi2, - & nilo0:nihi0), - & arraydst(dilo2:dihi2, - & dilo0:dihi0) - integer ic2,ic0 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic0=ifirst0,ilast0 - do ic2=ifirst2,ilast2 - arraydst(ic2,ic0)=arrayold(ic2,ic0)*oldfrac - & +arraynew(ic2,ic0)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutfacecmplx3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerside double data -c*********************************************************************** -c - subroutine lintimeintoutsidedoub3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidedoub3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo2:dihi2) - integer ic0,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic2)=arrayold(ic0,ic2)*oldfrac - & +arraynew(ic0,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidedoub3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerside float data -c*********************************************************************** -c - subroutine lintimeintoutsidefloat3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidefloat3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo2:dihi2) - integer ic0,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic2)=arrayold(ic0,ic2)*oldfrac - & +arraynew(ic0,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidefloat3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d outerside complex data -c*********************************************************************** -c - subroutine lintimeintoutsidecmplx3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo1:dihi1, - & dilo2:dihi2) - integer ic1,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - arraydst(ic1,ic2)=arrayold(ic1,ic2)*oldfrac - & +arraynew(ic1,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidecmplx3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo2:dihi2) - integer ic0,ic2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic2=ifirst2,ilast2 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic2)=arrayold(ic0,ic2)*oldfrac - & +arraynew(ic0,ic2)*tfrac - enddo - enddo -c - return - end -c - subroutine lintimeintoutsidecmplx3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1) - integer ic0,ic1 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - arraydst(ic0,ic1)=arrayold(ic0,ic1)*oldfrac - & +arraynew(ic0,ic1)*tfrac - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d side-centered double data -c*********************************************************************** -c - subroutine lintimeintsidedoub3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidedoub3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidedoub3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double precision - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d side-centered float data -c*********************************************************************** -c - subroutine lintimeintsidefloat3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidefloat3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidefloat3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - real - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c Linear time interpolation for 3d side-centered complex data -c*********************************************************************** -c - subroutine lintimeintsidecmplx3d0( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0+1, - & oilo1:oihi1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0+1, - & nilo1:nihi1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0+1, - & dilo1:dihi1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidecmplx3d1( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1+1, - & oilo2:oihi2), - & arraynew(nilo0:nihi0, - & nilo1:nihi1+1, - & nilo2:nihi2), - & arraydst(dilo0:dihi0, - & dilo1:dihi1+1, - & dilo2:dihi2) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2 - do ie1=ifirst1,ilast1+1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c - subroutine lintimeintsidecmplx3d2( - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2, - & tfrac, - & arrayold,arraynew, - & arraydst) -c*********************************************************************** - implicit none - double precision one - parameter (one=1.d0) -c - integer - & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, - & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, - & nilo0,nilo1,nilo2,nihi0,nihi1,nihi2, - & dilo0,dilo1,dilo2,dihi0,dihi1,dihi2 - double precision - & tfrac, oldfrac - double complex - & arrayold(oilo0:oihi0, - & oilo1:oihi1, - & oilo2:oihi2+1), - & arraynew(nilo0:nihi0, - & nilo1:nihi1, - & nilo2:nihi2+1), - & arraydst(dilo0:dihi0, - & dilo1:dihi1, - & dilo2:dihi2+1) - integer ie0,ie1,ie2 -c -c*********************************************************************** -c - oldfrac=one-tfrac - - do ie2=ifirst2,ilast2+1 - do ie1=ifirst1,ilast1 - do ie0=ifirst0,ilast0 - arraydst(ie0,ie1,ie2)= - & +arrayold(ie0,ie1,ie2)*oldfrac - & +arraynew(ie0,ie1,ie2)*tfrac - enddo - enddo - enddo -c - return - end -c diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.m4 b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.m4 index c20c1e89..abbaba70 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.m4 +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_lintimint3d.m4 @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI gerometry -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: FORTRAN routines for standard linear time interpolation -c of 3d patch data types. -c -include(pdat_m4lintimeintops3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for standard linear time interpolation +c of 3d patch data types. +c +include(PDAT_FORTDIR/pdat_m4lintimeintops3d.i)dnl c c*********************************************************************** c Linear time interpolation for 3d cell-centered double data diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i index 603fb635..396d01c4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for dimensioning 1d arrays in FORTRAN routines. c define(SAMRAICELL1d,`$1$4-$3:$2$4+$3')dnl define(SAMRAICELL1d0G,`$1$3:$2$3')dnl diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i index 79d82628..d70a03da 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for dimensioning 2d arrays in FORTRAN routines. c define(SAMRAICELL2d,`$1$4-$3:$2$4+$3, & $1$5-$3:$2$5+$3')dnl diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i index 2a8de536..9716b243 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. c define(SAMRAICELL3d,`$1$4-$3:$2$4+$3, & $1$5-$3:$2$5+$3, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim4d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim4d.i new file mode 100644 index 00000000..96822137 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4arrdim4d.i @@ -0,0 +1,203 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for dimensioning 4d arrays in FORTRAN routines. +c +define(SAMRAICELL4d,`$1$4-$3:$2$4+$3, + & $1$5-$3:$2$5+$3, + & $1$6-$3:$2$6+$3, + & $1$7-$3:$2$7+$3')dnl +define(SAMRAICELL4d0G,`$1$3:$2$3, + & $1$4:$2$4, + & $1$5:$2$5, + & $1$6:$2$6')dnl +define(SAMRAICELL4dVECG,`$1$4-$3$4:$2$4+$3$4, + & $1$5-$3$5:$2$5+$3$5, + & $1$6-$3$6:$2$6+$3$6, + & $1$7-$3$7:$2$7+$3$7')dnl +define(SAMRAIEDGE4d0,`$1`0'-$3:$2`0'+$3, + & $1`1'-$3:$2`1'+1+$3, + & $1`2'-$3:$2`2'+1+$3, + & $1`3'-$3:$2`3'+1+$3')dnl +define(SAMRAIEDGE4d1,`$1`0'-$3:$2`0'+1+$3, + & $1`1'-$3:$2`1'+$3, + & $1`2'-$3:$2`2'+1+$3, + & $1`3'-$3:$2`3'+1+$3')dnl +define(SAMRAIEDGE4d2,`$1`0'-$3:$2`0'+1+$3, + & $1`1'-$3:$2`1'+1+$3, + & $1`2'-$3:$2`2'+$3, + & $1`3'-$3:$2`3'+1+$3')dnl +define(SAMRAIEDGE4d3,`$1`0'-$3:$2`0'+1+$3, + & $1`1'-$3:$2`1'+1+$3, + & $1`2'-$3:$2`2'+1+$3, + & $1`3'-$3:$2`3'+$3')dnl +define(SAMRAIEDGE4d0G0,`$1`0':$2`0', + & $1`1':$2`1'+1, + & $1`2':$2`2'+1, + & $1`3':$2`3'+1')dnl +define(SAMRAIEDGE4d0G1,`$1`0':$2`0'+1, + & $1`1':$2`1', + & $1`2':$2`2'+1, + & $1`3':$2`3'+1')dnl +define(SAMRAIEDGE4d0G2,`$1`0':$2`0'+1, + & $1`1':$2`1'+1, + & $1`2':$2`2', + & $1`3':$2`3'+1')dnl +define(SAMRAIEDGE4d0G3,`$1`0':$2`0'+1, + & $1`1':$2`1'+1, + & $1`2':$2`2'+1, + & $1`3':$2`3'')dnl +define(SAMRAIEDGE4d0VECG,`$1`0'-$3`0':$2`0'+$3`0', + & $1`1'-$3`1':$2`1'+1+$3`1', + & $1`2'-$3`2':$2`2'+1+$3`2', + & $1`3'-$3`3':$2`3'+1+$3`3'')dnl +define(SAMRAIEDGE4d1VECG,`$1`0'-$3`0':$2`0'+1+$3`0', + & $1`1'-$3`1':$2`1'+$3`1', + & $1`2'-$3`2':$2`2'+1+$3`2', + & $1`3'-$3`3':$2`3'+1+$3`3'')dnl +define(SAMRAIEDGE4d2VECG,`$1`0'-$3`0':$2`0'+1+$3`0', + & $1`1'-$3`1':$2`1'+1+$3`1', + & $1`2'-$3`2':$2`2'+$3`2', + & $1`3'-$3`3':$2`3'+1+$3`3'')dnl +define(SAMRAIEDGE4d3VECG,`$1`0'-$3`0':$2`0'+1+$3`0', + & $1`1'-$3`1':$2`1'+1+$3`1', + & $1`2'-$3`2':$2`2'+1+$3`2', + & $1`3'-$3`3':$2`3'+$3`3'')dnl +define(SAMRAIFACE4d,`$1$4-$3:$2$4+1+$3, + & $1$5-$3:$2$5+$3, + & $1$6-$3:$2$6+$3, + & $1$7-$3:$2$7+$3')dnl +define(SAMRAIFACE4d0G,`$1$3:$2$3+1, + & $1$4:$2$4, + & $1$5:$2$5, + & $1$6:$2$6')dnl +define(SAMRAIFACE4dVECG,`$1$4-$3$4:$2$4+1+$3$4, + & $1$5-$3$5:$2$5+$3$5, + & $1$6-$3$6:$2$6+$3$6, + & $1$7-$3$7:$2$7+$3$7')dnl +define(SAMRAINODE4d,`$1$4-$3:$2$4+1+$3, + & $1$5-$3:$2$5+1+$3, + & $1$6-$3:$2$6+1+$3, + & $1$7-$3:$2$7+1+$3')dnl +define(SAMRAINODE4d0G,`$1$3:$2$3+1, + & $1$4:$2$4+1, + & $1$5:$2$5+1, + & $1$6:$2$6+1')dnl +define(SAMRAINODE4dVECG,`$1$4-$3$4:$2$4+1+$3$4, + & $1$5-$3$5:$2$5+1+$3$5, + & $1$6-$3$6:$2$6+1+$3$6, + & $1$7-$3$7:$2$7+1+$3$7')dnl +define(SAMRAIOUTERFACE4d,`$1$4-$3:$2$4+$3, + & $1$5-$3:$2$5+$3, + & $1$6-$3:$2$6+$3')dnl +define(SAMRAIOUTERFACE4d0G,`$1$3:$2$3, + & $1$4:$2$4, + & $1$5:$2$5')dnl +define(SAMRAIOUTERSIDE4d,`$1$4-$3:$2$4+$3, + & $1$5-$3:$2$5+$3, + & $1$6-$3:$2$6+$3')dnl +define(SAMRAIOUTERSIDE4d0G,`$1$3:$2$3, + & $1$4:$2$4, + & $1$5:$2$5')dnl +define(SAMRAIOUTERNODE4d0G,`$1$3+1:$2$3, + & $1$4+1:$2$4, + & $1$5+1:$2$5')dnl +define(SAMRAIOUTERNODE4d1G,`$1$3:$2$3+1, + & $1$4+1:$2$4, + & $1$5+1:$2$5')dnl +define(SAMRAIOUTERNODE4d2G,`$1$3:$2$3+1, + & $1$4:$2$4+1, + & $1$5:$2$5+1')dnl +define(SAMRAIOUTERNODE4d3G,`$1$3:$2$3+1, + & $1$4:$2$4+1, + & $1$5:$2$5+1')dnl +define(SAMRAISIDE4d0,`$1`0'-$3:$2`0'+1+$3, + & $1`1'-$3:$2`1'+$3, + & $1`2'-$3:$2`2'+$3, + & $1`3'-$3:$2`3'+$3')dnl +define(SAMRAISIDE4d1,`$1`0'-$3:$2`0'+$3, + & $1`1'-$3:$2`1'+1+$3, + & $1`2'-$3:$2`2'+$3, + & $1`3'-$3:$2`3'+$3')dnl +define(SAMRAISIDE4d2,`$1`0'-$3:$2`0'+$3, + & $1`1'-$3:$2`1'+$3, + & $1`2'-$3:$2`2'+1+$3, + & $1`3'-$3:$2`3'+$3')dnl +define(SAMRAISIDE4d3,`$1`0'-$3:$2`0'+$3, + & $1`1'-$3:$2`1'+$3, + & $1`2'-$3:$2`2'+$3, + & $1`3'-$3:$2`3'+1+$3')dnl +define(SAMRAISIDE4d0G0,`$1`0':$2`0'+1, + & $1`1':$2`1', + & $1`2':$2`2', + & $1`3':$2`3'')dnl +define(SAMRAISIDE4d0G1,`$1`0':$2`0', + & $1`1':$2`1'+1, + & $1`2':$2`2', + & $1`3':$2`3'')dnl +define(SAMRAISIDE4d0G2,`$1`0':$2`0', + & $1`1':$2`1', + & $1`2':$2`2'+1, + & $1`3':$2`3'')dnl +define(SAMRAISIDE4d0G3,`$1`0':$2`0', + & $1`1':$2`1', + & $1`2':$2`2', + & $1`3':$2`3'+1')dnl +define(SAMRAISIDE4d0VECG,`$1`0'-$3`0':$2`0'+1+$3`0', + & $1`1'-$3`1':$2`1'+$3`1', + & $1`2'-$3`2':$2`2'+$3`2', + & $1`3'-$3`3':$2`3'+$3`3'')dnl +define(SAMRAISIDE4d1VECG,`$1`0'-$3`0':$2`0'+$3`0', + & $1`1'-$3`1':$2`1'+1+$3`1', + & $1`2'-$3`2':$2`2'+$3`2', + & $1`3'-$3`3':$2`3'+$3`3'')dnl +define(SAMRAISIDE4d2VECG,`$1`0'-$3`0':$2`0'+$3`0', + & $1`1'-$3`1':$2`1'+$3`1', + & $1`2'-$3`2':$2`2'+1+$3`2', + & $1`3'-$3`3':$2`3'+$3`3'')dnl +define(SAMRAISIDE4d3VECG,`$1`0'-$3`0':$2`0'+$3`0', + & $1`1'-$3`1':$2`1'+$3`1', + & $1`2'-$3`2':$2`2'+$3`2', + & $1`3'-$3`3':$2`3'+1+$3`3'')dnl +define(CELL4d,`ifelse($3,`0',`SAMRAICELL4d0G($1,$2,0,1,2,3)',`SAMRAICELL4d($1,$2,$3,0,1,2,3)')')dnl +define(EDGE4d0,`ifelse($3,`0',`SAMRAIEDGE4d0G0($1,$2)',`SAMRAIEDGE4d0($1,$2,$3)')')dnl +define(EDGE4d1,`ifelse($3,`0',`SAMRAIEDGE4d0G1($1,$2)',`SAMRAIEDGE4d1($1,$2,$3)')')dnl +define(EDGE4d2,`ifelse($3,`0',`SAMRAIEDGE4d0G2($1,$2)',`SAMRAIEDGE4d2($1,$2,$3)')')dnl +define(EDGE4d3,`ifelse($3,`0',`SAMRAIEDGE4d0G3($1,$2)',`SAMRAIEDGE4d3($1,$2,$3)')')dnl +define(FACE4d0,`ifelse($3,`0',`SAMRAIFACE4d0G($1,$2,0,1,2,3)',`SAMRAIFACE4d($1,$2,$3,0,1,2,3)')')dnl +define(FACE4d1,`ifelse($3,`0',`SAMRAIFACE4d0G($1,$2,1,2,3,0)',`SAMRAIFACE4d($1,$2,$3,1,2,3,0)')')dnl +define(FACE4d2,`ifelse($3,`0',`SAMRAIFACE4d0G($1,$2,2,3,0,1)',`SAMRAIFACE4d($1,$2,$3,2,3,0,1)')')dnl +define(FACE4d3,`ifelse($3,`0',`SAMRAIFACE4d0G($1,$2,3,0,1,2)',`SAMRAIFACE4d($1,$2,$3,3,0,1,2)')')dnl +define(NODE4d,`ifelse($3,`0',`SAMRAINODE4d0G($1,$2,0,1,2,3)',`SAMRAINODE4d($1,$2,$3,0,1,2,3)')')dnl +define(OUTERFACE4d0,`ifelse($3,`0',`SAMRAIOUTERFACE4d0G($1,$2,1,2,3)',`SAMRAIOUTERFACE4d($1,$2,$3,1,2,3)')')dnl +define(OUTERFACE4d1,`ifelse($3,`0',`SAMRAIOUTERFACE4d0G($1,$2,2,3,0)',`SAMRAIOUTERFACE4d($1,$2,$3,2,3,0)')')dnl +define(OUTERFACE4d2,`ifelse($3,`0',`SAMRAIOUTERFACE4d0G($1,$2,3,0,1)',`SAMRAIOUTERFACE4d($1,$2,$3,3,0,1)')')dnl +define(OUTERFACE4d3,`ifelse($3,`0',`SAMRAIOUTERFACE4d0G($1,$2,0,1,2)',`SAMRAIOUTERFACE4d($1,$2,$3,0,1,2)')')dnl +define(OUTERSIDE4d0,`ifelse($3,`0',`SAMRAIOUTERSIDE4d0G($1,$2,1,2,3)',`SAMRAIOUTERSIDE4d($1,$2,$3,1,2,3)')')dnl +define(OUTERSIDE4d1,`ifelse($3,`0',`SAMRAIOUTERSIDE4d0G($1,$2,0,2,3)',`SAMRAIOUTERSIDE4d($1,$2,$3,0,2,3)')')dnl +define(OUTERSIDE4d2,`ifelse($3,`0',`SAMRAIOUTERSIDE4d0G($1,$2,0,1,3)',`SAMRAIOUTERSIDE4d($1,$2,$3,0,1,3)')')dnl +define(OUTERSIDE4d3,`ifelse($3,`0',`SAMRAIOUTERSIDE4d0G($1,$2,0,1,2)',`SAMRAIOUTERSIDE4d($1,$2,$3,0,1,2)')')dnl +define(OUTERNODE4d0,`SAMRAIOUTERNODE4d0G($1,$2,1,2,3)')dnl +define(OUTERNODE4d1,`SAMRAIOUTERNODE4d1G($1,$2,0,2,3)')dnl +define(OUTERNODE4d2,`SAMRAIOUTERNODE4d2G($1,$2,0,1,3)')dnl +define(OUTERNODE4d3,`SAMRAIOUTERNODE4d3G($1,$2,0,1,2)')dnl +define(SIDE4d0,`ifelse($3,`0',`SAMRAISIDE4d0G0($1,$2)',`SAMRAISIDE4d0($1,$2,$3)')')dnl +define(SIDE4d1,`ifelse($3,`0',`SAMRAISIDE4d0G1($1,$2)',`SAMRAISIDE4d1($1,$2,$3)')')dnl +define(SIDE4d2,`ifelse($3,`0',`SAMRAISIDE4d0G2($1,$2)',`SAMRAISIDE4d2($1,$2,$3)')')dnl +define(SIDE4d3,`ifelse($3,`0',`SAMRAISIDE4d0G3($1,$2)',`SAMRAISIDE4d3($1,$2,$3)')')dnl +define(CELL4dVECG,`SAMRAICELL4dVECG($1,$2,$3,0,1,2,3)')dnl +define(EDGE4d0VECG,`SAMRAIEDGE4d0VECG($1,$2,$3)')dnl +define(EDGE4d1VECG,`SAMRAIEDGE4d1VECG($1,$2,$3)')dnl +define(EDGE4d2VECG,`SAMRAIEDGE4d2VECG($1,$2,$3)')dnl +define(EDGE4d3VECG,`SAMRAIEDGE4d3VECG($1,$2,$3)')dnl +define(FACE4d0VECG,`SAMRAIFACE4dVECG($1,$2,$3,0,1,2,3)')dnl +define(FACE4d1VECG,`SAMRAIFACE4dVECG($1,$2,$3,1,2,3,0)')dnl +define(FACE4d2VECG,`SAMRAIFACE4dVECG($1,$2,$3,2,3,0,1)')dnl +define(FACE4d3VECG,`SAMRAIFACE4dVECG($1,$2,$3,3,0,1,2)')dnl +define(NODE4dVECG,`SAMRAINODE4dVECG($1,$2,$3,0,1,2,3)')dnl +define(SIDE4d0VECG,`SAMRAISIDE4d0VECG($1,$2,$3)')dnl +define(SIDE4d1VECG,`SAMRAISIDE4d1VECG($1,$2,$3)')dnl +define(SIDE4d2VECG,`SAMRAISIDE4d2VECG($1,$2,$3)')dnl +define(SIDE4d3VECG,`SAMRAISIDE4d3VECG($1,$2,$3)')dnl diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops1d.i index 11a7e931..669f0e8a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops1d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d constant coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d constant coarsen operators. c define(NDIM,1)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl define(con_coarsen_op_subroutine_head_1d,`dnl & ifirstc0,ilastc0, & filo0,fihi0, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops2d.i index 258d827d..b8953013 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops2d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d Cartesian coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d constant coarsen operators. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl define(con_coarsen_op_subroutine_head_2d,`dnl & ifirstc0,ifirstc1,ilastc0,ilastc1, & filo0,filo1,fihi0,fihi1, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops3d.i index 8f831937..dca34198 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4concoarsenops3d.i @@ -1,13 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian coarsen operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d constant coarsen operators. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl define(con_coarsen_op_subroutine_head_3d,`dnl & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, & filo0,filo1,filo2,fihi0,fihi1,fihi2, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conopstuff.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conopstuff.i index 7bbb1282..72f94412 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conopstuff.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conopstuff.i @@ -1,9 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for constant patchdata transfer routines. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for constant patchdata transfer routines. c define(coarsen_index,`dnl if ($1.lt.0) then diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops1d.i index 30eeb83a..e8b4a176 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops1d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 1d Cartesian refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d constant refine operators. c define(NDIM,1)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl -include(pdat_m4conopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4conopstuff.i)dnl c define(con_refine_op_subroutine_head_1d,`dnl & ifirstc0,ilastc0, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops2d.i index 9bacf7e1..994e1349 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops2d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d constant refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d constant refine operators. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(pdat_m4conopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4conopstuff.i)dnl c define(con_refine_op_subroutine_head_2d,`dnl & ifirstc0,ifirstc1,ilastc0,ilastc1, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops3d.i index 2f5aad61..5309c631 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4conrefineops3d.i @@ -1,14 +1,13 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d Cartesian refine operators +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d constant refine operators. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(pdat_m4conopstuff.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4conopstuff.i)dnl c define(con_refine_op_subroutine_head_3d,`dnl & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops1d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops1d.i index 9ae08036..af79e6a3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops1d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops1d.i @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for standard 1d time interpolation operators. -c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 1d standard linear time interpolation +c operators. +c +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl define(lin_time_int_subroutine_head_1d,`dnl & ifirst0,ilast0, & oilo0,oihi0, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops2d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops2d.i index 6c34c201..115f809c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops2d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops2d.i @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 2d std linear time interpolation operators. -c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d standard linear time interpolation +c operators. +c +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl define(lin_time_int_subroutine_head_2d,`dnl & ifirst0,ifirst1,ilast0,ilast1, & oilo0,oilo1,oihi0,oihi1, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops3d.i b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops3d.i index 7744aa77..e9755133 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops3d.i +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/pdat/fortran/pdat_m4lintimeintops3d.i @@ -1,12 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for 3d std linear time interpolation operators. -c -define(SAMRAI_FORTDIR,../../pdat/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d standard linear time interpolation +c operators. +c +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl define(lin_time_int_subroutine_head_3d,`dnl & ifirst0,ifirst1,ifirst2,ilast0,ilast1,ilast2, & oilo0,oilo1,oilo2,oihi0,oihi1,oihi2, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.C index eadb27dc..3f706325 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: C++ Wrapper class for CVODE solver package * ************************************************************************/ @@ -30,13 +30,13 @@ CVODESolver::CVODESolver( const bool uses_preconditioner) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(!(my_functions == (CVODEAbstractFunctions *)NULL)); + TBOX_ASSERT(!(my_functions == 0)); d_object_name = object_name; d_cvode_functions = my_functions; d_uses_preconditioner = uses_preconditioner; - d_solution_vector = (SundialsAbstractVector *)NULL; + d_solution_vector = 0; /* * Set default parameters to safe values or to CVODE/CVSpgmr defaults. @@ -45,8 +45,8 @@ CVODESolver::CVODESolver( /* * CVODE memory record and log file. */ - d_cvode_mem = NULL; - d_cvode_log_file = NULL; + d_cvode_mem = 0; + d_cvode_log_file = 0; d_cvode_log_file_name = "cvode.log"; /* @@ -55,7 +55,7 @@ CVODESolver::CVODESolver( d_t_0 = 0.0; d_user_t_f = 0.0; d_actual_t_f = 0.0; - d_ic_vector = ((SundialsAbstractVector *)NULL); + d_ic_vector = 0; /* * ODE integration parameters. @@ -66,7 +66,7 @@ CVODESolver::CVODESolver( setToleranceType(CV_SS); setRelativeTolerance(0.0); setAbsoluteTolerance(0.0); - d_absolute_tolerance_vector = (SundialsAbstractVector *)NULL; + d_absolute_tolerance_vector = 0; setSteppingMethod(CV_NORMAL); d_max_order = -1; @@ -113,7 +113,7 @@ CVODESolver::~CVODESolver() void CVODESolver::initializeCVODE() { - TBOX_ASSERT(!(d_solution_vector == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(!(d_solution_vector == 0)); // Disable Intel warning on real comparison #ifdef __INTEL_COMPILER @@ -211,8 +211,8 @@ CVODESolver::initializeCVODE() /* * Setup CVSpgmr function pointers. */ - CVSpilsPrecSetupFn precond_set = NULL; - CVSpilsPrecSolveFn precond_solve = NULL; + CVSpilsPrecSetupFn precond_set = 0; + CVSpilsPrecSolveFn precond_solve = 0; if (d_uses_preconditioner) { precond_set = CVODESolver::CVSpgmrPrecondSet; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.h index 7b0b5b7e..876afa70 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CVODESolver.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Wrapper class for CVODE solver function calls and data * ************************************************************************/ @@ -270,8 +270,8 @@ class CVODESolver initialize( SundialsAbstractVector* solution) { - TBOX_ASSERT(!(solution == (SundialsAbstractVector *)NULL)); - TBOX_ASSERT(d_solution_vector == (SundialsAbstractVector *)NULL); + TBOX_ASSERT(!(solution == 0)); + TBOX_ASSERT(d_solution_vector == 0); d_solution_vector = solution; d_CVODE_needs_initialization = true; initializeCVODE(); @@ -391,9 +391,12 @@ class CVODESolver setLogFileData( const std::string& log_fname = std::string()) { - TBOX_ASSERT(!log_fname.empty()); if (!(log_fname == d_cvode_log_file_name)) { - d_cvode_log_file_name = log_fname; + if (log_fname.empty()) { + d_cvode_log_file_name = "cvode.log"; + } else { + d_cvode_log_file_name = log_fname; + } d_CVODE_needs_initialization = true; } } @@ -423,7 +426,7 @@ class CVODESolver CVODEAbstractFunctions* my_functions, const bool uses_preconditioner) { - TBOX_ASSERT(!(my_functions == (CVODEAbstractFunctions *)NULL)); + TBOX_ASSERT(!(my_functions == 0)); d_cvode_functions = my_functions; d_uses_preconditioner = uses_preconditioner; d_CVODE_needs_initialization = true; @@ -623,7 +626,7 @@ class CVODESolver setAbsoluteTolerance( SundialsAbstractVector* absolute_tolerance) { - TBOX_ASSERT(!(absolute_tolerance == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(!(absolute_tolerance == 0)); TBOX_ASSERT(absolute_tolerance->vecMin() >= 0.0); d_absolute_tolerance_vector = absolute_tolerance; d_use_scalar_absolute_tolerance = false; @@ -712,7 +715,7 @@ class CVODESolver setInitialConditionVector( SundialsAbstractVector* ic_vector) { - TBOX_ASSERT(!(ic_vector == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(!(ic_vector == 0)); d_ic_vector = ic_vector; d_CVODE_needs_initialization = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.C index d4c127a3..f8c313fc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.C @@ -3,19 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition support on cartesian grids. * ************************************************************************/ -#ifndef included_solv_CartesianRobinBcHelper_C -#define included_solv_CartesianRobinBcHelper_C - #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/math/PatchCellDataOpsReal.h" #include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" @@ -25,7 +21,8 @@ #include "SAMRAI/solv/CartesianRobinBcHelper.h" -#include +#include "boost/make_shared.hpp" +#include extern "C" { @@ -33,7 +30,7 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( +void SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -44,12 +41,12 @@ void F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( const int& jbeg, const int& jend, const int& face, const int& ghos, const int& inte, const int& location, const double& h, const int& zerog); -void F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) ( +void SAMRAI_F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, const int* lower, const int* upper, const int& location); -void F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( +void SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -63,13 +60,13 @@ void F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( const int& kbeg, const int& kend, const int& face, const int& ghos, const int& inte, const int& location, const double& h, const int& zerog); -void F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) ( +void SAMRAI_F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, const int& dkfirst, const int& dklast, const int* lower, const int* upper, const int& location); -void F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) ( +void SAMRAI_F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -92,10 +89,10 @@ CartesianRobinBcHelper::CartesianRobinBcHelper( const tbox::Dimension& dim, std::string object_name, RobinBcCoefStrategy* coef_strategy): - xfer::RefinePatchStrategy(dim), - d_dim(dim), + xfer::RefinePatchStrategy(), d_object_name(object_name), - d_coef_strategy(NULL), + d_dim(dim), + d_coef_strategy(0), d_target_data_id(-1), d_homogeneous_bc(false) { @@ -132,10 +129,12 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( int target_data_id, bool homogeneous_bc) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, patch, ghost_width_to_fill); + TBOX_ASSERT_OBJDIM_EQUALITY2(patch, ghost_width_to_fill); NULL_USE(fill_time); + const tbox::Dimension& dim(patch.getDim()); + t_set_boundary_values_in_cells->start(); #ifdef DEBUG_CHECK_ASSERTIONS @@ -145,7 +144,7 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( } #endif - if (d_dim == tbox::Dimension(1)) { + if (patch.getDim() == tbox::Dimension(1)) { TBOX_ERROR(d_object_name << ": dim = 1 not supported"); } math::PatchCellDataOpsReal cops; @@ -153,46 +152,35 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( /* * Get info on the data. */ - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); + hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); boost::shared_ptr variable_ptr; vdb->mapIndexToVariable(target_data_id, variable_ptr); - boost::shared_ptr > cell_variable_ptr( - variable_ptr, - boost::detail::dynamic_cast_tag()); if (!variable_ptr) { TBOX_ERROR(d_object_name << ": No variable for index " << target_data_id); } - if (!cell_variable_ptr) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << target_data_id - << " does not correspond to\n" - << "a cell-centered double variable.\n"); - } + boost::shared_ptr > cell_variable_ptr( + BOOST_CAST, hier::Variable>(variable_ptr)); + TBOX_ASSERT(cell_variable_ptr); /* * Get the data. */ boost::shared_ptr data_ptr( patch.getPatchData(target_data_id)); - boost::shared_ptr > cell_data_ptr( - data_ptr, - boost::detail::dynamic_cast_tag()); if (!data_ptr) { TBOX_ERROR(d_object_name << ": No data for index " << target_data_id); } - if (!cell_data_ptr) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << target_data_id - << " does not correspond to\n" - << "cell-centered double data.\n"); - } + boost::shared_ptr > cell_data_ptr( + BOOST_CAST, hier::PatchData>(data_ptr)); + TBOX_ASSERT(cell_data_ptr); pdat::CellData& data = *cell_data_ptr; const hier::IntVector& ghost_cells = cell_data_ptr->getGhostCellWidth(); hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, ghost_width_to_fill); - if (!(gcw_to_fill == hier::IntVector::getZero(d_dim))) { + if (!(gcw_to_fill == hier::IntVector::getZero(dim))) { /* * Given a and g in a*u + (1-a)*un = g, * where un is the derivative in the outward normal direction, @@ -211,13 +199,15 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( * They are kept her for debugging. */ boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(pg); - const tbox::Array& codim1_boxes = + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); - const int n_codim1_boxes = codim1_boxes.getSize(); + const int n_codim1_boxes = static_cast(codim1_boxes.size()); const hier::Box& ghost_box = data.getGhostBox(); const double* h = pg->getDx(); @@ -245,8 +235,8 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( boost::make_shared >(coefbox, 1)); boost::shared_ptr > bcoef_data( boost::make_shared >(coefbox, 1)); - boost::shared_ptr >gcoef_data( - homogeneous_bc ? NULL : + boost::shared_ptr > gcoef_data( + homogeneous_bc ? 0 : new pdat::ArrayData(coefbox, 1)); t_use_set_bc_coefs->start(); d_coef_strategy->setBcCoefs(acoef_data, @@ -275,12 +265,12 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iint = igho + 1; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], igho, igho, jbeg, jend, @@ -295,12 +285,12 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iint = igho - 1; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], igho, igho, jbeg, jend, @@ -315,12 +305,12 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( jint = jgho + 1; ibeg = lower[0]; iend = upper[0]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], ibeg, iend, jgho, jgho, @@ -335,12 +325,12 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( jint = jgho - 1; ibeg = lower[0]; iend = upper[0]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], ibeg, iend, jgho, jgho, @@ -364,13 +354,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( jend = upper[1]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -388,13 +378,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( jend = upper[1]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -412,13 +402,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iend = upper[0]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -436,13 +426,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iend = upper[0]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -460,13 +450,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iend = upper[0]; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -484,13 +474,13 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( iend = upper[0]; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], acoef_data->getPointer(), bcoef_data->getPointer(), - gcoef_data ? gcoef_data->getPointer() : NULL, + gcoef_data ? gcoef_data->getPointer() : 0, coefbox.lower()[0], coefbox.upper()[0], coefbox.lower()[1], coefbox.upper()[1], coefbox.lower()[2], coefbox.upper()[2], @@ -520,9 +510,9 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( * This data may be used by refinement operators to do interpolation. */ - const tbox::Array& node_boxes = + const std::vector& node_boxes = pg->getNodeBoundaries(); - const int n_node_boxes = node_boxes.getSize(); + const int n_node_boxes = static_cast(node_boxes.size()); for (int n = 0; n < n_node_boxes; ++n) { const hier::BoundaryBox& bb = node_boxes[n]; TBOX_ASSERT(bb.getBoundaryType() == 2); // Must be a node boundary. @@ -530,7 +520,7 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( const hier::Index& lower = bb_box.lower(); const hier::Index& upper = bb_box.upper(); const int location_index = bb.getLocationIndex(); - F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], &lower[0], &upper[0], location_index); @@ -541,9 +531,9 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( * through the nearest interior cell and the two nearest side values. * This data may be used by refinement operators to do interpolation. */ - const tbox::Array& edge_boxes = + const std::vector& edge_boxes = pg->getEdgeBoundaries(); - const int n_edge_boxes = edge_boxes.getSize(); + const int n_edge_boxes = static_cast(edge_boxes.size()); for (int n = 0; n < n_edge_boxes; ++n) { const int location_index = edge_boxes[n].getLocationIndex(); const int edge_dir = 2 - (location_index / 4); @@ -556,7 +546,7 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( TBOX_ASSERT(boundary_box.getBoundaryType() == 2); const hier::Index& lower = boundary_box.getBox().lower(); const hier::Index& upper = boundary_box.getBox().upper(); - F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -568,8 +558,9 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( * through the nearest interior cell and the three nearest edge values. * This data may be used by refinement operators to do interpolation. */ - const tbox::Array& node_boxes = pg->getNodeBoundaries(); - const int n_node_boxes = node_boxes.getSize(); + const std::vector& node_boxes = + pg->getNodeBoundaries(); + const int n_node_boxes = static_cast(node_boxes.size()); for (int n = 0; n < n_node_boxes; ++n) { const hier::BoundaryBox& bb = node_boxes[n]; TBOX_ASSERT(bb.getBoundaryType() == 3); // Must be an node boundary. @@ -578,7 +569,7 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( const hier::Index& upper = bb_box.upper(); TBOX_ASSERT(lower == upper); const int location_index = bb.getLocationIndex(); - F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) (data.getPointer(0), + SAMRAI_F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) (data.getPointer(0), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -608,7 +599,7 @@ CartesianRobinBcHelper::setBoundaryValuesInCells( int target_data_id, bool homogeneous_bc) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, level, ghost_width_to_fill); + TBOX_ASSERT_OBJDIM_EQUALITY2(level, ghost_width_to_fill); for (hier::PatchLevel::iterator p(level.begin()); p != level.end(); ++p) { @@ -634,8 +625,6 @@ CartesianRobinBcHelper::setBoundaryValuesAtNodes( int target_data_id, bool homogeneous_bc) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, patch); - NULL_USE(patch); NULL_USE(fill_time); NULL_USE(target_data_id); @@ -662,7 +651,7 @@ CartesianRobinBcHelper::setPhysicalBoundaryConditions( const double fill_time, const hier::IntVector& ghost_width_to_fill) { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, patch, ghost_width_to_fill); + TBOX_ASSERT_OBJDIM_EQUALITY2(patch, ghost_width_to_fill); setBoundaryValuesInCells(patch, fill_time, @@ -672,9 +661,9 @@ CartesianRobinBcHelper::setPhysicalBoundaryConditions( } hier::IntVector -CartesianRobinBcHelper::getRefineOpStencilWidth() const +CartesianRobinBcHelper::getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(d_dim); + return hier::IntVector::getZero(dim); } void @@ -725,24 +714,6 @@ CartesianRobinBcHelper::postprocessRefine( NULL_USE(fine_boxes); NULL_USE(ratio); } -void -CartesianRobinBcHelper::fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry) -{ - NULL_USE(patch); - NULL_USE(encon_level); - NULL_USE(dst_to_encon); - NULL_USE(fill_time); - NULL_USE(fill_box); - NULL_USE(boundary_box); - NULL_USE(grid_geometry); -} /* ************************************************************************ @@ -757,7 +728,7 @@ CartesianRobinBcHelper::trimBoundaryBox( const hier::BoundaryBox& boundary_box, const hier::Box& limit_box) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, boundary_box, limit_box); + TBOX_ASSERT_OBJDIM_EQUALITY2(boundary_box, limit_box); if (boundary_box.getBoundaryType() == d_dim.getValue()) { // This is a node boundary box and cannot be trimmed anymore. @@ -822,8 +793,6 @@ hier::Box CartesianRobinBcHelper::makeFaceBoundaryBox( const hier::BoundaryBox& boundary_box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, boundary_box); - if (boundary_box.getBoundaryType() != 1) { TBOX_ERROR(d_object_name << ": makeFaceBoundaryBox called with\n" << "improper boundary box\n" @@ -837,7 +806,7 @@ CartesianRobinBcHelper::makeFaceBoundaryBox( * than the boundary cell indices, in the direction normal * to the boundary. */ - face_indices.shift(location_index / 2, 1); + face_indices.shift(static_cast(location_index / 2), 1); } return face_indices; } @@ -852,8 +821,6 @@ hier::Box CartesianRobinBcHelper::makeNodeBoundaryBox( const hier::BoundaryBox& boundary_box) const { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, boundary_box); - if (boundary_box.getBoundaryType() != 1) { TBOX_ERROR(d_object_name << ": makeNodeBoundaryBox called with\n" << "improper boundary box\n" @@ -867,7 +834,7 @@ CartesianRobinBcHelper::makeNodeBoundaryBox( * than the boundary cell indices, in the direction normal * to the boundary. */ - node_indices.shift(location_index / 2, 1); + node_indices.shift(static_cast(location_index / 2), 1); } /* * The node indices range one higher than the cell indices, @@ -881,4 +848,3 @@ CartesianRobinBcHelper::makeNodeBoundaryBox( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.h index b1966093..3a873a65 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CartesianRobinBcHelper.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition support on cartesian grids. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -66,7 +66,7 @@ class CartesianRobinBcHelper: explicit CartesianRobinBcHelper( const tbox::Dimension& dim, std::string object_name = std::string(), - RobinBcCoefStrategy* coef_strategy = NULL); + RobinBcCoefStrategy* coef_strategy = 0); /*! * @brief Destructor. @@ -82,7 +82,8 @@ class CartesianRobinBcHelper: const double fill_time, const hier::IntVector& ghost_width_to_fill); hier::IntVector - getRefineOpStencilWidth() const; + getRefineOpStencilWidth( + const tbox::Dimension& dim) const; virtual void preprocessRefineBoxes( hier::Patch& fine, @@ -107,15 +108,6 @@ class CartesianRobinBcHelper: const hier::Patch& coarse, const hier::Box& fine_box, const hier::IntVector& ratio); - virtual void - fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry); //@} @@ -205,6 +197,10 @@ class CartesianRobinBcHelper: * This data must be a cell-centered double. * @param homogeneous_bc Set a homogeneous boundary condition. * This means g=0 for the boundary. + * + * @pre patch.getDim() == ghost_width_to_fill.getDim() + * @pre d_coef_strategy + * @pre patch.getDim().getValue() != 1 */ void setBoundaryValuesInCells( @@ -232,6 +228,8 @@ class CartesianRobinBcHelper: * This data must be a cell-centered double. * @param homogeneous_bc Set a homogeneous boundary condition. * This means g=0 for the boundary. + * + * @pre level.getDim() == ghost_width_to_fill.getDim() */ void setBoundaryValuesInCells( @@ -304,14 +302,15 @@ class CartesianRobinBcHelper: * * @param coef_strategy Pointer to a concrete inmplementation of * the coefficient strategy. + * + * @pre coef_strategy */ void setCoefImplementation( const RobinBcCoefStrategy* coef_strategy) { if (!coef_strategy) { - TBOX_ERROR(d_object_name << ": Invalid pointer value" - << std::endl); + TBOX_ERROR(d_object_name << ": Invalid pointer value" << std::endl); } d_coef_strategy = coef_strategy; } @@ -363,6 +362,14 @@ class CartesianRobinBcHelper: return d_object_name; } + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; + } + private: /*! * @brief Trim a boundary box so that it does not stick out @@ -380,6 +387,8 @@ class CartesianRobinBcHelper: * @param limit_box hier::Box to not stick past * * @return New trimmed boundary box. + * + * @pre boundary_box.getDim() == limit_box.getDim() */ hier::BoundaryBox trimBoundaryBox( @@ -400,6 +409,8 @@ class CartesianRobinBcHelper: * @param boundary_box input boundary box * @return a box to define the node indices corresponding to * boundary_box + * + * @pre boundary_box.getBoundaryType() == 1 */ hier::Box makeNodeBoundaryBox( @@ -422,15 +433,17 @@ class CartesianRobinBcHelper: * @param boundary_box input boundary box * @return a box to define the face indices corresponding to * boundary_box + * + * @pre boundary_box.getBoundaryType() == 1 */ hier::Box makeFaceBoundaryBox( const hier::BoundaryBox& boundary_box) const; - const tbox::Dimension d_dim; - std::string d_object_name; + const tbox::Dimension d_dim; + /*! * @brief Coefficient strategy giving a way to get to * Robin bc coefficients. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.C index 917ccd7e..4b1e3b6d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operator class for cell-centered scalar Poisson using FAC * ************************************************************************/ -#ifndef included_solv_CellPoissonFACOps_C -#define included_solv_CellPoissonFACOps_C - #include "SAMRAI/solv/CellPoissonFACOps.h" #include IOMANIP_HEADER_FILE @@ -28,7 +25,6 @@ #include "SAMRAI/pdat/SideVariable.h" #include "SAMRAI/solv/FACPreconditioner.h" #include "SAMRAI/solv/CellPoissonHypreSolver.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/StartupShutdownManager.h" #include "SAMRAI/tbox/Timer.h" @@ -42,19 +38,19 @@ #include "SAMRAI/xfer/RefineSchedule.h" #include "SAMRAI/xfer/PatchLevelFullFillPattern.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace solv { boost::shared_ptr > -CellPoissonFACOps::s_cell_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +CellPoissonFACOps::s_cell_scratch_var[SAMRAI::MAX_DIM_VAL]; boost::shared_ptr > -CellPoissonFACOps::s_flux_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +CellPoissonFACOps::s_flux_scratch_var[SAMRAI::MAX_DIM_VAL]; boost::shared_ptr > -CellPoissonFACOps::s_oflux_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +CellPoissonFACOps::s_oflux_scratch_var[SAMRAI::MAX_DIM_VAL]; tbox::StartupShutdownManager::Handler CellPoissonFACOps::s_finalize_handler( @@ -70,7 +66,7 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(compfluxvardc2d, COMPFLUXVARDC2D) ( +void SAMRAI_F77_FUNC(compfluxvardc2d, COMPFLUXVARDC2D) ( double* xflux, double* yflux, const int* fluxgi, @@ -87,7 +83,7 @@ void F77_FUNC(compfluxvardc2d, COMPFLUXVARDC2D) ( const int* jfirst, const int* jlast, const double* dx); -void F77_FUNC(compfluxcondc2d, COMPFLUXCONDC2D) ( +void SAMRAI_F77_FUNC(compfluxcondc2d, COMPFLUXCONDC2D) ( double* xflux, double* yflux, const int* fluxgi, @@ -101,7 +97,7 @@ void F77_FUNC(compfluxcondc2d, COMPFLUXCONDC2D) ( const int* jfirst, const int* jlast, const double* dx); -void F77_FUNC(rbgswithfluxmaxvardcvarsf2d, RBGSWITHFLUXMAXVARDCVARSF2D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxvardcvarsf2d, RBGSWITHFLUXMAXVARDCVARSF2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -126,7 +122,7 @@ void F77_FUNC(rbgswithfluxmaxvardcvarsf2d, RBGSWITHFLUXMAXVARDCVARSF2D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxcondcvarsf2d, RBGSWITHFLUXMAXCONDCVARSF2D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxcondcvarsf2d, RBGSWITHFLUXMAXCONDCVARSF2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -148,7 +144,7 @@ void F77_FUNC(rbgswithfluxmaxcondcvarsf2d, RBGSWITHFLUXMAXCONDCVARSF2D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -171,7 +167,7 @@ void F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -191,7 +187,7 @@ void F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(compresvarsca2d, COMPRESVARSCA2D) ( +void SAMRAI_F77_FUNC(compresvarsca2d, COMPRESVARSCA2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -213,7 +209,7 @@ void F77_FUNC(compresvarsca2d, COMPRESVARSCA2D) ( const int* jfirst, const int* jlast, const double* dx); -void F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( +void SAMRAI_F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -233,7 +229,7 @@ void F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( const int* jfirst, const int* jlast, const double* dx); -void F77_FUNC(ewingfixfluxvardc2d, EWINGFIXFLUXVARDC2D) ( +void SAMRAI_F77_FUNC(ewingfixfluxvardc2d, EWINGFIXFLUXVARDC2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -254,7 +250,7 @@ void F77_FUNC(ewingfixfluxvardc2d, EWINGFIXFLUXVARDC2D) ( const int* blower, const int* bupper, const double* dx); -void F77_FUNC(ewingfixfluxcondc2d, EWINGFIXFLUXCONDC2D) ( +void SAMRAI_F77_FUNC(ewingfixfluxcondc2d, EWINGFIXFLUXCONDC2D) ( const double* xflux, const double* yflux, const int* fluxgi, @@ -273,7 +269,7 @@ void F77_FUNC(ewingfixfluxcondc2d, EWINGFIXFLUXCONDC2D) ( const int* bupper, const double* dx); -void F77_FUNC(compfluxvardc3d, COMPFLUXVARDC3D) ( +void SAMRAI_F77_FUNC(compfluxvardc3d, COMPFLUXVARDC3D) ( double* xflux, double* yflux, double* zflux, @@ -297,7 +293,7 @@ void F77_FUNC(compfluxvardc3d, COMPFLUXVARDC3D) ( const int* kfirst, const int* klast, const double* dx); -void F77_FUNC(compfluxcondc3d, COMPFLUXCONDC3D) ( +void SAMRAI_F77_FUNC(compfluxcondc3d, COMPFLUXCONDC3D) ( double* xflux, double* yflux, double* zflux, @@ -316,7 +312,7 @@ void F77_FUNC(compfluxcondc3d, COMPFLUXCONDC3D) ( const int* kfirst, const int* klast, const double* dx); -void F77_FUNC(rbgswithfluxmaxvardcvarsf3d, RBGSWITHFLUXMAXVARDCVARSF3D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxvardcvarsf3d, RBGSWITHFLUXMAXVARDCVARSF3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -350,7 +346,7 @@ void F77_FUNC(rbgswithfluxmaxvardcvarsf3d, RBGSWITHFLUXMAXVARDCVARSF3D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxcondcvarsf3d, RBGSWITHFLUXMAXCONDCVARSF3D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxcondcvarsf3d, RBGSWITHFLUXMAXCONDCVARSF3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -379,7 +375,7 @@ void F77_FUNC(rbgswithfluxmaxcondcvarsf3d, RBGSWITHFLUXMAXCONDCVARSF3D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -410,7 +406,7 @@ void F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( +void SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -436,7 +432,7 @@ void F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( const double* dx, const int* offset, const double* maxres); -void F77_FUNC(compresvarsca3d, COMPRESVARSCA3D) ( +void SAMRAI_F77_FUNC(compresvarsca3d, COMPRESVARSCA3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -466,7 +462,7 @@ void F77_FUNC(compresvarsca3d, COMPRESVARSCA3D) ( const int* kfirst, const int* klast, const double* dx); -void F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( +void SAMRAI_F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -493,7 +489,7 @@ void F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( const int* kfirst, const int* klast, const double* dx); -void F77_FUNC(ewingfixfluxvardc3d, EWINGFIXFLUXVARDC3D) ( +void SAMRAI_F77_FUNC(ewingfixfluxvardc3d, EWINGFIXFLUXVARDC3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -521,7 +517,7 @@ void F77_FUNC(ewingfixfluxvardc3d, EWINGFIXFLUXVARDC3D) ( const int* blower, const int* bupper, const double* dx); -void F77_FUNC(ewingfixfluxcondc3d, EWINGFIXFLUXCONDC3D) ( +void SAMRAI_F77_FUNC(ewingfixfluxcondc3d, EWINGFIXFLUXCONDC3D) ( const double* xflux, const double* yflux, const double* zflux, @@ -552,48 +548,79 @@ void F77_FUNC(ewingfixfluxcondc3d, EWINGFIXFLUXCONDC3D) ( * Constructor. ******************************************************************** */ +#ifdef HAVE_HYPRE CellPoissonFACOps::CellPoissonFACOps( + const boost::shared_ptr& hypre_solver, const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database): + const boost::shared_ptr& input_db): d_dim(dim), d_object_name(object_name), d_ln_min(-1), d_ln_max(-1), d_poisson_spec(object_name + "::Poisson specs"), - d_smoothing_choice("redblack"), - d_coarse_solver_choice( -#ifdef HAVE_HYPRE - "hypre" + d_coarse_solver_choice("hypre"), + d_cf_discretization("Ewing"), + d_prolongation_method("CONSTANT_REFINE"), + d_coarse_solver_tolerance(1.e-10), + d_coarse_solver_max_iterations(20), + d_residual_tolerance_during_smoothing(-1.0), + d_flux_id(-1), + d_hypre_solver(hypre_solver), + d_physical_bc_coef(0), + d_context(hier::VariableDatabase::getDatabase()->getContext( + object_name + "::PRIVATE_CONTEXT")), + d_cell_scratch_id(-1), + d_flux_scratch_id(-1), + d_oflux_scratch_id(-1), + d_bc_helper(dim, + d_object_name + "::bc helper"), + d_enable_logging(false) +{ + buildObject(input_db); +} #else - "redblack" -#endif - - ), +CellPoissonFACOps::CellPoissonFACOps( + const tbox::Dimension& dim, + const std::string& object_name, + const boost::shared_ptr& input_db): + d_dim(dim), + d_object_name(object_name), + d_ln_min(-1), + d_ln_max(-1), + d_poisson_spec(object_name + "::Poisson specs"), + d_coarse_solver_choice("redblack"), d_cf_discretization("Ewing"), d_prolongation_method("CONSTANT_REFINE"), d_coarse_solver_tolerance(1.e-8), - d_coarse_solver_max_iterations(10), + d_coarse_solver_max_iterations(500), d_residual_tolerance_during_smoothing(-1.0), d_flux_id(-1), -#ifdef HAVE_HYPRE - d_hypre_solver(dim, - object_name + "::hypre_solver", - database && database->isDatabase("hypre_solver") ? - database->getDatabase("hypre_solver") : - boost::shared_ptr()), -#endif - d_physical_bc_coef(NULL), + d_physical_bc_coef(0), d_context(hier::VariableDatabase::getDatabase()->getContext( - object_name + "::PRIVATE_CONTEXT")), + object_name + "::PRIVATE_CONTEXT")), d_cell_scratch_id(-1), d_flux_scratch_id(-1), d_oflux_scratch_id(-1), d_bc_helper(dim, d_object_name + "::bc helper"), - d_enable_logging(false), - d_preconditioner(NULL) + d_enable_logging(false) { + buildObject(input_db); +} +#endif + +CellPoissonFACOps::~CellPoissonFACOps() +{ +} + +void +CellPoissonFACOps::buildObject( + const boost::shared_ptr& input_db) +{ + if (d_dim == tbox::Dimension(1) || d_dim > tbox::Dimension(3)) { + TBOX_ERROR("CellPoissonFACOps : DIM == 1 or > 3 not implemented yet.\n"); + } t_restrict_solution = tbox::TimerManager::getManager()-> getTimer("solv::CellPoissonFACOps::restrictSolution()"); @@ -610,83 +637,102 @@ CellPoissonFACOps::CellPoissonFACOps( t_compute_residual_norm = tbox::TimerManager::getManager()-> getTimer("solv::CellPoissonFACOps::computeResidualNorm()"); - if (d_dim == tbox::Dimension(1) || d_dim > tbox::Dimension(3)) { - TBOX_ERROR("CellPoissonFACOps : DIM == 1 or > 3 not implemented yet.\n"); - } - - if (!s_cell_scratch_var[dim.getValue() - 1]) { - TBOX_ASSERT(!s_cell_scratch_var[dim.getValue() - 1]); - TBOX_ASSERT(!s_cell_scratch_var[dim.getValue() - 1]); + if (!s_cell_scratch_var[d_dim.getValue() - 1]) { + TBOX_ASSERT(!s_cell_scratch_var[d_dim.getValue() - 1]); std::ostringstream ss; - ss << "CellPoissonFACOps::private_cell_scratch" << dim.getValue(); - s_cell_scratch_var[dim.getValue() - 1].reset( - new pdat::CellVariable(dim, ss.str())); + ss << "CellPoissonFACOps::private_cell_scratch" << d_dim.getValue(); + s_cell_scratch_var[d_dim.getValue() - 1].reset( + new pdat::CellVariable(d_dim, ss.str())); ss.str(""); - ss << "CellPoissonFACOps::private_flux_scratch" << dim.getValue(); - s_flux_scratch_var[dim.getValue() - 1].reset( - new pdat::SideVariable(dim, ss.str())); + ss << "CellPoissonFACOps::private_flux_scratch" << d_dim.getValue(); + s_flux_scratch_var[d_dim.getValue() - 1].reset( + new pdat::SideVariable(d_dim, ss.str(), + hier::IntVector::getOne(d_dim))); ss.str(""); - ss << "CellPoissonFACOps::private_oflux_scratch" << dim.getValue(); - s_oflux_scratch_var[dim.getValue() - 1].reset( - new pdat::OutersideVariable(dim, ss.str())); + ss << "CellPoissonFACOps::private_oflux_scratch" << d_dim.getValue(); + s_oflux_scratch_var[d_dim.getValue() - 1].reset( + new pdat::OutersideVariable(d_dim, ss.str())); } + /* + * Some variables initialized by default are overriden by input. + */ + getFromInput(input_db); + hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); d_cell_scratch_id = vdb-> - registerVariableAndContext(s_cell_scratch_var[dim.getValue() - 1], + registerVariableAndContext(s_cell_scratch_var[d_dim.getValue() - 1], d_context, - hier::IntVector::getOne(dim)); + hier::IntVector::getOne(d_dim)); d_flux_scratch_id = vdb-> - registerVariableAndContext(s_flux_scratch_var[dim.getValue() - 1], + registerVariableAndContext(s_flux_scratch_var[d_dim.getValue() - 1], d_context, hier::IntVector::getZero(d_dim)); d_oflux_scratch_id = vdb-> - registerVariableAndContext(s_oflux_scratch_var[dim.getValue() - 1], + registerVariableAndContext(s_oflux_scratch_var[d_dim.getValue() - 1], d_context, hier::IntVector::getZero(d_dim)); /* - * Some variables initialized by default are overriden by input. + * Check input validity and correctness. */ - if (database) { + checkInputPatchDataIndices(); +} +/* + ************************************************************************ + * Read input parameters from database. + ************************************************************************ + */ +void +CellPoissonFACOps::getFromInput( + const boost::shared_ptr& input_db) +{ + if (input_db) { d_coarse_solver_choice = - database->getStringWithDefault("coarse_solver_choice", + input_db->getStringWithDefault("coarse_solver_choice", d_coarse_solver_choice); + if (!(d_coarse_solver_choice == "hypre" || + d_coarse_solver_choice == "redblack" || + d_coarse_solver_choice == "jacobi")) { + INPUT_VALUE_ERROR("coarse_solver_choice"); + } + d_coarse_solver_tolerance = - database->getDoubleWithDefault("coarse_solver_tolerance", + input_db->getDoubleWithDefault("coarse_solver_tolerance", d_coarse_solver_tolerance); + if (!(d_coarse_solver_tolerance > 0)) { + INPUT_RANGE_ERROR("coarse_solver_tolerance"); + } + d_coarse_solver_max_iterations = - database->getIntegerWithDefault("coarse_solver_max_iterations", + input_db->getIntegerWithDefault("coarse_solver_max_iterations", d_coarse_solver_max_iterations); - d_smoothing_choice = - database->getStringWithDefault("smoothing_choice", - d_smoothing_choice); + if (!(d_coarse_solver_max_iterations >= 1)) { + INPUT_RANGE_ERROR("coarse_solver_max_iterations"); + } d_cf_discretization = - database->getStringWithDefault("cf_discretization", - d_cf_discretization); + input_db->getStringWithDefault("cf_discretization", "Ewing"); + if (!(d_cf_discretization == "Ewing" || + d_cf_discretization == "CONSTANT_REFINE" || + d_cf_discretization == "LINEAR_REFINE" || + d_cf_discretization == "CONSERVATIVE_LINEAR_REFINE")) { + INPUT_VALUE_ERROR("cf_discretization"); + } d_prolongation_method = - database->getStringWithDefault("prolongation_method", - d_prolongation_method); - - d_enable_logging = - database->getBoolWithDefault("enable_logging", - d_enable_logging); + input_db->getStringWithDefault("prolongation_method", + "CONSTANT_REFINE"); + if (!(d_prolongation_method == "CONSTANT_REFINE" || + d_prolongation_method == "LINEAR_REFINE" || + d_prolongation_method == "CONSERVATIVE_LINEAR_REFINE")) { + INPUT_VALUE_ERROR("prolongation_method"); + } + d_enable_logging = input_db->getBoolWithDefault("enable_logging", false); } - - /* - * Check input validity and correctness. - */ - checkInputPatchDataIndices(); - -} - -CellPoissonFACOps::~CellPoissonFACOps() -{ } /* @@ -711,15 +757,15 @@ CellPoissonFACOps::initializeOperatorState( d_ln_min = solution.getCoarsestLevelNumber(); d_ln_max = solution.getFinestLevelNumber(); d_hopscell.reset(new math::HierarchyCellDataOpsReal(d_hierarchy, - d_ln_min, - d_ln_max)); + d_ln_min, + d_ln_max)); d_hopsside.reset(new math::HierarchySideDataOpsReal(d_hierarchy, - d_ln_min, - d_ln_max)); + d_ln_min, + d_ln_max)); #ifdef DEBUG_CHECK_ASSERTIONS - if (d_physical_bc_coef == NULL) { + if (d_physical_bc_coef == 0) { /* * It's an error not to have bc object set. * Note that the bc object cannot be passed in through @@ -759,12 +805,8 @@ CellPoissonFACOps::initializeOperatorState( << "correspond to a variable.\n"); } boost::shared_ptr > cell_var( - var, - boost::detail::dynamic_cast_tag()); - if (!cell_var) { - TBOX_ERROR(d_object_name - << ": RHS variable is not cell-centered double\n"); - } + BOOST_CAST, hier::Variable>(var)); + TBOX_ASSERT(cell_var); } { vdb->mapIndexToVariable(solution.getComponentDescriptorIndex(0), @@ -774,12 +816,8 @@ CellPoissonFACOps::initializeOperatorState( << "correspond to a variable.\n"); } boost::shared_ptr > cell_var( - var, - boost::detail::dynamic_cast_tag()); - if (!cell_var) { - TBOX_ERROR(d_object_name - << ": Solution variable is not cell-centered double\n"); - } + BOOST_CAST, hier::Variable>(var)); + TBOX_ASSERT(cell_var); } for (ln = d_ln_min; ln <= d_ln_max; ++ln) { boost::shared_ptr level_ptr( @@ -795,12 +833,8 @@ CellPoissonFACOps::initializeOperatorState( * Some data checks can only be done if the data already exists. */ boost::shared_ptr > cd( - fd, - boost::detail::dynamic_cast_tag()); - if (!cd) { - TBOX_ERROR(d_object_name - << ": RHS data is not cell-centered double\n"); - } + BOOST_CAST, hier::PatchData>(fd)); + TBOX_ASSERT(cd); if (cd->getDepth() > 1) { TBOX_WARNING(d_object_name << ": RHS data has multiple depths.\n" @@ -808,19 +842,14 @@ CellPoissonFACOps::initializeOperatorState( } } boost::shared_ptr ud( - patch.getPatchData(solution.getComponentDescriptorIndex(0)), - boost::detail::dynamic_cast_tag()); + patch.getPatchData(solution.getComponentDescriptorIndex(0))); if (ud) { /* * Some data checks can only be done if the data already exists. */ boost::shared_ptr > cd( - ud, - boost::detail::dynamic_cast_tag()); - if (!cd) { - TBOX_ERROR(d_object_name - << ": Solution data is not cell-centered double\n"); - } + BOOST_CAST, hier::PatchData>(ud)); + TBOX_ASSERT(cd); if (cd->getDepth() > 1) { TBOX_WARNING(d_object_name << ": Solution data has multiple depths.\n" @@ -850,7 +879,7 @@ CellPoissonFACOps::initializeOperatorState( * Initialize the coarse-fine boundary description for the * hierarchy. */ - d_cf_boundary.resizeArray(d_hierarchy->getNumberOfLevels()); + d_cf_boundary.resize(d_hierarchy->getNumberOfLevels()); hier::IntVector max_gcw(d_dim, 1); for (ln = d_ln_min; ln <= d_ln_max; ++ln) { @@ -861,14 +890,14 @@ CellPoissonFACOps::initializeOperatorState( } #ifdef HAVE_HYPRE if (d_coarse_solver_choice == "hypre") { - d_hypre_solver.initializeSolverState(d_hierarchy, d_ln_min); + d_hypre_solver->initializeSolverState(d_hierarchy, d_ln_min); /* * Share the boundary condition object with the hypre solver * to make sure that boundary condition settings are consistent * between the two objects. */ - d_hypre_solver.setPhysicalBcCoefObject(d_physical_bc_coef); - d_hypre_solver.setMatrixCoefficients(d_poisson_spec); + d_hypre_solver->setPhysicalBcCoefObject(d_physical_bc_coef); + d_hypre_solver->setMatrixCoefficients(d_poisson_spec); } #endif @@ -883,8 +912,9 @@ CellPoissonFACOps::initializeOperatorState( * acceptable strings for looking up the refine operator. */ boost::shared_ptr geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + d_hierarchy->getGridGeometry())); + TBOX_ASSERT(geometry); boost::shared_ptr variable; vdb->mapIndexToVariable(d_cell_scratch_id, variable); @@ -917,27 +947,27 @@ CellPoissonFACOps::initializeOperatorState( #ifdef DEBUG_CHECK_ASSERTIONS if (!d_prolongation_refine_operator) { TBOX_ERROR(d_object_name - << ": Cannot find prolongation refine operator"); + << ": Cannot find prolongation refine operator" << std::endl); } if (!d_urestriction_coarsen_operator) { TBOX_ERROR(d_object_name - << ": Cannot find restriction coarsening operator"); + << ": Cannot find restriction coarsening operator" << std::endl); } if (!d_rrestriction_coarsen_operator) { TBOX_ERROR(d_object_name - << ": Cannot find restriction coarsening operator"); + << ": Cannot find restriction coarsening operator" << std::endl); } if (!d_flux_coarsen_operator) { TBOX_ERROR(d_object_name - << ": Cannot find flux coarsening operator"); + << ": Cannot find flux coarsening operator" << std::endl); } if (!d_ghostfill_refine_operator) { TBOX_ERROR(d_object_name - << ": Cannot find ghost filling refinement operator"); + << ": Cannot find ghost filling refinement operator" << std::endl); } if (!d_ghostfill_nocoarse_refine_operator) { TBOX_ERROR(d_object_name - << ": Cannot find ghost filling refinement operator"); + << ": Cannot find ghost filling refinement operator" << std::endl); } #endif @@ -951,15 +981,15 @@ CellPoissonFACOps::initializeOperatorState( * There is no need to delete the old schedules first * because we have deallocated the solver state above. */ - d_prolongation_refine_schedules.resizeArray(d_ln_max + 1); - d_ghostfill_refine_schedules.resizeArray(d_ln_max + 1); - d_ghostfill_nocoarse_refine_schedules.resizeArray(d_ln_max + 1); - d_urestriction_coarsen_schedules.resizeArray(d_ln_max + 1); - d_rrestriction_coarsen_schedules.resizeArray(d_ln_max + 1); - d_flux_coarsen_schedules.resizeArray(d_ln_max + 1); + d_prolongation_refine_schedules.resize(d_ln_max + 1); + d_ghostfill_refine_schedules.resize(d_ln_max + 1); + d_ghostfill_nocoarse_refine_schedules.resize(d_ln_max + 1); + d_urestriction_coarsen_schedules.resize(d_ln_max + 1); + d_rrestriction_coarsen_schedules.resize(d_ln_max + 1); + d_flux_coarsen_schedules.resize(d_ln_max + 1); d_prolongation_refine_algorithm.reset( - new xfer::RefineAlgorithm(d_dim)); + new xfer::RefineAlgorithm()); d_urestriction_coarsen_algorithm.reset( new xfer::CoarsenAlgorithm(d_dim)); d_rrestriction_coarsen_algorithm.reset( @@ -967,9 +997,9 @@ CellPoissonFACOps::initializeOperatorState( d_flux_coarsen_algorithm.reset( new xfer::CoarsenAlgorithm(d_dim)); d_ghostfill_refine_algorithm.reset( - new xfer::RefineAlgorithm(d_dim)); + new xfer::RefineAlgorithm()); d_ghostfill_nocoarse_refine_algorithm.reset( - new xfer::RefineAlgorithm(d_dim)); + new xfer::RefineAlgorithm()); d_prolongation_refine_algorithm->registerRefine( d_cell_scratch_id, @@ -1089,31 +1119,31 @@ CellPoissonFACOps::deallocateOperatorState() d_hierarchy->getPatchLevel(ln)-> deallocatePatchData(d_oflux_scratch_id); } - d_cf_boundary.resizeArray(0); + d_cf_boundary.resize(0); #ifdef HAVE_HYPRE - d_hypre_solver.deallocateSolverState(); + d_hypre_solver->deallocateSolverState(); #endif d_hierarchy.reset(); d_ln_min = -1; d_ln_max = -1; d_prolongation_refine_algorithm.reset(); - d_prolongation_refine_schedules.setNull(); + d_prolongation_refine_schedules.clear(); d_urestriction_coarsen_algorithm.reset(); - d_urestriction_coarsen_schedules.setNull(); + d_urestriction_coarsen_schedules.clear(); d_rrestriction_coarsen_algorithm.reset(); - d_rrestriction_coarsen_schedules.setNull(); + d_rrestriction_coarsen_schedules.clear(); d_flux_coarsen_algorithm.reset(); - d_flux_coarsen_schedules.setNull(); + d_flux_coarsen_schedules.clear(); d_ghostfill_refine_algorithm.reset(); - d_ghostfill_refine_schedules.setNull(); + d_ghostfill_refine_schedules.clear(); d_ghostfill_nocoarse_refine_algorithm.reset(); - d_ghostfill_nocoarse_refine_schedules.setNull(); + d_ghostfill_nocoarse_refine_schedules.clear(); } } @@ -1229,7 +1259,7 @@ CellPoissonFACOps::prolongErrorAndCorrect( if (s.getPatchHierarchy() != d_hierarchy || d.getPatchHierarchy() != d_hierarchy) { TBOX_ERROR(d_object_name << ": Vector hierarchy does not match\n" - "internal state hierarchy."); + "internal state hierarchy." << std::endl); } #endif @@ -1286,17 +1316,11 @@ CellPoissonFACOps::smoothError( t_smooth_error->start(); checkInputPatchDataIndices(); - if (d_smoothing_choice == "redblack") { - smoothErrorByRedBlack(data, - residual, - ln, - num_sweeps, - d_residual_tolerance_during_smoothing); - } else { - TBOX_ERROR(d_object_name << ": Bad smoothing choice '" - << d_smoothing_choice - << "' in CellPoissonFACOps."); - } + smoothErrorByRedBlack(data, + residual, + ln, + num_sweeps, + d_residual_tolerance_during_smoothing); t_smooth_error->stop(); } @@ -1323,7 +1347,7 @@ CellPoissonFACOps::smoothErrorByRedBlack( if (data.getPatchHierarchy() != d_hierarchy || residual.getPatchHierarchy() != d_hierarchy) { TBOX_ERROR(d_object_name << ": Vector hierarchy does not match\n" - "internal hierarchy."); + "internal hierarchy." << std::endl); } #endif boost::shared_ptr level(d_hierarchy->getPatchLevel(ln)); @@ -1383,14 +1407,18 @@ CellPoissonFACOps::smoothErrorByRedBlack( } boost::shared_ptr > err_data( - data.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + data.getComponentPatchData(0, *patch))); boost::shared_ptr > residual_data( - residual.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + residual.getComponentPatchData(0, *patch))); boost::shared_ptr > flux_data( - patch->getPatchData(flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(flux_id))); + + TBOX_ASSERT(err_data); + TBOX_ASSERT(residual_data); + TBOX_ASSERT(flux_data); computeFluxOnPatch( *patch, @@ -1431,14 +1459,18 @@ CellPoissonFACOps::smoothErrorByRedBlack( } boost::shared_ptr > err_data( - data.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + data.getComponentPatchData(0, *patch))); boost::shared_ptr > residual_data( - residual.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + residual.getComponentPatchData(0, *patch))); boost::shared_ptr > flux_data( - patch->getPatchData(flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(flux_id))); + + TBOX_ASSERT(err_data); + TBOX_ASSERT(residual_data); + TBOX_ASSERT(flux_data); computeFluxOnPatch( *patch, @@ -1492,28 +1524,40 @@ CellPoissonFACOps::ewingFixFlux( pdat::SideData& flux_data, const hier::IntVector& ratio_to_coarser) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, patch, soln_data, flux_data, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(d_dim, patch, soln_data, flux_data, ratio_to_coarser); const int patch_ln = patch.getPatchLevelNumber(); const hier::GlobalId id = patch.getGlobalId(); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Box& patch_box(patch.getBox()); const hier::Index& plower = patch_box.lower(); const hier::Index& pupper = patch_box.upper(); - const tbox::Array& bboxes = + hier::IntVector block_ratio(ratio_to_coarser); + if (block_ratio.getNumBlocks() != 1) { + block_ratio = hier::IntVector(d_dim); + hier::BlockId::block_t b = patch_box.getBlockId().getBlockValue(); + for (unsigned int d = 0; d < d_dim.getValue(); ++d) { + block_ratio[d] = ratio_to_coarser(b,d); + } + } + + const std::vector& bboxes = d_cf_boundary[patch_ln]->getBoundaries(id, 1); - int bn, nboxes = bboxes.getSize(); + int bn, nboxes = static_cast(bboxes.size()); if (d_poisson_spec.dIsVariable()) { boost::shared_ptr > diffcoef_data( - patch.getPatchData(d_poisson_spec.getDPatchDataId()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_poisson_spec.getDPatchDataId()))); + + TBOX_ASSERT(diffcoef_data); for (bn = 0; bn < nboxes; ++bn) { const hier::BoundaryBox& boundary_box = bboxes[bn]; @@ -1525,7 +1569,7 @@ CellPoissonFACOps::ewingFixFlux( const hier::Index& bupper = bdry_box.upper(); const int location_index = boundary_box.getLocationIndex(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(ewingfixfluxvardc2d, EWINGFIXFLUXVARDC2D) ( + SAMRAI_F77_FUNC(ewingfixfluxvardc2d, EWINGFIXFLUXVARDC2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], &flux_data.getGhostCellWidth()[1], @@ -1537,11 +1581,11 @@ CellPoissonFACOps::ewingFixFlux( &soln_data.getGhostCellWidth()[1], &plower[0], &pupper[0], &plower[1], &pupper[1], &location_index, - &ratio_to_coarser[0], + &block_ratio[0], &blower[0], &bupper[0], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(ewingfixfluxvardc3d, EWINGFIXFLUXVARDC3D) ( + SAMRAI_F77_FUNC(ewingfixfluxvardc3d, EWINGFIXFLUXVARDC3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -1562,7 +1606,7 @@ CellPoissonFACOps::ewingFixFlux( &plower[1], &pupper[1], &plower[2], &pupper[2], &location_index, - &ratio_to_coarser[0], + &block_ratio[0], &blower[0], &bupper[0], dx); } else { @@ -1584,7 +1628,7 @@ CellPoissonFACOps::ewingFixFlux( const hier::Index& bupper = bdry_box.upper(); const int location_index = boundary_box.getLocationIndex(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(ewingfixfluxcondc2d, EWINGFIXFLUXCONDC2D) ( + SAMRAI_F77_FUNC(ewingfixfluxcondc2d, EWINGFIXFLUXCONDC2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], &flux_data.getGhostCellWidth()[1], @@ -1595,11 +1639,11 @@ CellPoissonFACOps::ewingFixFlux( &plower[0], &pupper[0], &plower[1], &pupper[1], &location_index, - &ratio_to_coarser[0], + &block_ratio[0], &blower[0], &bupper[0], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(ewingfixfluxcondc3d, EWINGFIXFLUXCONDC3D) ( + SAMRAI_F77_FUNC(ewingfixfluxcondc3d, EWINGFIXFLUXCONDC3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -1615,7 +1659,7 @@ CellPoissonFACOps::ewingFixFlux( &plower[1], &pupper[1], &plower[2], &pupper[2], &location_index, - &ratio_to_coarser[0], + &block_ratio[0], &blower[0], &bupper[0], dx); } @@ -1661,7 +1705,8 @@ CellPoissonFACOps::solveCoarsestLevel( TBOX_ERROR(d_object_name << ": Coarse level solver choice '" << d_coarse_solver_choice << "' unavailable in " - << "scapCellPoissonOps::solveCoarsestLevel."); + << "scapCellPoissonOps::solveCoarsestLevel." + << std::endl); #else return_value = solveCoarsestLevel_HYPRE(data, residual, coarsest_ln); #endif @@ -1669,7 +1714,8 @@ CellPoissonFACOps::solveCoarsestLevel( TBOX_ERROR( d_object_name << ": Bad coarse level solver choice '" << d_coarse_solver_choice - << "' in scapCellPoissonOps::solveCoarsestLevel."); + << "' in scapCellPoissonOps::solveCoarsestLevel." + << std::endl); } xeqScheduleGhostFillNoCoarse(data.getComponentDescriptorIndex(0), @@ -1700,17 +1746,18 @@ CellPoissonFACOps::solveCoarsestLevel_HYPRE( TBOX_ERROR(d_object_name << ": Coarse level solver choice '" << d_coarse_solver_choice << "' unavailable in " - << "CellPoissonFACOps::solveCoarsestLevel_HYPRE."); + << "CellPoissonFACOps::solveCoarsestLevel_HYPRE." + << std::endl); return 0; #else checkInputPatchDataIndices(); - d_hypre_solver.setStoppingCriteria(d_coarse_solver_max_iterations, + d_hypre_solver->setStoppingCriteria(d_coarse_solver_max_iterations, d_coarse_solver_tolerance); const int solver_ret = - d_hypre_solver.solveSystem( + d_hypre_solver->solveSystem( data.getComponentDescriptorIndex(0), residual.getComponentDescriptorIndex(0), true); @@ -1721,8 +1768,8 @@ CellPoissonFACOps::solveCoarsestLevel_HYPRE( if (d_enable_logging) tbox::plog << d_object_name << " Hypre solve " << (solver_ret ? "" : "NOT ") << "converged\n" - << "\titerations: " << d_hypre_solver.getNumberOfIterations() << "\n" - << "\tresidual: " << d_hypre_solver.getRelativeResidualNorm() << "\n"; + << "\titerations: " << d_hypre_solver->getNumberOfIterations() << "\n" + << "\tresidual: " << d_hypre_solver->getRelativeResidualNorm() << "\n"; return !solver_ret; @@ -1754,7 +1801,7 @@ CellPoissonFACOps::computeCompositeResidualOnLevel( || solution.getPatchHierarchy() != d_hierarchy || rhs.getPatchHierarchy() != d_hierarchy) { TBOX_ERROR(d_object_name << ": Vector hierarchy does not match\n" - "internal hierarchy."); + "internal hierarchy." << std::endl); } #endif boost::shared_ptr level(d_hierarchy->getPatchLevel(ln)); @@ -1825,11 +1872,15 @@ CellPoissonFACOps::computeCompositeResidualOnLevel( const boost::shared_ptr& patch = *pi; boost::shared_ptr > soln_data( - solution.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + solution.getComponentPatchData(0, *patch))); boost::shared_ptr > flux_data( - patch->getPatchData(flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(flux_id))); + + TBOX_ASSERT(soln_data); + TBOX_ASSERT(flux_data); + computeFluxOnPatch( *patch, level->getRatioToCoarserLevel(), @@ -1853,17 +1904,23 @@ CellPoissonFACOps::computeCompositeResidualOnLevel( pi != level->end(); ++pi) { const boost::shared_ptr& patch = *pi; boost::shared_ptr > soln_data( - solution.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + solution.getComponentPatchData(0, *patch))); boost::shared_ptr > rhs_data( - rhs.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + rhs.getComponentPatchData(0, *patch))); boost::shared_ptr > residual_data( - residual.getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + residual.getComponentPatchData(0, *patch))); boost::shared_ptr > flux_data( - patch->getPatchData(flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(flux_id))); + + TBOX_ASSERT(soln_data); + TBOX_ASSERT(rhs_data); + TBOX_ASSERT(residual_data); + TBOX_ASSERT(flux_data); + computeResidualOnPatch(*patch, *flux_data, *soln_data, @@ -1879,8 +1936,8 @@ CellPoissonFACOps::computeCompositeResidualOnLevel( * avoid writing another loop for it. */ boost::shared_ptr > oflux_data( - patch->getPatchData(d_oflux_scratch_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_oflux_scratch_id))); TBOX_ASSERT(oflux_data); @@ -1949,13 +2006,14 @@ CellPoissonFACOps::computeVectorWeights( int finest_ln) const { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); if (coarsest_ln == -1) coarsest_ln = 0; if (finest_ln == -1) finest_ln = hierarchy->getFinestLevelNumber(); if (finest_ln < coarsest_ln) { TBOX_ERROR(d_object_name - << ": Illegal level number range. finest_ln < coarsest_ln."); + << ": Illegal level number range. finest_ln < coarsest_ln." + << std::endl); } int ln; @@ -1970,8 +2028,11 @@ CellPoissonFACOps::computeVectorWeights( p != level->end(); ++p) { const boost::shared_ptr& patch = *p; boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + + TBOX_ASSERT(patch_geometry); + const double* dx = patch_geometry->getDx(); double cell_vol = dx[0]; if (d_dim > tbox::Dimension(1)) { @@ -1983,12 +2044,9 @@ CellPoissonFACOps::computeVectorWeights( } boost::shared_ptr > w( - patch->getPatchData(weight_id), - boost::detail::dynamic_cast_tag()); - if (!w) { - TBOX_ERROR(d_object_name - << ": weight id must refer to a pdat::CellVariable"); - } + BOOST_CAST, hier::PatchData>( + patch->getPatchData(weight_id))); + TBOX_ASSERT(w); w->fillAll(cell_vol); } @@ -2022,14 +2080,15 @@ CellPoissonFACOps::computeVectorWeights( p != level->end(); ++p) { const boost::shared_ptr& patch = *p; - for (hier::BoxContainer::iterator i(coarsened_boxes); + for (hier::BoxContainer::iterator i = coarsened_boxes.begin(); i != coarsened_boxes.end(); ++i) { hier::Box intersection = *i * (patch->getBox()); if (!intersection.empty()) { boost::shared_ptr > w( - patch->getPatchData(weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(weight_id))); + TBOX_ASSERT(w); w->fillAll(0.0, intersection); } // assignment only in non-empty intersection @@ -2058,31 +2117,25 @@ CellPoissonFACOps::checkInputPatchDataIndices() const boost::shared_ptr var; vdb.mapIndexToVariable(d_poisson_spec.getDPatchDataId(), var); boost::shared_ptr > diffcoef_var( - var, - boost::detail::dynamic_cast_tag()); - if (!diffcoef_var) { - TBOX_ERROR(d_object_name - << ": Bad diffusion coefficient patch data index."); - } + BOOST_CAST, hier::Variable>(var)); + + TBOX_ASSERT(diffcoef_var); } if (!d_poisson_spec.cIsConstant() && !d_poisson_spec.cIsZero()) { boost::shared_ptr var; vdb.mapIndexToVariable(d_poisson_spec.getCPatchDataId(), var); boost::shared_ptr > scalar_field_var( - var, - boost::detail::dynamic_cast_tag()); - if (!scalar_field_var) { - TBOX_ERROR(d_object_name << ": Bad linear term patch data index."); - } + BOOST_CAST, hier::Variable>(var)); + + TBOX_ASSERT(scalar_field_var); } if (d_flux_id != -1) { boost::shared_ptr var; vdb.mapIndexToVariable(d_flux_id, var); boost::shared_ptr > flux_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::Variable>(var)); TBOX_ASSERT(flux_var); } @@ -2104,15 +2157,16 @@ CellPoissonFACOps::computeFluxOnPatch( const pdat::CellData& w_data, pdat::SideData& Dgradw_data) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, patch, ratio_to_coarser_level, w_data, - Dgradw_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(d_dim, patch, ratio_to_coarser_level, + w_data, Dgradw_data); TBOX_ASSERT(patch.inHierarchy()); TBOX_ASSERT(w_data.getGhostCellWidth() >= hier::IntVector::getOne(ratio_to_coarser_level.getDim())); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Box& box = patch.getBox(); const int* lower = &box.lower()[0]; const int* upper = &box.upper()[0]; @@ -2121,7 +2175,7 @@ CellPoissonFACOps::computeFluxOnPatch( if (d_poisson_spec.dIsConstant()) { double D_value = d_poisson_spec.getDConstant(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compfluxcondc2d, COMPFLUXCONDC2D) ( + SAMRAI_F77_FUNC(compfluxcondc2d, COMPFLUXCONDC2D) ( Dgradw_data.getPointer(0), Dgradw_data.getPointer(1), &Dgradw_data.getGhostCellWidth()[0], @@ -2134,7 +2188,7 @@ CellPoissonFACOps::computeFluxOnPatch( &lower[1], &upper[1], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compfluxcondc3d, COMPFLUXCONDC3D) ( + SAMRAI_F77_FUNC(compfluxcondc3d, COMPFLUXCONDC3D) ( Dgradw_data.getPointer(0), Dgradw_data.getPointer(1), Dgradw_data.getPointer(2), @@ -2153,10 +2207,11 @@ CellPoissonFACOps::computeFluxOnPatch( } } else { boost::shared_ptr > D_data( - boost::dynamic_pointer_cast, hier::PatchData>( + BOOST_CAST, hier::PatchData>( patch.getPatchData(d_poisson_spec.getDPatchDataId()))); + TBOX_ASSERT(D_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compfluxvardc2d, COMPFLUXVARDC2D) ( + SAMRAI_F77_FUNC(compfluxvardc2d, COMPFLUXVARDC2D) ( Dgradw_data.getPointer(0), Dgradw_data.getPointer(1), &Dgradw_data.getGhostCellWidth()[0], @@ -2173,7 +2228,7 @@ CellPoissonFACOps::computeFluxOnPatch( dx); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compfluxvardc3d, COMPFLUXVARDC3D) ( + SAMRAI_F77_FUNC(compfluxvardc3d, COMPFLUXVARDC3D) ( Dgradw_data.getPointer(0), Dgradw_data.getPointer(1), Dgradw_data.getPointer(2), @@ -2216,12 +2271,13 @@ CellPoissonFACOps::computeResidualOnPatch( const pdat::CellData& rhs_data, pdat::CellData& residual_data) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS5(d_dim, patch, flux_data, soln_data, rhs_data, - residual_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY5(d_dim, patch, flux_data, soln_data, + rhs_data, residual_data); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Box& box = patch.getBox(); const int* lower = &box.lower()[0]; const int* upper = &box.upper()[0]; @@ -2230,10 +2286,11 @@ CellPoissonFACOps::computeResidualOnPatch( double scalar_field_constant; if (d_poisson_spec.cIsVariable()) { boost::shared_ptr > scalar_field_data( - boost::dynamic_pointer_cast, hier::PatchData>( + BOOST_CAST, hier::PatchData>( patch.getPatchData(d_poisson_spec.getCPatchDataId()))); + TBOX_ASSERT(scalar_field_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compresvarsca2d, COMPRESVARSCA2D) ( + SAMRAI_F77_FUNC(compresvarsca2d, COMPRESVARSCA2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2253,7 +2310,7 @@ CellPoissonFACOps::computeResidualOnPatch( &lower[0], &upper[0], &lower[1], &upper[1], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compresvarsca3d, COMPRESVARSCA3D) ( + SAMRAI_F77_FUNC(compresvarsca3d, COMPRESVARSCA3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2282,7 +2339,7 @@ CellPoissonFACOps::computeResidualOnPatch( } else if (d_poisson_spec.cIsConstant()) { scalar_field_constant = d_poisson_spec.getCConstant(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( + SAMRAI_F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2300,7 +2357,7 @@ CellPoissonFACOps::computeResidualOnPatch( &lower[0], &upper[0], &lower[1], &upper[1], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( + SAMRAI_F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2326,7 +2383,7 @@ CellPoissonFACOps::computeResidualOnPatch( } else { scalar_field_constant = 0.0; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( + SAMRAI_F77_FUNC(compresconsca2d, COMPRESCONSCA2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2344,7 +2401,7 @@ CellPoissonFACOps::computeResidualOnPatch( &lower[0], &upper[0], &lower[1], &upper[1], dx); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( + SAMRAI_F77_FUNC(compresconsca3d, COMPRESCONSCA3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2379,13 +2436,15 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( char red_or_black, double* p_maxres) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, patch, flux_data, soln_data, rhs_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(d_dim, patch, flux_data, soln_data, + rhs_data); TBOX_ASSERT(red_or_black == 'r' || red_or_black == 'b'); const int offset = red_or_black == 'r' ? 0 : 1; boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Box& box = patch.getBox(); const int* lower = &box.lower()[0]; const int* upper = &box.upper()[0]; @@ -2397,25 +2456,26 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( double diffcoef_constant; if (d_poisson_spec.cIsVariable()) { - scalar_field_data = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_poisson_spec.getCPatchDataId())); + scalar_field_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_poisson_spec.getCPatchDataId())); } else if (d_poisson_spec.cIsConstant()) { scalar_field_constant = d_poisson_spec.getCConstant(); } else { scalar_field_constant = 0.0; } if (d_poisson_spec.dIsVariable()) { - diffcoef_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_poisson_spec.getDPatchDataId())); + diffcoef_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_poisson_spec.getDPatchDataId())); } else { diffcoef_constant = d_poisson_spec.getDConstant(); } double maxres = 0.0; if (d_poisson_spec.dIsVariable() && d_poisson_spec.cIsVariable()) { + TBOX_ASSERT(scalar_field_data); + TBOX_ASSERT(diffcoef_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxvardcvarsf2d, RBGSWITHFLUXMAXVARDCVARSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcvarsf2d, RBGSWITHFLUXMAXVARDCVARSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2438,7 +2498,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxvardcvarsf3d, RBGSWITHFLUXMAXVARDCVARSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcvarsf3d, RBGSWITHFLUXMAXVARDCVARSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2470,8 +2530,9 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( &offset, &maxres); } } else if (d_poisson_spec.dIsVariable() && d_poisson_spec.cIsConstant()) { + TBOX_ASSERT(diffcoef_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2492,7 +2553,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2521,8 +2582,9 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( &offset, &maxres); } } else if (d_poisson_spec.dIsVariable() && d_poisson_spec.cIsZero()) { + TBOX_ASSERT(diffcoef_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf2d, RBGSWITHFLUXMAXVARDCCONSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2543,7 +2605,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxvardcconsf3d, RBGSWITHFLUXMAXVARDCCONSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2572,8 +2634,9 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( &offset, &maxres); } } else if (!d_poisson_spec.dIsVariable() && d_poisson_spec.cIsVariable()) { + TBOX_ASSERT(scalar_field_data); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxcondcvarsf2d, RBGSWITHFLUXMAXCONDCVARSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcvarsf2d, RBGSWITHFLUXMAXCONDCVARSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2593,7 +2656,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxcondcvarsf3d, RBGSWITHFLUXMAXCONDCVARSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcvarsf3d, RBGSWITHFLUXMAXCONDCVARSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2621,7 +2684,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( } } else if (!d_poisson_spec.dIsVariable() && d_poisson_spec.cIsConstant()) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2639,7 +2702,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2664,7 +2727,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( } } else if (!d_poisson_spec.dIsVariable() && d_poisson_spec.cIsZero()) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf2d, RBGSWITHFLUXMAXCONDCCONSF2D) ( flux_data.getPointer(0), flux_data.getPointer(1), &flux_data.getGhostCellWidth()[0], @@ -2682,7 +2745,7 @@ CellPoissonFACOps::redOrBlackSmoothingOnPatch( dx, &offset, &maxres); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( + SAMRAI_F77_FUNC(rbgswithfluxmaxcondcconsf3d, RBGSWITHFLUXMAXCONDCCONSF3D) ( flux_data.getPointer(0), flux_data.getPointer(1), flux_data.getPointer(2), @@ -2718,9 +2781,9 @@ CellPoissonFACOps::xeqScheduleProlongation( int dest_ln) { if (!d_prolongation_refine_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } - xfer::RefineAlgorithm refiner(d_dim); + xfer::RefineAlgorithm refiner; refiner.registerRefine(dst_id, src_id, scr_id, @@ -2738,7 +2801,7 @@ CellPoissonFACOps::xeqScheduleURestriction( int dest_ln) { if (!d_urestriction_coarsen_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } xfer::CoarsenAlgorithm coarsener(d_dim); @@ -2758,7 +2821,7 @@ CellPoissonFACOps::xeqScheduleRRestriction( int dest_ln) { if (!d_rrestriction_coarsen_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } xfer::CoarsenAlgorithm coarsener(d_dim); @@ -2778,7 +2841,7 @@ CellPoissonFACOps::xeqScheduleFluxCoarsen( int dest_ln) { if (!d_flux_coarsen_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } xfer::CoarsenAlgorithm coarsener(d_dim); @@ -2797,9 +2860,9 @@ CellPoissonFACOps::xeqScheduleGhostFill( int dest_ln) { if (!d_ghostfill_refine_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } - xfer::RefineAlgorithm refiner(d_dim); + xfer::RefineAlgorithm refiner; refiner. registerRefine(dst_id, dst_id, @@ -2818,9 +2881,9 @@ CellPoissonFACOps::xeqScheduleGhostFillNoCoarse( int dest_ln) { if (!d_ghostfill_nocoarse_refine_schedules[dest_ln]) { - TBOX_ERROR("Expected schedule not found."); + TBOX_ERROR("Expected schedule not found." << std::endl); } - xfer::RefineAlgorithm refiner(d_dim); + xfer::RefineAlgorithm refiner; refiner. registerRefine(dst_id, dst_id, @@ -2836,7 +2899,7 @@ CellPoissonFACOps::xeqScheduleGhostFillNoCoarse( void CellPoissonFACOps::finalizeCallback() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { s_cell_scratch_var[d].reset(); s_flux_scratch_var[d].reset(); s_oflux_scratch_var[d].reset(); @@ -2845,4 +2908,3 @@ CellPoissonFACOps::finalizeCallback() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.h index 8003e264..517b4a2b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACOps.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operator class for cell-centered scalar Poisson using FAC * ************************************************************************/ @@ -45,7 +45,7 @@ #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -103,36 +103,120 @@ namespace solv { * Hence, it owns none of the solution vectors, error vectors, * diffusion coefficient data, or any such things. * - * Input Examples - * @verbatim - * coarse_solver_choice = "hypre" // see setCoarsestLevelSolverChoice() - * coarse_solver_tolerance = 1e-14 // see setCoarsestLevelSolverTolerance() - * coarse_solver_max_iterations = 10 // see setCoarsestLevelSolverMaxIterations() - * smoothing_choice = "redblack" // see setSmoothingChoice() - * cf_discretization = "Ewing" // see setCoarseFineDiscretization() - * prolongation_method = "LINEAR_REFINE" // see setProlongationMethod() - * hypre_solver = { ... } // tbox::Database for initializing Hypre solver - * @endverbatim + * Input Parameters + * + * Definitions: + * - \b coarse_solver_choice + * + * - \b coarse_solver_tolerance + * + * - \b coarse_solver_max_iterations + * + * - \b cf_discretization + * + * - \b prolongation_method + * + * - \b enable_logging + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
coarse_solver_choicestring"hypre""hypre", "redblack", "jacobi"optNot written to restart. Value in input db used.
coarse_solver_tolerancedouble1e-14>0.0optNot written to restart. Value in input db used.
coarse_solver_max_iterationsint10>=1opt + * Not written to restart. Value in input db used.
cf_discretizationstring"Ewing""Ewing", "CONSTANT_REFINE", "CONSERVATIVE_LINEAR_REFINE", "LINEAR_REFINE"optNot written to restart. Value in input db used.
prolongation_methodstring"LINEAR_REFINE""CONSTANT_REFINE", "CONSERVATIVE_LINEAR_REFINE", "LINEAR_REFINE"optNot written to restart. Value in input db used.
enable_loggingboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
+ * */ class CellPoissonFACOps: public FACOperatorStrategy { public: +#ifdef HAVE_HYPRE /*! * @brief Constructor. * * If you want standard output and logging, * pass in valid pointers for those streams. * @param dim - * @param object_name Ojbect name - * @param database Input database + * @param object_name Object name + * @param hypre_solver underlying hypre solver + * @param input_db Input database */ - explicit CellPoissonFACOps( + CellPoissonFACOps( + const boost::shared_ptr& hypre_solver, const tbox::Dimension& dim, const std::string& object_name = std::string(), - const boost::shared_ptr& database = + const boost::shared_ptr& input_db = boost::shared_ptr()); +#else + /*! + * @brief Constructor. + * + * If you want standard output and logging, + * pass in valid pointers for those streams. + * @param dim + * @param object_name Object name + * @param input_db Input database + */ + CellPoissonFACOps( + const tbox::Dimension& dim, + const std::string& object_name = std::string(), + const boost::shared_ptr& input_db = + boost::shared_ptr()); +#endif /*! * @brief Destructor. @@ -151,208 +235,6 @@ class CellPoissonFACOps: d_poisson_spec = spec; } - /*! - * @brief Enable logging. - * - * By default, logging is disabled. The logging flag is - * propagated to the major components used by this class. - */ - void - enableLogging( - bool enable_logging) - { - d_enable_logging = enable_logging; - } - - //@{ - /*! - * @name Functions for setting solver mathematic algorithm controls - */ - - /*! - * @brief Set the choice of smoothing algorithms. - * - * Current smoothing choices are: - * - "redblack": Red-black Gauss-Seidel smoothing. - */ - void - setSmoothingChoice( - const std::string& smoothing_choice) - { -#ifdef DEBUG_CHECK_ASSERTIONS - if (smoothing_choice != "redblack") { - TBOX_ERROR(d_object_name << ": Bad smoothing choice '" - << smoothing_choice - << "' in CellPoissonFACOps::setSmoothingChoice."); - } -#endif - d_smoothing_choice = smoothing_choice; - } - - /*! - * @brief Set coarse level solver. - * - * Select from these: - * - @c "redblack" (red-black smoothing until convergence--very slow!) - * - @c "hypre" (only if the HYPRE library is available). - */ - void - setCoarsestLevelSolverChoice( - const std::string& choice) - { -#ifdef DEBUG_CHECK_ASSERTIONS -#ifndef HAVE_HYPRE - if (choice == "hypre") { - TBOX_ERROR(d_object_name << ": HYPRe library is not available.\n"); - } -#endif -#endif - if (choice == "redblack" || choice == "hypre") { - d_coarse_solver_choice = choice; - } else { - TBOX_ERROR( - d_object_name << ": Bad coarse level solver choice '" - << choice - << "' in scapCellPoissonOpsX::setCoarseLevelSolver."); - } - } - - /*! - * @brief Set tolerance for coarse level solve. - * - * If the coarse level solver requires a tolerance (currently, they all do), - * the specified value is used. - */ - void - setCoarsestLevelSolverTolerance( - double tol) - { - d_coarse_solver_tolerance = tol; - } - - /*! - * @brief Set max iterations for coarse level solve. - * - * If the coarse level solver requires a max iteration limit - * (currently, they all do), the specified value is used. - */ - void - setCoarsestLevelSolverMaxIterations( - int max_iterations) - { -#ifdef DEBUG_CHECK_ASSERTIONS - if (max_iterations < 0) { - TBOX_ERROR(d_object_name << ": Invalid number of max iterations\n"); - } -#endif - d_coarse_solver_max_iterations = max_iterations; - } - - /*! - * @brief Set the coarse-fine boundary discretization method. - * - * Specify the @c op_name std::string which will be passed to - * xfer::Geometry::lookupRefineOperator() to get the operator - * for setting fine grid ghost cells from the coarse grid. - * Note that chosing this operator implicitly choses the - * discretization method at the coarse-fine boundary. - * - * There is one important instance where this std::string is - * @em not passed to xfer::Geometry::lookupRefineOperator. - * If this variable is set to "Ewing", Ewing's coarse-fine - * discretization is used (a constant refinement is performed, - * and the flux is later corrected to result in Ewing's scheme). - * For a reference to Ewing's discretization method, see - * "Local Refinement Techniques for Elliptic Problems on Cell-Centered - * Grids, I. Error Analysis", Mathematics of Computation, Vol. 56, No. 194, - * April 1991, pp. 437-461. - * - * @param coarsefine_method String selecting the coarse-fine discretization method. - */ - void - setCoarseFineDiscretization( - const std::string& coarsefine_method) - { -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_hierarchy) { - TBOX_ERROR( - d_object_name << ": Cannot change coarse-fine\n" - << "discretization method while operator state\n" - << "is initialized because that causes a\n" - << "corruption in the state.\n"); - } -#endif - d_cf_discretization = coarsefine_method; - } - - /*! - * @brief Set the name of the prolongation method. - * - * Specify the @c op_name std::string which will be passed to - * xfer::Geometry::lookupRefineOperator() to get the operator - * for prolonging the coarse-grid correction. - * - * By default, "CONSTANT_REFINE" is used. "LINEAR_REFINE" seems to - * to lead to faster convergence, but it does NOT satisfy the Galerkin - * condition. - * - * Prolonging using linear refinement requires a Robin bc - * coefficient implementation that is capable of delivering - * coefficients for non-hierarchy data, because linear refinement - * requires boundary conditions to be set on temporary levels. - * - * @param prolongation_method String selecting the coarse-fine - * discretization method. - */ - void - setProlongationMethod( - const std::string& prolongation_method) - { -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_hierarchy) { - TBOX_ERROR( - d_object_name << ": Cannot change prolongation method\n" - << "while operator state is initialized because\n" - << "that causes a corruption in the state.\n"); - } -#endif - d_prolongation_method = prolongation_method; - } - -#ifdef HAVE_HYPRE - /*! - * @brief Set whether to use Hypre's PFMG algorithm instead of the - * SMG algorithm. - * - * This flag affects the Hypre solver (used to solve the coarsest level). - * The flag is used to select which of HYPRE's linear solver algorithms - * to use if true, the semicoarsening multigrid algorithm is used, and if - * false, the ``PF'' multigrid algorithm is used. - * By default, the SMG algorithm is used. - * - * This setting has effect only when Hypre is chosen for the coarsest - * level solver. See setCoarsestLevelSolverChoice(). - * - * Changing the algorithm must be done before initializing the solver - * state and must NOT be done while the state is initialized - * (the program will exit), as that would corrupt the state. - */ - void - setUseSMG( - bool use_smg) - { - if (d_hierarchy) { - TBOX_ERROR( - d_object_name << ": setUseSMG(bool) may NOT be called\n" - << "while the solver state is initialized, as that\n" - << "would lead to a corrupted solver state.\n"); - } - d_hypre_solver.setUseSMG(use_smg); - } -#endif - - //@} - //@{ /*! * @name Functions for setting patch data indices and coefficients @@ -362,7 +244,7 @@ class CellPoissonFACOps: * @brief Set the scratch patch data index for the flux. * * The use of this function is optional. - * The patch data index should be a pdat::SideData type of variable. + * The patch data index should be a pdat::SideData type of variable. * If the flux id is -1 (the default initial value), scratch space * for the flux is allocated as needed and immediately deallocated * afterward, level by level. If you have space preallocated for @@ -407,7 +289,7 @@ class CellPoissonFACOps: d_physical_bc_coef = physical_bc_coef; d_bc_helper.setCoefImplementation(physical_bc_coef); #ifdef HAVE_HYPRE - d_hypre_solver.setPhysicalBcCoefObject(d_physical_bc_coef); + d_hypre_solver->setPhysicalBcCoefObject(d_physical_bc_coef); #endif } @@ -455,6 +337,10 @@ class CellPoissonFACOps: * @param finest_ln Finest level number. Must be included * in hierarchy. Must not be less than @c coarsest_ln. * Default to finest level in @c hierarchy. + * + * @pre hierarchy + * @pre d_dim == hierarchy->getDim() + * @pre finest_ln >= coarsest_ln */ void computeVectorWeights( @@ -505,6 +391,12 @@ class CellPoissonFACOps: * is level zero, this is ignored * @param w_data cell-centered data * @param Dgradw_data side-centered flux data (i.e., D (grad w)) + * + * @pre (d_dim == patch.getDim()) && + * (d_dim == ratio_to_coarser_level.getDim()) && + * (d_dim == w_data.getDim()) && (d_dim == Dgradw_data.getDim()) + * @pre patch.inHierarchy() + * @pre w_data.getGhostCellWidth() >= hier::IntVector::getOne(ratio_to_coarser_level.getDim()) */ void computeFluxOnPatch( @@ -586,7 +478,22 @@ class CellPoissonFACOps: return d_object_name; } +protected: + /*! + * @brief Read parameters from input database. + * + * @param input_db Input Database. + */ + void + getFromInput( + const boost::shared_ptr& input_db); + private: + // Internals of both constructors + void + buildObject( + const boost::shared_ptr& input_db); + //@{ /*! * @name Private workhorse functions. @@ -603,6 +510,9 @@ class CellPoissonFACOps: * @param num_sweeps number of sweeps * @param residual_tolerance the maximum residual considered to be * converged + * + * @pre data.getPatchHierarchy() == d_hierarchy && + * residual.getPatchHierarchy() == d_hierarchy */ void smoothErrorByRedBlack( @@ -636,10 +546,11 @@ class CellPoissonFACOps: * @param patch patch * @param soln_data cell-centered solution data * @param flux_data side-centered flux data - * @param diffcoef_data side-centered diffusion coefficient data - * @param cfb coarse-fine boundary object for the level - * in which patch resides * @param ratio_to_coarser Refinement ratio to the next coarser level. + * + * @pre (d_dim == patch.getDim()) && (d_dim == soln_data.getDim()) && + * (d_dim == flux_data.getDim()) && + * (d_dim == ratio_to_coarser.getDim()) */ void ewingFixFlux( @@ -657,6 +568,10 @@ class CellPoissonFACOps: * @param soln_data cell-centered solution data * @param rhs_data cell-centered rhs data * @param residual_data cell-centered residual data + * + * @pre (d_dim = patch.getDim()) && (d_dim == flux_data.getDim()) && + * (d_dim == soln_data.getDim()) && (d_dim == rhs_data.getDim()) && + * (d_dim == residual_data.getDim()) */ void computeResidualOnPatch( @@ -673,11 +588,13 @@ class CellPoissonFACOps: * @param patch patch * @param flux_data side-centered flux data * @param rhs_data cell-centered rhs data - * @param scalar_field_data - * cell-centered scalar field data * @param soln_data cell-centered solution data * @param red_or_black red-black switch. Set to 'r' or 'b'. * @param p_maxres max residual output. Set to NULL to avoid computing. + * + * @pre (d_dim == patch.getDim()) && (d_dim == flux_data.getDim()) && + * (d_dim == soln_data.getDim()) && (d_dim == rhs_data.getDim()) + * @pre (red_or_black == 'r') || (red_or_black == 'b') */ void redOrBlackSmoothingOnPatch( @@ -686,7 +603,7 @@ class CellPoissonFACOps: const pdat::CellData& rhs_data, pdat::CellData& soln_data, char red_or_black, - double* p_maxres = NULL) const; + double* p_maxres = 0) const; //@} @@ -740,6 +657,8 @@ class CellPoissonFACOps: * * * @return refinement schedule for prolongation + * + * @pre d_prolongation_refine_schedules[dest_ln] */ void xeqScheduleProlongation( @@ -755,6 +674,8 @@ class CellPoissonFACOps: * See general notes for xeqScheduleProlongation(). * * @return coarsening schedule for restriction + * + * @pre d_urestriction_coarsen_schedules[dest_ln] */ void xeqScheduleURestriction( @@ -769,6 +690,8 @@ class CellPoissonFACOps: * See general notes for xeqScheduleProlongation(). * * @return coarsening schedule for restriction + * + * @pre d_rrestriction_coarsen_schedules[dest_ln] */ void xeqScheduleRRestriction( @@ -784,6 +707,8 @@ class CellPoissonFACOps: * * @return coarsening schedule for setting composite grid flux at * coarse-fine boundaries. + * + * @pre d_flux_coarsen_schedules[dest_ln] */ void xeqScheduleFluxCoarsen( @@ -799,6 +724,8 @@ class CellPoissonFACOps: * * @return refine schedule for filling ghost data from coarser level * and physical bc. + * + * @pre d_ghostfill_refine_schedules[dest_ln] */ void xeqScheduleGhostFill( @@ -818,6 +745,8 @@ class CellPoissonFACOps: * * @return refine schedule for filling ghost data from same level * and physical bc. + * + * @pre d_ghostfill_nocoarse_refine_schedules[dest_ln] */ void xeqScheduleGhostFillNoCoarse( @@ -890,7 +819,7 @@ class CellPoissonFACOps: * hier::CoarseFineBoundary is a light object before * it is set for a level. */ - tbox::Array > d_cf_boundary; + std::vector > d_cf_boundary; //@} @@ -905,21 +834,13 @@ class CellPoissonFACOps: */ PoissonSpecifications d_poisson_spec; - /*! - * @brief Smoothing choice. - * @see setSmoothingChoice. - */ - std::string d_smoothing_choice; - /*! * @brief Coarse level solver. - * @see setCoarsestLevelSolverChoice */ std::string d_coarse_solver_choice; /*! * @brief Coarse-fine discretization method. - * @see setCoarseFineDiscretization(). */ std::string d_cf_discretization; @@ -928,20 +849,16 @@ class CellPoissonFACOps: * * The name of the refinement operator used to prolong the * coarse grid correction. - * - * @see setProlongationMethod() */ std::string d_prolongation_method; /*! * @brief Tolerance specified to coarse solver - * @see setCoarsestLevelSolverTolerance() */ double d_coarse_solver_tolerance; /*! * @brief Coarse level solver iteration limit. - * @see setCoarsestLevelSolverMaxIterations() */ int d_coarse_solver_max_iterations; @@ -974,7 +891,7 @@ class CellPoissonFACOps: /*! * @brief HYPRE coarse-level solver object. */ - CellPoissonHypreSolver d_hypre_solver; + boost::shared_ptr d_hypre_solver; #endif /*! @@ -989,13 +906,13 @@ class CellPoissonFACOps: //@{ @name Internal context and scratch data static boost::shared_ptr > - s_cell_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_cell_scratch_var[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_flux_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_flux_scratch_var[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_oflux_scratch_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_oflux_scratch_var[SAMRAI::MAX_DIM_VAL]; /*! * @brief Default context of internally maintained hierarchy data. @@ -1044,37 +961,39 @@ class CellPoissonFACOps: //! @brief Error prolongation (refinement) operator. boost::shared_ptr d_prolongation_refine_operator; boost::shared_ptr d_prolongation_refine_algorithm; - tbox::Array > + std::vector > d_prolongation_refine_schedules; //! @brief Solution restriction (coarsening) operator. boost::shared_ptr d_urestriction_coarsen_operator; boost::shared_ptr d_urestriction_coarsen_algorithm; - tbox::Array > + std::vector > d_urestriction_coarsen_schedules; //! @brief Residual restriction (coarsening) operator. boost::shared_ptr d_rrestriction_coarsen_operator; boost::shared_ptr d_rrestriction_coarsen_algorithm; - tbox::Array > + std::vector > d_rrestriction_coarsen_schedules; //! @brief Coarsen operator for outerflux-to-flux boost::shared_ptr d_flux_coarsen_operator; boost::shared_ptr d_flux_coarsen_algorithm; - tbox::Array > + std::vector > d_flux_coarsen_schedules; //! @brief Refine operator for cell-like data from coarser level. boost::shared_ptr d_ghostfill_refine_operator; boost::shared_ptr d_ghostfill_refine_algorithm; - tbox::Array > + std::vector > d_ghostfill_refine_schedules; //! @brief Refine operator for cell-like data from same level. - boost::shared_ptr d_ghostfill_nocoarse_refine_operator; - boost::shared_ptr d_ghostfill_nocoarse_refine_algorithm; - tbox::Array > + boost::shared_ptr + d_ghostfill_nocoarse_refine_operator; + boost::shared_ptr + d_ghostfill_nocoarse_refine_algorithm; + std::vector > d_ghostfill_nocoarse_refine_schedules; //@} @@ -1109,6 +1028,12 @@ class CellPoissonFACOps: /*! * @brief Preconditioner using this object. * + * This must remain a raw pointer. Do not attempt to make this a smart + * pointer. The preconditioner and this class have data members referring + * to each other. If this is made into a smart pointer then things will not + * tear themselves down properly leading to memory leaks unless there is + * explicit action to reset the smart pointer. + * * See setPreconditioner(). */ const FACPreconditioner* d_preconditioner; @@ -1134,8 +1059,7 @@ class CellPoissonFACOps: boost::shared_ptr t_compute_composite_residual; boost::shared_ptr t_compute_residual_norm; - static tbox::StartupShutdownManager::Handler - s_finalize_handler; + static tbox::StartupShutdownManager::Handler s_finalize_handler; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.C index de47a0f0..272ecb49 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: High-level solver (wrapper) for scalar poisson equation. * ************************************************************************/ -#ifndef included_solv_CellPoissonFACSolver_C -#define included_solv_CellPoissonFACSolver_C - #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/solv/CellPoissonFACSolver.h" #include "SAMRAI/tbox/PIO.h" @@ -29,10 +26,8 @@ namespace solv { */ bool CellPoissonFACSolver::s_initialized = 0; -int CellPoissonFACSolver::s_weight_id[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; -int CellPoissonFACSolver::s_instance_counter[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; +int CellPoissonFACSolver::s_weight_id[SAMRAI::MAX_DIM_VAL] = { 0 }; +int CellPoissonFACSolver::s_instance_counter[SAMRAI::MAX_DIM_VAL] = { 0 }; /* ************************************************************************* @@ -52,13 +47,15 @@ int CellPoissonFACSolver::s_instance_counter[tbox::Dimension:: CellPoissonFACSolver::CellPoissonFACSolver( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database): + const boost::shared_ptr& fac_precond, + const boost::shared_ptr& fac_ops, + const boost::shared_ptr& input_db): d_dim(dim), d_object_name(object_name), d_poisson_spec(object_name + "::poisson_spec"), - d_fac_ops(d_dim, object_name + "::fac_ops"), - d_fac_precond(object_name + "::fac_precond", d_fac_ops), - d_bc_object(NULL), + d_fac_ops(fac_ops), + d_fac_precond(fac_precond), + d_bc_object(0), d_simple_bc(d_dim, object_name + "::bc"), d_ln_min(-1), d_ln_max(-1), @@ -72,21 +69,14 @@ CellPoissonFACSolver::CellPoissonFACSolver( initializeStatics(); } - setMaxCycles(10); - setResidualTolerance(1e-6); - setPresmoothingSweeps(1); - setPostsmoothingSweeps(1); - setCoarseFineDiscretization("Ewing"); -#ifdef HAVE_HYPRE - setCoarsestLevelSolverChoice("hypre"); - setCoarsestLevelSolverTolerance(1e-10); - setCoarsestLevelSolverMaxIterations(20); - setUseSMG(true); -#else - setCoarsestLevelSolverChoice("redblack"); - setCoarsestLevelSolverTolerance(1e-8); - setCoarsestLevelSolverMaxIterations(500); -#endif + /* + * The FAC operator optionally uses the preconditioner + * to get data for logging. + */ + d_fac_ops->setPreconditioner(d_fac_precond.get()); + + // Read user input. + getFromInput(input_db); /* * Construct integer tag variables and add to variable database. Note that @@ -101,8 +91,8 @@ CellPoissonFACSolver::CellPoissonFACSolver( static std::string weight_variable_name("CellPoissonFACSolver_weight"); boost::shared_ptr > weight( - var_db->getVariable(weight_variable_name), - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var_db->getVariable(weight_variable_name))); if (!weight) { weight.reset( new pdat::CellVariable(d_dim, weight_variable_name, 1)); @@ -114,23 +104,7 @@ CellPoissonFACSolver::CellPoissonFACSolver( hier::IntVector::getZero(d_dim)); } - /* - * The default RobinBcCoefStrategy used, - * SimpleCellRobinBcCoefs only works with constant refine - * for prolongation. So we use constant refinement - * for prolongation by default. - */ - setProlongationMethod("CONSTANT_REFINE"); - - /* - * The FAC operator optionally uses the preconditioner - * to get data for logging. - */ - d_fac_ops.setPreconditioner((const FACPreconditioner *)(&d_fac_precond)); - - getFromInput(database); - - s_instance_counter[d_dim.getValue() - 1]++; + ++s_instance_counter[d_dim.getValue() - 1]; } /* @@ -144,7 +118,7 @@ CellPoissonFACSolver::CellPoissonFACSolver( CellPoissonFACSolver::~CellPoissonFACSolver() { - s_instance_counter[d_dim.getValue() - 1]--; + --s_instance_counter[d_dim.getValue() - 1]; deallocateSolverState(); @@ -171,55 +145,10 @@ CellPoissonFACSolver::~CellPoissonFACSolver() void CellPoissonFACSolver::getFromInput( - const boost::shared_ptr& database) + const boost::shared_ptr& input_db) { - if (database) { - if (database->isBool("enable_logging")) { - bool logging = database->getBool("enable_logging"); - enableLogging(logging); - } - if (database->isInteger("max_cycles")) { - int max_cycles = database->getInteger("max_cycles"); - setMaxCycles(max_cycles); - } - if (database->isDouble("residual_tol")) { - double residual_tol = database->getDouble("residual_tol"); - setResidualTolerance(residual_tol); - } - if (database->isInteger("num_pre_sweeps")) { - int num_pre_sweeps = database->getInteger("num_pre_sweeps"); - setPresmoothingSweeps(num_pre_sweeps); - } - if (database->isInteger("num_post_sweeps")) { - int num_post_sweeps = database->getInteger("num_post_sweeps"); - setPostsmoothingSweeps(num_post_sweeps); - } - if (database->isString("coarse_fine_discretization")) { - std::string s = database->getString("coarse_fine_discretization"); - setCoarseFineDiscretization(s); - } - if (database->isString("prolongation_method")) { - std::string s = database->getString("prolongation_method"); - setProlongationMethod(s); - } - if (database->isString("coarse_solver_choice")) { - std::string s = database->getString("coarse_solver_choice"); - setCoarsestLevelSolverChoice(s); - } - if (database->isDouble("coarse_solver_tolerance")) { - double tol = database->getDouble("coarse_solver_tolerance"); - setCoarsestLevelSolverTolerance(tol); - } - if (database->isInteger("coarse_solver_max_iterations")) { - int itr = database->getInteger("coarse_solver_max_iterations"); - setCoarsestLevelSolverMaxIterations(itr); - } -#ifdef HAVE_HYPRE - if (database->isBool("use_smg")) { - bool smg = database->getBool("use_smg"); - setUseSMG(smg); - } -#endif + if (input_db) { + d_enable_logging = input_db->getBoolWithDefault("enable_logging", false); } } @@ -245,9 +174,9 @@ CellPoissonFACSolver::initializeSolverState( const int fine_level) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); - if (d_bc_object == NULL) { + if (d_bc_object == 0) { TBOX_ERROR( d_object_name << ": No BC coefficient strategy object!\n" << "Use either setBoundaries or setPhysicalBcCoefObject\n" @@ -260,12 +189,6 @@ CellPoissonFACSolver::initializeSolverState( } #endif -#ifdef DEBUG_CHECK_ASSERTIONS - if (!hierarchy) { - TBOX_ERROR(d_object_name << ": NULL hierarchy pointer not allowed\n" - << "in inititialization."); - } -#endif d_hierarchy = hierarchy; d_ln_min = coarse_level; @@ -290,7 +213,7 @@ CellPoissonFACSolver::initializeSolverState( s_weight_id[d_dim.getValue() - 1]); } - d_fac_ops.computeVectorWeights(d_hierarchy, + d_fac_ops->computeVectorWeights(d_hierarchy, s_weight_id[d_dim.getValue() - 1], d_ln_min, d_ln_max); @@ -306,11 +229,11 @@ CellPoissonFACSolver::initializeSolverState( } } - d_fac_ops.setPoissonSpecifications(d_poisson_spec); + d_fac_ops->setPoissonSpecifications(d_poisson_spec); createVectorWrappers(solution, rhs); - d_fac_precond.initializeSolverState(*d_uv, *d_fv); + d_fac_precond->initializeSolverState(*d_uv, *d_fv); d_solver_is_initialized = true; } @@ -320,7 +243,7 @@ CellPoissonFACSolver::deallocateSolverState() { if (d_hierarchy) { - d_fac_precond.deallocateSolverState(); + d_fac_precond->deallocateSolverState(); /* * Delete internally managed data. @@ -349,7 +272,7 @@ CellPoissonFACSolver::setBoundaries( int* bdry_types) { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_bc_object != NULL && d_bc_object != &d_simple_bc) { + if (d_bc_object != 0 && d_bc_object != &d_simple_bc) { TBOX_ERROR( d_object_name << ": Bad attempt to set boundary condition\n" << "by using default bc object after it has been overriden.\n"); @@ -360,7 +283,7 @@ CellPoissonFACSolver::setBoundaries( flags, bdry_types); d_bc_object = &d_simple_bc; - d_fac_ops.setPhysicalBcCoefObject(d_bc_object); + d_fac_ops->setPhysicalBcCoefObject(d_bc_object); } /* @@ -407,7 +330,7 @@ CellPoissonFACSolver::solveSystem( createVectorWrappers(u, f); bool solver_rval; - solver_rval = d_fac_precond.solveSystem(*d_uv, *d_fv); + solver_rval = d_fac_precond->solveSystem(*d_uv, *d_fv); if (d_bc_object == &d_simple_bc) { /* @@ -443,7 +366,7 @@ CellPoissonFACSolver::solveSystem( int fine_ln) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); if (d_enable_logging) { tbox::plog << "CellPoissonFACSolver::solveSystem (" << d_object_name @@ -458,10 +381,6 @@ CellPoissonFACSolver::solveSystem( << "solver state is uninitialized. You should deallocate\n" << "the solver state or use solveSystem(int,int).\n"); } - if (!hierarchy) { - TBOX_ERROR(d_object_name << ".solveSystem(): Null hierarchy\n" - << "specified.\n"); - } #endif initializeSolverState(u, f, hierarchy, coarse_ln, fine_ln); @@ -482,10 +401,10 @@ CellPoissonFACSolver::createVectorWrappers( boost::shared_ptr variable; if (!d_uv || d_uv->getComponentDescriptorIndex(0) != u) { - d_uv.reset(new SAMRAIVectorReal(d_object_name + "::uv", - d_hierarchy, - d_ln_min, - d_ln_max)); + d_uv.reset(new SAMRAIVectorReal(d_object_name + "::uv", + d_hierarchy, + d_ln_min, + d_ln_max)); vdb.mapIndexToVariable(u, variable); #ifdef DEBUG_CHECK_ASSERTIONS if (!variable) { @@ -493,21 +412,17 @@ CellPoissonFACSolver::createVectorWrappers( << u << "\n"); } boost::shared_ptr > cell_variable( - variable, - boost::detail::dynamic_cast_tag()); - if (!cell_variable) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << u - << " is not a cell-double variable.\n"); - } + BOOST_CAST, hier::Variable>(variable)); + TBOX_ASSERT(cell_variable); #endif d_uv->addComponent(variable, u, s_weight_id[d_dim.getValue() - 1]); } if (!d_fv || d_fv->getComponentDescriptorIndex(0) != f) { d_fv.reset(new SAMRAIVectorReal(d_object_name + "::fv", - d_hierarchy, - d_ln_min, - d_ln_max)); + d_hierarchy, + d_ln_min, + d_ln_max)); vdb.mapIndexToVariable(f, variable); #ifdef DEBUG_CHECK_ASSERTIONS if (!variable) { @@ -515,12 +430,8 @@ CellPoissonFACSolver::createVectorWrappers( << f << "\n"); } boost::shared_ptr > cell_variable( - variable, - boost::detail::dynamic_cast_tag()); - if (!cell_variable) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << f - << " is not a cell-double variable.\n"); - } + BOOST_CAST, hier::Variable>(variable)); + TBOX_ASSERT(cell_variable); #endif d_fv->addComponent(variable, f, s_weight_id[d_dim.getValue() - 1]); } @@ -529,7 +440,7 @@ CellPoissonFACSolver::createVectorWrappers( void CellPoissonFACSolver::initializeStatics() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { s_weight_id[d] = -1; s_instance_counter[d] = -1; } @@ -539,4 +450,3 @@ CellPoissonFACSolver::initializeStatics() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.h index cefb6481..e277c962 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonFACSolver.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: High-level solver (wrapper) for scalar poisson equation. * ************************************************************************/ @@ -19,7 +19,7 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -29,12 +29,6 @@ namespace solv { * wrapping up lower-level components (FAC cycling, Poisson equation * operations and boundary conditions) in a single high-level interface. * - * Note: this class provides a backward-compatible interface to - * the soon-to-be obsolete PoissonHierarchySolver class. - * Although this class hides the lower-level components (FAC cycling, - * Poisson equation operations and boundary conditions), it is - * perfectly acceptable to use those lower-level components directly. - * * We solve the equation * div(D grad(u)) + Cu = f * where D is a side-centered array and C is a cell-centered array. @@ -93,23 +87,31 @@ namespace solv { * * Finer solver controls can be set using the functions in this class. * - * Object of this class can be set using input databases. - * The following parameters can be set. Each is shown with its - * default value in the case where hypre is used. - * @verbatim - * enable_logging = TRUE // Bool flag to switch logging on/off - * max_cycles = 10 // Integer number of max FAC cycles to use - * residual_tol = 1.e-6 // Residual tolerance to solve for - * num_pre_sweeps = 1 // Number of presmoothing sweeps to use - * num_post_sweeps = 1 // Number of postsmoothing sweeps to use - * coarse_fine_discretization = "Ewing" // Name of coarse-fine discretization - * prolongation_method = "CONSTANT_REFINE" // Name of prolongation method - * coarse_solver_choice = "hypre" // Name of coarse level solver - * coarse_solver_tolerance = 1e-10 // Coarse level tolerance - * coarse_solver_max_iterations = 20 // Coarse level max iterations - * use_smg = "FALSE" // Whether to use hypre's smg solver - * // (alternative is the pfmg solver) - * @endverbatim + * Input Parameters + * + * Definitions: + * - \b enable_logging + * turn logging on or off + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
enable_loggingboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
* */ class CellPoissonFACSolver @@ -126,12 +128,16 @@ class CellPoissonFACSolver * * @param dim * @param object_name Name of object used in outputs - * @param database tbox::Database for initialization (may be NULL) + * @param fac_precond + * @param fac_ops + * @param input_db tbox::Database for initialization (may be NULL) */ CellPoissonFACSolver( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database = + const boost::shared_ptr& fac_precond, + const boost::shared_ptr& fac_ops, + const boost::shared_ptr& input_db = boost::shared_ptr()); /*! @@ -139,20 +145,6 @@ class CellPoissonFACSolver */ ~CellPoissonFACSolver(); - /*! - * @brief Enable logging. - * - * To disable, pass in @c false. - */ - void - enableLogging( - bool logging) - { - d_enable_logging = logging; - d_fac_precond.enableLogging(d_enable_logging); - d_fac_ops.enableLogging(d_enable_logging); - } - /*! * @brief Solve Poisson's equation, assuming an uninitialized * solver state. @@ -183,6 +175,10 @@ class CellPoissonFACSolver * @return whether solver converged to specified level * * @see initializeSolverState + * + * @pre hierarchy + * @pre d_dim == hierarchy->getDim() + * @pre !d_solver_is_initialized */ bool solveSystem( @@ -211,6 +207,9 @@ class CellPoissonFACSolver * @return whether solver converged to specified level * * @see solveSystem( const int, const int, boost::shared_ptr< hier::PatchHierarchy >, int, int); + * + * @pre d_solver_is_initialized + * @pre (solution >= 0) || (rhs >= 0) */ bool solveSystem( @@ -232,7 +231,7 @@ class CellPoissonFACSolver * * If using Dirichlet boundary conditions, then before the solver is * called, the storage for the unknown u - * must have a mapped_box_level of ghost cells at least one cell wide that includes + * must have a box_level of ghost cells at least one cell wide that includes * the Dirichlet boundary values. * * If using Neumann boundary conditions, then before the solver is called, @@ -258,6 +257,8 @@ class CellPoissonFACSolver * conditions, 1 for Neumann conditions, and 2 for mixed boundary * conditions. The bdry_type argument is never required, but if used * it can sometimes make the PoissonHYPRESolver class more efficient. + * + * @pre (d_bc_object == 0) || (d_bc_object == &d_simple_bc) */ void @@ -265,7 +266,7 @@ class CellPoissonFACSolver const std::string& boundary_type, const int fluxes = -1, const int flags = -1, - int* bdry_types = NULL); + int* bdry_types = 0); /*! * @brief Override internal implementation to set boundary condition @@ -283,6 +284,8 @@ class CellPoissonFACSolver * * Once the boundary condition object is overwritten by this * method, you must no longer call the setBoundaries() method. + * + * @pre bc_object */ void setBcObject( @@ -290,12 +293,12 @@ class CellPoissonFACSolver { #ifdef DEBUG_CHECK_ASSERTIONS if (!bc_object) { - TBOX_ERROR(d_object_name << ": NULL pointer for boundary condition\n" + TBOX_ERROR(d_object_name << ": NULL pointer for boundary condition " << "object.\n"); } #endif d_bc_object = bc_object; - d_fac_ops.setPhysicalBcCoefObject(d_bc_object); + d_fac_ops->setPhysicalBcCoefObject(d_bc_object); } //!@{ @name Specifying PDE parameters @@ -362,187 +365,6 @@ class CellPoissonFACSolver //@} - //@{ @name Functions for setting solver mathematic algorithm controls - - /*! - * @brief Set coarse level solver. - * - * Select from these: - * - @c "redblack" - * - @c "hypre" (only if the HYPRE library is available). - */ - void - setCoarsestLevelSolverChoice( - const std::string& choice) - { - d_fac_ops.setCoarsestLevelSolverChoice(choice); - } - - /*! - * @brief Set tolerance for coarse level solve. - * - * If the coarse level solver requires a tolerance - * (currently, they all do), the specified value is used. - */ - void - setCoarsestLevelSolverTolerance( - double tol) - { - d_fac_ops.setCoarsestLevelSolverTolerance(tol); - } - - /*! - * @brief Set max iterations for coarse level solve. - * - * If the coarse level solver requires a max iteration limit - * (currently, they all do), the specified value is used. - */ - void - setCoarsestLevelSolverMaxIterations( - int max_iterations) - { - d_fac_ops.setCoarsestLevelSolverMaxIterations(max_iterations); - } - -#ifdef HAVE_HYPRE - /*! - * @brief Set whether to use HYPRe's PFMG algorithm instead of the - * SMG algorithm. - * - * The flag is used to select which of HYPRE's linear solver algorithms - * to use if true, the semicoarsening multigrid algorithm is used, and if - * false, the ``PF'' multigrid algorithm is used. - * By default, the SMG algorithm is used. - * - * This setting has effect only when HYPRe is chosen for the coarsest - * level solver. See setCoarsestLevelSolverChoice(). - * - * Changing the algorithm must be done before setting up the matrix - * coefficients. - */ - void - setUseSMG( - bool use_smg) - { - if (d_solver_is_initialized) { - TBOX_ERROR( - d_object_name << ": setUseSMG(bool) may NOT be called\n" - << "while the solver state is initialized, as that\n" - << "would lead to a corrupted solver state.\n"); - } - d_fac_ops.setUseSMG(use_smg); - } -#endif - - /*! - * @brief Set the coarse-fine boundary discretization method. - * - * Specify the @c op_name std::string which will be passed to - * xfer::Geometry::lookupRefineOperator() to get the operator - * for setting fine grid ghost cells from the coarse grid. - * Note that chosing this operator implicitly choses the - * discretization method at the coarse-fine boundary. - * - * There is one important instance where this std::string is - * @em not passed to xfer::Geometry::lookupRefineOperator(). - * If this variable is set to "Ewing", a constant refinement - * method is used along with Ewing's correction. - * For a reference to the correction method, see - * "Local Refinement Techniques for Elliptic Problems on Cell-Centered - * Grids, I. Error Analysis", Mathematics of Computation, Vol. 56, No. 194, - * April 1991, pp. 437-461. - * - * @param coarsefine_method String selecting the coarse-fine discretization method. - */ - void - setCoarseFineDiscretization( - const std::string& coarsefine_method) - { - d_fac_ops.setCoarseFineDiscretization(coarsefine_method); - } - - /*! - * @brief Set the name of the prolongation method. - * - * Specify the @c op_name std::string which will be passed to - * xfer::Geometry::lookupRefineOperator() to get the operator - * for prolonging the coarse-grid correction. - * - * By default, "CONSTANT_REFINE" is used. "LINEAR_REFINE" seems to - * to lead to faster convergence, but it does NOT satisfy the Galerkin - * condition. - * - * Prolonging using linear refinement requires a Robin bc - * coefficient implementation that is capable of delivering - * coefficients for non-hierarchy data, because linear refinement - * requires boundary conditions to be set on temporary levels. - * - * @param prolongation_method String selecting the coarse-fine discretization method. - */ - void - setProlongationMethod( - const std::string& prolongation_method) - { - d_fac_ops.setProlongationMethod(prolongation_method); - } - - /*! - * @brief Set the number of pre-smoothing sweeps during - * FAC iteration process. - * - * Presmoothing is applied during the fine-to-coarse phase of the - * iteration. The default is to use one sweep. - * - * @param num_pre_sweeps Number of presmoothing sweeps - */ - void - setPresmoothingSweeps( - int num_pre_sweeps) - { - d_fac_precond.setPresmoothingSweeps(num_pre_sweeps); - } - - /*! - * @brief Set the number of post-smoothing sweeps during - * FAC iteration process. - * - * Postsmoothing is applied during the coarse-to-fine phase of the - * iteration. The default is to use one sweep. - * - * @param num_post_sweeps Number of postsmoothing sweeps - */ - void - setPostsmoothingSweeps( - int num_post_sweeps) - { - d_fac_precond.setPostsmoothingSweeps(num_post_sweeps); - } - - /*! - * @brief Set the max number of iterations (cycles) to use per solve. - */ - void - setMaxCycles( - int max_cycles) - { - d_fac_precond.setMaxCycles(max_cycles); - } - - /*! - * @brief Set the residual tolerance for stopping. - * - * If you want the prescribed maximum number of cycles to always be taken, - * set the residual tolerance to a negative number. - */ - void - setResidualTolerance( - double residual_tol) - { - d_fac_precond.setResidualTolerance(residual_tol); - } - - //@} - /*! * @brief Prepare the solver's internal state for solving * @@ -571,6 +393,11 @@ class CellPoissonFACSolver * @param hierarchy The patch hierarchy to solve on * @param coarse_level The coarsest level in the solve * @param fine_level The finest level in the solve + * + * @pre hierarchy + * @pre d_dim == hierarchy->getDim() + * @pre d_bc_object != 0 + * @pre (solution >= 0) || (rhs >= 0) */ void initializeSolverState( @@ -602,7 +429,7 @@ class CellPoissonFACSolver int getNumberOfIterations() const { - return d_fac_precond.getNumberOfIterations(); + return d_fac_precond->getNumberOfIterations(); } /*! @@ -617,7 +444,7 @@ class CellPoissonFACSolver double& avg_factor, double& final_factor) const { - d_fac_precond.getConvergenceFactors(avg_factor, final_factor); + d_fac_precond->getConvergenceFactors(avg_factor, final_factor); } /*! @@ -632,7 +459,7 @@ class CellPoissonFACSolver double getResidualNorm() const { - return d_fac_precond.getResidualNorm(); + return d_fac_precond->getResidualNorm(); } //@} @@ -655,12 +482,12 @@ class CellPoissonFACSolver * See the class description for the parameters that can be set * from a database. * - * @param database Input database. If a NULL pointer is given, + * @param input_db Input database. If a NULL pointer is given, * nothing is done. */ void getFromInput( - const boost::shared_ptr& database); + const boost::shared_ptr& input_db); /* * @brief Set @c d_uv and @c d_fv to vectors wrapping the data @@ -703,12 +530,12 @@ class CellPoissonFACSolver * @brief FAC operator implementation corresponding to cell-centered * Poisson discretization. */ - CellPoissonFACOps d_fac_ops; + boost::shared_ptr d_fac_ops; /*! * @brief FAC preconditioner algorithm. */ - FACPreconditioner d_fac_precond; + boost::shared_ptr d_fac_precond; /*! * @brief Robin bc object in use. @@ -743,8 +570,8 @@ class CellPoissonFACSolver bool d_enable_logging; static bool s_initialized; - static int s_weight_id[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - static int s_instance_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static int s_weight_id[SAMRAI::MAX_DIM_VAL]; + static int s_instance_counter[SAMRAI::MAX_DIM_VAL]; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.C index b2424a80..f757bab8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Hypre solver interface for diffusion-like elliptic problems. * ************************************************************************/ -#ifndef included_solv_CellPoissonHypreSolver_C -#define included_solv_CellPoissonHypreSolver_C - #include "SAMRAI/solv/CellPoissonHypreSolver.h" #ifdef HAVE_HYPRE @@ -37,7 +34,7 @@ #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/StartupShutdownManager.h" -#include +#include "boost/make_shared.hpp" #include extern "C" { @@ -46,7 +43,7 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(compdiagvariablec2d, COMPDIAGVARIABLEC2D) ( +void SAMRAI_F77_FUNC(compdiagvariablec2d, COMPDIAGVARIABLEC2D) ( double* diag, const double* c, const double* offdiagi, @@ -57,7 +54,7 @@ void F77_FUNC(compdiagvariablec2d, COMPDIAGVARIABLEC2D) ( const int* jlast, const double* cscale, const double* dscale); -void F77_FUNC(compdiagscalarc2d, COMPDIAGSCALARC2D) ( +void SAMRAI_F77_FUNC(compdiagscalarc2d, COMPDIAGSCALARC2D) ( double* diag, const double* c, const double* offdiagi, @@ -68,7 +65,7 @@ void F77_FUNC(compdiagscalarc2d, COMPDIAGSCALARC2D) ( const int* jlast, const double* cscale, const double* dscale); -void F77_FUNC(compdiagzeroc2d, COMPDIAGZEROC2D) ( +void SAMRAI_F77_FUNC(compdiagzeroc2d, COMPDIAGZEROC2D) ( double* diag, const double* offdiagi, const double* offdiagj, @@ -78,7 +75,7 @@ void F77_FUNC(compdiagzeroc2d, COMPDIAGZEROC2D) ( const int* jlast, const double* cscale, const double* dscale); -void F77_FUNC(adjbdry2d, ADJBDRY2D) ( +void SAMRAI_F77_FUNC(adjbdry2d, ADJBDRY2D) ( double* diag, const double* offdiagi, const double* offdiagj, @@ -94,7 +91,7 @@ void F77_FUNC(adjbdry2d, ADJBDRY2D) ( const int* lower, const int* upper, const int* location, const double* h); -void F77_FUNC(adjbdryconstoffdiags2d, ADJBDRYCONSTOFFDIAGS2D) ( +void SAMRAI_F77_FUNC(adjbdryconstoffdiags2d, ADJBDRYCONSTOFFDIAGS2D) ( double* diag, const double* offdiag, const int* pifirst, @@ -114,7 +111,7 @@ void F77_FUNC(adjbdryconstoffdiags2d, ADJBDRYCONSTOFFDIAGS2D) ( const int* lower, const int* upper, const int* location, const double* h); -void F77_FUNC(adjustrhs2d, ADJUSTRHS2D) (double* rhs, +void SAMRAI_F77_FUNC(adjustrhs2d, ADJUSTRHS2D) (double* rhs, const int* rifirst, const int* rilast, const int* rjfirst, @@ -132,7 +129,7 @@ void F77_FUNC(adjustrhs2d, ADJUSTRHS2D) (double* rhs, const int* lower, const int* upper, const int* location); -void F77_FUNC(compdiagvariablec3d, COMPDIAGVARIABLEC3D) ( +void SAMRAI_F77_FUNC(compdiagvariablec3d, COMPDIAGVARIABLEC3D) ( double* diag, const double* c, const double* offdiagi, @@ -146,7 +143,7 @@ void F77_FUNC(compdiagvariablec3d, COMPDIAGVARIABLEC3D) ( const int* klast, const double* cscale, const double* dscale); -void F77_FUNC(compdiagscalarc3d, COMPDIAGSCALARC3D) ( +void SAMRAI_F77_FUNC(compdiagscalarc3d, COMPDIAGSCALARC3D) ( double* diag, const double* c, const double* offdiagi, @@ -160,7 +157,7 @@ void F77_FUNC(compdiagscalarc3d, COMPDIAGSCALARC3D) ( const int* klast, const double* cscale, const double* dscale); -void F77_FUNC(compdiagzeroc3d, COMPDIAGZEROC3D) ( +void SAMRAI_F77_FUNC(compdiagzeroc3d, COMPDIAGZEROC3D) ( double* diag, const double* offdiagi, const double* offdiagj, @@ -173,7 +170,7 @@ void F77_FUNC(compdiagzeroc3d, COMPDIAGZEROC3D) ( const int* klast, const double* cscale, const double* dscale); -void F77_FUNC(adjbdry3d, ADJBDRY3D) ( +void SAMRAI_F77_FUNC(adjbdry3d, ADJBDRY3D) ( double* diag, const double* offdiagi, const double* offdiagj, @@ -202,7 +199,7 @@ void F77_FUNC(adjbdry3d, ADJBDRY3D) ( const int* lower, const int* upper, const int* location, const double* h); -void F77_FUNC(adjbdryconstoffdiags3d, ADJBDRYCONSTOFFDIAGS3D) ( +void SAMRAI_F77_FUNC(adjbdryconstoffdiags3d, ADJBDRYCONSTOFFDIAGS3D) ( double* diag, const double* offdiag, const int* pifirst, @@ -228,7 +225,7 @@ void F77_FUNC(adjbdryconstoffdiags3d, ADJBDRYCONSTOFFDIAGS3D) ( const int* lower, const int* upper, const int* location, const double* h); -void F77_FUNC(adjustrhs3d, ADJUSTRHS3D) (double* rhs, +void SAMRAI_F77_FUNC(adjustrhs3d, ADJUSTRHS3D) (double* rhs, const int* rifirst, const int* rilast, const int* rjfirst, @@ -258,7 +255,7 @@ namespace SAMRAI { namespace solv { boost::shared_ptr > -CellPoissonHypreSolver::s_Ak0_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +CellPoissonHypreSolver::s_Ak0_var[SAMRAI::MAX_DIM_VAL]; tbox::StartupShutdownManager::Handler CellPoissonHypreSolver::s_finalize_handler( 0, @@ -276,7 +273,7 @@ tbox::StartupShutdownManager::Handler CellPoissonHypreSolver::s_finalize_handler CellPoissonHypreSolver::CellPoissonHypreSolver( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database): + const boost::shared_ptr& input_db): d_dim(dim), d_object_name(object_name), d_ln(-1), @@ -294,13 +291,13 @@ CellPoissonHypreSolver::CellPoissonHypreSolver( d_num_pre_relax_steps(1), d_num_post_relax_steps(1), d_relative_residual_norm(-1.0), - d_use_smg(false), - d_grid(NULL), - d_stencil(NULL), - d_matrix(NULL), - d_linear_rhs(NULL), - d_linear_sol(NULL), - d_mg_data(NULL), + d_use_smg(true), + d_grid(0), + d_stencil(0), + d_matrix(0), + d_linear_rhs(0), + d_linear_sol(0), + d_mg_data(0), d_print_solver_info(false) { if (d_dim == tbox::Dimension(1) || d_dim > tbox::Dimension(3)) { @@ -314,15 +311,16 @@ CellPoissonHypreSolver::CellPoissonHypreSolver( hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); if (!s_Ak0_var[d_dim.getValue() - 1]) { - s_Ak0_var[d_dim.getValue() - 1].reset( - new pdat::OutersideVariable(d_dim, d_object_name + "::Ak0", 1)); + s_Ak0_var[d_dim.getValue() - 1].reset( + new pdat::OutersideVariable(d_dim, d_object_name + "::Ak0", 1)); } + d_Ak0_id = vdb->registerVariableAndContext(s_Ak0_var[d_dim.getValue() - 1], d_context, hier::IntVector::getZero(d_dim)); - getFromInput(database); + getFromInput(input_db); } /* @@ -333,42 +331,43 @@ CellPoissonHypreSolver::CellPoissonHypreSolver( void CellPoissonHypreSolver::getFromInput( - const boost::shared_ptr& database) + const boost::shared_ptr& input_db) { - if (database) { - d_print_solver_info = database->getBoolWithDefault("print_solver_info", - d_print_solver_info); - d_max_iterations = database->getIntegerWithDefault("max_iterations", - d_max_iterations); - d_relative_residual_tol = database->getDoubleWithDefault( - "relative_residual_tol", - d_relative_residual_tol); - if (database->isDouble("residual_tol")) { - TBOX_ERROR("CellPoissonHypreSolver input error.\n" + if (input_db) { + d_print_solver_info = + input_db->getBoolWithDefault("print_solver_info", false); + + d_max_iterations = input_db->getIntegerWithDefault("max_iterations", 10); + if (!(d_max_iterations >= 1)) { + INPUT_RANGE_ERROR("max_iterations"); + } + + d_relative_residual_tol = + input_db->getDoubleWithDefault("relative_residual_tol", 1.0e-10); + if (!(d_relative_residual_tol > 0)) { + INPUT_RANGE_ERROR("relative_residual_tol"); + } + + if (input_db->isDouble("residual_tol")) { + TBOX_ERROR("CellPoissonHypreSolver getFromInput error...\n" << "The parameter 'residual_tol' has been replaced\n" << "by 'relative_residual_tol' to be more descriptive.\n" << "Please change the parameter name in the input database."); } + d_num_pre_relax_steps = - database->getIntegerWithDefault("num_pre_relax_steps", - d_num_pre_relax_steps); - if (d_num_pre_relax_steps < 0) { - TBOX_ERROR(d_object_name << ": Number of relaxation steps must be\n" - << "non-negative.\n"); + input_db->getIntegerWithDefault("num_pre_relax_steps", 1); + if (!(d_num_pre_relax_steps >= 0)) { + INPUT_RANGE_ERROR("num_pre_relax_steps"); } + d_num_post_relax_steps = - database->getIntegerWithDefault("num_post_relax_steps", - d_num_post_relax_steps); - if (d_num_post_relax_steps < 0) { - TBOX_ERROR(d_object_name << ": Number of relaxation steps must be\n" - << "non-negative.\n"); - } - if (database->isBool("use_smg")) { - bool use_smg = database->getBool("use_smg"); - if (use_smg != d_use_smg) { - setUseSMG(use_smg); - } + input_db->getIntegerWithDefault("num_post_relax_steps", 1); + if (!(d_num_post_relax_steps >= 0)) { + INPUT_RANGE_ERROR("num_post_relax_steps"); } + + d_use_smg = input_db->getBoolWithDefault("use_smg", true); } } @@ -388,7 +387,7 @@ CellPoissonHypreSolver::initializeSolverState( int ln) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); deallocateSolverState(); @@ -450,14 +449,17 @@ CellPoissonHypreSolver::allocateHypreData() boost::shared_ptr level(d_hierarchy->getPatchLevel(d_ln)); boost::shared_ptr grid_geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + d_hierarchy->getGridGeometry())); + + TBOX_ASSERT(grid_geometry); + const hier::IntVector ratio = level->getRatioToLevelZero(); hier::IntVector periodic_shift = grid_geometry->getPeriodicShift(ratio); - int periodic_flag[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - int d; + int periodic_flag[SAMRAI::MAX_DIM_VAL]; + tbox::Dimension::dir_t d; bool is_periodic = false; for (d = 0; d < d_dim.getValue(); ++d) { periodic_flag[d] = periodic_shift[d] != 0; @@ -477,10 +479,12 @@ CellPoissonHypreSolver::allocateHypreData() const hier::BoxContainer& level_domain = level->getPhysicalDomain(hier::BlockId::zero()); hier::Box domain_bound(level_domain.front()); - for (hier::BoxContainer::const_iterator i(level_domain); + for (hier::BoxContainer::const_iterator i = level_domain.begin(); i != level_domain.end(); ++i) { - domain_bound.lower().min(i->lower()); - domain_bound.upper().max(i->upper()); + domain_bound.setLower( + hier::Index::min(domain_bound.lower(), i->lower())); + domain_bound.setUpper( + hier::Index::min(domain_bound.upper(), i->upper())); } for (d = 0; d < d_dim.getValue(); ++d) { if (periodic_flag[d] == true) { @@ -525,7 +529,7 @@ CellPoissonHypreSolver::allocateHypreData() { -1 }, { 0 } }; HYPRE_StructStencilCreate(d_dim.getValue(), stencil_size, &d_stencil); - for (int s = 0; s < stencil_size; s++) { + for (int s = 0; s < stencil_size; ++s) { HYPRE_StructStencilSetElement(d_stencil, s, stencil_offsets[s]); } @@ -535,7 +539,7 @@ CellPoissonHypreSolver::allocateHypreData() { -1, 0 }, { 0, -1 }, { 0, 0 } }; HYPRE_StructStencilCreate(d_dim.getValue(), stencil_size, &d_stencil); - for (int s = 0; s < stencil_size; s++) { + for (int s = 0; s < stencil_size; ++s) { HYPRE_StructStencilSetElement(d_stencil, s, stencil_offsets[s]); } @@ -545,7 +549,7 @@ CellPoissonHypreSolver::allocateHypreData() { -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, -1 }, { 0, 0, 0 } }; HYPRE_StructStencilCreate(d_dim.getValue(), stencil_size, &d_stencil); - for (int s = 0; s < stencil_size; s++) { + for (int s = 0; s < stencil_size; ++s) { HYPRE_StructStencilSetElement(d_stencil, s, stencil_offsets[s]); } @@ -566,8 +570,8 @@ CellPoissonHypreSolver::allocateHypreData() * Allocate the structured matrix */ - int* full_ghosts = NULL; - int* no_ghosts = NULL; + int* full_ghosts = 0; + int* no_ghosts = 0; if (d_dim == tbox::Dimension(1)) { full_ghosts = full_ghosts1; @@ -641,23 +645,23 @@ CellPoissonHypreSolver::deallocateHypreData() { if (d_stencil) { HYPRE_StructStencilDestroy(d_stencil); - d_stencil = NULL; + d_stencil = 0; } if (d_grid) { HYPRE_StructGridDestroy(d_grid); - d_grid = NULL; + d_grid = 0; } if (d_matrix) { HYPRE_StructMatrixDestroy(d_matrix); - d_matrix = NULL; + d_matrix = 0; } if (d_linear_rhs) { HYPRE_StructVectorDestroy(d_linear_rhs); - d_linear_rhs = NULL; + d_linear_rhs = 0; } if (d_linear_sol) { HYPRE_StructVectorDestroy(d_linear_sol); - d_linear_sol = NULL; + d_linear_sol = 0; } destroyHypreSolver(); } @@ -677,10 +681,10 @@ CellPoissonHypreSolver::copyToHypre( int depth, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, src, box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, src, box); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box, true); c != cend; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c != cend; ++c) { hier::IntVector ic = *c; HYPRE_StructVectorSetValues(vector, &ic[0], src(*c, depth)); } @@ -701,10 +705,10 @@ CellPoissonHypreSolver::copyFromHypre( HYPRE_StructVector vector, const hier::Box box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, dst, box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, dst, box); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box, true); c != cend; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c != cend; ++c) { double value; hier::IntVector ic = *c; HYPRE_StructVectorGetValues(vector, &ic[0], &value); @@ -727,7 +731,7 @@ void CellPoissonHypreSolver::setMatrixCoefficients( const PoissonSpecifications& spec) { - if (d_physical_bc_coef_strategy == NULL) { + if (d_physical_bc_coef_strategy == 0) { TBOX_ERROR( d_object_name << ": No BC coefficient strategy object!\n" << "Use either setBoundaries or setPhysicalBcCoefObject\n" @@ -737,8 +741,6 @@ CellPoissonHypreSolver::setMatrixCoefficients( t_set_matrix_coefficients->start(); - int i = 0; - boost::shared_ptr > C_data; boost::shared_ptr > D_data; @@ -773,39 +775,32 @@ CellPoissonHypreSolver::setMatrixCoefficients( hier::Patch& patch = **pi; boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(pg); const double* h = pg->getDx(); const hier::Box patch_box = patch.getBox(); - const hier::Index patch_lo = patch_box.lower(); - const hier::Index patch_up = patch_box.upper(); + const hier::Index& patch_lo = patch_box.lower(); + const hier::Index& patch_up = patch_box.upper(); if (!spec.cIsZero() && !spec.cIsConstant()) { - C_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(spec.getCPatchDataId())); - if (!C_data) { - TBOX_ERROR(d_object_name << ": Invalid cell variable index " - << spec.getCPatchDataId() - << " for the C parameter. It is not\n" - << "cell-centered double data."); - } + C_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(spec.getCPatchDataId())); + TBOX_ASSERT(C_data); } if (!spec.dIsConstant()) { - D_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(spec.getDPatchDataId())); - if (!D_data) { - TBOX_ERROR(d_object_name << ": Invalid cell variable index " - << spec.getDPatchDataId() - << " for diffusion coefficient. It is not\n" - << "side-centered double data."); - } + D_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(spec.getDPatchDataId())); + TBOX_ASSERT(D_data); } - Ak0 = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_Ak0_id)); + Ak0 = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_Ak0_id)); + TBOX_ASSERT(Ak0); Ak0->fillAll(0.0); @@ -818,8 +813,8 @@ CellPoissonHypreSolver::setMatrixCoefficients( */ diagonal.fillAll(0.0); - const hier::Index ifirst = patch_box.lower(); - const hier::Index ilast = patch_box.upper(); + const hier::Index& ifirst = patch_box.lower(); + const hier::Index& ilast = patch_box.upper(); /* * Storage for off-diagonal entries, @@ -833,13 +828,13 @@ CellPoissonHypreSolver::setMatrixCoefficients( * to our central difference formula. */ if (spec.dIsConstant()) { - for (i = 0; i < d_dim.getValue(); ++i) { + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { double dhh = spec.getDConstant() / (h[i] * h[i]); pdat::ArrayData& off_diag_array(off_diagonal.getArrayData(i)); off_diag_array.fill(dhh); } } else { - for (i = 0; i < d_dim.getValue(); ++i) { + for (tbox::Dimension::dir_t i = 0; i < d_dim.getValue(); ++i) { hier::Box sbox(patch_box); sbox.growUpper(i, 1); array_math.scale(off_diagonal.getArrayData(i), @@ -881,9 +876,9 @@ CellPoissonHypreSolver::setMatrixCoefficients( * and rhs contribution (k0). */ { - const tbox::Array& surface_boxes = + const std::vector& surface_boxes = pg->getCodimensionBoundaries(1); - const int n_bdry_boxes = surface_boxes.getSize(); + const int n_bdry_boxes = static_cast(surface_boxes.size()); for (int n = 0; n < n_bdry_boxes; ++n) { const hier::BoundaryBox& boundary_box = surface_boxes[n]; @@ -935,17 +930,16 @@ CellPoissonHypreSolver::setMatrixCoefficients( * There are potentially coarse-fine boundaries to deal with. */ - tbox::Array surface_boxes; + std::vector empty_vector(0, + hier::BoundaryBox(d_dim)); + const std::vector& surface_boxes = + d_dim == tbox::Dimension(2) ? d_cf_boundary->getEdgeBoundaries(pi->getGlobalId()) : + (d_dim == + tbox::Dimension(3) ? d_cf_boundary->getFaceBoundaries(pi->getGlobalId()) : + empty_vector); - if (d_dim == tbox::Dimension(2)) { - surface_boxes = - d_cf_boundary->getEdgeBoundaries(pi->getGlobalId()); - } else if (d_dim == tbox::Dimension(3)) { - surface_boxes = - d_cf_boundary->getFaceBoundaries(pi->getGlobalId()); - } + const int n_bdry_boxes = static_cast(surface_boxes.size()); - const int n_bdry_boxes = surface_boxes.getSize(); for (int n = 0; n < n_bdry_boxes; ++n) { const hier::BoundaryBox& boundary_box = surface_boxes[n]; @@ -1001,10 +995,10 @@ CellPoissonHypreSolver::setMatrixCoefficients( int stencil_indices[stencil_size]; double mat_entries[stencil_size]; - for (i = 0; i < stencil_size; i++) stencil_indices[i] = i; + for (int i = 0; i < stencil_size; ++i) stencil_indices[i] = i; - pdat::CellIterator ic(patch_box, true); - pdat::CellIterator icend(patch_box, false); + pdat::CellIterator ic(pdat::CellGeometry::begin(patch_box)); + pdat::CellIterator icend(pdat::CellGeometry::end(patch_box)); /* * To do: This loop uses inefficient high-level syntax. @@ -1070,11 +1064,11 @@ CellPoissonHypreSolver::setMatrixCoefficients( void CellPoissonHypreSolver::add_gAk0_toRhs( const hier::Patch& patch, - const tbox::Array& bdry_boxes, + const std::vector& bdry_boxes, const RobinBcCoefStrategy* robin_bc_coef, pdat::CellData& rhs) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, patch, rhs); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, patch, rhs); /* * g*A*k0(a) is the storage for adjustments to be made to the rhs @@ -1083,11 +1077,13 @@ CellPoissonHypreSolver::add_gAk0_toRhs( * and so is moved to the rhs. Before solving, g*A*k0(a) is added * to rhs. */ - boost::shared_ptr >Ak0( - patch.getPatchData(d_Ak0_id), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr > Ak0( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_Ak0_id))); + + TBOX_ASSERT(Ak0); - const int n_bdry_boxes = bdry_boxes.getSize(); + const int n_bdry_boxes = static_cast(bdry_boxes.size()); for (int n = 0; n < n_bdry_boxes; ++n) { const hier::BoundaryBox& boundary_box = bdry_boxes[n]; @@ -1124,7 +1120,7 @@ CellPoissonHypreSolver::add_gAk0_toRhs( * beg=beginning, end=ending. */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(adjustrhs2d, ADJUSTRHS2D) (rhs.getPointer(d_rhs_depth), + SAMRAI_F77_FUNC(adjustrhs2d, ADJUSTRHS2D) (rhs.getPointer(d_rhs_depth), &rhsbox.lower()[0], &rhsbox.upper()[0], &rhsbox.lower()[1], @@ -1142,7 +1138,7 @@ CellPoissonHypreSolver::add_gAk0_toRhs( &lower[0], &upper[0], &location_index); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(adjustrhs3d, ADJUSTRHS3D) (rhs.getPointer(d_rhs_depth), + SAMRAI_F77_FUNC(adjustrhs3d, ADJUSTRHS3D) (rhs.getPointer(d_rhs_depth), &rhsbox.lower()[0], &rhsbox.upper()[0], &rhsbox.lower()[1], @@ -1177,7 +1173,7 @@ CellPoissonHypreSolver::add_gAk0_toRhs( void CellPoissonHypreSolver::setupHypreSolver() { - TBOX_ASSERT(d_mg_data == NULL); + TBOX_ASSERT(d_mg_data == 0); tbox::SAMRAI_MPI::Comm communicator = d_hierarchy->getMPI().getCommunicator(); @@ -1215,13 +1211,13 @@ CellPoissonHypreSolver::setupHypreSolver() void CellPoissonHypreSolver::destroyHypreSolver() { - if (d_mg_data != NULL) { + if (d_mg_data != 0) { if (d_use_smg) { HYPRE_StructSMGDestroy(d_mg_data); } else { HYPRE_StructPFMGDestroy(d_mg_data); } - d_mg_data = NULL; + d_mg_data = 0; } } @@ -1240,7 +1236,7 @@ CellPoissonHypreSolver::solveSystem( const int f, bool homogeneous_bc) { - if (d_physical_bc_coef_strategy == NULL) { + if (d_physical_bc_coef_strategy == 0) { TBOX_ERROR( d_object_name << ": No BC coefficient strategy object!\n" << "Use either setBoundaries or setPhysicalBcCoefObject\n" @@ -1294,8 +1290,8 @@ CellPoissonHypreSolver::solveSystem( * Set up variable data needed to prepare linear system solver. */ boost::shared_ptr > u_data_( - patch->getPatchData(u), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(u))); TBOX_ASSERT(u_data_); pdat::CellData& u_data = *u_data_; pdat::CellData rhs_data(box, 1, no_ghosts); @@ -1388,8 +1384,11 @@ CellPoissonHypreSolver::solveSystem( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > u_data_( - patch->getPatchData(u), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(u))); + + TBOX_ASSERT(u_data_); + pdat::CellData& u_data = *u_data_; copyFromHypre(u_data, d_soln_depth, @@ -1409,17 +1408,17 @@ CellPoissonHypreSolver::computeDiagonalEntries( const pdat::SideData& off_diagonal, const hier::Box& patch_box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(d_dim, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(d_dim, diagonal, C_data, off_diagonal, patch_box); - const hier::Index patch_lo = patch_box.lower(); - const hier::Index patch_up = patch_box.upper(); + const hier::Index& patch_lo = patch_box.lower(); + const hier::Index& patch_up = patch_box.upper(); const double c = 1.0, d = 1.0; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compdiagvariablec2d, COMPDIAGVARIABLEC2D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagvariablec2d, COMPDIAGVARIABLEC2D) (diagonal.getPointer(), C_data.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), @@ -1427,7 +1426,7 @@ CellPoissonHypreSolver::computeDiagonalEntries( &patch_lo[1], &patch_up[1], &c, &d); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compdiagvariablec3d, COMPDIAGVARIABLEC3D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagvariablec3d, COMPDIAGVARIABLEC3D) (diagonal.getPointer(), C_data.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), @@ -1446,13 +1445,13 @@ CellPoissonHypreSolver::computeDiagonalEntries( const pdat::SideData& off_diagonal, const hier::Box& patch_box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, diagonal, off_diagonal, patch_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(d_dim, diagonal, off_diagonal, patch_box); - const hier::Index patch_lo = patch_box.lower(); - const hier::Index patch_up = patch_box.upper(); + const hier::Index& patch_lo = patch_box.lower(); + const hier::Index& patch_up = patch_box.upper(); const double c = 1.0, d = 1.0; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compdiagscalarc2d, COMPDIAGSCALARC2D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagscalarc2d, COMPDIAGSCALARC2D) (diagonal.getPointer(), &C, off_diagonal.getPointer(0), off_diagonal.getPointer(1), @@ -1460,7 +1459,7 @@ CellPoissonHypreSolver::computeDiagonalEntries( &patch_lo[1], &patch_up[1], &c, &d); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compdiagscalarc3d, COMPDIAGSCALARC3D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagscalarc3d, COMPDIAGSCALARC3D) (diagonal.getPointer(), &C, off_diagonal.getPointer(0), off_diagonal.getPointer(1), @@ -1481,20 +1480,20 @@ CellPoissonHypreSolver::computeDiagonalEntries( const pdat::SideData& off_diagonal, const hier::Box& patch_box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, diagonal, off_diagonal, patch_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(d_dim, diagonal, off_diagonal, patch_box); - const hier::Index patch_lo = patch_box.lower(); - const hier::Index patch_up = patch_box.upper(); + const hier::Index& patch_lo = patch_box.lower(); + const hier::Index& patch_up = patch_box.upper(); const double c = 1.0, d = 1.0; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compdiagzeroc2d, COMPDIAGZEROC2D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagzeroc2d, COMPDIAGZEROC2D) (diagonal.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), &patch_lo[0], &patch_up[0], &patch_lo[1], &patch_up[1], &c, &d); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compdiagzeroc3d, COMPDIAGZEROC3D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(compdiagzeroc3d, COMPDIAGZEROC3D) (diagonal.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), off_diagonal.getPointer(2), @@ -1518,20 +1517,20 @@ CellPoissonHypreSolver::adjustBoundaryEntries( const hier::Box bccoef_box, pdat::ArrayData& Ak0_data, const hier::BoundaryBox& trimmed_boundary_box, - const double h[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]) + const double h[SAMRAI::MAX_DIM_VAL]) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS8(d_dim, diagonal, off_diagonal, patch_box, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY8(d_dim, diagonal, off_diagonal, patch_box, acoef_data, bcoef_data, bccoef_box, Ak0_data, trimmed_boundary_box); - const hier::Index patch_lo = patch_box.lower(); - const hier::Index patch_up = patch_box.upper(); + const hier::Index& patch_lo = patch_box.lower(); + const hier::Index& patch_up = patch_box.upper(); const int location_index = trimmed_boundary_box.getLocationIndex(); const hier::Index& lower = trimmed_boundary_box.getBox().lower(); const hier::Index& upper = trimmed_boundary_box.getBox().upper(); const hier::Box& Ak0_box = Ak0_data.getBox(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(adjbdry2d, ADJBDRY2D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(adjbdry2d, ADJBDRY2D) (diagonal.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), &patch_lo[0], &patch_up[0], @@ -1550,7 +1549,7 @@ CellPoissonHypreSolver::adjustBoundaryEntries( &lower[0], &upper[0], &location_index, h); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(adjbdry3d, ADJBDRY3D) (diagonal.getPointer(), + SAMRAI_F77_FUNC(adjbdry3d, ADJBDRY3D) (diagonal.getPointer(), off_diagonal.getPointer(0), off_diagonal.getPointer(1), off_diagonal.getPointer(2), @@ -1583,7 +1582,7 @@ CellPoissonHypreSolver::adjustBoundaryEntries( void CellPoissonHypreSolver::finalizeCallback() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < SAMRAI::MAX_DIM_VAL; ++d) { s_Ak0_var[d].reset(); } } @@ -1592,4 +1591,3 @@ CellPoissonHypreSolver::finalizeCallback() } #endif -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.h index 953e9424..fa4341e3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/CellPoissonHypreSolver.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Hypre solver interface for diffusion-like elliptic problems. * ************************************************************************/ @@ -16,13 +16,13 @@ #ifndef included_HYPRE_struct_ls /* - * This might break things if F77_FUNC_ is different for hypre vs + * This might break things if SAMRAI_F77_FUNC_ is different for hypre vs * SAMRAI autoconf detection. But then C/C++ macros are totally * broken due to namespace collision as this example highlights so * resorting to hacks are necessary. */ -#ifdef F77_FUNC_ -#undef F77_FUNC_ +#ifdef SAMRAI_F77_FUNC_ +#undef SAMRAI_F77_FUNC_ #endif #include "HYPRE_struct_ls.h" #define included_HYPRE_struct_ls @@ -42,8 +42,9 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace solv { @@ -82,17 +83,87 @@ namespace solv { * - Solve the linear system, passing in u and f as the patch * indices of the solution and the right hand side, respectively. * - * Sample parameters for initialization from database (and their - * default values): - * @verbatim - * print_solver_info = FALSE // Whether to print some data for debugging - * max_iterations = 10 // Max iterations used by Hypre - * relative_residual_tol = 1.0e-8 // Residual tolerance used by Hypre - * num_pre_relax_steps = 1 // # of presmoothing steps used by Hypre - * num_post_relax_steps = 1 // # of postsmoothing steps used by Hypre - * use_smg = FALSE // Whether to use hypre's smg solver - * // (alternative is the pfmg solver) - * @endverbatim + * Input Parameters + * + * Definitions: + * - \b print_solver_info + * whether to print some data for debugging + * + * - \b max_iterations + * max iterations used by Hypre + * + * - \b relative_residual_tol + * residual tolerance used by Hypre + * + * - \b num_pre_relax_steps + * number of presmoothing steps used by Hypre + * + * - \b num_post_relax_steps + * number of postsmoothing steps used by Hypre + * + * - \b use_smg + * whether to use hypre's smg solver (alternative is the pfmg solver) + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
print_solver_infoboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
max_iterationsint10>0optNot written to restart. Value in input db used.
relative_residual_toldouble1.0e-10>0.0optNot written to restart. Value in input db used.
num_pre_relax_stepsint1>=0optNot written to restart. Value in input db used.
num_post_relax_stepsint1>=0optNot written to restart. Value in input db used.
use_smgboolTRUETRUE, FALSEoptNot written to restart. Value in input db used.
+ * */ class CellPoissonHypreSolver @@ -103,12 +174,14 @@ class CellPoissonHypreSolver * * @param dim * @param object_name Name of object. - * @param database tbox::Database for input. + * @param input_db tbox::Database for input. + * + * @pre (dim.getValue() == 2) || (dim.getValue() == 3) */ CellPoissonHypreSolver( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database = + const boost::shared_ptr& input_db = boost::shared_ptr()); /*! @@ -123,6 +196,9 @@ class CellPoissonHypreSolver * * @param hierarchy Hierarchy * @param ln Level number + * + * @pre hierarchy + * @pre d_dim == hierarchy->getDim() */ void initializeSolverState( @@ -143,6 +219,8 @@ class CellPoissonHypreSolver * you set the values of C and D. * * This method must be called before solveSystem(). + * + * @pre d_physical_bc_coef_strategy != 0 */ void setMatrixCoefficients( @@ -194,6 +272,9 @@ class CellPoissonHypreSolver * * @param max_iterations gives the maximum number of iterations * @param relative_residual_tol the maximum error tolerance + * + * @pre max_iterations >= 0 + * @pre relative_residual_tol >= 0.0 */ void setStoppingCriteria( @@ -238,6 +319,12 @@ class CellPoissonHypreSolver * are assumed. * * @return whether solver converged to specified level + * + * @pre d_physical_bc_coef_strategy != 0 + * @pre u >= 0 + * @pre f >= 0 + * @pre u < d_hierarchy->getPatchLevel(d_ln)->getPatchDescriptor()->getMaxNumberRegisteredComponents() + * @pre v < d_hierarchy->getPatchLevel(d_ln)->getPatchDescriptor()->getMaxNumberRegisteredComponents() */ int solveSystem( @@ -256,28 +343,6 @@ class CellPoissonHypreSolver return d_number_iterations; } - /*! - * @brief Set the number of pre-relax steps used by the Hypre solve. - */ - void - setNumPreRelaxSteps( - const int steps) - { - TBOX_ASSERT(d_hierarchy); - d_num_pre_relax_steps = steps; - } - - /*! - * @brief Set the number of post-relax steps used by the Hypre solve. - */ - void - setNumPostRelaxSteps( - const int steps) - { - TBOX_ASSERT(d_hierarchy); - d_num_post_relax_steps = steps; - } - /*! * @brief Return the final residual norm returned by the Hypre solve. * @return final residual norm returned by the Hypre solve. @@ -288,25 +353,6 @@ class CellPoissonHypreSolver return d_relative_residual_norm; } - /*! - * @brief Set whether to use Hypre's PFMG algorithm instead of the - * SMG algorithm. - * - * The flag is used to select which of HYPRE's linear solver algorithms - * to use if true, the semicoarsening multigrid algorithm is used, and if - * false, the "PF" multigrid algorithm is used. - * By default, the SMG algorithm is used. - * - * Changing the algorithm must be done before setting up the matrix - * coefficients. - */ - void - setUseSMG( - bool use_smg) - { - d_use_smg = use_smg; - } - /*! * @brief Specify boundary condition directly, without using * a RobinBcCoefStrategy object. @@ -324,7 +370,7 @@ class CellPoissonHypreSolver const std::string& boundary_type, const int fluxes = -1, const int flags = -1, - int* bdry_types = NULL) + int* bdry_types = 0) { d_physical_bc_simple_case.setBoundaries(boundary_type, fluxes, @@ -405,14 +451,14 @@ class CellPoissonHypreSolver * @brief Set state using database * * See the class description for the parameters that can be set - * from a database. + * from an input database. * - * @param database Input database. If a NULL pointer is given, + * @param input_db Input database. If a NULL pointer is given, * nothing is done. */ void getFromInput( - const boost::shared_ptr& database); + const boost::shared_ptr& input_db); void setupHypreSolver(); @@ -448,21 +494,26 @@ class CellPoissonHypreSolver * boundary or coarse-fine boundary for the patch. The * bc coefficient implementation should correspond to the * boundary being worked on. + * + * @pre (d_dim == patch.getDim()) && (d_dim == rhs.getDim()) */ void add_gAk0_toRhs( const hier::Patch& patch, - const tbox::Array& bdry_boxes, + const std::vector& bdry_boxes, const RobinBcCoefStrategy* robin_bc_coef, pdat::CellData& rhs); //@{ /*! - * @name Dimension-independent functions to organize Fortran interface. + * @name Functions to organize Fortran interface. */ //! @brief Compute diagonal entries of the matrix when C is variable. + // @pre (d_dim == diagonal.getDim()) && (d_dim == C_data.getDim()) && + // (d_dim == variable_off_diagonal.getDim()) && + // (d_dim == patch_box.getDim()) void computeDiagonalEntries( pdat::CellData& diagonal, @@ -470,6 +521,9 @@ class CellPoissonHypreSolver const pdat::SideData& variable_off_diagonal, const hier::Box& patch_box); //! @brief Compute diagonal entries of the matrix when C is constant. + // @pre (d_dim == diagonal.getDim()) && + // (d_dim == variable_off_diagonal.getDim()) && + // (d_dim == patch_box.getDim()) void computeDiagonalEntries( pdat::CellData& diagonal, @@ -477,6 +531,9 @@ class CellPoissonHypreSolver const pdat::SideData& variable_off_diagonal, const hier::Box& patch_box); //! @brief Compute diagonal entries of the matrix when C is zero. + // @pre (d_dim == diagonal.getDim()) && + // (d_dim == variable_off_diagonal.getDim()) && + // (d_dim == patch_box.getDim()) void computeDiagonalEntries( pdat::CellData& diagonal, @@ -487,6 +544,13 @@ class CellPoissonHypreSolver * * At the same time, save information that are needed to adjust * the rhs. + * + * @pre (d_dim == diagonal.getDim()) && + * (d_dim == variable_off_diagonal.getDim()) && + * (d_dim == patch_box.getDim()) && (d_dim == acoef_data.getDim()) && + * (d_dim == bcoef_data.getDim()) && (d_dim == bccoef_box.getDim()) && + * (d_dim == Ak0_data.getDim()) && + * (d_dim == trimmed_boundary_box.getDim()) */ void adjustBoundaryEntries( @@ -498,7 +562,7 @@ class CellPoissonHypreSolver const hier::Box bccoef_box, pdat::ArrayData& Ak0_data, const hier::BoundaryBox& trimmed_boundary_box, - const double h[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]); + const double h[SAMRAI::MAX_DIM_VAL]); //@} @@ -597,7 +661,7 @@ class CellPoissonHypreSolver int d_Ak0_id; static boost::shared_ptr > - s_Ak0_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_Ak0_var[SAMRAI::MAX_DIM_VAL]; /*! * @brief Depth of the solution variable. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.C index cb3c7f32..cb93ba8e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user-defined operations used in FAC solve. * ************************************************************************/ - -#ifndef included_solv_FACOperatorStrategy_C -#define included_solv_FACOperatorStrategy_C - #include "SAMRAI/solv/FACOperatorStrategy.h" namespace SAMRAI { @@ -31,4 +27,3 @@ FACOperatorStrategy::deallocateOperatorState() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.h index adb3b278..e4932d9a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACOperatorStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user-defined operations used in FAC solve. * ************************************************************************/ @@ -13,9 +13,8 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -34,7 +33,7 @@ namespace solv { * or FACPreconditioner::initializeSolverState() * or vectors cloned from them. * - * @see solv::FACPreconditioner + * @see FACPreconditioner */ class FACOperatorStrategy @@ -65,8 +64,8 @@ class FACOperatorStrategy * Can assume: * -# dest_ln is not the finest level in the range being solved. * -# corresponding solution has been computed on level dest_ln+1. - * -# the source and destination residual vectors (s and d) may - * or may not be the same. (This function must work in either case.) + * -# the source and destination residual vectors may or may not + * be the same. (This method must work in either case.) * * Upon return from this function, the solution on the refined region * of the coarse level will represent the coarsened version of the @@ -97,8 +96,8 @@ class FACOperatorStrategy * Can assume: * -# dest_ln is not the finest level in the range being solved. * -# correspnding residual has been computed on level dest_ln+1. - * -# the source and destination residual vectors (s and d) may - * or may not be the same. (This function must work in either case.) + * -# the source and destination residual vectors may or may not + * be the same. (This method must work in either case.) * * Upon return from this function, the residual on the refined region * of the coarse level will represent the coarsened version of the diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.C index 75c5780f..d8bab51c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: FAC algorithm for solving linear equations on a hierarchy * ************************************************************************/ - -#ifndef included_solv_FACPreconditioner_C -#define included_solv_FACPreconditioner_C - #include "SAMRAI/math/HierarchyDataOpsManager.h" #include "SAMRAI/solv/FACPreconditioner.h" #include "SAMRAI/tbox/Timer.h" @@ -34,25 +30,23 @@ namespace solv { FACPreconditioner::FACPreconditioner( const std::string& name, - FACOperatorStrategy& user_ops, - const boost::shared_ptr& database): + boost::shared_ptr user_ops, + const boost::shared_ptr& input_db): d_object_name(name), d_fac_operator(user_ops), d_coarsest_ln(0), d_finest_ln(0), - d_max_iterations(0), - d_residual_tolerance(tbox::MathUtilities::getSignalingNaN()), - d_relative_residual_tolerance(tbox::MathUtilities::getSignalingNaN()), + d_max_iterations(10), + d_residual_tolerance(1.0e-6), + d_relative_residual_tolerance(-1.0), d_presmoothing_sweeps(1), d_postsmoothing_sweeps(1), d_algorithm_choice("default"), d_number_iterations(0), - d_residual_norm(tbox::MathUtilities::getSignalingNaN()), - d_rhs_norm(tbox::MathUtilities::getSignalingNaN()), + d_residual_norm(tbox::MathUtilities::getMax()), d_convergence_factor(), - d_avg_convergence_factor(tbox::MathUtilities::getSignalingNaN()), - d_net_convergence_factor(tbox::MathUtilities::getSignalingNaN()), - d_do_log(false), + d_avg_convergence_factor(tbox::MathUtilities::getMax()), + d_net_convergence_factor(tbox::MathUtilities::getMax()), d_controlled_level_ops() { @@ -62,7 +56,7 @@ FACPreconditioner::FACPreconditioner( /* * Initialize object with data read from input database. */ - getFromInput(database); + getFromInput(input_db); } /* @@ -86,33 +80,37 @@ FACPreconditioner::~FACPreconditioner() void FACPreconditioner::getFromInput( - const boost::shared_ptr& database) + const boost::shared_ptr& input_db) { - if (database) { - if (database->isBool("enable_logging")) { - bool logging = database->getBool("enable_logging"); - enableLogging(logging); + if (input_db) { + d_max_iterations = input_db->getIntegerWithDefault("max_cycles", 10); + if (!(d_max_iterations >= 1)) { + INPUT_RANGE_ERROR("max_cycles"); } - if (database->isInteger("max_cycles")) { - int max_cycles = database->getInteger("max_cycles"); - setMaxCycles(max_cycles); - } - if (database->isDouble("residual_tol")) { - double residual_tol = database->getDouble("residual_tol"); - setResidualTolerance(residual_tol, d_relative_residual_tolerance); + + d_residual_tolerance = + input_db->getDoubleWithDefault("residual_tol", 1.0e-6); + if (!(d_residual_tolerance > 0.0)) { + INPUT_RANGE_ERROR("residual_tol"); } - if (database->isDouble("relative_residual_tol")) { - double relative_residual_tol = database->getDouble( - "relative_residual_tol"); - setResidualTolerance(d_residual_tolerance, relative_residual_tol); + + d_relative_residual_tolerance = + input_db->getDoubleWithDefault("relative_residual_tol", -1.0); + if (!(d_relative_residual_tolerance > 0.0 || + d_relative_residual_tolerance == -1)) { + INPUT_RANGE_ERROR("relative_residual_tol"); } - if (database->isInteger("num_pre_sweeps")) { - int num_pre_sweeps = database->getInteger("num_pre_sweeps"); - setPresmoothingSweeps(num_pre_sweeps); + + d_presmoothing_sweeps = + input_db->getIntegerWithDefault("num_pre_sweeps", 1); + if (!(d_presmoothing_sweeps >= 0)) { + INPUT_RANGE_ERROR("num_pre_sweeps"); } - if (database->isInteger("num_post_sweeps")) { - int num_post_sweeps = database->getInteger("num_post_sweeps"); - setPostsmoothingSweeps(num_post_sweeps); + + d_postsmoothing_sweeps = + input_db->getIntegerWithDefault("num_post_sweeps", 1); + if (!(d_postsmoothing_sweeps >= 0)) { + INPUT_RANGE_ERROR("num_post_sweeps"); } } } @@ -153,8 +151,8 @@ FACPreconditioner::deallocateSolverState() d_tmp_residual.reset(); } - d_controlled_level_ops.setNull(); - d_fac_operator.deallocateOperatorState(); + d_controlled_level_ops.clear(); + d_fac_operator->deallocateOperatorState(); } } @@ -193,7 +191,7 @@ FACPreconditioner::initializeSolverState( math::HierarchyDataOpsManager* ops_manager = math::HierarchyDataOpsManager::getManager(); int num_components = solution.getNumberOfComponents(); - d_controlled_level_ops.resizeArray(num_components); + d_controlled_level_ops.resize(num_components); for (int i = 0; i < num_components; ++i) { d_controlled_level_ops[i] = ops_manager->getOperationsDouble( @@ -221,15 +219,15 @@ FACPreconditioner::initializeSolverState( << "level.\n"); } #endif - for (int ln = d_coarsest_ln; ln <= d_finest_ln; ln++) { + for (int ln = d_coarsest_ln; ln <= d_finest_ln; ++ln) { if (!d_patch_hierarchy->getPatchLevel(ln)) { - TBOX_ERROR("FACPreconditioner::FACPreconditioner error ..." + TBOX_ERROR("FACPreconditioner::initializeSolverState error ..." << "\n object name = " << d_object_name << "\n hierarchy level " << ln << " does not exist" << std::endl); } } - d_fac_operator.initializeOperatorState(solution, rhs); + d_fac_operator->initializeOperatorState(solution, rhs); } bool @@ -292,8 +290,7 @@ FACPreconditioner::solveSystem( bool clear_hierarchy_configuration_when_done = false; if (!d_patch_hierarchy) { clear_hierarchy_configuration_when_done = true; - initializeSolverState(u, - f); + initializeSolverState(u, f); } else { #ifdef DEBUG_CHECK_ASSERTIONS if (!checkVectorStateCompatibility(u, f)) { @@ -322,7 +319,7 @@ FACPreconditioner::solveSystem( double effective_residual_tolerance = d_residual_tolerance; if (d_relative_residual_tolerance >= 0) { - double tmp = d_fac_operator.computeResidualNorm(f, + double tmp = d_fac_operator->computeResidualNorm(f, d_finest_ln, d_coarsest_ln); tmp *= d_relative_residual_tolerance; @@ -330,8 +327,8 @@ FACPreconditioner::solveSystem( tmp; } - if (d_convergence_factor.getSize() < d_max_iterations) - d_convergence_factor.resizeArray(d_max_iterations); + if (static_cast(d_convergence_factor.size()) < d_max_iterations) + d_convergence_factor.resize(d_max_iterations); d_number_iterations = 0; /* * Use a do loop instead of a while loop until convergence. @@ -394,7 +391,7 @@ FACPreconditioner::solveSystem( * more accurate fine-level solutions. */ for (int ln = d_finest_ln - 1; ln >= d_coarsest_ln; --ln) { - d_fac_operator.restrictSolution(u, + d_fac_operator->restrictSolution(u, u, ln); } @@ -426,7 +423,7 @@ FACPreconditioner::solveSystem( /* * Increment the iteration counter. * The rest of this block expects it to have the incremented value. - * In particular, d_fac_operator.postprocessOneCycle does. + * In particular, d_fac_operator->postprocessOneCycle does. */ ++d_number_iterations; @@ -439,7 +436,7 @@ FACPreconditioner::solveSystem( d_avg_convergence_factor = pow(d_net_convergence_factor, 1.0 / d_number_iterations); - d_fac_operator.postprocessOneCycle(d_number_iterations - 1, + d_fac_operator->postprocessOneCycle(d_number_iterations - 1, u, *d_residual_vector); @@ -486,23 +483,23 @@ FACPreconditioner::facCycle_Recursive( /* Step 1. */ if (ln == lmin) { - d_fac_operator.solveCoarsestLevel(e, + d_fac_operator->solveCoarsestLevel(e, r, ln); } else { /* Step 2. */ - d_fac_operator.smoothError(e, + d_fac_operator->smoothError(e, r, ln, d_presmoothing_sweeps); /* Step 3. */ - d_fac_operator.computeCompositeResidualOnLevel(*d_tmp_residual, + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, e, r, ln, true); - d_fac_operator.restrictResidual(*d_tmp_residual, + d_fac_operator->restrictResidual(*d_tmp_residual, r, ln - 1); facCycle_Recursive(e, @@ -511,11 +508,11 @@ FACPreconditioner::facCycle_Recursive( lmax, lmin, ln - 1); - d_fac_operator.prolongErrorAndCorrect(e, + d_fac_operator->prolongErrorAndCorrect(e, e, ln); /* Step 4. */ - d_fac_operator.smoothError(e, + d_fac_operator->smoothError(e, r, ln, d_postsmoothing_sweeps); @@ -559,7 +556,7 @@ FACPreconditioner::facCycle_McCormick( /* * Solve coarsest level. */ - d_fac_operator.solveCoarsestLevel(e, + d_fac_operator->solveCoarsestLevel(e, r, ln); } else { @@ -569,7 +566,7 @@ FACPreconditioner::facCycle_McCormick( /* * Step 2a. */ - d_fac_operator.computeCompositeResidualOnLevel(*d_tmp_residual, + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, e, r, ln, @@ -584,7 +581,7 @@ FACPreconditioner::facCycle_McCormick( /* * Step 2b. */ - d_fac_operator.smoothError(*d_tmp_error, + d_fac_operator->smoothError(*d_tmp_error, *d_tmp_residual, ln, d_presmoothing_sweeps); @@ -603,12 +600,12 @@ FACPreconditioner::facCycle_McCormick( /* * Step 3a. */ - d_fac_operator.computeCompositeResidualOnLevel(*d_tmp_residual, + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, e, r, ln, true); - d_fac_operator.restrictResidual(*d_tmp_residual, + d_fac_operator->restrictResidual(*d_tmp_residual, *d_tmp_residual, ln - 1); /* @@ -633,13 +630,13 @@ FACPreconditioner::facCycle_McCormick( /* * Step 3d. */ - d_fac_operator.prolongErrorAndCorrect(e, + d_fac_operator->prolongErrorAndCorrect(e, e, ln); /* * Step 4a. */ - d_fac_operator.computeCompositeResidualOnLevel(*d_tmp_residual, + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, e, r, ln, @@ -654,7 +651,7 @@ FACPreconditioner::facCycle_McCormick( /* * Step 4b. */ - d_fac_operator.smoothError(*d_tmp_error, + d_fac_operator->smoothError(*d_tmp_error, *d_tmp_residual, ln, d_postsmoothing_sweeps); @@ -703,7 +700,7 @@ FACPreconditioner::facCycle( /* * Presmoothing. */ - d_fac_operator.smoothError(e, + d_fac_operator->smoothError(e, r, ln, d_presmoothing_sweeps); @@ -711,7 +708,7 @@ FACPreconditioner::facCycle( * Compute residual to see how much correction is still needed: * d_tmp_residual <- r - A e */ - d_fac_operator.computeCompositeResidualOnLevel(*d_tmp_residual, + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, e, r, ln, @@ -722,7 +719,7 @@ FACPreconditioner::facCycle( * level really solves for the correction for this level * where they overlap. */ - d_fac_operator.restrictResidual(*d_tmp_residual, + d_fac_operator->restrictResidual(*d_tmp_residual, r, ln - 1); } // End V-cycle descent. @@ -739,14 +736,14 @@ FACPreconditioner::facCycle( /* * Solve coarsest level. */ - d_fac_operator.solveCoarsestLevel(e, + d_fac_operator->solveCoarsestLevel(e, r, ln); } else { /* * Apply the coarse level correction to this level. */ - d_fac_operator.prolongErrorAndCorrect(e, + d_fac_operator->prolongErrorAndCorrect(e, e, ln); @@ -757,7 +754,7 @@ FACPreconditioner::facCycle( /* * Postsmoothing. */ - d_fac_operator.smoothError(e, + d_fac_operator->smoothError(e, r, ln, d_postsmoothing_sweeps); @@ -783,7 +780,7 @@ FACPreconditioner::computeFullCompositeResidual( SAMRAIVectorReal& f) { - d_fac_operator.computeCompositeResidualOnLevel + d_fac_operator->computeCompositeResidualOnLevel (r, u, f, @@ -793,9 +790,9 @@ FACPreconditioner::computeFullCompositeResidual( for (int ln = d_finest_ln - 1; ln >= d_coarsest_ln; --ln) { // Bring down more accurate solution from finer level. - d_fac_operator.restrictSolution(u, u, ln); + d_fac_operator->restrictSolution(u, u, ln); - d_fac_operator.computeCompositeResidualOnLevel + d_fac_operator->computeCompositeResidualOnLevel (r, u, f, @@ -803,14 +800,14 @@ FACPreconditioner::computeFullCompositeResidual( false); // Bring down more accurate residual from finer level. - d_fac_operator.restrictResidual(r, + d_fac_operator->restrictResidual(r, r, ln); } double residual_norm = - d_fac_operator.computeResidualNorm(r, + d_fac_operator->computeResidualNorm(r, d_finest_ln, d_coarsest_ln); @@ -841,7 +838,6 @@ FACPreconditioner::printClassData( << "d_postsmoothing_sweeps = " << d_postsmoothing_sweeps << "\n" << "d_number_iterations = " << d_number_iterations << "\n" << "d_residual_norm = " << d_residual_norm << "\n" - << "d_rhs_norm = " << d_rhs_norm << "\n" << std::endl; } @@ -873,4 +869,3 @@ FACPreconditioner::setAlgorithmChoice( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.h index 4c636083..3e34d0cc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/FACPreconditioner.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: FAC algorithm for solving linear equations on a hierarchy * ************************************************************************/ @@ -16,13 +16,12 @@ #include "SAMRAI/math/HierarchyDataOpsReal.h" #include "SAMRAI/solv/FACOperatorStrategy.h" #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include #include -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -57,6 +56,72 @@ namespace solv { * -# After solving, get solver statistics by viewing the log information * and calling getNumberOfIterations(), getResidualNorm() functions * if desired. + * + * Input Parameters + * + * Definitions: + * - \b max_cycles + * + * - \b residual_tol + * + * - \b relative_residual_tol + * + * - \b num_pre_sweeps + * + * - \b num_post_sweeps + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
max_cyclesint10>=1optNot written to restart. Value in input db used.
residual_toldouble1.0e-6>0.0optNot written to restart. Value in input db used.
relative_residual_toldouble-1.0-1.0 or >0.0optNot written to restart. Value in input db used.
num_pre_sweepsint1>=0optNot written to restart. Value in input db used.
num_post_sweepsint1>=0optNot written to restart. Value in input db used.
+ * */ class FACPreconditioner @@ -67,12 +132,12 @@ class FACPreconditioner * * @param name Object name * @param user_ops Reference to user-specified FAC operator - * @param database Input database with initialization parameters + * @param input_db Input database with initialization parameters */ FACPreconditioner( const std::string& name, - FACOperatorStrategy& user_ops, - const boost::shared_ptr& database = + boost::shared_ptr user_ops, + const boost::shared_ptr& input_db = boost::shared_ptr()); /*! @@ -118,6 +183,8 @@ class FACPreconditioner * @return whether solver converged to specified level * * @see initializeSolverState + * + * @pre !d_patch_hierarchy || checkVectorStateCompatibility(solution, rhs) */ bool solveSystem( @@ -172,6 +239,10 @@ class FACPreconditioner * * @param solution solution vector u * @param rhs right hand side vector f + * + * @post d_patch_hierarchy == rhs.getPatchHierarchy() + * @post d_coarsest_ln >= 0 + * @post d_coarsest_ln <= d_finest_ln */ void initializeSolverState( @@ -213,6 +284,8 @@ class FACPreconditioner * It is possible that a false compatibility is returned. * * @return true if vectors are compatible with existing state + * + * @pre d_patch_hierarchy */ bool checkVectorStateCompatibility( @@ -222,66 +295,6 @@ class FACPreconditioner //@{ //! @name Functions to set solving parameters. - /*! - * @brief Set the number of pre-smoothing sweeps during - * FAC iteration process. - * - * Presmoothing is applied during the fine-to-coarse phase of the - * iteration. The default is to use one sweep. - * - * @param num_pre_sweeps Number of presmoothing sweeps - */ - void - setPresmoothingSweeps( - int num_pre_sweeps) - { - d_presmoothing_sweeps = num_pre_sweeps; - } - - /*! - * @brief Set the number of post-smoothing sweeps during - * FAC iteration process. - * - * Postsmoothing is applied during the coarse-to-fine phase of the - * iteration. The default is to use one sweep. - * - * @param num_post_sweeps Number of postsmoothing sweeps - */ - void - setPostsmoothingSweeps( - int num_post_sweeps) - { - d_postsmoothing_sweeps = num_post_sweeps; - } - - /*! - * @brief Set the max number of iterations (cycles) to use per solve. - */ - void - setMaxCycles( - int max_cycles) - { - d_max_iterations = max_cycles; - } - - /*! - * @brief Set the residual tolerance for stopping. - * - * The solution is considered converged if ||b-Ax|| <= residual_tol - * @b or ||b-Ax|| <= relative_residual_tol*||b||. - * - * If you want the prescribed maximum number of cycles to always be taken, - * set both residual tolerances to negative numbers. - */ - void - setResidualTolerance( - double residual_tol, - double relative_residual_tol = -1.0) - { - d_residual_tolerance = residual_tol; - d_relative_residual_tolerance = relative_residual_tol; - } - /*! * @brief Set the choice of FAC cycling algorithm to use. * @@ -305,24 +318,6 @@ class FACPreconditioner //@} - //@{ @name Logging functions - - /*! - * @brief Enable or disable logging. - * - * Set streams to NULL to turn off output. - * - * @param enabled Logging state. true=on, false=off. - */ - void - enableLogging( - bool enabled = true) - { - d_do_log = enabled; - } - - //@} - //@{ //! @name Functions to get data on last solve. @@ -347,6 +342,8 @@ class FACPreconditioner * @param avg_factor average convergence factor over FAC cycles * from last solve. * @param final_factor convergence factor of the last FAC cycle + * + * @pre d_number_iterations > 0 */ void getConvergenceFactors( @@ -371,6 +368,8 @@ class FACPreconditioner * has been reduced by the FAC cycles. * It is (current residual)/( initial residual + epsilon), * so it may not be accurate if the initial residual is very small. + * + * @pre d_number_iterations > 0 */ double getNetConvergenceFactor() const @@ -391,6 +390,8 @@ class FACPreconditioner * The average factor is the net factor to the power of * 1/(number of FAC cycles). * It may not be accurate if the initial residual is very small. + * + * @pre d_number_iterations > 0 */ double getAvgConvergenceFactor() const @@ -410,6 +411,8 @@ class FACPreconditioner * * The final factor is the factor to which the residual * has been reduced by the last FAC cycle. + * + * @pre d_number_iterations > 0 */ double getFinalConvergenceFactor() const @@ -463,7 +466,7 @@ class FACPreconditioner //! @name Functions not implemented: FACPreconditioner( const FACPreconditioner&); - void + FACPreconditioner& operator = ( const FACPreconditioner&); //@} @@ -474,12 +477,12 @@ class FACPreconditioner * See the class description for the parameters that can be set * from a database. * - * @param database Input database. If a NULL pointer is given, + * @param input_db Input database. If a NULL pointer is given, * nothing is done. */ void getFromInput( - const boost::shared_ptr& database); + const boost::shared_ptr& input_db); /*! * @brief Compute composite residual on all levels and @@ -605,7 +608,7 @@ class FACPreconditioner * * Reference is initialized by constructor @em never changes. */ - FACOperatorStrategy& d_fac_operator; + boost::shared_ptr d_fac_operator; //@{ /*! @@ -661,17 +664,13 @@ class FACPreconditioner int d_number_iterations; double d_residual_norm; - /*! - * @brief Norm of RHS, for computing relative residual. - */ - double d_rhs_norm; /*! * @brief Convergence factor stack. * * The convergence factor stack is reset for each solve * and contains the convergence factors for each FAC cycle. */ - tbox::Array d_convergence_factor; + std::vector d_convergence_factor; /*! * The average convergence factor computed from the current * values in d_convergence_factor. @@ -684,16 +683,11 @@ class FACPreconditioner double d_net_convergence_factor; //@} - /*! - * @brief Flag stating whether to log. - */ - bool d_do_log; - /*! * @brief Objects facilitating operations over a specific range * of levels. */ - tbox::Array > > + std::vector > > d_controlled_level_ops; /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.C index b25a3569..619340f5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition support on cartesian grids. * ************************************************************************/ -#ifndef included_solv_GhostCellRobinBcCoefs_C -#define included_solv_GhostCellRobinBcCoefs_C - #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/Variable.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -68,7 +65,7 @@ GhostCellRobinBcCoefs::setGhostDataId( int ghost_data_id, hier::IntVector extensions_fillable) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, extensions_fillable); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, extensions_fillable); d_ghost_data_id = ghost_data_id; d_extensions_fillable = extensions_fillable; @@ -86,13 +83,8 @@ GhostCellRobinBcCoefs::setGhostDataId( << " does not correspond to any variable."); } boost::shared_ptr > cell_variable_ptr( - variable_ptr, - boost::detail::dynamic_cast_tag()); - if (!cell_variable_ptr) { - TBOX_ERROR( - d_object_name << ": hier::Index " << ghost_data_id - << " does not correspond to a cell-double variable."); - } + BOOST_CAST, hier::Variable>(variable_ptr)); + TBOX_ASSERT(cell_variable_ptr); } } @@ -116,7 +108,7 @@ GhostCellRobinBcCoefs::setBcCoefs( const hier::BoundaryBox& bdry_box, double fill_time) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, *variable, patch, bdry_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(d_dim, *variable, patch, bdry_box); NULL_USE(variable); NULL_USE(fill_time); @@ -124,8 +116,11 @@ GhostCellRobinBcCoefs::setBcCoefs( t_set_bc_coefs->start(); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(patch_geom); + const int norm_dir = bdry_box.getLocationIndex() / 2; const double* dx = patch_geom->getDx(); const double h = dx[norm_dir]; @@ -136,18 +131,18 @@ GhostCellRobinBcCoefs::setBcCoefs( * the ghost cell centers. bcoef_data is 1-acoef_data. */ if (acoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *acoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *acoef_data); acoef_data->fill(1.0 / (1 + 0.5 * h)); } if (bcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *bcoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *bcoef_data); bcoef_data->fill(0.5 * h / (1 + 0.5 * h)); } if (gcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *gcoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *gcoef_data); if (d_ghost_data_id == -1) { TBOX_ERROR(d_object_name << ": Coefficient g requested without\n" @@ -156,8 +151,8 @@ GhostCellRobinBcCoefs::setBcCoefs( /* * Fill in gcoef_data with data from d_ghost_data_id. - * The data is first looked for in a pdat::OutersideData object - * and a pdat::CellData object in that order. Data from the + * The data is first looked for in a pdat::OutersideData object + * and a pdat::CellData object in that order. Data from the * first place with allocated storage is used. */ boost::shared_ptr patch_data( @@ -167,14 +162,10 @@ GhostCellRobinBcCoefs::setBcCoefs( << d_ghost_data_id << " does not exist."); } boost::shared_ptr > cell_data( - patch_data, - boost::detail::dynamic_cast_tag()); - if (!cell_data) { - TBOX_ERROR( - d_object_name << ": hier::Patch data for index " - << d_ghost_data_id - << " is not cell double data."); - } + BOOST_CAST, hier::PatchData>(patch_data)); + + TBOX_ASSERT(cell_data); + const int location_index = bdry_box.getLocationIndex(); const hier::IntVector& gw = cell_data->getGhostCellWidth(); if (gw[norm_dir] < 1) { @@ -227,7 +218,7 @@ hier::Box GhostCellRobinBcCoefs::makeSideBoundaryBox( const hier::BoundaryBox& boundary_box) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, boundary_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, boundary_box); if (boundary_box.getBoundaryType() != 1) { TBOX_ERROR( @@ -244,11 +235,10 @@ GhostCellRobinBcCoefs::makeSideBoundaryBox( * than the boundary cell indices, in the direction normal * to the boundary. */ - face_indices.shift(location_index / 2, 1); + face_indices.shift(static_cast(location_index / 2), 1); } return face_indices; } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.h index eed8405e..0e620049 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/GhostCellRobinBcCoefs.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition problem-dependent interfaces * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Timer.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -100,6 +100,13 @@ class GhostCellRobinBcCoefs: * the coefficient data is needed. * @param fill_time solution time corresponding to filling, for use * when coefficients are time-dependent. + * + * @pre (d_dim == variable->getDim()) && (d_dim == patch.getDim()) && + * (d_dim == bdry_box.getDim()) + * @pre !acoef_data || (d_dim == acoef_data->getDim()) + * @pre !bcoef_data || (d_dim == bcoef_data->getDim()) + * @pre !gcoef_data || (d_dim == gcoef_data->getDim()) + * @pre !gcoef_data || (d_ghost_data_id != -1) */ void setBcCoefs( @@ -124,11 +131,13 @@ class GhostCellRobinBcCoefs: * @param ghost_data_id patch data index of ghost data * @param extensions_fillable the number of extensions past * edge of a patch that has valid ghost cell values. + * + * @pre d_dim == extensions_fillable.getDim() */ void setGhostDataId( int ghost_data_id, - hier::IntVector extensions_fillable // Default v2.x.x = hier::IntVector::getZero(tbox::Dimension(DIM)) ); + hier::IntVector extensions_fillable // Default v2.x.x = zero ); ); /*! @@ -160,6 +169,9 @@ class GhostCellRobinBcCoefs: * @param boundary_box input boundary box * @return a box to define the face indices corresponding to * boundary_box + * + * @pre d_dim == boundary_box.getDim() + * @pre boundary_box.getBoundaryType() == 1 */ hier::Box makeSideBoundaryBox( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.C index 9ada66bd..67f59f38 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user-specified functions for KINSOL package * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.h index c4e52a4a..93173e39 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLAbstractFunctions.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user-specified functions for KINSOL package * ************************************************************************/ @@ -43,8 +43,8 @@ namespace solv { * via boolean arguments to the constructor of the KINSOLSolver * class, or using the setKINSOLFunctions() member function of that class. * - * @see solv::KINSOLSolver - * @see solv::SundialsAbstractVector + * @see KINSOLSolver + * @see SundialsAbstractVector */ class KINSOLAbstractFunctions diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.C index d81be1c9..5522eb67 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: C++ Wrapper class for KINSOL solver package * ************************************************************************/ @@ -29,7 +29,7 @@ KINSOLSolver::KINSOLSolver( const int uses_jac_times_vector) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(!(my_functions == (KINSOLAbstractFunctions *)NULL)); + TBOX_ASSERT(!(my_functions == 0)); d_object_name = object_name; d_KINSOL_functions = my_functions; @@ -42,12 +42,12 @@ KINSOLSolver::KINSOLSolver( * Default parameters to safe values or to KINSOL defaults. */ - d_kin_mem = NULL; - d_kinsol_log_file = NULL; - d_solution_vector = NULL; - d_constraints = NULL; - d_soln_scale = NULL; - d_fval_scale = NULL; + d_kin_mem = 0; + d_kinsol_log_file = 0; + d_solution_vector = 0; + d_constraints = 0; + d_soln_scale = 0; + d_fval_scale = 0; d_my_soln_scale_vector = false; d_my_fval_scale_vector = false; @@ -95,21 +95,21 @@ KINSOLSolver::freeInternalVectors() { if (d_my_soln_scale_vector && d_my_fval_scale_vector && d_soln_scale) { d_soln_scale->freeVector(); - d_soln_scale = NULL; - d_fval_scale = NULL; + d_soln_scale = 0; + d_fval_scale = 0; d_my_soln_scale_vector = false; d_my_fval_scale_vector = false; } if (d_my_soln_scale_vector && d_soln_scale) { d_soln_scale->freeVector(); - d_soln_scale = NULL; + d_soln_scale = 0; d_my_soln_scale_vector = false; } if (d_my_fval_scale_vector && d_fval_scale) { d_fval_scale->freeVector(); - d_fval_scale = NULL; + d_fval_scale = 0; d_my_fval_scale_vector = false; } } @@ -142,7 +142,7 @@ KINSOLSolver::initialize( SundialsAbstractVector* uscale, SundialsAbstractVector* fscale) { - TBOX_ASSERT(!(solution == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(!(solution == 0)); d_solution_vector = solution; @@ -177,7 +177,7 @@ KINSOLSolver::initialize( void KINSOLSolver::initializeKINSOL() { - TBOX_ASSERT(!(d_solution_vector == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(!(d_solution_vector == 0)); if (d_KINSOL_needs_initialization) { @@ -191,22 +191,22 @@ KINSOLSolver::initializeKINSOL() * KINSOL function pointers. */ - KINSpilsPrecSetupFn precond_set = NULL; - KINSpilsPrecSolveFn precond_solve = NULL; - KINSpilsJacTimesVecFn jac_times_vec = NULL; + KINSpilsPrecSetupFn precond_set = 0; + KINSpilsPrecSolveFn precond_solve = 0; + KINSpilsJacTimesVecFn jac_times_vec = 0; if (d_uses_preconditioner) { precond_set = KINSOLSolver::KINSOLPrecondSet; precond_solve = KINSOLSolver::KINSOLPrecondSolve; } else { - precond_set = NULL; - precond_solve = NULL; + precond_set = 0; + precond_solve = 0; } if (d_uses_jac_times_vector) { jac_times_vec = KINSOLSolver::KINSOLJacobianTimesVector; } else { - jac_times_vec = NULL; + jac_times_vec = 0; } if (d_kin_mem) KINFree(&d_kin_mem); @@ -272,7 +272,7 @@ KINSOLSolver::initializeKINSOL() } ierr = KINSetConstraints(d_kin_mem, - (d_constraints != NULL) ? d_constraints->getNVector() : NULL); + (d_constraints != 0) ? d_constraints->getNVector() : 0); KINSOL_SAMRAI_ERROR(ierr); // Keep default unless user specifies one. @@ -290,7 +290,7 @@ KINSOLSolver::initializeKINSOL() KINSOL_SAMRAI_ERROR(ierr); ierr = KINSetConstraints(d_kin_mem, - d_constraints == NULL ? NULL : d_constraints->getNVector()); + d_constraints == 0 ? 0 : d_constraints->getNVector()); KINSOL_SAMRAI_ERROR(ierr); ierr = KINSetNumMaxIters(d_kin_mem, d_max_iter); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.h index 9e995e54..83dd3dd5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOLSolver.h @@ -145,8 +145,8 @@ class KINSOLSolver void initialize( SundialsAbstractVector* solution, - SundialsAbstractVector* uscale = NULL, - SundialsAbstractVector* fscale = NULL); + SundialsAbstractVector* uscale = 0, + SundialsAbstractVector* fscale = 0); /** * Solve nonlinear problem and return integer termination code defined @@ -211,7 +211,7 @@ class KINSOLSolver const int uses_preconditioner, const int uses_jac_times_vector) { - TBOX_ASSERT(!(my_functions == (KINSOLAbstractFunctions *)NULL)); + TBOX_ASSERT(!(my_functions == 0)); d_KINSOL_functions = my_functions; d_uses_preconditioner = uses_preconditioner; d_uses_jac_times_vector = uses_jac_times_vector; @@ -304,7 +304,7 @@ class KINSOLSolver setResidualStoppingTolerance( const double tol) { - TBOX_ASSERT(tol >= 0.0); + TBOX_ASSERT(tol == -1.0 || tol >= 0.0); d_residual_tol = tol; d_KINSOL_needs_initialization = true; } @@ -344,7 +344,7 @@ class KINSOLSolver setMaxNewtonStep( const double maxstep) { - TBOX_ASSERT(maxstep > 0.0); + TBOX_ASSERT(maxstep == -1.0 || maxstep > 0.0); d_max_newton_step = maxstep; d_KINSOL_needs_initialization = true; } @@ -354,7 +354,7 @@ class KINSOLSolver setNonlinearStepTolerance( const double tol) { - TBOX_ASSERT(tol >= 0.0); + TBOX_ASSERT(tol == -1.0 || tol >= 0.0); d_step_tol = tol; d_KINSOL_needs_initialization = true; } @@ -364,7 +364,7 @@ class KINSOLSolver setRelativeFunctionError( const double reserr) { - TBOX_ASSERT(reserr > 0.0); + TBOX_ASSERT(reserr == -1.0 || reserr > 0.0); d_relative_function_error = reserr; d_KINSOL_needs_initialization = true; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.C index 7202c5be..730463a9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: KINSOL solver for use within a SAMRAI-based application. * ************************************************************************/ - -#ifndef included_solv_KINSOL_SAMRAIContext_C -#define included_solv_KINSOL_SAMRAIContext_C - #include "SAMRAI/solv/KINSOL_SAMRAIContext.h" #ifdef HAVE_SUNDIALS @@ -38,58 +34,48 @@ const int KINSOL_SAMRAIContext::SOLV_KINSOL_SAMRAI_CONTEXT_VERSION = 1; KINSOL_SAMRAIContext::KINSOL_SAMRAIContext( const std::string& object_name, - const boost::shared_ptr& input_db, - KINSOLAbstractFunctions* my_functions) + KINSOLAbstractFunctions* my_functions, + const boost::shared_ptr& input_db): + d_object_name(object_name), + d_KINSOL_solver(new KINSOLSolver(object_name, my_functions, 0, 0)), + d_solution_vector(0), + d_residual_stop_tolerance(-1.0), + d_max_nonlinear_iterations(200), + d_max_krylov_dimension(10), + d_global_newton_strategy(0), + d_max_newton_step(-1.0), + d_nonlinear_step_tolerance(-1.0), + d_relative_function_error(-1.0), + d_linear_convergence_test(3), + d_max_subsetup_calls(5), + d_residual_monitoring_constant(0.0), + d_linear_solver_constant_tolerance(0.1), + d_max_solves_no_precond_setup(10), + d_max_linear_solve_restarts(0), + d_KINSOL_print_flag(0), + d_no_min_eps(false), + d_uses_preconditioner(false), + d_uses_jac_times_vector(false) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(!(my_functions == (KINSOLAbstractFunctions *)NULL)); + TBOX_ASSERT(my_functions != 0); - d_object_name = object_name; - tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); + d_residual_monitoring_params[0] = 0.00001; + d_residual_monitoring_params[1] = 0.9; - /* - * Set default state. - */ + d_eisenstat_walker_params[0] = 2.0; + d_eisenstat_walker_params[1] = 0.9; - d_KINSOL_solver = new KINSOLSolver(object_name, - my_functions, - 0, 0); - - d_solution_vector = ((SundialsAbstractVector *)NULL); - - d_residual_stop_tolerance = 0.0; - d_max_nonlinear_iterations = 0; - d_max_krylov_dimension = 0; - d_global_newton_strategy = 0; - d_max_newton_step = 0.0; - d_nonlinear_step_tolerance = 0.0; - d_relative_function_error = 0.0; - d_solution_update_constraint = 0.0; - d_linear_convergence_test = 0; - d_eisenstat_walker_params[0] = 0.0; - d_eisenstat_walker_params[1] = 0.0; - d_linear_solver_constant_tolerance = 0.0; - d_precond_setup_flag = 0; - d_max_solves_no_precond_setup = 0; - d_max_linear_solve_restarts = 0; - d_KINSOL_print_flag = 0; - d_uses_preconditioner = false; - d_uses_jac_times_vector = false; + tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); /* * Initialize object with data read from the input and restart databases. */ - bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); if (is_from_restart) { getFromRestart(); } - getFromInput(input_db); - - d_KINSOL_solver->setPreconditioner(((d_uses_preconditioner == false) - ? 0 : 1)); - d_KINSOL_solver->setJacobianTimesVector(((d_uses_jac_times_vector == false) - ? 0 : 1)); + getFromInput(input_db, is_from_restart); } KINSOL_SAMRAIContext::~KINSOL_SAMRAIContext() @@ -141,130 +127,225 @@ KINSOL_SAMRAIContext::solve() void KINSOL_SAMRAIContext::getFromInput( - const boost::shared_ptr& db) + const boost::shared_ptr& input_db, + bool is_from_restart) { - if (db) { - if (db->keyExists("residual_stop_tolerance")) { - d_residual_stop_tolerance = db->getDouble("residual_stop_tolerance"); - d_KINSOL_solver-> - setResidualStoppingTolerance(d_residual_stop_tolerance); - } + if (input_db) { + if (!is_from_restart) { + + d_residual_stop_tolerance = + input_db->getDoubleWithDefault("residual_stop_tolerance", -1.0); + d_KINSOL_solver->setResidualStoppingTolerance( + d_residual_stop_tolerance); - if (db->keyExists("max_nonlinear_iterations")) { d_max_nonlinear_iterations = - db->getInteger("max_nonlinear_iterations"); + input_db->getIntegerWithDefault("max_nonlinear_iterations", 200); d_KINSOL_solver->setMaxIterations(d_max_nonlinear_iterations); - } - if (db->keyExists("max_krylov_dimension")) { - d_max_krylov_dimension = db->getInteger("max_krylov_dimension"); + d_max_krylov_dimension = + input_db->getIntegerWithDefault("max_krylov_dimension", 10); d_KINSOL_solver->setMaxKrylovDimension(d_max_krylov_dimension); - } - if (db->keyExists("global_newton_strategy")) { - d_global_newton_strategy = db->getInteger("global_newton_strategy"); + d_global_newton_strategy = + input_db->getIntegerWithDefault("global_newton_strategy", 0); d_KINSOL_solver->setGlobalStrategy(d_global_newton_strategy); - } - if (db->keyExists("max_newton_step")) { - d_max_newton_step = db->getDouble("max_newton_step"); + d_max_newton_step = + input_db->getDoubleWithDefault("max_newton_step", -1.0); d_KINSOL_solver->setMaxNewtonStep(d_max_newton_step); - } - if (db->keyExists("nonlinear_step_tolerance")) { d_nonlinear_step_tolerance = - db->getDouble("nonlinear_step_tolerance"); - d_KINSOL_solver-> - setNonlinearStepTolerance(d_nonlinear_step_tolerance); - } + input_db->getDoubleWithDefault("nonlinear_step_tolerance", -1.0); + d_KINSOL_solver->setNonlinearStepTolerance( + d_nonlinear_step_tolerance); - if (db->keyExists("relative_function_error")) { - d_relative_function_error = db->getDouble("relative_function_error"); + d_relative_function_error = + input_db->getDoubleWithDefault("relative_function_error", -1.0); d_KINSOL_solver->setRelativeFunctionError(d_relative_function_error); - } - if (db->keyExists("linear_convergence_test")) { - d_linear_convergence_test = db->getInteger("linear_convergence_test"); - d_KINSOL_solver-> - setLinearSolverConvergenceTest(d_linear_convergence_test); - } + d_linear_convergence_test = + input_db->getIntegerWithDefault("linear_convergence_test", 3); + d_KINSOL_solver->setLinearSolverConvergenceTest( + d_linear_convergence_test); - if (db->keyExists("max_subsetup_calls")) { - d_max_subsetup_calls = db->getInteger("max_subsetup_calls"); + d_max_subsetup_calls = + input_db->getIntegerWithDefault("max_subsetup_calls", 5); d_KINSOL_solver->setMaxSubSetupCalls(d_max_subsetup_calls); - } - if (db->keyExists("residual_monitoring_params")) { - db->getDoubleArray("residual_monitoring_params", - d_residual_monitoring_params, 2); - d_KINSOL_solver-> - setResidualMonitoringParams(d_residual_monitoring_params[0], + if (input_db->keyExists("residual_monitoring_params")) { + input_db->getDoubleArray("residual_monitoring_params", + d_residual_monitoring_params, 2); + } + d_KINSOL_solver->setResidualMonitoringParams( + d_residual_monitoring_params[0], d_residual_monitoring_params[1]); - } - if (db->keyExists("residual_monitoring_constant")) { d_residual_monitoring_constant = - db->getDouble("residual_monitoring_constant"); - d_KINSOL_solver-> - setResidualMonitoringConstant(d_residual_monitoring_constant); - } + input_db->getDoubleWithDefault("residual_monitoring_constant", 0.0); + d_KINSOL_solver->setResidualMonitoringConstant( + d_residual_monitoring_constant); - if (db->keyExists("no_min_eps")) { - d_no_min_eps = db->getBool("no_min_eps"); + d_no_min_eps = input_db->getBoolWithDefault("no_min_eps", false); d_KINSOL_solver->setNoMinEps(d_no_min_eps); - } - if (db->keyExists("eisenstat_walker_params")) { - db->getDoubleArray("eisenstat_walker_params", - d_eisenstat_walker_params, 2); - d_KINSOL_solver-> - setEisenstatWalkerParameters(d_eisenstat_walker_params[0], + if (input_db->keyExists("eisenstat_walker_params")) { + input_db->getDoubleArray("eisenstat_walker_params", + d_eisenstat_walker_params, 2); + } + d_KINSOL_solver->setEisenstatWalkerParameters( + d_eisenstat_walker_params[0], d_eisenstat_walker_params[1]); - } - if (db->keyExists("linear_solver_constant_tolerance")) { d_linear_solver_constant_tolerance = - db->getDouble("linear_solver_constant_tolerance"); - d_KINSOL_solver-> - setLinearSolverConstantTolerance(d_linear_solver_constant_tolerance); - } + input_db->getDoubleWithDefault("linear_solver_constant_tolerance", 0.1); + d_KINSOL_solver->setLinearSolverConstantTolerance( + d_linear_solver_constant_tolerance); - if (db->keyExists("max_solves_no_precond_setup")) { d_max_solves_no_precond_setup = - db->getInteger("max_solves_no_precond_setup"); - d_KINSOL_solver-> - setMaxStepsWithNoPrecondSetup(d_max_solves_no_precond_setup); - } + input_db->getIntegerWithDefault("max_solves_no_precond_setup", 10); + d_KINSOL_solver->setMaxStepsWithNoPrecondSetup( + d_max_solves_no_precond_setup); - if (db->keyExists("max_linear_solve_restarts")) { d_max_linear_solve_restarts = - db->getInteger("max_linear_solve_restarts"); - d_KINSOL_solver-> - setMaxLinearSolveRestarts(d_max_linear_solve_restarts); - } + input_db->getIntegerWithDefault("max_linear_solve_restarts", 0); + d_KINSOL_solver->setMaxLinearSolveRestarts( + d_max_linear_solve_restarts); + + d_KINSOL_log_filename = + input_db->getStringWithDefault("KINSOL_log_filename", ""); + d_KINSOL_print_flag = + input_db->getIntegerWithDefault("KINSOL_print_flag", 0); + d_KINSOL_solver->setLogFileData(d_KINSOL_log_filename, + d_KINSOL_print_flag); - bool set_print_options = false; - if (db->keyExists("KINSOL_log_filename")) { - d_KINSOL_log_filename = db->getString("KINSOL_log_filename"); - set_print_options = true; - } + d_uses_preconditioner = + input_db->getBoolWithDefault("uses_preconditioner", false); + d_KINSOL_solver->setPreconditioner( + (d_uses_preconditioner == false) ? 0 : 1); + + d_uses_jac_times_vector = + input_db->getBoolWithDefault("uses_jac_times_vector", false); + d_KINSOL_solver->setJacobianTimesVector( + (d_uses_jac_times_vector == false) ? 0 : 1); + } else { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + if (!read_on_restart) { + return; + } + + d_residual_stop_tolerance = + input_db->getDoubleWithDefault("residual_stop_tolerance", + d_residual_stop_tolerance); + d_KINSOL_solver->setResidualStoppingTolerance( + d_residual_stop_tolerance); - if (db->keyExists("KINSOL_print_flag")) { - d_KINSOL_print_flag = db->getInteger("KINSOL_print_flag"); - set_print_options = true; - } + d_max_nonlinear_iterations = + input_db->getIntegerWithDefault("max_nonlinear_iterations", + d_max_nonlinear_iterations); + d_KINSOL_solver->setMaxIterations(d_max_nonlinear_iterations); + + d_max_krylov_dimension = + input_db->getIntegerWithDefault("max_krylov_dimension", + d_max_krylov_dimension); + d_KINSOL_solver->setMaxKrylovDimension(d_max_krylov_dimension); + + d_global_newton_strategy = + input_db->getIntegerWithDefault("global_newton_strategy", + d_global_newton_strategy); + d_KINSOL_solver->setGlobalStrategy(d_global_newton_strategy); + + d_max_newton_step = + input_db->getDoubleWithDefault("max_newton_step", + d_max_newton_step); + d_KINSOL_solver->setMaxNewtonStep(d_max_newton_step); + + d_nonlinear_step_tolerance = + input_db->getDoubleWithDefault("nonlinear_step_tolerance", + d_nonlinear_step_tolerance); + d_KINSOL_solver->setNonlinearStepTolerance( + d_nonlinear_step_tolerance); + + d_relative_function_error = + input_db->getDoubleWithDefault("relative_function_error", + d_relative_function_error); + d_KINSOL_solver->setRelativeFunctionError(d_relative_function_error); + + d_linear_convergence_test = + input_db->getIntegerWithDefault("linear_convergence_test", + d_linear_convergence_test); + d_KINSOL_solver->setLinearSolverConvergenceTest( + d_linear_convergence_test); + + d_max_subsetup_calls = + input_db->getIntegerWithDefault("max_subsetup_calls", + d_max_subsetup_calls); + d_KINSOL_solver->setMaxSubSetupCalls(d_max_subsetup_calls); + + if (input_db->keyExists("residual_monitoring_params")) { + input_db->getDoubleArray("residual_monitoring_params", + d_residual_monitoring_params, 2); + } + d_KINSOL_solver->setResidualMonitoringParams( + d_residual_monitoring_params[0], + d_residual_monitoring_params[1]); - if (set_print_options) { + d_residual_monitoring_constant = + input_db->getDoubleWithDefault("residual_monitoring_constant", + d_residual_monitoring_constant); + d_KINSOL_solver->setResidualMonitoringConstant( + d_residual_monitoring_constant); + + d_no_min_eps = input_db->getBoolWithDefault("no_min_eps", + d_no_min_eps); + d_KINSOL_solver->setNoMinEps(d_no_min_eps); + + if (input_db->keyExists("eisenstat_walker_params")) { + input_db->getDoubleArray("eisenstat_walker_params", + d_eisenstat_walker_params, 2); + } + d_KINSOL_solver->setEisenstatWalkerParameters( + d_eisenstat_walker_params[0], + d_eisenstat_walker_params[1]); + + d_linear_solver_constant_tolerance = + input_db->getDoubleWithDefault("linear_solver_constant_tolerance", + d_linear_solver_constant_tolerance); + d_KINSOL_solver->setLinearSolverConstantTolerance( + d_linear_solver_constant_tolerance); + + d_max_solves_no_precond_setup = + input_db->getIntegerWithDefault("max_solves_no_precond_setup", + d_max_solves_no_precond_setup); + d_KINSOL_solver->setMaxStepsWithNoPrecondSetup( + d_max_solves_no_precond_setup); + + d_max_linear_solve_restarts = + input_db->getIntegerWithDefault("max_linear_solve_restarts", + d_max_linear_solve_restarts); + d_KINSOL_solver->setMaxLinearSolveRestarts( + d_max_linear_solve_restarts); + + d_KINSOL_log_filename = + input_db->getStringWithDefault("KINSOL_log_filename", + d_KINSOL_log_filename); + d_KINSOL_print_flag = + input_db->getIntegerWithDefault("KINSOL_print_flag", + d_KINSOL_print_flag); d_KINSOL_solver->setLogFileData(d_KINSOL_log_filename, d_KINSOL_print_flag); - } - if (db->keyExists("uses_preconditioner")) { - d_uses_preconditioner = db->getBool("uses_preconditioner"); - } - - if (db->keyExists("uses_jac_times_vector")) { - d_uses_jac_times_vector = db->getBool("uses_jac_times_vector"); + d_uses_preconditioner = + input_db->getBoolWithDefault("uses_preconditioner", + d_uses_preconditioner); + d_KINSOL_solver->setPreconditioner( + (d_uses_preconditioner == false) ? 0 : 1); + + d_uses_jac_times_vector = + input_db->getBoolWithDefault("uses_jac_times_vector", + d_uses_jac_times_vector); + d_KINSOL_solver->setJacobianTimesVector( + (d_uses_jac_times_vector == false) ? 0 : 1); } } } @@ -297,64 +378,128 @@ KINSOL_SAMRAIContext::getFromRestart() << "than class version."); } - d_residual_stop_tolerance = db->getDouble("d_residual_stop_tolerance"); - d_max_nonlinear_iterations = db->getInteger("d_max_nonlinear_iterations"); - d_max_krylov_dimension = db->getInteger("d_max_krylov_dimension"); - d_global_newton_strategy = db->getInteger("d_global_newton_strategy"); - d_max_newton_step = db->getDouble("d_max_newton_step"); - d_nonlinear_step_tolerance = db->getDouble("d_nonlinear_step_tolerance"); - d_relative_function_error = db->getDouble("d_relative_function_error"); - d_solution_update_constraint = db->getDouble("d_solution_update_constraint"); - d_linear_convergence_test = db->getInteger("d_linear_convergence_test"); - db->getDoubleArray("d_eisenstat_walker_params", + d_residual_stop_tolerance = db->getDouble("residual_stop_tolerance"); + d_KINSOL_solver->setResidualStoppingTolerance(d_residual_stop_tolerance); + + d_max_nonlinear_iterations = db->getInteger("max_nonlinear_iterations"); + d_KINSOL_solver->setMaxIterations(d_max_nonlinear_iterations); + + d_max_krylov_dimension = db->getInteger("max_krylov_dimension"); + d_KINSOL_solver->setMaxKrylovDimension(d_max_krylov_dimension); + + d_global_newton_strategy = db->getInteger("global_newton_strategy"); + d_KINSOL_solver->setGlobalStrategy(d_global_newton_strategy); + + d_max_newton_step = db->getDouble("max_newton_step"); + d_KINSOL_solver->setMaxNewtonStep(d_max_newton_step); + + d_nonlinear_step_tolerance = db->getDouble("nonlinear_step_tolerance"); + d_KINSOL_solver->setNonlinearStepTolerance(d_nonlinear_step_tolerance); + + d_relative_function_error = db->getDouble("relative_function_error"); + d_KINSOL_solver->setRelativeFunctionError(d_relative_function_error); + + d_linear_convergence_test = db->getInteger("linear_convergence_test"); + d_KINSOL_solver->setLinearSolverConvergenceTest(d_linear_convergence_test); + + d_max_subsetup_calls = db->getInteger("max_subsetup_calls"); + d_KINSOL_solver->setMaxSubSetupCalls(d_max_subsetup_calls); + + db->getDoubleArray("residual_monitoring_params", + d_residual_monitoring_params, 2); + d_KINSOL_solver->setResidualMonitoringParams( + d_residual_monitoring_params[0], + d_residual_monitoring_params[1]); + + d_residual_monitoring_constant = + db->getDouble("residual_monitoring_constant"); + d_KINSOL_solver->setResidualMonitoringConstant( + d_residual_monitoring_constant); + + d_no_min_eps = db->getBool("no_min_eps"); + d_KINSOL_solver->setNoMinEps(d_no_min_eps); + + db->getDoubleArray("eisenstat_walker_params", d_eisenstat_walker_params, 2); + d_KINSOL_solver->setEisenstatWalkerParameters(d_eisenstat_walker_params[0], + d_eisenstat_walker_params[1]); + d_linear_solver_constant_tolerance = - db->getDouble("d_linear_solver_constant_tolerance"); - d_precond_setup_flag = db->getInteger("d_precond_setup_flag"); + db->getDouble("linear_solver_constant_tolerance"); + d_KINSOL_solver->setLinearSolverConstantTolerance( + d_linear_solver_constant_tolerance); + d_max_solves_no_precond_setup = - db->getInteger("d_max_solves_no_precond_setup"); - d_max_linear_solve_restarts = db->getInteger("d_max_linear_solve_restarts"); - d_KINSOL_log_filename = db->getString("d_KINSOL_log_filename"); - d_KINSOL_print_flag = db->getInteger("d_KINSOL_print_flag"); + db->getInteger("max_solves_no_precond_setup"); + d_KINSOL_solver->setMaxStepsWithNoPrecondSetup( + d_max_solves_no_precond_setup); + + d_max_linear_solve_restarts = db->getInteger("max_linear_solve_restarts"); + d_KINSOL_solver->setMaxLinearSolveRestarts(d_max_linear_solve_restarts); + + d_KINSOL_log_filename = db->getString("KINSOL_log_filename"); + d_KINSOL_print_flag = db->getInteger("KINSOL_print_flag"); + d_KINSOL_solver->setLogFileData(d_KINSOL_log_filename, d_KINSOL_print_flag); + + d_uses_preconditioner = db->getBool("uses_preconditioner"); + d_KINSOL_solver->setPreconditioner( + (d_uses_preconditioner == false) ? 0 : 1); + + d_uses_jac_times_vector = db->getBool("uses_jac_times_vector"); + d_KINSOL_solver->setJacobianTimesVector( + (d_uses_jac_times_vector == false) ? 0 : 1); } /* ************************************************************************* * - * Write data members to database. + * Write data members to restart database. * ************************************************************************* */ void -KINSOL_SAMRAIContext::putToDatabase( - const boost::shared_ptr& db) const +KINSOL_SAMRAIContext::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("SOLV_KINSOL_SAMRAI_CONTEXT_VERSION", + restart_db->putInteger("SOLV_KINSOL_SAMRAI_CONTEXT_VERSION", SOLV_KINSOL_SAMRAI_CONTEXT_VERSION); - db->putDouble("d_residual_stop_tolerance", d_residual_stop_tolerance); - db->putInteger("d_max_nonlinear_iterations", d_max_nonlinear_iterations); - db->putInteger("d_max_krylov_dimension", d_max_krylov_dimension); - db->putInteger("d_global_newton_strategy", d_global_newton_strategy); - db->putDouble("d_max_newton_step", d_max_newton_step); - db->putDouble("d_nonlinear_step_tolerance", d_nonlinear_step_tolerance); - db->putDouble("d_relative_function_error", d_relative_function_error); - db->putDouble("d_solution_update_constraint", d_solution_update_constraint); - db->putInteger("d_linear_convergence_test", d_linear_convergence_test); - db->putDoubleArray("d_eisenstat_walker_params", + restart_db->putDouble("residual_stop_tolerance", + d_residual_stop_tolerance); + restart_db->putInteger("max_nonlinear_iterations", + d_max_nonlinear_iterations); + restart_db->putInteger("max_krylov_dimension", d_max_krylov_dimension); + restart_db->putInteger("global_newton_strategy", + d_global_newton_strategy); + restart_db->putDouble("max_newton_step", d_max_newton_step); + restart_db->putDouble("nonlinear_step_tolerance", + d_nonlinear_step_tolerance); + restart_db->putDouble("relative_function_error", + d_relative_function_error); + restart_db->putInteger("linear_convergence_test", + d_linear_convergence_test); + restart_db->putInteger("max_subsetup_calls", d_max_subsetup_calls); + restart_db->putDoubleArray("residual_monitoring_params", + d_residual_monitoring_params, 2); + restart_db->putDouble("residual_monitoring_constant", + d_residual_monitoring_constant); + restart_db->putBool("no_min_eps", d_no_min_eps); + restart_db->putDoubleArray("eisenstat_walker_params", d_eisenstat_walker_params, 2); - db->putDouble("d_linear_solver_constant_tolerance", + restart_db->putDouble("linear_solver_constant_tolerance", d_linear_solver_constant_tolerance); - db->putInteger("d_precond_setup_flag", d_precond_setup_flag); - db->putInteger("d_max_solves_no_precond_setup", + restart_db->putInteger("max_solves_no_precond_setup", d_max_solves_no_precond_setup); - db->putInteger("d_max_linear_solve_restarts", d_max_linear_solve_restarts); - db->putString("d_KINSOL_log_filename", d_KINSOL_log_filename); - db->putInteger("d_KINSOL_print_flag", d_KINSOL_print_flag); + restart_db->putInteger("max_linear_solve_restarts", + d_max_linear_solve_restarts); + restart_db->putString("KINSOL_log_filename", d_KINSOL_log_filename); + restart_db->putInteger("KINSOL_print_flag", d_KINSOL_print_flag); + restart_db->putBool("uses_preconditioner", d_uses_preconditioner); + restart_db->putBool("uses_jac_times_vector", d_uses_jac_times_vector); } /* @@ -387,7 +532,6 @@ KINSOL_SAMRAIContext::printClassData( << std::endl; os << "d_relative_function_error = " << d_relative_function_error << std::endl; - os << "d_solution_update_constraint = " << d_solution_update_constraint; os << "\nd_linear_convergence_test = " << d_linear_convergence_test << std::endl; os << "d_eisenstat_walker_params = " @@ -395,7 +539,6 @@ KINSOL_SAMRAIContext::printClassData( << d_eisenstat_walker_params[1] << std::endl; os << "d_linear_solver_constant_tolerance = " << d_linear_solver_constant_tolerance << std::endl; - os << "d_precond_setup_flag = " << d_precond_setup_flag << std::endl; os << "d_max_solves_no_precond_setup = " << d_max_solves_no_precond_setup; os << "\nd_max_linear_solve_restarts = " << d_max_linear_solve_restarts; os << "\nd_KINSOL_log_filename = " << d_KINSOL_log_filename << std::endl; @@ -407,4 +550,3 @@ KINSOL_SAMRAIContext::printClassData( } #endif -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.h index c7b96a66..b522c55c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/KINSOL_SAMRAIContext.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: KINSOL solver for use within a SAMRAI-based application. * ************************************************************************/ @@ -47,98 +47,258 @@ namespace solv { * Alternatively, solver parameters may be set up at initialization time * using the SAMRAI input database. * + * Input Parameters + * * If no parameters are read from input, KINSOL defaults are used. See KINSOL - * documentation for default information. Optional input keys and types are: + * documentation for default information. * + * Definitions: * - @b residual_stop_tolerance - * double value for stopping tolerance on norm of scaled residual. + * stopping tolerance on norm of scaled residual * * - @b max_nonlinear_iterations - * integer value for maximum number of nonlinear iterations (MXITER). + * maximum number of nonlinear iterations * * - @b max_krylov_dimension - * integer value for maximum dimension of Krylov space. + * maximum dimension of Krylov space * * - @b global_newton_strategy - * integer flag for globalization strategy. Choices are - * "INEXACT_NEWTON" (default) and "LINESEARCH". + * globalization strategy * * - @b max_newton_step - * double value for maximum allowable Newton step (MXNEWTONSTEP). + * maximum allowable Newton step * * - @b nonlinear_step_tolerance - * double value for stopping tolerance on maximum entry in - * scaled Newton step. + * stopping tolerance on maximum entry in scaled Newton step * * - @b relative_function_error - * double value for relative error in function evaluation (RELFUNC). - * - * - @b solution_update_constraint - * double value for constraint on relative change in solution (RELU). + * relative error in function evaluation * * - @b linear_convergence_test - * integer flag for linear solver convergence tolerance (ETACHOICE). - * Choices are "ETACONSTANT" (default), "ETACHOICE1", ETACHOICE2". + * linear solver convergence tolerance * - * - @b max_sub_setup_calls - * number of nonlinear iterations between checks by the - * nonlinear residual monitoring algorithm (specifies lenght of - * subinterval) NOTE: should be a multiple of - * MaxStepsWithNoPrecondSetup + * - @b max_subsetup_calls + * number of nonlinear iterations between checks by the nonlinear residual + * monitoring algorithm (specifies lenght of subinterval) + * NOTE: should be a multiple of max_solves_no_precond_setup * * - @b residual_monitoring_params - * values of omega_min and omega_max scalars used by nonlinear - * residual monitoring algorithm. - * Default is [0.00001 and 0.9] + * values of omega_min and omega_max scalars used by nonlinear residual + * monitoring algorithm * * - @b residual_monitoring_constant - * constant value used by residual monitoring algorithm. If - * omega=0, then it is estimated using omega_min and - * omega_max. - * Default is 0.0. + * constant value used by residual monitoring algorithm. If omega=0, then + * it is estimated using omega_min and omega_max. * - * - @b no_min_eps flag - * control whether or not the value * of eps is bounded below - * by 0.01*fnormtol. FALSE = "constrain value of eps by setting to - * the following: eps = MAX{0.01*fnormtol, eps}" TRUE = "do - * notconstrain value of eps". Default is FALSE + * - @b no_min_eps + * control whether or not the value * of eps is bounded below by + * 0.01*fnormtol. FALSE = "constrain value of eps by setting to the + * following: eps = MAX{0.01*fnormtol, eps}" TRUE = "do + * notconstrain value of eps". * * - @b eisenstat_walker_params - * array of two double values Eisenstat-Walker choice 2; i.e., - * the values are given as ETAALPHA, followed by ETAGAMMA. Note: the - * values only apply when linear convergence test is set to ETACHOICE2. - * - * - @b linear_solver_relative_tolerance - * double value for constant linear solver relative tolerance - * (ETACONST). Note: value only apply when convergence test is - * set to ETACONSTANT. + * Eisenstat-Walker choice 2; i.e., the values are given as ETAALPHA, + * followed by ETAGAMMA. Note: the values only apply when linear + * convergence test is set to ETACHOICE2. * - * - @b precond_setup_flag - * integer flag for preconditioner setup strategy (PRECOND_NO_INIT). + * - @b linear_solver_constant_tolerance + * constant linear solver relative tolerance + * Note: value only applies when convergence test is set to ETACONSTANT. * * - @b max_solves_no_precond_setup - * integer value for number of nonlinear steps separating successive - * calls to preconditioner setup routine. + * number of nonlinear steps separating successive calls to preconditioner + * setup routine * * - @b max_linear_solve_restarts - * integer value for maximum number of linear solver restarts allowed. + * maximum number of linear solver restarts allowed * * - @b KINSOL_log_filename - * string value for name of KINSOL log file; default is "kinsol.log". + * name of KINSOL log file * * - @b KINSOL_print_flag - * integer flag for KINSOL log file print options (PRINTFL). + * KINSOL log file print options * * - @b uses_preconditioner - * boolean flag indicating whether a preconditioner is supplied. - * Default is false. + * indicates whether a preconditioner is supplied * * - @b uses_jac_times_vector - * boolean flag indicating whether an analytic Jacobian-vector - * product is supplied. Default is false. - * - * Note that all input values may override values read in from restart. If - * no new input value is given, the restart value is used. + * indicates whether an analytic Jacobian-vector product is supplied + * + * All values read in from a restart database may be overriden by input + * database values. If no new input database value is given, the restart + * database value is used. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
residual_stop_tolerancedouble-1.0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_nonlinear_iterationsint200Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_krylov_dimensionint10Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
global_newton_strategyint0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_newton_stepdouble-1.0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
nonlinear_step_tolerancedouble-1.0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
relative_function_errordouble-1.0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
linear_convergence_testint3Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_subsetup_callsint5Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
residual_monitoring_paramsdouble[2][0.00001, 0.9]Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
residual_monitoring_constantdouble0.0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
no_min_epsboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
eisenstat_walker_paramsdouble[2][2.0, 0.9]Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
linear_solver_constant_tolerancedouble0.1Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_solves_no_precond_setupint10Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
max_linear_solve_restartsint0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
KINSOL_log_filenamestring""Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
KINSOL_print_flagint0Refer to KINSOL documentationoptParameter read from restart db may be overridden by input db
uses_preconditionerboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
uses_jac_times_vectorboolFALSETRUE, FALSEoptParameter read from restart db may be overridden by input db
* * A sample input file entry might look like: * @@ -150,7 +310,7 @@ namespace solv { * KINSOL_print_flag = 3 // print all output KINSOL has to offer * @endcode * - * @see solv::NonlinearSolverStrategy + * @see NonlinearSolverStrategy */ class KINSOL_SAMRAIContext: public NonlinearSolverStrategy, @@ -163,14 +323,14 @@ class KINSOL_SAMRAIContext: * with user-supplied solver components. Then, it reads solver parameter * from input and restart which may override default values. * - * When assertion checking is active, an unrecoverable assertion - * will result if the name string is empty or the pointer to the - * user-defined KINSOL functions object is null. + * @pre !object_name.empty() + * @pre my_functions != 0 */ KINSOL_SAMRAIContext( const std::string& object_name, - const boost::shared_ptr& input_db, - KINSOLAbstractFunctions* my_functions); + KINSOLAbstractFunctions* my_functions, + const boost::shared_ptr& input_db = + boost::shared_ptr()); /** * Destructor for algs::KINSOL_SAMRAIContext destroys the KINSOL @@ -182,6 +342,8 @@ class KINSOL_SAMRAIContext: * Initialize the state of KINSOL based on vector argument representing * the solution of the nonlinear system. In general, this routine must * be called before the solve() routine is invoked. + * + * @pre solution */ void initialize( @@ -210,12 +372,14 @@ class KINSOL_SAMRAIContext: /** * Read input parameters from given database. * - * When assertion checking is active, an unrecoverable assertion - * will result if the database pointer is null. + * @param[in] input_db + * + * @param[in] is_from_restart */ void getFromInput( - const boost::shared_ptr& db); + const boost::shared_ptr& input_db, + bool is_from_restart); /** * Retrieve solver parameters from restart database matching object name. @@ -230,12 +394,11 @@ class KINSOL_SAMRAIContext: /** * Retrieve solver parameters from restart database matching object name. * - * When assertion checking is active, an unrecoverable assertion - * will result if database pointer is null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Print out all members of integrator instance to given output stream. @@ -279,14 +442,12 @@ class KINSOL_SAMRAIContext: double d_max_newton_step; double d_nonlinear_step_tolerance; double d_relative_function_error; - double d_solution_update_constraint; int d_linear_convergence_test; int d_max_subsetup_calls; double d_residual_monitoring_params[2]; double d_residual_monitoring_constant; double d_eisenstat_walker_params[2]; double d_linear_solver_constant_tolerance; - int d_precond_setup_flag; int d_max_solves_no_precond_setup; int d_max_linear_solve_restarts; std::string d_KINSOL_log_filename; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.C index 2e627301..5dea96f1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition support on cartesian grids. * ************************************************************************/ -#ifndef included_solv_LocationIndexRobinBcCoefs_C -#define included_solv_LocationIndexRobinBcCoefs_C - #include #include "SAMRAI/solv/LocationIndexRobinBcCoefs.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/hier/Index.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/MathUtilities.h" #include IOMANIP_HEADER_FILE @@ -32,17 +28,18 @@ namespace solv { LocationIndexRobinBcCoefs::LocationIndexRobinBcCoefs( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database): + const boost::shared_ptr& input_db): d_dim(dim), d_object_name(object_name) { - int i; - for (i = 0; i < 2 * d_dim.getValue(); ++i) { + TBOX_ASSERT(input_db); + + for (int i = 0; i < 2 * d_dim.getValue(); ++i) { d_a_map[i] = tbox::MathUtilities::getSignalingNaN(); d_b_map[i] = tbox::MathUtilities::getSignalingNaN(); d_g_map[i] = tbox::MathUtilities::getSignalingNaN(); } - getFromInput(database); + getFromInput(input_db); } /* @@ -63,34 +60,54 @@ LocationIndexRobinBcCoefs::~LocationIndexRobinBcCoefs() void LocationIndexRobinBcCoefs::getFromInput( - const boost::shared_ptr& database) + const boost::shared_ptr& input_db) { - if (database) { - int i; - for (i = 0; i < 2 * d_dim.getValue(); ++i) { - std::string name = "boundary_" + tbox::Utilities::intToString(i); - if (database->isString(name)) { + if (!input_db) { + return; + } + + for (int i = 0; i < 2 * d_dim.getValue(); ++i) { + std::string name = "boundary_" + tbox::Utilities::intToString(i); + if (input_db->isString(name)) { + d_a_map[i] = 1.0; + d_g_map[i] = 0.0; + std::vector specs = input_db->getStringVector(name); + if (specs[0] == "value") { d_a_map[i] = 1.0; - d_g_map[i] = 0.0; - tbox::Array specs = database->getStringArray(name); - if (specs[0] == "value") { - d_a_map[i] = 1.0; - d_b_map[i] = 0.0; - if (specs.size() > 1) d_g_map[i] = atof(specs[1].c_str()); - } else if (specs[0] == "slope") { - d_a_map[i] = 0.0; - d_b_map[i] = 1.0; - if (specs.size() > 1) d_g_map[i] = atof(specs[1].c_str()); - } else if (specs[0] == "coefficients") { - if (specs.size() > 1) d_a_map[i] = atof(specs[1].c_str()); - if (specs.size() > 2) d_b_map[i] = atof(specs[2].c_str()); - if (specs.size() > 3) d_g_map[i] = atof(specs[3].c_str()); + d_b_map[i] = 0.0; + if (specs.size() != 2) { + TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n" + << "exactly 1 value needed with \"value\" boundary specifier" + << std::endl); + } else { + d_g_map[i] = atof(specs[1].c_str()); + } + } else if (specs[0] == "slope") { + d_a_map[i] = 0.0; + d_b_map[i] = 1.0; + if (specs.size() != 2) { + TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n" + << "exactly 1 value needed with \"slope\" boundary specifier" + << std::endl); + } else { + d_g_map[i] = atof(specs[1].c_str()); + } + } else if (specs[0] == "coefficients") { + if (specs.size() != 3) { + TBOX_ERROR("LocationIndexRobinBcCoefs::getFromInput error...\n" + << "exactly 2 values needed with \"coefficients\" boundary specifier" + << std::endl); } else { - TBOX_ERROR(d_object_name << ": Bad boundary specifier\n" - << "'" << specs[0] << "'. Use either 'value'\n" - << "'slope' or 'coefficients'.\n"); + d_a_map[i] = atof(specs[1].c_str()); + d_b_map[i] = atof(specs[2].c_str()); } + } else { + TBOX_ERROR(d_object_name << ": Bad boundary specifier\n" + << "'" << specs[0] << "'. Use either 'value'\n" + << "'slope' or 'coefficients'.\n"); } + } else { + TBOX_ERROR(d_object_name << ": Missing boundary specifier.\n"); } } } @@ -111,7 +128,7 @@ LocationIndexRobinBcCoefs::setBcCoefs( const hier::BoundaryBox& bdry_box, double fill_time) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, patch, bdry_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, patch, bdry_box); NULL_USE(variable); NULL_USE(patch); @@ -120,17 +137,17 @@ LocationIndexRobinBcCoefs::setBcCoefs( int location = bdry_box.getLocationIndex(); TBOX_ASSERT(location >= 0 && location < 2 * d_dim.getValue()); if (acoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *acoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *acoef_data); acoef_data->fill(d_a_map[location]); } if (bcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *bcoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *bcoef_data); bcoef_data->fill(d_b_map[location]); } if (gcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *gcoef_data); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *gcoef_data); gcoef_data->fill(d_g_map[location]); } @@ -151,7 +168,7 @@ LocationIndexRobinBcCoefs::numberOfExtensionsFillable() const ************************************************************************ */ -const LocationIndexRobinBcCoefs& +LocationIndexRobinBcCoefs& LocationIndexRobinBcCoefs::operator = ( const LocationIndexRobinBcCoefs& r) { @@ -166,4 +183,3 @@ LocationIndexRobinBcCoefs::operator = ( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.h index 66ed4d49..fd6e640e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/LocationIndexRobinBcCoefs.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition problem-dependent interfaces * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -44,25 +44,40 @@ namespace solv { * a and g directly (see RobinBcCoefStrategy) for the * meanings of a and g. * - * @b Inputs: - * You can specify the boundary conditions for any location index - * through the input database. One line is required for each - * location index. The input parameters are "boundary_N", where - * N is the index of the location. Each parameter must be - * a std::string array so that all boundary types can be accomodated - * the same way. The first std::string must be one of "value", - * "slope" or "coefficients". If the std::string is "value" or "slope" - * the next std::string is the value you want to set, defaulting to - * zero if not specified. If the first std::string is "coefficients", - * the next two strings specifies the values of a and g. + * Input Parameters + * + * Definitions: + * - \b boundary_N + * You can specify the boundary conditions for any location index + * through the input database. One line is required for each + * location index. The input parameters are "boundary_N", where + * N is the index of the location. Each parameter must be + * a std::string array so that all boundary types can be accomodated + * the same way. The first std::string must be one of "value", + * "slope" or "coefficients". If the std::string is "value" or "slope" + * the next std::string is the value you want to set. If the first + * std::string is "coefficients", the next two strings specify the + * values of a and b. + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
boundary_Narray of stringsnone"value", "gval"; "slope", "gval"; "coefficients", "aVal", "bVal"reqNot written to restart. Value in input db used.
* - * @b Examples inputs: - * @verbatim - * boundary_0 = "value", "0.0" - * boundary_1 = "value", "1.0" - * boundary_2 = "slope", "0.0" - * boundary_4 = "coefficients", "1.0", "0.0" - * @endverbatim */ class LocationIndexRobinBcCoefs: public RobinBcCoefStrategy @@ -70,12 +85,15 @@ class LocationIndexRobinBcCoefs: public: /*! - * @brief Constructor using database. + * @brief Constructor using input database. + * + * @pre input_db */ LocationIndexRobinBcCoefs( const tbox::Dimension& dim, const std::string& object_name, - const boost::shared_ptr& database); + const boost::shared_ptr& input_db = + boost::shared_ptr()); /*! * @brief Destructor. @@ -108,6 +126,13 @@ class LocationIndexRobinBcCoefs: * the coefficient data is needed. * @param fill_time Solution time corresponding to filling, * for use when coefficients are time-dependent. + * + * @pre (d_dim == patch.getDim()) && (d_dim == bdry_box.getDim()) + * @pre (!acoef_data || (d_dim == acoef_data.getDim()) + * @pre (!bcoef_data || (d_dim == acoef_data.betDim()) + * @pre (!gcoef_data || (d_dim == acoef_data.getDim()) + * @pre (bdry_box.getLocationIndex() >= 0) && + * (bdry_box.getLocationIndex() < 2 * d_dim.getValue()) */ void setBcCoefs( @@ -131,6 +156,8 @@ class LocationIndexRobinBcCoefs: * * @param location_index Set coefficients for this index. * @param value Boundary value at @c location_index. + * + * @pre (location_index >= 0) && (location_index < 2 * d_dim.getValue()) */ void setBoundaryValue( @@ -139,7 +166,7 @@ class LocationIndexRobinBcCoefs: { if (location_index < 0 || location_index >= 2 * d_dim.getValue()) { TBOX_ERROR("Location index in " << d_dim.getValue() << "D must be\n" - << "in [0," << 2 * d_dim.getValue() - 1 << "].\n"); + << "in [0," << 2 * d_dim.getValue() - 1 << ").\n"); } d_a_map[location_index] = 1.0; d_b_map[location_index] = 0.0; @@ -151,15 +178,17 @@ class LocationIndexRobinBcCoefs: * * @param location_index Set coefficients for this index. * @param slope Boundary slope at @c location_index. + * + * @pre (location_index >= 0) && (location_index < 2 * d_dim.getValue()) */ void setBoundarySlope( int location_index, double slope) { - if (location_index >= 2 * d_dim.getValue()) { + if (location_index < 0 || location_index >= 2 * d_dim.getValue()) { TBOX_ERROR("Location index in " << d_dim.getValue() << "D must be\n" - << "in [0," << 2 * d_dim.getValue() - 1 << "].\n"); + << "in [0," << 2 * d_dim.getValue() - 1 << ").\n"); } d_a_map[location_index] = 0.0; d_b_map[location_index] = 1.0; @@ -181,6 +210,8 @@ class LocationIndexRobinBcCoefs: * @param a Value of coefficient a at given location index. * @param b Value of coefficient b at given location index. * @param g Value of coefficient g at given location index. + * + * @pre (location_index >= 0) && (location_index < 2 * d_dim.getValue()) */ void setRawCoefficients( @@ -189,9 +220,9 @@ class LocationIndexRobinBcCoefs: double b, double g) { - if (location_index >= 2 * d_dim.getValue()) { + if (location_index < 0 || location_index >= 2 * d_dim.getValue()) { TBOX_ERROR("Location index in " << d_dim.getValue() << "D must be\n" - << "in [0," << 2 * d_dim.getValue() - 1 << "].\n"); + << "in [0," << 2 * d_dim.getValue() - 1 << ").\n"); } d_a_map[location_index] = a; d_b_map[location_index] = b; @@ -200,6 +231,13 @@ class LocationIndexRobinBcCoefs: /*! * @brief Access coefficients. + * + * @param location_index Set coefficients for this index. + * @param a Value of coefficient a at given location index. + * @param b Value of coefficient b at given location index. + * @param g Value of coefficient g at given location index. + * + * @pre (location_index >= 0) && (location_index < 2 * d_dim.getValue()) */ void getCoefficients( @@ -208,6 +246,10 @@ class LocationIndexRobinBcCoefs: double& b, double& g) const { + if (location_index < 0 || location_index >= 2 * d_dim.getValue()) { + TBOX_ERROR("Location index in " << d_dim.getValue() << "D must be\n" + << "in [0," << 2 * d_dim.getValue() - 1 << ").\n"); + } a = d_a_map[location_index]; b = d_b_map[location_index]; g = d_g_map[location_index]; @@ -227,7 +269,7 @@ class LocationIndexRobinBcCoefs: /*! * @brief Assignment operator. */ - const LocationIndexRobinBcCoefs& + LocationIndexRobinBcCoefs& operator = ( const LocationIndexRobinBcCoefs& r); @@ -238,12 +280,13 @@ class LocationIndexRobinBcCoefs: * See the class description for the parameters that can be set * from a database. * - * @param database Input database. If a NULL pointer is given, - * nothing is done. + * @param input_db Input database. + * + * @pre input_db */ void getFromInput( - const boost::shared_ptr& database); + const boost::shared_ptr& input_db); /* * @brief Object dimension @@ -258,16 +301,16 @@ class LocationIndexRobinBcCoefs: /* * @brief Mapping for a coefficient. */ - double d_a_map[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_a_map[2 * SAMRAI::MAX_DIM_VAL]; /* * @brief Mapping for b coefficient. */ - double d_b_map[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_b_map[2 * SAMRAI::MAX_DIM_VAL]; /* * @brief Mapping for g coefficient. */ - double d_g_map[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_g_map[2 * SAMRAI::MAX_DIM_VAL]; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.depend index fc40957c..ecb97f3e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -18,12 +18,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ CVODEAbstractFunctions.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=CVODESolver.o DEPENDS_1:=\ @@ -36,12 +35,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CVODESolver.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=CartesianRobinBcHelper.o DEPENDS_2:=\ @@ -75,6 +73,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -110,7 +109,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -122,8 +120,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -131,10 +129,11 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CartesianRobinBcHelper.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -151,11 +150,10 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=CellPoissonFACOps.o DEPENDS_3:=\ @@ -198,12 +196,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -300,7 +300,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -314,8 +313,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -337,10 +336,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CellPoissonFACOps.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -400,12 +399,11 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=CellPoissonFACSolver.o DEPENDS_4:=\ @@ -444,12 +442,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -547,7 +547,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -561,8 +560,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -583,10 +582,10 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CellPoissonFACSolver.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -646,12 +645,11 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=CellPoissonHypreSolver.o DEPENDS_5:=\ @@ -691,12 +689,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -734,7 +734,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -746,8 +745,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -756,7 +755,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CellPoissonHypreSolver.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ @@ -773,11 +771,10 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=FACOperatorStrategy.o DEPENDS_6:=\ @@ -813,12 +810,14 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -905,7 +904,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -917,8 +915,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -927,7 +925,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FACOperatorStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -986,11 +983,10 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=FACPreconditioner.o DEPENDS_7:=\ @@ -1026,12 +1022,14 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1122,7 +1120,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1134,8 +1131,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1144,7 +1141,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h FACPreconditioner.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1203,11 +1199,10 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=GhostCellRobinBcCoefs.o DEPENDS_8:=\ @@ -1234,6 +1229,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1253,7 +1249,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1265,7 +1260,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ @@ -1273,7 +1267,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h GhostCellRobinBcCoefs.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -1283,11 +1276,10 @@ DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_8}: ${DEPENDS_8} FILE_9=KINSOLAbstractFunctions.o DEPENDS_9:=\ @@ -1296,12 +1288,11 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ KINSOLAbstractFunctions.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_9 +=\ -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} + +${FILE_9}: ${DEPENDS_9} FILE_10=KINSOLSolver.o DEPENDS_10:=\ @@ -1314,12 +1305,11 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h KINSOLSolver.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_10 +=\ -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} + +${FILE_10}: ${DEPENDS_10} FILE_11=KINSOL_SAMRAIContext.o DEPENDS_11:=\ @@ -1355,12 +1345,14 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1452,7 +1444,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1465,8 +1456,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -1476,7 +1467,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h KINSOL_SAMRAIContext.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1535,11 +1525,10 @@ DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} + +${FILE_11}: ${DEPENDS_11} FILE_12=LocationIndexRobinBcCoefs.o DEPENDS_12:=\ @@ -1566,6 +1555,7 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1577,7 +1567,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/LocationIndexRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1589,24 +1578,21 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ LocationIndexRobinBcCoefs.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} + +${FILE_12}: ${DEPENDS_12} FILE_13=NonlinearSolverStrategy.o DEPENDS_13:=\ @@ -1642,12 +1628,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1734,7 +1722,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/NonlinearSolverStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1746,8 +1733,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1756,7 +1743,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NonlinearSolverStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -1815,11 +1801,10 @@ DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_13}: ${DEPENDS_13} FILE_14=PETScAbstractVectorReal.o DEPENDS_14:=\ @@ -1834,12 +1819,11 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PETScAbstractVectorReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_14 +=\ -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_14}: ${DEPENDS_14} FILE_15=PETSc_SAMRAIVectorReal.o DEPENDS_15:=\ @@ -1875,12 +1859,14 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1969,7 +1955,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1981,8 +1966,8 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1991,7 +1976,6 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PETSc_SAMRAIVectorReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2051,11 +2035,10 @@ DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} + +${FILE_15}: ${DEPENDS_15} FILE_16=PoissonSpecifications.o DEPENDS_16:=\ @@ -2066,12 +2049,11 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PoissonSpecifications.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_16 +=\ -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} + +${FILE_16}: ${DEPENDS_16} FILE_17=RobinBcCoefStrategy.o DEPENDS_17:=\ @@ -2097,6 +2079,7 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -2107,7 +2090,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -2119,23 +2101,20 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RobinBcCoefStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} + +${FILE_17}: ${DEPENDS_17} FILE_18=SAMRAIVectorReal.o DEPENDS_18:=\ @@ -2171,12 +2150,14 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2263,7 +2244,6 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2275,8 +2255,8 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2285,7 +2265,6 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SAMRAIVectorReal.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2343,11 +2322,10 @@ DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} + +${FILE_18}: ${DEPENDS_18} FILE_19=SNESAbstractFunctions.o DEPENDS_19:=\ @@ -2355,12 +2333,11 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/solv/SNESAbstractFunctions.h \ SNESAbstractFunctions.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_19 +=\ -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} + +${FILE_19}: ${DEPENDS_19} FILE_20=SNES_SAMRAIContext.o DEPENDS_20:=\ @@ -2396,12 +2373,14 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2492,7 +2471,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SNESAbstractFunctions.h \ $(INCLUDE_SAM)/SAMRAI/solv/SNES_SAMRAIContext.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2505,8 +2483,8 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -2516,7 +2494,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SNES_SAMRAIContext.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2577,11 +2554,10 @@ DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} + +${FILE_20}: ${DEPENDS_20} FILE_21=SimpleCellRobinBcCoefs.o DEPENDS_21:=\ @@ -2617,12 +2593,14 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2650,7 +2628,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2662,8 +2639,8 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2672,7 +2649,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SimpleCellRobinBcCoefs.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -2683,11 +2659,10 @@ DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} + +${FILE_21}: ${DEPENDS_21} FILE_22=SundialsAbstractVector.o DEPENDS_22:=\ @@ -2698,12 +2673,11 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SundialsAbstractVector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_22 +=\ -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} + +${FILE_22}: ${DEPENDS_22} FILE_23=Sundials_SAMRAIVector.o DEPENDS_23:=\ @@ -2739,12 +2713,14 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -2832,7 +2808,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -2844,8 +2819,8 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -2854,7 +2829,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Sundials_SAMRAIVector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -2913,11 +2887,10 @@ DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} + +${FILE_23}: ${DEPENDS_23} FILE_24=solv_NVector.o DEPENDS_24:=\ @@ -2929,10 +2902,9 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h solv_NVector.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_24 +=\ -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} + +${FILE_24}: ${DEPENDS_24} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.in index c31956c3..3e3d76c8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI solv package ## ######################################################################### @@ -48,7 +48,7 @@ OBJS = \ library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.C index 804f53fe..a807199a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface between implicit integrator and nonlinear solver. * ************************************************************************/ - -#ifndef included_solv_NonlinearSolverStrategy_C -#define included_solv_NonlinearSolverStrategy_C - #include "SAMRAI/solv/NonlinearSolverStrategy.h" namespace SAMRAI { @@ -26,4 +22,3 @@ NonlinearSolverStrategy::~NonlinearSolverStrategy() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.h index 1bf42438..12bebc09 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/NonlinearSolverStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface between implicit integrator and nonlinear solver. * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.C index 6f77cbf5..f7616fd4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to C++ vector implementation for PETSc package. * ************************************************************************/ @@ -40,7 +40,7 @@ template PETScAbstractVectorReal::PETScAbstractVectorReal( bool vector_created_via_duplicate, MPI_Comm comm): - d_petsc_vector(static_cast(NULL)), + d_petsc_vector(static_cast(0)), d_vector_created_via_duplicate(vector_created_via_duplicate), d_comm(comm) { @@ -51,12 +51,11 @@ PETScAbstractVectorReal::PETScAbstractVectorReal( PETSC_SAMRAI_ERROR(ierr); // Set PETSc vector data to this abstract vector object - d_petsc_vector->precision = PETSC_SCALAR; d_petsc_vector->data = this; d_petsc_vector->petscnative = PETSC_FALSE; - d_petsc_vector->map.n = 0; - d_petsc_vector->map.N = 0; - d_petsc_vector->map.bs = 1; + d_petsc_vector->map->n = 0; + d_petsc_vector->map->N = 0; + d_petsc_vector->map->bs = 1; // Assign vector operations to PETSc vector object. d_petsc_vector->ops->duplicate = PETScAbstractVectorReal::vecDuplicate; @@ -102,7 +101,6 @@ PETScAbstractVectorReal::PETScAbstractVectorReal( PETScAbstractVectorReal::vecMDot_local; d_petsc_vector->ops->mtdot_local = PETScAbstractVectorReal::vecMTDot_local; - d_petsc_vector->ops->loadintovector = VecLoadIntoVector_Default; d_petsc_vector->ops->maxpointwisedivide = PETScAbstractVectorReal::vecMaxPointwiseDivide; @@ -121,8 +119,6 @@ PETScAbstractVectorReal::PETScAbstractVectorReal( PETScAbstractVectorReal::vecReplaceArray; d_petsc_vector->ops->reciprocal = PETScAbstractVectorReal::vecReciprocal; - d_petsc_vector->ops->viewnative = - PETScAbstractVectorReal::vecViewNative; d_petsc_vector->ops->conjugate = PETScAbstractVectorReal::vecConjugate; d_petsc_vector->ops->setlocaltoglobalmapping = PETScAbstractVectorReal::vecSetLocalToGlobalMapping; @@ -141,22 +137,17 @@ PETScAbstractVectorReal::PETScAbstractVectorReal( PETScAbstractVectorReal::vecPointwiseMin; d_petsc_vector->ops->getvalues = PETScAbstractVectorReal::vecGetValues; - ierr = PetscMapInitialize(d_comm, &d_petsc_vector->map); + ierr = PetscLayoutCreate(d_comm, &d_petsc_vector->map); PETSC_SAMRAI_ERROR(ierr); - ierr = PetscMapSetBlockSize(&d_petsc_vector->map, 1); + ierr = PetscLayoutSetBlockSize(d_petsc_vector->map, 1); PETSC_SAMRAI_ERROR(ierr); - ierr = PetscMapSetSize(&d_petsc_vector->map, 0); + ierr = PetscLayoutSetSize(d_petsc_vector->map, 0); PETSC_SAMRAI_ERROR(ierr); - ierr = PetscMapSetLocalSize(&d_petsc_vector->map, 0); + ierr = PetscLayoutSetLocalSize(d_petsc_vector->map, 0); PETSC_SAMRAI_ERROR(ierr); const std::string my_name = "PETScAbstractVectorReal"; - if (d_petsc_vector->type_name) { - ierr = PetscFree(d_petsc_vector->type_name); - PETSC_SAMRAI_ERROR(ierr); - } - ierr = PetscObjectChangeTypeName(reinterpret_cast(d_petsc_vector), my_name.c_str()); @@ -170,7 +161,7 @@ PETScAbstractVectorReal::~PETScAbstractVectorReal() if (!d_vector_created_via_duplicate) { d_petsc_vector->ops->destroy = 0; - ierr = VecDestroy(d_petsc_vector); + ierr = VecDestroy(&d_petsc_vector); PETSC_SAMRAI_ERROR(ierr); } @@ -184,12 +175,12 @@ PETScAbstractVectorReal::vecDuplicateVecs( int n, Vec** varr_new) { - TBOX_ASSERT(!(v_in == (Vec)NULL)); + TBOX_ASSERT(v_in != 0); int ierr = 0; ierr = PetscMalloc(n * sizeof(Vec *), varr_new); PETSC_SAMRAI_ERROR(ierr); - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { PETScAbstractVectorReal::vecDuplicate(v_in, *varr_new + i); } PetscFunctionReturn(0); @@ -198,18 +189,18 @@ PETScAbstractVectorReal::vecDuplicateVecs( template PetscErrorCode PETScAbstractVectorReal::vecDestroyVecs( - Vec* v_arr, - PetscInt n) + PetscInt n, + Vec* v_arr) { int i; int ierr = 0; #ifdef DEBUG_CHECK_ASSERTIONS - for (i = 0; i < n; i++) { - TBOX_ASSERT(!(v_arr[i] == (Vec)NULL)); + for (i = 0; i < n; ++i) { + TBOX_ASSERT(v_arr[i] != 0); } #endif - for (i = 0; i < n; i++) { + for (i = 0; i < n; ++i) { Vec petsc_vec = v_arr[i]; vecDestroy(petsc_vec); @@ -220,7 +211,7 @@ PETScAbstractVectorReal::vecDestroyVecs( // However in the case of DuplicateVecs the VecDestroy // needs to be called on the PETSc Vec structure. petsc_vec->ops->destroy = 0; - ierr = VecDestroy(petsc_vec); + ierr = VecDestroy(&petsc_vec); PETSC_SAMRAI_ERROR(ierr); } @@ -244,7 +235,7 @@ PETScAbstractVectorReal::vecDuplicate( Vec v, Vec* newv) { - TBOX_ASSERT(!(v == (Vec)NULL)); + TBOX_ASSERT(v != 0); PETScAbstractVectorReal* new_pav = PABSVEC_CAST(v)->makeNewVector(); *newv = new_pav->getPETScVector(); @@ -261,8 +252,8 @@ PETScAbstractVectorReal::vecDot( Vec y, TYPE* val) { - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); *val = PABSVEC_CAST(x)->dotWith(PABSVEC_CAST(y)); @@ -278,10 +269,10 @@ PETScAbstractVectorReal::vecMDot( TYPE* val) { + TBOX_ASSERT(x != 0); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(x == (Vec)NULL)); - for (int i = 0; i < nv; i++) { - TBOX_ASSERT(!(y[i] == static_cast(NULL))); + for (int i = 0; i < nv; ++i) { + TBOX_ASSERT(y[i] != 0); } #endif @@ -301,7 +292,7 @@ PETScAbstractVectorReal::vecNorm( NormType type, TYPE* val) { - TBOX_ASSERT(x != static_cast(NULL)); + TBOX_ASSERT(x != 0); if (type == NORM_1) { *val = PABSVEC_CAST(x)->L1Norm(); } else if (type == NORM_2) { @@ -330,8 +321,8 @@ PETScAbstractVectorReal::vecTDot( Vec y, TYPE* val) { - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); *val = PABSVEC_CAST(x)->TdotWith(PABSVEC_CAST(y)); PetscFunctionReturn(0); @@ -345,10 +336,10 @@ PETScAbstractVectorReal::vecMTDot( const Vec* y, TYPE* val) { + TBOX_ASSERT(x != 0); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); for (PetscInt i = 0; i < nv; ++i) { - TBOX_ASSERT(y[i] != static_cast(NULL)); + TBOX_ASSERT(y[i] != 0); } #endif for (PetscInt i = 0; i < nv; ++i) { @@ -364,9 +355,8 @@ PETScAbstractVectorReal::vecScale( Vec x, TYPE alpha) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + PABSVEC_CAST(x)->scaleVector(alpha); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -380,10 +370,9 @@ PETScAbstractVectorReal::vecCopy( Vec x, Vec y) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + PABSVEC_CAST(y)->copyVector(PABSVEC_CAST(x)); int ierr = PetscObjectStateIncrease(reinterpret_cast(y)); @@ -397,9 +386,8 @@ PETScAbstractVectorReal::vecSet( Vec x, TYPE alpha) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + PABSVEC_CAST(x)->setToScalar(alpha); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -413,10 +401,9 @@ PETScAbstractVectorReal::vecSwap( Vec x, Vec y) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + PABSVEC_CAST(x)->swapWith(PABSVEC_CAST(y)); int ierr; @@ -434,10 +421,9 @@ PETScAbstractVectorReal::vecAXPY( TYPE alpha, Vec x) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + PABSVEC_CAST(y)->setAXPY(alpha, PABSVEC_CAST(x)); int ierr = PetscObjectStateIncrease(reinterpret_cast(y)); @@ -453,10 +439,9 @@ PETScAbstractVectorReal::vecAXPBY( TYPE beta, Vec x) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + PABSVEC_CAST(y)->setAXPBY(alpha, PABSVEC_CAST(x), beta); int ierr = PetscObjectStateIncrease(reinterpret_cast(y)); @@ -472,10 +457,10 @@ PETScAbstractVectorReal::vecMAXPY( const TYPE* alpha, Vec* x) { + TBOX_ASSERT(y != 0); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(y != static_cast(NULL)); for (PetscInt i = 0; i < nv; ++i) { - TBOX_ASSERT(x[i] != static_cast(NULL)); + TBOX_ASSERT(x[i] != 0); } #endif for (PetscInt i = 0; i < nv; ++i) { @@ -494,10 +479,9 @@ PETScAbstractVectorReal::vecAYPX( const TYPE alpha, Vec x) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + PABSVEC_CAST(y)->setAXPBY(1.0, PABSVEC_CAST(x), alpha); int ierr = PetscObjectStateIncrease(reinterpret_cast(y)); @@ -513,11 +497,10 @@ PETScAbstractVectorReal::vecWAXPY( Vec x, Vec y) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); - TBOX_ASSERT(w != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + TBOX_ASSERT(w != 0); + PABSVEC_CAST(w)->setWAXPY(alpha, PABSVEC_CAST(x), PABSVEC_CAST(y)); int ierr = PetscObjectStateIncrease(reinterpret_cast(w)); @@ -532,11 +515,10 @@ PETScAbstractVectorReal::vecPointwiseMult( Vec x, Vec y) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); - TBOX_ASSERT(w != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + TBOX_ASSERT(w != 0); + PABSVEC_CAST(w)->pointwiseMultiply(PABSVEC_CAST(x), PABSVEC_CAST(y)); int ierr = PetscObjectStateIncrease(reinterpret_cast(w)); PETSC_SAMRAI_ERROR(ierr); @@ -550,11 +532,10 @@ PETScAbstractVectorReal::vecPointwiseDivide( Vec x, Vec y) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); - TBOX_ASSERT(w != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); + TBOX_ASSERT(w != 0); + PABSVEC_CAST(w)->pointwiseDivide(PABSVEC_CAST(x), PABSVEC_CAST(y)); int ierr = PetscObjectStateIncrease(reinterpret_cast(w)); @@ -569,7 +550,7 @@ PETScAbstractVectorReal::vecGetArray( TYPE** a) { NULL_USE(x); - *a = NULL; + *a = 0; PetscFunctionReturn(0); } @@ -580,9 +561,8 @@ PETScAbstractVectorReal::vecGetSize( Vec x, PetscInt* size) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + *size = PABSVEC_CAST(x)->getDataSize(); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -596,9 +576,8 @@ PETScAbstractVectorReal::vecGetLocalSize( Vec x, PetscInt* size) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + *size = PABSVEC_CAST(x)->getLocalDataSize(); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -614,7 +593,7 @@ PETScAbstractVectorReal::vecRestoreArray( TYPE** a) { NULL_USE(x); - *a = NULL; + *a = 0; PetscFunctionReturn(0); } @@ -625,9 +604,8 @@ PETScAbstractVectorReal::vecMax( PetscInt* p, TYPE* val) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + PABSVEC_CAST(x)->vecMax(*p, *val); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -642,9 +620,8 @@ PETScAbstractVectorReal::vecMin( PetscInt* p, TYPE* val) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + PABSVEC_CAST(x)->vecMin(*p, *val); int ierr = PetscObjectStateIncrease(reinterpret_cast(x)); @@ -658,9 +635,8 @@ PETScAbstractVectorReal::vecSetRandom( Vec x, PetscRandom rctx) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TYPE lo, hi; int ierr; ierr = PetscRandomGetInterval(rctx, &lo, &hi); @@ -677,9 +653,7 @@ PetscErrorCode PETScAbstractVectorReal::vecDestroy( Vec v) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(v != static_cast(NULL)); -#endif + TBOX_ASSERT(v != 0); PABSVEC_CAST(v)->freeVector(); @@ -692,9 +666,7 @@ PETScAbstractVectorReal::vecView( Vec v, PetscViewer viewer) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(v != static_cast(NULL)); -#endif + TBOX_ASSERT(v != 0); NULL_USE(viewer); PABSVEC_CAST(v)->viewVector(); @@ -709,10 +681,8 @@ PETScAbstractVectorReal::vecDot_local( Vec y, TYPE* val) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); *val = PABSVEC_CAST(x)->dotWith(PABSVEC_CAST(y), true); @@ -726,10 +696,8 @@ PETScAbstractVectorReal::vecTDot_local( Vec y, TYPE* val) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); *val = PABSVEC_CAST(x)->TdotWith(PABSVEC_CAST(y), true); @@ -743,9 +711,7 @@ PETScAbstractVectorReal::vecNorm_local( NormType type, TYPE* val) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); if (type == NORM_1) { *val = PABSVEC_CAST(x)->L1Norm(true); @@ -776,10 +742,10 @@ PETScAbstractVectorReal::vecMDot_local( const Vec* y, TYPE* val) { + TBOX_ASSERT(x != 0); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); for (PetscInt i = 0; i < nv; ++i) { - TBOX_ASSERT(y[i] != static_cast(NULL)); + TBOX_ASSERT(y[i] != 0); } #endif for (PetscInt i = 0; i < nv; ++i) { @@ -797,10 +763,10 @@ PETScAbstractVectorReal::vecMTDot_local( const Vec* y, TYPE* val) { + TBOX_ASSERT(x != 0); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); for (PetscInt i = 0; i < nv; ++i) { - TBOX_ASSERT(y[i] != static_cast(NULL)); + TBOX_ASSERT(y[i] != 0); } #endif @@ -818,10 +784,8 @@ PETScAbstractVectorReal::vecMaxPointwiseDivide( Vec y, TYPE* max) { -#ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(x != static_cast(NULL)); - TBOX_ASSERT(y != static_cast(NULL)); -#endif + TBOX_ASSERT(x != 0); + TBOX_ASSERT(y != 0); *max = PABSVEC_CAST(x)->maxPointwiseDivide(PABSVEC_CAST(y)); PetscFunctionReturn(0); @@ -880,10 +844,12 @@ template PetscErrorCode PETScAbstractVectorReal::vecSetOption( Vec x, - VecOption op) + VecOption op, + PetscBool result) { NULL_USE(x); NULL_USE(op); + NULL_USE(result); TBOX_ERROR( "PETScAbstractVectorReal::vecSetOption() unimplemented" << std::endl); @@ -950,20 +916,6 @@ PETScAbstractVectorReal::vecReciprocal( PetscFunctionReturn(0); } -template -PetscErrorCode -PETScAbstractVectorReal::vecViewNative( - Vec v, - PetscViewer viewer) -{ - NULL_USE(v); - NULL_USE(viewer); - TBOX_ERROR( - "PETScAbstractVectorReal::vecViewNative() unimplemented" - << std::endl); - PetscFunctionReturn(0); -} - template PetscErrorCode PETScAbstractVectorReal::vecConjugate( @@ -1037,12 +989,10 @@ PETScAbstractVectorReal::vecSetFromOptions( template PetscErrorCode PETScAbstractVectorReal::vecLoad( - PetscViewer viewer, - VecType outtype, - Vec* newvec) + Vec newvec, + PetscViewer viewer) { NULL_USE(viewer); - NULL_USE(outtype); NULL_USE(newvec); TBOX_ERROR( "PETScAbstractVectorReal::vecLoad() unimplemented" << std::endl); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.h index 01d35db0..34372e48 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETScAbstractVectorReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to C++ vector implementation for PETSc package. * ************************************************************************/ @@ -31,6 +31,9 @@ #ifdef MPICH_SKIP_MPICXX #undef MPICH_SKIP_MPICXX #endif +#ifdef OMPI_SKIP_MPICXX +#undef OMPI_SKIP_MPICXX +#endif #include "petscvec.h" #endif @@ -363,8 +366,8 @@ class PETScAbstractVectorReal */ static PetscErrorCode vecDestroyVecs( - Vec* v_arr, - PetscInt n); + PetscInt n, + Vec* v_arr); /* * Computes the vector dot product. @@ -393,9 +396,8 @@ class PETScAbstractVectorReal * * typedef enum {NORM_1=0,NORM_2=1,NORM_FROBENIUS=2,NORM_INFINITY=3,NORM_1_AND_2=4} NormType; * - * If norm type is not NORM_1, NORM_2, NORM_INFINITY, or - * NORM_1_AND_2, an unrecoverable assertion will be thrown and - * program will abort. + * @pre (type == NORM_1) || (type == NORM_2) || (type == NORM_INFINITY) || + * (type == NORM_1_AND_2) */ static PetscErrorCode vecNorm( @@ -624,9 +626,8 @@ class PETScAbstractVectorReal * * typedef enum {NORM_1=0,NORM_2=1,NORM_FROBENIUS=2,NORM_INFINITY=3,NORM_1_AND_2=4} NormType; * - * If norm type is not NORM_1, NORM_2, NORM_INFINITY, or - * NORM_1_AND_2, an unrecoverable assertion will be thrown and - * program will abort. + * @pre (type == NORM_1) || (type == NORM_2) || (type == NORM_INFINITY) || + * (type == NORM_1_AND_2) */ static PetscErrorCode vecNorm_local( @@ -690,7 +691,8 @@ class PETScAbstractVectorReal static PetscErrorCode vecSetOption( Vec x, - VecOption op); + VecOption op, + PetscBool result); static PetscErrorCode vecSetValuesBlocked( @@ -746,9 +748,8 @@ class PETScAbstractVectorReal static PetscErrorCode vecLoad( - PetscViewer viewer, - VecType outtype, - Vec* newvec); + Vec newvec, + PetscViewer viewer); static PetscErrorCode vecPointwiseMax( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.C index 01e225eb..32659f04 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: "Glue code" between PETSc vector interface and SAMRAI vectors. * ************************************************************************/ @@ -57,11 +57,11 @@ void PETSc_SAMRAIVectorReal::destroyPETScVector( Vec petsc_vec) { - if (petsc_vec != static_cast(NULL)) { + if (petsc_vec != 0) { PETSc_SAMRAIVectorReal* psv = static_cast *>(petsc_vec->data); - TBOX_ASSERT(psv != NULL); + TBOX_ASSERT(psv != 0); delete psv; } @@ -72,13 +72,13 @@ boost::shared_ptr > PETSc_SAMRAIVectorReal::getSAMRAIVector( Vec petsc_vec) { - TBOX_ASSERT(petsc_vec != static_cast(NULL)); + TBOX_ASSERT(petsc_vec != 0); PETSc_SAMRAIVectorReal* psv = static_cast *>(petsc_vec->data); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(psv != NULL); + TBOX_ASSERT(psv != 0); #endif return psv->d_samrai_vector; @@ -151,7 +151,7 @@ PETSc_SAMRAIVectorReal::freeVector() Vec petsc_vec = this->getPETScVector(); #ifdef DEBUG_CHECK_TBOX_ASSERTIONS - TBOX_ASSERT(petsc_vec != static_cast(NULL)); + TBOX_ASSERT(petsc_vec != 0); #endif delete ((PETSc_SAMRAIVectorReal *)(petsc_vec->data)); } @@ -342,7 +342,7 @@ void PETSc_SAMRAIVectorReal::getDataArray( TYPE** array) { - *array = NULL; + *array = 0; } // getDataArray template @@ -350,7 +350,7 @@ void PETSc_SAMRAIVectorReal::restoreDataArray( TYPE** array) { - *array = NULL; + *array = 0; } // restoreDataArray template diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.h index 60b821f1..50fc4003 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PETSc_SAMRAIVectorReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: "Glue code" between PETSc vector interface and SAMRAI vectors. * ************************************************************************/ @@ -29,13 +29,16 @@ #ifdef MPICH_SKIP_MPICXX #undef MPICH_SKIP_MPICXX #endif +#ifdef OMPI_SKIP_MPICXX +#undef OMPI_SKIP_MPICXX +#endif #include "petscvec.h" #endif #include "SAMRAI/solv/PETScAbstractVectorReal.h" #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -63,8 +66,8 @@ namespace solv { * (i.e., data of type double or float. The class * PETSc_SAMRAIVectorComplex must be used for complex data. * - * @see solv::PETScAbstractVectorReal - * @see solv::SAMRAIVectorReal + * @see PETScAbstractVectorReal + * @see SAMRAIVectorReal */ template @@ -79,6 +82,8 @@ class PETSc_SAMRAIVectorReal:public PETScAbstractVectorReal * the vector data. Data must be allocated through the SAMRAI vector * object directly. For output of the data through PETSc "ViewVec" calls, * the output stream to which the SAMRAI vector object writes will be used. + * + * @pre samrai_vec */ static Vec createPETScVector( @@ -89,6 +94,8 @@ class PETSc_SAMRAIVectorReal:public PETScAbstractVectorReal * Destroy a given PETSc vector object. It is important to note that * this function does not deallocate storage for the vector data. * Vector data must be deallocated through the SAMRAI vector object. + * + * @pre !petsc_vec || petsc_vec->data */ static void destroyPETScVector( @@ -97,6 +104,8 @@ class PETSc_SAMRAIVectorReal:public PETScAbstractVectorReal /** * Return pointer to the SAMRAI vector object associated with the * given PETSc vector. + * + * @pre petsc_vec && petsc_vec->data */ static boost::shared_ptr > getSAMRAIVector( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.C index b43fc841..ef140eaa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Specifications for the scalar Poisson equation * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.h index c482eb1e..97bdddbc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/PoissonSpecifications.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Specifications for the scalar Poisson equation * ************************************************************************/ @@ -68,7 +68,7 @@ class PoissonSpecifications * * Assign everything except name. */ - const PoissonSpecifications& + PoissonSpecifications& operator = ( const PoissonSpecifications& r) { @@ -95,6 +95,8 @@ class PoissonSpecifications * * In addition, disregard any previous value * specified by setDConstant(). + * + * @pre id >= 0 */ void setDPatchDataId( @@ -152,6 +154,8 @@ class PoissonSpecifications * Error if D is not represented by a patch data id. * * @return D's id + * + * @pre d_D_id != -1 */ int getDPatchDataId() const @@ -170,6 +174,8 @@ class PoissonSpecifications * Error if D is not represented by a constant. * * @return D's constant value + * + * @pre d_D_id != -1 */ double getDConstant() const @@ -192,6 +198,8 @@ class PoissonSpecifications * * In addition, disregard any previous values * specified by setCConstant() or setCZero(). + * + * @pre id >= 0 */ void setCPatchDataId( @@ -289,6 +297,8 @@ class PoissonSpecifications * Error if C is not represented by a patch data id. * * @return C's patch data id + * + * @pre d_C_id != -1 */ int getCPatchDataId() const @@ -307,6 +317,8 @@ class PoissonSpecifications * Error if C is not represented by a constant. * * @return C's constant value + * + * @pre (d_C_id == -1) && !d_C_zero */ double getCConstant() const diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.C index e5d2c21c..b7a1679c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Operator class for solving scalar Poisson using FAC * ************************************************************************/ -#ifndef included_solv_RobinBcCoefStrategy_C -#define included_solv_RobinBcCoefStrategy_C - #include "SAMRAI/solv/RobinBcCoefStrategy.h" namespace SAMRAI { @@ -37,4 +34,3 @@ RobinBcCoefStrategy::~RobinBcCoefStrategy() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.h index 79294c23..45689c9e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/RobinBcCoefStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition problem-dependent interfaces * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -96,7 +96,7 @@ class RobinBcCoefStrategy * on the boundary is simple. * * The boundary condition coefficients should be placed - * in the pdat::ArrayData objects, @c acoef_data and @c gcoef_data + * in the pdat::ArrayData objects, @c acoef_data and @c gcoef_data * (see argument list), which are dimensioned to contain the indices * of the points alligned with @c variable and lying on the * the boundary defined by @c bdry_box. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.C index edaf9a73..0461ade4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Vector class for data on SAMRAI hierarchy. * ************************************************************************/ @@ -29,7 +29,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" #include #include #include @@ -46,24 +46,23 @@ namespace solv { */ template -int SAMRAIVectorReal::s_instance_counter[tbox::Dimension:: - MAXIMUM_DIMENSION_VALUE]; +int SAMRAIVectorReal::s_instance_counter[SAMRAI::MAX_DIM_VAL] = { 0 }; template boost::shared_ptr > SAMRAIVectorReal:: -s_cell_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +s_cell_ops[SAMRAI::MAX_DIM_VAL]; template boost::shared_ptr > SAMRAIVectorReal:: -s_edge_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +s_edge_ops[SAMRAI::MAX_DIM_VAL]; template boost::shared_ptr > SAMRAIVectorReal:: -s_face_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +s_face_ops[SAMRAI::MAX_DIM_VAL]; template boost::shared_ptr > SAMRAIVectorReal:: -s_node_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +s_node_ops[SAMRAI::MAX_DIM_VAL]; template boost::shared_ptr > SAMRAIVectorReal:: -s_side_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +s_side_ops[SAMRAI::MAX_DIM_VAL]; /* ************************************************************************* @@ -92,7 +91,7 @@ SAMRAIVectorReal::SAMRAIVectorReal( const tbox::Dimension& dim(d_hierarchy->getDim()); - SAMRAIVectorReal::s_instance_counter[dim.getValue() - 1]++; + ++SAMRAIVectorReal::s_instance_counter[dim.getValue() - 1]; if (name.empty()) { d_vector_name = "SAMRAIVectorReal"; @@ -118,16 +117,16 @@ SAMRAIVectorReal::~SAMRAIVectorReal() const tbox::Dimension& dim(d_hierarchy->getDim()); - SAMRAIVectorReal::s_instance_counter[dim.getValue() - 1]--; + --SAMRAIVectorReal::s_instance_counter[dim.getValue() - 1]; d_number_components = 0; - d_component_variable.resizeArray(0); - d_component_data_id.resizeArray(0); - d_component_operations.resizeArray(0); - d_control_volume_data_id.resizeArray(0); + d_component_variable.resize(0); + d_component_data_id.resize(0); + d_component_operations.resize(0); + d_control_volume_data_id.resize(0); - d_variableid_2_vectorcomponent_map.resizeArray(0); + d_variableid_2_vectorcomponent_map.resize(0); if (SAMRAIVectorReal::s_instance_counter[dim.getValue() - 1] == 0) { if (SAMRAIVectorReal::s_cell_ops[dim.getValue() - 1]) { @@ -149,31 +148,6 @@ SAMRAIVectorReal::~SAMRAIVectorReal() } -/* - ************************************************************************* - * - * The following are private and cannot be used, but they are defined - * here for compilers that require that every template declaration have - * a definition (a stupid requirement, if you ask me). - * - ************************************************************************* - */ - -template -SAMRAIVectorReal::SAMRAIVectorReal( - const SAMRAIVectorReal& foo) -{ - NULL_USE(foo); -} - -template -void -SAMRAIVectorReal::operator = ( - const SAMRAIVectorReal& foo) -{ - NULL_USE(foo); -} - /* ************************************************************************* * @@ -234,7 +208,7 @@ SAMRAIVectorReal::cloneVector( hier::VariableDatabase* var_db = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { int new_id = var_db->registerClonedPatchDataIndex(d_component_variable[i], @@ -269,19 +243,19 @@ SAMRAIVectorReal::freeVectorComponents() // free entries from variable database and return // patch descriptor indices - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { var_db->removePatchDataIndex(d_component_data_id[i]); } // reset variable state d_number_components = 0; - d_component_variable.resizeArray(0); - d_component_data_id.resizeArray(0); - d_component_operations.resizeArray(0); - d_control_volume_data_id.resizeArray(0); + d_component_variable.resize(0); + d_component_data_id.resize(0); + d_component_operations.resize(0); + d_control_volume_data_id.resize(0); - d_variableid_2_vectorcomponent_map.resizeArray(0); + d_variableid_2_vectorcomponent_map.resize(0); } /* @@ -335,12 +309,12 @@ SAMRAIVectorReal::addComponent( } #endif - d_number_components++; + ++d_number_components; - d_component_variable.resizeArray(d_number_components); - d_component_data_id.resizeArray(d_number_components); - d_component_operations.resizeArray(d_number_components); - d_control_volume_data_id.resizeArray(d_number_components); + d_component_variable.resize(d_number_components); + d_component_data_id.resize(d_number_components); + d_component_operations.resize(d_number_components); + d_control_volume_data_id.resize(d_number_components); hier::VariableDatabase::getDatabase()->registerPatchDataIndex(var, comp_data_id); @@ -369,10 +343,10 @@ SAMRAIVectorReal::allocateVectorData( && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { level->allocatePatchData(d_component_data_id[i], timestamp); } } @@ -387,10 +361,10 @@ SAMRAIVectorReal::deallocateVectorData() && (d_finest_level >= d_coarsest_level) && (d_finest_level <= d_hierarchy->getFinestLevelNumber())); - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { boost::shared_ptr level( d_hierarchy->getPatchLevel(ln)); - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { level->deallocatePatchData(d_component_data_id[i]); } } @@ -415,9 +389,9 @@ SAMRAIVectorReal::print( << " : finest level = " << d_finest_level << std::endl; s << "d_number_components = " << d_number_components << std::endl; - for (int ln = d_coarsest_level; ln <= d_finest_level; ln++) { + for (int ln = d_coarsest_level; ln <= d_finest_level; ++ln) { s << "Printing data components on level " << ln << std::endl; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { s << "Vector component index = " << i << std::endl; d_component_operations[i]->resetLevels(ln, ln); d_component_operations[i]->printData(d_component_data_id[i], @@ -444,10 +418,10 @@ SAMRAIVectorReal::setNumberOfComponents( { d_number_components = num_comp; - d_component_variable.resizeArray(d_number_components); - d_component_data_id.resizeArray(d_number_components); - d_component_operations.resizeArray(d_number_components); - d_control_volume_data_id.resizeArray(d_number_components); + d_component_variable.resize(d_number_components); + d_component_data_id.resize(d_number_components); + d_component_operations.resize(d_number_components); + d_control_volume_data_id.resize(d_number_components); } template @@ -463,34 +437,34 @@ SAMRAIVectorReal::setComponent( const tbox::Dimension& dim(d_hierarchy->getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, *var); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, *var); d_component_variable[comp_id] = var; d_component_data_id[comp_id] = data_id; if (!vop) { const boost::shared_ptr > cellvar( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var)); const boost::shared_ptr > edgevar( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var)); const boost::shared_ptr > facevar( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var)); const boost::shared_ptr > nodevar( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var)); const boost::shared_ptr > sidevar( - var, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, hier::Variable>( + var)); if (cellvar) { if (!SAMRAIVectorReal::s_cell_ops[dim.getValue() - 1]) { SAMRAIVectorReal::s_cell_ops[dim.getValue() - 1].reset( new math::HierarchyCellDataOpsReal(d_hierarchy, - d_coarsest_level, - d_finest_level)); + d_coarsest_level, + d_finest_level)); } d_component_operations[comp_id] = SAMRAIVectorReal::s_cell_ops[dim.getValue() - 1]; @@ -498,8 +472,8 @@ SAMRAIVectorReal::setComponent( if (!SAMRAIVectorReal::s_edge_ops[dim.getValue() - 1]) { SAMRAIVectorReal::s_edge_ops[dim.getValue() - 1].reset( new math::HierarchyEdgeDataOpsReal(d_hierarchy, - d_coarsest_level, - d_finest_level)); + d_coarsest_level, + d_finest_level)); } d_component_operations[comp_id] = SAMRAIVectorReal::s_edge_ops[dim.getValue() - 1]; @@ -507,8 +481,8 @@ SAMRAIVectorReal::setComponent( if (!SAMRAIVectorReal::s_face_ops[dim.getValue() - 1]) { SAMRAIVectorReal::s_face_ops[dim.getValue() - 1].reset( new math::HierarchyFaceDataOpsReal(d_hierarchy, - d_coarsest_level, - d_finest_level)); + d_coarsest_level, + d_finest_level)); } d_component_operations[comp_id] = SAMRAIVectorReal::s_face_ops[dim.getValue() - 1]; @@ -516,8 +490,8 @@ SAMRAIVectorReal::setComponent( if (!SAMRAIVectorReal::s_node_ops[dim.getValue() - 1]) { SAMRAIVectorReal::s_node_ops[dim.getValue() - 1].reset( new math::HierarchyNodeDataOpsReal(d_hierarchy, - d_coarsest_level, - d_finest_level)); + d_coarsest_level, + d_finest_level)); } d_component_operations[comp_id] = SAMRAIVectorReal::s_node_ops[dim.getValue() - 1]; @@ -525,8 +499,8 @@ SAMRAIVectorReal::setComponent( if (!SAMRAIVectorReal::s_side_ops[dim.getValue() - 1]) { SAMRAIVectorReal::s_side_ops[dim.getValue() - 1].reset( new math::HierarchySideDataOpsReal(d_hierarchy, - d_coarsest_level, - d_finest_level)); + d_coarsest_level, + d_finest_level)); } d_component_operations[comp_id] = SAMRAIVectorReal::s_side_ops[dim.getValue() - 1]; @@ -541,13 +515,13 @@ SAMRAIVectorReal::setComponent( int var_id = var->getInstanceIdentifier(); - int oldsize = d_variableid_2_vectorcomponent_map.getSize(); + int oldsize = static_cast(d_variableid_2_vectorcomponent_map.size()); int newsize = var_id + 1; if (oldsize < newsize) { newsize = tbox::MathUtilities::Max( oldsize + DESCRIPTOR_ID_ARRAY_SCRATCH_SPACE, newsize); - d_variableid_2_vectorcomponent_map.resizeArray(newsize); - for (int i = oldsize; i < newsize; i++) { + d_variableid_2_vectorcomponent_map.resize(newsize); + for (int i = oldsize; i < newsize; ++i) { d_variableid_2_vectorcomponent_map[i] = -1; } } @@ -573,7 +547,7 @@ SAMRAIVectorReal::copyVector( const boost::shared_ptr >& src_vec, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->copyData(d_component_data_id[i], src_vec->getComponentDescriptorIndex(i), @@ -586,7 +560,7 @@ void SAMRAIVectorReal::swapVectors( const boost::shared_ptr >& other) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->swapData(d_component_data_id[i], other->getComponentDescriptorIndex(i)); @@ -599,7 +573,7 @@ SAMRAIVectorReal::setToScalar( const TYPE& alpha, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->setToScalar(d_component_data_id[i], alpha, @@ -614,7 +588,7 @@ SAMRAIVectorReal::scale( const boost::shared_ptr >& x, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->scale(d_component_data_id[i], alpha, @@ -630,7 +604,7 @@ SAMRAIVectorReal::addScalar( const TYPE& alpha, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->addScalar(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -646,7 +620,7 @@ SAMRAIVectorReal::add( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->add(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -662,7 +636,7 @@ SAMRAIVectorReal::subtract( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->subtract(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -678,7 +652,7 @@ SAMRAIVectorReal::multiply( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->multiply(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -694,7 +668,7 @@ SAMRAIVectorReal::divide( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->divide(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -709,7 +683,7 @@ SAMRAIVectorReal::reciprocal( const boost::shared_ptr >& x, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->reciprocal(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -726,7 +700,7 @@ SAMRAIVectorReal::linearSum( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->linearSum(d_component_data_id[i], alpha, @@ -745,7 +719,7 @@ SAMRAIVectorReal::axpy( const boost::shared_ptr >& y, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->axpy(d_component_data_id[i], alpha, @@ -761,7 +735,7 @@ SAMRAIVectorReal::abs( const boost::shared_ptr >& x, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->abs(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -776,7 +750,7 @@ SAMRAIVectorReal::setRandomValues( const TYPE& low, const bool interior_only) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]->setRandomValues(d_component_data_id[i], width, @@ -792,7 +766,7 @@ SAMRAIVectorReal::L1Norm( { double norm = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); norm += d_component_operations[i]->L1Norm(d_component_data_id[i], d_control_volume_data_id[i], @@ -809,7 +783,7 @@ SAMRAIVectorReal::L2Norm( { double norm_squared = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); double comp_norm = d_component_operations[i]->L2Norm(d_component_data_id[i], @@ -828,7 +802,7 @@ SAMRAIVectorReal::weightedL2Norm( { double norm_squared = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); double comp_norm = d_component_operations[i]->weightedL2Norm( d_component_data_id[i], @@ -847,7 +821,7 @@ SAMRAIVectorReal::RMSNorm() const double num = L2Norm(); double denom = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); if (d_control_volume_data_id[i] < 0) { denom += double(d_component_operations[i]-> @@ -872,7 +846,7 @@ SAMRAIVectorReal::weightedRMSNorm( double num = weightedL2Norm(wgt); double denom = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); if (d_control_volume_data_id[i] < 0) { denom += double(d_component_operations[i]-> @@ -896,7 +870,7 @@ SAMRAIVectorReal::maxNorm( { double norm = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); norm = tbox::MathUtilities::Max(norm, d_component_operations[i]->maxNorm( @@ -916,7 +890,7 @@ SAMRAIVectorReal::dot( { TYPE dprod = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); dprod += d_component_operations[i]->dot(d_component_data_id[i], x->getComponentDescriptorIndex(i), @@ -942,7 +916,7 @@ SAMRAIVectorReal::computeConstrProdPos( computeConstrProdPos(d_component_data_id[i], x->getComponentDescriptorIndex(i), d_control_volume_data_id[i])); - i++; + ++i; } return test; @@ -954,7 +928,7 @@ SAMRAIVectorReal::compareToScalar( const boost::shared_ptr >& x, const TYPE& alpha) { - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); d_component_operations[i]-> compareToScalar(d_component_data_id[i], @@ -971,7 +945,7 @@ SAMRAIVectorReal::testReciprocal( { int test = 1; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); test = tbox::MathUtilities::Min(test, d_component_operations[i]-> @@ -991,7 +965,7 @@ SAMRAIVectorReal::maxPointwiseDivide( const tbox::SAMRAI_MPI& mpi(d_hierarchy->getMPI()); TYPE max = 0.0; - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); TYPE component_max = d_component_operations[i]->maxPointwiseDivide(d_component_data_id[i], @@ -1013,7 +987,7 @@ SAMRAIVectorReal::min( { TYPE minval = tbox::MathUtilities::getMax(); - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); minval = tbox::MathUtilities::Min( minval, @@ -1031,7 +1005,7 @@ SAMRAIVectorReal::max( { TYPE maxval = -tbox::MathUtilities::getMax(); - for (int i = 0; i < d_number_components; i++) { + for (int i = 0; i < d_number_components; ++i) { d_component_operations[i]->resetLevels(d_coarsest_level, d_finest_level); maxval = tbox::MathUtilities::Max( maxval, diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.h index 9f5d9a8d..ccf80742 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SAMRAIVectorReal.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Vector class for real data on SAMRAI hierarchy. * ************************************************************************/ @@ -18,10 +18,9 @@ #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/Variable.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -110,11 +109,9 @@ class SAMRAIVectorReal * added as vector components. In any case, storage for all * components must be allocated before the vector can be used. * - * It is important to note that a non-recoverable assertion will result - * if the specified levels do not exist in the hierarchy before a vector - * object is used, or if the hierarchy pointer itself is null. The range - * levels can be reset at any time (e.g., if the level configuration - * changes by re-meshing), by calling the resetLevels() member function. + * The range levels can be reset at any time (e.g., if the level + * configuration changes by re-meshing), by calling the resetLevels() member + * function. * * Although an empty std::string may be passed as the vector name, it is * recommended that a descriptive name be used to facilitate debugging @@ -123,6 +120,10 @@ class SAMRAIVectorReal * By default the vector component information and data will be sent to * the "plog" output stream when the print() function is called. This * stream can be changed at any time via the setOutputStream() function. + * + * @pre hierarchy + * @pre (coarsest_level >= 0) && (finest_level >= coarsest_level) && + * (finest_level <= hierarchy->getFinestLevelNumber()) */ SAMRAIVectorReal( const std::string& name, @@ -210,6 +211,8 @@ class SAMRAIVectorReal /** * Return patch data object for given vector component index. + * + * @pre (comp_id >= 0) && (comp_id < getNumberOfComponents()) */ boost::shared_ptr getComponentPatchData( @@ -218,6 +221,9 @@ class SAMRAIVectorReal /** * Return patch data object associated with given variable. + * + * @pre var + * @pre d_variableid_2_vectorcomponent_map[var->getInstanceIdentifier()] >= 0 */ boost::shared_ptr getComponentPatchData( @@ -226,6 +232,8 @@ class SAMRAIVectorReal /** * Return pointer to variable for specified vector component. + * + * @pre (component >= 0) && (component < getNumberOfComponents()) */ boost::shared_ptr getComponentVariable( @@ -233,6 +241,8 @@ class SAMRAIVectorReal /** * Return patch data index for specified vector component. + * + * @pre (component >= 0) && (component < getNumberOfComponents()) */ int getComponentDescriptorIndex( @@ -240,6 +250,8 @@ class SAMRAIVectorReal /** * Return patch data index of control volume data for vector component. + * + * @pre (component >= 0) && (component < getNumberOfComponents()) */ int getControlVolumeIndex( @@ -293,9 +305,8 @@ class SAMRAIVectorReal * Thus, the mapping between the variable and its patch data for the * vector can be obtained from the variable database if needed. * - * When assertion checking is active, this routine checks make sure - * that the type of the variable matches the types associated with - * the patch data indices passed in. + * @pre hier::VariableDatabase::getDatabase()->checkVariablePatchDataIndexType(var, comp_data_id) + * @pre (comp_vol_id < 0) || (hier::VariableDatabase::getDatabase()->checkVariablePatchDataIndexType(var, comp_vol_id)) */ void addComponent( @@ -307,6 +318,11 @@ class SAMRAIVectorReal /** * Allocate data storage for all components of this vector object. + * + * @pre getPatchHierarchy + * @pre (getCoarsestLevelNumber() >= 0) && + * (getFinestLevelNumber() >= getCoarsestLevelNumber()) && + * (getFinestLevelNumber( <= d_hierarchy->getFinestLevelNumber()) */ void allocateVectorData( @@ -316,6 +332,11 @@ class SAMRAIVectorReal * Deallocate data storage for all components of this vector object. * Note that this routine will not free the associated data * indices in the patch descriptor. See freeVectorComponents() function. + * + * @pre getPatchHierarchy + * @pre (getCoarsestLevelNumber() >= 0) && + * (getFinestLevelNumber() >= getCoarsestLevelNumber()) && + * (getFinestLevelNumber( <= d_hierarchy->getFinestLevelNumber()) */ void deallocateVectorData(); @@ -644,10 +665,10 @@ class SAMRAIVectorReal // The following are not implemented SAMRAIVectorReal( - const SAMRAIVectorReal&); - void + const SAMRAIVectorReal&); + SAMRAIVectorReal& operator = ( - const SAMRAIVectorReal&); + const SAMRAIVectorReal&); /* * Private member function to set number of vector components. This @@ -664,8 +685,10 @@ class SAMRAIVectorReal * either double or float vector types. This function is called from * addComponent() and clonevector(). * - * A non-recoverable assertion will be thrown if component id is - * greater than the number of componenents in the vector. + * @pre comp_id < getNumberOfComponents() + * @pre getPatchHierarchy()->getDim() == var->getDim() + * + * @post d_component_operations[comp_id] */ #ifdef _MSC_VER boost::shared_ptr > _bug_in_msvc; @@ -679,19 +702,19 @@ class SAMRAIVectorReal const boost::shared_ptr >& vop = boost::shared_ptr >()); - static int s_instance_counter[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + static int s_instance_counter[SAMRAI::MAX_DIM_VAL]; // shared data operations for variaous array-based types... static boost::shared_ptr > - s_cell_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_cell_ops[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_edge_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_edge_ops[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_face_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_face_ops[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_node_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_node_ops[SAMRAI::MAX_DIM_VAL]; static boost::shared_ptr > - s_side_ops[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_side_ops[SAMRAI::MAX_DIM_VAL]; std::string d_vector_name; @@ -702,15 +725,15 @@ class SAMRAIVectorReal int d_number_components; // arrays for component information whose size is the number of components - tbox::Array > d_component_variable; - tbox::Array d_component_data_id; - tbox::Array > > + std::vector > d_component_variable; + std::vector d_component_data_id; + std::vector > > d_component_operations; - tbox::Array d_control_volume_data_id; + std::vector d_control_volume_data_id; // map from variable instance id to vector component index: // size = largest instance id over all variables in vector. - tbox::Array d_variableid_2_vectorcomponent_map; + std::vector d_variableid_2_vectorcomponent_map; // output stream for vector data std::ostream* d_output_stream; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.C index a4118853..ccbecff2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user functions for SAMRAI-based PETSc SNES context * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.h index b3ea4377..dc3eae5a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNESAbstractFunctions.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to user functions for SAMRAI-based PETSc SNES context * ************************************************************************/ @@ -16,28 +16,23 @@ #ifdef HAVE_PETSC /* - * This is needed since petsc defines MPICH_SKIP_MPICXX so if SAMRAI - * has already defined it the compile will fail. + * This is needed since petsc defines MPICH_SKIP_MPICXX and OMPI_SKIP_MPICXX + * so if SAMRAI has already defined them the compile will fail. */ #ifndef samrai_included_petsc_snes #define samrai_included_petsc_snes #ifdef MPICH_SKIP_MPICXX #undef MPICH_SKIP_MPICXX #endif +#ifdef OMPI_SKIP_MPICXX +#undef OMPI_SKIP_MPICXX +#endif extern "C" { -#ifdef PETSC2028 -#include "snes.h" -#else #include "petscsnes.h" -#endif } #endif -#ifndef MPICH_SKIP_MPICXX -#define MPICH_SKIP_MPICXX -#endif - #ifdef REQUIRES_CMATH #include #endif @@ -65,7 +60,7 @@ namespace solv { * Note that the virtual members of this class are all protected. They should * not be used outside of a subclass of this class. * - * @see solv::SNES_SAMRAIContext + * @see SNES_SAMRAIContext */ class SNESAbstractFunctions diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.C index 98fc8571..53c40f00 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Wrapper for SNES solver for use in a SAMRAI-based application. * ************************************************************************/ - -#ifndef included_solv_SNES_SAMRAIContext_C -#define included_solv_SNES_SAMRAIContext_C - #include "SAMRAI/solv/SNES_SAMRAIContext.h" #include "SAMRAI/solv/PETSc_SAMRAIVectorReal.h" @@ -71,87 +67,58 @@ SNES_SAMRAIContext::SNESJacobianSet( */ SNES_SAMRAIContext::SNES_SAMRAIContext( const std::string& object_name, - const boost::shared_ptr& input_db, - SNESAbstractFunctions* my_functions) + SNESAbstractFunctions* my_functions, + const boost::shared_ptr& input_db): + d_object_name(object_name), + d_context_needs_initialization(true), + d_SNES_solver(0), + d_krylov_solver(0), + d_jacobian(0), + d_preconditioner(0), + d_solution_vector(0), + d_residual_vector(0), + d_SNES_functions(my_functions), + d_uses_preconditioner(true), + d_uses_explicit_jacobian(true), + d_maximum_nonlinear_iterations(PETSC_DEFAULT), + d_maximum_function_evals(PETSC_DEFAULT), + d_absolute_tolerance(PETSC_DEFAULT), + d_relative_tolerance(PETSC_DEFAULT), + d_step_tolerance(PETSC_DEFAULT), + d_forcing_term_strategy("CONSTANT"), + d_forcing_term_flag(PETSC_DEFAULT), + d_constant_forcing_term(PETSC_DEFAULT), + d_initial_forcing_term(PETSC_DEFAULT), + d_maximum_forcing_term(PETSC_DEFAULT), + d_EW_choice2_alpha(PETSC_DEFAULT), + d_EW_choice2_gamma(PETSC_DEFAULT), + d_EW_safeguard_exponent(PETSC_DEFAULT), + d_EW_safeguard_disable_threshold(PETSC_DEFAULT), + d_SNES_completion_code(SNES_CONVERGED_ITERATING), + d_linear_solver_absolute_tolerance(PETSC_DEFAULT), + d_linear_solver_divergence_tolerance(PETSC_DEFAULT), + d_maximum_linear_iterations(PETSC_DEFAULT), + d_maximum_gmres_krylov_dimension(PETSC_DEFAULT), + d_differencing_parameter_strategy(MATMFFD_WP), + d_function_evaluation_error(PETSC_DEFAULT), + d_nonlinear_iterations(0) { TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(!(my_functions == (SNESAbstractFunctions *)NULL)); + TBOX_ASSERT(my_functions != 0); - d_object_name = object_name; - d_context_needs_initialization = true; tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); - /* - * Set default state. - */ - - d_SNES_solver = ((SNES)NULL); - d_krylov_solver = ((KSP)NULL); - d_jacobian = ((Mat)NULL); - d_preconditioner = ((PC)NULL); - d_solution_vector = ((Vec)NULL); - d_residual_vector = ((Vec)NULL); - - d_SNES_functions = my_functions; - - /* - * Default nonlinear solver parameters. - */ - - d_absolute_tolerance = PETSC_DEFAULT; - d_relative_tolerance = PETSC_DEFAULT; - d_step_tolerance = PETSC_DEFAULT; - d_maximum_nonlinear_iterations = PETSC_DEFAULT; - d_maximum_function_evals = PETSC_DEFAULT; - - d_forcing_term_strategy = "CONSTANT"; - d_forcing_term_flag = PETSC_DEFAULT; - - d_constant_forcing_term = PETSC_DEFAULT; - d_initial_forcing_term = PETSC_DEFAULT; - d_maximum_forcing_term = PETSC_DEFAULT; - d_EW_choice2_alpha = PETSC_DEFAULT; - d_EW_choice2_gamma = PETSC_DEFAULT; - d_EW_safeguard_exponent = PETSC_DEFAULT; - d_EW_safeguard_disable_threshold = PETSC_DEFAULT; - - d_SNES_completion_code = SNES_CONVERGED_ITERATING; - - /* - * Default linear solver parameters. - */ - - d_linear_solver_absolute_tolerance = PETSC_DEFAULT; - d_linear_solver_divergence_tolerance = PETSC_DEFAULT; - d_maximum_linear_iterations = PETSC_DEFAULT; - - d_maximum_gmres_krylov_dimension = PETSC_DEFAULT; - d_gmres_orthogonalization_algorithm = PETSC_DEFAULT; - - /* - * Default "Matrix-free" parameters. - */ - - d_function_evaluation_error = PETSC_DEFAULT; - d_differencing_parameter_strategy = MATMFFD_WP; - - /* - * Default output parameters. - */ - - d_nonlinear_iterations = 0; - /* * Initialize members with data read from the input and restart * databases. Note that PETSc object parameters are set in * initialize(). */ - - if (tbox::RestartManager::getManager()->isFromRestart()) { + bool is_from_restart = tbox::RestartManager::getManager()->isFromRestart(); + if (is_from_restart) { getFromRestart(); } - getFromInput(input_db); + getFromInput(input_db, is_from_restart); } @@ -263,7 +230,7 @@ SNES_SAMRAIContext::solve() &d_SNES_completion_code); PETSC_SAMRAI_ERROR(ierr); - ierr = VecDestroy(initial_guess); + ierr = VecDestroy(&initial_guess); PETSC_SAMRAI_ERROR(ierr); return ((int)d_SNES_completion_code > 0) ? 1 : 0; @@ -301,7 +268,7 @@ SNES_SAMRAIContext::reportCompletionCode( case SNES_DIVERGED_MAX_IT: os << " Maximum nonlinear iteration count exceeded.\n"; break; - case SNES_DIVERGED_LS_FAILURE: + case SNES_DIVERGED_LINE_SEARCH: os << " Failure in linesearch procedure.\n"; break; default: @@ -327,12 +294,10 @@ SNES_SAMRAIContext::createPetscObjects() * Create the nonlinear solver, specify linesearch backtracking, * and register method for nonlinear residual evaluation. */ - ierr = SNESCreate(PETSC_COMM_SELF, - &d_SNES_solver); + ierr = SNESCreate(PETSC_COMM_SELF, &d_SNES_solver); PETSC_SAMRAI_ERROR(ierr); - ierr = SNESSetType(d_SNES_solver, - SNESLS); + ierr = SNESSetType(d_SNES_solver, SNESLS); PETSC_SAMRAI_ERROR(ierr); ierr = SNESSetFunction(d_SNES_solver, @@ -352,16 +317,13 @@ SNES_SAMRAIContext::createPetscObjects() // &d_krylov_solver); // PETSC_SAMRAI_ERROR(ierr); - ierr = SNESGetKSP(d_SNES_solver, - &d_krylov_solver); + ierr = SNESGetKSP(d_SNES_solver, &d_krylov_solver); PETSC_SAMRAI_ERROR(ierr); - ierr = KSPSetPreconditionerSide(d_krylov_solver, - PC_RIGHT); + ierr = KSPSetPCSide(d_krylov_solver, PC_RIGHT); PETSC_SAMRAI_ERROR(ierr); - ierr = KSPGetPC(d_krylov_solver, - &d_preconditioner); + ierr = KSPGetPC(d_krylov_solver, &d_preconditioner); PETSC_SAMRAI_ERROR(ierr); } @@ -414,7 +376,9 @@ SNES_SAMRAIContext::initializePetscObjects() * * First delete any Jacobian object that already has been created. */ - if (d_jacobian) MatDestroy(d_jacobian); + if (d_jacobian) { + MatDestroy(&d_jacobian); + } if (d_uses_explicit_jacobian) { ierr = MatCreateShell(PETSC_COMM_SELF, @@ -469,8 +433,7 @@ SNES_SAMRAIContext::initializePetscObjects() * type of Krylov method that is used and tolerances used by the * method. */ - ierr = KSPSetType(d_krylov_solver, - (KSPType)d_linear_solver_type.c_str()); + ierr = KSPSetType(d_krylov_solver, (KSPType)d_linear_solver_type.c_str()); PETSC_SAMRAI_ERROR(ierr); if (d_linear_solver_type == "gmres") { @@ -522,12 +485,10 @@ SNES_SAMRAIContext::initializePetscObjects() if (d_uses_preconditioner) { std::string pc_type = "shell"; - ierr = PCSetType(d_preconditioner, - (PCType)pc_type.c_str()); + ierr = PCSetType(d_preconditioner, (PCType)pc_type.c_str()); PETSC_SAMRAI_ERROR(ierr); - ierr = PCShellSetSetUp( - d_preconditioner, + ierr = PCShellSetSetUp(d_preconditioner, SNES_SAMRAIContext::SNESsetupPreconditioner); PETSC_SAMRAI_ERROR(ierr); @@ -541,8 +502,7 @@ SNES_SAMRAIContext::initializePetscObjects() } else { std::string pc_type = "none"; - ierr = PCSetType(d_preconditioner, - (PCType)pc_type.c_str()); + ierr = PCSetType(d_preconditioner, (PCType)pc_type.c_str()); PETSC_SAMRAI_ERROR(ierr); } @@ -561,15 +521,15 @@ void SNES_SAMRAIContext::destroyPetscObjects() { if (d_jacobian) { - MatDestroy(d_jacobian); - d_jacobian = ((Mat)NULL); + MatDestroy(&d_jacobian); + d_jacobian = 0; } if (d_SNES_solver) { - SNESDestroy(d_SNES_solver); -// if (d_SLES_solver) d_SLES_solver = ((SLES)NULL); - if (d_preconditioner) d_preconditioner = ((PC)NULL); - if (d_krylov_solver) d_krylov_solver = ((KSP)NULL); + SNESDestroy(&d_SNES_solver); +// if (d_SLES_solver) d_SLES_solver = 0; + if (d_preconditioner) d_preconditioner = 0; + if (d_krylov_solver) d_krylov_solver = 0; } } @@ -583,35 +543,35 @@ SNES_SAMRAIContext::destroyPetscObjects() void SNES_SAMRAIContext::getFromInput( - const boost::shared_ptr& db) + const boost::shared_ptr& input_db, + bool is_from_restart) { - if (db) { - if (db->keyExists("maximum_nonlinear_iterations")) { + if (input_db) { + if (!is_from_restart) { + d_maximum_nonlinear_iterations = - db->getInteger("maximum_nonlinear_iterations"); - } - if (db->keyExists("maximum_function_evals")) { - d_maximum_function_evals = db->getInteger("maximum_function_evals"); - } + input_db->getIntegerWithDefault("maximum_nonlinear_iterations", PETSC_DEFAULT); - if (db->keyExists("uses_preconditioner")) { - d_uses_preconditioner = db->getBool("uses_preconditioner"); - } - if (db->keyExists("uses_explicit_jacobian")) { - d_uses_explicit_jacobian = db->getBool("uses_explicit_jacobian"); - } - if (db->keyExists("absolute_tolerance")) { - d_absolute_tolerance = db->getDouble("absolute_tolerance"); - } - if (db->keyExists("relative_tolerance")) { - d_relative_tolerance = db->getDouble("relative_tolerance"); - } - if (db->keyExists("step_tolerance")) { - d_step_tolerance = db->getDouble("step_tolerance"); - } + d_maximum_function_evals = + input_db->getIntegerWithDefault("maximum_function_evals", PETSC_DEFAULT); + + d_uses_preconditioner = + input_db->getBoolWithDefault("uses_preconditioner", true); + + d_uses_explicit_jacobian = + input_db->getBoolWithDefault("uses_explicit_jacobian", true); - if (db->keyExists("forcing_term_strategy")) { - d_forcing_term_strategy = db->getString("forcing_term_strategy"); + d_absolute_tolerance = + input_db->getDoubleWithDefault("absolute_tolerance", PETSC_DEFAULT); + + d_relative_tolerance = + input_db->getDoubleWithDefault("relative_tolerance", PETSC_DEFAULT); + + d_step_tolerance = + input_db->getDoubleWithDefault("step_tolerance", PETSC_DEFAULT); + + d_forcing_term_strategy = + input_db->getStringWithDefault("forcing_term_strategy", "CONSTANT"); if (d_forcing_term_strategy == "EWCHOICE1") { d_forcing_term_flag = 1; } else if (d_forcing_term_strategy == "EWCHOICE2") { @@ -623,63 +583,147 @@ SNES_SAMRAIContext::getFromInput( << d_forcing_term_strategy << " in input not recognized."); } - } - if (db->keyExists("constant_forcing_term")) { - d_constant_forcing_term = db->getDouble("constant_forcing_term"); - } - if (db->keyExists("initial_forcing_term")) { - d_initial_forcing_term = db->getDouble("initial_forcing_term"); - } - if (db->keyExists("maximum_forcing_term")) { - d_maximum_forcing_term = db->getDouble("maximum_forcing_term"); - } - if (db->keyExists("EW_choice2_alpha")) { - d_EW_choice2_alpha = db->getDouble("EW_choice2_alpha"); - } - if (db->keyExists("EW_choice2_gamma")) { - d_EW_choice2_gamma = db->getDouble("EW_choice2_gamma"); - } - if (db->keyExists("EW_safeguard_exponent")) { - d_EW_safeguard_exponent = db->getDouble("EW_safeguard_exponent"); - } - if (db->keyExists("EW_safeguard_disable_threshold")) { + d_constant_forcing_term = + input_db->getDoubleWithDefault("constant_forcing_term", PETSC_DEFAULT); + + d_initial_forcing_term = + input_db->getDoubleWithDefault("initial_forcing_term", PETSC_DEFAULT); + + d_maximum_forcing_term = + input_db->getDoubleWithDefault("maximum_forcing_term", PETSC_DEFAULT); + + d_EW_choice2_alpha = + input_db->getDoubleWithDefault("EW_choice2_alpha", PETSC_DEFAULT); + + d_EW_choice2_gamma = + input_db->getDoubleWithDefault("EW_choice2_gamma", PETSC_DEFAULT); + + d_EW_safeguard_exponent = + input_db->getDoubleWithDefault("EW_safeguard_exponent", PETSC_DEFAULT); + d_EW_safeguard_disable_threshold = - db->getDouble("EW_safeguard_disable_threshold"); - } + input_db->getDoubleWithDefault("EW_safeguard_disable_threshold", PETSC_DEFAULT); + + d_linear_solver_type = + input_db->getStringWithDefault("linear_solver_type", ""); - if (db->keyExists("linear_solver_type")) { - d_linear_solver_type = db->getString("linear_solver_type"); - } - if (db->keyExists("linear_solver_absolute_tolerance")) { d_linear_solver_absolute_tolerance = - db->getDouble("linear_solver_absolute_tolerance"); - } - if (db->keyExists("linear_solver_divergence_tolerance")) { + input_db->getDoubleWithDefault("linear_solver_absolute_tolerance", PETSC_DEFAULT); + d_linear_solver_divergence_tolerance = - db->getDouble("linear_solver_divergence_tolerance"); - } - if (db->keyExists("maximum_linear_iterations")) { + input_db->getDoubleWithDefault("linear_solver_divergence_tolerance", PETSC_DEFAULT); + d_maximum_linear_iterations = - db->getInteger("maximum_linear_iterations"); - } + input_db->getIntegerWithDefault("maximum_linear_iterations", PETSC_DEFAULT); - if (db->keyExists("maximum_gmres_krylov_dimension")) { d_maximum_gmres_krylov_dimension = - db->getInteger("maximum_gmres_krylov_dimension"); - } - if (db->keyExists("gmres_orthogonalization_algorithm")) { + input_db->getIntegerWithDefault("maximum_gmres_krylov_dimension", PETSC_DEFAULT); + d_gmres_orthogonalization_algorithm = - db->getString("gmres_orthogonalization_algorithm"); - } + input_db->getStringWithDefault("gmres_orthogonalization_algorithm", ""); - if (db->keyExists("differencing_parameter_strategy")) { d_differencing_parameter_strategy = - db->getString("differencing_parameter_strategy"); - } - if (db->keyExists("function_evaluation_error")) { + input_db->getStringWithDefault("differencing_parameter_strategy", MATMFFD_WP); + if (!(d_differencing_parameter_strategy == MATMFFD_WP || + d_differencing_parameter_strategy == MATMFFD_DS)) { + INPUT_VALUE_ERROR("differencing_parameter_strategy"); + } + d_function_evaluation_error = - db->getDouble("function_evaluation_error"); + input_db->getDoubleWithDefault("function_evaluation_error", PETSC_DEFAULT); + } else { + bool read_on_restart = + input_db->getBoolWithDefault("read_on_restart", false); + if (!read_on_restart) { + return; + } + + d_maximum_nonlinear_iterations = + input_db->getIntegerWithDefault("maximum_nonlinear_iterations", + d_maximum_nonlinear_iterations); + d_maximum_function_evals = + input_db->getIntegerWithDefault("maximum_function_evals", + d_maximum_function_evals); + d_uses_preconditioner = + input_db->getBoolWithDefault("uses_preconditioner", + d_uses_preconditioner); + d_uses_explicit_jacobian = + input_db->getBoolWithDefault("uses_explicit_jacobian", + d_uses_explicit_jacobian); + d_absolute_tolerance = + input_db->getDoubleWithDefault("absolute_tolerance", + d_absolute_tolerance); + d_relative_tolerance = + input_db->getDoubleWithDefault("relative_tolerance", + d_relative_tolerance); + d_step_tolerance = + input_db->getDoubleWithDefault("step_tolerance", d_step_tolerance); + d_forcing_term_strategy = + input_db->getStringWithDefault("forcing_term_strategy", + d_forcing_term_strategy); + if (d_forcing_term_strategy == "EWCHOICE1") { + d_forcing_term_flag = 1; + } else if (d_forcing_term_strategy == "EWCHOICE2") { + d_forcing_term_flag = 2; + } else if (!(d_forcing_term_strategy == "CONSTANT")) { + TBOX_ERROR( + d_object_name << ": " + << "Key data `forcing_term_strategy' = " + << d_forcing_term_strategy + << " in input not recognized."); + } + d_constant_forcing_term = + input_db->getDoubleWithDefault("constant_forcing_term", + d_constant_forcing_term); + d_initial_forcing_term = + input_db->getDoubleWithDefault("initial_forcing_term", + d_initial_forcing_term); + d_maximum_forcing_term = + input_db->getDoubleWithDefault("maximum_forcing_term", + d_maximum_forcing_term); + d_EW_choice2_alpha = + input_db->getDoubleWithDefault("EW_choice2_alpha", + d_EW_choice2_alpha); + d_EW_choice2_gamma = + input_db->getDoubleWithDefault("EW_choice2_gamma", + d_EW_choice2_gamma); + d_EW_safeguard_exponent = + input_db->getDoubleWithDefault("EW_safeguard_exponent", + d_EW_safeguard_exponent); + d_EW_safeguard_disable_threshold = + input_db->getDoubleWithDefault("EW_safeguard_disable_threshold", + d_EW_safeguard_disable_threshold); + d_linear_solver_type = + input_db->getStringWithDefault("linear_solver_type", + d_linear_solver_type); + d_linear_solver_absolute_tolerance = + input_db->getDoubleWithDefault("linear_solver_absolute_tolerance", + d_linear_solver_absolute_tolerance); + d_linear_solver_divergence_tolerance = + input_db->getDoubleWithDefault("linear_solver_divergence_tolerance", + d_linear_solver_divergence_tolerance); + d_maximum_linear_iterations = + input_db->getIntegerWithDefault("maximum_linear_iterations", + d_maximum_linear_iterations); + d_maximum_gmres_krylov_dimension = + input_db->getIntegerWithDefault("maximum_gmres_krylov_dimension", + d_maximum_gmres_krylov_dimension); + d_gmres_orthogonalization_algorithm = + input_db->getStringWithDefault("gmres_orthogonalization_algorithm", + d_gmres_orthogonalization_algorithm); + d_differencing_parameter_strategy = + input_db->getStringWithDefault("differencing_parameter_strategy", + d_differencing_parameter_strategy); + if (d_differencing_parameter_strategy != MATMFFD_WP && + d_differencing_parameter_strategy != MATMFFD_DS) { + TBOX_ERROR("SNES_SAMRAIContext::getFromInput error...\n" + << "differencing_parameter_strategy must be \"wp\" or \"ds\"." + << std::endl); + } + d_function_evaluation_error = + input_db->getDoubleWithDefault("function_evaluation_error", + d_function_evaluation_error); } } @@ -708,101 +752,102 @@ SNES_SAMRAIContext::getFromRestart() int ver = db->getInteger("SOLV_SNES_SAMRAI_CONTEXT_VERSION"); if (ver != SOLV_SNES_SAMRAI_CONTEXT_VERSION) { - TBOX_ERROR(d_object_name << ": " + TBOX_ERROR(d_object_name << ":SNES_SAMRAIContext::getFromRestart() error ...\n " << "Restart file version different " << "than class version."); } - d_uses_preconditioner = db->getBool("d_uses_preconditioner"); - d_uses_explicit_jacobian = db->getBool("d_uses_explicit_jacobian"); + d_uses_preconditioner = db->getBool("uses_preconditioner"); + d_uses_explicit_jacobian = db->getBool("uses_explicit_jacobian"); d_maximum_nonlinear_iterations = - db->getInteger("d_maximum_nonlinear_iterations"); - d_maximum_function_evals = db->getInteger("d_maximum_function_evals"); + db->getInteger("maximum_nonlinear_iterations"); + d_maximum_function_evals = db->getInteger("maximum_function_evals"); - d_absolute_tolerance = db->getDouble("d_absolute_tolerance"); - d_relative_tolerance = db->getDouble("d_relative_tolerance"); - d_step_tolerance = db->getDouble("d_step_tolerance"); + d_absolute_tolerance = db->getDouble("absolute_tolerance"); + d_relative_tolerance = db->getDouble("relative_tolerance"); + d_step_tolerance = db->getDouble("step_tolerance"); - d_forcing_term_strategy = db->getString("d_forcing_term_strategy"); + d_forcing_term_strategy = db->getString("forcing_term_strategy"); d_forcing_term_flag = db->getInteger("d_forcing_term_flag"); - d_constant_forcing_term = db->getDouble("d_constant_forcing_term"); - d_initial_forcing_term = db->getDouble("d_initial_forcing_term"); - d_maximum_forcing_term = db->getDouble("d_maximum_forcing_term"); - d_EW_choice2_alpha = db->getDouble("d_EW_choice2_alpha"); - d_EW_choice2_gamma = db->getDouble("d_EW_choice2_gamma"); - d_EW_safeguard_exponent = db->getDouble("d_EW_safeguard_exponent"); + d_constant_forcing_term = db->getDouble("constant_forcing_term"); + d_initial_forcing_term = db->getDouble("initial_forcing_term"); + d_maximum_forcing_term = db->getDouble("maximum_forcing_term"); + d_EW_choice2_alpha = db->getDouble("EW_choice2_alpha"); + d_EW_choice2_gamma = db->getDouble("EW_choice2_gamma"); + d_EW_safeguard_exponent = db->getDouble("EW_safeguard_exponent"); d_EW_safeguard_disable_threshold = - db->getDouble("d_EW_safeguard_disable_threshold"); + db->getDouble("EW_safeguard_disable_threshold"); - d_linear_solver_type = db->getString("d_linear_solver_type"); + d_linear_solver_type = db->getString("linear_solver_type"); d_linear_solver_absolute_tolerance = - db->getDouble("d_linear_solver_absolute_tolerance"); + db->getDouble("linear_solver_absolute_tolerance"); d_linear_solver_divergence_tolerance = - db->getDouble("d_linear_solver_divergence_tolerance"); + db->getDouble("linear_solver_divergence_tolerance"); d_maximum_linear_iterations = - db->getInteger("d_maximum_linear_iterations"); + db->getInteger("maximum_linear_iterations"); d_maximum_gmres_krylov_dimension = - db->getInteger("d_maximum_gmres_krylov_dimension"); + db->getInteger("maximum_gmres_krylov_dimension"); d_gmres_orthogonalization_algorithm = - db->getString("d_gmres_orthogonalization_algorithm"); + db->getString("gmres_orthogonalization_algorithm"); - d_function_evaluation_error = db->getDouble("d_function_evaluation_error"); + d_function_evaluation_error = db->getDouble("function_evaluation_error"); d_differencing_parameter_strategy = - db->getString("d_differencing_parameter_strategy"); + db->getString("differencing_parameter_strategy"); } void -SNES_SAMRAIContext::putToDatabase( - const boost::shared_ptr& db) const +SNES_SAMRAIContext::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("SOLV_SNES_SAMRAI_CONTEXT_VERSION", + restart_db->putInteger("SOLV_SNES_SAMRAI_CONTEXT_VERSION", SOLV_SNES_SAMRAI_CONTEXT_VERSION); - db->putBool("d_uses_preconditioner", d_uses_preconditioner); - db->putBool("d_uses_explicit_jacobian", d_uses_explicit_jacobian); + restart_db->putBool("uses_preconditioner", d_uses_preconditioner); + restart_db->putBool("uses_explicit_jacobian", d_uses_explicit_jacobian); - db->putInteger("d_maximum_nonlinear_iterations", + restart_db->putInteger("maximum_nonlinear_iterations", d_maximum_nonlinear_iterations); - db->putInteger("d_maximum_function_evals", d_maximum_function_evals); - - db->putDouble("d_absolute_tolerance", d_absolute_tolerance); - db->putDouble("d_relative_tolerance", d_relative_tolerance); - db->putDouble("d_step_tolerance", d_step_tolerance); - - db->putString("d_forcing_term_strategy", d_forcing_term_strategy); - db->putInteger("d_forcing_term_flag", d_forcing_term_flag); - - db->putDouble("d_constant_forcing_term", d_constant_forcing_term); - db->putDouble("d_initial_forcing_term", d_initial_forcing_term); - db->putDouble("d_maximum_forcing_term", d_maximum_forcing_term); - db->putDouble("d_EW_choice2_alpha", d_EW_choice2_alpha); - db->putDouble("d_EW_choice2_gamma", d_EW_choice2_gamma); - db->putDouble("d_EW_safeguard_exponent", d_EW_safeguard_exponent); - db->putDouble("d_EW_safeguard_disable_threshold", + restart_db->putInteger("maximum_function_evals", + d_maximum_function_evals); + + restart_db->putDouble("absolute_tolerance", d_absolute_tolerance); + restart_db->putDouble("relative_tolerance", d_relative_tolerance); + restart_db->putDouble("step_tolerance", d_step_tolerance); + + restart_db->putString("forcing_term_strategy", d_forcing_term_strategy); + restart_db->putInteger("d_forcing_term_flag", d_forcing_term_flag); + + restart_db->putDouble("constant_forcing_term", d_constant_forcing_term); + restart_db->putDouble("initial_forcing_term", d_initial_forcing_term); + restart_db->putDouble("maximum_forcing_term", d_maximum_forcing_term); + restart_db->putDouble("EW_choice2_alpha", d_EW_choice2_alpha); + restart_db->putDouble("EW_choice2_gamma", d_EW_choice2_gamma); + restart_db->putDouble("EW_safeguard_exponent", d_EW_safeguard_exponent); + restart_db->putDouble("EW_safeguard_disable_threshold", d_EW_safeguard_disable_threshold); - db->putString("d_linear_solver_type", d_linear_solver_type); - db->putDouble("d_linear_solver_absolute_tolerance", + restart_db->putString("linear_solver_type", d_linear_solver_type); + restart_db->putDouble("linear_solver_absolute_tolerance", d_linear_solver_absolute_tolerance); - db->putDouble("d_linear_solver_divergence_tolerance", + restart_db->putDouble("linear_solver_divergence_tolerance", d_linear_solver_divergence_tolerance); - db->putInteger("d_maximum_linear_iterations", + restart_db->putInteger("maximum_linear_iterations", d_maximum_linear_iterations); - db->putInteger("d_maximum_gmres_krylov_dimension", + restart_db->putInteger("maximum_gmres_krylov_dimension", d_maximum_gmres_krylov_dimension); - db->putString("d_gmres_orthogonalization_algorithm", + restart_db->putString("gmres_orthogonalization_algorithm", d_gmres_orthogonalization_algorithm); - db->putDouble("d_function_evaluation_error", + restart_db->putDouble("function_evaluation_error", d_function_evaluation_error); - db->putString("d_differencing_parameter_strategy", + restart_db->putString("differencing_parameter_strategy", d_differencing_parameter_strategy); } @@ -879,4 +924,3 @@ SNES_SAMRAIContext::printClassData( } #endif -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.h index 50323f26..0ebf0979 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SNES_SAMRAIContext.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Wrapper for SNES solver for use in a SAMRAI-based application. * ************************************************************************/ @@ -11,6 +11,8 @@ #ifndef included_solv_SNES_SAMRAIContext #define included_solv_SNES_SAMRAIContext +#include "SAMRAI/SAMRAI_config.h" + /* ************************************************************************ * THIS CLASS WILL BE UNDEFINED IF THE LIBRARY IS BUILT WITHOUT PETSC @@ -23,19 +25,13 @@ #ifdef MPICH_SKIP_MPICXX #undef MPICH_SKIP_MPICXX #endif +#ifdef OMPI_SKIP_MPICXX +#undef OMPI_SKIP_MPICXX +#endif extern "C" { -#ifdef PETSC2028 -#include "snes.h" -#else #include "petscsnes.h" -#endif } #endif -#endif - -#include "SAMRAI/SAMRAI_config.h" - -#ifdef HAVE_PETSC #include "SAMRAI/solv/NonlinearSolverStrategy.h" #include "SAMRAI/solv/SNESAbstractFunctions.h" @@ -63,119 +59,294 @@ namespace solv { * The vector objects used within the solver are provided by the * PETSc_SAMRAIVectorReal wrapper class. * + * Input Parameters + * * If no parameters are read from input, PETSc defaults are used. See the * PETSc documentation (http://www-unix.mcs.anl.gov/petsc/). * for more information on default parameters and SNES functionality. * - * Optional input keys and types that can be read by this class are: + * Definitions: + * - \b maximum_nonlinear_iterations + * maximum number of nonlinear iterations * - * - absolute_tolerance - * double value for absolute nonlinear convergence tolerance + * - \b maximum_function_evals + * maximum number of nonlinear function evaluations * - * - relative_tolerance - * double value for relative nonlinear convergence tolerance + * - \b uses_preconditioner + * whether or not a preconditioner is used in the solution of the + * Newton equations. * - * - step_tolerance - * double value for minimum tolerance on change in solution norm - * between nonlinear iterates + * - \b uses_explicit_jacobian + * whether or not the user provides code to explicitly calculate + * Jacobian-vector products. * - * - maximum_nonlinear_iterations - * integer value for maximum number of nonlinear iterations + * - \b absolute_tolerance + * absolute nonlinear convergence tolerance * - * - maximum_function_evals - * integer value for maximum number of nonlinear function evaluations + * - \b relative_tolerance + * relative nonlinear convergence tolerance * - * - forcing_term_strategy - * integer value for forcing term choice for linear solvers - * within the inexact Newton method. Choices are "CONSTANT" (default), - * "EWCHOICE1", and "EWCHOICE2". + * - \b step_tolerance + * minimum tolerance on change in solution norm between nonlinear + * iterations * - * - constant_forcing_term - * double value for constant relative convergence tolerance in - * Krylov solver (default case) + * - \b forcing_term_strategy + * forcing term choice for linear solvers within the inexact Newton + * method. * - * - initial_forcing_term - * double value for initial relative convergence tolerance in - * Krylov solver (used in Eisenstat-Walker case). Value must - * satisfy @f$0 \le \eta_0 < 1@f$. + * - \b constant_forcing_term + * constant relative convergence tolerance in Krylov solver * - * - maximum_forcing_term - * double value for maximum relative convergence tolerance in - * Krylov solver (used in Eisenstat-Walker case). Value must - * satisfy @f$0 \le \eta_{max} < 1@f$. + * - \b initial_forcing_term + * initial relative convergence tolerance in Krylov solver + * (used in Eisenstat-Walker case). * - * - EW_choice2_alpha - * double value for power used in Eisenstat-Walker choice 2 - * relative convergence tolerance computation. Value must - * satisfy @f$1 < \alpha \le 2@f$. + * - \b maximum_forcing_term + * maximum relative convergence tolerance in Krylov solver + * (used in Eisenstat-Walker case). * - * - EW_safeguard_exponent - * double value for power for safeguard used in Eisenstat-Walker - * choice 2 + * - \b EW_choice2_alpha + * power used in Eisenstat-Walker choice 2 relative convergence + * tolerance computation. * - * - EW_choice2_gamma - * double value for multiplicative factor used in Eisenstat-Walker - * choice 2 relative convergence tolerance computation. Value - * must satisfy @f$0 \le \gamma \le 1@f$. + * - \b EW_choice2_gamma + * multiplicative factor used in Eisenstat-Walker choice 2 relative + * convergence tolerance computation. * - * - EW_safeguard_disable_threshold - * double value for threshold for imposing safeguard in - * Eisenstat-Walker choice 2. Value must - * satisfy @f$0 < \eta_{threshold} < 1@f$. + * - \b EW_safeguard_exponent + * power for safeguard used in Eisenstat-Walker choice 2 * - * - linear_solver_type - * std::string value for type of linear solver. See the - * PETSc documentation - * for the valid types. + * - \b EW_safeguard_disable_threshold + * threshold for imposing safeguard in Eisenstat-Walker choice 2. * - * - uses_preconditioner - * boolean value for whether or not a preconditioner is used in the - * solution of the Newton equations. + * - \b linear_solver_type + * value for type of linear solver. * - * - linear_solver_absolute_tolerance - * double value for absolute convergence tolerance in linear solver + * - \b linear_solver_absolute_tolerance + * absolute convergence tolerance in linear solver * - * - linear_solver_divergence_tolerance - * double value for amount linear solver residual can increase - * before solver concludes method is diverging + * - \b linear_solver_divergence_tolerance + * amount linear solver residual can increase before solver concludes + * method is diverging * - * - maximum_linear_iterations - * integer value for maximum number of linear solver iterations + * - \b maximum_linear_iterations + * maximum number of linear solver iterations * - * - maximum_gmres_krylov_dimension - * integer value for maximum dimension of Krylov subspace before - * restarting. Valid only if GMRES is used as the linear solver. + * - \b maximum_gmres_krylov_dimension + * maximum dimension of Krylov subspace before restarting. + * Valid only if GMRES is used as the linear solver. * - * - gmres_orthogonalization_algorithm - * std::string value for algorithm used to incrementally construct the - * orthonormal basis of the Krylov subspace used by GMRES. Valid - * only if GMRES is used as the linear solver. Valid values are: + * - \b gmres_orthogonalization_algorithm + * algorithm used to incrementally construct the orthonormal basis of + * the Krylov subspace used by GMRES. Valid only if GMRES is used as + * the linear solver * - * modifiedgramschmidt - * gmres_cgs_refine_ifneeded - * gmres_cgs_refine_always + * - \b differencing_parameter_strategy + * strategy used for computing the differencing parameter when + * Jacobian-vector products are approximated via finite differences * - * See the - * PETSc documentation - * for more information. + * - \b function_evaluation_error + * square root of the estimated relative error in function evaluation * - * - uses_explicit_jacobian - * boolean value for whether or not the user provides code to - * explicitly calculate Jacobian-vector products. + * All values read in from a restart database may be overriden by input + * database values. If no new input database value is given, the restart + * database value is used. * - * - differencing_parameter_strategy - * std::string value indicating strategy used for computing the differencing - * parameter when Jacobian-vector products are approximated via finite - * differences. See the - * PETSc documentation - * for valid values. - * - * - function_evaluation_error - * double value that is the square root of the estimated relative error - * in function evaluation. - * - * Note that all input values may override values read in from restart. If - * no new input value is given, the restart value is used. + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
maximum_nonliner_iterationsintPETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
maximum_function_evalsintPETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
uses_preconditionerboolTRUETRUE, FALSEoptParameter read from restart db may be overridden by input db
uses_explicit_jacobianboolTRUETRUE, FALSEoptParameter read from restart db may be overridden by input db
absolute_tolerancedoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
relative_tolerancedoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
step_tolerancedoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
forcing_term_strategystring"CONSTANT""CONSTANT", "EWCHOICE1", "EWCHOICE2"optParameter read from restart db may be overridden by input db
constant_forcing_termdoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
initial_forcing_termdoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
maximum_forcing_termdoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
EW_choice2_alphadoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
EW_choice2_gammadoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
EW_safeguard_exponentdoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
EW_safeguard_disable_thresholddoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
linear_solver_typestring""Refer to PETSc documentationoptParameter read from restart db may be overridden by input db
linear_solver_absolute_tolerancedoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
linear_solver_divergence_tolerancedoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
maximum_linear_iterationsintPETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
maximum_gmres_krylov_dimensionintPETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
gmres_orthogonalization_algorithmstring""Refer to PETSc documentationoptParameter read from restart db may be overridden by input db
differencing_parameter_strategystringMATMFFD_WPMATMFFD_WP, MATFFD_DSoptParameter read from restart db may be overridden by input db
function_evaluation_errordoublePETSC_DEFAULTRefer to PETSc documentationoptParameter read from restart db may be overridden by input db
* * A sample input file entry might look like: * @@ -196,8 +367,8 @@ namespace solv { * settings/changes will NOT be cached in the solver context, and so * will not be written to restart. * - * @see solv::SNESAbstractFunctions - * @see solv::NonlinearSolverStrategy + * @see SNESAbstractFunctions + * @see NonlinearSolverStrategy */ class SNES_SAMRAIContext: @@ -211,14 +382,14 @@ class SNES_SAMRAIContext: * user-supplied solver components. Then, it reads solver parameter * from input and restart which may override default values. * - * When assertion checking is active, an unrecoverable assertion - * will result if the name std::string is empty or the pointer to the - * user-defined SNES functions object is null. + * @pre !object_name.empty() + * @pre my_functions != 0 */ SNES_SAMRAIContext( const std::string& object_name, - const boost::shared_ptr& input_db, - SNESAbstractFunctions* my_functions); + SNESAbstractFunctions* my_functions, + const boost::shared_ptr& input_db = + boost::shared_ptr()); /*! * Destructor for solve_SNES_SAMRAIContext destroys the SNES @@ -378,6 +549,9 @@ class SNES_SAMRAIContext: /*! * Set strategy for forcing term. + * + * @pre (strategy == "CONSTANT") || (strategy == "EWCHOICE1") || + * (strategy == "EWCHOICE2") */ void setForcingTermStrategy( @@ -738,6 +912,8 @@ class SNES_SAMRAIContext: * Initialize the state of the SNES solver based on vector argument * representing the solution of the nonlinear system. In general, this * routine must be called before the solve() routine is invoked. + * + * @pre solution */ void initialize( @@ -791,12 +967,11 @@ class SNES_SAMRAIContext: /*! * Write solver parameters to restart database matching object name. * - * When assertion checking is active, an unrecoverable assertion - * will result if database pointer is null. + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /*! * Print out all members of integrator instance to given output stream. @@ -833,7 +1008,7 @@ class SNES_SAMRAIContext: { NULL_USE(snes); ((SNES_SAMRAIContext *)ctx)->getSNESFunctions()-> - evaluateNonlinearFunction(x, f); + evaluateNonlinearFunction(x, f); return 0; } @@ -861,10 +1036,13 @@ class SNES_SAMRAIContext: static int SNESsetupPreconditioner( - void* ctx) // input vector + PC pc) { + int ierr = 0; Vec current_solution; - int ierr = SNESGetSolution(((SNES_SAMRAIContext *)ctx)->getSNESSolver(), + void* ctx; + PCShellGetContext(pc, &ctx); + ierr = SNESGetSolution(((SNES_SAMRAIContext *)ctx)->getSNESSolver(), ¤t_solution); PETSC_SAMRAI_ERROR(ierr); return ((SNES_SAMRAIContext *)ctx)-> @@ -873,10 +1051,12 @@ class SNES_SAMRAIContext: static int SNESapplyPreconditioner( - void* ctx, // user-defined context + PC pc, Vec xin, // input vector Vec xout) // output vector { + void* ctx; + PCShellGetContext(pc, &ctx); return ((SNES_SAMRAIContext *)ctx)-> getSNESFunctions()->applyPreconditioner(xin, xout); } @@ -904,7 +1084,8 @@ class SNES_SAMRAIContext: */ void getFromInput( - const boost::shared_ptr& db); + const boost::shared_ptr& input_db, + bool is_from_restart); /*! * Read solver parameters from restart database matching object name. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.C index 34879275..23f5ee5f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Level solver for diffusion-like elliptic problems. * ************************************************************************/ -#ifndef included_solv_SimpleCellRobinBcCoefs_C -#define included_solv_SimpleCellRobinBcCoefs_C - #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/math/ArrayDataBasicOps.h" #include "SAMRAI/pdat/CellData.h" @@ -48,7 +45,6 @@ SimpleCellRobinBcCoefs::SimpleCellRobinBcCoefs( d_ln_max(-1), d_flux_id(-1), d_flag_id(-1), - d_dirichlet_data_id(-1), d_diffusion_coef_id(-1) { t_set_bc_coefs = tbox::TimerManager::getManager()-> @@ -66,12 +62,12 @@ SimpleCellRobinBcCoefs::setHierarchy( const int ln_max) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); d_hierarchy = hierarchy; d_ln_min = ln_min; d_ln_max = ln_max; - d_dirichlet_data.setNull(); + d_dirichlet_data.clear(); d_dirichlet_data_pos.clear(); if (d_ln_min == -1) { @@ -101,13 +97,10 @@ SimpleCellRobinBcCoefs::setBoundaries( if (boundary_type == "Dirichlet") { d_flux_id = -1; d_flag_id = -1; - for (k = 0; k < 2 * d_dim.getValue(); k++) { + for (k = 0; k < 2 * d_dim.getValue(); ++k) { d_bdry_types[k] = DIRICHLET; } } else if (boundary_type == "Neumann") { - for (k = 0; k < 2 * d_dim.getValue(); k++) { - d_bdry_types[k] = NEUMANN; - } #ifdef DEBUG_CHECK_ASSERTIONS if (fluxes < 0) { TBOX_ERROR( @@ -116,6 +109,9 @@ SimpleCellRobinBcCoefs::setBoundaries( << ") for Neumann boundary condition.\n"); } #endif + for (k = 0; k < 2 * d_dim.getValue(); ++k) { + d_bdry_types[k] = NEUMANN; + } d_flux_id = fluxes; d_flag_id = -1; } else if (boundary_type == "Mixed") { @@ -135,19 +131,19 @@ SimpleCellRobinBcCoefs::setBoundaries( #endif d_flux_id = fluxes; d_flag_id = flags; - if (bdry_types != NULL) { - for (k = 0; k < 2 * d_dim.getValue(); k++) { + if (bdry_types != 0) { + for (k = 0; k < 2 * d_dim.getValue(); ++k) { d_bdry_types[k] = bdry_types[k]; } } else { - for (k = 0; k < 2 * d_dim.getValue(); k++) { + for (k = 0; k < 2 * d_dim.getValue(); ++k) { d_bdry_types[k] = MIXED; } } } else { TBOX_ERROR( d_object_name << ": Non-existing case of\n" - << "boundary_type in PoissonSolver::setBoundaries()"); + << "boundary_type in SimpleCellRobinBcCoefs::setBoundaries()"); } } @@ -186,7 +182,19 @@ SimpleCellRobinBcCoefs::setBcCoefs( const hier::BoundaryBox& bdry_box, double fill_time) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, patch, bdry_box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, patch, bdry_box); + +#ifdef DEBUG_CHECK_DIM_ASSERTIONS + if (acoef_data) { + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *acoef_data); + } + if (bcoef_data) { + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *bcoef_data); + } + if (gcoef_data) { + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *gcoef_data); + } +#endif NULL_USE(variable); NULL_USE(fill_time); @@ -204,8 +212,6 @@ SimpleCellRobinBcCoefs::setBcCoefs( #ifdef DEBUG_CHECK_ASSERTIONS if (gcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *gcoef_data); - if (d_bdry_types[location_index] == DIRICHLET || d_bdry_types[location_index] == MIXED) { /* @@ -238,67 +244,42 @@ SimpleCellRobinBcCoefs::setBcCoefs( if (d_bdry_types[location_index] == NEUMANN || d_bdry_types[location_index] == MIXED) { patch_data = patch.getPatchData(d_flux_id); - flux_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch_data); if (!patch_data) { TBOX_ERROR(d_object_name << ": Flux data (patch data id = " << d_flux_id << ") does not exist."); } - if (!flux_data_ptr) { - TBOX_ERROR( - d_object_name << ": Flux data (patch data id = " - << d_flux_id - << ") is not outerface double data."); - } + flux_data_ptr = + BOOST_CAST, hier::PatchData>(patch_data); + TBOX_ASSERT(flux_data_ptr); if (d_diffusion_coef_id != -1) { patch_data = patch.getPatchData(d_diffusion_coef_id); - diffcoef_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch_data); if (!patch_data) { TBOX_ERROR(d_object_name << ": Diffusion coefficient data\n" "(patch data id = " << d_diffusion_coef_id << ") does not exist."); } - if (!diffcoef_data_ptr) { - TBOX_ERROR(d_object_name << ": Diffusion coefficient data\n" - "(patch data id = " << d_diffusion_coef_id - << ") is not side double data."); - } + diffcoef_data_ptr = + BOOST_CAST, hier::PatchData>(patch_data); + TBOX_ASSERT(diffcoef_data_ptr); } } } if (acoef_data) { if (d_bdry_types[location_index] == MIXED) { patch_data = patch.getPatchData(d_flag_id); - flag_data_ptr = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_flag_id)); if (!patch_data) { TBOX_ERROR(d_object_name << ": Flags data (patch data id = " << d_flag_id << ") does not exist."); } - if (!flag_data_ptr) { - TBOX_ERROR( - d_object_name << ": Flags data (patch data id = " - << d_flag_id - << ") is not outerface int data."); - } + flag_data_ptr = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flag_id)); + TBOX_ASSERT(flag_data_ptr); } } #endif int bn; -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - if (acoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *acoef_data); - } - if (bcoef_data) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *bcoef_data); - } -#endif - if (d_bdry_types[location_index] == DIRICHLET) { if (acoef_data) { @@ -311,14 +292,17 @@ SimpleCellRobinBcCoefs::setBcCoefs( if (gcoef_data) { boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array& codim1_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(pg); + + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); /* * Search for cached boundary box containing current boundary box. */ - for (bn = 0; bn < codim1_boxes.getSize(); ++bn) { + for (bn = 0; bn < static_cast(codim1_boxes.size()); ++bn) { const hier::BoundaryBox& cdb = codim1_boxes[bn]; if (bdry_box.getLocationIndex() == cdb.getLocationIndex() && bdry_box.getBox().lower() >= cdb.getBox().lower() @@ -326,7 +310,7 @@ SimpleCellRobinBcCoefs::setBcCoefs( ) break; } #ifdef DEBUG_CHECK_ASSERTIONS - if (bn == codim1_boxes.getSize()) { + if (bn == static_cast(codim1_boxes.size())) { TBOX_ERROR( d_object_name << " cannot find cached Dirichlet data.\n" << "This is most likely caused by not calling\n" @@ -334,10 +318,10 @@ SimpleCellRobinBcCoefs::setBcCoefs( << "after the hierarchy changed.\n"); } #endif - hier::BoxId mapped_box_id(global_id); + hier::BoxId box_id(global_id); std::map foo = d_dirichlet_data_pos[ln]; - int position = foo[mapped_box_id] + bn; + int position = foo[box_id] + bn; gcoef_data->copy(*d_dirichlet_data[position], d_dirichlet_data[position]->getBox(), hier::IntVector::getZero(d_dim)); @@ -354,8 +338,9 @@ SimpleCellRobinBcCoefs::setBcCoefs( if (gcoef_data) { flux_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_flux_id)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux_id)); + TBOX_ASSERT(flux_data_ptr); pdat::OuterfaceData& flux_data(*flux_data_ptr); const int axis = location_index / 2; const int face = location_index % 2; @@ -372,8 +357,9 @@ SimpleCellRobinBcCoefs::setBcCoefs( } } else { diffcoef_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_diffusion_coef_id)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_diffusion_coef_id)); + TBOX_ASSERT(diffcoef_data_ptr); const pdat::ArrayData& diffcoef_array_data = diffcoef_data_ptr->getArrayData(axis); for ( ; ai != aiend; ++ai) { @@ -388,9 +374,9 @@ SimpleCellRobinBcCoefs::setBcCoefs( const int axis = location_index / 2; const int face = location_index % 2; - flag_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_flag_id)); + flag_data_ptr = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flag_id)); + TBOX_ASSERT(flag_data_ptr); pdat::OuterfaceData& flag_data(*flag_data_ptr); hier::Index offset_to_inside(d_dim, 0); if (face != 0) offset_to_inside(axis) = -1; @@ -425,14 +411,17 @@ SimpleCellRobinBcCoefs::setBcCoefs( if (gcoef_data) { boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array& codim1_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(pg); + + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); /* * Search for cached boundary box containing current boundary box. */ - for (bn = 0; bn < codim1_boxes.getSize(); ++bn) { + for (bn = 0; bn < static_cast(codim1_boxes.size()); ++bn) { const hier::BoundaryBox& cdb = codim1_boxes[bn]; if (bdry_box.getLocationIndex() == cdb.getLocationIndex() && bdry_box.getBox().lower() >= cdb.getBox().lower() @@ -440,7 +429,7 @@ SimpleCellRobinBcCoefs::setBcCoefs( ) break; } #ifdef DEBUG_CHECK_ASSERTIONS - if (bn == codim1_boxes.getSize()) { + if (bn == static_cast(codim1_boxes.size())) { TBOX_ERROR( d_object_name << " cannot find cached Dirichlet data.\n" << "This is most likely caused by not calling\n" @@ -448,16 +437,17 @@ SimpleCellRobinBcCoefs::setBcCoefs( << "hierarchy changed.\n"); } #endif - hier::BoxId mapped_box_id(global_id); + hier::BoxId box_id(global_id); std::map foo = d_dirichlet_data_pos[ln]; - int position = foo[mapped_box_id] + bn; + int position = foo[box_id] + bn; const pdat::ArrayData& dirichlet_array_data = *d_dirichlet_data[position]; diffcoef_data_ptr = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_diffusion_coef_id)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_diffusion_coef_id)); + TBOX_ASSERT(diffcoef_data_ptr); pdat::ArrayData& g = *gcoef_data; pdat::OuterfaceData& flux_data(*flux_data_ptr); pdat::ArrayDataIterator ai(g.getBox(), true); @@ -487,7 +477,7 @@ SimpleCellRobinBcCoefs::setBcCoefs( *********************************************************************** * This class cannot set coefficients for boundary boxes that extend * past the patch in the direction parallel to the boundary, - * because it relies on data, such as pdat::OutersideData, + * because it relies on data, such as pdat::OutersideData, * that does not extend. *********************************************************************** */ @@ -501,18 +491,18 @@ SimpleCellRobinBcCoefs::numberOfExtensionsFillable() const ************************************************************************ * * Copy and save cell-centered Dirichlet data in ghost cells. - * For each boundary box in the hierarchy, we create a pdat::ArrayData + * For each boundary box in the hierarchy, we create a pdat::ArrayData * object indexed on the side indices corresponding to boundary boxes. * The ghost-cell-centered data is shifted to the side indices and - * saved in the pdat::ArrayData objects. + * saved in the pdat::ArrayData objects. * * First, loop through the hierarchy to compute how many - * pdat::ArrayData objects we need and the position of each one. + * pdat::ArrayData objects we need and the position of each one. * - * Second, allocate the pdat::ArrayData objects. + * Second, allocate the pdat::ArrayData objects. * * Third, loop through the hierarchy again to allocate the data in each - * pdat::ArrayData object and cache the ghost data. + * pdat::ArrayData object and cache the ghost data. * * The position of the appropriate boundary box bn of patch pn * of level ln is d_dirichlet_data_pos[ln][pn]+bn @@ -531,7 +521,7 @@ SimpleCellRobinBcCoefs::cacheDirichletData( << "caching boundary ghost cell data.\n"); } #endif - d_dirichlet_data.setNull(); + d_dirichlet_data.clear(); d_dirichlet_data_pos.clear(); int ln, bn, position, n_reqd_boxes = 0; d_dirichlet_data_pos.resize(d_ln_max + 1); @@ -542,17 +532,20 @@ SimpleCellRobinBcCoefs::cacheDirichletData( for ( ; pi != level.end(); ++pi) { hier::Patch& patch = **pi; const hier::GlobalId& global_id = patch.getGlobalId(); - hier::BoxId mapped_box_id(global_id); + hier::BoxId box_id(global_id); boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array& codim1_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(pg); + + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); - d_dirichlet_data_pos[ln][mapped_box_id] = n_reqd_boxes; - n_reqd_boxes += codim1_boxes.getSize(); + d_dirichlet_data_pos[ln][box_id] = n_reqd_boxes; + n_reqd_boxes += static_cast(codim1_boxes.size()); } } - d_dirichlet_data.resizeArray(n_reqd_boxes); + d_dirichlet_data.resize(n_reqd_boxes); for (ln = d_ln_min; ln <= d_ln_max; ++ln) { hier::PatchLevel& level = (hier::PatchLevel &) * d_hierarchy->getPatchLevel(ln); @@ -560,18 +553,22 @@ SimpleCellRobinBcCoefs::cacheDirichletData( for ( ; pi != level.end(); ++pi) { hier::Patch& patch = **pi; const hier::GlobalId& global_id = patch.getGlobalId(); - hier::BoxId mapped_box_id(global_id); + hier::BoxId box_id(global_id); boost::shared_ptr > cell_data( - patch.getPatchData(dirichlet_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(dirichlet_data_id))); boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array& codim1_boxes = + BOOST_CAST(patch.getPatchGeometry())); + + TBOX_ASSERT(cell_data); + TBOX_ASSERT(pg); + + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); - for (bn = 0; bn < codim1_boxes.getSize(); ++bn) { + for (bn = 0; bn < static_cast(codim1_boxes.size()); ++bn) { const hier::BoundaryBox& bdry_box = codim1_boxes[bn]; - position = d_dirichlet_data_pos[ln][mapped_box_id] + bn; + position = d_dirichlet_data_pos[ln][box_id] + bn; hier::Box databox = makeSideBoundaryBox(bdry_box); d_dirichlet_data[position].reset( new pdat::ArrayData(databox, 1)); @@ -613,25 +610,29 @@ SimpleCellRobinBcCoefs::restoreDirichletData( for ( ; pi != level.end(); ++pi) { hier::Patch& patch = **pi; const hier::GlobalId& global_id = patch.getGlobalId(); - hier::BoxId mapped_box_id(global_id); + hier::BoxId box_id(global_id); boost::shared_ptr > cell_data( - patch.getPatchData(dirichlet_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(dirichlet_data_id))); boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array& codim1_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + + TBOX_ASSERT(cell_data); + TBOX_ASSERT(pg); + + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); - for (bn = 0; bn < codim1_boxes.getSize(); ++bn) { + for (bn = 0; bn < static_cast(codim1_boxes.size()); ++bn) { const hier::BoundaryBox& bdry_box = codim1_boxes[bn]; - position = d_dirichlet_data_pos[ln][mapped_box_id] + bn; + position = d_dirichlet_data_pos[ln][box_id] + bn; pdat::ArrayData& array_data = *d_dirichlet_data[position]; hier::IntVector shift_amount(d_dim, 0); const int location_index = bdry_box.getLocationIndex(); hier::Box dst_box = array_data.getBox(); if (location_index % 2 == 0) { shift_amount[location_index / 2] = -1; - dst_box.shift(location_index / 2, -1); + dst_box.shift(static_cast(location_index / 2), -1); } cell_data->getArrayData().copy(array_data, dst_box, @@ -666,7 +667,7 @@ SimpleCellRobinBcCoefs::makeSideBoundaryBox( * than the boundary cell indices, in the direction normal * to the boundary. */ - face_indices.shift(location_index / 2, 1); + face_indices.shift(static_cast(location_index / 2), 1); } return face_indices; } @@ -681,5 +682,3 @@ SimpleCellRobinBcCoefs::makeSideBoundaryBox( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.h index 70b49a31..babb05b9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SimpleCellRobinBcCoefs.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Robin boundary condition problem-dependent interfaces * ************************************************************************/ @@ -18,8 +18,9 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/Patch.h" -#include +#include "boost/shared_ptr.hpp" #include +#include namespace SAMRAI { namespace solv { @@ -88,6 +89,11 @@ class SimpleCellRobinBcCoefs: * the coefficient data is needed. * @param fill_time solution time corresponding to filling, for use * when coefficients are time-dependent. + * + * @pre (d_dim == patch.getDim()) && (d_dim == bdry_box.getDim()) + * @pre !acoef_data || (d_dim == acoef_data->getDim()) + * @pre !bcoef_data || (d_dim == bcoef_data->getDim()) + * @pre !gcoef_data || (d_dim == gcoef_data->getDim()) */ void setBcCoefs( @@ -113,10 +119,15 @@ class SimpleCellRobinBcCoefs: * boundary values, the flux or the Dirichlet/Neumann * flag. That hierarchy and the range of relevant * patch levels is specified by calling this function. + * + * @pre hierarchy + * @pre d_dim == hierarchy->getDim() + * + * @post (d_ln_min >= 0) && (d_ln_max >= 0) && (d_ln_min <= d_ln_max) */ void setHierarchy( - const boost::shared_ptr&, + const boost::shared_ptr& hierarchy, const int ln_min = -1, const int ln_max = -1); @@ -130,7 +141,7 @@ class SimpleCellRobinBcCoefs: * * If using Dirichlet boundary conditions, then before the solver is * called, the storage for the unknown u - * must have a mapped_box_level of ghost cells at least one cell wide that includes + * must have a box_level of ghost cells at least one cell wide that includes * the Dirichlet boundary values. * * If using Neumann boundary conditions, then before the solver is called, @@ -156,14 +167,18 @@ class SimpleCellRobinBcCoefs: * conditions, 1 for Neumann conditions, and 2 for mixed boundary * conditions. The bdry_type argument is never required, but if used * it can sometimes make the PoissonHYPRESolver class more efficient. + * + * @pre (boundary_type != "Neumann") || (fluxes >= 0) + * @pre (boundary_type != "Mixed") || ((fluxes >= 0) && (flags >= 0)) + * @pre (boundary_type == "Dirichlet") || (boundary_type != "Neumann") || + * (boundary_type != "Mixed") */ - void setBoundaries( const std::string& boundary_type, const int fluxes = -1, const int flags = -1, - int* bdry_types = NULL); + int* bdry_types = 0); /*! * @brief Cache data providing Dirichlet boundary values. @@ -180,6 +195,8 @@ class SimpleCellRobinBcCoefs: * * @param dirichlet_data_id patch data id of the source cell data * for copy. + * + * @pre d_hierarchy */ void cacheDirichletData( @@ -195,6 +212,8 @@ class SimpleCellRobinBcCoefs: * * @param dirichlet_data_id patch data id of the destination cell data * for copy. + * + * @pre !d_dirichlet_data_pos.empty() */ void restoreDirichletData( @@ -273,6 +292,8 @@ class SimpleCellRobinBcCoefs: * @param boundary_box input boundary box * @return a box to define the face indices corresponding to * boundary_box + * + * @pre boundary_box.getBoundaryType() == 1 */ hier::Box makeSideBoundaryBox( @@ -296,7 +317,7 @@ class SimpleCellRobinBcCoefs: /*! * @brief array of boundary type on each side */ - int d_bdry_types[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int d_bdry_types[2 * SAMRAI::MAX_DIM_VAL]; /*! * @brief patch index for fluxes */ @@ -305,10 +326,6 @@ class SimpleCellRobinBcCoefs: * @brief patch index for flags */ int d_flag_id; - /*! - * @brief patch index for Dirichlet values. - */ - int d_dirichlet_data_id; /*! * @brief patch index for diffusion coefficients if it is variable. */ @@ -324,7 +341,7 @@ class SimpleCellRobinBcCoefs: * array. For the position of a particular box, see * d_dirichlet_data_position. */ - tbox::Array > > d_dirichlet_data; + std::vector > > d_dirichlet_data; /*! * @brief Position of cached boundary boxes of ghost cell data. * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.C index db676c43..676ac08a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to C++ vector implementation for Sundials package. * ************************************************************************/ @@ -22,7 +22,7 @@ SundialsAbstractVector::SundialsAbstractVector() { /* Create N vector */ d_n_vector = (N_Vector)malloc(sizeof *d_n_vector); - TBOX_ASSERT(d_n_vector != NULL); + TBOX_ASSERT(d_n_vector != 0); /* Attach content and ops */ d_n_vector->content = this; @@ -34,10 +34,10 @@ SundialsAbstractVector::~SundialsAbstractVector() if (d_n_vector) { if (d_n_vector->ops) { free(d_n_vector->ops); - d_n_vector->ops = NULL; + d_n_vector->ops = 0; } free(d_n_vector); - d_n_vector = NULL; + d_n_vector = 0; } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.h index 99986ccb..76029cca 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/SundialsAbstractVector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to C++ vector kernel operations for Sundials package. * ************************************************************************/ @@ -29,7 +29,7 @@ namespace SAMRAI { namespace solv { /** - * Class solv::SundialsAbstractVector is an abstract base class that declares + * Class SundialsAbstractVector is an abstract base class that declares * operations provided by any C++ class that may be used as the * vector kernel by the Sundials nonlinear solver package. Sundials allows * arbitrarily defined vectors to be used within it as long as the proper @@ -66,14 +66,14 @@ namespace solv { * * * - * @see solv::SundialsSolver + * @see SundialsSolver */ class SundialsAbstractVector { public: /** - * Uninteresting constructor and destructor for solv::SundialsAbstractVector. + * Uninteresting constructor and destructor for SundialsAbstractVector. */ SundialsAbstractVector(); virtual ~SundialsAbstractVector(); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.C index cd117709..7c31c941 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: "Glue code" between SAMRAI vector object and Sundials vector. * ************************************************************************/ - -#ifndef included_solv_Sundials_SAMRAIVector_C -#define included_solv_Sundials_SAMRAIVector_C - #include "SAMRAI/solv/Sundials_SAMRAIVector.h" #ifdef HAVE_SUNDIALS @@ -28,7 +24,7 @@ namespace solv { ************************************************************************* */ -SundialsAbstractVector* +SundialsAbstractVector * Sundials_SAMRAIVector::createSundialsVector( const boost::shared_ptr >& samrai_vec) { @@ -51,7 +47,7 @@ boost::shared_ptr > Sundials_SAMRAIVector::getSAMRAIVector( SundialsAbstractVector* sundials_vec) { - TBOX_ASSERT(!(sundials_vec == (SundialsAbstractVector *)NULL)); + TBOX_ASSERT(sundials_vec != 0); return (dynamic_cast(sundials_vec))-> getSAMRAIVector(); } @@ -60,7 +56,7 @@ boost::shared_ptr > Sundials_SAMRAIVector::getSAMRAIVector( N_Vector sundials_vec) { - TBOX_ASSERT(!(sundials_vec == NULL)); + TBOX_ASSERT(sundials_vec != 0); // sgs return static_cast(sundials_vec->content)-> getSAMRAIVector(); @@ -93,7 +89,7 @@ Sundials_SAMRAIVector::~Sundials_SAMRAIVector() ************************************************************************* */ -SundialsAbstractVector* +SundialsAbstractVector * Sundials_SAMRAIVector::makeNewVector() { Sundials_SAMRAIVector* out_vec = @@ -253,4 +249,3 @@ Sundials_SAMRAIVector::testReciprocal( } #endif -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.h index e26ceb7e..84e056a6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/Sundials_SAMRAIVector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: "Glue code" between Sundials vector interface and SAMRAI vectors. * ************************************************************************/ @@ -24,7 +24,7 @@ #include "SAMRAI/solv/SundialsAbstractVector.h" #include "SAMRAI/solv/SAMRAIVectorReal.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace solv { @@ -50,8 +50,8 @@ namespace solv { * Finally, we remark that this class provides vectors of type double, * which is the default for Sundials. * - * @see solv::SundialsAbstractVector - * @see solv::SAMRAIVectorReal + * @see SundialsAbstractVector + * @see SAMRAIVectorReal */ class Sundials_SAMRAIVector:public SundialsAbstractVector @@ -67,6 +67,8 @@ class Sundials_SAMRAIVector:public SundialsAbstractVector * through the SAMRAI vector object directly. For output of the * data through "N_VPrint" calls, the output stream to which the * SAMRAI vector object writes will be used. + * + * @pre samrai_vec */ static SundialsAbstractVector * createSundialsVector( @@ -84,6 +86,8 @@ class Sundials_SAMRAIVector:public SundialsAbstractVector /** * Return pointer to the SAMRAI vector object associated with the * given Sundials wrapper vector. + * + * @pre sundials_vec != 0 */ static boost::shared_ptr > getSAMRAIVector( @@ -92,6 +96,8 @@ class Sundials_SAMRAIVector:public SundialsAbstractVector /** * Return pointer to the SAMRAI vector object associated with the * given Sundials vector. + * + * @pre sundials_vec != 0 */ static boost::shared_ptr > getSAMRAIVector( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual.dox index 78bff2aa..c1d6ce8b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ @@ -16,11 +16,9 @@ namespace SAMRAI { The Solver package provides support for applying linear, nonlinear, and ODE solvers on a structured AMR patch hierarchy. The classes are divided into four categories: - -# @ref package_solvers_packages "C++ interfaces to specific - solver libraries (e.g., PETSc)" - -# @ref package_solvers_vectors "vector kernel support for data - on an AMR composite grid" - -# @ref package_solvers_FAC "Implementation of an FAC solver" + -# @ref package_solvers_packages "C++ interfaces to specific solver libraries (e.g., PETSc)" + -# @ref package_solvers_vectors "vector kernel support for data on an AMR composite grid" + -# @ref package_solvers_FAC "Implementation of a FAC solver" -# @ref package_solvers_poisson "Poisson solvers" -# @ref package_solvers_nonlinear "Nonlinear solver interface" diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_FAC.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_FAC.dox index ac5f306a..b724ee09 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_FAC.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_FAC.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_nonlinear.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_nonlinear.dox index b6bfe505..c533d8d3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_nonlinear.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_nonlinear.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages.dox index cc8c4baa..54786b05 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_petsc.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_petsc.dox index 864fe1f7..45730bdd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_petsc.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_petsc.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials.dox index ee18405f..904352b4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_cvode.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_cvode.dox index 7b5920cf..0b14249c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_cvode.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_cvode.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_kinsol.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_kinsol.dox index 66c3ece9..e54566dd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_kinsol.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_kinsol.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_vector.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_vector.dox index ab6e50a8..db111d13 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_vector.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_packages_sundials_vector.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_poisson.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_poisson.dox index e52bd32b..4d958ca3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_poisson.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_poisson.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_vectors.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_vectors.dox index 668c328b..a21acebf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_vectors.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/dox/manual_vectors.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.depend index 96917646..d0f28d0e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -16,70 +16,64 @@ DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cartesianrobinbchelper2d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=solv_cartesianrobinbchelper3d.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cartesianrobinbchelper3d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=solv_cellpoissonfacops2d.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cellpoissonfacops2d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=solv_cellpoissonfacops3d.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cellpoissonfacops3d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=solv_cellpoissonhypresolver2d.o DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cellpoissonhypresolver2d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=solv_cellpoissonhypresolver3d.o DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ solv_cellpoissonhypresolver3d.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.in index e9f1669e..457a1d2c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/Makefile.in @@ -3,15 +3,15 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for fortran files for solv directory ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/SAMRAI/solv/fortran -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. # For classes that are non-dimensional. @@ -28,6 +28,6 @@ include $(OBJECT)/config/Makefile.config library: $(OBJS) clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper2d.f index 8d271b09..c327401e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper2d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper2d.f @@ -1,12 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for Cartesian 2d Robin boundary conditions +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for Cartesian 2d Robin boundary conditions. c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper3d.f index a6c81cdc..31ed4cfe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper3d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cartesianrobinbchelper3d.f @@ -1,12 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for Cartesian 3d Robin boundary conditions +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for Cartesian 3d Robin boundary conditions. c c*********************************************************************** c*********************************************************************** @@ -263,7 +260,7 @@ subroutine settype3cells3d( i = lower(0) j = lower(1) k = lower(2) - data(i,j,k) = -data(i+1,j+1,k+1) + data(i,j,k) = -data(i+1,j+1,k+1) & + 2./3.*( data(i,j+1,k+1) & + data(i+1,j,k+1) & + data(i+1,j+1,k) ) @@ -272,7 +269,7 @@ subroutine settype3cells3d( i = upper(0) j = lower(1) k = lower(2) - data(i,j,k) = -data(i-1,j+1,k+1) + data(i,j,k) = -data(i-1,j+1,k+1) & + 2./3.*( data(i,j+1,k+1) & + data(i-1,j,k+1) & + data(i-1,j+1,k) ) @@ -281,7 +278,7 @@ subroutine settype3cells3d( i = lower(0) j = upper(1) k = lower(2) - data(i,j,k) = -data(i+1,j-1,k+1) + data(i,j,k) = -data(i+1,j-1,k+1) & + 2./3.*( data(i,j-1,k+1) & + data(i+1,j,k+1) & + data(i+1,j-1,k) ) @@ -290,7 +287,7 @@ subroutine settype3cells3d( i = upper(0) j = upper(1) k = lower(2) - data(i,j,k) = -data(i-1,j-1,k+1) + data(i,j,k) = -data(i-1,j-1,k+1) & + 2./3.*( data(i,j-1,k+1) & + data(i-1,j,k+1) & + data(i-1,j-1,k) ) @@ -299,7 +296,7 @@ subroutine settype3cells3d( i = lower(0) j = lower(1) k = upper(2) - data(i,j,k) = -data(i+1,j+1,k-1) + data(i,j,k) = -data(i+1,j+1,k-1) & + 2./3.*( data(i,j+1,k-1) & + data(i+1,j,k-1) & + data(i+1,j+1,k) ) @@ -308,7 +305,7 @@ subroutine settype3cells3d( i = upper(0) j = lower(1) k = upper(2) - data(i,j,k) = -data(i-1,j+1,k-1) + data(i,j,k) = -data(i-1,j+1,k-1) & + 2./3.*( data(i,j+1,k-1) & + data(i-1,j,k-1) & + data(i-1,j+1,k) ) @@ -317,7 +314,7 @@ subroutine settype3cells3d( i = lower(0) j = upper(1) k = upper(2) - data(i,j,k) = -data(i+1,j-1,k-1) + data(i,j,k) = -data(i+1,j-1,k-1) & + 2./3.*( data(i,j-1,k-1) & + data(i+1,j,k-1) & + data(i+1,j-1,k) ) @@ -326,7 +323,7 @@ subroutine settype3cells3d( i = upper(0) j = upper(1) k = upper(2) - data(i,j,k) = -data(i-1,j-1,k-1) + data(i,j,k) = -data(i-1,j-1,k-1) & + 2./3.*( data(i,j-1,k-1) & + data(i-1,j,k-1) & + data(i-1,j-1,k) ) diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops2d.f index ea2571ca..a84cb630 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops2d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops2d.f @@ -1,10 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for scalar Poisson FAC operator +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for scalar Poisson FAC operator c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops3d.f index 85bfbcc0..9a4cd163 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops3d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonfacops3d.f @@ -1,10 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for scalar Poisson FAC operator +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for scalar Poisson FAC operator. c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver2d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver2d.f index d3b920ca..42945fff 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver2d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver2d.f @@ -1,12 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for scalar Poisson Hypre solver +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for scalar Poisson Hypre solver. c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver3d.f b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver3d.f index 1551910e..60509afa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver3d.f +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/fortran/solv_cellpoissonhypresolver3d.f @@ -1,12 +1,9 @@ c -c File: $URL$ -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for scalar Poisson Hypre solver +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for scalar Poisson Hypre solver. c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/nvector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/nvector.h index fc2e3d63..585be1a6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/nvector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/nvector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: header file included by CVODE source files * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.C b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.C index c1e735a5..b77e626d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface to C++ vector implementation for Sundials package. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.h b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.h index 0e05d2bf..d5040097 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/solv/solv_NVector.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: C interface to C++ vector implementation for Sundials package. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.C index 4843d3fe..6dd2d3d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A simple array template class * ************************************************************************/ @@ -37,7 +37,7 @@ const typename Array::DoNotInitialize Array::UNINITIALIZED; */ template -Array::Array() : +Array::Array(): d_objects(0), d_counter(0), d_elements(0) @@ -46,7 +46,7 @@ Array::Array() : template Array::Array( - const Array& rhs) : + const Array& rhs): d_objects(rhs.d_objects), d_counter(rhs.d_counter), d_elements(rhs.d_elements) @@ -67,13 +67,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { void* p = &d_objects[i]; (void)new (p)TYPE(default_value); } } else { - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -90,8 +90,8 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; } else { - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -132,11 +132,13 @@ Array::resizeArray( if (n != d_elements) { Array array(n, default_value); const int s = (d_elements < n ? d_elements : n); - for (int i = 0; i < s; i++) { + for (int i = 0; i < s; ++i) { array.d_objects[i] = d_objects[i]; } - this->operator = (array); + this-> + operator = ( + array); } } @@ -145,7 +147,7 @@ void Array::erase( const int position) { - TBOX_ASSERT(position >= 0 && position < d_elements); + TBOX_ASSERT((position >= 0) && (position < size())); if (d_elements > 1) { @@ -155,13 +157,13 @@ Array::erase( malloc(sizeof(TYPE) * new_d_elements)); /* copy lower part of array */ - for (int j = 0; j < position; j++) { + for (int j = 0; j < position; ++j) { void* p = &new_d_objects[j]; (void)new (p)TYPE(d_objects[j]); } /* copy upper part of array */ - for (int j = position + 1; j < d_elements; j++) { + for (int j = position + 1; j < d_elements; ++j) { void* p = &new_d_objects[j - 1]; (void)new (p)TYPE(d_objects[j]); } @@ -178,8 +180,8 @@ Array::erase( if (d_counter && d_counter->deleteReference()) { deleteObjects(); } - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -190,15 +192,15 @@ void Array::deleteObjects() { if (d_objects) { - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i].~TYPE(); } free(reinterpret_cast(d_objects)); delete d_counter; } - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -207,7 +209,7 @@ TYPE& Array::operator [] ( const int i) { - TBOX_ASSERT((i >= 0) && (i < d_elements)); + TBOX_ASSERT((i >= 0) && (i < size())); return d_objects[i]; } @@ -217,7 +219,7 @@ const TYPE& Array::operator [] ( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_elements)); + TBOX_ASSERT((i >= 0) && (i < size())); return d_objects[i]; } @@ -229,8 +231,8 @@ Array::setNull() if (d_counter && d_counter->deleteReference()) { deleteObjects(); } - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -241,8 +243,8 @@ Array::clear() if (d_counter && d_counter->deleteReference()) { deleteObjects(); } - d_objects = (TYPE *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -261,21 +263,21 @@ Array::empty() const } template -TYPE* +TYPE * Array::getPointer( const int i) { - TBOX_ASSERT((i >= 0) && (i < d_elements)); + TBOX_ASSERT((i >= 0) && (i < size())); return &d_objects[i]; } template -const TYPE* +const TYPE * Array::getPointer( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_elements)); + TBOX_ASSERT((i >= 0) && (i < size())); return &d_objects[i]; } @@ -318,7 +320,7 @@ template const TYPE& Array::back() { - TBOX_ASSERT(d_elements > 0); + TBOX_ASSERT(size() > 0); return d_objects[d_elements - 1]; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.h index bc9ad9d6..2d88e548 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Array.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A simple array template class * ************************************************************************/ @@ -33,7 +33,7 @@ namespace tbox { * Class TYPE must define a copy constructor and an assignment * operator. * - * @see tbox::ReferenceCounter + * @see ReferenceCounter */ template @@ -78,7 +78,7 @@ class Array /** * Create an array of ``n'' uninitialized elements. * - * The tbox::Array::UNINITIALIZED value should be used for the + * The Array::UNINITIALIZED value should be used for the * second argument to flag that the array is uninitialized. * * CAUTION: Invoking this constructor will potentially result in a @@ -90,7 +90,7 @@ class Array * following example: * * \code - * for(int i = 0; i < d_elements; i++) { + * for(int i = 0; i < d_elements; ++i) { * void *p = &d_objects[i]; * (void) new (p) TYPE(arg1, arg2); * } @@ -112,7 +112,7 @@ class Array const typename Array::DoNotInitialize& do_not_initialize_flag); /** - * Const constructor for the array. This creates an alias to the + * Copy constructor for the array. This creates an alias to the * right hand side and increments the reference count. * * CAUTION: invoking resizeArray() forces a deep copy. @@ -122,7 +122,7 @@ class Array * of by value. */ Array( - const Array& rhs); + const Array& rhs); /** * Destructor for the array. If the reference count for the array data @@ -140,14 +140,18 @@ class Array * to one Array object container will not necessarily be reflected in the * other container. */ - Array& + Array& operator = ( - const Array& rhs); + const Array& rhs); /** * Non-const array subscripting. Return a reference the object at array * index ``i'' (between 0 and N-1, where N is the number of elements in * the array. + * + * @param i Array index of item whose reference is to be returned. + * + * @pre (i >= 0) && (i < size()) */ TYPE& operator [] ( @@ -157,6 +161,10 @@ class Array * Const array subscripting. Return a const reference to the object * at array index ``i'' (between 0 and N-1, where N is the number of * elements in the array. + * + * @param i Array index of item whose reference is to be returned. + * + * @pre (i >= 0) && (i < size()) */ const TYPE& operator [] ( @@ -197,6 +205,10 @@ class Array /** * Return a non-const pointer to the i-th object. The index must be * between 0 and N-1, where N is the number of elements in the array. + * + * @param i Array index of item whose reference is to be returned. + * + * @pre (i >= 0) && (i < size()) */ TYPE * getPointer( @@ -205,6 +217,10 @@ class Array /** * Return a const pointer to the i-th object. The index must be * between 0 and N-1, where N is the number of elements in the array. + * + * @param i Array index of item whose reference is to be returned. + * + * @pre (i >= 0) && (i < size()) */ const TYPE * getPointer( @@ -248,9 +264,9 @@ class Array const TYPE& value); /** - * * Returns a reference to the last element in the array container. * + * @pre size() > 0 */ const TYPE& back(); @@ -259,6 +275,9 @@ class Array * * Removes from the array container a single element at position. * + * @param position Array index of element to be removed. + * + * @pre (position >= 0) && (position < size()) */ void erase( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ArraySpecial.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ArraySpecial.C index 447ccd06..e91825fc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ArraySpecial.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ArraySpecial.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Array specializations * ************************************************************************/ @@ -34,13 +34,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i] = default_value; } } else { - d_objects = (bool *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -55,13 +55,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i] = default_value; } } else { - d_objects = (char *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -76,13 +76,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i] = default_value; } } else { - d_objects = (int *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -97,13 +97,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i] = default_value; } } else { - d_objects = (float *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -118,13 +118,13 @@ Array::Array( d_counter = new ReferenceCounter; d_elements = n; - for (int i = 0; i < d_elements; i++) { + for (int i = 0; i < d_elements; ++i) { d_objects[i] = default_value; } } else { - d_objects = (double *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } } @@ -138,8 +138,8 @@ Array::deleteObjects() delete d_counter; } - d_objects = (bool *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -152,8 +152,8 @@ Array::deleteObjects() delete d_counter; } - d_objects = (char *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -166,8 +166,8 @@ Array::deleteObjects() delete d_counter; } - d_objects = (int *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -180,8 +180,8 @@ Array::deleteObjects() delete d_counter; } - d_objects = (float *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } @@ -194,8 +194,8 @@ Array::deleteObjects() delete d_counter; } - d_objects = (double *)NULL; - d_counter = (ReferenceCounter *)NULL; + d_objects = 0; + d_counter = 0; d_elements = 0; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.C index 80fd4a39..4476d2fb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: All-to-one and one-to-all communication using a tree. * ************************************************************************/ @@ -63,22 +63,22 @@ AsyncCommGroup::s_initialize_finalize_handler( */ AsyncCommGroup::AsyncCommGroup(): AsyncCommStage::Member(), - d_nchild(MathUtilities::getMax()), + d_nchild(MathUtilities::getMax()), d_idx(-1), d_root_idx(-1), d_parent_rank(-1), - d_child_data(NULL), + d_child_data(0), d_branch_size_totl(-1), d_base_op(undefined), d_next_task_op(none), - d_external_buf(NULL), + d_external_buf(0), d_external_size(0), d_internal_buf(), d_mpi_tag(-1), d_mpi(SAMRAI_MPI::getSAMRAIWorld()), d_use_mpi_collective_for_full_groups(false), d_use_blocking_send_to_children(false), - d_use_blocking_send_to_parent(true) + d_use_blocking_send_to_parent(false) #ifdef DEBUG_CHECK_ASSERTIONS , d_group_ranks(0, true) @@ -106,14 +106,14 @@ AsyncCommGroup::AsyncCommGroup( d_branch_size_totl(-1), d_base_op(undefined), d_next_task_op(none), - d_external_buf(NULL), + d_external_buf(0), d_external_size(0), d_internal_buf(), d_mpi_tag(-1), d_mpi(SAMRAI_MPI::getSAMRAIWorld()), d_use_mpi_collective_for_full_groups(false), d_use_blocking_send_to_children(false), - d_use_blocking_send_to_parent(true) + d_use_blocking_send_to_parent(false) #ifdef DEBUG_CHECK_ASSERTIONS , d_group_ranks(0, true) @@ -128,7 +128,7 @@ AsyncCommGroup::AsyncCommGroup( */ AsyncCommGroup::AsyncCommGroup( const AsyncCommGroup& r): - AsyncCommStage::Member(0, NULL, NULL), + AsyncCommStage::Member(0, 0, 0), d_nchild(0), d_mpi(SAMRAI_MPI::getSAMRAIWorld()) { @@ -163,7 +163,7 @@ AsyncCommGroup::~AsyncCommGroup() << "mpi_tag = " << d_mpi_tag); } delete[] d_child_data; - d_child_data = NULL; + d_child_data = 0; } /* @@ -236,7 +236,7 @@ bool AsyncCommGroup::isDone() const { #ifdef DEBUG_CHECK_ASSERTIONS - if (d_next_task_op == none) { + if (getNextTaskOp() == none) { TBOX_ASSERT(!hasPendingRequests()); // Verify sane state. } #endif @@ -256,12 +256,12 @@ AsyncCommGroup::completeCurrentOperation() { SAMRAI_MPI::Request * const req = getRequestPointer(); SAMRAI_MPI::Status* mpi_stat = d_next_task_op == none ? - (SAMRAI_MPI::Status *)NULL : new SAMRAI_MPI::Status[d_nchild]; + 0 : new SAMRAI_MPI::Status[d_nchild]; while (d_next_task_op != none) { t_wait_all->start(); - int errf = d_mpi.Waitall(static_cast(d_nchild), + int errf = SAMRAI_MPI::Waitall(static_cast(d_nchild), req, mpi_stat); t_wait_all->stop(); @@ -276,7 +276,7 @@ AsyncCommGroup::completeCurrentOperation() } - if (mpi_stat != NULL) { + if (mpi_stat != 0) { delete[] mpi_stat; } } @@ -292,7 +292,7 @@ AsyncCommGroup::beginBcast( int* buffer, int size) { - if (d_next_task_op != none) { + if (getNextTaskOp() != none) { TBOX_ERROR("Cannot begin communication while another is in progress." << "mpi_communicator = " << d_mpi.getCommunicator() << "mpi_tag = " << d_mpi_tag); @@ -321,7 +321,7 @@ AsyncCommGroup::beginBcast( bool AsyncCommGroup::checkBcast() { - if (d_base_op != bcast) { + if (getBaseOp() != bcast) { TBOX_ERROR("Cannot check nonexistent broadcast operation." << "mpi_communicator = " << d_mpi.getCommunicator() << "mpi_tag = " << d_mpi_tag); @@ -360,7 +360,7 @@ AsyncCommGroup::checkBcast() case recv_check: if (req[0] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[0], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[0], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -370,10 +370,11 @@ AsyncCommGroup::checkBcast() << "mpi_communicator = " << d_mpi.getCommunicator() << "mpi_tag = " << d_mpi_tag); } + TBOX_ASSERT((req[0] == MPI_REQUEST_NULL) == (flag == 1)); if (flag == 1) { #ifdef DEBUG_CHECK_ASSERTIONS int count = -1; - d_mpi_err = d_mpi.Get_count(&d_mpi_status, MPI_INT, &count); + d_mpi_err = SAMRAI_MPI::Get_count(&d_mpi_status, MPI_INT, &count); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Get_count.\n" << "Error-in-status is " @@ -393,7 +394,6 @@ AsyncCommGroup::checkBcast() TBOX_ASSERT(count <= d_external_size); TBOX_ASSERT(d_mpi_status.MPI_TAG == d_mpi_tag); TBOX_ASSERT(d_mpi_status.MPI_SOURCE == d_parent_rank); - TBOX_ASSERT(req[0] == MPI_REQUEST_NULL); #endif } else { d_next_task_op = recv_check; @@ -437,7 +437,7 @@ AsyncCommGroup::checkBcast() for (ic = 0; ic < d_nchild; ++ic) { if (req[ic] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[ic], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[ic], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -447,17 +447,14 @@ AsyncCommGroup::checkBcast() << "mpi_communicator = " << d_mpi.getCommunicator() << "mpi_tag = " << d_mpi_tag); } -#ifdef DEBUG_CHECK_ASSERTIONS - if (req[ic] == MPI_REQUEST_NULL) { - int count = -1; - d_mpi.Get_count(&d_mpi_status, MPI_INT, &count); + TBOX_ASSERT((req[ic] == MPI_REQUEST_NULL) == (flag == 1)); #ifdef AsyncCommGroup_DEBUG_OUTPUT + if (req[ic] == MPI_REQUEST_NULL) { plog << "tag-" << d_mpi_tag << " sent unknown size (MPI convention)" << " to " << d_child_data[ic].rank << " in checkBcast" << std::endl; -#endif } #endif } @@ -481,7 +478,7 @@ AsyncCommGroup::checkBcast() } if (d_parent_rank == -1) { - TBOX_ASSERT(d_next_task_op != recv_check); + TBOX_ASSERT(getNextTaskOp() != recv_check); } return d_next_task_op == none; @@ -526,7 +523,7 @@ AsyncCommGroup::beginGather( int size) { - if (d_next_task_op != none) { + if (getNextTaskOp() != none) { TBOX_ERROR("Cannot begin communication while another is in progress." << "mpi_communicator = " << d_mpi.getCommunicator() << "mpi_tag = " << d_mpi_tag); @@ -597,7 +594,7 @@ AsyncCommGroup::beginGather( bool AsyncCommGroup::checkGather() { - if (d_base_op != gather) { + if (getBaseOp() != gather) { TBOX_ERROR("Cannot check nonexistent gather operation\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -648,7 +645,7 @@ AsyncCommGroup::checkGather() for (ic = 0; ic < d_nchild; ++ic) { if (req[ic] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[ic], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[ic], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -658,13 +655,13 @@ AsyncCommGroup::checkGather() << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); } + TBOX_ASSERT((req[ic] == MPI_REQUEST_NULL) == (flag == 1)); #ifdef DEBUG_CHECK_ASSERTIONS if (flag == 1) { TBOX_ASSERT(d_mpi_status.MPI_TAG == d_mpi_tag); TBOX_ASSERT(d_mpi_status.MPI_SOURCE == d_child_data[ic].rank); - TBOX_ASSERT(req[ic] == MPI_REQUEST_NULL); int count = -1; - d_mpi.Get_count(&d_mpi_status, MPI_INT, &count); + SAMRAI_MPI::Get_count(&d_mpi_status, MPI_INT, &count); #ifdef AsyncCommGroup_DEBUG_OUTPUT plog << "tag-" << d_mpi_tag << " received " << count @@ -755,7 +752,7 @@ AsyncCommGroup::checkGather() case send_check: if (req[0] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[0], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[0], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -765,6 +762,7 @@ AsyncCommGroup::checkGather() << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); } + TBOX_ASSERT((req[0] == MPI_REQUEST_NULL) == (flag == 1)); } if (req[0] != MPI_REQUEST_NULL) { d_next_task_op = send_check; @@ -802,7 +800,7 @@ AsyncCommGroup::beginSumReduce( int* buffer, int size) { - if (d_next_task_op != none) { + if (getNextTaskOp() != none) { TBOX_ERROR("Cannot begin communication while another is in progress.\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -921,9 +919,9 @@ AsyncCommGroup::beginReduce() bool AsyncCommGroup::checkReduce() { - if (!(d_base_op == max_reduce || - d_base_op == min_reduce || - d_base_op == sum_reduce)) { + if (!(getBaseOp() == max_reduce || + getBaseOp() == min_reduce || + getBaseOp() == sum_reduce)) { TBOX_ERROR("Cannot check nonexistent reduce operation.\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -968,7 +966,7 @@ AsyncCommGroup::checkReduce() for (ic = 0; ic < d_nchild; ++ic) { if (req[ic] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[ic], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[ic], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -978,13 +976,13 @@ AsyncCommGroup::checkReduce() << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); } + TBOX_ASSERT((req[ic] == MPI_REQUEST_NULL) == (flag == 1)); if (flag == 1) { #ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(d_mpi_status.MPI_TAG == d_mpi_tag); TBOX_ASSERT(d_mpi_status.MPI_SOURCE == d_child_data[ic].rank); - TBOX_ASSERT(req[ic] == MPI_REQUEST_NULL); int count = -1; - d_mpi.Get_count(&d_mpi_status, MPI_INT, &count); + SAMRAI_MPI::Get_count(&d_mpi_status, MPI_INT, &count); #ifdef AsyncCommGroup_DEBUG_OUTPUT plog << " child-" << ic << " tag-" << d_mpi_tag << " received " << count @@ -1075,7 +1073,7 @@ AsyncCommGroup::checkReduce() case send_check: if (req[0] != MPI_REQUEST_NULL) { resetStatus(); - d_mpi_err = d_mpi.Test(&req[0], &flag, &d_mpi_status); + d_mpi_err = SAMRAI_MPI::Test(&req[0], &flag, &d_mpi_status); if (d_mpi_err != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_Test.\n" << "Error-in-status is " @@ -1085,18 +1083,15 @@ AsyncCommGroup::checkReduce() << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); } + TBOX_ASSERT((req[0] == MPI_REQUEST_NULL) == (flag == 1)); } if (req[0] != MPI_REQUEST_NULL) { -#ifdef DEBUG_CHECK_ASSERTIONS - int count = -1; - d_mpi.Get_count(&d_mpi_status, MPI_INT, &count); #ifdef AsyncCommGroup_DEBUG_OUTPUT plog << "tag-" << d_mpi_tag - << " sent " << count + << " sent unknown size (MPI convention)" << " to " << d_parent_rank << " in checkReduce" << std::endl; -#endif #endif d_next_task_op = send_check; } else { @@ -1110,11 +1105,11 @@ AsyncCommGroup::checkReduce() << "mpi_tag = " << d_mpi_tag << '\n'); } - if (d_parent_rank == -1) { - TBOX_ASSERT(d_next_task_op != send_check); + if (getParentRank() == -1) { + TBOX_ASSERT(getNextTaskOp() != send_check); } - if (d_next_task_op != none) { + if (getNextTaskOp() != none) { TBOX_ASSERT(numberOfPendingRequests() > 0); } @@ -1159,8 +1154,9 @@ AsyncCommGroup::setGroupAndRootIndex( const int group_size, const int root_index) { - if (d_next_task_op != none) { - TBOX_ERROR("Changing group while a communication is occuring can\n" + if (getNextTaskOp() != none) { + TBOX_ERROR("AsyncCommGroup::setGroupAndRootIndex:\n" + << "Changing group while a communication is occuring can\n" << "corrupt data and so is disallowed.\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -1183,8 +1179,9 @@ AsyncCommGroup::setGroupAndRootIndex( #ifdef DEBUG_CHECK_ASSERTIONS // Set d_group_ranks and do some sanity checks. if (d_group_size > d_mpi.getSize()) { - TBOX_ERROR("Group size must not be greater than the size of\n" - << "the MPI communicator group.\n" + TBOX_ERROR("AsyncCommGroup::setGroupAndRootIndex:\n" + << "Group size (" << d_group_size << ") must not be greater than the size of\n" + << "the MPI communicator group (" << d_mpi.getSize() << ").\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -1192,11 +1189,12 @@ AsyncCommGroup::setGroupAndRootIndex( TBOX_ASSERT(d_group_size > 0); if (d_idx == -1) { TBOX_ERROR( - "The local process (" << d_mpi.getRank() - << ") MUST be in the communication group.\n" - << "mpi_communicator = " - << d_mpi.getCommunicator() << '\n' - << "mpi_tag = " << d_mpi_tag << '\n'); + "AsyncCommGroup::setGroupAndRootIndex:\n" + << "The local process (" << d_mpi.getRank() + << ") MUST be in the communication group.\n" + << "mpi_communicator = " + << d_mpi.getCommunicator() << '\n' + << "mpi_tag = " << d_mpi_tag << '\n'); } d_group_ranks.clear(); d_group_ranks.insert(d_group_ranks.end(), d_group_size, -1); @@ -1204,18 +1202,20 @@ AsyncCommGroup::setGroupAndRootIndex( for (int i = 0; i < d_group_size; ++i) { if (group_ranks[i] < 0 || group_ranks[i] >= d_mpi.getSize()) { TBOX_ERROR( - "Rank " << group_ranks[i] << " is not in the current\n" - << "MPI communicator.\n" - << "mpi_communicator = " - << d_mpi.getCommunicator() << '\n' - << "mpi_tag = " << d_mpi_tag - << '\n'); + "AsyncCommGroup::setGroupAndRootIndex:\n" + << "Rank " << group_ranks[i] << " is not in the current\n" + << "MPI communicator.\n" + << "mpi_communicator = " + << d_mpi.getCommunicator() << '\n' + << "mpi_tag = " << d_mpi_tag + << '\n'); } if (group_ranks[i] == d_mpi.getRank()) ++dup; d_group_ranks[i] = group_ranks[i]; } if (dup != 1) { - TBOX_ERROR("The local process must appear exactly once in the group.\n" + TBOX_ERROR("AsyncCommGroup::setGroupAndRootIndex:\n" + << "The local process must appear exactly once in the group.\n" << "It appeared " << dup << " times.\n" << "mpi_communicator = " << d_mpi.getCommunicator() << '\n' << "mpi_tag = " << d_mpi_tag << '\n'); @@ -1373,7 +1373,7 @@ AsyncCommGroup::toPosition( int index) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (index < 0 || index >= d_group_size) { + if (index < 0 || index >= getGroupSize()) { TBOX_ERROR( "Invalid index " << index << "\n" << "should be in [0," << d_group_size - 1 @@ -1395,7 +1395,7 @@ AsyncCommGroup::toIndex( int position) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (position < 0 || position >= d_group_size) { + if (position < 0 || position >= getGroupSize()) { TBOX_ERROR( "Invalid parent position " << position << " should be in [" << 0 << ',' @@ -1418,7 +1418,7 @@ AsyncCommGroup::toChildPosition( int child) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (parent_pos < 0 || parent_pos >= d_group_size) { + if (parent_pos < 0 || parent_pos >= getGroupSize()) { TBOX_ERROR( "Invalid parent position " << parent_pos << " should be in [" << 0 << ',' @@ -1437,7 +1437,7 @@ AsyncCommGroup::toOldest( int parent_pos) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (parent_pos < 0 || parent_pos >= d_group_size) { + if (parent_pos < 0 || parent_pos >= getGroupSize()) { TBOX_ERROR( "Invalid parent position " << parent_pos << " should be in [" << 0 << ',' @@ -1456,7 +1456,7 @@ AsyncCommGroup::toYoungest( int parent_pos) const { #ifdef DEBUG_CHECK_ASSERTIONS - if (parent_pos < 0 || parent_pos >= d_group_size) { + if (parent_pos < 0 || parent_pos >= getGroupSize()) { TBOX_ERROR( "Invalid parent position " << parent_pos << " should be in [" << 0 << ',' @@ -1473,7 +1473,7 @@ AsyncCommGroup::toYoungest( void AsyncCommGroup::checkMPIParams() { - if (d_mpi_tag < 0) { + if (getMPITag() < 0) { TBOX_ERROR("AsyncCommGroup: Invalid MPI tag value " << d_mpi_tag << "\nUse setMPITag() to set it."); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.h index d83be7eb..1647c2a0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommGroup.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: All-to-one and one-to-all communication using a tree. * ************************************************************************/ @@ -71,6 +71,21 @@ namespace tbox { class AsyncCommGroup:public AsyncCommStage::Member { +private: + //! @brief Operations user would want to do. + enum BaseOp { undefined, + gather, + bcast, + max_reduce, + min_reduce, + sum_reduce }; + //! @brief Tasks, executed in order, to complete a base operation. + enum TaskOp { recv_start, + recv_check, + send_start, + send_check, + none }; + public: /*! * @brief Default constructor does not set up anything. @@ -87,14 +102,18 @@ class AsyncCommGroup:public AsyncCommStage::Member * i.e., nchild=2 is a binary tree. * @param stage * @param handler + * + * @post nchild == numberOfRequests() */ AsyncCommGroup( const size_t nchild, - AsyncCommStage * stage, - AsyncCommStage::Handler * handler = NULL); + AsyncCommStage* stage, + AsyncCommStage::Handler* handler = 0); /*! * @brief Destructor. + * + * @pre isDone() */ virtual ~AsyncCommGroup(); @@ -110,12 +129,14 @@ class AsyncCommGroup:public AsyncCommStage::Member * message passing calls. * * @param handler Optional handler (see AsyncCommStage::Member). + * + * @pre isDone() */ void initialize( const int nchild, - AsyncCommStage * stage, - AsyncCommStage::Handler * handler = NULL); + AsyncCommStage* stage, + AsyncCommStage::Handler* handler = 0); //@{ //! @name Define the communication group @@ -126,11 +147,13 @@ class AsyncCommGroup:public AsyncCommStage::Member * * The root rank is specified by dereferencing @c group array with * @c root_index. + * + * @pre getNextTaskOp() == none */ void setGroupAndRootIndex( const SAMRAI_MPI& mpi, - const int * group_ranks, + const int* group_ranks, const int group_size, const int root_index); @@ -144,7 +167,7 @@ class AsyncCommGroup:public AsyncCommStage::Member void setGroupAndRootRank( const SAMRAI_MPI& mpi, - const int * group_ranks, + const int* group_ranks, const int group_size, const int root_rank); @@ -160,11 +183,58 @@ class AsyncCommGroup:public AsyncCommStage::Member * if incorrect messages are received. To be safe, it is best to * create a new communicator to avoid interference with other * communications within SAMRAI. + * + * @pre isDone() */ void setMPITag( const int mpi_tag); + /*! + * @brief Returns the MPI tag used for communication within the group. + */ + int + getMPITag() const + { + return d_mpi_tag; + } + + /*! + * @brief Returns the size of the group. + */ + int + getGroupSize() const + { + return d_group_size; + } + + /*! + * @brief Returns next task in a current communication operation. + */ + TaskOp + getNextTaskOp() const + { + return d_next_task_op; + } + + /*! + * @brief Returns operation being performed. + */ + BaseOp + getBaseOp() const + { + return d_base_op; + } + + /*! + * @brief Rank of parent process in the group. + */ + int + getParentRank() const + { + return d_parent_rank; + } + /*! * @brief Set whether to use native MPI collective function calls * when group includes all ranks in the MPI communicator. @@ -172,6 +242,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * This option is off by default to avoid MPI lock-ups. If you use * it, make sure all processors can get to the collective operation * to avoid lock-ups. + * + * @pre isDone() */ void setUseMPICollectiveForFullGroups( @@ -223,10 +295,12 @@ class AsyncCommGroup:public AsyncCommStage::Member * it returns true before any change in object state is allowed. * * @return Whether operation is completed. + * + * @pre getNextTaskOp() == none */ bool beginBcast( - int * buffer, + int* buffer, int size); /*! @@ -237,6 +311,10 @@ class AsyncCommGroup:public AsyncCommStage::Member * If no communication is in progress, this call does nothing. * * @return Whether operation is completed. + * + * @pre getBaseOp() == bcast + * + * @post (getParentRank() != -1) || (getNextTaskOp() != recv_check) */ bool checkBcast(); @@ -265,10 +343,12 @@ class AsyncCommGroup:public AsyncCommStage::Member * times the number of processes in the group). * * @return Whether operation is completed. + * + * @pre getNextTaskOp() == none */ bool beginGather( - int * buffer, + int* buffer, int size); /*! @@ -276,6 +356,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * gather if all MPI requests are fulfilled. * * @return Whether operation is completed. + * + * @pre getBaseOp() == gather */ bool checkGather(); @@ -292,10 +374,12 @@ class AsyncCommGroup:public AsyncCommStage::Member * Buffer should contain the data to be gathered. * * @return Whether operation is completed. + * + * @pre getNextTaskOp() == none */ bool beginSumReduce( - int * buffer, + int* buffer, int size); /*! @@ -324,6 +408,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * such as that returned by hasPendingRequests(). The communication * may be more complex, requiring several messages and copying of the * received message into the correct buffer. + * + * @pre (getNextTaskOp() != none) || !hasPendingRequests() */ bool isDone() const; @@ -349,6 +435,8 @@ class AsyncCommGroup:public AsyncCommStage::Member private: /* * @brief Assert that user-set MPI parameters are valid. + * + * @pre getMPITag() >= 0 */ void checkMPIParams(); @@ -389,20 +477,6 @@ class AsyncCommGroup:public AsyncCommStage::Member bool reduceByMpiCollective(); - //! @brief Operations user would want to do. - enum BaseOp { undefined, - gather, - bcast, - max_reduce, - min_reduce, - sum_reduce }; - //! @brief Tasks, executed in order, to complete a base operation. - enum TaskOp { recv_start, - recv_check, - send_start, - send_check, - none }; - struct ChildData { //! @brief Rank of child process in the group. int rank; @@ -433,6 +507,12 @@ class AsyncCommGroup:public AsyncCommStage::Member * This method is the workhorse underneath the public reduce methods. * * @return Whether operation is completed. + * + * @pre (getBaseOp() == max_reduce) || (getBaseOp() == min_reduce) || + * (getBaseOp() == sum_reduce) + * + * @post (getParentRank() != -1) || (getNextTaskOp() != send_check) + * @post (getNextTaskOp() == none) || (numberOfPendingRequests() > 0) */ bool checkReduce(); @@ -462,9 +542,9 @@ class AsyncCommGroup:public AsyncCommStage::Member void resetStatus() { - d_mpi_status.MPI_TAG= - d_mpi_status.MPI_SOURCE= - d_mpi_status.MPI_ERROR= -1; + d_mpi_status.MPI_TAG = + d_mpi_status.MPI_SOURCE = + d_mpi_status.MPI_ERROR = -1; } //@{ @@ -480,12 +560,16 @@ class AsyncCommGroup:public AsyncCommStage::Member /*! * @brief Convert the array index to the position. + * + * @pre (index >= 0) && (index < getGroupSize()) */ int toPosition( int index) const; /*! * @brief Convert the position to the array index. + * + * @pre (position >= 0) && (position < getGroupSize()) */ int toIndex( @@ -497,6 +581,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * * @param parent_pos Position of the parent in the group. * @param ic Index of the child. (Zero coresponds to the first child.) + * + * @pre (parent_pos >= 0) && (parent_pos < getGroupSize()) */ int toChildPosition( @@ -508,6 +594,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * of a given position (whether or not that child really exists). * * Same as toChildPosition( parent_pos, 0 ); + * + * @pre (parent_pos >= 0) && (parent_pos < getGroupSize()) */ int toOldest( @@ -517,6 +605,8 @@ class AsyncCommGroup:public AsyncCommStage::Member * of a given position (whether or not that child really exists). * * Same as toChildPosition( parent_pos, d_nchild-1 ); + * + * @pre (parent_pos >= 0) && (parent_pos < getGroupSize()) */ int toYoungest( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.C index 5a5447f8..c149c4ee 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Staged peer-to-peer communication. * ************************************************************************/ @@ -57,7 +57,6 @@ AsyncCommPeer::s_initialize_finalize_handler( /* *********************************************************************** - * FIXME: d_mpi should be initialized with commNull or SAMRAI's comm base. *********************************************************************** */ template @@ -68,9 +67,9 @@ AsyncCommPeer::AsyncCommPeer(): d_next_task_op(none), d_max_first_data_len(1), d_full_count(0), - d_external_buf(NULL), + d_external_buf(0), d_internal_buf_size(0), - d_internal_buf(), + d_internal_buf(0), d_mpi(SAMRAI_MPI::getSAMRAIWorld()), d_tag0(-1), d_tag1(-1), @@ -79,7 +78,7 @@ AsyncCommPeer::AsyncCommPeer(): t_wait_timer(t_default_wait_timer) { d_report_send_completion[0] = d_report_send_completion[1] = false; - if ( ! t_default_wait_timer ) { + if (!t_default_wait_timer) { /* * This should not be needed, but somehow initializeCallback() * may not have called yet. @@ -96,7 +95,6 @@ AsyncCommPeer::AsyncCommPeer(): * Construct a simple object that works with a communication stage. * All parameters are set to reasonable defaults or, if appropriate, * invalid values. - * FIXME: d_mpi should be initialized with commNull or SAMRAI's comm base. *********************************************************************** */ template @@ -109,9 +107,9 @@ AsyncCommPeer::AsyncCommPeer( d_next_task_op(none), d_max_first_data_len(1), d_full_count(0), - d_external_buf(NULL), + d_external_buf(0), d_internal_buf_size(0), - d_internal_buf(), + d_internal_buf(0), d_mpi(SAMRAI_MPI::getSAMRAIWorld()), d_tag0(-1), d_tag1(-1), @@ -120,7 +118,7 @@ AsyncCommPeer::AsyncCommPeer( t_wait_timer(t_default_wait_timer) { d_report_send_completion[0] = d_report_send_completion[1] = false; - if ( ! t_default_wait_timer ) { + if (!t_default_wait_timer) { /* * This should not be needed, but somehow initializeCallback() * may not have called yet. @@ -141,13 +139,14 @@ AsyncCommPeer::~AsyncCommPeer() { if (!isDone()) { TBOX_ERROR("Deallocating an AsyncCommPeer object while communication\n" - << "is pending leads to lost messages." + << "is pending leads to lost messages.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0 << ", " << d_tag1); + << ", mpi_tag = " << d_tag0 << ", " << d_tag1); } if (d_internal_buf) { free(d_internal_buf); + d_internal_buf = 0; } } @@ -190,12 +189,12 @@ AsyncCommPeer::proceedToNextWait() case undefined: TBOX_ERROR("There is no current operation to check.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0 << ", " << d_tag1); + << ", mpi_tag = " << d_tag0 << ", " << d_tag1); default: TBOX_ERROR("Library error: attempt to use an operation that\n" - << "has not been written yet" + << "has not been written yet.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0 << ", " << d_tag1); + << ", mpi_tag = " << d_tag0 << ", " << d_tag1); } return true; } @@ -219,7 +218,7 @@ AsyncCommPeer::completeCurrentOperation() while (!isDone()) { t_wait_timer->start(); - int errf = d_mpi.Waitall(2, + int errf = SAMRAI_MPI::Waitall(2, req, mpi_status); t_wait_timer->stop(); @@ -227,7 +226,7 @@ AsyncCommPeer::completeCurrentOperation() if (errf != MPI_SUCCESS) { TBOX_ERROR("Error in MPI_wait call.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } proceedToNextWait(); @@ -245,12 +244,13 @@ template bool AsyncCommPeer::beginSend( const TYPE* buffer, - int size) + int size, + bool automatic_push_to_completion_queue) { - if (d_next_task_op != none) { - TBOX_ERROR("Cannot begin communication while another is in progress." + if (getNextTaskOp() != none) { + TBOX_ERROR("Cannot begin communication while another is in progress.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } #ifdef DEBUG_CHECK_ASSERTIONS checkMPIParams(); @@ -259,8 +259,8 @@ AsyncCommPeer::beginSend( d_full_count = size; d_base_op = send; d_next_task_op = send_start; - bool status = checkSend(); - d_external_buf = NULL; + bool status = checkSend(automatic_push_to_completion_queue); + d_external_buf = 0; return status; } @@ -270,11 +270,14 @@ void AsyncCommPeer::resizeBuffer( size_t size) { + TBOX_ASSERT(!hasPendingRequests()); + if (d_internal_buf_size < size) { if (d_internal_buf) { d_internal_buf = (FlexData *)realloc(d_internal_buf, size * sizeof(FlexData)); #ifdef DEBUG_INITIALIZE_UNDEFINED - memset(d_internal_buf + d_internal_buf_size, 0, (size - d_internal_buf_size) * sizeof(FlexData)); + memset(d_internal_buf + d_internal_buf_size, 0, + (size - d_internal_buf_size) * sizeof(FlexData)); #endif } else { #ifdef DEBUG_INITIALIZE_UNDEFINED @@ -300,12 +303,13 @@ AsyncCommPeer::resizeBuffer( */ template bool -AsyncCommPeer::checkSend() +AsyncCommPeer::checkSend( + bool automatic_push_to_completion_queue) { - if (d_base_op != send) { - TBOX_ERROR("Cannot check nonexistent send operation." - << " mpi_communicator = " << d_mpi.getCommunicator() - << " mpi_tag = " << d_tag0 << ", " << d_tag1); + if (getBaseOp() != send) { + TBOX_ERROR("Cannot check nonexistent send operation.\n" + << "mpi_communicator = " << d_mpi.getCommunicator() + << ", mpi_tag = " << d_tag0 << ", " << d_tag1); } SAMRAI_MPI::Request * const req = getRequestPointer(); int flag = 0; @@ -346,9 +350,9 @@ AsyncCommPeer::checkSend() &req[0]); t_send_timer->stop(); if (d_mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error in MPI_Isend." + TBOX_ERROR("Error in MPI_Isend.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } #ifdef AsyncCommPeer_DEBUG_OUTPUT d_report_send_completion[0] = true; @@ -398,9 +402,9 @@ AsyncCommPeer::checkSend() &req[0]); t_send_timer->stop(); if (d_mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error in MPI_Isend." + TBOX_ERROR("Error in MPI_Isend.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } // Stuff and send second message. @@ -448,7 +452,7 @@ AsyncCommPeer::checkSend() << "MPI_ERROR value is " << mpi_status[ic].MPI_ERROR << '\n' << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } } if (req[ic] == MPI_REQUEST_NULL && d_report_send_completion[ic]) { @@ -468,16 +472,20 @@ AsyncCommPeer::checkSend() } else { // Sends completed. No next task. d_next_task_op = none; - d_external_buf = NULL; + d_external_buf = 0; d_full_count = 0; } break; default: - TBOX_ERROR("checkSend is incompatible with current state." + TBOX_ERROR("checkSend is incompatible with current state.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); + } + + if (automatic_push_to_completion_queue && d_next_task_op == none) { + pushToCompletionQueue(); } return d_next_task_op == none; @@ -491,12 +499,13 @@ AsyncCommPeer::checkSend() */ template bool -AsyncCommPeer::beginRecv() +AsyncCommPeer::beginRecv( + bool automatic_push_to_completion_queue) { - if (d_next_task_op != none) { - TBOX_ERROR("Cannot begin communication while another is in progress." + if (getNextTaskOp() != none) { + TBOX_ERROR("Cannot begin communication while another is in progress.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } #ifdef DEBUG_CHECK_ASSERTIONS checkMPIParams(); @@ -504,7 +513,7 @@ AsyncCommPeer::beginRecv() d_full_count = 0; d_base_op = recv; d_next_task_op = recv_start; - return checkRecv(); + return checkRecv(automatic_push_to_completion_queue); } /* @@ -520,12 +529,13 @@ AsyncCommPeer::beginRecv() */ template bool -AsyncCommPeer::checkRecv() +AsyncCommPeer::checkRecv( + bool automatic_push_to_completion_queue) { - if (d_base_op != recv) { - TBOX_ERROR("Cannot check nonexistent receive operation." - << " mpi_communicator = " << d_mpi.getCommunicator() - << " mpi_tag = " << d_tag0 << ", " << d_tag1); + if (getBaseOp() != recv) { + TBOX_ERROR("Cannot check nonexistent receive operation.\n" + << "mpi_communicator = " << d_mpi.getCommunicator() + << ", mpi_tag = " << d_tag0 << ", " << d_tag1); } SAMRAI_MPI::Request * const req = getRequestPointer(); SAMRAI_MPI::Status * const mpi_status = getStatusPointer(); @@ -546,8 +556,8 @@ AsyncCommPeer::checkRecv() d_max_first_data_len); resizeBuffer(first_chunk_count + 2); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(req[0] == MPI_REQUEST_NULL); +#ifdef DEBUG_CHECK_ASSERTIONS req[0] = MPI_REQUEST_NULL; #endif t_recv_timer->start(); @@ -560,9 +570,9 @@ AsyncCommPeer::checkRecv() &req[0]); t_recv_timer->stop(); if (d_mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error in MPI_Irecv." + TBOX_ERROR("Error in MPI_Irecv.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } #ifdef AsyncCommPeer_DEBUG_OUTPUT plog << "tag0-" << d_tag0 @@ -589,7 +599,7 @@ AsyncCommPeer::checkRecv() << "MPI_ERROR value is " << mpi_status[0].MPI_ERROR << '\n' << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } } @@ -602,7 +612,7 @@ AsyncCommPeer::checkRecv() int icount = -1; d_mpi_err = SAMRAI_MPI::Get_count(&mpi_status[0], MPI_BYTE, &icount); if (d_mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error in MPI_Get_count." + TBOX_ERROR("Error in MPI_Get_count.\n" << "error flag = " << d_mpi_err); } const size_t count = icount / sizeof(FlexData); // Convert byte count to item count. @@ -612,12 +622,12 @@ AsyncCommPeer::checkRecv() << " received " << count << " FlexData as " << icount << " bytes from " << d_peer_rank << " in checkRecv" << std::endl; +#endif #endif TBOX_ASSERT(count <= d_max_first_data_len + 2); TBOX_ASSERT(mpi_status[0].MPI_TAG == d_tag0); TBOX_ASSERT(mpi_status[0].MPI_SOURCE == d_peer_rank); TBOX_ASSERT(req[0] == MPI_REQUEST_NULL); -#endif // Get full count embedded in message. d_full_count = d_internal_buf[count - 1].i; @@ -636,7 +646,6 @@ AsyncCommPeer::checkRecv() const size_t second_chunk_count = getNumberOfFlexData( d_full_count - d_max_first_data_len); - // SGS this is bad coding.` resizeBuffer(d_internal_buf_size + second_chunk_count); TBOX_ASSERT(req[1] == MPI_REQUEST_NULL); @@ -651,9 +660,9 @@ AsyncCommPeer::checkRecv() &req[1]); t_recv_timer->stop(); if (d_mpi_err != MPI_SUCCESS) { - TBOX_ERROR("Error in MPI_Irecv." + TBOX_ERROR("Error in MPI_Irecv.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); } #ifdef AsyncCommPeer_DEBUG_OUTPUT plog << "tag1-" << d_tag1 @@ -686,7 +695,7 @@ AsyncCommPeer::checkRecv() << "MPI_ERROR value is " << mpi_status[1].MPI_ERROR << '\n' << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag1); + << ", mpi_tag = " << d_tag1); } if (flag == 1) { // Second message received. @@ -759,9 +768,13 @@ AsyncCommPeer::checkRecv() break; default: - TBOX_ERROR("checkRecv is incompatible with current state." + TBOX_ERROR("checkRecv is incompatible with current state.\n" << "mpi_communicator = " << d_mpi.getCommunicator() - << "mpi_tag = " << d_tag0); + << ", mpi_tag = " << d_tag0); + } + + if (automatic_push_to_completion_queue && d_next_task_op == none) { + pushToCompletionQueue(); } return d_next_task_op == none; @@ -775,20 +788,20 @@ template void AsyncCommPeer::checkMPIParams() { - if (d_tag0 < 0 || d_tag1 < 0) { + if (getPrimaryTag() < 0 || getSecondaryTag() < 0) { TBOX_ERROR("AsyncCommPeer: Invalid MPI tag values " << d_tag0 << " and " << d_tag1 << "\nUse setMPITag() to set it."); } - if (d_mpi.getCommunicator() == SAMRAI_MPI::commNull) { + if (getMPI().getCommunicator() == MPI_COMM_NULL) { TBOX_ERROR("AsyncCommPeer: Invalid MPI communicator value " << d_mpi.getCommunicator() << "\nUse setCommunicator() to set it."); } - if (d_peer_rank < 0) { + if (getPeerRank() < 0) { TBOX_ERROR("AsyncCommPeer: Invalid peer rank " << d_peer_rank << "\nUse setPeerRank() to set it."); } - if (d_peer_rank == d_mpi.getRank() && !SAMRAI_MPI::usingMPI()) { + if (getPeerRank() == getMPI().getRank() && !SAMRAI_MPI::usingMPI()) { TBOX_ERROR("AsyncCommPeer: Peer rank cannot be the local rank\n" << "when running without MPI."); } @@ -889,7 +902,7 @@ template int AsyncCommPeer::getRecvSize() const { - if (d_base_op != recv) { + if (getBaseOp() != recv) { TBOX_ERROR("AsyncCommPeer::getRecvSize() called without a\n" << "corresponding receive."); } @@ -901,13 +914,16 @@ AsyncCommPeer::getRecvSize() const *********************************************************************** */ template -const TYPE* +const TYPE * AsyncCommPeer::getRecvData() const { - if (d_base_op != recv) { + if (getBaseOp() != recv) { TBOX_ERROR("AsyncCommPeer::getRecvData() called without a\n" << "corresponding receive."); } + if (!d_internal_buf) { + TBOX_ERROR("AsyncCommPeer::getRecvData() after clearRecvData().\n"); + } return &d_internal_buf[0].t; } @@ -919,15 +935,16 @@ template void AsyncCommPeer::clearRecvData() { - if (d_next_task_op != none) { + if (getNextTaskOp() != none) { TBOX_ERROR("AsyncCommPeer::clearRecvData() called during an\n" << "operation."); } - // d_internal_buf.clear(); + if (d_internal_buf) { + free(d_internal_buf); + d_internal_buf = 0; + } } - - /* *********************************************************************** *********************************************************************** @@ -935,14 +952,11 @@ AsyncCommPeer::clearRecvData() template void AsyncCommPeer::setSendTimer( - const boost::shared_ptr &send_timer ) + const boost::shared_ptr& send_timer) { t_send_timer = send_timer ? send_timer : t_default_send_timer; - return; } - - /* *********************************************************************** *********************************************************************** @@ -950,14 +964,11 @@ AsyncCommPeer::setSendTimer( template void AsyncCommPeer::setRecvTimer( - const boost::shared_ptr &recv_timer ) + const boost::shared_ptr& recv_timer) { t_recv_timer = recv_timer ? recv_timer : t_default_recv_timer; - return; } - - /* *********************************************************************** *********************************************************************** @@ -965,14 +976,11 @@ AsyncCommPeer::setRecvTimer( template void AsyncCommPeer::setWaitTimer( - const boost::shared_ptr &wait_timer ) + const boost::shared_ptr& wait_timer) { t_wait_timer = wait_timer ? wait_timer : t_default_wait_timer; - return; } - - template bool AsyncCommPeer::isDone() const @@ -990,11 +998,11 @@ void AsyncCommPeer::initializeCallback() { t_default_send_timer = TimerManager::getManager()-> - getTimer("tbox::AsyncCommPeer::MPI_ISend"); + getTimer("tbox::AsyncCommPeer::MPI_Isend()"); t_default_recv_timer = TimerManager::getManager()-> - getTimer("tbox::AsyncCommPeer::MPI_Irecv"); + getTimer("tbox::AsyncCommPeer::MPI_Irecv()"); t_default_wait_timer = TimerManager::getManager()-> - getTimer("tbox::AsyncCommPeer::wait_all()"); + getTimer("tbox::AsyncCommPeer::MPI_Waitall()"); } /* diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.h index 5f55e5ea..35e781d6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommPeer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Staged peer-to-peer communication. * ************************************************************************/ @@ -59,6 +59,19 @@ template class AsyncCommPeer:public AsyncCommStage::Member { +private: + //! @brief Operations users would want to do. + enum BaseOp { undefined, + send, + recv }; + //! @brief Tasks used to complete a base operation. + enum TaskOp { send_start, + send_check, + recv_start, + recv_check0, + recv_check1, + none }; + public: /*! * @brief Default constructor does not set up anything. @@ -73,10 +86,12 @@ class AsyncCommPeer:public AsyncCommStage::Member */ explicit AsyncCommPeer( AsyncCommStage* stage, - AsyncCommStage::Handler* handler = NULL); + AsyncCommStage::Handler* handler = 0); /*! * @brief Destructor. + * + * @pre isDone() */ virtual ~AsyncCommPeer(); @@ -87,11 +102,13 @@ class AsyncCommPeer:public AsyncCommStage::Member * * @param stage The stage handling communicaiton requests for the object. * @param handler Optional pointer to user-defined data. + * + * @pre isDone() */ void initialize( AsyncCommStage* stage, - AsyncCommStage::Handler* handler = NULL); + AsyncCommStage::Handler* handler = 0); //@{ //! @name Define the peer relationship. @@ -103,11 +120,18 @@ class AsyncCommPeer:public AsyncCommStage::Member * a complementary call using this processor as its peer. * If this assumption is wrong, there will likely be * communication errors. + * + * @param peer_rank + * + * @pre isDone() */ void setPeerRank( int peer_rank); + /*! + * @brief Rank of peer process. + */ int getPeerRank() const { @@ -153,6 +177,11 @@ class AsyncCommPeer:public AsyncCommStage::Member * select the correct messages. Please specify appropriate values * for the MPI communicator and tag. Very elusive bugs can occur * if incorrect messages are received. + * + * @param primary_tag + * @param secondary_tag + * + * @pre isDone() */ void setMPITag( @@ -169,11 +198,60 @@ class AsyncCommPeer:public AsyncCommStage::Member * if incorrect messages are received. To be safe, it is best * to create a new communicator to avoid interference with other * communications within SAMRAI. + * + * @param mpi + * + * @pre isDone() */ void setMPI( const SAMRAI_MPI& mpi); + /*! + * @brief Gets the MPI object used for communications. + */ + const SAMRAI_MPI& + getMPI() const + { + return d_mpi; + } + + /*! + * @brief Next task in a current communication operation. + */ + TaskOp + getNextTaskOp() const + { + return d_next_task_op; + } + + /*! + * @brief Operation being performed. + */ + BaseOp + getBaseOp() const + { + return d_base_op; + } + + /*! + * @brief Primary tag for the first message. + */ + int + getPrimaryTag() const + { + return d_tag0; + } + + /*! + * @brief Secondary tag for the first message. + */ + int + getSecondaryTag() const + { + return d_tag1; + } + //@{ /*! @@ -188,12 +266,22 @@ class AsyncCommPeer:public AsyncCommStage::Member * On return, the data in @b buffer would have been copied so it is * safe to deallocate or modify @c buffer. * + * @param buffer + * @param size + * + * @param automatic_push_to_completion_queue Whether to automatically + * push this member onto the completion queue of its stage (where you + * can retrieve it using the stage's popFromCompletionQueue() method. + * * @return Whether operation is completed. + * + * @pre getNextTaskOp() == none */ bool beginSend( const TYPE* buffer, - int size); + int size, + bool automatic_push_to_completion_queue = false); /*! * @brief Check the current broadcast communication and complete @@ -201,10 +289,15 @@ class AsyncCommPeer:public AsyncCommStage::Member * * If no communication is in progress, this call does nothing. * + * @param automatic_push_to_completion_queue See beginSend(). + * * @return Whether operation is completed. + * + * @pre getBaseOp() == send */ bool - checkSend(); + checkSend( + bool automatic_push_to_completion_queue = false); /*! * @brief Begin a receive communication. @@ -220,6 +313,8 @@ class AsyncCommPeer:public AsyncCommStage::Member * The actual length of data received by the last receive operation * is returned by getRecvSize(). * + * @param automatic_push_to_completion_queue See beginSend(). + * * @return Whether operation is completed. * * @internal Once everthing is working, we should implement a @@ -227,27 +322,39 @@ class AsyncCommPeer:public AsyncCommStage::Member * need to copy from the internal to an external buffer. But it * requires some thought about size checking, especially with * regards to how to use the limit on the first message size. + * + * @pre getNextTaskOp() == none */ bool - beginRecv(); + beginRecv( + bool automatic_push_to_completion_queue = false); /*! * @brief Check the current receive communication and complete the * receive if the MPI request has been fulfilled. * * @return Whether operation is completed. + * + * @param automatic_push_to_completion_queue See beginSend(). + * + * @pre getBaseOp() == recv */ bool - checkRecv(); + checkRecv( + bool automatic_push_to_completion_queue = false); /*! * @brief Return the size of received data. + * + * @pre getBaseOp() == recv */ int getRecvSize() const; /*! * @brief Get access to the received data. + * + * @pre getBaseOp() == recv */ const TYPE * getRecvData() const; @@ -261,6 +368,8 @@ class AsyncCommPeer:public AsyncCommStage::Member * * It is an error to clear the receive buffer in the middle of a * communication operation. + * + * @pre getNextTaksOp() == none */ void clearRecvData(); @@ -290,8 +399,21 @@ class AsyncCommPeer:public AsyncCommStage::Member void completeCurrentOperation(); - //@} + /*! + * @brief Whether the current (or last) operation was a send. + */ + bool isSender() { + return d_base_op == send; + } + + /*! + * @brief Whether the current (or last) operation was a receive. + */ + bool isReceiver() { + return d_base_op == recv; + } + //@} //@{ //! @name Timers for MPI calls @@ -301,31 +423,33 @@ class AsyncCommPeer:public AsyncCommStage::Member * * Set the timer for non-blocking sends. * If the timer is null, revert to the default timer named - * ""tbox::AsyncCommPeer::MPI_ISend". + * "tbox::AsyncCommPeer::MPI_Isend()". * * @param [in] send_timer */ - void setSendTimer( - const boost::shared_ptr &send_timer ); + void + setSendTimer( + const boost::shared_ptr& send_timer); /*! * @brief Set the receive-timer. * * Set the timer for non-blocking receives. * If the timer is null, revert to the default timer named - * ""tbox::AsyncCommPeer::MPI_IRecv". + * "tbox::AsyncCommPeer::MPI_Irecv()". * * @param [in] recv_timer */ - void setRecvTimer( - const boost::shared_ptr &recv_timer ); + void + setRecvTimer( + const boost::shared_ptr& recv_timer); /*! * @brief Set the wait-timer. * * Set the timer for blocking waits. * If the timer is null, revert to the default timer named - * ""tbox::AsyncCommPeer::wait_all()". + * "tbox::AsyncCommPeer::MPI_Waitall()". * * This timer is used when in this class and is not the same * as the timer given to AsyncCommStage (unless the user sets @@ -333,8 +457,9 @@ class AsyncCommPeer:public AsyncCommStage::Member * * @param [in] wait_timer */ - void setWaitTimer( - const boost::shared_ptr &wait_timer ); + void + setWaitTimer( + const boost::shared_ptr& wait_timer); //@} @@ -358,6 +483,11 @@ class AsyncCommPeer:public AsyncCommStage::Member /* * @brief Assert that user-set MPI parameters are valid. + * + * @pre getPrimaryTag() >= 0 && getSecondaryTag() >= 0 + * @pre getMPI().getCommunicator() != MPI_COMM_NULL + * @pre getPeerRank() >= 0 + * @pre getPeerRank() != getMPI().getRank() || SAMRAI_MPI::usingMPI() */ void checkMPIParams(); @@ -383,18 +513,6 @@ class AsyncCommPeer:public AsyncCommStage::Member operator = ( const AsyncCommPeer& r); - //! @brief Operations users would want to do. - enum BaseOp { undefined, - send, - recv }; - //! @brief Tasks used to complete a base operation. - enum TaskOp { send_start, - send_check, - recv_start, - recv_check0, - recv_check1, - none }; - void resetStatus( SAMRAI_MPI::Status& mpi_status) @@ -519,7 +637,7 @@ class AsyncCommPeer:public AsyncCommStage::Member static boost::shared_ptr t_default_recv_timer; static boost::shared_ptr t_default_wait_timer; - static tbox::StartupShutdownManager::Handler + static StartupShutdownManager::Handler s_initialize_finalize_handler; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.C index 355379de..f3016947 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Support for coordinating multiple asynchronous communications * ************************************************************************/ @@ -53,7 +53,7 @@ AsyncCommStage::AsyncCommStage(): AsyncCommStage::~AsyncCommStage() { for (size_t i = 0; i < d_members.size(); ++i) { - if (d_members[i] != NULL) { + if (d_members[i] != 0) { /* * Found an undeallocated Member. Make sure it does not * have oustanding requests and deallocate it. @@ -63,9 +63,9 @@ AsyncCommStage::~AsyncCommStage() << "have pending communication leads to\n" << "abandoned MPI messages. Member number " << i << "\n" - << "is not yet done."); + << "is not yet done." << std::endl); } - d_members[i] = NULL; + d_members[i] = 0; } } } @@ -82,8 +82,8 @@ AsyncCommStage::privateStageMember( Member* member, size_t nreq) { + TBOX_ASSERT(!member->hasStage()); // Double stage not allowed. #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(member->d_stage == NULL); // Double stage not allowed. if (nreq < 1) { TBOX_ERROR("Each Member on a stage must have at least one request.\n"); } @@ -102,7 +102,6 @@ AsyncCommStage::privateStageMember( d_members.push_back(member); ++d_member_count; - const size_t cur_total_request_count = d_member_to_req[d_members.size() - 1]; const size_t new_total_request_count = cur_total_request_count + nreq; d_member_to_req.push_back(new_total_request_count); @@ -145,17 +144,17 @@ AsyncCommStage::privateDestageMember( assertDataConsistency(); #endif - if (d_members[member->d_index_on_stage] != member) { + if (getMember(member->d_index_on_stage) != member) { /* * Member was not staged with this AsyncCommStage. Since staging * and destaging are private methods, there must be some logic * bug in the library. */ TBOX_ERROR("Library error: An AsyncCommStage cannot destage a Member\n" - << "that was not staged with it."); + << "that was not staged with it." << std::endl); } - d_members[member->d_index_on_stage] = NULL; + d_members[member->d_index_on_stage] = 0; --d_member_count; /* @@ -164,11 +163,11 @@ AsyncCommStage::privateDestageMember( * end.) */ size_t min_required_len = d_members.size(); - while (min_required_len > 0 && d_members[min_required_len - 1] == NULL) { + while (min_required_len > 0 && d_members[min_required_len - 1] == 0) { --min_required_len; } if (min_required_len != d_members.size()) { - d_members.resize(min_required_len, NULL); + d_members.resize(min_required_len, 0); d_member_to_req.resize(d_members.size() + 1, size_t(MathUtilities::getMax())); @@ -180,8 +179,8 @@ AsyncCommStage::privateDestageMember( member->d_nreq = member->d_index_on_stage = size_t( MathUtilities::getMax()); - member->d_stage = NULL; - member->d_handler = NULL; + member->d_stage = 0; + member->d_handler = 0; #ifdef DEBUG_CHECK_ASSERTIONS assertDataConsistency(); @@ -198,10 +197,10 @@ AsyncCommStage::assertDataConsistency() const if (d_members.size() + 1 != d_member_to_req.size()) { TBOX_ERROR("d_members.size()=" << d_members.size() << "+1 is not d_member_to_req.size()=" - << d_member_to_req.size()); + << d_member_to_req.size() << std::endl); } if (d_member_to_req[d_member_to_req.size() - 1] != d_req.size()) { - TBOX_ERROR("d_member_to_req's last entry is bad."); + TBOX_ERROR("d_member_to_req's last entry is bad." << std::endl); } if (d_members.empty()) { @@ -210,14 +209,15 @@ AsyncCommStage::assertDataConsistency() const for (size_t i = 0; i < d_members.size() - 1; ++i) { if (d_member_to_req[i] >= d_member_to_req[i + 1]) { - TBOX_ERROR("d_member_to_req out of order at i=" << i); + TBOX_ERROR("d_member_to_req out of order at i=" << i << std::endl); } - if (d_members[i] != NULL) { + if (d_members[i] != 0) { if (d_members[i]->d_nreq != d_member_to_req[i + 1] - d_member_to_req[i]) { TBOX_ERROR("d_members[" << i << "] has bad d_nreq=" << d_members[i]->d_nreq << ", stage value is " - << (d_member_to_req[i + 1] - d_member_to_req[i])); + << (d_member_to_req[i + 1] - d_member_to_req[i]) + << std::endl); } } } @@ -228,12 +228,13 @@ AsyncCommStage::assertDataConsistency() const if (d_req_to_member[i] == member_index) { ++number_of_requests; } else { - if (d_members[member_index] != NULL) { + if (d_members[member_index] != 0) { if (d_members[member_index]->d_nreq != number_of_requests) { TBOX_ERROR("d_members[" << member_index << "]->d_nreq is " << d_members[member_index]->d_nreq << " while stage claims it should have " - << number_of_requests << " requests"); + << number_of_requests << " requests" + << std::endl); } } member_index = d_req_to_member[i]; @@ -244,82 +245,77 @@ AsyncCommStage::assertDataConsistency() const TBOX_ERROR("d_members[" << member_index << "]->d_nreq is " << d_members[member_index]->d_nreq << " while stage claims it should have " - << number_of_requests << " requests"); + << number_of_requests << " requests" + << std::endl); } } - - /* *********************************************************************** *********************************************************************** */ void -AsyncCommStage::privatePushToCompletionQueue( Member &member ) +AsyncCommStage::privatePushToCompletionQueue(Member& member) { - TBOX_ASSERT( member.isDone() ); + TBOX_ASSERT(member.isDone()); /* * Push member onto d_completed_members, but be sure to avoid * duplicating. */ std::list::iterator li; - for ( li=d_completed_members.begin(); - li!=d_completed_members.end(); ++li ) { - if ( member.d_index_on_stage == *li ) break; + for (li = d_completed_members.begin(); + li != d_completed_members.end(); ++li) { + if (member.d_index_on_stage == *li) break; } - if ( li == d_completed_members.end() ) { + if (li == d_completed_members.end()) { d_completed_members.push_back(member.d_index_on_stage); } - return; } - - /* *********************************************************************** *********************************************************************** */ void -AsyncCommStage::privateYankFromCompletionQueue( Member &member ) +AsyncCommStage::privateYankFromCompletionQueue(Member& member) { /* * Remove member from d_completed_members. */ std::list::iterator li; - for ( li=d_completed_members.begin(); - li!=d_completed_members.end(); ++li ) { - if ( member.d_index_on_stage == *li ) { + for (li = d_completed_members.begin(); + li != d_completed_members.end(); ++li) { + if (member.d_index_on_stage == *li) { d_completed_members.erase(li); break; } } - return; } /* *********************************************************************** *********************************************************************** */ -AsyncCommStage::Member* +AsyncCommStage::Member * AsyncCommStage::popCompletionQueue() { - if ( d_completed_members.empty() ) { + if (!hasCompletedMembers()) { TBOX_ERROR("AsyncCommStage::popCompletionQueue(): There is no\n" - << "completed member. You cannot call this method\n" - << "when numberOfCompletedMembers() > 0."); + << "completed member. You cannot call this method\n" + << "when hasCompletedMembers()." << std::endl); } - Member *completed = d_members[d_completed_members.front()]; - if ( ! completed->isDone() ) { + if (!firstCompletedMember()->isDone()) { TBOX_ERROR("AsyncCommStage::popCompletionQueue error:\n" - << "You asked for a completed AsyncCommStage Member\n" - << "but its stage has changed to pending since the\n" - << "stage last identified it as being completed.\n" - << "This is likely caused by some code re-using the\n" - << "Member for another operation before poping it\n" - << "using this method."); - } + << "You asked for a completed AsyncCommStage Member\n" + << "but its stage has changed to pending since the\n" + << "stage last identified it as being completed.\n" + << "This is likely caused by some code re-using the\n" + << "Member for another operation before poping it\n" + << "using this method." << std::endl); + } + Member* completed = d_members[d_completed_members.front()]; d_completed_members.pop_front(); return completed; } @@ -330,13 +326,13 @@ AsyncCommStage::popCompletionQueue() * repeatedly until all outstanding communications are complete. ****************************************************************** */ -size_t +bool AsyncCommStage::advanceAll() { while (hasPendingRequests()) { advanceSome(); } - return d_completed_members.size(); + return !d_completed_members.empty(); } /* @@ -350,16 +346,16 @@ AsyncCommStage::advanceAll() * finished. If no Member has finished, repeat until at least one has. ****************************************************************** */ -size_t +bool AsyncCommStage::advanceSome() { if (!SAMRAI_MPI::usingMPI()) { - return 0; + return false; } if (d_members.empty()) { // Short cut for an empty stage. - return 0; + return false; } #ifdef DEBUG_CHECK_ASSERTIONS @@ -367,12 +363,12 @@ AsyncCommStage::advanceSome() i < d_req.size(); ++i) { if (d_req[i] != MPI_REQUEST_NULL) - TBOX_WARNING("non-null request above d_n_req."); + TBOX_WARNING("non-null request above d_n_req." << std::endl); } #endif - Array index(static_cast(d_member_to_req[d_members.size()])); - Array stat( + std::vector index(static_cast(d_member_to_req[d_members.size()])); + std::vector stat( static_cast(d_member_to_req[d_members.size()])); size_t n_member_completed = 0; @@ -386,8 +382,8 @@ AsyncCommStage::advanceSome() static_cast(d_member_to_req[d_members.size()]), &d_req[0], &n_req_completed, - index.getPointer(), - stat.getPointer()); + &index[0], + &stat[0]); if (d_communication_timer) d_communication_timer->stop(); #ifdef DEBUG_CHECK_ASSERTIONS if (n_req_completed <= 0) { @@ -415,7 +411,7 @@ AsyncCommStage::advanceSome() i < d_req.size(); ++i) { if (d_req[i] != MPI_REQUEST_NULL) - TBOX_WARNING("non-null request above d_n_reg."); + TBOX_WARNING("non-null request above d_n_reg." << std::endl); } } if (n_req_completed == 0) { @@ -487,7 +483,7 @@ AsyncCommStage::advanceSome() } while (n_req_completed > 0 && n_member_completed == 0); - return d_completed_members.size(); + return !d_completed_members.empty(); } /* @@ -501,11 +497,11 @@ AsyncCommStage::advanceSome() * has completed its communication operation. **************************************************************** */ -size_t +bool AsyncCommStage::advanceAny() { if (!SAMRAI_MPI::usingMPI()) { - return 0; + return false; } #ifdef DEBUG_CHECK_ASSERTIONS @@ -513,7 +509,7 @@ AsyncCommStage::advanceAny() i < d_req.size(); ++i) { if (d_req[i] != MPI_REQUEST_NULL) - TBOX_WARNING("non-null request above d_n_reg."); + TBOX_WARNING("non-null request above d_n_reg." << std::endl); } #endif @@ -553,7 +549,7 @@ AsyncCommStage::advanceAny() TBOX_ASSERT(member_index_on_stage >= 0 && member_index_on_stage < static_cast(d_members.size())); - TBOX_ASSERT(d_members[member_index_on_stage] != NULL); + TBOX_ASSERT(d_members[member_index_on_stage] != 0); Member* member = d_members[member_index_on_stage]; /* @@ -587,12 +583,11 @@ AsyncCommStage::advanceAny() } while (member_done == false); - - if ( member_index_on_stage >= 0 ) { + if (member_index_on_stage >= 0) { privatePushToCompletionQueue(*d_members[member_index_on_stage]); } - return d_completed_members.size(); + return !d_completed_members.empty(); } /* @@ -603,8 +598,8 @@ size_t AsyncCommStage::numberOfRequests( size_t index_on_stage) const { - TBOX_ASSERT(index_on_stage < d_members.size()); - TBOX_ASSERT(d_members[index_on_stage] != NULL); + TBOX_ASSERT(index_on_stage < numManagedMembers()); + TBOX_ASSERT(getMember(index_on_stage) != 0); const int init_req = static_cast(d_member_to_req[index_on_stage]); const int term_req = static_cast(d_member_to_req[index_on_stage + 1]); @@ -653,7 +648,7 @@ AsyncCommStage::numberOfPendingMembers() const { size_t nmember = 0; for (size_t imember = 0; imember < d_members.size(); ++imember) { - if (d_members[imember] != NULL && + if (d_members[imember] != 0 && d_members[imember]->hasPendingRequests()) { ++nmember; } @@ -667,12 +662,12 @@ AsyncCommStage::numberOfPendingMembers() const * allocated by this object. **************************************************************** */ -SAMRAI_MPI::Request* +SAMRAI_MPI::Request * AsyncCommStage::lookupRequestPointer( const size_t imember) const { - TBOX_ASSERT(imember < d_members.size()); - TBOX_ASSERT(d_members[imember] != NULL); + TBOX_ASSERT(imember < numManagedMembers()); + TBOX_ASSERT(getMember(imember) != 0); return &d_req[d_member_to_req[imember]]; } @@ -682,12 +677,12 @@ AsyncCommStage::lookupRequestPointer( * allocated by this object. **************************************************************** */ -SAMRAI_MPI::Status* +SAMRAI_MPI::Status * AsyncCommStage::lookupStatusPointer( const size_t imember) const { - TBOX_ASSERT(imember < d_members.size()); - TBOX_ASSERT(d_members[imember] != NULL); + TBOX_ASSERT(imember < numManagedMembers()); + TBOX_ASSERT(getMember(imember) != 0); return &d_stat[d_member_to_req[imember]]; } @@ -705,7 +700,7 @@ AsyncCommStage::Member::Member( const size_t nreq, AsyncCommStage* stage, AsyncCommStage::Handler* handler): - d_stage(NULL), + d_stage(0), d_nreq(size_t(MathUtilities::getMax())), d_index_on_stage(size_t(MathUtilities::getMax())), d_handler(handler) @@ -718,10 +713,10 @@ AsyncCommStage::Member::Member( *********************************************************************** */ AsyncCommStage::Member::Member(): - d_stage(NULL), + d_stage(0), d_nreq(size_t(MathUtilities::getMax())), d_index_on_stage(size_t(MathUtilities::getMax())), - d_handler(NULL) + d_handler(0) { } @@ -735,10 +730,10 @@ AsyncCommStage::Member::~Member() TBOX_ERROR("Cannot deallocate a Member with pending communications.\n" << "It would corrupt message passing algorithms.\n"); } - if (d_stage != NULL) { + if (d_stage != 0) { d_stage->privateDestageMember(this); } - d_handler = NULL; + d_handler = 0; } /* @@ -750,11 +745,11 @@ AsyncCommStage::Member::attachStage( const size_t nreq, AsyncCommStage* stage) { - if (d_stage != NULL) { + if (d_stage != 0) { // Deregister from current stage. d_stage->privateDestageMember(this); } - if (stage != NULL) { + if (stage != 0) { // Register with new stage, if any. stage->privateStageMember(this, nreq); } @@ -767,12 +762,12 @@ AsyncCommStage::Member::attachStage( void AsyncCommStage::Member::detachStage() { - if (d_stage != NULL) { + if (d_stage != 0) { // Deregister from current stage. d_stage->privateDestageMember(this); } d_nreq = 0; - d_stage = NULL; + d_stage = 0; } /* @@ -782,7 +777,7 @@ AsyncCommStage::Member::detachStage() bool AsyncCommStage::Member::hasPendingRequests() const { - if (d_stage == NULL) { + if (d_stage == 0) { return false; } else { SAMRAI_MPI::Request* req = getRequestPointer(); @@ -801,7 +796,7 @@ size_t AsyncCommStage::Member::numberOfPendingRequests() const { size_t npending = 0; - if (d_stage != NULL) { + if (d_stage != 0) { SAMRAI_MPI::Request* req = getRequestPointer(); for (size_t i = 0; i < d_nreq; ++i) { if (req[i] != MPI_REQUEST_NULL) ++npending; @@ -814,17 +809,15 @@ AsyncCommStage::Member::numberOfPendingRequests() const *********************************************************************** *********************************************************************** */ -SAMRAI_MPI::Request* +SAMRAI_MPI::Request * AsyncCommStage::Member::getRequestPointer() const { - if (d_stage == NULL) { + if (!hasStage()) { TBOX_ERROR("AssyncCommStage::Member::getRequestPointer():\n" << "Empty stage encountered!\n" - << "This probably means that the stage that allocated\n" - << "your AsyncCommGroup has been deallocated.\n" - << "(and your AssyncCommGroup deallocated too!).\n" - << "It is an error to deallocate a stage and still\n" - << "use the Member it allocated.\n"); + << "This probably means the stage Member has not been placed on a stage.\n" + << "See documentation for the Membmber's concrete implementation for how\n" + << "to place the Member on the stage."); } return d_stage->lookupRequestPointer(d_index_on_stage); @@ -834,17 +827,15 @@ AsyncCommStage::Member::getRequestPointer() const *********************************************************************** *********************************************************************** */ -SAMRAI_MPI::Status* +SAMRAI_MPI::Status * AsyncCommStage::Member::getStatusPointer() const { - if (d_stage == NULL) { + if (!hasStage()) { TBOX_ERROR("AssyncCommStage::Member::getStatusPointer():\n" << "Empty stage encountered!\n" - << "This probably means that the stage that allocated\n" - << "your AsyncCommGroup has been deallocated.\n" - << "(and your AssyncCommGroup deallocated too!).\n" - << "It is an error to deallocate a stage and still\n" - << "use the Member it allocated.\n"); + << "This probably means the stage Member has not been placed on a stage.\n" + << "See documentation for the Membmber's concrete implementation for how\n" + << "to place the Member on the stage."); } return d_stage->lookupStatusPointer(d_index_on_stage); @@ -857,13 +848,13 @@ AsyncCommStage::Member::getStatusPointer() const void AsyncCommStage::Member::pushToCompletionQueue() { - if ( ! isDone() ) { + if (!isDone()) { TBOX_ERROR("AsyncCommStage::Member::pushToCompletionQueue error:\n" - << "This method may not be called by Members that have not\n" - << "completed their operation (and returns true from isDon()."); + << "This method may not be called by Members that have not\n" + << "completed their operation (and returns true from isDone()." + << std::endl); } d_stage->privatePushToCompletionQueue(*this); - return; } /* diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.h index f23ab211..314f5e1b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/AsyncCommStage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Support for coordinating multiple asynchronous communications * ************************************************************************/ @@ -26,7 +26,7 @@ namespace tbox { /*! * @brief Stage multiple non-blocking MPI communications so that codes * waiting for them to complete can advance as their respective MPI - * requests are completed. + * communication operations are completed. * * An AsyncCommStage object manages multiple non-blocking MPI * communications carried out by AsyncCommStage::Member objects. @@ -62,8 +62,8 @@ namespace tbox { * To advance the communication operation of any of the allocated * Member objects, use advanceAny() or advanceSome(). In general, * advanceSome() has better performance than advanceAny() because it - * gets around the "starvation" problem. See the MPI documentation - * for a discussion of starvation. + * avoids the "starvation" problem. See the MPI documentation for a + * discussion of starvation. * * This class supports communication and uses MPI for message passing. * If MPI is disabled, the job of this class disappears and the class @@ -103,6 +103,7 @@ class AsyncCommStage * attachStage() to properly stage the Member. */ Member(); + /*! * @brief Initializing constructor. * @@ -113,10 +114,13 @@ class AsyncCommStage const size_t nreq, AsyncCommStage* stage, Handler* handler); + /*! * @brief Destructor detach the Member from its stage. * Memory allocated by the stage to support the Member * will be recycled. + * + * @pre !hasPendingRequests() */ virtual ~Member(); @@ -214,17 +218,20 @@ class AsyncCommStage } /*! - * @brief Push this onto the stage's list of completed Members. + * @brief Push this onto its stage's list of completed Members. * * This causes the member to be returned by a call to * AsyncCommStage::popCompletionQueue(), eventually. + * + * @pre isDone() */ void pushToCompletionQueue(); /*! * @brief Yank this member from the stage's list of completed - * Members. + * Members so it would not be returned by + * AsyncCommStage::popCompletionQueue(). */ void yankFromCompletionQueue() @@ -232,6 +239,15 @@ class AsyncCommStage d_stage->privateYankFromCompletionQueue(*this); } + /*! + * @brief Returns true if there is a stage associated with this member. + */ + bool + hasStage() const + { + return d_stage != 0; + } + protected: /*! * @brief Associate the member with a stage. @@ -239,9 +255,9 @@ class AsyncCommStage * Specify the stage to use and the number of SAMRAI_MPI::Request * objects needed from the stage. * - * @param nreq Number of SAMRAI_MPI::Requests needed by the member. + * @param[in] nreq Number of SAMRAI_MPI::Requests needed by the member. * - * @param stage Register with this AsyncCommStage. + * @param[in] stage The AsyncCommStage to attach to. */ void attachStage( @@ -267,6 +283,8 @@ class AsyncCommStage * @b Important: Do not save the pointer returned by this * method. The stage's dynamic memory actions may render old * pointers invalid. + * + * @pre hasStage() */ SAMRAI_MPI::Request * getRequestPointer() const; @@ -284,10 +302,19 @@ class AsyncCommStage * @b Important: Do not save the pointer returned by this * method. The stage's dynamic memory actions may render old * pointers invalid. + * + * @pre hasStage() */ SAMRAI_MPI::Status * getStatusPointer() const; + /*! + * @brief Return the number of requests for this stage Member. + */ + size_t getNumberOfRequests() const { + return d_nreq; + } + private: /*! * @brief Member is an integral part of the stage code and the @@ -295,6 +322,15 @@ class AsyncCommStage */ friend class AsyncCommStage; + // Unimplemented copy constructor. + Member( + const Member& other); + + // Unimplemented assignment operator. + Member& + operator = ( + const Member& rhs); + /*! * @brief The stage this Member belongs to. * @@ -353,9 +389,9 @@ class AsyncCommStage * another processor, it is better to use advanceSome(), which uses * MPI_Waitsome, which avoids starvation. * - * @return Number of completed Members in the completion queue. + * @return True if there are still completed Members in the completion queue. */ - size_t + bool advanceAny(); /*! @@ -364,9 +400,9 @@ class AsyncCommStage * * The completed Members are accessible through popCompletionQueue(). * - * @return Number of completed Members in the completion queue. + * @return True if there are still completed Members in the completion queue. */ - size_t + bool advanceSome(); /*! @@ -374,9 +410,9 @@ class AsyncCommStage * * The completed Members are accessible through popCompletionQueue(). * - * @return Number of completed Members in the completion queue. + * @return True if there are still completed Members in the completion queue. */ - size_t + bool advanceAll(); /* @@ -384,7 +420,8 @@ class AsyncCommStage * queue. * * Members that completed their communication operation through - * advanceAny(), advanceSome() or advanceAll() can be accessed + * advanceAny(), advanceSome() or advanceAll(), and members manually + * pushed onto the queue by pushToCompletionQueue(), can be accessed * through popCompletionQueue(). This method gives the size of * that queue. */ @@ -394,6 +431,43 @@ class AsyncCommStage return d_completed_members.size(); } + /* + * @brief Returns true if there are completed stage Members in the completion + * queue. + * + * Members that completed their communication operation through + * advanceAny(), advanceSome() or advanceAll() can be accessed + * through popCompletionQueue(). This method tells if there are + * any members in that queue. + */ + bool + hasCompletedMembers() const + { + return !d_completed_members.empty(); + } + + /*! + * @brief Returns the first completed Member. + */ + const Member * + firstCompletedMember() const + { + return d_members[d_completed_members.front()]; + } + + /*! + * @brief Returns the ith managed Member. + * + * @param i + * + * @pre i < numManagedMembers() + */ + const Member * + getMember(size_t i) const + { + return d_members[i]; + } + /* * @brief Return a Member that has fully completed its * communication operation. @@ -403,8 +477,11 @@ class AsyncCommStage * populated by advanceAny(), advanceSome() and advanceAll(). You * can also push Members onto the queue using the Member's * pushToCompletionQueue(). + * + * @pre hasCompletedMembers() + * @pre firstCompletedMember()->isDone() */ - Member* + Member * popCompletionQueue(); /*! @@ -443,6 +520,15 @@ class AsyncCommStage return d_member_count; } + /*! + * @brief Returns the number of staged and destaged Members. + */ + size_t + numManagedMembers() const + { + return d_members.size(); + } + /*! * @brief Return whether the stage has any pending communication * requests. @@ -471,7 +557,16 @@ class AsyncCommStage * public. This friendship is safe because Member is an integral * part of the stage code. */ - friend class Member; + friend struct Member; + + // Unimplemented copy constructor. + AsyncCommStage( + const AsyncCommStage& other); + + // Unimplemented assignment operator. + AsyncCommStage& + operator = ( + const AsyncCommStage& rhs); //@{ //! @name Private methods to be called only by Members of the stage. @@ -480,26 +575,37 @@ class AsyncCommStage * @brief Set up a Member to work this stage, initializing mutual * references between the stage and the member. * + * @param member Member to work this stage. * @param nreq Number of requests needed on the stage. * - * @param handle Optional pointer back to a Member object associated - * with the Member. See class documentation. + * @pre !member->hasStage() + * @pre nreq >= 1 */ void privateStageMember( - Member* Member, + Member* member, size_t nreq); /*! * @brief Remove a member from the stage, clearing mutual * references between the stage and the member. + * + * @param member Member removed from the stage. + * + * @pre !member->hasPendingRequests() + * @pre getMember(member->d_index_on_stage) == member */ void privateDestageMember( - Member* Member); + Member* member); /*! * @brief Get the number of requests for the given Member index. + * + * @param index_on_stage Member index. + * + * @pre index_on_stage < numManagedMembers() + * @pre getMember(index_on_stage) != 0 */ size_t numberOfRequests( @@ -526,6 +632,11 @@ class AsyncCommStage * * This is private because only friend class Member should * use it. + * + * @param index_on_stage Member index. + * + * @pre index_on_stage < numManagedMembers() + * @pre getMember(index_on_stage) != 0 */ SAMRAI_MPI::Request * lookupRequestPointer( @@ -534,6 +645,11 @@ class AsyncCommStage /*! * @brief Look up and return the status pointer from the stage * for the given Member. (Works similarly to lookupRequestPointer().) + * + * @param index_on_stage Member index. + * + * @pre index_on_stage < numManagedMembers() + * @pre getMember(index_on_stage) != 0 */ SAMRAI_MPI::Status * lookupStatusPointer( @@ -542,21 +658,25 @@ class AsyncCommStage /*! * @brief Push the given Member onto the stage's list of completed * Members. + * + * @param member + * + * @pre member.isDone() */ void - privatePushToCompletionQueue( Member &member ); + privatePushToCompletionQueue( + Member& member); /*! * @brief Yank the given Member from the stage's list of completed * Members. */ void - privateYankFromCompletionQueue( Member &member ); + privateYankFromCompletionQueue( + Member& member); //@} - - /*! * @brief Members managed on this stage. * @@ -564,12 +684,12 @@ class AsyncCommStage * stage because they are not at the end of the vector and cannot * be removed from the vector. */ - std::vector d_members; + std::vector d_members; /*! * @brief Number of members. * - * Not necessarily the same as d_members.size(), because d_members + * Not necessarily the same as numManagedMembers(), because d_members * may have unused slots left behind by destaged members. */ size_t d_member_count; @@ -602,7 +722,7 @@ class AsyncCommStage * (d_member_to_req[i]) and the number of request it has * (d_member_to_req[i+1]-d_member_to_req[i]). This vector is * always one longer than d_members. The extra item, - * d_member_to_req[d_members.size()], is the total number of + * d_member_to_req[numManagedMembers()], is the total number of * requests that the stage has allocated. */ std::vector d_member_to_req; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.C index f67a5f21..8bc1f8d4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.C @@ -3,13 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility for building efficient communication tree. * ************************************************************************/ -#ifndef included_tbox_BalancedDepthFirstTree_C -#define included_tbox_BalancedDepthFirstTree_C - #include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/PIO.h" @@ -26,44 +23,84 @@ namespace SAMRAI { namespace tbox { -BalancedDepthFirstTree::BalancedDepthFirstTree() +/* + **************************************************************** + **************************************************************** + */ +BalancedDepthFirstTree::BalancedDepthFirstTree(): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_root_rank(getInvalidRank()), + d_num_children(0), + d_do_left_leaf_switch(true) { } +/* + **************************************************************** + **************************************************************** + */ BalancedDepthFirstTree::BalancedDepthFirstTree( - unsigned int first_rank, - unsigned int last_rank, - unsigned int my_rank, - bool do_left_leaf_switch) + int first_rank, + int last_rank, + int my_rank, + bool do_left_leaf_switch): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_root_rank(getInvalidRank()), + d_num_children(0), + d_do_left_leaf_switch(do_left_leaf_switch) { - initialize(first_rank, last_rank, my_rank, do_left_leaf_switch); + setupTreeForContiguousRanks(first_rank, last_rank, my_rank); } +/* + **************************************************************** + **************************************************************** + */ BalancedDepthFirstTree::~BalancedDepthFirstTree() { } +/* + **************************************************************** + * Set up the tree from a RankGroup. + **************************************************************** + */ +void +BalancedDepthFirstTree::setupTree( + const RankGroup& rank_group, + int my_rank) +{ + TBOX_ASSERT(rank_group.isMember(my_rank)); + setupTreeForContiguousRanks(0, rank_group.size() - 1, rank_group.getMapIndex(my_rank)); +} + +/* + **************************************************************** + * Set up the tree for contiguous ranks. + **************************************************************** + */ void -BalancedDepthFirstTree::initialize( - unsigned int first_rank, - unsigned int last_rank, - unsigned int rank, - bool do_left_leaf_switch) +BalancedDepthFirstTree::setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank) { TBOX_ASSERT(first_rank <= rank); TBOX_ASSERT(rank <= last_rank); -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog - << "BalancedDepthFirstTree::initialize with first_rank,last_rank,x=" - << first_rank << " " << last_rank << " " << rank << std::endl; -#endif - unsigned int rbeg = first_rank; - unsigned int rend = last_rank; - unsigned int up = getInvalidRank(); // Temporary guess for parent. - unsigned int upp = getInvalidRank(); // Temporary guess for grandparent. - unsigned int cl, cr; // Temporary guesses for children. - bool is_switchable = false; // Part of a left-leaf switchable trio. + d_root_rank = first_rank; + d_generation = 0; + d_child_number = getInvalidChildNumber(); + + int rbeg = first_rank; + int rend = last_rank; + int up = getInvalidRank(); // Temporary guess for parent. + int upp = getInvalidRank(); // Temporary guess for grandparent. + int cl, cr; // Temporary guesses for children. + unsigned int parents_child_number = getInvalidChildNumber(); + bool is_switchable = false; // Part of a left-leaf switchable trio. size_t nr; // Number of nodes on right branch size_t nl; // Number of nodes on left branch @@ -75,8 +112,8 @@ BalancedDepthFirstTree::initialize( * parent and its children. */ - unsigned int node = rbeg; // Node being examined - size_t nrem = rend - rbeg; // Number or nodes remaining, excluding node. + int node = rbeg; // Node being examined + size_t nrem = static_cast(rend - rbeg); // Number or nodes remaining, excluding node. nr = nrem / 2; // Number on right branch nl = nrem - nr; // Number on left branch @@ -94,34 +131,25 @@ BalancedDepthFirstTree::initialize( if (nl > 0) cl = node + 1; // left child if (nr > 0) cr = cl + static_cast(nl); // right child -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog << "There are" << " " << nrem << " " - << "remaining nodes. nl,nr=" << " " << nl << " " << nr - << std::endl; - plog << "cl=" << " " << cl << " " << "cr=" << " " << cr - << std::endl; -#endif - if (node == rank) break; else { TBOX_ASSERT(nl > 0); TBOX_ASSERT(cl != getInvalidRank()); upp = up; up = node; + ++d_generation; if (nr < 1 || rank < cr) { -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog << "Going left to" << " " << cl << std::endl; -#endif rbeg = cl; rend = cl + static_cast(nl) - 1; + parents_child_number = d_child_number; + d_child_number = 0; } else { TBOX_ASSERT(nr > 0); TBOX_ASSERT(cr != getInvalidRank()); -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog << "Going right to" << " " << cr << std::endl; -#endif rbeg = cr; rend = cr + static_cast(nr) - 1; + parents_child_number = d_child_number; + d_child_number = 1; } } } @@ -132,15 +160,8 @@ BalancedDepthFirstTree::initialize( d_children[0] = cl; d_children[1] = cr; d_num_children = 0; -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog << " " << d_parent << std::endl; - plog << " |" << std::endl; - plog << " " << d_rank << std::endl; - plog << " / \\ " << std::endl; - plog << d_children[0] << " " << d_children[1] << std::endl; -#endif - if (do_left_leaf_switch) { + if (d_do_left_leaf_switch) { if (is_switchable) { /* * Trios of a parent and 2 leaf children are subject to @@ -152,25 +173,33 @@ BalancedDepthFirstTree::initialize( * left right parent right */ if (nl == 1) { - // Parent in a left-leaf switchable. + // This is a parent in a left-leaf switchable. d_parent = cl; d_children[0] = getInvalidRank(); d_children[1] = getInvalidRank(); + ++d_generation; + d_child_number = 0; } else if (rank == d_parent + 1) { - // Left child in a left-leaf switchable. + // This is a left child in a left-leaf switchable. d_children[0] = d_parent; d_parent = gparent; d_children[1] = rank + 1; + --d_generation; + d_child_number = parents_child_number; } else { - // Right child in a left-leaf switchable. + // This is a right child in a left-leaf switchable. d_parent = d_parent + 1; } + if (last_rank - first_rank + 1 == 3) { + // Special case of exactly 3 ranks allows the root be switched. + d_root_rank = first_rank + 1; + } } else { /* * Rank is not in a switchable trio, but its children * may be. Example: * - * Before: rank After: rank + * Before: rank After: rank * / \ / \ * / \ / \ * rank+1 rank+4 rank+2 rank+5 @@ -193,13 +222,6 @@ BalancedDepthFirstTree::initialize( } } -#if defined(BalancedDepthFirstTree_ExtraDebug) - plog << " " << d_parent << std::endl; - plog << " |" << std::endl; - plog << " " << d_rank << std::endl; - plog << " / \\ " << std::endl; - plog << d_children[0] << " " << d_children[1] << std::endl; -#endif } } @@ -212,5 +234,3 @@ BalancedDepthFirstTree::initialize( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.h index 2603d6f3..9f1ace52 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BalancedDepthFirstTree.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility for building efficient communication tree. * ************************************************************************/ @@ -12,15 +12,17 @@ #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/RankTreeStrategy.h" + namespace SAMRAI { namespace tbox { /*! - * @brief Utility to compute neighbors in a balanced depth-first tree. + * @brief Implementation of RankTreeStrategy aranging ranks in a + * balanced, depth-first tree. + * + * An example of a tree created is * - * This class is a tool to create a processor tree appropriate for use - * in collective communication operations. An example of a tree created - * is * @verbatim * 0 * / \ @@ -45,12 +47,10 @@ namespace tbox { * subtree is composed nodes with contiguous natural ordering. This * again benefits communication. */ -class BalancedDepthFirstTree +class BalancedDepthFirstTree:public RankTreeStrategy { public: - typedef int LocalId; - /*! * @brief Constructor. */ @@ -59,13 +59,16 @@ class BalancedDepthFirstTree /*! * @brief Initializing constructor. * - * @see initialize(). + * @param[in] first_rank + * @param[in] last_rank + * @param[in] rank + * @param[in] do_left_leaf_switch See setLeftLeafSwitching() */ BalancedDepthFirstTree( - unsigned int first_rank, - unsigned int last_rank, - unsigned int rank, - bool do_left_leaf_switch); + int first_rank, + int last_rank, + int rank, + bool do_left_leaf_switch = true); /*! * @brief Destructor. @@ -75,45 +78,35 @@ class BalancedDepthFirstTree ~BalancedDepthFirstTree(); /*! - * @brief Construct the tree. - * - * Initialize the parent, left and right children, given a - * contiguous range of processor ranks and the desired rank. - * Initialization has complexity ln(length of range). + * @brief Set up the tree. * - * The tree is set up for collective communications with the root - * rank being the first_rank. + * Set up the tree for the processors in the given RankGroup. + * Prepare to provide tree data for the given rank. * - * @param first_rank The first in a contiguous range of ranks in the - * communication group. - * - * @param last_rank The last in a contiguous range of ranks in the - * communication group. + * @param[in] rank_group * - * @param rank The rank whose parent and children are sought. + * @param[in] my_rank The rank whose parent and children are + * sought, usually the local process. * - * @param do_left_leaf_switch + * @pre (first_rank <= rank) && (rank <= last_rank) */ void - initialize( - unsigned int first_rank, - unsigned int last_rank, - unsigned int rank, - bool do_left_leaf_switch); + setupTree( + const RankGroup& rank_group, + int my_rank); /*! * @brief Access the rank used to initialize. */ - unsigned int - getRank() const - { + int + getRank() const { return d_rank; } /*! * @brief Access the parent rank. */ - unsigned int + int getParentRank() const { return d_parent; @@ -121,48 +114,118 @@ class BalancedDepthFirstTree /*! * @brief Access a child rank. - * - * Currently, child_number must be 0 or 1 because we only support - * a binary tree. */ - unsigned int - getChildRank( - unsigned int child_number) const - { - return d_children[child_number]; + int + getChildRank(unsigned int child_number) const { + return (child_number < d_num_children) ? + d_children[child_number] : getInvalidRank(); } - unsigned short int - getNumberOfChildren() const - { + /*! + * @brief Return the number of children. + */ + unsigned int + getNumberOfChildren() const { return d_num_children; } /*! - * @brief What this class considers an invalid rank. - * - * When a parent or child does not exist, this value is returned for - * the rank. + * @brief Return the child number, or invalidChildNumber() if is + * root of the tree. */ unsigned int - getInvalidRank() const - { - return 1 << (8 * sizeof(unsigned int) - 2); + getChildNumber() const { + return d_child_number; + } + + /*! + * @brief Return the degree of the tree (the maximum number of + * children each node may have). + */ + unsigned int getDegree() const { + return 2; + } + + /*! + * @brief Return the generation number. + */ + unsigned int + getGenerationNumber() const { + return d_generation; + } + + /*! + * @brief Return the rank of the root of the tree. + */ + int getRootRank() const { + return d_root_rank; + } + + /*! + * @brief Whether to do left-leaf-switch, which puts all leaves + * within one rank of their parents. + * + * Without left-leaf-switching, about half of the leaves are within + * one rank of their parents. The other half are within 2 ranks of + * their parents. On the downside, switching moves the leaves' + * parents a little farther away from the grandparents. + * + * Default choice is true. To change the choice, this call must + * be made before setupTree(). + */ + void + setLeftLeafSwitching(bool do_left_leaf_switch) { + TBOX_ASSERT(d_rank == getInvalidRank()); + d_do_left_leaf_switch = do_left_leaf_switch; } private: + // Unimplemented copy constructor. + BalancedDepthFirstTree( + const BalancedDepthFirstTree& other); + + // Unimplemented assignment operator. + BalancedDepthFirstTree& + operator = ( + const BalancedDepthFirstTree& rhs); + /*! - * @brief Initialized rank. + * @brief Set up the tree. * - * @see initialize(); + * Setting up has log complexity. + * + * @param first_rank The first in a contiguous range of ranks in the + * communication group. + * + * @param last_rank The last in a contiguous range of ranks in the + * communication group. + * + * @param rank The rank whose parent and children are sought. */ - unsigned int d_rank; + void + setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank); + + /*! + * @brief Initialized rank. + */ + int d_rank; + + int d_parent; + + int d_children[2]; + + int d_root_rank; + + unsigned int d_num_children; - unsigned int d_parent; + unsigned int d_child_number; - unsigned int d_children[2]; + unsigned int d_generation; - unsigned short int d_num_children; + bool d_do_left_leaf_switch; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Boost.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Boost.h index 3ce482bf..206e6224 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Boost.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Boost.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SAMRAI support utilities for Boost * ************************************************************************/ @@ -22,7 +22,7 @@ * warning suppression mechanism. */ -#if __GNUC__ > 5 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 5)) +#if __GNUC__ >= 5 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6)) #define BEGIN_BOOST_WARNING_SUPPRESSION \ _Pragma("GCC diagnostic push") \ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.C new file mode 100644 index 00000000..188824e2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.C @@ -0,0 +1,135 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for building efficient communication tree. + * + ************************************************************************/ +#include "SAMRAI/tbox/BreadthFirstRankTree.h" + +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/Utilities.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace tbox { + +/* + **************************************************************** + **************************************************************** + */ +BreadthFirstRankTree::BreadthFirstRankTree(): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_children(2, getInvalidRank()), + d_num_children(0), + d_child_number(getInvalidChildNumber()), + d_generation(0), + d_root_rank(getInvalidRank()) +{ +} + +/* + **************************************************************** + **************************************************************** + */ +BreadthFirstRankTree::BreadthFirstRankTree( + int first_rank, + int last_rank, + int my_rank, + unsigned int degree): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_children(degree, getInvalidRank()), + d_num_children(0), + d_child_number(getInvalidChildNumber()), + d_generation(0), + d_root_rank(getInvalidRank()) +{ + setupTreeForContiguousRanks(first_rank, last_rank, my_rank); +} + +/* + **************************************************************** + **************************************************************** + */ +BreadthFirstRankTree::~BreadthFirstRankTree() +{ +} + +/* + **************************************************************** + * Set up the tree from a RankGroup. + **************************************************************** + */ +void +BreadthFirstRankTree::setupTree( + const RankGroup& rank_group, + int my_rank) +{ + TBOX_ASSERT(rank_group.isMember(my_rank)); + setupTreeForContiguousRanks(0, rank_group.size() - 1, rank_group.getMapIndex(my_rank)); +} + +/* + **************************************************************** + * Set up the tree for contiguous ranks. + **************************************************************** + */ +void +BreadthFirstRankTree::setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank) +{ + TBOX_ASSERT(first_rank <= rank); + TBOX_ASSERT(rank <= last_rank); + + const unsigned int degree = static_cast(d_children.size()); + + d_root_rank = first_rank; + d_rank = rank; + if (d_rank > first_rank) { + d_parent = (d_rank - first_rank - 1) / degree; + d_child_number = (d_rank - first_rank - 1) % degree; + } else { + d_parent = getInvalidRank(); + d_child_number = getInvalidChildNumber(); + } + + d_num_children = 0; + for (d_num_children = 0; d_num_children < degree; ++d_num_children) { + + d_children[d_num_children] = + first_rank + degree * (d_rank - first_rank) + 1 + d_num_children; + + if (d_children[d_num_children] > last_rank) { + for (unsigned int i = d_num_children; i < degree; ++i) { + d_children[i] = getInvalidRank(); + } + break; + } + + } + +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Unsuppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.h new file mode 100644 index 00000000..c5ac3125 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/BreadthFirstRankTree.h @@ -0,0 +1,244 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for building efficient communication tree. + * + ************************************************************************/ +#ifndef included_tbox_BreadthFirstRankTree +#define included_tbox_BreadthFirstRankTree + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/RankTreeStrategy.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +namespace SAMRAI { +namespace tbox { + +/*! + * @brief Implementation of RankTreeStrategy aranging ranks in a + * breadth-first tree. + * + * An example of a binary tree created is + * + * @verbatim + * 0 + * / \ + * / \ + * / \ + * 1 2 + * / \ / \ + * 3 4 5 6 + * /| /| |\ \ + * 7 8 9 10 11 12 13... + * @endverbatim + * + * The degree of the tree (max number of children at each node) can be + * set using setTreeDegree(), but that must be done before the tree is + * set up. The default is a binary tree (two children). + * + * A property of the tree is that the first rank, i0, is always the + * root. It is a d-degree tree. The children of rank i are rank + * d*(i-i0) and d*(i-i0)+1. It's parent is rank (i-i0-1)/d. The tree + * is as balanced as possible. Node ranks are close to their siblings + * but not their parents. This arangement does not map well to any + * known communication networks, so this tree does not perform well. + * It is included for comparison. + */ +class BreadthFirstRankTree:public RankTreeStrategy +{ + +public: + typedef int LocalId; + + /*! + * @brief Constructor. + */ + BreadthFirstRankTree(); + + /*! + * @brief Initializing constructor. + * + * @param[in] first_rank + * @param[in] last_rank + * @param[in] rank + * @param[in] degree See setTreeDegree() + */ + BreadthFirstRankTree( + int first_rank, + int last_rank, + int rank, + unsigned int degree = 2); + + /*! + * @brief Destructor. + * + * Deallocate internal data. + */ + ~BreadthFirstRankTree(); + + /*! + * @brief Set up the tree. + * + * Set up the tree for the processors in the given RankGroup. + * Prepare to provide tree data for the given rank. + * + * @param[in] rank_group + * + * @param[in] my_rank The rank whose parent and children are + * sought, usually the local process. + */ + void + setupTree( + const RankGroup& rank_group, + int my_rank); + + /*! + * @brief Access the rank used to initialize. + */ + int + getRank() const + { + return d_rank; + } + + /*! + * @brief Access the parent rank. + */ + int + getParentRank() const + { + return d_parent; + } + + /*! + * @brief Access a child rank. + * + * @param [in] child_number + * a binary tree. + */ + int + getChildRank( + unsigned int child_number) const + { + return (child_number < d_num_children) ? + d_children[child_number] : getInvalidRank(); + } + + unsigned int + getNumberOfChildren() const + { + return d_num_children; + } + + /*! + * @brief Return the child number, or invalidChildNumber() if is + * root of the tree. + */ + unsigned int getChildNumber() const + { + return d_child_number; + } + + /*! + * @brief Return the degree of the tree (the maximum number of + * children each node may have). + */ + unsigned int getDegree() const + { + return static_cast(d_children.size()); + } + + /*! + * @brief Return the generation number. + */ + unsigned int getGenerationNumber() const + { + return d_generation; + } + + /*! + * @brief Return the rank of the root of the tree. + */ + int getRootRank() const + { + return d_root_rank; + } + + /*! + * @brief Set the degree (max number of children) of the tree. + * + * Default choice is 2 (binary tree). To change the choice, this + * call must be made before setupTree(). + */ + void setTreeDegree(unsigned int tree_degree) + { + TBOX_ASSERT(d_rank == getInvalidRank()); + d_children.resize(tree_degree, getInvalidRank()); + } + +private: + // Unimplemented copy constructor. + BreadthFirstRankTree( + const BreadthFirstRankTree& other); + + // Unimplemented assignment operator. + BreadthFirstRankTree& + operator = ( + const BreadthFirstRankTree& rhs); + + /*! + * @brief Construct the tree. + * + * Setting up has complexity 1. + * + * @param first_rank The first in a contiguous range of ranks in the + * communication group. + * + * @param last_rank The last in a contiguous range of ranks in the + * communication group. + * + * @param rank The rank whose parent and children are sought. + */ + void + setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank); + + /*! + * @brief Initialized rank. + * + * @see setupTree(); + */ + int d_rank; + + int d_parent; + + /*! + * @brief Children rank. Length of this member is also the degree + * of the tree. + * + * Number of valid child ranks is d_child_number. The rest of the + * entries should be invalid ranks. + */ + std::vector d_children; + + unsigned int d_num_children; + + unsigned int d_child_number; + + unsigned int d_generation; + + int d_root_rank; + +}; + +} +} + +#endif // included_tbox_BreadthFirstRankTree diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.C new file mode 100644 index 00000000..908fb8e6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.C @@ -0,0 +1,208 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for building efficient communication tree. + * + ************************************************************************/ +#include "SAMRAI/tbox/CenteredRankTree.h" + +#include "SAMRAI/tbox/Utilities.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace tbox { + +/* + **************************************************************** + **************************************************************** + */ +CenteredRankTree::CenteredRankTree(): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_root_rank(getInvalidRank()), + d_num_children(0), + d_make_first_rank_the_root(false) +{ +} + +/* + **************************************************************** + **************************************************************** + */ +CenteredRankTree::CenteredRankTree( + const SAMRAI_MPI& mpi, + bool make_first_rank_the_root): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_root_rank(getInvalidRank()), + d_num_children(0), + d_make_first_rank_the_root(make_first_rank_the_root) +{ + setupTreeForContiguousRanks(0, mpi.getSize() - 1, mpi.getRank()); +} + +/* + **************************************************************** + **************************************************************** + */ +CenteredRankTree::CenteredRankTree( + int first_rank, + int last_rank, + int my_rank, + bool make_first_rank_the_root): + d_rank(getInvalidRank()), + d_parent(getInvalidRank()), + d_root_rank(getInvalidRank()), + d_num_children(0), + d_make_first_rank_the_root(make_first_rank_the_root) +{ + setupTreeForContiguousRanks(first_rank, last_rank, my_rank); +} + +/* + **************************************************************** + **************************************************************** + */ +CenteredRankTree::~CenteredRankTree() +{ +} + +/* + **************************************************************** + * Set up the tree from a RankGroup. + **************************************************************** + */ +void +CenteredRankTree::setupTree( + const RankGroup& rank_group, + int my_rank) +{ + TBOX_ASSERT(rank_group.isMember(my_rank)); + setupTreeForContiguousRanks(0, rank_group.size() - 1, rank_group.getMapIndex(my_rank)); +} + +/* + **************************************************************** + * Set up the tree for contiguous ranks. + * + * Determine the parent and children for the argument rank. Start + * with the range [first_rank,last_rank] and narrow it down by + * moving in the direction of the rank until we find it. + * + * How to determine which direction to go: + * Given contiguous ranks [rbeg, rend], the "midpoint" is + * rmid=(rbeg+rend+1)/2. Select the root and branches + * for the range like this: + * + * rmid + * / \ + * [rbeg,rmid) (rmid,rend] + * + * The midpoint is the root for this range. (Note that the midpoint is + * rounded up, so that the left branch gets the odd rank.) + * + * Exception: If d_make_first_rank_the_root and we are at the root of + * the tree, select the root and branches like this: rmid=(rbeg+rend)2, + * + * rbeg + * / \ + * (rbeg,rmid] (rmid,rend] + **************************************************************** + */ +void +CenteredRankTree::setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank) +{ +#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(first_rank <= rank); + TBOX_ASSERT(rank <= last_rank); +#endif + + d_rank = rank; + d_parent = d_children[0] = d_children[1] = getInvalidRank(); + d_generation = 0; + d_child_number = getInvalidChildNumber(); + + int rbeg = first_rank; + int rend = last_rank; + + /* + * Set up the root. If it is d_rank, compute its children. + */ + if (d_make_first_rank_the_root) { + d_root_rank = rbeg; + rbeg = rbeg + 1; + const int rmid = (rbeg + rend) / 2; + if (d_rank == d_root_rank) { + if (rbeg <= rend) d_children[0] = (rbeg + rmid + 1) / 2; + if (rend > rbeg) d_children[1] = (rmid + 1 + rend + 1) / 2; + } else if (d_rank <= rmid) { + rend = rmid; + d_child_number = 0; + } else { /* d_rank > rmid */ + rbeg = rmid + 1; + d_child_number = 1; + } + } else { + const int rmid = (rbeg + rend + 1) / 2; + d_root_rank = rmid; + if (d_rank == d_root_rank) { + if (d_rank > rbeg) d_children[0] = (rbeg + rmid) / 2; + if (d_rank < rend) d_children[1] = (rmid + 1 + rend + 1) / 2; + } + } + + if (d_rank != d_root_rank) { + // Find d_rank's parent and children by walking toward it. + d_parent = d_root_rank; + ++d_generation; + while (true) { + const int rmid = (rbeg + rend + 1) / 2; + if (d_rank == rmid) { + if (d_rank > rbeg) d_children[0] = (rbeg + rmid) / 2; + if (d_rank < rend) d_children[1] = (rmid + 1 + rend + 1) / 2; + break; + } else if (d_rank < rmid) { + rend = rmid - 1; + d_child_number = 0; + } else { /* d_rank > rmid */ + rbeg = rmid + 1; + d_child_number = 1; + } + d_parent = rmid; + ++d_generation; + } + } + + // Count number of children. + d_num_children = 0; + for (int i = 0; i < 2; ++i) { + if (d_children[i] != getInvalidRank()) { + ++d_num_children; + } + } + +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Unsuppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.h new file mode 100644 index 00000000..36aba428 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CenteredRankTree.h @@ -0,0 +1,255 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for building efficient communication tree. + * + ************************************************************************/ +#ifndef included_tbox_CenteredRankTree +#define included_tbox_CenteredRankTree + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/tbox/RankTreeStrategy.h" + +namespace SAMRAI { +namespace tbox { + +/*! + * @brief Implementation of RankTreeStrategy aranging ranks with the + * root at the center of its descendent ranks. + * + * An example of a tree created is + * + * @verbatim + * 7 + * / \ + * / \ + * / \ + * 3 11 + * / \ / \ + * 1 5 9 13 + * /| /| /| |\ + * 0 2 4 6 8 10 12 14 + * + * or with 0 at the root: + * 0 + * / \ + * / \ + * / \ + * 4 11 + * / \ / \ + * 2 6 9 13 + * /| /| /| |\ + * 1 3 5 7 8 10 12 14 + * @endverbatim + * + * The root of tree is the center, rounded up, of the rank in it left + * and right branches. The exception is the case where we force the + * first rank to be the root of the entire tree (@see + * makeFirstRankTheRoot()). + * + * Nodes that are close together + * in the tree tends to be close together in natural ordering. Without + * knowing about the underlying message passing network structure, we + * assume that close natural ordering usually means close together on + * the network. Thus nodes close together in the tree are also close + * together on the network. Thus, communication between nearest + * neighbors in the tree tend to be faster. If the weight of each edge + * is the difference in ranks of its nodes, the sum of all weights in + * a tree of N nodes is N*ln(N). + * + * The tree formed by this class has the property that each and every + * subtree is composed nodes with contiguous natural ordering. This + * again benefits communication. + */ +class CenteredRankTree:public RankTreeStrategy +{ + +public: + /*! + * @brief Constructor. + */ + CenteredRankTree(); + + /*! + * @brief Initializing constructor. + * + * @see setupTree() + * + * @param[in] mpi + * @param[in] make_first_rank_the_root See makeFirstRankTheRoot() + */ + CenteredRankTree( + const SAMRAI_MPI& mpi, + bool make_first_rank_the_root = true); + + /*! + * @brief Initializing constructor. + * + * @see setupTree() + * + * @param[in] first_rank + * @param[in] last_rank + * @param[in] rank + * @param[in] make_first_rank_the_root See makeFirstRankTheRoot() + */ + CenteredRankTree( + int first_rank, + int last_rank, + int rank, + bool make_first_rank_the_root = true); + + /*! + * @brief Destructor. + * + * Deallocate internal data. + */ + ~CenteredRankTree(); + + /*! + * @brief Set up the tree. + * + * Set up the tree for the processors in the given RankGroup. + * Prepare to provide tree data for the given rank. + * + * @param[in] rank_group + * + * @param[in] my_rank The rank whose parent and children are + * sought, usually the local process. + */ + void + setupTree( + const RankGroup& rank_group, + int my_rank); + + /*! + * @brief Access the rank used to initialize. + */ + int + getRank() const { + return d_rank; + } + + /*! + * @brief Access the parent rank. + */ + int + getParentRank() const { + return d_parent; + } + + /*! + * @brief Access a child rank. + */ + int + getChildRank(unsigned int child_number) const { + return (child_number < d_num_children) ? + d_children[child_number] : getInvalidRank(); + } + + /*! + * @brief Return the number of children. + */ + unsigned int getNumberOfChildren() const { + return d_num_children; + } + + /*! + * @brief Return the child number, or invalidChildNumber() if is + * root of the tree. + */ + unsigned int getChildNumber() const { + return d_child_number; + } + + /*! + * @brief Return the degree of the tree (the maximum number of + * children each node may have). + */ + unsigned int getDegree() const { + return 2; + } + + /*! + * @brief Return the generation number. + */ + unsigned int getGenerationNumber() const { + return d_generation; + } + + /*! + * @brief Return the rank of the root of the tree. + */ + int getRootRank() const { + return d_root_rank; + } + + /*! + * @brief Set whether to use the first rank in the range for the + * root instead of the rank at the middle of the range. + * + * Default choice is false. To change the choice, this call must + * be made before setupTree(). + */ + void makeFirstRankTheRoot(bool make_first_rank_the_root) { + TBOX_ASSERT(d_rank == getInvalidRank()); + d_make_first_rank_the_root = make_first_rank_the_root; + } + +private: + // Unimplemented copy constructor. + CenteredRankTree( + const CenteredRankTree& other); + + // Unimplemented assignment operator. + CenteredRankTree& + operator = ( + const CenteredRankTree& rhs); + + /*! + * @brief Set up the tree. + * + * Setting up has log complexity. + * + * @param[in] first_rank The first in a contiguous range of ranks in + * the communication group. + * + * @param[in] last_rank The last in a contiguous range of ranks in + * the communication group. + * + * @param[in] rank The rank whose parent and children are sought. + */ + void + setupTreeForContiguousRanks( + int first_rank, + int last_rank, + int rank); + + /*! + * @brief Initialized rank. + */ + int d_rank; + + int d_parent; + + int d_children[2]; + + int d_root_rank; + + unsigned int d_num_children; + + unsigned int d_child_number; + + unsigned int d_generation; + + bool d_make_first_rank_the_root; + +}; + +} +} + +#endif // included_tbox_CenteredRankTree diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.C index 188cfee8..79d12e9f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Accesses system times. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.h index 2ea4e0f7..a81a1f2d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Clock.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple utility class for interfacing with system clock * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.C new file mode 100644 index 00000000..26e5046d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.C @@ -0,0 +1,285 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Collects and writes out data on communication graphs. + * + ************************************************************************/ +#include "SAMRAI/tbox/CommGraphWriter.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +#include "SAMRAI/tbox/MessageStream.h" + +namespace SAMRAI { +namespace tbox { + +/* + *********************************************************************** + *********************************************************************** + */ +CommGraphWriter::CommGraphWriter(): + d_root_rank(0), + d_write_full_graph(true) +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +CommGraphWriter::~CommGraphWriter() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +size_t CommGraphWriter::addRecord( + const SAMRAI_MPI& mpi, + size_t number_of_edge_types, + size_t number_of_node_value_types) +{ + d_records.resize(1 + d_records.size()); + Record& record = d_records.back(); + record.d_mpi = mpi; + record.d_edges.resize(number_of_edge_types); + record.d_node_values.resize(number_of_node_value_types); + return d_records.size() - 1; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void CommGraphWriter::setEdgeInCurrentRecord( + size_t edge_type_index, + const std::string& edge_label, + double edge_value, + EdgeDirection edge_direction, + int other_node) +{ + TBOX_ASSERT(edge_type_index < d_records.back().d_edges.size()); + + Edge& edge = d_records.back().d_edges[edge_type_index]; + + edge.d_label = edge_label; + edge.d_value = edge_value; + edge.d_dir = edge_direction; + edge.d_other_node = other_node; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void CommGraphWriter::setNodeValueInCurrentRecord( + size_t nodevalue_type_index, + const std::string& nodevalue_label, + double node_value) +{ + TBOX_ASSERT(nodevalue_type_index < d_records.back().d_node_values.size()); + + NodeValue& nodevalue = d_records.back().d_node_values[nodevalue_type_index]; + + nodevalue.d_value = node_value; + nodevalue.d_label = nodevalue_label; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void CommGraphWriter::writeGraphToTextStream( + size_t record_number, + std::ostream& os) const +{ + if (d_write_full_graph) { + writeFullGraphToTextStream(record_number, os); + } else { + writeGraphSummaryToTextStream(record_number, os); + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void CommGraphWriter::writeGraphSummaryToTextStream( + size_t record_number, + std::ostream& os) const +{ + /* + * Gather graph data on d_root_rank and write out. + */ + TBOX_ASSERT(record_number < d_records.size()); + + const Record& record = d_records[record_number]; + + MessageStream ostr; + std::vector values; + values.reserve(record.d_node_values.size() + record.d_edges.size()); + + for (size_t inodev = 0; inodev < record.d_node_values.size(); ++inodev) { + values.push_back(record.d_node_values[inodev].d_value); + } + for (size_t iedge = 0; iedge < record.d_edges.size(); ++iedge) { + values.push_back(record.d_edges[iedge].d_value); + } + + if (values.size() > 0) { + std::vector tmpvalues(values); + record.d_mpi.Reduce( + (void *)&tmpvalues[0], + (void *)&values[0], + int(values.size()), + MPI_DOUBLE, + MPI_MAX, + d_root_rank); + } + + os.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + os.precision(8); + + std::vector max_nodev(record.d_node_values.size()); + std::vector max_edge(record.d_edges.size()); + + if (record.d_mpi.getRank() == d_root_rank) { + + std::vector::const_iterator vi = values.begin(); + + os << "\nCommGraphWriter begin record number " << record_number << '\n'; + os << "Node maximums:\n"; + for (size_t inodev = 0; inodev < record.d_node_values.size(); ++inodev) { + os << '\t' << record.d_node_values[inodev].d_label << '\t' << *(vi++) << '\n'; + } + os << "Edge maximums:\n"; + for (size_t iedge = 0; iedge < record.d_edges.size(); ++iedge) { + os << '\t' << record.d_edges[iedge].d_label << '\t' << *(vi++) << '\n'; + } + os << "CommGraphWriter end record number " << record_number << '\n'; + + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void CommGraphWriter::writeFullGraphToTextStream( + size_t record_number, + std::ostream& os) const +{ + /* + * Gather graph data on d_root_rank and write out. + */ + TBOX_ASSERT(record_number < d_records.size()); + + const Record& record = d_records[record_number]; + + MessageStream ostr; + + for (size_t inodev = 0; inodev < record.d_node_values.size(); ++inodev) { + const NodeValue& nodev = record.d_node_values[inodev]; + ostr << nodev.d_value; + } + for (size_t iedge = 0; iedge < record.d_edges.size(); ++iedge) { + const Edge& edge = record.d_edges[iedge]; + ostr << edge.d_value << edge.d_dir << edge.d_other_node; + } + + std::vector tmpbuf(record.d_mpi.getRank() == d_root_rank ? + ostr.getCurrentSize() * record.d_mpi.getSize() : 0); + + if (ostr.getCurrentSize() > 0) { + record.d_mpi.Gather( + (void *)ostr.getBufferStart(), + int(ostr.getCurrentSize()), + MPI_CHAR, + (record.d_mpi.getRank() == d_root_rank ? &tmpbuf[0] : 0), + int(record.d_mpi.getRank() == d_root_rank ? ostr.getCurrentSize() : 0), + MPI_CHAR, + d_root_rank); + } + + os.setf(std::ios_base::fmtflags(0), std::ios_base::floatfield); + os.precision(8); + + std::vector max_nodev(record.d_node_values.size()); + std::vector max_edge(record.d_edges.size()); + + if (record.d_mpi.getRank() == d_root_rank) { + + os << "\nCommGraphWriter begin record number " << record_number << '\n'; + os << "# proc" << '\t' << "dir" << '\t' << "remote" << '\t' << "value" << '\t' << "label\n"; + + if (!tmpbuf.empty()) { + MessageStream istr(tmpbuf.size(), + MessageStream::Read, + &tmpbuf[0], + false); + + for (int src_rank = 0; src_rank < record.d_mpi.getSize(); ++src_rank) { + + NodeValue tmpnodev; + for (size_t inodev = 0; inodev < record.d_node_values.size(); ++inodev) { + istr >> tmpnodev.d_value; + os << src_rank + << '\t' << tmpnodev.d_value + << '\t' << record.d_node_values[inodev].d_label + << '\n'; + if (max_nodev[inodev].d_value < tmpnodev.d_value) { + max_nodev[inodev] = tmpnodev; + } + } + + Edge tmpedge; + for (size_t iedge = 0; iedge < record.d_edges.size(); ++iedge) { + istr >> tmpedge.d_value >> tmpedge.d_dir >> tmpedge.d_other_node; + os << src_rank + << '\t' << (tmpedge.d_dir == FROM ? "<-" : "->") + << '\t' << tmpedge.d_other_node + << '\t' << tmpedge.d_value + << '\t' << record.d_edges[iedge].d_label + << '\n'; + if (max_edge[iedge].d_value < tmpedge.d_value) { + max_edge[iedge] = tmpedge; + } + } + + } + } + + os << "Node maximums:\n"; + for (size_t inodev = 0; inodev < record.d_node_values.size(); ++inodev) { + os << '\t' << record.d_node_values[inodev].d_label << '\t' << max_nodev[inodev].d_value + << '\n'; + } + os << "Edge maximums:\n"; + for (size_t iedge = 0; iedge < record.d_edges.size(); ++iedge) { + os << '\t' << record.d_edges[iedge].d_label << '\t' << max_edge[iedge].d_value << '\n'; + } + + os << "CommGraphWriter end record number " << record_number << '\n'; + + } +} + +} +} +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.h new file mode 100644 index 00000000..ef3a2c34 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/CommGraphWriter.h @@ -0,0 +1,173 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Collects and writes out data on communication graphs. + * + ************************************************************************/ +#ifndef included_tbox_CommGraphWriter +#define included_tbox_CommGraphWriter + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/tbox/SAMRAI_MPI.h" + +#include +#include + +namespace SAMRAI { +namespace tbox { + +/*! + * @brief Collects data on distributed communication graphs and writes + * out for analysis. + * + * A node can have multiple values, each with a label. An node can + * have multiple edges, each with a label. + */ +class CommGraphWriter +{ + +public: + /*! + * @brief Default constructor. + */ + CommGraphWriter(); + + /*! + * @brief Destructor. + */ + virtual ~CommGraphWriter(); + + /*! + * @brief Set whether to write full graph. + * + * Writing full graph is unscalable, but can be done at large scales + * if you have enough computing time and memory. Writing full graph + * is on by default. + */ + void setWriteFullGraph(bool write_full_graph) { + d_write_full_graph = write_full_graph; + } + + /*! + * @brief Add a graph record. + * + * @param[in] mpi Where the graph data is distributed. + * + * @param[in] number_of_edge_types + * + * @param[in] number_of_node_value_types + * + * @return Index of the record. + */ + size_t + addRecord( + const SAMRAI_MPI& mpi, + size_t number_of_edge_types, + size_t number_of_node_value_types); + + /*! + * @brief Get the current number of records. + * + * @return Current number of records. + */ + size_t getNumberOfRecords() const { + return d_records.size(); + } + + enum EdgeDirection { FROM = 0, TO = 1 }; + + /*! + * @brief Set an edge in the current record. + * + * The label only matters on the root process. Other processes do + * nothing in this method. + */ + void + setEdgeInCurrentRecord( + size_t edge_type_index, + const std::string& edge_label, + double edge_value, + EdgeDirection edge_direction, + int other_node); + + /*! + * @brief Set a node value in the current record. + * + * The label only matters on the root process. Other processes do + * nothing in this method. + */ + void + setNodeValueInCurrentRecord( + size_t nodevalue_type_index, + const std::string& nodevalue_label, + double node_value); + + /*! + * @brief Gather data onto the root process and write out text file. + */ + void + writeGraphToTextStream( + size_t record_number, + std::ostream& os) const; + +private: + // Unimplemented copy constructor. + CommGraphWriter( + const CommGraphWriter& other); + + // Unimplemented assignment operator. + CommGraphWriter& + operator = ( + const CommGraphWriter& rhs); + + struct Edge { + Edge():d_value(0.0), + d_dir(TO), + d_other_node(-1) { + } + double d_value; + EdgeDirection d_dir; + int d_other_node; + std::string d_label; + }; + + struct NodeValue { + NodeValue():d_value(0.0) { + } + double d_value; + std::string d_label; + }; + + struct Record { + Record():d_mpi(MPI_COMM_NULL) { + } + SAMRAI_MPI d_mpi; + std::vector d_edges; + std::vector d_node_values; + }; + + void + writeGraphSummaryToTextStream( + size_t record_number, + std::ostream& os) const; + + void + writeFullGraphToTextStream( + size_t record_number, + std::ostream& os) const; + + int d_root_rank; + std::vector d_records; + + bool d_write_full_graph; + +}; + +} +} + +#endif // included_tbox_CommGraphWriter diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Complex.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Complex.h index 210b6972..05cfb272 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Complex.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Complex.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: dcomplex class for old-style complex and new complex * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.C index fb08f09a..e2f08881 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for the SAMRAI database objects * ************************************************************************/ @@ -75,16 +75,22 @@ Database::putBool( */ void -Database::putBoolArray( +Database::putBoolVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putBoolArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + int nbools = static_cast(data.size()); + bool* bool_array = new bool[nbools]; + for (int i = 0; i < nbools; ++i) { + bool_array[i] = data[i]; + } + putBoolArray(key, bool_array, nbools); + delete[] bool_array; } else { - TBOX_ERROR("Database::putBoolArray() error in database " + TBOX_ERROR("Database::putBoolVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -125,9 +131,8 @@ Database::getBoolWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_bool = getBoolArray(key); - bool* locptr = local_bool.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_bool = getBoolVector(key); + return local_bool.empty() ? defaultvalue : local_bool[0]; } else { return defaultvalue; } @@ -137,22 +142,22 @@ void Database::getBoolArray( const std::string& key, bool* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getBoolArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getBoolVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { - TBOX_ERROR("Database::getBoolArray() error in database " + TBOX_ERROR("Database::getBoolVector() error in database " << getName() << "\n Incorrect array size = " << nelements << " given for key = " << key << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } @@ -180,24 +185,24 @@ Database::putDatabaseBox( /* ************************************************************************* * - * Create a box array entry in the database with the specified key name. + * Create a box vector entry in the database with the specified key name. * ************************************************************************* */ void -Database::putDatabaseBoxArray( +Database::putDatabaseBoxVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putDatabaseBoxArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putDatabaseBoxArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putDatabaseBoxArray() error in database " + TBOX_ERROR("Database::putDatabaseBoxVector() error in database " << getName() - << "\n Attempt to put zero-length array with key = " + << "\n Attempt to put zero-length vector with key = " << key << std::endl); } } @@ -244,9 +249,8 @@ Database::getDatabaseBoxWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_box = getDatabaseBoxArray(key); - DatabaseBox* locptr = local_box.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_box = getDatabaseBoxVector(key); + return local_box.empty() ? defaultvalue : local_box[0]; } else { return defaultvalue; } @@ -257,12 +261,12 @@ void Database::getDatabaseBoxArray( const std::string& key, DatabaseBox* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getDatabaseBoxArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getDatabaseBoxVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getDatabaseBoxArray() error in database " @@ -272,7 +276,7 @@ Database::getDatabaseBoxArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -304,23 +308,23 @@ Database::putChar( /* ************************************************************************* * - * Create a char array entry in the database with the specified + * Create a char vector entry in the database with the specified * key name. * ************************************************************************* */ void -Database::putCharArray( +Database::putCharVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putCharArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putCharArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putCharArray() error in database " + TBOX_ERROR("Database::putCharVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -369,9 +373,8 @@ Database::getCharWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_char = getCharArray(key); - char* locptr = local_char.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_char = getCharVector(key); + return local_char.empty() ? defaultvalue : local_char[0]; } else { return defaultvalue; } @@ -382,12 +385,12 @@ void Database::getCharArray( const std::string& key, char* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getCharArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getCharVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getCharArray() error in database " @@ -397,7 +400,7 @@ Database::getCharArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -428,23 +431,23 @@ Database::putComplex( /* ************************************************************************* * - * Create a complex array entry in the database with the specified + * Create a complex vector entry in the database with the specified * key name. * ************************************************************************* */ void -Database::putComplexArray( +Database::putComplexVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putComplexArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putComplexArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putComplexArray() error in database " + TBOX_ERROR("Database::putComplexVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -495,10 +498,9 @@ Database::getComplexWithDefault( dcomplex retval = defaultvalue; if (keyExists(key)) { - Array local_dcomplex = getComplexArray(key); - dcomplex* locptr = local_dcomplex.getPointer(); - if (locptr != NULL) { - retval = *locptr; + std::vector local_dcomplex = getComplexVector(key); + if (!local_dcomplex.empty()) { + retval = local_dcomplex[0]; } } return retval; @@ -508,12 +510,12 @@ void Database::getComplexArray( const std::string& key, dcomplex* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getComplexArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getComplexVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getComplexArray() error in database " @@ -523,7 +525,7 @@ Database::getComplexArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -554,23 +556,23 @@ Database::putFloat( /* ************************************************************************* * - * Create a float array entry in the database with the specified + * Create a float vector entry in the database with the specified * key name. * ************************************************************************* */ void -Database::putFloatArray( +Database::putFloatVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putFloatArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putFloatArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putFloatArray() error in database " + TBOX_ERROR("Database::putFloatVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -620,9 +622,8 @@ Database::getFloatWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_float = getFloatArray(key); - float* locptr = local_float.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_float = getFloatVector(key); + return local_float.empty() ? defaultvalue : local_float[0]; } else { return defaultvalue; } @@ -633,12 +634,12 @@ void Database::getFloatArray( const std::string& key, float* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getFloatArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getFloatVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getFloatArray() error in database " @@ -648,7 +649,7 @@ Database::getFloatArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -679,23 +680,23 @@ Database::putDouble( /* ************************************************************************* * - * Create a double array entry in the database with the specified + * Create a double vector entry in the database with the specified * key name. * ************************************************************************* */ void -Database::putDoubleArray( +Database::putDoubleVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putDoubleArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putDoubleArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putDoubleArray() error in database " + TBOX_ERROR("Database::putDoubleVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -744,9 +745,8 @@ Database::getDoubleWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_double = getDoubleArray(key); - double* locptr = local_double.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_double = getDoubleVector(key); + return local_double.empty() ? defaultvalue : local_double[0]; } else { return defaultvalue; } @@ -756,12 +756,12 @@ void Database::getDoubleArray( const std::string& key, double* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getDoubleArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getDoubleVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getDoubleArray() error in database " @@ -771,7 +771,7 @@ Database::getDoubleArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -809,16 +809,16 @@ Database::putInteger( */ void -Database::putIntegerArray( +Database::putIntegerVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putIntegerArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putIntegerArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putIntegerArray() error in database " + TBOX_ERROR("Database::putIntegerVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -867,9 +867,8 @@ Database::getIntegerWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_int = getIntegerArray(key); - int* locptr = local_int.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_int = getIntegerVector(key); + return local_int.empty() ? defaultvalue : local_int[0]; } else { return defaultvalue; } @@ -880,12 +879,12 @@ void Database::getIntegerArray( const std::string& key, int* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getIntegerArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getIntegerVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getIntegerArray() error in database " @@ -895,7 +894,7 @@ Database::getIntegerArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -926,23 +925,23 @@ Database::putString( /* ************************************************************************* * - * Create a string array entry in the database with the specified + * Create a string vector entry in the database with the specified * key name. * ************************************************************************* */ void -Database::putStringArray( +Database::putStringVector( const std::string& key, - const Array& data) + const std::vector& data) { TBOX_ASSERT(!key.empty()); - if (data.getSize() > 0) { - putStringArray(key, data.getPointer(), data.getSize()); + if (data.size() > 0) { + putStringArray(key, &data[0], static_cast(data.size())); } else { - TBOX_ERROR("Database::putStringArray() error in database " + TBOX_ERROR("Database::putStringVector() error in database " << getName() << "\n Attempt to put zero-length array with key = " << key << std::endl); @@ -991,9 +990,8 @@ Database::getStringWithDefault( TBOX_ASSERT(!key.empty()); if (keyExists(key)) { - Array local_string = getStringArray(key); - std::string* locptr = local_string.getPointer(); - return locptr == NULL ? defaultvalue : *locptr; + std::vector local_string = getStringVector(key); + return local_string.empty() ? defaultvalue : local_string[0]; } else { return defaultvalue; } @@ -1004,12 +1002,12 @@ void Database::getStringArray( const std::string& key, std::string* data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - Array tmp = getStringArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getStringVector(key); + const size_t tsize = tmp.size(); if (nelements != tsize) { TBOX_ERROR("Database::getStringArray() error in database " @@ -1019,7 +1017,7 @@ Database::getStringArray( << "\n Actual array size = " << tsize << std::endl); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.h index 40b16a21..0746d019 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Database.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for the SAMRAI database objects * ************************************************************************/ @@ -13,17 +13,24 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include +#define INPUT_RANGE_ERROR(param_name) \ + TBOX_ERROR(getObjectName() << ": getFromInput() error\n" << param_name \ + << " out of range. Check documentation for valid input.\n") + +#define INPUT_VALUE_ERROR(param_name) \ + TBOX_ERROR(getObjectName() << ": getFromInput() error\n" << param_name \ + << " invalid value. Check documentation for valid input.\n") + namespace SAMRAI { namespace tbox { @@ -133,7 +140,7 @@ class Database /** * Return all keys in the database. */ - virtual Array + virtual std::vector getAllKeys() = 0; /** @@ -155,7 +162,7 @@ class Database * * @param key Key name in database. */ - virtual int + virtual size_t getArraySize( const std::string& key) = 0; @@ -199,6 +206,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual boost::shared_ptr getDatabaseWithDefault( @@ -222,6 +231,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putBool( @@ -229,17 +240,20 @@ class Database const bool& data); /** - * Create a boolean array entry in the database with the specified + * Create a boolean vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putBoolArray( + putBoolVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a boolean array entry in the database with the specified @@ -254,7 +268,7 @@ class Database putBoolArray( const std::string& key, const bool * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a boolean entry in the database with the specified key name. @@ -263,6 +277,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual bool getBool( @@ -273,6 +289,8 @@ class Database * If the specified key does not exist in the database, then the default * value is returned. If the key exists but is not a boolean scalar, * then an error message is printed and the program exits. + * + * @pre !key.empty() */ virtual bool getBoolWithDefault( @@ -282,13 +300,13 @@ class Database /** * Get a boolean entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a boolean array, then an error message is printed and + * is not a boolean vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getBoolArray( + virtual std::vector + getBoolVector( const std::string& key) = 0; /** @@ -301,12 +319,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getBoolArray( const std::string& key, bool* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a box entry. If @@ -325,6 +345,8 @@ class Database * * @param key Key name in database. * @param data Data to put into database. + * + * @pre !key.empty() */ virtual void putDatabaseBox( @@ -337,12 +359,15 @@ class Database * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putDatabaseBoxArray( + putDatabaseBoxVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a box array entry in the database with the specified @@ -357,7 +382,7 @@ class Database putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a box entry in the database with the specified key name. @@ -366,6 +391,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual DatabaseBox getDatabaseBox( @@ -379,6 +406,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual DatabaseBox getDatabaseBoxWithDefault( @@ -388,13 +417,13 @@ class Database /** * Get a box entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a box array, then an error message is printed and + * is not a box vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getDatabaseBoxArray( + virtual std::vector + getDatabaseBoxVector( const std::string& key) = 0; /** @@ -407,12 +436,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getDatabaseBoxArray( const std::string& key, DatabaseBox* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a character entry. If @@ -431,6 +462,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putChar( @@ -438,19 +471,22 @@ class Database const char& data); /** - * Create a character array entry in the database with the specified + * Create a character vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putCharArray( + putCharVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a character array entry in the database with the specified @@ -465,7 +501,7 @@ class Database putCharArray( const std::string& key, const char * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a character entry in the database with the specified key name. @@ -474,6 +510,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual char getChar( @@ -487,6 +525,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual char getCharWithDefault( @@ -496,13 +536,13 @@ class Database /** * Get a character entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a character array, then an error message is printed and + * is not a character vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getCharArray( + virtual std::vector + getCharVector( const std::string& key) = 0; /** @@ -515,12 +555,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getCharArray( const std::string& key, char* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a complex entry. If @@ -539,6 +581,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putComplex( @@ -546,17 +590,20 @@ class Database const dcomplex& data); /** - * Create a complex array entry in the database with the specified + * Create a complex vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putComplexArray( + putComplexVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a complex array entry in the database with the specified @@ -571,7 +618,7 @@ class Database putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a complex entry in the database with the specified key name. @@ -580,6 +627,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual dcomplex getComplex( @@ -593,6 +642,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual dcomplex getComplexWithDefault( @@ -602,13 +653,13 @@ class Database /** * Get a complex entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a complex array, then an error message is printed and + * is not a complex vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getComplexArray( + virtual std::vector + getComplexVector( const std::string& key) = 0; /** @@ -621,12 +672,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getComplexArray( const std::string& key, dcomplex* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a double entry. If @@ -645,6 +698,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putDouble( @@ -652,17 +707,20 @@ class Database const double& data); /** - * Create a double array entry in the database with the specified + * Create a double vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putDoubleArray( + putDoubleVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a double array entry in the database with the specified @@ -677,7 +735,7 @@ class Database putDoubleArray( const std::string& key, const double * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a double entry in the database with the specified key name. @@ -686,6 +744,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual double getDouble( @@ -699,6 +759,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual double getDoubleWithDefault( @@ -708,13 +770,13 @@ class Database /** * Get a double entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a double array, then an error message is printed and + * is not a double vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getDoubleArray( + virtual std::vector + getDoubleVector( const std::string& key) = 0; /** @@ -727,12 +789,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getDoubleArray( const std::string& key, double* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a float entry. If @@ -751,6 +815,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putFloat( @@ -758,17 +824,20 @@ class Database const float& data); /** - * Create a float array entry in the database with the specified + * Create a float vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putFloatArray( + putFloatVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a float array entry in the database with the specified @@ -783,7 +852,7 @@ class Database putFloatArray( const std::string& key, const float * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a float entry in the database with the specified key name. @@ -792,6 +861,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual float getFloat( @@ -805,6 +876,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual float getFloatWithDefault( @@ -814,13 +887,13 @@ class Database /** * Get a float entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a float array, then an error message is printed and + * is not a float vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getFloatArray( + virtual std::vector + getFloatVector( const std::string& key) = 0; /** @@ -833,12 +906,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getFloatArray( const std::string& key, float* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents an integer entry. If @@ -857,6 +932,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putInteger( @@ -864,17 +941,20 @@ class Database const int& data); /** - * Create an integer array entry in the database with the specified + * Create an integer vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putIntegerArray( + putIntegerVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create an integer array entry in the database with the specified @@ -889,7 +969,7 @@ class Database putIntegerArray( const std::string& key, const int * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get an integer entry in the database with the specified key name. @@ -898,6 +978,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual int getInteger( @@ -911,6 +993,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual int getIntegerWithDefault( @@ -920,13 +1004,13 @@ class Database /** * Get an integer entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not an integer array, then an error message is printed and + * is not an integer vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getIntegerArray( + virtual std::vector + getIntegerVector( const std::string& key) = 0; /** @@ -939,12 +1023,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getIntegerArray( const std::string& key, int* data, - const int nelements); + const size_t nelements); /** * Return whether the specified key represents a std::string entry. If @@ -963,6 +1049,8 @@ class Database * * @param key Key name in database. * @param data Value to put into database. + * + * @pre !key.empty() */ virtual void putString( @@ -970,17 +1058,20 @@ class Database const std::string& data); /** - * Create a string array entry in the database with the specified + * Create a string vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param data Array with data to put into database. + * @param data Vector with data to put into database. + * + * @pre !key.empty() + * @pre data.size() > 0 */ virtual void - putStringArray( + putStringVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a string array entry in the database with the specified @@ -995,7 +1086,7 @@ class Database putStringArray( const std::string& key, const std::string * const data, - const int nelements) = 0; + const size_t nelements) = 0; /** * Get a string entry in the database with the specified key name. @@ -1004,6 +1095,8 @@ class Database * exits. * * @param key Key name in database. + * + * @pre !key.empty() */ virtual std::string getString( @@ -1017,6 +1110,8 @@ class Database * * @param key Key name in database. * @param defaultvalue Default value to return if not found. + * + * @pre !key.empty() */ virtual std::string getStringWithDefault( @@ -1026,13 +1121,13 @@ class Database /** * Get a string entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a string array, then an error message is printed and + * is not a string vector, then an error message is printed and * the program exits. * * @param key Key name in database. */ - virtual Array - getStringArray( + virtual std::vector + getStringVector( const std::string& key) = 0; /** @@ -1045,12 +1140,14 @@ class Database * @param key Key name in database. * @param data Array with data to put into database. * @param nelements Number of elements to write from array. + * + * @pre !key.empty() */ virtual void getStringArray( const std::string& key, std::string* data, - const int nelements); + const size_t nelements); /** * Get a bool entry in the database with the specified key name. @@ -1089,34 +1186,34 @@ class Database /** * Get a bool entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a bool array, then an error message is printed and + * is not a bool vector, then an error message is printed and * the program exits. * * @param key Key name in database. - * @param array Returns array that was read. + * @param array Returns vector that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getBoolArray(key); + array = getBoolVector(key); } /** - * Create an bool array entry in the database with the specified + * Create a bool vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putBoolArray(key, array); + putBoolVector(key, array); } /** @@ -1156,34 +1253,34 @@ class Database /** * Get a char entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a char array, then an error message is printed and + * is not a char vector, then an error message is printed and * the program exits. * * @param key Key name in database. * @param array Returns array that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getCharArray(key); + array = getCharVector(key); } /** - * Create an char array entry in the database with the specified + * Create an char vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putCharArray(key, array); + putCharVector(key, array); } /** @@ -1223,34 +1320,34 @@ class Database /** * Get a complex entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a complex array, then an error message is printed and + * is not a complex vector, then an error message is printed and * the program exits. * * @param key Key name in database. * @param array Returns array that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getComplexArray(key); + array = getComplexVector(key); } /** - * Create an complex array entry in the database with the specified + * Create a complex vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putComplexArray(key, array); + putComplexVector(key, array); } /** @@ -1290,34 +1387,34 @@ class Database /** * Get a float entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a float array, then an error message is printed and + * is not a float vector, then an error message is printed and * the program exits. * * @param key Key name in database. - * @param array Returns array that was read. + * @param array Returns vector that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getFloatArray(key); + array = getFloatVector(key); } /** - * Create an float array entry in the database with the specified + * Create a float vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putFloatArray(key, array); + putFloatVector(key, array); } /** @@ -1357,34 +1454,34 @@ class Database /** * Get a double entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a double array, then an error message is printed and + * is not a double vector, then an error message is printed and * the program exits. * * @param key Key name in database. - * @param array Returns array that was read. + * @param array Returns vector that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getDoubleArray(key); + array = getDoubleVector(key); } /** - * Create an double array entry in the database with the specified + * Create an double vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putDoubleArray(key, array); + putDoubleVector(key, array); } /** @@ -1424,34 +1521,34 @@ class Database /** * Get a integer entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a integer array, then an error message is printed and + * is not a integer vector, then an error message is printed and * the program exits. * * @param key Key name in database. - * @param array Returns array that was read. + * @param array Returns vector that was read. */ void - getArray( + getVector( const std::string& key, - Array& array) + std::vector& array) { - array = getIntegerArray(key); + array = getIntegerVector(key); } /** - * Create an integer array entry in the database with the specified + * Create an integer vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. * * @param key Key name in database. - * @param array Array to put into database. + * @param array Vector to put into database. */ void - putArray( + putVector( const std::string& key, - const Array array) + const std::vector& array) { - putIntegerArray(key, array); + putIntegerVector(key, array); } /** @@ -1465,10 +1562,10 @@ class Database const std::string& key); /** - * Get a std::vector from the database with the specified key - * name. If the specified key does not exist in the database or - * is not a vector, then an error message is printed and - * the program exits. + * Get a std::vector of a collection of objects (as opposed to + * primitives) from the database with the specified key name. If the + * specified key does not exist in the database or is not a vector, + * then an error message is printed and the program exits. * * TYPE must implement the Database::Serializable interface. * @@ -1477,21 +1574,22 @@ class Database */ template void - getVector( + getObjectVector( const std::string& key, std::vector& vector) { size_t size = getInteger(key + "_size"); for (unsigned int i = 0; i < size; ++i) { const std::string index_str = Utilities::intToString(i); - vector[i].getFromDatabase(*this, key + "_" + index_str); + vector[i].getFromRestart(*this, key + "_" + index_str); } } /** - * Create an vector entry in the database with the specified - * key name. If the key already exists in the database, then the old - * key record is deleted and the new one is silently created in its place. + * Create a vector entry of a collection of objects (as opposed to + * primitives) in the database with the specified key name. If the + * key already exists in the database, then the old key record is + * deleted and the new one is silently created in its place. * * TYPE must implement the Database::Serializable interface. * @@ -1500,7 +1598,7 @@ class Database */ template void - putVector( + putObjectVector( const std::string& key, const std::vector& vector) { @@ -1508,7 +1606,7 @@ class Database putInteger(key + "_size", size); for (unsigned int i = 0; i < size; ++i) { const std::string index_str = Utilities::intToString(i); - vector[i].putUnregisteredToDatabase(*this, key + "_" + index_str); + vector[i].putToRestart(*this, key + "_" + index_str); } } @@ -1532,6 +1630,16 @@ class Database printClassData( std::ostream& os = pout) = 0; +private: + // Unimplemented copy constructor. + Database( + const Database& other); + + // Unimplemented assignment operator. + Database& + operator = ( + const Database& rhs); + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.C index 879b5ddb..e747f67d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A box structure representing a portion of the AMR index space * ************************************************************************/ @@ -13,42 +13,31 @@ namespace SAMRAI { namespace tbox { -DatabaseBox::DatabaseBox(): - d_dim(Dimension::getInvalidDimension()) +DatabaseBox::DatabaseBox() { d_data.d_dimension = 0; - d_data.d_lo[0] = d_data.d_hi[0] = 0; - d_data.d_lo[1] = d_data.d_hi[1] = 0; - d_data.d_lo[2] = d_data.d_hi[2] = 0; + for (int i = 0; i < MAX_DIM_VAL; ++i) { + d_data.d_lo[i] = d_data.d_hi[i] = 0; + } } DatabaseBox::DatabaseBox( - const DatabaseBox& box): - d_dim(box.d_dim) + const DatabaseBox& box) { - d_data.d_dimension = box.d_data.d_dimension; - d_data.d_lo[0] = box.d_data.d_lo[0]; - d_data.d_lo[1] = box.d_data.d_lo[1]; - d_data.d_lo[2] = box.d_data.d_lo[2]; - d_data.d_hi[0] = box.d_data.d_hi[0]; - d_data.d_hi[1] = box.d_data.d_hi[1]; - d_data.d_hi[2] = box.d_data.d_hi[2]; + d_data = box.d_data; } DatabaseBox::DatabaseBox( const Dimension& dim, const int* lower, - const int* upper): - d_dim(dim) + const int* upper) { - TBOX_ASSERT(dim.getValue() <= DatabaseBox_MAX_DIM); - d_data.d_dimension = dim.getValue(); for (int i = 0; i < d_data.d_dimension; i++) { d_data.d_lo[i] = lower[i]; d_data.d_hi[i] = upper[i]; } - for (int j = d_data.d_dimension; j < DatabaseBox_MAX_DIM; j++) { + for (int j = d_data.d_dimension; j < SAMRAI::MAX_DIM_VAL; j++) { d_data.d_lo[j] = 0; d_data.d_hi[j] = 0; } @@ -62,14 +51,7 @@ DatabaseBox& DatabaseBox::operator = ( const DatabaseBox& box) { - d_dim = box.d_dim; - d_data.d_dimension = box.d_data.d_dimension; - d_data.d_lo[0] = box.d_data.d_lo[0]; - d_data.d_lo[1] = box.d_data.d_lo[1]; - d_data.d_lo[2] = box.d_data.d_lo[2]; - d_data.d_hi[0] = box.d_data.d_hi[0]; - d_data.d_hi[1] = box.d_data.d_hi[1]; - d_data.d_hi[2] = box.d_data.d_hi[2]; + d_data = box.d_data; return *this; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.h index 5eb06424..93a56bc1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseBox.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A box structure representing a portion of the AMR index space * ************************************************************************/ @@ -15,12 +15,6 @@ #include "SAMRAI/tbox/Dimension.h" -#ifndef DatabaseBox_MAX_DIM -#define DatabaseBox_MAX_DIM 3 -#else -Macro overloaded : DatabaseBox_MAX_DIM -#endif - namespace SAMRAI { namespace tbox { @@ -33,14 +27,14 @@ namespace tbox { */ struct DatabaseBox_POD { int d_dimension; - int d_lo[DatabaseBox_MAX_DIM]; - int d_hi[DatabaseBox_MAX_DIM]; + int d_lo[SAMRAI::MAX_DIM_VAL]; + int d_hi[SAMRAI::MAX_DIM_VAL]; }; /** - * Class DatabaseBox represents a one, two, or three dimensional box in the - * AMR index space. It is defined by lower and upper bounds given by integer - * arrays. + * Class DatabaseBox represents a box of up to MAX_DIM_VAL + * dimensions in the AMR index space. It is defined by lower and + * upper bounds given by integer arrays. * * This box is an auxilliary data structure used by the database routines to * manipulate boxes. This box type removes cyclic dependencies among the @@ -62,8 +56,7 @@ class DatabaseBox /** * Create a box of the specified dimension describing the index space - * between lower and upper. The dimension argument must be zero, one, - * two, or three. + * between lower and upper. */ DatabaseBox( const Dimension& dim, @@ -90,8 +83,8 @@ class DatabaseBox /** * Return whether the box is empty. A box is empty if it has dimension - * zero or if any of the upper dimensions is less than its corresponding - * lower dimension. + * zero or if any part of the upper index is less than its corresponding + * part of the lower index. */ bool empty() const; @@ -99,67 +92,71 @@ class DatabaseBox /** * Return the dimension of this object. */ - const Dimension& - getDim() const + Dimension::dir_t + getDimVal() const { - return d_dim; + return static_cast(d_data.d_dimension); } void setDim( const Dimension& dim) { - TBOX_DIM_ASSERT_CHECK_DIM(dim); - TBOX_ASSERT(dim.getValue() <= DatabaseBox_MAX_DIM); - d_dim = Dimension(dim); - d_data.d_dimension = d_dim.getValue(); + d_data.d_dimension = dim.getValue(); } /** * Return the specified component (non-const) of the lower index of the box. + * + * @pre (i >= 0) && (i < getDimVal()) */ int& lower( const int i) { - TBOX_ASSERT((i >= 0) && (i < d_data.d_dimension)); + TBOX_ASSERT((i >= 0) && (i < getDimVal())); return d_data.d_lo[i]; } /** * Return the specified component (non-const) of the upper index of the box. + * + * @pre (i >= 0) && (i < getDimVal()) */ int& upper( const int i) { - TBOX_ASSERT((i >= 0) && (i < d_data.d_dimension)); + TBOX_ASSERT((i >= 0) && (i < getDimVal())); return d_data.d_hi[i]; } /** * Return the specified component (const) of the lower index of the box. + * + * @pre (i >= 0) && (i < getDimVal()) */ int lower( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_data.d_dimension)); + TBOX_ASSERT((i >= 0) && (i < getDimVal())); return d_data.d_lo[i]; } /** * Return the specified component (const) of the upper index of the box. + * + * @pre (i >= 0) && (i < getDimVal()) */ int upper( const int i) const { - TBOX_ASSERT((i >= 0) && (i < d_data.d_dimension)); + TBOX_ASSERT((i >= 0) && (i < getDimVal())); return d_data.d_hi[i]; } - /** * Check whether two boxes represent the same portion of index space. */ @@ -179,8 +176,6 @@ class DatabaseBox * mirror this structure in defining a compound type for HDF. */ DatabaseBox_POD d_data; - - Dimension d_dim; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.C index 8510cdc6..86f72167 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for a DatabaseFactory * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.h index 151ac9dc..b97583bd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/DatabaseFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for a DatabaseFactory * ************************************************************************/ @@ -28,22 +28,32 @@ namespace tbox { class DatabaseFactory { public: - /** - * Default constructor - */ - DatabaseFactory(); + /** + * Default constructor + */ + DatabaseFactory(); - /** + /** * Destructor */ - virtual ~DatabaseFactory(); + virtual ~DatabaseFactory(); - /** + /** * Build a new Database instance. */ - virtual boost::shared_ptr - allocate( - const std::string& name) = 0; + virtual boost::shared_ptr + allocate( + const std::string& name) = 0; + +private: + // Unimplemented copy constructor. + DatabaseFactory( + const DatabaseFactory& other); + + // Unimplemented assignment operator. + DatabaseFactory& + operator = ( + const DatabaseFactory& rhs); }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.C index 6f211191..6a2e37b8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.C @@ -3,34 +3,24 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: A smart pointer template class with RTTI + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Dimension class for abstracting dimension * ************************************************************************/ - -#ifndef included_tbox_Dimension_C -#define included_tbox_Dimension_C - #include "SAMRAI/tbox/Dimension.h" namespace SAMRAI { namespace tbox { -Dimension::Dimension(): - d_dim(Dimension::getInvalidDimValue()) -{ -} - Dimension::Dimension( - const unsigned short& dim):d_dim(dim) { - TBOX_DIM_ASSERT((!isValid()) || - (d_dim > 0 && d_dim <= Dimension::getMaxDimValue())); + const unsigned short& dim):d_dim(dim) +{ + TBOX_DIM_ASSERT(dim > 0 && dim <= SAMRAI::MAX_DIM_VAL); } Dimension::Dimension( - const Dimension& dimension):d_dim(dimension.d_dim) { - TBOX_DIM_ASSERT((!isValid()) || - (d_dim > 0 && d_dim <= Dimension::getMaxDimValue())); + const Dimension& dimension):d_dim(dimension.d_dim) +{ } std::ostream& @@ -44,5 +34,3 @@ operator << ( } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.h index 125ec030..ad583893 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Dimension.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Dimension class for abstracting dimension * ************************************************************************/ @@ -18,27 +18,6 @@ #include #include -/* - * Forward declarations, which are questionable with respect to SAMRAI - * package ordering. These are needed since pdat::ArrayData and - * hier::IntVector classes need to access private Dimension assignment - * constructor. - * - * It would be good to come up with an alternative to this. - */ -namespace SAMRAI { - -namespace hier { -class IntVector; -} - -namespace pdat { -template -class ArrayData; -} - -} - namespace SAMRAI { namespace tbox { @@ -64,6 +43,9 @@ class DatabaseBox; class Dimension { public: + //! @brief Primitive type for direction or dimension. + typedef unsigned short int dir_t; + /** * Constructor for Dimension, object is built using the specified dimension * @@ -71,11 +53,7 @@ class Dimension * type conversions from integers impossible. This is intentionally to * avoid unintended conversions. * - * When dimensional assertion checking is active an assert is - * thrown when dim < 1 or dim > getMaxDimension() value specified when - * the library is configured (defaults to 3). dim also cannot be - * the getInvalidDimension() (the largest unsigned short value). - * + * @pre (dim > 0) && (dim <= SAMRAI::MAX_DIM_VAL) */ explicit Dimension( const unsigned short& dim); @@ -86,30 +64,6 @@ class Dimension Dimension( const Dimension& dimension); - /** - * Returns true if Dimension is valid. - * - * A valid Dimension != 0; != getInvalidDimension(), - * and <= getMaxDimension(). - * - */ - bool - isValid() const - { - return (d_dim != 0) && (d_dim <= Dimension::getMaxDimValue()); - } - - /** - * Returns true if Dimension is initialized (not set - * to getInvalidDimension()). - * - */ - bool - isInitialized() const - { - return d_dim != Dimension::getInvalidDimValue(); - } - /** * Equality operator. */ @@ -117,8 +71,6 @@ class Dimension operator == ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim == rhs.d_dim; } @@ -129,8 +81,6 @@ class Dimension operator != ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim != rhs.d_dim; } @@ -141,8 +91,6 @@ class Dimension operator > ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim > rhs.d_dim; } @@ -153,8 +101,6 @@ class Dimension operator >= ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim >= rhs.d_dim; } @@ -165,8 +111,6 @@ class Dimension operator < ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim < rhs.d_dim; } @@ -177,8 +121,6 @@ class Dimension operator <= ( const Dimension& rhs) const { - TBOX_DIM_ASSERT_CHECK_DIM(*this); - TBOX_DIM_ASSERT_CHECK_DIM(rhs); return d_dim <= rhs.d_dim; } @@ -196,26 +138,6 @@ class Dimension return d_dim; } - /** - * Returns the maximum dimension for the currently compiled library - * as an unsigned short. - * - * When the SAMRAI library is compiled a maximum dimension allowed - * is specified (the default is 3). This method is typically used - * to allocate arrays. - * - * double array[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - * - * The value must be >= 1 and < numeric_limits::max() - */ - static const unsigned short MAXIMUM_DIMENSION_VALUE = - SAMRAI_MAXIMUM_DIMENSION; - static unsigned short - getMaxDimValue() - { - return SAMRAI_MAXIMUM_DIMENSION; - } - /** * Returns the maximum dimension for the currently compiled library * as a Dimension object. @@ -228,49 +150,10 @@ class Dimension static const Dimension& getMaxDimension() { - static Dimension dim(SAMRAI_MAXIMUM_DIMENSION); + static Dimension dim(SAMRAI::MAX_DIM_VAL); return dim; } - /** - * An invalid dimension value as a Dimension object. - */ - static const Dimension& - getInvalidDimension() - { - static Dimension invalidDim(Dimension::getInvalidDimValue()); - return invalidDim; - } - - /** - * An invalid dimension value as an unsigned short. - * - * Currently this value is numeric_limits::max() but - * use this symbol as it is more readable. - * - */ - static unsigned short - getInvalidDimValue() - { - static unsigned short invalid = - std::numeric_limits::max(); - return invalid; - } - - /* - * Classes that are friends of dimension in order to access th - * private ctor which builds invalid dimensions. - * - * This is obviously not a very good design but so far - * a better solution has been elusive. Allowing - * any code to create invalid dimensions seemed too - * error prone. - */ - template - friend class pdat::ArrayData; - friend class hier::IntVector; - friend class DatabaseBox; - /** * Output operator for debugging and error messages. */ @@ -280,13 +163,8 @@ class Dimension const Dimension& rhs); private: - /** - * @brief Create an invalid dimension object. - * - * This ctor is private to prevent a default constructor call. - * Currently Dimension objects must always created with a dimension - * specified for normal code. Several special classes are allowed - * and are declared to be friends to access this ctor. + /* + * Unimplemented default constructor. */ Dimension(); @@ -303,9 +181,7 @@ class Dimension return *this; } - unsigned short d_dim; - - static Dimension s_maximum_dimension; + dir_t d_dim; }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.C index 04a6d30b..e13ed9fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.C @@ -1,10 +1,12 @@ #ifdef __GNUC__ +#ifndef __INTEL_COMPILER #if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ > 0))) #pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wconversion" #endif #endif +#endif #ifdef __INTEL_COMPILER // Ignore Intel warnings about unreachable statements @@ -173,10 +175,10 @@ // -// File: $URL$ -// Package: SAMRAI toolbox -// Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - +// This file is part of the SAMRAI distribution. For full copyright +// information, see COPYRIGHT and COPYING.LESSER. +// +// Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC // Description: Yacc grammar description for the input database // @@ -192,7 +194,6 @@ typedef ostringstream ostrstream; #endif #include "SAMRAI/tbox/Dimension.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Parser.h" @@ -258,7 +259,7 @@ static void to_complex(KeyData*); static KeyData* binary_op(KeyData*, KeyData*, const int); static KeyData* compare_op(KeyData*, KeyData*, const int); static KeyData* eval_function(KeyData*, const string&); -static KeyData* lookup_variable(const string&, const int, const bool); +static KeyData* lookup_variable(const string&, const size_t, const bool); @@ -608,11 +609,11 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 160, 160, 167, 169, 179, 179, 198, 198, 283, - 299, 302, 378, 381, 385, 391, 394, 398, 398, 412, - 417, 424, 431, 434, 438, 442, 445, 449, 452, 463, - 466, 469, 472, 475, 499, 507, 515, 518, 526, 529, - 537, 545, 561, 579, 615 + 0, 158, 158, 165, 167, 177, 177, 196, 196, 281, + 297, 300, 376, 379, 383, 389, 392, 396, 396, 410, + 415, 422, 429, 432, 436, 440, 443, 447, 450, 461, + 464, 467, 470, 473, 497, 505, 513, 516, 524, 527, + 535, 543, 559, 577, 613 }; #endif @@ -1649,68 +1650,68 @@ yyreduce: switch (list->d_array_type) { case KEY_BOOL: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_bool; list = list->d_next; } - Parser::getParser()->getScope()->putBoolArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putBoolVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_BOX: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_box; list = list->d_next; } - Parser::getParser()->getScope()->putDatabaseBoxArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putDatabaseBoxVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_CHAR: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_char; list = list->d_next; } - Parser::getParser()->getScope()->putCharArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putCharVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_COMPLEX: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { to_complex(list); data[i] = list->d_complex; list = list->d_next; } - Parser::getParser()->getScope()->putComplexArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putComplexVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_DOUBLE: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { to_double(list); data[i] = list->d_double; list = list->d_next; } - Parser::getParser()->getScope()->putDoubleArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putDoubleVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_INTEGER: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_integer; list = list->d_next; } - Parser::getParser()->getScope()->putIntegerArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putIntegerVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } case KEY_STRING: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_string; list = list->d_next; } - Parser::getParser()->getScope()->putStringArray(*(yyvsp[(1) - (4)].u_keyword), data); + Parser::getParser()->getScope()->putStringVector(*(yyvsp[(1) - (4)].u_keyword), data); break; } default: @@ -1760,7 +1761,7 @@ yyreduce: Parser::getParser()->error("Type mismatch in box array"); delete (yyvsp[(3) - (3)].u_keydata); (yyval.u_keydata) = (yyvsp[(1) - (3)].u_keydata); - } else if ((yyvsp[(3) - (3)].u_keydata)->d_box.getDim() != (yyvsp[(1) - (3)].u_keydata)->d_box.getDim()) { + } else if ((yyvsp[(3) - (3)].u_keydata)->d_box.getDimVal() != (yyvsp[(1) - (3)].u_keydata)->d_box.getDimVal()) { Parser::getParser()->error("Box array dimension mismatch"); delete (yyvsp[(3) - (3)].u_keydata); (yyval.u_keydata) = (yyvsp[(1) - (3)].u_keydata); @@ -1998,7 +1999,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_BOOL; (yyval.u_keydata)->d_array_type = KEY_BOOL; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_bool = true; } break; @@ -2010,7 +2011,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_BOOL; (yyval.u_keydata)->d_array_type = KEY_BOOL; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_bool = false; } break; @@ -2029,7 +2030,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_CHAR; (yyval.u_keydata)->d_array_type = KEY_CHAR; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_char = (yyvsp[(1) - (1)].u_char); } break; @@ -2048,7 +2049,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_DOUBLE; (yyval.u_keydata)->d_array_type = KEY_DOUBLE; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_double = (yyvsp[(1) - (1)].u_double); } break; @@ -2060,7 +2061,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_INTEGER; (yyval.u_keydata)->d_array_type = KEY_INTEGER; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_integer = (yyvsp[(1) - (1)].u_integer); } break; @@ -2072,7 +2073,7 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_STRING; (yyval.u_keydata)->d_array_type = KEY_STRING; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; (yyval.u_keydata)->d_string = *(yyvsp[(1) - (1)].u_string); delete (yyvsp[(1) - (1)].u_string); } @@ -2098,12 +2099,12 @@ yyreduce: (yyval.u_keydata)->d_node_type = KEY_BOX; (yyval.u_keydata)->d_array_type = KEY_BOX; (yyval.u_keydata)->d_array_size = 1; - (yyval.u_keydata)->d_next = NULL; + (yyval.u_keydata)->d_next = 0; if ((yyvsp[(2) - (5)].u_keydata)->d_array_size != (yyvsp[(4) - (5)].u_keydata)->d_array_size) { Parser::getParser()->error("Box lower/upper dimension mismatch"); - } else if ((yyvsp[(2) - (5)].u_keydata)->d_array_size > 3) { - Parser::getParser()->error("Box dimension too large (> 3)"); + } else if ((yyvsp[(2) - (5)].u_keydata)->d_array_size > SAMRAI::MAX_DIM_VAL) { + Parser::getParser()->error("Box dimension too large (> SAMRAI::MAX_DIM_VAL)"); } else { const int n = (yyvsp[(2) - (5)].u_keydata)->d_array_size; const Dimension dim(static_cast(n)); @@ -2661,26 +2662,26 @@ struct arith_functions { // compiler; so use an initialization function to // create the table static arith_functions af[] = { - { "abs" , fabs , NULL, abs }, - { "acos" , acos , NULL, NULL }, - { "asin" , asin , NULL, NULL }, - { "atan" , atan , NULL, NULL }, - { "ceil" , ceil , NULL, NULL }, - { "conj" , NULL , conj, NULL }, - { "cos" , cos , cos , NULL }, - { "cosh" , cosh , cosh, NULL }, - { "exp" , exp , exp , NULL }, - { "fabs" , fabs , NULL, NULL }, - { "floor", floor, NULL, NULL }, - { "imag" , NULL , NULL, imag }, - { "log10", log10, NULL, NULL }, - { "log" , log , log , NULL }, - { "real" , NULL , NULL, real }, - { "sin" , sin , sin , NULL }, - { "sinh" , sinh , sinh, NULL }, - { "sqrt" , sqrt , sqrt, NULL }, - { "tan" , tan , NULL, NULL }, - { "" , NULL , NULL, NULL } + { "abs" , fabs , 0 , abs }, + { "acos" , acos , 0 , 0 }, + { "asin" , asin , 0 , 0 }, + { "atan" , atan , 0 , 0 }, + { "ceil" , ceil , 0 , 0 }, + { "conj" , 0 , conj, 0 }, + { "cos" , cos , cos , 0 }, + { "cosh" , cosh , cosh, 0 }, + { "exp" , exp , exp , 0 }, + { "fabs" , fabs , 0 , 0 }, + { "floor", floor, 0 , 0 }, + { "imag" , 0 , 0 , imag }, + { "log10", log10, 0 , 0 }, + { "log" , log , log , 0 }, + { "real" , 0 , 0 , real }, + { "sin" , sin , sin , 0 }, + { "sinh" , sinh , sinh, 0 }, + { "sqrt" , sqrt , sqrt, 0 }, + { "tan" , tan , 0 , 0 }, + { "" , 0 , 0 , 0 } }; #endif @@ -2702,105 +2703,105 @@ void parser_static_table_initialize() { af[0].d_name = "abs"; af[0].d_r2r_func = fabs; - af[0].d_c2c_func = NULL; + af[0].d_c2c_func = 0; af[0].d_c2r_func = std::abs; af[1].d_name = "acos"; af[1].d_r2r_func = acos; - af[1].d_c2c_func = NULL; - af[1].d_c2r_func = NULL; + af[1].d_c2c_func = 0; + af[1].d_c2r_func = 0; af[2].d_name = "asin"; af[2].d_r2r_func = asin; - af[2].d_c2c_func = NULL; - af[2].d_c2r_func = NULL; + af[2].d_c2c_func = 0; + af[2].d_c2r_func = 0; af[3].d_name = "atan"; af[3].d_r2r_func = atan; - af[3].d_c2c_func = NULL; - af[3].d_c2r_func = NULL; + af[3].d_c2c_func = 0; + af[3].d_c2r_func = 0; af[4].d_name = "ceil"; af[4].d_r2r_func = ceil; - af[4].d_c2c_func = NULL; - af[4].d_c2r_func = NULL; + af[4].d_c2c_func = 0; + af[4].d_c2r_func = 0; af[5].d_name = "conj"; - af[5].d_r2r_func = NULL; + af[5].d_r2r_func = 0; af[5].d_c2c_func = conj; - af[5].d_c2r_func = NULL; + af[5].d_c2r_func = 0; af[6].d_name = "cos"; af[6].d_r2r_func = ::cos; af[6].d_c2c_func = std::cos; - af[6].d_c2r_func = NULL; + af[6].d_c2r_func = 0; af[7].d_name = "cosh"; af[7].d_r2r_func = ::cosh; af[7].d_c2c_func = std::cosh; - af[7].d_c2r_func = NULL; + af[7].d_c2r_func = 0; af[8].d_name = "exp"; af[8].d_r2r_func = ::exp; af[8].d_c2c_func = std::exp; - af[8].d_c2r_func = NULL; + af[8].d_c2r_func = 0; af[9].d_name = "fabs"; af[9].d_r2r_func = fabs; - af[9].d_c2c_func = NULL; - af[9].d_c2r_func = NULL; + af[9].d_c2c_func = 0; + af[9].d_c2r_func = 0; af[10].d_name = "floor"; af[10].d_r2r_func = floor; - af[10].d_c2c_func = NULL; - af[10].d_c2r_func = NULL; + af[10].d_c2c_func = 0; + af[10].d_c2r_func = 0; af[11].d_name = "imag"; - af[11].d_r2r_func = NULL; - af[11].d_c2c_func = NULL; + af[11].d_r2r_func = 0; + af[11].d_c2c_func = 0; af[11].d_c2r_func = imag_thunk; af[12].d_name = "log10"; af[12].d_r2r_func = ::log10; - af[12].d_c2c_func = NULL; - af[12].d_c2r_func = NULL; + af[12].d_c2c_func = 0; + af[12].d_c2r_func = 0; af[13].d_name = "log"; af[13].d_r2r_func = ::log; af[13].d_c2c_func = std::log; - af[13].d_c2r_func = NULL; + af[13].d_c2r_func = 0; af[14].d_name = "real"; - af[14].d_r2r_func = NULL; - af[14].d_c2c_func = NULL; + af[14].d_r2r_func = 0; + af[14].d_c2c_func = 0; af[14].d_c2r_func = real_thunk; af[15].d_name = "sin"; af[15].d_r2r_func = ::sin; af[15].d_c2c_func = std::sin; - af[15].d_c2r_func = NULL; + af[15].d_c2r_func = 0; af[16].d_name = "sinh"; af[16].d_r2r_func = ::sinh; af[16].d_c2c_func = std::sinh; - af[16].d_c2r_func = NULL; + af[16].d_c2r_func = 0; af[17].d_name = "sqrt"; af[17].d_r2r_func = ::sqrt; af[17].d_c2c_func = std::sqrt; - af[17].d_c2r_func = NULL; + af[17].d_c2r_func = 0; af[18].d_name = "tan"; af[18].d_r2r_func = tan; - af[18].d_c2c_func = NULL; - af[18].d_c2r_func = NULL; + af[18].d_c2c_func = 0; + af[18].d_c2r_func = 0; af[19].d_name = ""; - af[19].d_r2r_func = NULL; - af[19].d_c2c_func = NULL; - af[19].d_c2r_func = NULL; + af[19].d_r2r_func = 0; + af[19].d_c2c_func = 0; + af[19].d_c2r_func = 0; } static KeyData* eval_function(KeyData* arg, const string& func) @@ -2865,13 +2866,13 @@ static KeyData* eval_function(KeyData* arg, const string& func) */ static KeyData* lookup_variable( - const string& key, const int index, const bool is_array) + const string& key, const size_t index, const bool is_array) { KeyData* result = new KeyData; result->d_node_type = KEY_INTEGER; result->d_array_type = KEY_INTEGER; result->d_array_size = 1; - result->d_next = NULL; + result->d_next = 0; result->d_integer = 0; Parser *parser = Parser::getParser(); @@ -2887,7 +2888,7 @@ static KeyData* lookup_variable( tmp += key; tmp += "'' is not a scalar value"; parser->error(tmp); - } else if ((index < 0) || (index >= db->getArraySize(key))) { + } else if (index >= db->getArraySize(key)) { ostrstream oss; oss << index; string tmp("Variable ``"); @@ -2897,37 +2898,37 @@ static KeyData* lookup_variable( tmp += "]'' out of range"; parser->error(tmp); } else if (db->isInteger(key)) { - result->d_integer = db->getIntegerArray(key)[index]; + result->d_integer = db->getIntegerVector(key)[index]; result->d_node_type = KEY_INTEGER; result->d_array_type = KEY_INTEGER; } else if (db->isDouble(key)) { - result->d_double = db->getDoubleArray(key)[index]; + result->d_double = db->getDoubleVector(key)[index]; result->d_node_type = KEY_DOUBLE; result->d_array_type = KEY_DOUBLE; } else if (db->isComplex(key)) { - result->d_complex = db->getComplexArray(key)[index]; + result->d_complex = db->getComplexVector(key)[index]; result->d_node_type = KEY_COMPLEX; result->d_array_type = KEY_COMPLEX; } else if (db->isBool(key)) { - result->d_bool = db->getBoolArray(key)[index]; + result->d_bool = db->getBoolVector(key)[index]; result->d_node_type = KEY_BOOL; result->d_array_type = KEY_BOOL; } else if (db->isDatabaseBox(key)) { - result->d_box = db->getDatabaseBoxArray(key)[index]; + result->d_box = db->getDatabaseBoxVector(key)[index]; result->d_node_type = KEY_BOX; result->d_array_type = KEY_BOX; } else if (db->isChar(key)) { - result->d_char = db->getCharArray(key)[index]; + result->d_char = db->getCharVector(key)[index]; result->d_node_type = KEY_CHAR; result->d_array_type = KEY_CHAR; } else if (db->isString(key)) { - result->d_string = db->getStringArray(key)[index]; + result->d_string = db->getStringVector(key)[index]; result->d_node_type = KEY_STRING; result->d_array_type = KEY_STRING; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.y b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.y index 2bae2228..8bad46cc 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.y +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Grammar.y @@ -1,10 +1,10 @@ %{ // -// File: $URL$ -// Package: SAMRAI toolbox -// Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -// Revision: $LastChangedRevision$ -// Description: Yacc grammar description for the input database +// This file is part of the SAMRAI distribution. For full copyright +// information, see COPYRIGHT and COPYING.LESSER. +// +// Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +// Description: Yacc grammar description for the input database // #include "SAMRAI/SAMRAI_config.h" @@ -19,7 +19,6 @@ typedef ostringstream ostrstream; #endif #include "SAMRAI/tbox/Dimension.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Parser.h" @@ -207,68 +206,68 @@ P_DEFINITION switch (list->d_array_type) { case KEY_BOOL: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_bool; list = list->d_next; } - Parser::getParser()->getScope()->putBoolArray(*$1, data); + Parser::getParser()->getScope()->putBoolVector(*$1, data); break; } case KEY_BOX: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_box; list = list->d_next; } - Parser::getParser()->getScope()->putDatabaseBoxArray(*$1, data); + Parser::getParser()->getScope()->putDatabaseBoxVector(*$1, data); break; } case KEY_CHAR: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_char; list = list->d_next; } - Parser::getParser()->getScope()->putCharArray(*$1, data); + Parser::getParser()->getScope()->putCharVector(*$1, data); break; } case KEY_COMPLEX: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { to_complex(list); data[i] = list->d_complex; list = list->d_next; } - Parser::getParser()->getScope()->putComplexArray(*$1, data); + Parser::getParser()->getScope()->putComplexVector(*$1, data); break; } case KEY_DOUBLE: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { to_double(list); data[i] = list->d_double; list = list->d_next; } - Parser::getParser()->getScope()->putDoubleArray(*$1, data); + Parser::getParser()->getScope()->putDoubleVector(*$1, data); break; } case KEY_INTEGER: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_integer; list = list->d_next; } - Parser::getParser()->getScope()->putIntegerArray(*$1, data); + Parser::getParser()->getScope()->putIntegerVector(*$1, data); break; } case KEY_STRING: { - Array data(n); + std::vector data(n); for (int i = n-1; i >= 0; i--) { data[i] = list->d_string; list = list->d_next; } - Parser::getParser()->getScope()->putStringArray(*$1, data); + Parser::getParser()->getScope()->putStringVector(*$1, data); break; } default: @@ -318,7 +317,7 @@ P_EXPRESSION_LIST Parser::getParser()->error("Type mismatch in box array"); delete $3; $$ = $1; - } else if ($3->d_box.getDim() != $1->d_box.getDim()) { + } else if ($3->d_box.getDimVal() != $1->d_box.getDimVal()) { Parser::getParser()->error("Box array dimension mismatch"); delete $3; $$ = $1; @@ -500,7 +499,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_BOOL; $$->d_array_type = KEY_BOOL; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_bool = true; } | T_FALSE { @@ -508,7 +507,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_BOOL; $$->d_array_type = KEY_BOOL; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_bool = false; } | P_BOX { @@ -519,7 +518,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_CHAR; $$->d_array_type = KEY_CHAR; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_char = $1; } | P_COMPLEX { @@ -530,7 +529,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_DOUBLE; $$->d_array_type = KEY_DOUBLE; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_double = $1; } | T_INTEGER { @@ -538,7 +537,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_INTEGER; $$->d_array_type = KEY_INTEGER; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_integer = $1; } | T_STRING { @@ -546,7 +545,7 @@ P_PRIMITIVE_TYPE $$->d_node_type = KEY_STRING; $$->d_array_type = KEY_STRING; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; $$->d_string = *$1; delete $1; } @@ -580,12 +579,12 @@ P_BOX $$->d_node_type = KEY_BOX; $$->d_array_type = KEY_BOX; $$->d_array_size = 1; - $$->d_next = NULL; + $$->d_next = 0; if ($2->d_array_size != $4->d_array_size) { Parser::getParser()->error("Box lower/upper dimension mismatch"); - } else if ($2->d_array_size > 3) { - Parser::getParser()->error("Box dimension too large (> 3)"); + } else if ($2->d_array_size > SAMRAI::MAX_DIM_VAL) { + Parser::getParser()->error("Box dimension too large (> SAMRAI::MAX_DIM_VAL)"); } else { const int n = $2->d_array_size; const tbox::Dimension dim(static_cast(n)); @@ -929,26 +928,26 @@ struct arith_functions { // compiler; so use an initialization function to // create the table static arith_functions af[] = { - { "abs" , fabs , NULL, abs }, - { "acos" , acos , NULL, NULL }, - { "asin" , asin , NULL, NULL }, - { "atan" , atan , NULL, NULL }, - { "ceil" , ceil , NULL, NULL }, - { "conj" , NULL , conj, NULL }, - { "cos" , cos , cos , NULL }, - { "cosh" , cosh , cosh, NULL }, - { "exp" , exp , exp , NULL }, - { "fabs" , fabs , NULL, NULL }, - { "floor", floor, NULL, NULL }, - { "imag" , NULL , NULL, imag }, - { "log10", log10, NULL, NULL }, - { "log" , log , log , NULL }, - { "real" , NULL , NULL, real }, - { "sin" , sin , sin , NULL }, - { "sinh" , sinh , sinh, NULL }, - { "sqrt" , sqrt , sqrt, NULL }, - { "tan" , tan , NULL, NULL }, - { "" , NULL , NULL, NULL } + { "abs" , fabs , 0 , abs }, + { "acos" , acos , 0 , 0 }, + { "asin" , asin , 0 , 0 }, + { "atan" , atan , 0 , 0 }, + { "ceil" , ceil , 0 , 0 }, + { "conj" , 0 , conj, 0 }, + { "cos" , cos , cos , 0 }, + { "cosh" , cosh , cosh, 0 }, + { "exp" , exp , exp , 0 }, + { "fabs" , fabs , 0 , 0 }, + { "floor", floor, 0 , 0 }, + { "imag" , 0 , 0 , imag }, + { "log10", log10, 0 , 0 }, + { "log" , log , log , 0 }, + { "real" , 0 , 0 , real }, + { "sin" , sin , sin , 0 }, + { "sinh" , sinh , sinh, 0 }, + { "sqrt" , sqrt , sqrt, 0 }, + { "tan" , tan , 0 , 0 }, + { "" , 0 , 0 , 0 } }; #endif @@ -970,105 +969,105 @@ void parser_static_table_initialize() { af[0].d_name = "abs"; af[0].d_r2r_func = fabs; - af[0].d_c2c_func = NULL; + af[0].d_c2c_func = 0; af[0].d_c2r_func = std::abs; af[1].d_name = "acos"; af[1].d_r2r_func = acos; - af[1].d_c2c_func = NULL; - af[1].d_c2r_func = NULL; + af[1].d_c2c_func = 0; + af[1].d_c2r_func = 0; af[2].d_name = "asin"; af[2].d_r2r_func = asin; - af[2].d_c2c_func = NULL; - af[2].d_c2r_func = NULL; + af[2].d_c2c_func = 0; + af[2].d_c2r_func = 0; af[3].d_name = "atan"; af[3].d_r2r_func = atan; - af[3].d_c2c_func = NULL; - af[3].d_c2r_func = NULL; + af[3].d_c2c_func = 0; + af[3].d_c2r_func = 0; af[4].d_name = "ceil"; af[4].d_r2r_func = ceil; - af[4].d_c2c_func = NULL; - af[4].d_c2r_func = NULL; + af[4].d_c2c_func = 0; + af[4].d_c2r_func = 0; af[5].d_name = "conj"; - af[5].d_r2r_func = NULL; + af[5].d_r2r_func = 0; af[5].d_c2c_func = conj; - af[5].d_c2r_func = NULL; + af[5].d_c2r_func = 0; af[6].d_name = "cos"; af[6].d_r2r_func = ::cos; af[6].d_c2c_func = std::cos; - af[6].d_c2r_func = NULL; + af[6].d_c2r_func = 0; af[7].d_name = "cosh"; af[7].d_r2r_func = ::cosh; af[7].d_c2c_func = std::cosh; - af[7].d_c2r_func = NULL; + af[7].d_c2r_func = 0; af[8].d_name = "exp"; af[8].d_r2r_func = ::exp; af[8].d_c2c_func = std::exp; - af[8].d_c2r_func = NULL; + af[8].d_c2r_func = 0; af[9].d_name = "fabs"; af[9].d_r2r_func = fabs; - af[9].d_c2c_func = NULL; - af[9].d_c2r_func = NULL; + af[9].d_c2c_func = 0; + af[9].d_c2r_func = 0; af[10].d_name = "floor"; af[10].d_r2r_func = floor; - af[10].d_c2c_func = NULL; - af[10].d_c2r_func = NULL; + af[10].d_c2c_func = 0; + af[10].d_c2r_func = 0; af[11].d_name = "imag"; - af[11].d_r2r_func = NULL; - af[11].d_c2c_func = NULL; + af[11].d_r2r_func = 0; + af[11].d_c2c_func = 0; af[11].d_c2r_func = imag_thunk; af[12].d_name = "log10"; af[12].d_r2r_func = ::log10; - af[12].d_c2c_func = NULL; - af[12].d_c2r_func = NULL; + af[12].d_c2c_func = 0; + af[12].d_c2r_func = 0; af[13].d_name = "log"; af[13].d_r2r_func = ::log; af[13].d_c2c_func = std::log; - af[13].d_c2r_func = NULL; + af[13].d_c2r_func = 0; af[14].d_name = "real"; - af[14].d_r2r_func = NULL; - af[14].d_c2c_func = NULL; + af[14].d_r2r_func = 0; + af[14].d_c2c_func = 0; af[14].d_c2r_func = real_thunk; af[15].d_name = "sin"; af[15].d_r2r_func = ::sin; af[15].d_c2c_func = std::sin; - af[15].d_c2r_func = NULL; + af[15].d_c2r_func = 0; af[16].d_name = "sinh"; af[16].d_r2r_func = ::sinh; af[16].d_c2c_func = std::sinh; - af[16].d_c2r_func = NULL; + af[16].d_c2r_func = 0; af[17].d_name = "sqrt"; af[17].d_r2r_func = ::sqrt; af[17].d_c2c_func = std::sqrt; - af[17].d_c2r_func = NULL; + af[17].d_c2r_func = 0; af[18].d_name = "tan"; af[18].d_r2r_func = tan; - af[18].d_c2c_func = NULL; - af[18].d_c2r_func = NULL; + af[18].d_c2c_func = 0; + af[18].d_c2r_func = 0; af[19].d_name = ""; - af[19].d_r2r_func = NULL; - af[19].d_c2c_func = NULL; - af[19].d_c2r_func = NULL; + af[19].d_r2r_func = 0; + af[19].d_c2c_func = 0; + af[19].d_c2r_func = 0; } static KeyData* eval_function(KeyData* arg, const string& func) @@ -1139,7 +1138,7 @@ static KeyData* lookup_variable( result->d_node_type = KEY_INTEGER; result->d_array_type = KEY_INTEGER; result->d_array_size = 1; - result->d_next = NULL; + result->d_next = 0; result->d_integer = 0; Parser *parser = Parser::getParser(); @@ -1165,37 +1164,37 @@ static KeyData* lookup_variable( tmp += "]'' out of range"; parser->error(tmp); } else if (db->isInteger(key)) { - result->d_integer = db->getIntegerArray(key)[index]; + result->d_integer = db->getIntegerVector(key)[index]; result->d_node_type = KEY_INTEGER; result->d_array_type = KEY_INTEGER; } else if (db->isDouble(key)) { - result->d_double = db->getDoubleArray(key)[index]; + result->d_double = db->getDoubleVector(key)[index]; result->d_node_type = KEY_DOUBLE; result->d_array_type = KEY_DOUBLE; } else if (db->isComplex(key)) { - result->d_complex = db->getComplexArray(key)[index]; + result->d_complex = db->getComplexVector(key)[index]; result->d_node_type = KEY_COMPLEX; result->d_array_type = KEY_COMPLEX; } else if (db->isBool(key)) { - result->d_bool = db->getBoolArray(key)[index]; + result->d_bool = db->getBoolVector(key)[index]; result->d_node_type = KEY_BOOL; result->d_array_type = KEY_BOOL; } else if (db->isDatabaseBox(key)) { - result->d_box = db->getDatabaseBoxArray(key)[index]; + result->d_box = db->getDatabaseBoxVector(key)[index]; result->d_node_type = KEY_BOX; result->d_array_type = KEY_BOX; } else if (db->isChar(key)) { - result->d_char = db->getCharArray(key)[index]; + result->d_char = db->getCharVector(key)[index]; result->d_node_type = KEY_CHAR; result->d_array_type = KEY_CHAR; } else if (db->isString(key)) { - result->d_string = db->getStringArray(key)[index]; + result->d_string = db->getStringVector(key)[index]; result->d_node_type = KEY_STRING; result->d_array_type = KEY_STRING; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.C index b559cca1..ff6b24fe 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A database structure that stores HDF5 format data. * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" #include #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -59,10 +59,10 @@ { \ herr_t (* H5E_saved_efunc)( \ hid_t, \ - void *) = NULL; \ - void* H5E_saved_edata = NULL; \ + void *) = 0; \ + void* H5E_saved_edata = 0; \ H5Eget_auto(H5E_DEFAULT, &H5E_saved_efunc, &H5E_saved_edata); \ - H5Eset_auto(H5E_DEFAULT, NULL, NULL); + H5Eset_auto(H5E_DEFAULT, 0, 0); #define END_SUPPRESS_HDF5_WARNINGS \ H5Eset_auto(H5E_DEFAULT, H5E_saved_efunc, H5E_saved_edata); \ @@ -71,10 +71,10 @@ #define BEGIN_SUPPRESS_HDF5_WARNINGS \ { \ herr_t (* H5E_saved_efunc)( \ - void *) = NULL; \ - void* H5E_saved_edata = NULL; \ + void *) = 0; \ + void* H5E_saved_edata = 0; \ H5Eget_auto(&H5E_saved_efunc, &H5E_saved_edata); \ - H5Eset_auto(NULL, NULL); + H5Eset_auto(0, 0); #define END_SUPPRESS_HDF5_WARNINGS \ H5Eset_auto(H5E_saved_efunc, H5E_saved_edata); \ @@ -126,7 +126,7 @@ HDFDatabase::iterateKeys( const char* name, void* void_database) { - TBOX_ASSERT(name != (char *)NULL); + TBOX_ASSERT(name != 0); HDFDatabase* database = (HDFDatabase *)(void_database); @@ -156,7 +156,7 @@ HDFDatabase::iterateKeys( database->d_found_group = true; database->d_still_searching = - H5Giterate(grp, ".", NULL, + H5Giterate(grp, ".", 0, HDFDatabase::iterateKeys, void_database); TBOX_ASSERT(database->d_still_searching >= 0); @@ -175,7 +175,7 @@ HDFDatabase::iterateKeys( if (database->d_found_group) { addKeyToList(name, KEY_DATABASE, void_database); } else { - errf = H5Giterate(grp, ".", NULL, + errf = H5Giterate(grp, ".", 0, HDFDatabase::iterateKeys, void_database); TBOX_ASSERT(errf >= 0); @@ -249,8 +249,8 @@ HDFDatabase::addKeyToList( int type, void* database) { - TBOX_ASSERT(name != (char *)NULL); - TBOX_ASSERT(database != NULL); + TBOX_ASSERT(name != 0); + TBOX_ASSERT(database != 0); KeyData key_item; key_item.d_key = name; @@ -394,18 +394,19 @@ HDFDatabase::keyExists( ************************************************************************* */ -Array +std::vector HDFDatabase::getAllKeys() { performKeySearch(); - Array tmp_keys(static_cast(d_keydata.size())); + std::vector tmp_keys( + static_cast::size_type>(d_keydata.size())); - int k = 0; + size_t k = 0; for (std::list::iterator i = d_keydata.begin(); - i != d_keydata.end(); i++) { + i != d_keydata.end(); ++i) { tmp_keys[k] = i->d_key; - k++; + ++k; } cleanupKeySearch(); @@ -519,7 +520,7 @@ HDFDatabase::getArrayType( ************************************************************************* */ -int +size_t HDFDatabase::getArraySize( const std::string& key) { @@ -528,7 +529,7 @@ HDFDatabase::getArraySize( herr_t errf; NULL_USE(errf); - int array_size = 0; + size_t array_size = 0; hid_t this_set; BEGIN_SUPPRESS_HDF5_WARNINGS; @@ -551,7 +552,7 @@ HDFDatabase::getArraySize( } else { nsel = H5Sget_select_npoints(this_space); } - array_size = int(nsel); + array_size = static_cast(nsel); errf = H5Sclose(this_space); TBOX_ASSERT(errf >= 0); @@ -717,10 +718,10 @@ void HDFDatabase::putBoolArray( const std::string& key, const bool * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (bool *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -728,7 +729,7 @@ HDFDatabase::putBoolArray( if (nelements > 0) { hsize_t dim[1] = { nelements }; - hid_t space = H5Screate_simple(1, dim, NULL); + hid_t space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); /* @@ -741,8 +742,8 @@ HDFDatabase::putBoolArray( * shortest integer type we can find, the H5T_SAMRAI_BOOL * type. */ - Array data1(nelements); - for (int i = 0; i < nelements; ++i) data1[i] = data[i]; + std::vector data1(nelements); + for (size_t i = 0; i < nelements; ++i) data1[i] = data[i]; #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) hid_t dataset = H5Dcreate(d_group_id, key.c_str(), H5T_SAMRAI_BOOL, @@ -777,7 +778,7 @@ HDFDatabase::putBoolArray( /* ************************************************************************ * - * Two routines to get boolean arrays from the database with the + * Two routines to get boolean vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a boolean type. @@ -785,14 +786,14 @@ HDFDatabase::putBoolArray( ************************************************************************ */ -Array -HDFDatabase::getBoolArray( +std::vector +HDFDatabase::getBoolVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isBool(key)) { - TBOX_ERROR("HDFDatabase::getBoolArray() error in database " + TBOX_ERROR("HDFDatabase::getBoolVector() error in database " << d_database_name << "\n Key = " << key << " is not a bool array." << std::endl); } @@ -814,7 +815,8 @@ HDFDatabase::getBoolArray( nsel = H5Sget_select_npoints(dspace); - Array bool_array(static_cast(nsel)); + std::vector bool_array( + static_cast::size_type>(nsel)); if (nsel > 0) { /* @@ -824,8 +826,8 @@ HDFDatabase::getBoolArray( * type. So we read bools into native integer memory * then convert. */ - Array data1(static_cast(nsel)); - int* locPtr = data1.getPointer(); + std::vector data1(static_cast::size_type>(nsel)); + int* locPtr = &data1[0]; errf = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, @@ -899,10 +901,10 @@ void HDFDatabase::putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (DatabaseBox *)NULL); + TBOX_ASSERT(data != 0); if (nelements > 0) { @@ -915,7 +917,7 @@ HDFDatabase::putDatabaseBoxArray( hid_t stype = createCompoundDatabaseBox('s'); hsize_t length = nelements; - hid_t space = H5Screate_simple(1, &length, NULL); + hid_t space = H5Screate_simple(1, &length, 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) hid_t dataset = @@ -956,7 +958,7 @@ HDFDatabase::putDatabaseBoxArray( /* ************************************************************************ * - * Two routines to get box arrays from the database with the + * A routine to get a box vector from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a box type. @@ -964,14 +966,14 @@ HDFDatabase::putDatabaseBoxArray( ************************************************************************ */ -Array -HDFDatabase::getDatabaseBoxArray( +std::vector +HDFDatabase::getDatabaseBoxVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isDatabaseBox(key)) { - TBOX_ERROR("HDFDatabase::getDatabaseBoxArray() error in database " + TBOX_ERROR("HDFDatabase::getDatabaseBoxVector() error in database " << d_database_name << "\n Key = " << key << " is not a box array." << std::endl); } @@ -997,10 +999,11 @@ HDFDatabase::getDatabaseBoxArray( nsel = H5Sget_select_npoints(dspace); - Array boxArray(static_cast(nsel)); + std::vector boxVector( + static_cast::size_type>(nsel)); if (nsel > 0) { - DatabaseBox* locPtr = boxArray.getPointer(); + DatabaseBox* locPtr = &boxVector[0]; errf = H5Dread(dset, mtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); @@ -1021,7 +1024,7 @@ HDFDatabase::getDatabaseBoxArray( errf = H5Dclose(dset); TBOX_ASSERT(errf >= 0); - return boxArray; + return boxVector; } hid_t @@ -1054,11 +1057,11 @@ HDFDatabase::createCompoundDatabaseBox( int_type_spec); TBOX_ASSERT(errf >= 0); - const hsize_t box_dim = DatabaseBox_MAX_DIM /* defined in DatabaseBox.h */; + const hsize_t box_dim = SAMRAI::MAX_DIM_VAL; insertArray(type, "lo", HOFFSET(DatabaseBox_POD, d_lo), 1, &box_dim, - NULL, int_type_spec); + 0, int_type_spec); insertArray(type, "hi", HOFFSET(DatabaseBox_POD, d_hi), 1, &box_dim, - NULL, int_type_spec); + 0, int_type_spec); return type; } @@ -1116,10 +1119,10 @@ void HDFDatabase::putCharArray( const std::string& key, const char * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (char *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1139,7 +1142,7 @@ HDFDatabase::putCharArray( errf = H5Tset_strpad(atype, H5T_STR_NULLTERM); TBOX_ASSERT(errf >= 0); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { local_buf[i] = data[i]; } @@ -1184,7 +1187,7 @@ HDFDatabase::putCharArray( /* ************************************************************************ * - * Two routines to get char arrays from the database with the + * Two routines to get char vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a char type. @@ -1192,14 +1195,14 @@ HDFDatabase::putCharArray( ************************************************************************ */ -Array -HDFDatabase::getCharArray( +std::vector +HDFDatabase::getCharVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isChar(key)) { - TBOX_ERROR("HDFDatabase::getCharArray() error in database " + TBOX_ERROR("HDFDatabase::getCharVector() error in database " << d_database_name << "\n Key = " << key << " is not a char array." << std::endl); } @@ -1224,10 +1227,11 @@ HDFDatabase::getCharArray( nsel = H5Tget_size(dtype); - Array charArray(static_cast(nsel)); + std::vector charArray( + static_cast::size_type>(nsel)); if (nsel > 0) { - char* locPtr = charArray.getPointer(); + char* locPtr = &charArray[0]; errf = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); } @@ -1298,10 +1302,10 @@ void HDFDatabase::putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (dcomplex *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1316,7 +1320,7 @@ HDFDatabase::putComplexArray( hid_t stype = createCompoundComplex('s'); hsize_t dim[] = { nelements }; - space = H5Screate_simple(1, dim, NULL); + space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) @@ -1357,7 +1361,7 @@ HDFDatabase::putComplexArray( /* ************************************************************************ * - * Two routines to get complex arrays from the database with the + * Two routines to get complex vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a complex type. @@ -1365,8 +1369,8 @@ HDFDatabase::putComplexArray( ************************************************************************ */ -Array -HDFDatabase::getComplexArray( +std::vector +HDFDatabase::getComplexVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -1375,7 +1379,7 @@ HDFDatabase::getComplexArray( NULL_USE(errf); if (!isComplex(key)) { - TBOX_ERROR("HDFDatabase::getComplexArray() error in database " + TBOX_ERROR("HDFDatabase::getComplexVector() error in database " << d_database_name << "\n Key = " << key << " is not a complex array." << std::endl); } @@ -1398,10 +1402,11 @@ HDFDatabase::getComplexArray( nsel = H5Sget_select_npoints(dspace); - Array complexArray(static_cast(nsel)); + std::vector complexArray( + static_cast::size_type>(nsel)); if (nsel > 0) { - dcomplex* locPtr = complexArray.getPointer(); + dcomplex* locPtr = &complexArray[0]; errf = H5Dread(dset, mtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); } @@ -1506,10 +1511,10 @@ void HDFDatabase::putDoubleArray( const std::string& key, const double * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (double *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1517,7 +1522,7 @@ HDFDatabase::putDoubleArray( if (nelements > 0) { hsize_t dim[] = { nelements }; - hid_t space = H5Screate_simple(1, dim, NULL); + hid_t space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) @@ -1553,7 +1558,7 @@ HDFDatabase::putDoubleArray( /* ************************************************************************ * - * Two routines to get double arrays from the database with the + * Two routines to get double vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a double type. @@ -1561,8 +1566,8 @@ HDFDatabase::putDoubleArray( ************************************************************************ */ -Array -HDFDatabase::getDoubleArray( +std::vector +HDFDatabase::getDoubleVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -1571,7 +1576,7 @@ HDFDatabase::getDoubleArray( NULL_USE(errf); if (!isDouble(key)) { - TBOX_ERROR("HDFDatabase::getDoubleArray() error in database " + TBOX_ERROR("HDFDatabase::getDoubleVector() error in database " << d_database_name << "\n Key = " << key << " is not a double array." << std::endl); } @@ -1591,10 +1596,11 @@ HDFDatabase::getDoubleArray( nsel = H5Sget_select_npoints(dspace); - Array doubleArray(static_cast(nsel)); + std::vector doubleArray( + static_cast::size_type>(nsel)); if (nsel > 0) { - double* locPtr = doubleArray.getPointer(); + double* locPtr = &doubleArray[0]; errf = H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); @@ -1662,10 +1668,10 @@ void HDFDatabase::putFloatArray( const std::string& key, const float * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (float *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1673,7 +1679,7 @@ HDFDatabase::putFloatArray( if (nelements > 0) { hsize_t dim[] = { nelements }; - hid_t space = H5Screate_simple(1, dim, NULL); + hid_t space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) @@ -1710,7 +1716,7 @@ HDFDatabase::putFloatArray( /* ************************************************************************ * - * Two routines to get float arrays from the database with the + * Two routines to get float vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a float type. @@ -1718,8 +1724,8 @@ HDFDatabase::putFloatArray( ************************************************************************ */ -Array -HDFDatabase::getFloatArray( +std::vector +HDFDatabase::getFloatVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -1728,7 +1734,7 @@ HDFDatabase::getFloatArray( NULL_USE(errf); if (!isFloat(key)) { - TBOX_ERROR("HDFDatabase::getFloatArray() error in database " + TBOX_ERROR("HDFDatabase::getFloatVector() error in database " << d_database_name << "\n Key = " << key << " is not a float array." << std::endl); } @@ -1748,10 +1754,11 @@ HDFDatabase::getFloatArray( TBOX_ASSERT(dspace >= 0); nsel = H5Sget_select_npoints(dspace); - Array floatArray(static_cast(nsel)); + std::vector floatArray( + static_cast::size_type>(nsel)); if (nsel > 0) { - float* locPtr = floatArray.getPointer(); + float* locPtr = &floatArray[0]; errf = H5Dread(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); @@ -1821,10 +1828,10 @@ void HDFDatabase::putIntegerArray( const std::string& key, const int * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (int *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1832,7 +1839,7 @@ HDFDatabase::putIntegerArray( if (nelements > 0) { hsize_t dim[] = { nelements }; - hid_t space = H5Screate_simple(1, dim, NULL); + hid_t space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) @@ -1868,7 +1875,7 @@ HDFDatabase::putIntegerArray( /* ************************************************************************ * - * Two routines to get integer arrays from the database with the + * Two routines to get integer vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a integer type. @@ -1876,8 +1883,8 @@ HDFDatabase::putIntegerArray( ************************************************************************ */ -Array -HDFDatabase::getIntegerArray( +std::vector +HDFDatabase::getIntegerVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -1886,7 +1893,7 @@ HDFDatabase::getIntegerArray( NULL_USE(errf); if (!isInteger(key)) { - TBOX_ERROR("HDFDatabase::getIntegerArray() error in database " + TBOX_ERROR("HDFDatabase::getIntegerVector() error in database " << d_database_name << "\n Key = " << key << " is not an integer array." << std::endl); } @@ -1906,10 +1913,10 @@ HDFDatabase::getIntegerArray( nsel = H5Sget_select_npoints(dspace); - Array intArray(static_cast(nsel)); + std::vector intArray(static_cast::size_type>(nsel)); if (nsel > 0) { - int* locPtr = intArray.getPointer(); + int* locPtr = &intArray[0]; errf = H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, locPtr); TBOX_ASSERT(errf >= 0); @@ -1978,10 +1985,10 @@ void HDFDatabase::putStringArray( const std::string& key, const std::string * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (std::string *)NULL); + TBOX_ASSERT(data != 0); herr_t errf; NULL_USE(errf); @@ -1990,14 +1997,14 @@ HDFDatabase::putStringArray( int maxlen = 0; int current, data_size; - int i; - for (i = 0; i < nelements; i++) { + size_t i; + for (i = 0; i < nelements; ++i) { current = static_cast(data[i].size()); if (current > maxlen) maxlen = current; } char* local_buf = new char[nelements * (maxlen + 1)]; - for (i = 0; i < nelements; i++) { + for (i = 0; i < nelements; ++i) { strcpy(&local_buf[i * (maxlen + 1)], data[i].c_str()); data_size = static_cast(data[i].size()); if (data_size < maxlen) { @@ -2016,7 +2023,7 @@ HDFDatabase::putStringArray( TBOX_ASSERT(errf >= 0); hsize_t dim[] = { nelements }; - hid_t space = H5Screate_simple(1, dim, NULL); + hid_t space = H5Screate_simple(1, dim, 0); TBOX_ASSERT(space >= 0); #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) @@ -2065,8 +2072,8 @@ HDFDatabase::putStringArray( ************************************************************************ */ -Array -HDFDatabase::getStringArray( +std::vector +HDFDatabase::getStringVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -2075,7 +2082,7 @@ HDFDatabase::getStringArray( NULL_USE(errf); if (!isString(key)) { - TBOX_ERROR("HDFDatabase::getStringArray() error in database " + TBOX_ERROR("HDFDatabase::getStringVector() error in database " << d_database_name << "\n Key = " << key << " is not a string array." << std::endl); } @@ -2083,7 +2090,6 @@ HDFDatabase::getStringArray( hsize_t nsel; size_t dsize; hid_t dset, dspace, dtype; - char* local_buf; #if (H5_VERS_MAJOR > 1) || ((H5_VERS_MAJOR == 1) && (H5_VERS_MINOR > 6)) dset = H5Dopen(d_group_id, key.c_str(), H5P_DEFAULT); @@ -2101,16 +2107,21 @@ HDFDatabase::getStringArray( dsize = H5Tget_size(dtype); nsel = H5Sget_select_npoints(dspace); - local_buf = new char[nsel * dsize]; + std::vector stringArray( + static_cast::size_type>(nsel)); - errf = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, local_buf); - TBOX_ASSERT(errf >= 0); + if (nsel > 0) { + char* local_buf = new char[nsel * dsize]; - Array stringArray(static_cast(nsel)); + errf = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, local_buf); + TBOX_ASSERT(errf >= 0); - for (int i = 0; i < static_cast(nsel); i++) { - std::string* locPtr = stringArray.getPointer(i); - *locPtr = &local_buf[i * dsize]; + for (std::vector::size_type i = 0; + i < static_cast::size_type>(nsel); ++i) { + std::string* locPtr = &stringArray[i]; + *locPtr = &local_buf[i * dsize]; + } + delete[] local_buf; } errf = H5Sclose(dspace); @@ -2122,7 +2133,6 @@ HDFDatabase::getStringArray( errf = H5Dclose(dset); TBOX_ASSERT(errf >= 0); - delete[] local_buf; return stringArray; } @@ -2202,7 +2212,7 @@ HDFDatabase::printClassData( } for (std::list::iterator i = d_keydata.begin(); - i != d_keydata.end(); i++) { + i != d_keydata.end(); ++i) { int t = i->d_type; switch (MathUtilities::Abs(t)) { case KEY_DATABASE: { @@ -2406,7 +2416,7 @@ HDFDatabase::insertArray( #else size_t newdim[H5S_MAX_RANK]; - for (int i = 0; i < ndims; i++) { + for (int i = 0; i < ndims; ++i) { newdim[i] = dim[i]; } @@ -2447,7 +2457,7 @@ HDFDatabase::performKeySearch() d_still_searching = 1; - errf = H5Giterate(d_group_id, "/", NULL, + errf = H5Giterate(d_group_id, "/", 0, HDFDatabase::iterateKeys, (void *)this); TBOX_ASSERT(errf >= 0); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.h index 6cbde1c1..7a9fbba1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A database structure that stores HDF5 format data. * ************************************************************************/ @@ -21,7 +21,6 @@ #ifdef HAVE_HDF5 #include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" @@ -31,7 +30,7 @@ #endif #include "hdf5.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -45,7 +44,7 @@ namespace tbox { * It is assumed that all processors will access the database in the same * manner. Error reporting is done using the SAMRAI error reporting macros. * - * @see tbox::Database + * @see Database */ class HDFDatabase:public Database @@ -56,14 +55,17 @@ class HDFDatabase:public Database * specified name. By default the database will not be associated * with a file until it is mounted, using the mount() member function. * - * When assertion checking is active, the name string must be non-empty. * The name string is *NOT* the name of the HDF file. + * + * @pre !name.empty() */ explicit HDFDatabase( const std::string& name); /** * Constructor used to create sub-databases. + * + * @pre !name.empty() */ HDFDatabase( const std::string& name, @@ -78,19 +80,19 @@ class HDFDatabase:public Database * Return true if the specified key exists in the database * and false otherwise. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ virtual bool keyExists( const std::string& key); /** - * Return an array of all keys in the current database. Note that + * Return a vector of all keys in the current database. Note that * no keys from subdatabases contained in the current database * will appear in the array. To get the keys of any other * database, you must call this routine for that database. */ - virtual Array + virtual std::vector getAllKeys(); /** @@ -108,9 +110,9 @@ class HDFDatabase:public Database * Return the size of the array associated with the key. If the key * does not exist, then zero is returned. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ - virtual int + virtual size_t getArraySize( const std::string& key); @@ -118,6 +120,8 @@ class HDFDatabase:public Database * Return true or false depending on whether the specified key * represents a database entry. If the key does not exist or if * the string is empty, then false is returned. + * + * @pre !key.empty() */ virtual bool isDatabase( @@ -128,7 +132,7 @@ class HDFDatabase:public Database * pointer to it. A new group with the key name is also created * in the data file. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ virtual boost::shared_ptr putDatabase( @@ -139,7 +143,8 @@ class HDFDatabase:public Database * key does not represent a database entry in the database, then * an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isDatabase(key) */ virtual boost::shared_ptr getDatabase( @@ -158,30 +163,25 @@ class HDFDatabase:public Database * Create a boolean array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putBoolArray( const std::string& key, const bool * const data, - const int nelements); + const size_t nelements); - /** - * Get a boolean entry in the database with the specified key name. - * If the specified key does not exist in the database, then an - * error message is printed and the program exits. - * - * When assertion checking is active, the key string must be non-empty. - */ /** * Get a boolean entry from the database with the specified key * name. If the specified key does not exist in the database, * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isBool(key) */ - virtual Array - getBoolArray( + virtual std::vector + getBoolVector( const std::string& key); /** @@ -197,23 +197,25 @@ class HDFDatabase:public Database * Create a box array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements); + const size_t nelements); /** * Get a box entry from the database with the specified key - * name. If the specified key does not exist in the database, - * then an error message is printed and the program exits. + * name. If the specified key does not exist in the database or + * is not a box vector, then an error message is printed and + * the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @param key Key name in database. */ - virtual Array - getDatabaseBoxArray( + virtual std::vector + getDatabaseBoxVector( const std::string& key); /** @@ -229,23 +231,25 @@ class HDFDatabase:public Database * Create a character array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putCharArray( const std::string& key, const char * const data, - const int nelements); + const size_t nelements); /** * Get a character entry from the database with the specified key * name. If the specified key does not exist in the database, * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isChar(key) */ - virtual Array - getCharArray( + virtual std::vector + getCharVector( const std::string& key); /** @@ -261,23 +265,25 @@ class HDFDatabase:public Database * Create a complex array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements); + const size_t nelements); /** * Get a complex entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isComplex(key) */ - virtual Array - getComplexArray( + virtual std::vector + getComplexVector( const std::string& key); /** @@ -293,23 +299,25 @@ class HDFDatabase:public Database * Create a double array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putDoubleArray( const std::string& key, const double * const data, - const int nelements); + const size_t nelements); /** * Get a double entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isDouble(key) */ - virtual Array - getDoubleArray( + virtual std::vector + getDoubleVector( const std::string& key); /** @@ -325,23 +333,25 @@ class HDFDatabase:public Database * Create a float array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putFloatArray( const std::string& key, const float * const data, - const int nelements); + const size_t nelements); /** * Get a float entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isFloat(key) */ - virtual Array - getFloatArray( + virtual std::vector + getFloatVector( const std::string& key); /** @@ -357,23 +367,25 @@ class HDFDatabase:public Database * Create an integer array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putIntegerArray( const std::string& key, const int * const data, - const int nelements); + const size_t nelements); /** * Get an integer entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isInteger(key) */ - virtual Array - getIntegerArray( + virtual std::vector + getIntegerVector( const std::string& key); /** @@ -389,23 +401,25 @@ class HDFDatabase:public Database * Create a string array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putStringArray( const std::string& key, const std::string * const data, - const int nelements); + const size_t nelements); /** * Get a string entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isString(key) */ - virtual Array - getStringArray( + virtual std::vector + getStringVector( const std::string& key); /** @@ -425,6 +439,8 @@ class HDFDatabase:public Database * Returns true if successful. * * @param name name of database. Normally a filename. + * + * @pre !name.empty() */ virtual bool create( @@ -439,6 +455,8 @@ class HDFDatabase:public Database * * @param read_write_mode Open the database in read-write * mode instead of read-only mode. + * + * @pre !name.empty() */ virtual bool open( @@ -456,6 +474,8 @@ class HDFDatabase:public Database * SAMRAI data will be written within this group. * * Returns true if attach was successful. + * + * @pre group_id > 0 */ virtual bool attachToFile( @@ -495,6 +515,7 @@ class HDFDatabase:public Database using Database::getBoolArray; using Database::putDatabaseBoxArray; using Database::getDatabaseBoxArray; + using Database::getDatabaseBoxVector; using Database::putCharArray; using Database::getCharArray; using Database::putComplexArray; @@ -509,11 +530,12 @@ class HDFDatabase:public Database using Database::getStringArray; private: + HDFDatabase(); // not implemented HDFDatabase( const HDFDatabase&); // not implemented - void + HDFDatabase& operator = ( - const HDFDatabase&); // not implemented + const HDFDatabase&); // not implemented /* * Static function passed HDF5 iterator routine to look up database keys. @@ -552,12 +574,14 @@ class HDFDatabase:public Database * * When finished, the type should be closed using H5Tclose(hid_t). * - * @param char_type 'n' mean use native types; 'f' = means use + * @param type_spec 'n' mean use native types; 'f' = means use * types for file. * @return the compound type id. * @internal We currently create a new compound type every * time we write a compound. It would be more efficient to * cache the type id for the file. + * + * @pre (type_spec == 'n') || (type_spec == 's') */ hid_t createCompoundDatabaseBox( @@ -568,7 +592,7 @@ class HDFDatabase:public Database * * When finished, the type should be closed using H5Tclose(hid_t). * - * @param char_type 'n' mean use native types; 'f' = means use + * @param type_spec 'n' mean use native types; 'f' = means use * types for file. * @return the compound type id. * @internal We currently create a new compound type every @@ -701,6 +725,5 @@ class HDFDatabase:public Database } } - #endif #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.C index bc414c3f..e3e56afd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.C @@ -3,19 +3,43 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for a HDFDatabaseFactory * ************************************************************************/ #include "SAMRAI/tbox/HDFDatabaseFactory.h" #include "SAMRAI/tbox/HDFDatabase.h" +#include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace tbox { +HDFDatabaseFactory::HDFDatabaseFactory() +{ +} + +HDFDatabaseFactory::~HDFDatabaseFactory() +{ +} + +HDFDatabaseFactory::HDFDatabaseFactory( + const HDFDatabaseFactory& other): + DatabaseFactory() +{ + NULL_USE(other); +} + +HDFDatabaseFactory& +HDFDatabaseFactory::operator = ( + const HDFDatabaseFactory& rhs) +{ + NULL_USE(rhs); + return *this; +} + /** * Build a new Database object. */ @@ -30,7 +54,7 @@ HDFDatabaseFactory::allocate( #else NULL_USE(name); TBOX_WARNING("HDF5DatabaseFactory: Cannot allocate an HDFDatabase.\n" - << "SAMRAI was not configured with HDF."); + << "SAMRAI was not configured with HDF." << std::endl); return boost::shared_ptr(); #endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.h index 24c350e6..d7c735e5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/HDFDatabaseFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for a HDFDatabaseFactory * ************************************************************************/ @@ -24,6 +24,30 @@ namespace tbox { */ class HDFDatabaseFactory:public DatabaseFactory { +public: + /** + * Default constructor. + */ + HDFDatabaseFactory(); + + /** + * Copy constructor. + */ + HDFDatabaseFactory( + const HDFDatabaseFactory& other); + + /** + * Assignment operator. + */ + HDFDatabaseFactory& + operator = ( + const HDFDatabaseFactory& rhs); + + /** + * Destructor. + */ + ~HDFDatabaseFactory(); + /** * Build a new Database object. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.C index 023f01cc..6a05e367 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IEEE routines to set up handlers and get signaling NaNs * ************************************************************************/ @@ -46,7 +46,7 @@ namespace tbox { */ /* - * Function celled when an exception is tripped. + * Function called when an exception is tripped. */ #if defined(HAVE_EXCEPTION_HANDLING) static void error_action( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.h index 94fc3837..4e388b38 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IEEE.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: IEEE routines to set up handlers and get signaling NaNs * ************************************************************************/ @@ -13,10 +13,11 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + namespace SAMRAI { namespace tbox { @@ -35,14 +36,14 @@ namespace tbox { * SAMRAIManager::startup() routine. * * Note that all operations provided by this class (except for setting - * up exception handling) are implemented in @see tbox::MathUtilities. + * up exception handling) are implemented in @see MathUtilities. * Operations are provided by this class since it is not templated on * data type and so calling the operations provided here may be easier * in some cases, such as in codes built based on earlier versions - * of SAMRAI. See the tbox::MathUtilities header file for details + * of SAMRAI. See the MathUtilities header file for details * about the routines. * - * @see tbox::MathUtilities + * @see MathUtilities */ struct IEEE { @@ -118,42 +119,42 @@ struct IEEE { } /*! - * Initialize an array of floats to signaling NaNs. Before using this + * Initialize a vector of floats to signaling NaNs. Before using this * array in any operation, the NaN value should be reset. Otherwise, * an unrecoverable exception will result (as long as floating point * exception handling is supported by the compiler). */ static void - initializeArrayToSignalingNaN( - Array& array) + initializeVectorToSignalingNaN( + std::vector& vector) { - MathUtilities::setArrayToSignalingNaN(array); + MathUtilities::setVectorToSignalingNaN(vector); } /*! - * Initialize an array of doubles to signaling NaNs. Before using this + * Initialize a vector of doubles to signaling NaNs. Before using this * array in any operation, the NaN value should be reset. Otherwise, * an unrecoverable exception will result (as long as floating point * exception handling is supported by the compiler). */ static void - initializeArrayToSignalingNaN( - Array& array) + initializeVectorToSignalingNaN( + std::vector& vector) { - MathUtilities::setArrayToSignalingNaN(array); + MathUtilities::setVectorToSignalingNaN(vector); } /*! - * Initialize an array of dcomplex to signaling NaNs. Before using this + * Initialize a vector of dcomplex to signaling NaNs. Before using this * array in any operation, the NaN value should be reset. Otherwise, * an unrecoverable exception will result (as long as floating point * exception handling is supported by the compiler). */ static void - initializeArrayToSignalingNaN( - Array& array) + initializeVectorToSignalingNaN( + std::vector& vector) { - MathUtilities::setArrayToSignalingNaN(array); + MathUtilities::setVectorToSignalingNaN(vector); } /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IOStream.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IOStream.h index ede53863..d635cd4d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IOStream.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/IOStream.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Wrapper header file for standard IO stream classes * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputDatabase.h index 6893419c..209cb145 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An input database structure that stores (key,value) pairs * ************************************************************************/ @@ -22,11 +22,10 @@ namespace tbox { * @brief Class InputDatabase stores (key,value) pairs in a hierarchical * database. * - * This is just another name for the MemoryDatabase. @see tbox::MemoryDatabase + * This is just another name for the MemoryDatabase. @see MemoryDatabase * - * It is normally filled with data using a tbox::Parser (@see - * tbox::Parser) and used to pass user supplied input from input files - * to constructors for problem setup. + * It is normally filled with data using a Parser (@see Parser) and used to + * pass user supplied input from input file to constructors for problem setup. * */ typedef MemoryDatabase InputDatabase; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.C index 8b23d11d..96f7b4b4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.C @@ -3,13 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An input manager singleton class that parses input files * ************************************************************************/ #include "SAMRAI/tbox/InputManager.h" -#include +#include "boost/make_shared.hpp" #include #include #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -22,7 +22,7 @@ namespace SAMRAI { namespace tbox { -InputManager * InputManager::s_manager_instance = NULL; +InputManager * InputManager::s_manager_instance = 0; boost::shared_ptr InputManager::s_input_db; @@ -42,7 +42,7 @@ StartupShutdownManager::Handler InputManager::s_finalize_handler( ************************************************************************* */ -InputManager* +InputManager * InputManager::getManager() { if (!s_manager_instance) { @@ -66,7 +66,7 @@ InputManager::finalizeCallback() { if (s_manager_instance) { delete s_manager_instance; - s_manager_instance = ((InputManager *)NULL); + s_manager_instance = 0; } s_input_db.reset(); @@ -120,7 +120,7 @@ InputManager::parseInputFile( const std::string& filename, const boost::shared_ptr& db) { - FILE* fstream = NULL; + FILE* fstream = 0; const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); if (mpi.getRank() == 0) { fstream = fopen(filename.c_str(), "r"); @@ -128,7 +128,7 @@ InputManager::parseInputFile( int worked = (fstream ? 1 : 0); mpi.Bcast(&worked, 1, MPI_INT, 0); if (!worked) { - TBOX_ERROR("tbox::InputManager: Could not open input file``" + TBOX_ERROR("InputManager: Could not open input file``" << filename.c_str() << "''\n"); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.h index 3825909a..6f7cbc8e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/InputManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An input manager singleton class that parses input files * ************************************************************************/ @@ -15,7 +15,7 @@ #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/StartupShutdownManager.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -69,7 +69,7 @@ class InputManager */ static void setManager( - InputManager * manager); + InputManager* manager); /** * Return whether or not the manager has read an input database. If @@ -78,7 +78,7 @@ class InputManager static bool inputDatabaseExists() { - return s_input_db; + return s_input_db.get(); } /** @@ -146,7 +146,7 @@ class InputManager private: InputManager( const InputManager&); // not implemented - void + InputManager& operator = ( const InputManager&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.C index 4c246633..5545f639 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.C @@ -3,18 +3,19 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility functions for logging * ************************************************************************/ #include "SAMRAI/tbox/Logger.h" #include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/Utilities.h" namespace SAMRAI { namespace tbox { -Logger * Logger::s_instance = NULL; +Logger * Logger::s_instance = 0; StartupShutdownManager::Handler Logger::s_finalize_handler( @@ -130,20 +131,38 @@ Logger::finalizeCallback() { if (s_instance) { delete s_instance; - s_instance = static_cast(NULL); + s_instance = 0; } } -Logger* +Logger * Logger::getInstance() { - if (s_instance == static_cast(NULL)) { + if (s_instance == 0) { s_instance = new Logger(); } return s_instance; } +Logger::Appender::Appender() +{ +} + +Logger::Appender::Appender( + const Appender& other) +{ + NULL_USE(other); +} + +Logger::Appender& +Logger::Appender::operator = ( + const Appender& rhs) +{ + NULL_USE(rhs); + return *this; +} + Logger::Appender::~Appender() { } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.h index 5488d000..d9da04a5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Logger.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility class for logging. * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/StartupShutdownManager.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -96,6 +96,15 @@ class Logger const std::string& filename, const int line) = 0; + Appender(); + + Appender( + const Appender& other); + + Appender& + operator = ( + const Appender& rhs); + virtual ~Appender(); }; @@ -215,12 +224,21 @@ class Logger */ Logger(); + // Unimplemented copy constructor. + Logger( + const Logger& other); + /* * Private destructor to avoid destruction of the singleton * outside this class. */ ~Logger(); + // Unimplemented assignment operator. + Logger& + operator = ( + const Logger& rhs); + /*! * Frees instance of the singleton logger. * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.depend index ae87db13..6988fbd4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -22,12 +22,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Array.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=ArraySpecial.o DEPENDS_1:=\ @@ -39,17 +38,15 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ArraySpecial.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=AsyncCommGroup.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ @@ -61,7 +58,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -70,18 +66,15 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h AsyncCommGroup.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=AsyncCommPeer.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ @@ -93,7 +86,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -102,17 +94,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h AsyncCommPeer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=AsyncCommStage.o DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -123,7 +113,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -132,73 +121,143 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h AsyncCommStage.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=BalancedDepthFirstTree.o DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BalancedDepthFirstTree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ - -endif + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} +${FILE_5}: ${DEPENDS_5} -FILE_6=Clock.o +FILE_6=BreadthFirstRankTree.o DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BreadthFirstRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Clock.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h BreadthFirstRankTree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ - -endif + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} +${FILE_6}: ${DEPENDS_6} -FILE_7=Database.o +FILE_7=CenteredRankTree.o DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Database.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CenteredRankTree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} +${FILE_7}: ${DEPENDS_7} -FILE_8=DatabaseBox.o +FILE_8=Clock.o DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Clock.C + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=CommGraphWriter.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h CommGraphWriter.C + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=Database.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Database.C + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=DatabaseBox.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ @@ -207,17 +266,15 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DatabaseBox.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ +DEPENDS_11 +=\ -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=DatabaseFactory.o -DEPENDS_9:=\ +${FILE_11}: ${DEPENDS_11} + +FILE_12=DatabaseFactory.o +DEPENDS_12:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -226,19 +283,17 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DatabaseFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_12 +=\ + -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} -FILE_10=Dimension.o -DEPENDS_10:=\ +${FILE_12}: ${DEPENDS_12} + +FILE_13=Dimension.o +DEPENDS_13:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ @@ -246,17 +301,15 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Dimension.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ +DEPENDS_13 +=\ -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=Grammar.o -DEPENDS_11:=\ +${FILE_13}: ${DEPENDS_13} + +FILE_14=Grammar.o +DEPENDS_14:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -265,21 +318,18 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Parser.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Grammar.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_14 +=\ + -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} -FILE_12=HDFDatabase.o -DEPENDS_12:=\ +${FILE_14}: ${DEPENDS_14} + +FILE_15=HDFDatabase.o +DEPENDS_15:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -289,22 +339,18 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HDFDatabase.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=HDFDatabaseFactory.o -DEPENDS_13:=\ +${FILE_15}: ${DEPENDS_15} + +FILE_16=HDFDatabaseFactory.o +DEPENDS_16:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -315,43 +361,36 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HDFDatabaseFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_16 +=\ + -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} -FILE_14=IEEE.o -DEPENDS_14:=\ +${FILE_16}: ${DEPENDS_16} + +FILE_17=IEEE.o +DEPENDS_17:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IEEE.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h IEEE.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_14 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} -FILE_15=InputManager.o -DEPENDS_15:=\ +${FILE_17}: ${DEPENDS_17} + +FILE_18=InputManager.o +DEPENDS_18:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -363,68 +402,61 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Parser.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h InputManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_15 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_18 +=\ + -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} -FILE_16=Logger.o -DEPENDS_16:=\ +${FILE_18}: ${DEPENDS_18} + +FILE_19=Logger.o +DEPENDS_19:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h Logger.C + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Logger.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_16 +=\ +DEPENDS_19 +=\ -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} -FILE_17=MathUtilities.o -DEPENDS_17:=\ +${FILE_19}: ${DEPENDS_19} + +FILE_20=MathUtilities.o +DEPENDS_20:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h MathUtilities.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_17 +=\ +DEPENDS_20 +=\ -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} -FILE_18=MathUtilitiesSpecial.o -DEPENDS_18:=\ +${FILE_20}: ${DEPENDS_20} + +FILE_21=MathUtilitiesSpecial.o +DEPENDS_21:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MathUtilitiesSpecial.C + MathUtilitiesSpecial.C Utilities.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_18 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} -FILE_19=MemoryDatabase.o -DEPENDS_19:=\ +${FILE_21}: ${DEPENDS_21} + +FILE_22=MemoryDatabase.o +DEPENDS_22:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -433,22 +465,19 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MemoryDatabase.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_19 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_22 +=\ + -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} -FILE_20=MemoryDatabaseFactory.o -DEPENDS_20:=\ +${FILE_22}: ${DEPENDS_22} + +FILE_23=MemoryDatabaseFactory.o +DEPENDS_23:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -459,21 +488,18 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MemoryDatabaseFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_20 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_23 +=\ + -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} -FILE_21=MemoryUtilities.o -DEPENDS_21:=\ +${FILE_23}: ${DEPENDS_23} + +FILE_24=MemoryUtilities.o +DEPENDS_24:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -483,22 +509,19 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MemoryUtilities.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_21 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_24 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} -FILE_22=MessageStream.o -DEPENDS_22:=\ +${FILE_24}: ${DEPENDS_24} + +FILE_25=MessageStream.o +DEPENDS_25:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ @@ -507,17 +530,15 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MessageStream.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_22 +=\ +DEPENDS_25 +=\ -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} -FILE_23=NullDatabase.o -DEPENDS_23:=\ +${FILE_25}: ${DEPENDS_25} + +FILE_26=NullDatabase.o +DEPENDS_26:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -526,67 +547,59 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/NullDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h NullDatabase.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_23 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_26 +=\ + -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} -FILE_24=PIO.o -DEPENDS_24:=\ +${FILE_26}: ${DEPENDS_26} + +FILE_27=PIO.o +DEPENDS_27:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/ParallelBuffer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PIO.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_24 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_27 +=\ + -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} -FILE_25=ParallelBuffer.o -DEPENDS_25:=\ +${FILE_27}: ${DEPENDS_27} + +FILE_28=ParallelBuffer.o +DEPENDS_28:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/ParallelBuffer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ParallelBuffer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_25 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_28 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_25:X.o=${NDIM}.o}: ${DEPENDS_25} -FILE_26=Parser.o -DEPENDS_26:=\ +${FILE_28}: ${DEPENDS_28} + +FILE_29=Parser.o +DEPENDS_29:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -595,23 +608,20 @@ DEPENDS_26:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Parser.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Parser.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_26 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_29 +=\ + -${FILE_26:X.o=${NDIM}.o}: ${DEPENDS_26} -FILE_27=RankGroup.o -DEPENDS_27:=\ +${FILE_29}: ${DEPENDS_29} + +FILE_30=RankGroup.o +DEPENDS_30:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -621,38 +631,57 @@ DEPENDS_27:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RankGroup.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_27 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_30 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_27:X.o=${NDIM}.o}: ${DEPENDS_27} -FILE_28=ReferenceCounter.o -DEPENDS_28:=\ +${FILE_30}: ${DEPENDS_30} + +FILE_31=RankTreeStrategy.o +DEPENDS_31:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RankTreeStrategy.C + +DEPENDS_31 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_31}: ${DEPENDS_31} + +FILE_32=ReferenceCounter.o +DEPENDS_32:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ ReferenceCounter.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_28 +=\ +DEPENDS_32 +=\ -endif -${FILE_28:X.o=${NDIM}.o}: ${DEPENDS_28} -FILE_29=RestartManager.o -DEPENDS_29:=\ +${FILE_32}: ${DEPENDS_32} + +FILE_33=RestartManager.o +DEPENDS_33:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -664,7 +693,6 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/tbox/NullDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Parser.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -672,17 +700,15 @@ DEPENDS_29:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h RestartManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_29 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_33 +=\ + -${FILE_29:X.o=${NDIM}.o}: ${DEPENDS_29} -FILE_30=SAMRAIManager.o -DEPENDS_30:=\ +${FILE_33}: ${DEPENDS_33} + +FILE_34=SAMRAIManager.o +DEPENDS_34:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -692,24 +718,20 @@ DEPENDS_30:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SAMRAIManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_30 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_34 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_30:X.o=${NDIM}.o}: ${DEPENDS_30} -FILE_31=SAMRAI_MPI.o -DEPENDS_31:=\ +${FILE_34}: ${DEPENDS_34} + +FILE_35=SAMRAI_MPI.o +DEPENDS_35:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -717,23 +739,20 @@ DEPENDS_31:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SAMRAI_MPI.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_31 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_35 +=\ + -${FILE_31:X.o=${NDIM}.o}: ${DEPENDS_31} -FILE_32=Scanner.o -DEPENDS_32:=\ +${FILE_35}: ${DEPENDS_35} + +FILE_36=Scanner.o +DEPENDS_36:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -742,21 +761,18 @@ DEPENDS_32:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Parser.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Grammar.h Scanner.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_32 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_36 +=\ + -${FILE_32:X.o=${NDIM}.o}: ${DEPENDS_32} -FILE_33=Schedule.o -DEPENDS_33:=\ +${FILE_36}: ${DEPENDS_36} + +FILE_37=Schedule.o +DEPENDS_37:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ @@ -765,10 +781,12 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -779,18 +797,15 @@ DEPENDS_33:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Schedule.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_33 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_37 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C -endif -${FILE_33:X.o=${NDIM}.o}: ${DEPENDS_33} -FILE_34=Serializable.o -DEPENDS_34:=\ +${FILE_37}: ${DEPENDS_37} + +FILE_38=Serializable.o +DEPENDS_38:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -798,22 +813,19 @@ DEPENDS_34:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Serializable.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_34 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_38 +=\ + -${FILE_34:X.o=${NDIM}.o}: ${DEPENDS_34} -FILE_35=SiloDatabase.o -DEPENDS_35:=\ +${FILE_38}: ${DEPENDS_38} + +FILE_39=SiloDatabase.o +DEPENDS_39:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -822,23 +834,19 @@ DEPENDS_35:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SiloDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SiloDatabase.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_35 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_39 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_35:X.o=${NDIM}.o}: ${DEPENDS_35} -FILE_36=SiloDatabaseFactory.o -DEPENDS_36:=\ +${FILE_39}: ${DEPENDS_39} + +FILE_40=SiloDatabaseFactory.o +DEPENDS_40:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -847,38 +855,34 @@ DEPENDS_36:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SiloDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SiloDatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SiloDatabaseFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_36 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_40 +=\ + -${FILE_36:X.o=${NDIM}.o}: ${DEPENDS_36} -FILE_37=StartupShutdownManager.o -DEPENDS_37:=\ +${FILE_40}: ${DEPENDS_40} + +FILE_41=StartupShutdownManager.o +DEPENDS_41:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h StartupShutdownManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_37 +=\ +DEPENDS_41 +=\ -endif -${FILE_37:X.o=${NDIM}.o}: ${DEPENDS_37} -FILE_38=StatTransaction.o -DEPENDS_38:=\ +${FILE_41}: ${DEPENDS_41} + +FILE_42=StatTransaction.o +DEPENDS_42:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -887,24 +891,21 @@ DEPENDS_38:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StatTransaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h StatTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_38 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_42 +=\ + -${FILE_38:X.o=${NDIM}.o}: ${DEPENDS_38} -FILE_39=Statistic.o -DEPENDS_39:=\ +${FILE_42}: ${DEPENDS_42} + +FILE_43=Statistic.o +DEPENDS_43:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -914,25 +915,21 @@ DEPENDS_39:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Statistic.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_39 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_43 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_39:X.o=${NDIM}.o}: ${DEPENDS_39} -FILE_40=Statistician.o -DEPENDS_40:=\ +${FILE_43}: ${DEPENDS_43} + +FILE_44=Statistician.o +DEPENDS_44:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ @@ -946,7 +943,6 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -961,19 +957,16 @@ DEPENDS_40:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Statistician.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_40 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_44 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_40:X.o=${NDIM}.o}: ${DEPENDS_40} -FILE_41=Timer.o -DEPENDS_41:=\ +${FILE_44}: ${DEPENDS_44} + +FILE_45=Timer.o +DEPENDS_45:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -982,7 +975,6 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -991,17 +983,15 @@ DEPENDS_41:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Timer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_41 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_45 +=\ + -${FILE_41:X.o=${NDIM}.o}: ${DEPENDS_41} -FILE_42=TimerManager.o -DEPENDS_42:=\ +${FILE_45}: ${DEPENDS_45} + +FILE_46=TimerManager.o +DEPENDS_46:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1013,7 +1003,6 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -1023,28 +1012,26 @@ DEPENDS_42:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h TimerManager.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_42 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_46 +=\ + -${FILE_42:X.o=${NDIM}.o}: ${DEPENDS_42} -FILE_43=Tracer.o -DEPENDS_43:=\ +${FILE_46}: ${DEPENDS_46} + +FILE_47=Tracer.o +DEPENDS_47:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Tracer.h Tracer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_43 +=\ +DEPENDS_47 +=\ -endif -${FILE_43:X.o=${NDIM}.o}: ${DEPENDS_43} -FILE_44=Transaction.o -DEPENDS_44:=\ +${FILE_47}: ${DEPENDS_47} + +FILE_48=Transaction.o +DEPENDS_48:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ @@ -1054,17 +1041,15 @@ DEPENDS_44:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Transaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_44 +=\ +DEPENDS_48 +=\ -endif -${FILE_44:X.o=${NDIM}.o}: ${DEPENDS_44} -FILE_45=Utilities.o -DEPENDS_45:=\ +${FILE_48}: ${DEPENDS_48} + +FILE_49=Utilities.o +DEPENDS_49:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1072,16 +1057,14 @@ DEPENDS_45:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Utilities.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_45 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif +DEPENDS_49 +=\ + + -${FILE_45:X.o=${NDIM}.o}: ${DEPENDS_45} +${FILE_49}: ${DEPENDS_49} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.in index b6587445..874baf26 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI tbox package ## ######################################################################### @@ -26,7 +26,10 @@ OBJS = \ AsyncCommGroup.o \ AsyncCommStage.o \ BalancedDepthFirstTree.o \ + BreadthFirstRankTree.o \ + CenteredRankTree.o \ Clock.o \ + CommGraphWriter.o \ Database.o \ DatabaseBox.o \ DatabaseFactory.o \ @@ -47,6 +50,7 @@ OBJS = \ ParallelBuffer.o \ Parser.o \ RankGroup.o \ + RankTreeStrategy.o \ ReferenceCounter.o \ RestartManager.o \ SAMRAIManager.o \ @@ -69,7 +73,7 @@ OBJS = \ library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.C index 3b1a9706..62fd1ad3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utilities class to access common POSIX constants and math ops * ************************************************************************/ @@ -11,24 +11,26 @@ #ifndef included_tbox_MathUtilities_C #define included_tbox_MathUtilities_C +#include + namespace SAMRAI { namespace tbox { /* ************************************************************************* * - * Routines to initialize arrays to signaling NaNs. + * Routines to initialize vectors and arrays to signaling NaNs. * ************************************************************************* */ template void -MathUtilities::setArrayToSignalingNaN( - Array& array) +MathUtilities::setVectorToSignalingNaN( + std::vector& vector) { - for (int i = 0; i < array.getSize(); i++) { - array[i] = getSignalingNaN(); + for (int i = 0; i < static_cast(vector.size()); ++i) { + vector[i] = getSignalingNaN(); } } @@ -38,7 +40,7 @@ MathUtilities::setArrayToSignalingNaN( TYPE* array, int n) { - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { array[i] = getSignalingNaN(); } } @@ -46,18 +48,18 @@ MathUtilities::setArrayToSignalingNaN( /* ************************************************************************* * - * Routines to initialize arrays to max value for type. + * Routines to initialize vectors and arrays to max value for type. * ************************************************************************* */ template void -MathUtilities::setArrayToMax( - Array& array) +MathUtilities::setVectorToMax( + std::vector& vector) { - for (int i = 0; i < array.getSize(); i++) { - array[i] = getMax(); + for (int i = 0; i < static_cast(vector.size()); ++i) { + vector[i] = getMax(); } } @@ -67,7 +69,7 @@ MathUtilities::setArrayToMax( TYPE* array, int n) { - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { array[i] = getMax(); } } @@ -75,18 +77,18 @@ MathUtilities::setArrayToMax( /* ************************************************************************* * - * Routines to initialize arrays to min value for type. + * Routines to initialize vectors and arrays to min value for type. * ************************************************************************* */ template void -MathUtilities::setArrayToMin( - Array& array) +MathUtilities::setVectorToMin( + std::vector& vector) { - for (int i = 0; i < array.getSize(); i++) { - array[i] = getMin(); + for (int i = 0; i < static_cast(vector.size()); ++i) { + vector[i] = getMin(); } } @@ -96,7 +98,7 @@ MathUtilities::setArrayToMin( TYPE* array, int n) { - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { array[i] = getMin(); } } @@ -104,18 +106,18 @@ MathUtilities::setArrayToMin( /* ************************************************************************* * - * Routines to initialize arrays to epsilon value for type. + * Routines to initialize vectors and arrays to epsilon value for type. * ************************************************************************* */ template void -MathUtilities::setArrayToEpsilon( - Array& array) +MathUtilities::setVectorToEpsilon( + std::vector& vector) { - for (int i = 0; i < array.getSize(); i++) { - array[i] = getEpsilon(); + for (int i = 0; i < static_cast(vector.size()); ++i) { + vector[i] = getEpsilon(); } } @@ -125,7 +127,7 @@ MathUtilities::setArrayToEpsilon( TYPE* array, int n) { - for (int i = 0; i < n; i++) { + for (int i = 0; i < n; ++i) { array[i] = getEpsilon(); } } @@ -148,28 +150,28 @@ template TYPE MathUtilities::getSignalingNaN() { - return s_signaling_nan; + return std::numeric_limits::signaling_NaN(); } template TYPE MathUtilities::getMax() { - return s_max; + return std::numeric_limits::max(); } template TYPE MathUtilities::getMin() { - return s_min; + return std::numeric_limits::min(); } template TYPE MathUtilities::getEpsilon() { - return s_epsilon; + return std::numeric_limits::epsilon(); } template diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.h index 626fcfb1..e513aee4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utilities class to access common POSIX constants and math ops * ************************************************************************/ @@ -13,9 +13,10 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Complex.h" +#include + namespace SAMRAI { namespace tbox { @@ -37,11 +38,11 @@ namespace tbox { * computer architecture and how it implements floating point arithmetic * and hardware traps. * - * Note that the class @see tbox::IEEE also provides operations for + * Note that the class @see IEEE also provides operations for * dealing with signaling NaNs. This class provides the actual - * implementation for such operations with functions in tbox::IEEE + * implementation for such operations with functions in IEEE * calling the approriate operations provided here. The class - * tbox::IEEE is not templated on the data type and so calling the + * IEEE is not templated on the data type and so calling the * operations provided there may be easier in some cases, such as in * codes built based on earlier versions of SAMRAI. */ @@ -92,13 +93,13 @@ class MathUtilities const TYPE& value); /*! - * @brief Set array entries to value given by getSignalingNaN(). + * @brief Set vector entries to value given by getSignalingNaN(). * - * @param array SAMRAI array to set + * @param vector SAMRAI array to set */ static void - setArrayToSignalingNaN( - Array& array); + setVectorToSignalingNaN( + std::vector& vector); /*! * @brief Set array entries to value given by getSignalingNaN(). @@ -108,7 +109,7 @@ class MathUtilities */ static void setArrayToSignalingNaN( - TYPE* array, + TYPE * array, int n = 1); /*! @@ -141,13 +142,13 @@ class MathUtilities getMax(); /*! - * @brief Set array entries to value given by getMax(). + * @brief Set vector entries to value given by getMax(). * - * @param array SAMRAI array to set + * @param vector SAMRAI array to set */ static void - setArrayToMax( - Array& array); + setVectorToMax( + std::vector& vector); /*! * @brief Set array entries to value given by getMax(). @@ -157,7 +158,7 @@ class MathUtilities */ static void setArrayToMax( - TYPE* array, + TYPE * array, int n = 1); /*! @@ -172,13 +173,13 @@ class MathUtilities getMin(); /*! - * @brief Set array entries to value given by getMin(). + * @brief Set vector entries to value given by getMin(). * - * @param array SAMRAI array to set + * @param vector SAMRAI array to set */ static void - setArrayToMin( - Array& array); + setVectorToMin( + std::vector& vector); /*! * @brief Set array entries to value given by getMin(). @@ -188,7 +189,7 @@ class MathUtilities */ static void setArrayToMin( - TYPE* array, + TYPE * array, int n = 1); /*! @@ -204,13 +205,13 @@ class MathUtilities getEpsilon(); /*! - * @brief Set array entries to value given by getEpsilon(). + * @brief Set vector entries to value given by getEpsilon(). * - * @param array SAMRAI array to set + * @param vector SAMRAI array to set */ static void - setArrayToEpsilon( - Array& array); + setVectorToEpsilon( + std::vector& vector); /*! * @brief Set array entries to value given by getEpsilon(). @@ -220,7 +221,7 @@ class MathUtilities */ static void setArrayToEpsilon( - TYPE* array, + TYPE * array, int n = 1); /*! @@ -292,12 +293,20 @@ class MathUtilities const TYPE& width); private: + // Unimplemented default constructor. + MathUtilities(); + + // Unimplemented copy constructor. + MathUtilities( + const MathUtilities& other); + + // Unimplemented assignment operator. + MathUtilities& + operator = ( + const MathUtilities& rhs); + static TYPE s_zero; static TYPE s_one; - static TYPE s_signaling_nan; - static TYPE s_max; - static TYPE s_min; - static TYPE s_epsilon; }; /* diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilitiesSpecial.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilitiesSpecial.C index ded892a7..1b8c6a83 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilitiesSpecial.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MathUtilitiesSpecial.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: MathUtilities routines to set up handlers and get * signaling NaNs * @@ -23,18 +23,7 @@ #include #include "SAMRAI/tbox/Complex.h" - -/* - * Floating point assertion handling. - * The following lines setup assertion handling header files on - * systems other than solaris. - */ -#if defined(HAVE_EXCEPTION_HANDLING) -#include -#include -#include -#include -#endif +#include "Utilities.h" /* * The following lines setup assertion handling headers on the Sun. If we @@ -55,108 +44,35 @@ namespace SAMRAI { namespace tbox { -/* - * Settings for the various signaling NaNs on different systems - */ -//#if !defined(FLT_SNAN_IS_BROKEN) -//#define SAMRAI_FLT_SNAN FLT_SNAN -//#elif !defined(FLT_MAX_IS_BROKEN) -//#define SAMRAI_FLT_SNAN FLT_MAX -//#else -//#define SAMRAI_FLT_SNAN NAN -//#endif -// -//#if !defined(DBL_SNAN_IS_BROKEN) -//#define SAMRAI_DBL_SNAN DBL_SNAN -//#elif !defined(DBL_MAX_IS_BROKEN) -//#define SAMRAI_DBL_SNAN DBL_MAX -//#else -//#define SAMRAI_DBL_SNAN NAN -//#endif - -// TODO: This is in place ONLY for the 3.0.10 patch release. A change to the -// way we are doing signaling NaNs will be in the next release. -#define SAMRAI_FLT_SNAN FLT_MAX -#define SAMRAI_DBL_SNAN DBL_MAX - template<> bool MathUtilities::s_zero = false; template<> bool MathUtilities::s_one = true; -template<> -bool MathUtilities::s_signaling_nan = false; -template<> -bool MathUtilities::s_max = true; -template<> -bool MathUtilities::s_min = false; -template<> -bool MathUtilities::s_epsilon = true; template<> char MathUtilities::s_zero = 0; template<> char MathUtilities::s_one = 1; -template<> -char MathUtilities::s_signaling_nan = CHAR_MAX; -template<> -char MathUtilities::s_max = CHAR_MAX; -template<> -char MathUtilities::s_min = CHAR_MIN; -template<> -char MathUtilities::s_epsilon = 1; template<> int MathUtilities::s_zero = 0; template<> int MathUtilities::s_one = 1; -template<> -int MathUtilities::s_signaling_nan = INT_MAX; -template<> -int MathUtilities::s_max = INT_MAX; -template<> -int MathUtilities::s_min = INT_MIN; -template<> -int MathUtilities::s_epsilon = 1; template<> float MathUtilities::s_zero = 0.0; template<> float MathUtilities::s_one = 1.0; -template<> -float MathUtilities::s_signaling_nan = SAMRAI_FLT_SNAN; -template<> -float MathUtilities::s_max = FLT_MAX; -template<> -float MathUtilities::s_min = FLT_MIN; -template<> -float MathUtilities::s_epsilon = FLT_EPSILON; template<> double MathUtilities::s_zero = 0.0; template<> double MathUtilities::s_one = 1.0; -template<> -double MathUtilities::s_signaling_nan = SAMRAI_DBL_SNAN; -template<> -double MathUtilities::s_max = DBL_MAX; -template<> -double MathUtilities::s_min = DBL_MIN; -template<> -double MathUtilities::s_epsilon = DBL_EPSILON; template<> dcomplex MathUtilities::s_zero = dcomplex(0.0, 0.0); template<> dcomplex MathUtilities::s_one = dcomplex(1.0, 0.0); -template<> -dcomplex MathUtilities::s_signaling_nan = dcomplex(SAMRAI_DBL_SNAN, - SAMRAI_DBL_SNAN); -template<> -dcomplex MathUtilities::s_max = dcomplex(DBL_MAX, DBL_MAX); -template<> -dcomplex MathUtilities::s_min = dcomplex(DBL_MIN, DBL_MIN); -template<> -dcomplex MathUtilities::s_epsilon = dcomplex(DBL_MIN, 0.0); template<> bool MathUtilities::isNaN( @@ -228,6 +144,14 @@ MathUtilities::isNaN( return ((i_re != 0) || (i_im != 0)) ? true : false; } +template<> +dcomplex +MathUtilities::getSignalingNaN() +{ + return dcomplex(std::numeric_limits::signaling_NaN(), + std::numeric_limits::signaling_NaN()); +} + template<> bool MathUtilities::equalEps( @@ -239,10 +163,9 @@ MathUtilities::equalEps( MathUtilities::Abs(b)); float numerator = MathUtilities::Abs(a - b); float denomenator = - MathUtilities::Max(absmax, - MathUtilities::s_epsilon); + MathUtilities::Max(absmax, MathUtilities::getEpsilon()); - return numerator / denomenator < sqrt(MathUtilities::s_epsilon); + return numerator / denomenator < sqrt(MathUtilities::getEpsilon()); } template<> @@ -256,10 +179,9 @@ MathUtilities::equalEps( MathUtilities::Abs(b)); double numerator = MathUtilities::Abs(a - b); double denomenator = - MathUtilities::Max(absmax, - MathUtilities::s_epsilon); + MathUtilities::Max(absmax, MathUtilities::getEpsilon()); - return numerator / denomenator < sqrt(MathUtilities::s_epsilon); + return numerator / denomenator < sqrt(MathUtilities::getEpsilon()); } template<> @@ -411,8 +333,12 @@ round_internal( } } -template float round_internal(float x); -template double round_internal(double x); +template float round_internal( + float x); +template double round_internal( + double x); template<> float diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.C index e653ae30..17172027 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An memory database structure that stores (key,value) pairs in memory * ************************************************************************/ @@ -42,7 +42,7 @@ const int MemoryDatabase::PRINT_UNUSED = 4; const int MemoryDatabase::SSTREAM_BUFFER = 4096; MemoryDatabase::MemoryDatabase( - const std::string& name) : + const std::string& name): d_database_name(name) { } @@ -141,15 +141,14 @@ MemoryDatabase::keyExists( ************************************************************************* */ -Array +std::vector MemoryDatabase::getAllKeys() { - const int n = static_cast(d_keyvalues.size()); - Array keys(n); + std::vector keys(d_keyvalues.size()); - int k = 0; + std::vector::size_type k = 0; for (std::list::iterator i = d_keyvalues.begin(); - i != d_keyvalues.end(); i++) { + i != d_keyvalues.end(); ++i) { keys[k++] = i->d_key; } @@ -184,7 +183,7 @@ MemoryDatabase::getArrayType( ************************************************************************* */ -int +size_t MemoryDatabase::getArraySize( const std::string& key) { @@ -264,19 +263,11 @@ MemoryDatabase::putBool( putBoolArray(key, &data, 1); } -void -MemoryDatabase::putBoolArray( - const std::string& key, - const Array& data) -{ - putBoolArray(key, data.getPointer(), data.getSize()); -} - void MemoryDatabase::putBoolArray( const std::string& key, const bool * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -285,9 +276,9 @@ MemoryDatabase::putBoolArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_boolean = Array(nelements); + keydata.d_boolean = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_boolean[i] = data[i]; } @@ -320,8 +311,8 @@ MemoryDatabase::getBoolWithDefault( return defaultvalue; } -Array -MemoryDatabase::getBoolArray( +std::vector +MemoryDatabase::getBoolVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); @@ -336,19 +327,19 @@ void MemoryDatabase::getBoolArray( const std::string& key, bool* data, - const int nelements) + const size_t nelements) { - Array tmp = getBoolArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getBoolVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -378,18 +369,18 @@ MemoryDatabase::putDatabaseBox( } void -MemoryDatabase::putDatabaseBoxArray( +MemoryDatabase::putDatabaseBoxVector( const std::string& key, - const Array& data) + const std::vector& data) { - putDatabaseBoxArray(key, data.getPointer(), data.getSize()); + putDatabaseBoxArray(key, &data[0], data.size()); } void MemoryDatabase::putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -398,9 +389,9 @@ MemoryDatabase::putDatabaseBoxArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_box = Array(nelements); + keydata.d_box = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_box[i] = data[i]; } @@ -433,8 +424,8 @@ MemoryDatabase::getDatabaseBoxWithDefault( return defaultvalue; } -Array -MemoryDatabase::getDatabaseBoxArray( +std::vector +MemoryDatabase::getDatabaseBoxVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); @@ -449,19 +440,19 @@ void MemoryDatabase::getDatabaseBoxArray( const std::string& key, DatabaseBox* data, - const int nelements) + const size_t nelements) { - Array tmp = getDatabaseBoxArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getDatabaseBoxVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -491,18 +482,18 @@ MemoryDatabase::putChar( } void -MemoryDatabase::putCharArray( +MemoryDatabase::putCharVector( const std::string& key, - const Array& data) + const std::vector& data) { - putCharArray(key, data.getPointer(), data.getSize()); + putCharArray(key, &data[0], data.size()); } void MemoryDatabase::putCharArray( const std::string& key, const char * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -511,9 +502,9 @@ MemoryDatabase::putCharArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_char = Array(nelements); + keydata.d_char = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_char[i] = data[i]; } @@ -546,8 +537,8 @@ MemoryDatabase::getCharWithDefault( return defaultvalue; } -Array -MemoryDatabase::getCharArray( +std::vector +MemoryDatabase::getCharVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); @@ -562,19 +553,19 @@ void MemoryDatabase::getCharArray( const std::string& key, char* data, - const int nelements) + const size_t nelements) { - Array tmp = getCharArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getCharVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -609,18 +600,18 @@ MemoryDatabase::putComplex( } void -MemoryDatabase::putComplexArray( +MemoryDatabase::putComplexVector( const std::string& key, - const Array& data) + const std::vector& data) { - putComplexArray(key, data.getPointer(), data.getSize()); + putComplexArray(key, &data[0], data.size()); } void MemoryDatabase::putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -629,9 +620,9 @@ MemoryDatabase::putComplexArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_complex = Array(nelements); + keydata.d_complex = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_complex[i] = data[i]; } @@ -683,30 +674,33 @@ MemoryDatabase::getComplexWithDefault( return defaultvalue; } -Array -MemoryDatabase::getComplexArray( +std::vector +MemoryDatabase::getComplexVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); - Array array; + std::vector array; switch (keydata->d_type) { case Database::SAMRAI_INT: { - array = Array(keydata->d_integer.getSize()); - for (int i = 0; i < keydata->d_integer.getSize(); i++) { + array = std::vector(keydata->d_integer.size()); + for (std::vector::size_type i = 0; + i < keydata->d_integer.size(); ++i) { array[i] = dcomplex((double)keydata->d_integer[i], 0.0); } break; } case Database::SAMRAI_FLOAT: { - array = Array(keydata->d_float.getSize()); - for (int i = 0; i < keydata->d_float.getSize(); i++) { + array = std::vector(keydata->d_float.size()); + for (std::vector::size_type i = 0; + i < keydata->d_float.size(); ++i) { array[i] = dcomplex((double)keydata->d_float[i], 0.0); } break; } case Database::SAMRAI_DOUBLE: { - array = Array(keydata->d_double.getSize()); - for (int i = 0; i < keydata->d_float.getSize(); i++) { + array = std::vector(keydata->d_double.size()); + for (std::vector::size_type i = 0; + i < keydata->d_double.size(); ++i) { array[i] = dcomplex(keydata->d_double[i], 0.0); } break; @@ -725,19 +719,19 @@ void MemoryDatabase::getComplexArray( const std::string& key, dcomplex* data, - const int nelements) + const size_t nelements) { - Array tmp = getComplexArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getComplexVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -770,18 +764,18 @@ MemoryDatabase::putDouble( } void -MemoryDatabase::putDoubleArray( +MemoryDatabase::putDoubleVector( const std::string& key, - const Array& data) + const std::vector& data) { - putDoubleArray(key, data.getPointer(), data.getSize()); + putDoubleArray(key, &data[0], data.size()); } void MemoryDatabase::putDoubleArray( const std::string& key, const double * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -790,9 +784,9 @@ MemoryDatabase::putDoubleArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_double = Array(nelements); + keydata.d_double = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_double[i] = data[i]; } @@ -841,23 +835,23 @@ MemoryDatabase::getDoubleWithDefault( return defaultvalue; } -Array -MemoryDatabase::getDoubleArray( +std::vector +MemoryDatabase::getDoubleVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); - Array array; + std::vector array; switch (keydata->d_type) { case Database::SAMRAI_INT: { - array = Array(keydata->d_integer.getSize()); - for (int i = 0; i < keydata->d_integer.getSize(); i++) { + array = std::vector(keydata->d_integer.size()); + for (size_t i = 0; i < keydata->d_integer.size(); ++i) { array[i] = (double)keydata->d_integer[i]; } break; } case Database::SAMRAI_FLOAT: { - array = Array(keydata->d_float.getSize()); - for (int i = 0; i < keydata->d_float.getSize(); i++) { + array = std::vector(keydata->d_float.size()); + for (size_t i = 0; i < keydata->d_float.size(); ++i) { array[i] = (double)keydata->d_float[i]; } break; @@ -877,19 +871,19 @@ void MemoryDatabase::getDoubleArray( const std::string& key, double* data, - const int nelements) + const size_t nelements) { - Array tmp = getDoubleArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getDoubleVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -923,18 +917,18 @@ MemoryDatabase::putFloat( } void -MemoryDatabase::putFloatArray( +MemoryDatabase::putFloatVector( const std::string& key, - const Array& data) + const std::vector& data) { - putFloatArray(key, data.getPointer(), data.getSize()); + putFloatArray(key, &data[0], data.size()); } void MemoryDatabase::putFloatArray( const std::string& key, const float * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -943,9 +937,9 @@ MemoryDatabase::putFloatArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_float = Array(nelements); + keydata.d_float = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_float[i] = data[i]; } @@ -1000,16 +994,16 @@ MemoryDatabase::getFloatWithDefault( return defaultvalue; } -Array -MemoryDatabase::getFloatArray( +std::vector +MemoryDatabase::getFloatVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); - Array array; + std::vector array; switch (keydata->d_type) { case Database::SAMRAI_INT: { - array = Array(keydata->d_integer.getSize()); - for (int i = 0; i < keydata->d_integer.getSize(); i++) { + array = std::vector(keydata->d_integer.size()); + for (size_t i = 0; i < keydata->d_integer.size(); ++i) { array[i] = static_cast(keydata->d_integer[i]); } break; @@ -1018,8 +1012,8 @@ MemoryDatabase::getFloatArray( array = keydata->d_float; break; case Database::SAMRAI_DOUBLE: { - array = Array(keydata->d_double.getSize()); - for (int i = 0; i < keydata->d_double.getSize(); i++) { + array = std::vector(keydata->d_double.size()); + for (size_t i = 0; i < keydata->d_double.size(); ++i) { array[i] = static_cast(keydata->d_double[i]); } break; @@ -1035,19 +1029,19 @@ void MemoryDatabase::getFloatArray( const std::string& key, float* data, - const int nelements) + const size_t nelements) { - Array tmp = getFloatArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getFloatVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -1077,18 +1071,18 @@ MemoryDatabase::putInteger( } void -MemoryDatabase::putIntegerArray( +MemoryDatabase::putIntegerVector( const std::string& key, - const Array& data) + const std::vector& data) { - putIntegerArray(key, data.getPointer(), data.getSize()); + putIntegerArray(key, &data[0], data.size()); } void MemoryDatabase::putIntegerArray( const std::string& key, const int * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -1097,9 +1091,9 @@ MemoryDatabase::putIntegerArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_integer = Array(nelements); + keydata.d_integer = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_integer[i] = data[i]; } @@ -1132,8 +1126,8 @@ MemoryDatabase::getIntegerWithDefault( return defaultvalue; } -Array -MemoryDatabase::getIntegerArray( +std::vector +MemoryDatabase::getIntegerVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); @@ -1148,19 +1142,19 @@ void MemoryDatabase::getIntegerArray( const std::string& key, int* data, - const int nelements) + const size_t nelements) { - Array tmp = getIntegerArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getIntegerVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -1190,18 +1184,18 @@ MemoryDatabase::putString( } void -MemoryDatabase::putStringArray( +MemoryDatabase::putStringVector( const std::string& key, - const Array& data) + const std::vector& data) { - putStringArray(key, data.getPointer(), data.getSize()); + putStringArray(key, &data[0], data.size()); } void MemoryDatabase::putStringArray( const std::string& key, const std::string * const data, - const int nelements) + const size_t nelements) { deleteKeyIfFound(key); KeyData keydata; @@ -1210,9 +1204,9 @@ MemoryDatabase::putStringArray( keydata.d_array_size = nelements; keydata.d_accessed = false; keydata.d_from_default = false; - keydata.d_string = Array(nelements); + keydata.d_string = std::vector(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { keydata.d_string[i] = data[i]; } @@ -1245,8 +1239,8 @@ MemoryDatabase::getStringWithDefault( return defaultvalue; } -Array -MemoryDatabase::getStringArray( +std::vector +MemoryDatabase::getStringVector( const std::string& key) { KeyData* keydata = findKeyDataOrExit(key); @@ -1261,19 +1255,19 @@ void MemoryDatabase::getStringArray( const std::string& key, std::string* data, - const int nelements) + const size_t nelements) { - Array tmp = getStringArray(key); - const int tsize = tmp.getSize(); + std::vector tmp = getStringVector(key); + const size_t tsize = tmp.size(); - if (nelements != tmp.getSize()) { + if (nelements != tsize) { MEMORY_DB_ERROR( "Incorrect array size=" << nelements << " specified for key=" << key << " with array size=" << tsize << "..."); } - for (int i = 0; i < tsize; i++) { + for (size_t i = 0; i < tsize; ++i) { data[i] = tmp[i]; } } @@ -1304,7 +1298,7 @@ bool MemoryDatabase::deleteKeyIfFound( const std::string& key) { for (std::list::iterator i = d_keyvalues.begin(); - i != d_keyvalues.end(); i++) { + i != d_keyvalues.end(); ++i) { if (i->d_key == key) { d_keyvalues.erase(i); return true; @@ -1317,7 +1311,7 @@ bool MemoryDatabase::deleteKeyIfFound( ************************************************************************* * * Find the key data associated with the specified key and return a - * pointer to the record. If no such key data exists, then return NULL. + * pointer to the record. If no such key data exists, then return 0. * ************************************************************************* */ @@ -1327,12 +1321,12 @@ MemoryDatabase::findKeyData( const std::string& key) { for (std::list::iterator i = d_keyvalues.begin(); - i != d_keyvalues.end(); i++) { + i != d_keyvalues.end(); ++i) { if (key == i->d_key) { return &(*i); } } - return NULL; + return 0; } /* @@ -1350,13 +1344,13 @@ MemoryDatabase::findKeyDataOrExit( const std::string& key) { for (std::list::iterator i = d_keyvalues.begin(); - i != d_keyvalues.end(); i++) { + i != d_keyvalues.end(); ++i) { if (key == i->d_key) { return &(*i); } } MEMORY_DB_ERROR("Key ``" << key << "'' does not exist in the database..."); - return NULL; + return 0; } /* @@ -1392,14 +1386,14 @@ MemoryDatabase::printDatabase( * Get the maximum key width in the output (excluding databases) */ - long width = 0; + int width = 0; for (std::list::const_iterator k = d_keyvalues.begin(); - k != d_keyvalues.end(); k++) { + k != d_keyvalues.end(); ++k) { if (((k->d_from_default) && (toprint & PRINT_DEFAULT)) || ((k->d_accessed) && (toprint & PRINT_INPUT)) || (!(k->d_accessed) && (toprint & PRINT_UNUSED))) { if (k->d_type != Database::SAMRAI_DATABASE) { - const long keywidth = k->d_key.length(); + const int keywidth = static_cast(k->d_key.length()); if (keywidth > width) { width = keywidth; } @@ -1414,7 +1408,7 @@ MemoryDatabase::printDatabase( indentStream(os, indent); os << d_database_name << " {\n"; for (std::list::const_iterator i = d_keyvalues.begin(); - i != d_keyvalues.end(); i++) { + i != d_keyvalues.end(); ++i) { if (((i->d_from_default) && (toprint & PRINT_DEFAULT)) || ((i->d_accessed) && (toprint & PRINT_INPUT)) @@ -1440,10 +1434,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_BOOL: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_boolean.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_boolean.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << (i->d_boolean[j] ? "TRUE" : "FALSE"); if (j < n - 1) { sstream << ", "; @@ -1455,20 +1449,20 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_BOX: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_box.getSize(); - for (int j = 0; j < n; j++) { - const int m = i->d_box[j].getDim().getValue(); + const std::vector::size_type n = i->d_box.size(); + for (std::vector::size_type j = 0; j < n; ++j) { + const int m = i->d_box[j].getDimVal(); sstream << "[("; - for (int k = 0; k < m; k++) { + for (int k = 0; k < m; ++k) { sstream << i->d_box[j].lower(k); if (k < m - 1) { sstream << ","; } } sstream << "),("; - for (int l = 0; l < m; l++) { + for (int l = 0; l < m; ++l) { sstream << i->d_box[j].upper(l); if (l < m - 1) { sstream << ","; @@ -1485,10 +1479,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_CHAR: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_char.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_char.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << "'" << i->d_char[j] << "'"; if (j < n - 1) { sstream << ", "; @@ -1500,10 +1494,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_COMPLEX: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_complex.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_complex.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << i->d_complex[j]; if (j < n - 1) { sstream << ", "; @@ -1515,10 +1509,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_DOUBLE: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_double.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_double.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << i->d_double[j]; if (j < n - 1) { sstream << ", "; @@ -1530,10 +1524,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_FLOAT: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_float.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_float.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << i->d_float[j]; if (j < n - 1) { sstream << ", "; @@ -1545,10 +1539,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_INT: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_integer.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_integer.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << i->d_integer[j]; if (j < n - 1) { sstream << ", "; @@ -1560,10 +1554,10 @@ MemoryDatabase::printDatabase( case Database::SAMRAI_STRING: { indentStream(sstream, indent + 3); sstream << i->d_key; - indentStream(sstream, width - i->d_key.length()); + indentStream(sstream, width - static_cast(i->d_key.length())); sstream << " = "; - const int n = i->d_string.getSize(); - for (int j = 0; j < n; j++) { + const std::vector::size_type n = i->d_string.size(); + for (std::vector::size_type j = 0; j < n; ++j) { sstream << "\"" << i->d_string[j] << "\""; if (j < n - 1) { sstream << ", "; @@ -1579,9 +1573,9 @@ MemoryDatabase::printDatabase( if (i->d_type != Database::SAMRAI_DATABASE) { #ifndef LACKS_SSTREAM - const long tab = 59 - sstream.str().length(); + const int tab = static_cast(59 - sstream.str().length()); #else - const long tab = 59 - sstream.pcount(); + const int tab = static_cast(59 - sstream.pcount()); #endif if (tab > 0) { indentStream(sstream, tab); @@ -1606,11 +1600,10 @@ MemoryDatabase::printDatabase( */ for (std::list::const_iterator j = d_keyvalues.begin(); - j != d_keyvalues.end(); j++) { + j != d_keyvalues.end(); ++j) { if (j->d_type == Database::SAMRAI_DATABASE) { boost::shared_ptr db( - j->d_database, - boost::detail::dynamic_cast_tag()); + BOOST_CAST(j->d_database)); db->printDatabase(os, indent + 3, toprint); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.h index 965fcc3a..4170d9b0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A memory database structure that stores (key,value) pairs in memory * ************************************************************************/ @@ -84,6 +84,8 @@ class MemoryDatabase:public Database * @param read_write_mode Open the database in read-write * mode instead of read-only mode. NOTE: This class currently * does not support read-only mode, so this flag must be true. + * + * @pre read_write_mode == true */ virtual bool open( @@ -118,7 +120,7 @@ class MemoryDatabase:public Database /** * Return all keys in the database. */ - virtual Array + virtual std::vector getAllKeys(); /** @@ -136,7 +138,7 @@ class MemoryDatabase:public Database * Return the size of the array associated with the key. If the key * does not exist, then zero is returned. */ - virtual int + virtual size_t getArraySize( const std::string& key); @@ -184,16 +186,6 @@ class MemoryDatabase:public Database const std::string& key, const bool& data); - /** - * Create a boolean array entry in the database with the specified - * key name. If the key already exists in the database, then the old - * key record is deleted and the new one is silently created in its place. - */ - virtual void - putBoolArray( - const std::string& key, - const Array& data); - /** * Create a boolean array entry in the database with the specified * key name. If the key already exists in the database, then the old @@ -203,7 +195,7 @@ class MemoryDatabase:public Database putBoolArray( const std::string& key, const bool * const data, - const int nelements); + const size_t nelements); /** * Get a boolean entry in the database with the specified key name. @@ -229,11 +221,11 @@ class MemoryDatabase:public Database /** * Get a boolean entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a boolean array, then an error message is printed and + * is not a boolean vector, then an error message is printed and * the program exits. */ - virtual Array - getBoolArray( + virtual std::vector + getBoolVector( const std::string& key); /** @@ -246,8 +238,8 @@ class MemoryDatabase:public Database virtual void getBoolArray( const std::string& key, - bool * data, - const int nelements); + bool* data, + const size_t nelements); /** * Return whether the specified key represents a box entry. If @@ -268,14 +260,14 @@ class MemoryDatabase:public Database const DatabaseBox& data); /** - * Create a box array entry in the database with the specified + * Create a box vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putDatabaseBoxArray( + putDatabaseBoxVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a box array entry in the database with the specified @@ -286,7 +278,7 @@ class MemoryDatabase:public Database putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements); + const size_t nelements); /** * Get a box entry in the database with the specified key name. @@ -312,11 +304,13 @@ class MemoryDatabase:public Database /** * Get a box entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a box array, then an error message is printed and + * is not a box vector, then an error message is printed and * the program exits. + * + * @param key Key name in database. */ - virtual Array - getDatabaseBoxArray( + virtual std::vector + getDatabaseBoxVector( const std::string& key); /** @@ -329,8 +323,8 @@ class MemoryDatabase:public Database virtual void getDatabaseBoxArray( const std::string& key, - DatabaseBox * data, - const int nelements); + DatabaseBox* data, + const size_t nelements); /** * Return whether the specified key represents a character entry. If @@ -351,14 +345,14 @@ class MemoryDatabase:public Database const char& data); /** - * Create a character array entry in the database with the specified + * Create a character vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putCharArray( + putCharVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a character array entry in the database with the specified @@ -369,7 +363,7 @@ class MemoryDatabase:public Database putCharArray( const std::string& key, const char * const data, - const int nelements); + const size_t nelements); /** * Get a character entry in the database with the specified key name. @@ -395,11 +389,11 @@ class MemoryDatabase:public Database /** * Get a character entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a character array, then an error message is printed and + * is not a character vector, then an error message is printed and * the program exits. */ - virtual Array - getCharArray( + virtual std::vector + getCharVector( const std::string& key); /** @@ -412,8 +406,8 @@ class MemoryDatabase:public Database virtual void getCharArray( const std::string& key, - char * data, - const int nelements); + char* data, + const size_t nelements); /** * Return whether the specified key represents a complex entry. If @@ -435,14 +429,14 @@ class MemoryDatabase:public Database const dcomplex& data); /** - * Create a complex array entry in the database with the specified + * Create a complex vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putComplexArray( + putComplexVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a complex array entry in the database with the specified @@ -453,7 +447,7 @@ class MemoryDatabase:public Database putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements); + const size_t nelements); /** * Get a complex entry in the database with the specified key name. @@ -481,12 +475,12 @@ class MemoryDatabase:public Database /** * Get a complex entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a complex array, then an error message is printed and + * is not a complex vector, then an error message is printed and * the program exits. Complex values may be promoted from integers, * floats, or doubles. */ - virtual Array - getComplexArray( + virtual std::vector + getComplexVector( const std::string& key); /** @@ -500,8 +494,8 @@ class MemoryDatabase:public Database virtual void getComplexArray( const std::string& key, - dcomplex * data, - const int nelements); + dcomplex* data, + const size_t nelements); /** * Return whether the specified key represents a double entry. If @@ -523,14 +517,14 @@ class MemoryDatabase:public Database const double& data); /** - * Create a double array entry in the database with the specified + * Create a double vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putDoubleArray( + putDoubleVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a double array entry in the database with the specified @@ -541,7 +535,7 @@ class MemoryDatabase:public Database putDoubleArray( const std::string& key, const double * const data, - const int nelements); + const size_t nelements); /** * Get a double entry in the database with the specified key name. @@ -568,12 +562,12 @@ class MemoryDatabase:public Database /** * Get a double entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a double array, then an error message is printed and + * is not a double vector, then an error message is printed and * the program exits. Double values may be promoted from integers * or floats. */ - virtual Array - getDoubleArray( + virtual std::vector + getDoubleVector( const std::string& key); /** @@ -587,8 +581,8 @@ class MemoryDatabase:public Database virtual void getDoubleArray( const std::string& key, - double * data, - const int nelements); + double* data, + const size_t nelements); /** * Return whether the specified key represents a float entry. If @@ -610,14 +604,14 @@ class MemoryDatabase:public Database const float& data); /** - * Create a float array entry in the database with the specified + * Create a float vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putFloatArray( + putFloatVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a float array entry in the database with the specified @@ -628,7 +622,7 @@ class MemoryDatabase:public Database putFloatArray( const std::string& key, const float * const data, - const int nelements); + const size_t nelements); /** * Get a float entry in the database with the specified key name. @@ -656,12 +650,12 @@ class MemoryDatabase:public Database /** * Get a float entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a float array, then an error message is printed and + * is not a float vector, then an error message is printed and * the program exits. Float values may be promoted from integers * or silently truncated from doubles. */ - virtual Array - getFloatArray( + virtual std::vector + getFloatVector( const std::string& key); /** @@ -676,8 +670,8 @@ class MemoryDatabase:public Database virtual void getFloatArray( const std::string& key, - float * data, - const int nelements); + float* data, + const size_t nelements); /** * Return whether the specified key represents an integer entry. If @@ -698,14 +692,14 @@ class MemoryDatabase:public Database const int& data); /** - * Create an integer array entry in the database with the specified + * Create an integer vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putIntegerArray( + putIntegerVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create an integer array entry in the database with the specified @@ -716,7 +710,7 @@ class MemoryDatabase:public Database putIntegerArray( const std::string& key, const int * const data, - const int nelements); + const size_t nelements); /** * Get an integer entry in the database with the specified key name. @@ -742,11 +736,11 @@ class MemoryDatabase:public Database /** * Get an integer entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not an integer array, then an error message is printed and + * is not an integer vector, then an error message is printed and * the program exits. */ - virtual Array - getIntegerArray( + virtual std::vector + getIntegerVector( const std::string& key); /** @@ -759,8 +753,8 @@ class MemoryDatabase:public Database virtual void getIntegerArray( const std::string& key, - int * data, - const int nelements); + int* data, + const size_t nelements); /** * Return whether the specified key represents a std::string entry. If @@ -781,14 +775,14 @@ class MemoryDatabase:public Database const std::string& data); /** - * Create a string array entry in the database with the specified + * Create a string vector entry in the database with the specified * key name. If the key already exists in the database, then the old * key record is deleted and the new one is silently created in its place. */ virtual void - putStringArray( + putStringVector( const std::string& key, - const Array& data); + const std::vector& data); /** * Create a string array entry in the database with the specified @@ -799,7 +793,7 @@ class MemoryDatabase:public Database putStringArray( const std::string& key, const std::string * const data, - const int nelements); + const size_t nelements); /** * Get a string entry in the database with the specified key name. @@ -825,11 +819,11 @@ class MemoryDatabase:public Database /** * Get a string entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a string array, then an error message is printed and + * is not a string vector, then an error message is printed and * the program exits. */ - virtual Array - getStringArray( + virtual std::vector + getStringVector( const std::string& key); /** @@ -842,8 +836,8 @@ class MemoryDatabase:public Database virtual void getStringArray( const std::string& key, - std::string * data, - const int nelements); + std::string* data, + const size_t nelements); /** * @brief Returns the name of this database. @@ -904,9 +898,10 @@ class MemoryDatabase:public Database } private: + MemoryDatabase(); // not implemented MemoryDatabase( const MemoryDatabase&); // not implemented - void + MemoryDatabase& operator = ( const MemoryDatabase&); // not implemented @@ -918,18 +913,18 @@ class MemoryDatabase:public Database struct KeyData { std::string d_key; // key name enum Database::DataType d_type; // type of entry - int d_array_size; // size of array data + size_t d_array_size; // size of array data bool d_accessed; // whether accessed bool d_from_default; // from default key boost::shared_ptr d_database; // sub-database - Array d_boolean; // boolean array value - Array d_box; // box array value - Array d_char; // char array value - Array d_complex; // complex array value - Array d_double; // double array value - Array d_float; // float array value - Array d_integer; // integer array value - Array d_string; // string array value + std::vector d_boolean; // boolean vector value + std::vector d_box; // box vector value + std::vector d_char; // char vector value + std::vector d_complex; // complex vector value + std::vector d_double; // double vector value + std::vector d_float; // float vector value + std::vector d_integer; // integer vector value + std::vector d_string; // string vector value }; /* @@ -949,7 +944,7 @@ class MemoryDatabase:public Database std::ostream& os, const long indent) { - for (int i = 0; i < indent; i++) { + for (int i = 0; i < indent; ++i) { os << " "; } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.C index b95adb84..fa34fdf7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.C @@ -3,19 +3,43 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A factory for building MemoryDatabases * ************************************************************************/ #include "SAMRAI/tbox/MemoryDatabaseFactory.h" #include "SAMRAI/tbox/MemoryDatabase.h" +#include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace tbox { +MemoryDatabaseFactory::MemoryDatabaseFactory() +{ +} + +MemoryDatabaseFactory::~MemoryDatabaseFactory() +{ +} + +MemoryDatabaseFactory::MemoryDatabaseFactory( + const MemoryDatabaseFactory& other): + DatabaseFactory() +{ + NULL_USE(other); +} + +MemoryDatabaseFactory& +MemoryDatabaseFactory::operator = ( + const MemoryDatabaseFactory& rhs) +{ + NULL_USE(rhs); + return *this; +} + /** * Build a new MemoryDatabase object. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.h index 12cae75d..ab6e6aaa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryDatabaseFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A factory for building MemoryDatabases * ************************************************************************/ @@ -24,6 +24,30 @@ namespace tbox { */ class MemoryDatabaseFactory:public DatabaseFactory { +public: + /** + * Default constructor. + */ + MemoryDatabaseFactory(); + + /** + * Copy constructor. + */ + MemoryDatabaseFactory( + const MemoryDatabaseFactory& other); + + /** + * Assignment operator. + */ + MemoryDatabaseFactory& + operator = ( + const MemoryDatabaseFactory& rhs); + + /** + * Destructor. + */ + ~MemoryDatabaseFactory(); + /** * Build a new Database object. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.C index e633b73a..c18b3337 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routines for tracking memory use in SAMRAI. * ************************************************************************/ @@ -22,7 +22,7 @@ #endif #ifdef HAVE_TAU #if (PROFILING_ON || TRACING_ON) -#include +#include "Profile/Profiler.h" /* Register an "event" with Tau to track memory usage. */ TAU_PROFILE_STMT(TauUserEvent ue("memory use")) #endif @@ -171,7 +171,7 @@ MemoryUtilities::printMaxMemory( int maxmem = 0; int len = 1; SAMRAI_MPI::Status status; - for (int p = 0; p < mpi.getSize(); p++) { + for (int p = 0; p < mpi.getSize(); ++p) { if (mpi.getSize() > 1) { if (mpi.getRank() == p) { maxmem = static_cast(s_max_memory); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.h index c01095e9..044bacda 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MemoryUtilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routine for tracking memory use in applications. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.C index 1e7a6a9c..59404bf7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fixed-size message buffer used in interprocessor communication * ************************************************************************/ - -#ifndef included_tbox_MessageStream_C -#define included_tbox_MessageStream_C - #include "SAMRAI/tbox/MessageStream.h" #include "SAMRAI/tbox/Utilities.h" @@ -28,52 +24,53 @@ namespace tbox { MessageStream::MessageStream( const size_t num_bytes, const StreamMode mode, - const void *data_to_read, + const void* data_to_read, bool deep_copy): d_mode(mode), - d_buffer(), - d_buffer_access(NULL), + d_write_buffer(), + d_read_buffer(0), d_buffer_size(0), d_buffer_index(0), - d_grow_as_needed(false) + d_grow_as_needed(false), + d_deep_copy_read(deep_copy) { TBOX_ASSERT(num_bytes >= 1); - d_buffer.reserve(num_bytes); - if ( mode == Read ) { - if ( num_bytes > 0 && data_to_read == NULL ) { + if (mode == Read) { + if (data_to_read == 0) { TBOX_ERROR("MessageStream::MessageStream: error:\n" - <<"No data_to_read was given to a Read-mode MessageStream.\n"); + << "No data_to_read was given to a Read-mode MessageStream.\n"); } - if ( deep_copy ) { - d_buffer.insert( d_buffer.end(), - static_cast(data_to_read), - static_cast(data_to_read)+num_bytes ); - d_buffer_access = &d_buffer[0]; - } - else { - d_buffer_access = static_cast(data_to_read); + if (deep_copy) { + d_read_buffer = new char[num_bytes]; + memcpy(const_cast(d_read_buffer), data_to_read, num_bytes); + } else { + d_read_buffer = static_cast(data_to_read); } d_buffer_size = num_bytes; + } else { + d_write_buffer.reserve(num_bytes); } - return; } -MessageStream::MessageStream() - : d_mode(Write), - d_buffer(), - d_buffer_access(NULL), - d_buffer_size(0), - d_buffer_index(0), - d_grow_as_needed(true) +MessageStream::MessageStream(): + d_mode(Write), + d_write_buffer(), + d_read_buffer(0), + d_buffer_size(0), + d_buffer_index(0), + d_grow_as_needed(true), + d_deep_copy_read(false) { - d_buffer.reserve(10); - return; + d_write_buffer.reserve(10); } MessageStream::~MessageStream() { - d_buffer_access = NULL; + if (d_mode == Read && d_deep_copy_read) { + delete[] d_read_buffer; + } + d_read_buffer = 0; } /* @@ -90,10 +87,8 @@ MessageStream::printClassData( { os << "Maximum buffer size = " << d_buffer_size << std::endl; os << "Current buffer index = " << d_buffer_index << std::endl; - os << "Pointer to buffer data = " << static_cast(d_buffer_access) << std::endl; + os << "Pointer to buffer data = " << static_cast(d_read_buffer) << std::endl; } } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.h index 99b318d7..0d71bc73 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/MessageStream.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fixed-size message buffer used in interprocessor communication * ************************************************************************/ @@ -34,7 +34,7 @@ namespace tbox { * mode. It should be rewritten as two classes, like std::cin and * std::cout are. BTNG. * - * @see tbox::Schedule + * @see Schedule */ class MessageStream @@ -49,23 +49,27 @@ class MessageStream /*! * @brief Create a message stream of the specified size and mode * - * @param[in] bytes Number of bytes in the stream. + * @param[in] num_bytes Number of bytes in the stream. * * @param[in] mode MessageStream::Read or MessageStream::Write. * - * @param[in] data_to_read Data for unpacking, should be num_bytes bytes long. - * This is used when mode == MessageStream::Read, ignored in write mode. + * @param[in] data_to_read Data for unpacking, should be num_bytes bytes + * long. This is used when mode == MessageStream::Read, ignored in write + * mode. * * @param[in] deep_copy Whether to make deep copy of data_to_read. * The default is to make a deep copy, which is safer but slower * than a shallow (pointer) copy. This is used when mode == * MessageStream::Read, ignored in write mode. In shallow copy mode, * you cannot call growBufferAsNeeded(). + * + * @pre num_bytes >= 0 + * @pre mode != Read || data_to_read != 0 */ MessageStream( - const size_t bytes, + const size_t num_bytes, const StreamMode mode, - const void *data_to_read = NULL, + const void* data_to_read = 0, bool deep_copy = true); /*! @@ -95,8 +99,7 @@ class MessageStream * @param[in] num_items */ template - static unsigned int getSizeof( - unsigned int num_items = 1) + static size_t getSizeof(size_t num_items = 1) { return num_items * static_cast(sizeof(DATA_TYPE)); } @@ -107,8 +110,11 @@ class MessageStream const void * getBufferStart() const { - TBOX_ASSERT( d_buffer_access != NULL ); - return static_cast(d_buffer_access); + if (d_mode == Read) { + return static_cast(d_read_buffer); + } else { + return &d_write_buffer[0]; + } } /*! @@ -125,22 +131,25 @@ class MessageStream * as needed for data. * * It is an error to use this method for a Read-mode stream. + * + * @pre writeMode() */ void growBufferAsNeeded() { - TBOX_ASSERT( d_mode == Write ); + TBOX_ASSERT(writeMode()); d_grow_as_needed = true; - return; } /*! * @brief Whether a Read-mode MessageStream has reached the end of * its data. + * + * @pre readMode() */ bool endOfData() const { - TBOX_ASSERT( d_mode == Read ); + TBOX_ASSERT(readMode()); return d_buffer_index >= d_buffer_size; } @@ -149,14 +158,16 @@ class MessageStream * * @param[in] data Single item of type DATA_TYPE to be copied * into the stream. + * + * @pre writeMode() */ template MessageStream& operator << ( const DATA_TYPE& data) { - TBOX_ASSERT(d_mode == MessageStream::Write); - static const unsigned int nbytes = + TBOX_ASSERT(writeMode()); + static const size_t nbytes = MessageStream::getSizeof(1); copyDataIn(static_cast(&data), nbytes); return *this; @@ -168,33 +179,54 @@ class MessageStream * @param[in] data Pointer to an array of data of type DATA_TYPE * to be copied into the stream. * @param[in] size Number of items to pack. + * + * @pre writeMode() */ template void pack( const DATA_TYPE* data, - unsigned int size = 1) + size_t size = 1) { - TBOX_ASSERT(d_mode == MessageStream::Write); + TBOX_ASSERT(writeMode()); if (data && (size > 0)) { - const unsigned int nbytes = MessageStream::getSizeof(size); + const size_t nbytes = MessageStream::getSizeof(size); copyDataIn(static_cast(data), nbytes); } } + /*! + * @brief Pack content of another data stream into this one. + * + * @param[in] other The other data stream. + * + * @pre writeMode() + */ + void + pack( + const MessageStream& other) + { + TBOX_ASSERT(writeMode()); + if (other.getCurrentSize() > 0) { + copyDataIn(other.getBufferStart(), other.getCurrentSize()); + } + } + /*! * @brief Unpack a single data item from message stream. * * @param[out] data Single item of type DATA_TYPE that will be * copied from the stream. + * + * @pre readMode() */ template MessageStream& operator >> ( DATA_TYPE& data) { - TBOX_ASSERT(d_mode == MessageStream::Read); - static const unsigned int nbytes = + TBOX_ASSERT(readMode()); + static const size_t nbytes = MessageStream::getSizeof(1); copyDataOut(static_cast(&data), nbytes); return *this; @@ -207,16 +239,18 @@ class MessageStream * that will receive data copied from * the stream. * @param[out] size Number of items that will be copied. + * + * @pre readMode() */ template void unpack( - DATA_TYPE * data, - unsigned int size = 1) + DATA_TYPE* data, + size_t size = 1) { - TBOX_ASSERT(d_mode == MessageStream::Read); - if (data && (size > 0)) { - const unsigned int nbytes = MessageStream::getSizeof(size); + TBOX_ASSERT(readMode()); + if (data) { + const size_t nbytes = MessageStream::getSizeof(size); copyDataOut(static_cast(data), nbytes); } } @@ -230,51 +264,98 @@ class MessageStream printClassData( std::ostream& os) const; -private: + /*! + * @brief Returns true if stream is in read mode. + */ + bool + readMode() const + { + return d_mode == Read; + } + + /*! + * @brief Returns true if stream is in write mode. + */ + bool + writeMode() const + { + return d_mode == Write; + } + + /*! + * @brief Returns true if the buffer is grown as needed in Write mode. + */ + bool + growAsNeeded() const + { + return d_grow_as_needed; + } + /*! + * @brief Returns true if num_bytes can be copied into the stream. + */ + bool + canCopyIn( + size_t num_bytes) const + { + return d_buffer_index + num_bytes <= d_write_buffer.capacity(); + } + + /*! + * @brief Returns true if num_bytes can be copied out of the stream. + */ + bool + canCopyOut( + size_t num_bytes) const + { + return d_buffer_index + num_bytes <= d_buffer_size; + } + +private: /*! * @brief Copy data into the stream, advancing the stream pointer. * - * @param[in] data + * @param[in] input_data * @param[in] num_bytes + * + * @pre growAsNeeded() || canCopyIn(num_bytes) */ void copyDataIn( - const void *input_data, + const void* input_data, const size_t num_bytes) - { - if ( !d_grow_as_needed ) { - TBOX_ASSERT(d_buffer_index + num_bytes <= d_buffer.capacity()); - } - if ( num_bytes > 0 ) { - d_buffer.insert( d_buffer.end(), - static_cast(input_data), - static_cast(input_data) + num_bytes ); - d_buffer_size = d_buffer.size(); - d_buffer_index += num_bytes; - d_buffer_access = &d_buffer[0]; - } - return; + { + if (!growAsNeeded()) { + TBOX_ASSERT(canCopyIn(num_bytes)); + } + if (num_bytes > 0) { + d_write_buffer.insert(d_write_buffer.end(), + static_cast(input_data), + static_cast(input_data) + num_bytes); + d_buffer_size = d_write_buffer.size(); + d_buffer_index += num_bytes; } + } /*! * @brief Copy data out of the stream, advancing the stream pointer. * * @param[in] output_data * @param[in] num_bytes + * + * @pre canCopyOut(num_bytes) */ void copyDataOut( - void *output_data, + void* output_data, const size_t num_bytes) - { - TBOX_ASSERT( d_buffer_index + num_bytes <= d_buffer_size ); - memcpy(output_data, &d_buffer_access[d_buffer_index], num_bytes); - d_buffer_index += num_bytes; - return; - } + { + TBOX_ASSERT(canCopyOut(num_bytes)); + memcpy(output_data, &d_read_buffer[d_buffer_index], num_bytes); + d_buffer_index += num_bytes; + } MessageStream( const MessageStream&); // not implemented - void + MessageStream& operator = ( const MessageStream&); // not implemented @@ -284,21 +365,22 @@ class MessageStream const StreamMode d_mode; /*! - * The buffer for the streamed data. + * The buffer for the streamed data to be written. */ - std::vector d_buffer; + std::vector d_write_buffer; /*! - * @brief Pointer to either d_buffer space or, in shallow-copy Read - * mode, external memory. + * @brief Pointer to the externally supplied memory to read from in + * shallow-copy Read mode, or the internal copy of the externally supplied + * memory to read from in deep-copy Read mode. */ - const char *d_buffer_access; + const char* d_read_buffer; /*! * @brief Number of bytes in the buffer. * - * Equal to d_buffer.size() if using internal buffer. Otherwixe, - * equal to external buffer size. + * Equal to d_write_buffer.size() in write mode, size of supplied external + * buffer size in read mode. */ size_t d_buffer_size; @@ -312,6 +394,12 @@ class MessageStream */ bool d_grow_as_needed; + /*! + * @brief True if d_read_buffer is a deep copy (locally allocated copy) of + * externally supplied memory. + */ + bool d_deep_copy_read; + }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.C index b7948ae5..3aee546d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An input database structure that stores (key,value) pairs * ************************************************************************/ @@ -96,15 +96,15 @@ NullDatabase::keyExists( /* ************************************************************************* * - * Return an empty Array. + * Return an empty std::vector. * ************************************************************************* */ -Array +std::vector NullDatabase::getAllKeys() { - Array keys(0); + std::vector keys(0); return keys; } @@ -132,7 +132,7 @@ NullDatabase::getArrayType( ************************************************************************* */ -int +size_t NullDatabase::getArraySize( const std::string& key) { @@ -192,19 +192,19 @@ void NullDatabase::putBoolArray( const std::string& key, const bool * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getBoolArray( +std::vector +NullDatabase::getBoolVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -228,20 +228,20 @@ void NullDatabase::putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getDatabaseBoxArray( +std::vector +NullDatabase::getDatabaseBoxVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -265,20 +265,20 @@ void NullDatabase::putCharArray( const std::string& key, const char * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getCharArray( +std::vector +NullDatabase::getCharVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -304,20 +304,20 @@ void NullDatabase::putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getComplexArray( +std::vector +NullDatabase::getComplexVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -342,19 +342,19 @@ void NullDatabase::putDoubleArray( const std::string& key, const double * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getDoubleArray( +std::vector +NullDatabase::getDoubleVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -380,20 +380,20 @@ void NullDatabase::putFloatArray( const std::string& key, const float * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getFloatArray( +std::vector +NullDatabase::getFloatVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -417,20 +417,20 @@ void NullDatabase::putIntegerArray( const std::string& key, const int * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getIntegerArray( +std::vector +NullDatabase::getIntegerVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } @@ -454,19 +454,19 @@ void NullDatabase::putStringArray( const std::string& key, const std::string * const data, - const int nelements) + const size_t nelements) { NULL_USE(key); NULL_USE(data); NULL_USE(nelements); } -Array -NullDatabase::getStringArray( +std::vector +NullDatabase::getStringVector( const std::string& key) { NULL_USE(key); - Array empty(0); + std::vector empty(0); return empty; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.h index eb5efa16..7017cf06 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/NullDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A null database that does nothing for all database methods. * ************************************************************************/ @@ -15,8 +15,8 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Utilities.h" -#include -#include +#include "boost/make_shared.hpp" +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace tbox { @@ -91,9 +91,9 @@ class NullDatabase:public Database const std::string& key); /** - * Return an empty Array. + * Return an empty std::vector. */ - virtual Array + virtual std::vector getAllKeys(); /** @@ -106,7 +106,7 @@ class NullDatabase:public Database /** * Always returns 0. */ - virtual int + virtual size_t getArraySize( const std::string& key); @@ -145,13 +145,13 @@ class NullDatabase:public Database putBoolArray( const std::string& key, const bool * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getBoolArray( + virtual std::vector + getBoolVector( const std::string& key); /** @@ -168,13 +168,13 @@ class NullDatabase:public Database putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getDatabaseBoxArray( + virtual std::vector + getDatabaseBoxVector( const std::string& key); /** @@ -191,13 +191,13 @@ class NullDatabase:public Database putCharArray( const std::string& key, const char * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getCharArray( + virtual std::vector + getCharVector( const std::string& key); /** @@ -214,13 +214,13 @@ class NullDatabase:public Database putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getComplexArray( + virtual std::vector + getComplexVector( const std::string& key); /** @@ -237,13 +237,13 @@ class NullDatabase:public Database putDoubleArray( const std::string& key, const double * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getDoubleArray( + virtual std::vector + getDoubleVector( const std::string& key); /** @@ -260,13 +260,13 @@ class NullDatabase:public Database putFloatArray( const std::string& key, const float * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getFloatArray( + virtual std::vector + getFloatVector( const std::string& key); /** @@ -283,13 +283,13 @@ class NullDatabase:public Database putIntegerArray( const std::string& key, const int * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getIntegerArray( + virtual std::vector + getIntegerVector( const std::string& key); /** @@ -306,13 +306,13 @@ class NullDatabase:public Database putStringArray( const std::string& key, const std::string * const data, - const int nelements); + const size_t nelements); /** - * Returns an empty Array. + * Returns an empty std::vector. */ - virtual Array - getStringArray( + virtual std::vector + getStringVector( const std::string& key); /** @@ -332,6 +332,7 @@ class NullDatabase:public Database using Database::getBoolArray; using Database::putDatabaseBoxArray; using Database::getDatabaseBoxArray; + using Database::getDatabaseBoxVector; using Database::putCharArray; using Database::getCharArray; using Database::putComplexArray; @@ -348,9 +349,9 @@ class NullDatabase:public Database private: NullDatabase( const NullDatabase&); // not implemented - void + NullDatabase& operator = ( - const NullDatabase&); // not implemented + const NullDatabase&); // not implemented }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/OpenMPUtilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/OpenMPUtilities.h new file mode 100644 index 00000000..da520fd1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/OpenMPUtilities.h @@ -0,0 +1,103 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility functions for using OpenMP. + * + ************************************************************************/ + +/* + * @brief Macros defined for using OpenMP, with sensible definitions + * when not using it. + * + * OpenMP symbols beginning with omp_ is prepended with TBOX_ to + * indicate it is a SAMRAI toolbox macro. Macros for OpenMP functions + * must have argument list, even if it is empty. + */ + +#ifndef included_tbox_OpenMPUtilities +#define included_tbox_OpenMPUtilities + +#ifdef _OPENMP + +#include "SAMRAI/SAMRAI_config.h" + +#include + +#define TBOX_omp_version _OPENMP + +#define TBOX_omp_lock_t omp_lock_t + +#define TBOX_omp_init_lock(LOCK_PTR) omp_init_lock(LOCK_PTR) +#define TBOX_omp_destroy_lock(LOCK_PTR) omp_destroy_lock(LOCK_PTR) + +#define TBOX_omp_set_lock(LOCK_PTR) omp_set_lock(LOCK_PTR) +#define TBOX_omp_unset_lock(LOCK_PTR) omp_unset_lock(LOCK_PTR) + +#define TBOX_omp_get_num_threads() omp_get_num_threads() +#define TBOX_omp_get_max_threads() omp_get_max_threads() + +#define TBOX_IF_SINGLE_THREAD(CODE) \ + { \ + if (omp_get_num_threads() == 1) { \ + CODE \ + } \ + } + +#define TBOX_IF_MULTI_THREAD(CODE) \ + { \ + if (omp_get_num_threads() > 1) { \ + CODE \ + } \ + } + +#define TBOX_IF_IN_PARALLEL_REGION(CODE) \ + { \ + if (omp_in_parallel()) { \ + CODE \ + } \ + } + +#define TBOX_IF_NOT_IN_PARALLEL_REGION(CODE) \ + { \ + if (!omp_in_parallel()) { \ + CODE \ + } \ + } + +#define TBOX_IF_HAVE_OPENMP(CODE) { CODE } + +#define TBOX_IF_NOT_HAVE_OPENMP(CODE) + +#else + +#define TBOX_omp_version 0 + +#define TBOX_omp_lock_t int + +#define TBOX_omp_init_lock(LOCK_PTR) +#define TBOX_omp_destroy_lock(LOCK_PTR) + +#define TBOX_omp_set_lock(LOCK_PTR) +#define TBOX_omp_unset_lock(LOCK_PTR) + +#define TBOX_omp_get_num_threads() (1) +#define TBOX_omp_get_max_threads() (1) + +#define TBOX_IF_SINGLE_THREAD(CODE) { CODE } + +#define TBOX_IF_MULTI_THREAD(CODE) + +#define TBOX_IF_IN_PARALLEL_REGION(CODE) + +#define TBOX_IF_NOT_IN_PARALLEL_REGION(CODE) { CODE } + +#define TBOX_IF_HAVE_OPENMP(CODE) + +#define TBOX_IF_NOT_HAVE_OPENMP(CODE) { CODE } + +#endif + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.C index f064941d..2929fc95 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parallel I/O classes pout, perr, and plog and control class * ************************************************************************/ @@ -19,7 +19,7 @@ namespace SAMRAI { namespace tbox { int PIO::s_rank = -1; -std::ofstream * PIO::s_filestream = NULL; +std::ofstream * PIO::s_filestream = 0; /* ************************************************************************* @@ -52,7 +52,7 @@ PIO::initialize() { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); mpi.Comm_rank(&s_rank); - s_filestream = NULL; + s_filestream = 0; /* * Initialize the standard parallel output stream @@ -61,7 +61,7 @@ PIO::initialize() pout_buffer.setActive(s_rank == 0); pout_buffer.setPrefixString(std::string()); pout_buffer.setOutputStream1(&std::cout); - pout_buffer.setOutputStream2(NULL); + pout_buffer.setOutputStream2(0); /* * Initialize the error parallel output stream @@ -72,7 +72,7 @@ PIO::initialize() perr_buffer.setActive(true); perr_buffer.setPrefixString(buffer); perr_buffer.setOutputStream1(&std::cerr); - perr_buffer.setOutputStream2(NULL); + perr_buffer.setOutputStream2(0); /* * Initialize the parallel log file (disabled by default) @@ -80,8 +80,8 @@ PIO::initialize() plog_buffer.setActive(false); plog_buffer.setPrefixString(std::string()); - plog_buffer.setOutputStream1(NULL); - plog_buffer.setOutputStream2(NULL); + plog_buffer.setOutputStream1(0); + plog_buffer.setOutputStream2(0); } /* @@ -118,11 +118,11 @@ PIO::shutdownFilestream() s_filestream->close(); delete s_filestream; - s_filestream = NULL; + s_filestream = 0; - pout_buffer.setOutputStream2(NULL); - perr_buffer.setOutputStream2(NULL); - plog_buffer.setOutputStream1(NULL); + pout_buffer.setOutputStream2(0); + perr_buffer.setOutputStream2(0); + plog_buffer.setOutputStream1(0); plog_buffer.setActive(false); } } @@ -155,7 +155,7 @@ PIO::logOnlyNodeZero( s_filestream = new std::ofstream(filename.c_str()); if (!(*s_filestream)) { delete s_filestream; - s_filestream = NULL; + s_filestream = 0; perr << "PIO: Could not open log file ``" << filename.c_str() << "''\n"; } else { @@ -197,7 +197,7 @@ PIO::logAllNodes( if (!(*s_filestream)) { delete s_filestream; - s_filestream = NULL; + s_filestream = 0; perr << "PIO: Could not open log file ``" << full_filename << "''\n"; } else { pout_buffer.setOutputStream2(s_filestream); @@ -218,9 +218,9 @@ PIO::logAllNodes( void PIO::suspendLogging() { - pout_buffer.setOutputStream2(NULL); - perr_buffer.setOutputStream2(NULL); - plog_buffer.setOutputStream1(NULL); + pout_buffer.setOutputStream2(0); + perr_buffer.setOutputStream2(0); + plog_buffer.setOutputStream1(0); plog_buffer.setActive(false); } @@ -228,7 +228,7 @@ PIO::suspendLogging() ************************************************************************* * * Resume logging of the file stream (assuming it was open). If the - * file stream is NULL, then do nothing. + * file stream is 0, then do nothing. * ************************************************************************* */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.h index e47fce8a..ddf1097c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/PIO.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parallel I/O classes pout, perr, and plog and control class * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.C index 26138a6b..d9037d3e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parallel I/O class buffer to manage parallel ostreams output * ************************************************************************/ @@ -42,11 +42,12 @@ ParallelBuffer::ParallelBuffer() { d_active = true; d_prefix = std::string(); - d_ostream1 = NULL; - d_ostream2 = NULL; - d_buffer = NULL; + d_ostream1 = 0; + d_ostream2 = 0; + d_buffer = 0; d_buffer_size = 0; d_buffer_ptr = 0; + TBOX_omp_init_lock(&l_buffer); } /* @@ -63,6 +64,7 @@ ParallelBuffer::~ParallelBuffer() if (d_buffer) { delete[] d_buffer; } + TBOX_omp_destroy_lock(&l_buffer); } /* @@ -78,13 +80,15 @@ void ParallelBuffer::setActive( bool active) { + TBOX_omp_set_lock(&l_buffer); if (!active && d_buffer) { delete[] d_buffer; - d_buffer = NULL; + d_buffer = 0; d_buffer_size = 0; d_buffer_ptr = 0; } d_active = active; + TBOX_omp_unset_lock(&l_buffer); } /* @@ -104,6 +108,7 @@ ParallelBuffer::outputString( { if ((length > 0) && d_active) { + TBOX_omp_set_lock(&l_buffer); /* * If we need to allocate the internal buffer, then do so */ @@ -127,7 +132,7 @@ ParallelBuffer::outputString( */ int eol_ptr = 0; - for ( ; (eol_ptr < length) && (text[eol_ptr] != '\n'); eol_ptr++) + for ( ; (eol_ptr < length) && (text[eol_ptr] != '\n'); ++eol_ptr) NULL_STATEMENT; /* @@ -149,6 +154,8 @@ ParallelBuffer::outputString( outputString(text.substr(ncopy), length - ncopy); } } + + TBOX_omp_unset_lock(&l_buffer); } } @@ -159,6 +166,10 @@ ParallelBuffer::outputString( * If the internal buffer is not large enough to hold all of the string * data, then allocate a new internal buffer. * + * This method is not thread-safe, but it is only called from + * outputString(), which prevents multiple thread access to the + * buffer. + * ************************************************************************* */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.h index e3e931aa..6b430def 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ParallelBuffer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parallel I/O class buffer to manage parallel ostreams output * ************************************************************************/ @@ -13,6 +13,8 @@ #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" + #include #include @@ -147,6 +149,15 @@ class ParallelBuffer:public std::streambuf #endif private: + // Unimplemented copy constructor. + ParallelBuffer( + const ParallelBuffer& other); + + // Unimplemented assignment operator. + ParallelBuffer& + operator = ( + const ParallelBuffer& rhs); + void copyToBuffer( const std::string& text, @@ -161,6 +172,7 @@ class ParallelBuffer:public std::streambuf char* d_buffer; // internal buffer to store accumulated string int d_buffer_size; // size of the internal output buffer int d_buffer_ptr; // number of charcters in the output buffer + TBOX_omp_lock_t l_buffer; // OpenMP lock for buffer operations. static const int DEFAULT_BUFFER_SIZE; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.C index c25df149..fee83358 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parser that reads the input database grammar * ************************************************************************/ @@ -38,7 +38,7 @@ parser_static_table_initialize(); namespace SAMRAI { namespace tbox { -Parser * Parser::s_default_parser = NULL; +Parser * Parser::s_default_parser = 0; bool Parser::s_static_tables_initialized = 0; /* @@ -109,11 +109,11 @@ Parser::parse( d_scope_stack.push_front(database); s_default_parser = this; - yyrestart(NULL); + yyrestart(0); if (yyparse() && (d_errors == 0)) { error("Unexpected parse error"); } - s_default_parser = NULL; + s_default_parser = 0; d_parse_stack.clear(); d_scope_stack.clear(); @@ -154,11 +154,11 @@ Parser::advanceCursor( { Parser::ParseData& pd = d_parse_stack.front(); pd.d_cursor = pd.d_nextcursor; - for (std::string::const_iterator i = token.begin(); i != token.end(); i++) { + for (std::string::const_iterator i = token.begin(); i != token.end(); ++i) { if (*i == '\t') { pd.d_nextcursor = ((pd.d_nextcursor + 7) & (~7)) + 1; } else { - pd.d_nextcursor++; + ++(pd.d_nextcursor); } } } @@ -183,11 +183,11 @@ Parser::error( pout << pd.d_linebuffer << std::endl << std::flush; - for (int i = 0; i < pd.d_cursor; i++) + for (int i = 0; i < pd.d_cursor; ++i) pout << " "; pout << "^\n"; - d_errors++; + ++d_errors; } /* @@ -210,11 +210,11 @@ Parser::warning( pout << pd.d_linebuffer << std::endl << std::flush; - for (int i = 0; i < pd.d_cursor; i++) + for (int i = 0; i < pd.d_cursor; ++i) pout << " "; pout << "^\n"; - d_warnings++; + ++d_warnings; } /* @@ -231,7 +231,7 @@ Parser::getDatabaseWithKey( const std::string& key) { std::list >::iterator i = d_scope_stack.begin(); - for ( ; i != d_scope_stack.end(); i++) { + for ( ; i != d_scope_stack.end(); ++i) { if ((*i)->keyExists(key)) { return *i; } @@ -252,7 +252,7 @@ bool Parser::pushIncludeFile( const std::string& filename) { - FILE* fstream = NULL; + FILE* fstream = 0; const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); std::string filename_with_path; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.h index 4efac332..b4eb5bdb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Parser.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Parser that reads the input database grammar * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -76,7 +76,7 @@ class Parser int parse( const std::string& filename, - FILE * fstream, + FILE* fstream, const boost::shared_ptr& database); /** @@ -225,7 +225,7 @@ class Parser private: Parser( const Parser&); // not implemented - void + Parser& operator = ( const Parser&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.C index 415ac5ed..618b4b30 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A class to manage groups of processor ranks * ************************************************************************/ @@ -85,7 +85,7 @@ RankGroup::RankGroup( */ RankGroup::RankGroup( - const Array& rank_group, + const std::vector& rank_group, const SAMRAI_MPI& samrai_mpi): d_min(-1), d_max(-1), @@ -99,13 +99,13 @@ RankGroup::RankGroup( samrai_mpi.Comm_size(&nodes); #ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(rank_group.size() <= nodes); + TBOX_ASSERT(static_cast(rank_group.size()) <= nodes); /* * Check that each entry in the array has a unique value and is increasing * order */ - for (int i = 0; i < rank_group.size(); i++) { + for (int i = 0; i < static_cast(rank_group.size()); ++i) { TBOX_ASSERT(rank_group[i] >= 0); TBOX_ASSERT(rank_group[i] < nodes); if (i > 0) { @@ -117,12 +117,27 @@ RankGroup::RankGroup( /* * If array is the full set of ranks, then switch to "using_all" mode. */ - if (rank_group.size() == nodes) { - d_ranks.resizeArray(0); + if (static_cast(rank_group.size()) == nodes) { + d_ranks.resize(0); d_storage = USING_ALL; } } +/* + *********************************************************************** + * Copy constructor. + *********************************************************************** + */ +RankGroup::RankGroup( + const RankGroup& other): + d_min(other.d_min), + d_max(other.d_max), + d_ranks(other.d_ranks), + d_storage(other.d_storage), + d_samrai_mpi(other.d_samrai_mpi) +{ +} + /* *********************************************************************** * Destructor @@ -133,6 +148,23 @@ RankGroup::~RankGroup() { } +/* + *********************************************************************** + * Assignment operator. + *********************************************************************** + */ +RankGroup& +RankGroup::operator = ( + const RankGroup& rhs) +{ + d_min = rhs.d_min; + d_max = rhs.d_max; + d_ranks = rhs.d_ranks; + d_storage = rhs.d_storage; + d_samrai_mpi = rhs.d_samrai_mpi; + return *this; +} + /* *********************************************************************** * Determine if given rank is in the group. @@ -154,7 +186,7 @@ RankGroup::isMember( case USING_ARRAY: { int lo = 0; - int hi = d_ranks.size() - 1; + int hi = static_cast(d_ranks.size()) - 1; while (!is_member && hi >= lo) { int i = (lo + hi) / 2; if (rank < d_ranks[i]) { @@ -199,7 +231,7 @@ RankGroup::size() const break; case USING_ARRAY: - size = d_ranks.size(); + size = static_cast(d_ranks.size()); break; case USING_MIN_MAX: @@ -208,6 +240,7 @@ RankGroup::size() const default: TBOX_ERROR("RankGroup has not been set with a valid storage method"); + break; } return size; @@ -243,6 +276,7 @@ RankGroup::getMappedRank( default: TBOX_ERROR("RankGroup has not been set with a valid storage method"); + break; } return mapped_rank; @@ -277,7 +311,7 @@ RankGroup::getMapIndex( case USING_ARRAY: { int lo = 0; - int hi = d_ranks.size() - 1; + int hi = static_cast(d_ranks.size()) - 1; while (hi >= lo) { int i = (lo + hi) / 2; if (rank < d_ranks[i]) { @@ -298,6 +332,7 @@ RankGroup::getMapIndex( default: TBOX_ERROR("RankGroup has not been set with a valid storage method"); + break; } return map_id; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.h index 0b69c249..1cf17966 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankGroup.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A class to manage a group of processor ranks * ************************************************************************/ @@ -13,11 +13,12 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/SAMRAIManager.h" +#include + namespace SAMRAI { namespace tbox { @@ -60,6 +61,9 @@ class RankGroup * This constructor creates a RankGroup consisting of all ranks from min * to max, inclusive. min must be >= 0 and max must be less than the * total number of available processors. + * + * @pre min >= 0 + * @pre min <= max */ RankGroup( const int min, @@ -69,24 +73,37 @@ class RankGroup /*! * This constructor creates a RankGroup consisting of ranks corresponding - * to the integers in the array. Each member of the array must be >= 0, + * to the integers in the vector. Each member of the vector must be >= 0, * less than the total number of available processors, and unique within - * the array. Due to the use of an array for storage, RankGroups + * the vector. Due to the use of an vector for storage, RankGroups * created with this constructor should be expected to be less efficient * than those created with the above min/max constructor. * - * An assertion failure will result if the array is empty. + * @pre !rank_group.empty() */ explicit RankGroup( - const Array& rank_group, + const std::vector& rank_group, const SAMRAI_MPI& samrai_mpi = SAMRAI_MPI(SAMRAI_MPI::getSAMRAIWorld())); + /*! + * Copy constructor. + */ + RankGroup( + const RankGroup& other); + /*! * Destructor */ ~RankGroup(); + /*! + * Assignment operator. + */ + RankGroup& + operator = ( + const RankGroup& rhs); + /*! * Returns true if the RankGroup contains ranks for all available * processors. @@ -108,14 +125,10 @@ class RankGroup const int min, const int max) { -#ifdef DEBUG_CHECK_ASSERTIONS - int nodes = 1; - d_samrai_mpi.Comm_size(&nodes); -#endif TBOX_ASSERT(min >= 0); TBOX_ASSERT(min <= max); d_storage = USING_MIN_MAX; - d_ranks.resizeArray(0); + d_ranks.resize(0); d_min = min; d_max = max; } @@ -147,6 +160,8 @@ class RankGroup * contained in the RankGroup, return a unique integer identifier in the * set [0,N-1], N being the size of the rank group, according to a 1-to-1 * mapping. + * + * @pre rank >= 0 */ int getMapIndex( @@ -155,13 +170,12 @@ class RankGroup private: enum StorageType { USING_ALL, USING_ARRAY, - USING_MIN_MAX, - INVALID_STORAGE }; + USING_MIN_MAX }; int d_min; int d_max; - Array d_ranks; + std::vector d_ranks; StorageType d_storage; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.C new file mode 100644 index 00000000..c9da7ac4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.C @@ -0,0 +1,47 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for building efficient communication tree. + * + ************************************************************************/ +#include "SAMRAI/tbox/RankTreeStrategy.h" + +#include "SAMRAI/tbox/MathUtilities.h" + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Suppress XLC warnings + */ +#pragma report(disable, CPPC5334) +#pragma report(disable, CPPC5328) +#endif + +namespace SAMRAI { +namespace tbox { + +const int RankTreeStrategy::s_invalid_rank(-1); +const unsigned int +RankTreeStrategy::s_invalid_child_number( + MathUtilities::getMax() / 2); + +RankTreeStrategy::RankTreeStrategy() +{ +} + +RankTreeStrategy::~RankTreeStrategy() +{ +} + +} +} + +#if !defined(__BGL_FAMILY__) && defined(__xlC__) +/* + * Unsuppress XLC warnings + */ +#pragma report(enable, CPPC5334) +#pragma report(enable, CPPC5328) +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.h new file mode 100644 index 00000000..89b17757 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RankTreeStrategy.h @@ -0,0 +1,174 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Interface for using efficient communication tree. + * + ************************************************************************/ +#ifndef included_tbox_RankTreeStrategy +#define included_tbox_RankTreeStrategy + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/RankGroup.h" +#include "SAMRAI/tbox/Utilities.h" + +namespace SAMRAI { +namespace tbox { + +/*! + * @brief Strategy pattern for getting information on MPI ranks + * aranged on a user-defined tree. + * + * The purpose of a rank tree is to facilitate "collective-like" + * communications where information is communicated up or down the + * tree along its edges. It gives the parent rank, children ranks, + * etc., for a node in the tree. + * + * To improve communication performance, the tree should map well to + * the communication hardware. That is, processes on each ends of an + * edge should be close to each other on the communication network. + * Implementations of this strategy should consider the network + * topology when deciding how to lay out the process on the tree. + */ +class RankTreeStrategy +{ + +public: + /*! + * @brief Constructor. + */ + RankTreeStrategy(); + + /*! + * @brief Destructor. + */ + virtual ~RankTreeStrategy(); + + /*! + * @brief Set up the tree. + * + * Set up the tree for the processors in the given RankGroup. + * Prepare to provide tree data for the given rank. + * + * @param[in] rank_group + * + * @param[in] my_rank The rank whose parent and children are + * sought, usually the local process. + */ + virtual void + setupTree( + const RankGroup& rank_group, + int my_rank) = 0; + + /*! + * @brief Access the rank used in initialization. + */ + virtual int + getRank() const = 0; + + /*! + * @brief Access the parent rank. + * + * @returns parent rank or getInvalidRank() if is root of the tree. + */ + virtual int + getParentRank() const = 0; + + /*! + * @brief Access a child rank. + * + * @param child_number If outside [0, getNumberOfChildren()), + * the invalid rankd should be returned. + * + * @return Child's rank, or getInvalidRank() if child_number + * is outside [0, getNumberOfChildren()). + */ + virtual int + getChildRank( + unsigned int child_number) const = 0; + + /*! + * @brief Return the number of children. + */ + virtual unsigned int + getNumberOfChildren() const = 0; + + /*! + * @brief Return the child number. + * + * Return child number or invalidChildNumber() if is root of the + * tree. + */ + virtual unsigned int + getChildNumber() const = 0; + + /*! + * @brief Return the degree of the tree (the maximum number of + * children each node may have). + */ + virtual unsigned int + getDegree() const = 0; + + /*! + * @brief Return the generation number. + * + * The generation number starts at zero, at the root, and increases + * by one each generation. + */ + virtual unsigned int + getGenerationNumber() const = 0; + + /*! + * @brief Return the rank of the root of the tree. + */ + virtual int + getRootRank() const = 0; + + /*! + * @brief Return whether the local process is the root of its tree. + */ + bool isRoot() const { + return getRank() == getRootRank(); + } + + /*! + * @brief What this class considers an invalid rank. + * + * When a parent or child does not exist, this value is returned for + * the rank. + */ + static int getInvalidRank() { + return s_invalid_rank; + } + + /*! + * @brief What this class considers an invalid child number. + * + * The root of the tree is not anyone's child, so it should return + * this for getChildNumber();. + */ + static unsigned int getInvalidChildNumber() { + return s_invalid_child_number; + } + +private: + // Unimplemented copy constructor. + RankTreeStrategy( + const RankTreeStrategy& other); + + // Unimplemented assignment opperator. + RankTreeStrategy& + operator = ( + const RankTreeStrategy& rhs); + + static const int s_invalid_rank; + static const unsigned int s_invalid_child_number; + +}; + +} +} + +#endif // included_tbox_RankTreeStrategy diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.C index 3d8df59f..f6e2bfa8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Reference counting class for Array * ************************************************************************/ @@ -17,7 +17,7 @@ namespace SAMRAI { namespace tbox { -ReferenceCounter * ReferenceCounter::s_free_list = NULL; +ReferenceCounter * ReferenceCounter::s_free_list = 0; bool ReferenceCounter::s_is_finalized = false; StartupShutdownManager::Handler @@ -31,7 +31,7 @@ ReferenceCounter::s_handler( ReferenceCounter::ReferenceCounter() { d_references = 1; - d_next = (ReferenceCounter *)NULL; + d_next = 0; } ReferenceCounter::~ReferenceCounter() @@ -41,7 +41,7 @@ ReferenceCounter::~ReferenceCounter() } } -void* +void * ReferenceCounter::operator new ( size_t bytes) { @@ -55,7 +55,8 @@ ReferenceCounter::operator new ( s_free_list = s_free_list->d_next; return node; } else { - return ::operator new (bytes); + return ::operator new ( + bytes); } } @@ -78,8 +79,10 @@ ReferenceCounter::finalizeCallback() { while (s_free_list) { void * byebye = s_free_list; - s_free_list = s_free_list->d_next; - ::operator delete (byebye); + s_free_list = s_free_list->d_next + ; + ::operator delete ( + byebye); } s_is_finalized = true; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.h index b4d868b2..aaee932b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/ReferenceCounter.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Reference counting class for Array * ************************************************************************/ @@ -30,7 +30,7 @@ namespace tbox { * object will cause my simple memory allocation mechanism to break in * horrible and disgusting ways. * - * @see tbox::Array + * @see Array */ class ReferenceCounter @@ -97,7 +97,7 @@ class ReferenceCounter private: ReferenceCounter( const ReferenceCounter&); // not implemented - void + ReferenceCounter& operator = ( const ReferenceCounter&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.C index 4d26dde6..88354007 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.C @@ -3,12 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An restart manager singleton class * ************************************************************************/ -#include +#include "boost/make_shared.hpp" #include #include "SAMRAI/tbox/RestartManager.h" @@ -24,8 +24,7 @@ namespace SAMRAI { namespace tbox { -RestartManager * RestartManager::s_manager_instance = - (RestartManager *)NULL; +RestartManager * RestartManager::s_manager_instance = 0; StartupShutdownManager::Handler RestartManager::s_shutdown_handler( @@ -44,7 +43,7 @@ RestartManager::s_shutdown_handler( ************************************************************************* */ -RestartManager* +RestartManager * RestartManager::getManager() { if (!s_manager_instance) { @@ -59,7 +58,7 @@ RestartManager::shutdownCallback() if (s_manager_instance) { s_manager_instance->clearRestartItems(); delete s_manager_instance; - s_manager_instance = ((RestartManager *)NULL); + s_manager_instance = 0; } } @@ -72,7 +71,7 @@ RestartManager::shutdownCallback() ************************************************************************* */ -RestartManager::RestartManager() : +RestartManager::RestartManager(): d_database_root(boost::make_shared()), #ifdef HAVE_HDF5 d_database_factory(boost::make_shared()), @@ -127,10 +126,10 @@ RestartManager::openRestartFile( bool open_successful = true; /* try to mount restart file */ - if (d_database_factory) { + if (hasDatabaseFactory()) { boost::shared_ptr database(d_database_factory->allocate( - restart_filename)); + restart_filename)); if (!database->open(restart_filename)) { TBOX_ERROR( @@ -191,7 +190,7 @@ RestartManager::registerRestartItem( Serializable* obj) { TBOX_ASSERT(!name.empty()); - TBOX_ASSERT(obj != ((Serializable *)NULL)); + TBOX_ASSERT(obj != 0); /* * Run through list to see if there is another object registered @@ -201,7 +200,7 @@ RestartManager::registerRestartItem( d_restart_items_list.begin(); bool found_item = false; - for ( ; !found_item && iter != d_restart_items_list.end(); iter++) { + for ( ; !found_item && iter != d_restart_items_list.end(); ++iter) { found_item = (iter->name == name); } @@ -240,7 +239,7 @@ RestartManager::unregisterRestartItem( std::list::iterator iter = d_restart_items_list.begin(); - for ( ; iter != d_restart_items_list.end(); iter++) { + for ( ; iter != d_restart_items_list.end(); ++iter) { if (iter->name == name) { d_restart_items_list.erase(iter); break; @@ -275,10 +274,10 @@ RestartManager::writeRestartFile( std::string restart_filename = restart_dirname + restart_filename_buf; - if (d_database_factory) { + if (hasDatabaseFactory()) { boost::shared_ptr new_restartDB(d_database_factory->allocate( - restart_filename)); + restart_filename)); new_restartDB->create(restart_filename); @@ -297,7 +296,7 @@ RestartManager::writeRestartFile( /* ************************************************************************* * - * Write simulation state to supplied database. + * Write simulation state to supplied restart database. * ************************************************************************* */ @@ -309,10 +308,10 @@ RestartManager::writeRestartFile( std::list::iterator i = d_restart_items_list.begin(); - for ( ; i != d_restart_items_list.end(); i++) { + for ( ; i != d_restart_items_list.end(); ++i) { boost::shared_ptr obj_db( database->putDatabase(i->name)); - (i->obj)->putToDatabase(obj_db); + (i->obj)->putToRestart(obj_db); } } @@ -326,7 +325,7 @@ RestartManager::writeRestartFile( void RestartManager::writeRestartToDatabase() { - if (d_database_root) { + if (hasRootDatabase()) { writeRestartFile(d_database_root); } else { TBOX_ERROR("writeRestartToDatabase has no database to write to" diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.h index 87de8c1d..aaa87029 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/RestartManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An restart manager singleton class * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/DatabaseFactory.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -49,7 +49,7 @@ namespace tbox { * * It is important to note in the initialization process, some objects * will need to be constructed in the "empty" state and filled in later - * using some sort of getFromDatabase() method. + * using some sort of getFromRestart() method. * * The process for writing out state to a restart file is somewhat more * complicated. The following things need to be taken care of. @@ -57,7 +57,7 @@ namespace tbox { * * \li Each object that has state that needs to be saved for restart * must be derived from the Serializable class (which - * responds to the putToDatabase() method). + * responds to the putToRestart() method). * \li Any object that needs to save its state to the restart file * must be registered with the restart manager using the * registerRestartItem() method. NOTE THAT NO TWO RESTARTABLE @@ -73,7 +73,7 @@ namespace tbox { * both a restart directory name and a restore number for its arguments. * See comments for member functions for more details. * - * @see tbox::Database + * @see Database */ class RestartManager @@ -107,6 +107,8 @@ class RestartManager * If there is no error opening the file, then the restart manager * mounts the restart file. * Returns true if open is successful; false otherwise. + * + * @pre hasDatabaseFactory() */ bool openRestartFile( @@ -129,6 +131,15 @@ class RestartManager return d_database_root; } + /*! + * @brief Returns true if the root of the database has been set. + */ + bool + hasRootDatabase() + { + return d_database_root.get(); + } + /** * Sets the database for restore or dumps. * @@ -157,12 +168,20 @@ class RestartManager d_database_factory = database_factory; } + /*! + * @brief Returns true if the database for restore or dumps has been set. + */ + bool + hasDatabaseFactory() + { + return d_database_factory.get(); + } + /** * Registers an object for restart with the given name. * - * When assertion checking is active, an unrecoverable assertion - * will result if either the string is empty or the serializable - * object pointer is null. + * @pre !name.empty() + * @pre obj != 0 */ void registerRestartItem( @@ -173,8 +192,7 @@ class RestartManager * Removes the object with the specified name from the list of * restartable items. * - * When assertion checking is active, an unrecoverable assertion - * will result if the string is empty. + * @pre !name.empty() */ void unregisterRestartItem( @@ -209,6 +227,8 @@ class RestartManager * restart database. The string argument is the name of the * root of restart directory. The integer argument is the * identification number associated with the restart files generated. + * + * @pre hasDatabaseFactory() */ void writeRestartFile( @@ -218,6 +238,8 @@ class RestartManager /** * Write all objects registered to as restart objects to the * restart database. + * + * @pre hasRootDatabase() */ void writeRestartToDatabase(); @@ -243,15 +265,28 @@ class RestartManager * Initialize Singleton instance with instance of subclass. This function * is used to make the singleton object unique when inheriting from this * base class. + * + * @pre !s_manager_instance */ void registerSingletonSubclassInstance( - RestartManager* subclass_instance); + RestartManager * subclass_instance); private: + // Unimplemented copy constructor. + RestartManager( + const RestartManager& other); + + // Unimplemented assignment operator. + RestartManager& + operator = ( + const RestartManager& rhs); + /** * Write all objects registered to as restart objects to the * restart database. + * + * @pre database */ void writeRestartFile( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.C index f3343795..2a9fb84d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SAMRAI class to manage package startup and shutdown * ************************************************************************/ @@ -24,28 +24,22 @@ namespace tbox { /* ************************************************************************* * - * Set static members to set maximum number of patch data entries, + * Set static member to set maximum number of patch data entries, * statistics, and timers supported by the code. - * These numbers are used to set the sizes of certain array containers - * used in the SAMRAI library. They are set here so that they may be + * This value is used to set the sizes of certain array containers + * used in the SAMRAI library. It is set here so that it may be * resized if necessary from a single access point (i.e., via the - * SAMRAIManager) if the default sizes (set here) are insufficient. + * SAMRAIManager) if the default size (set here) are insufficient. * - * These values can be changed by calling the static functions: + * This value can be changed by calling the static functions: * SAMRAIManager::setMaxNumberPatchDataEntries(), * - * To avoid potentially erroneous or unexpected behavior, these - * value should be set early on during program execution before they - * are accessed in the library. Once accessed within the library, - * they cannot be reset during program execution. - * ************************************************************************* */ bool SAMRAIManager::s_initialized = false; bool SAMRAIManager::s_started = false; int SAMRAIManager::s_max_patch_data_entries = 256; -bool SAMRAIManager::s_max_patch_data_entries_accessed = false; /* ************************************************************************* @@ -91,16 +85,8 @@ void SAMRAIManager::setMaxNumberPatchDataEntries( int maxnum) { - if (s_max_patch_data_entries_accessed) { - TBOX_ERROR( - "SAMRAIManager::setMaxNumberPatchDataEntries() error..." - << "\nThe max patch data entries value has already been accessed and cannot" - << "\nbe reset after that point by calling this method -- program abort!" - << std::endl); - } else { - s_max_patch_data_entries = MathUtilities::Max(maxnum, - s_max_patch_data_entries); - } + s_max_patch_data_entries = MathUtilities::Max(maxnum, + s_max_patch_data_entries); } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.h index a4b80c2d..fcb56aeb 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAIManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SAMRAI class to manage package startup and shutdown * ************************************************************************/ @@ -50,8 +50,8 @@ namespace tbox { * Additionally this class manages static data that controls the maximum * number of patch data components that can be allowed. * - * @see tbox::SAMRAI_MPI - * @see tbox::StartupShutdownManager + * @see SAMRAI_MPI + * @see StartupShutdownManager */ class SAMRAIManager @@ -70,6 +70,8 @@ class SAMRAIManager * interface through StartupShutdownManager. * * @param[in] initialize_IEEE_assertion_handlers (defaults to true) + * + * @pre !s_initialized */ static void initialize( @@ -82,6 +84,9 @@ class SAMRAIManager * startup callback interface through StartupShutdownManager. * This function may be invoked more than once in a process if * solving multiple SAMRAI problems. + * + * @pre s_initialized + * @pre !s_started */ static void startup() @@ -99,6 +104,9 @@ class SAMRAIManager * startup callback interface through StartupShutdownManager. * This function may be invoked more than once in an process if * solving multiple SAMRAI problems. + * + * @pre s_initialized + * @pre s_started */ static void shutdown() @@ -122,6 +130,8 @@ class SAMRAIManager * exiting the program is a call to SAMRAI_MPI::finalize(). * * This function should be invoked only once. + * + * @pre s_initialized */ static void finalize() @@ -159,7 +169,6 @@ class SAMRAIManager static int getMaxNumberPatchDataEntries() { - s_max_patch_data_entries_accessed = true; return s_max_patch_data_entries; } @@ -168,19 +177,24 @@ class SAMRAIManager * * The maximum number will be set to the maximum of the current value and * the argument value. - * - * Note that this routine cannot be called anytime after the max patch - * data entries value has been accessed via the - * getMaxNumberPatchDataEntries() function, neither by the user nor - * internally within SAMRAI. Typically, the first internal access of this - * value occurs whenever any objects related to the patch hierarchy or - * variables are created. */ static void setMaxNumberPatchDataEntries( int maxnum); private: + // Unimplemented default constructor. + SAMRAIManager(); + + // Unimplemented copy constructor. + SAMRAIManager( + const SAMRAIManager& other); + + // Unimplemented assignment operator. + SAMRAIManager& + operator = ( + const SAMRAIManager& rhs); + /*! * Flag indicating SAMRAIManager has been initialized. */ @@ -196,11 +210,6 @@ class SAMRAIManager */ static int s_max_patch_data_entries; - /*! - * Flag telling whether maximum number of patch data components has - * been accessed. - */ - static bool s_max_patch_data_entries_accessed; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAI_MPI.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAI_MPI.C index 693efadb..0987a380 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAI_MPI.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SAMRAI_MPI.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple utility class for interfacing with MPI * ************************************************************************/ @@ -50,12 +50,12 @@ int MPICHX_PARALLELSOCKETS_PARAMETERS; namespace SAMRAI { namespace tbox { -SAMRAI_MPI::Comm SAMRAI_MPI::commWorld = MPI_COMM_NULL; -SAMRAI_MPI::Comm SAMRAI_MPI::commNull = MPI_COMM_NULL; +const SAMRAI_MPI::Comm SAMRAI_MPI::commWorld = MPI_COMM_WORLD; +const SAMRAI_MPI::Comm SAMRAI_MPI::commNull = MPI_COMM_NULL; bool SAMRAI_MPI::s_mpi_is_initialized = false; bool SAMRAI_MPI::s_we_started_mpi(false); -SAMRAI_MPI SAMRAI_MPI::s_samrai_world(SAMRAI_MPI::commNull); +SAMRAI_MPI SAMRAI_MPI::s_samrai_world(MPI_COMM_NULL); bool SAMRAI_MPI::s_call_abort_in_serial_instead_of_exit = false; bool SAMRAI_MPI::s_call_abort_in_parallel_instead_of_mpiabort = false; @@ -85,6 +85,19 @@ SAMRAI_MPI::SAMRAI_MPI( } } +/* + ************************************************************************** + * Copy constructor. + ************************************************************************** + */ +SAMRAI_MPI::SAMRAI_MPI( + const SAMRAI_MPI& other): + d_comm(other.d_comm), + d_rank(other.d_rank), + d_size(other.d_size) +{ +} + /* ************************************************************************** * @@ -140,18 +153,18 @@ SAMRAI_MPI::init( s_mpi_is_initialized = true; s_we_started_mpi = true; - MPI_Comm_dup(MPI_COMM_WORLD, &s_samrai_world.d_comm); - MPI_Comm_rank(s_samrai_world.d_comm, &s_samrai_world.d_rank); - MPI_Comm_size(s_samrai_world.d_comm, &s_samrai_world.d_size); + Comm dup_comm; + MPI_Comm_dup(MPI_COMM_WORLD, &dup_comm); + s_samrai_world.setCommunicator(dup_comm); #else NULL_USE(argc); NULL_USE(argv); + s_samrai_world.d_comm = MPI_COMM_WORLD; + s_samrai_world.d_size = 1; + s_samrai_world.d_rank = 0; #endif - commWorld = MPI_COMM_WORLD; - commNull = MPI_COMM_NULL; - if (getenv("SAMRAI_ABORT_ON_ERROR")) { SAMRAI_MPI::setCallAbortInSerialInsteadOfExit(true); SAMRAI_MPI::setCallAbortInParallelInsteadOfMPIAbort(true); @@ -177,14 +190,12 @@ SAMRAI_MPI::init( s_mpi_is_initialized = true; s_we_started_mpi = false; - MPI_Comm_dup(comm, &s_samrai_world.d_comm); - MPI_Comm_rank(s_samrai_world.d_comm, &s_samrai_world.d_rank); - MPI_Comm_size(s_samrai_world.d_comm, &s_samrai_world.d_size); -#endif + Comm dup_comm; + MPI_Comm_dup(comm, &dup_comm); + s_samrai_world.setCommunicator(dup_comm); - commWorld = MPI_COMM_WORLD; - commNull = MPI_COMM_NULL; +#endif if (getenv("SAMRAI_ABORT_ON_ERROR")) { SAMRAI_MPI::setCallAbortInSerialInsteadOfExit(true); @@ -203,9 +214,6 @@ SAMRAI_MPI::initMPIDisabled() s_mpi_is_initialized = false; s_we_started_mpi = false; - commWorld = MPI_COMM_WORLD; - commNull = MPI_COMM_NULL; - s_samrai_world.d_comm = MPI_COMM_WORLD; s_samrai_world.d_size = 1; s_samrai_world.d_rank = 0; @@ -227,9 +235,10 @@ void SAMRAI_MPI::finalize() { #ifdef HAVE_MPI - // check if mpi is initialized before calling Comm_free if (s_mpi_is_initialized) { MPI_Comm_free(&s_samrai_world.d_comm); + } else { + s_samrai_world.d_comm = MPI_COMM_NULL; } if (s_we_started_mpi) { @@ -252,6 +261,55 @@ SAMRAI_MPI::finalize() ***************************************************************************** */ +/* + ***************************************************************************** + ***************************************************************************** + */ +int +SAMRAI_MPI::Comm_rank( + Comm comm, + int* rank) +{ +#ifndef HAVE_MPI + NULL_USE(comm); +#endif + if (!s_mpi_is_initialized) { + TBOX_ERROR("SAMRAI_MPI::Comm_rank is a no-op without run-time MPI!"); + } + int rval = MPI_SUCCESS; +#ifdef HAVE_MPI + rval = MPI_Comm_rank(comm, rank); +#else + *rank = 0; +#endif + return rval; +} + +/* + ***************************************************************************** + ***************************************************************************** + */ +int +SAMRAI_MPI::Comm_size( + Comm comm, + int* size) +{ +#ifndef HAVE_MPI + NULL_USE(comm); +#endif + if (!s_mpi_is_initialized) { + TBOX_ERROR("SAMRAI_MPI::Comm_size is a no-op without run-time MPI!"); + } +#ifdef HAVE_MPI + return MPI_Comm_size(comm, size); + +#else + *size = 1; + return MPI_SUCCESS; + +#endif +} + /* ***************************************************************************** ***************************************************************************** @@ -310,17 +368,11 @@ int SAMRAI_MPI::Finalized( int* flag) { -#ifndef HAVE_MPI - NULL_USE(flag); -#endif int rval = MPI_SUCCESS; - if (!s_mpi_is_initialized) { - TBOX_ERROR("SAMRAI_MPI::Finalized is a no-op without run-time MPI!"); - } #ifdef HAVE_MPI - else { - rval = MPI_Finalized(flag); - } + rval = MPI_Finalized(flag); +#else + *flag = true; #endif return rval; } @@ -352,6 +404,29 @@ SAMRAI_MPI::Get_count( return rval; } +/* + ***************************************************************************** + ***************************************************************************** + */ +int +SAMRAI_MPI::Request_free( + Request* request) +{ +#ifndef HAVE_MPI + NULL_USE(request); +#endif + int rval = MPI_SUCCESS; + if (!s_mpi_is_initialized) { + TBOX_ERROR("SAMRAI_MPI::Get_count is a no-op without run-time MPI!"); + } +#ifdef HAVE_MPI + else { + rval = MPI_Request_free(request); + } +#endif + return rval; +} + /* ***************************************************************************** ***************************************************************************** @@ -1102,6 +1177,75 @@ SAMRAI_MPI::Send( return rval; } +/* + ***************************************************************************** + ***************************************************************************** + */ +int +SAMRAI_MPI::Sendrecv( + void* sendbuf, int sendcount, Datatype sendtype, int dest, int sendtag, + void* recvbuf, int recvcount, Datatype recvtype, int source, int recvtag, + Status* status) const +{ +#ifndef HAVE_MPI + NULL_USE(sendbuf); + NULL_USE(sendcount); + NULL_USE(sendtype); + NULL_USE(dest); + NULL_USE(sendtag); + NULL_USE(recvbuf); + NULL_USE(recvcount); + NULL_USE(recvtype); + NULL_USE(source); + NULL_USE(recvtag); + NULL_USE(status); +#endif + int rval = MPI_SUCCESS; + if (!s_mpi_is_initialized) { + TBOX_ERROR("SAMRAI_MPI::Send is a no-op without run-time MPI!"); + } +#ifdef HAVE_MPI + else { + rval = MPI_Sendrecv( + sendbuf, sendcount, sendtype, dest, sendtag, + recvbuf, recvcount, recvtype, source, recvtag, + d_comm, status); + } +#endif + return rval; +} + +/* + ***************************************************************************** + ***************************************************************************** + */ +int +SAMRAI_MPI::Scan( + void* sendbuf, + void* recvbuf, + int count, + Datatype datatype, + Op op) const +{ +#ifndef HAVE_MPI + NULL_USE(sendbuf); + NULL_USE(recvbuf); + NULL_USE(count); + NULL_USE(datatype); + NULL_USE(op); +#endif + int rval = MPI_SUCCESS; + if (!s_mpi_is_initialized) { + TBOX_ERROR("SAMRAI_MPI::Scan is a no-op without run-time MPI!"); + } +#ifdef HAVE_MPI + else { + rval = MPI_Scan(sendbuf, recvbuf, count, datatype, op, d_comm); + } +#endif + return rval; +} + /* ***************************************************************************** * @@ -1135,7 +1279,7 @@ SAMRAI_MPI::AllReduce( NULL_USE(ranks_of_extrema); #endif if ((op == MPI_MINLOC || op == MPI_MAXLOC) && - ranks_of_extrema == NULL) { + ranks_of_extrema == 0) { TBOX_ERROR("SAMRAI_MPI::AllReduce: If you specify reduce\n" << "operation MPI_MINLOC or MPI_MAXLOC, you must\n" << "provide space for the ranks in the 'ranks_of_extrema'\n" @@ -1153,7 +1297,7 @@ SAMRAI_MPI::AllReduce( bool get_ranks_of_extrema = op == MPI_MINLOC ? true : op == MPI_MAXLOC ? true : - ranks_of_extrema != NULL && (op == MPI_MIN || op == MPI_MAX); + ranks_of_extrema != 0 && (op == MPI_MIN || op == MPI_MAX); if (!get_ranks_of_extrema) { std::vector recv_buf(count); @@ -1204,7 +1348,7 @@ SAMRAI_MPI::AllReduce( NULL_USE(ranks_of_extrema); #endif if ((op == MPI_MINLOC || op == MPI_MAXLOC) && - ranks_of_extrema == NULL) { + ranks_of_extrema == 0) { TBOX_ERROR("SAMRAI_MPI::AllReduce: If you specify reduce\n" << "operation MPI_MINLOC or MPI_MAXLOC, you must\n" << "provide space for the ranks in the 'ranks_of_extrema'\n" @@ -1222,7 +1366,7 @@ SAMRAI_MPI::AllReduce( bool get_ranks_of_extrema = op == MPI_MINLOC ? true : op == MPI_MAXLOC ? true : - ranks_of_extrema != NULL && (op == MPI_MIN || op == MPI_MAX); + ranks_of_extrema != 0 && (op == MPI_MIN || op == MPI_MAX); if (!get_ranks_of_extrema) { std::vector recv_buf(count); @@ -1273,7 +1417,7 @@ SAMRAI_MPI::AllReduce( NULL_USE(ranks_of_extrema); #endif if ((op == MPI_MINLOC || op == MPI_MAXLOC) && - ranks_of_extrema == NULL) { + ranks_of_extrema == 0) { TBOX_ERROR("SAMRAI_MPI::AllReduce: If you specify reduce\n" << "operation MPI_MINLOC or MPI_MAXLOC, you must\n" << "provide space for the ranks in the 'ranks_of_extrema'\n" @@ -1291,7 +1435,7 @@ SAMRAI_MPI::AllReduce( bool get_ranks_of_extrema = op == MPI_MINLOC ? true : op == MPI_MAXLOC ? true : - ranks_of_extrema != NULL && (op == MPI_MIN || op == MPI_MAX); + ranks_of_extrema != 0 && (op == MPI_MIN || op == MPI_MAX); if (!get_ranks_of_extrema) { std::vector recv_buf(count); @@ -1354,40 +1498,40 @@ SAMRAI_MPI::parallelPrefixSum( Status send_stat, recv_stat; int mpi_err = MPI_SUCCESS; - for ( int distance=1; distance < d_size; distance *= 2 ) { + for (int distance = 1; distance < d_size; distance *= 2) { const int recv_from = d_rank - distance; const int send_to = d_rank + distance; - if ( recv_from >= 0 ) { - mpi_err = Irecv( &recv_scr[0], count, MPI_INT, recv_from, tag, &recv_req ); - if ( mpi_err != MPI_SUCCESS ) { + if (recv_from >= 0) { + mpi_err = Irecv(&recv_scr[0], count, MPI_INT, recv_from, tag, &recv_req); + if (mpi_err != MPI_SUCCESS) { return mpi_err; } } - if (send_to < d_size ) { + if (send_to < d_size) { send_scr.clear(); - send_scr.insert( send_scr.end(), x, x+count ); - mpi_err = Isend( &send_scr[0], count, MPI_INT, send_to, tag, &send_req ); - if ( mpi_err != MPI_SUCCESS ) { + send_scr.insert(send_scr.end(), x, x + count); + mpi_err = Isend(&send_scr[0], count, MPI_INT, send_to, tag, &send_req); + if (mpi_err != MPI_SUCCESS) { return mpi_err; } } - if ( recv_from >= 0 ) { - mpi_err = Wait( &recv_req, &recv_stat ); - if ( mpi_err != MPI_SUCCESS ) { + if (recv_from >= 0) { + mpi_err = Wait(&recv_req, &recv_stat); + if (mpi_err != MPI_SUCCESS) { return mpi_err; } - for ( int i=0; i 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ > 0))) #pragma GCC diagnostic ignored "-Wall" #pragma GCC diagnostic ignored "-Wextra" #pragma GCC diagnostic ignored "-Wconversion" #endif #endif +#endif #ifdef __INTEL_COMPILER // Ignore Intel warnings about unreachable statements @@ -40,7 +42,9 @@ #define YY_FLEX_MINOR_VERSION 5 #include +#ifdef HAVE_UNISTD_H #include +#endif /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -486,7 +490,7 @@ char *yytext; // // File: $URL$ // Package: SAMRAI toolbox -// Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +// Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC // Description: Lex scanner description for the SAMRAI input database // @@ -907,7 +911,7 @@ YY_RULE_SETUP { Parser::getParser()->advanceCursor(yytext); - SAMRAI_yylval.u_integer = atol(yytext); + SAMRAI_yylval.u_integer = atoi(yytext); return(T_INTEGER); } YY_BREAK @@ -971,7 +975,7 @@ YY_RULE_SETUP } else { if (Parser::getParser()->pushIncludeFile(filename)) { s_include_stack[s_include_stack_top++] = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(NULL,YY_BUF_SIZE)); + yy_switch_to_buffer(yy_create_buffer(0,YY_BUF_SIZE)); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Scanner.l b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Scanner.l index e04b7858..71ca903c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Scanner.l +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Scanner.l @@ -1,15 +1,13 @@ %{ // -// File: $URL$ -// Package: SAMRAI toolbox -// Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -// Revision: $LastChangedRevision$ -// Description: Lex scanner description for the SAMRAI input database +// This file is part of the SAMRAI distribution. For full copyright +// information, see COPYRIGHT and COPYING.LESSER. +// +// Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +// Description: Lex scanner description for the SAMRAI input database // -#include "SAMRAI/SAMRAI_config.h" - #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/Parser.h" @@ -86,7 +84,7 @@ S_STRING (\"([^\n"])*\") {S_INTEGER} { Parser::getParser()->advanceCursor(yytext); - yylval.u_integer = atol(yytext); + yylval.u_integer = atoi(yytext); return(T_INTEGER); } @@ -132,7 +130,7 @@ S_STRING (\"([^\n"])*\") } else { if (Parser::getParser()->pushIncludeFile(filename)) { s_include_stack[s_include_stack_top++] = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(NULL,YY_BUF_SIZE)); + yy_switch_to_buffer(yy_create_buffer(0,YY_BUF_SIZE)); } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.C index ff7f63dc..245c82d7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.C @@ -3,11 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Schedule of communication transactions between processors * ************************************************************************/ #include "SAMRAI/tbox/Schedule.h" +#include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -41,13 +42,14 @@ const size_t Schedule::s_default_first_message_length = 1000; const std::string Schedule::s_default_timer_prefix("tbox::Schedule"); std::map Schedule::s_static_timers; +char Schedule::s_ignore_external_timer_prefix('\0'); StartupShutdownManager::Handler Schedule::s_initialize_finalize_handler( Schedule::initializeCallback, 0, 0, - Schedule::finalizeCallback, + 0, StartupShutdownManager::priorityTimers); /* @@ -56,14 +58,17 @@ Schedule::s_initialize_finalize_handler( */ Schedule::Schedule(): - d_coms(NULL), + d_coms(0), d_com_stage(), d_mpi(SAMRAI_MPI::getSAMRAIWorld()), d_first_tag(s_default_first_tag), d_second_tag(s_default_second_tag), - d_first_message_length(s_default_first_message_length) + d_first_message_length(s_default_first_message_length), + d_unpack_in_deterministic_order(false), + d_object_timers(0) { - setTimerPrefix("tbox::Schedule"); + getFromInput(); + setTimerPrefix(s_default_timer_prefix); } /* @@ -74,7 +79,7 @@ Schedule::Schedule(): */ Schedule::~Schedule() { - if (d_coms != NULL) { + if (allocatedCommunicationObjects()) { TBOX_ERROR("Destructing a schedule while communication is pending\n" << "leads to lost messages. Aborting."); } @@ -172,10 +177,22 @@ Schedule::getNumRecvTransactions( void Schedule::communicate() { +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Schedule::communicate: Errant message detected before beginCommunication()."); + } +#endif + d_object_timers->t_communicate->start(); beginCommunication(); finalizeCommunication(); d_object_timers->t_communicate->stop(); + +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_mpi.hasReceivableMessage(0, MPI_ANY_SOURCE, MPI_ANY_TAG)) { + TBOX_ERROR("Schedule::communicate: Errant message detected after finalizeCommunication()."); + } +#endif } /* @@ -267,7 +284,7 @@ Schedule::postReceives() unsigned int byte_count = 0; bool can_estimate_incoming_message_size = true; for (ConstIterator r = transactions.begin(); - r != transactions.end(); r++) { + r != transactions.end(); ++r) { if (!(*r)->canEstimateIncomingMessageSize()) { can_estimate_incoming_message_size = false; break; @@ -344,7 +361,7 @@ Schedule::postSends() size_t byte_count = 0; bool can_estimate_incoming_message_size = true; for (ConstIterator pack = transactions.begin(); - pack != transactions.end(); pack++) { + pack != transactions.end(); ++pack) { if (!(*pack)->canEstimateIncomingMessageSize()) { can_estimate_incoming_message_size = false; } @@ -355,13 +372,13 @@ Schedule::postSends() MessageStream outgoing_stream(byte_count, MessageStream::Write); d_object_timers->t_pack_stream->start(); for (ConstIterator pack = transactions.begin(); - pack != transactions.end(); pack++) { + pack != transactions.end(); ++pack) { (*pack)->packStream(outgoing_stream); } d_object_timers->t_pack_stream->stop(); if (can_estimate_incoming_message_size) { - // Receiver knows message size, so set it exactly. + // Receiver knows message size so set it exactly. send_coms[icom].limitFirstDataLength(byte_count); } @@ -387,7 +404,7 @@ Schedule::performLocalCopies() { d_object_timers->t_local_copies->start(); for (Iterator local = d_local_set.begin(); - local != d_local_set.end(); local++) { + local != d_local_set.end(); ++local) { (*local)->copyLocalData(); } d_object_timers->t_local_copies->stop(); @@ -399,6 +416,8 @@ Schedule::performLocalCopies() * operations are placed in d_completed_comm. Process these first, * then check for next set of completed operations. Repeat until all * operations are completed. + * + * Once a receive is completed, put it in a MessageStream for unpacking. ************************************************************************* */ void @@ -406,34 +425,76 @@ Schedule::processCompletedCommunications() { d_object_timers->t_process_incoming_messages->start(); - while ( d_com_stage.numberOfCompletedMembers() > 0 || - d_com_stage.advanceSome() ) { + if (d_unpack_in_deterministic_order) { - AsyncCommPeer* completed_comm = - dynamic_cast *>(d_com_stage.popCompletionQueue()); + // Unpack in deterministic order. Wait for receive as needed. - TBOX_ASSERT(completed_comm != NULL); - TBOX_ASSERT(completed_comm->isDone()); - if (static_cast(completed_comm - d_coms) < d_recv_sets.size()) { + int irecv = 0; + for (TransactionSets::iterator recv_itr = d_recv_sets.begin(); + recv_itr != d_recv_sets.end(); ++recv_itr, ++irecv) { - const int sender = completed_comm->getPeerRank(); + int sender = recv_itr->first; + AsyncCommPeer& completed_comm = d_coms[irecv]; + TBOX_ASSERT(sender == completed_comm.getPeerRank()); + completed_comm.completeCurrentOperation(); + completed_comm.yankFromCompletionQueue(); - // Copy message into stream. MessageStream incoming_stream( - completed_comm->getRecvSize() * sizeof(char), + static_cast(completed_comm.getRecvSize()) * sizeof(char), MessageStream::Read, - completed_comm->getRecvData()); - completed_comm->clearRecvData(); + completed_comm.getRecvData(), + false /* don't use deep copy */); d_object_timers->t_unpack_stream->start(); for (Iterator recv = d_recv_sets[sender].begin(); - recv != d_recv_sets[sender].end(); recv++) { + recv != d_recv_sets[sender].end(); ++recv) { (*recv)->unpackStream(incoming_stream); } d_object_timers->t_unpack_stream->stop(); - } else { - // No further action required for completed send. + completed_comm.clearRecvData(); + + } + + // Complete sends. + d_com_stage.advanceAll(); + while (d_com_stage.hasCompletedMembers()) { + d_com_stage.popCompletionQueue(); } + + } else { + + // Unpack in order of completed receives. + + size_t num_senders = d_recv_sets.size(); + while (d_com_stage.hasCompletedMembers() || d_com_stage.advanceSome()) { + + AsyncCommPeer* completed_comm = + CPP_CAST *>(d_com_stage.popCompletionQueue()); + + TBOX_ASSERT(completed_comm != 0); + TBOX_ASSERT(completed_comm->isDone()); + if (static_cast(completed_comm - d_coms) < num_senders) { + + const int sender = completed_comm->getPeerRank(); + + MessageStream incoming_stream( + static_cast(completed_comm->getRecvSize()) * sizeof(char), + MessageStream::Read, + completed_comm->getRecvData(), + false /* don't use deep copy */); + + d_object_timers->t_unpack_stream->start(); + for (Iterator recv = d_recv_sets[sender].begin(); + recv != d_recv_sets[sender].end(); ++recv) { + (*recv)->unpackStream(incoming_stream); + } + d_object_timers->t_unpack_stream->stop(); + completed_comm->clearRecvData(); + } else { + // No further action required for completed send. + } + } + } d_object_timers->t_process_incoming_messages->stop(); @@ -449,7 +510,9 @@ void Schedule::allocateCommunicationObjects() { const size_t length = d_recv_sets.size() + d_send_sets.size(); - d_coms = new AsyncCommPeer[length]; + if (length > 0) { + d_coms = new AsyncCommPeer[length]; + } size_t counter = 0; for (TransactionSets::iterator ti = d_recv_sets.begin(); @@ -494,7 +557,7 @@ Schedule::printClassData( const std::list >& send_set = ss->second; stream << "Send Set: " << ss->first << std::endl; for (ConstIterator send = send_set.begin(); - send != send_set.end(); send++) { + send != send_set.end(); ++send) { (*send)->printClassData(stream); } } @@ -504,18 +567,48 @@ Schedule::printClassData( const std::list >& recv_set = rs->second; stream << "Recv Set: " << rs->first << std::endl; for (ConstIterator recv = recv_set.begin(); - recv != recv_set.end(); recv++) { + recv != recv_set.end(); ++recv) { (*recv)->printClassData(stream); } } stream << "Local Set" << std::endl; for (ConstIterator local = d_local_set.begin(); - local != d_local_set.end(); local++) { + local != d_local_set.end(); ++local) { (*local)->printClassData(stream); } } +/* + *********************************************************************** + *********************************************************************** + */ +void +Schedule::getFromInput() +{ + /* + * - set up debugging flags. + */ + if (s_ignore_external_timer_prefix == '\0') { + s_ignore_external_timer_prefix = 'n'; + if (InputManager::inputDatabaseExists()) { + boost::shared_ptr idb( + InputManager::getInputDatabase()); + if (idb->isDatabase("Schedule")) { + boost::shared_ptr sched_db( + idb->getDatabase("Schedule")); + s_ignore_external_timer_prefix = + sched_db->getCharWithDefault("DEV_ignore_external_timer_prefix", + 'n'); + if (!(s_ignore_external_timer_prefix == 'n' || + s_ignore_external_timer_prefix == 'y')) { + INPUT_VALUE_ERROR("DEV_ignore_external_timer_prefix"); + } + } + } + } +} + /* *********************************************************************** *********************************************************************** @@ -524,11 +617,17 @@ void Schedule::setTimerPrefix( const std::string& timer_prefix) { + std::string timer_prefix_used; + if (s_ignore_external_timer_prefix == 'y') { + timer_prefix_used = s_default_timer_prefix; + } else { + timer_prefix_used = timer_prefix; + } std::map::iterator ti( - s_static_timers.find(timer_prefix)); + s_static_timers.find(timer_prefix_used)); if (ti == s_static_timers.end()) { - d_object_timers = &s_static_timers[timer_prefix]; - getAllTimers(timer_prefix, *d_object_timers); + d_object_timers = &s_static_timers[timer_prefix_used]; + getAllTimers(timer_prefix_used, *d_object_timers); } else { d_object_timers = &(ti->second); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.h index a56d483c..66b969d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Schedule.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Schedule of communication transactions between processors * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/tbox/MessageStream.h" #include "SAMRAI/tbox/Transaction.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -48,7 +48,7 @@ namespace tbox { * order of transaction execution matters. The transactions will be * executed in the order in which they appear in the list. * - * @see tbox::Transaction + * @see Transaction */ class Schedule @@ -64,6 +64,8 @@ class Schedule * * Note that the schedule can not be deleted during a communication * phase; this will result in an assertion being thrown. + * + * @pre !allocatedCommunicationObjects() */ ~Schedule(); @@ -145,6 +147,9 @@ class Schedule * isolated from other communications, you can specify distinct * tags to avoid message mix-ups. Up to two messages are sent from * each communicating pairs. Specify two distinct tags. + * + * @pre first_tag >= 0 + * @pre second_tag >= 0 */ void setMPITag( @@ -188,13 +193,15 @@ class Schedule * first_message_length defaults to 1000. * * @param first_message_length length (in bytes) of first message + * + * @pre first_message_length > 0 */ void setFirstMessageLength( int first_message_length) { TBOX_ASSERT(first_message_length > 0); - d_first_message_length = first_message_length; + d_first_message_length = static_cast(first_message_length); } /*! @@ -226,6 +233,21 @@ class Schedule void finalizeCommunication(); + /*! + * @brief Set whether to unpack messages in a deterministic order. + * + * By default message unpacking is ordered by receive time, which + * is not deterministic. If your results are dependent on unpack + * ordering and you want deterministic results, set this flag to + * true. + * + * @param [in] flag + */ + void setDeterministicUnpackOrderingFlag(bool flag) + { + d_unpack_in_deterministic_order = flag; + } + /*! * @brief Setup names of timers. * @@ -247,14 +269,34 @@ class Schedule printClassData( std::ostream& stream) const; + /*! + * @brief Returns true if the communication objects have been allocated. + */ + bool + allocatedCommunicationObjects() + { + return d_coms != 0; + } + + /*! + * @brief Get the name of this object. + */ + const std::string + getObjectName() const + { + return "Schedule"; + } + private: void allocateCommunicationObjects(); void deallocateCommunicationObjects() { - delete[] d_coms; - d_coms = NULL; + if (d_coms) { + delete[] d_coms; + } + d_coms = 0; } void @@ -270,7 +312,7 @@ class Schedule Schedule( const Schedule&); // not implemented - void + Schedule& operator = ( const Schedule&); // not implemented @@ -287,15 +329,10 @@ class Schedule } /*! - * Free static timers. - * - * Only called by StartupShutdownManager. + * @brief Read input data from input database and initialize class members. */ - static void - finalizeCallback() - { - s_static_timers.clear(); - } + void + getFromInput(); /* * @brief Transactions in this schedule. @@ -356,6 +393,13 @@ class Schedule */ size_t d_first_message_length; + /*! + * @brief Whether to unpack messages in a deterministic order. + * + * @see setDeterministicUnpackOrderingFlag() + */ + bool d_unpack_in_deterministic_order; + static const int s_default_first_tag; static const int s_default_second_tag; static const size_t s_default_first_message_length; @@ -393,6 +437,8 @@ class Schedule */ static std::map s_static_timers; + static char s_ignore_external_timer_prefix; + /*! * @brief Structure of timers in s_static_timers, matching this * object's timer prefix. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.C index b9d5ee09..60fbad34 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for objects to be serialized * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.h index e2547529..79ea915b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Serializable.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: An abstract base class for objects to be serialized * ************************************************************************/ @@ -14,7 +14,7 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace tbox { @@ -24,11 +24,11 @@ namespace tbox { * database serialization for objects. * * Objects needing to serialize their data to a database implement the - * function putToDatabase(boost::shared_ptr) specifying + * function putToRestart(boost::shared_ptr) specifying * how to put its data members into the database instance. * * @note The interface asymmetric in that is no corresponding - * "getFromDatabase" function. This stems from SAMRAI's historical + * "getFromRestart" function. This stems from SAMRAI's historical * restart procedure and object creation is object initialization * pattern. Thus restarting is done in the constructors for classes * implementing Serializable not by an additional method. The @@ -51,12 +51,22 @@ class Serializable /*! * @brief Serializes the object by writing necessary state to the - * specified database. + * specified restart database. * */ virtual void - putToDatabase( - const boost::shared_ptr& database) const = 0; + putToRestart( + const boost::shared_ptr& restart_db) const = 0; + +private: + // Unimplemented copy constructor. + Serializable( + const Serializable& other); + + // Unimplemented default constructor. + Serializable& + operator = ( + const Serializable& rhs); }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.C index 3634fc2a..1e961478 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A database structure that stores Silo format data. * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" #include #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -63,7 +63,7 @@ SiloDatabase::nameMangle( std::string name) { std::stringstream mangled_name; - for (std::string::size_type i = 0; i < name.size(); i++) { + for (std::string::size_type i = 0; i < name.size(); ++i) { if (IsValid(name[i])) { mangled_name << name[i]; } else { @@ -110,7 +110,7 @@ SiloDatabase::nameDemangle( SiloDatabase::SiloDatabase( const std::string& name): d_is_file(false), - d_file(NULL), + d_file(0), d_directory("/"), d_database_name(name) { @@ -133,7 +133,7 @@ SiloDatabase::SiloDatabase( { TBOX_ASSERT(!name.empty()); TBOX_ASSERT(!directory.empty()); - TBOX_ASSERT(file != NULL); + TBOX_ASSERT(file != 0); int err; @@ -176,9 +176,9 @@ SiloDatabase::create( close(); } - d_file = DBCreate(name.c_str(), DB_CLOBBER, DB_LOCAL, NULL, DB_PDB); + d_file = DBCreate(name.c_str(), DB_CLOBBER, DB_LOCAL, 0, DB_PDB); - if (d_file == NULL) { + if (d_file == 0) { TBOX_ERROR("Unable to open Silo file " << name << "\n"); status = false; @@ -218,7 +218,7 @@ SiloDatabase::open( DB_UNKNOWN, read_write_mode ? DB_APPEND : DB_READ); - if (d_file == NULL) { + if (d_file == 0) { TBOX_ERROR("Unable to open Silo file " << name << "\n"); status = false; @@ -250,7 +250,7 @@ SiloDatabase::close() #ifdef ASSERT_SILO_RETURN_VALUES TBOX_ASSERT(err >= 0); #endif - d_file = NULL; + d_file = 0; d_is_file = false; } @@ -273,14 +273,14 @@ SiloDatabase::attachToFile( { bool status = false; - if (file != NULL) { + if (file != 0) { status = true; d_is_file = false; d_file = file; d_directory = directory; std::string path = nameMangle(d_directory); - if (!DBInqVarType(d_file, path.c_str()) == DB_DIR) { + if (DBInqVarType(d_file, path.c_str()) != DB_DIR) { int err = DBMkdir(d_file, path.c_str()); if (err < 0) { TBOX_ERROR( @@ -331,14 +331,14 @@ SiloDatabase::keyExists( ************************************************************************* */ -Array +std::vector SiloDatabase::getAllKeys() { - TBOX_ASSERT(!d_directory.empty()); + TBOX_ASSERT(hasDirectory()); std::string path = nameMangle(d_directory); - Array tmp_keys; + std::vector tmp_keys; DBObjectType var_type = DBInqVarType(d_file, path.c_str()); if (var_type == DB_DIR) { @@ -350,13 +350,13 @@ SiloDatabase::getAllKeys() DBtoc* toc = DBGetToc(d_file); - tmp_keys.resizeArray(toc->nvar + toc->ndir); + tmp_keys.resize(toc->nvar + toc->ndir); - for (int i = 0; i < toc->nvar; i++) { + for (int i = 0; i < toc->nvar; ++i) { tmp_keys[i] = toc->var_names[i]; } - for (int i = 0; i < toc->ndir; i++) { + for (int i = 0; i < toc->ndir; ++i) { tmp_keys[i + toc->nvar] = toc->dir_names[i]; } @@ -453,7 +453,7 @@ SiloDatabase::getArrayType( ************************************************************************* */ -int +size_t SiloDatabase::getArraySize( const std::string& key) { @@ -500,7 +500,7 @@ SiloDatabase::getArraySize( // Unrecognized type return 0 } - return array_size; + return static_cast(array_size); } /* @@ -592,6 +592,7 @@ bool SiloDatabase::isBool( const std::string& key) { + TBOX_ASSERT(!key.empty()); return isSiloSimpleType(key, DB_SHORT); } @@ -608,14 +609,14 @@ void SiloDatabase::putBoolArray( const std::string& key, const bool * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (bool *)NULL); + TBOX_ASSERT(data != 0); short temp_array[nelements]; - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { temp_array[i] = data[i]; } @@ -625,7 +626,7 @@ SiloDatabase::putBoolArray( /* ************************************************************************ * - * Two routines to get boolean arrays from the database with the + * Two routines to get boolean vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a boolean type. @@ -633,25 +634,25 @@ SiloDatabase::putBoolArray( ************************************************************************ */ -Array -SiloDatabase::getBoolArray( +std::vector +SiloDatabase::getBoolVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isBool(key)) { - TBOX_ERROR("SiloDatabase::getBoolArray() error in database " + TBOX_ERROR("SiloDatabase::getBoolVector() error in database " << d_database_name << std::endl << " Key = " << key << " is not a bool array." << std::endl); } - Array boolArray(getSiloSimpleTypeLength(key)); + std::vector boolArray(getSiloSimpleTypeLength(key)); short temp_array[getSiloSimpleTypeLength(key)]; getSiloSimpleType(key, temp_array); - for (int i = 0; i < getSiloSimpleTypeLength(key); i++) { + for (int i = 0; i < getSiloSimpleTypeLength(key); ++i) { boolArray[i] = temp_array[i]; } @@ -686,7 +687,7 @@ SiloDatabase::isDatabaseBox( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - if (ca != NULL) { + if (ca != 0) { if (ca->datatype == DB_INT) { is_type = true; } @@ -709,10 +710,10 @@ void SiloDatabase::putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (DatabaseBox *)NULL); + TBOX_ASSERT(data != 0); const char* elemnames[3]; int elemlengths[3]; @@ -722,23 +723,23 @@ SiloDatabase::putDatabaseBoxArray( elemnames[2] = "lo"; int size = 0; - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { size += data[i].d_data.d_dimension; } - elemlengths[0] = nelements; - elemlengths[1] = size; - elemlengths[2] = size; + elemlengths[0] = static_cast(nelements); + elemlengths[1] = static_cast(size); + elemlengths[2] = static_cast(size); - Array values(nelements + size * 2); + std::vector values(nelements + size * 2); - int offset = nelements; - for (int i = 0; i < nelements; i++) { + size_t offset = nelements; + for (size_t i = 0; i < nelements; ++i) { values[i] = data[i].d_data.d_dimension; - for (int d = 0; d < data[i].d_data.d_dimension; d++) { + for (int d = 0; d < data[i].d_data.d_dimension; ++d) { values[offset] = data[i].d_data.d_lo[d]; values[offset + size] = data[i].d_data.d_hi[d]; - offset++; + ++offset; } } @@ -755,8 +756,8 @@ SiloDatabase::putDatabaseBoxArray( err = DBPutCompoundarray(d_file, path.c_str(), const_cast(elemnames), elemlengths, - 3, values.getPointer(), values.size(), - DB_INT, NULL); + 3, &values[0], static_cast(values.size()), + DB_INT, 0); if (err < 0) { TBOX_ERROR( "SiloDatabase: DBPutCompoundarray failed " << d_directory @@ -768,7 +769,7 @@ SiloDatabase::putDatabaseBoxArray( /* ************************************************************************ * - * Two routines to get box arrays from the database with the + * A routine to get box vectors from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a box type. @@ -776,8 +777,8 @@ SiloDatabase::putDatabaseBoxArray( ************************************************************************ */ -Array -SiloDatabase::getDatabaseBoxArray( +std::vector +SiloDatabase::getDatabaseBoxVector( const std::string& key) { TBOX_ASSERT(!key.empty()); @@ -787,27 +788,28 @@ SiloDatabase::getDatabaseBoxArray( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - Array boxArray(ca->elemlengths[0]); + std::vector boxVector(ca->elemlengths[0]); int* values = static_cast(ca->values); int offset = ca->elemlengths[0]; - for (int i = 0; i < (ca->elemlengths[0]); i++) { - boxArray[i].d_data.d_dimension = values[i]; + for (int i = 0; i < (ca->elemlengths[0]); ++i) { + TBOX_ASSERT(values[i] > 0 && values[i] <= SAMRAI::MAX_DIM_VAL); + boxVector[i].d_data.d_dimension = static_cast(values[i]); /* * This preserves old behavior where boxes can be different dims but is * likely not supported anywhere else in the library. */ - boxArray[i].setDim(Dimension((unsigned short)values[i])); - for (int d = 0; d < boxArray[i].d_data.d_dimension; d++) { - boxArray[i].d_data.d_lo[d] = values[offset]; - boxArray[i].d_data.d_hi[d] = values[offset + ca->elemlengths[1]]; - offset++; + boxVector[i].setDim(Dimension((unsigned short)values[i])); + for (int d = 0; d < boxVector[i].d_data.d_dimension; ++d) { + boxVector[i].d_data.d_lo[d] = values[offset]; + boxVector[i].d_data.d_hi[d] = values[offset + ca->elemlengths[1]]; + ++offset; } } DBFreeCompoundarray(ca); - return boxArray; + return boxVector; } /* @@ -824,6 +826,7 @@ bool SiloDatabase::isChar( const std::string& key) { + TBOX_ASSERT(!key.empty()); return isSiloSimpleType(key, DB_CHAR); } @@ -840,10 +843,10 @@ void SiloDatabase::putCharArray( const std::string& key, const char * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (char *)NULL); + TBOX_ASSERT(data != 0); putSiloSimpleType(key, data, nelements, DB_CHAR); } @@ -851,7 +854,7 @@ SiloDatabase::putCharArray( /* ************************************************************************ * - * Two routines to get char arrays from the database with the + * Two routines to get char vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a char type. @@ -859,21 +862,21 @@ SiloDatabase::putCharArray( ************************************************************************ */ -Array -SiloDatabase::getCharArray( +std::vector +SiloDatabase::getCharVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isChar(key)) { - TBOX_ERROR("SiloDatabase::getCharArray() error in database " + TBOX_ERROR("SiloDatabase::getCharVector() error in database " << d_database_name << std::endl << " Key = " << key << " is not a char array." << std::endl); } - Array charArray(getSiloSimpleTypeLength(key)); + std::vector charArray(getSiloSimpleTypeLength(key)); - getSiloSimpleType(key, charArray.getPointer()); + getSiloSimpleType(key, &charArray[0]); return charArray; } @@ -906,7 +909,7 @@ SiloDatabase::isComplex( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - if (ca != NULL) { + if (ca != 0) { if (ca->datatype == DB_DOUBLE) { is_type = true; } @@ -931,22 +934,22 @@ void SiloDatabase::putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (dcomplex *)NULL); + TBOX_ASSERT(data != 0); const char* elemnames[2]; - Array values(nelements * 2); + std::vector values(nelements * 2); int elemlengths[2]; elemnames[0] = "real"; elemnames[1] = "imag"; - elemlengths[0] = nelements; - elemlengths[1] = nelements; + elemlengths[0] = static_cast(nelements); + elemlengths[1] = static_cast(nelements); - for (int i = 0; i < nelements; i++) { + for (size_t i = 0; i < nelements; ++i) { values[i] = data[i].real(); values[i + nelements] = data[i].imag(); } @@ -964,8 +967,8 @@ SiloDatabase::putComplexArray( err = DBPutCompoundarray(d_file, path.c_str(), const_cast(elemnames), elemlengths, 2, - values.getPointer(), values.size(), - DB_DOUBLE, NULL); + &values[0], static_cast(values.size()), + DB_DOUBLE, 0); if (err < 0) { TBOX_ERROR( "SiloDatabase DBPutCompoundarray failed " << d_directory @@ -976,7 +979,7 @@ SiloDatabase::putComplexArray( /* ************************************************************************ * - * Two routines to get complex arrays from the database with the + * Two routines to get complex vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a complex type. @@ -984,14 +987,14 @@ SiloDatabase::putComplexArray( ************************************************************************ */ -Array -SiloDatabase::getComplexArray( +std::vector +SiloDatabase::getComplexVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isComplex(key)) { - TBOX_ERROR("SiloDatabase::getComplexArray() error in database " + TBOX_ERROR("SiloDatabase::getComplexVector() error in database " << d_database_name << "\n Key = " << key << " is not a complex array." << std::endl); } @@ -1001,9 +1004,9 @@ SiloDatabase::getComplexArray( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - Array complexArray(ca->elemlengths[0]); + std::vector complexArray(ca->elemlengths[0]); - for (int i = 0; i < ca->elemlengths[0]; i++) { + for (int i = 0; i < ca->elemlengths[0]; ++i) { complexArray[i] = dcomplex(static_cast(ca->values)[i], static_cast(ca->values)[i + ca->elemlengths[0]]); } @@ -1027,6 +1030,7 @@ bool SiloDatabase::isDouble( const std::string& key) { + TBOX_ASSERT(!key.empty()); return isSiloSimpleType(key, DB_DOUBLE); } @@ -1043,10 +1047,10 @@ void SiloDatabase::putDoubleArray( const std::string& key, const double * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (double *)NULL); + TBOX_ASSERT(data != 0); putSiloSimpleType(key, data, nelements, DB_DOUBLE); } @@ -1054,7 +1058,7 @@ SiloDatabase::putDoubleArray( /* ************************************************************************ * - * Two routines to get double arrays from the database with the + * Two routines to get double vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a double type. @@ -1062,21 +1066,21 @@ SiloDatabase::putDoubleArray( ************************************************************************ */ -Array -SiloDatabase::getDoubleArray( +std::vector +SiloDatabase::getDoubleVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isDouble(key)) { - TBOX_ERROR("SiloDatabase::getDoubleArray() error in database " + TBOX_ERROR("SiloDatabase::getDoubleVector() error in database " << d_database_name << "\n Key = " << key << " is not a double array." << std::endl); } - Array doubleArray(getSiloSimpleTypeLength(key)); + std::vector doubleArray(getSiloSimpleTypeLength(key)); - getSiloSimpleType(key, doubleArray.getPointer()); + getSiloSimpleType(key, &doubleArray[0]); return doubleArray; } @@ -1095,6 +1099,7 @@ bool SiloDatabase::isFloat( const std::string& key) { + TBOX_ASSERT(!key.empty()); return isSiloSimpleType(key, DB_FLOAT); } @@ -1111,10 +1116,10 @@ void SiloDatabase::putFloatArray( const std::string& key, const float * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (float *)NULL); + TBOX_ASSERT(data != 0); putSiloSimpleType(key, data, nelements, DB_FLOAT); } @@ -1122,7 +1127,7 @@ SiloDatabase::putFloatArray( /* ************************************************************************ * - * Two routines to get float arrays from the database with the + * Two routines to get float vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a float type. @@ -1130,21 +1135,21 @@ SiloDatabase::putFloatArray( ************************************************************************ */ -Array -SiloDatabase::getFloatArray( +std::vector +SiloDatabase::getFloatVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isFloat(key)) { - TBOX_ERROR("SiloDatabase::getFloatArray() error in database " + TBOX_ERROR("SiloDatabase::getFloatVector() error in database " << d_database_name << std::endl << " Key = " << key << " is not a float array." << std::endl); } - Array floatArray(getSiloSimpleTypeLength(key)); + std::vector floatArray(getSiloSimpleTypeLength(key)); - getSiloSimpleType(key, floatArray.getPointer()); + getSiloSimpleType(key, &floatArray[0]); return floatArray; @@ -1164,6 +1169,7 @@ bool SiloDatabase::isInteger( const std::string& key) { + TBOX_ASSERT(!key.empty()); return isSiloSimpleType(key, DB_INT); } @@ -1180,10 +1186,10 @@ void SiloDatabase::putIntegerArray( const std::string& key, const int * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (int *)NULL); + TBOX_ASSERT(data != 0); putSiloSimpleType(key, data, nelements, DB_INT); } @@ -1191,7 +1197,7 @@ SiloDatabase::putIntegerArray( /* ************************************************************************ * - * Two routines to get integer arrays from the database with the + * Two routines to get integer vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a integer type. @@ -1199,21 +1205,21 @@ SiloDatabase::putIntegerArray( ************************************************************************ */ -Array -SiloDatabase::getIntegerArray( +std::vector +SiloDatabase::getIntegerVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isInteger(key)) { - TBOX_ERROR("SiloDatabase::getIntegerArray() error in database " + TBOX_ERROR("SiloDatabase::getIntegerVector() error in database " << d_database_name << std::endl << " Key = " << key << " is not a integer array." << std::endl); } - Array intArray(getSiloSimpleTypeLength(key)); + std::vector intArray(getSiloSimpleTypeLength(key)); - getSiloSimpleType(key, intArray.getPointer()); + getSiloSimpleType(key, &intArray[0]); return intArray; } @@ -1246,7 +1252,7 @@ SiloDatabase::isString( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - if (ca != NULL) { + if (ca != 0) { if (ca->datatype == DB_CHAR) { is_type = true; } @@ -1271,18 +1277,18 @@ void SiloDatabase::putStringArray( const std::string& key, const std::string * const data, - const int nelements) + const size_t nelements) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (std::string *)NULL); + TBOX_ASSERT(data != 0); std::vector strings(nelements); const char* elemnames[nelements]; std::string values; int elemlengths[nelements]; - for (int i = 0; i < nelements; i++) { - strings[i] = Utilities::intToString(i); + for (size_t i = 0; i < nelements; ++i) { + strings[i] = Utilities::sizetToString(i); elemnames[i] = strings[i].c_str(); elemlengths[i] = static_cast(data[i].size()); values.append(data[i]); @@ -1303,9 +1309,9 @@ SiloDatabase::putStringArray( DBPutCompoundarray(d_file, path.c_str(), const_cast(elemnames), elemlengths, - nelements, const_cast(values.c_str()), + static_cast(nelements), const_cast(values.c_str()), static_cast(values.size() + 1), - DB_CHAR, NULL); + DB_CHAR, 0); if (err < 0) { TBOX_ERROR( "SiloDatabase DBPutCompoundarray failed " << d_directory @@ -1317,7 +1323,7 @@ SiloDatabase::putStringArray( /* ************************************************************************ * - * Two routines to get string arrays from the database with the + * Two routines to get string vectors and arrays from the database with the * specified key name. In any case, an error message is printed and * the program exits if the specified key does not exist in the * database or is not associated with a string type. @@ -1325,14 +1331,14 @@ SiloDatabase::putStringArray( ************************************************************************ */ -Array -SiloDatabase::getStringArray( +std::vector +SiloDatabase::getStringVector( const std::string& key) { TBOX_ASSERT(!key.empty()); if (!isString(key)) { - TBOX_ERROR("SiloDatabase::getStringArray() error in database " + TBOX_ERROR("SiloDatabase::getStringVector() error in database " << d_database_name << std::endl << " Key = " << key << " is not a string array." << std::endl); } @@ -1342,12 +1348,12 @@ SiloDatabase::getStringArray( DBcompoundarray* ca = DBGetCompoundarray(d_file, path.c_str()); - Array stringArray(ca->nelems); + std::vector stringArray(ca->nelems); std::string values = static_cast(ca->values); std::string::size_type start = 0; - for (int i = 0; i < ca->nelems; i++) { + for (int i = 0; i < ca->nelems; ++i) { stringArray[i] = values.substr(start, ca->elemlengths[i]); start = start + ca->elemlengths[i]; } @@ -1372,9 +1378,9 @@ SiloDatabase::printClassData( std::ostream& os) { - Array keys = getAllKeys(); + std::vector keys = getAllKeys(); - if (keys.getSize() == 0) { + if (keys.size() == 0) { os << "Database named `" << d_database_name << "' has zero keys..." << std::endl; } else { @@ -1382,7 +1388,7 @@ SiloDatabase::printClassData( << d_database_name << "'..." << std::endl; } - for (int i = 0; i < keys.getSize(); i++) { + for (int i = 0; i < static_cast(keys.size()); ++i) { switch (getArrayType(keys[i])) { case Database::SAMRAI_INVALID: { os << " Data entry `" << keys[i] << "' is" @@ -1493,11 +1499,11 @@ bool SiloDatabase::putSiloSimpleType( const std::string& key, const void* data, - const int nelements, + const size_t nelements, const int simple_type) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != (float *)NULL); + TBOX_ASSERT(data != 0); int err; @@ -1505,7 +1511,7 @@ SiloDatabase::putSiloSimpleType( path = nameMangle(path); int dims[1]; - dims[0] = nelements; + dims[0] = static_cast(nelements); err = DBWrite(d_file, path.c_str(), const_cast(data), dims, 1, simple_type); @@ -1522,7 +1528,7 @@ SiloDatabase::getSiloSimpleType( void* data) { TBOX_ASSERT(!key.empty()); - TBOX_ASSERT(data != NULL); + TBOX_ASSERT(data != 0); int err; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.h index 503110eb..dcdf11b2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabase.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A database structure that stores Silo format data. * ************************************************************************/ @@ -21,14 +21,13 @@ #ifdef HAVE_SILO #include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/PIO.h" #include "silo.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -41,7 +40,7 @@ namespace tbox { * It is assumed that all processors will access the database in the same * manner. Error reporting is done using the SAMRAI error reporting macros. * - * @see tbox::Database + * @see Database */ class SiloDatabase:public Database @@ -52,13 +51,17 @@ class SiloDatabase:public Database * specified name. By default the database will not be associated * with a file until it is mounted, using the mount() member function. * - * When assertion checking is active, the name string must be non-empty. + * @pre !name.empty */ explicit SiloDatabase( const std::string& name); /** * Constructor used to create sub-databases. + * + * @pre !name.empty() + * @pre file != 0 + * @pre !directory.empty() */ SiloDatabase( const std::string& name, @@ -75,19 +78,21 @@ class SiloDatabase:public Database * Return true if the specified key exists in the database * and false otherwise. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ virtual bool keyExists( const std::string& key); /** - * Return an array of all keys in the current database. Note that + * Return a vector of all keys in the current database. Note that * no keys from subdatabases contained in the current database * will appear in the array. To get the keys of any other * database, you must call this routine for that database. + * + * @pre hasDirectory() */ - virtual Array + virtual std::vector getAllKeys(); /** @@ -96,6 +101,8 @@ class SiloDatabase:public Database * If the key does not exist, then INVALID is returned * * @param key Key name in database. + * + * @pre !key.empty() */ virtual enum DataType getArrayType( @@ -105,16 +112,18 @@ class SiloDatabase:public Database * Return the size of the array associated with the key. If the key * does not exist, then zero is returned. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ - virtual int + virtual size_t getArraySize( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a database entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a database entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isDatabase( @@ -125,7 +134,7 @@ class SiloDatabase:public Database * pointer to it. A new group with the key name is also created * in the data file. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ virtual boost::shared_ptr putDatabase( @@ -136,7 +145,8 @@ class SiloDatabase:public Database * key does not represent a database entry in the database, then * an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isDatabase(key) */ virtual boost::shared_ptr getDatabase( @@ -144,8 +154,10 @@ class SiloDatabase:public Database /** * Return true or false depending on whether the specified key - * represents a boolean entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a boolean entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isBool( @@ -155,30 +167,36 @@ class SiloDatabase:public Database * Create a boolean array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putBoolArray( const std::string& key, const bool * const data, - const int nelements); + const size_t nelements); /** * Get a boolean entry from the database with the specified key * name. If the specified key does not exist in the database or - * is not a boolean array, then an error message is printed and + * is not a boolean vector, then an error message is printed and * the program exits. * * @param key Key name in database. + * + * @pre !key.empty() + * @pre isBool(key) */ - virtual Array - getBoolArray( + virtual std::vector + getBoolVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a box entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a box entry. If the key does not exist, then false + * is returned. + * + * @pre !key.empty() */ virtual bool isDatabaseBox( @@ -188,29 +206,32 @@ class SiloDatabase:public Database * Create a box array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putDatabaseBoxArray( const std::string& key, const DatabaseBox * const data, - const int nelements); + const size_t nelements); /** * Get a box entry from the database with the specified key * name. If the specified key does not exist in the database, * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() */ - virtual Array - getDatabaseBoxArray( + virtual std::vector + getDatabaseBoxVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a char entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a char entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isChar( @@ -220,29 +241,33 @@ class SiloDatabase:public Database * Create a character array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putCharArray( const std::string& key, const char * const data, - const int nelements); + const size_t nelements); /** * Get a character entry from the database with the specified key * name. If the specified key does not exist in the database, * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isChar(key) */ - virtual Array - getCharArray( + virtual std::vector + getCharVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a complex entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a complex entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isComplex( @@ -252,29 +277,33 @@ class SiloDatabase:public Database * Create a complex array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putComplexArray( const std::string& key, const dcomplex * const data, - const int nelements); + const size_t nelements); /** * Get a complex entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isComplex(key) */ - virtual Array - getComplexArray( + virtual std::vector + getComplexVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a double entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a double entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isDouble( @@ -284,29 +313,33 @@ class SiloDatabase:public Database * Create a double array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putDoubleArray( const std::string& key, const double * const data, - const int nelements); + const size_t nelements); /** * Get a double entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isDouble(key) */ - virtual Array - getDoubleArray( + virtual std::vector + getDoubleVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a float entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a float entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isFloat( @@ -316,29 +349,33 @@ class SiloDatabase:public Database * Create a float array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putFloatArray( const std::string& key, const float * const data, - const int nelements); + const size_t nelements); /** * Get a float entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isFloat(key) */ - virtual Array - getFloatArray( + virtual std::vector + getFloatVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents an integer entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents an integer entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isInteger( @@ -348,29 +385,33 @@ class SiloDatabase:public Database * Create an integer array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putIntegerArray( const std::string& key, const int * const data, - const int nelements); + const size_t nelements); /** * Get an integer entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isInteger(key) */ - virtual Array - getIntegerArray( + virtual std::vector + getIntegerVector( const std::string& key); /** * Return true or false depending on whether the specified key - * represents a string entry. If the key does not exist or if - * the string is empty, then false is returned. + * represents a string entry. If the key does not exist, then + * false is returned. + * + * @pre !key.empty() */ virtual bool isString( @@ -380,30 +421,33 @@ class SiloDatabase:public Database * Create a string array entry in the database with the specified * key name. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre data != 0 */ virtual void putStringArray( const std::string& key, const std::string * const data, - const int nelements); + const size_t nelements); /** * Get a string entry from the database with the specified key * name. If the specified key does not exist in the database * then an error message is printed and the program exits. * - * When assertion checking is active, the key string must be non-empty. + * @pre !key.empty() + * @pre isString(key) */ - virtual Array - getStringArray( + virtual std::vector + getStringVector( const std::string& key); /** * @brief Returns the name of this database. * - * The name for the root of the database is the name supplied when creating it. - * Names for nested databases are the keyname of the database. + * The name for the root of the database is the name supplied + * when creating it. Names for nested databases are the keyname + * of the database. * */ virtual std::string @@ -426,6 +470,8 @@ class SiloDatabase:public Database * Returns true if successful. * * @param name name of database. Normally a filename. + * + * @pre !name.empty() */ virtual bool create( @@ -441,6 +487,8 @@ class SiloDatabase:public Database * @param read_write_mode Open the database in read-write * mode instead of read-only mode. NOTE: This class currently * does not support read-only mode, so this flag must be true. + * + * @pre !name.empty() */ virtual bool open( @@ -458,10 +506,12 @@ class SiloDatabase:public Database * the Silo file. * * Returns true if attach was successful. + * + * @pre file != 0 */ virtual bool attachToFile( - DBfile * file, + DBfile* file, const std::string& directory); /** @@ -475,10 +525,17 @@ class SiloDatabase:public Database virtual bool close(); + bool + hasDirectory() + { + return !d_directory.empty(); + } + using Database::putBoolArray; using Database::getBoolArray; using Database::putDatabaseBoxArray; using Database::getDatabaseBoxArray; + using Database::getDatabaseBoxVector; using Database::putCharArray; using Database::getCharArray; using Database::putComplexArray; @@ -493,11 +550,12 @@ class SiloDatabase:public Database using Database::getStringArray; private: + SiloDatabase(); // not implemented SiloDatabase( const SiloDatabase&); // not implemented - void + SiloDatabase& operator = ( - const SiloDatabase&); // not implemented + const SiloDatabase&); // not implemented bool isSiloType( @@ -513,7 +571,7 @@ class SiloDatabase:public Database putSiloSimpleType( const std::string& key, const void* data, - const int nelements, + const size_t nelements, const int simple_type); bool @@ -526,18 +584,18 @@ class SiloDatabase:public Database const std::string& key); /*! - * @brief Convert/mangle SAMRAI name into characters acceptable to SILO naming conventions. - * - * SILO only supports alphanumeric and "_" as valid characters in names. Other characters - * are allowed by SAMRAI (such as " " and "-") so they are converted to a mangled - * representation for SILO. + * @brief Convert/mangle SAMRAI name into characters acceptable to SILO + * naming conventions. SILO only supports alphanumeric and "_" as valid + * characters in names. Other characters are allowed by SAMRAI (such as + * " " and "-") so they are converted to a mangled representation for SILO. */ std::string nameMangle( std::string name); /*! - * @brief Convert/unmangle SILO name with possible mangled characters back to SAMRAI name. + * @brief Convert/unmangle SILO name with possible mangled characters back + * to SAMRAI name. */ std::string nameDemangle( diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.C index 2c35372e..ef682056 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.C @@ -3,20 +3,43 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A factory for building SiloDatabases * ************************************************************************/ #include "SAMRAI/tbox/SiloDatabaseFactory.h" #include "SAMRAI/tbox/SiloDatabase.h" +#include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace tbox { -#ifdef HAVE_SILO +SiloDatabaseFactory::SiloDatabaseFactory() +{ +} + +SiloDatabaseFactory::~SiloDatabaseFactory() +{ +} + +SiloDatabaseFactory::SiloDatabaseFactory( + const SiloDatabaseFactory& other): + DatabaseFactory() +{ + NULL_USE(other); +} + +SiloDatabaseFactory& +SiloDatabaseFactory::operator = ( + const SiloDatabaseFactory& rhs) +{ + NULL_USE(rhs); + return *this; +} + /** * Build a new SiloDatabase object. */ @@ -27,11 +50,13 @@ SiloDatabaseFactory::allocate( return boost::make_shared(name); #else - return NULL; + NULL_USE(name); + TBOX_WARNING("Silo5DatabaseFactory: Cannot allocate a SiloDatabase.\n" + << "SAMRAI was not configured with Silo." << std::endl); + return boost::shared_ptr(); #endif } -#endif } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.h index afb00fa5..066ebcaf 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/SiloDatabaseFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A factory for building SiloDatabases * ************************************************************************/ @@ -25,6 +25,30 @@ namespace tbox { */ class SiloDatabaseFactory:public DatabaseFactory { +public: + /** + * Default constructor. + */ + SiloDatabaseFactory(); + + /** + * Copy constructor. + */ + SiloDatabaseFactory( + const SiloDatabaseFactory& other); + + /** + * Assignment operator. + */ + SiloDatabaseFactory& + operator = ( + const SiloDatabaseFactory& rhs); + + /** + * Destructor. + */ + ~SiloDatabaseFactory(); + /** * Build a new Database object. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.C index 564f6752..6a641c3d 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Registry of shutdown routines to be called at program exit * ************************************************************************/ @@ -39,8 +39,7 @@ void StartupShutdownManager::registerHandler( AbstractHandler* handler) { -#ifdef DEBUG_CHECK_ASSERTIONS - assert(handler); + TBOX_ASSERT(handler); // Don't allow registering handlers when we are looping and the // handler needs to be called in that loop. This would create the @@ -49,11 +48,10 @@ StartupShutdownManager::registerHandler( // // SGS Ideally this would not be needed and maybe with some // additional work this could be made more clean. - assert(!(s_in_initialize && handler->hasInitialize())); - assert(!(s_in_startup && handler->hasStartup())); - assert(!(s_in_shutdown && handler->hasShutdown())); - assert(!s_in_finalize); -#endif + TBOX_ASSERT(!(s_in_initialize && handler->hasInitialize())); + TBOX_ASSERT(!(s_in_startup && handler->hasStartup())); + TBOX_ASSERT(!(s_in_shutdown && handler->hasShutdown())); + TBOX_ASSERT(!s_in_finalize); if (!s_singleton_initialized) { setupSingleton(); @@ -64,22 +62,20 @@ StartupShutdownManager::registerHandler( unsigned char priority = handler->getPriority(); - item->next = (ListElement *)NULL; + item->next = 0; if (s_num_manager_items[priority] == 0) { s_manager_list[priority] = item; } else { s_manager_list_last[priority]->next = item; } s_manager_list_last[priority] = item; - s_num_manager_items[priority]++; + ++s_num_manager_items[priority]; } void StartupShutdownManager::initialize() { -#ifdef DEBUG_CHECK_ASSERTIONS - assert(!s_initialized); -#endif + TBOX_ASSERT(!s_initialized); s_initialized = true; // only shutdown if something was registered @@ -106,12 +102,10 @@ StartupShutdownManager::initialize() void StartupShutdownManager::startup() { -#ifdef DEBUG_CHECK_ASSERTIONS // If this is thrown you need to make sure SAMRAIManger::initialize // is called before startup. - assert(s_initialized); - assert(!s_startuped); -#endif + TBOX_ASSERT(s_initialized); + TBOX_ASSERT(!s_startuped); s_startuped = true; @@ -140,11 +134,9 @@ StartupShutdownManager::startup() void StartupShutdownManager::shutdown() { -#ifdef DEBUG_CHECK_ASSERTIONS - assert(s_initialized); - assert(s_startuped); - assert(!s_shutdowned); -#endif + TBOX_ASSERT(s_initialized); + TBOX_ASSERT(s_startuped); + TBOX_ASSERT(!s_shutdowned); s_shutdowned = true; @@ -154,7 +146,7 @@ StartupShutdownManager::shutdown() for (int priority = s_number_of_priorities - 1; priority > -1; - priority--) { + --priority) { ListElement* item = s_manager_list[priority]; while (item) { if (item->handler) { @@ -173,9 +165,9 @@ StartupShutdownManager::shutdown() void StartupShutdownManager::setupSingleton() { - for (int priority = s_number_of_priorities - 1; priority > -1; priority--) { - s_manager_list[priority] = (ListElement *)NULL; - s_manager_list_last[priority] = (ListElement *)NULL; + for (int priority = s_number_of_priorities - 1; priority > -1; --priority) { + s_manager_list[priority] = 0; + s_manager_list_last[priority] = 0; s_num_manager_items[priority] = 0; } @@ -185,12 +177,9 @@ StartupShutdownManager::setupSingleton() void StartupShutdownManager::finalize() { - -#ifdef DEBUG_CHECK_ASSERTIONS - assert(s_initialized); - assert(s_shutdowned); - assert(!s_finalized); -#endif + TBOX_ASSERT(s_initialized); + TBOX_ASSERT(s_shutdowned); + TBOX_ASSERT(!s_finalized); s_finalized = true; @@ -200,7 +189,7 @@ StartupShutdownManager::finalize() for (int priority = s_number_of_priorities - 1; priority > -1; - priority--) { + --priority) { ListElement* item = s_manager_list[priority]; while (item) { if (item->handler) { @@ -227,11 +216,11 @@ StartupShutdownManager::finalize() s_initialized = false; } -StartupShutdownManager::AbstractHandler::~AbstractHandler() +StartupShutdownManager::AbstractHandler::AbstractHandler() { } -StartupShutdownManager::Handler::Handler() +StartupShutdownManager::AbstractHandler::~AbstractHandler() { } @@ -322,5 +311,9 @@ StartupShutdownManager::ListElement::ListElement(): { } +StartupShutdownManager::ListElement::~ListElement() +{ +} + } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.h index 51e2d29b..17343ba8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StartupShutdownManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager for startup and shutdown routines to be called at program start and exit * ************************************************************************/ @@ -65,6 +65,11 @@ class StartupShutdownManager { public: + /*! + * @brief Default constructor. + */ + AbstractHandler(); + /*! * @brief Virtual destructor since class has virtual methods. */ @@ -139,6 +144,16 @@ class StartupShutdownManager */ virtual bool hasFinalize() = 0; + +private: + // Unimplemented copy constructor. + AbstractHandler( + const AbstractHandler& other); + + // Unimplemented assignment operator. + AbstractHandler& + operator = ( + const AbstractHandler& rhs); }; /*! @@ -192,8 +207,6 @@ class StartupShutdownManager * time we are not aware of a method to invoke a block of code only * once for a template class. * - * TODO: Should implemenation be moved out of the header? - * */ class Handler:public AbstractHandler { @@ -213,10 +226,10 @@ class StartupShutdownManager * */ Handler( - void(*initialize)(), - void(*startup)(), - void(*shutdown)(), - void(*finalize)(), + void(* initialize)(), + void(* startup)(), + void(* shutdown)(), + void(* finalize)(), unsigned char priority); /*! @@ -279,13 +292,18 @@ class StartupShutdownManager hasFinalize(); private: - /*! - * @brief Default constructor is private. - * - * TODO: Should this be unimplemented? - */ + // Unimplemented default constructor. Handler(); + // Unimplemented copy constructor. + Handler( + const Handler& other); + + // Unimplemented assignment operator. + Handler& + operator = ( + const Handler& rhs); + /*! * @brief Initialize function. */ @@ -345,7 +363,7 @@ class StartupShutdownManager */ static void registerHandler( - AbstractHandler* handler); + AbstractHandler * handler); /*! * @brief Invoke the registered initialization handlers. @@ -402,6 +420,18 @@ class StartupShutdownManager static const unsigned char priorityVariables = 100; private: + // Unimplemented default constructor. + StartupShutdownManager(); + + // Unimplemented copy constructor. + StartupShutdownManager( + const StartupShutdownManager& other); + + // Unimplemented default constructor. + StartupShutdownManager& + operator = ( + const StartupShutdownManager& rhs); + /*! * @brief Sets up the StartupShutdownManager singleton. */ @@ -410,8 +440,6 @@ class StartupShutdownManager /*! * @brief Used to maintain a list of registered handlers. - * - * TODO: Should implementation be pulled out of header? */ class ListElement { @@ -422,6 +450,20 @@ class StartupShutdownManager */ ListElement(); + // Unimplemented copy constructor. + ListElement( + const ListElement& other); + + // Unimplemented assignment operator. + ListElement& + operator = ( + const ListElement& rhs); + + /*! + * @brief Destructor. + */ + ~ListElement(); + /*! * @brief A registered handler being stored in a list. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.C index def633c7..aa7843cd 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction structure for statistic data copies * ************************************************************************/ @@ -24,7 +24,7 @@ namespace tbox { StatTransaction::StatTransaction( const boost::shared_ptr& stat, int src_proc_id, - int dst_proc_id) : + int dst_proc_id): d_stat(stat), d_src_id(src_proc_id), d_dst_id(dst_proc_id) diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.h index 3517e79e..84075d51 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/StatTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction structure for statistic data copies * ************************************************************************/ @@ -16,7 +16,7 @@ #include "SAMRAI/tbox/Statistic.h" #include "SAMRAI/tbox/Transaction.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -27,8 +27,8 @@ namespace tbox { * transaction between two processors for sending and gathering statistic * information generated on different processors. * - * @see tbox::Schedule - * @see tbox::Transaction + * @see Schedule + * @see Transaction */ class StatTransaction:public Transaction @@ -125,9 +125,10 @@ class StatTransaction:public Transaction std::ostream& stream) const; private: + StatTransaction(); // not implemented StatTransaction( const StatTransaction&); // not implemented - void + StatTransaction& operator = ( const StatTransaction&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.C index 3144b4bc..5a1f5a99 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.C @@ -3,14 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class to record statistics during program execution. * ************************************************************************/ #include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/Utilities.h" @@ -61,8 +60,7 @@ Statistic::Statistic( if (stat_type == "PROC_STAT") { d_stat_type = PROC_STAT; - } - if (stat_type == "PATCH_STAT") { + } else if (stat_type == "PATCH_STAT") { d_stat_type = PATCH_STAT; } @@ -91,7 +89,7 @@ Statistic::recordProcStat( double value, int seq_num) { - if (d_stat_type != PROC_STAT) { + if (getType() != "PROC_STAT") { TBOX_ERROR("Statistic::recordProcStat error...\n" << " Statistic type is `PATCH_STAT'" << std::endl); } @@ -121,7 +119,7 @@ Statistic::recordProcStat( d_seq_counter = seq_num; d_proc_array[d_seq_counter].value = value; } - d_seq_counter++; + ++d_seq_counter; } void @@ -130,7 +128,7 @@ Statistic::recordPatchStat( double value, int seq_num) { - if (d_stat_type != PATCH_STAT) { + if (getType() != "PATCH_STAT") { TBOX_ERROR("Statistic::recordPatchStat error...\n" << " Statistic type is `PROC_STAT'" << std::endl); } @@ -169,7 +167,7 @@ Statistic::recordPatchStat( d_patch_array[seq_num].patch_records; bool found_patch_id = false; std::list::iterator ir = records.begin(); - for ( ; ir != records.end(); ir++) { + for ( ; ir != records.end(); ++ir) { if (ir->patch_id == patch_num) { ir->value = value; found_patch_id = true; @@ -180,7 +178,7 @@ Statistic::recordPatchStat( patchitem_record.value = value; patchitem_record.patch_id = patch_num; d_patch_array[seq_num].patch_records.push_back(patchitem_record); - d_total_patch_entries++; + ++d_total_patch_entries; } } @@ -190,7 +188,7 @@ Statistic::recordPatchStat( patchitem_record.value = value; patchitem_record.patch_id = patch_num; d_patch_array[seq_num].patch_records.push_back(patchitem_record); - d_total_patch_entries++; + ++d_total_patch_entries; d_seq_counter = seq_num + 1; } @@ -216,10 +214,10 @@ Statistic::recordPatchStat( ************************************************************************* */ -int +size_t Statistic::getDataStreamSize() { - int byte_size = MessageStream::getSizeof(4); + size_t byte_size = MessageStream::getSizeof(4); if (d_stat_type == PROC_STAT) { byte_size += MessageStream::getSizeof(d_seq_counter); } else { // d_stat_type == PATCH_STAT @@ -249,8 +247,8 @@ Statistic::packStream( num_int += d_seq_counter + d_total_patch_entries; num_double = d_total_patch_entries; } - Array idata(num_int); - Array ddata(num_double); + std::vector idata(num_int); + std::vector ddata(num_double); idata[0] = mpi.getRank(); idata[1] = d_instance_id; @@ -260,7 +258,7 @@ Statistic::packStream( int is = 0; if (d_stat_type == PROC_STAT) { - for (is = 0; is < d_seq_counter; is++) { + for (is = 0; is < d_seq_counter; ++is) { ddata[is] = d_proc_array[is].value; } @@ -269,25 +267,25 @@ Statistic::packStream( int mark = 4 + d_seq_counter; int isr = 0; - for (is = 0; is < d_seq_counter; is++) { + for (is = 0; is < d_seq_counter; ++is) { std::list& lrec = d_patch_array[is].patch_records; idata[4 + is] = static_cast(lrec.size()); std::list::iterator ilr = lrec.begin(); - for ( ; ilr != lrec.end(); ilr++) { + for ( ; ilr != lrec.end(); ++ilr) { idata[mark + isr] = ilr->patch_id; ddata[isr] = ilr->value; - isr++; + ++isr; } } } if (num_int > 0) { - stream.pack(idata.getPointer(), num_int); + stream.pack(&idata[0], num_int); } if (num_double > 0) { - stream.pack(ddata.getPointer(), num_double); + stream.pack(&ddata[0], num_double); } } @@ -325,11 +323,11 @@ Statistic::unpackStream( int is; if (d_stat_type == PROC_STAT) { - Array ddata(seq_len); + std::vector ddata(seq_len); if (seq_len > 0) { - stream.unpack(ddata.getPointer(), seq_len); - for (is = 0; is < seq_len; is++) { + stream.unpack(&ddata[0], seq_len); + for (is = 0; is < seq_len; ++is) { recordProcStat(ddata[is], is); } } @@ -337,25 +335,25 @@ Statistic::unpackStream( } else { // d_stat_type == PATCH_STAT if (seq_len > 0) { - Array inum_patches_data(seq_len); - stream.unpack(inum_patches_data.getPointer(), seq_len); + std::vector inum_patches_data(seq_len); + stream.unpack(&inum_patches_data[0], seq_len); int total_seq_items = 0; - for (is = 0; is < seq_len; is++) { + for (is = 0; is < seq_len; ++is) { total_seq_items += inum_patches_data[is]; } - Array ipatch_num_data(total_seq_items); - Array ddata(total_seq_items); + std::vector ipatch_num_data(total_seq_items); + std::vector ddata(total_seq_items); - stream.unpack(ipatch_num_data.getPointer(), total_seq_items); - stream.unpack(ddata.getPointer(), total_seq_items); + stream.unpack(&ipatch_num_data[0], total_seq_items); + stream.unpack(&ddata[0], total_seq_items); int isr = 0; - for (is = 0; is < seq_len; is++) { - for (int ipsr = 0; ipsr < inum_patches_data[is]; ipsr++) { + for (is = 0; is < seq_len; ++is) { + for (int ipsr = 0; ipsr < inum_patches_data[is]; ++ipsr) { recordPatchStat(ipatch_num_data[isr], ddata[isr], is); - isr++; + ++isr; } } } @@ -380,20 +378,20 @@ Statistic::printClassData( int is = 0; if (d_stat_type == PROC_STAT) { - for (is = 0; is < d_seq_counter; is++) { + for (is = 0; is < d_seq_counter; ++is) { stream << " sequence[" << is << "] : value = " << d_proc_array[is].value << std::endl; } } else { - for (is = 0; is < d_seq_counter; is++) { + for (is = 0; is < d_seq_counter; ++is) { stream << " sequence[" << is << "]" << std::endl; - const std::list& psrl = + const std::list& psrl = d_patch_array[is].patch_records; std::list::const_iterator ilr = psrl.begin(); - for ( ; ilr != psrl.end(); ilr++) { + for ( ; ilr != psrl.end(); ++ilr) { stream << " patch # = " << ilr->patch_id << " : value = " << ilr->value << std::endl; } @@ -417,8 +415,8 @@ Statistic::checkArraySizes( if (high_mark >= d_proc_stat_array_size) { int old_array_size = d_proc_stat_array_size; d_proc_stat_array_size += ARRAY_INCREMENT; - d_proc_array.resizeArray(d_proc_stat_array_size); - for (int i = old_array_size; i < d_proc_stat_array_size; i++) { + d_proc_array.resize(d_proc_stat_array_size); + for (int i = old_array_size; i < d_proc_stat_array_size; ++i) { d_proc_array[i].value = s_empty_seq_tag_entry; } @@ -428,7 +426,7 @@ Statistic::checkArraySizes( if (high_mark >= d_patch_stat_array_size) { d_patch_stat_array_size += ARRAY_INCREMENT; - d_patch_array.resizeArray(d_patch_stat_array_size); + d_patch_array.resize(d_patch_stat_array_size); } } @@ -436,60 +434,59 @@ Statistic::checkArraySizes( } void -Statistic::putUnregisteredToDatabase( - const boost::shared_ptr& db) const +Statistic::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("TBOX_STATISTIC_VERSION", - TBOX_STATISTIC_VERSION); + restart_db->putInteger("TBOX_STATISTIC_VERSION", TBOX_STATISTIC_VERSION); - db->putString("object_name", d_object_name); - db->putInteger("stat_type", d_stat_type); - db->putInteger("instance_id", d_instance_id); - db->putInteger("seq_counter", d_seq_counter); - db->putInteger("total_patch_entries", d_total_patch_entries); - db->putInteger("proc_stat_array_size", d_proc_stat_array_size); - db->putInteger("patch_stat_array_size", d_patch_stat_array_size); + restart_db->putString("object_name", d_object_name); + restart_db->putInteger("stat_type", d_stat_type); + restart_db->putInteger("instance_id", d_instance_id); + restart_db->putInteger("seq_counter", d_seq_counter); + restart_db->putInteger("total_patch_entries", d_total_patch_entries); + restart_db->putInteger("proc_stat_array_size", d_proc_stat_array_size); + restart_db->putInteger("patch_stat_array_size", d_patch_stat_array_size); int i; if (d_stat_type == PROC_STAT) { - Array ddata(d_seq_counter); - for (i = 0; i < d_seq_counter; i++) { + std::vector ddata(d_seq_counter); + for (i = 0; i < d_seq_counter; ++i) { ddata[i] = d_proc_array[i].value; } if (d_seq_counter > 0) { - db->putDoubleArray("ddata", ddata); + restart_db->putDoubleVector("ddata", ddata); } } if (d_stat_type == PATCH_STAT) { - Array idata(d_seq_counter + d_total_patch_entries); - Array ddata(d_total_patch_entries); + std::vector idata(d_seq_counter + d_total_patch_entries); + std::vector ddata(d_total_patch_entries); int il = 0; int mark = d_seq_counter; - for (i = 0; i < d_seq_counter; i++) { + for (i = 0; i < d_seq_counter; ++i) { const std::list& records = d_patch_array[i].patch_records; idata[i] = static_cast(records.size()); // # patches at seq num std::list::const_iterator ir = records.begin(); - for ( ; ir != records.end(); ir++) { + for ( ; ir != records.end(); ++ir) { idata[mark + il] = ir->patch_id; ddata[il] = ir->value; - il++; + ++il; } } if (d_seq_counter > 0) { - db->putIntegerArray("idata", idata); + restart_db->putIntegerVector("idata", idata); if (d_total_patch_entries > 0) { - db->putDoubleArray("ddata", ddata); + restart_db->putDoubleVector("ddata", ddata); } } } @@ -497,31 +494,31 @@ Statistic::putUnregisteredToDatabase( void Statistic::getFromRestart( - const boost::shared_ptr& db) + const boost::shared_ptr& restart_db) { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - int ver = db->getInteger("TBOX_STATISTIC_VERSION"); + int ver = restart_db->getInteger("TBOX_STATISTIC_VERSION"); if (ver != TBOX_STATISTIC_VERSION) { TBOX_ERROR("Restart file version different than class version."); } - d_object_name = db->getString("object_name"); - d_stat_type = db->getInteger("stat_type"); - d_instance_id = db->getInteger("instance_id"); - int seq_entries = db->getInteger("seq_counter"); - int total_patches = db->getInteger("total_patch_entries"); - d_proc_stat_array_size = db->getInteger("proc_stat_array_size"); - d_patch_stat_array_size = db->getInteger("patch_stat_array_size"); + d_object_name = restart_db->getString("object_name"); + d_stat_type = restart_db->getInteger("stat_type"); + d_instance_id = restart_db->getInteger("instance_id"); + int seq_entries = restart_db->getInteger("seq_counter"); + int total_patches = restart_db->getInteger("total_patch_entries"); + d_proc_stat_array_size = restart_db->getInteger("proc_stat_array_size"); + d_patch_stat_array_size = restart_db->getInteger("patch_stat_array_size"); - d_proc_array.resizeArray(d_proc_stat_array_size); - d_patch_array.resizeArray(d_patch_stat_array_size); + d_proc_array.resize(d_proc_stat_array_size); + d_patch_array.resize(d_patch_stat_array_size); int i; if (d_stat_type == PROC_STAT) { if (seq_entries > 0) { - Array ddata = db->getDoubleArray("ddata"); - for (i = 0; i < seq_entries; i++) { + std::vector ddata = restart_db->getDoubleVector("ddata"); + for (i = 0; i < seq_entries; ++i) { recordProcStat(ddata[i], i); } } @@ -529,24 +526,24 @@ Statistic::getFromRestart( if (d_stat_type == PATCH_STAT) { if (seq_entries > 0) { - Array idata = db->getIntegerArray("idata"); + std::vector idata = restart_db->getIntegerVector("idata"); - Array inum_patches(seq_entries); - for (i = 0; i < seq_entries; i++) { + std::vector inum_patches(seq_entries); + for (i = 0; i < seq_entries; ++i) { inum_patches[i] = idata[i]; } if (total_patches > 0) { - Array ddata = db->getDoubleArray("ddata"); + std::vector ddata = restart_db->getDoubleVector("ddata"); int il = 0; int mark = seq_entries; - for (i = 0; i < seq_entries; i++) { - for (int ipsr = 0; ipsr < inum_patches[i]; ipsr++) { + for (i = 0; i < seq_entries; ++i) { + for (int ipsr = 0; ipsr < inum_patches[i]; ++ipsr) { int patch_num = idata[mark + il]; double val = ddata[il]; recordPatchStat(patch_num, val, i); - il++; + ++il; } } } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.h index 60d5737d..f54d6ee5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistic.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class to record statistics during program execution. * ************************************************************************/ @@ -14,7 +14,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/MessageStream.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include @@ -71,7 +70,7 @@ class Statistician; * on level zero, level 1, etc. In this case, one can cimply create a * separate statistic object for each level. * - * @see tbox::Statistician + * @see Statistician */ class Statistic @@ -136,9 +135,9 @@ class Statistic * Record double processor statistic value. The optional sequence number * argument identifies where in timestep sequence the value should be. * If the sequence number is not specified, an internal counter will - * determine the appropriate sequence number. When assertion checking - * is active, an unrecoverable assertion will result if this function - * is called and "PATCH_STAT" was specified in the constructor. + * determine the appropriate sequence number. + * + * @pre getType() == "PROC_STAT" */ void recordProcStat( @@ -151,9 +150,9 @@ class Statistic * argument identifies where in timestep sequence the value should be. * The sequence number MUST be explicitly specified because the number * of patches on each processor will generally be different at - * each sequence step. When assertion checking is active, an - * unrecoverable assertion will result if this function is called and - * "PROC_STAT" was specified in the constructor. + * each sequence step. + * + * @pre getType() == "PATCH_STAT" */ void recordPatchStat( @@ -173,14 +172,16 @@ class Statistic } /** - * Return integer number of bytes needed to stream the statistic data. + * Return number of bytes needed to stream the statistic data. * This is the amount needed by the stat transaction class. */ - int + size_t getDataStreamSize(); /** * Pack contents of statistic data structure into message stream. + * + * @pre SAMRAI_MPI::getSAMRAIWorld().getRank() != 0 */ void packStream( @@ -188,6 +189,8 @@ class Statistic /** * Unpack contents of statistic data structure from message stream. + * + * @pre SAMRAI_MPI::getSAMRAIWorld().getRank() == 0 */ void unpackStream( @@ -196,6 +199,8 @@ class Statistic /** * Print statistic data to given output stream. Floating point precision * can be specified (default is 12). + * + * @pre precision > 0 */ void printClassData( @@ -203,20 +208,23 @@ class Statistic int precision = 12) const; /** - * Write statistic data members to database. When assertion checking - * is on, the database pointer must be non-null. + * Write statistic data members to restart database. The restart_db pointer + * must be non-null. + * + * @pre restart_db */ void - putUnregisteredToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** - * Read restarted times from restart database. When assertion checking - * is on, the database pointer must be non-null. + * Read restarted times from restart database. + * + * @pre restart_db */ void getFromRestart( - const boost::shared_ptr& db); + const boost::shared_ptr& restart_db); /* * These structures are used to store statistic data entries. @@ -239,6 +247,11 @@ class Statistic /** * The constructor for the Statistic class sets the name string * and the statistic type for a statistic object. + * + * @pre !name.empty() + * @pre !stat_type.empty() + * @pre (stat_type == "PROC_STAT") || (stat_type = "PATCH_STAT") + * @pre instance_id > -1 */ Statistic( const std::string& name, @@ -248,7 +261,7 @@ class Statistic /** * Return const reference to list of processor records. */ - const Array& + const std::vector& getProcStatSeqArray() const { return d_proc_array; @@ -257,7 +270,7 @@ class Statistic /** * Return const reference to list of patch records. */ - const Array& + const std::vector& getPatchStatSeqArray() const { return d_patch_array; @@ -284,10 +297,11 @@ class Statistic checkArraySizes( int seq_num); - // The following two members are not implemented + // The following three members are not implemented + Statistic(); Statistic( const Statistic&); - void + Statistic& operator = ( const Statistic&); @@ -304,12 +318,12 @@ class Statistic int d_stat_type; // see STATISTIC_RECORD_TYPE above. /* - * Arrays of records. Note that one of these will always be empty. + * Vectors of records. Note that one of these will always be empty. * Integer sequence length refers to length of list corresponding * to stat type. */ - Array d_proc_array; - Array d_patch_array; + std::vector d_proc_array; + std::vector d_patch_array; /* * Sequence and patch counters (NOTE: patch counter use for patch stats diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.C index 7df9e596..709ee1ff 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton manager class for statistic objects. * ************************************************************************/ @@ -20,7 +20,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace tbox { @@ -28,7 +28,7 @@ namespace tbox { const int Statistician::DEFAULT_NUMBER_OF_TIMERS_INCREMENT = 128; const int StatisticRestartDatabase::TBOX_STATISTICRESTARTDATABASE_VERSION = 1; -Statistician * Statistician::s_statistician_instance = (Statistician *)NULL; +Statistician * Statistician::s_statistician_instance = 0; StartupShutdownManager::Handler Statistician::s_finalize_handler( @@ -46,16 +46,15 @@ Statistician::s_finalize_handler( ************************************************************************* */ -Statistician* +Statistician * Statistician::createStatistician( - bool register_for_restart, bool read_from_restart) { - makeStatisticianInstance(register_for_restart, read_from_restart); + makeStatisticianInstance(read_from_restart); return s_statistician_instance; } -Statistician* +Statistician * Statistician::getStatistician() { /* Should have instance constructed in initializeCallback */ @@ -116,7 +115,7 @@ Statistician::registerSingletonSubclassInstance( Statistician::Statistician(): d_has_gathered_stats(false) { - d_restart_database_instance = (StatisticRestartDatabase *)NULL; + d_restart_database_instance = 0; d_must_call_finalize = true; @@ -131,8 +130,8 @@ Statistician::~Statistician() { if (d_restart_database_instance) delete d_restart_database_instance; - d_proc_statistics.resizeArray(0); - d_patch_statistics.resizeArray(0); + d_proc_statistics.resize(0); + d_patch_statistics.resize(0); d_num_proc_stats = 0; d_num_patch_stats = 0; @@ -148,7 +147,6 @@ Statistician::~Statistician() void Statistician::makeStatisticianInstance( - bool register_for_restart, bool read_from_restart) { /* If reading from restart then force new instance @@ -161,19 +159,16 @@ Statistician::makeStatisticianInstance( if (!s_statistician_instance) { s_statistician_instance = new Statistician(); - s_statistician_instance->initRestartDatabase(register_for_restart, - read_from_restart); + s_statistician_instance->initRestartDatabase(read_from_restart); } } void Statistician::initRestartDatabase( - bool register_for_restart, bool read_from_restart) { d_restart_database_instance = new StatisticRestartDatabase("StatisticRestartDatabase", - register_for_restart, read_from_restart); } @@ -200,7 +195,7 @@ Statistician::getStatistic( if (stat_type == "PROC_STAT") { - for (int i = 0; i < d_num_proc_stats; i++) { + for (int i = 0; i < d_num_proc_stats; ++i) { if (d_proc_statistics[i]->getName() == name) { stat = d_proc_statistics[i]; found = true; @@ -217,13 +212,13 @@ Statistician::getStatistic( } stat.reset(new Statistic(name, stat_type, d_num_proc_stats)); d_proc_statistics[d_num_proc_stats] = stat; - d_num_proc_stats++; + ++d_num_proc_stats; d_must_call_finalize = true; } } else if (stat_type == "PATCH_STAT") { - for (int i = 0; i < d_num_patch_stats; i++) { + for (int i = 0; i < d_num_patch_stats; ++i) { if (d_patch_statistics[i]->getName() == name) { stat = d_patch_statistics[i]; found = true; @@ -240,7 +235,7 @@ Statistician::getStatistic( } stat.reset(new Statistic(name, stat_type, d_num_patch_stats)); d_patch_statistics[d_num_patch_stats] = stat; - d_num_patch_stats++; + ++d_num_patch_stats; d_must_call_finalize = true; } @@ -281,7 +276,7 @@ Statistician::checkProcStatExists( stat.reset(); bool stat_found = false; - for (int i = 0; i < d_num_proc_stats; i++) { + for (int i = 0; i < d_num_proc_stats; ++i) { if (d_proc_statistics[i]->getName() == name) { stat_found = true; stat = d_proc_statistics[i]; @@ -300,7 +295,7 @@ Statistician::checkPatchStatExists( stat.reset(); bool stat_found = false; - for (int i = 0; i < d_num_patch_stats; i++) { + for (int i = 0; i < d_num_patch_stats; ++i) { if (d_patch_statistics[i]->getName() == name) { stat_found = true; stat = d_patch_statistics[i]; @@ -314,7 +309,7 @@ Statistician::checkPatchStatExists( void Statistician::resetProcessorStatistics() { - for (int i = 0; i < d_num_proc_stats; i++) { + for (int i = 0; i < d_num_proc_stats; ++i) { d_proc_statistics[i]->reset(); } d_must_call_finalize = true; @@ -323,7 +318,7 @@ Statistician::resetProcessorStatistics() void Statistician::resetPatchStatistics() { - for (int i = 0; i < d_num_patch_stats; i++) { + for (int i = 0; i < d_num_patch_stats; ++i) { d_patch_statistics[i]->reset(); } d_must_call_finalize = true; @@ -381,13 +376,13 @@ Statistician::getGlobalProcStatSequenceLength( TBOX_ERROR("Statistician::getGlobalProcStatSeqLength ..." << "\n The finalize() method to construct global data " << "must be called with the argument to gather global " - << "stats data BEFORE this metho." << std::endl); + << "stats data BEFORE this method." << std::endl); } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_data.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_data.size())); - seq_len = d_global_proc_stat_data[proc_stat_id].getSize(); + seq_len = static_cast(d_global_proc_stat_data[proc_stat_id].size()); } return seq_len; @@ -419,9 +414,9 @@ Statistician::getGlobalProcStatValue( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_data.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_data[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_data[proc_stat_id].size())); TBOX_ASSERT(proc_num < mpi.getSize()); val = d_global_proc_stat_data[proc_stat_id][seq_num][proc_num]; @@ -448,9 +443,9 @@ Statistician::getGlobalProcStatSum( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_sum.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_sum.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_sum[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_sum[proc_stat_id].size())); sum = d_global_proc_stat_sum[proc_stat_id][seq_num]; } @@ -476,9 +471,9 @@ Statistician::getGlobalProcStatMax( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_max.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_max.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_max[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_max[proc_stat_id].size())); pmax = d_global_proc_stat_max[proc_stat_id][seq_num]; } @@ -504,9 +499,9 @@ Statistician::getGlobalProcStatMaxProcessorId( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_data.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_imax.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_imax[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_imax[proc_stat_id].size())); id = d_global_proc_stat_imax[proc_stat_id][seq_num]; @@ -533,9 +528,9 @@ Statistician::getGlobalProcStatMin( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_min.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_min.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_min[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_min[proc_stat_id].size())); pmin = d_global_proc_stat_min[proc_stat_id][seq_num]; } @@ -561,9 +556,9 @@ Statistician::getGlobalProcStatMinProcessorId( } TBOX_ASSERT(proc_stat_id >= 0 && - proc_stat_id < d_global_proc_stat_imin.getSize()); + proc_stat_id < static_cast(d_global_proc_stat_imin.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_proc_stat_imin[proc_stat_id].getSize()); + seq_num < static_cast(d_global_proc_stat_imin[proc_stat_id].size())); id = d_global_proc_stat_imin[proc_stat_id][seq_num]; } @@ -603,13 +598,13 @@ Statistician::printGlobalProcStatData( << d_proc_statistics[proc_stat_id]->getName() << std::endl; int nnodes = mpi.getSize(); - const Array >& sdata = + const std::vector >& sdata = d_global_proc_stat_data[proc_stat_id]; - for (int ipsl = 0; ipsl < sdata.getSize(); ipsl++) { + for (int ipsl = 0; ipsl < static_cast(sdata.size()); ++ipsl) { os << " Seq # " << ipsl << std::endl; os << " proc : value" << std::endl; - for (int ip = 0; ip < nnodes; ip++) { + for (int ip = 0; ip < nnodes; ++ip) { /* * Write out data only if data entry is NOT an "empty" * entry, defined by the Statistic::s_empty_seq_tag_entry @@ -666,14 +661,14 @@ Statistician::printGlobalProcStatDataFormatted( // heading - line 1 os << "Seq#\t"; - for (n = 0; n < nnodes; n++) { + for (n = 0; n < nnodes; ++n) { os << "Proc\t"; } os << std::endl; // heading - line 2 os << " \t"; - for (n = 0; n < nnodes; n++) { + for (n = 0; n < nnodes; ++n) { os << n << "\t"; } os << std::endl; @@ -681,11 +676,11 @@ Statistician::printGlobalProcStatDataFormatted( /* * Now print values. */ - const Array >& sdata = + const std::vector >& sdata = d_global_proc_stat_data[proc_stat_id]; - for (s = 0; s < sdata.getSize(); s++) { + for (s = 0; s < static_cast(sdata.size()); ++s) { os << s << "\t"; - for (n = 0; n < nnodes; n++) { + for (n = 0; n < nnodes; ++n) { /* * Write out data only if data entry is NOT an "empty" * entry, defined by the Statistic::s_empty_seq_tag_entry @@ -754,9 +749,9 @@ Statistician::printGlobalProcStatDataFormatted( /* * Now print values. */ - const Array >& sdata = + const std::vector >& sdata = d_global_proc_stat_data[proc_stat_id]; - for (s = 0; s < sdata.getSize(); s++) { + for (s = 0; s < static_cast(sdata.size()); ++s) { os << s << "\t"; /* * Write out data only if data entry is NOT an "empty" @@ -816,9 +811,9 @@ Statistician::getGlobalPatchStatSequenceLength( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); - seq_len = d_global_patch_stat_data[patch_stat_id].getSize(); + seq_len = static_cast(d_global_patch_stat_data[patch_stat_id].size()); } return seq_len; @@ -850,12 +845,12 @@ Statistician::getGlobalPatchStatNumberPatches( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); num_patches = - d_global_patch_stat_data[patch_stat_id][seq_num].getSize(); + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); } return num_patches; @@ -887,12 +882,11 @@ Statistician::getGlobalPatchStatPatchMapping( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_mapping.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_mapping.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_mapping[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_mapping[patch_stat_id].size())); TBOX_ASSERT(patch_num >= 0 && - patch_num < d_global_patch_stat_mapping[patch_stat_id][seq_num]. - getSize()); + patch_num < static_cast(d_global_patch_stat_mapping[patch_stat_id][seq_num].size())); mapping = d_global_patch_stat_mapping[patch_stat_id][seq_num][patch_num]; @@ -926,12 +920,11 @@ Statistician::getGlobalPatchStatValue( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); TBOX_ASSERT(patch_num >= 0 && - patch_num < d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize()); + patch_num < static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size())); val = d_global_patch_stat_data[patch_stat_id][seq_num][patch_num]; } @@ -963,14 +956,14 @@ Statistician::getGlobalPatchStatSum( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); - for (int np = 0; np < num_patches; np++) { + for (int np = 0; np < num_patches; ++np) { sum += d_global_patch_stat_data[patch_stat_id][seq_num][np]; } } @@ -1002,14 +995,14 @@ Statistician::getGlobalPatchStatMax( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); double val = pmax; - for (int np = 0; np < num_patches; np++) { + for (int np = 0; np < num_patches; ++np) { val = d_global_patch_stat_data[patch_stat_id][seq_num][np]; pmax = (val > pmax ? val : pmax); } @@ -1043,14 +1036,14 @@ Statistician::getGlobalPatchStatMaxPatchId( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); double val = pmax; - for (int np = 0; np < num_patches; np++) { + for (int np = 0; np < num_patches; ++np) { val = d_global_patch_stat_data[patch_stat_id][seq_num][np]; if (val > pmax) { id = np; @@ -1086,14 +1079,14 @@ Statistician::getGlobalPatchStatMin( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); double val = pmin; - for (int np = 0; np < num_patches; np++) { + for (int np = 0; np < num_patches; ++np) { val = d_global_patch_stat_data[patch_stat_id][seq_num][np]; pmin = (val < pmin ? val : pmin); } @@ -1127,14 +1120,14 @@ Statistician::getGlobalPatchStatMinPatchId( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); double val = pmin; - for (int np = 0; np < num_patches; np++) { + for (int np = 0; np < num_patches; ++np) { val = d_global_patch_stat_data[patch_stat_id][seq_num][np]; if (val < pmin) { id = np; @@ -1172,11 +1165,11 @@ Statistician::getGlobalPatchStatProcessorSum( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(processor_id >= 0 && processor_id < mpi.getSize()); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); sum = d_global_patch_stat_proc_data[patch_stat_id][seq_num][processor_id]; } @@ -1208,12 +1201,12 @@ Statistician::getGlobalPatchStatProcessorSumMax( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); double val = pmax; - for (int np = 0; np < mpi.getSize(); np++) { + for (int np = 0; np < mpi.getSize(); ++np) { val = d_global_patch_stat_proc_data[patch_stat_id][seq_num][np]; pmax = (val > pmax ? val : pmax); } @@ -1247,12 +1240,12 @@ Statistician::getGlobalPatchStatProcessorSumMaxId( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); double val = pmax; - for (int np = 0; np < mpi.getSize(); np++) { + for (int np = 0; np < mpi.getSize(); ++np) { val = d_global_patch_stat_proc_data[patch_stat_id][seq_num][np]; if (val > pmax) { id = np; @@ -1287,13 +1280,13 @@ Statistician::getGlobalPatchStatProcessorSumMin( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); double val = pmin; - for (int np = 0; np < mpi.getSize(); np++) { + for (int np = 0; np < mpi.getSize(); ++np) { val = d_global_patch_stat_proc_data[patch_stat_id][seq_num][np]; pmin = (val < pmin ? val : pmin); } @@ -1327,12 +1320,12 @@ Statistician::getGlobalPatchStatProcessorSumMinId( } TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); double val = pmin; - for (int np = 0; np < mpi.getSize(); np++) { + for (int np = 0; np < mpi.getSize(); ++np) { val = d_global_patch_stat_proc_data[patch_stat_id][seq_num][np]; if (val < pmin) { id = np; @@ -1350,12 +1343,6 @@ Statistician::getGlobalPatchStatNumberPatchesOnProc( int proc_id) { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); - TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); - TBOX_ASSERT(proc_id >= 0 && - proc_id < mpi.getRank()); int num_patches = -1; if (mpi.getRank() == 0) { @@ -1372,6 +1359,12 @@ Statistician::getGlobalPatchStatNumberPatchesOnProc( << "stats data BEFORE this metho." << std::endl); } + TBOX_ASSERT(patch_stat_id >= 0 && + patch_stat_id < static_cast(d_global_patch_stat_data.size())); + TBOX_ASSERT(seq_num >= 0 && + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); + TBOX_ASSERT(proc_id >= 0 && proc_id < mpi.getSize()); + num_patches = d_global_patch_stat_mapping[patch_stat_id][seq_num][proc_id]; } @@ -1386,11 +1379,6 @@ Statistician::getGlobalPatchStatMaxPatchesPerProc( int seq_num) { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); - TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); - int pmax = -999999; if (mpi.getRank() == 0) { @@ -1408,24 +1396,28 @@ Statistician::getGlobalPatchStatMaxPatchesPerProc( << "stats data BEFORE this metho." << std::endl); } + TBOX_ASSERT(patch_stat_id >= 0 && + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); + TBOX_ASSERT(seq_num >= 0 && + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); + int val = pmax; - Array patches_per_proc; - patches_per_proc.resizeArray(mpi.getSize()); + std::vector patches_per_proc(mpi.getSize()); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); int np, p; - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { patches_per_proc[np] = 0; } - for (p = 0; p < num_patches; p++) { + for (p = 0; p < num_patches; ++p) { np = d_global_patch_stat_mapping[patch_stat_id][seq_num][np]; - patches_per_proc[np]++; + ++patches_per_proc[np]; } - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { val = patches_per_proc[np]; pmax = (val > pmax ? val : pmax); } @@ -1440,11 +1432,6 @@ Statistician::getGlobalPatchStatMaxPatchesPerProcId( int seq_num) { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); - TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); - int pmax = -999999; int id = -1; @@ -1463,24 +1450,28 @@ Statistician::getGlobalPatchStatMaxPatchesPerProcId( << "stats data BEFORE this metho." << std::endl); } + TBOX_ASSERT(patch_stat_id >= 0 && + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); + TBOX_ASSERT(seq_num >= 0 && + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); + int val = pmax; - Array patches_per_proc; - patches_per_proc.resizeArray(mpi.getSize()); + std::vector patches_per_proc(mpi.getSize()); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); int np, p; - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { patches_per_proc[np] = 0; } - for (p = 0; p < num_patches; p++) { + for (p = 0; p < num_patches; ++p) { np = d_global_patch_stat_mapping[patch_stat_id][seq_num][np]; - patches_per_proc[np]++; + ++patches_per_proc[np]; } - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { val = patches_per_proc[np]; if (val > pmax) { id = np; @@ -1499,11 +1490,6 @@ Statistician::getGlobalPatchStatMinPatchesPerProc( int seq_num) { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); - TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); - int pmin = 999999; if (mpi.getRank() == 0) { @@ -1520,30 +1506,32 @@ Statistician::getGlobalPatchStatMinPatchesPerProc( << "must be called with the argument to gather global " << "stats data BEFORE this metho." << std::endl); } - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_data.getSize()); + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_data[patch_stat_id].getSize()); + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); + TBOX_ASSERT(patch_stat_id >= 0 && + patch_stat_id < static_cast(d_global_patch_stat_data.size())); + TBOX_ASSERT(seq_num >= 0 && + seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())); int val = pmin; - Array patches_per_proc; - patches_per_proc.resizeArray(mpi.getSize()); + std::vector patches_per_proc(mpi.getSize()); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); int np, p; - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { patches_per_proc[np] = 0; } - for (p = 0; p < num_patches; p++) { + for (p = 0; p < num_patches; ++p) { np = d_global_patch_stat_mapping[patch_stat_id][seq_num][np]; - patches_per_proc[np]++; + ++patches_per_proc[np]; } - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { val = patches_per_proc[np]; pmin = (val < pmin ? val : pmin); } @@ -1559,10 +1547,6 @@ Statistician::getGlobalPatchStatMinPatchesPerProcId( int seq_num) { const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); - TBOX_ASSERT(patch_stat_id >= 0 && - patch_stat_id < d_global_patch_stat_proc_data.getSize()); - TBOX_ASSERT(seq_num >= 0 && - seq_num < d_global_patch_stat_proc_data[patch_stat_id].getSize()); int pmin = 9999999; int id = -1; @@ -1582,24 +1566,28 @@ Statistician::getGlobalPatchStatMinPatchesPerProcId( << "stats data BEFORE this metho." << std::endl); } + TBOX_ASSERT(patch_stat_id >= 0 && + patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())); + TBOX_ASSERT(seq_num >= 0 && + seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())); + int val = pmin; - Array patches_per_proc; - patches_per_proc.resizeArray(mpi.getSize()); + std::vector patches_per_proc(mpi.getSize()); - int num_patches = d_global_patch_stat_data[patch_stat_id][seq_num]. - getSize(); + int num_patches = + static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()); int np, p; - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { patches_per_proc[np] = 0; } - for (p = 0; p < num_patches; p++) { + for (p = 0; p < num_patches; ++p) { np = d_global_patch_stat_mapping[patch_stat_id][seq_num][np]; - patches_per_proc[np]++; + ++patches_per_proc[np]; } - for (np = 0; np < mpi.getSize(); np++) { + for (np = 0; np < mpi.getSize(); ++np) { val = patches_per_proc[np]; if (val < pmin) { id = np; @@ -1642,14 +1630,14 @@ Statistician::printGlobalPatchStatData( os << "\n " << patch_stat_id << ": " << d_patch_statistics[patch_stat_id]->getName() << std::endl; - const Array >& sdata = + const std::vector >& sdata = d_global_patch_stat_data[patch_stat_id]; - const Array >& spmap = + const std::vector >& spmap = d_global_patch_stat_mapping[patch_stat_id]; - for (int ipsl = 0; ipsl < sdata.getSize(); ipsl++) { + for (int ipsl = 0; ipsl < static_cast(sdata.size()); ++ipsl) { os << " Seq # " << ipsl << std::endl; os << " patch[proc]: value" << std::endl; - for (int ip = 0; ip < sdata[ipsl].getSize(); ip++) { + for (int ip = 0; ip < static_cast(sdata[ipsl].size()); ++ip) { /* * Write out data only if data entry is NOT an "empty" * entry, defined by the Statistic::s_empty_seq_tag_entry @@ -1705,23 +1693,23 @@ Statistician::printGlobalPatchStatDataFormatted( /* * Print tab-separated table header */ - const Array >& sdata = + const std::vector >& sdata = d_global_patch_stat_data[patch_stat_id]; - for (s = 0; s < sdata.getSize(); s++) { - int np_at_s = sdata[s].getSize(); + for (s = 0; s < static_cast(sdata.size()); ++s) { + int np_at_s = static_cast(sdata[s].size()); npatches = (np_at_s > npatches ? np_at_s : npatches); } // heading - line 1 os << "Seq#\t"; - for (n = 0; n < npatches; n++) { + for (n = 0; n < npatches; ++n) { os << "Patch\t"; } os << std::endl; // heading - line 2 os << " \t"; - for (n = 0; n < npatches; n++) { + for (n = 0; n < npatches; ++n) { os << n << "\t"; } os << std::endl; @@ -1729,9 +1717,9 @@ Statistician::printGlobalPatchStatDataFormatted( /* * Now print values. */ - for (s = 0; s < sdata.getSize(); s++) { + for (s = 0; s < static_cast(sdata.size()); ++s) { os << s << "\t"; - for (n = 0; n < sdata[s].getSize(); n++) { + for (n = 0; n < static_cast(sdata[s].size()); ++n) { /* * Write out data only if data entry is NOT an "empty" * entry, defined by the Statistic::s_empty_seq_tag_entry @@ -1766,12 +1754,12 @@ Statistician::finalize( int nnodes = mpi.getSize(); int my_rank = mpi.getRank(); - d_global_proc_stat_data.resizeArray(0); - d_global_patch_stat_data.resizeArray(0); - d_global_patch_stat_proc_data.resizeArray(0); - d_global_patch_stat_mapping.resizeArray(0); + d_global_proc_stat_data.resize(0); + d_global_patch_stat_data.resize(0); + d_global_patch_stat_proc_data.resize(0); + d_global_patch_stat_mapping.resize(0); - Array total_patches; + std::vector total_patches; checkStatsForConsistency(total_patches); reduceGlobalStatistics(); @@ -1792,50 +1780,45 @@ Statistician::finalize( * These are only needed on processor 0 but we construct them on * all processors to avoid compiler warnings. */ - Array >* global_proc_stats = - d_num_proc_stats > 0 - ? new Array >[d_num_proc_stats] - : (Array > *)NULL; - Array >* global_patch_stats = - d_num_patch_stats > 0 - ? new Array >[d_num_patch_stats] - : (Array > *)NULL; + std::vector >* global_proc_stats = + d_num_proc_stats > 0 ? + new std::vector >[d_num_proc_stats] : 0; + std::vector >* global_patch_stats = + d_num_patch_stats > 0 ? + new std::vector >[d_num_patch_stats] : 0; if (my_rank == 0) { - d_global_proc_stat_data.resizeArray(d_num_proc_stats); - for (is = 0; is < d_num_proc_stats; is++) { + d_global_proc_stat_data.resize(d_num_proc_stats); + for (is = 0; is < d_num_proc_stats; ++is) { seq_len = d_proc_statistics[is]->getStatSequenceLength(); - d_global_proc_stat_data[is].resizeArray(seq_len); + d_global_proc_stat_data[is].resize(seq_len); - for (ip = 0; ip < seq_len; ip++) { - d_global_proc_stat_data[is][ip].resizeArray(nnodes); + for (ip = 0; ip < seq_len; ++ip) { + d_global_proc_stat_data[is][ip].resize(nnodes); } } - d_global_patch_stat_data.resizeArray(d_num_patch_stats); - d_global_patch_stat_mapping.resizeArray(d_num_patch_stats); - d_global_patch_stat_proc_data.resizeArray(d_num_patch_stats); + d_global_patch_stat_data.resize(d_num_patch_stats); + d_global_patch_stat_mapping.resize(d_num_patch_stats); + d_global_patch_stat_proc_data.resize(d_num_patch_stats); ipsl = 0; - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { seq_len = d_patch_statistics[is]->getStatSequenceLength(); - d_global_patch_stat_data[is].resizeArray(seq_len); - d_global_patch_stat_mapping[is].resizeArray(seq_len); - d_global_patch_stat_proc_data[is].resizeArray(seq_len); + d_global_patch_stat_data[is].resize(seq_len); + d_global_patch_stat_mapping[is].resize(seq_len); + d_global_patch_stat_proc_data[is].resize(seq_len); - for (ip = 0; ip < seq_len; ip++) { + for (ip = 0; ip < seq_len; ++ip) { int npatches = total_patches[ipsl]; - d_global_patch_stat_data[is][ip]. - resizeArray(npatches); - d_global_patch_stat_mapping[is][ip]. - resizeArray(npatches); - d_global_patch_stat_proc_data[is][ip]. - resizeArray(nnodes); - ipsl++; + d_global_patch_stat_data[is][ip].resize(npatches); + d_global_patch_stat_mapping[is][ip].resize(npatches); + d_global_patch_stat_proc_data[is][ip].resize(nnodes); + ++ipsl; } } @@ -1862,11 +1845,11 @@ Statistician::finalize( * processor and add transaction to schedule to receive stat. */ - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { const std::string& sname = d_proc_statistics[is]->getName(); const std::string& stype = d_proc_statistics[is]->getType(); - global_proc_stats[is].resizeArray(nnodes); - for (ip = 1; ip < nnodes; ip++) { + global_proc_stats[is].resize(nnodes); + for (ip = 1; ip < nnodes; ++ip) { global_proc_stats[is][ip].reset( new Statistic(sname, stype, is)); stat_schedule.addTransaction( @@ -1882,7 +1865,7 @@ Statistician::finalize( * to processor zero. */ - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { stat_schedule.addTransaction( boost::make_shared( d_proc_statistics[is], my_rank, 0)); @@ -1901,11 +1884,11 @@ Statistician::finalize( * processor and add transaction to schedule to receive stat. */ - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { const std::string& sname = d_patch_statistics[is]->getName(); const std::string& stype = d_patch_statistics[is]->getType(); - global_patch_stats[is].resizeArray(nnodes); - for (ip = 1; ip < nnodes; ip++) { + global_patch_stats[is].resize(nnodes); + for (ip = 1; ip < nnodes; ++ip) { global_patch_stats[is][ip].reset( new Statistic(sname, stype, is)); stat_schedule.addTransaction( @@ -1921,7 +1904,7 @@ Statistician::finalize( * to processor zero. */ - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { stat_schedule.addTransaction( boost::make_shared( d_patch_statistics[is], my_rank, 0)); @@ -1945,18 +1928,18 @@ Statistician::finalize( if (my_rank == 0) { - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { - Array >& sdata = + std::vector >& sdata = d_global_proc_stat_data[is]; - for (ip = 0; ip < nnodes; ip++) { + for (ip = 0; ip < nnodes; ++ip) { boost::shared_ptr stat(((ip == 0) ? - d_proc_statistics[is] : - global_proc_stats[is][ip])); + d_proc_statistics[is] : + global_proc_stats[is][ip])); - for (ipsl = 0; ipsl < stat->getStatSequenceLength(); ipsl++) { + for (ipsl = 0; ipsl < stat->getStatSequenceLength(); ++ipsl) { sdata[ipsl][ip] = stat->getProcStatSeqArray()[ipsl].value; } @@ -1964,25 +1947,25 @@ Statistician::finalize( } // iterate over proc stats - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { - Array >& sdata = + std::vector >& sdata = d_global_patch_stat_data[is]; - Array >& spmap = + std::vector >& spmap = d_global_patch_stat_mapping[is]; - for (ip = 0; ip < nnodes; ip++) { + for (ip = 0; ip < nnodes; ++ip) { boost::shared_ptr stat(((ip == 0) ? - d_patch_statistics[is] : - global_patch_stats[is][ip])); + d_patch_statistics[is] : + global_patch_stats[is][ip])); - for (ipsl = 0; ipsl < stat->getStatSequenceLength(); ipsl++) { + for (ipsl = 0; ipsl < stat->getStatSequenceLength(); ++ipsl) { const std::list& psrl = stat->getPatchStatSeqArray()[ipsl].patch_records; std::list::const_iterator ilr = psrl.begin(); - for ( ; ilr != psrl.end(); ilr++) { + for ( ; ilr != psrl.end(); ++ilr) { int patch_id = ilr->patch_id; sdata[ipsl][patch_id] = ilr->value; spmap[ipsl][patch_id] = ip; @@ -2000,18 +1983,18 @@ Statistician::finalize( * just constructs a processor stat from the patch stat data. */ - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { - const Array >& pdata = + const std::vector >& pdata = d_global_patch_stat_data[is]; - for (int s = 0; s < pdata.getSize(); s++) { + for (int s = 0; s < static_cast(pdata.size()); ++s) { - for (ip = 0; ip < nnodes; ip++) { + for (ip = 0; ip < nnodes; ++ip) { d_global_patch_stat_proc_data[is][s][ip] = 0.; } - for (int p = 0; p < pdata[s].getSize(); p++) { + for (int p = 0; p < static_cast(pdata[s].size()); ++p) { ip = d_global_patch_stat_mapping[is][s][p]; d_global_patch_stat_proc_data[is][s][ip] += d_global_patch_stat_data[is][s][p]; @@ -2023,8 +2006,12 @@ Statistician::finalize( } // if I am processor zero - delete[] global_proc_stats; - delete[] global_patch_stats; + if (global_proc_stats) { + delete[] global_proc_stats; + } + if (global_patch_stats) { + delete[] global_patch_stats; + } d_has_gathered_stats = true; @@ -2045,9 +2032,9 @@ void Statistician::reduceGlobalStatistics() { std::vector proc_stat_values; - for (int istat = 0; istat < d_num_proc_stats; istat++) { + for (int istat = 0; istat < d_num_proc_stats; ++istat) { const Statistic& stat(*d_proc_statistics[istat]); - for (int iseq = 0; iseq < stat.getStatSequenceLength(); iseq++) { + for (int iseq = 0; iseq < stat.getStatSequenceLength(); ++iseq) { proc_stat_values.push_back(stat.getProcStatSeqArray()[iseq].value); } } @@ -2055,7 +2042,7 @@ Statistician::reduceGlobalStatistics() const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); std::vector sum_proc_stat_values(proc_stat_values); - if (mpi.getSize() > 1) { + if (mpi.getSize() > 1 && proc_stat_values.size() > 0) { mpi.Allreduce(&proc_stat_values[0], &sum_proc_stat_values[0], static_cast(proc_stat_values.size()), @@ -2065,7 +2052,7 @@ Statistician::reduceGlobalStatistics() std::vector max_proc_stat_values(proc_stat_values); std::vector imax_proc_stat_values(proc_stat_values.size(), mpi.getRank()); - if (mpi.getSize() > 1) { + if (mpi.getSize() > 1 && proc_stat_values.size() > 0) { mpi.AllReduce(&max_proc_stat_values[0], static_cast(max_proc_stat_values.size()), MPI_MAXLOC, @@ -2074,53 +2061,53 @@ Statistician::reduceGlobalStatistics() std::vector min_proc_stat_values(proc_stat_values); std::vector imin_proc_stat_values(proc_stat_values.size(), mpi.getRank()); - if (mpi.getSize() > 1) { + if (mpi.getSize() > 1 && proc_stat_values.size() > 0) { mpi.AllReduce(&min_proc_stat_values[0], static_cast(min_proc_stat_values.size()), MPI_MINLOC, &imin_proc_stat_values[0]); } - d_global_proc_stat_sum.setNull(); - d_global_proc_stat_sum.resizeArray(d_num_proc_stats); - d_global_proc_stat_max.setNull(); - d_global_proc_stat_max.resizeArray(d_num_proc_stats); - d_global_proc_stat_min.setNull(); - d_global_proc_stat_min.resizeArray(d_num_proc_stats); - d_global_proc_stat_imax.setNull(); - d_global_proc_stat_imax.resizeArray(d_num_proc_stats); - d_global_proc_stat_imin.setNull(); - d_global_proc_stat_imin.resizeArray(d_num_proc_stats); + d_global_proc_stat_sum.clear(); + d_global_proc_stat_sum.resize(d_num_proc_stats); + d_global_proc_stat_max.clear(); + d_global_proc_stat_max.resize(d_num_proc_stats); + d_global_proc_stat_min.clear(); + d_global_proc_stat_min.resize(d_num_proc_stats); + d_global_proc_stat_imax.clear(); + d_global_proc_stat_imax.resize(d_num_proc_stats); + d_global_proc_stat_imin.clear(); + d_global_proc_stat_imin.resize(d_num_proc_stats); size_t isum(0); size_t imax(0); size_t imin(0); - for (int istat = 0; istat < d_num_proc_stats; istat++) { + for (int istat = 0; istat < d_num_proc_stats; ++istat) { const Statistic& stat(*d_proc_statistics[istat]); if (stat.getStatSequenceLength() != 0) { - d_global_proc_stat_sum[istat].resizeArray(stat.getStatSequenceLength()); - memcpy(d_global_proc_stat_sum[istat].getPointer(), + d_global_proc_stat_sum[istat].resize(stat.getStatSequenceLength()); + memcpy(&d_global_proc_stat_sum[istat][0], &sum_proc_stat_values[isum], sizeof(double) * stat.getStatSequenceLength()); isum += stat.getStatSequenceLength(); - d_global_proc_stat_max[istat].resizeArray(stat.getStatSequenceLength()); - d_global_proc_stat_imax[istat].resizeArray(stat.getStatSequenceLength()); - memcpy(d_global_proc_stat_max[istat].getPointer(), + d_global_proc_stat_max[istat].resize(stat.getStatSequenceLength()); + d_global_proc_stat_imax[istat].resize(stat.getStatSequenceLength()); + memcpy(&d_global_proc_stat_max[istat][0], &max_proc_stat_values[imax], sizeof(double) * stat.getStatSequenceLength()); - memcpy(d_global_proc_stat_imax[istat].getPointer(), + memcpy(&d_global_proc_stat_imax[istat][0], &imax_proc_stat_values[imax], sizeof(int) * stat.getStatSequenceLength()); imax += stat.getStatSequenceLength(); - d_global_proc_stat_min[istat].resizeArray(stat.getStatSequenceLength()); - d_global_proc_stat_imin[istat].resizeArray(stat.getStatSequenceLength()); - memcpy(d_global_proc_stat_min[istat].getPointer(), + d_global_proc_stat_min[istat].resize(stat.getStatSequenceLength()); + d_global_proc_stat_imin[istat].resize(stat.getStatSequenceLength()); + memcpy(&d_global_proc_stat_min[istat][0], &min_proc_stat_values[imin], sizeof(double) * stat.getStatSequenceLength()); - memcpy(d_global_proc_stat_imin[istat].getPointer(), + memcpy(&d_global_proc_stat_imin[istat][0], &imin_proc_stat_values[imin], sizeof(int) * stat.getStatSequenceLength()); imin += stat.getStatSequenceLength(); @@ -2147,9 +2134,9 @@ Statistician::reduceGlobalStatistics() void Statistician::checkStatsForConsistency( - Array& total_patches) + std::vector& total_patches) { - TBOX_ASSERT(total_patches.getSize() == 0); + TBOX_ASSERT(total_patches.size() == 0); const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); @@ -2211,11 +2198,11 @@ Statistician::checkStatsForConsistency( std::vector my_seq_lengths(n_stats); std::vector max_seq_lengths(n_stats); - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { my_seq_lengths[is] = d_proc_statistics[is]->getStatSequenceLength(); max_seq_lengths[is] = my_seq_lengths[is]; } - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { int mark = d_num_proc_stats + is; my_seq_lengths[mark] = d_patch_statistics[is]->getStatSequenceLength(); @@ -2230,7 +2217,7 @@ Statistician::checkStatsForConsistency( } consistent = 1; - for (is = 0; is < n_stats; is++) { + for (is = 0; is < n_stats; ++is) { if (max_seq_lengths[is] != my_seq_lengths[is]) { consistent = 0; break; @@ -2254,23 +2241,23 @@ Statistician::checkStatsForConsistency( * for each patch statitic. */ - total_patches.resizeArray(n_patch_stat_seq_items); + total_patches.resize(n_patch_stat_seq_items); if (d_num_patch_stats > 0) { int ipsl = 0; - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { for (ip = 0; ip < d_patch_statistics[is]->getStatSequenceLength(); - ip++) { + ++ip) { total_patches[ipsl] = static_cast( - d_patch_statistics[is]->getPatchStatSeqArray()[ip].patch_records.size()); - ipsl++; + d_patch_statistics[is]->getPatchStatSeqArray()[ip].patch_records.size()); + ++ipsl; } } if (mpi.getSize() > 1) { - std::vector total_patches1(total_patches.getPointer(), - total_patches.getPointer() + total_patches.size()); + std::vector total_patches1(&total_patches[0], + &total_patches[0] + n_patch_stat_seq_items); mpi.Allreduce(&total_patches1[0], &total_patches[0], - total_patches.size(), MPI_INT, MPI_SUM); + n_patch_stat_seq_items, MPI_INT, MPI_SUM); } } @@ -2298,12 +2285,12 @@ Statistician::printLocalStatData( os << "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { os << std::endl; d_proc_statistics[is]->printClassData(os, precision); } - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { os << std::endl; d_patch_statistics[is]->printClassData(os, precision); } @@ -2340,7 +2327,7 @@ Statistician::printAllGlobalStatData( os << " Processor Statistics:" << std::endl; os << " ---------------------" << std::endl; os << " Stat #: name" << std::endl; - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { printGlobalProcStatData(is, os, precision); } @@ -2348,7 +2335,7 @@ Statistician::printAllGlobalStatData( os << " Patch Statistics:" << std::endl; os << " ---------------------" << std::endl; os << " Stat #: name" << std::endl; - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { printGlobalPatchStatData(is, os, precision); } @@ -2389,24 +2376,24 @@ Statistician::printAllSummedGlobalStatData( int is, id, num_sequences, n; double sum; - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { std::string procstat_name = d_proc_statistics[is]->getName(); os << "PROCESSOR STAT: " << procstat_name << std::endl; id = d_proc_statistics[is]->getInstanceId(); num_sequences = getGlobalProcStatSequenceLength(id); - for (n = 0; n < num_sequences; n++) { + for (n = 0; n < num_sequences; ++n) { sum = getGlobalProcStatSum(id, n); os << "\t" << n << "\t" << sum << std::endl; } os << "\n" << std::endl; } - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { std::string patchstat_name = d_patch_statistics[is]->getName(); os << "PATCH STAT: " << patchstat_name << std::endl; id = d_patch_statistics[is]->getInstanceId(); num_sequences = getGlobalPatchStatSequenceLength(id); - for (n = 0; n < num_sequences; n++) { + for (n = 0; n < num_sequences; ++n) { sum = getGlobalPatchStatSum(id, n); os << "\t" << n << "\t" << sum << std::endl; } @@ -2470,7 +2457,7 @@ Statistician::printSpreadSheetOutput( * and .patchstat. */ int is; - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { std::string filename = d_proc_statistics[is]->getName(); filename = filename + "-proc.txt"; if (write_to_dir) filename = dirname + "/" + filename; @@ -2479,7 +2466,7 @@ Statistician::printSpreadSheetOutput( file.close(); } - for (is = 0; is < d_num_patch_stats; is++) { + for (is = 0; is < d_num_patch_stats; ++is) { std::string filename = d_patch_statistics[is]->getName(); filename = filename + "-patch.txt"; if (write_to_dir) filename = dirname + "/" + filename; @@ -2546,7 +2533,7 @@ Statistician::printSpreadSheetOutputForProcessor( * "proc" or "patch" depending on the type of statistic. */ int is; - for (is = 0; is < d_num_proc_stats; is++) { + for (is = 0; is < d_num_proc_stats; ++is) { std::string name = d_proc_statistics[is]->getName(); name = name + "-proc-"; std::string filename = name + Utilities::processorToString( @@ -2571,17 +2558,12 @@ Statistician::printSpreadSheetOutputForProcessor( StatisticRestartDatabase::StatisticRestartDatabase( const std::string& object_name, - bool register_for_restart, - bool read_from_restart) + bool read_from_restart): + d_object_name(object_name) { TBOX_ASSERT(!object_name.empty()); - d_object_name = object_name; - d_registered_for_restart = register_for_restart; - - if (d_registered_for_restart) { - RestartManager::getManager()->registerRestartItem(d_object_name, this); - } + RestartManager::getManager()->registerRestartItem(d_object_name, this); bool is_from_restart = RestartManager::getManager()->isFromRestart(); if (is_from_restart && read_from_restart) { @@ -2591,17 +2573,15 @@ StatisticRestartDatabase::StatisticRestartDatabase( StatisticRestartDatabase::~StatisticRestartDatabase() { - if (d_registered_for_restart) { - RestartManager::getManager()->unregisterRestartItem(d_object_name); - } + RestartManager::getManager()->unregisterRestartItem(d_object_name); } -void StatisticRestartDatabase::putToDatabase( - const boost::shared_ptr& db) const +void StatisticRestartDatabase::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("TBOX_STATISTICRESTARTDATABASE_VERSION", + restart_db->putInteger("TBOX_STATISTICRESTARTDATABASE_VERSION", TBOX_STATISTICRESTARTDATABASE_VERSION); /* @@ -2613,10 +2593,10 @@ void StatisticRestartDatabase::putToDatabase( * Write the number of statistics */ int number_of_procstats = statistician->getNumberProcessorStats(); - db->putInteger("number_of_procstats", number_of_procstats); + restart_db->putInteger("number_of_procstats", number_of_procstats); int number_of_patchstats = statistician->getNumberPatchStats(); - db->putInteger("number_of_patchstats", number_of_patchstats); + restart_db->putInteger("number_of_patchstats", number_of_patchstats); /* * Iterate through the list of statistics and write out a @@ -2624,8 +2604,8 @@ void StatisticRestartDatabase::putToDatabase( * Store the name of each stat in the string arrays * "proc_stat_names" and "patch_stat_names". */ - Array proc_stat_names(number_of_procstats); - Array patch_stat_names(number_of_patchstats); + std::vector proc_stat_names(number_of_procstats); + std::vector patch_stat_names(number_of_patchstats); /* * Write procstat and patchstats to database. @@ -2633,18 +2613,18 @@ void StatisticRestartDatabase::putToDatabase( boost::shared_ptr stat; boost::shared_ptr stat_database; int n; - for (n = 0; n < number_of_procstats; n++) { + for (n = 0; n < number_of_procstats; ++n) { stat = statistician->d_proc_statistics[n]; proc_stat_names[n] = stat->getName(); - stat_database = db->putDatabase(proc_stat_names[n]); - stat->putUnregisteredToDatabase(stat_database); + stat_database = restart_db->putDatabase(proc_stat_names[n]); + stat->putToRestart(stat_database); } - for (n = 0; n < number_of_patchstats; n++) { + for (n = 0; n < number_of_patchstats; ++n) { stat = statistician->d_patch_statistics[n]; patch_stat_names[n] = stat->getName(); - stat_database = db->putDatabase(patch_stat_names[n]); - stat->putUnregisteredToDatabase(stat_database); + stat_database = restart_db->putDatabase(patch_stat_names[n]); + stat->putToRestart(stat_database); } /* @@ -2653,11 +2633,11 @@ void StatisticRestartDatabase::putToDatabase( * which to read the stat info. */ if (number_of_procstats > 0) { - db->putStringArray("proc_stat_names", proc_stat_names); + restart_db->putStringVector("proc_stat_names", proc_stat_names); } if (number_of_patchstats > 0) { - db->putStringArray("patch_stat_names", patch_stat_names); + restart_db->putStringVector("patch_stat_names", patch_stat_names); } } @@ -2678,7 +2658,7 @@ void StatisticRestartDatabase::getFromRestart() d_object_name << ": " "Restart file version different than class version. \n" << "Cannot read statistic information from restart file so" - << "all statistics will be reset."); + << "all statistics will be reset." << std::endl); } int number_of_procstats = db->getInteger("number_of_procstats"); @@ -2687,13 +2667,13 @@ void StatisticRestartDatabase::getFromRestart() /* * Read in the list of sub-database names. */ - Array proc_stat_names; + std::vector proc_stat_names; if (number_of_procstats > 0) { - proc_stat_names = db->getStringArray("proc_stat_names"); + proc_stat_names = db->getStringVector("proc_stat_names"); } - Array patch_stat_names; + std::vector patch_stat_names; if (number_of_patchstats > 0) { - patch_stat_names = db->getStringArray("patch_stat_names"); + patch_stat_names = db->getStringVector("patch_stat_names"); } /* @@ -2704,13 +2684,13 @@ void StatisticRestartDatabase::getFromRestart() std::string sub_database_name; boost::shared_ptr stat; int i; - for (i = 0; i < number_of_procstats; i++) { + for (i = 0; i < number_of_procstats; ++i) { sub_database = db->getDatabase(proc_stat_names[i]); stat = statistician->getStatistic(proc_stat_names[i], "PROC_STAT"); stat->getFromRestart(sub_database); } - for (i = 0; i < number_of_patchstats; i++) { + for (i = 0; i < number_of_patchstats; ++i) { sub_database = db->getDatabase(patch_stat_names[i]); stat = statistician->getStatistic(patch_stat_names[i], "PATCH_STAT"); stat->getFromRestart(sub_database); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.h index 63bccf1e..e019bc2b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Statistician.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton manager class for statistic objects. * ************************************************************************/ @@ -12,12 +12,11 @@ #define included_tbox_Statistician #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/Statistic.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -59,7 +58,7 @@ class StatisticRestartDatabase; * For more information about data that can be recorded with statistics, * consult the header file for the Statistic class. * - * @see tbox::Statistic + * @see Statistic */ class Statistician @@ -72,13 +71,8 @@ class Statistician * users can control whether statistic information will be written * to/read from restart files. * - * The statistic restart database object is also resistered for writing - * subsequent restart files when the first boolean argument is true. - * Whether the statistic database will write statistics to restart files - * during program execution is determined by this argument (true by - * default). Regardless of the value of this argument, statistics that - * exist in the restart file will be read from restart when a run is - * restarted and the second argument is true. + * Statistics that exist in the restart file will be read from restart + * when a run is restarted and the second argument is true. * * Generally, this routine should only be called once during program * execution. If the statistician has been previously created (e.g., @@ -87,7 +81,6 @@ class Statistician */ static Statistician * createStatistician( - bool register_for_restart = true, bool read_from_restart = true); /** @@ -97,6 +90,8 @@ class Statistician * object with the name "my_stat" to the statistician, use the * following call: * Statistician::getStatistician()->addStatistic("my_stat"). + * + * @pre s_statistician_instance */ static Statistician * getStatistician(); @@ -111,8 +106,9 @@ class Statistician * statistics and patch statistics which are indicated by the strings * "PROC_STAT" and "PATCH_STAT", respectively. * - * When assertion checking is active, an assertion will result if wither - * string is empty. + * @pre !name.empty() + * @pre !stat_type.empty() + * @pre (stat_type == "PROC_STAT") || (stat_type == "PATCH_STAT") */ boost::shared_ptr getStatistic( @@ -124,7 +120,8 @@ class Statistician * exists in the database of statistics controlled by the statistician. * If a match is found, the statistic pointer in the argument list is set * to that statistic. Otherwise, return false and return a null pointer. - * If the name string is empty, a null pointer is returned. + * + * @pre !name.empty() */ bool checkStatisticExists( @@ -189,8 +186,10 @@ class Statistician * provided to map the statistic string name to the proper integer * identifier. * - * When assertion checking is active, the identifier must be valid or - * an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_state && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_data.size()))) */ int getGlobalProcStatSequenceLength( @@ -204,8 +203,13 @@ class Statistician * getGlobalProcStatSequenceLength() provides the sequence length for * a given processor statistic. * - * When assertion checking is active, the identifier, sequence number, - * and processor number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_state && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_data[proc_stat_id].size())) && + * (proc_num < SAMRAI_MPI::getSAMRAIWorld().getSize())) */ double getGlobalProcStatValue( @@ -221,8 +225,12 @@ class Statistician * getGlobalProcStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_sum.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_sum[proc_stat_id].size()))) */ double getGlobalProcStatSum( @@ -237,8 +245,12 @@ class Statistician * getGlobalProcStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_max.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_max[proc_stat_id].size()))) */ double getGlobalProcStatMax( @@ -250,8 +262,12 @@ class Statistician * statistic specified by the given integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_imax.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_imax[proc_stat_id].size()))) */ int getGlobalProcStatMaxProcessorId( @@ -266,8 +282,12 @@ class Statistician * getGlobalProcStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_min.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_min[proc_stat_id].size()))) */ double getGlobalProcStatMin( @@ -279,8 +299,12 @@ class Statistician * statistic specified by the given integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && + * (proc_stat_id >= 0) && + * (proc_stat_id < static_cast(d_global_proc_stat_imin.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_proc_stat_imin[proc_stat_id].size()))) */ int getGlobalProcStatMinProcessorId( @@ -293,6 +317,10 @@ class Statistician * (default is 12). Note that this method generates a general dump of * the data but does NOT generate it in tabulated form. To generate * tabulated data, see the printGlobalProcStatDataFormatted() method. + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (proc_stat_id >= 0) && (precision > 0)) */ void printGlobalProcStatData( @@ -303,6 +331,10 @@ class Statistician /** * Print processor stat data in formatted output to given output * stream. Floating point precision may be specified (default is 12). + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (proc_stat_id >= 0) && (precision > 0)) */ void printGlobalProcStatDataFormatted( @@ -314,6 +346,10 @@ class Statistician * Print stat data for specified processor in formatted output to * given output stream. Floating point precision may be specified * (default is 12). + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (proc_stat_id >= 0) && (proc_id >= 0) && (precision > 0)) */ void printGlobalProcStatDataFormatted( @@ -338,8 +374,10 @@ class Statistician * is provided to map the statistic string name to the proper integer * identifier. * - * When assertion checking is active, the identifier must be valid or - * an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size()))) */ int getGlobalPatchStatSequenceLength( @@ -353,8 +391,12 @@ class Statistician * getGlobalPatchStatSequenceLength() provides the sequence length for * a given patch statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ int getGlobalPatchStatNumberPatches( @@ -371,8 +413,14 @@ class Statistician * getGlobalPatchStatNumberPatches() gives the number of patches * associated with a patch statistic and sequence number. * - * When assertion checking is active, the identifier, sequence number, - * and patch number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_mapping.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_mapping[patch_stat_id].size())) && + * (patch_num >= 0) && + * (patch_num < static_cast(d_global_patch_stat_mapping[patch_stat_id][seq_num].size()))) */ int getGlobalPatchStatPatchMapping( @@ -390,8 +438,14 @@ class Statistician * getGlobalPatchStatNumberPatches() gives the number of patches * associated with a patch statistic and sequence number. * - * When assertion checking is active, the identifier, sequence number, - * and patch number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())) && + * (patch_num >= 0) && + * (patch_num < static_cast(d_global_patch_stat_data[patch_stat_id][seq_num].size()))) */ double getGlobalPatchStatValue( @@ -407,8 +461,12 @@ class Statistician * getGlobalPatchStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ double getGlobalPatchStatSum( @@ -423,8 +481,12 @@ class Statistician * getGlobalPatchStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ double getGlobalPatchStatMax( @@ -436,8 +498,12 @@ class Statistician * statistic specified by the given integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ int getGlobalPatchStatMaxPatchId( @@ -452,8 +518,12 @@ class Statistician * getGlobalPatchStatSequenceLength() returns the maximum sequence length * for the processor statistic. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ double getGlobalPatchStatMin( @@ -465,8 +535,12 @@ class Statistician * statistic specified by the given integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ int getGlobalPatchStatMinPatchId( @@ -478,8 +552,14 @@ class Statistician * processor. The patch statistic is specified by its integer identifyer * and sequence number. * - * When assertion checking is active, the identifier, processor id, - * and sequence number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (processor_id >= 0) && + * (processor_id < SAMRAI_MPI::getSAMRAIWorld().getSize()) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ double getGlobalPatchStatProcessorSum( @@ -495,8 +575,12 @@ class Statistician * statistic is specified by its integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ double getGlobalPatchStatProcessorSumMax( @@ -510,8 +594,12 @@ class Statistician * for more information on the summed patch statistic information * on processors. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ int getGlobalPatchStatProcessorSumMaxId( @@ -525,8 +613,12 @@ class Statistician * statistic is specified by its integer identifyer and sequence * number. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ double getGlobalPatchStatProcessorSumMin( @@ -540,8 +632,12 @@ class Statistician * for more information on the summed patch statistic information * on processors. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ int getGlobalPatchStatProcessorSumMinId( @@ -552,8 +648,13 @@ class Statistician * Return number of patches on the specified processor number for * patch statistic with given identifier, and sequence number. * - * When assertion checking is active, the identifier and sequence number - * must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size())) && + * (proc_id >= 0 && proc_id < SAMRAI_MPI::getSAMRAIWorld().getSize())) */ int getGlobalPatchStatNumberPatchesOnProc( @@ -565,8 +666,12 @@ class Statistician * Returns the maximum number of patches per processor for the * specified patch statistic. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ int getGlobalPatchStatMaxPatchesPerProc( @@ -577,8 +682,12 @@ class Statistician * Returns the processor ID holding the maximum number of patches * per processor for the specified patch statistic. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ int getGlobalPatchStatMaxPatchesPerProcId( @@ -589,8 +698,16 @@ class Statistician * Returns the minimum number of patches per processor for the * specified patch statistic. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size())) && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_data[patch_stat_id].size()))) */ int getGlobalPatchStatMinPatchesPerProc( @@ -601,8 +718,12 @@ class Statistician * Returns the processor ID holding the minimum number of patches * per processor for the specified patch statistic. * - * When assertion checking is active, the identifier and sequence - * number must be valid or an assertion will result. + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats && + * (patch_stat_id >= 0) && + * (patch_stat_id < static_cast(d_global_patch_stat_proc_data.size())) && + * (seq_num >= 0) && + * (seq_num < static_cast(d_global_patch_stat_proc_data[patch_stat_id].size()))) */ int getGlobalPatchStatMinPatchesPerProcId( @@ -614,6 +735,9 @@ class Statistician * (default is 12). Note that this method generates a general dump of * the data but does NOT generate it in tabulated form. To generate * tabulated data, see the printGlobalPatchStatDataFormatted() method. + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (patch_stat_id >= 0 && precision > 0) */ void printGlobalPatchStatData( @@ -624,6 +748,9 @@ class Statistician /** * Print patch stat data in formatted output to given output * stream. Floating point precision may be specified (default is 12). + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (patch_stat_id >= 0 && precision > 0) */ void printGlobalPatchStatDataFormatted( @@ -647,7 +774,7 @@ class Statistician */ void finalize( - bool gather_individual_stats_on_proc_0 = true); + bool gather_individual_stats_on_proc_0 = false); /** * Print data to given output stream for local statistics managed @@ -663,6 +790,9 @@ class Statistician * Print global statistic data information to given output stream. * The data will NOT be in tabulated form. Floating point precision * can be specified (default is 12). + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats) */ void printAllGlobalStatData( @@ -695,6 +825,9 @@ class Statistician * The files may be read in to a spreadsheet program such as MS Excel. If * no directory name is supplied, the files will be written to the directory * where the application is run. + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats) */ void printSpreadSheetOutput( @@ -707,6 +840,9 @@ class Statistician * prints data for a single processor. This may be useful for information * that is the same across all processors. This method will only print * processor stats. Any patch stats will be ignored. + * + * @pre (SAMRAI_MPI::getSAMRAIWorld().getRank() != 0) || + * (!d_must_call_finalize && d_has_gathered_stats) */ void printSpreadSheetOutputForProcessor( @@ -731,18 +867,22 @@ class Statistician * Initialize Singleton instance with instance of subclass. This function * is used to make the singleton object unique when inheriting from this * base class. + * + * @pre !s_statistician_instance */ void registerSingletonSubclassInstance( - Statistician* subclass_instance); + Statistician * subclass_instance); /** * During finalize() check statistic information on all processors - * for consistency before generating arrays of data. + * for consistency before generating vectors of data. + * + * @pre total_patches.size() == 0 */ void checkStatsForConsistency( - Array& total_patches); + std::vector& total_patches); /** * Return true if a processor statistic whose name matches the @@ -769,6 +909,15 @@ class Statistician const std::string& name) const; private: + // Unimplemented copy constructor. + Statistician( + const Statistician& other); + + // Unimplemented assignment operator. + Statistician& + operator = ( + const Statistician& rhs); + /*! * @brief Get global-reduction statistics without depending on an * MPI gather, which is slow and does not scale. @@ -780,26 +929,26 @@ class Statistician * Gets the current maximum number of statistics. * * If trying to use more statistics than this value - * the arrays should be resized. + * the vectors should be resized. */ int getMaximumNumberOfStatistics() { - return d_proc_statistics.getSize(); + return static_cast(d_proc_statistics.size()); } /* * Set the maximum number of statistics. * - * This will grow the internal arrays used to store values. + * This will grow the internal vectors used to store values. */ void setMaximumNumberOfStatistics( const int size) { - if (size > d_proc_statistics.getSize()) { - d_proc_statistics.resizeArray(size); - d_patch_statistics.resizeArray(size); + if (size > static_cast(d_proc_statistics.size())) { + d_proc_statistics.resize(size); + d_patch_statistics.resize(size); } } @@ -810,7 +959,6 @@ class Statistician static void makeStatisticianInstance( - bool register_for_restart = true, bool read_from_restart = true); /* @@ -818,7 +966,6 @@ class Statistician */ void initRestartDatabase( - bool register_for_restart, bool read_from_restart); /** @@ -852,47 +999,46 @@ class Statistician StatisticRestartDatabase* d_restart_database_instance; /* - * Count of statistics registered with the statistician and arrays of + * Count of statistics registered with the statistician and vectors of * pointers to those statistics. */ int d_num_proc_stats; - Array > d_proc_statistics; + std::vector > d_proc_statistics; int d_num_patch_stats; - Array > d_patch_statistics; + std::vector > d_patch_statistics; /* - * Arrays of global statistic data assembled by the finalize() function. + * Vectors of global statistic data assembled by the finalize() function. * * Global processor stat data is assembled as - * array(stat id, seq id, proc id) = proc stat value. + * vector(stat id, seq id, proc id) = proc stat value. * * Global patch stat data is assembled as - * array(stat_id, seq id, global patch id) = patch stat value. + * vector(stat_id, seq id, global patch id) = patch stat value. * * Global patch stat processor data is assembled as - * array(stat_id, seq id, global proc id) = patch stats summed on + * vector(stat_id, seq id, global proc id) = patch stats summed on * different processors. * * The map of patches to processors is assembled as - * array(stat_id, seq id, global patch id) = proc number. + * vector(stat_id, seq id, global patch id) = proc number. */ bool d_must_call_finalize; bool d_has_gathered_stats; - Array > > d_global_proc_stat_data; + std::vector > > d_global_proc_stat_data; - Array > > d_global_patch_stat_data; - Array > > - d_global_patch_stat_proc_data; - Array > > d_global_patch_stat_mapping; + std::vector > > d_global_patch_stat_data; + std::vector > > d_global_patch_stat_proc_data; + std::vector > > d_global_patch_stat_mapping; /*! - * @brief Array of max-reduced processor stat data. + * @brief Vector of max-reduced processor stat data. * * d_global_proc_stat_max[i][j] is the max over all processors of * the stat id (i) and sequence id (j). */ - Array > d_global_proc_stat_max; + std::vector > d_global_proc_stat_max; /*! * @brief Processor owning the max value of processor stat data. @@ -900,15 +1046,15 @@ class Statistician * d_global_proc_stat_imax[i][j] is the process corresponding to * d_global_proc_stat_max[i][j]. */ - Array > d_global_proc_stat_imax; + std::vector > d_global_proc_stat_imax; /*! - * @brief Array of min-reduced processor stat data. + * @brief Vector of min-reduced processor stat data. * * d_global_proc_stat_min[i][j] is the min over all processors of * the stat id (i) and sequence id (j). */ - Array > d_global_proc_stat_min; + std::vector > d_global_proc_stat_min; /*! * @brief Processor owning the min value of processor stat data. @@ -916,18 +1062,18 @@ class Statistician * d_global_proc_stat_imin[i][j] is the process corresponding to * d_global_proc_stat_max[i][j]. */ - Array > d_global_proc_stat_imin; + std::vector > d_global_proc_stat_imin; /*! - * @brief Array of sum-reduced processor stat data. + * @brief Vector of sum-reduced processor stat data. * * d_global_proc_stat_sum[i][j] is the sum over all processors of * the stat id (i) and sequence id (j). */ - Array > d_global_proc_stat_sum; + std::vector > d_global_proc_stat_sum; /* - * Internal value used to set and grow arrays for storing + * Internal value used to set and grow vectors for storing * statistics. */ static const int DEFAULT_NUMBER_OF_TIMERS_INCREMENT; @@ -953,28 +1099,31 @@ class StatisticRestartDatabase:private Serializable /* * The StatisticRestartDatabase constructor caches a copy of the * database object name and registers the object with the restart - * manager for subsequent restart files if the first boolean argument - * is true. If the run is started froma restart file and the second - * boolean argument is true, we initialize the statistics from restart. + * manager for subsequent restart files. If the run is started from + * a restart file and the boolean argument is true, we initialize + * the statistics from restart. + * + * @pre !object_name.empty() */ StatisticRestartDatabase( const std::string& object_name, - bool register_for_restart, bool read_from_restart); /* * The destructor for StatisticRestartDatabase unregisters - * the database object with the restart manager when so registered. + * the database object with the restart manager. */ virtual ~StatisticRestartDatabase(); /* * Put all statistics and their state in the given restart database. - * This function is overloaded from Serializable. + * This function is inherited from Serializable. + * + * @pre restart_db */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /* * Construct those statistics saved in the restart database. @@ -992,8 +1141,19 @@ class StatisticRestartDatabase:private Serializable } private: + // Unimplemented default constructor. + StatisticRestartDatabase(); + + // Unimplemented default constructor. + StatisticRestartDatabase( + const StatisticRestartDatabase& other); + + // Unimplemented assignment operator. + StatisticRestartDatabase& + operator = ( + const StatisticRestartDatabase& rhs); + std::string d_object_name; - bool d_registered_for_restart; /* * Static integer constant describing this class's version number. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.C index 6044c574..e199c579 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Timer class to track elapsed time in portions of a program. * ************************************************************************/ @@ -125,11 +125,11 @@ Timer::start() if (d_is_running == true) { TBOX_ERROR("Illegal attempt to start timer '" << d_name - << "' when it is already started."); + << "' when it is already started."); } d_is_running = true; - d_accesses++; + ++d_accesses; Clock::timestamp(d_user_start_total, d_system_start_total, @@ -165,7 +165,7 @@ Timer::stop() if (d_is_running == false) { TBOX_ERROR("Illegal attempt to stop timer '" << d_name - << "' when it is already stopped."); + << "' when it is already stopped."); } d_is_running = false; @@ -346,48 +346,47 @@ Timer::computeMaxWallclock() } void -Timer::putUnregisteredToDatabase( - const boost::shared_ptr& db) const +Timer::putToRestart( + const boost::shared_ptr& restart_db) const { #ifdef ENABLE_SAMRAI_TIMERS - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - db->putInteger("TBOX_TIMER_VERSION", - TBOX_TIMER_VERSION); + restart_db->putInteger("TBOX_TIMER_VERSION", TBOX_TIMER_VERSION); - db->putString("d_name", d_name); + restart_db->putString("d_name", d_name); - db->putDouble("d_user_total", d_user_total); - db->putDouble("d_system_total", d_system_total); - db->putDouble("d_wallclock_total", d_wallclock_total); + restart_db->putDouble("d_user_total", d_user_total); + restart_db->putDouble("d_system_total", d_system_total); + restart_db->putDouble("d_wallclock_total", d_wallclock_total); - db->putDouble("d_user_exclusive", d_user_exclusive); - db->putDouble("d_system_exclusive", d_system_exclusive); - db->putDouble("d_wallclock_exclusive", d_wallclock_exclusive); + restart_db->putDouble("d_user_exclusive", d_user_exclusive); + restart_db->putDouble("d_system_exclusive", d_system_exclusive); + restart_db->putDouble("d_wallclock_exclusive", d_wallclock_exclusive); #endif // ENABLE_SAMRAI_TIMERS } void Timer::getFromRestart( - const boost::shared_ptr& db) + const boost::shared_ptr& restart_db) { #ifdef ENABLE_SAMRAI_TIMERS - TBOX_ASSERT(db); + TBOX_ASSERT(restart_db); - int ver = db->getInteger("TBOX_TIMER_VERSION"); + int ver = restart_db->getInteger("TBOX_TIMER_VERSION"); if (ver != TBOX_TIMER_VERSION) { TBOX_ERROR("Restart file version different than class version."); } - d_name = db->getString("d_name"); + d_name = restart_db->getString("d_name"); - d_user_total = db->getDouble("d_user_total"); - d_system_total = db->getDouble("d_system_total"); - d_wallclock_total = db->getDouble("d_wallclock_total"); + d_user_total = restart_db->getDouble("d_user_total"); + d_system_total = restart_db->getDouble("d_system_total"); + d_wallclock_total = restart_db->getDouble("d_wallclock_total"); - d_user_exclusive = db->getDouble("d_user_exclusive"); - d_system_exclusive = db->getDouble("d_system_exclusive"); - d_wallclock_exclusive = db->getDouble("d_wallclock_exclusive"); + d_user_exclusive = restart_db->getDouble("d_user_exclusive"); + d_system_exclusive = restart_db->getDouble("d_system_exclusive"); + d_wallclock_exclusive = restart_db->getDouble("d_wallclock_exclusive"); #endif // ENABLE_SAMRAI_TIMERS } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.h index d0297719..88f5e3de 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Timer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Timer class to track elapsed time in portions of a program. * ************************************************************************/ @@ -16,13 +16,13 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/PIO.h" -#include +#include "boost/shared_ptr.hpp" #include #include #ifdef HAVE_TAU #if (PROFILING_ON || TRACING_ON) -#include +#include "Profile/Profiler.h" #endif #endif @@ -56,7 +56,7 @@ class TimerManager; * Note that the constructor is protected so that timer objects can only * be created by the TimerManager class. * - * @see tbox::TimerManager + * @see TimerManager */ class Timer @@ -80,7 +80,7 @@ class Timer /** * Start the timer if active. * - * It is an error to start a timer that is already started. + * @pre !isActive() || !isRunning() */ void start(); @@ -88,7 +88,7 @@ class Timer /** * Stop the timer if active. * - * It is an error to stop a timer that is already stopped. + * @pre !isActive() || isRunning() */ void stop(); @@ -131,8 +131,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_system_total / Clock::getClockCycle(); + #else return 0.0; + #endif } @@ -144,8 +146,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_user_total / Clock::getClockCycle(); + #else return 0.0; + #endif } @@ -157,8 +161,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_wallclock_total; + #else return 0.0; + #endif } @@ -170,8 +176,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_max_wallclock; + #else return 0.0; + #endif } @@ -183,8 +191,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_system_exclusive / Clock::getClockCycle(); + #else return 0.0; + #endif } @@ -196,8 +206,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_user_exclusive / Clock::getClockCycle(); + #else return 0.0; + #endif } @@ -209,8 +221,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_wallclock_exclusive; + #else return 0.0; + #endif } @@ -222,8 +236,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_is_active; + #else return false; + #endif } @@ -235,8 +251,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_is_running; + #else return false; + #endif } @@ -249,8 +267,10 @@ class Timer { #ifdef ENABLE_SAMRAI_TIMERS return d_accesses; + #else return 0; + #endif } @@ -268,19 +288,22 @@ class Timer computeMaxWallclock(); /** - * Write timer data members to database. + * Write timer data members to restart database. + * + * @pre restart_db */ void - putUnregisteredToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** - * Read restarted times from restart database. When assertion checking - * is on, the database pointer must be non-null. + * Read restarted times from restart database. + * + * @pre restart_db */ void getFromRestart( - const boost::shared_ptr& db); + const boost::shared_ptr& restart_db); protected: /** @@ -324,6 +347,18 @@ class Timer const Timer& timer) const; private: + // Unimplemented default constructor. + Timer(); + + // Unimplemented copy constructor. + Timer( + const Timer& other); + + // Unimplemented assignment operator. + Timer& + operator = ( + const Timer& rhs); + /* * Class name, id, and concurrent timer flag. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.C index de9bc6b3..e52db087 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class to manage different timer objects used throughout the * library. * @@ -18,7 +18,7 @@ #include "SAMRAI/tbox/IOStream.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" #include #ifndef ENABLE_SAMRAI_TIMERS @@ -38,7 +38,7 @@ namespace SAMRAI { namespace tbox { -TimerManager * TimerManager::s_timer_manager_instance = (TimerManager *)NULL; +TimerManager * TimerManager::s_timer_manager_instance = 0; int TimerManager::s_main_timer_identifier = -1; int TimerManager::s_inactive_timer_identifier = -9999; @@ -82,7 +82,7 @@ TimerManager::createManager( } } -TimerManager* +TimerManager * TimerManager::getManager() { if (!s_timer_manager_instance) { @@ -100,7 +100,7 @@ TimerManager::finalizeCallback() { if (s_timer_manager_instance) { delete s_timer_manager_instance; - s_timer_manager_instance = ((TimerManager *)NULL); + s_timer_manager_instance = 0; } } @@ -126,7 +126,7 @@ TimerManager::registerSingletonSubclassInstance( */ TimerManager::TimerManager( - const boost::shared_ptr& input_db) : + const boost::shared_ptr& input_db): #ifdef ENABLE_SAMRAI_TIMERS d_timer_active_access_time(-9999.0), d_timer_inactive_access_time(-9999.0), @@ -214,7 +214,7 @@ TimerManager::checkTimerExistsInArray( timer.reset(); if (!name.empty()) { - for (size_t i = 0; i < timer_array.size(); i++) { + for (size_t i = 0; i < timer_array.size(); ++i) { if (timer_array[i]->getName() == name) { timer_found = true; timer = timer_array[i]; @@ -361,10 +361,10 @@ TimerManager::resetAllTimers() d_main_timer->reset(); d_main_timer->start(); - for (size_t i = 0; i < d_timers.size(); i++) { + for (size_t i = 0; i < d_timers.size(); ++i) { d_timers[i]->reset(); } - for (size_t j = 0; j < d_inactive_timers.size(); j++) { + for (size_t j = 0; j < d_inactive_timers.size(); ++j) { d_inactive_timers[j]->reset(); } #endif @@ -383,7 +383,7 @@ TimerManager::startTime( Timer* timer) { #ifdef ENABLE_SAMRAI_TIMERS - TBOX_ASSERT(!(timer == (Timer *)NULL)); + TBOX_ASSERT(timer != 0); if (timer->isActive()) { } @@ -398,7 +398,7 @@ TimerManager::startTime( } if (d_print_concurrent) { - for (size_t i = 0; i < d_timers.size(); i++) { + for (size_t i = 0; i < d_timers.size(); ++i) { if ((d_timers[i].get() != timer) && d_timers[i]->isRunning()) { d_timers[i]->addConcurrentTimer(*d_timers[i]); } @@ -412,7 +412,7 @@ TimerManager::stopTime( Timer* timer) { #ifdef ENABLE_SAMRAI_TIMERS - TBOX_ASSERT(!(timer == (Timer *)NULL)); + TBOX_ASSERT(timer != 0); if (d_print_exclusive) { timer->stopExclusive(); @@ -479,11 +479,11 @@ TimerManager::checkTimerInNameLists( int occurrences = 0; position = name.find("::"); if (position < name.size()) { - occurrences++; + ++occurrences; std::string substring = name.substr(position + 2); position = substring.find("::"); if (position < substring.size()) { - occurrences++; + ++occurrences; } } @@ -502,7 +502,7 @@ TimerManager::checkTimerInNameLists( bool package_exists = false; string_length = package.size(); for (std::list::iterator i = d_package_names.begin(); - i != d_package_names.end(); i++) { + i != d_package_names.end(); ++i) { list_entry_length = i->size(); if (string_length == list_entry_length) { package_exists = (*i == package); @@ -524,11 +524,11 @@ TimerManager::checkTimerInNameLists( int occurrences = 0; position = name.find("::"); if (position < name.size()) { - occurrences++; + ++occurrences; std::string substring = name.substr(position + 2); position = substring.find("::"); if (position < substring.size()) { - occurrences++; + ++occurrences; } } if (occurrences >= 2) { @@ -577,7 +577,7 @@ TimerManager::checkTimerInNameLists( string_length = nondim_class_name.size(); bool class_exists = false; for (std::list::iterator i = d_class_names.begin(); - i != d_class_names.end(); i++) { + i != d_class_names.end(); ++i) { list_entry_length = i->size(); if (string_length == list_entry_length) { class_exists = (*i == nondim_class_name); @@ -593,7 +593,7 @@ TimerManager::checkTimerInNameLists( string_length = class_name.size(); if (is_dimensional && !class_exists) { for (std::list::iterator i = d_class_names.begin(); - i != d_class_names.end(); i++) { + i != d_class_names.end(); ++i) { list_entry_length = i->size(); if (string_length == list_entry_length) { class_exists = (*i == class_name); @@ -656,7 +656,7 @@ TimerManager::checkTimerInNameLists( bool class_method_exists = false; string_length = nondim_name.size(); for (std::list::iterator i = d_class_method_names.begin(); - i != d_class_method_names.end(); i++) { + i != d_class_method_names.end(); ++i) { list_entry_length = i->size(); if (string_length == list_entry_length) { class_method_exists = (*i == nondim_name); @@ -672,7 +672,7 @@ TimerManager::checkTimerInNameLists( if (is_dimensional && !class_method_exists) { string_length = name.size(); for (std::list::iterator i = d_class_method_names.begin(); - i != d_class_method_names.end(); i++) { + i != d_class_method_names.end(); ++i) { list_entry_length = i->size(); if (string_length == list_entry_length) { class_method_exists = (*i == name); @@ -739,7 +739,7 @@ TimerManager::print( */ double(*timer_values)[18] = new double[d_timers.size() + 1][18]; int(*max_processor_id)[2] = new int[d_timers.size() + 1][2]; - Array timer_names(static_cast(d_timers.size()) + 1); + std::vector timer_names(static_cast(d_timers.size()) + 1); /* * Fill in timer_values and timer_names arrays, based on values of @@ -801,7 +801,7 @@ TimerManager::print( } std::string table_title; - Array column_titles(4); + std::vector column_titles(4); int column_ids[3] = { 0, 0, 0 }; int j, k; @@ -831,12 +831,12 @@ TimerManager::print( column_titles[2] = ""; } - for (k = 0; k < 2; k++) { + for (k = 0; k < 2; ++k) { if ((k == 0 && d_print_exclusive) || (k == 1 && d_print_total)) { - for (j = 0; j < 3; j++) { + for (j = 0; j < 3; ++j) { if ((j == 0 && d_print_processor) || (j == 1 && d_print_summed) || @@ -944,7 +944,7 @@ TimerManager::print( if (case2) { - for (k = 0; k < 2; k++) { + for (k = 0; k < 2; ++k) { if ((k == 0 && d_print_exclusive) || (k == 1 && d_print_total)) { @@ -1162,8 +1162,8 @@ TimerManager::print( void TimerManager::printTable( const std::string& table_title, - const Array column_titles, - const Array timer_names, + const std::vector& column_titles, + const std::vector& timer_names, const int column_ids[], const double timer_values[][18], std::ostream& os) @@ -1191,8 +1191,8 @@ TimerManager::printTable( * Determine maximum name length for formatting */ int maxlen = 10; - for (unsigned int n = 0; n < d_timers.size() + 1; n++) { - i = int(timer_names[n].size()); + for (unsigned int n = 0; n < d_timers.size() + 1; ++n) { + i = static_cast(timer_names[n].size()); if (i > maxlen) maxlen = i; } @@ -1213,7 +1213,7 @@ TimerManager::printTable( } else { os << ascii_line << std::setw(maxlen + 3) << "Timer Name" << ' '; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; ++i) { if (!column_titles[i].empty()) { os << std::setw(15) << column_titles[i].c_str() << " "; } @@ -1227,7 +1227,7 @@ TimerManager::printTable( * - that orders these values. */ int last_nonzero_column = 0; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; ++i) { if (!column_titles[i].empty()) { last_nonzero_column = column_ids[i]; } @@ -1248,7 +1248,7 @@ TimerManager::printTable( * Now output the rows of the table. */ - for (size_t k = 0; k < d_timers.size() + 1; k++) { + for (size_t k = 0; k < d_timers.size() + 1; ++k) { int n = ordered_list[k]; /* @@ -1265,7 +1265,7 @@ TimerManager::printTable( /* * Print column values */ - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; ++i) { /* * Print column values only title is non-null (i.e. not "") @@ -1312,8 +1312,8 @@ TimerManager::printTable( void TimerManager::printTable( const std::string& table_title, - const Array column_titles, - const Array timer_names, + const std::vector& column_titles, + const std::vector& timer_names, const int max_processor_id[][2], const int max_array_id, const int column_ids[], @@ -1341,8 +1341,8 @@ TimerManager::printTable( * Determine maximum name length for formatting */ int maxlen = 10; - for (unsigned int n = 0; n < d_timers.size() + 1; n++) { - i = int(timer_names[n].size()); + for (unsigned int n = 0; n < d_timers.size() + 1; ++n) { + i = static_cast(timer_names[n].size()); if (i > maxlen) maxlen = i; } @@ -1350,7 +1350,7 @@ TimerManager::printTable( * Print table header */ os << std::setw(maxlen + 3) << "Timer Name" << ' '; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; ++i) { if (!column_titles[i].empty()) { os << std::setw(15) << column_titles[i].c_str() << " "; } @@ -1363,7 +1363,7 @@ TimerManager::printTable( * - that orders these values. */ int last_nonzero_column = 0; - for (i = 0; i < 3; i++) { + for (i = 0; i < 3; ++i) { if (!column_titles[i].empty()) { last_nonzero_column = column_ids[i]; } @@ -1383,7 +1383,7 @@ TimerManager::printTable( /* * Now output the rows of the table. */ - for (size_t j = 0; j < d_timers.size() + 1; j++) { + for (size_t j = 0; j < d_timers.size() + 1; ++j) { unsigned int n = ordered_list[j]; /* @@ -1400,7 +1400,7 @@ TimerManager::printTable( /* * Print columns. */ - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; ++i) { /* * Print column values only title is non-null (i.e. not "") @@ -1460,7 +1460,7 @@ TimerManager::printTable( void TimerManager::printOverhead( - const Array timer_names, + const std::vector& timer_names, const double timer_values[][18], std::ostream& os) { @@ -1483,8 +1483,8 @@ TimerManager::printOverhead( * Determine maximum name length for formatting */ int maxlen = 10; - for (unsigned int n = 0; n < d_timers.size(); n++) { - int i = int(timer_names[n].size()); + for (unsigned int n = 0; n < d_timers.size(); ++n) { + int i = static_cast(timer_names[n].size()); if (i > maxlen) maxlen = i; } @@ -1501,7 +1501,7 @@ TimerManager::printOverhead( * Total cost includes inactive timer costs. */ int total_inactive_accesses = 0; - for (size_t i = 0; i < d_inactive_timers.size(); i++) { + for (size_t i = 0; i < d_inactive_timers.size(); ++i) { total_inactive_accesses += d_inactive_timers[i]->getNumberAccesses(); } @@ -1509,7 +1509,7 @@ TimerManager::printOverhead( double total_est_cost = est_cost; int total_accesses = 0; - for (size_t n = 0; n < d_timers.size(); n++) { + for (size_t n = 0; n < d_timers.size(); ++n) { total_accesses += d_timers[n]->getNumberAccesses(); } est_cost = d_timer_active_access_time * total_accesses; @@ -1546,7 +1546,7 @@ TimerManager::printOverhead( * add up the total cost and print it at the end... */ - for (unsigned int n = 0; n < d_timers.size(); n++) { + for (unsigned int n = 0; n < d_timers.size(); ++n) { num_accesses = d_timers[n]->getNumberAccesses(); est_cost = d_timer_active_access_time * num_accesses; @@ -1618,7 +1618,7 @@ TimerManager::printConcurrent( * Determine maximum name length for formatting */ int maxlen = 10; - for (size_t n = 0; n < d_timers.size(); n++) { + for (size_t n = 0; n < d_timers.size(); ++n) { int i = int((d_timers[n]->getName()).size()); if (i > maxlen) maxlen = i; @@ -1635,14 +1635,14 @@ TimerManager::printConcurrent( * Output the rows of the table. */ - for (size_t n = 0; n < d_timers.size(); n++) { + for (size_t n = 0; n < d_timers.size(); ++n) { os << std::setw(maxlen + 3) << d_timers[n]->getName().c_str(); int count = 0; - for (size_t i = 0; i < d_timers.size(); i++) { + for (size_t i = 0; i < d_timers.size(); ++i) { if (d_timers[n]->isConcurrentTimer(*d_timers[i])) { - count++; + ++count; } } if (count == 0) { @@ -1656,7 +1656,7 @@ TimerManager::printConcurrent( * line or subsequent lines. */ count = 0; - for (size_t j = 0; j < d_timers.size(); j++) { + for (size_t j = 0; j < d_timers.size(); ++j) { if (d_timers[n]->isConcurrentTimer(*d_timers[j])) { if (count == 0) { os << std::setw(25) << d_timers[j]->getName().c_str() @@ -1665,7 +1665,7 @@ TimerManager::printConcurrent( os << std::setw(maxlen + 3) << " " << d_timers[j]->getName().c_str() << std::endl; } - count++; + ++count; } } } @@ -1714,7 +1714,7 @@ TimerManager::checkConsistencyAcrossProcessors() mpi.Allreduce(&i, &max_num_timers, 1, MPI_INT, MPI_MAX); } - Array max_timer_lengths(max_num_timers); + std::vector max_timer_lengths(max_num_timers); std::vector rank_of_max(max_num_timers, mpi.getRank()); for (unsigned int i = 0; i < max_num_timers; ++i) { @@ -1724,7 +1724,7 @@ TimerManager::checkConsistencyAcrossProcessors() } if (mpi.getSize() > 1) { - mpi.AllReduce(max_timer_lengths.getPointer(), + mpi.AllReduce(&max_timer_lengths[0], max_num_timers, MPI_MAXLOC, &rank_of_max[0]); @@ -1740,11 +1740,11 @@ TimerManager::checkConsistencyAcrossProcessors() << "\nwill continue for this process, but checking only\n" << d_timers.size() << " timers." << "\nIt is not possible to print global" - << "\nsummed or max timer information."); + << "\nsummed or max timer information." << std::endl); ++inconsistency_count; } - for (unsigned int i = 0; i < d_timers.size(); i++) { + for (unsigned int i = 0; i < d_timers.size(); ++i) { if (max_timer_lengths[i] != int(d_timers[i]->getName().size())) { TBOX_WARNING("Timer[" << i << "]: " << d_timers[i]->getName() << "\nis not consistent across all processors." @@ -1752,7 +1752,7 @@ TimerManager::checkConsistencyAcrossProcessors() << max_timer_lengths[i] << " characters in their names." << "\nIt is not possible to print global" << "\nsummed or max timer information." - ); + << std::endl); ++inconsistency_count; } } @@ -1771,7 +1771,7 @@ TimerManager::checkConsistencyAcrossProcessors() if (inconsistency_count == 0) { TBOX_WARNING("Though this process found no timer inconsistencies," << "\nother processes did. It is not possible to print" - << "\nglobal summed or max timer information."); + << "\nglobal summed or max timer information." << std::endl); } } @@ -1792,7 +1792,7 @@ void TimerManager::buildTimerArrays( double timer_values[][18], int max_processor_id[][2], - Array timer_names) + std::vector& timer_names) { #ifdef ENABLE_SAMRAI_TIMERS const SAMRAI_MPI& mpi(SAMRAI_MPI::getSAMRAIWorld()); @@ -1808,11 +1808,11 @@ TimerManager::buildTimerArrays( /* * Initialize arrays */ - for (unsigned int n = 0; n < d_timers.size() + 1; n++) { + for (unsigned int n = 0; n < d_timers.size() + 1; ++n) { timer_names[n] = ""; max_processor_id[n][0] = 0; max_processor_id[n][1] = 0; - for (int i = 0; i < 18; i++) { + for (int i = 0; i < 18; ++i) { timer_values[n][i] = 0.; } } @@ -1820,7 +1820,7 @@ TimerManager::buildTimerArrays( /* * Build arrays. */ - for (unsigned int n = 0; n < d_timers.size(); n++) { + for (unsigned int n = 0; n < d_timers.size(); ++n) { timer_names[n] = d_timers[n]->getName(); /* @@ -1845,8 +1845,8 @@ TimerManager::buildTimerArrays( * m = 17 : max total wall time */ - for (int k = 0; k < 2; k++) { - for (int j = 0; j < 3; j++) { + for (int k = 0; k < 2; ++k) { + for (int j = 0; j < 3; ++j) { if ((k == 0 && d_print_exclusive) || (k == 1 && d_print_total)) { @@ -2051,9 +2051,8 @@ TimerManager::buildOrderedList( /* * initialize the arrays */ - Array timer_vals; - timer_vals.resizeArray(array_size); - for (int i = 0; i < array_size; i++) { + std::vector timer_vals(array_size); + for (int i = 0; i < array_size; ++i) { index[i] = i; timer_vals[i] = timer_values[i][column]; } @@ -2075,7 +2074,7 @@ TimerManager::buildOrderedList( */ void TimerManager::quicksort( - const Array& a, + const std::vector& a, int index[], int lo, int hi) @@ -2177,41 +2176,39 @@ TimerManager::getFromInput( #ifdef ENABLE_SAMRAI_TIMERS if (input_db) { - d_print_exclusive = input_db->getBoolWithDefault("print_exclusive", - d_print_exclusive); + d_print_exclusive = + input_db->getBoolWithDefault("print_exclusive", false); - d_print_total = input_db->getBoolWithDefault("print_total", - d_print_total); + d_print_total = input_db->getBoolWithDefault("print_total", true); - d_print_processor = input_db->getBoolWithDefault("print_processor", - d_print_processor); + d_print_processor = + input_db->getBoolWithDefault("print_processor", true); - d_print_max = input_db->getBoolWithDefault("print_max", d_print_max); + d_print_max = input_db->getBoolWithDefault("print_max", false); - d_print_summed = input_db->getBoolWithDefault("print_summed", - d_print_summed); + d_print_summed = input_db->getBoolWithDefault("print_summed", false); - d_print_user = input_db->getBoolWithDefault("print_user", d_print_user); + d_print_user = input_db->getBoolWithDefault("print_user", false); - d_print_sys = input_db->getBoolWithDefault("print_sys", d_print_sys); + d_print_sys = input_db->getBoolWithDefault("print_sys", false); - d_print_wall = input_db->getBoolWithDefault("print_wall", d_print_wall); + d_print_wall = input_db->getBoolWithDefault("print_wall", true); - d_print_percentage = input_db->getBoolWithDefault("print_percentage", - d_print_percentage); + d_print_percentage = + input_db->getBoolWithDefault("print_percentage", true); - d_print_concurrent = input_db->getBoolWithDefault("print_concurrent", - d_print_concurrent); + d_print_concurrent = + input_db->getBoolWithDefault("print_concurrent", false); - d_print_timer_overhead = input_db-> - getBoolWithDefault("print_timer_overhead", d_print_timer_overhead); + d_print_timer_overhead = + input_db->getBoolWithDefault("print_timer_overhead", false); - d_print_threshold = input_db-> - getDoubleWithDefault("print_threshold", d_print_threshold); + d_print_threshold = + input_db->getDoubleWithDefault("print_threshold", 0.25); - Array timer_list; + std::vector timer_list; if (input_db->keyExists("timer_list")) { - timer_list = input_db->getStringArray("timer_list"); + timer_list = input_db->getStringVector("timer_list"); } /* @@ -2219,7 +2216,7 @@ TimerManager::getFromInput( * the input file entry to the d_package_names, * d_class_names, and d_class_method_names lists. */ - for (int i = 0; i < timer_list.getSize(); i++) { + for (int i = 0; i < static_cast(timer_list.size()); ++i) { std::string entry = timer_list[i]; addTimerToNameLists(entry); } @@ -2440,7 +2437,7 @@ TimerManager::computeOverheadConstantActiveOrInactive( TimerManager::getManager()->getTimer(inner_name, active)); const int ntest = 1000; - for (int i = 0; i < ntest; i++) { + for (int i = 0; i < ntest; ++i) { outer_timer->start(); inner_timer->start(); inner_timer->stop(); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.h index 11ef4fd2..755bdb00 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/TimerManager.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Singleton timer manager class. * ************************************************************************/ @@ -13,13 +13,12 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/Timer.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -42,106 +41,208 @@ namespace tbox { * * Here `name' is the name string identifier for the timer. * - * The input data is summarized as follows. - * - * Required input keys: NONE - * - * Optional input keys and defaults: - * + * Input Parameters * + * Definitions: * - \b print_exclusive - * (bool) Specifying whether to track and print exclusive times. - * Exclusive times are convenient for identifying time spent inside - * nested routines. Exclusive time is measured by turning off the - * parent timer when the timer in the nested routine is started. - * It then turns on the parent timer again once the nested timer is - * stopped. This option should be used with some discretion - * because the extra overhead to manage the nested list of timers - * is between four and seven times more expensive than doing simple - * start/stop operations (as is done with the print_total option). - * For this reason, we leave it off by default. [FALSE] + * Specifies whether to track and print exclusive times. Exclusive + * times are convenient for identifying time spent inside nested + * routines. This option should be used with some discretion because + * the extra overhead to manage the nested list of timers is between + * four and seven times more expensive than doing simple start/stop + * operations (as is done with the print_total option). For this + * reason, we leave it off by default. * * - \b print_total - * (bool) Specifies whether to print total (i.e. non-nested) time. - * This is the least expensive way to time parts of the code. The - * overhead associated with each start/stop sequence is about - * one-half a millionth of a second. [TRUE] + * Specifies whether to print total (i.e. non-nested) time. This is + * the least expensive way to time parts of the code. The overhead + * associated with each start/stop sequence is about one-half a + * millionth of a second. * - * - \b print_wall - * (bool) Print wallclock time. [TRUE] + * - \b print_processor + * Print times measured on individual processors. + * + * - \b print_max + * Print maximum time spent on any processor, and the processor ID + * that incurred the time. + * + * - \b print_summed + * Print time summed across all processors. * * - \b print_user - * (bool) Print user time (measured by system clock). [FALSE] + * Print user time (measured by system clock). * * - \b print_sys - * (bool) Print system time (measured by system clock). [FALSE] - * - * - \b print_processor - * (bool) Print times measured on individual processors. [TRUE] + * Print system time (measured by system clock). * - * - \b print_summed - * (bool) Print time summed across all processors. [FALSE] + * - \b print_wall + * Print wallclock time. * - * - \b print_max - * (bool) Print maximum time spent on any processor, and the - * processor ID that incurred the time. [FALSE] + * - \b print_percentage + * Prints the percentage of total time with each timer. * * - \b print_concurrent - * (bool) Prints the concurrent timer tree, as determined during - * exclusive timing. That is, for each timer, it prints the list - * of names of the timers in nested routines it calls. [FALSE] - * - * - \b print_percentage - * (bool) Prints the percentage of total time with each timer. [TRUE] + * Prints the concurrent timer tree, as determined during exclusive + * timing. That is, for each timer, it prints the list of names of + * the timers in nested routines it calls. * * - \b print_timer_overhead - * (bool) Prints some overhead stats associated with the timers. - * Information like the number of times a start/stop sequence was - * called for the timer, and the predicted overhead time associated - * with the timer. This is a convenient option to occasionally - * check to make sure the timers themselves are not affecting the - * performance of your calculation. [FALSE] + * Prints some overhead stats associated with the timers. Information + * like the number of times a start/stop sequence was called for the + * timer, and the predicted overhead time associated with the timer. + * This is a convenient option to occasionally check to make sure the + * timers themselves are not affecting the performance of your + * calculation. * * - \b print_threshold - * (double) Timers that use up less than (print_threshold) - * percent of the overall run time are not printed. This can be - * a convenient option to limit output if you have many timers - * invoked. [0.25] + * Timers that use up less than (print_threshold) percent of + * the overall run time are not printed. This can be a convenient + * option to limit output if you have many timers invoked. * * - \b timer_list - * (string array) List of timers to be invoked. The timers can be - * listed individually in package::class::method format or - * the entries may contain wildcards to turn on a set of timers in - * a given package or class: - * \verbatim - * timer_list = "pkg1::*::*", "pkg2::class2::*", ... - * \endverbatim - * - * + * List of timers to be invoked. The timers can be listed individually + * in package::class::method format or the entries may contain + * wildcards to turn on a set of timers in a given package or class:
+ * timer_list = "pkg1::*::*", "pkg2::class2::*", ... + * + * Details:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
parametertypedefaultrangeopt/reqbehavior on restart
print_exclusiveboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_totalboolTRUETRUE, FALSEoptNot written to restart. Value in input db used.
print_processorboolTRUETRUE, FALSEoptNot written to restart. Value in input db used.
print_maxboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_summedboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_userboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_sysboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_wallboolTRUETRUE, FALSEoptNot written to restart. Value in input db used.
print_percentageboolTRUETRUE, FALSEoptNot written to restart. Value in input db used.
print_concurrentboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_timer_overheadboolFALSETRUE, FALSEoptNot written to restart. Value in input db used.
print_thresholddouble0.25any doubleoptNot written to restart. Value in input db used.
timer_listarray of stringsnoneN/AoptNot written to restart. Value in input db used.
* * A sample input file entry might look like: * - * \verbatim - * - * print_exclusive = TRUE - * print_timer_overhead = TRUE - * timer_list = "algs::HyperbolicLevelIntegrator::advanceLevel()", - * "mesh::GriddingAlgorithm::*", - * "xfer::*::*" - * - * \endverbatim + * @code + * print_exclusive = TRUE
+ * print_timer_overhead = TRUE
+ * timer_list = "algs::HyperbolicLevelIntegrator::advanceLevel()",
+ * "mesh::GriddingAlgorithm::*",
+ * "xfer::*::*"
+ * @endcode * * TimerManager expects timer names to be in a certain format to preserve * the wildcard naming capability (i.e. to turn on entire package or class - * of timers). See the PDF document in /SAMRAI/docs/userdocs/timing.pdf - * for a discussion of how to add timers that maintain this format as well - * as a catalog of available timers currently implemented in the library. + * of timers). See the PDF document in + * /SAMRAI/docs/userdocs/Timing-Instrumentation.pdf for a discussion of how + * to add timers that maintain this format as well as a catalog of available + * timers currently implemented in the library. * * Timing recursive function calls will yeild erroneous results and * may lead to memory problems. We recommend {\em not to use timers * to time recursive function calls}. * - * @see tbox::Timer + * @see Timer */ class TimerManager @@ -160,7 +261,8 @@ class TimerManager */ static void createManager( - const boost::shared_ptr& input_db); + const boost::shared_ptr& input_db = + boost::shared_ptr()); /*! * Return a pointer to the singleton instance of the timer manager. @@ -184,8 +286,7 @@ class TimerManager * This argument allows one to override the input file criteria and * turn the timer on anyway. * - * When assertion checking is active, an assertion will result if the - * string is empty. + * @pre !name.empty() */ boost::shared_ptr getTimer( @@ -197,7 +298,8 @@ class TimerManager * exists in the database of timers controlled by the manager. If * a match is found, the timer pointer in the argument list is set * to that timer. Otherwise, return false and return a null pointer. - * If the name string is empty, a null pointer is returned. + * + * @pre !name.empty() */ bool checkTimerExists( @@ -208,6 +310,8 @@ class TimerManager * Return true if a timer whose name matches the argument string * exists in the database of timers and is currently running. * Otherwise, return false. + * + * @pre !name.empty() */ bool checkTimerRunning( @@ -233,7 +337,8 @@ class TimerManager * can have access to the constructor for the class. */ explicit TimerManager( - const boost::shared_ptr& input_db); + const boost::shared_ptr& input_db = + boost::shared_ptr()); /*! * TimerManager is a Singleton class; its destructor is protected. @@ -244,10 +349,12 @@ class TimerManager * Initialize Singleton instance with instance of subclass. This function * is used to make the singleton object unique when inheriting from this * base class. + * + * @pre !s_timer_manager_instance */ void registerSingletonSubclassInstance( - TimerManager* subclass_instance); + TimerManager * subclass_instance); /*! * Mark given timer as running in timer database. @@ -255,11 +362,11 @@ class TimerManager * timer. Also stop exclusive time for timer on top of exclusive timer * stack and push given timer on to that stack. * - * When assertion checking is active, the timer pointer must be non-null. + * @pre timer != 0 */ void startTime( - Timer* timer); + Timer * timer); /*! * Mark given timer as not running in timer database. @@ -267,13 +374,25 @@ class TimerManager * Also, pop timer off top of exclusive timer stack and start exclusive * timer for new top of stack timer. * - * When assertion checking is active, the timer pointer must be non-null. + * @pre timer != 0 */ void stopTime( - Timer* timer); + Timer * timer); private: + // Unimplemented default constructor. + TimerManager(); + + // Unimplemented copy constructor. + TimerManager( + const TimerManager& other); + + // Unimplemented assignment operator. + TimerManager& + operator = ( + const TimerManager& rhs); + /** * Based on the values a user specified in the input database control * activate any existing timers that have already been registered. @@ -307,8 +426,8 @@ class TimerManager void printTable( const std::string& table_title, - const Array column_titles, - const Array timer_names, + const std::vector& column_titles, + const std::vector& timer_names, const int column_ids[], const double timer_values[][18], std::ostream& os); @@ -322,8 +441,8 @@ class TimerManager void printTable( const std::string& table_title, - const Array column_titles, - const Array timer_names, + const std::vector& column_titles, + const std::vector& timer_names, const int max_processor_id[][2], const int max_array_id, const int column_ids[], @@ -335,7 +454,7 @@ class TimerManager */ void printOverhead( - const Array timer_names, + const std::vector& timer_names, const double timer_values[][18], std::ostream& os); @@ -353,7 +472,7 @@ class TimerManager buildTimerArrays( double timer_values[][18], int max_processor_id[][2], - Array timer_names); + std::vector&timer_names); /* * Build an ordered list array, organizing timers largest to smallest. @@ -388,7 +507,7 @@ class TimerManager const boost::shared_ptr& input_db); /* - * Private member used by the above routine (processInputStringData) + * Private member used by the above routine (getFromInput) * and the addTimer routine to add a timer name to the d_package, * d_class, or d_class_method lists. */ @@ -402,9 +521,9 @@ class TimerManager * C++", 3rd Edition, Sedgewick. */ static void - quicksort(const Array&a, - int index[], - int lo, int hi); + quicksort(const std::vector&a, + int index[], + int lo, int hi); /* * Simple methods to compute percentages, given two doubles. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.C index 5e4ad2a1..934e2565 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A simple call sequence tracking class * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.h index e9096bdd..df243a03 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Tracer.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: A simple call sequence tracking class * ************************************************************************/ @@ -72,6 +72,18 @@ class Tracer } private: + // Unimplemented default constructor. + Tracer(); + + // Unimplemented copy constructor. + Tracer( + const Tracer& other); + + // Unimplemented assignment operator. + Tracer& + operator = ( + const Tracer& rhs); + std::string d_message; static std::ostream* s_stream; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.C index b19a52b7..c6bc56b4 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for all schedule transactions * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.h index caf608d4..d5a39a24 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Transaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract base class for all schedule transactions * ************************************************************************/ @@ -113,7 +113,7 @@ class Transaction private: Transaction( const Transaction&); // not implemented - void + Transaction& operator = ( const Transaction&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.C b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.C index c0fbcf77..c120bc4b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility functions for error reporting, file manipulation, etc. * ************************************************************************/ @@ -64,7 +64,7 @@ Utilities::recursiveMkdir( if (path_buf[pos] == seperator) { slash_found = true; if (pos >= 0) path_buf[pos] = '\0'; - } else pos--; + } else --pos; } } @@ -107,7 +107,7 @@ Utilities::recursiveMkdir( null_found = true; path_buf[pos] = seperator; } - pos++; + ++pos; } /* make directory if not at end of path */ @@ -152,6 +152,22 @@ Utilities::intToString( return os.str(); //returns the string form of the stringstream object } +/* + * Routine to convert a size_t to a string. + */ +std::string +Utilities::sizetToString( + size_t num, + int min_width) +{ + int tmp_width = (min_width > 0 ? min_width : 1); + std::ostringstream os; + os << std::setw(tmp_width) << std::setfill('0') << num; + os << std::flush; + + return os.str(); //returns the string form of the stringstream object +} + /* * Routine that calls abort and prints calling location to error stream. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.h b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.h index fd02eb0b..b67178ff 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/Utilities.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Utility functions for error reporting, file manipulation, etc. * ************************************************************************/ @@ -49,7 +49,7 @@ typedef int mode_t; */ #define NULL_USE(variable) \ do { \ - if (0) { char* temp = (char *)&variable; temp++; } \ + if (0) { char* temp = (char *)&variable; ++temp; } \ } while (0) /*! @@ -61,7 +61,7 @@ typedef int mode_t; do { \ std::ostringstream tboxos; \ tboxos << X << std::ends; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } while (0) /*! @@ -71,7 +71,7 @@ typedef int mode_t; do { \ std::ostringstream tboxos; \ tboxos << X << std::ends; \ - tbox::Logger::getInstance()->logWarning( \ + SAMRAI::tbox::Logger::getInstance()->logWarning( \ tboxos.str(), __FILE__, __LINE__); \ } while (0) @@ -82,7 +82,7 @@ typedef int mode_t; do { \ std::ostringstream tboxos; \ tboxos << X << std::ends; \ - tbox::Logger::getInstance()->logDebug( \ + SAMRAI::tbox::Logger::getInstance()->logDebug( \ tboxos.str(), __FILE__, __LINE__); \ } while (0) @@ -99,7 +99,7 @@ typedef int mode_t; if (!(EXP)) { \ std::ostringstream tboxos; \ tboxos << "Failed assertion: " << # EXP << std::ends; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } \ } while (0) #else @@ -125,7 +125,7 @@ typedef int mode_t; if (!(EXP)) { \ std::ostringstream tboxos; \ tboxos << "Failed assertion: " << # EXP << std::endl << # MSG << std::ends; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } \ } while (0) #else @@ -137,6 +137,20 @@ typedef int mode_t; #endif +/*! + */ +#ifdef DEBUG_CHECK_ASSERTIONS + +#define BOOST_CAST boost::dynamic_pointer_cast +#define CPP_CAST dynamic_cast + +#else + +#define BOOST_CAST boost::static_pointer_cast +#define CPP_CAST static_cast + +#endif + /*! * Throw an error assertion from within any C++ source code if the * given expression is not true. This version is used for assertions @@ -153,7 +167,7 @@ typedef int mode_t; if (!(EXP)) { \ std::ostringstream tboxos; \ tboxos << "Failed assertion: " << # EXP << std::ends; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } \ } while (0) #else @@ -165,105 +179,85 @@ typedef int mode_t; #endif -#define TBOX_DIM_ASSERT_CHECK_DIM(dim) \ - TBOX_DIM_ASSERT( \ - (dim).isValid() \ - ) - -#define TBOX_DIM_ASSERT_CHECK_DIM_ALLOW_UNINITIALIZED(dim) \ - TBOX_DIM_ASSERT( \ - !(dim).isInitialized || (dim).isValid() \ - ) - -#define TBOX_DIM_ASSERT_CHECK_ARGS1(arg1) \ - TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() \ - ) - -#define TBOX_DIM_ASSERT_CHECK_ARGS2(arg1, arg2) \ +#define TBOX_ASSERT_OBJDIM_EQUALITY2(arg1, arg2) \ TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ ((arg1).getDim() == (arg2).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_ARGS3(arg1, arg2, arg3) \ - TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ - ((arg1).getDim() == (arg2).getDim()) && \ - ((arg1).getDim() == (arg3).getDim()) \ +#define TBOX_ASSERT_OBJDIM_EQUALITY3(arg1, arg2, arg3) \ + TBOX_DIM_ASSERT( \ + ((arg1).getDim() == (arg2).getDim()) && \ + ((arg1).getDim() == (arg3).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_ARGS4(arg1, arg2, arg3, arg4) \ +#define TBOX_ASSERT_OBJDIM_EQUALITY4(arg1, arg2, arg3, arg4) \ TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ ((arg1).getDim() == (arg2).getDim()) && \ ((arg1).getDim() == (arg3).getDim()) && \ ((arg1).getDim() == (arg4).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_ARGS5(arg1, arg2, arg3, arg4, arg5) \ +#define TBOX_ASSERT_OBJDIM_EQUALITY5(arg1, arg2, arg3, arg4, arg5) \ TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ ((arg1).getDim() == (arg2).getDim()) && \ ((arg1).getDim() == (arg3).getDim()) && \ ((arg1).getDim() == (arg4).getDim()) && \ ((arg1).getDim() == (arg5).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_ARGS6(arg1, arg2, arg3, arg4, arg5, arg6) \ - TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ - ((arg1).getDim() == (arg2).getDim()) && \ - ((arg1).getDim() == (arg3).getDim()) && \ - ((arg1).getDim() == (arg4).getDim()) && \ - ((arg1).getDim() == (arg5).getDim()) && \ - ((arg1).getDim() == (arg6).getDim()) \ +#define TTBOX_ASSERT_OBJDIM_EQUALITY6(arg1, arg2, arg3, arg4, arg5, arg6) \ + TBOX_DIM_ASSERT( \ + ((arg1).getDim() == (arg2).getDim()) && \ + ((arg1).getDim() == (arg3).getDim()) && \ + ((arg1).getDim() == (arg4).getDim()) && \ + ((arg1).getDim() == (arg5).getDim()) && \ + ((arg1).getDim() == (arg6).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_ARGS7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ - TBOX_DIM_ASSERT( \ - (arg1).getDim().isValid() && \ - ((arg1).getDim() == (arg2).getDim()) && \ - ((arg1).getDim() == (arg3).getDim()) && \ - ((arg1).getDim() == (arg4).getDim()) && \ - ((arg1).getDim() == (arg5).getDim()) && \ - ((arg1).getDim() == (arg6).getDim()) && \ - ((arg1).getDim() == (arg7).getDim()) \ +#define TBOX_ASSERT_OBJDIM_EQUALITY7(arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + TBOX_DIM_ASSERT( \ + ((arg1).getDim() == (arg2).getDim()) && \ + ((arg1).getDim() == (arg3).getDim()) && \ + ((arg1).getDim() == (arg4).getDim()) && \ + ((arg1).getDim() == (arg5).getDim()) && \ + ((arg1).getDim() == (arg6).getDim()) && \ + ((arg1).getDim() == (arg7).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(dim, arg1) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(dim, arg1) \ TBOX_DIM_ASSERT( \ - (dim).isValid() && \ ((dim) == (arg1).getDim()) \ ) \ -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(dim, arg1, arg2) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, arg1, arg2) \ TBOX_DIM_ASSERT( \ - (dim).isValid() && \ ((dim) == (arg1).getDim()) && \ ((dim) == (arg2).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(dim, arg1, arg2, arg3) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY3(dim, arg1, arg2, arg3) \ TBOX_DIM_ASSERT( \ - (dim).isValid() && \ ((dim) == (arg1).getDim()) && \ ((dim) == (arg2).getDim()) && \ ((dim) == (arg3).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, arg1, arg2, arg3, arg4) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(dim, arg1, arg2, arg3, arg4) \ TBOX_DIM_ASSERT( \ - (dim).isValid() && \ ((dim) == (arg1).getDim()) && \ ((dim) == (arg2).getDim()) && \ ((dim) == (arg3).getDim()) && \ ((dim) == (arg4).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS5(dim, arg1, arg2, arg3, arg4, arg5) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY5(dim, arg1, arg2, arg3, arg4, arg5) \ TBOX_DIM_ASSERT( \ - (dim).isValid() && \ ((dim) == (arg1).getDim()) && \ ((dim) == (arg2).getDim()) && \ ((dim) == (arg3).getDim()) && \ @@ -271,55 +265,58 @@ typedef int mode_t; ((dim) == (arg5).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS6(dim, arg1, arg2, arg3, arg4, arg5, arg6) \ - TBOX_DIM_ASSERT( \ - (dim).isValid() && \ - ((dim) == (arg1).getDim()) && \ - ((dim) == (arg2).getDim()) && \ - ((dim) == (arg3).getDim()) && \ - ((dim) == (arg4).getDim()) && \ - ((dim) == (arg5).getDim()) && \ - ((dim) == (arg6).getDim()) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY6(dim, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6) \ + TBOX_DIM_ASSERT( \ + ((dim) == (arg1).getDim()) && \ + ((dim) == (arg2).getDim()) && \ + ((dim) == (arg3).getDim()) && \ + ((dim) == (arg4).getDim()) && \ + ((dim) == (arg5).getDim()) && \ + ((dim) == (arg6).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS7(dim, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7) \ - TBOX_DIM_ASSERT( \ - (dim).isValid() && \ - ((dim) == (arg1).getDim()) && \ - ((dim) == (arg2).getDim()) && \ - ((dim) == (arg3).getDim()) && \ - ((dim) == (arg4).getDim()) && \ - ((dim) == (arg5).getDim()) && \ - ((dim) == (arg6).getDim()) && \ - ((dim) == (arg7).getDim()) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY7(dim, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7) \ + TBOX_DIM_ASSERT( \ + ((dim) == (arg1).getDim()) && \ + ((dim) == (arg2).getDim()) && \ + ((dim) == (arg3).getDim()) && \ + ((dim) == (arg4).getDim()) && \ + ((dim) == (arg5).getDim()) && \ + ((dim) == (arg6).getDim()) && \ + ((dim) == (arg7).getDim()) \ ) -#define TBOX_DIM_ASSERT_CHECK_DIM_ARGS8(dim, \ - arg1, \ - arg2, \ - arg3, \ - arg4, \ - arg5, \ - arg6, \ - arg7, \ - arg8) \ - TBOX_DIM_ASSERT( \ - (dim).isValid() && \ - ((dim) == (arg1).getDim()) && \ - ((dim) == (arg2).getDim()) && \ - ((dim) == (arg3).getDim()) && \ - ((dim) == (arg4).getDim()) && \ - ((dim) == (arg5).getDim()) && \ - ((dim) == (arg6).getDim()) && \ - ((dim) == (arg7).getDim()) && \ - ((dim) == (arg8).getDim()) \ +#define TBOX_ASSERT_DIM_OBJDIM_EQUALITY8(dim, \ + arg1, \ + arg2, \ + arg3, \ + arg4, \ + arg5, \ + arg6, \ + arg7, \ + arg8) \ + TBOX_DIM_ASSERT( \ + ((dim) == (arg1).getDim()) && \ + ((dim) == (arg2).getDim()) && \ + ((dim) == (arg3).getDim()) && \ + ((dim) == (arg4).getDim()) && \ + ((dim) == (arg5).getDim()) && \ + ((dim) == (arg6).getDim()) && \ + ((dim) == (arg7).getDim()) && \ + ((dim) == (arg8).getDim()) \ ) #ifdef DEBUG_CHECK_DIM_ASSERTIONS @@ -329,7 +326,7 @@ typedef int mode_t; if (!(EXP)) { \ std::ostringstream tboxos; \ tboxos << "Failed dimension assertion: " << # EXP << std::ends; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } \ } while (0) @@ -359,11 +356,23 @@ typedef int mode_t; do { \ if (ierr) { \ std::ostringstream tboxos; \ - tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ + SAMRAI::tbox::Utilities::abort(tboxos.str(), __FILE__, __LINE__); \ } \ } while (0) #endif +/* + * Macro to indicate deprecated function. If syntax is known for other + * preprocessors please add to this list. + */ +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#define DEPRECATED(func) func +#endif + /*! * Utilities is a Singleton class containing basic routines for error * reporting, file manipulations, etc. @@ -385,6 +394,9 @@ struct Utilities { /*! * Rename a file from old file name to new file name. + * + * @pre !old_filename.empty() + * @pre !new_filename.empty() */ static void renameFile( @@ -413,6 +425,23 @@ struct Utilities { int num, int min_width = 1); + /*! + * Convert a size_t to a string. + * + * The returned string is padded with zeros as needed so that it + * contains at least the number of characters indicated by the + * minimum width argument. When the number is positive, the + * string is padded on the left. When the number is negative, + * the '-' sign appears first, followed by the integer value + * padded on the left with zeros. For example, the statement + * intToString(12, 5) returns "00012" and the statement + * intToString(-12, 5) returns "-0012". + */ + static std::string + sizetToString( + size_t num, + int min_width = 1); + /*! * Convert common integer values to strings. * diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual.dox index f3417de9..58eb70d7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_base.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_base.dox index b724955a..febcdd8e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_base.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_base.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_database.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_database.dox index 4502b134..8eb23b6e 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_database.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_database.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_inputdb.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_inputdb.dox index 3a4f3f8d..6d5b2b31 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_inputdb.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_inputdb.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_memory.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_memory.dox index fca698cc..bd3db4d1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_memory.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_memory.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_parallel.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_parallel.dox index 024b13ad..704e5da8 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_parallel.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_parallel.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_restartdb.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_restartdb.dox index 5f804574..eef4619b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_restartdb.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_restartdb.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_stream.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_stream.dox index d3342561..8447f697 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_stream.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_stream.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_timers.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_timers.dox index 4d99cd28..a62525c1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_timers.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/dox/manual_timers.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/genfiles.sh b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/genfiles.sh index db1b4172..d3496d04 100755 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/genfiles.sh +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/genfiles.sh @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: simple shell script to generate flex and bison files ## ######################################################################### @@ -33,6 +33,7 @@ rm temp.$$ # machine generated code. cat >> temp.$$ <<-EOF #ifdef __GNUC__ +#ifndef __INTEL_COMPILER #if __GNUC__ > 4 || \ (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || \ (__GNUC_MINOR__ == 2 && \ @@ -42,6 +43,7 @@ cat >> temp.$$ <<-EOF #pragma GCC diagnostic ignored "-Wconversion" #endif #endif +#endif #ifdef __INTEL_COMPILER // Ignore Intel warnings about unreachable statements diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/grammer_fixup.pl b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/grammer_fixup.pl index 6eb94e4a..9528ef21 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/grammer_fixup.pl +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/grammer_fixup.pl @@ -5,14 +5,14 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: $Description ## ######################################################################### ## File: $URL$ ## Package: SAMRAI tests -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: Code-generating script in inputdb package. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/scanner_fixup.pl b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/scanner_fixup.pl index f1805186..5595aba1 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/scanner_fixup.pl +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/tbox/scanner_fixup.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Script in input database package. ## ######################################################################### @@ -15,6 +15,8 @@ s/.*Date:.*//; s/.*Header:.*//; + s/#include /#ifdef HAVE_UNISTD_H\n#include \n#endif/; + # substitution to replace [yylval] with SAMRAI_[yylval] s/yylval/SAMRAI_yylval/g; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.C index f7d6f588..c8088b4a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_BoxGeometryVariableFillPattern_C -#define included_xfer_BoxGeometryVariableFillPattern_C - #include "SAMRAI/xfer/BoxGeometryVariableFillPattern.h" #include "SAMRAI/tbox/Utilities.h" @@ -79,10 +75,13 @@ BoxGeometryVariableFillPattern::getStencilWidth() boost::shared_ptr BoxGeometryVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const { + NULL_USE(node_fill_boxes); + /* * For this (default) case, the overlap is simply the intersection of * fill_boxes and data_box. @@ -99,4 +98,3 @@ BoxGeometryVariableFillPattern::computeFillBoxesOverlap( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.h index c9c70727..9e696cf6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/BoxGeometryVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Default fill pattern class * ************************************************************************/ @@ -27,7 +27,7 @@ namespace xfer { * no VariableFillPattern object is provided when a refine operation is * registered with a RefineAlgorithm, this class is used by default. * - * @see xfer::RefineAlgorithm + * @see RefineAlgorithm */ class BoxGeometryVariableFillPattern: @@ -64,6 +64,8 @@ class BoxGeometryVariableFillPattern: * * @return boost::shared_ptr to the calculated overlap * object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() */ boost::shared_ptr calculateOverlap( @@ -78,7 +80,7 @@ class BoxGeometryVariableFillPattern: #ifndef DEBUG_CHECK_DIM_ASSERTIONS NULL_USE(dst_patch_box); #endif - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); return dst_geometry.calculateOverlap(src_geometry, src_mask, fill_box, overwrite_interior, transformation); } @@ -94,6 +96,7 @@ class BoxGeometryVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered representation) + * @param[in] node_fill_boxes node-centered representation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -105,6 +108,7 @@ class BoxGeometryVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -133,7 +137,7 @@ class BoxGeometryVariableFillPattern: private: BoxGeometryVariableFillPattern( const BoxGeometryVariableFillPattern&); // not implemented - void + BoxGeometryVariableFillPattern& operator = ( const BoxGeometryVariableFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.C index 7218e7d8..2b8945c5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Coarsening algorithm for data transfer between AMR levels * ************************************************************************/ - -#ifndef included_xfer_CoarsenAlgorithm_C -#define included_xfer_CoarsenAlgorithm_C - #include "SAMRAI/xfer/CoarsenAlgorithm.h" #include "SAMRAI/xfer/BoxGeometryVariableFillPattern.h" @@ -19,7 +15,7 @@ #include "SAMRAI/hier/PatchDescriptor.h" #include "SAMRAI/hier/VariableDatabase.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace xfer { @@ -38,7 +34,7 @@ CoarsenAlgorithm::CoarsenAlgorithm( const tbox::Dimension& dim, bool fill_coarse_data): d_dim(dim), - d_coarsen_classes(boost::make_shared(d_fill_coarse_data)), + d_coarsen_classes(boost::make_shared()), d_fill_coarse_data(fill_coarse_data), d_schedule_created(false) { @@ -72,12 +68,6 @@ CoarsenAlgorithm::registerCoarsen( const hier::IntVector& gcw_to_coarsen, const boost::shared_ptr& var_fill_pattern) { -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - if (opcoarsen) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *opcoarsen); - } -#endif - if (d_schedule_created) { TBOX_ERROR( "CoarsenAlgorithm::registerCoarsen error..." @@ -121,7 +111,9 @@ CoarsenAlgorithm::createSchedule( CoarsenPatchStrategy* patch_strategy, const boost::shared_ptr& transaction_factory) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, *crse_level, *fine_level); + TBOX_ASSERT(crse_level); + TBOX_ASSERT(fine_level); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, *crse_level, *fine_level); d_schedule_created = true; @@ -133,12 +125,12 @@ CoarsenAlgorithm::createSchedule( } return boost::make_shared( - crse_level, - fine_level, - d_coarsen_classes, - trans_factory, - patch_strategy, - d_fill_coarse_data); + crse_level, + fine_level, + d_coarsen_classes, + trans_factory, + patch_strategy, + d_fill_coarse_data); } void @@ -179,4 +171,3 @@ CoarsenAlgorithm::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.h index d5249ac7..ad1c34a2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenAlgorithm.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Coarsening algorithm for data transfer between AMR levels * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -89,9 +89,9 @@ namespace xfer { * as long as the levels involved in the communication process do not change; * thus, they can be used for multiple data communication cycles. * - * @see xfer::CoarsenSchedule - * @see xfer::CoarsenPatchStrategy - * @see xfer::CoarsenClasses + * @see CoarsenSchedule + * @see CoarsenPatchStrategy + * @see CoarsenClasses */ class CoarsenAlgorithm @@ -181,6 +181,8 @@ class CoarsenAlgorithm * constructed. If the NULL default is used, * then class BoxGeometryVariableFillPattern * will be used internally. + * + * @pre !d_schedule_created */ void registerCoarsen( @@ -219,9 +221,6 @@ class CoarsenAlgorithm * fine level. To avoid potentially erroneous behavior, the coarse level * domain should cover the domain of the fine level. * - * Neither patch level can be null and when assertion checking is active, - * passing a null level pointer will produce an unrecoverable assertion. - * * Note that the schedule remains valid as long as the levels do not * change; thus, it can be used for multiple data communication cycles. * @@ -241,12 +240,16 @@ class CoarsenAlgorithm * pointer is null default state), then a * StandardCoarsenTransactionFactory object * will be used. + * + * @pre crse_level && fine_level + * @pre (getDim() == crse_level->getDim()) && + * (getDim() == fine_level->getDim()) */ boost::shared_ptr createSchedule( const boost::shared_ptr& crse_level, const boost::shared_ptr& fine_level, - CoarsenPatchStrategy * coarsen_strategy = ((CoarsenPatchStrategy *)NULL), + CoarsenPatchStrategy* coarsen_strategy = 0, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -265,6 +268,8 @@ class CoarsenAlgorithm * * @param[in] schedule boost::shared_ptr to coarsen schedule, which cannot * be null. + * + * @pre schedule */ bool checkConsistency( @@ -288,6 +293,9 @@ class CoarsenAlgorithm * * @param[in,out] schedule boost::shared_ptr to coarsen schedule, which * cannot be null. + * + * @pre schedule + * @pre d_coarsen_classes->classesMatch(schedule->getEquivalenceClasses()) */ void resetSchedule( @@ -314,15 +322,10 @@ class CoarsenAlgorithm private: CoarsenAlgorithm( const CoarsenAlgorithm&); // not implemented - void + CoarsenAlgorithm& operator = ( const CoarsenAlgorithm&); // not implemented - //! @brief Shorthand typedef. - typedef hier::Box MBox; - //! @brief Shorthand typedef. - typedef hier::BoxLevel BoxLevel; - /*! * @brief Dimension of the object. */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.C index 193260ea..211830f7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple structure for managing coarsening data in equivalence classes. * ************************************************************************/ - -#ifndef included_xfer_CoarsenClasses_C -#define included_xfer_CoarsenClasses_C - #include "SAMRAI/xfer/CoarsenClasses.h" #include "SAMRAI/hier/IntVector.h" @@ -34,14 +30,10 @@ int CoarsenClasses::s_default_coarsen_item_array_size = 20; ************************************************************************* */ -CoarsenClasses::CoarsenClasses( - bool fill_coarse_data): - d_fill_coarse_data(fill_coarse_data), +CoarsenClasses::CoarsenClasses(): + d_coarsen_classes_data_items(), d_num_coarsen_items(0) { - d_coarsen_classes_data_items.resizeArray( - s_default_coarsen_item_array_size, - Data(tbox::Dimension::getInvalidDimension())); } /* @@ -81,14 +73,15 @@ CoarsenClasses::insertEquivalenceClassItem( int eq_index = getEquivalenceClassIndex(data, descriptor); if (eq_index < 0) { - eq_index = d_equivalence_class_indices.size(); - d_equivalence_class_indices.resizeArray(eq_index + 1); + eq_index = static_cast(d_equivalence_class_indices.size()); + d_equivalence_class_indices.resize(eq_index + 1); } data.d_class_index = eq_index; - if (d_num_coarsen_items >= d_coarsen_classes_data_items.size()) { - d_coarsen_classes_data_items.resizeArray( + if (d_num_coarsen_items >= + static_cast(d_coarsen_classes_data_items.size())) { + d_coarsen_classes_data_items.resize( d_num_coarsen_items + s_default_coarsen_item_array_size, Data(data.d_gcw_to_coarsen.getDim())); } @@ -97,7 +90,7 @@ CoarsenClasses::insertEquivalenceClassItem( d_equivalence_class_indices[eq_index].push_back(d_num_coarsen_items); - d_num_coarsen_items++; + ++d_num_coarsen_items; } } @@ -128,6 +121,7 @@ CoarsenClasses::itemIsValid( if (!pd) { pd = hier::VariableDatabase::getDatabase()->getPatchDescriptor(); } + const tbox::Dimension& dim = pd->getPatchDataFactory(data_item.d_dst)->getDim(); const int dst_id = data_item.d_dst; const int src_id = data_item.d_src; @@ -158,13 +152,13 @@ CoarsenClasses::itemIsValid( boost::shared_ptr coarsop(data_item.d_opcoarsen); if (item_good && coarsop) { - if (coarsop->getStencilWidth() > sfact->getGhostCellWidth()) { + if (coarsop->getStencilWidth(dim) > sfact->getGhostCellWidth()) { item_good = false; TBOX_ERROR("Bad data given to CoarsenClasses...\n" << "Coarsen operator " << coarsop->getOperatorName() << "\nhas larger stencil width than ghost cell width" << "of `Source' patch data" << pd->mapIndexToName(src_id) - << "\noperator stencil width = " << coarsop->getStencilWidth() + << "\noperator stencil width = " << coarsop->getStencilWidth(dim) << "\n`Source' ghost width = " << sfact->getGhostCellWidth() << std::endl); @@ -227,7 +221,7 @@ CoarsenClasses::classesMatch( } // if number of items in equivalence class match - eq_index++; + ++eq_index; } // while equivalence classes match @@ -258,6 +252,7 @@ CoarsenClasses::itemsAreEquivalent( if (!pd) { pd = hier::VariableDatabase::getDatabase()->getPatchDescriptor(); } + const tbox::Dimension& dim = pd->getPatchDataFactory(data1.d_dst)->getDim(); equivalent = patchDataMatch(data1.d_dst, data2.d_dst, pd); @@ -269,8 +264,8 @@ CoarsenClasses::itemsAreEquivalent( equivalent &= (!data1.d_opcoarsen == !data2.d_opcoarsen); if (equivalent && data1.d_opcoarsen) { - equivalent &= (data1.d_opcoarsen->getStencilWidth() == - data2.d_opcoarsen->getStencilWidth()); + equivalent &= (data1.d_opcoarsen->getStencilWidth(dim) == + data2.d_opcoarsen->getStencilWidth(dim)); } equivalent &= (!data1.d_var_fill_pattern == @@ -297,19 +292,19 @@ CoarsenClasses::printClassData( { stream << "CoarsenClasses::printClassData()\n"; stream << "--------------------------------------\n"; - for (int i = 0; i < (int)d_equivalence_class_indices.size(); i++) { + for (int i = 0; i < static_cast(d_equivalence_class_indices.size()); ++i) { stream << "EQUIVALENCE CLASS # " << i << std::endl; int j = 0; const std::list& indices = d_equivalence_class_indices[i]; for (std::list::const_iterator li(indices.begin()); - li != indices.end(); li++) { + li != indices.end(); ++li) { stream << "Item # " << j << std::endl; stream << "-----------------------------\n"; printCoarsenItem(stream, d_coarsen_classes_data_items[*li]); - j++; + ++j; } stream << std::endl; } @@ -343,7 +338,8 @@ CoarsenClasses::printCoarsenItem( << data.d_opcoarsen->getOperatorPriority() << std::endl; stream << "operator stencil width: " - << data.d_opcoarsen->getStencilWidth() + << data.d_opcoarsen->getStencilWidth( + hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataDim(data.d_dst)) << std::endl; } stream << std::endl; @@ -419,7 +415,7 @@ CoarsenClasses::getEquivalenceClassIndex( eq_index = check_index; } - check_index++; + ++check_index; } return eq_index; @@ -439,4 +435,3 @@ CoarsenClasses::Data::Data( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.h index e7f6337e..a4a7f66b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenClasses.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple structure for managing coarsening data in equivalence classes. * ************************************************************************/ @@ -13,14 +13,14 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/hier/CoarsenOperator.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" #include #include +#include namespace SAMRAI { namespace xfer { @@ -110,12 +110,9 @@ class CoarsenClasses }; /*! - * @brief The constructor creates an empty array of coarsen classes. - * - * @deprecated fill_coarse_data is no longer used. + * @brief The default constructor creates an empty array of coarsen classes. */ - explicit CoarsenClasses( - bool fill_coarse_data); + CoarsenClasses(); /*! * @brief The destructor destroys the coarsen data items owned @@ -129,7 +126,7 @@ class CoarsenClasses int getNumberOfEquivalenceClasses() const { - return d_equivalence_class_indices.size(); + return static_cast(d_equivalence_class_indices.size()); } /*! @@ -145,12 +142,13 @@ class CoarsenClasses /*! * @brief Get representative item for a given equivalence class index. * - * When assertion checking is active, the index will be checked for validity. - * * @return Given an index of an existing equivalence class, one item * from that class is returned. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ const CoarsenClasses::Data& getClassRepresentative( @@ -159,7 +157,7 @@ class CoarsenClasses TBOX_ASSERT((equiv_class_index >= 0) && (equiv_class_index < getNumberOfEquivalenceClasses())); return d_coarsen_classes_data_items[ - d_equivalence_class_indices[equiv_class_index].front()]; + d_equivalence_class_indices[equiv_class_index].front()]; } /*! @@ -188,8 +186,7 @@ class CoarsenClasses * * The number of quivalence classes can be determined via the * getNumberOfEquivalenceClasses() member function. Valid integer - * arguments are from 0 to getNumberOfEquivalenceClasses()-1. When - * assertion checking is active, the id will be checked for validity. + * arguments are from 0 to getNumberOfEquivalenceClasses()-1. * * @note The list should not be modified through this iterator. * @@ -199,6 +196,9 @@ class CoarsenClasses * class. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ std::list::iterator getIterator( @@ -215,8 +215,7 @@ class CoarsenClasses * * The number of quivalence classes can be determined via the * getNumberOfEquivalenceClasses() member function. Valid integer - * arguments are from 0 to getNumberOfEquivalenceClasses()-1. When - * assertion checking is active, the id will be checked for validity. + * arguments are from 0 to getNumberOfEquivalenceClasses()-1. * * @note The list should not be modified through this iterator. * @@ -226,6 +225,9 @@ class CoarsenClasses * class. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ std::list::iterator getIteratorEnd( @@ -245,15 +247,14 @@ class CoarsenClasses * this item. The integer class index in the data item will set to the * index of the equivalence class into which it is inserted. * - * If assertion checking is active, the data item will be checked for - * validity. See itemIsValid() for explanation of validity. - * * If a null patch descriptor argument is passed (or ommitted), the * descriptor associated with the variable database Singleton object will be * used. * * @param[in,out] data * @param[in] descriptor + * + * @pre itemIsValid(data, descriptor) */ void insertEquivalenceClassItem( @@ -360,7 +361,7 @@ class CoarsenClasses int getCoarsenItemArraySize() const { - return d_coarsen_classes_data_items.size(); + return static_cast(d_coarsen_classes_data_items.size()); } /*! @@ -379,8 +380,8 @@ class CoarsenClasses const int size, const tbox::Dimension& dim) { - if (size > d_coarsen_classes_data_items.size()) { - d_coarsen_classes_data_items.resizeArray(size, Data(dim)); + if (size > static_cast(d_coarsen_classes_data_items.size())) { + d_coarsen_classes_data_items.resize(size, Data(dim)); } } @@ -455,15 +456,10 @@ class CoarsenClasses */ static int s_default_coarsen_item_array_size; - /*! - * @deprecated No longer used - */ - bool d_fill_coarse_data; - /*! * The array of coarsen items. */ - tbox::Array d_coarsen_classes_data_items; + std::vector d_coarsen_classes_data_items; /*! * The array managing equivalence classes. Each element of the array @@ -471,7 +467,7 @@ class CoarsenClasses * which items are part of an equivalence class. The integers index into * the array d_coarsen_classes_data_items. */ - tbox::Array > d_equivalence_class_indices; + std::vector > d_equivalence_class_indices; /*! * The number of coarsen items that have been registered. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.C index 3bf3f5c6..a6365724 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for data copies during data coarsening * ************************************************************************/ - -#ifndef included_xfer_CoarsenCopyTransaction_C -#define included_xfer_CoarsenCopyTransaction_C - #include "SAMRAI/xfer/CoarsenCopyTransaction.h" #include "SAMRAI/hier/Patch.h" @@ -28,10 +24,6 @@ namespace SAMRAI { namespace xfer { -const CoarsenClasses::Data ** CoarsenCopyTransaction::s_coarsen_items = - (const CoarsenClasses::Data **)NULL; -int CoarsenCopyTransaction::s_num_coarsen_items = 0; - /* ************************************************************************* * @@ -44,34 +36,35 @@ CoarsenCopyTransaction::CoarsenCopyTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - const int coarsen_item_id): - d_dst_patch_rank(dst_mapped_box.getOwnerRank()), - d_src_patch_rank(src_mapped_box.getOwnerRank()), + const hier::Box& dst_box, + const hier::Box& src_box, + const CoarsenClasses::Data** coarsen_data, + int item_id): + d_dst_patch_rank(dst_box.getOwnerRank()), + d_src_patch_rank(src_box.getOwnerRank()), d_overlap(overlap), - d_coarsen_item_id(coarsen_item_id), + d_coarsen_data(coarsen_data), + d_item_id(item_id), d_incoming_bytes(0), d_outgoing_bytes(0) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); TBOX_ASSERT(overlap); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box); - TBOX_ASSERT(dst_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(src_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(coarsen_item_id >= 0); - - // Note: s_num_coarsen_items cannot be used at this point! + dst_box, + src_box); + TBOX_ASSERT(dst_box.getLocalId() >= 0); + TBOX_ASSERT(src_box.getLocalId() >= 0); + TBOX_ASSERT(coarsen_data != 0); + TBOX_ASSERT(item_id >= 0); if (d_dst_patch_rank == dst_level->getBoxLevel()->getMPI().getRank()) { - d_dst_patch = dst_level->getPatch(dst_mapped_box.getGlobalId()); + d_dst_patch = dst_level->getPatch(dst_box.getGlobalId()); } if (d_src_patch_rank == src_level->getBoxLevel()->getMPI().getRank()) { - d_src_patch = src_level->getPatch(src_mapped_box.getGlobalId()); + d_src_patch = src_level->getPatch(src_box.getGlobalId()); } } @@ -93,11 +86,11 @@ CoarsenCopyTransaction::canEstimateIncomingMessageSize() bool can_estimate = false; if (d_src_patch) { can_estimate = - d_src_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_src) + d_src_patch->getPatchData(d_coarsen_data[d_item_id]->d_src) ->canEstimateStreamSizeFromBox(); } else { can_estimate = - d_dst_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_dst) + d_dst_patch->getPatchData(d_coarsen_data[d_item_id]->d_dst) ->canEstimateStreamSizeFromBox(); } return can_estimate; @@ -107,7 +100,7 @@ size_t CoarsenCopyTransaction::computeIncomingMessageSize() { d_incoming_bytes = - d_dst_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_dst) + d_dst_patch->getPatchData(d_coarsen_data[d_item_id]->d_dst) ->getDataStreamSize(*d_overlap); return d_incoming_bytes; } @@ -116,7 +109,7 @@ size_t CoarsenCopyTransaction::computeOutgoingMessageSize() { d_outgoing_bytes = - d_src_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_src) + d_src_patch->getPatchData(d_coarsen_data[d_item_id]->d_src) ->getDataStreamSize(*d_overlap); return d_outgoing_bytes; } @@ -137,7 +130,7 @@ void CoarsenCopyTransaction::packStream( tbox::MessageStream& stream) { - d_src_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_src) + d_src_patch->getPatchData(d_coarsen_data[d_item_id]->d_src) ->packStream(stream, *d_overlap); } @@ -145,7 +138,7 @@ void CoarsenCopyTransaction::unpackStream( tbox::MessageStream& stream) { - d_dst_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_dst) + d_dst_patch->getPatchData(d_coarsen_data[d_item_id]->d_dst) ->unpackStream(stream, *d_overlap); } @@ -153,10 +146,10 @@ void CoarsenCopyTransaction::copyLocalData() { hier::PatchData& dst_data = - *d_dst_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_dst); + *d_dst_patch->getPatchData(d_coarsen_data[d_item_id]->d_dst); const hier::PatchData& src_data = - *d_src_patch->getPatchData(s_coarsen_items[d_coarsen_item_id]->d_src); + *d_src_patch->getPatchData(d_coarsen_data[d_item_id]->d_src); dst_data.copy(src_data, *d_overlap); } @@ -174,18 +167,19 @@ CoarsenCopyTransaction::printClassData( std::ostream& stream) const { stream << "Coarsen Copy Transaction" << std::endl; - stream << " coarsen item array: " - << (CoarsenClasses::Data **)s_coarsen_items << std::endl; - stream << " num coarsen items: " << s_num_coarsen_items << std::endl; + stream << " coarsen item: " + << (CoarsenClasses::Data *)d_coarsen_data[d_item_id] << std::endl; stream << " destination patch rank: " << d_dst_patch_rank << std::endl; stream << " source patch_rank: " << d_src_patch_rank << std::endl; - stream << " coarsen item id: " << d_coarsen_item_id << std::endl; - stream << " destination patch data id: " - << s_coarsen_items[d_coarsen_item_id]->d_dst << std::endl; - stream << " source patch data id: " - << s_coarsen_items[d_coarsen_item_id]->d_src << std::endl; + stream << " coarsen item id: " << d_item_id << std::endl; + if (d_coarsen_data) { + stream << " destination patch data id: " + << d_coarsen_data[d_item_id]->d_dst << std::endl; + stream << " source patch data id: " + << d_coarsen_data[d_item_id]->d_src << std::endl; + } stream << " incoming bytes: " << d_incoming_bytes << std::endl; stream << " outgoing bytes: " << d_outgoing_bytes << std::endl; stream << " destination patch: " @@ -206,5 +200,3 @@ CoarsenCopyTransaction::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.h index 5843f1ba..b61d9494 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenCopyTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for data copies during data * coarsening * @@ -26,16 +26,16 @@ namespace xfer { /*! * @brief Class CoarsenCopyTransaction represents a single copy communication - * transaction between two processors or a local data copy for coaren schedules. - * Note that to there is an implicit hand-shaking between objects of this class - * and the CoarsenSchedule object that constructs them. Following the coarsen - * schedule implementation, the source patch data index for a copy transaction - * always refers to the source data, and the destination patch data index for a copy - * transaction is always the destination data, all as defined in the - * CoarsenClasses class. + * transaction between two processors or a local data copy for coaren + * schedules. Note that to there is an implicit hand-shaking between objects + * of this class and the CoarsenSchedule object that constructs them. + * Following the coarsen schedule implementation, the source patch data index + * for a copy transaction always refers to the source data, and the destination + * patch data index for a copy transaction is always the destination data, all + * as defined in the CoarsenClasses class. * - * @see xfer::CoarsenSchedule - * @see xfer::CoarsenClasses + * @see CoarsenSchedule + * @see CoarsenClasses * @see tbox::Schedule * @see tbox::Transaction */ @@ -43,63 +43,45 @@ namespace xfer { class CoarsenCopyTransaction:public tbox::Transaction { public: - /*! - * Static member function to set the array of coarsen class data items that - * is shared by all object instances of this copy transaction class during - * data transfers. The array must be set before any transactions are executed. - * The array is set in the CoarsenSchedule class. - */ - static void - setCoarsenItems( - const CoarsenClasses::Data** coarsen_items, - int num_coarsen_items) - { - TBOX_ASSERT(coarsen_items != (const CoarsenClasses::Data **)NULL); - TBOX_ASSERT(num_coarsen_items >= 0); - s_coarsen_items = coarsen_items; - s_num_coarsen_items = num_coarsen_items; - } - - /*! - * Static member function to unset the array of coarsen class data items that - * is shared by all object instances of this copy transaction class during - * data transfers. The unset function is used to prevent erroneous execution - * of different schedules. The array is unset in the CoarsenSchedule class. - */ - static void - unsetCoarsenItems() - { - s_coarsen_items = (const CoarsenClasses::Data **)NULL; - s_num_coarsen_items = 0; - } - /*! * Construct a transaction with the specified source and destination * levels, patches, and patch data components found in the coarsen class - * item with the given id owned by the calling coarsen schedule. In general, - * this constructor is called by a CoarsenSchedule object for each data - * transaction (not involving time interpolation) that must occur. This - * transaction will be responsible for one of the following: (1) a local data - * copy, (2) packing a message stream with source patch data, or (3) unpacking - * destination patch data from a message stream. + * item with the given id owned by the calling coarsen schedule. In + * general, this constructor is called by a CoarsenSchedule object for each + * data transaction (not involving time interpolation) that must occur. + * This transaction will be responsible for one of the following: (1) a + * local data copy, (2) packing a message stream with source patch data, or + * (3) unpacking destination patch data from a message stream. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param coarsen_item_id Integer id of coarsen data item owned by coarsen schedule. + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param coarsen_data Pointer to array of coarsen data items + * @param item_id Integer id of coarsen data item owned by coarsen + * schedule. * - * When assertion checking is active, an assertion will result if any of the pointer - * arguments is null, or if any of the integer arguments are invalid (i.e., < 0); + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_box.getDim()) && + * (dst_level->getDim() == src_box.getDim()) + * @pre dst_box.getLocalId() >= 0 + * @pre src_box.getLocalId() >= 0 + * @pre coarsen_data != 0 + * @pre item_id >= 0 */ CoarsenCopyTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - const int coarsen_item_id); + const hier::Box& dst_box, + const hier::Box& src_box, + const CoarsenClasses::Data ** coarsen_data, + int item_id); /*! * The virtual destructor for the copy transaction releases all @@ -111,21 +93,22 @@ class CoarsenCopyTransaction:public tbox::Transaction * Return a boolean indicating whether this transaction can estimate * the size of an incoming message. If this is false, then a different * communication protocol kicks in and the message size is transmitted - * between mapped_boxes. + * between boxes. */ virtual bool canEstimateIncomingMessageSize(); /*! - * Return the integer buffer space (in bytes) needed for the incoming message. - * This routine is only called if the transaction can estimate the + * Return the integer buffer space (in bytes) needed for the incoming + * message. This routine is only called if the transaction can estimate the * size of the incoming message. See canEstimateIncomingMessageSize(). */ virtual size_t computeIncomingMessageSize(); /*! - * Return the integer buffer space (in bytes) needed for the outgoing message. + * Return the integer buffer space (in bytes) needed for the outgoing + * message. */ virtual size_t computeOutgoingMessageSize(); @@ -176,17 +159,15 @@ class CoarsenCopyTransaction:public tbox::Transaction operator = ( const CoarsenCopyTransaction&); // not implemented - static const CoarsenClasses::Data** s_coarsen_items; - static int s_num_coarsen_items; - boost::shared_ptr d_dst_patch; int d_dst_patch_rank; boost::shared_ptr d_src_patch; int d_src_patch_rank; boost::shared_ptr d_overlap; - int d_coarsen_item_id; - int d_incoming_bytes; - int d_outgoing_bytes; + const CoarsenClasses::Data** d_coarsen_data; + int d_item_id; + size_t d_incoming_bytes; + size_t d_outgoing_bytes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.C index f930a1cb..f35b13a2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.C @@ -3,22 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for coarsening AMR data. * ************************************************************************/ - -#ifndef included_xfer_CoarsenPatchStrategy_C -#define included_xfer_CoarsenPatchStrategy_C - #include "SAMRAI/xfer/CoarsenPatchStrategy.h" namespace SAMRAI { namespace xfer { -CoarsenPatchStrategy::CoarsenPatchStrategy( - const tbox::Dimension& dim): - d_dim(dim) +CoarsenPatchStrategy::CoarsenPatchStrategy() { registerObject(); } @@ -43,10 +37,8 @@ CoarsenPatchStrategy::getMaxCoarsenOpStencilWidth( CoarsenPatchStrategy::getCurrentObjects(); for (std::set::const_iterator si = current_objects.begin(); si != current_objects.end(); ++si) { - const CoarsenPatchStrategy* op = *si; - if (op->getDim() == dim) { - max_width.max(op->getCoarsenOpStencilWidth()); - } + const CoarsenPatchStrategy* strategy = *si; + max_width.max(strategy->getCoarsenOpStencilWidth(dim)); } return max_width; @@ -54,4 +46,3 @@ CoarsenPatchStrategy::getMaxCoarsenOpStencilWidth( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.h index d0bea7c3..5d6e8682 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenPatchStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for coarsening AMR data. * ************************************************************************/ @@ -40,8 +40,8 @@ namespace xfer { * coarsening using CoarsenOperators and the postprocess member function is * called afterwards. * - * @see xfer::CoarsenAlgorithm - * @see xfer::CoarsenSchedule + * @see CoarsenAlgorithm + * @see CoarsenSchedule */ class CoarsenPatchStrategy @@ -55,9 +55,7 @@ class CoarsenPatchStrategy * getCoarsenOpStencilWidth() for every CoarsenPatchStrategy of the * given Dimension used in an application. * - * @param[in] dim Only objects with this dimension will be used to - * calculate the max. If a CoarsenPatchStrategy with - * another dimension is registered, it will be ignored. + * @param[in] dim */ static hier::IntVector getMaxCoarsenOpStencilWidth( @@ -69,8 +67,7 @@ class CoarsenPatchStrategy * The constructor will register the constructed object with a static * set that manages all CoarsenPatchStrategy objects in an application. */ - explicit CoarsenPatchStrategy( - const tbox::Dimension& dim); + CoarsenPatchStrategy(); /*! * @brief Destructor. @@ -87,9 +84,12 @@ class CoarsenPatchStrategy * For any user-defined coarsening operations implemented in the * preprocess or postprocess methods, return the maximum stencil needed * on a fine patch to coarsen data to a coarse patch. + * If your implementation doesn't work with the given dimension, return + * zero. */ virtual hier::IntVector - getCoarsenOpStencilWidth() const = 0; + getCoarsenOpStencilWidth( + const tbox::Dimension& dim) const = 0; /*! * @brief Perform user-defined patch data coarsening operations. @@ -139,15 +139,6 @@ class CoarsenPatchStrategy const hier::Box& coarse_box, const hier::IntVector& ratio) = 0; - /*! - * @brief Return the dimension of this object. - */ - const tbox::Dimension& - getDim() const - { - return d_dim; - } - private: /*! * @brief Get the set of CoarsenPatchStrategy objects that have been @@ -160,11 +151,6 @@ class CoarsenPatchStrategy return current_objects; } - /*! - * @brief Dimension of the object. - */ - const tbox::Dimension d_dim; - /*! * @brief Register the object with a set of all CoarsenPatchStrategy * objects used in an application. diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.C index 4a95815c..c075ac2b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.C @@ -3,20 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Coarsening schedule for data transfer between AMR levels * ************************************************************************/ - -#ifndef included_xfer_CoarsenSchedule_C -#define included_xfer_CoarsenSchedule_C - #include "SAMRAI/xfer/CoarsenSchedule.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxGeometry.h" #include "SAMRAI/hier/BoxOverlap.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchDataFactory.h" #include "SAMRAI/hier/PatchDescriptor.h" @@ -28,6 +23,8 @@ #include "SAMRAI/xfer/CoarsenCopyTransaction.h" #include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" +#include + namespace SAMRAI { namespace xfer { @@ -39,14 +36,15 @@ namespace xfer { ************************************************************************* */ -std::string -CoarsenSchedule::s_schedule_generation_method = "DLBG"; +std::string CoarsenSchedule::s_schedule_generation_method = "DLBG"; bool CoarsenSchedule::s_extra_debug = false; +bool CoarsenSchedule::s_barrier_and_time = false; +bool CoarsenSchedule::s_read_static_input = false; +boost::shared_ptr CoarsenSchedule::t_coarsen_schedule; boost::shared_ptr CoarsenSchedule::t_coarsen_data; boost::shared_ptr CoarsenSchedule::t_gen_sched_n_squared; boost::shared_ptr CoarsenSchedule::t_gen_sched_dlbg; -boost::shared_ptr CoarsenSchedule::t_invert_edges; boost::shared_ptr CoarsenSchedule::t_coarse_data_fill; tbox::StartupShutdownManager::Handler @@ -101,20 +99,29 @@ CoarsenSchedule::CoarsenSchedule( CoarsenPatchStrategy* patch_strategy, bool fill_coarse_data): d_number_coarsen_items(0), - d_coarsen_items((const CoarsenClasses::Data **)NULL), + d_coarsen_items(0), d_crse_level(crse_level), d_fine_level(fine_level), d_coarsen_patch_strategy(patch_strategy), d_transaction_factory(transaction_factory), - d_ratio_between_levels(crse_level->getDim()), + d_ratio_between_levels(crse_level->getDim(), + 0, + crse_level->getGridGeometry()->getNumberBlocks()), d_fill_coarse_data(fill_coarse_data) { TBOX_ASSERT(crse_level); TBOX_ASSERT(fine_level); TBOX_ASSERT(coarsen_classes); - TBOX_DIM_ASSERT_CHECK_ARGS2(*crse_level, *fine_level); + TBOX_ASSERT(transaction_factory); + TBOX_ASSERT_OBJDIM_EQUALITY2(*crse_level, *fine_level); - if ( s_extra_debug ) { + getFromInput(); + + if (s_barrier_and_time) { + t_coarsen_schedule->start(); + } + + if (s_extra_debug) { tbox::plog << "CoarsenSchedule::CoarsenSchedule " << this << " entered" << std::endl; } @@ -127,28 +134,32 @@ CoarsenSchedule::CoarsenSchedule( const hier::IntVector& fine(d_fine_level->getRatioToLevelZero()); const hier::IntVector& crse(d_crse_level->getRatioToLevelZero()); - int i; - for (i = 0; i < dim.getValue(); i++) { - if (fine(i) > 1) { - d_ratio_between_levels(i) = fine(i) / crse(i); - } else { - d_ratio_between_levels(i) = tbox::MathUtilities::Abs(crse( - i) / fine(i)); + + const size_t nblocks = d_crse_level->getGridGeometry()->getNumberBlocks(); + + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for (unsigned int i = 0; i < dim.getValue(); ++i) { + if (fine(b,i) > 1) { + d_ratio_between_levels(b,i) = fine(b,i) / crse(b,i); + } else { + d_ratio_between_levels(b,i) = tbox::MathUtilities::Abs(crse( + b,i) / fine(b,i)); + } } } #ifdef DEBUG_CHECK_ASSERTIONS - for (i = 0; i < dim.getValue(); i++) { - TBOX_ASSERT(d_ratio_between_levels(i) != 0); - } - if (dim > tbox::Dimension(1)) - for (i = 0; i < dim.getValue(); i++) { - if (d_ratio_between_levels(i) - * d_ratio_between_levels((i + 1) % dim.getValue()) < 0) { - TBOX_ASSERT((d_ratio_between_levels(i) == 1) || - (d_ratio_between_levels((i + 1) % dim.getValue()) == 1)); + if (dim > tbox::Dimension(1)) { + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { + for (unsigned int i = 0; i < dim.getValue(); ++i) { + if (d_ratio_between_levels(b,i) + * d_ratio_between_levels(b,(i + 1) % dim.getValue()) < 0) { + TBOX_ASSERT((d_ratio_between_levels(b,i) == 1) || + (d_ratio_between_levels(b,(i + 1) % dim.getValue()) == 1)); + } } } + } #endif setCoarsenItems(coarsen_classes); @@ -164,9 +175,13 @@ CoarsenSchedule::CoarsenSchedule( generateSchedule(); - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << "CoarsenSchedule::CoarsenSchedule " << this << " returning" << std::endl; } + + if (s_barrier_and_time) { + t_coarsen_schedule->barrierAndStop(); + } } /* @@ -181,6 +196,31 @@ CoarsenSchedule::CoarsenSchedule( CoarsenSchedule::~CoarsenSchedule() { clearCoarsenItems(); + delete[] d_coarsen_items; +} + +/* + * *********************************************************************** + * + * Read static member data from input database once. + * + * *********************************************************************** + */ +void +CoarsenSchedule::getFromInput() +{ + if (!s_read_static_input) { + s_read_static_input = true; + boost::shared_ptr idb( + tbox::InputManager::getInputDatabase()); + if (idb && idb->isDatabase("CoarsenSchedule")) { + boost::shared_ptr csdb( + idb->getDatabase("CoarsenSchedule")); + s_extra_debug = csdb->getBoolWithDefault("DEV_extra_debug", s_extra_debug); + s_barrier_and_time = + csdb->getBoolWithDefault("DEV_barrier_and_time", s_barrier_and_time); + } + } } /* @@ -232,17 +272,12 @@ CoarsenSchedule::reset( void CoarsenSchedule::coarsenData() const { - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << "CoarsenSchedule::coarsenData " << this << " entered" << std::endl; } - t_coarsen_data->barrierAndStart(); - - /* - * Set the coarsen items for all transactions. These items are - * shared by all transaction objects in the communication schedule. - */ - d_transaction_factory->setCoarsenItems(d_coarsen_items, - static_cast(d_number_coarsen_items)); + if (s_barrier_and_time) { + t_coarsen_data->barrierAndStart(); + } /* * Allocate the source data space on the temporary patch level. @@ -279,18 +314,13 @@ CoarsenSchedule::coarsenData() const d_temp_crse_level->deallocatePatchData(d_sources); - /* - * Unset the coarsen items for the copy transactions. These items - * are shared by all such transaction objects in the communication - * schedule. - */ - d_transaction_factory->unsetCoarsenItems(); - - t_coarsen_data->stop(); - - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << "CoarsenSchedule::coarsenData " << this << " returning" << std::endl; } + + if (s_barrier_and_time) { + t_coarsen_data->stop(); + } } /* @@ -315,54 +345,70 @@ CoarsenSchedule::generateTemporaryLevel() d_temp_crse_level->setNextCoarserHierarchyLevelNumber( d_crse_level->getLevelNumber()); - const hier::IntVector min_gcw = getMaxGhostsToGrow(); + const hier::IntVector max_ghosts = getMaxGhostsToGrow(); + hier::IntVector min_width(dim); + TBOX_ASSERT(d_crse_level->getBoxLevel()->getRefinementRatio() != 0); + if (d_crse_level->getBoxLevel()->getRefinementRatio() > + hier::IntVector::getZero(dim)) { + min_width = + (d_fine_level->getBoxLevel()->getRefinementRatio() + / d_crse_level->getBoxLevel()->getRefinementRatio()) + * max_ghosts; + } else { + TBOX_ASSERT(d_fine_level->getBoxLevel()->getRefinementRatio() >= + hier::IntVector::getOne(dim)); + min_width = + (-d_crse_level->getBoxLevel()->getRefinementRatio() + / d_fine_level->getBoxLevel()->getRefinementRatio()) + * max_ghosts; + } + const hier::IntVector transpose_width = - Connector::convertHeadWidthToBase(d_crse_level->getBoxLevel()->getRefinementRatio(), - d_fine_level->getBoxLevel()->getRefinementRatio(), - min_gcw); + hier::Connector::convertHeadWidthToBase( + d_crse_level->getBoxLevel()->getRefinementRatio(), + d_fine_level->getBoxLevel()->getRefinementRatio(), + min_width); const hier::Connector& coarse_to_fine = - d_crse_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *d_fine_level->getBoxLevel(), - transpose_width); - const hier::Connector& fine_to_coarse = - d_fine_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *d_crse_level->getBoxLevel(), - min_gcw); + d_crse_level->findConnectorWithTranspose(*d_fine_level, + transpose_width, + min_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); /* * Generate temporary BoxLevel and Connectors. */ /* - * Compute d_coarse_to_temp and d_temp_to_coarse. + * Compute d_coarse_to_temp and its transpose. * * We use the fact that d_temp_crse_level patches are numbered just * like the fine level patches. The Connectors between coarse and * temp are very similar to those between coarse and fine. */ - d_coarse_to_temp = coarse_to_fine; - d_coarse_to_temp.setConnectorType(hier::Connector::BASE_GENERATED); - d_coarse_to_temp.setBase(*d_crse_level->getBoxLevel()); - d_coarse_to_temp.setHead(*d_temp_crse_level->getBoxLevel()); - d_coarse_to_temp.setWidth(coarse_to_fine.getConnectorWidth(), true); - d_coarse_to_temp.coarsenLocalNeighbors(d_ratio_between_levels); + d_coarse_to_temp.reset(new hier::Connector(coarse_to_fine)); + d_coarse_to_temp->setBase(*d_crse_level->getBoxLevel()); + d_coarse_to_temp->setHead(*d_temp_crse_level->getBoxLevel()); + d_coarse_to_temp->setWidth(coarse_to_fine.getConnectorWidth(), true); + d_coarse_to_temp->coarsenLocalNeighbors(d_ratio_between_levels); /* - * d_temp_to_coarse is a Connector from a coarsened version of fine to + * temp_to_coarse is a Connector from a coarsened version of fine to * coarse. Therefore it has the same neighborhoods as fine_to_coarse * but it's base, head and width are different. So first assign - * fine_to_coarse to d_temp_to_coarse which will properly set the + * fine_to_coarse to temp_to_coarse which will properly set the * neighborhoods. Then initialize it with the proper base/head/width * keeping the neighborhoods that we just set. */ - d_temp_to_coarse = fine_to_coarse; - d_temp_to_coarse.setConnectorType(hier::Connector::BASE_GENERATED); - d_temp_to_coarse.setBase(*d_temp_crse_level->getBoxLevel()); - d_temp_to_coarse.setHead(coarse_to_fine.getBase()); - d_temp_to_coarse.setWidth(coarse_to_fine.getConnectorWidth(), true); - const hier::IntVector one_vector(dim, 1); - d_coarse_to_temp.shrinkWidth(one_vector); - d_temp_to_coarse.shrinkWidth(one_vector); + hier::Connector* temp_to_coarse = + new hier::Connector(coarse_to_fine.getTranspose()); + temp_to_coarse->setBase(*d_temp_crse_level->getBoxLevel()); + temp_to_coarse->setHead(coarse_to_fine.getBase()); + temp_to_coarse->setWidth(coarse_to_fine.getConnectorWidth(), true); + const hier::IntVector& one_vector(hier::IntVector::getOne(dim)); + d_coarse_to_temp->shrinkWidth(one_vector); + temp_to_coarse->shrinkWidth(one_vector); + d_coarse_to_temp->setTranspose(temp_to_coarse, true); } /* @@ -378,14 +424,12 @@ CoarsenSchedule::generateTemporaryLevel() void CoarsenSchedule::setupRefineAlgorithm() { - const tbox::Dimension& dim(d_crse_level->getDim()); - if (d_fill_coarse_data) { t_coarse_data_fill->barrierAndStart(); - d_precoarsen_refine_algorithm.reset(new RefineAlgorithm(dim)); + d_precoarsen_refine_algorithm.reset(new RefineAlgorithm()); - for (size_t ici = 0; ici < d_number_coarsen_items; ici++) { + for (size_t ici = 0; ici < d_number_coarsen_items; ++ici) { const int src_id = d_coarsen_items[ici]->d_src; d_precoarsen_refine_algorithm->registerRefine(src_id, src_id, @@ -426,7 +470,7 @@ CoarsenSchedule::generateSchedule() t_coarse_data_fill->barrierAndStart(); d_precoarsen_refine_schedule = d_precoarsen_refine_algorithm->createSchedule(d_temp_crse_level, - d_crse_level, NULL); + d_crse_level, 0); t_coarse_data_fill->stop(); } @@ -477,18 +521,19 @@ CoarsenSchedule::generateScheduleNSquared() const hier::ProcessorMapping& src_mapping = d_temp_crse_level->getProcessorMapping(); - hier::BoxContainer::const_iterator crse_itr_dp(d_crse_level->getBoxes()); - for (int dp = 0; dp < dst_npatches; dp++, ++crse_itr_dp) { + hier::BoxContainer::const_iterator crse_itr_dp = + d_crse_level->getBoxes().begin(); + for (int dp = 0; dp < dst_npatches; ++dp, ++crse_itr_dp) { - const hier::Box dst_mapped_box(*crse_itr_dp, - hier::LocalId(dp), - dst_mapping.getProcessorAssignment(dp)); + const hier::Box dst_box(*crse_itr_dp, + hier::LocalId(dp), + dst_mapping.getProcessorAssignment(dp)); - hier::BoxContainer::const_iterator crse_itr_sp( - d_temp_crse_level->getBoxes()); - for (int sp = 0; sp < src_npatches; sp++, ++crse_itr_sp) { + hier::BoxContainer::const_iterator crse_itr_sp = + d_temp_crse_level->getBoxes().begin(); + for (int sp = 0; sp < src_npatches; ++sp, ++crse_itr_sp) { - const hier::Box src_mapped_box( + const hier::Box src_box( *crse_itr_sp, hier::LocalId(sp), src_mapping.getProcessorAssignment(sp)); @@ -496,8 +541,8 @@ CoarsenSchedule::generateScheduleNSquared() if (dst_mapping.isMappingLocal(dp) || src_mapping.isMappingLocal(sp)) { - constructScheduleTransactions(d_crse_level, dst_mapped_box, - d_temp_crse_level, src_mapped_box); + constructScheduleTransactions(d_crse_level, dst_box, + d_temp_crse_level, src_box); } // if either source or destination patch is local @@ -522,71 +567,70 @@ CoarsenSchedule::generateScheduleDLBG() * Construct sending transactions for local src Boxes. */ /* - * Restructure the d_temp_to_coarse edge data to arange neighbors by the - * coarse mapped_boxes, as required to match the transaction ordering on the + * Restructure the temp_to_coarse edge data to arange neighbors by the + * coarse boxes, as required to match the transaction ordering on the * receiving processors. At the same time, shift temp-coarse pairs to * make the coarse shifts zero. */ FullNeighborhoodSet temp_eto_coarse_bycoarse; - t_invert_edges->start(); - restructureNeighborhoodSetsByDstNodes(temp_eto_coarse_bycoarse, d_temp_to_coarse); - t_invert_edges->stop(); + restructureNeighborhoodSetsByDstNodes(temp_eto_coarse_bycoarse, + d_coarse_to_temp->getTranspose()); for (FullNeighborhoodSet::const_iterator ei = temp_eto_coarse_bycoarse.begin(); ei != temp_eto_coarse_bycoarse.end(); ++ei) { /* - * coarse_mapped_box can be remote (by definition of FullNeighborhoodSet). - * local_temp_mapped_boxes are the local source mapped_boxes that - * contribute data to coarse_mapped_box. + * coarse_box can be remote (by definition of FullNeighborhoodSet). + * local_temp_boxes are the local source boxes that contribute data + * to box. */ - const hier::Box& coarse_mapped_box = ei->first; - const hier::BoxContainer& local_temp_mapped_boxes = ei->second; - TBOX_ASSERT(!coarse_mapped_box.isPeriodicImage()); + const hier::Box& coarse_box = ei->first; + const hier::BoxContainer& local_temp_boxes = ei->second; + TBOX_ASSERT(!coarse_box.isPeriodicImage()); /* - * Construct transactions for data going from local source mapped_boxes - * to remote coarse mapped_boxes. + * Construct transactions for data going from local source boxes + * to remote coarse boxes. */ for (hier::BoxContainer::const_iterator ni = - local_temp_mapped_boxes.begin(); - ni != local_temp_mapped_boxes.end(); ++ni) { - const hier::Box& temp_mapped_box = *ni; - if (temp_mapped_box.getOwnerRank() == - coarse_mapped_box.getOwnerRank()) { + local_temp_boxes.begin(); + ni != local_temp_boxes.end(); ++ni) { + const hier::Box& temp_box = *ni; + if (temp_box.getOwnerRank() == + coarse_box.getOwnerRank()) { /* - * Disregard local coarse_mapped_box to avoid duplicating same + * Disregard local coarse_box to avoid duplicating same * transactions created by the second loop below. */ continue; } constructScheduleTransactions(d_crse_level, - coarse_mapped_box, + coarse_box, d_temp_crse_level, - temp_mapped_box); + temp_box); } } /* - * Construct receiving transactions for local dst mapped_boxes. + * Construct receiving transactions for local dst boxes. */ - const BoxLevel& coarse_mapped_box_level = *d_crse_level->getBoxLevel(); - for (hier::Connector::ConstNeighborhoodIterator ei = d_coarse_to_temp.begin(); - ei != d_coarse_to_temp.end(); ++ei) { + const hier::BoxLevel& coarse_box_level = *d_crse_level->getBoxLevel(); + for (hier::Connector::ConstNeighborhoodIterator ei = d_coarse_to_temp->begin(); + ei != d_coarse_to_temp->end(); ++ei) { const hier::BoxId& dst_gid = *ei; - const hier::Box& dst_mapped_box = - *coarse_mapped_box_level.getBoxStrict(dst_gid); + const hier::Box& dst_box = + *coarse_box_level.getBoxStrict(dst_gid); - for (hier::Connector::ConstNeighborIterator ni = d_coarse_to_temp.begin(ei); - ni != d_coarse_to_temp.end(ei); ++ni) { - const hier::Box& src_mapped_box = *ni; + for (hier::Connector::ConstNeighborIterator ni = d_coarse_to_temp->begin(ei); + ni != d_coarse_to_temp->end(ei); ++ni) { + const hier::Box& src_box = *ni; constructScheduleTransactions(d_crse_level, - dst_mapped_box, + dst_box, d_temp_crse_level, - src_mapped_box); + src_box); } @@ -605,52 +649,53 @@ CoarsenSchedule::generateScheduleDLBG() * owners see them. Transactions must have the same order on the * sending and receiving processors. * - * 2. It shifts periodic image dst mapped_boxes back to the zero-shift position, - * and applies a similar shift to src mapped_boxes so that the overlap is + * 2. It shifts periodic image dst boxes back to the zero-shift position, + * and applies a similar shift to src boxes so that the overlap is * unchanged. The constructScheduleTransactions method requires all - * shifts to be absorbed in the src mapped_box. + * shifts to be absorbed in the src box. *********************************************************************** */ void CoarsenSchedule::restructureNeighborhoodSetsByDstNodes( FullNeighborhoodSet& full_inverted_edges, - const Connector& src_to_dst) const + const hier::Connector& src_to_dst) const { const tbox::Dimension& dim(d_crse_level->getDim()); - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(dim); - const BoxLevel& src_mapped_box_level = src_to_dst.getBase(); + const hier::BoxLevel& src_box_level = src_to_dst.getBase(); const hier::IntVector& src_ratio(src_to_dst.getBase().getRefinementRatio()); const hier::IntVector& dst_ratio(src_to_dst.getHead().getRefinementRatio()); + const hier::PeriodicShiftCatalog& shift_catalog = + src_box_level.getGridGeometry()->getPeriodicShiftCatalog(); + /* - * These are the counterparts to shifted dst mapped_boxes and unshifted src - * mapped_boxes. + * These are the counterparts to shifted dst boxes and unshifted src boxes. */ - hier::Box shifted_mapped_box(dim), unshifted_nabr(dim); + hier::Box shifted_box(dim), unshifted_nabr(dim); full_inverted_edges.clear(); for (hier::Connector::ConstNeighborhoodIterator ci = src_to_dst.begin(); ci != src_to_dst.end(); ++ci) { - const hier::Box& mapped_box = - *src_mapped_box_level.getBoxStrict(*ci); + const hier::Box& box = *src_box_level.getBoxStrict(*ci); for (hier::Connector::ConstNeighborIterator na = src_to_dst.begin(ci); na != src_to_dst.end(ci); ++na) { const hier::Box& nabr = *na; if (nabr.isPeriodicImage()) { - shifted_mapped_box.initialize( - mapped_box, - shift_catalog->getOppositeShiftNumber(nabr.getPeriodicId()), - src_ratio); + shifted_box.initialize( + box, + shift_catalog.getOppositeShiftNumber(nabr.getPeriodicId()), + src_ratio, + shift_catalog); unshifted_nabr.initialize( nabr, - shift_catalog->getZeroShiftNumber(), - dst_ratio); + shift_catalog.getZeroShiftNumber(), + dst_ratio, + shift_catalog); - full_inverted_edges[unshifted_nabr].insert(shifted_mapped_box); + full_inverted_edges[unshifted_nabr].insert(shifted_box); } else { - full_inverted_edges[nabr].insert(mapped_box); + full_inverted_edges[nabr].insert(box); } } } @@ -673,18 +718,18 @@ CoarsenSchedule::getMaxGhostsToGrow() const /* * Box, face and side elements of adjacent cells overlap even though * the cells do not overlap. Therefore, we always grow at least one - * cell catch overlaps of mapped_box, face and side elements. + * cell catch overlaps of box, face and side elements. */ hier::IntVector gcw(dim, 1); - for (size_t ici = 0; ici < d_number_coarsen_items; ici++) { + for (size_t ici = 0; ici < d_number_coarsen_items; ++ici) { const int src_id = d_coarsen_items[ici]->d_src; gcw.max(pd->getPatchDataFactory(src_id)->getGhostCellWidth()); hier::IntVector gcw1 = d_coarsen_items[ici]->d_gcw_to_coarsen; if (d_coarsen_items[ici]->d_opcoarsen) { - gcw1 += d_coarsen_items[ici]->d_opcoarsen->getStencilWidth(); + gcw1 += d_coarsen_items[ici]->d_opcoarsen->getStencilWidth(dim); } gcw.max(gcw1); } @@ -705,20 +750,20 @@ CoarsenSchedule::getMaxGhostsToGrow() const void CoarsenSchedule::constructScheduleTransactions( const boost::shared_ptr& dst_level, - const hier::Box& dst_mapped_box, + const hier::Box& dst_box, const boost::shared_ptr& src_level, - const hier::Box& src_mapped_box) + const hier::Box& src_box) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); const tbox::Dimension& dim(d_crse_level->getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(dim, *dst_level, *src_level, - dst_mapped_box, - src_mapped_box); + dst_box, + src_box); const hier::IntVector& constant_zero_intvector(hier::IntVector::getZero(dim)); const hier::IntVector& constant_one_intvector(hier::IntVector::getOne(dim)); @@ -727,10 +772,10 @@ CoarsenSchedule::constructScheduleTransactions( tbox::plog << "CoarsenSchedule::constructScheduleTransactions:" << "\n src: L" << src_level->getLevelNumber() << "R" << src_level->getRatioToLevelZero() - << " / " << src_mapped_box << "" + << " / " << src_box << "" << "\n dst: L" << dst_level->getLevelNumber() << "R" << dst_level->getRatioToLevelZero() - << " / " << dst_mapped_box + << " / " << dst_box << std::endl; } @@ -739,33 +784,32 @@ CoarsenSchedule::constructScheduleTransactions( boost::shared_ptr src_patch_descriptor( src_level->getPatchDescriptor()); - const hier::Box& dst_box = dst_mapped_box; - const hier::Box& src_box = src_mapped_box; - const int num_equiv_classes = d_coarsen_classes->getNumberOfEquivalenceClasses(); - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(dim); + const hier::PeriodicShiftCatalog& shift_catalog = + src_level->getGridGeometry()->getPeriodicShiftCatalog(); /* * Calculate the shift and the shifted source box. */ hier::IntVector src_shift(dim, 0); hier::IntVector dst_shift(dim, 0); - hier::Box unshifted_src_box = src_mapped_box; - hier::Box unshifted_dst_box = dst_mapped_box; - if (src_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); - src_shift = shift_catalog->shiftNumberToShiftDistance( - src_mapped_box.getPeriodicId()); + hier::Box unshifted_src_box = src_box; + hier::Box unshifted_dst_box = dst_box; + const hier::BlockId& dst_block_id = dst_box.getBlockId(); + const hier::BlockId& src_block_id = src_box.getBlockId(); + if (src_box.isPeriodicImage()) { + TBOX_ASSERT(!dst_box.isPeriodicImage()); + src_shift = shift_catalog.shiftNumberToShiftDistance( + src_box.getPeriodicId()); src_shift *= src_level->getRatioToLevelZero(); unshifted_src_box.shift(-src_shift); } - if (dst_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!src_mapped_box.isPeriodicImage()); - dst_shift = shift_catalog->shiftNumberToShiftDistance( - dst_mapped_box.getPeriodicId()); + if (dst_box.isPeriodicImage()) { + TBOX_ASSERT(!src_box.isPeriodicImage()); + dst_shift = shift_catalog.shiftNumberToShiftDistance( + dst_box.getPeriodicId()); dst_shift *= dst_level->getRatioToLevelZero(); unshifted_dst_box.shift(-dst_shift); } @@ -773,27 +817,25 @@ CoarsenSchedule::constructScheduleTransactions( /* * Transformation initialized to src_shift with no rotation. * It will never be modified in single-block runs, nor in multiblock runs - * when src_mapped_box and dst_mapped_box are on the same block. + * when src_box and dst_box are on the same block. */ hier::Transformation transformation(src_shift); /* - * When src_mapped_box and dst_mapped_box are on different blocks + * When src_box and dst_box are on different blocks * transformed_src_box is a representation of the source box in the * destination coordinate system. * * For all other cases, transformed_src_box is simply a copy of the - * box from src_mapped_box. + * box from src_box. */ - hier::Box transformed_src_box(src_mapped_box); + hier::Box transformed_src_box(src_box); /* * When needed, transform the source box and determine if src and * dst touch at an enhance connectivity singularity. */ - if (src_mapped_box.getBlockId() != dst_mapped_box.getBlockId()) { - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); + if (src_block_id != dst_block_id) { boost::shared_ptr grid_geometry( d_crse_level->getGridGeometry()); @@ -802,17 +844,15 @@ CoarsenSchedule::constructScheduleTransactions( grid_geometry->getRotationIdentifier(dst_block_id, src_block_id); hier::IntVector offset( - grid_geometry->getOffset(dst_block_id, src_block_id)); - - offset *= d_crse_level->getRatioToLevelZero(); + grid_geometry->getOffset(dst_block_id, src_block_id, d_crse_level->getLevelNumber())); transformation = hier::Transformation(rotation, offset, - src_block_id, dst_block_id); + src_block_id, dst_block_id); transformation.transform(transformed_src_box); #ifdef DEBUG_CHECK_ASSERTIONS if (grid_geometry->areSingularityNeighbors(dst_block_id, src_block_id)) { - for (int nc = 0; nc < num_equiv_classes; nc++) { + for (int nc = 0; nc < num_equiv_classes; ++nc) { const CoarsenClasses::Data& rep_item = d_coarsen_classes->getClassRepresentative(nc); @@ -825,12 +865,12 @@ CoarsenSchedule::constructScheduleTransactions( } const int num_coarsen_items = d_coarsen_classes->getNumberOfCoarsenItems(); - tbox::Array > transactions( + std::vector > transactions( num_coarsen_items); - for (int nc = 0; nc < num_equiv_classes; nc++) { + for (int nc = 0; nc < num_equiv_classes; ++nc) { - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << " equivalent class " << nc << "/" << num_equiv_classes << std::endl; } const CoarsenClasses::Data& rep_item = @@ -860,7 +900,7 @@ CoarsenSchedule::constructScheduleTransactions( hier::Box src_mask(test_mask); transformation.inverseTransform(src_mask); - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << " dst_gcw = " << dst_gcw << "\n dst_fill_box = " << dst_fill_box << "\n test_mask = " << test_mask @@ -868,7 +908,7 @@ CoarsenSchedule::constructScheduleTransactions( << std::endl; } - if ( ! src_mask.empty() ) { + if (!src_mask.empty()) { // What does this block do? Need comments! test_mask = unshifted_src_box; test_mask.grow( @@ -878,7 +918,7 @@ CoarsenSchedule::constructScheduleTransactions( src_mask += test_mask; } - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << "\n src_mask (after += test_mask) = " << src_mask << std::endl; } @@ -887,7 +927,7 @@ CoarsenSchedule::constructScheduleTransactions( rep_item.d_var_fill_pattern->calculateOverlap( *dst_pdf->getBoxGeometry(unshifted_dst_box), *src_pdf->getBoxGeometry(unshifted_src_box), - dst_mapped_box, + dst_box, src_mask, dst_fill_box, true, transformation)); @@ -899,40 +939,42 @@ CoarsenSchedule::constructScheduleTransactions( << "\n dst box = " << dst_box << "\n src mask = " << src_mask << std::endl); } - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << " Overlap:\n" << std::endl; overlap->print(tbox::plog); } if (!overlap->isOverlapEmpty()) { - if ( s_extra_debug ) { + if (s_extra_debug) { tbox::plog << " Overlap FINITE." << std::endl; } for (std::list::iterator l(d_coarsen_classes->getIterator(nc)); - l != d_coarsen_classes->getIteratorEnd(nc); l++) { + l != d_coarsen_classes->getIteratorEnd(nc); ++l) { const CoarsenClasses::Data& item = d_coarsen_classes->getCoarsenItem(*l); TBOX_ASSERT(item.d_class_index == nc); + TBOX_ASSERT(item.d_tag == *l); + TBOX_ASSERT(&item == d_coarsen_items[*l]); const int citem_count = item.d_tag; transactions[citem_count] = d_transaction_factory->allocate(dst_level, src_level, overlap, - dst_mapped_box, - src_mapped_box, + dst_box, + src_box, + d_coarsen_items, citem_count); } - } - else { - if ( s_extra_debug ) { + } else { + if (s_extra_debug) { tbox::plog << " Overlap empty." << std::endl; } } } // iterate over all coarsen equivalence classes - for (int i = 0; i < num_coarsen_items; i++) { + for (int i = 0; i < num_coarsen_items; ++i) { if (transactions[i]) { d_schedule->appendTransaction(transactions[i]); } @@ -963,24 +1005,26 @@ CoarsenSchedule::coarsenSourceData( d_temp_crse_level->getPatch(fine_patch->getGlobalId())); const hier::Box& box = temp_patch->getBox(); - + const hier::BlockId& block_id = box.getBlockId(); + hier::IntVector block_ratio( + d_ratio_between_levels.getBlockVector(block_id)); /* * Coarsen the fine space onto the temporary coarse space */ if (patch_strategy) { patch_strategy->preprocessCoarsen(*temp_patch, - *fine_patch, box, d_ratio_between_levels); + *fine_patch, box, block_ratio); } - for (size_t ici = 0; ici < d_number_coarsen_items; ici++) { + for (size_t ici = 0; ici < d_number_coarsen_items; ++ici) { const CoarsenClasses::Data * const crs_item = d_coarsen_items[ici]; if (crs_item->d_opcoarsen) { const int source_id = crs_item->d_src; crs_item->d_opcoarsen->coarsen(*temp_patch, *fine_patch, source_id, source_id, - box, d_ratio_between_levels); + box, block_ratio); } } @@ -988,7 +1032,7 @@ CoarsenSchedule::coarsenSourceData( patch_strategy->postprocessCoarsen(*temp_patch, *fine_patch, box, - d_ratio_between_levels); + block_ratio); } } } @@ -1018,7 +1062,7 @@ CoarsenSchedule::setCoarsenItems( */ d_sources.clrAllFlags(); - for (unsigned int nc = 0; nc < d_number_coarsen_items; nc++) { + for (unsigned int nc = 0; nc < d_number_coarsen_items; ++nc) { const CoarsenClasses::Data& item = d_coarsen_classes->getCoarsenItem(nc); d_sources.setFlag(item.d_src); } @@ -1027,14 +1071,16 @@ CoarsenSchedule::setCoarsenItems( * Allocate and initialize array of coarsen items. */ - d_coarsen_items = - new const CoarsenClasses::Data *[d_number_coarsen_items]; + if (!d_coarsen_items) { + d_coarsen_items = + new const CoarsenClasses::Data *[d_number_coarsen_items]; + } int ircount = 0; - for (unsigned int nc = 0; nc < d_number_coarsen_items; nc++) { + for (unsigned int nc = 0; nc < d_number_coarsen_items; ++nc) { d_coarsen_classes->getCoarsenItem(nc).d_tag = ircount; d_coarsen_items[ircount] = &(d_coarsen_classes->getCoarsenItem(nc)); - ircount++; + ++ircount; } } @@ -1066,10 +1112,10 @@ CoarsenSchedule::initialCheckCoarsenClassItems() const hier::IntVector user_gcw(dim, 0); if (d_coarsen_patch_strategy) { - user_gcw = d_coarsen_patch_strategy->getCoarsenOpStencilWidth(); + user_gcw = d_coarsen_patch_strategy->getCoarsenOpStencilWidth(dim); } - for (size_t ici = 0; ici < d_number_coarsen_items; ici++) { + for (size_t ici = 0; ici < d_number_coarsen_items; ++ici) { const CoarsenClasses::Data * const crs_item = d_coarsen_items[ici]; @@ -1096,7 +1142,7 @@ CoarsenSchedule::initialCheckCoarsenClassItems() const << "\n data ghost cell width = " << dst_gcw << std::endl); } - if ((crs_item->d_gcw_to_coarsen * d_ratio_between_levels) > src_gcw) { + if (d_ratio_between_levels * crs_item->d_gcw_to_coarsen > src_gcw) { TBOX_ERROR("Bad data given to CoarsenSchedule...\n" << "`Source' patch data " << pd->mapIndexToName(src_id) << " has ghost cell width too small to support the\n" @@ -1106,7 +1152,7 @@ CoarsenSchedule::initialCheckCoarsenClassItems() const << "d_gcw_to_coarsen = " << crs_item->d_gcw_to_coarsen << "\nratio between levels = " << d_ratio_between_levels << "\n Thus, data ghost width must be >= " - << (crs_item->d_gcw_to_coarsen * d_ratio_between_levels) + << d_ratio_between_levels * crs_item->d_gcw_to_coarsen << std::endl); } @@ -1139,15 +1185,28 @@ void CoarsenSchedule::clearCoarsenItems() { if (d_coarsen_items) { - for (size_t ici = 0; ici < d_number_coarsen_items; ici++) { - d_coarsen_items[ici] = (CoarsenClasses::Data *)NULL; + for (size_t ici = 0; ici < d_number_coarsen_items; ++ici) { + d_coarsen_items[ici] = 0; } - delete[] d_coarsen_items; - d_coarsen_items = (const CoarsenClasses::Data **)NULL; d_number_coarsen_items = 0; } } +/* + ************************************************************************** + ************************************************************************** + */ + +void +CoarsenSchedule::setDeterministicUnpackOrderingFlag(bool flag) +{ + if (d_schedule) { + d_schedule->setDeterministicUnpackOrderingFlag(flag); + } + if (d_precoarsen_refine_schedule) { + d_precoarsen_refine_schedule->setDeterministicUnpackOrderingFlag(flag); + } +} /* * ************************************************************************ @@ -1189,22 +1248,14 @@ CoarsenSchedule::printClassData( void CoarsenSchedule::initializeCallback() { - boost::shared_ptr idb( - tbox::InputManager::getInputDatabase()); - if (idb && idb->isDatabase("CoarsenSchedule")) { - boost::shared_ptr rsdb(idb->getDatabase( - "CoarsenSchedule")); - s_extra_debug = - rsdb->getBoolWithDefault("extra_debug", s_extra_debug); - } + t_coarsen_schedule = tbox::TimerManager::getManager()-> + getTimer("xfer::CoarsenSchedule::CoarsenSchedule()"); t_coarsen_data = tbox::TimerManager::getManager()-> getTimer("xfer::CoarsenSchedule::coarsenData()"); t_gen_sched_n_squared = tbox::TimerManager::getManager()-> getTimer("xfer::CoarsenSchedule::generateScheduleNSquared()"); t_gen_sched_dlbg = tbox::TimerManager::getManager()-> getTimer("xfer::CoarsenSchedule::generateScheduleDLBG()"); - t_invert_edges = tbox::TimerManager::getManager()-> - getTimer("xfer::CoarsenSchedule::generate...()_invert_edges"); t_coarse_data_fill = tbox::TimerManager::getManager()-> getTimer("xfer::CoarsenSchedule::coarse_data_fill"); } @@ -1221,13 +1272,12 @@ CoarsenSchedule::initializeCallback() void CoarsenSchedule::finalizeCallback() { + t_coarsen_schedule.reset(); t_coarsen_data.reset(); t_gen_sched_n_squared.reset(); t_gen_sched_dlbg.reset(); - t_invert_edges.reset(); + t_coarse_data_fill.reset(); } } } - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.h index 720efc9a..7698cda5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenSchedule.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Coarsening schedule for data transfer between AMR levels * ************************************************************************/ @@ -25,7 +25,7 @@ #include "SAMRAI/xfer/RefineSchedule.h" #include "SAMRAI/xfer/CoarsenTransactionFactory.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -60,9 +60,9 @@ namespace xfer { * CoarsenSchedule::setScheduleGenerationMethod(), which * sets the option for all instances of the class. * - * @see xfer::CoarsenAlgorithm - * @see xfer::CoarsenPatchStrategy - * @see xfer::CoarsenClasses + * @see CoarsenAlgorithm + * @see CoarsenPatchStrategy + * @see CoarsenClasses */ class CoarsenSchedule @@ -84,10 +84,6 @@ class CoarsenSchedule * cell width and and they must be filled with valid data before calling * coarsenData(). * - * When assertion checking is active, unrecoverable assertions will result - * if either patch level pointer, the refine classes pointer, or the - * transaction factory pointer, is null. - * * @param[in] crse_level boost::shared_ptr to coarse (destination) * patch level. * @param[in] fine_level boost::shared_ptr to fine (source) patch level. @@ -105,13 +101,19 @@ class CoarsenSchedule * @param[in] fill_coarse_data Boolean indicating whether coarse data * should be filled before coarsening * operations are done. + * + * @pre crse_level + * @pre fine_level + * @pre coarsen_classes + * @pre transaction_factory + * @pre crse_level->getDim() == fine_level->getDim() */ CoarsenSchedule( const boost::shared_ptr& crse_level, const boost::shared_ptr& fine_level, const boost::shared_ptr& coarsen_classes, const boost::shared_ptr& transaction_factory, - CoarsenPatchStrategy * patch_strategy, + CoarsenPatchStrategy* patch_strategy, bool fill_coarse_data); /*! @@ -120,6 +122,12 @@ class CoarsenSchedule */ ~CoarsenSchedule(); + /*! + * @brief Read static data from input database. + */ + void + getFromInput(); + /*! * @brief Reset this coarsen schedule to perform data transfers asssociated * items in the given CoarsenClasses argument. @@ -133,6 +141,8 @@ class CoarsenSchedule * general, this is constructed by the calling * CoarsenAlgorithm object. This pointer must * be non-null. + * + * @pre coarsen_classes */ void reset( @@ -154,6 +164,20 @@ class CoarsenSchedule return d_coarsen_classes; } + /*! + * @brief Set whether to unpack messages in a deterministic order. + * + * By default message unpacking is ordered by receive time, which + * is not deterministic. If your results are dependent on unpack + * ordering and you want deterministic results, set this flag to + * true. + * + * @param [in] flag + */ + void + setDeterministicUnpackOrderingFlag( + bool flag); + /*! * @brief Static function to set box intersection algorithm to use during * schedule construction for all CoarsenSchedule objects. @@ -165,6 +189,8 @@ class CoarsenSchedule * choices are: "DLBG" (default case), * and "ORIG_NSQUARED". More details can be found below * in the comments for the generateSchedule() routine. + * + * @pre (method == "ORIG_NSQUARED") || (method == "DLBG") */ static void setScheduleGenerationMethod( @@ -182,9 +208,9 @@ class CoarsenSchedule private: CoarsenSchedule( const CoarsenSchedule&); // not implemented - void + CoarsenSchedule& operator = ( - const CoarsenSchedule&); // not implemented + const CoarsenSchedule&); // not implemented /*! * @brief Set up things for the entire class. @@ -202,12 +228,6 @@ class CoarsenSchedule static void finalizeCallback(); - //! @brief Shorthand typedef. - typedef hier::LocalId LocalId; - //! @brief Shorthand typedef. - typedef hier::BoxLevel BoxLevel; - //! @brief Shorthand typedef. - typedef hier::Connector Connector; //! @brief Mapping from a (potentially remote) Box to a set of neighbors. typedef std::map FullNeighborhoodSet; @@ -241,6 +261,9 @@ class CoarsenSchedule *
  • if setScheduleGenerationMethod("ORIG_NSQUARED") is called use * generateScheduleNSquared() to generate the schedule. * + * + * @pre (s_schedule_generation_method == "ORIG_NSQUARED") || + * (s_schedule_generation_method == "DLBG") */ void generateSchedule(); @@ -307,17 +330,24 @@ class CoarsenSchedule * data from temporary coarse level to the destination level. * * @param[in] dst_level The destination level for the schedule - * @param[in] dst_mapped_box Owned by a Patch on the destination level + * @param[in] dst_box Owned by a Patch on the destination level * @param[in] src_level The temporary coarse level that will have * coarsened data - * @param[in] src_mapped_box Owned by a Patch on the temporary coarse level + * @param[in] src_box Owned by a Patch on the temporary coarse level + * + * @pre dst_level + * @pre src_level + * @pre (d_crse_level.getDim() == dst_level->getDim()) && + * (d_crse_level.getDim() == src_level->getDim()) && + * (d_crse_level.getDim() == dst_box.getDim()) && + * (d_crse_level.getDim() == src_box.getDim()) */ void constructScheduleTransactions( const boost::shared_ptr& dst_level, - const hier::Box& dst_mapped_box, + const hier::Box& dst_box, const boost::shared_ptr& src_level, - const hier::Box& src_mapped_box); + const hier::Box& src_box); /*! * @brief Restructure the neighborhood sets from a src_to_dst Connector @@ -328,10 +358,10 @@ class CoarsenSchedule * same order that dst owners see them. Transactions must have the same * order on the sending and receiving processors. * - * Section, it shifts periodic image dst mapped_boxes back to the zero-shift - * position, and applies a similar shift to src mapped_boxes so that the + * Section, it shifts periodic image dst boxes back to the zero-shift + * position, and applies a similar shift to src boxes so that the * overlap is unchanged. The constructScheduleTransactions method requires - * all shifts to be absorbed in the src mapped_box. + * all shifts to be absorbed in the src box. * * The restructured neighboorhood sets are added to the output parameter. * @@ -341,7 +371,7 @@ class CoarsenSchedule void restructureNeighborhoodSetsByDstNodes( FullNeighborhoodSet& full_inverted_edges, - const Connector& src_to_dst) const; + const hier::Connector& src_to_dst) const; /*! * @brief Utility function to set up local copies of coarsen items. @@ -389,6 +419,12 @@ class CoarsenSchedule */ static bool s_extra_debug; + /*! + * @brief Flag indicating if any RefineSchedule has read the input database + * for static data. + */ + static bool s_read_static_input; + /*! * @brief Structures that store coarsen data items. */ @@ -412,23 +448,16 @@ class CoarsenSchedule boost::shared_ptr d_temp_crse_level; /*! - * @brief Connector from temporary (coarsened fine) mapped_box_level - * to coarse mapped_box_level. - */ - Connector d_temp_to_coarse; - - /*! - * @brief Connector from coarse mapped_box_level to temporary - * (coarsened fine) mapped_box_level. + * @brief Connector from coarse box_level to temporary + * (coarsened fine) box_level. */ - Connector d_coarse_to_temp; + boost::shared_ptr d_coarse_to_temp; /*! * @brief Object supporting interface to user-defined spatial data * coarsening operations. */ CoarsenPatchStrategy* d_coarsen_patch_strategy; -// RefinePatchStrategy* d_refine_patch_strategy; /*! * @brief Factory object used to create data transactions when schedule is @@ -474,13 +503,18 @@ class CoarsenSchedule //@{ + /*! + * @brief Flag that turns on barrier calls for use in performance analysis. + */ + static bool s_barrier_and_time; + /*! * @name Timer objects for performance measurement. */ + static boost::shared_ptr t_coarsen_schedule; static boost::shared_ptr t_coarsen_data; static boost::shared_ptr t_gen_sched_n_squared; static boost::shared_ptr t_gen_sched_dlbg; - static boost::shared_ptr t_invert_edges; static boost::shared_ptr t_coarse_data_fill; //*} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.C index 9572daea..c4174713 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for factory objects that create transactions for * oarsen schedules. * ************************************************************************/ - -#ifndef included_xfer_CoarsenTransactionFactory_C -#define included_xfer_CoarsenTransactionFactory_C - #include "SAMRAI/xfer/CoarsenTransactionFactory.h" namespace SAMRAI { @@ -35,4 +31,3 @@ CoarsenTransactionFactory::~CoarsenTransactionFactory() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.h index a23e7234..cbea4eb2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CoarsenTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for factory objects that create transactions for * oarsen schedules. * @@ -23,11 +23,11 @@ namespace SAMRAI { namespace xfer { /*! - * @brief Abstract base class defining the interface for all concrete transaction - * factory objects that generate data transaction objects used with a CoarsenSchedule - * object. A concrete subclass will allocate new transaction objects. This class - * is an example of the ``Abstract Factory'' method described in the Design Patterns - * book by Gamma, et al. + * @brief Abstract base class defining the interface for all concrete + * transaction factory objects that generate data transaction objects used with + * a CoarsenSchedule object. A concrete subclass will allocate new transaction + * objects. This class is an example of the ``Abstract Factory'' method + * described in the Design Patterns book by Gamma, et al. * * To add a new type of Transaction object MyCoarsenTransaction: * @@ -37,8 +37,8 @@ namespace xfer { * concrete subclass; in particular, the allocate() function must return * a new instance of the desired transaction object. * -# The type of the transaction allocated by the concrete factory is a - * Transaction. Thus, the new transaction object must be derived - * from the Transaction base class and implement the abstract + * Transaction. Thus, the new transaction object must be derived + * from the Transaction base class and implement the abstract * virtual functions declared by the base class. * * @see tbox::Transaction @@ -58,37 +58,17 @@ class CoarsenTransactionFactory virtual ~CoarsenTransactionFactory(); /*! - * @brief Pure virtual function to set the array of CoarsenClass::Data items - * associated with the coarsen schedule. Typical concrete transactions used by - * the schedule use this information to communicate data. This operation - * is called by the coarsen schedule during the execution of the - * CoarsenSchedule::fillData() routine before data communication - * operations begin. - */ - virtual void - setCoarsenItems( - const CoarsenClasses::Data ** coarsen_items, - int num_coarsen_items) = 0; - - /*! - * @brief Pure virtual function to clear the array of CoarsenClass::Data items - * associated with the coarsen schedule. This operation is called by the - * coarsen schedule after data communication operations are complete. - */ - virtual void - unsetCoarsenItems() = 0; - - /*! - * @brief Pure virtual function to allocate a concrete coarsen transaction object. - * This routine is called by the coarsen schedule during construction of the - * schedule. + * @brief Pure virtual function to allocate a concrete coarsen transaction + * object. This routine is called by the coarsen schedule during + * construction of the schedule. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param citem_id Integer index of CoarsenClass::Data item associated + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param coarsen_data Pointer to array of coarsen data items + * @param item_id Integer index of CoarsenClass::Data item associated * with transaction. */ virtual boost::shared_ptr @@ -96,14 +76,15 @@ class CoarsenTransactionFactory const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int citem_id) const = 0; + const hier::Box& dst_box, + const hier::Box& src_box, + const CoarsenClasses::Data ** coarsen_data, + int item_id) const = 0; private: CoarsenTransactionFactory( - const CoarsenTransactionFactory&); // not implemented - void + const CoarsenTransactionFactory&); // not implemented + CoarsenTransactionFactory& operator = ( const CoarsenTransactionFactory&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.C new file mode 100644 index 00000000..6d0d4b46 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.C @@ -0,0 +1,91 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Manages data on stencils at coarse-fine boundaries + * + ************************************************************************/ +#include "SAMRAI/xfer/CompositeBoundaryAlgorithm.h" + +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/HierarchyNeighbors.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" +#include "SAMRAI/xfer/PatchInteriorVariableFillPattern.h" +#include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace xfer { + +/* + ************************************************************************* + * + * Constructor + * + ************************************************************************* + */ + +CompositeBoundaryAlgorithm::CompositeBoundaryAlgorithm( + boost::shared_ptr& hierarchy, + int stencil_width) +: d_hierarchy(hierarchy), + d_stencil_width(stencil_width), + d_schedule_created(false) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT(stencil_width >= 1); +} + +/* + ************************************************************************* + * + * Destructor explicitly deallocates PatchData + * + ************************************************************************* + */ + +CompositeBoundaryAlgorithm::~CompositeBoundaryAlgorithm() +{ +} + +/* + ************************************************************************* + * + * Creates a stencil at the coarse-fine boundary of the given level + * + ************************************************************************* + */ + +boost::shared_ptr +CompositeBoundaryAlgorithm::createSchedule(int level_num) +{ + d_schedule_created = true; + + return boost::make_shared( + d_hierarchy, + level_num, + d_stencil_width, + d_data_ids); + +} + +void CompositeBoundaryAlgorithm::addDataId(int data_id) +{ + TBOX_ASSERT(data_id >= 0); + + if (d_schedule_created) { + TBOX_ERROR("CompositeBoundaryAlgorithm::addDataId error: No data ids may be added after creating a CompositeBoundarySchedule." << std::endl); + } + + d_data_ids.insert(data_id); +} + + + + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.h new file mode 100644 index 00000000..1cc582e3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundaryAlgorithm.h @@ -0,0 +1,135 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Manages PatchData objects created at coarse-fine stencils + * + ************************************************************************/ + +#ifndef included_xfer_CompositeBoundaryAlgorithm +#define included_xfer_CompositeBoundaryAlgorithm + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/xfer/CompositeBoundarySchedule.h" + +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace xfer { + +/*! + * @brief Class CompositeBoundaryAlgorithm describes a pattern for + * a communication and representation of data at coarse-fine boundaries. + * + * The purpose of this class is to allow an application code that is operating + * on a particular Patch from a PatchHierarchy to have a local view into data + * from the next finer level that exists within a certain stencil width of the + * Patch's coarse-fine boundaries (if it has any). + * + * CompositeBoundaryAlgorithm holds the the desired stencil width for + * a composite boundary description, and manages the patch data ids for + * the data that is desired to be accessed at the composity boundaries. + * The stencil width and data ids should be set once in the life of an + * instance of this object. Once its state is set, CompositeBoundaryAlglorithm + * can repeatedly call createSchedule to create new CompositeBoundarySchedules + * at different levels and at different times in the run of an application. + * + * @see CompositeBoundarySchedule + */ + +class CompositeBoundaryAlgorithm +{ +public: + + /*! + * @brief Constructor sets up basic state + * + * The constructor associates the CompositeBoundaryAlgorithm with a hierarchy + * and a stencil width. + * + * The stencil width is interpreted in terms of the resolution of finer + * levels. So if the value is 4, that means that code operating on level n + * will be able to see a coarse-fine stencil of width 4 in the mesh + * resolution of level n + 1; + * + * @param[in] hierarchy + * @param[in] stencil_width + * + * @pre hierarchy != 0 + * @pre stencil_width >= 1 + */ + CompositeBoundaryAlgorithm( + boost::shared_ptr& hierarchy, + int stencil_width); + + /*! + * @brief Destructor + */ + ~CompositeBoundaryAlgorithm(); + + /*! + * @brief Add a patch data id to identify data to be managed on the stencils. + * + * This may be called multiple times to add as many data ids as desired, + * but all data ids must be added prior to calling createSchedule(). + * + * @param[in] data_id + * + * @pre data_id >= 0 + */ + void addDataId(int data_id); + + /*! + * @brief Create a CompositeBoundarySchedule to communicate and manage + * data at the coarse-fine boundaries + * + * The given level number represents a level from the hierarchy. The + * communicate data from the next finer level of resolution. + * + * This method should be called to create a new schedule after the level + * represented by level_num and/or the next finer level have been regridded. + * + * @param level_num level number for a level from hierarchy. + */ + boost::shared_ptr + createSchedule(int level_num); + +private: + CompositeBoundaryAlgorithm( + const CompositeBoundaryAlgorithm&); // not implemented + CompositeBoundaryAlgorithm& + operator = ( + const CompositeBoundaryAlgorithm&); // not implemented + + /*! + * @brief Hierarchy where the stencils exist + */ + boost::shared_ptr d_hierarchy; + + /*! + * @brief Width of the stencils. The width represents a width in + * terms of fine resolution at coarse-fine boundaries. + */ + int d_stencil_width; + + /*! + * @brief Patch data ids for data to be held on the stencil. + */ + std::set d_data_ids; + + /*! + * @brief Flag telling that a schedule has been created. This prevents + * new data ids from being added. + */ + bool d_schedule_created; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.C new file mode 100644 index 00000000..953a1f99 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.C @@ -0,0 +1,465 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Manages data on stencils at coarse-fine boundaries + * + ************************************************************************/ +#include "SAMRAI/xfer/CompositeBoundarySchedule.h" + +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/HierarchyNeighbors.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" +#include "SAMRAI/xfer/PatchInteriorVariableFillPattern.h" +#include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" + +#include "boost/make_shared.hpp" + +namespace SAMRAI { +namespace xfer { + +/* + ************************************************************************* + * + * Constructor + * + ************************************************************************* + */ + +CompositeBoundarySchedule::CompositeBoundarySchedule( + const boost::shared_ptr& hierarchy, + int coarse_level_num, + int stencil_width, + const std::set& data_ids) +: d_hierarchy(hierarchy), + d_coarse_level_num(coarse_level_num), + d_stencil_width(stencil_width), + d_data_ids(data_ids) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT(coarse_level_num <= hierarchy->getFinestLevelNumber()); + TBOX_ASSERT(stencil_width >= 1); + registerDataIds(); + createStencilForLevel(); +} + +/* + ************************************************************************* + * + * Destructor explicitly deallocates PatchData + * + ************************************************************************* + */ + +CompositeBoundarySchedule::~CompositeBoundarySchedule() +{ + if (d_stencil_level.get() != 0) { + for (std::set::const_iterator ditr = d_data_ids.begin(); + ditr != d_data_ids.end(); ++ditr) { + + if (d_stencil_level->checkAllocated(*ditr)) { + d_stencil_level->deallocatePatchData(*ditr); + } + } + } +} + +/* + ************************************************************************* + * + * Creates a stencil at the coarse-fine boundary of the given level + * + ************************************************************************* + */ + +void +CompositeBoundarySchedule::createStencilForLevel() +{ + int level_num = d_coarse_level_num; + TBOX_ASSERT(level_num >= 0 && + level_num <= d_hierarchy->getFinestLevelNumber()); + + const tbox::Dimension& dim = d_hierarchy->getDim(); + + d_stencil_level.reset(); + + if (level_num < d_hierarchy->getFinestLevelNumber()) { + + hier::IntVector stencil_vec(dim, d_stencil_width); + + hier::HierarchyNeighbors hier_nbrs(*d_hierarchy, + level_num, + level_num+1, + false, + d_stencil_width); + + const boost::shared_ptr& grid_geom = + d_hierarchy->getGridGeometry(); + + const boost::shared_ptr& level = + d_hierarchy->getPatchLevel(level_num); + const boost::shared_ptr& finer_level = + d_hierarchy->getPatchLevel(level_num+1); + + boost::shared_ptr stencil_box_level = + boost::make_shared( + finer_level->getRatioToLevelZero(), + grid_geom); + + hier::IntVector ratio(d_hierarchy->getRatioToCoarserLevel(level_num+1)); + + hier::IntVector s_to_c_width( + d_hierarchy->getRequiredConnectorWidth(level_num+1, level_num)); + s_to_c_width.max(stencil_vec); + + int num_blocks = d_hierarchy->getNumberBlocks(); + for (hier::BlockId::block_t blk = 0; blk < num_blocks; ++blk) { + for (unsigned int i = 0; i < dim.getValue(); ++i) { + while (s_to_c_width(blk,i) % ratio(blk,i) != 0) { + ++(s_to_c_width(blk,i)); + } + } + } + + hier::IntVector c_to_s_width(s_to_c_width / ratio); + + hier::Connector coarse_to_stencil( + *level->getBoxLevel(), + *stencil_box_level, + c_to_s_width); + + hier::Connector stencil_to_coarse( + *stencil_box_level, + *level->getBoxLevel(), + s_to_c_width); + + hier::LocalId stencil_local_id(-1); + hier::LocalId coarse_local_id(-1); + for (hier::PatchLevel::iterator itr = level->begin(); itr != level->end(); + ++itr) { + const boost::shared_ptr& patch(*itr); + const hier::Box& patch_box = patch->getBox(); + const hier::BoxId& box_id = patch_box.getBoxId(); + + const hier::BoxContainer& finer_nbrs = + hier_nbrs.getFinerLevelNeighbors(patch_box, level_num); + + hier::BoxContainer finer_tree(finer_nbrs); + finer_tree.makeTree(&(*grid_geom)); + + const hier::IntVector& level_ratio( + d_hierarchy->getRatioToCoarserLevel(level_num+1)); + hier::BoxContainer uncovered_fine(patch_box); + uncovered_fine.refine(level_ratio); + uncovered_fine.removeIntersections(finer_level->getRatioToLevelZero(), + finer_tree, + true); + uncovered_fine.coalesce(); + + hier::BoxContainer& uncovered_boxes = + d_patch_to_uncovered[box_id]; + + for (hier::BoxContainer::iterator uitr = uncovered_fine.begin(); + uitr != uncovered_fine.end(); ++uitr) { + ++coarse_local_id; + hier::Box add_box(*uitr, coarse_local_id, box_id.getOwnerRank()); + add_box.coarsen(level_ratio); + uncovered_boxes.insert(uncovered_boxes.end(), add_box); + } + + for (hier::BoxContainer::iterator uitr = uncovered_boxes.begin(); + uitr != uncovered_boxes.end(); ++uitr) { + hier::BoxContainer grow_boxes(*uitr); + grow_boxes.refine(level_ratio); + grow_boxes.grow(stencil_vec); + grow_boxes.intersectBoxes(finer_level->getRatioToLevelZero(), + finer_tree, true); + grow_boxes.coalesce(); + + for (hier::BoxContainer::iterator gitr = grow_boxes.begin(); + gitr != grow_boxes.end(); ++gitr) { + ++stencil_local_id; + hier::Box stencil_box(*gitr, stencil_local_id, box_id.getOwnerRank()); + stencil_box_level->addBoxWithoutUpdate(stencil_box); + d_uncovered_to_stencil[uitr->getBoxId()].insert( + stencil_box.getBoxId()); + + coarse_to_stencil.insertLocalNeighbor(stencil_box, box_id); + stencil_to_coarse.insertLocalNeighbor(patch_box, + stencil_box.getBoxId()); + } + } + } + + stencil_box_level->finalize(); + + coarse_to_stencil.setTranspose(&stencil_to_coarse, false); + const hier::Connector& fine_to_coarse = + finer_level->getBoxLevel()->findConnectorWithTranspose( + *level->getBoxLevel(), + s_to_c_width, + c_to_s_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + boost::shared_ptr fine_to_stencil; + hier::OverlapConnectorAlgorithm oca; + oca.bridge( + fine_to_stencil, + fine_to_coarse, + coarse_to_stencil, + hier::IntVector::getZero(dim), + true); + + const hier::Connector& fine_to_fine = + finer_level->getBoxLevel()->findConnector( + *finer_level->getBoxLevel(), + d_hierarchy->getRequiredConnectorWidth(level_num+1, level_num+1), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + hier::BoxLevelConnectorUtils blcu; + blcu.addPeriodicImagesAndRelationships( + *stencil_box_level, + fine_to_stencil->getTranspose(), + d_hierarchy->getGridGeometry()->getDomainSearchTree(), + fine_to_fine); + + finer_level->getBoxLevel()->cacheConnector(fine_to_stencil); + + d_stencil_level = boost::make_shared( + stencil_box_level, + grid_geom, + level->getPatchDescriptor()); + d_stencil_level->setLevelNumber(level_num+1); + + d_stencil_created = true; + + setUpSchedule(); + + } else { + d_stencil_created = true; + setUpSchedule(); + } + + +} + +void CompositeBoundarySchedule::registerDataIds() +{ + boost::shared_ptr< xfer::VariableFillPattern > + interior_fill(new PatchInteriorVariableFillPattern(d_hierarchy->getDim())); + + for (std::set::const_iterator itr = d_data_ids.begin(); + itr != d_data_ids.end(); ++itr) { + TBOX_ASSERT(*itr >= 0); + int data_id = *itr; + + d_refine_algorithm.registerRefine(data_id, data_id, data_id, + boost::shared_ptr(), interior_fill); + } +} + + +/* + ************************************************************************* + * + * Private method sets up schedule for communicating data onto the stencil + * + ************************************************************************* + */ + +void +CompositeBoundarySchedule::setUpSchedule() +{ + TBOX_ASSERT(d_stencil_created); + + d_refine_schedule.reset(); + + if (d_stencil_level) { + boost::shared_ptr< xfer::PatchLevelFillPattern > + interior_level_fill(new PatchLevelInteriorFillPattern()); + + d_refine_schedule = + d_refine_algorithm.createSchedule( + interior_level_fill, + d_stencil_level, + d_hierarchy->getPatchLevel(d_coarse_level_num+1)); + } +} + +/* + ************************************************************************* + * + * Fill patch data on the stencil + * + ************************************************************************* + */ +void +CompositeBoundarySchedule::fillData(double fill_time) +{ + if (!d_stencil_created) { + TBOX_ERROR("CompositeBoundarySchedule::fillData error: No stencil for boundary of Level " << d_coarse_level_num << " created." << std::endl); + } + if (d_refine_schedule == 0 && d_coarse_level_num != d_hierarchy->getFinestLevelNumber()) { + TBOX_ERROR("CompositeBoundarySchedule::fillData error: No schedule for filling stencil for boundary of Level " << d_coarse_level_num << " created." << std::endl); + } + + if (d_stencil_level && d_refine_schedule) { + for (std::set::const_iterator ditr = d_data_ids.begin(); + ditr != d_data_ids.end(); ++ditr) { + + if (!d_stencil_level->checkAllocated(*ditr)) { + d_stencil_level->allocatePatchData(*ditr); + } + } + + d_refine_schedule->fillData(fill_time); + } + + const boost::shared_ptr& level = + d_hierarchy->getPatchLevel(d_coarse_level_num); + + for (std::set::const_iterator ditr = d_data_ids.begin(); + ditr != d_data_ids.end(); ++ditr) { + + const int& data_id = *ditr; + d_data_map[data_id].clear(); + + for (hier::PatchLevel::iterator itr = level->begin(); itr != level->end(); + ++itr) { + + const boost::shared_ptr& patch(*itr); + const hier::BoxId& box_id = patch->getBox().getBoxId(); + VectorPatchData& data_vec = + d_data_map[data_id][box_id]; + data_vec.clear(); + + std::map >& + stencil_map = d_stencil_to_data[data_id]; + if (d_stencil_level) { + const hier::BoxContainer& uncovered_boxes = + d_patch_to_uncovered[box_id]; + + for (hier::BoxContainer::const_iterator uitr = uncovered_boxes.begin(); + uitr != uncovered_boxes.end(); ++uitr) { + const std::set& stencil_ids = + d_uncovered_to_stencil[uitr->getBoxId()]; + + for (std::set::const_iterator sitr = stencil_ids.begin(); + sitr != stencil_ids.end(); ++sitr) { + + data_vec.push_back( + d_stencil_level->getPatch(*sitr)->getPatchData(data_id)); + + stencil_map[*sitr] = data_vec.back(); + + } + } + } + } + } + + d_stencil_filled = true; +} + +/* + ************************************************************************* + * + * Get a vector of stencil PatchData + * + ************************************************************************* + */ + +const std::vector >& +CompositeBoundarySchedule::getBoundaryPatchData( + const hier::Patch& patch, + int data_id) const +{ + if (d_data_ids.find(data_id) == d_data_ids.end()) { + TBOX_ERROR("CompositeBoundarySchedule::getBoundaryPatchData data_id " << data_id << " not registered with CompositeBoundarySchedule" << std::endl); + } + + int level_num = d_coarse_level_num; + if (patch.getPatchLevelNumber() != level_num) { + TBOX_ERROR("CompositeBoundarySchedule::getBoundaryPatchData Patch is on level " << patch.getPatchLevelNumber() << " while CompositeBoundarySchedule was created for level " << level_num << "." << std::endl); + } + + if (!d_stencil_filled) { + TBOX_ERROR("CompositeBoundarySchedule::getBoundaryPatchData error: stencil for boundary of Level " << level_num << " not filled." << std::endl); + } + + std::map::const_iterator data_map_itr = + d_data_map.find(data_id); + + if (data_map_itr == d_data_map.end()) { + TBOX_ERROR("CompositeBoundarySchedule::getBoundaryPatchData error: stencil data for patch data id " << data_id << " not found for level " << level_num << std::endl); + } + + const MapBoxIdPatchData& inner_map = data_map_itr->second; + + const hier::BoxId& box_id = patch.getBox().getBoxId(); + MapBoxIdPatchData::const_iterator inner_map_itr = inner_map.find(box_id); + + if (inner_map_itr == inner_map.end()) { + TBOX_ERROR("CompositeBoundarySchedule::getBoundaryPatchData error: stencil data for patch data id " << data_id << " not found for Patch " << box_id << " on level " << level_num << std::endl); + } + + const std::vector >& data_vec = + inner_map_itr->second; + + return data_vec; + +} + +std::vector > +CompositeBoundarySchedule::getDataForUncoveredBox( + const hier::BoxId& uncovered_id, + int data_id) const +{ + if (d_data_ids.find(data_id) == d_data_ids.end()) { + TBOX_ERROR("CompositeBoundarySchedule:: data_id " << data_id << " not registered with CompositeBoundarySchedule" << std::endl); + } + + if (!d_stencil_filled) { + TBOX_ERROR("CompositeBoundarySchedule:: error: stencil not filled." << std::endl); + } + + std::map > >::const_iterator data_map_itr = d_stencil_to_data.find(data_id); + if (data_map_itr == d_stencil_to_data.end()) { + TBOX_ERROR("CompositeBoundarySchedule:: error: stencil data for patch data id " << data_id << " not found." << std::endl); + } + + const std::map >& data_map = + data_map_itr->second; + + std::vector > data_vec; + + std::map >::const_iterator st_itr = + d_uncovered_to_stencil.find(uncovered_id); + + if (st_itr != d_uncovered_to_stencil.end()) { + const std::set& stencil_ids = st_itr->second; + + for (std::set::const_iterator itr = stencil_ids.begin(); + itr != stencil_ids.end(); ++itr) { + std::map >::const_iterator pd_itr = data_map.find(*itr); + if (pd_itr == data_map.end()) { + TBOX_ERROR("CompositeBoundarySchedule:: error: No patch data for stencil box " << *itr << " found." << std::endl); + } + data_vec.push_back(pd_itr->second); + } + } + + return data_vec; +} + + + + + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.h new file mode 100644 index 00000000..84ab77f3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/CompositeBoundarySchedule.h @@ -0,0 +1,278 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Manages PatchData objects created at coarse-fine stencils + * + ************************************************************************/ + +#ifndef included_xfer_CompositeBoundarySchedule +#define included_xfer_CompositeBoundarySchedule + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/xfer/RefineAlgorithm.h" +#include "SAMRAI/xfer/RefineSchedule.h" + +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { +namespace xfer { + +/*! + * @brief Class CompositeBoundarySchedule manages the communication and access + * of patch data objects that hold data at a composite boundary. + * + * The purpose of this class is to allow an application code that is operating + * on a particular Patch from a PatchHierarchy to have a local view into data + * from the next finer level that exists within a certain stencil width of the + * Patch's coarse-fine boundaries (if it has any). + * + * The recommended usage is to create a CompositeBoundaryAlgorithm to hold + * the stencil width and the patch data ids, and use + * CompositeBoundaryAlgorithm::createSchedule to create instances of this + * class. + */ + +class CompositeBoundarySchedule +{ +public: + + /*! + * @brief Constructor sets up basic state + * + * The constructor associates the CompositeBoundarySchedule with a hierarchy + * and a stencil width. It does not manage any data until further + * setup calls are made. + * + * The stencil width is interpreted in terms of the resolution of finer + * levels. So if the value is 4, that means that code operating on level n + * will be able to see a coarse-fine stencil of width 4 in the mesh + * resolution of level n + 1; + * + * This object will become invalid if either the coarse level or the + * next finer level is changed by a regrid of the hierarchy. + * + * @param[in] hierarchy + * @param[in] coarse_level_num Level number of the coarse level at + * coarse-fine boundary + * @param[in] stencil_width Width in terms of fine level zones + * @param[in] data_ids Patch data ids for data to be communicated + * + * @pre hierarchy != 0 + * @pre stencil_width >= 1 + */ + CompositeBoundarySchedule( + const boost::shared_ptr& hierarchy, + int coarse_level_num, + int stencil_width, + const std::set& data_ids); + + /*! + * @brief Destructor + */ + ~CompositeBoundarySchedule(); + + /*! + * @brief Fill data into the stencil that exists at the coarse-fine + * boundaries of the given level. + * + * Data willl be filled from the corresponding fine level from the + * onto the stencil, where it is then accessible through the method + * getBoundaryPatchData(). + * + * This may be called multiple times, to account for changing state of + * data on the hierarchy. + * + * @param[in] fill_time Time for the filling operation. + */ + void fillData(double fill_time); + + /*! + * @brief Get the uncovered boxes for a patch on the schedule's coarse level. + * + * The uncovered boxes represent the regions of the patch, if any, that + * are not overlapped by the mesh of the next finest level. + * + * @param patch A local patch on the the coarse level. An error will occur + * the patch is not local or not on the level. + */ + const hier::BoxContainer& + getUncoveredBoxes( + const hier::Patch& patch) const + { + std::map::const_iterator itr = + d_patch_to_uncovered.find(patch.getBox().getBoxId()); + + if (itr == d_patch_to_uncovered.end()) { + TBOX_ERROR("CompositeBoundarySchedule::getUncoveredBoxes error: Patch " << patch.getBox().getBoxId() << " is not a local patch on the current coarse level." << std::endl); + } + + return itr->second; + } + + /*! + * @brief Get PatchData from the composite boundary stencil for a given + * data id. + * + * Get a vector that holds the stencil PatchData for the parts of the + * coarse-fine boundary touching the Patch. The Patch must be a local + * Patch on the hierarchy, and fillData() must already have been called on + * this object. + * + * If the Patch does not touch any coarse-fine boundaries, the returned + * vector will be empty. + * + * @param patch a local Patch from the hierarchy + * @param data_id patch data id for data stored in the stencil + */ + const std::vector >& + getBoundaryPatchData( + const hier::Patch& patch, + int data_id) const; + + /*! + * @brief Get PatchData from the composite boundary stencil associated with + * an uncovered box. + * + * The returned vector will contain PatchData located at the coarse-fine + * stencil touching the uncovered box. + * + * An error will occur if the uncovered_id is not the id of an uncovered + * box, or if the data_id is not an id that was passed into the constructor. + * + * @param uncovered_id BoxId for an uncovered box + * @param data_id patch data id for the desired data. + */ + std::vector > + getDataForUncoveredBox( + const hier::BoxId& uncovered_id, + int data_id) const; + +private: + CompositeBoundarySchedule( + const CompositeBoundarySchedule&); // not implemented + CompositeBoundarySchedule& + operator = ( + const CompositeBoundarySchedule&); // not implemented + + /*! + * @brief Register the data ids for communication. + * + * This must be called prior to calling createStencilForLevel(). + */ + void registerDataIds(); + + /*! + * @brief Create a stencil that exists at the coarse-fine boundaries + * of the coarse level. + */ + void createStencilForLevel(); + + /*! + * @brief Set up communication schedule to fill data at composite boundary + * + * This sets up the communications that fill the patch data around the + * coarse-fine boundaries of the coarse level. + */ + void setUpSchedule(); + + /*! + * @brief Hierarchy where the stencils exist + */ + boost::shared_ptr d_hierarchy; + + /*! + * @brief Levels representing the stencils + */ + boost::shared_ptr d_stencil_level; + + /*! + * @brief Map from BoxId of a hierarchy patch to the BoxIds of its + * coarse-fine stencil boxes. + */ + std::map > d_stencil_map; + + /*! + * @brief Width of the stencils. The width represents a width in + * terms of fine resolution at coarse-fine boundaries. + */ + int d_stencil_width; + + /*! + * @brief Patch data ids for data to be held on the stencil. + */ + std::set d_data_ids; + + /*! + * @brief Algorithm for communication of data to the stencil. + */ + RefineAlgorithm d_refine_algorithm; + + /*! + * @brief Schedules for communication of data from hierarchy to stencils. + */ + boost::shared_ptr d_refine_schedule; + + /* + * typedefs to simplify nested container declaration. + */ + typedef std::vector > VectorPatchData; + typedef std::map MapBoxIdPatchData; + + // map BoxId from Patch to container of uncovered boxes + std::map d_patch_to_uncovered; + + // map BoxId of uncovered box to container of stencil boxes + std::map > d_uncovered_to_stencil; + + // outer map maps a data id to the inner map. Inner map maps BoxId of + // a stencil box to the PatchData located on that box. + std::map > > + d_stencil_to_data; + + /*! + * @brief Container of PatchData on the stencil. + * + * The inner nested container is a vector of PatchData which consists of + * one PatchData object for each box of the coarse-fine stencil for a single + * Patch of the hierarchy. + * + * The nesting of the containers is organized as: + * + * d_data_map[data_id][box_id][stencil_box_index] + * + * level_number is the level number of the coarse level at a coarse-fine + * boundary where the stencil has been created and filled. data_id + * is the patch data id of the data that is to be accessed. box_id is + * the id of a Patch on the hierarchy. stencil_box_index is an index into + * the inner nested vector of PatchData. + */ + std::map d_data_map; + + /*! + * @brief Vector of flags telling if stencil has been created for each + * level of the hierarchy. + */ + bool d_stencil_created; + + /*! + * @brief Vector of flags telling if stencil has been filled for each + * level of the hierarchy. + */ + bool d_stencil_filled; + + /*! + * The level number of the coarse level at the coarse-fine boundary where + * the composite boundary stencils are created. + */ + int d_coarse_level_num; +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.depend b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.depend index 942dd616..4dd090ec 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -29,8 +29,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -41,7 +41,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -50,13 +49,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ BoxGeometryVariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=CoarsenAlgorithm.o DEPENDS_1:=\ @@ -93,16 +90,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -115,8 +113,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -138,18 +136,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/StandardCoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CoarsenAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=CoarsenClasses.o DEPENDS_2:=\ @@ -176,11 +173,11 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -190,8 +187,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -200,13 +197,11 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CoarsenClasses.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=CoarsenCopyTransaction.o DEPENDS_3:=\ @@ -239,6 +234,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -248,7 +244,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -259,8 +254,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -274,13 +269,11 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CoarsenCopyTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=CoarsenPatchStrategy.o DEPENDS_4:=\ @@ -306,11 +299,11 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -321,7 +314,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -329,18 +321,15 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ CoarsenPatchStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=CoarsenSchedule.o DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -362,7 +351,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -381,10 +369,10 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -400,8 +388,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -423,17 +411,16 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CoarsenSchedule.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=CoarsenTransactionFactory.o DEPENDS_6:=\ @@ -466,6 +453,7 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -475,7 +463,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -486,8 +473,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -501,34 +488,67 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CoarsenTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} -FILE_7=PatchInteriorVariableFillPattern.o +${FILE_6}: ${DEPENDS_6} + +FILE_7=CompositeBoundaryAlgorithm.o DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -538,35 +558,52 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CompositeBoundaryAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CompositeBoundarySchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchInteriorVariableFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelInteriorFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - PatchInteriorVariableFillPattern.C + CompositeBoundaryAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=PatchLevelBorderAndInteriorFillPattern.o +${FILE_7}: ${DEPENDS_7} + +FILE_8=CompositeBoundarySchedule.o DEPENDS_8:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -575,26 +612,38 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -605,29 +654,152 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h\ + $(INCLUDE_SAM)/SAMRAI/xfer/CompositeBoundarySchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchInteriorVariableFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - PatchLevelBorderAndInteriorFillPattern.C + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelInteriorFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + CompositeBoundarySchedule.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=PatchLevelBorderFillPattern.o +${FILE_8}: ${DEPENDS_8} + +FILE_9=PatchInteriorVariableFillPattern.o DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchInteriorVariableFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + PatchInteriorVariableFillPattern.C + +DEPENDS_9 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=PatchLevelBorderAndInteriorFillPattern.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h\ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + PatchLevelBorderAndInteriorFillPattern.C + +DEPENDS_10 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=PatchLevelBorderFillPattern.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -656,6 +828,7 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -665,7 +838,6 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -676,8 +848,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -689,16 +861,14 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ PatchLevelBorderFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} -FILE_10=PatchLevelEnhancedFillPattern.o -DEPENDS_10:=\ +${FILE_11}: ${DEPENDS_11} + +FILE_12=PatchLevelEnhancedFillPattern.o +DEPENDS_12:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -727,6 +897,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -736,7 +907,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -747,8 +917,8 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -760,16 +930,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ PatchLevelEnhancedFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=PatchLevelFillPattern.o -DEPENDS_11:=\ +${FILE_12}: ${DEPENDS_12} + +FILE_13=PatchLevelFillPattern.o +DEPENDS_13:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -798,6 +966,7 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ @@ -806,7 +975,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -817,8 +985,8 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -829,16 +997,14 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ PatchLevelFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} -FILE_12=PatchLevelFullFillPattern.o -DEPENDS_12:=\ +${FILE_13}: ${DEPENDS_13} + +FILE_14=PatchLevelFullFillPattern.o +DEPENDS_14:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -867,6 +1033,7 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -876,7 +1043,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -887,8 +1053,8 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -900,16 +1066,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFullFillPattern.h \ PatchLevelFullFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=PatchLevelInteriorFillPattern.o -DEPENDS_13:=\ +${FILE_14}: ${DEPENDS_14} + +FILE_15=PatchLevelInteriorFillPattern.o +DEPENDS_15:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -938,7 +1102,9 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RealBoxConstIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ @@ -946,7 +1112,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -957,8 +1122,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -970,16 +1135,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelInteriorFillPattern.h \ PatchLevelInteriorFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_15 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} -FILE_14=RefineAlgorithm.o -DEPENDS_14:=\ +${FILE_15}: ${DEPENDS_15} + +FILE_16=RefineAlgorithm.o +DEPENDS_16:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1015,16 +1178,17 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1037,8 +1201,8 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1056,21 +1220,20 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/StandardRefineTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineAlgorithm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_14 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_16 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} -FILE_15=RefineClasses.o -DEPENDS_15:=\ +${FILE_16}: ${DEPENDS_16} + +FILE_17=RefineClasses.o +DEPENDS_17:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -1093,13 +1256,13 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1109,8 +1272,8 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -1118,16 +1281,14 @@ DEPENDS_15:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h RefineClasses.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_15 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_17 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_15:X.o=${NDIM}.o}: ${DEPENDS_15} -FILE_16=RefineCopyTransaction.o -DEPENDS_16:=\ +${FILE_17}: ${DEPENDS_17} + +FILE_18=RefineCopyTransaction.o +DEPENDS_18:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1157,6 +1318,7 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1166,7 +1328,6 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1177,8 +1338,8 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1192,16 +1353,14 @@ DEPENDS_16:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineCopyTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_16 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_18 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_16:X.o=${NDIM}.o}: ${DEPENDS_16} -FILE_17=RefinePatchStrategy.o -DEPENDS_17:=\ +${FILE_18}: ${DEPENDS_18} + +FILE_19=RefinePatchStrategy.o +DEPENDS_19:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1231,6 +1390,7 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1240,7 +1400,6 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1251,8 +1410,8 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1260,19 +1419,19 @@ DEPENDS_17:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefinePatchStrategy.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_17 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_19 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_17:X.o=${NDIM}.o}: ${DEPENDS_17} -FILE_18=RefineSchedule.o -DEPENDS_18:=\ +${FILE_19}: ${DEPENDS_19} + +FILE_20=RefineSchedule.o +DEPENDS_20:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -1297,6 +1456,7 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -1318,10 +1478,10 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1337,8 +1497,8 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1351,6 +1511,7 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/xfer/BoxGeometryVariableFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFullFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelInteriorFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineCopyTransaction.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ @@ -1358,20 +1519,19 @@ DEPENDS_18:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTimeTransaction.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineSchedule.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_18 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_20 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_18:X.o=${NDIM}.o}: ${DEPENDS_18} -FILE_19=RefineScheduleConnectorWidthRequestor.o -DEPENDS_19:=\ +${FILE_20}: ${DEPENDS_20} + +FILE_21=RefineScheduleConnectorWidthRequestor.o +DEPENDS_21:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1403,16 +1563,17 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1423,8 +1584,8 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1432,20 +1593,20 @@ DEPENDS_19:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineScheduleConnectorWidthRequestor.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_19 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_21 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_19:X.o=${NDIM}.o}: ${DEPENDS_19} -FILE_20=RefineTimeTransaction.o -DEPENDS_20:=\ +${FILE_21}: ${DEPENDS_21} + +FILE_22=RefineTimeTransaction.o +DEPENDS_22:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1475,6 +1636,7 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1484,7 +1646,6 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1495,8 +1656,8 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1510,16 +1671,14 @@ DEPENDS_20:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineTimeTransaction.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_20 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_22 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_20:X.o=${NDIM}.o}: ${DEPENDS_20} -FILE_21=RefineTransactionFactory.o -DEPENDS_21:=\ +${FILE_22}: ${DEPENDS_22} + +FILE_23=RefineTransactionFactory.o +DEPENDS_23:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1549,6 +1708,7 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1558,7 +1718,6 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1569,8 +1728,8 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1584,16 +1743,26 @@ DEPENDS_21:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ RefineTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_21 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_23 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_21:X.o=${NDIM}.o}: ${DEPENDS_21} -FILE_22=StandardCoarsenTransactionFactory.o -DEPENDS_22:=\ +${FILE_23}: ${DEPENDS_23} + +FILE_24=SingularityPatchStrategy.o +DEPENDS_24:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + SingularityPatchStrategy.C + +DEPENDS_24 +=\ + + + +${FILE_24}: ${DEPENDS_24} + +FILE_25=StandardCoarsenTransactionFactory.o +DEPENDS_25:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1623,6 +1792,7 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1632,7 +1802,6 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1643,8 +1812,8 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1660,16 +1829,14 @@ DEPENDS_22:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ StandardCoarsenTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_22 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_25 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_22:X.o=${NDIM}.o}: ${DEPENDS_22} -FILE_23=StandardRefineTransactionFactory.o -DEPENDS_23:=\ +${FILE_25}: ${DEPENDS_25} + +FILE_26=StandardRefineTransactionFactory.o +DEPENDS_26:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1699,6 +1866,7 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -1708,7 +1876,6 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1719,8 +1886,8 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1737,16 +1904,14 @@ DEPENDS_23:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ StandardRefineTransactionFactory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_23 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_26 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_23:X.o=${NDIM}.o}: ${DEPENDS_23} -FILE_24=VariableFillPattern.o -DEPENDS_24:=\ +${FILE_26}: ${DEPENDS_26} + +FILE_27=VariableFillPattern.o +DEPENDS_27:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -1763,8 +1928,8 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1775,7 +1940,6 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ @@ -1783,11 +1947,9 @@ DEPENDS_24:=\ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ VariableFillPattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_24 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ +DEPENDS_27 +=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_24:X.o=${NDIM}.o}: ${DEPENDS_24} + +${FILE_27}: ${DEPENDS_27} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.in b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.in index 5dd9573f..f37f1bb7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: primary makefile for compiling the SAMRAI xfer package ## ######################################################################### @@ -46,12 +46,15 @@ OBJS = \ StandardCoarsenTransactionFactory.o \ CoarsenTransactionFactory.o \ CoarsenPatchStrategy.o \ - CoarsenClasses.o + CoarsenClasses.o \ + SingularityPatchStrategy.o \ + CompositeBoundaryAlgorithm.o \ + CompositeBoundarySchedule.o library: $(OBJS) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done clean: - $(SAMCLEAN) + $(CLEAN_COMMON_LIB_FILES) for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.C index 4bd938ac..bd973c80 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class that fills patch interiors only * ************************************************************************/ - -#ifndef included_xfer_PatchInteriorVariableFillPattern_C -#define included_xfer_PatchInteriorVariableFillPattern_C - #include "SAMRAI/xfer/PatchInteriorVariableFillPattern.h" #include "SAMRAI/tbox/Utilities.h" @@ -68,7 +64,7 @@ PatchInteriorVariableFillPattern::calculateOverlap( { NULL_USE(dst_patch_box); NULL_USE(overwrite_interior); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_patch_box, src_mask); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_patch_box, src_mask); hier::BoxContainer dst_restrict_boxes(dst_patch_box); return dst_geometry.calculateOverlap(src_geometry, src_mask, fill_box, true, transformation, @@ -86,10 +82,13 @@ PatchInteriorVariableFillPattern::calculateOverlap( boost::shared_ptr PatchInteriorVariableFillPattern::computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& unfilled_node_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const { + NULL_USE(unfilled_node_boxes); + /* * For this case, the overlap is simply the intersection of * fill_boxes, data_box, and patch_box. @@ -118,4 +117,3 @@ PatchInteriorVariableFillPattern::getPatternName() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.h index f949e96b..fb00bc26 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchInteriorVariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fill pattern class that fills PatchInteriors only * ************************************************************************/ @@ -18,18 +18,6 @@ namespace SAMRAI { namespace xfer { -/*! - * @brief Class BoxGeometryVariableFillPattern is a default implementation of - * the abstract base class VariableFillPattern. - * - * It is used to calculate overlaps that consist of the full intersection - * between source and destination patches, including all ghost regions. If - * no VariableFillPattern object is provided when a refine operation is - * registered with a RefineAlgorithm, this class is used by default. - * - * @see xfer::RefineAlgorithm - */ - /*! * @brief Class PatchInteriorVariableFillPattern is an implementation of the * abstract base class VariableFillPattern. @@ -82,6 +70,8 @@ class PatchInteriorVariableFillPattern: * * @return boost::shared_ptr to the calculated overlap * object + * + * @pre dst_patch_box.getDim() == src_mask.getDim() */ boost::shared_ptr calculateOverlap( @@ -105,6 +95,7 @@ class PatchInteriorVariableFillPattern: * @param[in] fill_boxes list representing the all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] unfilled_node_boxes node-centered representation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region @@ -116,6 +107,7 @@ class PatchInteriorVariableFillPattern: boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& unfilled_node_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& pdf) const; @@ -137,7 +129,7 @@ class PatchInteriorVariableFillPattern: private: PatchInteriorVariableFillPattern( const PatchInteriorVariableFillPattern&); // not implemented - void + PatchInteriorVariableFillPattern& operator = ( const PatchInteriorVariableFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.C index cfcbc80b..d3e98db3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.C @@ -3,17 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelBorderAndInteriorFillPattern_C -#define included_xfer_PatchLevelBorderAndInteriorFillPattern_C - #include "SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/MathUtilities.h" namespace SAMRAI { @@ -53,50 +50,67 @@ PatchLevelBorderAndInteriorFillPattern::~PatchLevelBorderAndInteriorFillPattern( */ void PatchLevelBorderAndInteriorFillPattern::computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) { - NULL_USE(dst_to_src); - NULL_USE(src_to_dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); + + fill_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); - const hier::BoxContainer& dst_mapped_boxes = - dst_mapped_box_level.getBoxes(); + dst_to_fill.reset(new hier::Connector(dst_box_level, + *fill_box_level, + fill_ghost_width)); + + const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); + + hier::IntVector dst_to_dst_width(fill_ghost_width); + if (data_on_patch_border) { + dst_to_dst_width += hier::IntVector::getOne(fill_ghost_width.getDim()); + } + + const int dst_level_num = dst_box_level.getGridGeometry()-> + getEquivalentLevelNumber(dst_box_level.getRefinementRatio()); + + const hier::Connector& dst_to_dst = + dst_box_level.findConnector(dst_box_level, + dst_to_dst_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); /* * Grow each patch box and remove the level from it, except the * patch box itself. (Do not fill ghost cells that are normally - * filled by same mapped_box_level. Do fill ghost cells that are - * normally filled by coarser mapped_box_level.) + * filled by same box_level. Do fill ghost cells that are + * normally filled by coarser box_level.) */ - hier::LocalId last_id = dst_mapped_box_level.getLastLocalId(); - for (hier::BoxContainer::const_iterator ni = dst_mapped_boxes.begin(); - ni != dst_mapped_boxes.end(); ++ni) { + hier::LocalId last_id = dst_box_level.getLastLocalId(); + for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); + ni != dst_boxes.realEnd(); ++ni) { - const hier::BoxId& gid(ni->getId()); - const hier::Box& dst_mapped_box = - *dst_mapped_box_level.getBox(gid); + const hier::BoxId& gid(ni->getBoxId()); + const hier::Box& dst_box = *dst_box_level.getBox(gid); hier::BoxContainer fill_boxes( - hier::Box::grow(dst_mapped_box, fill_ghost_width)); + hier::Box::grow(dst_box, fill_ghost_width)); hier::Connector::ConstNeighborhoodIterator nabrs = - dst_to_dst.find(dst_mapped_box.getId()); + dst_to_dst.find(dst_box.getBoxId()); for (hier::Connector::ConstNeighborIterator na = dst_to_dst.begin(nabrs); na != dst_to_dst.end(nabrs); ++na) { if (!ni->isSpatiallyEqual(*na)) { - if (dst_mapped_box.getBlockId() == na->getBlockId()) { + if (dst_box.getBlockId() == na->getBlockId()) { fill_boxes.removeIntersections(*na); } else { boost::shared_ptr grid_geometry( - dst_mapped_box_level.getGridGeometry()); + dst_box_level.getGridGeometry()); - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); + const hier::BlockId& dst_block_id = dst_box.getBlockId(); const hier::BlockId& nbr_block_id = na->getBlockId(); TBOX_ASSERT(grid_geometry->areNeighbors(dst_block_id, @@ -106,9 +120,7 @@ PatchLevelBorderAndInteriorFillPattern::computeFillBoxesAndNeighborhoodSets( grid_geometry->getRotationIdentifier(dst_block_id, nbr_block_id); hier::IntVector offset( - grid_geometry->getOffset(dst_block_id, nbr_block_id)); - - offset *= (dst_mapped_box_level.getRefinementRatio()); + grid_geometry->getOffset(dst_block_id, nbr_block_id, dst_level_num)); hier::Transformation transformation(rotation, offset, nbr_block_id, dst_block_id); @@ -122,36 +134,35 @@ PatchLevelBorderAndInteriorFillPattern::computeFillBoxesAndNeighborhoodSets( } } - if (!fill_boxes.isEmpty()) { + if (!fill_boxes.empty()) { d_max_fill_boxes = tbox::MathUtilities::Max(d_max_fill_boxes, fill_boxes.size()); hier::Connector::NeighborhoodIterator base_box_itr = - dst_to_fill.makeEmptyLocalNeighborhood(gid); - for (hier::BoxContainer::iterator li(fill_boxes); + dst_to_fill->makeEmptyLocalNeighborhood(gid); + for (hier::BoxContainer::iterator li = fill_boxes.begin(); li != fill_boxes.end(); ++li) { - hier::Box fill_mapped_box(*li, - ++last_id, - dst_mapped_box.getOwnerRank()); - TBOX_ASSERT(fill_mapped_box.getBlockId() == - dst_mapped_box.getBlockId()); - fill_mapped_boxes.addBoxWithoutUpdate(fill_mapped_box); - dst_to_fill.insertLocalNeighbor(fill_mapped_box, base_box_itr); + hier::Box fill_box(*li, + ++last_id, + dst_box.getOwnerRank()); + TBOX_ASSERT(fill_box.getBlockId() == dst_box.getBlockId()); + fill_box_level->addBoxWithoutUpdate(fill_box); + dst_to_fill->insertLocalNeighbor(fill_box, base_box_itr); } } } - fill_mapped_boxes.finalize(); + fill_box_level->finalize(); } void PatchLevelBorderAndInteriorFillPattern::computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) { NULL_USE(dst_fill_boxes_on_src_proc); - NULL_USE(dst_mapped_box_level); + NULL_USE(dst_box_level); NULL_USE(src_to_dst); NULL_USE(fill_ghost_width); if (!needsToCommunicateDestinationFillBoxes()) { @@ -193,4 +204,3 @@ PatchLevelBorderAndInteriorFillPattern::fillingEnhancedConnectivityOnly() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h index 36b96bcc..0e778208 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderAndInteriorFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ @@ -22,7 +22,7 @@ namespace xfer { * @brief PatchLevelFillPattern implementation for filling at PatchLevel * boundaries and interiors * - * For documentation on this interface see @ref xfer::PatchLevelFillPattern + * For documentation on this interface see @ref PatchLevelFillPattern * * The fill boxes will consist of the interior of the destination * level as well as ghost regions lying outside of the level interior @@ -45,34 +45,31 @@ class PatchLevelBorderAndInteriorFillPattern:public PatchLevelFillPattern virtual ~PatchLevelBorderAndInteriorFillPattern(); /*! - * @brief Compute the mapped boxes to be filled and related communication - * data. + * @brief Compute the boxes to be filled and related communication data. * - * The computed fill_mapped_boxes will cover the ghost regions around the - * boxes of dst_mapped_box_level at coarse-fine and physical boundaries, - * as well as the interior of the boxes of dst_mapped_box_level. The + * The computed fill_box_level will cover the ghost regions around the + * boxes of dst_box_level at coarse-fine and physical boundaries, + * as well as the interior of the boxes of dst_box_level. The * width of the ghost regions will be determined by fill_ghost_width. * - * @param[out] fill_mapped_boxes Output BoxLevel to be filled + * @param[out] fill_box_level Output BoxLevel to be filled * @param[out] dst_to_fill Output Connector between - * dst_mapped_box_level and - * and fill_mapped_boxes - * @param[in] dst_mapped_box_level destination level - * @param[in] dst_to_dst Connector of destination to itself - * @param[in] dst_to_src Connector of destination to source - * @param[in] src_to_dst Connector of source to destination + * dst_box_level and fill_box_level + * @param[in] dst_box_level destination level * @param[in] fill_ghost_width Ghost width being filled by refine * schedule + * @param[in] data_on_patch_border true if there is data living on patch + * borders + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border); /*! * @brief Return true to indicate source patch owners cannot compute @@ -90,15 +87,17 @@ class PatchLevelBorderAndInteriorFillPattern:public PatchLevelFillPattern * @param[out] dst_fill_boxes_on_src_proc FillSet storing the destination * neighbors of the source mapped * boxes - * @param[in] dst_mapped_box_level destination level + * @param[in] dst_box_level destination level * @param[in] src_to_dst Connector of source to destination * @param[in] fill_ghost_width Ghost width being filled by refine * schedule + * + * @pre needsToCommunicateDestinationFillBoxes() */ void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width); @@ -131,7 +130,7 @@ class PatchLevelBorderAndInteriorFillPattern:public PatchLevelFillPattern fillingCoarseFineGhosts() const; /*! - * @brief Returns false because this fill pattern is specialized for + * @brief Returns false because this fill pattern is not specialized for * enhanced connectivity only. */ bool @@ -140,7 +139,7 @@ class PatchLevelBorderAndInteriorFillPattern:public PatchLevelFillPattern private: PatchLevelBorderAndInteriorFillPattern( const PatchLevelBorderAndInteriorFillPattern&); // not implemented - void + PatchLevelBorderAndInteriorFillPattern& operator = ( const PatchLevelBorderAndInteriorFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.C index 5c007039..c8cc34d7 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelBorderFillPattern_C -#define included_xfer_PatchLevelBorderFillPattern_C - #include "SAMRAI/xfer/PatchLevelBorderFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" @@ -55,42 +51,60 @@ PatchLevelBorderFillPattern::~PatchLevelBorderFillPattern() */ void PatchLevelBorderFillPattern::computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) { - NULL_USE(dst_to_src); - NULL_USE(src_to_dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); + + fill_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); - const hier::BoxContainer& dst_mapped_boxes = - dst_mapped_box_level.getBoxes(); + dst_to_fill.reset(new hier::Connector(dst_box_level, + *fill_box_level, + fill_ghost_width)); + + const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); + + const int dst_level_num = dst_box_level.getGridGeometry()-> + getEquivalentLevelNumber(dst_box_level.getRefinementRatio()); + + hier::IntVector dst_to_dst_width(fill_ghost_width); + if (data_on_patch_border) { + dst_to_dst_width += hier::IntVector::getOne(fill_ghost_width.getDim()); + } + + const hier::Connector& dst_to_dst = + dst_box_level.findConnector(dst_box_level, + dst_to_dst_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); /* * To get the level border, grow each patch box and remove * the level from it. */ - hier::LocalId last_id = dst_mapped_box_level.getLastLocalId(); - for (hier::RealBoxConstIterator ni(dst_mapped_boxes.realBegin()); - ni != dst_mapped_boxes.realEnd(); ++ni) { - const hier::Box& dst_mapped_box = *ni; + hier::LocalId last_id = dst_box_level.getLastLocalId(); + for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); + ni != dst_boxes.realEnd(); ++ni) { + const hier::Box& dst_box = *ni; hier::BoxContainer fill_boxes( - hier::Box::grow(dst_mapped_box, fill_ghost_width)); + hier::Box::grow(dst_box, fill_ghost_width)); hier::Connector::ConstNeighborhoodIterator nabrs = - dst_to_dst.find(dst_mapped_box.getId()); + dst_to_dst.find(dst_box.getBoxId()); for (hier::Connector::ConstNeighborIterator na = dst_to_dst.begin(nabrs); na != dst_to_dst.end(nabrs); ++na) { - if (dst_mapped_box.getBlockId() == na->getBlockId()) { + if (dst_box.getBlockId() == na->getBlockId()) { fill_boxes.removeIntersections(*na); } else { boost::shared_ptr grid_geometry( - dst_mapped_box_level.getGridGeometry()); + dst_box_level.getGridGeometry()); - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); + const hier::BlockId& dst_block_id = dst_box.getBlockId(); const hier::BlockId& nbr_block_id = na->getBlockId(); TBOX_ASSERT(grid_geometry->areNeighbors(dst_block_id, @@ -100,9 +114,7 @@ PatchLevelBorderFillPattern::computeFillBoxesAndNeighborhoodSets( grid_geometry->getRotationIdentifier(dst_block_id, nbr_block_id); hier::IntVector offset( - grid_geometry->getOffset(dst_block_id, nbr_block_id)); - - offset *= (dst_mapped_box_level.getRefinementRatio()); + grid_geometry->getOffset(dst_block_id, nbr_block_id, dst_level_num)); hier::Transformation transformation(rotation, offset, nbr_block_id, dst_block_id); @@ -114,34 +126,33 @@ PatchLevelBorderFillPattern::computeFillBoxesAndNeighborhoodSets( } } - if (!fill_boxes.isEmpty()) { + if (!fill_boxes.empty()) { d_max_fill_boxes = tbox::MathUtilities::Max(d_max_fill_boxes, fill_boxes.size()); hier::Connector::NeighborhoodIterator base_box_itr = - dst_to_fill.makeEmptyLocalNeighborhood(dst_mapped_box.getId()); - for (hier::BoxContainer::iterator li(fill_boxes); + dst_to_fill->makeEmptyLocalNeighborhood(dst_box.getBoxId()); + for (hier::BoxContainer::iterator li = fill_boxes.begin(); li != fill_boxes.end(); ++li) { - hier::Box fill_mapped_box(*li, - ++last_id, - dst_mapped_box.getOwnerRank()); - TBOX_ASSERT(fill_mapped_box.getBlockId() == - dst_mapped_box.getBlockId()); - fill_mapped_boxes.addBoxWithoutUpdate(fill_mapped_box); - dst_to_fill.insertLocalNeighbor(fill_mapped_box, base_box_itr); + hier::Box fill_box(*li, + ++last_id, + dst_box.getOwnerRank()); + TBOX_ASSERT(fill_box.getBlockId() == dst_box.getBlockId()); + fill_box_level->addBoxWithoutUpdate(fill_box); + dst_to_fill->insertLocalNeighbor(fill_box, base_box_itr); } } } - fill_mapped_boxes.finalize(); + fill_box_level->finalize(); } void PatchLevelBorderFillPattern::computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) { - NULL_USE(dst_mapped_box_level); + NULL_USE(dst_box_level); NULL_USE(src_to_dst); NULL_USE(fill_ghost_width); NULL_USE(dst_fill_boxes_on_src_proc); @@ -184,4 +195,3 @@ PatchLevelBorderFillPattern::getMaxFillBoxes() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.h index bf902373..75aceab6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelBorderFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ @@ -22,7 +22,7 @@ namespace xfer { * @brief PatchLevelFillPattern implementation for filling at PatchLevel * boundaries. * - * For documentation on this interface see @ref xfer::PatchLevelFillPattern + * For documentation on this interface see @ref PatchLevelFillPattern * * The fill boxes will consist of the ghost regions lying outside of * the level interior--in other words the ghost regions at physical @@ -43,33 +43,30 @@ class PatchLevelBorderFillPattern:public PatchLevelFillPattern virtual ~PatchLevelBorderFillPattern(); /*! - * @brief Compute the mapped boxes to be filled and related communication - * data. + * @brief Compute the boxes to be filled and related communication data. * - * The computed fill_mapped_boxes will cover the ghost regions around the - * boxes of dst_mapped_box_level at coarse-fine and physical boundaries. + * The computed fill_box_level will cover the ghost regions around the + * boxes of dst_box_level at coarse-fine and physical boundaries. * The width of those ghost regions will be determined by fill_ghost_width. * - * @param[out] fill_mapped_boxes Output BoxLevel to be filled + * @param[out] fill_box_level Output BoxLevel to be filled * @param[out] dst_to_fill Output Connector between - * dst_mapped_box_level and - * and fill_mapped_boxes - * @param[in] dst_mapped_box_level destination level - * @param[in] dst_to_dst Connector of destination to itself - * @param[in] dst_to_src Connector of destination to source - * @param[in] src_to_dst Connector of source to destination + * dst_box_level and fill_box_level + * @param[in] dst_box_level destination level * @param[in] fill_ghost_width Ghost width being filled by refine * schedule + * @param[in] data_on_patch_border true if there is data living on patch + * borders + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border); /*! * @brief Return true to indicate source patch owners cannot compute @@ -85,11 +82,13 @@ class PatchLevelBorderFillPattern:public PatchLevelFillPattern * method should never be called. It is implemented here to satisfy * the pure virtual interface from the base class. An error will result * if this is ever called. + * + * @pre needsToCommunicateDestinationFillBoxes() */ void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width); @@ -122,7 +121,7 @@ class PatchLevelBorderFillPattern:public PatchLevelFillPattern fillingCoarseFineGhosts() const; /*! - * @brief Returns false because this fill pattern is specialized for + * @brief Returns false because this fill pattern is not specialized for * enhanced connectivity only. */ bool @@ -131,7 +130,7 @@ class PatchLevelBorderFillPattern:public PatchLevelFillPattern private: PatchLevelBorderFillPattern( const PatchLevelBorderFillPattern&); // not implemented - void + PatchLevelBorderFillPattern& operator = ( const PatchLevelBorderFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.C index 30613db3..11475d22 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelEnhancedFillPattern_C -#define included_xfer_PatchLevelEnhancedFillPattern_C - #include "SAMRAI/xfer/PatchLevelEnhancedFillPattern.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/RealBoxConstIterator.h" @@ -54,75 +50,75 @@ PatchLevelEnhancedFillPattern::~PatchLevelEnhancedFillPattern() */ void PatchLevelEnhancedFillPattern::computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) { - NULL_USE(dst_to_dst); - NULL_USE(dst_to_src); - NULL_USE(src_to_dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + NULL_USE(data_on_patch_border); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); + + fill_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); + + dst_to_fill.reset(new hier::Connector(dst_box_level, + *fill_box_level, + fill_ghost_width)); boost::shared_ptr grid_geometry( - dst_mapped_box_level.getGridGeometry()); + dst_box_level.getGridGeometry()); - const hier::BoxContainer& dst_mapped_boxes = - dst_mapped_box_level.getBoxes(); + const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); - hier::LocalId last_id = dst_mapped_box_level.getLastLocalId(); - for (hier::RealBoxConstIterator ni(dst_mapped_boxes.realBegin()); - ni != dst_mapped_boxes.realEnd(); ++ni) { - const hier::Box& dst_mapped_box = *ni; - const hier::BoxId& dst_mapped_box_id = dst_mapped_box.getId(); + hier::LocalId last_id = dst_box_level.getLastLocalId(); + for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); + ni != dst_boxes.realEnd(); ++ni) { + const hier::Box& dst_box = *ni; + const hier::BoxId& dst_box_id = dst_box.getBoxId(); hier::BoxContainer fill_boxes( - hier::Box::grow(dst_mapped_box, fill_ghost_width)); - - const std::list& neighbors = - grid_geometry->getNeighbors(dst_mapped_box.getBlockId()); + hier::Box::grow(dst_box, fill_ghost_width)); hier::BoxContainer constructed_fill_boxes; hier::Connector::NeighborhoodIterator base_box_itr = - dst_to_fill.findLocal(dst_mapped_box_id); - bool has_base_box = base_box_itr != dst_to_fill.end(); - - for (std::list::const_iterator ni = - neighbors.begin(); - ni != neighbors.end(); ni++) { + dst_to_fill->findLocal(dst_box_id); + bool has_base_box = base_box_itr != dst_to_fill->end(); - if (ni->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(dst_box.getBlockId()); + ni != grid_geometry->end(dst_box.getBlockId()); ++ni) { + const hier::BaseGridGeometry::Neighbor& nbr = *ni; + if (nbr.isSingularity()) { - hier::BoxContainer encon_boxes(ni->getTransformedDomain()); - encon_boxes.refine(dst_mapped_box_level.getRefinementRatio()); + hier::BoxContainer encon_boxes(nbr.getTransformedDomain()); + encon_boxes.refine(dst_box_level.getRefinementRatio()); encon_boxes.intersectBoxes(fill_boxes); encon_boxes.removeIntersections(constructed_fill_boxes); if (encon_boxes.size()) { if (!has_base_box) { - base_box_itr = dst_to_fill.makeEmptyLocalNeighborhood( - dst_mapped_box_id); + base_box_itr = dst_to_fill->makeEmptyLocalNeighborhood( + dst_box_id); has_base_box = true; } - for (hier::BoxContainer::iterator ei(encon_boxes); - ei != encon_boxes.end(); ei++) { + for (hier::BoxContainer::iterator ei = encon_boxes.begin(); + ei != encon_boxes.end(); ++ei) { - hier::Box fill_mapped_box( + hier::Box fill_box( *ei, ++last_id, - dst_mapped_box.getOwnerRank()); + dst_box.getOwnerRank()); - TBOX_ASSERT(fill_mapped_box.getBlockId() == - dst_mapped_box.getBlockId()); + TBOX_ASSERT(fill_box.getBlockId() == dst_box.getBlockId()); - fill_mapped_boxes.addBoxWithoutUpdate(fill_mapped_box); + fill_box_level->addBoxWithoutUpdate(fill_box); - dst_to_fill.insertLocalNeighbor( - fill_mapped_box, + dst_to_fill->insertLocalNeighbor( + fill_box, base_box_itr); constructed_fill_boxes.pushBack(*ei); @@ -135,17 +131,17 @@ PatchLevelEnhancedFillPattern::computeFillBoxesAndNeighborhoodSets( d_max_fill_boxes, constructed_fill_boxes.size()); } - fill_mapped_boxes.finalize(); + fill_box_level->finalize(); } void PatchLevelEnhancedFillPattern::computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) { - NULL_USE(dst_mapped_box_level); + NULL_USE(dst_box_level); NULL_USE(src_to_dst); NULL_USE(fill_ghost_width); NULL_USE(dst_fill_boxes_on_src_proc); @@ -188,4 +184,3 @@ PatchLevelEnhancedFillPattern::getMaxFillBoxes() const } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.h index 8a0efaea..5366fcac 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelEnhancedFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Level fill pattern for enhanced connectivity * ************************************************************************/ @@ -28,7 +28,7 @@ namespace xfer { * It is intended for users who wish to handle the filling of data at these * singularities separately from the filling of all other data. * - * @see xfer::RefineSchedule + * @see RefineSchedule */ class PatchLevelEnhancedFillPattern:public PatchLevelFillPattern @@ -45,32 +45,32 @@ class PatchLevelEnhancedFillPattern:public PatchLevelFillPattern virtual ~PatchLevelEnhancedFillPattern(); /*! - * @brief Compute the mapped boxes representing the region that will + * @brief Compute the boxes representing the region that will * be filled by a RefineSchedule. * - * This is currently unimplemented until BoxLevel is - * multiblock-aware. An error will occur if this is called. + * The fill boxes will exist only for destination patches that touch + * a block boundary at enhanced connectivity. The fill boxes will be + * the portion of the ghost regions of those patches lying across the + * enhanced connectivity boundary. * - * @param[out] fill_mapped_boxes Output BoxLevel to be filled + * @param[out] fill_box_level Output BoxLevel to be filled * @param[out] dst_to_fill Output Connector between - * dst_mapped_box_level and - * and fill_mapped_boxes - * @param[in] dst_mapped_box_level destination level - * @param[in] dst_to_dst Connector of destination to itself - * @param[in] dst_to_src Connector of destination to source - * @param[in] src_to_dst Connector of source to destination + * dst_box_level and fill_box_level + * @param[in] dst_box_level destination level * @param[in] fill_ghost_width Ghost width being filled by refine * schedule + * @param[in] data_on_patch_border true if there is data living on patch + * borders + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border); /*! * @brief Return true because source patch owner cannot compute fill @@ -88,11 +88,13 @@ class PatchLevelEnhancedFillPattern:public PatchLevelFillPattern * method should never be called. It is implemented here to satisfy * the pure virtual interface from the base class. An error will result * if this is ever called. + * + * @pre needsToCommunicateDestinationFillBoxes() */ void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width); @@ -138,7 +140,7 @@ class PatchLevelEnhancedFillPattern:public PatchLevelFillPattern PatchLevelEnhancedFillPattern( const PatchLevelEnhancedFillPattern&); // not implemented - void + PatchLevelEnhancedFillPattern& operator = ( const PatchLevelEnhancedFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.C index e4f3d15d..07228334 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelFillPattern_C -#define included_xfer_PatchLevelFillPattern_C - #include "SAMRAI/xfer/PatchLevelFillPattern.h" namespace SAMRAI { @@ -42,4 +38,3 @@ PatchLevelFillPattern::~PatchLevelFillPattern() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.h index b7104c81..3dca0eb0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ @@ -31,14 +31,13 @@ namespace xfer { * boxes to be filled as well as BoxNeighborhoodCollection information that * will be later used in the communications that fill those boxes. * - * @see xfer::RefineSchedule + * @see RefineSchedule * @see hier::BoxNeighborhoodCollection */ class PatchLevelFillPattern { public: - typedef std::vector BoxVector; typedef hier::BoxNeighborhoodCollection FillSet; /*! @@ -52,8 +51,7 @@ class PatchLevelFillPattern virtual ~PatchLevelFillPattern(); /*! - * @brief Compute the mapped boxes to be filled and related communication - * data. + * @brief Compute the boxes to be filled and related communication data. * * This pure virtual method provides an interface to give the * RefineSchedule the information needed to fill particular spatial @@ -61,30 +59,26 @@ class PatchLevelFillPattern * patch interiors, ghost regions, or some combination thereof) will be * specified in the concrete implementations of this class. Implementations * of this method should store the desired regions to be filled in the - * BoxSet fill_mapped_boxes, and should compute a BoxNeighborhoodCollection - * describing the relationship between dst_mapped_box_level and - * fill_mapped_boxes. + * BoxSet fill_box_level, and should compute a BoxNeighborhoodCollection + * describing the relationship between dst_box_level and + * fill_box_level. * - * @param[out] fill_mapped_boxes BoxLevel to be filled + * @param[out] fill_box_level BoxLevel to be filled * @param[out] dst_to_fill Connector between - * dst_mapped_box_level and - * and fill_mapped_boxes - * @param[in] dst_mapped_box_level destination level - * @param[in] dst_to_dst destination to itself connector - * @param[in] dst_to_src destination to source connector - * @param[in] src_to_dst source to destination connector + * dst_box_level and fill_box_level + * @param[in] dst_box_level destination level * @param[in] fill_ghost_width ghost width being filled by refine * schedule + * @param[in] data_on_patch_border true if there is data living on patch + * borders */ virtual void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) = 0; + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) = 0; /*! * @brief Return true if source owner can compute destination boxes on its @@ -120,7 +114,7 @@ class PatchLevelFillPattern * @param[out] dst_fill_boxes_on_src_proc FillSet storing the destination * neighbors of the source mapped * boxes - * @param[in] dst_mapped_box_level destination level + * @param[in] dst_box_level destination level * @param[in] src_to_dst Connector of source to destination * @param[in] fill_ghost_width Ghost width being filled by refine * schedule @@ -128,7 +122,7 @@ class PatchLevelFillPattern virtual void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) = 0; @@ -189,7 +183,7 @@ class PatchLevelFillPattern private: PatchLevelFillPattern( const PatchLevelFillPattern&); // not implemented - void + PatchLevelFillPattern& operator = ( const PatchLevelFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.C index 018843e5..163fc2d5 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelFullFillPattern_C -#define included_xfer_PatchLevelFullFillPattern_C - #include "SAMRAI/xfer/PatchLevelFullFillPattern.h" #include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/hier/Box.h" @@ -62,32 +58,36 @@ PatchLevelFullFillPattern::~PatchLevelFullFillPattern() void PatchLevelFullFillPattern::computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) { - NULL_USE(dst_to_dst); - NULL_USE(dst_to_src); - NULL_USE(src_to_dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); - - const hier::BoxContainer& dst_mapped_boxes = - dst_mapped_box_level.getBoxes(); - - for (hier::RealBoxConstIterator ni(dst_mapped_boxes.realBegin()); - ni != dst_mapped_boxes.realEnd(); ++ni) { - const hier::Box& dst_mapped_box = *ni; - hier::Box fill_mapped_box(dst_mapped_box); - fill_mapped_box.grow(fill_ghost_width); - fill_mapped_boxes.addBoxWithoutUpdate(fill_mapped_box); - dst_to_fill.insertLocalNeighbor(fill_mapped_box, dst_mapped_box.getId()); - TBOX_ASSERT(dst_to_fill.numLocalNeighbors(dst_mapped_box.getId()) == 1); + NULL_USE(data_on_patch_border); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); + + fill_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); + + dst_to_fill.reset(new hier::Connector(dst_box_level, + *fill_box_level, + fill_ghost_width)); + + const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); + + for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); + ni != dst_boxes.realEnd(); ++ni) { + const hier::Box& dst_box = *ni; + hier::Box fill_box(dst_box); + fill_box.grow(fill_ghost_width); + fill_box_level->addBoxWithoutUpdate(fill_box); + dst_to_fill->insertLocalNeighbor(fill_box, dst_box.getBoxId()); + TBOX_ASSERT(dst_to_fill->numLocalNeighbors(dst_box.getBoxId()) == 1); } - fill_mapped_boxes.finalize(); + fill_box_level->finalize(); } /* @@ -101,24 +101,24 @@ PatchLevelFullFillPattern::computeFillBoxesAndNeighborhoodSets( void PatchLevelFullFillPattern::computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) { - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); const tbox::Dimension& dim(fill_ghost_width.getDim()); - const hier::IntVector& ratio(dst_mapped_box_level.getRefinementRatio()); + const hier::IntVector& ratio(dst_box_level.getRefinementRatio()); bool is_periodic = false; - if (dst_mapped_box_level.getGridGeometry()->getPeriodicShift(ratio) != + if (dst_box_level.getGridGeometry()->getPeriodicShift(ratio) != hier::IntVector::getZero(dim)) { - is_periodic = true; + is_periodic = true; } /* - * src_to_dst initialized only when there is a src mapped_box_level. - * Without the src mapped_box_level, we do not need to compute + * src_to_dst initialized only when there is a src box_level. + * Without the src box_level, we do not need to compute * dst_fill_boxes_on_src_proc. * * For PatchLevelFullFillPattern, the src owner can compute fill boxes @@ -132,20 +132,21 @@ PatchLevelFullFillPattern::computeDestinationFillBoxesOnSourceProc( src_to_dst.getLocalNeighbors(tmp_nabrs); tmp_nabrs.unshiftPeriodicImageBoxes( all_dst_nabrs, - dst_mapped_box_level.getRefinementRatio()); + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry()->getPeriodicShiftCatalog()); } else { src_to_dst.getLocalNeighbors(all_dst_nabrs); } for (hier::BoxContainer::const_iterator na = all_dst_nabrs.begin(); na != all_dst_nabrs.end(); ++na) { FillSet::Iterator dst_fill_boxes_iter = - dst_fill_boxes_on_src_proc.insert(na->getId()).first; + dst_fill_boxes_on_src_proc.insert(na->getBoxId()).first; hier::Box fill_box(*na); fill_box.grow(fill_ghost_width); dst_fill_boxes_on_src_proc.insert(dst_fill_boxes_iter, fill_box); d_max_fill_boxes = tbox::MathUtilities::Max(d_max_fill_boxes, static_cast(dst_fill_boxes_on_src_proc.numNeighbors( - dst_fill_boxes_iter))); + dst_fill_boxes_iter))); } } @@ -189,5 +190,3 @@ PatchLevelFullFillPattern::getMaxFillBoxes() const #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.h index 48aa7eb8..8afc8736 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelFullFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ @@ -23,9 +23,9 @@ namespace xfer { * fills the entire region the destination level, both interior and * ghost. * - * For documentation on this interface see @ref xfer::PatchLevelFillPattern + * For documentation on this interface see @ref PatchLevelFillPattern * - * The fill boxes for this "All" PatchLevelFillPattern will consist of + * The fill boxes for this PatchLevelFillPattern will consist of * the entire region of the destination level that can be filled, both * interior and ghost regions. * @@ -34,8 +34,8 @@ namespace xfer { * PatchLevelFillPattern argument, this class will be used as the * default PatchLevelFillPattern. * - * @see xfer::RefineAlgorithm - * @see xfer::RefineSchedule + * @see RefineAlgorithm + * @see RefineSchedule */ class PatchLevelFullFillPattern:public PatchLevelFillPattern @@ -54,18 +54,18 @@ class PatchLevelFullFillPattern:public PatchLevelFillPattern /*! * @copydoc PatchLevelFillPattern::computeFillBoxesAndNeighborhoodSets() * - * The computed fill_mapped_boxes for this fill pattern will be the - * boxes of dst_mapped_box_level grown by the fill_ghost_width. + * The computed fill_box_level for this fill pattern will be the + * boxes of dst_box_level grown by the fill_ghost_width. + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border); /*! * @copydoc PatchLevelFillPattern::needsToCommunicateDestinationFillBoxes() @@ -79,11 +79,13 @@ class PatchLevelFullFillPattern:public PatchLevelFillPattern /*! * @copydoc PatchLevelFillPattern::computeDestinationFillBoxesOnSourceProc() + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width); @@ -117,7 +119,7 @@ class PatchLevelFullFillPattern:public PatchLevelFillPattern private: PatchLevelFullFillPattern( const PatchLevelFullFillPattern&); // not implemented - void + PatchLevelFullFillPattern& operator = ( const PatchLevelFullFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.C index 7fa61405..3ad4130f 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.C @@ -3,17 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_PatchLevelInteriorFillPattern_C -#define included_xfer_PatchLevelInteriorFillPattern_C - #include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/RealBoxConstIterator.h" #include "SAMRAI/tbox/MathUtilities.h" #if !defined(__BGL_FAMILY__) && defined(__xlC__) @@ -62,35 +59,38 @@ PatchLevelInteriorFillPattern::~PatchLevelInteriorFillPattern() void PatchLevelInteriorFillPattern::computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border) { - NULL_USE(dst_to_dst); - NULL_USE(dst_to_src); - NULL_USE(src_to_dst); NULL_USE(fill_ghost_width); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + NULL_USE(data_on_patch_border); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); - const hier::BoxContainer& dst_mapped_boxes = - dst_mapped_box_level.getBoxes(); + fill_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); + + dst_to_fill.reset(new hier::Connector(dst_box_level, + *fill_box_level, + fill_ghost_width)); + + const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); /* * Fill just the interior. Disregard gcw. */ - for (hier::BoxContainer::const_iterator ni = dst_mapped_boxes.begin(); - ni != dst_mapped_boxes.end(); ++ni) { - const hier::BoxId& gid = ni->getId(); - const hier::Box& dst_mapped_box = - *dst_mapped_box_level.getBox(gid); - fill_mapped_boxes.addBoxWithoutUpdate(dst_mapped_box); - dst_to_fill.insertLocalNeighbor(dst_mapped_box, gid); + for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); + ni != dst_boxes.realEnd(); ++ni) { + const hier::BoxId& gid = ni->getBoxId(); + const hier::Box& dst_box = *dst_box_level.getBox(gid); + fill_box_level->addBoxWithoutUpdate(dst_box); + dst_to_fill->insertLocalNeighbor(dst_box, gid); } - fill_mapped_boxes.finalize(); + fill_box_level->finalize(); } /* @@ -104,25 +104,25 @@ PatchLevelInteriorFillPattern::computeFillBoxesAndNeighborhoodSets( void PatchLevelInteriorFillPattern::computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width) { NULL_USE(fill_ghost_width); - TBOX_DIM_ASSERT_CHECK_ARGS2(dst_mapped_box_level, fill_ghost_width); + TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); const tbox::Dimension& dim(fill_ghost_width.getDim()); - const hier::IntVector& ratio(dst_mapped_box_level.getRefinementRatio()); + const hier::IntVector& ratio(dst_box_level.getRefinementRatio()); bool is_periodic = false; - if (dst_mapped_box_level.getGridGeometry()->getPeriodicShift(ratio) != + if (dst_box_level.getGridGeometry()->getPeriodicShift(ratio) != hier::IntVector::getZero(dim)) { is_periodic = true; } /* - * src_to_dst initialized only when there is a src mapped_box_level. - * Without the src mapped_box_level, we do not need to compute + * src_to_dst initialized only when there is a src box_level. + * Without the src box_level, we do not need to compute * dst_fill_boxes_on_src_proc. * * For PatchLevelInteriorFillPattern, the src owner can compute fill @@ -136,18 +136,19 @@ PatchLevelInteriorFillPattern::computeDestinationFillBoxesOnSourceProc( src_to_dst.getLocalNeighbors(tmp_nabrs); tmp_nabrs.unshiftPeriodicImageBoxes( all_dst_nabrs, - dst_mapped_box_level.getRefinementRatio()); + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry()->getPeriodicShiftCatalog()); } else { src_to_dst.getLocalNeighbors(all_dst_nabrs); } for (hier::BoxContainer::const_iterator na = all_dst_nabrs.begin(); na != all_dst_nabrs.end(); ++na) { FillSet::Iterator dst_fill_boxes_iter = - dst_fill_boxes_on_src_proc.insert(na->getId()).first; + dst_fill_boxes_on_src_proc.insert(na->getBoxId()).first; dst_fill_boxes_on_src_proc.insert(dst_fill_boxes_iter, *na); d_max_fill_boxes = tbox::MathUtilities::Max(d_max_fill_boxes, static_cast(dst_fill_boxes_on_src_proc.numNeighbors( - dst_fill_boxes_iter))); + dst_fill_boxes_iter))); } } @@ -191,5 +192,3 @@ PatchLevelInteriorFillPattern::getMaxFillBoxes() const #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.h index 05b18cc2..40f73e50 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/PatchLevelInteriorFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: fill pattern class for filling interiors only * ************************************************************************/ @@ -21,13 +21,13 @@ namespace xfer { /*! * @brief PatchLevelFillPattern implementation for patch interior filling. * - * For documentation on this interface see @ref xfer::PatchLevelFillPattern + * For documentation on this interface see @ref PatchLevelFillPattern * * Those fill boxes for this PatchLevelFillPattern will consist of the * patch interiors on the destination level only. * - * @see xfer::RefineAlgorithm - * @see xfer::RefineSchedule + * @see RefineAlgorithm + * @see RefineSchedule */ class PatchLevelInteriorFillPattern:public PatchLevelFillPattern @@ -44,32 +44,29 @@ class PatchLevelInteriorFillPattern:public PatchLevelFillPattern virtual ~PatchLevelInteriorFillPattern(); /*! - * @brief Compute the mapped boxes to be filled and related communication - * data. + * @brief Compute the boxes to be filled and related communication data. * - * The computed fill_mapped_boxes will be the boxes of dst_mapped_box_level, + * The computed fill_box_level will be the boxes of dst_box_level, * the "interior" of the destination level. * - * @param[out] fill_mapped_boxes Output BoxLevel to be filled + * @param[out] fill_box_level Output BoxLevel to be filled * @param[out] dst_to_fill Output Connector between - * dst_mapped_box_level and - * and fill_mapped_boxes - * @param[in] dst_mapped_box_level destination level - * @param[in] dst_to_dst Connector of destination to itself - * @param[in] dst_to_src Connector of destination to source - * @param[in] src_to_dst Connector of source to destination + * dst_box_level and fill_box_level + * @param[in] dst_box_level destination level * @param[in] fill_ghost_width Ghost width being filled by refine * schedule + * @param[in] data_on_patch_border true if there is data living on patch + * borders + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeFillBoxesAndNeighborhoodSets( - hier::BoxLevel& fill_mapped_boxes, - hier::Connector& dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector& dst_to_dst, - const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, - const hier::IntVector& fill_ghost_width); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + const hier::BoxLevel& dst_box_level, + const hier::IntVector& fill_ghost_width, + bool data_on_patch_border); /*! * @brief Return false because source patch owner can compute destination @@ -87,17 +84,19 @@ class PatchLevelInteriorFillPattern:public PatchLevelFillPattern /*! * @brief Compute the destination fill boxes. * - * @param[in] dst_mapped_box_level Destination level + * @param[in] dst_box_level Destination level * @param[in] src_to_dst Connector of source to destination * @param[in] fill_ghost_width Ghost width filled by refine schedule * @param[out] dst_fill_boxes_on_src_proc FillSet storing the destination * neighbors of the source mapped * boxes + * + * @pre dst_box_level.getDim() == fill_ghost_width.getDim() */ void computeDestinationFillBoxesOnSourceProc( FillSet& dst_fill_boxes_on_src_proc, - const hier::BoxLevel& dst_mapped_box_level, + const hier::BoxLevel& dst_box_level, const hier::Connector& src_to_dst, const hier::IntVector& fill_ghost_width); @@ -128,7 +127,7 @@ class PatchLevelInteriorFillPattern:public PatchLevelFillPattern fillingCoarseFineGhosts() const; /*! - * @brief Returns false because this fill pattern is specialized for + * @brief Returns false because this fill pattern is not specialized for * enhanced connectivity only. */ bool @@ -137,7 +136,7 @@ class PatchLevelInteriorFillPattern:public PatchLevelFillPattern private: PatchLevelInteriorFillPattern( const PatchLevelInteriorFillPattern&); // not implemented - void + PatchLevelInteriorFillPattern& operator = ( const PatchLevelInteriorFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.C index 6d871ef1..3ae60e37 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Refine algorithm for data transfer between AMR levels * ************************************************************************/ - -#ifndef included_xfer_RefineAlgorithm_C -#define included_xfer_RefineAlgorithm_C - #include "SAMRAI/xfer/RefineAlgorithm.h" #include "SAMRAI/xfer/BoxGeometryVariableFillPattern.h" @@ -22,7 +18,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace xfer { @@ -35,9 +31,7 @@ namespace xfer { ************************************************************************* */ -RefineAlgorithm::RefineAlgorithm( - const tbox::Dimension& dim): - d_dim(dim), +RefineAlgorithm::RefineAlgorithm(): d_refine_classes(boost::make_shared()), d_schedule_created(false) { @@ -72,12 +66,6 @@ RefineAlgorithm::registerRefine( const boost::shared_ptr& oprefine, const boost::shared_ptr& var_fill_pattern) { -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - if (oprefine) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *oprefine); - } -#endif - if (d_schedule_created) { TBOX_ERROR("RefineAlgorithm::registerRefine error..." << "\nCannot call registerRefine with a RefineAlgorithm" @@ -176,12 +164,6 @@ RefineAlgorithm::createSchedule( const boost::shared_ptr& transaction_factory) { TBOX_ASSERT(level); -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *level); - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); - } -#endif d_schedule_created = true; @@ -196,12 +178,12 @@ RefineAlgorithm::createSchedule( boost::make_shared()); return boost::make_shared( - fill_pattern, - level, - level, - d_refine_classes, - trans_factory, - patch_strategy); + fill_pattern, + level, + level, + d_refine_classes, + trans_factory, + patch_strategy); } /* @@ -222,12 +204,6 @@ RefineAlgorithm::createSchedule( const boost::shared_ptr& transaction_factory) { TBOX_ASSERT(level); -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *level); - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); - } -#endif d_schedule_created = true; @@ -239,12 +215,12 @@ RefineAlgorithm::createSchedule( } return boost::make_shared( - fill_pattern, - level, - level, - d_refine_classes, - trans_factory, - patch_strategy); + fill_pattern, + level, + level, + d_refine_classes, + trans_factory, + patch_strategy); } /* @@ -269,12 +245,7 @@ RefineAlgorithm::createSchedule( TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, *dst_level, *src_level); - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); - } -#endif + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); d_schedule_created = true; @@ -289,13 +260,13 @@ RefineAlgorithm::createSchedule( boost::make_shared()); return boost::make_shared( - fill_pattern, - dst_level, - src_level, - d_refine_classes, - trans_factory, - patch_strategy, - use_time_refinement); + fill_pattern, + dst_level, + src_level, + d_refine_classes, + trans_factory, + patch_strategy, + use_time_refinement); } /* @@ -319,12 +290,7 @@ RefineAlgorithm::createSchedule( { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); -#ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, *dst_level, *src_level); - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); - } -#endif + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); d_schedule_created = true; @@ -336,13 +302,13 @@ RefineAlgorithm::createSchedule( } return boost::make_shared( - fill_pattern, - dst_level, - src_level, - d_refine_classes, - trans_factory, - patch_strategy, - use_time_refinement); + fill_pattern, + dst_level, + src_level, + d_refine_classes, + trans_factory, + patch_strategy, + use_time_refinement); } /* @@ -365,16 +331,12 @@ RefineAlgorithm::createSchedule( const boost::shared_ptr& transaction_factory) { - // Do we all agree on the destination mapped_box_level? + // Do we all agree on the destination box_level? TBOX_ASSERT(level); TBOX_ASSERT((next_coarser_level == -1) || hierarchy); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *level); if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*level, *hierarchy); } #endif @@ -391,15 +353,15 @@ RefineAlgorithm::createSchedule( boost::make_shared()); return boost::make_shared( - fill_pattern, - level, - level, - next_coarser_level, - hierarchy, - d_refine_classes, - trans_factory, - patch_strategy, - use_time_refinement); + fill_pattern, + level, + level, + next_coarser_level, + hierarchy, + d_refine_classes, + trans_factory, + patch_strategy, + use_time_refinement); } /* @@ -423,16 +385,12 @@ RefineAlgorithm::createSchedule( const boost::shared_ptr& transaction_factory) { - // Do we all agree on the destination mapped_box_level? + // Do we all agree on the destination box_level? TBOX_ASSERT(level); TBOX_ASSERT((next_coarser_level == -1) || hierarchy); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *level); if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*level, *hierarchy); } #endif @@ -446,15 +404,15 @@ RefineAlgorithm::createSchedule( } return boost::make_shared( - fill_pattern, - level, - level, - next_coarser_level, - hierarchy, - d_refine_classes, - trans_factory, - patch_strategy, - use_time_refinement); + fill_pattern, + level, + level, + next_coarser_level, + hierarchy, + d_refine_classes, + trans_factory, + patch_strategy, + use_time_refinement); } /* @@ -482,19 +440,15 @@ RefineAlgorithm::createSchedule( TBOX_ASSERT(dst_level); TBOX_ASSERT((next_coarser_level == -1) || hierarchy); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_level); if (src_level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *src_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); } if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *hierarchy); } #endif - // Do we all agree on the destination mapped_box_level? + // Do we all agree on the destination box_level? if (src_level) { if (next_coarser_level >= 0) { } @@ -513,15 +467,15 @@ RefineAlgorithm::createSchedule( boost::make_shared()); return boost::make_shared( - fill_pattern, - dst_level, - src_level, - next_coarser_level, - hierarchy, - d_refine_classes, - trans_factory, - patch_strategy, - false); + fill_pattern, + dst_level, + src_level, + next_coarser_level, + hierarchy, + d_refine_classes, + trans_factory, + patch_strategy, + false); } /* @@ -550,19 +504,15 @@ RefineAlgorithm::createSchedule( TBOX_ASSERT(dst_level); TBOX_ASSERT((next_coarser_level == -1) || hierarchy); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *dst_level); if (src_level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *src_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); } if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*this, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *hierarchy); } #endif - // Do we all agree on the destination mapped_box_level? + // Do we all agree on the destination box_level? if (src_level) { if (next_coarser_level >= 0) { } @@ -578,15 +528,15 @@ RefineAlgorithm::createSchedule( } return boost::make_shared( - fill_pattern, - dst_level, - src_level, - next_coarser_level, - hierarchy, - d_refine_classes, - trans_factory, - patch_strategy, - false); + fill_pattern, + dst_level, + src_level, + next_coarser_level, + hierarchy, + d_refine_classes, + trans_factory, + patch_strategy, + false); } /* @@ -613,7 +563,7 @@ void RefineAlgorithm::resetSchedule( schedule->reset(d_refine_classes); } else { TBOX_ERROR("RefineAlgorithm::resetSchedule error..." - << "\n Items in xfer::RefineClasses object passed to reset" + << "\n Items in RefineClasses object passed to reset" << "\n routine does not match that in existing schedule." << std::endl); } @@ -638,4 +588,3 @@ RefineAlgorithm::printClassData( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.h index 63d0b6c5..860ee473 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineAlgorithm.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Refine algorithm for data transfer between AMR levels * ************************************************************************/ @@ -25,7 +25,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace xfer { @@ -112,9 +112,9 @@ namespace xfer { * as long as the patches involved in the communication process do not change; * thus, they can be used for multiple data communication cycles. * - * @see xfer::RefineSchedule - * @see xfer::RefinePatchStrategy - * @see xfer::RefineClasses + * @see RefineSchedule + * @see RefinePatchStrategy + * @see RefineClasses */ class RefineAlgorithm @@ -127,8 +127,7 @@ class RefineAlgorithm * before it can do anything useful. See the registerRefine() routines * for details */ - explicit RefineAlgorithm( - const tbox::Dimension& dim); + RefineAlgorithm(); /*! * @brief The destructor releases all internal storage. @@ -159,6 +158,8 @@ class RefineAlgorithm * the NULL default is used, then class * BoxGeometryVariableFillPattern will be used * internally. + * + * @pre !d_schedule_created */ void registerRefine( @@ -178,9 +179,7 @@ class RefineAlgorithm * the destination data using scratch data as a temporary work * space. The scratch data must have sufficient ghost cells to cover * the required operator stencil width and any needed physical boundary - * ghost cells. The time interpolation operator cannot be null. When - * assertion checking is active, passing in a null pointer will result in an - * unrecoverable assertion. + * ghost cells. * * @param[in] dst Patch data index filled on the destination level. * @param[in] src Patch data index for source data. @@ -203,6 +202,9 @@ class RefineAlgorithm * the NULL default is used, then class * BoxGeometryVariableFillPattern will be used * internally. + * + * @pre optime + * @pre !d_schedule_created */ void registerRefine( @@ -246,11 +248,13 @@ class RefineAlgorithm * pointer is null (default state), then a * StandardRefineTransactionFactory object * will be used. + * + * @pre level */ boost::shared_ptr createSchedule( const boost::shared_ptr& level, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -260,12 +264,14 @@ class RefineAlgorithm * @param[in] fill_pattern Indicates which parts of the destination level * to fill. See RefineSchedule for available * patterns. + * + * @pre level */ boost::shared_ptr createSchedule( const boost::shared_ptr& fill_pattern, const boost::shared_ptr& level, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -309,12 +315,16 @@ class RefineAlgorithm * null (default state), then a * StandardRefineTransactionFactory object * will be used. + * + * @pre dst_level + * @pre src_level + * @pre dst_level->getDim() == src_level->getDim() */ boost::shared_ptr createSchedule( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -330,13 +340,17 @@ class RefineAlgorithm * @param patch_strategy * @param[in] use_time_interpolation * @param[in] transaction_factory + * + * @pre dst_level + * @pre src_level + * @pre dst_level->getDim() == src_level->getDim() */ boost::shared_ptr createSchedule( const boost::shared_ptr& fill_pattern, const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -406,13 +420,17 @@ class RefineAlgorithm * null (default state), then a * StandardRefineTransactionFactory object * will be used. + * + * @pre level + * @pre (next_coarser_level == -1) || hierarchy + * @pre !hierarchy || (level->getDim() == hierarchy->getDim()) */ boost::shared_ptr createSchedule( const boost::shared_ptr& level, const int next_coarser_level, const boost::shared_ptr& hierarchy, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -429,6 +447,10 @@ class RefineAlgorithm * @param patch_strategy * @param[in] use_time_interpolation * @param[in] transaction_factory + * + * @pre level + * @pre (next_coarser_level == -1) || hierarchy + * @pre !hierarchy || (level->getDim() == hierarchy->getDim()) */ boost::shared_ptr createSchedule( @@ -436,7 +458,7 @@ class RefineAlgorithm const boost::shared_ptr& level, const int next_coarser_level, const boost::shared_ptr& hierarchy, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -522,6 +544,11 @@ class RefineAlgorithm * null (default state), then a * StandardRefineTransactionFactory object * will be used. + * + * @pre dst_level + * @pre (next_coarser_level == -1) || hierarchy + * @pre !src_level || (dst_level->getDim() == src_level->getDim()) + * @pre !hierarchy || (dst_level->getDim() == hierarchy->getDim()) */ boost::shared_ptr createSchedule( @@ -529,7 +556,7 @@ class RefineAlgorithm const boost::shared_ptr& src_level, const int next_coarser_level, const boost::shared_ptr& hierarchy, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -547,6 +574,11 @@ class RefineAlgorithm * @param patch_strategy * @param[in] use_time_interpolation * @param[in] transaction_factory + * + * @pre dst_level + * @pre (next_coarser_level == -1) || hierarchy + * @pre !src_level || (dst_level->getDim() == src_level->getDim()) + * @pre !hierarchy || (dst_level->getDim() == hierarchy->getDim()) */ boost::shared_ptr createSchedule( @@ -555,7 +587,7 @@ class RefineAlgorithm const boost::shared_ptr& src_level, const int next_coarser_level, const boost::shared_ptr& hierarchy, - RefinePatchStrategy * patch_strategy = ((RefinePatchStrategy *)NULL), + RefinePatchStrategy* patch_strategy = 0, bool use_time_interpolation = false, const boost::shared_ptr& transaction_factory = boost::shared_ptr()); @@ -577,6 +609,8 @@ class RefineAlgorithm * * @param[in] schedule boost::shared_ptr to refine schedule, which cannot * be null. + * + * @pre schedule */ bool checkConsistency( @@ -598,6 +632,9 @@ class RefineAlgorithm * * @param[in,out] schedule boost::shared_ptr to refine schedule, which * cannot be null. + * + * @pre schedule + * @pre d_refine_classes->classesMatch(schedule->getEquivalenceClasses()) */ void resetSchedule( @@ -625,15 +662,6 @@ class RefineAlgorithm d_refine_classes = refine_classes; } - /*! - * @brief Return the dimension of this object. - */ - const tbox::Dimension& - getDim() const - { - return d_dim; - } - /*! * @brief Print the refine algorithm state to the specified data stream. * @@ -646,20 +674,10 @@ class RefineAlgorithm private: RefineAlgorithm( const RefineAlgorithm&); // not implemented - void + RefineAlgorithm& operator = ( const RefineAlgorithm&); // not implemented - //! @brief Shorthand typedef. - typedef hier::Box MBox; - //! @brief Shorthand typedef. - typedef hier::BoxLevel BoxLevel; - - /*! - * @brief Dimension of the object - */ - const tbox::Dimension d_dim; - /*! * RefineClasses object holds all of the registered refine items */ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.C index f50d276b..dfad2c17 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple structure for managing refinement data in equivalence classes. * ************************************************************************/ - -#ifndef included_xfer_RefineClasses_C -#define included_xfer_RefineClasses_C - #include #include "SAMRAI/xfer/RefineClasses.h" @@ -34,10 +30,9 @@ int RefineClasses::s_default_refine_item_array_size = 20; ************************************************************************* */ -RefineClasses::RefineClasses(): - d_num_refine_items(0) +RefineClasses::RefineClasses() { - d_refine_classes_data_items.resizeArray(s_default_refine_item_array_size); + d_refine_classes_data_items.reserve(s_default_refine_item_array_size); } /* @@ -77,22 +72,15 @@ RefineClasses::insertEquivalenceClassItem( int eq_index = getEquivalenceClassIndex(data, descriptor); if (eq_index < 0) { - eq_index = d_equivalence_class_indices.size(); - d_equivalence_class_indices.resizeArray(eq_index + 1); + eq_index = static_cast(d_equivalence_class_indices.size()); + d_equivalence_class_indices.resize(eq_index + 1); } data.d_class_index = eq_index; - if (d_num_refine_items >= d_refine_classes_data_items.size()) { - d_refine_classes_data_items.resizeArray( - d_num_refine_items + s_default_refine_item_array_size); - } - - d_refine_classes_data_items[d_num_refine_items] = data; - - d_equivalence_class_indices[eq_index].push_back(d_num_refine_items); - - d_num_refine_items++; + d_equivalence_class_indices[eq_index].push_back(static_cast(d_refine_classes_data_items. + size())); + d_refine_classes_data_items.push_back(data); } @@ -152,6 +140,8 @@ RefineClasses::itemIsValid( boost::shared_ptr scratch_fact( pd->getPatchDataFactory(scratch_id)); + const tbox::Dimension& dim = dst_fact->getDim(); + if (item_good && !(src_fact->validCopyTo(scratch_fact))) { item_good = false; TBOX_ERROR("Bad data given to RefineClasses...\n" @@ -185,13 +175,13 @@ RefineClasses::itemIsValid( boost::shared_ptr refop(data_item.d_oprefine); if (item_good && refop) { - if (refop->getStencilWidth() > scratch_gcw) { + if (refop->getStencilWidth(dim) > scratch_gcw) { item_good = false; TBOX_ERROR("Bad data given to RefineClasses...\n" << "Refine operator " << refop->getOperatorName() << "\nhas larger stencil width than ghost cell width" << "of `Scratch' patch data" << pd->mapIndexToName(scratch_id) - << "\noperator stencil width = " << refop->getStencilWidth() + << "\noperator stencil width = " << refop->getStencilWidth(scratch_gcw.getDim()) << "\n`Scratch' ghost width = " << scratch_gcw << std::endl); } } @@ -202,7 +192,7 @@ RefineClasses::itemIsValid( if (fill_pattern->getPatternName() != "BOX_GEOMETRY_FILL_PATTERN") { if (fill_pattern->getStencilWidth() > scratch_gcw) { item_good = false; - TBOX_ERROR("Bad data given to RefineClasses...\n" + TBOX_ERROR("Bad data given to RefineClasses...\n" << "VariableFillPattern " << fill_pattern->getPatternName() << "\nhas larger stencil width than ghost cell width" << "of `Scratch' patch data" << pd->mapIndexToName( @@ -315,7 +305,7 @@ RefineClasses::classesMatch( } // if number of items in equivalence class match - eq_index++; + ++eq_index; } // while equivalence classes match @@ -346,6 +336,7 @@ RefineClasses::itemsAreEquivalent( if (!pd) { pd = hier::VariableDatabase::getDatabase()->getPatchDescriptor(); } + const tbox::Dimension& dim = pd->getPatchDataFactory(data1.d_dst)->getDim(); equivalent = patchDataMatch(data1.d_dst, data2.d_dst, pd); @@ -363,8 +354,8 @@ RefineClasses::itemsAreEquivalent( equivalent &= (!data1.d_oprefine == !data2.d_oprefine); if (equivalent && data1.d_oprefine) { - equivalent &= (data1.d_oprefine->getStencilWidth() == - data2.d_oprefine->getStencilWidth()); + equivalent &= (data1.d_oprefine->getStencilWidth(dim) == + data2.d_oprefine->getStencilWidth(dim)); } equivalent &= (!data1.d_var_fill_pattern == @@ -391,19 +382,19 @@ RefineClasses::printClassData( { stream << "RefineClasses::printClassData()\n"; stream << "--------------------------------------\n"; - for (int i = 0; i < d_equivalence_class_indices.size(); i++) { + for (int i = 0; i < static_cast(d_equivalence_class_indices.size()); ++i) { stream << "EQUIVALENCE CLASS # " << i << std::endl; int j = 0; const std::list& indices = d_equivalence_class_indices[i]; for (std::list::const_iterator li(indices.begin()); - li != indices.end(); li++) { + li != indices.end(); ++li) { stream << "Item # " << j << std::endl; stream << "-----------------------------\n"; printRefineItem(stream, d_refine_classes_data_items[*li]); - j++; + ++j; } stream << std::endl; } @@ -437,7 +428,8 @@ RefineClasses::printRefineItem( << data.d_oprefine->getOperatorPriority() << std::endl; stream << "operator stencil width: " - << data.d_oprefine->getStencilWidth() + << data.d_oprefine->getStencilWidth( + hier::VariableDatabase::getDatabase()->getPatchDescriptor()->getPatchDataDim(data.d_dst)) << std::endl; } if (!data.d_time_interpolate) { @@ -514,7 +506,7 @@ RefineClasses::getEquivalenceClassIndex( const RefineClasses::Data& data, const boost::shared_ptr& descriptor) const { - NULL_USE(descriptor); + NULL_USE(descriptor); int eq_index = -1; @@ -531,7 +523,7 @@ RefineClasses::getEquivalenceClassIndex( eq_index = check_index; } - check_index++; + ++check_index; } return eq_index; @@ -540,4 +532,3 @@ RefineClasses::getEquivalenceClassIndex( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.h index 7c934394..be05ea2b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineClasses.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple structure for managing refinement data in equivalence classes. * ************************************************************************/ @@ -13,14 +13,14 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" #include "SAMRAI/xfer/VariableFillPattern.h" -#include +#include "boost/shared_ptr.hpp" #include #include +#include namespace SAMRAI { namespace xfer { @@ -132,7 +132,7 @@ class RefineClasses int getNumberOfEquivalenceClasses() const { - return d_equivalence_class_indices.size(); + return static_cast(d_equivalence_class_indices.size()); } /*! @@ -142,18 +142,19 @@ class RefineClasses int getNumberOfRefineItems() const { - return d_num_refine_items; + return static_cast(d_refine_classes_data_items.size()); } /*! * @brief Get representative item for a given equivalence class index. * - * When assertion checking is active, the index will be checked for validity. - * * @return Given index of an existing equivalence class, one item * from that class is returned. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ const RefineClasses::Data& getClassRepresentative( @@ -162,7 +163,7 @@ class RefineClasses TBOX_ASSERT((equiv_class_index >= 0) && (equiv_class_index < getNumberOfEquivalenceClasses())); return d_refine_classes_data_items[ - d_equivalence_class_indices[equiv_class_index].front()]; + d_equivalence_class_indices[equiv_class_index].front()]; } /*! @@ -191,8 +192,7 @@ class RefineClasses * * The number of quivalence classes can be determined via the * getNumberOfEquivalenceClasses() member function. Valid integer - * arguments are from 0 to getNumberOfEquivalenceClasses()-1. When - * assertion checking is active, the id will be checked for validity. + * arguments are from 0 to getNumberOfEquivalenceClasses()-1. * * @note The list should not be modified through this iterator. * @@ -202,6 +202,9 @@ class RefineClasses * class. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ std::list::iterator getIterator( @@ -218,8 +221,7 @@ class RefineClasses * * The number of quivalence classes can be determined via the * getNumberOfEquivalenceClasses() member function. Valid integer - * arguments are from 0 to getNumberOfEquivalenceClasses()-1. When - * assertion checking is active, the id will be checked for validity. + * arguments are from 0 to getNumberOfEquivalenceClasses()-1. * * @note The list should not be modified through this iterator. * @@ -229,6 +231,9 @@ class RefineClasses * class. * * @param[in] equiv_class_index + * + * @pre (equiv_class_index >= 0) && + * (equiv_class_index < getNumberOfEquivalenceClasses()) */ std::list::iterator getIteratorEnd( @@ -248,15 +253,14 @@ class RefineClasses * this item. The integer class index in the data item will set to the * index of the equivalence class into which it is inserted. * - * If assertion checking is active, the data item will be checked for - * validity. See itemIsValid() for explanation of validity. - * * If a null patch descriptor argument is passed (or ommitted), the * descriptor associated with the variable database Singleton object will be * used. * * @param[in,out] data_item * @param[in] descriptor + * + * @pre itemIsValid(data, descriptor) */ void insertEquivalenceClassItem( @@ -360,21 +364,6 @@ class RefineClasses const boost::shared_ptr& descriptor = boost::shared_ptr()) const; - /*! - * @brief Get the size that has been allocated for the array storing refine - * items. - * - * Note that this is not necessarily the same as the number of registered - * refine items, which can be retrieved using getNumberOfRefineItems(). - * The refine item array is allocated to a default size and grown when - * necessary or when increaseRefineItemArraySize() is called. - */ - int - getRefineItemArraySize() const - { - return d_refine_classes_data_items.size(); - } - /*! * @brief Increase the allocated size of the array storing refine items. * @@ -389,8 +378,8 @@ class RefineClasses increaseRefineItemArraySize( const int size) { - if (size > d_refine_classes_data_items.size()) { - d_refine_classes_data_items.resizeArray(size); + if (size > static_cast(d_refine_classes_data_items.size())) { + d_refine_classes_data_items.resize(size); } } @@ -417,7 +406,7 @@ class RefineClasses private: RefineClasses( const RefineClasses&); // not implemented - void + RefineClasses& operator = ( const RefineClasses&); // not implemented @@ -467,7 +456,7 @@ class RefineClasses /*! * The array of refine items. */ - tbox::Array d_refine_classes_data_items; + std::vector d_refine_classes_data_items; /*! * The array managing equivalence classes. Each element of the array @@ -475,12 +464,7 @@ class RefineClasses * which items are part of an equivalence class. The integers index into * the array d_refine_classes_data_items. */ - tbox::Array > d_equivalence_class_indices; - - /*! - * The number of refine items that have been registered. - */ - int d_num_refine_items; + std::vector > d_equivalence_class_indices; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.C index 9d7152b3..20bdfb95 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for data copies during data refining * ************************************************************************/ - -#ifndef included_xfer_RefineCopyTransaction_C -#define included_xfer_RefineCopyTransaction_C - #include "SAMRAI/xfer/RefineCopyTransaction.h" #include "SAMRAI/hier/Patch.h" @@ -28,10 +24,6 @@ namespace SAMRAI { namespace xfer { -const RefineClasses::Data ** RefineCopyTransaction::s_refine_items = - (const RefineClasses::Data **)NULL; -int RefineCopyTransaction::s_num_refine_items = 0; - /* ************************************************************************* * @@ -44,34 +36,37 @@ RefineCopyTransaction::RefineCopyTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - const int refine_item_id): - d_dst_patch_rank(dst_mapped_box.getOwnerRank()), - d_src_patch_rank(src_mapped_box.getOwnerRank()), + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data** refine_data, + int item_id): + d_dst_patch_rank(dst_box.getOwnerRank()), + d_src_patch_rank(src_box.getOwnerRank()), d_overlap(overlap), - d_refine_item_id(refine_item_id), + d_refine_data(refine_data), + d_item_id(item_id), d_incoming_bytes(0), d_outgoing_bytes(0) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); TBOX_ASSERT(overlap); - TBOX_ASSERT(dst_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(src_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(refine_item_id >= 0); - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, + TBOX_ASSERT(dst_box.getLocalId() >= 0); + TBOX_ASSERT(src_box.getLocalId() >= 0); + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box); + dst_box, + src_box); // Note: s_num_coarsen_items cannot be used at this point! if (d_dst_patch_rank == dst_level->getBoxLevel()->getMPI().getRank()) { - d_dst_patch = dst_level->getPatch(dst_mapped_box.getGlobalId()); + d_dst_patch = dst_level->getPatch(dst_box.getGlobalId()); } if (d_src_patch_rank == dst_level->getBoxLevel()->getMPI().getRank()) { - d_src_patch = src_level->getPatch(src_mapped_box.getGlobalId()); + d_src_patch = src_level->getPatch(src_box.getGlobalId()); } } @@ -93,11 +88,11 @@ RefineCopyTransaction::canEstimateIncomingMessageSize() bool can_estimate = false; if (d_src_patch) { can_estimate = - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src) + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src) ->canEstimateStreamSizeFromBox(); } else { can_estimate = - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->canEstimateStreamSizeFromBox(); } return can_estimate; @@ -107,7 +102,7 @@ size_t RefineCopyTransaction::computeIncomingMessageSize() { d_incoming_bytes = - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->getDataStreamSize(*d_overlap); return d_incoming_bytes; } @@ -116,7 +111,7 @@ size_t RefineCopyTransaction::computeOutgoingMessageSize() { d_outgoing_bytes = - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src) + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src) ->getDataStreamSize(*d_overlap); return d_outgoing_bytes; } @@ -135,7 +130,7 @@ void RefineCopyTransaction::packStream( tbox::MessageStream& stream) { - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src) + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src) ->packStream(stream, *d_overlap); } @@ -143,7 +138,7 @@ void RefineCopyTransaction::unpackStream( tbox::MessageStream& stream) { - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->unpackStream(stream, *d_overlap); } @@ -151,10 +146,10 @@ void RefineCopyTransaction::copyLocalData() { hier::PatchData& dst_data = - *d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch); + *d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch); const hier::PatchData& src_data = - *d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src); + *d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src); dst_data.copy(src_data, *d_overlap); } @@ -172,18 +167,18 @@ RefineCopyTransaction::printClassData( std::ostream& stream) const { stream << "Refine Copy Transaction" << std::endl; - stream << " refine item array: " - << (RefineClasses::Data **)s_refine_items << std::endl; - stream << " num refine items: " << s_num_refine_items << std::endl; + stream << " refine item: " + << (RefineClasses::Data *)d_refine_data[d_item_id] << std::endl; stream << " destination patch rank: " << d_dst_patch_rank << std::endl; stream << " source patch rank: " << d_src_patch_rank << std::endl; - stream << " refine item id: " << d_refine_item_id << std::endl; - stream << " destination patch data id: " - << s_refine_items[d_refine_item_id]->d_scratch << std::endl; - stream << " source patch data id: " - << s_refine_items[d_refine_item_id]->d_src << std::endl; + if (d_refine_data) { + stream << " destination patch data id: " + << d_refine_data[d_item_id]->d_scratch << std::endl; + stream << " source patch data id: " + << d_refine_data[d_item_id]->d_src << std::endl; + } stream << " incoming bytes: " << d_incoming_bytes << std::endl; stream << " outgoing bytes: " << d_outgoing_bytes << std::endl; stream << " destination patch: " @@ -204,5 +199,3 @@ RefineCopyTransaction::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.h index 952b9c3f..3480032a 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineCopyTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for data copies during data * refining * @@ -26,16 +26,16 @@ namespace xfer { /*! * @brief Class RefineCopyTransaction represents a single copy communication - * transaction between two processors or a local data copy for refine schedules. - * Note that to there is an implicit hand-shaking between objects of this class - * and the RefineSchedule object that constructs them. Following the refine - * schedule implementation, the source patch data index for a copy transaction - * always refers to the source data and the destination patch data index for a copy - * transaction is always the scratch data, all as defined in the - * RefineClasses class. + * transaction between two processors or a local data copy for refine + * schedules. Note that to there is an implicit hand-shaking between objects + * of this class and the RefineSchedule object that constructs them. Following + * the refine schedule implementation, the source patch data index for a copy + * transaction always refers to the source data and the destination patch data + * index for a copy transaction is always the scratch data, all as defined in + * the RefineClasses class. * - * @see xfer::RefineSchedule - * @see xfer::RefineClasses + * @see RefineSchedule + * @see RefineClasses * @see tbox::Schedule * @see tbox::Transaction */ @@ -43,63 +43,45 @@ namespace xfer { class RefineCopyTransaction:public tbox::Transaction { public: - /*! - * Static member function to set the array of refine class data items that - * is shared by all object instances of this copy transaction class during - * data transfers. The array must be set before any transactions are executed. - * The array is set in the RefineSchedule class. - */ - static void - setRefineItems( - const RefineClasses::Data** refine_items, - int num_refine_items) - { - TBOX_ASSERT(refine_items != (const RefineClasses::Data **)NULL); - TBOX_ASSERT(num_refine_items >= 0); - s_refine_items = refine_items; - s_num_refine_items = num_refine_items; - } - - /*! - * Static member function to unset the array of refine class data items that - * is shared by all object instances of this copy transaction class during - * data transfers. The unset function is used to prevent erroneous execution - * of different schedules. The array is unset in the RefineSchedule class. - */ - static void - unsetRefineItems() - { - s_refine_items = (const RefineClasses::Data **)NULL; - s_num_refine_items = 0; - } - /*! * Construct a transaction with the specified source and destination * levels, patches, and patch data components found in the refine class * item with the given id owned by the calling refine schedule. In general, * this constructor is called by a RefineSchedule object for each data * transaction (not involving time interpolation) that must occur. This - * transaction will be responsible for one of the following: (1) a local data - * copy, (2) packing a message stream with source patch data, or (3) unpacking - * destination patch data from a message stream. + * transaction will be responsible for one of the following: (1) a local + * data copy, (2) packing a message stream with source patch data, or (3) + * unpacking destination patch data from a message stream. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param refine_item_id Integer id of refine data item owned by refine schedule. + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param refine_data Pointer to array of refine data items + * @param item_id Integer id of refine data item owned by refine + * schedule. * - * When assertion checking is active, an assertion will result if any of the pointer - * arguments is null, or if any of the integer arguments are invalid (i.e., < 0); + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_box.getLocalId() >= 0 + * @pre src_box.getLocalId() >= 0 + * @pre refine_data != 0 + * @pre refine_item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_box.getDim()) && + * (dst_level->getDim() == src_box.getDim()) */ RefineCopyTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - const int refine_item_id); + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data ** refine_data, + int item_id); /*! * The virtual destructor for the copy transaction releases all @@ -111,21 +93,22 @@ class RefineCopyTransaction:public tbox::Transaction * Return a boolean indicating whether this transaction can estimate * the size of an incoming message. If this is false, then a different * communication protocol kicks in and the message size is transmitted - * between mapped_boxes. + * between boxes. */ virtual bool canEstimateIncomingMessageSize(); /*! - * Return the integer buffer space (in bytes) needed for the incoming message. - * This routine is only called if the transaction can estimate the + * Return the integer buffer space (in bytes) needed for the incoming + * message. This routine is only called if the transaction can estimate the * size of the incoming message. See canEstimateIncomingMessageSize(). */ virtual size_t computeIncomingMessageSize(); /*! - * Return the integer buffer space (in bytes) needed for the outgoing message. + * Return the integer buffer space (in bytes) needed for the outgoing + * message. */ virtual size_t computeOutgoingMessageSize(); @@ -172,21 +155,19 @@ class RefineCopyTransaction:public tbox::Transaction private: RefineCopyTransaction( const RefineCopyTransaction&); // not implemented - void + RefineCopyTransaction& operator = ( const RefineCopyTransaction&); // not implemented - static const RefineClasses::Data** s_refine_items; - static int s_num_refine_items; - boost::shared_ptr d_dst_patch; int d_dst_patch_rank; boost::shared_ptr d_src_patch; int d_src_patch_rank; boost::shared_ptr d_overlap; - int d_refine_item_id; - int d_incoming_bytes; - int d_outgoing_bytes; + const RefineClasses::Data** d_refine_data; + int d_item_id; + size_t d_incoming_bytes; + size_t d_outgoing_bytes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.C index b3a7813d..d1c965de 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for refining AMR data. * ************************************************************************/ - -#ifndef included_xfer_RefinePatchStrategy_C -#define included_xfer_RefinePatchStrategy_C - #include "SAMRAI/xfer/RefinePatchStrategy.h" #include "SAMRAI/hier/BoxContainer.h" @@ -26,9 +22,7 @@ namespace xfer { ************************************************************************* */ -RefinePatchStrategy::RefinePatchStrategy( - const tbox::Dimension& dim): - d_dim(dim) +RefinePatchStrategy::RefinePatchStrategy() { registerObject(); } @@ -38,29 +32,6 @@ RefinePatchStrategy::~RefinePatchStrategy() unregisterObject(); } -void -RefinePatchStrategy::fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry) -{ - NULL_USE(patch); - NULL_USE(encon_level); - NULL_USE(dst_to_encon); - NULL_USE(fill_time); - NULL_USE(fill_box); - NULL_USE(boundary_box); - NULL_USE(grid_geometry); - TBOX_ERROR( - "The abstract RefinePatchLevelStragey::fillSingularityBoudaryConditions:\n" - << "must be implemented whenever the concrete derived\n" - << "class supports multiblock and singularities."); -} - /* ************************************************************************* * Compute the max refine stencil width from all constructed @@ -77,10 +48,8 @@ RefinePatchStrategy::getMaxRefineOpStencilWidth( RefinePatchStrategy::getCurrentObjects(); for (std::set::const_iterator si = current_objects.begin(); si != current_objects.end(); ++si) { - const RefinePatchStrategy* op = *si; - if (op->getDim() == dim) { - max_width.max(op->getRefineOpStencilWidth()); - } + const RefinePatchStrategy* strategy = *si; + max_width.max(strategy->getRefineOpStencilWidth(dim)); } return max_width; @@ -88,4 +57,3 @@ RefinePatchStrategy::getMaxRefineOpStencilWidth( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.h index 7026fa01..d8e7fdec 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefinePatchStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Strategy interface to user routines for refining AMR data. * ************************************************************************/ @@ -13,10 +13,12 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/xfer/RefineClasses.h" #include @@ -50,8 +52,11 @@ namespace xfer { * process an entire patch at one time. By default, the box list version * loops over all of the boxes in the box list and calls the single box version. * - * @see xfer::RefineAlgorithm - * @see xfer::RefineSchedule + * For operations on a mesh with block-singularities, implementations of this + * class must also inherit and implement SingularityPatchStrategy. + * + * @see RefineAlgorithm + * @see RefineSchedule */ class RefinePatchStrategy @@ -65,9 +70,7 @@ class RefinePatchStrategy * getRefineOpStencilWidth() for every RefinePatchStrategy of the * given Dimension used in an application. * - * @param[in] dim Only objects with this dimension will be used to - * calculate the max. If a RefinePatchStrategy with - * another dimension is registered, it will be ignored. + * @param[in] dim */ static hier::IntVector getMaxRefineOpStencilWidth( @@ -79,8 +82,7 @@ class RefinePatchStrategy * The constructor will register the constructed object with a static * set that manages all RefinePatchStrategy objects in an application. */ - explicit RefinePatchStrategy( - const tbox::Dimension& dim); + RefinePatchStrategy(); /*! * @brief Destructor @@ -108,41 +110,6 @@ class RefinePatchStrategy const double fill_time, const hier::IntVector& ghost_width_to_fill) = 0; - /*! - * @brief Set the ghost data at a multiblock singularity. - * - * This virtual method allows for a user-defined implemenation to fill - * ghost data at ghost regions located at reduced or enhanced connectivity - * multiblock singularities. The method is virtual so that it need not - * be overridden in single-block applications. The encon_level and - * dst_to_encon arguments may be ignored if the patch touches - * no enhanced connectivity singularities. - * - * The patches in encon level are in the coordinate system of the blocks - * where they originated, not in that of the destination patch, so the - * filling operation must take into account the transformation between - * blocks. - * - * @param patch The patch containing the data to be filled - * @param encon_level Level representing enhanced connectivity ghost - * regions - * @param dst_to_encon Connector from destination level to encon_level - * @param fill_time Simulation time at which data is filled - * @param fill_box Box covering maximum amount of ghost cells to be filled - * @param boundary_box BoundaryBox describing location of singularity in - * relation to patch - * @param[in] grid_geometry - */ - virtual void - fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry); - /*! * @brief Return maximum stencil width needed for user-defined * data refinement operations performed by this object. @@ -153,9 +120,12 @@ class RefinePatchStrategy * For any user-defined interpolation operations implemented in the * preprocess or postprocess methods, return the maximum stencil needed * on a coarse patch to refine data to a fine patch. + * If your implementation doesn't work with the given dimension, return + * zero. */ virtual hier::IntVector - getRefineOpStencilWidth() const = 0; + getRefineOpStencilWidth( + const tbox::Dimension& dim) const = 0; /*! * @brief Perform user-defined patch data refinement operations. @@ -216,6 +186,9 @@ class RefinePatchStrategy * @param[in] fine_boxes List of box regions on fine patch into which data * is refined. * @param[in] ratio Refinement ratio between coarse and fine patches. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) */ virtual void preprocessRefineBoxes( @@ -224,8 +197,8 @@ class RefinePatchStrategy const hier::BoxContainer& fine_boxes, const hier::IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_ARGS3(fine, coarse, ratio); - for (hier::BoxContainer::const_iterator b(fine_boxes); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); + for (hier::BoxContainer::const_iterator b = fine_boxes.begin(); b != fine_boxes.end(); ++b) { preprocessRefine(fine, coarse, *b, ratio); } @@ -245,6 +218,9 @@ class RefinePatchStrategy * @param[in] fine_boxes List of box regions on fine patch into which data * is refined. * @param[in] ratio Refinement ratio between coarse and fine patches. + * + * @pre (fine.getDim() == coarse.getDim()) && + * (fine.getDim() == ratio.getDim()) */ virtual void postprocessRefineBoxes( @@ -253,20 +229,67 @@ class RefinePatchStrategy const hier::BoxContainer& fine_boxes, const hier::IntVector& ratio) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS3(d_dim, fine, coarse, ratio); - for (hier::BoxContainer::const_iterator b(fine_boxes); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); + for (hier::BoxContainer::const_iterator b = fine_boxes.begin(); b != fine_boxes.end(); ++b) { postprocessRefine(fine, coarse, *b, ratio); } } /*! - * @brief Return the dimension of this object. + * @brief Perform user-defined patch data pre-refinement operations + * on a PatchLevel. + * + * This member function is called before standard refine operations + * (expressed using concrete subclasses of the RefineOperator base class). + * + * @param[out] fine_level Fine patch level containing destination data. + * @param[in] coarse_level Coarse patch level containing source data. + * @param[in] coarse_to_fine Connector coarse to fine + * @param[in] coarse_to_unfilled Connector coarse to level representing + * boxes that need to be filled. + * @param[in] overlaps + * @param[in] refine_items */ - const tbox::Dimension& - getDim() const - { - return d_dim; + virtual void + preprocessRefineLevel( + hier::PatchLevel& fine_level, + const hier::PatchLevel& coarse_level, + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled, + const std::vector > >& overlaps, + const RefineClasses::Data** refine_items) { + NULL_USE(fine_level); + NULL_USE(coarse_level); + NULL_USE(coarse_to_fine); + NULL_USE(coarse_to_unfilled); + NULL_USE(overlaps); + NULL_USE(refine_items); + } + + /*! + * @brief Perform user-defined patch data post-refinement + * operations on a PatchLevel. + * + * This member function is called after standard refine operations + * (expressed using concrete subclasses of the RefineOperator base class). + * + * @param[out] fine_level Fine patch level containing destination data. + * @param[in] coarse_level Coarse patch level containing source data. + * @param[in] coarse_to_fine Connector coarse to fine + * @param[in] coarse_to_unfilled Connector coarse to level representing + * boxes that need to be filled. + */ + virtual void + postprocessRefineLevel( + hier::PatchLevel& fine_level, + const hier::PatchLevel& coarse_level, + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled) { + NULL_USE(fine_level); + NULL_USE(coarse_level); + NULL_USE(coarse_to_fine); + NULL_USE(coarse_to_unfilled); } private: @@ -281,11 +304,6 @@ class RefinePatchStrategy return current_objects; } - /*! - * @brief Dimension of the object. - */ - const tbox::Dimension d_dim; - /*! * @brief Register the object with a set of all RefinePatchStrategy * objects used in an application. @@ -295,7 +313,6 @@ class RefinePatchStrategy { std::set& current_objects = RefinePatchStrategy::getCurrentObjects(); - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); current_objects.insert(this); } @@ -307,7 +324,6 @@ class RefinePatchStrategy { std::set& current_objects = RefinePatchStrategy::getCurrentObjects(); - TBOX_DIM_ASSERT_CHECK_DIM(d_dim); current_objects.erase(this); } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.C index db4d0cbd..e4bc401b 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.C @@ -3,17 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Refine schedule for data transfer between AMR levels * ************************************************************************/ - -#ifndef included_xfer_RefineSchedule_C -#define included_xfer_RefineSchedule_C - #include "SAMRAI/xfer/RefineSchedule.h" #include "SAMRAI/xfer/BoxGeometryVariableFillPattern.h" #include "SAMRAI/xfer/PatchLevelFullFillPattern.h" +#include "SAMRAI/xfer/PatchLevelInteriorFillPattern.h" #include "SAMRAI/xfer/RefineCopyTransaction.h" #include "SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h" #include "SAMRAI/xfer/RefineTimeTransaction.h" @@ -31,11 +28,12 @@ #include "SAMRAI/tbox/AsyncCommPeer.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include "SAMRAI/tbox/StartupShutdownManager.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/make_shared.hpp" #if !defined(__BGL_FAMILY__) && defined(__xlC__) /* @@ -48,32 +46,26 @@ namespace SAMRAI { namespace xfer { -static const std::string logbord; -static const std::string errbord("E-> "); - bool RefineSchedule::s_extra_debug = false; bool RefineSchedule::s_barrier_and_time = false; +bool RefineSchedule::s_read_static_input = false; +boost::shared_ptr RefineSchedule::t_refine_schedule; boost::shared_ptr RefineSchedule::t_fill_data; -boost::shared_ptr RefineSchedule::t_recursive_fill; +boost::shared_ptr RefineSchedule::t_fill_data_nonrecursive; +boost::shared_ptr RefineSchedule::t_fill_data_recursive; +boost::shared_ptr RefineSchedule::t_fill_physical_boundaries; +boost::shared_ptr RefineSchedule::t_fill_singularity_boundaries; boost::shared_ptr RefineSchedule::t_refine_scratch_data; boost::shared_ptr RefineSchedule::t_finish_sched_const; boost::shared_ptr RefineSchedule::t_finish_sched_const_recurse; boost::shared_ptr RefineSchedule::t_gen_comm_sched; -boost::shared_ptr RefineSchedule::t_bridge_connector; -boost::shared_ptr RefineSchedule::t_modify_connector; -boost::shared_ptr RefineSchedule::t_make_seq_map; boost::shared_ptr RefineSchedule::t_shear; -boost::shared_ptr RefineSchedule::t_misc1; -boost::shared_ptr RefineSchedule::t_barrier_and_time; -boost::shared_ptr RefineSchedule::t_get_global_mapped_box_count; +boost::shared_ptr RefineSchedule::t_get_global_box_count; boost::shared_ptr RefineSchedule::t_coarse_shear; -boost::shared_ptr RefineSchedule::t_setup_coarse_interp_mapped_box_level; -boost::shared_ptr RefineSchedule::t_misc2; +boost::shared_ptr RefineSchedule::t_setup_coarse_interp_box_level; boost::shared_ptr RefineSchedule::t_bridge_coarse_interp_hiercoarse; boost::shared_ptr RefineSchedule::t_bridge_dst_hiercoarse; -boost::shared_ptr RefineSchedule::t_make_coarse_interp_level; -boost::shared_ptr RefineSchedule::t_make_coarse_interp_to_unfilled; boost::shared_ptr RefineSchedule::t_invert_edges; boost::shared_ptr RefineSchedule::t_construct_send_trans; boost::shared_ptr RefineSchedule::t_construct_recv_trans; @@ -109,10 +101,11 @@ RefineSchedule::RefineSchedule( RefinePatchStrategy* patch_strategy, bool use_time_refinement): d_number_refine_items(0), - d_refine_items((const RefineClasses::Data **)NULL), + d_refine_items(0), d_dst_level(dst_level), d_src_level(src_level), d_refine_patch_strategy(patch_strategy), + d_singularity_patch_strategy(dynamic_cast(patch_strategy)), d_transaction_factory(transaction_factory), d_max_stencil_width(dst_level->getDim()), d_max_scratch_gcw(dst_level->getDim()), @@ -123,59 +116,73 @@ RefineSchedule::RefineSchedule( d_coarse_priority_level_schedule(boost::make_shared()), d_fine_priority_level_schedule(boost::make_shared()), d_encon_level(boost::make_shared(dst_level->getDim())), + d_dst_to_src(0), d_max_fill_boxes(0), d_dst_level_fill_pattern(dst_level_fill_pattern), - d_constructing_internal_schedule(false) + d_top_refine_schedule(this) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); TBOX_ASSERT(refine_classes); + TBOX_ASSERT(transaction_factory); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *src_level); - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *patch_strategy); - } + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); #endif - const tbox::Dimension& dim(dst_level->getDim()); + getFromInput(); + + if (s_barrier_and_time) { + t_refine_schedule->barrierAndStart(); + } + + if (d_dst_level->getGridGeometry()->getNumberOfBlockSingularities() > 0 && + !d_singularity_patch_strategy && d_refine_patch_strategy) { + TBOX_ERROR("RefineSchedule: Schedules for meshes with singularities\n" + << "requires a SingularityPatchStrategy implementation along\n" + << "with the RefinePatchStrategy. To do this,\n" + << "inherit SinglarityPatchStrategy with the user class\n" + << "that inherited RefinePatchStrategy and implement\n" + << "the SingularityPatchStrategy pure virtual methods."); + } setRefineItems(refine_classes); initialCheckRefineClassItems(); - d_domain_is_one_box.resizeArray( - dst_level->getGridGeometry()->getNumberBlocks(), false); + d_domain_is_one_box.resize( + d_dst_level->getGridGeometry()->getNumberBlocks(), false); - d_coarse_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule"); - d_fine_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule"); + d_coarse_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule_fill"); + d_fine_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule_fill"); /* * Initialize destination level, ghost cell widths, * and domain information data members. */ + initializeDomainAndGhostInformation(); - bool recursive_schedule = false; - initializeDomainAndGhostInformation(recursive_schedule); - - hier::IntVector min_connector_width = d_max_scratch_gcw; - min_connector_width.max(d_boundary_fill_ghost_width); - - const Connector& dst_to_src = - dst_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *src_level->getBoxLevel(), - min_connector_width); - - const Connector& src_to_dst = - src_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *dst_level->getBoxLevel(), - Connector::convertHeadWidthToBase(src_level->getBoxLevel()-> - getRefinementRatio(), - dst_level->getBoxLevel()->getRefinementRatio(), - min_connector_width)); + hier::IntVector min_connector_width(getMinConnectorWidth()); + if (!d_dst_level_fill_pattern->fillingCoarseFineGhosts()) { + min_connector_width = hier::IntVector::getZero(dst_level->getDim()); + } - TBOX_ASSERT(dst_to_src.getBase() == *dst_level->getBoxLevel()); - TBOX_ASSERT(src_to_dst.getHead() == *dst_level->getBoxLevel()); - TBOX_ASSERT(dst_to_src.getConnectorWidth() >= d_max_scratch_gcw); - TBOX_ASSERT(dst_to_src.getConnectorWidth() >= d_boundary_fill_ghost_width); + d_dst_to_src = &d_dst_level->findConnectorWithTranspose(*d_src_level, + min_connector_width, + hier::Connector::convertHeadWidthToBase( + d_src_level->getBoxLevel()->getRefinementRatio(), + d_dst_level->getBoxLevel()->getRefinementRatio(), + min_connector_width), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + hier::Connector& src_to_dst = d_dst_to_src->getTranspose(); + + TBOX_ASSERT(d_dst_to_src->getBase() == *d_dst_level->getBoxLevel()); + TBOX_ASSERT(src_to_dst.getHead() == *d_dst_level->getBoxLevel()); +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_dst_level_fill_pattern->fillingCoarseFineGhosts()) { + TBOX_ASSERT(d_dst_to_src->getConnectorWidth() >= d_max_scratch_gcw); + TBOX_ASSERT(d_dst_to_src->getConnectorWidth() >= d_boundary_fill_ghost_width); + } +#endif if (s_extra_debug) { /* @@ -183,51 +190,44 @@ RefineSchedule::RefineSchedule( * PersistentOverlapConnectors should already guarantee * completeness. */ - hier::OverlapConnectorAlgorithm oca; - oca.assertOverlapCorrectness(dst_to_src); - oca.assertOverlapCorrectness(src_to_dst); + d_dst_to_src->assertOverlapCorrectness(); + src_to_dst.assertOverlapCorrectness(); } /* - * Create fill_mapped_box_level, representing all parts of the + * Create fill_box_level, representing all parts of the * destination level, including ghost regions if desired, that this * schedule will attempt to fill. */ - BoxLevel fill_mapped_box_level(dim); - Connector dst_to_fill; - BoxNeighborhoodCollection dst_to_fill_on_src_proc; + boost::shared_ptr fill_box_level; + boost::shared_ptr dst_to_fill; + hier::BoxNeighborhoodCollection dst_to_fill_on_src_proc; setDefaultFillBoxLevel( - fill_mapped_box_level, + fill_box_level, dst_to_fill, - dst_to_fill_on_src_proc, - *dst_level->getBoxLevel(), - &dst_to_src, - &src_to_dst, - d_boundary_fill_ghost_width); + dst_to_fill_on_src_proc); /* * Generation the communication transactions that will move data from * the source to the destination. generateCommunicationSchedule will * initialize the "unused" objects with information about the parts of - * fill_mapped_box_level that cannot be filled from the source level. + * fill_box_level that cannot be filled from the source level. * They are unused because this RefineSchedule constructor creates * schedules that do not do anything to fill the parts of the * destination that can't be filled directly from the source. */ - boost::shared_ptr unused_unfilled_mapped_box_level; - boost::shared_ptr unused_dst_to_unfilled; - boost::shared_ptr unused_unfilled_encon_box_level; - boost::shared_ptr unused_encon_to_unfilled_encon; + boost::shared_ptr unused_unfilled_box_level; + boost::shared_ptr unused_dst_to_unfilled; + boost::shared_ptr unused_unfilled_encon_box_level; + boost::shared_ptr unused_encon_to_unfilled_encon; bool create_transactions = true; generateCommunicationSchedule( - unused_unfilled_mapped_box_level, + unused_unfilled_box_level, unused_dst_to_unfilled, unused_unfilled_encon_box_level, unused_encon_to_unfilled_encon, - dst_to_src, - src_to_dst, - dst_to_fill, + *dst_to_fill, dst_to_fill_on_src_proc, use_time_refinement, create_transactions); @@ -236,18 +236,21 @@ RefineSchedule::RefineSchedule( computeRefineOverlaps(d_refine_overlaps, d_dst_level, d_coarse_interp_level, - d_coarse_interp_to_dst, - d_coarse_interp_to_unfilled); + d_dst_to_coarse_interp->getTranspose(), + *d_coarse_interp_to_unfilled); } if (d_coarse_interp_encon_level) { computeRefineOverlaps(d_encon_refine_overlaps, d_encon_level, d_coarse_interp_encon_level, - d_coarse_interp_encon_to_encon, - d_coarse_interp_encon_to_unfilled_encon); + d_encon_to_coarse_interp_encon->getTranspose(), + *d_coarse_interp_encon_to_unfilled_encon); } + if (s_barrier_and_time) { + t_refine_schedule->barrierAndStop(); + } } /* @@ -283,10 +286,11 @@ RefineSchedule::RefineSchedule( RefinePatchStrategy* patch_strategy, bool use_time_refinement): d_number_refine_items(0), - d_refine_items((const RefineClasses::Data **)NULL), + d_refine_items(0), d_dst_level(dst_level), d_src_level(src_level), d_refine_patch_strategy(patch_strategy), + d_singularity_patch_strategy(dynamic_cast(patch_strategy)), d_transaction_factory(transaction_factory), d_max_stencil_width(dst_level->getDim()), d_max_scratch_gcw(dst_level->getDim()), @@ -295,110 +299,172 @@ RefineSchedule::RefineSchedule( d_num_periodic_directions(0), d_periodic_shift(dst_level->getDim()), d_encon_level(boost::make_shared(dst_level->getDim())), + d_dst_to_src(0), d_max_fill_boxes(0), d_dst_level_fill_pattern(dst_level_fill_pattern), - d_constructing_internal_schedule(false) + d_top_refine_schedule(this) { TBOX_ASSERT(dst_level); TBOX_ASSERT((next_coarser_ln == -1) || hierarchy); TBOX_ASSERT(refine_classes); + TBOX_ASSERT(transaction_factory); #ifdef DEBUG_CHECK_DIM_ASSERTIONS if (src_level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *src_level); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); } if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *hierarchy); } #endif + getFromInput(); + + if (s_barrier_and_time) { + t_refine_schedule->barrierAndStart(); + } + const tbox::Dimension& dim(dst_level->getDim()); + if (dst_level->getGridGeometry()->getNumberOfBlockSingularities() > 0 && + !d_singularity_patch_strategy && d_refine_patch_strategy) { + TBOX_ERROR("RefineSchedule: Schedules for meshes with singularities\n" + << "requires a SingularityPatchStrategy implementation along\n" + << "with the RefinePatchStrategy. To do this,\n" + << "inherit SinglarityPatchStrategy with the user class\n" + << "that inherited RefinePatchStrategy and implement\n" + << "the SingularityPatchStrategy pure virtual methods."); + } + setRefineItems(refine_classes); initialCheckRefineClassItems(); - d_domain_is_one_box.resizeArray( + d_domain_is_one_box.resize( dst_level->getGridGeometry()->getNumberBlocks(), false); /* * Initialize destination level, ghost cell widths, * and domain information data members. */ + initializeDomainAndGhostInformation(); + + hier::IntVector min_connector_width(getMinConnectorWidth()); + + if (d_src_level && + d_src_level->getRatioToLevelZero() != d_dst_level->getRatioToLevelZero()) { + if (d_src_level->getRatioToLevelZero() >= d_dst_level->getRatioToLevelZero()) { + const hier::IntVector src_dst_ratio = + d_src_level->getRatioToLevelZero() / d_dst_level->getRatioToLevelZero(); + if (d_dst_level->getRatioToLevelZero() * src_dst_ratio != + d_src_level->getRatioToLevelZero()) { + TBOX_ERROR("RefineSchedule::RefineSchedule error: source and destination\n" + << "levels must be a simple refinement of one another.\n" + << "src resolution: " << d_src_level->getRatioToLevelZero() << "\n" + << "dst resolution: " << d_dst_level->getRatioToLevelZero()); + } + min_connector_width *= src_dst_ratio; + } else if (d_src_level->getRatioToLevelZero() <= d_dst_level->getRatioToLevelZero()) { + TBOX_ERROR("RefineSchedule:RefineSchedule error: We are not currently\n" + << "supporting RefineSchedules with the source level finer\n" + << "than the destination level."); + } else { + TBOX_ERROR("RefineSchedule::RefineSchedule error: src level may not be\n" + << "coarser than dst level in one direction and finer in another.\n" + << "src resolution: " << d_src_level->getRatioToLevelZero() << "\n" + << "dst resolution: " << d_dst_level->getRatioToLevelZero()); + } + } - bool recursive_schedule = false; - initializeDomainAndGhostInformation(recursive_schedule); + if (next_coarser_ln >= 0) { + RefineScheduleConnectorWidthRequestor rscwr; - const Connector dummy_connector; + if (hierarchy->getNumberOfLevels() > next_coarser_ln + 1) { + if (d_dst_level->getRatioToLevelZero() != + hierarchy->getPatchLevel(next_coarser_ln + 1)->getRatioToLevelZero()) { + hier::IntVector expansion_ratio = + hierarchy->getPatchLevel(next_coarser_ln+1)->getRatioToLevelZero() / d_dst_level->getRatioToLevelZero(); +#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT( expansion_ratio * d_dst_level->getRatioToLevelZero() == hierarchy->getPatchLevel(next_coarser_ln+1)->getRatioToLevelZero() ); + // All values in expansion_ratio must be identical. + TBOX_ASSERT( hier::IntVector(dim,expansion_ratio(0,0),expansion_ratio.getNumBlocks()) == expansion_ratio ); +#endif + rscwr.setGhostCellWidthFactor(expansion_ratio(0,0)); + } + } + rscwr.computeRequiredFineConnectorWidthsForRecursiveRefinement( + d_fine_connector_widths, + min_connector_width, + d_max_stencil_width, + *hierarchy, + next_coarser_ln + 1); + } - const Connector* dst_to_src = &dummy_connector; - const Connector* src_to_dst = &dummy_connector; + boost::shared_ptr dummy_connector( + boost::make_shared(dim)); - if (src_level) { - hier::IntVector min_connector_width = d_max_scratch_gcw; - min_connector_width.max(d_boundary_fill_ghost_width); + if (d_src_level) { - dst_to_src = - &dst_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *src_level->getBoxLevel(), + hier::IntVector transpose_min_connector_width = + hier::Connector::convertHeadWidthToBase( + d_src_level->getBoxLevel()->getRefinementRatio(), + dst_level->getBoxLevel()->getRefinementRatio(), min_connector_width); - - src_to_dst = - &src_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( - *dst_level->getBoxLevel(), - Connector::convertHeadWidthToBase(src_level->getBoxLevel()-> - getRefinementRatio(), - dst_level->getBoxLevel()->getRefinementRatio(), - min_connector_width)); - - TBOX_ASSERT(dst_to_src->getBase() == *dst_level->getBoxLevel()); - TBOX_ASSERT(src_to_dst->getHead() == *dst_level->getBoxLevel()); - TBOX_ASSERT(dst_to_src->getConnectorWidth() >= d_max_scratch_gcw); - TBOX_ASSERT(dst_to_src->getConnectorWidth() >= d_boundary_fill_ghost_width); + d_dst_to_src = &dst_level->findConnectorWithTranspose(*d_src_level, + min_connector_width, + transpose_min_connector_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + TBOX_ASSERT(d_dst_to_src->getBase() == *dst_level->getBoxLevel()); + TBOX_ASSERT(d_dst_to_src->getTranspose().getHead() == *dst_level->getBoxLevel()); + TBOX_ASSERT(d_dst_to_src->getConnectorWidth() >= d_max_scratch_gcw); + TBOX_ASSERT(d_dst_to_src->getConnectorWidth() >= d_boundary_fill_ghost_width); + } else { + dummy_connector->setTranspose(dummy_connector.get(), false); + d_dst_to_src = dummy_connector.get(); } /* - * Create fill_mapped_box_level, representing all parts of the + * Create fill_box_level, representing all parts of the * destination level, including ghost regions if desired, that this * schedule will fill. */ - BoxLevel fill_mapped_box_level(dim); - Connector dst_to_fill; - BoxNeighborhoodCollection dst_to_fill_on_src_proc; + boost::shared_ptr fill_box_level; + boost::shared_ptr dst_to_fill; + hier::BoxNeighborhoodCollection dst_to_fill_on_src_proc; setDefaultFillBoxLevel( - fill_mapped_box_level, + fill_box_level, dst_to_fill, - dst_to_fill_on_src_proc, - *dst_level->getBoxLevel(), - dst_to_src, - src_to_dst, - d_boundary_fill_ghost_width); + dst_to_fill_on_src_proc); const bool skip_first_generate_schedule = !d_dst_level_fill_pattern->doesSourceLevelCommunicateToDestination(); const hier::IntVector dummy_intvector(dim, -1); - const bool dst_is_coarse_interp_level = false; /* * finishScheduleConstruction sets up all transactions to communicate * data from source to destination, and sets up recursive schedules to * fill whatever cannot be filled by the source. */ - finishScheduleConstruction( - next_coarser_ln, - hierarchy, - *dst_to_src, - *src_to_dst, - dst_is_coarse_interp_level, - dummy_intvector, - dst_to_fill, - dst_to_fill_on_src_proc, - use_time_refinement, - skip_first_generate_schedule); + int errf = finishScheduleConstruction( + next_coarser_ln, + hierarchy, + dummy_intvector, + *dst_to_fill, + dst_to_fill_on_src_proc, + use_time_refinement, + skip_first_generate_schedule); + if (errf) { + tbox::perr + << "Internal error in RefineSchedule constructor..." + << "\n dst_to_fill:\n" << dst_to_fill->format("\tDF->", 2) + << "\n dst:\n" << d_dst_level->getBoxLevel()->format("\tD->", 2) + << std::endl; + TBOX_ERROR("Top RefineSchedule constructor aborting due to above error."); + return; + } /* * Compute the BoxOverlap objects that will be used to refine the @@ -408,18 +474,21 @@ RefineSchedule::RefineSchedule( computeRefineOverlaps(d_refine_overlaps, d_dst_level, d_coarse_interp_level, - d_coarse_interp_to_dst, - d_coarse_interp_to_unfilled); + d_dst_to_coarse_interp->getTranspose(), + *d_coarse_interp_to_unfilled); } if (d_coarse_interp_encon_schedule) { computeRefineOverlaps(d_encon_refine_overlaps, d_encon_level, d_coarse_interp_encon_level, - d_coarse_interp_encon_to_encon, - d_coarse_interp_encon_to_unfilled_encon); + d_encon_to_coarse_interp_encon->getTranspose(), + *d_coarse_interp_encon_to_unfilled_encon); } + if (s_barrier_and_time) { + t_refine_schedule->barrierAndStop(); + } } /* @@ -433,21 +502,23 @@ RefineSchedule::RefineSchedule( */ RefineSchedule::RefineSchedule( + int& errf, const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, int next_coarser_ln, const boost::shared_ptr& hierarchy, const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, const hier::IntVector& src_growth_to_nest_dst, const boost::shared_ptr& refine_classes, const boost::shared_ptr& transaction_factory, - RefinePatchStrategy* patch_strategy): + RefinePatchStrategy* patch_strategy, + const RefineSchedule* top_refine_schedule): d_number_refine_items(0), - d_refine_items((const RefineClasses::Data **)NULL), + d_refine_items(0), d_dst_level(dst_level), d_src_level(src_level), d_refine_patch_strategy(patch_strategy), + d_singularity_patch_strategy(dynamic_cast(patch_strategy)), d_transaction_factory(transaction_factory), d_max_stencil_width(dst_level->getDim()), d_max_scratch_gcw(dst_level->getDim()), @@ -457,27 +528,26 @@ RefineSchedule::RefineSchedule( d_num_periodic_directions(0), d_periodic_shift(dst_level->getDim()), d_encon_level(boost::make_shared(dst_level->getDim())), + d_dst_to_src(&dst_to_src), d_max_fill_boxes(0), d_dst_level_fill_pattern(boost::make_shared()), - d_constructing_internal_schedule(true) + d_top_refine_schedule(top_refine_schedule) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); TBOX_ASSERT((next_coarser_ln == -1) || hierarchy); + TBOX_ASSERT(dst_to_src.hasTranspose()); TBOX_ASSERT(refine_classes); #ifdef DEBUG_CHECK_DIM_ASSERTIONS - if (src_level) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *src_level); - } + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *src_level); if (hierarchy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *hierarchy); - } - if (patch_strategy) { - TBOX_DIM_ASSERT_CHECK_ARGS2(*dst_level, *patch_strategy); + TBOX_ASSERT_OBJDIM_EQUALITY2(*dst_level, *hierarchy); } #endif - const tbox::Dimension& dim(dst_level->getDim()); + // Don't time this constructor because it's recursive. + + getFromInput(); /* * Initial values; some will change in setup operations. @@ -492,62 +562,60 @@ RefineSchedule::RefineSchedule( * Initialize destination level, ghost cell widths, * and domain information data members. */ + initializeDomainAndGhostInformation(); - bool recursive_schedule = true; - initializeDomainAndGhostInformation(recursive_schedule); + hier::Connector& src_to_dst = d_dst_to_src->getTranspose(); - TBOX_ASSERT(dst_to_src.getBase() == *dst_level->getBoxLevel()); - TBOX_ASSERT(src_to_dst.getHead() == *dst_level->getBoxLevel()); + TBOX_ASSERT(d_dst_to_src->getBase() == *d_dst_level->getBoxLevel()); + TBOX_ASSERT(src_to_dst.getHead() == *d_dst_level->getBoxLevel()); - if ( s_extra_debug ) { - hier::OverlapConnectorAlgorithm oca; - oca.assertOverlapCorrectness(src_to_dst); - oca.assertOverlapCorrectness(dst_to_src); + if (s_extra_debug) { + src_to_dst.assertOverlapCorrectness(false, true, true); + d_dst_to_src->assertOverlapCorrectness(false, true, true); } - /* - * Create fill_mapped_box_level, representing all parts of the + * Create fill_box_level, representing all parts of the * destination level, including ghost regions if desired, that this * schedule will fill. Here, the destination is always a coarse interpolation * level constructed by coarsening another RefineSchedule's unfilled * boxes. As the destination will be used as a coarse level in a - * refinement operation, the fill_mapped_box_level will be the boxes + * refinement operation, the fill_box_level will be the boxes * of the destination level grown by the maximum interplation stencil * width. */ - BoxLevel fill_mapped_box_level(dim); - Connector dst_to_fill; - BoxNeighborhoodCollection dst_to_fill_on_src_proc; + boost::shared_ptr fill_box_level; + boost::shared_ptr dst_to_fill; + hier::BoxNeighborhoodCollection dst_to_fill_on_src_proc; setDefaultFillBoxLevel( - fill_mapped_box_level, + fill_box_level, dst_to_fill, - dst_to_fill_on_src_proc, - *dst_level->getBoxLevel(), - &dst_to_src, - &src_to_dst, - d_max_stencil_width); + dst_to_fill_on_src_proc); bool use_time_refinement = true; - const bool dst_is_coarse_interp_level = true; /* - * finishSchedule construction sets up all transactions to communicate + * finishScheduleConstruction sets up all transactions to communicate * data from source to destination, and sets up recursive schedules to * fill whatever cannot be filled by the source. */ - finishScheduleConstruction( - next_coarser_ln, - hierarchy, - dst_to_src, - src_to_dst, - dst_is_coarse_interp_level, - src_growth_to_nest_dst, - dst_to_fill, - dst_to_fill_on_src_proc, - use_time_refinement); + errf = finishScheduleConstruction( + next_coarser_ln, + hierarchy, + src_growth_to_nest_dst, + *dst_to_fill, + dst_to_fill_on_src_proc, + use_time_refinement); + if (errf) { + tbox::perr + << "Internal error in private RefineSchedule constructor..." + << "\n next_coarser_ln: " << next_coarser_ln + << "\n dst_to_fill:\n" << dst_to_fill->format("\tDF->", 2) + << std::endl; + return; + } /* * Compute the BoxOverlap objects that will be used to refine the @@ -558,16 +626,16 @@ RefineSchedule::RefineSchedule( computeRefineOverlaps(d_refine_overlaps, d_dst_level, d_coarse_interp_level, - d_coarse_interp_to_dst, - d_coarse_interp_to_unfilled); + d_dst_to_coarse_interp->getTranspose(), + *d_coarse_interp_to_unfilled); } if (d_coarse_interp_encon_schedule) { computeRefineOverlaps(d_encon_refine_overlaps, d_encon_level, d_coarse_interp_encon_level, - d_coarse_interp_encon_to_encon, - d_coarse_interp_encon_to_unfilled_encon); + d_encon_to_coarse_interp_encon->getTranspose(), + *d_coarse_interp_encon_to_unfilled_encon); } } @@ -584,6 +652,31 @@ RefineSchedule::RefineSchedule( RefineSchedule::~RefineSchedule() { clearRefineItems(); + delete[] d_refine_items; +} + +/* + ************************************************************************* + * + * Read static member data from input database once. + * + ************************************************************************ + */ +void +RefineSchedule::getFromInput() +{ + if (!s_read_static_input) { + s_read_static_input = true; + boost::shared_ptr idb( + tbox::InputManager::getInputDatabase()); + if (idb && idb->isDatabase("RefineSchedule")) { + boost::shared_ptr rsdb( + idb->getDatabase("RefineSchedule")); + s_extra_debug = rsdb->getBoolWithDefault("DEV_extra_debug", false); + s_barrier_and_time = + rsdb->getBoolWithDefault("DEV_barrier_and_time", false); + } + } } /* @@ -627,20 +720,21 @@ RefineSchedule::reset( ************************************************************************ */ -void +int RefineSchedule::finishScheduleConstruction( int next_coarser_ln, const boost::shared_ptr& hierarchy, - const Connector& dst_to_src, - const Connector& src_to_dst, - const bool dst_is_coarse_interp_level, const hier::IntVector& src_growth_to_nest_dst, - const Connector& dst_to_fill, - const BoxNeighborhoodCollection& dst_to_fill_on_src_proc, + const hier::Connector& dst_to_fill, + const hier::BoxNeighborhoodCollection& dst_to_fill_on_src_proc, bool use_time_interpolation, bool skip_generate_schedule) { - t_finish_sched_const->start(); + if (s_barrier_and_time) { + t_finish_sched_const->barrierAndStart(); + } + TBOX_ASSERT(d_dst_to_src); + TBOX_ASSERT(d_dst_to_src->hasTranspose()); TBOX_ASSERT((next_coarser_ln == -1) || hierarchy); // Get data that will be used below. @@ -649,31 +743,33 @@ RefineSchedule::finishScheduleConstruction( hier::BoxLevelConnectorUtils edge_utils; hier::OverlapConnectorAlgorithm oca; + oca.setTimerPrefix("xfer::RefineSchedule_build"); - const BoxLevel& dst_mapped_box_level = dst_to_fill.getBase(); if (d_src_level) { // Should never have a source without connection from destination. - TBOX_ASSERT(dst_to_src.isFinalized()); + TBOX_ASSERT(d_dst_to_src->isFinalized()); } - d_coarse_priority_level_schedule.reset(new tbox::Schedule()); d_fine_priority_level_schedule.reset(new tbox::Schedule()); + d_coarse_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule_fill"); + d_fine_priority_level_schedule->setTimerPrefix("xfer::RefineSchedule_fill"); + /* * Generate the schedule for filling the boxes in dst_to_fill. * Any portions of the fill boxes that cannot be filled from - * the source is placed in d_unfilled_mapped_box_level. + * the source is placed in d_unfilled_box_level. * * If the source is not given or skip_generate_schedule==true, * the schedule generation degenates to turning all the fill boxes * into unfilled boxes. */ - boost::shared_ptr dst_to_unfilled; + boost::shared_ptr dst_to_unfilled; const boost::shared_ptr& grid_geometry( d_dst_level->getGridGeometry()); - boost::shared_ptr encon_to_unfilled_encon; + boost::shared_ptr encon_to_unfilled_encon; bool create_transactions = true; if (!d_src_level || skip_generate_schedule) { @@ -681,53 +777,51 @@ RefineSchedule::finishScheduleConstruction( } generateCommunicationSchedule( - d_unfilled_mapped_box_level, + d_unfilled_box_level, dst_to_unfilled, d_unfilled_encon_box_level, encon_to_unfilled_encon, - dst_to_src, - src_to_dst, dst_to_fill, dst_to_fill_on_src_proc, use_time_interpolation, create_transactions); /* - * d_unfilled_mapped_box_level may include ghost cells that lie + * d_unfilled_box_level may include ghost cells that lie * outside the physical domain. These parts must be removed if * they are not at periodic boundaries. They will be filled * through a user call-back method. */ shearUnfilledBoxesOutsideNonperiodicBoundaries( - *d_unfilled_mapped_box_level, + *d_unfilled_box_level, *dst_to_unfilled, hierarchy); - t_get_global_mapped_box_count->barrierAndStart(); + t_get_global_box_count->barrierAndStart(); const bool need_to_fill = - (d_unfilled_mapped_box_level->getGlobalNumberOfBoxes() > 0); + (d_unfilled_box_level->getGlobalNumberOfBoxes() > 0); const bool need_to_fill_encon = grid_geometry->hasEnhancedConnectivity() && (d_unfilled_encon_box_level->getGlobalNumberOfBoxes() > 0); - t_get_global_mapped_box_count->stop(); + t_get_global_box_count->stop(); /* * If there remain boxes to be filled from coarser levels, then set * up data for recursive schedule generation: * * 1. Generate a coarse interpolation BoxLevel - * (coarse_interp_mapped_box_level) by coarsening the unfilled boxes. + * (coarse_interp_box_level) by coarsening the unfilled boxes. * - * 2. Connect coarse_interp_mapped_box_level to the next coarser level on + * 2. Connect coarse_interp_box_level to the next coarser level on * the hierarchy. * - * 3: Construct the coarse interpolation PatchLevel (d_coarse_interp_level) and - * construct d_coarse_interp_schedule to fill d_coarse_interp_level. The coarser - * level on the hierarchy will be the source for filling + * 3: Construct the coarse interpolation PatchLevel (d_coarse_interp_level) + * and construct d_coarse_interp_schedule to fill d_coarse_interp_level. + * The coarser level on the hierarchy will be the source for filling * d_coarse_interp_level, which is why we need step 2.. * * The idea is that once d_coarse_interp_level is filled, we can refine its @@ -738,40 +832,46 @@ RefineSchedule::finishScheduleConstruction( t_finish_sched_const_recurse->start(); + makeNodeCenteredUnfilledBoxLevel(*d_unfilled_box_level, + *dst_to_unfilled); + /* * If there are no coarser levels in the hierarchy or the * hierarchy is null, then throw an error. Something is messed * up someplace and code execution cannot proceed. */ if (next_coarser_ln < 0) { - TBOX_ERROR( - "Internal error in RefineSchedule::finishScheduleConstruction..." - << "\n In finishScheduleConstruction() -- " - << "\n No coarser levels...will not fill from coarser." - << "\n dst_mapped_box_level:\n" << dst_mapped_box_level.format("DEST->", 2) - << "\n dst_to_fill:\n" << dst_to_fill.format("DF->", 2) - << "\n d_unfilled_mapped_box_level:\n" << d_unfilled_mapped_box_level->format("UF->", 2) - << "\n dst_to_unfilled:\n" << dst_to_unfilled->format("DU->", 2) - << "\n dst_to_src:\n" << dst_to_src.format("DS->", 2) - << std::endl); + tbox::perr + << "Internal error in RefineSchedule::finishScheduleConstruction..." + << "\n In finishScheduleConstruction() -- " + << "\n No coarser levels...will not fill from coarser." + << "\n next_coarser_ln: " << next_coarser_ln + << "\n src_growth_to_nest_dst: " << src_growth_to_nest_dst + << "\n dst_to_unfilled:\n" << dst_to_unfilled->format("\tDU->", 2) + << "\n d_unfilled_box_level:\n" << d_unfilled_box_level->format("\tUF->", 2) + << std::endl; + return 1; } else { if (!hierarchy) { - TBOX_ERROR("Internal RefineSchedule error..." - << "\n In finishScheduleConstruction() -- " - << "\n Need to fill from coarser hierarchy level and \n" - << "hierarchy is unavailable." << std::endl); + tbox::perr + << "Internal RefineSchedule error..." + << "\n In finishScheduleConstruction() -- " + << "\n Need to fill from coarser hierarchy level and \n" + << "hierarchy is unavailable." << std::endl; + return 2; } } /* * hiercoarse is the coarse level on the hierarchy. It is to be - * differentiated from the coarse interpolation (coarse_interp) level, which is at - * the same resolution and level number but is not on the hierarchy. + * differentiated from the coarse interpolation (coarse_interp) level, + * which is at the same resolution and level number but is not on the + * hierarchy. */ const boost::shared_ptr hiercoarse_level( hierarchy->getPatchLevel(next_coarser_ln)); - const hier::BoxLevel& hiercoarse_mapped_box_level( + const hier::BoxLevel& hiercoarse_box_level( *hiercoarse_level->getBoxLevel()); /* @@ -783,18 +883,17 @@ RefineSchedule::finishScheduleConstruction( /* * Set up the coarse interpolation BoxLevel and also set up - * d_dst_to_coarse_interp, d_coarse_interp_to_dst and + * d_dst_to_coarse_interp, its transpose and * d_coarse_interp_to_unfilled. These * Connectors are easily generated using dst_to_unfilled. */ - hier::BoxLevel coarse_interp_mapped_box_level(dim); + boost::shared_ptr coarse_interp_box_level; setupCoarseInterpBoxLevel( - coarse_interp_mapped_box_level, + coarse_interp_box_level, d_dst_to_coarse_interp, - d_coarse_interp_to_dst, d_coarse_interp_to_unfilled, - hiercoarse_mapped_box_level, + hiercoarse_box_level, *dst_to_unfilled); /* @@ -803,22 +902,17 @@ RefineSchedule::finishScheduleConstruction( * BoxLevel (the next recursion's src). */ - hier::Connector coarse_interp_to_hiercoarse; - hier::Connector hiercoarse_to_coarse_interp; + boost::shared_ptr coarse_interp_to_hiercoarse; createCoarseInterpPatchLevel( d_coarse_interp_level, - coarse_interp_mapped_box_level, + coarse_interp_box_level, coarse_interp_to_hiercoarse, - hiercoarse_to_coarse_interp, - hierarchy, next_coarser_ln, - dst_to_src, - src_to_dst, - d_coarse_interp_to_dst, - d_dst_to_coarse_interp, - d_dst_level, - dst_is_coarse_interp_level); + hierarchy, + *d_dst_to_src, + *d_dst_to_coarse_interp, + d_dst_level); /* * Compute how much hiercoarse would have to grow to nest coarse_interp, a @@ -829,13 +923,15 @@ RefineSchedule::finishScheduleConstruction( * assumptions about where dst came from in order to determine * how its fill boxes nest in hiercoarse. */ - hier::IntVector hiercoarse_growth_to_nest_coarse_interp(dim); + hier::IntVector hiercoarse_growth_to_nest_coarse_interp( + hier::IntVector::getZero(dim)); + const bool dst_is_coarse_interp_level = this != d_top_refine_schedule; if (dst_is_coarse_interp_level) { /* * Assume that src barely nests in hiercoarse. (In most * places, it nests by a margin equal to the nesting buffer, * but we don't count on that because the nesting buffer is - * relaxed at physical boundaries.) To nest dst, hiercoarse + * zero at physical boundaries.) To nest dst, hiercoarse * has to grow as much as the src does, plus the ghost width * of the fill. * @@ -859,9 +955,11 @@ RefineSchedule::finishScheduleConstruction( * To nest dst and its fill boxes, hiercoarse just has to grow by * the ghost width of the fill. */ - hiercoarse_growth_to_nest_coarse_interp = dst_to_fill.getConnectorWidth(); + hiercoarse_growth_to_nest_coarse_interp = + dst_to_fill.getConnectorWidth(); } - hiercoarse_growth_to_nest_coarse_interp.ceilingDivide(dst_hiercoarse_ratio); + hiercoarse_growth_to_nest_coarse_interp.ceilingDivide( + dst_hiercoarse_ratio); t_finish_sched_const_recurse->stop(); @@ -882,27 +980,43 @@ RefineSchedule::finishScheduleConstruction( const int num_refine_items = d_refine_classes->getNumberOfRefineItems(); - for (int nd = 0; nd < num_refine_items; nd++) { + for (int nd = 0; nd < num_refine_items; ++nd) { RefineClasses::Data item = d_refine_classes->getRefineItem(nd); item.d_var_fill_pattern = bg_fill_pattern; coarse_schedule_refine_classes->insertEquivalenceClassItem(item); } - t_finish_sched_const->stop(); + if (t_finish_sched_const->isRunning()) { + t_finish_sched_const->stop(); + } - d_coarse_interp_schedule.reset(new RefineSchedule(d_coarse_interp_level, + int errf; + d_coarse_interp_schedule.reset(new RefineSchedule(errf, + d_coarse_interp_level, hiercoarse_level, next_coarser_ln - 1, hierarchy, - coarse_interp_to_hiercoarse, - hiercoarse_to_coarse_interp, + *coarse_interp_to_hiercoarse, hiercoarse_growth_to_nest_coarse_interp, coarse_schedule_refine_classes, d_transaction_factory, - d_refine_patch_strategy)); + d_refine_patch_strategy, + d_top_refine_schedule)); + if (errf) { + tbox::perr + << "In finishScheduleConstruction after failure to generate d_coarse_interp_schedule:" + << "\n next_coarser_ln: " << next_coarser_ln + << "\n src_growth_to_nest_dst: " << src_growth_to_nest_dst + << "\n coarse_interp_level:\n" << d_coarse_interp_level->getBoxLevel()->format("\tCI->", 2) + << "\n coarse_interp_to_hiercoarse:\n" << coarse_interp_to_hiercoarse->format("\tCHC->", 2) + << std::endl; + return errf; + } } else { - t_finish_sched_const->stop(); + if (t_finish_sched_const->isRunning()) { + t_finish_sched_const->stop(); + } } if (need_to_fill_encon) { @@ -917,11 +1031,11 @@ RefineSchedule::finishScheduleConstruction( createEnconFillSchedule( hierarchy, hiercoarse_level, - dst_is_coarse_interp_level, src_growth_to_nest_dst, *encon_to_unfilled_encon); } + return 0; } /* @@ -937,11 +1051,10 @@ void RefineSchedule::createEnconFillSchedule( const boost::shared_ptr& hierarchy, const boost::shared_ptr& hiercoarse_level, - const bool dst_is_coarse_interp_level, const hier::IntVector& src_growth_to_nest_dst, const hier::Connector& encon_to_unfilled_encon) { - const hier::BoxLevel &hiercoarse_mapped_box_level( + const hier::BoxLevel& hiercoarse_box_level( *hiercoarse_level->getBoxLevel()); const int next_coarser_ln = hiercoarse_level->getLevelNumber(); @@ -953,41 +1066,33 @@ RefineSchedule::createEnconFillSchedule( d_dst_level->getRatioToLevelZero() / hiercoarse_level->getRatioToLevelZero()); - hier::BoxLevel coarse_interp_encon_box_level( - hiercoarse_level->getRatioToLevelZero(), - hiercoarse_level->getGridGeometry(), - d_unfilled_mapped_box_level->getMPI()); + boost::shared_ptr coarse_interp_encon_box_level; setupCoarseInterpBoxLevel( coarse_interp_encon_box_level, d_encon_to_coarse_interp_encon, - d_coarse_interp_encon_to_encon, d_coarse_interp_encon_to_unfilled_encon, - hiercoarse_mapped_box_level, + hiercoarse_box_level, encon_to_unfilled_encon); - hier::Connector coarse_interp_encon_to_hiercoarse; - hier::Connector hiercoarse_to_coarse_interp_encon; + boost::shared_ptr coarse_interp_encon_to_hiercoarse; createCoarseInterpPatchLevel( d_coarse_interp_encon_level, coarse_interp_encon_box_level, coarse_interp_encon_to_hiercoarse, - hiercoarse_to_coarse_interp_encon, - hierarchy, next_coarser_ln, - d_encon_to_src, - d_src_to_encon, - d_coarse_interp_encon_to_encon, - d_encon_to_coarse_interp_encon, - d_encon_level, - dst_is_coarse_interp_level); + hierarchy, + *d_encon_to_src, + *d_encon_to_coarse_interp_encon, + d_encon_level); /* * Compute this nesting value the same as for coarse_interp */ hier::IntVector hiercoarse_growth_to_nest_coarse_interp_encon( - hiercoarse_level->getDim()); + hier::IntVector::getZero(hiercoarse_level->getDim())); + const bool dst_is_coarse_interp_level = this != d_top_refine_schedule; if (dst_is_coarse_interp_level) { hiercoarse_growth_to_nest_coarse_interp_encon = src_growth_to_nest_dst + encon_to_unfilled_encon.getConnectorWidth(); @@ -1012,7 +1117,7 @@ RefineSchedule::createEnconFillSchedule( const int num_refine_items = d_refine_classes->getNumberOfRefineItems(); - for (int nd = 0; nd < num_refine_items; nd++) { + for (int nd = 0; nd < num_refine_items; ++nd) { RefineClasses::Data item = d_refine_classes->getRefineItem(nd); item.d_var_fill_pattern = bg_fill_pattern; coarse_schedule_refine_classes->insertEquivalenceClassItem(item); @@ -1021,22 +1126,25 @@ RefineSchedule::createEnconFillSchedule( /* * Schedule to fill d_coarse_interp_encon_level */ + int errf; d_coarse_interp_encon_schedule.reset(new RefineSchedule( - d_coarse_interp_encon_level, - hiercoarse_level, - next_coarser_ln - 1, - hierarchy, - coarse_interp_encon_to_hiercoarse, - hiercoarse_to_coarse_interp_encon, - hiercoarse_growth_to_nest_coarse_interp_encon, - coarse_schedule_refine_classes, - d_transaction_factory, - d_refine_patch_strategy)); + errf, + d_coarse_interp_encon_level, + hiercoarse_level, + next_coarser_ln - 1, + hierarchy, + *coarse_interp_encon_to_hiercoarse, + hiercoarse_growth_to_nest_coarse_interp_encon, + coarse_schedule_refine_classes, + d_transaction_factory, + d_refine_patch_strategy, + d_top_refine_schedule)); + if (errf) { + TBOX_ERROR("RefineSchedule constructor aborting due to above errors."); + } } - - /* ************************************************************************** * Shear off parts of unfilled boxes that lie outside non-periodic @@ -1068,28 +1176,29 @@ RefineSchedule::shearUnfilledBoxesOutsideNonperiodicBoundaries( t_shear->start(); - const Connector& unfilled_to_periodic_domain( - d_unfilled_mapped_box_level->getPersistentOverlapConnectors(). - findOrCreateConnector( + const hier::Connector& unfilled_to_periodic_domain( + d_unfilled_box_level->findConnector( hierarchy->getDomainBoxLevel(), - dst_to_unfilled.getConnectorWidth())); + dst_to_unfilled.getConnectorWidth(), + hier::CONNECTOR_CREATE)); - Connector unfilled_to_sheared; - BoxLevel sheared_mapped_box_level(dim); + boost::shared_ptr unfilled_to_sheared; + boost::shared_ptr sheared_box_level; hier::BoxLevelConnectorUtils edge_utils; + edge_utils.setTimerPrefix("xfer::RefineSchedule_build"); edge_utils.computeInternalParts( - sheared_mapped_box_level, + sheared_box_level, unfilled_to_sheared, unfilled_to_periodic_domain, hier::IntVector::getZero(dim)); - t_modify_connector->start(); hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix("xfer::RefineSchedule_build"); + mca.setBarrierBeforeCommunication(false); // Next modify needs not communicate. mca.modify(dst_to_unfilled, - unfilled_to_sheared, - d_unfilled_mapped_box_level.get()); - t_modify_connector->stop(); + *unfilled_to_sheared, + d_unfilled_box_level.get()); dst_to_unfilled.eraseEmptyNeighborSets(); t_shear->stop(); @@ -1097,19 +1206,132 @@ RefineSchedule::shearUnfilledBoxesOutsideNonperiodicBoundaries( /* ************************************************************************** - * Set up the coarse interpolation BoxLevel. The coarse_interp_mapped_box_level + * Make the node-centered unfilled box level. + ************************************************************************** + */ + +void +RefineSchedule::makeNodeCenteredUnfilledBoxLevel( + const hier::BoxLevel& unfilled_box_level, + const hier::Connector& dst_to_unfilled) +{ + const tbox::Dimension& dim = unfilled_box_level.getDim(); + + d_unfilled_node_box_level.reset(new hier::BoxLevel( + unfilled_box_level.getRefinementRatio(), + unfilled_box_level.getGridGeometry(), + unfilled_box_level.getMPI())); + + d_unfilled_to_unfilled_node.reset(new hier::Connector( + unfilled_box_level, + *d_unfilled_node_box_level, + hier::IntVector::getZero(unfilled_box_level.getDim()))); + + const hier::BoxLevel& dst_box_level = dst_to_unfilled.getBase(); + + hier::Connector const* dst_to_src; + if (d_src_level) { + dst_to_src = d_dst_to_src; + } else { + dst_to_src = 0; + } + + hier::LocalId last_unfilled_node_local_id(-1); + const boost::shared_ptr& grid_geometry( + dst_to_unfilled.getBase().getGridGeometry()); + + for (hier::Connector::ConstNeighborhoodIterator cf = dst_to_unfilled.begin(); + cf != dst_to_unfilled.end(); ++cf) { + + const hier::BoxId& dst_box_id(*cf); + const hier::Box& dst_box = *dst_box_level.getBox(dst_box_id); + const hier::BlockId& dst_block = dst_box.getBlockId(); + hier::Box dst_node_box(dst_box); + dst_node_box.setUpper( + dst_node_box.upper() + hier::IntVector::getOne(dim)); + + for (hier::Connector::ConstNeighborIterator ni = dst_to_unfilled.begin(cf); + ni != dst_to_unfilled.end(cf); ++ni) { + + const hier::Box& unfilled_box = *ni; + + hier::BoxContainer unfilled_node_boxes(unfilled_box); + unfilled_node_boxes.begin()->setUpper( + unfilled_node_boxes.begin()->upper() + hier::IntVector::getOne(dim)); + + if (d_src_level && dst_to_src->hasNeighborSet(dst_box_id)) { + + hier::Connector::ConstNeighborhoodIterator dst_src_itr = + dst_to_src->findLocal(dst_box_id); + + for (hier::Connector::ConstNeighborIterator ds = + dst_to_src->begin(dst_src_itr); + ds != dst_to_src->end(dst_src_itr); ++ds) { + + const hier::Box& src_box = *ds; + const hier::BlockId& src_block = src_box.getBlockId(); + hier::Box src_node_box(src_box); + if (src_block == dst_block) { + src_node_box.setUpper( + src_node_box.upper() + hier::IntVector::getOne(dim)); + } else if (grid_geometry->areNeighbors(src_block, dst_block)) { + grid_geometry->transformBox( + src_node_box, + d_dst_level->getLevelNumber(), + dst_block, + src_block); + src_node_box.setUpper( + src_node_box.upper() + hier::IntVector::getOne(dim)); + } + if (!(src_node_box * dst_node_box).empty()) { + unfilled_node_boxes.removeIntersections(src_node_box); + } + } + } + + unfilled_node_boxes.coalesce(); + + hier::Connector::NeighborhoodIterator unfilled_itr = + d_unfilled_to_unfilled_node-> + makeEmptyLocalNeighborhood(unfilled_box.getBoxId()); + + for (hier::BoxContainer::iterator ui = unfilled_node_boxes.begin(); + ui != unfilled_node_boxes.end(); ++ui) { + + hier::Box unfilled_nodal(*ui, + ++last_unfilled_node_local_id, + dst_box.getOwnerRank()); + TBOX_ASSERT(unfilled_nodal.getBlockId() == dst_block); + + d_unfilled_node_box_level->addBoxWithoutUpdate(unfilled_nodal); + + d_unfilled_to_unfilled_node->insertLocalNeighbor( + unfilled_nodal, + unfilled_itr); + } + + } + } + + d_unfilled_node_box_level->finalize(); + +} + +/* + ************************************************************************** + * Set up the coarse interpolation BoxLevel. The coarse_interp_box_level * represents parts of the fill boxes that cannot be filled by - * d_src_level (d_unfilled_mapped_box_level). It will be filled by + * d_src_level (d_unfilled_box_level). It will be filled by * appealing to coarser levels in the hierarchy. * - * - Start with the d_unfilled_mapped_box_level. + * - Start with the d_unfilled_box_level. * - Coarsen unfilled boxes * - Shear off parts outside non-periodic boundaries or extend to boundary, * if needed for conforming to gridding restrictions at boundary. * - * Build Connectors d_dst_to_coarse_interp, d_coarse_interp_to_dst and - * d_coarse_interp_to_unfilled. The ghost data to be filled on the coarse interpolation level - * will be the max stencil width. + * Build Connectors d_dst_to_coarse_interp, its transpose and + * d_coarse_interp_to_unfilled. The ghost data to be filled on the coarse + * interpolation level will be the max stencil width. * * We set d_dst_to_coarse_interp's width big enough so each dst Box, grown by * this width, nests its potential coarse interpolation Boxes. Note that @@ -1119,44 +1341,44 @@ RefineSchedule::shearUnfilledBoxesOutsideNonperiodicBoundaries( */ void RefineSchedule::setupCoarseInterpBoxLevel( - hier::BoxLevel &coarse_interp_mapped_box_level, - hier::Connector &dst_to_coarse_interp, - hier::Connector &coarse_interp_to_dst, - hier::Connector &coarse_interp_to_unfilled, - const hier::BoxLevel &hiercoarse_mapped_box_level, - const hier::Connector &dst_to_unfilled) + boost::shared_ptr& coarse_interp_box_level, + boost::shared_ptr& dst_to_coarse_interp, + boost::shared_ptr& coarse_interp_to_unfilled, + const hier::BoxLevel& hiercoarse_box_level, + const hier::Connector& dst_to_unfilled) { - t_setup_coarse_interp_mapped_box_level->start(); + t_setup_coarse_interp_box_level->start(); const tbox::Dimension& dim(dst_to_unfilled.getBase().getDim()); const hier::IntVector dst_hiercoarse_ratio( d_dst_level->getRatioToLevelZero() - / hiercoarse_mapped_box_level.getRefinementRatio()); + / hiercoarse_box_level.getRefinementRatio()); const bool fully_periodic = d_num_periodic_directions == dim.getValue(); const boost::shared_ptr& grid_geometry( dst_to_unfilled.getBase().getGridGeometry()); - const int nblocks(grid_geometry->getNumberBlocks()); + const size_t nblocks = grid_geometry->getNumberBlocks(); hier::IntVector big_grow_vector(dim, 0); if (d_num_periodic_directions > 0) { - for (int dir = 0; dir < dim.getValue(); dir++) { + for (int dir = 0; dir < dim.getValue(); ++dir) { if (d_periodic_shift(dir)) { big_grow_vector(dir) = BIG_GHOST_CELL_WIDTH; } } } + hier::IntVector multi_big_grow(big_grow_vector, nblocks); - tbox::Array coarser_physical_domain(nblocks); - tbox::Array coarser_shear_domain(nblocks); - tbox::Array do_coarse_shearing(nblocks); - for (int b = 0; b < nblocks; b++) { + std::vector coarser_physical_domain(nblocks); + std::vector coarser_shear_domain(nblocks); + std::vector do_coarse_shearing(nblocks); + for (hier::BlockId::block_t b = 0; b < nblocks; ++b) { grid_geometry->computePhysicalDomain( coarser_physical_domain[b], - hiercoarse_mapped_box_level.getRefinementRatio(), + hiercoarse_box_level.getRefinementRatio(), hier::BlockId(b)); do_coarse_shearing[b] = (!fully_periodic && !d_domain_is_one_box[b]); @@ -1167,7 +1389,7 @@ RefineSchedule::setupCoarseInterpBoxLevel( coarser_shear_domain[b] = coarser_physical_domain[b]; if (d_num_periodic_directions > 0) { - coarser_shear_domain[b].grow(big_grow_vector); + coarser_shear_domain[b].grow(multi_big_grow); } coarser_shear_domain[b].unorder(); @@ -1177,10 +1399,16 @@ RefineSchedule::setupCoarseInterpBoxLevel( } } - coarse_interp_mapped_box_level.initialize( - hiercoarse_mapped_box_level.getRefinementRatio(), - grid_geometry, - hiercoarse_mapped_box_level.getMPI()); + coarse_interp_box_level.reset(new hier::BoxLevel( + hiercoarse_box_level.getRefinementRatio(), + grid_geometry, + hiercoarse_box_level.getMPI())); + + boost::shared_ptr nbr_blk_fill_box_level( + new hier::BoxLevel( + d_dst_level->getRatioToLevelZero(), + grid_geometry, + hiercoarse_box_level.getMPI())); /* * Width of dst-->coarse_interp is @@ -1199,29 +1427,33 @@ RefineSchedule::setupCoarseInterpBoxLevel( dst_hiercoarse_ratio) + d_max_stencil_width) * dst_hiercoarse_ratio; - dst_to_coarse_interp.clearNeighborhoods(); - dst_to_coarse_interp.setBase(dst_to_unfilled.getBase()); - dst_to_coarse_interp.setHead(coarse_interp_mapped_box_level); - dst_to_coarse_interp.setWidth(dst_to_coarse_interp_width, true); + dst_to_coarse_interp.reset(new hier::Connector(dst_to_unfilled.getBase(), + *coarse_interp_box_level, + dst_to_coarse_interp_width)); - coarse_interp_to_unfilled.clearNeighborhoods(); - coarse_interp_to_unfilled.setBase(coarse_interp_mapped_box_level); - coarse_interp_to_unfilled.setHead(dst_to_unfilled.getHead()); - coarse_interp_to_unfilled.setWidth(hier::IntVector::getZero(dim), true); + coarse_interp_to_unfilled.reset(new hier::Connector( + *coarse_interp_box_level, + dst_to_unfilled.getHead(), + hier::IntVector::getZero(dim))); + + d_coarse_interp_to_nbr_fill.reset(new hier::Connector( + *coarse_interp_box_level, + *nbr_blk_fill_box_level, + hier::IntVector::getZero(dim))); /* - * This loop builds up coarse_interp_mapped_box_level. It also builds up + * This loop builds up coarse_interp_box_level. It also builds up * the neighborhood sets of dst_to_coarse_interp and * coarse_interp_to_unfilled using simple associations in dst_to_unfilled. */ for (hier::Connector::ConstNeighborhoodIterator ei = dst_to_unfilled.begin(); ei != dst_to_unfilled.end(); ++ei) { - const hier::BoxId& dst_mapped_box_mbid = *ei; + const hier::BoxId& dst_box_id = *ei; hier::Connector::NeighborhoodIterator dst_base_box_itr = - dst_to_coarse_interp.findLocal(dst_mapped_box_mbid); - bool has_base_box = dst_base_box_itr != dst_to_coarse_interp.end(); + dst_to_coarse_interp->findLocal(dst_box_id); + bool has_base_box = dst_base_box_itr != dst_to_coarse_interp->end(); for (hier::Connector::ConstNeighborIterator ni = dst_to_unfilled.begin(ei); ni != dst_to_unfilled.end(ei); ++ni) { @@ -1232,59 +1464,124 @@ RefineSchedule::setupCoarseInterpBoxLevel( * the physical boundary to conform to normal gridding * restrictions. */ - const hier::Box& unfilled_mapped_box = *ni; - const int dst_blk = unfilled_mapped_box.getBlockId().getBlockValue(); + const hier::Box& unfilled_box = *ni; + const hier::BlockId& dst_blk_id = unfilled_box.getBlockId(); + const hier::BlockId::block_t& dst_blk = dst_blk_id.getBlockValue(); + + hier::Box coarse_interp_box(unfilled_box); + hier::BoxContainer coarse_interp_boxes; + if (nblocks == 1 || grid_geometry->hasIsotropicRatios()) { + coarse_interp_boxes.pushBack(coarse_interp_box); + } else { + hier::BoxUtilities::growAndAdjustAcrossBlockBoundary( + coarse_interp_boxes, + coarse_interp_box, + grid_geometry, + d_dst_level->getBoxLevel()->getRefinementRatio(), + hier::IntVector::getOne(dim), + hier::IntVector::getZero(dim), + false, + false); + } - hier::Box coarse_interp_box(unfilled_mapped_box); - coarse_interp_box.coarsen(dst_hiercoarse_ratio); + coarse_interp_boxes.coarsen(dst_hiercoarse_ratio); - hier::BoxContainer sheared_coarse_interp_boxes(coarse_interp_box); + std::vector sheared_coarse_interp_boxes(nblocks); - if (do_coarse_shearing[dst_blk] && - (d_dst_level->patchTouchesRegularBoundary( - dst_mapped_box_mbid))) { - sheared_coarse_interp_boxes.intersectBoxes(coarser_shear_domain[dst_blk]); - sheared_coarse_interp_boxes.simplify(); + if (nblocks > 1) { + sheared_coarse_interp_boxes.resize(nblocks); + for (hier::BoxContainer::iterator ci = coarse_interp_boxes.begin(); + ci != coarse_interp_boxes.end(); ++ci) { + const hier::BlockId& cblock_id = ci->getBlockId(); + sheared_coarse_interp_boxes[cblock_id.getBlockValue()]. + pushBack(*ci); + } + } else { + sheared_coarse_interp_boxes[0].spliceBack(coarse_interp_boxes); } - (void)hier::BoxUtilities::extendBoxesToDomainBoundary( - sheared_coarse_interp_boxes, - coarser_physical_domain[dst_blk], - d_max_stencil_width); + bool sheared_boxes_exist = false; + for (hier::BlockId::block_t blk = 0; blk < nblocks; ++blk) { + if (do_coarse_shearing[blk] && + !sheared_coarse_interp_boxes[blk].empty() && + (d_dst_level->patchTouchesRegularBoundary(dst_box_id))) { + sheared_coarse_interp_boxes[blk].intersectBoxes( + coarser_shear_domain[blk]); + sheared_coarse_interp_boxes[blk].simplify(); + } + + if (!sheared_coarse_interp_boxes[blk].empty()) { + (void)hier::BoxUtilities::extendBoxesToDomainBoundary( + sheared_coarse_interp_boxes[blk], + coarser_physical_domain[blk], + d_max_stencil_width); + sheared_boxes_exist = true; + } + } - if (sheared_coarse_interp_boxes.size() > 0) { + if (sheared_boxes_exist) { if (!has_base_box) { dst_base_box_itr = - dst_to_coarse_interp.makeEmptyLocalNeighborhood( - dst_mapped_box_mbid); + dst_to_coarse_interp->makeEmptyLocalNeighborhood(dst_box_id); has_base_box = true; } - for (hier::BoxContainer::iterator b(sheared_coarse_interp_boxes); - b != sheared_coarse_interp_boxes.end(); ++b) { - const hier::Box& coarse_interp_mapped_box = - *coarse_interp_mapped_box_level.addBox(*b, ni->getBlockId()); - dst_to_coarse_interp.insertLocalNeighbor( - coarse_interp_mapped_box, - dst_base_box_itr); - - coarse_interp_to_unfilled.insertLocalNeighbor( - unfilled_mapped_box, - coarse_interp_mapped_box.getId()); - } + for (hier::BlockId::block_t blk = dst_blk; + blk < nblocks + dst_blk; ++blk) { + hier::BlockId::block_t cur_blk = + static_cast(blk % nblocks); + for (hier::BoxContainer::iterator bi = + sheared_coarse_interp_boxes[cur_blk].begin(); + bi != sheared_coarse_interp_boxes[cur_blk].end(); ++bi) { + const hier::Box& coarse_interp_level_box = + *coarse_interp_box_level->addBox(*bi, bi->getBlockId()); + dst_to_coarse_interp->insertLocalNeighbor( + coarse_interp_level_box, + dst_base_box_itr); + + coarse_interp_to_unfilled->insertLocalNeighbor( + unfilled_box, + coarse_interp_level_box.getBoxId()); + + if (bi->getBlockId() != dst_blk_id && + !grid_geometry->hasIsotropicRatios()) { + hier::Box fill_box(coarse_interp_level_box); + fill_box.refine(dst_hiercoarse_ratio); + nbr_blk_fill_box_level->addBoxWithoutUpdate(fill_box); + d_coarse_interp_to_nbr_fill->insertLocalNeighbor( + fill_box, + coarse_interp_level_box.getBoxId()); + } + } + } } - } } + nbr_blk_fill_box_level->finalize(); + if (nblocks > 1 && !grid_geometry->hasIsotropicRatios()) { + d_nbr_blk_fill_level.reset(new hier::PatchLevel( + nbr_blk_fill_box_level, + d_dst_level->getGridGeometry(), + d_dst_level->getPatchDescriptor())); + d_nbr_blk_fill_level->setLevelNumber(d_dst_level->getLevelNumber()); + d_nbr_blk_fill_level->setNextCoarserHierarchyLevelNumber( + d_dst_level->getLevelNumber()-1); + + d_nbr_blk_fill_level->getGridGeometry()-> + adjustMultiblockPatchLevelBoundaries(*d_nbr_blk_fill_level); + } + /* * Get the transpose of dst_to_coarse_interp, which is simple to compute * because we know the edges are all local. */ - coarse_interp_to_dst.initializeToLocalTranspose(dst_to_coarse_interp); + dst_to_coarse_interp->setTranspose( + dst_to_coarse_interp->createLocalTranspose(), + true); - t_setup_coarse_interp_mapped_box_level->stop(); + t_setup_coarse_interp_box_level->stop(); } /* @@ -1300,39 +1597,32 @@ RefineSchedule::setupCoarseInterpBoxLevel( void RefineSchedule::createCoarseInterpPatchLevel( boost::shared_ptr& coarse_interp_level, - hier::BoxLevel& coarse_interp_mapped_box_level, - hier::Connector &coarse_interp_to_hiercoarse, - hier::Connector &hiercoarse_to_coarse_interp, - const boost::shared_ptr& hierarchy, + boost::shared_ptr& coarse_interp_box_level, + boost::shared_ptr& coarse_interp_to_hiercoarse, const int next_coarser_ln, - const hier::Connector &dst_to_src, - const hier::Connector &src_to_dst, - const hier::Connector &coarse_interp_to_dst, - const hier::Connector &dst_to_coarse_interp, - const boost::shared_ptr &dst_level, - const bool dst_is_coarse_interp_level ) + const boost::shared_ptr& hierarchy, + const hier::Connector& dst_to_src, + const hier::Connector& dst_to_coarse_interp, + const boost::shared_ptr& dst_level) { + TBOX_ASSERT(dst_to_src.hasTranspose()); + TBOX_ASSERT(dst_to_coarse_interp.hasTranspose()); + const tbox::Dimension& dim(hierarchy->getDim()); hier::OverlapConnectorAlgorithm oca; + oca.setTimerPrefix("xfer::RefineSchedule_build"); hier::BoxLevelConnectorUtils edge_utils; - /* - * Compute the overlap Connector widths required by RefineSchedule. - */ - std::vector self_connector_widths; - std::vector fine_connector_widths; - RefineScheduleConnectorWidthRequestor rscwri; - rscwri.computeRequiredConnectorWidths(self_connector_widths, - fine_connector_widths, - *hierarchy); - const boost::shared_ptr hiercoarse_level( hierarchy->getPatchLevel(next_coarser_ln)); - const hier::BoxLevel& hiercoarse_mapped_box_level( + const hier::BoxLevel& hiercoarse_box_level( *hiercoarse_level->getBoxLevel()); + const hier::IntVector& zero_vec(hier::IntVector::getZero(dim)); + const hier::IntVector& one_vec(hier::IntVector::getOne(dim)); + /* * To compute coarse_interp<==>hiercoarse, we will perform this bridge: * coarse_interp<==>dst<==>hiercoarse. @@ -1350,32 +1640,79 @@ RefineSchedule::createCoarseInterpPatchLevel( * scalability. */ - const Connector* dst_to_hiercoarse = NULL; - const Connector* hiercoarse_to_dst = NULL; - Connector bridged_dst_to_hiercoarse; - Connector bridged_hiercoarse_to_dst; + // Required hiercoarse<==>dst width for recursion: + const hier::IntVector& hiercoarse_to_dst_width( + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln]); + const hier::IntVector dst_to_hiercoarse_width( + hier::Connector::convertHeadWidthToBase( + dst_level->getBoxLevel()->getRefinementRatio(), + hiercoarse_box_level.getRefinementRatio(), + hiercoarse_to_dst_width)); - if (dst_is_coarse_interp_level) { + const hier::Connector* dst_to_hiercoarse = 0; + boost::shared_ptr bridged_dst_to_hiercoarse; + boost::shared_ptr bridged_hiercoarse_to_dst; + + /* + * dst_to_hiercoarse and its transpose point to the + * hiercoarse<==>dst Connector we will use. The exact Connectors + * will be either the ones cached in PersistentOverlapConnectors, + * or if not there, the ones computed by the + * dst<==>src<==>hiercoarse bridge. + * + * We expect to find cached hiercoarse<==>dst if: + * - dst is on the hierarchy + * - someone had the foresight to compute and cache it (such as the + * coarsening step of the Richardson extrapolation). + * + * If there is no cached hiercoarse<==>dst, we'll bridge + * dst<==>src<==>hiercoarse for it. Therefore, we require src to + * be on the hierarchy and satisfying certain nesting requirement + * and having cached src<==>hiercoarse. + * + * An unscalable alternative of last resort would be to have the + * PersistentOverlapConnectors compute the missing + * dst<==>hiercoarse. This is not implemented but could be in the + * future. + */ + + bool has_cached_connectors = + dst_level->hasConnector(*hiercoarse_level, dst_to_hiercoarse_width); + has_cached_connectors = has_cached_connectors && + hiercoarse_level->hasConnector(*dst_level, hiercoarse_to_dst_width); + + if (has_cached_connectors) { + + dst_to_hiercoarse = + &dst_level->findConnectorWithTranspose(*hiercoarse_level, + dst_to_hiercoarse_width, + hiercoarse_to_dst_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + } else { const hier::BoxLevel& src_box_level = *(d_src_level->getBoxLevel()); if (hierarchy->getBoxLevel(next_coarser_ln + 1).get() != &src_box_level) { TBOX_ERROR("Missing dst<==>hiercoarse connector and\n" - << "src is not from hierarchy."); + << "src is not from hierarchy. RefineSchedule cannot\n" + << "continue because there is no way to connect\n" + << "the destination to the hierarchy."); } const hier::BoxLevel& dst_box_level = dst_to_src.getBase(); const hier::IntVector& hiercoarse_to_src_width = - fine_connector_widths[next_coarser_ln]; + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln]; hier::IntVector src_to_hiercoarse_width = hiercoarse_to_src_width * d_src_level->getRatioToCoarserLevel(); /* * The computation of src_to_hiercoarse_width puts it in the - * resolution of next_coarser_ln+1, but that is not the - * resolution of src (for example, src may be a Richardson + * resolution of next_coarser_ln+1, but that is not necessarily + * the resolution of src (for example, src may be a Richardson * extrapolation temporary level), so we have to adjust. */ if (d_src_level->getBoxLevel()->getRefinementRatio() <= @@ -1395,21 +1732,18 @@ RefineSchedule::createCoarseInterpPatchLevel( } const hier::Connector& src_to_hiercoarse = - d_src_level->getBoxLevel()->getPersistentOverlapConnectors() - .findConnector( - hiercoarse_mapped_box_level, - src_to_hiercoarse_width); - - const hier::Connector& hiercoarse_to_src = - hiercoarse_mapped_box_level.getPersistentOverlapConnectors() - .findConnector( - *d_src_level->getBoxLevel(), - hiercoarse_to_src_width); - - const hier::IntVector& src_to_dst_width = src_to_dst.getConnectorWidth(); + d_src_level->findConnectorWithTranspose( + *hiercoarse_level, + src_to_hiercoarse_width, + hiercoarse_to_src_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + const hier::IntVector& src_to_dst_width = + dst_to_src.getTranspose().getConnectorWidth(); const hier::IntVector& dst_to_src_width = dst_to_src.getConnectorWidth(); - if (src_to_dst_width > hier::IntVector::getZero(dim) && - dst_to_src_width > hier::IntVector::getZero(dim)) { + if (src_to_dst_width > zero_vec && + dst_to_src_width > zero_vec) { if (s_barrier_and_time) { t_bridge_dst_hiercoarse->barrierAndStart(); @@ -1417,12 +1751,10 @@ RefineSchedule::createCoarseInterpPatchLevel( oca.bridge( bridged_dst_to_hiercoarse, - bridged_hiercoarse_to_dst, dst_to_src, src_to_hiercoarse, - hiercoarse_to_src, - src_to_dst, - fine_connector_widths[next_coarser_ln]); + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln], + true); if (s_barrier_and_time) { t_bridge_dst_hiercoarse->stop(); @@ -1430,24 +1762,26 @@ RefineSchedule::createCoarseInterpPatchLevel( } else { /* * This should be entered when setting up recursive schedules for - * enhanced connectivity. + * enhanced connectivity. */ - - hier::IntVector connector_width(src_to_dst_width); - connector_width.max(hier::IntVector::getOne(dim)); - const hier::Connector& found_src_to_dst = - src_box_level.getPersistentOverlapConnectors() - .findConnector( - dst_box_level, - connector_width); - - connector_width = dst_to_src_width; - connector_width.max(hier::IntVector::getOne(dim)); + + int level_number = d_src_level->getLevelNumber(); + const hier::Connector& found_dst_to_src = - dst_box_level.getPersistentOverlapConnectors() - .findConnector( + dst_box_level.findConnectorWithTranspose( src_box_level, - connector_width); + hierarchy->getRequiredConnectorWidth(level_number, level_number), + hierarchy->getRequiredConnectorWidth(level_number, level_number), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + const hier::Connector& found_src_to_hiercoarse = + d_src_level->findConnectorWithTranspose( + *hiercoarse_level, + hierarchy->getRequiredConnectorWidth(level_number, level_number - 1), + hierarchy->getRequiredConnectorWidth(level_number - 1, level_number), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); if (s_barrier_and_time) { t_bridge_dst_hiercoarse->barrierAndStart(); @@ -1455,12 +1789,10 @@ RefineSchedule::createCoarseInterpPatchLevel( oca.bridge( bridged_dst_to_hiercoarse, - bridged_hiercoarse_to_dst, found_dst_to_src, - src_to_hiercoarse, - hiercoarse_to_src, - found_src_to_dst, - fine_connector_widths[next_coarser_ln]); + found_src_to_hiercoarse, + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln], + true); if (s_barrier_and_time) { t_bridge_dst_hiercoarse->stop(); @@ -1468,30 +1800,14 @@ RefineSchedule::createCoarseInterpPatchLevel( } - bridged_dst_to_hiercoarse.removePeriodicRelationships(); - bridged_hiercoarse_to_dst.removePeriodicRelationships(); + bridged_dst_to_hiercoarse->removePeriodicRelationships(); + bridged_dst_to_hiercoarse->getTranspose().removePeriodicRelationships(); - dst_to_hiercoarse = &bridged_dst_to_hiercoarse; - hiercoarse_to_dst = &bridged_hiercoarse_to_dst; + dst_to_hiercoarse = bridged_dst_to_hiercoarse.get(); - } else { /* !dst_is_coarse_interp_level */ + } /* !has_cached_connectors */ - const hier::IntVector& hiercoarse_to_dst_width(fine_connector_widths[next_coarser_ln]); - const hier::IntVector dst_to_hiercoarse_width( - hier::Connector::convertHeadWidthToBase( - dst_level->getBoxLevel()->getRefinementRatio(), - hiercoarse_mapped_box_level.getRefinementRatio(), - hiercoarse_to_dst_width)); - - dst_to_hiercoarse = &dst_level->getBoxLevel()-> - getPersistentOverlapConnectors(). - findConnector(hiercoarse_mapped_box_level, - dst_to_hiercoarse_width); - hiercoarse_to_dst = &hiercoarse_mapped_box_level. - getPersistentOverlapConnectors(). - findConnector(*dst_level->getBoxLevel(), - hiercoarse_to_dst_width); - } + hier::Connector& hiercoarse_to_dst = dst_to_hiercoarse->getTranspose(); /* * Compute coarse_interp<==>hiercoarse by bridging @@ -1502,25 +1818,16 @@ RefineSchedule::createCoarseInterpPatchLevel( t_bridge_coarse_interp_hiercoarse->barrierAndStart(); } - const hier::IntVector neg1(-hier::IntVector::getOne(hierarchy->getDim())); - const hier::IntVector dst_growth_to_nest_coarse_interp = - dst_to_coarse_interp.getConnectorWidth() - - (d_max_stencil_width * dst_to_hiercoarse->getRatio()); - - oca.bridgeWithNesting( + oca.bridge( coarse_interp_to_hiercoarse, - hiercoarse_to_coarse_interp, - coarse_interp_to_dst, + dst_to_coarse_interp.getTranspose(), *dst_to_hiercoarse, - *hiercoarse_to_dst, - dst_to_coarse_interp, - dst_growth_to_nest_coarse_interp, - neg1, - neg1); - TBOX_ASSERT( coarse_interp_to_hiercoarse.getConnectorWidth() >= d_max_stencil_width ); - TBOX_ASSERT( hiercoarse_to_coarse_interp.getConnectorWidth() >= d_max_stencil_width ); - coarse_interp_to_hiercoarse.removePeriodicRelationships(); - hiercoarse_to_coarse_interp.removePeriodicRelationships(); + hiercoarse_to_dst.getConnectorWidth(), + true); + hier::Connector& hiercoarse_to_coarse_interp = + coarse_interp_to_hiercoarse->getTranspose(); + TBOX_ASSERT(coarse_interp_to_hiercoarse->getConnectorWidth() >= d_max_stencil_width); + TBOX_ASSERT(hiercoarse_to_coarse_interp.getConnectorWidth() >= d_max_stencil_width); if (s_barrier_and_time) { t_bridge_coarse_interp_hiercoarse->stop(); } @@ -1528,22 +1835,27 @@ RefineSchedule::createCoarseInterpPatchLevel( if (d_num_periodic_directions > 0) { /* * Remove periodic relationships added by bridging. Some of - * them may be extraneous because coarse_interp may have parts outside - * the domain boundary. Then add periodic images for coarse_interp and - * periodic relationships in coarse_interp<==>hiercoarse. + * them may be extraneous because coarse_interp may have parts + * outside the domain boundary. Then add periodic images for + * coarse_interp and periodic relationships in + * coarse_interp<==>hiercoarse. Connector + * hiercoarse--->hiercoarse must be as wide as hiercoarse--->dst + * to make sure it sees everything dst sees. Because dst sees + * all of coarse_interp, this guarantees that + * hiercoarse<==>coarse_interp does not miss any periodic + * relationships. */ - coarse_interp_to_hiercoarse.removePeriodicRelationships(); + coarse_interp_to_hiercoarse->removePeriodicRelationships(); hiercoarse_to_coarse_interp.removePeriodicRelationships(); const hier::Connector& hiercoarse_to_hiercoarse = - hiercoarse_level->getBoxLevel()-> - getPersistentOverlapConnectors(). - findConnector(*hiercoarse_level->getBoxLevel(), - hiercoarse_to_coarse_interp.getConnectorWidth()); + hiercoarse_level->findConnector(*hiercoarse_level, + hiercoarse_to_dst.getConnectorWidth(), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); edge_utils.addPeriodicImagesAndRelationships( - coarse_interp_mapped_box_level, - coarse_interp_to_hiercoarse, - hiercoarse_to_coarse_interp, + *coarse_interp_box_level, + *coarse_interp_to_hiercoarse, hierarchy->getGridGeometry()->getDomainSearchTree(), hiercoarse_to_hiercoarse); @@ -1551,10 +1863,9 @@ RefineSchedule::createCoarseInterpPatchLevel( if (s_extra_debug) { sanityCheckCoarseInterpAndHiercoarseLevels( - coarse_interp_to_hiercoarse, - hiercoarse_to_coarse_interp, + next_coarser_ln, hierarchy, - next_coarser_ln); + *coarse_interp_to_hiercoarse); } /* @@ -1563,12 +1874,10 @@ RefineSchedule::createCoarseInterpPatchLevel( * BoxLevel. */ - t_make_coarse_interp_level->start(); coarse_interp_level.reset(new hier::PatchLevel( - coarse_interp_mapped_box_level, + coarse_interp_box_level, hiercoarse_level->getGridGeometry(), hiercoarse_level->getPatchDescriptor())); - t_make_coarse_interp_level->stop(); coarse_interp_level->setLevelNumber(next_coarser_ln); coarse_interp_level->setNextCoarserHierarchyLevelNumber(next_coarser_ln - 1); @@ -1588,15 +1897,18 @@ RefineSchedule::createCoarseInterpPatchLevel( */ void RefineSchedule::sanityCheckCoarseInterpAndHiercoarseLevels( - const hier::Connector& coarse_interp_to_hiercoarse, - const hier::Connector& hiercoarse_to_coarse_interp, + const int next_coarser_ln, const boost::shared_ptr& hierarchy, - const int next_coarser_ln) + const hier::Connector& coarse_interp_to_hiercoarse) { + TBOX_ASSERT(coarse_interp_to_hiercoarse.hasTranspose()); + + const hier::Connector& hiercoarse_to_coarse_interp = + coarse_interp_to_hiercoarse.getTranspose(); /* - * coarse_interp_to_hiercoarse and hiercoarse_to_coarse_interp should be proper - * transposes. + * coarse_interp_to_hiercoarse and hiercoarse_to_coarse_interp should be + * proper transposes. */ size_t err1 = coarse_interp_to_hiercoarse.checkTransposeCorrectness( hiercoarse_to_coarse_interp); @@ -1609,60 +1921,46 @@ RefineSchedule::sanityCheckCoarseInterpAndHiercoarseLevels( << "hiercoarse_to_coarse_interp failed transpose correctness." << std::endl; - /* - * Compute the Connector widths required to properly - * set up overlap Connectors. - */ - - std::vector self_connector_widths; - std::vector fine_connector_widths; - - RefineScheduleConnectorWidthRequestor rscwri; - rscwri.computeRequiredConnectorWidths(self_connector_widths, - fine_connector_widths, - *hierarchy); - hier::OverlapConnectorAlgorithm oca; + oca.setTimerPrefix("xfer::RefineSchedule_build"); - // Check completeness of coarse_interp<==>hiercoarse Connectors. - oca.assertOverlapCorrectness( coarse_interp_to_hiercoarse ); - oca.assertOverlapCorrectness( hiercoarse_to_coarse_interp ); + hier::IntVector multi_max_stencil(d_max_stencil_width); /* * To work properly, we must ensure that - * coarse_interp^d_max_stencil_width nests in hiercoarse^fine_connector_width. + * coarse_interp^d_max_stencil_width nests in + * hiercoarse^fine_connector_width. * * The nesting guarantees that the Connectors sees enough of its * surroundings to generate all the necessary relationships in * further RefineSchedule recursions. We know that - * coarse_interp_to_hiercoarse and hiercoarse_to_coarse_interp are not complete, but - * this nesting guarantees we still have enough relationships to - * avoid miss any relationships when we use these Connectors in + * coarse_interp_to_hiercoarse and hiercoarse_to_coarse_interp are not + * complete, but this nesting guarantees we still have enough relationships + * to avoid missing any relationships when we use these Connectors in * bridge operations. */ - Connector wider_coarse_interp_to_hiercoarse( + boost::shared_ptr wider_coarse_interp_to_hiercoarse; + oca.findOverlaps(wider_coarse_interp_to_hiercoarse, coarse_interp_to_hiercoarse.getBase(), coarse_interp_to_hiercoarse.getHead(), - fine_connector_widths[next_coarser_ln] - d_max_stencil_width); - oca.findOverlaps(wider_coarse_interp_to_hiercoarse); - + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln] - multi_max_stencil); - BoxLevel external(hiercoarse_to_coarse_interp.getBase().getDim()); - Connector coarse_interp_to_external; + boost::shared_ptr external; + boost::shared_ptr coarse_interp_to_external; hier::BoxLevelConnectorUtils edge_utils; edge_utils.computeExternalParts( external, coarse_interp_to_external, - wider_coarse_interp_to_hiercoarse, - fine_connector_widths[next_coarser_ln] - d_max_stencil_width, + *wider_coarse_interp_to_hiercoarse, + d_top_refine_schedule->d_fine_connector_widths[next_coarser_ln] - multi_max_stencil, hierarchy->getGridGeometry()->getPeriodicDomainSearchTree()); - coarse_interp_to_external.eraseEmptyNeighborSets(); + coarse_interp_to_external->eraseEmptyNeighborSets(); - int err3 = coarse_interp_to_external.getGlobalNumberOfRelationships(); + int err3 = coarse_interp_to_external->getGlobalNumberOfRelationships(); if (err3) { tbox::perr << "Some parts of coarse_interp lies outside of where we\n" << "guarantee support for recursive RefineSchedule.\n" - << coarse_interp_to_external.format("SE: ", 2); + << coarse_interp_to_external->format("SE: ", 2); } if (err1 || err2 || err3) { @@ -1670,7 +1968,7 @@ RefineSchedule::sanityCheckCoarseInterpAndHiercoarseLevels( "coarse_interp<==>hiercoarse have problems as reported above.\n" << "coarse_interp:\n" << coarse_interp_to_hiercoarse.getBase().format("SUPP->", 2) << "hiercoarse:\n" << coarse_interp_to_hiercoarse.getHead().format("HCRS->", 2) - << "dst_to_coarse_interp:\n" << d_dst_to_coarse_interp.format("DS->", 2) + << "dst_to_coarse_interp:\n" << d_dst_to_coarse_interp->format("DS->", 2) << "coarse_interp_to_hiercoarse:\n" << coarse_interp_to_hiercoarse.format("SH->", 2) << "hiercoarse_to_coarse_interp:\n" << hiercoarse_to_coarse_interp.format("HS->", 2)); } @@ -1700,7 +1998,11 @@ RefineSchedule::fillData( double fill_time, bool do_physical_boundary_fill) const { - t_fill_data->start(); + if (s_barrier_and_time) { + t_fill_data->barrierAndStart(); + } + + t_fill_data_nonrecursive->start(); /* * Set the refine items and time for all transactions. These items will @@ -1708,7 +2010,6 @@ RefineSchedule::fillData( */ d_transaction_factory->setTransactionTime(fill_time); - d_transaction_factory->setRefineItems(d_refine_items, d_number_refine_items); /* * Check whether scratch data needs to be allocated on the destination @@ -1724,14 +2025,28 @@ RefineSchedule::fillData( allocateScratchSpace(encon_allocate_vector, d_encon_level, fill_time); } + hier::ComponentSelector nbr_fill_scratch_vector; + hier::ComponentSelector nbr_fill_dst_vector; + if (d_dst_level->getGridGeometry()->getNumberBlocks() > 1 && + d_nbr_blk_fill_level.get()) { + allocateScratchSpace(nbr_fill_scratch_vector, + d_nbr_blk_fill_level, + fill_time); + allocateDestinationSpace(nbr_fill_dst_vector, + d_nbr_blk_fill_level, + fill_time); + } + /* * Begin the recursive algorithm that fills from coarser, fills from * same, and then fills physical boundaries. */ - t_recursive_fill->start(); + t_fill_data_nonrecursive->stop(); + t_fill_data_recursive->start(); recursiveFill(fill_time, do_physical_boundary_fill); - t_recursive_fill->stop(); + t_fill_data_recursive->stop(); + t_fill_data_nonrecursive->start(); /* * Copy the scratch space of the destination level to the destination @@ -1749,15 +2064,17 @@ RefineSchedule::fillData( if (d_dst_level->getGridGeometry()->hasEnhancedConnectivity()) { d_encon_level->deallocatePatchData(encon_allocate_vector); } + if (d_dst_level->getGridGeometry()->getNumberBlocks() > 1 && + d_nbr_blk_fill_level.get()) { + d_nbr_blk_fill_level->deallocatePatchData(nbr_fill_scratch_vector); + d_nbr_blk_fill_level->deallocatePatchData(nbr_fill_dst_vector); + } - /* - * Unset the refine items for all transactions. These items are - * shared by all transaction objects in the communication schedule. - */ - - d_transaction_factory->unsetRefineItems(); + t_fill_data_nonrecursive->stop(); - t_fill_data->stop(); + if (s_barrier_and_time) { + t_fill_data->stop(); + } } /* @@ -1812,12 +2129,29 @@ RefineSchedule::recursiveFill( fill_time); } + hier::ComponentSelector nbr_blk_fill_allocate_vector; + if (d_dst_level->getGridGeometry()->getNumberBlocks() > 1 && + d_coarse_interp_schedule->d_nbr_blk_fill_level.get()) { + allocateScratchSpace(nbr_blk_fill_allocate_vector, + d_coarse_interp_schedule->d_nbr_blk_fill_level, fill_time); + } + + hier::ComponentSelector nbr_blk_fill_scratch_vector; + hier::ComponentSelector nbr_blk_fill_dst_vector; + if (d_nbr_blk_fill_level.get()) { + allocateScratchSpace(nbr_blk_fill_scratch_vector, + d_nbr_blk_fill_level, fill_time); + allocateDestinationSpace(nbr_blk_fill_dst_vector, + d_nbr_blk_fill_level, fill_time); + } + /* * Recursively call the fill routine to fill the required coarse fill * boxes on the coarser level. */ - d_coarse_interp_schedule->recursiveFill(fill_time, do_physical_boundary_fill); + d_coarse_interp_schedule->recursiveFill(fill_time, + do_physical_boundary_fill); /* * d_coarse_interp_level should now be filled. Now interpolate @@ -1826,8 +2160,8 @@ RefineSchedule::recursiveFill( refineScratchData(d_dst_level, d_coarse_interp_level, - d_coarse_interp_to_dst, - d_coarse_interp_to_unfilled, + d_dst_to_coarse_interp->getTranspose(), + *d_coarse_interp_to_unfilled, d_refine_overlaps); /* @@ -1841,6 +2175,19 @@ RefineSchedule::recursiveFill( encon_allocate_vector); } + if (d_dst_level->getGridGeometry()->getNumberBlocks() > 1 && + d_coarse_interp_schedule->d_nbr_blk_fill_level.get()) { + d_coarse_interp_schedule->d_nbr_blk_fill_level->deallocatePatchData( + nbr_blk_fill_allocate_vector); + } + + if (d_nbr_blk_fill_level.get()) { + d_nbr_blk_fill_level->deallocatePatchData( + nbr_blk_fill_scratch_vector); + d_nbr_blk_fill_level->deallocatePatchData( + nbr_blk_fill_dst_vector); + } + } if (d_coarse_interp_encon_schedule) { @@ -1851,7 +2198,9 @@ RefineSchedule::recursiveFill( */ hier::ComponentSelector allocate_vector; - allocateScratchSpace(allocate_vector, d_coarse_interp_encon_level, fill_time); + allocateScratchSpace(allocate_vector, + d_coarse_interp_encon_level, + fill_time); hier::ComponentSelector encon_allocate_vector; if (d_dst_level->getGridGeometry()->hasEnhancedConnectivity()) { @@ -1865,7 +2214,8 @@ RefineSchedule::recursiveFill( * boxes on the coarser level. */ - d_coarse_interp_encon_schedule->recursiveFill(fill_time, do_physical_boundary_fill); + d_coarse_interp_encon_schedule->recursiveFill(fill_time, + do_physical_boundary_fill); /* * d_coarse_interp_encon_level should now be filled. Now interpolate @@ -1874,8 +2224,8 @@ RefineSchedule::recursiveFill( refineScratchData(d_encon_level, d_coarse_interp_encon_level, - d_coarse_interp_encon_to_encon, - d_coarse_interp_encon_to_unfilled_encon, + d_encon_to_coarse_interp_encon->getTranspose(), + *d_coarse_interp_encon_to_unfilled_encon, d_encon_refine_overlaps); /* @@ -1907,7 +2257,9 @@ RefineSchedule::recursiveFill( fillPhysicalBoundaries(fill_time); } - fillSingularityBoundaries(fill_time); + if (d_dst_level->getGridGeometry()->getNumberOfBlockSingularities() > 0) { + fillSingularityBoundaries(fill_time); + } } /* @@ -1923,6 +2275,7 @@ RefineSchedule::fillPhysicalBoundaries( double fill_time) const { TBOX_ASSERT(d_dst_level); + t_fill_physical_boundaries->start(); d_dst_level->setBoundaryBoxes(); @@ -1938,6 +2291,7 @@ RefineSchedule::fillPhysicalBoundaries( } } } + t_fill_physical_boundaries->stop(); } /* @@ -1953,6 +2307,9 @@ RefineSchedule::fillSingularityBoundaries( double fill_time) const { TBOX_ASSERT(d_dst_level); + t_fill_singularity_boundaries->start(); + + NULL_USE(fill_time); boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); @@ -1963,17 +2320,17 @@ RefineSchedule::fillSingularityBoundaries( const tbox::Dimension& dim(d_dst_level->getDim()); - hier::IntVector ratio(d_dst_level->getRatioToLevelZero()); + const hier::IntVector& ratio = d_dst_level->getRatioToLevelZero(); - if (d_refine_patch_strategy) { + if (d_singularity_patch_strategy) { - for (int bn = 0; bn < grid_geometry->getNumberBlocks(); bn++) { + for (hier::BlockId::block_t bn = 0; bn < grid_geometry->getNumberBlocks(); ++bn) { hier::BlockId block_id(bn); const hier::BoxContainer& sing_boxes = grid_geometry->getSingularityBoxContainer(block_id); - for (hier::BoxContainer::const_iterator sb(sing_boxes); + for (hier::BoxContainer::const_iterator sb = sing_boxes.begin(); sb != sing_boxes.end(); ++sb) { hier::Box singularity(*sb); @@ -1985,21 +2342,21 @@ RefineSchedule::fillSingularityBoundaries( level_boxes.begin(block_id)); for ( ; dst_local_iter != level_boxes.end(block_id); - ++dst_local_iter) { + ++dst_local_iter) { - const hier::BoxId& mapped_box_id = - dst_local_iter->getId(); + const hier::BoxId& box_id = dst_local_iter->getBoxId(); boost::shared_ptr patch( - d_dst_level->getPatch(mapped_box_id)); + d_dst_level->getPatch(box_id)); boost::shared_ptr pgeom( patch->getPatchGeometry()); - tbox::Array nboxes = + const std::vector& nboxes = pgeom->getNodeBoundaries(); - if (nboxes.getSize()) { - for (int bb = 0; bb < nboxes.getSize(); bb++) { + if (nboxes.size()) { + for (int bb = 0; + bb < static_cast(nboxes.size()); ++bb) { hier::Box intersection((nboxes[bb].getBox()) * singularity); if (!(intersection.empty())) { @@ -2009,25 +2366,24 @@ RefineSchedule::fillSingularityBoundaries( d_boundary_fill_ghost_width)); if (!(fill_box.empty())) { - - d_refine_patch_strategy-> + d_singularity_patch_strategy-> fillSingularityBoundaryConditions( *patch, *d_encon_level, d_dst_to_encon, - fill_time, fill_box, nboxes[bb], + fill_box, nboxes[bb], grid_geometry); - } } } } if (dim == tbox::Dimension(3)) { - tbox::Array eboxes = + const std::vector& eboxes = pgeom->getEdgeBoundaries(); - if (eboxes.getSize()) { - for (int bb = 0; bb < eboxes.getSize(); bb++) { + if (eboxes.size()) { + for (int bb = 0; + bb < static_cast(eboxes.size()); ++bb) { hier::Box intersection( (eboxes[bb].getBox()) * singularity); if (!(intersection.empty())) { @@ -2037,12 +2393,11 @@ RefineSchedule::fillSingularityBoundaries( d_boundary_fill_ghost_width)); if (!(fill_box.empty())) { - - d_refine_patch_strategy-> + d_singularity_patch_strategy-> fillSingularityBoundaryConditions( *patch, *d_encon_level, d_dst_to_encon, - fill_time, fill_box, eboxes[bb], + fill_box, eboxes[bb], grid_geometry); } } @@ -2054,6 +2409,7 @@ RefineSchedule::fillSingularityBoundaries( } } } + t_fill_singularity_boundaries->stop(); } /* @@ -2078,7 +2434,7 @@ RefineSchedule::allocateScratchSpace( hier::ComponentSelector preprocess_vector; - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const int scratch_id = d_refine_items[iri]->d_scratch; if (!level->checkAllocated(scratch_id)) { allocate_vector.setFlag(scratch_id); @@ -2095,32 +2451,28 @@ RefineSchedule::allocateScratchSpace( } } -/* - ************************************************************************** - * - * Allocate all destination data and store the destination components - * in a component selector. - * - ************************************************************************** - */ - void RefineSchedule::allocateDestinationSpace( hier::ComponentSelector& allocate_vector, + const boost::shared_ptr& level, double fill_time) const { - TBOX_ASSERT(d_dst_level); + TBOX_ASSERT(level); allocate_vector.clrAllFlags(); - for (int iri = 0; iri < d_number_refine_items; iri++) { + hier::ComponentSelector preprocess_vector; + + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const int dst_id = d_refine_items[iri]->d_dst; - if (!d_dst_level->checkAllocated(dst_id)) { + if (!level->checkAllocated(dst_id)) { allocate_vector.setFlag(dst_id); } + preprocess_vector.setFlag(dst_id); } - d_dst_level->allocatePatchData(allocate_vector, fill_time); + level->allocatePatchData(allocate_vector, fill_time); + } /* @@ -2142,7 +2494,7 @@ RefineSchedule::copyScratchToDestination() const p != d_dst_level->end(); ++p) { const boost::shared_ptr& patch(*p); - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const int src_id = d_refine_items[iri]->d_scratch; const int dst_id = d_refine_items[iri]->d_dst; if (src_id != dst_id) { @@ -2170,88 +2522,188 @@ void RefineSchedule::refineScratchData( const boost::shared_ptr& fine_level, const boost::shared_ptr& coarse_level, - const Connector& coarse_to_fine, - const Connector& coarse_to_unfilled, - const std::list > >& + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled, + const std::vector > >& overlaps) const { t_refine_scratch_data->start(); +#ifdef DEBUG_CHECK_ASSERTIONS + bool is_encon = (fine_level == d_encon_level); +#endif + int nbr_blk_copies = 0; + + if (d_refine_patch_strategy) { + d_refine_patch_strategy->preprocessRefineLevel( + *fine_level, + *coarse_level, + coarse_to_fine, + coarse_to_unfilled, + overlaps, + d_refine_items); + } + const hier::IntVector ratio(fine_level->getRatioToLevelZero() / coarse_level->getRatioToLevelZero()); - std::list > >::const_iterator - overlap_iter(overlaps.begin()); - /* * Loop over all the coarse patches and find the corresponding * destination patch and destination fill boxes. */ - for ( hier::PatchLevel::iterator crse_itr(coarse_level->begin()); - crse_itr != coarse_level->end(); ++crse_itr, ++overlap_iter ) - { - const hier::Box& crse_mapped_box = crse_itr->getBox(); + for (int pi = 0; pi < coarse_level->getLocalNumberOfPatches(); ++pi) { + const hier::Box& crse_box = coarse_level->getPatch(pi)->getBox(); + const hier::BoxId& crse_box_id = crse_box.getBoxId(); + hier::Connector::ConstNeighborhoodIterator dst_nabrs = - coarse_to_fine.find(crse_mapped_box.getId()); - hier::Connector::ConstNeighborIterator na = - coarse_to_fine.begin(dst_nabrs); - const hier::Box& dst_mapped_box = *na; + coarse_to_fine.find(crse_box_id); + const hier::Box& dst_box = *coarse_to_fine.begin(dst_nabrs); #ifdef DEBUG_CHECK_ASSERTIONS /* - * Each crse_mapped_box can point back to just one dst_mapped_box. - * All other mapped_boxes in dst_nabrs must be a periodic image of - * the same dst_mapped_box. + * Each crse_box can point back to just one dst_box. + * All other boxes in dst_nabrs must be a periodic image of + * the same dst_box. */ - for (; na != coarse_to_fine.end(dst_nabrs); ++na) { + for (hier::Connector::ConstNeighborIterator na = coarse_to_fine.begin(dst_nabrs); + na != coarse_to_fine.end(dst_nabrs); ++na) { TBOX_ASSERT(na->isPeriodicImage() || - na == coarse_to_fine.begin(dst_nabrs)); - TBOX_ASSERT(na->getGlobalId() == dst_mapped_box.getGlobalId()); + na == coarse_to_fine.begin(dst_nabrs)); + TBOX_ASSERT(na->getGlobalId() == dst_box.getGlobalId()); } #endif boost::shared_ptr fine_patch(fine_level->getPatch( - dst_mapped_box.getGlobalId())); + dst_box.getGlobalId())); boost::shared_ptr crse_patch(coarse_level->getPatch( - crse_mapped_box.getGlobalId())); + crse_box.getGlobalId())); + + const hier::BlockId& crse_blk_id = crse_patch->getBox().getBlockId(); + hier::IntVector local_ratio(ratio.getBlockVector(crse_blk_id)); + if (fine_patch->getBox().getBlockId() == crse_blk_id) { + + TBOX_ASSERT(coarse_to_unfilled.numLocalNeighbors(crse_box.getBoxId()) == 1); + hier::Connector::ConstNeighborhoodIterator unfilled_nabrs = + coarse_to_unfilled.find(crse_box.getBoxId()); + const hier::Box& unfilled_nabr = + *coarse_to_unfilled.begin(unfilled_nabrs); + hier::BoxContainer fill_boxes(unfilled_nabr); + + if (d_refine_patch_strategy) { + d_refine_patch_strategy->preprocessRefineBoxes(*fine_patch, + *crse_patch, + fill_boxes, + local_ratio); + } - TBOX_ASSERT(coarse_to_unfilled.numLocalNeighbors( - crse_mapped_box.getId()) == 1); - hier::Connector::ConstNeighborhoodIterator unfilled_nabrs = - coarse_to_unfilled.find(crse_mapped_box.getId()); - const hier::Box& unfilled_nabr = - *coarse_to_unfilled.begin(unfilled_nabrs); - hier::BoxContainer fill_boxes(unfilled_nabr); - - if (d_refine_patch_strategy) { - d_refine_patch_strategy->preprocessRefineBoxes(*fine_patch, - *crse_patch, - fill_boxes, - ratio); - } + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { + const RefineClasses::Data * const ref_item = d_refine_items[iri]; + if (ref_item->d_oprefine) { - for (int iri = 0; iri < d_number_refine_items; iri++) { - const RefineClasses::Data * const ref_item = d_refine_items[iri]; - if (ref_item->d_oprefine) { + boost::shared_ptr refine_overlap = + (overlaps[pi])[ref_item->d_class_index]; - boost::shared_ptr refine_overlap( - (*overlap_iter)[ref_item->d_class_index]); + const int scratch_id = ref_item->d_scratch; - const int scratch_id = ref_item->d_scratch; + ref_item->d_oprefine->refine(*fine_patch, *crse_patch, + scratch_id, scratch_id, + *refine_overlap, local_ratio); - ref_item->d_oprefine->refine(*fine_patch, *crse_patch, - scratch_id, scratch_id, - *refine_overlap, ratio); + } + } + if (d_refine_patch_strategy) { + d_refine_patch_strategy->postprocessRefineBoxes(*fine_patch, + *crse_patch, + fill_boxes, + local_ratio); } - } + } else { + /* + * This section is only entered when filling ghost regions in + * blocks neighboring the fine patch, and there is anisotropic + * refinement so that the refinement ratio on the neighboring block + * may be different from the ratio on the fine patch's block. + */ - if (d_refine_patch_strategy) { - d_refine_patch_strategy->postprocessRefineBoxes(*fine_patch, - *crse_patch, - fill_boxes, - ratio); + TBOX_ASSERT(!is_encon); + TBOX_ASSERT(!d_dst_level->getGridGeometry()->hasIsotropicRatios()); + TBOX_ASSERT(d_coarse_interp_to_nbr_fill->numLocalNeighbors(crse_box.getBoxId()) == 1); + hier::Connector::ConstNeighborhoodIterator unfilled_nabrs = + d_coarse_interp_to_nbr_fill->find(crse_box.getBoxId()); + const hier::Box& unfilled_nabr = + *d_coarse_interp_to_nbr_fill->begin(unfilled_nabrs); + hier::BoxContainer fill_boxes(unfilled_nabr); + + const hier::BoxId& unfilled_id = unfilled_nabr.getBoxId(); + + /* + * The refinement operation interpolates data onto nbr_fill_patch. + */ + + boost::shared_ptr nbr_fill_patch( + d_nbr_blk_fill_level->getPatch(unfilled_id)); + + if (d_refine_patch_strategy) { + d_refine_patch_strategy->preprocessRefineBoxes(*nbr_fill_patch, + *crse_patch, + fill_boxes, + local_ratio); + } + + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { + const RefineClasses::Data * const ref_item = d_refine_items[iri]; + + if (ref_item->d_oprefine) { + + boost::shared_ptr refine_overlap = + (overlaps[pi])[ref_item->d_class_index]; + + const int scratch_id = ref_item->d_scratch; + + ref_item->d_oprefine->refine(*nbr_fill_patch, *crse_patch, + scratch_id, scratch_id, + *refine_overlap, local_ratio); + + } + } + + if (d_refine_patch_strategy) { + d_refine_patch_strategy->postprocessRefineBoxes(*nbr_fill_patch, + *crse_patch, + fill_boxes, + local_ratio); + } + + /* + * Post-interpolation loop to copy data from nbr_fill_patch to + * fine_patch. + */ + + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { + const RefineClasses::Data * const ref_item = d_refine_items[iri]; + + if (ref_item->d_oprefine) { + boost::shared_ptr nbr_copy_overlap = + (d_nbr_blk_copy_overlaps[nbr_blk_copies])[ref_item->d_class_index]; + + const int scratch_id = ref_item->d_scratch; + + fine_patch->getPatchData(scratch_id)->copy( + *nbr_fill_patch->getPatchData(scratch_id), *nbr_copy_overlap); + + } + } + + ++nbr_blk_copies; } + } + if (d_refine_patch_strategy) { + d_refine_patch_strategy->postprocessRefineLevel( + *fine_level, + *coarse_level, + coarse_to_fine, + coarse_to_unfilled); } t_refine_scratch_data->stop(); @@ -2267,11 +2719,11 @@ RefineSchedule::refineScratchData( */ void RefineSchedule::computeRefineOverlaps( - std::list > >& overlaps, + std::vector > >& overlaps, const boost::shared_ptr& fine_level, const boost::shared_ptr& coarse_level, - const Connector& coarse_to_fine, - const Connector& coarse_to_unfilled) + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled) { bool is_encon = (fine_level == d_encon_level); @@ -2284,89 +2736,213 @@ RefineSchedule::computeRefineOverlaps( const int num_equiv_classes = d_refine_classes->getNumberOfEquivalenceClasses(); + TBOX_ASSERT(overlaps.empty()); + overlaps.reserve(coarse_level->getLocalNumberOfPatches()); + + boost::shared_ptr grid_geom( + d_dst_level->getGridGeometry()); + /* * Loop over all the coarse patches and find the corresponding * destination patch and destination fill boxes. */ - for ( hier::PatchLevel::iterator crse_itr(coarse_level->begin()); - crse_itr != coarse_level->end(); ++crse_itr ) - { - const hier::Box& coarse_mapped_box = crse_itr->getBox(); + for (hier::PatchLevel::iterator crse_itr(coarse_level->begin()); + crse_itr != coarse_level->end(); ++crse_itr) { + const hier::Box& coarse_box = crse_itr->getBox(); hier::Connector::ConstNeighborhoodIterator fine_nabrs = - coarse_to_fine.find(coarse_mapped_box.getId()); + coarse_to_fine.find(coarse_box.getBoxId()); hier::Connector::ConstNeighborIterator na = coarse_to_fine.begin(fine_nabrs); - const hier::Box& fine_mapped_box = *na; + const hier::Box& fine_box = *na; #ifdef DEBUG_CHECK_ASSERTIONS /* - * Each coarse_mapped_box can point back to just one fine_mapped_box. - * All other mapped_boxes in fine_nabrs must be a periodic image of - * the same fine_mapped_box. + * Each coarse_box can point back to just one fine_box. + * All other boxes in fine_nabrs must be a periodic image of + * the same fine_box. */ - for (; na != coarse_to_fine.end(fine_nabrs); ++na) { + for ( ; na != coarse_to_fine.end(fine_nabrs); ++na) { TBOX_ASSERT(na->isPeriodicImage() || - na == coarse_to_fine.begin(fine_nabrs)); - TBOX_ASSERT(na->getGlobalId() == fine_mapped_box.getGlobalId()); + na == coarse_to_fine.begin(fine_nabrs)); + TBOX_ASSERT(na->getGlobalId() == fine_box.getGlobalId()); } #endif boost::shared_ptr fine_patch(fine_level->getPatch( - fine_mapped_box.getId())); + fine_box.getBoxId())); TBOX_ASSERT(coarse_to_unfilled.numLocalNeighbors( - coarse_mapped_box.getId()) == 1); + coarse_box.getBoxId()) == 1); hier::Connector::ConstNeighborhoodIterator unfilled_nabrs = - coarse_to_unfilled.find(coarse_mapped_box.getId()); + coarse_to_unfilled.find(coarse_box.getBoxId()); const hier::Box& unfilled_nabr = *coarse_to_unfilled.begin( - unfilled_nabrs); - hier::BoxContainer fill_boxes(unfilled_nabr); + unfilled_nabrs); + + if (unfilled_nabr.getBlockId() == coarse_box.getBlockId()) { + hier::BoxContainer fill_boxes(unfilled_nabr); + fill_boxes.intersectBoxes( + hier::Box::refine(coarse_box, coarse_to_fine.getRatio())); + const hier::BoxId& unfilled_id = unfilled_nabr.getBoxId(); + + hier::BoxContainer node_fill_boxes; + if (!is_encon) { + d_unfilled_to_unfilled_node->getNeighborBoxes(unfilled_id, + node_fill_boxes); + } - /* - * The refine overlap will cover only the fine fill box regions. - * of index space. Note that we restrict the interpolation range - * to the intersection of the fine fill box and the ghost box of - * the scratch data component (i.e., the destination of the - * interpolation). This is needed for the case where data - * components treated by the schedule have different ghost - * cell widths since the fill boxes are generated using the - * maximum ghost cell width. - */ - tbox::Array > refine_overlaps( - num_equiv_classes); - for (int ne = 0; ne < num_equiv_classes; ne++) { + /* + * The refine overlap will cover only the fine fill box regions. + * of index space. Note that we restrict the interpolation range + * to the intersection of the fine fill box and the ghost box of + * the scratch data component (i.e., the destination of the + * interpolation). This is needed for the case where data + * components treated by the schedule have different ghost + * cell widths since the fill boxes are generated using the + * maximum ghost cell width. + */ + overlaps.push_back(std::vector >(0)); + std::vector >& refine_overlaps( + overlaps.back()); + refine_overlaps.resize(num_equiv_classes); + for (int ne = 0; ne < num_equiv_classes; ++ne) { + + const RefineClasses::Data& rep_item = + d_refine_classes->getClassRepresentative(ne); + + if (rep_item.d_oprefine) { + + const int scratch_id = rep_item.d_scratch; + boost::shared_ptr fine_pdf( + fine_patch_descriptor->getPatchDataFactory(scratch_id)); + const hier::IntVector& fine_scratch_gcw = + fine_pdf->getGhostCellWidth(); + hier::Box scratch_space(fine_patch->getBox()); + scratch_space.grow(fine_scratch_gcw); + + if (!is_encon) { + refine_overlaps[ne] = + rep_item.d_var_fill_pattern->computeFillBoxesOverlap( + fill_boxes, + node_fill_boxes, + fine_patch->getBox(), + scratch_space, + *fine_pdf); + + } else { + refine_overlaps[ne] = + bg_fill_pattern->computeFillBoxesOverlap( + fill_boxes, + node_fill_boxes, + fine_patch->getBox(), + scratch_space, + *fine_pdf); + } + } + } + } else { + /* + * This section only gets entered if fine patch touches a block + * boundary and we need to fill ghost region across that block + * boundary, and there is anisotropic refinement so that the + * refinement ratio on the neighboring block may be different from + * the ratio on the fine patch's block. + */ + TBOX_ASSERT(!is_encon); + TBOX_ASSERT(!grid_geom->hasIsotropicRatios()); + TBOX_ASSERT(d_coarse_interp_to_nbr_fill->numLocalNeighbors(coarse_box.getBoxId()) == 1); + + /* + * Find the patch on d_nbr_blk_fill_level where data will + * be interpolated, and the fill boxes to ensure that data is only + * interpolated from space covered by the coarse box. + */ + hier::Connector::ConstNeighborhoodIterator fill_nabrs = + d_coarse_interp_to_nbr_fill->find(coarse_box.getBoxId()); + const hier::Box& fill_nabr = + *d_coarse_interp_to_nbr_fill->begin(fill_nabrs); - const RefineClasses::Data& rep_item = - d_refine_classes->getClassRepresentative(ne); + hier::BoxContainer fill_boxes(fill_nabr); + fill_boxes.intersectBoxes(hier::Box::refine(coarse_box, + coarse_to_fine.getRatio())); + const hier::BoxId& fill_id = fill_nabr.getBoxId(); - if (rep_item.d_oprefine) { + boost::shared_ptr nbr_fill_patch( + d_nbr_blk_fill_level->getPatch(fill_id)); - const int scratch_id = rep_item.d_scratch; - boost::shared_ptr fine_pdf( - fine_patch_descriptor->getPatchDataFactory(scratch_id)); - const hier::IntVector& fine_scratch_gcw = - fine_pdf->getGhostCellWidth(); - hier::Box scratch_space(fine_patch->getBox()); - scratch_space.grow(fine_scratch_gcw); + /* + * Access the Transformation so that dst_fill_box can be computed + * in terms of the fine patch's block's index space. + */ - if (!is_encon) { - refine_overlaps[ne] = - rep_item.d_var_fill_pattern->computeFillBoxesOverlap( - fill_boxes, - fine_patch->getBox(), - scratch_space, - *fine_pdf); + hier::BaseGridGeometry::ConstNeighborIterator nbr_itr = + grid_geom->find(fine_box.getBlockId(), coarse_box.getBlockId()); + TBOX_ASSERT(nbr_itr != grid_geom->end(fine_box.getBlockId())); + + const hier::Transformation& transformation = + (*nbr_itr).getTransformation(fine_level->getLevelNumber()); + + hier::Box dst_fill_box(fill_nabr); + transformation.transform(dst_fill_box); + + hier::IntVector fill_ghost_width( + this == d_top_refine_schedule ? + d_boundary_fill_ghost_width : d_max_stencil_width); + + fill_ghost_width.max(hier::IntVector::getOne(fine_box.getDim())); + hier::Box fill_fine_box(fine_box); + fill_fine_box.grow(fill_ghost_width); + dst_fill_box *= fill_fine_box; + + overlaps.push_back( + std::vector >(0)); + d_nbr_blk_copy_overlaps.push_back( + std::vector >(0)); + std::vector >& refine_overlaps( + overlaps.back()); + std::vector >& nbr_overlaps( + d_nbr_blk_copy_overlaps.back()); + refine_overlaps.resize(num_equiv_classes); + nbr_overlaps.resize(num_equiv_classes); + + hier::BoxContainer node_fill_boxes; //Unneeded here, so empty. + + /* + * The overlaps computed here are refine_overlaps, to control + * the interpolation of data onto nbr_fill_patch, and nbr_overlaps, + * to control local copies from nbr_fill_patch to fine_patch. + */ + for (int ne = 0; ne < num_equiv_classes; ++ne) { + + const RefineClasses::Data& rep_item = + d_refine_classes->getClassRepresentative(ne); + + if (rep_item.d_oprefine) { + + const int scratch_id = rep_item.d_scratch; + boost::shared_ptr fine_pdf( + fine_patch_descriptor->getPatchDataFactory(scratch_id)); + hier::Box scratch_space(nbr_fill_patch->getBox()); - } else { refine_overlaps[ne] = bg_fill_pattern->computeFillBoxesOverlap( fill_boxes, - fine_patch->getBox(), + node_fill_boxes, + nbr_fill_patch->getBox(), scratch_space, *fine_pdf); + + nbr_overlaps[ne] = + rep_item.d_var_fill_pattern->calculateOverlap( + *fine_pdf->getBoxGeometry(fine_patch->getBox()), + *fine_pdf->getBoxGeometry(nbr_fill_patch->getBox()), + fine_patch->getBox(), + fill_nabr, + dst_fill_box, + true, + transformation); + } } } - overlaps.push_back(refine_overlaps); } } @@ -2386,65 +2962,64 @@ RefineSchedule::computeRefineOverlaps( void RefineSchedule::generateCommunicationSchedule( - boost::shared_ptr& unfilled_mapped_box_level, - boost::shared_ptr& dst_to_unfilled, - boost::shared_ptr& unfilled_encon_box_level, - boost::shared_ptr& encon_to_unfilled_encon, - const Connector& dst_to_src, - const Connector& src_to_dst, - const Connector& dst_to_fill, - const BoxNeighborhoodCollection& dst_to_fill_on_src_proc, + boost::shared_ptr& unfilled_box_level, + boost::shared_ptr& dst_to_unfilled, + boost::shared_ptr& unfilled_encon_box_level, + boost::shared_ptr& encon_to_unfilled_encon, + const hier::Connector& dst_to_fill, + const hier::BoxNeighborhoodCollection& dst_to_fill_on_src_proc, const bool use_time_interpolation, const bool create_transactions) { t_gen_comm_sched->start(); + TBOX_ASSERT(d_dst_to_src); + TBOX_ASSERT(d_dst_to_src->hasTranspose()); boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); if (s_extra_debug) { - if (dst_to_src.isFinalized()) { - dst_to_src.assertTransposeCorrectness(src_to_dst); - src_to_dst.assertTransposeCorrectness(dst_to_src); + if (d_dst_to_src->isFinalized()) { + hier::Connector& src_to_dst = d_dst_to_src->getTranspose(); + d_dst_to_src->assertTransposeCorrectness(src_to_dst); + src_to_dst.assertTransposeCorrectness(*d_dst_to_src); } } - const BoxLevel& dst_mapped_box_level = dst_to_fill.getBase(); + const hier::BoxLevel& dst_box_level = dst_to_fill.getBase(); - unfilled_mapped_box_level.reset(new BoxLevel( - dst_mapped_box_level.getRefinementRatio(), - dst_mapped_box_level.getGridGeometry(), - dst_mapped_box_level.getMPI())); + unfilled_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); dst_to_unfilled.reset(new hier::Connector( - dst_mapped_box_level, - *unfilled_mapped_box_level, - dst_to_fill.getConnectorWidth(), - BoxLevel::DISTRIBUTED)); + dst_box_level, + *unfilled_box_level, + dst_to_fill.getConnectorWidth())); if (grid_geometry->hasEnhancedConnectivity()) { - unfilled_encon_box_level.reset(new BoxLevel( - dst_mapped_box_level.getRefinementRatio(), - dst_mapped_box_level.getGridGeometry(), - dst_mapped_box_level.getMPI())); + unfilled_encon_box_level.reset(new hier::BoxLevel( + dst_box_level.getRefinementRatio(), + dst_box_level.getGridGeometry(), + dst_box_level.getMPI())); encon_to_unfilled_encon.reset(new hier::Connector( *(d_encon_level->getBoxLevel()), *unfilled_encon_box_level, - dst_to_fill.getConnectorWidth(), - BoxLevel::DISTRIBUTED)); + dst_to_fill.getConnectorWidth())); } if (create_transactions) { /* - * Reorder the src_to_dst edge data to arrange neighbors by the - * dst mapped_boxes, as required to match the transaction ordering + * Reorder d_dst_to_src's transpose's edge data to arrange neighbors by + * the dst boxes, as required to match the transaction ordering * on the receiving processors. */ FullNeighborhoodSet src_to_dst_edges_bydst; t_invert_edges->start(); - reorderNeighborhoodSetsByDstNodes(src_to_dst_edges_bydst, src_to_dst); + reorderNeighborhoodSetsByDstNodes(src_to_dst_edges_bydst); t_invert_edges->stop(); t_construct_send_trans->start(); @@ -2457,39 +3032,43 @@ RefineSchedule::generateCommunicationSchedule( ei != src_to_dst_edges_bydst.end(); ++ei) { /* - * dst_mapped_box can be remote (by definition of FullNeighborhoodSet). - * local_src_mapped_boxes are the local source mapped_boxes that - * contribute data to dst_mapped_box. + * dst_box can be remote (by definition of FullNeighborhoodSet). + * local_src_boxes are the local source boxes that + * contribute data to dst_box. */ - const hier::Box& dst_mapped_box = ei->first; - const hier::BoxContainer& local_src_mapped_boxes = ei->second; - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); + const hier::Box& dst_box = ei->first; + const hier::BoxContainer& local_src_boxes = ei->second; + TBOX_ASSERT(!dst_box.isPeriodicImage()); - BoxNeighborhoodCollection::ConstIterator dst_fill_iter = - dst_to_fill_on_src_proc.find(dst_mapped_box.getId()); + hier::BoxNeighborhoodCollection::ConstIterator dst_fill_iter = + dst_to_fill_on_src_proc.find(dst_box.getBoxId()); if (dst_fill_iter == dst_to_fill_on_src_proc.end()) { /* - * Missing fill boxes should indicate that the dst mapped_box + * Missing fill boxes should indicate that the dst box * has no fill box. One way this is possible is for * d_dst_level_fill_pattern to be of type PatchLevelBorderFillPattern - * and for dst_mapped_box to be away from level borders. + * and for dst_box to be away from level borders. */ continue; } - for (hier::BoxContainer::const_iterator - ni = local_src_mapped_boxes.begin(); - ni != local_src_mapped_boxes.end(); ++ni) { - const hier::Box& src_mapped_box = *ni; + int num_nbrs = dst_to_fill_on_src_proc.numNeighbors(dst_fill_iter); + hier::BoxNeighborhoodCollection::ConstNeighborIterator nbrs_begin = + dst_to_fill_on_src_proc.begin(dst_fill_iter); + hier::BoxNeighborhoodCollection::ConstNeighborIterator nbrs_end = + dst_to_fill_on_src_proc.end(dst_fill_iter); + for (hier::BoxContainer::const_iterator ni = local_src_boxes.begin(); + ni != local_src_boxes.end(); ++ni) { + const hier::Box& src_box = *ni; - if (src_mapped_box.getOwnerRank() != - dst_mapped_box.getOwnerRank()) { + if (src_box.getOwnerRank() != dst_box.getOwnerRank()) { constructScheduleTransactions( - dst_to_fill_on_src_proc, - dst_fill_iter, - dst_mapped_box, - src_mapped_box, + num_nbrs, + nbrs_begin, + nbrs_end, + dst_box, + src_box, use_time_interpolation); } @@ -2507,10 +3086,9 @@ RefineSchedule::generateCommunicationSchedule( for (hier::Connector::ConstNeighborhoodIterator cf = dst_to_fill.begin(); cf != dst_to_fill.end(); ++cf) { - const hier::BoxId& dst_mapped_box_id(*cf); - const hier::Box& dst_mapped_box = *dst_mapped_box_level.getBox( - dst_mapped_box_id); - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); + const hier::BoxId& dst_box_id(*cf); + const hier::Box& dst_box = *dst_box_level.getBox(dst_box_id); + const hier::BlockId& dst_block_id = dst_box.getBlockId(); hier::BoxContainer fill_boxes_list; for (hier::Connector::ConstNeighborIterator bi = dst_to_fill.begin(cf); @@ -2533,7 +3111,7 @@ RefineSchedule::generateCommunicationSchedule( /* * unfilled_boxes_for_dst starts out containing the fill boxes - * for the current dst_mapped_box. As transactions are created, + * for the current dst_box. As transactions are created, * the space covered by those transactions will be removed from this * list, and whatever is left cannot be filled from the source level. * @@ -2547,16 +3125,21 @@ RefineSchedule::generateCommunicationSchedule( if (create_transactions) { hier::Connector::ConstNeighborhoodIterator dst_to_src_iter = - dst_to_src.findLocal(dst_mapped_box_id); + d_dst_to_src->findLocal(dst_box_id); - if (dst_to_src_iter != dst_to_src.end()) { + if (dst_to_src_iter != d_dst_to_src->end()) { + int num_nbrs = dst_to_fill.numLocalNeighbors(*cf); + hier::Connector::ConstNeighborIterator nbrs_begin = + dst_to_fill.begin(cf); + hier::Connector::ConstNeighborIterator nbrs_end = + dst_to_fill.end(cf); for (hier::Connector::ConstNeighborIterator - na = dst_to_src.begin(dst_to_src_iter); - na != dst_to_src.end(dst_to_src_iter); ++na) { + na = d_dst_to_src->begin(dst_to_src_iter); + na != d_dst_to_src->end(dst_to_src_iter); ++na) { - const hier::Box& src_mapped_box = *na; - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); + const hier::Box& src_box = *na; + const hier::BlockId& src_block_id = src_box.getBlockId(); /* * Remove the source box from the unfilled boxes list. If @@ -2573,11 +3156,11 @@ RefineSchedule::generateCommunicationSchedule( if (!grid_geometry->areSingularityNeighbors(dst_block_id, src_block_id)) { - hier::Box transformed_src_box(src_mapped_box); + hier::Box transformed_src_box(src_box); grid_geometry->transformBox( transformed_src_box, - d_dst_level->getRatioToLevelZero(), + d_dst_level->getLevelNumber(), dst_block_id, src_block_id); @@ -2586,14 +3169,14 @@ RefineSchedule::generateCommunicationSchedule( } } else { - unfilled_boxes_for_dst.removeIntersections( - src_mapped_box); + unfilled_boxes_for_dst.removeIntersections(src_box); } constructScheduleTransactions( - dst_to_fill, - cf, - dst_mapped_box, - src_mapped_box, + num_nbrs, + nbrs_begin, + nbrs_end, + dst_box, + src_box, use_time_interpolation); } @@ -2601,32 +3184,30 @@ RefineSchedule::generateCommunicationSchedule( } if (grid_geometry->hasEnhancedConnectivity() && - unfilled_boxes_for_dst.size()) { + !unfilled_boxes_for_dst.empty()) { hier::BoxContainer fixed_unfilled_boxes(unfilled_boxes_for_dst); hier::BoxContainer dst_block_domain; grid_geometry->computePhysicalDomain( dst_block_domain, d_dst_level->getRatioToLevelZero(), - dst_mapped_box.getBlockId()); + dst_box.getBlockId()); fixed_unfilled_boxes.intersectBoxes(dst_block_domain); - for (hier::BoxContainer::iterator bi(unfilled_boxes_for_dst); + for (hier::BoxContainer::iterator bi = unfilled_boxes_for_dst.begin(); bi != unfilled_boxes_for_dst.end(); ++bi) { - const std::list& neighbors = - grid_geometry->getNeighbors(dst_mapped_box.getBlockId()); - - for (std::list::const_iterator - ni = neighbors.begin(); ni != neighbors.end(); ++ni) { + for (hier::BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(dst_box.getBlockId()); + ni != grid_geometry->end(dst_box.getBlockId()); ++ni) { hier::BoxContainer transformed_domain( - ni->getTransformedDomain()); + (*ni).getTransformedDomain()); - transformed_domain.refine(d_dst_level->getRatioToLevelZero()); + transformed_domain.refine(d_dst_level->getRatioToLevelZero()); transformed_domain.intersectBoxes(*bi); - if (transformed_domain.size()) { + if (!transformed_domain.empty()) { fixed_unfilled_boxes.spliceBack(transformed_domain); } } @@ -2639,21 +3220,23 @@ RefineSchedule::generateCommunicationSchedule( * Add mapping information to unfilled boxes and add them to * containers for the level. */ - if (unfilled_boxes_for_dst.size() > 0) { + if (!unfilled_boxes_for_dst.empty()) { + + unfilled_boxes_for_dst.coalesce(); + hier::Connector::NeighborhoodIterator base_box_itr = - dst_to_unfilled->makeEmptyLocalNeighborhood(dst_mapped_box_id); - for (hier::BoxContainer::iterator bi(unfilled_boxes_for_dst); + dst_to_unfilled->makeEmptyLocalNeighborhood(dst_box_id); + for (hier::BoxContainer::iterator bi = unfilled_boxes_for_dst.begin(); bi != unfilled_boxes_for_dst.end(); ++bi) { - hier::Box unfilled_mapped_box(*bi, - ++last_unfilled_local_id, - dst_mapped_box.getOwnerRank()); - TBOX_ASSERT(unfilled_mapped_box.getBlockId() == dst_block_id); + hier::Box unfilled_box(*bi, + ++last_unfilled_local_id, + dst_box.getOwnerRank()); + TBOX_ASSERT(unfilled_box.getBlockId() == dst_block_id); - unfilled_mapped_box_level->addBoxWithoutUpdate( - unfilled_mapped_box); + unfilled_box_level->addBoxWithoutUpdate(unfilled_box); dst_to_unfilled->insertLocalNeighbor( - unfilled_mapped_box, + unfilled_box, base_box_itr); } @@ -2663,18 +3246,17 @@ RefineSchedule::generateCommunicationSchedule( * Call private method to handle unfilled boxes where the destination * box touches enhanced connectivity. */ - if (encon_fill_boxes.size() > 0) { + if (!encon_fill_boxes.empty()) { findEnconUnfilledBoxes( unfilled_encon_box_level, encon_to_unfilled_encon, last_unfilled_local_id, - dst_mapped_box, - dst_to_src, + dst_box, encon_fill_boxes); } } // End receive/copy transactions loop - unfilled_mapped_box_level->finalize(); + unfilled_box_level->finalize(); if (grid_geometry->hasEnhancedConnectivity()) { unfilled_encon_box_level->finalize(); } @@ -2696,21 +3278,20 @@ RefineSchedule::findEnconFillBoxes( const hier::BoxContainer& fill_boxes_list, const hier::BlockId& dst_block_id) { - TBOX_ASSERT(encon_fill_boxes.size() == 0); + TBOX_ASSERT(encon_fill_boxes.empty()); boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); - const std::list& neighbors = - grid_geometry->getNeighbors(dst_block_id); - hier::BoxContainer encon_neighbor_list; - for (std::list::const_iterator ni = - neighbors.begin(); - ni != neighbors.end(); ni++) { - - if (ni->isSingularity()) { - hier::BoxContainer transformed_domain(ni->getTransformedDomain()); + for (hier::BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(dst_block_id); + ni != grid_geometry->end(dst_block_id); ++ni) { + + const hier::BaseGridGeometry::Neighbor& nbr = *ni; + if (nbr.isSingularity()) { + hier::BoxContainer transformed_domain( + nbr.getTransformedDomain()); encon_fill_boxes.spliceFront(transformed_domain); } @@ -2735,15 +3316,16 @@ RefineSchedule::findEnconUnfilledBoxes( const boost::shared_ptr& unfilled_encon_box_level, const boost::shared_ptr& encon_to_unfilled_encon, hier::LocalId& last_unfilled_local_id, - const hier::Box& dst_mapped_box, - const Connector& dst_to_src, + const hier::Box& dst_box, const hier::BoxContainer& encon_fill_boxes) { + TBOX_ASSERT(d_dst_to_src); + boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); - const hier::BoxId& dst_mapped_box_id = dst_mapped_box.getId(); - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); + const hier::BoxId& dst_box_id = dst_box.getBoxId(); + const hier::BlockId& dst_block_id = dst_box.getBlockId(); /* * map container will hold unfilled boxes for each block that is @@ -2755,58 +3337,58 @@ RefineSchedule::findEnconUnfilledBoxes( */ std::map unfilled_encon_nbr_boxes; - const std::list& neighbors = - grid_geometry->getNeighbors(dst_block_id); + for (hier::BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(dst_block_id); + ni != grid_geometry->end(dst_block_id); ++ni) { - for (std::list::const_iterator ni = - neighbors.begin(); - ni != neighbors.end(); ni++) { + const hier::BaseGridGeometry::Neighbor& nbr = *ni; + if (nbr.isSingularity()) { + const hier::BlockId nbr_block_id(nbr.getBlockId()); - if (ni->isSingularity()) { - const hier::BlockId nbr_block_id(ni->getBlockId()); - - hier::BoxContainer neighbor_boxes(ni->getTransformedDomain()); + hier::BoxContainer neighbor_boxes(nbr.getTransformedDomain()); neighbor_boxes.refine(d_dst_level->getRatioToLevelZero()); neighbor_boxes.intersectBoxes(encon_fill_boxes); unfilled_encon_nbr_boxes[nbr_block_id].spliceFront(neighbor_boxes); - } + } } - /* - * If there are overlapping source boxes found in dst_to_src, - * and if those source boxes lie across enhanced connectivity from - * the destination box, then we remove the source box from the - * source block's entry in the unfilled_encon_nbr_boxes map container. - */ - hier::Connector::ConstNeighborhoodIterator dst_to_src_iter = - dst_to_src.findLocal(dst_mapped_box_id); - - if (dst_to_src_iter != dst_to_src.end()) { - + if (d_src_level) { /* - * If at enhanced connectivity, remove source box from container of - * unfilled boxes + * If there are overlapping source boxes found in d_dst_to_src, + * and if those source boxes lie across enhanced connectivity from + * the destination box, then we remove the source box from the + * source block's entry in the unfilled_encon_nbr_boxes map container. */ - for (hier::Connector::ConstNeighborIterator na = dst_to_src.begin(dst_to_src_iter); - na != dst_to_src.end(dst_to_src_iter); ++na) { + hier::Connector::ConstNeighborhoodIterator dst_to_src_iter = + d_dst_to_src->findLocal(dst_box_id); + + if (dst_to_src_iter != d_dst_to_src->end()) { + + /* + * If at enhanced connectivity, remove source box from container of + * unfilled boxes + */ + for (hier::Connector::ConstNeighborIterator na = d_dst_to_src->begin(dst_to_src_iter); + na != d_dst_to_src->end(dst_to_src_iter); ++na) { - const hier::Box& src_mapped_box = *na; - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); + const hier::Box& src_box = *na; + const hier::BlockId& src_block_id = src_box.getBlockId(); - if (src_block_id != dst_block_id) { + if (src_block_id != dst_block_id) { - if (grid_geometry->areSingularityNeighbors(dst_block_id, - src_block_id)) { + if (grid_geometry->areSingularityNeighbors(dst_block_id, + src_block_id)) { - hier::Box transformed_src_box(src_mapped_box); - grid_geometry->transformBox(transformed_src_box, - d_dst_level->getRatioToLevelZero(), - dst_block_id, - src_block_id); + hier::Box transformed_src_box(src_box); + grid_geometry->transformBox(transformed_src_box, + d_dst_level->getLevelNumber(), + dst_block_id, + src_block_id); - unfilled_encon_nbr_boxes[src_block_id].removeIntersections( - transformed_src_box); + unfilled_encon_nbr_boxes[src_block_id].removeIntersections( + transformed_src_box); + } } } } @@ -2819,20 +3401,21 @@ RefineSchedule::findEnconUnfilledBoxes( if (unfilled_encon_nbr_boxes.size() > 0) { hier::Connector::ConstNeighborhoodIterator find_encon_nabrs = - d_dst_to_encon.findLocal(dst_mapped_box_id); + d_dst_to_encon->findLocal(dst_box_id); - if (find_encon_nabrs != d_dst_to_encon.end()) { + if (find_encon_nabrs != d_dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator de_iter = d_dst_to_encon.begin(find_encon_nabrs); - de_iter != d_dst_to_encon.end(find_encon_nabrs); ++de_iter) { + for (hier::Connector::ConstNeighborIterator de_iter = + d_dst_to_encon->begin(find_encon_nabrs); + de_iter != d_dst_to_encon->end(find_encon_nabrs); ++de_iter) { - const hier::BoxId& encon_mapped_box_id = de_iter->getId(); + const hier::BoxId& encon_box_id = de_iter->getBoxId(); const hier::BlockId& nbr_block_id = de_iter->getBlockId(); const hier::BoxContainer& unfilled_boxes = unfilled_encon_nbr_boxes[nbr_block_id]; - if (unfilled_boxes.size() > 0) { + if (!unfilled_boxes.empty()) { /* * The unfilled boxes are, at this point, represented in @@ -2843,22 +3426,22 @@ RefineSchedule::findEnconUnfilledBoxes( hier::Connector::NeighborhoodIterator base_box_itr = encon_to_unfilled_encon->makeEmptyLocalNeighborhood( - encon_mapped_box_id); - for (hier::BoxContainer::const_iterator bi(unfilled_boxes); + encon_box_id); + for (hier::BoxContainer::const_iterator bi = unfilled_boxes.begin(); bi != unfilled_boxes.end(); ++bi) { hier::Box unfilled_box(*bi); grid_geometry->transformBox( unfilled_box, - d_dst_level->getRatioToLevelZero(), + d_dst_level->getLevelNumber(), nbr_block_id, dst_block_id); hier::Box unfilled_encon_box(unfilled_box, ++last_unfilled_local_id, - dst_mapped_box.getOwnerRank()); + dst_box.getOwnerRank()); - TBOX_ASSERT(unfilled_encon_box.getBlockId() == nbr_block_id); + TBOX_ASSERT(unfilled_encon_box.getBlockId() == nbr_block_id); unfilled_encon_box_level->addBox(unfilled_encon_box); encon_to_unfilled_encon->insertLocalNeighbor( @@ -2889,43 +3472,48 @@ RefineSchedule::findEnconUnfilledBoxes( */ void RefineSchedule::reorderNeighborhoodSetsByDstNodes( - FullNeighborhoodSet& full_inverted_edges, - const Connector& src_to_dst) const + FullNeighborhoodSet& full_inverted_edges) const { + TBOX_ASSERT(d_dst_to_src); + TBOX_ASSERT(d_dst_to_src->hasTranspose()); + + hier::Connector& src_to_dst = d_dst_to_src->getTranspose(); + const tbox::Dimension& dim(d_dst_level->getDim()); - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(dim); - const BoxLevel& src_mapped_box_level = src_to_dst.getBase(); - const hier::IntVector& src_ratio = src_to_dst.getBase().getRefinementRatio(); + const hier::BoxLevel& src_box_level = src_to_dst.getBase(); + const hier::IntVector& src_ratio = src_box_level.getRefinementRatio(); const hier::IntVector& dst_ratio = src_to_dst.getHead().getRefinementRatio(); + const hier::PeriodicShiftCatalog& shift_catalog = + src_box_level.getGridGeometry()->getPeriodicShiftCatalog(); + /* - * These are the counterparts to shifted dst mapped_boxes and unshifted src - * mapped_boxes. + * These are the counterparts to shifted dst boxes and unshifted src boxes. */ - hier::Box shifted_mapped_box(dim), unshifted_nabr(dim); + hier::Box shifted_box(dim), unshifted_nabr(dim); full_inverted_edges.clear(); for (hier::Connector::ConstNeighborhoodIterator ci = src_to_dst.begin(); ci != src_to_dst.end(); ++ci) { - const hier::Box& mapped_box = - *src_mapped_box_level.getBoxStrict(*ci); + const hier::Box& src_box = *src_box_level.getBoxStrict(*ci); for (hier::Connector::ConstNeighborIterator na = src_to_dst.begin(ci); na != src_to_dst.end(ci); ++na) { const hier::Box& nabr = *na; if (nabr.isPeriodicImage()) { - shifted_mapped_box.initialize( - mapped_box, - shift_catalog->getOppositeShiftNumber(nabr.getPeriodicId()), - src_ratio); + shifted_box.initialize( + src_box, + shift_catalog.getOppositeShiftNumber(nabr.getPeriodicId()), + src_ratio, + shift_catalog); unshifted_nabr.initialize( nabr, - shift_catalog->getZeroShiftNumber(), - dst_ratio); - full_inverted_edges[unshifted_nabr].insert(shifted_mapped_box); + shift_catalog.getZeroShiftNumber(), + dst_ratio, + shift_catalog); + full_inverted_edges[unshifted_nabr].insert(shifted_box); } else { - full_inverted_edges[nabr].insert(mapped_box); + full_inverted_edges[nabr].insert(src_box); } } } @@ -2940,9 +3528,9 @@ RefineSchedule::reorderNeighborhoodSetsByDstNodes( * d_dst_level_fill_pattern. Initialize the fill BoxLevel from * the those fill boxes. * - * Set the edges between dst and fill mapped_box_levels (trivial, + * Set the edges between dst and fill box_levels (trivial, * since fill BoxLevel is related to dst BoxLevel). Set - * edges between src and fill mapped_box_levels (by copying the edges + * edges between src and fill box_levels (by copying the edges * between src and dst. * * If d_dst_level_fill_pattern can compute the relationship between @@ -2950,7 +3538,7 @@ RefineSchedule::reorderNeighborhoodSetsByDstNodes( * Otherwise, perform communication to get that information onto the * src processes. * - * The Connectors dst_to_dst and dst_to_src (in the arguments) + * The Connectors dst_to_src and src_to_src (in the arguments) * are required only for fill_patterns PatchLevelBorderFillPattern and * and PatchLevelBorderAndInteriorFillPattern **************************************************************** @@ -2958,14 +3546,13 @@ RefineSchedule::reorderNeighborhoodSetsByDstNodes( void RefineSchedule::setDefaultFillBoxLevel( - BoxLevel& fill_mapped_box_level, - Connector& dst_to_fill, - BoxNeighborhoodCollection& dst_to_fill_on_src_proc, - const BoxLevel& dst_mapped_box_level, - const hier::Connector* dst_to_src, - const hier::Connector* src_to_dst, - const hier::IntVector& fill_ghost_width) + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + hier::BoxNeighborhoodCollection& dst_to_fill_on_src_proc) { + TBOX_ASSERT(d_dst_to_src); + TBOX_ASSERT(d_dst_to_src->hasTranspose()); + /* * If the destination variable of any registered communication * requires that coarse data take precedence over fine data at @@ -2978,13 +3565,17 @@ RefineSchedule::setDefaultFillBoxLevel( */ const tbox::Dimension& dim(d_dst_level->getDim()); + const hier::BoxLevel& dst_box_level(*d_dst_level->getBoxLevel()); + const hier::IntVector& fill_ghost_width( + this == d_top_refine_schedule ? + d_boundary_fill_ghost_width : d_max_stencil_width); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(dim, dst_mapped_box_level, fill_ghost_width); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(dim, dst_box_level, fill_ghost_width); const hier::IntVector& constant_one_intvector(hier::IntVector::getOne(dim)); bool need_nontrivial_ghosts = false; - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { if (!(d_refine_items[iri]->d_fine_bdry_reps_var)) { need_nontrivial_ghosts = true; } @@ -2995,66 +3586,46 @@ RefineSchedule::setDefaultFillBoxLevel( fill_gcw.max(constant_one_intvector); } - const Connector dummy_connector; - const Connector* dst_to_dst = - dst_mapped_box_level.getPersistentOverlapConnectors().hasConnector( - dst_mapped_box_level, - fill_gcw) ? - &dst_mapped_box_level.getPersistentOverlapConnectors().findConnector( - dst_mapped_box_level, - fill_gcw) : &dummy_connector; - // New data computed here: /* * d_max_fill_boxes is the max number of fill boxes - * for any dst mapped_box. d_max_fill_boxes is nominally 1. + * for any dst box. d_max_fill_boxes is nominally 1. * If more is required (based on fill_pattern), * it is incremented below. */ d_max_fill_boxes = 1; /* - * Generate fill mapped_boxes (grown dst mapped_boxes) and - * get edges between dst and fill mapped_box_levels. + * Generate fill boxes (grown dst boxes) and + * get edges between dst and fill box_levels. * These are all local edges by definition. - * Note that since fill mapped_boxes are simply grown - * versions of dst_mapped_box (at most), edges between - * fill and src mapped_box_levels would have gcw of zero. + * Note that since fill boxes are simply grown + * versions of dst_box (at most), edges between + * fill and src box_levels would have gcw of zero. * * Technically speaking, edges between dst and * fill are not complete. Once the dst box is * grown to make the fill box, the fill box may - * intersect other boxes in the dst mapped_box_level. We + * intersect other boxes in the dst box_level. We * ignore all these overlaps because they are not * needed by the algorithm. */ - fill_mapped_box_level.initialize( - dst_mapped_box_level.getRefinementRatio(), - dst_mapped_box_level.getGridGeometry(), - dst_mapped_box_level.getMPI()); - /* * Note that dst_to_fill is NOT complete. - * We care only about the intersection between a dst_mapped_box - * and the fill_mapped_box it created. In fact, a dst_mapped_box - * may also intersect the fill_mapped_box of other nearby - * destination mapped_boxes. + * We care only about the intersection between a dst_box + * and the fill_box it created. In fact, a dst_box + * may also intersect the fill_box of other nearby + * destination boxes. */ - dst_to_fill.clearNeighborhoods(); - dst_to_fill.setBase(dst_mapped_box_level); - dst_to_fill.setHead(fill_mapped_box_level); - dst_to_fill.setWidth(fill_gcw, true); d_dst_level_fill_pattern->computeFillBoxesAndNeighborhoodSets( - fill_mapped_box_level, + fill_box_level, dst_to_fill, - dst_mapped_box_level, - *dst_to_dst, - dst_to_src == NULL ? dummy_connector : *dst_to_src, - src_to_dst == NULL ? dummy_connector : *src_to_dst, - fill_gcw); + dst_box_level, + fill_gcw, + d_data_on_patch_border_flag); d_max_fill_boxes = tbox::MathUtilities::Max( d_max_fill_boxes, @@ -3067,23 +3638,20 @@ RefineSchedule::setDefaultFillBoxLevel( * This part assumes src-dst ratio is one. * Should be modified if the assumption does not hold. */ - TBOX_ASSERT(dst_to_src->getRatio() == hier::IntVector::getOne(dim)); + TBOX_ASSERT(d_dst_to_src->getRatio() == 1); /* * For these fill_pattern, the src owner could not compute fill boxes * for all its dst neighbors using local data, so the dst owners * must send this information. */ - communicateFillBoxes(dst_to_fill_on_src_proc, - dst_to_fill, - *dst_to_src, - *src_to_dst); + communicateFillBoxes(dst_to_fill_on_src_proc, *dst_to_fill); } else { d_dst_level_fill_pattern->computeDestinationFillBoxesOnSourceProc( dst_to_fill_on_src_proc, - dst_mapped_box_level, - *src_to_dst, + dst_box_level, + d_dst_to_src->getTranspose(), fill_gcw); } } @@ -3106,7 +3674,7 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); - const int num_blocks = grid_geometry->getNumberBlocks(); + const size_t num_blocks = grid_geometry->getNumberBlocks(); /* * Create encon_box_level and associated Connectors. @@ -3115,17 +3683,19 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * boundaries, data communicated by this schedule will not be written * directly into those ghost regions, but rather into patches on * d_encon_level. This level, once filled with data, will be provided - * to RefinePatchStrategy's fillSingularityBoundaryConditions. + * to SingularityPatchStrategy's fillSingularityBoundaryConditions. */ - hier::BoxLevel encon_box_level(d_dst_level->getRatioToLevelZero(), - grid_geometry); + boost::shared_ptr encon_box_level( + boost::make_shared(d_dst_level->getRatioToLevelZero(), + grid_geometry)); - d_dst_to_encon.clearNeighborhoods(); - d_dst_to_encon.setBase(*(d_dst_level->getBoxLevel())); + d_dst_to_encon.reset(new hier::Connector(dim)); + d_dst_to_encon->setBase(*(d_dst_level->getBoxLevel())); + + hier::IntVector encon_gcw( + hier::IntVector::max(fill_gcw, hier::IntVector::getOne(dim))); if (num_blocks > 1) { - hier::IntVector encon_gcw( - hier::IntVector::max(fill_gcw, hier::IntVector::getOne(dim))); hier::LocalId encon_local_id(0); @@ -3133,7 +3703,7 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * Loop over blocks to find destination patches on each block * that touch enhanced connectivity. */ - for (int bn = 0; bn < num_blocks; bn++) { + for (hier::BlockId::block_t bn = 0; bn < num_blocks; ++bn) { hier::BlockId block_id(bn); @@ -3158,20 +3728,20 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) const hier::BoxContainer& sing_boxes = grid_geometry->getSingularityBoxContainer(block_id); - if (sing_boxes.size() > 0) { - const std::list& neighbors = - grid_geometry->getNeighbors(block_id); + if (!sing_boxes.empty()) { /* * Loop over neighboring blocks and find the ones that are * singularity neighbors. */ - for (std::list::const_iterator ni = neighbors.begin(); - ni != neighbors.end(); ni++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ni = + grid_geometry->begin(block_id); + ni != grid_geometry->end(block_id); ++ni) { - if (ni->isSingularity()) { + const hier::BaseGridGeometry::Neighbor& nbr = *ni; + if (nbr.isSingularity()) { - const hier::BlockId& nbr_id = ni->getBlockId(); + const hier::BlockId& nbr_id = nbr.getBlockId(); /* * Get the transformation from neighbor block to dst @@ -3179,9 +3749,9 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * domain in coordinate system of dst block. */ hier::Transformation::RotationIdentifier rotation = - ni->getRotationIdentifier(); - hier::IntVector offset(ni->getShift()); - offset *= (d_dst_level->getRatioToLevelZero()); + nbr.getRotationIdentifier(); + const hier::IntVector& offset = + nbr.getShift(d_dst_level->getLevelNumber()); hier::Transformation transformation(rotation, offset, nbr_id, block_id); @@ -3194,7 +3764,7 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) d_dst_level->getRatioToLevelZero()); /* - * Loop over dst mapped boxes for this block and + * Loop over dst boxes for this block and * determine if they touch the current neighbor block * at enhanced connectivity. */ @@ -3202,13 +3772,12 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) level_boxes.begin(block_id)); for ( ; dst_local_iter != level_boxes.end(block_id); - ++dst_local_iter) { + ++dst_local_iter) { - const hier::BoxId& mapped_box_id = - dst_local_iter->getId(); + const hier::BoxId& box_id = dst_local_iter->getBoxId(); boost::shared_ptr patch( - d_dst_level->getPatch(mapped_box_id)); + d_dst_level->getPatch(box_id)); boost::shared_ptr pgeom( patch->getPatchGeometry()); @@ -3225,7 +3794,7 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) encon_test_list.grow(encon_gcw); encon_test_list.intersectBoxes(trans_neighbor_list); - if (encon_test_list.size() > 0) { + if (!encon_test_list.empty()) { encon_test_list.coalesce(); TBOX_ASSERT(encon_test_list.size() == 1); @@ -3238,9 +3807,9 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) */ hier::Connector::NeighborhoodIterator base_box_itr = - d_dst_to_encon.makeEmptyLocalNeighborhood( - mapped_box_id); - for (hier::BoxContainer::iterator bi(encon_test_list); + d_dst_to_encon->makeEmptyLocalNeighborhood( + box_id); + for (hier::BoxContainer::iterator bi = encon_test_list.begin(); bi != encon_test_list.end(); ++bi) { hier::Box encon_box(*bi); @@ -3252,24 +3821,24 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * already exists in encon_box_level, * do not create another. */ - hier::Box encon_mapped_box(dim); - if (!encon_box_level.getSpatiallyEqualBox( - encon_box, nbr_id, encon_mapped_box)) { - encon_mapped_box = hier::Box(encon_box, - ++encon_local_id, - mapped_box_id.getOwnerRank()); - TBOX_ASSERT(encon_mapped_box.getBlockId() == - nbr_id); - encon_box_level.addBoxWithoutUpdate( - encon_mapped_box); + hier::Box actual_encon_box(dim); + if (!encon_box_level->getSpatiallyEqualBox( + encon_box, nbr_id, actual_encon_box)) { + actual_encon_box = hier::Box(encon_box, + ++encon_local_id, + box_id.getOwnerRank()); + TBOX_ASSERT(actual_encon_box.getBlockId() == + nbr_id); + encon_box_level->addBoxWithoutUpdate( + actual_encon_box); } /* * Add to the neighborhood set for the * d_dst_to_encon connector. */ - d_dst_to_encon.insertLocalNeighbor( - encon_mapped_box, + d_dst_to_encon->insertLocalNeighbor( + actual_encon_box, base_box_itr); } @@ -3286,7 +3855,7 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * Finalize encon_box_level create d_encon_level and more associated * Connectors. */ - encon_box_level.finalize(); + encon_box_level->finalize(); d_encon_level.reset(new hier::PatchLevel(encon_box_level, grid_geometry, @@ -3296,36 +3865,36 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) d_encon_level->setLevelNumber(d_dst_level->getLevelNumber()); - d_dst_to_encon.setHead(*(d_encon_level->getBoxLevel())); - d_dst_to_encon.setWidth(hier::IntVector::getOne(dim), true); + d_dst_to_encon->setHead(*(d_encon_level->getBoxLevel())); + d_dst_to_encon->setWidth(encon_gcw, true); if (d_src_level) { - const Connector& dst_to_src = - d_dst_level->getBoxLevel()->getPersistentOverlapConnectors(). - findConnector( - *d_src_level->getBoxLevel(), - hier::IntVector::getOne(dim)); - - const Connector& src_to_dst = - d_src_level->getBoxLevel()->getPersistentOverlapConnectors(). - findConnector( - *d_dst_level->getBoxLevel(), - hier::IntVector::getOne(dim)); - - Connector encon_to_dst; - encon_to_dst.initializeToLocalTranspose(d_dst_to_encon); + const hier::Connector& dst_to_src = + d_dst_level->findConnectorWithTranspose(*d_src_level, + encon_gcw, + encon_gcw, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + // d_dst_to_encon only needs its transpose set temporarily as the + // transpose is only used in this call to bridge. We do not want to + // store d_dst_to_encon's transpose after this point which is why it is + // deleted a few lines later. + hier::Connector* encon_to_dst = d_dst_to_encon->createLocalTranspose(); + d_dst_to_encon->setTranspose(encon_to_dst, false); hier::OverlapConnectorAlgorithm oca; + oca.setTimerPrefix("xfer::RefineSchedule_build"); oca.bridge( - d_src_to_encon, d_encon_to_src, - src_to_dst, - d_dst_to_encon, - encon_to_dst, + *encon_to_dst, dst_to_src, - hier::IntVector::getZero(dim)); + hier::IntVector::getZero(dim), + true); + d_dst_to_encon->setTranspose(0, false); + delete encon_to_dst; } } @@ -3334,78 +3903,104 @@ RefineSchedule::createEnconLevel(const hier::IntVector& fill_gcw) * Calculate the maximum ghost cell width of all destination patch data * components. * - * It is possible for dst_to_fill_on_src_proc to omit a visible dst mapped_box - * if the dst mapped_box has no fill boxes. + * It is possible for dst_to_fill_on_src_proc to omit a visible dst box + * if the dst box has no fill boxes. ************************************************************************** */ void RefineSchedule::communicateFillBoxes( - BoxNeighborhoodCollection& dst_to_fill_on_src_proc, - const Connector& dst_to_fill, - const Connector& dst_to_src, - const Connector& src_to_dst) + hier::BoxNeighborhoodCollection& dst_to_fill_on_src_proc, + const hier::Connector& dst_to_fill) { + TBOX_ASSERT(d_dst_to_src); + TBOX_ASSERT(d_dst_to_src->hasTranspose()); + + hier::Connector& src_to_dst = d_dst_to_src->getTranspose(); + const tbox::Dimension& dim(d_dst_level->getDim()); + int rank = dst_to_fill.getBase().getMPI().getRank(); + std::set src_owners; - dst_to_src.getLocalOwners(src_owners); - src_owners.erase(dst_to_fill.getBase().getMPI().getRank()); + d_dst_to_src->getLocalOwners(src_owners); + src_owners.erase(rank); std::set dst_owners; src_to_dst.getLocalOwners(dst_owners); - dst_owners.erase(dst_to_fill.getBase().getMPI().getRank()); + dst_owners.erase(rank); std::map > send_mesgs; std::map > recv_mesgs; + int num_incoming_comms = static_cast(dst_owners.size()); + int num_comms = static_cast(src_owners.size()) + num_incoming_comms; tbox::AsyncCommStage comm_stage; - tbox::AsyncCommPeer* comms = - new tbox::AsyncCommPeer[src_owners.size() + dst_owners.size()]; + tbox::AsyncCommPeer* comms = new tbox::AsyncCommPeer[num_comms]; + // Set up all comms. + // We want to post the first receive for the processor with rank immediatly + // less that this processor's. Set mesg_number to the index of the comm + // whose processor's receive we want to post first. int mesg_number = 0; + int counter = 0; + for (std::set::const_iterator di = dst_owners.begin(); + di != dst_owners.end(); ++di) { + comms[counter].initialize(&comm_stage); + comms[counter].setPeerRank(*di); + // Reuse communicator. Assuming it has no outstanding messages! + comms[counter].setMPI(src_to_dst.getMPI()); + comms[counter].setMPITag(0, 1); + if (*di < rank) { + ++mesg_number; + } + ++counter; + } + mesg_number = mesg_number > 0 ? mesg_number - 1 : num_incoming_comms - 1; + + // Set iterator si corresponds to comms[mesg_number]. + std::set::const_iterator si = num_comms == 0 ? + dst_owners.end() : + dst_owners.find(comms[mesg_number].getPeerRank()); /* * Post receives for fill boxes from dst owners. */ - - // TODO: should use cyclic ordering for efficiency. - for (std::set::const_iterator di = dst_owners.begin(); - di != dst_owners.end(); ++di) { - comms[mesg_number].initialize(&comm_stage); - comms[mesg_number].setPeerRank(*di); - // Reuse communicator. Assuming it has no outstanding messages! - comms[mesg_number].setMPI(src_to_dst.getMPI()); - comms[mesg_number].setMPITag(0, 1); + for (counter = 0; counter < num_incoming_comms; + ++counter, --si, --mesg_number) { comms[mesg_number].beginRecv(); if (comms[mesg_number].isDone()) { comms[mesg_number].pushToCompletionQueue(); } - ++mesg_number; + + if (si == dst_owners.begin()) { + // Continue loop at the opposite end. + si = dst_owners.end(); + mesg_number = num_incoming_comms; + } } /* * Pack fill boxes and send messages to src owners. - * TODO: should use cyclic ordering for efficiency. */ // Pack messages. std::vector tmp_mesg; hier::BoxContainer tmp_fill_boxes; for (hier::Connector::ConstNeighborhoodIterator ei = dst_to_fill.begin(); ei != dst_to_fill.end(); ++ei) { - const hier::BoxId& dst_mapped_box_id = *ei; + const hier::BoxId& dst_box_id = *ei; /* - * Pack dst_mapped_box_id's fill box info into tmp_mesg. - * - dst_mapped_box_id's LocalId + * Pack dst_box_id's fill box info into tmp_mesg. + * - dst_box_id's LocalId * - number of fill neighbors * - fill neighbors (could just send box and save 2 ints) - * Also, create BoxVector object for local use. */ tmp_mesg.clear(); - tmp_mesg.reserve(3 + dst_to_fill.numLocalNeighbors(dst_mapped_box_id) * hier::Box::commBufferSize(dim)); + tmp_mesg.reserve(3 + dst_to_fill.numLocalNeighbors(dst_box_id) + * hier::Box::commBufferSize(dim)); tmp_mesg.insert(tmp_mesg.end(), 3, 0); - tmp_mesg[0] = dst_mapped_box_id.getLocalId().getValue(); + tmp_mesg[0] = dst_box_id.getLocalId().getValue(); tmp_mesg[1] = -1; - tmp_mesg[2] = static_cast(dst_to_fill.numLocalNeighbors(dst_mapped_box_id)); + tmp_mesg[2] = static_cast(dst_to_fill.numLocalNeighbors(dst_box_id)); tmp_fill_boxes.clear(); for (hier::Connector::ConstNeighborIterator na = dst_to_fill.begin(ei); na != dst_to_fill.end(ei); ++na) { @@ -3416,16 +4011,16 @@ RefineSchedule::communicateFillBoxes( } // Append tmp_mesg to buffers for sending to src owners. hier::Connector::ConstNeighborhoodIterator di = - dst_to_src.findLocal(dst_mapped_box_id); - if (di != dst_to_src.end()) { + d_dst_to_src->findLocal(dst_box_id); + if (di != d_dst_to_src->end()) { std::set tmp_owners; - dst_to_src.getLocalOwners(di, tmp_owners); + d_dst_to_src->getLocalOwners(di, tmp_owners); for (std::set::const_iterator so = tmp_owners.begin(); so != tmp_owners.end(); ++so) { const int& src_owner = *so; - if (src_owner == dst_mapped_box_id.getOwnerRank()) { + if (src_owner == dst_box_id.getOwnerRank()) { dst_to_fill_on_src_proc.insert( - dst_mapped_box_id, + dst_box_id, tmp_fill_boxes); } else { std::vector& send_mesg = send_mesgs[src_owner]; @@ -3436,9 +4031,18 @@ RefineSchedule::communicateFillBoxes( } } } + // Send messages. - for (std::set::const_iterator si = src_owners.begin(); - si != src_owners.end(); ++si) { + // We want the first send to be to the processor whose rank is immediately + // greater that the sender's. Set si to the processor whose send we want to + // post first. + si = src_owners.lower_bound(rank + 1); + for (mesg_number = num_incoming_comms; + mesg_number < num_comms; + ++mesg_number, ++si) { + if (si == src_owners.end()) { + si = src_owners.begin(); + } comms[mesg_number].initialize(&comm_stage); comms[mesg_number].setPeerRank(*si); // Reuse communicator. Assuming it has no outstanding messages! @@ -3449,37 +4053,35 @@ RefineSchedule::communicateFillBoxes( if (comms[mesg_number].isDone()) { comms[mesg_number].pushToCompletionQueue(); } - ++mesg_number; } /* * Complete communication and unpack messages. */ - while ( comm_stage.numberOfCompletedMembers() > 0 || - comm_stage.advanceSome() ) { + while (comm_stage.hasCompletedMembers() || comm_stage.advanceSome()) { tbox::AsyncCommPeer* peer = - dynamic_cast *>(comm_stage.popCompletionQueue()); - TBOX_ASSERT(peer != NULL); + CPP_CAST *>(comm_stage.popCompletionQueue()); + TBOX_ASSERT(peer != 0); if (peer < comms + src_owners.size()) { // This is a receive. Unpack it. (Otherwise, ignore send completion.) const int* ptr = peer->getRecvData(); while (ptr != peer->getRecvData() + peer->getRecvSize()) { const hier::BoxId distributed_id(hier::LocalId(ptr[0]), peer->getPeerRank()); - const unsigned int num_fill_mapped_boxes = ptr[2]; + const unsigned int num_fill_boxes = ptr[2]; ptr += 3; d_max_fill_boxes = tbox::MathUtilities::Max( - d_max_fill_boxes, - num_fill_mapped_boxes); - BoxNeighborhoodCollection::Iterator fill_boxes_iter = + d_max_fill_boxes, + num_fill_boxes); + hier::BoxNeighborhoodCollection::Iterator fill_boxes_iter = dst_to_fill_on_src_proc.insert(distributed_id).first; - for (size_t ii = 0; ii < num_fill_mapped_boxes; ++ii) { - hier::Box tmp_dst_mapped_box(dim); - tmp_dst_mapped_box.getFromIntBuffer(ptr); + for (size_t ii = 0; ii < num_fill_boxes; ++ii) { + hier::Box tmp_dst_box(dim); + tmp_dst_box.getFromIntBuffer(ptr); ptr += hier::Box::commBufferSize(dim); dst_to_fill_on_src_proc.insert( fill_boxes_iter, - tmp_dst_mapped_box); + tmp_dst_box); } } TBOX_ASSERT(ptr == peer->getRecvData() + peer->getRecvSize()); @@ -3489,6 +4091,75 @@ RefineSchedule::communicateFillBoxes( delete[] comms; } +/* + ************************************************************************** + * Get whether there is data living on patch borders. + ************************************************************************** + */ + +bool +RefineSchedule::getDataOnPatchBorderFlag() const +{ + bool rval = false; + boost::shared_ptr pd( + d_dst_level->getPatchDescriptor()); + + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { + const int dst_id = d_refine_items[iri]->d_dst; + const hier::PatchDataFactory& pdf = *pd->getPatchDataFactory(dst_id); + if (pdf.dataLivesOnPatchBorder()) { + rval = true; + break; + } + } + + return rval; +} + +/* + ************************************************************************** + * Calculate the maximum ghost cell width of all destination patch data + * components for the purpose of determining overlap criterion. + * + * When data lives on the border, increment width to create an overlap + * in the cell index space. + ************************************************************************** + */ + +hier::IntVector +RefineSchedule::getMinConnectorWidth() const +{ + const tbox::Dimension& dim(d_dst_level->getDim()); + + hier::IntVector width(dim, 0); + boost::shared_ptr pd( + d_dst_level->getPatchDescriptor()); + + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { + + const int dst_id = d_refine_items[iri]->d_dst; + const hier::PatchDataFactory& dst_pdf = *pd->getPatchDataFactory(dst_id); + + if (dst_pdf.dataLivesOnPatchBorder()) { + width.max(dst_pdf.getGhostCellWidth() + 1); + } else { + width.max(dst_pdf.getGhostCellWidth()); + } + + const int scratch_id = d_refine_items[iri]->d_scratch; + const hier::PatchDataFactory& scratch_pdf = *pd->getPatchDataFactory(scratch_id); + + if (scratch_pdf.dataLivesOnPatchBorder()) { + width.max(scratch_pdf.getGhostCellWidth() + 1); + } else { + width.max(scratch_pdf.getGhostCellWidth()); + } + + } + + return width; +} + /* ************************************************************************** * Calculate the maximum ghost cell width of all destination patch data @@ -3505,7 +4176,7 @@ RefineSchedule::getMaxDestinationGhosts() const boost::shared_ptr pd( d_dst_level->getPatchDescriptor()); - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const int dst_id = d_refine_items[iri]->d_dst; gcw.max(pd->getPatchDataFactory(dst_id)->getGhostCellWidth()); } @@ -3531,7 +4202,7 @@ RefineSchedule::getMaxScratchGhosts() const boost::shared_ptr pd( d_dst_level->getPatchDescriptor()); - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const int scratch_id = d_refine_items[iri]->d_scratch; gcw.max(pd->getPatchDataFactory(scratch_id)->getGhostCellWidth()); } @@ -3554,12 +4225,12 @@ RefineSchedule::getMaxStencilGhosts() const hier::IntVector gcw(dim, 0); if (d_refine_patch_strategy) { - gcw = d_refine_patch_strategy->getRefineOpStencilWidth(); + gcw = d_refine_patch_strategy->getRefineOpStencilWidth(dim); } - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { if (d_refine_items[iri]->d_oprefine) { - gcw.max(d_refine_items[iri]->d_oprefine->getStencilWidth()); + gcw.max(d_refine_items[iri]->d_oprefine->getStencilWidth(dim)); } } @@ -3578,15 +4249,16 @@ RefineSchedule::getMaxStencilGhosts() const void RefineSchedule::constructScheduleTransactions( - const BoxNeighborhoodCollection& dst_to_fill_on_src_proc, - BoxNeighborhoodCollection::ConstIterator& dst_to_fill_iter, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, + int num_nbrs, + hier::BoxNeighborhoodCollection::ConstNeighborIterator& nbrs_begin, + hier::BoxNeighborhoodCollection::ConstNeighborIterator& nbrs_end, + const hier::Box& dst_box, + const hier::Box& src_box, bool use_time_interpolation) { TBOX_ASSERT(d_dst_level); TBOX_ASSERT(d_src_level); - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); // src absorbs the shift, if any. + TBOX_ASSERT(!dst_box.isPeriodicImage()); // src absorbs the shift, if any. const tbox::Dimension& dim(d_dst_level->getDim()); const int my_rank = d_dst_level->getBoxLevel()->getMPI().getRank(); @@ -3599,13 +4271,13 @@ RefineSchedule::constructScheduleTransactions( << std::endl; tbox::plog << " src: L" << d_src_level->getLevelNumber() << "R" << d_src_level->getRatioToLevelZero() - << " / " << src_mapped_box << std::endl; + << " / " << src_box << std::endl; tbox::plog << " dst: L" << d_dst_level->getLevelNumber() << "R" << d_dst_level->getRatioToLevelZero() - << " / " << dst_mapped_box << std::endl; - tbox::plog << " fill_boxes (" << dst_to_fill_on_src_proc.numNeighbors(dst_to_fill_iter) << ")"; - for (BoxNeighborhoodCollection::ConstNeighborIterator bi = dst_to_fill_on_src_proc.begin(dst_to_fill_iter); - bi != dst_to_fill_on_src_proc.end(dst_to_fill_iter); ++bi) { + << " / " << dst_box << std::endl; + tbox::plog << " fill_boxes (" << num_nbrs << ")"; + for (hier::BoxNeighborhoodCollection::ConstNeighborIterator bi = nbrs_begin; + bi != nbrs_end; ++bi) { tbox::plog << " " << *bi; } tbox::plog << std::endl; @@ -3625,9 +4297,9 @@ RefineSchedule::constructScheduleTransactions( } } - if (d_overlaps.getSize() < max_overlap_array_size) { - d_overlaps.setNull(); - d_overlaps.resizeArray(max_overlap_array_size); + if (static_cast(d_overlaps.size()) < max_overlap_array_size) { + d_overlaps.clear(); + d_overlaps.resize(max_overlap_array_size); } boost::shared_ptr dst_patch_descriptor( @@ -3635,51 +4307,48 @@ RefineSchedule::constructScheduleTransactions( boost::shared_ptr src_patch_descriptor( d_src_level->getPatchDescriptor()); - const hier::Box& dst_box = dst_mapped_box; -#ifdef DEBUG_CHECK_ASSERTIONS - const hier::Box& src_box = src_mapped_box; - // src_box used only in debug mode. Ifdef out in opt mode to avoid warning. -#endif - const bool same_patch = (d_dst_level == d_src_level && - dst_mapped_box.getGlobalId() == src_mapped_box.getGlobalId()); + dst_box.getGlobalId() == src_box.getGlobalId()); const bool same_patch_no_shift = - (same_patch && !src_mapped_box.isPeriodicImage()); + (same_patch && !src_box.isPeriodicImage()); const int num_equiv_classes = d_refine_classes->getNumberOfEquivalenceClasses(); - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(dim); + const hier::PeriodicShiftCatalog& shift_catalog = + d_dst_level->getGridGeometry()->getPeriodicShiftCatalog(); /* * Calculate the shift and the shifted source box. */ hier::IntVector src_shift(dim, 0); hier::IntVector dst_shift(dim, 0); - hier::Box unshifted_src_box = src_mapped_box; - hier::Box unshifted_dst_box = dst_mapped_box; - if (src_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); - src_shift = shift_catalog->shiftNumberToShiftDistance( - src_mapped_box.getPeriodicId()); - src_shift = (d_src_level->getRatioToLevelZero() > - constant_zero_intvector) ? - (src_shift * d_src_level->getRatioToLevelZero()) : - hier::IntVector::ceilingDivide(src_shift, - -d_src_level->getRatioToLevelZero()); + hier::Box unshifted_src_box = src_box; + hier::Box unshifted_dst_box = dst_box; + const hier::BlockId& dst_block_id = dst_box.getBlockId(); + const hier::BlockId& src_block_id = src_box.getBlockId(); + + if (src_box.isPeriodicImage()) { + TBOX_ASSERT(!dst_box.isPeriodicImage()); + const hier::IntVector& src_ratio = + d_src_level->getRatioToLevelZero(); + src_shift = shift_catalog.shiftNumberToShiftDistance( + src_box.getPeriodicId()); + src_shift = (src_ratio > constant_zero_intvector) ? + (src_shift * src_ratio) : + hier::IntVector::ceilingDivide(src_shift, -src_ratio); unshifted_src_box.shift(-src_shift); } - if (dst_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!src_mapped_box.isPeriodicImage()); - dst_shift = shift_catalog->shiftNumberToShiftDistance( - dst_mapped_box.getPeriodicId()); - dst_shift = (d_dst_level->getRatioToLevelZero() > - constant_zero_intvector) ? - (dst_shift * d_dst_level->getRatioToLevelZero()) : - hier::IntVector::ceilingDivide(dst_shift, - -d_dst_level->getRatioToLevelZero()); + if (dst_box.isPeriodicImage()) { + TBOX_ASSERT(!src_box.isPeriodicImage()); + const hier::IntVector& dst_ratio = + d_dst_level->getRatioToLevelZero(); + dst_shift = shift_catalog.shiftNumberToShiftDistance( + dst_box.getPeriodicId()); + dst_shift = (dst_ratio > constant_zero_intvector) ? + (dst_shift * dst_ratio) : + hier::IntVector::ceilingDivide(dst_shift, -dst_ratio); unshifted_dst_box.shift(-dst_shift); } if (s_extra_debug) { @@ -3692,28 +4361,26 @@ RefineSchedule::constructScheduleTransactions( /* * Transformation initialized to src_shift with no rotation. * It will never be modified in single-block runs, nor in multiblock runs - * when src_mapped_box and dst_mapped_box are on the same block. + * when src_box and dst_box are on the same block. */ hier::Transformation transformation(src_shift); /* - * When src_mapped_box and dst_mapped_box are on different blocks + * When src_box and dst_box are on different blocks * transformed_src_box is a representation of the source box in the * destination coordinate system. * * For all other cases, transformed_src_box is simply a copy of the - * box from src_mapped_box. + * box from src_box. */ - hier::Box transformed_src_box(src_mapped_box); + hier::Box transformed_src_box(src_box); /* * When needed, transform the source box and determine if src and * dst touch at an enhance connectivity singularity. */ bool is_singularity = false; - if (src_mapped_box.getBlockId() != dst_mapped_box.getBlockId()) { - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); + if (src_block_id != dst_block_id) { boost::shared_ptr grid_geometry( d_dst_level->getGridGeometry()); @@ -3722,75 +4389,82 @@ RefineSchedule::constructScheduleTransactions( grid_geometry->getRotationIdentifier(dst_block_id, src_block_id); hier::IntVector offset( - grid_geometry->getOffset(dst_block_id, src_block_id)); - - offset *= d_dst_level->getRatioToLevelZero(); + grid_geometry->getOffset(dst_block_id, src_block_id, d_dst_level->getLevelNumber())); is_singularity = grid_geometry->areSingularityNeighbors(dst_block_id, src_block_id); transformation = hier::Transformation(rotation, offset, - src_block_id, dst_block_id); + src_block_id, dst_block_id); transformation.transform(transformed_src_box); } /* * For any case except when src and dst touch at enhanced connectivity, * the transactions use d_dst_level as the destination level and - * dst_mapped_box as the destination box. For the enhanced connectivity + * dst_box as the destination box. For the enhanced connectivity * case, the destination level becomes d_encon_level and the destination * box is a member of d_encon_level. */ boost::shared_ptr transaction_dst_level; - hier::Box transaction_dst_mapped_box(dim); + hier::Box transaction_dst_box(dim); if (is_singularity) { /* - * Determination of transaction_dst_mapped_box is done differently - * depending of if dst_mapped_box is local. When it is local + * Determination of transaction_dst_box is done differently + * depending of if dst_box is local. When it is local * (regardless of whether source is also local), the appropriate - * Box to assign to transaction_dst_mapped_box can be + * Box to assign to transaction_dst_box can be * found from the d_dst_to_encon connector. * - * If the destination is not local, then the source is, - * and d_src_to_encon is searched to fined the right member of - * d_encon_level to assign to transaction_dst_mapped_box. + * If the destination is not local, then the source is, and + * d_encon_to_src->getTranspose() is searched to fined the right member + * of d_encon_level to assign to transaction_dst_box. */ - if (dst_mapped_box.getOwnerRank() == my_rank) { + if (dst_box.getOwnerRank() == my_rank) { hier::Connector::ConstNeighborhoodIterator ei = - d_dst_to_encon.findLocal(dst_mapped_box.getId()); + d_dst_to_encon->findLocal(dst_box.getBoxId()); - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); + if (ei == d_dst_to_encon->end()) { + return; + } + + const hier::BlockId& src_block_id = src_box.getBlockId(); - for (hier::Connector::ConstNeighborIterator en = d_dst_to_encon.begin(ei); - en != d_dst_to_encon.end(ei); ++en) { + for (hier::Connector::ConstNeighborIterator en = d_dst_to_encon->begin(ei); + en != d_dst_to_encon->end(ei); ++en) { if (src_block_id == en->getBlockId()) { - TBOX_ASSERT(transaction_dst_mapped_box.empty()); - transaction_dst_mapped_box = *en; + TBOX_ASSERT(transaction_dst_box.empty()); + transaction_dst_box = *en; } } } else { - TBOX_ASSERT(src_mapped_box.getOwnerRank() == my_rank); + TBOX_ASSERT(src_box.getOwnerRank() == my_rank); + + hier::Connector& src_to_encon = d_encon_to_src->getTranspose(); + hier::Connector::ConstNeighborhoodIterator ei = + src_to_encon.findLocal(src_box.getBoxId()); + + if (ei == src_to_encon.end()) { + return; + } hier::IntVector test_gcw( hier::IntVector::max(d_boundary_fill_ghost_width, d_max_stencil_width)); test_gcw.max(hier::IntVector::getOne(dim)); - hier::Box test_dst_box(dst_mapped_box); + hier::Box test_dst_box(dst_box); test_dst_box.grow(test_gcw); - hier::Connector::ConstNeighborhoodIterator ei = - d_src_to_encon.findLocal(src_mapped_box.getId()); - hier::BoxContainer encon_nbr_choices; - for (hier::Connector::ConstNeighborIterator ni = d_src_to_encon.begin(ei); - ni != d_src_to_encon.end(ei); ++ni) { - if (ni->getOwnerRank() == dst_mapped_box.getOwnerRank()) { + for (hier::Connector::ConstNeighborIterator ni = src_to_encon.begin(ei); + ni != src_to_encon.end(ei); ++ni) { + if (ni->getOwnerRank() == dst_box.getOwnerRank()) { hier::Box encon_box(*ni); transformation.transform(encon_box); @@ -3799,17 +4473,17 @@ RefineSchedule::constructScheduleTransactions( } } } - if (encon_nbr_choices.size() == 0) { - transaction_dst_mapped_box.setEmpty(); - transaction_dst_mapped_box.setBlockId(src_mapped_box.getBlockId()); + if (encon_nbr_choices.empty()) { + transaction_dst_box.setEmpty(); + transaction_dst_box.setBlockId(src_box.getBlockId()); } else { - int max_nbr_size = 0; - for (hier::BoxContainer::iterator en(encon_nbr_choices); + size_t max_nbr_size = 0; + for (hier::BoxContainer::iterator en = encon_nbr_choices.begin(); en != encon_nbr_choices.end(); ++en) { - const int box_size = en->size(); + const size_t box_size = en->size(); if (box_size > max_nbr_size) { max_nbr_size = box_size; - transaction_dst_mapped_box = *en; + transaction_dst_box = *en; } } } @@ -3823,10 +4497,10 @@ RefineSchedule::constructScheduleTransactions( * go here to do a simple assignment. */ transaction_dst_level = d_dst_level; - transaction_dst_mapped_box = dst_mapped_box; + transaction_dst_box = dst_box; } - for (int nc = 0; nc < num_equiv_classes; nc++) { + for (int nc = 0; nc < num_equiv_classes; ++nc) { const RefineClasses::Data& rep_item = d_refine_classes->getClassRepresentative(nc); @@ -3841,11 +4515,10 @@ RefineSchedule::constructScheduleTransactions( const hier::IntVector& dst_gcw = dst_pdf->getGhostCellWidth(); - hier::BoxContainer::iterator box_itr(d_src_masks); + hier::BoxContainer::iterator box_itr = d_src_masks.begin(); int box_num = 0; - for (BoxNeighborhoodCollection::ConstNeighborIterator bi = - dst_to_fill_on_src_proc.begin(dst_to_fill_iter); - bi != dst_to_fill_on_src_proc.end(dst_to_fill_iter); ++bi) { + for (hier::BoxNeighborhoodCollection::ConstNeighborIterator bi = nbrs_begin; + bi != nbrs_end; ++bi) { const hier::Box& fill_box = *bi; @@ -3886,14 +4559,16 @@ RefineSchedule::constructScheduleTransactions( src_mask = test_mask; transformation.inverseTransform(src_mask); - overlap = - rep_item.d_var_fill_pattern->calculateOverlap( - *dst_pdf->getBoxGeometry(unshifted_dst_box), - *src_pdf->getBoxGeometry(unshifted_src_box), - dst_mapped_box, - src_mask, - fill_box, - true, transformation); + if (!src_mask.empty()) { + overlap = + rep_item.d_var_fill_pattern->calculateOverlap( + *dst_pdf->getBoxGeometry(unshifted_dst_box), + *src_pdf->getBoxGeometry(unshifted_src_box), + dst_box, + src_mask, + fill_box, + true, transformation); + } } else { /* @@ -3903,7 +4578,7 @@ RefineSchedule::constructScheduleTransactions( hier::Box test_mask(dst_fill_box); transformation.inverseTransform(test_mask); - test_mask = test_mask * src_mapped_box; + test_mask = test_mask * src_box; if (test_mask.empty() && dst_pdf->dataLivesOnPatchBorder()) { if ((dst_gcw == constant_zero_intvector) || (dst_box.isSpatiallyEqual(fill_box))) { @@ -3911,29 +4586,31 @@ RefineSchedule::constructScheduleTransactions( test_mask = dst_fill_box; test_mask.grow(constant_one_intvector); transformation.inverseTransform(test_mask); - test_mask = test_mask * src_mapped_box; + test_mask = test_mask * src_box; } } src_mask = test_mask; hier::Box transformed_fill_box(fill_box); - hier::Box transformed_dst_box(dst_mapped_box); + hier::Box transformed_dst_box(dst_box); transformation.inverseTransform(transformed_fill_box); transformation.inverseTransform(transformed_dst_box); - overlap = - rep_item.d_var_fill_pattern->calculateOverlap( - *dst_pdf->getBoxGeometry(transaction_dst_mapped_box), - *src_pdf->getBoxGeometry(unshifted_src_box), - transformed_dst_box, - src_mask, - transformed_fill_box, - true, hier::Transformation(hier::IntVector::getZero(dim))); + if (!src_mask.empty()) { + overlap = + rep_item.d_var_fill_pattern->calculateOverlap( + *dst_pdf->getBoxGeometry(transaction_dst_box), + *src_pdf->getBoxGeometry(unshifted_src_box), + transformed_dst_box, + src_mask, + transformed_fill_box, + true, hier::Transformation(hier::IntVector::getZero(dim))); + } } #ifdef DEBUG_CHECK_ASSERTIONS - if (!overlap) { + if (!overlap && !src_mask.empty()) { TBOX_ERROR("Internal RefineSchedule error..." << "\n Overlap is NULL for " << "\n src box = " << src_box @@ -3948,7 +4625,7 @@ RefineSchedule::constructScheduleTransactions( } *box_itr = src_mask; d_overlaps[box_num] = overlap; - box_num++; + ++box_num; ++box_itr; } @@ -3957,13 +4634,14 @@ RefineSchedule::constructScheduleTransactions( * Iterate over components in refine description list */ for (std::list::iterator l(d_refine_classes->getIterator(nc)); - l != d_refine_classes->getIteratorEnd(nc); l++) { + l != d_refine_classes->getIteratorEnd(nc); ++l) { const RefineClasses::Data& item = d_refine_classes->getRefineItem(*l); TBOX_ASSERT(item.d_class_index == nc); + TBOX_ASSERT(&item == d_refine_items[*l]); + TBOX_ASSERT(item.d_tag == *l); const int dst_id = item.d_scratch; const int src_id = item.d_src; - const int ritem_count = item.d_tag; /* * If the src and dst patches, levels, and components are the @@ -3975,8 +4653,8 @@ RefineSchedule::constructScheduleTransactions( * Iterate over the fill boxes and create transactions * for each box that has a non-empty overlap. */ - hier::BoxContainer::iterator itr(d_src_masks); - for (int i = 0; i < box_num; i++, ++itr) { + hier::BoxContainer::iterator itr = d_src_masks.begin(); + for (int i = 0; i < box_num; ++i, ++itr) { /* * If overlap is not empty, then add the transaction @@ -3990,12 +4668,7 @@ RefineSchedule::constructScheduleTransactions( * whether we use time interpolation. */ - /* - * If we only perform the following block only for - * non-null d_overlap[i], why not just loop through - * box_num instead of num_fill_boxes? - */ - if (!d_overlaps[i]->isOverlapEmpty()) { + if (d_overlaps[i] && !d_overlaps[i]->isOverlapEmpty()) { boost::shared_ptr transaction; @@ -4005,26 +4678,31 @@ RefineSchedule::constructScheduleTransactions( d_transaction_factory->allocate(transaction_dst_level, d_src_level, d_overlaps[i], - transaction_dst_mapped_box, - src_mapped_box, - ritem_count); + transaction_dst_box, + src_box, + d_refine_items, + item.d_tag, + *itr, + (use_time_interpolation && item.d_time_interpolate)); } else if (use_time_interpolation && item.d_time_interpolate) { transaction.reset(new RefineTimeTransaction( transaction_dst_level, d_src_level, d_overlaps[i], - transaction_dst_mapped_box, src_mapped_box, + transaction_dst_box, src_box, *itr, - ritem_count)); + d_refine_items, + item.d_tag)); } else { // no time interpolation transaction.reset(new RefineCopyTransaction( transaction_dst_level, d_src_level, d_overlaps[i], - transaction_dst_mapped_box, src_mapped_box, - ritem_count)); + transaction_dst_box, src_box, + d_refine_items, + item.d_tag)); } // time interpolation conditional @@ -4060,534 +4738,53 @@ RefineSchedule::constructScheduleTransactions( /* ************************************************************************* * - * Private utility function that constructs schedule transactions that - * move data from source patch on source level to destination patch - * on destination level on regions defined by list of fil boxes. + * Private member function to initialize data members for hierarchy info. * ************************************************************************* */ void -RefineSchedule::constructScheduleTransactions( - const hier::Connector& dst_to_fill, - hier::Connector::ConstNeighborhoodIterator& dst_itr, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - bool use_time_interpolation) +RefineSchedule::initializeDomainAndGhostInformation() { - TBOX_ASSERT(d_dst_level); - TBOX_ASSERT(d_src_level); - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); // src absorbs the shift, if any. const tbox::Dimension& dim(d_dst_level->getDim()); - const int my_rank = d_dst_level->getBoxLevel()->getMPI().getRank(); - const hier::IntVector& constant_zero_intvector(hier::IntVector::getZero(dim)); - const hier::IntVector& constant_one_intvector(hier::IntVector::getOne(dim)); + d_max_scratch_gcw = getMaxScratchGhosts(); + d_max_stencil_width = getMaxStencilGhosts(); - if (s_extra_debug) { - tbox::plog << "RefineSchedule::constructScheduleTransactions: " << use_time_interpolation - << std::endl; - tbox::plog << " src: L" << d_src_level->getLevelNumber() - << "R" << d_src_level->getRatioToLevelZero() - << " / " << src_mapped_box << std::endl; - tbox::plog << " dst: L" << d_dst_level->getLevelNumber() - << "R" << d_dst_level->getRatioToLevelZero() - << " / " << dst_mapped_box << std::endl; - tbox::plog << " fill_boxes (" - << dst_to_fill.numLocalNeighbors(*dst_itr) << ")"; - for (hier::Connector::ConstNeighborIterator bi = dst_to_fill.begin(dst_itr); - bi != dst_to_fill.end(dst_itr); ++bi) { - tbox::plog << " " << *bi; - } - tbox::plog << std::endl; + if (d_top_refine_schedule == this) { + // Not a recursive schedule. + d_boundary_fill_ghost_width = getMaxDestinationGhosts(); + d_force_boundary_fill = false; + } else { + // Recursive schedule. + d_boundary_fill_ghost_width = d_max_stencil_width; + d_force_boundary_fill = (d_boundary_fill_ghost_width.max() > 0); } - /* - * d_src_masks and d_overlaps exist only in this method, but are - * class members instead of temporaries so that they don't - * have to be reallocated every time this method is used. - */ - int max_overlap_array_size = d_max_fill_boxes; - - if (d_src_masks.size() < max_overlap_array_size) { - for (int i = d_src_masks.size(); - i < max_overlap_array_size; ++i) { - d_src_masks.pushBack(hier::Box(dim)); - } - } - - if (d_overlaps.getSize() < max_overlap_array_size) { - d_overlaps.setNull(); - d_overlaps.resizeArray(max_overlap_array_size); - } - - boost::shared_ptr dst_patch_descriptor( - d_dst_level->getPatchDescriptor()); - boost::shared_ptr src_patch_descriptor( - d_src_level->getPatchDescriptor()); - - const hier::Box& dst_box = dst_mapped_box; -#ifdef DEBUG_CHECK_ASSERTIONS - const hier::Box& src_box = src_mapped_box; - // src_box used only in debug mode. Ifdef out in opt mode to avoid warning. -#endif - - const bool same_patch = - (d_dst_level == d_src_level && - dst_mapped_box.getGlobalId() == src_mapped_box.getGlobalId()); - const bool same_patch_no_shift = - (same_patch && !src_mapped_box.isPeriodicImage()); - - const int num_equiv_classes = - d_refine_classes->getNumberOfEquivalenceClasses(); - - const hier::PeriodicShiftCatalog* shift_catalog = - hier::PeriodicShiftCatalog::getCatalog(dim); - - /* - * Calculate the shift and the shifted source box. - */ - hier::IntVector src_shift(dim, 0); - hier::IntVector dst_shift(dim, 0); - hier::Box unshifted_src_box = src_mapped_box; - hier::Box unshifted_dst_box = dst_mapped_box; - if (src_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!dst_mapped_box.isPeriodicImage()); - src_shift = shift_catalog->shiftNumberToShiftDistance( - src_mapped_box.getPeriodicId()); - src_shift = (d_src_level->getRatioToLevelZero() > - constant_zero_intvector) ? - (src_shift * d_src_level->getRatioToLevelZero()) : - hier::IntVector::ceilingDivide(src_shift, - -d_src_level->getRatioToLevelZero()); - unshifted_src_box.shift(-src_shift); - } - if (dst_mapped_box.isPeriodicImage()) { - TBOX_ASSERT(!src_mapped_box.isPeriodicImage()); - dst_shift = shift_catalog->shiftNumberToShiftDistance( - dst_mapped_box.getPeriodicId()); - dst_shift = (d_dst_level->getRatioToLevelZero() > - constant_zero_intvector) ? - (dst_shift * d_dst_level->getRatioToLevelZero()) : - hier::IntVector::ceilingDivide(dst_shift, - -d_dst_level->getRatioToLevelZero()); - unshifted_dst_box.shift(-dst_shift); - } - if (s_extra_debug) { - tbox::plog << " src_shift: " << src_shift - << " unshifted_src_box " << unshifted_src_box << std::endl; - tbox::plog << " dst_shift: " << dst_shift - << " unshifted_dst_box " << unshifted_dst_box << std::endl; - } - - /* - * Transformation initialized to src_shift with no rotation. - * It will never be modified in single-block runs, nor in multiblock runs - * when src_mapped_box and dst_mapped_box are on the same block. - */ - hier::Transformation transformation(src_shift); - - /* - * When src_mapped_box and dst_mapped_box are on different blocks - * transformed_src_box is a representation of the source box in the - * destination coordinate system. - * - * For all other cases, transformed_src_box is simply a copy of the - * box from src_mapped_box. - */ - hier::Box transformed_src_box(src_mapped_box); - - /* - * When needed, transform the source box and determine if src and - * dst touch at an enhance connectivity singularity. - */ - bool is_singularity = false; - if (src_mapped_box.getBlockId() != dst_mapped_box.getBlockId()) { - const hier::BlockId& dst_block_id = dst_mapped_box.getBlockId(); - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); - - boost::shared_ptr grid_geometry( - d_dst_level->getGridGeometry()); - - hier::Transformation::RotationIdentifier rotation = - grid_geometry->getRotationIdentifier(dst_block_id, - src_block_id); - hier::IntVector offset( - grid_geometry->getOffset(dst_block_id, src_block_id)); - - offset *= d_dst_level->getRatioToLevelZero(); - - is_singularity = grid_geometry->areSingularityNeighbors(dst_block_id, - src_block_id); - - transformation = hier::Transformation(rotation, offset, - src_block_id, dst_block_id); - transformation.transform(transformed_src_box); - } - - /* - * For any case except when src and dst touch at enhanced connectivity, - * the transactions use d_dst_level as the destination level and - * dst_mapped_box as the destination box. For the enhanced connectivity - * case, the destination level becomes d_encon_level and the destination - * box is a member of d_encon_level. - */ - boost::shared_ptr transaction_dst_level; - hier::Box transaction_dst_mapped_box(dim); - if (is_singularity) { - - /* - * Determination of transaction_dst_mapped_box is done differently - * depending of if dst_mapped_box is local. When it is local - * (regardless of whether source is also local), the appropriate - * Box to assign to transaction_dst_mapped_box can be - * found from the d_dst_to_encon connector. - * - * If the destination is not local, then the source is, - * and d_src_to_encon is searched to fined the right member of - * d_encon_level to assign to transaction_dst_mapped_box. - */ - if (dst_mapped_box.getOwnerRank() == my_rank) { - - hier::Connector::ConstNeighborhoodIterator ei = - d_dst_to_encon.findLocal(dst_mapped_box.getId()); - - const hier::BlockId& src_block_id = src_mapped_box.getBlockId(); - - for (hier::Connector::ConstNeighborIterator en = d_dst_to_encon.begin(ei); - en != d_dst_to_encon.end(ei); ++en) { - - if (src_block_id == (*en).getBlockId()) { - TBOX_ASSERT(transaction_dst_mapped_box.empty()); - transaction_dst_mapped_box = *en; - } - } - - } else { - - TBOX_ASSERT(src_mapped_box.getOwnerRank() == my_rank); - - hier::IntVector test_gcw( - hier::IntVector::max(d_boundary_fill_ghost_width, - d_max_stencil_width)); - test_gcw.max(hier::IntVector::getOne(dim)); - - hier::Box test_dst_box(dst_mapped_box); - test_dst_box.grow(test_gcw); - - hier::Connector::ConstNeighborhoodIterator ei = - d_src_to_encon.findLocal(src_mapped_box.getId()); - - hier::BoxContainer encon_nbr_choices; - for (hier::Connector::ConstNeighborIterator ni = d_src_to_encon.begin(ei); - ni != d_src_to_encon.end(ei); ++ni) { - if ((*ni).getOwnerRank() == dst_mapped_box.getOwnerRank()) { - hier::Box encon_box(*ni); - transformation.transform(encon_box); - - if (test_dst_box.contains(encon_box)) { - encon_nbr_choices.pushBack(*ni); - } - } - } - if (encon_nbr_choices.size() == 0) { - transaction_dst_mapped_box.setEmpty(); - } else { - int max_nbr_size = 0; - for (hier::BoxContainer::iterator en(encon_nbr_choices); - en != encon_nbr_choices.end(); ++en) { - const int box_size = en->size(); - if (box_size > max_nbr_size) { - max_nbr_size = box_size; - transaction_dst_mapped_box = *en; - } - } - } - } - - transaction_dst_level = d_encon_level; - - } else { - /* - * All cases except for handling enhance connectivity neighbors - * go here to do a simple assignment. - */ - transaction_dst_level = d_dst_level; - transaction_dst_mapped_box = dst_mapped_box; - } - - for (int nc = 0; nc < num_equiv_classes; nc++) { - - const RefineClasses::Data& rep_item = - d_refine_classes->getClassRepresentative(nc); - - const int rep_item_dst_id = rep_item.d_scratch; - const int rep_item_src_id = rep_item.d_src; - - boost::shared_ptr src_pdf( - src_patch_descriptor->getPatchDataFactory(rep_item_src_id)); - boost::shared_ptr dst_pdf( - dst_patch_descriptor->getPatchDataFactory(rep_item_dst_id)); - - const hier::IntVector& dst_gcw = dst_pdf->getGhostCellWidth(); - - hier::BoxContainer::iterator box_itr(d_src_masks); - int box_num = 0; - for (hier::Connector::ConstNeighborIterator bi = dst_to_fill.begin(dst_itr); - bi != dst_to_fill.end(dst_itr); ++bi) { - - const hier::Box& fill_box = *bi; - - /* - * Get the patch data factories and calculate the overlap. - * Note that we restrict the domain of the time interpolation - * to the intersection of the fill box and the ghost box of - * the destination patch data component. This is needed for - * the case where the schedule treats data components with - * different ghost cell widths since the fill boxes are - * generated using the largest ghost width. - */ - - hier::Box dst_fill_box(dst_box); - dst_fill_box.grow(dst_gcw); - dst_fill_box = dst_fill_box * fill_box; - - boost::shared_ptr overlap; - hier::Box src_mask(dim); - if (!is_singularity) { - - /* - * Create overlap for normal cases (all but enhanced connectivity). - */ - - hier::Box test_mask(dst_fill_box * transformed_src_box); - if (test_mask.empty() && dst_pdf->dataLivesOnPatchBorder()) { - if ((dst_gcw == constant_zero_intvector) || - (dst_box.isSpatiallyEqual(fill_box))) { - - test_mask = dst_fill_box; - test_mask.grow(constant_one_intvector); - test_mask = test_mask * transformed_src_box; - - } - } - - src_mask = test_mask; - transformation.inverseTransform(src_mask); - - overlap = - rep_item.d_var_fill_pattern->calculateOverlap( - *dst_pdf->getBoxGeometry(unshifted_dst_box), - *src_pdf->getBoxGeometry(unshifted_src_box), - dst_mapped_box, - src_mask, - fill_box, - true, transformation); - } else { - - /* - * Create overlap for enhanced connectivity. This overlap - * will be used in transaction from d_src_level to d_encon_level. - */ - - hier::Box test_mask(dst_fill_box); - transformation.inverseTransform(test_mask); - test_mask = test_mask * src_mapped_box; - if (test_mask.empty() && dst_pdf->dataLivesOnPatchBorder()) { - if ((dst_gcw == constant_zero_intvector) || - (dst_box.isSpatiallyEqual(fill_box))) { - - test_mask = dst_fill_box; - test_mask.grow(constant_one_intvector); - transformation.inverseTransform(test_mask); - test_mask = test_mask * src_mapped_box; - - } - } - - src_mask = test_mask; - hier::Box transformed_fill_box(fill_box); - hier::Box transformed_dst_box(dst_mapped_box); - transformation.inverseTransform(transformed_fill_box); - transformation.inverseTransform(transformed_dst_box); - - overlap = - rep_item.d_var_fill_pattern->calculateOverlap( - *dst_pdf->getBoxGeometry(transaction_dst_mapped_box), - *src_pdf->getBoxGeometry(unshifted_src_box), - transformed_dst_box, - src_mask, - transformed_fill_box, - true, hier::Transformation(hier::IntVector::getZero(dim))); - } - -#ifdef DEBUG_CHECK_ASSERTIONS - if (!overlap) { - TBOX_ERROR("Internal RefineSchedule error..." - << "\n Overlap is NULL for " - << "\n src box = " << src_box - << "\n dst box = " << dst_box - << "\n src mask = " << src_mask << std::endl); - } -#endif - - if (s_extra_debug) { - tbox::plog << " overlap: "; - overlap->print(tbox::plog); - } - *box_itr = src_mask; - d_overlaps[box_num] = overlap; - box_num++; - ++box_itr; - - } - - /* - * Iterate over components in refine description list - */ - for (std::list::iterator l(d_refine_classes->getIterator(nc)); - l != d_refine_classes->getIteratorEnd(nc); l++) { - const RefineClasses::Data& item = d_refine_classes->getRefineItem(*l); - TBOX_ASSERT(item.d_class_index == nc); - - const int dst_id = item.d_scratch; - const int src_id = item.d_src; - const int ritem_count = item.d_tag; - - /* - * If the src and dst patches, levels, and components are the - * same, and there is no shift, the data exchange is unnecessary. - */ - if (!same_patch_no_shift || (dst_id != src_id)) { - - /* - * Iterate over the fill boxes and create transactions - * for each box that has a non-empty overlap. - */ - hier::BoxContainer::iterator itr(d_src_masks); - for (int i = 0; i < box_num; i++, ++itr) { - - /* - * If overlap is not empty, then add the transaction - * to the appropriate communication schedule. - * There are two schedules depending on whether - * coarse or fine data takes precedence at - * coarse-fine boundaries for communications - * where the destination variable quantity - * has data residing on the boundary. - * There are two types of transactions depending on - * whether we use time interpolation. - */ - - /* - * If we only perform the following block only for - * non-null d_overlap[i], why not just loop through - * box_num instead of num_fill_boxes? - */ - if (!d_overlaps[i]->isOverlapEmpty()) { - - boost::shared_ptr transaction; - - if (d_transaction_factory) { - - transaction = - d_transaction_factory->allocate(transaction_dst_level, - d_src_level, - d_overlaps[i], - transaction_dst_mapped_box, - src_mapped_box, - ritem_count); - } else if (use_time_interpolation && - item.d_time_interpolate) { - - transaction.reset(new RefineTimeTransaction( - transaction_dst_level, d_src_level, - d_overlaps[i], - transaction_dst_mapped_box, src_mapped_box, - *itr, - ritem_count)); - - } else { // no time interpolation - - transaction.reset(new RefineCopyTransaction( - transaction_dst_level, d_src_level, - d_overlaps[i], - transaction_dst_mapped_box, src_mapped_box, - ritem_count)); - - } // time interpolation conditional - - if (item.d_fine_bdry_reps_var) { - if (same_patch) { - d_fine_priority_level_schedule->addTransaction( - transaction); - } else { - d_fine_priority_level_schedule->appendTransaction( - transaction); - } - } else { - if (same_patch) { - d_coarse_priority_level_schedule->addTransaction( - transaction); - } else { - d_coarse_priority_level_schedule->appendTransaction( - transaction); - } - } - - } // if overlap not empty - - } // iterate over fill_boxes - - } - - } // iterate over refine components in equivalence class - - } // iterate over refine equivalence classes -} - -/* - ************************************************************************* - * - * Private member function to initialize data members for hierarchy info. - * - ************************************************************************* - */ - -void -RefineSchedule::initializeDomainAndGhostInformation( - bool recursive_schedule) -{ - - const tbox::Dimension& dim(d_dst_level->getDim()); - - d_max_scratch_gcw = getMaxScratchGhosts(); - d_max_stencil_width = getMaxStencilGhosts(); - - if (recursive_schedule) { - d_boundary_fill_ghost_width = d_max_stencil_width; - d_force_boundary_fill = (d_boundary_fill_ghost_width.max() > 0); - } else { - d_boundary_fill_ghost_width = getMaxDestinationGhosts(); - d_force_boundary_fill = false; - } + d_data_on_patch_border_flag = getDataOnPatchBorderFlag(); boost::shared_ptr grid_geom( d_dst_level->getGridGeometry()); const hier::IntVector& ratio_to_level_zero = d_dst_level->getRatioToLevelZero(); - for (int b = 0; b < grid_geom->getNumberBlocks(); b++) { + for (hier::BlockId::block_t b = 0; b < grid_geom->getNumberBlocks(); ++b) { d_domain_is_one_box[b] = grid_geom->getDomainIsSingleBox(hier::BlockId(b)); } - d_periodic_shift = grid_geom->getPeriodicShift(ratio_to_level_zero); + if (grid_geom->getNumberBlocks() > 1) { + d_periodic_shift = hier::IntVector::getZero(dim); + } else { + d_periodic_shift = + grid_geom->getPeriodicShift( + ratio_to_level_zero); + } d_num_periodic_directions = 0; - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { if (d_periodic_shift(d)) { - d_num_periodic_directions++; + ++d_num_periodic_directions; } } @@ -4607,18 +4804,20 @@ RefineSchedule::setRefineItems( { clearRefineItems(); + TBOX_ASSERT(d_number_refine_items == 0); d_refine_classes = refine_classes; d_number_refine_items = d_refine_classes->getNumberOfRefineItems(); - d_refine_items = new const RefineClasses::Data *[d_number_refine_items]; + if (!d_refine_items) { + d_refine_items = + new const RefineClasses::Data *[d_number_refine_items]; + } - int ircount = 0; - for (int nd = 0; nd < d_number_refine_items; nd++) { - d_refine_classes->getRefineItem(nd).d_tag = ircount; - d_refine_items[ircount] = &(d_refine_classes->getRefineItem(nd)); - ircount++; + for (int nd = 0; nd < static_cast(d_number_refine_items); ++nd) { + d_refine_classes->getRefineItem(nd).d_tag = nd; + d_refine_items[nd] = &(d_refine_classes->getRefineItem(nd)); } } @@ -4631,7 +4830,7 @@ RefineSchedule::setRefineItems( * In particular, each scratch data entry must have at least as many * ghost cells as the user-defined refine operator stencil width. * Other checks are performed in the - * xfer::RefineClasses::itemIsValid() routine. + * RefineClasses::itemIsValid() routine. * ************************************************************************* */ @@ -4649,12 +4848,12 @@ RefineSchedule::initialCheckRefineClassItems() const hier::IntVector user_gcw(constant_zero_intvector); if (d_refine_patch_strategy) { - user_gcw = d_refine_patch_strategy->getRefineOpStencilWidth(); + user_gcw = d_refine_patch_strategy->getRefineOpStencilWidth(dim); } if (user_gcw > constant_zero_intvector) { - for (int iri = 0; iri < d_number_refine_items; iri++) { + for (size_t iri = 0; iri < d_number_refine_items; ++iri) { const RefineClasses::Data * const ref_item = d_refine_items[iri]; @@ -4697,15 +4896,35 @@ void RefineSchedule::clearRefineItems() { if (d_refine_items) { - for (int iri = 0; iri < d_number_refine_items; iri++) { - d_refine_items[iri] = (RefineClasses::Data *)NULL; + for (size_t ici = 0; ici < d_number_refine_items; ++ici) { + d_refine_items[ici] = 0; } - delete[] d_refine_items; - d_refine_items = (const RefineClasses::Data **)NULL; d_number_refine_items = 0; } } +/* + ************************************************************************** + ************************************************************************** + */ + +void +RefineSchedule::setDeterministicUnpackOrderingFlag(bool flag) +{ + if (d_coarse_priority_level_schedule) { + d_coarse_priority_level_schedule->setDeterministicUnpackOrderingFlag(flag); + } + if (d_fine_priority_level_schedule) { + d_fine_priority_level_schedule->setDeterministicUnpackOrderingFlag(flag); + } + if (d_coarse_interp_schedule) { + d_coarse_interp_schedule->setDeterministicUnpackOrderingFlag(flag); + } + if (d_coarse_interp_encon_schedule) { + d_coarse_interp_encon_schedule->setDeterministicUnpackOrderingFlag(flag); + } +} + /* ************************************************************************** * @@ -4735,7 +4954,6 @@ RefineSchedule::printClassData( } } - /* ************************************************************************** ************************************************************************** @@ -4744,21 +4962,18 @@ RefineSchedule::printClassData( void RefineSchedule::initializeCallback() { - boost::shared_ptr idb( - tbox::InputManager::getInputDatabase()); - if (idb && idb->isDatabase("RefineSchedule")) { - boost::shared_ptr rsdb( - idb->getDatabase("RefineSchedule")); - s_extra_debug = - rsdb->getBoolWithDefault("extra_debug", s_extra_debug); - s_barrier_and_time = - rsdb->getBoolWithDefault("barrier_and_time", s_barrier_and_time); - } - + t_refine_schedule = tbox::TimerManager::getManager()-> + getTimer("xfer::RefineSchedule::RefineSchedule()"); t_fill_data = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::fillData()"); - t_recursive_fill = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::recursive_fill"); + t_fill_data_nonrecursive = tbox::TimerManager::getManager()-> + getTimer("xfer::RefineSchedule::fillData()_nonrecursive"); + t_fill_data_recursive = tbox::TimerManager::getManager()-> + getTimer("xfer::RefineSchedule::fillData()_recursive"); + t_fill_physical_boundaries = tbox::TimerManager::getManager()-> + getTimer("xfer::RefineSchedule::fillPhysicalBoundaries()"); + t_fill_singularity_boundaries = tbox::TimerManager::getManager()-> + getTimer("xfer::RefineSchedule::fillSingularityBoundaries()"); t_refine_scratch_data = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::refineScratchData()"); t_finish_sched_const = tbox::TimerManager::getManager()-> @@ -4767,35 +4982,19 @@ RefineSchedule::initializeCallback() getTimer("xfer::RefineSchedule::finishScheduleConstruction()_recurse"); t_gen_comm_sched = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::generateCommunicationSchedule()"); - t_bridge_connector = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::bridge_connector"); - t_modify_connector = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::modify_connector"); - t_make_seq_map = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::make_seq_map"); t_shear = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::finish...()_shear"); - t_misc1 = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::finish...()_misc1"); - t_barrier_and_time = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::barrier_and_time"); - t_get_global_mapped_box_count = tbox::TimerManager::getManager()-> + t_get_global_box_count = tbox::TimerManager::getManager()-> getTimer( - "xfer::RefineSchedule::finish...()_get_global_mapped_box_count"); + "xfer::RefineSchedule::finish...()_get_global_box_count"); t_coarse_shear = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::finish...()_coarse_shear"); - t_setup_coarse_interp_mapped_box_level = tbox::TimerManager::getManager()-> + t_setup_coarse_interp_box_level = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::setupCoarseInterpBoxLevel()"); - t_misc2 = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::finish...()_misc2"); t_bridge_coarse_interp_hiercoarse = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::finish...()_bridge_coarse_interp_hiercoarse"); t_bridge_dst_hiercoarse = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::finish...()_bridge_dst_hiercoarse"); - t_make_coarse_interp_level = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::finish...()_make_coarse_interp_level"); - t_make_coarse_interp_to_unfilled = tbox::TimerManager::getManager()-> - getTimer("xfer::RefineSchedule::finish...()_make_coarse_interp_to_unfilled"); t_invert_edges = tbox::TimerManager::getManager()-> getTimer("xfer::RefineSchedule::generate...()_invert_edges"); t_construct_send_trans = tbox::TimerManager::getManager()-> @@ -4815,25 +5014,18 @@ void RefineSchedule::finalizeCallback() { t_fill_data.reset(); - t_recursive_fill.reset(); + t_fill_data_nonrecursive.reset(); + t_fill_data_recursive.reset(); t_refine_scratch_data.reset(); t_finish_sched_const.reset(); t_finish_sched_const_recurse.reset(); t_gen_comm_sched.reset(); - t_bridge_connector.reset(); - t_modify_connector.reset(); - t_make_seq_map.reset(); t_shear.reset(); - t_misc1.reset(); - t_barrier_and_time.reset(); - t_get_global_mapped_box_count.reset(); + t_get_global_box_count.reset(); t_coarse_shear.reset(); - t_setup_coarse_interp_mapped_box_level.reset(); - t_misc2.reset(); + t_setup_coarse_interp_box_level.reset(); t_bridge_coarse_interp_hiercoarse.reset(); t_bridge_dst_hiercoarse.reset(); - t_make_coarse_interp_level.reset(); - t_make_coarse_interp_to_unfilled.reset(); t_invert_edges.reset(); t_construct_send_trans.reset(); t_construct_recv_trans.reset(); @@ -4849,5 +5041,3 @@ RefineSchedule::finalizeCallback() #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.h index 34811310..122c5361 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineSchedule.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Refine schedule for data transfer between AMR levels * ************************************************************************/ @@ -17,15 +17,15 @@ #include "SAMRAI/xfer/RefineClasses.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" #include "SAMRAI/xfer/RefineTransactionFactory.h" +#include "SAMRAI/xfer/SingularityPatchStrategy.h" #include "SAMRAI/hier/ComponentSelector.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Schedule.h" #include "SAMRAI/tbox/Timer.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -62,9 +62,9 @@ namespace xfer { * - @c PatchLevelBorderAndInteriorFillPattern - Fill interior and * ghosts on level borders. * - * @see xfer::RefineAlgorithm - * @see xfer::RefinePatchStrategy - * @see xfer::RefineClasses + * @see RefineAlgorithm + * @see RefinePatchStrategy + * @see RefineClasses */ class RefineSchedule @@ -86,10 +86,6 @@ class RefineSchedule * to be in the same AMR patch hierarchy. Generally, this * constructor is called by a RefineAlgorithm object. * - * When assertion checking is active, unrecoverable assertions will result - * if either patch level pointer, the refine classes pointer, or the - * transaction factory factory pointer is null. - * * @param[in] dst_level_fill_pattern Indicates which parts of the * destination level to fill. * @param[in] dst_level boost::shared_ptr to destination patch level. @@ -100,15 +96,25 @@ class RefineSchedule * RefineAlgorithm object. * @param[in] transaction_factory boost::shared_ptr to a factory object * that will create data transactions. - * @param[in] patch_strategy boost::shared_ptr to a refine patch strategy + * @param[in] patch_strategy Pointer to a refine patch strategy * object that provides user-defined physical * boundary filling operations. This pointer * may be null, in which case no boundary filling - * operations will occur. + * operations will occur. If your mesh has a + * singularity, the object this points to should + * have also inherited from + * SingularityPatchStrategy. * @param[in] use_time_interpolation Boolean flag indicating whether to * use time interpolation when setting * data on the destination level. * Default is no time interpolation. + * + * @pre dst_level + * @pre src_level + * @pre refine_classes + * @pre transaction_factory + * @pre dst_level->getDim() == src_level->getDim() + * @pre dst_level->getGridGeometry()->getNumberOfBlockSingularities() == 0 || d_singularity_patch_strategy */ RefineSchedule( const boost::shared_ptr& dst_level_fill_pattern, @@ -116,7 +122,7 @@ class RefineSchedule const boost::shared_ptr& src_level, const boost::shared_ptr& refine_classes, const boost::shared_ptr& transaction_factory, - RefinePatchStrategy * patch_strategy, + RefinePatchStrategy* patch_strategy, bool use_time_interpolation = false); /*! @@ -135,10 +141,6 @@ class RefineSchedule * However, the levels do not have to be in the same AMR patch hierarchy. * In general, this constructor is called by a RefineAlgorithm object. * - * When assertion checking is active, unrecoverable assertions will result - * if either patch level pointer, the refine classes pointer, or the - * transaction factory factory pointer is null. - * * @param[in] dst_level_fill_pattern Indicates which parts of the * destination level to fill. * @param[in] dst_level boost::shared_ptr to destination patch level. @@ -166,15 +168,25 @@ class RefineSchedule * RefineAlgorithm object. * @param[in] transaction_factory boost::shared_ptr to a factory object * that will create data transactions. - * @param[in] patch_strategy boost::shared_ptr to a refine patch strategy + * @param[in] patch_strategy Pointer to a refine patch strategy * object that provides user-defined physical * boundary filling operations. This pointer * may be null, in which case no boundary filling * or user-defined refine operations will occur. + * If your mesh has a singularity, the object + * this points to should have also inherited + * from SingularityPatchStrategy. * @param[in] use_time_refinement Boolean flag indicating whether to use * time interpolation when setting data * on the destination level. Default * is no time interpolation. + * + * @pre dst_level + * @pre (next_coarser_level == -1) || hierarchy + * @pre refine_classes + * @pre !src_level || (dst_level->getDim() == src_level.getDim()) + * @pre !hierarchy || (dst_level->getDim() == hierarchy.getDim()) + * @pre dst_level->getGridGeometry()->getNumberOfBlockSingularities() == 0 || d_singularity_patch_strategy */ RefineSchedule( const boost::shared_ptr& dst_level_fill_pattern, @@ -184,7 +196,7 @@ class RefineSchedule const boost::shared_ptr& hierarchy, const boost::shared_ptr& refine_classes, const boost::shared_ptr& transaction_factory, - RefinePatchStrategy * patch_strategy, + RefinePatchStrategy* patch_strategy, bool use_time_refinement = false); /*! @@ -205,6 +217,8 @@ class RefineSchedule * general, this is constructed by the calling * RefineAlgorithm object. This pointer must be * non-null. + * + * @pre refine_classes */ void reset( @@ -235,72 +249,6 @@ class RefineSchedule double fill_time, bool do_physical_boundary_fill = true) const; - /*! - * @brief Initialize a component selector to store the components - * needed to allocate source data. - * - * @param[out] allocate_vector ComponentSelector that will be - * set to contain the patch data indices for - * source data. - */ - void - initializeSourceVector( - hier::ComponentSelector& allocate_vector) const - { - allocate_vector.clrAllFlags(); - for (int iri = 0; iri < d_number_refine_items; iri++) { - allocate_vector.setFlag(d_refine_items[iri]->d_src); - } - } - - /*! - * @brief Allocate destination space on the destination level and store the - * allocated patch data indices in the component selector for later - * deallocation. - * - * @param[out] allocate_vector Component selector that will store the - * allocated patch data indices. - * @param[in] fill_time Simulation time for filling operation. - */ - void - allocateDestinationSpace( - hier::ComponentSelector& allocate_vector, - double fill_time) const; - - /*! - * @brief Allocate scratch space on the specified level and store the - * allocated patch data indices in the component selector for later - * deallocation. - * - * @param[in,out] level - * @param[in] fill_time Simulation time for filling operation. - * @param[out] allocate_vector Component selector that will store the - * allocated patch data indices. - */ - void - allocateScratchSpace( - hier::ComponentSelector& allocate_vector, - const boost::shared_ptr& level, - double fill_time) const; - - /*! - * @brief Initialize a component selector to store the components needed to - * allocate destination data. - * - * @param[out] allocate_vector An empty ComponentSelector that will be - * set to contain the patch data indices for - * destination data. - */ - void - initializeDestinationVector( - hier::ComponentSelector& allocate_vector) const - { - allocate_vector.clrAllFlags(); - for (int iri = 0; iri < d_number_refine_items; iri++) { - allocate_vector.setFlag(d_refine_items[iri]->d_dst); - } - } - /*! * @brief Return refine equivalence classes. * @@ -313,14 +261,18 @@ class RefineSchedule } /*! - * @brief Return width of ghost cell region to fill which is passed to user - * supplied physical boundary condition routine. + * @brief Set whether to unpack messages in a deterministic order. + * + * By default message unpacking is ordered by receive time, which + * is not deterministic. If your results are dependent on unpack + * ordering and you want deterministic results, set this flag to + * true. + * + * @param [in] flag */ - const hier::IntVector& - getBoundaryFillGhostWidth() const - { - return d_boundary_fill_ghost_width; - } + void + setDeterministicUnpackOrderingFlag( + bool flag); /*! * @brief Print the refine schedule data to the specified data stream. @@ -339,9 +291,9 @@ class RefineSchedule RefineSchedule( const RefineSchedule&); // not implemented - void + RefineSchedule& operator = ( - const RefineSchedule&); // not implemented + const RefineSchedule&); // not implemented /*! * @brief Allocate static timers. @@ -359,14 +311,6 @@ class RefineSchedule static void finalizeCallback(); - //! @brief Shorthand typedef. - typedef hier::LocalId LocalId; - //! @brief Shorthand typedef. - typedef hier::BoxLevel BoxLevel; - //! @brief Shorthand typedef. - typedef hier::Connector Connector; - //! @brief Shorthand typedef. - typedef hier::BoxNeighborhoodCollection BoxNeighborhoodCollection; //! @brief Mapping from a (potentially remote) Box to a set of neighbors. typedef std::map FullNeighborhoodSet; @@ -378,6 +322,7 @@ class RefineSchedule * This constructor is used by the refine schedule algorithm during the * recursive schedule generation process. * + * @param[out] errf Error flag * @param[in] dst_level A temporary level that is used during * interpolation. * @param[in] src_level A level from the hierarchy that is of the @@ -389,6 +334,7 @@ class RefineSchedule * the coarsest level), this value should be * less than zero. * @param[in] hierarchy boost::shared_ptr to patch hierarchy. + * @param[in] dst_to_src * @param[in] src_growth_to_nest_dst The minimum amount that src_level has * to grow in order to nest dst. * @param[in] refine_classes Holds refine equivalence classes to be used @@ -400,18 +346,36 @@ class RefineSchedule * boundary filling operations. This pointer * may be null, in which case no boundary filling * or user-defined refine operations will occur. + * @param[in] top_refine_schedule + * + * @pre dst_level + * @pre src_level + * @pre (next_coarser_level == -1) || hierarchy + * @pre dst_to_src.hasTranspose() + * @pre refine_classes + * @pre dst_level->getDim() == src_level.getDim() + * @pre !hierarchy || (dst_level->getDim() == hierarchy.getDim()) + * @pre dst_to_src.getBase() == *dst_level->getBoxLevel() + * @pre src_to_dst.getHead() == *dst_level->getBoxLevel() */ RefineSchedule( + int& errf, const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, int next_coarser_level, const boost::shared_ptr& hierarchy, const hier::Connector& dst_to_src, - const hier::Connector& src_to_dst, const hier::IntVector& src_growth_to_nest_dst, const boost::shared_ptr& refine_classes, const boost::shared_ptr& transaction_factory, - RefinePatchStrategy* patch_strategy); + RefinePatchStrategy* patch_strategy, + const RefineSchedule* top_refine_schedule); + + /*! + * @brief Read static data from input database. + */ + void + getFromInput(); /*! * @brief Finish the schedule construction for the two constructors @@ -420,18 +384,15 @@ class RefineSchedule * The hierarchy gives the possibility of recursion to get data from * coarser levels. * + * Returns an error flag: + * - 0: No error. + * - 1: Internal error due to unfilled boxes without coarser level. + * - 2: Internal error due to unfilled boxes without hierarchy. + * * @param[in] next_coarser_ln Level number of the level coarser than * the destination level * @param[in] hierarchy A patch hierarchy to be used to provide coarser * levels that may be used for interpolation. - * @param[in] dst_to_src Connector between dst and src levels given - * in constructor. - * @param[in] src_to_dst Connector between src and dst levels given - * in constructor. - * @param[in] dst_is_coarse_interp_level Tells if the destination level - * is a temporary coarse - * interpolation level used for - * interpolation. * @param[in] src_growth_to_nest_dst The minimum amount that the source * level has to grow in order to nest the * destination level. @@ -449,20 +410,46 @@ class RefineSchedule * transactions to communicate from * source level to destination level * will be skipped. + * + * @pre d_dst_to_src + * @pre d_dst_to_src->hasTranspose() + * @pre (next_coarser_ln == -1) || hierarchy + * @pre !d_src_level || d_dst_to_src->isFinalized() + * @return error flag */ - void + int finishScheduleConstruction( int next_coarser_ln, const boost::shared_ptr& hierarchy, - const Connector& dst_to_src, - const Connector& src_to_dst, - const bool dst_is_coarse_interp_level, const hier::IntVector& src_growth_to_nest_dst, - const Connector& dst_to_fill, - const BoxNeighborhoodCollection& src_owner_dst_to_fill, + const hier::Connector& dst_to_fill, + const hier::BoxNeighborhoodCollection& src_owner_dst_to_fill, bool use_time_interpolation, bool skip_generate_schedule = false); + /*! + * @brief Allocate scratch space on the specified level and store the + * allocated patch data indices in the component selector for later + * deallocation. + * + * @param[out] allocate_vector Component selector that will store the + * allocated patch data indices. + * @param[in,out] level + * @param[in] fill_time Simulation time for filling operation. + * + * @pre level + */ + void + allocateScratchSpace( + hier::ComponentSelector& allocate_vector, + const boost::shared_ptr& level, + double fill_time) const; + void + allocateDestinationSpace( + hier::ComponentSelector& allocate_vector, + const boost::shared_ptr& level, + double fill_time) const; + /*! * @brief Recursively fill the destination level with data at the * given time. @@ -485,6 +472,8 @@ class RefineSchedule * @brief Fill the physical boundaries for each patch on d_dst_level. * * @param[in] fill_time Simulation time when the fill takes place + * + * @pre d_dst_level */ void fillPhysicalBoundaries( @@ -499,6 +488,8 @@ class RefineSchedule * * If the scratch and destination patch data components are the same, * then no copying is performed. + * + * @pre d_dst_level */ void copyScratchToDestination() const; @@ -511,14 +502,15 @@ class RefineSchedule * @param[in] coarse_to_fine Connector coarse to fine * @param[in] coarse_to_unfilled Connector coarse to level representing * boxes that need to be filled. + * @param[in] overlaps */ void refineScratchData( const boost::shared_ptr& fine_level, const boost::shared_ptr& coarse_level, - const Connector& coarse_to_fine, - const Connector& coarse_to_unfilled, - const std::list > >& + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled, + const std::vector > >& overlaps) const; /*! @@ -527,11 +519,11 @@ class RefineSchedule */ void computeRefineOverlaps( - std::list > >& overlaps, + std::vector > >& overlaps, const boost::shared_ptr& fine_level, const boost::shared_ptr& coarse_level, - const Connector& coarse_to_fine, - const Connector& coarse_to_unfilled); + const hier::Connector& coarse_to_fine, + const hier::Connector& coarse_to_unfilled); /*! * @brief Constructs the transactions for all communication and copying @@ -540,13 +532,13 @@ class RefineSchedule * The resulting transactions will only fill the regions of intersection * between the fill level, which is "head" level that the Connector * dst_to_fill points to, and the source level. The remaining - * box regions are added to unfilled_mapped_box_level. + * box regions are added to unfilled_box_level. * - * @param[out] unfilled_mapped_box_level The parts of the fill level + * @param[out] unfilled_box_level The parts of the fill level * that cannot be filled from * the source level are added here. * @param[out] dst_to_unfilled Connector from dst_level to - * unfilled_mapped_box_level. + * unfilled_box_level. * @param[out] unfilled_encon_box_level The parts of the fill level * at enhanced connectivity block * boundaries that cannot be filled @@ -555,10 +547,6 @@ class RefineSchedule * enhanced connectivity on the * destination level to * unfilled_encon_box_level - * @param[in] dst_to_src Connector between dst_level and src_level - * passed into the constructor - * @param[in] src_to_dst Connector between src_level and dst_level - * passed into the constructor * @param[in] dst_to_fill Connector between dst_level and a level * representing the boxes that need to be filled. * @param[in] src_owner_dst_to_fill A BoxNeighborhoodCollection that maps @@ -569,17 +557,20 @@ class RefineSchedule * @param[in] use_time_interpolation Boolean flag indicating whether to * use time interpolation when setting * data on the destination level. + * + * @param[in] create_transactions + * + * @pre d_dst_to_src + * @pre d_dst_to_src->hasTranspose() */ void generateCommunicationSchedule( - boost::shared_ptr& unfilled_mapped_box_level, - boost::shared_ptr& dst_to_unfilled, - boost::shared_ptr& unfilled_encon_box_level, - boost::shared_ptr& encon_to_unfilled_encon, - const Connector& dst_to_src, - const Connector& src_to_dst, - const Connector& dst_to_fill, - const BoxNeighborhoodCollection& src_owner_dst_to_fill, + boost::shared_ptr& unfilled_box_level, + boost::shared_ptr& dst_to_unfilled, + boost::shared_ptr& unfilled_encon_box_level, + boost::shared_ptr& encon_to_unfilled_encon, + const hier::Connector& dst_to_fill, + const hier::BoxNeighborhoodCollection& src_owner_dst_to_fill, const bool use_time_interpolation, const bool create_transactions); @@ -587,39 +578,35 @@ class RefineSchedule * @brief Compute boxes that need to be filled and data associated with * them. * - * fill_mapped_box_level will be filled with mapped boxes representing all + * fill_box_level will be filled with boxes representing all * of the regions intended to be filled by the schedule. It will include - * the boxes of dst_mapped_box_level grown by ill_gcw, but then can be + * the boxes of dst_box_level grown by ill_gcw, but then can be * restricted based on the PatchLevelFillPattern given to the schedule * constructor. This method sets up this fill level, as well as a * connector from the destination level to the fill level, and also provides - * a mapping from each source mapped box to the boxes they can fill + * a mapping from each source box to the boxes they can fill * on the fill level. * - * @param[out] fill_mapped_box_level Will contain all boxes that need to - * be filled. - * @param[out] dst_to_fill Connector from dst_level to - * fill_mapped_box_level. + * @param[out] fill_box_level Will contain all boxes that need to + * be filled. + * @param[out] dst_to_fill Connector from dst_level to fill_box_level. * @param[out] src_owner_dst_to_fill A BoxNeighborhoodCollection that maps * each local box on the source level to * a collection of boxes that indicates - * what parts of fill_mapped_box_level + * what parts of fill_box_level * can be filled by that source box. - * @param[in] dst_mapped_box_level Mapped box representation of the - * dst_level given to the constructor. - * @param[in] dst_to_src Connector from dst_level to src_level. - * @param[in] src_to_dst Connector from src_level to dst_level. - * @param[in] fill_gcw Maximum ghost width to be filled by the schedule. + * + * @pre (d_dst_level->getDim() == dst_box_level.getDim()) && + * (d_dst_level->getDim() == fill_ghost_width.getDim()) + * + * @pre d_dst_to_src + * @pre d_dst_to_src->hasTranspose() */ void setDefaultFillBoxLevel( - BoxLevel& fill_mapped_box_level, - Connector& dst_to_fill, - BoxNeighborhoodCollection& src_owner_dst_to_fill, - const hier::BoxLevel& dst_mapped_box_level, - const hier::Connector* dst_to_src, - const hier::Connector* src_to_dst, - const hier::IntVector& fill_gcw); + boost::shared_ptr& fill_box_level, + boost::shared_ptr& dst_to_fill, + hier::BoxNeighborhoodCollection& src_owner_dst_to_fill); /* * @brief Set up level to represent ghost regions at enhanced @@ -641,6 +628,8 @@ class RefineSchedule * @param[out] encon_fill_boxes * @param[in] fill_boxes_list * @param[in] dst_block_id + * + * @pre encon_fill_boxes.empty() */ void findEnconFillBoxes( @@ -656,7 +645,7 @@ class RefineSchedule * level_encon_unfilled_boxes, and edges are added to * encon_to_unfilled_encon_nbrhood_set. * - * The source level is the head level from the connector dst_to_src. + * The source level is the head level from the connector d_dst_to_src. * * @param[out] unfilled_encon_box_level encon unfilled boxes for the dst * level @@ -664,17 +653,17 @@ class RefineSchedule * level_encon_unfilled_boxes * @param[in,out] last_unfilled_local_id a unique LocalId not already * used in level_encon_unfilled_boxes - * @param[in] dst_mapped_box The destination box - * @param[in] dst_to_src + * @param[in] dst_box The destination box * @param[in] encon_fill_boxes + * + * @pre d_dst_to_src */ void findEnconUnfilledBoxes( const boost::shared_ptr& unfilled_encon_box_level, const boost::shared_ptr& encon_to_unfilled_encon, hier::LocalId& last_unfilled_local_id, - const hier::Box& dst_mapped_box, - const Connector& dst_to_src, + const hier::Box& dst_box, const hier::BoxContainer& encon_fill_boxes); /* @@ -684,7 +673,6 @@ class RefineSchedule * @param[in] hierarchy The patch hierarchy * @param[in] hiercoarse_level Level on hierarchy one level coarser than * the destination level - * @param[in] dst_is_coarse_interp_level * @param[in] src_growth_to_nest_dst * @param[in] encon_to_unfilled_encon */ @@ -692,7 +680,6 @@ class RefineSchedule createEnconFillSchedule( const boost::shared_ptr& hierarchy, const boost::shared_ptr& hiercoarse_level, - const bool dst_is_coarse_interp_level, const hier::IntVector& src_growth_to_nest_dst, const hier::Connector& encon_to_unfilled_encon); @@ -703,19 +690,18 @@ class RefineSchedule * @param[out] src_owner_dst_to_fill A BoxNeighborhoodCollection that maps * each local box on the source level to * a collection of boxes that indicates - * what parts of fill_mapped_box_level + * what parts of fill_box_level * can be filled by that source box. * @param[in] dst_to_fill Mapping from the dst_level to boxes it needs * need to have filled. - * @param[in] dst_to_src Mapping from the dst_level to src_level - * @param[in] src_to_dst Mapping from the src_level to dst_level + * + * @pre d_dst_to_src + * @pre d_dst_to_src->hasTranspose() */ void communicateFillBoxes( - BoxNeighborhoodCollection& src_owner_dst_to_fill, - const Connector& dst_to_fill, - const Connector& dst_to_src, - const Connector& src_to_dst); + hier::BoxNeighborhoodCollection& src_owner_dst_to_fill, + const hier::Connector& dst_to_fill); /*! * @brief Shear off parts of unfilled boxes that lie outside non-periodic @@ -724,6 +710,8 @@ class RefineSchedule * @param[in,out] unfilled * * @param[in,out] dst_to_unfilled + * + * @param[in] hierarchy */ void shearUnfilledBoxesOutsideNonperiodicBoundaries( @@ -731,34 +719,48 @@ class RefineSchedule hier::Connector& dst_to_unfilled, const boost::shared_ptr& hierarchy); + /*! + * @brief make an unfilled box level consisting of node-centered boxes + * + * When this is called, there already exists a cell-centered unfilled + * box level, which is the first argument passed in here. + * This method creates a node-centered unfilled box level, consisting of + * the boxes in the cell-centered unfilled level converted to a node + * centering, with any nodes that can be filled by this schedule's source + * level removed. + * + * @param[in] unfilled_box_level Cell-centered unfilled level + * @param[in] dst_to_unfiled Connector from destination to unfilled + */ + void + makeNodeCenteredUnfilledBoxLevel( + const hier::BoxLevel& unfilled_box_level, + const hier::Connector& dst_to_unfilled); + /*! * @brief Set up a coarse interpolation BoxLevel and related data. * * Also sets up dst_to_coarse_interp, coarse_interp_to_dst and * coarse_interp_to_unfilled. * - * @param[out] coarse_interp_mapped_box_level + * @param[out] coarse_interp_box_level * * @param[out] dst_to_coarse_interp * - * @param[out] coarse_interp_to_dst - * * @param[out] coarse_interp_to_unfilled * - * @param[in] hiercoarse_mapped_box_level The BoxLevel on the - * hierarchy at the resolution that coarse_interp_mapped_box_level is to - * have. + * @param[in] hiercoarse_box_level The BoxLevel on the + * hierarchy at the resolution that coarse_interp_box_level is to have. * * @param[in] dst_to_unfilled */ void setupCoarseInterpBoxLevel( - hier::BoxLevel &coarse_interp_mapped_box_level, - hier::Connector &dst_to_coarse_interp, - hier::Connector &coarse_interp_to_dst, - hier::Connector &coarse_interp_to_unfilled, - const hier::BoxLevel &hiercoarse_mapped_box_level, - const hier::Connector &dst_to_unfilled); + boost::shared_ptr& coarse_interp_box_level, + boost::shared_ptr& dst_to_coarse_interp, + boost::shared_ptr& coarse_interp_to_unfilled, + const hier::BoxLevel& hiercoarse_box_level, + const hier::Connector& dst_to_unfilled); /*! * @brief Create a coarse interpolation PatchLevel and compute the @@ -767,44 +769,35 @@ class RefineSchedule * * @param[out] coarse_interp_level * - * @param[in,out] coarse_interp_mapped_box_level This method will add - * periodic images to coarse_interp_mapped_box_level, if needed. - * - * @param[in] hierarchy + * @param[in,out] coarse_interp_box_level This method will add + * periodic images to coarse_interp_box_level, if needed. * * @param[in] coarse_interp_to_hiercoarse * - * @param[in] hiercoarse_to_coarse_interp - * * @param[in] next_coarser_ln Level number of hiercoarse (the * coarser level on the hierarchy * - * @param[in] dst_to_src - * - * @param[in] src_to_dst + * @param[in] hierarchy * - * @param[in] coarse_interp_to_dst + * @param[in] dst_to_src * * @param[in] dst_to_coarse_interp * * @param[in] dst_level * - * @param[in] dst_is_coarse_interp_level + * @pre dst_to_src.hasTranspose() + * @pre dst_to_coarse_interp.hasTranspose() */ void createCoarseInterpPatchLevel( boost::shared_ptr& coarse_interp_level, - hier::BoxLevel& coarse_interp_mapped_box_level, - hier::Connector &coarse_interp_to_hiercoarse, - hier::Connector &hiercoarse_to_coarse_interp, - const boost::shared_ptr& hierarchy, + boost::shared_ptr& coarse_interp_box_level, + boost::shared_ptr& coarse_interp_to_hiercoarse, const int next_coarser_ln, - const hier::Connector &dst_to_src, - const hier::Connector &src_to_dst, - const hier::Connector &coarse_interp_to_dst, - const hier::Connector &dst_to_coarse_interp, - const boost::shared_ptr &dst_level, - const bool dst_is_coarse_interp_level ); + const boost::shared_ptr& hierarchy, + const hier::Connector& dst_to_src, + const hier::Connector& dst_to_coarse_interp, + const boost::shared_ptr& dst_level); /*! * @brief Check that the Connectors between the coarse @@ -814,10 +807,22 @@ class RefineSchedule */ void sanityCheckCoarseInterpAndHiercoarseLevels( - const hier::Connector& coarse_interp_to_hiercoarse, - const hier::Connector& hiercoarse_to_coarse_interp, + const int next_coarser_ln, const boost::shared_ptr& hierarchy, - const int next_coarser_ln); + const hier::Connector& coarse_interp_to_hiercoarse); + + /*! + * @brief Get whether there is data living on patch borders. + */ + bool + getDataOnPatchBorderFlag() const; + + /*! + * @brief Get the mininum width required for the overlap Connector + * between destination and source. + */ + hier::IntVector + getMinConnectorWidth() const; /*! * @brief Get the maximum ghost cell width of all destination @@ -841,46 +846,29 @@ class RefineSchedule /*! * @brief Function that constructs schedule transactions between - * one source mapped box and one destination mapped box. + * one source box and one destination box. * * Transactions will move data on the intersection of the source and - * destination mapped boxes with the fill boxes. + * destination boxes with the fill boxes. * - * @param[in] fill_boxes A container of boxes that need to be filled. - * @param[in] dst_mapped_box Box from a destination patch. - * @param[in] src_mapped_box Box from a source patch. + * @param[in] num_nbrs + * @param[in] nbrs_begin + * @param[in] nbrs_end + * @param[in] dst_box Box from a destination patch. + * @param[in] src_box Box from a source patch. * @param[in] use_time_interpolation - */ - void - constructScheduleTransactions( - const BoxNeighborhoodCollection& dst_to_fill_on_src_proc, - BoxNeighborhoodCollection::ConstIterator& dst_to_fill_iter, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - const bool use_time_interpolation); - - /*! - * @brief Function that constructs schedule transactions between - * one source mapped box and one destination mapped box. * - * Transactions will move data on the intersection of the source and - * destination mapped boxes with the fill boxes. - * - * @param[in] dst_to_fill A connector from the destination to the fill - * levels. - * filled. - * @param[in] dst_itr An iterator to the neighborhood of a Box in - * dst_to_fill. - * @param[in] dst_mapped_box Box from a destination patch. - * @param[in] src_mapped_box Box from a source patch. - * @param[in] use_time_interpolation + * @pre d_dst_level + * @pre d_src_level + * @pre !dst_box.isPeriodicImage() */ void constructScheduleTransactions( - const hier::Connector& dst_to_fill, - hier::Connector::ConstNeighborhoodIterator& dst_itr, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, + int num_nbrs, + hier::BoxNeighborhoodCollection::ConstNeighborIterator& nbrs_begin, + hier::BoxNeighborhoodCollection::ConstNeighborIterator& nbrs_end, + const hier::Box& dst_box, + const hier::Box& src_box, const bool use_time_interpolation); /*! @@ -892,33 +880,30 @@ class RefineSchedule * same order that dst owners see them. Transactions must have the same * order on the sending and receiving processors. * - * Section, it shifts periodic image dst mapped_boxes back to the zero-shift - * position, and applies a similar shift to src mapped_boxes so that the + * Section, it shifts periodic image dst boxes back to the zero-shift + * position, and applies a similar shift to src boxes so that the * overlap is unchanged. The constructScheduleTransactions method requires - * all shifts to be absorbed in the src mapped_box. + * all shifts to be absorbed in the src box. * * The reordered neighboorhood sets are added to the output parameter. * * @param[out] full_inverted_edges - * @param[in] src_to_dst + * + * @pre d_dst_to_src + * @pre d_dst_to_src->hasTranspose() */ void reorderNeighborhoodSetsByDstNodes( - FullNeighborhoodSet& full_inverted_edges, - const Connector& src_to_dst) const; + FullNeighborhoodSet& full_inverted_edges) const; /*! * @brief Cache local copies of hierarchy information and compute * necessary ghost and stencil widths. * * This is called by every RefineSchedule constructor. - * - * @param[in] True if the constructor calling this method is being - * called recursively from another RefineSchedule constructor. */ void - initializeDomainAndGhostInformation( - bool recursive_schedule); + initializeDomainAndGhostInformation(); /*! * @brief Utility function to set up local copies of refine items. @@ -956,7 +941,15 @@ class RefineSchedule * Structures that store refine data items. */ boost::shared_ptr d_refine_classes; - int d_number_refine_items; + + /*! + * @brief number of refine data items + */ + size_t d_number_refine_items; + + /*! + * @brief used as array to store copy of refine data items. + */ const RefineClasses::Data** d_refine_items; /*! @@ -975,12 +968,23 @@ class RefineSchedule */ RefinePatchStrategy* d_refine_patch_strategy; + /*! + * @brief Object supporting interface to user-defined ghost data + * filling at block singularities. + */ + SingularityPatchStrategy* d_singularity_patch_strategy; + /*! * @brief Factory object used to create data transactions when schedule is * constructed. */ boost::shared_ptr d_transaction_factory; + /*! + * @brief Whether there is data on patch borders. + */ + bool d_data_on_patch_border_flag; + /*! * @brief maximum stencil width. */ @@ -1016,7 +1020,7 @@ class RefineSchedule * @brief Boolean flag indicating whether physical domain * can be represented as a single box region. */ - tbox::Array d_domain_is_one_box; + std::vector d_domain_is_one_box; /*! * @brief Number of non-zero entries in periodic shift vector. @@ -1060,9 +1064,9 @@ class RefineSchedule * destination that could not be filled directly from the source * level. * - * Once d_coarse_interp_level is filled (by executing d_coarse_interp_schedule) - * interpolating data into the corresponding fill boxes of the - * destination is a local operation. + * Once d_coarse_interp_level is filled (by executing + * d_coarse_interp_schedule) interpolating data into the corresponding fill + * boxes of the destination is a local operation. * * This coarser level is filled by the d_coarse_interp_schedule. If * no coarser level data is needed, then this pointer will be NULL. @@ -1076,9 +1080,9 @@ class RefineSchedule * to hold data used for interpolating into unfilled boxes at * enhanced connectivity block boundaries. * - * d_coarse_interp_encon_level will be filled by d_coarse_interp_encon_schedule. Once it - * is filled, the interpolation of data to patches in d_encon_level will - * be a local operation. + * d_coarse_interp_encon_level will be filled by + * d_coarse_interp_encon_schedule. Once it is filled, the interpolation of + * data to patches in d_encon_level will be a local operation. */ boost::shared_ptr d_coarse_interp_encon_level; @@ -1113,61 +1117,82 @@ class RefineSchedule */ boost::shared_ptr d_encon_level; + /*! + * @brief Intermediate destination level for interpolating ghost data at + * block boundaries + */ + boost::shared_ptr d_nbr_blk_fill_level; + /*! * @brief Describes remaining unfilled boxes after attempting to * fill from the source level. These remaining boxes must be * filled using a coarse interpolation schedule, d_coarse_interp_schedule. */ - boost::shared_ptr d_unfilled_mapped_box_level; + boost::shared_ptr d_unfilled_box_level; + boost::shared_ptr d_unfilled_node_box_level; /*! * @brief Describes remaining unfilled boxes of d_encon_level after * attempting to fill from the source level. These remaining boxes must - * be filled using a coarse interpolation schedule, d_coarse_interp_encon_schedule. + * be filled using a coarse interpolation schedule, + * d_coarse_interp_encon_schedule. */ - boost::shared_ptr d_unfilled_encon_box_level; + boost::shared_ptr d_unfilled_encon_box_level; /*! * @brief Stores the BoxOverlaps needed by refineScratchData() */ - std::list > > + std::vector > > d_refine_overlaps; /*! * @brief Stores the BoxOverlaps needed by refineScratchData() for * unfilled boxes at enhanced connectivity */ - std::list > > + std::vector > > d_encon_refine_overlaps; /*! - * @brief Connector from the coarse interpolation level to the destination. + * @brief Stores the overlaps needed to copy from d_nbr_blk_fill_level + * to the destination at block boundaries. */ - Connector d_coarse_interp_to_dst; + std::vector > > + d_nbr_blk_copy_overlaps; /*! * @brief Connector from the destination level to the coarse interpolation. */ - Connector d_dst_to_coarse_interp; + boost::shared_ptr d_dst_to_coarse_interp; /*! * @brief Connector from d_encon_level to d_coarse_interp_encon_level. */ - Connector d_encon_to_coarse_interp_encon; + boost::shared_ptr d_encon_to_coarse_interp_encon; + + boost::shared_ptr d_unfilled_to_unfilled_node; /*! - * @brief Connector d_coarse_interp_level to d_unfilled_mapped_box_level. + * @brief Connector d_coarse_interp_level to d_unfilled_box_level. * * Cached for use during schedule filling. */ - Connector d_coarse_interp_to_unfilled; + boost::shared_ptr d_coarse_interp_to_unfilled; + + boost::shared_ptr d_coarse_interp_encon_to_unfilled_encon; + + /*! + * @brief Connector from coarse interp level to d_nbr_blk_fill_level, + * used to connect coarse and fine patches for interpolation at + * block boundaries. + */ + boost::shared_ptr d_coarse_interp_to_nbr_fill; - Connector d_coarse_interp_encon_to_unfilled_encon; - Connector d_coarse_interp_encon_to_encon; + boost::shared_ptr d_dst_to_encon; + boost::shared_ptr d_encon_to_src; + const hier::Connector* d_dst_to_src; - Connector d_dst_to_encon; - Connector d_src_to_encon; - Connector d_encon_to_src; + std::map d_nbr_refine_ratio; + std::map d_encon_nbr_refine_ratio; //@{ @@ -1183,7 +1208,7 @@ class RefineSchedule * * The size of the array is controlled by d_max_fill_boxes. */ - tbox::Array > d_overlaps; + std::vector > d_overlaps; /*! * @brief Source mask boxes used in construction of transactions. @@ -1208,11 +1233,22 @@ class RefineSchedule boost::shared_ptr d_dst_level_fill_pattern; /*! - * @brief Tells whether recursive construction of an internal schedule - * is happening. Gets set to true by the private RefineSchedule - * constructor. + * @brief Required fine Connector widths used in refining data from + * coarser levels. + * + * Maintained by the top level RefineSchedule for use by the + * recursive schedules. Unused when there is no hierarchy for + * recursion. + */ + std::vector d_fine_connector_widths; + + /*! + * @brief The top RefineSchedule that led recursively to this one. + * + * The top RefineSchedule contains some parameters to be shared by + * the recursive RefineSchedules. */ - bool d_constructing_internal_schedule; + const RefineSchedule* d_top_refine_schedule; /*! * @brief Shared debug checking flag. @@ -1224,30 +1260,32 @@ class RefineSchedule */ static bool s_barrier_and_time; + /*! + * @brief Flag indicating if any RefineSchedule has read the input database + * for static data. + */ + static bool s_read_static_input; + //@{ /*! * @name Timer objects for performance measurement. */ + static boost::shared_ptr t_refine_schedule; static boost::shared_ptr t_fill_data; - static boost::shared_ptr t_recursive_fill; + static boost::shared_ptr t_fill_data_nonrecursive; + static boost::shared_ptr t_fill_data_recursive; + static boost::shared_ptr t_fill_physical_boundaries; + static boost::shared_ptr t_fill_singularity_boundaries; static boost::shared_ptr t_refine_scratch_data; static boost::shared_ptr t_finish_sched_const; static boost::shared_ptr t_finish_sched_const_recurse; static boost::shared_ptr t_gen_comm_sched; - static boost::shared_ptr t_bridge_connector; - static boost::shared_ptr t_modify_connector; - static boost::shared_ptr t_make_seq_map; static boost::shared_ptr t_shear; - static boost::shared_ptr t_misc1; - static boost::shared_ptr t_barrier_and_time; - static boost::shared_ptr t_get_global_mapped_box_count; + static boost::shared_ptr t_get_global_box_count; static boost::shared_ptr t_coarse_shear; - static boost::shared_ptr t_setup_coarse_interp_mapped_box_level; - static boost::shared_ptr t_misc2; + static boost::shared_ptr t_setup_coarse_interp_box_level; static boost::shared_ptr t_bridge_coarse_interp_hiercoarse; static boost::shared_ptr t_bridge_dst_hiercoarse; - static boost::shared_ptr t_make_coarse_interp_level; - static boost::shared_ptr t_make_coarse_interp_to_unfilled; static boost::shared_ptr t_invert_edges; static boost::shared_ptr t_construct_send_trans; static boost::shared_ptr t_construct_recv_trans; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.C index 9346f576..9abef560 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: RefineSchedule's implementation of PatchHierarchy * ************************************************************************/ - -#ifndef included_xfer_RefineScheduleConnectorWidthRequestor_C -#define included_xfer_RefineScheduleConnectorWidthRequestor_C - #include "SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" @@ -75,15 +71,20 @@ RefineScheduleConnectorWidthRequestor::computeRequiredConnectorWidths( const tbox::Dimension& dim(patch_hierarchy.getDim()); + /* + * Add one to max data ghost width to create overlaps of data + * living on patch boundaries. + */ const hier::IntVector max_data_gcw( - patch_hierarchy.getPatchDescriptor()->getMaxGhostWidth(dim) * d_gcw_factor); + patch_hierarchy.getPatchDescriptor()->getMaxGhostWidth(dim) + 1); - const hier::IntVector max_stencil_width( - hier::IntVector::max( - patch_hierarchy.getGridGeometry()->getMaxTransferOpStencilWidth(), - RefinePatchStrategy::getMaxRefineOpStencilWidth(dim))); + hier::IntVector max_stencil_width = + patch_hierarchy.getGridGeometry()->getMaxTransferOpStencilWidth(dim); + max_stencil_width.max( + RefinePatchStrategy::getMaxRefineOpStencilWidth(dim)); - const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); + hier::IntVector zero_vector(hier::IntVector::getZero(dim), + patch_hierarchy.getNumberBlocks()); /* * Compute the Connector width needed to ensure all edges are found @@ -103,8 +104,10 @@ RefineScheduleConnectorWidthRequestor::computeRequiredConnectorWidths( * it. */ + hier::IntVector self_width(max_data_gcw * d_gcw_factor, + patch_hierarchy.getNumberBlocks()); self_connector_widths.clear(); - self_connector_widths.resize(max_levels, max_data_gcw); + self_connector_widths.resize(max_levels, self_width); fine_connector_widths.clear(); if (max_levels > 1) { @@ -117,27 +120,58 @@ RefineScheduleConnectorWidthRequestor::computeRequiredConnectorWidths( * fine levels. */ for (int ln = max_levels - 1; ln > -1; --ln) { + computeRequiredFineConnectorWidthsForRecursiveRefinement( + fine_connector_widths, + max_data_gcw, + max_stencil_width, + patch_hierarchy, + ln); + } + +} + +/* + ************************************************************************** + * Compute fine Connector width needed at each coarser level (lnc) for + * recursive refinement starting with destination level ln. + ************************************************************************** + */ +void +RefineScheduleConnectorWidthRequestor::computeRequiredFineConnectorWidthsForRecursiveRefinement( + std::vector& fine_connector_widths, + const hier::IntVector& data_gcw_on_initial_dst_ln, + const hier::IntVector& max_stencil_width, + const hier::PatchHierarchy& patch_hierarchy, + int initial_dst_ln) const +{ + if (static_cast(fine_connector_widths.size()) < initial_dst_ln) { + fine_connector_widths.insert( + fine_connector_widths.end(), + initial_dst_ln - fine_connector_widths.size(), + hier::IntVector(patch_hierarchy.getDim(), 0, + patch_hierarchy.getGridGeometry()->getNumberBlocks()) ); + } + + const size_t nblocks = patch_hierarchy.getGridGeometry()->getNumberBlocks(); + + hier::IntVector width_for_refining_recursively( + data_gcw_on_initial_dst_ln * d_gcw_factor, nblocks); + + for (int lnc = initial_dst_ln - 1; lnc > -1; --lnc) { + + const hier::IntVector& ratio_to_coarser = + patch_hierarchy.getRatioToCoarserLevel(lnc + 1); + width_for_refining_recursively.ceilingDivide(ratio_to_coarser); + /* - * Compute width needed at each coarser level (lnc) for - * recursive refinement starting with destination level ln. + * Data in the supplemental level in RefineSchedule may have ghost + * cells as big as the stencil width. Coarse_to_fine_width must be + * big enough to allow coarse to bridge to fine's supplemental, and + * the supplemental includes the stencil width at coarse. */ - hier::IntVector width_for_refining_recursively = max_data_gcw; - for (int lnc = ln - 1; lnc > -1; --lnc) { - - const hier::IntVector& ratio_to_coarser = - patch_hierarchy.getRatioToCoarserLevel(lnc + 1); - width_for_refining_recursively.ceilingDivide(ratio_to_coarser); - - /* - * Data in the supplemental level in RefineSchedule may have ghost - * cells as big as the stencil width. Coarse_to_fine_width must be - * big enough to allow coarse to bridge to fine's supplemental, and - * the supplemental includes the stencil width at coarse. - */ - width_for_refining_recursively += max_stencil_width; - - fine_connector_widths[lnc].max(width_for_refining_recursively); - } + width_for_refining_recursively += max_stencil_width; + + fine_connector_widths[lnc].max(width_for_refining_recursively); } } @@ -152,5 +186,3 @@ RefineScheduleConnectorWidthRequestor::computeRequiredConnectorWidths( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h index 241ae35b..97d71b39 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineScheduleConnectorWidthRequestor.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: RefineSchedule's implementation of PatchHierarchy * ************************************************************************/ @@ -71,11 +71,47 @@ class RefineScheduleConnectorWidthRequestor: * factor. Increasing the factor is NOT the same as multiplying * the Connector widths by the same factor. * - * @param[in] factor By default, @c factor=1. + * @param[in] gcw_factor By default, @c gcw_factor=1. + * + * @pre gcw_factor >= 0 */ void setGhostCellWidthFactor( - int factor); + int gcw_factor); + + /* + * @brief Compute fine Connector width needed at each coarser level + * for recursive refinement starting with destination level ln. + * + * @param fine_connector_width [in,out] On input, contains width + * requirement from other conditions, if any. This method computes + * the fine connector width for each level coarser than + * initial_dst_ln, for recursive refinement with initial + * destination level initial_dst_ln. It sets fine_connector_width + * to the max of its input value and the value computed. It will + * change the values of the first initial_dst_ln entries (or create + * them if missing). + * + * @param data_gcw_on_initial_dst_ln Ghost data width to be filled + * on the initial destination level. Important: This input value + * should include the 1 cell added for data on patch borders, if it + * is needed. + * + * @param [out] max_stencil_width Max stencil width used by the + * refinement operators. + * + * @param [in] patch_hierarchy + * + * @param [in] initial_dst_ln Level number corresponding to the + * initial destination. + */ + void + computeRequiredFineConnectorWidthsForRecursiveRefinement( + std::vector& fine_connector_widths, + const hier::IntVector& data_gcw_on_initial_dst_ln, + const hier::IntVector& max_stencil_width, + const hier::PatchHierarchy& patch_hierarchy, + int initial_dst_ln) const; private: /*! diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.C index 9567cc40..55757ae3 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for time interpolation during data refining * ************************************************************************/ - -#ifndef included_xfer_RefineTimeTransaction_C -#define included_xfer_RefineTimeTransaction_C - #include "SAMRAI/xfer/RefineTimeTransaction.h" #include "SAMRAI/hier/IntVector.h" @@ -43,10 +39,6 @@ namespace xfer { double RefineTimeTransaction::s_time = 0.0; -const RefineClasses::Data ** -RefineTimeTransaction::s_refine_items = (const RefineClasses::Data **)NULL; -int RefineTimeTransaction::s_num_refine_items = 0; - /* ************************************************************************* * @@ -54,42 +46,42 @@ int RefineTimeTransaction::s_num_refine_items = 0; * ************************************************************************* */ - RefineTimeTransaction::RefineTimeTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, + const hier::Box& dst_box, + const hier::Box& src_box, const hier::Box& box, - const int refine_item_id): + const RefineClasses::Data** refine_data, + int item_id): d_dst_patch(), - d_dst_patch_rank(dst_mapped_box.getOwnerRank()), + d_dst_patch_rank(dst_box.getOwnerRank()), d_src_patch(), - d_src_patch_rank(src_mapped_box.getOwnerRank()), + d_src_patch_rank(src_box.getOwnerRank()), d_overlap(overlap), d_box(box), - d_refine_item_id(refine_item_id) + d_refine_data(refine_data), + d_item_id(item_id) { TBOX_ASSERT(dst_level); TBOX_ASSERT(src_level); TBOX_ASSERT(overlap); - TBOX_ASSERT(dst_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(src_mapped_box.getLocalId() >= 0); - TBOX_ASSERT(refine_item_id >= 0); - TBOX_DIM_ASSERT_CHECK_ARGS5(*dst_level, + TBOX_ASSERT(dst_box.getLocalId() >= 0); + TBOX_ASSERT(src_box.getLocalId() >= 0); + TBOX_ASSERT(item_id >= 0); + TBOX_ASSERT(refine_data[item_id] != 0); + TBOX_ASSERT_OBJDIM_EQUALITY5(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box, + dst_box, + src_box, box); - // Note: s_num_coarsen_items cannot be used at this point! - if (d_dst_patch_rank == dst_level->getBoxLevel()->getMPI().getRank()) { - d_dst_patch = dst_level->getPatch(dst_mapped_box.getId()); + d_dst_patch = dst_level->getPatch(dst_box.getGlobalId()); } if (d_src_patch_rank == dst_level->getBoxLevel()->getMPI().getRank()) { - d_src_patch = src_level->getPatch(src_mapped_box.getId()); + d_src_patch = src_level->getPatch(src_box.getGlobalId()); } } @@ -111,13 +103,11 @@ RefineTimeTransaction::canEstimateIncomingMessageSize() bool can_estimate = false; if (d_src_patch) { can_estimate = - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_told) + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_told) ->canEstimateStreamSizeFromBox(); } else { can_estimate = - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->canEstimateStreamSizeFromBox(); } return can_estimate; @@ -127,8 +117,7 @@ size_t RefineTimeTransaction::computeIncomingMessageSize() { d_incoming_bytes = - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->getDataStreamSize(*d_overlap); return d_incoming_bytes; } @@ -137,8 +126,7 @@ size_t RefineTimeTransaction::computeOutgoingMessageSize() { d_outgoing_bytes = - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_told) + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_told) ->getDataStreamSize(*d_overlap); return d_outgoing_bytes; } @@ -157,24 +145,25 @@ void RefineTimeTransaction::packStream( tbox::MessageStream& stream) { - hier::Box temporary_mapped_box(d_box.getDim()); - temporary_mapped_box.initialize(d_box, hier::LocalId(-1), tbox::SAMRAI_MPI::getInvalidRank()); + hier::Box temporary_box(d_box.getDim()); + temporary_box.initialize(d_box, + d_src_patch->getBox().getLocalId(), + tbox::SAMRAI_MPI::getInvalidRank()); hier::Patch temporary_patch( - temporary_mapped_box, + temporary_box, d_src_patch->getPatchDescriptor()); boost::shared_ptr temporary_patch_data( d_src_patch->getPatchDescriptor() - ->getPatchDataFactory(s_refine_items[d_refine_item_id]-> - d_src_told) + ->getPatchDataFactory(d_refine_data[d_item_id]->d_src_told) ->allocate(temporary_patch)); temporary_patch_data->setTime(s_time); timeInterpolate( temporary_patch_data, - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src_told), - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]->d_src_tnew)); + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_told), + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_tnew)); temporary_patch_data->packStream(stream, *d_overlap); } @@ -183,7 +172,7 @@ void RefineTimeTransaction::unpackStream( tbox::MessageStream& stream) { - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->unpackStream(stream, *d_overlap); } @@ -200,38 +189,34 @@ RefineTimeTransaction::copyLocalData() hier::IntVector::getZero(d_box.getDim())) { timeInterpolate( - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_scratch), - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_told), - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_tnew)); + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch), + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_told), + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_tnew)); } else { - hier::Box temporary_mapped_box(d_box.getDim()); - temporary_mapped_box.initialize(d_box, hier::LocalId(-1), tbox::SAMRAI_MPI::getInvalidRank()); + hier::Box temporary_box(d_box.getDim()); + temporary_box.initialize(d_box, + d_src_patch->getBox().getLocalId(), + tbox::SAMRAI_MPI::getInvalidRank()); hier::Patch temporary_patch( - temporary_mapped_box, + temporary_box, d_src_patch->getPatchDescriptor()); boost::shared_ptr temp( d_src_patch->getPatchDescriptor() - ->getPatchDataFactory(s_refine_items[d_refine_item_id]-> - d_src_told) + ->getPatchDataFactory(d_refine_data[d_item_id]->d_src_told) ->allocate(temporary_patch)); temp->setTime(s_time); timeInterpolate( temp, - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_told), - d_src_patch->getPatchData(s_refine_items[d_refine_item_id]-> - d_src_tnew)); + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_told), + d_src_patch->getPatchData(d_refine_data[d_item_id]->d_src_tnew)); - d_dst_patch->getPatchData(s_refine_items[d_refine_item_id]->d_scratch) + d_dst_patch->getPatchData(d_refine_data[d_item_id]->d_scratch) ->copy(*temp, *d_overlap); } @@ -246,20 +231,20 @@ RefineTimeTransaction::timeInterpolate( { TBOX_ASSERT(pd_old); TBOX_ASSERT(pd_dst); - TBOX_DIM_ASSERT_CHECK_ARGS2(*pd_dst, *pd_old); + TBOX_ASSERT_OBJDIM_EQUALITY2(*pd_dst, *pd_old); TBOX_ASSERT(tbox::MathUtilities::equalEps(pd_dst->getTime(), s_time)); if (tbox::MathUtilities::equalEps(pd_old->getTime(), s_time)) { - s_refine_items[d_refine_item_id]-> + d_refine_data[d_item_id]-> d_optime->timeInterpolate(*pd_dst, d_box, *pd_old, *pd_old); } else { TBOX_ASSERT(pd_new); - TBOX_DIM_ASSERT_CHECK_ARGS2(*pd_dst, *pd_new); + TBOX_ASSERT_OBJDIM_EQUALITY2(*pd_dst, *pd_new); TBOX_ASSERT(pd_old->getTime() < s_time); TBOX_ASSERT(pd_new->getTime() >= s_time); - s_refine_items[d_refine_item_id]-> + d_refine_data[d_item_id]-> d_optime->timeInterpolate(*pd_dst, d_box, *pd_old, *pd_new); } } @@ -279,22 +264,23 @@ RefineTimeTransaction::printClassData( stream << "Refine Time Transaction" << std::endl; stream << " transaction time: " << s_time << std::endl; stream << " refine item array: " - << (RefineClasses::Data **)s_refine_items << std::endl; - stream << " num refine items: " << s_num_refine_items << std::endl; + << (RefineClasses::Data *)d_refine_data[d_item_id] << std::endl; stream << " destination patch rank: " << d_dst_patch_rank << std::endl; stream << " source patch rank: " << d_src_patch_rank << std::endl; stream << " time interpolation box: " << d_box << std::endl; - stream << " refine item id: " << d_refine_item_id << std::endl; - stream << " destination patch data id: " - << s_refine_items[d_refine_item_id]->d_scratch << std::endl; - stream << " source (old) patch data id: " - << s_refine_items[d_refine_item_id]->d_src_told << std::endl; - stream << " source (new) patch data id: " - << s_refine_items[d_refine_item_id]->d_src_tnew << std::endl; - stream << " time interpolation name id: " - << typeid(*s_refine_items[d_refine_item_id]->d_optime).name() << std::endl; + stream << " refine item id : " << d_item_id << std::endl; + if (d_refine_data) { + stream << " destination patch data id: " + << d_refine_data[d_item_id]->d_scratch << std::endl; + stream << " source (old) patch data id: " + << d_refine_data[d_item_id]->d_src_told << std::endl; + stream << " source (new) patch data id: " + << d_refine_data[d_item_id]->d_src_tnew << std::endl; + stream << " time interpolation name id: " + << typeid(*d_refine_data[d_item_id]->d_optime).name() << std::endl; + } stream << " incoming bytes: " << d_incoming_bytes << std::endl; stream << " outgoing bytes: " << d_outgoing_bytes << std::endl; stream << " destination patch: " @@ -315,5 +301,3 @@ RefineTimeTransaction::printClassData( #pragma report(enable, CPPC5334) #pragma report(enable, CPPC5328) #endif - -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.h index 5c20702a..3cc7c0d0 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTimeTransaction.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Communication transaction for time interpolation during data * refining * @@ -27,16 +27,17 @@ namespace xfer { /*! * @brief Class RefineTimeTransaction represents a single time interpolation - * communication transaction between two processors or a local data copy or refine - * schedules. Note that to there is an implicit hand-shaking between objects of - * this class and the RefineSchedule object that constructs them. Following - * the refine schedule implementation, the source patch data indices for a time - * transaction are always refer to the old and new source data and the destination - * patch data index for a time transaction is always the scratch data, all as defined - * in the RefineClasses class. This transaction is used by the refine schedule. + * communication transaction between two processors or a local data copy or + * refine schedules. Note that to there is an implicit hand-shaking between + * objects of this class and the RefineSchedule object that constructs them. + * Following the refine schedule implementation, the source patch data indices + * for a time transaction are always refer to the old and new source data and + * the destination patch data index for a time transaction is always the + * scratch data, all as defined in the RefineClasses class. This transaction + * is used by the refine schedule. * - * @see xfer::RefineSchedule - * @see xfer::RefineClasses + * @see RefineSchedule + * @see RefineClasses * @see tbox::Schedule * @see tbox::Transaction */ @@ -44,36 +45,6 @@ namespace xfer { class RefineTimeTransaction:public tbox::Transaction { public: - /*! - * Static member function to set the array of refine class data items that - * is shared by all object instances of this time transaction class during - * data transfers. The array must be set before any transactions are executed. - * The array is set in the RefineSchedule class. - */ - static void - setRefineItems( - const RefineClasses::Data** refine_items, - int num_refine_items) - { - TBOX_ASSERT(refine_items != (const RefineClasses::Data **)NULL); - TBOX_ASSERT(num_refine_items >= 0); - s_refine_items = refine_items; - s_num_refine_items = num_refine_items; - } - - /*! - * Static member function to unset the array of refine class data items that - * is shared by all object instances of this time transaction class during - * data transfers. The unset function is used to prevent erroneous execution - * of different schedules. The array is unset in the RefineSchedule class. - */ - static void - unsetRefineItems() - { - s_refine_items = (const RefineClasses::Data **)NULL; - s_num_refine_items = 0; - } - /*! * Static member function to set the transaction time that will be shared * by all object instances of this time transaction class during time @@ -92,32 +63,45 @@ class RefineTimeTransaction:public tbox::Transaction * patches, and patch data components found in the refine class * item with the given id owned by the calling refine schedule. In general, * this constructor is called by a RefineSchedule object for each data - * transaction (involving time interpolation) that must occur. This transaction - * will be responsible for one of the following: (1) performing a local copy, - * (2) packing a message stream from the source, or (3) unpacking a message stream - * from the destination. The transaction will perform time interpolation between - * the source old and new times using the time interpolation operator found in - * the refine class item. + * transaction (involving time interpolation) that must occur. This + * transaction will be responsible for one of the following: (1) performing + * a local copy, (2) packing a message stream from the source, or + * (3) unpacking a message stream from the destination. The transaction + * will perform time interpolation between the source old and new times + * using the time interpolation operator found in the refine class item. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. * @param box hier::Box region in which to time interpolate. - * @param refine_item_id Integer id of refine data item owned by refine schedule. + * @param refine_data Pointer to array of refine data items + * @param item_id Integer id of refine data item owned by refine + * schedule. * - * When assertion checking is active, an assertion will result if any of the pointer - * arguments is null, or if any of the integer arguments are invalid (i.e., < 0); + * @pre dst_level + * @pre src_level + * @pre overlap + * @pre dst_box.getLocalId() >= 0 + * @pre src_box.getLocalId() >= 0 + * @pre refine_data != 0 + * @pre item_id >= 0 + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_box.getDim()) && + * (dst_level->getDim() == src_box.getDim()) && + * (dst_level->getDim() == box.getDim()) */ RefineTimeTransaction( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, + const hier::Box& dst_box, + const hier::Box& src_box, const hier::Box& box, - const int refine_item_id); + const RefineClasses::Data ** refine_data, + int item_id); /*! * The virtual destructor for time transaction releases all @@ -129,7 +113,7 @@ class RefineTimeTransaction:public tbox::Transaction * Return a boolean indicating whether this transaction can estimate * the size of an incoming message. If this is false, then a different * communications protocol kicks in and the message size is transmitted - * between mapped_boxes. + * between boxes. */ virtual bool canEstimateIncomingMessageSize(); @@ -143,7 +127,8 @@ class RefineTimeTransaction:public tbox::Transaction computeIncomingMessageSize(); /*! - * Return the integer buffer space needed (in bytes) for the outgoing message. + * Return the integer buffer space needed (in bytes) for the outgoing + * message. */ virtual size_t computeOutgoingMessageSize(); @@ -190,13 +175,11 @@ class RefineTimeTransaction:public tbox::Transaction private: RefineTimeTransaction( const RefineTimeTransaction&); // not implemented - void + RefineTimeTransaction& operator = ( const RefineTimeTransaction&); // not implemented static double s_time; - static const RefineClasses::Data** s_refine_items; - static int s_num_refine_items; void timeInterpolate( @@ -210,9 +193,10 @@ class RefineTimeTransaction:public tbox::Transaction int d_src_patch_rank; boost::shared_ptr d_overlap; hier::Box d_box; - int d_refine_item_id; - int d_incoming_bytes; - int d_outgoing_bytes; + const RefineClasses::Data** d_refine_data; + int d_item_id; + size_t d_incoming_bytes; + size_t d_outgoing_bytes; }; diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.C index fba99bc4..0b4df6d6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.C @@ -3,15 +3,11 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for factory objects that create transactions for * refine schedules. * ************************************************************************/ - -#ifndef included_xfer_RefineTransactionFactory_C -#define included_xfer_RefineTransactionFactory_C - #include "SAMRAI/xfer/RefineTransactionFactory.h" namespace SAMRAI { @@ -50,4 +46,3 @@ RefineTransactionFactory::setTransactionTime( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.h index b6abc04c..63d04970 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/RefineTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Interface for factory objects that create transactions for * refine schedules. * @@ -24,11 +24,11 @@ namespace SAMRAI { namespace xfer { /*! - * @brief Abstract base class defining the interface for all concrete transaction - * factory objects that generate data transaction objects used with a RefineSchedule - * object. A concrete subclass will allocate new transaction objects. This class - * is an example of the ``Abstract Factory'' method described in the Design Patterns - * book by Gamma, et al. + * @brief Abstract base class defining the interface for all concrete + * transaction factory objects that generate data transaction objects used with + * a RefineSchedule object. A concrete subclass will allocate new transaction + * objects. This class is an example of the ``Abstract Factory'' method + * described in the Design Patterns book by Gamma, et al. * * To add a new type of Transaction object MyRefineTransaction: * @@ -38,8 +38,8 @@ namespace xfer { * concrete subclass; in particular, the allocate() function must return * a new instance of the desired transaction object. * -# The type of the transaction allocated by the concrete factory is a - * Transaction. Thus, the new transaction object must be derived - * from the Transaction base class and implement the abstract + * Transaction. Thus, the new transaction object must be derived + * from the Transaction base class and implement the abstract * virtual functions declared by the base class. * * @see tbox::Transaction @@ -59,42 +59,23 @@ class RefineTransactionFactory virtual ~RefineTransactionFactory(); /*! - * @brief Pure virtual function to set the array of RefineClass::Data items - * associated with the refine schedule. Typical concrete transactions used by - * the schedule use this information to communicate data. This operation - * is called by the refine schedule during the execution of the - * RefineSchedule::fillData() routine before data communication - * operations begin. - */ - virtual void - setRefineItems( - const RefineClasses::Data ** refine_items, - int num_refine_items) = 0; - - /*! - * @brief Pure virtual function to clear the array of RefineClass::Data items - * associated with the refine schedule. This operation is called by the - * refine schedule after data communication operations are complete. - */ - virtual void - unsetRefineItems() = 0; - - /*! - * @brief Pure virtual function to allocate a concrete refine transaction object. - * This routine is called by the refine schedule during construction of the - * schedule. + * @brief Pure virtual function to allocate a concrete refine transaction + * object. This routine is called by the refine schedule during + * construction of the schedule. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param ritem_id Integer index of RefineClass::Data item associated + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param refine_data Pointer to array of refine data items + * @param item_id Integer index of RefineClass::Data item associated * with transaction. * @param box Optional const reference to box defining region of * refine transaction. Default is an empty box. - * @param use_time_interpolation Optional boolean flag indicating whether the - * refine transaction involves time interpolation. + * @param use_time_interpolation Optional boolean flag indicating whether + * the refine transaction involves time interpolation. * Default is false. */ virtual boost::shared_ptr @@ -102,9 +83,10 @@ class RefineTransactionFactory const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int ritem_id, + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation = false) const = 0; @@ -113,21 +95,23 @@ class RefineTransactionFactory const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int ritem_id) const + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data** refine_data, + int item_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box); + dst_box, + src_box); return allocate( dst_level, src_level, overlap, - dst_mapped_box, - src_mapped_box, - ritem_id, + dst_box, + src_box, + refine_data, + item_id, hier::Box::getEmptyBox(src_level->getDim()), false); } @@ -144,17 +128,17 @@ class RefineTransactionFactory double fill_time); /*! - * @brief Virtual function allowing transaction factory to preprocess scratch - * space data before transactactions use it if they need to. This function is - * optional for the concrete transaction factory object. + * @brief Virtual function allowing transaction factory to preprocess + * scratch space data before transactactions use it if they need to. This + * function is optional for the concrete transaction factory object. * The default implementation is a no-op. * * @param level boost::shared_ptr to patch level holding scratch data. * @param fill_time Double value of simulation time corresponding to * RefineSchedule operations. - * @param preprocess_vector Const reference to ComponentSelector that indicates - * patch data array indices of scratch patch data objects - * to preprocess. + * @param preprocess_vector Const reference to ComponentSelector that + * indicates patch data array indices of scratch patch + * data objects to preprocess. */ virtual void preprocessScratchSpace( @@ -166,7 +150,7 @@ class RefineTransactionFactory // The following two functions are not implemented RefineTransactionFactory( const RefineTransactionFactory&); - void + RefineTransactionFactory& operator = ( const RefineTransactionFactory&); diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.C new file mode 100644 index 00000000..0a866e5b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.C @@ -0,0 +1,29 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Strategy interface to user routines for refining AMR data. + * + ************************************************************************/ +#include "SAMRAI/xfer/SingularityPatchStrategy.h" + +namespace SAMRAI { +namespace xfer { + +/* + ************************************************************************* + ************************************************************************* + */ + +SingularityPatchStrategy::SingularityPatchStrategy() +{ +} + +SingularityPatchStrategy::~SingularityPatchStrategy() +{ +} + +} +} diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.h new file mode 100644 index 00000000..2408db1c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/SingularityPatchStrategy.h @@ -0,0 +1,97 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Strategy interface to user routines for refining AMR data. + * + ************************************************************************/ + +#ifndef included_xfer_SingularityPatchStrategy +#define included_xfer_SingularityPatchStrategy + +#include "SAMRAI/SAMRAI_config.h" +#include "boost/shared_ptr.hpp" + +namespace SAMRAI { + +namespace hier { +class Box; +class Connector; +class BaseGridGeometry; +class BoundaryBox; +class Patch; +class PatchLevel; +} + +namespace xfer { + +/*! + * @brief Abstract base class for setting ghost data when refining at + * a multiblock singularity. + * + * This class would be needed where ever you need a + * RefinePatchStrategy and have a multiblock mesh with singularities. + * Otherwise, you can ignore it. + * + * To use this base class, inherit it in the concrete class where you + * inherit RefinePatchStrategy and implement its pure virtual methods. + * + * SingularityPatchStrategy provides an interface for a user to supply + * methods for application-specific refining of data at block + * singularities in the mesh. A concrete subclass must define + * the method fillSingularityBoundaryConditions. + */ + +class SingularityPatchStrategy +{ +public: + /*! + * @brief Constructor. + */ + SingularityPatchStrategy(); + + /*! + * @brief Destructor + */ + virtual ~SingularityPatchStrategy(); + + /*! + * @brief Set the ghost data at a multiblock singularity. + * + * This virtual method allows for a user-defined implemenation to + * fill ghost data at ghost regions located at reduced or enhanced + * connectivity multiblock singularities. The encon_level and + * dst_to_encon arguments may be ignored if the patch touches no + * enhanced connectivity singularities. + * + * The patches in encon level are in the coordinate system of the blocks + * where they originated, not in that of the destination patch, so the + * filling operation must take into account the transformation between + * blocks. + * + * @param patch The patch containing the data to be filled + * @param encon_level Level representing enhanced connectivity ghost + * regions + * @param dst_to_encon Connector from destination level to encon_level + * @param fill_box Box covering maximum amount of ghost cells to be filled + * @param boundary_box BoundaryBox describing location of singularity in + * relation to patch + * @param[in] grid_geometry + */ + virtual void + fillSingularityBoundaryConditions( + hier::Patch& patch, + const hier::PatchLevel& encon_level, + boost::shared_ptr dst_to_encon, + const hier::Box& fill_box, + const hier::BoundaryBox& boundary_box, + const boost::shared_ptr& grid_geometry) = 0; + +}; + +} +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.C index 4dec2c50..32973e10 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.C @@ -3,20 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Concrete factory for create standard copy transactions * for coarsen schedules. * ************************************************************************/ - -#ifndef included_xfer_StandardCoarsenTransactionFactory_C -#define included_xfer_StandardCoarsenTransactionFactory_C - #include "SAMRAI/xfer/StandardCoarsenTransactionFactory.h" #include "SAMRAI/xfer/CoarsenCopyTransaction.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace xfer { @@ -37,33 +33,6 @@ StandardCoarsenTransactionFactory::~StandardCoarsenTransactionFactory() { } -/* - ************************************************************************* - * - * Set/unset information for transactions managed by this factory class. - * - ************************************************************************* - */ - -void -StandardCoarsenTransactionFactory::setCoarsenItems( - const CoarsenClasses::Data** coarsen_items, - int num_coarsen_items) -{ - CoarsenCopyTransaction::setCoarsenItems(coarsen_items, - num_coarsen_items); - d_coarsen_items = coarsen_items; - d_num_coarsen_items = num_coarsen_items; -} - -void -StandardCoarsenTransactionFactory::unsetCoarsenItems() -{ - CoarsenCopyTransaction::unsetCoarsenItems(); - d_coarsen_items = (const CoarsenClasses::Data **)NULL; - d_num_coarsen_items = 0; -} - /* ************************************************************************* * @@ -77,24 +46,25 @@ StandardCoarsenTransactionFactory::allocate( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int citem_id) const + const hier::Box& dst_box, + const hier::Box& src_box, + const CoarsenClasses::Data** coarsen_data, + int item_id) const { - TBOX_DIM_ASSERT_CHECK_ARGS4(*dst_level, + TBOX_ASSERT_OBJDIM_EQUALITY4(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box); + dst_box, + src_box); return boost::make_shared( - dst_level, - src_level, - overlap, - dst_mapped_box, - src_mapped_box, - citem_id); + dst_level, + src_level, + overlap, + dst_box, + src_box, + coarsen_data, + item_id); } } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.h index f1f03805..d9bc24f9 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardCoarsenTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Concrete factory for create standard copy transactions * for coarsen schedules. * @@ -20,16 +20,16 @@ #include "SAMRAI/xfer/CoarsenClasses.h" #include "SAMRAI/xfer/CoarsenTransactionFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace xfer { /*! - * @brief Concrete subclass of CoarsenTransactionFactory base class that allocates - * CoarsenCopyTransaction objects for a CoarsenSchedule object. + * @brief Concrete subclass of CoarsenTransactionFactory base class that + * allocates CoarsenCopyTransaction objects for a CoarsenSchedule object. * - * @see xfer::CoarsenCopyTransaction + * @see CoarsenCopyTransaction */ class StandardCoarsenTransactionFactory:public CoarsenTransactionFactory @@ -45,51 +45,41 @@ class StandardCoarsenTransactionFactory:public CoarsenTransactionFactory */ virtual ~StandardCoarsenTransactionFactory(); - /*! - * @brief Set the array of CoarsenClass::Data items used by the transactions. - */ - virtual void - setCoarsenItems( - const CoarsenClasses::Data ** coarsen_items, - int num_coarsen_items); - - /*! - * @brief Clear the array of CoarsenClass::Data items used by the transactions. - */ - virtual void - unsetCoarsenItems(); - /*! * @brief Allocate a CoarsenCopyTransaction object. * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param citem_id Integer index of CoarsenClass::Data item associated + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param coarsen_data Pointer to array of coarsen data items + * @param item_id Integer index of CoarsenClass::Data item associated * with transaction. + * + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_box.getDim()) && + * (dst_level->getDim() == src_box.getDim()) */ virtual boost::shared_ptr allocate( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int citem_id) const; + const hier::Box& dst_box, + const hier::Box& src_box, + const CoarsenClasses::Data ** coarsen_data, + int item_id) const; private: // The following two functions are not implemented StandardCoarsenTransactionFactory( const StandardCoarsenTransactionFactory&); - void + StandardCoarsenTransactionFactory& operator = ( const StandardCoarsenTransactionFactory&); - const CoarsenClasses::Data** d_coarsen_items; - int d_num_coarsen_items; - }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.C index 1cb37b2d..3a96690c 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.C @@ -3,21 +3,17 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Concrete factory to create standard copy and time transactions * for refine schedules. * ************************************************************************/ - -#ifndef included_xfer_StandardRefineTransactionFactory_C -#define included_xfer_StandardRefineTransactionFactory_C - #include "SAMRAI/xfer/StandardRefineTransactionFactory.h" #include "SAMRAI/xfer/RefineCopyTransaction.h" #include "SAMRAI/xfer/RefineTimeTransaction.h" -#include +#include "boost/make_shared.hpp" namespace SAMRAI { namespace xfer { @@ -38,34 +34,6 @@ StandardRefineTransactionFactory::~StandardRefineTransactionFactory() { } -/* - ************************************************************************* - * - * Set/unset information for transactions managed by this factory class. - * - ************************************************************************* - */ - -void -StandardRefineTransactionFactory::setRefineItems( - const RefineClasses::Data** refine_items, - int num_refine_items) -{ - RefineCopyTransaction::setRefineItems(refine_items, num_refine_items); - RefineTimeTransaction::setRefineItems(refine_items, num_refine_items); - d_refine_items = refine_items; - d_num_refine_items = num_refine_items; -} - -void -StandardRefineTransactionFactory::unsetRefineItems() -{ - RefineCopyTransaction::unsetRefineItems(); - RefineTimeTransaction::unsetRefineItems(); - d_refine_items = (const RefineClasses::Data **)NULL; - d_num_refine_items = 0; -} - void StandardRefineTransactionFactory::setTransactionTime( double fill_time) @@ -86,38 +54,41 @@ StandardRefineTransactionFactory::allocate( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int ritem_id, + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data** refine_data, + int item_id, const hier::Box& box, bool use_time_interpolation) const { - TBOX_DIM_ASSERT_CHECK_ARGS5(*dst_level, + TBOX_ASSERT_OBJDIM_EQUALITY5(*dst_level, *src_level, - dst_mapped_box, - src_mapped_box, + dst_box, + src_box, box); if (use_time_interpolation) { return boost::make_shared( - dst_level, - src_level, - overlap, - dst_mapped_box, - src_mapped_box, - box, - ritem_id); + dst_level, + src_level, + overlap, + dst_box, + src_box, + box, + refine_data, + item_id); } else { return boost::make_shared( - dst_level, - src_level, - overlap, - dst_mapped_box, - src_mapped_box, - ritem_id); + dst_level, + src_level, + overlap, + dst_box, + src_box, + refine_data, + item_id); } } @@ -135,4 +106,3 @@ StandardRefineTransactionFactory::preprocessScratchSpace( } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.h index d56062f3..35c51d34 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/StandardRefineTransactionFactory.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Concrete factory to create standard copy and time transactions * for refine schedules. * @@ -20,19 +20,19 @@ #include "SAMRAI/xfer/RefineClasses.h" #include "SAMRAI/xfer/RefineTransactionFactory.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { namespace xfer { /*! - * @brief Concrete subclass of RefineTransactionFactory base class that allocates - * RefineCopyTransaction and RefineTimeTransaction objects for a + * @brief Concrete subclass of RefineTransactionFactory base class that + * allocates RefineCopyTransaction and RefineTimeTransaction objects for a * RefineSchedule object. * - * @see xfer::RefineCopyTransaction - * @see xfer::RefineTimeTransaction - * @see xfer::RefineTransactionFactory + * @see RefineCopyTransaction + * @see RefineTimeTransaction + * @see RefineTransactionFactory */ class StandardRefineTransactionFactory:public RefineTransactionFactory @@ -48,20 +48,6 @@ class StandardRefineTransactionFactory:public RefineTransactionFactory */ virtual ~StandardRefineTransactionFactory(); - /*! - * @brief Set the array of RefineClass::Data items used by the transactions. - */ - virtual void - setRefineItems( - const RefineClasses::Data ** refine_items, - int num_refine_items); - - /*! - * @brief Clear the array of RefineClass::Data items used by the transactions. - */ - virtual void - unsetRefineItems(); - /*! * @brief Set simulation time used by the refine time transaction objects. */ @@ -77,40 +63,49 @@ class StandardRefineTransactionFactory:public RefineTransactionFactory * * @param dst_level boost::shared_ptr to destination patch level. * @param src_level boost::shared_ptr to source patch level. - * @param overlap boost::shared_ptr to overlap region between patches. - * @param dst_mapped_box Destination Box in destination patch level. - * @param src_mapped_box Source Box in source patch level. - * @param ritem_id Integer index of RefineClass::Data item associated + * @param overlap boost::shared_ptr to overlap region between + * patches. + * @param dst_box Destination Box in destination patch level. + * @param src_box Source Box in source patch level. + * @param refine_data Pointer to array of refine data items. + * @param item_id Integer index of RefineClass::Data item associated * with transaction. * @param box Optional const reference to box defining region of * refine transaction. Default is an empty box. - * @param use_time_interpolation Optional boolean flag indicating whether the - * refine transaction involves time interpolation. + * @param use_time_interpolation Optional boolean flag indicating whether + * the refine transaction involves time interpolation. * Default is false. + * + * @pre (dst_level->getDim() == src_level->getDim()) && + * (dst_level->getDim() == dst_box.getDim()) && + * (dst_level->getDim() == src_box.getDim()) && + * (dst_level->getDim() == box.getDim()) */ virtual boost::shared_ptr allocate( const boost::shared_ptr& dst_level, const boost::shared_ptr& src_level, const boost::shared_ptr& overlap, - const hier::Box& dst_mapped_box, - const hier::Box& src_mapped_box, - int ritem_id, + const hier::Box& dst_box, + const hier::Box& src_box, + const RefineClasses::Data ** refine_data, + int item_id, const hier::Box& box, // Default in v 2.x = hier::Box() bool use_time_interpolation = false) const; /*! - * @brief Virtual function allowing transaction factory to preprocess scratch - * space data before transactactions use it if they need to. This function is - * optional for the concrete transaction factory object. + * @brief Virtual function allowing transaction factory to preprocess + * scratch space data before transactactions use it if they need to. This + * function is optional for the concrete transaction factory object. * The default implementation is a no-op. * - * @param level boost::shared_ptr to patch level holding scratch data. + * @param level boost::shared_ptr to patch level holding scratch + * data. * @param fill_time Double value of simulation time corresponding to * RefineSchedule operations. - * @param preprocess_vector Const reference to ComponentSelector that indicates - * patch data array indices of scratch patch data objects - * to preprocess. + * @param preprocess_vector Const reference to ComponentSelector that + * indicates patch data array indices of scratch patch + * data objects to preprocess. */ virtual void preprocessScratchSpace( @@ -122,13 +117,10 @@ class StandardRefineTransactionFactory:public RefineTransactionFactory // The following two functions are not implemented StandardRefineTransactionFactory( const StandardRefineTransactionFactory&); - void + StandardRefineTransactionFactory& operator = ( const StandardRefineTransactionFactory&); - const RefineClasses::Data** d_refine_items; - int d_num_refine_items; - }; } diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.C b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.C index bca0c11e..6641f189 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.C +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.C @@ -3,14 +3,10 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ - -#ifndef included_xfer_VariableFillPattern_C -#define included_xfer_VariableFillPattern_C - #include "SAMRAI/xfer/VariableFillPattern.h" namespace SAMRAI { @@ -42,4 +38,3 @@ VariableFillPattern::~VariableFillPattern() } } -#endif diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.h b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.h index 7b219eeb..9c6324c6 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.h +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/VariableFillPattern.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Abstract fill pattern class to provide interface for stencils * ************************************************************************/ @@ -17,7 +17,7 @@ #include "SAMRAI/hier/BoxOverlap.h" #include "SAMRAI/hier/PatchDataFactory.h" -#include +#include "boost/shared_ptr.hpp" #include namespace SAMRAI { @@ -39,8 +39,8 @@ namespace xfer { * near a patch boundary. * * @see hier::BoxOverlap - * @see xfer::RefineAlgorithm - * @see xfer::RefineSchedule + * @see RefineAlgorithm + * @see RefineSchedule */ class VariableFillPattern @@ -99,19 +99,21 @@ class VariableFillPattern * @param[in] fill_boxes list representing all of the space on a patch * or its ghost region that may be filled by a * refine operator (cell-centered represtentation) + * @param[in] node_fill_boxes node-centered representation of fill_boxes * @param[in] patch_box box representing the patch where a refine operator * will fill data. (cell-centered representation) * @param[in] data_box box representing the full extent of the region * covered by a patch data object, including all * ghosts (cell-centered representation) - * @param[in] patch_data_factory patch data factory for the data that is to be - * filled + * @param[in] patch_data_factory patch data factory for the data that is to + * be filled * * @return boost::shared_ptr to the calculated overlap object */ virtual boost::shared_ptr computeFillBoxesOverlap( const hier::BoxContainer& fill_boxes, + const hier::BoxContainer& node_fill_boxes, const hier::Box& patch_box, const hier::Box& data_box, const hier::PatchDataFactory& patch_data_factory) const = 0; @@ -132,7 +134,7 @@ class VariableFillPattern private: VariableFillPattern( const VariableFillPattern&); // not implemented - void + VariableFillPattern& operator = ( const VariableFillPattern&); // not implemented diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual.dox index 397adf55..c82ee415 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_datamovers.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_datamovers.dox index dffd97bd..82ada5a2 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_datamovers.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_datamovers.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_operators.dox b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_operators.dox index d414f4e7..28536efa 100644 --- a/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_operators.dox +++ b/base/SAMRAI/SAMRAI/source/SAMRAI/xfer/dox/manual_operators.dox @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Generation of SAMRAI Doxygen source code manual * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/scripts/change_copyright b/base/SAMRAI/SAMRAI/source/scripts/change_copyright index 021e7033..b376571e 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/change_copyright +++ b/base/SAMRAI/SAMRAI/source/scripts/change_copyright @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: bash script to update copyright dates in SAMRAI files ## ######################################################################### @@ -29,7 +29,7 @@ #============================================================================= # First find all the files with old copyright dates #============================================================================= -find . -type f ! -name \*.svn\* -exec grep -l "1997-2012" {} \; > files +find . -type f ! -name \*.svn\* -exec grep -l "1997-2016" {} \; > files #============================================================================= # Replace the old copyright dates with new dates @@ -38,7 +38,7 @@ for i in `cat files` do echo $i cp $i $i.sed.bak - sed "s/1997-2011/1997-2012/" $i.sed.bak > $i + sed "s/1997-2016/1997-2016/" $i.sed.bak > $i done #============================================================================= diff --git a/base/SAMRAI/SAMRAI/source/scripts/cmp.pl b/base/SAMRAI/SAMRAI/source/scripts/cmp.pl index ba1097ad..fe34c32d 100644 --- a/base/SAMRAI/SAMRAI/source/scripts/cmp.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/cmp.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to compare two files but ignore CVS comments ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/copy-if-change b/base/SAMRAI/SAMRAI/source/scripts/copy-if-change deleted file mode 100755 index fd7f92cf..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/copy-if-change +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: copy files if there is a change (ignoring CVS comments) -## -######################################################################### - -PERL=${PERL:-perl} - -# -# Check usage - must have at least two arguments -# - -BIN=`dirname $0` -if [ $# -le 1 ] ; then - echo "usage: copy-if-change ..." - exit 1 -fi - -# -# Get destination directory - check to make sure directory exists -# - -DIR=$1 ; shift -if [ ! -d $DIR ] ; then - echo "usage: copy-if-change ..." - exit 1 -fi - -# -# Copy SRC to DST if the two files are not the same -# - -for FILE in $*; do - SRC=$FILE - DST=$DIR/`basename $FILE` - echo "Checking "$SRC - if [ -r $DST ] ; then - if $PERL $BIN/cmp.pl $SRC $DST ; then - foo=foo # do nothing - else - echo " updating "$DST - cp -f $SRC $DST - fi - else - echo " creating "$DST - cp $SRC $DST - fi -done - -exit 0 diff --git a/base/SAMRAI/SAMRAI/source/scripts/create_configure b/base/SAMRAI/SAMRAI/source/scripts/create_configure index 7898fc8a..f2351617 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/create_configure +++ b/base/SAMRAI/SAMRAI/source/scripts/create_configure @@ -1,17 +1,35 @@ -#!/bin/bash -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Commands to create the autoconf configure script -## -######################################################################### - -rm -fr autom4te.cache -rm -fr config/aclocal.m4 -aclocal -I `pwd`/config --output=config/aclocal.m4 -autoheader -I config +#!/bin/sh + +# This is a short, non-critical script to issue the commands +# for rebuilding the configure script. + +topdir="`echo $0 | sed -e 's:^[^/]\{1,\}$:./\&:' -e 's:/[^/]\{1,\}$::'`/../.." + +set -x + +# Go to the top-level directory. +cd "$topdir" + +# We don't always have to remove the cache, but I'm not sure when we +# should so just remove it. +rm -rf autom4te.cache + +# This generates the aclocal.m4 file. +# aclocal grabs needed macros and put them in aclocal.m4. +# Having aclocal.m4 allows one to regenerate configure after +# a "minor change" without having to look for macros. +# A minor change is one that does not require a new macro. +aclocal"$AUTOMAKE_VERSION" -I `pwd`/config --output=config/aclocal.m4 + +# This generates config/SAMRAI_config.h.in +# The file is generated based on the AH_TOP and AH_BOTTOM macros +# and the numerous use of AC_DEFINE. +# +# We remove some macros because they conflict with other packages +# using autoconf, and we don't use these macros anyway. +autoheader"$AUTOCONF_VERSION" -I config sed -i -e 's/^\(#undef \(PACKAGE\|VERSION\)\)/\/\/ Removed due to name conflict \1/' config/SAMRAI_config.h.in -autoconf -I config +sed -i -e 's/\(F77_FUNC\)/SAMRAI_\1/' config/SAMRAI_config.h.in + +# This generates configure +autoconf"$AUTOCONF_VERSION" -I config || exit 1 diff --git a/base/SAMRAI/SAMRAI/source/scripts/cscope_create_database b/base/SAMRAI/SAMRAI/source/scripts/cscope_create_database index 63e627a9..59ce5207 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/cscope_create_database +++ b/base/SAMRAI/SAMRAI/source/scripts/cscope_create_database @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: shell script generating Cscope cross reference symbol database ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/depend b/base/SAMRAI/SAMRAI/source/scripts/depend index 8a7f5115..5acb0fbb 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/depend +++ b/base/SAMRAI/SAMRAI/source/scripts/depend @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: shell script to generate dependencies for SAMRAI files ## ######################################################################### @@ -20,7 +20,7 @@ bindir=`cd $BIN && pwd` PERL=${PERL:-perl} COMP="$PERL $BIN/cmp.pl" -DIRS=`find . -type d -print | grep -v '\(OLD|NEW|BAK|SAVE|to_be_implemented\|noprefix\|CVS\|\.svn\|\.git\|\.hg\)'` +DIRS=`find . -type d -print | grep -v '\(config\|OLD\|NEW\|BAK\|SAVE\|to_be_implemented\|noprefix\|CVS\|\.svn\|\.git\|\.hg\)'` for DIR in $DIRS ; do # @@ -28,8 +28,16 @@ for DIR in $DIRS ; do # echo "Checking dependencies in directory "$DIR - FILES=`(cd $DIR; echo *.[fCc])` - if [ "*.[fCc]" != "$FILES" ] ; then + SRCFILES=`(cd $DIR; echo *.[fCc])` + M4FILES=`(cd $DIR; echo *.m4)` + FILES="" + if [ "*.[fCc]" != "$SRCFILES" ] ; then + FILES=$SRCFILES + fi + if [ "*.m4" != "$M4FILES" ] ; then + FILES="$FILES $M4FILES" + fi + if [ "" != "$FILES" ] ; then (cd $DIR && perl $bindir/depend.pl . '-' $FILES) # diff --git a/base/SAMRAI/SAMRAI/source/scripts/depend.pl b/base/SAMRAI/SAMRAI/source/scripts/depend.pl index ae7ee4f0..79024932 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/depend.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/depend.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to generate dependencies for SAMRAI files ## ######################################################################### @@ -12,19 +12,14 @@ # Output a Makefile.depend file for .C src files. A dependency is # created for each .C, .h, and .I recursively included file. -# In order to speed compilation the makefile flag -# DEPENDS_ON_TEMPLATE_IMPLEMENTATION is used to control dependency -# on .C files. The rules for determining dependency are: +# The rules for determining dependency are: # # .h and .I files always included in the dependency # -# The src file is always included in the dependency. +# The src file is always included in the dependency. # -# .C files included directly by the src file are always included in -# the dependency. -# -# .C files that are recursively included are ONLY included in the -# dependency if DEPENDS_ON_TEMPLATE_IMPLEMENTATION is "yes". +# .C files included directly by the src file are always included in +# the dependency. # use File::Basename; @@ -40,7 +35,7 @@ } else { opendir( SRCDIR, $src_dir ) || die "Cannot open directory $src_dir"; - @FILES = sort grep( /.*\.[fCc]$/, (readdir SRCDIR) ); + @FILES = sort grep( /.*\.[mfCc]$/, (readdir SRCDIR) ); closedir SRCDIR; } $DEPEND = "Makefile.depend.tmp"; @@ -87,7 +82,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -140,6 +135,7 @@ } @deps = sort(keys %dset); + print "file $cfile depends on: ", join(" ",@deps), "\n" if $debug; for (@deps) { $_ = &fixName($_); } print "$cfile depends on @deps\n" if $debug; # Add SAMRAI_config.h because everything should depend on it, @@ -163,6 +159,20 @@ sub getMoreDeps { ) { push( @deps, $_ ) } + elsif ( s/^include\(([^\"]+)\)dnl\s*/\1/o + && /[^\s]/o + ) { + if ( s/^PDAT_FORTDIR/SAMRAI\/pdat\/fortran/o + && /[^\s]/o + ) { + push( @deps, $_ ) + } + elsif ( s/^FORTDIR\///o + && /[^\s]/o + ) { + push( @deps, $_ ) + } + } } close DEPFILE; if ( $debug ) { @@ -180,10 +190,14 @@ sub getFullPath { my $FILE = shift(@_); for (@INCPATH) { - print "checking if $_/$FILE is in SAMRAI source\n" if $debug; + print "checking if $_/$FILE is in SAMRAI source ... " if $debug; if (-r "$_/$FILE") { + print "yes.\n" if $debug; return( $_ ne '.' ? "$_/$FILE" : $FILE ); } + else { + print "no.\n" if $debug; + } } return(""); @@ -206,6 +220,7 @@ sub printDependencies { my $LIBLINE = $SRC_FILE; $LIBLINE =~ s/^(.*)\.[Cfc]/$1.o/o; + $LIBLINE =~ s/^(.*)\.m4/$1.o/o; print OUTFILE "FILE_$FILENUMBER=$LIBLINE\n"; @@ -246,12 +261,11 @@ sub printDependencies { print OUTFILE "DEPENDS_$FILENUMBER:=\\\n"; printTabbedFiles(@OTHER_DEPS); print OUTFILE "\n"; - print OUTFILE "ifeq (\${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes)\n"; print OUTFILE "DEPENDS_$FILENUMBER +=\\\n"; printTabbedFiles(@C_SOURCE_DEPS); - print OUTFILE "endif\n\n"; + print OUTFILE "\n\n"; - $LIBLINE="\${FILE_$FILENUMBER:X.o=\${NDIM}.o}: \${DEPENDS_$FILENUMBER}"; + $LIBLINE="\${FILE_$FILENUMBER}: \${DEPENDS_$FILENUMBER}"; print OUTFILE "$LIBLINE\n\n"; } @@ -293,13 +307,20 @@ sub printTabbedFiles { sub fixName { $_ = shift(@_); - print "Fixing name $_\n" if $debug; + print "Fixing name $_ -> " if $debug; if ( m|(.*)/SAMRAI/(.*)$|o ) { + print "\$(INCLUDE_SAM)/SAMRAI/$2\n" if $debug; return("\$(INCLUDE_SAM)/SAMRAI/$2"); } + if ( m|(.*)/test/testlib/(.*)$|o ) { + print "\$(TESTLIBDIR)/$2\n" if $debug; + return("\$(TESTLIBDIR)/$2"); + } if ( m|/([^/]*)$|o ) { + print "$1\n" if $debug; return($1); } else { + print "$_\n" if $debug; return($_); } } diff --git a/base/SAMRAI/SAMRAI/source/scripts/indent.pl b/base/SAMRAI/SAMRAI/source/scripts/indent.pl index fc0e007f..59a5b167 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/indent.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/indent.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to indent SAMRAI ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/make-template.pl b/base/SAMRAI/SAMRAI/source/scripts/make-template.pl deleted file mode 100644 index 56ebe58c..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/make-template.pl +++ /dev/null @@ -1,358 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: perl script to create template files for the SAMRAI repository -## -######################################################################### - -# -# Usage: perl make-template.pl -# perl make-template.pl standard ./ tbox::Array double -# perl make-template.pl char ./ tbox::Pointer tbox::Array char* -# -# is used to accumulate the names of the files generated for later -# use in constructing the makefile. - -# This script should probably be reworked. It does not handle templates -# on more than one type very well and the NDIM handling is a -# bit of a kludge. - -# -# Read the input directory, calculate the file name, and create the class -# - -$OBJFILE = shift(@ARGV); -$DIR = shift(@ARGV); -$PACKAGE = shift(@ARGV); -$FILE = getFileName(@ARGV); -$CLASS = getClassName(@ARGV); -$_ = $CLASS; - - - - - -# Append the file generated to list of files -open(OUTFILE, ">>$DIR/$OBJFILE") || die "Cannot open filename file $DIR/$OBJFILE"; -print OUTFILE "$FILE.C\n"; -close(OUTFILE); - -# -# List classes require special static data member instantiation -# - -if (/^tbox::List$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - if ($FILE =~ /HDFDatabase|VisItDataWriter/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - if ($FILE =~ /SiloDatabase/) { - print OUTFILE "#ifdef HAVE_SILO\n"; - } - print OUTFILE "#ifdef LACKS_STATIC_DATA_INSTANTIATION\n"; - print OUTFILE "$NODE *$NODE\::s_free_list=0;\n"; - print OUTFILE "bool $NODE\::s_registered_callback=false;\n"; - print OUTFILE "#endif\n"; - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "template class $ITER;\n"; - print OUTFILE "template class $NODE;\n"; - if ($FILE =~ /HDFDatabase|VisItDataWriter/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /SiloDatabase/) { - print OUTFILE "#endif\n"; - } - printFooter(); - close(OUTFILE); - -# -# Special template instantiation for PETSc vector classes -# - -} elsif (/^(PETScAbstractVectorReal|PETSc_SAMRAIVectorReal|SNES_SAMRAIContext)/) { - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - print OUTFILE "#ifdef HAVE_PETSC\n"; - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "#endif\n"; - printFooter(); - close(OUTFILE); - - -# -# Special template instantiation for Hyper classes -# - -} elsif (/^(CellPoissonHypreSolver)/) { - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - print OUTFILE "#ifdef HAVE_HYPRE\n"; - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "#endif\n"; - printFooter(); - close(OUTFILE); - - -# -# Special template instantiation for KINSOL classes -# - -} elsif (/^(KINSOL_SAMRAIContext)/) { - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - print OUTFILE "#ifdef HAVE_SUNDIALS\n"; - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "#endif\n"; - printFooter(); - close(OUTFILE); - -# -# Special template instantiation for Sundials classes -# - -} elsif (/^(Sundials_SAMRAIVector)/) { - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - print OUTFILE "#ifdef HAVE_SUNDIALS\n"; - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "#endif\n"; - printFooter(); - close(OUTFILE); - - -} elsif (/^Box\/\1/; - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - if ($FILE =~ /HDF/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#ifdef HAVE_SILO\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "template class $ITER;\n"; - print OUTFILE "template std::istream& operator >> (std::istream& s, $BASECLASS& box);\n"; - print OUTFILE "template std::ostream& operator << (std::ostream& s, const $BASECLASS& box);\n"; - - if ($FILE =~ /HDF/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /appu_VisIt/) { - print OUTFILE "#endif\n"; - } - printFooter(); - close(OUTFILE); - -} elsif (/^IntVector\/\1/; - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - if ($FILE =~ /HDF/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#ifdef HAVE_SILO\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "template std::istream& operator >> (std::istream& s, $BASECLASS& box);\n"; - print OUTFILE "template std::ostream& operator << (std::ostream& s, const $BASECLASS& box);\n"; - - if ($FILE =~ /HDF/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#endif\n"; - } - printFooter(); - close(OUTFILE); - -} elsif (/^PatchLevel\/\1/; - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - if ($FILE =~ /HDF/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#ifdef HAVE_SILO\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - print OUTFILE "template class $CLASS;\n"; - print OUTFILE "template class $ITER;\n"; - if ($FILE =~ /HDF/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#endif\n"; - } - printFooter(); - close(OUTFILE); - -# -# Other templates do not require special treatment (except for HDF classes and VisIt classes, which use HDF) -# -} else { - open(OUTFILE, ">$DIR/$FILE.C") || die "Cannot open output file $DIR/$FILE.C"; - printHeader($FILE, @ARGV); - if ($FILE =~ /HDF/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#ifdef HAVE_SILO\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#ifdef HAVE_HDF5\n"; - } - print OUTFILE "template class $CLASS;\n"; - if ($FILE =~ /HDF/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /Silo/) { - print OUTFILE "#endif\n"; - } - if ($FILE =~ /VisIt/) { - print OUTFILE "#endif\n"; - } - printFooter(); - close(OUTFILE); -} - -# -# Exit the script -# - -exit(0); - -# -# Construct a filename from the collection of class names -# - -sub getFileName { - my $FILE = shift(@_); - - $FILE =~ s/::/__/g; - $FILE =~ s/\,/_/g; - - for (@_) { - (my $TYPE = $_) =~ s/\*/Pointer/g; - $TYPE =~ s/::/__/g; - $TYPE =~ s/\<|\>|\,/_/g; - - $FILE .= "-$TYPE"; - - } - - # If the file is NDIM based add X to the filename - # to pickup the correct build rule. - if ($FILE =~ /NDIM/) { - $FILE .= X; - } - - return $FILE; -} - -# -# Generate the template class name (with brackets) from the name list -# - -sub getClassName { - my $NAME = shift; - if ($#_ >= 0) { - $NAME .= "< "; - $NAME .= getClassName(@_); - $NAME .= " >"; - } - return($NAME); -} - -# -# Print header information to OUTFILE (banner, includes, namespace) -# - -sub printHeader { - my $FILE = shift(@_); - my $CLASS = shift(@_); - - # classname comes after the package prefix (if any) - ($CLASSFILE = $CLASS) =~ s/(.*)::(.*)/\2/g; - $CLASSFILE = "SAMRAI/" . $PACKAGE . "/" . $CLASSFILE; - - print OUTFILE <<_EOM_; -// -// File: $FILE.C -// Package: SAMRAI templates -// Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -// Description: Template file automatically generated by make-template.pl -// - -#include "$CLASSFILE.h" -#include "$CLASSFILE.C" -_EOM_ - - # There may be comma seperated class lists so split them - # apart so we can include each of the headers - @classes=split(/[\s,]/, join(" ", @_)); - for (@classes) { - # strip off pointer for classnames - $_ =~ s/\*//g; - if (/^NDIM$/) { - # NDIM is an int, no header required - } elsif (/dcomplex|NDIM\,dcomplex/) { - print OUTFILE "#include \"SAMRAI/tbox/Complex.h\"\n"; - } elsif (/string|NDIM\,string/) { - print OUTFILE "#include \nusing namespace std;\n"; - } elsif (/NDIM\,.*/) { - } elsif (/^(.*)::(.*)\$/) { - print OUTFILE "#include \"SAMRAI/$1/$2.h\"\n"; - } elsif (/^(.*)::(.*)\::.*/) { - print OUTFILE "#include \"SAMRAI/$1/$2.h\"\n"; - } elsif (/^([^:]+)\::.*/) { - print OUTFILE "#include \"SGS SAMRAI/$PACKAGE/$1.h\"\n"; - } elsif (/^([^:]+)::(.*)::(.*)/) { - print OUTFILE "#include \"SAMRAI/$1/$2.h\"\n"; - } elsif (/^([^:]+)::(.*)/) { - print OUTFILE "#include \"SAMRAI/$1/$2.h\"\n"; - } elsif (!/^(bool)|(char)|(double)|(float)|(int)$/) { - print OUTFILE "#include \"SAMRAI/$PACKAGE/$_.h\"\n"; - } - } - print OUTFILE "\n"; - - print OUTFILE "namespace SAMRAI {\n"; - print OUTFILE " namespace $PACKAGE {\n"; -} - -# -# Print footer information to OUTFILE (closes the SAMRAI namespace) -# - -sub printFooter { - print OUTFILE "}\n"; - print OUTFILE "}\n"; -} diff --git a/base/SAMRAI/SAMRAI/source/scripts/object.pl b/base/SAMRAI/SAMRAI/source/scripts/object.pl deleted file mode 100644 index 043c206f..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/object.pl +++ /dev/null @@ -1,114 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: perl script to create Makefile.objects.tmp files from .C files -## -######################################################################### - -# -# Usage: object.pl <.C files> -# - -# -# Set up global directory information and output depend file -# - -$TARGET = shift(@ARGV); -@FILES = @ARGV; -$DEPEND = "Makefile.objects.tmp"; - -$TABLEN = 8; -$LINLEN = 72; - -# -# Write an output object file that contains the .o files from the .C input -# - -open(OUTFILE, ">>$DEPEND") || die "Cannot open output file $DEPEND..."; - -$EMPTY=""; - -if ($TARGET eq "libdefault") { - print OUTFILE "##\n"; - print OUTFILE "## File:\tMakefile.objects\n"; - print OUTFILE "## Package:\tSAMRAI\n"; - print OUTFILE "## Copyright:\t(c) 1997-2012 Lawrence Livermore National Security, LLC\n"; - print OUTFILE "## Release:\t\$N${EMPTY}ame: \$\n"; - print OUTFILE "## Revision:\t\$R${EMPTY}evision: \$\n"; - print OUTFILE "## Modified:\t\$D${EMPTY}ate: \$\n"; - print OUTFILE "## Description:\tmakefile objects\n"; - print OUTFILE "##\n\n"; -} - -print OUTFILE "\n\n"; - -@FILES=sort(@FILES); - -# Reorder list of files by nested template level. This is done so the -#"real" templates are compiled before things like Pointers, Lists, -#etc. - -for(@FILES) { - - # Find number of "-" characters, this is the number of nested - #templates. - - $string=$_; - $lookfor="-"; - $template_depth=0; - $pos = $[; - while (( $pos = index($string,$lookfor,$pos)) >= $[) { - $pos++; - $template_depth++; - } - - # Create 2D array ordered by template depth - - push @{$SORTED_FILES[$template_depth]}, $string; -} - -# Rebuild list of files with new order - -@FILES=(); -for $template_depth (0 .. $#SORTED_FILES) { - @FILES = (@FILES, @{$SORTED_FILES[$template_depth]}); -} - -printObjects(@FILES); -close(OUTFILE); - -# -# Print out object data in a pleasing manner -# - -sub printObjects { - my @OBJS = @_; - - print OUTFILE "$TARGET:\t"; - $CURLEN = $TABLEN; - for (@OBJS) { - $OBJ = $_; - $OBJ =~ s/^(.*)\.C/$1.o/; - $OBJ =~ s/X.o/\$\{NDIM\}\.o/; - if (length($OBJ)+$CURLEN >= $LINLEN) { - $NTAB = ($LINLEN-$CURLEN)/$TABLEN; - for ($i = 0; $i < $NTAB; $i++) { - print OUTFILE "\t"; - } - print OUTFILE "\\\n"; - print OUTFILE "\t"; - $CURLEN = $TABLEN; - } - if ($CURLEN == $TABLEN) { - print OUTFILE "$OBJ"; - $CURLEN += length($OBJ); - } else { - print OUTFILE " $OBJ"; - $CURLEN += length($OBJ)+1; - } - } - print OUTFILE "\n"; -} diff --git a/base/SAMRAI/SAMRAI/source/scripts/object.sh b/base/SAMRAI/SAMRAI/source/scripts/object.sh deleted file mode 100644 index cc6ed464..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/object.sh +++ /dev/null @@ -1,78 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: shell script to update Makefile.objects files for templates -## -######################################################################### - -# -# Generate object information in the template subdrectories -# - -PERL=${PERL:-perl} -DIFF="$PERL ../../../scripts/cmp.pl" -OBJECTPL="$PERL ../../../../scripts/object.pl" - -SRCDIR=../$1 -DIR=$2 -rm -f $DIR/Makefile.objects.tmp - -# -# Generate a Makefile.objects.tmp file in the specified directory -# - -echo "Checking objects in directory "$DIR - - - -(cd $DIR; $OBJECTPL libdefault \ - `cat $SRCDIR/default.filenames` \ - `cat $SRCDIR/Double.filenames` \ - `cat $SRCDIR/Integer.filenames`\ - `cat $SRCDIR/double.filenames` \ - `cat $SRCDIR/int.filenames` \ - ) - -(cd $DIR; $OBJECTPL libchar \ - `cat $SRCDIR/char.filenames` \ - ) - -(cd $DIR; $OBJECTPL libbool \ - `cat $SRCDIR/bool.filenames` \ - ) - -(cd $DIR; $OBJECTPL libfloat\ - `cat $SRCDIR/float.filenames` \ - `cat $SRCDIR/Float.filenames` \ - ) -(cd $DIR; $OBJECTPL libdcomplex \ - `cat $SRCDIR/dcomplex.filenames` \ - `cat $SRCDIR/Complex.filenames` \ - ) - -# -# If Makefile.objects does not exist, then create it -# - -if [ ! -r $DIR/Makefile.objects ] ; then - echo " creating "$DIR/Makefile.objects - mv -f $DIR/Makefile.objects.tmp $DIR/Makefile.objects - -# -# Otherwise, copy if the two files are not the same. Remove the CVS -# portions of the header to ignore changes in date/revision/modified. -# - -else - if $DIFF $DIR/Makefile.objects.tmp $DIR/Makefile.objects; then - rm -f $DIR/Makefile.objects.tmp - else - echo " updating "$DIR/Makefile.objects - mv -f $DIR/Makefile.objects.tmp $DIR/Makefile.objects - fi -fi - -exit 0 diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findClassNames.pl b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findClassNames.pl index ae8952f4..0ce16750 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findClassNames.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findClassNames.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to update Xd sed files to templates on DIM ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles index f151fcb1..4c5577ef 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: Find all header files ## diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles.pl b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles.pl index 5a4a1a3f..3de9a2c1 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/findHeaderFiles.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to update Xd sed files to templates on DIM ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/removeNameKeyword.pl b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/removeNameKeyword.pl index c96d5cf9..cc3e008d 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/removeNameKeyword.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/removeNameKeyword.pl @@ -5,14 +5,14 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: $Description ## ######################################################################### ## File: $URL$ ## Package: SAMRAI application -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: Script in source-manipulation utility. diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards index c3942aa4..ff444d1d 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: shell script to convert 1.x codes to 2.0 ## diff --git a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards.pl b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards.pl index 049ccbd7..7de2b25b 100755 --- a/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards.pl +++ b/base/SAMRAI/SAMRAI/source/scripts/source_manipulation/replaceIncludeGuards.pl @@ -4,7 +4,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: perl script to update Xd sed files to templates on DIM ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/source/scripts/update b/base/SAMRAI/SAMRAI/source/scripts/update deleted file mode 100755 index e404b7ec..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/update +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: shell script to run updateXd, include, and depend -## -######################################################################### - -BIN=`dirname $0` - -perl $BIN/updateXd.pl -sh $BIN/depend - -if test -n "`pwd | grep ./source/.`" ; then - echo "Warning - you may need to re-run $BIN/depend in SAMRAI/source..." -fi - -exit 0 diff --git a/base/SAMRAI/SAMRAI/source/scripts/updateXd.pl b/base/SAMRAI/SAMRAI/source/scripts/updateXd.pl deleted file mode 100755 index ec012745..00000000 --- a/base/SAMRAI/SAMRAI/source/scripts/updateXd.pl +++ /dev/null @@ -1,138 +0,0 @@ -#! /usr/bin/perl -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: shell script to update 1d, 2d, and 3d sed files -## -######################################################################### - -# -# Convert all files of the form "*X.*.sed" into their dimension-dependent -# forms in directories 1d, 2d, and 3d. -# - -use File::Basename; -use File::Find; -use Cwd; - -# -# Disallow running from certain directories. -# - -my $pwd = cwd; -die basename($0) . " should not be run from your current directory" - if $pwd =~ m:\b(source/test|source/scripts)(/|$):; - - -my $debug = 0; - - -# -# Convert all files of the form "*[123]d.m4" into their dimension-dependent -# forms in directories 1d, 2d, and 3d. -# - -# -# Find the m4 files to convert. -# -@allfiles = (); -sub selectm4file { - # This subroutine selects the dimensional m4 files in a find command, - # excluding certain directories. - # Do not run in applications directory. - if ( $File::Find::name =~ m!/(test|scripts|CVS|\.hg|[123]d)$!o ) { - $File::Find::prune = true; - } - elsif ( -f && m/.*[123]d\.m4$/o ) { - push @allfiles, $File::Find::name; - $allfiles[$#allfiles] =~ s|^\./||o; - } -} -print "Scanning...\n" if ( $debug > 0 ); -find( \&selectm4file, '.' ); -print "Done.\n" if ( $debug > 0 ); -# for (@allfiles) { print "$_\n"; } - -# -# Recurse through all directories with sed files and update 1d, 2d, and 3d -# - -my $savepwd = `pwd`; chop $savepwd; -for $dim (1,2,3) { - @dimfiles = grep /${dim}d\.m4$/, @allfiles; - print "dimfiles: @dimfiles\n" if ( $debug > 0 ); - - for $mfile (@dimfiles) { - print "Checking $mfile\n"; - $mdir = dirname $mfile; - $mbase = basename $mfile; - ( $dfile = $mbase ) =~ s/d\.m4$/d.f/o; - $tpath = "$mdir/$dfile.tmp"; # Temporary file. - print "dfile: $dfile\n" if ( $debug > 0 ); - print "tpath: $tpath\n" if ( $debug > 0 ); - print "creating $tpath\n" if ( $debug > 0 ); - chdir $mdir || die "Cannot cd to $mdir"; - open MF, "m4 $mbase |" || die "Cannot launch 'm4 $mbase'"; - chdir($savepwd) - || die "Cannot cd back to $savepwd from $mdir due to $!"; - open TF, "> $tpath" || die "Cannot open file $tpath"; - while ( $str = ) { - # Remove CVS-substituted string. - $str =~ s/\$((Id|Name|Revision|Date)[^\$]*)\$//go; - print TF $str; - } - close MF || die "Cannot close process 'm4 $mfile'"; - close TF || die "Cannot close file $tpath"; - if ( &cmpfiles( "$mdir/$dfile", $tpath ) ) { - print "renaming $tpath to $dfile due to difference\n" - if ( $debug > 0 ); - rename( $tpath, "$mdir/$dfile" ) - || die "Cannot rename $tpath to $dfile"; - } else { - print "Removing $tpath due to no difference\n" - if ( $debug > 0 ); - unlink $tpath || die "Cannot remove $tpath"; - } - } -} - - - -# -# Subroutine to check if two files are the same. -# -sub cmpfiles { - -($ANAME,$BNAME) = @_; - -return 1 unless ( -r $ANAME && -r $BNAME ); -open(AFILE, "$ANAME") || die "Cannot open input file $ANAME..."; -open(BFILE, "$BNAME") || die "Cannot open input file $BNAME..."; - -while (!eof(AFILE) && !eof(BFILE)) { - $ALINE = ; - $BLINE = ; - if ($ALINE ne $BLINE) { - close AFILE; - close BFILE; - return 1; - } -} - -if (eof(AFILE) && eof(BFILE)) { - $rvalue = 0; -} else { - $rvalue = 1; -} - -close AFILE; -close BFILE; -return $rvalue; - -} - - - diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.depend new file mode 100644 index 00000000..9d3aa8a2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.depend @@ -0,0 +1,91 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=main.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartition.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.in b/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.in new file mode 100644 index 00000000..5aafbbe8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/Makefile.in @@ -0,0 +1,75 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for timer and statistician main programs +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/Connector +VPATH = @srcdir@ +TESTTOOLS = ../testtools +OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml + +default: check + +include $(OBJECT)/config/Makefile.config + +CPPFLAGS_EXTRA= -DTESTING=1 + +main: main.o $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(LIBSAMRAI) $(LDLIBS) -o main + +NUM_TESTS = 3 + +TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +checkcompile: main + +check: checkcompile + @for i in test_inputs/*.input ; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +check2d: + $(MAKE) check + +check3d: + $(MAKE) check + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/main.C b/base/SAMRAI/SAMRAI/source/test/Connector/main.C new file mode 100644 index 00000000..e0b8d1c5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/main.C @@ -0,0 +1,485 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test program to test Connector class + * + ************************************************************************/ + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/MemoryDatabase.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/hier/BoxLevel.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/AssumedPartition.h" +#include "SAMRAI/geom/GridGeometry.h" + +#include "boost/make_shared.hpp" + +using namespace std; + +using namespace SAMRAI; +using namespace hier; + +/*! + * @brief Primitive BoxGenerator (independent of mesh package) + * creating boxes using an AssumedPartition followed by an index + * filter to keep a subset of boxes. + */ +struct PrimitiveBoxGen { + boost::shared_ptr d_geom; + hier::AssumedPartition d_ap; + // Index filtering parameters. + enum IndexFilter { ALL = 0 /* Keep all boxes */, + INTERVAL = 1 /* Keep d_num_keep, discard d_num_discard */, + LOWER = 2 /* Keep indices below d_frac */, + UPPER = 3 /* Keep indices above d_frac */ + }; + std::string d_nickname; + double d_avg_parts_per_rank; + int d_index_filter; + int d_num_keep; + int d_num_discard; + double d_frac; + PrimitiveBoxGen( + tbox::Database& database, + const boost::shared_ptr& geom): + d_avg_parts_per_rank(1.0) + { + d_geom = geom; + getFromInput(database); + } + PrimitiveBoxGen( + const PrimitiveBoxGen& other): + d_geom(other.d_geom), + d_ap(other.d_ap), + d_avg_parts_per_rank(other.d_avg_parts_per_rank), + d_index_filter(other.d_index_filter), + d_num_keep(other.d_num_keep), + d_num_discard(other.d_num_discard), + d_frac(other.d_frac) { + } + void + getFromInput( + tbox::Database& input_db); + void + getBoxes( + hier::BoxContainer& boxes); +}; + +// Parameters in a specific test. +struct CommonTestParams { + std::string d_nickname; + int d_base_num; + int d_head_num; + std::string d_method; + // For method mod: + int d_denom; + // For method bracket: + int d_begin_shift; + int d_end_shift; + int d_inc; + // For method overlap: (no parameter) + CommonTestParams( + tbox::Database& test_db); + void + contriveConnector( + Connector& conn, + const std::vector& boxgens, + const std::vector& levels, + const hier::IntVector& connector_width); +}; + +CommonTestParams +getTestParametersFromDatabase( + tbox::Database& test_db); + +int main( + int argc, + char* argv[]) +{ + tbox::SAMRAI_MPI::init(&argc, &argv); + tbox::SAMRAIManager::initialize(); + tbox::SAMRAIManager::startup(); + + const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(); + + int fail_count = 0; + + /* + * Process command line arguments. For each run, the input + * filename must be specified. Usage is: + * + * executable + */ + std::string input_filename; + + if (argc < 2) { + TBOX_ERROR("USAGE: " << argv[0] << " [case name]\n" + << " options:\n" + << " none at this time" << std::endl); + } else { + input_filename = argv[1]; + } + + /* + * Create block to force pointer deallocation. If this is not done + * then there will be memory leaks reported. + */ + { + /* + * Create input database and parse all data in input file. + */ + boost::shared_ptr input_db(new tbox::MemoryDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + boost::shared_ptr main_db = input_db->getDatabase("Main"); + + std::string base_name = "unnamed"; + base_name = main_db->getStringWithDefault("base_name", base_name); + + /* + * Modify basename for this particular run. + * Add the number of processes and the case name. + */ + std::string base_name_ext = base_name; + base_name_ext = base_name_ext + '-' + + tbox::Utilities::nodeToString(mpi.getSize()); + + /* + * Start logging. + */ + const std::string log_file_name = base_name_ext + ".log"; + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", log_all_nodes); + if (log_all_nodes) { + tbox::PIO::logAllNodes(log_file_name); + } else { + tbox::PIO::logOnlyNodeZero(log_file_name); + } + + const int rank = mpi.getRank(); + + { + + const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + + const hier::IntVector& refinement_ratio = hier::IntVector::getOne(dim); + + hier::IntVector connector_width(dim); + main_db->getIntegerArray("connector_width", + &connector_width[0], + connector_width.getDim().getValue()); + + if (!input_db->isDatabase("BlockGeometry")) { + TBOX_ERROR( + "getTestParametersFromDatabase: You must specify \"BlockGeometry\" in input database."); + } + // Note: Using GridGeometry only because BaseGridGeometry can't be instanstiated. + boost::shared_ptr grid_geom = + boost::make_shared( + dim, + "BlockGeometry", + input_db->getDatabase("BlockGeometry")); + + hier::BoxLevelConnectorUtils blcu; + + /* + * Generate BoxLevels and associated PrimitiveBoxGen objects. + */ + + std::vector levels; + std::vector boxgens; + + while (true) { + + std::string level_name("PrimitiveBoxGen"); + level_name += tbox::Utilities::intToString(static_cast(levels.size()), 1); + + boost::shared_ptr level_db = + input_db->getDatabaseWithDefault(level_name, boost::shared_ptr()); + + if (!level_db) { + break; + } + + PrimitiveBoxGen boxgen(*level_db, grid_geom); + BoxContainer boxes; + boxgen.getBoxes(boxes); + BoxLevel box_level(boxes, refinement_ratio, grid_geom); + blcu.addPeriodicImages(box_level, + grid_geom->getPeriodicDomainSearchTree(), connector_width); + box_level.cacheGlobalReducedData(); + + boxgens.push_back(boxgen); + levels.push_back(box_level); + + const BoxLevel& globalized = levels.back().getGlobalizedVersion(); + if (rank == 0) { + tbox::plog << "Globalized version of BoxLevel #" << levels.size() - 1 << ":\n" + << globalized.format("\t"); + } + } + + /* + * Read in and run tests. + */ + + int test_number = 0; + while (true) { + + std::string test_name("Test"); + test_name += tbox::Utilities::intToString(test_number++, 2); + + boost::shared_ptr test_db = + input_db->getDatabaseWithDefault(test_name, boost::shared_ptr()); + + if (!test_db) { + break; + } + + CommonTestParams testparams(*test_db); + + tbox::plog << "\n\n"; + tbox::pout << "Running " << test_name << " (" << testparams.d_nickname << ")\n"; + + /* + * Set up edges in forward by the contrivance specified + * in the test database. Then check transpose + * correctness. + */ + + hier::Connector forward(dim); + testparams.contriveConnector(forward, boxgens, levels, connector_width); + + tbox::plog << "Testing with:" + << "\nbase:\n" << forward.getBase().format("\t") + << "\nhead:\n" << forward.getHead().format("\t") + << "\nforward:\n" << forward.format("\t") + << std::endl; + + hier::Connector reverse(forward.getHead(), forward.getBase(), connector_width); + reverse.computeTransposeOf(forward); + tbox::plog << "Computed:\nreverse:\n" << reverse.format("\t") + << std::endl; + + size_t test_fail_count = forward.checkTransposeCorrectness(reverse); + fail_count += static_cast(test_fail_count); + if (test_fail_count) { + tbox::pout << "FAILED: " << test_name << " (" << testparams.d_nickname << ')' + << std::endl; + tbox::plog << "FAILED: " << test_name << " (" << testparams.d_nickname << ')' + << std::endl; + } else { + tbox::plog << "PASSED: " << test_name << " (" << testparams.d_nickname << ')' + << std::endl; + } + } + + } + + input_db->printClassData(tbox::plog); + + } + + if (fail_count == 0) { + tbox::pout << "\nPASSED: Connector" << std::endl; + } + + tbox::SAMRAIManager::shutdown(); + tbox::SAMRAIManager::finalize(); + tbox::SAMRAI_MPI::finalize(); + return fail_count; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void PrimitiveBoxGen::getFromInput(tbox::Database& test_db) +{ + int rank_begin = 0; + int rank_end = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + int index_begin = test_db.getIntegerWithDefault("index_begin", 0); + + d_avg_parts_per_rank = test_db.getDoubleWithDefault("avg_parts_per_rank", d_avg_parts_per_rank); + + d_nickname = test_db.getString("nickname"); + + std::string index_filter = test_db.getStringWithDefault("index_filter", "ALL"); + if (index_filter == "ALL") { + d_index_filter = PrimitiveBoxGen::ALL; + } else if (index_filter == "INTERVAL") { + d_index_filter = PrimitiveBoxGen::INTERVAL; + d_num_keep = test_db.getInteger("num_keep"); + d_num_discard = test_db.getInteger("num_discard"); + } else if (index_filter == "LOWER") { + d_index_filter = PrimitiveBoxGen::LOWER; + d_frac = test_db.getDouble("frac"); + } else if (index_filter == "UPPER") { + d_index_filter = PrimitiveBoxGen::UPPER; + d_frac = test_db.getDouble("frac"); + } + + d_ap.partition(d_geom->getPhysicalDomain(), + rank_begin, rank_end, index_begin, + d_avg_parts_per_rank); + + tbox::plog << "PrimitiveBoxGen::getFromInput():\n" + << "d_nickname = " << d_nickname << "\n" + << "d_avg_parts_per_rank = " << d_avg_parts_per_rank << "\n" + << "rank begin, end = " << rank_begin << " " << rank_end << '\n' + << "index_begin = " << index_begin << "\n" + << "index_filter = " << index_filter << "\n" + << "d_num_keep = " << d_num_keep << "\n" + << "d_num_discard = " << d_num_discard << "\n" + << "d_frac = " << d_frac << "\n" + << "generated AssumedPartition:\n"; + d_ap.recursivePrint(tbox::plog, "\t", 3); + + if (d_ap.selfCheck()) { + TBOX_ERROR("Error in setting up AssumedPartition d_ap (selfCheck failed).\n"); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void PrimitiveBoxGen::getBoxes(hier::BoxContainer& boxes) +{ + if (d_index_filter == ALL) { + int idbegin = d_ap.begin(); + int idend = d_ap.end(); + for (int id = idbegin; id < idend; ++id) { + boxes.push_back(d_ap.getBox(id)); + } + } else if (d_index_filter == INTERVAL) { + int idbegin = d_ap.begin(); + int idend = d_ap.end(); + int interval = d_num_keep + d_num_discard; + for (int id = idbegin; id < idend; ++id) { + int interval_id = id % interval; + if (interval_id < d_num_keep) { + boxes.push_back(d_ap.getBox(id)); + } + } + } else if (d_index_filter == LOWER) { + int threshold = d_ap.begin() + static_cast(d_frac * (d_ap.end() - d_ap.begin())); + int idbegin = d_ap.begin(); + int idend = tbox::MathUtilities::Min(threshold, d_ap.end()); + for (int id = idbegin; id < idend; ++id) { + boxes.push_back(d_ap.getBox(id)); + } + } else if (d_index_filter == UPPER) { + int threshold = d_ap.begin() + static_cast(d_frac * (d_ap.end() - d_ap.begin())); + int idbegin = tbox::MathUtilities::Max(threshold, d_ap.begin()); + int idend = d_ap.end(); + for (int id = idbegin; id < idend; ++id) { + boxes.push_back(d_ap.getBox(id)); + } + } else { + TBOX_ERROR("Invalid value of index_filter: " << d_index_filter); + } +} + +CommonTestParams::CommonTestParams( + tbox::Database& test_db): + d_denom(0), + d_begin_shift(0), + d_end_shift(0), + d_inc(0) +{ + d_nickname = test_db.getString("nickname"); + d_method = test_db.getString("method"); + + int level_num[2]; + test_db.getIntegerArray("levels", level_num, 2); + d_base_num = level_num[0]; + d_head_num = level_num[1]; + + if (d_method == "mod") { + d_denom = test_db.getInteger("denom"); + } else if (d_method == "bracket") { + d_begin_shift = test_db.getInteger("begin_shift"); + d_end_shift = test_db.getInteger("end_shift"); + d_inc = test_db.getInteger("inc"); + } else if (d_method == "overlap") { + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void CommonTestParams::contriveConnector( + Connector& conn, + const std::vector& boxgens, + const std::vector& levels, + const hier::IntVector& connector_width) +{ + const PrimitiveBoxGen& boxgen_base = boxgens[d_base_num]; + const PrimitiveBoxGen& boxgen_head = boxgens[d_head_num]; + const hier::BoxLevel& base = levels[d_base_num]; + const hier::BoxLevel& head = levels[d_head_num]; + + conn = Connector(base, head, connector_width); + + const int rank = conn.getBase().getMPI().getRank(); + + if (d_method == "mod") { + for (int i = boxgen_base.d_ap.beginOfRank(rank); i < boxgen_base.d_ap.endOfRank(rank); ++i) { + hier::Box l1box = boxgen_base.d_ap.getBox(i); + TBOX_ASSERT(l1box.getOwnerRank() == rank); + for (int j = boxgen_head.d_ap.begin(); j < boxgen_head.d_ap.end(); ++j) { + hier::Box l2box = boxgen_head.d_ap.getBox(j); + TBOX_ASSERT(l2box.getOwnerRank() >= 0 && + l2box.getOwnerRank() < conn.getBase().getMPI().getSize()); + if ((i + j) % d_denom == 0) { + conn.insertLocalNeighbor(l2box, l1box.getBoxId()); + } + } + } + tbox::plog << "Contrived connector using 'mod':" + << " denom=" << d_denom + << std::endl; + } else if (d_method == "bracket") { + for (int i = boxgen_base.d_ap.beginOfRank(rank); i < boxgen_base.d_ap.endOfRank(rank); ++i) { + hier::Box l1box = boxgen_base.d_ap.getBox(i); + TBOX_ASSERT(l1box.getOwnerRank() == rank); + + int begin = l1box.getLocalId().getValue() + d_begin_shift; + int end = l1box.getLocalId().getValue() + d_end_shift; + begin = tbox::MathUtilities::Max(begin, boxgen_head.d_ap.begin()); + end = tbox::MathUtilities::Min(end, boxgen_head.d_ap.end()); + + for (int j = begin; j < end; j += d_inc) { + hier::Box l2box = boxgen_head.d_ap.getBox(j); + TBOX_ASSERT(l2box.getOwnerRank() >= 0 && + l2box.getOwnerRank() < conn.getBase().getMPI().getSize()); + conn.insertLocalNeighbor(l2box, l1box.getBoxId()); + } + } + tbox::plog << "Contrived connector using 'bracket':" + << " begin_shift=" << d_begin_shift + << " end_shift=" << d_end_shift + << " inc=" << d_inc + << std::endl; + } else if (d_method == "overlap") { + hier::OverlapConnectorAlgorithm oca; + oca.findOverlaps(conn); + tbox::plog << "Contrived connector using 'overlap':" + << std::endl; + } else { + TBOX_ERROR("Contrivance method must be one of these: mod, bracket."); + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.2d.input b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.2d.input new file mode 100644 index 00000000..8c27cd93 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.2d.input @@ -0,0 +1,155 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for Connector tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "default.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + + dim = 2 + + connector_width = 2,2 +} + + +BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + +} + + + +PrimitiveBoxGen0 { + nickname = "Full domain" + avg_parts_per_rank = 5 + index_filter = "ALL" +} + +PrimitiveBoxGen1 { + nickname = "25% sparse domain" + avg_parts_per_rank = 5 + index_filter = "INTERVAL" + num_keep = 1 + num_discard = 3 +} + +PrimitiveBoxGen2 { + nickname = "lower .60" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.60 +} + +PrimitiveBoxGen3 { + nickname = "upper .60" + avg_parts_per_rank = 5 + index_filter = "UPPER" + frac = 0.40 +} + +PrimitiveBoxGen4 { + nickname = "lower .10" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.10 +} + + + +Test00 { + nickname = "full levels, full connectivity" + levels = 0, 0 + method = "mod" + denom = 1 +} + +Test01 { + nickname = "full levels, sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 4 + inc = 1 +} + +Test02 { + nickname = "full levels, also sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 8 + inc = 2 +} + +Test03 { + nickname = "full levels, overlap connectivity" + levels = 0, 0 + method = "overlap" +} + +Test04 { + nickname = "sparse-to-lower, overlap connectivity" + levels = 1, 2 + method = "overlap" +} + +Test05 { + nickname = "sparse-to-upper, overlap connectivity" + levels = 1, 3 + method = "overlap" +} + +Test06 { + nickname = "full-to-tiny, overlap connectivity" + levels = 0, 4 + method = "overlap" +} + +Test07 { + nickname = "tiny-to-full, overlap connectivity" + levels = 4, 0 + method = "overlap" +} diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.3d.input b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.3d.input new file mode 100644 index 00000000..32137d66 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/multiblock.3d.input @@ -0,0 +1,292 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for Connector tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "default.3d" + + // Whether to log all nodes. + log_all_nodes = TRUE + + dim = 3 + + connector_width = 2,2,2 +} + +BlockGeometry { + num_blocks = 7 + domain_boxes_0 = [ (0,0,0) , (14,14,14) ] + domain_boxes_1 = [ (0,0,0) , (14,14,14) ] + domain_boxes_2 = [ (0,0,0) , (14,14,14) ] + domain_boxes_3 = [ (0,0,0) , (14,14,14) ] + domain_boxes_4 = [ (0,0,0) , (14,14,14) ] + domain_boxes_5 = [ (0,0,0) , (14,14,14) ] + domain_boxes_6 = [ (0,0,0) , (14,14,14) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,14,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors3 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors4 { + block_a = 0 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_DOWN", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,14 + } + + BlockNeighbors5 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors6 { + block_a = 1 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors7 { + block_a = 1 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { + block_a = 2 + block_b = 3 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors10 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors11 { + block_a = 2 + block_b = 5 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 14,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors12 { + block_a = 3 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,0,14 + point_in_b_space = 14,0,-1 + } + + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + +} + + + +PrimitiveBoxGen0 { + nickname = "Full domain" + avg_parts_per_rank = 5 + index_filter = "ALL" +} + +PrimitiveBoxGen1 { + nickname = "25% sparse domain" + avg_parts_per_rank = 5 + index_filter = "INTERVAL" + num_keep = 1 + num_discard = 3 +} + +PrimitiveBoxGen2 { + nickname = "lower .60" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.60 +} + +PrimitiveBoxGen3 { + nickname = "upper .60" + avg_parts_per_rank = 5 + index_filter = "UPPER" + frac = 0.40 +} + +PrimitiveBoxGen4 { + nickname = "lower .10" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.10 +} + + + +Test00 { + nickname = "full levels, full connectivity" + levels = 0, 0 + method = "mod" + denom = 1 +} + +Test01 { + nickname = "full levels, sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 4 + inc = 1 +} + +Test02 { + nickname = "full levels, also sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 8 + inc = 2 +} + +Test03 { + nickname = "full levels, overlap connectivity" + levels = 0, 0 + method = "overlap" +} + +Test04 { + nickname = "sparse-to-lower, overlap connectivity" + levels = 1, 2 + method = "overlap" +} + +Test05 { + nickname = "sparse-to-upper, overlap connectivity" + levels = 1, 3 + method = "overlap" +} + +Test06 { + nickname = "full-to-tiny, overlap connectivity" + levels = 0, 4 + method = "overlap" +} + +Test07 { + nickname = "tiny-to-full, overlap connectivity" + levels = 4, 0 + method = "overlap" +} diff --git a/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/periodic.2d.input b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/periodic.2d.input new file mode 100644 index 00000000..aa6dc059 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/Connector/test_inputs/periodic.2d.input @@ -0,0 +1,130 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for Connector tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "periodic.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + + dim = 2 + + connector_width = 2,2 +} + + +BlockGeometry { + // Domain of a single box: + domain_boxes = [(0,0), (150,310)] + // + // Domain of a single box, described as 4 boxes: + // domain_boxes = [(0,0), (7,15)], [(8,0), (15,15)], [(0,15), (7,31)], [(7,15), (15,31)] + + periodic_dimension = 1, 1 + x_lo = 0, 0 + x_up = 1, 2 +} + + + +PrimitiveBoxGen0 { + nickname = "Full domain" + avg_parts_per_rank = 5 + index_filter = "ALL" +} + +PrimitiveBoxGen1 { + nickname = "25% sparse domain" + avg_parts_per_rank = 5 + index_filter = "INTERVAL" + num_keep = 1 + num_discard = 3 +} + +PrimitiveBoxGen2 { + nickname = "lower .60" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.60 +} + +PrimitiveBoxGen3 { + nickname = "upper .60" + avg_parts_per_rank = 5 + index_filter = "UPPER" + frac = 0.40 +} + +PrimitiveBoxGen4 { + nickname = "lower .10" + avg_parts_per_rank = 5 + index_filter = "LOWER" + frac = 0.10 +} + + + +Test00 { + nickname = "full levels, full connectivity" + levels = 0, 0 + method = "mod" + denom = 1 +} + +Test01 { + nickname = "full levels, sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 4 + inc = 1 +} + +Test02 { + nickname = "full levels, also sparse connectivity" + levels = 0, 0 + method = "bracket" + begin_shift = -2 + end_shift = 8 + inc = 2 +} + +Test03 { + nickname = "full levels, overlap connectivity" + levels = 0, 0 + method = "overlap" +} + +Test04 { + nickname = "sparse-to-lower, overlap connectivity" + levels = 1, 2 + method = "overlap" +} + +Test05 { + nickname = "sparse-to-upper, overlap connectivity" + levels = 1, 3 + method = "overlap" +} + +Test06 { + nickname = "full-to-tiny, overlap connectivity" + levels = 0, 4 + method = "overlap" +} + +Test07 { + nickname = "tiny-to-full, overlap connectivity" + levels = 4, 0 + method = "overlap" +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.C index 7e534388..a168fdab 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.C @@ -3,20 +3,18 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AdaptivePoisson class implementation * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" -#include "printObject.h" #include "SAMRAI/pdat/MDA_Access.h" #include "SAMRAI/pdat/ArrayDataAccess.h" #include "patchFcns.h" #include "AdaptivePoisson.h" #include "SAMRAI/solv/CellPoissonFACOps.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/Database.h" @@ -49,41 +47,42 @@ #include "SAMRAI/math/PatchCellDataOpsReal.h" #include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include #include +#include + using namespace SAMRAI; AdaptivePoisson::AdaptivePoisson( const std::string& object_name, const tbox::Dimension& dim, + boost::shared_ptr& fac_ops, + boost::shared_ptr& fac_precond, tbox::Database& database, - /*! Standard output stream */ std::ostream* out_stream, /*! Log output stream */ std::ostream* log_stream): d_name(object_name), d_dim(dim), - d_fac_ops(d_dim, - object_name + ":scalar poisson operator", - database.getDatabase("ScalarPoissonOps")), - d_fac_preconditioner("FAC preconditioner for Poisson's equation", - d_fac_ops), + d_fac_ops(fac_ops), + d_fac_preconditioner(fac_precond), d_context_persistent(new hier::VariableContext("PERSISTENT")), d_context_scratch(new hier::VariableContext("SCRATCH")), - d_diffcoef(new pdat::SideVariable(d_dim, "solution:diffcoef", 1)), - d_flux(new pdat::SideVariable(d_dim, "flux", 1)), + d_diffcoef(new pdat::SideVariable(d_dim, "solution:diffcoef", + hier::IntVector::getOne(d_dim), 1)), + d_flux(new pdat::SideVariable(d_dim, "flux", + hier::IntVector::getOne(d_dim), 1)), d_scalar(new pdat::CellVariable(d_dim, "solution:scalar", 1)), d_constant_source(new pdat::CellVariable( - d_dim, "poisson source", 1)), + d_dim, "poisson source", 1)), d_ccoef(new pdat::CellVariable( - d_dim, "linear source coefficient", 1)), + d_dim, "linear source coefficient", 1)), d_rhs(new pdat::CellVariable(d_dim, "linear system rhs", 1)), d_exact(new pdat::CellVariable(d_dim, "solution:exact", 1)), d_resid(new pdat::CellVariable(d_dim, object_name + "residual")), d_weight(new pdat::CellVariable(d_dim, "vector weight", 1)), - d_ostream(out_stream), d_lstream(log_stream), d_problem_name("sine"), d_sps(object_name + "Poisson solver specifications"), @@ -93,9 +92,8 @@ AdaptivePoisson::AdaptivePoisson( d_polynomial_solution(dim), d_gaussian_diffcoef_solution(dim), d_robin_refine_patch(d_dim, object_name + "Refine patch implementation"), - d_physical_bc_coef(NULL), + d_physical_bc_coef(0), d_adaption_threshold(0.5), - d_finest_plot_level(9999999), d_finest_dbg_plot_ln(database.getIntegerWithDefault("finest_dbg_plot_ln", 99)) { @@ -170,15 +168,11 @@ AdaptivePoisson::AdaptivePoisson( ); } - d_finest_plot_level = - database.getIntegerWithDefault("finest_plot_level", - d_finest_plot_level); - /* * Experiment with algorithm choices in solv::FACPreconditioner. */ std::string fac_algo = database.getStringWithDefault("fac_algo", "default"); - d_fac_preconditioner.setAlgorithmChoice(fac_algo); + d_fac_preconditioner->setAlgorithmChoice(fac_algo); d_adaption_threshold = database.getDoubleWithDefault("adaption_threshold", @@ -223,10 +217,8 @@ AdaptivePoisson::AdaptivePoisson( d_problem_name = database.getStringWithDefault("problem_name", d_problem_name); if (d_problem_name != "sine" - && d_problem_name != "sine-neumann" && d_problem_name != "gauss" && d_problem_name != "multigauss" - && d_problem_name != "pernice" && d_problem_name != "poly" && d_problem_name != "gauss-coef" ) { @@ -264,12 +256,10 @@ AdaptivePoisson::AdaptivePoisson( * Tell ScalarPoissonOperator where to find some of the data * we are providing it. */ - d_fac_ops.setPoissonSpecifications(d_sps); - d_fac_ops.setFluxId(-1); + d_fac_ops->setPoissonSpecifications(d_sps); + d_fac_ops->setFluxId(-1); - d_fac_ops.setPhysicalBcCoefObject(d_physical_bc_coef); - - d_fac_ops.setProlongationMethod("LINEAR_REFINE"); + d_fac_ops->setPhysicalBcCoefObject(d_physical_bc_coef); tbox::plog << "Gaussian solution parameters:\n" << d_gaussian_solution << "\n\n" << std::endl; @@ -283,7 +273,7 @@ AdaptivePoisson::AdaptivePoisson( #endif tbox::plog << "Problem name is: " << d_problem_name << "\n\n" << std::endl; - d_fac_ops.setPreconditioner(&d_fac_preconditioner); + d_fac_ops->setPreconditioner(d_fac_preconditioner.get()); } void AdaptivePoisson::initializeLevelData( @@ -337,14 +327,16 @@ void AdaptivePoisson::initializeLevelData( hier::Box pbox = patch.getBox(); boost::shared_ptr > diffcoef_data( - patch.getPatchData(d_diffcoef_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_diffcoef_persistent))); boost::shared_ptr > exact_data( - patch.getPatchData(d_exact_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_exact_persistent))); boost::shared_ptr > source_data( - patch.getPatchData(d_constant_source_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_constant_source_persistent))); + TBOX_ASSERT(exact_data); + TBOX_ASSERT(source_data); /* Set source function and exact solution. */ if (d_problem_name == "sine") { @@ -364,6 +356,7 @@ void AdaptivePoisson::initializeLevelData( *exact_data, *source_data); } else if (d_problem_name == "gauss-coef") { + TBOX_ASSERT(diffcoef_data); d_gaussian_diffcoef_solution.setGridData(patch, *diffcoef_data, *exact_data, @@ -378,10 +371,11 @@ void AdaptivePoisson::initializeLevelData( * Refine solution data from coarser level and, if provided, old level. */ { - xfer::RefineAlgorithm refiner(d_dim); + xfer::RefineAlgorithm refiner; boost::shared_ptr grid_geometry_( - patch_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch_hierarchy->getGridGeometry())); + TBOX_ASSERT(grid_geometry_); geom::CartesianGridGeometry& grid_geometry = *grid_geometry_; boost::shared_ptr accurate_refine_op = grid_geometry. @@ -433,7 +427,7 @@ void AdaptivePoisson::initializeLevelData( } /* Set vector weight. */ - d_fac_ops.computeVectorWeights(hierarchy, d_weight_persistent); + d_fac_ops->computeVectorWeights(hierarchy, d_weight_persistent); } void AdaptivePoisson::resetHierarchyConfiguration( @@ -479,7 +473,7 @@ void AdaptivePoisson::applyGradientDetector( hier::PatchHierarchy& hierarchy = *hierarchy_; hier::PatchLevel& level = (hier::PatchLevel &) * hierarchy.getPatchLevel(ln); - int ntag = 0, ntotal = 0; + size_t ntag = 0, ntotal = 0; double maxestimate = 0; for (hier::PatchLevel::iterator pi(level.begin()); pi != level.end(); ++pi) { @@ -492,11 +486,8 @@ void AdaptivePoisson::applyGradientDetector( "Data index " << tag_index << " does not exist for patch.\n"); } boost::shared_ptr > tag_cell_data_( - tag_data, - boost::detail::dynamic_cast_tag()); - if (!tag_cell_data_) { - TBOX_ERROR("Data index " << tag_index << " is not cell int data.\n"); - } + BOOST_CAST, hier::PatchData>(tag_data)); + TBOX_ASSERT(tag_cell_data_); boost::shared_ptr soln_data( patch.getPatchData(d_scalar_persistent)); if (!soln_data) { @@ -504,12 +495,8 @@ void AdaptivePoisson::applyGradientDetector( << " does not exist for patch.\n"); } boost::shared_ptr > soln_cell_data_( - soln_data, - boost::detail::dynamic_cast_tag()); - if (!soln_cell_data_) { - TBOX_ERROR("Data index " << d_scalar_persistent - << " is not cell int data.\n"); - } + BOOST_CAST, hier::PatchData>(soln_data)); + TBOX_ASSERT(soln_cell_data_); pdat::CellData& soln_cell_data = *soln_cell_data_; pdat::CellData& tag_cell_data = *tag_cell_data_; pdat::CellData estimate_data(patch.getBox(), @@ -518,8 +505,8 @@ void AdaptivePoisson::applyGradientDetector( computeAdaptionEstimate(estimate_data, soln_cell_data); tag_cell_data.fill(0); - hier::Box::iterator iend(patch.getBox(), false); - for (hier::Box::iterator i(patch.getBox(), true); i != iend; ++i) { + hier::Box::iterator iend(patch.getBox().end()); + for (hier::Box::iterator i(patch.getBox().begin()); i != iend; ++i) { const pdat::CellIndex cell_index(*i); if (maxestimate < estimate_data(cell_index)) maxestimate = estimate_data(cell_index); @@ -559,24 +546,20 @@ int AdaptivePoisson::registerVariablesWithPlotter( 1.0, "CELL"); - // This code has memory leaks but is not critical to the test. - if (1) { - tbox::Array expression_keys(1); - tbox::Array expressions(1); - tbox::Array expression_types(1); - - { - expression_keys[0] = "Error"; - expression_types[0] = "scalar"; - expressions[0] = " - "; - } - - visit_writer.registerVisItExpressions(expression_keys, - expressions, - expression_types); + std::vector expression_keys(1); + std::vector expressions(1); + std::vector expression_types(1); + { + expression_keys[0] = "Error"; + expression_types[0] = "scalar"; + expressions[0] = " - "; } + visit_writer.registerVisItExpressions(expression_keys, + expressions, + expression_types); + return 0; } #endif @@ -586,9 +569,11 @@ bool AdaptivePoisson::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { NULL_USE(depth_id); + NULL_USE(simulation_time); // begin debug code // math::HierarchyCellDataOpsReal hcellmath(d_hierarchy); @@ -597,8 +582,9 @@ bool AdaptivePoisson::packDerivedDataIntoDoubleBuffer( if (variable_name == "Gradient Function") { boost::shared_ptr > soln_cell_data_( - patch.getPatchData(d_scalar_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_scalar_persistent))); + TBOX_ASSERT(soln_cell_data_); const pdat::CellData& soln_cell_data = *soln_cell_data_; pdat::CellData estimate_data(region, 1, @@ -610,8 +596,7 @@ bool AdaptivePoisson::packDerivedDataIntoDoubleBuffer( memcpy(buffer, estimate_data.getPointer(), sizeof(double) * region.size()); } else if (variable_name == "Patch level number") { double pln = patch.getPatchLevelNumber(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = pln; + for (size_t i = 0; i < region.size(); ++i) buffer[i] = pln; } else { // Did not register this name. TBOX_ERROR( @@ -720,8 +705,8 @@ int AdaptivePoisson::computeError( const hier::PatchHierarchy& hierarchy, double* l2norm, double* linorm, - tbox::Array& l2norms, - tbox::Array& linorms) const + std::vector& l2norms, + std::vector& linorms) const { const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -738,7 +723,7 @@ int AdaptivePoisson::computeError( * parallel overhead. */ const int nlevels = hierarchy.getNumberOfLevels(); - tbox::Array wtsums(2 * nlevels); + std::vector wtsums(2 * nlevels); for (ln = nlevels - 1; ln >= 0; --ln) { boost::shared_ptr level(hierarchy.getPatchLevel(ln)); @@ -756,14 +741,17 @@ int AdaptivePoisson::computeError( * Get the patch data. */ boost::shared_ptr > current_solution( - patch->getPatchData(d_scalar_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_scalar_persistent))); boost::shared_ptr > exact_solution( - patch->getPatchData(d_exact_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exact_persistent))); boost::shared_ptr > weight( - patch->getPatchData(d_weight_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_weight_persistent))); + TBOX_ASSERT(current_solution); + TBOX_ASSERT(exact_solution); + TBOX_ASSERT(weight); { const int* lower = ¤t_solution->getBox().lower()[0]; @@ -833,10 +821,10 @@ int AdaptivePoisson::computeError( * in one shot, saving some parallel overhead. */ if (mpi.getSize() > 1) { - mpi.AllReduce(wtsums.getPointer(), 2 * nlevels, MPI_SUM); + mpi.AllReduce(&wtsums[0], 2 * nlevels, MPI_SUM); } if (mpi.getSize() > 1) { - mpi.AllReduce(linorms.getPointer(), nlevels, MPI_SUM); + mpi.AllReduce(&linorms[0], nlevels, MPI_SUM); } } @@ -872,10 +860,6 @@ int AdaptivePoisson::computeError( int AdaptivePoisson::solvePoisson( boost::shared_ptr hierarchy, - int max_cycles, - double residual_tol, - int pre_sweeps, - int post_sweeps, std::string initial_u) { @@ -904,7 +888,7 @@ int AdaptivePoisson::solvePoisson( * Fill the boundary condition coefficient data. */ for (int ln = coarsest_ln; ln <= finest_ln; ++ln) { - boost::shared_ptr level(hierarchy->getPatchLevel(ln)); + boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator pi(level->begin()); pi != level->end(); ++pi) { @@ -913,11 +897,13 @@ int AdaptivePoisson::solvePoisson( const hier::Box& box = patch->getBox(); boost::shared_ptr > source_data( - patch->getPatchData(d_constant_source_persistent), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_constant_source_persistent))); boost::shared_ptr > rhs_data( - patch->getPatchData(d_rhs_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_rhs_scratch))); + TBOX_ASSERT(source_data); + TBOX_ASSERT(rhs_data); math::PatchCellDataOpsReal cell_ops; cell_ops.scale(rhs_data, 1.0, source_data, box); @@ -928,7 +914,7 @@ int AdaptivePoisson::solvePoisson( if (0) { x.setToScalar(1.0); double weightsums = - d_fac_ops.computeResidualNorm(x, finest_ln, coarsest_ln); + d_fac_ops->computeResidualNorm(x, finest_ln, coarsest_ln); tbox::pout << "weightsums: " << weightsums << std::endl; } @@ -957,31 +943,29 @@ int AdaptivePoisson::solvePoisson( /* * Set up FAC preconditioner object. */ - d_fac_preconditioner.setMaxCycles(max_cycles); - d_fac_preconditioner.setResidualTolerance(residual_tol); - d_fac_preconditioner.setPresmoothingSweeps(pre_sweeps); - d_fac_preconditioner.setPostsmoothingSweeps(post_sweeps); - if (d_lstream) d_fac_preconditioner.printClassData(*d_lstream); - d_fac_preconditioner.initializeSolverState(x, b); + if (d_lstream) { + d_fac_preconditioner->printClassData(*d_lstream); + } + d_fac_preconditioner->initializeSolverState(x, b); /* * Solve the system. */ - d_fac_preconditioner.solveSystem(x, b); + d_fac_preconditioner->solveSystem(x, b); if (d_lstream) *d_lstream << "FAC solve completed with\n" << std::setw(30) << "number of iterations: " - << d_fac_preconditioner.getNumberOfIterations() << "\n" + << d_fac_preconditioner->getNumberOfIterations() << "\n" << std::setw(30) << "residual norm: " - << d_fac_preconditioner.getResidualNorm() << "\n" + << d_fac_preconditioner->getResidualNorm() << "\n" ; - d_fac_preconditioner.deallocateSolverState(); + d_fac_preconditioner->deallocateSolverState(); /* * Get data on the solve. */ double avg_convergence_factor, final_convergence_factor; - d_fac_preconditioner.getConvergenceFactors(avg_convergence_factor, + d_fac_preconditioner->getConvergenceFactors(avg_convergence_factor, final_convergence_factor); if (d_lstream) *d_lstream << "Final result: \n" @@ -998,10 +982,11 @@ int AdaptivePoisson::solvePoisson( * the solver finishes. */ { - xfer::RefineAlgorithm refiner(d_dim); + xfer::RefineAlgorithm refiner; boost::shared_ptr grid_geometry_( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + hierarchy->getGridGeometry())); + TBOX_ASSERT(grid_geometry_); geom::CartesianGridGeometry& grid_geometry = *grid_geometry_; boost::shared_ptr accurate_refine_op( grid_geometry.lookupRefineOperator(d_scalar, "LINEAR_REFINE")); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.h index 306610ee..90fbbcd9 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/AdaptivePoisson.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AdaptivePoisson class declaration * ************************************************************************/ @@ -52,7 +52,7 @@ #include "SAMRAI/solv/SAMRAIVectorReal.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -87,9 +87,10 @@ class AdaptivePoisson: AdaptivePoisson( const std::string& object_name, const tbox::Dimension& dim, + boost::shared_ptr& fac_ops, + boost::shared_ptr& fac_precond, tbox::Database& database, - /*! Standard output stream */ std::ostream* out_stream = NULL, - /*! Log output stream */ std::ostream* log_stream = NULL); + /*! Log output stream */ std::ostream* log_stream = 0); //@{ @name mesh::StandardTagAndInitStrategy virtuals @@ -160,7 +161,8 @@ class AdaptivePoisson: const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; //@} @@ -172,9 +174,6 @@ class AdaptivePoisson: * solv::FACPreconditioner object to solve it. * * @param hierarchy the hierarchy to solve on - * @param max_cycle max number of FAC cycles to use - * @param pre_sweeps number of presmoothing sweeps to use - * @param pre_sweeps number of postsmoothing sweeps to use * @param initial_u how to set the initial guess for u. * A std::string is used so the option "random" can be * used. If "random" is not used, set the std::string @@ -183,10 +182,6 @@ class AdaptivePoisson: int solvePoisson( boost::shared_ptr hierarchy, - int max_cycles = 10, - double residual_tol = 1e-6, - int pre_sweeps = 5, - int post_sweeps = 5, std::string initial_u = std::string("0.0")); #ifdef HAVE_HDF5 @@ -209,8 +204,8 @@ class AdaptivePoisson: /*! hierarchy */ const hier::PatchHierarchy& hierarchy, /*! L2 norm */ double* l2norm, /*! L-inf norm */ double* linorm, - /*! L2 norm on each level */ tbox::Array& l2norms, - /*! L-inf norm on each level */ tbox::Array& linorms) const; + /*! L2 norm on each level */ std::vector& l2norms, + /*! L-inf norm on each level */ std::vector& linorms) const; /*! * @brief Compute error estimator (for adaption or plotting). @@ -233,9 +228,9 @@ class AdaptivePoisson: * @name Major algorithm objects. */ - solv::CellPoissonFACOps d_fac_ops; + boost::shared_ptr d_fac_ops; - solv::FACPreconditioner d_fac_preconditioner; + boost::shared_ptr d_fac_preconditioner; //@} @@ -327,13 +322,6 @@ class AdaptivePoisson: /*! * @name Output streams. */ - /*! - * @brief Output stream pointer. - * - * If set to NULL, no output. - */ - std::ostream* d_ostream; - /*! * @brief Log stream pointer. * @@ -371,8 +359,6 @@ class AdaptivePoisson: double d_adaption_threshold; - int d_finest_plot_level; - //@{ private: /*! diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.C index b27b89f3..08e5ee58 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Gaussian function support for FAC solver tests. * ************************************************************************/ @@ -13,6 +13,7 @@ #include #include #include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" #include #include @@ -159,7 +160,7 @@ std::istream& operator >> ( ci >> gf.d_center[dim]; EAT_WS(ci) // ci >> std::noskipws; // ci.ipfx(0); } else { - abort(); + tbox::SAMRAI_MPI::abort(); } } return ci; diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.h index 69b681b0..c8db69d7 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/GaussianFcn.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Gaussian function support for FAC solver tests. * ************************************************************************/ @@ -32,7 +32,7 @@ class GaussianFcn public: GaussianFcn(); - GaussianFcn( + explicit GaussianFcn( const tbox::Dimension& dim); /*! @@ -146,7 +146,7 @@ class GaussianFcn //! Amplitude double d_amp; //! Center - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; //! Lambda double d_lambda; diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.depend index bea43aa4..e9b69179 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -58,12 +58,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -163,7 +165,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -180,8 +181,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -202,14 +203,13 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ AdaptivePoisson.C AdaptivePoisson.h GaussianFcn.h \ PoissonGaussianDiffcoefSolution.h PoissonGaussianSolution.h \ PoissonMultigaussianSolution.h PoissonPolynomialSolution.h \ - PoissonSineSolution.h QuarticFcn.h SinusoidFcn.h patchFcns.h \ - printObject.h + PoissonSineSolution.h QuarticFcn.h SinusoidFcn.h patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -270,29 +270,29 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=GaussianFcn.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h GaussianFcn.C \ GaussianFcn.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=PoissonGaussianDiffcoefSolution.o DEPENDS_2:=\ @@ -330,12 +330,14 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -359,7 +361,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -373,8 +374,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -389,12 +390,12 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h GaussianFcn.h \ PoissonGaussianDiffcoefSolution.C \ PoissonGaussianDiffcoefSolution.h QuarticFcn.h SinusoidFcn.h \ patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -404,12 +405,11 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=PoissonGaussianSolution.o DEPENDS_3:=\ @@ -447,12 +447,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -476,7 +478,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -490,8 +491,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -506,11 +507,11 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h GaussianFcn.h \ PoissonGaussianSolution.C PoissonGaussianSolution.h QuarticFcn.h\ SinusoidFcn.h patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -520,12 +521,11 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=PoissonMultigaussianSolution.o DEPENDS_4:=\ @@ -563,12 +563,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -592,7 +594,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -606,8 +607,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -622,11 +623,11 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h GaussianFcn.h \ PoissonMultigaussianSolution.C PoissonMultigaussianSolution.h \ QuarticFcn.h SinusoidFcn.h patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -636,12 +637,11 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=PoissonPolynomialSolution.o DEPENDS_5:=\ @@ -679,12 +679,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -708,7 +710,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -722,8 +723,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -738,11 +739,11 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ PoissonPolynomialSolution.C PoissonPolynomialSolution.h \ QuarticFcn.h SinusoidFcn.h patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -752,12 +753,11 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=PoissonSineSolution.o DEPENDS_6:=\ @@ -795,12 +795,14 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -824,7 +826,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -838,8 +839,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -854,11 +855,11 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ PoissonSineSolution.C PoissonSineSolution.h QuarticFcn.h \ SinusoidFcn.h patchFcns.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ @@ -868,12 +869,11 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=QuarticFcn.o DEPENDS_7:=\ @@ -884,12 +884,11 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h QuarticFcn.C QuarticFcn.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=SinusoidFcn.o DEPENDS_8:=\ @@ -901,27 +900,14 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SinusoidFcn.C \ SinusoidFcn.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ -endif - -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} - -FILE_9=get-input-filename.o -DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h get-input-filename.C \ - get-input-filename.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} +${FILE_8}: ${DEPENDS_8} -FILE_10=main.o -DEPENDS_10:=\ +FILE_9=main.o +DEPENDS_9:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ @@ -932,6 +918,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianSideDoubleWeightedAverage.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -941,6 +928,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -954,7 +942,10 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -966,12 +957,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1004,7 +997,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -1012,11 +1004,12 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -1082,12 +1075,12 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -1101,9 +1094,10 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1126,15 +1120,15 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - AdaptivePoisson.h GaussianFcn.h \ - PoissonGaussianDiffcoefSolution.h PoissonGaussianSolution.h \ - PoissonMultigaussianSolution.h PoissonPolynomialSolution.h \ - PoissonSineSolution.h QuarticFcn.h SinusoidFcn.h \ - get-input-filename.h main.C printObject.h + $(TESTLIBDIR)/get-input-filename.h AdaptivePoisson.h \ + GaussianFcn.h PoissonGaussianDiffcoefSolution.h \ + PoissonGaussianSolution.h PoissonMultigaussianSolution.h \ + PoissonPolynomialSolution.h PoissonSineSolution.h QuarticFcn.h \ + SinusoidFcn.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ +DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -1193,15 +1187,14 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=patchFcns.o -DEPENDS_11:=\ +${FILE_9}: ${DEPENDS_9} + +FILE_10=patchFcns.o +DEPENDS_10:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ @@ -1225,6 +1218,7 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -1247,7 +1241,6 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -1259,15 +1252,15 @@ DEPENDS_11:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h QuarticFcn.h \ SinusoidFcn.h patchFcns.C setArrayData.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ +DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataAccess.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1276,97 +1269,13 @@ DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} - -FILE_12=printObject.o -DEPENDS_12:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h printObject.C \ - printObject.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} +${FILE_10}: ${DEPENDS_10} -FILE_13=setArrayData.o -DEPENDS_13:=\ +FILE_11=setArrayData.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ @@ -1376,10 +1285,9 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h QuarticFcn.h \ SinusoidFcn.h setArrayData.C setArrayData.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ +DEPENDS_11 +=\ -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} + +${FILE_11}: ${DEPENDS_11} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.in b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.in index 5cc13cda..694bd869 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the FAC test directory ## ######################################################################### @@ -14,6 +14,9 @@ SUBDIR = source/test/FAC_adaptive VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check @@ -21,14 +24,12 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DTESTING=1 - NUM_TESTS = 15 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o AdaptivePoisson.o \ - get-input-filename.o \ - printObject.o \ patchFcns.o \ setArrayData.o \ SinusoidFcn.o \ @@ -40,9 +41,13 @@ CXX_OBJS = main.o AdaptivePoisson.o \ PoissonMultigaussianSolution.o \ PoissonPolynomialSolution.o -main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main +main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ + $(LIBSAMRAI) $(LDLIBS) -o main + +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): check: $(MAKE) check2d @@ -50,32 +55,49 @@ check: check2d: main @for i in test_inputs/*.2d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile examples: -clean-check: - $(SAMCLEAN) +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f *main* - $(RM) -rf *visit +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.C index 3a30fe26..7c4014d7 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonGaussianDiffcoefSolution class implementation * ************************************************************************/ @@ -84,7 +84,7 @@ void PoissonGaussianDiffcoefSolution::setFromDatabase( { // Compute the cosine-sine component. d_cscomp = d_sscomp; - double new_phase_angles[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double new_phase_angles[SAMRAI::MAX_DIM_VAL]; d_cscomp.getPhaseAngles(new_phase_angles); new_phase_angles[0] -= 0.5; d_cscomp.setPhaseAngles(new_phase_angles); @@ -121,9 +121,9 @@ double PoissonGaussianDiffcoefSolution::sourceFcn( double x, double y) const { double rval; - double trig_arg[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double trig_arg[SAMRAI::MAX_DIM_VAL]; d_sscomp.getPhaseAngles(trig_arg); - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; d_gcomp.getCenter(gauss_ctr); trig_arg[0] += d_k[0] * x; trig_arg[1] += d_k[1] * y; @@ -142,9 +142,9 @@ double PoissonGaussianDiffcoefSolution::sourceFcn( double y, double z) const { double rval; - double trig_arg[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double trig_arg[SAMRAI::MAX_DIM_VAL]; d_sscomp.getPhaseAngles(trig_arg); - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; d_gcomp.getCenter(gauss_ctr); trig_arg[0] += d_k[0] * x; trig_arg[1] += d_k[1] * y; @@ -180,23 +180,24 @@ void PoissonGaussianDiffcoefSolution::setGridData( pdat::CellData& source_data) { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* h = patch_geom->getDx(); const double* xl = patch_geom->getXLower(); const int* il = &patch.getBox().lower()[0]; - int axis; + tbox::Dimension::dir_t axis; { /* Set diffusion coefficients on each side at a time. */ for (axis = 0; axis < d_dim.getValue(); ++axis) { - double sl[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // Like XLower, except for side. + double sl[SAMRAI::MAX_DIM_VAL]; // Like XLower, except for side. int j; for (j = 0; j < d_dim.getValue(); ++j) { sl[j] = j != axis ? xl[j] + 0.5 * h[j] : xl[j]; } - pdat::SideData::iterator iter(patch.getBox(), axis, true); - pdat::SideData::iterator iterend(patch.getBox(), axis, false); + pdat::SideData::iterator iter(pdat::SideGeometry::begin(patch.getBox(), axis)); + pdat::SideData::iterator iterend(pdat::SideGeometry::end(patch.getBox(), axis)); if (d_dim == tbox::Dimension(2)) { double x, y; for ( ; iter != iterend; ++iter) { @@ -219,13 +220,13 @@ void PoissonGaussianDiffcoefSolution::setGridData( } { /* Set cell-centered data. */ - double sl[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // Like XLower, except for cell. + double sl[SAMRAI::MAX_DIM_VAL]; // Like XLower, except for cell. int j; for (j = 0; j < d_dim.getValue(); ++j) { sl[j] = xl[j] + 0.5 * h[j]; } - pdat::CellData::iterator iter(patch.getBox(), true); - pdat::CellData::iterator iterend(patch.getBox(), false); + pdat::CellData::iterator iter(pdat::CellGeometry::begin(patch.getBox())); + pdat::CellData::iterator iterend(pdat::CellGeometry::end(patch.getBox())); if (d_dim == tbox::Dimension(2)) { double x, y; for ( ; iter != iterend; ++iter) { @@ -272,8 +273,9 @@ void PoissonGaussianDiffcoefSolution::setBcCoefs( NULL_USE(fill_time); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * Set to an inhomogeneous Dirichlet boundary condition. */ @@ -293,9 +295,9 @@ void PoissonGaussianDiffcoefSolution::setBcCoefs( hier::Index upper = box.upper(); if (d_dim == tbox::Dimension(2)) { - double* a_array = acoef_data ? acoef_data->getPointer() : NULL; - double* b_array = bcoef_data ? bcoef_data->getPointer() : NULL; - double* g_array = gcoef_data ? gcoef_data->getPointer() : NULL; + double* a_array = acoef_data ? acoef_data->getPointer() : 0; + double* b_array = bcoef_data ? bcoef_data->getPointer() : 0; + double* g_array = gcoef_data ? gcoef_data->getPointer() : 0; int i, j, ibeg, iend, jbeg, jend; double x, y; switch (bdry_box.getLocationIndex()) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.h index bd30aac2..36671131 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianDiffcoefSolution.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonGaussianDiffcoefSolution class declaration * ************************************************************************/ @@ -75,9 +75,9 @@ class PoissonGaussianDiffcoefSolution: , /*! Input database */ tbox::Database& database , /*! Standard output stream */ - std::ostream * out_stream = NULL + std::ostream * out_stream = 0 , /*! Log output stream */ - std::ostream * log_stream = NULL); + std::ostream * log_stream = 0); virtual ~PoissonGaussianDiffcoefSolution(); @@ -166,8 +166,8 @@ class PoissonGaussianDiffcoefSolution: SinusoidFcn d_sccomp; //@{ double d_lambda; - double d_k[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double d_p[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_k[SAMRAI::MAX_DIM_VAL]; + double d_p[SAMRAI::MAX_DIM_VAL]; double d_k2; //@} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.C index c0f35dd8..d74f1f44 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonGaussianSolution class implementation * ************************************************************************/ @@ -89,7 +89,7 @@ double PoissonGaussianSolution::exactFcn( double PoissonGaussianSolution::sourceFcn( double x, double y) const { - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; d_gauss.getCenter(gauss_ctr); double rval; rval = 4 * d_gauss.getLambda() * ((x - gauss_ctr[0]) * (x - gauss_ctr[0]) @@ -104,7 +104,7 @@ double PoissonGaussianSolution::sourceFcn( double x, double y, double z) const { - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; d_gauss.getCenter(gauss_ctr); double rval; rval = 4 * d_gauss.getLambda() * ((x - gauss_ctr[0]) * (x - gauss_ctr[0]) @@ -122,8 +122,9 @@ void PoissonGaussianSolution::setGridData( pdat::CellData& source_data) { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* h = patch_geom->getDx(); const double* xl = patch_geom->getXLower(); @@ -131,13 +132,13 @@ void PoissonGaussianSolution::setGridData( { /* Set cell-centered data. */ - double sl[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // Like XLower, except for cell. + double sl[SAMRAI::MAX_DIM_VAL]; // Like XLower, except for cell. int j; for (j = 0; j < d_dim.getValue(); ++j) { sl[j] = xl[j] + 0.5 * h[j]; } - pdat::CellData::iterator iter(patch.getBox(), true); - pdat::CellData::iterator iterend(patch.getBox(), false); + pdat::CellData::iterator iter(pdat::CellGeometry::begin(patch.getBox())); + pdat::CellData::iterator iterend(pdat::CellGeometry::end(patch.getBox())); if (d_dim == tbox::Dimension(2)) { double x, y; for ( ; iter != iterend; ++iter) { @@ -181,8 +182,9 @@ void PoissonGaussianSolution::setBcCoefs( NULL_USE(fill_time); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * Set to an inhomogeneous Dirichlet boundary condition. */ @@ -202,9 +204,9 @@ void PoissonGaussianSolution::setBcCoefs( hier::Index upper = box.upper(); if (d_dim == tbox::Dimension(2)) { - double* a_array = acoef_data ? acoef_data->getPointer() : NULL; - double* b_array = bcoef_data ? bcoef_data->getPointer() : NULL; - double* g_array = gcoef_data ? gcoef_data->getPointer() : NULL; + double* a_array = acoef_data ? acoef_data->getPointer() : 0; + double* b_array = bcoef_data ? bcoef_data->getPointer() : 0; + double* g_array = gcoef_data ? gcoef_data->getPointer() : 0; int i, j, ibeg, iend, jbeg, jend; double x, y; switch (bdry_box.getLocationIndex()) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.h index c5841b55..518c943e 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonGaussianSolution.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonGaussianSolution class declaration * ************************************************************************/ @@ -57,9 +57,9 @@ class PoissonGaussianSolution: , /*! Input database */ tbox::Database& database , /*! Standard output stream */ - std::ostream * out_stream = NULL + std::ostream * out_stream = 0 , /*! Log output stream */ - std::ostream * log_stream = NULL); + std::ostream * log_stream = 0); virtual ~PoissonGaussianSolution(); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.C index ef5547a6..99cb3765 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonMultigaussianSolution class implementation * ************************************************************************/ @@ -116,7 +116,7 @@ double PoissonMultigaussianSolution::sourceFcn( d_gauss_const_iterator i; for (i = d_gauss_begin; i != d_gauss_end; ++i) { const GaussianFcn& gauss = *i; - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; gauss.getCenter(gauss_ctr); double tval; tval = 4 * gauss.getLambda() * ((x - gauss_ctr[0]) * (x - gauss_ctr[0]) @@ -137,7 +137,7 @@ double PoissonMultigaussianSolution::sourceFcn( d_gauss_const_iterator i; for (i = d_gauss_begin; i != d_gauss_end; ++i) { const GaussianFcn& gauss = *i; - double gauss_ctr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double gauss_ctr[SAMRAI::MAX_DIM_VAL]; gauss.getCenter(gauss_ctr); double tval; tval = 4 * gauss.getLambda() * ((x - gauss_ctr[0]) * (x - gauss_ctr[0]) @@ -157,8 +157,9 @@ void PoissonMultigaussianSolution::setGridData( pdat::CellData& source_data) { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* h = patch_geom->getDx(); const double* xl = patch_geom->getXLower(); @@ -166,13 +167,13 @@ void PoissonMultigaussianSolution::setGridData( { /* Set cell-centered data. */ - double sl[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; // Like XLower, except for cell. + double sl[SAMRAI::MAX_DIM_VAL]; // Like XLower, except for cell. int j; for (j = 0; j < d_dim.getValue(); ++j) { sl[j] = xl[j] + 0.5 * h[j]; } - pdat::CellData::iterator iter(patch.getBox(), true); - pdat::CellData::iterator iterend(patch.getBox(), false); + pdat::CellData::iterator iter(pdat::CellGeometry::begin(patch.getBox())); + pdat::CellData::iterator iterend(pdat::CellGeometry::end(patch.getBox())); if (d_dim == tbox::Dimension(2)) { double x, y; for ( ; iter != iterend; ++iter) { @@ -224,8 +225,9 @@ void PoissonMultigaussianSolution::setBcCoefs( } boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * Set to an inhomogeneous Dirichlet boundary condition. */ @@ -246,11 +248,11 @@ void PoissonMultigaussianSolution::setBcCoefs( if (d_dim == tbox::Dimension(2)) { hier::Box::iterator boxit(acoef_data ? - acoef_data->getBox() : gcoef_data->getBox(), - true); + acoef_data->getBox().begin() : + gcoef_data->getBox().begin()); hier::Box::iterator boxitend(acoef_data ? - acoef_data->getBox() : gcoef_data->getBox(), - false); + acoef_data->getBox().end() : + gcoef_data->getBox().end()); int i, j; double x, y; switch (bdry_box.getLocationIndex()) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.h index 896986b1..87ae4f14 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonMultigaussianSolution.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonMultigaussianSolution class declaration * ************************************************************************/ @@ -71,9 +71,9 @@ class PoissonMultigaussianSolution: , /*! Input database */ tbox::Database& database , /*! Standard output stream */ - std::ostream * out_stream = NULL + std::ostream * out_stream = 0 , /*! Log output stream */ - std::ostream * log_stream = NULL); + std::ostream * log_stream = 0); virtual ~PoissonMultigaussianSolution(); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.C index 15fa25aa..c2d19431 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonPolynomialSolution class implementation * ************************************************************************/ @@ -120,8 +120,9 @@ void PoissonPolynomialSolution::setBcCoefs( NULL_USE(fill_time); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * Set to an inhomogeneous Dirichlet boundary condition. */ @@ -141,9 +142,9 @@ void PoissonPolynomialSolution::setBcCoefs( hier::Index upper = box.upper(); if (d_dim == tbox::Dimension(2)) { - double* a_array = acoef_data ? acoef_data->getPointer() : NULL; - double* b_array = bcoef_data ? bcoef_data->getPointer() : NULL; - double* g_array = gcoef_data ? gcoef_data->getPointer() : NULL; + double* a_array = acoef_data ? acoef_data->getPointer() : 0; + double* b_array = bcoef_data ? bcoef_data->getPointer() : 0; + double* g_array = gcoef_data ? gcoef_data->getPointer() : 0; int i, j, ibeg, iend, jbeg, jend; double x, y; switch (bdry_box.getLocationIndex()) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.h index 3c1ebe53..14f06be3 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonPolynomialSolution.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonPolynomialSolution class declaration * ************************************************************************/ @@ -45,9 +45,9 @@ class PoissonPolynomialSolution: , /*! Input database */ tbox::Database& database , /*! Standard output stream */ - std::ostream * out_stream = NULL + std::ostream * out_stream = 0 , /*! Log output stream */ - std::ostream * log_stream = NULL); + std::ostream * log_stream = 0); virtual ~PoissonPolynomialSolution(); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.C index 739380c3..76e74861 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonSineSolution class implementation * ************************************************************************/ @@ -16,7 +16,6 @@ #include STL_SSTREAM_HEADER_FILE #include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/tbox/Array.h" using namespace SAMRAI; @@ -64,15 +63,15 @@ void PoissonSineSolution::setFromDatabase( std::istringstream ist(istr); ist >> d_exact; if (database.isBool("neumann_locations")) { - tbox::Array neumann_locations = - database.getBoolArray("neumann_locations"); - if (neumann_locations.getSize() > 2 * d_dim.getValue()) { + std::vector neumann_locations = + database.getBoolVector("neumann_locations"); + if (static_cast(neumann_locations.size()) > 2 * d_dim.getValue()) { TBOX_ERROR( "'neumann_locations' should have at most " << 2 * d_dim.getValue() << " entries in " << d_dim << "D.\n"); } int i; - for (i = 0; i < neumann_locations.getSize(); ++i) { + for (i = 0; i < static_cast(neumann_locations.size()); ++i) { d_neumann_location[i] = neumann_locations[i]; } } @@ -117,8 +116,8 @@ void PoissonSineSolution::setGridData( setCellDataToSinusoid(source_data, patch, d_exact); - double npi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE], - ppi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double npi[SAMRAI::MAX_DIM_VAL], + ppi[SAMRAI::MAX_DIM_VAL]; d_exact.getWaveNumbers(npi); d_exact.getPhaseAngles(ppi); double source_scale = 0.0; @@ -172,8 +171,9 @@ void PoissonSineSolution::setBcCoefs( */ hier::Box patch_box(patch.getBox()); boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* xlo = patch_geom->getXLower(); const double* xup = patch_geom->getXUpper(); const double* dx = patch_geom->getDx(); @@ -183,8 +183,8 @@ void PoissonSineSolution::setBcCoefs( if (gcoef_data) { if (d_dim == tbox::Dimension(2)) { - hier::Box::iterator boxit(gcoef_data->getBox(), true); - hier::Box::iterator boxitend(gcoef_data->getBox(), false); + hier::Box::iterator boxit(gcoef_data->getBox().begin()); + hier::Box::iterator boxitend(gcoef_data->getBox().end()); int i, j; double x, y; switch (location_index) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.h index 583f95be..99fd0b24 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/PoissonSineSolution.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: PoissonSineSolution class declaration * ************************************************************************/ @@ -45,9 +45,9 @@ class PoissonSineSolution: , /*! Input database */ tbox::Database& database , /*! Standard output stream */ - std::ostream * out_stream = NULL + std::ostream * out_stream = 0 , /*! Log output stream */ - std::ostream * log_stream = NULL); + std::ostream * log_stream = 0); virtual ~PoissonSineSolution(); @@ -99,7 +99,7 @@ class PoissonSineSolution: private: const tbox::Dimension d_dim; - bool d_neumann_location[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + bool d_neumann_location[2 * SAMRAI::MAX_DIM_VAL]; double d_linear_coef; SinusoidFcn d_exact; diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.C index 471e84fa..93d5281a 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Quartic function functor. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.h index 0a4a8d25..4d2acf96 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/QuarticFcn.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Quartic function functor. * ************************************************************************/ @@ -32,7 +32,7 @@ class QuarticFcn * * Construct a trivial polynomial function. */ - QuarticFcn( + explicit QuarticFcn( const tbox::Dimension& dim); /*! diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/README b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/README index 12beddb2..08250825 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/README +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/README @@ -3,30 +3,76 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for FAC solver test. +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: README file for FAC solver test ## ######################################################################### -Test problems for FAC solver -============================ +This is a unit test of the the FAC solver. These tests use true mesh +adaptivity based on the evolution of the solution. In addition a variety of +functionally defined boundary conditions are applied depending on the test. +The files included in this directory are as follows: + + main.C - example main program + AdaptivePoisson.[Ch] - class to set tags to solve + - Poisson's equation + PoissonGaussianDiffcoefSolution.[Ch] - implements Gaussian-diffcoef + boundary conditions to Poisson's + equation + PoissonGaussianSolution.[Ch] - implements Gaussian boundary + conditions to Poisson's equation + PoissonMultigaussianSolution.[Ch] - implements a sum of Gaussian + boundary conditions to Poisson's + equation + GaussianFcn.[Ch] - functor to define and ecaluate + 1, 2, and 3D Gaussian functions + PoissonPolynomialSolution.[Ch] - implements quartic polynomial + boundary conditions to Poisson's + equation + QuarticFcn.[Ch] - functor to define and evaluate + 1, 2, and 3D quartic polynomials + PoissonSineSolution.[Ch] - implements sinusoidal boundary + conditions to Poisson's equation + SinusoidFcn.[Ch] - functor to define and evaluate + 1, 2, and 3D sinusoidal functions + get-input-filename.[Ch] - utility to get input filename + patchFcns.[Ch] - utilities to set PatchData in + various ways + setArrayData.[Ch] - utilities to set arrays in various + ways -To generate the 2D and 3D sources, use the genfiles.sh script. -This script should be run in the SAMRAI/source/test/FAC directory -or one of the dimensional subdirectories. -To regenerate the source while in the object directory of this -test, use "make src". +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main -To run: -====== + Execution: + For one of the following input files: + test_inputs/allneumann.2d.input + test_inputs/allneumann.3d.input + test_inputs/complex.2d.input + test_inputs/default.2d.input + test_inputs/default.3d.input + test_inputs/gauss.2d.input + test_inputs/gauss.3d.input + test_inputs/periodic.2d.input + test_inputs/periodic.3d.input + test_inputs/ring_gauss.2d.input + test_inputs/simple.2d.input + test_inputs/simple_gauss.2d.input + test_inputs/simple_gauss.3d.input + test_inputs/varcoef.2d.input + test_inputs/varcoef.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main -Compilation: - make -Execution: - make check - or - make check2d - or - make check2d +INPUT PARAMETERS +---------------- +Refer to test_inputs/allneumann.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.C index 923b4185..a5d8bba8 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Sinusoidal function functor in FAC solver test. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.h index f40eecd2..75d8de59 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/SinusoidFcn.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Sinusoidal function functor in FAC solver test. * ************************************************************************/ @@ -27,7 +27,7 @@ class SinusoidFcn { public: - SinusoidFcn( + explicit SinusoidFcn( const tbox::Dimension& dim); /*! @@ -174,9 +174,9 @@ class SinusoidFcn //! Amplitude double d_amp; //! Wave number in half-cycles - double d_npi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_npi[SAMRAI::MAX_DIM_VAL]; //! Phase shift in half-cycles - double d_ppi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_ppi[SAMRAI::MAX_DIM_VAL]; }; diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.C deleted file mode 100644 index 058b4de7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.C +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting the input file name. - * - ************************************************************************/ -#include "SAMRAI/SAMRAI_config.h" -#include - -// using namespace std; - -#include "get-input-filename.h" - -int get_input_filename( - int* argc, - char* argv[], - std::string& input_filename) { - - int rval = 0; - std::string argv0(argv[0]); - if (*argc > 1) { - // Input file is the first argument. Shift other arguments down. - input_filename = argv[1]; - --(*argc); - int i; - for (i = 1; i < (*argc); ++i) { - argv[i] = argv[i + 1]; - } - } else if (*argc == 1 && argv0.rfind("check-") < argv0.size()) { - /* - * No argument but input file is implicit in program name - * which has the form check-. - */ - input_filename = argv0.substr(argv0.rfind("check-") + 6) + ".input"; - } else if (*argc == 1) { - // No argument and not invoked as "check-blah". - rval = 1; - } - return rval; -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.h deleted file mode 100644 index d973315c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/get-input-filename.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting the input file name. - * - ************************************************************************/ -#include - -/*! - * This function gets the input file name from the argument list. - * For most cases, this is simply the first - * command-line argument (after the program name). - * The variable @c input_filename is set to the filename, - * and all arguments following it are shifed down one. - * Unless you are a developer, this is all you need to know. - * - * For the special case with no command-line argument, - * if the program is invoked with the name "check-blah", - * it assumes the input file is "blah.input". - * The purpose of this setup is so that it is compatible with - * the automake make-check mechanism, which runs programs without - * arguments. At the same time, an input file can be manually - * specified for operational flexibility. - * - * @return 0 if filename is found, 1 otherwise. - */ -int get_input_filename(int* argc, char* argv[], std::string & input_filename); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/main.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/main.C index f3b41285..59fd3cc1 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/main.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Program for poisson solver on adaptive grid using FAC * ************************************************************************/ @@ -13,14 +13,13 @@ #include // using namespace std; -#include "printObject.h" #include "AdaptivePoisson.h" -#include "get-input-filename.h" +#include "test/testlib/get-input-filename.h" /* * Headers for basic SAMRAI objects used in this code. */ -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -43,7 +42,10 @@ #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/solv/FACPreconditioner.h" -#include +#include "boost/shared_ptr.hpp" + +#include +#include using namespace SAMRAI; @@ -52,14 +54,14 @@ int main( char* argv[]) { - string input_filename; + std::string input_filename; /* * Initialize MPI, process argv, and initialize SAMRAI */ tbox::SAMRAI_MPI::init(&argc, &argv); if (get_input_filename(&argc, argv, input_filename) == 1) { - tbox::pout << "Usage: " << argv[0] << " ." << endl; + tbox::pout << "Usage: " << argv[0] << " ." << std::endl; tbox::SAMRAI_MPI::finalize(); return 0; } @@ -78,7 +80,7 @@ int main( * Do not run them without hypre. */ #ifdef HAVE_HYPRE - tbox::pout << "Input file is " << input_filename << endl; + tbox::pout << "Input file is " << input_filename << std::endl; std::string case_name; if (argc > 1) { @@ -106,14 +108,15 @@ int main( const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); - tbox::plog << "Main database:" << endl; + tbox::plog << "Main database:" << std::endl; main_db->printClassData(tbox::plog); /* * Base filename info. */ - string base_name = main_db->getStringWithDefault("base_name", "noname"); + std::string base_name = + main_db->getStringWithDefault("base_name", "noname"); /* * Modify basename for this particular run. @@ -129,7 +132,7 @@ int main( * Log file info. */ { - string log_filename = + std::string log_filename = main_db->getStringWithDefault("log_filename", base_name + ".log"); bool log_all = main_db->getBoolWithDefault("log_all", false); @@ -145,13 +148,13 @@ int main( */ /* * Create a grid geometry required for the patchHierarchy object. - */ + */ boost::shared_ptr grid_geometry( new geom::CartesianGridGeometry( dim, "CartesianGridGeometry", input_db->getDatabase("CartesianGridGeometry"))); - tbox::plog << "Grid Geometry:" << endl; + tbox::plog << "Grid Geometry:" << std::endl; grid_geometry->printClassData(tbox::plog); boost::shared_ptr patch_hierarchy( new hier::PatchHierarchy( @@ -163,12 +166,55 @@ int main( * Create the problem-specific object implementing the required * SAMRAI virtual functions. */ - AdaptivePoisson - adaptive_poisson("AdaptivePoisson", - dim, - *(input_db->getDatabase("AdaptivePoisson")), - &tbox::pout, - &tbox::plog); + + std::string adaptive_poisson_name = "AdaptivePoisson"; + std::string fac_ops_name = + adaptive_poisson_name + ":scalar poisson operator"; + std::string fac_precond_name = + "FAC preconditioner for Poisson's equation"; + std::string hypre_poisson_name = fac_ops_name + "::hypre_solver"; + +#ifdef HAVE_HYPRE + boost::shared_ptr hypre_poisson( + new solv::CellPoissonHypreSolver( + dim, + hypre_poisson_name, + input_db->isDatabase("hypre_solver") ? + input_db->getDatabase("hypre_solver") : + boost::shared_ptr())); + + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + hypre_poisson, + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#else + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#endif + + boost::shared_ptr fac_precond( + new solv::FACPreconditioner( + fac_precond_name, + fac_ops, + input_db->isDatabase("fac_precond") ? + input_db->getDatabase("fac_precond") : + boost::shared_ptr())); + + AdaptivePoisson adaptive_poisson(adaptive_poisson_name, + dim, + fac_ops, + fac_precond, + *(input_db->getDatabase("AdaptivePoisson")), + &tbox::plog); /* * Create the tag-and-initializer, box-generator and load-balancer @@ -176,7 +222,6 @@ int main( */ boost::shared_ptr tag_and_initializer( new mesh::StandardTagAndInitialize( - dim, "CellTaggingMethod", &adaptive_poisson, input_db->getDatabase("StandardTagAndInitialize"))); @@ -200,7 +245,7 @@ int main( boost::shared_ptr gridding_algorithm( new mesh::GriddingAlgorithm( patch_hierarchy, - " Gridding Algorithm", + "Gridding Algorithm", input_db->getDatabase("GriddingAlgorithm"), tag_and_initializer, box_generator, @@ -248,22 +293,13 @@ int main( /* * Solve. */ - string max_cycles_str = "max_cycles"; - int max_cycles = main_db->getIntegerWithDefault(max_cycles_str, 10); - double residual_tol = main_db->getDoubleWithDefault("residual_tol", - 1e-6); - tbox::pout.setf(ios::scientific); - int pre_sweeps = main_db->getIntegerWithDefault("pre_sweeps", 5); - int post_sweeps = main_db->getIntegerWithDefault("post_sweeps", 5); - string initial_u = main_db->getStringWithDefault("initial_u", "0.0"); + tbox::pout.setf(std::ios::scientific); + std::string initial_u = + main_db->getStringWithDefault("initial_u", "0.0"); adaptive_poisson.solvePoisson(patch_hierarchy, - max_cycles, - residual_tol, - pre_sweeps, - post_sweeps, - adaption_number ? string() : initial_u); - tbox::Array l2norms(patch_hierarchy->getNumberOfLevels()); - tbox::Array linorms(patch_hierarchy->getNumberOfLevels()); + adaption_number ? std::string() : initial_u); + std::vector l2norms(patch_hierarchy->getNumberOfLevels()); + std::vector linorms(patch_hierarchy->getNumberOfLevels()); adaptive_poisson.computeError(*patch_hierarchy, &l2norm, &linorm, @@ -272,18 +308,18 @@ int main( error_ok = l2norm <= target_l2norm; tbox::plog << "Err " << (error_ok ? "" : "NOT ") << "ok, err norm/target: " - << scientific << l2norm << '/' << scientific - << target_l2norm << endl; + << std::scientific << l2norm << '/' << std::scientific + << target_l2norm << std::endl; tbox::plog << "Err result after " << adaption_number << " adaptions: \n" - << setw(15) << "l2: " << setw(10) << scientific << l2norm - << setw(15) << "li: " << setw(10) << scientific << linorm + << std::setw(15) << "l2: " << std::setw(10) << std::scientific << l2norm + << std::setw(15) << "li: " << std::setw(10) << std::scientific << linorm << "\n"; for (ln = 0; ln < patch_hierarchy->getNumberOfLevels(); ++ln) { - tbox::plog << setw(10) << "l2[" << setw(2) << ln << "]: " - << setw(10) << scientific << l2norms[ln] - << setw(10) << "li[" << setw(2) << ln << "]: " - << setw(10) << scientific << linorms[ln] + tbox::plog << std::setw(10) << "l2[" << std::setw(2) << ln << "]: " + << std::setw(10) << std::scientific << l2norms[ln] + << std::setw(10) << "li[" << std::setw(2) << ln << "]: " + << std::setw(10) << std::scientific << linorms[ln] << "\n"; } @@ -314,14 +350,15 @@ int main( ++adaption_number; tbox::plog << "Adaption number " << adaption_number << "\n"; - tbox::Array tag_buffer(patch_hierarchy->getMaxNumberOfLevels()); - for (ln = 0; ln < tag_buffer.getSize(); ++ln) { + std::vector tag_buffer(patch_hierarchy->getMaxNumberOfLevels()); + for (ln = 0; ln < static_cast(tag_buffer.size()); ++ln) { tag_buffer[ln] = 1; } gridding_algorithm->regridAllFinerLevels( 0, - 0.0, - tag_buffer); + tag_buffer, + 0, + 0.0); tbox::plog << "Newly adapted hierarchy\n"; patch_hierarchy->recursivePrint(tbox::plog, " ", 1); if (0) { @@ -342,7 +379,7 @@ int main( tbox::plog << "After " << adaption_number << "/" << max_adaptions << " adaptions, residual is " << l2norm << "/" << target_l2norm - << endl; + << std::endl; tbox::TimerManager::getManager()->print(tbox::plog); @@ -351,7 +388,7 @@ int main( #endif if (error_ok) { - tbox::pout << "\nPASSED: FAC" << endl; + tbox::pout << "\nPASSED: FAC" << std::endl; } else { TBOX_ERROR("Failed to meet accuracy specifications."); } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.C index ea6e9966..e9955514 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Misc patch functions used in FAC solver tests. * ************************************************************************/ @@ -23,7 +23,7 @@ #include "SAMRAI/pdat/SideData.h" #include "SAMRAI/pdat/OutersideData.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -131,8 +131,9 @@ void setCellDataToSinusoid( const SinusoidFcn& fcn) { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); if (cd.getDim() == tbox::Dimension(2)) { MDA_Access > t4 = pdat::ArrayDataAccess::access<2, double>(cd.getArrayData()); @@ -225,8 +226,9 @@ void setCellDataToQuartic( const QuarticFcn& fcn) { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); if (cd.getDim() == tbox::Dimension(2)) { MDA_Access > t4 = pdat::ArrayDataAccess::access<2, double>(cd.getArrayData()); diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.h index ef39d06f..f6961aca 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/patchFcns.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Misc patch functions used in FAC solver tests. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.C deleted file mode 100644 index a843f743..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.C +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Misc printing functions in FAC solver test. - * - ************************************************************************/ -#include "SAMRAI/SAMRAI_config.h" - -#include "printObject.h" - -#include "SAMRAI/pdat/MDA_Access.h" - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/pdat/ArrayData.h" - -#include - -using namespace SAMRAI; - -/*! - * \brief Print a box - */ -int printObject( - std::ostream& os, - const hier::Box& box, - const std::string& border, - unsigned short depth) -{ - NULL_USE(depth); - const tbox::Dimension& dim = box.getDim(); - if ((dim == tbox::Dimension(1))) { - os << border << "( " << box.lower(0) - << " ) to ( " - << box.upper(0) - << " )\n"; - } - if ((dim == tbox::Dimension(2))) { - os << border << "( " << box.lower(0) << ' ' << box.lower(1) - << " ) to ( " - << box.upper(0) << ' ' << box.upper(1) - << " )\n"; - } - if ((dim == tbox::Dimension(3))) { - os << border << "( " - << box.lower(0) << ' ' << box.lower(1) << ' ' << box.lower(2) - << " ) to ( " - << box.upper(0) << ' ' << box.upper(1) << ' ' << box.upper(2) - << " )\n"; - } - return 0; -} - -/*! - * \brief Print a patch data object - */ -int printObject( - std::ostream& os, - const hier::PatchData& pdat, - const std::string& border, - unsigned short depth) -{ - NULL_USE(depth); - const hier::Box& rbox = pdat.getBox(); - const hier::Box& gbox = pdat.getBox(); - os << border - << "Box = ( " - << rbox.lower(0) << ' ' << rbox.lower(1) - << " ) to ( " - << rbox.upper(0) << ' ' << rbox.upper(1) - << " )\n"; - os << border - << "Ghost hier::Box = ( " - << gbox.lower(0) << ' ' << gbox.lower(1) - << " ) to ( " - << gbox.upper(0) << ' ' << gbox.upper(1) - << " )\n"; - return 0; -} - -/*! - * \brief Print an array data object - */ -template -int printObject( - std::ostream& os, - const pdat::ArrayData& adat, - const int depth, - const std::string& border) -{ - os << border << "printObject(pdat::ArayData)... " << std::endl; - const hier::Box& rbox = adat.getBox(); - os << border - << "Box = ( " - << rbox.lower(0) << ' ' << rbox.lower(1) - << " ) to ( " - << rbox.upper(0) << ' ' << rbox.upper(1) - << " )\n"; - os << border << "depth " << depth << "\n"; - printObject(os, - adat.getDim(), - (const T *)adat.getPointer(depth), - &adat.getBox().lower()[0], - &adat.getBox().upper()[0] - ); - return 0; -} -template int printObject( - std::ostream& os, - const pdat::ArrayData& adat, - const int depth, - const std::string& border); - -/*! - * \brief Print an array - */ -int printObject( - std::ostream& os - , - const tbox::Dimension& dim - , - const double* a_ptr, - const int* a_lower, - const int* a_upper - , - const int* lower - , - const int* upper) { - switch (dim.getValue()) { - case 1: - { - MDA_AccessConst > a(a_ptr, - a_lower, - a_upper); - if (!lower) lower = a_lower; - if (!upper) upper = a_upper; - os << "\narray data... " << std::endl; - for (int j = lower[1]; j <= upper[1]; ++j) { - for (int i = lower[0]; i <= upper[0]; ++i) { - os << i << ' ' << j << ' ' << a(i, j) << std::endl; - } - } - } - break; - case 2: - { - MDA_AccessConst > a(a_ptr, - a_lower, - a_upper); - if (!lower) lower = a_lower; - if (!upper) upper = a_upper; - os << "\narray data... " << std::endl; - for (int j = lower[1]; j <= upper[1]; ++j) { - for (int i = lower[0]; i <= upper[0]; ++i) { - os << i << ' ' << j << ' ' << a(i, j) << std::endl; - } - } - } - break; - case 3: - { - MDA_AccessConst > a(a_ptr, - a_lower, - a_upper); - if (!lower) lower = a_lower; - if (!upper) upper = a_upper; - os << "\narray data... " << std::endl; - for (int j = lower[1]; j <= upper[1]; ++j) { - for (int i = lower[0]; i <= upper[0]; ++i) { - os << i << ' ' << j << ' ' << a(i, j) << std::endl; - } - } - } - break; - } - return 0; -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.h deleted file mode 100644 index dcd45c11..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/printObject.h +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Misc printing functions in FAC solver test. - * - ************************************************************************/ -#ifndef included_printObject_h -#define included_printObject_h - -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/hier/Box.h" - -#include -#include - -using namespace std; -using namespace SAMRAI; - -/*! - * @brief Print a box - */ -int -printObject( - std::ostream& os, - const hier::Box& box, - const std::string& border = std::string(), - unsigned short depth = 0); - -/*! - * @brief Print a patch data object - */ -int -printObject( - std::ostream& os, - const hier::PatchData& pdat, - const std::string& border = std::string(), - unsigned short depth = 0); - -/*! - * @brief Print an array - */ -int -printObject( - std::ostream& os, - const tbox::Dimension& dim, - const double* a_ptr, - const int* a_lower, - const int* a_upper, - const int* lower = NULL, - const int* upper = NULL); - -/*! - * @brief Print an array data object - */ -template -int -printObject( - std::ostream& os, - const tbox::Dimension& dim, - const pdat::ArrayData& adat, - const int depth = 0, - const std::string& border = std::string()); - -#endif // included_printObject_h diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.C b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.C index 1c2b2d53..faef3a0e 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Misc array setting functions in FAC solver test. * ************************************************************************/ @@ -107,7 +107,7 @@ void setArrayDataTo( NULL_USE(xhi); const double ucoef[2] = { 1., 1. }; - if (coef == NULL) coef = ucoef; + if (coef == 0) coef = ucoef; for (int j = lower[1]; j <= upper[1]; ++j) { double y = xlo[1] + h[1] * (j - lower[1] + 0.5); for (int i = lower[0]; i <= upper[0]; ++i) { @@ -131,7 +131,7 @@ void setArrayDataTo( NULL_USE(xhi); const double ucoef[3] = { 1., 1., 1. }; - if (coef == NULL) coef = ucoef; + if (coef == 0) coef = ucoef; for (int k = lower[2]; k <= upper[2]; ++k) { double z = xlo[2] + h[2] * (k - lower[2] + 0.5); for (int j = lower[1]; j <= upper[1]; ++j) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.h b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.h index f6872afd..a331837e 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/setArrayData.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Misc array setting functions in FAC solver test. * ************************************************************************/ @@ -28,7 +28,7 @@ setArrayDataTo( const double* xhi, const double* h , - const double* coef = NULL); + const double* coef = 0); void setArrayDataTo( @@ -42,7 +42,7 @@ setArrayDataTo( const double* xhi, const double* h , - const double* coef = NULL); + const double* coef = 0); void setArrayDataTo( MDA_Access >& s @@ -55,7 +55,7 @@ setArrayDataTo( const double* xhi, const double* h , - const double* coef = NULL); + const double* coef = 0); void setArrayDataToSinusoidal( diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.2d.input index 822fc6bd..615ed3bf 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.2d.input @@ -3,67 +3,114 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for FAC solver tests. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for FAC solver tests using true adaptivity. * ************************************************************************/ Main { + // Dimension of the problem. dim = 2 + + // Base name of problem. base_name = "allneumann2d" + + // Name of log file name. If not specified, determined by base_name. + log_filename = "allneumann2d.log" + + // If TRUE all nodes log, otherwise only node 0 logs. + log_all = FALSE + + // Visualization filename. If not specified, determined by base_name. + // vis_filename = "allneumann2d" + + // If TRUE write plot file on each adaption. do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 + + // Maximum number of adaptions to perform. max_adaptions = 3 + + // Upper limit on L2 Norm for solution to have converged. target_l2norm = 1e-4 + + // Initial quess for u on first adaption. + initial_u = "0.0" } AdaptivePoisson { + // FACPreconditioner algorithm. Either "default", "mccormick-s4.3", or + // "pernice". fac_algo = "default" + + // Type of boundary conditions. One of "sine", "gauss", "multigauss", + // "poly", or "gauss-coef". problem_name = "sine" - // finest_plot_level = 0 + + // Tag cells for adaption if error estimator exceeds this threshold. adaption_threshold = 5.0e-3 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - hypre_solver { - use_smg = TRUE - } - } + + // Input for PoissonSineSolution. sine_solution { + // Wave numbers in half-cycles and phase shifts in half-cycles in each + // dimension. SinusoidFcnControl = "{ nx=1.0 px=0.40 ny=1.0 py=0.75 }" + + // For each direction in each dimension, whether the boundary condition + // at that location is a Neumann boundary condition. neumann_locations = TRUE, TRUE, TRUE, TRUE + + // Linear coefficient. linear_coef = -1.0e+00 } } +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_solver { + use_smg = FALSE +} + +// Refer to mesh::CartesianGridGeometry and its base classes for input. CartesianGridGeometry { domain_boxes = [(0,0), (31,31)] x_lo = 0, 0 x_up = 1, 1 } +// Refer to mesh::StandardTagAndInitialize for input. StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to mesh::BergerRigoutsos for input. BergerRigoutsos { - log_node_history = TRUE - log_cluster_summary = TRUE - log_cluster = TRUE + efficiency_tolerance = 0.99 + combine_efficiency = 0.99 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = TRUE } +// Refer to mesh::TreeLoadBalancer for input. TreeLoadBalancer{ } +// Refer to hier::PatchHierarchy for input. PatchHierarchy { max_levels = 5 proper_nesting_buffer = 2, 2, 2, 2, 2, 2 @@ -89,30 +136,17 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } +// Refer to mesh::GriddingAlgorithm for input. GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.99 - combine_efficiency = 0.99 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } +// Refer to tbox::TimerManager for input. TimerManager{ timer_list = "solv::FACPreconditionerX::*", "solv::ScalarPoissonFacOpsX::*", "solv::CartesianRobinBcHelperX::*" print_user = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.3d.input index 3f653395..0bd52503 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/allneumann.3d.input @@ -3,36 +3,43 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "allneumann3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 1e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 3.5e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 1e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { problem_name = "sine" // finest_dbg_plot_ln = 0 adaption_threshold = 3.0e-2 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } sine_solution { SinusoidFcnControl = "{ nx=1.0 px=0.5 ny=1.0 py=0.3 nz=1.0 pz=1.8 }" neumann_locations = TRUE, TRUE, TRUE, TRUE, TRUE, TRUE @@ -52,10 +59,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -84,19 +90,17 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { combine_efficiency = 0.95 efficiency_tolerance = 0.95 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/complex.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/complex.2d.input index 18b8cd8a..bfa2e44c 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/complex.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/complex.2d.input @@ -3,42 +3,45 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "complex2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 5 target_l2norm = 3e-3 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "sine" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } sine_solution { SinusoidFcnControl = "{ nx=2.0 px=0.0 ny=3.0 py=0.0 }" } - polynomial_solution { - QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem - } - // finest_plot_level = 0 adaption_threshold = 0.2 } @@ -83,28 +86,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.2d.input index 59edc0d7..fc9989f5 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.2d.input @@ -3,45 +3,45 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "default2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 2e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "gauss" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } - sine_solution { - SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 }" - } gaussian_solution { GaussianFcnControl = "{ lambda=-1000 amp=1 cx=0.5 cy=0.5 }" } - polynomial_solution { - QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem - } - // finest_plot_level = 0 adaption_threshold = .0100 } @@ -86,28 +86,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.3d.input index 4162ee3c..e715e404 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/default.3d.input @@ -3,40 +3,45 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "default3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 1e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 4 target_l2norm = 1.5e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 1e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { problem_name = "multigauss" - // finest_dbg_plot_ln = 0 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } multigaussian_solution { GaussianFcnControl_0 = "{ lambda=-50 cx=0.5 cy=0.5 cz=0.0 }" GaussianFcnControl_1 = "{ lambda=-20 cx=0.0 cy=0.0 cz=1.0 }" } - // finest_plot_level = 0 adaption_threshold = .0200 } @@ -52,10 +57,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -86,22 +90,17 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE - combine_efficiency = 0.75 - efficiency_tolerance = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } BergerRigoutsos { - log_node_history = FALSE - log_cluster = FALSE + combine_efficiency = 0.75 + efficiency_tolerance = 0.75 + DEV_log_node_history = FALSE + DEV_log_cluster = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.2d.input index 5fa1a946..f4d78c78 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.2d.input @@ -3,50 +3,47 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "gauss2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 5 target_l2norm = 5e-5 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "multigauss" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "LINEAR_REFINE" - prolongation_method = "LINEAR_REFINE" - } multigaussian_solution { GaussianFcnControl_0 = "{ lambda=-100 cx=0.5 cy=0.5 }" GaussianFcnControl_1 = "{ lambda=-50 cx=0.0 cy=0.5 }" GaussianFcnControl_2 = "{ lambda=-25 cx=0.5 cy=0.0 }" } - sine_solution { - SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 }" - } - gaussian_solution { - GaussianFcnControl = "{ lambda=-1000 amp=1 cx=0.5 cy=0.5 }" - } - polynomial_solution { - QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem - } - // finest_plot_level = 0 adaption_threshold = .0010 } @@ -62,9 +59,11 @@ StandardTagAndInitialize { } BergerRigoutsos { - log_node_history = TRUE - log_cluster_summary = TRUE - log_cluster = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = TRUE } TreeLoadBalancer{ @@ -99,26 +98,11 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.85 - combine_efficiency = 0.85 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.3d.input index 4822f139..aaa4f68c 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/gauss.3d.input @@ -3,48 +3,48 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "gauss3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 2.6e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "multigauss" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } multigaussian_solution { GaussianFcnControl_0 = "{ lambda=-500 cx=0.5 cy=0.5 cz=0.5 }" GaussianFcnControl_1 = "{ lambda=-50 cx=0.0 cy=0.5 cz=0.5 }" GaussianFcnControl_2 = "{ lambda=-25 cx=0.5 cy=0.0 cz=0.5 }" GaussianFcnControl_3 = "{ lambda=-200 cx=0.0 cy=0.0 cz=1.0 }" } - sine_solution { - SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 nz=1.0 pz=0.0 }" - } - gaussian_solution { - GaussianFcnControl = "{ lambda=-1000 amp=1 cx=0.5 cy=0.5 cz=0.5 }" - } - // finest_plot_level = 0 adaption_threshold = .0200 } @@ -61,10 +61,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -93,19 +92,17 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } +BergerRigoutsos { + efficiency_tolerance = 0.73 + combine_efficiency = 0.73 +} + GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE - combine_efficiency = 0.73 - efficiency_tolerance = 0.73 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.2d.input index 5a0d1317..a98656ee 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.2d.input @@ -3,40 +3,43 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "periodic2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 2.2e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "sine" - // finest_plot_level = 0 adaption_threshold = 7.0e-3 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - hypre_solver { - use_smg = TRUE - } - } sine_solution { SinusoidFcnControl = "{ nx=2.0 px=0.40 ny=2.0 py=0.30 }" linear_coef = -1.0e+00 @@ -56,10 +59,12 @@ StandardTagAndInitialize { } BergerRigoutsos { - log_node_history = TRUE - log_cluster_summary = TRUE - log_cluster = TRUE - max_lap_cut_from_center = 0.1 + efficiency_tolerance = 0.80 + combine_efficiency = 0.80 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = TRUE + DEV_max_inflection_cut_from_center = 0.1 } TreeLoadBalancer{ @@ -92,34 +97,16 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - proper_nesting_buffer = 2, 2, 2, 2, 2, 2 - // load_balance = FALSE - efficiency_tolerance = 0.80 - combine_efficiency = 0.80 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" - allow_patches_smaller_than_ghostwidth = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE check_overflow_nesting = FALSE check_proper_nesting = FALSE - check_connectors = FALSE - print_layer_hierarchy = FALSE - print_steps = FALSE + DEV_check_connectors = FALSE + DEV_print_steps = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.3d.input index be8c3e73..d6026f63 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/periodic.3d.input @@ -3,40 +3,44 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "periodic3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 1e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 3.7e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 1e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "sine" // finest_dbg_plot_ln = 0 adaption_threshold = 3.0e-2 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - hypre_solver { - use_smg = TRUE - } - } sine_solution { SinusoidFcnControl = "{ nx=2.0 px=0.5 ny=2.0 py=0.4 nz=2.0 pz=1.8 }" linear_coef = -1.0e+00 @@ -56,10 +60,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -85,19 +88,17 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { combine_efficiency = 0.88 efficiency_tolerance = 0.88 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/ring_gauss.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/ring_gauss.2d.input index 76c74174..dac6e201 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/ring_gauss.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/ring_gauss.2d.input @@ -3,45 +3,45 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "ring-gauss2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 3 target_l2norm = 2e-3 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "gauss" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } - sine_solution { - SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 }" - } gaussian_solution { GaussianFcnControl = "{ lambda=-10 amp=1 cx=0.5 cy=0.5 }" } - polynomial_solution { - QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem - } - // finest_plot_level = 0 adaption_threshold = .0300 } @@ -87,29 +87,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - proper_nesting_buffer = 2, 2, 2, 2, 2, 2 - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple.2d.input index 71d9c643..c04c7e38 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple.2d.input @@ -3,38 +3,42 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "simple2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 5 target_l2norm = 7e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "poly" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } - sine_solution { - SinusoidFcnControl = "{ nx=2.0 px=0.0 ny=2.0 py=0.0 }" - } polynomial_solution { QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem } @@ -82,28 +86,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.2d.input index 6832336b..abb5909e 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.2d.input @@ -3,45 +3,45 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "simple-gauss2d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 5 target_l2norm = 1.0e-3 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "gauss" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } gaussian_solution { GaussianFcnControl = "{ lambda=-200.0 cx=0.5 cy=0.5 }" } - sine_solution { - SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 }" - } - polynomial_solution { - QuarticFcnControl = "{ 6=1 8=-1 9=-1 12=1 }" // Pernice's problem - } - // finest_plot_level = 0 adaption_threshold = .0150 } @@ -86,28 +86,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.3d.input index e916b288..1dbac9fe 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/simple_gauss.3d.input @@ -3,35 +3,42 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "simple-gauss3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 1e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 4 target_l2norm = 1.0e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 1e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { problem_name = "gauss" // finest_dbg_plot_ln = 0 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } gaussian_solution { GaussianFcnControl = "{ lambda=-20.0 cx=0.0 cy=0.0 cz=0.0 }" } @@ -50,10 +57,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -81,20 +87,17 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { combine_efficiency = 0.88 efficiency_tolerance = 0.88 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" - allow_patches_smaller_than_ghostwidth = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.2d.input index e16445b6..ee7dea91 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.2d.input @@ -3,40 +3,46 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 base_name = "varcoef3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 3e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 5 target_l2norm = 5.6e-4 } +fac_precond { + max_cycles = 15 + residual_tol = 3e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { fac_algo = "default" problem_name = "gauss-coef" - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10000 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } gaussian_diffcoef_solution { GaussianFcnControl = "{ lambda=-4.0 cx=0.5 cy=0.5 }" SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 }" } - // finest_plot_level = 0 adaption_threshold = .022 } @@ -81,28 +87,18 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.80 combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "ERROR" check_overlapping_patches = "ERROR" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.3d.input index c4bb89fb..8e69096a 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/FAC_adaptive/test_inputs/varcoef.3d.input @@ -3,35 +3,42 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for FAC solver tests. * ************************************************************************/ +// Refer to allneumann2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "varcoef3d" do_plot = TRUE - max_cycles = 15 - residual_tol = 1e-10 - pre_sweeps = 1 - post_sweeps = 3 max_adaptions = 2 target_l2norm = 3.8e-3 } +fac_precond { + max_cycles = 15 + residual_tol = 1e-10 + num_pre_sweeps = 1 + num_post_sweeps = 3 +} + +fac_ops { + coarse_solver_tolerance = 1e-8 + coarse_solver_max_iterations = 10 + prolongation_method = "LINEAR_REFINE" +} + +hypre_solver { + use_smg = FALSE +} + AdaptivePoisson { problem_name = "gauss-coef" // finest_dbg_plot_ln = 0 - ScalarPoissonOps { - enable_logging = TRUE - coarse_solver_choice = "hypre" - coarse_solver_tolerance = 1e-14 - coarse_solver_max_iterations = 10 - smoothing_choice = "redblack" - cf_discretization = "Ewing" - prolongation_method = "LINEAR_REFINE" - } gaussian_diffcoef_solution { GaussianFcnControl = "{ lambda=0 cx=0.5 cy=0.5 cz=0.5 }" SinusoidFcnControl = "{ nx=1.0 px=0.0 ny=1.0 py=0.0 nz=1.0 pz=0.0 }" @@ -51,10 +58,9 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -83,19 +89,17 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { combine_efficiency = 0.88 efficiency_tolerance = 0.88 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE } TimerManager{ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.depend deleted file mode 100644 index ce57e2a9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.depend +++ /dev/null @@ -1,542 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile dependencies -## -######################################################################### - -## This file is automatically generated by depend.pl. - - -FILE_0=FACPoisson.o -DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ - $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/LocationIndexRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ - $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h FACPoisson.C \ - FACPoisson.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=main.o -DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ - $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/LocationIndexRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ - $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h FACPoisson.h \ - main.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} - diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.in b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.in deleted file mode 100644 index 33a0bf12..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/Makefile.in +++ /dev/null @@ -1,96 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for SAMRAI FAC Poisson solver example -## -######################################################################### - -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ -SUBDIR = source/test/FAC_nonadaptive -VPATH = @srcdir@ -TESTTOOLS = ../testtools -OBJECT = ../../.. - -default: check - -include $(OBJECT)/config/Makefile.config - -CPPFLAGS_EXTRA= -DTESTING=0 - -NUM_TESTS = 2 - -TEST_NPROCS = @TEST_NPROCS@ - -CXX_OBJS = main.o FACPoisson.o -F_OBJS = facpoisson2d.o facpoisson3d.o - -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main - -check: - $(MAKE) check2d - $(MAKE) check3d - -check2d: main - @for i in test_inputs/*2d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -check3d: main - @for i in test_inputs/*3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -checkcompile: main - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -examples2d: main - @for i in $(SRCDIR)/example_inputs/*.2d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -examples3d: main - @for i in $(SRCDIR)/example_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -examples: - $(MAKE) examples2d - $(MAKE) examples3d - -clean-check: - $(SAMCLEAN) - -clean: clean-check - $(RM) main - $(RM) -rf *visit - -redo: - $(RM) core main - -include $(SRCDIR)/Makefile.depend - -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) - -facpoisson2d.o: $(FORTRAN)/facpoisson2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/facpoisson2d.m4 > facpoisson2d.f - $(F77) $(FFLAGS) -c facpoisson2d.f -o $@ - -facpoisson3d.o: $(FORTRAN)/facpoisson3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/facpoisson3d.m4 > facpoisson3d.f - $(F77) $(FFLAGS) -c facpoisson3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/README b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/README deleted file mode 100644 index 2b015385..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/README +++ /dev/null @@ -1,185 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: FAC solver example -## -######################################################################### - -This example demonstrates use of the FAC classes in a SAMRAI application. -The files included in this directory are as follows: - - FACPoisson.h, FACPoisson.C - - Class to set up and solve the scalar - Poisson equation. - main.C - example main program - -Class FACPoisson uses the solver defined in CellPoissonFACSolver. -This class assembles the the FAC algorithm in FACPreconditioner, -and the level operations in CellPoissonFACOps. It uses the -Robin boundary condition, which is accessed through the virtual -interface defined by RobinBcCoefStrategy class. - -This example uses the library-implemented LocationIndexRobinBcCoefs -version of the Robin boundary condition. Other versions of Robin -boundary conditions may be used, including user-defined. See the -RobinBcCoefStrategy class. The boundary conditions specified -in the input files are parsed by that the LocationIndexRobinBcCoefs -class. - -COMPILE and RUN ---------------- -Compile: make main2d main3d -Run: main2 2d.default.input - main2 2d.otherbc.input - main2 2d.const-refine.input - main3 3d.default.input - main3 3d.otherbc.input - main3 3d.const-refine.input - - -INPUTS ------- - - The input files *.default.input have sample default settings. - Variations of the boundary conditions in this example are shown - in the files *otherbc.input. (Other ways to vary boundary - conditions are to supply different implementations of the - RobinBcCoefStrategy strategy class.) Using constant refinement - in the prolongation step is shown in the *.const-refine.input - files. (Constant refinement gives slower convergence but may - be more effective with strongly varying diffusion coefficients.) - - Main { - // General specifications. - base_name = "default2" // The base file name for output files. - vis_filename = "default2" // The base file name for visualization files. - // defaults to the base name. - } - - FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_iterations = 30 // Max number of FAC cycles to use - residual_tol = 1.e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - boundary_0 = "slope", "0" - boundary_1 = "coefficients", "0", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - } - } - - "CartesianGeometry" input section - --------------------------------- - CartesianGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - x_lo = 0.e0 , 0.e0 - x_up = 65.e0 , 55.e0 - domain_boxes = [(0,9),(14,20)], - [(0,21),(19,35)], - [(0,36),(14,49)], - [(20,0),(49,54)], - [(50,0),(64,35)], - [(50,46),(64,54)], - [(57,36),(64,45)] - periodic_dimension = 0, 1 // periodic in y only - } - - - "GriddingAlgorithm" input section - --------------------------------- - GriddingAlgorithm { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 48 , 48 - } - } - - "StandardTagAndInitialize" input section - --------------------------------------------- - StandardTagAndInitialize { - // Specification of the type of tagging to be performed - // tagging_method -- (string array) one or more entries specifying - // the tagging algorithm used. Options include: - // "GRADIENT_DETECTOR" - // "RICHARDSON_EXTRAPOLATION" - // "REFINE_BOXES" - // - // REFINE_BOXES allows you to prescribe where refinement should occur. - // If this option is used, you must also supply a RefineBoxes database - // entry with the refine boxes on different levels specified. i.e. - // RefineBoxes{ - // level_0 -- (BoxArray) Boxes to be refined on level 0 - // level_1 -- (BoxArray) Boxes to be refined on level 1 - // etc. - // - // Static refine boxes option. - tagging_method = "REFINE_BOXES" - RefineBoxes { - level0_boxes = [(15,0),(29,14)] - level1_boxes = [(65,10),(114,40)] - } - } diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.2d.input deleted file mode 100644 index bdf22828..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.2d.input +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the input file for the 2D FAC example -// demonstrating changes in boundary conditions. -// -// Note that using constant refine prolongation -// lead to slower convergence. - -Main { - dim = 2 - // Base name for output files. - base_name = "constantrefine2" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "Vizamrai", "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 20 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "CONSTANT_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - // boundary_0 = "slope", "0" - // boundary_1 = "coefficients", "0", "0" - // boundary_2 = "value", "0" - // boundary_3 = "value", "0" - boundary_0 = "value", "0" - boundary_1 = "value", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0), (31,31)] - x_lo = 0, 0 - x_up = 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0),(31,15)] - level_1 = [(0,0),(63,15)] - level_2 = [(0,0),(16,16)] - //etc. - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2 - level_2 = 2, 2 - } - largest_patch_size { - level_0 = 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.3d.input deleted file mode 100644 index 96c8bf21..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/const_refine.3d.input +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the input file for the 3D FAC example -// demonstrating changes in boundary conditions. -// -// Note that using constant refine prolongation -// lead to slower convergence. - -Main { - dim = 3 - // Base name for output files. - base_name = "constantrefine3" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "Vizamrai", "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 20 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "CONSTANT_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - // boundary_0 = "slope", "0" - // boundary_1 = "coefficients", "0", "0" - // boundary_2 = "value", "0" - // boundary_3 = "value", "0" - boundary_0 = "value", "0" - boundary_1 = "value", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - boundary_4 = "value", "0" - boundary_5 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0,0), (15,15,15)] - x_lo = 0, 0, 0 - x_up = 1, 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0,0),(7,7,7)] - level_1 = [(0,0,0),(7,7,7)] - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - } - largest_patch_size { - level_0 = 32, 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.2d.input deleted file mode 100644 index a9b63572..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.2d.input +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the input file for the 2D FAC example -// demonstrating changes in boundary conditions. -// -// Note that you should not compare the computed -// solution with the exact solution in the example. -// The exact solution is only for the boundary -// condition of 0 on all boundaries. - -Main { - dim = 2 - // Base name for output files. - base_name = "otherbc2" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "Vizamrai", "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 10 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "LINEAR_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - // boundary_0 = "slope", "0" - // boundary_1 = "coefficients", "0", "0" - // boundary_2 = "value", "0" - // boundary_3 = "value", "0" - boundary_0 = "slope", "0" - boundary_1 = "coefficients", "0", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0), (31,31)] - x_lo = 0, 0 - x_up = 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0),(31,15)] - level_1 = [(0,0),(63,15)] - level_2 = [(0,0),(16,16)] - //etc. - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2 - level_2 = 2, 2 - } - largest_patch_size { - level_0 = 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.3d.input deleted file mode 100644 index 89434f73..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/example_inputs/otherbc.3d.input +++ /dev/null @@ -1,137 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the input file for the 3D FAC example -// demonstrating changes in boundary conditions. -// -// Note that you should not compare the computed -// solution with the exact solution in the example. -// The exact solution is only for the boundary -// condition of 0 on all boundaries. - -Main { - dim = 3 - // Base name for output files. - base_name = "otherbc3" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "Vizamrai", "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 10 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "LINEAR_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - // boundary_0 = "slope", "0" - // boundary_1 = "coefficients", "0", "0" - // boundary_2 = "value", "0" - // boundary_3 = "value", "0" - boundary_0 = "slope", "0" - boundary_1 = "coefficients", "0", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - boundary_4 = "value", "0" - boundary_5 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0,0), (15,15,15)] - x_lo = 0, 0, 0 - x_up = 1, 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0,0),(7,7,7)] - level_1 = [(0,0,0),(7,7,7)] - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - } - largest_patch_size { - level_0 = 32, 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/main.C b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/main.C deleted file mode 100644 index 4ba65ab8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/main.C +++ /dev/null @@ -1,291 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Main program for FAC Poisson example - * - ************************************************************************/ -#include "SAMRAI/SAMRAI_config.h" - -#include -using namespace std; - -#include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/mesh/GriddingAlgorithm.h" -#include "SAMRAI/tbox/InputDatabase.h" -#include "SAMRAI/tbox/InputManager.h" -#include "SAMRAI/mesh/TreeLoadBalancer.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/mesh/StandardTagAndInitialize.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/appu/VisItDataWriter.h" - -#include "FACPoisson.h" - -#include - -using namespace SAMRAI; - -/* - ************************************************************************ - * - * This is the driver program to demonstrate - * how to use the FAC Poisson solver. - * - * We set up the simple problem - * u + div(grad(u)) = sin(x)*sin(y) - * in the domain [0:1]x[0:1], with u=0 on the - * boundary. - * - * FACPoisson is the primary object used to - * set up and solve the system. It maintains - * the data for the computed solution u, the - * exact solution, and the right hand side. - * - * The hierarchy created to solve this problem - * has only one level. (The FAC Poisson solver - * is a single-level solver.) - * - ************************************************************************* - */ - -int main( - int argc, - char* argv[]) -{ - /* - * Initialize MPI, SAMRAI. - */ - - tbox::SAMRAI_MPI::init(&argc, &argv); - tbox::SAMRAIManager::initialize(); - tbox::SAMRAIManager::startup(); - - /* - * Create block to force pointer deallocation. If this is not done - * then there will be memory leaks reported. - */ - { - /* - * Process command line arguments. For each run, the input - * filename must be specified. Usage is: - * - * executable - * - */ - string input_filename; - - if (argc != 2) { - TBOX_ERROR("USAGE: " << argv[0] << " \n" - << " options:\n" - << " none at this time" << endl); - } else { - input_filename = argv[1]; - } - - /* - * Create input database and parse all data in input file. - */ - - boost::shared_ptr input_db( - new tbox::InputDatabase("input_db")); - tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); - - /* - * Set up the timer manager. - */ - if (input_db->isDatabase("TimerManager")) { - tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); - } - - /* - * Retrieve "Main" section from input database. - * The main database is used only in main(). - * The base_name variable is a base name for - * all name strings in this program. - */ - - boost::shared_ptr main_db(input_db->getDatabase("Main")); - - const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); - - string base_name = "unnamed"; - base_name = main_db->getStringWithDefault("base_name", base_name); - - /* - * Start logging. - */ - const string log_file_name = base_name + ".log"; - bool log_all_nodes = false; - log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", - log_all_nodes); - if (log_all_nodes) { - tbox::PIO::logAllNodes(log_file_name); - } else { - tbox::PIO::logOnlyNodeZero(log_file_name); - } - - /* - * Create major algorithm and data objects which comprise application. - * Each object will be initialized either from input data or restart - * files, or a combination of both. Refer to each class constructor - * for details. For more information on the composition of objects - * for this application, see comments at top of file. - */ - - boost::shared_ptr grid_geometry( - new geom::CartesianGridGeometry( - dim, - base_name + "CartesianGridGeometry", - input_db->getDatabase("CartesianGridGeometry"))); - tbox::plog << "Cartesian Geometry:" << endl; - grid_geometry->printClassData(tbox::plog); - - boost::shared_ptr patch_hierarchy( - new hier::PatchHierarchy( - base_name + "::PatchHierarchy", - grid_geometry, - input_db->getDatabase("PatchHierarchy"))); - - /* - * The FACPoisson object is the main user object specific to the - * problem being solved. It provides the implementations for setting - * up the grid and plotting data. It also wraps up the solve - * process that includes making the initial guess, specifying the - * boundary conditions and call the solver. - */ - FACPoisson fac_poisson(base_name + "::FACPoisson", - dim, - input_db->isDatabase("FACPoisson") ? - input_db->getDatabase("FACPoisson") : - boost::shared_ptr()); - - /* - * Create the tag-and-initializer, box-generator and load-balancer - * object references required by the gridding_algorithm object. - */ - boost::shared_ptr tag_and_initializer( - new mesh::StandardTagAndInitialize( - dim, - "CellTaggingMethod", - &fac_poisson, - input_db->getDatabase("StandardTagAndInitialize"))); - boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); - boost::shared_ptr load_balancer( - new mesh::TreeLoadBalancer( - dim, - "load balancer", - boost::shared_ptr())); - load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - - /* - * Create the gridding algorithm used to generate the SAMR grid - * and create the grid. - */ - boost::shared_ptr gridding_algorithm( - new mesh::GriddingAlgorithm( - patch_hierarchy, - "Gridding Algorithm", - input_db->getDatabase("GriddingAlgorithm"), - tag_and_initializer, - box_generator, - load_balancer)); - tbox::plog << "Gridding algorithm:" << endl; - gridding_algorithm->printClassData(tbox::plog); - - /* - * Make the coarsest patch level where we will be solving. - */ - gridding_algorithm->makeCoarsestLevel(0.0); - bool done = false; - for (int lnum = 0; - patch_hierarchy->levelCanBeRefined(lnum) && !done; lnum++) { - tbox::plog << "Adding finner levels with lnum = " << lnum << endl; - gridding_algorithm->makeFinerLevel( - 0.0, - true, - 0); - tbox::plog << "Just added finer levels with lnum = " << lnum << endl; - done = !(patch_hierarchy->finerLevelExists(lnum)); - } - - /* - * Set up the plotter for the hierarchy just created. - * The FACPoisson object handles the data and has the - * function setupExternalPlotter to register its data - * with the plotter. - */ - tbox::Array vis_writer(1); - vis_writer[0] = "Visit"; - if (main_db->keyExists("vis_writer")) { - vis_writer = main_db->getStringArray("vis_writer"); - } - bool use_visit = false; - for (int i = 0; i < vis_writer.getSize(); i++) { - if (vis_writer[i] == "VisIt") use_visit = true; - } -#ifdef HAVE_HDF5 - boost::shared_ptr visit_writer; - string vis_filename = - main_db->getStringWithDefault("vis_filename", base_name); - if (use_visit) { - visit_writer.reset(new appu::VisItDataWriter(dim, - "Visit Writer", - vis_filename + ".visit")); - fac_poisson.setupPlotter(*visit_writer); - } -#endif - - /* - * After creating all objects and initializing their state, - * we print the input database and variable database contents - * to the log file. - */ - tbox::plog << "\nCheck input data and variables before simulation:" - << endl; - tbox::plog << "Input database..." << endl; - input_db->printClassData(tbox::plog); - - /* - * Solve. - */ - fac_poisson.solvePoisson(); - -#ifdef HAVE_HDF5 - /* - * Plot. - */ - if (use_visit) { - visit_writer->writePlotData(patch_hierarchy, 0); - } -#endif - - /* - * Deallocate objects when done. - */ - - tbox::TimerManager::getManager()->print(tbox::plog); - } - - /* - * This print is for the SAMRAI testing framework. Passing here - * means application ran. A better test would actually test the - * results. - */ - tbox::pout << "\nPASSED: FAC" << endl; - - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - - return 0; -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.2d.input deleted file mode 100644 index 50f88673..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.2d.input +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the default input file for the 2D FAC example. - -Main { - dim = 2 - // Base name for output files. - base_name = "default2" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 10 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "LINEAR_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - boundary_0 = "value", "0" - boundary_1 = "value", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0), (31,31)] - x_lo = 0, 0 - x_up = 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0),(31,15)] - level_1 = [(0,0),(63,15)] - level_2 = [(0,0),(16,16)] - //etc. - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2 - level_2 = 2, 2 - } - largest_patch_size { - level_0 = 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - // TODO this should be removed - sequentialize_patch_indices = TRUE -} - - -TimerManager{ - timer_list = "hier::*::*", "mesh::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = -1 - print_summed = TRUE - print_max = TRUE -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.3d.input deleted file mode 100644 index 3c3715eb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/test_inputs/default.3d.input +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for example FAC Poisson solver - * - ************************************************************************/ -// This is the default input file for the 3D FAC example. - -Main { - dim = 3 - // Base name for output files. - base_name = "default3" - // Whether to log all nodes in a parallel run. - log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "VisIt" -} - -FACPoisson { - // The FACPoisson class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for FACPoisson is simply the inputs for the individual - // parts owned by the FACPoisson class. - fac_solver { - // This is the input for the cell-centered Poisson FAC solver - // class in the SAMRAI library. - enable_logging = TRUE // Bool flag to switch logging on/off - max_cycles = 10 // Max number of FAC cycles to use - residual_tol = 1e-8 // Residual tolerance to solve for - num_pre_sweeps = 1 // Number of presmoothing sweeps to use - num_post_sweeps = 3 // Number of postsmoothing sweeps to use - prolongation_method = "LINEAR_REFINE" // Type of refinement - // used in prolongation. - // Suggested values are - // "LINEAR_REFINE" - // "CONSTANT_REFINE" - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - boundary_0 = "value", "0" - boundary_1 = "value", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - boundary_4 = "value", "0" - boundary_5 = "value", "0" - } -} - -CartesianGridGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - domain_boxes = [(0,0,0), (15,15,15)] - x_lo = 0, 0, 0 - x_up = 1, 1, 1 -} - -StandardTagAndInitialize { - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [(0,0,0),(7,7,7)] - level_1 = [(0,0,0),(7,7,7)] - } -} - -PatchHierarchy { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - } - largest_patch_size { - level_0 = 32, 32, 32 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - // TODO this should be removed - sequentialize_patch_indices = TRUE -} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.C b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.C similarity index 81% rename from base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.C rename to base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.C index 974ca607..e3542487 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.C +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for example FAC Poisson solver * ************************************************************************/ @@ -22,7 +22,7 @@ #include "SAMRAI/hier/VariableDatabase.h" extern "C" { -void F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, +void SAMRAI_F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, @@ -31,7 +31,7 @@ void F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, const double* dx, const double* xlower); -void F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) (const int& ifirst0, +void SAMRAI_F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) (const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, @@ -54,21 +54,12 @@ namespace SAMRAI { FACPoisson::FACPoisson( const std::string& object_name, const tbox::Dimension& dim, - boost::shared_ptr database): + const boost::shared_ptr& fac_solver, + const boost::shared_ptr& bc_coefs): d_object_name(object_name), d_dim(dim), - d_poisson_fac_solver((d_dim), - object_name + "::poisson_hypre", - (database && - database->isDatabase("fac_solver")) ? - database->getDatabase("fac_solver") : - boost::shared_ptr()), - d_bc_coefs(d_dim, - object_name + "::bc_coefs", - (database && - database->isDatabase("bc_coefs")) ? - database->getDatabase("bc_coefs") : - boost::shared_ptr()) + d_poisson_fac_solver(fac_solver), + d_bc_coefs(bc_coefs) { hier::VariableDatabase* vdb = @@ -121,7 +112,7 @@ FACPoisson::FACPoisson( * We use the implementation solv::LocationIndexRobinBcCoefs, but other * implementations are possible, including user-implemented. */ - d_poisson_fac_solver.setBcObject(&d_bc_coefs); + d_poisson_fac_solver->setBcObject(d_bc_coefs.get()); } /* @@ -179,21 +170,24 @@ void FACPoisson::initializeLevelData( } hier::Box pbox = patch->getBox(); boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); boost::shared_ptr > exact_data( - patch->getPatchData(d_exact_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exact_id))); boost::shared_ptr > rhs_data( - patch->getPatchData(d_rhs_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_rhs_id))); + TBOX_ASSERT(patch_geom); + TBOX_ASSERT(exact_data); + TBOX_ASSERT(rhs_data); /* * Set source function and exact solution. */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) ( + SAMRAI_F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) ( pbox.lower()[0], pbox.upper()[0], pbox.lower()[1], @@ -203,7 +197,7 @@ void FACPoisson::initializeLevelData( patch_geom->getDx(), patch_geom->getXLower()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) ( + SAMRAI_F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) ( pbox.lower()[0], pbox.upper()[0], pbox.lower()[1], @@ -261,8 +255,9 @@ int FACPoisson::solvePoisson() ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > data( - patch->getPatchData(d_comp_soln_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_comp_soln_id))); + TBOX_ASSERT(data); data->fill(0.0); } } @@ -274,10 +269,10 @@ int FACPoisson::solvePoisson() * (D is the diffusion coefficient. * C is the source term which is not used in this example.) */ - d_poisson_fac_solver.setDConstant(1.0); - d_poisson_fac_solver.setCConstant(0.0); + d_poisson_fac_solver->setDConstant(1.0); + d_poisson_fac_solver->setCConstant(0.0); - d_poisson_fac_solver.initializeSolverState( + d_poisson_fac_solver->initializeSolverState( d_comp_soln_id, d_rhs_id, d_hierarchy, @@ -286,23 +281,22 @@ int FACPoisson::solvePoisson() tbox::plog << "solving..." << std::endl; int solver_ret; - solver_ret = d_poisson_fac_solver.solveSystem(d_comp_soln_id, - d_rhs_id); + solver_ret = d_poisson_fac_solver->solveSystem(d_comp_soln_id, d_rhs_id); /* * Present data on the solve. */ double avg_factor, final_factor; - d_poisson_fac_solver.getConvergenceFactors(avg_factor, final_factor); + d_poisson_fac_solver->getConvergenceFactors(avg_factor, final_factor); tbox::plog << "\t" << (solver_ret ? "" : "NOT ") << "converged " << "\n" << " iterations: " - << d_poisson_fac_solver.getNumberOfIterations() << "\n" - << " residual: "<< d_poisson_fac_solver.getResidualNorm() + << d_poisson_fac_solver->getNumberOfIterations() << "\n" + << " residual: " << d_poisson_fac_solver->getResidualNorm() << "\n" - << " average convergence: "<< avg_factor << "\n" - << " final convergence: "<< final_factor << "\n" + << " average convergence: " << avg_factor << "\n" + << " final convergence: " << final_factor << "\n" << std::flush; - d_poisson_fac_solver.deallocateSolverState(); + d_poisson_fac_solver->deallocateSolverState(); return 0; } @@ -349,20 +343,24 @@ bool FACPoisson::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { NULL_USE(depth_id); + NULL_USE(simulation_time); - pdat::CellData::iterator icell(region, true); - pdat::CellData::iterator icellend(region, false); + pdat::CellData::iterator icell(pdat::CellGeometry::begin(region)); + pdat::CellData::iterator icellend(pdat::CellGeometry::end(region)); if (variable_name == "Error") { boost::shared_ptr > current_solution_( - patch.getPatchData(d_comp_soln_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_comp_soln_id))); boost::shared_ptr > exact_solution_( - patch.getPatchData(d_exact_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_exact_id))); + TBOX_ASSERT(current_solution_); + TBOX_ASSERT(exact_solution_); pdat::CellData& current_solution = *current_solution_; pdat::CellData& exact_solution = *exact_solution_; for ( ; icell != icellend; ++icell) { diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.h b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.h similarity index 91% rename from base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.h rename to base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.h index ab465173..e9747d6b 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/FACPoisson.h +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/FACPoisson.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for example FAC Poisson solver * ************************************************************************/ @@ -24,7 +24,7 @@ #include "SAMRAI/appu/VisDerivedDataStrategy.h" #include "SAMRAI/appu/VisItDataWriter.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -71,13 +71,15 @@ class FACPoisson: * pass in valid pointers for those streams. * * @param object_name Ojbect name - * @param database Input database (may be NULL) + * @param dim + * @param fac_solver + * @param bc_coefs */ FACPoisson( const std::string& object_name, const tbox::Dimension& dim, - boost::shared_ptr database = - boost::shared_ptr()); + const boost::shared_ptr& fac_solver, + const boost::shared_ptr& bc_coefs); virtual ~FACPoisson(); @@ -122,7 +124,8 @@ class FACPoisson: const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; //@} @@ -176,12 +179,12 @@ class FACPoisson: /*! * @brief FAC poisson solver. */ - solv::CellPoissonFACSolver d_poisson_fac_solver; + boost::shared_ptr d_poisson_fac_solver; /*! * @brief Boundary condition coefficient implementation. */ - solv::LocationIndexRobinBcCoefs d_bc_coefs; + boost::shared_ptr d_bc_coefs; //@} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.depend new file mode 100644 index 00000000..95976f7a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.depend @@ -0,0 +1,549 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=FACPoisson.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ + $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ + $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/solv/LocationIndexRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ + $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ + $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h FACPoisson.C \ + FACPoisson.h + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=main.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ + $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ + $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ + $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/solv/LocationIndexRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ + $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ + $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h FACPoisson.h \ + main.C + +DEPENDS_1 +=\ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_1}: ${DEPENDS_1} + diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.in b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.in new file mode 100644 index 00000000..18d4c0b3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/Makefile.in @@ -0,0 +1,112 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for SAMRAI FAC Poisson solver example +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/FAC_staticrefinement +VPATH = @srcdir@ +TESTTOOLS = ../testtools +OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml + +default: check + +include $(OBJECT)/config/Makefile.config + +SUBDIRS = fortran + +CPPFLAGS_EXTRA= -DTESTING=0 + +NUM_TESTS = 2 + +TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = main.o FACPoisson.o +F_OBJS = fortran/facpoisson2d.o fortran/facpoisson3d.o + +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ + $(LIBSAMRAI3D) $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main + +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/facpoisson2d.o: + +fortran/facpoisson3d.o: + +check: + $(MAKE) check2d + $(MAKE) check3d + +check2d: main + @for i in test_inputs/*2d.input ; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +check3d: main + @for i in test_inputs/*3d.input ; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +checkcompile: main + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples2d: main + @for i in example_inputs/*.2d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ + done + +examples3d: main + @for i in example_inputs/*.3d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ + done + +examples: + $(MAKE) examples2d + $(MAKE) examples3d + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + +redo: + $(RM) core main + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/README b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/README new file mode 100644 index 00000000..d83f678b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/README @@ -0,0 +1,53 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of the FAC solver +## +######################################################################### + +This is a unit test of the FAC solver. The tests use pre-set, user defined +refined boxes so the adaptivity is not connected to the evolution of the +solution. Hence the "nonadaptive" in the test name. The files included in +this directory are as follows: + + FACPoisson.[Ch] - Class to set up and solve the scalar Poisson + equation. + main.C - example main program + test_inputs/*.input - 2d and 3d input files + example_inputs - 2d and 3d example problems + +Class FACPoisson uses the solver defined in CellPoissonFACSolver. +This class assembles the the FAC algorithm in FACPreconditioner, +and the level operations in CellPoissonFACOps. It uses the +Robin boundary condition, which is accessed through the virtual +interface defined by RobinBcCoefStrategy class. + +This example uses the library-implemented LocationIndexRobinBcCoefs +version of the Robin boundary condition. Other versions of Robin +boundary conditions may be used, including user-defined. See the +RobinBcCoefStrategy class. The boundary conditions specified +in the input files are parsed by that the LocationIndexRobinBcCoefs +class. + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main default.[2,3]d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main test_inputs/default.[2,3]d.input + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/default.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.2d.input new file mode 100644 index 00000000..e861bb60 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.2d.input @@ -0,0 +1,154 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for example FAC Poisson solver + * + ************************************************************************/ + +// Refer to ../test_inputs/default.2d.input for full description of all input +// parameters specific to this problem. + +// This is the input file for the 2D FAC example +// demonstrating changes in boundary conditions. +// +// Note that using constant refine prolongation +// lead to slower convergence. + +Main { + // Dimension of the problem. + dim = 2 + + // Base name for output files. + base_name = "constantrefine2" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 20 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "CONSTANT_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_poisson { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + // boundary_0 = "slope", "0" + // boundary_1 = "coefficients", "0", "0" + // boundary_2 = "value", "0" + // boundary_3 = "value", "0" + boundary_0 = "value", "0" + boundary_1 = "value", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" +} + +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0), (31,31)] + x_lo = 0, 0 + x_up = 1, 1 +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0),(31,15)] + } + level_1 { + boxes = [(0,0),(63,15)] + } + level_2 { + boxes = [(0,0),(16,16)] + } + //etc. +} + +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2 + level_2 = 2, 2 + } + largest_patch_size { + level_0 = 32, 32 + // all finer levels will use same values as level_0... + } +} + +GriddingAlgorithm { +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.3d.input new file mode 100644 index 00000000..c65408c1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/const_refine.3d.input @@ -0,0 +1,152 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for example FAC Poisson solver + * + ************************************************************************/ + +// Refer to ../test_inputs/default.2d.input for full description of all input +// parameters specific to this problem. + +// This is the input file for the 3D FAC example +// demonstrating changes in boundary conditions. +// +// Note that using constant refine prolongation +// lead to slower convergence. + +Main { + // Dimension of the problem. + dim = 3 + + // Base name for output files. + base_name = "constantrefine3" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 20 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "CONSTANT_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_poisson { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + // boundary_0 = "slope", "0" + // boundary_1 = "coefficients", "0", "0" + // boundary_2 = "value", "0" + // boundary_3 = "value", "0" + boundary_0 = "value", "0" + boundary_1 = "value", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" + boundary_4 = "value", "0" + boundary_5 = "value", "0" +} + +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0,0), (15,15,15)] + x_lo = 0, 0, 0 + x_up = 1, 1, 1 +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0,0),(7,7,7)] + } + level_1 { + boxes = [(0,0,0),(7,7,7)] + } +} + +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + largest_patch_size { + level_0 = 32, 32, 32 + // all finer levels will use same values as level_0... + } +} + +GriddingAlgorithm { +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.2d.input new file mode 100644 index 00000000..f37284de --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.2d.input @@ -0,0 +1,156 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for example FAC Poisson solver + * + ************************************************************************/ + +// Refer to ../test/inputs/default.2d.input for full description of all input +// parameters specific to this problem. + +// This is the input file for the 2D FAC example +// demonstrating changes in boundary conditions. +// +// Note that you should not compare the computed +// solution with the exact solution in the example. +// The exact solution is only for the boundary +// condition of 0 on all boundaries. + +Main { + // Dimension of the problem. + dim = 2 + + // Base name for output files. + base_name = "otherbc2" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 10 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "LINEAR_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_poisson { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + // boundary_0 = "slope", "0" + // boundary_1 = "coefficients", "0", "0" + // boundary_2 = "value", "0" + // boundary_3 = "value", "0" + boundary_0 = "slope", "0" + boundary_1 = "coefficients", "0", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" +} + +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0), (31,31)] + x_lo = 0, 0 + x_up = 1, 1 +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0),(31,15)] + } + level_1 { + boxes = [(0,0),(63,15)] + } + level_2 { + boxes = [(0,0),(16,16)] + } + //etc. +} + +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2 + level_2 = 2, 2 + } + largest_patch_size { + level_0 = 32, 32 + // all finer levels will use same values as level_0... + } +} + +GriddingAlgorithm { +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.3d.input new file mode 100644 index 00000000..051e1b5f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/example_inputs/otherbc.3d.input @@ -0,0 +1,154 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for example FAC Poisson solver + * + ************************************************************************/ + +// Refer to ../test_inputs/default.2d.input for full description of all input +// parameters specific to this problem. + +// This is the input file for the 3D FAC example +// demonstrating changes in boundary conditions. +// +// Note that you should not compare the computed +// solution with the exact solution in the example. +// The exact solution is only for the boundary +// condition of 0 on all boundaries. + +Main { + // Dimension of the problem. + dim = 3 + + // Base name for output files. + base_name = "otherbc3" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 10 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "LINEAR_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_poisson { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + // boundary_0 = "slope", "0" + // boundary_1 = "coefficients", "0", "0" + // boundary_2 = "value", "0" + // boundary_3 = "value", "0" + boundary_0 = "slope", "0" + boundary_1 = "coefficients", "0", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" + boundary_4 = "value", "0" + boundary_5 = "value", "0" +} + +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0,0), (15,15,15)] + x_lo = 0, 0, 0 + x_up = 1, 1, 1 +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0,0),(7,7,7)] + } + level_1 { + boxes = [(0,0,0),(7,7,7)] + } +} + +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + largest_patch_size { + level_0 = 32, 32, 32 + // all finer levels will use same values as level_0... + } +} + +GriddingAlgorithm { +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.depend new file mode 100644 index 00000000..83c0fac2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.depend @@ -0,0 +1,37 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=facpoisson2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + facpoisson2d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=facpoisson3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + facpoisson3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.in new file mode 100644 index 00000000..6a2864e5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/Makefile.in @@ -0,0 +1,39 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI FAC Poisson solver +## example +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/FAC_staticrefinement/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= facpoisson2d.o facpoisson3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +facpoisson2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/facpoisson2d.m4 > facpoisson2d.f + $(F77) $(FFLAGS) -c facpoisson2d.f -o $@ + +facpoisson3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/facpoisson3d.m4 > facpoisson3d.f + $(F77) $(FFLAGS) -c facpoisson3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson2d.m4 b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson2d.m4 similarity index 81% rename from base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson2d.m4 rename to base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson2d.m4 index f3d125e4..275def2c 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 2D F77 routines. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine setexactandrhs2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson3d.m4 b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson3d.m4 similarity index 84% rename from base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson3d.m4 rename to base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson3d.m4 index 660db786..f167fde2 100644 --- a/base/SAMRAI/SAMRAI/source/test/FAC_nonadaptive/fortran/facpoisson3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/fortran/facpoisson3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 3D F77 routines. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine setexactandrhs3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/main.C b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/main.C new file mode 100644 index 00000000..23a11460 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/main.C @@ -0,0 +1,338 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Main program for FAC Poisson example + * + ************************************************************************/ +#include "SAMRAI/SAMRAI_config.h" + +#include +using namespace std; + +#include "SAMRAI/mesh/BergerRigoutsos.h" +#include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/mesh/GriddingAlgorithm.h" +#include "SAMRAI/tbox/InputDatabase.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/mesh/StandardTagAndInitialize.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" + +#include "FACPoisson.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/* + ************************************************************************ + * + * This is the driver program to demonstrate + * how to use the FAC Poisson solver. + * + * We set up the simple problem + * u + div(grad(u)) = sin(x)*sin(y) + * in the domain [0:1]x[0:1], with u=0 on the + * boundary. + * + * FACPoisson is the primary object used to + * set up and solve the system. It maintains + * the data for the computed solution u, the + * exact solution, and the right hand side. + * + * The hierarchy created to solve this problem + * has only one level. (The FAC Poisson solver + * is a single-level solver.) + * + ************************************************************************* + */ + +int main( + int argc, + char* argv[]) +{ + /* + * Initialize MPI, SAMRAI. + */ + + tbox::SAMRAI_MPI::init(&argc, &argv); + tbox::SAMRAIManager::initialize(); + tbox::SAMRAIManager::startup(); + + /* + * Create block to force pointer deallocation. If this is not done + * then there will be memory leaks reported. + */ + { + /* + * Process command line arguments. For each run, the input + * filename must be specified. Usage is: + * + * executable + * + */ + string input_filename; + + if (argc != 2) { + TBOX_ERROR("USAGE: " << argv[0] << " \n" + << " options:\n" + << " none at this time" << endl); + } else { + input_filename = argv[1]; + } + + /* + * Create input database and parse all data in input file. + */ + + boost::shared_ptr input_db( + new tbox::InputDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + /* + * Set up the timer manager. + */ + if (input_db->isDatabase("TimerManager")) { + tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); + } + + /* + * Retrieve "Main" section from input database. + * The main database is used only in main(). + * The base_name variable is a base name for + * all name strings in this program. + */ + + boost::shared_ptr main_db(input_db->getDatabase("Main")); + + const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + + string base_name = "unnamed"; + base_name = main_db->getStringWithDefault("base_name", base_name); + + /* + * Start logging. + */ + const string log_file_name = base_name + ".log"; + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", + log_all_nodes); + if (log_all_nodes) { + tbox::PIO::logAllNodes(log_file_name); + } else { + tbox::PIO::logOnlyNodeZero(log_file_name); + } + + /* + * Create major algorithm and data objects which comprise application. + * Each object will be initialized either from input data or restart + * files, or a combination of both. Refer to each class constructor + * for details. For more information on the composition of objects + * for this application, see comments at top of file. + */ + + boost::shared_ptr grid_geometry( + new geom::CartesianGridGeometry( + dim, + base_name + "CartesianGridGeometry", + input_db->getDatabase("CartesianGridGeometry"))); + tbox::plog << "Cartesian Geometry:" << endl; + grid_geometry->printClassData(tbox::plog); + + boost::shared_ptr patch_hierarchy( + new hier::PatchHierarchy( + base_name + "::PatchHierarchy", + grid_geometry, + input_db->getDatabase("PatchHierarchy"))); + + std::string fac_poisson_name = base_name + "::FACPoisson"; + std::string fac_solver_name = fac_poisson_name + "::poisson_hypre"; + std::string fac_ops_name = fac_solver_name + "::fac_ops"; + std::string fac_precond_name = fac_solver_name + "::fac_precond"; + std::string hypre_poisson_name = fac_ops_name + "::hypre_solver"; + std::string bc_coefs_name = fac_poisson_name + "::bc_coefs"; + +#ifdef HAVE_HYPRE + boost::shared_ptr hypre_poisson( + new solv::CellPoissonHypreSolver( + dim, + hypre_poisson_name, + input_db->isDatabase("hypre_solver") ? + input_db->getDatabase("hypre_solver") : + boost::shared_ptr())); + + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + hypre_poisson, + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#else + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#endif + + boost::shared_ptr fac_precond( + new solv::FACPreconditioner( + fac_precond_name, + fac_ops, + input_db->isDatabase("fac_precond") ? + input_db->getDatabase("fac_precond") : + boost::shared_ptr())); + + boost::shared_ptr fac_solver( + new solv::CellPoissonFACSolver( + dim, + fac_solver_name, + fac_precond, + fac_ops, + input_db->isDatabase("fac_solver") ? + input_db->getDatabase("fac_solver") : + boost::shared_ptr())); + + boost::shared_ptr bc_coefs( + new solv::LocationIndexRobinBcCoefs( + dim, + bc_coefs_name, + input_db->isDatabase("bc_coefs") ? + input_db->getDatabase("bc_coefs") : + boost::shared_ptr())); + + /* + * The FACPoisson object is the main user object specific to the + * problem being solved. It provides the implementations for setting + * up the grid and plotting data. It also wraps up the solve + * process that includes making the initial guess, specifying the + * boundary conditions and call the solver. + */ + FACPoisson fac_poisson(fac_poisson_name, + dim, + fac_solver, + bc_coefs); + + /* + * Create the tag-and-initializer, box-generator and load-balancer + * object references required by the gridding_algorithm object. + */ + boost::shared_ptr tag_and_initializer( + new mesh::StandardTagAndInitialize( + "CellTaggingMethod", + &fac_poisson, + input_db->getDatabase("StandardTagAndInitialize"))); + boost::shared_ptr box_generator( + new mesh::BergerRigoutsos(dim)); + boost::shared_ptr load_balancer( + new mesh::TreeLoadBalancer( + dim, + "load balancer", + boost::shared_ptr())); + load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + /* + * Create the gridding algorithm used to generate the SAMR grid + * and create the grid. + */ + boost::shared_ptr gridding_algorithm( + new mesh::GriddingAlgorithm( + patch_hierarchy, + "Gridding Algorithm", + input_db->getDatabase("GriddingAlgorithm"), + tag_and_initializer, + box_generator, + load_balancer)); + tbox::plog << "Gridding algorithm:" << endl; + gridding_algorithm->printClassData(tbox::plog); + + /* + * Make the coarsest patch level where we will be solving. + */ + gridding_algorithm->makeCoarsestLevel(0.0); + bool done = false; + for (int lnum = 0; + patch_hierarchy->levelCanBeRefined(lnum) && !done; lnum++) { + tbox::plog << "Adding finner levels with lnum = " << lnum << endl; + gridding_algorithm->makeFinerLevel( + 0, + true, + 0, + 0.0); + tbox::plog << "Just added finer levels with lnum = " << lnum << endl; + done = !(patch_hierarchy->finerLevelExists(lnum)); + } + + /* + * Set up the plotter for the hierarchy just created. + * The FACPoisson object handles the data and has the + * function setupExternalPlotter to register its data + * with the plotter. + */ +#ifdef HAVE_HDF5 + string vis_filename = + main_db->getStringWithDefault("vis_filename", base_name); + boost::shared_ptr visit_writer( + boost::make_shared(dim, + "VisIt Writer", + vis_filename + ".visit")); + fac_poisson.setupPlotter(*visit_writer); +#endif + + /* + * After creating all objects and initializing their state, + * we print the input database and variable database contents + * to the log file. + */ + tbox::plog << "\nCheck input data and variables before simulation:" + << endl; + tbox::plog << "Input database..." << endl; + input_db->printClassData(tbox::plog); + + /* + * Solve. + */ + fac_poisson.solvePoisson(); + +#ifdef HAVE_HDF5 + /* + * Plot. + */ + visit_writer->writePlotData(patch_hierarchy, 0); +#endif + + /* + * Deallocate objects when done. + */ + + tbox::TimerManager::getManager()->print(tbox::plog); + } + + /* + * This print is for the SAMRAI testing framework. Passing here + * means application ran. A better test would actually test the + * results. + */ + tbox::pout << "\nPASSED: FAC" << endl; + + tbox::SAMRAIManager::shutdown(); + tbox::SAMRAIManager::finalize(); + tbox::SAMRAI_MPI::finalize(); + + return 0; +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.2d.input new file mode 100644 index 00000000..724b8c7b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.2d.input @@ -0,0 +1,163 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for FAC_nonadaptive unit test. + * + ************************************************************************/ + +Main { + // Dimension of the problem. + dim = 2 + + // Base name for output files. + base_name = "default2" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE + + // If supplied, the nmae of visualization files. Otherwise derived from + // base_name. + // vis_filename = "default2" +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 10 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "LINEAR_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_solver { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + boundary_0 = "value", "0" + boundary_1 = "value", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" +} + +// Refer to mesh::CartesianGridGeometry for input. +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0), (31,31)] + x_lo = 0, 0 + x_up = 1, 1 +} + +// Refer to mesh::StandardTagAndInitialize for input. +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0),(31,15)] + } + level_1 { + boxes = [(0,0),(63,15)] + } + level_2 { + boxes = [(0,0),(16,16)] + } + //etc. +} + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2 + level_2 = 2, 2 + } + largest_patch_size { + level_0 = 32, 32 + // all finer levels will use same values as level_0... + } +} + +// Refer to mesh::GriddingAlgorithm for input. +GriddingAlgorithm { + + // TODO this should be removed + sequentialize_patch_indices = TRUE +} + + +// Refer to tbox::TimerManager for input. +TimerManager{ + timer_list = "hier::*::*", "mesh::*::*" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = -1 + print_summed = TRUE + print_max = TRUE +} diff --git a/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.3d.input new file mode 100644 index 00000000..686c0573 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/FAC_staticrefinement/test_inputs/default.3d.input @@ -0,0 +1,144 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for FAC_nonadaptive unit test. + * + ************************************************************************/ + +// Refer to default.2d.input for full description of all input parameters +// specific to this problem. + +Main { + // Dimension of the problem. + dim = 3 + + // Base name for output files. + base_name = "default3" + + // Whether to log all nodes in a parallel run. + log_all_nodes = FALSE +} + +// Refer to solv::CellPoissonFACSolver for input. +fac_solver { + // This is the input for the cell-centered Poisson FAC solver + // class in the SAMRAI library. + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::FACPreconditioner for input. +fac_precond { + max_cycles = 10 // Max number of FAC cycles to use + residual_tol = 1e-8 // Residual tolerance to solve for + num_pre_sweeps = 1 // Number of presmoothing sweeps to use + num_post_sweeps = 3 // Number of postsmoothing sweeps to use +} + +// Refer to solv::CellPoissonFACOps for input. +fac_ops { + prolongation_method = "LINEAR_REFINE" // Type of refinement + // used in prolongation. + // Suggested values are + // "LINEAR_REFINE" + // "CONSTANT_REFINE" + enable_logging = TRUE // Bool flag to switch logging on/off +} + +// Refer to solv::CellPoissonHypreSolver for input. +hypre_poisson { + use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. +} + +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + boundary_0 = "value", "0" + boundary_1 = "value", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" + boundary_4 = "value", "0" + boundary_5 = "value", "0" +} + +CartesianGridGeometry { + // Specify lower/upper corners of the computational domain and a + // set of non-overlapping boxes defining domain interior. If union + // of boxes is not a parallelpiped, lower/upper corner data corresponds + // to min/max corner indices over all boxes given. + // x_lo -- (double array) lower corner of computational domain [REQD] + // x_up -- (double array) upper corner of computational domain [REQD] + // domain_boxes -- (box array) set of boxes that define interior of + // hysical domain. [REQD] + // periodic_dimension -- (int array) coordinate directions in which + // domain is periodic. Zero indicates not + // periodic, non-zero value indicates periodicity. + // [0] + domain_boxes = [(0,0,0), (15,15,15)] + x_lo = 0, 0, 0 + x_up = 1, 1, 1 +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + level_0 { + boxes = [(0,0,0),(7,7,7)] + } + level_1 { + boxes = [(0,0,0),(7,7,7)] + } +} + +PatchHierarchy { + // Information used to create patches in AMR hierarchy. + // max_levels -- (int) max number of mesh levels in hierarchy [REQD] + // + // For most of the following parameters, the number of precribed data + // values need not match the number of levels in the hierarchy + // (determined by max_levels). If more values are given than number + // of levels, extraneous values will be ignored. If less are give, then + // values that correspond to individual levels will apply to those + // levels. Missing values will be taken from those for the finest + // level specified. + // + // ratio_to_coarser { + // level_1 -- (int array) ratio between index spaces on + // level 1 to level 0 [REQD] + // level_2 -- (int array) ratio between index spaces on + // level 2 to level 1 [REQD] + // etc.... + // } + // largest_patch_size { + // level_0 -- (int array) largest patch allowed on level 0. + // [REQD] + // level_1 -- (int array) " " " " level 1 + // [level 0 entry] + // etc.... + // } + max_levels = 3 + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + largest_patch_size { + level_0 = 32, 32, 32 + // all finer levels will use same values as level_0... + } +} + +GriddingAlgorithm { + // TODO this should be removed + sequentialize_patch_indices = TRUE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.C b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.C deleted file mode 100644 index 93a28dd4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.C +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#include "DerivedVisOwnerData.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/SAMRAIManager.h" - -using namespace SAMRAI; - -DerivedVisOwnerData::DerivedVisOwnerData() -{ -} - -DerivedVisOwnerData::~DerivedVisOwnerData() -{ -} - -bool DerivedVisOwnerData::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const -{ - NULL_USE(patch); - NULL_USE(depth_id); - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << - "DerivedVisOwnerData::packDerivedPatchDataIntoDoubleBuffer"); - } - - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.h b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.h deleted file mode 100644 index 23d543bd..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/DerivedVisOwnerData.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#ifndef included_DerivedVisOwnerData -#define included_DerivedVisOwnerData - -#include - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/Patch.h" - -#include "SAMRAI/tbox/Database.h" - -#include - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisDerivedDataStrategy.h" - -using namespace SAMRAI; - -/*! - * @brief Write owner rank using VisDerivedDataStrategy. - */ -class DerivedVisOwnerData: - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - DerivedVisOwnerData(); - - ~DerivedVisOwnerData(); - - //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals - - virtual bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const; - - //@} - -private: -}; - -#endif // included_DerivedVisOwnerData diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.depend index 2a957692..b3a0b41a 100644 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -11,69 +11,14 @@ ## This file is automatically generated by depend.pl. -FILE_0=DerivedVisOwnerData.o +FILE_0=main-lbcorrectness.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.C \ - DerivedVisOwnerData.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=main-lbcorrectness.o -DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -87,16 +32,19 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelStatistics.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ConnectorStatistics.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -111,12 +59,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -125,9 +75,16 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GraphLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -140,13 +97,20 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BreadthFirstRankTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -160,9 +124,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -171,11 +136,13 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ - main-lbcorrectness.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(TESTLIBDIR)/DerivedVisOwnerData.h \ + $(TESTLIBDIR)/ShrunkenLevelGenerator.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h \ + $(TESTLIBDIR)/SphericalShellGenerator.h main-lbcorrectness.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ +DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -184,11 +151,11 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.in b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.in index aae1d165..4780a668 100644 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/Makefile.in @@ -3,69 +3,96 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Test program for performance of load balancers. ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/LoadBalanceCorrectness -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../.. - -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -NUM_TESTS = 8 +CPPFLAGS_EXTRA= -DTESTING=1 + +NUM_TESTS = 34 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = main-lbcorrectness.o DerivedVisOwnerData.o +CXX_OBJS = main-lbcorrectness.o -INPUTS1D = rod.1d.input -INPUTS2D = rect.2d.treelb.input rod.2d.treelb.input small_cube.2d.caplb.input small_cube.2d.treelb.input small_sphere.2d.caplb.input small_sphere.2d.treelb.input -INPUTS3D = plank.3d.treelb.input small_cube.3d.treelb.input +INPUTS2D = box.2d.tilecap.input box.2d.cascade.input box.2d.tilecascade.input lss.2d.cascade.input lss.2d.tilecascade.input box.2d.treelb.input box.2d.tilelb.input box.2d.graphlb.input box.2d.caplb.input lss.2d.caplb.input lss.2d.treelb.input lss.2d.tilelb.input lss.2d.graphlb.input front.2d.caplb.input front.2d.treelb.input front.2d.tilelb.input front.2d.graphlb.input +INPUTS3D = box.3d.cascade.input box.3d.tilecascade.input lss.3d.cascade.input lss.3d.tilecascade.input box.3d.treelb.input box.3d.tilelb.input box.3d.graphlb.input box.3d.caplb.input lss.3d.caplb.input lss.3d.treelb.input lss.3d.tilelb.input lss.3d.graphlb.input front.3d.caplb.input front.3d.treelb.input front.3d.tilelb.input front.3d.graphlb.input int_overflow.3d.cascade.input -main: $(CXX_OBJS) $(LIBSAMRAI) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ +main: $(CXX_OBJS) $(LIBSAMRAI) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ -check: - $(MAKE) check2d - $(MAKE) check3d +testlib: + cd $(TESTLIBDIR) && $(MAKE) library + +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -check1d: main - for f in $(INPUTS1D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done +check: + $(MAKE) check2d + $(MAKE) check3d check2d: main - for f in $(INPUTS2D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done + @for f in $(INPUTS2D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "test_inputs/$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main - for f in $(INPUTS3D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done + @for f in $(INPUTS3D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "test_inputs/$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f main +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/main-lbcorrectness.C b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/main-lbcorrectness.C index a3685f73..d846c001 100644 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/main-lbcorrectness.C +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/main-lbcorrectness.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for performance and quality of TreeLoadBalancer. * ************************************************************************/ @@ -12,30 +12,46 @@ #include #include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxLevel.h" +#include "SAMRAI/hier/BoxLevelStatistics.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/pdat/NodeData.h" #include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/ConnectorStatistics.h" #include "SAMRAI/hier/BoxLevelConnectorUtils.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/MappingConnectorAlgorithm.h" #include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/mesh/CascadePartitioner.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/GraphLoadBalancer.h" +#include "SAMRAI/mesh/TileClustering.h" #include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" +#include "SAMRAI/tbox/BreadthFirstRankTree.h" +#include "SAMRAI/tbox/CenteredRankTree.h" +#include "SAMRAI/tbox/HDFDatabase.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include "SAMRAI/tbox/TimerManager.h" #include -#include "DerivedVisOwnerData.h" +#include + +#include "test/testlib/DerivedVisOwnerData.h" +#include "test/testlib/SinusoidalFrontGenerator.h" +#include "test/testlib/SphericalShellGenerator.h" +#include "test/testlib/ShrunkenLevelGenerator.h" using namespace SAMRAI; using namespace tbox; @@ -48,48 +64,130 @@ using namespace tbox; */ void -generatePrebalanceByUserBoxes( - boost::shared_ptr database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balacne_to_anchor); - -void -generatePrebalanceByUserShells( - const boost::shared_ptr& database, +enforceNesting( + hier::BoxLevel& L1, + hier::Connector& L0_to_L1, + hier::Connector& L1_to_L0, const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor); + int coarser_ln); void sortNodes( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, bool sort_by_corners, bool sequentialize_global_indices); -/*! - * @brief Compare prebalance and postbalance BoxLevels - * to check for errors. - * - * Write errors to tbox::plog. - * - * @return number of errors found. - */ +void +refineHead( + hier::BoxLevel& head, + hier::Connector& ref_to_head, + hier::Connector& head_to_ref, + const hier::IntVector& refinement_ratio); + +void +outputPostcluster( + const hier::BoxLevel& cluster, + const hier::BoxLevel& ref, + const hier::IntVector& ref_to_cluster_width, + const std::string& border); + +void +outputPrebalance( + const hier::BoxLevel& pre, + const hier::BoxLevel& ref, + const hier::IntVector& pre_width, + const std::string& border); + +void +outputPostbalance( + const hier::BoxLevel& post, + const hier::BoxLevel& ref, + const hier::IntVector& post_width, + const std::string& border); + +boost::shared_ptr +createBoxGenerator( + const boost::shared_ptr& input_db, + const std::string& bg_type, + const tbox::Dimension& dim); + +boost::shared_ptr +createLoadBalancer( + const boost::shared_ptr& input_db, + const std::string& lb_type, + const std::string& rank_tree_type, + int ln, + const tbox::Dimension& dim); + int checkBalanceCorrectness( const hier::BoxLevel& prebalance, const hier::BoxLevel& postbalance); +boost::shared_ptr +getRankTree( + Database& input_db, + const std::string& rank_tree_type); + +/*! + * @brief Implementation to tell PatchHierarchy about the request + * for Connector widths used in enforcing nesting. + * + * This is not essential, but we chose to go through the hierarchy to + * determine how big a Connector width to compute during the level + * generation. This more closely resembles what real aplications do. + * This step is typically done in the mesh generator, and what we are + * writing here is essentially a mesh generator. + */ +class NestingLevelConnectorWidthRequestor: + public hier::PatchHierarchy::ConnectorWidthRequestorStrategy +{ +public: + virtual void + computeRequiredConnectorWidths( + std::vector& self_connector_widths, + std::vector& fine_connector_widths, + const hier::PatchHierarchy& patch_hierarchy) const + { + self_connector_widths.clear(); + self_connector_widths.reserve(patch_hierarchy.getMaxNumberOfLevels()); + const hier::IntVector& one = hier::IntVector::getOne((patch_hierarchy.getDim())); + for (int ln = 0; ln < patch_hierarchy.getMaxNumberOfLevels(); ++ln) { + self_connector_widths.push_back( + one * patch_hierarchy.getProperNestingBuffer(ln)); + } + // fine_connector_widths is same, but doesn't need last level's. + fine_connector_widths = self_connector_widths; + fine_connector_widths.pop_back(); + } +}; +NestingLevelConnectorWidthRequestor nesting_level_connector_width_requestor; + +static boost::shared_ptr comm_graph_writer; +size_t num_records_written = 0; + +/* + ******************************************************************************** + * + * Performance testing for load balancers. + * + * 1. Build "level 0" from the domain description (input parameter + * "domain_boxes"). L0 is for doing the test, not for checking load + * balancer performance. + * + * 2. Build "level 1" and write out performance data for balancing it. + * + * 3. Build "level 2" and write out performance data for balancing it. + * The prebalance boxes for L2 are generated by clustering tags on L1. + * All L1 cells are tagged except for a small margin by the L1 boundary + * (input parameter "tag_margin". This configuration tries to mimick + * real problems where the tags occupy a large portion of the tag + * level, leading to a greater number of owners for prebalance boxes. + * + ******************************************************************************** + */ + int main( int argc, char* argv[]) @@ -103,9 +201,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); - int fail_count = 0; - /* * Process command line arguments. For each run, the input * filename must be specified. Usage is: @@ -156,9 +251,12 @@ int main( * all name strings in this program. */ - boost::shared_ptr main_db(input_db->getDatabase("Main")); + boost::shared_ptr main_db = input_db->getDatabase("Main"); + + const tbox::Dimension + dim(static_cast(main_db->getInteger("dim"))); - const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + const hier::IntVector& zero_vec = hier::IntVector::getZero(dim); std::string base_name = "unnamed"; base_name = main_db->getStringWithDefault("base_name", base_name); @@ -187,97 +285,193 @@ int main( * Start logging. */ const std::string log_file_name = base_name + ".log"; - bool log_all_nodes = true; - // log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", log_all_nodes); + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", + log_all_nodes); if (log_all_nodes) { PIO::logAllNodes(log_file_name); } else { PIO::logOnlyNodeZero(log_file_name); } - plog << "Input database after initialization..." << std::endl; - input_db->printClassData(plog); +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif /* - * Parameters. Some of these should be specified by input deck. + * Whether to perform certain steps in mesh generation. */ - hier::IntVector ghost_cell_width(dim, 2); - if (main_db->isInteger("ghost_cell_width")) { - main_db->getIntegerArray("ghost_cell_width", &ghost_cell_width[0], dim.getValue()); - } - hier::IntVector min_size(dim, 8); - if (main_db->isInteger("min_size")) { - main_db->getIntegerArray("min_size", &min_size[0], dim.getValue()); + std::vector enforce_nesting(1, true); + if (main_db->isBool("enforce_nesting")) { + enforce_nesting = main_db->getBoolVector("enforce_nesting"); } - hier::IntVector max_size(dim, -1); - if (main_db->isInteger("max_size")) { - main_db->getIntegerArray("max_size", &max_size[0], dim.getValue()); + + std::vector load_balance(1, true); + if (main_db->isBool("load_balance")) { + load_balance = main_db->getBoolVector("load_balance"); } - hier::IntVector bad_interval(dim, 2); + + hier::IntVector bad_interval(dim, 1); hier::IntVector cut_factor(dim, 1); hier::OverlapConnectorAlgorithm oca; /* - * Set up hierarchy. + * Set up the domain from input. + */ + + std::vector db_box_vector = + main_db->getDatabaseBoxVector("domain_boxes"); + hier::BoxContainer input_boxes(db_box_vector); + input_boxes.begin(); + + hier::BoxContainer domain_boxes; + hier::LocalId local_id(0); + for (hier::BoxContainer::iterator itr = input_boxes.begin(); + itr != input_boxes.end(); ++itr) { + itr->setBlockId(hier::BlockId(0)); + domain_boxes.pushBack(hier::Box(*itr, local_id++, 0)); + } + + std::vector xlo(dim.getValue()); + std::vector xhi(dim.getValue()); + for (int i = 0; i < dim.getValue(); ++i) { + xlo[i] = 0.0; + xhi[i] = 1.0; + } + if (main_db->isDouble("xlo")) { + xlo = main_db->getDoubleVector("xlo"); + } + if (main_db->isDouble("xhi")) { + xhi = main_db->getDoubleVector("xhi"); + } + + /* + * Choose the tagging code. + */ + const std::string mesh_generator_name = + main_db->getStringWithDefault("mesh_generator_name", "SinusoidalFrontGenerator"); + boost::shared_ptr mesh_gen; + if (mesh_generator_name == "SinusoidalFrontGenerator") { + mesh_gen.reset( + new SinusoidalFrontGenerator( + "SinusoidalFrontGenerator", + dim, + main_db->getDatabaseWithDefault("SinusoidalFrontGenerator", + boost::shared_ptr()))); + } else if (mesh_generator_name == "SphericalShellGenerator") { + mesh_gen.reset( + new SphericalShellGenerator( + "SphericalShellGenerator", + dim, + main_db->getDatabaseWithDefault("SphericalShellGenerator", + boost::shared_ptr()))); + } else if (mesh_generator_name == "ShrunkenLevelGenerator") { + mesh_gen.reset( + new ShrunkenLevelGenerator( + "ShrunkenLevelGenerator", + dim, + main_db->getDatabaseWithDefault("ShrunkenLevelGenerator", + boost::shared_ptr()))); + } else { + TBOX_ERROR("Unrecognized MeshGeneratorStrategy " << mesh_generator_name); + } + + /* + * If autoscale_base_nprocs is given, take the domain_boxes, xlo and xhi + * to be the size for the (integer) value of autoscale_base_nprocs. Scale + * the problem from there to the number of process running by + * doubling the size starting with the j direction. * - * anchor_mapped_box_level is used for level 0. - * balance_mapped_box_level is used for level 1. + * The number of processes must be a power of 2 times the value + * of autoscale_base_nprocs. */ + const int autoscale_base_nprocs = + main_db->getIntegerWithDefault("autoscale_base_nprocs", mpi.getSize()); + + mesh_gen->setDomain(domain_boxes, &xlo[0], &xhi[0], autoscale_base_nprocs, mpi); + hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); + + /* + * Clustering algorithm. + */ + + std::string box_generator_type = + main_db->getStringWithDefault("box_generator_type", "BergerRigoutsos"); + + boost::shared_ptr box_generator = + createBoxGenerator(input_db, box_generator_type, dim); + + /* + * Create hierarchy. + */ + + tbox::plog << "Building domain with boxes:\n" << domain_boxes.format("\t") << std::endl; boost::shared_ptr grid_geometry( new geom::CartesianGridGeometry( - dim, "GridGeometry", - input_db->getDatabase("CartesianGridGeometry"))); + &xlo[0], + &xhi[0], + domain_boxes)); boost::shared_ptr hierarchy( new hier::PatchHierarchy( "Hierarchy", - grid_geometry)); + grid_geometry, + input_db->getDatabase("PatchHierarchy"))); + + hierarchy->registerConnectorWidthRequestor(nesting_level_connector_width_requestor); - hierarchy->setMaxNumberOfLevels(2); + mesh_gen->resetHierarchyConfiguration(hierarchy, 0, 1); - const hier::BoxLevel& domain_mapped_box_level(hierarchy->getDomainBoxLevel()); + enforce_nesting.resize(hierarchy->getMaxNumberOfLevels(), + bool(enforce_nesting.back())); + + load_balance.resize(hierarchy->getMaxNumberOfLevels(), + bool(load_balance.back())); + + const int max_levels = hierarchy->getMaxNumberOfLevels(); + + /* + * Set up the patch data for tags. + */ + + boost::shared_ptr > tag_variable( + new pdat::CellVariable(dim, "ShrinkingLevelTagVariable")); + + boost::shared_ptr default_context = + vdb->getContext("TagVariable"); + + const int tag_data_id = vdb->registerVariableAndContext( + tag_variable, + default_context, + hier::IntVector::getZero(dim)); + + const hier::BoxLevel& domain_box_level(hierarchy->getDomainBoxLevel()); /* * Set up the load balancers. */ - mesh::ChopAndPackLoadBalancer cut_and_pack_lb( - dim, - "ChopAndPackLoadBalancer", - input_db->getDatabaseWithDefault("ChopAndPackLoadBalancer", - boost::shared_ptr())); + std::string load_balancer_type = + main_db->getStringWithDefault("load_balancer_type", "TreeLoadBalancer"); - mesh::TreeLoadBalancer tree_lb( - dim, - "TreeLoadBalancer", - input_db->getDatabaseWithDefault("TreeLoadBalancer", - boost::shared_ptr())); - tree_lb.setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - - mesh::LoadBalanceStrategy* lb = NULL; - - std::string load_balancer_type; - if (main_db->isString("load_balancer_type")) { - load_balancer_type = main_db->getString("load_balancer_type"); - if (load_balancer_type == "TreeLoadBalancer") { - lb = &tree_lb; - } else if (load_balancer_type == "ChopAndPackLoadBalancer") { - lb = &cut_and_pack_lb; - } - } - if (lb == NULL) { - TBOX_ERROR( - "Missing or bad load_balancer specification in Main database.\n" - << "Specify load_balancer_type = STRING, where STRING can be\n" - << "\"ChopAndPackLoadBalancer\" or \"TreeLoadBalancer\"."); + std::string rank_tree_type = + main_db->getStringWithDefault("rank_tree_type", "CenteredRankTree"); + + const bool write_comm_graph = main_db->getBoolWithDefault("write_comm_graph", false); + if (write_comm_graph) { + comm_graph_writer.reset(new CommGraphWriter); } /* - * Baseline stuff: + * Baseline stuff for regression tests: * * Whether to generate a baseline or compare against it. * If generating a baseline, the tests are NOT checked! @@ -285,318 +479,659 @@ int main( const std::string baseline_dirname = main_db->getStringWithDefault("baseline_dirname", "test_inputs"); - const std::string baseline_filename = baseline_dirname + "/" + base_name + ".baselinedb." + std::string baseline_filename = baseline_dirname; + +#if defined(__xlC__) + baseline_filename = baseline_filename + "/xlC/" + base_name + ".baselinedb." + tbox::Utilities::processorToString(mpi.getRank()); - tbox::HDFDatabase basline_db(baseline_filename); +#else + baseline_filename = baseline_filename + "/" + base_name + ".baselinedb." + + tbox::Utilities::processorToString(mpi.getRank()); +#endif /* - * If generate_baseline is true, the run will write out baseline files - * but will not do a reqgression check. If it is false, do a regression - * check against the baseline file. + * If baseline_action states whether we want to generate the + * baseline, compare against it or do nothing. */ - const bool generate_baseline = - main_db->getBoolWithDefault("generate_baseline", false); + const std::string bl_act = + main_db->getStringWithDefault("baseline_action", ""); + char baseline_action = '\0'; + if (bl_act == "GENERATE") { + baseline_action = 'g'; + } else if (bl_act == "COMPARE") { + baseline_action = 'c'; + } else if (bl_act == "NONE") { + baseline_action = 'n'; + } else { + TBOX_ERROR( + "main: If given, baseline_action must be \"GENERATE\" or \"COMPARE\" or \"NONE\""); + } + +#ifdef HAVE_HDF5 boost::shared_ptr baseline_db( new tbox::HDFDatabase("LoadBalanceCorrectness baseline")); - boost::shared_ptr prebalance_mapped_box_level_db; - boost::shared_ptr postbalance_mapped_box_level_db; - - if (generate_baseline) { + if (baseline_action == 'g') { baseline_db->create(baseline_filename); - prebalance_mapped_box_level_db = baseline_db->putDatabase("prebalance MappedBoxLevel"); - postbalance_mapped_box_level_db = baseline_db->putDatabase("postbalance MappedBoxLevel"); - } else { + } else if (baseline_action == 'c') { baseline_db->open(baseline_filename); - prebalance_mapped_box_level_db = baseline_db->getDatabase("prebalance MappedBoxLevel"); - postbalance_mapped_box_level_db = baseline_db->getDatabase("postbalance MappedBoxLevel"); } +#else + TBOX_WARNING("HDF5 is not available.\n" + << "Skipping baseline comparison and generation.\n" + << "This means no regression checks!\n"); +#endif + + plog << "Input database after initialization..." << std::endl; + input_db->printClassData(plog); + bool do_test = true; +#ifndef HAVE_PTSCOTCH /* - * Set up data used by TreeLoadBalancer. + * Skip GraphLoadBalancer test if PT-Scotch is not available. */ - hier::BoxLevel - anchor_mapped_box_level(hier::IntVector(dim, 1), grid_geometry); - hier::BoxLevel balance_mapped_box_level(dim); - hier::Connector balance_to_anchor; - hier::Connector anchor_to_balance; - - { - hier::BoxContainer anchor_boxes(main_db->getDatabaseBoxArray("anchor_boxes")); + if (load_balancer_type == "GraphLoadBalancer") { + do_test = false; + } +#endif + /* + * Step 1: Build L0. + */ + tbox::pout << "\n==================== Generating L0 ====================" << std::endl; + + if (do_test) { + + hier::BoxLevel L0(hier::IntVector(dim, 1), grid_geometry); + + hier::BoxContainer L0_boxes( + grid_geometry->getPhysicalDomain()); const int boxes_per_proc = - (anchor_boxes.size() + anchor_mapped_box_level.getMPI().getSize() - - 1) / anchor_mapped_box_level.getMPI().getSize(); - const int my_boxes_start = anchor_mapped_box_level.getMPI().getRank() + (L0_boxes.size() + L0.getMPI().getSize() + - 1) / L0.getMPI().getSize(); + const int my_boxes_start = L0.getMPI().getRank() * boxes_per_proc; const int my_boxes_stop = tbox::MathUtilities::Min(my_boxes_start + boxes_per_proc, - anchor_boxes.size()); - hier::BoxContainer::iterator anchor_boxes_itr(anchor_boxes); + L0_boxes.size()); + hier::BoxContainer::iterator L0_boxes_itr = L0_boxes.begin(); for (int i = 0; i < my_boxes_start; ++i) { - ++anchor_boxes_itr; + if (L0_boxes_itr != L0_boxes.end()) { + ++L0_boxes_itr; + } } - for (int i = my_boxes_start; i < my_boxes_stop; ++i, ++anchor_boxes_itr) { - anchor_boxes_itr->setBlockId(hier::BlockId(0)); - anchor_mapped_box_level.addBox(*anchor_boxes_itr, hier::BlockId::zero()); + for (int i = my_boxes_start; i < my_boxes_stop; ++i, ++L0_boxes_itr) { + L0.addBox(*L0_boxes_itr, hier::BlockId::zero()); } - } - { /* - * Load balance the anchor BoxLevel, using the domain as its anchor. + * Load balance the L0 BoxLevel, using the domain as its L0. * * This is not a part of the performance test because does not * reflect the load balancer use in real apps. We just neeed a - * distributed anchor for the real load balancing performance test. + * distributed L0 for the real load balancing performance test. */ - hier::Connector anchor_to_domain( - anchor_mapped_box_level, - domain_mapped_box_level, - hier::IntVector(dim, 2)); - hier::Connector domain_to_anchor( - domain_mapped_box_level, - anchor_mapped_box_level, - hier::IntVector(dim, 2)); - oca.findOverlaps(anchor_to_domain); - oca.findOverlaps(domain_to_anchor); - - tbox::plog << "\n\n\ninitial anchor loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)anchor_mapped_box_level.getLocalNumberOfCells(), - anchor_mapped_box_level.getMPI()); - - lb->loadBalanceBoxLevel( - anchor_mapped_box_level, - anchor_to_domain, - domain_to_anchor, - hierarchy, - 0, - hier::Connector(), - hier::Connector(), - min_size, - max_size, - domain_mapped_box_level, - bad_interval, - cut_factor); + boost::shared_ptr L0_to_domain(new hier::Connector( + L0, + domain_box_level, + hier::IntVector(dim, 2))); + boost::shared_ptr domain_to_L0(new hier::Connector( + domain_box_level, + L0, + hier::IntVector(dim, 2))); + oca.findOverlaps(*L0_to_domain); + oca.findOverlaps(*domain_to_L0); + domain_to_L0->setTranspose(L0_to_domain.get(), false); + + boost::shared_ptr lb0 = + createLoadBalancer(input_db, load_balancer_type, rank_tree_type, 0, dim); + + tbox::plog << "\n\tL0 prebalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L0.getLocalNumberOfCells())), + L0.getMPI()); + + outputPrebalance(L0, domain_box_level, hierarchy->getRequiredConnectorWidth(0, 0), "L0: "); - oca.assertOverlapCorrectness(anchor_to_domain, false, true, true); - oca.assertOverlapCorrectness(domain_to_anchor, false, true, true); +#ifdef HAVE_HDF5 + if (baseline_action == 'g') { + boost::shared_ptr prebalance_L0_db = + baseline_db->putDatabase("prebalance BoxLevel 0"); + L0.putToRestart(prebalance_L0_db); + } else if (baseline_action == 'c') { + boost::shared_ptr prebalance_L0_db = + baseline_db->getDatabase("prebalance BoxLevel 0"); + boost::shared_ptr baseline_prebalance_L0( + new hier::BoxLevel( + dim, + *prebalance_L0_db, + grid_geometry)); + baseline_prebalance_L0->cacheGlobalReducedData(); + + if (L0 != *baseline_prebalance_L0) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the prebalance L0 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L0.format("Generated prebalance L0: ", 2) + << std::endl + << baseline_prebalance_L0->format("Baseline prebalance: ", 2); + } + } +#endif + + if (load_balance[0]) { + const hier::BoxLevel L0before(L0); + tbox::pout << "\tPartitioning..." << std::endl; + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + lb0->loadBalanceBoxLevel( + L0, + L0_to_domain.get(), + hierarchy, + 0, + hierarchy->getSmallestPatchSize(0), + hierarchy->getLargestPatchSize(0), + domain_box_level, + bad_interval, + cut_factor); + error_count += checkBalanceCorrectness(L0before, L0); + } + +#ifdef HAVE_HDF5 + if (baseline_action == 'g') { + boost::shared_ptr postbalance_box_level_db = + baseline_db->putDatabase("postbalance BoxLevel 0"); + L0.putToRestart(postbalance_box_level_db); + } else if (baseline_action == 'c') { + boost::shared_ptr postbalance_L0_db = + baseline_db->getDatabase("postbalance BoxLevel 0"); + boost::shared_ptr baseline_postbalance_L0( + new hier::BoxLevel( + dim, + *postbalance_L0_db, + grid_geometry)); + baseline_postbalance_L0->cacheGlobalReducedData(); + + if (L0 != *baseline_postbalance_L0) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the postbalance L0 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L0.format("Generated postbalance L0: ", 2) + << std::endl + << baseline_postbalance_L0->format("Baseline postbalance: ", 2); + } + } +#endif - sortNodes(anchor_mapped_box_level, - domain_to_anchor, - anchor_to_domain, + sortNodes(L0, + *domain_to_L0, false, true); + L0.cacheGlobalReducedData(); - anchor_mapped_box_level.cacheGlobalReducedData(); + tbox::plog << "\n\tL0 postbalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L0.getLocalNumberOfCells())), + L0.getMPI()); - tbox::plog << "\n\n\nfinal anchor loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)anchor_mapped_box_level.getLocalNumberOfCells(), - anchor_mapped_box_level.getMPI()); - } + outputPostbalance(L0, domain_box_level, hierarchy->getRequiredConnectorWidth(0, 0), "L0: "); - { - std::string box_gen_method("PrebalanceByUserBoxes"); - box_gen_method = main_db->getStringWithDefault("box_gen_method", - box_gen_method); - if (box_gen_method == "PrebalanceByUserBoxes") { - generatePrebalanceByUserBoxes( - main_db->getDatabase("PrebalanceByUserBoxes"), - hierarchy, - min_size, - ghost_cell_width, - balance_mapped_box_level, - anchor_mapped_box_level, - anchor_to_balance, - balance_to_anchor); - } else if (box_gen_method == "PrebalanceByUserShells") { - generatePrebalanceByUserShells( - main_db->getDatabase("PrebalanceByUserShells"), - hierarchy, - min_size, - ghost_cell_width, - balance_mapped_box_level, - anchor_mapped_box_level, - anchor_to_balance, - balance_to_anchor); - } else { - TBOX_ERROR("Bad box_gen_method: '" << box_gen_method << "'"); + if (comm_graph_writer) { + tbox::plog << "\nCommunication Graph for balancing L0:\n"; + for ( ; + num_records_written < comm_graph_writer->getNumberOfRecords(); + ++num_records_written) { + comm_graph_writer->writeGraphToTextStream(num_records_written, tbox::plog); + } + tbox::plog << "\n"; } + + L0.cacheGlobalReducedData(); + + hierarchy->makeNewPatchLevel(0, L0); } - /* - * Save the prebalance BoxLevel for error checking later. - */ - const hier::BoxLevel prebalance_mapped_box_level(balance_mapped_box_level); + hier::Connector* L1_to_L0; + boost::shared_ptr L0_to_L1; + boost::shared_ptr L1_to_L1; + + if (do_test && max_levels > 1) { + + const hier::BoxLevel& L0 = *hierarchy->getPatchLevel(0)->getBoxLevel(); - { /* - * Output "before" data. + * Step 2: Build L1. */ - balance_mapped_box_level.cacheGlobalReducedData(); - tbox::plog << "\n\n\nBefore:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)balance_mapped_box_level.getLocalNumberOfCells(), - balance_mapped_box_level.getMPI()); + tbox::pout << "\n\n==================== Generating L1 ====================" << std::endl; - tbox::plog << "Anchor mapped_box_level:\n" - << anchor_mapped_box_level.format("AL-> ", 2); + boost::shared_ptr L1; - tbox::plog << "Balance mapped_box_level:\n" - << balance_mapped_box_level.format("BL-> ", 2); + const int coarser_ln = 0; + const int finer_ln = coarser_ln + 1; - tbox::plog << "balance_to_anchor:\n" - << balance_to_anchor.format("BA-> "); + // Get the prebalanced L1: + const hier::IntVector required_connector_width = + hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); + const hier::IntVector min_size = hier::IntVector::ceilingDivide( + hierarchy->getSmallestPatchSize(finer_ln), + hierarchy->getRatioToCoarserLevel(finer_ln)); - tbox::plog << "anchor_to_balance:\n" - << anchor_to_balance.format("AB-> "); - } - - if (generate_baseline) { - balance_mapped_box_level.putUnregisteredToDatabase( - prebalance_mapped_box_level_db); - } + /* + * Tag cells. + */ + tbox::pout << "\tTagging..." << std::endl; + bool exact_tagging = false; + hierarchy->getPatchLevel(coarser_ln)->allocatePatchData(tag_data_id); + mesh_gen->setTags(exact_tagging, hierarchy, coarser_ln, tag_data_id); - { /* - * Load balance the unbalanced mapped_box_level. + * Cluster. */ - lb->loadBalanceBoxLevel( - balance_mapped_box_level, - balance_to_anchor, - anchor_to_balance, - hierarchy, - 1, - hier::Connector(), - hier::Connector(), + tbox::pout << "\tClustering..." << std::endl; + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + box_generator->findBoxesContainingTags( + L1, + L0_to_L1, + hierarchy->getPatchLevel(coarser_ln), + tag_data_id, + 1 /* tag_val */, + hier::BoxContainer(L0.getGlobalBoundingBox(hier::BlockId(0))), min_size, - max_size, - domain_mapped_box_level, - bad_interval, - cut_factor); + required_connector_width); + L0_to_L1->assertOverlapCorrectness(); + L1_to_L0 = &L0_to_L1->getTranspose(); + L1_to_L0->assertOverlapCorrectness(); - oca.assertOverlapCorrectness(balance_to_anchor); - oca.assertOverlapCorrectness(anchor_to_balance); + outputPostcluster(*L1, L0, required_connector_width, "L1: "); - sortNodes(balance_mapped_box_level, - anchor_to_balance, - balance_to_anchor, - false, - true); - } + if (L1->getGlobalNumberOfBoxes() == 0) { + TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); + } - { /* - * Output "after" data. + * Enforce nesting. */ - balance_mapped_box_level.cacheGlobalReducedData(); - tbox::plog << "\n\n\nAfter:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)balance_mapped_box_level.getLocalNumberOfCells(), - balance_mapped_box_level.getMPI()); + if (enforce_nesting[1]) { + enforceNesting( + *L1, + *L0_to_L1, + *L1_to_L0, + hierarchy, + coarser_ln); + } - tbox::plog << "Balance mapped_box_level:\n" - << balance_mapped_box_level.format("BL-> ", 2); + if (hierarchy->getRatioToCoarserLevel(1) != zero_vec) { + refineHead( + *L1, + *L0_to_L1, + *L1_to_L0, + hierarchy->getRatioToCoarserLevel(1)); + } - tbox::plog << "balance_to_anchor:\n" - << balance_to_anchor.format("BA-> "); + boost::shared_ptr lb1 = + createLoadBalancer(input_db, load_balancer_type, rank_tree_type, 1, dim); - tbox::plog << "anchor_to_balance:\n" - << anchor_to_balance.format("AB-> "); - } + tbox::plog << "\n\tL1 prebalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L1->getLocalNumberOfCells())), + L1->getMPI()); - if (generate_baseline) { - balance_mapped_box_level.putUnregisteredToDatabase( - postbalance_mapped_box_level_db); - } + outputPrebalance(*L1, L0, required_connector_width, "L1: "); #ifdef HAVE_HDF5 - hierarchy->makeNewPatchLevel(0, anchor_mapped_box_level); - hierarchy->makeNewPatchLevel(1, balance_mapped_box_level); + if (baseline_action == 'g') { + boost::shared_ptr prebalance_box_level_db = + baseline_db->putDatabase("prebalance BoxLevel 1"); + L1->putToRestart(prebalance_box_level_db); + } else if (baseline_action == 'c') { + boost::shared_ptr prebalance_L1_db = + baseline_db->getDatabase("prebalance BoxLevel 1"); + boost::shared_ptr baseline_prebalance_L1( + new hier::BoxLevel( + dim, + *prebalance_L1_db, + grid_geometry)); + baseline_prebalance_L1->cacheGlobalReducedData(); + + if (*L1 != *baseline_prebalance_L1) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the prebalance L1 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L1->format("Generated prebalance L1: ", 2) + << std::endl + << baseline_prebalance_L1->format("Baseline prebalance: ", 2); + } + } +#endif - if ((dim == tbox::Dimension(2)) || (dim == tbox::Dimension(3))) { + if (load_balance[1]) { + const hier::BoxLevel L1before(*L1); + tbox::pout << "\tPartitioning..." << std::endl; + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + lb1->loadBalanceBoxLevel( + *L1, + L1_to_L0, + hierarchy, + 1, + hierarchy->getSmallestPatchSize(1), + hierarchy->getLargestPatchSize(1), + domain_box_level, + bad_interval, + cut_factor); + error_count += checkBalanceCorrectness(L1before, *L1); + } + +#ifdef HAVE_HDF5 + if (baseline_action == 'g') { + boost::shared_ptr postbalance_box_level_db = + baseline_db->putDatabase("postbalance BoxLevel 1"); + L1->putToRestart(postbalance_box_level_db); + } else if (baseline_action == 'c') { + boost::shared_ptr postbalance_L1_db = + baseline_db->getDatabase("postbalance BoxLevel 1"); + boost::shared_ptr baseline_postbalance_L1( + new hier::BoxLevel( + dim, + *postbalance_L1_db, + grid_geometry)); + baseline_postbalance_L1->cacheGlobalReducedData(); + + if (*L1 != *baseline_postbalance_L1) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the postbalance L1 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L1->format("Generated postbalance L1: ", 2) + << std::endl + << baseline_postbalance_L1->format("Baseline postbalance: ", 2); + } + } +#endif + + sortNodes(*L1, + *L0_to_L1, + false, + true); + + tbox::plog << "\n\tL1 postbalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L1->getLocalNumberOfCells())), + L1->getMPI()); + + outputPostbalance(*L1, L0, required_connector_width, "L1: "); + + if (comm_graph_writer) { + tbox::plog << "\nCommunication Graph for balancing L1:\n"; + for ( ; + num_records_written < comm_graph_writer->getNumberOfRecords(); + ++num_records_written) { + comm_graph_writer->writeGraphToTextStream(num_records_written, tbox::plog); + } + tbox::plog << "\n"; + } + + // Get the L1_to_L1 for edge statistics. + oca.bridge( + L1_to_L1, + *L1_to_L0, + *L0_to_L1, + false); + + hierarchy->makeNewPatchLevel(1, *L1); + } + + hier::Connector* L2_to_L1; + boost::shared_ptr L1_to_L2; + boost::shared_ptr L2_to_L2; + + if (do_test && max_levels > 2) { /* - * Create the VisIt data writer. - * Write the plot file. + * Step 3: Build L2. */ - DerivedVisOwnerData owner_writer; - const std::string visit_filename = base_name + ".visit"; - appu::VisItDataWriter visit_data_writer(dim, - "VisIt Writer", - visit_filename); - visit_data_writer.registerDerivedPlotQuantity("Owner", - "SCALAR", - &owner_writer); - visit_data_writer.writePlotData(hierarchy, 0); - } -#endif + tbox::pout << "\n\n==================== Generating L2 ====================" << std::endl; - /* - * Check for errors. - */ - error_count += - checkBalanceCorrectness(prebalance_mapped_box_level, balance_mapped_box_level); + const hier::BoxLevel& L1 = *hierarchy->getPatchLevel(1)->getBoxLevel(); + + boost::shared_ptr L2; + + const int coarser_ln = 1; + const int finer_ln = coarser_ln + 1; - if (!generate_baseline) { + // Get the prebalanced L2: + const hier::IntVector required_connector_width = + hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); + const hier::IntVector min_size = hier::IntVector::ceilingDivide( + hierarchy->getSmallestPatchSize(finer_ln), + hierarchy->getRatioToCoarserLevel(finer_ln)); /* - * Compare the prebalance_mapped_box_level against its baseline. + * Tag cells. */ - hier::BoxLevel baseline_prebalance_mapped_box_level(dim); - baseline_prebalance_mapped_box_level.getFromDatabase( - *prebalance_mapped_box_level_db, - grid_geometry); - - if (prebalance_mapped_box_level != baseline_prebalance_mapped_box_level) { - tbox::perr << "LoadBalanceCorrectness test regression:\n" - << "the prebalance BoxLevel generated is different\n" - << "from the baseline in the database. The load balancing\n" - << "may be correct, but it failed against regression.\n" - << "Writing the BoxLevels in log files.\n"; - ++error_count; - tbox::plog << prebalance_mapped_box_level.format("Generated prebalance: ", 2) - << std::endl - << baseline_prebalance_mapped_box_level.format("Baseline prebalance: ", 2); + tbox::pout << "\tTagging..." << std::endl; + bool exact_tagging = false; + hierarchy->getPatchLevel(coarser_ln)->allocatePatchData(tag_data_id); + mesh_gen->setTags(exact_tagging, hierarchy, coarser_ln, tag_data_id); + + /* + * Cluster. + */ + tbox::pout << "\tClustering..." << std::endl; + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + box_generator->findBoxesContainingTags( + L2, + L1_to_L2, + hierarchy->getPatchLevel(coarser_ln), + tag_data_id, + 1 /* tag_val */, + hier::BoxContainer(L1.getGlobalBoundingBox(hier::BlockId(0))), + min_size, + required_connector_width); + + outputPostcluster(*L2, L1, required_connector_width, "L2: "); + + if (L2->getGlobalNumberOfBoxes() == 0) { + TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); } + L2_to_L1 = &L1_to_L2->getTranspose(); /* - * Compare the balance_mapped_box_level against its baseline. + * Enforce nesting. */ - hier::BoxLevel baseline_postbalance_mapped_box_level(dim); - baseline_postbalance_mapped_box_level.getFromDatabase( - *postbalance_mapped_box_level_db, - grid_geometry); - - if (balance_mapped_box_level != baseline_postbalance_mapped_box_level) { - tbox::perr << "LoadBalanceCorrectness test regression:\n" - << "the postbalance BoxLevel generated is different\n" - << "from the baseline in the database. The load balancing\n" - << "may be correct, but it failed against regression.\n" - << "Writing the BoxLevels in log files.\n"; - ++error_count; - tbox::plog << balance_mapped_box_level.format("Generated postbalance: ", 2) - << std::endl - << baseline_postbalance_mapped_box_level.format("Baseline postbalance: ", 2); + if (enforce_nesting[2]) { + enforceNesting( + *L2, + *L1_to_L2, + *L2_to_L1, + hierarchy, + coarser_ln); + } + + if (hierarchy->getRatioToCoarserLevel(2) != zero_vec) { + refineHead( + *L2, + *L1_to_L2, + *L2_to_L1, + hierarchy->getRatioToCoarserLevel(2)); + } + + boost::shared_ptr lb2 = + createLoadBalancer(input_db, load_balancer_type, rank_tree_type, 2, dim); + + tbox::plog << "\n\tL2 prebalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L2->getLocalNumberOfCells())), + L2->getMPI()); + + outputPrebalance(*L2, L1, required_connector_width, "L2: "); + +#ifdef HAVE_HDF5 + if (baseline_action == 'g') { + boost::shared_ptr prebalance_box_level_db = + baseline_db->putDatabase("prebalance BoxLevel 2"); + L2->putToRestart(prebalance_box_level_db); + } else if (baseline_action == 'c') { + boost::shared_ptr prebalance_L2_db = + baseline_db->getDatabase("prebalance BoxLevel 2"); + boost::shared_ptr baseline_prebalance_L2( + new hier::BoxLevel( + dim, + *prebalance_L2_db, + grid_geometry)); + baseline_prebalance_L2->cacheGlobalReducedData(); + + if (*L2 != *baseline_prebalance_L2) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the prebalance L2 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L2->format("Generated prebalance L2: ", 2) + << std::endl + << baseline_prebalance_L2->format("Baseline prebalance: ", 2); + } } +#endif + + if (load_balance[2]) { + const hier::BoxLevel L2before(*L2); + tbox::pout << "\tPartitioning..." << std::endl; + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + lb2->loadBalanceBoxLevel( + *L2, + L2_to_L1, + hierarchy, + 1, + hierarchy->getSmallestPatchSize(2), + hierarchy->getLargestPatchSize(2), + domain_box_level, + bad_interval, + cut_factor); + error_count += checkBalanceCorrectness(L2before, *L2); + } + +#ifdef HAVE_HDF5 + if (baseline_action == 'g') { + boost::shared_ptr postbalance_box_level_db = + baseline_db->putDatabase("postbalance BoxLevel 2"); + L2->putToRestart(postbalance_box_level_db); + } else if (baseline_action == 'c') { + boost::shared_ptr postbalance_L2_db = + baseline_db->getDatabase("postbalance BoxLevel 2"); + boost::shared_ptr baseline_postbalance_L2( + new hier::BoxLevel( + dim, + *postbalance_L2_db, + grid_geometry)); + baseline_postbalance_L2->cacheGlobalReducedData(); + + if (*L2 != *baseline_postbalance_L2) { + tbox::perr << "FAILED: LoadBalanceCorrectness test regression:\n" + << "the postbalance L2 BoxLevel generated is different\n" + << "from the baseline in the database. The load balancing\n" + << "may be correct, but it failed against regression.\n" + << "Writing the BoxLevels in log files.\n"; + ++error_count; + tbox::plog << L2->format("Generated postbalance L2: ", 2) + << std::endl + << baseline_postbalance_L2->format("Baseline postbalance: ", 2); + } + } +#endif + + sortNodes(*L2, + *L1_to_L2, + false, + true); + + tbox::plog << "\n\tL2 postbalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L2->getLocalNumberOfCells())), + L2->getMPI()); + + outputPostbalance(*L2, L1, required_connector_width, "L2: "); + + if (comm_graph_writer) { + tbox::plog << "\nCommunication Graph for balancing L2:\n"; + for ( ; + num_records_written < comm_graph_writer->getNumberOfRecords(); + ++num_records_written) { + comm_graph_writer->writeGraphToTextStream(num_records_written, tbox::plog); + } + tbox::plog << "\n\n"; + } + + // Get the L2_to_L2 for edge statistics. + oca.bridge( + L2_to_L2, + *L2_to_L1, + *L1_to_L2, + false); + + hierarchy->makeNewPatchLevel(2, *L2); + } + + tbox::plog << "\n==================== Final hierarchy ====================" << std::endl; + for (int ln = 0; ln < hierarchy->getNumberOfLevels(); ++ln) { + tbox::plog << '\n' + << "\tL" << ln << " summary:\n" + << hierarchy->getPatchLevel(ln)->getBoxLevel()->format("\t\t", 0) + << "\tL" << ln << " statistics:\n" + << hierarchy->getPatchLevel(ln)->getBoxLevel()->formatStatistics("\t\t"); + } + tbox::plog << "\n\n"; + + bool write_visit = + main_db->getBoolWithDefault("write_visit", false); + if (do_test && write_visit) { +#ifdef HAVE_HDF5 + + if ((dim == tbox::Dimension(2)) || (dim == tbox::Dimension(3))) { + /* + * Create the VisIt data writer. + * Write the plot file. + */ + DerivedVisOwnerData owner_writer; + const std::string visit_filename = base_name + ".visit"; + appu::VisItDataWriter visit_data_writer(dim, + "VisIt Writer", + visit_filename); + visit_data_writer.registerDerivedPlotQuantity("Owner", + "SCALAR", + &owner_writer); + visit_data_writer.writePlotData(hierarchy, 0); + } +#else + TBOX_WARNING("main: You set write_visit to TRUE,\n" + << "but VisIt dumps are not supported due to\n" + << "not having configured with HDF5.\n"); +#endif } } + /* + * Output timer results. + */ + tbox::TimerManager::getManager()->print(tbox::plog); + /* * Print input database again to fully show usage. */ plog << "Input database after running..." << std::endl; tbox::InputManager::getManager()->getInputDatabase()->printClassData(plog); - mpi.AllReduce(&error_count, 1, MPI_SUM); - - if (mpi.getRank() == 0) { - if (error_count == 0) { - tbox::pout << "\nPASSED: LoadBalanceCorrectness" << std::endl; - } else { - tbox::perr << "\nFAILED: LoadBalanceCorrectness" << std::endl; - } + if (error_count == 0) { + tbox::pout << "\nPASSED: LoadBalanceCorrectness" << std::endl; } /* @@ -609,225 +1144,459 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - std::cout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } + return error_count; +} + +/* + **************************************************************************** + * Output post-cluster metadata. + **************************************************************************** + */ +void outputPostcluster( + const hier::BoxLevel& cluster, + const hier::BoxLevel& ref, + const hier::IntVector& ref_to_cluster_width, + const std::string& border) +{ + cluster.cacheGlobalReducedData(); + + const hier::IntVector cluster_to_ref_width = + hier::Connector::convertHeadWidthToBase( + cluster.getRefinementRatio(), + ref.getRefinementRatio(), + ref_to_cluster_width); + + const hier::Connector& cluster_to_ref = cluster.findConnector(ref, + ref_to_cluster_width, + hier::CONNECTOR_CREATE, + true); + + cluster.cacheGlobalReducedData(); + cluster_to_ref.cacheGlobalReducedData(); + + tbox::plog << "\n\n" + << border << "Cluster summary:\n" + << cluster.format(border + "\t", 0) + << border << "Cluster stats:\n" + << cluster.formatStatistics(border + "\t"); + + tbox::plog << '\n' + << border << "cluster--->ref summary:\n" + << cluster_to_ref.format(border + "\t", 0) + << border << "cluster--->ref stats:\n" + << cluster_to_ref.formatStatistics(border + "\t"); +} - return fail_count; +/* + **************************************************************************** + * Output pre-balance metadata. + * - pre-balance level + * - pre--->pre for proximity contrast to post--->post + * - pre--->ref for proximity contrast to post--->pre + * - ref--->pre for proximity contrast to ref--->post + **************************************************************************** + */ +void outputPrebalance( + const hier::BoxLevel& pre, + const hier::BoxLevel& ref, + const hier::IntVector& pre_width, + const std::string& border) +{ + pre.cacheGlobalReducedData(); + + const hier::IntVector ref_width = + hier::Connector::convertHeadWidthToBase( + ref.getRefinementRatio(), + pre.getRefinementRatio(), + pre_width); + + const hier::Connector& pre_to_pre = pre.findConnector(pre, + pre_width, + hier::CONNECTOR_CREATE, + true); + + tbox::plog << "\n\n" + << border << "Prebalance summary:\n" + << pre.format(border + "\t", 0) + << border << "Prebalance stats:\n" + << pre.formatStatistics(border + "\t"); + + tbox::plog << '\n' + << border << "pre--->pre summary:\n" + << pre_to_pre.format(border + "\t", 0) + << border << "pre--->pre stats:\n" + << pre_to_pre.formatStatistics(border + "\t"); +} + +/* + **************************************************************************** + * Output post-balance metadata: + * - post-balance level + * - post--->post for proximity evaluation + * - post--->ref for proximity contrast to pre--->ref + * - ref--->post for proximity contrast to ref--->pre + **************************************************************************** + */ +void outputPostbalance( + const hier::BoxLevel& post, + const hier::BoxLevel& ref, + const hier::IntVector& post_width, + const std::string& border) +{ + post.cacheGlobalReducedData(); + + const hier::IntVector ref_width = + hier::Connector::convertHeadWidthToBase( + ref.getRefinementRatio(), + post.getRefinementRatio(), + post_width); + + const hier::Connector& post_to_post = post.findConnector(post, + post_width, + hier::CONNECTOR_CREATE, + true); + + const hier::Connector& post_to_ref = post.findConnector(ref, + post_width, + hier::CONNECTOR_CREATE, + true); + + const hier::Connector& ref_to_post = ref.findConnector(post, + ref_width, + hier::CONNECTOR_CREATE, + true); + + tbox::plog << "\n\n" + << border << "Postbalance summary:\n" + << post.format(border + "\t", 0) + << border << "Postbalance stats:\n" + << post.formatStatistics(border + "\t"); + + tbox::plog << '\n' + << border << "post--->post summary:\n" + << post_to_post.format(border + "\t", 0) + << border << "post--->post stats:\n" + << post_to_post.formatStatistics(border + "\t"); + + tbox::plog << '\n' + << border << "post--->ref summary:\n" + << post_to_ref.format(border + "\t", 0) + << border << "post--->ref stats:\n" + << post_to_ref.formatStatistics(border + "\t"); + + tbox::plog << '\n' + << border << "ref--->post summary:\n" + << ref_to_post.format(border + "\t", 0) + << border << "ref--->post stats:\n" + << ref_to_post.formatStatistics(border + "\t"); } /* *********************************************************************** *********************************************************************** */ -void generatePrebalanceByUserShells( - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor) +void sortNodes( + hier::BoxLevel& new_box_level, + hier::Connector& tag_to_new, + bool sort_by_corners, + bool sequentialize_global_indices) { + hier::BoxLevelConnectorUtils dlbg_edge_utils; + dlbg_edge_utils.setTimerPrefix("apps::sortNodes"); - const tbox::Dimension dim(hierarchy->getDim()); + boost::shared_ptr sorting_map; + boost::shared_ptr seq_box_level; - /* - * Starting at shell origin, tag cells with centroids - * at radii[0] radii; - double efficiency_tol = 0.75; - double combine_tol = 0.75; - - std::vector r0(dim.getValue()); - for (int d = 0; d < dim.getValue(); ++d) r0[d] = 0; - - boost::shared_ptr abr_db; - if (database) { - efficiency_tol = database->getDoubleWithDefault("efficiency_tol", - efficiency_tol); - combine_tol = database->getDoubleWithDefault("combine_tol", combine_tol); - if (database->isDouble("r0")) { - database->getDoubleArray("r0", &r0[0], dim.getValue()); + dlbg_edge_utils.makeSortingMap( + seq_box_level, + sorting_map, + new_box_level, + sort_by_corners, + sequentialize_global_indices); + + hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix("apps::sortNodes"); + + mca.modify(tag_to_new, + *sorting_map, + &new_box_level); +} + +/* + *********************************************************************** + *********************************************************************** + */ +void refineHead( + hier::BoxLevel& head, + hier::Connector& ref_to_head, + hier::Connector& head_to_ref, + const hier::IntVector& refinement_ratio) +{ + head.refineBoxes( + head, + refinement_ratio, + head.getRefinementRatio() * refinement_ratio); + head.finalize(); + + hier::IntVector head_to_ref_width = + refinement_ratio * head_to_ref.getConnectorWidth(); + head_to_ref.setBase(head); + head_to_ref.setWidth(head_to_ref_width, true); + + ref_to_head.setHead(head, true); + ref_to_head.refineLocalNeighbors(refinement_ratio); +} + +boost::shared_ptr +createLoadBalancer( + const boost::shared_ptr& input_db, + const std::string& lb_type, + const std::string& rank_tree_type, + int ln, + const tbox::Dimension& dim) +{ + + if (lb_type == "TreeLoadBalancer") { + + boost::shared_ptr rank_tree = getRankTree(*input_db, + rank_tree_type); + + const boost::shared_ptr db = + input_db->getDatabaseWithDefault("TreeLoadBalancer", + boost::shared_ptr()); + boost::shared_ptr + tree_lb(new mesh::TreeLoadBalancer( + dim, + std::string("mesh::TreeLoadBalancer") + tbox::Utilities::intToString(ln), + db, + rank_tree)); + tree_lb->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + tree_lb->setCommGraphWriter(comm_graph_writer); + if (db) { + tbox::plog << "TreeLoadBalancer created with this input database:\n"; + db->printClassData(plog); } - if (database->isDouble("radii")) { - radii = database->getDoubleArray("radii"); + return tree_lb; + + } else if (lb_type == "GraphLoadBalancer") { + + const boost::shared_ptr db = + input_db->getDatabaseWithDefault("GraphLoadBalancer", + boost::shared_ptr()); + boost::shared_ptr + graph_lb(new mesh::GraphLoadBalancer( + dim, + std::string("mesh::GraphLoadBalancer") + tbox::Utilities::intToString(ln), + db)); + if (db) { + tbox::plog << "GraphLoadBalancer created with this input database:\n"; + db->printClassData(plog); } - abr_db = database->getDatabaseWithDefault("BergerRigoutsos", abr_db); - TBOX_ASSERT(radii.size() % 2 == 0); - } + return graph_lb; - const int tag_val = 1; - - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr tag_level( - new hier::PatchLevel( - anchor_mapped_box_level, - grid_geometry, - vdb->getPatchDescriptor())); - - boost::shared_ptr > tag_variable( - new pdat::CellVariable(dim, "TagVariable")); - - boost::shared_ptr default_context( - vdb->getContext("TagVariable")); - - const int tag_id = vdb->registerVariableAndContext( - tag_variable, - default_context, - hier::IntVector::getZero(dim)); - - tag_level->allocatePatchData(tag_id); - - const double* xlo = grid_geometry->getXLower(); - const double* h = grid_geometry->getDx(); - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - const boost::shared_ptr& patch = *pi; - boost::shared_ptr > tag_data( - patch->getPatchData(tag_id), - boost::detail::dynamic_cast_tag()); - - tag_data->getArrayData().undefineData(); - - pdat::CellData::iterator ciend(tag_data->getGhostBox(), false); - for (pdat::CellData::iterator ci(tag_data->getGhostBox(), true); - ci != ciend; ++ci) { - const pdat::CellIndex& idx = *ci; - double rr = 0; - std::vector r(dim.getValue()); - for (int d = 0; d < dim.getValue(); ++d) { - r[d] = xlo[d] + h[d] * (idx(d) + 0.5) - r0[d]; - rr += r[d] * r[d]; - } - rr = sqrt(rr); - for (int i = 0; i < radii.size(); i += 2) { - if (radii[i] < rr && rr < radii[i + 1]) { - (*tag_data)(idx) = tag_val; - break; - } - } + } else if (lb_type == "ChopAndPackLoadBalancer") { + + const boost::shared_ptr db = + input_db->getDatabaseWithDefault("ChopAndPackLoadBalancer", + boost::shared_ptr()); + boost::shared_ptr + cap_lb(new mesh::ChopAndPackLoadBalancer( + dim, + std::string("mesh::ChopAndPackLoadBalancer") + tbox::Utilities::intToString(ln), + db)); + if (db) { + tbox::plog << "ChopAndPackLoadBalancer created with this input database:\n"; + db->printClassData(plog); + } + return cap_lb; + + } else if (lb_type == "CascadePartitioner") { + + const boost::shared_ptr db = + input_db->getDatabaseWithDefault("CascadePartitioner", + boost::shared_ptr()); + boost::shared_ptr + cp_lb(new mesh::CascadePartitioner( + dim, + std::string("mesh::CascadePartitioner") + tbox::Utilities::intToString(ln), + db)); + if (db) { + tbox::plog << "CascadePartitioner created with this input database:\n"; + db->printClassData(plog); } + return cp_lb; + + } else { + TBOX_ERROR( + "Missing or bad load_balancer specification in Main database.\n" + << "Specify load_balancer_type = STRING, where STRING can be\n" + << "\"ChopAndPackLoadBalancer\" or \"TreeLoadBalancer\"."); } - mesh::BergerRigoutsos abr(dim, abr_db); - abr.setMPI(anchor_mapped_box_level.getMPI()); - abr.findBoxesContainingTags( - balance_mapped_box_level, - anchor_to_balance, - balance_to_anchor, - tag_level, - tag_id, - tag_val, - anchor_mapped_box_level.getGlobalBoundingBox(0), - min_size, - efficiency_tol, - combine_tol, - connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); + return boost::shared_ptr(); +} - /* - * The clustering step generated Connectors to/from the temporary - * tag_level->getBoxLevel(), which is not the same as the - * anchor BoxLevel. We need to reset the Connectors to use - * the anchor_mapped_box_level instead. - */ - anchor_to_balance.setBase(anchor_mapped_box_level); - anchor_to_balance.setHead(balance_mapped_box_level, true); - balance_to_anchor.setBase(balance_mapped_box_level); - balance_to_anchor.setHead(anchor_mapped_box_level, true); +boost::shared_ptr +createBoxGenerator( + const boost::shared_ptr& input_db, + const std::string& bg_type, + const tbox::Dimension& dim) +{ + + if (bg_type == "BergerRigoutsos") { + + boost::shared_ptr + berger_rigoutsos( + new mesh::BergerRigoutsos( + dim, + input_db->getDatabaseWithDefault("BergerRigoutsos", boost::shared_ptr()))); + berger_rigoutsos->useDuplicateMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + return berger_rigoutsos; + + } else if (bg_type == "TileClustering") { + + boost::shared_ptr + tiled( + new mesh::TileClustering( + dim, + input_db->getDatabaseWithDefault("TileClustering", boost::shared_ptr()))); + + return tiled; + + } else { + TBOX_ERROR( + "Missing or box generator specification in Main database.\n" + << "Specify load_balancer_type = STRING, where STRING can be\n" + << "\"BergerRigoutsos\" or \"TileClustering\"."); + } + + return boost::shared_ptr(); } /* - *********************************************************************** - *********************************************************************** + **************************************************************************** + * Get the RankTreeStrategy implementation for TreeLoadBalancer + **************************************************************************** */ -void generatePrebalanceByUserBoxes( - boost::shared_ptr database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor) +boost::shared_ptr getRankTree( + Database& input_db, + const std::string& rank_tree_type) { - NULL_USE(hierarchy); - NULL_USE(min_size); - - const tbox::Dimension& dim(hierarchy->getDim()); - - hier::BoxContainer balance_boxes(database->getDatabaseBoxArray("balance_boxes")); - tbox::Array initial_owners(1); - initial_owners[0] = 0; - initial_owners = database->getIntegerArray("initial_owners"); - - balance_mapped_box_level.initialize(hier::IntVector(dim, 1), - hierarchy->getGridGeometry(), - anchor_mapped_box_level.getMPI()); - hier::BoxContainer::iterator balance_boxes_itr(balance_boxes); - for (int i = 0; i < balance_boxes.size(); ++i, ++balance_boxes_itr) { - const int owner = i % initial_owners.size(); - if (owner == balance_mapped_box_level.getMPI().getRank()) { - balance_boxes_itr->setBlockId(hier::BlockId(0)); - balance_mapped_box_level.addBox(hier::Box(*balance_boxes_itr, - hier::LocalId(i), owner)); + tbox::plog << "Rank tree type is " << rank_tree_type << '\n'; + + boost::shared_ptr rank_tree; + + if (rank_tree_type == "BalancedDepthFirstTree") { + + BalancedDepthFirstTree * bdfs(new BalancedDepthFirstTree()); + + if (input_db.isDatabase("BalancedDepthFirstTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("BalancedDepthFirstTree"); + bool do_left_leaf_switch = tmp_db->getBoolWithDefault("do_left_leaf_switch", true); + bdfs->setLeftLeafSwitching(do_left_leaf_switch); + } + + rank_tree.reset(bdfs); + + } else if (rank_tree_type == "CenteredRankTree") { + + CenteredRankTree * crt(new tbox::CenteredRankTree()); + + if (input_db.isDatabase("CenteredRankTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("CenteredRankTree"); + bool make_first_rank_the_root = tmp_db->getBoolWithDefault("make_first_rank_the_root", + true); + crt->makeFirstRankTheRoot(make_first_rank_the_root); } + + rank_tree.reset(crt); + + } else if (rank_tree_type == "BreadthFirstRankTree") { + + BreadthFirstRankTree * dft(new tbox::BreadthFirstRankTree()); + + if (input_db.isDatabase("BreadthFirstRankTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("BreadthFirstRankTree"); + const int tree_degree = tmp_db->getIntegerWithDefault("tree_degree", true); + dft->setTreeDegree(static_cast(tree_degree)); + } + + rank_tree.reset(dft); + + } else { + TBOX_ERROR("Unrecognized RankTreeStrategy " << rank_tree_type); } - // Generate the balance<===>anchor Connectors. - balance_to_anchor.setBase(balance_mapped_box_level); - balance_to_anchor.setHead(anchor_mapped_box_level); - balance_to_anchor.setWidth(connector_width, true); - anchor_to_balance.setBase(anchor_mapped_box_level); - anchor_to_balance.setHead(balance_mapped_box_level); - anchor_to_balance.setWidth(connector_width, true); - hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(balance_to_anchor); - oca.findOverlaps(anchor_to_balance); + return rank_tree; } /* - *********************************************************************** - *********************************************************************** + ************************************************************************ + ************************************************************************ */ -void sortNodes( - hier::BoxLevel& new_mapped_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - bool sort_by_corners, - bool sequentialize_global_indices) +void enforceNesting( + hier::BoxLevel& L1, + hier::Connector& L0_to_L1, + hier::Connector& L1_to_L0, + const boost::shared_ptr& hierarchy, + int coarser_ln) { - const hier::MappingConnectorAlgorithm mca; + tbox::pout << "\tEnforcing nesting..." << std::endl; - hier::Connector sorting_map; - hier::BoxLevel seq_mapped_box_level(new_mapped_box_level.getDim()); - hier::BoxLevelConnectorUtils dlbg_edge_utils; - dlbg_edge_utils.makeSortingMap( - seq_mapped_box_level, - sorting_map, - new_mapped_box_level, - sort_by_corners, - sequentialize_global_indices); + const tbox::Dimension dim(hierarchy->getDim()); - mca.modify(tag_to_new, - new_to_tag, - sorting_map, - &new_mapped_box_level); + const hier::BoxLevel& L0 = L1_to_L0.getHead(); + + const size_t cell_count = L1.getGlobalNumberOfCells(); + + /* + * Make L1 nest inside L0 by nesting_width. + */ + const hier::IntVector nesting_width(dim, hierarchy->getProperNestingBuffer(coarser_ln)); + const hier::IntVector nesting_width_transpose = hier::Connector::convertHeadWidthToBase( + L0.getRefinementRatio(), + L1.getRefinementRatio(), + nesting_width); + boost::shared_ptr L1nested; + boost::shared_ptr L1_to_L1nested; + hier::BoxLevelConnectorUtils blcu; + blcu.computeInternalParts(L1nested, + L1_to_L1nested, + L1.findConnectorWithTranspose(L0, + nesting_width, + nesting_width_transpose, + hier::CONNECTOR_CREATE, + true), + -nesting_width, + hierarchy->getGridGeometry()->getDomainSearchTree()); + hier::MappingConnectorAlgorithm mca; + mca.modify(L0_to_L1, + *L1_to_L1nested, + &L1, + L1nested.get()); + + /* + * Remove overflow nesting. + */ + blcu.computeInternalParts(L1nested, + L1_to_L1nested, + L1_to_L0, + hier::IntVector::getZero(dim), + hierarchy->getGridGeometry()->getDomainSearchTree()); + mca.modify(L0_to_L1, + *L1_to_L1nested, + &L1, + L1nested.get()); + + if (cell_count != L1.getGlobalNumberOfCells()) { + tbox::plog << "Warning: enforceNesting changed number of cells from " << cell_count + << " to " << L1.getGlobalNumberOfCells() << '\n'; + } else { + tbox::plog << "enforceNesting left number of cells at " << cell_count << '\n'; + } } /* @@ -853,35 +1622,35 @@ int checkBalanceCorrectness( const hier::BaseGridGeometry& grid_geometry(*postbalance.getGridGeometry()); - const hier::BoxContainer& globalized_prebalance_mapped_box_set = + const hier::BoxContainer& globalized_prebalance_boxes = globalized_prebalance.getGlobalBoxes(); - const hier::BoxContainer globalized_prebalance_mapped_box_tree( - globalized_prebalance_mapped_box_set); - globalized_prebalance_mapped_box_tree.makeTree(&grid_geometry); + const hier::BoxContainer globalized_prebalance_box_tree( + globalized_prebalance_boxes); + globalized_prebalance_box_tree.makeTree(&grid_geometry); const hier::BoxLevel& globalized_postbalance = postbalance.getGlobalizedVersion(); - const hier::BoxContainer& globalized_postbalance_mapped_box_set = + const hier::BoxContainer& globalized_postbalance_boxes = globalized_postbalance.getGlobalBoxes(); - const hier::BoxContainer globalized_postbalance_mapped_box_tree( - globalized_postbalance_mapped_box_set); - globalized_postbalance_mapped_box_tree.makeTree(&grid_geometry); - + const hier::BoxContainer globalized_postbalance_box_tree( + globalized_postbalance_boxes); + globalized_postbalance_box_tree.makeTree(&grid_geometry); // Check for prebalance indices absent in postbalance. - for (hier::BoxContainer::const_iterator bi = globalized_prebalance_mapped_box_set.begin(); - bi != globalized_prebalance_mapped_box_set.end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = + globalized_prebalance_boxes.begin(); + bi != globalized_prebalance_boxes.end(); ++bi) { hier::BoxContainer box_container(*bi); box_container.removeIntersections( prebalance.getRefinementRatio(), - globalized_postbalance_mapped_box_tree); - if (!box_container.isEmpty()) { + globalized_postbalance_box_tree); + if (!box_container.empty()) { tbox::plog << "Prebalance Box " << *bi << " has " << box_container.size() << " parts absent in postbalance:\n"; - for (hier::BoxContainer::iterator bj(box_container); + for (hier::BoxContainer::iterator bj = box_container.begin(); bj != box_container.end(); ++bj) { tbox::plog << " " << *bj << std::endl; } @@ -890,16 +1659,17 @@ int checkBalanceCorrectness( } // Check for postbalance indices absent in prebalance. - for (hier::BoxContainer::const_iterator bi = globalized_postbalance_mapped_box_set.begin(); - bi != globalized_postbalance_mapped_box_set.end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = + globalized_postbalance_boxes.begin(); + bi != globalized_postbalance_boxes.end(); ++bi) { hier::BoxContainer box_container(*bi); box_container.removeIntersections( postbalance.getRefinementRatio(), - globalized_prebalance_mapped_box_tree); - if (!box_container.isEmpty()) { + globalized_prebalance_box_tree); + if (!box_container.empty()) { tbox::plog << "Postbalance Box " << *bi << " has " << box_container.size() << " parts absent in prebalance:\n"; - for (hier::BoxContainer::iterator bj(box_container); + for (hier::BoxContainer::iterator bj = box_container.begin(); bj != box_container.end(); ++bj) { tbox::plog << " " << *bj << std::endl; } @@ -907,5 +1677,11 @@ int checkBalanceCorrectness( } } + if (error_count > 0) { + tbox::plog << "Error - balance correctness failed regardless of baseline\n" + << std::endl; + ++error_count; + } + return error_count; } diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..c0eb7ef6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..2abd6e56 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..9b1afba3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82005b25 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..72bffd39 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..65c56b1e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..443568fc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb.input new file mode 100644 index 00000000..ca80d0d6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.caplb.input @@ -0,0 +1,118 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.caplb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..6f8b065f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..9ffd9bd3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..2054e0cf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..7405edaf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..09681c60 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..46ec6733 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..4ea8b0ab Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade.input new file mode 100644 index 00000000..50cdb5d3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.cascade.input @@ -0,0 +1,147 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.cascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb.input new file mode 100644 index 00000000..fcacee07 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.graphlb.input @@ -0,0 +1,112 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 10, 10 + target_box_size = 30, 30 + coalesce_boxes = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00001.baselinedb.0000000 new file mode 100644 index 00000000..1e859f2a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000000 new file mode 100644 index 00000000..55a05c94 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000001 new file mode 100644 index 00000000..3664e401 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000000 new file mode 100644 index 00000000..b9caaea5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000001 new file mode 100644 index 00000000..84aa4188 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000002 new file mode 100644 index 00000000..0b37a279 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000003 new file mode 100644 index 00000000..f64440b1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap.input new file mode 100644 index 00000000..348dea73 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecap.input @@ -0,0 +1,123 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.tilecap" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + // autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "ChopAndPackLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { + tile_size = 10, 10 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..6969c545 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..0a9b929b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..0e118c36 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..027258c3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..288e8ee3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..0839f0f3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..14531ea8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade.input new file mode 100644 index 00000000..fab9b02f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilecascade.input @@ -0,0 +1,132 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.tilecascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + tile_size = 10, 10 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..d7d34103 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..de3834c4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..8f830fd3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..e7a3985b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..c8dfb4df Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..7eee7d07 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..fbd1ffa6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb.input new file mode 100644 index 00000000..b8ef6dda --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.tilelb.input @@ -0,0 +1,120 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..97545b8c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..0ba16757 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..44d9823f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..da9bce4d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..3510a669 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..91ae7792 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..a566102c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb.input new file mode 100644 index 00000000..de78f1fe --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.2d.treelb.input @@ -0,0 +1,118 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box.2d.treelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 1, 1 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..744fbc07 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..23806c2f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..5826203d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..89634003 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..0ccbdec9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..7e736d85 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..c56d3ebe Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb.input new file mode 100644 index 00000000..e2fdeb65 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.caplb.input @@ -0,0 +1,131 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.caplb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 16, 16, 16 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..277c7d0f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..b58abd2a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..c34b6a07 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..ea9c543b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..246961ca Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..18fcd7f6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..49b18b01 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade.input new file mode 100644 index 00000000..8cd56754 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.cascade.input @@ -0,0 +1,149 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.cascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + DEV_reset_obligations = TRUE + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb.input new file mode 100644 index 00000000..f25a1a7f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.graphlb.input @@ -0,0 +1,130 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.0, 1.0, 1.0 + + enforce_nesting = TRUE, FALSE, FALSE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + ghost_cell_width = 4, 4, 4 + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 8, 8, 8 + target_box_size = 8, 8, 8 + coalesce_boxes = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + level_1 = -1, -1, -1 + level_2 = 72, 72, 72 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..bfbc8f62 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..e1a67604 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..accc48d4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..0a582fb0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..4e72774d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..baf0844d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..bd307277 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade.input new file mode 100644 index 00000000..8234c535 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilecascade.input @@ -0,0 +1,150 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.tilecascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + tile_size = 16, 16, 16 + DEV_reset_obligations = TRUE + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..18421494 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..1da864ce Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..7f07f2cd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..36202167 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..0557819b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..5f6f83c7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..33340af6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb.input new file mode 100644 index 00000000..50ee83a1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.tilelb.input @@ -0,0 +1,136 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.0, 1.0, 1.0 + + enforce_nesting = TRUE, FALSE, FALSE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + ghost_cell_width = 4, 4, 4 + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 8, 8, 8 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..9b47bd34 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..53e1a555 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..f1da3b7b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..0e25c75e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..a6cde971 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..87a041a9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..d49d9493 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb.input new file mode 100644 index 00000000..7a0e5f3e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/box.3d.treelb.input @@ -0,0 +1,130 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "box.3d.treelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..ed6bdfcc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..fc6fa2fb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..90b66e56 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..ee4ee4b7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..a482c53f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..c9f6c946 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..40e7c6cc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb.input new file mode 100644 index 00000000..6cf01de1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.caplb.input @@ -0,0 +1,122 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.caplb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_time = 0.0 + init_disp = 1.0, 0.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb.input new file mode 100644 index 00000000..3b370f32 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.graphlb.input @@ -0,0 +1,118 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 10, 10 + coalesce_boxes = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 10, 10 + target_box_size = 30,30 + coalesce_boxes = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + level_1 = -1,-1 + level_2 = 144,144 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..8a5697fe Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..ffa87205 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..4f5aa598 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..aa741885 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..90fbdc8f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..f137dd8d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..03c1f648 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb.input new file mode 100644 index 00000000..04837616 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.tilelb.input @@ -0,0 +1,124 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_time = 0.0 + init_disp = 1.0, 0.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 20, 20 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..decb7d84 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..9970ad3d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..5086bc5f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..cc1d3d5f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..54624f3b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..2a72c266 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..873d95f8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb.input new file mode 100644 index 00000000..e7f9e600 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.2d.treelb.input @@ -0,0 +1,122 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.treelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_time = 0.0 + init_disp = 1.0, 0.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 1, 1 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..7c416c73 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..297bdd9f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..342326d0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..10e6bc30 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..3eceed7f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..15c019ab Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..6cb86fbb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb.input new file mode 100644 index 00000000..04348440 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.caplb.input @@ -0,0 +1,138 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +Main { + dim = 3 + + base_name = "front.3d.caplb" + baseline_dirname = "test_inputs" + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + // Domain definition + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + // Whether to enforce nesting. + enforce_nesting = TRUE, TRUE, TRUE + + // Base nprocs for automatic scaling. + autoscale_base_nprocs = 1 + + // Box generator types: BergerRigoutsos, TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer, CascadePartitioner + load_balancer_type = "ChopAndPackLoadBalancer" + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE, TRUE + + /* + Specify ghost-cell-width between anchor and unbalanced. + */ + ghost_cell_width = 4, 4, 4 + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + /* + Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. + */ + init_time = 0.0 + init_disp = 1.0, 0.0, 0.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + // Buffer distances around the walls (one for each tag level). + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 6, 6, 6 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb.input new file mode 100644 index 00000000..7747c76f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.graphlb.input @@ -0,0 +1,129 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "front.3d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 6, 6, 6 + target_box_size = 6, 6, 6 + coalesce_boxes = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + level_1 = -1, -1, -1 + level_2 = 30, 30, 30 + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..438ef679 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..30b5422a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..b2a04b6e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..0063de4c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..b2bb032e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..29d15ce3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..f2ab2e45 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb.input new file mode 100644 index 00000000..74fd279c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.tilelb.input @@ -0,0 +1,137 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "front.3d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_time = 0.0 + init_disp = 1.0, 0.0, 0.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 6, 6, 6 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..e5f468cf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..babd1c4e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..bd7ddc5f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..55285f08 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..5929b37d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..d16f23db Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..073ce93e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb.input new file mode 100644 index 00000000..a896163f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/front.3d.treelb.input @@ -0,0 +1,136 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "front.3d.treelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_time = 0.0 + init_disp = 1.0, 0.0, 0.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 1, 1, 1 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..70db11c7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..6ec624e4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..af7f12a2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..caa826ac Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..da7d4a5c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..583e5efd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..5ba5ad15 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade.input new file mode 100644 index 00000000..b63cdb30 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/int_overflow.3d.cascade.input @@ -0,0 +1,149 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Single box with size > 2^31 + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "int_overflow.3d.cascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = FALSE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(2048,2048,2048)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + // autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.20, 0.20, 0.20 + shrink_distance_1 = 0.20, 0.20, 0.20 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + DEV_reset_obligations = TRUE + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 1 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..dadc58ee Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..29cb2be3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..1585f850 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..04f37059 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..c9434cf8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..577712cd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..054f62c6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb.input new file mode 100644 index 00000000..7510238e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.caplb.input @@ -0,0 +1,121 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.caplb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..e05acf21 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..6847bc17 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..2e27a0bb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..d0d03461 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..8b988049 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..1e158991 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..27be051a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade.input new file mode 100644 index 00000000..2ff2b097 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.cascade.input @@ -0,0 +1,139 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.cascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + rank_tree_type = "CenteredRankTree" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + DEV_limit_supply_to_surplus = FALSE + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb.input new file mode 100644 index 00000000..a0c1a4e4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.graphlb.input @@ -0,0 +1,118 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + coalesce_boxes = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 10, 10 + target_box_size = 30, 30 + coalesce_boxes = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + level_1 = 80,80 + level_2 = 170,170 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..6984dc34 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..60e3b20f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..0f75869f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..da0c3ac4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..82210f2f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..aa9bd66e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..40d9aa5b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade.input new file mode 100644 index 00000000..25977c91 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilecascade.input @@ -0,0 +1,135 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.tilecascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + rank_tree_type = "CenteredRankTree" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = TRUE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..d944f314 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..e4167789 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..3ad7610e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..0f1eea1e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..2bc499f6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..292b4dcf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..9c55c4d1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb.input new file mode 100644 index 00000000..6210ed26 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.tilelb.input @@ -0,0 +1,124 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + load_balance = TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = TRUE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 10, 10 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 10, 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..e6d8c859 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..dd6b794c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..2b8b41e3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..0ac57200 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..cbbb3aa9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..2754464e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..f1ad51e3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb.input new file mode 100644 index 00000000..55bbc2c8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.2d.treelb.input @@ -0,0 +1,158 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +Main { + // Dimension of problem. No default. + dim = 2 + + // Base name for output files. + base_name = "lss.2d.treelb" + + // Directory for baseline results. + baseline_dirname = "test_inputs" + + // Whether to generate new baseline or compare to old. + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + // Whether to write visit dump. + write_visit = TRUE + + // Whether to log all processes. + log_all_nodes = TRUE + + // Domain definition + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + // Whether to enforce nesting (one value for each level, but first value is ignored). + enforce_nesting = TRUE, TRUE, TRUE + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE + + // Scale the domain size by number of processes divided by this value. + autoscale_base_nprocs = 1 + + // Box generator types: BergerRigoutsos, TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer, CascadePartitioner + load_balancer_type = "TreeLoadBalancer" + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, or BreadthFirstTree. + rank_tree_type = "CenteredRankTree" + + // Mesh generator: SphericalShellGenerator, SinusoidalFrontGenerator, or ShrunkenLevelGenerator. + mesh_generator_name = "SphericalShellGenerator" + + // Refer to SphericalShellGenerator for input. + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 10, 10 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + tile_size = 1, 1 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::BalancedDepthFirstTree for input. +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::BreadthFirstRankTree for input. +BreadthFirstRankTree { + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..c8cf898f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..dbe5f1b2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..de6f857d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..54a7c199 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..4fe2db9b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..4e2d4186 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..ea3bd9f0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb.input new file mode 100644 index 00000000..f3bd4b35 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.caplb.input @@ -0,0 +1,132 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "lss.3d.caplb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 16, 16, 16 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..74d80f01 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..2968035a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..14a2316f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..73802a0a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..3ec594c1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..17d1ecd6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..172e002d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade.input new file mode 100644 index 00000000..6fe434e0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.cascade.input @@ -0,0 +1,147 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "lss.3d.cascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb.input new file mode 100644 index 00000000..2858515b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.graphlb.input @@ -0,0 +1,130 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "lss.3d.graphlb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = FALSE, FALSE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "GraphLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +GraphLoadBalancer { + tile_size = 16, 16, 16 + target_box_size = 16,16,16 + coalesce_boxes = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + level_1 = -1, -1, -1 + level_2 = 48, 48, 48 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 16, 16, 16 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..065aa0e6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..23576536 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..c62e6d7f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..9d4a9bcd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..2a43b008 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..985e95b7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..588395ca Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade.input new file mode 100644 index 00000000..c75ec4fe --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilecascade.input @@ -0,0 +1,151 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "lss.3d.tilecascade" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" or "NONE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + load_balance = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + tile_size = 16, 16, 16 + DEV_reset_obligations = TRUE + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..6d237f18 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..edc064c6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..4af384be Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..8bbd4275 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..73ea156f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..8bf90be8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..2f829878 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb.input new file mode 100644 index 00000000..e90f5168 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.tilelb.input @@ -0,0 +1,136 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + + dim = 3 + + base_name = "lss.3d.tilelb" + + baseline_dirname = "test_inputs" + + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = FALSE, FALSE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 8, 8, 8 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +TreeLoadBalancer { + tile_size = 16, 16, 16 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 16, 16, 16 +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..aff2bb62 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..cb95db80 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..9e21af7e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..5f956894 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..d8f3eede Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..6b5fdef3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..acdb04ad Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb.input new file mode 100644 index 00000000..8fadefeb --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/lss.3d.treelb.input @@ -0,0 +1,163 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Load balance correctness test input file. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells + +Main { + // Dimension of problem. No default. + dim = 3 + + // Base name for output files. + base_name = "lss.3d.treelb" + + // Directory for baseline results. + baseline_dirname = "test_inputs" + + // Whether to generate new baseline or compare to old. + baseline_action = "COMPARE" // "GENERATE" or "COMPARE" + + // Whether to write visit dump. + write_visit = TRUE + + // Whether to log all processes. + log_all_nodes = TRUE + + // Domain definition: box, lower and upper corners. + domain_boxes = [(0,0,0),(31,31,31)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + // Whether to enforce nesting (one value for each level, but first value is ignored). + enforce_nesting = TRUE, TRUE, TRUE + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE, TRUE + + // Scale the domain size by number of processes divided by this value. + autoscale_base_nprocs = 4 + + // Box generator types: BergerRigoutsos, TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer, TreeLoadBalancer + load_balancer_type = "TreeLoadBalancer" + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, or BreadthFirstTree. + rank_tree_type = "CenteredRankTree" + + // Mesh generator: SphericalShellGenerator, SinusoidalFrontGenerator, or ShrunkenLevelGenerator. + mesh_generator_name = "SphericalShellGenerator" + + // Refer to SphericalShellGenerator for input. + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 8, 8, 8 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + tile_size = 1, 1, 1 + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { + make_first_rank_the_root = FALSE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +BoxTransitSet { + DEV_print_break_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.3d.treelb.input deleted file mode 100644 index 345dd285..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.3d.treelb.input +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "plank.treelb.3d" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0,0),(49,99,299)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10,10),(39,89,289)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0,0),(49,99,299)] - x_lo = 0.0, 0.0, 0.0 - x_up = 1.0, 1.0, 1.0 - periodic_dimension = 0,1,0 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00001.baselinedb.0000000 deleted file mode 100644 index 58e64029..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000000 deleted file mode 100644 index d11fc273..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000001 deleted file mode 100644 index a6f6d9bc..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000000 deleted file mode 100644 index bb9eb903..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000001 deleted file mode 100644 index 5b1a561c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000002 deleted file mode 100644 index 55a6704e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000000 deleted file mode 100644 index fcb65b2b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000001 deleted file mode 100644 index 0ccc1534..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000002 deleted file mode 100644 index 5018fe40..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000003 deleted file mode 100644 index 6c045003..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000000 deleted file mode 100644 index 65391adf..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000001 deleted file mode 100644 index 2ab9f20a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000002 deleted file mode 100644 index 1c459cc0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000003 deleted file mode 100644 index e7865350..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000004 deleted file mode 100644 index 91278a2c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000000 deleted file mode 100644 index 21c40f0a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000001 deleted file mode 100644 index 5c885274..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000002 deleted file mode 100644 index d2bebdfb..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000003 deleted file mode 100644 index ee3b0e48..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000004 deleted file mode 100644 index 40c50d4d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000005 deleted file mode 100644 index a2b02af3..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000000 deleted file mode 100644 index b5b7e7ea..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000001 deleted file mode 100644 index c262b1d6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000002 deleted file mode 100644 index ea3fc645..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000003 deleted file mode 100644 index de5e9070..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000004 deleted file mode 100644 index d1aa2377..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000005 deleted file mode 100644 index 1a06e2c1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000006 deleted file mode 100644 index 42d0da1d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000000 deleted file mode 100644 index 7ef6e576..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000001 deleted file mode 100644 index f3abe400..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000002 deleted file mode 100644 index 044d27f5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000003 deleted file mode 100644 index 4ecc4d41..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000004 deleted file mode 100644 index cfcdf908..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000005 deleted file mode 100644 index 111e7c96..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000006 deleted file mode 100644 index 5c9064fe..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000007 deleted file mode 100644 index 41c7c8ba..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/plank.treelb.3d-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.2d.treelb.input deleted file mode 100644 index dac45bdf..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.2d.treelb.input +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "rect.treelb.2d" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(999,199)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(989,189)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(999,199)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00001.baselinedb.0000000 deleted file mode 100644 index 83db97f0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000000 deleted file mode 100644 index a6551b8e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000001 deleted file mode 100644 index cea6291a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000000 deleted file mode 100644 index efd5efd8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000001 deleted file mode 100644 index 6c7d4e15..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000002 deleted file mode 100644 index 254ca5ce..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000000 deleted file mode 100644 index 37cdfdd2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000001 deleted file mode 100644 index 695833c5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000002 deleted file mode 100644 index 273a26df..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000003 deleted file mode 100644 index 53941794..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000000 deleted file mode 100644 index e8ae3afe..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000001 deleted file mode 100644 index bdac9e62..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000002 deleted file mode 100644 index de9c46d6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000003 deleted file mode 100644 index d0c852c2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000004 deleted file mode 100644 index 411eaa97..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000000 deleted file mode 100644 index 29dff2aa..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000001 deleted file mode 100644 index 0dac9daa..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000002 deleted file mode 100644 index e7362503..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000003 deleted file mode 100644 index 34ec0399..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000004 deleted file mode 100644 index 6cba52e0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000005 deleted file mode 100644 index 6742bd62..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000000 deleted file mode 100644 index 186b5616..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000001 deleted file mode 100644 index 530d7c96..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000002 deleted file mode 100644 index c4fadcb1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000003 deleted file mode 100644 index a4bcf877..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000004 deleted file mode 100644 index 00c03d48..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000005 deleted file mode 100644 index 9d0b0ede..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000006 deleted file mode 100644 index 7136909c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000000 deleted file mode 100644 index ae87488f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000001 deleted file mode 100644 index 04a04159..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000002 deleted file mode 100644 index c6110231..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000003 deleted file mode 100644 index 9e8e3101..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000004 deleted file mode 100644 index 1811ca2d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000005 deleted file mode 100644 index effda1b4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000006 deleted file mode 100644 index 081cec6f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000007 deleted file mode 100644 index 7bf541ce..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rect.treelb.2d-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.1d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.1d.treelb.input deleted file mode 100644 index 8569826b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.1d.treelb.input +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - base_name = "rod.treelb.1d" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0),(299)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4 - - /* - Specify the min patch size. - */ - min_size = 1 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(1),(298)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0),(299)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.2d.treelb.input deleted file mode 100644 index d12f09d7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.2d.treelb.input +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "rod.treelb.2d" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(299,2)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min patch size. - */ - min_size = 1, 1 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(1,1),(298,1)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(299,2)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00001.baselinedb.0000000 deleted file mode 100644 index 614379bc..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000000 deleted file mode 100644 index dc2fdc97..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000001 deleted file mode 100644 index 8b7d5839..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000000 deleted file mode 100644 index 7497946a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000001 deleted file mode 100644 index be8783b4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000002 deleted file mode 100644 index e7d07886..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000000 deleted file mode 100644 index 705dba09..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000001 deleted file mode 100644 index 55cfd325..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000002 deleted file mode 100644 index f81e01b9..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000003 deleted file mode 100644 index 9771c5b2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000000 deleted file mode 100644 index e94bbf8b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000001 deleted file mode 100644 index e5062bb0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000002 deleted file mode 100644 index 64e26443..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000003 deleted file mode 100644 index 01a0bf67..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000004 deleted file mode 100644 index c15be4af..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000000 deleted file mode 100644 index cc73b820..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000001 deleted file mode 100644 index a26b92ad..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000002 deleted file mode 100644 index 9dd9eaf2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000003 deleted file mode 100644 index a49a92ce..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000004 deleted file mode 100644 index 51fd1277..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000005 deleted file mode 100644 index 2bddef60..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000000 deleted file mode 100644 index 2110b33d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000001 deleted file mode 100644 index a594a400..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000002 deleted file mode 100644 index 531e7777..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000003 deleted file mode 100644 index 4e658c2e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000004 deleted file mode 100644 index 84c05cb1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000005 deleted file mode 100644 index 4e1063b0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000006 deleted file mode 100644 index 707e199c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000000 deleted file mode 100644 index ad8be0a1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000001 deleted file mode 100644 index 3afe6d4a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000002 deleted file mode 100644 index d5ca1b08..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000003 deleted file mode 100644 index 9469475a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000004 deleted file mode 100644 index 8113bf7b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000005 deleted file mode 100644 index 62b0f17c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000006 deleted file mode 100644 index 90db7987..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000007 deleted file mode 100644 index 6cbcb0f3..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/rod.treelb.2d-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00001.baselinedb.0000000 deleted file mode 100644 index 5110ebe1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000000 deleted file mode 100644 index 9efa2c14..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000001 deleted file mode 100644 index ad309ea4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000000 deleted file mode 100644 index ba4b2ac4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000001 deleted file mode 100644 index abdc6174..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000002 deleted file mode 100644 index 9c6a635a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000000 deleted file mode 100644 index 9384f19c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000001 deleted file mode 100644 index c932b0eb..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000002 deleted file mode 100644 index 2ad29179..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000003 deleted file mode 100644 index 21ac3651..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000000 deleted file mode 100644 index ab4dfe4c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000001 deleted file mode 100644 index 261da3d0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000002 deleted file mode 100644 index 36502065..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000003 deleted file mode 100644 index 01204fd2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000004 deleted file mode 100644 index 7f5c732b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000000 deleted file mode 100644 index 8ff49c75..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000001 deleted file mode 100644 index a1b6d90c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000002 deleted file mode 100644 index 60db74b7..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000003 deleted file mode 100644 index 0c9d03c6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000004 deleted file mode 100644 index 00542566..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000005 deleted file mode 100644 index 86b01bb7..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000000 deleted file mode 100644 index d9bf23d6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000001 deleted file mode 100644 index 23f4b691..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000002 deleted file mode 100644 index dabb487c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000003 deleted file mode 100644 index 9fac4d60..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000004 deleted file mode 100644 index 2b8b1478..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000005 deleted file mode 100644 index 39b165dd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000006 deleted file mode 100644 index 1dab27ec..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000000 deleted file mode 100644 index 4e4bb3f5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000001 deleted file mode 100644 index 41adaedc..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000002 deleted file mode 100644 index cb576119..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000003 deleted file mode 100644 index 54ce03d7..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000004 deleted file mode 100644 index bf03376e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000005 deleted file mode 100644 index 03d29267..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000006 deleted file mode 100644 index 1d86befd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000007 deleted file mode 100644 index c0dfa987..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb.input deleted file mode 100644 index 5a49bb7c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.caplb.input +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_cube.2d.caplb" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(199,199)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min/max patch size. - */ - min_size = 4, 4 - // max_size = 8, 8 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(189,189)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(199,199)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -ChopAndPackLoadBalancer { - max_workload_factor = 0.1, 0.1 -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00001.baselinedb.0000000 deleted file mode 100644 index 305ab8ea..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000000 deleted file mode 100644 index 2d9d5a7f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000001 deleted file mode 100644 index ab2c7563..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000000 deleted file mode 100644 index 3bcc864b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000001 deleted file mode 100644 index 15e36ae0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000002 deleted file mode 100644 index 51c57597..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000000 deleted file mode 100644 index 6734e22d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000001 deleted file mode 100644 index 315ac59e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000002 deleted file mode 100644 index 9f362ba2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000003 deleted file mode 100644 index cd730281..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000000 deleted file mode 100644 index 0a8bbee9..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000001 deleted file mode 100644 index c8cc995f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000002 deleted file mode 100644 index b1783935..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000003 deleted file mode 100644 index 28e77195..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000004 deleted file mode 100644 index 2d53a330..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000000 deleted file mode 100644 index 6a2bd22d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000001 deleted file mode 100644 index 10f5e79f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000002 deleted file mode 100644 index 2d4e0441..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000003 deleted file mode 100644 index 79abf8e8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000004 deleted file mode 100644 index 5073c9cb..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000005 deleted file mode 100644 index cdf3bb80..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000000 deleted file mode 100644 index 46b6009b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000001 deleted file mode 100644 index 6d9dfd86..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000002 deleted file mode 100644 index 324f8b66..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000003 deleted file mode 100644 index 94a5ab37..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000004 deleted file mode 100644 index f39ca2f4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000005 deleted file mode 100644 index 9287e80f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000006 deleted file mode 100644 index f11c4a27..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000000 deleted file mode 100644 index e4895558..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000001 deleted file mode 100644 index 31632185..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000002 deleted file mode 100644 index 149aa072..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000003 deleted file mode 100644 index 23e83ed2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000004 deleted file mode 100644 index 1b619531..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000005 deleted file mode 100644 index bd7b69dd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000006 deleted file mode 100644 index 62e9e4c0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000007 deleted file mode 100644 index bfcac27f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb.input deleted file mode 100644 index dabb1038..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.2d.treelb.input +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_cube.2d.treelb" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(199,199)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(189,189)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(199,199)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00001.baselinedb.0000000 deleted file mode 100644 index 9394d23e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000000 deleted file mode 100644 index 1e3f297b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000001 deleted file mode 100644 index 36157ec0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000000 deleted file mode 100644 index 42669ea5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000001 deleted file mode 100644 index e56dd2a1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000002 deleted file mode 100644 index 0a720219..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000000 deleted file mode 100644 index 587fbde6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000001 deleted file mode 100644 index f3a347dd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000002 deleted file mode 100644 index 5549eed3..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000003 deleted file mode 100644 index 32f79506..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000000 deleted file mode 100644 index 041ceef2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000001 deleted file mode 100644 index 554e1e5e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000002 deleted file mode 100644 index 3f83a6c1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000003 deleted file mode 100644 index 4492fb75..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000004 deleted file mode 100644 index f6ed0ecf..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000000 deleted file mode 100644 index 67290e46..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000001 deleted file mode 100644 index 4f48658a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000002 deleted file mode 100644 index 028fdcf5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000003 deleted file mode 100644 index 34108f87..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000004 deleted file mode 100644 index 4219ddbe..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000005 deleted file mode 100644 index 1e0b1809..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000000 deleted file mode 100644 index 4558f6fd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000001 deleted file mode 100644 index 98f2b45c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000002 deleted file mode 100644 index f579a59a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000003 deleted file mode 100644 index dff35f92..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000004 deleted file mode 100644 index 94ad54ca..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000005 deleted file mode 100644 index 9149d880..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000006 deleted file mode 100644 index eec877a3..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000000 deleted file mode 100644 index 4d81f0e6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000001 deleted file mode 100644 index 0d89329c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000002 deleted file mode 100644 index c1af255c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000003 deleted file mode 100644 index 2075dacc..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000004 deleted file mode 100644 index e90103ef..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000005 deleted file mode 100644 index a2fc6f81..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000006 deleted file mode 100644 index 7e4be1dd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000007 deleted file mode 100644 index 54ad795c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb.input deleted file mode 100644 index a0c057e2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_cube.3d.treelb.input +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_cube.3d.treelb" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0,0),(99,99,99)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10,10),(89,89,89)] - initial_owners = 0 - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0,0),(99,99,99)] - x_lo = 0.0, 0.0, 0.0 - x_up = 1.0, 1.0, 1.0 - periodic_dimension = 0,1,0 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00001.baselinedb.0000000 deleted file mode 100644 index 63594cb2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000000 deleted file mode 100644 index 368b2506..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000001 deleted file mode 100644 index 43aa9e8b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000000 deleted file mode 100644 index b832e465..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000001 deleted file mode 100644 index fce8fd12..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000002 deleted file mode 100644 index a5f0dafb..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000000 deleted file mode 100644 index 7f1260f6..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000001 deleted file mode 100644 index 0afa9ac8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000002 deleted file mode 100644 index 63ffc773..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000003 deleted file mode 100644 index b42278b9..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000000 deleted file mode 100644 index 40b3ea9e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000001 deleted file mode 100644 index 2cdeba9d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000002 deleted file mode 100644 index 5d49dc57..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000003 deleted file mode 100644 index 9222b0f0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000004 deleted file mode 100644 index 84d00580..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000000 deleted file mode 100644 index d61c0004..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000001 deleted file mode 100644 index 406995cb..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000002 deleted file mode 100644 index 75bd73a8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000003 deleted file mode 100644 index 4e448ce7..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000004 deleted file mode 100644 index fd6bbfc9..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000005 deleted file mode 100644 index 558518f3..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000000 deleted file mode 100644 index 1cfd924d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000001 deleted file mode 100644 index 1f4cc072..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000002 deleted file mode 100644 index 990a24e4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000003 deleted file mode 100644 index 3f92db8f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000004 deleted file mode 100644 index 9c89ef8a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000005 deleted file mode 100644 index 8d791c2b..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000006 deleted file mode 100644 index 05f43dde..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000000 deleted file mode 100644 index 119e2e46..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000001 deleted file mode 100644 index 7ba367fd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000002 deleted file mode 100644 index 92066489..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000003 deleted file mode 100644 index 06156eec..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000004 deleted file mode 100644 index c1dd8e50..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000005 deleted file mode 100644 index 578f48d2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000006 deleted file mode 100644 index 3dd27b8c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000007 deleted file mode 100644 index d53341b2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb.input deleted file mode 100644 index c85caa60..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.caplb.input +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_sphere.2d.caplb" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(49,49)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4 - - box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - sort_output_nodes = TRUE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(49,49)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00001.baselinedb.0000000 deleted file mode 100644 index 2c31b111..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00001.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000000 deleted file mode 100644 index bac0b867..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000001 deleted file mode 100644 index 435ba5fe..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00002.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000000 deleted file mode 100644 index 2a6cf9d8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000001 deleted file mode 100644 index b42b5259..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000002 deleted file mode 100644 index 4ad96a25..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00003.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000000 deleted file mode 100644 index 365ccbd9..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000001 deleted file mode 100644 index 6edb6394..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000002 deleted file mode 100644 index 9d30f803..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000003 deleted file mode 100644 index a63c293d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00004.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000000 deleted file mode 100644 index 49909b7e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000001 deleted file mode 100644 index c027d942..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000002 deleted file mode 100644 index d99dd92a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000003 deleted file mode 100644 index fa303230..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000004 deleted file mode 100644 index 154b889f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00005.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000000 deleted file mode 100644 index 1da6f181..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000001 deleted file mode 100644 index d9b02952..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000002 deleted file mode 100644 index fb91e223..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000003 deleted file mode 100644 index aad5ff98..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000004 deleted file mode 100644 index 05084d31..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000005 deleted file mode 100644 index 4bdf21c5..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00006.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000000 deleted file mode 100644 index a796db73..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000001 deleted file mode 100644 index 4ad9cb90..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000002 deleted file mode 100644 index 5cfc927f..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000003 deleted file mode 100644 index 9e70191c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000004 deleted file mode 100644 index ed6ef5b4..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000005 deleted file mode 100644 index 5cfdc1f0..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000006 deleted file mode 100644 index 99e392e1..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00007.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000000 deleted file mode 100644 index a018524d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000000 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000001 deleted file mode 100644 index e37dcc3d..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000001 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000002 deleted file mode 100644 index 77dfea8e..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000002 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000003 deleted file mode 100644 index 876cbe61..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000003 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000004 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000004 deleted file mode 100644 index 1a4eaa8c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000004 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000005 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000005 deleted file mode 100644 index f9c31cd8..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000005 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000006 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000006 deleted file mode 100644 index 9dfb666a..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000006 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000007 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000007 deleted file mode 100644 index c8e3f7bd..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb-00008.baselinedb.0000007 and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb.input deleted file mode 100644 index 0b8b80c7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/small_sphere.2d.treelb.input +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_sphere.2d.treelb" - baseline_dirname = "test_inputs" - // generate_baseline = TRUE // Default is FALSE - - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0,0),(49,49)] - - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4, 4 - - /* - Specify the min patch size. - */ - min_size = 4, 4 - - box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - sort_output_nodes = TRUE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -CartesianGridGeometry { - domain_boxes = [(0,0),(49,49)] - x_lo = 0.0, 0.0 - x_up = 1.0, 1.0 - periodic_dimension = 0,1 -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..2b92cd05 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..15a6bc78 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..3866223d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..7f64ccf0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..0a0df4f9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..4aaff852 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..8a4198a4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..14773bf1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..18888696 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..68dc39e5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..6a508802 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..49b0426d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..e5313c71 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..0bd5e269 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00001.baselinedb.0000000 new file mode 100644 index 00000000..039f70f7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000000 new file mode 100644 index 00000000..8a62f749 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000001 new file mode 100644 index 00000000..06b3dc83 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000000 new file mode 100644 index 00000000..afafd481 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000001 new file mode 100644 index 00000000..061b6b24 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000002 new file mode 100644 index 00000000..578eb6e9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000003 new file mode 100644 index 00000000..c043246f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecap-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..e3fe2247 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..523becbb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..8a1934b5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..104d0eb2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..ce154ab4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..b7672127 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..9d8bbeea Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..d03762ae Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..3a44e24b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..2501af86 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..2ce558ba Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..4224340c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..a37fa5f7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..aaa227d2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..a5fb4a1e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..cb2c4bef Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..af7fcff9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..24506f15 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..0a235a6a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..810e452d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..6567649c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..4e3dfe70 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..e9f1b753 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..ee6ab175 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..0626f4c3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..4e08ed37 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..216beef3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..95abdc0e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..e766bea9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..8f35ad62 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..0910cbda Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..f325698d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..a24f5e38 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..14bf73a0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..44a7fefd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..b0d67910 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..8ccf5009 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..23bb6910 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..a16e733d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..8c0db922 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..ea68ed88 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..8061c363 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..1d7b3498 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..09918203 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..08b55ee4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..3bbb52e2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..e337e15a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..c16a61e4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..7c982b94 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..9d00ba45 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..a750e31a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..4f1aea61 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..c7d587e6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..66472f4e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..3e64d136 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..6e837d49 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/box.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..c408bc5c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..155388ad Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..d235755f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..9363b244 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..502245f8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..e089c694 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..e03e7a26 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..4f4f50f2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..ffa87205 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..4f5aa598 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..aa741885 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..90fbdc8f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..f137dd8d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..03c1f648 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..2a9691b8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..49e3ca84 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..1e166e0e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..25e1784d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..0379a905 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..2e4f2fa5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..de76d861 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..7bdb9556 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..fd1f815a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..7bd78a8e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..2a720746 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..8ce23364 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..18ffc57f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..03c3b485 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..af9793cc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..311d17ec Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..8b385983 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..87a56e2d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..ad029055 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..10e1d017 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..5e85bf84 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..01e0cc12 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..388e14db Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..42dedb31 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..9fa3ecfc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..6dcea5e0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..2000e810 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..9da8731a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/front.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..31ed1e89 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..9d14b6fc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..fe5e1e24 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..35041a77 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..e189d464 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..3ef7b6f3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..aabe2cc1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/int_overflow.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..0ff62156 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..fe5bd1ea Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..79472d7b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..f5812f32 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..21a03e0b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..74643a4f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..13cdc8c9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..4c835322 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..d0275ed1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..b1fda960 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..e5b578d9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..ad87c9d3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..5e36c9a9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..c036bb4c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..1dcd7790 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..60e3b20f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..0f75869f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..eef44710 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..0211d1b9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..b055fdcb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..87a1e13b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..71fe96c4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..e4167789 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..3ad7610e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..a3ad63ef Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..af4e4361 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..42aef54e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..62f3a572 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..b0ccd625 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..afaf2d8e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..3c87c01e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..9bc08f17 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..efbb487e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..2c467d5c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..dbacdbda Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.2d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00001.baselinedb.0000000 new file mode 100644 index 00000000..3ec99104 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000000 new file mode 100644 index 00000000..f282dc34 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000001 new file mode 100644 index 00000000..12a2efef Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000000 new file mode 100644 index 00000000..3708fffe Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000001 new file mode 100644 index 00000000..e8e4882a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000002 new file mode 100644 index 00000000..c837d621 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000003 new file mode 100644 index 00000000..27a75ff0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.caplb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..86a7c290 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..341959d6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..887da2d5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..cefb224b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..0bad56fe Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..ce4ef0e2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..104294a4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.cascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00001.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000000 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000001 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000002 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000003 new file mode 100644 index 00000000..82daee09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.graphlb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00001.baselinedb.0000000 new file mode 100644 index 00000000..781c7201 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000000 new file mode 100644 index 00000000..7fa972ca Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000001 new file mode 100644 index 00000000..84592a61 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000000 new file mode 100644 index 00000000..55faf772 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000001 new file mode 100644 index 00000000..f2fda6ba Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000002 new file mode 100644 index 00000000..ee62456b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000003 new file mode 100644 index 00000000..f1bb954f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilecascade-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..1646886e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..e049224c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..cf8bb3b4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..219182bb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..7a96fbbb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..d8bcd1e1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..2ed26ad4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.tilelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00001.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00001.baselinedb.0000000 new file mode 100644 index 00000000..52432e4e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00001.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000000 new file mode 100644 index 00000000..d6e0bc51 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000001 new file mode 100644 index 00000000..d6e15dc0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00002.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000000 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000000 new file mode 100644 index 00000000..e1ce95b5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000001 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000001 new file mode 100644 index 00000000..06cb5f31 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000002 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000002 new file mode 100644 index 00000000..7c12cc0b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000003 b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000003 new file mode 100644 index 00000000..7b1f82c5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/LoadBalanceCorrectness/test_inputs/xlC/lss.3d.treelb-00004.baselinedb.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/Makefile.in b/base/SAMRAI/SAMRAI/source/test/Makefile.in index e389e9c5..c282a69e 100644 --- a/base/SAMRAI/SAMRAI/source/test/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/Makefile.in @@ -3,20 +3,20 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing parts of SAMRAI library ## ######################################################################### -SAMRAI = @top_srcdir@ +SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ OBJECT = ../.. +REPORT = $(OBJECT)/report.xml SUBDIR = source/test SUBDIRS = \ - pointer \ + testlib \ logger \ - ieee \ dimension \ dataaccess \ inputdb \ @@ -30,6 +30,9 @@ SUBDIRS = \ async_comm \ mapped_box_set_iterators \ hierarchy \ + Connector \ + assumed_partition \ + OverlapConnectorAlgorithm \ MappingConnector \ mblktree \ MappedBoxLevelConnectorUtilsTests \ @@ -40,7 +43,7 @@ SUBDIRS = \ patchbdrysum \ dataops \ hypre \ - FAC_nonadaptive \ + FAC_staticrefinement \ FAC_adaptive \ vector \ sundials \ @@ -61,7 +64,14 @@ include $(OBJECT)/config/Makefile.config library: check: + $(RM) $(REPORT) + touch $(REPORT) + @echo "" >> $(REPORT) + @echo "" >> $(REPORT) + @echo " " >> $(REPORT) for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + @echo " " >> $(REPORT) + @echo "" >> $(REPORT) check2d: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done @@ -71,13 +81,37 @@ check3d: checkcompile: @echo "Starting " $@ " in source/test at `date`" - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done @echo "Completed " $@ " in source/test at `date`" checktest: + $(RM) $(REPORT) + touch $(REPORT) + @echo "" >> $(REPORT) + @echo "" >> $(REPORT) + @echo " " >> $(REPORT) @echo "Starting " $@ " in source/test at `date`" for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done @echo "Completed " $@ " in source/test at `date`" + @echo " " >> $(REPORT) + @echo "" >> $(REPORT) + +examples: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +perf: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +everything: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) checkcompile) || exit 1; done + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) checktest); done + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) examples); done + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) perf); done clean: + $(RM) $(REPORT) + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +checkclean: + $(RM) $(REPORT) for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.depend index 20e32cf4..10c5f148 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -15,6 +15,7 @@ FILE_0=main-mblcu.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -36,6 +37,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -48,37 +51,27 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -90,34 +83,23 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-mblcu.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.in b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.in index 86bb07e1..db51eb94 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the MultiblockMappedBoxTree tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/MappedBoxLevelConnectorUtilsTests -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -24,36 +25,62 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 17 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" main: main-mblcu.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-mblcu.o $(LIBSAMRAI) $(LDLIBS) -o $@ -check: main +check: main $(MAKE) check2d $(MAKE) check3d check2d: - for i in test_inputs/*.2d.input; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ - done + @for i in test_inputs/*.2d.input; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: - for i in test_inputs/*.3d.input; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ - done + @for i in test_inputs/*.3d.input; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/main-mblcu.C b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/main-mblcu.C index 2d142b48..c8774987 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/main-mblcu.C +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/main-mblcu.C @@ -3,13 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for performance of tree search algorithm. * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Connector.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxLevel.h" @@ -17,6 +16,7 @@ #include "SAMRAI/hier/BoxContainerSingleBlockIterator.h" #include "SAMRAI/geom/GridGeometry.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/HDFDatabase.h" @@ -38,8 +38,8 @@ using namespace tbox; */ void partitionBoxes( - hier::BoxLevel& mapped_box_level, - hier::BoxLevel& domain_mapped_box_level, + hier::BoxLevel& box_level, + hier::BoxLevel& domain_box_level, const hier::IntVector& max_box_size, const hier::IntVector& min_box_size); @@ -48,17 +48,17 @@ partitionBoxes( */ void shrinkBoxLevel( - hier::BoxLevel& small_mapped_box_level, - const hier::BoxLevel& big_mapped_box_level, + boost::shared_ptr& small_box_level, + const hier::BoxLevel& big_box_level, const hier::IntVector& shrinkage, - const tbox::Array& unshrunken_blocks); + const std::vector& unshrunken_blocks); /* * Refine a BoxLevel by the given ratio. */ void refineBoxLevel( - hier::BoxLevel& mapped_box_level, + hier::BoxLevel& box_level, const hier::IntVector& ratio); /* @@ -126,7 +126,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); int fail_count = 0; { @@ -188,7 +187,7 @@ int main( TBOX_ERROR("BoxLevelConnectorUtils test: could not find entry GridGeometry" << "\nin input."); } - boost::shared_ptr grid_geometry( + boost::shared_ptr grid_geometry( new geom::GridGeometry( dim, "GridGeometry", @@ -198,30 +197,36 @@ int main( /* * Empty blocks are blocks not to have any Boxes. */ - tbox::Array empty_blocks; + std::vector empty_blocks; if (main_db->isInteger("empty_blocks")) { - empty_blocks = main_db->getIntegerArray("empty_blocks"); + empty_blocks = main_db->getIntegerVector("empty_blocks"); } /* * Unshrunken blocks are blocks in which the small BoxLevel * has the same index space as the big BoxLevel. */ - tbox::Array unshrunken_blocks; + std::vector unshrunken_blocks; if (main_db->isInteger("unshrunken_blocks")) { - unshrunken_blocks = main_db->getIntegerArray("unshrunken_blocks"); + std::vector input_unshrunken = + main_db->getIntegerVector("unshrunken_blocks"); + for (std::vector::const_iterator itr = input_unshrunken.begin(); + itr != input_unshrunken.end(); ++itr) { + unshrunken_blocks.push_back( + static_cast(*itr)); + } } plog << "Input database after initialization..." << std::endl; input_db->printClassData(plog); - const hier::IntVector& one_vector(hier::IntVector::getOne(dim)); - const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); + hier::IntVector one_vector(hier::IntVector::getOne(dim)); + hier::IntVector zero_vector(hier::IntVector::getZero(dim)); /* * How much to shrink the big BoxLevel to get the small one. */ - const hier::IntVector shrinkage(dim, 1); + const hier::IntVector shrinkage(hier::IntVector::getOne(dim)); hier::BoxLevelConnectorUtils mblcu; @@ -229,34 +234,33 @@ int main( * Set up the domain. */ - hier::BoxContainer domain_mapped_boxes; - grid_geometry->computePhysicalDomain( - domain_mapped_boxes, one_vector); - tbox::plog << "domain_mapped_boxes:\n" - << domain_mapped_boxes.format() + hier::BoxContainer domain_boxes; + grid_geometry->computePhysicalDomain(domain_boxes, one_vector); + tbox::plog << "domainboxes:\n" + << domain_boxes.format() << std::endl; - domain_mapped_boxes.makeTree(grid_geometry.get()); + domain_boxes.makeTree(grid_geometry.get()); /* - * Construct the big_mapped_box_level. It is a refinement of + * Construct the big_box_level. It is a refinement of * the domain but without exclude* boxes. */ - hier::BoxLevel big_mapped_box_level( + hier::BoxLevel big_box_level( one_vector, grid_geometry, tbox::SAMRAI_MPI::getSAMRAIWorld()); const std::string exclude("exclude"); - for (int bn = 0; bn < grid_geometry->getNumberBlocks(); ++bn) { + for (hier::BlockId::block_t bn = 0; bn < grid_geometry->getNumberBlocks(); ++bn) { const hier::BlockId block_id(bn); - const std::string exclude_boxes_name = exclude + tbox::Utilities::intToString(bn); + const std::string exclude_boxes_name = exclude + tbox::Utilities::intToString(static_cast(bn)); if (main_db->keyExists(exclude_boxes_name)) { /* - * Block bn boxes in big_mapped_box_level are the + * Block bn boxes in big_box_level are the * block_domain \ exclude_boxes. */ @@ -265,8 +269,9 @@ int main( one_vector, block_id); - hier::BoxContainer exclude_boxes; - exclude_boxes = main_db->getDatabaseBoxArray(exclude_boxes_name); + std::vector db_box_vector = + main_db->getDatabaseBoxVector(exclude_boxes_name); + hier::BoxContainer exclude_boxes(db_box_vector); for (hier::BoxContainer::iterator itr = exclude_boxes.begin(); itr != exclude_boxes.end(); ++itr) { itr->setBlockId(block_id); @@ -275,9 +280,9 @@ int main( block_domain.removeIntersections(exclude_boxes); hier::LocalId last_local_id(-1); - for (hier::BoxContainer::iterator bi(block_domain); + for (hier::BoxContainer::iterator bi = block_domain.begin(); bi != block_domain.end(); ++bi) { - big_mapped_box_level.addBoxWithoutUpdate( + big_box_level.addBoxWithoutUpdate( hier::Box(*bi, ++last_local_id, 0)); @@ -286,54 +291,67 @@ int main( } else { /* - * Block bn boxes in big_mapped_box_level are the same as + * Block bn boxes in big_box_level are the same as * block bn domain. */ - for (hier::BoxContainerSingleBlockIterator bi(domain_mapped_boxes.begin(block_id)); - bi != domain_mapped_boxes.end(block_id); ++bi) { - big_mapped_box_level.addBoxWithoutUpdate(*bi); + for (hier::BoxContainerSingleBlockIterator bi(domain_boxes.begin(block_id)); + bi != domain_boxes.end(block_id); ++bi) { + big_box_level.addBoxWithoutUpdate(*bi); } } } - big_mapped_box_level.finalize(); + big_box_level.finalize(); - const hier::BoxContainer& big_mapped_box_set( - big_mapped_box_level.getBoxes()); + const hier::BoxContainer& big_boxes(big_box_level.getBoxes()); - hier::BoxLevel big_domain_level = big_mapped_box_level; + hier::BoxLevel big_domain_level = big_box_level; /* * Generate the "small" BoxLevel by shrinking the big one * back at its boundary. */ - hier::BoxLevel small_mapped_box_level(dim); - shrinkBoxLevel(small_mapped_box_level, - big_mapped_box_level, + boost::shared_ptr small_box_level; + shrinkBoxLevel(small_box_level, + big_box_level, shrinkage, unshrunken_blocks); - hier::BoxLevel small_domain_level = small_mapped_box_level; + hier::BoxLevel small_domain_level = *small_box_level; + + std::vector refinement_ratios( + 1, hier::IntVector(dim, 1, grid_geometry->getNumberBlocks())); /* * Refine Boxlevels as user specified. */ if (main_db->isInteger("big_refinement_ratio")) { hier::IntVector big_refinement_ratio(dim); - main_db->getIntegerArray("big_refinement_ratio", &big_refinement_ratio[0], dim.getValue()); - refineBoxLevel(big_mapped_box_level, - big_refinement_ratio); + main_db->getIntegerArray("big_refinement_ratio", + &big_refinement_ratio[0], + dim.getValue()); + refineBoxLevel(big_box_level, big_refinement_ratio); } + refinement_ratios.push_back(big_box_level.getRefinementRatio()); if (main_db->isInteger("small_refinement_ratio")) { hier::IntVector small_refinement_ratio(dim); main_db->getIntegerArray("small_refinement_ratio", &small_refinement_ratio[0], dim.getValue()); - refineBoxLevel(small_mapped_box_level, - small_refinement_ratio); + refineBoxLevel(*small_box_level, small_refinement_ratio); } + TBOX_ASSERT(small_box_level->getRefinementRatio() > + big_box_level.getRefinementRatio()); + refinement_ratios.push_back(small_box_level->getRefinementRatio() / + big_box_level.getRefinementRatio()); + + /* + * These steps are usually handled by PatchHierarchy, but this + * test does not use PatchHierarchy. + */ + grid_geometry->setUpRatios(refinement_ratios); /* * Partition the big and small BoxLevels. @@ -343,32 +361,36 @@ int main( */ hier::IntVector max_box_size(dim, tbox::MathUtilities::getMax()); if (main_db->isInteger("max_box_size")) { - main_db->getIntegerArray("max_box_size", &max_box_size[0], dim.getValue()); + main_db->getIntegerArray("max_box_size", + &max_box_size[0], + dim.getValue()); } hier::IntVector min_box_size(dim, 2); if (main_db->isInteger("min_box_size")) { - main_db->getIntegerArray("min_box_size", &min_box_size[0], dim.getValue()); + main_db->getIntegerArray("min_box_size", + &min_box_size[0], + dim.getValue()); } - partitionBoxes(small_mapped_box_level, small_domain_level, - max_box_size, min_box_size); - partitionBoxes(big_mapped_box_level, big_domain_level, - max_box_size, min_box_size); + partitionBoxes(*small_box_level, small_domain_level, + max_box_size, min_box_size); + partitionBoxes(big_box_level, big_domain_level, + max_box_size, min_box_size); - big_mapped_box_level.cacheGlobalReducedData(); - small_mapped_box_level.cacheGlobalReducedData(); + big_box_level.cacheGlobalReducedData(); + small_box_level->cacheGlobalReducedData(); - tbox::plog << "\nbig_mapped_box_level:\n" - << big_mapped_box_level.format("", 2) + tbox::plog << "\nbig_box_level:\n" + << big_box_level.format("", 2) << '\n' - << "small_mapped_box_level:\n" - << small_mapped_box_level.format("", 2) + << "small_box_level:\n" + << small_box_level->format("", 2) << '\n' ; - const hier::BoxContainer& small_mapped_box_set(small_mapped_box_level.getBoxes()); + const hier::BoxContainer& small_boxes(small_box_level->getBoxes()); const hier::BoxContainer small_box_tree( - small_mapped_box_level.getGlobalizedVersion().getGlobalBoxes()); + small_box_level->getGlobalizedVersion().getGlobalBoxes()); small_box_tree.makeTree(grid_geometry.get()); /* @@ -376,15 +398,12 @@ int main( */ const hier::Connector& small_to_big( - small_mapped_box_level.getPersistentOverlapConnectors().createConnector( - big_mapped_box_level, + small_box_level->createConnectorWithTranspose(big_box_level, + refinement_ratios.back() * shrinkage, shrinkage)); small_to_big.cacheGlobalReducedData(); - const hier::Connector& big_to_small( - big_mapped_box_level.getPersistentOverlapConnectors().createConnector( - small_mapped_box_level, - shrinkage)); + const hier::Connector& big_to_small = small_to_big.getTranspose(); big_to_small.cacheGlobalReducedData(); tbox::plog << "\nsmall_to_big:\n" @@ -400,95 +419,100 @@ int main( { /* - * small_mapped_box_level nests inside big_mapped_box_level + * small_box_level nests inside big_box_level * by the shrinkage amount. Verify that * computeInternalParts finds all - * small_mapped_box_level to be internal to - * big_mapped_box_level and that + * small_box_level to be internal to + * big_box_level and that * computeExternalParts finds none of - * small_mapped_box_level to be external to - * big_mapped_box_level. + * small_box_level to be external to + * big_box_level. * - * small_mapped_box_level's internal parts should include + * small_box_level's internal parts should include * everything. Thus small_to_everything should only map - * small_mapped_box_level to its own index space (no more and + * small_box_level to its own index space (no more and * no less). * - * small_mapped_box_level's external parts should include + * small_box_level's external parts should include * nothing. Thus small_to_nothing should map - * small_mapped_box_level to nothing. + * small_box_level to nothing. */ - hier::BoxLevel everything(dim), nothing(dim); - hier::Connector small_to_everything, small_to_nothing; + boost::shared_ptr everything; + boost::shared_ptr nothing; + boost::shared_ptr small_to_everything, + small_to_nothing; mblcu.computeExternalParts( nothing, small_to_nothing, small_to_big, -shrinkage, - domain_mapped_boxes); + domain_boxes); mblcu.computeInternalParts( everything, small_to_everything, small_to_big, -shrinkage, - domain_mapped_boxes); + domain_boxes); tbox::plog << "\nsmall_to_nothing:\n" - << small_to_nothing.format("", 2) << '\n' + << small_to_nothing->format("", 2) << '\n' << "\nnothing:\n" - << nothing.format("", 2) << '\n' + << nothing->format("", 2) << '\n' << "small_to_everything:\n" - << small_to_everything.format("", 2) << '\n' + << small_to_everything->format("", 2) << '\n' << "\neverything:\n" - << everything.format("", 2) << '\n' + << everything->format("", 2) << '\n' ; - for (hier::BoxContainer::const_iterator bi = small_mapped_box_set.begin(); - bi != small_mapped_box_set.end(); ++bi) { - const hier::Box& small_mapped_box = *bi; + for (hier::BoxContainer::const_iterator bi = small_boxes.begin(); + bi != small_boxes.end(); ++bi) { + const hier::Box& small_box = *bi; - if (small_to_everything.hasNeighborSet(small_mapped_box.getId())) { + if (small_to_everything->hasNeighborSet(small_box.getBoxId())) { hier::Connector::ConstNeighborhoodIterator neighbors = - small_to_everything.find(small_mapped_box.getId()); + small_to_everything->find(small_box.getBoxId()); hier::BoxContainer neighbor_box_list; - for (hier::Connector::ConstNeighborIterator na = small_to_everything.begin(neighbors); - na != small_to_everything.end(neighbors); ++na) { + for (hier::Connector::ConstNeighborIterator na = + small_to_everything->begin(neighbors); + na != small_to_everything->end(neighbors); ++na) { if (!(*na).empty()) { neighbor_box_list.pushBack(*na); - - if (!small_mapped_box.contains(*na)) { + + if (!small_box.contains(*na)) { tbox::perr << "Mapping small_to_everyting erroneously mapped " - << small_mapped_box << " to:\n" << *na + << small_box << " to:\n" << *na << " which is outside itself.\n"; ++fail_count; } } } - hier::BoxContainer tmp_box_list(small_mapped_box); + hier::BoxContainer tmp_box_list(small_box); tmp_box_list.removeIntersections(neighbor_box_list); if (tmp_box_list.size() != 0) { tbox::perr << "Mapping small_to_everything erroneously mapped " - << small_mapped_box << " to something less than itself:\n"; - small_to_everything.writeNeighborhoodToErrorStream( - small_mapped_box.getId()); + << small_box << " to something less than itself:\n"; + small_to_everything->writeNeighborhoodToStream( + tbox::perr, + small_box.getBoxId()); } } - if (small_to_nothing.hasNeighborSet(small_mapped_box.getId())) { - if (!small_to_nothing.isEmptyNeighborhood( - small_mapped_box.getId())) { - tbox::perr << "Mapping small_to_nothing erroneously mapped " << small_mapped_box + if (small_to_nothing->hasNeighborSet(small_box.getBoxId())) { + if (!small_to_nothing->isEmptyNeighborhood( + small_box.getBoxId())) { + tbox::perr << "Mapping small_to_nothing erroneously mapped " << small_box << " to:\n"; - small_to_nothing.writeNeighborhoodToErrorStream( - small_mapped_box.getId()); + small_to_nothing->writeNeighborhoodToStream( + tbox::perr, + small_box.getBoxId()); tbox::perr << "\nIt should be mapped to nothing\n"; ++fail_count; } } else { tbox::perr << "Mapping small_to_nothing is missing a map from " - << small_mapped_box << " to nothing.\n"; + << small_box << " to nothing.\n"; ++fail_count; } @@ -497,42 +521,41 @@ int main( { /* - * Compute the parts of big_mapped_box_level that are - * internal to small_mapped_box_level and check for - * correctness. + * Compute the parts of big_box_level that are + * internal to small_box_level and check for correctness. * * To verify that the internal parts are correctly computed: * - * - check that the small_mapped_box_level and the internal - * parts of big_mapped_box_level have the same index space. + * - check that the small_box_level and the internal + * parts of big_box_level have the same index space. */ - hier::BoxLevel internal_mapped_box_level(dim); - hier::Connector big_to_internal; + boost::shared_ptr internal_box_level; + boost::shared_ptr big_to_internal; mblcu.computeInternalParts( - internal_mapped_box_level, + internal_box_level, big_to_internal, big_to_small, zero_vector); - const hier::BoxContainer& internal_mapped_box_set(internal_mapped_box_level.getBoxes()); - tbox::plog << "internal_mapped_box_level:\n" - << internal_mapped_box_level.format("", 2) + const hier::BoxContainer& internal_boxes(internal_box_level->getBoxes()); + tbox::plog << "internal_box_level:\n" + << internal_box_level->format("", 2) << '\n' << "big_to_internal:\n" - << big_to_internal.format("", 2); + << big_to_internal->format("", 2); hier::BoxContainer internal_box_tree( - internal_mapped_box_level.getGlobalizedVersion().getGlobalBoxes()); + internal_box_level->getGlobalizedVersion().getGlobalBoxes()); internal_box_tree.makeTree(grid_geometry.get()); - for (hier::BoxContainer::const_iterator ni = small_mapped_box_set.begin(); - ni != small_mapped_box_set.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = small_boxes.begin(); + ni != small_boxes.end(); ++ni) { hier::BoxContainer tmp_box_list(*ni); small_to_big.getHeadCoarserFlag() ? tmp_box_list.coarsen(small_to_big.getRatio()) : tmp_box_list.refine(small_to_big.getRatio()); tmp_box_list.removeIntersections( - big_mapped_box_level.getRefinementRatio(), + big_box_level.getRefinementRatio(), internal_box_tree); if (tmp_box_list.size() > 0) { tbox::perr << "Small box " << *ni << " should fall within " @@ -541,14 +564,14 @@ int main( } } - for (hier::BoxContainer::const_iterator ni = internal_mapped_box_set.begin(); - ni != internal_mapped_box_set.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = internal_boxes.begin(); + ni != internal_boxes.end(); ++ni) { hier::BoxContainer tmp_box_list(*ni); big_to_small.getHeadCoarserFlag() ? tmp_box_list.coarsen(big_to_small.getRatio()) : tmp_box_list.refine(big_to_small.getRatio()); tmp_box_list.removeIntersections( - small_mapped_box_level.getRefinementRatio(), + small_box_level->getRefinementRatio(), small_box_tree); if (tmp_box_list.size() > 0) { tbox::perr << "Internal box " << *ni << " should fall within " @@ -562,49 +585,49 @@ int main( { /* - * Compute parts of big_mapped_box_level that are external to - * small_mapped_box_level. + * Compute parts of big_box_level that are external to + * small_box_level. * * Verify that the external parts are correctly computed: * - * - check that external parts do not overlap small_mapped_box_level. + * - check that external parts do not overlap small_box_level. * - * - check that small_mapped_box_level does not overlap external parts. + * - check that small_box_level does not overlap external parts. * - * - check that big_mapped_box_level \ { small_mapped_box_level, external parts } + * - check that big_box_level \ { small_box_level, external parts } * is empty. */ - hier::BoxLevel external_mapped_box_level(dim); - hier::Connector big_to_external; + boost::shared_ptr external_box_level; + boost::shared_ptr big_to_external; mblcu.computeExternalParts( - external_mapped_box_level, + external_box_level, big_to_external, big_to_small, zero_vector, hier::BoxContainer()); - const hier::BoxContainer& external_mapped_box_set(external_mapped_box_level.getBoxes()); - tbox::plog << "\nexternal_mapped_box_level:\n" - << external_mapped_box_level.format("", 2) + const hier::BoxContainer& external_boxes(external_box_level->getBoxes()); + tbox::plog << "\nexternal_box_level:\n" + << external_box_level->format("", 2) << '\n' << "big_to_external:\n" - << big_to_external.format("", 2); + << big_to_external->format("", 2); hier::BoxContainer external_box_tree( - external_mapped_box_level.getGlobalizedVersion().getGlobalBoxes()); + external_box_level->getGlobalizedVersion().getGlobalBoxes()); external_box_tree.makeTree(grid_geometry.get()); - for (hier::BoxContainer::const_iterator ni = external_mapped_box_set.begin(); - ni != external_mapped_box_set.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = external_boxes.begin(); + ni != external_boxes.end(); ++ni) { hier::BoxContainer tmp_box_list(*ni); big_to_small.getHeadCoarserFlag() ? tmp_box_list.coarsen(big_to_small.getRatio()) : tmp_box_list.refine(big_to_small.getRatio()); tmp_box_list.intersectBoxes( - small_mapped_box_level.getRefinementRatio(), + small_box_level->getRefinementRatio(), small_box_tree); if (tmp_box_list.size() != 0) { tbox::perr << "External box " << *ni << " should not\n" - << "intersect small_mapped_box_level but does.\n" + << "intersect small_box_level but does.\n" << "Intersections:\n"; tmp_box_list.print(tbox::perr); tbox::perr << std::endl; @@ -612,14 +635,14 @@ int main( } } - for (hier::BoxContainer::const_iterator ni = small_mapped_box_set.begin(); - ni != small_mapped_box_set.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = small_boxes.begin(); + ni != small_boxes.end(); ++ni) { hier::BoxContainer tmp_box_list(*ni); small_to_big.getHeadCoarserFlag() ? tmp_box_list.coarsen(small_to_big.getRatio()) : tmp_box_list.refine(small_to_big.getRatio()); tmp_box_list.intersectBoxes( - big_mapped_box_level.getRefinementRatio(), + big_box_level.getRefinementRatio(), external_box_tree); if (tmp_box_list.size() != 0) { tbox::perr << "Small box " << *ni << " should not intersect " @@ -631,20 +654,20 @@ int main( } } - for (hier::BoxContainer::const_iterator ni = big_mapped_box_set.begin(); - ni != big_mapped_box_set.end(); ++ni) { + for (hier::BoxContainer::const_iterator ni = big_boxes.begin(); + ni != big_boxes.end(); ++ni) { hier::BoxContainer tmp_box_list(*ni); big_to_small.getHeadCoarserFlag() ? tmp_box_list.coarsen(big_to_small.getRatio()) : tmp_box_list.refine(big_to_small.getRatio()); tmp_box_list.removeIntersections( - small_mapped_box_level.getRefinementRatio(), + small_box_level->getRefinementRatio(), small_box_tree); small_to_big.getHeadCoarserFlag() ? tmp_box_list.coarsen(small_to_big.getRatio()) : tmp_box_list.refine(small_to_big.getRatio()); tmp_box_list.removeIntersections( - big_mapped_box_level.getRefinementRatio(), + big_box_level.getRefinementRatio(), external_box_tree); if (tmp_box_list.size() > 0) { tbox::perr << "Big box " << *ni << " should not be inside " @@ -659,7 +682,7 @@ int main( } if (fail_count == 0) { - tbox::pout << "\nPASSED: MappedBoxLevelConnector test" << std::endl; + tbox::pout << "\nPASSED: BoxLevelConnector test" << std::endl; } input_db.reset(); @@ -677,17 +700,8 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - tbox::pout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - tbox::plog << "Process " << std::setw(5) << rank << " exiting." << std::endl; return fail_count; } @@ -698,210 +712,153 @@ int main( * configuration. */ void partitionBoxes( - hier::BoxLevel& mapped_box_level, - hier::BoxLevel& domain_mapped_box_level, + hier::BoxLevel& box_level, + hier::BoxLevel& domain_box_level, const hier::IntVector& max_box_size, const hier::IntVector& min_box_size) { - const tbox::Dimension& dim(mapped_box_level.getDim()); + const tbox::Dimension& dim(box_level.getDim()); - domain_mapped_box_level.setParallelState(hier::BoxLevel::GLOBALIZED); + domain_box_level.setParallelState(hier::BoxLevel::GLOBALIZED); - mesh::TreeLoadBalancer load_balancer(mapped_box_level.getDim()); + mesh::TreeLoadBalancer load_balancer(box_level.getDim(), + "TreeLoaadBalaancer"); - hier::Connector dummy_connector; + hier::Connector* dummy_connector = 0; const hier::IntVector bad_interval(dim, 1); - const hier::IntVector cut_factor(dim, 1); + const hier::IntVector cut_factor(hier::IntVector::getOne(dim)); load_balancer.loadBalanceBoxLevel( - mapped_box_level, - dummy_connector, + box_level, dummy_connector, boost::shared_ptr(), 0, - dummy_connector, - dummy_connector, min_box_size, max_box_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor); } void shrinkBoxLevel( - hier::BoxLevel& small_mapped_box_level, - const hier::BoxLevel& big_mapped_box_level, + boost::shared_ptr& small_box_level, + const hier::BoxLevel& big_box_level, const hier::IntVector& shrinkage, - const tbox::Array& unshrunken_blocks) + const std::vector& unshrunken_blocks) { const boost::shared_ptr& grid_geometry( - big_mapped_box_level.getGridGeometry()); + big_box_level.getGridGeometry()); - const int local_rank = big_mapped_box_level.getMPI().getRank(); + const int local_rank = big_box_level.getMPI().getRank(); - const hier::BoxContainer& big_mapped_box_set(big_mapped_box_level.getBoxes()); + const hier::BoxContainer& big_boxes(big_box_level.getBoxes()); const hier::Connector& big_to_big( - big_mapped_box_level.getPersistentOverlapConnectors().createConnector( - big_mapped_box_level, - shrinkage)); + big_box_level.createConnector(big_box_level, shrinkage)); - hier::BoxContainer visible_mapped_boxes(big_mapped_box_set); + hier::BoxContainer visible_boxes(big_boxes); for (hier::Connector::ConstNeighborhoodIterator mi = big_to_big.begin(); mi != big_to_big.end(); ++mi) { for (hier::Connector::ConstNeighborIterator ni = big_to_big.begin(mi); ni != big_to_big.end(mi); ++ni) { - visible_mapped_boxes.insert(*ni); + visible_boxes.insert(*ni); } } -#if 1 - hier::BoxContainer boundary_boxes = visible_mapped_boxes; -#else - std::map boundary_boxes; - for (hier::BoxContainer::const_iterator si = visible_mapped_boxes.begin(); - si != visible_mapped_boxes.end(); ++si) { - - std::map::iterator bdry_iter = - boundary_boxes.find(si->getBlockId()); - - if (bdry_iter != boundary_boxes.end()) { - bdry_iter->second.pushBack(*si); - } else { - hier::BoxContainer bdry_list(*si); - boundary_boxes.insert( - std::pair(si->getBlockId(), - bdry_list)); - } - - } -#endif + hier::BoxContainer boundary_boxes = visible_boxes; hier::BoxLevelConnectorUtils mblcu; mblcu.computeBoxesAroundBoundary( boundary_boxes, - big_mapped_box_level.getRefinementRatio(), - big_mapped_box_level.getGridGeometry()); + big_box_level.getRefinementRatio(), + big_box_level.getGridGeometry()); -#if 1 tbox::plog << "shrinkBoxLevel: Boundary plain boxes:\n" << boundary_boxes.format("\n", 2); -#else - tbox::plog << "shrinkBoxLevel: Boundary plain boxes:\n"; - for (std::map::iterator mi = boundary_boxes.begin(); - mi != boundary_boxes.end(); ++mi) { - tbox::plog << "Block " << mi->first << '\n'; - for (hier::BoxContainer::iterator bi(mi->second); bi != mi->second.end(); - ++bi) { - tbox::plog << " " << *bi << '\t' << bi->numberCells() << '\n'; - } - } -#endif /* - * Construct the complement of the small_mapped_box_level by + * Construct the complement of the small_box_level by * growing the boundary boxes. */ - hier::BoxContainer complement_mapped_boxes; + hier::BoxContainer complement_boxes; hier::LocalId last_local_id(-1); -#if 1 for (hier::BoxContainer::const_iterator bi = boundary_boxes.begin(); bi != boundary_boxes.end(); ++bi) { hier::Box box(*bi); box.grow(shrinkage); - hier::Box complement_mapped_box( + hier::Box complement_box( box, ++last_local_id, local_rank); - complement_mapped_boxes.insert(complement_mapped_box); - } -#else - for (std::map::iterator mi = boundary_boxes.begin(); - mi != boundary_boxes.end(); ++mi) { - - hier::BlockId block_id(mi->first); - hier::BoxContainer& boundary_for_block(mi->second); - - for (hier::BoxContainer::iterator bi(boundary_for_block); - bi != boundary_for_block.end(); ++bi) { - hier::Box box(*bi); - assert( box.getBlockId() == block_id ); - box.grow(shrinkage); - hier::Box complement_mapped_box( - box, ++last_local_id, local_rank); - complement_mapped_boxes.insert(complement_mapped_box); - } - + complement_boxes.insert(complement_box); } -#endif - complement_mapped_boxes.makeTree(grid_geometry.get()); + complement_boxes.makeTree(grid_geometry.get()); /* - * Construct the small_mapped_box_level. + * Construct the small_box_level. */ - small_mapped_box_level.initialize( - big_mapped_box_level.getRefinementRatio(), - grid_geometry, - big_mapped_box_level.getMPI()); + small_box_level.reset(new hier::BoxLevel( + big_box_level.getRefinementRatio(), + grid_geometry, + big_box_level.getMPI())); last_local_id = -1; - for (hier::BoxContainer::const_iterator bi = big_mapped_box_set.begin(); - bi != big_mapped_box_set.end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = big_boxes.begin(); + bi != big_boxes.end(); ++bi) { - const hier::Box& mapped_box = *bi; + const hier::Box& box = *bi; int ix; - for (ix = 0; ix < unshrunken_blocks.size(); ++ix) { - if (mapped_box.getBlockId() == unshrunken_blocks[ix]) { + for (ix = 0; ix < static_cast(unshrunken_blocks.size()); ++ix) { + if (box.getBlockId() == unshrunken_blocks[ix]) { break; } } - if (ix < unshrunken_blocks.size()) { + if (ix < static_cast(unshrunken_blocks.size())) { /* * This block should be excluded from shrinking. */ - small_mapped_box_level.addBoxWithoutUpdate(mapped_box); + small_box_level->addBoxWithoutUpdate(box); } else { - hier::BoxContainer shrunken_boxes(mapped_box); + hier::BoxContainer shrunken_boxes(box); shrunken_boxes.removeIntersections( - big_mapped_box_level.getRefinementRatio(), - complement_mapped_boxes); + big_box_level.getRefinementRatio(), + complement_boxes); shrunken_boxes.simplify(); - for (hier::BoxContainer::iterator li(shrunken_boxes); + for (hier::BoxContainer::iterator li = shrunken_boxes.begin(); li != shrunken_boxes.end(); ++li) { - const hier::Box shrunken_mapped_box( + const hier::Box shrunken_box( *li, ++last_local_id, - mapped_box.getOwnerRank()); - TBOX_ASSERT(shrunken_mapped_box.getBlockId() == - mapped_box.getBlockId()); + box.getOwnerRank()); + TBOX_ASSERT(shrunken_box.getBlockId() == + box.getBlockId()); - small_mapped_box_level.addBoxWithoutUpdate(shrunken_mapped_box); + small_box_level->addBoxWithoutUpdate(shrunken_box); } } } - small_mapped_box_level.finalize(); + small_box_level->finalize(); } /* *********************************************************************** *********************************************************************** */ -void refineBoxLevel(hier::BoxLevel& mapped_box_level, +void refineBoxLevel(hier::BoxLevel& box_level, const hier::IntVector& ratio) { - mapped_box_level.refineBoxes( - mapped_box_level, - ratio, - mapped_box_level.getRefinementRatio()*ratio); - mapped_box_level.finalize(); - return; + box_level.refineBoxes( + box_level, + ratio, + box_level.getRefinementRatio() * ratio); + box_level.finalize(); } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.2blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.2blk.2d.input index a523a5ca..5ef98dba 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.2blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.2blk.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.2d.input index 61682334..4e53e380 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -33,14 +33,6 @@ GridGeometry { domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.3d.input index ab40638c..5f77f4a7 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -36,14 +36,6 @@ GridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,11) ] domain_boxes_2 = [ (0,0,0) , (20,25,11) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,11)] - sing_box_1 = [(-1,14,0),(-1,14,11)] - sing_box_2 = [(21,-1,0),(21,-1,11)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk2.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk2.2d.input index 2f00b00a..5ed525bf 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk2.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blk2.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -36,14 +36,6 @@ GridGeometry { domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blkb.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blkb.2d.input index a42dc0d5..a94e695e 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blkb.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blkb.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -62,7 +62,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 21,14 point_in_b_space = 20,0 - // is_singularity = TRUE } } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blku.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blku.2d.input index 1e49a3c5..8fe99afd 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blku.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.3blku.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -40,14 +40,6 @@ GridGeometry { domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -67,4 +59,13 @@ GridGeometry { } + BlockNeighbors2 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + } + } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blk.3d.input index 7053ea0a..cea79776 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blk.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -39,47 +39,6 @@ GridGeometry { domain_boxes_2 = [ (0,0,0) , (14,14,14) ] domain_boxes_3 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity3 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity4 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -138,6 +97,6 @@ GridGeometry { } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blktrivial.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blktrivial.3d.input index 59d386b9..dc0f5560 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blktrivial.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.4blktrivial.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -42,15 +42,6 @@ GridGeometry { domain_boxes_2 = [ (0,0,0) , (14,9,7) ] domain_boxes_3 = [ (0,0,0) , (19,9,7) ] - Singularity0 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,10,0),(15,10,7)] - sing_box_1 = [(-1,10,0),(-1,10,7)] - sing_box_2 = [(15,-1,0),(15,-1,7)] - sing_box_3 = [(-1,-1,0),(-1,-1,7)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.2d.input index bea80dcc..caa5c1a4 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -35,16 +35,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -61,7 +51,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -71,7 +60,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -101,7 +89,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -111,7 +98,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -131,7 +117,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.3d.input index f0c598f4..3a696640 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -38,16 +38,6 @@ GridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,7) ] domain_boxes_4 = [ (0,0,0) , (19,19,7) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,7)] - sing_box_1 = [(20,20,0),(20,20,7)] - sing_box_2 = [(20,-1,0),(20,-1,7)] - sing_box_3 = [(-1,-1,0),(-1,-1,7)] - sing_box_4 = [(-1,20,0),(-1,20,7)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -64,7 +54,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -74,7 +63,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -104,7 +92,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -114,7 +101,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -134,7 +120,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk2.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk2.2d.input index af8580b9..920ff0c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk2.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blk2.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -38,16 +38,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -64,7 +54,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -74,7 +63,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -104,7 +92,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -114,7 +101,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -134,7 +120,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blkb.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blkb.2d.input index c27b3be8..5476a8b8 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blkb.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blkb.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -39,16 +39,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -65,7 +55,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -75,7 +64,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } /* @@ -107,7 +95,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors5 { @@ -117,7 +104,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors6 { @@ -137,7 +123,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors8 { diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blku.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blku.2d.input index 1ae99bda..fa0eb41a 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blku.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.5blku.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -42,16 +42,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -68,7 +58,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -78,7 +67,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } /* @@ -110,7 +98,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors5 { @@ -120,7 +107,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors6 { @@ -140,7 +126,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors8 { diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.2d.input index b70b5439..66c9b975 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -36,23 +36,6 @@ GridGeometry { domain_boxes_4 = [ (0,0) , ( 9, 9) ] domain_boxes_5 = [ (0,0) , ( 9,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(-1,10),(-1,10)] - sing_box_1 = [(-1,-1),(-1,-1)] - sing_box_2 = [(15,10),(15,10)] - } - - Singularity1 { - blocks = 0,1,3,4,5 - - sing_box_0 = [(10,10),(10,10)] - sing_box_1 = [(10,-1),(10,-1)] - sing_box_3 = [(-1,-10),(-1,10)] - sing_box_4 = [(-1,-1),(-1,-1)] - sing_box_5 = [(-1,-1),(-1,-1)] - } BlockNeighbors0 { block_a = 0 @@ -125,7 +108,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 9,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors8 { @@ -135,7 +117,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 9,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors9 { @@ -145,7 +126,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 0,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors10 { @@ -155,7 +135,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 0,9 point_in_b_space = 10,-1 - is_singularity = TRUE } BlockNeighbors11 { @@ -165,7 +144,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = -1,-1 point_in_b_space = 9,0 - is_singularity = TRUE } } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.3d.input index 1ca9b783..09e0e92f 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -43,139 +43,6 @@ GridGeometry { domain_boxes_4 = [ (0,0,0) , (14,14,14) ] domain_boxes_5 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity7 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity8 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity9 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity10 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity11 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity12 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity13 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity14 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity15 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - BlockNeighbors0 { block_a = 0 diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk2.2d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk2.2d.input index 4ebef3ce..6bbf11c3 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk2.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.6blk2.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ @@ -39,24 +39,6 @@ GridGeometry { domain_boxes_4 = [ (0,0) , ( 9, 9) ] domain_boxes_5 = [ (0,0) , ( 9,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(-1,10),(-1,10)] - sing_box_1 = [(-1,-1),(-1,-1)] - sing_box_2 = [(15,10),(15,10)] - } - - Singularity1 { - blocks = 0,1,3,4,5 - - sing_box_0 = [(10,10),(10,10)] - sing_box_1 = [(10,-1),(10,-1)] - sing_box_3 = [(-1,10),(-1,10)] - sing_box_4 = [(-1,-1),(-1,-1)] - sing_box_5 = [(-1,-1),(-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -128,7 +110,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 9,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors8 { @@ -138,7 +119,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 9,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors9 { @@ -148,7 +128,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 0,9 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors10 { @@ -158,7 +137,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 0,9 point_in_b_space = 10,-1 - is_singularity = TRUE } BlockNeighbors11 { @@ -168,7 +146,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = -1,-1 point_in_b_space = 9,0 - is_singularity = TRUE } } diff --git a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.7blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.7blk.3d.input index 64680a7a..b1ea0347 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.7blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests/test_inputs/mblcu.7blk.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ @@ -44,239 +44,6 @@ GridGeometry { domain_boxes_5 = [ (0,0,0) , (14,14,14) ] domain_boxes_6 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,1,6 - - sing_box_0 = [(-1,15,0),(-1,15,14)] - sing_box_1 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity7 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity8 { - blocks = 0,3,6 - - sing_box_0 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,15),(14,-1,15)] - } - - Singularity9 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity10 { - blocks = 0,4,6 - - sing_box_0 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity11 { - blocks = 0,5,6 - - sing_box_0 = [(-1,-1,0),(-1,-1,14)] - sing_box_5 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity12 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity13 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity14 { - blocks = 1,3,6 - - sing_box_1 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(15,0,15),(15,14,15)] - } - - Singularity15 { - blocks = 1,4,6 - - sing_box_1 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(15,0,-1),(15,14,-1)] - } - - Singularity16 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity17 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity18 { - blocks = 3,5,6 - - sing_box_3 = [(-1,0,15),(-1,14,15)] - sing_box_5 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(-1,0,15),(-1,14,15)] - } - - Singularity19 { - blocks = 4,5,6 - - sing_box_4 = [(-1,0,-1),(-1,14,-1)] - sing_box_5 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(-1,0,-1),(-1,14,-1)] - } - - Singularity20 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity21 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity22 { - blocks = 0,1,3,6 - - sing_box_0 = [(-1,15,15),(-1,15,15)] - sing_box_1 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(15,-1,15),(15,-1,15)] - } - - Singularity23 { - blocks = 0,1,4,6 - - sing_box_0 = [(-1,15,-1),(-1,15,-1)] - sing_box_1 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity24 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity25 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - Singularity26 { - blocks = 0,3,5,6 - - sing_box_0 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,15),(-1,-1,15)] - sing_box_5 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(-1,-1,15),(-1,-1,15)] - } - - Singularity27 { - blocks = 0,4,5,6 - - sing_box_0 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_5 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(-1,-1,-1),(-1,-1,-1)] - } - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -431,4 +198,12 @@ GridGeometry { point_in_b_space = -1,0,14 } + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } } diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.depend index 45b68b9e..de410b6b 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -36,6 +36,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -50,37 +51,27 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -92,34 +83,23 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-modify.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.in b/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.in index 8a781ada..2e6397f3 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the MultiblockMappedBoxTree tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/MappingConnector -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -24,14 +25,26 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" main: main-modify.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-modify.o $(LIBSAMRAI) $(LDLIBS) -o $@ -check: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/modify.3blk.2d.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/modify.5blk.2d.input +check: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/modify.3blk.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/modify.5blk.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -42,13 +55,26 @@ check3d: checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/README b/base/SAMRAI/SAMRAI/source/test/MappingConnector/README new file mode 100644 index 00000000..548fdd6f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/README @@ -0,0 +1,38 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of MappingConnector operations +## +######################################################################### + +This is a unit test of the modify method in MappingConnector. +The files included in this directory are as follows: + + main-modify.C - complete code for the unit test + test_inputs/*.input - 2d input files for 3 block and 5 block configurations + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files: + test_inputs/modify.3blk.2d.input + test_inputs/modify.5blk.2d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/modify.3blk.2d.input for a full description of all +input parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/main-modify.C b/base/SAMRAI/SAMRAI/source/test/MappingConnector/main-modify.C index ec9723d2..df922361 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappingConnector/main-modify.C +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/main-modify.C @@ -3,13 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for performance of tree search algorithm. * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Connector.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/BoxLevel.h" @@ -17,6 +16,7 @@ #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/geom/GridGeometry.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/HDFDatabase.h" @@ -38,21 +38,20 @@ using namespace tbox; * The database may have the following items: min_box_size, * max_box_size, refinement_ratio. * - * The mapped_box_level will be refined by refinement_ratio and + * The box_level will be refined by refinement_ratio and * partitioned to generate a non-trivial configuration for testing. */ void breakUpBoxes( - hier::BoxLevel& mapped_box_level, - const hier::BoxLevel& domain_mapped_box_level, + hier::BoxLevel& box_level, + const hier::BoxLevel& domain_box_level, const boost::shared_ptr& database); void alterAndGenerateMapping( - hier::BoxLevel& mapped_box_level_c, - hier::Connector& b_to_c, - hier::Connector& c_to_b, - const hier::BoxLevel& mapped_box_level_b, + boost::shared_ptr& box_level_c, + boost::shared_ptr& b_to_c, + const hier::BoxLevel& box_level_b, const boost::shared_ptr& database); /* @@ -92,7 +91,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); size_t fail_count = 0; { @@ -157,7 +155,7 @@ int main( TBOX_ERROR("Multiblock tree search test: could not find entry GridGeometry" << "\nin input."); } - boost::shared_ptr grid_geometry( + boost::shared_ptr grid_geometry( new geom::GridGeometry( dim, "GridGeometry", @@ -172,35 +170,45 @@ int main( const hier::IntVector& one_vector(hier::IntVector::getOne(dim)); const hier::IntVector& zero_vector(hier::IntVector::getZero(dim)); - hier::BoxLevel domain_mapped_box_level( + hier::BoxLevel domain_box_level( one_vector, grid_geometry, tbox::SAMRAI_MPI::getSAMRAIWorld(), hier::BoxLevel::GLOBALIZED); grid_geometry->computePhysicalDomain( - domain_mapped_box_level, - hier::IntVector::getOne(dim)); - domain_mapped_box_level.finalize(); + domain_box_level, + one_vector); + domain_box_level.finalize(); + + std::vector refinement_ratios( + 1, domain_box_level.getRefinementRatio()); /* * Generate BoxLevel A from the multiblock domain description * using input database BoxLevelA. */ - hier::BoxLevel mapped_box_level_a(domain_mapped_box_level); + hier::BoxLevel box_level_a(domain_box_level); boost::shared_ptr a_db(main_db->getDatabase("BoxLevelA")); - breakUpBoxes(mapped_box_level_a, domain_mapped_box_level, a_db); - mapped_box_level_a.cacheGlobalReducedData(); - // tbox::pout << "mapped box level a:\n" << mapped_box_level_a.format("A: ",2) << std::endl; + breakUpBoxes(box_level_a, domain_box_level, a_db); + box_level_a.cacheGlobalReducedData(); + refinement_ratios.push_back(box_level_a.getRefinementRatio()); /* * Generate BoxLevel B from the multiblock domain description * using input database BoxLevelB. */ - hier::BoxLevel mapped_box_level_b(domain_mapped_box_level); + hier::BoxLevel box_level_b(domain_box_level); boost::shared_ptr b_db(main_db->getDatabase("BoxLevelB")); - breakUpBoxes(mapped_box_level_b, domain_mapped_box_level, b_db); - mapped_box_level_b.cacheGlobalReducedData(); - // tbox::pout << "mapped box level b:\n" << mapped_box_level_b.format("B: ",2) << std::endl; + breakUpBoxes(box_level_b, domain_box_level, b_db); + box_level_b.cacheGlobalReducedData(); + refinement_ratios.push_back(box_level_b.getRefinementRatio() / + box_level_a.getRefinementRatio()); + + /* + * These steps are usually handled by PatchHierarchy, but this + * test does not use PatchHierarchy. + */ + grid_geometry->setUpRatios(refinement_ratios); /* * Generate Connector A<==>B, to be modified by the mapping @@ -208,89 +216,86 @@ int main( */ hier::IntVector base_width_a(zero_vector); - hier::IntVector base_width_b(zero_vector); if (main_db->isInteger("base_width_a")) { main_db->getIntegerArray("base_width_a", &base_width_a[0], dim.getValue()); } - base_width_b = hier::Connector::convertHeadWidthToBase( - mapped_box_level_b.getRefinementRatio(), - mapped_box_level_a.getRefinementRatio(), - base_width_a); - - hier::Connector a_to_b(mapped_box_level_a, - mapped_box_level_b, - base_width_a); - hier::Connector b_to_a(mapped_box_level_b, - mapped_box_level_a, - base_width_b); + hier::IntVector width_a(base_width_a); + hier::IntVector width_b( + hier::Connector::convertHeadWidthToBase( + box_level_b.getRefinementRatio(), + box_level_a.getRefinementRatio(), + width_a)); + + boost::shared_ptr a_to_b; hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(a_to_b); - oca.findOverlaps(b_to_a); - // tbox::pout << "a_to_b:\n" << a_to_b.format("AB: ",2) << std::endl; + oca.findOverlapsWithTranspose(a_to_b, + box_level_a, + box_level_b, + width_a, + width_b); + hier::Connector& b_to_a = a_to_b->getTranspose(); + // tbox::pout << "a_to_b:\n" << a_to_b->format("AB: ",2) << std::endl; // tbox::pout << "b_to_a:\n" << b_to_a.format("BA: ",2) << std::endl; - a_to_b.checkConsistencyWithBase(); - a_to_b.checkConsistencyWithHead(); + a_to_b->checkConsistencyWithBase(); + a_to_b->checkConsistencyWithHead(); b_to_a.checkConsistencyWithBase(); b_to_a.checkConsistencyWithHead(); - oca.checkOverlapCorrectness(b_to_a); - oca.checkOverlapCorrectness(b_to_a); + a_to_b->checkOverlapCorrectness(); + b_to_a.checkOverlapCorrectness(); /* * Generate BoxLevel C by altering B based on a simple formula. * Generate the mapping Connectors B<==>C. */ - hier::BoxLevel mapped_box_level_c(dim); - hier::Connector b_to_c, c_to_b; + boost::shared_ptr box_level_c; + boost::shared_ptr b_to_c; boost::shared_ptr alteration_db( main_db->getDatabase("Alteration")); alterAndGenerateMapping( - mapped_box_level_c, + box_level_c, b_to_c, - c_to_b, - mapped_box_level_b, + box_level_b, alteration_db); - mapped_box_level_c.cacheGlobalReducedData(); - // tbox::pout << "mapped box level c:\n" << mapped_box_level_c.format("C: ",2) << std::endl; - // tbox::pout << "b_to_c:\n" << b_to_c.format("BC: ",2) << std::endl; - // tbox::pout << "c_to_b:\n" << c_to_b.format("CB: ",2) << std::endl; + box_level_c->cacheGlobalReducedData(); + // tbox::pout << "box level c:\n" << box_level_c->format("C: ",2) << std::endl; + // tbox::pout << "b_to_c:\n" << b_to_c->format("BC: ",2) << std::endl; + // tbox::pout << "c_to_b:\n" << b_to_c->getTranspose().format("CB: ",2) << std::endl; hier::MappingConnectorAlgorithm mca; - mca.modify(a_to_b, - b_to_a, - b_to_c, - c_to_b, - &mapped_box_level_b, - &mapped_box_level_c); - // tbox::pout << "mapped box level b after modify:\n" << mapped_box_level_b.format("B: ",2) << std::endl; + mca.modify(*a_to_b, + *b_to_c, + &box_level_b, + box_level_c.get()); + // tbox::pout << "box level b after modify:\n" << box_level_b.format("B: ",2) << std::endl; // tbox::pout << "checking a--->b consistency with base:" << std::endl; - a_to_b.checkConsistencyWithBase(); + a_to_b->checkConsistencyWithBase(); // tbox::pout << "checking a--->b consistency with head:" << std::endl; - a_to_b.checkConsistencyWithHead(); + a_to_b->checkConsistencyWithHead(); // tbox::pout << "checking b--->a consistency with base:" << std::endl; b_to_a.checkConsistencyWithBase(); // tbox::pout << "checking b--->a consistency with head:" << std::endl; b_to_a.checkConsistencyWithHead(); - tbox::pout << "Checking for a--->b errors:" << std::endl; - const int a_to_b_errors = oca.checkOverlapCorrectness(a_to_b); + tbox::pout << "Checking for a--->b overlap correctness:" << std::endl; + const int a_to_b_errors = a_to_b->checkOverlapCorrectness(); if (a_to_b_errors) { tbox::pout << "... " << a_to_b_errors << " errors." << std::endl; } else { - tbox::pout << "... none." << std::endl; + tbox::pout << "... OK." << std::endl; } - tbox::pout << "Checking for b--->a errors:" << std::endl; - const int b_to_a_errors = oca.checkOverlapCorrectness(b_to_a); + tbox::pout << "Checking for b--->a overlap correctness:" << std::endl; + const int b_to_a_errors = b_to_a.checkOverlapCorrectness(); if (b_to_a_errors) { tbox::pout << "... " << b_to_a_errors << " errors." << std::endl; } else { - tbox::pout << "... none." << std::endl; + tbox::pout << "... OK." << std::endl; } fail_count += a_to_b_errors + b_to_a_errors; @@ -314,17 +319,8 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - tbox::pout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - tbox::plog << "Process " << std::setw(5) << rank << " exiting." << std::endl; return int(fail_count); } @@ -337,11 +333,11 @@ int main( * 2. Partition according to min and max box sizes in the database. */ void breakUpBoxes( - hier::BoxLevel& mapped_box_level, - const hier::BoxLevel& domain_mapped_box_level, + hier::BoxLevel& box_level, + const hier::BoxLevel& domain_box_level, const boost::shared_ptr& database) { - const tbox::Dimension& dim(mapped_box_level.getDim()); + const tbox::Dimension& dim(box_level.getDim()); hier::IntVector refinement_ratio(hier::IntVector::getOne(dim)); if (database->isInteger("refinement_ratio")) { @@ -349,10 +345,10 @@ void breakUpBoxes( } if (refinement_ratio != hier::IntVector::getOne(dim)) { - mapped_box_level.refineBoxes(mapped_box_level, + box_level.refineBoxes(box_level, refinement_ratio, - mapped_box_level.getRefinementRatio()*refinement_ratio); - mapped_box_level.finalize(); + box_level.getRefinementRatio() * refinement_ratio); + box_level.finalize(); } hier::IntVector max_box_size(dim, tbox::MathUtilities::getMax()); @@ -365,26 +361,24 @@ void breakUpBoxes( database->getIntegerArray("min_box_size", &min_box_size[0], dim.getValue()); } - mesh::TreeLoadBalancer load_balancer(mapped_box_level.getDim()); + mesh::TreeLoadBalancer load_balancer(box_level.getDim(), + "TreeLoadBalancer"); const int level_number(0); - hier::Connector dummy_connector; + hier::Connector* dummy_connector = 0; - const hier::IntVector bad_interval(dim, 1); - const hier::IntVector cut_factor(dim, 1); + const hier::IntVector bad_interval(hier::IntVector::getOne(dim)); + const hier::IntVector cut_factor(hier::IntVector::getOne(dim)); load_balancer.loadBalanceBoxLevel( - mapped_box_level, - dummy_connector, + box_level, dummy_connector, boost::shared_ptr(), level_number, - dummy_connector, - dummy_connector, min_box_size, max_box_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor); } @@ -394,13 +388,12 @@ void breakUpBoxes( * Generate the mapping Connectors B<==>C. */ void alterAndGenerateMapping( - hier::BoxLevel& mapped_box_level_c, - hier::Connector& b_to_c, - hier::Connector& c_to_b, - const hier::BoxLevel& mapped_box_level_b, + boost::shared_ptr& box_level_c, + boost::shared_ptr& b_to_c, + const hier::BoxLevel& box_level_b, const boost::shared_ptr& database) { - const tbox::Dimension dim(mapped_box_level_b.getDim()); + const tbox::Dimension dim(box_level_b.getDim()); /* * Increment for changing the LocalIds. @@ -409,40 +402,39 @@ void alterAndGenerateMapping( const int local_id_increment = database->getIntegerWithDefault("local_id_increment", 0); - const hier::BoxContainer mapped_boxes_b(mapped_box_level_b.getBoxes()); - - mapped_box_level_c.initialize(mapped_box_level_b.getRefinementRatio(), - mapped_box_level_b.getGridGeometry(), - mapped_box_level_b.getMPI()); - - b_to_c.setConnectorType(hier::Connector::MAPPING); - b_to_c.setBase(mapped_box_level_b); - b_to_c.setHead(mapped_box_level_c); - b_to_c.setWidth(hier::IntVector::getZero(dim), true); - c_to_b.setConnectorType(hier::Connector::MAPPING); - c_to_b.setBase(mapped_box_level_c); - c_to_b.setHead(mapped_box_level_b); - c_to_b.setWidth(hier::IntVector::getZero(dim), true); - for (hier::BoxContainer::const_iterator bi = mapped_boxes_b.begin(); - bi != mapped_boxes_b.end(); ++bi) { - const hier::Box& mapped_box_b(*bi); - hier::Box mapped_box_c(mapped_box_b, - mapped_box_b.getLocalId() + local_id_increment, - mapped_box_b.getOwnerRank(), - mapped_box_b.getPeriodicId()); - mapped_box_level_c.addBoxWithoutUpdate(mapped_box_c); - b_to_c.insertLocalNeighbor(mapped_box_c, mapped_box_b.getId()); - c_to_b.insertLocalNeighbor(mapped_box_b, mapped_box_c.getId()); + const hier::BoxContainer boxes_b(box_level_b.getBoxes()); + + box_level_c.reset(new hier::BoxLevel(box_level_b.getRefinementRatio(), + box_level_b.getGridGeometry(), + box_level_b.getMPI())); + + b_to_c.reset(new hier::MappingConnector(box_level_b, + *box_level_c, + hier::IntVector::getZero(dim))); + hier::MappingConnector* c_to_b = + new hier::MappingConnector(*box_level_c, + box_level_b, + hier::IntVector::getZero(dim)); + b_to_c->setTranspose(c_to_b, true); + for (hier::BoxContainer::const_iterator bi = boxes_b.begin(); + bi != boxes_b.end(); ++bi) { + const hier::Box& box_b(*bi); + hier::Box box_c(box_b, + box_b.getLocalId() + local_id_increment, + box_b.getOwnerRank(), + box_b.getPeriodicId()); + box_level_c->addBoxWithoutUpdate(box_c); + b_to_c->insertLocalNeighbor(box_c, box_b.getBoxId()); + c_to_b->insertLocalNeighbor(box_b, box_c.getBoxId()); } - mapped_box_level_c.finalize(); + box_level_c->finalize(); - b_to_c.checkConsistencyWithBase(); - b_to_c.checkConsistencyWithHead(); - c_to_b.checkConsistencyWithBase(); - c_to_b.checkConsistencyWithHead(); + b_to_c->checkConsistencyWithBase(); + b_to_c->checkConsistencyWithHead(); + c_to_b->checkConsistencyWithBase(); + c_to_b->checkConsistencyWithHead(); - hier::MappingConnectorAlgorithm mca; - mca.assertMappingValidity(b_to_c); - mca.assertMappingValidity(c_to_b); + b_to_c->assertMappingValidity(); + c_to_b->assertMappingValidity(); } diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.3blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.3blk.2d.input index 5cf0e1f2..fec90edf 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.3blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.3blk.2d.input @@ -3,80 +3,98 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ Main { - dim = 2 -// -// Log file information -// - base_name = "modify.3blk.2d" - log_all_nodes = TRUE - -base_width_a = 0,0 // Connector width in index space of A - -GridGeometry { - num_blocks = 3 - domain_boxes_0 = [ (0,0) , (20,13) ] - domain_boxes_1 = [ (0,0) , (25,13) ] - domain_boxes_2 = [ (0,0) , (20,25) ] - - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { - block_a = 0 - block_b = 1 + // Dimension of problem. No default. + dim = 2 - rotation_b_to_a = "I_UP", "J_UP" - point_in_a_space = 21,0 - point_in_b_space = 0,0 - } + // Base name of log and viz files. Default is "unnamed". + base_name = "modify.3blk.2d" - BlockNeighbors1 { - block_a = 0 - block_b = 2 + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. + log_all_nodes = TRUE - rotation_b_to_a = "I_UP", "J_UP" - point_in_a_space = 0,14 - point_in_b_space = 0,0 + // Connector width for the MappingConnector that will be build and tested. + // Expressed in the resolution of the base level of the Connector. + // Integer vector of size dim, default is 0 in all directions + base_width_a = 0,0 - } + // Refer to geom::CartesianGridGeometry and its base classes for input + GridGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 - BlockNeighbors2 { - block_a = 1 - block_b = 2 + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 - rotation_b_to_a = "J_UP", "I_DOWN" - point_in_a_space = 0,14 - point_in_b_space = 20,0 + } } -} + // Parameters for BoxLevel "A", the base level for the MappingConnector that + // will be tested. + BoxLevelA { + // Refinement ratio to this level from the physical domain description. + // Default is 1 in all directions + refinement_ratio = 3,3 -BoxLevelA { - refinement_ratio = 3,3 // Refinement of the domain description to get this level. - min_box_size = 1,1 - max_box_size = 90,110 -} + // Minimum box size allowed when this level is decomposed by the load + // balancer. Default is 1 in all directions. + min_box_size = 1,1 -BoxLevelB { - refinement_ratio = 6,6 // Refinement of the domain description to get this level. - min_box_size = 1,1 - max_box_size = 80,100 -} + // Maximum box size allowed when this level is decomposed by the load + // balance. Default is INT_MAX in all directions. + max_box_size = 90,110 + } -Alteration { - local_id_increment = 1000 // Increase all LocalIds by this amount. -} + // Parameters for BoxLevel "B", the head level for the MappingConnector that + // will be tested. Input parameters are the same as those for BoxLevelA. + BoxLevelB { + refinement_ratio = 6,6 + min_box_size = 1,1 + max_box_size = 80,100 + } + + // Parameters describing alterations to a BoxLevel that will be + // changed by the modify method. + Alteration { + // Increment all LocalIds by this value. + // Default is zero, which means there will be no alteration. + local_id_increment = 1000 + } + } diff --git a/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.5blk.2d.input b/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.5blk.2d.input index 7de7cbf7..ce9b3aff 100644 --- a/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.5blk.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/MappingConnector/test_inputs/modify.5blk.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing Connector modify algorithm. * ************************************************************************/ +// See modify.3blk.2d.input for description of the input parameters specific +// to this test. + Main { dim = 2 // @@ -26,16 +29,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -52,7 +45,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -62,7 +54,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -92,7 +83,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -102,7 +92,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -122,7 +111,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/GeomUtilsAMR.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/GeomUtilsAMR.h deleted file mode 100644 index 1315efd6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/GeomUtilsAMR.h +++ /dev/null @@ -1,353 +0,0 @@ -/************************************************************************** - * Module: GeomUtilsAMR - * Purpose: inline functions for the ale3d amr apps - ***************************************************************************/ - -#ifndef __GeomUtilsAMR_h -#define __GeomUtilsAMR_h - -// -// calculate the volume of a hexahedral element -// -real8 -UpwindVolume( - const real8 x0, - const real8 x1, - const real8 x2, - const real8 x3, - const real8 x4, - const real8 x5, - const real8 x6, - const real8 x7, - const real8 y0, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 y4, - const real8 y5, - const real8 y6, - const real8 y7, - const real8 z0, - const real8 z1, - const real8 z2, - const real8 z3, - const real8 z4, - const real8 z5, - const real8 z6, - const real8 z7) -{ - const real8 twelfth = 1.0 / 12.0; - real8 volume, s1234, s5678, s1265, s4378, s2376, s1485; - - s1234 = - (x1 + x2) * ((y0 + y1) * (z2 + z3) - (z0 + z1) * (y2 + y3)) - + (y1 + y2) * ((z0 + z1) * (x2 + x3) - (x0 + x1) * (z2 + z3)) - + (z1 + z2) * ((x0 + x1) * (y2 + y3) - (y0 + y1) * (x2 + x3)); - - s5678 = - (x5 + x6) * ((y4 + y5) * (z6 + z7) - (z4 + z5) * (y6 + y7)) - + (y5 + y6) * ((z4 + z5) * (x6 + x7) - (x4 + x5) * (z6 + z7)) - + (z5 + z6) * ((x4 + x5) * (y6 + y7) - (y4 + y5) * (x6 + x7)); - - s1265 = - (x1 + x5) * ((y0 + y1) * (z5 + z4) - (z0 + z1) * (y5 + y4)) - + (y1 + y5) * ((z0 + z1) * (x5 + x4) - (x0 + x1) * (z5 + z4)) - + (z1 + z5) * ((x0 + x1) * (y5 + y4) - (y0 + y1) * (x5 + x4)); - - s4378 = - (x2 + x6) * ((y3 + y2) * (z6 + z7) - (z3 + z2) * (y6 + y7)) - + (y2 + y6) * ((z3 + z2) * (x6 + x7) - (x3 + x2) * (z6 + z7)) - + (z2 + z6) * ((x3 + x2) * (y6 + y7) - (y3 + y2) * (x6 + x7)); - - s2376 = - (x2 + x6) * ((y1 + y2) * (z6 + z5) - (z1 + z2) * (y6 + y5)) - + (y2 + y6) * ((z1 + z2) * (x6 + x5) - (x1 + x2) * (z6 + z5)) - + (z2 + z6) * ((x1 + x2) * (y6 + y5) - (y1 + y2) * (x6 + x5)); - - s1485 = - (x3 + x7) * ((y0 + y3) * (z7 + z4) - (z0 + z3) * (y7 + y4)) - + (y3 + y7) * ((z0 + z3) * (x7 + x4) - (x0 + x3) * (z7 + z4)) - + (z3 + z7) * ((x0 + x3) * (y7 + y4) - (y0 + y3) * (x7 + x4)); - - volume = (s1234 - s5678 - s1265 + s4378 - s2376 + s1485) * twelfth; - return volume; -} - -// -// compute the area of a face -// -real8 -UpwindAreaFace( - const real8 x0, - const real8 x1, - const real8 x2, - const real8 x3, - const real8 y0, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 z0, - const real8 z1, - const real8 z2, - const real8 z3) -{ - real8 fx = (x2 - x0) - (x3 - x1); - real8 fy = (y2 - y0) - (y3 - y1); - real8 fz = (z2 - z0) - (z3 - z1); - real8 gx = (x2 - x0) + (x3 - x1); - real8 gy = (y2 - y0) + (y3 - y1); - real8 gz = (z2 - z0) + (z3 - z1); - real8 area = - (fx * fx + fy * fy + fz * fz) - * (gx * gx + gy * gy + gz * gz) - - (fx * gx + fy * gy + fz * gz) - * (fx * gx + fy * gy + fz * gz); - return area; -} - -// -// compute a characteristic length -// -real8 -UpwindCharacteristicLength( - const real8 x[8], - const real8 y[8], - const real8 z[8], - const real8 volume) -{ - real8 a, charLength = 0.0; - - a = UpwindAreaFace(x[0], x[1], x[2], x[3], - y[0], y[1], y[2], y[3], - z[0], z[1], z[2], z[3]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[4], x[5], x[6], x[7], - y[4], y[5], y[6], y[7], - z[4], z[5], z[6], z[7]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[0], x[1], x[5], x[4], - y[0], y[1], y[5], y[4], - z[0], z[1], z[5], z[4]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[1], x[2], x[6], x[5], - y[1], y[2], y[6], y[5], - z[1], z[2], z[6], z[5]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[2], x[3], x[7], x[6], - y[2], y[3], y[7], y[6], - z[2], z[3], z[7], z[6]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[3], x[0], x[4], x[7], - y[3], y[0], y[4], y[7], - z[3], z[0], z[4], z[7]); - charLength = MAX(a, charLength); - - charLength = 4.0 * volume / sqrt(charLength); - - return charLength; -} - -/// -/// the non-uniform grid monotonic slope finder -/// -void -my_slopes( - double psi, - double pim, - double pip, - double pjm, - double pjp, - double pkm, - double pkp, - double w_i, - double w_ip, - double w_im, - double w_jp, - double w_jm, - double w_kp, - double w_km, - double& pxi, - double& peta, - double& pzeta) -{ - real8 sumf, sumb; - real8 elDenm, elDenp, del, sfp, sbm, scale; - - real8 elDenC = psi; - real8 scale_fact = 1.0; - real8 slope_fact = 1.0; - - // - // compute weight functions - // - real8 volzrc = w_i; - - real8 volzrxim = w_im; - real8 volzrxip = w_ip; - real8 volzretam = w_jm; - real8 volzretap = w_jp; - real8 volzrzetam = w_km; - real8 volzrzetap = w_kp; - - sumf = volzrc + volzrxip; - sumb = volzrc + volzrxim; - real8 wgtxi1 = volzrc / sumf; - real8 wgtxi2 = volzrxip / sumf; - real8 wgtxi3 = volzrc / sumb; - real8 wgtxi4 = volzrxim / sumb; - - sumf = volzrc + volzretap; - sumb = volzrc + volzretam; - real8 wgteta1 = volzrc / sumf; - real8 wgteta2 = volzretap / sumf; - real8 wgteta3 = volzrc / sumb; - real8 wgteta4 = volzretam / sumb; - - sumf = volzrc + volzrzetap; - sumb = volzrc + volzrzetam; - real8 wgtzeta1 = volzrc / sumf; - real8 wgtzeta2 = volzrzetap / sumf; - real8 wgtzeta3 = volzrc / sumb; - real8 wgtzeta4 = volzrzetam / sumb; - - elDenm = pim; - elDenp = pip; - - del = (wgtxi2 * elDenp + wgtxi1 * elDenC - - wgtxi4 * elDenm - wgtxi3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - pxi = slope_fact * del * scale; - - // --------------------------------- eta - - elDenm = pjm; - elDenp = pjp; - - del = (wgteta2 * elDenp + wgteta1 * elDenC - - wgteta4 * elDenm - wgteta3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - peta = slope_fact * del * scale; - - // --------------------------------- zeta - - elDenm = pkm; - elDenp = pkp; - - del = (wgtzeta2 * elDenp + wgtzeta1 * elDenC - - wgtzeta4 * elDenm - wgtzeta3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - pzeta = slope_fact * del * scale; -} - -/// -/// the cartesian uniform grid monotonic slope finder -/// -void -my_slopesCart( - double psi, - double pim, - double pip, - double pjm, - double pjp, - double pkm, - double pkp, - double& pxi, - double& peta, - double& pzeta) -{ - real8 del, sfp, sbm, scale; - real8 elDenp, elDenC, elDenm; - real8 sfact = 0.25; // due to the fact that xi ranges from -1 to 1 - elDenC = psi; - - // - // xi - // - elDenp = pip; - elDenm = pim; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - pxi = del * scale; // xi, eta, zeta vary from -1 to 1 - - // - // eta - // - elDenp = pjp; - elDenm = pjm; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - peta = del * scale; - - // - // eta - // - elDenp = pkp; - elDenm = pkm; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - pzeta = del * scale; -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.depend index d177a824..429bf7b6 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -51,12 +51,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -97,7 +99,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -116,8 +117,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -139,11 +140,13 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h GeomUtilsAMR.h \ - MblkEuler.C MblkEuler.h MblkGeometry.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/GeomUtilsAMR.h \ + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h MblkEuler.C \ + MblkEuler.h MblkGeometry.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -162,12 +165,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=MblkGeometry.o DEPENDS_1:=\ @@ -193,6 +195,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -212,7 +215,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -225,16 +227,15 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MblkGeometry.C \ MblkGeometry.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -242,377 +243,42 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=MblkHyperbolicLevelIntegrator.o +${FILE_1}: ${DEPENDS_1} + +FILE_2=bc_common.o DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.C MblkHyperbolicLevelIntegrator.h \ - MblkHyperbolicPatchStrategy.h + $(OBJECT)/include/SAMRAI/SAMRAI_config.h bc_common.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif + -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=MblkHyperbolicPatchStrategy.o +${FILE_2}: ${DEPENDS_2} + +FILE_3=boundaryconditions.o DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicPatchStrategy.C MblkHyperbolicPatchStrategy.h + $(OBJECT)/include/SAMRAI/SAMRAI_config.h boundaryconditions.f -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} - -FILE_4=Pointer-MblkHyperbolicLevelIntegrator.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - Pointer-MblkHyperbolicLevelIntegrator.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} - -FILE_5=bc_common.o -DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h bc_common.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=boundaryconditions.o -DEPENDS_6:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h boundaryconditions.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - -endif +${FILE_3}: ${DEPENDS_3} -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} - -FILE_7=main.o -DEPENDS_7:=\ +FILE_4=main.o +DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -622,6 +288,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -633,7 +300,10 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -645,18 +315,17 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -664,11 +333,12 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -702,12 +372,12 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -722,9 +392,10 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -748,14 +419,13 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h MblkEuler.h \ - MblkGeometry.h MblkHyperbolicLevelIntegrator.h \ - MblkHyperbolicPatchStrategy.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h MblkEuler.h \ + MblkGeometry.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ +DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -773,32 +443,9 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=skelbdry.o -DEPENDS_8:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h skelbdry.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ - -endif - -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} - -FILE_9=upfluxsum.o -DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h upfluxsum.f - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} +${FILE_4}: ${DEPENDS_4} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.in b/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.in index fd5a4ff9..d0e405f8 100755 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for multiblock sample application ## ######################################################################### @@ -14,58 +14,72 @@ SUBDIR = source/test/MblkEuler VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = MblkGeometry.o main.o MblkEuler.o MblkHyperbolicLevelIntegrator.o \ - MblkHyperbolicPatchStrategy.o Pointer-MblkHyperbolicLevelIntegrator.o +CXX_OBJS = MblkGeometry.o main.o MblkEuler.o -F_OBJS = upfluxsum.o boundaryconditions.o +F_OBJS = boundaryconditions.o -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): + check: $(MAKE) check3d check3d: main @for i in test_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -examples3d: main - @for i in test_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -examples: - $(MAKE) examples3d + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) viz* -clean: - $(SAMCLEAN) - $(RM) *.f main viz* +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main redo: $(RM) main @@ -74,7 +88,3 @@ include $(SRCDIR)/Makefile.depend boundaryconditions.o: $(SRCDIR)/boundaryconditions.f $(SRCDIR)/bc_common.f $(F77) $(FFLAGS) -c $(SRCDIR)/boundaryconditions.f -o $@ - -upfluxsum.o: $(SRCDIR)/upfluxsum.f - $(F77) $(FFLAGS) -c $(SRCDIR)/upfluxsum.f -o $@ - diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.C index 9d517ee2..365938c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Template for a multiblock AMR Euler code * ************************************************************************/ @@ -31,6 +31,7 @@ using namespace std; #include #include #include +#include #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/MathUtilities.h" @@ -73,7 +74,7 @@ using namespace std; // // inline geometry functions // -#include "GeomUtilsAMR.h" +#include "test/testlib/GeomUtilsAMR.h" // ================================= MblkEuler::Initialization ============================= @@ -142,7 +143,8 @@ MblkEuler::MblkEuler( // d_state.reset(new pdat::CellVariable(dim, "state", d_nState)); d_vol.reset(new pdat::CellVariable(dim, "vol", 1)); - d_flux.reset(new pdat::SideVariable(dim, "flux", d_nState)); + d_flux.reset(new pdat::SideVariable(dim, "flux", + hier::IntVector::getOne(dim), d_nState)); d_xyz.reset(new pdat::NodeVariable(dim, "xyz", d_dim.getValue())); // @@ -151,17 +153,17 @@ MblkEuler::MblkEuler( tbox::plog << "region layout follows:" << endl; tbox::plog << "field"; - for (int ir = 0; ir < d_number_of_regions; ir++) + for (int ir = 0; ir < d_number_of_regions; ++ir) tbox::plog << "\t" << ir; tbox::plog << endl; - for (int ii = 0; ii < d_number_of_regions * 10; ii++) + for (int ii = 0; ii < d_number_of_regions * 10; ++ii) tbox::plog << "-"; tbox::plog << endl; - for (int istate = 0; istate < d_nState; istate++) { + for (int istate = 0; istate < d_nState; ++istate) { tbox::plog << d_state_names[istate]; - for (int ir = 0; ir < d_number_of_regions; ir++) + for (int ir = 0; ir < d_number_of_regions; ++ir) tbox::plog << "\t" << d_state_ic[ir][istate]; tbox::plog << endl; } @@ -184,7 +186,7 @@ MblkEuler::~MblkEuler() { * * Register conserved variable (u) (i.e., solution state variable) and * flux variable with hyperbolic integrator that manages storage for - * those quantities. Also, register plot data with Vizamrai or VisIt. + * those quantities. Also, register plot data with VisIt. * ************************************************************************* */ @@ -192,10 +194,7 @@ MblkEuler::~MblkEuler() { void MblkEuler::registerModelVariables( MblkHyperbolicLevelIntegrator* integrator) { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(integrator != (MblkHyperbolicLevelIntegrator *)NULL); -#endif + TBOX_ASSERT(integrator != 0); // // zonal data and its fluxes @@ -237,12 +236,12 @@ void MblkEuler::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING( d_object_name << ": registerModelVariables()" - << "\nVisit data writer was" + << "\nVisIt data writer was" << "\nregistered. Consequently, no plot data will" << "\nbe written." << endl); } - for (int n = 0; n < d_nState; n++) { + for (int n = 0; n < d_nState; ++n) { string vname = d_state_names[n]; d_visit_writer->registerPlotQuantity(vname, "SCALAR", vardb->mapVariableAndContextToIndex(d_state, @@ -285,21 +284,19 @@ void MblkEuler::initializeDataOnPatch( if (initial_time) { boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(state); TBOX_ASSERT(vol); TBOX_ASSERT(xyz); TBOX_ASSERT(state->getGhostCellWidth() == vol->getGhostCellWidth()); -#endif hier::IntVector state_ghosts = state->getGhostCellWidth(); hier::IntVector xyz_ghosts = xyz->getGhostCellWidth(); @@ -347,9 +344,9 @@ void MblkEuler::initializeDataOnPatch( // // ---------------- compute the element coordinates // - for (int k = kmin; k <= kmax; k++) { - for (int j = jmin; j <= jmax; j++) { - for (int i = imin; i <= imax; i++) { + for (int k = kmin; k <= kmax; ++k) { + for (int j = jmin; j <= jmax; ++j) { + for (int i = imin; i <= imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int n1 = POLY3(i, @@ -387,9 +384,9 @@ void MblkEuler::initializeDataOnPatch( // // ---------------- compute the element volume // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int cind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -429,15 +426,15 @@ void MblkEuler::initializeDataOnPatch( // if (d_data_problem == "REVOLUTION") { - for (int m = 0; m < d_number_of_regions; m++) { // loop over the regions and shape in data + for (int m = 0; m < d_number_of_regions; ++m) { // loop over the regions and shape in data - tbox::Array& lrad = d_rev_rad[m]; - tbox::Array& laxis = d_rev_axis[m]; - int naxis = laxis.getSize(); + std::vector& lrad = d_rev_rad[m]; + std::vector& laxis = d_rev_axis[m]; + int naxis = static_cast(laxis.size()); - for (int k = kmin; k <= kmax; k++) { - for (int j = jmin; j <= jmax; j++) { - for (int i = imin; i <= imax; i++) { + for (int k = kmin; k <= kmax; ++k) { + for (int j = jmin; j <= jmax; ++j) { + for (int i = imin; i <= imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); double x2 = zc[ind] - d_center[2]; @@ -453,7 +450,7 @@ void MblkEuler::initializeDataOnPatch( int lpos = 0; while (Dz > laxis[lpos]) - lpos++; + ++lpos; double a = (Dz @@ -477,31 +474,23 @@ void MblkEuler::initializeDataOnPatch( // the spherical initialization // else if (d_data_problem == "SPHERE") { - double zero = 0.0; - double angle = 0.0; - double* front = d_front_position.getPointer(); - for (int k = kmin; k <= kmax; k++) { - for (int j = jmin; j <= jmax; j++) { - for (int i = imin; i <= imax; i++) { + double* front = &d_front_position[0]; + for (int k = kmin; k <= kmax; ++k) { + for (int j = jmin; j <= jmax; ++j) { + for (int i = imin; i <= imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); double x2 = zc[ind] - d_center[2]; double x1 = yc[ind] - d_center[1]; double x0 = xc[ind] - d_center[0]; - if (x1 == zero && x0 == zero) { - angle = zero; - } else { - angle = atan2(x1, x0); - } - double rad2 = sqrt(x0 * x0 + x1 * x1); // double phi = atan2(rad2,x2); double rad3 = sqrt(rad2 * rad2 + x2 * x2); int ifr = 0; // find the region we draw from (ifr=0 is always origin) while (rad3 > front[ifr + 1]) { - ifr++; + ++ifr; } region_ids[ind] = ifr; } @@ -515,7 +504,7 @@ void MblkEuler::initializeDataOnPatch( || (d_data_problem == "PIECEWISE_CONSTANT_Y") || (d_data_problem == "PIECEWISE_CONSTANT_Z")) { - double* front = d_front_position.getPointer(); + double* front = &d_front_position[0]; double* xx = xc; if (d_data_problem == "PIECEWISE_CONSTANT_Y") { xx = yc; @@ -524,14 +513,14 @@ void MblkEuler::initializeDataOnPatch( xx = zc; } - for (int k = kmin; k <= kmax; k++) { - for (int j = jmin; j <= jmax; j++) { - for (int i = imin; i <= imax; i++) { + for (int k = kmin; k <= kmax; ++k) { + for (int j = jmin; j <= jmax; ++j) { + for (int i = imin; i <= imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int ifr = 0; // the geion we are in while (xx[ind] > front[ifr + 1]) { - ifr++; + ++ifr; } region_ids[ind] = ifr; } @@ -543,17 +532,17 @@ void MblkEuler::initializeDataOnPatch( // else if ((d_data_problem == "RT_SHOCK_TUBE")) { - double* front = d_front_position.getPointer(); + double* front = &d_front_position[0]; double shock_pos = front[1]; // the shock front double front_pos = front[2]; // the sinusoidal perturbation between the two fluids double dt_ampl = d_dt_ampl; - int nmodes = d_amn.getSize(); - double* amn = d_amn.getPointer(); - double* n_mode = d_n_mode.getPointer(); - double* m_mode = d_m_mode.getPointer(); - double* phiy = d_phiy.getPointer(); - double* phiz = d_phiz.getPointer(); + int nmodes = static_cast(d_amn.size()); + double* amn = &d_amn[0]; + double* n_mode = &d_n_mode[0]; + double* m_mode = &d_m_mode[0]; + double* phiy = &d_phiy[0]; + double* phiz = &d_phiz[0]; // ... this is a cartesian problem by definition const double* xdlo = 0; // d_cart_xlo[0][0]; @@ -564,15 +553,15 @@ void MblkEuler::initializeDataOnPatch( double l_z = xdhi[2] - xdlo[2]; double lpi = 3.14159265358979310862446895044; - for (int k = kmin; k <= kmax; k++) { - for (int j = jmin; j <= jmax; j++) { - for (int i = imin; i <= imax; i++) { + for (int k = kmin; k <= kmax; ++k) { + for (int j = jmin; j <= jmax; ++j) { + for (int i = imin; i <= imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); double lpert = 0.0; double ly = yc[ind]; double lz = zc[ind]; - for (int m = 0; m < nmodes; m++) { + for (int m = 0; m < nmodes; ++m) { double lphiy = 2.0 * lpi * n_mode[m] * ly / l_y + phiy[m]; double lphiz = 2.0 * lpi * m_mode[m] * lz / l_z + phiz[m]; double cy = cos(lphiy); @@ -600,12 +589,12 @@ void MblkEuler::initializeDataOnPatch( // int depth = state->getDepth(); - for (int idepth = 0; idepth < depth; idepth++) { + for (int idepth = 0; idepth < depth; ++idepth) { double* psi = state->getPointer(idepth); - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int cind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); #if 0 @@ -630,8 +619,9 @@ void MblkEuler::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } @@ -673,11 +663,11 @@ double MblkEuler::computeStableDtOnPatch( // get the cell data and their bounds // boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); hier::IntVector state_ghosts = state->getGhostCellWidth(); hier::IntVector xyz_ghosts = xyz->getGhostCellWidth(); @@ -710,30 +700,30 @@ double MblkEuler::computeStableDtOnPatch( int pind = 0; double* a11 = Aii.getPointer(pind); - pind++; + ++pind; double* a12 = Aii.getPointer(pind); - pind++; + ++pind; double* a13 = Aii.getPointer(pind); - pind++; + ++pind; double* a21 = Aii.getPointer(pind); - pind++; + ++pind; double* a22 = Aii.getPointer(pind); - pind++; + ++pind; double* a23 = Aii.getPointer(pind); - pind++; + ++pind; double* a31 = Aii.getPointer(pind); - pind++; + ++pind; double* a32 = Aii.getPointer(pind); - pind++; + ++pind; double* a33 = Aii.getPointer(pind); - pind++; + ++pind; // // compute direction cosines // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -849,9 +839,9 @@ double MblkEuler::computeStableDtOnPatch( double v = d_advection_velocity[1]; double w = d_advection_velocity[2]; - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); double uxi = a11[ind] * u + a12[ind] * v + a13[ind] * w; // max parametric signal speed @@ -903,8 +893,9 @@ void MblkEuler::testPatchExtrema( const char* pos) { boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); + TBOX_ASSERT(state); hier::IntVector state_ghosts = state->getGhostCellWidth(); const hier::Index ifirst = patch.getBox().lower(); @@ -924,17 +915,17 @@ void MblkEuler::testPatchExtrema( // double* psi_min = new double[d_nState]; double* psi_max = new double[d_nState]; - for (int ii = 0; ii < d_nState; ii++) { + for (int ii = 0; ii < d_nState; ++ii) { psi_max[ii] = -1.e80; psi_min[ii] = 1.e80; } - for (int ii = 0; ii < d_nState; ii++) { + for (int ii = 0; ii < d_nState; ++ii) { double* lstate = state->getPointer(ii); - for (int k = ifirst(2); k <= ilast(2); k++) { // just loop over interior elements - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { // just loop over interior elements + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int gind = POLY3(i, j, k, imgn, jmgn, kmgn, nxg, nxnyg); @@ -950,7 +941,7 @@ void MblkEuler::testPatchExtrema( tbox::plog << endl << "extrema for the state follow " << pos << " (min,max) = " << endl; - for (int ii = 0; ii < d_nState; ii++) { + for (int ii = 0; ii < d_nState; ++ii) { tbox::plog << d_state_names[ii] << " (min,max) = "; tbox::plog << psi_min[ii] << " " << psi_max[ii] << endl; } @@ -985,21 +976,22 @@ void MblkEuler::computeFluxesOnPatch( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); TBOX_ASSERT(state); TBOX_ASSERT(flux); TBOX_ASSERT(vol); + TBOX_ASSERT(xyz); TBOX_ASSERT(state->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(vol->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); @@ -1088,7 +1080,7 @@ void MblkEuler::computeFluxesOnPatch( int depth = state->getDepth(); - for (int idepth = 0; idepth < depth; idepth++) { + for (int idepth = 0; idepth < depth; ++idepth) { double* psi = state->getPointer(idepth); // assumed single depth here !!!! @@ -1099,9 +1091,9 @@ void MblkEuler::computeFluxesOnPatch( // // compute the fluxes for the upwind method // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0) + 1; i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0) + 1; ++i) { // --------- get the indices int ifx = POLY3(i, j, k, fx_imn, fx_jmn, fx_kmn, fx_nx, fx_nxny); @@ -1190,9 +1182,9 @@ void MblkEuler::computeFluxesOnPatch( } } - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1) + 1; j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1) + 1; ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { // --------- get the indices int ify = POLY3(i, j, k, fy_imn, fy_jmn, fy_kmn, fy_nx, fy_nxny); @@ -1281,9 +1273,9 @@ void MblkEuler::computeFluxesOnPatch( } } - for (int k = ifirst(2); k <= ilast(2) + 1; k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2) + 1; ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { // --------- get the indices int ifz = POLY3(i, j, k, fz_imn, fz_jmn, fz_kmn, fz_nx, fz_nxny); @@ -1375,9 +1367,9 @@ void MblkEuler::computeFluxesOnPatch( // // compute the source due to the upwind method // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -1489,8 +1481,9 @@ void MblkEuler::markPhysicalBoundaryConditions( const hier::IntVector& ghost_width_to_fill) { boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); + TBOX_ASSERT(state); // // the domain and its ghost box @@ -1517,12 +1510,12 @@ void MblkEuler::markPhysicalBoundaryConditions( const boost::shared_ptr pgeom( patch.getPatchGeometry()); - for (int ii = 0; ii < 3; ii++) { + for (int ii = 0; ii < 3; ++ii) { - const tbox::Array& bc_bdry = + const std::vector& bc_bdry = pgeom->getCodimensionBoundaries(bc_types[ii]); - for (int jj = 0; jj < bc_bdry.getSize(); jj++) { + for (int jj = 0; jj < static_cast(bc_bdry.size()); ++jj) { hier::Box fill_box = pgeom->getBoundaryFillBox(bc_bdry[jj], interior, @@ -1537,12 +1530,12 @@ void MblkEuler::markPhysicalBoundaryConditions( int nd = state->getDepth(); - for (int n = 0; n < nd; n++) { + for (int n = 0; n < nd; ++n) { double* sptr = state->getPointer(n); - for (int k = l_kmin; k <= l_kmax; k++) { - for (int j = l_jmin; j <= l_jmax; j++) { - for (int i = l_imin; i <= l_imax; i++) { + for (int k = l_kmin; k <= l_kmax; ++k) { + for (int j = l_jmin; j <= l_jmax; ++j) { + for (int i = l_imin; i <= l_imax; ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -1571,7 +1564,7 @@ void MblkEuler::markPhysicalBoundaryConditions( */ extern "C" { -void F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( +void SAMRAI_F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( const int *, const int *, const int *, const int *, const int *, const int *, double *, @@ -1592,16 +1585,19 @@ void MblkEuler::setPhysicalBoundaryConditions( { NULL_USE(fill_time); - const int block_number = patch.getBox().getBlockId().getBlockValue(); + const hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); markPhysicalBoundaryConditions(patch, ghost_width_to_fill); boost::shared_ptr > position( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); boost::shared_ptr > state( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); + TBOX_ASSERT(position); + TBOX_ASSERT(state); // // the patch and its ghost box @@ -1636,7 +1632,7 @@ void MblkEuler::setPhysicalBoundaryConditions( patch.getBox().getBlockId().getBlockValue(), d_dom_local_blocks); // - // loop over the dimensions, filling in boundary conditions where needed + // loop over the directions, filling in boundary conditions where needed // note that here we have a check for is this really a physical boundary or is it // just a periodic boundary condition, or is it just an internal block boundary // @@ -1654,13 +1650,14 @@ void MblkEuler::setPhysicalBoundaryConditions( int nd_kmin = nghost_box.lower(2); int nd_kmax = nghost_box.upper(2); - for (int dir = 0; dir < d_dim.getValue(); dir++) { + for (tbox::Dimension::dir_t dir = 0; dir < d_dim.getValue(); ++dir) { if (!periodic(dir)) { if ((ghost_box.lower(dir) < domain_box.lower(dir)) && (d_dom_local_blocks[dir] == block_number)) { int iside = 0; - F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( + int intdir = dir; + SAMRAI_F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( &nd_imin, &nd_imax, &nd_jmin, &nd_jmax, &nd_kmin, &nd_kmax, position_ptr, &imin, &imax, &jmin, &jmax, &kmin, &kmax, state_ptr, @@ -1671,13 +1668,14 @@ void MblkEuler::setPhysicalBoundaryConditions( &ghost_box.upper()[0], &patch_box.lower()[0], &patch_box.upper()[0], - &dir, &iside); + &intdir, &iside); } if ((ghost_box.upper(dir) > domain_box.upper(dir)) && (d_dom_local_blocks[d_dim.getValue() + dir] == block_number)) { int iside = 1; - F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( + int intdir = dir; + SAMRAI_F77_FUNC(bcmultiblock, BCMULTIBLOCK) ( &nd_imin, &nd_imax, &nd_jmin, &nd_jmax, &nd_kmin, &nd_kmax, position_ptr, &imin, &imax, &jmin, &jmax, &kmin, &kmax, state_ptr, @@ -1688,12 +1686,12 @@ void MblkEuler::setPhysicalBoundaryConditions( &ghost_box.upper()[0], &patch_box.lower()[0], &patch_box.upper()[0], - &dir, &iside); + &intdir, &iside); } } // end of periodic check - } // end of dimension loop + } // end of direction loop } @@ -1751,28 +1749,26 @@ void MblkEuler::postprocessRefine( const hier::IntVector& ratio) { boost::shared_ptr > cstate( - coarse.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_state, getDataContext()))); boost::shared_ptr > cvol( - coarse.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > fstate( - fine.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_state, getDataContext()))); boost::shared_ptr > fvol( - fine.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_vol, getDataContext()))); - int depth = cstate->getDepth(); - -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cstate); TBOX_ASSERT(fstate); TBOX_ASSERT(cvol); TBOX_ASSERT(fvol); TBOX_ASSERT(cstate->getDepth() == fstate->getDepth()); -#endif + + int depth = cstate->getDepth(); // // get the boxes and bounds @@ -1864,23 +1860,23 @@ void MblkEuler::postprocessRefine( // // ================================= state variable refinement ==================== // - double* cdata = NULL; // keeps pointers around till end of loop - double* fdata = NULL; + double* cdata = 0; // keeps pointers around till end of loop + double* fdata = 0; - for (int n = 0; n < depth; n++) { + for (int n = 0; n < depth; ++n) { cdata = cstate->getPointer(n); fdata = fstate->getPointer(n); - for (int l = 0; l < nel; l++) { // default slopes are zero + for (int l = 0; l < nel; ++l) { // default slopes are zero slope0[l] = 0.0; // this yields piecewise constant interpolation slope1[l] = 0.0; // and makes a handy initializer slope2[l] = 0.0; } - for (int k = ifirstc(2); k <= ilastc(2); k++) { - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int cind = POLY3(i, j, k, cimin, cjmin, ckmin, cnx, cnxny); @@ -1888,10 +1884,8 @@ void MblkEuler::postprocessRefine( double aii = cdata[cind]; val[ind] = aii; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(ind >= 0); // debug assertions TBOX_ASSERT(ind < nel); -#endif #if 0 // turn to zero for simple interp int im1 = cind - 1; int ip1 = cind + 1; @@ -1929,9 +1923,9 @@ void MblkEuler::postprocessRefine( // compute the interpolated data from the cached slopes, looping // over the fine zones // - for (int k = ifirstf(2); k <= ilastf(2); k++) { - for (int j = ifirstf(1); j <= ilastf(1); j++) { - for (int i = ifirstf(0); i <= ilastf(0); i++) { + for (int k = ifirstf(2); k <= ilastf(2); ++k) { + for (int j = ifirstf(1); j <= ilastf(1); ++j) { + for (int i = ifirstf(0); i <= ilastf(0); ++i) { int find = POLY3(i, j, k, fimin, fjmin, fkmin, fnx, fnxny); @@ -1949,10 +1943,8 @@ void MblkEuler::postprocessRefine( int ind = POLY3(ic, jc, kc, imin, jmin, kmin, nx, nxny); // work pos -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(0 <= ind); TBOX_ASSERT(ind < nel); -#endif fdata[find] = val[ind] @@ -2021,27 +2013,26 @@ void MblkEuler::postprocessCoarsen( const hier::IntVector& ratio) { boost::shared_ptr > cstate( - coarse.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_state, getDataContext()))); boost::shared_ptr > cvol( - coarse.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > fstate( - fine.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_state, getDataContext()))); boost::shared_ptr > fvol( - fine.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_vol, getDataContext()))); - int depth = cstate->getDepth(); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cstate); TBOX_ASSERT(cvol); TBOX_ASSERT(fstate); TBOX_ASSERT(fvol); TBOX_ASSERT(cstate->getDepth() == fstate->getDepth()); -#endif + + int depth = cstate->getDepth(); // // box and geometry information @@ -2112,14 +2103,14 @@ void MblkEuler::postprocessCoarsen( // // average the data // - for (int n = 0; n < depth; n++) { + for (int n = 0; n < depth; ++n) { // // zero out the underlying coarse data to serve as a counter // - for (int k = ifirstc(2); k <= ilastc(2); k++) { // loop over the coarse zones - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { // loop over the coarse zones + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int chind = POLY3(i, j, k, cimin, cjmin, ckmin, cnx, cnxny) + n * cnel; @@ -2133,9 +2124,9 @@ void MblkEuler::postprocessCoarsen( // compute the interpolated data from the cached slopes // - for (int k = ifirstf(2); k <= ilastf(2); k++) { // loop over the coarse zones - for (int j = ifirstf(1); j <= ilastf(1); j++) { - for (int i = ifirstf(0); i <= ilastf(0); i++) { + for (int k = ifirstf(2); k <= ilastf(2); ++k) { // loop over the coarse zones + for (int j = ifirstf(1); j <= ilastf(1); ++j) { + for (int i = ifirstf(0); i <= ilastf(0); ++i) { int vol_ind = POLY3(i, j, k, fimin, fjmin, fkmin, fnx, fnxny); int fhind = vol_ind + n * fnel; @@ -2151,11 +2142,9 @@ void MblkEuler::postprocessCoarsen( int chind = POLY3(ic, jc, kc, cimin, cjmin, ckmin, cnx, cnxny) + n * cnel; // post + state offset -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cimin <= ic && ic <= cimax); TBOX_ASSERT(cjmin <= jc && jc <= cjmax); TBOX_ASSERT(ckmin <= kc && kc <= ckmax); -#endif double fmass = fvolume[vol_ind]; @@ -2167,9 +2156,9 @@ void MblkEuler::postprocessCoarsen( // // normalize the completed sum by converting back from extensive to intensive // - for (int k = ifirstc(2); k <= ilastc(2); k++) { // loop over the coarse zones - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { // loop over the coarse zones + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int vol_ind = POLY3(i, j, k, cimin, cjmin, ckmin, cnx, cnxny); int chind = vol_ind + n * cnel; @@ -2220,8 +2209,9 @@ void MblkEuler::tagGradientDetectorCells( const int error_level_number = patch.getPatchLevelNumber(); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); + TBOX_ASSERT(xyz); double* x = xyz->getPointer(0); double* y = xyz->getPointer(1); double* z = xyz->getPointer(2); @@ -2237,11 +2227,13 @@ void MblkEuler::tagGradientDetectorCells( tbox::plog << "box = " << patch.getBox() << endl; boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); boost::shared_ptr > var( - patch.getPatchData(d_state, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_state, getDataContext()))); + TBOX_ASSERT(tags); + TBOX_ASSERT(var); // // Create a set of temporary tags and set to untagged value. @@ -2300,27 +2292,27 @@ void MblkEuler::tagGradientDetectorCells( // specified time interval. If so, apply appropriate tagging for // the level. // - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(var); -#endif + string ref = d_refinement_criteria[ncrit]; if (ref == "GRADIENT") { - int nStateLocal = d_state_grad_names.getSize(); - for (int id = 0; id < nStateLocal; id++) { + int nStateLocal = static_cast(d_state_grad_names.size()); + for (int id = 0; id < nStateLocal; ++id) { double* lvar = var->getPointer(d_state_grad_id[id]); - int size = d_state_grad_tol[id].getSize(); // max depth of gradient tolerance + int size = static_cast(d_state_grad_tol[id].size()); // max depth of gradient tolerance double tol = ((error_level_number < size) // find the tolerance ? d_state_grad_tol[id][error_level_number] : d_state_grad_tol[id][size - 1]); - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int tind = POLY3(i, j, k, imn, jmn, kmn, tnx, tnxny); @@ -2480,7 +2472,7 @@ void MblkEuler::tagGradientDetectorCells( if (d_mblk_geometry->getRefineBoxes(refine_boxes, patch.getBox().getBlockId().getBlockValue(), level_number)) { - for (hier::BoxContainer::iterator b(refine_boxes); + for (hier::BoxContainer::iterator b = refine_boxes.begin(); b != refine_boxes.end(); ++b) { hier::Box intersect = pbox * (*b); if (!intersect.empty()) { @@ -2496,8 +2488,9 @@ void MblkEuler::tagGradientDetectorCells( // // Update tags // - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2515,8 +2508,7 @@ void MblkEuler::tagGradientDetectorCells( void MblkEuler::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) @@ -2525,7 +2517,6 @@ void MblkEuler::fillSingularityBoundaryConditions( NULL_USE(patch); NULL_USE(encon_level); NULL_USE(dst_to_encon); - NULL_USE(fill_time); NULL_USE(fill_box); NULL_USE(boundary_box); NULL_USE(grid_geometry); @@ -2558,7 +2549,7 @@ void MblkEuler::setMappedGridOnPatch( // d_dom_current_nboxes = domain_boxes.size(); - hier::BoxContainer::iterator itr(domain_boxes); + hier::BoxContainer::iterator itr = domain_boxes.begin(); d_dom_current_bounds[0] = itr->lower(0); d_dom_current_bounds[1] = itr->lower(1); d_dom_current_bounds[2] = itr->lower(2); @@ -2567,7 +2558,7 @@ void MblkEuler::setMappedGridOnPatch( d_dom_current_bounds[5] = itr->upper(2); ++itr; - for (int i = 1; i < d_dom_current_nboxes; i++, ++itr) { + for (int i = 1; i < d_dom_current_nboxes; ++i, ++itr) { d_dom_current_bounds[0] = MIN(d_dom_current_bounds[0], itr->lower(0)); d_dom_current_bounds[1] = MIN(d_dom_current_bounds[1], itr->lower(1)); d_dom_current_bounds[2] = MIN(d_dom_current_bounds[2], itr->lower(2)); @@ -2601,12 +2592,14 @@ void MblkEuler::setVolumeOnPatch( const hier::Patch& patch) { boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); + TBOX_ASSERT(vol); + TBOX_ASSERT(xyz); hier::IntVector vol_ghosts = vol->getGhostCellWidth(); hier::IntVector xyz_ghosts = xyz->getGhostCellWidth(); @@ -2638,9 +2631,9 @@ void MblkEuler::setVolumeOnPatch( double* y = xyz->getPointer(1); double* z = xyz->getPointer(2); - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int cind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -2684,9 +2677,7 @@ void MblkEuler::setVolumeOnPatch( void MblkEuler::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -2702,13 +2693,11 @@ void MblkEuler::registerVisItDataWriter( void MblkEuler::printClassData( ostream& os) const { - int j; - os << "\nMblkEuler::printClassData..." << endl; os << "MblkEuler: this = " << (MblkEuler *)this << endl; os << "d_object_name = " << d_object_name << endl; os << "d_grid_geometry = " << endl; - for (j = 0; j < d_grid_geometry->getNumberBlocks(); j++) { + for (hier::BlockId::block_t j = 0; j < d_grid_geometry->getNumberBlocks(); ++j) { // os << (geom::GridGeometry*)d_grid_geometry[j] << endl; } @@ -2716,7 +2705,7 @@ void MblkEuler::printClassData( os << "Parameters for numerical method ..." << endl; os << " d_advection_velocity = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_advection_velocity[j] << " "; + for (tbox::Dimension::dir_t j = 0; j < d_dim.getValue(); ++j) os << d_advection_velocity[j] << " "; os << endl; os << " d_nghosts = " << d_nghosts << endl; @@ -2738,9 +2727,7 @@ void MblkEuler::getFromInput( boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif boost::shared_ptr db(input_db->getDatabase("MblkEuler")); @@ -2765,30 +2752,27 @@ void MblkEuler::getFromInput( // --------------- initialize boundary condition factors // if (db->keyExists("wall_factors")) { - d_wall_factors = db->getIntegerArray("wall_factors"); + d_wall_factors = db->getIntegerVector("wall_factors"); } else { - d_wall_factors.resizeArray(6); - for (int i = 0; i < 6; i++) d_wall_factors[i] = 0; + d_wall_factors.resize(6); + for (int i = 0; i < 6; ++i) d_wall_factors[i] = 0; } // // --------------- process the linear advection test --------------------- // - d_advection_test = 0; + d_advection_test = 1; d_advection_velocity[0] = d_advection_velocity[1] = d_advection_velocity[2] = FLT_MAX; d_advection_vel_type = 0; - if (db->keyExists("advection_test")) { - d_advection_test = db->getInteger("advection_test"); - if (db->keyExists("advection_velocity")) { - db->getDoubleArray("advection_velocity", - d_advection_velocity, d_dim.getValue()); - d_advection_vel_type = db->getInteger("advection_vel_type"); - } else { - TBOX_ERROR( - d_object_name << ": " - << "Key data `advection_velocity' not found in input."); - } + if (db->keyExists("advection_velocity")) { + db->getDoubleArray("advection_velocity", + d_advection_velocity, d_dim.getValue()); + d_advection_vel_type = db->getInteger("advection_vel_type"); + } else { + TBOX_ERROR( + d_object_name << ": " + << "Key data `advection_velocity' not found in input."); } // @@ -2796,8 +2780,8 @@ void MblkEuler::getFromInput( // if (d_advection_test) { if (db->keyExists("state_names")) { - d_state_names = db->getStringArray("state_names"); - d_nState = d_state_names.getSize(); + d_state_names = db->getStringVector("state_names"); + d_nState = static_cast(d_state_names.size()); } else { TBOX_ERROR("missing 'state_names' input for sizing the state" << endl); } @@ -2847,10 +2831,10 @@ void MblkEuler::getFromInput( d_axis[1] /= anorm; d_axis[2] /= anorm; - d_rev_rad.resizeArray(d_number_of_regions); - d_rev_axis.resizeArray(d_number_of_regions); + d_rev_rad.resize(d_number_of_regions); + d_rev_axis.resize(d_number_of_regions); - for (int i = 0; i < d_number_of_regions; i++) { + for (int i = 0; i < d_number_of_regions; ++i) { char tmp[20]; sprintf(tmp, "region_%d", i + 1); // @@ -2858,8 +2842,8 @@ void MblkEuler::getFromInput( boost::shared_ptr region_db( db->getDatabase(lkey)); - d_rev_rad[i] = region_db->getDoubleArray("radius"); - d_rev_axis[i] = region_db->getDoubleArray("axis"); + d_rev_rad[i] = region_db->getDoubleVector("radius"); + d_rev_axis[i] = region_db->getDoubleVector("axis"); } @@ -2885,11 +2869,11 @@ void MblkEuler::getFromInput( if (db->keyExists("amn")) { d_dt_ampl = db->getDouble("ampl"); - d_amn = db->getDoubleArray("amn"); - d_m_mode = db->getDoubleArray("m_mode"); - d_n_mode = db->getDoubleArray("n_mode"); - d_phiy = db->getDoubleArray("phiy"); - d_phiz = db->getDoubleArray("phiz"); + d_amn = db->getDoubleVector("amn"); + d_m_mode = db->getDoubleVector("m_mode"); + d_n_mode = db->getDoubleVector("n_mode"); + d_phiy = db->getDoubleVector("phiy"); + d_phiz = db->getDoubleVector("phiz"); } else { TBOX_ERROR("missing input for RT_SHOCK_TUBE problem." << endl); } @@ -2900,8 +2884,8 @@ void MblkEuler::getFromInput( // if (problem_1d) { if (db->keyExists("front_position")) { - d_front_position = db->getDoubleArray("front_position"); - d_number_of_regions = d_front_position.getSize() - 1; + d_front_position = db->getDoubleVector("front_position"); + d_number_of_regions = static_cast(d_front_position.size()) - 1; TBOX_ASSERT(d_number_of_regions > 0); } else { TBOX_ERROR("Missing`front_position' input required" << endl); @@ -2913,15 +2897,15 @@ void MblkEuler::getFromInput( // // int llen = d_number_of_regions*d_nState; // //double *tmp = new double[llen]; -// tbox::Array tmp(llen); -// for ( int ii = 0 ; ii < llen ; ii++ ) { +// std::vector tmp(llen); +// for ( int ii = 0 ; ii < llen ; ++ii ) { // tmp[ii] = FLT_MAX; // } - d_state_ic.resizeArray(d_number_of_regions); + d_state_ic.resize(d_number_of_regions); //d_state_ic = new double *[d_number_of_regions]; - for (int iReg = 0; iReg < d_number_of_regions; iReg++) { - d_state_ic[iReg].resizeArray(d_nState); + for (int iReg = 0; iReg < d_number_of_regions; ++iReg) { + d_state_ic[iReg].resize(d_nState); //d_state_ic[iReg] = tmp[d_nState*iReg]; } @@ -2932,10 +2916,10 @@ void MblkEuler::getFromInput( if (db->keyExists("state_data")) { boost::shared_ptr state_db( db->getDatabase("state_data")); - tbox::Array lpsi; - for (int iState = 0; iState < d_nState; iState++) { - lpsi = state_db->getDoubleArray(d_state_names[iState]); - for (int iReg = 0; iReg < d_number_of_regions; iReg++) { + std::vector lpsi; + for (int iState = 0; iState < d_nState; ++iState) { + lpsi = state_db->getDoubleVector(d_state_names[iState]); + for (int iReg = 0; iReg < d_number_of_regions; ++iReg) { d_state_ic[iReg][iState] = lpsi[iReg]; } } @@ -2955,12 +2939,11 @@ void MblkEuler::getFromInput( if (db->keyExists("Refinement_data")) { boost::shared_ptr refine_db = db->getDatabase( "Refinement_data"); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -2968,10 +2951,10 @@ void MblkEuler::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -2991,7 +2974,7 @@ void MblkEuler::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } // @@ -2999,19 +2982,19 @@ void MblkEuler::getFromInput( // if (error_db && error_key == "GRADIENT") { - d_state_grad_names = error_db->getStringArray("names"); - int nStateLocal = d_state_grad_names.getSize(); + d_state_grad_names = error_db->getStringVector("names"); + int nStateLocal = static_cast(d_state_grad_names.size()); - d_state_grad_tol.resizeArray(nStateLocal); - d_state_grad_id.resizeArray(nStateLocal); + d_state_grad_tol.resize(nStateLocal); + d_state_grad_id.resize(nStateLocal); - for (int id = 0; id < nStateLocal; id++) { + for (int id = 0; id < nStateLocal; ++id) { string grad_name = d_state_grad_names[id]; // ... the index needed d_state_grad_id[id] = -1; bool found = false; - for (int idj = 0; idj < d_nState && !found; idj++) { + for (int idj = 0; idj < d_nState && !found; ++idj) { if (grad_name == d_state_names[idj]) { found = true; d_state_grad_id[id] = idj; @@ -3020,7 +3003,8 @@ void MblkEuler::getFromInput( // ... the tolerance array needed if (error_db->keyExists(grad_name)) { - d_state_grad_tol[id] = error_db->getDoubleArray(grad_name); + d_state_grad_tol[id] = + error_db->getDoubleVector(grad_name); } else { TBOX_ERROR( "No tolerance array " << grad_name @@ -3042,8 +3026,8 @@ void MblkEuler::getFromInput( hier::IntVector periodic = d_grid_geometry->getPeriodicShift( hier::IntVector(d_dim, 1)); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } /* @@ -3063,21 +3047,23 @@ void MblkEuler::getFromInput( ************************************************************************* */ -void MblkEuler::putToDatabase( - const boost::shared_ptr& db) const +void MblkEuler::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("MBLKEULER_VERSION", MBLKEULER_VERSION); + restart_db->putInteger("MBLKEULER_VERSION", MBLKEULER_VERSION); - db->putDoubleArray("d_advection_velocity", d_advection_velocity, d_dim.getValue()); + restart_db->putDoubleArray("d_advection_velocity", + d_advection_velocity, + d_dim.getValue()); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); } /* @@ -3120,7 +3106,7 @@ void MblkEuler::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const + const std::vector& scalar_bconds) const { NULL_USE(btype); NULL_USE(patch); diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.h index 97b55d58..c6ce6fa7 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEuler.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/TimeInterpolateOperator.h" #include "SAMRAI/pdat/CellVariable.h" @@ -22,12 +21,13 @@ #include "SAMRAI/appu/VisItDataWriter.h" #include +#include using namespace std; #define included_String #include "MblkGeometry.h" -#include "MblkHyperbolicLevelIntegrator.h" -#include "MblkHyperbolicPatchStrategy.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicPatchStrategy.h" // ---------------------------------------------------------------------- @@ -35,7 +35,8 @@ using namespace SAMRAI; class MblkEuler: public tbox::Serializable, - public MblkHyperbolicPatchStrategy + public MblkHyperbolicPatchStrategy, + public xfer::SingularityPatchStrategy { public: // @@ -182,8 +183,7 @@ class MblkEuler: fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); @@ -209,8 +209,8 @@ class MblkEuler: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; hier::IntVector getMultiblockRefineOpStencilWidth() const; @@ -237,17 +237,14 @@ class MblkEuler: private: /* - * These private member functions read data from input and restart. - * When beginning a run from a restart file, all data members are read - * from the restart file. If the boolean flag is true when reading - * from input, some restart values may be overridden by those in the - * input file. + * This private member function reads data from input. If the boolean flag + * is true all input must be present in input database. * * An assertion results if the database pointer is null. */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void @@ -261,7 +258,7 @@ class MblkEuler: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + const std::vector& scalar_bconds) const; /* * The object name is used for error/warning reporting and also as a @@ -272,7 +269,7 @@ class MblkEuler: const tbox::Dimension d_dim; /* - * We cache pointers to the grid geometry and Vizamrai data writer + * We cache pointers to the grid geometry and VisIt data writer * object to set up initial data, set physical boundary conditions, * and register plot variables. */ @@ -288,7 +285,7 @@ class MblkEuler: bool d_use_nonuniform_workload; // - // =========================== State and Variable definitions (private) ============================ + // =============== State and Variable definitions (private) ================ // // @@ -311,31 +308,30 @@ class MblkEuler: // boost::shared_ptr to grid - [xyz] // boost::shared_ptr > d_xyz; - int d_xyz_id; // - // ======================================= Initial Conditions (private) ============================ + // =========================== Initial Conditions (private) ================ // /// center of the sphere or revolution origin - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; /// revolution axis - double d_axis[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_axis[SAMRAI::MAX_DIM_VAL]; /// revolution radius and pos on axis of radius - tbox::Array > d_rev_rad; - tbox::Array > d_rev_axis; + std::vector > d_rev_rad; + std::vector > d_rev_axis; /// /// Rayleigh Taylor Shock tube experiments /// double d_dt_ampl; - tbox::Array d_amn; - tbox::Array d_m_mode; - tbox::Array d_n_mode; - tbox::Array d_phiy; - tbox::Array d_phiz; + std::vector d_amn; + std::vector d_m_mode; + std::vector d_n_mode; + std::vector d_phiy; + std::vector d_phiz; /// /// input for all the geometries @@ -346,7 +342,7 @@ class MblkEuler: // int d_advection_test; // run the linear advection unit test int d_advection_vel_type; // type of velocity to use - double d_advection_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_advection_velocity[SAMRAI::MAX_DIM_VAL]; // // sizing of zonal, flux, and nodal ghosts @@ -364,13 +360,13 @@ class MblkEuler: // region initialization inputs // int d_number_of_regions; - tbox::Array d_front_position; + std::vector d_front_position; // // array of initial conditions and their names [region][state] // - tbox::Array > d_state_ic; - tbox::Array d_state_names; + std::vector > d_state_ic; + std::vector d_state_names; // // This class stores geometry information used for constructing the @@ -381,29 +377,30 @@ class MblkEuler: /// the bound on the index space for the current block int d_dom_current_bounds[6]; - /// the number of boxes needed to describe the index space for the current block + /// the number of boxes needed to describe the index space + /// for the current block int d_dom_current_nboxes; /// the blocks bounding the current patch - int d_dom_local_blocks[6]; + hier::BlockId::block_t d_dom_local_blocks[6]; // - // ======================================= Refinement Data (private) ============================ + // ====================== Refinement Data (private) ======================= // - tbox::Array d_refinement_criteria; + std::vector d_refinement_criteria; /// history variable gradient tagging tolerance - tbox::Array > d_state_grad_tol; - tbox::Array d_state_grad_names; - tbox::Array d_state_grad_id; + std::vector > d_state_grad_tol; + std::vector d_state_grad_names; + std::vector d_state_grad_id; // - // ======================================= Boundary Conditions (private) ============================ + // ==================== Boundary Conditions (private) ====================== // /// factors for the boundary conditions - tbox::Array d_wall_factors; + std::vector d_wall_factors; // // Operators to be used with GridGeometry diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEulerFort.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEulerFort.h index d0b092d8..7fe60860 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEulerFort.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkEulerFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI linear advection example. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.C index 39832440..30061c0a 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: set geometry for multiblock domain * ************************************************************************/ @@ -18,6 +18,9 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include +#include + #define MAX(a, b) (a > b ? a : b) #define MIN(a, b) (a < b ? a : b) @@ -35,13 +38,11 @@ MblkGeometry::MblkGeometry( const std::string& object_name, const tbox::Dimension& dim, boost::shared_ptr input_db, - const int nblocks): + const size_t nblocks): d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); -#endif d_object_name = object_name; //tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); @@ -86,12 +87,12 @@ std::string MblkGeometry::getGeometryType() */ bool MblkGeometry::getRefineBoxes( hier::BoxContainer& refine_boxes, - const int block_number, + const hier::BlockId::block_t block_number, const int level_number) { bool boxes_exist = false; - if (block_number < d_refine_boxes.getSize()) { - if (level_number < d_refine_boxes[level_number].getSize()) { + if (block_number < d_refine_boxes.size()) { + if (level_number < static_cast(d_refine_boxes[level_number].size())) { boxes_exist = true; refine_boxes = d_refine_boxes[block_number][level_number]; } @@ -110,9 +111,7 @@ bool MblkGeometry::getRefineBoxes( void MblkGeometry::getFromInput( boost::shared_ptr input_db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif boost::shared_ptr db( input_db->getDatabase("MblkGeometry")); @@ -120,9 +119,9 @@ void MblkGeometry::getFromInput( d_geom_problem = db->getString("problem_type"); bool found = false; - int i, nb; + int i; char block_name[128]; - double temp_domain[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double temp_domain[SAMRAI::MAX_DIM_VAL]; // // Cartesian geometry @@ -132,10 +131,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr cart_db( db->getDatabase("CartesianGeometry")); - d_cart_xlo.resizeArray(d_nblocks); - d_cart_xhi.resizeArray(d_nblocks); + d_cart_xlo.resize(d_nblocks); + d_cart_xhi.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // xlo sprintf(block_name, "domain_xlo_%d", nb); @@ -145,9 +144,9 @@ void MblkGeometry::getFromInput( << "' domain_xlo for block " << nb << " not found in input." << std::endl); } - d_cart_xlo[nb].resizeArray(d_dim.getValue()); + d_cart_xlo[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xlo[nb][i] = temp_domain[i]; } @@ -159,9 +158,9 @@ void MblkGeometry::getFromInput( << "' domain_xhi for block " << nb << " not found in input." << std::endl); } - d_cart_xhi[nb].resizeArray(d_dim.getValue()); + d_cart_xhi[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xhi[nb][i] = temp_domain[i]; } @@ -177,10 +176,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr wedge_db( db->getDatabase("WedgeGeometry")); - d_wedge_rmin.resizeArray(d_nblocks); - d_wedge_rmax.resizeArray(d_nblocks); + d_wedge_rmin.resize(d_nblocks); + d_wedge_rmax.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // rmin sprintf(block_name, "rmin_%d", nb); @@ -238,14 +237,14 @@ void MblkGeometry::getFromInput( d_tri_nyp = new int[d_tri_nblocks]; d_tri_nzp = new int[d_tri_nblocks]; - d_tri_nbr = new int *[d_tri_nblocks]; + d_tri_nbr = new hier::BlockId::block_t *[d_tri_nblocks]; d_tri_x = new double *[d_tri_nblocks]; d_tri_y = new double *[d_tri_nblocks]; d_tri_z = new double *[d_tri_nblocks]; d_tri_node_size = new int[d_tri_nblocks]; - for (int ib = 0; ib < d_tri_nblocks; ib++) { + for (int ib = 0; ib < d_tri_nblocks; ++ib) { // --------- the size of each block rtest = static_cast(fread(&d_tri_nxp[ib], sizeof(int), 1, fid)); @@ -261,7 +260,7 @@ void MblkGeometry::getFromInput( int nsize = d_tri_nxp[ib] * d_tri_nyp[ib] * d_tri_nzp[ib]; d_tri_node_size[ib] = nsize; - d_tri_nbr[ib] = new int[6]; + d_tri_nbr[ib] = new hier::BlockId::block_t[6]; d_tri_x[ib] = new double[nsize]; d_tri_y[ib] = new double[nsize]; d_tri_z[ib] = new double[nsize]; @@ -285,15 +284,15 @@ void MblkGeometry::getFromInput( rtest = static_cast(fread(&d_tri_z[ib][0], sizeof(double), nsize, fid)); TBOX_ASSERT(rtest == nsize); - //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ii++ ) { + //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ++ii ) { // fscanf( fid, "%20.12e\n", &d_tri_x[ib][ii] ); //} - //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ii++ ) { + //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ++ii ) { // fscanf( fid, "%20.12e\n", &d_tri_y[ib][ii] ); //} - //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ii++ ) { + //for ( int ii = 0 ; ii < d_tri_node_size[ib]; ++ii ) { // fscanf( fid, "%20.12e\n", &d_tri_z[ib][ii] ); //} @@ -364,24 +363,26 @@ void MblkGeometry::getFromInput( * would specify the refinement region on block 2, level 0. * */ - d_refine_boxes.resizeArray(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + d_refine_boxes.resize(d_nblocks); + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // see what the max number of levels is int max_ln = 0; int ln; - for (ln = 0; ln < 10; ln++) { + for (ln = 0; ln < 10; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - max_ln++; + ++max_ln; } } - d_refine_boxes[nb].resizeArray(max_ln); + d_refine_boxes[nb].resize(max_ln); - for (ln = 0; ln < max_ln; ln++) { + for (ln = 0; ln < max_ln; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - d_refine_boxes[nb][ln] = db->getDatabaseBoxArray(block_name); + std::vector db_box_vector = + db->getDatabaseBoxVector(block_name); + d_refine_boxes[nb][ln] = db_box_vector; } else { TBOX_ERROR( d_object_name << ": input entry `" @@ -404,11 +405,11 @@ void MblkGeometry::getFromInput( void MblkGeometry::buildLocalBlocks( const hier::Box& pbox, // the patch box const hier::Box& domain, // the block box - const int block_number, - int* dom_local_blocks) // this returns the blocks neighboring this patch + const hier::BlockId::block_t block_number, + hier::BlockId::block_t* dom_local_blocks) // this returns the blocks neighboring this patch { // by default single block simulation - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; ++i) { dom_local_blocks[i] = block_number; } @@ -479,8 +480,8 @@ void MblkGeometry::buildGridOnPatch( const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number, - int* dom_local_blocks) // this returns the blocks neighboring this patch + const hier::BlockId::block_t block_number, + hier::BlockId::block_t* dom_local_blocks) // this returns the blocks neighboring this patch { buildLocalBlocks(patch.getBox(), domain, block_number, dom_local_blocks); @@ -532,9 +533,9 @@ void MblkGeometry::buildCartesianGridOnPatch( hier::Index upper(domain.upper()); hier::Index diff(upper - lower + hier::Index(lower.getDim(), 1)); - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double xlo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < d_dim.getValue(); i++) { + double dx[SAMRAI::MAX_DIM_VAL]; + double xlo[SAMRAI::MAX_DIM_VAL]; + for (int i = 0; i < d_dim.getValue(); ++i) { dx[i] = (d_cart_xhi[0][i] - d_cart_xlo[0][i]) / (double)diff(i); xlo[i] = d_cart_xlo[0][i]; } @@ -543,12 +544,10 @@ void MblkGeometry::buildCartesianGridOnPatch( // get the coordinates array information // boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); @@ -571,9 +570,9 @@ void MblkGeometry::buildCartesianGridOnPatch( // // ----------- set the nodal positions // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { - for (int i = nd_imin; i <= nd_imax; i++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, nd_imin, nd_jmin, nd_kmin, nd_nx, nd_nxny); x[ind] = xlo[0] + i * dx[0]; @@ -598,12 +597,12 @@ void MblkGeometry::buildWedgeGridOnPatch( const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number) + const hier::BlockId::block_t block_number) { // // Set dx (dr, dth, dz) for the level // - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double dx[SAMRAI::MAX_DIM_VAL]; double nr = (domain.upper(0) - domain.lower(0) + 1); double nth = (domain.upper(1) - domain.lower(1) + 1); @@ -617,12 +616,10 @@ void MblkGeometry::buildWedgeGridOnPatch( } boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); @@ -646,9 +643,9 @@ void MblkGeometry::buildWedgeGridOnPatch( // ----------- set the wedge nodal positions // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { - for (int i = nd_imin; i <= nd_imax; i++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, nd_imin, nd_jmin, nd_kmin, nd_nx, nd_nxny); @@ -679,7 +676,7 @@ void MblkGeometry::buildTrilinearGridOnPatch( const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number) + const hier::BlockId::block_t block_number) { // // Set dx (dr, dth, dz) for the level @@ -689,12 +686,10 @@ void MblkGeometry::buildTrilinearGridOnPatch( double nz = (domain.upper(2) - domain.lower(2) + 1); boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); @@ -735,9 +730,9 @@ void MblkGeometry::buildTrilinearGridOnPatch( // ----------- compute the nodal tri-linear interpolation // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { - for (int i = nd_imin; i <= nd_imax; i++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, nd_imin, nd_jmin, nd_kmin, nd_nx, nd_nxny); @@ -809,7 +804,7 @@ void MblkGeometry::buildSShellGridOnPatch( const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number) + const hier::BlockId::block_t block_number) { bool xyz_allocated = patch.checkAllocated(xyz_id); @@ -819,12 +814,10 @@ void MblkGeometry::buildSShellGridOnPatch( } boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif if (d_dim == tbox::Dimension(3)) { @@ -870,8 +863,8 @@ void MblkGeometry::buildSShellGridOnPatch( // step in a radial direction in x and set y and z appropriately // for a solid angle we go -th to th and -phi to phi // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { double theta = d_sangle_thmin + j * dx[1]; // dx used for dth double phi = d_sangle_thmin + k * dx[2]; @@ -880,7 +873,7 @@ void MblkGeometry::buildSShellGridOnPatch( double yface = sin(theta) * cos(phi); double zface = sin(phi); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, @@ -920,8 +913,8 @@ void MblkGeometry::buildSShellGridOnPatch( // the block we are in. This is contained in the dispOctant.m // matlab code. // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { // // compute the position on the unit sphere for our radial line @@ -930,7 +923,7 @@ void MblkGeometry::buildSShellGridOnPatch( computeUnitSphereOctant(block_number, nth, j, k, &xface, &yface, &zface); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, @@ -980,7 +973,7 @@ void MblkGeometry::buildSShellGridOnPatch( ************************************************************************* */ void MblkGeometry::computeUnitSphereOctant( - int nblock, + hier::BlockId::block_t nblock, int nth, int j, int k, @@ -1044,7 +1037,7 @@ void MblkGeometry::computeUnitSphereOctant( // // nblock = 1, xface = 2, yface, = 3, zface - int tb = nblock; + int tb = static_cast(nblock); int tj = j; int tk = k; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.h index 9048649f..66536377 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: this class creates mapped multiblock grid geometries. * The supported grid types include Cartesian, Wedge, and * Spherical shell. The spherical shell case is a full @@ -16,10 +16,11 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/pdat/CellData.h" +#include + using namespace SAMRAI; class MblkGeometry @@ -33,7 +34,7 @@ class MblkGeometry const std::string& object_name, const tbox::Dimension& dim, boost::shared_ptr input_db, - const int nblocks); + const size_t nblocks); ~MblkGeometry(); @@ -50,7 +51,7 @@ class MblkGeometry bool getRefineBoxes( hier::BoxContainer& refine_boxes, - const int block_number, + const hier::BlockId::block_t block_number, const int level_number); // @@ -63,8 +64,8 @@ class MblkGeometry const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number, - int* dom_local_blocks); + const hier::BlockId::block_t block_number, + hier::BlockId::block_t* dom_local_blocks); // // The array of block indices denoting patch neighbors @@ -73,8 +74,8 @@ class MblkGeometry buildLocalBlocks( const hier::Box& pbox, // the patch box const hier::Box& domain, // the block box - const int block_number, - int* dom_local_blocks); // this returns the blocks neighboring this patch + const hier::BlockId::block_t block_number, + hier::BlockId::block_t* dom_local_blocks); // this returns the blocks neighboring this patch private: // @@ -101,7 +102,7 @@ class MblkGeometry const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number); + const hier::BlockId::block_t block_number); // // trilinearly interpolated base mesh @@ -111,7 +112,7 @@ class MblkGeometry const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number); + const hier::BlockId::block_t block_number); // // Spherical shell grid construction @@ -121,18 +122,18 @@ class MblkGeometry const hier::Patch& patch, const hier::Box& domain, const int xyz_id, - const int block_number); + const hier::BlockId::block_t block_number); // // For the spherical shell construction, i always points in the r direction // and j,k are points on the shell. Given a certain j,k compute the // unit sphere locations for block face (actual xyz is computed - // by x = r*xface, y = r*yface, z = r*zface. Note that the dimension + // by x = r*xface, y = r*yface, z = r*zface. Note that the size // in the theta direction (nth) should be the same for each block. // void computeUnitSphereOctant( - int nblock, + hier::BlockId::block_t nblock, int nth, int j, int k, @@ -152,19 +153,19 @@ class MblkGeometry // The number of blocks and the set of skelton grid geometries that make // up a multiblock mesh. // - int d_nblocks; + size_t d_nblocks; // // Cartesian inputs // - tbox::Array > d_cart_xlo; - tbox::Array > d_cart_xhi; + std::vector > d_cart_xlo; + std::vector > d_cart_xhi; // // Wedge inputs // - tbox::Array d_wedge_rmin; - tbox::Array d_wedge_rmax; + std::vector d_wedge_rmin; + std::vector d_wedge_rmax; double d_wedge_thmin; double d_wedge_thmax; double d_wedge_zmin; @@ -180,7 +181,7 @@ class MblkGeometry int* d_tri_nzp; int* d_tri_node_size; // block size - int** d_tri_nbr; // integer array of neighboring blocks + hier::BlockId::block_t** d_tri_nbr; // integer array of neighboring blocks double** d_tri_x; // [block][node] nodal coordinates double** d_tri_y; double** d_tri_z; @@ -207,7 +208,7 @@ class MblkGeometry // // Refine boxes for different blocks/levels // - tbox::Array > d_refine_boxes; + std::vector > d_refine_boxes; }; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 408ded77..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,2573 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/PatchDataFactory.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/FaceData.h" -#include "SAMRAI/pdat/FaceDataFactory.h" -#include "SAMRAI/pdat/FaceVariable.h" -#include "SAMRAI/pdat/OuterfaceData.h" -#include "SAMRAI/pdat/OuterfaceVariable.h" -#include "SAMRAI/pdat/OutersideData.h" -#include "SAMRAI/pdat/OutersideVariable.h" -#include "SAMRAI/pdat/SideData.h" -#include "SAMRAI/pdat/SideDataFactory.h" -#include "SAMRAI/pdat/SideVariable.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/RestartManager.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Timer.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/xfer/CoarsenSchedule.h" - - -//#define RECORD_STATS -#undef RECORD_STATS -#ifdef RECORD_STATS -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" -#endif - -#include -#include -#include -using namespace std; - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in flux - * synchronization process between hierarchy levels. - * - ************************************************************************* - */ - -extern "C" { -// in upfluxsum.m4: -// for 2D: -void F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACe2d0) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); - -// for 3D: -void F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) (const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); - -} - -#ifndef NULL -#define NULL (0) -#endif - -#define ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION (3) - -using namespace SAMRAI; -using namespace algs; - -/* - ************************************************************************* - * - * This constructor sets the HyperbolicPatchStrategy pointer and - * initializes integration parameters to default values. Communication - * algorithms are created here too. Other data members are read in - * from the input database or from the restart database corresponding - * to the specified object_name. - * - ************************************************************************* - */ - -MblkHyperbolicLevelIntegrator::MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - const boost::shared_ptr& mblk_hierarchy, - const bool register_for_restart, - const bool use_time_refinement): - d_patch_strategy(patch_strategy), - d_object_name(object_name), - d_dim(dim), - d_use_time_refinement(use_time_refinement), - d_registered_for_restart(register_for_restart), - d_cfl(tbox::MathUtilities::getSignalingNaN()), - d_cfl_init(tbox::MathUtilities::getSignalingNaN()), - d_lag_dt_computation(true), - d_use_ghosts_for_dt(false), - d_flux_is_face(true), - d_flux_face_registered(false), - d_flux_side_registered(false), - d_mblk_bdry_fill_advance(new xfer::RefineAlgorithm(dim)), - d_mblk_bdry_fill_advance_new(new xfer::RefineAlgorithm(dim)), - d_mblk_bdry_fill_advance_old(new xfer::RefineAlgorithm(dim)), - d_mblk_coarsen_fluxsum(new xfer::CoarsenAlgorithm(dim)), - d_mblk_coarsen_sync_data(new xfer::CoarsenAlgorithm(dim)), - d_mblk_sync_initial_data(new xfer::CoarsenAlgorithm(dim)), - d_coarsen_rich_extrap_init(new xfer::CoarsenAlgorithm(dim)), - d_coarsen_rich_extrap_final(new xfer::CoarsenAlgorithm(dim)), - d_mblk_fill_new_level(new xfer::RefineAlgorithm(dim)), - d_number_time_data_levels(2), - d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")), - d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_new(hier::VariableDatabase::getDatabase()->getContext("NEW")), - d_plot_context(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_have_flux_on_level_zero(false), - d_distinguish_mpi_reduction_costs(false), - t_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_comm")), - t_error_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_create")), - t_error_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_comm")), - t_mpi_reductions(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::mpi_reductions")), - t_initialize_level_data(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::initializeLevelData()")), - t_fill_new_level_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_create")), - t_fill_new_level_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_comm")), - t_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_create")), - t_new_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_create")), - t_apply_gradient_detector(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::applyGradientDetector()")), - t_coarsen_rich_extrap(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_rich_extrap")), - t_get_level_dt(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()")), - t_get_level_dt_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()_sync")), - t_advance_level(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()")), - t_new_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_comm")), - t_patch_num_kernel(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::patch_numerical_kernels")), - t_advance_level_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()_sync")), - t_std_level_sync(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::standardLevelSynchronization()")), - t_sync_new_levels(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::synchronizeNewLevels()")) -{ - NULL_USE(mblk_hierarchy); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(input_db); - TBOX_ASSERT(patch_strategy != ((MblkHyperbolicPatchStrategy *)NULL)); -#endif - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } - - /* - * Initialize object with data read from the input and restart databases. - */ - - bool from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (from_restart) { - getFromRestart(); - } - getFromInput(input_db, from_restart); -} - -/* - ************************************************************************* - * - * Destructor tells the tbox::RestartManager to remove this object from - * the list of restart items. - * - ************************************************************************* - */ -MblkHyperbolicLevelIntegrator::~MblkHyperbolicLevelIntegrator() -{ - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } -} - -/* - ************************************************************************* - * - * Initialize integration data on all patches on level. This process - * is used at the start of the simulation to set the initial hierarchy - * data and after adaptive regridding. In the second case, the old - * level pointer points to the level that existed in the hierarchy - * before regridding. This pointer may be null, in which case it is - * ignored. If it is non-null, then data is copied from the old level - * to the new level before the old level is discarded. - * - * Note that we also allocate flux storage for the coarsest AMR - * hierarchy level here (i.e., level 0). The time step sequence on - * level 0 is dictated by the user code; so to avoid any memory - * management errors, flux storage on level 0 persists as long as the - * level does. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level, - const bool allocate_data) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_initialize_level_data->start(); - - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(level_number)); - - /* - * Allocate storage needed to initialize level and fill data - * from coarser levels in AMR hierarchy, potentially. Since - * time gets set when we allocate data, re-stamp it to current - * time if we don't need to allocate. - */ - if (allocate_data) { - mblk_level->allocatePatchData(d_new_patch_init_data, init_data_time); - mblk_level->allocatePatchData(d_old_time_dep_data, init_data_time); - } else { - mblk_level->setTime(init_data_time, d_new_patch_init_data); - } - - /* - * Create schedules for filling new level and fill data. - */ - - if ((level_number > 0) || old_level) { - t_fill_new_level_create->start(); - - boost::shared_ptr sched( - d_mblk_fill_new_level->createSchedule(mblk_level, - old_level, - level_number - 1, - hierarchy, - d_patch_strategy)); - t_fill_new_level_create->stop(); - - d_patch_strategy->setDataContext(d_scratch); - - t_fill_new_level_comm->start(); - sched->fillData(init_data_time); - t_fill_new_level_comm->stop(); - - d_patch_strategy->clearDataContext(); - } - - if ((d_number_time_data_levels == 3) && can_be_refined) { - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - time_dep_var++; - } - - } // loop over patches - } - - /* - * Initialize data on patch interiors. - */ - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, init_data_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - init_data_time, - initial_time); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - t_initialize_level_data->stop(); -} - -/* - ************************************************************************* - * - * Reset hierarchy configuration information where the range of new - * hierarchy levels is specified. The information updated involves - * the cached communication schedules maintained by the algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level <= finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln0 = 0; ln0 <= finest_level; ln0++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); - } -#else - NULL_USE(finest_level); -#endif - - int finest_hiera_level = hierarchy->getFinestLevelNumber(); - - d_mblk_bdry_sched_advance.resizeArray(finest_hiera_level + 1); - d_mblk_bdry_sched_advance_new.resizeArray(finest_hiera_level + 1); - - for (int ln = coarsest_level; ln <= finest_hiera_level; ln++) { - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(ln)); - - t_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance[ln] = - d_mblk_bdry_fill_advance->createSchedule(mblk_level, - ln - 1, - hierarchy, - d_patch_strategy); - t_advance_bdry_fill_create->stop(); - - if (!d_lag_dt_computation && d_use_ghosts_for_dt) { - t_new_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance_new[ln] = - d_mblk_bdry_fill_advance_new->createSchedule(mblk_level, - ln - 1, - hierarchy, - d_patch_strategy); - t_new_advance_bdry_fill_create->stop(); - } - - } - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells near large gradients. - * These cells will be refined. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_apply_gradient_detector->start(); - - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(level_number)); - - mblk_level->allocatePatchData(d_saved_var_scratch_data, error_data_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_error_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[level_number]->fillData(error_data_time); - t_error_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - d_patch_strategy-> - tagGradientDetectorCells(**mi, - error_data_time, - initial_time, - tag_index, - uses_richardson_extrapolation_too); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - mblk_level->deallocatePatchData(d_saved_var_scratch_data); - - t_apply_gradient_detector->stop(); - -} - -/* - ************************************************************************* - * - * The Richardson extrapolation algorithm requires a coarsened version - * of the level on which error estiamtion is performed. This routine - * is used to coarsen data from a level in the AMR hierarchy to some - * coarsened version of it. Note that this routine will be called twice - * The init_coarse_level boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * or by coarsening the "new" solution on the fine level (i.e., after - * it has been advanced). - * - * The contexts used for coarsening old data depends on the number of - * time levels. We always want to use data at the oldest time on the - * fine level, coarsened to the CURRENT context on the coarse level. - * Thus, if the problem uses two time levels, we coarsen data from - * CURRENT on fine level (since CURRENT is the oldest time maintained) - * to CURRENT on the coarse level. If the problem uses three time - * levels, we coarsen from OLD on the fine level (since OLD is the - * time maintained) to CURRENT on the coarse level. - * - * When the boolean is false, indicating we are operating at the new - * time, we coarsen the time advanced solution at the NEW context on - * the fine level to the NEW context on the coarse level so that they - * may be compared later. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance) -{ -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(hierarchy); - NULL_USE(level_number); -#endif -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); - TBOX_ASSERT(coarse_level); -#endif - t_coarsen_rich_extrap->start(); - -// boost::shared_ptr level( -// hierarchy->getPatchLevel(level_number)); - - if (before_advance) { - - coarse_level->allocatePatchData(d_new_patch_init_data, - coarsen_data_time); - - if (d_number_time_data_levels == 3) { - d_patch_strategy->setDataContext(d_old); - } else { - d_patch_strategy->setDataContext(d_current); - } - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_init-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } else { - - coarse_level->allocatePatchData(d_new_time_dep_data, - coarsen_data_time); - - d_patch_strategy->setDataContext(d_new); - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_final-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } - - t_coarsen_rich_extrap->stop(); - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells for refinement using Richardson - * extrapolation. Richardson extrapolation requires two copies of - * the solution to compare. The NEW context holds the solution - * computed on the fine level and coarsened, whereas the CURRENT - * context holds the solution integrated on the coarse level after - * coarsening the initial data from the fine level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - /* - * Compare solutions computed on level (stored in NEW context) and on - * the coarser level (stored in CURR context) on the patches of the - * coarser level. The patch strategy implements the compare operations - * performed on each patch. - */ - - int error_level_number = - level->getNextCoarserHierarchyLevelNumber() + 1; - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - d_patch_strategy-> - tagRichardsonExtrapolationCells(*patch, - error_level_number, - d_new, // finer context - d_current, // coarser context - error_data_time, - deltat, - error_coarsen_ratio, - initial_time, - tag_index, - uses_gradient_detector_too); - } - -} - -/* - ************************************************************************* - * - * Initialize level integrator by: - * - * (1) Setting the number of time data levels based on needs of - * the gridding algorithm - * (2) Invoking variable registration in patch strategy. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(gridding_alg); -#endif - - d_number_time_data_levels = 2; - - if ((gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() < 1) || - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() > 3)) { - TBOX_ERROR("MblkHyperbolicLevelIntegrator::initializeLevelIntegrator " - << "error...\n" << " object name = " << d_object_name - << " gridding algorithm has bad error coarsen ratio" << std::endl); - } - - if ((gridding_alg->getTagAndInitializeStrategy()->usesTimeIntegration()) && - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() == 3)) { - d_number_time_data_levels = 3; - d_old = hier::VariableDatabase::getDatabase()->getContext("OLD"); - } - - d_patch_strategy->registerModelVariables(this); - - d_patch_strategy->setupLoadBalancer(this, - gridding_alg.get()); -} - -/* - ************************************************************************* - * - * Invoke dt calculation routines in patch strategy and take a min - * over all patches on the level. The result will be the max of the - * next timestep on the level. If the boolean recompute_dt is true, - * the max timestep on the level will be computed. If it is false, - * the method will simply access the latest dt stored in the time - * refinement integrator. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - t_get_level_dt->start(); - - double dt = tbox::MathUtilities::getMax(); - - if (!d_use_ghosts_for_dt) { - - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } else { - - level->allocatePatchData(d_saved_var_scratch_data, dt_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[level->getLevelNumber()]->fillData(dt_time); - t_advance_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - /* - * Copy data from scratch to current and de-allocate scratch storage. - * This may be excessive here, but seems necessary if the - * computation of dt affects the state of the problem solution. - * Also, this getLevelDt() routine is called at initialization only - * in most cases. - */ - - copyTimeDependentData(level, d_scratch, d_current); - - level->deallocatePatchData(d_saved_var_scratch_data); - - } - - t_get_level_dt_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_get_level_dt_sync->stop(); - t_mpi_reductions->start(); - } - - /* - * The level time increment is a global min over all patches. - */ - - double global_dt = dt; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&global_dt, 1, MPI_MIN); - } - global_dt *= tbox::MathUtilities::Min(d_cfl_init, d_cfl); - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_get_level_dt_sync->stop(); - } - - t_get_level_dt->stop(); - - return global_dt; - -} - -/* - ************************************************************************* - * - * For the standard explicit integration algorithm for hyperbolic - * conservation laws, the fine time increment is the coarse increment - * divided by the maximum mesh ratio (independent of level number). - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio) -{ - NULL_USE(finer_level_number); -#ifdef DEBUG_CHECK_ASSERTIONS - for (int id = 0; id < d_dim.getValue(); id++) { - TBOX_ASSERT(ratio(id) > 0); - } -#endif - return coarse_dt / double(ratio.max()); -} - -/* - ************************************************************************* - * - * Integrate data on all patches in patch level from current time - * to new time (new_time) using a single time step. Before the advance - * can occur, proper ghost cell information is obtained for all patches - * on the level. Then, local patches are advanced sequentially in the - * loop over patches. The details of the routine are as follows: - * - * 0) Allocate storage for new time level data. Also, allocate - * necessary FLUX and flux integral storage if needed - * (i.e., if regrid_advance is false, first_step is true, and - * coarser or finer level than current level exists in hierarchy.) - * - * 1) Scratch space is filled so that, for each patch, interior data - * and ghost cell bdry data correspond to specified time. - * - * 1a) Call user routines to pre-process advance data, if needed. - * - * 2) Compute explicit fluxes in scratch space using data on - * patch + ghosts at given time. - * - * 3) Apply conservative difference in scratch space to advance patch - * interior data to time = new_time. - * - * 3a) Call user routines to post-process advance data, if needed. - * - * 4) Compute next stable time increment for subsequent level advances: - * - * 4a) If (d_lag_dt_computation == true) { - * DO NOT RECOMPUTE characteristic data after advancing - * data on patch. Use characteristic data corresponding - * to current time level, computed prior to flux computation, - * in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Compute dt using data on patch+ghosts at time. - * Else - * - Compute dt using data on patch interior ONLY. - * } - * - * 4b) Copy data from scratch space patch interior to new data - * storage for patch (i.e., at time = new_time). - * - * 4a) If (d_lag_dt_computation == false) { - * RECOMPUTE characteristic data after advancing data on - * patch. Use characteristic data corresponding to new time - * level in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Refill scratch space with new interior patch data - * and ghost cell bdry data correspond to new time. - * (NOTE: This requires a new boundary schedule.) - * - Compute dt using data on patch+ghosts at new_time. - * Else - * - Compute dt using data on patch interior ONLY. - * (using patch interior data at new_time) - * } - * - * 5) If (ln > 0), update flux integrals by adding patch bdry FLUXes - * to flux sums. - * - * Important Notes: - * 1) In order to advance finer levels (if they exist), both old - * and new data for each patch on the level must be maintained. - * 2) If the timestep is the first in the timestep loop on the level - * (indicated by first_step), then time interpolation is - * is unnecessary to fill ghost cells from the next coarser level. - * 3) The new dt is not calculated if regrid_advance is true. - * If this is the case, it is assumed that the results of the - * advance and the timestep calculation will be discarded - * (e.g., during regridding, or initialization). Also, allocation - * and post-processing of FLUX/flux integral data is not performed - * in this case. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); - TBOX_ASSERT(hierarchy); - TBOX_ASSERT(current_time <= new_time); -#endif - -#ifdef RECORD_STATS - boost::shared_ptr num_boxes_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL0", "PROC_STAT")); - boost::shared_ptr num_boxes_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL1", "PROC_STAT")); - boost::shared_ptr num_boxes_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL2", "PROC_STAT")); - boost::shared_ptr num_boxes_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL3", "PROC_STAT")); - boost::shared_ptr num_gridcells_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL0", "PROC_STAT")); - boost::shared_ptr num_gridcells_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL1", "PROC_STAT")); - boost::shared_ptr num_gridcells_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL2", "PROC_STAT")); - boost::shared_ptr num_gridcells_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL3", "PROC_STAT")); - boost::shared_ptr timestamp_l0( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL0", "PROC_STAT")); - boost::shared_ptr timestamp_l1( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL1", "PROC_STAT")); - boost::shared_ptr timestamp_l2( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL2", "PROC_STAT")); - boost::shared_ptr timestamp_l3( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL3", "PROC_STAT")); - - int level_num = level->getLevelNumber(); - - /* - * Record number of gridcells on each patch. Note that patch - * stat requires a seq number to be identified. - */ - double level_gridcells = 0.; - double level_local_patches = 0.; - // to count total gridcells on level - //hier::BoxList boxes = level->getBoxes(); - //for (hier::BoxList::Iterator i(boxes); i; i++) { - // level_gridcells += itr().size(); - //} - // to count gridcells on this processor - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - level_gridcells += (*mi)->getBox().size(); - level_local_patches += 1.0; - } - - if (level_num == 0) { - num_boxes_l0->recordProcStat(level_local_patches); - num_gridcells_l0->recordProcStat(level_gridcells); - timestamp_l0->recordProcStat(current_time); - } - if (level_num == 1) { - num_boxes_l1->recordProcStat(level_local_patches); - num_gridcells_l1->recordProcStat(level_gridcells); - timestamp_l1->recordProcStat(current_time); - } - if (level_num == 2) { - num_boxes_l2->recordProcStat(level_local_patches); - num_gridcells_l2->recordProcStat(level_gridcells); - timestamp_l2->recordProcStat(current_time); - } - if (level_num == 3) { - num_boxes_l3->recordProcStat(level_local_patches); - num_gridcells_l3->recordProcStat(level_gridcells); - timestamp_l3->recordProcStat(current_time); - } -#endif - - t_advance_level->start(); - - const int level_number = level->getLevelNumber(); - const double dt = new_time - current_time; - - /* - * (1) Allocate data needed for advancing level. - * (2) Generate temporary communication schedule to fill ghost - * cells, if needed. - * (3) Fill ghost cell data. - * (4) Process flux storage before the advance. - */ - - level->allocatePatchData(d_new_time_dep_data, new_time); - level->allocatePatchData(d_saved_var_scratch_data, current_time); - - boost::shared_ptr mblk_fill_schedule; - - bool in_hierarchy = level->inHierarchy(); - - if (!in_hierarchy) { - t_error_bdry_fill_create->start(); - if (d_number_time_data_levels == 3) { - mblk_fill_schedule = d_mblk_bdry_fill_advance_old-> - createSchedule(level, - level->getLevelNumber() - 1, - hierarchy, - d_patch_strategy); - } else { - mblk_fill_schedule = d_mblk_bdry_fill_advance-> - createSchedule(level, - level->getLevelNumber() - 1, - hierarchy, - d_patch_strategy); - } - t_error_bdry_fill_create->stop(); - } else { - mblk_fill_schedule = d_mblk_bdry_sched_advance[level_number]; - } - - d_patch_strategy->setDataContext(d_scratch); - if (regrid_advance) { - t_error_bdry_fill_comm->start(); - } else { - t_advance_bdry_fill_comm->start(); - } - mblk_fill_schedule->fillData(current_time); - if (regrid_advance) { - t_error_bdry_fill_comm->stop(); - } else { - t_advance_bdry_fill_comm->stop(); - } - - d_patch_strategy->clearDataContext(); - mblk_fill_schedule.reset(); - - preprocessFluxData(level, - current_time, - new_time, - regrid_advance, - first_step, - last_step); - - /* - * (5) Call user-routine to pre-process state data, if needed. - * (6) Advance solution on all level patches (scratch storage). - * (7) Copy new solution to from scratch to new storage. - * (8) Call user-routine to post-process state data, if needed. - */ - t_patch_num_kernel->start(); - d_patch_strategy->preprocessAdvanceLevelState(level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - d_patch_strategy->setDataContext(d_scratch); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - patch->allocatePatchData(d_temp_var_scratch_data, current_time); - - t_patch_num_kernel->start(); - d_patch_strategy->computeFluxesOnPatch(*patch, - current_time, - dt); - t_patch_num_kernel->stop(); - - bool at_syncronization = false; - - t_patch_num_kernel->start(); - d_patch_strategy->conservativeDifferenceOnPatch(*patch, - current_time, - dt, - at_syncronization); - t_patch_num_kernel->stop(); - - patch->deallocatePatchData(d_temp_var_scratch_data); - } - d_patch_strategy->clearDataContext(); - - level->setTime(new_time, d_saved_var_scratch_data); - level->setTime(new_time, d_flux_var_data); - - copyTimeDependentData(level, d_scratch, d_new); - - t_patch_num_kernel->start(); - d_patch_strategy->postprocessAdvanceLevelState(level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - /* - * (9) If the level advance is for regridding, we compute the next timestep: - * - * (a) If the dt computation is lagged (i.e., we use pre-advance data - * to compute timestep), we reset scratch space on patch interiors - * if needed. Then, we set the strategy context to current or scratch - * depending on whether ghost values are used to compute dt. - * (b) If the dt computation is not lagged (i.e., we use advanced data - * to compute timestep), we refill scratch space, including ghost - * data with new solution values if needed. Then, we set the strategy - * context to new or scratch depending on whether ghost values are - * used to compute dt. - * (c) Then, we loop over patches and compute the dt on each patch. - */ - - double dt_next = tbox::MathUtilities::getMax(); - - if (!regrid_advance) { - - if (d_lag_dt_computation) { - - if (d_use_ghosts_for_dt) { - d_patch_strategy->setDataContext(d_scratch); - copyTimeDependentData(level, d_current, d_scratch); - } else { - d_patch_strategy->setDataContext(d_current); - } - - } else { - - if (d_use_ghosts_for_dt) { - - if (!d_mblk_bdry_sched_advance_new[level_number]) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to fill new ghost data for timestep" - << "computation, but schedule not defined." << std::endl); - } - - d_patch_strategy->setDataContext(d_scratch); - t_new_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance_new[level_number]->fillData(new_time); - t_new_advance_bdry_fill_comm->stop(); - - } else { - d_patch_strategy->setDataContext(d_new); - } - - } - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, new_time); - // "false" argument indicates "initial_time" is false. - t_patch_num_kernel->start(); - double patch_dt = - d_patch_strategy->computeStableDtOnPatch(**mi, - false, - new_time); - t_patch_num_kernel->stop(); - - dt_next = tbox::MathUtilities::Min(dt_next, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } // !regrid_advance - - level->deallocatePatchData(d_saved_var_scratch_data); - - postprocessFluxData(level, - regrid_advance, - first_step, - last_step); - - t_advance_level->stop(); - - t_advance_level_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_advance_level_sync->stop(); - t_mpi_reductions->start(); - } - - double next_dt = dt_next; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&next_dt, 1, MPI_MIN); - } - next_dt *= d_cfl; - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_advance_level_sync->stop(); - } - - return next_dt; -} - -/* - ************************************************************************* - * - * Synchronize data between patch levels according to the standard - * hyperbolic flux correction algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time) -{ - tbox::Array old_times(finest_level - coarsest_level + 1); - for (int i = coarsest_level; i <= finest_level; i++) { - old_times[i] = old_time; - } - standardLevelSynchronization(hierarchy, coarsest_level, finest_level, - sync_time, old_times); -} - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(old_times.getSize() >= finest_level); - for (int ln = coarsest_level; ln < finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - TBOX_ASSERT(sync_time >= old_times[ln]); - } - TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); -#endif - t_std_level_sync->start(); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sync_time >= old_times[coarse_ln]); -#endif - - boost::shared_ptr mblk_fine_level( - hierarchy->getPatchLevel(fine_ln)); - boost::shared_ptr mblk_coarse_level( - hierarchy->getPatchLevel(coarse_ln)); - - synchronizeLevelWithCoarser(mblk_fine_level, - mblk_coarse_level, - sync_time, - old_times[coarse_ln]); - - mblk_fine_level->deallocatePatchData(d_fluxsum_data); - mblk_fine_level->deallocatePatchData(d_flux_var_data); - - if (coarse_ln > coarsest_level) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - } else { - if (coarsest_level == 0) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - d_have_flux_on_level_zero = false; - } - } - - } - - t_std_level_sync->stop(); - -} - -/* - ************************************************************************* - * - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true (i.e., hierarchy is being constructed at initial simulation - * time). After data is coarsened, the user's initialization routine - * is called to reset data (as needed by the application) before - * that solution is further coarsened to the next coarser level in the - * hierarchy. If initial_time is false, then this routine does nothing - * In that case, interpolation of data from coarser levels is sufficient - * to set data on new levels in the hierarchy during regridding. - * - * NOTE: The fact that this routine does nothing when called at any - * time later than when the AMR hierarchy is constructed initially - * may need to change at some point based on application needs. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln = coarsest_level; ln <= finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - } -#endif - - boost::shared_ptr t_sync_initial_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_create")); - boost::shared_ptr t_sync_initial_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_comm")); - - t_sync_new_levels->start(); - - if (initial_time) { - - d_patch_strategy->setDataContext(d_current); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - - //boost::shared_ptr fine_level( - // hierarchy->getPatchLevel(fine_ln)); - - boost::shared_ptr coarse_level( - hierarchy->getPatchLevel(coarse_ln)); - - t_sync_initial_create->start(); - //boost::shared_ptr sched( - // d_mblk_sync_initial_data->createSchedule(coarse_level, - // fine_level, - // d_patch_strategy)); - t_sync_initial_create->stop(); - - t_sync_initial_comm->start(); - //sched->coarsenData(); - t_sync_initial_comm->stop(); - - for (hier::PatchLevel::iterator mi(coarse_level->begin()); - mi != coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, sync_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - sync_time, - initial_time); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } - } - - d_patch_strategy->clearDataContext(); - - } // if (initial_time) - - t_sync_new_levels->stop(); - -} - -/* - ************************************************************************* - * - * Synchronize data between coarse and fine patch levels according to - * the standard hyperbolic flux correction algorithm. The steps of - * the algorithm are: - * - * (1) Replace coarse time-space flux integrals at coarse-fine - * boundaries with time-space flux integrals computed on fine - * level. - * (2) Repeat conservative difference on coarse level with corrected - * fluxes. - * (3) Conservatively coarsen solution on interior of fine level to - * coarse level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::synchronizeLevelWithCoarser( - const boost::shared_ptr mblk_fine_level, - const boost::shared_ptr mblk_coarse_level, - const double sync_time, - const double coarse_sim_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_fine_level); - TBOX_ASSERT(mblk_coarse_level); - TBOX_ASSERT(mblk_coarse_level->getLevelNumber() == - (mblk_fine_level->getLevelNumber() - 1)); -#endif - - boost::shared_ptr t_coarsen_fluxsum_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_create")); - boost::shared_ptr t_coarsen_fluxsum_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_comm")); - boost::shared_ptr t_coarsen_sync_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_create")); - boost::shared_ptr t_coarsen_sync_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_comm")); - - /* - * Coarsen flux integrals around fine patch boundaries to coarser level - * and replace coarse flux information where appropriate. NULL patch - * model is passed in to avoid over complicating coarsen process; - * i.e. patch model is not needed in coarsening of flux integrals. - */ - - t_coarsen_fluxsum_create->start(); - boost::shared_ptr sched( - d_mblk_coarsen_fluxsum->createSchedule(mblk_coarse_level, - mblk_fine_level, - NULL)); - t_coarsen_fluxsum_create->stop(); - - d_patch_strategy->setDataContext(d_current); - t_coarsen_fluxsum_comm->start(); - //sched->coarsenData(); - t_coarsen_fluxsum_comm->stop(); - d_patch_strategy->clearDataContext(); - - /* - * Repeat conservative difference on coarser level. - */ - mblk_coarse_level->allocatePatchData(d_saved_var_scratch_data, - coarse_sim_time); - mblk_coarse_level->setTime(coarse_sim_time, d_flux_var_data); - - d_patch_strategy->setDataContext(d_scratch); - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[mblk_coarse_level->getLevelNumber()]-> - fillData(coarse_sim_time); - t_advance_bdry_fill_comm->stop(); - - const double reflux_dt = sync_time - coarse_sim_time; - - for (hier::PatchLevel::iterator mi(mblk_coarse_level->begin()); - mi != mblk_coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); - - bool at_syncronization = true; - d_patch_strategy->conservativeDifferenceOnPatch(**mi, - coarse_sim_time, - reflux_dt, - at_syncronization); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - copyTimeDependentData(mblk_coarse_level, d_scratch, d_new); - - mblk_coarse_level->deallocatePatchData(d_saved_var_scratch_data); - - /* - * Coarsen time-dependent data from fine patch interiors to coarse patches. - */ - - t_coarsen_sync_create->start(); - sched = d_mblk_coarsen_sync_data->createSchedule(mblk_coarse_level, - mblk_fine_level, - d_patch_strategy); - t_coarsen_sync_create->stop(); - - d_patch_strategy->setDataContext(d_new); - - t_coarsen_sync_comm->start(); - //sched->coarsenData(); - t_coarsen_sync_comm->stop(); - - d_patch_strategy->clearDataContext(); - -} - -/* - ************************************************************************* - * - * Reset time-dependent data on patch level by replacing current data - * with new. The boolean argument is used for odd refinement ratios - * (in particular 3 used in certain applications). - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - double cur_time = 0.; - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - int new_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_new); - - cur_time = (*mi)->getPatchData(cur_indx)->getTime(); - - if (can_be_refined && d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } else { - - if (d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - } - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } - - (*mi)->deallocatePatchData(new_indx); - - time_dep_var++; - - } - - } // loop over patches - - level->setTime(new_time, d_new_patch_init_data); - - if (d_number_time_data_levels == 3) { - level->setTime(cur_time, d_old_time_dep_data); - } - -} - -/* - ************************************************************************* - * - * Discard new data on level. This is used primarily to reset patch - * data after error estimation (e.g., Richardson extrapolation.) - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetDataToPreadvanceState( - const boost::shared_ptr& level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - - /* - * De-allocate new context - */ - level->deallocatePatchData(d_new_time_dep_data); - -} - -/* - ************************************************************************* - * - * Register given variable with algorithm according to specified - * algorithm role (i.e., HYP_VAR_TYPE). Assignment of descriptor - * indices to variable lists, component selectors, and communication - * algorithms takes place here. The different cases are: - * - * TIME_DEP: - * The number of factories depends on the number of time - * levels of data that must be stored on patches to satisfy - * regridding reqs. Currently, there are two possibilities: - * - * (1) If the coarsen ratios between levels are even, the - * error coarsening ratio will be two and so only two - * time levels of data must be maintained on every level - * but the finest as usual. - * - * (2) If the coarsen ratios between levels are three, and - * time integration is used during regridding (e.g., Rich- - * ardson extrapolation), then three time levels of data - * must be maintained on every level but the finest so - * that error estimation can be executed properly. - * - * In case (1), three factories are needed: - * SCRATCH, CURRENT, NEW. - * In case (2), four factories are needed: - * SCRATCH, OLD, CURRENT, NEW. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * NEW index is added to d_new_time_dep_data. - * - * INPUT: - * Only one time level of data is maintained and once values - * are set on patches, they do not change in time. - * - * Two factories are needed: SCRATCH, CURRENT. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * - * NO_FILL: - * Only one time level of data is stored and no scratch space - * is used. Data may be set and manipulated at will in user - * routines. Data (including ghost values) is never touched - * outside of user routines. - * - * Two factories are needed: CURRENT, SCRATCH. - * - * CURRENT index is added to d_new_patch_init_data. - * SCRATCH index is needed only for temporary work space to - * fill new patch levels. - * - * FLUX: - * One factory is needed: SCRATCH. - * - * SCRATCH index is added to d_flux_var_data. - * - * Additionally, a variable for flux integral data is created - * for each FLUX variable. It has a single factory, SCRATCH, - * which is added to d_fluxsum_data. - * - * TEMPORARY: - * One factory needed: SCRATCH. - * SCRATCH index is added to d_temp_var_scratch_data. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op, - const boost::shared_ptr refine_op, - const boost::shared_ptr time_int) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(var); -#endif - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - const hier::IntVector zero_ghosts(d_dim, 0); - - d_all_variables.push_back(var); - - switch (h_v_type) { - - case TIME_DEP: { - -#ifdef DEBUG_CHECK_ASSERTIONS - //TBOX_ASSERT(refine_op); - //TBOX_ASSERT(coarsen_op); - //TBOX_ASSERT(time_int); -#endif - - d_time_dep_variables.push_back(var); - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int new_id = variable_db->registerVariableAndContext(var, - d_new, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - d_new_time_dep_data.setFlag(new_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Set boundary fill schedules for time-dependent variable. - * If time interpolation operator is non-NULL, regular advance - * bdry fill algorithm will time interpolate between current and - * new data on coarser levels, and fill from current data on - * same level. New advance bdry fill algorithm will time interpolate - * between current and new data on coarser levels, and fill from new - * data on same level. If time interpolation operator is NULL, - * regular and new bdry fill algorithms will use current and new - * data, respectively. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, new_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - - /* - * For data synchronization between levels, the coarsen algorithm - * will coarsen new data on finer level to new data on coarser. - * Recall that coarser level data pointers will not be reset until - * after synchronization so we always coarsen to new - * (see synchronizeLevelWithCoarser routine). - */ - - d_mblk_coarsen_sync_data->registerCoarsen(new_id, new_id, coarsen_op); - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); - - /* - * Coarsen operations used in Richardson extrapolation. The init - * initializes data on coarser level, before the coarse level - * advance. If two time levels are used, coarsening occurs between - * the CURRENT context on both levels. If three levels are used, - * coarsening occurs between the OLD context on the fine level and - * the CURRENT context on the coarse level. The final coarsen - * algorithm coarsens data after it has been advanced on the fine - * level to the NEW context on the coarser level. - */ - - if (d_number_time_data_levels == 3) { - - int old_id = variable_db->registerVariableAndContext(var, - d_old, - zero_ghosts); - d_old_time_dep_data.setFlag(old_id); - - d_mblk_bdry_fill_advance_old->registerRefine( - scr_id, cur_id, old_id, new_id, scr_id, refine_op, time_int); - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, old_id, coarsen_op); - - } else { - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - } - - d_coarsen_rich_extrap_final-> - registerCoarsen(new_id, new_id, coarsen_op); - - break; - } - - case INPUT: { - -#ifdef DEBUG_CHECK_ASSERTIONS - // TBOX_ASSERT(refine_op); - // TBOX_ASSERT(coarsen_op); -#endif - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Bdry algorithms for input variables will fill from current only. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * At initialization, it may be necessary to coarsen INPUT data - * up through the hierarchy so that all levels are consistent. - */ - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - - break; - } - - case NO_FILL: { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(refine_op); - TBOX_ASSERT(coarsen_op); -#endif - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - ghosts); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - - break; - } - - case FLUX: { - -#ifdef DEBUG_CHECK_ASSERTIONS -// TBOX_ASSERT(coarsen_op); -#endif - /* - * Note that we force all flux variables to hold double precision - * data and be face- or side-centered. Also, for each flux variable, - * a corresponding "fluxsum" variable is created to manage - * synchronization of data betweeen patch levels in the hierarchy. - */ - const boost::shared_ptr > face_var( - var, - boost::detail::dynamic_cast_tag()); - const boost::shared_ptr > side_var( - var, - boost::detail::dynamic_cast_tag()); - - if (face_var) { - if (d_flux_side_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register FaceVariable when " - << "SideVariable already registered." - << std::endl); - } - - d_flux_is_face = true; - - } else if (side_var) { - if (d_flux_face_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register SideVariable when " - << "FaceVariable already registered." - << std::endl); - } - - d_flux_is_face = false; - - } else { - TBOX_ERROR( - d_object_name << ": " - << "Flux is neither face- or side-centered." << std::endl); - } - - d_flux_variables.push_back(var); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_flux_var_data.setFlag(scr_id); - - string var_name = var->getName(); - string fs_suffix = "_fluxsum"; - string fsum_name = var_name; - fsum_name += fs_suffix; - - boost::shared_ptr fluxsum; - - if (d_flux_is_face) { - boost::shared_ptr > fdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OuterfaceVariable( - d_dim, - fsum_name, - fdf->getDepth())); - d_flux_face_registered = true; - } else { - boost::shared_ptr > sdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OutersideVariable( - d_dim, - fsum_name, - sdf->getDepth())); - d_flux_side_registered = true; - } - - d_fluxsum_variables.push_back(fluxsum); - - int fs_id = variable_db->registerVariableAndContext(fluxsum, - d_scratch, - zero_ghosts); - - d_fluxsum_data.setFlag(fs_id); - - d_mblk_coarsen_fluxsum->registerCoarsen(scr_id, fs_id, coarsen_op); - - break; - } - - case TEMPORARY: { - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_temp_var_scratch_data.setFlag(scr_id); - - break; - } - - default: { - - TBOX_ERROR( - d_object_name << ": " - << "unknown HYP_VAR_TYPE = " << h_v_type - << std::endl); - - } - - } -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data before integration on the level. - * - * We allocate FLUX storage if appropriate. - * - * If the advance is not temporary, we also zero out the FLUX INTEGRALS - * on the first step of any level finer than level zero. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::preprocessFluxData( - const boost::shared_ptr mblk_level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(cur_time); - NULL_USE(last_step); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_level); -#endif - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - const int level_number = mblk_level->getLevelNumber(); - - if (!regrid_advance) { - if (((level_number > 0) && first_step) || - ((level_number == 0) && !d_have_flux_on_level_zero)) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - if (level_number == 0) { - d_have_flux_on_level_zero = true; - } - } - } else { - if (first_step) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - } - } - - if (!regrid_advance && (level_number > 0)) { - - if (first_step) { - - mblk_level->allocatePatchData(d_fluxsum_data, new_time); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator fs_var = - d_fluxsum_variables.begin(); - - while (fs_var != d_fluxsum_variables.end()) { - int fsum_id = - variable_db->mapVariableAndContextToIndex(*fs_var, - d_scratch); - - if (d_flux_is_face) { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } else { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } - - fs_var++; - } - - } // loop over patches - - } else { - mblk_level->setTime(new_time, d_fluxsum_data); - } - - } // if ( !regrid_advance && (level_number > 0) ) - -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data after advancing the solution on - * the level. During normal integration steps, the flux integrals are - * updated for subsequent synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is not temporary (regular integration step): - * 1) If the level is the finest in the hierarchy, FLUX data is - * deallocated. It is not used during synchronization, and is only - * maintained if needed for the advance. - * - * 2) If the level is not the coarsest in the hierarchy, update the - * flux integrals for later synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is temporary, deallocate the flux data if first step. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::postprocessFluxData( - const boost::shared_ptr mblk_level, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(last_step); - - TBOX_ASSERT(mblk_level); - - if (regrid_advance && first_step) { - mblk_level->deallocatePatchData(d_flux_var_data); - } - - if (!regrid_advance && (mblk_level->getLevelNumber() > 0)) { - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator flux_var = - d_flux_variables.begin(); - std::list >::iterator fluxsum_var = - d_fluxsum_variables.begin(); - - const hier::Index& ilo = (*mi)->getBox().lower(); - const hier::Index& ihi = (*mi)->getBox().upper(); - - while (flux_var != d_flux_variables.end()) { - - boost::shared_ptr flux_data( - (*mi)->getPatchData(*flux_var, d_scratch)); - boost::shared_ptr fsum_data( - (*mi)->getPatchData(*fluxsum_var, d_scratch)); - - boost::shared_ptr > fflux_data; - boost::shared_ptr > ffsum_data; - - boost::shared_ptr > sflux_data; - boost::shared_ptr > sfsum_data; - - int ddepth; - hier::IntVector flux_ghosts(d_dim); - - if (d_flux_is_face) { - fflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - ffsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fflux_data && ffsum_data); - TBOX_ASSERT(fflux_data->getDepth() == ffsum_data->getDepth()); -#endif - ddepth = fflux_data->getDepth(); - flux_ghosts = fflux_data->getGhostCellWidth(); - } else { - sflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - sfsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sflux_data && sfsum_data); - TBOX_ASSERT(sflux_data->getDepth() == sfsum_data->getDepth()); -#endif - ddepth = sflux_data->getDepth(); - flux_ghosts = sflux_data->getGhostCellWidth(); - } - - for (int d = 0; d < ddepth; d++) { - // loop over lower and upper parts of outer face/side arrays - for (int ifs = 0; ifs < 2; ifs++) { - if (d_flux_is_face) { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumface2d0, - UPFLUXSUMFACE2D0) (ilo(0), ilo(1), ihi(0), - ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface2d1, - UPFLUXSUMFACE2D1) (ilo(0), ilo(1), ihi(0), - ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumface3d0, - UPFLUXSUMFACE3D0) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface3d1, - UPFLUXSUMFACE3D1) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumface3d2, - UPFLUXSUMFACE3D2) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(2, d), - ffsum_data->getPointer(2, ifs, d)); - } - } else { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumside2d0, - UPFLUXSUMSIDE2D0) (ilo(0), ilo(1), ihi(0), - ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside2d1, - UPFLUXSUMSIDE2D1) (ilo(0), ilo(1), ihi(0), - ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumside3d0, - UPFLUXSUMSIDE3D0) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside3d1, - UPFLUXSUMSIDE3D1) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumside3d2, - UPFLUXSUMSIDE3D2) (ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(2, d), - sfsum_data->getPointer(2, ifs, d)); - } - } // if face operations vs. side operations - } // loop over lower and upper sides/faces - } // loop over depth - - flux_var++; - fluxsum_var++; - - } // loop over flux variables - - } // loop over patches - - } // if !regrid_advance and level number > 0 .... - -} - -/* - ************************************************************************* - * - * Copy time-dependent data from source to destination on level. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); - TBOX_ASSERT(src_context); - TBOX_ASSERT(dst_context); -#endif - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - boost::shared_ptr src_data( - patch->getPatchData(*time_dep_var, src_context), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr dst_data( - patch->getPatchData(*time_dep_var, dst_context), - boost::detail::dynamic_cast_tag()); - - dst_data->copy(*src_data); - time_dep_var++; - } - - } - -} - -/* - ************************************************************************* - * - * Print all class data for MblkHyperbolicLevelIntegrator object. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::printClassData( - ostream& os) const -{ - os << "\nMblkHyperbolicLevelIntegrator::printClassData..." << std::endl; - os << "MblkHyperbolicLevelIntegrator: this = " - << (MblkHyperbolicLevelIntegrator *)this << std::endl; - os << "d_object_name = " << d_object_name << std::endl; - os << "d_cfl = " << d_cfl << "\n" - << "d_cfl_init = " << d_cfl_init << std::endl; - os << "d_lag_dt_computation = " << d_lag_dt_computation << "\n" - << "d_use_ghosts_for_dt = " - << d_use_ghosts_for_dt << std::endl; - os << "d_patch_strategy = " - << (MblkHyperbolicPatchStrategy *)d_patch_strategy << std::endl; - os - << "NOTE: Not printing variable arrays, ComponentSelectors, communication schedules, etc." - << std::endl; -} - -/* - ************************************************************************* - * - * Writes out the class version number, d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_for_dt to the database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::putToDatabase( - const boost::shared_ptr& db) const -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", - ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION); - - db->putDouble("d_cfl", d_cfl); - db->putDouble("d_cfl_init", d_cfl_init); - db->putBool("d_lag_dt_computation", d_lag_dt_computation); - db->putBool("d_use_ghosts_for_dt", d_use_ghosts_for_dt); -} - -/* - ************************************************************************* - * - * Reads in cfl, cfl_init, lag_dt_computation, and - * use_ghosts_to_compute_dt from the input database. - * Note all restart values are overriden with values from the input - * database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::getFromInput( - boost::shared_ptr db, - bool is_from_restart) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - if (db->keyExists("cfl")) { - d_cfl = db->getDouble("cfl"); - } else { - if (!is_from_restart) { - d_cfl = db->getDoubleWithDefault("cfl", d_cfl); - } - } - - if (db->keyExists("cfl_init")) { - d_cfl_init = db->getDouble("cfl_init"); - } else { - if (!is_from_restart) { - d_cfl_init = db->getDoubleWithDefault("cfl_init", d_cfl_init); - } - } - - if (db->keyExists("lag_dt_computation")) { - d_lag_dt_computation = db->getBool("lag_dt_computation"); - } else { - if (!is_from_restart) { - d_lag_dt_computation = - db->getDoubleWithDefault("lag_dt_computation", - d_lag_dt_computation); - } - } - - if (db->keyExists("use_ghosts_to_compute_dt")) { - d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); - } else { - if (!is_from_restart) { - d_use_ghosts_for_dt = - db->getDoubleWithDefault("use_ghosts_for_dt", - d_use_ghosts_for_dt); - TBOX_WARNING( - d_object_name << ": " - << "Key data `use_ghosts_to_compute_dt' not found in input." - << " Using default value " - << d_use_ghosts_for_dt << std::endl); - } - } - - if (db->keyExists("distinguish_mpi_reduction_costs")) { - d_distinguish_mpi_reduction_costs = - db->getBool("distinguish_mpi_reduction_costs"); - } -} - -/* - ************************************************************************* - * - * First, gets the database corresponding to the object_name from the - * restart file. If this database exists, this method checks to make - * sure that the version number of the class matches the version number - * of the restart file. If they match, then d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_to_compute_dt are read from - * restart database. - * Note all restart values can be overriden with values from the input - * database. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::getFromRestart() -{ - - boost::shared_ptr root_db( - tbox::RestartManager::getManager()->getRootDatabase()); - - if (!root_db->isDatabase(d_object_name)) { - TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file" << std::endl); - } - boost::shared_ptr db(root_db->getDatabase(d_object_name)); - - int ver = db->getInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION"); - if (ver != ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION) { - TBOX_ERROR(d_object_name << ": " - << "Restart file version different " - << "than class version." << std::endl); - } - - d_cfl = db->getDouble("d_cfl"); - d_cfl_init = db->getDouble("d_cfl_init"); - d_lag_dt_computation = db->getBool("d_lag_dt_computation"); - d_use_ghosts_for_dt = db->getBool("d_use_ghosts_for_dt"); -} - -/* - ************************************************************************* - * - * Utility routines to retrieve variable contexts used by integrator. - * - ************************************************************************* - */ - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getCurrentContext() const -{ - return d_current; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getNewContext() const -{ - return d_new; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getOldContext() const -{ - return d_old; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getScratchContext() const -{ - return d_scratch; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getPlotContext() const -{ - return d_plot_context; -} - -bool -MblkHyperbolicLevelIntegrator::usingRefinedTimestepping() const -{ - return d_use_time_refinement; -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.h deleted file mode 100644 index 216285ad..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicLevelIntegrator.h +++ /dev/null @@ -1,1041 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicLevelIntegratorXD -#define included_MblkHyperbolicLevelIntegratorXD - -#include "SAMRAI/SAMRAI_config.h" - -#include "MblkHyperbolicPatchStrategy.h" -#include "SAMRAI/algs/TimeRefinementLevelStrategy.h" -#include "SAMRAI/hier/ComponentSelector.h" -#include "SAMRAI/hier/Variable.h" -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" -#include "SAMRAI/hier/CoarsenOperator.h" -#include "SAMRAI/hier/RefineOperator.h" -#include "SAMRAI/hier/TimeInterpolateOperator.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Serializable.h" -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/tbox/Timer.h" - -#include -#include -#include -#include - -using namespace std; - -/** - * Class MblkHyperbolicLevelIntegrator provides routines needed to - * integrate a system of hyperbolic conservation laws on a structured - * AMR patch hierarchy using local time refinement. The routines include - * initializing a level, advance a level, and synchronize levels in a - * time-dependent AMR application. The AMR timestepping algorithm that - * cycles through the patch levels and calls these routines is provided by - * the TimeRefinementIntegrator class. Together, that hierarchy - * integration class and this single level integration class produce the - * common AMR algorithm due to Berger, Colella and Oliger - * (see e.g., Berger and Colella, J. Comp. Phys. (82)1:64-84, 1989). - * The operations performed on single patches on each level are implemented - * in the user-defined, problem-specific class derived from the abstract - * base class HyperbolicPatchStrategy. - * - * It is important to note that the variable contexts used by the concrete - * patch strategy subclass must be consistent with those defined in this - * class which manages the data for the variables. - * - * This class is derived from the abstract base class - * TimeRefinementLevelStrategy, which defines routines needed by - * the time refinement integrator. There is an argument in the constructor - * that determines whether this class will be used by the time - * refinement integrator for refined timestepping or synchronized - * timestepping. The routines overloaded in - * TimeRefinementLevelStrategy are: initializeLevelIntegrator(), - * getLevelDt(), getMaxFinerLevelDt(), advanceLevel(), - * standardLevelSynchronization(), synchronizeNewLevels(), - * resetTimeDependentData(), and resetDataToPreadvanceState(). - * This class is also derived from mesh::StandardTagAndInitStrategy, - * which defines routines needed by the gridding algorithm classes. The - * routines overloaded in mesh::StandardTagAndInitStrategy are: - * initializeLevelData(), resetHierarchyConfiguration(), - * applyGradientDetector(), applyRichardsonExtrapolation(), and - * coarsenDataForRichardsonExtrapolation(). - * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input and restart data are summarized as follows. - * - * Required input keys and data types: NONE - * - * Optional input keys, data types, and defaults: - * - * - * - * - * - \b cfl - * double value for the CFL factor used for timestep selection - * (dt used = CFL * max dt). If no input value is given, a default - * value of 0.9 is used. - * - * - \b cfl_init - * double value for CFL factor used for initial timestep. - * If no input value is given, a default value of 0.9 is used. - * - * - \b lag_dt_computation - * boolean value indicating whether dt is based on current - * solution or solution from previous step (possible optimization - * in communication for characteristic analysis). If no input - * value is given, a default value of TRUE is used. - * - * - * - \b use_ghosts_to_compute_dt - * boolean value indicating whether ghost data must be filled before - * timestep is computed on each patch (possible communication - * optimization). if no input value is given, a default value - * of TRUE is used. - * - * - \b distinguish_mpi_reduction_costs - * boolean specifying whether to separate reduction costs in tbox::MPI - * from costs of load imbalances. By specifying it true, a - * barrier is put in place before the reduction call, so an extra - * operation is incurred. For this reason, it is defaulted FALSE. - * - * - * - * - * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. - * - * A sample input file entry might look like: - * - * \verbatim - * - * cfl = 0.9 - * cfl_init = 0.9 - * lag_dt_computation = FALSE - * use_ghosts_to_compute_dt = TRUE - * distinguish_mpi_reduction_costs = TRUE - * - * \endverbatim - * - * @see algs::TimeRefinementIntegrator - * @see mesh::StandardTagAndInitStrategy - * @see algs::HyperbolicPatchStrategy - */ - -using namespace SAMRAI; -using namespace algs; - -class MblkHyperbolicLevelIntegrator: - public TimeRefinementLevelStrategy, - public mesh::StandardTagAndInitStrategy, - public tbox::Serializable -{ -public: - /** - * Enumerated type for the different ways in which variable storage - * can be manipulated by the level integration algorithm. - * See registerVariable(...) function for more details. - * - * - * - * - \b TIME_DEP {Data that changes in time and needs more than one - * time level to be stored.} - * - \b INPUT {Data that is set once and do not change during - * the ghosts are never re-filled outside of - * user-defined routines.} - * - \b FLUX {Face-centered double values used in conservative - * difference and synchronization (i.e., refluxing) - * process. A corresponding variable to store flux - * integral information is created for each FLUX - * variable.} - * - \b TEMPORARY {Accessory values intended to live only for - * computation on a single patch (i.e., they cannot - * be assumed to exist between patch routine function - * calls.)} - * - * - * - */ - enum HYP_VAR_TYPE { TIME_DEP = 0, - INPUT = 1, - NO_FILL = 2, - FLUX = 3, - TEMPORARY = 4 }; - - /** - * Constructor for MblkHyperbolicLevelIntegrator initializes - * integration parameters to default values and constructs standard - * communication algorithms. Other data members are read in from - * the specified input database or the restart database corresponding - * to the specified object_name. The constructor also registers - * this object for restart using the specified object name when - * the boolean argument is true. Whether object will write its state to - * restart files during program execution is determined by this argument. - * Note that it has a default state of true. This class is used by - * the time refinement integrator for refined timestepping when the - * use_time_refinement argument is true, and for synchronized - * timestepping when the boolean is false. - * - * When assertion checking is active, passing in any null pointer - * or an empty string will result in an unrecoverable assertion. - */ - MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - const boost::shared_ptr& mblk_hierarchy, - const bool register_for_restart = true, - const bool use_time_refinement = true); - - /** - * The destructor for MblkHyperbolicLevelIntegrator unregisters - * the integrator object with the restart manager when so registered. - */ - virtual ~MblkHyperbolicLevelIntegrator(); - - /** - * Initialize level integrator by by setting the number of time levels - * of data needed based on specifications of the gridding algorithm. - * - * This routine also invokes variable registration in the patch strategy. - * - * Assertion checking will throw unrecoverable assertions if either - * pointer is null. - */ - virtual void - initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg); - - /** - * Determine time increment to advance data on level and return that - * value. The double dt_time argument is the simulation time when - * the routine is called. The initial_time boolean is true if this - * routine is called during hierarchy initialization (i.e., at the - * initial simulation time). Otherwise, it is false. The - * recompute_dt option specifies whether to compute the timestep using - * the current level data or to return the value stored by the time - * integrator. The default true setting means the timestep will be - * computed if no value is supplied. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual double - getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time); - - /** - * Return the maximum allowable time increment for the level with - * the specified level number based on the time increment for the - * next coarser level and the mesh refinement ratio between the two - * levels. For the common explicit integration methods for hyperbolic - * conservation laws (constrained by a CFL limit), the fine time increment - * is typically the coarse increment divided by the refinement ratio. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the ratio vector is not acceptable (i.e., all values > 0). - */ - virtual double - getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio_to_coarser); - - /** - * Integrate data on all patches on the given patch level from current - * time (current_time) to new time (new_time). This routine is used - * to advance the solution on each level in the hierarchy and during - * time-dependent regridding procedures, such as Richardson extrapolation. - * The boolean arguments are used to determine the state of the algorithm - * and the data when the advance routine is called. The first_step - * and last_step indicate whether the step is the first or last in the - * current timestep sequence on the level. Typically, the current timestep - * sequence means each step on the level between advance steps on a - * coarser level in the hierarchy, if one exists. The regrid_advance - * value is true when the advance is called as part of a time-dependent - * regridding procedure. Usually when this happens, the results of the - * colution advance will be discarded. So, for example, when this is true - * flux information is not maintained and flux integrals are not updated. - * The final boolean argument indicates whether or not the level resides - * in the hierarchy. For example, during time-dependent regridding, such - * as Richardson extrapolation, a temporary level that is not in the - * hierarchy is created and advanced. Then, a communication schedule - * must be generated for the level before the advance begins. - * - * This routine is called at two different points during time integration: - * during the regular time advance sequence, and possibly at the initial - * simulation time. The second call advances the solution on a coarser - * level ahead in time to provide time-dependent boundary values for some - * finer level when time-dependent regridding is used. In the first case, - * the values of the boolean flags are: - * - * - * - * - \b first_step - * = true for first step in level time step sequence; else, false. - * - \b last_step - * = true for last step in level time step sequence; else, false. - * - \b regrid_advance - * = false. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = false. - * - \b regrid_advance - * = true. - * - * - * - * - * When time-dependent regridding (i.e., Richardson extrapolation) is - * used, the routine is called from two different points in addition to - * those described above: to advance a temporary level that is coarser - * than the hierarchy level on which error estimation is performed, and - * to advance the hierarchy level itself. In the first case, the values of - * the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = true. - * - \b regrid_advance - * = true. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * (when regridding during time integration sequence) - * = true when the level is not coarsest level to synchronize - * immediately before the regridding process; else, false. - * (when generating initial hierarchy construction) - * = true, even though there may be multiple advance steps. - * - \b last_step - * = true when the advance is the last in the Richardson - * extrapolation step sequence; else false. - * - \b regrid_advance - * = true. - * - * - * - * - * When assertion checking is active, an unrecoverable assertion will - * result if either the level or hierarchy pointer is null, or the - * new time is not greater than the given time. - */ - - virtual double - advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance = false); - - /** - * Synchronize data between given patch levels in patch hierarchy - * according to the standard hyperbolic AMR flux correction algorithm. - * This routine synchronizes data between two levels at a time from - * the level with index finest_level down to the level with index - * coarsest_level. The array of old time values are used in the - * re-integration of the time-dependent data. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null), or - * all of the old time values are less than the value of sync_time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times); - - /** - * This overloaded version of standardLevelSynchronization implements - * a routine used for synchronized timestepping. Only a single - * value for the old time is needed, since all levels would have the - * same old time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time); - - /** - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true. In this case, the hierarchy is being constructed at the - * initial simulation time, After data is coarsened, the application- - * specific initialization routine is called to set data before that - * solution is further coarsened to the next coarser level in the - * hierarchy. This operation makes the solution consistent between - * coarser levels and finer levels that did not exist when the coarse - * levels where created and initialized originally. - * - * When initial_time is false, this routine does nothing since the - * standard hyperbolic AMR algorithm for conservation laws requires - * no data synchronization after regridding beyond interpolation of - * data from coarser levels in the hierarchy in some conservative fashion. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null). - */ - virtual void - synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time); - - /** - * Resets time-dependent data storage and update time for patch level. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined); - - /** - * Deallocate all new simulation data on the given level. This may - * be necessary during regridding, or setting up levels initially. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetDataToPreadvanceState( - const boost::shared_ptr& level); - - /** - * Initialize data on a new level after it is inserted into an AMR patch - * hierarchy by the gridding algorithm. The level number indicates - * that of the new level. The old_level pointer corresponds to - * the level that resided in the hierarchy before the level with the - * specified number was introduced. If the pointer is null, there was - * no level in the hierarchy prior to the call and the level data is set - * based on the user routines and the simulation time. Otherwise, the - * specified level replaces the old level and the new level receives data - * from the old level appropriately before it is destroyed. - * - * Typically, when data is set, it is interpolated from coarser levels - * in the hierarchy. If the data is to be set, the level number must - * match that of the old level, if non-null. If the old level is - * non-null, then data is copied from the old level to the new level - * on regions of intersection between those levels before interpolation - * occurs. Then, user-supplied patch routines are called to further - * initialize the data if needed. The boolean argument initial_time - * is passed into the user's routines. - * - * The boolean argument initial_time indicates whether the level is - * being introduced for the first time (i.e., at initialization time), - * or after some regrid process during the calculation beyond the initial - * hierarchy construction. This information is provided since the - * initialization of the data on a patch may be different in each of those - * circumstances. The can_be_refined boolean argument indicates whether - * the level is the finest level allowed in the hierarchy. This may or - * may not affect the data initialization process depending on the problem. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level number does - * not match any level in the hierarchy, or the old level number - * does not match the level number (if the old level pointer is non-null). - */ - virtual void - initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level = - boost::shared_ptr(), - const bool allocate_data = true); - - /** - * Reset cached communication schedules after the hierarchy has changed - * (due to regidding, for example) and the data has been initialized on - * the new levels. The intent is that the cost of data movement on the - * hierarchy will be amortized across multiple communication cycles, - * if possible. The level numbers indicate the range of levels in the - * hierarchy that have changed. However, this routine updates - * communication schedules every level finer than and including that - * indexed by the coarsest level number given. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, any pointer to a level - * in the hierarchy that is coarser than the finest level is null, - * or the given level numbers not specified properly; e.g., - * coarsest_level > finest_level. - */ - virtual void - resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level); - - /** - * Set integer tags to "one" in cells where refinement of the given - * level should occur according to some user-supplied gradient criteria. - * The double time argument is the regrid time. The integer "tag_index" - * argument is the patch descriptor index of the cell-centered integer tag - * array on each patch in the hierarchy. The boolean argument - * initial_time indicates whether the level is being subject to refinement - * at the initial simulation time. If it is false, then the error - * estimation process is being invoked at some later time after the AMR - * hierarchy was initially constructed. The boolean argument - * uses_richardson_extrapolation_too is true when Richardson - * extrapolation error estimation is used in addition to the gradient - * detector, and false otherwise. This argument helps the user to - * manage multiple regridding criteria. This information is passed along - * to the user's patch tagging routines since the application of the - * gradient detector may be different in each case. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null or the level number does - * not match any existing level in the hierarchy. - */ - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too); - - /** - * Set integer tags to "one" where refinement onf the given - * level should occur according to some user-supplied Richardson - * extrapolation criteria. The "error_data_time" argument is the - * regrid time. The "deltat" argument is the time increment to advance - * the solution on the level to be refined. Note that that level is - * finer than the level in the argument list, in general. The - * ratio between the argument level and the actual hierarchy level - * is given by the integer "coarsen ratio". - * - * The integer "tag_index" argument is the patch descriptor index of - * the cell-centered integer tag array on each patch in the hierarchy. - * - * The boolean argument initial_time indicates whether the level is being - * subject to refinement at the initial simulation time. If it is false, - * then the error estimation process is being invoked at some later time - * after the AMR hierarchy was initially constructed. Typically, this - * information is passed to the user's patch tagging routines since the - * application of the Richardson extrapolation process may be different - * in each case. - * - * The boolean uses_gradient_detector_too is true when a gradient - * detector procedure is used in addition to Richardson extrapolation, - * and false otherwise. This argument helps the user to manage multiple - * regridding criteria. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - * - */ - virtual void - applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too); - - /** - * Coarsen solution data from level to coarse_level for Richardson - * extrapolation. Note that this routine will be called twice during - * the Richardson extrapolation error estimation process. The - * before_advance boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * (i.e., before it has been advanced) or by coarsening the "new" - * solution on the fine level (i.e., after it has been advanced). - * - * When assertion checking is active, an unrecoverable assertion will - * result if either level pointer is null. - * - */ - virtual void - coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance); - - /** - * Register a variable with the hyperbolic integration algorithm. The - * variable type must be one of the options defined by the enumerated - * type defined above. Typically, this routine is called from the - * hyperbolic patch model when the variable registration process is - * invoked by calling the function initializeLevelIntegrator() above. - * In fact, that function should be called before this routine is called. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the variable pointer or geometry pointer is null. - */ - virtual void - registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op = - boost::shared_ptr(), - const boost::shared_ptr refine_op = - boost::shared_ptr(), - const boost::shared_ptr time_int = - boost::shared_ptr()); - - /** - * Print class data representation for hyperbolic level integrator object. - * This is done automatically, when an unrecoverable run-time assertion - * is thrown within some member function of this class. - */ - virtual void - printClassData( - ostream& os) const; - - /** - * Write out object state to the given database. - * - * When assertion checking is active, database point must be non-null. - */ - virtual void - putToDatabase( - const boost::shared_ptr& db) const; - - /** - * Return pointer to "current" variable context used by integrator. - * Current data corresponds to state data at the beginning of a - * timestep, or when a new level is initialized. - */ - boost::shared_ptr - getCurrentContext() const; - - /** - * Return pointer to "new" variable context used by integrator. - * New data corresponds to advanced state data at the end of a timestep. - * The data is one timestep later than the "current" data. - */ - boost::shared_ptr - getNewContext() const; - - /** - * Return pointer to "old" variable context used by integrator. - * Old data corresponds to an extra time level of state data used - * for Richardson extrapolation error estimation. The data is - * one timestep earlier than the "current" data. - * - * Note that only in certain cases when using time-dependent error - * estimation, such as Richardson extrapolation, is the returned - * pointer will non-null. See contructor for more information. - */ - boost::shared_ptr - getOldContext() const; - - /** - * Return pointer to "scratch" variable context used by integrator. - * Scratch data typically corresponds to storage that user-routines - * in the concrete HyperbolicPatchStrategy object manipulate; - * in particular, scratch data contains ghost cells. - */ - boost::shared_ptr - getScratchContext() const; - - /** - * Return pointer to variable context used for plotting. This - * context corresponds to the data storage that should be written - * to plot files. Typically, this is the same as the "current" context. - */ - boost::shared_ptr - getPlotContext() const; - - /** - * Return true if this class has been constructed to use refined - * timestepping and false if it has been constructed to use - * synchronized timestepping. - */ - bool - usingRefinedTimestepping() const; - -protected: - /** - * Read input values, indicated above, from given database. The boolean - * argument is_from_restart should be set to true if the simulation - * is beginning from restart. Otherwise it should be set to false. - * - * When assertion checking is active, the database pointer must be non-null. - */ - virtual void - getFromInput( - boost::shared_ptr db, - bool is_from_restart); - - /** - * Read object state from the restart file and initialize class - * data members. The database from which the restart data is read is - * determined by the object_name specified in the constructor. - * - * Unrecoverable Errors: - * - * - * - * - * - - * The database corresponding to object_name is not found - * in the restart file. - * - * - - * The class version number and restart version number do not - * match. - * - * - * - * - * - */ - virtual void - getFromRestart(); - - /* - * Pre-process flux storage before advancing solution on level from - * cur_time to new_time. The boolean flags are used to determine - * how flux and flux integral storage is allocated and initialized. - * These are needed since the advanceLevel() routine is used for - * both level integration and time-dependent error estimation. - * - * When assertion checking is active, the level and schedule pointers - * must be non-null and the current time must be less than the new time. - */ - virtual void - preprocessFluxData( - const boost::shared_ptr level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Post-process flux storage after advancing solution on level. - * The boolean flag is used to determine how flux and flux integral - * storage is copied and de-allocated. This is needed since the - * advanceLevel() routine is used for both level integration and - * time-dependent error estimation. - * - * When assertion checking is active, the level pointer must be non-null. - */ - virtual void - postprocessFluxData( - const boost::shared_ptr level, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Copy time-dependent data from source space to destination space. - * - * When assertion checking is active, the level and context pointers - * must be non-null. - */ - virtual void - copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context); - - /** - * Apply the standard AMR hyperbolic flux synchronization process preserve - * conservation properties in the solution between the fine level and the - * coarse level. The sync_time argument indicates the time at which - * the solution on the two levels is being synchronized. The variable - * coarse_sim_time indicates the previous simulation time on the - * coarse level (recall the conservative difference will be repeated on the - * coarse level during the synchronization process). After the - * synchronization, the flux and flux integral data storage is reset on - * the levels. - * - * When assertion checking is turned on, an unrecoverable assertion - * will result if either level pointer is null, the levels are not - * consecutive in the AMR hierarchy, or the coarse sim time is not - * less than the sync time. - */ - virtual void - synchronizeLevelWithCoarser( - const boost::shared_ptr fine, - const boost::shared_ptr coarse, - const double sync_time, - const double coarse_sim_time); - -private: - /* - * The patch strategy supplies the application-specific operations - * needed to treat data on patches in the AMR hierarchy. - */ - MblkHyperbolicPatchStrategy* d_patch_strategy; - - /* - * The object name is used as a handle to databases stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. - */ - string d_object_name; - - const tbox::Dimension d_dim; - - bool d_use_time_refinement; - bool d_registered_for_restart; - - /* - * Courant-Friedrichs-Levy parameters for time increment selection. - */ - double d_cfl; - double d_cfl_init; - - /* - * Boolean flags for algorithm variations during time integration. - * - * d_lag_dt_computation indicates when time increment is computed for - * next step on a level. A value of true means - * that the current solution values will be used to - * compute dt. A value of false means that dt will - * be computed after the current solution is advanced - * and the new solution is used to compute dt. The - * default value is true. - * - * d_use_ghosts_for_dt indicates whether the time increment computation - * on a patch requires ghost cell data (e.g., if - * boundary conditions are needed). This value must - * be consistent with the numerical routines used - * in the hyperbolic patch strategy object to - * calculate the time step size. The default is true. - */ - bool d_lag_dt_computation; - bool d_use_ghosts_for_dt; - - /* - * Boolean flags for indicated whether face or side data types are - * used for fluxes (choice is determined by numerical routines in - * hyperbolic patch model). - */ - bool d_flux_is_face; - bool d_flux_face_registered; - bool d_flux_side_registered; - -/* - * The following communication algorithms and schedules are created and - * maintained to manage inter-patch communication during AMR integration. - * The algorithms are created in the class constructor. They are initialized - * when variables are "registered" are registered with the integrator. - */ - - /* - * The "advance" schedule is used prior to advancing a level and - * prior to computing dt at initialization. It must be reset each - * time a level is regridded. All ghosts are filled with TIME_DEP - * and INPUT data at specified time. TIME_DEP data in patch interiors - * will be filled with CURRENT_VAR values. - */ - boost::shared_ptr d_mblk_bdry_fill_advance; - tbox::Array > - d_mblk_bdry_sched_advance; - - /* - * The "advance new" schedule can be used twice during a time integration - * cycle. The first is when ghost cell data is required during the - * conservative difference process (i.e., d_use_ghosts_for_cons_diff - * is true). If this is the case, ghosts must be refilled before the - * conservative difference on a coarser level during the refluxing - * process can take place. See synchronizeLevelWithCoarser in class - * MblkHyperbolicLevelIntegrator second occurs when the dt calculation is - * not lagged and the physical boundary conditions are needed to compute dt - * (i.e., (!d_lag_dt_computation && d_use_ghosts_for_dt_computation) - * is true). In either case, all ghosts are filled with TIME_DEP and INPUT - * data at specified time. TIME_DEP data in patch interiors will be filled - * with values corresponding to NEW descriptor indices. See notes - * accompanying MblkHyperbolicLevelIntegrator::advanceLevel. - */ - boost::shared_ptr d_mblk_bdry_fill_advance_new; - tbox::Array > - d_mblk_bdry_sched_advance_new; - - /* - * The "advance old" algorithm is used to fill ghosts using time - * interpolated data from OLD_VAR and NEW_VAR on the coarser hierarchy - * level. It is currently only used for advancing data on a temporary - * level during the Richardson extrapolation algorithm. Use of OLD_VAR - * data is required only when three time levels are used - * (i.e. d_number_time_data_levels=3). - */ - boost::shared_ptr d_mblk_bdry_fill_advance_old; - - /* - * Coarsen algorithms for conservative data synchronization - * (e.g., flux correction or refluxing). - */ - boost::shared_ptr d_mblk_coarsen_fluxsum; - boost::shared_ptr d_mblk_coarsen_sync_data; - boost::shared_ptr d_mblk_sync_initial_data; - - /* - * Coarsen algorithms for Richardson extrapolation. - */ - boost::shared_ptr d_coarsen_rich_extrap_init; - boost::shared_ptr d_coarsen_rich_extrap_final; - - /* - * Algorithm for filling a new patch level in the hierarchy. - */ - boost::shared_ptr d_mblk_fill_new_level; - - /* - * Number of levels of time-dependent data that must be maintained - * on each patch level. This value is used to coordinate the needs - * of the time integration and the regridding process with the - * patch data types and descriptor indices. - */ - int d_number_time_data_levels; - - /* - * hier::Variable contexts and lists of variables used for data management. - * The contexts are set in the constructor. Note that they must - * be consistent with those defined by the concrete subclass of - * the HyperbolicPatchStrategy object. The variable lists - * and component selectors are set in the registerVariable() function. - */ - - boost::shared_ptr d_scratch; - boost::shared_ptr d_current; - boost::shared_ptr d_new; - boost::shared_ptr d_old; - boost::shared_ptr d_plot_context; - - std::list > d_all_variables; - std::list > d_time_dep_variables; - std::list > d_flux_variables; - std::list > d_fluxsum_variables; - - /* - * SCRATCH descriptor indices for (non-TEMPORARY) variables - * (i.e., TIME_DEP, INPUT, FLUX). Note that these are used - * to create scratch space before ghost cells are filled - * on level prior to advancing the data. - */ - hier::ComponentSelector d_saved_var_scratch_data; - - /* - * SCRATCH descriptor indices for TEMPORARY variables. Note that - * these are used to create scratch space on a patch-by-patch basis. - */ - hier::ComponentSelector d_temp_var_scratch_data; - - /* - * CURRENT descriptor indices for TIME_DEP, INPUT, NO_FILL - * variables. Note that these are used to create storage for quantities - * when new patches are made (e.g., during hierachy initialization, - * before error estimation during regridding, after regridding new - * patch levels, etc.). - */ - hier::ComponentSelector d_new_patch_init_data; - - /* - * NEW descriptor indices for TIME_DEP variables. Note that these - * are used to create space for new data before patch level is advanced. - */ - hier::ComponentSelector d_new_time_dep_data; - - /* - * Descriptor indices for FLUX quantities and integrals of fluxes - * (used to accumulate flux information around fine patch boundaries). - * Also, a boolean flag to track flux storage on level 0. - */ - hier::ComponentSelector d_flux_var_data; - hier::ComponentSelector d_fluxsum_data; - bool d_have_flux_on_level_zero; - - /* - * OLD descriptor indices for TIME_DEP variables. Note that - * these are used only when three time levels of data are used. - */ - hier::ComponentSelector d_old_time_dep_data; - - /* - * Option to distinguish tbox::MPI reduction costs from load imbalances - * when doing performance timings. - */ - bool d_distinguish_mpi_reduction_costs; - - /* - * Timers interspersed throughout the class. - */ - boost::shared_ptr t_advance_bdry_fill_comm; - boost::shared_ptr t_error_bdry_fill_create; - boost::shared_ptr t_error_bdry_fill_comm; - boost::shared_ptr t_mpi_reductions; - boost::shared_ptr t_initialize_level_data; - boost::shared_ptr t_fill_new_level_create; - boost::shared_ptr t_fill_new_level_comm; - boost::shared_ptr t_advance_bdry_fill_create; - boost::shared_ptr t_new_advance_bdry_fill_create; - boost::shared_ptr t_apply_gradient_detector; - boost::shared_ptr t_coarsen_rich_extrap; - boost::shared_ptr t_get_level_dt; - boost::shared_ptr t_get_level_dt_sync; - boost::shared_ptr t_advance_level; - boost::shared_ptr t_new_advance_bdry_fill_comm; - boost::shared_ptr t_patch_num_kernel; - boost::shared_ptr t_advance_level_sync; - boost::shared_ptr t_std_level_sync; - boost::shared_ptr t_sync_new_levels; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.C deleted file mode 100644 index ba43e8c4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.C +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#include "MblkHyperbolicPatchStrategy.h" - -#include "SAMRAI/tbox/Utilities.h" - -using namespace SAMRAI; - -MblkHyperbolicPatchStrategy::MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - xfer::CoarsenPatchStrategy(dim), - d_dim(dim) -{ -} - -MblkHyperbolicPatchStrategy::~MblkHyperbolicPatchStrategy() -{ -} - -/* - ************************************************************************* - * - * Default virtual function implementations. - * - ************************************************************************* - */ - -void MblkHyperbolicPatchStrategy::tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too) -{ - NULL_USE(patch); - NULL_USE(regrid_time); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_richardson_extrapolation_too); - TBOX_WARNING("MblkHyperbolicPatchStrategy::tagGradientDetectorCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << std::endl); -} - -void MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too) -{ - NULL_USE(patch); - NULL_USE(error_level_number); - NULL_USE(coarsened_fine); - NULL_USE(advanced_coarse); - NULL_USE(regrid_time); - NULL_USE(deltat); - NULL_USE(error_coarsen_ratio); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_gradient_detector_too); - TBOX_WARNING( - "MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << std::endl); -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.h b/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.h deleted file mode 100644 index 94d27a1b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/MblkHyperbolicPatchStrategy.h +++ /dev/null @@ -1,526 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicPatchStrategyXD -#define included_MblkHyperbolicPatchStrategyXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/Variable.h" -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" -#include "SAMRAI/xfer/CoarsenPatchStrategy.h" -#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" - -#include - -/** - * Class MblkHyperbolicPatchStrategy is an abstract base class defining the - * interface between an MblkHyperbolicLevelIntegrator object and operations - * applied to a single patch in a structured AMR hierarchy. The operations - * include patch initialization, dt calculation, flux computation, - * conservative differencing, and error estimation. This class is derived - * from the xfer::RefinePatchStrategy and xfer::CoarsenPatchStrategy - * abstract base classes. These base classes provide the interface for - * user-defined interlevel data refining and coarsening operations and the - * specification of physical boundary conditions. The functions - * setPhysicalBoundaryConditions(), and pre/postprocessRefine() are - * overloaded from the class xfer::RefinePatchStrategy. The operations - * pre/postprocessCoarsen() are overloaded from xfer::CoarsenPatchStrategy. - * The pre/postprocessCoarsen/Refine() operations are given empty - * implementations here so that the user does not need to proovide them if - * the operations are not needed. - * - * It is important to recognize that for the concrete patch strategy subclass - * and the MblkHyperbolicLevelIntegrator to work together, the concrete - * strategy must know which patch data to operate on. The patch data storage - * is manipulated by the level integrator. The set/clearDataContext() methods - * allow the integrator to inform the patch strategy of the correct data - * context. The concrete patch strategy subclass can access the appropriate - * context via the getDataContext() method. - * - * @see algs::MblkHyperbolicLevelIntegrator - * @see xfer::RefinePatchStrategy - * @see xfer::CoarsenPatchStrategy - */ - -using namespace SAMRAI; - -class MblkHyperbolicLevelIntegrator; - -class MblkHyperbolicPatchStrategy: - public xfer::RefinePatchStrategy, - public xfer::CoarsenPatchStrategy -{ -public: - /** - * Blank constructor for MblkHyperbolicPatchStrategy. - */ - MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim); - - /** - * Virtual destructor for MblkHyperbolicPatchStrategy. - */ - virtual ~MblkHyperbolicPatchStrategy(); - - /** - * Register specific variables needed in the numerical routines with the - * hyperbolic level integrator using the registerVariable() function in that - * class. The integrator manipulates storage for the data and this - * registration defines the way in which data for each quantity will - * be manipulated on the patches. Typically, the derived data quantities - * for plotting are registered with a visualization data writer in this - * routine as well, since the hyperbolic level integrator provides the - * variable context for plotting (i.e., which data is available when a - * plot file is generated). The integrator pointer cannot be null in - * most cases. - * - * The gridding algorithm pointer is provided so that patch data objects - * may be registered with the load balancer object (owned by the gridding - * algorithm) for non-uniform load balancing, if needed. - */ - virtual void - registerModelVariables( - MblkHyperbolicLevelIntegrator* integrator) = 0; - - /** - * Set up parameters in the load balancer object (owned by the gridding - * algorithm) if needed. This function is called immediately after the - * registerModelVariables() function is called. The hyperbolic level - * integrator pointer is provided so that the integrator can be used - * to manage data for the load balancer if needed (e.g., when using - * non-uniform load balancing). - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void setupLoadBalancer( - MblkHyperbolicLevelIntegrator* integrator, - mesh::GriddingAlgorithmStrategy* gridding_algorithm) - { - NULL_USE(integrator); - NULL_USE(gridding_algorithm); - } - - /** - * Set the initial data on a patch interior only. Note that no ghost cells - * need to be set in this routine regardless of whether the patch data - * corresponding to the context requires ghost cells. The data_time - * is the simulation time when the routine is called. The boolean - * initial_time is true if the routine is called at the initial time - * when the hierarchy is initially constructed, otherwise it is false. - */ - virtual void - initializeDataOnPatch( - hier::Patch& patch, - const double data_time, - const bool initial_time) = 0; - - /** - * Compute the stable time increment for a patch on the level with the - * given number. The boolean flag initial_time is true if the routine - * is called at the initial simulation time; otherwise it is false. - * The double argument dt_time is the simulation time. - */ - virtual double - computeStableDtOnPatch( - hier::Patch& patch, - const bool initial_time, - const double dt_time) = 0; - - /** - * Compute TIME INTEGRALS of fluxes to be used in conservative difference - * for patch integration. That is, it is assumed that this numerical - * routine will compute the fluxes corresponding to the cell faces - * multiplied by the time increment. Typically, the numerical flux is - * the normal flux at the cell face. The flux integrals will be used in - * the conservative difference that updates the conserved quantities. - * - * Note that the numerical routines in this method generally require - * ghost cells. Ghost cells data is filled before this routine is called. - */ - virtual void - computeFluxesOnPatch( - hier::Patch& patch, - const double time, - const double dt) = 0; - - /** - * Update patch data with a conservative difference (approximating - * the divergence theorem) using the flux integrals computed in - * computeFluxesOnPatch() routine. The boolean flag is true when this - * routine is called during a flux synchronization step. Otherwise, - * it is false. Note that the computeFluxesOnPatch() routine computes - * TIME INTEGRALs of the numerical fluxes (e.g., they have been multiplied - * by dt). So the conservative difference routine should be consistent - * with this. - */ - virtual void - conservativeDifferenceOnPatch( - hier::Patch& patch, - const double time, - const double dt, - bool at_syncronization) = 0; - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data BEFORE patches are advanced on the given level. - * This routine is called after patch boundary data is filled - * (i.e., ghosts) and before computeFluxesOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser level will occur - * immediately after this advance), regrid_advance -- boolean flag that - * is true if the advance is during a regridding phase (i.e., the advance - * is not used to integrate data on the hierarchy) in which case the - * results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * current level data on all patch interiors. That is, both scratch and - * current data correspond to current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - preprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data AFTER patches are advanced on the given level. - * This routine is called after conservativeDifferenceOnPatch() is called - * and before computeStableDtOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser - * level will occur immediately after this advance), regrid_advance -- - * boolean flag that is true if the advance is during a regridding phase - * (i.e., the advance is not used to integrate data on the hierarchy) in - * which case the results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * new level data on all patch interiors. That is, both scratch and - * new data correspond to current_time + dt on patch interiors. - * The current data and ghost values correspond to the current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - postprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * Tag cells on the given patch that require refinement based on - * application-specific numerical quantities. The tag index argument - * indicates the index of the tag data on the patch data array. The - * boolean argument initial_error is true if tagging is being done at the - * initial simulation time; otherwise, it is false. The other boolean - * flag uses_richardson_extrapolation_too is true when Richardson - * extrapolation is used in addition to the gradient detector. This flag - * helps users manage multiple regridding criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too); - - /** - * Tag cells based from differences computed in the Richardson - * extrapolation. The Richardson - * extrapolation algorithm creates a coarsened version of some hierarchy - * patch level and advances data in time on both the coarsened patch - * level and the hierarchy level. This routine takes the data resulting - * from the advance on both the coarse and fine levels, compares them, and - * tags cells according to the difference. - * \verbatim - * (2) - * n+1 ^------->x finish (1) advanced_coarse - * | ^ (2) coarsened_fine - * time n - | - * ^ |(1) - * | | - * <--------o start - * fine coarse - * \endverbatim - * - * The patch supplied to this routine is on the coarsened level. However, - * the error_level_number corresponds to the actual hierarchy level - * from which it was coarsened. Data resides on this patch in two - * contexts - ``advanced_coarse'' and ``coarsened_fine''. Advanced - * coarse is data advanced on the coarsened version of the level, while - * coarsened fine is the data advanced on the fine level and then - * coarsened to the coarse level. The regrid time and the time increment - * are given for the actual hierarchy level. The error coarsen ratio - * argument is the ratio between the index spaces on the hierarchy level - * and the coarsened hierarchy level. The boolean flag ``initial_error'' - * is true when the error estimation is performed at the initial simulation - * time; i.e., when the hierarchy levels are being constructed for the first - * time. The tag index argument is the index of the tag data on the patch - * data array. The other boolean flag uses_gradient_detector_too is - * true when a gradient detector scheme is used in addition to Richardson - * extrapolation. This flag helps users manage multiple regridding - * criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too); - - /** - * Set user-defined boundary conditions at the physical domain boundary. - */ - virtual void - setPhysicalBoundaryConditions( - hier::Patch& patch, - const double fill_time, - const hier::IntVector& ghost_width_to_fill) = 0; - - /** - * Fill the singularity conditions for the multi-block case - */ - virtual void - fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry) = 0; - - /** - * Return maximum stencil width needed for user-defined - * data interpolation operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getRefineOpStencilWidth() const - { - return hier::IntVector(xfer::CoarsenPatchStrategy::getDim(), 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. The - * interpolation routines are used in the hyperbolic AMR algorithm - * for filling patch ghost cells before advancing data on a level - * and after regridding a level to fill portions of the new level - * from some coarser level. These routines are called automatically - * from within patch boundary filling schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_REFINE" is given as the interpolation - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that refine such variables in either - * of these routines, then they will not be refined. - * - * The order in which these operations are used in each patch - * boundary filling schedule is: - * - * - \b (1) {Call user's preprocessRefine() routine.} - * - \b (2) {Refine all variables with standard interpolation operators.} - * - \b (3) {Call user's postprocessRefine() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /** - * Return maximum stencil width needed for user-defined - * data coarsen operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getCoarsenOpStencilWidth() const - { - return hier::IntVector(xfer::CoarsenPatchStrategy::getDim(), 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. The coarsening - * routines are used in the hyperbolic AMR algorithm synchronizing - * coarse and fine levels when they have been integrated to the same - * point. These routines are called automatically from within the - * data synchronization coarsen schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_COARSEN" is given as the coarsening - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that coarsen such variables in either - * of these routines, then they will not be coarsened. - * - * The order in which these operations are used in each coarsening - * schedule is: - * - * - \b (1) {Call user's preprocessCoarsen() routine.} - * - \b (2) {Coarsen all variables with standard coarsening operators.} - * - \b (3) {Call user's postprocessCoarsen() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /** - * Return pointer to patch data context. - */ - boost::shared_ptr getDataContext() const - { - return d_data_context; - } - - /** - * The hyperbolic integrator controls the context for the data to be used - * in the numerical routines implemented in the concrete patch strategy. - * The setDataContext() allows the integrator to set the context for - * data on a patch on which to operate. - */ - void setDataContext( - boost::shared_ptr context) - { - d_data_context = context; - } - - /** - * The clearDataContext() routine resets the data context to be null. - */ - void clearDataContext() - { - d_data_context.reset(); - } - -private: - boost::shared_ptr d_data_context; - - const tbox::Dimension d_dim; -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Pointer-MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/Pointer-MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 6b0f5329..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/Pointer-MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/README b/base/SAMRAI/SAMRAI/source/test/MblkEuler/README index 7c3dda39..c584a35f 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/README +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/README @@ -3,27 +3,57 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Multiblock Linear Advection Equation Example +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Multiblock Euler Example ## ######################################################################### -This example is similar to the single-block AMR LinAdv sample application. -Please see the README in that example for details on how to compile -and run. This example has the following differences: +This README explains how to compile and run the Multiblock Euler +application. The files in this directory are as follows: + + main.C - application driver program + MblkEuler.[C,h] - C++ class containing routines specific to the + Euler example and which are called from + SAMRAI AMR library routines + MblkGeometry.[C,h] - Class managing the physical coordinate geometry + of the problem. + boundaryconditions.f - Fortran implementation of some boundary + conditions code + bccommon.f - Defines some fortran constants used in + boundarycondistions.f + MblkEulerFort.h - Header file defining external fortran routines + +This example is similar to the single-block Euler sample application. +This example has the following differences: 1. It works on non-cartesian mapped grids 2. It works with multiblock grids 3. All numerical kernel operations (e.g. computeFluxesOnPatch()) are c-based rather than fortran -The three test cases included are: +The included test case is: + + 1. octant_3blk - multi block (3 blocks) mapped octant grid + +Note that the numerics for this example have not been fully tested in 2D so it +currently should only run in 3D. + +COMPILATION AND EXECUTION +------------------------- + + Compilation: + make main - 1. cart-1blk - single block Cartesian grid - 2. wedge-1blk - single block mapped wedge grid - 3. octant-3blk - multi block (3 blocks) mapped octant grid + Execution: + serial: + ./main test_inputs/octant_3blk.3d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main test_inputs/octant_3blk.3d.input -Note that this example will compile in 2D but the numerics have not been fully -tested so it currently should only run in 3D. For further information, please -contact Andy Wissink: awissink@llnl.gov +INPUT PARAMETERS +---------------- +Refer to test_inputs/octant_3blk.3d.input for full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/bc_common.f b/base/SAMRAI/SAMRAI/source/test/MblkEuler/bc_common.f index d087942d..78652142 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/bc_common.f +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/bc_common.f @@ -1,5 +1,9 @@ c -c define some boundary condition constants +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: Define some boundary condition constants. c c @@ -7,63 +11,63 @@ c apputils/boundary/CartesianBoundaryDefines.h c - integer XLO - integer XHI - integer YLO - integer YHI - integer ZLO - integer ZHI + integer XLO + integer XHI + integer YLO + integer YHI + integer ZLO + integer ZHI - integer Y0Z0 - integer Y1Z0 - integer Y0Z1 - integer Y1Z1 - integer X0Z0 - integer X0Z1 - integer X1Z0 - integer X1Z1 - integer X0Y0 - integer X1Y0 - integer X0Y1 - integer X1Y1 + integer Y0Z0 + integer Y1Z0 + integer Y0Z1 + integer Y1Z1 + integer X0Z0 + integer X0Z1 + integer X1Z0 + integer X1Z1 + integer X0Y0 + integer X1Y0 + integer X0Y1 + integer X1Y1 - integer X0Y0Z0 - integer X1Y0Z0 - integer X0Y1Z0 - integer X1Y1Z0 - integer X0Y0Z1 - integer X1Y0Z1 - integer X0Y1Z1 - integer X1Y1Z1 + integer X0Y0Z0 + integer X1Y0Z0 + integer X0Y1Z0 + integer X1Y1Z0 + integer X0Y0Z1 + integer X1Y0Z1 + integer X0Y1Z1 + integer X1Y1Z1 - parameter( XLO = 0) - parameter( XHI = 1) - parameter( YLO = 2) - parameter( YHI = 3) - parameter( ZLO = 4) - parameter( ZHI = 5) + parameter( XLO = 0) + parameter( XHI = 1) + parameter( YLO = 2) + parameter( YHI = 3) + parameter( ZLO = 4) + parameter( ZHI = 5) - parameter( Y0Z0 = 0) - parameter( Y1Z0 = 1) - parameter( Y0Z1 = 2) - parameter( Y1Z1 = 3) - parameter( X0Z0 = 4) - parameter( X0Z1 = 5) - parameter( X1Z0 = 6) - parameter( X1Z1 = 7) - parameter( X0Y0 = 8) - parameter( X1Y0 = 9) - parameter( X0Y1 = 10) - parameter( X1Y1 = 11) + parameter( Y0Z0 = 0) + parameter( Y1Z0 = 1) + parameter( Y0Z1 = 2) + parameter( Y1Z1 = 3) + parameter( X0Z0 = 4) + parameter( X0Z1 = 5) + parameter( X1Z0 = 6) + parameter( X1Z1 = 7) + parameter( X0Y0 = 8) + parameter( X1Y0 = 9) + parameter( X0Y1 = 10) + parameter( X1Y1 = 11) - parameter( X0Y0Z0 = 0) - parameter( X1Y0Z0 = 1) - parameter( X0Y1Z0 = 2) - parameter( X1Y1Z0 = 3) - parameter( X0Y0Z1 = 4) - parameter( X1Y0Z1 = 5) - parameter( X0Y1Z1 = 6) - parameter( X1Y1Z1 = 7) + parameter( X0Y0Z0 = 0) + parameter( X1Y0Z0 = 1) + parameter( X0Y1Z0 = 2) + parameter( X1Y1Z0 = 3) + parameter( X0Y0Z1 = 4) + parameter( X1Y0Z1 = 5) + parameter( X0Y1Z1 = 6) + parameter( X1Y1Z1 = 7) c c end of include file c diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/boundaryconditions.f b/base/SAMRAI/SAMRAI/source/test/MblkEuler/boundaryconditions.f index a5be5801..01d7e93b 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/boundaryconditions.f +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/boundaryconditions.f @@ -1,6 +1,9 @@ - c -c This code is post-processed fortran that has been cleaned up +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: This code is post-processed fortran that has been cleaned up. c c ---------------------------------------------------------------------- diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cart_1blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cart_1blk.3d.input deleted file mode 100644 index e9dab01b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cart_1blk.3d.input +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ -MblkGeometry { - problem_type = "CARTESIAN" - - CartesianGeometry { - domain_xlo_0 = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - domain_xhi_0 = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. - } - - refine_boxes_0_0 = [(5,5,5),(9,9,9)] -} - - -MblkLinAdv { - - advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 5.5 , 5.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { -// refine_criteria = "USER_DEFINED", "UVAL_GRADIENT", "UVAL_SHOCK" - refine_criteria = "USER_DEFINED" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -Main { - dim = 3 -// log file parameters - log_file_name = "sphere-3d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_cart-1blk" - viz_dump_filename = "cart-1blk" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_cart-1blk" - -} - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -Multiblock { - num_blocks = 1 - - // Geometries of the hierachy blocks - BlockGeometry0{ - domain_boxes = [ (0,0,0) , (29,19,19) ] - } - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 - sing_box_0 = [(30,20,20),(30,20,20)] - } - -} - - - - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 9 , 9 , 9 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.5e0 // max cfl factor used in problem - cfl_init = 0.5e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.inc b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.inc deleted file mode 100644 index 680e5848..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.inc +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description - * - ************************************************************************/ - -Multiblock { - - num_blocks = 4 - - // Geometries of the hierachy blocks - BlockGeometry0 { - domain_boxes = [ (0,0,0) , (2,2,2) ] - } - - BlockGeometry1 { - domain_boxes = [ (0,0,0) , (2,2,7) ] - } - - BlockGeometry2 { - domain_boxes = [ (0,0,0) , (2,7,2) ] - } - - BlockGeometry3 { - domain_boxes = [ (0,0,0) , (7,2,2) ] - } - - // Singularity edge definition - Singularity0 { - blocks = 0, 1, 2 - sing_box_0 = [ (0,3,3), (2,3,3) ] - sing_box_1 = [ (0,3,-1), (2,3,-1) ] - sing_box_2 = [ (0,-1,3), (2,-1,3) ] - } - - Singularity1 { - blocks = 0, 1, 3 - sing_box_0 = [ (3,0,3), (3,2,3) ] - sing_box_1 = [ (3,0,-1), (3,2,-1) ] - sing_box_3 = [ (-1,0,3), (-1,2,3) ] - } - - Singularity2 { - blocks = 0, 2, 3 - sing_box_0 = [ (3,3,0), (3,3,2) ] - sing_box_2 = [ (3,-1,0), (3,-1,2) ] - sing_box_3 = [ (-1,3,0), (-1,3,2) ] - } - - Singularity3 { - blocks = 1, 2, 3 - sing_box_1 = [ (3,3,0), (3,3,7) ] - sing_box_2 = [ (3,0,3), (3,7,3) ] - sing_box_3 = [ (0,3,3), (7,3,3) ] - } - - // define face connectivity - BlockNeighbors0 { - block_a = 0 - block_b = 1 - rotation_b_to_a = "I_UP", "J_UP", "K_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = 0, 0, -3 - } - - BlockNeighbors1 { - block_a = 0 - block_b = 2 - rotation_b_to_a = "I_UP", "J_UP", "K_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = 0, -3, 0 - } - - BlockNeighbors2 { - block_a = 0 - block_b = 3 - rotation_b_to_a = "I_UP", "J_UP", "K_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = -3, 0, 0 - } - - BlockNeighbors3 { - block_a = 1 - block_b = 2 - rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = 0, 0, 5 - } - - BlockNeighbors4 { - block_a = 1 - block_b = 3 - rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = 0, 0, 5 - } - - BlockNeighbors5 { - block_a = 2 - block_b = 3 - rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" - point_in_a_space = 0, 0, 0 - point_in_b_space = 0, 5, 0 - } - -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.input deleted file mode 100644 index 25795b0d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.input +++ /dev/null @@ -1,189 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: input file for the multiblock linear advector for advecting - * a blob through a spherical shell - * - ************************************************************************/ - -// ------------------------------------------------------------------- -// problem setup -// ------------------------------------------------------------------- - -// ----------------- define the size of each block -MLEVELS = 1 - -MblkGeometry { - problem_type = "TRILINEAR" - - TrilinearGeometry { - mesh_filename = "cdw.3d.mesh" - } - -} - -MblkEuler { - - advection_test = 1 - - // 0, cartesian, 1 R translation, 2 rigid body theta rotation, 4, rigid body phi rotation - advection_vel_type = 0 - - // advection_velocity = 2.0e0 , 0.0e0 , 0.0e0 - // advection_velocity = 0.0e0 , 2.0e0 , 0.0e0 - advection_velocity = 2.0e0 , 0.0e0 , 0.0e0 - - data_problem = "SPHERE" - - // center = xx, yy, zz // middle of block 0 - // center = yy, xx, zz // middle of block 1 - // center = xxx, yyy, zzz // middle of block 2 - // center = 0.75 , 0.75, 0.75 // middle of the shell - // front_position = 0.0, 0.2, 1.e20 - - //center = 8.0, 4.0, 4.0 // middle of the shell - //center = 4.0, 8.0, 4.0 // middle of the shell - center = 4.0, 4.0, 8.0 // middle of the shell - front_position = 0.0, 1.5, 1.e20 - - // center = 1.25, 1.25, 1.25 // middle of the shell - // front_position = 0.0, 0.75, 1.e20 - - state_names = "rho" - - state_data { - rho = 1.0, 0.0 - } - -/* - state_names = "rho", "u", "v", "w", "p", "ss" - - state_data { - rho = 1.0, 2.0 - u = 1.0, 0.0 - v = 1.0, 4.0 - w = 1.0, 0.0 - p = 1.0, 6.0 - ss = 1.0, 0.0 - } -*/ - - Refinement_data { - refine_criteria = "GRADIENT" - - GRADIENT { - names = "rho" - rho = 0.5 - } - } - -} - - -// ------------------------------------------------------------------- -// hydro blocks -// ------------------------------------------------------------------- - -Main { - dim = 3 -// log file parameters - log_file_name = "cdw.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_cdw" - viz_dump_filename = "octant" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_cdw" - -} - - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -PatchHierarchy { - max_levels = MLEVELS // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40, 40, 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 2 , 2 , 2 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm { - - // efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - // combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - efficiency_tolerance = 0.7e0 // min % of tag cells in new patch level - combine_efficiency = 0.7e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator{ - cfl = 0.5e0 // max cfl factor used in problem - cfl_init = 0.5e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - - -TimeRefinementIntegrator{ - tag_buffer = 2, 2, 2 // number of zones used in the tag buffer - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 100 // max number of simulation timesteps -} - - -LoadBalancer { -} - - -// ------------------------------------------------------------------- -// The mesh -// ------------------------------------------------------------------- - -#include "cdw.3d.inc" diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.mesh b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.mesh deleted file mode 100644 index fe09639c..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/cdw.3d.mesh and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/octant_cart.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/octant_cart.3d.input deleted file mode 100644 index ee0dc34e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/octant_cart.3d.input +++ /dev/null @@ -1,263 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: input file for the multiblock linear advector for - * advecting a blob through a spherical shell - * - ************************************************************************/ - -// ------------------------------------------------------------------- -// problem setup -// ------------------------------------------------------------------- - -// ----------------- define the size of each block -NRAD = 10 // 4 -NRADM = NRAD - 1 -MLEVELS = 2 - -MblkGeometry { - problem_type = "SPHERICAL_SHELL" - - ShellGeometry { - rmin = 1.e0 - rmax = 2.e0 - - shell_type = "OCTANT" - } - - - // The refinement boxes are specified here because the MultiblockGriddingAlg does not have any - // way to take in refinement boxes for multiple blocks. The format is "refine_boxes[block][lev]". - // level 0 - // refine_boxes_0_0 = [(5,0,0),(5,9,9)] - // refine_boxes_1_0 = [(5,0,0),(5,9,9)] - // refine_boxes_2_0 = [(5,0,0),(5,9,9)] - // level 1 - // refine_boxes_0_1 = [(20,0,0),(20,39,39)] - // refine_boxes_1_1 = [(20,0,0),(20,39,39)] - // refine_boxes_2_1 = [(20,0,0),(20,39,39)] -} - -// -------------- some calculations for placing the blob in the middle of each octant -r = 1.5 -pi = 3.14159265358979 -pio8 = pi/8 -pio4 = pi/4 -phi1 = 3.0*pi/8.0 -xx = r*cos(pio8)*cos(pio8) -yy = r*sin(pio8)*cos(pio8) -zz = r*sin(pio8) - -xxx = r*cos(pio4)*cos(phi1) -yyy = r*sin(pio4)*cos(phi1) -zzz = r*sin(phi1) - -MblkEuler { - - advection_test = 1 - - // 0, cartesian, 1 R translation, 2 rigid body theta rotation, 4, rigid body phi rotation - advection_vel_type = 0 - - // advection_velocity = 2.0e0 , 0.0e0 , 0.0e0 - // advection_velocity = 0.0e0 , 2.0e0 , 0.0e0 - advection_velocity = 0.0e0 , 0.0e0 , 2.0e0 - - data_problem = "SPHERE" - - // center = xx, yy, zz // middle of block 0 - // center = yy, xx, zz // middle of block 1 - // center = xxx, yyy, zzz // middle of block 2 - // center = 0.75 , 0.75, 0.75 // middle of the shell - // front_position = 0.0, 0.2, 1.e20 - - center = 0.75 , 0.75, 0.75 // middle of the shell - front_position = 0.0, 0.2, 1.e20 - - state_names = "rho" - - state_data { - rho = 1.0, 2.0 - } - -/* - state_names = "rho", "u", "v", "w", "p", "ss" - - state_data { - rho = 1.0, 2.0 - u = 1.0, 0.0 - v = 1.0, 4.0 - w = 1.0, 0.0 - p = 1.0, 6.0 - ss = 1.0, 0.0 - } -*/ - - Refinement_data { - refine_criteria = "GRADIENT" - - GRADIENT { - names = "rho" - rho = 0.5 - } - } - -} - - -// ------------------------------------------------------------------- -// hydro blocks -// ------------------------------------------------------------------- - -Main { - dim = 3 -// log file parameters - log_file_name = "octant.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_octant-cart" - viz_dump_filename = "octant" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_octant" - -} - - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -PatchHierarchy { - max_levels = MLEVELS // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40, 40, 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 2 , 2 , 2 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - // efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - // combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - efficiency_tolerance = 0.7e0 // min % of tag cells in new patch level - combine_efficiency = 0.7e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator{ - cfl = 0.5e0 // max cfl factor used in problem - cfl_init = 0.5e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - - -TimeRefinementIntegrator{ - tag_buffer = 2, 2, 2 // number of zones used in the tag buffer - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 100 // max number of simulation timesteps -} - - -LoadBalancer { -} - - -// ------------------------------------------------------------------- -// The mesh -// ------------------------------------------------------------------- - - -Multiblock { - num_blocks = 3 - - // Geometries of the hierachy blocks - BlockGeometry0{ - domain_boxes = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - } - BlockGeometry1{ - domain_boxes = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - } - BlockGeometry2{ - domain_boxes = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - } - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 , 1 , 2 - sing_box_0 = [ (0,NRAD,NRAD), (NRADM,NRAD,NRAD) ] - sing_box_1 = [ (0,-1, NRAD), (NRADM,-1, NRAD) ] - sing_box_2 = [ (0,NRAD,NRAD), (NRADM,NRAD,NRAD) ] - } - - BlockNeighbors0 { - block_a = 0 - block_b = 1 - - rotation_b_to_a = "I_UP", "J_UP", "K_UP" - point_in_a_space = 0, NRAD, 0 - point_in_b_space = 0, 0, 0 - } - - BlockNeighbors1 { - block_a = 0 - block_b = 2 - - // j index in block a is k up in block b index - rotation_b_to_a = "I_UP", "K_UP" , "J_DOWN" - point_in_a_space = 0, 0, NRAD - point_in_b_space = 0, NRADM, 0 - } - - BlockNeighbors2 { - block_a = 1 - block_b = 2 - - rotation_b_to_a = "I_UP", "J_DOWN" , "K_DOWN" - point_in_a_space = 0, 0, NRAD - point_in_b_space = 0, NRADM , NRADM - } - -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/wedge_1blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/wedge_1blk.3d.input deleted file mode 100644 index 0727b60b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/example_inputs/wedge_1blk.3d.input +++ /dev/null @@ -1,249 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ -MblkGeometry { - problem_type = "WEDGE" - - WedgeGeometry { - rmin_0 = 1.e0 - rmax_0 = 2.e0 - - pi = 3.14159265358979325873406851315 - thmin = -30 * pi/180 // should be in radians - thmax = 30 * pi/180 - - zmin = 0. - zmax = 2. - - } -} - - -MblkEuler { - - advection_test = 1 - - advection_velocity = 2.0e0 , 0.1e0 , 0.1e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 0.75 - center = 1.25 , -0.5 , 1.0 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -Main { - dim = 3 -// log file parameters - log_file_name = "wedge.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_wedge" - viz_dump_filename = "wedge" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_wedge" - -} - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -Multiblock { - num_blocks = 1 - - // Geometries of the hierachy blocks - BlockGeometry0{ - domain_boxes = [ (0,0,0) , (29,19,19) ] - } - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 - sing_box_0 = [(30,20,20),(30,20,20)] - } - -} - -PatchHierarchy { - max_levels = 1 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 9 , 9 , 9 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/main.C b/base/SAMRAI/SAMRAI/source/test/MblkEuler/main.C index 224b5922..4596a8f0 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/main.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Run multiblock Euler AMR * ************************************************************************/ @@ -24,6 +24,7 @@ using namespace std; // Headers for basic SAMRAI objects +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/RestartManager.h" @@ -40,9 +41,13 @@ using namespace std; // Header for application-specific algorithm/data structure object -#include "MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" #include "MblkEuler.h" +#ifdef _OPENMP +#include +#endif + using namespace SAMRAI; void @@ -103,6 +108,14 @@ int main( tbox::PIO::logOnlyNodeZero(log_file_name); } +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif + tbox::plog << "input_filename = " << input_filename << endl; tbox::plog << "restart_read_dirname = " << restart_read_dirname << endl; tbox::plog << "restore_num = " << restore_num << endl; @@ -255,7 +268,6 @@ int main( input_db->getDatabase("HyperbolicLevelIntegrator"), euler_model, mblk_patch_hierarchy, - true, use_refined_timestepping)); // @@ -263,19 +275,20 @@ int main( // boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", mblk_hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); + new mesh::BergerRigoutsos(dim, + input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer( dim, "TreeLoadBalancer", - input_db->getDatabase("TreeLoadBalancer"))); + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); boost::shared_ptr mblk_gridding_algorithm( @@ -468,9 +481,7 @@ void setupHierarchy( boost::shared_ptr& geometry, boost::shared_ptr& mblk_hierarchy) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif boost::shared_ptr mult_db( main_input_db->getDatabase("PatchHierarchy")); @@ -497,7 +508,6 @@ void setupHierarchy( new hier::PatchHierarchy( "PatchHierarchy", geometry, - mult_db, - true)); + mult_db)); } diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/skelbdry.f b/base/SAMRAI/SAMRAI/source/test/MblkEuler/skelbdry.f deleted file mode 100644 index 35ed9eb1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/skelbdry.f +++ /dev/null @@ -1,1414 +0,0 @@ -c -c*********************************************************************** -c*********************************************************************** - subroutine getskelfacebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_cartbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (-1, 0, 0) 2 (0,-1, 0) 4 (0, 0,-1) -c 1 ( 1, 0, 0) 3 (0, 1, 0) 5 (0, 0, 1) -c*********************************************************************** -c*********************************************************************** - face_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.ZLEFT).or.(bdry_loc.eq.ZRIGHT)) then - if (bdry_loc.eq.ZLEFT) then -c z0 boundary - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else -c z1 boundary - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskeledgebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) -c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) -c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) -c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) -c*********************************************************************** -c*********************************************************************** - if ((bdry_loc.eq.Y0Z0).or.(bdry_loc.eq.Y1Z0).or. - & (bdry_loc.eq.Y0Z1).or.(bdry_loc.eq.Y1Z1)) then - if (bdry_loc.eq.Y0Z0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y1Z0) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y0Z1) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Z0).or.(bdry_loc.eq.X0Z1).or. - & (bdry_loc.eq.X1Z0).or.(bdry_loc.eq.X1Z1)) then - if (bdry_loc.eq.X0Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X0Z1) then - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Y0).or.(bdry_loc.eq.X1Y0).or. - & (bdry_loc.eq.X0Y1).or.(bdry_loc.eq.X1Y1)) then - if (bdry_loc.eq.X0Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else if (bdry_loc.eq.X0Y1) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskelnodebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1,-1,-1) 4 (-1,-1, 1) -c 1 ( 1,-1,-1) 5 ( 1,-1, 1) -c 2 (-1, 1,-1) 6 (-1, 1, 1) -c 3 ( 1, 1,-1) 7 ( 1, 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y0Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y1Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y1Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y0Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y0Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X0Y1Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y1Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getskelnodebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdryloc3d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - -c 3d faces - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - ZLEFT=ZLEFTin - ZRIGHT=ZRIGHTin - -c 3d edges - Y0Z0=Y0Z0in - Y1Z0=Y1Z0in - Y0Z1=Y0Z1in - Y1Z1=Y1Z1in - X0Z0=X0Z0in - X0Z1=X0Z1in - X1Z0=X1Z0in - X1Z1=X1Z1in - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - -c 3d nodes - X0Y0Z0=X0Y0Z0in - X1Y0Z0=X1Y0Z0in - X0Y1Z0=X0Y1Z0in - X1Y1Z0=X1Y1Z0in - X0Y0Z1=X0Y0Z1in - X1Y0Z1=X1Y0Z1in - X0Y1Z1=X0Y1Z1in - X1Y1Z1=X1Y1Z1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdrycond3d( - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - ZFLOW=ZFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - ZREFLECT=ZREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - ZDIRICHLET=ZDIRICHLETin - - NEUMANN=NEUMANNin - XNEUMANN=XNEUMANNin - YNEUMANN=YNEUMANNin - ZNEUMANN=ZNEUMANNin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/test_inputs/octant_3blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkEuler/test_inputs/octant_3blk.3d.input index 31acede5..35bc5266 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/test_inputs/octant_3blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MblkEuler/test_inputs/octant_3blk.3d.input @@ -3,136 +3,112 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for the multiblock linear advector for * advecting a blob through a spherical shell * ************************************************************************/ -// ------------------------------------------------------------------- -// problem setup -// ------------------------------------------------------------------- - -// ----------------- define the size of each block -NRAD = 20 // 4 -NRADM = NRAD - 1 -MLEVELS = 2 - MblkGeometry { + + //Choices are CARTESIAN, WEDGE, and SPHERICAL_SHELL. Only SPHERICAL_SHELL + //sets up a multiblock problem. problem_type = "SPHERICAL_SHELL" + //Define the parameters of the shell ShellGeometry { + //Minimum and maximum sperical radii, no default rmin = 1.e0 rmax = 2.e0 + //Choices are SOLID and OCTANT, no default shell_type = "OCTANT" } - - // The refinement boxes are specified here because the MultiblockGriddingAlg does not have any - // way to take in refinement boxes for multiple blocks. The format is "refine_boxes[block][lev]". - // level 0 - // refine_boxes_0_0 = [(5,0,0),(5,9,9)] - // refine_boxes_1_0 = [(5,0,0),(5,9,9)] - // refine_boxes_2_0 = [(5,0,0),(5,9,9)] - // level 1 - // refine_boxes_0_1 = [(20,0,0),(20,39,39)] - // refine_boxes_1_1 = [(20,0,0),(20,39,39)] - // refine_boxes_2_1 = [(20,0,0),(20,39,39)] } -// -------------- some calculations for placing the blob in the middle of each octant -r = 1.5 -pi = 3.14159265358979 -pio8 = pi/8 -pio4 = pi/4 -phi1 = 3.0*pi/8.0 -xx = r*cos(pio8)*cos(pio8) -yy = r*sin(pio8)*cos(pio8) -zz = r*sin(pio8) - -xxx = r*cos(pio4)*cos(phi1) -yyy = r*sin(pio4)*cos(phi1) -zzz = r*sin(phi1) - MblkEuler { - advection_test = 1 - - // 0, cartesian, 1 R translation, 2 rigid body theta rotation, 4, rigid body phi rotation + // advection velocity type, no default + // 0 - cartesian + // 1 - R translation + // 2 - rigid body theta rotation + // 4 - rigid body phi rotation advection_vel_type = 1 - - // advection_velocity = 2.0e0 , 0.0e0 , 0.0e0 - // advection_velocity = 0.0e0 , 2.0e0 , 0.0e0 + + // advection velocity vector--vector of length dim. + // No default advection_velocity = 0.0e0 , 0.0e0 , 2.0e0 + // General type of problem and its initial conditions. Options are + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z" + // Specific Initial_data inputs vary by problem type. + // No default. data_problem = "SPHERE" - // center = xx, yy, zz // middle of block 0 - // center = yy, xx, zz // middle of block 1 - // center = xxx, yyy, zzz // middle of block 2 - // center = 0.75 , 0.75, 0.75 // middle of the shell - // front_position = 0.0, 0.2, 1.e20 - + // Position of the middle of the shell--vector of length dim center = 0.0, 0.0, 0.0 // middle of the shell + + // Position of the front--vector of length dim front_position = 0.0, 1.5, 1.e20 + // List names of state data to initialize state_names = "rho" + // Initial values for rho in each region state_data { rho = 1.0, 2.0 } -/* - state_names = "rho", "u", "v", "w", "p", "ss" - - state_data { - rho = 1.0, 2.0 - u = 1.0, 0.0 - v = 1.0, 4.0 - w = 1.0, 0.0 - p = 1.0, 6.0 - ss = 1.0, 0.0 - } -*/ - + // Control of how to refine. Refinement_data { - refine_criteria = "GRADIENT" - - GRADIENT { - names = "rho" - rho = 0.5 - } + // Can be GRADIENT or USER_DEFINED. No default + refine_criteria = "GRADIENT" + + // Identify name of variable and a gradient tolerance. Tagging will + // occur where the gradient is greater than the tolerance. + GRADIENT { + names = "rho" + rho = 0.5 // gradient tolerance for rho + } } } -// ------------------------------------------------------------------- -// hydro blocks -// ------------------------------------------------------------------- Main { + + // Dimension of problem. No default. dim = 3 -// log file parameters - log_file_name = "octant.log" - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off + // Default is 0. viz_dump_interval = 1 // zero to turn off + + // Directory in which to place viz output. + // No default, error will occur if viz_dump_interval > 0 and + // this directory name is not specified. viz_dump_dirname = "viz_octant-3blk" - viz_dump_filename = "octant" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai + // Number of processors that write to each viz file, default is 1. + visit_number_procs_per_file = 1 -// restart dump parameters + // Frequency at which to dump restart output--zero to turn off + // Default is 0. restart_interval = 0 // zero to turn off + + // Directory in which to place restart output. + // No default, error will occur if restart_interval > 0 and + // this directory name is not specified. restart_write_dirname = "restart_octant" } - +// Refer to tbox::TimerManager for input TimerManager { // timer_list = "apps::*::*", // "algs::*::*", @@ -144,30 +120,34 @@ TimerManager { print_threshold = 0.0 } - -GriddingAlgorithm{ +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.7e0 // min % of tag cells in new patch level combine_efficiency = 0.7e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ sequentialize_patch_indices = TRUE } - +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } - +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.5e0 // max cfl factor used in problem cfl_init = 0.5e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE + do_coarsening = FALSE } - +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ tag_buffer = 2, 2, 2 // number of zones used in the tag buffer start_time = 0.e0 // initial simulation time @@ -176,38 +156,24 @@ TimeRefinementIntegrator{ max_integrator_steps = 10 // 2 // 100 // max number of simulation timesteps } - +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { } - -// ------------------------------------------------------------------- -// The mesh -// ------------------------------------------------------------------- - - -// Geometries of the hierachy blocks +// Refer to hier::BaseGridGeometry and geom::GridGeometry for input BlockGeometry { num_blocks = 3 - domain_boxes_0 = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - domain_boxes_1 = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - domain_boxes_2 = [ (0,0,0) , (NRADM,NRADM,NRADM) ] - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 , 1 , 2 - sing_box_0 = [ (0,NRAD,NRAD), (NRADM,NRAD,NRAD) ] - sing_box_1 = [ (0,-1, NRAD), (NRADM,-1, NRAD) ] - sing_box_2 = [ (0,NRAD,NRAD), (NRADM,NRAD,NRAD) ] - } + domain_boxes_0 = [ (0,0,0) , (19,19,19) ] + domain_boxes_1 = [ (0,0,0) , (19,19,19) ] + domain_boxes_2 = [ (0,0,0) , (19,19,19) ] BlockNeighbors0 { block_a = 0 block_b = 1 rotation_b_to_a = "I_UP", "J_UP", "K_UP" - point_in_a_space = 0, NRAD, 0 + point_in_a_space = 0, 20, 0 point_in_b_space = 0, 0, 0 } @@ -217,8 +183,8 @@ BlockGeometry { // j index in block a is k up in block b index rotation_b_to_a = "I_UP", "K_UP" , "J_DOWN" - point_in_a_space = 0, 0, NRAD - point_in_b_space = 0, NRADM, 0 + point_in_a_space = 0, 0, 20 + point_in_b_space = 0, 19, 0 } BlockNeighbors2 { @@ -226,14 +192,14 @@ BlockGeometry { block_b = 2 rotation_b_to_a = "I_UP", "J_DOWN" , "K_DOWN" - point_in_a_space = 0, 0, NRAD - point_in_b_space = 0, NRADM , NRADM + point_in_a_space = 0, 0, 20 + point_in_b_space = 0, 19 , 19 } } - +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = MLEVELS // Maximum number of levels in hierarchy. + max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 , 2 } diff --git a/base/SAMRAI/SAMRAI/source/test/MblkEuler/upfluxsum.f b/base/SAMRAI/SAMRAI/source/test/MblkEuler/upfluxsum.f deleted file mode 100644 index ada85018..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkEuler/upfluxsum.f +++ /dev/null @@ -1,242 +0,0 @@ -c -c File: algs_upfluxsum3d.m4 -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 3d flux sums from fluxes. -c -c -c File: pdat_m4arrdim3d.i -c Package: SAMRAI patchdata -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: m4 include file for dimensioning 3d arrays in FORTRAN routines. -c -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -c -c - subroutine upfluxsumface3d0( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo1:ihi1, - & ilo2:ihi2) - integer ie0,ic1,ic2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie0 = ilo0 - else - ie0 = ihi0+1 - endif - - do ic2=ilo2,ihi2 - do ic1=ilo1,ihi1 - fluxsum(ic1,ic2)=fluxsum(ic1,ic2)+flux(ie0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumface3d1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo2:ihi2) - integer ie1,ic2,ic0 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie1 = ilo1 - else - ie1 = ihi1+1 - endif - - do ic0=ilo0,ihi0 - do ic2=ilo2,ihi2 - fluxsum(ic2,ic0)=fluxsum(ic2,ic0)+flux(ie1,ic2,ic0) - enddo - enddo -c - return - end -c - subroutine upfluxsumface3d2( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+1+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo1:ihi1) - integer ie2,ic0,ic1 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie2 = ilo2 - else - ie2 = ihi2+1 - endif - - do ic1=ilo1,ihi1 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic1)=fluxsum(ic0,ic1)+flux(ie2,ic0,ic1) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d0( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+1+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo1:ihi1, - & ilo2:ihi2) - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic0 = ilo0 - else - ic0 = ihi0+1 - endif - - do ic2=ilo2,ihi2 - do ic1=ilo1,ihi1 - fluxsum(ic1,ic2)=fluxsum(ic1,ic2)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+1+flxgc1, - & ilo2-flxgc2:ihi2+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo2:ihi2) - integer ic1,ic0,ic2 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic1 = ilo1 - else - ic1 = ihi1+1 - endif - - do ic2=ilo2,ihi2 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic2)=fluxsum(ic0,ic2)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -c - subroutine upfluxsumside3d2( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - double precision - & flux(ilo0-flxgc0:ihi0+flxgc0, - & ilo1-flxgc1:ihi1+flxgc1, - & ilo2-flxgc2:ihi2+1+flxgc2), - & fluxsum(ilo0:ihi0, - & ilo1:ihi1) - integer ic2,ic0,ic1 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic2 = ilo2 - else - ic2 = ihi2+1 - endif - - do ic1=ilo1,ihi1 - do ic0=ilo0,ihi0 - fluxsum(ic0,ic1)=fluxsum(ic0,ic1)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/GeomUtilsAMR.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/GeomUtilsAMR.h deleted file mode 100644 index bdf6af0b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/GeomUtilsAMR.h +++ /dev/null @@ -1,449 +0,0 @@ -/************************************************************************** - * Module: GeomUtilsAMR - * Purpose: inline functions for the ale3d amr apps - ***************************************************************************/ - -#ifndef __GeomUtilsAMR_h -#define __GeomUtilsAMR_h - -// -// calculate the flux through a face -// -real8 -UpwindFlux( - const real8 x1, - const real8 x2, - const real8 x3, - const real8 x4, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 y4, - const real8 z1, - const real8 z2, - const real8 z3, - const real8 z4, - real8 u, - real8 v, - real8 w, - real8 psiLo, - real8 psiHi) -{ - real8 dx31 = x3 - x1; - real8 dx42 = x4 - x2; - - real8 dy31 = y3 - y1; - real8 dy42 = y4 - y2; - - real8 dz31 = z3 - z1; - real8 dz42 = z4 - z2; - - real8 Ax = 0.5 * (dy42 * dz31 - dz42 * dy31); - real8 Ay = 0.5 * (dz42 * dx31 - dx42 * dz31); - real8 Az = 0.5 * (dx42 * dy31 - dy42 * dx31); - - real8 Audotn = Ax * u + Ay * v + Az * w; - - real8 flux = (Audotn > 0.0 ? psiLo : psiHi) * Audotn; - - return flux; -} - -// -// calculate the flux through a face, assuming a velocity in the radial -// direction -// -real8 -UpwindFluxRadial( - const real8 x1, - const real8 x2, - const real8 x3, - const real8 x4, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 y4, - const real8 z1, - const real8 z2, - const real8 z3, - const real8 z4, - real8 u0, - real8 psiLo, - real8 psiHi) -{ - // --------- set the velocity - real8 xm = 0.25 * (x1 + x2 + x3 + x4); - real8 ym = 0.25 * (y1 + y2 + y3 + y4); - real8 zm = 0.25 * (z1 + z2 + z3 + z4); - real8 xnorm = sqrt(xm * xm + ym * ym + zm * zm); - - real8 u = u0 * xm / xnorm; - real8 v = u0 * ym / xnorm; - real8 w = u0 * zm / xnorm; - - // --------- set the flux - real8 dx31 = x3 - x1; - real8 dx42 = x4 - x2; - - real8 dy31 = y3 - y1; - real8 dy42 = y4 - y2; - - real8 dz31 = z3 - z1; - real8 dz42 = z4 - z2; - - real8 Ax = 0.5 * (dy42 * dz31 - dz42 * dy31); - real8 Ay = 0.5 * (dz42 * dx31 - dx42 * dz31); - real8 Az = 0.5 * (dx42 * dy31 - dy42 * dx31); - - real8 Audotn = Ax * u + Ay * v + Az * w; - - real8 flux = (Audotn > 0.0 ? psiLo : psiHi) * Audotn; - - return flux; -} - -// -// calculate the volume of a hexahedral element -// -real8 -UpwindVolume( - const real8 x0, - const real8 x1, - const real8 x2, - const real8 x3, - const real8 x4, - const real8 x5, - const real8 x6, - const real8 x7, - const real8 y0, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 y4, - const real8 y5, - const real8 y6, - const real8 y7, - const real8 z0, - const real8 z1, - const real8 z2, - const real8 z3, - const real8 z4, - const real8 z5, - const real8 z6, - const real8 z7) -{ - const real8 twelfth = 1.0 / 12.0; - real8 volume, s1234, s5678, s1265, s4378, s2376, s1485; - - s1234 = - (x1 + x2) * ((y0 + y1) * (z2 + z3) - (z0 + z1) * (y2 + y3)) - + (y1 + y2) * ((z0 + z1) * (x2 + x3) - (x0 + x1) * (z2 + z3)) - + (z1 + z2) * ((x0 + x1) * (y2 + y3) - (y0 + y1) * (x2 + x3)); - - s5678 = - (x5 + x6) * ((y4 + y5) * (z6 + z7) - (z4 + z5) * (y6 + y7)) - + (y5 + y6) * ((z4 + z5) * (x6 + x7) - (x4 + x5) * (z6 + z7)) - + (z5 + z6) * ((x4 + x5) * (y6 + y7) - (y4 + y5) * (x6 + x7)); - - s1265 = - (x1 + x5) * ((y0 + y1) * (z5 + z4) - (z0 + z1) * (y5 + y4)) - + (y1 + y5) * ((z0 + z1) * (x5 + x4) - (x0 + x1) * (z5 + z4)) - + (z1 + z5) * ((x0 + x1) * (y5 + y4) - (y0 + y1) * (x5 + x4)); - - s4378 = - (x2 + x6) * ((y3 + y2) * (z6 + z7) - (z3 + z2) * (y6 + y7)) - + (y2 + y6) * ((z3 + z2) * (x6 + x7) - (x3 + x2) * (z6 + z7)) - + (z2 + z6) * ((x3 + x2) * (y6 + y7) - (y3 + y2) * (x6 + x7)); - - s2376 = - (x2 + x6) * ((y1 + y2) * (z6 + z5) - (z1 + z2) * (y6 + y5)) - + (y2 + y6) * ((z1 + z2) * (x6 + x5) - (x1 + x2) * (z6 + z5)) - + (z2 + z6) * ((x1 + x2) * (y6 + y5) - (y1 + y2) * (x6 + x5)); - - s1485 = - (x3 + x7) * ((y0 + y3) * (z7 + z4) - (z0 + z3) * (y7 + y4)) - + (y3 + y7) * ((z0 + z3) * (x7 + x4) - (x0 + x3) * (z7 + z4)) - + (z3 + z7) * ((x0 + x3) * (y7 + y4) - (y0 + y3) * (x7 + x4)); - - volume = (s1234 - s5678 - s1265 + s4378 - s2376 + s1485) * twelfth; - return volume; -} - -// -// compute the area of a face -// -real8 -UpwindAreaFace( - const real8 x0, - const real8 x1, - const real8 x2, - const real8 x3, - const real8 y0, - const real8 y1, - const real8 y2, - const real8 y3, - const real8 z0, - const real8 z1, - const real8 z2, - const real8 z3) -{ - real8 fx = (x2 - x0) - (x3 - x1); - real8 fy = (y2 - y0) - (y3 - y1); - real8 fz = (z2 - z0) - (z3 - z1); - real8 gx = (x2 - x0) + (x3 - x1); - real8 gy = (y2 - y0) + (y3 - y1); - real8 gz = (z2 - z0) + (z3 - z1); - real8 area = - (fx * fx + fy * fy + fz * fz) - * (gx * gx + gy * gy + gz * gz) - - (fx * gx + fy * gy + fz * gz) - * (fx * gx + fy * gy + fz * gz); - return area; -} - -// -// compute a characteristic length -// -real8 -UpwindCharacteristicLength( - const real8 x[8], - const real8 y[8], - const real8 z[8], - const real8 volume) -{ - real8 a, charLength = 0.0; - - a = UpwindAreaFace(x[0], x[1], x[2], x[3], - y[0], y[1], y[2], y[3], - z[0], z[1], z[2], z[3]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[4], x[5], x[6], x[7], - y[4], y[5], y[6], y[7], - z[4], z[5], z[6], z[7]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[0], x[1], x[5], x[4], - y[0], y[1], y[5], y[4], - z[0], z[1], z[5], z[4]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[1], x[2], x[6], x[5], - y[1], y[2], y[6], y[5], - z[1], z[2], z[6], z[5]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[2], x[3], x[7], x[6], - y[2], y[3], y[7], y[6], - z[2], z[3], z[7], z[6]); - charLength = MAX(a, charLength); - - a = UpwindAreaFace(x[3], x[0], x[4], x[7], - y[3], y[0], y[4], y[7], - z[3], z[0], z[4], z[7]); - charLength = MAX(a, charLength); - - charLength = 4.0 * volume / sqrt(charLength); - - return charLength; -} - -/// -/// the non-uniform grid monotonic slope finder -/// -void -my_slopes( - double psi, - double pim, - double pip, - double pjm, - double pjp, - double pkm, - double pkp, - double w_i, - double w_ip, - double w_im, - double w_jp, - double w_jm, - double w_kp, - double w_km, - double& pxi, - double& peta, - double& pzeta) -{ - real8 sumf, sumb; - real8 elDenm, elDenp, del, sfp, sbm, scale; - - real8 elDenC = psi; - real8 scale_fact = 1.0; - real8 slope_fact = 1.0; - - // - // compute weight functions - // - real8 volzrc = w_i; - - real8 volzrxim = w_im; - real8 volzrxip = w_ip; - real8 volzretam = w_jm; - real8 volzretap = w_jp; - real8 volzrzetam = w_km; - real8 volzrzetap = w_kp; - - sumf = volzrc + volzrxip; - sumb = volzrc + volzrxim; - real8 wgtxi1 = volzrc / sumf; - real8 wgtxi2 = volzrxip / sumf; - real8 wgtxi3 = volzrc / sumb; - real8 wgtxi4 = volzrxim / sumb; - - sumf = volzrc + volzretap; - sumb = volzrc + volzretam; - real8 wgteta1 = volzrc / sumf; - real8 wgteta2 = volzretap / sumf; - real8 wgteta3 = volzrc / sumb; - real8 wgteta4 = volzretam / sumb; - - sumf = volzrc + volzrzetap; - sumb = volzrc + volzrzetam; - real8 wgtzeta1 = volzrc / sumf; - real8 wgtzeta2 = volzrzetap / sumf; - real8 wgtzeta3 = volzrc / sumb; - real8 wgtzeta4 = volzrzetam / sumb; - - elDenm = pim; - elDenp = pip; - - del = (wgtxi2 * elDenp + wgtxi1 * elDenC - - wgtxi4 * elDenm - wgtxi3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - pxi = slope_fact * del * scale; - - // --------------------------------- eta - - elDenm = pjm; - elDenp = pjp; - - del = (wgteta2 * elDenp + wgteta1 * elDenC - - wgteta4 * elDenm - wgteta3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - peta = slope_fact * del * scale; - - // --------------------------------- zeta - - elDenm = pkm; - elDenp = pkp; - - del = (wgtzeta2 * elDenp + wgtzeta1 * elDenC - - wgtzeta4 * elDenm - wgtzeta3 * elDenC) + 1e-80; - - sfp = (elDenp - elDenC) * scale_fact / del; - sbm = (elDenC - elDenm) * scale_fact / del; - - scale = MIN(sfp, sbm); - if (scale > 1.) - scale = 1.0; - else if (scale < 0.) - scale = 0.; - - if ((sfp * sbm) < 0.0) scale = 0.; - - pzeta = slope_fact * del * scale; -} - -/// -/// the cartesian uniform grid monotonic slope finder -/// -void -my_slopesCart( - double psi, - double pim, - double pip, - double pjm, - double pjp, - double pkm, - double pkp, - double& pxi, - double& peta, - double& pzeta) -{ - real8 del, sfp, sbm, scale; - real8 elDenp, elDenC, elDenm; - real8 sfact = 0.25; // due to the fact that xi ranges from -1 to 1 - elDenC = psi; - - // - // xi - // - elDenp = pip; - elDenm = pim; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - pxi = del * scale; // xi, eta, zeta vary from -1 to 1 - - // - // eta - // - elDenp = pjp; - elDenm = pjm; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - peta = del * scale; - - // - // eta - // - elDenp = pkp; - elDenm = pkm; - - del = sfact * (elDenp - elDenm) + 1.e-80; - sfp = (elDenp - elDenC) * 2. / del; - sbm = (elDenC - elDenm) * 2. / del; - - scale = MIN(sfp, sbm); - scale = (scale > 1.0 ? 1.0 : scale); - scale = (scale < 0.0 ? 0.0 : scale); - scale = (sfp * sbm < 0.0 ? 0.0 : scale); - - pzeta = del * scale; -} - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.depend index 73285e84..18164653 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -35,6 +35,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -54,7 +55,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -67,16 +67,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MblkGeometry.C \ MblkGeometry.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -84,16 +83,21 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} -FILE_1=MblkHyperbolicLevelIntegrator.o +${FILE_0}: ${DEPENDS_0} + +FILE_1=MblkLinAdv.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -114,6 +118,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -126,37 +132,51 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleInjection.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ @@ -165,31 +185,32 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ @@ -205,54 +226,55 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.C MblkHyperbolicLevelIntegrator.h \ - MblkHyperbolicPatchStrategy.h + $(TESTLIBDIR)/GeomUtilsAMR.h \ + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h \ + $(TESTLIBDIR)/SkeletonBoundaryUtilities2.h \ + $(TESTLIBDIR)/SkeletonBoundaryUtilities3.h \ + $(TESTLIBDIR)/SkeletonCellDoubleConservativeLinearRefine.h \ + $(TESTLIBDIR)/SkeletonCellDoubleWeightedAverage.h MblkGeometry.h\ + MblkLinAdv.C MblkLinAdv.h \ + SkeletonOutersideDoubleWeightedAverage.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=MblkHyperbolicPatchStrategy.o +${FILE_1}: ${DEPENDS_1} + +FILE_2=SkeletonOutersideDoubleWeightedAverage.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ @@ -263,27 +285,28 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -292,45 +315,44 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicPatchStrategy.C MblkHyperbolicPatchStrategy.h + SkeletonOutersideDoubleWeightedAverage.C \ + SkeletonOutersideDoubleWeightedAverage.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=MblkLinAdv.o +${FILE_2}: ${DEPENDS_2} + +FILE_3=main.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -340,6 +362,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -351,7 +374,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -363,30 +389,36 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ @@ -395,8 +427,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleInjection.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ @@ -416,12 +446,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -429,13 +459,17 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -459,18 +493,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h GeomUtilsAMR.h \ - MblkGeometry.h MblkHyperbolicLevelIntegrator.h \ - MblkHyperbolicPatchStrategy.h MblkLinAdv.C MblkLinAdv.h \ - SkeletonBoundaryUtilities2.h SkeletonBoundaryUtilities3.h \ - SkeletonCellDoubleConservativeLinearRefine.h \ - SkeletonCellDoubleWeightedAverage.h \ - SkeletonOutersideDoubleWeightedAverage.h + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h \ + $(TESTLIBDIR)/SkeletonCellDoubleConservativeLinearRefine.h \ + $(TESTLIBDIR)/SkeletonCellDoubleWeightedAverage.h MblkGeometry.h\ + MblkLinAdv.h SkeletonOutersideDoubleWeightedAverage.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -488,830 +519,9 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} - -FILE_4=Pointer-MblkHyperbolicLevelIntegrator.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - Pointer-MblkHyperbolicLevelIntegrator.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} - -FILE_5=Pointer-SkeletonCellDoubleConservativeLinearRefine.o -DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonCellDoubleConservativeLinearRefine.C \ - SkeletonCellDoubleConservativeLinearRefine.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} - -FILE_6=Pointer-SkeletonCellDoubleWeightedAverage.o -DEPENDS_6:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonCellDoubleWeightedAverage.C \ - SkeletonCellDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} - -FILE_7=Pointer-SkeletonOutersideDoubleWeightedAverage.o -DEPENDS_7:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonOutersideDoubleWeightedAverage.C \ - SkeletonOutersideDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} - -FILE_8=SkeletonBoundaryUtilities2.o -DEPENDS_8:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonBoundaryUtilities2.C SkeletonBoundaryUtilities2.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} - -FILE_9=SkeletonBoundaryUtilities3.o -DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonBoundaryUtilities3.C SkeletonBoundaryUtilities3.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} - -FILE_10=SkeletonCellDoubleConservativeLinearRefine.o -DEPENDS_10:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonCellDoubleConservativeLinearRefine.C \ - SkeletonCellDoubleConservativeLinearRefine.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} - -FILE_11=SkeletonCellDoubleWeightedAverage.o -DEPENDS_11:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonCellDoubleWeightedAverage.C \ - SkeletonCellDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} - -FILE_12=SkeletonOutersideDoubleWeightedAverage.o -DEPENDS_12:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonOutersideDoubleWeightedAverage.C \ - SkeletonOutersideDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} - -FILE_13=main.o -DEPENDS_13:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h MblkGeometry.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - MblkLinAdv.h SkeletonCellDoubleConservativeLinearRefine.h \ - SkeletonCellDoubleWeightedAverage.h \ - SkeletonOutersideDoubleWeightedAverage.h main.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} +${FILE_3}: ${DEPENDS_3} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.in b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.in index 781f0a18..4a949fde 100755 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for linear advection sample application ## ######################################################################### @@ -14,6 +14,9 @@ SUBDIR = source/test/MblkLinAdv VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check @@ -24,21 +27,19 @@ CPPFLAGS_EXTRA= -DTESTING=0 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = MblkGeometry.o main.o MblkLinAdv.o MblkHyperbolicLevelIntegrator.o \ - MblkHyperbolicPatchStrategy.o Pointer-MblkHyperbolicLevelIntegrator.o \ - SkeletonCellDoubleConservativeLinearRefine.o Pointer-SkeletonCellDoubleConservativeLinearRefine.o \ - SkeletonCellDoubleWeightedAverage.o Pointer-SkeletonCellDoubleWeightedAverage.o \ - SkeletonOutersideDoubleWeightedAverage.o Pointer-SkeletonOutersideDoubleWeightedAverage.o \ - SkeletonBoundaryUtilities2.o \ - SkeletonBoundaryUtilities3.o +CXX_OBJS = MblkGeometry.o main.o MblkLinAdv.o \ + SkeletonOutersideDoubleWeightedAverage.o -F_OBJS = upfluxsum2d.o skelbdry2d.o upfluxsum3d.o skelbdry3d.o - -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ +main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): + check: $(MAKE) check3d @@ -46,59 +47,43 @@ check2d: check3d: main @for i in test_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -examples2d: +examples: -examples3d: main - @for i in $(SRCDIR)/example_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done +perf: -examples: - $(MAKE) examples2d - $(MAKE) examples3d +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) viz* -clean: - $(SAMCLEAN) - $(RM) *.f main viz* +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main redo: $(RM) main include $(SRCDIR)/Makefile.depend -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) - -skelbdry2d.o: $(FORTRAN)/2d/skelbdry2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/skelbdry2d.m4 > skelbdry2d.f - $(F77) $(FFLAGS) -c skelbdry2d.f -o $@ - -upfluxsum2d.o: $(FORTRAN)/2d/upfluxsum2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/upfluxsum2d.m4 > upfluxsum2d.f - $(F77) $(FFLAGS) -c upfluxsum2d.f -o $@ - - -skelbdry3d.o: $(FORTRAN)/3d/skelbdry3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/skelbdry3d.m4 > skelbdry3d.f - $(F77) $(FFLAGS) -c skelbdry3d.f -o $@ - -upfluxsum3d.o: $(FORTRAN)/3d/upfluxsum3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/upfluxsum3d.m4 > upfluxsum3d.f - $(F77) $(FFLAGS) -c upfluxsum3d.f -o $@ - diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.C index 50d94f09..4b5cafee 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: set geometry for multiblock domain * ************************************************************************/ @@ -18,6 +18,9 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include +#include + #define POLY3(i, j, k, imin, jmin, kmin, nx, nxny) \ ((i - imin) + (j - jmin) * (nx) + (k - kmin) * (nxny)) @@ -33,21 +36,19 @@ MblkGeometry::MblkGeometry( const std::string& object_name, const tbox::Dimension& dim, boost::shared_ptr input_db, - const int nblocks): + const size_t nblocks): d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); -#endif d_object_name = object_name; //tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); d_nblocks = nblocks; - d_metrics_set.resizeArray(10); - for (int i = 0; i < 10; i++) { + d_metrics_set.resize(10); + for (int i = 0; i < 10; ++i) { d_metrics_set[i] = false; } @@ -96,12 +97,12 @@ std::string MblkGeometry::getGeometryType() */ bool MblkGeometry::getRefineBoxes( hier::BoxContainer& refine_boxes, - const int block_number, + const hier::BlockId::block_t block_number, const int level_number) { bool boxes_exist = false; - if (block_number < d_refine_boxes.getSize()) { - if (level_number < d_refine_boxes[level_number].getSize()) { + if (block_number < d_refine_boxes.size()) { + if (level_number < static_cast(d_refine_boxes[level_number].size())) { boxes_exist = true; refine_boxes = d_refine_boxes[block_number][level_number]; } @@ -123,15 +124,14 @@ void MblkGeometry::tagOctantCells( const double regrid_time, const int refine_tag_val) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(d_geom_problem == "SPHERICAL_SHELL" && d_sshell_type == "OCTANT"); TBOX_ASSERT(temp_tags); -#endif boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); + TBOX_ASSERT(xyz); if (d_dim == tbox::Dimension(3)) { /* @@ -143,9 +143,9 @@ void MblkGeometry::tagOctantCells( + (regrid_time * d_tag_velocity) + (0.5 * d_tag_width); hier::Box pbox = patch.getBox(); - for (int k = pbox.lower(2); k <= pbox.upper(2) + 1; k++) { - for (int j = pbox.lower(1); j <= pbox.upper(1) + 1; j++) { - for (int i = pbox.lower(0); i <= pbox.upper(0) + 1; i++) { + for (int k = pbox.lower(2); k <= pbox.upper(2) + 1; ++k) { + for (int j = pbox.lower(1); j <= pbox.upper(1) + 1; ++j) { + for (int i = pbox.lower(0); i <= pbox.upper(0) + 1; ++i) { hier::Index ic(i, j, k); pdat::NodeIndex node(ic, pdat::NodeIndex::LLL); hier::Index icm1(i - 1, j - 1, k - 1); @@ -176,9 +176,7 @@ void MblkGeometry::getFromInput( boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif NULL_USE(is_from_restart); @@ -187,9 +185,9 @@ void MblkGeometry::getFromInput( d_geom_problem = db->getString("problem_type"); bool found = false; - int i, nb; + int i; char block_name[128]; - double temp_domain[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double temp_domain[SAMRAI::MAX_DIM_VAL]; /* * Cartesian geometry @@ -199,10 +197,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr cart_db( db->getDatabase("CartesianGeometry")); - d_cart_xlo.resizeArray(d_nblocks); - d_cart_xhi.resizeArray(d_nblocks); + d_cart_xlo.resize(d_nblocks); + d_cart_xhi.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // xlo sprintf(block_name, "domain_xlo_%d", nb); @@ -212,9 +210,9 @@ void MblkGeometry::getFromInput( << "' domain_xlo for block " << nb << " not found in input." << std::endl); } - d_cart_xlo[nb].resizeArray(d_dim.getValue()); + d_cart_xlo[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xlo[nb][i] = temp_domain[i]; } @@ -226,9 +224,9 @@ void MblkGeometry::getFromInput( << "' domain_xhi for block " << nb << " not found in input." << std::endl); } - d_cart_xhi[nb].resizeArray(d_dim.getValue()); + d_cart_xhi[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xhi[nb][i] = temp_domain[i]; } @@ -244,10 +242,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr wedge_db( db->getDatabase("WedgeGeometry")); - d_wedge_rmin.resizeArray(d_nblocks); - d_wedge_rmax.resizeArray(d_nblocks); + d_wedge_rmin.resize(d_nblocks); + d_wedge_rmax.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // rmin sprintf(block_name, "rmin_%d", nb); @@ -337,8 +335,8 @@ void MblkGeometry::getFromInput( /* * Block rotation */ - d_block_rotation.resizeArray(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + d_block_rotation.resize(d_nblocks); + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { d_block_rotation[nb] = 0; sprintf(block_name, "rotation_%d", nb); if (db->keyExists(block_name)) { @@ -359,24 +357,26 @@ void MblkGeometry::getFromInput( * would specify the refinement region on block 2, level 0. * */ - d_refine_boxes.resizeArray(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + d_refine_boxes.resize(d_nblocks); + for (hier::BlockId::block_t nb = 0; nb < d_nblocks; ++nb) { // see what the max number of levels is int max_ln = 0; int ln; - for (ln = 0; ln < 10; ln++) { + for (ln = 0; ln < 10; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - max_ln++; + ++max_ln; } } - d_refine_boxes[nb].resizeArray(max_ln); + d_refine_boxes[nb].resize(max_ln); - for (ln = 0; ln < max_ln; ln++) { + for (ln = 0; ln < max_ln; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - d_refine_boxes[nb][ln] = db->getDatabaseBoxArray(block_name); + std::vector db_box_vector = + db->getDatabaseBoxVector(block_name); + d_refine_boxes[nb][ln] = db_box_vector; } else { TBOX_ERROR( d_object_name << ": input entry `" @@ -401,7 +401,7 @@ void MblkGeometry::buildGridOnPatch( const hier::Box& domain, const int xyz_id, const int level_number, - const int block_number) + const hier::BlockId::block_t block_number) { if (d_geom_problem == "CARTESIAN") { @@ -492,7 +492,7 @@ void MblkGeometry::getDx( << "takes in the domain." << std::endl); } - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { dx[i] = d_dx[level_number][i]; } @@ -507,7 +507,7 @@ void MblkGeometry::getDx( */ int MblkGeometry::getBlockRotation( - const int block_number) + const hier::BlockId::block_t block_number) { return d_block_rotation[block_number]; @@ -529,16 +529,16 @@ void MblkGeometry::setCartesianMetrics( hier::Index upper(domain.upper()); hier::Index diff(upper - lower + hier::Index(lower.getDim(), 1)); - if (d_dx.getSize() < (level_number + 1)) { - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(d_dim.getValue()); + if (static_cast(d_dx.size()) < (level_number + 1)) { + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); } /* * Compute dx from first grid geometry block only. Its assumed * to be uniform across the multiple blocks. */ - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { d_dx[level_number][i] = (d_cart_xhi[0][i] - d_cart_xlo[0][i]) / (double)diff(i); } @@ -559,19 +559,18 @@ void MblkGeometry::buildCartesianGridOnPatch( const hier::Patch& patch, const int xyz_id, const int level_number, - const int block_number) + const hier::BlockId::block_t block_number) { boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif - pdat::NodeIterator niend(patch.getBox(), false); - for (pdat::NodeIterator ni(patch.getBox(), true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(patch.getBox())); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(patch.getBox())); + ni != niend; ++ni) { pdat::NodeIndex node = *ni; if (d_block_rotation[block_number] == 0) { @@ -626,8 +625,8 @@ void MblkGeometry::setWedgeMetrics( // // Set dx (dr, dth, dz) for the level // - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(d_dim.getValue()); + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); double nr = (domain.upper(0) - domain.lower(0) + 1); double nth = (domain.upper(1) - domain.lower(1) + 1); @@ -654,12 +653,12 @@ void MblkGeometry::buildWedgeGridOnPatch( const hier::Patch& patch, const int xyz_id, const int level_number, - const int block_number) + const hier::BlockId::block_t block_number) { boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); TBOX_ASSERT(xyz); @@ -677,7 +676,7 @@ void MblkGeometry::buildWedgeGridOnPatch( int nd_nxny = nd_nx * nd_ny; //int nd_nel = nd_nx*nd_ny*nd_nz; - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double dx[SAMRAI::MAX_DIM_VAL]; dx[0] = d_dx[level_number][0]; dx[1] = d_dx[level_number][1]; @@ -687,7 +686,7 @@ void MblkGeometry::buildWedgeGridOnPatch( int nd_kmin; int nd_kmax; dx[2] = d_dx[level_number][2]; - double* z = NULL; + double* z = 0; if (d_dim == tbox::Dimension(3)) { nd_kmin = ifirst(2) - nghost_cells(2); nd_kmax = ilast(2) + 1 + nghost_cells(2); @@ -702,9 +701,9 @@ void MblkGeometry::buildWedgeGridOnPatch( // ----------- set the wedge nodal positions // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { - for (int i = nd_imin; i <= nd_imax; i++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, nd_imin, nd_jmin, nd_kmin, nd_nx, nd_nxny); @@ -742,8 +741,8 @@ void MblkGeometry::setSShellMetrics( // // Set dx (drad, dth, dphi) for the level // - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(d_dim.getValue()); + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); double nrad = (domain.upper(0) - domain.lower(0) + 1); double nth = (domain.upper(1) - domain.lower(1) + 1); @@ -793,7 +792,7 @@ void MblkGeometry::buildSShellGridOnPatch( const hier::Box& domain, const int xyz_id, const int level_number, - const int block_number) + const hier::BlockId::block_t block_number) { bool xyz_allocated = patch.checkAllocated(xyz_id); @@ -803,12 +802,10 @@ void MblkGeometry::buildSShellGridOnPatch( } boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif if (d_dim == tbox::Dimension(3)) { @@ -863,8 +860,8 @@ void MblkGeometry::buildSShellGridOnPatch( // step in a radial direction in x and set y and z appropriately // for a solid angle we go -th to th and -phi to phi // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { double theta = d_sangle_thmin + j * d_dx[level_number][1]; // dx used for dth double phi = d_sangle_thmin + k * d_dx[level_number][2]; @@ -873,7 +870,7 @@ void MblkGeometry::buildSShellGridOnPatch( double yface = sin(theta) * cos(phi); double zface = sin(phi); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, @@ -913,8 +910,8 @@ void MblkGeometry::buildSShellGridOnPatch( // the block we are in. This is contained in the dispOctant.m // matlab code. // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { // // compute the position on the unit sphere for our radial line @@ -923,7 +920,7 @@ void MblkGeometry::buildSShellGridOnPatch( computeUnitSphereOctant(block_number, nth, j, k, &xface, &yface, &zface); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, @@ -973,7 +970,7 @@ void MblkGeometry::buildSShellGridOnPatch( ************************************************************************* */ void MblkGeometry::computeUnitSphereOctant( - int nblock, + hier::BlockId::block_t nblock, int nth, int j, int k, @@ -1026,7 +1023,7 @@ void MblkGeometry::computeUnitSphereOctant( // // nblock = 1, xface = 2, yface, = 3, zface - int tb = nblock; + int tb = static_cast(nblock); int tj = j; int tk = k; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.h index 738bbddf..fce8cb20 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: set geometry for multiblock domain * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/pdat/CellData.h" @@ -37,7 +36,7 @@ class MblkGeometry const std::string& object_name, const tbox::Dimension& dim, boost::shared_ptr input_db, - const int nblocks); + const size_t nblocks); ~MblkGeometry(); @@ -54,7 +53,7 @@ class MblkGeometry bool getRefineBoxes( hier::BoxContainer& refine_boxes, - const int block_number, + const hier::BlockId::block_t block_number, const int level_number); /*! @@ -68,7 +67,7 @@ class MblkGeometry const hier::Box& domain, const int xyz_id, const int level_number, - const int block_number); + const hier::BlockId::block_t block_number); /*! * Access the stored dx @@ -90,7 +89,7 @@ class MblkGeometry */ int getBlockRotation( - const int block_number); + const hier::BlockId::block_t block_number); /*! * Tag cells for the octant problem. @@ -125,7 +124,7 @@ class MblkGeometry const hier::Patch& patch, const int xyz_id, const int level_number, - const int block_number); + const hier::BlockId::block_t block_number); /* * Wedge grid construction. @@ -140,7 +139,7 @@ class MblkGeometry const hier::Patch& patch, const int xyz_id, const int level_number, - const int block_number); + const hier::BlockId::block_t block_number); /* * Spherical shell grid construction @@ -156,18 +155,18 @@ class MblkGeometry const hier::Box& domain, const int xyz_id, const int level_number, - const int block_number); + const hier::BlockId::block_t block_number); /* * For the spherical shell construction, i always points in the r direction * and j,k are points on the shell. Given a certain j,k compute the * unit sphere locations for block face (actual xyz is computed - * by x = r*xface, y = r*yface, z = r*zface. Note that the dimension + * by x = r*xface, y = r*yface, z = r*zface. Note that the size * in the theta direction (nth) should be the same for each block. */ void computeUnitSphereOctant( - int nblock, + hier::BlockId::block_t nblock, int nth, int j, int k, @@ -187,26 +186,26 @@ class MblkGeometry * The number of blocks and the set of skelton grid geometries that make * up a multiblock mesh. */ - int d_nblocks; - tbox::Array d_metrics_set; + size_t d_nblocks; + std::vector d_metrics_set; /* * The grid spacing. For cartesian, d_dx = (dx,dy,dz). For wedge, * d_dx = (dr, dth, dz). For spherical shell, d_dx = (dr, dth, dphi) */ - tbox::Array > d_dx; + std::vector > d_dx; /* * Cartesian inputs */ - tbox::Array > d_cart_xlo; - tbox::Array > d_cart_xhi; + std::vector > d_cart_xlo; + std::vector > d_cart_xhi; /* * Wedge inputs */ - tbox::Array d_wedge_rmin; - tbox::Array d_wedge_rmax; + std::vector d_wedge_rmin; + std::vector d_wedge_rmax; double d_wedge_thmin; double d_wedge_thmax; double d_wedge_zmin; @@ -234,12 +233,12 @@ class MblkGeometry /* * Specify block rotation. */ - tbox::Array d_block_rotation; + std::vector d_block_rotation; /* * Refine boxes for different blocks/levels */ - tbox::Array > d_refine_boxes; + std::vector > d_refine_boxes; }; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 5f2e661c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,2563 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include -#include -#include -using namespace std; - -#include "SAMRAI/tbox/RestartManager.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/FaceVariable.h" -#include "SAMRAI/pdat/OuterfaceVariable.h" -#include "SAMRAI/pdat/OutersideVariable.h" -#include "SAMRAI/pdat/SideVariable.h" - -//#define RECORD_STATS -#undef RECORD_STATS -#ifdef RECORD_STATS -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" -#endif - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in flux - * synchronization process between hierarchy levels. - * - ************************************************************************* - */ - -extern "C" { -// in upfluxsum.m4: - -void F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); - -void F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -} - -#ifndef NULL -#define NULL (0) -#endif - -#define ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION (3) - -using namespace SAMRAI; -using namespace algs; - -/* - ************************************************************************* - * - * This constructor sets the HyperbolicPatchStrategy pointer and - * initializes integration parameters to default values. Communication - * algorithms are created here too. Other data members are read in - * from the input database or from the restart database corresponding - * to the specified object_name. - * - ************************************************************************* - */ - -MblkHyperbolicLevelIntegrator::MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - const boost::shared_ptr& mblk_hierarchy, - const bool register_for_restart, - const bool use_time_refinement): - d_patch_strategy(patch_strategy), - d_object_name(object_name), - d_dim(dim), - d_use_time_refinement(use_time_refinement), - d_registered_for_restart(register_for_restart), - d_cfl(tbox::MathUtilities::getSignalingNaN()), - d_cfl_init(tbox::MathUtilities::getSignalingNaN()), - d_lag_dt_computation(true), - d_use_ghosts_for_dt(false), - d_flux_is_face(true), - d_flux_face_registered(false), - d_flux_side_registered(false), - d_mblk_bdry_fill_advance(new xfer::RefineAlgorithm(dim)), - d_mblk_bdry_fill_advance_new(new xfer::RefineAlgorithm(dim)), - d_mblk_bdry_fill_advance_old(new xfer::RefineAlgorithm(dim)), - d_mblk_coarsen_fluxsum(new xfer::CoarsenAlgorithm(dim)), - d_mblk_coarsen_sync_data(new xfer::CoarsenAlgorithm(dim)), - d_mblk_sync_initial_data(new xfer::CoarsenAlgorithm(dim)), - d_coarsen_rich_extrap_init(new xfer::CoarsenAlgorithm(dim)), - d_coarsen_rich_extrap_final(new xfer::CoarsenAlgorithm(dim)), - d_mblk_fill_new_level(new xfer::RefineAlgorithm(dim)), - d_number_time_data_levels(2), - d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")), - d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_new(hier::VariableDatabase::getDatabase()->getContext("NEW")), - d_plot_context( - hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_have_flux_on_level_zero(false), - d_distinguish_mpi_reduction_costs(false), - t_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_comm")), - t_error_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_create")), - t_error_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_comm")), - t_mpi_reductions(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::mpi_reductions")), - t_initialize_level_data(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::initializeLevelData()")), - t_fill_new_level_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_create")), - t_fill_new_level_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_comm")), - t_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_create")), - t_new_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_create")), - t_apply_gradient_detector(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::applyGradientDetector()")), - t_coarsen_rich_extrap(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_rich_extrap")), - t_get_level_dt(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()")), - t_get_level_dt_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()_sync")), - t_advance_level(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()")), - t_new_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_comm")), - t_patch_num_kernel(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::patch_numerical_kernels")), - t_advance_level_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()_sync")), - t_std_level_sync(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::standardLevelSynchronization()")), - t_sync_new_levels(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::synchronizeNewLevels()")) -{ - NULL_USE(mblk_hierarchy); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(input_db); - TBOX_ASSERT(patch_strategy != ((MblkHyperbolicPatchStrategy *)NULL)); -#endif - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } - - /* - * Initialize object with data read from the input and restart databases. - */ - - bool from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (from_restart) { - getFromRestart(); - } - getFromInput(input_db, from_restart); -} - -/* - ************************************************************************* - * - * Destructor tells the tbox::RestartManager to remove this object from - * the list of restart items. - * - ************************************************************************* - */ -MblkHyperbolicLevelIntegrator::~MblkHyperbolicLevelIntegrator() -{ - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } -} - -/* - ************************************************************************* - * - * Initialize integration data on all patches on level. This process - * is used at the start of the simulation to set the initial hierarchy - * data and after adaptive regridding. In the second case, the old - * level pointer points to the level that existed in the hierarchy - * before regridding. This pointer may be null, in which case it is - * ignored. If it is non-null, then data is copied from the old level - * to the new level before the old level is discarded. - * - * Note that we also allocate flux storage for the coarsest AMR - * hierarchy level here (i.e., level 0). The time step sequence on - * level 0 is dictated by the user code; so to avoid any memory - * management errors, flux storage on level 0 persists as long as the - * level does. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level, - const bool allocate_data) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_initialize_level_data->start(); - - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(level_number)); - - /* - * Allocate storage needed to initialize level and fill data - * from coarser levels in AMR hierarchy, potentially. Since - * time gets set when we allocate data, re-stamp it to current - * time if we don't need to allocate. - */ - if (allocate_data) { - mblk_level->allocatePatchData(d_new_patch_init_data, init_data_time); - mblk_level->allocatePatchData(d_old_time_dep_data, init_data_time); - } else { - mblk_level->setTime(init_data_time, d_new_patch_init_data); - } - - /* - * Create schedules for filling new level and fill data. - */ - - if ((level_number > 0) || old_level) { - t_fill_new_level_create->start(); - - boost::shared_ptr sched( - d_mblk_fill_new_level->createSchedule(mblk_level, - old_level, - level_number - 1, - hierarchy, - d_patch_strategy)); - t_fill_new_level_create->stop(); - - d_patch_strategy->setDataContext(d_scratch); - - t_fill_new_level_comm->start(); - sched->fillData(init_data_time); - t_fill_new_level_comm->stop(); - - d_patch_strategy->clearDataContext(); - } - - if ((d_number_time_data_levels == 3) && can_be_refined) { - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - time_dep_var++; - } - } - - } // loop over patches - - /* - * Initialize data on patch interiors. - */ - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, init_data_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - init_data_time, - initial_time); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - //d_mblk_fill_new_level.reset(); - - t_initialize_level_data->stop(); -} - -/* - ************************************************************************* - * - * Reset hierarchy configuration information where the range of new - * hierarchy levels is specified. The information updated involves - * the cached communication schedules maintained by the algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level <= finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln0 = 0; ln0 <= finest_level; ln0++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); - } -#else - NULL_USE(finest_level); -#endif - - int finest_hiera_level = hierarchy->getFinestLevelNumber(); - - d_mblk_bdry_sched_advance.resizeArray(finest_hiera_level + 1); - d_mblk_bdry_sched_advance_new.resizeArray(finest_hiera_level + 1); - - for (int ln = coarsest_level; ln <= finest_hiera_level; ln++) { - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(ln)); - - t_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance[ln] = - d_mblk_bdry_fill_advance->createSchedule(mblk_level, - ln - 1, - hierarchy, - d_patch_strategy); - t_advance_bdry_fill_create->stop(); - - if (!d_lag_dt_computation && d_use_ghosts_for_dt) { - t_new_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance_new[ln] = - d_mblk_bdry_fill_advance_new->createSchedule(mblk_level, - ln - 1, - hierarchy, - d_patch_strategy); - t_new_advance_bdry_fill_create->stop(); - } - - } - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells near large gradients. - * These cells will be refined. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_apply_gradient_detector->start(); - - boost::shared_ptr mblk_level( - hierarchy->getPatchLevel(level_number)); - - mblk_level->allocatePatchData(d_saved_var_scratch_data, error_data_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_error_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[level_number]->fillData(error_data_time); - t_error_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - d_patch_strategy-> - tagGradientDetectorCells(**mi, - error_data_time, - initial_time, - tag_index, - uses_richardson_extrapolation_too); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - mblk_level->deallocatePatchData(d_saved_var_scratch_data); - - t_apply_gradient_detector->stop(); - -} - -/* - ************************************************************************* - * - * The Richardson extrapolation algorithm requires a coarsened version - * of the level on which error estiamtion is performed. This routine - * is used to coarsen data from a level in the AMR hierarchy to some - * coarsened version of it. Note that this routine will be called twice - * The init_coarse_level boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * or by coarsening the "new" solution on the fine level (i.e., after - * it has been advanced). - * - * The contexts used for coarsening old data depends on the number of - * time levels. We always want to use data at the oldest time on the - * fine level, coarsened to the CURRENT context on the coarse level. - * Thus, if the problem uses two time levels, we coarsen data from - * CURRENT on fine level (since CURRENT is the oldest time maintained) - * to CURRENT on the coarse level. If the problem uses three time - * levels, we coarsen from OLD on the fine level (since OLD is the - * time maintained) to CURRENT on the coarse level. - * - * When the boolean is false, indicating we are operating at the new - * time, we coarsen the time advanced solution at the NEW context on - * the fine level to the NEW context on the coarse level so that they - * may be compared later. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance) -{ -#ifndef DEBUG_CHECK_ASSERTIONS - NULL_USE(hierarchy); - NULL_USE(level_number); -#endif -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); - TBOX_ASSERT(coarse_level); -#endif - t_coarsen_rich_extrap->start(); - -// boost::shared_ptr level( -// hierarchy->getPatchLevel(level_number)); - - if (before_advance) { - - coarse_level->allocatePatchData(d_new_patch_init_data, - coarsen_data_time); - - if (d_number_time_data_levels == 3) { - d_patch_strategy->setDataContext(d_old); - } else { - d_patch_strategy->setDataContext(d_current); - } - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_init-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } else { - - coarse_level->allocatePatchData(d_new_time_dep_data, - coarsen_data_time); - - d_patch_strategy->setDataContext(d_new); - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_final-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } - - t_coarsen_rich_extrap->stop(); - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells for refinement using Richardson - * extrapolation. Richardson extrapolation requires two copies of - * the solution to compare. The NEW context holds the solution - * computed on the fine level and coarsened, whereas the CURRENT - * context holds the solution integrated on the coarse level after - * coarsening the initial data from the fine level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - /* - * Compare solutions computed on level (stored in NEW context) and on - * the coarser level (stored in CURR context) on the patches of the - * coarser level. The patch strategy implements the compare operations - * performed on each patch. - */ - - int error_level_number = - level->getNextCoarserHierarchyLevelNumber() + 1; - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - d_patch_strategy-> - tagRichardsonExtrapolationCells(*patch, - error_level_number, - d_new, // finer context - d_current, // coarser context - error_data_time, - deltat, - error_coarsen_ratio, - initial_time, - tag_index, - uses_gradient_detector_too); - } - -} - -/* - ************************************************************************* - * - * Initialize level integrator by: - * - * (1) Setting the number of time data levels based on needs of - * the gridding algorithm - * (2) Invoking variable registration in patch strategy. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(gridding_alg); -#endif - - d_number_time_data_levels = 2; - - if ((gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() < 1) || - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() > 3)) { - TBOX_ERROR("MblkHyperbolicLevelIntegrator::initializeLevelIntegrator " - << "error...\n" << " object name = " << d_object_name - << " gridding algorithm has bad error coarsen ratio" << endl); - } - - if ((gridding_alg->getTagAndInitializeStrategy()->usesTimeIntegration()) && - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() == 3)) { - d_number_time_data_levels = 3; - d_old = hier::VariableDatabase::getDatabase()->getContext("OLD"); - } - - d_patch_strategy->registerModelVariables(this); - - d_patch_strategy->setupLoadBalancer(this, - gridding_alg.get()); -} - -/* - ************************************************************************* - * - * Invoke dt calculation routines in patch strategy and take a min - * over all patches on the level. The result will be the max of the - * next timestep on the level. If the boolean recompute_dt is true, - * the max timestep on the level will be computed. If it is false, - * the method will simply access the latest dt stored in the time - * refinement integrator. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - t_get_level_dt->start(); - - double dt = tbox::MathUtilities::getMax(); - - if (!d_use_ghosts_for_dt) { - - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } else { - - level->allocatePatchData(d_saved_var_scratch_data, dt_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[level->getLevelNumber()]->fillData(dt_time); - t_advance_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - /* - * Copy data from scratch to current and de-allocate scratch storage. - * This may be excessive here, but seems necessary if the - * computation of dt affects the state of the problem solution. - * Also, this getLevelDt() routine is called at initialization only - * in most cases. - */ - - copyTimeDependentData(level, d_scratch, d_current); - - level->deallocatePatchData(d_saved_var_scratch_data); - - } - - t_get_level_dt_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_get_level_dt_sync->stop(); - t_mpi_reductions->start(); - } - - /* - * The level time increment is a global min over all patches. - */ - - double global_dt = dt; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&global_dt, 1, MPI_MIN); - } - global_dt *= tbox::MathUtilities::Min(d_cfl_init, d_cfl); - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_get_level_dt_sync->stop(); - } - - t_get_level_dt->stop(); - - return global_dt; - -} - -/* - ************************************************************************* - * - * For the standard explicit integration algorithm for hyperbolic - * conservation laws, the fine time increment is the coarse increment - * divided by the maximum mesh ratio (independent of level number). - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio) -{ - NULL_USE(finer_level_number); -#ifdef DEBUG_CHECK_ASSERTIONS - for (int id = 0; id < d_dim.getValue(); id++) { - TBOX_ASSERT(ratio(id) > 0); - } -#endif - return coarse_dt / double(ratio.max()); -} - -/* - ************************************************************************* - * - * Integrate data on all patches in patch level from current time - * to new time (new_time) using a single time step. Before the advance - * can occur, proper ghost cell information is obtained for all patches - * on the level. Then, local patches are advanced sequentially in the - * loop over patches. The details of the routine are as follows: - * - * 0) Allocate storage for new time level data. Also, allocate - * necessary FLUX and flux integral storage if needed - * (i.e., if regrid_advance is false, first_step is true, and - * coarser or finer level than current level exists in hierarchy.) - * - * 1) Scratch space is filled so that, for each patch, interior data - * and ghost cell bdry data correspond to specified time. - * - * 1a) Call user routines to pre-process advance data, if needed. - * - * 2) Compute explicit fluxes in scratch space using data on - * patch + ghosts at given time. - * - * 3) Apply conservative difference in scratch space to advance patch - * interior data to time = new_time. - * - * 3a) Call user routines to post-process advance data, if needed. - * - * 4) Compute next stable time increment for subsequent level advances: - * - * 4a) If (d_lag_dt_computation == true) { - * DO NOT RECOMPUTE characteristic data after advancing - * data on patch. Use characteristic data corresponding - * to current time level, computed prior to flux computation, - * in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Compute dt using data on patch+ghosts at time. - * Else - * - Compute dt using data on patch interior ONLY. - * } - * - * 4b) Copy data from scratch space patch interior to new data - * storage for patch (i.e., at time = new_time). - * - * 4a) If (d_lag_dt_computation == false) { - * RECOMPUTE characteristic data after advancing data on - * patch. Use characteristic data corresponding to new time - * level in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Refill scratch space with new interior patch data - * and ghost cell bdry data correspond to new time. - * (NOTE: This requires a new boundary schedule.) - * - Compute dt using data on patch+ghosts at new_time. - * Else - * - Compute dt using data on patch interior ONLY. - * (using patch interior data at new_time) - * } - * - * 5) If (ln > 0), update flux integrals by adding patch bdry FLUXes - * to flux sums. - * - * Important Notes: - * 1) In order to advance finer levels (if they exist), both old - * and new data for each patch on the level must be maintained. - * 2) If the timestep is the first in the timestep loop on the level - * (indicated by first_step), then time interpolation is - * is unnecessary to fill ghost cells from the next coarser level. - * 3) The new dt is not calculated if regrid_advance is true. - * If this is the case, it is assumed that the results of the - * advance and the timestep calculation will be discarded - * (e.g., during regridding, or initialization). Also, allocation - * and post-processing of FLUX/flux integral data is not performed - * in this case. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); - TBOX_ASSERT(hierarchy); - TBOX_ASSERT(current_time <= new_time); -#endif - -#ifdef RECORD_STATS - boost::shared_ptr num_boxes_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL0", "PROC_STAT")); - boost::shared_ptr num_boxes_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL1", "PROC_STAT")); - boost::shared_ptr num_boxes_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL2", "PROC_STAT")); - boost::shared_ptr num_boxes_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL3", "PROC_STAT")); - boost::shared_ptr num_gridcells_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL0", "PROC_STAT")); - boost::shared_ptr num_gridcells_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL1", "PROC_STAT")); - boost::shared_ptr num_gridcells_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL2", "PROC_STAT")); - boost::shared_ptr num_gridcells_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL3", "PROC_STAT")); - boost::shared_ptr timestamp_l0( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL0", "PROC_STAT")); - boost::shared_ptr timestamp_l1( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL1", "PROC_STAT")); - boost::shared_ptr timestamp_l2( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL2", "PROC_STAT")); - boost::shared_ptr timestamp_l3( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL3", "PROC_STAT")); - - int level_num = level->getLevelNumber(); - - /* - * Record number of gridcells on each patch. Note that patch - * stat requires a seq number to be identified. - */ - double level_gridcells = 0.; - double level_local_patches = 0.; - // to count total gridcells on level - //hier::BoxList boxes = level->getBoxes(); - //for (hier::BoxList::Iterator i(boxes); i; i++) { - // level_gridcells += itr().size(); - //} - // to count gridcells on this processor - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - level_gridcells += (*mi)->getBox().size(); - level_local_patches += 1.0; - } // loop over patches - - if (level_num == 0) { - num_boxes_l0->recordProcStat(level_local_patches); - num_gridcells_l0->recordProcStat(level_gridcells); - timestamp_l0->recordProcStat(current_time); - } - if (level_num == 1) { - num_boxes_l1->recordProcStat(level_local_patches); - num_gridcells_l1->recordProcStat(level_gridcells); - timestamp_l1->recordProcStat(current_time); - } - if (level_num == 2) { - num_boxes_l2->recordProcStat(level_local_patches); - num_gridcells_l2->recordProcStat(level_gridcells); - timestamp_l2->recordProcStat(current_time); - } - if (level_num == 3) { - num_boxes_l3->recordProcStat(level_local_patches); - num_gridcells_l3->recordProcStat(level_gridcells); - timestamp_l3->recordProcStat(current_time); - } -#endif - - t_advance_level->start(); - - const int level_number = level->getLevelNumber(); - const double dt = new_time - current_time; - - /* - * (1) Allocate data needed for advancing level. - * (2) Generate temporary communication schedule to fill ghost - * cells, if needed. - * (3) Fill ghost cell data. - * (4) Process flux storage before the advance. - */ - - level->allocatePatchData(d_new_time_dep_data, new_time); - level->allocatePatchData(d_saved_var_scratch_data, current_time); - - boost::shared_ptr mblk_fill_schedule; - - const bool in_hierarchy = level->inHierarchy(); - - if (!in_hierarchy) { - t_error_bdry_fill_create->start(); - if (d_number_time_data_levels == 3) { - mblk_fill_schedule = d_mblk_bdry_fill_advance_old-> - createSchedule(level, - level->getLevelNumber() - 1, - hierarchy, - d_patch_strategy); - } else { - mblk_fill_schedule = d_mblk_bdry_fill_advance-> - createSchedule(level, - level->getLevelNumber() - 1, - hierarchy, - d_patch_strategy); - } - t_error_bdry_fill_create->stop(); - } else { - mblk_fill_schedule = d_mblk_bdry_sched_advance[level_number]; - } - - d_patch_strategy->setDataContext(d_scratch); - if (regrid_advance) { - t_error_bdry_fill_comm->start(); - } else { - t_advance_bdry_fill_comm->start(); - } - mblk_fill_schedule->fillData(current_time); - if (regrid_advance) { - t_error_bdry_fill_comm->stop(); - } else { - t_advance_bdry_fill_comm->stop(); - } - - d_patch_strategy->clearDataContext(); - mblk_fill_schedule.reset(); - - preprocessFluxData(level, - current_time, - new_time, - regrid_advance, - first_step, - last_step); - - /* - * (5) Call user-routine to pre-process state data, if needed. - * (6) Advance solution on all level patches (scratch storage). - * (7) Copy new solution to from scratch to new storage. - * (8) Call user-routine to post-process state data, if needed. - */ - t_patch_num_kernel->start(); - d_patch_strategy->preprocessAdvanceLevelState(level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - d_patch_strategy->setDataContext(d_scratch); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - patch->allocatePatchData(d_temp_var_scratch_data, current_time); - - t_patch_num_kernel->start(); - d_patch_strategy->computeFluxesOnPatch(*patch, - current_time, - dt); - t_patch_num_kernel->stop(); - - bool at_syncronization = false; - - t_patch_num_kernel->start(); - d_patch_strategy->conservativeDifferenceOnPatch(*patch, - current_time, - dt, - at_syncronization); - t_patch_num_kernel->stop(); - - patch->deallocatePatchData(d_temp_var_scratch_data); - } - d_patch_strategy->clearDataContext(); - - level->setTime(new_time, d_saved_var_scratch_data); - level->setTime(new_time, d_flux_var_data); - - copyTimeDependentData(level, d_scratch, d_new); - - t_patch_num_kernel->start(); - d_patch_strategy->postprocessAdvanceLevelState(level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - /* - * (9) If the level advance is for regridding, we compute the next timestep: - * - * (a) If the dt computation is lagged (i.e., we use pre-advance data - * to compute timestep), we reset scratch space on patch interiors - * if needed. Then, we set the strategy context to current or scratch - * depending on whether ghost values are used to compute dt. - * (b) If the dt computation is not lagged (i.e., we use advanced data - * to compute timestep), we refill scratch space, including ghost - * data with new solution values if needed. Then, we set the strategy - * context to new or scratch depending on whether ghost values are - * used to compute dt. - * (c) Then, we loop over patches and compute the dt on each patch. - */ - - double dt_next = tbox::MathUtilities::getMax(); - - if (!regrid_advance) { - - if (d_lag_dt_computation) { - - if (d_use_ghosts_for_dt) { - d_patch_strategy->setDataContext(d_scratch); - copyTimeDependentData(level, d_current, d_scratch); - } else { - d_patch_strategy->setDataContext(d_current); - } - - } else { - - if (d_use_ghosts_for_dt) { - - if (!d_mblk_bdry_sched_advance_new[level_number]) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to fill new ghost data for timestep" - << "computation, but schedule not defined." << endl); - } - - d_patch_strategy->setDataContext(d_scratch); - t_new_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance_new[level_number]->fillData(new_time); - t_new_advance_bdry_fill_comm->stop(); - - } else { - d_patch_strategy->setDataContext(d_new); - } - - } - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, new_time); - // "false" argument indicates "initial_time" is false. - t_patch_num_kernel->start(); - double patch_dt = - d_patch_strategy->computeStableDtOnPatch(**mi, - false, - new_time); - t_patch_num_kernel->stop(); - - dt_next = tbox::MathUtilities::Min(dt_next, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } // !regrid_advance - - level->deallocatePatchData(d_saved_var_scratch_data); - - postprocessFluxData(level, - regrid_advance, - first_step, - last_step); - - t_advance_level->stop(); - - t_advance_level_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_advance_level_sync->stop(); - t_mpi_reductions->start(); - } - - double next_dt = dt_next; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&next_dt, 1, MPI_MIN); - } - next_dt *= d_cfl; - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_advance_level_sync->stop(); - } - - return next_dt; -} - -/* - ************************************************************************* - * - * Synchronize data between patch levels according to the standard - * hyperbolic flux correction algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time) -{ - tbox::Array old_times(finest_level - coarsest_level + 1); - for (int i = coarsest_level; i <= finest_level; i++) { - old_times[i] = old_time; - } - standardLevelSynchronization(hierarchy, coarsest_level, finest_level, - sync_time, old_times); -} - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(old_times.getSize() >= finest_level); - for (int ln = coarsest_level; ln < finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - TBOX_ASSERT(sync_time >= old_times[ln]); - } - TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); -#endif - t_std_level_sync->start(); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sync_time >= old_times[coarse_ln]); -#endif - - boost::shared_ptr mblk_fine_level( - hierarchy->getPatchLevel(fine_ln)); - boost::shared_ptr mblk_coarse_level( - hierarchy->getPatchLevel(coarse_ln)); - - synchronizeLevelWithCoarser(mblk_fine_level, - mblk_coarse_level, - sync_time, - old_times[coarse_ln]); - - mblk_fine_level->deallocatePatchData(d_fluxsum_data); - mblk_fine_level->deallocatePatchData(d_flux_var_data); - - if (coarse_ln > coarsest_level) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - } else { - if (coarsest_level == 0) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - d_have_flux_on_level_zero = false; - } - } - - } - - t_std_level_sync->stop(); - -} - -/* - ************************************************************************* - * - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true (i.e., hierarchy is being constructed at initial simulation - * time). After data is coarsened, the user's initialization routine - * is called to reset data (as needed by the application) before - * that solution is further coarsened to the next coarser level in the - * hierarchy. If initial_time is false, then this routine does nothing - * In that case, interpolation of data from coarser levels is sufficient - * to set data on new levels in the hierarchy during regridding. - * - * NOTE: The fact that this routine does nothing when called at any - * time later than when the AMR hierarchy is constructed initially - * may need to change at some point based on application needs. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln = coarsest_level; ln <= finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - } -#endif - - boost::shared_ptr t_sync_initial_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_create")); - boost::shared_ptr t_sync_initial_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_comm")); - - t_sync_new_levels->start(); - - if (initial_time) { - - d_patch_strategy->setDataContext(d_current); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - - boost::shared_ptr fine_level( - hierarchy->getPatchLevel(fine_ln)); - - boost::shared_ptr coarse_level( - hierarchy->getPatchLevel(coarse_ln)); - - t_sync_initial_create->start(); - boost::shared_ptr sched( - d_mblk_sync_initial_data->createSchedule(coarse_level, - fine_level, - d_patch_strategy)); - t_sync_initial_create->stop(); - - t_sync_initial_comm->start(); - sched->coarsenData(); - t_sync_initial_comm->stop(); - - for (hier::PatchLevel::iterator mi(coarse_level->begin()); - mi != coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, sync_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - sync_time, - initial_time); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } - } - - d_patch_strategy->clearDataContext(); - - } // if (initial_time) - - t_sync_new_levels->stop(); - -} - -/* - ************************************************************************* - * - * Synchronize data between coarse and fine patch levels according to - * the standard hyperbolic flux correction algorithm. The steps of - * the algorithm are: - * - * (1) Replace coarse time-space flux integrals at coarse-fine - * boundaries with time-space flux integrals computed on fine - * level. - * (2) Repeat conservative difference on coarse level with corrected - * fluxes. - * (3) Conservatively coarsen solution on interior of fine level to - * coarse level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::synchronizeLevelWithCoarser( - const boost::shared_ptr mblk_fine_level, - const boost::shared_ptr mblk_coarse_level, - const double sync_time, - const double coarse_sim_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_fine_level); - TBOX_ASSERT(mblk_coarse_level); - TBOX_ASSERT(mblk_coarse_level->getLevelNumber() == - (mblk_fine_level->getLevelNumber() - 1)); -#endif - - boost::shared_ptr t_coarsen_fluxsum_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_create")); - boost::shared_ptr t_coarsen_fluxsum_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_comm")); - boost::shared_ptr t_coarsen_sync_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_create")); - boost::shared_ptr t_coarsen_sync_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_comm")); - - /* - * Coarsen flux integrals around fine patch boundaries to coarser level - * and replace coarse flux information where appropriate. NULL patch - * model is passed in to avoid over complicating coarsen process; - * i.e. patch model is not needed in coarsening of flux integrals. - */ - - t_coarsen_fluxsum_create->start(); - boost::shared_ptr sched( - d_mblk_coarsen_fluxsum->createSchedule(mblk_coarse_level, - mblk_fine_level, - NULL)); - t_coarsen_fluxsum_create->stop(); - - d_patch_strategy->setDataContext(d_current); - t_coarsen_fluxsum_comm->start(); - sched->coarsenData(); - t_coarsen_fluxsum_comm->stop(); - d_patch_strategy->clearDataContext(); - - /* - * Repeat conservative difference on coarser level. - */ - mblk_coarse_level->allocatePatchData(d_saved_var_scratch_data, - coarse_sim_time); - mblk_coarse_level->setTime(coarse_sim_time, d_flux_var_data); - - d_patch_strategy->setDataContext(d_scratch); - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[mblk_coarse_level->getLevelNumber()]-> - fillData(coarse_sim_time); - t_advance_bdry_fill_comm->stop(); - - const double reflux_dt = sync_time - coarse_sim_time; - - for (hier::PatchLevel::iterator mi(mblk_coarse_level->begin()); - mi != mblk_coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); - - bool at_syncronization = true; - d_patch_strategy->conservativeDifferenceOnPatch(**mi, - coarse_sim_time, - reflux_dt, - at_syncronization); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - copyTimeDependentData(mblk_coarse_level, d_scratch, d_new); - - mblk_coarse_level->deallocatePatchData(d_saved_var_scratch_data); - - /* - * Coarsen time-dependent data from fine patch interiors to coarse patches. - */ - - t_coarsen_sync_create->start(); - sched = d_mblk_coarsen_sync_data->createSchedule(mblk_coarse_level, - mblk_fine_level, - d_patch_strategy); - t_coarsen_sync_create->stop(); - - d_patch_strategy->setDataContext(d_new); - - t_coarsen_sync_comm->start(); - sched->coarsenData(); - t_coarsen_sync_comm->stop(); - - d_patch_strategy->clearDataContext(); - -} - -/* - ************************************************************************* - * - * Reset time-dependent data on patch level by replacing current data - * with new. The boolean argument is used for odd refinement ratios - * (in particular 3 used in certain applications). - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - double cur_time = 0.; - - for (hier::PatchLevel::iterator mi(level->begin()); - mi != level->end(); ++mi) { - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - int new_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_new); - - cur_time = (*mi)->getPatchData(cur_indx)->getTime(); - - if (can_be_refined && d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } else { - - if (d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - } - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } - - (*mi)->deallocatePatchData(new_indx); - - time_dep_var++; - - } - - } // loop over patches - - level->setTime(new_time, d_new_patch_init_data); - - if (d_number_time_data_levels == 3) { - level->setTime(cur_time, d_old_time_dep_data); - } - -} - -/* - ************************************************************************* - * - * Discard new data on level. This is used primarily to reset patch - * data after error estimation (e.g., Richardson extrapolation.) - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetDataToPreadvanceState( - const boost::shared_ptr& level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - - /* - * De-allocate new context - */ - level->deallocatePatchData(d_new_time_dep_data); - -} - -/* - ************************************************************************* - * - * Register given variable with algorithm according to specified - * algorithm role (i.e., HYP_VAR_TYPE). Assignment of descriptor - * indices to variable lists, component selectors, and communication - * algorithms takes place here. The different cases are: - * - * TIME_DEP: - * The number of factories depends on the number of time - * levels of data that must be stored on patches to satisfy - * regridding reqs. Currently, there are two possibilities: - * - * (1) If the coarsen ratios between levels are even, the - * error coarsening ratio will be two and so only two - * time levels of data must be maintained on every level - * but the finest as usual. - * - * (2) If the coarsen ratios between levels are three, and - * time integration is used during regridding (e.g., Rich- - * ardson extrapolation), then three time levels of data - * must be maintained on every level but the finest so - * that error estimation can be executed properly. - * - * In case (1), three factories are needed: - * SCRATCH, CURRENT, NEW. - * In case (2), four factories are needed: - * SCRATCH, OLD, CURRENT, NEW. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * NEW index is added to d_new_time_dep_data. - * - * INPUT: - * Only one time level of data is maintained and once values - * are set on patches, they do not change in time. - * - * Two factories are needed: SCRATCH, CURRENT. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * - * NO_FILL: - * Only one time level of data is stored and no scratch space - * is used. Data may be set and manipulated at will in user - * routines. Data (including ghost values) is never touched - * outside of user routines. - * - * Two factories are needed: CURRENT, SCRATCH. - * - * CURRENT index is added to d_new_patch_init_data. - * SCRATCH index is needed only for temporary work space to - * fill new patch levels. - * - * FLUX: - * One factory is needed: SCRATCH. - * - * SCRATCH index is added to d_flux_var_data. - * - * Additionally, a variable for flux integral data is created - * for each FLUX variable. It has a single factory, SCRATCH, - * which is added to d_fluxsum_data. - * - * TEMPORARY: - * One factory needed: SCRATCH. - * SCRATCH index is added to d_temp_var_scratch_data. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op, - const boost::shared_ptr refine_op, - const boost::shared_ptr time_int) -{ - TBOX_ASSERT(var); - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - const hier::IntVector zero_ghosts(d_dim, 0); - - d_all_variables.push_back(var); - - switch (h_v_type) { - - case TIME_DEP: { - -#ifdef DEBUG_CHECK_ASSERTIONS - //TBOX_ASSERT(refine_op); - //TBOX_ASSERT(coarsen_op); - //TBOX_ASSERT(time_int); -#endif - - d_time_dep_variables.push_back(var); - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int new_id = variable_db->registerVariableAndContext(var, - d_new, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - d_new_time_dep_data.setFlag(new_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Set boundary fill schedules for time-dependent variable. - * If time interpolation operator is non-NULL, regular advance - * bdry fill algorithm will time interpolate between current and - * new data on coarser levels, and fill from current data on - * same level. New advance bdry fill algorithm will time interpolate - * between current and new data on coarser levels, and fill from new - * data on same level. If time interpolation operator is NULL, - * regular and new bdry fill algorithms will use current and new - * data, respectively. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, new_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - - /* - * For data synchronization between levels, the coarsen algorithm - * will coarsen new data on finer level to new data on coarser. - * Recall that coarser level data pointers will not be reset until - * after synchronization so we always coarsen to new - * (see synchronizeLevelWithCoarser routine). - */ - - d_mblk_coarsen_sync_data->registerCoarsen(new_id, new_id, coarsen_op); - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); - - /* - * Coarsen operations used in Richardson extrapolation. The init - * initializes data on coarser level, before the coarse level - * advance. If two time levels are used, coarsening occurs between - * the CURRENT context on both levels. If three levels are used, - * coarsening occurs between the OLD context on the fine level and - * the CURRENT context on the coarse level. The final coarsen - * algorithm coarsens data after it has been advanced on the fine - * level to the NEW context on the coarser level. - */ - - if (d_number_time_data_levels == 3) { - - int old_id = variable_db->registerVariableAndContext(var, - d_old, - zero_ghosts); - d_old_time_dep_data.setFlag(old_id); - - d_mblk_bdry_fill_advance_old->registerRefine( - scr_id, cur_id, old_id, new_id, scr_id, refine_op, time_int); - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, old_id, coarsen_op); - - } else { - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - } - - d_coarsen_rich_extrap_final-> - registerCoarsen(new_id, new_id, coarsen_op); - - break; - } - - case INPUT: { - -#ifdef DEBUG_CHECK_ASSERTIONS - // TBOX_ASSERT(refine_op); - // TBOX_ASSERT(coarsen_op); -#endif - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Bdry algorithms for input variables will fill from current only. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * At initialization, it may be necessary to coarsen INPUT data - * up through the hierarchy so that all levels are consistent. - */ - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - - break; - } - - case NO_FILL: { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(refine_op); - TBOX_ASSERT(coarsen_op); -#endif - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - ghosts); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op); - - break; - } - - case FLUX: { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(coarsen_op); -#endif - /* - * Note that we force all flux variables to hold double precision - * data and be face- or side-centered. Also, for each flux variable, - * a corresponding "fluxsum" variable is created to manage - * synchronization of data betweeen patch levels in the hierarchy. - */ - const boost::shared_ptr > face_var( - var, - boost::detail::dynamic_cast_tag()); - const boost::shared_ptr > side_var( - var, - boost::detail::dynamic_cast_tag()); - - if (face_var) { - if (d_flux_side_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register FaceVariable when " - << "SideVariable already registered." - << endl); - } - - d_flux_is_face = true; - - } else if (side_var) { - if (d_flux_face_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register SideVariable when " - << "FaceVariable already registered." - << endl); - } - - d_flux_is_face = false; - - } else { - TBOX_ERROR( - d_object_name << ": " - << "Flux is neither face- or side-centered." << endl); - } - - d_flux_variables.push_back(var); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_flux_var_data.setFlag(scr_id); - - string var_name = var->getName(); - string fs_suffix = "_fluxsum"; - string fsum_name = var_name; - fsum_name += fs_suffix; - - boost::shared_ptr fluxsum; - - if (d_flux_is_face) { - boost::shared_ptr > fdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OuterfaceVariable( - d_dim, - fsum_name, - fdf->getDepth())); - d_flux_face_registered = true; - } else { - boost::shared_ptr > sdf( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OutersideVariable( - d_dim, - fsum_name, - sdf->getDepth())); - d_flux_side_registered = true; - } - - d_fluxsum_variables.push_back(fluxsum); - - int fs_id = variable_db->registerVariableAndContext(fluxsum, - d_scratch, - zero_ghosts); - - d_fluxsum_data.setFlag(fs_id); - - d_mblk_coarsen_fluxsum->registerCoarsen(scr_id, fs_id, coarsen_op); - - break; - } - - case TEMPORARY: { - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_temp_var_scratch_data.setFlag(scr_id); - - break; - } - - default: { - - TBOX_ERROR( - d_object_name << ": " - << "unknown HYP_VAR_TYPE = " << h_v_type - << endl); - - } - - } -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data before integration on the level. - * - * We allocate FLUX storage if appropriate. - * - * If the advance is not temporary, we also zero out the FLUX INTEGRALS - * on the first step of any level finer than level zero. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::preprocessFluxData( - const boost::shared_ptr mblk_level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(cur_time); - NULL_USE(last_step); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_level); -#endif - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - const int level_number = mblk_level->getLevelNumber(); - - if (!regrid_advance) { - if (((level_number > 0) && first_step) || - ((level_number == 0) && !d_have_flux_on_level_zero)) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - if (level_number == 0) { - d_have_flux_on_level_zero = true; - } - } - } else { - if (first_step) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - } - } - - if (!regrid_advance && (level_number > 0)) { - - if (first_step) { - - mblk_level->allocatePatchData(d_fluxsum_data, new_time); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator fs_var = - d_fluxsum_variables.begin(); - - while (fs_var != d_fluxsum_variables.end()) { - int fsum_id = - variable_db->mapVariableAndContextToIndex(*fs_var, - d_scratch); - - if (d_flux_is_face) { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } else { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } - - fs_var++; - } - } // loop over patches - - } else { - mblk_level->setTime(new_time, d_fluxsum_data); - } - - } // if ( !regrid_advance && (level_number > 0) ) - -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data after advancing the solution on - * the level. During normal integration steps, the flux integrals are - * updated for subsequent synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is not temporary (regular integration step): - * 1) If the level is the finest in the hierarchy, FLUX data is - * deallocated. It is not used during synchronization, and is only - * maintained if needed for the advance. - * - * 2) If the level is not the coarsest in the hierarchy, update the - * flux integrals for later synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is temporary, deallocate the flux data if first step. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::postprocessFluxData( - const boost::shared_ptr mblk_level, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(last_step); - - TBOX_ASSERT(mblk_level); - - if (regrid_advance && first_step) { - mblk_level->deallocatePatchData(d_flux_var_data); - } - - if (!regrid_advance && (mblk_level->getLevelNumber() > 0)) { - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator flux_var = - d_flux_variables.begin(); - std::list >::iterator fluxsum_var = - d_fluxsum_variables.begin(); - - const hier::Index& ilo = (*mi)->getBox().lower(); - const hier::Index& ihi = (*mi)->getBox().upper(); - - while (flux_var != d_flux_variables.end()) { - - boost::shared_ptr flux_data( - (*mi)->getPatchData(*flux_var, d_scratch), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr fsum_data( - (*mi)->getPatchData(*fluxsum_var, d_scratch), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr > fflux_data; - boost::shared_ptr > ffsum_data; - - boost::shared_ptr > sflux_data; - boost::shared_ptr > sfsum_data; - - int ddepth; - hier::IntVector flux_ghosts(d_dim); - - if (d_flux_is_face) { - fflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - ffsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fflux_data && ffsum_data); - TBOX_ASSERT(fflux_data->getDepth() == ffsum_data->getDepth()); -#endif - ddepth = fflux_data->getDepth(); - flux_ghosts = fflux_data->getGhostCellWidth(); - } else { - sflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - sfsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sflux_data && sfsum_data); - TBOX_ASSERT(sflux_data->getDepth() == sfsum_data->getDepth()); -#endif - ddepth = sflux_data->getDepth(); - flux_ghosts = sflux_data->getGhostCellWidth(); - } - - for (int d = 0; d < ddepth; d++) { - // loop over lower and upper parts of outer face/side arrays - for (int ifs = 0; ifs < 2; ifs++) { - if (d_flux_is_face) { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(2, d), - ffsum_data->getPointer(2, ifs, d)); - } - } else { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(2, d), - sfsum_data->getPointer(2, ifs, d)); - } - } // if face operations vs. side operations - } // loop over lower and upper sides/faces - } // loop over depth - - flux_var++; - fluxsum_var++; - - } // loop over flux variables - - } // loop over patches - - } // if !regrid_advance and level number > 0 .... - -} - -/* - ************************************************************************* - * - * Copy time-dependent data from source to destination on level. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); - TBOX_ASSERT(src_context); - TBOX_ASSERT(src_context); -#endif - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - boost::shared_ptr patch = *ip; - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - boost::shared_ptr src_data( - patch->getPatchData(*time_dep_var, src_context), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr dst_data( - patch->getPatchData(*time_dep_var, dst_context), - boost::detail::dynamic_cast_tag()); - - dst_data->copy(*src_data); - time_dep_var++; - } - - } - -} - -/* - ************************************************************************* - * - * Print all class data for MblkHyperbolicLevelIntegrator object. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::printClassData( - ostream& os) const -{ - os << "\nMblkHyperbolicLevelIntegrator::printClassData..." << endl; - os << "MblkHyperbolicLevelIntegrator: this = " - << (MblkHyperbolicLevelIntegrator *)this << endl; - os << "d_object_name = " << d_object_name << endl; - os << "d_cfl = " << d_cfl << "\n" - << "d_cfl_init = " << d_cfl_init << endl; - os << "d_lag_dt_computation = " << d_lag_dt_computation << "\n" - << "d_use_ghosts_for_dt = " - << d_use_ghosts_for_dt << endl; - os << "d_patch_strategy = " - << (MblkHyperbolicPatchStrategy *)d_patch_strategy << endl; - os - << "NOTE: Not printing variable arrays, ComponentSelectors, communication schedules, etc." - << endl; -} - -/* - ************************************************************************* - * - * Writes out the class version number, d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_for_dt to the database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::putToDatabase( - const boost::shared_ptr& db) const -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", - ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION); - - db->putDouble("d_cfl", d_cfl); - db->putDouble("d_cfl_init", d_cfl_init); - db->putBool("d_lag_dt_computation", d_lag_dt_computation); - db->putBool("d_use_ghosts_for_dt", d_use_ghosts_for_dt); -} - -/* - ************************************************************************* - * - * Reads in cfl, cfl_init, lag_dt_computation, and - * use_ghosts_to_compute_dt from the input database. - * Note all restart values are overriden with values from the input - * database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::getFromInput( - boost::shared_ptr db, - bool is_from_restart) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - if (db->keyExists("cfl")) { - d_cfl = db->getDouble("cfl"); - } else { - if (!is_from_restart) { - d_cfl = db->getDoubleWithDefault("cfl", d_cfl); - } - } - - if (db->keyExists("cfl_init")) { - d_cfl_init = db->getDouble("cfl_init"); - } else { - if (!is_from_restart) { - d_cfl_init = db->getDoubleWithDefault("cfl_init", d_cfl_init); - } - } - - if (db->keyExists("lag_dt_computation")) { - d_lag_dt_computation = db->getBool("lag_dt_computation"); - } else { - if (!is_from_restart) { - d_lag_dt_computation = - db->getDoubleWithDefault("lag_dt_computation", - d_lag_dt_computation); - } - } - - if (db->keyExists("use_ghosts_to_compute_dt")) { - d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); - } else { - if (!is_from_restart) { - d_use_ghosts_for_dt = - db->getDoubleWithDefault("use_ghosts_for_dt", - d_use_ghosts_for_dt); - TBOX_WARNING( - d_object_name << ": " - << "Key data `use_ghosts_to_compute_dt' not found in input." - << " Using default value " - << d_use_ghosts_for_dt << endl); - } - } - - if (db->keyExists("distinguish_mpi_reduction_costs")) { - d_distinguish_mpi_reduction_costs = - db->getBool("distinguish_mpi_reduction_costs"); - } -} - -/* - ************************************************************************* - * - * First, gets the database corresponding to the object_name from the - * restart file. If this database exists, this method checks to make - * sure that the version number of the class matches the version number - * of the restart file. If they match, then d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_to_compute_dt are read from - * restart database. - * Note all restart values can be overriden with values from the input - * database. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::getFromRestart() -{ - - boost::shared_ptr root_db( - tbox::RestartManager::getManager()->getRootDatabase()); - - if (!root_db->isDatabase(d_object_name)) { - TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file" << endl); - } - boost::shared_ptr db(root_db->getDatabase(d_object_name)); - - int ver = db->getInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION"); - if (ver != ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION) { - TBOX_ERROR(d_object_name << ": " - << "Restart file version different " - << "than class version." << endl); - } - - d_cfl = db->getDouble("d_cfl"); - d_cfl_init = db->getDouble("d_cfl_init"); - d_lag_dt_computation = db->getBool("d_lag_dt_computation"); - d_use_ghosts_for_dt = db->getBool("d_use_ghosts_for_dt"); -} - -/* - ************************************************************************* - * - * Utility routines to retrieve variable contexts used by integrator. - * - ************************************************************************* - */ - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getCurrentContext() const -{ - return d_current; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getNewContext() const -{ - return d_new; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getOldContext() const -{ - return d_old; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getScratchContext() const -{ - return d_scratch; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getPlotContext() const -{ - return d_plot_context; -} - -bool -MblkHyperbolicLevelIntegrator::usingRefinedTimestepping() const -{ - return d_use_time_refinement; -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.h deleted file mode 100644 index a70b29cb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicLevelIntegrator.h +++ /dev/null @@ -1,1033 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicLevelIntegratorXD -#define included_MblkHyperbolicLevelIntegratorXD - -#include "SAMRAI/SAMRAI_config.h" - -#ifndef included_iostream -#define included_iostream -#include -using namespace std; -#endif -#include "MblkHyperbolicPatchStrategy.h" - -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/algs/TimeRefinementLevelStrategy.h" - -#include - -#ifndef included_String -#include -using namespace std; -#define included_String -#endif - -/** - * Class MblkHyperbolicLevelIntegrator provides routines needed to - * integrate a system of hyperbolic conservation laws on a structured - * AMR patch hierarchy using local time refinement. The routines include - * initializing a level, advance a level, and synchronize levels in a - * time-dependent AMR application. The AMR timestepping algorithm that - * cycles through the patch levels and calls these routines is provided by - * the TimeRefinementIntegrator class. Together, that hierarchy - * integration class and this single level integration class produce the - * common AMR algorithm due to Berger, Colella and Oliger - * (see e.g., Berger and Colella, J. Comp. Phys. (82)1:64-84, 1989). - * The operations performed on single patches on each level are implemented - * in the user-defined, problem-specific class derived from the abstract - * base class HyperbolicPatchStrategy. - * - * It is important to note that the variable contexts used by the concrete - * patch strategy subclass must be consistent with those defined in this - * class which manages the data for the variables. - * - * This class is derived from the abstract base class - * TimeRefinementLevelStrategy, which defines routines needed by - * the time refinement integrator. There is an argument in the constructor - * that determines whether this class will be used by the time - * refinement integrator for refined timestepping or synchronized - * timestepping. The routines overloaded in - * TimeRefinementLevelStrategy are: initializeLevelIntegrator(), - * getLevelDt(), getMaxFinerLevelDt(), advanceLevel(), - * standardLevelSynchronization(), synchronizeNewLevels(), - * resetTimeDependentData(), and resetDataToPreadvanceState(). - * This class is also derived from mesh::StandardTagAndInitStrategy, - * which defines routines needed by the gridding algorithm classes. The - * routines overloaded in mesh::StandardTagAndInitStrategy are: - * initializeLevelData(), resetHierarchyConfiguration(), - * applyGradientDetector(), applyRichardsonExtrapolation(), and - * coarsenDataForRichardsonExtrapolation(). - * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input and restart data are summarized as follows. - * - * Required input keys and data types: NONE - * - * Optional input keys, data types, and defaults: - * - * - * - * - * - \b cfl - * double value for the CFL factor used for timestep selection - * (dt used = CFL * max dt). If no input value is given, a default - * value of 0.9 is used. - * - * - \b cfl_init - * double value for CFL factor used for initial timestep. - * If no input value is given, a default value of 0.9 is used. - * - * - \b lag_dt_computation - * boolean value indicating whether dt is based on current - * solution or solution from previous step (possible optimization - * in communication for characteristic analysis). If no input - * value is given, a default value of TRUE is used. - * - * - * - \b use_ghosts_to_compute_dt - * boolean value indicating whether ghost data must be filled before - * timestep is computed on each patch (possible communication - * optimization). if no input value is given, a default value - * of TRUE is used. - * - * - \b distinguish_mpi_reduction_costs - * boolean specifying whether to separate reduction costs in tbox::MPI - * from costs of load imbalances. By specifying it true, a - * barrier is put in place before the reduction call, so an extra - * operation is incurred. For this reason, it is defaulted FALSE. - * - * - * - * - * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. - * - * A sample input file entry might look like: - * - * \verbatim - * - * cfl = 0.9 - * cfl_init = 0.9 - * lag_dt_computation = FALSE - * use_ghosts_to_compute_dt = TRUE - * distinguish_mpi_reduction_costs = TRUE - * - * \endverbatim - * - * @see algs::TimeRefinementIntegrator - * @see mesh::StandardTagAndInitStrategy - * @see algs::HyperbolicPatchStrategy - */ - -using namespace SAMRAI; - -class MblkHyperbolicLevelIntegrator: - public algs::TimeRefinementLevelStrategy, - public mesh::StandardTagAndInitStrategy, - public tbox::Serializable -{ -public: - /** - * Enumerated type for the different ways in which variable storage - * can be manipulated by the level integration algorithm. - * See registerVariable(...) function for more details. - * - * - * - * - \b TIME_DEP {Data that changes in time and needs more than one - * time level to be stored.} - * - \b INPUT {Data that is set once and do not change during - * the ghosts are never re-filled outside of - * user-defined routines.} - * - \b FLUX {Face-centered double values used in conservative - * difference and synchronization (i.e., refluxing) - * process. A corresponding variable to store flux - * integral information is created for each FLUX - * variable.} - * - \b TEMPORARY {Accessory values intended to live only for - * computation on a single patch (i.e., they cannot - * be assumed to exist between patch routine function - * calls.)} - * - * - * - */ - enum HYP_VAR_TYPE { TIME_DEP = 0, - INPUT = 1, - NO_FILL = 2, - FLUX = 3, - TEMPORARY = 4 }; - - /** - * Constructor for MblkHyperbolicLevelIntegrator initializes - * integration parameters to default values and constructs standard - * communication algorithms. Other data members are read in from - * the specified input database or the restart database corresponding - * to the specified object_name. The constructor also registers - * this object for restart using the specified object name when - * the boolean argument is true. Whether object will write its state to - * restart files during program execution is determined by this argument. - * Note that it has a default state of true. This class is used by - * the time refinement integrator for refined timestepping when the - * use_time_refinement argument is true, and for synchronized - * timestepping when the boolean is false. - * - * When assertion checking is active, passing in any null pointer - * or an empty string will result in an unrecoverable assertion. - */ - MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - const boost::shared_ptr& mblk_hierarchy, - const bool register_for_restart = true, - const bool use_time_refinement = true); - - /** - * The destructor for MblkHyperbolicLevelIntegrator unregisters - * the integrator object with the restart manager when so registered. - */ - virtual ~MblkHyperbolicLevelIntegrator(); - - /** - * Initialize level integrator by by setting the number of time levels - * of data needed based on specifications of the gridding algorithm. - * - * This routine also invokes variable registration in the patch strategy. - * - * Assertion checking will throw unrecoverable assertions if either - * pointer is null. - */ - virtual void - initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg); - - /** - * Determine time increment to advance data on level and return that - * value. The double dt_time argument is the simulation time when - * the routine is called. The initial_time boolean is true if this - * routine is called during hierarchy initialization (i.e., at the - * initial simulation time). Otherwise, it is false. The - * recompute_dt option specifies whether to compute the timestep using - * the current level data or to return the value stored by the time - * integrator. The default true setting means the timestep will be - * computed if no value is supplied. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual double - getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time); - - /** - * Return the maximum allowable time increment for the level with - * the specified level number based on the time increment for the - * next coarser level and the mesh refinement ratio between the two - * levels. For the common explicit integration methods for hyperbolic - * conservation laws (constrained by a CFL limit), the fine time increment - * is typically the coarse increment divided by the refinement ratio. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the ratio vector is not acceptable (i.e., all values > 0). - */ - virtual double - getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio_to_coarser); - - /** - * Integrate data on all patches on the given patch level from current - * time (current_time) to new time (new_time). This routine is used - * to advance the solution on each level in the hierarchy and during - * time-dependent regridding procedures, such as Richardson extrapolation. - * The boolean arguments are used to determine the state of the algorithm - * and the data when the advance routine is called. The first_step - * and last_step indicate whether the step is the first or last in the - * current timestep sequence on the level. Typically, the current timestep - * sequence means each step on the level between advance steps on a - * coarser level in the hierarchy, if one exists. The regrid_advance - * value is true when the advance is called as part of a time-dependent - * regridding procedure. Usually when this happens, the results of the - * colution advance will be discarded. So, for example, when this is true - * flux information is not maintained and flux integrals are not updated. - * The final boolean argument indicates whether or not the level resides - * in the hierarchy. For example, during time-dependent regridding, such - * as Richardson extrapolation, a temporary level that is not in the - * hierarchy is created and advanced. Then, a communication schedule - * must be generated for the level before the advance begins. - * - * This routine is called at two different points during time integration: - * during the regular time advance sequence, and possibly at the initial - * simulation time. The second call advances the solution on a coarser - * level ahead in time to provide time-dependent boundary values for some - * finer level when time-dependent regridding is used. In the first case, - * the values of the boolean flags are: - * - * - * - * - \b first_step - * = true for first step in level time step sequence; else, false. - * - \b last_step - * = true for last step in level time step sequence; else, false. - * - \b regrid_advance - * = false. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = false. - * - \b regrid_advance - * = true. - * - * - * - * - * When time-dependent regridding (i.e., Richardson extrapolation) is - * used, the routine is called from two different points in addition to - * those described above: to advance a temporary level that is coarser - * than the hierarchy level on which error estimation is performed, and - * to advance the hierarchy level itself. In the first case, the values of - * the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = true. - * - \b regrid_advance - * = true. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * (when regridding during time integration sequence) - * = true when the level is not coarsest level to synchronize - * immediately before the regridding process; else, false. - * (when generating initial hierarchy construction) - * = true, even though there may be multiple advance steps. - * - \b last_step - * = true when the advance is the last in the Richardson - * extrapolation step sequence; else false. - * - \b regrid_advance - * = true. - * - * - * - * - * When assertion checking is active, an unrecoverable assertion will - * result if either the level or hierarchy pointer is null, or the - * new time is not greater than the given time. - */ - - virtual double - advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance = false); - - /** - * Synchronize data between given patch levels in patch hierarchy - * according to the standard hyperbolic AMR flux correction algorithm. - * This routine synchronizes data between two levels at a time from - * the level with index finest_level down to the level with index - * coarsest_level. The array of old time values are used in the - * re-integration of the time-dependent data. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null), or - * all of the old time values are less than the value of sync_time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times); - - /** - * This overloaded version of standardLevelSynchronization implements - * a routine used for synchronized timestepping. Only a single - * value for the old time is needed, since all levels would have the - * same old time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time); - - /** - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true. In this case, the hierarchy is being constructed at the - * initial simulation time, After data is coarsened, the application- - * specific initialization routine is called to set data before that - * solution is further coarsened to the next coarser level in the - * hierarchy. This operation makes the solution consistent between - * coarser levels and finer levels that did not exist when the coarse - * levels where created and initialized originally. - * - * When initial_time is false, this routine does nothing since the - * standard hyperbolic AMR algorithm for conservation laws requires - * no data synchronization after regridding beyond interpolation of - * data from coarser levels in the hierarchy in some conservative fashion. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null). - */ - virtual void - synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time); - - /** - * Resets time-dependent data storage and update time for patch level. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined); - - /** - * Deallocate all new simulation data on the given level. This may - * be necessary during regridding, or setting up levels initially. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetDataToPreadvanceState( - const boost::shared_ptr& level); - - /** - * Initialize data on a new level after it is inserted into an AMR patch - * hierarchy by the gridding algorithm. The level number indicates - * that of the new level. The old_level pointer corresponds to - * the level that resided in the hierarchy before the level with the - * specified number was introduced. If the pointer is null, there was - * no level in the hierarchy prior to the call and the level data is set - * based on the user routines and the simulation time. Otherwise, the - * specified level replaces the old level and the new level receives data - * from the old level appropriately before it is destroyed. - * - * Typically, when data is set, it is interpolated from coarser levels - * in the hierarchy. If the data is to be set, the level number must - * match that of the old level, if non-null. If the old level is - * non-null, then data is copied from the old level to the new level - * on regions of intersection between those levels before interpolation - * occurs. Then, user-supplied patch routines are called to further - * initialize the data if needed. The boolean argument initial_time - * is passed into the user's routines. - * - * The boolean argument initial_time indicates whether the level is - * being introduced for the first time (i.e., at initialization time), - * or after some regrid process during the calculation beyond the initial - * hierarchy construction. This information is provided since the - * initialization of the data on a patch may be different in each of those - * circumstances. The can_be_refined boolean argument indicates whether - * the level is the finest level allowed in the hierarchy. This may or - * may not affect the data initialization process depending on the problem. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level number does - * not match any level in the hierarchy, or the old level number - * does not match the level number (if the old level pointer is non-null). - */ - virtual void - initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level, - const bool allocate_data = true); - - /** - * Reset cached communication schedules after the hierarchy has changed - * (due to regidding, for example) and the data has been initialized on - * the new levels. The intent is that the cost of data movement on the - * hierarchy will be amortized across multiple communication cycles, - * if possible. The level numbers indicate the range of levels in the - * hierarchy that have changed. However, this routine updates - * communication schedules every level finer than and including that - * indexed by the coarsest level number given. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, any pointer to a level - * in the hierarchy that is coarser than the finest level is null, - * or the given level numbers not specified properly; e.g., - * coarsest_level > finest_level. - */ - virtual void - resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level); - - /** - * Set integer tags to "one" in cells where refinement of the given - * level should occur according to some user-supplied gradient criteria. - * The double time argument is the regrid time. The integer "tag_index" - * argument is the patch descriptor index of the cell-centered integer tag - * array on each patch in the hierarchy. The boolean argument - * initial_time indicates whether the level is being subject to refinement - * at the initial simulation time. If it is false, then the error - * estimation process is being invoked at some later time after the AMR - * hierarchy was initially constructed. The boolean argument - * uses_richardson_extrapolation_too is true when Richardson - * extrapolation error estimation is used in addition to the gradient - * detector, and false otherwise. This argument helps the user to - * manage multiple regridding criteria. This information is passed along - * to the user's patch tagging routines since the application of the - * gradient detector may be different in each case. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null or the level number does - * not match any existing level in the hierarchy. - */ - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too); - - /** - * Set integer tags to "one" where refinement onf the given - * level should occur according to some user-supplied Richardson - * extrapolation criteria. The "error_data_time" argument is the - * regrid time. The "deltat" argument is the time increment to advance - * the solution on the level to be refined. Note that that level is - * finer than the level in the argument list, in general. The - * ratio between the argument level and the actual hierarchy level - * is given by the integer "coarsen ratio". - * - * The integer "tag_index" argument is the patch descriptor index of - * the cell-centered integer tag array on each patch in the hierarchy. - * - * The boolean argument initial_time indicates whether the level is being - * subject to refinement at the initial simulation time. If it is false, - * then the error estimation process is being invoked at some later time - * after the AMR hierarchy was initially constructed. Typically, this - * information is passed to the user's patch tagging routines since the - * application of the Richardson extrapolation process may be different - * in each case. - * - * The boolean uses_gradient_detector_too is true when a gradient - * detector procedure is used in addition to Richardson extrapolation, - * and false otherwise. This argument helps the user to manage multiple - * regridding criteria. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - * - */ - virtual void - applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too); - - /** - * Coarsen solution data from level to coarse_level for Richardson - * extrapolation. Note that this routine will be called twice during - * the Richardson extrapolation error estimation process. The - * before_advance boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * (i.e., before it has been advanced) or by coarsening the "new" - * solution on the fine level (i.e., after it has been advanced). - * - * When assertion checking is active, an unrecoverable assertion will - * result if either level pointer is null. - * - */ - virtual void - coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance); - - /** - * Register a variable with the hyperbolic integration algorithm. The - * variable type must be one of the options defined by the enumerated - * type defined above. Typically, this routine is called from the - * hyperbolic patch model when the variable registration process is - * invoked by calling the function initializeLevelIntegrator() above. - * In fact, that function should be called before this routine is called. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the variable pointer or geometry pointer is null. - */ - virtual void - registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op = - boost::shared_ptr(), - const boost::shared_ptr refine_op = - boost::shared_ptr(), - const boost::shared_ptr time_int = - boost::shared_ptr()); - - /** - * Print class data representation for hyperbolic level integrator object. - * This is done automatically, when an unrecoverable run-time assertion - * is thrown within some member function of this class. - */ - virtual void - printClassData( - ostream& os) const; - - /** - * Write out object state to the given database. - * - * When assertion checking is active, database point must be non-null. - */ - virtual void - putToDatabase( - const boost::shared_ptr& db) const; - - /** - * Return pointer to "current" variable context used by integrator. - * Current data corresponds to state data at the beginning of a - * timestep, or when a new level is initialized. - */ - boost::shared_ptr - getCurrentContext() const; - - /** - * Return pointer to "new" variable context used by integrator. - * New data corresponds to advanced state data at the end of a timestep. - * The data is one timestep later than the "current" data. - */ - boost::shared_ptr - getNewContext() const; - - /** - * Return pointer to "old" variable context used by integrator. - * Old data corresponds to an extra time level of state data used - * for Richardson extrapolation error estimation. The data is - * one timestep earlier than the "current" data. - * - * Note that only in certain cases when using time-dependent error - * estimation, such as Richardson extrapolation, is the returned - * pointer will non-null. See contructor for more information. - */ - boost::shared_ptr - getOldContext() const; - - /** - * Return pointer to "scratch" variable context used by integrator. - * Scratch data typically corresponds to storage that user-routines - * in the concrete HyperbolicPatchStrategy object manipulate; - * in particular, scratch data contains ghost cells. - */ - boost::shared_ptr - getScratchContext() const; - - /** - * Return pointer to variable context used for plotting. This - * context corresponds to the data storage that should be written - * to plot files. Typically, this is the same as the "current" context. - */ - boost::shared_ptr - getPlotContext() const; - - /** - * Return true if this class has been constructed to use refined - * timestepping and false if it has been constructed to use - * synchronized timestepping. - */ - bool - usingRefinedTimestepping() const; - -protected: - /** - * Read input values, indicated above, from given database. The boolean - * argument is_from_restart should be set to true if the simulation - * is beginning from restart. Otherwise it should be set to false. - * - * When assertion checking is active, the database pointer must be non-null. - */ - virtual void - getFromInput( - boost::shared_ptr db, - bool is_from_restart); - - /** - * Read object state from the restart file and initialize class - * data members. The database from which the restart data is read is - * determined by the object_name specified in the constructor. - * - * Unrecoverable Errors: - * - * - * - * - * - - * The database corresponding to object_name is not found - * in the restart file. - * - * - - * The class version number and restart version number do not - * match. - * - * - * - * - * - */ - virtual void - getFromRestart(); - - /* - * Pre-process flux storage before advancing solution on level from - * cur_time to new_time. The boolean flags are used to determine - * how flux and flux integral storage is allocated and initialized. - * These are needed since the advanceLevel() routine is used for - * both level integration and time-dependent error estimation. - * - * When assertion checking is active, the level and schedule pointers - * must be non-null and the current time must be less than the new time. - */ - virtual void - preprocessFluxData( - const boost::shared_ptr level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Post-process flux storage after advancing solution on level. - * The boolean flag is used to determine how flux and flux integral - * storage is copied and de-allocated. This is needed since the - * advanceLevel() routine is used for both level integration and - * time-dependent error estimation. - * - * When assertion checking is active, the level pointer must be non-null. - */ - virtual void - postprocessFluxData( - const boost::shared_ptr level, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Copy time-dependent data from source space to destination space. - * - * When assertion checking is active, the level and context pointers - * must be non-null. - */ - virtual void - copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context); - - /** - * Apply the standard AMR hyperbolic flux synchronization process preserve - * conservation properties in the solution between the fine level and the - * coarse level. The sync_time argument indicates the time at which - * the solution on the two levels is being synchronized. The variable - * coarse_sim_time indicates the previous simulation time on the - * coarse level (recall the conservative difference will be repeated on the - * coarse level during the synchronization process). After the - * synchronization, the flux and flux integral data storage is reset on - * the levels. - * - * When assertion checking is turned on, an unrecoverable assertion - * will result if either level pointer is null, the levels are not - * consecutive in the AMR hierarchy, or the coarse sim time is not - * less than the sync time. - */ - virtual void - synchronizeLevelWithCoarser( - const boost::shared_ptr fine, - const boost::shared_ptr coarse, - const double sync_time, - const double coarse_sim_time); - -private: - /* - * The patch strategy supplies the application-specific operations - * needed to treat data on patches in the AMR hierarchy. - */ - MblkHyperbolicPatchStrategy* d_patch_strategy; - - /* - * The object name is used as a handle to databases stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. - */ - string d_object_name; - - const tbox::Dimension d_dim; - - bool d_use_time_refinement; - bool d_registered_for_restart; - - /* - * Courant-Friedrichs-Levy parameters for time increment selection. - */ - double d_cfl; - double d_cfl_init; - - /* - * Boolean flags for algorithm variations during time integration. - * - * d_lag_dt_computation indicates when time increment is computed for - * next step on a level. A value of true means - * that the current solution values will be used to - * compute dt. A value of false means that dt will - * be computed after the current solution is advanced - * and the new solution is used to compute dt. The - * default value is true. - * - * d_use_ghosts_for_dt indicates whether the time increment computation - * on a patch requires ghost cell data (e.g., if - * boundary conditions are needed). This value must - * be consistent with the numerical routines used - * in the hyperbolic patch strategy object to - * calculate the time step size. The default is true. - */ - bool d_lag_dt_computation; - bool d_use_ghosts_for_dt; - - /* - * Boolean flags for indicated whether face or side data types are - * used for fluxes (choice is determined by numerical routines in - * hyperbolic patch model). - */ - bool d_flux_is_face; - bool d_flux_face_registered; - bool d_flux_side_registered; - -/* - * The following communication algorithms and schedules are created and - * maintained to manage inter-patch communication during AMR integration. - * The algorithms are created in the class constructor. They are initialized - * when variables are "registered" are registered with the integrator. - */ - - /* - * The "advance" schedule is used prior to advancing a level and - * prior to computing dt at initialization. It must be reset each - * time a level is regridded. All ghosts are filled with TIME_DEP - * and INPUT data at specified time. TIME_DEP data in patch interiors - * will be filled with CURRENT_VAR values. - */ - boost::shared_ptr d_mblk_bdry_fill_advance; - tbox::Array > - d_mblk_bdry_sched_advance; - - /* - * The "advance new" schedule can be used twice during a time integration - * cycle. The first is when ghost cell data is required during the - * conservative difference process (i.e., d_use_ghosts_for_cons_diff - * is true). If this is the case, ghosts must be refilled before the - * conservative difference on a coarser level during the refluxing - * process can take place. See synchronizeLevelWithCoarser in class - * MblkHyperbolicLevelIntegrator second occurs when the dt calculation is - * not lagged and the physical boundary conditions are needed to compute dt - * (i.e., (!d_lag_dt_computation && d_use_ghosts_for_dt_computation) - * is true). In either case, all ghosts are filled with TIME_DEP and INPUT - * data at specified time. TIME_DEP data in patch interiors will be filled - * with values corresponding to NEW descriptor indices. See notes - * accompanying MblkHyperbolicLevelIntegrator::advanceLevel. - */ - boost::shared_ptr d_mblk_bdry_fill_advance_new; - tbox::Array > - d_mblk_bdry_sched_advance_new; - - /* - * The "advance old" algorithm is used to fill ghosts using time - * interpolated data from OLD_VAR and NEW_VAR on the coarser hierarchy - * level. It is currently only used for advancing data on a temporary - * level during the Richardson extrapolation algorithm. Use of OLD_VAR - * data is required only when three time levels are used - * (i.e. d_number_time_data_levels=3). - */ - boost::shared_ptr d_mblk_bdry_fill_advance_old; - - /* - * Coarsen algorithms for conservative data synchronization - * (e.g., flux correction or refluxing). - */ - boost::shared_ptr d_mblk_coarsen_fluxsum; - boost::shared_ptr d_mblk_coarsen_sync_data; - boost::shared_ptr d_mblk_sync_initial_data; - - /* - * Coarsen algorithms for Richardson extrapolation. - */ - boost::shared_ptr d_coarsen_rich_extrap_init; - boost::shared_ptr d_coarsen_rich_extrap_final; - - /* - * Algorithm for filling a new patch level in the hierarchy. - */ - boost::shared_ptr d_mblk_fill_new_level; - - /* - * Number of levels of time-dependent data that must be maintained - * on each patch level. This value is used to coordinate the needs - * of the time integration and the regridding process with the - * patch data types and descriptor indices. - */ - int d_number_time_data_levels; - - /* - * hier::Variable contexts and lists of variables used for data management. - * The contexts are set in the constructor. Note that they must - * be consistent with those defined by the concrete subclass of - * the HyperbolicPatchStrategy object. The variable lists - * and component selectors are set in the registerVariable() function. - */ - - boost::shared_ptr d_scratch; - boost::shared_ptr d_current; - boost::shared_ptr d_new; - boost::shared_ptr d_old; - boost::shared_ptr d_plot_context; - - std::list > d_all_variables; - std::list > d_time_dep_variables; - std::list > d_flux_variables; - std::list > d_fluxsum_variables; - - /* - * SCRATCH descriptor indices for (non-TEMPORARY) variables - * (i.e., TIME_DEP, INPUT, FLUX). Note that these are used - * to create scratch space before ghost cells are filled - * on level prior to advancing the data. - */ - hier::ComponentSelector d_saved_var_scratch_data; - - /* - * SCRATCH descriptor indices for TEMPORARY variables. Note that - * these are used to create scratch space on a patch-by-patch basis. - */ - hier::ComponentSelector d_temp_var_scratch_data; - - /* - * CURRENT descriptor indices for TIME_DEP, INPUT, NO_FILL - * variables. Note that these are used to create storage for quantities - * when new patches are made (e.g., during hierachy initialization, - * before error estimation during regridding, after regridding new - * patch levels, etc.). - */ - hier::ComponentSelector d_new_patch_init_data; - - /* - * NEW descriptor indices for TIME_DEP variables. Note that these - * are used to create space for new data before patch level is advanced. - */ - hier::ComponentSelector d_new_time_dep_data; - - /* - * Descriptor indices for FLUX quantities and integrals of fluxes - * (used to accumulate flux information around fine patch boundaries). - * Also, a boolean flag to track flux storage on level 0. - */ - hier::ComponentSelector d_flux_var_data; - hier::ComponentSelector d_fluxsum_data; - bool d_have_flux_on_level_zero; - - /* - * OLD descriptor indices for TIME_DEP variables. Note that - * these are used only when three time levels of data are used. - */ - hier::ComponentSelector d_old_time_dep_data; - - /* - * Option to distinguish tbox::MPI reduction costs from load imbalances - * when doing performance timings. - */ - bool d_distinguish_mpi_reduction_costs; - - /* - * Timers interspersed throughout the class. - */ - boost::shared_ptr t_advance_bdry_fill_comm; - boost::shared_ptr t_error_bdry_fill_create; - boost::shared_ptr t_error_bdry_fill_comm; - boost::shared_ptr t_mpi_reductions; - boost::shared_ptr t_initialize_level_data; - boost::shared_ptr t_fill_new_level_create; - boost::shared_ptr t_fill_new_level_comm; - boost::shared_ptr t_advance_bdry_fill_create; - boost::shared_ptr t_new_advance_bdry_fill_create; - boost::shared_ptr t_apply_gradient_detector; - boost::shared_ptr t_coarsen_rich_extrap; - boost::shared_ptr t_get_level_dt; - boost::shared_ptr t_get_level_dt_sync; - boost::shared_ptr t_advance_level; - boost::shared_ptr t_new_advance_bdry_fill_comm; - boost::shared_ptr t_patch_num_kernel; - boost::shared_ptr t_advance_level_sync; - boost::shared_ptr t_std_level_sync; - boost::shared_ptr t_sync_new_levels; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.C deleted file mode 100644 index ef502009..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.C +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#include "MblkHyperbolicPatchStrategy.h" - -#include "SAMRAI/tbox/Utilities.h" - -using namespace std; -using namespace SAMRAI; - -MblkHyperbolicPatchStrategy::MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - xfer::CoarsenPatchStrategy(dim), - d_dim(dim) -{ -} - -MblkHyperbolicPatchStrategy::~MblkHyperbolicPatchStrategy() -{ -} - -/* - ************************************************************************* - * - * Default virtual function implementations. - * - ************************************************************************* - */ - -void MblkHyperbolicPatchStrategy::tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too) -{ - NULL_USE(patch); - NULL_USE(regrid_time); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_richardson_extrapolation_too); - TBOX_WARNING("MblkHyperbolicPatchStrategy::tagGradientDetectorCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << endl); -} - -void MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too) -{ - NULL_USE(patch); - NULL_USE(error_level_number); - NULL_USE(coarsened_fine); - NULL_USE(advanced_coarse); - NULL_USE(regrid_time); - NULL_USE(deltat); - NULL_USE(error_coarsen_ratio); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_gradient_detector_too); - TBOX_WARNING( - "MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << endl); -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.h deleted file mode 100644 index 67efea7a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkHyperbolicPatchStrategy.h +++ /dev/null @@ -1,527 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicPatchStrategyXD -#define included_MblkHyperbolicPatchStrategyXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/Variable.h" -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" -#include "SAMRAI/xfer/CoarsenPatchStrategy.h" -#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" - -#include - -/** - * Class MblkHyperbolicPatchStrategy is an abstract base class defining the - * interface between an MblkHyperbolicLevelIntegrator object and operations - * applied to a single patch in a structured AMR hierarchy. The operations - * include patch initialization, dt calculation, flux computation, - * conservative differencing, and error estimation. This class is derived - * from the xfer::RefinePatchStrategy and xfer::CoarsenPatchStrategy - * abstract base classes. These base classes provide the interface for - * user-defined interlevel data refining and coarsening operations and the - * specification of physical boundary conditions. The functions - * setPhysicalBoundaryConditions(), and pre/postprocessRefine() are - * overloaded from the class xfer::RefinePatchStrategy. The operations - * pre/postprocessCoarsen() are overloaded from xfer::CoarsenPatchStrategy. - * The pre/postprocessCoarsen/Refine() operations are given empty - * implementations here so that the user does not need to proovide them if - * the operations are not needed. - * - * It is important to recognize that for the concrete patch strategy subclass - * and the MblkHyperbolicLevelIntegrator to work together, the concrete - * strategy must know which patch data to operate on. The patch data storage - * is manipulated by the level integrator. The set/clearDataContext() methods - * allow the integrator to inform the patch strategy of the correct data - * context. The concrete patch strategy subclass can access the appropriate - * context via the getDataContext() method. - * - * @see algs::MblkHyperbolicLevelIntegrator - * @see xfer::RefinePatchStrategy - * @see xfer::CoarsenPatchStrategy - */ - -using namespace SAMRAI; - -class MblkHyperbolicLevelIntegrator; - -class MblkHyperbolicPatchStrategy: - public xfer::RefinePatchStrategy, - public xfer::CoarsenPatchStrategy -{ -public: - /** - * Default constructor for MblkHyperbolicPatchStrategy. - */ - MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim); - - /** - * Virtual destructor for MblkHyperbolicPatchStrategy. - */ - virtual ~MblkHyperbolicPatchStrategy(); - - /** - * Register specific variables needed in the numerical routines with the - * hyperbolic level integrator using the registerVariable() function in that - * class. The integrator manipulates storage for the data and this - * registration defines the way in which data for each quantity will - * be manipulated on the patches. Typically, the derived data quantities - * for plotting are registered with a visualization data writer in this - * routine as well, since the hyperbolic level integrator provides the - * variable context for plotting (i.e., which data is available when a - * plot file is generated). The integrator pointer cannot be null in - * most cases. - * - * The gridding algorithm pointer is provided so that patch data objects - * may be registered with the load balancer object (owned by the gridding - * algorithm) for non-uniform load balancing, if needed. - */ - virtual void - registerModelVariables( - MblkHyperbolicLevelIntegrator* integrator) = 0; - - /** - * Set up parameters in the load balancer object (owned by the gridding - * algorithm) if needed. This function is called immediately after the - * registerModelVariables() function is called. The hyperbolic level - * integrator pointer is provided so that the integrator can be used - * to manage data for the load balancer if needed (e.g., when using - * non-uniform load balancing). - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void setupLoadBalancer( - MblkHyperbolicLevelIntegrator* integrator, - mesh::GriddingAlgorithmStrategy* gridding_algorithm) - { - NULL_USE(integrator); - NULL_USE(gridding_algorithm); - } - - /** - * Set the initial data on a patch interior only. Note that no ghost cells - * need to be set in this routine regardless of whether the patch data - * corresponding to the context requires ghost cells. The data_time - * is the simulation time when the routine is called. The boolean - * initial_time is true if the routine is called at the initial time - * when the hierarchy is initially constructed, otherwise it is false. - */ - virtual void - initializeDataOnPatch( - hier::Patch& patch, - const double data_time, - const bool initial_time) = 0; - - /** - * Compute the stable time increment for a patch on the level with the - * given number. The boolean flag initial_time is true if the routine - * is called at the initial simulation time; otherwise it is false. - * The double argument dt_time is the simulation time. - */ - virtual double - computeStableDtOnPatch( - hier::Patch& patch, - const bool initial_time, - const double dt_time) = 0; - - /** - * Compute TIME INTEGRALS of fluxes to be used in conservative difference - * for patch integration. That is, it is assumed that this numerical - * routine will compute the fluxes corresponding to the cell faces - * multiplied by the time increment. Typically, the numerical flux is - * the normal flux at the cell face. The flux integrals will be used in - * the conservative difference that updates the conserved quantities. - * - * Note that the numerical routines in this method generally require - * ghost cells. Ghost cells data is filled before this routine is called. - */ - virtual void - computeFluxesOnPatch( - hier::Patch& patch, - const double time, - const double dt) = 0; - - /** - * Update patch data with a conservative difference (approximating - * the divergence theorem) using the flux integrals computed in - * computeFluxesOnPatch() routine. The boolean flag is true when this - * routine is called during a flux synchronization step. Otherwise, - * it is false. Note that the computeFluxesOnPatch() routine computes - * TIME INTEGRALs of the numerical fluxes (e.g., they have been multiplied - * by dt). So the conservative difference routine should be consistent - * with this. - */ - virtual void - conservativeDifferenceOnPatch( - hier::Patch& patch, - const double time, - const double dt, - bool at_syncronization) = 0; - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data BEFORE patches are advanced on the given level. - * This routine is called after patch boundary data is filled - * (i.e., ghosts) and before computeFluxesOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser level will occur - * immediately after this advance), regrid_advance -- boolean flag that - * is true if the advance is during a regridding phase (i.e., the advance - * is not used to integrate data on the hierarchy) in which case the - * results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * current level data on all patch interiors. That is, both scratch and - * current data correspond to current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - preprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data AFTER patches are advanced on the given level. - * This routine is called after conservativeDifferenceOnPatch() is called - * and before computeStableDtOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser - * level will occur immediately after this advance), regrid_advance -- - * boolean flag that is true if the advance is during a regridding phase - * (i.e., the advance is not used to integrate data on the hierarchy) in - * which case the results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * new level data on all patch interiors. That is, both scratch and - * new data correspond to current_time + dt on patch interiors. - * The current data and ghost values correspond to the current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - postprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * Tag cells on the given patch that require refinement based on - * application-specific numerical quantities. The tag index argument - * indicates the index of the tag data on the patch data array. The - * boolean argument initial_error is true if tagging is being done at the - * initial simulation time; otherwise, it is false. The other boolean - * flag uses_richardson_extrapolation_too is true when Richardson - * extrapolation is used in addition to the gradient detector. This flag - * helps users manage multiple regridding criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too); - - /** - * Tag cells based from differences computed in the Richardson - * extrapolation. The Richardson - * extrapolation algorithm creates a coarsened version of some hierarchy - * patch level and advances data in time on both the coarsened patch - * level and the hierarchy level. This routine takes the data resulting - * from the advance on both the coarse and fine levels, compares them, and - * tags cells according to the difference. - * \verbatim - * (2) - * n+1 ^------->x finish (1) advanced_coarse - * | ^ (2) coarsened_fine - * time n - | - * ^ |(1) - * | | - * <--------o start - * fine coarse - * \endverbatim - * - * The patch supplied to this routine is on the coarsened level. However, - * the error_level_number corresponds to the actual hierarchy level - * from which it was coarsened. Data resides on this patch in two - * contexts - ``advanced_coarse'' and ``coarsened_fine''. Advanced - * coarse is data advanced on the coarsened version of the level, while - * coarsened fine is the data advanced on the fine level and then - * coarsened to the coarse level. The regrid time and the time increment - * are given for the actual hierarchy level. The error coarsen ratio - * argument is the ratio between the index spaces on the hierarchy level - * and the coarsened hierarchy level. The boolean flag ``initial_error'' - * is true when the error estimation is performed at the initial simulation - * time; i.e., when the hierarchy levels are being constructed for the first - * time. The tag index argument is the index of the tag data on the patch - * data array. The other boolean flag uses_gradient_detector_too is - * true when a gradient detector scheme is used in addition to Richardson - * extrapolation. This flag helps users manage multiple regridding - * criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too); - - /** - * Set user-defined boundary conditions at the physical domain boundary. - */ - virtual void - setPhysicalBoundaryConditions( - hier::Patch& patch, - const double fill_time, - const hier::IntVector& ghost_width_to_fill) = 0; - - /** - * Fill the singularity conditions for the multi-block case - */ - virtual void - fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry) = 0; - - /** - * Return maximum stencil width needed for user-defined - * data interpolation operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getRefineOpStencilWidth() const - { - return hier::IntVector(d_dim, 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. The - * interpolation routines are used in the hyperbolic AMR algorithm - * for filling patch ghost cells before advancing data on a level - * and after regridding a level to fill portions of the new level - * from some coarser level. These routines are called automatically - * from within patch boundary filling schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_REFINE" is given as the interpolation - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that refine such variables in either - * of these routines, then they will not be refined. - * - * The order in which these operations are used in each patch - * boundary filling schedule is: - * - * - \b (1) {Call user's preprocessRefine() routine.} - * - \b (2) {Refine all variables with standard interpolation operators.} - * - \b (3) {Call user's postprocessRefine() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /** - * Return maximum stencil width needed for user-defined - * data coarsen operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getCoarsenOpStencilWidth() const - { - return hier::IntVector(d_dim, 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. The coarsening - * routines are used in the hyperbolic AMR algorithm synchronizing - * coarse and fine levels when they have been integrated to the same - * point. These routines are called automatically from within the - * data synchronization coarsen schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_COARSEN" is given as the coarsening - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that coarsen such variables in either - * of these routines, then they will not be coarsened. - * - * The order in which these operations are used in each coarsening - * schedule is: - * - * - \b (1) {Call user's preprocessCoarsen() routine.} - * - \b (2) {Coarsen all variables with standard coarsening operators.} - * - \b (3) {Call user's postprocessCoarsen() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /** - * Return pointer to patch data context. - */ - boost::shared_ptr getDataContext() const - { - return d_data_context; - } - - /** - * The hyperbolic integrator controls the context for the data to be used - * in the numerical routines implemented in the concrete patch strategy. - * The setDataContext() allows the integrator to set the context for - * data on a patch on which to operate. - */ - void setDataContext( - boost::shared_ptr context) - { - d_data_context = context; - } - - /** - * The clearDataContext() routine resets the data context to be null. - */ - void clearDataContext() - { - d_data_context.reset(); - } - -private: - const tbox::Dimension d_dim; - - boost::shared_ptr d_data_context; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.C index 88b86408..70adb6ab 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -25,6 +25,8 @@ #endif #endif +#include + using namespace std; #include @@ -32,7 +34,6 @@ using namespace std; #include #include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/hier/PatchGeometry.h" #include "SAMRAI/hier/BoundaryBox.h" @@ -56,8 +57,8 @@ using namespace std; #define BOGUS_BDRY_DATA (-9999) // routines for managing boundary data -#include "SkeletonBoundaryUtilities2.h" -#include "SkeletonBoundaryUtilities3.h" +#include "test/testlib/SkeletonBoundaryUtilities2.h" +#include "test/testlib/SkeletonBoundaryUtilities3.h" // Depth of the advected variable #define DEPTH (1) @@ -107,7 +108,7 @@ using namespace std; // // inline geometry functions // -#include "GeomUtilsAMR.h" +#include "test/testlib/GeomUtilsAMR.h" /* ************************************************************************* @@ -136,7 +137,8 @@ MblkLinAdv::MblkLinAdv( d_use_nonuniform_workload(false), d_uval(new pdat::CellVariable(dim, "uval", DEPTH)), d_vol(new pdat::CellVariable(dim, "vol", 1)), - d_flux(new pdat::SideVariable(dim, "flux", 1)), + d_flux(new pdat::SideVariable(dim, "flux", + hier::IntVector::getOne(dim), 1)), d_xyz(new pdat::NodeVariable(dim, "xyz", dim.getValue())), d_dx_set(false), d_godunov_order(1), @@ -164,15 +166,13 @@ MblkLinAdv::MblkLinAdv( input_db, grid_geom->getNumberBlocks()); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif // SPHERE problem... tbox::MathUtilities::setArrayToSignalingNaN(d_center, d_dim.getValue()); // SINE problem - for (int k = 0; k < d_dim.getValue(); k++) d_frequency[k] = 0.; + for (int k = 0; k < d_dim.getValue(); ++k) d_frequency[k] = 0.; /* * Defaults for boundary conditions. Set to bogus values @@ -180,45 +180,44 @@ MblkLinAdv::MblkLinAdv( */ if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_uval.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_uval); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_bdry_edge_uval.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_uval); + } else if (d_dim == tbox::Dimension(3)) { + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_uval.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_uval); + d_bdry_face_uval.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_uval); } /* @@ -262,13 +261,13 @@ MblkLinAdv::MblkLinAdv( * so we reset them to FLOW. */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -282,15 +281,14 @@ MblkLinAdv::MblkLinAdv( i, d_scalar_bdry_node_conds[i]); } } - } - if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + } else if (d_dim == tbox::Dimension(3)) { + for (int i = 0; i < NUM_3D_FACES; ++i) { if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_face_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; } @@ -308,7 +306,7 @@ MblkLinAdv::MblkLinAdv( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -347,7 +345,7 @@ MblkLinAdv::~MblkLinAdv() { * * Register conserved variable (u) (i.e., solution state variable) and * flux variable with hyperbolic integrator that manages storage for - * those quantities. Also, register plot data with Vizamrai or VisIt. + * those quantities. Also, register plot data with VisIt. * ************************************************************************* */ @@ -355,7 +353,7 @@ MblkLinAdv::~MblkLinAdv() { void MblkLinAdv::registerModelVariables( MblkHyperbolicLevelIntegrator* integrator) { - TBOX_ASSERT(integrator != (MblkHyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); d_cell_cons_linear_refine_op.reset( @@ -372,7 +370,7 @@ void MblkLinAdv::registerModelVariables( // which we explicitly set on any new patch boost::shared_ptr node_linear_refine_op; boost::shared_ptr node_cons_coarsen_op( - new pdat::NodeDoubleInjection(d_dim)); + new pdat::NodeDoubleInjection()); integrator->registerVariable(d_uval, d_nghosts, MblkHyperbolicLevelIntegrator::TIME_DEP, @@ -421,7 +419,7 @@ void MblkLinAdv::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING( d_object_name << ": registerModelVariables()" - << "\nVisit data writer was" + << "\nVisIt data writer was" << "\nregistered. Consequently, no plot data will" << "\nbe written." << endl); } @@ -450,14 +448,15 @@ void MblkLinAdv::initializeDataOnPatch( /* * Build the mapped grid on the patch. */ - int block_number = patch.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); int level_number = patch.getPatchLevelNumber(); setMappedGridOnPatch(patch, level_number, block_number); /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double dx[SAMRAI::MAX_DIM_VAL]; d_mblk_geometry->getDx(level_number, dx); d_dx_set = true; @@ -468,14 +467,14 @@ void MblkLinAdv::initializeDataOnPatch( if (initial_time) { boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); TBOX_ASSERT(uval); TBOX_ASSERT(vol); @@ -525,9 +524,9 @@ void MblkLinAdv::initializeDataOnPatch( // // compute the source due to the upwind method // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int cind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -593,8 +592,9 @@ void MblkLinAdv::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } @@ -625,7 +625,8 @@ double MblkLinAdv::computeStableDtOnPatch( /* * Build the mapped grid on the patch. */ - int block_number = patch.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); int level_number = patch.getPatchLevelNumber(); setMappedGridOnPatch(patch, level_number, block_number); @@ -633,21 +634,19 @@ double MblkLinAdv::computeStableDtOnPatch( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(vol); TBOX_ASSERT(xyz); TBOX_ASSERT(uval->getGhostCellWidth() == vol->getGhostCellWidth()); -#endif hier::IntVector uval_ghosts = uval->getGhostCellWidth(); hier::IntVector xyz_ghosts = xyz->getGhostCellWidth(); @@ -698,9 +697,9 @@ double MblkLinAdv::computeStableDtOnPatch( double* y = xyz->getPointer(1); double* z = xyz->getPointer(2); - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int cind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -793,7 +792,8 @@ void MblkLinAdv::computeFluxesOnPatch( //return; - int block_number = patch.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); int level_number = patch.getPatchLevelNumber(); setMappedGridOnPatch(patch, level_number, block_number); @@ -802,35 +802,34 @@ void MblkLinAdv::computeFluxesOnPatch( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > vol( - patch.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); /* * Verify that the integrator providing the context correctly * created it, and that the ghost cell width associated with the * context matches the ghosts defined in this class... */ -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(vol); + TBOX_ASSERT(xyz); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(vol->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); TBOX_ASSERT(xyz->getGhostCellWidth() == d_nodeghosts); -#endif // // ------------------------------- spliced in code ---------------------------- @@ -918,9 +917,9 @@ void MblkLinAdv::computeFluxesOnPatch( // // compute the source due to the upwind method // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0) + 1; i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0) + 1; ++i) { int ifx = POLY3(i, j, k, fx_imn, fx_jmn, fx_kmn, fx_nx, fx_nxny); @@ -945,9 +944,9 @@ void MblkLinAdv::computeFluxesOnPatch( } } - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1) + 1; j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1) + 1; ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ify = POLY3(i, j, k, fy_imn, fy_jmn, fy_kmn, fy_nx, fy_nxny); @@ -972,9 +971,9 @@ void MblkLinAdv::computeFluxesOnPatch( } } - for (int k = ifirst(2); k <= ilast(2) + 1; k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2) + 1; ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ifz = POLY3(i, j, k, fz_imn, fz_jmn, fz_kmn, fz_nx, fz_nxny); @@ -1002,9 +1001,9 @@ void MblkLinAdv::computeFluxesOnPatch( // // compute the source due to the upwind method // - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); @@ -1089,16 +1088,11 @@ void MblkLinAdv::setPhysicalBoundaryConditions( NULL_USE(fill_time); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif - hier::IntVector uval_ghosts = uval->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); -#endif if (d_dim == tbox::Dimension(2)) { @@ -1124,8 +1118,7 @@ void MblkLinAdv::setPhysicalBoundaryConditions( d_bdry_edge_uval); } // d_dim == tbox::Dimension(2)) - - if (d_dim == tbox::Dimension(3)) { + else if (d_dim == tbox::Dimension(3)) { /* * Set boundary conditions for cells corresponding to patch faces. @@ -1199,7 +1192,8 @@ void MblkLinAdv::preprocessRefine( << "\ncoarse xyz data not allocated" << endl); } } - int block_number = coarse.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + coarse.getBox().getBlockId().getBlockValue(); setMappedGridOnPatch(coarse, cln, block_number); setMappedGridOnPatch(fine, fln, block_number); @@ -1213,26 +1207,24 @@ void MblkLinAdv::postprocessRefine( { boost::shared_ptr > cuval( - coarse.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > cvol( - coarse.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > fuval( - fine.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > fvol( - fine.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_vol, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cuval); TBOX_ASSERT(fuval); TBOX_ASSERT(cvol); TBOX_ASSERT(fvol); TBOX_ASSERT(cuval->getDepth() == fuval->getDepth()); -#endif // // get the needed geometry and box information @@ -1327,17 +1319,17 @@ void MblkLinAdv::postprocessRefine( // // ================================= history variable refinement ==================== // - for (int n = 0; n < DEPTH; n++) { + for (int n = 0; n < DEPTH; ++n) { - for (int l = 0; l < nel; l++) { // default slopes are zero + for (int l = 0; l < nel; ++l) { // default slopes are zero slope0[l] = 0.0; // this yields piecewise constant interpolation slope1[l] = 0.0; // and makes a handy initializer slope2[l] = 0.0; } - for (int k = ifirstc(2); k <= ilastc(2); k++) { - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int chind = @@ -1370,10 +1362,9 @@ void MblkLinAdv::postprocessRefine( val[ind] = aii; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(ind >= 0); // debug assertions TBOX_ASSERT(ind < nel); -#endif + my_slopes(aii, aip, aim, ajp, ajm, akp, akm, w_i, w_ip, w_im, w_jp, w_jm, w_kp, w_km, slope0[ind], @@ -1388,9 +1379,9 @@ void MblkLinAdv::postprocessRefine( // compute the interpolated data from the cached slopes, looping // over the fine zones // - for (int k = ifirstf(2); k <= ilastf(2); k++) { - for (int j = ifirstf(1); j <= ilastf(1); j++) { - for (int i = ifirstf(0); i <= ilastf(0); i++) { + for (int k = ifirstf(2); k <= ilastf(2); ++k) { + for (int j = ifirstf(1); j <= ilastf(1); ++j) { + for (int i = ifirstf(0); i <= ilastf(0); ++i) { int fhind = POLY3(i, j, k, fimin, fjmin, fkmin, fnx, fnxny) + n * fnel; @@ -1409,10 +1400,8 @@ void MblkLinAdv::postprocessRefine( int ind = POLY3(ic, jc, kc, imin, jmin, kmin, nx, nxny); // work pos -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(0 <= ind); TBOX_ASSERT(ind < nel); -#endif fdata[fhind] = cdata[ind] @@ -1465,7 +1454,8 @@ void MblkLinAdv::preprocessCoarsen( << "\ncoarse xyz data not allocated" << endl); } } - int block_number = coarse.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + coarse.getBox().getBlockId().getBlockValue(); setMappedGridOnPatch(coarse, cln, block_number); setMappedGridOnPatch(fine, fln, block_number); @@ -1482,26 +1472,24 @@ void MblkLinAdv::postprocessCoarsen( { boost::shared_ptr > cuval( - coarse.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > cvol( - coarse.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_vol, getDataContext()))); boost::shared_ptr > fuval( - fine.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > fvol( - fine.getPatchData(d_vol, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_vol, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cuval); TBOX_ASSERT(cvol); TBOX_ASSERT(fuval); TBOX_ASSERT(fvol); TBOX_ASSERT(cuval->getDepth() == fuval->getDepth()); -#endif // // box and geometry information @@ -1572,14 +1560,14 @@ void MblkLinAdv::postprocessCoarsen( // // average the data // - for (int n = 0; n < DEPTH; n++) { + for (int n = 0; n < DEPTH; ++n) { // // zero out the underlying coarse data to serve as a counter // - for (int k = ifirstc(2); k <= ilastc(2); k++) { // loop over the coarse zones - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { // loop over the coarse zones + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int chind = POLY3(i, j, k, cimin, cjmin, ckmin, cnx, cnxny) + n * cnel; @@ -1593,9 +1581,9 @@ void MblkLinAdv::postprocessCoarsen( // compute the interpolated data from the cached slopes // - for (int k = ifirstf(2); k <= ilastf(2); k++) { // loop over the coarse zones - for (int j = ifirstf(1); j <= ilastf(1); j++) { - for (int i = ifirstf(0); i <= ilastf(0); i++) { + for (int k = ifirstf(2); k <= ilastf(2); ++k) { // loop over the coarse zones + for (int j = ifirstf(1); j <= ilastf(1); ++j) { + for (int i = ifirstf(0); i <= ilastf(0); ++i) { int vol_ind = POLY3(i, j, k, fimin, fjmin, fkmin, fnx, fnxny); int fhind = vol_ind + n * fnel; @@ -1611,11 +1599,9 @@ void MblkLinAdv::postprocessCoarsen( int chind = POLY3(ic, jc, kc, cimin, cjmin, ckmin, cnx, cnxny) + n * cnel; // post + history offset -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cimin <= ic && ic <= cimax); TBOX_ASSERT(cjmin <= jc && jc <= cjmax); TBOX_ASSERT(ckmin <= kc && kc <= ckmax); -#endif real8 fmass = fvolume[vol_ind]; @@ -1627,9 +1613,9 @@ void MblkLinAdv::postprocessCoarsen( // // normalize the completed sum by converting back from extensive to intensive // - for (int k = ifirstc(2); k <= ilastc(2); k++) { // loop over the coarse zones - for (int j = ifirstc(1); j <= ilastc(1); j++) { - for (int i = ifirstc(0); i <= ilastc(0); i++) { + for (int k = ifirstc(2); k <= ilastc(2); ++k) { // loop over the coarse zones + for (int j = ifirstc(1); j <= ilastc(1); ++j) { + for (int i = ifirstc(0); i <= ilastc(0); ++i) { int vol_ind = POLY3(i, j, k, cimin, cjmin, ckmin, cnx, cnxny); int chind = vol_ind + n * cnel; @@ -1671,7 +1657,8 @@ void MblkLinAdv::tagGradientDetectorCells( NULL_USE(initial_error); - int block_number = patch.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); int level_number = patch.getPatchLevelNumber(); setMappedGridOnPatch(patch, level_number, block_number); @@ -1681,8 +1668,9 @@ void MblkLinAdv::tagGradientDetectorCells( const int error_level_number = patch.getPatchLevelNumber(); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); + TBOX_ASSERT(xyz); double* x = xyz->getPointer(0); double* y = xyz->getPointer(1); double* z = xyz->getPointer(2); @@ -1698,11 +1686,13 @@ void MblkLinAdv::tagGradientDetectorCells( tbox::plog << "box = " << patch.getBox() << endl; boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); boost::shared_ptr > var( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); + TBOX_ASSERT(tags); + TBOX_ASSERT(var); // // Create a set of temporary tags and set to untagged value. @@ -1768,24 +1758,22 @@ void MblkLinAdv::tagGradientDetectorCells( // specified time interval. If so, apply appropriate tagging for // the level. // - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(var); -#endif string ref = d_refinement_criteria[ncrit]; int size = 0; double tol = 0.; if (ref == "UVAL_GRADIENT") { - size = d_grad_tol.getSize(); // max depth of gradient tolerance + size = static_cast(d_grad_tol.size()); // max depth of gradient tolerance tol = ((error_level_number < size) // find the tolerance ? d_grad_tol[error_level_number] : d_grad_tol[size - 1]); - for (int k = ifirst(2); k <= ilast(2); k++) { - for (int j = ifirst(1); j <= ilast(1); j++) { - for (int i = ifirst(0); i <= ilast(0); i++) { + for (int k = ifirst(2); k <= ilast(2); ++k) { + for (int j = ifirst(1); j <= ilast(1); ++j) { + for (int i = ifirst(0); i <= ilast(0); ++i) { int ind = POLY3(i, j, k, imin, jmin, kmin, nx, nxny); int tind = POLY3(i, j, k, imn, jmn, kmn, tnx, tnxny); @@ -1939,13 +1927,14 @@ void MblkLinAdv::tagGradientDetectorCells( * For user-defined, access refine box data from the MblkGeometry * class. */ - int block_number = patch.getBox().getBlockId().getBlockValue(); + hier::BlockId::block_t block_number = + patch.getBox().getBlockId().getBlockValue(); int level_number = patch.getPatchLevelNumber(); hier::BoxContainer refine_boxes; if (d_mblk_geometry->getRefineBoxes(refine_boxes, block_number, level_number)) { - for (hier::BoxContainer::iterator b(refine_boxes); + for (hier::BoxContainer::iterator b = refine_boxes.begin(); b != refine_boxes.end(); ++b) { hier::Box intersect = pbox * (*b); if (!intersect.empty()) { @@ -1961,8 +1950,9 @@ void MblkLinAdv::tagGradientDetectorCells( // // Update tags // - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -1980,8 +1970,7 @@ void MblkLinAdv::tagGradientDetectorCells( void MblkLinAdv::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) @@ -1990,7 +1979,6 @@ void MblkLinAdv::fillSingularityBoundaryConditions( NULL_USE(patch); NULL_USE(encon_level); NULL_USE(dst_to_encon); - NULL_USE(fill_time); NULL_USE(fill_box); NULL_USE(boundary_box); NULL_USE(grid_geometry); @@ -2007,11 +1995,9 @@ void MblkLinAdv::fillSingularityBoundaryConditions( void MblkLinAdv::setMappedGridOnPatch( const hier::Patch& patch, const int level_number, - const int block_number) + const hier::BlockId::block_t block_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(level_number >= 0); -#endif // compute level domain const boost::shared_ptr patch_geom( @@ -2049,9 +2035,7 @@ void MblkLinAdv::setMappedGridOnPatch( void MblkLinAdv::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -2073,13 +2057,13 @@ void MblkLinAdv::printClassData( os << "MblkLinAdv: this = " << (MblkLinAdv *)this << endl; os << "d_object_name = " << d_object_name << endl; os << "d_grid_geometry = " << endl; -// for (j=0; j < d_grid_geometry.getSize(); j++) { +// for (j=0; j < d_grid_geometry.getSize(); ++j) { // os << (*((boost::shared_ptr)(d_grid_geometry[j]))) << endl; // } os << "Parameters for numerical method ..." << endl; os << " d_advection_velocity = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_advection_velocity[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_advection_velocity[j] << " "; os << endl; os << " d_godunov_order = " << d_godunov_order << endl; os << " d_corner_transport = " << d_corner_transport << endl; @@ -2092,25 +2076,25 @@ void MblkLinAdv::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_uval_inside = " << d_uval_inside << endl; os << " d_uval_outside = " << d_uval_outside << endl; os << " d_number_of_intervals = " << d_number_of_intervals << endl; os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { + for (k = 0; k < d_number_of_intervals - 1; ++k) { os << d_front_position[k] << " "; } os << endl; os << " d_interval_uval = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_uval[k] << endl; } os << " Boundary condition data " << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { @@ -2119,15 +2103,14 @@ void MblkLinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " << d_node_bdry_edge[j] << endl; } - } - if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { + } else if (d_dim == tbox::Dimension(3)) { + for (j = 0; j < static_cast(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { @@ -2136,14 +2119,14 @@ void MblkLinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " @@ -2153,76 +2136,76 @@ void MblkLinAdv::printClassData( os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_tol.size()); ++j) { os << " d_dev_tol[" << j << "] = " << d_dev_tol[j] << endl; } - for (j = 0; j < d_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_dev.size()); ++j) { os << " d_dev[" << j << "] = " << d_dev[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_max.size()); ++j) { os << " d_dev_time_max[" << j << "] = " << d_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_min.size()); ++j) { os << " d_dev_time_min[" << j << "] = " << d_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_tol.size()); ++j) { os << " d_grad_tol[" << j << "] = " << d_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_max.size()); ++j) { os << " d_grad_time_max[" << j << "] = " << d_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_min.size()); ++j) { os << " d_grad_time_min[" << j << "] = " << d_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_onset.size()); ++j) { os << " d_shock_onset[" << j << "] = " << d_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_tol.size()); ++j) { os << " d_shock_tol[" << j << "] = " << d_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_max.size()); ++j) { os << " d_shock_time_max[" << j << "] = " << d_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_min.size()); ++j) { os << " d_shock_time_min[" << j << "] = " << d_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_tol.size()); ++j) { os << " d_rich_tol[" << j << "] = " << d_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_max.size()); ++j) { os << " d_rich_time_max[" << j << "] = " << d_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_min.size()); ++j) { os << " d_rich_time_min[" << j << "] = " << d_rich_time_min[j] << endl; } @@ -2242,9 +2225,7 @@ void MblkLinAdv::getFromInput( boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif boost::shared_ptr db(input_db->getDatabase("MblkLinAdv")); @@ -2303,12 +2284,11 @@ void MblkLinAdv::getFromInput( if (db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -2316,10 +2296,10 @@ void MblkLinAdv::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -2338,14 +2318,13 @@ void MblkLinAdv::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } if (error_db && error_key == "UVAL_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2354,8 +2333,7 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("uval_dev")) { - d_dev = - error_db->getDoubleArray("uval_dev"); + d_dev = error_db->getDoubleVector("uval_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -2364,18 +2342,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_dev_time_max = - error_db->getDoubleArray("time_max"); + d_dev_time_max = error_db->getDoubleVector("time_max"); } else { - d_dev_time_max.resizeArray(1); + d_dev_time_max.resize(1); d_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_dev_time_min = - error_db->getDoubleArray("time_min"); + d_dev_time_min = error_db->getDoubleVector("time_min"); } else { - d_dev_time_min.resizeArray(1); + d_dev_time_min.resize(1); d_dev_time_min[0] = 0.; } @@ -2384,8 +2360,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2394,18 +2369,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_grad_time_max = - error_db->getDoubleArray("time_max"); + d_grad_time_max = error_db->getDoubleVector("time_max"); } else { - d_grad_time_max.resizeArray(1); + d_grad_time_max.resize(1); d_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_grad_time_min = - error_db->getDoubleArray("time_min"); + d_grad_time_min = error_db->getDoubleVector("time_min"); } else { - d_grad_time_min.resizeArray(1); + d_grad_time_min.resize(1); d_grad_time_min[0] = 0.; } @@ -2414,8 +2387,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_SHOCK") { if (error_db->keyExists("shock_onset")) { - d_shock_onset = - error_db->getDoubleArray("shock_onset"); + d_shock_onset = error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -2424,8 +2396,7 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2434,18 +2405,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_shock_time_max = - error_db->getDoubleArray("time_max"); + d_shock_time_max = error_db->getDoubleVector("time_max"); } else { - d_shock_time_max.resizeArray(1); + d_shock_time_max.resize(1); d_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_shock_time_min = - error_db->getDoubleArray("time_min"); + d_shock_time_min = error_db->getDoubleVector("time_min"); } else { - d_shock_time_min.resizeArray(1); + d_shock_time_min.resize(1); d_shock_time_min[0] = 0.; } @@ -2454,8 +2423,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2464,18 +2432,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_rich_time_max = - error_db->getDoubleArray("time_max"); + d_rich_time_max = error_db->getDoubleVector("time_max"); } else { - d_rich_time_max.resizeArray(1); + d_rich_time_max.resize(1); d_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_rich_time_min = - error_db->getDoubleArray("time_min"); + d_rich_time_min = error_db->getDoubleVector("time_min"); } else { - d_rich_time_min.resizeArray(1); + d_rich_time_min.resize(1); d_rich_time_min[0] = 0.; } @@ -2551,7 +2517,6 @@ void MblkLinAdv::getFromInput( (d_data_problem == "SINE_CONSTANT_Y") || (d_data_problem == "SINE_CONSTANT_Z"))) { - int idir = 0; if (d_data_problem == "PIECEWISE_CONSTANT_Y") { if (d_dim < tbox::Dimension(2)) { TBOX_ERROR( @@ -2559,7 +2524,6 @@ void MblkLinAdv::getFromInput( << "problem invalid in 1 dimension." << endl); } - idir = 1; } if (d_data_problem == "PIECEWISE_CONSTANT_Z") { @@ -2568,13 +2532,12 @@ void MblkLinAdv::getFromInput( d_object_name << ": `PIECEWISE_CONSTANT_Z' " << "problem invalid in 1 or 2 dimensions." << endl); } - idir = 2; } - tbox::Array init_data_keys = init_data_db->getAllKeys(); + std::vector init_data_keys = init_data_db->getAllKeys(); if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); + d_front_position = init_data_db->getDoubleVector("front_position"); } else { TBOX_ERROR(d_object_name << ": " << "`front_position' input required for " @@ -2582,10 +2545,10 @@ void MblkLinAdv::getFromInput( } d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); + tbox::MathUtilities::Min(static_cast(d_front_position.size()) + 1, + static_cast(init_data_keys.size()) - 1); - d_interval_uval.resizeArray(d_number_of_intervals); + d_interval_uval.resize(d_number_of_intervals); int i = 0; int nkey = 0; @@ -2593,7 +2556,7 @@ void MblkLinAdv::getFromInput( while (!found_interval_data && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { + && (nkey < static_cast(init_data_keys.size()))) { if (!(init_data_keys[nkey] == "front_position")) { @@ -2607,13 +2570,13 @@ void MblkLinAdv::getFromInput( << "`uval' data missing in input for key = " << init_data_keys[nkey] << endl); } - i++; + ++i; found_interval_data = (i == d_number_of_intervals); } - nkey++; + ++nkey; } @@ -2654,8 +2617,8 @@ void MblkLinAdv::getFromInput( hier::IntVector periodic = d_grid_geometry->getPeriodicShift( hier::IntVector(d_dim, 1)); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } /* @@ -2672,14 +2635,13 @@ void MblkLinAdv::getFromInput( db->getDatabase("Boundary_data")); if (d_dim == tbox::Dimension(2)) { - SkeletonBoundaryUtilities2::readBoundaryInput(this, + SkeletonBoundaryUtilities2::getFromInput(this, bdry_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); - } - if (d_dim == tbox::Dimension(3)) { - SkeletonBoundaryUtilities3::readBoundaryInput(this, + } else if (d_dim == tbox::Dimension(3)) { + SkeletonBoundaryUtilities3::getFromInput(this, bdry_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, @@ -2703,29 +2665,31 @@ void MblkLinAdv::getFromInput( ************************************************************************* */ -void MblkLinAdv::putToDatabase( - const boost::shared_ptr& db) const +void MblkLinAdv::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("MBLKLINADV_VERSION", MBLKLINADV_VERSION); + restart_db->putInteger("MBLKLINADV_VERSION", MBLKLINADV_VERSION); - db->putDoubleArray("d_advection_velocity", d_advection_velocity, d_dim.getValue()); + restart_db->putDoubleArray("d_advection_velocity", + d_advection_velocity, + d_dim.getValue()); - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, d_dim.getValue()); - db->putDouble("d_uval_inside", d_uval_inside); - db->putDouble("d_uval_outside", d_uval_outside); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleArray("d_center", d_center, d_dim.getValue()); + restart_db->putDouble("d_uval_inside", d_uval_inside); + restart_db->putDouble("d_uval_outside", d_uval_outside); } if ((d_data_problem == "PIECEWISE_CONSTANT_X") || @@ -2734,43 +2698,50 @@ void MblkLinAdv::putToDatabase( (d_data_problem == "SINE_CONSTANT_X") || (d_data_problem == "SINE_CONSTANT_Y") || (d_data_problem == "SINE_CONSTANT_Z")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); + restart_db->putInteger("d_number_of_intervals", d_number_of_intervals); if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_uval", d_interval_uval); + restart_db->putDoubleVector("d_front_position", d_front_position); + restart_db->putDoubleVector("d_interval_uval", d_interval_uval); } } - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putIntegerVector("d_scalar_bdry_edge_conds", + d_scalar_bdry_edge_conds); + restart_db->putIntegerVector("d_scalar_bdry_node_conds", + d_scalar_bdry_node_conds); - db->putDoubleArray("d_bdry_edge_uval", d_bdry_edge_uval); - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_uval", d_bdry_face_uval); + if (d_dim == tbox::Dimension(2)) { + restart_db->putDoubleVector("d_bdry_edge_uval", d_bdry_edge_uval); + } else if (d_dim == tbox::Dimension(3)) { + restart_db->putIntegerVector("d_scalar_bdry_face_conds", + d_scalar_bdry_face_conds); + restart_db->putDoubleVector("d_bdry_face_uval", d_bdry_face_uval); + } - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - db->putDoubleArray("d_dev_tol", d_dev_tol); - db->putDoubleArray("d_dev", d_dev); - db->putDoubleArray("d_dev_time_max", d_dev_time_max); - db->putDoubleArray("d_dev_time_min", d_dev_time_min); + restart_db->putDoubleVector("d_dev_tol", d_dev_tol); + restart_db->putDoubleVector("d_dev", d_dev); + restart_db->putDoubleVector("d_dev_time_max", d_dev_time_max); + restart_db->putDoubleVector("d_dev_time_min", d_dev_time_min); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - db->putDoubleArray("d_grad_tol", d_grad_tol); - db->putDoubleArray("d_grad_time_max", d_grad_time_max); - db->putDoubleArray("d_grad_time_min", d_grad_time_min); + restart_db->putDoubleVector("d_grad_tol", d_grad_tol); + restart_db->putDoubleVector("d_grad_time_max", d_grad_time_max); + restart_db->putDoubleVector("d_grad_time_min", d_grad_time_min); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - db->putDoubleArray("d_shock_onset", d_shock_onset); - db->putDoubleArray("d_shock_tol", d_shock_tol); - db->putDoubleArray("d_shock_time_max", d_shock_time_max); - db->putDoubleArray("d_shock_time_min", d_shock_time_min); + restart_db->putDoubleVector("d_shock_onset", d_shock_onset); + restart_db->putDoubleVector("d_shock_tol", d_shock_tol); + restart_db->putDoubleVector("d_shock_time_max", d_shock_time_max); + restart_db->putDoubleVector("d_shock_time_min", d_shock_time_min); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - db->putDoubleArray("d_rich_tol", d_rich_tol); - db->putDoubleArray("d_rich_time_max", d_rich_time_max); - db->putDoubleArray("d_rich_time_min", d_rich_time_min); + restart_db->putDoubleVector("d_rich_tol", d_rich_tol); + restart_db->putDoubleVector("d_rich_time_max", d_rich_time_max); + restart_db->putDoubleVector("d_rich_time_min", d_rich_time_min); } } @@ -2842,45 +2813,45 @@ void MblkLinAdv::getFromRestart() (d_data_problem == "SINE_CONSTANT_Z")) { d_number_of_intervals = db->getInteger("d_number_of_intervals"); if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_uval = db->getDoubleArray("d_interval_uval"); + d_front_position = db->getDoubleVector("d_front_position"); + d_interval_uval = db->getDoubleVector("d_interval_uval"); } } - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); + d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); + d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_uval = db->getDoubleArray("d_bdry_edge_uval"); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); + d_bdry_edge_uval = db->getDoubleVector("d_bdry_edge_uval"); + } else if (d_dim == tbox::Dimension(3)) { + d_scalar_bdry_face_conds = + db->getIntegerVector("d_scalar_bdry_face_conds"); - d_bdry_face_uval = db->getDoubleArray("d_bdry_face_uval"); + d_bdry_face_uval = db->getDoubleVector("d_bdry_face_uval"); } if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - d_dev_tol = db->getDoubleArray("d_dev_tol"); - d_dev_time_max = db->getDoubleArray("d_dev_time_max"); - d_dev_time_min = db->getDoubleArray("d_dev_time_min"); + d_dev_tol = db->getDoubleVector("d_dev_tol"); + d_dev_time_max = db->getDoubleVector("d_dev_time_max"); + d_dev_time_min = db->getDoubleVector("d_dev_time_min"); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - d_grad_tol = db->getDoubleArray("d_grad_tol"); - d_grad_time_max = db->getDoubleArray("d_grad_time_max"); - d_grad_time_min = db->getDoubleArray("d_grad_time_min"); + d_grad_tol = db->getDoubleVector("d_grad_tol"); + d_grad_time_max = db->getDoubleVector("d_grad_time_max"); + d_grad_time_min = db->getDoubleVector("d_grad_time_min"); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - d_shock_onset = db->getDoubleArray("d_shock_onset"); - d_shock_tol = db->getDoubleArray("d_shock_tol"); - d_shock_time_max = db->getDoubleArray("d_shock_time_max"); - d_shock_time_min = db->getDoubleArray("d_shock_time_min"); + d_shock_onset = db->getDoubleVector("d_shock_onset"); + d_shock_tol = db->getDoubleVector("d_shock_tol"); + d_shock_time_max = db->getDoubleVector("d_shock_time_max"); + d_shock_time_min = db->getDoubleVector("d_shock_time_min"); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - d_rich_tol = db->getDoubleArray("d_rich_tol"); - d_rich_time_max = db->getDoubleArray("d_rich_time_max"); - d_rich_time_min = db->getDoubleArray("d_rich_time_min"); + d_rich_tol = db->getDoubleVector("d_rich_tol"); + d_rich_time_max = db->getDoubleVector("d_rich_time_max"); + d_rich_time_min = db->getDoubleVector("d_rich_time_min"); } } @@ -2900,17 +2871,15 @@ void MblkLinAdv::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, bdry_location_index, d_bdry_edge_uval); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { readStateDataEntry(db, db_name, bdry_location_index, @@ -2922,14 +2891,12 @@ void MblkLinAdv::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval) + std::vector& uval) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(uval.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(uval.size()) > array_indx); if (db->keyExists("uval")) { uval[array_indx] = db->getDouble("uval"); @@ -2963,14 +2930,13 @@ void MblkLinAdv::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const + const std::vector& scalar_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { TBOX_ASSERT(btype == Bdry::EDGE2D || btype == Bdry::NODE2D); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { TBOX_ASSERT(btype == Bdry::FACE3D || btype == Bdry::EDGE3D || btype == Bdry::NODE3D); @@ -2979,79 +2945,71 @@ void MblkLinAdv::checkBoundaryData( const boost::shared_ptr pgeom( patch.getPatchGeometry()); - const tbox::Array bdry_boxes = + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); int bscalarcase = 0, refbdryloc = 0; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_2D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_2D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_edge[bloc]; } - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_FACES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_edge_bdry_face[bloc]; } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_face[bloc]; } } +#if (TESTING == 1) int num_bad_values = 0; +#endif if (d_dim == tbox::Dimension(2)) { +#if (TESTING == 1) num_bad_values = - SkeletonBoundaryUtilities2::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_edge_uval[refbdryloc]); - } - if (d_dim == tbox::Dimension(3)) { +#endif + SkeletonBoundaryUtilities2::checkBdryData( + d_uval->getName(), + patch, + vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, + ghost_width_to_check, + bbox, + bscalarcase, + d_bdry_edge_uval[refbdryloc]); + } else if (d_dim == tbox::Dimension(3)) { +#if (TESTING == 1) num_bad_values = - SkeletonBoundaryUtilities3::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_face_uval[refbdryloc]); +#endif + SkeletonBoundaryUtilities3::checkBdryData( + d_uval->getName(), + patch, + vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, + ghost_width_to_check, + bbox, + bscalarcase, + d_bdry_face_uval[refbdryloc]); } #if (TESTING == 1) if (num_bad_values > 0) { diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.h index 9739a2bb..b6e020ba 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdv.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/pdat/SideData.h" @@ -22,18 +21,19 @@ #include "SAMRAI/appu/BoundaryUtilityStrategy.h" #include "SAMRAI/appu/VisItDataWriter.h" -#include "SkeletonCellDoubleConservativeLinearRefine.h" -#include "SkeletonCellDoubleWeightedAverage.h" +#include "test/testlib/SkeletonCellDoubleConservativeLinearRefine.h" +#include "test/testlib/SkeletonCellDoubleWeightedAverage.h" #include "SkeletonOutersideDoubleWeightedAverage.h" #include +#include using namespace std; #define included_String // Local classes used for this application #include "MblkGeometry.h" -#include "MblkHyperbolicLevelIntegrator.h" -#include "MblkHyperbolicPatchStrategy.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicPatchStrategy.h" /** * The MblkLinAdv class provides routines for a sample application code that @@ -59,6 +59,7 @@ using namespace SAMRAI; class MblkLinAdv: public tbox::Serializable, public MblkHyperbolicPatchStrategy, + public xfer::SingularityPatchStrategy, public appu::BoundaryUtilityStrategy { public: @@ -105,7 +106,7 @@ class MblkLinAdv: * In other words, variables are registered according to their role * in the integration process (e.g., time-dependent, flux, etc.). * This routine also registers variables for plotting with the - * Vis writer (Vizamrai or VisIt). + * Vis writer. */ void registerModelVariables( @@ -232,8 +233,7 @@ class MblkLinAdv: fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); @@ -245,7 +245,7 @@ class MblkLinAdv: setMappedGridOnPatch( const hier::Patch& patch, const int level_number, - const int block_number); + const hier::BlockId::block_t block_number); /** * Write state of MblkLinAdv object to the given database for restart. @@ -254,8 +254,8 @@ class MblkLinAdv: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -317,7 +317,7 @@ class MblkLinAdv: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void @@ -328,7 +328,7 @@ class MblkLinAdv: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); + std::vector& uval); /* * Private member function to check correctness of boundary data. @@ -338,7 +338,7 @@ class MblkLinAdv: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + const std::vector& scalar_bconds) const; /* * Three-dimensional flux computation routines corresponding to @@ -363,7 +363,7 @@ class MblkLinAdv: const tbox::Dimension d_dim; /* - * We cache pointers to the grid geometry and Vizamrai data writer + * We cache pointers to the grid geometry and VisIt data writer * object to set up initial data, set physical boundary conditions, * and register plot variables. */ @@ -404,7 +404,7 @@ class MblkLinAdv: /** * linear advection velocity vector */ - double d_advection_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_advection_velocity[SAMRAI::MAX_DIM_VAL]; /* * Parameters for numerical method: @@ -436,7 +436,7 @@ class MblkLinAdv: * Input for SPHERE problem */ double d_radius; - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; double d_uval_inside; double d_uval_outside; @@ -444,8 +444,8 @@ class MblkLinAdv: * Input for FRONT problem */ int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_uval; + std::vector d_front_position; + std::vector d_interval_uval; /* * Boundary condition cases and boundary values. @@ -454,50 +454,50 @@ class MblkLinAdv: * * Input file values are read into these arrays. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // 3D only + std::vector d_scalar_bdry_edge_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_scalar_bdry_face_conds; // 3D only /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_node_bdry_edge; // 2D only - tbox::Array d_edge_bdry_face; // 3D only - tbox::Array d_node_bdry_face; // 3D only + std::vector d_node_bdry_edge; // 2D only + std::vector d_edge_bdry_face; // 3D only + std::vector d_node_bdry_face; // 3D only /* - * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. + * Vectors of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_uval; - tbox::Array d_bdry_face_uval; + std::vector d_bdry_edge_uval; + std::vector d_bdry_face_uval; /* * Input for Sine problem initialization */ double d_amplitude; - double d_frequency[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_frequency[SAMRAI::MAX_DIM_VAL]; /* * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_dev_tol; - tbox::Array d_dev; - tbox::Array d_dev_time_max; - tbox::Array d_dev_time_min; - tbox::Array d_grad_tol; - tbox::Array d_grad_time_max; - tbox::Array d_grad_time_min; - tbox::Array d_shock_onset; - tbox::Array d_shock_tol; - tbox::Array d_shock_time_max; - tbox::Array d_shock_time_min; - tbox::Array d_rich_tol; - tbox::Array d_rich_time_max; - tbox::Array d_rich_time_min; + std::vector d_refinement_criteria; + std::vector d_dev_tol; + std::vector d_dev; + std::vector d_dev_time_max; + std::vector d_dev_time_min; + std::vector d_grad_tol; + std::vector d_grad_time_max; + std::vector d_grad_time_min; + std::vector d_shock_onset; + std::vector d_shock_tol; + std::vector d_shock_time_max; + std::vector d_shock_time_min; + std::vector d_rich_tol; + std::vector d_rich_time_max; + std::vector d_rich_time_min; /* * This class stores geometry information used for constructing the @@ -509,11 +509,11 @@ class MblkLinAdv: * Operators to be used with GridGeometry */ boost::shared_ptr - d_cell_cons_linear_refine_op; + d_cell_cons_linear_refine_op; boost::shared_ptr d_cell_cons_coarsen_op; boost::shared_ptr d_cell_time_interp_op; boost::shared_ptr - d_side_cons_coarsen_op; + d_side_cons_coarsen_op; }; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdvFort.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdvFort.h deleted file mode 100644 index 6de00706..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/MblkLinAdvFort.h +++ /dev/null @@ -1,373 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: F77 external declarations for SAMRAI linear advection example. - * - ************************************************************************/ - -#include -#include - -extern "C" { - -// 2D: - -void F77_FUNC(linadvinit, LINADVINIT) ( - const int&, const double *, const double *, const double *, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - double *, - const int&, - const double *, const double *); - -void F77_FUNC(linadvinitsine, LINADVINITSINE) ( - const int&, const double *, const double *, - const double *, const double *, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - double *, - const int&, - const double *, const double *, - const double&, const double *); - -void F77_FUNC(initsphere, INITSPHERE) ( - const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - double *, - double *, - const double&, const double&, - const double *, const double&); - -void F77_FUNC(stabledt, STABLEDT) ( - const double *, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const double *, - const double *, - double&); - -void F77_FUNC(inittraceflux, INITTRACEFLUX) ( - const int&, const int&, - const int&, const int&, - const double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(chartracing0, CHARTRACING0) ( - const double&, const int&, const int&, - const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(chartracing1, CHARTRACING1) ( - const double&, const int&, const int&, const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( - const double&, const int&, const int&, - const double *, - const int&, const int&, - const int&, const int&, - const double *, - const double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(fluxcorrec, FLUXCORREC) ( - const double&, const int&, const int&, const int&, const int&, - const double *, - const double *, const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(consdiff, CONSDIFF) ( - const int&, const int&, - const int&, const int&, - const double *, - const double *, const double *, - const double *, - double *); - -void F77_FUNC(getbdry, GETBDRY) ( - const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, - const int&, - const int&, - const double *, const double&, - double *, - const double *, const double *, const int&); - -void F77_FUNC(detectgrad, DETECTGRAD) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const double *, - const double&, - const int&, const int&, - const double *, - int *, int *); - -void F77_FUNC(detectshock, DETECTSHOCK) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const double *, - const double&, const double&, - const int&, const int&, - const double *, - int *, int *); - -void F77_FUNC(stufprobc, STUFPROBC) ( - const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -// in cartrefine2d.f: -void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, double *); - -// 3D: - -void F77_FUNC(linadvinit, LINADVINIT) ( - const int&, const double *, const double *, const double *, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const int&, - double *, - const int&, - const double *, const double *); - -void F77_FUNC(linadvinitsine, LINADVINITSINE) ( - const int&, const double *, const double *, - const double *, const double *, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const int&, - double *, - const int&, - const double *, const double *, - const double&, const double *); - -void F77_FUNC(initsphere, INITSPHERE) ( - const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const int&, - double *, - double *, - const double&, const double&, - const double *, const double&); - -void F77_FUNC(stabledt, STABLEDT) ( - const double *, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const int&, - const double *, - const double *, - double&); - -void F77_FUNC(inittraceflux, INITTRACEFLUX) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const double *, - double *, double *, double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(chartracing0, CHARTRACING0) ( - const double&, const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(chartracing1, CHARTRACING1) ( - const double&, const int&, const int&, const int&, const int&, - const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(chartracing2, CHARTRACING2) ( - const double&, const int&, const int&, const int&, const int&, - const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( - const double&, const int&, const int&, - const int&, - const double *, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const double *, - const double *, - double *, double *, double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( - const double&, const int&, const int&, const int&, const int&, - const int&, const int&, - const double *, const double *, const int&, - const double *, - const double *, const double *, const double *, - const double *, const double *, const double *, - const double *, const double *, const double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( - const double&, const int&, const int&, const int&, const int&, - const int&, const int&, - const double *, const double *, - const double *, - const double *, const double *, const double *, - const double *, const double *, const double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(consdiff, CONSDIFF) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const double *, - const double *, const double *, - const double *, - const double *, - double *); - -void F77_FUNC(getbdry, GETBDRY) ( - const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, - const int&, - const int&, - const int&, - const double *, const double&, - double *, - const double *, const double *, const int&); - -void F77_FUNC(onethirdstate, ONETHIRDSTATE) ( - const double&, const double *, const int&, - const int&, const int&, const int&, const int&, const int&, const int&, - const double *, const double *, - const double *, const double *, const double *, - double *); - -void F77_FUNC(fluxthird, FLUXTHIRD) ( - const double&, const double *, const int&, - const int&, const int&, const int&, const int&, const int&, const int&, - const double *, const double *, - const double *, - double *, double *, double *); - -void F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( - const double&, const double *, const int&, - const int&, const int&, const int&, const int&, const int&, const int&, - const double *, const double *, - const double *, const double *, const double *, - double *, double *, double *, - double *, double *, double *); - -void F77_FUNC(detectgrad, DETECTGRAD) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const double *, - const double&, - const int&, const int&, - const double *, - int *, int *); - -void F77_FUNC(detectshock, DETECTSHOCK) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const double *, - const double&, const double&, - const int&, const int&, - const double *, - int *, int *); - -void F77_FUNC(stufprobc, STUFPROBC) ( - const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -// in cartrefine3d.f: -void F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, - double *, double *, double *); -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 6b0f5329..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleConservativeLinearRefine.C deleted file mode 100644 index 4733eccc..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleConservativeLinearRefine.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonCellDoubleConservativeLinearRefine.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleWeightedAverage.C deleted file mode 100644 index 7bb47e1d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonCellDoubleWeightedAverage.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonCellDoubleWeightedAverage.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonOutersideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonOutersideDoubleWeightedAverage.C deleted file mode 100644 index 8866697a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/Pointer-SkeletonOutersideDoubleWeightedAverage.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonOutersideDoubleWeightedAverage.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/README b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/README index f98278a4..be67bb55 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/README +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/README @@ -3,27 +3,57 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: MULTIBLOCK LINEAR ADVECTION EQUATION EXAMPLE ## ######################################################################### +This README explains how to compile and run the Multiblock Linear Advection +application. The files in this directory are as follows: + + main.C - application driver program + MblkLinAdv.[C,h] - C++ class containing routines specific to the + Linear Advection example and which are called from + SAMRAI AMR library routines + MblkGeometry.[C,h] - Class managing the physical coordinate geometry + of the problem. + SkeletonOutersideDoubleWeightedAverage.[C,h] + - A coarsening operator needed for this problem + This example is similar to the single-block AMR LinAdv sample application. -Please see the README in that example for details on how to compile -and run. This example has the following differences: +This example has the following differences: 1. It works on non-cartesian mapped grids 2. It works with multiblock grids 3. All numerical kernel operations (e.g. computeFluxesOnPatch()) are c-based rather than fortran -The three test cases included are: +The two test cases included are: + + 1. wedge_1blk.3d - single block mapped wedge grid + 2. octant_3blk.3d - multi block (3 blocks) mapped octant grid + +Note that the numerics for this example have not been fully tested in 2D so it +currently should only run in 3D. + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main - 1. cart-1blk - single block Cartesian grid - 2. wedge-1blk - single block mapped wedge grid - 3. octant-3blk - multi block (3 blocks) mapped octant grid + Execution: + For one of the following input files: + test_inputs/octant_3blk.3d.input + test_inputs/wedge_1blk.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main -Note that this example will compile in 2D but the numerics have not been fully -tested so it currently should only run in 3D. For further information, please -contact Andy Wissink: awissink@llnl.gov +INPUT PARAMETERS +---------------- +Refer to test_inputs/octant_3blk.3d.input for full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.C deleted file mode 100644 index 6c6bfad7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.C +++ /dev/null @@ -1,878 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating 2D Skeleton boundary data - * - ************************************************************************/ - -#include "SkeletonBoundaryUtilities2.h" - -#include "SAMRAI/appu/CartesianBoundaryDefines.h" - -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/pdat/CellIndex.h" -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in - * boundary condition implementation. - * - ************************************************************************* - */ - -extern "C" { - -void F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -void F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&); - -void F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const double *, - double *, - const int&); - -} - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -bool SkeletonBoundaryUtilities2::s_fortran_constants_stuffed = false; - -/* - * This function reads 2D boundary data from given input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete BoundaryStrategy - * provided). When DIRICHLET or NEUMANN conditions are specified, control - * is passed to the BoundaryStrategy to read the boundary state data - * specific to the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary edges or - * node entries are not required from input. Error checking requires - * that node boundary conditions are consistent with those - * specified for the edges. - * - * Arguments are: - * bdry_strategy .... object that reads DIRICHLET or NEUMANN data - * bdry_db .......... input database containing all boundary data - * edge_conds ....... array into which integer boundary conditions - * for edges are read - * node_conds ....... array into which integer boundary conditions - * for nodes are read - * periodic ......... integer vector specifying which coordinate - * directions are periodic (value returned from - * GridGeometry2::getPeriodicShift()) - */ - -void SkeletonBoundaryUtilities2::readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - read2dBdryEdges(bdry_strategy, - bdry_db, - edge_conds, - periodic); - - read2dBdryNodes(bdry_db, - edge_conds, - node_conds, - periodic); - -} - -/* - * Function to fill edge boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_edge_conds ...... array of boundary conditions for patch edges - * bdry_edge_values ..... array of boundary values for edges - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities2::fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - - const hier::Box& interior = patch.getBox(); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& edge_bdry = - pgeom->getCodimensionBoundaries(Bdry::EDGE2D); - for (int i = 0; i < edge_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE2D); -#endif - - int bedge_loc = edge_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], - interior, - gcw_to_fill)); - - if (!fill_box.empty()) { - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ibeg(0), iend(0), - ibeg(1), iend(1), - ghost_cells(0), ghost_cells(1), - bedge_loc, - bdry_edge_conds[bedge_loc], - bdry_edge_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - } - - } - -} - -/* - * Function to fill node boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_node_conds ...... array of boundary conditions for patch nodes - * bdry_edge_values ..... array of boundary values for edges - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities2::fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_2D_NODES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& node_bdry = - pgeom->getCodimensionBoundaries(Bdry::NODE2D); - - for (int i = 0; i < node_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE2D); -#endif - - int bnode_loc = node_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], - interior, - gcw_to_fill)); - - if (!fill_box.empty()) { - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ibeg(0), iend(0), - ibeg(1), iend(1), - ghost_cells(0), ghost_cells(1), - bnode_loc, - bdry_node_conds[bnode_loc], - bdry_edge_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - } - - } - -} - -/* - * Function that returns the integer edge boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - */ - -int SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry( - int node_loc, - int node_btype) -{ - - int ret_edge = -1; - - switch (node_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - { - if (node_loc == NodeBdyLoc2D::XLO_YLO || - node_loc == NodeBdyLoc2D::XLO_YHI) { - ret_edge = BdryLoc::XLO; - } else { - ret_edge = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - { - if (node_loc == NodeBdyLoc2D::XLO_YLO || - node_loc == NodeBdyLoc2D::XHI_YLO) { - ret_edge = BdryLoc::YLO; - } else { - ret_edge = BdryLoc::YHI; - } - break; - } - default: { - TBOX_ERROR("Unknown node boundary condition type = " - << node_btype << " passed to \n" - << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" - << endl); - } - } - - if (ret_edge == -1) { - TBOX_ERROR("Node boundary condition type = " - << node_btype << " and node location = " << node_loc - << "\n passed to " - << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" - << " are inconsistant." << endl); - } - - return ret_edge; - -} - -/* - * Function to check 2D boundary data filling. Arguments are: - * - * varname ..... name of variable (for error reporting) - * patch ....... patch on which boundary data to check lives - * data_id ..... patch data index on patch - * depth ....... depth index of data to check - * gcw_to_check. boundary ghost width to fill - * bbox ........ boundary box to check - * bcase ....... boundary condition case for edge or a node to check - * bstate ...... boundary state that applies when such a value is - * required, such as when using Dirichlet conditions - */ - -int SkeletonBoundaryUtilities2::checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!varname.empty()); - TBOX_ASSERT(data_id >= 0); - TBOX_ASSERT(depth >= 0); -#endif - - int num_bad_values = 0; - - int btype = bbox.getBoundaryType(); - int bloc = bbox.getLocationIndex(); - - boost::shared_ptr pgeom(patch.getPatchGeometry()); - - boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); - - string bdry_type_str; - if (btype == Bdry::EDGE2D) { - bdry_type_str = "EDGE"; - } else if (btype == Bdry::NODE2D) { - bdry_type_str = "NODE"; - } else { - TBOX_ERROR( - "Unknown btype " << btype - << " passed to SkeletonBoundaryUtilities2::checkBdryData()! " - << endl); - } - - tbox::plog << "\n\nCHECKING 2D " << bdry_type_str << " BDRY DATA..." << endl; - tbox::plog << "varname = " << varname << " : depth = " << depth << endl; - tbox::plog << "bbox = " << bbox.getBox() << endl; - tbox::plog << "btype, bloc, bcase = " - << btype << ", = " << bloc << ", = " << bcase << endl; - - int idir; - double valfact = 0.0, constval = 0.0, dxfact = 0.0; - int offsign; - - get2dBdryDirectionCheckValues(idir, offsign, - btype, bloc, bcase); - - if (btype == Bdry::EDGE2D) { - - if (bcase == BdryCond::FLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::REFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::DIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::NODE2D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || - bcase == BdryCond::YDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } - - hier::Box gbox_to_check( - vardata->getGhostBox() * pgeom->getBoundaryFillBox(bbox, - patch.getBox(), - gcw_to_check)); - - hier::Box cbox(gbox_to_check); - hier::Box dbox(gbox_to_check); - hier::Index ifirst(vardata->getBox().lower()); - hier::Index ilast(vardata->getBox().upper()); - - if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); - } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); - } - - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { - double checkval = valfact * (*vardata)(*id, depth) + constval; - pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { - double offcheckval = checkval + dxfact * (p + 1); - if ((*vardata)(check, depth) != offcheckval) { - num_bad_values++; - TBOX_WARNING("Bad " << bdry_type_str - << " boundary value for " << varname - << " found in cell " << check - << "\n found = " << (*vardata)(check, depth) - << " : correct = " << offcheckval << endl); - } - check(idir) += offsign; - } - ++id; - } - - return num_bad_values; - -} - -/* - * Private function to read 2D edge boundary data from input database. - */ - -void SkeletonBoundaryUtilities2::read2dBdryEdges( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& edge_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 2) { // face boundary input required - - for (int s = 0; s < NUM_2D_EDGES; s++) { - - string bdry_loc_str; - switch (s) { - case BdryLoc::XLO: { - bdry_loc_str = "boundary_edge_xlo"; - break; - } - case BdryLoc::XHI: { - bdry_loc_str = "boundary_edge_xhi"; - break; - } - case BdryLoc::YLO: { - bdry_loc_str = "boundary_edge_ylo"; - break; - } - case BdryLoc::YHI: { - bdry_loc_str = "boundary_edge_yhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = true; - if (num_per_dirs > 0) { - if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { - need_data_read = false; - } else if (periodic(1) && (s == BdryLoc::YLO || - s == BdryLoc::YHI)) { - need_data_read = false; - } - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - edge_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - edge_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - edge_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 2) - -} - -/* - * Private function to read 2D node boundary data from input database. - */ - -void SkeletonBoundaryUtilities2::read2dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 1) { // node boundary data required - - for (int s = 0; s < NUM_2D_NODES; s++) { - - string bdry_loc_str; - switch (s) { - case NodeBdyLoc2D::XLO_YLO: { - bdry_loc_str = "boundary_node_xlo_ylo"; - break; - } - case NodeBdyLoc2D::XHI_YLO: { - bdry_loc_str = "boundary_node_xhi_ylo"; - break; - } - case NodeBdyLoc2D::XLO_YHI: { - bdry_loc_str = "boundary_node_xlo_yhi"; - break; - } - case NodeBdyLoc2D::XHI_YHI: { - bdry_loc_str = "boundary_node_xhi_yhi"; - break; - } - default: NULL_STATEMENT; - } - - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - string proper_edge; - string proper_edge_data; - bool no_edge_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || - s == NodeBdyLoc2D::XLO_YHI) { - proper_edge = "XLO"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "XHI"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || - s == NodeBdyLoc2D::XHI_YLO) { - proper_edge = "YLO"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "YHI"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } - if (no_edge_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_edge_data - << " data found for edge " - << proper_edge << endl); - } - - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // for (int s = 0 ... - - } // if (num_per_dirs < 1) - -} - -/* - * Private function to get boundary orientation information for - * 2D boundary condition checking. Called from checkBdryData(). - */ - -void SkeletonBoundaryUtilities2::get2dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase) -{ - - string bdry_type_str; - - if (btype == Bdry::EDGE2D) { - - bdry_type_str = "NODE"; - - if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { - idir = 0; - if (bloc == BdryLoc::XLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { - idir = 1; - if (bloc == BdryLoc::YLO) { - offsign = -1; - } else { - offsign = 1; - } - } else { - TBOX_ERROR( - "Unknown boundary location " << bloc - << - " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " - << bdry_type_str << " boundary " << endl); - } - - } else if (btype == Bdry::NODE2D) { - - bdry_type_str = "NODE"; - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET) { - idir = 0; - if (bloc == NodeBdyLoc2D::XLO_YLO || - bloc == NodeBdyLoc2D::XLO_YHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET) { - idir = 1; - if (bloc == NodeBdyLoc2D::XLO_YLO || - bloc == NodeBdyLoc2D::XHI_YLO) { - offsign = -1; - } else { - offsign = 1; - } - } - - } else { - TBOX_ERROR( - "Unknown boundary type " << btype - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - -} - -/* - * Private function to stuff 2D boundary contants into Fortran common blocks - */ - -void SkeletonBoundaryUtilities2::stuff2dBdryFortConst() -{ - F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( - BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, - NodeBdyLoc2D::XLO_YLO, NodeBdyLoc2D::XHI_YLO, - NodeBdyLoc2D::XLO_YHI, NodeBdyLoc2D::XHI_YHI); - F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( - BdryCond::FLOW, - BdryCond::XFLOW, BdryCond::YFLOW, - BdryCond::REFLECT, - BdryCond::XREFLECT, BdryCond::YREFLECT, - BdryCond::DIRICHLET, - BdryCond::XDIRICHLET, BdryCond::YDIRICHLET); - s_fortran_constants_stuffed = true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.h deleted file mode 100644 index 7b0e00f7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities2.h +++ /dev/null @@ -1,262 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating Skeleton 2d boundary data - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/appu/BoundaryUtilityStrategy.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Database.h" - -#include -#ifndef included_String -#include -#define included_String -#endif - -/*! - * @brief Class SkeletonBoundaryUtilities2 is a utility class that - * simplifies the implementation of simple physical boundary data in - * 2 spatial dimensions. It contains routines for reading boundary data - * information from input files, applying those boundary conditions, - * and error checking boundary data. These routines apply to the - * case of cell-centered double data only. One may use all of these - * capabilities, or use the input reading, boundary setting, and error - * checking routines independently. - * - * To use the boundary condition input reading capabilities, the format - * of the input file section containing the boundary information must - * be as described next. Boundary node and edge entries are only - * required for those that are not filled automatically when periodic - * conditions apply. - * - * The boundary condition for edge "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_edge_* { - * boundary_condition = ... // boundary condition string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... - * } - * - * Allowable edge identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi - * Supported edge boundary_condition strin values are: - * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - * - * \endverbatim - * - * The boundary condition for node "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_node_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable node identifiers (i.e., values for "*") are: - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition string values are: - * "XFLOW", "YFLOW", - * "XREFLECT", "YREFLECT", - * "XDIRICHLET", "YDIRICHLET", - * "XNEUMANN", "YNEUMANN" - * - * \endverbatim - * - * Note that node conditions must be consistent with adjacent edge conditions. - * - * See the include file SkeletonBoundaryDefines.h for integer constant - * definitions that apply for the various boundary types, locations, - * and boundary conditions. If you choose to use the input reading - * capabilities only and write your own boundary condition routines in - * FORTRAN, you should note that the integer constants for the various - * boundary condition types and locations are automatically "stuffed" into - * FORTRAN common blocks. This avoids potential problems with - * inconsistencies between C++ and FORTRAN usage. Please see the - * FORTRAN include file cartbdryparams2d.i for details. - * - * @see appu::BoundaryUtilityStrategy2 - */ - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -struct SkeletonBoundaryUtilities2 { -public: - /*! - * Function to read 2d boundary data from input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete - * BoundaryUtilityStrategy object provided). When DIRICHLET or - * NEUMANN conditions are specified, control is passed to the - * BoundaryUtilityStrategy to read the boundary state data specific to - * the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary edge or - * node entries are not required from input. Error checking - * requires that node boundary conditions are consistent - * with those specified for the edges. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN - * conditions - * @param bdry_db input database containing all boundary data - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read - * @param periodic integer vector specifying which coordinate - * directions are periodic (e.g., value returned from - * GridGeometry2::getPeriodicShift()) - */ - static void - readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - /*! - * Function to fill 2d edge boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. - */ - static void - fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values); - - /*! - * Function to fill 2d node boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. - */ - static void - fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values); - - /*! - * Function that returns the integer edge boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - * - * @return Integer edge location for node location and boundary condition type. - * - * @param node_loc Integer location for node. - * @param node_btype Integer boundary condition type for node. - */ - static int - getEdgeLocationForNodeBdry( - int node_loc, - int node_btype); - - /*! - * Function to check 2d boundary data for a patch data quantity on - * a patch after it is set. A warning message will be sent to log - * file for each bad boundary value that is found. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @return Integer number of bad boundary values found. - * - * @param varname String name of variable (for error reporting). - * @param patch hier::Patch on which data object lives. - * @param data_id hier::Patch data index for data on patch. - * @param depth Depth index of patch data to check. - * @param gcw_to_check Width of ghost region to check. - * @param bbox Boundary box to check. - * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. - */ - static int - checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate); - -private: - static bool s_fortran_constants_stuffed; - - static void - read2dBdryEdges( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& edge_conds, - const hier::IntVector& periodic); - - static void - read2dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - static void - get2dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase); - - static void - stuff2dBdryFortConst(); -}; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.C deleted file mode 100644 index 578308ee..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.C +++ /dev/null @@ -1,1673 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating 3D Skeleton boundary data - * - ************************************************************************/ - -#include "SkeletonBoundaryUtilities3.h" - -#include "SAMRAI/appu/CartesianBoundaryDefines.h" - -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/pdat/CellIndex.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in - * boundary condition implementation. - * - ************************************************************************* - */ - -extern "C" { - -void F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -void F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&); - -void F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -} -using namespace SAMRAI; -using namespace appu; - -bool SkeletonBoundaryUtilities3::s_fortran_constants_stuffed = false; - -/* - * This function reads 3D boundary data from given input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete BoundaryStrategy - * provided). When DIRICHLET or NEUMANN conditions are specified, control - * is passed to the BoundaryStrategy to read the boundary state data - * specific to the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary face, edge, or - * node entries are not required from input. Error checking requires - * that node and edge boundary conditions are consistent with those - * specified for the faces. - * - * Arguments are: - * bdry_strategy .... object that reads DIRICHLET or NEUMANN conditions - * bdry_db .......... input database containing all boundary data - * face_conds ....... array into which integer boundary conditions - * for faces are read - * edge_conds ....... array into which integer boundary conditions - * for edges are read - * node_conds ....... array into which integer boundary conditions - * for nodes are read - * periodic ......... integer vector specifying which coordinate - * directions are periodic (value returned from - * GridGeometry3::getPeriodicShift()) - */ - -void SkeletonBoundaryUtilities3::readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - read3dBdryFaces(bdry_strategy, - bdry_db, - face_conds, - periodic); - - read3dBdryEdges(bdry_db, - face_conds, - edge_conds, - periodic); - - read3dBdryNodes(bdry_db, - face_conds, - node_conds, - periodic); - -} - -/* - * Function to fill face boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_face_conds ...... array of boundary conditions for patch faces - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillFaceBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_face_conds.getSize() == NUM_3D_FACES); -// TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES*(vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - const tbox::Array& face_bdry = - pgeom->getCodimensionBoundaries(Bdry::FACE3D); - for (int i = 0; i < face_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(face_bdry[i].getBoundaryType() == Bdry::FACE3D); -#endif - - int bface_loc = face_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(face_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bface_loc, - bdry_face_conds[bface_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function to fill edge boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_edge_conds ...... array of boundary conditions for patch edges - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& edge_bdry = - pgeom->getCodimensionBoundaries(Bdry::EDGE3D); - for (int i = 0; i < edge_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE3D); -#endif - - int bedge_loc = edge_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bedge_loc, - bdry_edge_conds[bedge_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function to fill node boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_node_conds ...... array of boundary conditions for patch nodes - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_3D_NODES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& node_bdry = - pgeom->getCodimensionBoundaries(Bdry::NODE3D); - for (int i = 0; i < node_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE3D); -#endif - - int bnode_loc = node_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bnode_loc, - bdry_node_conds[bnode_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function that returns the integer face boundary location - * corresponding to the given edge location and edge boundary - * condition. - * - * If the edge boundary condition type or edge location are unknown, - * or the boundary condition type is inconsistant with the edge location - * an error results. - */ - -int SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry( - int edge_loc, - int edge_btype) -{ - - int ret_face = -1; - - switch (edge_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - case BdryCond::XNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XLO_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XLO_YHI) { - ret_face = BdryLoc::XLO; - } else if (edge_loc == EdgeBdyLoc3D::XHI_ZLO || - edge_loc == EdgeBdyLoc3D::XHI_ZHI || - edge_loc == EdgeBdyLoc3D::XHI_YLO || - edge_loc == EdgeBdyLoc3D::XHI_YHI) { - ret_face = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - case BdryCond::YNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YLO_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XHI_YLO) { - ret_face = BdryLoc::YLO; - } else if (edge_loc == EdgeBdyLoc3D::YHI_ZLO || - edge_loc == EdgeBdyLoc3D::YHI_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YHI || - edge_loc == EdgeBdyLoc3D::XHI_YHI) { - ret_face = BdryLoc::YHI; - } - break; - } - case BdryCond::ZFLOW: - case BdryCond::ZREFLECT: - case BdryCond::ZDIRICHLET: - case BdryCond::ZNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YHI_ZLO || - edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XHI_ZLO) { - ret_face = BdryLoc::ZLO; - } else if (edge_loc == EdgeBdyLoc3D::YLO_ZHI || - edge_loc == EdgeBdyLoc3D::YHI_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_ZHI || - edge_loc == EdgeBdyLoc3D::XHI_ZHI) { - ret_face = BdryLoc::ZHI; - } - break; - } - default: { - TBOX_ERROR("Unknown edge boundary condition type = " - << edge_btype << " passed to \n" - << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" - << endl); - } - } - - if (ret_face == -1) { - TBOX_ERROR("Edge boundary condition type = " - << edge_btype << " and edge location = " << edge_loc - << "\n passed to " - << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" - << " are inconsistant." << endl); - } - - return ret_face; - -} - -/* - * Function that returns the integer face boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - */ - -int SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry( - int node_loc, - int node_btype) -{ - - int ret_face = -1; - - switch (node_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - case BdryCond::XNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || - node_loc == NodeBdyLoc3D::XLO_YHI_ZLO || - node_loc == NodeBdyLoc3D::XLO_YLO_ZHI || - node_loc == NodeBdyLoc3D::XLO_YHI_ZHI) { - ret_face = BdryLoc::XLO; - } else { - ret_face = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - case BdryCond::YNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || - node_loc == NodeBdyLoc3D::XHI_YLO_ZLO || - node_loc == NodeBdyLoc3D::XLO_YLO_ZHI || - node_loc == NodeBdyLoc3D::XHI_YLO_ZHI) { - ret_face = BdryLoc::YLO; - } else { - ret_face = BdryLoc::YHI; - } - break; - } - case BdryCond::ZFLOW: - case BdryCond::ZREFLECT: - case BdryCond::ZDIRICHLET: - case BdryCond::ZNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || - node_loc == NodeBdyLoc3D::XHI_YLO_ZLO || - node_loc == NodeBdyLoc3D::XLO_YHI_ZLO || - node_loc == NodeBdyLoc3D::XHI_YHI_ZLO) { - ret_face = BdryLoc::ZLO; - } else { - ret_face = BdryLoc::ZHI; - } - break; - } - default: { - TBOX_ERROR("Unknown node boundary condition type = " - << node_btype << " passed to \n" - << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" - << endl); - } - } - - if (ret_face == -1) { - TBOX_ERROR("Node boundary condition type = " - << node_btype << " and node location = " << node_loc - << "\n passed to " - << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" - << " are inconsistant." << endl); - } - - return ret_face; - -} - -/* - * Function to check 3D boundary data filling. Arguments are: - * - * varname ..... name of variable (for error reporting) - * patch ....... patch on which boundary data to check lives - * data_id ..... patch data index on patch - * depth ....... depth index of data to check - * gcw_to_check. boundary ghost width to fill - * bbox ........ boundary box to check - * bcase ....... boundary condition case for edge or a node to check - * bstate ...... boundary state that applies when such a value is - * required, such as when using Dirichlet conditions - */ - -int SkeletonBoundaryUtilities3::checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!varname.empty()); - TBOX_ASSERT(data_id >= 0); - TBOX_ASSERT(depth >= 0); -#endif - - int num_bad_values = 0; - - int btype = bbox.getBoundaryType(); - int bloc = bbox.getLocationIndex(); - - boost::shared_ptr pgeom( - patch.getPatchGeometry()); - - boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); - - string bdry_type_str; - if (btype == Bdry::FACE3D) { - bdry_type_str = "FACE"; - } else if (btype == Bdry::EDGE3D) { - bdry_type_str = "EDGE"; - } else if (btype == Bdry::NODE3D) { - bdry_type_str = "NODE"; - } else { - TBOX_ERROR( - "Unknown btype " << btype - << " passed to SkeletonBoundaryUtilities3::checkBdryData()! " - << endl); - } - - tbox::plog << "\n\nCHECKING 3D " << bdry_type_str << " BDRY DATA..." << endl; - tbox::plog << "varname = " << varname << " : depth = " << depth << endl; - tbox::plog << "bbox = " << bbox.getBox() << endl; - tbox::plog << "btype, bloc, bcase = " - << btype << ", = " << bloc << ", = " << bcase << endl; - - int idir; - double valfact = 0.0, constval = 0.0, dxfact = 0.0; - int offsign; - - get3dBdryDirectionCheckValues(idir, offsign, - btype, bloc, bcase); - - if (btype == Bdry::FACE3D) { - - if (bcase == BdryCond::FLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::REFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::DIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::EDGE3D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || - bcase == BdryCond::ZFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || - bcase == BdryCond::ZREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || - bcase == BdryCond::ZDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::NODE3D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || - bcase == BdryCond::ZFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || - bcase == BdryCond::ZREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || - bcase == BdryCond::ZDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } - - hier::Box gbox_to_check(vardata->getGhostBox() * pgeom->getBoundaryFillBox( - bbox, - patch.getBox(), - gcw_to_check)); - - hier::Box cbox(gbox_to_check); - hier::Box dbox(gbox_to_check); - hier::Index ifirst(vardata->getBox().lower()); - hier::Index ilast(vardata->getBox().upper()); - - if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); - } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); - } - - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { - double checkval = valfact * (*vardata)(*id, depth) + constval; - pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { - double offcheckval = checkval + dxfact * (p + 1); - if ((*vardata)(check, depth) != offcheckval) { - num_bad_values++; - TBOX_WARNING("Bad " << bdry_type_str - << " boundary value for " << varname - << " found in cell " << check - << "\n found = " << (*vardata)(check, depth) - << " : correct = " << offcheckval << endl); - } - check(idir) += offsign; - } - ++id; - } - - return num_bad_values; - -} - -/* - * Private function to read 3D face boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryFaces( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& face_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 3) { // face boundary input required - - for (int s = 0; s < NUM_3D_FACES; s++) { - - string bdry_loc_str; - switch (s) { - case BdryLoc::XLO: { bdry_loc_str = "boundary_face_xlo"; - break; - } - case BdryLoc::XHI: { bdry_loc_str = "boundary_face_xhi"; - break; - } - case BdryLoc::YLO: { bdry_loc_str = "boundary_face_ylo"; - break; - } - case BdryLoc::YHI: { bdry_loc_str = "boundary_face_yhi"; - break; - } - case BdryLoc::ZLO: { bdry_loc_str = "boundary_face_zlo"; - break; - } - case BdryLoc::ZHI: { bdry_loc_str = "boundary_face_zhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = true; - if (num_per_dirs > 0) { - if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { - need_data_read = false; - } else if (periodic(1) && (s == BdryLoc::YLO || s == BdryLoc::YHI)) { - need_data_read = false; - } else if (periodic(2) && (s == BdryLoc::ZLO || s == BdryLoc::ZHI)) { - need_data_read = false; - } - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - face_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - face_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - face_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else if (bdry_cond_str == "NEUMANN") { - face_conds[s] = BdryCond::NEUMANN; - bdry_strategy-> - readNeumannBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown face boundary string = " - << bdry_cond_str << " found in input." << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 3) - -} - -/* - * Private function to read 3D edge boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryEdges( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 2) { // edge boundary input required - - for (int s = 0; s < NUM_3D_EDGES; s++) { - - string bdry_loc_str; - switch (s) { - case EdgeBdyLoc3D::YLO_ZLO: { - bdry_loc_str = "boundary_edge_ylo_zlo"; - break; - } - case EdgeBdyLoc3D::YHI_ZLO: { - bdry_loc_str = "boundary_edge_yhi_zlo"; - break; - } - case EdgeBdyLoc3D::YLO_ZHI: { - bdry_loc_str = "boundary_edge_ylo_zhi"; - break; - } - case EdgeBdyLoc3D::YHI_ZHI: { - bdry_loc_str = "boundary_edge_yhi_zhi"; - break; - } - case EdgeBdyLoc3D::XLO_ZLO: { - bdry_loc_str = "boundary_edge_xlo_zlo"; - break; - } - case EdgeBdyLoc3D::XLO_ZHI: { - bdry_loc_str = "boundary_edge_xlo_zhi"; - break; - } - case EdgeBdyLoc3D::XHI_ZLO: { - bdry_loc_str = "boundary_edge_xhi_zlo"; - break; - } - case EdgeBdyLoc3D::XHI_ZHI: { - bdry_loc_str = "boundary_edge_xhi_zhi"; - break; - } - case EdgeBdyLoc3D::XLO_YLO: { - bdry_loc_str = "boundary_edge_xlo_ylo"; - break; - } - case EdgeBdyLoc3D::XHI_YLO: { - bdry_loc_str = "boundary_edge_xhi_ylo"; - break; - } - case EdgeBdyLoc3D::XLO_YHI: { - bdry_loc_str = "boundary_edge_xlo_yhi"; - break; - } - case EdgeBdyLoc3D::XHI_YHI: { - bdry_loc_str = "boundary_edge_xhi_yhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = false; - if (num_per_dirs == 0) { - need_data_read = true; - } else if (periodic(0) && - (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI)) { - need_data_read = true; - } else if (periodic(1) && - (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI)) { - need_data_read = true; - } else if (periodic(2) && - (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || - s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI)) { - need_data_read = true; - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - edge_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - edge_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - edge_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - edge_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - edge_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - edge_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - edge_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - edge_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - edge_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - edge_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - edge_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - edge_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - bool ambiguous_type = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XREFLECT" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN") { - if (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YREFLECT" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZREFLECT" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || - s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI) { - ambiguous_type = true; - } - } - if (ambiguous_type) { - TBOX_ERROR("Ambiguous bdry condition " - << bdry_cond_str - << " found for " << bdry_loc_str << endl); - } - - string proper_face; - string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XLO_YHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 2) - -} - -/* - * Private function to read 3D node boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 1) { // node boundary data required - - for (int s = 0; s < NUM_3D_NODES; s++) { - - string bdry_loc_str; - switch (s) { - case NodeBdyLoc3D::XLO_YLO_ZLO: { - bdry_loc_str = "boundary_node_xlo_ylo_zlo"; - break; - } - case NodeBdyLoc3D::XHI_YLO_ZLO: { - bdry_loc_str = "boundary_node_xhi_ylo_zlo"; - break; - } - case NodeBdyLoc3D::XLO_YHI_ZLO: { - bdry_loc_str = "boundary_node_xlo_yhi_zlo"; - break; - } - case NodeBdyLoc3D::XHI_YHI_ZLO: { - bdry_loc_str = "boundary_node_xhi_yhi_zlo"; - break; - } - case NodeBdyLoc3D::XLO_YLO_ZHI: { - bdry_loc_str = "boundary_node_xlo_ylo_zhi"; - break; - } - case NodeBdyLoc3D::XHI_YLO_ZHI: { - bdry_loc_str = "boundary_node_xhi_ylo_zhi"; - break; - } - case NodeBdyLoc3D::XLO_YHI_ZHI: { - bdry_loc_str = "boundary_node_xlo_yhi_zhi"; - break; - } - case NodeBdyLoc3D::XHI_YHI_ZHI: { - bdry_loc_str = "boundary_node_xhi_yhi_zhi"; - break; - } - default: NULL_STATEMENT; - } - - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - node_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - node_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - node_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - node_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - node_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - node_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - string proper_face; - string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YHI_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || - s == NodeBdyLoc3D::XLO_YHI_ZHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || - s == NodeBdyLoc3D::XHI_YLO_ZHI) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || - s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YHI_ZLO || - s == NodeBdyLoc3D::XHI_YHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << endl); - } - - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // for (int s = 0 ... - - } // if (num_per_dirs < 1) - -} - -/* - * Private function to get boundary orientation information for - * 3D boundary condition checking. Called from checkBdryData(). - */ - -void SkeletonBoundaryUtilities3::get3dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase) -{ - - string bdry_type_str; - - if (btype == Bdry::FACE3D) { - - bdry_type_str = "FACE"; - - if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { - idir = 0; - if (bloc == BdryLoc::XLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { - idir = 1; - if (bloc == BdryLoc::YLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::ZLO || bloc == BdryLoc::ZHI) { - idir = 2; - if (bloc == BdryLoc::ZLO) { - offsign = -1; - } else { - offsign = 1; - } - } else { - TBOX_ERROR( - "Unknown boundary location " << bloc - << - " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " - << bdry_type_str << " boundary " << endl); - } - - } else if (btype == Bdry::EDGE3D) { - - bdry_type_str = "EDGE"; - - bool bad_case = false; - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { - idir = 0; - if (bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XLO_ZHI || - bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XLO_YHI) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::XHI_ZLO || bloc == EdgeBdyLoc3D::XHI_ZHI || - bloc == EdgeBdyLoc3D::XHI_YLO || bloc == EdgeBdyLoc3D::XHI_YHI) { - offsign = 1; - } else { - bad_case = true; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { - idir = 1; - if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YLO_ZHI || - bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XHI_YLO) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::YHI_ZLO || bloc == EdgeBdyLoc3D::YHI_ZHI || - bloc == EdgeBdyLoc3D::XLO_YHI || bloc == EdgeBdyLoc3D::XHI_YHI) { - offsign = 1; - } else { - bad_case = true; - } - } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || - bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { - idir = 2; - if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YHI_ZLO || - bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XHI_ZLO) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::YLO_ZHI || bloc == EdgeBdyLoc3D::YHI_ZHI || - bloc == EdgeBdyLoc3D::XLO_ZHI || bloc == EdgeBdyLoc3D::XHI_ZHI) { - offsign = 1; - } else { - bad_case = true; - } - } - if (bad_case) { - TBOX_ERROR( - "Unknown or ambigous bcase " << bcase - << - " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc - << endl); - } - - } else if (btype == Bdry::NODE3D) { - - bdry_type_str = "NODE"; - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { - idir = 0; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XLO_YHI_ZLO || - bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XLO_YHI_ZHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { - idir = 1; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || - bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XHI_YLO_ZHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || - bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { - idir = 2; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || - bloc == NodeBdyLoc3D::XLO_YHI_ZLO || bloc == NodeBdyLoc3D::XHI_YHI_ZLO) { - offsign = -1; - } else { - offsign = 1; - } - } - - } else { - TBOX_ERROR( - "Unknown boundary type " << btype - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - -} - -/* - * Private function to stuff 3D boundary contants into Fortran common blocks - */ - -void SkeletonBoundaryUtilities3::stuff3dBdryFortConst() -{ - F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( - BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, BdryLoc::ZLO, BdryLoc::ZHI, - EdgeBdyLoc3D::YLO_ZLO, EdgeBdyLoc3D::YHI_ZLO, EdgeBdyLoc3D::YLO_ZHI, - EdgeBdyLoc3D::YHI_ZHI, EdgeBdyLoc3D::XLO_ZLO, EdgeBdyLoc3D::XLO_ZHI, - EdgeBdyLoc3D::XHI_ZLO, EdgeBdyLoc3D::XHI_ZHI, EdgeBdyLoc3D::XLO_YLO, - EdgeBdyLoc3D::XHI_YLO, EdgeBdyLoc3D::XLO_YHI, EdgeBdyLoc3D::XHI_YHI, - NodeBdyLoc3D::XLO_YLO_ZLO, NodeBdyLoc3D::XHI_YLO_ZLO, NodeBdyLoc3D::XLO_YHI_ZLO, - NodeBdyLoc3D::XHI_YHI_ZLO, NodeBdyLoc3D::XLO_YLO_ZHI, NodeBdyLoc3D::XHI_YLO_ZHI, - NodeBdyLoc3D::XLO_YHI_ZHI, NodeBdyLoc3D::XHI_YHI_ZHI); - F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( - BdryCond::FLOW, - BdryCond::XFLOW, BdryCond::YFLOW, BdryCond::ZFLOW, - BdryCond::REFLECT, - BdryCond::XREFLECT, BdryCond::YREFLECT, BdryCond::ZREFLECT, - BdryCond::DIRICHLET, - BdryCond::XDIRICHLET, BdryCond::YDIRICHLET, BdryCond::ZDIRICHLET, - BdryCond::NEUMANN, - BdryCond::XNEUMANN, BdryCond::YNEUMANN, BdryCond::ZNEUMANN); - s_fortran_constants_stuffed = true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.h deleted file mode 100644 index f04aa913..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonBoundaryUtilities3.h +++ /dev/null @@ -1,341 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating Skeleton 3d boundary data - * - ************************************************************************/ - -#ifndef included_appu_SkeletonBoundaryUtilities3 -#define included_appu_SkeletonBoundaryUtilities3 - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/appu/BoundaryUtilityStrategy.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Database.h" - -#include -#include - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -/*! - * @brief Class SkeletonBoundaryUtilities2 is a utility class that - * simplifies the implementation of simple physical boundary data in - * 3 spatial dimensions. It contains routines for reading boundary data - * information from input files, applying those boundary conditions, - * and error checking boundary data. These routines apply to the - * case of cell-centered double data only. One may use all of these - * capabilities, or use the input reading, boundary setting, and error - * checking routines independently. - * - * To use the boundary condition input reading capabilities, the format - * of the input file section containing the boundary information must - * be as described next. Boundary face, node, and edge entries are only - * required for those that are not filled automatically when periodic - * conditions apply. - * - * The boundary condition for face "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_face_* { - * boundary_condition = ... // boundary condition string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... - * } - * - * Allowable face identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi, zlo, zhi - * Supported face boundary_condition string values are: - * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - * - * \endverbatim - * - * The boundary condition for edge "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_edge_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable edge identifiers (i.e., values for "*") are: - * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, - * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported edge boundary_condition string values are: - * "XFLOW", "YFLOW", "ZFLOW", - * "XREFLECT", "YREFLECT", "ZREFLECT", - * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" - * "XNEUMANN", "YNEUMANN", "ZNEUMANN" - * - * \endverbatim - * - * Note that edge conditions must be consistent with adjacent face conditions. - * - * The boundary condition for node "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_node_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable node identifiers (i.e., values for "*") are: - * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, - * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition values are: - * "XFLOW", "YFLOW", "ZFLOW", - * "XREFLECT", "YREFLECT", "ZREFLECT", - * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" - * "XNEUMANN", "YNEUMANN", "ZNEUMANN" - * - * \endverbatim - * - * Note that node conditions must be consistent with adjacent face conditions. - * - * See the include file SkeletonBoundaryDefines.h for integer constant - * definitions that apply for the various boundary types, locations, - * and boundary conditions. If you choose to use the input reading - * capabilities only and write your own boundary condition routines in - * FORTRAN, you should note that the integer constants for the various - * boundary condition types and locations are automatically "stuffed" into - * FORTRAN common blocks. This avoids potential problems with - * inconsistencies between C++ and FORTRAN usage. Please see the - * FORTRAN include file cartbdryparams3d.i for details. - * - * @see appu::BoundaryUtilityStrategy3 - */ - -struct SkeletonBoundaryUtilities3 { -public: - /*! - * Function to read 3d boundary data from input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete - * BoundaryUtilityStrategy object provided). When DIRICHLET or - * NEUMANN conditions are specified, control is passed to the - * BoundaryUtilityStrategy to read the boundary state data specific to - * the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary face, edge, or - * node entries are not required from input. Error checking - * requires that node and edge boundary conditions are consistent - * with those specified for the faces. - * - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN - * conditions - * @param bdry_db input database containing all boundary data - * @param face_conds array into which integer face boundary condition types - * are read - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read - * @param periodic integer vector specifying which coordinate - * directions are periodic (e.g., value returned from - * GridGeometry2::getPeriodicShift()) - */ - static void - readBoundaryInput( - appu::BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - /*! - * Function to fill 3d face boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_face_conds tbox::Array of boundary condition types for patch faces. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillFaceBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function to fill 3d edge boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function to fill 3d node boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function that returns the integer face boundary location - * corresponding to the given edge location and edge boundary - * condition. - * - * If the edge boundary condition type or edge location are unknown, - * or the boundary condition type is inconsistant with the edge location - * an error results. - * - * @return Integer face location for edge location and boundary condition type. - * - * @param edge_loc Integer location for edge. - * @param edge_btype Integer boundary condition type for edge. - */ - static int - getFaceLocationForEdgeBdry( - int edge_loc, - int edge_btype); - - /*! - * Function that returns the integer face boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - * - * @return Integer face location for node location and boundary condition type. - * - * @param node_loc Integer location for node. - * @param node_btype Integer boundary condition type for node. - */ - static int - getFaceLocationForNodeBdry( - int node_loc, - int node_btype); - - /*! - * Function to check 3d boundary data for a patch data quantity on - * a patch after it is set. A warning message will be sent to log - * file for each bad boundary value that is found. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @return Integer number of bad boundary values found. - * - * @param varname String name of variable (for error reporting). - * @param patch hier::Patch on which data object lives. - * @param data_id hier::Patch data index for data on patch. - * @param depth Depth index of patch data to check. - * @param gcw_to_check Width of ghost region to check. - * @param bbox Boundary box to check. - * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. - */ - static int - checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate); - -private: - static bool s_fortran_constants_stuffed; - - static void - read3dBdryFaces( - appu::BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& face_conds, - const hier::IntVector& periodic); - - static void - read3dBdryEdges( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, - const hier::IntVector& periodic); - - static void - read3dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - static void - get3dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase); - - static void - stuff3dBdryFortConst(); -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.C deleted file mode 100644 index 7e0fa30c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.C +++ /dev/null @@ -1,262 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Conservative linear refine operator for cell-centered - * double data on a Skeleton mesh. - * - ************************************************************************/ - -#include "SkeletonCellDoubleConservativeLinearRefine.h" - -#include -#include -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN routines. - * - ************************************************************************* - */ - -extern "C" { -// in cartrefine1d.f: -void F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *); -// in cartrefine2d.f: -void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, double *); -// in cartrefine3d.f: -void F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, - double *, double *, double *); -} - -using namespace SAMRAI; - -SkeletonCellDoubleConservativeLinearRefine:: -SkeletonCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "SKELETON_CONSERVATIVE_LINEAR_REFINE") -{ - const int max_levels = 10; - d_dx.resizeArray(max_levels); - for (int n = 0; n < max_levels; n++) { - d_dx[n].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[n][i] = 1.; - } - } - -} - -SkeletonCellDoubleConservativeLinearRefine::~ -SkeletonCellDoubleConservativeLinearRefine() -{ -} - -int -SkeletonCellDoubleConservativeLinearRefine::getOperatorPriority() const -{ - return 0; -} - -hier::IntVector -SkeletonCellDoubleConservativeLinearRefine::getStencilWidth() const { - return hier::IntVector(getDim(), 1); -} - -void SkeletonCellDoubleConservativeLinearRefine::refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::BoxOverlap& fine_overlap, - const hier::IntVector& ratio) const -{ - const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); - - TBOX_ASSERT(t_overlap != NULL); - - const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { - refine(fine, - coarse, - dst_component, - src_component, - *b, - ratio); - } -} - -void SkeletonCellDoubleConservativeLinearRefine::refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::Box& fine_box, - const hier::IntVector& ratio) const -{ - boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); - - TBOX_ASSERT(cdata); - TBOX_ASSERT(fdata); - TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - - const hier::Box cgbox(cdata->getGhostBox()); - - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - - const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - const hier::IntVector tmp_ghosts(getDim(), 0); - tbox::Array diff0(cgbox.numberCells(0) + 1); - pdat::CellData slope0(cgbox, 1, tmp_ghosts); - - int flev_num = fine.getPatchLevelNumber(); - int clev_num = coarse.getPatchLevelNumber(); - - // deal with levels not in hierarchy - if (flev_num < 0) flev_num = clev_num + 1; - if (clev_num < 0) clev_num = flev_num - 1; - - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - getDx(clev_num, cdx); - getDx(flev_num, fdx); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( - ifirstc(0), ilastc(0), - ifirstf(0), ilastf(0), - cilo(0), cihi(0), - filo(0), fihi(0), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer()); - } else if (getDim() == tbox::Dimension(2)) { - - tbox::Array diff1(cgbox.numberCells(1) + 1); - pdat::CellData slope1(cgbox, 1, tmp_ghosts); - - F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( - ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), - ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), - cilo(0), cilo(1), cihi(0), cihi(1), - filo(0), filo(1), fihi(0), fihi(1), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer()); - } else if (getDim() == tbox::Dimension(3)) { - - tbox::Array diff1(cgbox.numberCells(1) + 1); - pdat::CellData slope1(cgbox, 1, tmp_ghosts); - - tbox::Array diff2(cgbox.numberCells(2) + 1); - pdat::CellData slope2(cgbox, 1, tmp_ghosts); - - F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( - ifirstc(0), ifirstc(1), ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - ifirstf(0), ifirstf(1), ifirstf(2), - ilastf(0), ilastf(1), ilastf(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer(), - diff2.getPointer(), slope2.getPointer()); - } else { - TBOX_ERROR("SkeletonCellDoubleConservativeLinearRefine error...\n" - << "getDim() > 3 not supported." << endl); - - } - } -} - -void SkeletonCellDoubleConservativeLinearRefine::setDx( - const int level_number, - const double* dx) -{ - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[level_number][i] = dx[i]; - } - } -} - -void SkeletonCellDoubleConservativeLinearRefine::getDx( - const int level_number, - double* dx) const -{ - for (int i = 0; i < getDim().getValue(); i++) { - dx[i] = d_dx[level_number][i]; - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.h deleted file mode 100644 index d44416a0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleConservativeLinearRefine.h +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Conservative linear refine operator for cell-centered - * double data on a Skeleton mesh. - * - ************************************************************************/ - -#ifndef included_SkeletonCellDoubleConservativeLinearRefineXD -#define included_SkeletonCellDoubleConservativeLinearRefineXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#ifndef included_String -#include -#define included_String -#endif -#include "SAMRAI/hier/RefineOperator.h" - -#include - -using namespace std; -using namespace SAMRAI; - -/** - * Class SkeletonCellDoubleConservativeLinearRefine implements - * conservative linear interpolation for cell-centered double patch data - * defined over a Skeleton mesh. It is derived from the base class - * hier::RefineOperator. The numerical operations for the interpolation - * use FORTRAN numerical routines. - * - * @see hier::RefineOperator - */ - -class SkeletonCellDoubleConservativeLinearRefine: - public hier::RefineOperator -{ -public: - /** - * Uninteresting default constructor. - */ - SkeletonCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim); - - /** - * Uninteresting virtual destructor. - */ - virtual ~SkeletonCellDoubleConservativeLinearRefine(); - - /** - * The priority of cell-centered double conservative linear is 0. - * It will be performed before any user-defined interpolation operations. - */ - int - getOperatorPriority() const; - - /** - * The stencil width of the conservative linear interpolation operator is - * the vector of ones. - */ - hier::IntVector - getStencilWidth() const; - - /** - * Refine the source component on the coarse patch to the destination - * component on the fine patch using the cell-centered double conservative - * linear interpolation operator. Interpolation is performed on the - * intersection of the destination patch and the fine box. It is assumed - * that the coarse patch contains sufficient data for the stencil width of - * the refinement operator. - */ - void - refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::BoxOverlap& fine_overlap, - const hier::IntVector& ratio) const; - - void - refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::Box& fine_box, - const hier::IntVector& ratio) const; - - /** - * Set the dx, the distance between mesh nodes. - */ - void - setDx( - const int level_number, - const double* dx); - -private: - /** - * Return the dx - */ - void - getDx( - const int level_number, - double* dx) const; - - tbox::Array > d_dx; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.C deleted file mode 100644 index 398d42a0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.C +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Weighted averaging operator for cell-centered double data on - * a Skeleton mesh. - * - ************************************************************************/ - -#include "SkeletonCellDoubleWeightedAverage.h" - -#include -#include -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN routines. - * - ************************************************************************* - */ -extern "C" { -// in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -// in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -// in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -} - -using namespace SAMRAI; - -SkeletonCellDoubleWeightedAverage::SkeletonCellDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "SKELETON_CONSERVATIVE_COARSEN") -{ -} - -SkeletonCellDoubleWeightedAverage::~SkeletonCellDoubleWeightedAverage() -{ -} - -int SkeletonCellDoubleWeightedAverage::getOperatorPriority() const -{ - return 0; -} - -hier::IntVector -SkeletonCellDoubleWeightedAverage::getStencilWidth() const { - return hier::IntVector(getDim(), 0); -} - -void SkeletonCellDoubleWeightedAverage::coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const -{ - boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fdata); - TBOX_ASSERT(cdata); - TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); -#endif - - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); - - const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - - int flev_num = fine.getPatchLevelNumber(); - int clev_num = coarse.getPatchLevelNumber(); - - // deal with levels not in hierarchy - if (flev_num < 0) flev_num = clev_num + 1; - if (clev_num < 0) clev_num = flev_num - 1; - - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - getDx(clev_num, cdx); - getDx(flev_num, fdx); - - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( - ifirstc(0), ilastc(0), - filo(0), fihi(0), - cilo(0), cihi(0), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( - ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), - filo(0), filo(1), fihi(0), fihi(1), - cilo(0), cilo(1), cihi(0), cihi(1), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( - ifirstc(0), ifirstc(1), ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else { - TBOX_ERROR("SkeletonCellDoubleWeightedAverage error...\n" - << "getDim() > 3 not supported." << endl); - - } - } -} - -void SkeletonCellDoubleWeightedAverage::setDx( - const int level_number, - const double* dx) -{ - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[level_number][i] = dx[i]; - } - } -} - -void SkeletonCellDoubleWeightedAverage::getDx( - const int level_number, - double* dx) const -{ - for (int i = 0; i < getDim().getValue(); i++) { - dx[i] = d_dx[level_number][i]; - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.h deleted file mode 100644 index 20de42ec..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonCellDoubleWeightedAverage.h +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Weighted averaging operator for cell-centered double data on - * a Skeleton mesh. - * - ************************************************************************/ - -#ifndef included_SkeletonCellDoubleWeightedAverageXD -#define included_SkeletonCellDoubleWeightedAverageXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#ifndef included_String -#include -#define included_String -#endif -#include "SAMRAI/hier/CoarsenOperator.h" - -#include - -using namespace std; -using namespace SAMRAI; - -/** - * Class SkeletonCellDoubleWeightedAverageX implements conservative - * cell-weighted averaging for cell-centered double patch data defined over a - * Skeleton mesh. It is derived from the hier::CoarsenOperator base class. - * The numerical operations for the averaging use FORTRAN numerical routines. - * - * @see hier::CoarsenOperator - */ - -class SkeletonCellDoubleWeightedAverage: - public hier::CoarsenOperator -{ -public: - /** - * Uninteresting default constructor. - */ - SkeletonCellDoubleWeightedAverage( - const tbox::Dimension& dim); - - /** - * Uninteresting virtual destructor. - */ - virtual ~SkeletonCellDoubleWeightedAverage(); - - /** - * The priority of cell-centered double weighted averaging is 0. - * It will be performed before any user-defined coarsen operations. - */ - int - getOperatorPriority() const; - - /** - * The stencil width of the weighted averaging operator is the vector of - * zeros. That is, its stencil does not extend outside the fine box. - */ - hier::IntVector - getStencilWidth() const; - - /** - * Coarsen the source component on the fine patch to the destination - * component on the coarse patch using the cell-centered double weighted - * averaging operator. Coarsening is performed on the intersection of - * the destination patch and the coarse box. It is assumed that the - * fine patch contains sufficient data for the stencil width of the - * coarsening operator. - */ - void - coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const; - - /** - * Set the dx, the distance between mesh nodes. - */ - void - setDx( - const int level_number, - const double* dx); - -private: - /** - * Return the dx - */ - void - getDx( - const int level_number, - double* dx) const; - - tbox::Array > d_dx; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.C index f26edd78..d518145b 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Skeleton mesh. * @@ -28,14 +28,14 @@ */ extern "C" { // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +45,7 @@ void F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) ( const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +55,7 @@ void F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) ( const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +64,7 @@ void F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) ( const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -73,7 +73,7 @@ void F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) ( const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) ( +void SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -88,7 +88,8 @@ using namespace SAMRAI; SkeletonOutersideDoubleWeightedAverage::SkeletonOutersideDoubleWeightedAverage( const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "SKELETON_CONSERVATIVE_COARSEN") + hier::CoarsenOperator("SKELETON_CONSERVATIVE_COARSEN"), + d_dim(dim) { } @@ -102,8 +103,8 @@ int SkeletonOutersideDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -SkeletonOutersideDoubleWeightedAverage::getStencilWidth() const { - return hier::IntVector(getDim(), 0); +SkeletonOutersideDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector(dim, 0); } void SkeletonOutersideDoubleWeightedAverage::coarsen( @@ -115,29 +116,20 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( const hier::IntVector& ratio) const { boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); -#endif const hier::Index filo = fdata->getGhostBox().lower(); const hier::Index fihi = fdata->getGhostBox().upper(); const hier::Index cilo = cdata->getGhostBox().lower(); const hier::Index cihi = cdata->getGhostBox().upper(); - const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const hier::Index ifirstc = coarse_box.lower(); const hier::Index ilastc = coarse_box.upper(); @@ -148,16 +140,16 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( if (flev_num < 0) flev_num = clev_num + 1; if (clev_num < 0) clev_num = flev_num - 1; - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double cdx[SAMRAI::MAX_DIM_VAL]; + double fdx[SAMRAI::MAX_DIM_VAL]; getDx(clev_num, cdx); getDx(flev_num, fdx); - for (int d = 0; d < cdata->getDepth(); d++) { + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) ( + for (int i = 0; i < 2; ++i) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub1d, CARTWGTAVGOUTSIDEDOUB1D) ( ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -166,8 +158,8 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) ( + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d0, CARTWGTAVGOUTSIDEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -176,7 +168,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) ( + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub2d1, CARTWGTAVGOUTSIDEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -185,8 +177,8 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) ( + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d0, CARTWGTAVGOUTSIDEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -198,7 +190,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) ( + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d1, CARTWGTAVGOUTSIDEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -210,7 +202,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) ( + SAMRAI_F77_FUNC(cartwgtavgoutsidedoub3d2, CARTWGTAVGOUTSIDEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -224,7 +216,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdata->getPointer(2, i, d)); } else { TBOX_ERROR("SkeletonOutersideDoubleWeightedAverage error...\n" - << "getDim() > 3 not supported." << endl); + << "dimension > 3 not supported." << endl); } } } @@ -234,10 +226,10 @@ void SkeletonOutersideDoubleWeightedAverage::setDx( const int level_number, const double* dx) { - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { + if (level_number >= static_cast(d_dx.size())) { + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { d_dx[level_number][i] = dx[i]; } } @@ -247,7 +239,7 @@ void SkeletonOutersideDoubleWeightedAverage::getDx( const int level_number, double* dx) const { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { dx[i] = d_dx[level_number][i]; } } diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.h index 67d23ed4..1eabba20 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/SkeletonOutersideDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Skeleton mesh. * @@ -22,7 +22,7 @@ #endif #include "SAMRAI/hier/CoarsenOperator.h" -#include +#include "boost/shared_ptr.hpp" using namespace std; using namespace SAMRAI; @@ -63,7 +63,8 @@ class SkeletonOutersideDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -99,7 +100,8 @@ class SkeletonOutersideDoubleWeightedAverage: const int level_number, double* dx) const; - tbox::Array > d_dx; + const tbox::Dimension d_dim; + std::vector > d_dx; }; diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/example_inputs/cart_1blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/example_inputs/cart_1blk.3d.input deleted file mode 100644 index 369068c6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/example_inputs/cart_1blk.3d.input +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -MblkGeometry { - problem_type = "CARTESIAN" - - CartesianGeometry { - domain_xlo_0 = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - domain_xhi_0 = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. - } - - refine_boxes_0_0 = [(5,5,5),(9,9,9)] -} - - -MblkLinAdv { - - advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 5.5 , 5.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { -// refine_criteria = "USER_DEFINED", "UVAL_GRADIENT", "UVAL_SHOCK" - refine_criteria = "USER_DEFINED" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -Main { - dim = 3 -// log file parameters - log_file_name = "sphere-3d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_cart-1blk" - viz_dump_filename = "cart-1blk" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_cart-1blk" - -} - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -Multiblock { - num_blocks = 1 - - // Geometries of the hierachy blocks - BlockGeometry0{ - domain_boxes = [ (0,0,0) , (29,19,19) ] - } - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 - sing_box_0 = [(30,20,20),(30,20,20)] - } - - PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - - // Note: For the following regridding information, data is required for each - // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. - // If more data values than needed are given, only the number required - // will be read in. If fewer values are given, an error will result. - // - // Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 9 , 9 , 9 - // all finer levels will use same values as level_0... - } - // boxes < efficiency * vol of large box - } -} - - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.5e0 // max cfl factor used in problem - cfl_init = 0.5e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/skelbdry2d.m4 b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/skelbdry2d.m4 deleted file mode 100644 index ea1f8b74..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/skelbdry2d.m4 +++ /dev/null @@ -1,430 +0,0 @@ -c -c -c general boundary condition cases -c -c -c node boundary conditions -c -c -c edge boundary conditions -c -c*********************************************************************** -c*********************************************************************** - subroutine getskeledgebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1, 0) 2 (0,-1) -c 1 ( 1, 0) 3 (0, 1) -c*********************************************************************** -c*********************************************************************** - edge_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskelnodebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc0,edge_loc1 - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index -c 0 (-1,-1) -c 1 ( 1,-1) -c 2 (-1, 1) -c 3 ( 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X0Y1) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - else if (bdry_loc.eq.X1Y1) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc0) - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc1) - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getskelnodebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdryloc2d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - -c 2d edges - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - -c 2d nodes - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdrycond2d( - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/upfluxsum2d.m4 b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/upfluxsum2d.m4 deleted file mode 100644 index 85dd842b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/2d/upfluxsum2d.m4 +++ /dev/null @@ -1,89 +0,0 @@ -c -c File: algs_upfluxsum2d.m4 -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 2d flux sums from fluxes. -c -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -define(upfluxsumface_case_2d,`dnl - subroutine upfluxsumface2d$1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - REAL - & flux(SIDE2d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE2d$1(ilo,ihi,0)) - integer ie$1,ic$2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie$1 = ilo$1 - else - ie$1 = ihi$1+1 - endif - - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2)=fluxsum(ic$2)+flux(ie$1,ic$2) - enddo -c - return - end -')dnl -define(upfluxsumside_case_2d,`dnl - subroutine upfluxsumside2d$1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - REAL - & flux(SIDE2d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE2d$1(ilo,ihi,0)) - integer ic$1,ic$2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ic$1 = ilo$1 - else - ic$1 = ihi$1+1 - endif - - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2)=fluxsum(ic$2)+flux(ic0,ic1) - enddo -c - return - end -')dnl -upfluxsumface_case_2d(0,1)dnl -c -upfluxsumface_case_2d(1,0)dnl -c -upfluxsumside_case_2d(0,1)dnl -c -upfluxsumside_case_2d(1,0)dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/skelbdry3d.m4 b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/skelbdry3d.m4 deleted file mode 100644 index 35ed9eb1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/skelbdry3d.m4 +++ /dev/null @@ -1,1414 +0,0 @@ -c -c*********************************************************************** -c*********************************************************************** - subroutine getskelfacebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_cartbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (-1, 0, 0) 2 (0,-1, 0) 4 (0, 0,-1) -c 1 ( 1, 0, 0) 3 (0, 1, 0) 5 (0, 0, 1) -c*********************************************************************** -c*********************************************************************** - face_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.ZLEFT).or.(bdry_loc.eq.ZRIGHT)) then - if (bdry_loc.eq.ZLEFT) then -c z0 boundary - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else -c z1 boundary - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskeledgebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) -c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) -c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) -c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) -c*********************************************************************** -c*********************************************************************** - if ((bdry_loc.eq.Y0Z0).or.(bdry_loc.eq.Y1Z0).or. - & (bdry_loc.eq.Y0Z1).or.(bdry_loc.eq.Y1Z1)) then - if (bdry_loc.eq.Y0Z0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y1Z0) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y0Z1) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Z0).or.(bdry_loc.eq.X0Z1).or. - & (bdry_loc.eq.X1Z0).or.(bdry_loc.eq.X1Z1)) then - if (bdry_loc.eq.X0Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X0Z1) then - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Y0).or.(bdry_loc.eq.X1Y0).or. - & (bdry_loc.eq.X0Y1).or.(bdry_loc.eq.X1Y1)) then - if (bdry_loc.eq.X0Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else if (bdry_loc.eq.X0Y1) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskelnodebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1,-1,-1) 4 (-1,-1, 1) -c 1 ( 1,-1,-1) 5 ( 1,-1, 1) -c 2 (-1, 1,-1) 6 (-1, 1, 1) -c 3 ( 1, 1,-1) 7 ( 1, 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y0Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y1Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y1Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y0Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y0Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X0Y1Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y1Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getskelnodebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdryloc3d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - -c 3d faces - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - ZLEFT=ZLEFTin - ZRIGHT=ZRIGHTin - -c 3d edges - Y0Z0=Y0Z0in - Y1Z0=Y1Z0in - Y0Z1=Y0Z1in - Y1Z1=Y1Z1in - X0Z0=X0Z0in - X0Z1=X0Z1in - X1Z0=X1Z0in - X1Z1=X1Z1in - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - -c 3d nodes - X0Y0Z0=X0Y0Z0in - X1Y0Z0=X1Y0Z0in - X0Y1Z0=X0Y1Z0in - X1Y1Z0=X1Y1Z0in - X0Y0Z1=X0Y0Z1in - X1Y0Z1=X1Y0Z1in - X0Y1Z1=X0Y1Z1in - X1Y1Z1=X1Y1Z1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdrycond3d( - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - ZFLOW=ZFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - ZREFLECT=ZREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - ZDIRICHLET=ZDIRICHLETin - - NEUMANN=NEUMANNin - XNEUMANN=XNEUMANNin - YNEUMANN=YNEUMANNin - ZNEUMANN=ZNEUMANNin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/upfluxsum3d.m4 b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/upfluxsum3d.m4 deleted file mode 100644 index 60806234..00000000 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/fortran/3d/upfluxsum3d.m4 +++ /dev/null @@ -1,98 +0,0 @@ -c -c File: algs_upfluxsum3d.m4 -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 3d flux sums from fluxes. -c -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -define(upfluxsumface_case_3d,`dnl - subroutine upfluxsumface3d$1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - REAL - & flux(SIDE3d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE3d$1(ilo,ihi,0)) - integer ie$1,ic$2,ic$3 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie$1 = ilo$1 - else - ie$1 = ihi$1+1 - endif - - do ic$3=ilo$3,ihi$3 - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ie$1,ic$2,ic$3) - enddo - enddo -c - return - end -')dnl -c -c -define(upfluxsumside_case_3d,`dnl - subroutine upfluxsumside3d$1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - REAL - & flux(SIDE3d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE3d$1(ilo,ihi,0)) - integer ic$1,ic$2,ic$3 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic$1 = ilo$1 - else - ic$1 = ihi$1+1 - endif - - do ic$3=ilo$3,ihi$3 - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -')dnl -upfluxsumface_case_3d(0,1,2)dnl -c -upfluxsumface_case_3d(1,2,0)dnl -c -upfluxsumface_case_3d(2,0,1)dnl -c -upfluxsumside_case_3d(0,1,2)dnl -c -upfluxsumside_case_3d(1,0,2)dnl -c -upfluxsumside_case_3d(2,0,1)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/main.C b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/main.C index c14842a6..f31693c3 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/main.C +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI Linear Advection example problem. * ************************************************************************/ @@ -24,6 +24,7 @@ using namespace std; // Headers for basic SAMRAI objects +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/RestartManager.h" @@ -40,9 +41,13 @@ using namespace std; // Header for application-specific algorithm/data structure object -#include "MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" #include "MblkLinAdv.h" +#ifdef _OPENMP +#include +#endif + // Classes for run-time plotting and autotesting. #if (TESTING == 1) @@ -170,7 +175,7 @@ int main( /* * Run problem twice to test startup/shutdown process for multi-block problems. */ - for (int run = 0; run < 2; run++) { + for (int run = 0; run < 2; ++run) { tbox::SAMRAIManager::startup(); const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -233,7 +238,7 @@ int main( /* * Retrieve "Main" section of the input database. First, read dump - * information, which is used for writing vizamrai plot files. Second, + * information, which is used for writing VisIt plot files. Second, * if proper restart information was given on command line, and the restart * interval is non-zero, create a restart database. */ @@ -243,7 +248,7 @@ int main( const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); - string log_file_name = "linadv.log"; + string log_file_name = "MblkLinAdv.log"; if (main_db->keyExists("log_file_name")) { log_file_name = main_db->getString("log_file_name"); } @@ -257,6 +262,14 @@ int main( tbox::PIO::logOnlyNodeZero(log_file_name); } +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif + int viz_dump_interval = 0; if (main_db->keyExists("viz_dump_interval")) { viz_dump_interval = main_db->getInteger("viz_dump_interval"); @@ -375,24 +388,24 @@ int main( input_db->getDatabase("HyperbolicLevelIntegrator"), linear_advection_model, mblk_patch_hierarchy, - true, use_refined_timestepping)); boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", mblk_hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); + new mesh::BergerRigoutsos(dim, + input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer( dim, "TreeLoadBalancer", - input_db->getDatabase("TreeLoadBalancer"))); + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); boost::shared_ptr mblk_gridding_algorithm( @@ -417,7 +430,7 @@ int main( /* * Set up Visualization plot file writer(s). */ - // VisitDataWriter is only present if HDF is available + // VisItDataWriter is only present if HDF is available #ifdef HAVE_HDF5 bool is_multiblock = true; boost::shared_ptr visit_data_writer( @@ -602,9 +615,7 @@ void setupHierarchy( boost::shared_ptr& geometry, boost::shared_ptr& mblk_hierarchy) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif boost::shared_ptr mult_db( main_input_db->getDatabase("PatchHierarchy")); @@ -628,6 +639,6 @@ void setupHierarchy( } mblk_hierarchy.reset( - new hier::PatchHierarchy("PatchHierarchy", geometry, mult_db, true)); + new hier::PatchHierarchy("PatchHierarchy", geometry, mult_db)); } diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/octant_3blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/octant_3blk.3d.input index 5674b005..fc8ad9ee 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/octant_3blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/octant_3blk.3d.input @@ -3,28 +3,40 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ + + MblkGeometry { + + //Choices are CARTESIAN, WEDGE, and SPHERICAL_SHELL. Only SPHERICAL_SHELL + //sets up a multiblock problem. problem_type = "SPHERICAL_SHELL" + //Define the parameters of the shell ShellGeometry { + //Minimum and maximum sperical radii, no default rmin = 1.e0 rmax = 2.e0 + //Choices are SOLID and OCTANT, no default shell_type = "OCTANT" } - // The refinement boxes are specified here because the MultiblockGriddingAlg does not have any - // way to take in refinement boxes for multiple blocks. The format is "refine_boxes[block][lev]". - // level 0 + // The refinement boxes are specified here because this test was written + // when the GriddingAlgorithm did not have any way to take in user-specified + // refinement boxes for multiple blocks. This could be cleaned up to use + // the libray's standard formant. Here the format is + // "refine_boxes_[block]_[lev]". + + // Level 0 boxes to be refined when creating Level 1 refine_boxes_0_0 = [(5,0,0),(5,9,9)] refine_boxes_1_0 = [(5,0,0),(5,9,9)] refine_boxes_2_0 = [(5,0,0),(5,9,9)] - // level 1 + // Level 1 boxes to be refined when creating Level 2 refine_boxes_0_1 = [(20,0,0),(20,39,39)] refine_boxes_1_1 = [(20,0,0),(20,39,39)] refine_boxes_2_1 = [(20,0,0),(20,39,39)] @@ -33,26 +45,57 @@ MblkGeometry { MblkLinAdv { + // Linear advection velocity vector--vector of length dim. + // No default advection_velocity = 0.0e0 , 2.0e0 , 0.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) + + // Order of Godunov slopes (1, 2, or 4). Default is 1. + godunov_order = 2 + + // Type of finite difference approximation for 3d transverse flux + // correction. Allowed values are CORNER_TRANSPORT_1 and + // CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + // Default is "CORNER_TRANSPORT_1". corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. Options are + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z", "SINE_CONSTANT_X", "SINE_CONSTANT_Y", + // "SINE_CONSTANT_Z". Specific Initial_data inputs vary by problem type. + // No default. data_problem = "SPHERE" - Initial_data { + // Radius of sphere. No default. radius = 0.2 + + // Center of sphere. No default. center = 0.75 , 1.0 , 0.75 + // uval inside of sphere. No default. uval_inside = 80.0 + + // uval outside of sphere. No default. uval_outside = 5.0 } Refinement_data { + // Use refinement boxes specified above in the MblkGeometry refine_criteria = "USER_DEFINED" + + // Other error-based refinement options can be used here. See analogous + // input documentation in test.2d.input of the applications/LinAdv + // test. } - // valid boundary_condition values are "REFLECT", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. Boundary_data { boundary_face_xlo { boundary_condition = "REFLECT" @@ -141,25 +184,47 @@ MblkLinAdv { } Main { + + // Dimension of problem. No default. dim = 3 -// log file parameters + + // File name for output log. Default "MblkLinAdv.log" log_file_name = "octant.log" + + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 5 // zero to turn off + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off + // Default is 0. + viz_dump_interval = 5 + + // Directory in which to place viz output. + // No default, error will occur if viz_dump_interval > 0 and + // this directory name is not specified. viz_dump_dirname = "viz_octant-3blk" - viz_dump_filename = "octant" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai + // Number of processors that write to each viz file, default is 1. + visit_number_procs_per_file = 1 + + + // Restart dump parameters. -// restart dump parameters + // Frequency at which to dump restart output--zero to turn off + // Default is 0. restart_interval = 0 // zero to turn off + + // Directory in which to place restart output. + // No default, error will occur if restart_interval > 0 and + // this directory name is not specified. restart_write_dirname = "restart_octant" } +// Refer to tbox::TimerManager for input TimerManager { timer_list = "apps::*::*", "algs::*::*", @@ -171,21 +236,13 @@ TimerManager { print_threshold = 0.0 } - +// Refer to hier::BaseGridGeometry and geom::GridGeometry for input BlockGeometry { num_blocks = 3 domain_boxes_0 = [ (0,0,0) , (19,19,19) ] domain_boxes_1 = [ (0,0,0) , (19,19,19) ] domain_boxes_2 = [ (0,0,0) , (19,19,19) ] - // Singularity defn and neighbors - Singularity0 { - blocks = 0 , 1 , 2 - sing_box_0 = [(0,20,20),(19,20,20)] - sing_box_1 = [(0,20,20),(19,20,20)] - sing_box_2 = [(0,-1,20),(19,-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -214,6 +271,7 @@ BlockGeometry { } } +// Refer to hier::PatchHierarchy for input PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE max_levels = 1 // Maximum number of levels in hierarchy. @@ -230,24 +288,25 @@ PatchHierarchy { } } - - - - - -GriddingAlgorithm{ - sequentialize_patch_indices = TRUE - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ + sequentialize_patch_indices = TRUE } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.5e0 // max cfl factor used in problem cfl_init = 0.5e0 // initial cfl factor @@ -255,6 +314,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ tag_buffer = 2, 2, 2 // number of zones used in the tag buffer start_time = 0.e0 // initial simulation time @@ -263,5 +323,6 @@ TimeRefinementIntegrator{ max_integrator_steps = 50 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { } diff --git a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/wedge_1blk.3d.input b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/wedge_1blk.3d.input index efa9252a..a565b16d 100644 --- a/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/wedge_1blk.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/MblkLinAdv/test_inputs/wedge_1blk.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ +// Refer to octant_3blk.3d.input for full description of all input parameters +// specific to this problem. + MblkGeometry { problem_type = "WEDGE" @@ -151,11 +154,9 @@ Main { log_all_nodes = TRUE // visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both viz_dump_interval = 1 // zero to turn off viz_dump_dirname = "viz_wedge" - viz_dump_filename = "wedge" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai + visit_number_procs_per_file = 1 // restart dump parameters @@ -180,12 +181,6 @@ TimerManager { BlockGeometry { num_blocks = 1 domain_boxes_0 = [ (0,0,0) , (29,19,19) ] - - // Singularity defn and neighbors - Singularity0 { - blocks = 0 - sing_box_0 = [(30,20,20),(30,20,20)] - } } PatchHierarchy { @@ -205,19 +200,16 @@ PatchHierarchy { } } - - - - - -GriddingAlgorithm{ - sequentialize_patch_indices = TRUE - +BergerRigoutsos { efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm{ + sequentialize_patch_indices = TRUE +} + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } diff --git a/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.depend new file mode 100644 index 00000000..22545e32 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.depend @@ -0,0 +1,89 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=main.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartition.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + diff --git a/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.in b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.in new file mode 100644 index 00000000..c710c889 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/Makefile.in @@ -0,0 +1,75 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for timer and statistician main programs +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/OverlapConnectorAlgorithm +VPATH = @srcdir@ +TESTTOOLS = ../testtools +OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml + +default: check + +include $(OBJECT)/config/Makefile.config + +CPPFLAGS_EXTRA= -DTESTING=1 + +main: main.o $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(LIBSAMRAI) $(LDLIBS) -o main + +NUM_TESTS = 2 + +TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +checkcompile: main + +check: checkcompile + @for i in test_inputs/*.input ; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +check2d: + $(MAKE) check + +check3d: + $(MAKE) check + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/main.C b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/main.C new file mode 100644 index 00000000..270c8f1b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/main.C @@ -0,0 +1,325 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test program to test OverlapConnectorAlgorithm class + * + ************************************************************************/ + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/MemoryDatabase.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/hier/AssumedPartition.h" +#include "SAMRAI/hier/BoxLevel.h" +#include "SAMRAI/hier/Connector.h" +#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" +#include "SAMRAI/geom/GridGeometry.h" + +#include "boost/make_shared.hpp" + +using namespace std; + +using namespace SAMRAI; +using namespace hier; + +/*! + * @brief Primitive BoxGenerator (independent of mesh package) + * creating boxes using an AssumedPartition followed by an index + * filter to keep a subset of boxes. + */ +struct PrimitiveBoxGen { + boost::shared_ptr d_geom; + AssumedPartition d_ap; + // Index filtering parameters. + enum IndexFilter { ALL = 0 /* Keep all boxes */, + INTERVAL = 1 /* Keep d_num_keep, discard d_num_discard */ + }; + int d_index_filter; + int d_num_keep; + int d_num_discard; + PrimitiveBoxGen( + tbox::Database& database, + const boost::shared_ptr& geom): + d_index_filter(ALL), + d_num_keep(1), + d_num_discard(0) + { + d_geom = geom; + getFromInput(database); + } + PrimitiveBoxGen( + const PrimitiveBoxGen& other): + d_geom(other.d_geom), + d_ap(other.d_ap), + d_index_filter(other.d_index_filter), + d_num_keep(other.d_num_keep), + d_num_discard(other.d_num_discard) { + } + void + getFromInput( + tbox::Database& input_db); + void + getBoxes( + BoxContainer& boxes, + int rank); + void + populateBoxLevel( + BoxLevel& box_level); +}; + +struct CommonTestParams { + PrimitiveBoxGen d_gen1; + PrimitiveBoxGen d_gen2; + CommonTestParams( + const tbox::Dimension& dim); + CommonTestParams( + const CommonTestParams& other); +}; + +CommonTestParams +getTestParametersFromDatabase( + tbox::Database& database); + +int main( + int argc, + char* argv[]) +{ + tbox::SAMRAI_MPI::init(&argc, &argv); + tbox::SAMRAIManager::initialize(); + tbox::SAMRAIManager::startup(); + + const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(); + + int fail_count = 0; + + /* + * Process command line arguments. For each run, the input + * filename must be specified. Usage is: + * + * executable + */ + std::string input_filename; + + if (argc < 2) { + TBOX_ERROR("USAGE: " << argv[0] << " [case name]\n" + << " options:\n" + << " none at this time" << std::endl); + } else { + input_filename = argv[1]; + } + + /* + * Create block to force pointer deallocation. If this is not done + * then there will be memory leaks reported. + */ + { + /* + * Create input database and parse all data in input file. + */ + boost::shared_ptr input_db(new tbox::MemoryDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + boost::shared_ptr main_db = input_db->getDatabase("Main"); + + std::string base_name = "unnamed"; + base_name = main_db->getStringWithDefault("base_name", base_name); + + /* + * Modify basename for this particular run. + * Add the number of processes and the case name. + */ + std::string base_name_ext = base_name; + base_name_ext = base_name_ext + '-' + + tbox::Utilities::nodeToString(mpi.getSize()); + + /* + * Start logging. + */ + const std::string log_file_name = base_name_ext + ".log"; + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", log_all_nodes); + if (log_all_nodes) { + tbox::PIO::logAllNodes(log_file_name); + } else { + tbox::PIO::logOnlyNodeZero(log_file_name); + } + + const int rank = mpi.getRank(); + + { + + const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + + if (!input_db->isDatabase("BlockGeometry")) { + TBOX_ERROR( + "getTestParametersFromDatabase: You must specify \"BlockGeometry\" in input database."); + } + // Note: Using GridGeometry only because BaseGridGeometry can't be instanstiated. + boost::shared_ptr grid_geom = + boost::make_shared( + dim, + "BlockGeometry", + input_db->getDatabase("BlockGeometry")); + + int test_number = 0; + while (true) { + + std::string test_name("Test"); + test_name += tbox::Utilities::intToString(test_number++, 2); + + boost::shared_ptr test_db = + input_db->getDatabaseWithDefault(test_name, boost::shared_ptr()); + + if (!test_db) { + break; + } + + const std::string nickname = + test_db->getStringWithDefault("nickname", test_name); + + tbox::plog << "\n\n"; + tbox::pout << "Running " << test_name << " (" << nickname << ")\n"; + + PrimitiveBoxGen pb1(*test_db->getDatabase("PrimitiveBoxGen1"), grid_geom); + BoxContainer boxes1; + pb1.getBoxes(boxes1, rank); + BoxLevel l1(boxes1, IntVector::getOne(pb1.d_geom->getDim()), pb1.d_geom); + l1.cacheGlobalReducedData(); + + PrimitiveBoxGen pb2(*test_db->getDatabase("PrimitiveBoxGen2"), grid_geom); + BoxContainer boxes2; + pb2.getBoxes(boxes2, rank); + BoxLevel l2(boxes2, IntVector::getOne(pb2.d_geom->getDim()), pb2.d_geom); + l2.cacheGlobalReducedData(); + + /* + * Set up edges in l1_to_l2 by the contrivance specified + * in the test database. Then check transpose + * correctness. + */ + + Connector l1_to_l2(l1, l2, IntVector::getZero(dim)); + Connector l2_to_l1(l2, l1, IntVector::getZero(dim)); + OverlapConnectorAlgorithm oca; + oca.findOverlaps_assumedPartition(l1_to_l2); + oca.findOverlaps_assumedPartition(l2_to_l1); + + tbox::plog << "Testing with:" + << "\nl1:\n" << l1.format("\t") + << "\nl2:\n" << l2.format("\t") + << "\nl1_to_l2:\n" << l1_to_l2.format("\t") + << "\nl2_to_l1:\n" << l2_to_l1.format("\t") + << std::endl; + + size_t fail_count_1 = l1_to_l2.checkOverlapCorrectness(); + size_t fail_count_2 = l2_to_l1.checkOverlapCorrectness(); + + if (fail_count_1) { + tbox::plog << "Error l1_to_l2 of " << test_name << " (" << nickname << ')' + << std::endl; + } + if (fail_count_2) { + tbox::plog << "Error l2_to_l1 of " << test_name << " (" << nickname << ')' + << std::endl; + } + + if (fail_count_1 || fail_count_2) { + tbox::pout << "FAILED: " << test_name << " (" << nickname << ')' << std::endl; + tbox::plog << "FAILED: " << test_name << " (" << nickname << ')' << std::endl; + } else { + tbox::plog << "PASSED: " << test_name << " (" << nickname << ')' << std::endl; + } + + fail_count += static_cast(fail_count_1 + fail_count_2); + } + + } + + input_db->printClassData(tbox::plog); + + } + + if (fail_count == 0) { + tbox::pout << "\nPASSED: Connector" << std::endl; + } + + tbox::SAMRAIManager::shutdown(); + tbox::SAMRAIManager::finalize(); + tbox::SAMRAI_MPI::finalize(); + return fail_count; +} + +/* + ************************************************************************* + ************************************************************************* + */ +void PrimitiveBoxGen::getFromInput(tbox::Database& database) +{ + int rank_begin = 0; + int rank_end = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + int index_begin = database.getIntegerWithDefault("index_begin", 0); + double parts_per_rank = database.getDoubleWithDefault("parts_per_rank", 1.0); + d_ap.partition(d_geom->getPhysicalDomain(), rank_begin, rank_end, index_begin, parts_per_rank); + tbox::plog << "PrimitiveBoxGen::getFromInput() generated AssumedPartition:\n"; + d_ap.recursivePrint(tbox::plog, "\t", 3); + if (d_ap.selfCheck()) { + TBOX_ERROR("Error in setting up AssumedPartition d_ap (selfCheck failed).\n"); + } + + std::string index_filter = database.getStringWithDefault("index_filter", "ALL"); + if (index_filter == "ALL") { + d_index_filter = PrimitiveBoxGen::ALL; + } else if (index_filter == "INTERVAL") { + d_index_filter = PrimitiveBoxGen::INTERVAL; + } + d_num_keep = database.getIntegerWithDefault("num_keep", d_num_keep); + d_num_discard = database.getIntegerWithDefault("num_discard", d_num_discard); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void PrimitiveBoxGen::getBoxes(BoxContainer& boxes, int rank) +{ + if (d_index_filter == ALL) { + int idbegin = d_ap.beginOfRank(rank); + int idend = d_ap.endOfRank(rank); + for (int id = idbegin; id < idend; ++id) { + boxes.push_back(d_ap.getBox(id)); + } + } else if (d_index_filter == INTERVAL) { + int idbegin = d_ap.beginOfRank(rank); + int idend = d_ap.endOfRank(rank); + int interval = d_num_keep + d_num_discard; + for (int id = idbegin; id < idend; ++id) { + int interval_id = id % interval; + if (interval_id < d_num_keep) { + boxes.push_back(d_ap.getBox(id)); + } + } + } else { + TBOX_ERROR("Invalid value of index_filter: " << d_index_filter); + } +} + +/* + ************************************************************************* + ************************************************************************* + */ +void PrimitiveBoxGen::populateBoxLevel(BoxLevel& box_level) +{ + BoxContainer boxes; + getBoxes(boxes, box_level.getMPI().getRank()); + for (BoxContainer::const_iterator bi = boxes.begin(); bi != boxes.end(); ++bi) { + box_level.addBoxWithoutUpdate(*bi); + } + box_level.finalize(); +} diff --git a/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.2d.input new file mode 100644 index 00000000..22fec63e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.2d.input @@ -0,0 +1,108 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for OverlapConnectorAlgorithm tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "default.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + + dim = 2 +} + + +BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + +} + + +Test00 { + nickname = "full l1 and l2" + PrimitiveBoxGen1 { + index_filter = "ALL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "ALL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} + +Test01 { + nickname = "sparse l1, full l2" + PrimitiveBoxGen1 { + index_filter = "INTERVAL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "ALL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} + +Test02 { + nickname = "full l1, sparse l2" + PrimitiveBoxGen1 { + index_filter = "ALL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "INTERVAL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.3d.input new file mode 100644 index 00000000..b90988c6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/OverlapConnectorAlgorithm/test_inputs/default.3d.input @@ -0,0 +1,247 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "default.3d" + + // Whether to log all nodes. + log_all_nodes = TRUE + + dim = 3 +} + + BlockGeometry { + num_blocks = 7 + domain_boxes_0 = [ (0,0,0) , (14,14,14) ] + domain_boxes_1 = [ (0,0,0) , (14,14,14) ] + domain_boxes_2 = [ (0,0,0) , (14,14,14) ] + domain_boxes_3 = [ (0,0,0) , (14,14,14) ] + domain_boxes_4 = [ (0,0,0) , (14,14,14) ] + domain_boxes_5 = [ (0,0,0) , (14,14,14) ] + domain_boxes_6 = [ (0,0,0) , (14,14,14) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,14,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors3 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors4 { + block_a = 0 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_DOWN", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,14 + } + + BlockNeighbors5 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors6 { + block_a = 1 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors7 { + block_a = 1 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { + block_a = 2 + block_b = 3 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors10 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors11 { + block_a = 2 + block_b = 5 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 14,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors12 { + block_a = 3 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,0,14 + point_in_b_space = 14,0,-1 + } + + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + } + + +Test00 { + nickname = "full l1 and l2" + PrimitiveBoxGen1 { + index_filter = "ALL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "ALL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} + + +Test01 { + nickname = "sparse l1, full l2" + PrimitiveBoxGen1 { + index_filter = "INTERVAL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "ALL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} + + +Test02 { + nickname = "full l1, sparse l2" + PrimitiveBoxGen1 { + index_filter = "ALL" + num_keep = 2 + num_discard = 1 + parts_per_rank = 10 + } + PrimitiveBoxGen2 { + index_filter = "INTERVAL" + num_keep = 2 + num_discard = 2 + parts_per_rank = 20 + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/README b/base/SAMRAI/SAMRAI/source/test/README index 67f8eadf..c3146876 100644 --- a/base/SAMRAI/SAMRAI/source/test/README +++ b/base/SAMRAI/SAMRAI/source/test/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README SAMRAI test package. ## ######################################################################### @@ -30,16 +30,26 @@ applications: doing a "diff" on the output data file with these correct result files. + Requires the testlib be built. + async_comm: + Unit test of asynchronous communication. + + All test source code is contained in the SAMRAI/source/test/async_comm + directory. boundary: A set of tests to check the correctness of the routines to set various physical boundary conditions supplied by the CartesianBoundaryUtilities classes in the Application Utilities package. - All test source code is contained in the SAMRAI/examples/boundary directory. + All test source code is contained in the SAMRAI/source/test/boundary + directory. clustering: + Unit test of Berger Rigoutsos algorithm. + + Requires the testlib be built. communication: Performs a set of tests that invoke data transfer operations @@ -50,82 +60,203 @@ communication: configuration and number of processors may be set through the input file. + Requires the testlib be built. + dataaccess: + Unit test of SAMRAI PatchData access via PatchData iterators and Indexes. + + All test source code is contained in the SAMRAI/source/test/dataaccess + directory. dataops: - Tests various data operations with cell, face, node, side, - and edge datatypes across the hierarchy and for complex - operations. The operations set data on patches and - test operations like linear_sum(), dot_product(), - axmy(), etc. on the hierarchy. The grid hierarchy is - fixed so it must be run on 1 or 2 processors. - of processors. + Tests various data operations with cell, face, node, side, and edge + centerings across the hierarchy and for a variety of underlying datatypes. + The operations set data on patches and test operations like linear_sum(), + dot_product(), axmy(), etc. on the hierarchy. The grid hierarchy is fixed. + + All test source code is contained in the SAMRAI/source/test/dataops + directory. + +dimension: + Unit test of SAMRAI Dimension class. + + All test source code is contained in the SAMRAI/source/test/dimension + directory. dlbg: + Test of the BergerRigoutsos algorithm and the Connectors generated by it. + + Requires the testlib be built. -emb_bdry: +FAC_adaptive: + Test of FAC solver which uses true mesh adaptivity based on the evolution of + the solution. A variety of functionally defined boundary conditions are + applied depending on which test is run. -FAC: + Requires the testlib be built. -HDF5: - A set of tests to check the correctness of the routines to read from and - write to an HDF5 file in the tbox::HDFDatabase class (used for writing and - reading SAMRAI restart files). +FAC_nonadaptive: + Unit test of FAC solver which uses pre-set user defined refined boxes. The + mesh is adaptive but not in a "real" sense. Simple constant boundary + conditions are used. - All test source code is contained in the SAMRAI/source/test/HDF5 directory. + All test source code is contained in the SAMRAI/source/test/FAC_nonadaptive + directory. + +fill_pattern: + Unit test of SAMRAI fill patterns. + + All test source code is contained in the SAMRAI/source/test/fill_pattern + directory. hierarchy: A set of tests to check the correctness of the PatchHierarchy operations to make coarsened and refined versions of a given AMR patch hierarchy. - All test source code is contained in the SAMRAI/source/test/hierarchy directory. + All test source code is contained in the SAMRAI/source/test/hierarchy + directory. hypre: + Unit test of CellPoissonHypreSolver. + + All test source code is contained in the SAMRAI/source/test/hypre directory. -ieee: +indexdata: + Unit test of IndexData. + + All test source code is contained in the SAMRAI/source/test/indexdata + directory. inputdb: A set of tests to check the correctness of the routines to read data from SAMRAI inut files defined in the tbox:InputDatabase class. - All test source code is contained in the SAMRAI/source/test/inputdb directory. + All test source code is contained in the SAMRAI/source/test/inputdb + directory. + +LoadBalanceCorrectness: + Requires the testlib be built. -locally_active: - A set of tests to check coarsening and refinement communication operations for - locally-active data defined on a SAMRAI patch hierarchy. +logger: + All test source code is contained in the SAMRAI/source/test/logger + directory. - All test source code is contained in the SAMRAI/source/test/locally_active directory. +MappedBoxLevelConnectorUtilsTests: + All test source code is contained in the + SAMRAI/source/test/MappedBoxLevelConnectorUtilsTests directory. + +mapped_box_set_iterators: + Tests the iterators that are used on a BoxContainer. + + All test source code is contained in the + SAMRAI/source/test/mapped_box_set_iterators directory. + +MappingConnector: + Tests the modify method in MappingConnector. + + All test source code is contained in the SAMRAI/source/test/MappingConnector + directory. mblkcomm: + Performs tests of refine operations on multiblock configurations. + + All test source code is contained in the SAMRAI/source/test/mblkcomm + directory. + +MblkEuler: + A test similar to the applications/Euler test but set up to work in + a multiblock configuration. + + Requires the testlib be built. + +MblkLinAdv: + A test similar to the applications/LinAdv test but set up to work in + a multiblock configuration. + + Requires the testlib be built. + +mblktree: + Tests the tree-based box searching algorithms in multiblock configurations. + + All test source code is contained in the SAMRAI/source/test/mblktree + directory. nonlinear: + Tests nonlinear solvers using the SAMRAI interfaces to KINSOL and PETSc. + + All test source code is contained in the SAMRAI/source/test/nonlinear + directory. patchbdrysum: - A set of tests to check operations for summing node and edge data across shared points - on the boundaries of patches in a SAMRAI patch hierarchy. + A set of tests to check operations for summing node and edge data across + shared points on the boundaries of patches in a SAMRAI patch hierarchy. + + All test source code is contained in the SAMRAI/source/test/patchbdrysum + directory. + +performance: + Requires the testlib be built. + +rank_group: + Unit test of RankGroup class. - All test source code is contained in the SAMRAI/examples/patchbdrysum directory. + All test source code is contained in the SAMRAI/examples/rank_group + directory. -pointer: - A set of tests to basic operation of SAMRAI smart pointers. +restartdb: + Tests the RestartManager and the HDFDatabase. - All test source code is contained in the SAMRAI/source/test/pointer directory. + All test source code is contained in the SAMRAI/examples/restartdb + directory. + +samrai_mpi: + Tests configurations of SAMRAI_MPI wrapper class. + + All test source code is contained in the SAMRAI/source/test/samrai_mpi + directory. + +sparsedata: + Unit tests for SparseData patch data type + + All test source code is contained in the SAMRAI/source/test/sparsedata + directory. sundials: + Test the intervace to sundials/CVODE. + + All test source code is contained in the SAMRAI/source/test/sundials directory. -schedules: +testlib: + Not a test itself but a collection of classes and methods common to multiple + tests. There are no associated tests. + +testtools: + Contains tools (scripts, etc.) used exclusively for running and verifying + tests. timers: Tests use of timers, verifying nested structure, input, parallel usage, and restart capability. + All test source code is contained in the SAMRAI/source/test/timers directory. + +transformation: + Tests the Transformation class in 2D and 3D for a variety of possible + usage patterns. + + All test source code is contained in the SAMRAI/source/test/transformation + directory. + variables: - A set of tests to check operations provided by the SAMRAI VariableDatabase class. + A set of tests to check operations provided by the SAMRAI VariableDatabase + class. - All test source code is contained in the SAMRAI/source/test/variables directory. + All test source code is contained in the SAMRAI/source/test/variables + directory. vector: Tests the SAMRAI vector classes. In particular, the SAMRAI-PETSc and SAMRAI-Kinsol vector interfaces. Tests use a specific grid hierarchy layout and can only be tested on 1 or 2 processors. + All test source code is contained in the SAMRAI/source/test/vector directory. diff --git a/base/SAMRAI/SAMRAI/source/test/applications/AutoTester.C b/base/SAMRAI/SAMRAI/source/test/applications/AutoTester.C deleted file mode 100644 index 5ef30976..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/AutoTester.C +++ /dev/null @@ -1,601 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Class used for auto testing applications - * - ************************************************************************/ - -#include "AutoTester.h" - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/tbox/MathUtilities.h" - -AutoTester::AutoTester( - const std::string& object_name, - const tbox::Dimension& dim, - boost::shared_ptr input_db): - d_dim(dim) -#ifdef HAVE_HDF5 - , - d_hdf_db("AutoTesterDatabase") -#endif -{ - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - d_object_name = object_name; - d_test_fluxes = false; - d_test_iter_num = 10; - d_output_correct = false; - - d_write_patch_boxes = false; - d_read_patch_boxes = false; - d_test_patch_boxes_at_steps.resizeArray(0); - d_test_patch_boxes_step_count = 0; - - getFromInput(input_db); - - const std::string hdf_filename = - d_test_patch_boxes_filename - + "." + tbox::Utilities::nodeToString(mpi.getSize()) - + "." + tbox::Utilities::processorToString(mpi.getRank()); - -#ifdef HAVE_HDF5 - if (d_read_patch_boxes) { - d_hdf_db.open(hdf_filename); - if (d_output_correct) { - d_hdf_db.printClassData(tbox::pout); - } - - } - - if (d_write_patch_boxes) { - d_hdf_db.create(hdf_filename); - } -#endif - -} - -AutoTester::~AutoTester() -{ -} - -/* - ****************************************************************** - * - * Method "evalTestData" compares the result of the run with - * the correct result for runs with the TimeRefinementIntegrator - * and HyperbolicLevelIntegrator. - * - ****************************************************************** - */ -int AutoTester::evalTestData( - int iter, - const boost::shared_ptr hierarchy, - const boost::shared_ptr tri, - const boost::shared_ptr hli, - const boost::shared_ptr ga) -{ - NULL_USE(ga); - - int num_failures = 0; - - /* - * Compare "correct_result" array to the computed result on specified - * iteration. - */ - if (iter == d_test_iter_num && !d_test_fluxes) { - - /* - * set precision of output stream. - */ - tbox::plog.precision(12); - - /* - * determine level. - */ - int nlevels = hierarchy->getNumberOfLevels() - 1; - boost::shared_ptr level( - hierarchy->getPatchLevel(nlevels)); - - /* - * Test 0: Time Refinement Integrator - */ - double time = tri->getIntegratorTime(); - if (d_correct_result.getSize() > 0) { - if (d_output_correct) { - tbox::plog << "Test 0: Time Refinement Integrator " - << "\n computed result: " << time; - - tbox::plog << "\n specified result = " - << d_correct_result[0]; - } - tbox::plog << std::endl; - - if (tbox::MathUtilities::equalEps(time, - d_correct_result[0])) { - tbox::plog << "Test 0: Time Refinement check successful" - << std::endl; - } else { - tbox::perr << "Test 0 FAILED: Check Time Refinement Integrator" - << std::endl; - num_failures++; - } - } - - /* - * Test 1: Time Refinement Integrator - */ - double dt = tri->getLevelDtMax(nlevels); - if (d_correct_result.getSize() > 1) { - if (d_output_correct) { - tbox::plog << "Test 1: Time Refinement Integrator " - << "\n computed result: " << dt; - tbox::plog << "\n specified result = " - << d_correct_result[1]; - } - tbox::plog << std::endl; - - if (tbox::MathUtilities::equalEps(dt, d_correct_result[1])) { - tbox::plog << "Test 1: Time Refinement check successful" - << std::endl; - } else { - tbox::perr << "Test 1 FAILED: Check Time Refinement Integrator" - << std::endl; - num_failures++; - } - } - - /* - * Test 2: Hyperbolic Level Integrator - */ - dt = hli->getLevelDt(level, time, false); - if (d_correct_result.getSize() > 2) { - if (d_output_correct) { - tbox::plog << "Test 2: Hyperbolic Level Integrator " - << "\n computed result: " << dt; - - tbox::plog << "\n specified result = " - << d_correct_result[2]; - } - tbox::plog << std::endl; - - if (tbox::MathUtilities::equalEps(dt, d_correct_result[2])) { - tbox::plog << "Test 2: Hyperbolic Level Int check successful" - << std::endl; - } else { - tbox::perr << "Test 2 FAILED: Check Hyperbolic Level Integrator" - << std::endl; - num_failures++; - } - } - - /* - * Test 3: Gridding Algorithm - */ - int n = hierarchy->getMaxNumberOfLevels(); - if (d_output_correct) { - tbox::plog << "Test 3: Gridding Algorithm " - << "\n computed result: " << n; - tbox::plog << "\n correct result = " << nlevels + 1; - tbox::plog << std::endl; - } - if (n == (nlevels + 1)) { - tbox::plog << "Test 3: Gridding Algorithm check successful" - << std::endl; - } else { - tbox::perr << "Test 3 FAILED: Check Gridding Algorithm" << std::endl; - num_failures++; - } - - } - - if ((d_test_patch_boxes_at_steps.getSize() > - d_test_patch_boxes_step_count) && - (d_test_patch_boxes_at_steps[d_test_patch_boxes_step_count] == iter)) { - - int num_levels = hierarchy->getNumberOfLevels(); - -#ifdef HAVE_HDF5 - if (d_read_patch_boxes) { - - if (d_output_correct) { - d_hdf_db.printClassData(tbox::pout); - } - - const std::string step_name = - std::string("step_number_") + tbox::Utilities::intToString( - d_test_patch_boxes_step_count, - 2); - std::cout << std::endl; - boost::shared_ptr step_db( - d_hdf_db.getDatabase(step_name)); - - /* - * FIXME: This check give false positives!!!!! - * It writes the same file regardless of the number of processors. - * We should be checking against base runs with the same number of processors, - * compare different data. - */ - for (int ln = 0; ln < num_levels; ln++) { - - const std::string level_name = - std::string("level_number_") + tbox::Utilities::levelToString(ln); - boost::shared_ptr level_db( - step_db->getDatabase(level_name)); - hier::BoxLevel correct_mapped_box_level(d_dim); - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry()); - correct_mapped_box_level.getFromDatabase(*level_db, - grid_geometry); - - num_failures += checkHierarchyBoxes(hierarchy, - ln, - correct_mapped_box_level, - iter); - } - - } - - if (d_write_patch_boxes) { - - const std::string step_name = - std::string("step_number_") + tbox::Utilities::intToString( - d_test_patch_boxes_step_count, - 2); - std::cout << std::endl; - boost::shared_ptr step_db( - d_hdf_db.putDatabase(step_name)); - - for (int ln = 0; ln < num_levels; ln++) { - boost::shared_ptr level( - hierarchy->getPatchLevel(ln)); - - const std::string level_name = - std::string("level_number_") + tbox::Utilities::levelToString(ln); - boost::shared_ptr level_db( - step_db->putDatabase(level_name)); - level->getBoxLevel()->putUnregisteredToDatabase(level_db); - } - - if (d_output_correct) { - d_hdf_db.printClassData(tbox::pout); - } - } -#endif - - d_test_patch_boxes_step_count++; - - } - - return num_failures; -} - -/* - ****************************************************************** - * - * Method "evalTestData" compares the result of the run with - * the correct result for runs with the MethodOfLinesIntegrator. - * - ****************************************************************** - */ -int AutoTester::evalTestData( - int iter, - const boost::shared_ptr hierarchy, - double time, - const boost::shared_ptr mol, - const boost::shared_ptr ga) -{ - NULL_USE(ga); - - int num_failures = 0; - - /* - * Compare "correct_result" array to the computed result on specified - * iteration. - */ - if (iter == d_test_iter_num && !d_test_fluxes) { - - /* - * set precision of output stream. - */ - tbox::plog.precision(12); - - /* - * determine level. - */ - int nlevels = hierarchy->getNumberOfLevels() - 1; - boost::shared_ptr level( - hierarchy->getPatchLevel(nlevels)); - - /* - * Test 0: Time test - */ - if (d_output_correct) { - tbox::plog << "Test 0: Simulation Time: " - << "\n computed result: " << time; - if (d_correct_result.getSize() > 0) { - tbox::plog << "\n specified result = " - << d_correct_result[0]; - } - tbox::plog << std::endl; - } - if (tbox::MathUtilities::equalEps(time, d_correct_result[0])) { - tbox::plog << "Test 0: Simulation Time check successful" << std::endl; - } else { - tbox::perr << "Test 0 FAILED: Simulation time incorrect" << std::endl; - num_failures++; - } - - /* - * Test 1: MethodOfLinesIntegrator - */ - double dt = mol->getTimestep(hierarchy, time); - if (d_output_correct) { - tbox::plog << "Test 1: Method of Lines Integrator " - << "\n computed result: " << dt; - if (d_correct_result.getSize() > 1) { - tbox::plog << "\n specified result = " - << d_correct_result[1]; - } - tbox::plog << std::endl; - } - if (tbox::MathUtilities::equalEps(dt, d_correct_result[1])) { - tbox::plog << "Test 1: MOL Int check successful" << std::endl; - } else { - tbox::perr << "Test 1 FAILED: Check Method of Lines Integrator" - << std::endl; - num_failures++; - } - - /* - * Test 2: Gridding Algorithm - */ - int n = hierarchy->getMaxNumberOfLevels(); - if (d_output_correct) { - tbox::plog << "Test 2: Gridding Algorithm " - << "\n computed result: " << n; - tbox::plog << "\n correct result = " << nlevels + 1; - tbox::plog << std::endl; - } - if (n == (nlevels + 1)) { - tbox::plog << "Test 2: Gridding Alg check successful" << std::endl; - } else { - tbox::perr << "Test 2 FAILED: Check Gridding Algorithm" << std::endl; - num_failures++; - } - - } - - if ((d_test_patch_boxes_at_steps.getSize() > 0) && - (d_test_patch_boxes_at_steps[d_test_patch_boxes_step_count] == iter)) { - - int num_levels = hierarchy->getNumberOfLevels(); - -#ifdef HAVE_HDF5 - if (d_read_patch_boxes) { - - if (d_output_correct) { - d_hdf_db.printClassData(tbox::pout); - } - - const std::string step_name = - std::string("step_number_") + tbox::Utilities::intToString( - d_test_patch_boxes_step_count, - 2); - std::cout << std::endl; - boost::shared_ptr step_db( - d_hdf_db.getDatabase(step_name)); - - for (int ln = 0; ln < num_levels; ln++) { - - const std::string level_name = - std::string("level_number_") + tbox::Utilities::levelToString(ln); - boost::shared_ptr level_db( - step_db->getDatabase(level_name)); - hier::BoxLevel correct_mapped_box_level(d_dim); - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry()); - correct_mapped_box_level.getFromDatabase(*level_db, - grid_geometry); - - num_failures += checkHierarchyBoxes(hierarchy, - ln, - correct_mapped_box_level, - iter); - } - - } - - if (d_write_patch_boxes) { - - if (d_output_correct) { - d_hdf_db.printClassData(tbox::pout); - } - - const std::string step_name = - std::string("step_number_") + tbox::Utilities::intToString( - d_test_patch_boxes_step_count, - 2); - std::cout << std::endl; - boost::shared_ptr step_db( - d_hdf_db.putDatabase(step_name)); - - for (int ln = 0; ln < num_levels; ln++) { - boost::shared_ptr level( - hierarchy->getPatchLevel(ln)); - - const std::string level_name = - std::string("level_number_") + tbox::Utilities::levelToString(ln); - boost::shared_ptr level_db( - step_db->putDatabase(level_name)); - level->getBoxLevel()->putUnregisteredToDatabase(level_db); - } - - } -#endif - - d_test_patch_boxes_step_count++; - - } - - return num_failures; -} - -/* - ****************************************************************** - * - * Get test parameters from input. - * - ****************************************************************** - */ - -void AutoTester::getFromInput( - boost::shared_ptr input_db) -{ - boost::shared_ptr tester_db( - input_db->getDatabase(d_object_name)); - - /* - * Read testing parameters from testing_db - */ - if (tester_db->keyExists("test_fluxes")) { - d_test_fluxes = tester_db->getBool("test_fluxes"); - } - - if (tester_db->keyExists("test_iter_num")) { - d_test_iter_num = tester_db->getInteger("test_iter_num"); - } - - if (tester_db->keyExists("write_patch_boxes")) { - d_write_patch_boxes = tester_db->getBool("write_patch_boxes"); - } - if (tester_db->keyExists("read_patch_boxes")) { - d_read_patch_boxes = tester_db->getBool("read_patch_boxes"); - } - if (d_read_patch_boxes && d_write_patch_boxes) { - tbox::perr << "FAILED: - AutoTester " << d_object_name << "\n" - << "Cannot 'read_patch_boxes' and 'write_patch_boxes' \n" - << "at the same time." << std::endl; - } - if (d_read_patch_boxes || d_write_patch_boxes) { - if (!tester_db->keyExists("test_patch_boxes_at_steps")) { - tbox::perr << "FAILED: - AutoTester " << d_object_name << "\n" - << "Must provide 'test_patch_boxes_at_steps' data." - << std::endl; - } else { - d_test_patch_boxes_at_steps = - tester_db->getIntegerArray("test_patch_boxes_at_steps"); - } - if (!tester_db->keyExists("test_patch_boxes_filename")) { - tbox::perr << "FAILED: - AutoTester " << d_object_name << "\n" - << "Must provide 'test_patch_boxes_filename' data." - << std::endl; - } else { - d_test_patch_boxes_filename = - tester_db->getString("test_patch_boxes_filename"); - } - } - - if (d_test_fluxes) { - - /* - * Read expected result for flux test... - * Fluxes not verified in this routine. Rather, we let it - * write the result and do a "diff" within the script - */ - - tbox::pout << "Do a diff on the resulting *.dat file to verify result." - << std::endl; - - } else { - - /* - * Read correct_result array for timestep test... - */ - if (tester_db->keyExists("correct_result")) { - d_correct_result = tester_db->getDoubleArray("correct_result"); - } else { - TBOX_WARNING("main.C: TESTING is on but no `correct_result' array" - << "is given in input file." << std::endl); - } - - /* Specify whether to output "correct_result" result */ - - if (tester_db->keyExists("output_correct")) { - d_output_correct = tester_db->getBool("output_correct"); - } - - } - -} - -int AutoTester::checkHierarchyBoxes( - const boost::shared_ptr hierarchy, - int level_number, - const hier::BoxLevel& correct_mapped_box_level, - int iter) -{ - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - - const boost::shared_ptr patch_level( - hierarchy->getPatchLevel(level_number)); - const hier::BoxLevel& mapped_box_level = - *patch_level->getBoxLevel(); - - const int local_exact_match = - mapped_box_level == correct_mapped_box_level; - - int global_exact_match = local_exact_match; - if (mpi.getSize() > 1) { - mpi.AllReduce(&global_exact_match, 1, MPI_MIN); - } - - /* - * Check to make sure hierarchy's BoxLevel and - * correct_mapped_box_level are identical. If not, write an error - * message. - */ - - int num_failures = 0; - - if (local_exact_match && global_exact_match) { - tbox::plog << "Test 4: Level " << level_number - << " BoxLevel check successful for step " << iter - << std::endl << std::endl; - } else { - tbox::perr << "Test 4: FAILED: Level " << level_number - << " hier::BoxLevel configuration doesn't match at step " << iter - << std::endl << std::endl; - num_failures++; - } - - if (d_output_correct) { - - tbox::pout << "-------------------------------------------------------" - << std::endl; - - if (!local_exact_match) { - tbox::pout << "LOCAL MAPPED BOX LEVEL DOES NOT MATCH " - << "ON LEVEL: " << level_number << std::endl; - } - - if (!global_exact_match) { - tbox::pout << "GLOBAL MAPPED BOX LEVEL DOES NOT MATCH " - << "ON LEVEL: " << level_number << std::endl; - } - tbox::pout << "BoxLevel: " << std::endl; - mapped_box_level.recursivePrint(tbox::pout, "", 3); - tbox::pout << "correct BoxLevel: " << std::endl; - correct_mapped_box_level.recursivePrint(tbox::pout, "", 3); - - tbox::pout << "-------------------------------------------------------" - << std::endl << std::endl; - - } - - return num_failures; -} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.C b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.C index 6d24baf6..fbc41aa6 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in convection * diffusion example. * @@ -35,7 +35,6 @@ using namespace std; #include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" @@ -91,7 +90,7 @@ ConvDiff::ConvDiff( const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom): - algs::MethodOfLinesPatchStrategy::MethodOfLinesPatchStrategy(dim), + algs::MethodOfLinesPatchStrategy::MethodOfLinesPatchStrategy(), d_object_name(object_name), d_dim(dim), d_grid_geometry(grid_geom), @@ -124,10 +123,10 @@ ConvDiff::ConvDiff( * mu = diffusion coefficient * gamma = source coefficient */ - for (k = 0; k < d_dim.getValue(); k++) d_convection_coeff[k] = 0.; + for (k = 0; k < d_dim.getValue(); ++k) d_convection_coeff[k] = 0.; // Physics parameters - for (k = 0; k < NEQU; k++) d_tolerance[k] = 0.; + for (k = 0; k < NEQU; ++k) d_tolerance[k] = 0.; /* * Defaults for problem type and initial data. Set initial @@ -145,45 +144,44 @@ ConvDiff::ConvDiff( * Boundary condition initialization. */ if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_val.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_bdry_edge_val.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_val); + } else if (d_dim == tbox::Dimension(3)) { + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_val.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_val); + d_bdry_face_val.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_val); } /* @@ -215,13 +213,13 @@ ConvDiff::ConvDiff( * so we reset them to FLOW. */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -235,15 +233,14 @@ ConvDiff::ConvDiff( i, d_scalar_bdry_node_conds[i]); } } - } - if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + } else if (d_dim == tbox::Dimension(3)) { + for (int i = 0; i < NUM_3D_FACES; ++i) { if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_face_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; } @@ -261,7 +258,7 @@ ConvDiff::ConvDiff( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -343,7 +340,7 @@ void ConvDiff::registerModelVariables( const int size = static_cast(dump_name.length()) + 16; char* buffer = new char[size]; - for (int n = 0; n < NEQU; n++) { + for (int n = 0; n < NEQU; ++n) { sprintf(buffer, "%s%01d", dump_name.c_str(), n); string variable_name(buffer); #ifdef HAVE_HDF5 @@ -355,7 +352,7 @@ void ConvDiff::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING( d_object_name << ": registerModelVariables()\n" - << "Visit data writer was not registered.\n" + << "VisIt data writer was not registered.\n" << "Consequently, no plot data will\n" << "be written." << endl); } @@ -389,31 +386,28 @@ void ConvDiff::initializeDataOnPatch( if (initial_time) { const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const double* xlo = patch_geom->getXLower(); const double* xhi = patch_geom->getXUpper(); boost::shared_ptr > primitive_vars( - patch.getPatchData(d_primitive_vars, getInteriorContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_primitive_vars, getInteriorContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(primitive_vars); -#endif - hier::IntVector ghost_cells = primitive_vars->getGhostCellWidth(); - hier::Box pbox = patch.getBox(); - boost::shared_ptr > temp_var( - new pdat::CellData(pbox, 1, ghost_cells)); + hier::IntVector ghost_cells = primitive_vars->getGhostCellWidth(); - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); + const hier::Box& pbox = patch.getBox(); + const hier::Index ifirst = pbox.lower(); + const hier::Index ilast = pbox.upper(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(initsphere2d, INITSPHERE2D) (dx, xlo, xhi, + SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) (dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), ghost_cells(1), primitive_vars->getPointer(), @@ -421,9 +415,8 @@ void ConvDiff::initializeDataOnPatch( d_val_outside, d_center, d_radius, NEQU); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(initsphere3d, INITSPHERE3D) (dx, xlo, xhi, + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) (dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), ghost_cells(0), ghost_cells(1), @@ -437,7 +430,7 @@ void ConvDiff::initializeDataOnPatch( // tbox::plog << "Level:" << patch.getPatchLevelNumber() << "\n" << endl; // tbox::plog << "Patch:" << endl; - // primitive_vars->print(patch.getBox(),tbox::plog); + // primitive_vars->print(pbox,tbox::plog); } } @@ -456,16 +449,14 @@ double ConvDiff::computeStableDtOnPatch( NULL_USE(time); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); - - boost::shared_ptr > primitive_vas( - patch.getPatchData(d_primitive_vars, getInteriorContext()), - boost::detail::dynamic_cast_tag()); + const hier::Box& pbox = patch.getBox(); + const hier::Index ifirst = pbox.lower(); + const hier::Index ilast = pbox.upper(); double stabdt = 0.0; @@ -476,8 +467,7 @@ double ConvDiff::computeStableDtOnPatch( if (d_dim == tbox::Dimension(2)) { stabdt = d_cfl * ((*dx) * (*dx)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { stabdt = d_cfl * ((*dx) * (*dx) * (*dx)); } @@ -514,23 +504,28 @@ void ConvDiff::singleStep( { boost::shared_ptr > prim_var_updated( - patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()))); boost::shared_ptr > prim_var_fixed( - patch.getPatchData(d_primitive_vars, getInteriorContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_primitive_vars, getInteriorContext()))); boost::shared_ptr > function_eval( - patch.getPatchData(d_function_eval, getInteriorContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_function_eval, getInteriorContext()))); + TBOX_ASSERT(prim_var_updated); + TBOX_ASSERT(prim_var_fixed); + TBOX_ASSERT(function_eval); - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); + const hier::Box& pbox = patch.getBox(); + const hier::Index ifirst = pbox.lower(); + const hier::Index ilast = pbox.upper(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); // tbox::plog << "----primitive_var_current" << endl; @@ -541,7 +536,7 @@ void ConvDiff::singleStep( // Evaluate Right hand side F(prim_var_scratch) // if (d_dim == tbox::Dimension(2)) { - F77_FUNC(computerhs2d, COMPUTERHS2D) (ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(computerhs2d, COMPUTERHS2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), d_nghosts(0), d_nghosts(1), dx, @@ -551,9 +546,8 @@ void ConvDiff::singleStep( prim_var_updated->getPointer(), function_eval->getPointer(), NEQU); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(computerhs3d, COMPUTERHS3D) (ifirst(0), ilast(0), ifirst(1), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(computerhs3d, COMPUTERHS3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_nghosts(0), d_nghosts(1), @@ -573,7 +567,7 @@ void ConvDiff::singleStep( // Take RK step // if (d_dim == tbox::Dimension(2)) { - F77_FUNC(rkstep2d, RKSTEP2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(rkstep2d, RKSTEP2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), d_nghosts(0), d_nghosts(1), dt, alpha_1, alpha_2, beta, d_convection_coeff, @@ -583,9 +577,8 @@ void ConvDiff::singleStep( prim_var_fixed->getPointer(), function_eval->getPointer(), NEQU); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(rkstep3d, RKSTEP3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(rkstep3d, RKSTEP3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_nghosts(0), d_nghosts(1), d_nghosts(2), @@ -623,28 +616,30 @@ void ConvDiff::tagGradientDetectorCells( NULL_USE(uses_richardson_extrapolation_too); boost::shared_ptr > tags( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); boost::shared_ptr > primitive_vars( - patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()))); + TBOX_ASSERT(tags); + TBOX_ASSERT(primitive_vars); - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); + const hier::Box& pbox = patch.getBox(); + const hier::Index ifirst = pbox.lower(); + const hier::Index ilast = pbox.upper(); const hier::IntVector var_ghosts = primitive_vars->getGhostCellWidth(); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(tagcells2d, TAGCELLS2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(tagcells2d, TAGCELLS2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), var_ghosts(0), var_ghosts(1), tags->getPointer(), primitive_vars->getPointer(), true, d_tolerance, NEQU); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(tagcells3d, TAGCELLS3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(tagcells3d, TAGCELLS3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), var_ghosts(0), var_ghosts(1), var_ghosts(2), @@ -656,54 +651,6 @@ void ConvDiff::tagGradientDetectorCells( } } -void ConvDiff::preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) -{ - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); -} - -void ConvDiff::postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) -{ - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); -} - -void ConvDiff::preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); -} - -void ConvDiff::postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); -} - /* ************************************************************************* * @@ -722,16 +669,11 @@ void ConvDiff::setPhysicalBoundaryConditions( NULL_USE(fill_time); boost::shared_ptr > primitive_vars( - patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_primitive_vars, getInteriorWithGhostsContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(primitive_vars); -#endif - hier::IntVector ghost_cells = primitive_vars->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(primitive_vars->getGhostCellWidth() == d_nghosts); -#endif if (d_dim == tbox::Dimension(2)) { @@ -771,8 +713,7 @@ void ConvDiff::setPhysicalBoundaryConditions( #endif } // d_dim == tbox::Dimension(2)) - - if (d_dim == tbox::Dimension(3)) { + else if (d_dim == tbox::Dimension(3)) { /* * Set boundary conditions for cells corresponding to patch faces. @@ -841,9 +782,7 @@ void ConvDiff::setPhysicalBoundaryConditions( void ConvDiff::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -867,7 +806,7 @@ void ConvDiff::printClassData( << d_grid_geometry.get() << endl; os << "Coefficients..." << endl; - for (j = 0; j < d_dim.getValue(); j++) os << "d_convection_coeff[" << j << "] = " + for (j = 0; j < d_dim.getValue(); ++j) os << "d_convection_coeff[" << j << "] = " << d_convection_coeff[j] << endl; os << "d_diffusion_coeff = " << d_diffusion_coeff << endl; os << "d_source_coeff = " << d_source_coeff << endl; @@ -877,18 +816,18 @@ void ConvDiff::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_val_inside = "; - for (j = 0; j < NEQU; j++) os << d_val_inside[j] << " "; + for (j = 0; j < NEQU; ++j) os << d_val_inside[j] << " "; os << endl; os << " d_val_outside = "; - for (j = 0; j < NEQU; j++) os << d_val_outside[j] << " "; + for (j = 0; j < NEQU; ++j) os << d_val_outside[j] << " "; os << endl; os << "Boundary Condition data..." << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { @@ -897,15 +836,14 @@ void ConvDiff::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " << d_node_bdry_edge[j] << endl; } - } - if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { + } else if (d_dim == tbox::Dimension(3)) { + for (j = 0; j < static_cast(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { @@ -914,14 +852,14 @@ void ConvDiff::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " @@ -942,39 +880,37 @@ void ConvDiff::printClassData( ************************************************************************* */ void ConvDiff::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); - if (db->keyExists("convection_coeff")) { - db->getDoubleArray("convection_coeff", + if (input_db->keyExists("convection_coeff")) { + input_db->getDoubleArray("convection_coeff", d_convection_coeff, d_dim.getValue()); } else { TBOX_ERROR( d_object_name << ": " << "Key data `convection_coeff' not found in input."); } - if (db->keyExists("diffusion_coeff")) { - d_diffusion_coeff = db->getDouble("diffusion_coeff"); + if (input_db->keyExists("diffusion_coeff")) { + d_diffusion_coeff = input_db->getDouble("diffusion_coeff"); } else { TBOX_ERROR( d_object_name << ": " << "Key data `diffusion_coeff' not found in input."); } - if (db->keyExists("source_coeff")) { - d_source_coeff = db->getDouble("source_coeff"); + if (input_db->keyExists("source_coeff")) { + d_source_coeff = input_db->getDouble("source_coeff"); } else { TBOX_ERROR(d_object_name << ": " << "Key data `source_coeff' not found in input."); } - d_cfl = db->getDoubleWithDefault("cfl", d_cfl); + d_cfl = input_db->getDoubleWithDefault("cfl", d_cfl); - if (db->keyExists("cell_tagging_tolerance")) { - db->getDoubleArray("cell_tagging_tolerance", + if (input_db->keyExists("cell_tagging_tolerance")) { + input_db->getDoubleArray("cell_tagging_tolerance", d_tolerance, NEQU); } else { TBOX_ERROR( @@ -984,8 +920,8 @@ void ConvDiff::getFromInput( if (!is_from_restart) { - if (db->keyExists("data_problem")) { - d_data_problem = db->getString("data_problem"); + if (input_db->keyExists("data_problem")) { + d_data_problem = input_db->getString("data_problem"); } else { TBOX_ERROR( d_object_name << ": " @@ -993,13 +929,13 @@ void ConvDiff::getFromInput( << endl); } - if (!db->keyExists("Initial_data")) { + if (!input_db->keyExists("Initial_data")) { TBOX_ERROR( d_object_name << ": " << "No `Initial_data' database found in input." << endl); } boost::shared_ptr init_data_db( - db->getDatabase("Initial_data")); + input_db->getDatabase("Initial_data")); bool found_problem_data = false; @@ -1045,26 +981,25 @@ void ConvDiff::getFromInput( << endl); } - const hier::IntVector one_vec = hier::IntVector::getOne(d_dim); + const hier::IntVector& one_vec(hier::IntVector::getOne(d_dim)); hier::IntVector periodic = d_grid_geometry->getPeriodicShift(one_vec); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } - if (db->keyExists("Boundary_data")) { + if (input_db->keyExists("Boundary_data")) { boost::shared_ptr boundary_db( - db->getDatabase("Boundary_data")); + input_db->getDatabase("Boundary_data")); if (d_dim == tbox::Dimension(2)) { - appu::CartesianBoundaryUtilities2::readBoundaryInput(this, + appu::CartesianBoundaryUtilities2::getFromInput(this, boundary_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); - } - if (d_dim == tbox::Dimension(3)) { - appu::CartesianBoundaryUtilities3::readBoundaryInput(this, + } else if (d_dim == tbox::Dimension(3)) { + appu::CartesianBoundaryUtilities3::getFromInput(this, boundary_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, @@ -1089,38 +1024,40 @@ void ConvDiff::getFromInput( ************************************************************************* */ -void ConvDiff::putToDatabase( - const boost::shared_ptr& db) const +void ConvDiff::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("CONV_DIFF_VERSION", CONV_DIFF_VERSION); + restart_db->putInteger("CONV_DIFF_VERSION", CONV_DIFF_VERSION); - db->putDouble("d_diffusion_coeff", d_diffusion_coeff); - db->putDoubleArray("d_convection_coeff", d_convection_coeff, d_dim.getValue()); - db->putDouble("d_source_coeff", d_source_coeff); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putDouble("d_diffusion_coeff", d_diffusion_coeff); + restart_db->putDoubleArray("d_convection_coeff", + d_convection_coeff, + d_dim.getValue()); + restart_db->putDouble("d_source_coeff", d_source_coeff); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, d_dim.getValue()); - db->putDoubleArray("d_val_inside", d_val_inside, NEQU); - db->putDoubleArray("d_val_outside", d_val_outside, NEQU); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleArray("d_center", d_center, d_dim.getValue()); + restart_db->putDoubleArray("d_val_inside", d_val_inside, NEQU); + restart_db->putDoubleArray("d_val_outside", d_val_outside, NEQU); - db->putDouble("d_cfl", d_cfl); + restart_db->putDouble("d_cfl", d_cfl); - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putIntegerVector("d_scalar_bdry_edge_conds", + d_scalar_bdry_edge_conds); + restart_db->putIntegerVector("d_scalar_bdry_node_conds", + d_scalar_bdry_node_conds); if (d_dim == tbox::Dimension(2)) { - db->putDoubleArray("d_bdry_edge_val", d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_val", d_bdry_face_val); + restart_db->putDoubleVector("d_bdry_edge_val", d_bdry_edge_val); + } else if (d_dim == tbox::Dimension(3)) { + restart_db->putIntegerVector("d_scalar_bdry_face_conds", + d_scalar_bdry_face_conds); + restart_db->putDoubleVector("d_bdry_face_val", d_bdry_face_val); } } @@ -1164,16 +1101,16 @@ void ConvDiff::getFromRestart() d_cfl = db->getDouble("d_cfl"); - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); + d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); + d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_val = db->getDoubleArray("d_bdry_edge_val"); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); + d_bdry_edge_val = db->getDoubleVector("d_bdry_edge_val"); + } else if (d_dim == tbox::Dimension(3)) { + d_scalar_bdry_face_conds = + db->getIntegerVector("d_scalar_bdry_face_conds"); - d_bdry_face_val = db->getDoubleArray("d_bdry_face_val"); + d_bdry_face_val = db->getDoubleVector("d_bdry_face_val"); } } @@ -1191,17 +1128,15 @@ void ConvDiff::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, bdry_location_index, d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { readStateDataEntry(db, db_name, bdry_location_index, @@ -1214,17 +1149,15 @@ void ConvDiff::readNeumannBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, bdry_location_index, d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { readStateDataEntry(db, db_name, bdry_location_index, @@ -1236,14 +1169,12 @@ void ConvDiff::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& val) + std::vector& val) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(val.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(val.size()) > array_indx); if (db->keyExists("val")) { val[array_indx] = db->getDouble("val"); @@ -1267,14 +1198,13 @@ void ConvDiff::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const + const std::vector& scalar_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { TBOX_ASSERT(btype == Bdry::EDGE2D || btype == Bdry::NODE2D); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { TBOX_ASSERT(btype == Bdry::FACE3D || btype == Bdry::EDGE3D || btype == Bdry::NODE3D); @@ -1282,53 +1212,46 @@ void ConvDiff::checkBoundaryData( #endif const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array bdry_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); int bscalarcase = 0, refbdryloc = 0; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_edge[bloc]; } - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_FACES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_edge_bdry_face[bloc]; } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_face[bloc]; } @@ -1348,8 +1271,7 @@ void ConvDiff::checkBoundaryData( bbox, bscalarcase, d_bdry_edge_val[refbdryloc]); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { num_bad_values = appu::CartesianBoundaryUtilities3::checkBdryData( d_primitive_vars->getName(), diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.h b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.h index 519f5409..8de592fb 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiff.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in Heat equation ex. * ************************************************************************/ @@ -31,7 +31,8 @@ using namespace std; #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/appu/VisItDataWriter.h" -#include +#include "boost/shared_ptr.hpp" +#include /** * The ConvDiff class provides numerical routines for a sample problem @@ -162,38 +163,6 @@ class ConvDiff: const int tag_index, const bool uses_richardson_extrapolation_too); - /* - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. - */ - virtual void preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio); - - virtual void postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio); - - /* - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. - */ - virtual void preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); - - virtual void postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); - /// /// The following routines: /// @@ -215,15 +184,78 @@ class ConvDiff: const hier::IntVector& ghost_width_to_fill); + //@{ + //! @name Required implementations of MethodOfLinesPatchStrategy pure virtuals. + + hier::IntVector + getRefineOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + void + postprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + hier::IntVector + getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + void + postprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + //@} + /** - * Writes state of ConvDiff object to the specified database. + * Writes state of ConvDiff object to the specified restart database. * * This routine is a concrete implementation of the function * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -275,7 +307,7 @@ class ConvDiff: */ virtual void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); virtual void @@ -286,7 +318,7 @@ class ConvDiff: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); + std::vector& uval); /* * Private member function to check correctness of boundary data. @@ -296,7 +328,7 @@ class ConvDiff: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + const std::vector& scalar_bconds) const; /* * Object name used for error/warning reporting and as a label @@ -329,7 +361,7 @@ class ConvDiff: /* * Convection-diffusion equation constant vectors */ - double d_convection_coeff[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_convection_coeff[SAMRAI::MAX_DIM_VAL]; double d_diffusion_coeff; double d_source_coeff; @@ -361,7 +393,7 @@ class ConvDiff: * Input for SPHERE problem */ double d_radius; - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; double d_val_inside[NEQU]; double d_val_outside[NEQU]; @@ -372,24 +404,24 @@ class ConvDiff: * * Input file values are read into these arrays. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // 3D use only. + std::vector d_scalar_bdry_edge_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_scalar_bdry_face_conds; // 3D use only. /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_node_bdry_edge; // 2D use only. - tbox::Array d_edge_bdry_face; // 3D use only. - tbox::Array d_node_bdry_face; // 3D use only. + std::vector d_node_bdry_edge; // 2D use only. + std::vector d_edge_bdry_face; // 3D use only. + std::vector d_node_bdry_face; // 3D use only. /* - * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. + * Vectors of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_val; // 2D use only. - tbox::Array d_bdry_face_val; // 3D use only. + std::vector d_bdry_edge_val; // 2D use only. + std::vector d_bdry_face_val; // 3D use only. }; diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiffFort.h b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiffFort.h index 25d3181c..d93e09eb 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiffFort.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/ConvDiffFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI Heat Equation example. * ************************************************************************/ @@ -14,7 +14,7 @@ // Function argument list interfaces extern "C" { -void F77_FUNC(initsphere2d, INITSPHERE2D) ( +void SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) ( const double *, const double *, const double *, const int&, const int&, const int&, const int&, const int&, const int&, @@ -25,7 +25,7 @@ void F77_FUNC(initsphere2d, INITSPHERE2D) ( const double&, const int&); -void F77_FUNC(initsphere3d, INITSPHERE3D) ( +void SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) ( const double *, const double *, const double *, const int&, const int&, const int&, const int&, const int&, const int&, @@ -38,18 +38,18 @@ void F77_FUNC(initsphere3d, INITSPHERE3D) ( const double&, const int&); -void F77_FUNC(computerhs2d, COMPUTERHS2D) ( +void SAMRAI_F77_FUNC(computerhs2d, COMPUTERHS2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const double *, // dx const double *, // d_convection_coeff const double&, // d_diffusion_coeff const double&, // d_source_coeff - double *, // prim_var_updated - double *, // function_eval - const int&); // NEQU + const double *, // prim_var_updated + double *, // function_eval + const int&); // NEQU -void F77_FUNC(computerhs3d, COMPUTERHS3D) ( +void SAMRAI_F77_FUNC(computerhs3d, COMPUTERHS3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -58,11 +58,11 @@ void F77_FUNC(computerhs3d, COMPUTERHS3D) ( const double *, // d_convection_coeff const double&, // d_diffusion_coeff const double&, // d_source_coeff - double *, // prim_var_updated - double *, // function_eval - const int&); // NEQU + const double *, // prim_var_updated + double *, // function_eval + const int&); // NEQU -void F77_FUNC(rkstep2d, RKSTEP2D) ( +void SAMRAI_F77_FUNC(rkstep2d, RKSTEP2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const double&, const double&, @@ -74,7 +74,7 @@ void F77_FUNC(rkstep2d, RKSTEP2D) ( const double *, const int&); -void F77_FUNC(rkstep3d, RKSTEP3D) ( +void SAMRAI_F77_FUNC(rkstep3d, RKSTEP3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -88,7 +88,7 @@ void F77_FUNC(rkstep3d, RKSTEP3D) ( const double *, const int&); -void F77_FUNC(tagcells2d, TAGCELLS2D) ( +void SAMRAI_F77_FUNC(tagcells2d, TAGCELLS2D) ( const int&, const int&, const int&, const int&, const int&, const int&, int *, @@ -97,7 +97,7 @@ void F77_FUNC(tagcells2d, TAGCELLS2D) ( const double *, const int&); -void F77_FUNC(tagcells3d, TAGCELLS3D) ( +void SAMRAI_F77_FUNC(tagcells3d, TAGCELLS3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.C b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.C index f6415d6c..6b941e61 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Concrete subclass of tbox + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Concrete subclass of tbox::Serializable. * ************************************************************************/ @@ -119,18 +119,18 @@ void MainRestartData::setIterationNumber( * ************************************************************************* */ -void MainRestartData::putToDatabase( - const boost::shared_ptr& db) const +void MainRestartData::putToRestart( + const boost::shared_ptr& restart_db) const { - TBOX_ASSERT(db); - - db->putInteger("d_max_timesteps", d_max_timesteps); - db->putDouble("d_start_time", d_start_time); - db->putDouble("d_end_time", d_end_time); - db->putInteger("d_regrid_step", d_regrid_step); - db->putInteger("d_tag_buffer", d_tag_buffer); - db->putDouble("d_loop_time", d_loop_time); - db->putInteger("d_iteration_number", d_iteration_number); + TBOX_ASSERT(restart_db); + + restart_db->putInteger("d_max_timesteps", d_max_timesteps); + restart_db->putDouble("d_start_time", d_start_time); + restart_db->putDouble("d_end_time", d_end_time); + restart_db->putInteger("d_regrid_step", d_regrid_step); + restart_db->putInteger("d_tag_buffer", d_tag_buffer); + restart_db->putDouble("d_loop_time", d_loop_time); + restart_db->putInteger("d_iteration_number", d_iteration_number); } void MainRestartData::getFromInput( diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.h b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.h index 9f292608..d04499b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/MainRestartData.h @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Concrete subclass of tbox + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Concrete subclass of tbox::Serializable * ************************************************************************/ @@ -19,7 +19,7 @@ #define included_String #endif -#include +#include "boost/shared_ptr.hpp" using namespace std; using namespace SAMRAI; @@ -130,11 +130,12 @@ class MainRestartData:public tbox::Serializable /** * Writes out d_max_timesteps, d_start_time, d_end_time, - * d_regrid_step, d_tag_buffer, d_loop_time, d_iteration_number. + * d_regrid_step, d_tag_buffer, d_loop_time, d_iteration_number + * to the restart database. */ virtual void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; private: /** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.depend index c78c9056..aa68e5e9 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -26,6 +26,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -35,6 +36,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -46,7 +48,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -58,12 +63,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -87,7 +94,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -103,9 +109,9 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -129,10 +135,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h ConvDiff.C \ ConvDiff.h ConvDiffFort.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -141,17 +147,15 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=MainRestartData.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -160,25 +164,28 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MainRestartData.C \ MainRestartData.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} +${FILE_1}: ${DEPENDS_1} FILE_2=main.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ @@ -186,6 +193,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -195,6 +203,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -206,7 +215,10 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -218,18 +230,17 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -237,11 +248,12 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -255,12 +267,12 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -275,9 +287,10 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -301,13 +314,11 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h ConvDiff.h \ - MainRestartData.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/AutoTester.h ConvDiff.h MainRestartData.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -315,10 +326,9 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.in index 72241e23..0a95448c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for Convection-Diffusion ODE sample application ## ######################################################################### @@ -14,53 +14,97 @@ SUBDIR = source/test/applications/ConvDiff VPATH = @srcdir@ TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -AUTOTEST = $(SAMRAI)/source/test/applications -CPPFLAGS_EXTRA= -I$(AUTOTEST) -DTESTING=1 +SUBDIRS = fortran + +CPPFLAGS_EXTRA = -DTESTING=1 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = main.o ConvDiff.o MainRestartData.o +F77_OBJS = fortran/compute_rhs2d.o \ + fortran/init2d.o \ + fortran/rkstep2d.o \ + fortran/tag_cells2d.o \ + fortran/compute_rhs3d.o \ + fortran/init3d.o \ + fortran/rkstep3d.o \ + fortran/tag_cells3d.o + + +main: $(CXX_OBJS) $(F77_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F77_OBJS) $(TESTLIB) \ + $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main -CXX_OBJS = main.o ConvDiff.o MainRestartData.o AutoTester.o -F77_OBJS = compute_rhs2d.o init2d.o rkstep2d.o tag_cells2d.o \ - compute_rhs3d.o init3d.o rkstep3d.o tag_cells3d.o +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): +fortran/compute_rhs2d.o: -main: $(CXX_OBJS) $(F77_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F77_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main +fortran/init2d.o: + +fortran/rkstep2d.o: + +fortran/tag_cells2d.o: + +fortran/compute_rhs3d.o: + +fortran/init3d.o: + +fortran/rkstep3d.o: + +fortran/tag_cells3d.o: check: $(MAKE) check2d $(MAKE) check3d check2d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.2d.input; + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check3d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.3d.input; + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile examples2d: main - @for i in $(SRCDIR)/example_inputs/*.2d.input ; do \ + @for i in example_inputs/*.2d.input ; do \ $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main $${i}; \ done examples3d: main - @for i in $(SRCDIR)/example_inputs/*.3d.input ; do \ + @for i in example_inputs/*.3d.input ; do \ $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main $${i}; \ done @@ -69,12 +113,22 @@ examples: $(MAKE) examples2d $(MAKE) examples3d -clean-check: - $(SAMCLEAN) +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) test*.restart -clean: clean-check - $(RM) *.f main - $(RM) -rf test*restart +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done redo: $(RM) core main*d @@ -84,39 +138,3 @@ include $(SRCDIR)/Makefile.depend AutoTester.o: $(AUTOTEST)/AutoTester.C $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C -o $@ -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) - -compute_rhs2d.o: $(FORTRAN)/compute_rhs2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/compute_rhs2d.m4 > compute_rhs2d.f - $(F77) $(FFLAGS) -c compute_rhs2d.f -o $@ - -init2d.o: $(FORTRAN)/init2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init2d.m4 > init2d.f - $(F77) $(FFLAGS) -c init2d.f -o $@ - -tag_cells2d.o: $(FORTRAN)/tag_cells2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/tag_cells2d.m4 > tag_cells2d.f - $(F77) $(FFLAGS) -c tag_cells2d.f -o $@ - -rkstep2d.o: $(FORTRAN)/rkstep2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/rkstep2d.m4 > rkstep2d.f - $(F77) $(FFLAGS) -c rkstep2d.f -o $@ - - -compute_rhs3d.o: $(FORTRAN)/compute_rhs3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/compute_rhs3d.m4 > compute_rhs3d.f - $(F77) $(FFLAGS) -c compute_rhs3d.f -o $@ - -init3d.o: $(FORTRAN)/init3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init3d.m4 > init3d.f - $(F77) $(FFLAGS) -c init3d.f -o $@ - -tag_cells3d.o: $(FORTRAN)/tag_cells3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/tag_cells3d.m4 > tag_cells3d.f - $(F77) $(FFLAGS) -c tag_cells3d.f -o $@ - -rkstep3d.o: $(FORTRAN)/rkstep3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/rkstep3d.m4 > rkstep3d.f - $(F77) $(FFLAGS) -c rkstep3d.f -o $@ - diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/README b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/README index 8c14fa1c..28621259 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/README +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/README @@ -1,457 +1,103 @@ ######################################################################### ## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: CONVECTION DIFFUSION EQUATION EXAMPLE ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: CONVECTION DIFFUSION EQUATION EXAMPLE ## ######################################################################### -This README explains how to run the Convection Diffusion example which uses -an adaptive Runge-Kutta time integration. The files included in this -directory are as follows: - - main.C - application driver program - ConvDiff.[C,h] - C++ class containing routines specific to the - ConvDiff example and which are called - from SAMRAI AMR library routines - ConvDiffFort.h - header file defining external fortran routines - fortran/2d,3d - Fortran numerical routines for 2d,3d problems. - -To understand the construction of this application code from pieces +This README explains how to compile and run the Convection Diffusion example +which uses an adaptive Runge-Kutta time integration. The files included in +this directory are as follows: + + main.C - application driver program + MainRestartData.[C,h] - just a holder for general run control + parameters such as start and end time and + number of time steps + ConvDiff.[C,h] - C++ class containing routines specific to + the ConvDiff example and which are called + from SAMRAI AMR library routines + ConvDiffFort.h - header file defining external fortran + routines + fortran/2d,3d - Fortran numerical routines for 2d,3d + problems. + +To understand the construction of this application code from pieces specific to the ConvDiff model and more generic pieces in the SAMRAI library consider the object construction pattern in the main.C file. -For more details on these files and the Euler class consult the comments -in those files and the ConvDiff.h class header file. - -COMPILE and RUN ---------------- -Compile: make where = "main2d" for 2D case - = "main3d" for 3D case - -Run: - - main2d ... Serial run (w/o MPI) - mpirun -np main2d ... Parallel run (with MPI) - - NOTE: is the FULL-PATH of the input file - - There are sample input files in the subdirectory sample_input. - sphere-2d.input - advecting sphere in a box with fixed boundaries - sphere-3d.input - advecting sphere in a cube with fixed boundaries - heated-flr-2d.input - mimics a heated floor, demonstrating diffusion. - - example: - main2d sample_input/sphere-2d.input - mpirun -np 2 main2d sample_input/sphere-2d.input - -Restarted Run: - - same format as regular run but add - to end of command. - is directory where restart files are stored - (set in input file). - is the identifier of which restart file to use - (generally the timestep). - - example: (to start from timestep #5) - - main2d sample_input/sphere-2d.input restart_sphere-2d 5 - mpirun -np 2 main2d sample_input/sphere-2d.input restart_sphere-2d 5 - - NOTE: The ordinary use of our restart functionality requires that - a problem can only be restarted on on the same number of - processors on which the problem was originally run. To restart - on a different number of processors, used the - restart-redistribute tool in SAMRAI/tools/restart. - - -CONSTRUCTION: -------------- - - The ConvDiff application code is composed of various classes that implement - the algorithmic and numerical routines in the AMR solution process (see - comments in the main.C code for more discussion of the various objects - used to build the application). User-specified inputs control the - behavior of the objects. Those objects expecting input are: +For more details on library classes and the ConvDiff class consult +the comments in the header files for the library classes and the +ConvDiff.h class header file. - Main program .... creates objects used in the simulation - controls output - of viz and restart information. - MainRestart .... Stores data used in the main program for restart. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main - ConvDiff ........... defines variables and provides numerical kernels for - ConvDiff problem, including data initialization, time - integration, boundary routines, etc. + Run: + serial: + ./main test_inputs/test.[2,3]d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] main test_inputs/test.[2,3]d.input - CartesianGeometry ..... manages Cartesian grid coordinate system - on AMR patch hierarchy. + There are also example input files in the subdirectory example_inputs. + sphere.2d.input - advecting sphere in a box with fixed boundaries + sphere.3d.input - advecting sphere in a cube with fixed boundaries + heated_floor.2d.input - mimics a heated floor, demonstrating diffusion. - GriddingAlgorithm ..... constructs AMR patch hierarchy and - regrids levels during simulation. + The test and example input files contain comments describing the input + parameters specific to this problem. Descriptions of input parameters for + library classes will be found in the documentation of those classes as well + their header files. - - StandardTagAndInitialize .... manages tagging and initialization during - regridding operation. - MethodOfLinesIntegrator ... manages time integration using Runge-Kutta - algorithm on levels in AMR patch hierarchy. - - LoadBalancer .... manages mapping of patches to processors. - - - The input options for these objects are discussed below. The TYPE is - shown in (parenthesis) and the DEFAULT setting (value set if no input - is given) for the option is shown in [brackets]. Required inputs are - designated by [REQD]. - - "Main" input section - -------------------- - Main { - // Log file where output is directed - // log_file_name -- (char string) name of log file ["euler.log"] - // log_all_nodes -- (bool) option to specify whether output on different - // processors should be directed to multiple log files - // (named "log_file_name.") or to the - // single file. [FALSE] - log_file_name = "sphere-2d.log" - log_all_nodes = TRUE - - // Visualization dump parameters. - // viz_dump_interval -- (int) the interval in timesteps over coarsest - // level between writing of consecutive - // visualization dumps. Setting it to zero turns off - // writing of visualization files. - // viz_dump_dirname -- (char string) directory where viz files are - // writen (may include a path). VisIt requires a - // non-empty string. Vizamrai permits an empty string, - // in which case dumps go to directory where main2d/3d - // exists. If both data writers are used, directory name - // must be nonempty, and main.C will append _VisIt, - // _Vizamrai to dirname. - // visit_number_procs_per_file - // -- (int >= 1) for parallel runs, number of processors - // that share a single common dump file. If this parameter - // > number processors being used, all processors share - // single dump file. Not used by Vizamrai. - // - // For example, the following inputs: - viz_writer = "Vizamrai", "VisIt" - viz_dump_interval = 1 - viz_dump_dirname = "viz_sphere-2d" - // would result in the following dump structure: - // main2d - // viz_sphere-2d_VisIt/ - // visit_dump.00000/ - // visit_dump.00001/ - // ... - // dumps.visit - - // Restart dump parameters. - // restart_interval -- (int) the interval in timesteps over coarsest - // level between writing of consecutive restart - // files. Setting it to zero turns off writing - // of restart files. [0] - // restart_write_dirname -- (char string) directory where restart files - // are written [empty string] - // (assertion thrown if not specified - // and restart_interval > 0) - // - restart_interval = 1 - restart_write_dirname = "restart_sphere-2d" - - // Run-time plotting arguments (only apply in 2d): - // - // X-windows plotting specification for each primitive variable. - // Options: NO_PLOTTING, BOXES_ONLY, CONTOURS_ONLY, SHADE_ONLY, - // CONTOUR_WITH_SHADE, BOTH_CONTOUR_AND_SHADE - // (see "euler_const.input" below for discussion of these options). - // plotting_interval -- (int) interval for which values are plotted - // in X window during run [1] - // plot2d_density -- (above options) specification of plotting for - // density [NO_PLOTTING] - // plot2d_pressure -- (above options) specification of plotting for - // pressure [NO_PLOTTING] - // plot2d_velocity -- (above options) specification of plotting for - // velocity [NO_PLOTTING] - plotting_interval = 5 - plot2d_var = SHADE_ONLY - } - - "MainRestart" input section - -------------------- - MainRestart { - // max_timesteps -- (int) max number of timesteps to be used [REQD] - // start_time -- (double) simulation start time [0.] - // end_time -- (double) simulation stops when end time is reached - // (or if max timesteps is reached) [100000.] - // regrid_step -- (int) regrid interval [2] - // tag_buffer -- (int) buffer to be placed around tagged regions - [regrid_step] - } - - "ConvDiff" input section - --------------------- - ConvDiff { - // Problem specification parameters - // convection_coeff -- (double array) convection coefficient in each - // direction [0,0] - // diffusion_coeff -- (double) diffusion coefficient [0] - // source_coeff -- (double) source coefficient [0] - // cfl -- (double) cfl condition to control timestep - // dt = cfl*dx^2 (dx^3 in 3d) [0.9] - // cell_tagging_tolerance -- (double) value at which cells are tagged. - // (i.e. cells tagged if value > tol). - // data_problem -- (SPHERE) specification of the problem [REQD] - // - convection_coeff = 40.0, 20.0 - diffusion_coeff = 0.1 - source_coeff = 0.0 - cfl = 0.5 - cell_tagging_tol = 20.0 - data_problem = SPHERE - - // Initial data for SPHERE problem: - // radius -- (double) radius of sphere [REQD] - // center -- (double array) location of sphere center [REQD] - // val_inside -- (double) value inside sphere [REQD] - // val_outside -- (double) value outside sphere [REQD] - Initial_data { - radius = 2.9 - center = 5.5 , 5.5 - - val_inside = 80. - val_outside = 0. - } - - - // Boundary conditions - // Options: DIRICHLET, NEUMANN - // Boundary_data { - // boundary_node_x0y0 -- (above options) lower left corner [DIRICHLET] - // boundary_node_x1y0 -- (above options) lower right corner [DIRICHLET] - // boundary_node_x0y1 -- (above options) upper left corner [DIRICHLET] - // boundary_node_x1y1 -- (above options) upper right corner [DIRICHLET] - // boundary_edge_x0 { -- left edge - // boundary_edge_x1 { -- right edge - // boundary_edge_y0 { -- bottom edge - // boundary_edge_y1 { -- top edge - // boundary_type -- (above options) type at prescribed - // edge [DIRICHLET] - // bdry_val -- (double) value at prescribed edge [0] - // } - // - // edge_y1 - // node_x0y1 o--------------o node_x1y1 - // | | - // | | - // edge_x0 | | edge_x1 - // | | - // | | - // node_x0y0 o--------------o node_x1y0 - // edge_y0 - // - // NOTE: 3D case specifies data at faces as well. See - // /SAMRAI/docs/userdocs/boundaries.ps for further discussion. - Boundary_data { - boundary_node_x0y0 = DIRICHLET - boundary_node_x1y0 = DIRICHLET - boundary_node_x0y1 = DIRICHLET - boundary_node_x1y1 = DIRICHLET - boundary_edge_x0 { - boundary_type = DIRICHLET - } - boundary_edge_x1 { - boundary_type = DIRICHLET - } - boundary_edge_y0 { - boundary_type = DIRICHLET - } - boundary_edge_y1 { - boundary_type = DIRICHLET - } - } - - } +INPUT PARAMETER +--------------- +Refer to test_inputs/test2d.input for full description of all input parameters +specific to this problem. - "CartesianGeometry" input section - --------------------------------- - CartesianGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - x_lo = 0.e0 , 0.e0 - x_up = 65.e0 , 55.e0 - domain_boxes = [(0,0),(59,39)] - periodic_dimension = 0, 1 // periodic in y only - } +RESETTING BASELINES +------------------- +The tests that are run from this directory include comparisons of the results +to baseline data that represent expected results. The tests compare the +box configuration of the hierarchy, and certain timestep floating point values, +as specified in the AutoTester input described above. The baseline boxes +are stored in HDF data files, and the expected timestep values are listed +in the AutoTester input. - "GriddingAlgorithm" input section - --------------------------------- - GriddingAlgorithm { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - // smallest_patch_size { - // level_0 -- (int array) smallest patch allowed on level 0. - // [max ghost width for all variables] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 48 , 48 - } - smallest_patch_size { - level_0 = 8 , 8 - } +If a SAMRAI developer makes changes to the library that can legitimately change +the box configuration of a hierarchy, then the baselines here need to be reset, +according to the following steps - // Tolerances for gridding efficiency and box chopping operations. - // efficiency_tolerance -- (double array) minimum percentage of tagged - // cells allowed in a box [0.8 for each level] - // combine_efficiency -- (double array) threshold specifying when a - // box may be chopped into two smaller boxes. - // If sum of the volumes of smaller boxes is > - // combine efficiency * volume of larger box, - // then larger box will not be chopped. - // [0.8 for each level] - // proper_nesting_buffer -- (int array) number of coarse cells by which - // the next finer level is nested within its - // interior. [1 for each level] - efficiency_tolerance = 0.85e0 - combine_efficiency = 0.95e0 - proper_nesting_buffer = 1 +1. Change the AutoTester input block in each input file to include these + two entries: - // Option to read or write gridding information - // write_regrid_boxes -- (bool) Output sequence of refine boxes to file - // read_regrid_boxes -- (bool) Read sequence of refine boxes from file - // regrid_boxes_filename -- (string) file name used for reading or writing - // boxes. - // - // Reading and writing options require some user intervention to assure - // they work properly. Please consult Andy Wissink (awissink@llnl.gov) - // if you are interested in using these options. - write_regrid_boxes = TRUE - regrid_boxes_filename = TRUE - } + write_patch_boxes = TRUE + read_patch_boxes = FALSE - "StandardTagAndInitialize" input section - --------------------------------------------- - StandardTagAndInitialize { - // Specification of the type of tagging to be performed - // tagging_method -- (string array) one or more entries specifying - // the tagging algorithm used. Options include: - // "GRADIENT_DETECTOR" - // "RICHARDSON_EXTRAPOLATION" - // "REFINE_BOXES" - // - // REFINE_BOXES allows you to prescribe where refinement should occur. - // If this option is used, you must also supply a RefineBoxes database - // entry with the refine boxes on different levels specified. i.e. - // RefineBoxes{ - // level_0 -- (BoxArray) Boxes to be refined on level 0 - // level_1 -- (BoxArray) Boxes to be refined on level 1 - // etc. - // - // Gradient detection option. - tagging_method = "GRADIENT_DETECTOR" - // - // Richarson extrapolation option. - tagging_method = "RICHARDSON_EXTRAPOLATION" - // - // Static refine boxes option. - tagging_method = "REFINE_BOXES" - RefineBoxes { - level0_boxes = [(15,0),(29,14)] - level1_boxes = [(65,10),(114,40)] - } - // Combination. - tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" - } +2. Comment out all of the lines that read restart files in the + Makefile's check2d and check3d rules. - "MethodOfLinesIntegrator" input section - ----------------------------------------- - MethodOfLinesIntegrator{ - // order -- (int) order of the Runge-Kutta scheme (which will be - // the number of sub-iterations at each timestep. - // alpha -- (double array) sequence of alphas applied at each - // sub-iteration. The number of entries in the array - // should be the same as the order. - order = 2 - alpha = 0.5 , 1.0 - } +3. make check. The baseline HDF files will be regenerated here. - "LoadBalancer" input section - ---------------------------------- - LoadBalancer { - // using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) - } +4. If you get floating-point-difference errors when the "correct_result" + values are compared, do the following + a. set output_correct = TRUE in the AutoTester input -"euler_const.input" -------------------- - // This file specifies some constants used within the ConvDiff code. These - // names and values map to those specified via "#define" statements in - // ConvDiff.C + b. make check - // 2D X Window plotting options - // Plotting will execute while the program is running for 2D cases. - // Note that since it pipes data to an X-window, it slows the - // performance of the code somewhat, but it sure is PRETTY! - NO_PLOTTING = 0 // no plotting - BOXES_ONLY = 1 // plot bounding boxes only - CONTOURS_ONLY = 2 // plot contours only - SHADE_ONLY = 3 // plot color shade only - CONTOUR_WITH_SHADE = 4 // plot contours and color shade in same window - BOTH_CONTOUR_AND_SHADE = 5 // plot contours and color shade in separate - // window + c. Find the new values of the three floating-point outputs in the log + file, and put them on the line "correct_result = ..." + (make sure they don't differ too much). - - // - // Data problem (only one at this point - more could be added) - // SPHERE : sphere problem - SPHERE = 40 +5. Undo all makefile and input file changes (except for changes to + correct_results). - // Boundary types - // DIRICHLET - // NEUMANN - DIRICHLET = 1 - NEUMANN = 2 +6. make checktest (there should be no more errors). diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/heated_floor.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/heated_floor.2d.input index 46904aa1..3403356b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/heated_floor.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/heated_floor.2d.input @@ -3,20 +3,32 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Heated floor input for SAMRAI ConvDiff example problem * ************************************************************************/ + +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + ConvDiff { - convection_coeff = 0.0, 0.0 // vector [NDIM] + // convection-diffusion equation coefficients + convection_coeff = 0.0, 0.0 // vector of length dim diffusion_coeff = 0.5 // scalar source_coeff = 0.0 // scalar + // CFL condition for timestepping cfl = 0.5 - cell_tagging_tolerance = 11.0 // vector [NEQU] - data_problem = "SPHERE" + // Tolerance used for tagging cells. + cell_tagging_tolerance = 11.0 // vector of length NEQU defined in ConvDiff.h + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { radius = 2.9 center = 15.0, 10.0 // vector [NDIM] @@ -25,8 +37,8 @@ ConvDiff { val_outside = 10. // vector [NEQU] } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - // and "NEUMANN" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "DIRICHLET" @@ -68,41 +80,58 @@ ConvDiff { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "heated_floor.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_htdflr2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_htdflr2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } MainRestartData{ - max_timesteps = 20 + // maximum number of timesteps to take + max_timesteps = 20 + + // simulation time of first timestep start_time = 0. + + // simulation time of last timestep end_time = 100. + + // number of timesteps between regrids regrid_step = 3 + + // tag buffer for each finer level tag_buffer = 2 } - +// Refer to geom::CartesianGeometry and its base clases for input CartesianGeometry{ domain_boxes = [(0,0),(59,39)] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_lo = 0.e0 , 0.e0 // lower end of computational domain. x_up = 30.e0 , 20.e0 // upper end of computational domain. -// periodic_dimension = 1, 0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 @@ -120,22 +149,27 @@ PatchHierarchy { // boxes < efficiency * vol of large box } -GriddingAlgorithm{ - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::MethodOfLinesIntegrator for input MethodOfLinesIntegrator{ - order = 2 - alpha = 0.5 , 1.0 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.2d.input index afd89c18..9126a609 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.2d.input @@ -3,30 +3,42 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Advecting sphere input for SAMRAI ConvDiff example problem * ************************************************************************/ + +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + ConvDiff { - convection_coeff = 40.0, 20.0 // vector [NDIM] - diffusion_coeff = 0.1 // scalar - source_coeff = 0.0 // scalar + // convection-diffusion equation coefficients + convection_coeff = 40.0, 20.0 // vector of length dim + diffusion_coeff = 0.1 // scalar + source_coeff = 0.0 // scalar + // CFL condition for timestepping cfl = 0.5 - cell_tagging_tolerance = 20.0 // vector [NEQU] - data_problem = "SPHERE" + // Tolerance used for tagging cells. + cell_tagging_tolerance = 20.0 // vector of length NEQU defined in ConvDiff.h + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { - radius = 2.9 - center = 5.5, 5.5 // vector [NDIM] + radius = 2.9 + center = 5.5, 5.5 // vector of length dim - val_inside = 80.0 // vector [NEQU] - val_outside = 10. // vector [NEQU] + val_inside = 80.0 // vector of length NEQU defined in ConvDiff.h + val_outside = 10. // vector of length NEQU defined in ConvDiff.h } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET", - // and "NEUMANN" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -61,50 +73,63 @@ ConvDiff { boundary_condition = "XFLOW" } } + } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "sphere.2d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 -// restart dump parameters - restart_interval = 0 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 - plotting_interval = 5 } MainRestartData{ + // maximum number of timesteps to take max_timesteps = 50 + + // simulation time of first timestep start_time = 0. + + // simulation time of last timestep end_time = 100. + + // number of timesteps between regrids regrid_step = 3 + + // tag buffer for each finer level tag_buffer = 2 } - +// Refer to geom::CartesianGeometry and its base clases for input CartesianGeometry{ domain_boxes = [(0,0),(59,39)] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_lo = 0.e0 , 0.e0 // lower end of computational domain. x_up = 30.e0 , 20.e0 // upper end of computational domain. -// periodic_dimension = 1, 0 -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 @@ -122,18 +147,27 @@ PatchHierarchy { } -GriddingAlgorithm{ - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + +// Refer to algs::MethodOfLinesIntegrator for input MethodOfLinesIntegrator{ - order = 2 - alpha = 0.5 , 1.0 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.3d.input index ef626b31..373c3fb6 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/example_inputs/sphere.3d.input @@ -3,30 +3,42 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Advecting sphere input for SAMRAI ConvDiff example problem * ************************************************************************/ + +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + ConvDiff { - convection_coeff = 4.0e0 , 2.0e0 , 2.0e0 // vector [NDIM] - diffusion_coeff = 0.5 // scalar - source_coeff = 0.0 // scalar + // convection-diffusion equation coefficients + convection_coeff = 4.0e0 , 2.0e0 , 2.0e0 // vector of length dim + diffusion_coeff = 0.5 // scalar + source_coeff = 0.0 // scalar + // CFL condition for timestepping cfl = 0.5 - cell_tagging_tolerance = 20.0 // vector [NEQU] - data_problem = "SPHERE" + // Tolerance used for tagging cells. + cell_tagging_tolerance = 20.0 // vector of length NEQU defined in ConvDiff.h + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { radius = 2.9 - center = 5.5, 5.5, 5.5 // vector [NDIM] + center = 5.5, 5.5, 5.5 // vector of length dim - val_inside = 80.0 // vector [NEQU] - val_outside = 10. // vector [NEQU] + val_inside = 80.0 // vector of length NEQU defined in ConvDiff.h + val_outside = 10. // vector of length NEQU defined in ConvDiff.h } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - // and "NEUMANN" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "DIRICHLET" @@ -136,37 +148,55 @@ ConvDiff { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "sphere.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere3d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere3d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 -// restart dump parameters - restart_interval = 0 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } MainRestartData{ + // maximum number of timesteps to take max_timesteps = 10 + + // simulation time of first timestep start_time = 0. + + // simulation time of last timestep end_time = 100. + + // number of timesteps between regrids regrid_step = 3 + + // tag buffer for each finer level tag_buffer = 2 } +// Refer to geom::CartesianGeometry and its base clases for input CartesianGeometry{ domain_boxes = [ (0,0,0) , (14,9,9) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. @@ -195,22 +225,27 @@ PatchHierarchy { // boxes < efficiency * vol of large box } -GriddingAlgorithm{ - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::MethodOfLinesIntegrator for input MethodOfLinesIntegrator{ - order = 2 - alpha = 0.5 , 1.0 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.depend new file mode 100644 index 00000000..e5e6c269 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.depend @@ -0,0 +1,109 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=compute_rhs2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + compute_rhs2d.m4 const.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=compute_rhs3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + compute_rhs3d.m4 const.i + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=init2d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=init3d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=rkstep2d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + rkstep2d.m4 + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=rkstep3d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + rkstep3d.m4 + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=tag_cells2d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + tag_cells2d.m4 + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=tag_cells3d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + tag_cells3d.m4 + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.in new file mode 100644 index 00000000..19c31a2d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/Makefile.in @@ -0,0 +1,65 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI Convection-Diffusion +## ODE sample application +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/applications/ConvDiff/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= compute_rhs2d.o init2d.o rkstep2d.o tag_cells2d.o \ + compute_rhs3d.o init3d.o rkstep3d.o tag_cells3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +compute_rhs2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/compute_rhs2d.m4 > compute_rhs2d.f + $(F77) $(FFLAGS) -c compute_rhs2d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +tag_cells2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/tag_cells2d.m4 > tag_cells2d.f + $(F77) $(FFLAGS) -c tag_cells2d.f -o $@ + +rkstep2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/rkstep2d.m4 > rkstep2d.f + $(F77) $(FFLAGS) -c rkstep2d.f -o $@ + + +compute_rhs3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/compute_rhs3d.m4 > compute_rhs3d.f + $(F77) $(FFLAGS) -c compute_rhs3d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +tag_cells3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/tag_cells3d.m4 > tag_cells3d.f + $(F77) $(FFLAGS) -c tag_cells3d.f -o $@ + +rkstep3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/rkstep3d.m4 > rkstep3d.f + $(F77) $(FFLAGS) -c rkstep3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs2d.m4 index 44446e84..a6e80b83 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs2d.m4 @@ -1,6 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute RHS of 2d convection diffusion +c equation. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine computerhs2d( & ifirst0,ilast0,ifirst1,ilast1, @@ -29,7 +37,7 @@ c c variables in 2d cell indexed REAL & var(CELL2dVECG(ifirst,ilast,gcw),0:nequ-1), - & rhs(CELL2d(ifirst,ilast,0),0:nequ-1) + & rhs(CELL2dVECG(ifirst,ilast,gcw),0:nequ-1) c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs3d.m4 index 4e02ca51..6b2700d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/compute_rhs3d.m4 @@ -1,6 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute RHS of 3d convection diffusion +c equation. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine computerhs3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, @@ -29,7 +37,7 @@ c c variables in 3d cell indexed REAL & var(CELL3dVECG(ifirst,ilast,gcw),0:nequ-1), - & rhs(CELL3d(ifirst,ilast,0),0:nequ-1) + & rhs(CELL3dVECG(ifirst,ilast,gcw),0:nequ-1) c c*********************************************************************** c diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/const.i index e405389c..6bcd3a3d 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,tenth,sixth,fourth,third,half,twothird, & rt75,one,onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init2d.m4 index c1189e33..e615079b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to initialize 2d convection diffusion equation. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine initsphere2d(dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init3d.m4 index ca75eef6..78cbc077 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/init3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to initialize 3d convection diffusion equation. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine initsphere3d(dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep2d.m4 index 8dce1012..4d30c78e 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to take an RK step in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine rkstep2d( & ifirst0,ilast0,ifirst1,ilast1, @@ -31,7 +38,7 @@ c variables in 2d cell indexed REAL & soln_updated(CELL2dVECG(ifirst,ilast,gcw),0:nequ-1), & soln_fixed(CELL2d(ifirst,ilast,0),0:nequ-1), - & rhs(CELL2d(ifirst,ilast,0),0:nequ-1) + & rhs(CELL2dVECG(ifirst,ilast,gcw),0:nequ-1) c c*********************************************************************** c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep3d.m4 index eec35bbc..f21cb1a8 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/rkstep3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to take an RK step in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine rkstep3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, @@ -31,7 +38,7 @@ c variables in 2d cell indexed REAL & soln_updated(CELL3dVECG(ifirst,ilast,gcw),0:nequ-1), & soln_fixed(CELL3d(ifirst,ilast,0),0:nequ-1), - & rhs(CELL3d(ifirst,ilast,0),0:nequ-1) + & rhs(CELL3dVECG(ifirst,ilast,gcw),0:nequ-1) c c*********************************************************************** integer ic0,ic1,ic2,ineq diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells2d.m4 index ade1c9ea..5cadf374 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to tag cells in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine tagcells2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells3d.m4 index 29a9d2a2..8d128e1c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/fortran/tag_cells3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to tag cells in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine tagcells3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/main.C b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/main.C index 9738c7ca..82726091 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/main.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI convection-diffusion ex. problem. * ************************************************************************/ @@ -24,7 +24,7 @@ using namespace std; // Headers for basic SAMRAI objects #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/tbox/Database.h" @@ -53,10 +53,12 @@ using namespace std; // Classes for autotesting. #if (TESTING == 1) -#include "AutoTester.h" +#include "test/testlib/AutoTester.h" #endif -#include +#include "boost/shared_ptr.hpp" + +#include using namespace SAMRAI; using namespace algs; @@ -330,7 +332,6 @@ int main( boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", mol_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); @@ -346,7 +347,8 @@ int main( new mesh::TreeLoadBalancer( dim, "LoadBalancer", - input_db->getDatabase("LoadBalancer"))); + input_db->getDatabase("LoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); boost::shared_ptr gridding_algorithm( @@ -405,23 +407,24 @@ int main( * ****************************************************************/ - tbox::Array + std::vector tag_buffer_array(patch_hierarchy->getMaxNumberOfLevels()); - for (int il = 0; il < patch_hierarchy->getMaxNumberOfLevels(); il++) { + for (int il = 0; il < patch_hierarchy->getMaxNumberOfLevels(); ++il) { tag_buffer_array[il] = main_restart_data->getTagBuffer(); tbox::pout << "il = " << il << " tag_buffer = " << tag_buffer_array[il] << endl; } - tbox::Array - regrid_start_time(patch_hierarchy->getMaxNumberOfLevels()); + std::vector regrid_start_time( + patch_hierarchy->getMaxNumberOfLevels()); double loop_time = main_restart_data->getLoopTime(); + int loop_cycle = main_restart_data->getIterationNumber(); if (tbox::RestartManager::getManager()->isFromRestart()) { - patch_hierarchy->getFromRestart(); + patch_hierarchy->initializeHierarchy(); gridding_algorithm->getTagAndInitializeStrategy()-> resetHierarchyConfiguration(patch_hierarchy, @@ -433,14 +436,15 @@ int main( gridding_algorithm->makeCoarsestLevel(loop_time); bool done = false; - bool initial_time = true; + bool initial_cycle = true; for (int ln = 0; patch_hierarchy->levelCanBeRefined(ln) && !done; - ln++) { + ++ln) { gridding_algorithm->makeFinerLevel( - loop_time, - initial_time, - tag_buffer_array[ln]); + tag_buffer_array[ln], + initial_cycle, + loop_cycle, + loop_time); done = !(patch_hierarchy->finerLevelExists(ln)); } } @@ -507,7 +511,7 @@ int main( (iteration_num < main_restart_data->getMaxTimesteps())) { iteration_num = main_restart_data->getIterationNumber(); - iteration_num++; + ++iteration_num; tbox::pout << "++++++++++++++++++++++++++++++++++++++++++++" << endl; tbox::pout << "At begining of timestep # " << iteration_num - 1 @@ -564,8 +568,9 @@ int main( << patch_hierarchy->getFinestLevelNumber() << endl; gridding_algorithm->regridAllFinerLevels(0, - loop_time, tag_buffer_array, + iteration_num, + loop_time, regrid_start_time); tbox::plog << "Finest level after regrid: " diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000001.0000000 index 1bf0c1fc..5f83b5fe 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000000 index 20d693f9..8c72c2b1 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000001 index e8a05d15..4d5610c4 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..bf171383 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..1fa74312 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..2702c39a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..4ff17c4b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.input index b5e9a1dc..90ecfed6 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.2d.input @@ -3,53 +3,109 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Advecting sphere input for SAMRAI ConvDiff example problem * ************************************************************************/ GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). call_abort_in_serial_instead_of_exit = FALSE } AutoTester { + // If true, fluxes will be written out to a .dat file for inspection. + // Default is FALSE. + test_fluxes = FALSE + + // iteration to carry out test. Default is 10. test_iter_num = 10 - correct_result = 0.0048828125, 0.00048828125 - output_correct = FALSE + // if true will write correct patch boxes--used for rebaselining + // Default is FALSE. write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + // Default is FALSE. read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. test_patch_boxes_filename = "test_inputs/test.2d.boxes" - simplify_test_boxes = TRUE + + // expected correct result + // Required if test_fluxes is FALSE. Unread otherwise. No default. + correct_result = 0.0048828125, 0.00048828125 + + // if true will write corrct result--used for rebaselining + // Default is FALSE. + output_correct = FALSE } ConvDiff { - convection_coeff = 40.0, 20.0 // vector [NDIM] - diffusion_coeff = 0.1 // scalar - source_coeff = 0.0 // scalar + // convection-diffusion equation coefficients + // Vector of length dim. Required input. No default. + convection_coeff = 40.0, 20.0 + + // Scalar. Required input. No default. + diffusion_coeff = 0.1 + // Scalar. Required input. No default. + source_coeff = 0.0 + + + // CFL condition for timestepping. + // Default is 0.9. cfl = 0.5 - cell_tagging_tolerance = 20.0 // vector [NEQU] + + // Tolerance used for tagging cells. + // Vector of length NEQU defined in ConvDiff.h. + // Required input. No default. + cell_tagging_tolerance = 20.0 + + + // General type of problem and its initial conditions. + // May only be "SPHERE". Required input. No default. data_problem = "SPHERE" + // Problem initial data. Required inputs. No default. Initial_data { + // Radius of sphere. Required input. No default. radius = 2.9 - center = 5.5, 5.5 // vector [NDIM] - val_inside = 80.0 // vector [NEQU] - val_outside = 10. // vector [NEQU] + // Center of sphere. Vector of length dim. + // Required input. No default. + center = 5.5, 5.5 + + // Initial value of "u" inside sphere. + // Vector of length NEQU defined in ConDiff.h. + // Required input. No default. + val_inside = 80.0 + + // Initial value of "u" outside sphere. + // Vector of length NEQU defined in ConDiff.h. + // Required input. No default. + val_outside = 10. } + + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. Boundary_data { boundary_edge_xlo { boundary_condition = "DIRICHLET" val = 10. } boundary_edge_xhi { - boundary_condition = "DIRICHLET" - val = 10. + boundary_condition = "FLOW" } boundary_edge_ylo { boundary_condition = "DIRICHLET" @@ -70,7 +126,7 @@ ConvDiff { boundary_condition = "XDIRICHLET" } boundary_node_xhi_ylo { - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_node_xlo_yhi { boundary_condition = "YDIRICHLET" @@ -83,39 +139,80 @@ ConvDiff { } Main { + // Dimension of problem. Required input. No default. dim = 2 + + + // Base name of log file. Default is "unnamed". base_name = "test.2d" -// log file parameters + + + // Explicit name of log file. Default is base_name + ".log" + log_filname = "test.2d.log" + + + // If true all nodes will log to individual files. + // If false only node 0 will log. + // Default is false. log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + + // visualization dump parameters + // Frequency at which to dump viz output--zero to turn off. + // Default is 0. + viz_dump_interval = 0 + + // Directory in which to place viz output. + // Default is base_name + ".visit" viz_dump_dirname = "viz_test-2d" -// restart dump parameters - restart_interval = 5 // zero to turn off + // Number of processors which write to each viz file. + // Default is 1. + visit_number_procs_per_file = 1 + + + // restart dump parameters + // Frequency at which to dump restart output--zero to turn off + // Default is 0. + restart_interval = 5 - plotting_interval = 0 // zero to turn off + // Directory in which to place restart output. + // Default is base_name + ".restart" + restart_write_dirname = "test.2d.restart" } MainRestartData{ + // Maximum number of timesteps to take. + // Required if not run from restart. max_timesteps = 10 + + // Simulation time of first timestep. + // Default is 0.0. start_time = 0. + + // Simulation time of last timestep. + // Default is 100000. end_time = 100. + + // Number of timesteps between regrids. + // Default is 2. regrid_step = 3 + + // Tag buffer for each finer level. + // Default is regrid_step. tag_buffer = 2 } - +// Refer to geom::CartesianGeometry and its base clases for input CartesianGeometry{ domain_boxes = [(0,0),(59,39)] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_lo = 0.e0 , 0.e0 // lower end of computational domain. x_up = 30.e0 , 20.e0 // upper end of computational domain. -// periodic_dimension = 1, 0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 @@ -135,26 +232,28 @@ PatchHierarchy { // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ +} +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::MethodOfLinesIntegrator for input MethodOfLinesIntegrator{ - order = 2 - alpha = 0.5 , 1.0 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000001.0000000 index edde12fc..ca87b276 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000000 index 6edb8314..3e94ce00 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000001 index 7289fd79..56b6fc8c 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..9bd9ec60 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..e1f9ea8b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..22ac87d8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..47e7ffaa Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.input index 6cc09546..73c80a2e 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/test.3d.input @@ -3,67 +3,86 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Advecting sphere input for SAMRAI ConvDiff example problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.625, 0.0625 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining + write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + read_patch_boxes = TRUE + + // time steps for which correctness of patch boxes will be checked test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test.3d.boxes" - simplify_test_boxes = TRUE } ConvDiff { - convection_coeff = 4.0e0 , 2.0e0 , 2.0e0 // vector [NDIM] - diffusion_coeff = 0.5 // scalar - source_coeff = 0.0 // scalar + // convection-diffusion equation coefficients + convection_coeff = 4.0e0 , 2.0e0 , 2.0e0 // vector of length dim + diffusion_coeff = 0.1 // scalar + source_coeff = 0.0 // scalar + // CFL condition for timestepping cfl = 0.5 - cell_tagging_tolerance = 20.0 // vector [NEQU] - data_problem = "SPHERE" + // Tolerance used for tagging cells. + cell_tagging_tolerance = 20.0 // vector of length NEQU defined in ConvDiff.h + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { radius = 2.9 - center = 5.5, 5.5, 5.5 // vector [NDIM] + center = 5.5, 5.5, 5.5 // vector if length dim - val_inside = 80.0 // vector [NEQU] - val_outside = 10. // vector [NEQU] + val_inside = 80.0 // vector of length NEQU defined in ConvDiff.h + val_outside = 10. // vector of length NEQU defined in ConvDiff.h } - Boundary_data { + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] + Boundary_data { boundary_face_xlo { boundary_condition = "DIRICHLET" val = 10. } boundary_face_xhi { - boundary_condition = "DIRICHLET" - val = 10. + boundary_condition = "FLOW" } boundary_face_ylo { boundary_condition = "DIRICHLET" val = 10. } boundary_face_yhi { - boundary_condition = "DIRICHLET" - val = 10. + boundary_condition = "FLOW" } boundary_face_zlo { boundary_condition = "DIRICHLET" val = 100. } boundary_face_zhi { - boundary_condition = "DIRICHLET" - val = 10. + boundary_condition = "FLOW" } // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given @@ -81,10 +100,10 @@ ConvDiff { boundary_condition = "ZDIRICHLET" } boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" + boundary_condition = "ZFLOW" } boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" + boundary_condition = "ZFLOW" } boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed boundary_condition = "XDIRICHLET" @@ -93,10 +112,10 @@ ConvDiff { boundary_condition = "XDIRICHLET" } boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed boundary_condition = "YDIRICHLET" @@ -105,10 +124,10 @@ ConvDiff { boundary_condition = "YDIRICHLET" } boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" + boundary_condition = "YFLOW" } boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" + boundary_condition = "YFLOW" } // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given @@ -123,25 +142,25 @@ ConvDiff { boundary_condition = "XDIRICHLET" } boundary_node_xhi_ylo_zlo { - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_node_xlo_yhi_zlo { boundary_condition = "XDIRICHLET" } boundary_node_xhi_yhi_zlo { - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_node_xlo_ylo_zhi { boundary_condition = "XDIRICHLET" } boundary_node_xhi_ylo_zhi { - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } boundary_node_xlo_yhi_zhi { boundary_condition = "XDIRICHLET" } boundary_node_xhi_yhi_zhi { - boundary_condition = "XDIRICHLET" + boundary_condition = "XFLOW" } } @@ -149,28 +168,46 @@ ConvDiff { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz_test-3d" -// restart dump parameters - restart_interval = 5 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 5 } MainRestartData{ + // maximum number of timesteps to take max_timesteps = 10 + + // simulation time of first timestep start_time = 0. + + // simulation time of last timestep end_time = 100. + + // number of timesteps between regrids regrid_step = 3 + + // tag buffer for each finer level tag_buffer = 2 } +// Refer to geom::CartesianGeometry and its base clases for input CartesianGeometry{ domain_boxes = [ (0,0,0) , (14,9,9) ] @@ -178,8 +215,9 @@ CartesianGeometry{ x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -205,26 +243,29 @@ PatchHierarchy { } // boxes < efficiency * vol of large box } + +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ +} +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::MethodOfLinesIntegrator for input MethodOfLinesIntegrator{ - order = 2 - alpha = 0.5 , 1.0 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..fc06a4c0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..65fd9b28 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..619da925 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..9e61085a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..e84cd4fc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..be1705c8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..fdc897e2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..52a6f9c4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..c572afdb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..3bbedf9b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..cc5cfdc8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..69738f6d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..dd786e4c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..40f24548 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..682f3f8d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..7b415376 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..a405d68a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..dcbd9942 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..d398f68d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..30584bd6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..cf670e34 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..019507fc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..01e824d4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..d50ce6e9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..656dfa12 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..c421eeec Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..d948c323 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..28814c8c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/ConvDiff/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.C b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.C index ba3b0552..150315fc 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for Euler equations SAMRAI example * ************************************************************************/ @@ -45,6 +45,7 @@ using namespace std; #include "SAMRAI/mesh/TreeLoadBalancer.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Timer.h" @@ -125,17 +126,18 @@ Euler::Euler( const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom): - algs::HyperbolicPatchStrategy(dim), + algs::HyperbolicPatchStrategy(), d_object_name(object_name), d_grid_geometry(grid_geom), d_dim(dim), d_use_nonuniform_workload(false), d_density(new pdat::CellVariable(dim, "density", 1)), d_velocity(new pdat::CellVariable( - dim, "velocity", d_dim.getValue())), + dim, "velocity", d_dim.getValue())), d_pressure(new pdat::CellVariable(dim, "pressure", 1)), d_flux(new pdat::FaceVariable(dim, "flux", NEQU)), - d_gamma(1.4), // specific heat ratio for ideal diatomic gas (e.g., air) + d_gamma(1.4), + // specific heat ratio for ideal diatomic gas (e.g., air) d_riemann_solve("APPROX_RIEM_SOLVE"), d_godunov_order(1), d_corner_transport("CORNER_TRANSPORT_1"), @@ -169,16 +171,16 @@ Euler::Euler( getTimer("apps::Euler::tagGradientDetectorCells()"); } -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif /* * Defaults for problem type and initial data */ - tbox::MathUtilities::setArrayToSignalingNaN(d_center, d_dim.getValue()); - tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_inside, d_dim.getValue()); + tbox::MathUtilities::setArrayToSignalingNaN(d_center, + d_dim.getValue()); + tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_inside, + d_dim.getValue()); tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_outside, d_dim.getValue()); @@ -188,73 +190,79 @@ Euler::Euler( */ if (d_dim == tbox::Dimension(2)) { - d_master_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_master_bdry_edge_conds.resize(NUM_2D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_master_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_master_bdry_node_conds.resize(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_vector_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_density.resizeArray(NUM_2D_EDGES); - d_bdry_edge_velocity.resizeArray(NUM_2D_EDGES * d_dim.getValue()); - d_bdry_edge_pressure.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_density); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_velocity); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_pressure); + d_bdry_edge_density.resize(NUM_2D_EDGES); + d_bdry_edge_velocity.resize(NUM_2D_EDGES * d_dim.getValue()); + d_bdry_edge_pressure.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_edge_density); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_edge_velocity); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_edge_pressure); } if (d_dim == tbox::Dimension(3)) { - d_master_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_vector_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_master_bdry_face_conds.resize(NUM_3D_FACES); + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + d_vector_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_master_bdry_face_conds[fi] = BOGUS_BDRY_DATA; d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; d_vector_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_master_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_master_bdry_edge_conds.resize(NUM_3D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_master_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_master_bdry_node_conds.resize(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_vector_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_density.resizeArray(NUM_3D_FACES); - d_bdry_face_velocity.resizeArray(NUM_3D_FACES * d_dim.getValue()); - d_bdry_face_pressure.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_density); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_velocity); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_pressure); + d_bdry_face_density.resize(NUM_3D_FACES); + d_bdry_face_velocity.resize(NUM_3D_FACES * d_dim.getValue()); + d_bdry_face_pressure.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_face_density); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_face_velocity); + tbox::MathUtilities::setVectorToSignalingNaN( + d_bdry_face_pressure); } /* @@ -306,7 +314,7 @@ Euler::Euler( * Postprocess boundary data from input/restart values. */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; @@ -315,7 +323,7 @@ Euler::Euler( } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; @@ -334,7 +342,7 @@ Euler::Euler( } } if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + for (int i = 0; i < NUM_3D_FACES; ++i) { d_scalar_bdry_face_conds[i] = d_master_bdry_face_conds[i]; d_vector_bdry_face_conds[i] = d_master_bdry_face_conds[i]; @@ -343,7 +351,7 @@ Euler::Euler( } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; @@ -364,7 +372,7 @@ Euler::Euler( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; @@ -387,7 +395,7 @@ Euler::Euler( } - F77_FUNC(stufprobc, STUFPROBC) (APPROX_RIEM_SOLVE, EXACT_RIEM_SOLVE, + SAMRAI_F77_FUNC(stufprobc, STUFPROBC) (APPROX_RIEM_SOLVE, EXACT_RIEM_SOLVE, HLLC_RIEM_SOLVE, PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SPHERE, STEP, @@ -431,10 +439,8 @@ Euler::~Euler() void Euler::registerModelVariables( algs::HyperbolicLevelIntegrator* integrator) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(integrator != (algs::HyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); -#endif integrator->registerVariable(d_density, d_nghosts, algs::HyperbolicLevelIntegrator::TIME_DEP, @@ -491,7 +497,7 @@ void Euler::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING(d_object_name << ": registerModelVariables()\n" - << "Visit data writer was not registered\n" + << "VisIt data writer was not registered\n" << "Consequently, no plot data will\n" << "be written." << endl); } @@ -516,11 +522,13 @@ void Euler::setupLoadBalancer( const hier::IntVector& zero_vec = hier::IntVector::getZero(d_dim); hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); + hier::PatchDataRestartManager* pdrm = + hier::PatchDataRestartManager::getManager(); if (d_use_nonuniform_workload && gridding_algorithm) { boost::shared_ptr load_balancer( - gridding_algorithm->getLoadBalanceStrategy(), - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast( + gridding_algorithm->getLoadBalanceStrategy())); if (load_balancer) { d_workload_variable.reset( @@ -533,7 +541,7 @@ void Euler::setupLoadBalancer( vardb->getContext("WORKLOAD"), zero_vec); load_balancer->setWorkloadPatchDataIndex(d_workload_data_id); - vardb->registerPatchDataForRestart(d_workload_data_id); + pdrm->registerPatchDataForRestart(d_workload_data_id); } else { TBOX_WARNING( d_object_name << ": " @@ -572,32 +580,31 @@ void Euler::initializeDataOnPatch( if (initial_time) { const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* xlo = pgeom->getXLower(); const double* xhi = pgeom->getXUpper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif + const hier::IntVector& ghost_cells = density->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); -#endif const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); @@ -605,7 +612,7 @@ void Euler::initializeDataOnPatch( if (d_data_problem == "SPHERE") { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2d) (d_data_problem_int, + SAMRAI_F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2d) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -623,7 +630,7 @@ void Euler::initializeDataOnPatch( d_pressure_outside, d_center, d_radius); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3d) (d_data_problem_int, + SAMRAI_F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3d) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -647,7 +654,7 @@ void Euler::initializeDataOnPatch( } else { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(eulerinit2d, EULERINIT2D) (d_data_problem_int, + SAMRAI_F77_FUNC(eulerinit2d, EULERINIT2D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -658,12 +665,12 @@ void Euler::initializeDataOnPatch( velocity->getPointer(), pressure->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_density.getPointer(), - d_interval_velocity.getPointer(), - d_interval_pressure.getPointer()); + &d_front_position[0], + &d_interval_density[0], + &d_interval_velocity[0], + &d_interval_pressure[0]); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(eulerinit3d, EULERINIT3D) (d_data_problem_int, + SAMRAI_F77_FUNC(eulerinit3d, EULERINIT3D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -676,10 +683,10 @@ void Euler::initializeDataOnPatch( velocity->getPointer(), pressure->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_density.getPointer(), - d_interval_velocity.getPointer(), - d_interval_pressure.getPointer()); + &d_front_position[0], + &d_interval_density[0], + &d_interval_velocity[0], + &d_interval_pressure[0]); } } @@ -691,8 +698,9 @@ void Euler::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } @@ -719,37 +727,36 @@ double Euler::computeStableDtOnPatch( t_compute_dt->start(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); const boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); const boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); const boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif + const hier::IntVector& ghost_cells = density->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); -#endif double stabdt = 0.; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(stabledt2d, STABLEDT2D) (dx, + SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), @@ -760,7 +767,7 @@ double Euler::computeStableDtOnPatch( pressure->getPointer(), stabdt); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(stabledt3d, STABLEDT3D) (dx, + SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -807,13 +814,12 @@ void Euler::computeFluxesOnPatch( if (d_dim == tbox::Dimension(2)) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -821,19 +827,18 @@ void Euler::computeFluxesOnPatch( const hier::Index ilast = pbox.upper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -842,7 +847,6 @@ void Euler::computeFluxesOnPatch( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -854,7 +858,7 @@ void Euler::computeFluxesOnPatch( /* * Initialize traced states (w^R and w^L) with proper cell-centered values. */ - F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), density->getPointer(), velocity->getPointer(), @@ -876,23 +880,23 @@ void Euler::computeFluxesOnPatch( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); /* * Compute local sound speed in each computational cell. */ - F77_FUNC(computesound2d, COMPUTESOUND2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(computesound2d, COMPUTESOUND2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), d_gamma, density->getPointer(), @@ -906,36 +910,36 @@ void Euler::computeFluxesOnPatch( * Inputs: sound_speed, w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, + SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[0], d_gamma, d_godunov_order, sound_speed.getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, + SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[1], d_gamma, d_godunov_order, sound_speed.getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity /* * Compute preliminary fluxes at faces by solving approximate @@ -943,7 +947,7 @@ void Euler::computeFluxesOnPatch( * Inputs: P, rho, v, w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), d_gamma, d_riemann_solve_int, @@ -962,7 +966,7 @@ void Euler::computeFluxesOnPatch( * Inputs: F (flux) * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec, FLUXCORREC) (dt, + SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), dx, d_gamma, density->getPointer(), @@ -982,7 +986,7 @@ void Euler::computeFluxesOnPatch( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), d_gamma, d_riemann_solve_int, @@ -1015,13 +1019,12 @@ void Euler::compute3DFluxesWithCornerTransport1( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1029,19 +1032,18 @@ void Euler::compute3DFluxesWithCornerTransport1( const hier::Index ilast = pbox.upper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -1050,7 +1052,6 @@ void Euler::compute3DFluxesWithCornerTransport1( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1065,7 +1066,7 @@ void Euler::compute3DFluxesWithCornerTransport1( /* * Initialize traced states (w^R and w^L) with proper cell-centered values. */ - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), density->getPointer(), @@ -1091,23 +1092,23 @@ void Euler::compute3DFluxesWithCornerTransport1( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); /* * Compute local sound speed in each computational cell. */ - F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, @@ -1122,7 +1123,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: sound_speed, w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1130,13 +1131,13 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1144,13 +1145,13 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1158,11 +1159,11 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... @@ -1172,9 +1173,9 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, w^L, w^R (traced_left/right) * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1198,7 +1199,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), P, rho, v, w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, 1, density->getPointer(), @@ -1228,7 +1229,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, temp_traced_left/right * Output: temp_flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1251,7 +1252,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), P, rho, v, w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, -1, density->getPointer(), @@ -1284,7 +1285,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, temp_traced_left/right * Output: flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1307,7 +1308,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: temp_flux, flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, + SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, density->getPointer(), @@ -1331,7 +1332,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1364,13 +1365,12 @@ void Euler::compute3DFluxesWithCornerTransport2( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1378,19 +1378,18 @@ void Euler::compute3DFluxesWithCornerTransport2( const hier::Index ilast = pbox.upper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -1399,7 +1398,6 @@ void Euler::compute3DFluxesWithCornerTransport2( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1413,7 +1411,7 @@ void Euler::compute3DFluxesWithCornerTransport2( /* * Initialize traced states (w^R and w^L) with proper cell-centered values. */ - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), density->getPointer(), @@ -1435,9 +1433,9 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: P, rho, v, w^L, w^R (traced_left/right) * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 1, 0, dx, +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1464,23 +1462,23 @@ void Euler::compute3DFluxesWithCornerTransport2( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); /* * Compute local sound speed in each computational cell. */ - F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, @@ -1494,7 +1492,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: sound_speed, w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1502,13 +1500,13 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1516,13 +1514,13 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1530,15 +1528,15 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { /* * Approximate traces at cell centers (in idir direction); @@ -1546,7 +1544,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: F (flux), rho, v, P * Output: third_state */ - F77_FUNC(onethirdstate, ONETHIRDSTATE) (dt, dx, idir, + SAMRAI_F77_FUNC(onethirdstate, ONETHIRDSTATE) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, density->getPointer(), @@ -1563,7 +1561,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: third_state, rho, v, P * Output: temp_flux (only directions other than idir are modified) */ - F77_FUNC(fluxthird, FLUXTHIRD) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxthird, FLUXTHIRD) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1581,7 +1579,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: temp_flux, rho, v, P * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrecjt, FLUXCORRECJT) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxcorrecjt, FLUXCORRECJT) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, density->getPointer(), @@ -1606,7 +1604,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1650,8 +1648,9 @@ void Euler::conservativeDifferenceOnPatch( t_conservdiff->start(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1659,19 +1658,18 @@ void Euler::conservativeDifferenceOnPatch( const hier::Index ilast = pbox.upper(); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -1680,10 +1678,9 @@ void Euler::conservativeDifferenceOnPatch( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif if (d_dim == tbox::Dimension(2)) { - F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), dx, flux->getPointer(0), flux->getPointer(1), @@ -1692,7 +1689,7 @@ void Euler::conservativeDifferenceOnPatch( velocity->getPointer(), pressure->getPointer()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, flux->getPointer(0), flux->getPointer(1), @@ -1728,10 +1725,13 @@ void Euler::boundaryReset( bool bdry_cell = true; const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); hier::BoxContainer domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); + d_grid_geometry->computePhysicalDomain(domain_boxes, + patch_geom->getRatio(), + hier::BlockId::zero()); const double* dx = patch_geom->getDx(); const double* xpatchhi = patch_geom->getXUpper(); const double* xdomainhi = d_grid_geometry->getXUpper(); @@ -1742,7 +1742,7 @@ void Euler::boundaryReset( hier::Index iblast = ilast; int bdry_case = 0; - for (idir = 0; idir < d_dim.getValue(); idir++) { + for (idir = 0; idir < d_dim.getValue(); ++idir) { ibfirst(idir) = ifirst(idir) - 1; iblast(idir) = ifirst(idir) - 1; bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); @@ -1752,8 +1752,8 @@ void Euler::boundaryReset( bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); } - hier::BoxContainer::iterator ib(bdrybox); - for (idir = 0; idir < d_dim.getValue(); idir++) { + hier::BoxContainer::iterator ib = bdrybox.begin(); + for (idir = 0; idir < d_dim.getValue(); ++idir) { int bside = 2 * idir; if (d_dim == tbox::Dimension(2)) { bdry_case = d_master_bdry_edge_conds[bside]; @@ -1762,9 +1762,11 @@ void Euler::boundaryReset( bdry_case = d_master_bdry_face_conds[bside]; } if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*ib, false); - for (pdat::CellIterator ic(*ib, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); domain_boxes_itr != domain_boxes.end(); ++domain_boxes_itr) { if (domain_boxes_itr->contains(*ic)) @@ -1792,9 +1794,11 @@ void Euler::boundaryReset( } // END SIMPLE-MINDED FIX FOR STEP PROBLEM if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*ib, false); - for (pdat::CellIterator ic(*ib, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); domain_boxes_itr != domain_boxes.end(); ++domain_boxes_itr) { if (domain_boxes_itr->contains(*ic)) @@ -1819,11 +1823,6 @@ void Euler::boundaryReset( ************************************************************************* */ -hier::IntVector Euler::getRefineOpStencilWidth() const -{ - return hier::IntVector(d_dim, 1); -} - void Euler::postprocessRefine( hier::Patch& fine, const hier::Patch& coarse, @@ -1832,26 +1831,25 @@ void Euler::postprocessRefine( { boost::shared_ptr > cdensity( - coarse.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_density, getDataContext()))); boost::shared_ptr > cvelocity( - coarse.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > cpressure( - coarse.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > fdensity( - fine.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_density, getDataContext()))); boost::shared_ptr > fvelocity( - fine.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > fpressure( - fine.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cdensity); TBOX_ASSERT(cvelocity); TBOX_ASSERT(cpressure); @@ -1859,6 +1857,7 @@ void Euler::postprocessRefine( TBOX_ASSERT(fvelocity); TBOX_ASSERT(fpressure); +#ifdef DEBUG_CHECK_ASSERTIONS hier::IntVector gccheck = cdensity->getGhostCellWidth(); TBOX_ASSERT(cvelocity->getGhostCellWidth() == gccheck); TBOX_ASSERT(cpressure->getGhostCellWidth() == gccheck); @@ -1876,11 +1875,13 @@ void Euler::postprocessRefine( const hier::Index fihi = fdensity->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); const hier::Index ifirstc = coarse_box.lower(); @@ -1900,7 +1901,7 @@ void Euler::postprocessRefine( pdat::CellData slope1(coarse_box, 1, tmp_ghosts); double* diff2 = d_dim == - tbox::Dimension(3) ? new double[coarse_box.numberCells(2) + 1] : NULL; + tbox::Dimension(3) ? new double[coarse_box.numberCells(2) + 1] : 0; pdat::CellData slope2(coarse_box, 1, tmp_ghosts); if (d_dim == tbox::Dimension(2)) { @@ -1914,7 +1915,7 @@ void Euler::postprocessRefine( double* tdensc = new double[mc]; double* tpresc = new double[mc]; double* tvelc = new double[mc]; - F77_FUNC(conservlinint2d, CONSERVLININT2D) (ifirstc(0), ifirstc(1), + SAMRAI_F77_FUNC(conservlinint2d, CONSERVLININT2D) (ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), /* input */ ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -1942,8 +1943,7 @@ void Euler::postprocessRefine( delete[] tdensc; delete[] tpresc; delete[] tvelc; - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { pdat::CellData flat0(coarse_box, 1, tmp_ghosts); pdat::CellData flat1(coarse_box, 1, tmp_ghosts); pdat::CellData flat2(coarse_box, 1, tmp_ghosts); @@ -1956,7 +1956,7 @@ void Euler::postprocessRefine( double* tdensc = new double[mc]; double* tpresc = new double[mc]; double* tvelc = new double[mc]; - F77_FUNC(conservlinint3d, CONSERVLININT3D) (ifirstc(0), ifirstc(1), + SAMRAI_F77_FUNC(conservlinint3d, CONSERVLININT3D) (ifirstc(0), ifirstc(1), ifirstc(2), /* input */ ilastc(0), ilastc(1), ilastc(2), ifirstf(0), ifirstf(1), ifirstf(2), @@ -2007,11 +2007,6 @@ void Euler::postprocessRefine( ************************************************************************* */ -hier::IntVector Euler::getCoarsenOpStencilWidth() const -{ - return hier::IntVector(d_dim, 0); -} - void Euler::postprocessCoarsen( hier::Patch& coarse, const hier::Patch& fine, @@ -2020,25 +2015,24 @@ void Euler::postprocessCoarsen( { boost::shared_ptr > fdensity( - fine.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_density, getDataContext()))); boost::shared_ptr > fvelocity( - fine.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > fpressure( - fine.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > cdensity( - coarse.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_density, getDataContext()))); boost::shared_ptr > cvelocity( - coarse.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > cpressure( - coarse.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cdensity); TBOX_ASSERT(cvelocity); TBOX_ASSERT(cpressure); @@ -2046,6 +2040,7 @@ void Euler::postprocessCoarsen( TBOX_ASSERT(fvelocity); TBOX_ASSERT(fpressure); +#ifdef DEBUG_CHECK_ASSERTIONS hier::IntVector gccheck = cdensity->getGhostCellWidth(); TBOX_ASSERT(cvelocity->getGhostCellWidth() == gccheck); TBOX_ASSERT(cpressure->getGhostCellWidth() == gccheck); @@ -2061,11 +2056,13 @@ void Euler::postprocessCoarsen( const hier::Index cihi = cdensity->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + coarse.getPatchGeometry())); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); const hier::Box fine_box = hier::Box::refine(coarse_box, ratio); const hier::Index ifirstc = coarse_box.lower(); @@ -2077,7 +2074,7 @@ void Euler::postprocessCoarsen( pdat::CellData conserved(fine_box, 1, cons_ghosts); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(conservavg2d, CONSERVAVG2D) (ifirstf(0), ifirstf(1), ilastf(0), + SAMRAI_F77_FUNC(conservavg2d, CONSERVAVG2D) (ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), /* input */ ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), @@ -2093,9 +2090,8 @@ void Euler::postprocessCoarsen( cvelocity->getPointer(), /* output */ cpressure->getPointer(), conserved.getPointer()); /* temporary */ - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(conservavg3d, CONSERVAVG3D) (ifirstf(0), ifirstf(1), ifirstf(2), /* input */ + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conservavg3d, CONSERVAVG3D) (ifirstf(0), ifirstf(1), ifirstf(2), /* input */ ilastf(0), ilastf(1), ilastf(2), ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), @@ -2136,22 +2132,20 @@ void Euler::setPhysicalBoundaryConditions( t_setphysbcs->start(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif - hier::IntVector ghost_cells = density->getGhostCellWidth(); #ifdef DEBUG_CHECK_ASSERTIONS + hier::IntVector ghost_cells = density->getGhostCellWidth(); TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); #endif @@ -2165,9 +2159,9 @@ void Euler::setPhysicalBoundaryConditions( * so that the right edge of the domain gets (out)FLOW conditions * whereas the right edge at the step gets REFLECT condtions (from input), */ - tbox::Array tmp_edge_scalar_bcond(NUM_2D_EDGES); - tbox::Array tmp_edge_vector_bcond(NUM_2D_EDGES); - for (int i = 0; i < NUM_2D_EDGES; i++) { + std::vector tmp_edge_scalar_bcond(NUM_2D_EDGES); + std::vector tmp_edge_vector_bcond(NUM_2D_EDGES); + for (int i = 0; i < NUM_2D_EDGES; ++i) { tmp_edge_scalar_bcond[i] = d_scalar_bdry_edge_conds[i]; tmp_edge_vector_bcond[i] = d_vector_bdry_edge_conds[i]; } @@ -2175,8 +2169,9 @@ void Euler::setPhysicalBoundaryConditions( if (d_data_problem == "STEP") { const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const double* xpatchhi = patch_geom->getXUpper(); const double* xdomainhi = d_grid_geometry->getXUpper(); @@ -2365,22 +2360,26 @@ void Euler::tagGradientDetectorCells( const int error_level_number = patch.getPatchLevelNumber(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); + TBOX_ASSERT(tags); hier::Box pbox = patch.getBox(); hier::BoxContainer domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); + d_grid_geometry->computePhysicalDomain(domain_boxes, + patch_geom->getRatio(), + hier::BlockId::zero()); /* * Construct domain bounding box */ hier::Box domain(d_dim); - for (hier::BoxContainer::iterator i(domain_boxes); + for (hier::BoxContainer::iterator i = domain_boxes.begin(); i != domain_boxes.end(); ++i) { domain += *i; } @@ -2413,8 +2412,9 @@ void Euler::tagGradientDetectorCells( } hier::Box ibox = pbox * tagbox; - pdat::CellIterator itcend(ibox, false); - for (pdat::CellIterator itc(ibox, true); itc != itcend; ++itc) { + pdat::CellIterator itcend(pdat::CellGeometry::end(ibox)); + for (pdat::CellIterator itc(pdat::CellGeometry::begin(ibox)); + itc != itcend; ++itc) { (*temp_tags)(*itc, 0) = TRUE; } } @@ -2431,7 +2431,8 @@ void Euler::tagGradientDetectorCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > var; @@ -2442,123 +2443,113 @@ void Euler::tagGradientDetectorCells( bool time_allowed = false; if (ref == "DENSITY_DEVIATION") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_density, getDataContext())); - size = d_density_dev_tol.getSize(); + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_dev_tol.size()); tol = ((error_level_number < size) ? d_density_dev_tol[error_level_number] : d_density_dev_tol[size - 1]); - size = d_density_dev.getSize(); + size = static_cast(d_density_dev.size()); dev = ((error_level_number < size) ? d_density_dev[error_level_number] : d_density_dev[size - 1]); - size = d_density_dev_time_min.getSize(); + size = static_cast(d_density_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_density_dev_time_min[error_level_number] : d_density_dev_time_min[size - 1]); - size = d_density_dev_time_max.getSize(); + size = static_cast(d_density_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_density_dev_time_max[error_level_number] : d_density_dev_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "DENSITY_GRADIENT") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_density, getDataContext())); - size = d_density_grad_tol.getSize(); + } else if (ref == "DENSITY_GRADIENT") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_grad_tol.size()); tol = ((error_level_number < size) ? d_density_grad_tol[error_level_number] : d_density_grad_tol[size - 1]); - size = d_density_grad_time_min.getSize(); + size = static_cast(d_density_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_density_grad_time_min[error_level_number] : d_density_grad_time_min[size - 1]); - size = d_density_grad_time_max.getSize(); + size = static_cast(d_density_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_density_grad_time_max[error_level_number] : d_density_grad_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "DENSITY_SHOCK") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_density, getDataContext())); - size = d_density_shock_tol.getSize(); + } else if (ref == "DENSITY_SHOCK") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_shock_tol.size()); tol = ((error_level_number < size) ? d_density_shock_tol[error_level_number] : d_density_shock_tol[size - 1]); - size = d_density_shock_onset.getSize(); + size = static_cast(d_density_shock_onset.size()); onset = ((error_level_number < size) ? d_density_shock_onset[error_level_number] : d_density_shock_onset[size - 1]); - size = d_density_shock_time_min.getSize(); + size = static_cast(d_density_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_density_shock_time_min[error_level_number] : d_density_shock_time_min[size - 1]); - size = d_density_shock_time_max.getSize(); + size = static_cast(d_density_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_density_shock_time_max[error_level_number] : d_density_shock_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_DEVIATION") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_pressure, getDataContext())); - size = d_pressure_dev_tol.getSize(); + } else if (ref == "PRESSURE_DEVIATION") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_dev_tol.size()); tol = ((error_level_number < size) ? d_pressure_dev_tol[error_level_number] : d_pressure_dev_tol[size - 1]); - size = d_pressure_dev.getSize(); + size = static_cast(d_pressure_dev.size()); dev = ((error_level_number < size) ? d_pressure_dev[error_level_number] : d_pressure_dev[size - 1]); - size = d_pressure_dev_time_min.getSize(); + size = static_cast(d_pressure_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_dev_time_min[error_level_number] : d_pressure_dev_time_min[size - 1]); - size = d_pressure_dev_time_max.getSize(); + size = static_cast(d_pressure_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_dev_time_max[error_level_number] : d_pressure_dev_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_GRADIENT") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_pressure, getDataContext())); - size = d_pressure_grad_tol.getSize(); + } else if (ref == "PRESSURE_GRADIENT") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_grad_tol.size()); tol = ((error_level_number < size) ? d_pressure_grad_tol[error_level_number] : d_pressure_grad_tol[size - 1]); - size = d_pressure_grad_time_min.getSize(); + size = static_cast(d_pressure_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_grad_time_min[error_level_number] : d_pressure_grad_time_min[size - 1]); - size = d_pressure_grad_time_max.getSize(); + size = static_cast(d_pressure_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_grad_time_max[error_level_number] : d_pressure_grad_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_SHOCK") { - var = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_pressure, getDataContext())); - size = d_pressure_shock_tol.getSize(); + } else if (ref == "PRESSURE_SHOCK") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_shock_tol.size()); tol = ((error_level_number < size) ? d_pressure_shock_tol[error_level_number] : d_pressure_shock_tol[size - 1]); - size = d_pressure_shock_onset.getSize(); + size = static_cast(d_pressure_shock_onset.size()); onset = ((error_level_number < size) ? d_pressure_shock_onset[error_level_number] : d_pressure_shock_onset[size - 1]); - size = d_pressure_shock_time_min.getSize(); + size = static_cast(d_pressure_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_shock_time_min[error_level_number] : d_pressure_shock_time_min[size - 1]); - size = d_pressure_shock_time_max.getSize(); + size = static_cast(d_pressure_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_shock_time_max[error_level_number] : d_pressure_shock_time_max[size - 1]); @@ -2567,9 +2558,7 @@ void Euler::tagGradientDetectorCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(var); -#endif hier::IntVector vghost = var->getGhostCellWidth(); hier::IntVector tagghost = tags->getGhostCellWidth(); @@ -2582,8 +2571,9 @@ void Euler::tagGradientDetectorCells( * RICHARDSON_NEWLY_TAGGED since these were set most recently * by Richardson extrapolation. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { double locden = tol; int tag_val = (*tags)(*ic, 0); if (tag_val) { @@ -2596,11 +2586,9 @@ void Euler::tagGradientDetectorCells( (*temp_tags)(*ic, 0) = TRUE; } } - } - - if (ref == "DENSITY_GRADIENT" || ref == "PRESSURE_GRADIENT") { + } else if (ref == "DENSITY_GRADIENT" || ref == "PRESSURE_GRADIENT") { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectgrad2d, DETECTGRAD2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2610,7 +2598,7 @@ void Euler::tagGradientDetectorCells( var->getPointer(), tags->getPointer(), temp_tags->getPointer()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectgrad3d, DETECTGRAD3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), @@ -2622,11 +2610,9 @@ void Euler::tagGradientDetectorCells( var->getPointer(), tags->getPointer(), temp_tags->getPointer()); } - } - - if (ref == "DENSITY_SHOCK" || ref == "PRESSURE_SHOCK") { + } else if (ref == "DENSITY_SHOCK" || ref == "PRESSURE_SHOCK") { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectshock2d, DETECTSHOCK2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2637,7 +2623,7 @@ void Euler::tagGradientDetectorCells( var->getPointer(), tags->getPointer(), temp_tags->getPointer()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectshock3d, DETECTSHOCK3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), @@ -2660,8 +2646,9 @@ void Euler::tagGradientDetectorCells( * Adjust temp_tags from those tags set in Richardson extrapolation. */ if (uses_richardson_extrapolation_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*temp_tags)(*ic, 0) = TRUE; @@ -2672,8 +2659,9 @@ void Euler::tagGradientDetectorCells( /* * Update tags */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2704,16 +2692,18 @@ void Euler::tagRichardsonExtrapolationCells( NULL_USE(initial_error); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* xdomainlo = d_grid_geometry->getXLower(); const double* xdomainhi = d_grid_geometry->getXUpper(); hier::Box pbox = patch.getBox(); boost::shared_ptr > tags( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); /* * Possible tagging criteria includes @@ -2724,7 +2714,8 @@ void Euler::tagRichardsonExtrapolationCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > coarsened_fine_var; @@ -2735,42 +2726,40 @@ void Euler::tagRichardsonExtrapolationCells( if (ref == "DENSITY_RICHARDSON") { coarsened_fine_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_density, coarsened_fine)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, coarsened_fine)); advanced_coarse_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_density, advanced_coarse)); - size = d_density_rich_tol.getSize(); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, advanced_coarse)); + size = static_cast(d_density_rich_tol.size()); tol = ((error_level_number < size) ? d_density_rich_tol[error_level_number] : d_density_rich_tol[size - 1]); - size = d_density_rich_time_min.getSize(); + size = static_cast(d_density_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_density_rich_time_min[error_level_number] : d_density_rich_time_min[size - 1]); - size = d_density_rich_time_max.getSize(); + size = static_cast(d_density_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_density_rich_time_max[error_level_number] : d_density_rich_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_RICHARDSON") { + } else if (ref == "PRESSURE_RICHARDSON") { coarsened_fine_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_pressure, coarsened_fine)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, coarsened_fine)); advanced_coarse_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_pressure, advanced_coarse)); - size = d_pressure_rich_tol.getSize(); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, advanced_coarse)); + size = static_cast(d_pressure_rich_tol.size()); tol = ((error_level_number < size) ? d_pressure_rich_tol[error_level_number] : d_pressure_rich_tol[size - 1]); - size = d_pressure_rich_time_min.getSize(); + size = static_cast(d_pressure_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_rich_time_min[error_level_number] : d_pressure_rich_time_min[size - 1]); - size = d_pressure_rich_time_max.getSize(); + size = static_cast(d_pressure_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_rich_time_max[error_level_number] : d_pressure_rich_time_max[size - 1]); @@ -2779,10 +2768,8 @@ void Euler::tagRichardsonExtrapolationCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(coarsened_fine_var); TBOX_ASSERT(advanced_coarse_var); -#endif if (ref == "DENSITY_RICHARDSON" || ref == "PRESSURE_RICHARDSON") { @@ -2806,7 +2793,7 @@ void Euler::tagRichardsonExtrapolationCells( const double* dx = patch_geom->getDx(); double max_dx = 0.; double max_length = 0.; - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { max_dx = tbox::MathUtilities::Max(max_dx, dx[idir]); double length = xdomainhi[idir] - xdomainlo[idir]; max_length = @@ -2833,8 +2820,9 @@ void Euler::tagRichardsonExtrapolationCells( double diff = 0.; double error = 0.; - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { /* * Compute error norm @@ -2876,8 +2864,9 @@ void Euler::tagRichardsonExtrapolationCells( * use this information in the gradient detector. */ if (!uses_gradient_detector_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*tags)(*ic, 0) = TRUE; @@ -2902,9 +2891,7 @@ void Euler::tagRichardsonExtrapolationCells( void Euler::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -2923,32 +2910,31 @@ bool Euler::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { -#ifdef DEBUG_CHECK_ASSERTIONS + NULL_USE(simulation_time); + TBOX_ASSERT((region * patch.getBox()).isSpatiallyEqual(region)); -#endif bool data_on_patch = FALSE; boost::shared_ptr > density( - patch.getPatchData(d_density, d_plot_context), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, d_plot_context))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, d_plot_context), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, d_plot_context))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, d_plot_context), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, d_plot_context))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); TBOX_ASSERT(density->getGhostBox().isSpatiallyEqual(patch.getBox())); TBOX_ASSERT(velocity->getGhostBox().isSpatiallyEqual(patch.getBox())); TBOX_ASSERT(pressure->getGhostBox().isSpatiallyEqual(patch.getBox())); -#endif const hier::Box& data_box = density->getGhostBox(); const int box_w0 = region.numberCells(0); @@ -2963,19 +2949,19 @@ bool Euler::packDerivedDataIntoDoubleBuffer( const double * const dens = density->getPointer(); const double * const xvel = velocity->getPointer(0); const double * const yvel = velocity->getPointer(1); - const double * const zvel = d_dim > tbox::Dimension(2) ? velocity->getPointer(2) : NULL; + const double * const zvel = d_dim > tbox::Dimension(2) ? velocity->getPointer(2) : 0; const double * const pres = pressure->getPointer(); double valinv = 1.0 / (d_gamma - 1.0); int buf_b1 = 0; - int dat_b2 = data_box.offset(region.lower()); + size_t dat_b2 = data_box.offset(region.lower()); if (d_dim > tbox::Dimension(2)) { - for (int i2 = 0; i2 < box_w2; i2++) { - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; + for (int i2 = 0; i2 < box_w2; ++i2) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; double v2norm = pow(xvel[dat_indx], 2.0) + pow(yvel[dat_indx], 2.0) + pow(zvel[dat_indx], 2.0) @@ -2996,10 +2982,10 @@ bool Euler::packDerivedDataIntoDoubleBuffer( } if (d_dim == tbox::Dimension(2)) { - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; double v2norm = pow(xvel[dat_indx], 2.0) + pow(yvel[dat_indx], 2.0) ; @@ -3019,20 +3005,18 @@ bool Euler::packDerivedDataIntoDoubleBuffer( data_on_patch = TRUE; } else if (variable_name == "Momentum") { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(depth_id < d_dim.getValue()); -#endif const double * const dens = density->getPointer(); const double * const vel = velocity->getPointer(depth_id); int buf_b1 = 0; - int dat_b2 = data_box.offset(region.lower()); + size_t dat_b2 = data_box.offset(region.lower()); if (d_dim == tbox::Dimension(2)) { - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; dbuffer[buf_b1 + i0] = dens[dat_indx] * vel[dat_indx]; } dat_b1 += dat_w0; @@ -3040,11 +3024,11 @@ bool Euler::packDerivedDataIntoDoubleBuffer( } } if (d_dim == tbox::Dimension(3)) { - for (int i2 = 0; i2 < box_w2; i2++) { - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; + for (int i2 = 0; i2 < box_w2; ++i2) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; dbuffer[buf_b1 + i0] = dens[dat_indx] * vel[dat_indx]; } dat_b1 += dat_w0; @@ -3077,7 +3061,7 @@ bool Euler::packDerivedDataIntoDoubleBuffer( void Euler::writeData1dPencil( const boost::shared_ptr patch, const hier::Box& pencil_box, - const int idir, + const tbox::Dimension::dir_t idir, ostream& file) { @@ -3087,24 +3071,23 @@ void Euler::writeData1dPencil( if (!box.empty()) { boost::shared_ptr > density( - patch->getPatchData(d_density, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch->getPatchData(d_velocity, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch->getPatchData(d_pressure, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif const boost::shared_ptr pgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* xlo = pgeom->getXLower(); @@ -3116,10 +3099,11 @@ void Euler::writeData1dPencil( double valinv = 1.0 / (d_gamma - 1.0); int ccount = 0; - pdat::CellIterator icend(box, false); - for (pdat::CellIterator ic(box, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(box)); + ic != icend; ++ic) { file << cell_center + ccount * dx[idir] << " "; - ccount++; + ++ccount; double rho = (*density)(*ic, 0); double vel = (*velocity)(*ic, idir); @@ -3189,46 +3173,46 @@ void Euler::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_density_inside = " << d_density_inside << endl; os << " d_velocity_inside = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_velocity_inside[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_velocity_inside[j] << " "; os << endl; os << " d_pressure_inside = " << d_pressure_inside << endl; os << " d_density_outside = " << d_density_outside << endl; os << " d_velocity_outside = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_velocity_outside[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_velocity_outside[j] << " "; os << endl; os << " d_pressure_outside = " << d_pressure_outside << endl; os << " d_number_of_intervals = " << d_number_of_intervals << endl; os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { + for (k = 0; k < d_number_of_intervals - 1; ++k) { os << d_front_position[k] << " "; } os << endl; os << " d_interval_density = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_density[k] << endl; } os << " d_interval_velocity = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " "; - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { os << d_interval_velocity[k * d_dim.getValue() + j] << " "; } os << endl; } os << " d_interval_pressure = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_pressure[k] << endl; } os << " Boundary condition data " << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { os << "\n d_master_bdry_edge_conds[" << j << "] = " << d_master_bdry_edge_conds[j] << endl; os << " d_scalar_bdry_edge_conds[" << j << "] = " @@ -3246,7 +3230,7 @@ void Euler::printClassData( } } os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { os << "\n d_master_bdry_node_conds[" << j << "] = " << d_master_bdry_node_conds[j] << endl; os << " d_scalar_bdry_node_conds[" << j << "] = " @@ -3258,7 +3242,7 @@ void Euler::printClassData( } } if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_master_bdry_face_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_face_conds.size()); ++j) { os << "\n d_master_bdry_face_conds[" << j << "] = " << d_master_bdry_face_conds[j] << endl; os << " d_scalar_bdry_face_conds[" << j << "] = " @@ -3277,7 +3261,7 @@ void Euler::printClassData( } } os << endl; - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { os << "\n d_master_bdry_edge_conds[" << j << "] = " << d_master_bdry_edge_conds[j] << endl; os << " d_scalar_bdry_edge_conds[" << j << "] = " @@ -3288,7 +3272,7 @@ void Euler::printClassData( << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { os << "\n d_master_bdry_node_conds[" << j << "] = " << d_master_bdry_node_conds[j] << endl; os << " d_scalar_bdry_node_conds[" << j << "] = " @@ -3302,148 +3286,148 @@ void Euler::printClassData( os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_tol.size()); ++j) { os << " d_density_dev_tol[" << j << "] = " << d_density_dev_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev.size()); ++j) { os << " d_density_dev[" << j << "] = " << d_density_dev[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_time_max.size()); ++j) { os << " d_density_dev_time_max[" << j << "] = " << d_density_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_time_min.size()); ++j) { os << " d_density_dev_time_min[" << j << "] = " << d_density_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_tol.size()); ++j) { os << " d_density_grad_tol[" << j << "] = " << d_density_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_time_max.size()); ++j) { os << " d_density_grad_time_max[" << j << "] = " << d_density_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_time_min.size()); ++j) { os << " d_density_grad_time_min[" << j << "] = " << d_density_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_onset.size()); ++j) { os << " d_density_shock_onset[" << j << "] = " << d_density_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_tol.size()); ++j) { os << " d_density_shock_tol[" << j << "] = " << d_density_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_time_max.size()); ++j) { os << " d_density_shock_time_max[" << j << "] = " << d_density_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_time_min.size()); ++j) { os << " d_density_shock_time_min[" << j << "] = " << d_density_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_tol.size()); ++j) { os << " d_density_rich_tol[" << j << "] = " << d_density_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_time_max.size()); ++j) { os << " d_density_rich_time_max[" << j << "] = " << d_density_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_time_min.size()); ++j) { os << " d_density_rich_time_min[" << j << "] = " << d_density_rich_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_tol.size()); ++j) { os << " d_pressure_dev_tol[" << j << "] = " << d_pressure_dev_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev.size()); ++j) { os << " d_pressure_dev[" << j << "] = " << d_pressure_dev[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_time_max.size()); ++j) { os << " d_pressure_dev_time_max[" << j << "] = " << d_pressure_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_time_min.size()); ++j) { os << " d_pressure_dev_time_min[" << j << "] = " << d_pressure_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_tol.size()); ++j) { os << " d_pressure_grad_tol[" << j << "] = " << d_pressure_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_time_max.size()); ++j) { os << " d_pressure_grad_time_max[" << j << "] = " << d_pressure_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_time_min.size()); ++j) { os << " d_pressure_grad_time_min[" << j << "] = " << d_pressure_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_onset.size()); ++j) { os << " d_pressure_shock_onset[" << j << "] = " << d_pressure_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_tol.size()); ++j) { os << " d_pressure_shock_tol[" << j << "] = " << d_pressure_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_time_max.size()); ++j) { os << " d_pressure_shock_time_max[" << j << "] = " << d_pressure_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_time_min.size()); ++j) { os << " d_pressure_shock_time_min[" << j << "] = " << d_pressure_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_tol.size()); ++j) { os << " d_pressure_rich_tol[" << j << "] = " << d_pressure_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_time_max.size()); ++j) { os << " d_pressure_rich_time_max[" << j << "] = " << d_pressure_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_time_min.size()); ++j) { os << " d_pressure_rich_time_min[" << j << "] = " << d_pressure_rich_time_min[j] << endl; } @@ -3461,12 +3445,10 @@ void Euler::printClassData( */ void Euler::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); /* * Note: if we are restarting, then we only allow nonuniform @@ -3474,21 +3456,21 @@ void Euler::getFromInput( */ if (!is_from_restart) { d_use_nonuniform_workload = - db->getBoolWithDefault("use_nonuniform_workload", + input_db->getBoolWithDefault("use_nonuniform_workload", d_use_nonuniform_workload); } else { if (d_use_nonuniform_workload) { d_use_nonuniform_workload = - db->getBool("use_nonuniform_workload"); + input_db->getBool("use_nonuniform_workload"); } } if (!is_from_restart) { - d_gamma = db->getDoubleWithDefault("gamma", d_gamma); + d_gamma = input_db->getDoubleWithDefault("gamma", d_gamma); } - if (db->keyExists("riemann_solve")) { - d_riemann_solve = db->getString("riemann_solve"); + if (input_db->keyExists("riemann_solve")) { + d_riemann_solve = input_db->getString("riemann_solve"); if ((d_riemann_solve != "APPROX_RIEM_SOLVE") && (d_riemann_solve != "EXACT_RIEM_SOLVE") && (d_riemann_solve != "HLLC_RIEM_SOLVE")) { @@ -3500,12 +3482,12 @@ void Euler::getFromInput( } } else { - d_riemann_solve = db->getStringWithDefault("d_riemann_solve", + d_riemann_solve = input_db->getStringWithDefault("d_riemann_solve", d_riemann_solve); } - if (db->keyExists("godunov_order")) { - d_godunov_order = db->getInteger("godunov_order"); + if (input_db->keyExists("godunov_order")) { + d_godunov_order = input_db->getInteger("godunov_order"); if ((d_godunov_order != 1) && (d_godunov_order != 2) && (d_godunov_order != 4)) { @@ -3515,12 +3497,12 @@ void Euler::getFromInput( } } else { - d_godunov_order = db->getIntegerWithDefault("d_godunov_order", + d_godunov_order = input_db->getIntegerWithDefault("d_godunov_order", d_godunov_order); } - if (db->keyExists("corner_transport")) { - d_corner_transport = db->getString("corner_transport"); + if (input_db->keyExists("corner_transport")) { + d_corner_transport = input_db->getString("corner_transport"); if ((d_corner_transport != "CORNER_TRANSPORT_1") && (d_corner_transport != "CORNER_TRANSPORT_2")) { TBOX_ERROR( @@ -3529,19 +3511,18 @@ void Euler::getFromInput( << " 'CORNER_TRANSPORT_1' or 'CORNER_TRANSPORT_2'." << endl); } } else { - d_corner_transport = db->getStringWithDefault("corner_transport", + d_corner_transport = input_db->getStringWithDefault("corner_transport", d_corner_transport); } - if (db->keyExists("Refinement_data")) { + if (input_db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( - db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + input_db->getDatabase("Refinement_data")); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -3549,10 +3530,10 @@ void Euler::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -3575,14 +3556,13 @@ void Euler::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } if (error_db && error_key == "DENSITY_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_density_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_density_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3591,8 +3571,7 @@ void Euler::getFromInput( } if (error_db->keyExists("density_dev")) { - d_density_dev = - error_db->getDoubleArray("density_dev"); + d_density_dev = error_db->getDoubleVector("density_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -3602,18 +3581,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_dev_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_dev_time_max.resizeArray(1); + d_density_dev_time_max.resize(1); d_density_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_dev_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_dev_time_min.resizeArray(1); + d_density_dev_time_min.resize(1); d_density_dev_time_min[0] = 0.; } @@ -3622,8 +3601,7 @@ void Euler::getFromInput( if (error_db && error_key == "DENSITY_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_density_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_density_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3633,18 +3611,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_grad_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_grad_time_max.resizeArray(1); + d_density_grad_time_max.resize(1); d_density_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_grad_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_grad_time_min.resizeArray(1); + d_density_grad_time_min.resize(1); d_density_grad_time_min[0] = 0.; } @@ -3654,7 +3632,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_onset")) { d_density_shock_onset = - error_db->getDoubleArray("shock_onset"); + error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -3663,8 +3641,7 @@ void Euler::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_density_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_density_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3674,18 +3651,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_shock_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_shock_time_max.resizeArray(1); + d_density_shock_time_max.resize(1); d_density_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_shock_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_shock_time_min.resizeArray(1); + d_density_shock_time_min.resize(1); d_density_shock_time_min[0] = 0.; } @@ -3694,8 +3671,7 @@ void Euler::getFromInput( if (error_db && error_key == "DENSITY_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_density_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_density_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3705,18 +3681,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_rich_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_rich_time_max.resizeArray(1); + d_density_rich_time_max.resize(1); d_density_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_rich_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_rich_time_min.resizeArray(1); + d_density_rich_time_min.resize(1); d_density_rich_time_min[0] = 0.; } @@ -3725,8 +3701,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_pressure_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_pressure_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3735,8 +3710,7 @@ void Euler::getFromInput( } if (error_db->keyExists("pressure_dev")) { - d_pressure_dev = - error_db->getDoubleArray("pressure_dev"); + d_pressure_dev = error_db->getDoubleVector("pressure_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -3746,18 +3720,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_dev_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_dev_time_max.resizeArray(1); + d_pressure_dev_time_max.resize(1); d_pressure_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_dev_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_dev_time_min.resizeArray(1); + d_pressure_dev_time_min.resize(1); d_pressure_dev_time_min[0] = 0.; } @@ -3766,8 +3740,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_pressure_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_pressure_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3777,18 +3750,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_grad_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_grad_time_max.resizeArray(1); + d_pressure_grad_time_max.resize(1); d_pressure_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_grad_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_grad_time_min.resizeArray(1); + d_pressure_grad_time_min.resize(1); d_pressure_grad_time_min[0] = 0.; } @@ -3798,7 +3771,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_onset")) { d_pressure_shock_onset = - error_db->getDoubleArray("shock_onset"); + error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -3808,7 +3781,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_tol")) { d_pressure_shock_tol = - error_db->getDoubleArray("shock_tol"); + error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3818,18 +3791,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_shock_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_shock_time_max.resizeArray(1); + d_pressure_shock_time_max.resize(1); d_pressure_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_shock_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_shock_time_min.resizeArray(1); + d_pressure_shock_time_min.resize(1); d_pressure_shock_time_min[0] = 0.; } @@ -3838,8 +3811,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_pressure_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_pressure_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3849,18 +3821,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_rich_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_rich_time_max.resizeArray(1); + d_pressure_rich_time_max.resize(1); d_pressure_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_rich_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_rich_time_min.resizeArray(1); + d_pressure_rich_time_min.resize(1); d_pressure_rich_time_min[0] = 0.; } @@ -3873,10 +3845,11 @@ void Euler::getFromInput( /* * Check that input is found for each string identifier in key list. */ - for (int k0 = 0; k0 < d_refinement_criteria.getSize(); k0++) { + for (int k0 = 0; + k0 < static_cast(d_refinement_criteria.size()); ++k0) { string use_key = d_refinement_criteria[k0]; bool key_found = false; - for (int k1 = 0; k1 < def_key_cnt; k1++) { + for (int k1 = 0; k1 < def_key_cnt; ++k1) { string def_key = ref_keys_defined[k1]; if (def_key == use_key) key_found = true; } @@ -3892,8 +3865,8 @@ void Euler::getFromInput( if (!is_from_restart) { - if (db->keyExists("data_problem")) { - d_data_problem = db->getString("data_problem"); + if (input_db->keyExists("data_problem")) { + d_data_problem = input_db->getString("data_problem"); } else { TBOX_ERROR( d_object_name << ": " @@ -3901,13 +3874,13 @@ void Euler::getFromInput( << endl); } - if (!db->keyExists("Initial_data")) { + if (!input_db->keyExists("Initial_data")) { TBOX_ERROR( d_object_name << ": " << "No `Initial_data' database found in input." << endl); } boost::shared_ptr init_data_db( - db->getDatabase("Initial_data")); + input_db->getDatabase("Initial_data")); bool found_problem_data = false; @@ -3999,10 +3972,10 @@ void Euler::getFromInput( idir = 2; } - tbox::Array init_data_keys = init_data_db->getAllKeys(); + std::vector init_data_keys = init_data_db->getAllKeys(); if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); + d_front_position = init_data_db->getDoubleVector("front_position"); } else { TBOX_ERROR(d_object_name << ": " << "`front_position' input required for " @@ -4010,16 +3983,16 @@ void Euler::getFromInput( } d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); + tbox::MathUtilities::Min(static_cast(d_front_position.size()) + 1, + static_cast(init_data_keys.size()) - 1); - d_front_position.resizeArray(d_front_position.getSize() + 1); - d_front_position[d_front_position.getSize() - 1] = + d_front_position.resize(static_cast(d_front_position.size()) + 1); + d_front_position[static_cast(d_front_position.size()) - 1] = d_grid_geometry->getXUpper()[idir]; - d_interval_density.resizeArray(d_number_of_intervals); - d_interval_velocity.resizeArray(d_number_of_intervals * d_dim.getValue()); - d_interval_pressure.resizeArray(d_number_of_intervals); + d_interval_density.resize(d_number_of_intervals); + d_interval_velocity.resize(d_number_of_intervals * d_dim.getValue()); + d_interval_pressure.resize(d_number_of_intervals); int i = 0; int nkey = 0; @@ -4027,7 +4000,7 @@ void Euler::getFromInput( while (!found_interval_data && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { + && (nkey < static_cast(init_data_keys.size()))) { if (!(init_data_keys[nkey] == "front_position")) { @@ -4041,13 +4014,13 @@ void Euler::getFromInput( d_interval_velocity, d_interval_pressure); - i++; + ++i; found_interval_data = (i == d_number_of_intervals); } - nkey++; + ++nkey; } @@ -4073,26 +4046,26 @@ void Euler::getFromInput( const hier::IntVector& one_vec = hier::IntVector::getOne(d_dim); hier::IntVector periodic = d_grid_geometry->getPeriodicShift(one_vec); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < d_dim.getValue()) { - if (db->keyExists("Boundary_data")) { + if (input_db->keyExists("Boundary_data")) { - boost::shared_ptr bdry_db = db->getDatabase( + boost::shared_ptr bdry_db = input_db->getDatabase( "Boundary_data"); if (d_dim == tbox::Dimension(2)) { - appu::CartesianBoundaryUtilities2::readBoundaryInput(this, + appu::CartesianBoundaryUtilities2::getFromInput(this, bdry_db, d_master_bdry_edge_conds, d_master_bdry_node_conds, periodic); } if (d_dim == tbox::Dimension(3)) { - appu::CartesianBoundaryUtilities3::readBoundaryInput(this, + appu::CartesianBoundaryUtilities3::getFromInput(this, bdry_db, d_master_bdry_face_conds, d_master_bdry_edge_conds, @@ -4118,148 +4091,162 @@ void Euler::getFromInput( ************************************************************************* */ -void Euler::putToDatabase( - const boost::shared_ptr& db) const +void Euler::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("EULER_VERSION", EULER_VERSION); + restart_db->putInteger("EULER_VERSION", EULER_VERSION); - db->putDouble("d_gamma", d_gamma); + restart_db->putDouble("d_gamma", d_gamma); - db->putString("d_riemann_solve", d_riemann_solve); - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); + restart_db->putString("d_riemann_solve", d_riemann_solve); + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, d_dim.getValue()); - db->putDouble("d_density_inside", d_density_inside); - db->putDoubleArray("d_velocity_inside", d_velocity_inside, d_dim.getValue()); - db->putDouble("d_pressure_inside", d_pressure_inside); - db->putDouble("d_density_outside", d_density_outside); - db->putDoubleArray("d_velocity_outside", d_velocity_outside, d_dim.getValue()); - db->putDouble("d_pressure_outside", d_pressure_outside); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleArray("d_center", d_center, d_dim.getValue()); + restart_db->putDouble("d_density_inside", d_density_inside); + restart_db->putDoubleArray("d_velocity_inside", + d_velocity_inside, + d_dim.getValue()); + restart_db->putDouble("d_pressure_inside", d_pressure_inside); + restart_db->putDouble("d_density_outside", d_density_outside); + restart_db->putDoubleArray("d_velocity_outside", + d_velocity_outside, + d_dim.getValue()); + restart_db->putDouble("d_pressure_outside", d_pressure_outside); } if ((d_data_problem == "PIECEWISE_CONSTANT_X") || (d_data_problem == "PIECEWISE_CONSTANT_Y") || (d_data_problem == "PIECEWISE_CONSTANT_Z") || (d_data_problem == "STEP")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); + restart_db->putInteger("d_number_of_intervals", d_number_of_intervals); if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_density", d_interval_density); - db->putDoubleArray("d_interval_velocity", d_interval_velocity); - db->putDoubleArray("d_interval_pressure", d_interval_pressure); + restart_db->putDoubleVector("d_front_position", d_front_position); + restart_db->putDoubleVector("d_interval_density", d_interval_density); + restart_db->putDoubleVector("d_interval_velocity", d_interval_velocity); + restart_db->putDoubleVector("d_interval_pressure", d_interval_pressure); } } - db->putIntegerArray("d_master_bdry_edge_conds", d_master_bdry_edge_conds); - db->putIntegerArray("d_master_bdry_node_conds", d_master_bdry_node_conds); + restart_db->putIntegerVector("d_master_bdry_edge_conds", + d_master_bdry_edge_conds); + restart_db->putIntegerVector("d_master_bdry_node_conds", + d_master_bdry_node_conds); if (d_dim == tbox::Dimension(2)) { - db->putDoubleArray("d_bdry_edge_density", d_bdry_edge_density); - db->putDoubleArray("d_bdry_edge_velocity", d_bdry_edge_velocity); - db->putDoubleArray("d_bdry_edge_pressure", d_bdry_edge_pressure); + restart_db->putDoubleVector("d_bdry_edge_density", + d_bdry_edge_density); + restart_db->putDoubleVector("d_bdry_edge_velocity", + d_bdry_edge_velocity); + restart_db->putDoubleVector("d_bdry_edge_pressure", + d_bdry_edge_pressure); } if (d_dim == tbox::Dimension(3)) { - db->putIntegerArray("d_master_bdry_face_conds", d_master_bdry_face_conds); + restart_db->putIntegerVector("d_master_bdry_face_conds", + d_master_bdry_face_conds); - db->putDoubleArray("d_bdry_face_density", d_bdry_face_density); - db->putDoubleArray("d_bdry_face_velocity", d_bdry_face_velocity); - db->putDoubleArray("d_bdry_face_pressure", d_bdry_face_pressure); + restart_db->putDoubleVector("d_bdry_face_density", + d_bdry_face_density); + restart_db->putDoubleVector("d_bdry_face_velocity", + d_bdry_face_velocity); + restart_db->putDoubleVector("d_bdry_face_pressure", + d_bdry_face_pressure); } - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "DENSITY_DEVIATION") { - db->putDoubleArray("d_density_dev_tol", + restart_db->putDoubleVector("d_density_dev_tol", d_density_dev_tol); - db->putDoubleArray("d_density_dev", + restart_db->putDoubleVector("d_density_dev", d_density_dev); - db->putDoubleArray("d_density_dev_time_max", + restart_db->putDoubleVector("d_density_dev_time_max", d_density_dev_time_max); - db->putDoubleArray("d_density_dev_time_min", + restart_db->putDoubleVector("d_density_dev_time_min", d_density_dev_time_min); } else if (d_refinement_criteria[i] == "DENSITY_GRADIENT") { - db->putDoubleArray("d_density_grad_tol", + restart_db->putDoubleVector("d_density_grad_tol", d_density_grad_tol); - db->putDoubleArray("d_density_grad_time_max", + restart_db->putDoubleVector("d_density_grad_time_max", d_density_grad_time_max); - db->putDoubleArray("d_density_grad_time_min", + restart_db->putDoubleVector("d_density_grad_time_min", d_density_grad_time_min); } else if (d_refinement_criteria[i] == "DENSITY_SHOCK") { - db->putDoubleArray("d_density_shock_onset", + restart_db->putDoubleVector("d_density_shock_onset", d_density_shock_onset); - db->putDoubleArray("d_density_shock_tol", + restart_db->putDoubleVector("d_density_shock_tol", d_density_shock_tol); - db->putDoubleArray("d_density_shock_time_max", + restart_db->putDoubleVector("d_density_shock_time_max", d_density_shock_time_max); - db->putDoubleArray("d_density_shock_time_min", + restart_db->putDoubleVector("d_density_shock_time_min", d_density_shock_time_min); } else if (d_refinement_criteria[i] == "DENSITY_RICHARDSON") { - db->putDoubleArray("d_density_rich_tol", + restart_db->putDoubleVector("d_density_rich_tol", d_density_rich_tol); - db->putDoubleArray("d_density_rich_time_max", + restart_db->putDoubleVector("d_density_rich_time_max", d_density_rich_time_max); - db->putDoubleArray("d_density_rich_time_min", + restart_db->putDoubleVector("d_density_rich_time_min", d_density_rich_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_DEVIATION") { - db->putDoubleArray("d_pressure_dev_tol", + restart_db->putDoubleVector("d_pressure_dev_tol", d_pressure_dev_tol); - db->putDoubleArray("d_pressure_dev", + restart_db->putDoubleVector("d_pressure_dev", d_pressure_dev); - db->putDoubleArray("d_pressure_dev_time_max", + restart_db->putDoubleVector("d_pressure_dev_time_max", d_pressure_dev_time_max); - db->putDoubleArray("d_pressure_dev_time_min", + restart_db->putDoubleVector("d_pressure_dev_time_min", d_pressure_dev_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_GRADIENT") { - db->putDoubleArray("d_pressure_grad_tol", + restart_db->putDoubleVector("d_pressure_grad_tol", d_pressure_grad_tol); - db->putDoubleArray("d_pressure_grad_time_max", + restart_db->putDoubleVector("d_pressure_grad_time_max", d_pressure_grad_time_max); - db->putDoubleArray("d_pressure_grad_time_min", + restart_db->putDoubleVector("d_pressure_grad_time_min", d_pressure_grad_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_SHOCK") { - db->putDoubleArray("d_pressure_shock_onset", + restart_db->putDoubleVector("d_pressure_shock_onset", d_pressure_shock_onset); - db->putDoubleArray("d_pressure_shock_tol", + restart_db->putDoubleVector("d_pressure_shock_tol", d_pressure_shock_tol); - db->putDoubleArray("d_pressure_shock_time_max", + restart_db->putDoubleVector("d_pressure_shock_time_max", d_pressure_shock_time_max); - db->putDoubleArray("d_pressure_shock_time_min", + restart_db->putDoubleVector("d_pressure_shock_time_min", d_pressure_shock_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_RICHARDSON") { - db->putDoubleArray("d_pressure_rich_tol", + restart_db->putDoubleVector("d_pressure_rich_tol", d_pressure_rich_tol); - db->putDoubleArray("d_pressure_rich_time_max", + restart_db->putDoubleVector("d_pressure_rich_time_max", d_pressure_rich_time_max); - db->putDoubleArray("d_pressure_rich_time_min", + restart_db->putDoubleVector("d_pressure_rich_time_min", d_pressure_rich_time_min); } @@ -4294,7 +4281,7 @@ void Euler::getFromRestart() int* tmp_nghosts = &d_nghosts[0]; db->getIntegerArray("d_nghosts", tmp_nghosts, d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { if (d_nghosts(i) != CELLG) { TBOX_ERROR( d_object_name << ": " @@ -4303,7 +4290,7 @@ void Euler::getFromRestart() } int* tmp_fluxghosts = &d_fluxghosts[0]; db->getIntegerArray("d_fluxghosts", tmp_fluxghosts, d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { if (d_fluxghosts(i) != FLUXG) { TBOX_ERROR( d_object_name << ": " @@ -4330,114 +4317,115 @@ void Euler::getFromRestart() (d_data_problem == "STEP")) { d_number_of_intervals = db->getInteger("d_number_of_intervals"); if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_density = db->getDoubleArray("d_interval_density"); - d_interval_velocity = db->getDoubleArray("d_interval_velocity"); - d_interval_pressure = db->getDoubleArray("d_interval_pressure"); + d_front_position = db->getDoubleVector("d_front_position"); + d_interval_density = db->getDoubleVector("d_interval_density"); + d_interval_velocity = db->getDoubleVector("d_interval_velocity"); + d_interval_pressure = db->getDoubleVector("d_interval_pressure"); } } - d_master_bdry_edge_conds = db->getIntegerArray("d_master_bdry_edge_conds"); - d_master_bdry_node_conds = db->getIntegerArray("d_master_bdry_node_conds"); + d_master_bdry_edge_conds = db->getIntegerVector("d_master_bdry_edge_conds"); + d_master_bdry_node_conds = db->getIntegerVector("d_master_bdry_node_conds"); if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_density = db->getDoubleArray("d_bdry_edge_density"); - d_bdry_edge_velocity = db->getDoubleArray("d_bdry_edge_velocity"); - d_bdry_edge_pressure = db->getDoubleArray("d_bdry_edge_pressure"); + d_bdry_edge_density = db->getDoubleVector("d_bdry_edge_density"); + d_bdry_edge_velocity = db->getDoubleVector("d_bdry_edge_velocity"); + d_bdry_edge_pressure = db->getDoubleVector("d_bdry_edge_pressure"); } if (d_dim == tbox::Dimension(3)) { - d_master_bdry_face_conds = db->getIntegerArray("d_master_bdry_face_conds"); + d_master_bdry_face_conds = + db->getIntegerVector("d_master_bdry_face_conds"); - d_bdry_face_density = db->getDoubleArray("d_bdry_face_density"); - d_bdry_face_velocity = db->getDoubleArray("d_bdry_face_velocity"); - d_bdry_face_pressure = db->getDoubleArray("d_bdry_face_pressure"); + d_bdry_face_density = db->getDoubleVector("d_bdry_face_density"); + d_bdry_face_velocity = db->getDoubleVector("d_bdry_face_velocity"); + d_bdry_face_pressure = db->getDoubleVector("d_bdry_face_pressure"); } if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "DENSITY_DEVIATION") { d_density_dev_tol = - db->getDoubleArray("d_density_dev_tol"); + db->getDoubleVector("d_density_dev_tol"); d_density_dev = - db->getDoubleArray("d_density_dev"); + db->getDoubleVector("d_density_dev"); d_density_dev_time_max = - db->getDoubleArray("d_density_dev_time_max"); + db->getDoubleVector("d_density_dev_time_max"); d_density_dev_time_min = - db->getDoubleArray("d_density_dev_time_min"); + db->getDoubleVector("d_density_dev_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_GRADIENT") { d_density_grad_tol = - db->getDoubleArray("d_density_grad_tol"); + db->getDoubleVector("d_density_grad_tol"); d_density_grad_time_max = - db->getDoubleArray("d_density_grad_time_max"); + db->getDoubleVector("d_density_grad_time_max"); d_density_grad_time_min = - db->getDoubleArray("d_density_grad_time_min"); + db->getDoubleVector("d_density_grad_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_SHOCK") { d_density_shock_onset = - db->getDoubleArray("d_density_shock_onset"); + db->getDoubleVector("d_density_shock_onset"); d_density_shock_tol = - db->getDoubleArray("d_density_shock_tol"); + db->getDoubleVector("d_density_shock_tol"); d_density_shock_time_max = - db->getDoubleArray("d_density_shock_time_max"); + db->getDoubleVector("d_density_shock_time_max"); d_density_shock_time_min = - db->getDoubleArray("d_density_shock_time_min"); + db->getDoubleVector("d_density_shock_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_RICHARDSON") { d_density_rich_tol = - db->getDoubleArray("d_density_rich_tol"); + db->getDoubleVector("d_density_rich_tol"); d_density_rich_time_max = - db->getDoubleArray("d_density_rich_time_max"); + db->getDoubleVector("d_density_rich_time_max"); d_density_rich_time_min = - db->getDoubleArray("d_density_rich_time_min"); + db->getDoubleVector("d_density_rich_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_DEVIATION") { d_pressure_dev_tol = - db->getDoubleArray("d_pressure_dev_tol"); + db->getDoubleVector("d_pressure_dev_tol"); d_pressure_dev = - db->getDoubleArray("d_pressure_dev"); + db->getDoubleVector("d_pressure_dev"); d_pressure_dev_time_max = - db->getDoubleArray("d_pressure_dev_time_max"); + db->getDoubleVector("d_pressure_dev_time_max"); d_pressure_dev_time_min = - db->getDoubleArray("d_pressure_dev_time_min"); + db->getDoubleVector("d_pressure_dev_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_GRADIENT") { d_pressure_grad_tol = - db->getDoubleArray("d_pressure_grad_tol"); + db->getDoubleVector("d_pressure_grad_tol"); d_pressure_grad_time_max = - db->getDoubleArray("d_pressure_grad_time_max"); + db->getDoubleVector("d_pressure_grad_time_max"); d_pressure_grad_time_min = - db->getDoubleArray("d_pressure_grad_time_min"); + db->getDoubleVector("d_pressure_grad_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_SHOCK") { d_pressure_shock_onset = - db->getDoubleArray("d_pressure_shock_onset"); + db->getDoubleVector("d_pressure_shock_onset"); d_pressure_shock_tol = - db->getDoubleArray("d_pressure_shock_tol"); + db->getDoubleVector("d_pressure_shock_tol"); d_pressure_shock_time_max = - db->getDoubleArray("d_pressure_shock_time_max"); + db->getDoubleVector("d_pressure_shock_time_max"); d_pressure_shock_time_min = - db->getDoubleArray("d_pressure_shock_time_min"); + db->getDoubleVector("d_pressure_shock_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_RICHARDSON") { d_pressure_rich_tol = - db->getDoubleArray("d_pressure_rich_tol"); + db->getDoubleVector("d_pressure_rich_tol"); d_pressure_rich_time_max = - db->getDoubleArray("d_pressure_rich_time_max"); + db->getDoubleVector("d_pressure_rich_time_max"); d_pressure_rich_time_min = - db->getDoubleArray("d_pressure_rich_time_min"); + db->getDoubleVector("d_pressure_rich_time_min"); } @@ -4458,10 +4446,9 @@ void Euler::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, @@ -4494,18 +4481,16 @@ void Euler::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& density, - tbox::Array& velocity, - tbox::Array& pressure) + std::vector& density, + std::vector& velocity, + std::vector& pressure) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(density.getSize() > array_indx); - TBOX_ASSERT(velocity.getSize() > array_indx * d_dim.getValue()); - TBOX_ASSERT(pressure.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(density.size()) > array_indx); + TBOX_ASSERT(static_cast(velocity.size()) > array_indx * d_dim.getValue()); + TBOX_ASSERT(static_cast(pressure.size()) > array_indx); if (db->keyExists("density")) { density[array_indx] = db->getDouble("density"); @@ -4515,15 +4500,14 @@ void Euler::readStateDataEntry( << " input database. " << endl); } if (db->keyExists("velocity")) { - tbox::Array tmp_vel(0); - tmp_vel = db->getDoubleArray("velocity"); - if (tmp_vel.getSize() < d_dim.getValue()) { + std::vector tmp_vel = db->getDoubleVector("velocity"); + if (static_cast(tmp_vel.size()) < d_dim.getValue()) { TBOX_ERROR(d_object_name << ": " << "Insufficient number `velocity' values" << " given in " << db_name << " input database." << endl); } - for (int iv = 0; iv < d_dim.getValue(); iv++) { + for (int iv = 0; iv < d_dim.getValue(); ++iv) { velocity[array_indx * d_dim.getValue() + iv] = tmp_vel[iv]; } } else { @@ -4553,8 +4537,8 @@ void Euler::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds, - const tbox::Array& vector_bconds) const + const std::vector& scalar_bconds, + const std::vector& vector_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { @@ -4566,18 +4550,17 @@ void Euler::checkBoundaryData( #endif const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array bdry_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); int bscalarcase = 0; @@ -4585,18 +4568,20 @@ void Euler::checkBoundaryData( int refbdryloc = 0; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_2D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_EDGES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_2D_EDGES); + bscalarcase = scalar_bconds[bloc]; bvelocitycase = vector_bconds[bloc]; refbdryloc = bloc; } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_2D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_NODES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_2D_NODES); + bscalarcase = scalar_bconds[bloc]; bvelocitycase = vector_bconds[bloc]; refbdryloc = d_node_bdry_edge[bloc]; @@ -4604,26 +4589,29 @@ void Euler::checkBoundaryData( } if (d_dim == tbox::Dimension(3)) { if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_FACES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_FACES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_FACES); + bscalarcase = scalar_bconds[bloc]; bvelocitycase = vector_bconds[bloc]; refbdryloc = bloc; } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_EDGES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_EDGES); + bscalarcase = scalar_bconds[bloc]; bvelocitycase = vector_bconds[bloc]; refbdryloc = d_edge_bdry_face[bloc]; } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_NODES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_NODES); + bscalarcase = scalar_bconds[bloc]; bvelocitycase = vector_bconds[bloc]; refbdryloc = d_node_bdry_face[bloc]; @@ -4700,7 +4688,7 @@ void Euler::checkBoundaryData( } #endif - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { int vbcase = bscalarcase; if (d_dim == tbox::Dimension(2)) { diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.h b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.h index 45ba5d88..ec7c32b9 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Euler.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in Euler equation ex. * ************************************************************************/ @@ -31,11 +31,10 @@ #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/MessageStream.h" -#include "SAMRAI/tbox/Array.h" - -#include +#include "boost/shared_ptr.hpp" #include +#include using namespace std; /** @@ -203,11 +202,15 @@ class Euler: const int tag_index, const bool uses_gradient_detector_too); + //@{ + //! @name Required implementations of HyperbolicPatchStrategy pure virtuals. + /// /// The following routines: /// /// setPhysicalBoundaryConditions(), /// getRefineOpStencilWidth(), + /// preprocessRefine() /// postprocessRefine() /// /// are concrete implementations of functions declared in the @@ -229,8 +232,22 @@ class Euler: /** * Return stencil width of conservative linear interpolation operations. */ - virtual hier::IntVector - getRefineOpStencilWidth() const; + hier::IntVector + getRefineOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getOne(dim); + } + + void + preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } /** * Refine velocity and pressure from coarse patch to fine patch @@ -247,17 +264,33 @@ class Euler: /// The following routines: /// /// getCoarsenOpStencilWidth(), + /// preprocessCoarsen() /// postprocessCoarsen() /// /// are concrete implementations of functions declared in the - /// CoarsenPatchStrategy abstract base class. + /// CoarsenPatchStrategy abstract base class. They are trivial + /// because this class doesn't do any pre/postprocessCoarsen. /// /** * Return stencil width of conservative averaging operations. */ hier::IntVector - getCoarsenOpStencilWidth() const; + getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } /** * Coarsen velocity and pressure from coarse patch to fine patch @@ -270,6 +303,8 @@ class Euler: const hier::Box& coarse_box, const hier::IntVector& ratio); + //@} + /** * Write state of Euler object to the given database for restart. * @@ -277,8 +312,8 @@ class Euler: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -339,7 +374,8 @@ class Euler: const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; /// /// The following routines are specific to the Euler class and @@ -373,7 +409,7 @@ class Euler: writeData1dPencil( const boost::shared_ptr patch, const hier::Box& pencil_box, - const int idir, + const tbox::Dimension::dir_t idir, ostream& file); private: @@ -388,7 +424,7 @@ class Euler: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void getFromRestart(); @@ -398,9 +434,9 @@ class Euler: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& density, - tbox::Array& velocity, - tbox::Array& pressure); + std::vector& density, + std::vector& velocity, + std::vector& pressure); /* * Private member function to check correctness of boundary data. @@ -410,8 +446,8 @@ class Euler: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds, - const tbox::Array& vector_bconds) const; + const std::vector& scalar_bconds, + const std::vector& vector_bconds) const; /* * Three-dimensional flux computation routines corresponding to @@ -509,22 +545,22 @@ class Euler: * Input for SPHERE problem */ double d_radius; - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; double d_density_inside; - double d_velocity_inside[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_velocity_inside[SAMRAI::MAX_DIM_VAL]; double d_pressure_inside; double d_density_outside; - double d_velocity_outside[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_velocity_outside[SAMRAI::MAX_DIM_VAL]; double d_pressure_outside; /* * Input for PIECEWISE_CONSTANT_* and STEP problems */ int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_density; - tbox::Array d_interval_velocity; - tbox::Array d_interval_pressure; + std::vector d_front_position; + std::vector d_interval_density; + std::vector d_interval_velocity; + std::vector d_interval_pressure; /* * Boundary condition cases and boundary values. @@ -533,71 +569,71 @@ class Euler: * * Input file values are read into these arrays. */ - tbox::Array d_master_bdry_edge_conds; - tbox::Array d_master_bdry_node_conds; - tbox::Array d_master_bdry_face_conds; // Used in 3D only. + std::vector d_master_bdry_edge_conds; + std::vector d_master_bdry_node_conds; + std::vector d_master_bdry_face_conds; // Used in 3D only. /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_vector_bdry_edge_conds; + std::vector d_scalar_bdry_edge_conds; + std::vector d_vector_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_vector_bdry_node_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_vector_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // Used in 3D only. - tbox::Array d_vector_bdry_face_conds; // Used in 3D only. + std::vector d_scalar_bdry_face_conds; // Used in 3D only. + std::vector d_vector_bdry_face_conds; // Used in 3D only. - tbox::Array d_node_bdry_edge; // Used in 2D only. - tbox::Array d_edge_bdry_face; // Used in 3D only. - tbox::Array d_node_bdry_face; // Used in 3D only. + std::vector d_node_bdry_edge; // Used in 2D only. + std::vector d_edge_bdry_face; // Used in 3D only. + std::vector d_node_bdry_face; // Used in 3D only. /* - * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. + * Vectors of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_density; // Used in 2D only. - tbox::Array d_bdry_edge_velocity; // Used in 2D only. - tbox::Array d_bdry_edge_pressure; // Used in 2D only. - tbox::Array d_bdry_face_density; // Used in 3D only. - tbox::Array d_bdry_face_velocity; // Used in 3D only. - tbox::Array d_bdry_face_pressure; // Used in 3D only. + std::vector d_bdry_edge_density; // Used in 2D only. + std::vector d_bdry_edge_velocity; // Used in 2D only. + std::vector d_bdry_edge_pressure; // Used in 2D only. + std::vector d_bdry_face_density; // Used in 3D only. + std::vector d_bdry_face_velocity; // Used in 3D only. + std::vector d_bdry_face_pressure; // Used in 3D only. /* * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_density_dev_tol; - tbox::Array d_density_dev; - tbox::Array d_density_dev_time_max; - tbox::Array d_density_dev_time_min; - tbox::Array d_density_grad_tol; - tbox::Array d_density_grad_time_max; - tbox::Array d_density_grad_time_min; - tbox::Array d_density_shock_onset; - tbox::Array d_density_shock_tol; - tbox::Array d_density_shock_time_max; - tbox::Array d_density_shock_time_min; - tbox::Array d_density_rich_tol; - tbox::Array d_density_rich_time_max; - tbox::Array d_density_rich_time_min; - tbox::Array d_pressure_dev_tol; - tbox::Array d_pressure_dev; - tbox::Array d_pressure_dev_time_max; - tbox::Array d_pressure_dev_time_min; - tbox::Array d_pressure_grad_tol; - tbox::Array d_pressure_grad_time_max; - tbox::Array d_pressure_grad_time_min; - tbox::Array d_pressure_shock_onset; - tbox::Array d_pressure_shock_tol; - tbox::Array d_pressure_shock_time_max; - tbox::Array d_pressure_shock_time_min; - tbox::Array d_pressure_rich_tol; - tbox::Array d_pressure_rich_time_max; - tbox::Array d_pressure_rich_time_min; + std::vector d_refinement_criteria; + std::vector d_density_dev_tol; + std::vector d_density_dev; + std::vector d_density_dev_time_max; + std::vector d_density_dev_time_min; + std::vector d_density_grad_tol; + std::vector d_density_grad_time_max; + std::vector d_density_grad_time_min; + std::vector d_density_shock_onset; + std::vector d_density_shock_tol; + std::vector d_density_shock_time_max; + std::vector d_density_shock_time_min; + std::vector d_density_rich_tol; + std::vector d_density_rich_time_max; + std::vector d_density_rich_time_min; + std::vector d_pressure_dev_tol; + std::vector d_pressure_dev; + std::vector d_pressure_dev_time_max; + std::vector d_pressure_dev_time_min; + std::vector d_pressure_grad_tol; + std::vector d_pressure_grad_time_max; + std::vector d_pressure_grad_time_min; + std::vector d_pressure_shock_onset; + std::vector d_pressure_shock_tol; + std::vector d_pressure_shock_time_max; + std::vector d_pressure_shock_time_min; + std::vector d_pressure_rich_tol; + std::vector d_pressure_rich_time_max; + std::vector d_pressure_rich_time_min; /* * Timers. diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/EulerFort.h b/base/SAMRAI/SAMRAI/source/test/applications/Euler/EulerFort.h index 068bcb0d..d8637ab5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/EulerFort.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/EulerFort.h @@ -3,14 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI Euler gas dynamics ex. * ************************************************************************/ extern "C" { -void F77_FUNC(eulerinit2d, EULERINIT2D) ( +void SAMRAI_F77_FUNC(eulerinit2d, EULERINIT2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -22,7 +22,7 @@ void F77_FUNC(eulerinit2d, EULERINIT2D) ( const double *, const double *, const double *, const double *); -void F77_FUNC(eulerinit3d, EULERINIT3D) ( +void SAMRAI_F77_FUNC(eulerinit3d, EULERINIT3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -36,7 +36,7 @@ void F77_FUNC(eulerinit3d, EULERINIT3D) ( const double *, const double *, const double *, const double *); -void F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2D) ( +void SAMRAI_F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -48,7 +48,7 @@ void F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2D) ( const double&, const double *, const double&, const double *, const double&); -void F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3D) ( +void SAMRAI_F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -62,7 +62,7 @@ void F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3D) ( const double&, const double *, const double&, const double *, const double&); -void F77_FUNC(stabledt2d, STABLEDT2D) ( +void SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, const int&, const int&, const int&, const int&, @@ -71,7 +71,7 @@ void F77_FUNC(stabledt2d, STABLEDT2D) ( const double&, const double *, const double *, const double *, double&); -void F77_FUNC(stabledt3d, STABLEDT3D) ( +void SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, const int&, const int&, const int&, const int&, @@ -82,14 +82,14 @@ void F77_FUNC(stabledt3d, STABLEDT3D) ( const double&, const double *, const double *, const double *, double&); -void F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( +void SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( const int&, const int&, const int&, const int&, const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( +void SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -98,14 +98,14 @@ void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(computesound2d, COMPUTESOUND2D) ( +void SAMRAI_F77_FUNC(computesound2d, COMPUTESOUND2D) ( const int&, const int&, const int&, const int&, const double&, const double *, const double *, const double *, double *); -void F77_FUNC(computesound3d, COMPUTESOUND3D) ( +void SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -113,7 +113,7 @@ void F77_FUNC(computesound3d, COMPUTESOUND3D) ( const double *, const double *, const double *, double *); -void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( +void SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) ( const double&, const int&, const int&, const int&, const int&, @@ -124,7 +124,7 @@ void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( double *, double *, double *); -void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( +void SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) ( const double&, const int&, const int&, const int&, const int&, @@ -136,7 +136,7 @@ void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( double *, double *, double *); -void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( +void SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) ( const double&, const int&, const int&, const int&, const int&, @@ -147,7 +147,7 @@ void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( double *, double *, double *); -void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( +void SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) ( const double&, const int&, const int&, const int&, const int&, @@ -159,7 +159,7 @@ void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( double *, double *, double *); -void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( +void SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) ( const double&, const int&, const int&, const int&, const int&, @@ -171,7 +171,7 @@ void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( double *, double *, double *); -void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( +void SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( const double&, const int&, const int&, const double *, @@ -183,7 +183,7 @@ void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( +void SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( const double&, const int&, const int&, const int&, @@ -198,7 +198,7 @@ void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double&, const int&, @@ -211,7 +211,7 @@ void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double&, @@ -221,7 +221,7 @@ void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec, FLUXCORREC) ( +void SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) ( const double&, const int&, const int&, const int&, const int&, const double *, const double&, @@ -230,7 +230,7 @@ void F77_FUNC(fluxcorrec, FLUXCORREC) ( double *, double *, double *, double *); -void F77_FUNC(consdiff2d, CONSDIFF2D) ( +void SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) ( const int&, const int&, const int&, const int&, const double *, @@ -239,7 +239,7 @@ void F77_FUNC(consdiff2d, CONSDIFF2D) ( const double&, double *, double *, double *); -void F77_FUNC(consdiff3d, CONSDIFF3D) ( +void SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -250,7 +250,7 @@ void F77_FUNC(consdiff3d, CONSDIFF3D) ( const double&, double *, double *, double *); -void F77_FUNC(onethirdstate, onethirdstate) ( +void SAMRAI_F77_FUNC(onethirdstate, ONETHIRDSTATE) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -258,7 +258,7 @@ void F77_FUNC(onethirdstate, onethirdstate) ( const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird, fluxthird) ( +void SAMRAI_F77_FUNC(fluxthird, FLUXTHIRD) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -266,7 +266,7 @@ void F77_FUNC(fluxthird, fluxthird) ( const double *, const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt, fluxcorrecjt) ( +void SAMRAI_F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -275,7 +275,7 @@ void F77_FUNC(fluxcorrecjt, fluxcorrecjt) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(conservlinint2d, conservlinint2d) ( +void SAMRAI_F77_FUNC(conservlinint2d, CONSERVLININT2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -290,7 +290,7 @@ void F77_FUNC(conservlinint2d, conservlinint2d) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(conservavg2d, conservavg2d) ( +void SAMRAI_F77_FUNC(conservavg2d, CONSERVAVG2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -300,7 +300,7 @@ void F77_FUNC(conservavg2d, conservavg2d) ( const double *, const double *, double *, double *, double *); -void F77_FUNC(conservlinint3d, conservlinint3d) ( +void SAMRAI_F77_FUNC(conservlinint3d, CONSERVLININT3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -319,7 +319,7 @@ void F77_FUNC(conservlinint3d, conservlinint3d) ( double *, double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(conservavg3d, conservavg3d) ( +void SAMRAI_F77_FUNC(conservavg3d, CONSERVAVG3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -334,7 +334,7 @@ void F77_FUNC(conservavg3d, conservavg3d) ( double *, double *, double *); -void F77_FUNC(detectgrad2d, detectgrad2d) ( +void SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -345,7 +345,7 @@ void F77_FUNC(detectgrad2d, detectgrad2d) ( const double *, int *, int *); -void F77_FUNC(detectgrad3d, detectgrad3d) ( +void SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -358,7 +358,7 @@ void F77_FUNC(detectgrad3d, detectgrad3d) ( const double *, int *, int *); -void F77_FUNC(detectshock2d, detectshock2d) ( +void SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -369,7 +369,7 @@ void F77_FUNC(detectshock2d, detectshock2d) ( const double *, int *, int *); -void F77_FUNC(detectshock3d, detectshock3d) ( +void SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -382,7 +382,7 @@ void F77_FUNC(detectshock3d, detectshock3d) ( const double *, int *, int *); -void F77_FUNC(stufprobc, stufprobc) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.depend index 236d0733..fb0296cc 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -36,6 +37,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -47,11 +49,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -59,27 +65,27 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -103,12 +109,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -120,9 +125,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -146,13 +152,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h Euler.C Euler.h\ EulerFort.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -165,19 +169,21 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ @@ -185,6 +191,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -194,6 +201,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -205,7 +213,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -217,18 +228,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -236,11 +246,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -264,12 +275,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -284,9 +295,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -311,12 +323,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h Euler.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/AutoTester.h Euler.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -329,10 +340,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.in index e884eae8..3681ea0b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/Makefile.in @@ -3,8 +3,8 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for Euler gas dynamics sample application +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for Euler gas dynamics sample application ## ######################################################################### @@ -14,142 +14,213 @@ SUBDIR = source/test/applications/Euler VPATH = @srcdir@ TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -AUTOTEST = $(SAMRAI)/source/test/applications -CPPFLAGS_EXTRA= -I$(AUTOTEST) -DNDIM=$(PDIM) -DTESTING=1 -FORTRAN = $(SRCDIR)/fortran/$(PDIM)d +SUBDIRS = fortran + +CPPFLAGS_EXTRA = -DTESTING=1 NUM_TESTS = 12 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = main.o Euler.o AutoTester.o +CXX_OBJS = main.o Euler.o F_OBJS = \ - avgint2d.o flaten1d2d.o flux2d.o grad2d.o init2d.o stable2d.o \ - stufprobc.o trace2d.o trace1d2d.o \ - avgint3d.o flaten1d3d.o flux3d.o grad3d.o init3d.o stable3d.o \ - trace3d.o trace1d3d.o fluxcorner3d.o + fortran/avgint2d.o \ + fortran/flaten1d2d.o \ + fortran/flux2d.o \ + fortran/grad2d.o \ + fortran/init2d.o \ + fortran/stable2d.o \ + fortran/stufprobc.o \ + fortran/trace2d.o \ + fortran/trace1d2d.o \ + fortran/avgint3d.o \ + fortran/flaten1d3d.o \ + fortran/flux3d.o \ + fortran/grad3d.o \ + fortran/init3d.o \ + fortran/stable3d.o \ + fortran/trace3d.o \ + fortran/trace1d3d.o \ + fortran/fluxcorner3d.o -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) $(TESTLIB) \ + $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main -check: - $(MAKE) check2d - $(MAKE) check3d +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -check2d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.2d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.2d.input test.2d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.2d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.2d.input test_sync.2d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_restart.2d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_restart.2d.input test_restart.2d.restart 5 +fortran/avgint2d.o: -check3d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.3d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.3d.input test.3d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.3d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.3d.input test_sync.3d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync_restart.3d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync_restart.3d.input test_sync_restart.3d.restart 5 +fortran/flaten1d2d.o: -checkcompile: main +fortran/flux2d.o: -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean-check: - $(SAMCLEAN) +fortran/grad2d.o: -clean: clean-check - $(RM) *.f main - $(RM) -rf test*restart test*visit viz* +fortran/init2d.o: -include $(SRCDIR)/Makefile.depend +fortran/stable2d.o: -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +fortran/stufprobc.o: -AutoTester.o: $(AUTOTEST)/AutoTester.C - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C \ - -o $@ +fortran/trace2d.o: -avgint2d.o: $(FORTRAN)/avgint2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/avgint2d.m4 > avgint2d.f - $(F77) $(FFLAGS) -c avgint2d.f -o $@ +fortran/trace1d2d.o: -avgint3d.o: $(FORTRAN)/avgint3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/avgint3d.m4 > avgint3d.f - $(F77) $(FFLAGS) -c avgint3d.f -o $@ +fortran/avgint3d.o: -flaten1d2d.o: $(FORTRAN)/flaten1d2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flaten1d2d.m4 > flaten1d2d.f - $(F77) $(FFLAGS) -c flaten1d2d.f -o $@ +fortran/flaten1d3d.o: -flaten1d3d.o: $(FORTRAN)/flaten1d3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flaten1d3d.m4 > flaten1d3d.f - $(F77) $(FFLAGS) -c flaten1d3d.f -o $@ +fortran/flux3d.o: -flux2d.o: $(FORTRAN)/flux2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux2d.m4 > flux2d.f - $(F77) $(FFLAGS) -c flux2d.f -o $@ +fortran/grad3d.o: -flux3d.o: $(FORTRAN)/flux3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux3d.m4 > flux3d.f - $(F77) $(FFLAGS) -c flux3d.f -o $@ +fortran/init3d.o: -fluxcorner3d.o: $(FORTRAN)/fluxcorner3d.m4 - $(M4) -B8096 $(M4DIRS) $(FORTRAN)/fluxcorner3d.m4 > fluxcorner3d.f - $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ +fortran/stable3d.o: -grad2d.o: $(FORTRAN)/grad2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad2d.m4 > grad2d.f - $(F77) $(FFLAGS) -c grad2d.f -o $@ +fortran/trace3d.o: -grad3d.o: $(FORTRAN)/grad3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad3d.m4 > grad3d.f - $(F77) $(FFLAGS) -c grad3d.f -o $@ +fortran/trace1d3d.o: -init2d.o: $(FORTRAN)/init2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init2d.m4 > init2d.f - $(F77) $(FFLAGS) -c init2d.f -o $@ +fortran/fluxcorner3d.o: -init3d.o: $(FORTRAN)/init3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init3d.m4 > init3d.f - $(F77) $(FFLAGS) -c init3d.f -o $@ - -stable2d.o: $(FORTRAN)/stable2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable2d.m4 > stable2d.f - $(F77) $(FFLAGS) -c stable2d.f -o $@ +check: + $(MAKE) check2d + $(MAKE) check3d -stable3d.o: $(FORTRAN)/stable3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable3d.m4 > stable3d.f - $(F77) $(FFLAGS) -c stable3d.f -o $@ +check2d: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.2d.input test.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.2d.input test_sync.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_restart.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_restart.2d.input test_restart.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo -stufprobc.o: $(FORTRAN)/stufprobc.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stufprobc.m4 > stufprobc.f - $(F77) $(FFLAGS) -c stufprobc.f -o $@ +check3d: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.3d.input test.3d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.3d.input test_sync.3d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync_restart.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync_restart.3d.input test_sync_restart.3d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo -trace2d.o: $(FORTRAN)/trace2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace2d.m4 > trace2d.f - $(F77) $(FFLAGS) -c trace2d.f -o $@ +checkcompile: main -trace3d.o: $(FORTRAN)/trace3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace3d.m4 > trace3d.f - $(F77) $(FFLAGS) -c trace3d.f -o $@ +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples2d: main + @for i in example_inputs/*.2d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i}; \ + done + +examples3d: main + @for i in example_inputs/*.3d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i}; \ + done + +examples: + $(MAKE) examples2d + $(MAKE) examples3d + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) test*restart viz* + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -trace1d2d.o: $(FORTRAN)/trace1d2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace1d2d.m4 > trace1d2d.f - $(F77) $(FFLAGS) -c trace1d2d.f -o $@ +include $(SRCDIR)/Makefile.depend -trace1d3d.o: $(FORTRAN)/trace1d3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace1d3d.m4 > trace1d3d.f - $(F77) $(FFLAGS) -c trace1d3d.f -o $@ +AutoTester.o: $(AUTOTEST)/AutoTester.C + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/README b/base/SAMRAI/SAMRAI/source/test/applications/Euler/README index 50058c05..0205aa83 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/README +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/README @@ -1,63 +1,90 @@ ######################################################################### ## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for Euler test. ## ######################################################################### -This directory contains a Makefile to build an Automatic testing -version of the Euler application. It is used in the autotest -suite of SAMRAI. - -The Makefile operates on the Euler code in the applications -directory. However, it performs two functions not done in the -standard Euler application. First, it builds and links the -AutoTester class, located in /SAMRAI/source/test/applications. -This class reads information from input and performs an -"evaluate" function to assure the computed information is -correct. Second, it sets to TRUE the TESTING preprocessor -option so that the autotest part of Euler is included. - -The following segment should be added to the input file -to satisfy the input requirements for AutoTester: - -// Automated testing arguments. -// test_iter_num -- (int) iteration number (i.e. coarse-grid -// timestep) for which to check result [10]. -// test_fluxes -- (bool) test Riemann solver. -// If TRUE, it outputs primitive variables to a -// file which can then be verified against some -// known "correct" result. If FALSE, it will -// simply check timesteps in the -// HyperbolicLevelIntegrator. [FALSE] -// correct_result -- (double array) specification of correct result -// for the different test performed. If the -// computed result does not match the specified -// result, the code will report an error [0]. -// output_correct -- (bool) output computed result. Useful for -// setting baseline "correct_result" values for a -// new problem. That is, set to TRUE and run the -// case. Enter the output values in the -// correct_result array in input, and use the -// input file for automated testing. [FALSE] -AutoTester { - test_iter_num = 10 - test_fluxes = FALSE - correct_result = 2.25, 0.0140625, 0.0140625 - output_correct = FALSE -} - -A 2D and a 3D test input file are included with Euler: - test-2d.input - contains input and "correct" output data for 2D - test of Euler - test-3d.input - same, but for 3D test. +This README explains how to compile and run the application solving +the Euler equations of gas dynamics. The files included in this directory +are as follows: + + main.C - application driver program + Euler.[C,h] - C++ class containing routines specific to the + Euler example and which are called from SAMRAI + AMR library routines + EulerFort.h - header file defining external fortran routines + fortran/2d,3d - Fortran numerical routines for 2d,3d problems. + +To understand the construction of this application code from pieces +specific to the Euler model and more generic pieces in the SAMRAI +library consider the object construction pattern in the main.C file. +For more details on library classes and the Euler class consult the +the comments in the header files for the library classes and the +Euler.h class header file. + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + A 2D and a 3D test input file are included with Euler: + test.2d.input - contains input and "correct" output data for 2D + test of Euler + test.3d.input - same, but for 3D test. + serial: + ./main test_inputs/test.[2,3]d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main test_inputs/test.[2,3]d.input + + Restarted Run: + same format as regular run but add + to end of command. + is directory where restart files are stored + (set in input file). + is the identifier of which restart file to use + (generally the timestep). + + example: (to start from timestep #5) + + ./main test_inputs/test.2d.input test.2d.restart 5 + mpirun -np 2 ./main test_inputs/test.2d.input test.2d.restart 5 + + NOTE: The ordinary use of our restart functionality requires that + a problem can only be restarted on on the same number of + processors on which the problem was originally run. To restart + on a different number of processors, used the + restart-redistribute tool in SAMRAI/tools/restart. + + There are also example input files in the subdirectory example_inputs. + box.3d.input - gas sphere in a 3d box + room.2d.input - gas sphere in an irregularly shaped 2d room + room.3d.input - gas sphere in an irregularly shaped 3d room + sphere_restart.2d.input - gas sphere in a 2d box + step.2d.input - 2d step with 3 levels + step_5levels.2d.input - 2d step with 5 levels + + The test and example input files contain comments describing the input + parameters specific to this problem. Descriptions of input parameters for + library classes will be found in the documentation of those classes as well + their header files. + + +INPUT PARAMETER +--------------- +Refer to test_inputs/test2d.input for full description of all input parameters +specific to this problem. RESETTING BASELINES - +------------------- The tests that are run from this directory include comparisons of the results to baseline data that represent expected results. The tests compare the box configuration of the hierarchy, and certain timestep floating point values, @@ -95,4 +122,3 @@ according to the following steps correct_results). 6. make checktest (there should be no more errors). - diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-RP_test b/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-RP_test new file mode 100644 index 00000000..b0d48583 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-RP_test @@ -0,0 +1,45 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: README file for Euler test. +## +######################################################################### + +The RP_test input files implement three different problems: + +1. testX-1-2d - Sod shock tube + Tests Sod shock tube problem in the X direction in 2D. + (coupled RP-testX-2d.input with RP-test1.data in the RP_input + directory in the applications directory). 50 timesteps + +2. testY-3-3d - left side, Woodward Colella blast wave + Tests Woodward-Colella problem in the Y direction in 3D. + (coupled RP-testY-3d.input with RP-test3.data in the RP_input + directory in the applications directory). 75 timesteps. + +3. testZ-6-3d - slow moving contact discontinuity + Tests contact discontinuity problem in Z direction in 3D. + (coupled RP-testZ-3d.input with RP-test6Z.data in the RP_input + directory in the applications directory). 60 timesteps. + +An input file, a "correct" solution file, and a plot of the solution +are included for each of these tests: + + .input - input file for the test + _.correct - data file with the "correct" + solution at the specified timestep. + _.jpg - JPEG image file showing plots of the + solution at the specified step. + +To run a test and compare with the correct solution, do the following: + +1. Run the test case with the appropriate input file: + ./main RP_test/testY-3-3d.input + +2. Compare the *.dat file (written to the RP_test directory) to the + correct solution: + diff testY-3-3d_0060.dat testY-3-3d_0060.correct + diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-test b/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-test deleted file mode 100644 index 3c56c5fa..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/README-test +++ /dev/null @@ -1,45 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for Euler test. -## -######################################################################### - -The input files implement three different problems: - -1. testX-1-2d - Sod shock tube - Tests Sod shock tube problem in the X direction in 2D. - (coupled RP-testX-2d.input with RP-test1.data in the RP_input - directory in the applications directory). 50 timesteps - -2. testY-3-3d - left side, Woodward Colella blast wave - Tests Woodward-Colella problem in the Y direction in 3D. - (coupled RP-testY-3d.input with RP-test3.data in the RP_input - directory in the applications directory). 75 timesteps. - -3. testZ-6-3d - slow moving contact discontinuity - Tests contact discontinuity problem in Z direction in 3D. - (coupled RP-testZ-3d.input with RP-test6Z.data in the RP_input - directory in the applications directory). 60 timesteps. - -An input file, a "correct" solution file, and a plot of the solution -are included for each of these tests: - - .input - input file for the test - _.correct - data file with the "correct" - solution at the specified timestep. - _.jpg - JPEG image file showing plots of the - solution at the specified step. - -To run a test and compare with the correct solution, do the following: - -1. Run the test case with the appropriate input file: - main3d-test RP_test/testY-3-3d.input - -2. Compare the *.dat file (written to the RP_test directory) to the - correct solution: - diff testY-3-3d_0060.dat testY-3-3d_0060.correct - diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/READ_ME b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/READ_ME index 5519efc4..162ecaa5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/READ_ME +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/READ_ME @@ -87,7 +87,7 @@ Example Use 1) Run the code with one of the input files: - main3d ./RP_input/RP-testY-3d.input + ./main RP_input/RP-testY-3d.input 2) go into the visualization dump directory. Data files (*.dat) that contain primitive and conserved variable values at different diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test1.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test1.data index c8b15c19..c0f207ca 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test1.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test1.data @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2X.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2X.data index ae956313..c0561e18 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2X.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2X.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Y.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Y.data index 68d4a8ae..dbbd0c73 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Y.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Y.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Z.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Z.data index ca63bb38..6dfa6cf2 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Z.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test2Z.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test3.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test3.data index b35a67a0..55fc8ed5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test3.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test3.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test4.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test4.data index 76819799..1a50f1df 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test4.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test4.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5X.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5X.data index ddbd792a..66990e09 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5X.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5X.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Y.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Y.data index 28725c7a..7cb1c88c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Y.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Y.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Z.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Z.data index c86511eb..73b5a42a 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Z.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test5Z.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6X.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6X.data index 74d16add..8494f925 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6X.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6X.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Y.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Y.data index e929dd86..892db864 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Y.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Y.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Z.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Z.data index 0fa5e6aa..8de6f366 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Z.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test6Z.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7X.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7X.data index ef5b4e18..96ef6054 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7X.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7X.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Y.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Y.data index 16aa7160..7a90c339 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Y.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Y.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Z.data b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Z.data index bd42784c..4f7fab1f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Z.data +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-test7Z.data @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-2d.input index 8ef0f9f3..41459d5f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 2d code (X direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-3d.input index 1dc67018..4d95bd52 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testX-3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 3d code (X direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-2d.input index 5252f392..26db0335 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 2d code (Y direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-3d.input index 5b37bfe0..e56d42c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testY-3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 3d code (Y direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testZ-3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testZ-3d.input index 094a17cf..1e08407b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testZ-3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_input/RP-testZ-3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 3d code (Z direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testX-1-2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testX-1-2d.input index ccf73ce3..f88f9860 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testX-1-2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testX-1-2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Sod Shock test for Euler Riemann in 2d (X direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testY-3-3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testY-3-3d.input index 41aeb4b9..e9dce8c0 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testY-3-3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testY-3-3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 3d code (Y direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testZ-6-3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testZ-6-3d.input index 19802dda..b6656c8c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testZ-6-3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/RP_test/testZ-6-3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input for testing Euler Riemann solvers in 3d code (Z direction) * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/box.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/box.3d.input index b0786086..4cb9614a 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/box.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/box.3d.input @@ -3,39 +3,63 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (3d box) * ************************************************************************/ +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + Euler { + // if TRUE allows for nonuniform load balancing use_nonuniform_workload = TRUE - gamma = 1.4 // gamma = Ratio of specific heats - godunov_order = 4 + // Ratio of specific heats + gamma = 1.4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_2" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 0.125 - center = 0.5 , 0.5 , 0.5 + center = 0.5 , 0.5 , 0.5 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 - pressure_outside = 1.0 + density_outside = 1.0 + velocity_outside = 0.0 , 0.0 , 0.0 // vector of length dim + pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -44,12 +68,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -153,21 +178,30 @@ Euler { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "box.3d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_box3d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_box3d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager { print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -176,42 +210,51 @@ TimerManager { "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. + x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. x_up = 1.e0,1.e0,1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2,2,2 - level_2 = 2,2,2 + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 , 2 + level_2 = 2 , 2 , 2 } largest_patch_size { - level_0 = 10, 10, 10 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + level_0 = 10, 10, 10 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 + level_0 = 8, 8, 8 // all finer levels will use same values as level_0... } } - -GriddingAlgorithm { - + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm { +} + +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -219,13 +262,15 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 25 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.2d.input index f9bdf19b..4ca27c76 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.2d.input @@ -3,35 +3,51 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (2d room) * ************************************************************************/ + +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + // General type of problem and its initial conditions. data_problem = "SPHERE" Initial_data { radius = 6.0 - center = 34.0 , 28.0 + center = 34.0 , 28.0 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 density_outside = 1.0 - velocity_outside = 0.0 , 0.0 + velocity_outside = 0.0 , 0.0 // vector of length dim pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -40,12 +56,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "REFLECT" @@ -83,21 +100,30 @@ Euler { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "room.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_room2d" - visit_file_cluster_size = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_room2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -106,6 +132,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,9),(14,20)], [(0,21),(19,35)], @@ -119,17 +146,19 @@ CartesianGeometry{ x_up = 65.e0 , 55.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + level_2 = 4 , 4 + level_3 = 4 , 4 } largest_patch_size { @@ -144,28 +173,35 @@ PatchHierarchy { } } + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 301 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 301 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.3d.input index 88055e4d..1fdebc88 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/room.3d.input @@ -3,38 +3,60 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (3d room) * ************************************************************************/ -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Godunov slopes - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - corner_transport = "CORNER_TRANSPORT_2" +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. - data_problem = "SPHERE" +AutoTester { + // No input--this is an example and does not test results. +} +Euler { + // Ratio of specific heats + gamma = 1.4 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + corner_transport = "CORNER_TRANSPORT_2" + + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { radius = 6.0 - center = 34.0 , 28.0 , 10.0 + center = 34.0 , 28.0 , 10.0 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 - pressure_outside = 1.0 + density_outside = 1.0 + velocity_outside = 0.0 , 0.0 , 0.0 // vector of length dim + pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -43,12 +65,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "REFLECT" @@ -153,21 +176,30 @@ Euler { Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "room.3d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_room3d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_room3d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -175,6 +207,7 @@ TimerManager{ "algs::GriddingAlgorithmX::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,9,0) , (14,20,20) ], [ (0,21,0) , (19,35,20) ], @@ -183,41 +216,49 @@ CartesianGeometry { [ (50,0,0) , (64,35,20) ], [ (50,46,0) , (64,54,20) ], [ (57,36,0) , (64,45,20) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 65.e0 , 55.e0 , 20.e0 // upper end of computational domain. + x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. + x_up = 65.e0,55.e0,20.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 1 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + max_levels = 1 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 , 4 level_2 = 4 , 4 , 4 level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 48, 48, 48 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + level_0 = 48, 48, 48 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 + level_0 = 8, 8, 8 // all finer levels will use same values as level_0... } } + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -225,13 +266,15 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 25 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/sphere_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/sphere_restart.2d.input index ea5791c3..89e3dadf 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/sphere_restart.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/sphere_restart.2d.input @@ -3,36 +3,54 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (2d sphere) * ************************************************************************/ + +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} + Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 6.0 - center = 30.0 , 30.0 + center = 30.0 , 30.0 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 - pressure_outside = 1.0 + density_outside = 1.0 + velocity_outside = 0.0 , 0.0 // vector of length dim + pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { + // PRESSURE_GRADIENT and PRESSURE_SHOCK criteria are applied only if + // the gradient detector is turned on in StandardTagAndInitialize + // input below... refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK", "PRESSURE_RICHARDSON" @@ -41,21 +59,19 @@ Euler { rich_tol = 0.001 } - // PRESSURE_GRADIENT and PRESSURE_SHOCK criteria are applied only if - // the gradient detector is turned on in StandardTagAndInitialize - // input below... PRESSURE_GRADIENT { grad_tol = 10.0 } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "REFLECT" @@ -93,21 +109,30 @@ Euler { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "sphere_restart.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -116,31 +141,36 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(59,59)] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 60.e0 , 60.e0 // upper end of computational domain. + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 60.e0 , 60.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { // tagging_method = "GRADIENT_DETECTOR" tagging_method = "RICHARDSON_EXTRAPOLATION" // tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" // tagging_method = "REFINE_BOXES" -// RefineBoxes { -// level_0 = [(20,20),(40,40)] -// level_1 = [(90,90),(150,150)] +// level_0 { +// boxes = [(20,20),(40,40)] +// } +// level_1 { +// boxes = [(90,90),(150,150)] // } } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + level_2 = 4 , 4 + level_3 = 4 , 4 } largest_patch_size { @@ -155,14 +185,19 @@ PatchHierarchy { } } + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -170,13 +205,15 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 301 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 301 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step.2d.input index 209f39a1..5dbeafa6 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step.2d.input @@ -3,36 +3,50 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (2d step) * ************************************************************************/ -Euler { - gamma = 1.4 // gamma = Ratio of specific heats +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) +AutoTester { + // No input--this is an example and does not test results. +} - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" +Euler { + // Ratio of specific heats + gamma = 1.4 - data_problem = "STEP" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // General type of problem and its initial conditions. + data_problem = "STEP" Initial_data { front_position = 0.0 interval_0 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } interval_1 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -41,12 +55,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.90 + shock_tol = 10.0 + shock_onset = 0.90 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -84,21 +99,30 @@ Euler { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "step.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_step2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_step2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -107,6 +131,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0) , (9,19) ], [ (10,4) , (49,19) ] @@ -114,12 +139,14 @@ CartesianGeometry { x_up = 2.5e0 , 1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 @@ -127,7 +154,7 @@ PatchHierarchy { } largest_patch_size { - level_0 = 32 , 32 + level_0 = 32 , 32 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -137,14 +164,19 @@ PatchHierarchy { } } + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -152,13 +184,15 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 20.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 401 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 20.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 401 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step_5levels.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step_5levels.2d.input index 3050fa29..ca686a1c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step_5levels.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/example_inputs/step_5levels.2d.input @@ -3,36 +3,50 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (2d step) * ************************************************************************/ -Euler { - gamma = 1.4 // gamma = Ratio of specific heats +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) +AutoTester { + // No input--this is an example and does not test results. +} - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" +Euler { + // Ratio of specific heats + gamma = 1.4 - data_problem = "STEP" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // General type of problem and its initial conditions. + data_problem = "STEP" Initial_data { front_position = 0.0 interval_0 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } interval_1 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -41,12 +55,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.90 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -84,21 +99,30 @@ Euler { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "step_5levels.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_step2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_5levels_step2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -107,6 +131,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0) , (9,19) ], [ (10,4) , (49,19) ] @@ -114,12 +139,14 @@ CartesianGeometry { x_up = 2.5e0 , 1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 5 // Maximum number of levels in hierarchy. + max_levels = 5 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 @@ -129,7 +156,7 @@ PatchHierarchy { } largest_patch_size { - level_0 = 32 , 32 + level_0 = 32 , 32 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -142,14 +169,19 @@ PatchHierarchy { } } + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -157,13 +189,15 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 20.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 401 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 20.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 401 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.depend new file mode 100644 index 00000000..02e0116f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.depend @@ -0,0 +1,226 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=avgint2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + amrflaten2d.i avgint2d.m4 const.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=avgint3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + amrflaten3d.i avgint3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=flaten1d2d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i flaten1d2d.m4 \ + flaten2d.i probparams.i + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=flaten1d3d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i flaten1d3d.m4 \ + flaten3d.i probparams.i + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=flux2d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + flux2d.m4 gas1d_approxrp2d.i gas1d_exactrp2d.i m4flux2d.i \ + probparams.i + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=flux3d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + flux3d.m4 gas1d_approxrp3d.i gas1d_exactrp3d.i m4flux3d.i \ + probparams.i + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=fluxcorner3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + fluxcorner3d.m4 m4fluxcorner3d.i probparams.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=grad2d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + grad2d.m4 probparams.i + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=grad3d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + grad3d.m4 probparams.i + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=init2d.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 probparams.i + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=init3d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 probparams.i + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=stable2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + stable2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=stable3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + stable3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=stufprobc.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc.m4 + +DEPENDS_13 +=\ + + + +${FILE_13}: ${DEPENDS_13} + +FILE_14=trace1d2d.o +DEPENDS_14:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d2d.m4 + +DEPENDS_14 +=\ + + + +${FILE_14}: ${DEPENDS_14} + +FILE_15=trace1d3d.o +DEPENDS_15:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d3d.m4 + +DEPENDS_15 +=\ + + + +${FILE_15}: ${DEPENDS_15} + +FILE_16=trace2d.o +DEPENDS_16:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + m4trace2d.i probparams.i trace2d.m4 + +DEPENDS_16 +=\ + + + +${FILE_16}: ${DEPENDS_16} + +FILE_17=trace3d.o +DEPENDS_17:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + m4trace3d.i probparams.i trace3d.m4 + +DEPENDS_17 +=\ + + + +${FILE_17}: ${DEPENDS_17} + diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.in new file mode 100644 index 00000000..248aca1c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/Makefile.in @@ -0,0 +1,106 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI Euler gas dynamics +## sample application +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/applications/Euler/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= avgint2d.o flaten1d2d.o flux2d.o grad2d.o init2d.o stable2d.o \ + stufprobc.o trace2d.o trace1d2d.o \ + avgint3d.o flaten1d3d.o flux3d.o grad3d.o init3d.o stable3d.o \ + trace3d.o trace1d3d.o fluxcorner3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +avgint2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/avgint2d.m4 > avgint2d.f + $(F77) $(FFLAGS) -c avgint2d.f -o $@ + +avgint3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/avgint3d.m4 > avgint3d.f + $(F77) $(FFLAGS) -c avgint3d.f -o $@ + +flaten1d2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flaten1d2d.m4 > flaten1d2d.f + $(F77) $(FFLAGS) -c flaten1d2d.f -o $@ + +flaten1d3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flaten1d3d.m4 > flaten1d3d.f + $(F77) $(FFLAGS) -c flaten1d3d.f -o $@ + +flux2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux2d.m4 > flux2d.f + $(F77) $(FFLAGS) -c flux2d.f -o $@ + +flux3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux3d.m4 > flux3d.f + $(F77) $(FFLAGS) -c flux3d.f -o $@ + +fluxcorner3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/fluxcorner3d.m4 > fluxcorner3d.f + $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ + +grad2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad2d.m4 > grad2d.f + $(F77) $(FFLAGS) -c grad2d.f -o $@ + +grad3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad3d.m4 > grad3d.f + $(F77) $(FFLAGS) -c grad3d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +stable2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable2d.m4 > stable2d.f + $(F77) $(FFLAGS) -c stable2d.f -o $@ + +stable3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable3d.m4 > stable3d.f + $(F77) $(FFLAGS) -c stable3d.f -o $@ + +stufprobc.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc.m4 > stufprobc.f + $(F77) $(FFLAGS) -c stufprobc.f -o $@ + +trace2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace2d.m4 > trace2d.f + $(F77) $(FFLAGS) -c trace2d.f -o $@ + +trace3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace3d.m4 > trace3d.f + $(F77) $(FFLAGS) -c trace3d.f -o $@ + +trace1d2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d2d.m4 > trace1d2d.f + $(F77) $(FFLAGS) -c trace1d2d.f -o $@ + +trace1d3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d3d.m4 > trace1d3d.f + $(F77) $(FFLAGS) -c trace1d3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten2d.i index c23d6255..d82f0f3f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten2d.i @@ -1,4 +1,12 @@ c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient for 2d euler equation. +c +c c*********************************************************************** c flatten routine c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten3d.i index 3066cd57..deaf5827 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/amrflaten3d.i @@ -1,4 +1,12 @@ c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient for 3d euler equation. +c +c c*********************************************************************** c flatten routine c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint2d.m4 index c58e2d7a..6ab12c90 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint2d.m4 @@ -1,14 +1,14 @@ c -c File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/examples/Euler/fortran/2d/avgint.m4 $ -c Package: SAMRAI applications -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision: 1917 $ -c Description: F77 routines for interlevel transfer of velocity and -c pressure for 2d euler equations. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for interlevel transfer of velocity and pressure +c for 2d euler equations. c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/amrflaten2d.i)dnl c define(coarsen_index,`dnl @@ -306,7 +306,7 @@ c & if0,if1,velf(if0,if1,1) c enddo c enddo c call flush(6) - stop + stop endif c return @@ -376,7 +376,7 @@ c do ic1=ifirstc1,ilastc1 do ic0=ifirstc0,ilastc0 - velc(ic0,ic1,id) = zero + velc(ic0,ic1,id) = zero enddo enddo diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint3d.m4 index 785edb42..4af6e1e8 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/avgint3d.m4 @@ -1,14 +1,14 @@ c -c File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/examples/Euler/fortran/3d/avgint.m4 $ -c Package: SAMRAI applications -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision: 1917 $ -c Description: F77 routines for conservative interlevel transfer of velocity -c and pressure for 3d euler equations. +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for conservative interlevel transfer of velocity +c and pressure for 3d euler equations. c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/amrflaten3d.i)dnl c define(coarsen_index,`dnl @@ -419,7 +419,7 @@ c & if0,if1,if2,velf(if0,if1,if2,2) c enddo c enddo c enddo - stop + stop endif c return diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/const.i index d6e93070..6da5a3d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,tenth,sixth,fourth,third,half,twothird, & rt75,one,onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d2d.m4 index 93b0c55c..aa6657c0 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d2d.m4 @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute flattening coefficient for 2d euler +c equations. +c define(NEQU,4)dnl define(REAL,`double precision')dnl include(FORTDIR/flaten2d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d3d.m4 index aca61f18..abde8ca1 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten1d3d.m4 @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute flattening coefficient for 3d euler +c equations. +c define(NEQU,5)dnl define(REAL,`double precision')dnl include(FORTDIR/flaten3d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten2d.i index d0d78c07..716e6204 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten2d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient for 2d euler equation. +c c*********************************************************************** subroutine flaten2d(ifirst,ilast,i,mc,idir, & tracest,sound,flattn) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten3d.i index 4c3e673a..32390cf2 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flaten3d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient for 3d euler equation. +c c*********************************************************************** subroutine flaten3d(ifirst,ilast,i,mc,idir, & tracest,sound,flattn) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux2d.m4 index b4291aa9..7a3ec17c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute fluxes for 2d euler equations. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4flux2d.i)dnl subroutine fluxcorrec(dt, @@ -49,7 +56,7 @@ c write(6,*) "In fluxcorrec()" if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" c call flush(6) - stop + stop endif c ****************************************************************** c * complete tracing at cell edges @@ -182,7 +189,7 @@ c if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" c call flush(6) - stop + stop endif c c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux3d.m4 index ef2eec8b..212360dd 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/flux3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute fluxes for 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4flux3d.i)dnl subroutine fluxcorrec2d(dt, @@ -18,25 +25,25 @@ c*********************************************************************** include(FORTDIR/probparams.i)dnl include(FORTDIR/const.i)dnl c*********************************************************************** -c*********************************************************************** +c*********************************************************************** c input arrays: integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt + REAL dt integer idir c variables in 1d axis indexed c - REAL + REAL & dx(0:NDIM-1) -c variables in 2d cell indexed +c variables in 2d cell indexed REAL & gamma, & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), & pressure(CELL3d(ifirst,ilast,CELLG)), c - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), c & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), @@ -52,20 +59,35 @@ c & ttracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), & ttracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2,k REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) +c REAL ttvlft(NEQU),ttvrgt(NEQU) REAL ttv(NEQU) REAL v2norm,rho,vel1,vel2,vel0,gam_min_one +c c write(6,*) "In fluxcorrec2d()" if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif -c +c gam_min_one = gamma - one + +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,velocity,pressure, +!$OMPc flux0,flux1,flux2, +!$OMPc tracelft0,tracelft1,tracelft2, +!$OMPc tracergt0,tracergt1,tracergt2, +!$OMPc ttracelft0,ttracelft1,ttracelft2, +!$OMPc ttracergt0,ttracergt1,ttracergt2, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2,fluxg, +!$OMPc idir, +!$OMPc gamma,gam_min_one,dt,dx) +!$OMPc PRIVATE(ic2,ic1,ic0, +!$OMPc vel0,vel1,vel2,rho,trnsvers,v2norm, +!$OMPc ttv) c c "Forward" computation of transverse flux terms c @@ -89,8 +111,9 @@ correc_flux2d(2,`ic0,ic1',1,`ic2,ic0',0)dnl c endif c +!$OMP END PARALLEL return - end + end c c*********************************************************************** c*********************************************************************** @@ -108,26 +131,26 @@ c*********************************************************************** include(FORTDIR/probparams.i)dnl include(FORTDIR/const.i)dnl c*********************************************************************** -c*********************************************************************** +c*********************************************************************** c input arrays: integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt + REAL dt c variables in 1d axis indexed c - REAL + REAL & dx(0:NDIM-1) -c variables in 2d cell indexed +c variables in 2d cell indexed REAL & gamma, & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), & pressure(CELL3d(ifirst,ilast,CELLG)), & fluxa0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & fluxa1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & fluxa2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & fluxa1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & fluxa2(FACE3d2(ifirst,ilast,FLUXG),NEQU), & fluxb0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & fluxb1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & fluxb2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & fluxb1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & fluxb2(FACE3d2(ifirst,ilast,FLUXG),NEQU), & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), @@ -135,32 +158,44 @@ c variables in 2d cell indexed & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2,k REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) +c REAL ttvlft(NEQU),ttvrgt(NEQU) REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel2,vel0,gam_min_one + REAL v2norm,rho,vel1,vel2,vel0,gam_min_one c if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif - + c ****************************************************************** c * complete tracing at cell edges c ****************************************************************** gam_min_one = gamma - one -c + +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,velocity,pressure, +!$OMPc fluxa0,fluxa1,fluxa2,fluxb0,fluxb1,fluxb2, +!$OMPc tracelft0,tracelft1,tracelft2, +!$OMPc tracergt0,tracergt1,tracergt2, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2,fluxg, +!$OMPc gamma,gam_min_one,dt,dx) +!$OMPc PRIVATE(ic2,ic1,ic0, +!$OMPc vel0,vel1,vel2,rho,trnsvers,v2norm, +!$OMPc ttv) +c correc_flux3d(2,0,1,a0,a1,`ic1,ic2',`ic2,ic0')dnl -c +c correc_flux3d(1,2,0,a2,b0,`ic0,ic1',`ic1,ic2')dnl -c +c correc_flux3d(0,1,2,b1,b2,`ic2,ic0',`ic0,ic1')dnl -c +c +!$OMP END PARALLEL return - end + end c c*********************************************************************** c*********************************************************************** @@ -172,7 +207,7 @@ c*********************************************************************** & flux0,flux1,flux2, & trlft0,trlft1,trlft2, & trrgt0,trrgt1,trrgt2) - + c*********************************************************************** implicit none include(FORTDIR/probparams.i)dnl @@ -182,17 +217,17 @@ c*********************************************************************** c input arrays: integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 integer xcell0,xcell1,visco,rpchoice - REAL dt,dx(0:NDIM-1),gamma -c variables in 2d cell indexed + REAL dt,dx(0:NDIM-1),gamma +c variables in 2d cell indexed REAL & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), & pressure(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed +c variables in 2d side indexed REAL & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), & trlft0(FACE3d0(ifirst,ilast,FACEG),NEQU), & trrgt0(FACE3d0(ifirst,ilast,FACEG),NEQU), & trlft1(FACE3d1(ifirst,ilast,FACEG),NEQU), @@ -200,7 +235,7 @@ c variables in 2d side indexed & trlft2(FACE3d2(ifirst,ilast,FACEG),NEQU), & trrgt2(FACE3d2(ifirst,ilast,FACEG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2,ie0,ie1,ie2,j REAL stateL(NEQU),stateR(NEQU), @@ -213,17 +248,17 @@ c variables for hllc scheme REAL aLsq,aRsq,keL,keR,flux(NEQU),diff(NEQU) REAL mfL,mfR,star(NEQU),sL,sM,sR REAL w,omw,hat(NEQU+1),denom -c + if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif c c*********************************************************************** c solve riemann problems for conservative flux c arguments: ( axis for RP, other axis, extra cells-direction) c*********************************************************************** -c +c gam_min_one = gamma-one c write(6,*) "in fluxcalculation3d..." @@ -235,6 +270,21 @@ c write(6,*) "gamma = ",gamma c write(6,*) "rpchoice = ",rpchoice c write(6,*) "gam_min_one = ",gam_min_one c call flush(6) + +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,velocity,pressure,flux0,flux1,flux2, +!$OMPc trlft0,trrgt0,trlft1,trrgt1,trlft2,trrgt2, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc xcell0,xcell1,rpchoice,fluxg, +!$OMPc gamma,gam_min_one,dt,visco, +!$OMPc APPROX_RIEM_SOLVE,EXACT_RIEM_SOLVE,HLLC_RIEM_SOLVE) +!$OMPc PRIVATE(ic2,ic1,ic0,ie0,ie1,ie2,j,stateL,stateR, +!$OMPc vel,mom0,mom1,mom2,v2norm,Hent, +!$OMPc riemst,w,omw,hat,aLsq,aRsq,sL,sM,sR,mfL,mfR,flux, +!$OMPc keL,keR,diff,star,denom, +!$OMPc maxeig, vcoef,vcorr, +!$OMPc mom0L,mom1L,mom2L,enerL,mom0R,mom1R,mom2R,enerR) + riemann_solve(0,1,2,`ic1,ic2',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl c @@ -253,12 +303,13 @@ c artificial_viscosity1(2,0,1)dnl c endif +!$OMP END PARALLEL return - end + end c*********************************************************************** c*********************************************************************** c*********************************************************************** - + subroutine consdiff3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & dx, @@ -283,13 +334,18 @@ c integer ic0,ic1,ic2,k REAL temp,v2norm,mom(NDIM),energy, & gam_min_one - + c*********************************************************************** c update conserved to full time c note the permutation of indices in 2nd, 3rd coordinate directions c*********************************************************************** gam_min_one = gamma - one +!$OMP PARALLEL SHARED(density,velocity,pressure,flux0,flux1,flux2, +!$OMPc fluxg) +!$OMPc PRIVATE(ic2,ic1,ic0,mom,v2norm,energy,temp) + +!$OMP DO SCHEDULE(DYNAMIC) do ic2=ifirst2,ilast2 do ic1=ifirst1,ilast1 do ic0=ifirst0,ilast0 @@ -301,7 +357,7 @@ c*********************************************************************** & velocity(ic0,ic1,ic2,3)**2) energy = pressure(ic0,ic1,ic2)/gam_min_one + & half*density(ic0,ic1,ic2)*v2norm - + density(ic0,ic1,ic2) = density(ic0,ic1,ic2) & -(flux0(ic0+1,ic1,ic2,1)-flux0(ic0,ic1,ic2,1))/dx(0) & -(flux1(ic1+1,ic2,ic0,1)-flux1(ic1,ic2,ic0,1))/dx(1) @@ -319,7 +375,7 @@ c*********************************************************************** & -(flux0(ic0+1,ic1,ic2,NEQU)-flux0(ic0,ic1,ic2,NEQU))/dx(0) & -(flux1(ic1+1,ic2,ic0,NEQU)-flux1(ic1,ic2,ic0,NEQU))/dx(1) & -(flux2(ic2+1,ic0,ic1,NEQU)-flux2(ic2,ic0,ic1,NEQU))/dx(2) -c +c v2norm = (velocity(ic0,ic1,ic2,1)**2+ & velocity(ic0,ic1,ic2,2)**2+velocity(ic0,ic1,ic2,3)**2) temp = energy - half*density(ic0,ic1,ic2)*v2norm @@ -328,6 +384,8 @@ c enddo enddo enddo +!$OMP END DO NOWAIT +!$OMP END PARALLEL c return end diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/fluxcorner3d.m4 index 8a1cbe37..03214e1c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/fluxcorner3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/fluxcorner3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute corner fluxes for 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4fluxcorner3d.i)dnl subroutine onethirdstate(dt,dx,idir, @@ -13,15 +20,15 @@ c*********************************************************************** implicit none include(FORTDIR/probparams.i)dnl include(FORTDIR/const.i)dnl -c*********************************************************************** +c*********************************************************************** c input arrays: integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt + REAL dt c variables in 1d axis indexed c - REAL + REAL & dx(0:NDIM-1), gamma -c variables in 3d cell indexed +c variables in 3d cell indexed REAL & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), @@ -31,40 +38,53 @@ c variables in 3d cell indexed & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), & st3(CELL3d(ifirst,ilast,CELLG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2,k REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) REAL ttv(NEQU) REAL v2norm,rho,vel1,vel2,vel0,pres, & gam_min_one c if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif - + c ****************************************************************** c * complete tracing at cell edges c ****************************************************************** gam_min_one = gamma - one +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,dx,idir,gamma,gam_min_one, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc density,velocity,pressure,flux0,flux1,flux2,st3, +!$OMPc CELLG,FLUXG,FACEG) +!$OMPc PRIVATE(ic0,ic1,ic2,k, +!$OMPc trnsvers,ttv,rho,pres,vel0,vel1,vel2,v2norm) c if (idir.eq.0) then -c +c +!$OMP DO SCHEDULE(DYNAMIC) st_third(0,1,2,`ic1,ic2')dnl +!$OMP END DO c elseif (idir.eq.1) then -c +c +!$OMP DO SCHEDULE(DYNAMIC) st_third(1,2,0,`ic2,ic0')dnl +!$OMP END DO c elseif (idir.eq.2) then -c +c +!$OMP DO SCHEDULE(DYNAMIC) st_third(2,0,1,`ic0,ic1')dnl +!$OMP END DO c endif +!$OMP END PARALLEL return - end + end c c*********************************************************************** c*********************************************************************** @@ -75,7 +95,7 @@ c*********************************************************************** & density,velocity,pressure, & st3, & flux0,flux1,flux2 ) - + c*********************************************************************** implicit none include(FORTDIR/probparams.i)dnl @@ -84,20 +104,20 @@ c*********************************************************************** c*********************************************************************** c input arrays: integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt,dx(0:NDIM-1),gamma + REAL dt,dx(0:NDIM-1),gamma integer rpchoice REAL & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), & pressure(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed +c variables in 2d side indexed REAL & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), & st3(CELL3d(ifirst,ilast,CELLG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2 REAL stateL(4),stateR(4), @@ -107,38 +127,61 @@ c c if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif c c*********************************************************************** c solve riemann problems for conservative flux c arguments: ( axis for RP, other axis, extra cells-direction) c*********************************************************************** -c +c gam_min_one = gamma - one +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,dx,idir,gamma,gam_min_one,rpchoice, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc density,velocity,pressure,flux0,flux1,flux2,st3, +!$OMPc CELLG,FLUXG,FACEG, +!$OMPc APPROX_RIEM_SOLVE,EXACT_RIEM_SOLVE, +!$OMPc HLLC_RIEM_SOLVE) +!$OMPc PRIVATE(ic0,ic1,ic2, +!$OMPc stateL,stateR,riemst,mom0,mom1,mom2,Hent, +!$OMPc vel,v2norm) c if (idir.eq.0) then c +!$OMP DO SCHEDULE(DYNAMIC) f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl +!$OMP END DO c +!$OMP DO SCHEDULE(DYNAMIC) f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl +!$OMP END DO c elseif (idir.eq.1) then c +!$OMP DO SCHEDULE(DYNAMIC) f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl +!$OMP END DO c +!$OMP DO SCHEDULE(DYNAMIC) f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl +!$OMP END DO c elseif (idir.eq.2) then c +!$OMP DO SCHEDULE(DYNAMIC) f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl +!$OMP END DO c +!$OMP DO SCHEDULE(DYNAMIC) f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl +!$OMP END DO c endif c +!$OMP END PARALLEL return - end + end c*********************************************************************** c*********************************************************************** c*********************************************************************** @@ -153,15 +196,15 @@ c*********************************************************************** include(FORTDIR/probparams.i)dnl include(FORTDIR/const.i)dnl c*********************************************************************** -c*********************************************************************** +c*********************************************************************** c input arrays: integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt + REAL dt c variables in 1d axis indexed c - REAL + REAL & dx(0:3-1) -c variables in 2d cell indexed +c variables in 2d cell indexed REAL & density(CELL3d(ifirst,ilast,CELLG)), & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), @@ -176,24 +219,33 @@ c variables in 2d cell indexed & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) c -c*********************************************************************** +c*********************************************************************** c integer ic0,ic1,ic2,k REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) REAL ttv(NEQU) REAL v2norm,rho,vel1,vel2,vel0,gamma, & gam_min_one c if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif - + c ****************************************************************** c * complete tracing at cell edges c ****************************************************************** gam_min_one = gamma - one +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,dx,idir,gamma,gam_min_one, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc density,velocity,pressure,flux0,flux1,flux2, +!$OMPc CELLG,FLUXG,FACEG, +!$OMPc tracelft0,tracelft1,tracelft2, +!$OMPc tracergt0,tracergt1,tracergt2) +!$OMPc PRIVATE(ic0,ic1,ic2,k, +!$OMPc vel0,vel1,vel2,rho, +!$OMPc trnsvers,ttv,v2norm) c if (idir.eq.0) then c @@ -209,7 +261,8 @@ correc_fluxjt(2,1,0,`ic1,ic2',`ic2,ic0')dnl c endif c +!$OMP END PARALLEL return - end + end c c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp2d.i index b2cb53c3..2372e8ef 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp2d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to 2d +c Riemann problem. +c subroutine gas1dapproxrp2d(eosgam,wleft,wright, striem) c*********************************************************************** c description of arguments: @@ -38,7 +46,7 @@ c ****************************************************************** return endif - + gp1g2i=half*(eosgam+one)/eosgam gp1o2gm1=half*(eosgam+one)/(eosgam-one) clsqp=eosgam*wleft(1)*max(smallr,wleft(3)) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp3d.i index 9490f786..be861f97 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_approxrp3d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to 3d +c Riemann problem. +c subroutine gas1dapproxrp3d(eosgam,wleft,wright, striem) c*********************************************************************** c description of arguments: @@ -38,7 +46,7 @@ c ****************************************************************** return endif - + gp1g2i=half*(eosgam+one)/eosgam gp1o2gm1=half*(eosgam+one)/(eosgam-one) clsqp=eosgam*wleft(1)*max(smallr,wleft(3)) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp2d.i index 693e20d1..6dc1a6f5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp2d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to 2d +c Riemann problem. +c define(rarefvel,`dnl $3= ($1*two/(gamma-one))*(one- exp(log($2)*tau)) ')dnl @@ -159,7 +167,7 @@ c----------------------------------------------------------------- c SOLVE RIEMANN PROBLEM if ((leftwave.eq.2).and.(rightwave.eq.1)) then -c LEFT RAREF , RIGHT SHOCK +c LEFT RAREF , RIGHT SHOCK pstar = rpres pxl = pstar/lpres pxr = pstar/rpres @@ -191,7 +199,7 @@ dersvel(cxr,pxr,dfright)dnl rstarl = lrho*exp(log(pxl)/gamma) rstarr = rrho*(1+beta*pxr)/(beta+pxr) elseif ((leftwave.eq.1).and.(rightwave.eq.2)) then -c LEFT SHOCK ,RIGHT RAREF +c LEFT SHOCK ,RIGHT RAREF pstar = lpres pxl = pstar/lpres pxr = pstar/rpres @@ -223,7 +231,7 @@ derrvel(cxr,pxr,dfright)dnl rstarl = lrho*(1+beta*pxl)/(beta+pxl) rstarr = rrho*exp(log(pxr)/gamma) elseif ((leftwave.eq.1).and.(rightwave.eq.1)) then -c RIGHT SHOCK, LEFT SHOCK +c RIGHT SHOCK, LEFT SHOCK pstar = max(rpres,lpres) pxl = pstar/lpres pxr = pstar/rpres @@ -255,7 +263,7 @@ dersvel(cxr,pxr,dfright)dnl rstarl = lrho*(1+beta*pxl)/(beta+pxl) rstarr = rrho*(1+beta*pxr)/(beta+pxr) else -c RIGHT RAREF, LEFT RAREF +c RIGHT RAREF, LEFT RAREF pstarl = exp(tau*log(lpres)) pstarr = exp(tau*log(rpres)) pstar = (half*(gamma-1)*(lvel-rvel)+cxl+cxr)/ @@ -301,7 +309,7 @@ c PICK STATE FOR FLUXES cstar=sqrt(gamma*pstar/rstar) dummy=pstar-po if (dummy.ge.zero) then -c shock +c shock wo=sqrt(gamma*ro*po*( one +gp1g2i*dummy/po)) ushok=sein*ustar+wo/rstar if (ushok.ge.zero) then @@ -314,7 +322,7 @@ c shock striem(3)=po endif else -c rarefaction +c rarefaction co=sqrt(po*gamma/ro) wso=sein*uo+co wsi=sein*ustar+cstar diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp3d.i index be671f0b..6eb4c10d 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/gas1d_exactrp3d.i @@ -1,3 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to 3d +c Riemann problem. +c define(rarefvel,`dnl $3= ($1*two/(gamma-one))*(one- exp(log($2)*tau)) ')dnl @@ -159,7 +167,7 @@ c----------------------------------------------------------------- c SOLVE RIEMANN PROBLEM if ((leftwave.eq.2).and.(rightwave.eq.1)) then -c LEFT RAREF , RIGHT SHOCK +c LEFT RAREF , RIGHT SHOCK pstar = rpres pxl = pstar/lpres pxr = pstar/rpres @@ -191,7 +199,7 @@ dersvel(cxr,pxr,dfright)dnl rstarl = lrho*exp(log(pxl)/gamma) rstarr = rrho*(1+beta*pxr)/(beta+pxr) elseif ((leftwave.eq.1).and.(rightwave.eq.2)) then -c LEFT SHOCK ,RIGHT RAREF +c LEFT SHOCK ,RIGHT RAREF pstar = lpres pxl = pstar/lpres pxr = pstar/rpres @@ -223,7 +231,7 @@ derrvel(cxr,pxr,dfright)dnl rstarl = lrho*(1+beta*pxl)/(beta+pxl) rstarr = rrho*exp(log(pxr)/gamma) elseif ((leftwave.eq.1).and.(rightwave.eq.1)) then -c RIGHT SHOCK, LEFT SHOCK +c RIGHT SHOCK, LEFT SHOCK pstar = max(rpres,lpres) pxl = pstar/lpres pxr = pstar/rpres @@ -255,7 +263,7 @@ dersvel(cxr,pxr,dfright)dnl rstarl = lrho*(1+beta*pxl)/(beta+pxl) rstarr = rrho*(1+beta*pxr)/(beta+pxr) else -c RIGHT RAREF, LEFT RAREF +c RIGHT RAREF, LEFT RAREF pstarl = exp(tau*log(lpres)) pstarr = exp(tau*log(rpres)) pstar = (half*(gamma-1)*(lvel-rvel)+cxl+cxr)/ @@ -301,7 +309,7 @@ c PICK STATE FOR FLUXES cstar=sqrt(gamma*pstar/rstar) dummy=pstar-po if (dummy.ge.zero) then -c shock +c shock wo=sqrt(gamma*ro*po*( one +gp1g2i*dummy/po)) ushok=sein*ustar+wo/rstar if (ushok.ge.zero) then @@ -314,7 +322,7 @@ c shock striem(3)=po endif else -c rarefaction +c rarefaction co=sqrt(po*gamma/ro) wso=sein*uo+co wsi=sein*ustar+cstar diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad2d.m4 index 58f5fdd9..9ab3558f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad2d.m4 @@ -1,8 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to compute gradients for 2d euler equations. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine detectgrad2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad3d.m4 index 38421908..7284af34 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/grad3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to compute gradients for 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine detectgrad3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init2d.m4 index ceb78ec8..ea28a2f8 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to initialize 2d euler equations. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine eulerinit2d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init3d.m4 index 89532c59..2091bc82 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/init3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to initialize 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine eulerinit3d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux2d.i index 9db5a614..548d5f46 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux3d.i index 4e1fcdcf..dfa78f5b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4flux3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt @@ -9,6 +16,7 @@ c * Approximate Riemann solver and exact Riemann solver have c * identical setup and post-process phases. c ************************************************************ +!$OMP DO SCHEDULE(DYNAMIC) do ic$3=ifirst$3-$6,ilast$3+$6 do ic$2=ifirst$2-$5,ilast$2+$5 do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) @@ -52,12 +60,14 @@ c ************************************************************ enddo enddo enddo +!$OMP END DO elseif (rpchoice.eq.HLLC_RIEM_SOLVE) then c ****************************************************************** c * HLLC Riemann Solver c ****************************************************************** +!$OMP DO SCHEDULE(DYNAMIC) do ic$3=ifirst$3-$6,ilast$3+$6 do ic$2=ifirst$2-$5,ilast$2+$5 do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) @@ -205,11 +215,13 @@ c ************************************************************ enddo enddo enddo +!$OMP END DO endif ')dnl define(correc_flux2d,`dnl c correct the $1-direction with $3-fluxes +!$OMP DO SCHEDULE(DYNAMIC) do ic$5=ifirst$5-(FLUXG),ilast$5+(FLUXG) do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) do ic$1=ifirst$1-(FLUXG),ilast$1+(FLUXG) @@ -240,9 +252,11 @@ c enddo enddo enddo +!$OMP END DO ')dnl define(correc_flux3d,`dnl c correct the $1-direction with $2$3-fluxes +!$OMP DO SCHEDULE(DYNAMIC) do ic$1=ifirst$1-FLUXG,ilast$1+FLUXG do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) @@ -256,7 +270,7 @@ c correct the $1-direction with $2$3-fluxes & (flux$4(ic$2+1,$6,k)-flux$4(ic$2,$6,k))/dx($2)+ & (flux$5(ic$3+1,$7,k)-flux$5(ic$3,$7,k))/dx($3)) enddo - + ttv(1)= trnsvers(1) ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho @@ -274,14 +288,16 @@ c correct the $1-direction with $2$3-fluxes enddo enddo enddo +!$OMP END DO ')dnl define(artificial_viscosity1,`dnl +!$OMP DO SCHEDULE(DYNAMIC) do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) do ie$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG) maxeig =trrgt$1(ie$1,ic$2,ic$3,NEQU)-trlft$1(ie$1,ic$2,ic$3,NEQU) vcoef = tenth*abs(maxeig) - + mom0L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,2) mom1L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,3) mom2L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,4) @@ -308,9 +324,11 @@ define(artificial_viscosity1,`dnl enddo enddo enddo +!$OMP END DO ')dnl c define(artificial_viscosity2,`dnl +!$OMP DO SCHEDULE(DYNAMIC) do ic1=ifirst1,ilast1 do ie0=ifirst0,ilast0+1 maxeig =pressure(ie0,ic1)-pressure(ie0-1,ic1) @@ -336,6 +354,9 @@ define(artificial_viscosity2,`dnl enddo enddo enddo +!$OMP END DO + +!$OMP DO SCHEDULE(DYNAMIC) do ic0=ifirst0,ilast0 do ie1=ifirst1,ilast1+1 maxeig =pressure(ic0,ie1)-pressure(ic0-1,ie1) @@ -360,5 +381,6 @@ define(artificial_viscosity2,`dnl flux1(ie1,ic0,4)= flux1(ie1,ic0,4) - vcorr4 enddo enddo +!$OMP END DO ')dnl c diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4fluxcorner3d.i index e98a370b..eb07339c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4fluxcorner3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4fluxcorner3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d corner flux calculation. +c define(st_third,`dnl do ic$3=ifirst$3-FLUXG,ilast$3+FLUXG do ic$2=ifirst$2-FLUXG,ilast$2+FLUXG @@ -79,6 +86,7 @@ c else if (rpchoice.eq.HLLC_RIEM_SOLVE) then ')dnl define(correc_fluxjt,`dnl c correct the $2-direction with $3-fluxes +!$OMP DO SCHEDULE(DYNAMIC) do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) ic$2=ifirst$2-FLUXG @@ -155,8 +163,10 @@ c correct the $2-direction with $3-fluxes enddo enddo enddo +!$OMP END DO c c correct the $3-direction with $2-fluxes +!$OMP DO SCHEDULE(DYNAMIC) do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) ic$3=ifirst$3-FLUXG @@ -233,4 +243,5 @@ c correct the $3-direction with $2-fluxes enddo enddo enddo +!$OMP END DO ')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace2d.i index 947d80ee..b912880c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d trace calculation. +c define(trace_init,`dnl do ic$2=ifirst$2-FACEG,ilast$2+FACEG ie$1=ifirst$1-FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace3d.i index 714e7613..399f7017 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/m4trace3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d trace calculation. +c define(trace_init,`dnl do ic$3=ifirst$3-FACEG,ilast$3+FACEG do ic$2=ifirst$2-FACEG,ilast$2+FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/probparams.i b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/probparams.i index d5771a82..8c0d1444 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/probparams.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/probparams.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining common block. +c common/probparams/APPROX_RIEM_SOLVE,EXACT_RIEM_SOLVE, & HLLC_RIEM_SOLVE, & PIECEWISE_CONSTANT_X,PIECEWISE_CONSTANT_Y,PIECEWISE_CONSTANT_Z, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable2d.m4 index def9931e..68c0ac2b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable2d.m4 @@ -1,7 +1,15 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute stable dt for 2d euler equations. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + subroutine stabledt2d(dx, & ifirst0,ilast0,ifirst1,ilast1, & ngc0,ngc1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable3d.m4 index 5da95315..a1b501d8 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stable3d.m4 @@ -1,7 +1,15 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute stable dt for 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + subroutine stabledt3d(dx, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & ngc0,ngc1,ngc2, @@ -14,14 +22,18 @@ c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & ngc0,ngc1,ngc2 c - REAL + REAL & density(CELL3dVECG(ifirst,ilast,ngc)), & velocity(CELL3dVECG(ifirst,ilast,ngc),0:NDIM-1), & pressure(CELL3dVECG(ifirst,ilast,ngc)) -c +c integer ic0,ic1,ic2 integer ighoslft(0:NDIM-1),ighosrgt(0:NDIM-1) + integer thread_c, omp_get_num_threads + integer thread_n, omp_get_thread_num + integer chunk + REAL maxspeed(0:NDIM-1),gamma,lambda c ighoslft(0) = ifirst0 - ngc0 @@ -35,6 +47,18 @@ c maxspeed(1)=zero maxspeed(2)=zero + chunk = 1000 +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,pressure,velocity,gamma, +!$OMPc ighoslft,ighosrgt,chunk) +!$OMPc PRIVATE(ic2,ic1,ic0,lambda, thread_c) +!$OMPc REDUCTION(max:maxspeed) + +c thread_n = omp_get_thread_num() +c thread_c = omp_get_num_threads() +c write(6,*) "Thread number = ", thread_n, ' / ', thread_c + +!$OMP DO SCHEDULE(DYNAMIC) do ic2=ighoslft(2),ighosrgt(2) do ic1=ighoslft(1),ighosrgt(1) do ic0=ighoslft(0),ighosrgt(0) @@ -49,6 +73,9 @@ c enddo enddo enddo +!$OMP END DO +!$OMP END PARALLEL + stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) stabdt = min((dx(2)/maxspeed(2)),stabdt) c write(6,*) " dx(0),maxspeed(0)= ",dx(0),maxspeed(0) @@ -56,4 +83,4 @@ c write(6,*) " dx(1),maxspeed(1)= ",dx(1),maxspeed(1) c write(6,*) " dx(2),maxspeed(2)= ",dx(2),maxspeed(2) c write(6,*) " stabdt= ",stabdt return - end + end diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stufprobc.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stufprobc.m4 index 85f1d819..3fed00cf 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stufprobc.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/stufprobc.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine. +c subroutine stufprobc( & APPROX_RIEM_SOLVEin,EXACT_RIEM_SOLVEin,HLLC_RIEM_SOLVEin, & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d2d.m4 index 98fe8f73..efc6cf35 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d2d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace for 2d euler equations. +c define(NEQU,4)dnl define(REAL,`double precision')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d3d.m4 index 3f57d6e8..38ff54cf 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace1d3d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace for 3d euler equations. +c define(NEQU,5)dnl define(REAL,`double precision')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace2d.m4 index bf1a7a07..1354baac 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace for 2d euler equations. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4trace2d.i)dnl subroutine computesound2d(ifirst0,ilast0,ifirst1,ilast1, @@ -90,7 +97,7 @@ c (first-order upwind) c*********************************************************************** if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif c*********************************************************************** c write(6,*) "in init_trace_flux" diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace3d.m4 index 7ecaae03..427a8b01 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/fortran/trace3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace for 3d euler equations. +c define(NDIM,3)dnl define(NEQU,5)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4trace3d.i)dnl subroutine computesound3d(ifirst0,ilast0,ifirst1,ilast1, @@ -25,6 +32,14 @@ c c c*********************************************************************** c +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,velocity,pressure,sound, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc gamma, +!$OMPc CELLG,FLUXG,FACEG) +!$OMPc PRIVATE(ic0,ic1,ic2) + +!$OMP DO SCHEDULE(DYNAMIC) do ic0=ifirst0-CELLG,ilast0+CELLG do ic1=ifirst1-CELLG,ilast1+CELLG do ic2=ifirst2-CELLG,ilast2+CELLG @@ -34,6 +49,8 @@ c enddo enddo enddo +!$OMP END DO +!$OMP END PARALLEL return end @@ -76,20 +93,36 @@ c (first-order upwind) c*********************************************************************** if (FLUXG.lt.1) then write(6,*) "flux ghosts < 1!" - stop + stop endif c c*********************************************************************** +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(density,velocity,pressure, +!$OMPc tracelft0,tracelft1,tracelft2, +!$OMPc tracergt0,tracergt1,tracergt2, +!$OMPc fluxriem0,fluxriem1,fluxriem2, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc CELLG,FLUXG,FACEG) +!$OMPc PRIVATE(ic0,ic1,ic2,ie0,ie1,ie2) + +!$OMP DO SCHEDULE(DYNAMIC) trace_init(0,1,2,`ie0-1,ic1,ic2',`ie0,ic1,ic2')dnl +!$OMP END DO +!$OMP DO SCHEDULE(DYNAMIC) trace_init(1,2,0,`ic0,ie1-1,ic2',`ic0,ie1,ic2')dnl +!$OMP END DO +!$OMP DO SCHEDULE(DYNAMIC) trace_init(2,0,1,`ic0,ic1,ie2-1',`ic0,ic1,ie2')dnl +!$OMP END DO c c we initialize the flux to be 0 +!$OMP DO SCHEDULE(DYNAMIC) do ic2=ifirst2-FLUXG,ilast2+FLUXG do ic1=ifirst1-FLUXG,ilast1+FLUXG do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 @@ -99,7 +132,9 @@ c we initialize the flux to be 0 enddo enddo enddo +!$OMP END DO c +!$OMP DO SCHEDULE(DYNAMIC) do ic2=ifirst2-FLUXG,ilast2+FLUXG do ic0=ifirst0-FLUXG,ilast0+FLUXG do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 @@ -109,7 +144,9 @@ c enddo enddo enddo +!$OMP END DO c +!$OMP DO SCHEDULE(DYNAMIC) do ic1=ifirst1-FLUXG,ilast1+FLUXG do ic0=ifirst0-FLUXG,ilast0+FLUXG do ie2=ifirst2-FLUXG,ilast2+FLUXG+1 @@ -119,7 +156,9 @@ c enddo enddo enddo +!$OMP END DO c +!$OMP END PARALLEL return end c @@ -164,12 +203,25 @@ c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells & ttsound(ifirst0-CELLG:ifirst0+mc-1+CELLG) c*********************************************************************** integer ic0,ic1,ic2,k,idir + c*********************************************************************** c trace higher order states at cell edges c*********************************************************************** idir = 0 +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,mc,dx,gamma,igdnv,sound, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc tracelft,tracergt, +!$OMPc CELLG,FLUXG,FACEG, +!$OMPc idir) +!$OMPc PRIVATE(ic0,ic1,ic2, +!$OMPc ttsound,ttcelslp,ttedgslp,ttraclft,ttracrgt, +!$OMPc k) +!$OMP DO SCHEDULE(DYNAMIC) trace_call(0,1,2)dnl +!$OMP END DO c*********************************************************************** +!$OMP END PARALLEL return end c*********************************************************************** @@ -215,9 +267,21 @@ c*********************************************************************** c trace higher order states at cell edges c*********************************************************************** idir = 1 +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,mc,dx,gamma,igdnv,sound, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc tracelft,tracergt, +!$OMPc CELLG,FLUXG,FACEG, +!$OMPc idir) +!$OMPc PRIVATE(ic0,ic1,ic2, +!$OMPc ttsound,ttcelslp,ttedgslp,ttraclft,ttracrgt, +!$OMPc k) +!$OMP DO SCHEDULE(DYNAMIC) trace_call(1,2,0)dnl +!$OMP END DO c c*********************************************************************** +!$OMP END PARALLEL return end c @@ -264,8 +328,20 @@ c*********************************************************************** c trace higher order states at cell edges c*********************************************************************** idir = 2 +!$OMP PARALLEL DEFAULT(none) +!$OMPc SHARED(dt,mc,dx,gamma,igdnv,sound, +!$OMPc ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, +!$OMPc tracelft,tracergt, +!$OMPc CELLG,FLUXG,FACEG, +!$OMPc idir) +!$OMPc PRIVATE(ic0,ic1,ic2, +!$OMPc ttsound,ttcelslp,ttedgslp,ttraclft,ttracrgt, +!$OMPc k) +!$OMP DO SCHEDULE(DYNAMIC) trace_call(2,0,1)dnl +!$OMP END DO c c*********************************************************************** +!$OMP END PARALLEL return end diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/main.C b/base/SAMRAI/SAMRAI/source/test/applications/Euler/main.C index 7221347f..23dda493 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/main.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI Euler gas dynamics sample application * ************************************************************************/ @@ -33,20 +33,20 @@ #include "SAMRAI/hier/Index.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/SiloDatabaseFactory.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" -#include +#include "boost/shared_ptr.hpp" #include #include #include @@ -59,10 +59,14 @@ using namespace std; #include +#ifdef _OPENMP +#include +#endif + // Classes for autotesting. #if (TESTING == 1) -#include "AutoTester.h" +#include "test/testlib/AutoTester.h" #endif using namespace SAMRAI; @@ -126,7 +130,7 @@ using namespace SAMRAI; * patch level into a collection of logically-rectangular * box domains. * - * mesh::LoadBalancer - Processes the boxes generated by the + * mesh::TreeLoadBalancer - Processes the boxes generated by the * mesh::BergerRigoutsos algorithm into a configuration from * which patches are contructed. The algorithm we use in this * class assumes a spatially-uniform workload distribution; @@ -177,9 +181,9 @@ dumpMatlabData1dPencil( const int ext, const double plot_time, const boost::shared_ptr hierarchy, - const int pencil_direction, + const tbox::Dimension::dir_t pencil_direction, const bool default_pencil, - const tbox::Array& pencil_index, + const std::vector& pencil_index, Euler* euler_model); int main( @@ -289,6 +293,14 @@ int main( tbox::PIO::logOnlyNodeZero(log_filename); } +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif + int viz_dump_interval = 0; if (main_db->keyExists("viz_dump_interval")) { viz_dump_interval = main_db->getInteger("viz_dump_interval"); @@ -308,10 +320,10 @@ int main( string matlab_dump_filename; string matlab_dump_dirname; int matlab_dump_interval = 0; - int matlab_pencil_direction = 0; - tbox::Array matlab_pencil_index(dim.getValue() - 1); + tbox::Dimension::dir_t matlab_pencil_direction = 0; + std::vector matlab_pencil_index(dim.getValue() - 1); bool matlab_default_pencil = true; - for (int id = 0; id < dim.getValue() - 1; id++) { + for (int id = 0; id < dim.getValue() - 1; ++id) { matlab_pencil_index[id] = 0; } @@ -327,15 +339,15 @@ int main( } if (main_db->keyExists("matlab_pencil_direction")) { matlab_pencil_direction = - main_db->getInteger("matlab_pencil_direction"); + static_cast(main_db->getInteger("matlab_pencil_direction")); } if (main_db->keyExists("matlab_pencil_index")) { matlab_default_pencil = false; - matlab_pencil_index = main_db->getIntegerArray( - "matlab_pencil_index"); - if (matlab_pencil_index.getSize() != dim.getValue() - 1) { + matlab_pencil_index = + main_db->getIntegerVector("matlab_pencil_index"); + if (static_cast(matlab_pencil_index.size()) != dim.getValue() - 1) { TBOX_ERROR("`matlab_pencil_index' has " - << matlab_pencil_index.getSize() << " values in input. " + << matlab_pencil_index.size() << " values in input. " << dim.getValue() - 1 << " values must be specified when default" << " is overridden."); } @@ -437,12 +449,10 @@ int main( "HyperbolicLevelIntegrator", input_db->getDatabase("HyperbolicLevelIntegrator"), euler_model, - true, use_refined_timestepping)); boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); @@ -458,7 +468,8 @@ int main( new mesh::TreeLoadBalancer( dim, "LoadBalancer", - input_db->getDatabase("LoadBalancer"))); + input_db->getDatabase("LoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); load_balancer->setSAMRAI_MPI( tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -668,6 +679,9 @@ int main( } + tbox::plog << "GriddingAlgorithm statistics:\n"; + gridding_algorithm->printStatistics(); + /* * Output timer results. */ @@ -710,9 +724,9 @@ static void dumpMatlabData1dPencil( const int ext, const double plot_time, const boost::shared_ptr hierarchy, - const int pencil_direction, + const tbox::Dimension::dir_t pencil_direction, const bool default_pencil, - const tbox::Array& pencil_index, + const std::vector& pencil_index, Euler* euler_model) { const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -734,34 +748,33 @@ static void dumpMatlabData1dPencil( if (dim > tbox::Dimension(1)) { int indx = 0; - int id = 0; - tbox::Array tmp(dim.getValue() - 1); - for (id = 0; id < dim.getValue() - 1; id++) { + std::vector tmp(dim.getValue() - 1); + for (tbox::Dimension::dir_t id = 0; id < dim.getValue() - 1; ++id) { tmp[id] = pencil_index[id]; } if (default_pencil) { hier::Index ifirst = domain.getBoundingBox().lower(); indx = 0; - for (id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { if (id != pencil_direction) { tmp[indx] = ifirst(id); - indx++; + ++indx; } } } indx = 0; - for (id = 0; id < dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < dim.getValue(); ++id) { if (id != pencil_direction) { - pencil_box.lower(id) = tmp[indx]; - pencil_box.upper(id) = tmp[indx]; - indx++; + pencil_box.setLower(id, tmp[indx]); + pencil_box.setUpper(id, tmp[indx]); + ++indx; } } } - tbox::Array outboxes(nlevels); + std::vector outboxes(nlevels); - for (int l1 = 0; l1 < nlevels; l1++) { + for (int l1 = 0; l1 < nlevels; ++l1) { boost::shared_ptr level(hierarchy->getPatchLevel(l1)); outboxes[l1] = hier::BoxContainer(level->getBoxes()); @@ -771,7 +784,7 @@ static void dumpMatlabData1dPencil( hierarchy->getPatchLevel(l1 + 1)); hier::IntVector coarsen_ratio = finer_level->getRatioToCoarserLevel(); - hier::BoxContainer takeaway = hier::BoxContainer(finer_level->getBoxes()); + hier::BoxContainer takeaway(finer_level->getBoxes()); takeaway.coarsen(coarsen_ratio); outboxes[l1].removeIntersections(takeaway); } @@ -813,7 +826,7 @@ static void dumpMatlabData1dPencil( /* * There are 7 values dumped for every cell. Here we dump the time. */ - for (int i = 0; i < 6 + 1; i++) { + for (int i = 0; i < 6 + 1; ++i) { outfile << plot_time << " "; } outfile << endl; @@ -821,7 +834,7 @@ static void dumpMatlabData1dPencil( euler_model->setDataContext( hier::VariableDatabase::getDatabase()->getContext("CURRENT")); - for (int l5 = 0; l5 < nlevels; l5++) { + for (int l5 = 0; l5 < nlevels; ++l5) { boost::shared_ptr level(hierarchy->getPatchLevel(l5)); hier::Box level_pencil_box = pencil_box; @@ -834,7 +847,7 @@ static void dumpMatlabData1dPencil( const boost::shared_ptr& patch = *i; hier::Box pbox = patch->getBox(); - for (hier::BoxContainer::iterator b(outboxes[l5]); + for (hier::BoxContainer::iterator b = outboxes[l5].begin(); b != outboxes[l5].end(); ++b) { const hier::Box box = (*b) * pbox * level_pencil_box; diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test-2d-re.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test-2d-re.input deleted file mode 100644 index 3a8b5cac..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test-2d-re.input +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (2d room) - * - ************************************************************************/ - -GlobalInputs { - call_abort_in_serial_instead_of_exit = FALSE -} - -AutoTester { - test_fluxes = FALSE - test_iter_num = 10 - correct_result = 0.602378029044, 0.0118573379806, 0.00131668704346 - output_correct = FALSE - - write_patch_boxes = FALSE - read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data - test_patch_boxes_filename = "test_inputs/test-2d-re.boxes" - simplify_test_boxes = TRUE -} - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "SPHERE" - - Initial_data { - radius = 6.0 - center = 30.0 , 30.0 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 - pressure_outside = 1.0 - - } - - Refinement_data { - refine_criteria = "PRESSURE_RICHARDSON" - - PRESSURE_RICHARDSON { - rich_tol = 0.001 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "REFLECT" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "XREFLECT" - } - } - -} - -Main { - dim = 2 - base_name = "test-2d-re" -// log file parameters - log_all_nodes = TRUE - -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-2d-re" - -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry{ - domain_boxes = [(0,0),(59,59)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 60.e0 , 60.e0 // upper end of computational domain. -} - -StandardTagAndInitialize { - tagging_method = "RICHARDSON_EXTRAPOLATION" -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - - largest_patch_size { - level_0 = 48 , 48 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8 , 8 - level_1 = 16 , 16 - // all finer levels will use same values as level_1... - } - -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000001.0000000 index 02c521aa..eae861fa 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000000 index 3e51254c..f4a6f8bd 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000001 index 9a1b9d0e..4027d3ad 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..6726e1e2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..f549110c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..de1e051b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..4e595444 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.input index f0d9c124..784a4552 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.2d.input @@ -3,67 +3,223 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler 2d test problem * ************************************************************************/ GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). call_abort_in_serial_instead_of_exit = FALSE } AutoTester { + // If true, fluxes will be written out to a .dat file for inspection. + // Default is FALSE. test_fluxes = FALSE + + // iteration to carry out test. Default is 10. test_iter_num = 10 - correct_result = 0.0199217807513, 0.000626631372170, 6.97075036474e-05 - output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining + // Default is FALSE. write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + // Default is FALSE. read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. test_patch_boxes_filename = "test_inputs/test.2d.boxes" - simplify_test_boxes = TRUE + + // expected correct result + // Required if test_fluxes is FALSE. Unread otherwise. No default. + correct_result = 0.0199217807513, 0.000626631372170, 6.97075036474e-05 + + // if true will write corrct result--useful for rebaselining + // Default is FALSE. + output_correct = FALSE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Allow nonuniform workload. Default is FALSE. + use_nonuniform_workload = FALSE - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) + // Ratio of specific heats. Not read on restart. Default is 1.4. + gamma = 1.4 + // Riemann solver used in flux calculation. Must be one of + // "APPROX_RIEM_SOLVE", "EXACT_RIEM_SOLVE", "HLLC_RIEM_SOLVE". + // Default is "APPROX_RIEM_SOLVE". riemann_solve = "APPROX_RIEM_SOLVE" // riemann_solve = "EXACT_RIEM_SOLVE" // riemann_solve = "HLLC_RIEM_SOLVE" - data_problem = "STEP" + // Order of Goduov slopes (1, 2, or 4). Default is 1. + godunov_order = 4 + + // Type of finite difference approximation for 3d transverse flux + // correction. Allowed values are CORNER_TRANSPORT_1 and + // CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + // Default is "CORNER_TRANSPORT_1". + corner_transport = "CORNER_TRANSPORT_1" + + // Control of how to refine. + Refinement_data { + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, + // PRESSURE_DEVIATION, PRESSURE_GRADIENT, PRESSURE_SHOCK, or + // PRESSURE_RICHARDSON. + // Input required. No default. + refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" + + // Criteria for PRESSURE_GRADIENT refinement criteria. + PRESSURE_GRADIENT { + // Array of pressure gradient tagging tolerances, one value per level. + // If the number of levels is greater than the number of entries in + // this array then the tolerance for all finer levels is the last + // array entry. Gradients greater than this tolerance result in + // tagged cells. No default. + grad_tol = 20.0 + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 + } + + // Criteria for PRESSURE_SHOCK refinement criteria. + PRESSURE_SHOCK { + // Array of shock tagging tolerances, one value per level. If the + // number of levels is greater than the number of entries in this + // array then the tolerance for all finer levels is the last array + // entry. No default. + shock_tol = 10.0 + + // Array of shock tagging onsets, one value per level. This value is + // used to prevent unintended overrefinement of large, smooth + // gradients resulting in smooth flow. If the number of levels is + // greater than the number of entries in this array then the onset for + // all finer levels is the last array entry. No default. + shock_onset = 0.90 + + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 + } + + // PRESSURE_DEVIATION + // dev_tol + // An array of pressure deviation tolerances, one value per level. Cell + // is refined if (p - pressure_dev) > dev_tol. If the number of levels + // is greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // pressure_dev + // An array of pressure deviations, one value per level. If the number + // of levels is greater than the number of entries in this array then the + // deviation of for all finer levels is the last array entry. + // No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + + // PRESSURE_RICHARDSON + // rich_tol + // An array of tolerances on the global error. Cells in which the global + // error exceeds the tolerance are tagged. If the number of levels is + // greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + + // DENSITY_GRADIENT inputs are grad_tol, time_max, time_min and are + // analogous to those for PRESSURE_GRADIENT. + + // DENSITY_SHOCK input are shock_onset, shock_tol, time_max, time_min and + // are analogous to thos pre PRESSURE_SHOCK. + + // DENSITY_DEVIATION inputs are dev_tol, density_dev, time_max, time_min + // and are analogous to those for PRESSURE_DEVIATION. + + // DENSITY_RICHARDSON inputs are rich_tol, time_max, time_min and are + // analogous to those for PRESSURE_RICHARDSON. + } + + // General type of problem and its initial conditions. Options are "STEP", + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z". Specific Initial_data inputs vary by problem + // type. No default. + data_problem = "STEP" Initial_data { + // Initial location of front. front_position = 0.0 + // Initial conditions on one side of step. interval_0 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } + // Initial conditions on other side of step. interval_1 { density = 1.4 - velocity = 3.0 , 0.0 + velocity = 3.0 , 0.0 // vector of length dim pressure = 1.0 } } - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 20.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.90 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -101,35 +257,57 @@ Euler { } -BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE - sort_output_nodes = TRUE // Makes results repeatable. - max_box_size = 100, 100 - log_cluster_summary = TRUE - log_cluster = FALSE - barrier_before = TRUE - barrier_after = TRUE -} - Main { + // Dimension of problem. Required input. No default. dim = 2 + + + // Base name of log and viz files. Default is "unnamed". base_name = "test.2d" -// log file parameters + + + // Explicit name of log file. Default is base_name + ".log" + log_filname = "test.2d.log" + + + // If true all nodes will log to individual files. + // If false only node 0 will log. + // Default is FALSE. log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 1 // zero to turn off -// restart dump parameters - restart_interval = 1 // zero to turn off + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off. + // Default is 0. + viz_dump_interval = 1 + + // Directory in which to place viz output. + // Default is base_name + ".visit" + viz_dump_dirname = "test.2d.visit" + + // Number of processors which write to each viz file. + // Default is 1. + visit_number_procs_per_file = 1 + + + // Restart dump parameters. + + // Frequency at which to dump restart output--zero to turn off. + // Default is 0. + restart_interval = 1 + + // Directory in which to place restart output. + // Default is base_name + ".restart" + restart_write_dirname = "test.2d.restart" - plotting_interval = 0 + + // If anything but "SYNCHRONIZED" will use refined timestepping. + // Default is not "SYNCHRONIZED". +// use_refined_timestepping = "SYNCHRONIZED" } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -138,6 +316,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0) , (9,19) ], [ (10,4) , (49,19) ] @@ -145,10 +324,12 @@ CartesianGeometry { x_up = 2.5e0 , 1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 5 // Maximum number of levels in hierarchy. @@ -179,19 +360,33 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE + DEV_extend_to_domain_boundary = TRUE check_nonrefined_tags = "IGNORE" - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box sequentialize_patch_indices = TRUE // Required for plotting. check_overlapping_patches = "IGNORE" } +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_log_node_history = FALSE + sort_output_nodes = TRUE // Makes results repeatable. + max_box_size = 100, 100 + efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE +} + +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -199,20 +394,22 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 1 + DEV_report_load_balance = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } +// Refer to xfer::RefineSchedule for input RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000001.0000000 index cf7b0a3a..3fa09ee4 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000000 index 9ae47660..fba4fbfd 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000001 index d2f44d56..0697ca9d 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..96437423 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..57d4cb05 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..4c143ac6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..4160e92e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.input index 5b79ddae..241415a3 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test.3d.input @@ -1,57 +1,85 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d box) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d box) * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.0463367714649 , 0.00370820618904 , 0.000414460472703 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test.3d.boxes" - simplify_test_boxes = TRUE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 + // order of Goduov slopes (1, 2, or 4) godunov_order = 4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_2" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 0.125 - center = 0.5 , 0.5 , 0.5 + center = 0.5 , 0.5 , 0.5 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 + velocity_outside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -60,12 +88,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -169,18 +198,26 @@ Euler { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 -// restart dump parameters - restart_interval = 1 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager { print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -189,46 +226,55 @@ TimerManager { "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0,0) , (12,12,12) ] - x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. + x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. x_up = 1.e0,1.e0,1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2,2,2 - level_2 = 2,2,2 + + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 , 2 + level_2 = 2 , 2 , 2 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 + level_0 = 8, 8, 8 // all finer levels will use same values as level_0... } } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { + DEV_log_metadata_statistics = TRUE + DEV_barrier_and_time = TRUE +} +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -236,17 +282,20 @@ HyperbolicLevelIntegrator { use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } +// Refer to xfer::RefineSchedule for input RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000001.0000000 index 810593e7..58501b74 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000000 index 8ac1dfc4..a3a1d472 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000001 index c4107ff4..1e38892f 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..2c377420 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..a2ffaca0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..87d1c85f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..10d466d2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.input index ac05636d..2ab7c364 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_restart.2d.input @@ -3,53 +3,73 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (2d room) * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.602378029044, 0.0118573379806, 0.00131668704346 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_restart.2d.boxes" - simplify_test_boxes = TRUE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + // Riemann solver used in flux calculation riemann_solve = "APPROX_RIEM_SOLVE" // riemann_solve = "EXACT_RIEM_SOLVE" // riemann_solve = "HLLC_RIEM_SOLVE" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 6.0 - center = 30.0 , 30.0 + center = 30.0 , 30.0 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 density_outside = 1.0 - velocity_outside = 0.0 , 0.0 + velocity_outside = 0.0 , 0.0 // vector of length dim pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_RICHARDSON" @@ -58,7 +78,8 @@ Euler { } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "REFLECT" @@ -97,21 +118,28 @@ Euler { } Main { + // dimension of problem dim = 2 - base_name = "test_restart.2d" -// log file parameters + + // base name of log file + base_name = "test_restart.2d" + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 1 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output viz_dump_dirname = "viz-test-2d-re" -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -120,6 +148,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(59,59)] @@ -127,21 +156,23 @@ CartesianGeometry{ x_up = 60.e0 , 60.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "RICHARDSON_EXTRAPOLATION" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + level_2 = 4 , 4 + level_3 = 4 , 4 } largest_patch_size { - level_0 = 48 , 48 + level_0 = 48 , 48 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -153,18 +184,20 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box sequentialize_patch_indices = TRUE // Required for plotting. } - + +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } - + +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.1e0 // initial cfl factor @@ -172,6 +205,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -179,6 +213,7 @@ TimeRefinementIntegrator{ max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000001.0000000 index dfed6856..46bc94c7 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000000 index 6f591247..2bdca5e9 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000001 index cdc1569a..6f408556 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..a2f93582 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..02778608 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..9ac8ea29 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..9a7ab86d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.input index 516c6482..57193ce5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.2d.input @@ -3,39 +3,55 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler 2d test problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.00491625520151, 0.000664890679259, 7.29562576939e-05 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync.2d.boxes" - simplify_test_boxes = TRUE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + // Riemann solver used in flux calculation riemann_solve = "APPROX_RIEM_SOLVE" // riemann_solve = "EXACT_RIEM_SOLVE" // riemann_solve = "HLLC_RIEM_SOLVE" + // General type of problem and its initial conditions. data_problem = "STEP" - Initial_data { front_position = 0.0 interval_0 { @@ -50,6 +66,10 @@ Euler { } } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -58,12 +78,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.90 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -101,23 +122,31 @@ Euler { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "test_sync.2d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz-test-2d-sync" -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to tbox::TimerManager for input TimerManager{ print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -126,6 +155,7 @@ TimerManager{ "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0) , (9,19) ], [ (10,4) , (49,19) ] @@ -133,10 +163,12 @@ CartesianGeometry { x_up = 2.5e0 , 1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 5 // Maximum number of levels in hierarchy. @@ -148,7 +180,7 @@ PatchHierarchy { } largest_patch_size { - level_0 = 32 , 32 + level_0 = 32 , 32 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -163,35 +195,37 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - allow_patches_smaller_than_ghostwidth = TRUE allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 10 // max number of simulation timesteps regrid_interval = 2 } LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000001.0000000 index c7e66894..58c5d3a5 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000000 index 3c499a91..9e0cc6d7 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000001 index 075836f0..8778be28 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..7ab85fa2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..41bfcb48 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..e571af3a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..8f0708d5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.input index 85a4e6ec..61996534 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync.3d.input @@ -3,41 +3,65 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Euler example problem (3d box) * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.0150594507261, 0.00245085625513, 0.000514174342157 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync.3d.boxes" - simplify_test_boxes = TRUE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 + // order of Goduov slopes (1, 2, or 4) godunov_order = 4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_2" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 0.125 center = 0.5 , 0.5 , 0.5 @@ -52,6 +76,10 @@ Euler { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" @@ -60,12 +88,13 @@ Euler { } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -170,21 +199,31 @@ Euler { Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test_sync.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-3d-sync" + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output + viz_dump_dirname = "viz-test-3d-sync" -// restart dump parameters - restart_interval = 1 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to tbox::TimerManager for input TimerManager { print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -193,26 +232,30 @@ TimerManager { "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. + x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. x_up = 1.e0,1.e0,1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "GRADIENT_DETECTOR" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2,2,2 level_2 = 2,2,2 } largest_patch_size { level_0 = 19, 19, 19 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + // all finer levels will use same values as level_0... } smallest_patch_size { @@ -222,32 +265,36 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { +} +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } - -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - + +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps regrid_interval = 2 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000001.0000000 index 9cfd787f..f251c916 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000000 index 068c6bfc..63413750 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000001 index 016e5318..83e46d15 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..99a6c043 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..dda6fb62 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..1720731b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..8020cf54 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.input index c3fb6222..df3eee57 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/test_sync_restart.3d.input @@ -1,58 +1,89 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d box) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d box) * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.0150594507261, 0.00245085625513 , 0.000514174342157 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync_restart.3d.boxes" - simplify_test_boxes = TRUE } Euler { - gamma = 1.4 // gamma = Ratio of specific heats + // Ratio of specific heats + gamma = 1.4 + // order of Goduov slopes (1, 2, or 4) godunov_order = 4 - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - + // Riemann solver used in flux calculation + riemann_solve = "APPROX_RIEM_SOLVE" +// riemann_solve = "EXACT_RIEM_SOLVE" +// riemann_solve = "HLLC_RIEM_SOLVE" + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_2" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 0.125 - center = 0.5 , 0.5 , 0.5 + center = 0.5 , 0.5 , 0.5 // vector of length dim density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 + velocity_inside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_inside = 40.0 density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 + velocity_outside = 0.0 , 0.0 , 0.0 // vector of length dim pressure_outside = 1.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of DENSITY_DEVIATION, + // DENSITY_GRADIENT, DENSITY_SHOCK, DENSITY_RICHARDSON, PRESSURE_DEVIATION, + // PRESSURE_GRADIENT, PRESSURE_SHOCK, or PRESSURE_RICHARDSON. Refinement_data { + // PRESSURE_GRADIENT and PRESSURE_SHOCK criteria are applied only if + // the gradient detector is turned on in StandardTagAndInitialize + // input below... refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK", "PRESSURE_RICHARDSON" @@ -61,20 +92,18 @@ Euler { rich_tol = 0.001 } - // PRESSURE_GRADIENT and PRESSURE_SHOCK criteria are applied only if - // the gradient detector is turned on in StandardTagAndInitialize - // input below... PRESSURE_GRADIENT { grad_tol = 10.0 } PRESSURE_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "REFLECT" @@ -178,21 +207,31 @@ Euler { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test_sync_restart.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-3d-sync-re" + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output + viz_dump_dirname = "viz-test-3d-sync-re" -// restart dump parameters - restart_interval = 1 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to tbox::TimerManager for input TimerManager { print_exclusive = TRUE // output exclusive time timer_list = "apps::main::*", @@ -201,27 +240,31 @@ TimerManager { "algs::HyperbolicLevelIntegrator::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. + x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. x_up = 1.e0,1.e0,1.e0 // upper end of computational domain. } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ // tagging_method = "GRADIENT_DETECTOR" tagging_method = "RICHARDSON_EXTRAPOLATION" } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2,2,2 level_2 = 2,2,2 } largest_patch_size { level_0 = 19, 19, 19 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + // all finer levels will use same values as level_0... } smallest_patch_size { @@ -231,31 +274,35 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - +} + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..9fa5666e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..cec9f05a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..b547b42e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..de5000fc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..20d083f2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..be526ab6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..f98522b4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..d0967266 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..91158c9b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..4b264355 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..4d1662b8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..12386484 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..ba837218 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..3548e64e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..e4bac45d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..699a42f1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..f0b1ed05 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..65195470 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..399dda3c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..85ae6723 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..c0a383b1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..cdb71e24 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..09805c3e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..be22877c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..d0ff0511 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..6cc9fd9c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..44d590d7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..3b4db9ff Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..8aa455d8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..7306b436 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..dc4d8333 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..c019852b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..15c0a2a4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..9447ad37 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..2ca23bd2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..ad0c837c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..8b9e5658 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..a6682e51 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..d3754921 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..e3490723 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..640123dd Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..824598d7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC/test_sync_restart.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..863c4308 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..87eb2d0d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..5708bc89 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..422f59c9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..5170e0f6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..bf25df5c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..8855b870 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..d0324517 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..c70e20b9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..7416755b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..d12efc84 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..faa7e640 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..775da766 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..ecf2bfa6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..01373bd8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..65dd4ab2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..7cce9200 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..0f1538c0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..e9becc7f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..752308c8 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..fb8e68f1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..1c56c906 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..9b98aa15 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..3291e09b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..147e1802 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..3adf7696 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..de37fac3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..1f28c3d1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..1b641372 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..d5c28b6a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..c7481b75 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..ade7fd5f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..75d95779 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..3aca3be4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..d73e912e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..7133a1ed Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..6bb39103 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..c760d7a2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..83d04e6a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..f2f33c60 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..b267f226 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..c13487a2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/Euler/test_inputs/xlC_debug/test_sync_restart.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.C b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.C index cf7ab1fb..743ce705 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -32,7 +32,6 @@ using namespace std; #include #include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -44,11 +43,12 @@ using namespace std; #include "SAMRAI/pdat/FaceIndex.h" #include "SAMRAI/pdat/FaceVariable.h" #include "SAMRAI/hier/Index.h" -#include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/CascadePartitioner.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" //integer constants for boundary conditions @@ -117,7 +117,7 @@ LinAdv::LinAdv( const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom): - algs::HyperbolicPatchStrategy(dim), + algs::HyperbolicPatchStrategy(), d_object_name(object_name), d_dim(dim), d_grid_geometry(grid_geom), @@ -125,6 +125,8 @@ LinAdv::LinAdv( d_uval(new pdat::CellVariable(dim, "uval", 1)), d_flux(new pdat::FaceVariable(dim, "flux", 1)), d_advection_velocity(dim.getValue()), + d_source(0.0), + d_check_fluxes(false), d_godunov_order(1), d_corner_transport("CORNER_TRANSPORT_1"), d_nghosts(dim, CELLG), @@ -144,15 +146,13 @@ LinAdv::LinAdv( tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif // SPHERE problem... - tbox::MathUtilities::setArrayToSignalingNaN(&d_center[0], d_dim.getValue()); + tbox::MathUtilities::setVectorToSignalingNaN(d_center); // SINE problem - for (int k = 0; k < d_dim.getValue(); k++) d_frequency[k] = 0.; + for (int k = 0; k < d_dim.getValue(); ++k) d_frequency[k] = 0.; /* * Defaults for boundary conditions. Set to bogus values @@ -160,45 +160,45 @@ LinAdv::LinAdv( */ if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_uval.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_uval); + d_bdry_edge_uval.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_uval); } if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_uval.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_uval); + d_bdry_face_uval.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_uval); } /* @@ -242,13 +242,13 @@ LinAdv::LinAdv( * so we reset them to FLOW. */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -264,13 +264,13 @@ LinAdv::LinAdv( } } if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + for (int i = 0; i < NUM_3D_FACES; ++i) { if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_face_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; } @@ -288,7 +288,7 @@ LinAdv::LinAdv( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -308,7 +308,7 @@ LinAdv::LinAdv( } - F77_FUNC(stufprobc, STUFPROBC) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, + SAMRAI_F77_FUNC(stufprobc, STUFPROBC) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SINE_CONSTANT_X, SINE_CONSTANT_Y, SINE_CONSTANT_Z, SPHERE, CELLG, FACEG, FLUXG); @@ -340,10 +340,8 @@ void LinAdv::registerModelVariables( algs::HyperbolicLevelIntegrator* integrator) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(integrator != (algs::HyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); -#endif integrator->registerVariable(d_uval, d_nghosts, algs::HyperbolicLevelIntegrator::TIME_DEP, @@ -372,7 +370,7 @@ void LinAdv::registerModelVariables( #ifdef HAVE_HDF5 if (!d_visit_writer) { TBOX_WARNING(d_object_name << ": registerModelVariables()" - << "\nVisit data writer was not registered.\n" + << "\nVisIt data writer was not registered.\n" << "Consequently, no plot data will" << "\nbe written." << endl); } @@ -398,11 +396,13 @@ void LinAdv::setupLoadBalancer( const hier::IntVector& zero_vec = hier::IntVector::getZero(d_dim); hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); + hier::PatchDataRestartManager* pdrm = + hier::PatchDataRestartManager::getManager(); if (d_use_nonuniform_workload && gridding_algorithm) { - boost::shared_ptr load_balancer( - gridding_algorithm->getLoadBalanceStrategy(), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr load_balancer( + boost::dynamic_pointer_cast( + gridding_algorithm->getLoadBalanceStrategy())); if (load_balancer) { d_workload_variable.reset( new pdat::CellVariable( @@ -414,7 +414,7 @@ void LinAdv::setupLoadBalancer( vardb->getContext("WORKLOAD"), zero_vec); load_balancer->setWorkloadPatchDataIndex(d_workload_data_id); - vardb->registerPatchDataForRestart(d_workload_data_id); + pdrm->registerPatchDataForRestart(d_workload_data_id); } else { TBOX_WARNING( d_object_name << ": " @@ -450,28 +450,28 @@ void LinAdv::initializeDataOnPatch( if (initial_time) { const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* xlo = pgeom->getXLower(); const double* xhi = pgeom->getXUpper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif + hier::IntVector ghost_cells(uval->getGhostCellWidth()); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); - if ((d_data_problem_int == SPHERE)) { + if (d_data_problem_int == SPHERE) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(initsphere2d, INITSPHERE2D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -483,7 +483,7 @@ void LinAdv::initializeDataOnPatch( &d_center[0], d_radius); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(initsphere3d, INITSPHERE3D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -504,12 +504,12 @@ void LinAdv::initializeDataOnPatch( const double* domain_xlo = d_grid_geometry->getXLower(); const double* domain_xhi = d_grid_geometry->getXUpper(); std::vector domain_length(d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { domain_length[i] = domain_xhi[i] - domain_xlo[i]; } if (d_dim == tbox::Dimension(2)) { - F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) (d_data_problem_int, + SAMRAI_F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) (d_data_problem_int, dx, xlo, domain_xlo, &domain_length[0], ifirst(0), ilast(0), @@ -518,13 +518,13 @@ void LinAdv::initializeDataOnPatch( ghost_cells(1), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer(), + &d_front_position[0], + &d_interval_uval[0], d_amplitude, &d_frequency[0]); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) (d_data_problem_int, + SAMRAI_F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) (d_data_problem_int, dx, xlo, domain_xlo, &domain_length[0], ifirst(0), ilast(0), @@ -535,15 +535,15 @@ void LinAdv::initializeDataOnPatch( ghost_cells(2), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer(), + &d_front_position[0], + &d_interval_uval[0], d_amplitude, &d_frequency[0]); } } else { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(linadvinit2d, LINADVINIT2D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(linadvinit2d, LINADVINIT2D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -551,11 +551,11 @@ void LinAdv::initializeDataOnPatch( ghost_cells(1), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); + &d_front_position[0], + &d_interval_uval[0]); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(linadvinit3d, LINADVINIT3D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(linadvinit3d, LINADVINIT3D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -565,8 +565,8 @@ void LinAdv::initializeDataOnPatch( ghost_cells(2), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); + &d_front_position[0], + &d_interval_uval[0]); } } @@ -577,9 +577,15 @@ void LinAdv::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); - workload_data->fillAll(1.0); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); + + const hier::Box& box = patch.getBox(); + const hier::BoxId& box_id = box.getBoxId(); + const hier::LocalId& local_id = box_id.getLocalId(); + double id_val = local_id.getValue() % 2 ? static_cast(local_id.getValue() % 10) : 0.0; + workload_data->fillAll(1.0+id_val); } } @@ -601,35 +607,33 @@ double LinAdv::computeStableDtOnPatch( NULL_USE(dt_time); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif + hier::IntVector ghost_cells(uval->getGhostCellWidth()); double stabdt; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(stabledt2d, STABLEDT2D) (dx, + SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), ghost_cells(1), &d_advection_velocity[0], - uval->getPointer(), stabdt); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(stabledt3d, STABLEDT3D) (dx, + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -637,8 +641,10 @@ double LinAdv::computeStableDtOnPatch( ghost_cells(1), ghost_cells(2), &d_advection_velocity[0], - uval->getPointer(), stabdt); + } else { + TBOX_ERROR("Only 2D or 3D allowed in LinAdv::computeStableDtOnPatch"); + stabdt = 0; } return stabdt; @@ -671,39 +677,37 @@ void LinAdv::computeFluxesOnPatch( } + hier::Box pbox = patch.getBox(); + + boost::shared_ptr > flux( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); + TBOX_ASSERT(flux); + if (d_dim < tbox::Dimension(3)) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); - hier::Box pbox = patch.getBox(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); - + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); /* * Verify that the integrator providing the context correctly * created it, and that the ghost cell width associated with the * context matches the ghosts defined in this class... */ -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); - TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -712,7 +716,7 @@ void LinAdv::computeFluxesOnPatch( pdat::FaceData traced_right(pbox, 1, d_nghosts); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), uval->getPointer(), traced_left.getPointer(0), @@ -730,17 +734,17 @@ void LinAdv::computeFluxesOnPatch( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -749,28 +753,26 @@ void LinAdv::computeFluxesOnPatch( * Output: w^L, w^R */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, + SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[0], d_advection_velocity[0], d_godunov_order, - uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, + SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, - uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } } // if (d_godunov_order > 1) ... @@ -784,10 +786,9 @@ void LinAdv::computeFluxesOnPatch( // fluxcalculation_(dt,*,1,dx, to get artificial viscosity // fluxcalculation_(dt,*,0,dx, to get NO artificial viscosity - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), traced_left.getPointer(0), @@ -800,10 +801,9 @@ void LinAdv::computeFluxesOnPatch( * Inputs: F (flux) * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec, FLUXCORREC) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), dx, &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), traced_left.getPointer(0), @@ -818,10 +818,9 @@ void LinAdv::computeFluxesOnPatch( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), traced_left.getPointer(0), @@ -830,9 +829,34 @@ void LinAdv::computeFluxesOnPatch( traced_right.getPointer(1)); } + } -// tbox::plog << "flux values: option1...." << endl; -// flux->print(pbox, tbox::plog); + if (d_check_fluxes) { + + /* + * This is used for testing time-refinement. In the associated + * test case, there should be no net fluxes, as the exact + * solution is u=t. + */ + + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { + + const pdat::CellIndex& ci(*ic); + for (int dir = 0; dir < d_dim.getValue(); dir++) { + + pdat::FaceIndex fm(ci, dir, pdat::FaceIndex::Lower); + pdat::FaceIndex fp(ci, dir, pdat::FaceIndex::Upper); + + double delta = (*flux)(fm) - (*flux)(fp); + if (fabs(delta) > 1.e-10) { + tbox::perr << "\nLinAdv Time Refinement Test FAILED: \n" + << " found non-zero net fluxes" << endl; + } + } + } + } } @@ -849,14 +873,13 @@ void LinAdv::compute3DFluxesWithCornerTransport1( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); TBOX_ASSERT(d_dim == tbox::Dimension(3)); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -864,18 +887,16 @@ void LinAdv::compute3DFluxesWithCornerTransport1( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -886,7 +907,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( pdat::FaceData temp_traced_left(pbox, 1, d_nghosts); pdat::FaceData temp_traced_right(pbox, 1, d_nghosts); - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -911,17 +932,17 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -929,44 +950,41 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[0], d_advection_velocity[0], d_godunov_order, - uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, - uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[2], d_advection_velocity[2], d_godunov_order, - uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } /* @@ -978,10 +996,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( // fluxcalculation_(dt,*,*,1,dx, to do artificial viscosity // fluxcalculation_(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -998,10 +1015,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], 1, - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1026,10 +1042,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_traced_left/right * Output: temp_flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), temp_flux.getPointer(0), temp_flux.getPointer(1), temp_flux.getPointer(2), @@ -1046,10 +1061,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], -1, - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1077,10 +1091,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_traced_left/right * Output: flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1098,10 +1111,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_flux, flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], - uval->getPointer(), temp_flux.getPointer(0), temp_flux.getPointer(1), temp_flux.getPointer(2), @@ -1119,10 +1131,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1152,14 +1163,13 @@ void LinAdv::compute3DFluxesWithCornerTransport2( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); TBOX_ASSERT(d_dim == tbox::Dimension(3)); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1167,18 +1177,16 @@ void LinAdv::compute3DFluxesWithCornerTransport2( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1191,7 +1199,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( /* * Initialize trace fluxes (w^R and w^L) with cell-centered values. */ - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1212,10 +1220,9 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1236,17 +1243,17 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to update traces w^L and @@ -1254,45 +1261,42 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[0], d_advection_velocity[0], d_godunov_order, - uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, - uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[2], d_advection_velocity[2], d_godunov_order, - uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { /* * Approximate traces at cell centers (in idir direction) - denoted @@ -1300,7 +1304,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: F (flux) * Output: third_state */ - F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, + SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1315,10 +1319,9 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Output: temp_flux (only two directions (i.e. those other than idir) * are modified) */ - F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), third_state.getPointer(), temp_flux.getPointer(0), temp_flux.getPointer(1), @@ -1331,10 +1334,9 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: temp_flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), temp_flux.getPointer(0), temp_flux.getPointer(1), temp_flux.getPointer(2), @@ -1354,10 +1356,9 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], - uval->getPointer(), flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), @@ -1392,42 +1393,43 @@ void LinAdv::conservativeDifferenceOnPatch( NULL_USE(at_syncronization); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif if (d_dim == tbox::Dimension(2)) { - F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), dx, flux->getPointer(0), flux->getPointer(1), &d_advection_velocity[0], + d_source*dt, uval->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, flux->getPointer(0), flux->getPointer(1), flux->getPointer(2), &d_advection_velocity[0], + d_source*dt, uval->getPointer()); } @@ -1453,10 +1455,13 @@ void LinAdv::boundaryReset( bool bdry_cell = true; const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); hier::BoxContainer domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); + d_grid_geometry->computePhysicalDomain(domain_boxes, + patch_geom->getRatio(), + hier::BlockId::zero()); pdat::CellIndex icell(ifirst); hier::BoxContainer bdrybox; @@ -1465,7 +1470,7 @@ void LinAdv::boundaryReset( int bdry_case = 0; int bside; - for (idir = 0; idir < d_dim.getValue(); idir++) { + for (idir = 0; idir < d_dim.getValue(); ++idir) { ibfirst(idir) = ifirst(idir) - 1; iblast(idir) = ifirst(idir) - 1; bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); @@ -1475,8 +1480,8 @@ void LinAdv::boundaryReset( bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); } - hier::BoxContainer::iterator ib(bdrybox); - for (idir = 0; idir < d_dim.getValue(); idir++) { + hier::BoxContainer::iterator ib = bdrybox.begin(); + for (idir = 0; idir < d_dim.getValue(); ++idir) { bside = 2 * idir; if (d_dim == tbox::Dimension(2)) { bdry_case = d_scalar_bdry_edge_conds[bside]; @@ -1485,9 +1490,11 @@ void LinAdv::boundaryReset( bdry_case = d_scalar_bdry_face_conds[bside]; } if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*ib, false); - for (pdat::CellIterator ic(*ib, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); domain_boxes_itr != domain_boxes.end(); ++domain_boxes_itr) { if (domain_boxes_itr->contains(*ic)) @@ -1509,9 +1516,11 @@ void LinAdv::boundaryReset( bdry_case = d_scalar_bdry_face_conds[bnode]; } if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*ib, false); - for (pdat::CellIterator ic(*ib, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); domain_boxes_itr != domain_boxes.end(); ++domain_boxes_itr) { if (domain_boxes_itr->contains(*ic)) @@ -1546,16 +1555,14 @@ void LinAdv::setPhysicalBoundaryConditions( NULL_USE(fill_time); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif + hier::IntVector ghost_cells(uval->getGhostCellWidth()); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); -#endif + + TBOX_ASSERT(ghost_cells == d_nghosts); if (d_dim == tbox::Dimension(2)) { @@ -1675,14 +1682,12 @@ void LinAdv::tagRichardsonExtrapolationCells( { NULL_USE(initial_error); - const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); hier::Box pbox = patch.getBox(); boost::shared_ptr > tags( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); /* * Possible tagging criteria includes @@ -1693,31 +1698,30 @@ void LinAdv::tagRichardsonExtrapolationCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; - boost::shared_ptr > coarsened_fine_var; - boost::shared_ptr > advanced_coarse_var; int size; double tol; bool time_allowed; if (ref == "UVAL_RICHARDSON") { - coarsened_fine_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_uval, coarsened_fine)); - advanced_coarse_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_uval, advanced_coarse)); - size = d_rich_tol.getSize(); + boost::shared_ptr > coarsened_fine_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, coarsened_fine)); + boost::shared_ptr > advanced_coarse_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, advanced_coarse)); + size = static_cast(d_rich_tol.size()); tol = ((error_level_number < size) ? d_rich_tol[error_level_number] : d_rich_tol[size - 1]); - size = d_rich_time_min.getSize(); + size = static_cast(d_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_rich_time_min[error_level_number] : d_rich_time_min[size - 1]); - size = d_rich_time_max.getSize(); + size = static_cast(d_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_rich_time_max[error_level_number] : d_rich_time_max[size - 1]); @@ -1725,10 +1729,8 @@ void LinAdv::tagRichardsonExtrapolationCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(coarsened_fine_var); TBOX_ASSERT(advanced_coarse_var); -#endif /* * We tag wherever the global error > specified tolerance * (i.e. d_rich_tol). The estimated global error is the @@ -1746,7 +1748,7 @@ void LinAdv::tagRichardsonExtrapolationCells( const double* xdomainhi = d_grid_geometry->getXUpper(); double max_length = 0.; double max_wave_speed = 0.; - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { double length = xdomainhi[idir] - xdomainlo[idir]; if (length > max_length) max_length = length; @@ -1774,8 +1776,9 @@ void LinAdv::tagRichardsonExtrapolationCells( double diff = 0.; double error = 0.; - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { /* * Compute error norm @@ -1819,8 +1822,9 @@ void LinAdv::tagRichardsonExtrapolationCells( * use this information in the gradient detector. */ if (!uses_gradient_detector_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*tags)(*ic, 0) = TRUE; @@ -1853,22 +1857,26 @@ void LinAdv::tagGradientDetectorCells( const int error_level_number = patch.getPatchLevelNumber(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); + TBOX_ASSERT(tags); hier::Box pbox(patch.getBox()); hier::BoxContainer domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); + d_grid_geometry->computePhysicalDomain(domain_boxes, + patch_geom->getRatio(), + hier::BlockId::zero()); /* * Construct domain bounding box */ hier::Box domain(d_dim); - for (hier::BoxContainer::iterator i(domain_boxes); + for (hier::BoxContainer::iterator i = domain_boxes.begin(); i != domain_boxes.end(); ++i) { domain += *i; } @@ -1899,15 +1907,15 @@ void LinAdv::tagGradientDetectorCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > var( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); TBOX_ASSERT(var); -#endif + hier::IntVector vghost(var->getGhostCellWidth()); hier::IntVector tagghost(tags->getGhostCellWidth()); @@ -1916,20 +1924,38 @@ void LinAdv::tagGradientDetectorCells( double onset = 0.; bool time_allowed = false; + if (ref == "RANDOM") { + + /* + * Tag with random frequency set by d_threshold. + */ + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { + + double u = rand()/double(RAND_MAX); + + (*temp_tags)(*ic, 0) = not_refine_tag_val; + if (u < d_threshold) { + (*temp_tags)(*ic, 0) = refine_tag_val; + } + } + } + if (ref == "UVAL_DEVIATION") { - size = d_dev_tol.getSize(); + size = static_cast(d_dev_tol.size()); tol = ((error_level_number < size) ? d_dev_tol[error_level_number] : d_dev_tol[size - 1]); - size = d_dev.getSize(); + size = static_cast(d_dev.size()); double dev = ((error_level_number < size) ? d_dev[error_level_number] : d_dev[size - 1]); - size = d_dev_time_min.getSize(); + size = static_cast(d_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_dev_time_min[error_level_number] : d_dev_time_min[size - 1]); - size = d_dev_time_max.getSize(); + size = static_cast(d_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_dev_time_max[error_level_number] : d_dev_time_max[size - 1]); @@ -1943,8 +1969,9 @@ void LinAdv::tagGradientDetectorCells( * RICHARDSON_NEWLY_TAGGED since these were set most recently * by Richardson extrapolation. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { double locden = tol; int tag_val = (*tags)(*ic, 0); if (tag_val) { @@ -1961,15 +1988,15 @@ void LinAdv::tagGradientDetectorCells( } if (ref == "UVAL_GRADIENT") { - size = d_grad_tol.getSize(); + size = static_cast(d_grad_tol.size()); tol = ((error_level_number < size) ? d_grad_tol[error_level_number] : d_grad_tol[size - 1]); - size = d_grad_time_min.getSize(); + size = static_cast(d_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_grad_time_min[error_level_number] : d_grad_time_min[size - 1]); - size = d_grad_time_max.getSize(); + size = static_cast(d_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_grad_time_max[error_level_number] : d_grad_time_max[size - 1]); @@ -1978,7 +2005,7 @@ void LinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectgrad2d, DETECTGRAD2D) ( + SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -1989,7 +2016,7 @@ void LinAdv::tagGradientDetectorCells( tags->getPointer(), temp_tags->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectgrad3d, DETECTGRAD3D) ( + SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2005,19 +2032,19 @@ void LinAdv::tagGradientDetectorCells( } if (ref == "UVAL_SHOCK") { - size = d_shock_tol.getSize(); + size = static_cast(d_shock_tol.size()); tol = ((error_level_number < size) ? d_shock_tol[error_level_number] : d_shock_tol[size - 1]); - size = d_shock_onset.getSize(); + size = static_cast(d_shock_onset.size()); onset = ((error_level_number < size) ? d_shock_onset[error_level_number] : d_shock_onset[size - 1]); - size = d_shock_time_min.getSize(); + size = static_cast(d_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_shock_time_min[error_level_number] : d_shock_time_min[size - 1]); - size = d_shock_time_max.getSize(); + size = static_cast(d_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_shock_time_max[error_level_number] : d_shock_time_max[size - 1]); @@ -2026,7 +2053,7 @@ void LinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectshock2d, DETECTSHOCK2D) ( + SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2038,7 +2065,7 @@ void LinAdv::tagGradientDetectorCells( tags->getPointer(), temp_tags->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectshock3d, DETECTSHOCK3D) ( + SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2062,8 +2089,9 @@ void LinAdv::tagGradientDetectorCells( * to be the designated "refine_tag_val". */ if (uses_richardson_extrapolation_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*temp_tags)(*ic, 0) = refine_tag_val; @@ -2074,8 +2102,9 @@ void LinAdv::tagGradientDetectorCells( /* * Update tags. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2094,9 +2123,7 @@ void LinAdv::tagGradientDetectorCells( void LinAdv::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -2122,8 +2149,9 @@ void LinAdv::printClassData( os << "Parameters for numerical method ..." << endl; os << " d_advection_velocity = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_advection_velocity[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_advection_velocity[j] << " "; os << endl; + os << " d_source = " << d_source << endl; os << " d_godunov_order = " << d_godunov_order << endl; os << " d_corner_transport = " << d_corner_transport << endl; os << " d_nghosts = " << d_nghosts << endl; @@ -2135,25 +2163,25 @@ void LinAdv::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_uval_inside = " << d_uval_inside << endl; os << " d_uval_outside = " << d_uval_outside << endl; os << " d_number_of_intervals = " << d_number_of_intervals << endl; os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { + for (k = 0; k < d_number_of_intervals - 1; ++k) { os << d_front_position[k] << " "; } os << endl; os << " d_interval_uval = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_uval[k] << endl; } os << " Boundary condition data " << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { @@ -2162,7 +2190,7 @@ void LinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " @@ -2170,7 +2198,7 @@ void LinAdv::printClassData( } } if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { @@ -2179,14 +2207,14 @@ void LinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " @@ -2196,76 +2224,76 @@ void LinAdv::printClassData( os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_tol.size()); ++j) { os << " d_dev_tol[" << j << "] = " << d_dev_tol[j] << endl; } - for (j = 0; j < d_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_dev.size()); ++j) { os << " d_dev[" << j << "] = " << d_dev[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_max.size()); ++j) { os << " d_dev_time_max[" << j << "] = " << d_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_min.size()); ++j) { os << " d_dev_time_min[" << j << "] = " << d_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_tol.size()); ++j) { os << " d_grad_tol[" << j << "] = " << d_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_max.size()); ++j) { os << " d_grad_time_max[" << j << "] = " << d_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_min.size()); ++j) { os << " d_grad_time_min[" << j << "] = " << d_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_onset.size()); ++j) { os << " d_shock_onset[" << j << "] = " << d_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_tol.size()); ++j) { os << " d_shock_tol[" << j << "] = " << d_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_max.size()); ++j) { os << " d_shock_time_max[" << j << "] = " << d_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_min.size()); ++j) { os << " d_shock_time_min[" << j << "] = " << d_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_tol.size()); ++j) { os << " d_rich_tol[" << j << "] = " << d_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_max.size()); ++j) { os << " d_rich_time_max[" << j << "] = " << d_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_min.size()); ++j) { os << " d_rich_time_min[" << j << "] = " << d_rich_time_min[j] << endl; } @@ -2282,12 +2310,10 @@ void LinAdv::printClassData( ************************************************************************* */ void LinAdv::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); /* * Note: if we are restarting, then we only allow nonuniform @@ -2295,17 +2321,17 @@ void LinAdv::getFromInput( */ if (!is_from_restart) { d_use_nonuniform_workload = - db->getBoolWithDefault("use_nonuniform_workload", + input_db->getBoolWithDefault("use_nonuniform_workload", d_use_nonuniform_workload); } else { if (d_use_nonuniform_workload) { d_use_nonuniform_workload = - db->getBool("use_nonuniform_workload"); + input_db->getBool("use_nonuniform_workload"); } } - if (db->keyExists("advection_velocity")) { - db->getDoubleArray("advection_velocity", + if (input_db->keyExists("advection_velocity")) { + input_db->getDoubleArray("advection_velocity", &d_advection_velocity[0], d_dim.getValue()); } else { TBOX_ERROR( @@ -2313,8 +2339,15 @@ void LinAdv::getFromInput( << "Key data `advection_velocity' not found in input."); } - if (db->keyExists("godunov_order")) { - d_godunov_order = db->getInteger("godunov_order"); + + /* + /* Used for testing, in particular time refinement + */ + d_source = input_db->getDoubleWithDefault("source", 0.0); + d_check_fluxes = input_db->getBoolWithDefault("check_fluxes", false); + + if (input_db->keyExists("godunov_order")) { + d_godunov_order = input_db->getInteger("godunov_order"); if ((d_godunov_order != 1) && (d_godunov_order != 2) && (d_godunov_order != 4)) { @@ -2323,12 +2356,12 @@ void LinAdv::getFromInput( << "`godunov_order' in input must be 1, 2, or 4." << endl); } } else { - d_godunov_order = db->getIntegerWithDefault("d_godunov_order", + d_godunov_order = input_db->getIntegerWithDefault("d_godunov_order", d_godunov_order); } - if (db->keyExists("corner_transport")) { - d_corner_transport = db->getString("corner_transport"); + if (input_db->keyExists("corner_transport")) { + d_corner_transport = input_db->getString("corner_transport"); if ((d_corner_transport != "CORNER_TRANSPORT_1") && (d_corner_transport != "CORNER_TRANSPORT_2")) { TBOX_ERROR( @@ -2337,19 +2370,18 @@ void LinAdv::getFromInput( << " 'CORNER_TRANSPORT_1' or 'CORNER_TRANSPORT_2'." << endl); } } else { - d_corner_transport = db->getStringWithDefault("corner_transport", + d_corner_transport = input_db->getStringWithDefault("corner_transport", d_corner_transport); } - if (db->keyExists("Refinement_data")) { + if (input_db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( - db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + input_db->getDatabase("Refinement_data")); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -2357,10 +2389,10 @@ void LinAdv::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -2368,6 +2400,7 @@ void LinAdv::getFromInput( if (!(error_key == "refine_criteria")) { if (!(error_key == "UVAL_DEVIATION" || + error_key == "RANDOM" || error_key == "UVAL_GRADIENT" || error_key == "UVAL_SHOCK" || error_key == "UVAL_RICHARDSON")) { @@ -2379,14 +2412,17 @@ void LinAdv::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } + if (error_db && error_key == "RANDOM") { + d_threshold = error_db->getDoubleWithDefault("threshold", 0.01); + } + if (error_db && error_key == "UVAL_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2395,8 +2431,7 @@ void LinAdv::getFromInput( } if (error_db->keyExists("uval_dev")) { - d_dev = - error_db->getDoubleArray("uval_dev"); + d_dev = error_db->getDoubleVector("uval_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -2405,18 +2440,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_dev_time_max = - error_db->getDoubleArray("time_max"); + d_dev_time_max = error_db->getDoubleVector("time_max"); } else { - d_dev_time_max.resizeArray(1); + d_dev_time_max.resize(1); d_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_dev_time_min = - error_db->getDoubleArray("time_min"); + d_dev_time_min = error_db->getDoubleVector("time_min"); } else { - d_dev_time_min.resizeArray(1); + d_dev_time_min.resize(1); d_dev_time_min[0] = 0.; } @@ -2425,8 +2458,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2435,18 +2467,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_grad_time_max = - error_db->getDoubleArray("time_max"); + d_grad_time_max = error_db->getDoubleVector("time_max"); } else { - d_grad_time_max.resizeArray(1); + d_grad_time_max.resize(1); d_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_grad_time_min = - error_db->getDoubleArray("time_min"); + d_grad_time_min = error_db->getDoubleVector("time_min"); } else { - d_grad_time_min.resizeArray(1); + d_grad_time_min.resize(1); d_grad_time_min[0] = 0.; } @@ -2455,8 +2485,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_SHOCK") { if (error_db->keyExists("shock_onset")) { - d_shock_onset = - error_db->getDoubleArray("shock_onset"); + d_shock_onset = error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -2465,8 +2494,7 @@ void LinAdv::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2475,18 +2503,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_shock_time_max = - error_db->getDoubleArray("time_max"); + d_shock_time_max = error_db->getDoubleVector("time_max"); } else { - d_shock_time_max.resizeArray(1); + d_shock_time_max.resize(1); d_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_shock_time_min = - error_db->getDoubleArray("time_min"); + d_shock_time_min = error_db->getDoubleVector("time_min"); } else { - d_shock_time_min.resizeArray(1); + d_shock_time_min.resize(1); d_shock_time_min[0] = 0.; } @@ -2495,8 +2521,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2505,18 +2530,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_rich_time_max = - error_db->getDoubleArray("time_max"); + d_rich_time_max = error_db->getDoubleVector("time_max"); } else { - d_rich_time_max.resizeArray(1); + d_rich_time_max.resize(1); d_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_rich_time_min = - error_db->getDoubleArray("time_min"); + d_rich_time_min = error_db->getDoubleVector("time_min"); } else { - d_rich_time_min.resizeArray(1); + d_rich_time_min.resize(1); d_rich_time_min[0] = 0.; } @@ -2529,10 +2552,11 @@ void LinAdv::getFromInput( /* * Check that input is found for each string identifier in key list. */ - for (int k0 = 0; k0 < d_refinement_criteria.getSize(); k0++) { + for (int k0 = 0; + k0 < static_cast(d_refinement_criteria.size()); ++k0) { string use_key = d_refinement_criteria[k0]; bool key_found = false; - for (int k1 = 0; k1 < def_key_cnt; k1++) { + for (int k1 = 0; k1 < def_key_cnt; ++k1) { string def_key = ref_keys_defined[k1]; if (def_key == use_key) key_found = true; } @@ -2548,8 +2572,8 @@ void LinAdv::getFromInput( if (!is_from_restart) { - if (db->keyExists("data_problem")) { - d_data_problem = db->getString("data_problem"); + if (input_db->keyExists("data_problem")) { + d_data_problem = input_db->getString("data_problem"); } else { TBOX_ERROR( d_object_name << ": " @@ -2557,13 +2581,13 @@ void LinAdv::getFromInput( << endl); } - if (!db->keyExists("Initial_data")) { + if (!input_db->keyExists("Initial_data")) { TBOX_ERROR( d_object_name << ": " << "No `Initial_data' database found in input." << endl); } boost::shared_ptr init_data_db( - db->getDatabase("Initial_data")); + input_db->getDatabase("Initial_data")); bool found_problem_data = false; @@ -2577,7 +2601,7 @@ void LinAdv::getFromInput( << "`radius' input required for SPHERE problem." << endl); } if (init_data_db->keyExists("center")) { - init_data_db->getDoubleArray("center", &d_center[0], d_dim.getValue()); + d_center = init_data_db->getDoubleVector("center"); } else { TBOX_ERROR( d_object_name << ": " @@ -2630,10 +2654,10 @@ void LinAdv::getFromInput( idir = 2; } - tbox::Array init_data_keys = init_data_db->getAllKeys(); + std::vector init_data_keys = init_data_db->getAllKeys(); if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); + d_front_position = init_data_db->getDoubleVector("front_position"); } else { TBOX_ERROR(d_object_name << ": " << "`front_position' input required for " @@ -2641,14 +2665,14 @@ void LinAdv::getFromInput( } d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); + tbox::MathUtilities::Min(static_cast(d_front_position.size()) + 1, + static_cast(init_data_keys.size()) - 1); - d_front_position.resizeArray(d_front_position.getSize() + 1); - d_front_position[d_front_position.getSize() - 1] = + d_front_position.resize(static_cast(d_front_position.size()) + 1); + d_front_position[static_cast(d_front_position.size()) - 1] = d_grid_geometry->getXUpper()[idir]; - d_interval_uval.resizeArray(d_number_of_intervals); + d_interval_uval.resize(d_number_of_intervals); int i = 0; int nkey = 0; @@ -2656,7 +2680,7 @@ void LinAdv::getFromInput( while (!found_interval_data && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { + && (nkey < static_cast(init_data_keys.size()))) { if (!(init_data_keys[nkey] == "front_position")) { @@ -2670,13 +2694,13 @@ void LinAdv::getFromInput( << "`uval' data missing in input for key = " << init_data_keys[nkey] << endl); } - i++; + ++i; found_interval_data = (i == d_number_of_intervals); } - nkey++; + ++nkey; } @@ -2717,24 +2741,24 @@ void LinAdv::getFromInput( const hier::IntVector& one_vec = hier::IntVector::getOne(d_dim); hier::IntVector periodic(d_grid_geometry->getPeriodicShift(one_vec)); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } - if (db->keyExists("Boundary_data")) { + if (input_db->keyExists("Boundary_data")) { boost::shared_ptr bdry_db( - db->getDatabase("Boundary_data")); + input_db->getDatabase("Boundary_data")); if (d_dim == tbox::Dimension(2)) { - appu::CartesianBoundaryUtilities2::readBoundaryInput(this, + appu::CartesianBoundaryUtilities2::getFromInput(this, bdry_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); } if (d_dim == tbox::Dimension(3)) { - appu::CartesianBoundaryUtilities3::readBoundaryInput(this, + appu::CartesianBoundaryUtilities3::getFromInput(this, bdry_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, @@ -2758,29 +2782,31 @@ void LinAdv::getFromInput( ************************************************************************* */ -void LinAdv::putToDatabase( - const boost::shared_ptr& db) const +void LinAdv::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("LINADV_VERSION", LINADV_VERSION); + restart_db->putInteger("LINADV_VERSION", LINADV_VERSION); - db->putDoubleArray("d_advection_velocity", &d_advection_velocity[0], d_dim.getValue()); + restart_db->putDoubleVector("d_advection_velocity", d_advection_velocity); + restart_db->putDouble("d_source", d_source); + restart_db->putBool("d_check_fluxes", d_check_fluxes); - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", &d_center[0], d_dim.getValue()); - db->putDouble("d_uval_inside", d_uval_inside); - db->putDouble("d_uval_outside", d_uval_outside); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleVector("d_center", d_center); + restart_db->putDouble("d_uval_inside", d_uval_inside); + restart_db->putDouble("d_uval_outside", d_uval_outside); } if ((d_data_problem == "PIECEWISE_CONSTANT_X") || @@ -2789,47 +2815,51 @@ void LinAdv::putToDatabase( (d_data_problem == "SINE_CONSTANT_X") || (d_data_problem == "SINE_CONSTANT_Y") || (d_data_problem == "SINE_CONSTANT_Z")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); + restart_db->putInteger("d_number_of_intervals", d_number_of_intervals); if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_uval", d_interval_uval); + restart_db->putDoubleVector("d_front_position", d_front_position); + restart_db->putDoubleVector("d_interval_uval", d_interval_uval); } } - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putIntegerVector("d_scalar_bdry_edge_conds", + d_scalar_bdry_edge_conds); + restart_db->putIntegerVector("d_scalar_bdry_node_conds", + d_scalar_bdry_node_conds); if (d_dim == tbox::Dimension(2)) { - db->putDoubleArray("d_bdry_edge_uval", d_bdry_edge_uval); + restart_db->putDoubleVector("d_bdry_edge_uval", d_bdry_edge_uval); } if (d_dim == tbox::Dimension(3)) { - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_uval", d_bdry_face_uval); + restart_db->putIntegerVector("d_scalar_bdry_face_conds", + d_scalar_bdry_face_conds); + restart_db->putDoubleVector("d_bdry_face_uval", d_bdry_face_uval); } - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - db->putDoubleArray("d_dev_tol", d_dev_tol); - db->putDoubleArray("d_dev", d_dev); - db->putDoubleArray("d_dev_time_max", d_dev_time_max); - db->putDoubleArray("d_dev_time_min", d_dev_time_min); + restart_db->putDoubleVector("d_dev_tol", d_dev_tol); + restart_db->putDoubleVector("d_dev", d_dev); + restart_db->putDoubleVector("d_dev_time_max", d_dev_time_max); + restart_db->putDoubleVector("d_dev_time_min", d_dev_time_min); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - db->putDoubleArray("d_grad_tol", d_grad_tol); - db->putDoubleArray("d_grad_time_max", d_grad_time_max); - db->putDoubleArray("d_grad_time_min", d_grad_time_min); + restart_db->putDoubleVector("d_grad_tol", d_grad_tol); + restart_db->putDoubleVector("d_grad_time_max", d_grad_time_max); + restart_db->putDoubleVector("d_grad_time_min", d_grad_time_min); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - db->putDoubleArray("d_shock_onset", d_shock_onset); - db->putDoubleArray("d_shock_tol", d_shock_tol); - db->putDoubleArray("d_shock_time_max", d_shock_time_max); - db->putDoubleArray("d_shock_time_min", d_shock_time_min); + restart_db->putDoubleVector("d_shock_onset", d_shock_onset); + restart_db->putDoubleVector("d_shock_tol", d_shock_tol); + restart_db->putDoubleVector("d_shock_time_max", d_shock_time_max); + restart_db->putDoubleVector("d_shock_time_min", d_shock_time_min); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - db->putDoubleArray("d_rich_tol", d_rich_tol); - db->putDoubleArray("d_rich_time_max", d_rich_time_max); - db->putDoubleArray("d_rich_time_min", d_rich_time_min); + restart_db->putDoubleVector("d_rich_tol", d_rich_tol); + restart_db->putDoubleVector("d_rich_time_max", d_rich_time_max); + restart_db->putDoubleVector("d_rich_time_min", d_rich_time_min); } } @@ -2861,7 +2891,9 @@ void LinAdv::getFromRestart() << "Restart file version different than class version."); } - db->getDoubleArray("d_advection_velocity", &d_advection_velocity[0], d_dim.getValue()); + d_advection_velocity = db->getDoubleVector("d_advection_velocity"); + d_source = db->getDouble("d_source"); + d_check_fluxes = db->getBool("d_check_fluxes"); d_godunov_order = db->getInteger("d_godunov_order"); d_corner_transport = db->getString("d_corner_transport"); @@ -2886,7 +2918,7 @@ void LinAdv::getFromRestart() if (d_data_problem == "SPHERE") { d_data_problem_int = SPHERE; d_radius = db->getDouble("d_radius"); - db->getDoubleArray("d_center", &d_center[0], d_dim.getValue()); + d_center = db->getDoubleVector("d_center"); d_uval_inside = db->getDouble("d_uval_inside"); d_uval_outside = db->getDouble("d_uval_outside"); } @@ -2899,45 +2931,46 @@ void LinAdv::getFromRestart() (d_data_problem == "SINE_CONSTANT_Z")) { d_number_of_intervals = db->getInteger("d_number_of_intervals"); if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_uval = db->getDoubleArray("d_interval_uval"); + d_front_position = db->getDoubleVector("d_front_position"); + d_interval_uval = db->getDoubleVector("d_interval_uval"); } } - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); + d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); + d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_uval = db->getDoubleArray("d_bdry_edge_uval"); + d_bdry_edge_uval = db->getDoubleVector("d_bdry_edge_uval"); } if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); + d_scalar_bdry_face_conds = + db->getIntegerVector("d_scalar_bdry_face_conds"); - d_bdry_face_uval = db->getDoubleArray("d_bdry_face_uval"); + d_bdry_face_uval = db->getDoubleVector("d_bdry_face_uval"); } if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - d_dev_tol = db->getDoubleArray("d_dev_tol"); - d_dev_time_max = db->getDoubleArray("d_dev_time_max"); - d_dev_time_min = db->getDoubleArray("d_dev_time_min"); + d_dev_tol = db->getDoubleVector("d_dev_tol"); + d_dev_time_max = db->getDoubleVector("d_dev_time_max"); + d_dev_time_min = db->getDoubleVector("d_dev_time_min"); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - d_grad_tol = db->getDoubleArray("d_grad_tol"); - d_grad_time_max = db->getDoubleArray("d_grad_time_max"); - d_grad_time_min = db->getDoubleArray("d_grad_time_min"); + d_grad_tol = db->getDoubleVector("d_grad_tol"); + d_grad_time_max = db->getDoubleVector("d_grad_time_max"); + d_grad_time_min = db->getDoubleVector("d_grad_time_min"); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - d_shock_onset = db->getDoubleArray("d_shock_onset"); - d_shock_tol = db->getDoubleArray("d_shock_tol"); - d_shock_time_max = db->getDoubleArray("d_shock_time_max"); - d_shock_time_min = db->getDoubleArray("d_shock_time_min"); + d_shock_onset = db->getDoubleVector("d_shock_onset"); + d_shock_tol = db->getDoubleVector("d_shock_tol"); + d_shock_time_max = db->getDoubleVector("d_shock_time_max"); + d_shock_time_min = db->getDoubleVector("d_shock_time_min"); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - d_rich_tol = db->getDoubleArray("d_rich_tol"); - d_rich_time_max = db->getDoubleArray("d_rich_time_max"); - d_rich_time_min = db->getDoubleArray("d_rich_time_min"); + d_rich_tol = db->getDoubleVector("d_rich_tol"); + d_rich_time_max = db->getDoubleVector("d_rich_time_max"); + d_rich_time_min = db->getDoubleVector("d_rich_time_min"); } } @@ -2957,10 +2990,9 @@ void LinAdv::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, @@ -2989,14 +3021,12 @@ void LinAdv::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval) + std::vector& uval) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(uval.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(uval.size()) > array_indx); if (db->keyExists("uval")) { uval[array_indx] = db->getDouble("uval"); @@ -3020,7 +3050,7 @@ void LinAdv::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const + const std::vector& scalar_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { @@ -3035,53 +3065,47 @@ void LinAdv::checkBoundaryData( #endif const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array bdry_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); int bscalarcase = 0, refbdryloc = 0; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_edge[bloc]; } } if (d_dim == tbox::Dimension(3)) { if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_FACES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_edge_bdry_face[bloc]; } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_face[bloc]; } @@ -3124,3 +3148,26 @@ void LinAdv::checkBoundaryData( } } + +void +LinAdv::checkUserTagData( + hier::Patch& patch, + const int tag_index) const +{ + boost::shared_ptr > tags( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); +} + +void +LinAdv::checkNewPatchTagData( + hier::Patch& patch, + const int tag_index) const +{ + boost::shared_ptr > tags( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); +} + diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.h b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.h index 5d7345ea..efa0a721 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdv.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/appu/BoundaryUtilityStrategy.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -30,8 +29,9 @@ #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/appu/VisItDataWriter.h" -#include +#include "boost/shared_ptr.hpp" #include +#include using namespace std; @@ -202,13 +202,20 @@ class LinAdv: const int tag_index, const bool uses_gradient_detector_too); + //@{ + //! @name Required implementations of HyperbolicPatchStrategy pure virtuals. + /// /// The following routines: /// /// setPhysicalBoundaryConditions() + /// getRefineOpStencilWidth(), + /// preprocessRefine() + /// postprocessRefine() /// /// are concrete implementations of functions declared in the - /// RefinePatchStrategy abstract base class. + /// RefinePatchStrategy abstract base class. Some are trivial + /// because this class doesn't do any pre/postprocessRefine. /// /** @@ -223,6 +230,78 @@ class LinAdv: const hier::IntVector& ghost_width_to_fill); + hier::IntVector + getRefineOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + void + postprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + /// + /// The following routines: + /// + /// getCoarsenOpStencilWidth(), + /// preprocessCoarsen() + /// postprocessCoarsen() + /// + /// are concrete implementations of functions declared in the + /// CoarsenPatchStrategy abstract base class. They are trivial + /// because this class doesn't do any pre/postprocessCoarsen. + /// + + hier::IntVector + getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + void + postprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + //@} + /** * Write state of LinAdv object to the given database for restart. * @@ -230,8 +309,8 @@ class LinAdv: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -258,6 +337,16 @@ class LinAdv: string& db_name, int bdry_location_index); + void + checkUserTagData( + hier::Patch& patch, + const int tag_index) const; + + void + checkNewPatchTagData( + hier::Patch& patch, + const int tag_index) const; + #ifdef HAVE_HDF5 /** * Register a VisIt data writer so this class will write @@ -298,7 +387,7 @@ class LinAdv: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void @@ -309,7 +398,7 @@ class LinAdv: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); + std::vector& uval); /* * Private member function to check correctness of boundary data. @@ -319,7 +408,7 @@ class LinAdv: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + const std::vector& scalar_bconds) const; /* * Three-dimensional flux computation routines corresponding to @@ -376,6 +465,12 @@ class LinAdv: */ std::vector d_advection_velocity; + /** + * source term for use in testing, and flag to check fluxes + */ + double d_source; + bool d_check_fluxes; + /* * Parameters for numerical method: * @@ -413,8 +508,8 @@ class LinAdv: * Input for FRONT problem */ int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_uval; + std::vector d_front_position; + std::vector d_interval_uval; /* * Boundary condition cases and boundary values. @@ -423,24 +518,24 @@ class LinAdv: * * Input file values are read into these arrays. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // only for (dim == tbox::Dimension(3)) + std::vector d_scalar_bdry_edge_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_scalar_bdry_face_conds; // only for (dim == tbox::Dimension(3)) /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_node_bdry_edge; // only for (dim == tbox::Dimension(2)) - tbox::Array d_edge_bdry_face; // only for (dim == tbox::Dimension(3)) - tbox::Array d_node_bdry_face; // only for (dim == tbox::Dimension(3)) + std::vector d_node_bdry_edge; // only for (dim == tbox::Dimension(2)) + std::vector d_edge_bdry_face; // only for (dim == tbox::Dimension(3)) + std::vector d_node_bdry_face; // only for (dim == tbox::Dimension(3)) /* - * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. + * Vectors of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_uval; // only for (dim == tbox::Dimension(2)) - tbox::Array d_bdry_face_uval; // only for (dim == tbox::Dimension(3)) + std::vector d_bdry_edge_uval; // only for (dim == tbox::Dimension(2)) + std::vector d_bdry_face_uval; // only for (dim == tbox::Dimension(3)) /* * Input for Sine problem initialization @@ -452,21 +547,22 @@ class LinAdv: * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_dev_tol; - tbox::Array d_dev; - tbox::Array d_dev_time_max; - tbox::Array d_dev_time_min; - tbox::Array d_grad_tol; - tbox::Array d_grad_time_max; - tbox::Array d_grad_time_min; - tbox::Array d_shock_onset; - tbox::Array d_shock_tol; - tbox::Array d_shock_time_max; - tbox::Array d_shock_time_min; - tbox::Array d_rich_tol; - tbox::Array d_rich_time_max; - tbox::Array d_rich_time_min; + std::vector d_refinement_criteria; + double d_threshold; + std::vector d_dev_tol; + std::vector d_dev; + std::vector d_dev_time_max; + std::vector d_dev_time_min; + std::vector d_grad_tol; + std::vector d_grad_time_max; + std::vector d_grad_time_min; + std::vector d_shock_onset; + std::vector d_shock_tol; + std::vector d_shock_time_max; + std::vector d_shock_time_min; + std::vector d_rich_tol; + std::vector d_rich_time_max; + std::vector d_rich_time_min; }; diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdvFort.h b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdvFort.h index 9a4b6ed9..6a0e2662 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdvFort.h +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/LinAdvFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI linear advection example. * ************************************************************************/ @@ -13,7 +13,7 @@ extern "C" { -void F77_FUNC(linadvinit2d, LINADVINIT2D) ( +void SAMRAI_F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -23,7 +23,7 @@ void F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *); -void F77_FUNC(linadvinit3d, LINADVINIT3D) ( +void SAMRAI_F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -35,7 +35,7 @@ void F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *); -void F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( +void SAMRAI_F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( const int&, const double *, const double *, const double *, const double *, const int&, const int&, @@ -47,7 +47,7 @@ void F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( const double *, const double *, const double&, const double *); -void F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( +void SAMRAI_F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( const int&, const double *, const double *, const double *, const double *, const int&, const int&, @@ -61,7 +61,7 @@ void F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( const double *, const double *, const double&, const double *); -void F77_FUNC(initsphere2d, INITSPHERE2D) ( +void SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -71,7 +71,7 @@ void F77_FUNC(initsphere2d, INITSPHERE2D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(initsphere3d, INITSPHERE3D) ( +void SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -83,17 +83,16 @@ void F77_FUNC(initsphere3d, INITSPHERE3D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(stabledt2d, STABLEDT2D) ( +void SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, const int&, const int&, const int&, const int&, const int&, const int&, const double *, - const double *, double&); -void F77_FUNC(stabledt3d, STABLEDT3D) ( +void SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, const int&, const int&, const int&, const int&, @@ -102,22 +101,16 @@ void F77_FUNC(stabledt3d, STABLEDT3D) ( const int&, const int&, const double *, - const double *, double&); -void F77_FUNC(inittraceflux1d, INITTRACEFLUX1D) ( - const int&, const int&, - const double *, - double *, double *, double *); - -void F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( +void SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( const int&, const int&, const int&, const int&, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( +void SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -126,70 +119,56 @@ void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing1d0, CHARTRACING1D0) ( - const double&, const int&, const int&, - const int&, const double&, const double&, const int&, - const double *, - double *, double *, - double *, double *, - double *, double *); - -void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( +void SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( +void SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( +void SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( +void SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( +void SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2d) ( +void SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( const double&, const int&, const int&, const double *, const int&, const int&, const int&, const int&, const double *, - const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) ( +void SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( const double&, const int&, const int&, const int&, const double *, @@ -197,49 +176,47 @@ void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) ( const int&, const int&, const int&, const int&, const double *, - const double *, double *, double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const int&, - const double *, const double *, const double *, const double *, const double *, const double *, const double *, const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, - const double *, const double *, const double *, const double *, const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec, FLUXCORREC) ( +void SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) ( const double&, const int&, const int&, const int&, const int&, const double *, - const double *, const double *, + const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(consdiff2d, CONSDIFF2D) ( +void SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) ( const int&, const int&, const int&, const int&, const double *, const double *, const double *, const double *, + const double&, double *); -void F77_FUNC(consdiff3d, CONSDIFF3D) ( +void SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -247,9 +224,10 @@ void F77_FUNC(consdiff3d, CONSDIFF3D) ( const double *, const double *, const double *, const double *, + const double&, double *); -void F77_FUNC(getbdry2d, GETBDRY2D) (const int&, +void SAMRAI_F77_FUNC(getbdry2d, GETBDRY2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -259,7 +237,7 @@ void F77_FUNC(getbdry2d, GETBDRY2D) (const int&, double *, const double *, const double *, const int&); -void F77_FUNC(getbdry3d, GETBDRY3D) (const int&, +void SAMRAI_F77_FUNC(getbdry3d, GETBDRY3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -271,29 +249,29 @@ void F77_FUNC(getbdry3d, GETBDRY3D) (const int&, double *, const double *, const double *, const int&); -void F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( +void SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( +void SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - const double *, const double *, + const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( +void SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, - const double *, const double *, + const double *, const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( +void SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -304,7 +282,7 @@ void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const double *, int *, int *); -void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( +void SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -317,7 +295,7 @@ void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const double *, int *, int *); -void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( +void SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -328,7 +306,7 @@ void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const double *, int *, int *); -void F77_FUNC(detectshock3d, DETECTSHOCK3D) ( +void SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -341,7 +319,7 @@ void F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const double *, int *, int *); -void F77_FUNC(stufprobc, STUFPROBC) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.depend index 2bf1ff72..ce0a02ed 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -36,6 +37,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -47,11 +49,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -59,28 +65,29 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -103,10 +110,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -120,9 +125,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -146,13 +152,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h LinAdv.C \ LinAdv.h LinAdvFort.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -165,19 +169,21 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ @@ -185,6 +191,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -194,6 +201,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -205,7 +213,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -217,31 +228,32 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -264,7 +276,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ @@ -284,9 +295,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -310,12 +322,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h LinAdv.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/AutoTester.h LinAdv.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -328,10 +339,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.in index 7b615f5d..fb7ade22 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for linear advection sample application ## ######################################################################### @@ -14,120 +14,201 @@ SUBDIR = source/test/applications/LinAdv VPATH = @srcdir@ TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -AUTOTEST = $(SAMRAI)/source/test/applications -CPPFLAGS_EXTRA= -I$(AUTOTEST) -DTESTING=1 +SUBDIRS = fortran -NUM_TESTS = 10 +CPPFLAGS_EXTRA = -DTESTING=1 + +NUM_TESTS = 11 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = main.o LinAdv.o AutoTester.o -F_OBJS = flux2d.o grad2d.o init2d.o stable2d.o stufprobc.o trace1d.o trace2d.o flux3d.o init3d.o grad3d.o trace3d.o stable3d.o fluxcorner3d.o +CXX_OBJS = main.o LinAdv.o +F_OBJS = fortran/flux2d.o \ + fortran/grad2d.o \ + fortran/init2d.o \ + fortran/stable2d.o \ + fortran/stufprobc.o \ + fortran/trace1d.o \ + fortran/trace2d.o \ + fortran/flux3d.o \ + fortran/init3d.o \ + fortran/grad3d.o \ + fortran/trace3d.o \ + fortran/stable3d.o \ + fortran/fluxcorner3d.o -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) $(TESTLIB) \ + $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main -check: - $(MAKE) check2d - $(MAKE) check3d +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -# WARNING: Checking of the redistribute routine is a bit of a problem since it needs only a single run -# to have been done. So remove the old stuff. -check2d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.2d.input; - $(RM) -rf test.2d.restart/restore.000003/nodes.*[2-9] - $(OBJECT)/tools/restart/restart-redistribute test.2d.restart test_restart_redistribute_2d 3 4; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.2d.input test.2d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.2d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.2d.input test_sync.2d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync_restart.2d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync_restart.2d.input test_sync_restart.2d.restart 5 +fortran/flux2d.o: -check3d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.3d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test.3d.input test.3d.restart 5; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.3d.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/test_sync.3d.input test_sync.3d.restart 5 +fortran/grad2d.o: -checkcompile: main +fortran/init2d.o: -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean-check: - $(SAMCLEAN) +fortran/stable2d.o: -clean: clean-check - $(RM) *.f *main* - $(RM) -rf test*restart* - $(RM) -rf viz* +fortran/stufprobc.o: -include $(SRCDIR)/Makefile.depend +fortran/trace1d.o: -FORTRAN = $(SRCDIR)/fortran/$(PDIM)d -M4DIRS = -DFORTDIR=$(SRCDIR)/fortran $(SAMRAI_M4_FLAGS) +fortran/trace2d.o: -AutoTester.o: $(AUTOTEST)/AutoTester.C - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C \ - -o $@ +fortran/flux3d.o: -flux2d.o: fortran/flux2d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/flux2d.m4 > flux2d.f - $(F77) $(FFLAGS) -c flux2d.f -o $@ +fortran/init3d.o: -flux3d.o: fortran/flux3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/flux3d.m4 > flux3d.f - $(F77) $(FFLAGS) -c flux3d.f -o $@ +fortran/grad3d.o: -fluxcorner3d.o: fortran/fluxcorner3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/fluxcorner3d.m4 > fluxcorner3d.f - $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ +fortran/trace3d.o: -grad2d.o: fortran/grad2d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/grad2d.m4 > grad2d.f - $(F77) $(FFLAGS) -c grad2d.f -o $@ +fortran/stable3d.o: -grad3d.o: fortran/grad3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/grad3d.m4 > grad3d.f - $(F77) $(FFLAGS) -c grad3d.f -o $@ +fortran/fluxcorner3d.o: -init2d.o: fortran/init2d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/init2d.m4 > init2d.f - $(F77) $(FFLAGS) -c init2d.f -o $@ - -init3d.o: fortran/init3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/init3d.m4 > init3d.f - $(F77) $(FFLAGS) -c init3d.f -o $@ +check: + $(MAKE) check2d + $(MAKE) check3d -stable2d.o: fortran/stable2d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/stable2d.m4 > stable2d.f - $(F77) $(FFLAGS) -c stable2d.f -o $@ +# WARNING: Checking of the redistribute routine is a bit of a problem since it +# needs only a single run to have been done. So remove the old +# stuff. +check2d: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done +ifeq ($(findstring 4, ${TEST_NPROCS}),4) + $(RM) test.2d.restart/restore.000003/nodes.*1; + $(RM) test.2d.restart/restore.000003/nodes.*4; + $(OBJECT)/config/serpa-run 2 $(OBJECT)/tools/restart/restart-redistribute test.2d.restart test_restart_redistribute_2d 3 4; + @echo " " >> $(REPORT); + $(OBJECT)/config/serpa-run 4 ./main test_inputs/test.2d.input test_restart_redistribute_2d 3 | $(TEE) foo; + @if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; + @echo " " >> $(REPORT); +endif + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.2d.input test.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.2d.input test_sync.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync_restart.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync_restart.2d.input test_sync_restart.2d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_time_refinement.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + $(RM) foo; -stable3d.o: fortran/stable3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/stable3d.m4 > stable3d.f - $(F77) $(FFLAGS) -c stable3d.f -o $@ +check3d: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test.3d.input test.3d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/test_sync.3d.input test_sync.3d.restart 5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + $(RM) foo; -stufprobc.o: fortran/stufprobc.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/stufprobc.m4 > stufprobc.f - $(F77) $(FFLAGS) -c stufprobc.f -o $@ +checkcompile: main -trace2d.o: fortran/trace2d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/trace2d.m4 > trace2d.f - $(F77) $(FFLAGS) -c trace2d.f -o $@ +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 1 makecheck.logfile + $(RM) makecheck.logfile + +examples2d: main + @for i in example_inputs/*.2d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ + done + +examples3d: main + @for i in example_inputs/*.3d.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main $${i}; \ + done + +examples: + $(MAKE) examples2d + $(MAKE) examples3d + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) test*restart* viz* + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -trace3d.o: fortran/trace3d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/trace3d.m4 > trace3d.f - $(F77) $(FFLAGS) -c trace3d.f -o $@ +include $(SRCDIR)/Makefile.depend -trace1d.o: fortran/trace1d.m4 - $(M4) $(M4DIRS) $(SRCDIR)/fortran/trace1d.m4 > trace1d.f - $(F77) $(FFLAGS) -c trace1d.f -o $@ +AutoTester.o: $(AUTOTEST)/AutoTester.C + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/README b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/README index 7cd81e13..906d7377 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/README +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/README @@ -3,61 +3,90 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for LinAdv test. +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: README file for Linear Advection test. ## ######################################################################### -This directory contains a Makefile to build an Automatic testing -version of the LinAdv application. It is used in the autotest -suite of SAMRAI. - -The Makefile operates on the LinAdv code in the applications -directory. However, it performs two functions not done in the -standard LinAdv application. First, it builds and links the -AutoTester class, located in /SAMRAI/source/test/applications. -This class reads information from input and performs an -"evaluate" function to assure the computed information is -correct. Second, it sets to TRUE the TESTING preprocessor -option so that the autotest part of LinAdv is included. - -The following segment should be added to the input file -to satisfy the input requirements for AutoTester: - -// Automated testing arguments. -// test_iter_num -- (int) iteration number (i.e. coarse-grid -// timestep) for which to check result [10]. -// test_fluxes -- (bool) test Riemann solver. -// If TRUE, it outputs primitive variables to a -// file which can then be verified against some -// known "correct" result. If FALSE, it will -// simply check timesteps in the -// HyperbolicLevelIntegrator. [FALSE] -// correct_result -- (double array) specification of correct result -// for the different test performed. If the -// computed result does not match the specified -// result, the code will report an error [0]. -// output_correct -- (bool) output computed result. Useful for -// setting baseline "correct_result" values for a -// new problem. That is, set to TRUE and run the -// case. Enter the output values in the -// correct_result array in input, and use the -// input file for automated testing. [FALSE] -AutoTester { - test_iter_num = 10 - test_fluxes = FALSE - correct_result = 2.25, 0.0140625, 0.0140625 - output_correct = FALSE -} - -A 2D and a 3D test input file are included with LinAdv: - test-2d.input - contains input and "correct" output data for 2D - test of LinAdv - test-3d.input - same, but for 3D test. +This README explains how to compile and run the Linear Advection application. +The files in this directory are as follows: + + main.C - application driver program + LinAdv.[C,h - C++ class containing routines specific to the + Linear Advection example and which are called from + SAMRAI AMR library routines + LinAdvFort.h - header file defining external fortran routines + fortran/2d,3d - Fortran numerical routines for 2d,3d problems. + +To understand the construction of this application code from pieces +specific to the Linear Advection model and more generic pieces in the SAMRAI +library consider the object construction pattern in the main.C file. +For more details on library classes and the LinAdv class consult the +the comments in the header files for the library classes and the +LinAdv.h class header file. + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + A 2D and a 3D test input file are included with LinAdv: + test.2d.input - contains input and "correct" output data for 2D + test of LinAdv + test.3d.input - same, but for 3D test. + + serial: + ./main test_inputs/test.[2,3]d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main test_inputs/test.[2,3]d.input + + Restarted Run: + same format as regular run but add + to end of command. + is directory where restart files are stored + (set in input file). + is the identifier of which restart file to use + (generally the timestep). + + example: (to start from timestep #5) + + ./main test_inputs/test.2d.input test.2d.restart 5 + mpirun -np 2 ./main test_inputs/test.2d.input test.2d.restart 5 + + NOTE: The ordinary use of our restart functionality requires that + a problem can only be restarted on on the same number of + processors on which the problem was originally run. To restart + on a different number of processors, used the + restart-redistribute tool in SAMRAI/tools/restart. + + There are also example input files in the subdirectory example_inputs. + sine_front.2d.input - advecting 2d sinusoidal front in a box with 3 + levels + sphere.2d.input - advecting 2d sphere in a box with 3 levels + using UVAL_GRADIENT and UVAL_SHOCK refinement criteria + sphere.3d.input - advecting 3d sphere in a box with 3 levels + using UVAL_GRADIENT and UVAL_SHOCK refinement criteria + sphere_4levels.2d.input - advecting 2d sphere in a box with 4 levels + using UVAL_GRADIENT and UVAL_SHOCK refinement + criteria + sphere_restart.2d.input - advecting 2d sphere in a box with 4 levels + using UVAL_RICHARDSON refinement criteria and + different values for a number of meshing and + tagging parameters from the file above + + +INPUT PARAMETER +--------------- +Refer to test_inputs/test2d.input for full description of all input parameters +specific to this problem. RESETTING BASELINES - +------------------- The tests that are run from this directory include comparisons of the results to baseline data that represent expected results. The tests compare the box configuration of the hierarchy, and certain timestep floating point values, @@ -95,4 +124,3 @@ according to the following steps correct_results). 6. make checktest (there should be no more errors). - diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sine_front.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sine_front.2d.input index 0e160b1d..4a4e198a 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sine_front.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sine_front.2d.input @@ -1,23 +1,40 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Linadv example problem - * (2d sinusoidal fronusoidal frontt) + * (2d sinusoidal fronusoidal front) * ************************************************************************/ +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} LinAdv { + // Linear advection velocity vector--vector of length dim advection_velocity = 2.0e0 , 0.1e0 + // order of Goduov slopes (1, 2, or 4) godunov_order = 4 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SINE_CONSTANT_X" - Initial_data { front_position = 0.0 interval_0 { @@ -26,25 +43,29 @@ LinAdv { interval_1 { uval = 1.0 } - amplitude = 0.25 + amplitude = 0.25 frequency = 2.0, 2.0 } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -82,46 +103,55 @@ LinAdv { } Main { + // dimension of problem dim = 2 - base_name = "sine_front.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sine2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // base name of log file + base_name = "sine_front.2d" -// restart dump parameters - restart_interval = 0 // zero to turn off + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE - run_time_plotting = FALSE + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sine2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to tbox::TimerManager for input TimerManager { - print_exclusive = TRUE + print_exclusive = TRUE timer_list = "apps::*::*", "algs::*::*", "mesh::*::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0) , (39,19) ] - x_lo = -2.e0, -1.e0 // lower end of computational domain. + x_lo = -2.e0, -1.e0 // lower end of computational domain. x_up = 2.e0, 1.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 + max_levels = 3 // Maximum number of levels in hierarchy. + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + level_2 = 4 , 4 } largest_patch_size { level_0 = 19, 19 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... + // all finer levels will use same values as level_0... } smallest_patch_size { @@ -131,34 +161,42 @@ PatchHierarchy { } -GriddingAlgorithm { - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm { // write_regrid_boxes = TRUE regrid_boxes_filename = "regrid_boxes" } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 25 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.2d.input index 3dcbd0bd..ca22f36e 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.2d.input @@ -1,44 +1,66 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ -LinAdv { +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) +LinAdv { + // Linear advection velocity vector--vector of length dim + advection_velocity = 2.0e0 , 1.0e0 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 + radius = 2.9 + center = 22.5 , 5.5 uval_inside = 80.0 uval_outside = 5.0 - + } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -77,22 +99,31 @@ LinAdv { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "sphere.2d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere2d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 -// restart dump parameters - restart_interval = 0 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -102,8 +133,9 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -112,7 +144,7 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 @@ -120,28 +152,34 @@ PatchHierarchy { } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 16 , 16 + level_0 = 16 , 16 // all finer levels will use same values as level_0... } } -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -149,6 +187,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -158,6 +197,7 @@ TimeRefinementIntegrator{ tag_buffer = 2,2,2 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.3d.input index d734aa9c..4183632a 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere.3d.input @@ -1,23 +1,41 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ -LinAdv { +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. - advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" +AutoTester { + // No input--this is an example and does not test results. +} - data_problem = "SPHERE" +LinAdv { + // Linear advection velocity vector--vector of length dim + advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + corner_transport = "CORNER_TRANSPORT_1" + + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { - radius = 2.9 + radius = 2.9 center = 5.5 , 5.5 , 5.5 uval_inside = 80.0 @@ -25,20 +43,24 @@ LinAdv { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -142,32 +164,41 @@ LinAdv { } Main { - dim = 2 + // dimension of problem + dim = 3 + + // base name of log file base_name = "sphere.3d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere3d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere3d" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 -// restart dump parameters - restart_interval = 0 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ - domain_boxes = [ (0,0,0) , (29,19,19) ] + domain_boxes = [ (0,0,0) , (29,19,19) ] x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -176,35 +207,41 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 , 2 level_2 = 2 , 2 , 2 level_3 = 2 , 2 , 2 } largest_patch_size { - level_0 = 40 , 40 , 40 + level_0 = 40 , 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 9 , 9 , 9 + level_0 = 9 , 9 , 9 // all finer levels will use same values as level_0... } } -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -212,13 +249,14 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps + max_integrator_steps = 25 // max number of simulation timesteps } LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_4levels.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_4levels.2d.input index f48253e4..afcb3986 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_4levels.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_4levels.2d.input @@ -1,30 +1,51 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ -LinAdv { +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" +AutoTester { + // No input--this is an example and does not test results. +} - data_problem = "SPHERE" +LinAdv { + // Linear advection velocity vector--vector of length dim + advection_velocity = 2.0e0 , 1.0e0 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { - radius = 2.9 - center = 22.5 , 5.5 + radius = 2.9 + center = 22.5 , 5.5 uval_inside = 80.0 uval_outside = 5.0 - + } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" @@ -33,12 +54,13 @@ LinAdv { } UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -77,21 +99,30 @@ LinAdv { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "sphere_4levels.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere2d_4level" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -101,8 +132,9 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 4 // Maximum number of levels in hierarchy. + max_levels = 4 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -111,36 +143,41 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 level_2 = 2 , 2 level_3 = 2 , 2 } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 16 , 16 - level_1 = 12 , 12 + level_0 = 16 , 16 + level_1 = 12 , 12 // all finer levels will use same values as level_1... } +} +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -148,6 +185,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -157,6 +195,7 @@ TimeRefinementIntegrator{ tag_buffer = 3,3,3 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_restart.2d.input index faa95866..a02d8a0a 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_restart.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/example_inputs/sphere_restart.2d.input @@ -1,49 +1,72 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ -LinAdv { - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" +// Refer to ../test_inputs/test2d.input for full description of all input +// parameters specific to this problem. + +AutoTester { + // No input--this is an example and does not test results. +} - data_problem = "SPHERE" +LinAdv { + // Linear advection velocity vector--vector of length dim + advection_velocity = 2.0e0 , 1.0e0 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 4 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. + data_problem = "SPHERE" Initial_data { - radius = 2.9 - center = 22.5 , 5.5 + radius = 2.9 + center = 22.5 , 5.5 uval_inside = 80.0 uval_outside = 5.0 - + } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { + // UVAL_GRADIENT AND UVAL_SHOCK criteria are applied only if the gradient + // detector is turned on in the StandardTagAndInitialize input below... refine_criteria = "UVAL_RICHARDSON", "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_RICHARDSON { rich_tol = 0.1, 0.1, 0.001 } - // UVAL_GRADIENT AND UVAL_SHOCK criteria are applied only if the gradient - // detector is turned on in the StandardTagAndInitialize input below... UVAL_GRADIENT { grad_tol = 10.0 } UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -82,21 +105,30 @@ LinAdv { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "sphere_restart.2d" -// log file parameters - log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - visit_number_procs_per_file = 1 // not used by Vizamrai + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE -// restart dump parameters - restart_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 1 + // directory in which to place viz output + viz_dump_dirname = "viz_sphere2d_restart" + // number of processors which write to each viz file + visit_number_procs_per_file = 1 + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 0 } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -106,8 +138,9 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 4 // Maximum number of levels in hierarchy. + max_levels = 4 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -116,7 +149,7 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 2 , 2 level_3 = 2 , 2 @@ -124,35 +157,43 @@ PatchHierarchy { } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 16 , 16 + level_0 = 16 , 16 // all finer levels will use same values as level_0... } } -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { // tagging_method = "GRADIENT_DETECTOR" tagging_method = "RICHARDSON_EXTRAPOLATION" // tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" // tagging_method = "REFINE_BOXES" -// RefineBoxes { -// level_0 = [(15,0),(29,14)] -// level_1 = [(65,10),(114,40)] +// level_0 { +// boxes = [(15,0),(29,14)] +// } +// level_1 { +// boxes = [(65,10),(114,40)] // } } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -160,6 +201,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -168,6 +210,8 @@ TimeRefinementIntegrator{ tag_buffer = 2,2,2 } + +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.depend new file mode 100644 index 00000000..2285ae84 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.depend @@ -0,0 +1,167 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=flux2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + flux2d.m4 m4flux2d.i probparams.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=flux3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + flux3d.m4 m4flux3d.i probparams.i + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=fluxcorner3d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + fluxcorner3d.m4 m4fluxcorner3d.i probparams.i + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=grad2d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + grad2d.m4 probparams.i + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=grad3d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + grad3d.m4 probparams.i + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=init2d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 probparams.i + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=init3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 probparams.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=stable2d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + stable2d.m4 + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=stable3d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + stable3d.m4 + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=stufprobc.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc.m4 + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=trace1d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d.m4 + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=trace2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + m4trace2d.i probparams.i trace2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=trace3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + m4trace3d.i probparams.i trace3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.in new file mode 100644 index 00000000..8b53002f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/Makefile.in @@ -0,0 +1,95 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI linear advection +## sample application +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/applications/LinAdv/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= flux2d.o \ + grad2d.o \ + init2d.o \ + stable2d.o \ + stufprobc.o \ + trace1d.o \ + trace2d.o \ + flux3d.o \ + init3d.o \ + grad3d.o \ + trace3d.o \ + stable3d.o \ + fluxcorner3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +flux2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux2d.m4 > flux2d.f + $(F77) $(FFLAGS) -c flux2d.f -o $@ + +flux3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux3d.m4 > flux3d.f + $(F77) $(FFLAGS) -c flux3d.f -o $@ + +fluxcorner3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/fluxcorner3d.m4 > fluxcorner3d.f + $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ + +grad2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad2d.m4 > grad2d.f + $(F77) $(FFLAGS) -c grad2d.f -o $@ + +grad3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad3d.m4 > grad3d.f + $(F77) $(FFLAGS) -c grad3d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +stable2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable2d.m4 > stable2d.f + $(F77) $(FFLAGS) -c stable2d.f -o $@ + +stable3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable3d.m4 > stable3d.f + $(F77) $(FFLAGS) -c stable3d.f -o $@ + +stufprobc.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc.m4 > stufprobc.f + $(F77) $(FFLAGS) -c stufprobc.f -o $@ + +trace1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d.m4 > trace1d.f + $(F77) $(FFLAGS) -c trace1d.f -o $@ + +trace2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace2d.m4 > trace2d.f + $(F77) $(FFLAGS) -c trace2d.f -o $@ + +trace3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace3d.m4 > trace3d.f + $(F77) $(FFLAGS) -c trace3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/const.i index f1303636..d815c0c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,sixth,fourth,third,half,twothird,rt75,one, & onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux2d.m4 index 6c04ceee..400fd63d 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux2d.m4 @@ -1,13 +1,20 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for flux computation in 2d. +c define(NDIM,2)dnl define(NEQU,1)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4flux2d.i)dnl subroutine fluxcorrec(dt, & ifirst0,ilast0,ifirst1,ilast1, & dx, - & advecspeed,uval, + & advecspeed, & flux0,flux1, & trlft0,trlft1, & trrgt0,trrgt1) @@ -27,7 +34,6 @@ c c variables in 2d cell indexed REAL & advecspeed(0:NDIM-1), - & uval(CELL2d(ifirst,ilast,CELLG)), & flux0(FACE2d0(ifirst,ilast,FLUXG)), & flux1(FACE2d1(ifirst,ilast,FLUXG)), & trlft0(FACE2d0(ifirst,ilast,FACEG)), @@ -75,7 +81,6 @@ c*********************************************************************** subroutine fluxcalculation2d(dt,extra_cell,visco,dx, & ifirst0,ilast0,ifirst1,ilast1, & advecspeed, - & uval, & flux0,flux1, & trlft0,trlft1,trrgt0,trrgt1) c*********************************************************************** @@ -91,7 +96,6 @@ c input arrays: c variables in 2d cell indexed REAL & advecspeed(0:NDIM-1), - & uval(CELL2d(ifirst,ilast,CELLG)), c variables in 2d side indexed & flux0(FACE2d0(ifirst,ilast,FLUXG)), & flux1(FACE2d1(ifirst,ilast,FLUXG)), @@ -137,7 +141,7 @@ c*********************************************************************** & ifirst0,ilast0,ifirst1,ilast1, & dx, & flux0,flux1, - & advecspeed,uval) + & advecspeed,src,uval) c*********************************************************************** implicit none include(FORTDIR/const.i)dnl @@ -148,7 +152,7 @@ c*********************************************************************** REAL & flux0(FACE2d0(ifirst,ilast,FLUXG)), & flux1(FACE2d1(ifirst,ilast,FLUXG)), - & advecspeed(0:NDIM-1), + & advecspeed(0:NDIM-1),src, & uval(CELL2d(ifirst,ilast,CELLG)) c integer ic0,ic1 @@ -164,7 +168,7 @@ c write(6,*) "flux0" c do ic1=ifirst1,ilast1 c do ic0=ifirst0,ilast0+1 c write(6,*) "ic0,flux0= ",ic0,ic1, -c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), +c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) c call flush(6) c enddo @@ -173,7 +177,7 @@ c write(6,*) "flux1" c do ic1=ifirst1,ilast1 c do ic0=ifirst0,ilast0+1 c write(6,*) "ic0,flux1= ",ic0,ic1, -c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), +c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) c call flush(6) c enddo @@ -190,7 +194,7 @@ c enddo c*********************************************************************** do ic1=ifirst1,ilast1 do ic0=ifirst0,ilast0 - uval(ic0,ic1) = uval(ic0,ic1) + uval(ic0,ic1) = uval(ic0,ic1) +src & -(flux0(ic0+1,ic1)-flux0(ic0,ic1))/dx(0) & -(flux1(ic1+1,ic0)-flux1(ic1,ic0))/dx(1) enddo diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux3d.m4 index 7a50fb1b..bc165305 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/flux3d.m4 @@ -1,13 +1,19 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for flux computation in 3d. +c define(NDIM,3)dnl define(NEQU,1)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4flux3d.i)dnl subroutine fluxcorrec2d(dt, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & dx,advecspeed,idir, - & uval, & flux0,flux1,flux2, & tracelft0,tracelft1,tracelft2, & tracergt0,tracergt1,tracergt2, @@ -30,7 +36,6 @@ c c variables in 2d cell indexed REAL & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), c & flux0(FACE3d0(ifirst,ilast,FLUXG)), & flux1(FACE3d1(ifirst,ilast,FLUXG)), @@ -91,7 +96,7 @@ c*********************************************************************** subroutine fluxcorrec3d(dt, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & dx, - & advecspeed,uval, + & advecspeed, & fluxa0,fluxa1,fluxa2, & fluxb0,fluxb1,fluxb2, & tracelft0,tracelft1,tracelft2, @@ -112,7 +117,6 @@ c c variables in 2d cell indexed REAL & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), & fluxa0(FACE3d0(ifirst,ilast,FLUXG)), & fluxa1(FACE3d1(ifirst,ilast,FLUXG)), & fluxa2(FACE3d2(ifirst,ilast,FLUXG)), @@ -151,7 +155,6 @@ c*********************************************************************** subroutine fluxcalculation3d(dt,xcell0,xcell1,visco,dx, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & advecspeed, - & uval, & flux0,flux1,flux2, & trlft0,trlft1,trlft2, & trrgt0,trrgt1,trrgt2) @@ -170,8 +173,7 @@ c input arrays: & dx(0:NDIM-1) c variables in 2d cell indexed REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) + & advecspeed(0:NDIM-1) c variables in 2d side indexed REAL & flux0(FACE3d0(ifirst,ilast,FLUXG)), @@ -224,7 +226,7 @@ c*********************************************************************** & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & dx, & flux0,flux1,flux2, - & advecspeed,uval) + & advecspeed,src,uval) c*********************************************************************** implicit none include(FORTDIR/const.i)dnl @@ -236,7 +238,7 @@ c*********************************************************************** & flux0(FACE3d0(ifirst,ilast,FLUXG)), & flux1(FACE3d1(ifirst,ilast,FLUXG)), & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & advecspeed(0:NDIM-1), + & advecspeed(0:NDIM-1),src, & uval(CELL3d(ifirst,ilast,CELLG)) c integer ic0,ic1,ic2 @@ -249,7 +251,7 @@ c*********************************************************************** do ic2=ifirst2,ilast2 do ic1=ifirst1,ilast1 do ic0=ifirst0,ilast0 - uval(ic0,ic1,ic2) = uval(ic0,ic1,ic2) + uval(ic0,ic1,ic2) = uval(ic0,ic1,ic2) +src & -(flux0(ic0+1,ic1,ic2)-flux0(ic0,ic1,ic2))/dx(0) & -(flux1(ic1+1,ic2,ic0)-flux1(ic1,ic2,ic0))/dx(1) & -(flux2(ic2+1,ic0,ic1)-flux2(ic2,ic0,ic1))/dx(2) diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.i deleted file mode 100644 index 992cf4f3..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.i +++ /dev/null @@ -1,168 +0,0 @@ -include(FORTDIR/m4fluxjt.i)dnl - - subroutine onethirdstates(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux0,flux1,flux2, - & st3_0,st3_1,st3_2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -st_third(0,1,2,`ic1,ic2')dnl -c -st_third(1,2,0,`ic2,ic0')dnl -c -st_third(2,0,1,`ic0,ic1')dnl -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxthird(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed, - & uval, - & st3_0,st3_1,st3_2, - & flux01,flux12,flux20, - & flux02,flux10,flux21) - -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - -f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrecjt(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux01,flux12,flux20, - & flux02,flux10,flux21, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:3-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers -c REAL ttvlft,ttvrgt - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -correc_fluxjt(2,0,1,`ic1,ic2',`ic2,ic0')dnl -c -correc_fluxjt(1,2,0,`ic0,ic1',`ic1,ic2')dnl -c -correc_fluxjt(0,1,2,`ic2,ic0',`ic0,ic1')dnl -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.m4 index e13aefca..e1c77e0f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/fluxcorner3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for corner flux computation in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4fluxcorner3d.i)dnl subroutine onethirdstate3d(dt,dx,idir, @@ -59,7 +66,6 @@ c*********************************************************************** subroutine fluxthird3d(dt,dx,idir, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & advecspeed, - & uval, & st3, & flux0,flux1,flux2) @@ -76,8 +82,7 @@ c input arrays: & dx(0:NDIM-1) c variables in 2d cell indexed REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) + & advecspeed(0:NDIM-1) c variables in 2d side indexed REAL & flux0(FACE3d0(ifirst,ilast,FLUXG)), @@ -123,7 +128,7 @@ c*********************************************************************** c*********************************************************************** subroutine fluxcorrecjt3d(dt,dx,idir, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, + & advecspeed, & flux0,flux1,flux2, & tracelft0,tracelft1,tracelft2, & tracergt0,tracergt1,tracergt2) @@ -143,7 +148,6 @@ c c variables in 2d cell indexed REAL & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), & flux0(FACE3d0(ifirst,ilast,FLUXG)), & flux1(FACE3d1(ifirst,ilast,FLUXG)), & flux2(FACE3d2(ifirst,ilast,FLUXG)), diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad2d.m4 index 3ae0eb70..9be9d8d1 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad2d.m4 @@ -1,7 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradient computation in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine detectgrad2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad3d.m4 index 52917b23..2dd30de1 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/grad3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradient computation in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine detectgrad3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init2d.m4 index 213e9df6..441255da 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine linadvinit2d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init3d.m4 index 2585c8cd..8c8bf03c 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/init3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine linadvinit3d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m3fluxjt3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m3fluxjt3d.i deleted file mode 100644 index c9c03036..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m3fluxjt3d.i +++ /dev/null @@ -1,60 +0,0 @@ -define(st_third,`dnl - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2-1,ilast$2+1 - do ic$1=ifirst$1,ilast$1 - trnsvers= - & (flux$1(ic$1+1,$4)-flux$1(ic$1,$4))/(3*dx($1)) -c - st3_$1(ic0,ic1,ic2)=uval(ic0,ic1,ic2) -trnsvers - enddo - enddo - enddo -')dnl -define(f_third,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2,ilast$2 - do ic$1=ifirst$1,ilast$1+1 - - if (advecspeed($1).ge.zero) then - riemst = st3_$2($5) - else - riemst = st3_$2(ic0,ic1,ic2) - endif - flux$1$2(ic$1,$4)= dt*riemst*advecspeed($1) - enddo - enddo - enddo -')dnl -define(correc_fluxjt,`dnl -c correct the $1-direction with $2$3-fluxes - do ic$3=ifirst$3,ilast$3 - do ic$2=ifirst$2,ilast$2 - ic$1=ifirst$1-1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - do ic$1=ifirst$1,ilast$1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - ic$1=ilast$1+1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4bdry3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4bdry3d.i deleted file mode 100644 index 7ba8c7ca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4bdry3d.i +++ /dev/null @@ -1,167 +0,0 @@ -define(cell_even,`dnl - uval(ic0,ic1,ic2)=uval($1) -')dnl -define(lin_boundary,`dnl - ict$1 = $2 - uval0 = uval(ict0,ict1,ict2) - ict$1 = $3 - slope=(uval0-uval(ict0,ict1,ict2))/($2-$3) - uval(ic0,ic1,ic2)=uval0 + (ic$1-$2)*slope -')dnl -define(fixed_state,`dnl - uval(ic0,ic1,ic2)=bdry_states(1+(sn-1)) -')dnl -define(symmetry,`dnl - ict$1 = 3*$2-$3-ic$1 - uval(ic0,ic1,ic2)=uval(ict0,ict1,ict2) -')dnl -define(do_bdry_face,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -lin_boundary(`$1',`$5',`$6')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -symmetry(`$1',`$5',`$6')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_node,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -lin_boundary(`0',`$4',`$5')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -symmetry(`0',`$4',`$5')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_edge,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -lin_boundary($2,`$6',`$7')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -symmetry($2,`$6',`$7')dnl - enddo - enddo - enddo - endif -')dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux2d.i index 338013fc..abfa1efe 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux3d.i index af2ecf4c..6136784f 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4flux3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4fluxcorner3d.i index c24a00b7..2115d9da 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4fluxcorner3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4fluxcorner3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d corner flux calculation. +c define(st_third,`dnl do ic$3=ifirst$3-1,ilast$3+1 do ic$2=ifirst$2-1,ilast$2+1 diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace2d.i index 64054d15..082f7c22 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace2d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d trace calculation. +c define(trace_init,`dnl do ic$2=ifirst$2-FACEG,ilast$2+FACEG ie$1=ifirst$1-FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace3d.i index 743987f9..6b2a6ba4 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace3d.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/m4trace3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d trace calculation. +c define(trace_init,`dnl do ic$3=ifirst$3-FACEG,ilast$3+FACEG do ic$2=ifirst$2-FACEG,ilast$2+FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/probparams.i b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/probparams.i index 1b46a43e..b43283f0 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/probparams.i +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/probparams.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining common block. +c common/probparams/ & PIECEWISE_CONSTANT_X,PIECEWISE_CONSTANT_Y,PIECEWISE_CONSTANT_Z, & SINE_CONSTANT_X,SINE_CONSTANT_Y,SINE_CONSTANT_Z,SPHERE, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable2d.m4 index a788a373..08f8d880 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable2d.m4 @@ -1,11 +1,18 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for compuation of stable dt in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine stabledt2d(dx, & ifirst0,ilast0,ifirst1,ilast1, & ngc0,ngc1, - & advecspeed,uval,stabdt) + & advecspeed,stabdt) c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ implicit none include(FORTDIR/const.i)dnl @@ -14,8 +21,7 @@ c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ integer ifirst0,ilast0,ifirst1,ilast1,ngc0,ngc1 c REAL - & advecspeed(0:NDIM-1), - & uval(CELL2dVECG(ifirst,ilast,ngc)) + & advecspeed(0:NDIM-1) c REAL maxspeed(0:NDIM-1) c diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable3d.m4 index 0e11632b..eee53d42 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stable3d.m4 @@ -1,11 +1,18 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for compuation of stable dt in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine stabledt3d(dx, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, & ngc0,ngc1,ngc2, - & advecspeed,uval,stabdt) + & advecspeed,stabdt) c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ implicit none include(FORTDIR/const.i)dnl @@ -15,8 +22,7 @@ c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ & ngc0,ngc1,ngc2 c REAL - & advecspeed(0:NDIM-1), - & uval(CELL3dVECG(ifirst,ilast,ngc)) + & advecspeed(0:NDIM-1) c REAL maxspeed(0:NDIM-1) c diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stufprobc.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stufprobc.m4 index 64885c81..aa31d5da 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stufprobc.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/stufprobc.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine. +c subroutine stufprobc( & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, & PIECEWISE_CONSTANT_Zin, diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace1d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace1d.m4 index 182d48bf..c65db5e0 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace1d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 1d. +c define(NEQU,1)dnl define(REAL,`double precision')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace2d.m4 index edfdce15..7b2c637b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace in 2d. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4trace2d.i)dnl subroutine inittraceflux2d( @@ -65,7 +72,6 @@ c*********************************************************************** & mc, & dx, & advecspeed,igdnv, - & uval, & tracelft,tracergt, & ttcelslp,ttedgslp, & ttraclft,ttracrgt) @@ -79,9 +85,8 @@ c input arrays: c variables in 1d axis indexed REAL & dx,advecspeed -c variables in 2d axis indexed +c variables in 2d axis indexed REAL - & uval(CELL2d(ifirst,ilast,CELLG)), & tracelft(FACE2d0(ifirst,ilast,FACEG)), & tracergt(FACE2d0(ifirst,ilast,FACEG)) c side variables ifirst0 to ifirst0+mc plus ghost cells @@ -113,7 +118,6 @@ c*********************************************************************** & mc, & dx, & advecspeed,igdnv, - & uval, & tracelft,tracergt, & ttcelslp,ttedgslp, & ttraclft,ttracrgt) @@ -127,9 +131,8 @@ c input arrays: c variables in 1d axis indexed REAL & dx,advecspeed -c variables in 2d axis indexed +c variables in 2d axis indexed REAL - & uval(CELL2d(ifirst,ilast,CELLG)), & tracelft(FACE2d1(ifirst,ilast,FACEG)), & tracergt(FACE2d1(ifirst,ilast,FACEG)) c side variables ifirst1 to ifirst1+mc plus ghost cells diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace3d.m4 index 9ba8ae5a..57c060e2 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/fortran/trace3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4trace3d.i)dnl subroutine inittraceflux3d( @@ -82,7 +89,6 @@ c & mc, & dx, & advecspeed,igdnv, - & uval, & tracelft,tracergt, & ttcelslp,ttedgslp, & ttraclft,ttracrgt) @@ -97,9 +103,8 @@ c input arrays: c variables in 1d axis indexed REAL & dx,advecspeed -c variables in 2d axis indexed +c variables in 2d axis indexed REAL - & uval(CELL3d(ifirst,ilast,CELLG)), & tracelft(FACE3d0(ifirst,ilast,FACEG)), & tracergt(FACE3d0(ifirst,ilast,FACEG)) c side variables ifirst0 to ifirst0+mc plus ghost cells @@ -128,7 +133,6 @@ c*********************************************************************** & mc, & dx, & advecspeed,igdnv, - & uval, & tracelft,tracergt, & ttcelslp,ttedgslp, & ttraclft,ttracrgt) @@ -143,9 +147,8 @@ c input arrays: c variables in 1d axis indexed REAL & dx,advecspeed -c variables in 2d axis indexed +c variables in 2d axis indexed REAL - & uval(CELL3d(ifirst,ilast,CELLG)), & tracelft(FACE3d1(ifirst,ilast,FACEG)), & tracergt(FACE3d1(ifirst,ilast,FACEG)) REAL @@ -174,7 +177,6 @@ c*********************************************************************** & mc, & dx, & advecspeed,igdnv, - & uval, & tracelft,tracergt, & ttcelslp,ttedgslp, & ttraclft,ttracrgt) @@ -189,9 +191,8 @@ c input arrays: c variables in 1d axis indexed REAL & dx,advecspeed -c variables in 2d axis indexed +c variables in 2d axis indexed REAL - & uval(CELL3d(ifirst,ilast,CELLG)), & tracelft(FACE3d2(ifirst,ilast,FACEG)), & tracergt(FACE3d2(ifirst,ilast,FACEG)) REAL diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/main.C b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/main.C index 9105b035..622103e7 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/main.C +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI Linear Advection example problem. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/algs/HyperbolicLevelIntegrator.h" -#include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/CascadePartitioner.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/algs/TimeRefinementIntegrator.h" @@ -32,6 +32,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" @@ -43,10 +44,10 @@ // Classes for run-time plotting and autotesting. #if (TESTING == 1) -#include "AutoTester.h" +#include "test/testlib/AutoTester.h" #endif -#include +#include "boost/shared_ptr.hpp" #ifndef _MSC_VER #include @@ -119,12 +120,12 @@ using namespace SAMRAI; * which it is configured when they are passed into its * constructor. They are: * - * mesh::BergerRigoutsos - Clusters cells tagged for refinement on a + * mesh::BergerRigoutsos - Clusters cells tagged for refinement on a * patch level into a collection of logically-rectangular * box domains. * - * mesh::LoadBalancer - Processes the boxes generated by the - * mesh::BergerRigoutsos algorithm into a configuration from + * mesh::LoadBalancer - Processes the boxes generated by the + * mesh::BergerRigoutsos algorithm into a configuration from * which patches are contructed. The algorithm used in this * class assumes a spatially-uniform workload distribution; * thus, it attempts to produce a collection of boxes @@ -354,11 +355,11 @@ int main( new algs::HyperbolicLevelIntegrator( "HyperbolicLevelIntegrator", input_db->getDatabase("HyperbolicLevelIntegrator"), - linear_advection_model, true, use_refined_timestepping)); + linear_advection_model, + use_refined_timestepping)); boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); @@ -369,9 +370,10 @@ int main( input_db->getDatabaseWithDefault( "BergerRigoutsos", boost::shared_ptr()))); + box_generator->useDuplicateMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - boost::shared_ptr load_balancer( - new mesh::TreeLoadBalancer( + boost::shared_ptr load_balancer( + new mesh::CascadePartitioner( dim, "LoadBalancer", input_db->getDatabase("LoadBalancer"))); @@ -395,7 +397,7 @@ int main( hyp_level_integrator, gridding_algorithm)); - // VisitDataWriter is only present if HDF is available + // VisItDataWriter is only present if HDF is available #ifdef HAVE_HDF5 boost::shared_ptr visit_data_writer( new appu::VisItDataWriter( diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000001.0000000 index 622b30d0..58e74640 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000000 index 1de1cc47..bc9f25ec 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000001 index b844b94d..7aa82f3f 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..8799a985 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..d1d9db6e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..d2b9a081 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..a1243a55 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.input index c0b44e78..9da787f5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.2d.input @@ -1,61 +1,203 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). call_abort_in_serial_instead_of_exit = FALSE } AutoTester { + // If true, fluxes will be written out to a .dat file for inspection. + // Default is FALSE. test_fluxes = FALSE + + // iteration to carry out test. Default is 10. test_iter_num = 10 - correct_result = 4.5, 0.028125, 0.028125 - output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining + // Default is FALSE. write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + // Default is FALSE. read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. test_patch_boxes_filename = "test_inputs/test.2d.boxes" - simplify_test_boxes = TRUE + + // expected correct result + // Required if test_fluxes is FALSE. Unread otherwise. No default. + correct_result = 4.5, 0.028125, 0.028125 + + // if true will write corrct result--useful for rebaselining + // Default is FALSE. + output_correct = FALSE } LinAdv { + // Allow nonuniform workload. Default is FALSE. + use_nonuniform_workload = FALSE + // Linear advection velocity vector--vector of length dim. + // No default. advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } + // Order of Goduov slopes (1, 2, or 4). Default is 1. + godunov_order = 2 + + // Type of finite difference approximation for 3d transverse flux + // correction. Allowed values are CORNER_TRANSPORT_1 and + // CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + // Default is "CORNER_TRANSPORT_1". + corner_transport = "CORNER_TRANSPORT_1" + // Control of how to refine. Refinement_data { + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, + // UVAL_GRADIENT, UVAL_SHOCK, or UVAL_RICHARDSON. No default. refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + // Criteria for UVAL_GRADIENT refinement criteria. UVAL_GRADIENT { + // Array of variable gradient tagging tolerances, one value per level. + // If the number of levels is greater than the number of entries in + // this array then the tolerance for all finer levels is the last + // array entry. Gradients greater than this tolerance result in + // tagged cells. No default. grad_tol = 10.0 + + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 } + // Criteria for UVAL_SHOCK refinement criteria. UVAL_SHOCK { - shock_tol = 0.10 + // Array of shock tagging tolerances, one value per level. If the + // number of levels is greater than the number of entries in this + // array then the tolerance for all finer levels is the last array + // entry. No default. + shock_tol = 0.10 + + // Array of shock tagging onsets, one value per level. This value is + // used to prevent unintended overrefinement of large, smooth + // gradients resulting in smooth flow. If the number of levels is + // greater than the number of entries in this array then the onset for + // all finer levels is the last array entry. No default. shock_onset = 0.85 + + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 } + + // UVAL_DEVIATION + // dev_tol + // An array of uval deviation tolerances, one value per level. Cell + // is refined if (p - uval_dev) > dev_tol. If the number of levels + // is greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // uval_dev + // An array of uval deviations, one value per level. If the number of + // levels is greater than the number of entries in this array then the + // deviation of for all finer levels is the last array entry. + // No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + + // UVAL_RICHARDSON + // rich_tol + // An array of tolerances on the global error. Cells in which the global + // error exceeds the tolerance are tagged. If the number of levels is + // greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + } + + // General type of problem and its initial conditions. Options are + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z", "SINE_CONSTANT_X", "SINE_CONSTANT_Y", + // "SINE_CONSTANT_Z". Specific Initial_data inputs vary by problem type. + // No default. + data_problem = "SPHERE" + Initial_data { + // Radius of sphere. No default. + radius = 2.9 + + // Center of sphere. No default. + center = 22.5 , 5.5 + + // uval inside of sphere. No default. + uval_inside = 80.0 + + // uval outside of sphere. No default. + uval_outside = 5.0 + } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -93,22 +235,53 @@ LinAdv { } Main { + // Dimension of problem. No default. dim = 2 + + + // Base name of log and viz files. Default is "unnamed". base_name = "test.2d" -// log file parameters + + + // Explicit name of log file. Default is base_name + ".log" + log_filename = "test.2d.log" + + + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 1 // zero to turn off + + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off + // Default is 0. + viz_dump_interval = 1 + + // Directory in which to place viz output. + // Default is base_name + ".visit" viz_dump_dirname = "viz-test-2d" -// restart dump parameters - restart_interval = 1 // zero to turn off - plotting_interval = 0 + // Restart dump parameters. + + // Frequency at which to dump restart output--zero to turn off + // Default is 0. + restart_interval = 1 + + // Directory in which to place restart output. + // Default is base_name + ".restart" + restart_write_dirname = "test.2d.restart" + + + // If anything but "SYNCHRONIZED" will use refined timestepping. + // Default is not "SYNCHRONIZED". +// use_refined_timestepping = "SYNCHRONIZED" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -118,10 +291,11 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 // SGS TODO this was added for DistributedGriddingAlgorthm level_2 = 4 , 4 @@ -129,7 +303,7 @@ PatchHierarchy { } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -140,25 +314,27 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - sequentialize_patch_indices = TRUE // Required for plotting. print_mapped_box_level_hierarchy = 'y' } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -166,6 +342,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -173,6 +350,7 @@ TimeRefinementIntegrator{ max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000001.0000000 index 2b386c81..785f9e65 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000000 index 4163a840..015c54c9 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000001 index bc8f1501..0500d794 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..4574ae58 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..59455412 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..b575a72e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..f63d63f2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.input index b5c29b67..2aa6c2b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test.3d.input @@ -1,39 +1,63 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 9.0, 0.225, 0.225 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test.3d.boxes" - simplify_test_boxes = TRUE } LinAdv { - + // Linear advection velocity vector--vector of length dim advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 2.9 center = 5.5 , 5.5 , 5.5 @@ -43,6 +67,9 @@ LinAdv { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" @@ -51,12 +78,13 @@ LinAdv { } UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -160,19 +188,28 @@ LinAdv { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz-test-3d" -// restart dump parameters - restart_interval = 1 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [ (0,0,0) , (14,9,9) ] @@ -180,8 +217,9 @@ CartesianGeometry{ x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -190,14 +228,14 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 , 2 level_2 = 2 , 2 , 2 level_3 = 2 , 2 , 2 } largest_patch_size { - level_0 = 40 , 40 , 40 + level_0 = 40 , 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -208,22 +246,25 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -231,13 +272,15 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps + max_integrator_steps = 10 // max number of simulation timesteps } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.2d.input new file mode 100644 index 00000000..15da632d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.2d.input @@ -0,0 +1,356 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem + * + ************************************************************************/ + +GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). + call_abort_in_serial_instead_of_exit = FALSE +} + +AutoTester { + // If true, fluxes will be written out to a .dat file for inspection. + // Default is FALSE. + test_fluxes = FALSE + + // iteration to carry out test. Default is 10. + test_iter_num = 10 + + // if true will write correct patch boxes--useful for rebaselining + // Default is FALSE. + write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + // Default is FALSE. + read_patch_boxes = TRUE + + // time steps for which correctness of patch boxes will be checked + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_filename = "test_inputs/test.2d.boxes" + + // expected correct result + // Required if test_fluxes is FALSE. Unread otherwise. No default. + correct_result = 4.5, 0.028125, 0.028125 + + // if true will write corrct result--useful for rebaselining + // Default is FALSE. + output_correct = FALSE +} + +LinAdv { + // Allow nonuniform workload. Default is FALSE. + use_nonuniform_workload = TRUE + + // Linear advection velocity vector--vector of length dim. + // No default. + advection_velocity = 2.0e0 , 1.0e0 + + // Order of Goduov slopes (1, 2, or 4). Default is 1. + godunov_order = 2 + + // Type of finite difference approximation for 3d transverse flux + // correction. Allowed values are CORNER_TRANSPORT_1 and + // CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + // Default is "CORNER_TRANSPORT_1". + corner_transport = "CORNER_TRANSPORT_1" + + // Control of how to refine. + Refinement_data { + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, + // UVAL_GRADIENT, UVAL_SHOCK, or UVAL_RICHARDSON. No default. + refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + + // Criteria for UVAL_GRADIENT refinement criteria. + UVAL_GRADIENT { + // Array of variable gradient tagging tolerances, one value per level. + // If the number of levels is greater than the number of entries in + // this array then the tolerance for all finer levels is the last + // array entry. Gradients greater than this tolerance result in + // tagged cells. No default. + grad_tol = 10.0 + + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 + } + + // Criteria for UVAL_SHOCK refinement criteria. + UVAL_SHOCK { + // Array of shock tagging tolerances, one value per level. If the + // number of levels is greater than the number of entries in this + // array then the tolerance for all finer levels is the last array + // entry. No default. + shock_tol = 0.10 + + // Array of shock tagging onsets, one value per level. This value is + // used to prevent unintended overrefinement of large, smooth + // gradients resulting in smooth flow. If the number of levels is + // greater than the number of entries in this array then the onset for + // all finer levels is the last array entry. No default. + shock_onset = 0.85 + + // Array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the maximum simulation time for all + // finer levels is the last array entry. + // Default is all time (maximum double) for all levels. +// time_max = 1000000.0 + + // Array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number + // of entries in this array then the minimum simulation time for all + // finer levels is the last array entry. + // Default is 0.0 for all levels. + time_min = 0.0 + } + + // UVAL_DEVIATION + // dev_tol + // An array of uval deviation tolerances, one value per level. Cell + // is refined if (p - uval_dev) > dev_tol. If the number of levels + // is greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // uval_dev + // An array of uval deviations, one value per level. If the number of + // levels is greater than the number of entries in this array then the + // deviation of for all finer levels is the last array entry. + // No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + + // UVAL_RICHARDSON + // rich_tol + // An array of tolerances on the global error. Cells in which the global + // error exceeds the tolerance are tagged. If the number of levels is + // greater than the number of entries in this array then the tolerance + // for all finer levels is the last array entry. No default. + // time_max + // An array of maximum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the maximum simulation time for all finer + // levels is the last array entry. Default is all time (maximum double) + // for all levels. + // time_min + // An array of minimum simulation times for which this criteria applies, + // one per level. If the number of levels is greater than the number of + // entries in this array then the minimum simulation time for all finer + // levels is the last array entry. Default is 0.0 for all levels. + } + + // General type of problem and its initial conditions. Options are + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z", "SINE_CONSTANT_X", "SINE_CONSTANT_Y", + // "SINE_CONSTANT_Z". Specific Initial_data inputs vary by problem type. + // No default. + data_problem = "SPHERE" + Initial_data { + // Radius of sphere. No default. + radius = 2.9 + + // Center of sphere. No default. + center = 22.5 , 5.5 + + // uval inside of sphere. No default. + uval_inside = 80.0 + + // uval outside of sphere. No default. + uval_outside = 5.0 + + } + + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. + Boundary_data { + boundary_edge_xlo { + boundary_condition = "FLOW" + } + boundary_edge_xhi { + boundary_condition = "FLOW" + } + boundary_edge_ylo { + boundary_condition = "FLOW" + } + boundary_edge_yhi { + boundary_condition = "FLOW" + } + + // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given + // for a node, the condition must match that of the + // appropriate adjacent edge above. This is enforced for + // consistency. However, note when a REFLECT edge condition + // is given and the other adjacent edge has either a FLOW + // or REFLECT condition, the resulting node boundary values + // will be the same regardless of which edge is used. + boundary_node_xlo_ylo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi { + boundary_condition = "XFLOW" + } + } +} + +Main { + // Dimension of problem. No default. + dim = 2 + + + // Base name of log and viz files. Default is "unnamed". + base_name = "test.2d" + + + // Explicit name of log file. Default is base_name + ".log" + log_filename = "test.2d.log" + + + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. + log_all_nodes = TRUE + + + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off + // Default is 0. + viz_dump_interval = 1 + + // Directory in which to place viz output. + // Default is base_name + ".visit" + viz_dump_dirname = "viz-test-2d" + + + // Restart dump parameters. + + // Frequency at which to dump restart output--zero to turn off + // Default is 0. + restart_interval = 1 + + // Directory in which to place restart output. + // Default is base_name + ".restart" + restart_write_dirname = "test.2d.restart" + + + // If anything but "SYNCHRONIZED" will use refined timestepping. + // Default is not "SYNCHRONIZED". +// use_refined_timestepping = "SYNCHRONIZED" + +} + +// Refer to geom::CartesianGridGeometry and its base classes for input +CartesianGeometry{ + domain_boxes = [(0,0),(29,19)] + + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 30.e0 , 20.e0 // upper end of computational domain. + + periodic_dimension = 1,0 +} + +// Refer to hier::PatchHierarchy for input +PatchHierarchy { + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + // SGS TODO this was added for DistributedGriddingAlgorthm + level_2 = 4 , 4 + // all finer levels will use same values as level_0... + } + + largest_patch_size { + level_0 = 40 , 40 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 12 , 12 + // all finer levels will use same values as level_0... + } + +} + +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ + sequentialize_patch_indices = TRUE // Required for plotting. + + print_mapped_box_level_hierarchy = 'y' +} + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +// Refer to mesh::StandardTagAndInitialize for input +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + +// Refer to algs::HyperbolicLevelIntegrator for input +HyperbolicLevelIntegrator{ + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.9e0 // initial cfl factor + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE +} + +// Refer to algs::TimeRefinementIntegrator for input +TimeRefinementIntegrator{ + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps +} + +// Refer to mesh::TreeLoadBalancer for input +LoadBalancer { + // using default TreeLoadBalancer configuration +} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.3d.input new file mode 100644 index 00000000..6cb42ff6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_nonuniform.3d.input @@ -0,0 +1,288 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem + * + ************************************************************************/ + +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + +GlobalInputs { + call_abort_in_serial_instead_of_exit = FALSE +} + +AutoTester { + // iteration to carry out test + test_iter_num = 10 + + // expected correct result + correct_result = 9.0, 0.225, 0.225 + + // if true will write corrct result--useful for rebaselining + output_correct = FALSE + + // if true will write correct patch boxes--useful for rebaselining + write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + read_patch_boxes = TRUE + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + test_patch_boxes_filename = "test_inputs/test.3d.boxes" + +} + +LinAdv { + use_nonuniform_workload = TRUE + + // Linear advection velocity vector--vector of length dim + advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + corner_transport = "CORNER_TRANSPORT_1" + + // General type of problem and its initial conditions. + data_problem = "SPHERE" + Initial_data { + radius = 2.9 + center = 5.5 , 5.5 , 5.5 + + uval_inside = 80.0 + uval_outside = 5.0 + + } + + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. + Refinement_data { + refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + + UVAL_GRADIENT { + grad_tol = 10.0 + } + + UVAL_SHOCK { + shock_tol = 10.0 + shock_onset = 0.85 + } + } + + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] + Boundary_data { + boundary_face_xlo { + boundary_condition = "FLOW" + } + boundary_face_xhi { + boundary_condition = "FLOW" + } + boundary_face_ylo { + boundary_condition = "FLOW" + } + boundary_face_yhi { + boundary_condition = "FLOW" + } + boundary_face_zlo { + boundary_condition = "FLOW" + } + boundary_face_zhi { + boundary_condition = "FLOW" + } + + // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given + // for an edge, the condition must match that of the + // appropriate adjacent face above. This is enforced for + // consistency. However, note when a REFLECT face condition + // is given and the other adjacent face has either a FLOW + // or REFLECT condition, the resulting edge boundary values + // will be the same regardless of which face is used. + + boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + + // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given + // for a node, the condition must match that of the + // appropriate adjacent face above. This is enforced for + // consistency. However, note when a REFLECT face condition + // is given and the other adjacent faces have either FLOW + // or REFLECT conditions, the resulting node boundary values + // will be the same regardless of which face is used. + + boundary_node_xlo_ylo_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_ylo_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi_zhi { + boundary_condition = "XFLOW" + } + + } + +} + +Main { + // dimension of problem + dim = 3 + + // base name of log file + base_name = "test.3d" + + // if true all nodes will log to individual files + // if false only node 0 will log + log_all_nodes = TRUE + + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output + viz_dump_dirname = "viz-test-3d" + + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 +} + +// Refer to geom::CartesianGridGeometry and its base classes for input +CartesianGeometry{ + domain_boxes = [ (0,0,0) , (29,19,19) ] + + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. +} + +// Refer to hier::PatchHierarchy for input +PatchHierarchy { + max_levels = 3 // Maximum number of levels in hierarchy. + +// Note: For the following regridding information, data is required for each +// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. +// If more data values than needed are given, only the number required +// will be read in. If fewer values are given, an error will result. +// +// Specify coarsening ratios for each level 1 through max_levels-1 + + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 , 2 + level_2 = 2 , 2 , 2 + level_3 = 2 , 2 , 2 + } + + largest_patch_size { + level_0 = 40 , 40 , 40 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 9 , 9 , 9 + // all finer levels will use same values as level_0... + } + +} + +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +// Refer to mesh::StandardTagAndInitialize for input +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + + +// Refer to algs::HyperbolicLevelIntegrator for input +HyperbolicLevelIntegrator{ + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.9e0 // initial cfl factor + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE +} + +// Refer to algs::TimeRefinementIntegrator for input +TimeRefinementIntegrator{ + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps +} + +// Refer to mesh::TreeLoadBalancer for input +LoadBalancer { + // using default TreeLoadBalancer configuration +} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_restart.2d.input deleted file mode 100644 index 204ad9b7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_restart.2d.input +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -GlobalInputs { - call_abort_in_serial_instead_of_exit = FALSE -} - -AutoTester { - test_fluxes = FALSE - test_iter_num = 10 - correct_result = 4.5, 0.028125, 0.028125 - output_correct = FALSE - - write_patch_boxes = FALSE - read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data - test_patch_boxes_filename = "test_inputs/test_restart.2d.boxes" - simplify_test_boxes = TRUE - -} - -LinAdv { - - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_RICHARDSON" - - UVAL_RICHARDSON { - rich_tol = 0.1, 0.1, 0.001 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi { - boundary_condition = "XFLOW" - } - } - -} - -Main { - dim = 2 - base_name = "test_restart.2d" -// log file parameters - log_all_nodes = TRUE - -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-2d-re" - -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 - -} - -CartesianGeometry{ - domain_boxes = [(0,0),(29,19)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 30.e0 , 20.e0 // upper end of computational domain. - - periodic_dimension = 1,0 -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - - largest_patch_size { - level_0 = 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 16 , 16 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. -} - -StandardTagAndInitialize { - tagging_method = "RICHARDSON_EXTRAPOLATION" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000001.0000000 index 8286e3e6..995d1f73 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000000 index 1e2726d7..be3c9c64 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000001 index f3cfd9ae..a7555161 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..bb292fcf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..c5f52a99 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..f63dfe2a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..1b272493 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.input index 0a33faaa..38e28798 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.2d.input @@ -1,39 +1,63 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.28125, 0.028125, 0.028125 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync.2d.boxes" - simplify_test_boxes = TRUE } LinAdv { - + // Linear advection velocity vector--vector of length dim advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 2.9 center = 22.5 , 5.5 @@ -43,6 +67,9 @@ LinAdv { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" @@ -51,12 +78,13 @@ LinAdv { } UVAL_SHOCK { - shock_tol = 0.10 + shock_tol = 0.10 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -94,23 +122,31 @@ LinAdv { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "test_sync.2d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz-test-2d-sync" -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -120,17 +156,18 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -141,21 +178,24 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -163,6 +203,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -171,6 +212,7 @@ TimeRefinementIntegrator{ regrid_interval = 2 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000001.0000000 index 7e3041ff..772136b1 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000000 index 85b07155..eb5c9813 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000001 index 692b9b8d..88783f2c 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..4d1871a3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..bfefe755 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..3fd0df10 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..9c90df09 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.input index b728cd11..cea3dad7 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync.3d.input @@ -1,39 +1,63 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 2.25, 0.225, 0.225 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync.3d.boxes" - simplify_test_boxes = TRUE } LinAdv { - + // Linear advection velocity vector--vector of length dim advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 2.9 center = 5.5 , 5.5 , 5.5 @@ -43,6 +67,9 @@ LinAdv { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" @@ -51,12 +78,13 @@ LinAdv { } UVAL_SHOCK { - shock_tol = 10.0 + shock_tol = 10.0 shock_onset = 0.85 } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -160,21 +188,31 @@ LinAdv { } Main { + // dimension of problem dim = 3 + + // base name of log file base_name = "test_sync.3d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz-test-3d-sync" -// restart dump parameters - restart_interval = 1 // zero to turn off + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [ (0,0,0) , (14,9,9) ] @@ -182,8 +220,9 @@ CartesianGeometry{ x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. // Note: For the following regridding information, data is required for each // potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. @@ -192,14 +231,14 @@ PatchHierarchy { // // Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 2 , 2 , 2 level_2 = 2 , 2 , 2 level_3 = 2 , 2 , 2 } largest_patch_size { - level_0 = 40 , 40 , 40 + level_0 = 40 , 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -210,22 +249,25 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -233,14 +275,15 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps + max_integrator_steps = 10 // max number of simulation timesteps regrid_interval = 2 } LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000001.0000000 index 21e11781..0fb74abe 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000001.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000000 index 256e5cca..0526bfcd 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000000 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000001 index 3aa45431..173e9223 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000001 and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..03b82dee Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..7a2f5027 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..7663eaa1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..6335a472 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.input index d4e9e5d3..57290234 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_sync_restart.2d.input @@ -1,39 +1,63 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem * ************************************************************************/ +// Refer to test2d.input for full description of all input parameters specific +// to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } AutoTester { - test_fluxes = FALSE + // iteration to carry out test test_iter_num = 10 + + // expected correct result correct_result = 0.28125, 0.028125, 0.028125 + + // if true will write corrct result--useful for rebaselining output_correct = FALSE + // if true will write correct patch boxes--useful for rebaselining write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data + + // time steps for which correctness of patch boxes will be checked + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes test_patch_boxes_filename = "test_inputs/test_sync_restart.2d.boxes" - simplify_test_boxes = TRUE } LinAdv { - + // Linear advection velocity vector--vector of length dim advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // type of finite difference approximation for 3d transverse flux correction + // Allowed values are CORNER_TRANSPORT_1 and CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. corner_transport = "CORNER_TRANSPORT_1" + // General type of problem and its initial conditions. data_problem = "SPHERE" - Initial_data { radius = 2.9 center = 22.5 , 5.5 @@ -43,6 +67,9 @@ LinAdv { } + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, UVAL_GRADIENT, + // UVAL_SHOCK, or UVAL_RICHARDSON. Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK", @@ -53,7 +80,7 @@ LinAdv { } UVAL_SHOCK { - shock_tol = 0.10 + shock_tol = 0.10 shock_onset = 0.85 } @@ -62,7 +89,8 @@ LinAdv { } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3] Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -101,23 +129,31 @@ LinAdv { } Main { + // dimension of problem dim = 2 + + // base name of log file base_name = "test_sync_restart.2d" -// log file parameters + + // if true all nodes will log to individual files + // if false only node 0 will log log_all_nodes = TRUE -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off + // visualization dump parameters + // frequency at which to dump viz output--zero to turn off + viz_dump_interval = 0 + // directory in which to place viz output viz_dump_dirname = "viz-test-2d-sync-re" -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 + // restart dump parameters + // frequency at which to dump restart output--zero to turn off + restart_interval = 1 + // timestepping method--if not SYNCHRONIZED uses refined time stepping timestepping = "SYNCHRONIZED" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0),(29,19)] @@ -127,17 +163,18 @@ CartesianGeometry{ periodic_dimension = 1,0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. + max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level + ratio_to_coarser { // vector ratio to next coarser level level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 } largest_patch_size { - level_0 = 40 , 40 + level_0 = 40 , 40 // largest patch allowed in hierarchy // all finer levels will use same values as level_0... } @@ -148,22 +185,25 @@ PatchHierarchy { } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - sort_output_nodes = TRUE // Makes results repeatable. + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { // tagging_method = "GRADIENT_DETECTOR" tagging_method = "RICHARDSON_EXTRAPOLATION" } +// Refer to algs::HyperbolicLevelIntegrator for input HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -171,6 +211,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } +// Refer to algs::TimeRefinementIntegrator for input TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -179,6 +220,7 @@ TimeRefinementIntegrator{ regrid_interval = 2 } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) + // using default TreeLoadBalancer configuration } diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_time_refinement.2d.input b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_time_refinement.2d.input new file mode 100644 index 00000000..921e9b31 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/test_time_refinement.2d.input @@ -0,0 +1,265 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI LinAdv example problem + * + ************************************************************************/ + +GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). + call_abort_in_serial_instead_of_exit = FALSE +} + +AutoTester { + // If true, fluxes will be written out to a .dat file for inspection. + // Default is FALSE. + test_fluxes = TRUE + + // iteration to carry out test. Default is 10. + test_iter_num = 10 + + // if true will write correct patch boxes--useful for rebaselining + // Default is FALSE. + write_patch_boxes = FALSE + + // if true will read correct patch boxes--set to FALSE to rebaseline + // Default is FALSE. + read_patch_boxes = FALSE + + // time steps for which correctness of patch boxes will be checked + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_at_steps = 0, 5, 10 + + // base name of files containing correct patch boxes + // Required if one of write_patch_boxes or read_patch_boxes is true. + // No default. + test_patch_boxes_filename = "test_inputs/test.2d.boxes" + + // expected correct result + // Required if test_fluxes is FALSE. Unread otherwise. No default. + correct_result = 4.5, 0.028125, 0.028125 + + // if true will write corrct result--useful for rebaselining + // Default is FALSE. + output_correct = FALSE +} + +LinAdv { + // Allow nonuniform workload. Default is FALSE. + use_nonuniform_workload = FALSE + + // Linear advection velocity vector--vector of length dim. + // No default. + advection_velocity = 1.0e0 , 0.0e0 + + // Add source term which admits u=t solution. + source = 1.0 + + // trigger internal test for 0 net fluxes + check_fluxes = TRUE + + // Order of Goduov slopes (1, 2, or 4). Default is 1. + godunov_order = 2 + + // Type of finite difference approximation for 3d transverse flux + // correction. Allowed values are CORNER_TRANSPORT_1 and + // CORNER_TRANSPORT_2. + // CORNER_TRANSPORT_1 means to compute numerical approximations to flux + // terms using an extension to three dimensions of Collella's corner + // transport upwind approach. + // CORNER_TRANSPORT_2 means to compute numerical approximations to flux + // terms using John Trangenstein's interpretation of the three-dimensional + // version of Collella's corner transport upwind approach. + // Default is "CORNER_TRANSPORT_1". + corner_transport = "CORNER_TRANSPORT_1" + + // Control of how to refine. + Refinement_data { + // Refinement criteria and, for each, the parameters controling it. + // Refinement criteria may be one or more of UVAL_DEVIATION, + // UVAL_GRADIENT, UVAL_SHOCK, or UVAL_RICHARDSON. No default. + refine_criteria = "RANDOM" + + RANDOM { + threshold = 0.005 + } + } + + // General type of problem and its initial conditions. Options are + // "SPHERE", "PIECEWISE_CONSTANT_X", "PIECEWISE_CONSTANT_"Y, + // "PIECEWISE_CONSTANT_Z", "SINE_CONSTANT_X", "SINE_CONSTANT_Y", + // "SINE_CONSTANT_Z". Specific Initial_data inputs vary by problem type. + // No default. + data_problem = "PIECEWISE_CONSTANT_X" + Initial_data { + front_position = 0.0 + interval_0 { + uval = 0 + } + } + + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. + Boundary_data { + boundary_edge_xlo { + boundary_condition = "FLOW" + } + boundary_edge_xhi { + boundary_condition = "FLOW" + } + boundary_edge_ylo { + boundary_condition = "FLOW" + } + boundary_edge_yhi { + boundary_condition = "FLOW" + } + + // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given + // for a node, the condition must match that of the + // appropriate adjacent edge above. This is enforced for + // consistency. However, note when a REFLECT edge condition + // is given and the other adjacent edge has either a FLOW + // or REFLECT condition, the resulting node boundary values + // will be the same regardless of which edge is used. + boundary_node_xlo_ylo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi { + boundary_condition = "XFLOW" + } + } +} + +Main { + // Dimension of problem. No default. + dim = 2 + + + // Base name of log and viz files. Default is "unnamed". + base_name = "test.2d" + + + // Explicit name of log file. Default is base_name + ".log" + log_filename = "test.2d.log" + + + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. + log_all_nodes = TRUE + + + // Visualization dump parameters. + + // Frequency at which to dump viz output--zero to turn off + // Default is 0. + viz_dump_interval = 1 + + // Directory in which to place viz output. + // Default is base_name + ".visit" + viz_dump_dirname = "viz-test-2d" + + + // Restart dump parameters. + + // Frequency at which to dump restart output--zero to turn off + // Default is 0. + restart_interval = 1 + + // Directory in which to place restart output. + // Default is base_name + ".restart" + restart_write_dirname = "test.2d.restart" + + + // If anything but "SYNCHRONIZED" will use refined timestepping. + // Default is not "SYNCHRONIZED". +// use_refined_timestepping = "SYNCHRONIZED" + +} + +// Refer to geom::CartesianGridGeometry and its base classes for input +CartesianGeometry{ + domain_boxes = [(0,0),(29,19)] + + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 30.e0 , 20.e0 // upper end of computational domain. + + periodic_dimension = 1,0 +} + +// Refer to hier::PatchHierarchy for input +PatchHierarchy { + max_levels = 3 // Maximum number of levels in hierarchy. + + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2,2 +// level_1 = 4 , 4 + // SGS TODO this was added for DistributedGriddingAlgorthm + level_2 = 4 , 4 + // all finer levels will use same values as level_0... + } + + largest_patch_size { + level_0 = 40 , 40 // largest patch allowed in hierarchy + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 16 , 16 + // all finer levels will use same values as level_0... + } + +} + +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ + sequentialize_patch_indices = TRUE // Required for plotting. + + print_mapped_box_level_hierarchy = 'y' +} + +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { + sort_output_nodes = TRUE // Makes results repeatable. + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +// Refer to mesh::StandardTagAndInitialize for input +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + +// Refer to algs::HyperbolicLevelIntegrator for input +HyperbolicLevelIntegrator{ + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.9e0 // initial cfl factor + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE + use_flux_correction = FALSE +} + +// Refer to algs::TimeRefinementIntegrator for input +TimeRefinementIntegrator{ + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 10 // max number of simulation timesteps +} + +// Refer to mesh::TreeLoadBalancer for input +LoadBalancer { + // using default TreeLoadBalancer configuration +} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..58e74640 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..bc9f25ec Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..7aa82f3f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..8799a985 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..d1d9db6e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..d2b9a081 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..a1243a55 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..8ee60de9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..428c4bf9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..f11b10c0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..9af5eabe Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..f08ab48a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..5240e795 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..c84c4aa2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..bf920c2a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..0455bb83 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..3a54fe06 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..72a130cf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..1a27b9f2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..374db46a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..5f1a434b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..ae321f71 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..7acaa468 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..a0a2d15a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..4c06fa0e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..b13ca093 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..3efa4054 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..5d7fd9b1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..0990325a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..257dad27 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..4f43aef9 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..28386805 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..56f4ca0f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..910603cf Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..d08b1e65 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC/test_sync_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..03387a2a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..79f001d6 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..11c7cab0 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..5355de96 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..cecc5c53 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..284d0ffb Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..63742c9f Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..d6e8ffc7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..6f06b332 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..f1a7486a Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..2d27905b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..385cfc45 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..cc2fdd8d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..abbbf6b4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..b5b30670 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..6d2f910c Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..403e9a3b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..b36e30f3 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..7f5d8c4b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..ba3d2960 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..9a066a2b Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 new file mode 100644 index 00000000..2de4ccc1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 new file mode 100644 index 00000000..be5b4e99 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 new file mode 100644 index 00000000..017225e2 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 new file mode 100644 index 00000000..4aaa8ea4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 new file mode 100644 index 00000000..e9fd01d1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 new file mode 100644 index 00000000..8e94fac7 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 new file mode 100644 index 00000000..bc2f2726 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync.3d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000001.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000001.0000000 new file mode 100644 index 00000000..77b23dd4 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000001.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000000 new file mode 100644 index 00000000..50e1e5a1 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000001 new file mode 100644 index 00000000..a9fe35dc Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000002.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000000 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000000 new file mode 100644 index 00000000..fa75832d Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000000 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000001 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000001 new file mode 100644 index 00000000..2cf27ca5 Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000001 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000002 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000002 new file mode 100644 index 00000000..394b951e Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000002 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000003 b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000003 new file mode 100644 index 00000000..13e5fcca Binary files /dev/null and b/base/SAMRAI/SAMRAI/source/test/applications/LinAdv/test_inputs/xlC_debug/test_sync_restart.2d.boxes.0000004.0000003 differ diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/applications/Makefile.depend deleted file mode 100644 index 8db011ed..00000000 --- a/base/SAMRAI/SAMRAI/source/test/applications/Makefile.depend +++ /dev/null @@ -1,142 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile dependencies -## -######################################################################### - -## This file is automatically generated by depend.pl. - - -FILE_0=AutoTester.o -DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ - $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ - $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h AutoTester.C \ - AutoTester.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - diff --git a/base/SAMRAI/SAMRAI/source/test/applications/Makefile.in b/base/SAMRAI/SAMRAI/source/test/applications/Makefile.in index 78683735..f76fa216 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/applications/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the applications directory ## ######################################################################### @@ -21,14 +21,6 @@ SUBDIRS = LinAdv Euler ConvDiff library: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib1d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib2d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib3d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -libXd: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done check: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done check2d: @@ -36,8 +28,17 @@ check2d: check3d: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done checkcompile: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + (cd $(OBJECT)/source/test/testlib && $(MAKE) $@) + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done checktest: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +examples: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +perf: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +everything: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done clean: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +checkclean: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.depend new file mode 100644 index 00000000..6e6b0ee1 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.depend @@ -0,0 +1,78 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=main.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartition.h \ + $(INCLUDE_SAM)/SAMRAI/hier/AssumedPartitionBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.in b/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.in new file mode 100644 index 00000000..86b5c55d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/Makefile.in @@ -0,0 +1,75 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for timer and statistician main programs +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/assumed_partition +VPATH = @srcdir@ +TESTTOOLS = ../testtools +OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml + +default: check + +include $(OBJECT)/config/Makefile.config + +CPPFLAGS_EXTRA= -DTESTING=1 + +main: main.o $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(LIBSAMRAI) $(LDLIBS) -o main + +NUM_TESTS = 6 + +TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +checkcompile: main + +check: checkcompile + @for i in test_inputs/single*.input test_inputs/multi*.input; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +check2d: + $(MAKE) check + +check3d: + $(MAKE) check + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/README b/base/SAMRAI/SAMRAI/source/test/assumed_partition/README new file mode 100644 index 00000000..6351c205 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/README @@ -0,0 +1,25 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI tranformation class. +## +######################################################################### + +This is a unit test of SAMRAI's AssumedPartition classes. + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make checkcompile + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/main.C b/base/SAMRAI/SAMRAI/source/test/assumed_partition/main.C new file mode 100644 index 00000000..65e73eb5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/main.C @@ -0,0 +1,224 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test program to test the AssumedPartition classes + * + ************************************************************************/ + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/MemoryDatabase.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/AssumedPartitionBox.h" +#include "SAMRAI/hier/AssumedPartition.h" +#include "SAMRAI/geom/GridGeometry.h" + +using namespace std; + +using namespace SAMRAI; + +struct CommonTestParams { + hier::Box box; + boost::shared_ptr geometry; + int rank_begin; + int rank_end; + int index_begin; + double avg_parts_per_rank; + CommonTestParams( + const tbox::Dimension& dim): + box(dim), + rank_begin(0), + rank_end(tbox::SAMRAI_MPI::getSAMRAIWorld().getSize()), + index_begin(0), + avg_parts_per_rank(1.0) { + } + CommonTestParams( + const CommonTestParams& other): + box(other.box), + geometry(other.geometry), + rank_begin(other.rank_begin), + rank_end(other.rank_end), + index_begin(other.index_begin), + avg_parts_per_rank(other.avg_parts_per_rank) { + } +}; + +CommonTestParams +getTestParametersFromDatabase( + tbox::Database& test_db); + +int +main( + int argc, + char* argv[]) +{ + tbox::SAMRAI_MPI::init(&argc, &argv); + tbox::SAMRAIManager::initialize(); + tbox::SAMRAIManager::startup(); + + const tbox::SAMRAI_MPI& mpi = tbox::SAMRAI_MPI::getSAMRAIWorld(); + + int fail_count = 0; + + /* + * Process command line arguments. For each run, the input + * filename must be specified. Usage is: + * + * executable + */ + std::string input_filename; + + if (argc < 2) { + TBOX_ERROR("USAGE: " << argv[0] << " [case name]\n" + << " options:\n" + << " none at this time" << std::endl); + } else { + input_filename = argv[1]; + } + + /* + * Create block to force pointer deallocation. If this is not done + * then there will be memory leaks reported. + */ + { + /* + * Create input database and parse all data in input file. + */ + boost::shared_ptr input_db(new tbox::MemoryDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + boost::shared_ptr main_db = input_db->getDatabase("Main"); + + std::string base_name = "unnamed"; + base_name = main_db->getStringWithDefault("base_name", base_name); + + /* + * Modify basename for this particular run. + * Add the number of processes and the case name. + */ + std::string base_name_ext = base_name; + base_name_ext = base_name_ext + '-' + + tbox::Utilities::nodeToString(mpi.getSize()); + + /* + * Start logging. + */ + const std::string log_file_name = base_name_ext + ".log"; + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", + log_all_nodes); + if (log_all_nodes) { + tbox::PIO::logAllNodes(log_file_name); + } else { + tbox::PIO::logOnlyNodeZero(log_file_name); + } + + { + + int test_number = 0; + + while (true) { + + std::string test_name("Test"); + test_name += tbox::Utilities::intToString(test_number, 2); + + boost::shared_ptr test_db = + input_db->getDatabaseWithDefault(test_name, boost::shared_ptr()); + + if (!test_db) { + break; + } + + const std::string nickname = + test_db->getStringWithDefault("nickname", test_name); + + tbox::plog << "\n\n"; + tbox::pout << "Running " << test_name << " (" << nickname << ")\n"; + + CommonTestParams ctp = getTestParametersFromDatabase(*test_db); + + size_t test_fail_count = 0; + if (ctp.geometry) { + // Test multi-box assumed partitions. + hier::AssumedPartition ap(ctp.geometry->getPhysicalDomain(), + ctp.rank_begin, + ctp.rank_end, + ctp.index_begin, + ctp.avg_parts_per_rank); + tbox::plog << "AssumedPartition:\n"; + ap.recursivePrint(tbox::plog, "\t"); + test_fail_count = ap.selfCheck(); + } else { + // Test single-box assumed partitions. + hier::AssumedPartitionBox apb(ctp.box, + ctp.rank_begin, + ctp.rank_end, + ctp.index_begin, + ctp.avg_parts_per_rank); + tbox::plog << "AssumedPartitionBox:\n"; + apb.recursivePrint(tbox::plog, "\t"); + test_fail_count = apb.selfCheck(); + } + + fail_count += static_cast(test_fail_count); + if (test_fail_count) { + tbox::pout << "FAILED: selfCheck found " << fail_count << " problems in test " + << test_name << " (" << nickname << ')' << std::endl; + } + + ++test_number; + + } + } + + } + + if (fail_count == 0) { + tbox::pout << "\nPASSED: assumed_partition" << std::endl; + } + + tbox::SAMRAIManager::shutdown(); + tbox::SAMRAIManager::finalize(); + tbox::SAMRAI_MPI::finalize(); + return fail_count; +} + +/* + ************************************************************************* + ************************************************************************* + */ +CommonTestParams +getTestParametersFromDatabase( + tbox::Database& test_db) +{ + const tbox::Dimension dim(static_cast(test_db.getInteger("dim"))); + CommonTestParams ctp(dim); + if (test_db.isDatabaseBox("box")) { + ctp.box = test_db.getDatabaseBox("box"); + ctp.box.setBlockId(hier::BlockId(0)); + } else if (test_db.isDatabase("BlockGeometry")) { + // Note: Using GridGeometry only because BaseGridGeometry can't be instanstiated. + ctp.geometry.reset( + new geom::GridGeometry( + dim, + "BlockGeometry", + test_db.getDatabase("BlockGeometry"))); + } else { + TBOX_ERROR("getTestParametersFromDatabase: You must specify either \"box\"\n" + << "or \"BlockGeometry\" in each test."); + } + ctp.rank_begin = test_db.getIntegerWithDefault("rank_begin", ctp.rank_begin); + ctp.rank_end = test_db.getIntegerWithDefault("rank_end", ctp.rank_end); + ctp.index_begin = test_db.getIntegerWithDefault("index_begin", ctp.index_begin); + ctp.avg_parts_per_rank = test_db.getDoubleWithDefault("avg_parts_per_rank", + ctp.avg_parts_per_rank); + return ctp; +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi-overpartition.2d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi-overpartition.2d.input new file mode 100644 index 00000000..b70f4626 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi-overpartition.2d.input @@ -0,0 +1,298 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "multi-overpartition.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "3 blocks, 4 owners, 3 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 0 + rank_end = 4 + index_begin = 0 + avg_parts_per_rank = 4 +} + + +Test01 { + nickname = "3 blocks, 8 owners, 3 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 10 + rank_end = 18 + index_begin = 100 + avg_parts_per_rank = 4 +} + + +Test02 { + nickname = "3 blocks, 100 owners, 3 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 10 + rank_end = 110 + index_begin = 100 + avg_parts_per_rank = 4 +} + + +Test03 { + nickname = "3 blocks, more owners than cells, 3 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (2,1) ] + domain_boxes_1 = [ (0,0) , (3,1) ] + domain_boxes_2 = [ (0,0) , (2,3) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 4,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,3 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,3 + point_in_b_space = 4,0 + + } + + } + rank_begin = 10 + rank_end = 60 + index_begin = 100 + avg_parts_per_rank = 4 +} + + +Test04 { + nickname = "3 blocks, as many ownwers as MPI tasks, 4 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + index_begin = 0 + avg_parts_per_rank = 4 +} + + +Test05 { + nickname = "3 blocks, 6 tasks, 4 parts/rank" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 0 + rank_end = 6 + index_begin = 0 + avg_parts_per_rank = 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.2d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.2d.input new file mode 100644 index 00000000..ae5ea846 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.2d.input @@ -0,0 +1,292 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "multi.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "3 blocks, 4 owners" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 0 + rank_end = 4 + index_begin = 0 +} + + +Test01 { + nickname = "3 blocks, 8 owners" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 10 + rank_end = 18 + index_begin = 100 +} + + +Test02 { + nickname = "3 blocks, 100 owners" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 10 + rank_end = 110 + index_begin = 100 +} + + +Test03 { + nickname = "3 blocks, more owners than cells" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (2,1) ] + domain_boxes_1 = [ (0,0) , (3,1) ] + domain_boxes_2 = [ (0,0) , (2,3) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 4,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,3 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,3 + point_in_b_space = 4,0 + + } + + } + rank_begin = 10 + rank_end = 60 + index_begin = 100 +} + + +Test04 { + nickname = "3 blocks, as many ownwers as MPI tasks" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + index_begin = 0 +} + + +Test05 { + nickname = "3 blocks, 6 tasks" // Nick name of test. + dim = 2 + BlockGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 + + } + + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } + rank_begin = 0 + rank_end = 6 + index_begin = 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.3d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.3d.input new file mode 100644 index 00000000..daca021f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/multi.3d.input @@ -0,0 +1,391 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "multi.3d" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "8 blocks, 16 owners" // Nick name of test. + dim = 3 + + BlockGeometry { + num_blocks = 7 + domain_boxes_0 = [ (0,0,0) , (14,14,14) ] + domain_boxes_1 = [ (0,0,0) , (14,14,14) ] + domain_boxes_2 = [ (0,0,0) , (14,14,14) ] + domain_boxes_3 = [ (0,0,0) , (14,14,14) ] + domain_boxes_4 = [ (0,0,0) , (14,14,14) ] + domain_boxes_5 = [ (0,0,0) , (14,14,14) ] + domain_boxes_6 = [ (0,0,0) , (14,14,14) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,14,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors3 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors4 { + block_a = 0 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_DOWN", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,14 + } + + BlockNeighbors5 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors6 { + block_a = 1 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors7 { + block_a = 1 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { + block_a = 2 + block_b = 3 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors10 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors11 { + block_a = 2 + block_b = 5 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 14,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors12 { + block_a = 3 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,0,14 + point_in_b_space = 14,0,-1 + } + + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + } + rank_begin = 0 + rank_end = 16 + index_begin = 0 +} + +Test01 { + nickname = "8 blocks, fewer owners" // Nick name of test. + dim = 3 + + BlockGeometry { + num_blocks = 7 + domain_boxes_0 = [ (0,0,0) , (14,14,14) ] + domain_boxes_1 = [ (0,0,0) , (14,14,14) ] + domain_boxes_2 = [ (0,0,0) , (14,14,14) ] + domain_boxes_3 = [ (0,0,0) , (14,14,14) ] + domain_boxes_4 = [ (0,0,0) , (14,14,14) ] + domain_boxes_5 = [ (0,0,0) , (14,14,14) ] + domain_boxes_6 = [ (0,0,0) , (14,14,14) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,14,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors3 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors4 { + block_a = 0 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_DOWN", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,14 + } + + BlockNeighbors5 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors6 { + block_a = 1 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors7 { + block_a = 1 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { + block_a = 2 + block_b = 3 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors10 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors11 { + block_a = 2 + block_b = 5 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 14,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors12 { + block_a = 3 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,0,14 + point_in_b_space = 14,0,-1 + } + + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + } + rank_begin = 0 + rank_end = 3 + index_begin = 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single-overpartition.2d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single-overpartition.2d.input new file mode 100644 index 00000000..b91f5bef --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single-overpartition.2d.input @@ -0,0 +1,75 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "single-overpartition.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "11x11, 4 owners, 5 parts/rank" // Nick name of test. + dim = 2 + box = [(0,0),(10,10)] + rank_begin = 0 + rank_end = 4 + index_begin = 0 + avg_parts_per_rank = 5.0 +} + +Test01 { + nickname = "long box, 3 owners, 5 parts/rank" // Nick name of test. + dim = 2 + box = [(100,100),(110,180)] + rank_begin = 0 + rank_end = 3 + index_begin = 0 + avg_parts_per_rank = 5.0 +} + +Test02 { + nickname = "long box, 10 owners, 8 parts/rank" // Nick name of test. + dim = 2 + box = [(100,100),(110,180)] + rank_begin = 0 + rank_end = 10 + index_begin = 0 + avg_parts_per_rank = 5.0 +} + +Test03 { + nickname = "more owners than cells, 3 parts/rank" // Nick name of test. + dim = 2 + box = [(100,100),(105,102)] + rank_begin = 0 + rank_end = 30 + index_begin = 1000 + avg_parts_per_rank = 3.0 +} + +Test04 { + nickname = "as many ownwers as MPI tassks, 7 parts/rank" // Nick name of test. + dim = 2 + box = [(100,100),(110,180)] + rank_begin = 0 + rank_end = 3 + index_begin = 1000 + avg_parts_per_rank = 7.0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.2d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.2d.input new file mode 100644 index 00000000..e18c8ada --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.2d.input @@ -0,0 +1,105 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "single.2d" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "11x11, 4 owners" // Nick name of test. + dim = 2 + box = [(0,0),(10,10)] + rank_begin = 0 + rank_end = 4 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test01 { + nickname = "11x11, 4 owners, starting not at (0,0)" // Nick name of test. + dim = 2 + box = [(150,250),(160,260)] + rank_begin = 0 + rank_end = 4 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test02 { + nickname = "11x11, 2 owners" // Nick name of test. + dim = 2 + box = [(10,10),(20,20)] + rank_begin = 0 + rank_end = 2 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test03 { + nickname = "11x11, 13 owners" // Nick name of test. + dim = 2 + box = [(10,10),(20,20)] + rank_begin = 0 + rank_end = 13 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test04 { + nickname = "long box, 3 owners" // Nick name of test. + dim = 2 + box = [(100,100),(110,180)] + rank_begin = 0 + rank_end = 3 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test05 { + nickname = "long box, more owners" // Nick name of test. + dim = 2 + box = [(100,100),(110,180)] + rank_begin = 0 + rank_end = 10 + index_begin = 0 + avg_parts_per_rank = 1.0 +} + +Test06 { + nickname = "more owners than cells" // Nick name of test. + dim = 2 + box = [(100,100),(105,102)] + rank_begin = 0 + rank_end = 30 + index_begin = 1000 + avg_parts_per_rank = 1.0 +} + +Test07 { + nickname = "as many ownwers as MPI tassks" // Nick name of test. + dim = 2 + box = [(100,100),(105,102)] + rank_begin = 0 + rank_end = 3 + index_begin = 1000 + avg_parts_per_rank = 1.0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.3d.input b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.3d.input new file mode 100644 index 00000000..2e5320c7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/assumed_partition/test_inputs/single.3d.input @@ -0,0 +1,79 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for assumed_partition tests. + * + ************************************************************************/ + + +Main { + + // Base name for output files. + base_name = "single.3d" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + +/* + * Define test for AssumedPartitionBox using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + nickname = "11x11x11, 4 owners" // Nick name of test. + dim = 3 + box = [(0,0,0),(10,10,10)] + rank_begin = 0 + rank_end = 4 + index_begin = 0 +} + +Test01 { + nickname = "11x11x11, 4 owners, starting not at (0,0)" // Nick name of test. + dim = 3 + box = [(150,250,350),(160,260,360)] + rank_begin = 0 + rank_end = 4 + index_begin = 0 +} + +Test02 { + nickname = "11x11, 2 owners" // Nick name of test. + dim = 3 + box = [(10,10,10),(20,20,20)] + rank_begin = 0 + rank_end = 2 + index_begin = 0 +} + +Test03 { + nickname = "11x11, 13 owners" // Nick name of test. + dim = 3 + box = [(10,10,10),(20,20,20)] + rank_begin = 0 + rank_end = 13 + index_begin = 0 +} + +Test04 { + nickname = "long box, 3 owners" // Nick name of test. + dim = 3 + box = [(100,100,100),(110,180,140)] + rank_begin = 0 + rank_end = 3 + index_begin = 0 +} + +Test05 { + nickname = "long box, more owners" // Nick name of test. + dim = 3 + box = [(100,100,100),(110,180,140)] + rank_begin = 0 + rank_end = 10 + index_begin = 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.depend index f28d5213..0090c584 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,7 +14,6 @@ FILE_0=main-async_comm.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommGroup.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ @@ -28,7 +27,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -37,17 +35,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-async_comm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main-peer_comm.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ @@ -62,7 +58,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -71,12 +66,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-peer_comm.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.in b/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.in index a31b4af3..83a44180 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the asynchromous communication class tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/async_comm -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -24,6 +25,7 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" main-async_comm: main-async_comm.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-async_comm.o $(LIBSAMRAI) $(LDLIBS) -o $@ @@ -32,8 +34,19 @@ main-peer_comm: main-peer_comm.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-peer_comm.o $(LIBSAMRAI) $(LDLIBS) -o $@ check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main-async_comm test_inputs/async.default.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main-peer_comm test_inputs/peer.default.input + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main-async_comm test_inputs/async.default.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main-peer_comm test_inputs/peer.default.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -44,13 +57,26 @@ check3d: checkcompile: main-async_comm main-peer_comm checktest: checkcompile - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean: - $(SAMCLEAN) +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main-async_comm main-peer_comm include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/README b/base/SAMRAI/SAMRAI/source/test/async_comm/README new file mode 100644 index 00000000..ec2653e4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/README @@ -0,0 +1,45 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Asynchronous communication unit tests +## +######################################################################### + +This is a unit test of asynchronous communication. The files included in this +directory are as follows: + + main-async_comm.C - application driver program for asynchronous + communication unit test + main-peer_comm.C - application driver program for asynchronous peer + communication unit test + test_inputs/*.input - input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Run: + serial: + ./main-async_comm test_inputs/async.default.input + ./main-peer_comm test_inputs/peer.default.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] main-async_comm async.default.input + mpirun -np [mpirun options] main-peer_comm peer.default.input + + The test input files contain comments describing the input parameters + specific to this problem. Descriptions of input parameters for library + classes will be found in the documentation of those classes as well their + header files. + + +INPUT PARAMETER +--------------- +Refer to the 2 input files in test_inputs for full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/main-async_comm.C b/base/SAMRAI/SAMRAI/source/test/async_comm/main-async_comm.C index b2a75c02..6f31aa87 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/main-async_comm.C +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/main-async_comm.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Test program for asynchromous communication classes + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test program for asynchronous communication classes * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" @@ -83,11 +83,8 @@ int main( * to avoid possible interference with other communications * by SAMRAI library. */ - tbox::SAMRAI_MPI::Comm isolated_communicator(MPI_COMM_NULL); - if (tbox::SAMRAI_MPI::usingMPI()) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Comm_dup(&isolated_communicator); - } - tbox::SAMRAI_MPI isolated_mpi(isolated_communicator); + tbox::SAMRAI_MPI isolated_mpi(MPI_COMM_NULL); + isolated_mpi.dupCommunicator(SAMRAI_MPI::getSAMRAIWorld()); plog << "Process " << std::setw(5) << rank << " duplicated Communicator." << std::endl; @@ -182,7 +179,6 @@ int main( int gi; // Group index. int ai; // Active group index. - int count = 0; while ((sync_bcast_count < sync_bcast_cycles) || (sync_sumreduce_count < sync_sumreduce_cycles) || @@ -198,11 +194,11 @@ int main( plog << "\n\n\n***************** Beginning Cycle Number " << count << " *******************\n\n"; - Array > group_ids(num_groups); - Array owners(num_groups); - Array active_flags(num_groups); + std::vector > group_ids(num_groups); + std::vector owners(num_groups); + std::vector active_flags(num_groups); - Array active_groups(num_groups); + std::vector active_groups(num_groups); int num_active_groups = 0; /* @@ -216,7 +212,7 @@ int main( for (int n = 0; n < num_groups; ++n) { int gsize = (mpi.getSize() + n) / (n + 1); - group_ids[n].resizeArray(gsize); + group_ids[n].resize(gsize); active_flags[n] = false; for (int i = 0; i < gsize; ++i) { group_ids[n][i] = i * (n + 1); @@ -231,7 +227,7 @@ int main( owners[n] = group_ids[n][gsize / 2]; } - active_groups.resizeArray(num_active_groups); + active_groups.resize(num_active_groups); /* * Write out group data. @@ -247,7 +243,7 @@ int main( << std::setw(4) << owners[n] << (active_flags[n] ? '*' : ' ') << (owners[n] == rank ? '*' : ' ') << ':'; - for (int i = 0; i < group_ids[n].size(); ++i) { + for (int i = 0; i < static_cast(group_ids[n].size()); ++i) { plog << " " << group_ids[n][i]; } plog << '\n'; @@ -265,14 +261,14 @@ int main( * Compute the correct sum for comparison. */ - Array sum(num_active_groups); - Array correct_sum(num_active_groups); + std::vector sum(num_active_groups); + std::vector correct_sum(num_active_groups); for (ai = 0; ai < num_active_groups; ++ai) { sum[ai] = 1 + rank; correct_sum[ai] = 0; - Array& g = group_ids[active_groups[ai]]; - for (int j = 0; j < g.size(); ++j) { + std::vector& g = group_ids[active_groups[ai]]; + for (int j = 0; j < static_cast(g.size()); ++j) { correct_sum[ai] += 1 + g[j]; } } @@ -281,8 +277,8 @@ int main( * Initialize data for broadcast test. * Broadcast data is 1001 + the group index. */ - Array bcdata(num_active_groups); - Array correct_bcdata(num_active_groups); + std::vector bcdata(num_active_groups); + std::vector correct_bcdata(num_active_groups); for (ai = 0; ai < num_active_groups; ++ai) { gi = active_groups[ai]; bcdata[ai] = rank == owners[gi] ? 1001 + gi : -1; @@ -301,8 +297,8 @@ int main( comm_groups[ai].initialize(num_children, &comm_stage); comm_groups[ai].setGroupAndRootRank(isolated_mpi, - group_ids[gi].getPointer(), - group_ids[gi].size(), + &group_ids[gi][0], + static_cast(group_ids[gi].size()), owners[gi]); comm_groups[ai].setMPITag(1000000 * count + gi); comm_groups[ai].setUseBlockingSendToParent(false); @@ -314,7 +310,7 @@ int main( * For the synchronous (groupwise) broadcast test, * each group broadcasts the its group id. */ - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); plog << "\n\n\n*********** Synchronous Broadcast " << sync_bcast_count << " ************\n"; for (ai = 0; ai < num_active_groups; ++ai) @@ -348,7 +344,7 @@ int main( } if (sync_sumreduce_count < sync_sumreduce_cycles) { - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); /* * For the sum advanceSome reduce test, * each group sums up the ranks of its members, plus 1. @@ -390,7 +386,7 @@ int main( } if (asyncany_bcast_count < asyncany_bcast_cycles) { - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); /* * For the advanceSome broadcast test, * each group broadcasts the its group id. @@ -412,9 +408,10 @@ int main( } else { comm_stage.advanceAny(); } - if ( comm_stage.numberOfCompletedMembers() > 0 ) { - AsyncCommGroup *completed_group = - dynamic_cast(comm_stage.popCompletionQueue()); + if (comm_stage.hasCompletedMembers()) { + AsyncCommGroup* completed_group = + CPP_CAST(comm_stage.popCompletionQueue()); + TBOX_ASSERT(completed_group); ai = static_cast(completed_group - comm_groups); gi = active_groups[ai]; plog << std::setw(3) << ai @@ -443,7 +440,7 @@ int main( } if (asyncany_sumreduce_count < asyncany_sumreduce_cycles) { - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); /* * For the advanceSome broadcast test, * each group broadcasts the its group id. @@ -463,14 +460,15 @@ int main( } ++counter; } - if ( comm_stage.numberOfCompletedMembers() == 0 ) { + if (!comm_stage.hasCompletedMembers()) { comm_stage.advanceAny(); - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() < 2 ); + TBOX_ASSERT(comm_stage.numberOfCompletedMembers() < 2); } - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() < 2 ); - if ( comm_stage.numberOfCompletedMembers() > 0 ) { - AsyncCommGroup *completed_group = - dynamic_cast(comm_stage.popCompletionQueue()); + TBOX_ASSERT(comm_stage.numberOfCompletedMembers() < 2); + if (comm_stage.hasCompletedMembers()) { + AsyncCommGroup* completed_group = + CPP_CAST(comm_stage.popCompletionQueue()); + TBOX_ASSERT(completed_group); ai = static_cast(completed_group - comm_groups); gi = active_groups[ai]; plog << std::setw(3) << ai @@ -503,7 +501,7 @@ int main( } if (asyncsome_bcast_count < asyncsome_bcast_cycles) { - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); /* * For the advanceSome broadcast test, * each group broadcasts the its group id. @@ -515,23 +513,23 @@ int main( for (ai = 0; ai < num_active_groups; ++ai) { AsyncCommGroup& comm_group = comm_groups[ai]; comm_group.beginBcast(&bcdata[ai], 1); - if ( comm_group.isDone() ) { + if (comm_group.isDone()) { comm_group.pushToCompletionQueue(); } } plog << "Job Group Result Correct Note\n"; - while ( comm_stage.numberOfCompletedMembers() > 0 || - comm_stage.advanceSome() ) { + while (comm_stage.hasCompletedMembers() || + comm_stage.advanceSome()) { AsyncCommGroup* completed_group = - dynamic_cast(comm_stage.popCompletionQueue()); - TBOX_ASSERT(completed_group != NULL); + CPP_CAST(comm_stage.popCompletionQueue()); + TBOX_ASSERT(completed_group != 0); ai = static_cast(completed_group - comm_groups); gi = active_groups[ai]; plog << std::setw(3) << ai << std::setw(5) << gi << std::setw(8) << bcdata[ai] << std::setw(8) << correct_bcdata[ai] - ; + ; plog << " Bcast difference = " << bcdata[ai] - correct_bcdata[ai]; if (bcdata[ai] != correct_bcdata[ai]) { @@ -551,7 +549,7 @@ int main( } if (asyncsome_sumreduce_count < asyncsome_sumreduce_cycles) { - TBOX_ASSERT( comm_stage.numberOfCompletedMembers() == 0 ); + TBOX_ASSERT(!comm_stage.hasCompletedMembers()); /* * For the sum advanceSome reduce test, * each group sums up the ranks of its members, plus 1. @@ -562,23 +560,23 @@ int main( for (ai = 0; ai < num_active_groups; ++ai) { AsyncCommGroup& comm_group = comm_groups[ai]; comm_group.beginSumReduce(&sum[ai], 1); - if ( comm_group.isDone() ) { + if (comm_group.isDone()) { comm_group.pushToCompletionQueue(); } } plog << "Job Group Result Correct Note\n"; - while ( comm_stage.numberOfCompletedMembers() > 0 || - comm_stage.advanceSome() ) { + while (comm_stage.hasCompletedMembers() || + comm_stage.advanceSome()) { AsyncCommGroup* completed_group = - dynamic_cast(comm_stage.popCompletionQueue()); - TBOX_ASSERT(completed_group != NULL); + CPP_CAST(comm_stage.popCompletionQueue()); + TBOX_ASSERT(completed_group != 0); ai = static_cast(completed_group - comm_groups); gi = active_groups[ai]; plog << std::setw(3) << ai << std::setw(5) << gi << std::setw(8) << sum[ai] << std::setw(8) << correct_sum[ai] - ; + ; if (rank == owners[gi]) { plog << " Sum reduce difference = " << sum[ai] - correct_sum[ai]; @@ -617,10 +615,6 @@ int main( TimerManager::getManager()->print(plog); -#if defined(HAVE_MPI) - MPI_Comm_free(&isolated_communicator); -#endif - } if (fail_count == 0) { @@ -629,15 +623,7 @@ int main( SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - plog << "Process " << std::setw(5) << rank << " aborting." << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - plog << "Process " << std::setw(5) << rank << " exiting." << std::endl; return fail_count; } diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/main-peer_comm.C b/base/SAMRAI/SAMRAI/source/test/async_comm/main-peer_comm.C index 5b859bae..e1fa3cd2 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/main-peer_comm.C +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/main-peer_comm.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Test program for asynchromous peer communication classes + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test program for asynchronous peer communication classes * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" @@ -162,7 +162,6 @@ void TypeIndependentTester::runTest( << "] recv fr " << std::setw(3) << peer_rank << std::endl; } - /* * Test loop. Each process will send and receive from every * member in its group num_cycles times. @@ -186,7 +185,7 @@ void TypeIndependentTester::runTest( /* * Check completed members for correctness. */ - while ( stage.numberOfCompletedMembers() > 0 ) { + while (stage.hasCompletedMembers()) { AsyncCommStage::Member* completed_member = stage.popCompletionQueue(); @@ -197,7 +196,8 @@ void TypeIndependentTester::runTest( */ AsyncCommPeer* completed_comm_ = - dynamic_cast *>(completed_member); + CPP_CAST *>(completed_member); + TBOX_ASSERT(completed_comm_); AsyncCommPeer& completed_comm = *completed_comm_; int completed_comm_index = static_cast(completed_comm_ - peer_comms); @@ -261,7 +261,7 @@ void TypeIndependentTester::runTest( peer_comm.getPeerRank(), completion_counter[i], send_data); - peer_comm.beginSend(send_data.size() > 0 ? &send_data[0] : NULL, + peer_comm.beginSend(send_data.size() > 0 ? &send_data[0] : 0, static_cast(send_data.size())); /* * Check if the new communication is done (because if it is, @@ -542,18 +542,7 @@ int main( SAMRAIManager::shutdown(); SAMRAIManager::finalize(); - - if (total_fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - perr << "Process " << std::setw(5) << iproc << " got " - << total_fail_count - << " failures. Aborting." << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - plog << "Process " << std::setw(5) << iproc << " exiting." << std::endl; + SAMRAI_MPI::finalize(); return total_fail_count; } diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/async.default.input b/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/async.default.input index 1154251c..44aabe1b 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/async.default.input +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/async.default.input @@ -3,26 +3,29 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ Main { - // Number of communication groups in test: - num_groups = 10 + // Base name of log file(s). + base_name = "async_test" // Whether to log all nodes: log_all_nodes = TRUE + // Number of communication groups in test: + num_groups = 10 + // Number of children per branching of the communication tree: // (2 children creates a binary tree.) num_children = 2 // Test selection: // - // Set number of cycles to 0 to disable. + // Set number of cycles to 0 to disable a test. sync_bcast_cycles = 8 sync_sumreduce_cycles = 8 diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/default.input b/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/default.input deleted file mode 100644 index 3c227392..00000000 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/default.input +++ /dev/null @@ -1,20 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for asynchronous communication tests. - * - ************************************************************************/ - - sync_bcast_cycles = 8 - sync_sumreduce_cycles = 8 - - asyncany_bcast_cycles = 8 - asyncany_sumreduce_cycles = 8 - - asyncsome_bcast_cycles = 8 - asyncsome_sumreduce_cycles = 8 - -} diff --git a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/peer.default.input b/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/peer.default.input index 11f90b24..a57a970c 100644 --- a/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/peer.default.input +++ b/base/SAMRAI/SAMRAI/source/test/async_comm/test_inputs/peer.default.input @@ -3,26 +3,30 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ Main { + // Base name of all generated log files. base_name = "peer_test" - // Whether to log all nodes: + // Whether to log all nodes. log_all_nodes = TRUE + // Number of times to perform each communication. num_cycles = 20 + // Maximum number of items sent in first message. max_first_data_length = 6 // First and last in group. Specify rank relative to local rank. group_rel_first = -3 group_rel_last = 4 + // If TRUE uses advanceSome, otherwise uses advanceAny. use_advance_some = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.C b/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.C index c7292d4a..3512f845 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.C +++ b/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class to test usage of boundary utilities * ************************************************************************/ @@ -45,17 +45,15 @@ BoundaryDataTester::BoundaryDataTester( const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom): - xfer::RefinePatchStrategy(dim), + xfer::RefinePatchStrategy(), d_object_name(object_name), d_dim(dim), d_grid_geometry(grid_geom), d_variable_context( hier::VariableDatabase::getDatabase()->getContext("BOUNDARY_TEST")) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); -#endif readVariableInputAndMakeVariables(input_db); @@ -89,14 +87,12 @@ void BoundaryDataTester::setPhysicalBoundaryConditions( << endl; tbox::plog << "ghost_width_to_fill = " << ghost_width_to_fill << endl; - for (int iv = 0; iv < d_variables.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) { boost::shared_ptr > cvdata( - patch.getPatchData(d_variables[iv], d_variable_context), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[iv], d_variable_context))); TBOX_ASSERT(cvdata); -#endif tbox::plog << "\n iv = " << iv << " : " << d_variable_name[iv] << endl; tbox::plog << " depth = " << cvdata->getDepth() << endl; @@ -194,10 +190,10 @@ void BoundaryDataTester::initializeDataOnPatchInteriors( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - for (int iv = 0; iv < d_variables.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) { boost::shared_ptr > cvdata( - patch->getPatchData(d_variables[iv], d_variable_context), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_variables[iv], d_variable_context))); TBOX_ASSERT(cvdata); cvdata->getArrayData().undefineData(); @@ -209,13 +205,13 @@ void BoundaryDataTester::initializeDataOnPatchInteriors( ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - for (int iv = 0; iv < d_variables.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) { boost::shared_ptr > cvdata( - patch->getPatchData(d_variables[iv], d_variable_context), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_variables[iv], d_variable_context))); TBOX_ASSERT(cvdata); - for (int id = 0; id < cvdata->getDepth(); id++) { + for (int id = 0; id < cvdata->getDepth(); ++id) { cvdata->fill(d_variable_interior_values[iv][id], patch->getBox(), id); @@ -245,18 +241,16 @@ int BoundaryDataTester::runBoundaryTest( boost::shared_ptr hierarchy, int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT(level_number == 0); -#endif int d_fail_count = 0; hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - xfer::RefineAlgorithm boundary_fill(d_dim); + xfer::RefineAlgorithm boundary_fill; - for (int iv = 0; iv < d_variables.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) { int datid = variable_db->mapVariableAndContextToIndex(d_variables[iv], d_variable_context); @@ -267,9 +261,7 @@ int BoundaryDataTester::runBoundaryTest( boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(level); -#endif boundary_fill.createSchedule(level, this)->fillData(0.0); @@ -290,22 +282,22 @@ void BoundaryDataTester::readVariableInputAndMakeVariables( { TBOX_ASSERT(db); - tbox::Array var_keys = db->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = db->getAllKeys(); + int nkeys = static_cast(var_keys.size()); int var_cnt = 0; - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { if (db->getDatabase(var_keys[i])->keyExists("name")) { - var_cnt++; + ++var_cnt; } } - d_variable_name.resizeArray(var_cnt); - d_variable_depth.resizeArray(var_cnt); - d_variable_num_ghosts.resizeArray(var_cnt, hier::IntVector(d_dim, 1)); - d_variable_interior_values.resizeArray(var_cnt); + d_variable_name.resize(var_cnt); + d_variable_depth.resize(var_cnt); + d_variable_num_ghosts.resize(var_cnt, hier::IntVector(d_dim, 1)); + d_variable_interior_values.resize(var_cnt); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db(db->getDatabase(var_keys[i])); @@ -331,10 +323,8 @@ void BoundaryDataTester::readVariableInputAndMakeVariables( } if (var_db->keyExists("interior_values")) { - d_variable_interior_values[i].resizeArray(d_variable_depth[i]); - var_db->getDoubleArray("interior_values", - d_variable_interior_values[i].getPointer(), - d_variable_depth[i]); + d_variable_interior_values[i] = + var_db->getDoubleVector("interior_values"); } else { TBOX_ERROR( d_object_name << ": " @@ -348,12 +338,12 @@ void BoundaryDataTester::readVariableInputAndMakeVariables( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - d_variables.resizeArray(d_variable_name.getSize()); + d_variables.resize(d_variable_name.size()); - for (int iv = 0; iv < d_variable_name.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variable_name.size()); ++iv) { d_variables[iv].reset( new pdat::CellVariable(d_dim, d_variable_name[iv], - d_variable_depth[iv])); + d_variable_depth[iv])); int datid = variable_db->registerVariableAndContext(d_variables[iv], @@ -381,21 +371,21 @@ void BoundaryDataTester::setBoundaryDataDefaults() */ if (d_dim == tbox::Dimension(2)) { - d_master_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_master_bdry_edge_conds.resize(NUM_2D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_master_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_master_bdry_node_conds.resize(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_vector_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; @@ -404,32 +394,32 @@ void BoundaryDataTester::setBoundaryDataDefaults() } if (d_dim == tbox::Dimension(3)) { - d_master_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_vector_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_master_bdry_face_conds.resize(NUM_3D_FACES); + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + d_vector_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_master_bdry_face_conds[fi] = BOGUS_BDRY_DATA; d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; d_vector_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_master_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_master_bdry_edge_conds.resize(NUM_3D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_master_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_master_bdry_node_conds.resize(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_vector_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; @@ -437,18 +427,16 @@ void BoundaryDataTester::setBoundaryDataDefaults() } } - d_variable_bc_values.resizeArray(d_variable_name.getSize()); - for (int iv = 0; iv < d_variable_name.getSize(); iv++) { + d_variable_bc_values.resize(d_variable_name.size()); + for (int iv = 0; iv < static_cast(d_variable_name.size()); ++iv) { if (d_dim == tbox::Dimension(2)) { - d_variable_bc_values[iv].resizeArray(NUM_2D_EDGES - * d_variable_depth[iv]); + d_variable_bc_values[iv].resize(NUM_2D_EDGES * d_variable_depth[iv]); } if (d_dim == tbox::Dimension(3)) { - d_variable_bc_values[iv].resizeArray(NUM_3D_FACES - * d_variable_depth[iv]); + d_variable_bc_values[iv].resize(NUM_3D_FACES * d_variable_depth[iv]); } - tbox::MathUtilities::setArrayToSignalingNaN(d_variable_bc_values[ - iv]); + tbox::MathUtilities::setVectorToSignalingNaN( + d_variable_bc_values[iv]); } } @@ -482,36 +470,34 @@ void BoundaryDataTester::readBoundaryDataStateEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); - TBOX_ASSERT(d_variable_bc_values.getSize() == d_variable_name.getSize()); -#endif + TBOX_ASSERT(d_variable_bc_values.size() == d_variable_name.size()); - for (int iv = 0; iv < d_variable_name.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variable_name.size()); ++iv) { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { - TBOX_ASSERT(d_variable_bc_values[iv].getSize() == + TBOX_ASSERT(static_cast(d_variable_bc_values[iv].size()) == NUM_2D_EDGES * d_variable_depth[iv]); } if (d_dim == tbox::Dimension(3)) { - TBOX_ASSERT(d_variable_bc_values[iv].getSize() == + TBOX_ASSERT(static_cast(d_variable_bc_values[iv].size()) == NUM_3D_FACES * d_variable_depth[iv]); } #endif if (db->keyExists(d_variable_name[iv])) { int depth = d_variable_depth[iv]; - tbox::Array tmp_val(0); - tmp_val = db->getDoubleArray(d_variable_name[iv]); - if (tmp_val.getSize() < depth) { + std::vector tmp_val = + db->getDoubleVector(d_variable_name[iv]); + if (static_cast(tmp_val.size()) < depth) { TBOX_ERROR(d_object_name << ": " << "Insufficient number of " << d_variable_name[iv] << " values given in " << db_name << " input database." << endl); } - for (int id = 0; id < depth; id++) { + for (int id = 0; id < depth; ++id) { d_variable_bc_values[iv][bdry_location_index * depth + id] = tmp_val[id]; } @@ -529,16 +515,14 @@ void BoundaryDataTester::readBoundaryDataStateEntry( void BoundaryDataTester::readBoundaryDataInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif hier::IntVector periodic(d_grid_geometry->getPeriodicShift(hier::IntVector( d_dim, 1))); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } if (num_per_dirs < d_dim.getValue()) { @@ -550,7 +534,7 @@ void BoundaryDataTester::readBoundaryDataInput( if (d_dim == tbox::Dimension(2)) { appu::CartesianBoundaryUtilities2:: - readBoundaryInput(this, + getFromInput(this, bdry_db, d_master_bdry_edge_conds, d_master_bdry_node_conds, @@ -558,7 +542,7 @@ void BoundaryDataTester::readBoundaryDataInput( } if (d_dim == tbox::Dimension(3)) { appu::CartesianBoundaryUtilities3:: - readBoundaryInput(this, + getFromInput(this, bdry_db, d_master_bdry_face_conds, d_master_bdry_edge_conds, @@ -588,7 +572,7 @@ void BoundaryDataTester::readBoundaryDataInput( void BoundaryDataTester::postprocessBoundaryInput() { if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; @@ -596,7 +580,7 @@ void BoundaryDataTester::postprocessBoundaryInput() d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; @@ -615,7 +599,7 @@ void BoundaryDataTester::postprocessBoundaryInput() } } if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + for (int i = 0; i < NUM_3D_FACES; ++i) { d_scalar_bdry_face_conds[i] = d_master_bdry_face_conds[i]; d_vector_bdry_face_conds[i] = d_master_bdry_face_conds[i]; @@ -624,7 +608,7 @@ void BoundaryDataTester::postprocessBoundaryInput() } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; @@ -645,7 +629,7 @@ void BoundaryDataTester::postprocessBoundaryInput() } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; @@ -695,25 +679,22 @@ void BoundaryDataTester::checkBoundaryData( #endif const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array bdry_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); - for (int iv = 0; iv < d_variables.getSize(); iv++) { + for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) { boost::shared_ptr > cvdata( - patch.getPatchData(d_variables[iv], d_variable_context), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[iv], d_variable_context))); TBOX_ASSERT(cvdata); -#endif int depth = d_variable_depth[iv]; @@ -780,7 +761,7 @@ void BoundaryDataTester::checkBoundaryData( } #if (TESTING == 1) if (num_bad_values > 0) { - d_fail_count++; + ++d_fail_count; tbox::perr << "\nBoundary Test FAILED: \n" << " " << num_bad_values << " bad " << d_variable_name[iv] << " values found for" @@ -791,7 +772,7 @@ void BoundaryDataTester::checkBoundaryData( #endif } else { - for (int id = 0; id < depth; id++) { + for (int id = 0; id < depth; ++id) { int vbcase = bscalarcase; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { @@ -853,7 +834,7 @@ void BoundaryDataTester::checkBoundaryData( } #if (TESTING == 1) if (num_bad_values > 0) { - d_fail_count++; + ++d_fail_count; tbox::perr << "\nBoundary Test FAILED: \n" << " " << num_bad_values << " bad " << d_variable_name[iv] << " values found for" @@ -863,13 +844,13 @@ void BoundaryDataTester::checkBoundaryData( } #endif - } // for (int id = 0; id < depth; id++) + } // for (int id = 0; id < depth; ++id) } // else - } // for (int iv = 0; iv < d_variables.getSize(); iv++) + } // for (int iv = 0; iv < static_cast(d_variables.size()); ++iv) - } // for (int i = 0; i < bdry_boxes.getSize(); i++ ) + } // for (int i = 0; i < static_cast(bdry_boxes.size()); ++i ) } @@ -895,17 +876,17 @@ void BoundaryDataTester::printClassData( os << "d_variable_context = " << d_variable_context->getName() << endl; } else { - os << "d_variable_context = NULL" << endl; + os << "d_variable_context = 0" << endl; } os << "\nVariables ...\n" << endl; - for (i = 0; i < d_variable_name.getSize(); i++) { + for (i = 0; i < static_cast(d_variable_name.size()); ++i) { os << "Variable " << i << endl; os << " name = " << d_variable_name[i] << endl; os << " depth = " << d_variable_depth[i] << endl; os << " num_ghosts = " << d_variable_num_ghosts[i] << endl; os << " interior_values = " << d_variable_interior_values[i][0]; - for (j = 1; j < d_variable_depth[i]; j++) { + for (j = 1; j < d_variable_depth[i]; ++j) { os << " , " << d_variable_interior_values[i][j]; } os << endl; @@ -914,7 +895,7 @@ void BoundaryDataTester::printClassData( os << "\n Boundary condition data... " << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { os << "\n d_master_bdry_edge_conds[" << j << "] = " << d_master_bdry_edge_conds[j] << endl; os << " d_scalar_bdry_edge_conds[" << j << "] = " @@ -923,10 +904,10 @@ void BoundaryDataTester::printClassData( << d_vector_bdry_edge_conds[j] << endl; if (d_master_bdry_edge_conds[j] == BdryCond::DIRICHLET || d_master_bdry_edge_conds[j] == BdryCond::NEUMANN) { - for (i = 0; i < d_variable_name.getSize(); i++) { + for (i = 0; i < static_cast(d_variable_name.size()); ++i) { os << d_variable_name[i] << " bdry edge value[" << j << "] = " << d_variable_bc_values[i][j * d_variable_depth[i]]; - for (int id = 1; id < d_variable_depth[i]; id++) { + for (int id = 1; id < d_variable_depth[i]; ++id) { os << " , " << d_variable_bc_values[i][j * d_variable_depth[i] + id]; } @@ -935,7 +916,7 @@ void BoundaryDataTester::printClassData( } } os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { os << "\n d_master_bdry_node_conds[" << j << "] = " << d_master_bdry_node_conds[j] << endl; os << " d_scalar_bdry_node_conds[" << j << "] = " @@ -947,18 +928,19 @@ void BoundaryDataTester::printClassData( } } if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_master_bdry_face_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_face_conds.size()); ++j) { os << "\n d_master_bdry_face_conds[" << j << "] = " << d_master_bdry_face_conds[j] << endl; os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; os << " d_vector_bdry_face_conds[" << j << "] = " << d_vector_bdry_face_conds[j] << endl; - if (d_master_bdry_face_conds[j] == BdryCond::DIRICHLET) { - for (i = 0; i < d_variable_name.getSize(); i++) { + if (d_master_bdry_face_conds[j] == BdryCond::DIRICHLET || + d_master_bdry_face_conds[j] == BdryCond::NEUMANN) { + for (i = 0; i < static_cast(d_variable_name.size()); ++i) { os << d_variable_name[i] << " bdry edge value[" << j << "] = " << d_variable_bc_values[i][j * d_variable_depth[i]]; - for (int id = 1; id < d_variable_depth[i]; id++) { + for (int id = 1; id < d_variable_depth[i]; ++id) { os << " , " << d_variable_bc_values[i][j * d_variable_depth[i] + id]; } @@ -967,7 +949,7 @@ void BoundaryDataTester::printClassData( } } os << endl; - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { os << "\n d_master_bdry_edge_conds[" << j << "] = " << d_master_bdry_edge_conds[j] << endl; os << " d_scalar_bdry_edge_conds[" << j << "] = " @@ -978,7 +960,7 @@ void BoundaryDataTester::printClassData( << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { os << "\n d_master_bdry_node_conds[" << j << "] = " << d_master_bdry_node_conds[j] << endl; os << " d_scalar_bdry_node_conds[" << j << "] = " diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.h b/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.h index af5e3d03..fa661151 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.h +++ b/base/SAMRAI/SAMRAI/source/test/boundary/BoundaryDataTester.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class to test usage of boundary utilities * ************************************************************************/ @@ -24,10 +24,10 @@ #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Array.h" -#include +#include "boost/shared_ptr.hpp" #include +#include using namespace std; using namespace SAMRAI; @@ -68,8 +68,8 @@ class BoundaryDataTester: * They are not needed for this example since we only have one level * in the hierarchy. */ - hier::IntVector getRefineOpStencilWidth() const { - return hier::IntVector(d_dim, 0); + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector(dim, 0); } void preprocessRefine( @@ -146,6 +146,14 @@ class BoundaryDataTester: printClassData( ostream& os) const; + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; + } + private: /* * The object name is used for error/warning reporting. @@ -157,40 +165,40 @@ class BoundaryDataTester: boost::shared_ptr d_grid_geometry; /* - * Arrays of information read from input file describing test variables + * Vectors of information read from input file describing test variables */ - tbox::Array d_variable_name; - tbox::Array d_variable_depth; - tbox::Array d_variable_num_ghosts; - tbox::Array > d_variable_interior_values; + std::vector d_variable_name; + std::vector d_variable_depth; + std::vector d_variable_num_ghosts; + std::vector > d_variable_interior_values; /* * Items used to manage variables and data in test program. */ - tbox::Array > d_variables; + std::vector > d_variables; boost::shared_ptr d_variable_context; hier::ComponentSelector d_patch_data_components; /* - * Arrays of information read from input file for boundary conditions + * Vectors of information read from input file for boundary conditions */ - tbox::Array d_master_bdry_edge_conds; - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_vector_bdry_edge_conds; + std::vector d_master_bdry_edge_conds; + std::vector d_scalar_bdry_edge_conds; + std::vector d_vector_bdry_edge_conds; - tbox::Array d_master_bdry_node_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_vector_bdry_node_conds; + std::vector d_master_bdry_node_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_vector_bdry_node_conds; - tbox::Array d_master_bdry_face_conds; // Used only in 3D - tbox::Array d_scalar_bdry_face_conds; // Used only in 3D - tbox::Array d_vector_bdry_face_conds; // Used only in 3D + std::vector d_master_bdry_face_conds; // Used only in 3D + std::vector d_scalar_bdry_face_conds; // Used only in 3D + std::vector d_vector_bdry_face_conds; // Used only in 3D - tbox::Array d_node_bdry_edge; // Used only in 2D - tbox::Array d_edge_bdry_face; // Used only in 3D - tbox::Array d_node_bdry_face; // Used only in 3D + std::vector d_node_bdry_edge; // Used only in 2D + std::vector d_edge_bdry_face; // Used only in 3D + std::vector d_node_bdry_face; // Used only in 3D - tbox::Array > d_variable_bc_values; + std::vector > d_variable_bc_values; int d_fail_count; diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.depend index fa11a856..31ebe7d0 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -53,12 +53,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -74,7 +76,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -88,8 +89,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -105,10 +106,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ BoundaryDataTester.C BoundaryDataTester.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -117,12 +118,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -152,6 +152,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -164,16 +165,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -187,8 +189,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -196,14 +198,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ BoundaryDataTester.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.in b/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.in index 0259d632..19621b31 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/boundary/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for boundary utilities sample application ## ######################################################################### @@ -14,17 +14,19 @@ SUBDIR = source/test/boundary VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config AUTOTEST = $(SAMRAI)/source/test/boundary -CPPFLAGS_EXTRA= -I$(AUTOTEST) -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -I$(AUTOTEST) -DTESTING=1 NUM_TESTS = 13 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o BoundaryDataTester.o @@ -38,29 +40,49 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile +examples: -clean-check: - $(SAMCLEAN) +perf: -clean: clean-check - $(RM) *main* +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/README b/base/SAMRAI/SAMRAI/source/test/boundary/README index d999a38b..947f4f49 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/README +++ b/base/SAMRAI/SAMRAI/source/test/boundary/README @@ -3,115 +3,53 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Boundary Utilities example +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Boundary Utilities unit test ## ######################################################################### -This example demonstrates use of simple boundary utilities to implement -and test basic boundary conditions in a SAMRAI application. -The files included in this directory are as follows: +This test demonstrates use of simple boundary utilities to implement and unit +test basic boundary conditions in a SAMRAI application. The files included in +this directory are as follows: - main.C - example main program - BoundaryDataTester.[Ch] - example user routines for boundary data - sample_input/*.input - various 2d and 3d input files + main.C - unit tester + BoundaryDataTester.[Ch] - example user routines for boundary data + test_inputs/*.input - various 2d and 3d input files -COMPILE and RUN ---------------- -Compile: make main*d to build the *d version of the example -Run: main*d sample_input/*.input - -Results will be reported in a log file whose name corresponds to the -given input file; i.e., main*d sample_input/*.input produces a log -file named *.log. - - -INPUTS: ------------- - -Each input file contains 3 sections used to describe the test and to -initialize the various object involved inthe test. - -The "Main" section includes the log file name, and describes how the -domain should be chopped into patches when it is a parallelepiped -(in 3d or a rectangle in 2d). For example in 2d this might look like: - -Main { - log_file_name = "basic2d-flow.log" - num_domain_boxes = 2 , 1 -} - -The "CartesianGridGeometry" section describes the physical coordinates -of the domain and the periodic directions (if any). For example in 2d -this might look like: - -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 0 -} - -The "BoundaryDataTester" section describes the variables and their -attributes in the test problem. Applicable boundary information is -described in a subdatabase called "Boundary_data". For example in 2d -this might look like: - -BoundaryDataTester { - - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - - variable_1 { - name = "var1" - depth = 1 - num_ghosts = 2 , 2 - interior_values = 1.0 - } - - variable_2 { - name = "var2" - depth = 2 - num_ghosts = 1 , 1 - interior_values = 2.0 , 3.0 - } - - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "SYMMETRIC", "DIRICHLET" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // - Boundary_data { - - // see the various sample input files for more details.... - - } - -} +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + For one of the following input files: + test_inputs/dirichlet.2d.input + test_inputs/dirichlet.3d.input + test_inputs/flow.2d.input + test_inputs/flow.3d.input + test_inputs/neumann.2d.input + test_inputs/neumann.3d.input + test_inputs/periodic010.3d.input + test_inputs/periodic011.3d.input + test_inputs/periodic01.2d.input + test_inputs/periodic111.3d.input + test_inputs/periodic11.2d.input + test_inputs/reflect.2d.input + test_inputs/reflect.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +Results will be reported in a log file whose name is related to the +given input file; i.e., ./main test_inputs/dirichlet.2d.input produces a log +file named basic2d-dirichlet.log. + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/dirichlet.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/main.C b/base/SAMRAI/SAMRAI/source/test/boundary/main.C index 6df35640..5016ea3d 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/main.C +++ b/base/SAMRAI/SAMRAI/source/test/boundary/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Example program to demonstrate boundary utilities. * ************************************************************************/ @@ -31,7 +31,7 @@ using namespace std; // Headers for classes specific to this example #include "BoundaryDataTester.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -64,26 +64,6 @@ int main( return -1; } - /* - * This test only is valid on 1 processor. - * This should be removed. - */ - if (mpi.getSize() != 1) { - tbox::pout << "This test is valid for 1 processor only" << endl; - tbox::pout << "\nPASSED: boundary" << endl; - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - return 0; - } - -#ifdef DEBUG_CHECK_ASSERTIONS - /* - * This should never be true. - */ - TBOX_ASSERT(mpi.getSize() == 1); -#endif - string input_filename = argv[1]; /* @@ -163,8 +143,7 @@ int main( tbox::plog << "\nBuilding patch hierarchy..." << endl; - const hier::BoxContainer& domain = - grid_geometry->getPhysicalDomain(); + const hier::BoxContainer& domain = grid_geometry->getPhysicalDomain(); hier::BoxContainer boxes(domain); boxes.unorder(); if ((domain.size() == 1) && @@ -181,16 +160,21 @@ int main( bad_interval, domain); } - hier::BoxContainer patch_boxes(boxes); hier::BoxLevelConnectorUtils edge_utils; - hier::BoxLevel layer0(hier::IntVector(dim, 1), grid_geometry); - hier::BoxContainer::const_iterator domain_boxes(domain); - for (hier::LocalId ib(0); ib < patch_boxes.size(); ib++, ++domain_boxes) { - layer0.addBox(hier::Box(*domain_boxes, ib, 0)); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), grid_geometry)); + hier::BoxContainer::const_iterator domain_boxes = domain.begin(); + int rank = mpi.getRank(); + int size = mpi.getSize(); + for (hier::LocalId ib(0); ib < boxes.size(); ++ib, ++domain_boxes) { + if (ib % size == rank) { + layer0->addBox(hier::Box(*domain_boxes, ib, rank)); + } } edge_utils.addPeriodicImages( - layer0, + *layer0, patch_hierarchy->getGridGeometry()->getDomainSearchTree(), hier::IntVector(dim, 2)); @@ -199,10 +183,7 @@ int main( // Add Connector required for schedule construction. boost::shared_ptr level0( patch_hierarchy->getPatchLevel(0)); - level0->getBoxLevel()->getPersistentOverlapConnectors(). - createConnector( - *level0->getBoxLevel(), - hier::IntVector(dim, 2)); + level0->createConnector(*level0, hier::IntVector(dim, 2)); /* * Allocate data on hierarchy and set variable data on patch interiors diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.2d.input index 80feacd2..6a13ce79 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.2d.input @@ -3,26 +3,26 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 2d dirichlet boundary conditions * ************************************************************************/ GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). call_abort_in_serial_instead_of_exit = FALSE } Main { + // Dimention of problem. dim = 2 + + // Name of log file. log_file_name = "basic2d-dirichlet.log" - num_domain_boxes = 2 , 1 -} -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 0 + // Number of boxes in each direction domain should be chopped into. + num_domain_boxes = 2 , 1 } BoundaryDataTester { @@ -55,25 +55,10 @@ BoundaryDataTester { } // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*REFLECT", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // + // Boundary condition information is read in by the BoundaryDataTester + // object. Each boundary condition in the Boundary_data database must + // follow the input format defined by appu::CartesianBoundaryUtilities[2,3] + // depending on the problem dimension. Refer to these classes for details. // Boundary_data { boundary_edge_xlo { @@ -117,3 +102,11 @@ BoundaryDataTester { } } + +// Refer to geom::CartesianGeometry and its base clases for input +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.3d.input index 5598ca21..c4b7b740 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/dirichlet.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d dirichlet boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { boundary_condition = "DIRICHLET" @@ -201,3 +162,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.2d.input index 54b45f52..b8050548 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 2d flow boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 } -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,27 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "SYMMETRIC", "DIRICHLET". "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // Boundary_data { boundary_edge_xlo { boundary_condition = "FLOW" @@ -109,3 +71,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.3d.input index 61d5bc01..98107553 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/flow.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d flow boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { @@ -190,3 +151,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.2d.input index 4ab14974..5fde96ec 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 2d neumann boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 } -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,27 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*REFLECT", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // Boundary_data { boundary_edge_xlo { boundary_condition = "NEUMANN" @@ -117,3 +79,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.3d.input index 7f375ff6..f430a212 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/neumann.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d neumann boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { boundary_condition = "NEUMANN" @@ -201,3 +162,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic01.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic01.2d.input index 95bebdd5..2bfd23df 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic01.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic01.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: input file for testing 2d reflect & periodic boundary conditions + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: input file for testing 2d periodic boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 } -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 1 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,27 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*REFLECT", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // Boundary_data { boundary_edge_xlo { boundary_condition = "DIRICHLET" @@ -90,3 +52,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 0, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic010.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic010.3d.input index 30888b50..84776592 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic010.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic010.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d periodic boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 1, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET, "*NEUMANN"" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { boundary_condition = "DIRICHLET" @@ -118,3 +79,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 1, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic011.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic011.3d.input index 87f2e1f8..e3d5a317 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic011.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic011.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d periodic boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 1, 1 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { boundary_condition = "DIRICHLET" @@ -91,3 +52,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic11.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic11.2d.input index eb450c9c..9e6988b3 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic11.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic11.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 2d periodic boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 } -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 1, 1 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,26 +37,11 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*REFLECT", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // +} +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 1, 1 } diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic111.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic111.3d.input index 90830f5a..f6aa788f 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic111.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/periodic111.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d periodic boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 1, 1, 1 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,27 +37,11 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // +} +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 1, 1, 1 } diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.2d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.2d.input index f5a7758d..c26a6505 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 2d reflect boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 } -CartesianGridGeometry { - domain_boxes = [ (0,0) , (7,3) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 // upper end of computational domain. - periodic_dimension = 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,27 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for edges in 2d are: - // "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for nodes in 2d are: - // "*FLOW", "*REFLECT", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X" or "Y". The condition given for a node - // must match that of the appropriate adjacent edge. This is enforced - // for consistency. Note that when a REFLECT edge condition is given - // and the other adjacent edge has either a FLOW or REFLECT condition, - // the resulting node boundary values will be the same regardless of - // which edge is used. - // - // Boundary data must be given for each edge and node in a non-periodic - // direction. Any input values given for periodic directions will be ignored. - // - // Boundary_data { boundary_edge_xlo { boundary_condition = "REFLECT" @@ -109,3 +71,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0) , (7,3) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 // upper end of computational domain. + periodic_dimension = 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.3d.input b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.3d.input index d3ef0cb7..4f815dd1 100644 --- a/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/boundary/test_inputs/reflect.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing 3d reflect boundary conditions * ************************************************************************/ +// Refer to dirichlet.2d.input for a full description of all input parameters +// specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -18,28 +21,8 @@ Main { num_domain_boxes = 2 , 1 , 2 } -CartesianGridGeometry { - domain_boxes = [ (0,0,0) , (7,3,7) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. - periodic_dimension = 0, 0, 0 -} - BoundaryDataTester { - // - // Variable information is read in by the BoundaryDataTester object - // Each variable has its own sub-database which must contain the proper - // variable information. The name of each sub-database for a variable - // is arbitrary. But the names must be distinct. Also the names of the - // individual variables must be distinct. - // - // Required input: name - // interior_values (# of values must = depth) - // Optional input: depth (default = 1) - // num_ghosts (default = 1,1,1) - // - variable_1 { name = "var1" depth = 1 @@ -54,28 +37,6 @@ BoundaryDataTester { interior_values = 2.0 , 3.0 , 4.0 } - // - // Boundary conditioninformation is read in by the BoundaryDataTester object - // Each boundary type and location has its own sub-database which must be - // named properly and contain valid boundary information. - // - // Valid boundary_condition entries for faces in 3d are: - // "FLOW", "SYMMETRIC", "DIRICHLET", "NEUMANN" - // - // Valid boundary_condition entries for edges and nodes in 3d are: - // "*FLOW", "*SYMMETRIC", "*DIRICHLET", "*NEUMANN" - // Here, "*" may be either "X", "Y", or "Z". The condition given for - // an edge or node must match that of the appropriate adjacent face. - // This is enforced for consistency. Note that when a REFLECT face - // condition is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge or node boundary values - // will be the same regardless of which face is used. - // - // Boundary data must be given for each face, edge, and node in a - // non-periodic direction. Any input values given for periodic - // directions will be ignored. - // - // Boundary_data { boundary_face_xlo { @@ -190,3 +151,10 @@ BoundaryDataTester { } } + +CartesianGridGeometry { + domain_boxes = [ (0,0,0) , (7,3,7) ] + x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 0.5e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 0, 0, 0 +} diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/Makefile.in b/base/SAMRAI/SAMRAI/source/test/clustering/Makefile.in index 0df30d1a..23ed9bb9 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/clustering/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing parts of SAMRAI library ## ######################################################################### @@ -15,18 +15,11 @@ SUBDIR = source/test/clustering SUBDIRS = async_br -# TODO SGS need to add parallel back in -#SUBDIRS = parallel_br async_br - default: check include $(OBJECT)/config/Makefile.config library: -lib1d: -lib2d: -lib3d: -libXd: check: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done @@ -38,10 +31,22 @@ check3d: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done checkcompile: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done checktest: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +examples: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +perf: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +everything: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done + clean: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + +checkclean: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.C b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.C index b7c695b4..29b8425b 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.C +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: ABRTest class implementation * ************************************************************************/ @@ -31,13 +31,11 @@ ABRTest::ABRTest( d_name(object_name), d_dim(dim), d_hierarchy(patch_hierarchy), - d_tagger(object_name + ":tagger", - dim, - database->isDatabase("sine_tagger") ? - database->getDatabase("sine_tagger").get() : NULL), - d_time(0.5) + d_sine_wall(object_name + ":tagger", + d_dim, + database->getDatabaseWithDefault("sine_tagger", boost::shared_ptr())) { - d_tagger.resetHierarchyConfiguration(d_hierarchy, 0, 0); + d_sine_wall.resetHierarchyConfiguration(d_hierarchy, 0, 0); } ABRTest::~ABRTest() @@ -46,7 +44,7 @@ ABRTest::~ABRTest() mesh::StandardTagAndInitStrategy *ABRTest::getStandardTagAndInitObject() { - return &d_tagger; + return &d_sine_wall; } /* @@ -56,7 +54,7 @@ void ABRTest::computeHierarchyData( hier::PatchHierarchy& hierarchy, double time) { - d_tagger.computeHierarchyData(hierarchy, time); + d_sine_wall.computeHierarchyData(hierarchy, time); } /* @@ -65,7 +63,7 @@ void ABRTest::computeHierarchyData( void ABRTest::deallocatePatchData( hier::PatchHierarchy& hierarchy) { - d_tagger.deallocatePatchData(hierarchy); + d_sine_wall.deallocatePatchData(hierarchy); } /* @@ -74,7 +72,7 @@ void ABRTest::deallocatePatchData( void ABRTest::deallocatePatchData( hier::PatchLevel& level) { - d_tagger.deallocatePatchData(level); + d_sine_wall.deallocatePatchData(level); } #ifdef HAVE_HDF5 @@ -82,7 +80,7 @@ int ABRTest::registerVariablesWithPlotter( boost::shared_ptr writer) { if (writer) - d_tagger.registerVariablesWithPlotter(*writer); + d_sine_wall.registerVariablesWithPlotter(*writer); return 0; } #endif @@ -92,13 +90,15 @@ bool ABRTest::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { NULL_USE(depth_id); + NULL_USE(simulation_time); if (variable_name == "Patch level number") { double pln = patch.getPatchLevelNumber(); - int i, size = region.size(); + size_t i, size = region.size(); for (i = 0; i < size; ++i) buffer[i] = pln; } else { // Did not register this name. diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.h b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.h index 2baa8488..3bad83b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.h +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/ABRTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: ABRTest class declaration * ************************************************************************/ @@ -13,7 +13,7 @@ #include using namespace std; -#include +#include "boost/shared_ptr.hpp" #include "SAMRAI/tbox/Database.h" /* @@ -26,7 +26,7 @@ using namespace std; #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/solv/CartesianRobinBcHelper.h" #include "SAMRAI/solv/RobinBcCoefStrategy.h" -#include "SinusoidalFrontTagger.h" +#include "test/testlib/SinusoidalFrontGenerator.h" using namespace SAMRAI; @@ -60,7 +60,8 @@ class ABRTest: const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; //@} @@ -103,12 +104,7 @@ class ABRTest: boost::shared_ptr d_hierarchy; - SinusoidalFrontTagger d_tagger; - - /*! - * @brief Front time. - */ - double d_time; + SinusoidalFrontGenerator d_sine_wall; }; diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.depend index 9d146089..eafdb5e3 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -49,12 +49,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -92,7 +94,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -105,8 +106,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -114,10 +115,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h ABRTest.C \ - ABRTest.h SinusoidalFrontTagger.h + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h ABRTest.C ABRTest.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -140,166 +142,20 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=SinusoidalFrontTagger.o -DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SinusoidalFrontTagger.C \ - SinusoidalFrontTagger.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=get-input-filename.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h get-input-filename.C \ - get-input-filename.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - -endif +${FILE_0}: ${DEPENDS_0} -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - -FILE_3=main.o -DEPENDS_3:=\ +FILE_1=main.o +DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -309,6 +165,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -321,7 +178,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -333,12 +193,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -371,7 +233,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -379,11 +240,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -442,12 +304,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -462,9 +324,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -483,11 +346,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h ABRTest.h \ - SinusoidalFrontTagger.h get-input-filename.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h \ + $(TESTLIBDIR)/get-input-filename.h ABRTest.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ +DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -545,10 +409,9 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.in b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.in index a9e2430e..41ddb513 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/Makefile.in @@ -3,17 +3,20 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for asynchronous Berger-Rigoutsos test ## ######################################################################### -SAMRAI = @top_srcdir@ +SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ SUBDIR = source/test/clustering/async_br -VPATH = @top_srcdir@/source/test/clustering/async_br +VPATH = @srcdir@ TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check @@ -21,15 +24,24 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DTESTING=1 -CXX_OBJS = main.o ABRTest.o SinusoidalFrontTagger.o get-input-filename.o +CXX_OBJS = main.o ABRTest.o -main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ +main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ +testlib: + cd $(TESTLIBDIR) && $(MAKE) library + +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): + + NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" check: $(MAKE) check2d @@ -37,31 +49,50 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f *main* - $(RM) -rf restart-*d* +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main lib2d lib3d: cd $(OBJECT) && make $@ diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/README b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/README new file mode 100644 index 00000000..bee22088 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/README @@ -0,0 +1,40 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Asynchronous Berger Rigoutsos unit test +## +######################################################################### + +This is a unit test of the asynchronous Berger Rigoutsos algorithm. The files +included in this directory are as follows: + + main.C - unit tester + ABRTest.[Ch] - tags cells based on sinusoidal front and computes + new hierarchy based on tagging + get-input-filename.[Ch] - utility for getting input file name + test_inputs/*.input - 2d and 3d input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + For one of the following input files: + test_inputs/front.2d.input + test_inputs/front.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/front.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.C b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.C deleted file mode 100644 index 27b75cb8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.C +++ /dev/null @@ -1,611 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class implementation - * - ************************************************************************/ -#include "SinusoidalFrontTagger.h" - -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include "SAMRAI/pdat/MDA_Access.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - -// using namespace std; - -SinusoidalFrontTagger::SinusoidalFrontTagger( - const std::string& object_name, - const tbox::Dimension& dim, - tbox::Database* database): - d_name(object_name), - d_dim(dim), - d_period(1.0), - d_init_disp(dim.getValue()), - d_velocity(dim.getValue()), - d_amplitude(0.2), - d_ghost_cell_width(dim, 0), - d_buffer_cells(dim, 1), - d_allocate_data(true), - d_time(0.5) -{ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(variable_db != NULL); -#endif - - tbox::Array init_disp; - tbox::Array velocity; - - if (database != NULL) { - d_allocate_data = - database->getBoolWithDefault("allocate_data", - d_allocate_data); - if (database->isInteger("buffer_cells")) { - database->getIntegerArray("buffer_cells", - &d_buffer_cells[0], d_dim.getValue()); - } - for (int ln = 0; true; ++ln) { - std::string name("buffer_space_"); - name = name + tbox::Utilities::intToString(ln); - if (database->isDouble(name)) { - d_buffer_space.resizeArray(d_dim.getValue() * (ln + 1)); - database->getDoubleArray(name, &d_buffer_space[d_dim.getValue() * ln], d_dim.getValue()); - } else { - break; - } - } - d_period = - database->getDoubleWithDefault("period", - d_period); - if (database->isDouble("init_disp")) { - init_disp = - database->getDoubleArray("init_disp"); - } - if (database->isDouble("velocity")) { - velocity = - database->getDoubleArray("velocity"); - } - d_amplitude = - database->getDoubleWithDefault("amplitude", - d_amplitude); - d_time = - database->getDoubleWithDefault("time", - d_time); - } - - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - d_init_disp[idim] = idim < init_disp.size() ? init_disp[idim] : 0.0; - d_velocity[idim] = idim < velocity.size() ? velocity[idim] : 0.0; - } - - const std::string context_name = d_name + std::string(":context"); - d_context = variable_db->getContext(context_name); - - if (database->isInteger("ghost_cell_width")) { - database->getIntegerArray("ghost_cell_width", - &d_ghost_cell_width[0], d_dim.getValue()); - } - - boost::shared_ptr dist_var( - new pdat::NodeVariable(dim, d_name + ":dist")); - d_dist_id = variable_db->registerVariableAndContext(dist_var, - d_context, - d_ghost_cell_width); - - boost::shared_ptr tag_var( - new pdat::CellVariable(dim, d_name + ":tag")); - d_tag_id = variable_db->registerVariableAndContext(tag_var, - d_context, - d_ghost_cell_width); - - t_setup = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::setup"); - t_node_pos = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::node_pos"); - t_distance = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::distance"); - t_tag_cells = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::tag_cells"); - t_copy = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::copy"); -} - -SinusoidalFrontTagger::~SinusoidalFrontTagger() -{ -} - -void SinusoidalFrontTagger::initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& base_hierarchy, - /*! Level to initialize */ - const int ln, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_base_level, - const bool allocate_data) -{ - NULL_USE(can_be_refined); - - boost::shared_ptr hierarchy(base_hierarchy); - boost::shared_ptr old_level(old_base_level); - if (old_base_level) { - TBOX_ASSERT(old_level); - } - TBOX_ASSERT(hierarchy); - - /* - * Reference the level object with the given index from the hierarchy. - */ - boost::shared_ptr level(hierarchy->getPatchLevel(ln)); - - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - initializePatchData(patch, - init_data_time, - initial_time, - allocate_data); - } - -#if 0 - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - level->allocatePatchData(d_dist_id); - level->allocatePatchData(d_tag_id); - } - computeLevelData(hierarchy, ln, d_time /*init_data_time*/, - d_dist_id, d_tag_id, old_level); - } -#endif -} - -void SinusoidalFrontTagger::initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) -{ - NULL_USE(initial_time); - - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - if (!patch.checkAllocated(d_dist_id)) { - patch.allocatePatchData(d_dist_id); - } - if (!patch.checkAllocated(d_tag_id)) { - patch.allocatePatchData(d_tag_id); - } - boost::shared_ptr > dist_data( - patch.getPatchData(d_dist_id), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch.getPatchData(d_tag_id), - boost::detail::dynamic_cast_tag()); - TBOX_ASSERT(dist_data); - TBOX_ASSERT(tag_data); - computePatchData(patch, init_data_time, - dist_data.get(), tag_data.get()); - } - } -} - -void SinusoidalFrontTagger::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - -void SinusoidalFrontTagger::applyGradientDetector( - const boost::shared_ptr& base_hierarchy_, - const int ln, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation) -{ - NULL_USE(initial_time); - NULL_USE(uses_richardson_extrapolation); - - boost::shared_ptr hierarchy_(base_hierarchy_); - TBOX_ASSERT(hierarchy_); - boost::shared_ptr level_(hierarchy_->getPatchLevel(ln)); - TBOX_ASSERT(level_); - - hier::PatchLevel& level = *level_; - - for (hier::PatchLevel::iterator pi(level.begin()); - pi != level.end(); ++pi) { - hier::Patch& patch = **pi; - - boost::shared_ptr tag_data( - patch.getPatchData(tag_index)); - if (!tag_data) { - TBOX_ERROR("Data index " << tag_index - << " does not exist for patch.\n"); - } - boost::shared_ptr > tag_cell_data_( - tag_data, - boost::detail::dynamic_cast_tag()); - if (!tag_cell_data_) { - TBOX_ERROR("Data index " << tag_index - << " is not cell int data.\n"); - } - - if (d_allocate_data) { - // Use internally stored data. - boost::shared_ptr saved_tag_data( - patch.getPatchData(d_tag_id)); - tag_cell_data_->copy(*saved_tag_data); - } else { - // Compute tag data for patch. - computePatchData(patch, - error_data_time, - NULL, - tag_cell_data_.get()); - } - - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchHierarchy& hierarchy) -{ - int ln; - for (ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - boost::shared_ptr level(hierarchy.getPatchLevel(ln)); - deallocatePatchData(*level); - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchLevel& level) -{ - level.deallocatePatchData(d_dist_id); - level.deallocatePatchData(d_tag_id); -} - -/* - * Deallocate patch data allocated by this class. - */ -void SinusoidalFrontTagger::computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time) -{ - d_time = time; - if (!d_allocate_data) return; - - for (int ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - computeLevelData(hierarchy, ln, time, d_dist_id, d_tag_id); - } -} - -/* - * Compute the solution data for a level. - * Can copy data from old level (if any) to support - * initializeLevelData(). - */ - -void SinusoidalFrontTagger::computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level) const -{ - NULL_USE(old_level); - - const boost::shared_ptr level( - hierarchy.getPatchLevel(ln)); - - /* - * Initialize data in all patches in the level. - */ - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - boost::shared_ptr > dist_data; - if (dist_id >= 0) { - dist_data = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(dist_id)); - } - boost::shared_ptr > tag_data; - if (tag_id >= 0) { - tag_data = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(tag_id)); - } - computePatchData(patch, time, - dist_data.get(), - tag_data.get()); - } -} - -/* - * Compute the solution data for a patch. - */ - -void SinusoidalFrontTagger::computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const -{ - - t_setup->start(); - - TBOX_ASSERT(d_hierarchy); - TBOX_ASSERT(patch.inHierarchy()); - const int ln = patch.getPatchLevelNumber(); - const boost::shared_ptr level( - d_hierarchy->getPatchLevel(ln)); - const hier::IntVector& ratio(level->getRatioToLevelZero()); - - const hier::Box& pbox = patch.getBox(); - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const double* xlo = patch_geom->getXLower(); - - const double* dx = patch_geom->getDx(); - - // Compute the size of buffer to tag around cells crossing front. - hier::IntVector buffer(d_buffer_cells); - for (int i = 0; i < d_dim.getValue(); ++i) { - if (d_buffer_space.size() > ln * d_dim.getValue() + i) { - int space_based_buffer = - int(d_buffer_space[ln * d_dim.getValue() + i] / dx[i] + 0.5); - if (space_based_buffer > buffer(i)) buffer(i) = space_based_buffer; - } - } - // std::cout << "buffer for ln of " << ln << " is " << buffer << std::endl; - - /* - * We need at least buffer ghost cells to compute - * the tags, but the data does not have as many ghost cells. - * So we create temporary patch data with the required "ghost" - * buffer for computing tag values. (We could give the real - * data the required ghost cells, but that may affect the - * regridding algorithm I'm testing.) - */ - hier::IntVector required_tmp_buffer(buffer); - required_tmp_buffer *= ratio; - pdat::NodeData tmp_dist(pbox, 1, required_tmp_buffer); - pdat::CellData tmp_tag(pbox, 1, required_tmp_buffer); - - /* - * Determine what x-node-index contains the sinusoidal front. - */ - - const double wave_number = 2 * 3.141592654 / d_period; - - t_setup->stop(); - - t_node_pos->start(); - - hier::Box front_box = pbox; - front_box.grow(required_tmp_buffer); - front_box.growUpper(hier::IntVector(d_dim, 1)); - // Squash front_box to a single plane. - front_box.upper(0) = front_box.lower(0); - const int ifront = front_box.lower(0); - - pdat::ArrayData front_i_(front_box, 1); - - MDA_Access > front_i2; - MDA_Access > front_i3; - if (d_dim == tbox::Dimension(2)) { - front_i2 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int j = front_i2.beg(1); j < front_i2.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number * (y + d_init_disp[1] - d_velocity[1] * time)); - double fx = d_amplitude * siny + d_init_disp[0] + d_velocity[0] * time; - front_i2(ifront, j) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); - // std::cout << i << '\t' << j << '\t' << y << '\t' << front_i(i,j) << std::endl; - } - } else if (d_dim == tbox::Dimension(3)) { - front_i3 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int k = front_i3.beg(2); k < front_i3.end(2); ++k) { - double z = xlo[2] + dx[2] * (k - pbox.lower(2)); - double sinz = - sin(wave_number * (z + d_init_disp[2] - d_velocity[2] * time)); - for (int j = front_i3.beg(1); j < front_i3.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number * (y + d_init_disp[1] + d_velocity[1] * time)); - double fx = d_amplitude * siny * sinz + d_init_disp[0] - + d_velocity[0] * time; - front_i3(ifront, j, k) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); - // std::cout << i << '\t' << j << '\t' << k << '\t' << y << '\t' << z << '\t' << front_i(i,j,k) << std::endl; - } - } - } - - t_node_pos->stop(); - - if (dist_data != NULL) { - t_distance->start(); - - pdat::NodeData::iterator ni(tmp_dist.getGhostBox(), true); - pdat::NodeData::iterator niend(tmp_dist.getGhostBox(), false); - for ( ; ni != niend; ++ni) { - const pdat::NodeIndex& index = *ni; - if (d_dim == tbox::Dimension(2)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i2(ifront, index(1)) * dx[0]; - } else if (d_dim == tbox::Dimension(3)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i3(ifront, index(1), index(2)) * dx[0]; - } - } - // tmp_dist.print(tmp_dist.getBox(),0,plog); - - t_distance->stop(); - } - - if (tag_data != NULL) { - - t_tag_cells->start(); - - tag_data->fill(0); - - const hier::IntVector tag_growth(buffer); - - if (d_dim == tbox::Dimension(2)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int mini = front_i2(ifront, j) - buffer(0); - int maxi = front_i2(ifront, j) + buffer(0); - if (mini < pbox.lower() (0)) mini = pbox.lower() (0); - if (maxi > pbox.upper() (0)) maxi = pbox.upper() (0); - for (int i = mini; i <= maxi; ++i) { - tag_aa(i, j) = 1; - } - } - } else if (d_dim == tbox::Dimension(3)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int k = pbox.lower(2); k <= pbox.upper(2); ++k) { - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int mini = front_i3(ifront, j, k) - buffer(0); - int maxi = front_i3(ifront, j, k) + buffer(0); - if (mini < pbox.lower() (0)) mini = pbox.lower() (0); - if (maxi > pbox.upper() (0)) maxi = pbox.upper() (0); - for (int i = mini; i <= maxi; ++i) { - tag_aa(i, j, k) = 1; - } - } - } - } - - t_tag_cells->stop(); - - } - - t_copy->start(); - - /* - * Copy computed data to output. Recall that the convention is - * to send in a NULL pointer to indicate that data is not wanted. - */ - if (dist_data != NULL) { - dist_data->copy(tmp_dist); - } - - t_copy->stop(); -} - -#ifdef HAVE_HDF5 -int SinusoidalFrontTagger::registerVariablesWithPlotter( - appu::VisItDataWriter& writer) -{ - /* - * Register variables with plotter. - */ - if (d_allocate_data) { - writer.registerPlotQuantity("Distance to front", "SCALAR", d_dist_id); - writer.registerPlotQuantity("Tag value", "SCALAR", d_tag_id); - } else { - writer.registerDerivedPlotQuantity("Distance to front", "SCALAR", this, - // hier::IntVector(0), - 1.0, - "NODE"); - writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); - } - return 0; -} -#endif - -bool SinusoidalFrontTagger::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - NULL_USE(region); - NULL_USE(depth_index); - - TBOX_ASSERT(d_allocate_data == false); - if (variable_name == "Distance to front") { - pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, - 0)); - computePatchData(patch, d_time, &dist_data, NULL); - pdat::NodeData::iterator ciend(patch.getBox(), false); - for (pdat::NodeData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = dist_data(*ci); - } - } else if (variable_name == "Tag value") { - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - computePatchData(patch, d_time, NULL, &tag_data); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} - -void SinusoidalFrontTagger::setTime( - double time) -{ - d_time = time; -} diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.h b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.h deleted file mode 100644 index 577ac95b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/SinusoidalFrontTagger.h +++ /dev/null @@ -1,242 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class declaration - * - ************************************************************************/ -#ifndef included_SinusoidalFrontTagger -#define included_SinusoidalFrontTagger - -#include -#include -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" - -using namespace std; -using namespace SAMRAI; - -/*! - * @brief Class to tag a sinusoidal "front" in given domain. - */ -class SinusoidalFrontTagger: - public mesh::StandardTagAndInitStrategy, - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - SinusoidalFrontTagger( - /*! Ojbect name */ - const std::string& object_name, - const tbox::Dimension& dim, - /*! Input database */ - tbox::Database* database = NULL); - - ~SinusoidalFrontTagger(); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - /*! - * @brief Allocate and initialize data for a new level - * in the patch hierarchy. - * - * This is where you implement the code for initialize data on the - * grid. Nevermind when it is called or where in the program that - * happens. All the information you need to initialize the grid - * are in the arguments. - * - * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() - */ - virtual void - initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& hierarchy, - /*! Level to initialize */ - const int level_number, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_level = - boost::shared_ptr(), - /*! Whether data on new patch needs to be allocated */ - const bool allocate_data = true); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level); - - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data); - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - - void - setTime( - double time); - -public: - /*! - * @brief Deallocate internally managed patch data on level. - */ - void - deallocatePatchData( - hier::PatchLevel& level); - - /*! - * @brief Deallocate internally managed patch data on hierarchy. - */ - void - deallocatePatchData( - hier::PatchHierarchy& hierarchy); - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - - /* - * Compute patch data allocated by this class, on a hierarchy. - */ - void - computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time); - - /*! - * @brief Compute distance and tag data for a level. - */ - void - computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level = - boost::shared_ptr()) const; - - /*! - * @brief Compute distance and tag data for a patch. - */ - void - computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const; - -private: - std::string d_name; - - const tbox::Dimension d_dim; - - boost::shared_ptr d_hierarchy; - - /*! - * @brief Period of sinusoid. - */ - double d_period; - - /*! - * @brief Initial displacement. - */ - std::vector d_init_disp; - - /*! - * @brief Front velocity. - */ - std::vector d_velocity; - - /*! - * @brief Amplitude of sinusoid. - */ - double d_amplitude; - - /*! - * @brief ghost cell width of internal data. - * - * Optional. Meant to influence gridding parameters. Defaults to zero. - */ - hier::IntVector d_ghost_cell_width; - - /*! - * @brief Number of cells to tag around cells intersecting the front. - */ - hier::IntVector d_buffer_cells; - - tbox::Array d_buffer_space; - - boost::shared_ptr d_context; - - /*! - * @brief Distance from the front in the x direction. - */ - int d_dist_id; - /*! - * @brief Value of tag based on distance from front. - */ - int d_tag_id; - - /*! - * @brief Whether to allocate data on the mesh. - */ - bool d_allocate_data; - - /*! - * @brief Front time. - */ - double d_time; - - boost::shared_ptr t_setup; - boost::shared_ptr t_node_pos; - boost::shared_ptr t_distance; - boost::shared_ptr t_tag_cells; - boost::shared_ptr t_copy; - -}; - -#endif // included_ssup_SinusoidalFrontTagger diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.C b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.C deleted file mode 100644 index 67fbe719..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.C +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting input file name. - * - ************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "get-input-filename.h" - -int get_input_filename( - int* argc, - char* argv[], - std::string& input_filename) { - - int rval = 0; - std::string argv0(argv[0]); - if (*argc > 1) { - // Input file is the first argument. Shift other arguments down. - input_filename = argv[1]; - --(*argc); - int i; - for (i = 1; i < (*argc); ++i) { - argv[i] = argv[i + 1]; - } - } else if (*argc == 1 && argv0.rfind("check-") < argv0.size()) { - /* - * No argument but input file is implicit in program name - * which has the form check-. - */ - input_filename = argv0.substr(argv0.rfind("check-") + 6) + ".input"; - } else if (*argc == 1) { - // No argument and not invoked as "check-blah". - rval = 1; - } - return rval; -} diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.h b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.h deleted file mode 100644 index c33df146..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/get-input-filename.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting input file name. - * - ************************************************************************/ -#include - -/*! - * This function gets the input file name from the argument list. - * For most cases, this is simply the first - * command-line argument (after the program name). - * The variable @c input_filename is set to the filename, - * and all arguments following it are shifed down one. - * Unless you are a developer, this is all you need to know. - * - * For the special case with no command-line argument, - * if the program is invoked with the name "check-blah", - * it assumes the input file is "blah.input". - * The purpose of this setup is so that it is compatible with - * the automake make-check mechanism, which runs programs without - * arguments. At the same time, an input file can be manually - * specified for operational flexibility. - * - * @return 0 if filename is found, 1 otherwise. - */ -int get_input_filename(int* argc, char* argv[], std::string & input_filename); diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/main.C b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/main.C index b81245d4..e49485ba 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/main.C +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for asynchronous BR implementation * ************************************************************************/ @@ -16,6 +16,7 @@ #include #include #include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/MemoryUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -24,7 +25,6 @@ * Headers for basic SAMRAI objects used in this code. */ #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -50,9 +50,11 @@ #include "SAMRAI/solv/FACPreconditioner.h" #include "ABRTest.h" -#include "get-input-filename.h" +#include "test/testlib/get-input-filename.h" -#include +#include "boost/shared_ptr.hpp" + +#include using namespace SAMRAI; @@ -179,13 +181,6 @@ int main( tbox::plog << "Running on " << mpi.getSize() << " processes.\n"; - /* - * Choose which BR implementation to use. - */ - char which_br = 'o'; - which_br = main_db->getCharWithDefault("which_br", which_br); - tbox::plog << "which_br is " << which_br << endl; - int plot_step = main_db->getIntegerWithDefault("plot_step", 0); /* @@ -226,7 +221,7 @@ int main( input_db->isDatabase("BergerRigoutsos") ? input_db->getDatabase("BergerRigoutsos") : boost::shared_ptr())); - new_br->setMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + new_br->useDuplicateMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); tbox::plog << "Creating grid algorithm.\n"; /* @@ -235,7 +230,6 @@ int main( */ boost::shared_ptr tag_and_initializer( new mesh::StandardTagAndInitialize( - dim, "CellTaggingMethod", abrtest.getStandardTagAndInitObject(), input_db->getDatabase("StandardTagAndInitialize"))); @@ -297,14 +291,15 @@ int main( tbox::MemoryUtilities::printMemoryInfo(tbox::plog); bool done = false; for (int ln = 0; patch_hierarchy->levelCanBeRefined(ln) && !done; - ln++) { + ++ln) { tbox::plog << "Adding finer levels with ln = " << ln << endl; boost::shared_ptr level_( patch_hierarchy->getPatchLevel(ln)); gridding_algorithm->makeFinerLevel( - /* simulation time */ 0.0, - /* whether initial time */ true, - /* tag buffer size */ 0); + /* tag buffer size */ 0, + /* whether initial cycle */ true, + /* cycle */ 0, + /* simulation time */ 0.0); tbox::plog << "Just added finer level " << ln << " -> " << ln + 1; if (patch_hierarchy->getNumberOfLevels() < ln + 2) { tbox::plog << " (no new level!)" << endl; @@ -358,8 +353,10 @@ int main( /* * Adapt the grid. */ - tbox::Array tag_buffer(10); - for (int i = 0; i < tag_buffer.size(); ++i) tag_buffer[i] = 1; + std::vector tag_buffer(10); + for (int i = 0; i < static_cast(tag_buffer.size()); ++i) { + tag_buffer[i] = 1; + } for (int istep = 0; istep < num_steps; ++istep) { @@ -369,14 +366,16 @@ int main( abrtest.computeHierarchyData(*patch_hierarchy, double(istep + 1)); - tbox::Array regrid_start_time(patch_hierarchy->getMaxNumberOfLevels()); - for (int i = 0; i < regrid_start_time.size(); ++i) + std::vector regrid_start_time(patch_hierarchy->getMaxNumberOfLevels()); + for (int i = 0; i < static_cast(regrid_start_time.size()); ++i) { regrid_start_time[i] = istep; + } gridding_algorithm->regridAllFinerLevels( 0, - double(istep + 1), tag_buffer, + istep + 1, + double(istep + 1), regrid_start_time); if (mpi.getRank() == 0) { diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.2d.input b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.2d.input index 84fdfc97..5c78087f 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.2d.input @@ -3,54 +3,83 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for 2D DLBG test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 2D asynchronous Berger Rigoutsos unit test. * ************************************************************************/ Main { + // Dimension of problem. dim = 2 - which_br = 'n' - base_name = "front2d" + + // Base part name of log and vis filenames. + base_name = "front.2d" + + // Base name of log file(s). + //log_filename = "front.2d.log" + + // If TRUE log all nodes otherwise only log node 0. log_all = TRUE + + // Base name of visualization files. + //vis_filename = "front.2d" + + // Time step interval at which to plot. plot_step = 1 - check_graph = FALSE - // restart_write_dirname = "restart" - // time_nlbg_random_rmi = TRUE + + // If TRUE, perform recursivePrint on patch hierarchy. log_hierarchy = FALSE + + // Number of time steps. num_steps = 5 } ABRTest { + // Input for SinusoidalFrontGenerator. If anything other that sine_tagger is + // specified (or there is nothing) the SinusoidalFrontGenerator's defaults are + // used. See testlib/SinusoidalFrontGenerator for input parameter details. sine_tagger { - allocate_data = TRUE - adaption_buffer = 1 - period = 1 + // Period of tagging sinusoid. + period = 1.0, 1.0 + + // Amplitude of tagging sinusoid. amplitude = .3 + + // Front initial displacement. init_disp = 0.5, 0.0 - velocity = 0.02, 0.005 + + // Front velocity. + velocity = 0.015, 0.010 + + // Tagging buffer, in physical space units. + buffer_distance_0 = 0.2, 0.2 + buffer_distance_1 = 0.1, 0.1 + buffer_distance_2 = 0.05, 0.05 + buffer_distance_3 = 0.00, 0.00 + buffer_distance_4 = 0.00, 0.00 } } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - // log_node_history = TRUE - log_cluster_summary = TRUE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - // algo_advance_mode = "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - // owner_mode = "SINGLE_OWNER" - owner_mode = "MOST_OVERLAP" - // owner_mode = "FEWEST_OWNED" - // owner_mode = "LEAST_ACTIVE" - use_level_boxes = FALSE - use_private_communicator = TRUE - max_gcw = 0, 0 + efficiency_tolerance = 0.70 + combine_efficiency = 0.85 + // DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + // DEV_algo_advance_mode = "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + // DEV_owner_mode = "SINGLE_OWNER" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "FEWEST_OWNED" + // DEV_owner_mode = "LEAST_ACTIVE" } +// Refer to geom::CartesianGeometry and its base clases for input CartesianGridGeometry { // domain_boxes = [(0,0), (9,3)] // domain_boxes = [(0,0), (23,15)] @@ -63,23 +92,25 @@ CartesianGridGeometry { x_up = 3, 2 } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { - report_load_balance = TRUE - num_cycles = 2 + DEV_report_load_balance = TRUE // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 5 largest_patch_size { @@ -108,24 +139,14 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { - efficiency_tolerance = 0.70 - combine_efficiency = 0.85 - check_nonrefined_tags = "IGNORE" - sort_boxes_after_clustering = TRUE sequentialize_patch_indices = TRUE // For VisIt - // extend_tags_to_bdry = TRUE - // use_new_alg = TRUE - print_steps = TRUE + DEV_print_steps = TRUE } - -GlobalInputs{ - tag_clustering_method = "BINARY_TREE" -} - - +// Refer to tbox::TimerManager for input TimerManager{ timer_list = "hier::*::*", "mesh::*::*", "tbox::*::*", "apps::*::*" print_user = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.3d.input b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.3d.input index 5198fb14..0dbb3f27 100644 --- a/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/clustering/async_br/test_inputs/front.3d.input @@ -3,51 +3,51 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for 3D DLBG test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 3D asynchronous Berger Rigoutsos unit test. * ************************************************************************/ +// Refer to front2d.input for full description of all input parameters specific +// to this problem. + Main { dim = 3 - which_br = 'n' base_name = "front3d" log_all = TRUE plot_step = 1 - check_graph = FALSE - // restart_write_dirname = "restart" - // time_nlbg_random_rmi = TRUE log_hierarchy = FALSE num_steps = 3 } ABRTest { sine_tagger { - allocate_data = FALSE - adaption_buffer = 1 - period = 1 - amplitude = .3 + period = 1, 1, 1 + amplitude = .15 init_disp = 0.5, 0.0, 0.0 - velocity = 0.02, 0.005, 0.005 + velocity = 0.015, 0.010, 0.004 + + buffer_distance_0 = 0.0, 0.0, 0.0 + buffer_distance_1 = 0.0, 0.0, 0.0 + buffer_distance_2 = 0.0, 0.0, 0.0 } } BergerRigoutsos { - // log_node_history = TRUE - log_cluster_summary = TRUE - // algo_advance_mode = "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - // algo_advance_mode = "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - // owner_mode = "SINGLE_OWNER" - owner_mode = "MOST_OVERLAP" - // owner_mode = "FEWEST_OWNED" - // owner_mode = "LEAST_ACTIVE" - use_level_boxes = FALSE - use_private_communicator = TRUE - max_gcw = 0, 0, 0 + combine_efficiency = 0.88 + efficiency_tolerance = 0.88 + // DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + // DEV_algo_advance_mode = "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + // DEV_algo_advance_mode = "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + // DEV_owner_mode = "SINGLE_OWNER" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "FEWEST_OWNED" + // DEV_owner_mode = "LEAST_ACTIVE" } @@ -63,8 +63,7 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - num_cycles = 2 + DEV_report_load_balance = TRUE } PatchHierarchy { @@ -95,17 +94,8 @@ PatchHierarchy { } GriddingAlgorithm { - combine_efficiency = 0.88 - efficiency_tolerance = 0.88 - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } - -GlobalInputs{ - tag_clustering_method = "BINARY_TREE" -} - - TimerManager{ timer_list = "hier::*::*", "mesh::*::*", "tbox::*::*", "apps::*::*" print_user = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/Makefile.in b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/Makefile.in deleted file mode 100644 index 52586740..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/Makefile.in +++ /dev/null @@ -1,123 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for Euler gas dynamics sample application -## -######################################################################### - -SAMRAI = @top_srcdir@ -SRCDIR = @top_srcdir@/examples/Euler -SUBDIR = source/test/clustering/parallel_br -VPATH = @top_srcdir@/examples/Euler -TESTTOOLS = ../../testtools -OBJECT = ../../../.. - -default: check - -include $(OBJECT)/config/Makefile.config - -AUTOTEST = $(SAMRAI)/source/test/applications -CPPFLAGS_EXTRA= -I$(AUTOTEST) -DNDIM=$(PDIM) -DTESTING=1 - -NUM_TESTS = 3 - -TEST_NPROCS = @TEST_NPROCS@ - -CXX_OBJS = main.o Euler.o AutoTester.o -F2D_OBJS = avgint.o flaten1d.o flux.o grad.o init.o stable.o \ - stufprobc.o trace.o trace1d.o -F3D_OBJS = $(F2D_OBJS) fluxcorner.o - -main2d: - if test -f stamp-3d; then $(MAKE) clean-check; fi - touch stamp-2d - $(MAKE) PDIM=2 main-2d - -main-2d:$(CXX_OBJS) $(F2D_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F2D_OBJS) \ - $(LIBSAMRAI2D) $(LIBSAMRAI) $(LDLIBS) -o main2d - -TEST_NPROCS = @TEST_NPROCS@ - -check: - $(MAKE) check2d - $(MAKE) check3d - -check2d: main2d - @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main2d $${i}; \ - done - -check3d: - -checkcompile: main2d main3d - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean-check: - $(RM) *.f test-*d-append-*.input core - $(RM) *.o *.ii *.int.c stamp-[23]d - $(RM) -r ti_files ii_files - -clean: - $(SAMCLEAN) - $(MAKE) clean-check - $(RM) main* - $(RM) -r restart-* - -include $(SRCDIR)/Makefile.depend - -FORTRAN = $(SRCDIR)/fortran/$(PDIM)d -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) - -AutoTester.o: $(AUTOTEST)/AutoTester.C - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(AUTOTEST)/AutoTester.C \ - -o $@ - -avgint.o: $(FORTRAN)/avgint.m4 - $(M4) $(M4DIRS) $(FORTRAN)/avgint.m4 > avgint.f - $(F77) $(FFLAGS) -c avgint.f -o $@ - -flaten1d.o: $(FORTRAN)/flaten1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flaten1d.m4 > flaten1d.f - $(F77) $(FFLAGS) -c flaten1d.f -o $@ - -flux.o: $(FORTRAN)/flux.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux.m4 > flux.f - $(F77) $(FFLAGS) -c flux.f -o $@ - -fluxcorner.o: $(FORTRAN)/fluxcorner.m4 - $(M4) -B8096 $(M4DIRS) $(FORTRAN)/fluxcorner.m4 > fluxcorner.f - $(F77) $(FFLAGS) -c fluxcorner.f -o $@ - -grad.o: $(FORTRAN)/grad.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad.m4 > grad.f - $(F77) $(FFLAGS) -c grad.f -o $@ - -init.o: $(FORTRAN)/init.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init.m4 > init.f - $(F77) $(FFLAGS) -c init.f -o $@ - -stable.o: $(FORTRAN)/stable.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable.m4 > stable.f - $(F77) $(FFLAGS) -c stable.f -o $@ - -stufprobc.o: $(FORTRAN)/../stufprobc.m4 - $(M4) $(M4DIRS) $(FORTRAN)/../stufprobc.m4 > stufprobc.f - $(F77) $(FFLAGS) -c stufprobc.f -o $@ - -trace.o: $(FORTRAN)/trace.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace.m4 > trace.f - $(F77) $(FFLAGS) -c trace.f -o $@ - -trace1d.o: $(FORTRAN)/trace1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace1d.m4 > trace1d.f - $(F77) $(FFLAGS) -c trace1d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.boxes b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.boxes deleted file mode 100644 index 8b981ce2..00000000 Binary files a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.boxes and /dev/null differ diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.inc b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.inc deleted file mode 100644 index 312c33f3..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test.2d.inc +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler 2d test problem - * - ************************************************************************/ - -AutoTester { - test_fluxes = FALSE - test_iter_num = 10 - correct_result = 0.0199217807513, 0.000626511715916, 0.0000697047190579 - output_correct = FALSE - - write_patch_boxes = FALSE - read_patch_boxes = TRUE - test_patch_boxes_at_steps = 0, 5, 10 // 0 checks initial data - test_patch_boxes_filename = "test-2d.boxes" - simplify_test_boxes = TRUE -} - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "STEP" - - Initial_data { - front_position = 0.0 - interval_0 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - interval_1 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 20.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.90 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "YREFLECT" - } - } - -} - -Main { -// log file parameters - log_file_name = "test-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-2d" - viz_dump_filename = "step2d" - -// restart dump parameters - restart_interval = 1 // zero to turn off - restart_write_dirname = "restart-test-2d" - - plotting_interval = 0 -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (9,19) ], - [ (10,4) , (49,19) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 2.5e0 , 1.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -GriddingAlgorithm { - max_levels = 5 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - level_4 = 2 , 2 - } - - largest_patch_size { - level_0 = 32 , 32 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8 , 8 - level_1 = 8 , 8 - level_2 = 8 , 8 - level_3 = 12 , 12 - } - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE -} - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 10 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_1.input b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_1.input deleted file mode 100644 index fc9b2a66..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_1.input +++ /dev/null @@ -1,16 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for parallel clustering tests. - * - ************************************************************************/ - -GlobalInputs { - tag_clustering_method = "ORIGINAL" - call_abort_in_serial_instead_of_exit = FALSE -} - -include test.2d.inc diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_2.input b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_2.input deleted file mode 100644 index 3d2b6839..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_2.input +++ /dev/null @@ -1,16 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for parallel clustering tests. - * - ************************************************************************/ - -GlobalInputs { - tag_clustering_method = "COMMUNICATOR" - call_abort_in_serial_instead_of_exit = FALSE -} - -include test.2d.inc diff --git a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_3.input b/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_3.input deleted file mode 100644 index fc194855..00000000 --- a/base/SAMRAI/SAMRAI/source/test/clustering/parallel_br/test_inputs/test_3.input +++ /dev/null @@ -1,16 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for parallel clustering test. - * - ************************************************************************/ - -GlobalInputs { - tag_clustering_method = "ORIG_FAST_REDUCE" - call_abort_in_serial_instead_of_exit = FALSE -} - -include test.2d.inc diff --git a/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.C index ae5050e6..09cbc0d3 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for cell-centered patch data * ************************************************************************/ @@ -23,6 +23,8 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/tbox/Database.h" +#include + namespace SAMRAI { using namespace std; @@ -37,11 +39,9 @@ CellDataTest::CellDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -115,23 +115,22 @@ void CellDataTest::readTestInput( */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); } void CellDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::CellVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); if (d_do_refine) { commtest->registerVariable(d_variables[i], @@ -158,13 +157,12 @@ void CellDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const pdat::CellIndex loweri(patch.getBox().lower()); const pdat::CellIndex upperi(patch.getBox().upper()); const double* pdx = pgeom->getDx(); @@ -175,8 +173,9 @@ void CellDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - pdat::CellIterator ciend(sbox, false); - for (pdat::CellIterator ci(sbox, true); ci != ciend; ++ci) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sbox)); + ci != ciend; ++ci) { /* * Compute spatial location of cell center and @@ -192,7 +191,7 @@ void CellDataTest::setLinearData( z = lowerx[2] + pdx[2] * ((*ci)(2) - loweri(2) + 0.5); } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ci, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -207,20 +206,19 @@ void CellDataTest::setConservativeData( const boost::shared_ptr hierarchy, int level_number) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); -#endif boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); const hier::BoxContainer& domain = level->getPhysicalDomain(hier::BlockId::zero()); - int ncells = 0; - for (hier::BoxContainer::const_iterator i(domain); i != domain.end(); ++i) { + size_t ncells = 0; + for (hier::BoxContainer::const_iterator i = domain.begin(); + i != domain.end(); ++i) { ncells += i->size(); } @@ -234,14 +232,15 @@ void CellDataTest::setConservativeData( * Set cell value on level zero to u(i,j,k) = (i + j + k)/ncells. */ - pdat::CellIterator fiend(sbox, false); - for (pdat::CellIterator fi(sbox, true); fi != fiend; ++fi) { + pdat::CellIterator fiend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator fi(pdat::CellGeometry::begin(sbox)); + fi != fiend; ++fi) { double value = 0.0; - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < d_dim.getValue(); ++d) { value += (double)((*fi)(d)); } - value /= ncells; - for (int dep = 0; dep < depth; dep++) { + value /= static_cast(ncells); + for (int dep = 0; dep < depth; ++dep) { (*data)(*fi, dep) = value; } } @@ -256,20 +255,21 @@ void CellDataTest::setConservativeData( * is the vector between the coarse and fine cell centers. */ - hier::IntVector ratio(level->getRatioToLevelZero()); + const hier::IntVector& ratio = level->getRatioToLevelZero(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - int coarse_ncells = ncells; + size_t coarse_ncells = ncells; std::vector > delta(d_dim.getValue()); - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < d_dim.getValue(); ++d) { delta[d].resize(ratio(d), 0.0); coarse_ncells /= ratio(d); double coarse_dx = dx[d] * ratio(d); - for (int i = 0; i < ratio(d); i++) { + for (int i = 0; i < ratio(d); ++i) { /* * delta[d][i] is the physical distance from i-th fine * cell centroid in d-direction to coarse cell centroid. @@ -280,23 +280,24 @@ void CellDataTest::setConservativeData( } } - pdat::CellIterator fiend(sbox, false); - for (pdat::CellIterator fi(sbox, true); fi != fiend; ++fi) { + pdat::CellIterator fiend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator fi(pdat::CellGeometry::begin(sbox)); + fi != fiend; ++fi) { const hier::IntVector ci(hier::Index::coarsen(*fi, ratio)); hier::IntVector del(ci.getDim()); // Index vector from ci to fi. double value = 0.0; - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < d_dim.getValue(); ++d) { del(d) = (int)delta[d][(*fi)(d) - ci(d) * ratio(d)]; value += (double)(ci(d)); } - value /= coarse_ncells; + value /= static_cast(coarse_ncells); - for (int d = 0; d < d_dim.getValue(); d++) { + for (int d = 0; d < d_dim.getValue(); ++d) { value += ci(d) * del(d); } - for (int dep = 0; dep < depth; dep++) { + for (int dep = 0; dep < depth; ++dep) { (*data)(*fi, dep) = value; } @@ -311,9 +312,7 @@ void CellDataTest::setPeriodicData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif NULL_USE(patch); const double* xlo = d_cart_grid_geometry->getXLower(); @@ -324,16 +323,18 @@ void CellDataTest::setPeriodicData( } const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const int depth = data->getDepth(); const hier::Box sbox = data->getGhostBox() * box; - pdat::CellIterator ciend(sbox, false); - for (pdat::CellIterator ci(sbox, true); ci != ciend; ++ci) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sbox)); + ci != ciend; ++ci) { double val = 1.0; for (int d = 0; d < d_dim.getValue(); ++d) { @@ -341,7 +342,7 @@ void CellDataTest::setPeriodicData( tmpf = sin(2 * M_PI * tmpf); val *= tmpf; } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ci, d) = val; } @@ -363,11 +364,12 @@ void CellDataTest::initializeDataOnPatch( if (d_do_refine) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); hier::Box dbox = cell_data->getBox(); @@ -381,11 +383,12 @@ void CellDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); hier::Box dbox = cell_data->getGhostBox(); @@ -425,9 +428,10 @@ void CellDataTest::checkPatchInteriorData( setLinearData(correct_data, correct_data->getGhostBox(), patch); } - pdat::CellIterator ciend(interior, false); - for (pdat::CellIterator ci(interior, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::CellIterator ciend(pdat::CellGeometry::end(interior)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(interior)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { if (!(tbox::MathUtilities::equalEps((*data)(*ci, d), (*correct_data)(*ci, d)))) { tbox::perr << "FAILED: -- patch interior not properly filled" @@ -450,30 +454,31 @@ void CellDataTest::setPhysicalBoundaryConditions( bool is_periodic = periodic_shift.max() > 0; boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - } - const int num_edge_bdry_boxes = d_dim > tbox::Dimension(1) ? edge_bdry.getSize() : -1; + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - } - const int num_face_bdry_boxes = d_dim == tbox::Dimension(3) ? face_bdry.getSize() : -1; + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); hier::Box patch_interior = cell_data->getBox(); checkPatchInteriorData(cell_data, patch_interior, patch); @@ -481,7 +486,7 @@ void CellDataTest::setPhysicalBoundaryConditions( /* * Set node boundary data. */ - for (int ni = 0; ni < num_node_bdry_boxes; ni++) { + for (int ni = 0; ni < num_node_bdry_boxes; ++ni) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[ni], patch.getBox(), @@ -498,7 +503,7 @@ void CellDataTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), @@ -516,7 +521,7 @@ void CellDataTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], patch.getBox(), @@ -561,7 +566,7 @@ bool CellDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(periodic_shift.getDim(), 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -587,18 +592,20 @@ bool CellDataTest::verifyResults( } } - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); int depth = cell_data->getDepth(); hier::Box dbox = cell_data->getGhostBox(); - pdat::CellIterator ciend(dbox, false); - for (pdat::CellIterator ci(dbox, true); ci != ciend; ++ci) { + pdat::CellIterator ciend(pdat::CellGeometry::end(dbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(dbox)); + ci != ciend; ++ci) { double correct = (*solution)(*ci); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*cell_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { tbox::perr << "Test FAILED: ...." @@ -633,4 +640,81 @@ bool CellDataTest::verifyResults( } +void CellDataTest::setDataIds(std::list& data_ids) +{ + hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); + for (int i = 0; i < static_cast(d_variables.size()); ++i) { + int data_id = variable_db->mapVariableAndContextToIndex( + d_variables[i], + getDataContext()); + data_ids.push_back(data_id); + } +} + +bool CellDataTest::verifyCompositeBoundaryData( + const hier::Patch& patch, + const boost::shared_ptr hierarchy, + int data_id, + int level_number, + const std::vector >& bdry_data) +{ + bool test_failed = false; + + const hier::IntVector periodic_shift( + d_cart_grid_geometry->getPeriodicShift(hier::IntVector(d_dim, 1))); + bool is_periodic = periodic_shift.max() > 0; + + if (d_do_refine && !is_periodic) { + for (std::vector >::const_iterator + itr = bdry_data.begin(); itr != bdry_data.end(); ++itr) { + boost::shared_ptr > cell_bdry_data( + BOOST_CAST, hier::PatchData>(*itr)); + TBOX_ASSERT(cell_bdry_data); + + hier::Patch solution_patch( + cell_bdry_data->getBox(), patch.getPatchDescriptor()); + + d_cart_grid_geometry->setGeometryDataOnPatch( + solution_patch, + hierarchy->getPatchLevel(level_number+1)->getRatioToLevelZero(), + hier::PatchGeometry::TwoDimBool(patch.getDim(), false)); + + boost::shared_ptr > solution( + new pdat::CellData( + solution_patch.getBox(), 1, + hier::IntVector::getZero(patch.getDim()))); + + setLinearData(solution, solution_patch.getBox(), solution_patch); + + int depth = cell_bdry_data->getDepth(); + hier::Box dbox(cell_bdry_data->getBox()); + + pdat::CellIterator ciend(pdat::CellGeometry::end(dbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(dbox)); + ci != ciend; ++ci) { + double correct = (*solution)(*ci); + for (int d = 0; d < depth; ++d) { + double result = (*cell_bdry_data)(*ci, d); + if (!tbox::MathUtilities::equalEps(correct, result)) { + tbox::perr << "Test FAILED: ...." + << " : cell index = " << *ci + << " on composite boundary stencil" + << " " << solution->getBox() << endl; + tbox::perr << " patch data id " << data_id + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } + } + } + } + } + + return !test_failed; + +} + + + } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.h index d0286dcb..e2966a74 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/CellDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for cell-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -25,7 +24,7 @@ #include "PatchDataTestStrategy.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -122,6 +121,17 @@ class CellDataTest:public PatchDataTestStrategy const boost::shared_ptr hierarchy, int level_number); + void + setDataIds(std::list& data_ids); + + bool + verifyCompositeBoundaryData( + const hier::Patch& patch, + const boost::shared_ptr hierarchy, + int data_id, + int level_number, + const std::vector >& bdry_data); + private: /** * Function for reading test data from input file. @@ -191,7 +201,7 @@ class CellDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/CommTester.C b/base/SAMRAI/SAMRAI/source/test/communication/CommTester.C index ef4c5a91..194cefe2 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/CommTester.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/CommTester.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch data communication tests. * ************************************************************************/ @@ -11,14 +11,15 @@ #include "CommTester.h" #include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/CoarsenOperator.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/xfer/CompositeBoundaryAlgorithm.h" namespace SAMRAI { @@ -40,28 +41,28 @@ CommTester::CommTester( bool do_refine, bool do_coarsen, const string& refine_option): - RefinePatchStrategy(dim), - CoarsenPatchStrategy(dim), + RefinePatchStrategy(), + CoarsenPatchStrategy(), d_dim(dim), - d_fill_source_algorithm(dim), - d_refine_algorithm(dim), + d_fill_source_algorithm(), + d_refine_algorithm(), d_coarsen_algorithm(dim), - d_reset_refine_algorithm(dim), + d_reset_refine_algorithm(), d_reset_coarsen_algorithm(dim) { NULL_USE(main_input_db); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); - TBOX_ASSERT(data_test != (PatchDataTestStrategy *)NULL); -#endif + TBOX_ASSERT(data_test != 0); d_object_name = object_name; d_data_test_strategy = data_test; d_fake_time = 0.0; + d_fake_cycle = 0; + d_is_reset = false; d_do_refine = do_refine; @@ -78,9 +79,9 @@ CommTester::CommTester( } d_patch_data_components.clrAllFlags(); - d_fill_source_schedule.resizeArray(0); - d_refine_schedule.resizeArray(0); - d_coarsen_schedule.resizeArray(0); + d_fill_source_schedule.resize(0); + d_refine_schedule.resize(0); + d_coarsen_schedule.resize(0); d_source = hier::VariableDatabase::getDatabase()->getContext("SOURCE"); @@ -121,7 +122,7 @@ void CommTester::registerVariable( const boost::shared_ptr xfer_geom, const string& operator_name) { - TBOX_DIM_ASSERT_CHECK_ARGS2(src_ghosts, dst_ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_ghosts, dst_ghosts); TBOX_ASSERT(src_variable); TBOX_ASSERT(dst_variable); @@ -154,7 +155,7 @@ void CommTester::registerVariable( dst_ghosts)); scratch_ghosts.max(hier::IntVector(scratch_ghosts.getDim(), 1)); if (refine_operator) { - scratch_ghosts.max(refine_operator->getStencilWidth()); + scratch_ghosts.max(refine_operator->getStencilWidth(dim)); } int scratch_id = variable_db->registerVariableAndContext(src_variable, @@ -196,7 +197,7 @@ void CommTester::registerVariableForReset( const boost::shared_ptr xfer_geom, const string& operator_name) { - TBOX_DIM_ASSERT_CHECK_ARGS2(src_ghosts, dst_ghosts); + TBOX_ASSERT_OBJDIM_EQUALITY2(src_ghosts, dst_ghosts); TBOX_ASSERT(src_variable); TBOX_ASSERT(dst_variable); @@ -224,7 +225,7 @@ void CommTester::registerVariableForReset( dst_ghosts)); scratch_ghosts.max(hier::IntVector(scratch_ghosts.getDim(), 1)); if (refine_operator) { - scratch_ghosts.max(refine_operator->getStencilWidth()); + scratch_ghosts.max(refine_operator->getStencilWidth(scratch_ghosts.getDim())); } int scratch_id = variable_db->registerVariableAndContext(src_variable, @@ -259,36 +260,42 @@ void CommTester::registerVariableForReset( void CommTester::createRefineSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif boost::shared_ptr level( d_patch_hierarchy->getPatchLevel(level_number)); if (d_do_refine) { - d_fill_source_schedule.resizeArray(d_patch_hierarchy->getNumberOfLevels()); + d_fill_source_schedule.resize(d_patch_hierarchy->getNumberOfLevels()); d_fill_source_schedule[level_number].reset(); - d_refine_schedule.resizeArray(d_patch_hierarchy->getNumberOfLevels()); + d_refine_schedule.resize(d_patch_hierarchy->getNumberOfLevels()); d_refine_schedule[level_number].reset(); const hier::Connector& peer_cnect = - d_patch_hierarchy->getConnector(level_number, level_number); + d_patch_hierarchy->getPatchLevel(level_number)->findConnector( + *d_patch_hierarchy->getPatchLevel(level_number), + d_patch_hierarchy->getRequiredConnectorWidth(level_number, level_number, true), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false); const hier::Connector* cnect_to_coarser = level_number > 0 ? - &d_patch_hierarchy->getConnector(level_number, level_number - 1) : NULL; - const hier::Connector* cnect_from_coarser = level_number > 0 ? - &d_patch_hierarchy->getConnector(level_number - 1, level_number) : NULL; + &d_patch_hierarchy->getPatchLevel(level_number)->findConnectorWithTranspose( + *d_patch_hierarchy->getPatchLevel(level_number - 1), + d_patch_hierarchy->getRequiredConnectorWidth(level_number, level_number - 1, true), + d_patch_hierarchy->getRequiredConnectorWidth(level_number - 1, level_number), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + false) : 0; if (0) { // These are expensive checks. - hier::OverlapConnectorAlgorithm oca; - oca.assertOverlapCorrectness(peer_cnect); - if (cnect_to_coarser) - oca.assertOverlapCorrectness(*cnect_to_coarser); - if (cnect_from_coarser) - oca.assertOverlapCorrectness(*cnect_from_coarser); + peer_cnect.assertOverlapCorrectness(); + if (cnect_to_coarser) { + cnect_to_coarser->assertOverlapCorrectness(); + if (cnect_to_coarser->hasTranspose()) { + cnect_to_coarser->getTranspose().assertOverlapCorrectness(); + } + } d_patch_hierarchy->recursivePrint(tbox::plog, "", 3); } @@ -318,10 +325,8 @@ void CommTester::createRefineSchedule( void CommTester::resetRefineSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif if (d_do_refine) { @@ -335,14 +340,12 @@ void CommTester::resetRefineSchedule( void CommTester::createCoarsenSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif if (d_do_coarsen && (level_number > 0)) { - d_coarsen_schedule.resizeArray(d_patch_hierarchy->getNumberOfLevels()); + d_coarsen_schedule.resize(d_patch_hierarchy->getNumberOfLevels()); d_coarsen_schedule[level_number].reset(); boost::shared_ptr level( @@ -362,10 +365,8 @@ void CommTester::createCoarsenSchedule( void CommTester::resetCoarsenSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif if (d_do_coarsen && (level_number > 0)) { @@ -389,7 +390,7 @@ void CommTester::performRefineOperations( { if (d_do_refine) { if (d_fill_source_schedule[level_number] && - level_number < d_fill_source_schedule.size() - 1) { + level_number < static_cast(d_fill_source_schedule.size()) - 1) { d_data_test_strategy->setDataContext(d_source); d_fill_source_schedule[level_number]->fillData(d_fake_time); } @@ -421,6 +422,52 @@ void CommTester::performCoarsenOperations( } } +bool CommTester::performCompositeBoundaryComm( + const int level_number) +{ + bool test_failed = false; + + d_data_test_strategy->setDataContext(d_destination); + std::list dst_ids; + d_data_test_strategy->setDataIds(dst_ids); + if (!dst_ids.empty()) { + SAMRAI::xfer::CompositeBoundaryAlgorithm cba(d_patch_hierarchy, 3); + for (std::list::const_iterator itr = dst_ids.begin(); + itr != dst_ids.end(); ++itr) { + cba.addDataId(*itr); + } + boost::shared_ptr cbsched = + cba.createSchedule(level_number); + cbsched->fillData(d_fake_time); + + boost::shared_ptr level( + d_patch_hierarchy->getPatchLevel(level_number)); + + for (hier::PatchLevel::iterator p(level->begin()); + p != level->end(); ++p) { + const boost::shared_ptr& patch = *p; + + for (std::list::const_iterator itr = dst_ids.begin(); + itr != dst_ids.end(); ++itr) { + const std::vector >& bdry_data = + cbsched->getBoundaryPatchData(*patch, *itr); + + bool result = d_data_test_strategy->verifyCompositeBoundaryData( + *patch, d_patch_hierarchy, *itr, level_number, bdry_data); + + if (!result) { + test_failed = true; + } + } + } + } + + d_data_test_strategy->clearDataContext(); + + return !test_failed; +} + + /* ************************************************************************* * @@ -438,7 +485,7 @@ bool CommTester::verifyCommunicationResults() const d_data_test_strategy->setDataContext(d_destination); } for (int ln = 0; - ln <= d_patch_hierarchy->getFinestLevelNumber(); ln++) { + ln <= d_patch_hierarchy->getFinestLevelNumber(); ++ln) { boost::shared_ptr level( d_patch_hierarchy->getPatchLevel(ln)); @@ -446,7 +493,7 @@ bool CommTester::verifyCommunicationResults() const p != level->end(); ++p) { const boost::shared_ptr& patch = *p; - tests_pass &= + tests_pass = tests_pass && d_data_test_strategy->verifyResults(*patch, d_patch_hierarchy, ln); } } @@ -478,11 +525,10 @@ void CommTester::initializeLevelData( NULL_USE(initial_time); NULL_USE(old_level); NULL_USE(allocate_data); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(hierarchy); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); TBOX_ASSERT(level_number >= 0); -#endif hier::PatchLevel& level = (hier::PatchLevel &) * hierarchy->getPatchLevel(level_number); @@ -571,9 +617,9 @@ void CommTester::setPhysicalBoundaryConditions( gcw); } -hier::IntVector CommTester::getRefineOpStencilWidth() const +hier::IntVector CommTester::getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getOne(d_dim); + return hier::IntVector::getOne(dim); } void CommTester::preprocessRefine( @@ -594,9 +640,9 @@ void CommTester::postprocessRefine( d_data_test_strategy->postprocessRefine(fine, coarse, fine_box, ratio); } -hier::IntVector CommTester::getCoarsenOpStencilWidth() const +hier::IntVector CommTester::getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector::getZero(d_dim); + return hier::IntVector::getZero(dim); } void CommTester::preprocessCoarsen( @@ -631,9 +677,7 @@ void CommTester::setupHierarchy( boost::shared_ptr main_input_db, boost::shared_ptr cell_tagger) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif d_patch_hierarchy.reset( new hier::PatchHierarchy("PatchHierarchy", @@ -641,7 +685,8 @@ void CommTester::setupHierarchy( main_input_db->getDatabase("PatchHierarchy"))); boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(d_dim)); + new mesh::BergerRigoutsos(d_dim, + main_input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer( @@ -663,12 +708,13 @@ void CommTester::setupHierarchy( gridding_algorithm->makeCoarsestLevel(d_fake_time); - bool initial_time = true; - for (int ln = 0; d_patch_hierarchy->levelCanBeRefined(ln); ln++) { + bool initial_cycle = true; + for (int ln = 0; d_patch_hierarchy->levelCanBeRefined(ln); ++ln) { gridding_algorithm->makeFinerLevel( - d_fake_time, - initial_time, - fake_tag_buffer); + fake_tag_buffer, + initial_cycle, + d_fake_cycle, + d_fake_time); } /* @@ -679,13 +725,13 @@ void CommTester::setupHierarchy( for (int ln = 0; ln < d_patch_hierarchy->getNumberOfLevels(); ++ln) { boost::shared_ptr level( d_patch_hierarchy->getPatchLevel(ln)); - level->getBoxLevel()->getPersistentOverlapConnectors().clear(); + level->getBoxLevel()->clearPersistentOverlapConnectors(); } if (0) { tbox::plog << "h: generated hierarchy:\n"; d_patch_hierarchy->recursivePrint(tbox::plog, "h: ", 3); - tbox::plog << "h: mapped_box_level hierarchy:\n"; + tbox::plog << "h: box_level hierarchy:\n"; d_patch_hierarchy->recursivePrint(tbox::plog, "", 3); diff --git a/base/SAMRAI/SAMRAI/source/test/communication/CommTester.h b/base/SAMRAI/SAMRAI/source/test/communication/CommTester.h index b541a21a..3c3ec323 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/CommTester.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/CommTester.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch data communication tests. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/ComponentSelector.h" #include "SAMRAI/xfer/CoarsenAlgorithm.h" @@ -39,7 +38,7 @@ using namespace std; #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -147,6 +146,10 @@ class CommTester: performRefineOperations( const int level_number); + bool + performCompositeBoundaryComm( + const int level_number); + /** * Coarsen data to specified level. */ @@ -196,7 +199,8 @@ class CommTester: const hier::IntVector& gcw); hier::IntVector - getRefineOpStencilWidth() const; + getRefineOpStencilWidth( + const tbox::Dimension& dim) const; void preprocessRefine( @@ -213,7 +217,8 @@ class CommTester: const hier::IntVector& ratio); hier::IntVector - getCoarsenOpStencilWidth() const; + getCoarsenOpStencilWidth( + const tbox::Dimension& dim) const; void preprocessCoarsen( @@ -267,6 +272,14 @@ class CommTester: boost::shared_ptr main_input_db, boost::shared_ptr cell_tagger); + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; + } + private: const tbox::Dimension d_dim; @@ -303,6 +316,11 @@ class CommTester: */ double d_fake_time; + /* + * Dummy cycle for all data operations. + */ + int d_fake_cycle; + /* * The CommTester uses two variable contexts for each variable. * The "source", and "destination" contexts indicate the source @@ -338,9 +356,9 @@ class CommTester: bool d_is_reset; - tbox::Array > d_fill_source_schedule; - tbox::Array > d_refine_schedule; - tbox::Array > d_coarsen_schedule; + std::vector > d_fill_source_schedule; + std::vector > d_refine_schedule; + std::vector > d_coarsen_schedule; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.C index 950369a5..1121bc77 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -16,6 +16,7 @@ #include "SAMRAI/pdat/CellIndex.h" #include "SAMRAI/pdat/CellIterator.h" #include "CommTester.h" +#include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/pdat/EdgeGeometry.h" #include "SAMRAI/pdat/EdgeIndex.h" #include "SAMRAI/pdat/EdgeIterator.h" @@ -47,11 +48,9 @@ EdgeDataTest::EdgeDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -63,7 +62,7 @@ EdgeDataTest::EdgeDataTest( d_refine_option = refine_option; - d_use_fine_value_at_interface.resizeArray(0); + d_use_fine_value_at_interface.resize(0); d_Acoef = 0.0; d_Bcoef = 0.0; @@ -93,9 +92,7 @@ EdgeDataTest::~EdgeDataTest() void EdgeDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Read coeeficients of linear profile to test interpolation. @@ -130,16 +127,15 @@ void EdgeDataTest::readTestInput( */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); boost::shared_ptr var_data( db->getDatabase("VariableData")); - tbox::Array var_keys = var_data->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = var_data->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_use_fine_value_at_interface.resizeArray(nkeys); + d_use_fine_value_at_interface.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db( var_data->getDatabase(var_keys[i])); @@ -157,17 +153,17 @@ void EdgeDataTest::readTestInput( void EdgeDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::EdgeVariable(d_dim, d_variable_src_name[i], - d_variable_depth[i], - d_use_fine_value_at_interface[i])); + d_variable_depth[i], + d_use_fine_value_at_interface[i])); if (d_do_refine) { commtest->registerVariable(d_variables[i], @@ -197,13 +193,11 @@ void EdgeDataTest::setConstantData( { NULL_USE(axfact); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif if (!box.empty()) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { pdat::ArrayData& array = data->getArrayData(axis); double value = GETVALUE(d_dim.getValue(), ndimfact, axis); @@ -221,12 +215,10 @@ void EdgeDataTest::setConservativeData( const boost::shared_ptr hierarchy, int level_number) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); -#endif int i, j; boost::shared_ptr level( @@ -234,8 +226,9 @@ void EdgeDataTest::setConservativeData( const hier::BoxContainer& domain = level->getPhysicalDomain(hier::BlockId::zero()); - int ncells = 0; - for (hier::BoxContainer::const_iterator i(domain); i != domain.end(); ++i) { + size_t ncells = 0; + for (hier::BoxContainer::const_iterator i = domain.begin(); + i != domain.end(); ++i) { ncells += i->size(); } @@ -253,20 +246,21 @@ void EdgeDataTest::setConservativeData( * u2(i,j,k) = (i + j)/ncells */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { - pdat::CellIterator ciend(sbox, false); - for (pdat::CellIterator ci(sbox, true); ci != ciend; ++ci) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sbox)); + ci != ciend; ++ci) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i == axis) { value += (double)((*ci)(i)); } } - value /= ncells; + value /= static_cast(ncells); if (d_dim == tbox::Dimension(1)) { - for (int edge = 0; edge < 1; edge++) { + for (int edge = 0; edge < 1; ++edge) { pdat::EdgeIndex si(*ci, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -274,9 +268,9 @@ void EdgeDataTest::setConservativeData( if (d_dim == tbox::Dimension(2)) { for (int edge = pdat::EdgeIndex::Lower; edge <= pdat::EdgeIndex::Upper; - edge++) { + ++edge) { pdat::EdgeIndex si(*ci, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -284,9 +278,9 @@ void EdgeDataTest::setConservativeData( if (d_dim == tbox::Dimension(3)) { for (int edge = pdat::EdgeIndex::LowerLeft; edge <= pdat::EdgeIndex::UpperRight; - edge++) { + ++edge) { pdat::EdgeIndex si(*ci, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -308,27 +302,29 @@ void EdgeDataTest::setConservativeData( const int max_ratio = ratio.max(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - int coarse_ncells = ncells; + size_t coarse_ncells = static_cast(ncells); double* delta = new double[max_ratio * d_dim.getValue()]; - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { coarse_ncells /= ratio(j); double coarse_dx = dx[j] * ratio(j); - for (i = 0; i < ratio(j); i++) { + for (i = 0; i < ratio(j); ++i) { delta[j * max_ratio + i] = (i + 0.5) * dx[j] - coarse_dx * 0.5; } } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::IntVector ci(ratio.getDim()); hier::IntVector del(ratio.getDim()); - pdat::CellIterator fiend(sbox, false); - for (pdat::CellIterator fi(sbox, true); fi != fiend; ++fi) { + pdat::CellIterator fiend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator fi(pdat::CellGeometry::begin(sbox)); + fi != fiend; ++fi) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i == axis) { int findx = (*fi)(i); ci(i) = ((findx < 0) ? (findx + 1) / ratio(i) - 1 @@ -337,18 +333,18 @@ void EdgeDataTest::setConservativeData( value += (double)(ci(i)); } } - value /= coarse_ncells; + value /= static_cast(coarse_ncells); - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { if (j == axis) { value += ci(j) * del(j); } } if (d_dim == tbox::Dimension(1)) { - for (int edge = 0; edge < 1; edge++) { + for (int edge = 0; edge < 1; ++edge) { pdat::EdgeIndex si(*fi, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -356,9 +352,9 @@ void EdgeDataTest::setConservativeData( if (d_dim == tbox::Dimension(2)) { for (int edge = pdat::EdgeIndex::Lower; edge <= pdat::EdgeIndex::Upper; - edge++) { + ++edge) { pdat::EdgeIndex si(*fi, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -366,9 +362,9 @@ void EdgeDataTest::setConservativeData( if (d_dim == tbox::Dimension(3)) { for (int edge = pdat::EdgeIndex::LowerLeft; edge <= pdat::EdgeIndex::UpperRight; - edge++) { + ++edge) { pdat::EdgeIndex si(*fi, axis, edge); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -394,11 +390,12 @@ void EdgeDataTest::initializeDataOnPatch( if (d_do_refine) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); hier::Box dbox = edge_data->getBox(); @@ -408,11 +405,12 @@ void EdgeDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); hier::Box dbox = edge_data->getGhostBox(); @@ -431,16 +429,15 @@ void EdgeDataTest::setConstantBoundaryData( double ndimfact, double axfact) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif + int lid = bbox.getLocationIndex(); const hier::IntVector& gcw(data->getGhostCellWidth()); hier::Box fillbox = bbox.getBox(); if (bbox.getBoundaryType() == d_dim.getValue()) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (axis == 0) { if (lid % 2) { fillbox.growLower(axis, @@ -471,7 +468,7 @@ void EdgeDataTest::setConstantBoundaryData( } } else if (bbox.getBoundaryType() == 1) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (lid == 2 * axis) { fillbox.growLower(axis, tbox::MathUtilities::Max(gcw(axis) - 1, 0)); @@ -545,7 +542,7 @@ void EdgeDataTest::setConstantBoundaryData( } } - for (int id = 0; id < d_dim.getValue(); id++) { + for (int id = 0; id < d_dim.getValue(); ++id) { double value = GETVALUE(d_dim.getValue(), ndimfact, axfact); data->getArrayData(id).fillAll(value, pdat::EdgeGeometry::toEdgeBox(fillbox, id)); @@ -578,7 +575,7 @@ bool EdgeDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -595,11 +592,12 @@ bool EdgeDataTest::verifyResults( patch, hierarchy, level_number); } - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); int depth = edge_data->getDepth(); hier::Box dbox = edge_data->getGhostBox(); @@ -608,11 +606,12 @@ bool EdgeDataTest::verifyResults( setLinearData(solution, tbox, patch); } - for (int id = 0; id < d_dim.getValue(); id++) { - pdat::EdgeIterator siend(dbox, id, false); - for (pdat::EdgeIterator si(dbox, id, true); si != siend; ++si) { + for (int id = 0; id < d_dim.getValue(); ++id) { + pdat::EdgeIterator siend(pdat::EdgeGeometry::end(dbox, id)); + for (pdat::EdgeIterator si(pdat::EdgeGeometry::begin(dbox, id)); + si != siend; ++si) { double correct = (*solution)(*si); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*edge_data)(*si, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -647,13 +646,12 @@ void EdgeDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x, y, z; @@ -662,10 +660,11 @@ void EdgeDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::EdgeIndex loweri(patch.getBox().lower(), axis, 0); - pdat::EdgeIterator eiend(sbox, axis, false); - for (pdat::EdgeIterator ei(sbox, axis, true); ei != eiend; ++ei) { + pdat::EdgeIterator eiend(pdat::EdgeGeometry::end(sbox, axis)); + for (pdat::EdgeIterator ei(pdat::EdgeGeometry::begin(sbox, axis)); + ei != eiend; ++ei) { /* * Compute spatial location of cell center and @@ -693,7 +692,7 @@ void EdgeDataTest::setLinearData( } } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ei, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -708,9 +707,7 @@ void EdgeDataTest::checkPatchInteriorData( const hier::Box& interior, const boost::shared_ptr& pgeom) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); @@ -718,10 +715,11 @@ void EdgeDataTest::checkPatchInteriorData( const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::EdgeIndex loweri(interior.lower(), axis, 0); - pdat::EdgeIterator eiend(interior, axis, false); - for (pdat::EdgeIterator ei(interior, axis, true); ei != eiend; ++ei) { + pdat::EdgeIterator eiend(pdat::EdgeGeometry::end(interior, axis)); + for (pdat::EdgeIterator ei(pdat::EdgeGeometry::begin(interior, axis)); + ei != eiend; ++ei) { /* * Compute spatial location of cell center and @@ -750,7 +748,7 @@ void EdgeDataTest::checkPatchInteriorData( } double value; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; if (!(tbox::MathUtilities::equalEps((*data)(*ei, d), value))) { @@ -772,30 +770,31 @@ void EdgeDataTest::setPhysicalBoundaryConditions( NULL_USE(time); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - } - const int num_edge_bdry_boxes = d_dim > tbox::Dimension(1) ? edge_bdry.getSize() : -1; + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - } - const int num_face_bdry_boxes = d_dim == tbox::Dimension(3) ? face_bdry.getSize() : -1; + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); hier::Box patch_interior = edge_data->getBox(); checkPatchInteriorData(edge_data, patch_interior, pgeom); @@ -803,7 +802,7 @@ void EdgeDataTest::setPhysicalBoundaryConditions( /* * Set node boundary data. */ - for (int ni = 0; ni < num_node_bdry_boxes; ni++) { + for (int ni = 0; ni < num_node_bdry_boxes; ++ni) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[ni], patch.getBox(), gcw); @@ -815,7 +814,7 @@ void EdgeDataTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), gcw); @@ -828,7 +827,7 @@ void EdgeDataTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], patch.getBox(), gcw); diff --git a/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.h index cd854c10..36103218 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/EdgeDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -30,7 +29,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -196,7 +195,7 @@ class EdgeDataTest:public PatchDataTestStrategy /* * Data members specific to this edge data test. */ - tbox::Array d_use_fine_value_at_interface; + std::vector d_use_fine_value_at_interface; double d_Acoef; double d_Bcoef; @@ -208,7 +207,7 @@ class EdgeDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.C index ec9c67e1..6a36dfc0 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for face-centered patch data * ************************************************************************/ @@ -16,6 +16,7 @@ #include "SAMRAI/pdat/CellIndex.h" #include "SAMRAI/pdat/CellIterator.h" #include "CommTester.h" +#include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/pdat/FaceGeometry.h" #include "SAMRAI/pdat/FaceIndex.h" #include "SAMRAI/pdat/FaceIterator.h" @@ -25,6 +26,8 @@ #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/hier/VariableDatabase.h" +#include + namespace SAMRAI { using namespace std; @@ -39,11 +42,9 @@ FaceDataTest::FaceDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -55,7 +56,7 @@ FaceDataTest::FaceDataTest( d_refine_option = refine_option; - d_use_fine_value_at_interface.resizeArray(0); + d_use_fine_value_at_interface.resize(0); d_Acoef = 0.0; d_Bcoef = 0.0; @@ -85,24 +86,21 @@ FaceDataTest::~FaceDataTest() void FaceDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); boost::shared_ptr var_data(db->getDatabase("VariableData")); - tbox::Array var_keys = var_data->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = var_data->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_use_fine_value_at_interface.resizeArray(nkeys); + d_use_fine_value_at_interface.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db( var_data->getDatabase(var_keys[i])); @@ -145,18 +143,18 @@ void FaceDataTest::readTestInput( void FaceDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::FaceVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i], - d_use_fine_value_at_interface[i])); + d_variable_src_name[i], + d_variable_depth[i], + d_use_fine_value_at_interface[i])); if (d_do_refine) { commtest->registerVariable(d_variables[i], @@ -185,12 +183,10 @@ void FaceDataTest::setConservativeData( const boost::shared_ptr hierarchy, int level_number) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); -#endif int i, j; boost::shared_ptr level( @@ -198,8 +194,9 @@ void FaceDataTest::setConservativeData( const hier::BoxContainer& domain = level->getPhysicalDomain(hier::BlockId::zero()); - int ncells = 0; - for (hier::BoxContainer::const_iterator i(domain); i != domain.end(); ++i) { + size_t ncells = 0; + for (hier::BoxContainer::const_iterator i = domain.begin(); + i != domain.end(); ++i) { ncells += i->size(); } @@ -217,20 +214,21 @@ void FaceDataTest::setConservativeData( * u2(i,j,k) = (i + j)/ncells */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { - pdat::CellIterator ciend(sbox, false); - for (pdat::CellIterator ci(sbox, true); ci != ciend; ++ci) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sbox)); + ci != ciend; ++ci) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i != axis) { value += (double)((*ci)(i)); } } - value /= ncells; + value /= static_cast(ncells); for (int face = pdat::FaceIndex::Lower; - face <= pdat::FaceIndex::Upper; face++) { + face <= pdat::FaceIndex::Upper; ++face) { pdat::FaceIndex si(*ci, axis, face); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -251,27 +249,29 @@ void FaceDataTest::setConservativeData( const int max_ratio = ratio.max(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - int coarse_ncells = ncells; + size_t coarse_ncells = ncells; double* delta = new double[max_ratio * d_dim.getValue()]; - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { coarse_ncells /= ratio(j); double coarse_dx = dx[j] * ratio(j); - for (i = 0; i < ratio(j); i++) { + for (i = 0; i < ratio(j); ++i) { delta[j * max_ratio + i] = (i + 0.5) * dx[j] - coarse_dx * 0.5; } } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::IntVector ci(ratio.getDim()); hier::IntVector del(ratio.getDim()); - pdat::CellIterator fiend(sbox, false); - for (pdat::CellIterator fi(sbox, true); fi != fiend; ++fi) { + pdat::CellIterator fiend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator fi(pdat::CellGeometry::begin(sbox)); + fi != fiend; ++fi) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i != axis) { int findx = (*fi)(i); ci(i) = ((findx < 0) ? (findx + 1) / ratio(i) - 1 @@ -280,18 +280,18 @@ void FaceDataTest::setConservativeData( value += (double)(ci(i)); } } - value /= coarse_ncells; + value /= static_cast(coarse_ncells); - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { if (j != axis) { value += ci(j) * del(j); } } for (int face = pdat::FaceIndex::Lower; - face <= pdat::FaceIndex::Upper; face++) { + face <= pdat::FaceIndex::Upper; ++face) { pdat::FaceIndex si(*fi, axis, face); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -313,11 +313,12 @@ void FaceDataTest::initializeDataOnPatch( if (d_do_refine) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); hier::Box dbox = face_data->getBox(); @@ -326,11 +327,12 @@ void FaceDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); hier::Box dbox = face_data->getGhostBox(); @@ -348,9 +350,7 @@ void FaceDataTest::checkPatchInteriorData( const hier::Box& interior, const boost::shared_ptr& pgeom) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); @@ -358,10 +358,11 @@ void FaceDataTest::checkPatchInteriorData( const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::FaceIndex loweri(interior.lower(), axis, 0); - pdat::FaceIterator fiend(interior, axis, false); - for (pdat::FaceIterator fi(interior, axis, true); fi != fiend; ++fi) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(interior, axis)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(interior, axis)); + fi != fiend; ++fi) { /* * Compute spatial location of face and @@ -396,7 +397,7 @@ void FaceDataTest::checkPatchInteriorData( } double value; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; if (!(tbox::MathUtilities::equalEps((*data)(*fi, d), value))) { @@ -416,30 +417,31 @@ void FaceDataTest::setPhysicalBoundaryConditions( NULL_USE(time); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - } - const int num_edge_bdry_boxes = d_dim.getValue() > 1 ? edge_bdry.getSize() : -1; + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - } - const int num_face_bdry_boxes = d_dim == tbox::Dimension(3) ? face_bdry.getSize() : -1; + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); hier::Box patch_interior = face_data->getBox(); checkPatchInteriorData(face_data, patch_interior, pgeom); @@ -447,7 +449,7 @@ void FaceDataTest::setPhysicalBoundaryConditions( /* * Set node boundary data. */ - for (int ni = 0; ni < num_node_bdry_boxes; ni++) { + for (int ni = 0; ni < num_node_bdry_boxes; ++ni) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[ni], patch.getBox(), @@ -460,7 +462,7 @@ void FaceDataTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), @@ -474,7 +476,7 @@ void FaceDataTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], patch.getBox(), @@ -493,13 +495,12 @@ void FaceDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x = 0., y = 0., z = 0.; @@ -508,10 +509,11 @@ void FaceDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::FaceIndex loweri(patch.getBox().lower(), axis, 0); - pdat::FaceIterator fiend(sbox, axis, false); - for (pdat::FaceIterator fi(sbox, axis, true); fi != fiend; ++fi) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(sbox, axis)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(sbox, axis)); + fi != fiend; ++fi) { /* * Compute spatial location of cell center and @@ -545,7 +547,7 @@ void FaceDataTest::setLinearData( } } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*fi, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -577,7 +579,7 @@ bool FaceDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -594,11 +596,12 @@ bool FaceDataTest::verifyResults( patch, hierarchy, level_number); } - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); int depth = face_data->getDepth(); hier::Box dbox = face_data->getGhostBox(); @@ -606,11 +609,12 @@ bool FaceDataTest::verifyResults( setLinearData(solution, tbox, patch); } - for (int id = 0; id < d_dim.getValue(); id++) { - pdat::FaceIterator siend(dbox, id, false); - for (pdat::FaceIterator si(dbox, id, true); si != siend; ++si) { + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { + pdat::FaceIterator siend(pdat::FaceGeometry::end(dbox, id)); + for (pdat::FaceIterator si(pdat::FaceGeometry::begin(dbox, id)); + si != siend; ++si) { double correct = (*solution)(*si); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*face_data)(*si, d); if (!tbox::MathUtilities::equalEps(correct, result)) { diff --git a/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.h index 365edffa..c96fc677 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/FaceDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for face-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -31,7 +30,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -170,7 +169,7 @@ class FaceDataTest:public PatchDataTestStrategy /* * Data members specific to this face data test. */ - tbox::Array d_use_fine_value_at_interface; + std::vector d_use_fine_value_at_interface; double d_Acoef; double d_Bcoef; @@ -182,7 +181,7 @@ class FaceDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/communication/Makefile.depend index 9a08a30a..000ec1d5 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/communication/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -49,12 +49,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -74,7 +76,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -88,8 +89,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -110,10 +111,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CellDataTest.C \ CellDataTest.h CommTester.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -122,12 +123,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=CommTester.o DEPENDS_1:=\ @@ -144,6 +144,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -155,6 +156,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ @@ -168,18 +171,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -187,11 +189,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -205,12 +208,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -220,9 +223,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -245,13 +249,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.C \ CommTester.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -259,12 +261,11 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=EdgeDataTest.o DEPENDS_2:=\ @@ -304,12 +305,14 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -336,7 +339,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -350,8 +352,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -372,10 +374,10 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ EdgeDataTest.C EdgeDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -386,12 +388,11 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=FaceDataTest.o DEPENDS_3:=\ @@ -431,12 +432,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -463,7 +466,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -477,8 +479,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -499,10 +501,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ FaceDataTest.C FaceDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -513,12 +515,11 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=NodeDataTest.o DEPENDS_4:=\ @@ -558,12 +559,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -586,7 +589,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -600,8 +602,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -622,10 +624,10 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ NodeDataTest.C NodeDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -636,12 +638,11 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=OuterfaceDataTest.o DEPENDS_5:=\ @@ -681,12 +682,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -711,7 +714,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -725,8 +727,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -747,10 +749,10 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ OuterfaceDataTest.C OuterfaceDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -762,12 +764,11 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} + +${FILE_5}: ${DEPENDS_5} FILE_6=OuternodeDataTest.o DEPENDS_6:=\ @@ -807,12 +808,14 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -836,7 +839,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -850,8 +852,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -872,10 +874,10 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ OuternodeDataTest.C OuternodeDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -887,12 +889,11 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} + +${FILE_6}: ${DEPENDS_6} FILE_7=OutersideDataTest.o DEPENDS_7:=\ @@ -932,12 +933,14 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -962,7 +965,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -976,8 +978,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -998,10 +1000,10 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ OutersideDataTest.C OutersideDataTest.h PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -1013,12 +1015,11 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} + +${FILE_7}: ${DEPENDS_7} FILE_8=PatchDataTestStrategy.o DEPENDS_8:=\ @@ -1055,12 +1056,14 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1074,7 +1077,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1086,8 +1088,8 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1097,118 +1099,19 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h PatchDataTestStrategy.C \ PatchDataTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=Pointer-CommTester.o -DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ - PatchDataTestStrategy.h Pointer-CommTester.C +${FILE_8}: ${DEPENDS_8} -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} - -FILE_10=SideDataTest.o -DEPENDS_10:=\ +FILE_9=SideDataTest.o +DEPENDS_9:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1245,12 +1148,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1277,7 +1182,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1291,8 +1195,8 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1313,11 +1217,11 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CommTester.h \ PatchDataTestStrategy.h SideDataTest.C SideDataTest.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ +DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -1327,71 +1231,14 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=VisItDerivedData.o -DEPENDS_11:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h VisItDerivedData.C \ - VisItDerivedData.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif +${FILE_9}: ${DEPENDS_9} -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} - -FILE_12=main.o -DEPENDS_12:=\ +FILE_10=main.o +DEPENDS_10:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ @@ -1431,12 +1278,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1477,7 +1326,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1495,8 +1343,8 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1517,13 +1365,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CellDataTest.h \ - CommTester.h EdgeDataTest.h FaceDataTest.h NodeDataTest.h \ - OuterfaceDataTest.h OuternodeDataTest.h OutersideDataTest.h \ - PatchDataTestStrategy.h SideDataTest.h VisItDerivedData.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/DerivedVisOwnerData.h CellDataTest.h CommTester.h \ + EdgeDataTest.h FaceDataTest.h NodeDataTest.h OuterfaceDataTest.h\ + OuternodeDataTest.h OutersideDataTest.h PatchDataTestStrategy.h \ + SideDataTest.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ +DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -1536,10 +1385,9 @@ DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} + +${FILE_10}: ${DEPENDS_10} diff --git a/base/SAMRAI/SAMRAI/source/test/communication/Makefile.in b/base/SAMRAI/SAMRAI/source/test/communication/Makefile.in index f61aa30f..349f0eff 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/communication/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI communication tests ## ######################################################################### @@ -14,22 +14,25 @@ SUBDIR = source/test/communication VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 NUM_TESTS = 56 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = \ CommTester.o \ PatchDataTestStrategy.o \ main.o \ - VisItDerivedData.o \ CellDataTest.o \ EdgeDataTest.o \ FaceDataTest.o \ @@ -37,43 +40,66 @@ CXX_OBJS = \ OuterfaceDataTest.o \ OuternodeDataTest.o \ OutersideDataTest.o \ - Pointer-CommTester.o \ SideDataTest.o -main: $(CXX_OBJS) $(LIBSAMRAI) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ +main: $(CXX_OBJS) $(LIBSAMRAI) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): + check: $(MAKE) check2d $(MAKE) check3d check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: clean-check +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main - $(RM) -rf *visit include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.C index a7c591d3..849d8761 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -23,6 +23,8 @@ #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableDatabase.h" +#include + namespace SAMRAI { using namespace std; @@ -37,11 +39,9 @@ NodeDataTest::NodeDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -81,9 +81,7 @@ NodeDataTest::~NodeDataTest() void NodeDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Read coeeficients of linear profile to test interpolation. @@ -118,25 +116,22 @@ void NodeDataTest::readTestInput( */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); } void NodeDataTest::registerVariables( CommTester* commtest) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(commtest != (CommTester *)NULL); -#endif + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::NodeVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); if (d_do_refine) { commtest->registerVariable(d_variables[i], @@ -163,13 +158,12 @@ void NodeDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const pdat::NodeIndex loweri( patch.getBox().lower(), (pdat::NodeIndex::Corner)0); const double* dx = pgeom->getDx(); @@ -180,8 +174,9 @@ void NodeDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - pdat::NodeIterator ciend(sbox, false); - for (pdat::NodeIterator ci(sbox, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(sbox)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(sbox)); + ci != ciend; ++ci) { /* * Compute spatial location of node center and @@ -197,7 +192,7 @@ void NodeDataTest::setLinearData( z = lowerx[2] + dx[2] * ((*ci)(2) - loweri(2)); } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ci, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -210,9 +205,8 @@ void NodeDataTest::setPeriodicData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif + NULL_USE(patch); const double* xlo = d_cart_grid_geometry->getXLower(); @@ -223,16 +217,18 @@ void NodeDataTest::setPeriodicData( } const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const int depth = data->getDepth(); const hier::Box sbox = data->getGhostBox() * box; - pdat::NodeIterator niend(sbox, false); - for (pdat::NodeIterator ni(sbox, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(sbox)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(sbox)); + ni != niend; ++ni) { double val = 1.0; for (int d = 0; d < d_dim.getValue(); ++d) { @@ -241,7 +237,7 @@ void NodeDataTest::setPeriodicData( val *= tmpf; } val = val + 20.0; // Shift function range to [1,3] to avoid bad floating point compares. - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ni, d) = val; } @@ -265,11 +261,12 @@ void NodeDataTest::initializeDataOnPatch( if (d_do_refine) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); hier::Box dbox = node_data->getBox(); @@ -283,11 +280,12 @@ void NodeDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); hier::Box dbox = node_data->getGhostBox(); @@ -308,9 +306,7 @@ void NodeDataTest::checkPatchInteriorData( const hier::Box& interior, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const bool is_periodic = d_cart_grid_geometry->getPeriodicShift(hier::IntVector(d_dim, @@ -329,9 +325,10 @@ void NodeDataTest::checkPatchInteriorData( setLinearData(correct_data, correct_data->getGhostBox(), patch); } - pdat::NodeIterator niend(interior, false); - for (pdat::NodeIterator ni(interior, true); ni != niend; ++ni) { - for (int d = 0; d < depth; d++) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(interior)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(interior)); + ni != niend; ++ni) { + for (int d = 0; d < depth; ++d) { if (!(tbox::MathUtilities::equalEps((*data)(*ni, d), (*correct_data)(*ni, d)))) { tbox::perr << "FAILED: -- patch interior not properly filled" @@ -354,30 +351,31 @@ void NodeDataTest::setPhysicalBoundaryConditions( bool is_periodic = periodic_shift.max() > 0; boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - } - const int num_edge_bdry_boxes = d_dim > tbox::Dimension(1) ? edge_bdry.getSize() : -1; + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - } - const int num_face_bdry_boxes = d_dim == tbox::Dimension(3) ? face_bdry.getSize() : -1; + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); hier::Box patch_interior = node_data->getBox(); checkPatchInteriorData(node_data, patch_interior, patch); @@ -385,7 +383,7 @@ void NodeDataTest::setPhysicalBoundaryConditions( /* * Set node boundary data. */ - for (int ni = 0; ni < num_node_bdry_boxes; ni++) { + for (int ni = 0; ni < num_node_bdry_boxes; ++ni) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[ni], patch.getBox(), @@ -402,7 +400,7 @@ void NodeDataTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), @@ -420,7 +418,7 @@ void NodeDataTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], patch.getBox(), @@ -466,7 +464,7 @@ bool NodeDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(periodic_shift.getDim(), 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -492,18 +490,20 @@ bool NodeDataTest::verifyResults( } } - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); int depth = node_data->getDepth(); hier::Box dbox = node_data->getGhostBox(); - pdat::NodeIterator ciend(dbox, false); - for (pdat::NodeIterator ci(dbox, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(dbox)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(dbox)); + ci != ciend; ++ci) { double correct = (*solution)(*ci); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*node_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { tbox::perr << "Test FAILED: ...." diff --git a/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.h index 75539393..fda83566 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/NodeDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -29,7 +28,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -181,7 +180,7 @@ class NodeDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.C index 66a51918..261c21e5 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for outerface-centered patch data * ************************************************************************/ @@ -40,11 +40,9 @@ OuterfaceDataTest::OuterfaceDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -56,7 +54,7 @@ OuterfaceDataTest::OuterfaceDataTest( d_refine_option = refine_option; - d_use_fine_value_at_interface.resizeArray(0); + d_use_fine_value_at_interface.resize(0); d_Acoef = 0.0; d_Bcoef = 0.0; @@ -86,25 +84,22 @@ OuterfaceDataTest::~OuterfaceDataTest() void OuterfaceDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); boost::shared_ptr var_data( db->getDatabase("VariableData")); - tbox::Array var_keys = var_data->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = var_data->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_use_fine_value_at_interface.resizeArray(nkeys); + d_use_fine_value_at_interface.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db( var_data->getDatabase(var_keys[i])); @@ -147,26 +142,33 @@ void OuterfaceDataTest::readTestInput( void OuterfaceDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - const tbox::Dimension dim(d_dim); + int nvars = static_cast(d_variable_src_name.size()); - int nvars = d_variable_src_name.getSize(); + d_variables_src.resize(nvars); + d_variables_dst.resize(nvars); - d_variables_src.resizeArray(nvars); - d_variables_dst.resizeArray(nvars); - - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables_src[i].reset( - new pdat::OuterfaceVariable(dim, - d_variable_src_name[i], - d_variable_depth[i])); - - d_variables_dst[i].reset( - new pdat::FaceVariable(dim, - d_variable_dst_name[i], - d_variable_depth[i], - d_use_fine_value_at_interface[i])); + new pdat::OuterfaceVariable(d_dim, + d_variable_src_name[i], + d_variable_depth[i])); + + if (i % 2 == 0) { + d_variables_dst[i].reset( + new pdat::FaceVariable( + d_dim, + d_variable_dst_name[i], + d_variable_depth[i], + d_use_fine_value_at_interface[i])); + } else { + d_variables_dst[i].reset( + new pdat::OuterfaceVariable( + d_dim, + d_variable_dst_name[i], + d_variable_depth[i])); + } if (d_do_refine) { commtest->registerVariable(d_variables_src[i], @@ -199,12 +201,12 @@ void OuterfaceDataTest::initializeDataOnPatch( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); variable_db->printClassData(); - tbox::Array >& variables( + std::vector >& variables( src_or_dst == 's' ? d_variables_src : d_variables_dst); if (d_do_refine) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); @@ -212,11 +214,11 @@ void OuterfaceDataTest::initializeDataOnPatch( TBOX_ASSERT(data); boost::shared_ptr > oface_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > face_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getBox(); @@ -231,7 +233,7 @@ void OuterfaceDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); @@ -239,11 +241,11 @@ void OuterfaceDataTest::initializeDataOnPatch( TBOX_ASSERT(data); boost::shared_ptr > oface_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > face_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getGhostBox(); @@ -265,9 +267,7 @@ void OuterfaceDataTest::checkPatchInteriorData( const hier::Box& interior, const boost::shared_ptr& pgeom) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); @@ -275,10 +275,11 @@ void OuterfaceDataTest::checkPatchInteriorData( const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::FaceIndex loweri(interior.lower(), axis, 0); - pdat::FaceIterator fiend(interior, axis, false); - for (pdat::FaceIterator fi(interior, axis, true); fi != fiend; ++fi) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(interior, axis)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(interior, axis)); + fi != fiend; ++fi) { /* * Compute spatial location of face and @@ -313,7 +314,7 @@ void OuterfaceDataTest::checkPatchInteriorData( } double value; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; if (!(tbox::MathUtilities::equalEps((*data)(*fi, d), value))) { @@ -340,13 +341,12 @@ void OuterfaceDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x = 0., y = 0., z = 0.; @@ -355,10 +355,11 @@ void OuterfaceDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::FaceIndex loweri(patch.getBox().lower(), axis, 0); - pdat::FaceIterator fiend(sbox, axis, false); - for (pdat::FaceIterator fi(sbox, axis, true); fi != fiend; ++fi) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(sbox, axis)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(sbox, axis)); + fi != fiend; ++fi) { /* * Compute spatial location of cell center and @@ -392,7 +393,7 @@ void OuterfaceDataTest::setLinearData( } } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*fi, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -409,26 +410,25 @@ void OuterfaceDataTest::setLinearData( { NULL_USE(box); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x = 0., y = 0., z = 0.; const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - for (int f = 0; f < 2; f++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + for (int f = 0; f < 2; ++f) { const hier::Box databox = data->getArrayData(axis, f).getBox(); const pdat::FaceIndex loweri(patch.getBox().lower(), axis, 0); - hier::Box::iterator biend(databox, false); - for (hier::Box::iterator bi(databox, true); bi != biend; ++bi) { + hier::Box::iterator biend(databox.end()); + for (hier::Box::iterator bi(databox.begin()); bi != biend; ++bi) { /* * Compute spatial location of cell center and @@ -463,7 +463,7 @@ void OuterfaceDataTest::setLinearData( } double value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { data->getArrayData(axis, f) (*bi, d) = value; } } @@ -494,7 +494,7 @@ bool OuterfaceDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { tgcw.max(patch.getPatchData(d_variables_dst[i], getDataContext())-> getGhostCellWidth()); } @@ -512,35 +512,91 @@ bool OuterfaceDataTest::verifyResults( setLinearData(solution, tbox, patch); //, hierarchy, level_number); } - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { + + if (i % 2 == 0) { + boost::shared_ptr > face_data( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables_dst[i], getDataContext()))); + TBOX_ASSERT(face_data); + int depth = face_data->getDepth(); + hier::Box dbox = face_data->getGhostBox(); + + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(dbox, id)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(dbox, id)); + fi != fiend; ++fi) { + double correct = (*solution)(*fi); + for (int d = 0; d < depth; ++d) { + double result = (*face_data)(*fi, d); + if (!tbox::MathUtilities::equalEps(correct, + result)) { + tbox::perr << "Test FAILED: ...." + << " : face_data index = " << *fi << endl; + tbox::perr << " hier::Variable = " + << d_variable_src_name[i] + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } + } + } + } + } else { + boost::shared_ptr > oface_data( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables_dst[i], getDataContext()))); + TBOX_ASSERT(oface_data); + int depth = oface_data->getDepth(); + hier::Box dbox = oface_data->getGhostBox(); + + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { + hier::Box dbox_lo(dbox); + dbox_lo.setUpper(id, dbox_lo.lower(id)); + hier::BoxIterator loend(dbox_lo.end()); + for (hier::BoxIterator si(dbox_lo.begin()); si != loend; ++si) { + pdat::FaceIndex fndx(*si, id, 0); + double correct = (*solution)(fndx); + for (int d = 0; d < depth; ++d) { + double result = (*oface_data)(fndx, 0, d); + if (!tbox::MathUtilities::equalEps(correct, + result)) { + tbox::perr << "Test FAILED: ...." + << " : oface_data index = " << fndx << endl; + tbox::perr << " hier::Variable = " + << d_variable_src_name[i] + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } + } + } - boost::shared_ptr > face_data( - patch.getPatchData(d_variables_dst[i], getDataContext()), - boost::detail::dynamic_cast_tag()); - int depth = face_data->getDepth(); - hier::Box dbox = face_data->getGhostBox(); - - for (int id = 0; id < d_dim.getValue(); id++) { - pdat::FaceIterator fiend(dbox, id, false); - for (pdat::FaceIterator fi(dbox, id, true); fi != fiend; ++fi) { - double correct = (*solution)(*fi); - for (int d = 0; d < depth; d++) { - double result = (*face_data)(*fi, d); - if (!tbox::MathUtilities::equalEps(correct, - result)) { - tbox::perr << "Test FAILED: ...." - << " : face_data index = " << *fi << endl; - tbox::perr << " hier::Variable = " - << d_variable_src_name[i] - << " : depth index = " << d << endl; - tbox::perr << " result = " << result - << " : correct = " << correct << endl; - test_failed = true; + hier::Box dbox_hi(dbox); + dbox_hi.setLower(id, dbox_hi.upper(id)); + hier::BoxIterator hiend(dbox_hi.end()); + for (hier::BoxIterator si(dbox_hi.begin()); si != hiend; ++si) { + pdat::FaceIndex fndx(*si, id, 1); + double correct = (*solution)(fndx); + for (int d = 0; d < depth; ++d) { + double result = (*oface_data)(fndx, 1, d); + if (!tbox::MathUtilities::equalEps(correct, + result)) { + tbox::perr << "Test FAILED: ...." + << " : oface_data index = " << fndx << endl; + tbox::perr << " hier::Variable = " + << d_variable_src_name[i] + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } } } } } - } if (!test_failed) { tbox::plog << "Outerface test Successful!" << endl; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.h index 89bf815b..325bd3df 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/OuterfaceDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for outerface-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -32,7 +31,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -163,7 +162,7 @@ class OuterfaceDataTest:public PatchDataTestStrategy */ boost::shared_ptr d_cart_grid_geometry; - tbox::Array d_use_fine_value_at_interface; + std::vector d_use_fine_value_at_interface; double d_Acoef; double d_Bcoef; @@ -175,8 +174,8 @@ class OuterfaceDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables_src; - tbox::Array > d_variables_dst; + std::vector > d_variables_src; + std::vector > d_variables_dst; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.C index 36cf15d6..b7a2d129 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -39,11 +39,9 @@ OuternodeDataTest::OuternodeDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -91,9 +89,7 @@ OuternodeDataTest::~OuternodeDataTest() void OuternodeDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Read coeeficients of linear profile to test interpolation. @@ -128,20 +124,19 @@ void OuternodeDataTest::readTestInput( */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); } void OuternodeDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables_src.resizeArray(nvars); - d_variables_dst.resizeArray(nvars); + d_variables_src.resize(nvars); + d_variables_dst.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables_src[i].reset( new pdat::OuternodeVariable( d_dim, @@ -178,13 +173,12 @@ void OuternodeDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const pdat::NodeIndex loweri( patch.getBox().lower(), (pdat::NodeIndex::Corner)0); const double* dx = pgeom->getDx(); @@ -195,8 +189,9 @@ void OuternodeDataTest::setLinearData( const hier::Box sbox = data->getGhostBox() * box; - pdat::NodeIterator ciend(sbox, false); - for (pdat::NodeIterator ci(sbox, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(sbox)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(sbox)); + ci != ciend; ++ci) { /* * Compute spatial location of node center and @@ -212,7 +207,7 @@ void OuternodeDataTest::setLinearData( z = lowerx[2] + dx[2] * ((*ci)(2) - loweri(2)); } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ci, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -227,9 +222,9 @@ void OuternodeDataTest::setLinearData( { NULL_USE(box); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); TBOX_ASSERT(box.isSpatiallyEqual(patch.getBox())); +#ifdef DEBUG_CHECK_ASSERTIONS if (!box.isSpatiallyEqual(data->getBox())) { TBOX_ERROR("Box is not identical to data box, which is\n" << "required for testing Outernode communication."); @@ -237,8 +232,9 @@ void OuternodeDataTest::setLinearData( #endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const pdat::NodeIndex loweri( patch.getBox().lower(), (pdat::NodeIndex::Corner)0); const double* dx = pgeom->getDx(); @@ -247,12 +243,11 @@ void OuternodeDataTest::setLinearData( const int depth = data->getDepth(); - int n, s; - for (n = 0; n < d_dim.getValue(); ++n) { - for (s = 0; s < 2; ++s) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { + for (int s = 0; s < 2; ++s) { const hier::Box databox = data->getDataBox(n, s); - hier::Box::iterator biend(databox, false); - for (hier::Box::iterator bi(databox, true); bi != biend; ++bi) { + hier::Box::iterator biend(databox.end()); + for (hier::Box::iterator bi(databox.begin()); bi != biend; ++bi) { /* * Compute spatial location of node center and @@ -269,7 +264,7 @@ void OuternodeDataTest::setLinearData( } pdat::NodeIndex ni(*bi, (pdat::NodeIndex::Corner)0); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(ni, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -290,23 +285,23 @@ void OuternodeDataTest::initializeDataOnPatch( NULL_USE(level_number); hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); variable_db->printClassData(); - tbox::Array >& variables( + std::vector >& variables( src_or_dst == 's' ? d_variables_src : d_variables_dst); if (d_do_refine) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); TBOX_ASSERT(data); boost::shared_ptr > onode_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > node_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getBox(); @@ -321,17 +316,17 @@ void OuternodeDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); TBOX_ASSERT(data); boost::shared_ptr > onode_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > node_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getGhostBox(); @@ -353,9 +348,7 @@ void OuternodeDataTest::checkPatchInteriorData( const hier::Box& interior, const boost::shared_ptr& pgeom) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const pdat::NodeIndex loweri(interior.lower(), (pdat::NodeIndex::Corner)0); const double* dx = pgeom->getDx(); @@ -364,8 +357,9 @@ void OuternodeDataTest::checkPatchInteriorData( const int depth = data->getDepth(); - pdat::NodeIterator ciend(interior, false); - for (pdat::NodeIterator ci(interior, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(interior)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(interior)); + ci != ciend; ++ci) { /* * Compute spatial location of edge and @@ -382,7 +376,7 @@ void OuternodeDataTest::checkPatchInteriorData( } double value; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; if (!(tbox::MathUtilities::equalEps((*data)(*ci, d), value))) { @@ -430,7 +424,7 @@ bool OuternodeDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { tgcw.max(patch.getPatchData(d_variables_dst[i], getDataContext())-> getGhostCellWidth()); } @@ -449,18 +443,20 @@ bool OuternodeDataTest::verifyResults( patch); //, hierarchy, level_number); } - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables_dst[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables_dst[i], getDataContext()))); + TBOX_ASSERT(node_data); int depth = node_data->getDepth(); hier::Box dbox = node_data->getGhostBox(); - pdat::NodeIterator ciend(dbox, false); - for (pdat::NodeIterator ci(dbox, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(dbox)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(dbox)); + ci != ciend; ++ci) { double correct = (*solution)(*ci); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*node_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { tbox::perr << "Test FAILED: ...." diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.h index 793367c7..b2098c5e 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/OuternodeDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -30,7 +29,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -181,8 +180,8 @@ class OuternodeDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables_src; - tbox::Array > d_variables_dst; + std::vector > d_variables_src; + std::vector > d_variables_dst; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.C index 35b8740d..a6aface3 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for outerside-centered patch data * ************************************************************************/ @@ -40,11 +40,9 @@ OutersideDataTest::OutersideDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -64,7 +62,7 @@ OutersideDataTest::OutersideDataTest( d_refine_option = refine_option; - d_use_fine_value_at_interface.resizeArray(0); + d_use_fine_value_at_interface.resize(0); d_Acoef = 0.0; d_Bcoef = 0.0; @@ -93,24 +91,20 @@ OutersideDataTest::~OutersideDataTest() void OutersideDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif - /* * Base class reads variable parameters and boxes to refine. */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); boost::shared_ptr var_data(db->getDatabase("VariableData")); - tbox::Array var_keys = var_data->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = var_data->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_use_fine_value_at_interface.resizeArray(nkeys); + d_use_fine_value_at_interface.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db( var_data->getDatabase(var_keys[i])); @@ -153,26 +147,34 @@ void OutersideDataTest::readTestInput( void OutersideDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables_src.resizeArray(nvars); - d_variables_dst.resizeArray(nvars); + d_variables_src.resize(nvars); + d_variables_dst.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables_src[i].reset( new pdat::OutersideVariable( d_dim, d_variable_src_name[i], d_variable_depth[i])); - d_variables_dst[i].reset( - new pdat::SideVariable( - d_dim, - d_variable_dst_name[i], - d_variable_depth[i], - d_use_fine_value_at_interface[i])); - + if (i % 2 == 0) { + d_variables_dst[i].reset( + new pdat::SideVariable( + d_dim, + d_variable_dst_name[i], + hier::IntVector::getOne(d_dim), + d_variable_depth[i], + d_use_fine_value_at_interface[i])); + } else { + d_variables_dst[i].reset( + new pdat::OutersideVariable( + d_dim, + d_variable_dst_name[i], + d_variable_depth[i])); + } if (d_do_refine) { commtest->registerVariable(d_variables_src[i], d_variables_dst[i], @@ -204,12 +206,12 @@ void OutersideDataTest::initializeDataOnPatch( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); variable_db->printClassData(); - tbox::Array >& variables( + std::vector >& variables( src_or_dst == 's' ? d_variables_src : d_variables_dst); if (d_do_refine) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); @@ -217,11 +219,11 @@ void OutersideDataTest::initializeDataOnPatch( TBOX_ASSERT(data); boost::shared_ptr > oside_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > side_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getBox(); @@ -236,7 +238,7 @@ void OutersideDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < variables.getSize(); i++) { + for (int i = 0; i < static_cast(variables.size()); ++i) { boost::shared_ptr data( patch.getPatchData(variables[i], getDataContext())); @@ -244,11 +246,11 @@ void OutersideDataTest::initializeDataOnPatch( TBOX_ASSERT(data); boost::shared_ptr > oside_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); boost::shared_ptr > side_data( - data, - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast, + hier::PatchData>(data)); hier::Box dbox = data->getGhostBox(); @@ -269,9 +271,7 @@ void OutersideDataTest::checkPatchInteriorData( const hier::Box& interior, const boost::shared_ptr& pgeom) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); @@ -279,10 +279,11 @@ void OutersideDataTest::checkPatchInteriorData( const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { const pdat::SideIndex loweri(interior.lower(), axis, 0); - pdat::SideIterator siend(interior, axis, false); - for (pdat::SideIterator si(interior, axis, true); si != siend; ++si) { + pdat::SideIterator siend(pdat::SideGeometry::end(interior, axis)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(interior, axis)); + si != siend; ++si) { /* * Compute spatial location of face and @@ -311,7 +312,7 @@ void OutersideDataTest::checkPatchInteriorData( } double value; - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; if (!(tbox::MathUtilities::equalEps((*data)(*si, @@ -341,13 +342,12 @@ void OutersideDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x, y, z; @@ -358,11 +358,12 @@ void OutersideDataTest::setLinearData( hier::IntVector directions(data->getDirectionVector()); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { const pdat::SideIndex loweri(patch.getBox().lower(), axis, 0); - pdat::SideIterator eiend(sbox, axis, false); - for (pdat::SideIterator ei(sbox, axis, true); ei != eiend; ++ei) { + pdat::SideIterator eiend(pdat::SideGeometry::end(sbox, axis)); + for (pdat::SideIterator ei(pdat::SideGeometry::begin(sbox, axis)); + ei != eiend; ++ei) { /* * Compute spatial location of cell center and @@ -390,7 +391,7 @@ void OutersideDataTest::setLinearData( } } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ei, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -407,25 +408,24 @@ void OutersideDataTest::setLinearData( { NULL_USE(box); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x = 0., y = 0., z = 0.; const int depth = data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - for (int s = 0; s < 2; s++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + for (int s = 0; s < 2; ++s) { const hier::Box databox = data->getArrayData(axis, s).getBox(); const pdat::SideIndex loweri(patch.getBox().lower(), axis, 0); - hier::Box::iterator biend(databox, false); - for (hier::Box::iterator bi(databox, true); bi != biend; ++bi) { + hier::Box::iterator biend(databox.end()); + for (hier::Box::iterator bi(databox.begin()); bi != biend; ++bi) { /* * Compute spatial location of cell center and @@ -455,7 +455,7 @@ void OutersideDataTest::setLinearData( double value = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; pdat::SideIndex si(*bi, axis, 0); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, s, d) = value; } } @@ -487,7 +487,7 @@ bool OutersideDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { tgcw.max(patch.getPatchData(d_variables_dst[i], getDataContext())-> getGhostCellWidth()); } @@ -505,28 +505,84 @@ bool OutersideDataTest::verifyResults( setLinearData(solution, tbox, patch); //, hierarchy, level_number); } - for (int i = 0; i < d_variables_dst.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables_dst.size()); ++i) { + + if (i % 2 == 0) { + boost::shared_ptr > side_data( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables_dst[i], getDataContext()))); + TBOX_ASSERT(side_data); + int depth = side_data->getDepth(); + hier::Box dbox = side_data->getGhostBox(); + + hier::IntVector directions(side_data->getDirectionVector()); + + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { + if (directions(id)) { + pdat::SideIterator siend(pdat::SideGeometry::end(dbox, id)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(dbox, id)); + si != siend; ++si) { + double correct = (*solution)(*si); + for (int d = 0; d < depth; ++d) { + double result = (*side_data)(*si, d); + if (!tbox::MathUtilities::equalEps(correct, + result)) { + tbox::perr << "Test FAILED: ...." + << " : side_data index = " << *si << endl; + tbox::perr << " hier::Variable = " + << d_variable_src_name[i] + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } + } + } + } + } + } else { + boost::shared_ptr > oside_data( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables_dst[i], getDataContext()))); + TBOX_ASSERT(oside_data); + int depth = oside_data->getDepth(); + hier::Box dbox = oside_data->getGhostBox(); + + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { + hier::Box dbox_lo(dbox); + dbox_lo.setUpper(id, dbox_lo.lower(id)); + hier::BoxIterator loend(dbox_lo.end()); + for (hier::BoxIterator si(dbox_lo.begin()); si != loend; ++si) { + pdat::SideIndex sndx(*si, id, 0); + double correct = (*solution)(sndx); + for (int d = 0; d < depth; ++d) { + double result = (*oside_data)(sndx, 0, d); + if (!tbox::MathUtilities::equalEps(correct, + result)) { + tbox::perr << "Test FAILED: ...." + << " : oside_data index = " << sndx << endl; + tbox::perr << " hier::Variable = " + << d_variable_src_name[i] + << " : depth index = " << d << endl; + tbox::perr << " result = " << result + << " : correct = " << correct << endl; + test_failed = true; + } + } + } - boost::shared_ptr > side_data( - patch.getPatchData(d_variables_dst[i], getDataContext()), - boost::detail::dynamic_cast_tag()); - int depth = side_data->getDepth(); - hier::Box dbox = side_data->getGhostBox(); - - hier::IntVector directions(side_data->getDirectionVector()); - - for (int id = 0; id < d_dim.getValue(); id++) { - if (directions(id)) { - pdat::SideIterator siend(dbox, id, false); - for (pdat::SideIterator si(dbox, id, true); - si != siend; ++si) { - double correct = (*solution)(*si); - for (int d = 0; d < depth; d++) { - double result = (*side_data)(*si, d); + hier::Box dbox_hi(dbox); + dbox_hi.setLower(id, dbox_hi.upper(id)); + hier::BoxIterator hiend(dbox_hi.end()); + for (hier::BoxIterator si(dbox_hi.begin()); si != hiend; ++si) { + pdat::SideIndex sndx(*si, id, 1); + double correct = (*solution)(sndx); + for (int d = 0; d < depth; ++d) { + double result = (*oside_data)(sndx, 1, d); if (!tbox::MathUtilities::equalEps(correct, result)) { tbox::perr << "Test FAILED: ...." - << " : side_data index = " << *si << endl; + << " : oside_data index = " << sndx << endl; tbox::perr << " hier::Variable = " << d_variable_src_name[i] << " : depth index = " << d << endl; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.h index 2adc0bc7..6a7ad6fc 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/OutersideDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for outerside-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -32,7 +31,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -163,7 +162,7 @@ class OutersideDataTest:public PatchDataTestStrategy */ boost::shared_ptr d_cart_grid_geometry; - tbox::Array d_use_fine_value_at_interface; + std::vector d_use_fine_value_at_interface; double d_Acoef; double d_Bcoef; @@ -175,8 +174,8 @@ class OutersideDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables_src; - tbox::Array > d_variables_dst; + std::vector > d_variables_src; + std::vector > d_variables_dst; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.C b/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.C index 6bf5b19d..e53e6807 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for patch data test operations. * ************************************************************************/ @@ -15,6 +15,8 @@ #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Utilities.h" +#include + namespace SAMRAI { using namespace std; @@ -39,13 +41,13 @@ PatchDataTestStrategy::PatchDataTestStrategy( const tbox::Dimension& dim): d_dim(dim) { - d_variable_src_name.resizeArray(0); - d_variable_dst_name.resizeArray(0); - d_variable_depth.resizeArray(0); - d_variable_src_ghosts.resizeArray(0, hier::IntVector(d_dim)); - d_variable_dst_ghosts.resizeArray(0, hier::IntVector(d_dim)); - d_variable_coarsen_op.resizeArray(0); - d_variable_refine_op.resizeArray(0); + d_variable_src_name.resize(0); + d_variable_dst_name.resize(0); + d_variable_depth.resize(0); + d_variable_src_ghosts.resize(0, hier::IntVector(d_dim)); + d_variable_dst_ghosts.resize(0, hier::IntVector(d_dim)); + d_variable_coarsen_op.resize(0); + d_variable_refine_op.resize(0); } PatchDataTestStrategy::~PatchDataTestStrategy() @@ -63,22 +65,20 @@ PatchDataTestStrategy::~PatchDataTestStrategy() void PatchDataTestStrategy::readVariableInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif - tbox::Array var_keys = db->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = db->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_variable_src_name.resizeArray(nkeys); - d_variable_dst_name.resizeArray(nkeys); - d_variable_depth.resizeArray(nkeys); - d_variable_src_ghosts.resizeArray(nkeys, hier::IntVector(d_dim, 0)); - d_variable_dst_ghosts.resizeArray(nkeys, hier::IntVector(d_dim, 0)); - d_variable_coarsen_op.resizeArray(nkeys); - d_variable_refine_op.resizeArray(nkeys); + d_variable_src_name.resize(nkeys); + d_variable_dst_name.resize(nkeys); + d_variable_depth.resize(nkeys); + d_variable_src_ghosts.resize(nkeys, hier::IntVector(d_dim, 0)); + d_variable_dst_ghosts.resize(nkeys, hier::IntVector(d_dim, 0)); + d_variable_coarsen_op.resize(nkeys); + d_variable_refine_op.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db(db->getDatabase(var_keys[i])); @@ -128,23 +128,6 @@ void PatchDataTestStrategy::readVariableInput( } -void PatchDataTestStrategy::readRefinementInput( - boost::shared_ptr db) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - tbox::Array box_keys = db->getAllKeys(); - int nkeys = box_keys.getSize(); - - d_refine_level_boxes.resizeArray(nkeys); - for (int i = 0; i < nkeys; i++) { - d_refine_level_boxes[i] = db->getDatabaseBoxArray(box_keys[i]); - } - -} - /* ************************************************************************* * diff --git a/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.h b/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.h index 0a83d648..9274b73f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/PatchDataTestStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for patch data test operations. * ************************************************************************/ @@ -19,10 +19,9 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -108,9 +107,7 @@ class PatchDataTestStrategy void setGridGeometry( boost::shared_ptr grid_geom) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(grid_geom); -#endif d_grid_geometry = grid_geom; } @@ -126,9 +123,7 @@ class PatchDataTestStrategy void setDataContext( boost::shared_ptr context) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(context); -#endif d_data_context = context; } @@ -150,13 +145,6 @@ class PatchDataTestStrategy readVariableInput( boost::shared_ptr db); - /** - * Read arrays of refinement boxes from input database. - */ - void - readRefinementInput( - boost::shared_ptr db); - /** * Virtual functions in interface to user-supplied boundary conditions, * coarsen and refine operations. @@ -233,23 +221,40 @@ class PatchDataTestStrategy const boost::shared_ptr hierarchy, int level_number) = 0; + virtual void + setDataIds(std::list& data_ids) + { + NULL_USE(data_ids); + } + + virtual bool + verifyCompositeBoundaryData( + const hier::Patch& patch, + const boost::shared_ptr hierarchy, + int data_id, + int level_number, + const std::vector >& bdry_data) + { + NULL_USE(patch); + NULL_USE(hierarchy); + NULL_USE(data_id); + NULL_USE(level_number); + NULL_USE(bdry_data); + return true; + } + protected: const tbox::Dimension d_dim; /* - * Arrays of information read from input file describing test variables - */ - tbox::Array d_variable_src_name; - tbox::Array d_variable_dst_name; - tbox::Array d_variable_depth; - tbox::Array d_variable_src_ghosts; - tbox::Array d_variable_dst_ghosts; - tbox::Array d_variable_coarsen_op; - tbox::Array d_variable_refine_op; - - /* - * Arrays of information read from input file describing test variables + * Vectors of information read from input file describing test variables */ - tbox::Array d_refine_level_boxes; + std::vector d_variable_src_name; + std::vector d_variable_dst_name; + std::vector d_variable_depth; + std::vector d_variable_src_ghosts; + std::vector d_variable_dst_ghosts; + std::vector d_variable_coarsen_op; + std::vector d_variable_refine_op; private: boost::shared_ptr d_grid_geometry; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/Pointer-CommTester.C b/base/SAMRAI/SAMRAI/source/test/communication/Pointer-CommTester.C deleted file mode 100644 index 9adbe084..00000000 --- a/base/SAMRAI/SAMRAI/source/test/communication/Pointer-CommTester.C +++ /dev/null @@ -1,15 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description - * - ************************************************************************/ - -#include "CommTester.h" - -using namespace SAMRAI; - -template class boost::shared_ptr; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/README b/base/SAMRAI/SAMRAI/source/test/communication/README new file mode 100644 index 00000000..4d1f68c5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/communication/README @@ -0,0 +1,46 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Communication tests +## +######################################################################### + +This test exercises refining and coarsening operations. The files +included in this directory are as follows: + + main.C - driver + CommTester.[Ch] - Implementation of RefinePatchStrategy, + CoarsenPatchStrategy, and StandardTagAndInitStrategy + PatchDataTestStrategy.[Ch] + - Base class for patch data specific tests + *DataTest.[Ch] - Classes for patch data specific tests + test_inputs/*.input - Input files for a variety of data centerings + and multiblock configurations + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files: + test_inputs/*.input + + serial: + ./main + + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/cell_refine_a.2d.input for a full description of +all input parameters specific to this problem. The remainder of the +input files are small variations on this model input file. diff --git a/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.C b/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.C index b16aa635..c00f0710 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for side-centered patch data * ************************************************************************/ @@ -16,6 +16,7 @@ #include "SAMRAI/pdat/CellIndex.h" #include "SAMRAI/pdat/CellIterator.h" #include "CommTester.h" +#include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/pdat/SideGeometry.h" #include "SAMRAI/pdat/SideIndex.h" #include "SAMRAI/pdat/SideIterator.h" @@ -25,6 +26,8 @@ #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/hier/VariableDatabase.h" +#include + namespace SAMRAI { using namespace std; @@ -39,11 +42,9 @@ SideDataTest::SideDataTest( PatchDataTestStrategy(dim), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -55,9 +56,6 @@ SideDataTest::SideDataTest( d_refine_option = refine_option; - d_test_direction.resizeArray(0); - d_use_fine_value_at_interface.resizeArray(0); - d_Acoef = 0.0; d_Bcoef = 0.0; d_Ccoef = 0.0; @@ -86,33 +84,31 @@ SideDataTest::~SideDataTest() void SideDataTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. */ readVariableInput(db->getDatabase("VariableData")); - readRefinementInput(db->getDatabase("RefinementData")); boost::shared_ptr var_data( db->getDatabase("VariableData")); - tbox::Array var_keys = var_data->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = var_data->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_test_direction.resizeArray(nkeys); - d_use_fine_value_at_interface.resizeArray(nkeys); + d_test_direction.resize(nkeys, hier::IntVector::getZero(d_dim)); + d_use_fine_value_at_interface.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db( var_data->getDatabase(var_keys[i])); - if (var_db->keyExists("test_direction")) { - d_test_direction[i] = var_db->getInteger("test_direction"); - } else { - d_test_direction[i] = -1; + int test_direction = var_db->getIntegerWithDefault("test_direction", -1); + for (int j = 0; j < d_dim.getValue(); ++j) { + if (test_direction == -1 || test_direction == j) { + d_test_direction[i][j] = 1; + } } if (var_db->keyExists("use_fine_value_at_interface")) { @@ -154,20 +150,20 @@ void SideDataTest::readTestInput( void SideDataTest::registerVariables( CommTester* commtest) { - TBOX_ASSERT(commtest != (CommTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::SideVariable( d_dim, d_variable_src_name[i], + d_test_direction[i], d_variable_depth[i], - d_use_fine_value_at_interface[i], - d_test_direction[i])); + d_use_fine_value_at_interface[i])); if (d_do_refine) { commtest->registerVariable(d_variables[i], @@ -196,12 +192,10 @@ void SideDataTest::setConservativeData( const boost::shared_ptr hierarchy, int level_number) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); -#endif int i, j; boost::shared_ptr level( @@ -209,8 +203,9 @@ void SideDataTest::setConservativeData( const hier::BoxContainer& domain = level->getPhysicalDomain(hier::BlockId::zero()); - int ncells = 0; - for (hier::BoxContainer::const_iterator i(domain); i != domain.end(); ++i) { + size_t ncells = 0; + for (hier::BoxContainer::const_iterator i = domain.begin(); + i != domain.end(); ++i) { ncells += i->size(); } @@ -230,21 +225,22 @@ void SideDataTest::setConservativeData( * u2(i,j,k) = (i + j)/ncells */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { - pdat::CellIterator ciend(sbox, false); - for (pdat::CellIterator ci(sbox, true); ci != ciend; ++ci) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sbox)); + ci != ciend; ++ci) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i != axis) { value += (double)((*ci)(i)); } } - value /= ncells; + value /= static_cast(ncells); for (int side = pdat::SideIndex::Lower; - side <= pdat::SideIndex::Upper; side++) { + side <= pdat::SideIndex::Upper; ++side) { pdat::SideIndex si(*ci, axis, side); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -266,28 +262,30 @@ void SideDataTest::setConservativeData( const int max_ratio = ratio.max(); boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - int coarse_ncells = ncells; + size_t coarse_ncells = ncells; double* delta = new double[max_ratio * d_dim.getValue()]; - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { coarse_ncells /= ratio(j); double coarse_dx = dx[j] * ratio(j); - for (i = 0; i < ratio(j); i++) { + for (i = 0; i < ratio(j); ++i) { delta[j * max_ratio + i] = (i + 0.5) * dx[j] - coarse_dx * 0.5; } } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { hier::IntVector ci(ratio.getDim()); hier::IntVector del(ratio.getDim()); - pdat::CellIterator fiend(sbox, false); - for (pdat::CellIterator fi(sbox, true); fi != fiend; ++fi) { + pdat::CellIterator fiend(pdat::CellGeometry::end(sbox)); + for (pdat::CellIterator fi(pdat::CellGeometry::begin(sbox)); + fi != fiend; ++fi) { double value = 0.0; - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { if (i != axis) { int findx = (*fi)(i); ci(i) = ((findx < 0) ? (findx + 1) / ratio(i) - 1 @@ -297,18 +295,18 @@ void SideDataTest::setConservativeData( value += (double)(ci(i)); } } - value /= coarse_ncells; + value /= static_cast(coarse_ncells); - for (j = 0; j < d_dim.getValue(); j++) { + for (j = 0; j < d_dim.getValue(); ++j) { if (j != axis) { value += ci(j) * del(j); } } for (int side = pdat::SideIndex::Lower; - side <= pdat::SideIndex::Upper; side++) { + side <= pdat::SideIndex::Upper; ++side) { pdat::SideIndex si(*fi, axis, side); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(si, d) = value; } } @@ -338,11 +336,12 @@ void SideDataTest::initializeDataOnPatch( if (d_do_refine) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); hier::Box dbox = side_data->getBox(); @@ -355,11 +354,12 @@ void SideDataTest::initializeDataOnPatch( } else if (d_do_coarsen) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); hier::Box dbox = side_data->getGhostBox(); @@ -377,9 +377,7 @@ void SideDataTest::checkPatchInteriorData( const hier::Box& interior, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif const bool is_periodic = d_cart_grid_geometry->getPeriodicShift(hier::IntVector(tbox::Dimension( @@ -404,12 +402,13 @@ void SideDataTest::checkPatchInteriorData( const hier::IntVector& directions(data->getDirectionVector()); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { const pdat::SideIndex loweri(interior.lower(), axis, 0); - pdat::SideIterator siend(interior, axis, false); - for (pdat::SideIterator si(interior, axis, true); si != siend; ++si) { - for (int d = 0; d < depth; d++) { + pdat::SideIterator siend(pdat::SideGeometry::end(interior, axis)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(interior, axis)); + si != siend; ++si) { + for (int d = 0; d < depth; ++d) { if (!(tbox::MathUtilities::equalEps((*data)(*si, d), (*correct_data)(*si, d)))) { tbox::perr << "FAILED: -- patch interior not properly filled" @@ -436,30 +435,31 @@ void SideDataTest::setPhysicalBoundaryConditions( const bool is_periodic = periodic_shift.max() > 0; boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - } - const int num_edge_bdry_boxes = d_dim > tbox::Dimension(1) ? edge_bdry.getSize() : -1; + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - } - const int num_face_bdry_boxes = d_dim == tbox::Dimension(3) ? face_bdry.getSize() : -1; + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); hier::Box patch_interior = side_data->getBox(); checkPatchInteriorData(side_data, patch_interior, patch); @@ -467,7 +467,7 @@ void SideDataTest::setPhysicalBoundaryConditions( /* * Set node boundary data. */ - for (int ni = 0; ni < num_node_bdry_boxes; ni++) { + for (int ni = 0; ni < num_node_bdry_boxes; ++ni) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[ni], patch.getBox(), @@ -484,7 +484,7 @@ void SideDataTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), @@ -502,7 +502,7 @@ void SideDataTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fbox(face_bdry[fi].getBox()); hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], @@ -526,13 +526,12 @@ void SideDataTest::setLinearData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* lowerx = pgeom->getXLower(); double x, y, z; @@ -543,11 +542,12 @@ void SideDataTest::setLinearData( hier::IntVector directions(data->getDirectionVector()); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { const pdat::SideIndex loweri(patch.getBox().lower(), axis, 0); - pdat::SideIterator eiend(sbox, axis, false); - for (pdat::SideIterator ei(sbox, axis, true); ei != eiend; ++ei) { + pdat::SideIterator eiend(pdat::SideGeometry::end(sbox, axis)); + for (pdat::SideIterator ei(pdat::SideGeometry::begin(sbox, axis)); + ei != eiend; ++ei) { /* * Compute spatial location of cell center and @@ -575,7 +575,7 @@ void SideDataTest::setLinearData( } } - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*ei, d) = d_Dcoef + d_Acoef * x + d_Bcoef * y + d_Ccoef * z; } @@ -590,9 +590,8 @@ void SideDataTest::setPeriodicData( const hier::Box& box, const hier::Patch& patch) const { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(data); -#endif + NULL_USE(patch); const double* xlo = d_cart_grid_geometry->getXLower(); @@ -603,8 +602,9 @@ void SideDataTest::setPeriodicData( } const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const int depth = data->getDepth(); @@ -613,11 +613,12 @@ void SideDataTest::setPeriodicData( hier::IntVector directions(data->getDirectionVector()); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { if (directions(axis)) { const pdat::SideIndex loweri(patch.getBox().lower(), axis, 0); - pdat::SideIterator siend(sbox, axis, false); - for (pdat::SideIterator si(sbox, axis, true); si != siend; ++si) { + pdat::SideIterator siend(pdat::SideGeometry::end(sbox, axis)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(sbox, axis)); + si != siend; ++si) { double val = 1.0; for (int d = 0; d < d_dim.getValue(); ++d) { @@ -627,7 +628,7 @@ void SideDataTest::setPeriodicData( val *= tmpf; } val = val + 2.0; // Shift function range to [1,3] to avoid bad floating point compares. - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*data)(*si, d) = val; } @@ -666,7 +667,7 @@ bool SideDataTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(periodic_shift.getDim(), 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -690,22 +691,24 @@ bool SideDataTest::verifyResults( patch, hierarchy, level_number); } - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); int depth = side_data->getDepth(); hier::Box dbox = side_data->getGhostBox(); hier::IntVector directions(side_data->getDirectionVector()); - for (int id = 0; id < d_dim.getValue(); id++) { + for (tbox::Dimension::dir_t id = 0; id < d_dim.getValue(); ++id) { if (directions(id)) { - pdat::SideIterator siend(dbox, id, false); - for (pdat::SideIterator si(dbox, id, true); si != siend; ++si) { + pdat::SideIterator siend(pdat::SideGeometry::end(dbox, id)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(dbox, id)); + si != siend; ++si) { double correct = (*solution)(*si); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*side_data)(*si, d); if (!tbox::MathUtilities::equalEps(correct, result)) { diff --git a/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.h b/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.h index af80b092..6a3f6a32 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.h +++ b/base/SAMRAI/SAMRAI/source/test/communication/SideDataTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for side-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -31,7 +30,7 @@ using namespace std; #endif #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" namespace SAMRAI { @@ -182,8 +181,8 @@ class SideDataTest:public PatchDataTestStrategy /* * Data members specific to this side data test. */ - tbox::Array d_test_direction; - tbox::Array d_use_fine_value_at_interface; + std::vector d_test_direction; + std::vector d_use_fine_value_at_interface; double d_Acoef; double d_Bcoef; @@ -195,7 +194,7 @@ class SideDataTest:public PatchDataTestStrategy std::string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.C b/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.C deleted file mode 100644 index ad0d82f4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.C +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: VisItDerivedData class to write patch owner value. - * - ************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "VisItDerivedData.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/SAMRAIManager.h" - -using namespace SAMRAI; - -VisItDerivedData::VisItDerivedData() -{ -} - -VisItDerivedData::~VisItDerivedData() -{ -} - -bool VisItDerivedData::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const -{ - NULL_USE(patch); - NULL_USE(depth_id); - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << "VisItDerivedData::packDerivedPatchDataIntoDoubleBuffer"); - } - - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.h b/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.h deleted file mode 100644 index 6f3e84f9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/communication/VisItDerivedData.h +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: VisItDerivedData class to write patch owner value. - * - ************************************************************************/ -#ifndef included_VisItDerivedData -#define included_VisItDerivedData - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisDerivedDataStrategy.h" - -using namespace SAMRAI; - -/*! - * @brief Class to implemement patch owners as VisIt derived data. - */ -class VisItDerivedData: - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - VisItDerivedData(); - - ~VisItDerivedData(); - - //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals - - virtual bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const; - - //@} - -}; - -#endif // included_VisItDerivedData diff --git a/base/SAMRAI/SAMRAI/source/test/communication/main.C b/base/SAMRAI/SAMRAI/source/test/communication/main.C index 0479149a..a5118779 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/main.C +++ b/base/SAMRAI/SAMRAI/source/test/communication/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for patch data communication tests. * ************************************************************************/ @@ -16,7 +16,7 @@ using namespace std; #include "SAMRAI/tbox/SAMRAIManager.h" #include "CommTester.h" -#include "VisItDerivedData.h" +#include "test/testlib/DerivedVisOwnerData.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" @@ -41,7 +41,11 @@ using namespace std; #include "OuterfaceDataTest.h" //#include "MultiVariableDataTest.h" -#include +#include "boost/shared_ptr.hpp" + +#ifdef _OPENMP +#include +#endif using namespace SAMRAI; @@ -258,6 +262,14 @@ int main( tbox::PIO::logOnlyNodeZero(log_file_name); } +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif + int ntimes_run = 1; if (main_db->keyExists("ntimes_run")) { ntimes_run = main_db->getInteger("ntimes_run"); @@ -298,7 +310,7 @@ int main( * Create communication tester and patch data test object */ - PatchDataTestStrategy* patch_data_test = NULL; + PatchDataTestStrategy* patch_data_test = 0; if (test_to_run == "CellDataTest") { patch_data_test = new CellDataTest("CellDataTest", @@ -376,7 +388,6 @@ int main( boost::shared_ptr cell_tagger( new mesh::StandardTagAndInitialize( - dim, "StandardTaggingAndInitializer", comm_tester.get(), input_db->getDatabase("StandardTaggingAndInitializer"))); @@ -404,7 +415,7 @@ int main( time_man->getTimer("test::main::performCoarsenOperations")); const bool plot = main_db->getBoolWithDefault("plot", false); - VisItDerivedData vdd; + DerivedVisOwnerData vdd; if (plot) { #ifdef HAVE_HDF5 const std::string visit_filename = base_name + ".visit"; @@ -442,13 +453,13 @@ int main( if (do_refine) { - for (int n = 0; n < ntimes_run; n++) { + for (int n = 0; n < ntimes_run; ++n) { /* * Create communication schedules for data refine tests. */ refine_create_time->start(); - for (int i = 0; i < nlevels; i++) { + for (int i = 0; i < nlevels; ++i) { comm_tester->createRefineSchedule(i); } refine_create_time->stop(); @@ -457,7 +468,7 @@ int main( * Perform refine data communication operations. */ refine_comm_time->start(); - for (int j = 0; j < nlevels; j++) { + for (int j = 0; j < nlevels; ++j) { comm_tester->performRefineOperations(j); } refine_comm_time->stop(); @@ -468,13 +479,13 @@ int main( if (do_coarsen) { - for (int n = 0; n < ntimes_run; n++) { + for (int n = 0; n < ntimes_run; ++n) { /* * Create communication schedules for data coarsen tests. */ coarsen_create_time->start(); - for (int i = nlevels - 1; i > 0; i--) { + for (int i = nlevels - 1; i > 0; --i) { comm_tester->createCoarsenSchedule(i); } coarsen_create_time->stop(); @@ -483,7 +494,7 @@ int main( * Perform coarsen data communication operations. */ coarsen_comm_time->start(); - for (int j = nlevels - 1; j > 0; j--) { + for (int j = nlevels - 1; j > 0; --j) { comm_tester->performCoarsenOperations(j); } coarsen_comm_time->stop(); @@ -492,17 +503,25 @@ int main( } + bool composite_test_passed = true; + if (do_refine) { + for (int i = 0; i < nlevels; ++i) { + composite_test_passed = comm_tester->performCompositeBoundaryComm(i); + } + } + + bool test1_passed = comm_tester->verifyCommunicationResults(); if (do_refine) { - for (int n = 0; n < ntimes_run; n++) { + for (int n = 0; n < ntimes_run; ++n) { /* * Create communication schedules for data refine tests. */ refine_create_time->start(); - for (int i = 0; i < nlevels; i++) { + for (int i = 0; i < nlevels; ++i) { comm_tester->resetRefineSchedule(i); } refine_create_time->stop(); @@ -511,7 +530,7 @@ int main( * Perform refine data communication operations. */ refine_comm_time->start(); - for (int j = 0; j < nlevels; j++) { + for (int j = 0; j < nlevels; ++j) { comm_tester->performRefineOperations(j); } refine_comm_time->stop(); @@ -522,13 +541,13 @@ int main( if (do_coarsen) { - for (int n = 0; n < ntimes_run; n++) { + for (int n = 0; n < ntimes_run; ++n) { /* * Create communication schedules for data coarsen tests. */ coarsen_create_time->start(); - for (int i = nlevels - 1; i > 0; i--) { + for (int i = nlevels - 1; i > 0; --i) { comm_tester->resetCoarsenSchedule(i); } coarsen_create_time->stop(); @@ -537,7 +556,7 @@ int main( * Perform coarsen data communication operations. */ coarsen_comm_time->start(); - for (int j = nlevels - 1; j > 0; j--) { + for (int j = nlevels - 1; j > 0; --j) { comm_tester->performCoarsenOperations(j); } coarsen_comm_time->stop(); @@ -559,7 +578,7 @@ int main( tbox::plog << "\nInput file data at end of run is ...." << endl; input_db->printClassData(tbox::plog); - if (test1_passed && test2_passed) { + if (test1_passed && test2_passed && composite_test_passed) { tbox::pout << "\nPASSED: communication" << endl; return_val = 0; } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.2d.input index 70401d12..9207a68b 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_coarsen.2d" log_all_nodes = TRUE // @@ -130,9 +130,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -162,13 +159,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -176,20 +175,18 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } @@ -199,10 +196,10 @@ TreeLoadBalancer { RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.3d.input index da64c6eb..a8a9168d 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_coarsen.3d" log_all_nodes = TRUE // @@ -130,9 +130,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -161,13 +158,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -177,23 +176,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_a.2d.input index dd6e8de2..ef1f41c5 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_ghostoverlap_a.2d" log_all_nodes = TRUE // @@ -48,7 +48,6 @@ Main { // do_refine = TRUE refine_option = "INTERIOR_FROM_SAME_LEVEL" - create_ghost_overlap = TRUE do_coarsen = FALSE } @@ -120,9 +119,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -151,24 +147,16 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - barrier_before_regrid = FALSE - barrier_before_find_refinement = FALSE - barrier_after_find_refinement = FALSE - barrier_before_tag_cells = FALSE - barrier_before_cluster = FALSE - barrier_before_nest = FALSE - barrier_before_limit = FALSE - barrier_before_extend = FALSE - barrier_before_balance = FALSE - barrier_before_make_new = FALSE } @@ -178,28 +166,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_b.3d.input index ae967d5f..32ce340f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_ghostoverlap_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -49,7 +49,6 @@ Main { // do_refine = TRUE refine_option = "INTERIOR_FROM_COARSER_LEVEL" - create_ghost_overlap = TRUE do_coarsen = FALSE @@ -132,9 +131,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -163,16 +159,17 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" - check_boundary_proximity_violation_of_user_boxes = "ERROR" } @@ -181,23 +178,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,5,14) , (43,6,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,5,14) , (43,6,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.2d.input index bd45af6e..3d9b8062 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -160,13 +160,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -175,39 +177,40 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.3d.input index 7a2d868a..a071142f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -130,9 +130,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -159,63 +156,66 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,22) ], - [ (0,6,0) , (5,10,19) ], - [ (0,0,25) , (5,8,39) ], - [ (26,1,6) , (29,8,10) ], - [ (26,6,11) , (29,11,14) ], - [ (26,14,11) , (29,19,22) ], - [ (26,0,11) , (29,5,22) ], - [ (24,10,30) , (29,19,39) ], - [ (0,14,35) , (2,19,39) ], - [ (0,14,0) , (2,19,3) ], - [ (24,0,0) , (29,19,5) ], - [ (26,0,30) , (29,8,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,0,14) , (20,11,24) ] - level_1 = [ (0,2,0) , (4,7,10) ], - [ (27,15,36) , (29,19,39) ], - [ (0,15,12) , (4,19,21) ], - [ (12,0,15) , (16,5,19) ], - [ (14,15,17) , (19,19,21) ] + level_0 { + boxes = [ (0,0,0) , (5,5,22) ], + [ (0,6,0) , (5,10,19) ], + [ (0,0,25) , (5,8,39) ], + [ (26,1,6) , (29,8,10) ], + [ (26,6,11) , (29,11,14) ], + [ (26,14,11) , (29,19,22) ], + [ (26,0,11) , (29,5,22) ], + [ (24,10,30) , (29,19,39) ], + [ (0,14,35) , (2,19,39) ], + [ (0,14,0) , (2,19,3) ], + [ (24,0,0) , (29,19,5) ], + [ (26,0,30) , (29,8,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,0,14) , (20,11,24) ] + } + level_1 { + boxes = [ (0,2,0) , (4,7,10) ], + [ (27,15,36) , (29,19,39) ], + [ (0,15,12) , (4,19,21) ], + [ (12,0,15) , (16,5,19) ], + [ (14,15,17) , (19,19,21) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.2d.input index 5500a209..4f2720e3 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -129,9 +129,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -158,54 +155,57 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,10) ], - [ (24,5) , (29,9) ], - [ (24,10) , (29,19) ], - [ (18,13) , (23,19) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,6) , (29,12) ], - [ (22,15) , (29,19) ], - [ (0,15) , (4,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,10) ], + [ (24,5) , (29,9) ], + [ (24,10) , (29,19) ], + [ (18,13) , (23,19) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,6) , (29,12) ], + [ (22,15) , (29,19) ], + [ (0,15) , (4,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.3d.input index 5829837e..5fc09426 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -130,9 +130,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -159,54 +156,57 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,29) ], - [ (0,6,0) , (5,10,19) ], - [ (24,5,14) , (29,9,39) ], - [ (24,10,24) , (29,19,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,5,14) , (17,11,24) ] - level_1 = [ (0,2,0) , (4,7,14) ], - [ (25,6,35) , (29,12,39) ], - [ (22,15,25) , (29,19,39) ], - [ (0,15,12) , (4,19,21) ], - [ (12,6,15) , (16,10,19) ] + level_0 { + boxes = [ (0,0,0) , (5,5,29) ], + [ (0,6,0) , (5,10,19) ], + [ (24,5,14) , (29,9,39) ], + [ (24,10,24) , (29,19,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,5,14) , (17,11,24) ] + } + level_1 { + boxes = [ (0,2,0) , (4,7,14) ], + [ (25,6,35) , (29,12,39) ], + [ (22,15,25) , (29,19,39) ], + [ (0,15,12) , (4,19,21) ], + [ (12,6,15) , (16,10,19) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.2d.input index 8cf3e7ae..adddf513 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -131,9 +131,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -160,55 +157,57 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" - check_boundary_proximity_violation_of_user_boxes = "ERROR" } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,5) , (4,10) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,5) , (4,10) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.3d.input index 2faf068b..f8f969f7 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_periodic_c.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -131,9 +131,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -160,62 +157,65 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,22) ], - [ (0,6,0) , (5,10,19) ], - [ (0,0,25) , (5,8,39) ], - [ (26,1,6) , (29,8,10) ], - [ (26,6,11) , (29,11,14) ], - [ (26,14,11) , (29,19,22) ], - [ (26,0,11) , (29,5,22) ], - [ (24,10,30) , (29,19,39) ], - [ (0,14,35) , (2,19,39) ], - [ (0,14,0) , (2,19,3) ], - [ (24,0,0) , (29,19,5) ], - [ (26,0,30) , (29,8,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,0,14) , (20,11,24) ] - level_1 = [ (0,2,0) , (4,7,10) ], - [ (27,15,36) , (29,19,39) ], - [ (0,15,12) , (4,19,21) ], - [ (12,0,15) , (16,5,19) ], - [ (14,15,17) , (19,19,21) ] + level_0 { + boxes = [ (0,0,0) , (5,5,22) ], + [ (0,6,0) , (5,10,19) ], + [ (0,0,25) , (5,8,39) ], + [ (26,1,6) , (29,8,10) ], + [ (26,6,11) , (29,11,14) ], + [ (26,14,11) , (29,19,22) ], + [ (26,0,11) , (29,5,22) ], + [ (24,10,30) , (29,19,39) ], + [ (0,14,35) , (2,19,39) ], + [ (0,14,0) , (2,19,3) ], + [ (24,0,0) , (29,19,5) ], + [ (26,0,30) , (29,8,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,0,14) , (20,11,24) ] + } + level_1 { + boxes = [ (0,2,0) , (4,7,10) ], + [ (27,15,36) , (29,19,39) ], + [ (0,15,12) , (4,19,21) ], + [ (12,0,15) , (16,5,19) ], + [ (14,15,17) , (19,19,21) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.2d.input index d2cacc89..ab133f71 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -13,11 +13,16 @@ GlobalInputs { } Main { + +// +// Problem dimensionality +// dim = 2 + // // Log file information // - base_name = "cell-test" + base_name = "cell_refine_a.2d" log_all_nodes = TRUE // @@ -129,11 +134,10 @@ CellPatchDataTest { } - RefinementData { - } - } +// Domain description for entire problem + CartesianGridGeometry { domain_boxes = [ (0,0) , (41,29) ], [ (42,0) , (53,29) ], @@ -143,6 +147,8 @@ CartesianGridGeometry { x_up = 1.e0 , 1.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input documentation + PatchHierarchy { max_levels = 3 largest_patch_size { @@ -160,55 +166,62 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +// Refer to mesh::BergerRigoutsos for input documentation + +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +// Refer to mesh::GriddingAlgorithm for input documentation + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - barrier_before_regrid = FALSE - barrier_before_find_refinement = FALSE - barrier_after_find_refinement = FALSE - barrier_before_tag_cells = FALSE - barrier_before_cluster = FALSE - barrier_before_nest = FALSE - barrier_before_limit = FALSE - barrier_before_extend = FALSE - barrier_before_balance = FALSE - barrier_before_make_new = FALSE } +// Refer to mesh::TreeLoadBalancer for input + TreeLoadBalancer { } +// Refer to mesh::StandardTagAndInitialize for input. + StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + // These are the boxes that will be tagged on level 0 to create level 1 + + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + + // These are the boxes that will be tagged on level 1 to create level 2 + + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } +// Extra debug/sanity checks could be turned on in the event of a problem. + RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } +// Turn on sanity checking of connectors + PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.3d.input index 126344e8..887a7499 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_refine_a.3d" log_all_nodes = TRUE // @@ -129,9 +129,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -160,12 +157,14 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } +BergerRigoutsos { + combine_efficiency = 0.85 +} + GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE - combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -175,24 +174,27 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.2d.input index a1d6d3d4..a4f0983a 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_refine_b.2d" log_all_nodes = TRUE // @@ -129,9 +129,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -160,13 +157,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -177,29 +176,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.3d.input index 13a00385..d8d793f1 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/cell_refine_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "cell-test" + base_name = "cell_refine_b.3d" log_all_nodes = TRUE // @@ -129,9 +129,6 @@ CellPatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -160,13 +157,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -176,23 +175,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.2d.input index cfcc1bf3..332d9511 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_coarsen.2d" log_all_nodes = TRUE // @@ -115,9 +115,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -146,13 +143,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -163,28 +162,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.3d.input index 3405eb48..ccbadd5d 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_coarsen.3d" log_all_nodes = TRUE // @@ -123,9 +123,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -154,13 +151,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -170,23 +169,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.2d.input index 59dc5aa4..9577101b 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_refine_a.2d" log_all_nodes = TRUE // @@ -114,9 +114,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -145,13 +142,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -162,29 +161,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.3d.input index 7b418a27..81d710aa 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_refine_a.3d" log_all_nodes = TRUE // @@ -133,9 +133,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -164,13 +161,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -180,23 +179,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.2d.input index 9344420a..9f6900b0 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_refine_b.2d" log_all_nodes = TRUE // @@ -114,9 +114,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -145,13 +142,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -162,29 +161,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.3d.input index 4a35e135..f2470374 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/edge_refine_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "edge-test" + base_name = "edge_refine_b.3d" log_all_nodes = TRUE // @@ -122,9 +122,6 @@ EdgePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -153,13 +150,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -169,23 +168,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.2d.input index a82e4942..588e78a3 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_coarsen.2d" log_all_nodes = TRUE // @@ -123,9 +123,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -154,13 +151,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -171,28 +170,25 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.3d.input index 8e978439..07b0e35c 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_coarsen.3d" log_all_nodes = TRUE // @@ -123,9 +123,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -154,13 +151,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -170,23 +169,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.2d.input index 47f65671..3485abe0 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_refine_a.2d" log_all_nodes = TRUE // @@ -122,9 +122,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -153,13 +150,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -170,29 +169,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.3d.input index 0154e062..0e862d26 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_refine_a.3d" log_all_nodes = TRUE // @@ -133,9 +133,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -164,13 +161,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -180,23 +179,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.2d.input index c77c679f..4f1db2e5 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_refine_b.2d" log_all_nodes = TRUE // @@ -122,9 +122,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -153,13 +150,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -170,29 +169,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.3d.input index c4c1707c..4c139b57 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/face_refine_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "face-test" + base_name = "face_refine_b.3d" log_all_nodes = TRUE // @@ -133,9 +133,6 @@ FacePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -164,13 +161,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -180,23 +179,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.2d.input index a4376cd0..bf6e8772 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_coarsen.2d" log_all_nodes = TRUE // @@ -120,9 +120,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -151,13 +148,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -168,30 +167,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.3d.input index d957d342..75b38550 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_coarsen.3d" log_all_nodes = TRUE // @@ -121,9 +121,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -152,13 +149,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -168,23 +167,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_a.3d.input index 2b8d774c..19e78691 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_ghostoverlap_a.3d" log_all_nodes = TRUE // @@ -48,7 +48,6 @@ Main { // do_refine = TRUE refine_option = "INTERIOR_FROM_SAME_LEVEL" - create_ghost_overlap = TRUE do_coarsen = FALSE } @@ -121,8 +120,6 @@ NodePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -151,13 +148,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,23 +166,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_b.2d.input index c4f3e91b..9741797f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_ghostoverlap_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_ghostoverlap_b.2d" log_all_nodes = TRUE // @@ -48,7 +48,6 @@ Main { // do_refine = TRUE refine_option = "INTERIOR_FROM_COARSER_LEVEL" - create_ghost_overlap = TRUE do_coarsen = FALSE } @@ -110,9 +109,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -139,13 +135,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -156,28 +154,31 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - xlevel_1 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - level_1 = [ (18,8) , (25,13) ], - [ (12,32) , (15,37) ], - [ (16,32) , (21,35) ] + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } +// level_1 { +// boxes = [ (36,16) , (51,27) ], +// [ (24,64) , (31,75) ], +// [ (32,64) , (43,71) ] +// } + level_1 { + boxes = [ (18,8) , (25,13) ], + [ (12,32) , (15,37) ], + [ (16,32) , (21,35) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.2d.input index d06fb970..748e2d4c 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -120,9 +120,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -149,13 +146,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -164,39 +163,40 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.3d.input index 4a6b7b6d..4e0998d5 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_periodic_a.3d" log_all_nodes = TRUE plot = TRUE @@ -131,8 +131,6 @@ NodePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -159,63 +157,66 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,22) ], - [ (0,6,0) , (5,10,19) ], - [ (0,0,25) , (5,8,39) ], - [ (26,1,6) , (29,8,10) ], - [ (26,6,11) , (29,11,14) ], - [ (26,14,11) , (29,19,22) ], - [ (26,0,11) , (29,5,22) ], - [ (24,10,30) , (29,19,39) ], - [ (0,14,35) , (2,19,39) ], - [ (0,14,0) , (2,19,3) ], - [ (24,0,0) , (29,19,5) ], - [ (26,0,30) , (29,8,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,0,14) , (20,11,24) ] - level_1 = [ (0,2,0) , (4,7,10) ], - [ (27,15,36) , (29,19,39) ], - [ (0,15,12) , (4,19,21) ], - [ (12,0,15) , (16,5,19) ], - [ (14,15,17) , (19,19,21) ] + level_0 { + boxes = [ (0,0,0) , (5,5,22) ], + [ (0,6,0) , (5,10,19) ], + [ (0,0,25) , (5,8,39) ], + [ (26,1,6) , (29,8,10) ], + [ (26,6,11) , (29,11,14) ], + [ (26,14,11) , (29,19,22) ], + [ (26,0,11) , (29,5,22) ], + [ (24,10,30) , (29,19,39) ], + [ (0,14,35) , (2,19,39) ], + [ (0,14,0) , (2,19,3) ], + [ (24,0,0) , (29,19,5) ], + [ (26,0,30) , (29,8,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,0,14) , (20,11,24) ] + } + level_1 { + boxes = [ (0,2,0) , (4,7,10) ], + [ (27,15,36) , (29,19,39) ], + [ (0,15,12) , (4,19,21) ], + [ (12,0,15) , (16,5,19) ], + [ (14,15,17) , (19,19,21) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.2d.input index eb606f0e..c9a9af4f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -149,13 +149,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -164,39 +166,40 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.3d.input index 5dd86bc0..9e2bf4cc 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -121,8 +121,6 @@ NodePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -149,63 +147,66 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,22) ], - [ (0,6,0) , (5,10,19) ], - [ (0,0,25) , (5,8,39) ], - [ (26,1,6) , (29,8,10) ], - [ (26,6,11) , (29,11,14) ], - [ (26,14,11) , (29,19,22) ], - [ (26,0,11) , (29,5,22) ], - [ (24,10,30) , (29,19,39) ], - [ (0,14,35) , (2,19,39) ], - [ (0,14,0) , (2,19,3) ], - [ (24,0,0) , (29,19,5) ], - [ (26,0,30) , (29,8,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,0,14) , (20,11,24) ] - level_1 = [ (0,2,0) , (4,7,10) ], - [ (27,15,36) , (29,19,39) ], - [ (0,15,12) , (4,19,21) ], - [ (12,0,15) , (16,5,19) ], - [ (14,15,17) , (19,19,21) ] + level_0 { + boxes = [ (0,0,0) , (5,5,22) ], + [ (0,6,0) , (5,10,19) ], + [ (0,0,25) , (5,8,39) ], + [ (26,1,6) , (29,8,10) ], + [ (26,6,11) , (29,11,14) ], + [ (26,14,11) , (29,19,22) ], + [ (26,0,11) , (29,5,22) ], + [ (24,10,30) , (29,19,39) ], + [ (0,14,35) , (2,19,39) ], + [ (0,14,0) , (2,19,3) ], + [ (24,0,0) , (29,19,5) ], + [ (26,0,30) , (29,8,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,0,14) , (20,11,24) ] + } + level_1 { + boxes = [ (0,2,0) , (4,7,10) ], + [ (27,15,36) , (29,19,39) ], + [ (0,15,12) , (4,19,21) ], + [ (12,0,15) , (16,5,19) ], + [ (14,15,17) , (19,19,21) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.2d.input index 49b6e198..ccfc4a47 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -121,9 +121,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -150,13 +147,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -165,53 +164,56 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - xRefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,10) ], - [ (24,5) , (29,9) ], - [ (24,10) , (29,19) ], - [ (18,13) , (23,19) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,4) , (9,15) ], - [ (50,12) , (59,24) ], - [ (44,30) , (59,39) ], - [ (0,30) , (9,39) ], - [ (24,12) , (33,21) ] +// level_0 { +// boxes = [ (0,0) , (5,5) ], +// [ (0,6) , (5,10) ], +// [ (24,5) , (29,9) ], +// [ (24,10) , (29,19) ], +// [ (18,13) , (23,19) ], +// [ (0,14) , (9,19) ], +// [ (11,5) , (17,11) ] +// } +// level_1 { +// boxes = [ (0,4) , (9,15) ], +// [ (50,12) , (59,24) ], +// [ (44,30) , (59,39) ], +// [ (0,30) , (9,39) ], +// [ (24,12) , (33,21) ] +// } + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] } - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,4) , (9,15) ], - [ (50,14) , (59,23) ], - [ (44,30) , (59,39) ], - [ (24,12) , (33,21) ] + level_1 { + boxes = [ (0,4) , (9,15) ], + [ (50,14) , (59,23) ], + [ (44,30) , (59,39) ], + [ (24,12) , (33,21) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.3d.input index 224f8b46..b831ee9b 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_periodic_c.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -122,9 +122,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -151,63 +148,66 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } TreeLoadBalancer { - barrier_after = TRUE + DEV_barrier_after = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (5,5,22) ], - [ (0,6,0) , (5,10,19) ], - [ (0,0,25) , (5,8,39) ], - [ (26,1,6) , (29,8,10) ], - [ (26,6,11) , (29,11,14) ], - [ (26,14,11) , (29,19,22) ], - [ (26,0,11) , (29,5,22) ], - [ (24,10,30) , (29,19,39) ], - [ (0,14,35) , (2,19,39) ], - [ (0,14,0) , (2,19,3) ], - [ (24,0,0) , (29,19,5) ], - [ (26,0,30) , (29,8,39) ], - [ (18,13,15) , (23,19,39) ], - [ (0,14,10) , (17,19,29) ], - [ (11,0,14) , (20,11,24) ] - level_1 = [ (0,4,0) , (9,15,21) ], - [ (54,30,72) , (59,39,79) ], - [ (0,30,24) , (9,39,43) ], - [ (24,0,30) , (33,11,39) ], - [ (28,30,34) , (39,39,43) ] + level_0 { + boxes = [ (0,0,0) , (5,5,22) ], + [ (0,6,0) , (5,10,19) ], + [ (0,0,25) , (5,8,39) ], + [ (26,1,6) , (29,8,10) ], + [ (26,6,11) , (29,11,14) ], + [ (26,14,11) , (29,19,22) ], + [ (26,0,11) , (29,5,22) ], + [ (24,10,30) , (29,19,39) ], + [ (0,14,35) , (2,19,39) ], + [ (0,14,0) , (2,19,3) ], + [ (24,0,0) , (29,19,5) ], + [ (26,0,30) , (29,8,39) ], + [ (18,13,15) , (23,19,39) ], + [ (0,14,10) , (17,19,29) ], + [ (11,0,14) , (20,11,24) ] + } + level_1 { + boxes = [ (0,4,0) , (9,15,21) ], + [ (54,30,72) , (59,39,79) ], + [ (0,30,24) , (9,39,43) ], + [ (24,0,30) , (33,11,39) ], + [ (28,30,34) , (39,39,43) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'y' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.2d.input index b86df529..5d8e11e4 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_refine_a.2d" log_all_nodes = TRUE // @@ -119,9 +119,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -150,13 +147,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,29 +166,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.3d.input index 475ce3b8..864e0c74 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_refine_a.3d" log_all_nodes = TRUE // @@ -130,8 +130,6 @@ NodePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -160,13 +158,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -176,23 +176,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.2d.input index f741f545..0dd3d970 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_refine_b.2d" log_all_nodes = TRUE // @@ -119,9 +119,6 @@ NodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -148,13 +145,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -165,28 +164,31 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - xlevel_1 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - level_1 = [ (18,8) , (25,13) ], - [ (12,32) , (15,37) ], - [ (16,32) , (21,35) ] + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } +// level_1 { +// boxes = [ (36,16) , (51,27) ], +// [ (24,64) , (31,75) ], +// [ (32,64) , (43,71) ] +// } + level_1 { + boxes = [ (18,8) , (25,13) ], + [ (12,32) , (15,37) ], + [ (16,32) , (21,35) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.3d.input index cb31fc8d..5be11aa2 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/node_refine_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "node-test" + base_name = "node_refine_b.3d" log_all_nodes = TRUE // @@ -120,8 +120,6 @@ NodePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -150,13 +148,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -166,23 +166,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.2d.input index 76ce2654..b0b327db 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "oface-test" + base_name = "oface_coarsen.2d" log_all_nodes = TRUE // @@ -119,9 +119,28 @@ OuterfacePatchDataTest { use_fine_value_at_interface = TRUE } - } + variable_3 { + src_name = "src_var3" + dst_name = "dst_var3" + depth = 1 + src_ghosts = 0,0 + dst_ghosts = 2,2 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + + variable_4 { + src_name = "src_var4" + dst_name = "dst_var4" + depth = 2 + src_ghosts = 0,0 + dst_ghosts = 0,0 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } - RefinementData { } } @@ -152,13 +171,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -169,28 +190,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.3d.input index 092ca89e..f52e9115 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oface_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI OuterfaceData. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "oface-test" + base_name = "oface_coarsen.3d" log_all_nodes = TRUE // @@ -118,9 +118,29 @@ OuterfacePatchDataTest { use_fine_value_at_interface = TRUE } - } + variable_3 { + src_name = "src_var3" + dst_name = "dst_var3" + depth = 1 + src_ghosts = 0,0,0 + dst_ghosts = 2,2,2 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + + variable_4 { + src_name = "src_var4" + dst_name = "dst_var4" + depth = 2 + src_ghosts = 0,0,0 + dst_ghosts = 0,0,0 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + - RefinementData { } } @@ -151,13 +171,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,23 +189,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.2d.input index 781a3676..101d3693 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "onode-test" + base_name = "onode_coarsen.2d" log_all_nodes = TRUE // @@ -117,9 +117,6 @@ OuternodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -148,13 +145,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -165,29 +164,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.3d.input index 1267aaae..6fcd96e4 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/onode_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "onode-test" + base_name = "onode_coarsen.3d" log_all_nodes = TRUE // @@ -118,9 +118,6 @@ OuternodePatchDataTest { } - RefinementData { - } - } CartesianGridGeometry { @@ -149,13 +146,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -165,23 +164,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.2d.input index d7477e4c..fdc2b96c 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI outerside data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "oside-test" + base_name = "oside_coarsen.2d" log_all_nodes = TRUE // @@ -118,9 +118,29 @@ OutersidePatchDataTest { use_fine_value_at_interface = TRUE } - } + variable_3 { + src_name = "src_var3" + dst_name = "dst_var3" + depth = 1 + src_ghosts = 0,0 + dst_ghosts = 2,2 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } - RefinementData {} + variable_4 { + src_name = "src_var4" + dst_name = "dst_var4" + depth = 2 + src_ghosts = 0,0 + dst_ghosts = 0,0 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + + } } @@ -157,13 +177,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -174,29 +196,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.3d.input index 7bbb27d2..9d31fe6f 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/oside_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI OutersideData. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "oside-test" + base_name = "oside_coarsen.3d" log_all_nodes = TRUE // @@ -110,6 +110,28 @@ OutersidePatchDataTest { variable_2 { src_name = "src_var2" dst_name = "dst_var2" + depth = 1 + src_ghosts = 0,0,0 + dst_ghosts = 0,0,0 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + + variable_3 { + src_name = "src_var3" + dst_name = "dst_var3" + depth = 1 + src_ghosts = 0,0,0 + dst_ghosts = 2,2,2 + coarsen_operator = "CONSERVATIVE_COARSEN" + refine_operator = "CONSERVATIVE_LINEAR_REFINE" + use_fine_value_at_interface = TRUE + } + + variable_4 { + src_name = "src_var4" + dst_name = "dst_var4" depth = 2 src_ghosts = 0,0,0 dst_ghosts = 0,0,0 @@ -118,9 +140,7 @@ OutersidePatchDataTest { use_fine_value_at_interface = TRUE } - } - RefinementData { } } @@ -151,13 +171,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,23 +189,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.2d.input index 941935f0..b834eb50 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -17,7 +17,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_coarsen.2d" log_all_nodes = TRUE // @@ -126,8 +126,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -156,13 +154,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -173,28 +173,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.3d.input index 5b7b9d94..86b9415d 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_coarsen.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_coarsen.3d" log_all_nodes = TRUE // @@ -122,8 +122,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -152,13 +150,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,23 +167,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.2d.input index 21d28965..5e557bd4 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -122,8 +122,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -150,13 +148,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -165,39 +165,40 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.3d.input index 87aeaa14..cbace547 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_periodic_a.3d" log_all_nodes = TRUE // @@ -133,8 +133,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -161,13 +159,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -176,23 +176,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (18,8,7) , (25,13,8) ], - [ (12,32,10) , (15,37,14) ], - [ (16,32,10) , (21,35,12) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (18,8,7) , (25,13,8) ], + [ (12,32,10) , (15,37,14) ], + [ (16,32,10) , (21,35,12) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.2d.input index a0828381..c17db9fd 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -122,8 +122,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -150,13 +148,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" check_nonnesting_user_boxes = "WARN" } @@ -165,39 +165,40 @@ GriddingAlgorithm { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (5,5) ], - [ (0,6) , (5,12) ], - [ (24,6) , (29,10) ], - [ (24,11) , (29,19) ], - [ (18,13) , (23,19) ], - [ (21,0) , (29,5) ], - [ (0,14) , (9,19) ], - [ (11,5) , (17,11) ] - level_1 = [ (0,2) , (4,7) ], - [ (25,7) , (29,11) ], - [ (22,15) , (29,19) ], - [ (12,6) , (16,10) ] + level_0 { + boxes = [ (0,0) , (5,5) ], + [ (0,6) , (5,12) ], + [ (24,6) , (29,10) ], + [ (24,11) , (29,19) ], + [ (18,13) , (23,19) ], + [ (21,0) , (29,5) ], + [ (0,14) , (9,19) ], + [ (11,5) , (17,11) ] + } + level_1 { + boxes = [ (0,2) , (4,7) ], + [ (25,7) , (29,11) ], + [ (22,15) , (29,19) ], + [ (12,6) , (16,10) ] } - } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } -MappingConnectorUtil { - print_modify_steps = 'n' +MappingConnectorAlgorithm { + DEV_print_modify_steps = 'n' } RefineSchedule { - extra_debug = TRUE + DEV_extra_debug = FALSE } TreeLoadBalancer{ } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.3d.input index e3e56892..b2d5ce32 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_periodic_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_periodic_b.3d" log_all_nodes = TRUE // @@ -121,7 +121,6 @@ SidePatchDataTest { } - RefinementData {} } CartesianGridGeometry { @@ -148,13 +147,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -163,23 +164,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (18,8,7) , (25,13,8) ], - [ (12,32,10) , (15,37,14) ], - [ (16,32,10) , (21,35,12) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (18,8,7) , (25,13,8) ], + [ (12,32,10) , (15,37,14) ], + [ (16,32,10) , (21,35,12) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.2d.input index 9f7b162a..be6fa334 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_refine_a.2d" log_all_nodes = TRUE // @@ -121,8 +121,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -151,13 +149,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -168,28 +168,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 { - boxes_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - } - level_1 { - boxes_0 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] - } + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.3d.input index 6c8b10aa..531c3ceb 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_a.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_refine_a.3d" log_all_nodes = TRUE // @@ -133,8 +133,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -163,13 +161,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -178,23 +178,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.2d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.2d.input index f92cce74..96e80ff6 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.2d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_refine_b.2d" log_all_nodes = TRUE // @@ -121,8 +121,6 @@ SidePatchDataTest { } - RefinementData {} - } CartesianGridGeometry { @@ -151,13 +149,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -167,24 +167,27 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - level_1 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] + + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.3d.input b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.3d.input index 5f9fa18d..ae9de38b 100644 --- a/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/communication/test_inputs/side_refine_b.3d.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ @@ -13,7 +13,7 @@ Main { // // Log file information // - base_name = "side-test" + base_name = "side_refine_b.3d" log_all_nodes = TRUE // @@ -121,7 +121,6 @@ SidePatchDataTest { } - RefinementData {} } CartesianGridGeometry { @@ -150,13 +149,15 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = FALSE } -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE +BergerRigoutsos { efficiency_tolerance = 0.70 combine_efficiency = 0.85 - extend_tags_to_bdry = TRUE +} + +GriddingAlgorithm { + enforce_proper_nesting = TRUE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" } @@ -165,23 +166,26 @@ TreeLoadBalancer { StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } RefineSchedule { - extra_debug = FALSE + DEV_extra_debug = FALSE } PersistentOverlapConnectors { - check_created_connectors = TRUE - check_accessed_connectors = TRUE + DEV_check_created_connectors = TRUE + DEV_check_accessed_connectors = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.depend index a16b7e4b..821d84a3 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -28,6 +28,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -59,7 +60,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -74,14 +74,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -92,9 +92,8 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.in b/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.in index 064bf296..38ed54d0 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing data access functionality ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/dataaccess -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -24,6 +25,7 @@ CPPFLAGS_EXTRA = -DTESTING=1 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o @@ -32,33 +34,54 @@ main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(LIBSAMRAI) $(LDLIBS) -o $@ check: - $(MAKE) check2d - $(MAKE) check3d + $(MAKE) check2d + $(MAKE) check3d check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: clean-check - $(RM) *.f main +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/README b/base/SAMRAI/SAMRAI/source/test/dataaccess/README new file mode 100644 index 00000000..af0ad426 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/README @@ -0,0 +1,38 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI PatchData access via PatchData iterators +## and Indexes. +## +######################################################################### + +This is a unit test of SAMRAI PatchData access via PatchData iterators and +Indexes. The files included in this directory are as follows: + + main.C - unit tester + test_inputs/*.input - 2d and 3d input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + For one of the following input files: + test_inputs/default.2d.input + test_inputs/default.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/default.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/main.C b/base/SAMRAI/SAMRAI/source/test/dataaccess/main.C index 571d2dfd..c3691240 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataaccess/main.C +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for testing SAMRAI data access * ************************************************************************/ @@ -83,7 +83,7 @@ int main( hier::Index box_lower(dim, 0); hier::Index box_upper(dim); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { box_upper(d) = (d + 4) * 3; } @@ -116,51 +116,53 @@ int main( double* cell_ptr = cell_data.getPointer(); - int cell_data_size = box.size(); + size_t cell_data_size = box.size(); - for (int i = 0; i < cell_data_size; i++) { + for (size_t i = 0; i < cell_data_size; ++i) { cell_ptr[i] = (double)i; } int j = 0; - pdat::CellIterator ciend(box, false); - for (pdat::CellIterator ci(box, true); ci != ciend; ++ci) { + pdat::CellIterator ciend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(box)); + ci != ciend; ++ci) { if (!tbox::MathUtilities::equalEps(cell_data(*ci), cell_ptr[j])) { tbox::perr << "FAILED: - CellIterator test" << std::endl; ++error_count; } - j++; + ++j; } /* * Test FaceIterator */ - double* face_ptr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double* face_ptr[SAMRAI::MAX_DIM_VAL]; - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { face_ptr[axis] = face_data.getPointer(axis); hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, axis); - int face_data_size = face_box.size(); + size_t face_data_size = face_box.size(); - for (int i = 0; i < face_data_size; i++) { + for (size_t i = 0; i < face_data_size; ++i) { face_ptr[axis][i] = (double)i; } j = 0; - pdat::FaceIterator fiend(box, axis, false); - for (pdat::FaceIterator fi(box, axis, true); fi != fiend; ++fi) { + pdat::FaceIterator fiend(pdat::FaceGeometry::end(box, axis)); + for (pdat::FaceIterator fi(pdat::FaceGeometry::begin(box, axis)); + fi != fiend; ++fi) { if (!tbox::MathUtilities::equalEps(face_data(*fi), face_ptr[axis][j])) { tbox::perr << "FAILED: - FaceIterator test" << std::endl; ++error_count; } - j++; + ++j; } } @@ -168,21 +170,21 @@ int main( * Test FaceIndex */ - pdat::CellIterator ifcend(box, false); - for (pdat::CellIterator ifc(box, true); ifc != ifcend; ++ifc) { + pdat::CellIterator ifcend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator ifc(pdat::CellGeometry::begin(box)); + ifc != ifcend; ++ifc) { - for (int a = 0; a < dim.getValue(); a++) { + for (tbox::Dimension::dir_t a = 0; a < dim.getValue(); ++a) { - hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, - a); + hier::Box face_box = pdat::FaceGeometry::toFaceBox(box, a); hier::Index flo = face_box.lower(); hier::Index fhi = face_box.upper(); - for (int f = 0; f < 2; f++) { + for (int f = 0; f < 2; ++f) { pdat::FaceIndex findx(*ifc, a, f); int offset = 0; - for (int i = dim.getValue() - 1; i > 0; i--) { + for (int i = dim.getValue() - 1; i > 0; --i) { offset = (fhi(i - 1) - flo(i - 1) + 1) * (findx(i) - flo(i) + offset); } @@ -208,29 +210,31 @@ int main( hier::Index nlo = node_box.lower(); hier::Index nhi = node_box.upper(); - int node_data_size = node_box.size(); + size_t node_data_size = node_box.size(); - for (int i = 0; i < node_data_size; i++) { + for (size_t i = 0; i < node_data_size; ++i) { node_ptr[i] = (double)i; } j = 0; - pdat::NodeIterator niend(box, false); - for (pdat::NodeIterator ni(box, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(box)); + ni != niend; ++ni) { if (!tbox::MathUtilities::equalEps(node_data(*ni), node_ptr[j])) { tbox::perr << "FAILED: - NodeIterator test" << std::endl; ++error_count; } - j++; + ++j; } /* * Test NodeIndex */ - pdat::CellIterator incend(box, false); - for (pdat::CellIterator inc(box, true); inc != incend; ++inc) { + pdat::CellIterator incend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator inc(pdat::CellGeometry::begin(box)); + inc != incend; ++inc) { hier::IntVector corner(dim, 0); @@ -241,7 +245,7 @@ int main( pdat::NodeIndex nindx(*inc, corner); int offset = 0; - for (int i = dim.getValue() - 1; i > 0; i--) { + for (int i = dim.getValue() - 1; i > 0; --i) { offset = (nhi(i - 1) - nlo(i - 1) + 1) * (nindx(i) - nlo(i) + offset); } @@ -254,11 +258,11 @@ int main( } int u; - for (u = 0; u < dim.getValue(); u++) { + for (u = 0; u < dim.getValue(); ++u) { if (corner(u) == 1) { corner(u) = 0; } else { - corner(u)++; + ++corner(u); break; } } @@ -272,29 +276,30 @@ int main( * Test EdgeIterator */ - double* edge_ptr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double* edge_ptr[SAMRAI::MAX_DIM_VAL]; - for (int axis = 0; axis < dim.getValue(); axis++) { + for (int axis = 0; axis < dim.getValue(); ++axis) { edge_ptr[axis] = edge_data.getPointer(axis); hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, axis); - int edge_data_size = edge_box.size(); + size_t edge_data_size = edge_box.size(); - for (int i = 0; i < edge_data_size; i++) { + for (size_t i = 0; i < edge_data_size; ++i) { edge_ptr[axis][i] = (double)i; } j = 0; - pdat::EdgeIterator eiend(box, axis, false); - for (pdat::EdgeIterator ei(box, axis, true); ei != eiend; ++ei) { + pdat::EdgeIterator eiend(pdat::EdgeGeometry::end(box, axis)); + for (pdat::EdgeIterator ei(pdat::EdgeGeometry::begin(box, axis)); + ei != eiend; ++ei) { if (!tbox::MathUtilities::equalEps(edge_data(*ei), edge_ptr[axis][j])) { tbox::perr << "FAILED: - EdgeIterator test" << std::endl; ++error_count; } - j++; + ++j; } } @@ -302,20 +307,21 @@ int main( * Test EdgeIndex */ - pdat::CellIterator iecend(box, false); - for (pdat::CellIterator iec(box, true); iec != iecend; ++iec) { - for (int a = 0; a < dim.getValue(); a++) { + pdat::CellIterator iecend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator iec(pdat::CellGeometry::begin(box)); + iec != iecend; ++iec) { + for (int a = 0; a < dim.getValue(); ++a) { hier::Box edge_box = pdat::EdgeGeometry::toEdgeBox(box, a); hier::Index elo = edge_box.lower(); hier::Index ehi = edge_box.upper(); - for (int f = 0; f < (1 << (dim.getValue() - 1)); f++) { + for (int f = 0; f < (1 << (dim.getValue() - 1)); ++f) { pdat::EdgeIndex eindx(*iec, a, f); int offset = 0; - for (int i = dim.getValue() - 1; i > 0; i--) { + for (int i = dim.getValue() - 1; i > 0; --i) { offset = (ehi(i - 1) - elo(i - 1) + 1) * (eindx(i) - elo(i) + offset); } @@ -334,29 +340,29 @@ int main( * Test SideIterator */ - double* side_ptr[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double* side_ptr[SAMRAI::MAX_DIM_VAL]; - for (int axis = 0; axis < dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < dim.getValue(); ++axis) { side_ptr[axis] = side_data.getPointer(axis); - hier::Box side_box = pdat::SideGeometry::toSideBox(box, - axis); - int side_data_size = side_box.size(); + hier::Box side_box = pdat::SideGeometry::toSideBox(box, axis); + size_t side_data_size = side_box.size(); - for (int i = 0; i < side_data_size; i++) { + for (size_t i = 0; i < side_data_size; ++i) { side_ptr[axis][i] = (double)i; } j = 0; - pdat::SideIterator siend(box, axis, false); - for (pdat::SideIterator si(box, axis, true); si != siend; ++si) { + pdat::SideIterator siend(pdat::SideGeometry::end(box, axis)); + for (pdat::SideIterator si(pdat::SideGeometry::begin(box, axis)); + si != siend; ++si) { if (!tbox::MathUtilities::equalEps(side_data(*si), side_ptr[axis][j])) { tbox::perr << "FAILED: - SideIterator test" << std::endl; ++error_count; } - j++; + ++j; } } @@ -364,20 +370,20 @@ int main( * Test SideIndex */ - pdat::CellIterator iscend(box, false); - for (pdat::CellIterator isc(box, true); isc != iscend; ++isc) { - for (int a = 0; a < dim.getValue(); a++) { + pdat::CellIterator iscend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator isc(pdat::CellGeometry::begin(box)); + isc != iscend; ++isc) { + for (tbox::Dimension::dir_t a = 0; a < dim.getValue(); ++a) { - hier::Box side_box = pdat::SideGeometry::toSideBox(box, - a); + hier::Box side_box = pdat::SideGeometry::toSideBox(box, a); hier::Index slo = side_box.lower(); hier::Index shi = side_box.upper(); - for (int f = 0; f < 2; f++) { + for (int f = 0; f < 2; ++f) { pdat::SideIndex sindx(*isc, a, f); int offset = 0; - for (int i = dim.getValue() - 1; i > 0; i--) { + for (int i = dim.getValue() - 1; i > 0; --i) { offset = (shi(i - 1) - slo(i - 1) + 1) * (sindx(i) - slo(i) + offset); } diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.2d.input index 81542a96..62a587d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.2d.input @@ -3,11 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 2D PatchData access unit tests. * ************************************************************************/ Main { + // Dimension of this problem. dim = 2 } diff --git a/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.3d.input index 5a977c14..089471a2 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/dataaccess/test_inputs/default.3d.input @@ -3,11 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 3D PatchData access unit tests. * ************************************************************************/ Main { + // Dimension of this problem. dim = 3 } diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.depend index 1f1265d8..087e62b3 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,10 +14,10 @@ FILE_0=SampleIndexData.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -27,18 +27,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SampleIndexData.C \ SampleIndexData.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=cell_cplxtest.o DEPENDS_1:=\ @@ -76,12 +73,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -111,7 +110,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -123,8 +121,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -133,7 +131,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_cplxtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -151,13 +148,12 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=cell_hierops.o +${FILE_1}: ${DEPENDS_1} + +FILE_2=cell_hiertest.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ @@ -193,28 +189,25 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsComplex.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -228,7 +221,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -240,17 +232,16 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_hierops.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_hiertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -268,13 +259,12 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=cell_hiertest.o +${FILE_2}: ${DEPENDS_2} + +FILE_3=cell_patchtest.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ @@ -306,10 +296,9 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ @@ -322,8 +311,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ @@ -340,7 +327,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -352,23 +338,20 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_hiertest.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_patchtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ @@ -380,120 +363,13 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} -FILE_4=cell_patchtest.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h cell_patchtest.C +${FILE_3}: ${DEPENDS_3} -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} - -FILE_5=edge_cplxtest.o -DEPENDS_5:=\ +FILE_4=edge_cplxtest.o +DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -529,12 +405,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -567,7 +445,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -579,8 +456,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -589,8 +466,7 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h edge_cplxtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ +DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -609,14 +485,13 @@ DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=edge_hiertest.o -DEPENDS_6:=\ +${FILE_4}: ${DEPENDS_4} + +FILE_5=edge_hiertest.o +DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -652,12 +527,14 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -690,7 +567,6 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -702,8 +578,8 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -712,8 +588,7 @@ DEPENDS_6:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h edge_hiertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ +DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -732,14 +607,13 @@ DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} -FILE_7=face_cplxtest.o -DEPENDS_7:=\ +${FILE_5}: ${DEPENDS_5} + +FILE_6=face_cplxtest.o +DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -775,12 +649,14 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -813,7 +689,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -825,8 +700,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -835,8 +710,7 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h face_cplxtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ +DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -855,14 +729,13 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=face_hiertest.o -DEPENDS_8:=\ +${FILE_6}: ${DEPENDS_6} + +FILE_7=face_hiertest.o +DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -898,12 +771,14 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -936,7 +811,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -948,8 +822,8 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -958,8 +832,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h face_hiertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ +DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -978,14 +851,13 @@ DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} -FILE_9=indx_dataops.o -DEPENDS_9:=\ +${FILE_7}: ${DEPENDS_7} + +FILE_8=indx_dataops.o +DEPENDS_8:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1020,12 +892,14 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1036,7 +910,6 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1048,8 +921,8 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1059,19 +932,17 @@ DEPENDS_9:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SampleIndexData.h \ indx_dataops.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ +DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} -FILE_10=node_cplxtest.o -DEPENDS_10:=\ +${FILE_8}: ${DEPENDS_8} + +FILE_9=node_cplxtest.o +DEPENDS_9:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1107,12 +978,14 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1145,7 +1018,6 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1157,8 +1029,8 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1167,8 +1039,7 @@ DEPENDS_10:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h node_cplxtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ +DEPENDS_9 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -1187,137 +1058,13 @@ DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} -FILE_11=node_hierops.o -DEPENDS_11:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsComplex.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h node_hierops.C +${FILE_9}: ${DEPENDS_9} -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} - -FILE_12=node_hiertest.o -DEPENDS_12:=\ +FILE_10=node_hiertest.o +DEPENDS_10:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1353,12 +1100,14 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1391,7 +1140,6 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1403,8 +1151,8 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1413,8 +1161,7 @@ DEPENDS_12:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h node_hiertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ +DEPENDS_10 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -1433,14 +1180,13 @@ DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} -FILE_13=side_cplxtest.o -DEPENDS_13:=\ +${FILE_10}: ${DEPENDS_10} + +FILE_11=side_cplxtest.o +DEPENDS_11:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1476,12 +1222,14 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1514,7 +1262,6 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1526,8 +1273,8 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1536,8 +1283,7 @@ DEPENDS_13:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h side_cplxtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ +DEPENDS_11 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -1556,14 +1302,13 @@ DEPENDS_13 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} -FILE_14=side_hiertest.o -DEPENDS_14:=\ +${FILE_11}: ${DEPENDS_11} + +FILE_12=side_hiertest.o +DEPENDS_12:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ @@ -1599,12 +1344,14 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1637,7 +1384,6 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -1649,8 +1395,8 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -1659,8 +1405,7 @@ DEPENDS_14:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h side_hiertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_14 +=\ +DEPENDS_12 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -1679,9 +1424,8 @@ DEPENDS_14 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_14:X.o=${NDIM}.o}: ${DEPENDS_14} + +${FILE_12}: ${DEPENDS_12} diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.in b/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.in index 45413841..c6a25f29 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/dataops/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing patch data operations ## ######################################################################### @@ -14,22 +14,30 @@ SUBDIR = source/test/dataops VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA = -DDISPLAY -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA = -DDISPLAY -DTESTING=1 -ifneq (,$(findstring libdcomplex, "@SAMRAI_OPTIONAL_LIBS@ ")) - NUM_TESTS = 17 +ifneq (,$(findstring libdcomplex, $(SAMRAI_LIBRARY_TARGETS))) + NUM_TESTS = 24 else - NUM_TESTS = 11 + NUM_TESTS = 14 endif TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" +SampleIndexData.o: $(SAMRAI)/source/test/dataops/SampleIndexData.C + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(SAMRAI)/source/test/dataops/SampleIndexData.C -o $@ + +indx_dataops: indx_dataops.o SampleIndexData.o $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) indx_dataops.o SampleIndexData.o $(LIBSAMRAI2D) $(LIBSAMRAI) $(LDLIBS) -o $@ + cell_patchtest: cell_patchtest.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) cell_patchtest.o $(LIBSAMRAI2D) $(LIBSAMRAI) $(LDLIBS) -o $@ @@ -72,7 +80,8 @@ TARGETS2D= cell_patchtest \ face_hiertest \ node_hiertest \ side_hiertest \ - edge_hiertest + edge_hiertest \ + indx_dataops ifneq (,$(findstring complex, $(SAMRAI_LIBRARY_TARGETS))) TARGETS2D+= cell_cplxtest \ @@ -87,14 +96,10 @@ checkcompile: $(TARGETS2D) cell_hiertest check: $(MAKE) check2d - $(MAKE) check3d check2d: $(SAMRAI_LIBRARY_TARGETS) - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_patchtest 2; -check3d: cell_patchtest cell_hiertest - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_patchtest 3; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_hiertest 3; +check3d: $(SAMRAI_LIBRARY_TARGETS) libbool: @@ -102,17 +107,76 @@ libchar: libfloat: +# Note that tmp file names need to be distinct between targets +# libdcomplex and libdefault to prevent race conditions using parallel +# make. + libdcomplex: cell_cplxtest \ face_cplxtest \ node_cplxtest \ side_cplxtest \ edge_cplxtest - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_cplxtest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_cplxtest 3; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./face_cplxtest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./node_cplxtest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./edge_cplxtest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./side_cplxtest 2 + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_cplxtest 2 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_cplxtest 3 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./face_cplxtest 2 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./face_cplxtest 3 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./node_cplxtest 2 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./node_cplxtest 3 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./edge_cplxtest 2 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./edge_cplxtest 3 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./side_cplxtest 2 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./side_cplxtest 3 | $(TEE) foo-cplx; \ + if ! grep "PASSED" foo-cplx >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo-cplx libdefault: cell_patchtest \ @@ -120,27 +184,116 @@ libdefault: cell_patchtest \ face_hiertest \ node_hiertest \ side_hiertest \ - edge_hiertest - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_hiertest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_hiertest 3; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_patchtest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./cell_patchtest 3; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./face_hiertest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./node_hiertest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./edge_hiertest 2; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./side_hiertest 2 + edge_hiertest \ + indx_dataops + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./indx_dataops 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./indx_dataops 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_hiertest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_hiertest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_patchtest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./cell_patchtest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./face_hiertest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./face_hiertest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./node_hiertest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./node_hiertest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./edge_hiertest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./edge_hiertest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./side_hiertest 2 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./side_hiertest 3 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: clean-check - $(RM) *_hiertest* *_cplxtest* *_patchtest* +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) *_hiertest *_cplxtest *_patchtest *_dataops include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/README b/base/SAMRAI/SAMRAI/source/test/dataops/README index d8d4a09a..9f20d793 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/README +++ b/base/SAMRAI/SAMRAI/source/test/dataops/README @@ -3,67 +3,81 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for data operations test. +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: README file for data operations unit tests. ## ######################################################################### -The SAMRAI/source/test/dataops directory contains source code -to test the basic patch data operations. Each of these test programs -creates a 2 level patch hierarchy with 2 patches on each level. The -"hier"-tests test the operations associated with the built in C/C++ types -(e.g. addition, subtraction, etc.). The "cplx"-tests test the operations -associated with data types that are complex numbers. The "patch"-tests -test operations that are performed on subsets of the patches (in contrast -with previous "hier"- and "cplx"- test programs which test operations that -affect each patch its entirety). These test programs can only be run with -1 or 2 processors. +The SAMRAI/source/test/dataops directory contains source code to test the basic +patch data operations. Each of these test programs creates a 2 level patch +hierarchy with 2 patches on each level. The "hier"-tests test the operations +associated with the built in C/C++ types (e.g. addition, subtraction, etc.). +The "cplx"-tests test the operations associated with data types that are +complex numbers. The "patch"-tests test operations that are performed on +subsets of the patches (in contrast with previous "hier"- and "cplx"- test +programs which test operations that affect each patch in its entirety). -Compilation: - cell_patchtest - make cellpatchtest - cell_hiertest - make cellhiertest - cell_cplxtest - make cellcplx_test - face_patchtest - make facepatchtest - face_hiertest - make facehiertest - face_cplxtest - make facecplx_test - node_patchtest - make nodepatchtest - node_hiertest - make nodehiertest - node_cplxtest - make nodecplx_test -Execution: - serial - - cell_patchtest - ./cellpatchtest - cell_hiertest - ./cellhiertest - cell_cplxtest - ./cellcplx_test - face_patchtest - ./facepatchtest - face_hiertest - ./facehiertest - face_cplxtest - ./facecplx_test - node_patchtest - ./nodepatchtest - node_hiertest - ./nodehiertest - node_cplxtest - ./nodecplx_test - parallel - - cell_patchtest - mpirun -np [nec. options] cellpatchtest - cell_hiertest - mpirun -np [nec. options] cellhiertest - cell_cplxtest - mpirun -np [nec. options] cellcplx_test - face_patchtest - mpirun -np [nec. options] facepatchtest - face_hiertest - mpirun -np [nec. options] facehiertest - face_cplxtest - mpirun -np [nec. options] facecplx_test - node_patchtest - mpirun -np [nec. options] nodepatchtest - node_hiertest - mpirun -np [nec. options] nodehiertest - node_cplxtest - mpirun -np [nec. options] nodecplx_test +COMPILATION AND EXECUTION +------------------------- + Compilation: + cell_patchtest - make cell_patchtest + cell_hiertest - make cell_hiertest + cell_cplxtest - make cell_cplxtest + face_hiertest - make face_hiertest + face_cplxtest - make face_cplx_test + node_hiertest - make node_hiertest + node_cplxtest - make node_cplxtest + edge_hiertest - make edge_hiertest + edge_cplxtest - make edge_cplxtest + side_hiertest - make side_hiertest + side_cplxtest - make side_cplxtest + indx_dataops - make indx_dataops - The necessary options are those required by MPI to run the - executable. For example, on the CASC Sun Cluster, one needs - to specify the machines that will run the MPI processes in - a file and use the -machinefile option. + Execution: + All tests take 1 argument which is the dimension, 2 or 3. -Output: - cell_patchtest - cell_patchtest.log.* - cell_hiertest - cell_hiertest.log.* - cell_cplxtest - cell_cplxtest.log.* - face_patchtest - face_patchtest.log.* - face_hiertest - face_hiertest.log.* - face_cplxtest - face_cplxtest.log.* - node_patchtest - node_patchtest.log.* - node_hiertest - node_hiertest.log.* - node_cplxtest - node_cplxtest.log.* + serial: + cell_patchtest - ./cell_patchtest [2, 3] + cell_hiertest - ./cell_hiertest [2, 3] + cell_cplxtest - ./cell_cplxtest [2, 3] + face_hiertest - ./face_hiertest [2, 3] + face_cplxtest - ./face_cplxtest [2, 3] + node_hiertest - ./node_hiertest [2, 3] + node_cplxtest - ./node_cplxtest [2, 3] + edge_hiertest - ./edge_hiertest [2, 3] + edge_cplxtest - ./edge_cplxtest [2, 3] + side_hiertest - ./side_hiertest [2, 3] + side_cplxtest - ./side_cplxtest [2, 3] + indx_dataops - ./indx_dataops [2, 3] + parallel: + Parallel execution is platform dependent. These examples demonstrate + execution via mpirun. + cell_patchtest - mpirun -np [mpirun options] cell_patchtest [2, 3] + cell_hiertest - mpirun -np [mpirun options] cell_hiertest [2, 3] + cell_cplxtest - mpirun -np [mpirun options] cell_cplxtest [2, 3] + face_hiertest - mpirun -np [mpirun options] face_hiertest [2, 3] + face_cplxtest - mpirun -np [mpirun options] face_cplxtest [2, 3] + node_hiertest - mpirun -np [mpirun options] node_hiertest [2, 3] + node_cplxtest - mpirun -np [mpirun options] node_cplxtest [2, 3] + edge_hiertest - mpirun -np [mpirun options] edge_hiertest [2, 3] + edge_cplxtest - mpirun -np [mpirun options] edge_cplxtest [2, 3] + side_hiertest - mpirun -np [mpirun options] side_hiertest [2, 3] + side_cplxtest - mpirun -np [mpirun options] side_cplxtest [2, 3] + indx_dataops - mpirun -np [mpirun options] indx_dataops [2, 3] + + +OUTPUT +------ + cell_patchtest - cell_patchtest.[2,3]d.log.* + cell_hiertest - cell_hiertest.[2,3]d.log.* + cell_cplxtest - cell_cplxtest.[2,3]d.log.* + face_hiertest - face_hiertest.[2,3]d.log.* + face_cplxtest - face_cplxtest.[2,3]d.log.* + node_hiertest - node_hiertest.[2,3]d.log.* + node_cplxtest - node_cplxtest.[2,3]d.log.* + edge_hiertest - edge_hiertest.[2,3]d.log.* + edge_cplxtest - edge_cplxtest.[2,3]d.log.* + side_hiertest - side_hiertest.[2,3]d.log.* + side_cplxtest - side_cplxtest.[2,3]d.log.* + indx_dataops - indx_dataops.[2,3]d.log.* diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.C b/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.C index 49038e05..120560cc 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.C @@ -3,8 +3,9 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SampleIndexData example demonstrating IndexData type. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Example user defined index data type used in indx_dataops + * test. * ************************************************************************/ @@ -26,52 +27,11 @@ using namespace SAMRAI; -SampleIndexData::SampleIndexData( - const tbox::Dimension& dim): - d_index(dim), - d_dummy_int(0) -{ -} - -SampleIndexData::SampleIndexData( - const hier::Index& ic): - d_index(ic), +SampleIndexData::SampleIndexData(): d_dummy_int(0) { } -/* - ************************************************************************* - * - * Copy Constructor - * - ************************************************************************* - */ - -SampleIndexData::SampleIndexData( - const SampleIndexData& data): - d_index(data.d_index), - d_dummy_int(data.d_dummy_int) -{ - -} - -/* - ************************************************************************* - * - * Assignment operator - * - ************************************************************************* - */ - -SampleIndexData& SampleIndexData::operator = ( - const SampleIndexData& data) -{ - d_index = data.d_index; - d_dummy_int = data.d_dummy_int; - return *this; -} - /* ************************************************************************* * @@ -97,12 +57,6 @@ void SampleIndexData::setInt( d_dummy_int = dummy; } -void SampleIndexData::setIndex( - const hier::Index& index) -{ - d_index = index; -} - /* ************************************************************************* * @@ -115,31 +69,6 @@ int SampleIndexData::getInt() const return d_dummy_int; } -/* - ************************************************************************* - * - * Return index - * - ************************************************************************* - */ -const hier::Index& SampleIndexData::getIndex() const -{ - return d_index; -} - -/* - ************************************************************************* - * - * Print contents - * - ************************************************************************* - */ -void SampleIndexData::printClassData( - std::ostream& os) const -{ - os << "printing data"; -} - /* ************************************************************************* * @@ -149,10 +78,12 @@ void SampleIndexData::printClassData( ************************************************************************* */ void SampleIndexData::copySourceItem( - hier::Index& index, - SampleIndexData& src_item) + const hier::Index& index, + const hier::IntVector& src_offset, + const SampleIndexData& src_item) { - d_index = index; + NULL_USE(index); + NULL_USE(src_offset); d_dummy_int = src_item.d_dummy_int; } @@ -170,58 +101,27 @@ void SampleIndexData::copySourceItem( size_t SampleIndexData::getDataStreamSize() { - /* - * #bytes = - * d_index (int[NDIM]) + - * d_dummy_int (int) - */ - - int dim = d_index.getDim().getValue(); - size_t bytes = (dim + 1) * tbox::MessageStream::getSizeof(); - - return bytes; + return 0; } void SampleIndexData::packStream( tbox::MessageStream& stream) { - int counter = 0; - int dim = d_index.getDim().getValue(); - int ibuffer[dim + 1]; - for (int i = 0; i < dim; i++) { - ibuffer[i] = d_index(i); - counter++; - } - ibuffer[counter] = d_dummy_int; - stream.pack(ibuffer, dim + 1); - + NULL_USE(stream); } void SampleIndexData::unpackStream( tbox::MessageStream& stream, const hier::IntVector& offset) { - int counter = 0; - int dim = d_index.getDim().getValue(); - int ibuffer[dim + 1]; - stream.unpack(ibuffer, dim); - //pdat::CellIndex index; - hier::Index* index = new pdat::CellIndex(d_index.getDim()); - for (int i = 0; i < dim; i++) { - (*index)[i] = ibuffer[i]; - counter++; - } - *index += offset; - d_index = *index; - - d_dummy_int = ibuffer[counter]; - + NULL_USE(stream); + NULL_USE(offset); } /* ************************************************************************* * - * The putToDatabase() and getFromDatabase() methods + * The putToRestart() and getFromRestart() methods * are required to template SampleIndexData as IndexData type - i.e. * IndexData. They are used to write/read SampleIndexData, * data to/from the restart database. @@ -229,35 +129,16 @@ void SampleIndexData::unpackStream( ************************************************************************* */ -void SampleIndexData::putUnregisteredToDatabase( - const boost::shared_ptr& database) const +void SampleIndexData::putToRestart( + boost::shared_ptr& restart_db) const { - - int counter = 0; - int dim = d_index.getDim().getValue(); - int ibuffer[dim + 1]; - for (int i = 0; i < dim; i++) { - ibuffer[i] = d_index(i); - counter++; - } - ibuffer[counter] = d_dummy_int; - - database->putIntegerArray("ibuffer", ibuffer, dim + 1); - + NULL_USE(restart_db); } -void SampleIndexData::getFromDatabase( - const boost::shared_ptr& database) +void SampleIndexData::getFromRestart( + boost::shared_ptr& restart_db) { - int dim = d_index.getDim().getValue(); - int ibuffer[dim + 1]; - database->getIntegerArray("ibuffer", ibuffer, dim + 1); - hier::Index* index = new pdat::CellIndex(d_index.getDim()); - for (int i = 0; i < dim; i++) { - (*index)(i) = ibuffer[i]; - } - d_index = *index; - d_dummy_int = ibuffer[dim]; + NULL_USE(restart_db); } /* @@ -269,7 +150,6 @@ void SampleIndexData::getFromDatabase( */ //#include "SampleIndexData.h" -//#include "SAMRAI/tbox/Array.C" //#include "SAMRAI/pdat/IndexData.C" //#include "SAMRAI/pdat/IndexDataFactory.C" //#include "SAMRAI/pdat/IndexVariable.C" @@ -281,13 +161,13 @@ void SampleIndexData::getFromDatabase( //template class pdat::SparseDataFactory; //template class pdat::IndexData; //template class pdat::IndexDataFactory; -//template class pdat::IndexDataNode; -//template class pdat::IndexIterator; +//template class pdat::IndexDataNode; +//template class pdat::IndexIterator; //template class pdat::IndexVariable; -//template class tbox::Array; -//template class tbox::Array; +//template class std::vector >; -//template class boost::shared_ptr >; //template class boost::shared_ptr >; diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.h b/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.h index 30aaa353..96a9ba88 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.h +++ b/base/SAMRAI/SAMRAI/source/test/dataops/SampleIndexData.h @@ -3,8 +3,9 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Boundary cell struct for embedded boundary implementations + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Example user defined index data type used in indx_dataops + * test. * ************************************************************************/ @@ -20,7 +21,7 @@ #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/IOStream.h" -#include +#include "boost/shared_ptr.hpp" /** * The SampleClass struct holds some dummy data and methods. It's intent @@ -32,27 +33,7 @@ using namespace SAMRAI; class SampleIndexData { public: - SampleIndexData( - const tbox::Dimension& d); - /** - * Copy constructor. - */ - SampleIndexData( - const SampleIndexData& data); - - /** - * Constructor supplying cell index where data is defined. - */ - SampleIndexData( - const hier::Index& ic); -// const pdat::CellIndex& ic); - - /** - * The assignment operator copies the data of the argument cell. - */ - SampleIndexData& - operator = ( - const SampleIndexData& cell); + SampleIndexData(); /** * The destructor for SampleIndexData. @@ -66,49 +47,31 @@ class SampleIndexData setInt( const int dummy); - void - setIndex( - const hier::Index& index); - /** * Returns a dummy integer in this class. */ int getInt() const; - /** - * Returns the cell index where the index data is stored. - */ - //pdat::CellIndex - const hier::Index& - getIndex() const; - - /** - * Print class data representation when an unrecoverable run-time - * assertion is thrown. Or, when desired. - */ - void - printClassData( - std::ostream& os) const; - /** * The copySourceItem() method allows SampleIndexData to be a templated * data type for IndexData - i.e. IndexData. In * addition to this method, the other methods that must be defined are * getDataStreamSize(), packStream(), unpackStream() for communication, - * putToDatabase(), getFromDatabase for restart. These are described - * below. + * putToRestart(), getFromRestart() for restart. These are + * described below. */ void copySourceItem( - hier::Index& index, - SampleIndexData& src_item); + const hier::Index& index, + const hier::IntVector& src_offset, + const SampleIndexData& src_item); /** - * The following functions enable parallel communication with SampleIndexDatas. - * They are used in SAMRAI communication infrastructure to - * specify the number of bytes of data stored in each SampleIndexData object, - * and to pack and unpack the data to the specified stream. + * The following functions enable parallel communication with + * SampleIndexDatas. They are used in SAMRAI communication infrastructure + * to specify the number of bytes of data stored in each SampleIndexData + * object, and to pack and unpack the data to the specified stream. */ size_t getDataStreamSize(); @@ -125,19 +88,13 @@ class SampleIndexData * restart. */ void - getFromDatabase( - const boost::shared_ptr& database); + getFromRestart( + boost::shared_ptr& restart_db); void - putUnregisteredToDatabase( - const boost::shared_ptr& database) const; + putToRestart( + boost::shared_ptr& restart_db) const; private: - /* - * Cell index where SampleIndexData is defined. - */ - //pdat::CellIndex d_index; - hier::Index d_index; - /* * Dummy int data */ diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/cell_cplxtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/cell_cplxtest.C index 91e146e3..ba382ffc 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/cell_cplxtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/cell_cplxtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test cell-centered complex patch data ops * ************************************************************************/ @@ -44,6 +44,8 @@ #include #include +#include "boost/shared_ptr.hpp" + using namespace SAMRAI; /* Helper function declarations */ @@ -74,13 +76,13 @@ int main( TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } - const int d = atoi(argv[1]); + const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= SAMRAI_MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); const std::string log_fn = std::string("cell_cplxtest.") - + tbox::Utilities::intToString(dim, 1) + "d.log"; + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); /* @@ -91,8 +93,8 @@ int main( int ln, iv; // Make a dummy hierarchy domain - double lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double hi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; hier::Index clo0(dim); hier::Index chi0(dim); @@ -103,7 +105,7 @@ int main( hier::Index flo1(dim); hier::Index fhi1(dim); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { lo[i] = 0.0; clo0(i) = 0; flo0(i) = 4; @@ -128,18 +130,18 @@ int main( } } - hier::Box coarse0(clo0, chi0); - hier::Box coarse1(clo1, chi1); - hier::Box fine0(flo0, fhi0); - hier::Box fine1(flo1, fhi1); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); hier::IntVector ratio(dim, 2); - hier::BoxContainer coarse_domain(dim); - hier::BoxContainer fine_boxes(dim); - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_boxes.appendItem(fine0); - fine_boxes.appendItem(fine1); + hier::BoxContainer coarse_domain; + hier::BoxContainer fine_boxes; + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_boxes.pushBack(fine0); + fine_boxes.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -151,38 +153,42 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_boxes.getNumberOfBoxes(); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getRank()) { - layer0.addBox(hier::Box(*coarse_itr, ib, - layer0.getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, ib, 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getRank()) { - layer1.addBox(hier::Box(*fine_itr, ib, - layer1.getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, ib, 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -217,9 +223,9 @@ int main( cwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(cvindx[iv]); } } @@ -238,25 +244,29 @@ int main( 1)); boost::shared_ptr patch; - boost::shared_ptr pgeom; // Initialize control volume data for cell-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); + patch = *ip; + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); double cell_vol = dx[0]; - for (int i = 1; i < dim.getValue(); i++) { + for (int i = 1; i < dim.getValue(); ++i) { cell_vol *= dx[i]; } boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + TBOX_ASSERT(cvdata); cvdata->fillAll(cell_vol); if (ln == 0) cvdata->fillAll(0.0, (coarse_fine * patch->getBox())); } @@ -268,19 +278,21 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level for 2d. 0.001 and 0.000125 for 3d. bool vol_test_passed = true; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); - c != cend && vol_test_passed; - ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); + c != cend && vol_test_passed; ++c) { pdat::CellIndex cell_index = *c; if (ln == 0) { @@ -320,7 +332,7 @@ int main( } } if (!vol_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; @@ -331,7 +343,7 @@ int main( // Expected: norm = 0.5 double norm = cell_ops->sumControlVolumes(cvindx[0], cwgt_id); if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1b: math::HierarchyCellDataOpsComplex::sumControlVolumes()\n" << "Expected value = 0.5 , Computed value = " @@ -340,17 +352,17 @@ int main( // Test #2: math::HierarchyCellDataOpsComplex::numberOfEntries() // Expected: num_data_points = 90 in 2d, 660 in 3d - int num_data_points = cell_ops->numberOfEntries(cvindx[0]); + size_t num_data_points = cell_ops->numberOfEntries(cvindx[0]); { - int compare; + size_t compare; if ((dim == tbox::Dimension(2))) compare = 90; else compare = 660; if (num_data_points != compare) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #2: math::HierarchyCellDataOpsReal::numberOfEntries()\n" << "Expected value = " << compare @@ -364,7 +376,7 @@ int main( dcomplex val0 = dcomplex(2.0, 1.5); cell_ops->setToScalar(cvindx[0], val0); if (!complexDataSameAsValue(cvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyCellDataOpsComplex::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -376,7 +388,7 @@ int main( dcomplex val1(4.0, 3.0); cell_ops->setToScalar(cvindx[1], val1); if (!complexDataSameAsValue(cvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyCellDataOpsComplex::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -387,7 +399,7 @@ int main( // Expected: v2 = v1 = (4.0, 3.0) cell_ops->copyData(cvindx[2], cvindx[1]); if (!complexDataSameAsValue(cvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyCellDataOpsComplex::copyData()\n" << "Expected: v2 = v1 = " << val1 << std::endl; @@ -398,14 +410,14 @@ int main( // Expected: v0 = (4.0, 3.0), v1 = (2.0,1.5) cell_ops->swapData(cvindx[0], cvindx[1]); if (!complexDataSameAsValue(cvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyCellDataOpsComplex::swapData()\n" << "Expected: v0 = " << val1 << std::endl; cell_ops->printData(cvindx[0], tbox::plog); } if (!complexDataSameAsValue(cvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyCellDataOpsComplex::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -417,7 +429,7 @@ int main( cell_ops->scale(cvindx[2], 0.25, cvindx[2]); dcomplex val_scale(1.0, 0.75); if (!complexDataSameAsValue(cvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyCellDataOpsComplex::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -429,7 +441,7 @@ int main( cell_ops->add(cvindx[3], cvindx[0], cvindx[1]); dcomplex val_add(6.0, 4.5); if (!complexDataSameAsValue(cvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyCellDataOpsComplex::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -444,7 +456,7 @@ int main( cell_ops->subtract(cvindx[1], cvindx[3], cvindx[0]); dcomplex val_sub(6.0, 0.0); if (!complexDataSameAsValue(cvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyCellDataOpsComplex::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -456,7 +468,7 @@ int main( cell_ops->addScalar(cvindx[1], cvindx[1], dcomplex(0.0, -4.0)); dcomplex val_addScalar(6.0, -4.0); if (!complexDataSameAsValue(cvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyCellDataOpsComplex::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -468,7 +480,7 @@ int main( cell_ops->addScalar(cvindx[2], cvindx[2], dcomplex(0.0, 0.25)); val_addScalar = dcomplex(1.0, 1.0); if (!complexDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyCellDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -480,7 +492,7 @@ int main( cell_ops->addScalar(cvindx[2], cvindx[2], dcomplex(3.0, -4.0)); val_addScalar = dcomplex(4.0, -3.0); if (!complexDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9d: math::HierarchyCellDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -495,7 +507,7 @@ int main( cell_ops->multiply(cvindx[1], cvindx[3], cvindx[1]); dcomplex val_mult(3.0, -2.0); if (!complexDataSameAsValue(cvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyCellDataOpsComplex::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -507,7 +519,7 @@ int main( cell_ops->divide(cvindx[0], cvindx[2], cvindx[1]); dcomplex val_div(1.3846153846154, -0.076923076923077); if (!complexDataSameAsValue(cvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyCellDataOpsComplex::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -519,7 +531,7 @@ int main( cell_ops->reciprocal(cvindx[1], cvindx[1]); dcomplex val_rec(0.23076923076923, 0.15384615384615); if (!complexDataSameAsValue(cvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyCellDataOpsComplex::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -534,8 +546,10 @@ int main( hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - cdata = patch->getPatchData(cvindx[2]); + patch = *ip; + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[2])); + TBOX_ASSERT(cdata); hier::Index index0(dim, 2); hier::Index index1(dim, 3); index1(0) = 5; @@ -551,16 +565,17 @@ int main( bool bogus_value_test_passed = true; for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - cdata = patch->getPatchData(cvindx[2]); + patch = *ipp; + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[2])); + TBOX_ASSERT(cdata); hier::Index index0(dim, 2); hier::Index index1(dim, 3); index1(0) = 5; - pdat::CellIterator cend(cdata->getBox(), false); - for (pdat::CellIterator c(cdata->getBox(), true); - c != cend && bogus_value_test_passed; - ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(cdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cdata->getBox())); + c != cend && bogus_value_test_passed; ++c) { pdat::CellIndex cell_index = *c; if (cell_index == pdat::CellIndex(index0)) { @@ -586,7 +601,7 @@ int main( } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: Place some bogus values on coarse level" << std::endl; @@ -607,7 +622,7 @@ int main( compare = 4402.00337888; if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: math::HierarchyCellDataOpsComplex::L1Norm()" << " - w/o control weight\n" @@ -621,7 +636,7 @@ int main( // Expected: correct_l1_norm = 2.5 double correct_l1_norm = cell_ops->L1Norm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #15: math::HierarchyCellDataOpsComplex::L1Norm()" << " - w/control weight\n" @@ -633,7 +648,7 @@ int main( // Expected: l2_norm = 3.53553390593 double l2_norm = cell_ops->L2Norm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(l2_norm, 3.53553390593)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #16: math::HierarchyCellDataOpsComplex::L2Norm()\n" << "Expected value = 3.53553390593, Computed value = " @@ -644,7 +659,7 @@ int main( // Expected: bogus_max_norm = 1000.19998 double bogus_max_norm = cell_ops->maxNorm(cvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.19998)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchyCellDataOpsComplex::maxNorm() " << "- w/o control weight\n" @@ -656,7 +671,7 @@ int main( // Expected: max_norm = 5.0 double max_norm = cell_ops->maxNorm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 5.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyCellDataOpsComplex::maxNorm() " << "- w/control weight\n" @@ -675,7 +690,7 @@ int main( dcomplex(2.0, 0.0), cvindx[1], dcomplex(0.0, -1.0), cvindx[0]); dcomplex val_linearSum(2.0, 5.0); if (!complexDataSameAsValue(cvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyCellDataOpsComplex::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -687,7 +702,7 @@ int main( cell_ops->axmy(cvindx[3], 3.0, cvindx[1], cvindx[0]); dcomplex val_axmy(6.5, 12.0); if (!complexDataSameAsValue(cvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyCellDataOpsComplex::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -699,7 +714,7 @@ int main( dcomplex cdot = cell_ops->dot(cvindx[2], cvindx[1], cwgt_id); dcomplex ans_2_dot_1(8.75, -10.5); if (!tbox::MathUtilities::equalEps(cdot, ans_2_dot_1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21a: math::HierarchyCellDataOpsComplex::dot()\n" << "Expected value = (8.75,-10.5), Computed value = " @@ -711,7 +726,7 @@ int main( dcomplex cdot2 = cell_ops->dot(cvindx[1], cvindx[2], cwgt_id); dcomplex ans_1_dot_2(8.75, 10.5); if (!tbox::MathUtilities::equalEps(cdot2, ans_1_dot_2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21b: math::HierarchyCellDataOpsComplex::dot()\n" << "Expected value = (8.75,10.5), Computed value = " @@ -723,7 +738,7 @@ int main( cell_ops->setToScalar(cvindx[0], dcomplex(4.0, -3.0)); cell_ops->abs(cwgt_id, cvindx[0]); if (!doubleDataSameAsValue(cwgt_id, 5.0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::HierarchyCellDataOpsComplex::abs()\n" << "Expected: abs(v0) = 5.0" << std::endl; @@ -731,20 +746,20 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { cvar[iv].reset(); } cwgt.reset(); geometry.reset(); - hierarchy.set(); + hierarchy.reset(); cell_ops.reset(); cwgt_ops.reset(); @@ -774,16 +789,19 @@ complexDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); + TBOX_ASSERT(cvdata); + + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); c != cend && test_passed; ++c) { pdat::CellIndex cell_index = *c; if (!tbox::MathUtilities::equalEps((*cvdata)(cell_index), @@ -810,17 +828,20 @@ doubleDataSameAsValue( bool test_passed = true; int ln; - boost::shared_ptr patch - for (ln = 0; ln < 2; ln++) { + boost::shared_ptr patch; + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); c != cend && test_passed; ++c) { pdat::CellIndex cell_index = *c; if (!tbox::MathUtilities::equalEps((*cvdata)(cell_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/cell_hierops.C b/base/SAMRAI/SAMRAI/source/test/dataops/cell_hierops.C deleted file mode 100644 index 0c5d926a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dataops/cell_hierops.C +++ /dev/null @@ -1,679 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Main program to test cell-centered patch data ops - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" - -#include -#include -#include -#include -using namespace std; - -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" - -#include "SAMRAI/tbox/SAMRAIManager.h" - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/BoxArray.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/math/HierarchyDataOpsComplex.h" -#include "SAMRAI/math/HierarchyCellDataOpsComplex.h" -#include "SAMRAI/math/HierarchyDataOpsReal.h" -#include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include "SAMRAI/pdat/CellIndex.h" -#include "SAMRAI/pdat/CellIterator.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchDescriptor.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/ProcessorMapping.h" -#include "SAMRAI/tbox/Complex.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/hier/VariableContext.h" - -#include - -using namespace SAMRAI; - -/* Helper function declarations */ -bool -doubleDataSameAsValue( - int desc_id, - double value, - boost::shared_ptr hierarchy); - -#define NVARS 4 - -int main( - int argc, - char* argv[]) { - tbox::SAMRAI_MPI::init(&argc, &argv); - tbox::SAMRAIManager::initialize(); - tbox::SAMRAIManager::startup(); - - /* - * Create block to force pointer deallocation. If this is not done - * then there will be memory leaks reported. - */ - { - -// tbox::PIO::logOnlyNodeZero("cell_hierops.log"); - tbox::PIO::logAllNodes("cell_hierops.log"); - - int ln, iv; - - /* - * Make a simple 2-level hierarchy. - */ - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box<2> coarse0(hier::Index<2>(0, 0), hier::Index<2>(9, 2)); - hier::Box<2> coarse1(hier::Index<2>(0, 3), hier::Index<2>(9, 4)); - hier::Box<2> fine0(hier::Index<2>(4, 4), hier::Index<2>(7, 7)); - hier::Box<2> fine1(hier::Index<2>(8, 4), hier::Index<2>(13, 7)); - hier::IntVector<2> ratio(2); - - hier::BoxArray<2> coarse_domain(2); - hier::BoxArray<2> fine_domain(2); - coarse_domain[0] = coarse0; - coarse_domain[1] = coarse1; - fine_domain[0] = fine0; - fine_domain[1] = fine1; - - boost::shared_ptr geometry( - new geom::CartesianGridGeometry( - "CartesianGeometry", - lo, - hi, - coarse_domain)); - - boost::shared_ptr hierarchy( - new hier::PatchHierarchy("PatchHierarchy", geometry)); - - // Note: For these simple tests we allow at most 2 processors. - tbox::SAMRAI_MPI mpi(SAMRAIManager::getSAMRAICommWorld()); - const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_domain.getNumberOfBoxes(); - hier::ProcessorMapping mapping0(n_coarse_boxes); - hier::ProcessorMapping mapping1(n_fine_boxes); - - int ib; - for (ib = 0; ib < n_coarse_boxes; ib++) { - if (nproc > 1) { - mapping0.setProcessorAssignment(ib, ib); - } else { - mapping0.setProcessorAssignment(ib, 0); - } - } - - for (ib = 0; ib < n_fine_boxes; ib++) { - if (nproc > 1) { - mapping1.setProcessorAssignment(ib, ib); - } else { - mapping1.setProcessorAssignment(ib, 0); - } - } - - hierarchy->makeNewPatchLevel(0, hier::IntVector<2>( - 1), coarse_domain, mapping0); - hierarchy->makeNewPatchLevel(1, ratio, fine_domain, mapping1); - - /* - * Create some variables, a context, and register them with - * the variable database. - */ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - boost::shared_ptr dummy( - variable_db->getContext("dummy")); - const hier::IntVector<2> no_ghosts(0); - - boost::shared_ptr > cvar[NVARS]; - int cvindx[NVARS]; - cvar[0].reset(new pdat::CellVariable("cvar0", 1)); - cvindx[0] = variable_db->registerVariableAndContext( - cvar[0], dummy, no_ghosts); - cvar[1].reset(new pdat::CellVariable("cvar1", 1)); - cvindx[1] = variable_db->registerVariableAndContext( - cvar[1], dummy, no_ghosts); - cvar[2].reset(new pdat::CellVariable("cvar2", 1)); - cvindx[2] = variable_db->registerVariableAndContext( - cvar[2], dummy, no_ghosts); - cvar[3].reset(new pdat::CellVariable("cvar3", 1)); - cvindx[3] = variable_db->registerVariableAndContext( - cvar[3], dummy, no_ghosts); - - boost::shared_ptr > cwgt( - new pdat::CellVariable("cwgt", 1); - int cwgt_id = variable_db->registerVariableAndContext( - cwgt, dummy, no_ghosts); - - // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { - hierarchy->getPatchLevel(ln)->allocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { - hierarchy->getPatchLevel(ln)->allocatePatchData(cvindx[iv]); - } - } - - /* - * Create instances of hierarchy operations to apply certain - * mathematical operators. e.g. scale(), axpy(), min(), etc. - */ - int coarsest = 0; - int finest = 1; - boost::shared_ptr > cell_ops( - new math::HierarchyCellDataOpsReal( - hierarchy, - coarsest, - finest)); - TBOX_ASSERT(cell_ops); - - boost::shared_ptr > cwgt_ops( - new math::HierarchyCellDataOpsReal( - hierarchy, - coarsest, - finest)); - - boost::shared_ptr patch; - boost::shared_ptr pgeom; - - // Initialize control volume data for cell-centered components - hier::Box<2> coarse_fine = fine0 + fine1; - coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { - boost::shared_ptr level( - hierarchy->getPatchLevel(ln)); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); - const double* dx = pgeom->getDx(); - const double cell_vol = dx[0] * dx[1]; - boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id)); - cvdata->fillAll(cell_vol); - if (ln == 0) cvdata->fillAll(0.0, (coarse_fine * patch->getBox())); - } - } - - /* - * Apply various operations to the hierarchy data. Test the - * result to assure its accuracy. - */ - // Test #1a: Check control volume data set properly - // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and - // 0.0025 on fine level - bool vol_test_passed = true; - for (ln = 0; ln < 2; ln++) { - - boost::shared_ptr level( - hierarchy->getPatchLevel(ln)); - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id)); - - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); - c != cend && vol_test_passed; - ++c) { - pdat::CellIndex cell_index = *c; - - if (ln == 0) { - if ((coarse_fine * patch->getBox()).contains(cell_index)) { - if (!tbox::MathUtilities::equalEps((*cvdata)( - cell_index), 0.0)) { - vol_test_passed = false; - } - } else { - if (!tbox::MathUtilities::equalEps((*cvdata)( - cell_index), 0.01)) { - vol_test_passed = false; - } - } - } - - if (ln == 1) { - if (!tbox::MathUtilities::equalEps((*cvdata)( - cell_index), 0.0025)) { - vol_test_passed = false; - } - } - } - } - } - if (!vol_test_passed) { - tbox::perr - << "FAILED: - Test #1a: Check control volume data set properly" - << endl; - cwgt_ops->printData(cwgt_id, tbox::pout); - } - - // Test #1b: HierarchyCellDataOpsReal2::sumControlVolumes() - // Expected: norm = 0.5 - double norm = cell_ops->sumControlVolumes(cvindx[0], cwgt_id); - if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - tbox::perr - << "FAILED: - Test #1b: HierarchyCellDataOpsReal2::sumControlVolumes()\n" - << "Expected value = 0.5 , Computed value = " - << norm << endl; - } - - // Test #2: HierarchyCellDataOpsReal2::numberOfEntries() - // Expected: num_data_points = 90 - int num_data_points = cell_ops->numberOfEntries(cvindx[0]); - if (num_data_points != 90) { - tbox::perr - << "FAILED: - Test #2: HierarchyCellDataOpsReal2::numberOfEntries()\n" - << "Expected value = 90 , Computed value = " - << num_data_points << endl; - } - - // Test #3a: HierarchyCellDataOpsReal2::setToScalar() - // Expected: v0 = 2.0 - double val0 = 2.0; - cell_ops->setToScalar(cvindx[0], val0); - if (!doubleDataSameAsValue(cvindx[0], val0, hierarchy)) { - tbox::perr - << "FAILED: - Test #3a: HierarchyCellDataOpsReal2::setToScalar()\n" - << "Expected: v0 = " << val0 << endl; - cell_ops->printData(cvindx[0], tbox::pout); - } - - // Test #3b: HierarchyCellDataOpsReal2::setToScalar() - // Expected: v1 = (4.0) - cell_ops->setToScalar(cvindx[1], 4.0); - double val1 = 4.0; - if (!doubleDataSameAsValue(cvindx[1], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #3b: HierarchyCellDataOpsReal2::setToScalar()\n" - << "Expected: v1 = " << val1 << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #4: HierarchyCellDataOpsReal2::copyData() - // Expected: v2 = v1 = (4.0) - cell_ops->copyData(cvindx[2], cvindx[1]); - if (!doubleDataSameAsValue(cvindx[2], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #4: HierarchyCellDataOpsReal2::copyData()\n" - << "Expected: v2 = " << val1 << endl; - cell_ops->printData(cvindx[2], tbox::pout); - } - - // Test #5: HierarchyCellDataOpsReal2::swapData() - // Expected: v0 = (4.0), v1 = (2.0) - cell_ops->swapData(cvindx[0], cvindx[1]); - if (!doubleDataSameAsValue(cvindx[0], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #5a: HierarchyCellDataOpsReal2::swapData()\n" - << "Expected: v0 = " << val1 << endl; - cell_ops->printData(cvindx[0], tbox::pout); - } - if (!doubleDataSameAsValue(cvindx[1], val0, hierarchy)) { - tbox::perr - << "FAILED: - Test #5b: HierarchyCellDataOpsReal2::swapData()\n" - << "Expected: v1 = " << val0 << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #6: HierarchyCellDataOpsReal2::scale() - // Expected: v2 = 0.25 * v2 = (1.0) - cell_ops->scale(cvindx[2], 0.25, cvindx[2]); - double val_scale = 1.0; - if (!doubleDataSameAsValue(cvindx[2], val_scale, hierarchy)) { - tbox::perr - << "FAILED: - Test #6: HierarchyCellDataOpsReal2::scale()\n" - << "Expected: v2 = " << val_scale << endl; - cell_ops->printData(cvindx[2], tbox::pout); - } - - // Test #7: HierarchyCellDataOpsReal2::add() - // Expected: v3 = v0 + v1 = (6.0) - cell_ops->add(cvindx[3], cvindx[0], cvindx[1]); - double val_add = 6.0; - if (!doubleDataSameAsValue(cvindx[3], val_add, hierarchy)) { - tbox::perr << "FAILED: - Test #7: HierarchyCellDataOpsReal2::add()\n" - << "Expected: v3 = " << val_add << endl; - cell_ops->printData(cvindx[3], tbox::pout); - } - - // Reset v0: v0 = (0.0) - cell_ops->setToScalar(cvindx[0], 0.0); - - // Test #8: HierarchyCellDataOpsReal2::subtract() - // Expected: v1 = v3 - v0 = (6.0) - cell_ops->subtract(cvindx[1], cvindx[3], cvindx[0]); - double val_sub = 6.0; - if (!doubleDataSameAsValue(cvindx[1], val_sub, hierarchy)) { - tbox::perr - << "FAILED: - Test #8: HierarchyCellDataOpsReal2::subtract()\n" - << "Expected: v1 = " << val_sub << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #9a: HierarchyCellDataOpsReal2::addScalar() - // Expected: v1 = v1 + (0.0) = (6.0) - cell_ops->addScalar(cvindx[1], cvindx[1], 0.0); - double val_addScalar = 6.0; - if (!doubleDataSameAsValue(cvindx[1], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9a: HierarchyCellDataOpsReal2::addScalar()\n" - << "Expected: v1 = " << val_addScalar << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #9b: HierarchyCellDataOpsReal2::addScalar() - // Expected: v2 = v2 + (0.0) = (1.0) - cell_ops->addScalar(cvindx[2], cvindx[2], 0.0); - val_addScalar = 1.0; - if (!doubleDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9b: HierarchyCellDataOpsReal2::addScalar()\n" - << "Expected: v2 = " << val_addScalar << endl; - cell_ops->printData(cvindx[2], tbox::pout); - } - - // Test #9c: HierarchyCellDataOpsReal2::addScalar() - // Expected: v2 = v2 + (3.0) = (4.0) - cell_ops->addScalar(cvindx[2], cvindx[2], 3.0); - val_addScalar = 4.0; - if (!doubleDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9c: HierarchyCellDataOpsReal2::addScalar()\n" - << "Expected: v2 = " << val_addScalar << endl; - cell_ops->printData(cvindx[2], tbox::pout); - } - - // Reset v3: v3 = (0.5) - cell_ops->setToScalar(cvindx[3], 0.5); - - // Test #10: HierarchyCellDataOpsReal2::multiply() - // Expected: v1 = v3 * v1 = (3.0) - cell_ops->multiply(cvindx[1], cvindx[3], cvindx[1]); - double val_mult = 3.0; - if (!doubleDataSameAsValue(cvindx[1], val_mult, hierarchy)) { - tbox::perr - << "FAILED: - Test #10: HierarchyCellDataOpsReal2::multiply()\n" - << "Expected: v1 = " << val_mult << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #11: HierarchyCellDataOpsReal2::divide() - // Expected: v0 = v2 / v1 = 1.3333333333 - cell_ops->divide(cvindx[0], cvindx[2], cvindx[1]); - double val_div = 1.33333333333; - if (!doubleDataSameAsValue(cvindx[0], val_div, hierarchy)) { - tbox::perr - << "FAILED: - Test #11: HierarchyCellDataOpsReal2::divide()\n" - << "Expected: v0 = " << val_div << endl; - cell_ops->printData(cvindx[0], tbox::pout); - } - - // Test #12: HierarchyCellDataOpsReal2::reciprocal() - // Expected: v1 = 1 / v1 = (0.333333333) - cell_ops->reciprocal(cvindx[1], cvindx[1]); - double val_rec = 0.33333333333; - if (!doubleDataSameAsValue(cvindx[1], val_rec, hierarchy)) { - tbox::perr - << "FAILED: - Test #12: HierarchyCellDataOpsReal2::reciprocal()\n" - << "Expected: v1 = " << val_rec << endl; - cell_ops->printData(cvindx[1], tbox::pout); - } - - // Test #13: HierarchyCellDataOpsReal2::abs() - // Expected: v3 = abs(v2) = 4.0 - cell_ops->abs(cvindx[3], cvindx[2]); - double val_abs = 4.0; - if (!doubleDataSameAsValue(cvindx[3], val_abs, hierarchy)) { - tbox::perr << "FAILED: - Test #13: HierarchyCellDataOpsReal2::abs()\n" - << "Expected: v3 = " << val_abs << endl; - cell_ops->printData(cvindx[3], tbox::pout); - } - - // Test #14: Place some bogus values on coarse level - boost::shared_ptr > cdata; - - // set values - boost::shared_ptr level(hierarchy->getPatchLevel(0)); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - cdata = patch->getPatchData(cvindx[2]); - hier::Index<2> index0(2, 2); - hier::Index<2> index1(5, 3); - if (patch->getBox().contains(index0)) { - (*cdata)(pdat::CellIndex(index0), 0) = 100.0; - } - if (patch->getBox().contains(index1)) { - (*cdata)(pdat::CellIndex(index1), 0) = -1000.0; - } - } - - // check values - bool bogus_value_test_passed = true; - for (hier::PatchLevel::iterator ipp(level->begin()); - ipp != level->end(); ++ipp) { - patch = level->getPatch(ipp()); - cdata = patch->getPatchData(cvindx[2]); - hier::Index<2> index0(2, 2); - hier::Index<2> index1(5, 3); - - pdat::CellIterator cend(cdata->getBox(), false); - for (pdat::CellIterator c(cdata->getBox(), true); - c != cend && bogus_value_test_passed; - ++c) { - pdat::CellIndex cell_index = *c; - - if (cell_index == index0) { - if (!tbox::MathUtilities::equalEps((*cdata)(cell_index), - 100.0)) { - bogus_value_test_passed = false; - } - } else { - if (cell_index == index1) { - if (!tbox::MathUtilities::equalEps((*cdata)( - cell_index), -1000.0)) { - bogus_value_test_passed = false; - } - } else { - if (!tbox::MathUtilities::equalEps((*cdata)( - cell_index), 4.0)) { - bogus_value_test_passed = false; - } - } - } - } - } - if (!bogus_value_test_passed) { - tbox::perr - << "FAILED: - Test #14: Place some bogus values on coarse level" - << endl; - cell_ops->printData(cvindx[2], tbox::pout); - } - - // Test #15: HierarchyCellDataOpsReal2::L1Norm() - w/o control weight - // Expected: bogus_l1_norm = 1452 - double bogus_l1_norm = cell_ops->L1Norm(cvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1452)) { - tbox::perr - << "FAILED: - Test #15: HierarchyCellDataOpsReal2::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 1452, Computed value = " - << setprecision(12) << bogus_l1_norm << endl; - } - - // Test #16: HierarchyCellDataOpsReal2::L1Norm() - w/control weight - // Expected: correct_l1_norm = 2.0 - double correct_l1_norm = cell_ops->L1Norm(cvindx[2], cwgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.0)) { - tbox::perr - << "FAILED: - Test #16: HierarchyCellDataOpsReal2::L1Norm()" - << " - w/control weight\n" - << "Expected value = 2.0, Computed value = " - << correct_l1_norm << endl; - } - - // Test #17: HierarchyCellDataOpsReal2::L2Norm() - // Expected: l2_norm = 2.82842712475 - double l2_norm = cell_ops->L2Norm(cvindx[2], cwgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 2.82842712475)) { - tbox::perr - << "FAILED: - Test #17: HierarchyCellDataOpsReal2::L2Norm()\n" - << "Expected value = 2.82842712475, Computed value = " - << l2_norm << endl; - } - - // Test #18: HierarchyCellDataOpsReal2::L2Norm() - w/o control weight - // Expected: bogus_max_norm = 1000.0 - double bogus_max_norm = cell_ops->maxNorm(cvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - tbox::perr - << "FAILED: - Test #18: HierarchyCellDataOpsReal2::L2Norm()" - << " - w/o control weight\n" - << "Expected value = 1000.0, Computed value = " - << bogus_max_norm << endl; - } - - // Test #19: HierarchyCellDataOpsReal2::L2Norm() - w/control weight - // Expected: max_norm = 4.0 - double max_norm = cell_ops->maxNorm(cvindx[2], cwgt_id); - if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - tbox::perr - << "FAILED: - Test #19: HierarchyCellDataOpsReal2::L2Norm()" - << " - w/control weight\n" - << "Expected value = 4.0, Computed value = " - << max_norm << endl; - } - - // Reset data and test sums, axpy's - cell_ops->setToScalar(cvindx[0], 1.00); - cell_ops->setToScalar(cvindx[1], 2.5); - cell_ops->setToScalar(cvindx[2], 7.0); - - // Test #20: HierarchyCellDataOpsReal2::linearSum() - // Expected: v3 = 5.0 - cell_ops->linearSum(cvindx[3], 2.0, cvindx[1], 0.00, cvindx[0]); - double val_linearSum = 5.0; - if (!doubleDataSameAsValue(cvindx[3], val_linearSum, hierarchy)) { - tbox::perr - << "FAILED: - Test #20: HierarchyCellDataOpsReal2::linearSum()\n" - << "Expected: v3 = " << val_linearSum << endl; - cell_ops->printData(cvindx[3], tbox::pout); - } - - // Test #21: HierarchyCellDataOpsReal2::axmy() - // Expected: v3 = 6.5 - cell_ops->axmy(cvindx[3], 3.0, cvindx[1], cvindx[0]); - double val_axmy = 6.5; - if (!doubleDataSameAsValue(cvindx[3], val_axmy, hierarchy)) { - tbox::perr - << "FAILED: - Test #21: HierarchyCellDataOpsReal2::axmy()\n" - << "Expected: v3 = " << val_axmy << endl; - cell_ops->printData(cvindx[3], tbox::pout); - } - - // Test #22a: HierarchyCellDataOpsReal2::dot() - (ind2) * (ind1) - // Expected: cdot = 8.75 - double cdot = cell_ops->dot(cvindx[2], cvindx[1], cwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - tbox::perr - << "FAILED: - Test #22a: HierarchyCellDataOpsReal2::dot() - (ind2) * (ind1)\n" - << "Expected Value = 8.75, Computed Value = " - << cdot << endl; - } - - // Test #22b: HierarchyCellDataOpsReal2::dot() - (ind1) * (ind2) - // Expected: cdot = 8.75 - cdot = cell_ops->dot(cvindx[1], cvindx[2], cwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - tbox::perr - << "FAILED: - Test #22b: HierarchyCellDataOpsReal2::dot() - (ind1) * (ind2)\n" - << "Expected Value = 8.75, Computed Value = " - << cdot << endl; - } - - // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { - hierarchy->getPatchLevel(ln)->deallocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { - hierarchy->getPatchLevel(ln)->deallocatePatchData(cvindx[iv]); - } - } - - for (iv = 0; iv < NVARS; iv++) { - cvar[iv].reset(); - } - cwgt.reset(); - - geometry.reset(); - hierarchy.reset(); - cell_ops.reset(); - cwgt_ops.reset(); - - } - - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - - return 0; -} - -/* - * Returns true if all the data in the hierarchy is equal to the specified - * value. Returns false otherwise. - */ -bool -doubleDataSameAsValue( - int desc_id, - double value, - boost::shared_ptr hierarchy) -{ - bool test_passed = true; - - int ln; - boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { - boost::shared_ptr level(hierarchy->getPatchLevel(ln)); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - boost::shared_ptr > cvdata( - patch->getPatchData(desc_id)); - - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); - c != cend && test_passed; ++c) { - pdat::CellIndex cell_index = *c; - if (!tbox::MathUtilities::equalEps((*cvdata)(cell_index), - value)) { - test_passed = false; - } - } - } - } - - return test_passed; -} diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/cell_hiertest.C b/base/SAMRAI/SAMRAI/source/test/dataops/cell_hiertest.C index 7924de24..0ee0e0c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/cell_hiertest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/cell_hiertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test cell-centered patch data ops * ************************************************************************/ @@ -41,7 +41,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -71,7 +71,7 @@ int main( const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); const std::string log_fn = std::string("cell_hiertest.") @@ -87,8 +87,8 @@ int main( int ln, iv; // Make a dummy hierarchy domain - double lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double hi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; hier::Index clo0(dim); hier::Index chi0(dim); @@ -99,7 +99,7 @@ int main( hier::Index flo1(dim); hier::Index fhi1(dim); - for (int i = 0; i < dim.getValue(); i++) { + for (int i = 0; i < dim.getValue(); ++i) { lo[i] = 0.0; clo0(i) = 0; flo0(i) = 4; @@ -130,11 +130,6 @@ int main( hier::Box fine1(flo1, fhi1, hier::BlockId(0)); hier::IntVector ratio(dim, 2); - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); - hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; coarse_domain.pushBack(coarse0); @@ -155,37 +150,38 @@ int main( hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); - // Note: For these simple tests we allow at most 2 processors. const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -220,9 +216,9 @@ int main( cwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(cvindx[iv]); } } @@ -245,23 +241,25 @@ int main( // Initialize control volume data for cell-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr pgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); double cell_vol = dx[0]; - for (int i = 1; i < dim.getValue(); i++) { + for (int i = 1; i < dim.getValue(); ++i) { cell_vol *= dx[i]; } boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + TBOX_ASSERT(cvdata); cvdata->fillAll(cell_vol); if (ln == 0) cvdata->fillAll(0.0, (coarse_fine * patch->getBox())); } @@ -273,7 +271,7 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level bool vol_test_passed = true; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); @@ -281,11 +279,13 @@ int main( ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); c != cend && vol_test_passed; ++c) { pdat::CellIndex cell_index = *c; @@ -313,18 +313,18 @@ int main( } } if (!vol_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; - cwgt_ops->printData(cwgt_id, tbox::pout); + cwgt_ops->printData(cwgt_id, tbox::plog); } // Test #1b: math::HierarchyCellDataOpsReal::sumControlVolumes() // Expected: norm = 0.5 double norm = cell_ops->sumControlVolumes(cvindx[0], cwgt_id); if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1b: math::HierarchyCellDataOpsReal::sumControlVolumes()\n" << "Expected value = 0.5 , Computed value = " @@ -333,9 +333,9 @@ int main( // Test #2: math::HierarchyCellDataOpsReal::numberOfEntries() // Expected: num_data_points = 90 for 2D, 660 for 3D - int num_data_points = cell_ops->numberOfEntries(cvindx[0]); + size_t num_data_points = cell_ops->numberOfEntries(cvindx[0]); if (num_data_points != ((dim == tbox::Dimension(2)) ? 90 : 660)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #2: math::HierarchyCellDataOpsReal::numberOfEntries()\n" << "Expected value = " << ((dim == tbox::Dimension(2)) ? 90 : 660) @@ -347,11 +347,11 @@ int main( double val0 = 2.0; cell_ops->setToScalar(cvindx[0], val0); if (!doubleDataSameAsValue(cvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyCellDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; - cell_ops->printData(cvindx[0], tbox::pout); + cell_ops->printData(cvindx[0], tbox::plog); } // Test #3b: math::HierarchyCellDataOpsReal::setToScalar() @@ -359,40 +359,40 @@ int main( cell_ops->setToScalar(cvindx[1], 4.0); double val1 = 4.0; if (!doubleDataSameAsValue(cvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyCellDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #4: math::HierarchyCellDataOpsReal::copyData() // Expected: v2 = v1 = (4.0) cell_ops->copyData(cvindx[2], cvindx[1]); if (!doubleDataSameAsValue(cvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyCellDataOpsReal::copyData()\n" << "Expected: v2 = " << val1 << std::endl; - cell_ops->printData(cvindx[2], tbox::pout); + cell_ops->printData(cvindx[2], tbox::plog); } // Test #5: math::HierarchyCellDataOpsReal::swapData() // Expected: v0 = (4.0), v1 = (2.0) cell_ops->swapData(cvindx[0], cvindx[1]); if (!doubleDataSameAsValue(cvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyCellDataOpsReal::swapData()\n" << "Expected: v0 = " << val1 << std::endl; - cell_ops->printData(cvindx[0], tbox::pout); + cell_ops->printData(cvindx[0], tbox::plog); } if (!doubleDataSameAsValue(cvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyCellDataOpsReal::swapData()\n" << "Expected: v1 = " << val0 << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #6: math::HierarchyCellDataOpsReal::scale() @@ -400,11 +400,11 @@ int main( cell_ops->scale(cvindx[2], 0.25, cvindx[2]); double val_scale = 1.0; if (!doubleDataSameAsValue(cvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyCellDataOpsReal::scale()\n" << "Expected: v2 = " << val_scale << std::endl; - cell_ops->printData(cvindx[2], tbox::pout); + cell_ops->printData(cvindx[2], tbox::plog); } // Test #7: math::HierarchyCellDataOpsReal::add() @@ -412,11 +412,11 @@ int main( cell_ops->add(cvindx[3], cvindx[0], cvindx[1]); double val_add = 6.0; if (!doubleDataSameAsValue(cvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyCellDataOpsReal::add()\n" << "Expected: v3 = " << val_add << std::endl; - cell_ops->printData(cvindx[3], tbox::pout); + cell_ops->printData(cvindx[3], tbox::plog); } // Reset v0: v0 = (0.0) @@ -427,11 +427,11 @@ int main( cell_ops->subtract(cvindx[1], cvindx[3], cvindx[0]); double val_sub = 6.0; if (!doubleDataSameAsValue(cvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyCellDataOpsReal::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #9a: math::HierarchyCellDataOpsReal::addScalar() @@ -439,11 +439,11 @@ int main( cell_ops->addScalar(cvindx[1], cvindx[1], 0.0); double val_addScalar = 6.0; if (!doubleDataSameAsValue(cvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyCellDataOpsReal::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #9b: math::HierarchyCellDataOpsReal::addScalar() @@ -451,11 +451,11 @@ int main( cell_ops->addScalar(cvindx[2], cvindx[2], 0.0); val_addScalar = 1.0; if (!doubleDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyCellDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; - cell_ops->printData(cvindx[2], tbox::pout); + cell_ops->printData(cvindx[2], tbox::plog); } // Test #9c: math::HierarchyCellDataOpsReal::addScalar() @@ -463,11 +463,11 @@ int main( cell_ops->addScalar(cvindx[2], cvindx[2], 3.0); val_addScalar = 4.0; if (!doubleDataSameAsValue(cvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyCellDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; - cell_ops->printData(cvindx[2], tbox::pout); + cell_ops->printData(cvindx[2], tbox::plog); } // Reset v3: v3 = (0.5) @@ -478,11 +478,11 @@ int main( cell_ops->multiply(cvindx[1], cvindx[3], cvindx[1]); double val_mult = 3.0; if (!doubleDataSameAsValue(cvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyCellDataOpsReal::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #11: math::HierarchyCellDataOpsReal::divide() @@ -490,11 +490,11 @@ int main( cell_ops->divide(cvindx[0], cvindx[2], cvindx[1]); double val_div = 1.33333333333; if (!doubleDataSameAsValue(cvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyCellDataOpsReal::divide()\n" << "Expected: v0 = " << val_div << std::endl; - cell_ops->printData(cvindx[0], tbox::pout); + cell_ops->printData(cvindx[0], tbox::plog); } // Test #12: math::HierarchyCellDataOpsReal::reciprocal() @@ -502,11 +502,11 @@ int main( cell_ops->reciprocal(cvindx[1], cvindx[1]); double val_rec = 0.33333333333; if (!doubleDataSameAsValue(cvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyCellDataOpsReal::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; - cell_ops->printData(cvindx[1], tbox::pout); + cell_ops->printData(cvindx[1], tbox::plog); } // Test #13: math::HierarchyCellDataOpsReal::abs() @@ -514,11 +514,11 @@ int main( cell_ops->abs(cvindx[3], cvindx[2]); double val_abs = 4.0; if (!doubleDataSameAsValue(cvindx[3], val_abs, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: math::HierarchyCellDataOpsReal::abs()\n" << "Expected: v3 = " << val_abs << std::endl; - cell_ops->printData(cvindx[3], tbox::pout); + cell_ops->printData(cvindx[3], tbox::plog); } // Test #14: Place some bogus values on coarse level @@ -530,8 +530,9 @@ int main( for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { patch = *ip; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(cvindx[2])); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[2])); + TBOX_ASSERT(cdata); hier::Index index0(dim, 2); hier::Index index1(dim, 3); index1(0) = 5; @@ -548,14 +549,15 @@ int main( for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { patch = *ipp; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(cvindx[2])); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[2])); + TBOX_ASSERT(cdata); hier::Index index0(dim, 2); hier::Index index1(dim, 3); index1(0) = 5; - pdat::CellIterator cend(cdata->getBox(), false); - for (pdat::CellIterator c(cdata->getBox(), true); + pdat::CellIterator cend(pdat::CellGeometry::end(cdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cdata->getBox())); c != cend && bogus_value_test_passed; ++c) { pdat::CellIndex cell_index = *c; @@ -580,11 +582,11 @@ int main( } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: Place some bogus values on coarse level" << std::endl; - cell_ops->printData(cvindx[2], tbox::pout); + cell_ops->printData(cvindx[2], tbox::plog); } // Test #15: math::HierarchyCellDataOpsReal::L1Norm() - w/o control weight @@ -592,7 +594,7 @@ int main( double bogus_l1_norm = cell_ops->L1Norm(cvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_l1_norm, ((dim == tbox::Dimension(2)) ? 1452 : 3732))) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #15: math::HierarchyCellDataOpsReal::L1Norm()" << " - w/o control weight\n" @@ -605,7 +607,7 @@ int main( // Expected: correct_l1_norm = 2.0 double correct_l1_norm = cell_ops->L1Norm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #16: math::HierarchyCellDataOpsReal::L1Norm()" << " - w/control weight\n" @@ -617,7 +619,7 @@ int main( // Expected: l2_norm = 2.82842712475 double l2_norm = cell_ops->L2Norm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(l2_norm, 2.82842712475)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchyCellDataOpsReal::L2Norm()\n" << "Expected value = 2.82842712475, Computed value = " @@ -628,7 +630,7 @@ int main( // Expected: bogus_max_norm = 1000.0 double bogus_max_norm = cell_ops->maxNorm(cvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyCellDataOpsReal::L2Norm()" << " - w/o control weight\n" @@ -640,7 +642,7 @@ int main( // Expected: max_norm = 4.0 double max_norm = cell_ops->maxNorm(cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyCellDataOpsReal::L2Norm()" << " - w/control weight\n" @@ -658,11 +660,11 @@ int main( cell_ops->linearSum(cvindx[3], 2.0, cvindx[1], 0.00, cvindx[0]); double val_linearSum = 5.0; if (!doubleDataSameAsValue(cvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyCellDataOpsReal::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; - cell_ops->printData(cvindx[3], tbox::pout); + cell_ops->printData(cvindx[3], tbox::plog); } // Test #21: math::HierarchyCellDataOpsReal::axmy() @@ -670,18 +672,18 @@ int main( cell_ops->axmy(cvindx[3], 3.0, cvindx[1], cvindx[0]); double val_axmy = 6.5; if (!doubleDataSameAsValue(cvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::HierarchyCellDataOpsReal::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; - cell_ops->printData(cvindx[3], tbox::pout); + cell_ops->printData(cvindx[3], tbox::plog); } // Test #22a: math::HierarchyCellDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 8.75 double cdot = cell_ops->dot(cvindx[2], cvindx[1], cwgt_id); if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22a: math::HierarchyCellDataOpsReal::dot() - (ind2) * (ind1)\n" << "Expected Value = 8.75, Computed Value = " @@ -692,7 +694,7 @@ int main( // Expected: cdot = 8.75 cdot = cell_ops->dot(cvindx[1], cvindx[2], cwgt_id); if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22b: math::HierarchyCellDataOpsReal::dot() - (ind1) * (ind2)\n" << "Expected Value = 8.75, Computed Value = " @@ -700,14 +702,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { cvar[iv].reset(); } cwgt.reset(); @@ -743,17 +745,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); c != cend && test_passed; ++c) { pdat::CellIndex cell_index = *c; if (!tbox::MathUtilities::equalEps((*cvdata)(cell_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/cell_patchtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/cell_patchtest.C index a20ef3fc..cddb1b2c 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/cell_patchtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/cell_patchtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test cell patch data operations. * ************************************************************************/ @@ -47,7 +47,9 @@ #include "SAMRAI/math/PatchCellDataOpsReal.h" -#include +#include "boost/shared_ptr.hpp" + +#include // using namespace std; using namespace SAMRAI; @@ -75,7 +77,7 @@ int main( const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); int num_failures = 0; @@ -91,9 +93,9 @@ int main( { /* Make a dummy mesh domain with one patch */ - double lo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double hi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int i = 0; i < dim.getValue(); i++) { + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + for (int i = 0; i < dim.getValue(); ++i) { lo[i] = 0.0; if (i == 1) { hi[i] = 0.5; @@ -105,7 +107,6 @@ int main( hier::Index indxhi(dim, 9); indxhi(1) = 4; hier::Box patch_box(indxlo, indxhi, hier::BlockId(0)); - patch_box.initialize(patch_box, hier::LocalId(0), 0); hier::BoxContainer grid_domain(patch_box); hier::IntVector ratio(dim, 1); @@ -212,7 +213,7 @@ int main( bool descriptor_test_passed = true; bool name_error_indx[6]; bool factory_error_indx[6]; - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { name_error_indx[desc_id] = false; factory_error_indx[desc_id] = false; } @@ -225,7 +226,7 @@ int main( std::string cell_int_variable1("cell_int_variable##ghost_width_1"); std::string cell_int_variable2("cell_int_variable##ghost_width_2"); - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { var_ctxt_name = hier::VariableDatabase::getDatabase()->getPatchDescriptor()-> mapIndexToName(desc_id); @@ -333,11 +334,11 @@ int main( } if (!descriptor_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1: State of PatchDescriptor" << std::endl; - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { if (name_error_indx[desc_id] == true) { tbox::plog << "Name for index = " << desc_id << " incorrect" << std::endl; @@ -351,13 +352,13 @@ int main( // Test #2: Check state of hier::Patch before allocating storage if (!tpatch->getBox().isSpatiallyEqual(patch_box)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #2a: hier::Patch box incorrectly set\n" << "Expected: d_box = " << patch_box << "\n" << "Set to: d_box = " << tpatch->getBox() << std::endl; } if (tpatch->getLocalId() != patch_node.getLocalId()) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #2b: hier::Patch number incorrectly set\n" << "Expected: d_patch_number = " @@ -368,14 +369,14 @@ int main( /* HOW TO GET NUMBER OF COMPONENTS ON PATCH * FOR NOW JUST CHECK THAT getPatchData(0) returns NULL * - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #2c: Number of components allocated incorrect\n" * << "Expected: number of components = 0\n" * << "Got: number of components = 0\n" */ - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { if (tpatch->checkAllocated(desc_id)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #2c." << desc_id << ": Descriptor slot " << desc_id << " should not be allocated but is!" << std::endl; @@ -387,13 +388,13 @@ int main( // Test #3: Check state of hier::Patch after allocating storage if (!tpatch->getBox().isSpatiallyEqual(patch_box)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: hier::Patch box incorrectly set\n" << "Expected: d_box = " << patch_box << "\n" << "Set to: d_box = " << tpatch->getBox() << std::endl; } if (tpatch->getLocalId() != patch_node.getLocalId()) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: hier::Patch number incorrectly set\n" << "Expected: d_patch_number = " @@ -402,10 +403,10 @@ int main( << tpatch->getLocalId() << std::endl; } /* SAME ISSUE AS ABOVE FOR NUMBER OF COMPONENTS */ - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { if (!tpatch->checkAllocated(desc_id)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.0: Descriptor index " << desc_id << " should be allocated but isn't!" << std::endl; } else { @@ -420,14 +421,14 @@ int main( case 0: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.0.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.0.b: Ghost width incorrect\n" << "Expected: (1,1)\n" @@ -438,14 +439,14 @@ int main( case 1: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.1.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.1.b: Ghost width incorrect\n" << "Expected: (2,2)\n" @@ -456,14 +457,14 @@ int main( case 2: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.2.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 3)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.2.b: Ghost width incorrect\n" << "Expected: (3,3)\n" @@ -474,14 +475,14 @@ int main( case 3: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.3.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.3.b: Ghost width incorrect\n" << "Expected: (0,0)\n" @@ -492,14 +493,14 @@ int main( case 4: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.4.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.4.b: Ghost width incorrect\n" << "Expected: (1,1)\n" @@ -510,14 +511,14 @@ int main( case 5: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.5.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3c.5.b: Ghost width incorrect\n" << "Expected: (2,2)\n" @@ -532,13 +533,14 @@ int main( // Initialize control volume data for cell-centered data const double* dx = geometry.getDx(); double cell_vol = dx[0]; - for (int i = 1; i < dim.getValue(); i++) { + for (int i = 1; i < dim.getValue(); ++i) { cell_vol *= dx[i]; } boost::shared_ptr > weight( - tpatch->getPatchData(cwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + tpatch->getPatchData(cwgt_id))); + TBOX_ASSERT(weight); weight->fillAll(cell_vol); // Simple tests of cell data operations @@ -547,28 +549,25 @@ int main( // Get pointers to patch data objects boost::shared_ptr > cddata0( - tpatch->getPatchData(cdvindx[0]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + tpatch->getPatchData(cdvindx[0]))); boost::shared_ptr > cddata1( - tpatch->getPatchData(cdvindx[1]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + tpatch->getPatchData(cdvindx[1]))); boost::shared_ptr > cddata2( - tpatch->getPatchData(cdvindx[2]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + tpatch->getPatchData(cdvindx[2]))); - boost::shared_ptr > cidata0( - tpatch->getPatchData(civindx[0]), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > cidata1( - tpatch->getPatchData(civindx[1]), - boost::detail::dynamic_cast_tag()); + TBOX_ASSERT(cddata0); + TBOX_ASSERT(cddata1); + TBOX_ASSERT(cddata2); // Test #4a: math::PatchCellDataOpsReal::setToScalar() // Expected: cddata0 = 0.0 cdops_double.setToScalar(cddata0, 0.0, cddata0->getGhostBox()); double val0 = 0.0; if (!doubleDataSameAsValue(cdvindx[0], val0, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4a: math::PatchCellDataOpsReal::setToScalar()\n" << "Expected: cddata0 = " << val0 << std::endl; @@ -580,7 +579,7 @@ int main( cdops_double.setToScalar(cddata1, 1.0, cddata1->getGhostBox()); double val1 = 1.0; if (!doubleDataSameAsValue(cdvindx[1], val1, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4b: math::PatchCellDataOpsReal::setToScalar()\n" << "Expected: cddata1 = " << val1 << std::endl; @@ -592,7 +591,7 @@ int main( cdops_double.setToScalar(cddata2, 2.0, cddata2->getGhostBox()); double val2 = 2.0; if (!doubleDataSameAsValue(cdvindx[2], val2, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4b: math::PatchCellDataOpsReal::setToScalar()\n" << "Expected: cddata2 = " << val2 << std::endl; @@ -604,7 +603,7 @@ int main( cdops_double.add(cddata0, cddata1, cddata2, tpatch->getBox()); double val_add = 3.0; if (!doubleDataSameAsValue(cdvindx[0], val_add, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5: math::PatchCellDataOpsReal::add()\n" << "Expected: cddata0 = " << val_add << std::endl; cdops_double.printData(cddata0, cddata0->getGhostBox(), tbox::plog); @@ -623,11 +622,13 @@ int main( double val_inbox = 1.0; double val_not_inbox = 3.0; boost::shared_ptr > cvdata( - tpatch->getPatchData(cdvindx[0]), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + tpatch->getPatchData(cdvindx[0]))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); c != cend && subtract_inbox_test_passed; ++c) { pdat::CellIndex cell_index = *c; @@ -645,7 +646,7 @@ int main( } if (!subtract_inbox_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::PatchCellDataOpsReal::subtract() on [(3,1),(5,2)]\n" << "Expected: cddata0 = 1.0 in [(3,1),(5,2)]\n" @@ -658,7 +659,7 @@ int main( cdops_double.scale(cddata0, 0.4, cddata2, tpatch->getBox()); double val_scale = 0.8; if (!doubleDataSameAsValue(cdvindx[0], val_scale, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::PatchCellDataOpsReal::scale()\n" << "Expected: cddata0 = " << val_scale << std::endl; @@ -670,7 +671,7 @@ int main( cdops_double.multiply(cddata0, cddata0, cddata2, tpatch->getBox()); double val_mult = 1.6; if (!doubleDataSameAsValue(cdvindx[0], val_mult, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::PatchCellDataOpsReal::multiply()\n" << "Expected: cddata0 = " << val_mult << std::endl; @@ -684,12 +685,13 @@ int main( bool divide_inbox_test_passed = true; val_inbox = 0.8; val_not_inbox = 1.6; - cvdata = boost::dynamic_pointer_cast, - hier::PatchData>(tpatch->getPatchData(cdvindx[0])); + cvdata = BOOST_CAST, + hier::PatchData>(tpatch->getPatchData(cdvindx[0])); + TBOX_ASSERT(cvdata); - pdat::CellIterator ccend(cvdata->getBox(), false); - for (pdat::CellIterator cc(cvdata->getBox(), true); - cc != ccend && divide_inbox_test_passed; ++cc) { + pdat::CellIterator ccend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator cc(pdat::CellGeometry::begin(cvdata->getBox())); + cc != ccend && divide_inbox_test_passed; ++cc) { pdat::CellIndex cell_index = *cc; double value; @@ -706,7 +708,7 @@ int main( } if (!divide_inbox_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9: math::PatchCellDataOpsReal::divide() on [(3,1),(5,2)]\n" << "Expected: cddata0 = 1.0 in [(3,1),(5,2)]\n" @@ -719,7 +721,7 @@ int main( cdops_double.reciprocal(cddata0, cddata2, tpatch->getBox()); double val_rec = 0.5; if (!doubleDataSameAsValue(cdvindx[0], val_rec, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::PatchCellDataOpsReal::reciprocal()\n" << "Expected: cddata0 = " << val_rec << std::endl; @@ -740,7 +742,7 @@ int main( tpatch->getBox()); double val_linearSum = 50.0; if (!doubleDataSameAsValue(cdvindx[0], val_linearSum, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::PatchCellDataOpsReal::linearSum()\n" << "Expected: cddata0 = " << val_linearSum << std::endl; @@ -765,11 +767,12 @@ int main( bool restricted_linSum_test_passed = true; val_inbox = 50.0; val_not_inbox = 0.0; - cvdata = boost::dynamic_pointer_cast, - hier::PatchData>(tpatch->getPatchData(cdvindx[0])); + cvdata = BOOST_CAST, + hier::PatchData>(tpatch->getPatchData(cdvindx[0])); + TBOX_ASSERT(cvdata); - pdat::CellIterator cciend(cvdata->getBox(), false); - for (pdat::CellIterator cci(cvdata->getBox(), true); + pdat::CellIterator cciend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator cci(pdat::CellGeometry::begin(cvdata->getBox())); cci != cciend && restricted_linSum_test_passed; ++cci) { pdat::CellIndex cell_index = *cci; @@ -787,7 +790,7 @@ int main( } if (!restricted_linSum_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::PatchCellDataOpsReal::linearSum()\n" << "Expected: cddata0 = " << val_linearSum @@ -829,10 +832,11 @@ int main( double val_inbox3 = 21.0; val_not_inbox = 1.0; - cvdata = boost::dynamic_pointer_cast, - hier::PatchData>(tpatch->getPatchData(cdvindx[1])); - pdat::CellIterator ciend(cvdata->getBox(), false); - for (pdat::CellIterator ci(cvdata->getBox(), true); + cvdata = BOOST_CAST, + hier::PatchData>(tpatch->getPatchData(cdvindx[1])); + TBOX_ASSERT(cvdata); + pdat::CellIterator ciend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(cvdata->getBox())); ci != ciend && setToScalar_onBox_test_passed; ++ci) { pdat::CellIndex cell_index = *ci; @@ -858,7 +862,7 @@ int main( } if (!setToScalar_onBox_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: math::PatchCellDataOpsReal::setToScalar() on box\n" << "Expected: cddata1 = 0.0003 in [(3,1),(3,2)]\n" @@ -874,7 +878,7 @@ int main( indx2(0) = 7; double lmax = cdops_double.max(cddata1, hier::Box(indx0, indx2, hier::BlockId(0))); if (!tbox::MathUtilities::equalEps(lmax, 21.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: math::PatchCellDataOpsReal::max() on box [(3,1),(7,4)]\n" << "Expected value = 21.0, Computed value = " @@ -885,7 +889,7 @@ int main( // Expected: lmax = 12345.0 lmax = cdops_double.max(cddata1, tpatch->getBox()); if (!tbox::MathUtilities::equalEps(lmax, 12345.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #15: math::PatchCellDataOpsReal::max() in box [(0,0),(9,4)]\n" << "Expected value = 12345.0, Computed value = " @@ -904,7 +908,7 @@ int main( cdops_double.axpy(cddata0, 0.5, cddata1, cddata2, tpatch->getBox()); double val_axpy = 2.5; if (!doubleDataSameAsValue(cdvindx[0], val_axpy, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #16: math::PatchCellDataOpsReal::axpy()\n" << "Expected: cddata0 = " << val_axpy << std::endl; @@ -916,7 +920,7 @@ int main( cdops_double.axmy(cddata0, 1.5, cddata2, cddata1, tpatch->getBox()); double val_axmy = 2.0; if (!doubleDataSameAsValue(cdvindx[0], val_axmy, tpatch)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::PatchCellDataOpsReal::axmy()\n" << "Expected: cddata0 = " << val_axmy << std::endl; @@ -931,7 +935,7 @@ int main( weight, tpatch->getBox()); if (!tbox::MathUtilities::equalEps(lsum, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18a: math::PatchCellDataOpsReal::sumControlVolumes() for cddata1\n" << "Expected value = 0.5, Computed value = " @@ -942,7 +946,7 @@ int main( // Expected: lsum = 0.5 lsum = cdops_double.sumControlVolumes(cddata2, weight, tpatch->getBox()); if (!tbox::MathUtilities::equalEps(lsum, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18b: math::PatchCellDataOpsReal::sumControlVolumes() for cddata2\n" << "Expected value = 0.5, Computed value = " @@ -953,7 +957,7 @@ int main( // Expected: l1norm = 0.5 double l1norm = cdops_double.L1Norm(cddata1, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(l1norm, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19a: math::PatchCellDataOpsReal::L1norm() for cddata1\n" << "Expected value = 0.5, Computed value = " @@ -964,7 +968,7 @@ int main( // Expected: l1norm = 1.0 l1norm = cdops_double.L1Norm(cddata2, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(l1norm, 1.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19b: math::PatchCellDataOpsReal::L1norm() for cddata2\n" << "Expected value = 1.0, Computed value = " @@ -975,7 +979,7 @@ int main( // Expected: l2norm = sqrt(2) = 1.4142135623731 double l2norm = cdops_double.L2Norm(cddata2, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(l2norm, 1.4142135623731)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::PatchCellDataOpsReal::L2norm() for cddata2\n" << "Expected value = sqrt(2) = 1.4142135623731, Computed value = " @@ -992,7 +996,7 @@ int main( tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(wl2norm, 0.70710678118655)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::PatchCellDataOpsReal::weightedL2norm() for cddata2\n" << "Expected value = sqrt(0.5) = 0.70710678118655, Computed value = " @@ -1003,7 +1007,7 @@ int main( // Expected: rmsnorm= L2-Norm/sqrt(control volume) = 2.0 double rmsnorm = cdops_double.RMSNorm(cddata2, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(rmsnorm, 2.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::PatchCellDataOpsReal::RMSNorm() for cddata2\n" << "Expected value = L2-Norm/sqrt(control volume) = 2.0, " @@ -1017,7 +1021,7 @@ int main( tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(wrmsnorm, 1.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #23: math::PatchCellDataOpsReal::weightedRMSNorm() for cddata2\n" << "Expected value = Weighted L2-Norm/sqrt(control volume) = 1.0, " @@ -1028,7 +1032,7 @@ int main( // Expected: maxnorm = 2.0 double maxnorm = cdops_double.maxNorm(cddata2, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(maxnorm, 2.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #24: math::PatchCellDataOpsReal::maxNorm() for cddata2\n" << "Expected value = 2.0, Computed value = " @@ -1043,7 +1047,7 @@ int main( // Expected: dotp = 7.5 double dotp = cdops_double.dot(cddata1, cddata2, tpatch->getBox(), weight); if (!tbox::MathUtilities::equalEps(dotp, 7.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #25: math::PatchCellDataOpsReal::dotp() - (cddata1) * (cddata2)\n" << "Expected value = 7.5, Computed value = " @@ -1052,13 +1056,13 @@ int main( // Test #26: Check state of hier::Patch before deallocating storage if (!tpatch->getBox().isSpatiallyEqual(patch_box)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26a: hier::Patch box incorrectly set\n" << "Expected: d_box = " << patch_box << "\n" << "Set to: d_box = " << tpatch->getBox() << std::endl; } if (tpatch->getLocalId() != patch_node.getLocalId()) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26b: hier::Patch number incorrectly set\n" << "Expected: d_patch_number = " @@ -1067,10 +1071,10 @@ int main( << tpatch->getLocalId() << std::endl; } /* SAME ISSUE AS ABOVE FOR NUMBER OF COMPONENTS */ - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { if (!tpatch->checkAllocated(desc_id)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.0: Descriptor index " << desc_id << " should be allocated but isn't!" << std::endl; } else { @@ -1085,14 +1089,14 @@ int main( case 0: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.0.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.0.b: Ghost width incorrect\n" << "Expected: (1,1)\n" @@ -1103,14 +1107,14 @@ int main( case 1: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.1.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.1.b: Ghost width incorrect\n" << "Expected: (2,2)\n" @@ -1121,14 +1125,14 @@ int main( case 2: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.2.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 3)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.2.b: Ghost width incorrect\n" << "Expected: (3,3)\n" @@ -1139,14 +1143,14 @@ int main( case 3: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.3.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.3.b: Ghost width incorrect\n" << "Expected: (0,0)\n" @@ -1157,14 +1161,14 @@ int main( case 4: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.4.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.4.b: Ghost width incorrect\n" << "Expected: (1,1)\n" @@ -1175,14 +1179,14 @@ int main( case 5: if (typeid(*tpatch->getPatchData(desc_id)) != typeid(pdat::CellData)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.5.a: hier::Patch Data name incorrect\n" << "Expected: pdat::CellData\n" << "Actual: " << patch_data_name << std::endl; } if (ghost_width != hier::IntVector(dim, 2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #26c.5.b: Ghost width incorrect\n" << "Expected: (2,2)\n" @@ -1199,13 +1203,13 @@ int main( // Test #27: Check state of hier::Patch after deallocating storage if (!tpatch->getBox().isSpatiallyEqual(patch_box)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #27a: hier::Patch box incorrectly set\n" << "Expected: d_box = " << patch_box << "\n" << "Set to: d_box = " << tpatch->getBox() << std::endl; } if (tpatch->getLocalId() != patch_node.getLocalId()) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #27b: hier::Patch number incorrectly set\n" << "Expected: d_patch_number = " @@ -1214,10 +1218,10 @@ int main( << tpatch->getLocalId() << std::endl; } /* SAME ISSUE AS ABOVE FOR NUMBER OF COMPONENTS */ - for (desc_id = 0; desc_id < 6; desc_id++) { + for (desc_id = 0; desc_id < 6; ++desc_id) { if (tpatch->checkAllocated(desc_id)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #27c: Descriptor index " << desc_id << " should be deallocated but isn't!" << std::endl; } @@ -1252,12 +1256,14 @@ doubleDataSameAsValue( bool test_passed = true; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(cvdata); - pdat::CellIterator cend(cvdata->getBox(), false); - for (pdat::CellIterator c(cvdata->getBox(), true); - c != cend&& test_passed; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(cvdata->getBox())); + for (pdat::CellIterator c(pdat::CellGeometry::begin(cvdata->getBox())); + c != cend && test_passed; ++c) { pdat::CellIndex cell_index = *c; if (!tbox::MathUtilities::equalEps((*cvdata)(cell_index), value)) { diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/edge_cplxtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/edge_cplxtest.C index 66ae7155..ef757a0c 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/edge_cplxtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/edge_cplxtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test edge-centered complex patch data ops * ************************************************************************/ @@ -39,7 +39,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" #include #include @@ -76,17 +76,13 @@ int main( TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } - const int d = atoi(argv[1]); + const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= SAMRAI_MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != 2) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("edge_cplxtest.") - + tbox::Utilities::intToString(dim, 1) + "d.log"; + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); /* @@ -94,26 +90,58 @@ int main( * then there will be memory leaks reported. */ { - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7)); - hier::IntVector ratio(dim2d, 2); - - hier::BoxContainer coarse_domain(dim2d); - hier::BoxContainer fine_boxes(dim2d); - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_boxes.appendItem(fine0); - fine_boxes.appendItem(fine1); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } + + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); + + hier::BoxContainer coarse_domain; + hier::BoxContainer fine_boxes; + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_boxes.pushBack(fine0); + fine_boxes.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -125,38 +153,42 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_boxes.getNumberOfBoxes(); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getRank()) { - layer0.addBox(hier::Box(*coarse_itr, ib, - layer0.getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, ib, 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getRank()) { - layer1.addBox(hier::Box(*fine_itr, ib, - layer1.getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, ib, 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -167,7 +199,7 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; @@ -191,9 +223,9 @@ int main( swgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(svindx[iv]); } } @@ -212,118 +244,836 @@ int main( 1)); boost::shared_ptr patch; - boost::shared_ptr pgeom; // Initialize control volume data for edge-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - boost::shared_ptr > data; - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); + patch = *ip; + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double edge_vol = dx[0] * dx[1]; - data = patch->getPatchData(swgt_id); + double edge_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + edge_vol *= dx[i]; + } + boost::shared_ptr > data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(swgt_id))); + TBOX_ASSERT(data); data->fillAll(edge_vol); pdat::EdgeIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, plo1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::EdgeIndex(hier::Index(phi0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + } + // left and right edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, plo1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::EdgeIndex(hier::Index(ic, phi1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::EdgeIndex(hier::Index(phi0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, plo1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::EdgeIndex(hier::Index(ic, phi1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + // bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + } + } else { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + } } } else { - // top and bottom coarse-fine edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, plo1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::EdgeIndex(hier::Index(ic, phi1), - pdat::EdgeIndex::X, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::EdgeIndex(hier::Index(phi0, ic), - pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // left face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } else { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + } } } } @@ -336,13 +1086,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::CellData > svdata = patch->getPatchData(cwgt_id); * - * pdat::CellIterator cend(svdata->getBox(), false); - * for (pdat::CellIterator c(svdata->getBox(), true); c != cend && vol_test_passed; ++c) { + * pdat::CellIterator cend(pdat::CellGeometry::end(svdata->getBox())); + * for (pdat::CellIterator c(pdat::CellGeometry::begin(svdata->getBox())); c != cend && vol_test_passed; ++c) { * pdat::CellIndex cell_index = *c; * * if (ln == 0) { @@ -366,7 +1116,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -377,25 +1127,40 @@ int main( // Test #1b: math::HierarchyEdgeDataOpsComplex::sumControlVolumes() // Expected: norm = 1.0 - double norm = - edge_ops->sumControlVolumes(svindx[0], swgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchyEdgeDataOpsComplex::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + double norm = edge_ops->sumControlVolumes(svindx[0], swgt_id); + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchyEdgeDataOpsComplex::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchyEdgeDataOpsComplex::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = edge_ops->numberOfEntries(svindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyEdgeDataOpsComplex::numberOfEntries()\n" - << "Expected value = 209 , Computed value = " - << num_data_points << std::endl; + size_t num_data_points = edge_ops->numberOfEntries(svindx[0]); + { + size_t compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2615; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyEdgeDataOpsComplex::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyEdgeDataOpsComplex::setToScalar() @@ -403,7 +1168,7 @@ int main( dcomplex val0 = dcomplex(2.0, 1.5); edge_ops->setToScalar(svindx[0], val0); if (!complexDataSameAsValue(svindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyEdgeDataOpsComplex::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -415,7 +1180,7 @@ int main( dcomplex val1(4.0, 3.0); edge_ops->setToScalar(svindx[1], dcomplex(4.0, 3.0)); if (!complexDataSameAsValue(svindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyEdgeDataOpsComplex::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -426,7 +1191,7 @@ int main( // Expected: v2 = v1 = (4.0, 3.0) edge_ops->copyData(svindx[2], svindx[1]); if (!complexDataSameAsValue(svindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyEdgeDataOpsComplex::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -437,14 +1202,14 @@ int main( // Expected: v0 = (4.0, 3.0), v1 = (2.0,1.5) edge_ops->swapData(svindx[0], svindx[1]); if (!complexDataSameAsValue(svindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyEdgeDataOpsComplex::swapData()\n" << "Expected: v0 = " << val1 << std::endl; edge_ops->printData(svindx[0], tbox::plog); } if (!complexDataSameAsValue(svindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyEdgeDataOpsComplex::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -456,7 +1221,7 @@ int main( edge_ops->scale(svindx[2], 0.25, svindx[2]); dcomplex val_scale(1.0, 0.75); if (!complexDataSameAsValue(svindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyEdgeDataOpsComplex::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -468,7 +1233,7 @@ int main( edge_ops->add(svindx[3], svindx[0], svindx[1]); dcomplex val_add(6.0, 4.5); if (!complexDataSameAsValue(svindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyEdgeDataOpsComplex::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -483,7 +1248,7 @@ int main( edge_ops->subtract(svindx[1], svindx[3], svindx[0]); dcomplex val_sub(6.0, 0.0); if (!complexDataSameAsValue(svindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyEdgeDataOpsComplex::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -495,7 +1260,7 @@ int main( edge_ops->addScalar(svindx[1], svindx[1], dcomplex(0.0, -4.0)); dcomplex val_addScalar(6.0, -4.0); if (!complexDataSameAsValue(svindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyEdgeDataOpsComplex::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -507,7 +1272,7 @@ int main( edge_ops->addScalar(svindx[2], svindx[2], dcomplex(0.0, 0.25)); val_addScalar = dcomplex(1.0, 1.0); if (!complexDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyEdgeDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -519,7 +1284,7 @@ int main( edge_ops->addScalar(svindx[2], svindx[2], dcomplex(3.0, -4.0)); val_addScalar = dcomplex(4.0, -3.0); if (!complexDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyEdgeDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -534,7 +1299,7 @@ int main( edge_ops->multiply(svindx[1], svindx[3], svindx[1]); dcomplex val_mult(3.0, -2.0); if (!complexDataSameAsValue(svindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyEdgeDataOpsComplex::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -546,7 +1311,7 @@ int main( edge_ops->divide(svindx[0], svindx[2], svindx[1]); dcomplex val_div(1.3846153846154, -0.076923076923077); if (!complexDataSameAsValue(svindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyEdgeDataOpsComplex::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -558,7 +1323,7 @@ int main( edge_ops->reciprocal(svindx[1], svindx[1]); dcomplex val_rec(0.23076923076923, 0.15384615384615); if (!complexDataSameAsValue(svindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyEdgeDataOpsComplex::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -574,17 +1339,31 @@ int main( hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - sdata = patch->getPatchData(svindx[2]); - hier::Index index0(2, 2); - hier::Index index1(5, 3); - if (patch->getBox().contains(index0)) { - (*sdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower), 0) = dcomplex(100.0, -50.0); - } - if (patch->getBox().contains(index1)) { - (*sdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper), 0) = dcomplex(-1000.0, 20.0); + patch = *ip; + sdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(sdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; + if (dim.getValue() == 2) { + if (patch->getBox().contains(index0)) { + (*sdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower), 0) = dcomplex(100.0, -50.0); + } + if (patch->getBox().contains(index1)) { + (*sdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper), 0) = dcomplex(-1000.0, 20.0); + } + } else { + if (patch->getBox().contains(index0)) { + (*sdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight), 0) = dcomplex(100.0, -50.0); + } + if (patch->getBox().contains(index1)) { + (*sdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight), 0) = dcomplex(-1000.0, 20.0); + } } } @@ -592,20 +1371,28 @@ int main( bool bogus_value_test_passed = true; for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - sdata = patch->getPatchData(svindx[2]); - pdat::EdgeIndex index0(hier::Index(2, - 2), pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - pdat::EdgeIndex index1(hier::Index(5, - 3), pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper); + patch = *ipp; + sdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(sdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + int corner0, corner1; + if (dim.getValue() == 2) { + corner0 = pdat::EdgeIndex::Lower; + corner1 = pdat::EdgeIndex::Upper; + } else { + corner0 = pdat::EdgeIndex::LowerRight; + corner1 = pdat::EdgeIndex::UpperRight; + } + pdat::EdgeIndex index0(idx0, pdat::EdgeIndex::Y, corner0); + pdat::EdgeIndex index1(idx1, pdat::EdgeIndex::Y, corner1); // check X axis data - pdat::EdgeIterator cend(sdata->getBox(), pdat::EdgeIndex::X, false); - for (pdat::EdgeIterator c(sdata->getBox(), pdat::EdgeIndex::X, true); - c != cend && bogus_value_test_passed; - ++c) { + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(sdata->getBox(), pdat::EdgeIndex::X)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(sdata->getBox(), pdat::EdgeIndex::X)); + c != cend && bogus_value_test_passed; ++c) { pdat::EdgeIndex edge_index = *c; if (!tbox::MathUtilities::equalEps((*sdata)(edge_index), @@ -615,10 +1402,9 @@ int main( } // check Y axis data - pdat::EdgeIterator ccend(sdata->getBox(), pdat::EdgeIndex::Y, false); - for (pdat::EdgeIterator cc(sdata->getBox(), pdat::EdgeIndex::Y, true); - cc != ccend && bogus_value_test_passed; - ++cc) { + pdat::EdgeIterator ccend(pdat::EdgeGeometry::end(sdata->getBox(), pdat::EdgeIndex::Y)); + for (pdat::EdgeIterator cc(pdat::EdgeGeometry::begin(sdata->getBox(), pdat::EdgeIndex::Y)); + cc != ccend && bogus_value_test_passed; ++cc) { pdat::EdgeIndex edge_index = *cc; if (edge_index == index0) { @@ -642,9 +1428,23 @@ int main( } } } + + if (dim.getValue() == 3) { + // check Z axis data + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(sdata->getBox(), pdat::EdgeIndex::Z)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(sdata->getBox(), pdat::EdgeIndex::Z)); + c != cend && bogus_value_test_passed; ++c) { + pdat::EdgeIndex edge_index = *c; + + if (!tbox::MathUtilities::equalEps((*sdata)(edge_index), + dcomplex(4.0, -3.0))) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: Place some bogus values on coarse level" << std::endl; @@ -656,43 +1456,67 @@ int main( // Test #14: math::HierarchyEdgeDataOpsComplex::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 2217.003379 double bogus_l1_norm = edge_ops->L1Norm(svindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 2217.003379)) { - num_failures++; - tbox::perr - << "FAILED: - Test #14: math::HierarchyEdgeDataOpsComplex::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 2217.003379, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 2217.003379; + } else { + compare = 15477.0033789; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #14: math::HierarchyEdgeDataOpsComplex::L1Norm()" + << " - w/o control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #15: math::HierarchyEdgeDataOpsComplex::L1Norm() - w/control weight // Expected: correct_l1_norm = 5.0 double correct_l1_norm = edge_ops->L1Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchyEdgeDataOpsComplex::L1Norm()" - << " - w/control weight\n" - << "Expected value = 5.0, Computed value = " - << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 7.5; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchyEdgeDataOpsComplex::L1Norm()" + << " - w/control weight\n" + << "Expected value = " << compare << ", Computed value = " + << correct_l1_norm << std::endl; + } } // Test #16: math::HierarchyEdgeDataOpsComplex::L2Norm() // Expected: l2_norm = 5.0 double l2_norm = edge_ops->L2Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchyEdgeDataOpsComplex::L2Norm()\n" - << "Expected value = 5.0, Computed value = " - << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 6.12372435696; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchyEdgeDataOpsComplex::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << l2_norm << std::endl; + } } // Test #17: math::HierarchyEdgeDataOpsComplex::maxNorm() - w/o control weight // Expected: bogus_max_norm = 1000.19998 double bogus_max_norm = edge_ops->maxNorm(svindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.19998)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchyEdgeDataOpsComplex::maxNorm()" << " - w/o control weight\n" @@ -704,7 +1528,7 @@ int main( // Expected: max_norm = 5.0 double max_norm = edge_ops->maxNorm(svindx[2], swgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 5.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyEdgeDataOpsComplex::maxNorm()" << " - w/control weight\n" @@ -723,7 +1547,7 @@ int main( dcomplex(2.0, 0.0), svindx[1], dcomplex(0.0, -1.0), svindx[0]); dcomplex val_linearSum(2.0, 5.0); if (!complexDataSameAsValue(svindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyEdgeDataOpsComplex::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -735,7 +1559,7 @@ int main( edge_ops->axmy(svindx[3], 3.0, svindx[1], svindx[0]); dcomplex val_axmy(6.5, 12.0); if (!complexDataSameAsValue(svindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyEdgeDataOpsComplex::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -745,24 +1569,30 @@ int main( // Test #21a: math::HierarchyEdgeDataOpsComplex::dot() - (ind2) * (ind1) // Expected: cdot = (17.5,-21.0) dcomplex cdot = edge_ops->dot(svindx[2], svindx[1], swgt_id); - dcomplex ans_2_dot_1(17.5, -21.0); + double ctl_wt; + if (dim.getValue() == 2) { + ctl_wt = 1.0; + } else { + ctl_wt = 1.5; + } + dcomplex ans_2_dot_1(17.5 * ctl_wt, -21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot, ans_2_dot_1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21a: math::HierarchyEdgeDataOpsComplex::dot() - (ind2) * (ind1)\n" - << "Expected value = (17.5,-21.0), Computed value = " + << "Expected value = " << ans_2_dot_1 << ", Computed value = " << cdot << std::endl; } // Test #21b: math::HierarchyEdgeDataOpsComplex::dot() - (ind1) * (ind2) // Expected: cdot = (17.5,-1.0) dcomplex cdot2 = edge_ops->dot(svindx[1], svindx[2], swgt_id); - dcomplex ans_1_dot_2(17.5, 21.0); + dcomplex ans_1_dot_2(17.5 * ctl_wt, 21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot2, ans_1_dot_2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21b: math::HierarchyEdgeDataOpsComplex::dot() - (ind1) * (ind2)\n" - << "Expected value = (17.5,21.0), Computed value = " + << "Expected value = " << ans_1_dot_2 << ", Computed value = " << cdot2 << std::endl; } @@ -771,7 +1601,7 @@ int main( edge_ops->setToScalar(svindx[0], dcomplex(4.0, -3.0)); edge_ops->abs(swgt_id, svindx[0]); if (!doubleDataSameAsValue(swgt_id, 5.0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::HierarchyEdgeDataOpsComplex::abs()\n" << "Expected: abs(v0) = 5.0" << std::endl; @@ -779,14 +1609,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(svindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } swgt.reset(); @@ -822,16 +1652,19 @@ complexDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > svdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(svdata); - pdat::EdgeIterator cend(svdata->getBox(), 1, false); - for (pdat::EdgeIterator c(svdata->getBox(), 1, true); + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(svdata->getBox(), 1)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(svdata->getBox(), 1)); c != cend && test_passed; ++c) { pdat::EdgeIndex edge_index = *c; if (!tbox::MathUtilities::equalEps((*svdata)(edge_index), @@ -859,16 +1692,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > svdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(svdata); - pdat::EdgeIterator cend(svdata->getBox(), 1, false); - for (pdat::EdgeIterator c(svdata->getBox(), 1, true); + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(svdata->getBox(), 1)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(svdata->getBox(), 1)); c != cend && test_passed; ++c) { pdat::EdgeIndex edge_index = *c; if (!tbox::MathUtilities::equalEps((*svdata)(edge_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/edge_hiertest.C b/base/SAMRAI/SAMRAI/source/test/dataops/edge_hiertest.C index 1c4fae0c..0d3d832f 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/edge_hiertest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/edge_hiertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test edge-centered patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -68,21 +68,15 @@ int main( tbox::SAMRAIManager::initialize(); tbox::SAMRAIManager::startup(); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (argc < 2) { TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != tbox::Dimension(2)) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("edge_hiertest.") + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); @@ -92,25 +86,51 @@ int main( * then there will be memory leaks reported. */ { - - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2), hier::BlockId(0)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4), hier::BlockId(0)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7), hier::BlockId(0)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7), hier::BlockId(0)); - hier::IntVector ratio(dim2d, 2); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; @@ -132,37 +152,39 @@ int main( hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); - // Note: For these simple tests we allow at most 2 processors. + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -173,33 +195,33 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; int svindx[NVARS]; - fvar[0].reset(new pdat::EdgeVariable(dim2d, "fvar0", 1)); + fvar[0].reset(new pdat::EdgeVariable(dim, "fvar0", 1)); svindx[0] = variable_db->registerVariableAndContext( fvar[0], dummy, no_ghosts); - fvar[1].reset(new pdat::EdgeVariable(dim2d, "fvar1", 1)); + fvar[1].reset(new pdat::EdgeVariable(dim, "fvar1", 1)); svindx[1] = variable_db->registerVariableAndContext( fvar[1], dummy, no_ghosts); - fvar[2].reset(new pdat::EdgeVariable(dim2d, "fvar2", 1)); + fvar[2].reset(new pdat::EdgeVariable(dim, "fvar2", 1)); svindx[2] = variable_db->registerVariableAndContext( fvar[2], dummy, no_ghosts); - fvar[3].reset(new pdat::EdgeVariable(dim2d, "fvar3", 1)); + fvar[3].reset(new pdat::EdgeVariable(dim, "fvar3", 1)); svindx[3] = variable_db->registerVariableAndContext( fvar[3], dummy, no_ghosts); boost::shared_ptr > swgt( - new pdat::EdgeVariable(dim2d, "swgt", 1)); + new pdat::EdgeVariable(dim, "swgt", 1)); int swgt_id = variable_db->registerVariableAndContext( swgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(svindx[iv]); } } @@ -222,102 +244,832 @@ int main( // Initialize control volume data for edge-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr pgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double edge_vol = dx[0] * dx[1]; + double edge_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + edge_vol *= dx[i]; + } boost::shared_ptr > data( - patch->getPatchData(swgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(swgt_id))); + TBOX_ASSERT(data); data->fillAll(edge_vol); pdat::EdgeIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, - plo1), pdat::EdgeIndex::X, pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::EdgeIndex(hier::Index(phi0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + } + // left and right edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, - plo1), pdat::EdgeIndex::X, pdat::EdgeIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::EdgeIndex(hier::Index(ic, - phi1), pdat::EdgeIndex::X, pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::EdgeIndex(hier::Index(phi0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine edge boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::EdgeIndex(hier::Index(ic, plo1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic, phi1), + pdat::EdgeIndex::X, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine edge boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, - plo1), pdat::EdgeIndex::X, pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::EdgeIndex(hier::Index(ic, - phi1), pdat::EdgeIndex::X, pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + // bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + } + } else { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 0.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 0.25; + } } } else { - // top and bottom coarse-fine edge boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::EdgeIndex(hier::Index(ic, - plo1), pdat::EdgeIndex::X, pdat::EdgeIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::EdgeIndex(hier::Index(ic, - phi1), pdat::EdgeIndex::X, pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine edge boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::EdgeIndex(hier::Index(plo0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::EdgeIndex(hier::Index(phi0, - ic), pdat::EdgeIndex::Y, pdat::EdgeIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // left face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } else { + // front and back face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + // top and bottom face boundary edges + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + } + for (ic0 = plo0; ic0 < phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 1.5; + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 1.5; + } + // left and right face boundary edges + for (ic2 = plo2; ic2 < phi2; ++ic2) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + } + for (ic2 = plo2; ic2 < phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + for (ic1 = plo1; ic1 < phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 1.5; + } + // front and back top and bottom edges + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, phi1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, phi2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(ic0, plo1, plo2), + pdat::EdgeIndex::X, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) *= 2.25; + } + // left and right top and bottom edges + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + fi = pdat::EdgeIndex(hier::Index(plo0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, phi1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(plo0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, plo1, ic2), + pdat::EdgeIndex::Z, + pdat::EdgeIndex::LowerRight); + (*data)(fi) *= 2.25; + } + // left and right front and back edges + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(plo0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerLeft); + (*data)(fi) = 0.0; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, phi2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight); + (*data)(fi) *= 2.25; + fi = pdat::EdgeIndex(hier::Index(phi0, ic1, plo2), + pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperLeft); + (*data)(fi) *= 2.25; + } } } } @@ -330,13 +1082,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::EdgeData > cvdata = patch->getPatchData(cwgt_id); * - * pdat::EdgeIterator cend(cvdata->getBox(), 1, false); - * for (pdat::EdgeIterator c(cvdata->getBox(), 1, true); c != cend && vol_test_passed; ++c) { + * pdat::EdgeIterator cend(pdat::EdgeGeometry::end(cvdata->getBox(), 1)); + * for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(cvdata->getBox(), 1)); c != cend && vol_test_passed; ++c) { * pdat::EdgeIndex edge_index = *c; * * if (ln == 0) { @@ -360,7 +1112,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -372,25 +1124,40 @@ int main( // Test #1b: math::HierarchyEdgeDataOpsReal::sumControlVolumes() // Expected: norm = 1.0 - double norm = - edge_ops->sumControlVolumes(svindx[0], swgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchyEdgeDataOpsReal::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + double norm = edge_ops->sumControlVolumes(svindx[0], swgt_id); + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchyEdgeDataOpsReal::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchyEdgeDataOpsReal::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = edge_ops->numberOfEntries(svindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyEdgeDataOpsReal::numberOfEntries()\n" - << "Expected value = 209 , Computed value = " - << num_data_points << std::endl; + int num_data_points = static_cast(edge_ops->numberOfEntries(svindx[0])); + { + int compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2615; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyEdgeDataOpsReal::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyEdgeDataOpsReal::setToScalar() @@ -398,7 +1165,7 @@ int main( double val0 = double(2.0); edge_ops->setToScalar(svindx[0], val0); if (!doubleDataSameAsValue(svindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyEdgeDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -410,7 +1177,7 @@ int main( edge_ops->setToScalar(svindx[1], 4.0); double val1 = 4.0; if (!doubleDataSameAsValue(svindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyEdgeDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -421,7 +1188,7 @@ int main( // Expected: v2 = v1 = (4.0) edge_ops->copyData(svindx[2], svindx[1]); if (!doubleDataSameAsValue(svindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyEdgeDataOpsReal::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -432,14 +1199,14 @@ int main( // Expected: v0 = (4.0), v1 = (2.0) edge_ops->swapData(svindx[0], svindx[1]); if (!doubleDataSameAsValue(svindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyEdgeDataOpsReal::swapData()\n" << "Expected: v0 = " << val1 << std::endl; edge_ops->printData(svindx[0], tbox::plog); } if (!doubleDataSameAsValue(svindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyEdgeDataOpsReal::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -451,7 +1218,7 @@ int main( edge_ops->scale(svindx[2], 0.25, svindx[2]); double val_scale = 1.0; if (!doubleDataSameAsValue(svindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyEdgeDataOpsReal::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -463,7 +1230,7 @@ int main( edge_ops->add(svindx[3], svindx[0], svindx[1]); double val_add = 6.0; if (!doubleDataSameAsValue(svindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyEdgeDataOpsReal::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -478,7 +1245,7 @@ int main( edge_ops->subtract(svindx[1], svindx[3], svindx[0]); double val_sub = 6.0; if (!doubleDataSameAsValue(svindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyEdgeDataOpsReal::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -490,7 +1257,7 @@ int main( edge_ops->addScalar(svindx[1], svindx[1], 0.0); double val_addScalar = 6.0; if (!doubleDataSameAsValue(svindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyEdgeDataOpsReal::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -502,7 +1269,7 @@ int main( edge_ops->addScalar(svindx[2], svindx[2], 0.0); val_addScalar = 1.0; if (!doubleDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyEdgeDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -514,7 +1281,7 @@ int main( edge_ops->addScalar(svindx[2], svindx[2], 3.0); val_addScalar = 4.0; if (!doubleDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyEdgeDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -529,7 +1296,7 @@ int main( edge_ops->multiply(svindx[1], svindx[3], svindx[1]); double val_mult = 3.0; if (!doubleDataSameAsValue(svindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10 math::HierarchyEdgeDataOpsReal::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -541,7 +1308,7 @@ int main( edge_ops->divide(svindx[0], svindx[2], svindx[1]); double val_div = 1.333333333333; if (!doubleDataSameAsValue(svindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11 math::HierarchyEdgeDataOpsReal::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -553,7 +1320,7 @@ int main( edge_ops->reciprocal(svindx[1], svindx[1]); double val_rec = 0.33333333333333; if (!doubleDataSameAsValue(svindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12 math::HierarchyEdgeDataOpsReal::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -565,7 +1332,7 @@ int main( edge_ops->abs(svindx[3], svindx[2]); double val_abs = 4.0; if (!doubleDataSameAsValue(svindx[3], val_abs, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13 math::HierarchyEdgeDataOpsReal::abs()\n" << "Expected: v3 = " << val_abs << std::endl; @@ -577,21 +1344,34 @@ int main( // set values boost::shared_ptr level_zero( - hierarchy->getPatchLevel(0)); + hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { patch = *ip; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(svindx[2])); - hier::Index index0(2, 2); - hier::Index index1(5, 3); - if (patch->getBox().contains(index0)) { - (*cdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower), 0) = 100.0; - } - if (patch->getBox().contains(index1)) { - (*cdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper), 0) = -1000.0; + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(cdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; + if (dim.getValue() == 2) { + if (patch->getBox().contains(index0)) { + (*cdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, + pdat::EdgeIndex::Lower), 0) = 100.0; + } + if (patch->getBox().contains(index1)) { + (*cdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, + pdat::EdgeIndex::Upper), 0) = -1000.0; + } + } else { + if (patch->getBox().contains(index0)) { + (*cdata)(pdat::EdgeIndex(index0, pdat::EdgeIndex::Y, + pdat::EdgeIndex::LowerRight), 0) = 100.0; + } + if (patch->getBox().contains(index1)) { + (*cdata)(pdat::EdgeIndex(index1, pdat::EdgeIndex::Y, + pdat::EdgeIndex::UpperRight), 0) = -1000.0; + } } } @@ -600,18 +1380,26 @@ int main( for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { patch = *ipp; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(svindx[2])); - pdat::EdgeIndex index0(hier::Index(2, - 2), pdat::EdgeIndex::Y, - pdat::EdgeIndex::Lower); - pdat::EdgeIndex index1(hier::Index(5, - 3), pdat::EdgeIndex::Y, - pdat::EdgeIndex::Upper); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(cdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + int corner0, corner1; + if (dim.getValue() == 2) { + corner0 = pdat::EdgeIndex::Lower; + corner1 = pdat::EdgeIndex::Upper; + } else { + corner0 = pdat::EdgeIndex::LowerRight; + corner1 = pdat::EdgeIndex::UpperRight; + } + pdat::EdgeIndex index0(idx0, pdat::EdgeIndex::Y, corner0); + pdat::EdgeIndex index1(idx1, pdat::EdgeIndex::Y, corner1); // check X axis data - pdat::EdgeIterator cend(cdata->getBox(), pdat::EdgeIndex::X, false); - for (pdat::EdgeIterator c(cdata->getBox(), pdat::EdgeIndex::X, true); + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(cdata->getBox(), pdat::EdgeIndex::X)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(cdata->getBox(), pdat::EdgeIndex::X)); c != cend && bogus_value_test_passed; ++c) { pdat::EdgeIndex edge_index = *c; @@ -623,8 +1411,8 @@ int main( } // check Y axis data - pdat::EdgeIterator ccend(cdata->getBox(), pdat::EdgeIndex::Y, false); - for (pdat::EdgeIterator cc(cdata->getBox(), pdat::EdgeIndex::Y, true); + pdat::EdgeIterator ccend(pdat::EdgeGeometry::end(cdata->getBox(), pdat::EdgeIndex::Y)); + for (pdat::EdgeIterator cc(pdat::EdgeGeometry::begin(cdata->getBox(), pdat::EdgeIndex::Y)); cc != ccend && bogus_value_test_passed; ++cc) { pdat::EdgeIndex edge_index = *cc; @@ -648,9 +1436,24 @@ int main( } } } + + if (dim.getValue() == 3) { + // check Z axis data + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(cdata->getBox(), pdat::EdgeIndex::Z)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(cdata->getBox(), pdat::EdgeIndex::Z)); + c != cend && bogus_value_test_passed; + ++c) { + pdat::EdgeIndex edge_index = *c; + + if (!tbox::MathUtilities::equalEps((*cdata)(edge_index), + 4.0)) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: Place some bogus values on coarse level" << std::endl; @@ -660,43 +1463,67 @@ int main( // Test #15: math::HierarchyEdgeDataOpsReal::L1Norm() - w/o control weights // Expected: bogus_l1_norm = 1984.00 double bogus_l1_norm = edge_ops->L1Norm(svindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1984.00)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchyEdgeDataOpsReal::L1Norm()" - << " - w/o control weights\n" - << "Expected value = 1984.00, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1984.0; + } else { + compare = 12592.0; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchyEdgeDataOpsReal::L1Norm()" + << " - w/o control weights\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #16: math::HierarchyEdgeDataOpsReal::L1Norm() - w/control weights // Expected: correct_l1_norm = 4.0 double correct_l1_norm = edge_ops->L1Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchyEdgeDataOpsReal::L1Norm()" - << " - w/control weights\n" - << "Expected value = 4.0, Computed value = " - << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 6.0; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchyEdgeDataOpsReal::L1Norm()" + << " - w/control weights\n" + << "Expected value = " << compare << ", Computed value = " + << correct_l1_norm << std::endl; + } } // Test #17: math::HierarchyEdgeDataOpsReal::L2Norm() // Expected: l2_norm = 4.0 double l2_norm = edge_ops->L2Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #17: math::HierarchyEdgeDataOpsReal::L2Norm()\n" - << "Expected value = 4.0, Computed value = " - << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 4.89897948557; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #17: math::HierarchyEdgeDataOpsReal::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << l2_norm << std::endl; + } } // Test #18: math::HierarchyEdgeDataOpsReal::maxNorm() - w/o control weights // Expected: bogus_max_norm = 1000.0 double bogus_max_norm = edge_ops->maxNorm(svindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyEdgeDataOpsReal::maxNorm()" << " - w/o control weights\n" @@ -708,7 +1535,7 @@ int main( // Expected: max_norm = 4.0 double max_norm = edge_ops->maxNorm(svindx[2], swgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyEdgeDataOpsReal::maxNorm()" << " - w/control weights\n" @@ -726,7 +1553,7 @@ int main( edge_ops->linearSum(svindx[3], 2.0, svindx[1], 0.0, svindx[0]); double val_linearSum = 5.0; if (!doubleDataSameAsValue(svindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyEdgeDataOpsReal::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -738,7 +1565,7 @@ int main( edge_ops->axmy(svindx[3], 3.0, svindx[1], svindx[0]); double val_axmy = 6.5; if (!doubleDataSameAsValue(svindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::HierarchyEdgeDataOpsReal::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -748,34 +1575,50 @@ int main( // Test #22a: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 17.5 double cdot = edge_ops->dot(svindx[2], svindx[1], swgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22a: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22a: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // Test #22b: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 17.5 cdot = edge_ops->dot(svindx[1], svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22b: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22b: math::HierarchyEdgeDataOpsReal::dot() - (ind2) * (ind1)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(svindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } swgt.reset(); @@ -811,17 +1654,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(cvdata); - pdat::EdgeIterator cend(cvdata->getBox(), 1, false); - for (pdat::EdgeIterator c(cvdata->getBox(), 1, true); + pdat::EdgeIterator cend(pdat::EdgeGeometry::end(cvdata->getBox(), 1)); + for (pdat::EdgeIterator c(pdat::EdgeGeometry::begin(cvdata->getBox(), 1)); c != cend && test_passed; ++c) { pdat::EdgeIndex edge_index = *c; if (!tbox::MathUtilities::equalEps((*cvdata)(edge_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/face_cplxtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/face_cplxtest.C index 036f7dce..b836ed9c 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/face_cplxtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/face_cplxtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test face-centered complex patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -77,17 +77,13 @@ int main( TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } - const int d = atoi(argv[1]); + const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= SAMRAI_MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != 2) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("face_cplxtest.") - + tbox::Utilities::intToString(dim, 1) + "d.log"; + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); /* @@ -95,26 +91,58 @@ int main( * then there will be memory leaks reported. */ { - const tbox::Dimension dim2(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7)); - hier::IntVector ratio(dim2, 2); - - hier::BoxContainer coarse_domain(dim); - hier::BoxContainer fine_boxes(dim); - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_boxes.appendItem(fine0); - fine_boxes.appendItem(fine1); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } + + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); + + hier::BoxContainer coarse_domain; + hier::BoxContainer fine_boxes; + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_boxes.pushBack(fine0); + fine_boxes.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -126,38 +154,42 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_boxes.getNumberOfBoxes(); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getRank()) { - layer0.addBox(hier::Box(*coarse_itr, ib, - layer0.getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, ib, 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getRank()) { - layer1.addBox(hier::Box(*fine_itr, ib, - layer1.getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, ib, 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -168,7 +200,7 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; @@ -192,9 +224,9 @@ int main( fwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(fwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(fvindx[iv]); } } @@ -213,104 +245,318 @@ int main( 1)); boost::shared_ptr patch; - boost::shared_ptr pgeom; // Initialize control volume data for face-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - boost::shared_ptr > data; - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); + patch = *ip; + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double face_vol = dx[0] * dx[1]; - data = patch->getPatchData(fwgt_id); + double face_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + face_vol *= dx[i]; + } + boost::shared_ptr > data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fwgt_id))); + TBOX_ASSERT(data); data->fillAll(face_vol); pdat::FaceIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom face boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::FaceIndex(hier::Index(ic, - plo1), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right face boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::FaceIndex(hier::Index(plo0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::FaceIndex(hier::Index(phi0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::FaceIndex(hier::Index(ic, plo1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + //left and right face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::FaceIndex(hier::Index(plo0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::FaceIndex(hier::Index(phi0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::FaceIndex(hier::Index(ic, plo1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::FaceIndex(hier::Index(ic, phi1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::FaceIndex(hier::Index(plo0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::FaceIndex(hier::Index(phi0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom face boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::FaceIndex(hier::Index(ic, - plo1), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::FaceIndex(hier::Index(ic, - phi1), pdat::FaceIndex::Y, pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right face boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::FaceIndex(hier::Index(plo0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::FaceIndex(hier::Index(phi0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::FaceIndex(hier::Index(ic, plo1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::FaceIndex(hier::Index(ic, phi1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::FaceIndex(hier::Index(plo0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::FaceIndex(hier::Index(ic, plo1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::FaceIndex(hier::Index(ic, phi1), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::FaceIndex(hier::Index(plo0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::FaceIndex(hier::Index(phi0, ic), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::FaceIndex(hier::Index(ic, - plo1), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::FaceIndex(hier::Index(ic, - phi1), pdat::FaceIndex::Y, pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine face boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::FaceIndex(hier::Index(plo0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } } } else { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::FaceIndex(hier::Index(ic, - plo1), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::FaceIndex(hier::Index(ic, - phi1), pdat::FaceIndex::Y, pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine face boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::FaceIndex(hier::Index(plo0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::FaceIndex(hier::Index(phi0, - ic), pdat::FaceIndex::X, pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + } } } } @@ -322,13 +568,13 @@ int main( // Test #1a: Check control volume data set properly // Expected: cwgt = /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::FaceData > fvdata = patch->getPatchData(fwgt_id); * - * pdat::FaceIterator cend(fvdata->getBox(),1, false); - * for (pdat::FaceIterator c(fvdata->getBox(), 1, true); c != cend && vol_test_passed; ++c) { + * pdat::FaceIterator cend(pdat::FaceGeometry::end(fvdata->getBox(), 1)); + * for (pdat::FaceIterator c(pdat::FaceGeometry::begin(fvdata->getBox(), 1)); c != cend && vol_test_passed; ++c) { * pdat::FaceIndex face_index = *c; * * if (ln == 0) { @@ -352,32 +598,47 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * fwgt_ops->printData(fwgt_id, tbox::plog); * } */ // Test #1b: math::HierarchyFaceDataOpsComplex::sumControlVolumes() // Expected: norm = 1.0 - double norm = - face_ops->sumControlVolumes(fvindx[0], fwgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchyFaceDataOpsComplex::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + double norm = face_ops->sumControlVolumes(fvindx[0], fwgt_id); + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchyFaceDataOpsComplex::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchyFaceDataOpsComplex::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = face_ops->numberOfEntries(fvindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyFaceDataOpsComplex::numberOfEntries()\n" - << "Expected value = 209 , Computed value = " - << num_data_points << std::endl; + size_t num_data_points = face_ops->numberOfEntries(fvindx[0]); + { + size_t compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2276; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyFaceDataOpsComplex::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyFaceDataOpsComplex::setToScalar() @@ -385,7 +646,7 @@ int main( dcomplex val0 = dcomplex(2.0, 1.5); face_ops->setToScalar(fvindx[0], val0); if (!complexDataSameAsValue(fvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyFaceDataOpsComplex::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -397,7 +658,7 @@ int main( dcomplex val1(4.0, 3.0); face_ops->setToScalar(fvindx[1], val1); if (!complexDataSameAsValue(fvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyFaceDataOpsComplex::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -408,7 +669,7 @@ int main( // Expected: v2 = v1 = (4.0,3.0) face_ops->copyData(fvindx[2], fvindx[1]); if (!complexDataSameAsValue(fvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyFaceDataOpsComplex::copyData()\n" << "Expected: v2 = v1 = " << val1 << std::endl; @@ -419,14 +680,14 @@ int main( // Expected: v0 = (4.0, 3.0), v1 = (2.0,1.5) face_ops->swapData(fvindx[0], fvindx[1]); if (!complexDataSameAsValue(fvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyFaceDataOpsComplex::swapData()\n" << "Expected: v0 = " << val1 << std::endl; face_ops->printData(fvindx[0], tbox::plog); } if (!complexDataSameAsValue(fvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyFaceDataOpsComplex::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -438,7 +699,7 @@ int main( face_ops->scale(fvindx[2], 0.25, fvindx[2]); dcomplex val_scale(1.0, 0.75); if (!complexDataSameAsValue(fvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyFaceDataOpsComplex::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -450,7 +711,7 @@ int main( face_ops->add(fvindx[3], fvindx[0], fvindx[1]); dcomplex val_add(6.0, 4.5); if (!complexDataSameAsValue(fvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyFaceDataOpsComplex::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -465,7 +726,7 @@ int main( face_ops->subtract(fvindx[1], fvindx[3], fvindx[0]); dcomplex val_sub(6.0, 0.0); if (!complexDataSameAsValue(fvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyFaceDataOpsComplex::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -477,7 +738,7 @@ int main( face_ops->addScalar(fvindx[1], fvindx[1], dcomplex(0.0, -4.0)); dcomplex val_addScalar(6.0, -4.0); if (!complexDataSameAsValue(fvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyFaceDataOpsComplex::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -489,7 +750,7 @@ int main( face_ops->addScalar(fvindx[2], fvindx[2], dcomplex(0.0, 0.25)); val_addScalar = dcomplex(1.0, 1.0); if (!complexDataSameAsValue(fvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyFaceDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -501,7 +762,7 @@ int main( face_ops->addScalar(fvindx[2], fvindx[2], dcomplex(3.0, -4.0)); val_addScalar = dcomplex(4.0, -3.0); if (!complexDataSameAsValue(fvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyFaceDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -516,7 +777,7 @@ int main( face_ops->multiply(fvindx[1], fvindx[3], fvindx[1]); dcomplex val_mult(3.0, -2.0); if (!complexDataSameAsValue(fvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyFaceDataOpsComplex::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -528,7 +789,7 @@ int main( face_ops->divide(fvindx[0], fvindx[2], fvindx[1]); dcomplex val_div(1.3846153846154, -0.076923076923077); if (!complexDataSameAsValue(fvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyFaceDataOpsComplex::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -540,7 +801,7 @@ int main( face_ops->reciprocal(fvindx[1], fvindx[1]); dcomplex val_rec(0.23076923076923, 0.15384615384615); if (!complexDataSameAsValue(fvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyFaceDataOpsComplex::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -555,10 +816,13 @@ int main( hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - cdata = patch->getPatchData(fvindx[2]); - hier::Index index0(2, 2); - hier::Index index1(5, 3); + patch = *ip; + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[2])); + TBOX_ASSERT(cdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; if (patch->getBox().contains(index0)) { (*cdata)(pdat::FaceIndex(index0, pdat::FaceIndex::Y, pdat::FaceIndex::Lower), 0) = dcomplex(100.0, -50.0); @@ -573,20 +837,24 @@ int main( bool bogus_value_test_passed = true; for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - cdata = patch->getPatchData(fvindx[2]); - pdat::FaceIndex index0(hier::Index(2, - 2), pdat::FaceIndex::Y, + patch = *ipp; + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[2])); + TBOX_ASSERT(cdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::FaceIndex index0(idx0, + pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - pdat::FaceIndex index1(hier::Index(5, - 3), pdat::FaceIndex::Y, + pdat::FaceIndex index1(idx1, + pdat::FaceIndex::Y, pdat::FaceIndex::Upper); // check X axis data - pdat::FaceIterator cend(cdata->getBox(), pdat::FaceIndex::X, false); - for (pdat::FaceIterator c(cdata->getBox(), pdat::FaceIndex::X, true); - c != cend && bogus_value_test_passed; - ++c) { + pdat::FaceIterator cend(pdat::FaceGeometry::end(cdata->getBox(), pdat::FaceIndex::X)); + for (pdat::FaceIterator c(pdat::FaceGeometry::begin(cdata->getBox(), pdat::FaceIndex::X)); + c != cend && bogus_value_test_passed; ++c) { pdat::FaceIndex face_index = *c; if (!tbox::MathUtilities::equalEps((*cdata)(face_index), @@ -596,10 +864,9 @@ int main( } // check Y axis data - pdat::FaceIterator ccend(cdata->getBox(), pdat::FaceIndex::Y, false); - for (pdat::FaceIterator cc(cdata->getBox(), pdat::FaceIndex::Y, true); - cc != ccend && bogus_value_test_passed; - ++cc) { + pdat::FaceIterator ccend(pdat::FaceGeometry::end(cdata->getBox(), pdat::FaceIndex::Y)); + for (pdat::FaceIterator cc(pdat::FaceGeometry::begin(cdata->getBox(), pdat::FaceIndex::Y)); + cc != ccend && bogus_value_test_passed; ++cc) { pdat::FaceIndex face_index = *cc; if (face_index == index0) { @@ -623,9 +890,23 @@ int main( } } } + + if (dim.getValue() == 3) { + // check Z axis data + pdat::FaceIterator cend(pdat::FaceGeometry::end(cdata->getBox(), pdat::FaceIndex::Z)); + for (pdat::FaceIterator c(pdat::FaceGeometry::begin(cdata->getBox(), pdat::FaceIndex::Z)); + c != cend && bogus_value_test_passed; ++c) { + pdat::FaceIndex face_index = *c; + + if (!tbox::MathUtilities::equalEps((*cdata)(face_index), + dcomplex(4.0, -3.0))) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: Place some bogus values on coarse level" << std::endl; @@ -637,43 +918,67 @@ int main( // Test #14: math::HierarchyFaceDataOpsComplex::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 2217.003379 double bogus_l1_norm = face_ops->L1Norm(fvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 2217.003379)) { - num_failures++; - tbox::perr - << "FAILED: - Test #14: math::HierarchyFaceDataOpsComplex::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 2217.003379, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 2217.003379; + } else { + compare = 13062.0033789; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #14: math::HierarchyFaceDataOpsComplex::L1Norm()" + << " - w/o control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #15: math::HierarchyFaceDataOpsComplex::L1Norm() - w/ control weight // Expected: correct_l1_norm = 5.0 double correct_l1_norm = face_ops->L1Norm(fvindx[2], fwgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchyFaceDataOpsComplex::L1Norm()" - << " - w/ control weight\n" - << "Expected value = 5.0, Computed value = " - << std::setprecision(12) << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 7.5; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchyFaceDataOpsComplex::L1Norm()" + << " - w/ control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << correct_l1_norm << std::endl; + } } // Test #16: math::HierarchyFaceDataOpsComplex::L2Norm() // Expected: l2_norm = 5.0 double l2_norm = face_ops->L2Norm(fvindx[2], fwgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchyFaceDataOpsComplex::L2Norm()\n" - << "Expected value = 5.0, Computed value = " - << std::setprecision(12) << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 6.12372435696; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchyFaceDataOpsComplex::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << l2_norm << std::endl; + } } // Test #17: math::HierarchyFaceDataOpsComplex::maxNorm() - w/o control weight // Expected: bogus_max_norm = 1000.19998 double bogus_max_norm = face_ops->maxNorm(fvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.19998)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchyFaceDataOpsComplex::maxNorm()" << " - w/o control weight\n" @@ -685,7 +990,7 @@ int main( // Expected: bogus_max_norm = 1000.19998 double max_norm = face_ops->maxNorm(fvindx[2], fwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 5.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyFaceDataOpsComplex::maxNorm()" << " - w/ control weight\n" @@ -704,7 +1009,7 @@ int main( dcomplex(2.0, 0.0), fvindx[1], dcomplex(0.0, -1.0), fvindx[0]); dcomplex val_linearSum(2.0, 5.0); if (!complexDataSameAsValue(fvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyFaceDataOpsComplex::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -716,7 +1021,7 @@ int main( face_ops->axmy(fvindx[3], 3.0, fvindx[1], fvindx[0]); dcomplex val_axmy(6.5, 12.0); if (!complexDataSameAsValue(fvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyFaceDataOpsComplex::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -726,24 +1031,30 @@ int main( // Test #21a: math::HierarchyFaceDataOpsComplex::dot() // Expected: cdot = (17.5,-21.0) dcomplex cdot = face_ops->dot(fvindx[2], fvindx[1], fwgt_id); - dcomplex ans_2_dot_1(17.5, -21.0); + double ctl_wt; + if (dim.getValue() == 2) { + ctl_wt = 1.0; + } else { + ctl_wt = 1.5; + } + dcomplex ans_2_dot_1(17.5 * ctl_wt, -21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot, ans_2_dot_1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21a: math::HierarchyFaceDataOpsComplex::dot()\n" - << "Expected value = (17.5,-21.0), Computed value = " + << "Expected value = " << ans_2_dot_1 << ", Computed value = " << cdot << std::endl; } // Test #21b: math::HierarchyFaceDataOpsComplex::dot() // Expected: cdot = (17.5,21.0) dcomplex cdot2 = face_ops->dot(fvindx[1], fvindx[2], fwgt_id); - dcomplex ans_1_dot_2(17.5, 21.0); + dcomplex ans_1_dot_2(17.5 * ctl_wt, 21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot2, ans_1_dot_2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21b: math::HierarchyFaceDataOpsComplex::dot()\n" - << "Expected value = (17.5,21.0), Computed value = " + << "Expected value = " << ans_1_dot_2 << ", Computed value = " << cdot2 << std::endl; } @@ -752,7 +1063,7 @@ int main( face_ops->setToScalar(fvindx[0], dcomplex(4.0, -3.0)); face_ops->abs(fwgt_id, fvindx[0]); if (!doubleDataSameAsValue(fwgt_id, 5.0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::HierarchyFaceDataOpsComplex::abs()\n" << "Expected: abs(v0) = 5.0" << std::endl; @@ -760,14 +1071,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(fwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(fvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } fwgt.reset(); @@ -803,16 +1114,18 @@ complexDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > fvdata( - patch->getPatchData(desc_id)); - pdat::FaceIterator fend(fvdata->getBox(), 1, false); - for (pdat::FaceIterator f(fvdata->getBox(), 1, true); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + TBOX_ASSERT(fvdata); + pdat::FaceIterator fend(pdat::FaceGeometry::end(fvdata->getBox(), 1)); + for (pdat::FaceIterator f(pdat::FaceGeometry::begin(fvdata->getBox(), 1)); f != fend && test_passed; ++f) { pdat::FaceIndex face_index = *f; if (!tbox::MathUtilities::equalEps((*fvdata)(face_index), @@ -840,17 +1153,20 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > fvdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(fvdata); - pdat::FaceIterator fend(fvdata->getBox(), 1, false); - for (pdat::FaceIterator f(fvdata->getBox(), 1, true); + pdat::FaceIterator fend(pdat::FaceGeometry::end(fvdata->getBox(), 1)); + for (pdat::FaceIterator f(pdat::FaceGeometry::begin(fvdata->getBox(), 1)); f != fend && test_passed; ++f) { pdat::FaceIndex face_index = *f; if (!tbox::MathUtilities::equalEps((*fvdata)(face_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/face_hiertest.C b/base/SAMRAI/SAMRAI/source/test/dataops/face_hiertest.C index b86e24d0..57a01bf7 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/face_hiertest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/face_hiertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test face-centered patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -76,13 +76,9 @@ int main( const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != tbox::Dimension(2)) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("face_hiertest.") + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); @@ -93,40 +89,52 @@ int main( */ { - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - int coarse0_array[2][2] = { { 0, 0 }, { 9, 2 } }; - hier::Box coarse0((hier::Index(dim2d, coarse0_array[0])), - (hier::Index(dim2d, coarse0_array[1])), - hier::BlockId(0)); - - int coarse1_array[2][2] = { { 0, 3 }, { 9, 4 } }; - hier::Box coarse1((hier::Index(dim2d, coarse1_array[0])), - (hier::Index(dim2d, coarse1_array[1])), - hier::BlockId(0)); - - int fine0_array[2][2] = { { 4, 4 }, { 7, 7 } }; - hier::Box fine0((hier::Index(dim2d, fine0_array[0])), - (hier::Index(dim2d, fine0_array[1])), - hier::BlockId(0)); - - int fine1_array[2][2] = { { 8, 4 }, { 13, 7 } }; - hier::Box fine1((hier::Index(dim2d, fine1_array[0])), - (hier::Index(dim2d, fine1_array[1])), - hier::BlockId(0)); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } - hier::IntVector ratio(dim2d, 2); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); + hier::IntVector ratio(dim, 2); hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; @@ -148,37 +156,38 @@ int main( hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); - // Note: For these simple tests we allow at most 2 processors. const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -189,7 +198,7 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; @@ -213,9 +222,9 @@ int main( fwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(fwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(fvindx[iv]); } } @@ -238,130 +247,328 @@ int main( // Initialize control volume data for face-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - boost::shared_ptrpgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double face_vol = dx[0] * dx[1]; - boost::shared_ptr >data( - patch->getPatchData(fwgt_id), - boost::detail::dynamic_cast_tag()); + double face_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + face_vol *= dx[i]; + } + boost::shared_ptr > data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fwgt_id))); + TBOX_ASSERT(data); data->fillAll(face_vol); pdat::FaceIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom face boundaries - for (ic = plo0; ic <= phi0; ic++) { - int array_lo[2] = { ic, plo1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::Y, - pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right face boundaries - for (ic = plo1; ic <= phi1; ic++) { - int array_lo[2] = { plo0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::X, - pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - int array_up[2] = { phi0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::X, - pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + int array_lo[2] = { ic, plo1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + // left and right face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + int array_lo[2] = { plo0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_up[2] = { phi0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + int array_lo[2] = { ic, plo1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + int array_up[2] = { ic, phi1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + int array_lo[2] = { plo0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_up[2] = { phi0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom face boundaries - for (ic = plo0; ic <= phi0; ic++) { - int array_lo[2] = { ic, plo1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::Y, - pdat::FaceIndex::Lower); - (*data)(fi) = 0.0; - int array_up[2] = { ic, phi1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::Y, - pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right face boundaries - for (ic = plo1; ic <= phi1; ic++) { - int array_lo[2] = { plo0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::X, - pdat::FaceIndex::Lower); - (*data)(fi) *= 0.5; - int array_up[2] = { phi0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::X, - pdat::FaceIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + int array_lo[2] = { ic, plo1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + int array_up[2] = { ic, phi1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + int array_lo[2] = { plo0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + int array_lo[2] = { ic, plo1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + int array_up[2] = { ic, phi1 }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + int array_lo[2] = { plo0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_lo), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + int array_up[2] = { phi0, ic }; + fi = pdat::FaceIndex(hier::Index(dim, array_up), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic <= phi0; ic++) { - int array_lo[2] = { ic, plo1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::Y, - pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; - int array_up[2] = { ic, phi1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::Y, - pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine face boundaries - for (ic = plo1; ic <= phi1; ic++) { - int array_lo[2] = { plo0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::X, - pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 0.5; + } + } } } else { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic <= phi0; ic++) { - int array_lo[2] = { ic, plo1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::Y, - pdat::FaceIndex::Lower); - (*data)(fi) *= 1.5; - int array_up[2] = { ic, phi1 }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::Y, - pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine face boundaries - for (ic = plo1; ic <= phi1; ic++) { - int array_lo[2] = { plo0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_lo), pdat::FaceIndex::X, - pdat::FaceIndex::Lower); - (*data)(fi) = 0.0; - int array_up[2] = { phi0, ic }; - fi = pdat::FaceIndex(hier::Index(dim2d, - array_up), pdat::FaceIndex::X, - pdat::FaceIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_front), + pdat::FaceIndex::Z, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_back), + pdat::FaceIndex::Z, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_top), + pdat::FaceIndex::Y, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_bottom), + pdat::FaceIndex::Y, + pdat::FaceIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_left), + pdat::FaceIndex::X, + pdat::FaceIndex::Lower); + (*data)(fi) = 0.0; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::FaceIndex(hier::Index(dim, array_right), + pdat::FaceIndex::X, + pdat::FaceIndex::Upper); + (*data)(fi) *= 1.5; + } + } } } } @@ -374,15 +581,17 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::FaceData > cvdata( - * patch->getPatchData(cwgt_id), - * boost::detail::dynamic_cast_tag(); + * BOOST_CAST, hier::PatchData>( + * patch->getPatchData(cwgt_id))); + * + * TBOX_ASSERT(cvdata); * - * pdat::FaceIterator cend(cvdata->getBox(), 1, false); - * for (pdat::FaceIterator c(cvdata->getBox(), 1, true); c != cend && vol_test_passed; ++c) { + * pdat::FaceIterator cend(pdat::FaceGeometry::end(cvdata->getBox(), 1)); + * for (pdat::FaceIterator c(pdat::FaceGeometry::begin(cvdata->getBox(), 1)); c != cend && vol_test_passed; ++c) { * pdat::FaceIndex face_index = *c; * * if (ln == 0) { @@ -406,7 +615,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -419,23 +628,39 @@ int main( // Test #1b: math::HierarchyFaceDataOpsReal::sumControlVolumes() // Expected: norm = 1.0 double norm = face_ops->sumControlVolumes(fvindx[0], fwgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchyFaceDataOpsReal::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchyFaceDataOpsReal::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchyFaceDataOpsReal::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = face_ops->numberOfEntries(fvindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyFaceDataOpsReal::numberOfEntries()\n" - << "Expected value = 209, Computed value = " - << num_data_points << std::endl; + int num_data_points = static_cast(face_ops->numberOfEntries(fvindx[0])); + { + int compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2276; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyFaceDataOpsReal::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyFaceDataOpsReal::setToScalar() @@ -443,7 +668,7 @@ int main( double val0 = double(2.0); face_ops->setToScalar(fvindx[0], val0); if (!doubleDataSameAsValue(fvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyFaceDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -455,7 +680,7 @@ int main( face_ops->setToScalar(fvindx[1], 4.0); double val1 = double(4.0); if (!doubleDataSameAsValue(fvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyFaceDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -466,7 +691,7 @@ int main( // Expected: v2 = v1 = (4.0) face_ops->copyData(fvindx[2], fvindx[1]); if (!doubleDataSameAsValue(fvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyFaceDataOpsReal::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -477,14 +702,14 @@ int main( // Expected: v0 = (4.0), v1 = (2.0) face_ops->swapData(fvindx[0], fvindx[1]); if (!doubleDataSameAsValue(fvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyFaceDataOpsReal::swapData()\n" << "Expected: v0 = " << val1 << std::endl; face_ops->printData(fvindx[0], tbox::plog); } if (!doubleDataSameAsValue(fvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyFaceDataOpsReal::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -496,7 +721,7 @@ int main( face_ops->scale(fvindx[2], 0.25, fvindx[2]); double val_scale = 1.0; if (!doubleDataSameAsValue(fvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyFaceDataOpsReal::swapData()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -508,7 +733,7 @@ int main( face_ops->add(fvindx[3], fvindx[0], fvindx[1]); double val_add = 6.0; if (!doubleDataSameAsValue(fvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyFaceDataOpsReal::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -523,7 +748,7 @@ int main( face_ops->subtract(fvindx[1], fvindx[3], fvindx[0]); double val_sub = 6.0; if (!doubleDataSameAsValue(fvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyFaceDataOpsReal::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -535,7 +760,7 @@ int main( face_ops->addScalar(fvindx[1], fvindx[1], 0.0); double val_addScalar = 6.0; if (!doubleDataSameAsValue(fvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyFaceDataOpsReal::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -547,7 +772,7 @@ int main( face_ops->addScalar(fvindx[2], fvindx[2], 0.0); val_addScalar = 1.0; if (!doubleDataSameAsValue(fvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyFaceDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -559,7 +784,7 @@ int main( face_ops->addScalar(fvindx[2], fvindx[2], 3.0); val_addScalar = 4.0; if (!doubleDataSameAsValue(fvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyFaceDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -574,7 +799,7 @@ int main( face_ops->multiply(fvindx[1], fvindx[3], fvindx[1]); double val_mult = 3.0; if (!doubleDataSameAsValue(fvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyFaceDataOpsReal::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -586,7 +811,7 @@ int main( face_ops->divide(fvindx[0], fvindx[2], fvindx[1]); double val_div = 1.3333333333333; if (!doubleDataSameAsValue(fvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyFaceDataOpsReal::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -598,7 +823,7 @@ int main( face_ops->reciprocal(fvindx[1], fvindx[1]); double val_rec = 0.3333333333333; if (!doubleDataSameAsValue(fvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyFaceDataOpsReal::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -610,7 +835,7 @@ int main( face_ops->abs(fvindx[3], fvindx[2]); double val_abs = 4.0; if (!doubleDataSameAsValue(fvindx[3], val_abs, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: math::HierarchyFaceDataOpsReal::abs()\n" << "Expected: v3 = " << val_abs << std::endl; @@ -626,12 +851,12 @@ int main( for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { patch = *ip; - fdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(fvindx[2])); - int array0[2] = { 2, 2 }; - hier::Index index0(dim2d, array0); - int array1[2] = { 5, 3 }; - hier::Index index1(dim2d, array1); + fdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[2])); + TBOX_ASSERT(fdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; if (patch->getBox().contains(index0)) { (*fdata)(pdat::FaceIndex(index0, pdat::FaceIndex::Y, pdat::FaceIndex::Lower), 0) = 100.0; @@ -648,20 +873,22 @@ int main( for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { patch = *ipp; - fdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(fvindx[2])); - int array0[2] = { 2, 2 }; - pdat::FaceIndex index0(hier::Index(dim2d, - array0), pdat::FaceIndex::Y, + fdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[2])); + TBOX_ASSERT(fdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::FaceIndex index0(idx0, + pdat::FaceIndex::Y, pdat::FaceIndex::Lower); - int array1[2] = { 5, 3 }; - pdat::FaceIndex index1(hier::Index(dim2d, - array1), pdat::FaceIndex::Y, + pdat::FaceIndex index1(idx1, + pdat::FaceIndex::Y, pdat::FaceIndex::Upper); // check X axis data - pdat::FaceIterator cend(fdata->getBox(), pdat::FaceIndex::X, false); - for (pdat::FaceIterator c(fdata->getBox(), pdat::FaceIndex::X, true); + pdat::FaceIterator cend(pdat::FaceGeometry::end(fdata->getBox(), pdat::FaceIndex::X)); + for (pdat::FaceIterator c(pdat::FaceGeometry::begin(fdata->getBox(), pdat::FaceIndex::X)); c != cend && bogus_value_test_passed; ++c) { pdat::FaceIndex face_index = *c; @@ -673,8 +900,8 @@ int main( } // check Y axis data - pdat::FaceIterator ccend(fdata->getBox(), pdat::FaceIndex::Y, false); - for (pdat::FaceIterator cc(fdata->getBox(), pdat::FaceIndex::Y, true); + pdat::FaceIterator ccend(pdat::FaceGeometry::end(fdata->getBox(), pdat::FaceIndex::Y)); + for (pdat::FaceIterator cc(pdat::FaceGeometry::begin(fdata->getBox(), pdat::FaceIndex::Y)); cc != ccend && bogus_value_test_passed; ++cc) { pdat::FaceIndex face_index = *cc; @@ -698,9 +925,25 @@ int main( } } } + + if (dim.getValue() == 3) { + + // check Z axis data + pdat::FaceIterator cend(pdat::FaceGeometry::end(fdata->getBox(), pdat::FaceIndex::Z)); + for (pdat::FaceIterator c(pdat::FaceGeometry::begin(fdata->getBox(), pdat::FaceIndex::Z)); + c != cend && bogus_value_test_passed; + ++c) { + pdat::FaceIndex face_index = *c; + + if (!tbox::MathUtilities::equalEps((*fdata)(face_index), + 4.0)) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: Place some bogus values on coarse level" << std::endl; @@ -710,43 +953,67 @@ int main( // Test #15: math::HierarchyFaceDataOpsReal::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 1984.00 double bogus_l1_norm = face_ops->L1Norm(fvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1984.00)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchyFaceDataOpsReal::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 1984.00, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1984.0; + } else { + compare = 10660.0; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchyFaceDataOpsReal::L1Norm()" + << " - w/o control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #16: math::HierarchyFaceDataOpsReal::L1Norm() - w/control weight // Expected: correct_l1_norm = 4.0 double correct_l1_norm = face_ops->L1Norm(fvindx[2], fwgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchyFaceDataOpsReal::L1Norm()" - << " - w/control weight\n" - << "Expected value = 4.0, Computed value = " - << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 6.0; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchyFaceDataOpsReal::L1Norm()" + << " - w/control weight\n" + << "Expected value = " << compare << ", Computed value = " + << correct_l1_norm << std::endl; + } } // Test #17: math::HierarchyFaceDataOpsReal::L2Norm() // Expected: l2_norm = 4.0 double l2_norm = face_ops->L2Norm(fvindx[2], fwgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #17: math::HierarchyFaceDataOpsReal::L2Norm()\n" - << "Expected value = 4.0, Computed value = " - << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 4.89897948557; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #17: math::HierarchyFaceDataOpsReal::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << l2_norm << std::endl; + } } // Test #18: math::HierarchyFaceDataOpsReal::L1Norm() - w/o control weight // Expected: bogus_max_norm = 1000.0 double bogus_max_norm = face_ops->maxNorm(fvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyFaceDataOpsReal::L1Norm()" << " - w/o control weight\n" @@ -758,7 +1025,7 @@ int main( // Expected: max_norm = 4.0 double max_norm = face_ops->maxNorm(fvindx[2], fwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyFaceDataOpsReal::L1Norm()" << " - w/control weight\n" @@ -776,7 +1043,7 @@ int main( face_ops->linearSum(fvindx[3], 2.0, fvindx[1], 0.0, fvindx[0]); double val_linearSum = 5.0; if (!doubleDataSameAsValue(fvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyFaceDataOpsReal::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -788,7 +1055,7 @@ int main( face_ops->axmy(fvindx[3], 3.0, fvindx[1], fvindx[0]); double val_axmy = 6.5; if (!doubleDataSameAsValue(fvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::HierarchyFaceDataOpsReal::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -798,34 +1065,50 @@ int main( // Test #22a: math::HierarchyFaceDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 17.5 double cdot = face_ops->dot(fvindx[2], fvindx[1], fwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22a: math::HierarchyFaceDataOpsReal::dot() - (ind2) * (ind1)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22a: math::HierarchyFaceDataOpsReal::dot() - (ind2) * (ind1)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // Test #22b: math::HierarchyFaceDataOpsReal::dot() - (ind1) * (ind2) // Expected: cdot = 17.5 cdot = face_ops->dot(fvindx[1], fvindx[2], fwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22b: math::HierarchyFaceDataOpsReal::dot() - (ind1) * (ind2)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22b: math::HierarchyFaceDataOpsReal::dot() - (ind1) * (ind2)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(fwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(fvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } fwgt.reset(); @@ -861,17 +1144,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > fvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(fvdata); - pdat::FaceIterator cend(fvdata->getBox(), 1, false); - for (pdat::FaceIterator c(fvdata->getBox(), 1, true); + pdat::FaceIterator cend(pdat::FaceGeometry::end(fvdata->getBox(), 1)); + for (pdat::FaceIterator c(pdat::FaceGeometry::begin(fvdata->getBox(), 1)); c != cend && test_passed; ++c) { pdat::FaceIndex face_index = *c; diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/indx_dataops.C b/base/SAMRAI/SAMRAI/source/test/dataops/indx_dataops.C index a2e7b7eb..6b64002a 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/indx_dataops.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/indx_dataops.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test index data operations * ************************************************************************/ @@ -18,11 +18,11 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/pdat/CellIterator.h" #include "SAMRAI/pdat/IndexData.h" #include "SAMRAI/pdat/IndexVariable.h" #include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/ProcessorMapping.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/Patch.h" @@ -33,7 +33,7 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -41,11 +41,24 @@ int main( int argc, char* argv[]) { + int num_failures = 0; + tbox::SAMRAI_MPI::init(&argc, &argv); tbox::SAMRAIManager::initialize(); tbox::SAMRAIManager::startup(); -// tbox::PIO::logOnlyNodeZero("indx_dataops.log"); - tbox::PIO::logAllNodes("indx_dataops.log"); + + if (argc < 2) { + TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); + } + + const unsigned short d = static_cast(atoi(argv[1])); + TBOX_ASSERT(d > 0); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); + const tbox::Dimension dim(d); + + const std::string log_fn = std::string("indx_dataops.") + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; + tbox::PIO::logAllNodes(log_fn); /* * Create block to force pointer deallocation. If this is not done @@ -61,21 +74,55 @@ int main( * ************************************************************************ */ - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7)); - hier::IntVector ratio(2); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); hier::BoxContainer coarse_domain; hier::BoxContainer fine_domain; - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_domain.appendItem(fine0); - fine_domain.appendItem(fine1); + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_domain.pushBack(fine0); + fine_domain.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -87,36 +134,47 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. - tbox::SAMRAI_MPI mpi(SAMRAIManager::getSAMRAICommWorld()); + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_domain.getNumberOfBoxes(); - hier::ProcessorMapping mapping0(n_coarse_boxes); - hier::ProcessorMapping mapping1(n_fine_boxes); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_domain.size(); + + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - int ib; - for (ib = 0; ib < n_coarse_boxes; ib++) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - mapping0.setProcessorAssignment(ib, ib); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); + } } else { - mapping0.setProcessorAssignment(ib, 0); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - for (ib = 0; ib < n_fine_boxes; ib++) { + hier::BoxContainer::iterator fine_itr = fine_domain.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib) { if (nproc > 1) { - mapping1.setProcessorAssignment(ib, ib); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); + } } else { - mapping1.setProcessorAssignment(ib, 0); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } - hierarchy->makeNewPatchLevel(0, hier::IntVector( - 1), coarse_domain, mapping0); - hierarchy->makeNewPatchLevel(1, ratio, fine_domain, mapping1); + hierarchy->makeNewPatchLevel(0, layer0); + hierarchy->makeNewPatchLevel(1, layer1); /* * Create an IndexData variable and register it with @@ -125,12 +183,12 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr cxt( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(0); + const hier::IntVector no_ghosts(dim, 0); - boost::shared_ptr > data( - new pdat::IndexVariable( - "sample")); + new pdat::IndexVariable( + dim, "sample")); int data_id = variable_db->registerVariableAndContext( data, cxt, no_ghosts); @@ -147,7 +205,7 @@ int main( */ int counter = 0; std::ostream& os = tbox::plog; - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); @@ -158,34 +216,44 @@ int main( // loop over patches on level for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - boost::shared_ptr patch(level->getPatch(ip())); + boost::shared_ptr patch(*ip); os << "Patch: " << patch->getLocalId() << std::endl; // access sample data from patch - boost::shared_ptr > sample( - patch->getPatchData(data_id)); + boost::shared_ptr > sample( + BOOST_CAST, + hier::PatchData>( + patch->getPatchData(data_id))); + TBOX_ASSERT(sample); // iterate over cells of patch and invoke one "SampleIndexData" // instance on each cell (its possible to do more). - pdat::CellIterator icend(patch->getBox(), false); - for (pdat::CellIterator ic(patch->getBox(), true); + pdat::CellIterator icend(pdat::CellGeometry::end(patch->getBox())); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(patch->getBox())); ic != icend; ++ic) { - SampleIndexData sd(*ic); + SampleIndexData sd; sd.setInt(counter); sample->appendItem(*ic, sd); - counter++; + ++counter; } // iterate over the "SampleIndexData" index data stored on the patch // and dump the integer stored on it. - for (pdat::IndexData::Iterator id(*sample); - id; - id++) { - os << " Index: " << id().getIndex() - << " SampleIndexData data: " << id().getInt() + int currData = counter - 1; + pdat::IndexData::iterator idend(*sample, false); + for (pdat::IndexData::iterator id(*sample, true); + id != idend; + ++id) { + os << " SampleIndexData data: " << id->getInt() << std::endl; + if (id->getInt() != currData) { + ++num_failures; + tbox::perr + << "FAILED: - Index data set incorrectly" << std::endl; + } + --currData; } } @@ -193,11 +261,15 @@ int main( geometry.reset(); hierarchy.reset(); + + if (num_failures == 0) { + tbox::pout << "\nPASSED: indx dataops" << std::endl; + } } tbox::SAMRAIManager::shutdown(); tbox::SAMRAIManager::finalize(); tbox::SAMRAI_MPI::finalize(); - return 0; + return num_failures; } diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/node_cplxtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/node_cplxtest.C index 9cf07991..c730ee46 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/node_cplxtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/node_cplxtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test node-centered complex patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -77,17 +77,13 @@ int main( TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } - const int d = atoi(argv[1]); + const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= SAMRAI_MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != 2) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("node_cplxtest.") - + tbox::Utilities::intToString(dim, 1) + "d.log"; + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); /* @@ -95,26 +91,58 @@ int main( * then there will be memory leaks reported. */ { - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7)); - hier::IntVector ratio(dim2d, 2); - - hier::BoxContainer coarse_domain(dim2d); - hier::BoxContainer fine_boxes(dim2d); - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_boxes.appendItem(fine0); - fine_boxes.appendItem(fine1); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } + + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); + + hier::BoxContainer coarse_domain; + hier::BoxContainer fine_boxes; + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_boxes.pushBack(fine0); + fine_boxes.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -126,38 +154,42 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_boxes.getNumberOfBoxes(); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getRank()) { - layer0.addBox(hier::Box(*coarse_itr, ib, - layer0.getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, ib, 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getRank()) { - layer1.addBox(hier::Box(*fine_itr, ib, - layer1.getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, ib, 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -168,7 +200,7 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > nvar[NVARS]; @@ -192,9 +224,9 @@ int main( nwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(nvindx[iv]); } } @@ -213,131 +245,485 @@ int main( 1)); boost::shared_ptr patch; - boost::shared_ptr pgeom; // Initialize control volume data for node-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - boost::shared_ptr > data; - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); + patch = *ip; + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double node_vol = dx[0] * dx[1]; - data = patch->getPatchData(nwgt_id); + double node_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + node_vol *= dx[i]; + } + boost::shared_ptr > data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(nwgt_id))); + TBOX_ASSERT(data); data->fillAll(node_vol); pdat::NodeIndex ni(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom face boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 0.5; - } - //left and right face boundaries - for (ic = plo1; ic <= phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom face boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 0.5; + } + // left and right face boundaries + for (ic = plo1; ic <= phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) *= 0.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) *= 0.25; + } else { + // top and bottom face boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) = 0.0; + } + // left and right face boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1), + pdat::NodeIndex::UpperLeft)) *= 0.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1), + pdat::NodeIndex::UpperRight)) *= 0.25; } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 0.25; } else { - //top and bottom face boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) = 0.0; - } - //left and right face boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic <= phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // left coarse-fine face boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 1.5; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) *= 2.25; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1), + pdat::NodeIndex::UpperLeft)) *= 2.25; + } else { + // top and bottom coarse-fine face boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // right coarse-fine face boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) *= 2.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1), + pdat::NodeIndex::UpperRight)) *= 2.25; + // shared left boundaries + for (ic = plo1; ic <= phi1 + 1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::LowerLeft); + (*data)(ni) = 0; + } } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 0.25; } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic <= phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // bottom face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.5; + } + } + // left and right face boundaries + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.25; + } + // lower left and right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.25; + } + // left and right front and back edge boundaries + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) *= 0.125; + } else { + // front and back face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // top face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // left and right face boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) = 0.0; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + // upper and lower left and right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, phi1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) = 0.0; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + // front and back left and right edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, plo2), + pdat::NodeIndex::LUL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, plo2), + pdat::NodeIndex::UUL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, phi2), + pdat::NodeIndex::LUU)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, phi2), + pdat::NodeIndex::UUU)) *= 0.125; + // bottom face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + } } - //left coarse-fine face boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 2.25; } else { - // top and bottom coarse-fine face boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - //right coarse-fine face boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 2.25; - //shared left boundaries - for (ic = plo1; ic <= phi1 + 1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::LowerLeft); - (*data)(ni) = 0; + if (patch->getLocalId() == 0) { + // front and back coarse-fine face boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // top and bottom coarse-fine face boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // left coarse-fine face boundary + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 1.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // upper and lower left edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, phi1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) *= 2.25; + } + // front and back left edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 2.25; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, plo2), + pdat::NodeIndex::LUL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, phi2), + pdat::NodeIndex::LUU)) *= 3.375; + } else { + // front and back coarse-fine face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // top and bottom coarse-fine face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // right coarse-fine face boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 1.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // upper and lower right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(phi0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // front and back right edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, plo2), + pdat::NodeIndex::UUL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, phi2), + pdat::NodeIndex::UUU)) *= 3.375; + // shared left boundaries + for (ic1 = plo1; ic1 <= phi1 + 1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2 + 1; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LLL); + (*data)(ni) = 0; + } + } } } } @@ -350,13 +736,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::NodeData > cvdata = patch->getPatchData(cwgt_id); * - * pdat::NodeIterator cend(cvdata->getBox(), false); - * for (pdat::NodeIterator c(cvdata->getBox(), true); c != cend && vol_test_passed; ++c) { + * pdat::NodeIterator cend(pdat::NodeGeometry::end(cvdata->getBox())); + * for (pdat::NodeIterator c(pdat::NodeGeometry::begin(cvdata->getBox())); c != cend && vol_test_passed; ++c) { * pdat::NodeIndex cell_index = *c; * * if (ln == 0) { @@ -380,7 +766,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -394,7 +780,7 @@ int main( double norm = node_ops->sumControlVolumes(nvindx[0], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1: math::HierarchyNodeDataOpsComplex::sumControlVolumes()\n" << "Expected value = 0.5 , Computed value = " @@ -403,13 +789,21 @@ int main( // Test #2: math::HierarchyNodeDataOpsComplex::numberOfEntries() // Expected: num_data_points = 121 - int num_data_points = node_ops->numberOfEntries(nvindx[0]); - if (num_data_points != 121) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyNodeDataOpsComplex::numberOfEntries()\n" - << "Expected value = 121 , Computed value = " - << num_data_points << std::endl; + size_t num_data_points = node_ops->numberOfEntries(nvindx[0]); + { + size_t compare; + if (dim.getValue() == 2) { + compare = 121; + } else { + compare = 1001; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyNodeDataOpsComplex::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyNodeDataOpsComplex::setToScalar() @@ -417,7 +811,7 @@ int main( dcomplex val0 = dcomplex(2.0, 1.5); node_ops->setToScalar(nvindx[0], val0); if (!complexDataSameAsValue(nvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyNodeDataOpsComplex::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -429,7 +823,7 @@ int main( dcomplex val1(4.0, 3.0); node_ops->setToScalar(nvindx[1], dcomplex(4.0, 3.0)); if (!complexDataSameAsValue(nvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyNodeDataOpsComplex::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -440,7 +834,7 @@ int main( // Expected: v2 = v1 = (4.0, 3.0) node_ops->copyData(nvindx[2], nvindx[1]); if (!complexDataSameAsValue(nvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyNodeDataOpsComplex::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -451,14 +845,14 @@ int main( // Expected: v0 = (4.0, 3.0), v1 = (2.0,1.5) node_ops->swapData(nvindx[0], nvindx[1]); if (!complexDataSameAsValue(nvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyNodeDataOpsComplex::swapData()\n" << "Expected: v0 = " << val1 << std::endl; node_ops->printData(nvindx[0], tbox::plog); } if (!complexDataSameAsValue(nvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyNodeDataOpsComplex::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -470,7 +864,7 @@ int main( node_ops->scale(nvindx[2], 0.25, nvindx[2]); dcomplex val_scale(1.0, 0.75); if (!complexDataSameAsValue(nvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyNodeDataOpsComplex::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -482,7 +876,7 @@ int main( node_ops->add(nvindx[3], nvindx[0], nvindx[1]); dcomplex val_add(6.0, 4.5); if (!complexDataSameAsValue(nvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyNodeDataOpsComplex::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -497,7 +891,7 @@ int main( node_ops->subtract(nvindx[1], nvindx[3], nvindx[0]); dcomplex val_sub(6.0, 0.0); if (!complexDataSameAsValue(nvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyNodeDataOpsComplex::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -509,7 +903,7 @@ int main( node_ops->addScalar(nvindx[1], nvindx[1], dcomplex(0.0, -4.0)); dcomplex val_addScalar(6.0, -4.0); if (!complexDataSameAsValue(nvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyNodeDataOpsComplex::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -521,7 +915,7 @@ int main( node_ops->addScalar(nvindx[2], nvindx[2], dcomplex(0.0, 0.25)); val_addScalar = dcomplex(1.0, 1.0); if (!complexDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyNodeDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -533,7 +927,7 @@ int main( node_ops->addScalar(nvindx[2], nvindx[2], dcomplex(3.0, -4.0)); val_addScalar = dcomplex(4.0, -3.0); if (!complexDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyNodeDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -548,7 +942,7 @@ int main( node_ops->multiply(nvindx[1], nvindx[3], nvindx[1]); dcomplex val_mult(3.0, -2.0); if (!complexDataSameAsValue(nvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyNodeDataOpsComplex::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -560,7 +954,7 @@ int main( node_ops->divide(nvindx[0], nvindx[2], nvindx[1]); dcomplex val_div(1.3846153846154, -0.076923076923077); if (!complexDataSameAsValue(nvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyNodeDataOpsComplex::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -572,7 +966,7 @@ int main( node_ops->reciprocal(nvindx[1], nvindx[1]); dcomplex val_rec(0.23076923076923, 0.15384615384615); if (!complexDataSameAsValue(nvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyNodeDataOpsComplex::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -586,18 +980,31 @@ int main( hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - ndata = patch->getPatchData(nvindx[2]); - hier::Index index0(2, 2); - hier::Index index1(5, 3); - if (patch->getBox().contains(index0)) { - (*ndata)(pdat::NodeIndex(index0, - pdat::NodeIndex::LowerLeft), 0) = dcomplex(100.0, -50.0); - } - if (patch->getBox().contains(index1)) { - (*ndata)(pdat::NodeIndex(index1, - pdat::NodeIndex::UpperRight), 0) = dcomplex(-1000.0, - 20.0); + patch = *ip; + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; + if (dim.getValue() == 2) { + if (patch->getBox().contains(index0)) { + (*ndata)(pdat::NodeIndex(index0, pdat::NodeIndex::LowerLeft), 0) = + dcomplex(100.0, -50.0); + } + if (patch->getBox().contains(index1)) { + (*ndata)(pdat::NodeIndex(index1, pdat::NodeIndex::UpperRight), 0) = + dcomplex(-1000.0, 20.0); + } + } else { + if (patch->getBox().contains(index0)) { + (*ndata)(pdat::NodeIndex(index0, pdat::NodeIndex::LLL), 0) = + dcomplex(100.0, -50.0); + } + if (patch->getBox().contains(index1)) { + (*ndata)(pdat::NodeIndex(index1, pdat::NodeIndex::UUU), 0) = + dcomplex(-1000.0, 20.0); + } } } @@ -605,15 +1012,28 @@ int main( bool bogus_value_test_passed = true; for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - ndata = patch->getPatchData(nvindx[2]); - pdat::NodeIndex index0(hier::Index(2, 2), pdat::NodeIndex::LowerLeft); - pdat::NodeIndex index1(hier::Index(5, 3), pdat::NodeIndex::UpperRight); - - pdat::NodeIterator cend(ndata->getBox(), false); - for (pdat::NodeIterator c(ndata->getBox(), true); - c != cend && bogus_value_test_passed; - ++c) { + patch = *ipp; + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::NodeIndex::Corner corner0; + pdat::NodeIndex::Corner corner1; + if (dim.getValue() == 2) { + corner0 = pdat::NodeIndex::LowerLeft; + corner1 = pdat::NodeIndex::UpperRight; + } else { + corner0 = pdat::NodeIndex::LLL; + corner1 = pdat::NodeIndex::UUU; + } + pdat::NodeIndex index0(idx0, corner0); + pdat::NodeIndex index1(idx1, corner1); + + pdat::NodeIterator cend(pdat::NodeGeometry::end(ndata->getBox())); + for (pdat::NodeIterator c(pdat::NodeGeometry::begin(ndata->getBox())); + c != cend && bogus_value_test_passed; ++c) { pdat::NodeIndex node_index = *c; if (node_index == index0) { @@ -623,14 +1043,12 @@ int main( } } else { if (node_index == index1) { - if (!tbox::MathUtilities::equalEps((*ndata)( - node_index), + if (!tbox::MathUtilities::equalEps((*ndata)(node_index), dcomplex(-1000.0, 20.0))) { bogus_value_test_passed = false; } } else { - if (!tbox::MathUtilities::equalEps((*ndata)( - node_index), + if (!tbox::MathUtilities::equalEps((*ndata)(node_index), dcomplex(4.0, -3.0))) { bogus_value_test_passed = false; } @@ -639,7 +1057,7 @@ int main( } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: Place some bogus values on coarse level" << std::endl; @@ -651,19 +1069,27 @@ int main( // Test #14: math::HierarchyNodeDataOpsComplex::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 1787.0034 double bogus_l1_norm = node_ops->L1Norm(nvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1787.0034)) { - num_failures++; - tbox::perr - << "FAILED: - Test #14: math::HierarchyCellDataOpsComplex::L1Norm()" - << "Expected value = 1787.0034, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1787.0034; + } else { + compare = 6837.00337888; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #14: math::HierarchyCellDataOpsComplex::L1Norm()" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #15: math::HierarchyNodeDataOpsComplex::L1Norm() - w/ control weight // Expected: l1_norm = 2.5 double correct_l1_norm = node_ops->L1Norm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #15: math::HierarchyNodeDataOpsComplex::L1Norm()" << " - w/ control weight\n" @@ -675,7 +1101,7 @@ int main( // Expected: l2_norm = 3.53553390593 double l2_norm = node_ops->L2Norm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(l2_norm, 3.53553390593)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #16: math::HierarchyNodeDataOpsComplex::L2Norm()\n" << "Expected value = 3.53553390593, Computed value = " @@ -686,7 +1112,7 @@ int main( // Expected: bogus_max_norm = 1000.19998 double bogus_max_norm = node_ops->maxNorm(nvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.19998)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: Bogus maxNorm of v2\n" << "Expected value = 1000.19998, Computed value = " << bogus_max_norm << std::endl; @@ -696,7 +1122,7 @@ int main( // Expected: max_norm = 5.0 double max_norm = node_ops->maxNorm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 5.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: maxNorm of v2\n" << "Expected value = 5.0, Computed value = " << max_norm << std::endl; @@ -713,7 +1139,7 @@ int main( dcomplex(2.0, 0.0), nvindx[1], dcomplex(0.0, -1.0), nvindx[0]); dcomplex val_linearSum(2.0, 5.0); if (!complexDataSameAsValue(nvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyNodeDataOpsComplex::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -725,7 +1151,7 @@ int main( node_ops->axmy(nvindx[3], 3.0, nvindx[1], nvindx[0]); dcomplex val_axmy(6.5, 12.0); if (!complexDataSameAsValue(nvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyNodeDataOpsComplex::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -737,7 +1163,7 @@ int main( dcomplex cdot = node_ops->dot(nvindx[2], nvindx[1], nwgt_id); dcomplex ans_2_dot_1(8.75, -10.5); if (!tbox::MathUtilities::equalEps(cdot, ans_2_dot_1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21a: math::HierarchyNodeDataOpsComplex::dot()\n" << "Expected value = (8.75,-10.5), Computed value = " @@ -749,7 +1175,7 @@ int main( dcomplex cdot2 = node_ops->dot(nvindx[1], nvindx[2], nwgt_id); dcomplex ans_1_dot_2(8.75, 10.5); if (!tbox::MathUtilities::equalEps(cdot2, ans_1_dot_2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21b: math::HierarchyNodeDataOpsComplex::dot()\n" << "Expected value = (8.75,10.5), Computed value = " @@ -761,7 +1187,7 @@ int main( node_ops->setToScalar(nvindx[0], dcomplex(4.0, -3.0)); node_ops->abs(nwgt_id, nvindx[0]); if (!doubleDataSameAsValue(nwgt_id, 5.0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::HierarchyNodeDataOpsComplex::abs()\n" << "Expected: abs(v0) = 5.0" << std::endl; @@ -769,14 +1195,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(nvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { nvar[iv].reset(); } nwgt.reset(); @@ -812,17 +1238,20 @@ complexDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > nvdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); - pdat::NodeIterator cend(nvdata->getBox(), false); - for (pdat::NodeIterator c(nvdata->getBox(), true); + TBOX_ASSERT(nvdata); + + pdat::NodeIterator cend(pdat::NodeGeometry::end(nvdata->getBox())); + for (pdat::NodeIterator c(pdat::NodeGeometry::begin(nvdata->getBox())); c != cend && test_passed; ++c) { pdat::NodeIndex node_index = *c; if (!tbox::MathUtilities::equalEps((*nvdata)(node_index), @@ -850,16 +1279,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > nvdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(nvdata); - pdat::NodeIterator cend(nvdata->getBox(), false); - for (pdat::NodeIterator c(nvdata->getBox(), true); + pdat::NodeIterator cend(pdat::NodeGeometry::end(nvdata->getBox())); + for (pdat::NodeIterator c(pdat::NodeGeometry::begin(nvdata->getBox())); c != cend && test_passed; ++c) { pdat::NodeIndex node_index = *c; if (!tbox::MathUtilities::equalEps((*nvdata)(node_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/node_hierops.C b/base/SAMRAI/SAMRAI/source/test/dataops/node_hierops.C deleted file mode 100644 index 0636458a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dataops/node_hierops.C +++ /dev/null @@ -1,738 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Main program to test node-centered patch data ops - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" - -#include -#include -#include -#include -using namespace std; - -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" - -#include "SAMRAI/tbox/SAMRAIManager.h" - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/BoxArray.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/math/HierarchyDataOpsComplex.h" -#include "SAMRAI/math/HierarchyNodeDataOpsComplex.h" -#include "SAMRAI/math/HierarchyDataOpsReal.h" -#include "SAMRAI/math/HierarchyNodeDataOpsReal.h" -#include "SAMRAI/pdat/NodeIndex.h" -#include "SAMRAI/pdat/NodeIterator.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchDescriptor.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/ProcessorMapping.h" -#include "SAMRAI/tbox/Complex.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/hier/VariableContext.h" - -#include - -using namespace SAMRAI; - -/* Helper function declarations */ -bool -doubleDataSameAsValue( - int desc_id, - double value, - boost::shared_ptr hierarchy); - -#define NVARS 4 - -int main( - int argc, - char* argv[]) { - - tbox::SAMRAI_MPI::init(&argc, &argv); - tbox::SAMRAIManager::initialize(); - tbox::SAMRAIManager::startup(); -// tbox::PIO::logOnlyNodeZero("node_hierops.log"); - tbox::PIO::logAllNodes("node_hierops.log"); - - /* - * Create block to force pointer deallocation. If this is not done - * then there will be memory leaks reported. - */ - { - - int ln, iv; - - /* - * Make a simple 2-level hierarchy. - */ - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box<2> coarse0(hier::Index<2>(0, 0), hier::Index<2>(9, 2)); - hier::Box<2> coarse1(hier::Index<2>(0, 3), hier::Index<2>(9, 4)); - hier::Box<2> fine0(hier::Index<2>(4, 4), hier::Index<2>(7, 7)); - hier::Box<2> fine1(hier::Index<2>(8, 4), hier::Index<2>(13, 7)); - hier::IntVector<2> ratio(2); - - hier::BoxArray<2> coarse_domain(2); - hier::BoxArray<2> fine_domain(2); - coarse_domain(0) = coarse0; - coarse_domain(1) = coarse1; - fine_domain(0) = fine0; - fine_domain(1) = fine1; - - boost::shared_ptr geometry( - new geom::CartesianGridGeometry( - "CartesianGeometry", - lo, - hi, - coarse_domain)); - - boost::shared_ptr hierarchy( - new hier::PatchHierarchy("PatchHierarchy", geometry)); - - // Note: For these simple tests we allow at most 2 processors. - tbox::SAMRAI_MPI mpi(SAMRAIManager::getSAMRAICommWorld()); - const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_domain.getNumberOfBoxes(); - hier::ProcessorMapping mapping0(n_coarse_boxes); - hier::ProcessorMapping mapping1(n_fine_boxes); - - int ib; - for (ib = 0; ib < n_coarse_boxes; ib++) { - if (nproc > 1) { - mapping0.setProcessorAssignment(ib, ib); - } else { - mapping0.setProcessorAssignment(ib, 0); - } - } - - for (ib = 0; ib < n_fine_boxes; ib++) { - if (nproc > 1) { - mapping1.setProcessorAssignment(ib, ib); - } else { - mapping1.setProcessorAssignment(ib, 0); - } - } - - hierarchy->makeNewPatchLevel(0, hier::IntVector<2>( - 1), coarse_domain, mapping0); - hierarchy->makeNewPatchLevel(1, ratio, fine_domain, mapping1); - - /* - * Create some variables, a context, and register them with - * the variable database. - */ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - boost::shared_ptr dummy( - variable_db->getContext("dummy")); - const hier::IntVector<2> no_ghosts(0); - - boost::shared_ptr > nvar[NVARS]; - int nvindx[NVARS]; - nvar[0].reset(new pdat::NodeVariable("nvar0", 1)); - nvindx[0] = variable_db->registerVariableAndContext( - nvar[0], dummy, no_ghosts); - nvar[1].reset(new pdat::NodeVariable("nvar1", 1)); - nvindx[1] = variable_db->registerVariableAndContext( - nvar[1], dummy, no_ghosts); - nvar[2].reset(new pdat::NodeVariable("nvar2", 1)); - nvindx[2] = variable_db->registerVariableAndContext( - nvar[2], dummy, no_ghosts); - nvar[3].reset(new pdat::NodeVariable("nvar3", 1)); - nvindx[3] = variable_db->registerVariableAndContext( - nvar[3], dummy, no_ghosts); - - boost::shared_ptr > nwgt( - new pdat::NodeVariable("nwgt", 1)); - int nwgt_id = variable_db->registerVariableAndContext( - nwgt, dummy, no_ghosts); - - // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { - hierarchy->getPatchLevel(ln)->allocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { - hierarchy->getPatchLevel(ln)->allocatePatchData(nvindx[iv]); - } - } - - /* - * Create instances of hierarchy operations to apply certain - * mathematical operators. e.g. scale(), axpy(), min(), etc. - */ - int coarsest = 0; - int finest = 1; - boost::shared_ptr > node_ops( - new math::HierarchyNodeDataOpsReal( - hierarchy, - coarsest, - finest)); - TBOX_ASSERT(node_ops); - - boost::shared_ptr > nwgt_ops( - new math::HierarchyNodeDataOpsReal( - hierarchy, - coarsest, - finest)); - - boost::shared_ptr patch; - boost::shared_ptr pgeom; - - // Initialize control volume data for node-centered components - hier::Box<2> coarse_fine = fine0 + fine1; - coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { - boost::shared_ptr level( - hierarchy->getPatchLevel(ln)); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - boost::shared_ptr > data; - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); - const double* dx = pgeom->getDx(); - const double node_vol = dx[0] * dx[1]; - data = patch->getPatchData(nwgt_id); - data->fillAll(node_vol); - pdat::NodeIndex ni; - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 0.5; - } - //left and right boundaries - for (ic = plo1; ic <= phi1; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index<2>(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; - } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index<2>(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index<2>(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 0.25; - } else { - //top and bottom boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index<2>(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) = 0.0; - } - //left and right boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index<2>(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; - } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index<2>(plo0, - plo1), pdat::NodeIndex::LowerLeft)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index<2>(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index<2>(phi0, - plo1), pdat::NodeIndex::LowerRight)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index<2>(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 0.25; - } - } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine boundaries - for (ic = plo0; ic <= phi0; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index<2>(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - //left coarse-fine boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index<2>(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index<2>(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 2.25; - } else { - // top and bottom coarse-fine boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index<2>(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - //right coarse-fine boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index<2>(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index<2>(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 2.25; - //shared left boundaries - for (ic = plo1; ic <= phi1 + 1; ic++) { - ni = pdat::NodeIndex(hier::Index<2>(plo0, - ic), pdat::NodeIndex::LowerLeft); - (*data)(ni) = 0; - } - } - } - } - } - - // Test #1b: HierarchyNodeDataOpsReal2::sumControlVolumes() - // Expected: norm = 0.5 - double norm = node_ops->sumControlVolumes(nvindx[0], nwgt_id); - if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - tbox::perr - << "FAILED: - Test #1b: HierarchyNodeDataOpsReal2::sumControlVolumes()\n" - << "Expected value = 0.5 , Computed value = " - << norm << endl; - } - - // Test #2: HierarchyNodeDataOpsReal2::numberOfEntries() - // Expected: num_data_points = 121 - int num_data_points = node_ops->numberOfEntries(nvindx[0]); - if (num_data_points != 121) { - tbox::perr - << "FAILED: - Test #2: HierarchyNodeDataOpsReal2::numberOfEntries()\n" - << "Expected value = 121 , Computed value = " - << num_data_points << endl; - } - - // Test #3a: HierarchyNodeDataOpsReal2::setToScalar() - // Expected: v0 = 2.0 - double val0 = double(2.0); - node_ops->setToScalar(nvindx[0], val0); - if (!doubleDataSameAsValue(nvindx[0], val0, hierarchy)) { - tbox::perr - << "FAILED: - Test #3a: HierarchyNodeDataOpsReal2::setToScalar()\n" - << "Expected: v0 = " << val0 << endl; - node_ops->printData(nvindx[0], tbox::plog); - } - - // Test #3b: HierarchyNodeDataOpsReal2::setToScalar() - // Expected: v1 = (4.0) - node_ops->setToScalar(nvindx[1], 4.0); - double val1 = 4.0; - if (!doubleDataSameAsValue(nvindx[1], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #3b: HierarchyNodeDataOpsReal2::setToScalar()\n" - << "Expected: v1 = " << val1 << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #4: HierarchyNodeDataOpsReal2::copyData() - // Expected: v2 = v1 = (4.0) - node_ops->copyData(nvindx[2], nvindx[1]); - if (!doubleDataSameAsValue(nvindx[2], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #4: HierarchyNodeDataOpsReal2::setToScalar()\n" - << "Expected: v2 = " << val1 << endl; - node_ops->printData(nvindx[2], tbox::plog); - } - - // Test #5: HierarchyNodeDataOpsReal2::swapData() - // Expected: v0 = (4.0), v1 = (2.0) - node_ops->swapData(nvindx[0], nvindx[1]); - if (!doubleDataSameAsValue(nvindx[0], val1, hierarchy)) { - tbox::perr - << "FAILED: - Test #5a: HierarchyNodeDataOpsReal2::setToScalar()\n" - << "Expected: v0 = " << val1 << endl; - node_ops->printData(nvindx[0], tbox::plog); - } - if (!doubleDataSameAsValue(nvindx[1], val0, hierarchy)) { - tbox::perr - << "FAILED: - Test #5b: HierarchyNodeDataOpsReal2::setToScalar()\n" - << "Expected: v1 = " << val0 << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #6: HierarchyNodeDataOpsReal2::scale() - // Expected: v2 = 0.25 * v2 = (1.0) - node_ops->scale(nvindx[2], 0.25, nvindx[2]); - double val_scale = 1.0; - if (!doubleDataSameAsValue(nvindx[2], val_scale, hierarchy)) { - tbox::perr - << "FAILED: - Test #6: HierarchyNodeDataOpsReal2::scale()\n" - << "Expected: v2 = " << val_scale << endl; - node_ops->printData(nvindx[2], tbox::plog); - } - - // Test #7: HierarchyNodeDataOpsReal2::add() - // Expected: v3 = v0 + v1 = (6.0) - node_ops->add(nvindx[3], nvindx[0], nvindx[1]); - double val_add = 6.0; - if (!doubleDataSameAsValue(nvindx[3], val_add, hierarchy)) { - tbox::perr << "FAILED: - Test #7: HierarchyNodeDataOpsReal2::add()\n" - << "Expected: v3 = " << val_add << endl; - node_ops->printData(nvindx[3], tbox::plog); - } - - // Reset v0: v0 = (0.0) - node_ops->setToScalar(nvindx[0], 0.0); - - // Test #8: HierarchyNodeDataOpsReal2::subtract() - // Expected: v1 = v3 - v0 = (6.0) - node_ops->subtract(nvindx[1], nvindx[3], nvindx[0]); - double val_sub = 6.0; - if (!doubleDataSameAsValue(nvindx[1], val_sub, hierarchy)) { - tbox::perr - << "FAILED: - Test #8: HierarchyNodeDataOpsReal2::subtract()\n" - << "Expected: v1 = " << val_sub << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #9a: HierarchyNodeDataOpsReal2::addScalar() - // Expected: v1 = v1 + (0.0) = (6.0) - node_ops->addScalar(nvindx[1], nvindx[1], 0.0); - double val_addScalar = 6.0; - if (!doubleDataSameAsValue(nvindx[1], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9a: HierarchyNodeDataOpsReal2::addScalar()\n" - << "Expected: v1 = " << val_addScalar << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #9b: HierarchyNodeDataOpsReal2::addScalar() - // Expected: v2 = v2 + (0.0) = (1.0) - node_ops->addScalar(nvindx[2], nvindx[2], 0.0); - val_addScalar = 1.0; - if (!doubleDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9b: HierarchyNodeDataOpsReal2::addScalar()\n" - << "Expected: v2 = " << val_addScalar << endl; - node_ops->printData(nvindx[2], tbox::plog); - } - - // Test #9c: HierarchyNodeDataOpsReal2::addScalar() - // Expected: v2 = v2 + (3.0) = (4.0) - node_ops->addScalar(nvindx[2], nvindx[2], 3.0); - val_addScalar = 4.0; - if (!doubleDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - tbox::perr - << "FAILED: - Test #9c: HierarchyNodeDataOpsReal2::addScalar()\n" - << "Expected: v2 = " << val_addScalar << endl; - node_ops->printData(nvindx[2], tbox::plog); - } - - // Reset v3: v3 = (0.5) - node_ops->setToScalar(nvindx[3], 0.5); - - // Test #10: HierarchyNodeDataOpsReal2::multiply() - // Expected: v1 = v3 * v1 = (3.0) - node_ops->multiply(nvindx[1], nvindx[3], nvindx[1]); - double val_mult = 3.0; - if (!doubleDataSameAsValue(nvindx[1], val_mult, hierarchy)) { - tbox::perr - << "FAILED: - Test #10: HierarchyNodeDataOpsReal2::multiply()\n" - << "Expected: v1 = " << val_mult << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #11: HierarchyNodeDataOpsReal2::divide() - // Expected: v0 = v2 / v1 = 1.3333333333333 - node_ops->divide(nvindx[0], nvindx[2], nvindx[1]); - double val_div = 1.333333333333333; - if (!doubleDataSameAsValue(nvindx[0], val_div, hierarchy)) { - tbox::perr - << "FAILED: - Test #11: HierarchyNodeDataOpsReal2::divide()\n" - << "Expected: v0 = " << val_div << endl; - node_ops->printData(nvindx[0], tbox::plog); - } - - // Test #12: HierarchyNodeDataOpsReal2::reciprocal() - // Expected: v1 = 1 / v1 = (0.333333333) - node_ops->reciprocal(nvindx[1], nvindx[1]); - double val_rec = 0.33333333333333; - if (!doubleDataSameAsValue(nvindx[1], val_rec, hierarchy)) { - tbox::perr - << "FAILED: - Test #12: HierarchyNodeDataOpsReal2::reciprocal()\n" - << "Expected: v1 = " << val_rec << endl; - node_ops->printData(nvindx[1], tbox::plog); - } - - // Test #13: HierarchyNodeDataOpsReal2::abs() - // Expected: v3 = abs(v2) = 4.0 - node_ops->abs(nvindx[3], nvindx[2]); - double val_abs = 4.0; - if (!doubleDataSameAsValue(nvindx[3], val_abs, hierarchy)) { - tbox::perr << "FAILED: - Test #13: HierarchyNodeDataOpsReal2::abs()\n" - << "Expected: v3 = " << val_abs << endl; - node_ops->printData(nvindx[3], tbox::plog); - } - - // Test #14: Place some bogus values on coarse level - boost::shared_ptr > ndata; - - // set values - boost::shared_ptr level_zero( - hierarchy->getPatchLevel(0)); - for (hier::PatchLevel::iterator ip(level_zero->begin()); - ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - ndata = patch->getPatchData(nvindx[2]); - hier::Index<2> index0(2, 2); - hier::Index<2> index1(5, 3); - if (patch->getBox().contains(index0)) { - (*ndata)(pdat::NodeIndex(index0, - pdat::NodeIndex::LowerLeft), 0) = 100.0; - } - if (patch->getBox().contains(index1)) { - (*ndata)(pdat::NodeIndex(index1, - pdat::NodeIndex::UpperRight), 0) = -1000.0; - } - } - - // check values - bool bogus_value_test_passed = true; - for (hier::PatchLevel::iterator ipp(level_zero->begin()); - ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - ndata = patch->getPatchData(nvindx[2]); - pdat::NodeIndex index0(hier::Index<2>(2, - 2), pdat::NodeIndex::LowerLeft); - pdat::NodeIndex index1(hier::Index<2>(5, - 3), pdat::NodeIndex::UpperRight); - - pdat::NodeIterator cend(ndata->getBox(), false); - for (pdat::NodeIterator c(ndata->getBox(), true); - c != cend && bogus_value_test_passed; - ++c) { - pdat::NodeIndex node_index = *c; - - if (node_index == index0) { - if (!tbox::MathUtilities::equalEps((*ndata)(node_index), - 100.0)) { - bogus_value_test_passed = false; - } - } else { - if (node_index == index1) { - if (!tbox::MathUtilities::equalEps((*ndata)( - node_index), -1000.0)) { - bogus_value_test_passed = false; - } - } else { - if (!tbox::MathUtilities::equalEps((*ndata)( - node_index), 4.0)) { - bogus_value_test_passed = false; - } - } - } - } - } - if (!bogus_value_test_passed) { - tbox::perr - << "FAILED: - Test #14: Place some bogus values on coarse level" - << endl; - node_ops->printData(nvindx[2], tbox::plog); - } - - // Test #15: HierarchyNodeDataOpsReal2::L1Norm() - w/o control weight - // Expected: bogus_l1_norm = 1640.00 - double bogus_l1_norm = node_ops->L1Norm(nvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1640.00)) { - tbox::perr - << "FAILED: - Test #15: HierarchyNodeDataOpsReal2::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 1640.00, Computed value = " - << setprecision(12) << bogus_l1_norm << endl; - } - - // Test #16: HierarchyNodeDataOpsReal2::L1Norm() - w/control weight - // Expected: correct_l1_norm = 2.0 - double correct_l1_norm = node_ops->L1Norm(nvindx[2], nwgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.0)) { - tbox::perr - << "FAILED: - Test #16: HierarchyNodeDataOpsReal2::L1Norm()" - << " - w/control weight\n" - << "Expected value = 2.0, Computed value = " - << correct_l1_norm << endl; - } - - // Test #17: HierarchyNodeDataOpsReal2::L2Norm() - // Expected: l2_norm = 2.8284271 - double l2_norm = node_ops->L2Norm(nvindx[2], nwgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 2.82842712475)) { - tbox::perr - << "FAILED: - Test #17: HierarchyNodeDataOpsReal2::L2Norm()\n" - << "Expected value = 2.82842712475, Computed value = " - << l2_norm << endl; - } - - // Test #18: HierarchyNodeDataOpsReal2::maxNorm() - w/o control weight - // Expected: bogus_max_norm = 1000.0 - double bogus_max_norm = node_ops->maxNorm(nvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - tbox::perr - << "FAILED: - Test #18: HierarchyNodeDataOpsReal2::maxNorm()" - << " - w/o control weight\n" - << "Expected value = 1000.0, Computed value = " - << bogus_max_norm << endl; - } - - // Test #19: HierarchyNodeDataOpsReal2::maxNorm() - w/control weight - // Expected: max_norm = 4.0 - double max_norm = node_ops->maxNorm(nvindx[2], nwgt_id); - if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - tbox::perr - << "FAILED: - Test #19: HierarchyNodeDataOpsReal2::maxNorm()" - << " - w/control weight\n" - << "Expected value = 4.0, Computed value = " - << max_norm << endl; - } - - // Reset data and test sums, axpy's - node_ops->setToScalar(nvindx[0], 1.0); - node_ops->setToScalar(nvindx[1], 2.5); - node_ops->setToScalar(nvindx[2], 7.0); - - // Test #20: HierarchyNodeDataOpsReal2::linearSum() - // Expected: v3 = 5.0 - double val_linearSum = 5.0; - node_ops->linearSum(nvindx[3], 2.0, nvindx[1], 0.00, nvindx[0]); - if (!doubleDataSameAsValue(nvindx[3], val_linearSum, hierarchy)) { - tbox::perr - << "FAILED: - Test #20: HierarchyNodeDataOpsReal2::linearSum()\n" - << "Expected: v3 = " << val_linearSum << endl; - node_ops->printData(nvindx[3], tbox::plog); - } - - // Test #21: HierarchyNodeDataOpsReal2::axmy() - // Expected: v3 = 6.5 - node_ops->axmy(nvindx[3], 3.0, nvindx[1], nvindx[0]); - double val_axmy = 6.5; - if (!doubleDataSameAsValue(nvindx[3], val_axmy, hierarchy)) { - tbox::perr - << "FAILED: - Test #21: HierarchyNodeDataOpsReal2::axmy()\n" - << "Expected: v3 = " << val_axmy << endl; - node_ops->printData(nvindx[3], tbox::plog); - } - - // Test #22a: HierarchyNodeDataOpsReal2::dot() - (ind2) * (ind1) - // Expected: cdot = 8.75 - double cdot = node_ops->dot(nvindx[2], nvindx[1], nwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - tbox::perr - << "FAILED: - Test #22a: HierarchyNodeDataOpsReal2::dot() - (ind2) * (ind1)\n" - << "Expected Value = 8.75, Computed Value = " - << cdot << endl; - } - - // Test #22a: HierarchyNodeDataOpsReal2::dot() - (ind1) * (ind2) - // Expected: cdot = 8.75 - cdot = node_ops->dot(nvindx[1], nvindx[2], nwgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - tbox::perr - << "FAILED: - Test #22a: HierarchyNodeDataOpsReal2::dot() - (ind1) * (ind2)\n" - << "Expected Value = 8.75, Computed Value = " - << cdot << endl; - } - - // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { - hierarchy->getPatchLevel(ln)->deallocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { - hierarchy->getPatchLevel(ln)->deallocatePatchData(nvindx[iv]); - } - } - - for (iv = 0; iv < NVARS; iv++) { - nvar[iv].reset(); - } - nwgt.reset(); - - geometry.reset(); - hierarchy.reset(); - node_ops.reset(); - nwgt_ops.reset(); - } - - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - - return 0; -} - -/* - * Returns true if all the data in the hierarchy is equal to the specified - * value. Returns false otherwise. - */ -bool -doubleDataSameAsValue( - int desc_id, - double value, - boost::shared_ptr hierarchy) -{ - bool test_passed = true; - - int ln; - boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { - boost::shared_ptr level(hierarchy->getPatchLevel(ln)); - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - patch = level->getPatch(ip()); - boost::shared_ptr > nvdata( - patch->getPatchData(desc_id)); - - pdat::NodeIterator cend(nvdata->getBox(), false); - for (pdat::NodeIterator c(nvdata->getBox(), true); - c != cend && test_passed; ++c) { - pdat::NodeIndex node_index = *c; - if (!tbox::MathUtilities::equalEps((*nvdata)(node_index), - value)) { - test_passed = false; - } - } - } - } - - return test_passed; -} diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/node_hiertest.C b/base/SAMRAI/SAMRAI/source/test/dataops/node_hiertest.C index 37d3db93..ce0a054a 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/node_hiertest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/node_hiertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test node-centered patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -68,21 +68,15 @@ int main( tbox::SAMRAIManager::initialize(); tbox::SAMRAIManager::startup(); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (argc < 2) { TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != tbox::Dimension(2)) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("node_hiertest.") + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); @@ -93,40 +87,51 @@ int main( */ { - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - int coarse0_array[2][2] = { { 0, 0 }, { 9, 2 } }; - hier::Box coarse0((hier::Index(dim2d, coarse0_array[0])), - (hier::Index(dim2d, coarse0_array[1])), - hier::BlockId(0)); - - int coarse1_array[2][2] = { { 0, 3 }, { 9, 4 } }; - hier::Box coarse1((hier::Index(dim2d, coarse1_array[0])), - (hier::Index(dim2d, coarse1_array[1])), - hier::BlockId(0)); - - int fine0_array[2][2] = { { 4, 4 }, { 7, 7 } }; - hier::Box fine0((hier::Index(dim2d, fine0_array[0])), - (hier::Index(dim2d, fine0_array[1])), - hier::BlockId(0)); - - int fine1_array[2][2] = { { 8, 4 }, { 13, 7 } }; - hier::Box fine1((hier::Index(dim2d, fine1_array[0])), - (hier::Index(dim2d, fine1_array[1])), - hier::BlockId(0)); - - hier::IntVector ratio(dim2d, 2); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; @@ -148,37 +153,39 @@ int main( hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); - // Note: For these simple tests we allow at most 2 processors. + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -189,35 +196,35 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > nvar[NVARS]; int nvindx[NVARS]; - nvar[0].reset(new pdat::NodeVariable(dim2d, "nvar0", 1)); + nvar[0].reset(new pdat::NodeVariable(dim, "nvar0", 1)); nvindx[0] = variable_db->registerVariableAndContext( nvar[0], dummy, no_ghosts); - nvar[1].reset(new pdat::NodeVariable(dim2d, "nvar1", 1)); + nvar[1].reset(new pdat::NodeVariable(dim, "nvar1", 1)); nvindx[1] = variable_db->registerVariableAndContext( nvar[1], dummy, no_ghosts); - nvar[2].reset(new pdat::NodeVariable(dim2d, "nvar2", 1)); + nvar[2].reset(new pdat::NodeVariable(dim, "nvar2", 1)); nvindx[2] = variable_db->registerVariableAndContext( nvar[2], dummy, no_ghosts); - nvar[3].reset(new pdat::NodeVariable(dim2d, "nvar3", 1)); + nvar[3].reset(new pdat::NodeVariable(dim, "nvar3", 1)); nvindx[3] = variable_db->registerVariableAndContext( nvar[3], dummy, no_ghosts); boost::shared_ptr > nwgt( - new pdat::NodeVariable(dim2d, "nwgt", 1)); + new pdat::NodeVariable(dim, "nwgt", 1)); int nwgt_id = variable_db->registerVariableAndContext( nwgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); level->allocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { level->allocatePatchData(nvindx[iv]); } } @@ -240,129 +247,481 @@ int main( // Initialize control volume data for node-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr pgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double node_vol = dx[0] * dx[1]; + double node_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + node_vol *= dx[i]; + } boost::shared_ptr > data( - patch->getPatchData(nwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(nwgt_id))); + TBOX_ASSERT(data); data->fillAll(node_vol); pdat::NodeIndex ni(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 0.5; - } - //left and right boundaries - for (ic = plo1; ic <= phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 0.5; + } + // left and right boundaries + for (ic = plo1; ic <= phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) *= 0.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) *= 0.25; + } else { + // top and bottom boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) = 0.0; + } + // left and right boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 0.5; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1), + pdat::NodeIndex::UpperLeft)) *= 0.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1), + pdat::NodeIndex::UpperRight)) *= 0.25; } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 0.25; } else { - //top and bottom boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) = 0.0; - } - //left and right boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 0.5; - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine boundaries + for (ic = plo0; ic <= phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // left coarse-fine boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::UpperLeft); + (*data)(ni) *= 1.5; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1), + pdat::NodeIndex::LowerLeft)) *= 2.25; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1), + pdat::NodeIndex::UpperLeft)) *= 2.25; + } else { + // top and bottom coarse-fine boundaries + for (ic = plo0; ic < phi0; ++ic) { + ni = pdat::NodeIndex(hier::Index(ic, plo1), + pdat::NodeIndex::LowerRight); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic, phi1), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // right coarse-fine boundaries + for (ic = plo1; ic < phi1; ++ic) { + ni = pdat::NodeIndex(hier::Index(phi0, ic), + pdat::NodeIndex::UpperRight); + (*data)(ni) *= 1.5; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1), + pdat::NodeIndex::LowerRight)) *= 2.25; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1), + pdat::NodeIndex::UpperRight)) *= 2.25; + // shared left boundaries + for (ic = plo1; ic <= phi1 + 1; ++ic) { + ni = pdat::NodeIndex(hier::Index(plo0, ic), + pdat::NodeIndex::LowerLeft); + (*data)(ni) = 0; + } } - // corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 0.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) = 0.0; - (*data)(pdat::NodeIndex(hier::Index(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 0.25; } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine boundaries - for (ic = plo0; ic <= phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // bottom face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.5; + } + } + // left and right face boundaries + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.25; + } + // lower left and right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 0.25; + } + // left and right front and back edge boundaries + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) *= 0.125; + } else { + // front and back face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // top face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // left and right face boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.5; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) = 0.0; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + // upper and lower left and right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, phi1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) = 0.0; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + // front and back left and right edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 0.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 0.25; + } + // corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) = 0.0; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, plo2), + pdat::NodeIndex::LUL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, plo2), + pdat::NodeIndex::UUL)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, phi2), + pdat::NodeIndex::LUU)) *= 0.125; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, phi2), + pdat::NodeIndex::UUU)) *= 0.125; + // bottom face boundary + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) = 0.0; + } + } } - //left coarse-fine boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::UpperLeft); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index(plo0, - plo1), pdat::NodeIndex::LowerLeft)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index(plo0, - phi1), pdat::NodeIndex::UpperLeft)) *= 2.25; } else { - // top and bottom coarse-fine boundaries - for (ic = plo0; ic < phi0; ic++) { - ni = pdat::NodeIndex(hier::Index(ic, - plo1), pdat::NodeIndex::LowerRight); - (*data)(ni) *= 1.5; - ni = pdat::NodeIndex(hier::Index(ic, - phi1), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - //right coarse-fine boundaries - for (ic = plo1; ic < phi1; ic++) { - ni = pdat::NodeIndex(hier::Index(phi0, - ic), pdat::NodeIndex::UpperRight); - (*data)(ni) *= 1.5; - } - // coarse-fine corner boundaries - (*data)(pdat::NodeIndex(hier::Index(phi0, - plo1), pdat::NodeIndex::LowerRight)) *= 2.25; - (*data)(pdat::NodeIndex(hier::Index(phi0, - phi1), pdat::NodeIndex::UpperRight)) *= 2.25; - //shared left boundaries - for (ic = plo1; ic <= phi1 + 1; ic++) { - ni = pdat::NodeIndex(hier::Index(plo0, - ic), pdat::NodeIndex::LowerLeft); - (*data)(ni) = 0; + if (patch->getLocalId() == 0) { + // front and back coarse-fine face boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // top and bottom coarse-fine face boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // left coarse-fine face boundary + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 1.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // upper and lower left edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, phi1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(plo0, plo1, ic2), + pdat::NodeIndex::LLU); + (*data)(ni) *= 2.25; + } + // front and back left edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, plo2), + pdat::NodeIndex::LUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(plo0, ic1, phi2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 2.25; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, plo2), + pdat::NodeIndex::LLL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, plo2), + pdat::NodeIndex::LUL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, plo1, phi2), + pdat::NodeIndex::LLU)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(plo0, phi1, phi2), + pdat::NodeIndex::LUU)) *= 3.375; + } else { + // front and back coarse-fine face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(ic0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // top and bottom coarse-fine face boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(ic0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 1.5; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 1.5; + } + } + // right coarse-fine face boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(phi0, ic1, ic2), + pdat::NodeIndex::LUU); + (*data)(ni) *= 1.5; + } + } + // upper and lower front and back edge boundaries + for (ic0 = plo0; ic0 < phi0; ++ic0) { + ni = pdat::NodeIndex(hier::Index(ic0, phi1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, phi1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, plo2), + pdat::NodeIndex::ULL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(ic0, plo1, phi2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // upper and lower right edge boundaries + for (ic2 = plo2; ic2 < phi2; ++ic2) { + ni = pdat::NodeIndex(hier::Index(phi0, phi1, ic2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(phi0, plo1, ic2), + pdat::NodeIndex::ULU); + (*data)(ni) *= 2.25; + } + // front and back right edge boundaries + for (ic1 = plo1; ic1 < phi1; ++ic1) { + ni = pdat::NodeIndex(hier::Index(phi0, ic1, plo2), + pdat::NodeIndex::UUL); + (*data)(ni) *= 2.25; + ni = pdat::NodeIndex(hier::Index(phi0, ic1, phi2), + pdat::NodeIndex::UUU); + (*data)(ni) *= 2.25; + } + // coarse-fine corner boundaries + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, plo2), + pdat::NodeIndex::ULL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, plo2), + pdat::NodeIndex::UUL)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, plo1, phi2), + pdat::NodeIndex::ULU)) *= 3.375; + (*data)(pdat::NodeIndex(hier::Index(phi0, phi1, phi2), + pdat::NodeIndex::UUU)) *= 3.375; + // shared left boundaries + for (ic1 = plo1; ic1 <= phi1 + 1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2 + 1; ++ic2) { + ni = pdat::NodeIndex(hier::Index(plo0, ic1, ic2), + pdat::NodeIndex::LLL); + (*data)(ni) = 0; + } + } } } } @@ -375,13 +734,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::NodeData > cvdata = patch->getPatchData(cwgt_id); * - * pdat::NodeIterator cend(cvdata->getBox(), false); - * for (pdat::NodeIterator c(cvdata->getBox(), true); c != cend && vol_test_passed; ++c) { + * pdat::NodeIterator cend(pdat::NodeGeometry::end(cvdata->getBox())); + * for (pdat::NodeIterator c(pdat::NodeGeometry::begin(cvdata->getBox())); c != cend && vol_test_passed; ++c) { * pdat::NodeIndex node_index = *c; * * if (ln == 0) { @@ -405,7 +764,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -420,7 +779,7 @@ int main( // Expected: norm = 0.5 double norm = node_ops->sumControlVolumes(nvindx[0], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, 0.5)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #1b: math::HierarchyNodeDataOpsReal::sumControlVolumes()\n" << "Expected value = 0.5 , Computed value = " @@ -429,13 +788,21 @@ int main( // Test #2: math::HierarchyNodeDataOpsReal::numberOfEntries() // Expected: num_data_points = 121 - int num_data_points = node_ops->numberOfEntries(nvindx[0]); - if (num_data_points != 121) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchyNodeDataOpsReal::numberOfEntries()\n" - << "Expected value = 121 , Computed value = " - << num_data_points << std::endl; + int num_data_points = static_cast(node_ops->numberOfEntries(nvindx[0])); + { + int compare; + if (dim.getValue() == 2) { + compare = 121; + } else { + compare = 1001; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchyNodeDataOpsReal::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchyNodeDataOpsReal::setToScalar() @@ -443,7 +810,7 @@ int main( double val0 = double(2.0); node_ops->setToScalar(nvindx[0], val0); if (!doubleDataSameAsValue(nvindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchyNodeDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -455,7 +822,7 @@ int main( node_ops->setToScalar(nvindx[1], 4.0); double val1 = 4.0; if (!doubleDataSameAsValue(nvindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchyNodeDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -466,7 +833,7 @@ int main( // Expected: v2 = v1 = (4.0) node_ops->copyData(nvindx[2], nvindx[1]); if (!doubleDataSameAsValue(nvindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchyNodeDataOpsReal::setToScalar()\n" << "Expected: v2 = " << val1 << std::endl; @@ -477,14 +844,14 @@ int main( // Expected: v0 = (4.0), v1 = (2.0) node_ops->swapData(nvindx[0], nvindx[1]); if (!doubleDataSameAsValue(nvindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchyNodeDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val1 << std::endl; node_ops->printData(nvindx[0], tbox::plog); } if (!doubleDataSameAsValue(nvindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchyNodeDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val0 << std::endl; @@ -496,7 +863,7 @@ int main( node_ops->scale(nvindx[2], 0.25, nvindx[2]); double val_scale = 1.0; if (!doubleDataSameAsValue(nvindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchyNodeDataOpsReal::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -508,7 +875,7 @@ int main( node_ops->add(nvindx[3], nvindx[0], nvindx[1]); double val_add = 6.0; if (!doubleDataSameAsValue(nvindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchyNodeDataOpsReal::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -523,7 +890,7 @@ int main( node_ops->subtract(nvindx[1], nvindx[3], nvindx[0]); double val_sub = 6.0; if (!doubleDataSameAsValue(nvindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchyNodeDataOpsReal::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -535,7 +902,7 @@ int main( node_ops->addScalar(nvindx[1], nvindx[1], 0.0); double val_addScalar = 6.0; if (!doubleDataSameAsValue(nvindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchyNodeDataOpsReal::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -547,7 +914,7 @@ int main( node_ops->addScalar(nvindx[2], nvindx[2], 0.0); val_addScalar = 1.0; if (!doubleDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchyNodeDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -559,7 +926,7 @@ int main( node_ops->addScalar(nvindx[2], nvindx[2], 3.0); val_addScalar = 4.0; if (!doubleDataSameAsValue(nvindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchyNodeDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -574,7 +941,7 @@ int main( node_ops->multiply(nvindx[1], nvindx[3], nvindx[1]); double val_mult = 3.0; if (!doubleDataSameAsValue(nvindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchyNodeDataOpsReal::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -586,7 +953,7 @@ int main( node_ops->divide(nvindx[0], nvindx[2], nvindx[1]); double val_div = 1.333333333333333; if (!doubleDataSameAsValue(nvindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchyNodeDataOpsReal::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -598,7 +965,7 @@ int main( node_ops->reciprocal(nvindx[1], nvindx[1]); double val_rec = 0.33333333333333; if (!doubleDataSameAsValue(nvindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchyNodeDataOpsReal::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -610,7 +977,7 @@ int main( node_ops->abs(nvindx[3], nvindx[2]); double val_abs = 4.0; if (!doubleDataSameAsValue(nvindx[3], val_abs, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: math::HierarchyNodeDataOpsReal::abs()\n" << "Expected: v3 = " << val_abs << std::endl; @@ -626,17 +993,26 @@ int main( for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { patch = *ip; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); - hier::Index index0(2, 2); - hier::Index index1(5, 3); - if (patch->getBox().contains(index0)) { - (*ndata)(pdat::NodeIndex(index0, - pdat::NodeIndex::LowerLeft), 0) = 100.0; - } - if (patch->getBox().contains(index1)) { - (*ndata)(pdat::NodeIndex(index1, - pdat::NodeIndex::UpperRight), 0) = -1000.0; + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; + if (dim.getValue() == 2) { + if (patch->getBox().contains(index0)) { + (*ndata)(pdat::NodeIndex(index0, pdat::NodeIndex::LowerLeft), 0) = 100.0; + } + if (patch->getBox().contains(index1)) { + (*ndata)(pdat::NodeIndex(index1, pdat::NodeIndex::UpperRight), 0) = -1000.0; + } + } else { + if (patch->getBox().contains(index0)) { + (*ndata)(pdat::NodeIndex(index0, pdat::NodeIndex::LLL), 0) = 100.0; + } + if (patch->getBox().contains(index1)) { + (*ndata)(pdat::NodeIndex(index1, pdat::NodeIndex::UUU), 0) = -1000.0; + } } } @@ -645,13 +1021,26 @@ int main( for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { patch = *ipp; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); - pdat::NodeIndex index0(hier::Index(2, 2), pdat::NodeIndex::LowerLeft); - pdat::NodeIndex index1(hier::Index(5, 3), pdat::NodeIndex::UpperRight); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::NodeIndex::Corner corner0; + pdat::NodeIndex::Corner corner1; + if (dim.getValue() == 2) { + corner0 = pdat::NodeIndex::LowerLeft; + corner1 = pdat::NodeIndex::UpperRight; + } else { + corner0 = pdat::NodeIndex::LLL; + corner1 = pdat::NodeIndex::UUU; + } + pdat::NodeIndex index0(idx0, corner0); + pdat::NodeIndex index1(idx1, corner1); - pdat::NodeIterator cend(ndata->getBox(), false); - for (pdat::NodeIterator c(ndata->getBox(), true); + pdat::NodeIterator cend(pdat::NodeGeometry::end(ndata->getBox())); + for (pdat::NodeIterator c(pdat::NodeGeometry::begin(ndata->getBox())); c != cend && bogus_value_test_passed; ++c) { pdat::NodeIndex node_index = *c; @@ -677,7 +1066,7 @@ int main( } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: Place some bogus values on coarse level" << std::endl; @@ -687,20 +1076,28 @@ int main( // Test #15: math::HierarchyNodeDataOpsReal::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 1640.00 double bogus_l1_norm = node_ops->L1Norm(nvindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1640.00)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchyNodeDataOpsReal::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 1640.00, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1640.00; + } else { + compare = 5680.00; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchyNodeDataOpsReal::L1Norm()" + << " - w/o control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #16: math::HierarchyNodeDataOpsReal::L1Norm() - w/control weight // Expected: correct_l1_norm = 2.0 double correct_l1_norm = node_ops->L1Norm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(correct_l1_norm, 2.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #16: math::HierarchyNodeDataOpsReal::L1Norm()" << " - w/control weight\n" @@ -712,7 +1109,7 @@ int main( // Expected: l2_norm = 2.8284271 double l2_norm = node_ops->L2Norm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(l2_norm, 2.82842712475)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchyNodeDataOpsReal::L2Norm()\n" << "Expected value = 2.82842712475, Computed value = " @@ -723,7 +1120,7 @@ int main( // Expected: bogus_max_norm = 1000.0 double bogus_max_norm = node_ops->maxNorm(nvindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchyNodeDataOpsReal::maxNorm()" << " - w/o control weight\n" @@ -735,7 +1132,7 @@ int main( // Expected: max_norm = 4.0 double max_norm = node_ops->maxNorm(nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchyNodeDataOpsReal::maxNorm()" << " - w/control weight\n" @@ -753,7 +1150,7 @@ int main( double val_linearSum = 5.0; node_ops->linearSum(nvindx[3], 2.0, nvindx[1], 0.00, nvindx[0]); if (!doubleDataSameAsValue(nvindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchyNodeDataOpsReal::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -765,7 +1162,7 @@ int main( node_ops->axmy(nvindx[3], 3.0, nvindx[1], nvindx[0]); double val_axmy = 6.5; if (!doubleDataSameAsValue(nvindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::HierarchyNodeDataOpsReal::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -776,7 +1173,7 @@ int main( // Expected: cdot = 8.75 double cdot = node_ops->dot(nvindx[2], nvindx[1], nwgt_id); if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22a: math::HierarchyNodeDataOpsReal::dot() - (ind2) * (ind1)\n" << "Expected Value = 8.75, Computed Value = " @@ -787,7 +1184,7 @@ int main( // Expected: cdot = 8.75 cdot = node_ops->dot(nvindx[1], nvindx[2], nwgt_id); if (!tbox::MathUtilities::equalEps(cdot, 8.75)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22a: math::HierarchyNodeDataOpsReal::dot() - (ind1) * (ind2)\n" << "Expected Value = 8.75, Computed Value = " @@ -795,14 +1192,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(nwgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(nvindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { nvar[iv].reset(); } nwgt.reset(); @@ -812,14 +1209,16 @@ int main( node_ops.reset(); nwgt_ops.reset(); - tbox::pout << "\nPASSED: node hiertest" << std::endl; + if (num_failures == 0) { + tbox::pout << "\nPASSED: node hiertest" << std::endl; + } } tbox::SAMRAIManager::shutdown(); tbox::SAMRAIManager::finalize(); tbox::SAMRAI_MPI::finalize(); - return 0; + return num_failures; } /* @@ -836,17 +1235,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > nvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(nvdata); - pdat::NodeIterator cend(nvdata->getBox(), false); - for (pdat::NodeIterator c(nvdata->getBox(), true); + pdat::NodeIterator cend(pdat::NodeGeometry::end(nvdata->getBox())); + for (pdat::NodeIterator c(pdat::NodeGeometry::begin(nvdata->getBox())); c != cend && test_passed; ++c) { pdat::NodeIndex node_index = *c; if (!tbox::MathUtilities::equalEps((*nvdata)(node_index), diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/side_cplxtest.C b/base/SAMRAI/SAMRAI/source/test/dataops/side_cplxtest.C index 515f9df1..46ded20c 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/side_cplxtest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/side_cplxtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test side-centered complex patch data ops * ************************************************************************/ @@ -45,7 +45,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -77,17 +77,13 @@ int main( TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } - const int d = atoi(argv[1]); + const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= SAMRAI_MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != 2) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("side_cplxtest.") - + tbox::Utilities::intToString(dim, 1) + "d.log"; + + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); /* @@ -95,26 +91,58 @@ int main( * then there will be memory leaks reported. */ { - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7)); - hier::IntVector ratio(dim2d, 2); - - hier::BoxContainer coarse_domain(dim2d); - hier::BoxContainer fine_boxes(dim2d); - coarse_domain.appendItem(coarse0); - coarse_domain.appendItem(coarse1); - fine_boxes.appendItem(fine0); - fine_boxes.appendItem(fine1); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } + + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); + + hier::BoxContainer coarse_domain; + hier::BoxContainer fine_boxes; + coarse_domain.pushBack(coarse0); + coarse_domain.pushBack(coarse1); + fine_boxes.pushBack(fine0); + fine_boxes.pushBack(fine1); boost::shared_ptr geometry( new geom::CartesianGridGeometry( @@ -126,38 +154,42 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); - // Note: For these simple tests we allow at most 2 processors. + hierarchy->setMaxNumberOfLevels(2); + hierarchy->setRatioToCoarserLevel(ratio, 1); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); - const int n_coarse_boxes = coarse_domain.getNumberOfBoxes(); - const int n_fine_boxes = fine_boxes.getNumberOfBoxes(); + const int n_coarse_boxes = coarse_domain.size(); + const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getRank()) { - layer0.addBox(hier::Box(*coarse_itr, ib, - layer0.getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, ib, 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getRank()) { - layer1.addBox(hier::Box(*fine_itr, ib, - layer1.getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, ib, 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -168,33 +200,38 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; int svindx[NVARS]; - fvar[0].reset(new pdat::SideVariable(dim, "fvar0", 1)); + fvar[0].reset(new pdat::SideVariable(dim, "fvar0", + hier::IntVector::getOne(dim), 1)); svindx[0] = variable_db->registerVariableAndContext( fvar[0], dummy, no_ghosts); - fvar[1].reset(new pdat::SideVariable(dim, "fvar1", 1)); + fvar[1].reset(new pdat::SideVariable(dim, "fvar1", + hier::IntVector::getOne(dim), 1)); svindx[1] = variable_db->registerVariableAndContext( fvar[1], dummy, no_ghosts); - fvar[2].reset(new pdat::SideVariable(dim, "fvar2", 1)); + fvar[2].reset(new pdat::SideVariable(dim, "fvar2", + hier::IntVector::getOne(dim), 1)); svindx[2] = variable_db->registerVariableAndContext( fvar[2], dummy, no_ghosts); - fvar[3].reset(new pdat::SideVariable(dim, "fvar3", 1)); + fvar[3].reset(new pdat::SideVariable(dim, "fvar3", + hier::IntVector::getOne(dim), 1)); svindx[3] = variable_db->registerVariableAndContext( fvar[3], dummy, no_ghosts); boost::shared_ptr > swgt( - new pdat::SideVariable(dim, "swgt", 1)); + new pdat::SideVariable(dim, "swgt", + hier::IntVector::getOne(dim), 1)); int swgt_id = variable_db->registerVariableAndContext( swgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->allocatePatchData(svindx[iv]); } } @@ -213,104 +250,318 @@ int main( 1)); boost::shared_ptr patch; - boost::shared_ptr pgeom; // Initialize control volume data for side-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - boost::shared_ptr > data; - patch = level->getPatch(ip()); - pgeom = patch->getPatchGeometry(); + patch = *ip; + boost::shared_ptr pgeom( + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double side_vol = dx[0] * dx[1]; - data = patch->getPatchData(swgt_id); + double side_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + side_vol *= dx[i]; + } + boost::shared_ptr > data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(swgt_id))); + TBOX_ASSERT(data); data->fillAll(side_vol); pdat::SideIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + // left and right side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } } } else { - // top and bottom coarse-fine side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + } } } } @@ -323,13 +574,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::CellData > svdata = patch->getPatchData(cwgt_id); * - * pdat::CellIterator cend(svdata->getBox(), false); - * for (pdat::CellIterator c(svdata->getBox(), true); c != cend && vol_test_passed; ++c) { + * pdat::CellIterator cend(pdat::CellGeometry::end(svdata->getBox())); + * for (pdat::CellIterator c(pdat::CellGeometry::begin(svdata->getBox())); c != cend && vol_test_passed; ++c) { * pdat::CellIndex cell_index = *c; * * if (ln == 0) { @@ -353,7 +604,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -364,25 +615,40 @@ int main( // Test #1b: math::HierarchySideDataOpsComplex::sumControlVolumes() // Expected: norm = 1.0 - double norm = - side_ops->sumControlVolumes(svindx[0], swgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchySideDataOpsComplex::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + double norm = side_ops->sumControlVolumes(svindx[0], swgt_id); + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchySideDataOpsComplex::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchySideDataOpsComplex::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = side_ops->numberOfEntries(svindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchySideDataOpsComplex::numberOfEntries()\n" - << "Expected value = 209 , Computed value = " - << num_data_points << std::endl; + size_t num_data_points = side_ops->numberOfEntries(svindx[0]); + { + size_t compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2276; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchySideDataOpsComplex::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchySideDataOpsComplex::setToScalar() @@ -390,7 +656,7 @@ int main( dcomplex val0 = dcomplex(2.0, 1.5); side_ops->setToScalar(svindx[0], val0); if (!complexDataSameAsValue(svindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchySideDataOpsComplex::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -402,7 +668,7 @@ int main( dcomplex val1(4.0, 3.0); side_ops->setToScalar(svindx[1], dcomplex(4.0, 3.0)); if (!complexDataSameAsValue(svindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchySideDataOpsComplex::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -413,7 +679,7 @@ int main( // Expected: v2 = v1 = (4.0, 3.0) side_ops->copyData(svindx[2], svindx[1]); if (!complexDataSameAsValue(svindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchySideDataOpsComplex::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -424,14 +690,14 @@ int main( // Expected: v0 = (4.0, 3.0), v1 = (2.0,1.5) side_ops->swapData(svindx[0], svindx[1]); if (!complexDataSameAsValue(svindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchySideDataOpsComplex::swapData()\n" << "Expected: v0 = " << val1 << std::endl; side_ops->printData(svindx[0], tbox::plog); } if (!complexDataSameAsValue(svindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchySideDataOpsComplex::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -443,7 +709,7 @@ int main( side_ops->scale(svindx[2], 0.25, svindx[2]); dcomplex val_scale(1.0, 0.75); if (!complexDataSameAsValue(svindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchySideDataOpsComplex::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -455,7 +721,7 @@ int main( side_ops->add(svindx[3], svindx[0], svindx[1]); dcomplex val_add(6.0, 4.5); if (!complexDataSameAsValue(svindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchySideDataOpsComplex::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -470,7 +736,7 @@ int main( side_ops->subtract(svindx[1], svindx[3], svindx[0]); dcomplex val_sub(6.0, 0.0); if (!complexDataSameAsValue(svindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchySideDataOpsComplex::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -482,7 +748,7 @@ int main( side_ops->addScalar(svindx[1], svindx[1], dcomplex(0.0, -4.0)); dcomplex val_addScalar(6.0, -4.0); if (!complexDataSameAsValue(svindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchySideDataOpsComplex::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -494,7 +760,7 @@ int main( side_ops->addScalar(svindx[2], svindx[2], dcomplex(0.0, 0.25)); val_addScalar = dcomplex(1.0, 1.0); if (!complexDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchySideDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -506,7 +772,7 @@ int main( side_ops->addScalar(svindx[2], svindx[2], dcomplex(3.0, -4.0)); val_addScalar = dcomplex(4.0, -3.0); if (!complexDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchySideDataOpsComplex::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -521,7 +787,7 @@ int main( side_ops->multiply(svindx[1], svindx[3], svindx[1]); dcomplex val_mult(3.0, -2.0); if (!complexDataSameAsValue(svindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10: math::HierarchySideDataOpsComplex::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -533,7 +799,7 @@ int main( side_ops->divide(svindx[0], svindx[2], svindx[1]); dcomplex val_div(1.3846153846154, -0.076923076923077); if (!complexDataSameAsValue(svindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11: math::HierarchySideDataOpsComplex::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -545,7 +811,7 @@ int main( side_ops->reciprocal(svindx[1], svindx[1]); dcomplex val_rec(0.23076923076923, 0.15384615384615); if (!complexDataSameAsValue(svindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12: math::HierarchySideDataOpsComplex::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -560,10 +826,13 @@ int main( hierarchy->getPatchLevel(0)); for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { - patch = level_zero->getPatch(ip()); - sdata = patch->getPatchData(svindx[2]); - hier::Index index0(2, 2); - hier::Index index1(5, 3); + patch = *ip; + sdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(sdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; if (patch->getBox().contains(index0)) { (*sdata)(pdat::SideIndex(index0, pdat::SideIndex::Y, pdat::SideIndex::Lower), 0) = dcomplex(100.0, -50.0); @@ -578,20 +847,24 @@ int main( bool bogus_value_test_passed = true; for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { - patch = level_zero->getPatch(ipp()); - sdata = patch->getPatchData(svindx[2]); - pdat::SideIndex index0(hier::Index(2, - 2), pdat::SideIndex::Y, + patch = *ipp; + sdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(sdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::SideIndex index0(idx0, + pdat::SideIndex::Y, pdat::SideIndex::Lower); - pdat::SideIndex index1(hier::Index(5, - 3), pdat::SideIndex::Y, + pdat::SideIndex index1(idx1, + pdat::SideIndex::Y, pdat::SideIndex::Upper); // check X axis data - pdat::SideIterator cend(sdata->getBox(), pdat::SideIndex::X, false); - for (pdat::SideIterator c(sdata->getBox(), pdat::SideIndex::X, true); - c != ciend && bogus_value_test_passed; - ++c) { + pdat::SideIterator cend(pdat::SideGeometry::end(sdata->getBox(), pdat::SideIndex::X)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(sdata->getBox(), pdat::SideIndex::X)); + c != cend && bogus_value_test_passed; ++c) { pdat::SideIndex side_index = *c; if (!tbox::MathUtilities::equalEps((*sdata)(side_index), @@ -601,10 +874,9 @@ int main( } // check Y axis data - pdat::SideIterator ccend(sdata->getBox(), pdat::SideIndex::Y, false); - for (pdat::SideIterator cc(sdata->getBox(), pdat::SideIndex::Y, true); - cc != ccend && bogus_value_test_passed; - ++cc) { + pdat::SideIterator ccend(pdat::SideGeometry::end(sdata->getBox(), pdat::SideIndex::Y)); + for (pdat::SideIterator cc(pdat::SideGeometry::begin(sdata->getBox(), pdat::SideIndex::Y)); + cc != ccend && bogus_value_test_passed; ++cc) { pdat::SideIndex side_index = *cc; if (side_index == index0) { @@ -628,9 +900,23 @@ int main( } } } + + if (dim.getValue() == 3) { + // check Z axis data + pdat::SideIterator cend(pdat::SideGeometry::end(sdata->getBox(), pdat::SideIndex::Z)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(sdata->getBox(), pdat::SideIndex::Z)); + c != cend && bogus_value_test_passed; ++c) { + pdat::SideIndex side_index = *c; + + if (!tbox::MathUtilities::equalEps((*sdata)(side_index), + dcomplex(4.0, -3.0))) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13: Place some bogus values on coarse level" << std::endl; @@ -642,43 +928,67 @@ int main( // Test #14: math::HierarchySideDataOpsComplex::L1Norm() - w/o control weight // Expected: bogus_l1_norm = 2217.003379 double bogus_l1_norm = side_ops->L1Norm(svindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 2217.003379)) { - num_failures++; - tbox::perr - << "FAILED: - Test #14: math::HierarchySideDataOpsComplex::L1Norm()" - << " - w/o control weight\n" - << "Expected value = 2217.003379, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 2217.003379; + } else { + compare = 13062.0033789; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #14: math::HierarchySideDataOpsComplex::L1Norm()" + << " - w/o control weight\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #15: math::HierarchySideDataOpsComplex::L1Norm() - w/control weight // Expected: correct_l1_norm = 5.0 double correct_l1_norm = side_ops->L1Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchySideDataOpsComplex::L1Norm()" - << " - w/control weight\n" - << "Expected value = 5.0, Computed value = " - << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 7.5; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchySideDataOpsComplex::L1Norm()" + << " - w/control weight\n" + << "Expected value = " << compare << ", Computed value = " + << correct_l1_norm << std::endl; + } } // Test #16: math::HierarchySideDataOpsComplex::L2Norm() // Expected: l2_norm = 5.0 double l2_norm = side_ops->L2Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 5.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchySideDataOpsComplex::L2Norm()\n" - << "Expected value = 5.0, Computed value = " - << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 5.0; + } else { + compare = 6.12372435696; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchySideDataOpsComplex::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << l2_norm << std::endl; + } } // Test #17: math::HierarchySideDataOpsComplex::maxNorm() - w/o control weight // Expected: bogus_max_norm = 1000.19998 double bogus_max_norm = side_ops->maxNorm(svindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.19998)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #17: math::HierarchySideDataOpsComplex::maxNorm()" << " - w/o control weight\n" @@ -690,7 +1000,7 @@ int main( // Expected: max_norm = 5.0 double max_norm = side_ops->maxNorm(svindx[2], swgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 5.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchySideDataOpsComplex::maxNorm()" << " - w/control weight\n" @@ -709,7 +1019,7 @@ int main( dcomplex(2.0, 0.0), svindx[1], dcomplex(0.0, -1.0), svindx[0]); dcomplex val_linearSum(2.0, 5.0); if (!complexDataSameAsValue(svindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchySideDataOpsComplex::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -721,7 +1031,7 @@ int main( side_ops->axmy(svindx[3], 3.0, svindx[1], svindx[0]); dcomplex val_axmy(6.5, 12.0); if (!complexDataSameAsValue(svindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchySideDataOpsComplex::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -731,24 +1041,30 @@ int main( // Test #21a: math::HierarchySideDataOpsComplex::dot() - (ind2) * (ind1) // Expected: cdot = (17.5,-21.0) dcomplex cdot = side_ops->dot(svindx[2], svindx[1], swgt_id); - dcomplex ans_2_dot_1(17.5, -21.0); + double ctl_wt; + if (dim.getValue() == 2) { + ctl_wt = 1.0; + } else { + ctl_wt = 1.5; + } + dcomplex ans_2_dot_1(17.5 * ctl_wt, -21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot, ans_2_dot_1)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21a: math::HierarchySideDataOpsComplex::dot() - (ind2) * (ind1)\n" - << "Expected value = (17.5,-21.0), Computed value = " + << "Expected value = " << ans_2_dot_1 << ", Computed value = " << cdot << std::endl; } // Test #21b: math::HierarchySideDataOpsComplex::dot() - (ind1) * (ind2) // Expected: cdot = (17.5,-1.0) dcomplex cdot2 = side_ops->dot(svindx[1], svindx[2], swgt_id); - dcomplex ans_1_dot_2(17.5, 21.0); + dcomplex ans_1_dot_2(17.5 * ctl_wt, 21.0 * ctl_wt); if (!tbox::MathUtilities::equalEps(cdot2, ans_1_dot_2)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21b: math::HierarchySideDataOpsComplex::dot() - (ind1) * (ind2)\n" - << "Expected value = (17.5,21.0), Computed value = " + << "Expected value = " << ans_1_dot_2 << ", Computed value = " << cdot2 << std::endl; } @@ -757,7 +1073,7 @@ int main( side_ops->setToScalar(svindx[0], dcomplex(4.0, -3.0)); side_ops->abs(swgt_id, svindx[0]); if (!doubleDataSameAsValue(swgt_id, 5.0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #22: math::HierarchySideDataOpsComplex::abs()\n" << "Expected: abs(v0) = 5.0" << std::endl; @@ -765,14 +1081,14 @@ int main( } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(svindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } swgt.reset(); @@ -808,18 +1124,20 @@ complexDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > svdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(svdata); - pdat::SideIterator cend(svdata->getBox(), 1, false); - for (pdat::SideIterator c(svdata->getBox(), 1, true); - c != cend && test_passed; - ++c) { + pdat::SideIterator cend(pdat::SideGeometry::end(svdata->getBox(), 1)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(svdata->getBox(), 1)); + c != cend && test_passed; ++c) { pdat::SideIndex side_index = *c; if (!tbox::MathUtilities::equalEps((*svdata)(side_index), value)) { @@ -846,18 +1164,20 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - patch = level->getPatch(ip()); + patch = *ip; boost::shared_ptr > svdata( - patch->getPatchData(desc_id)); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(svdata); - pdat::SideIterator cend(svdata->getBox(), 1, false); - for (pdat::SideIterator c(svdata->getBox(), 1, true); - c != cend && test_passed; - ++c) { + pdat::SideIterator cend(pdat::SideGeometry::end(svdata->getBox(), 1)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(svdata->getBox(), 1)); + c != cend && test_passed; ++c) { pdat::SideIndex side_index = *c; if (!tbox::MathUtilities::equalEps((*svdata)(side_index), value)) { diff --git a/base/SAMRAI/SAMRAI/source/test/dataops/side_hiertest.C b/base/SAMRAI/SAMRAI/source/test/dataops/side_hiertest.C index f5aa3443..cee2a52e 100644 --- a/base/SAMRAI/SAMRAI/source/test/dataops/side_hiertest.C +++ b/base/SAMRAI/SAMRAI/source/test/dataops/side_hiertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test side-centered patch data ops * ************************************************************************/ @@ -46,7 +46,7 @@ using namespace std; #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -69,21 +69,15 @@ int main( tbox::SAMRAIManager::initialize(); tbox::SAMRAIManager::startup(); - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (argc < 2) { TBOX_ERROR("Usage: " << argv[0] << " [dimension]"); } const unsigned short d = static_cast(atoi(argv[1])); TBOX_ASSERT(d > 0); - TBOX_ASSERT(d <= tbox::Dimension::MAXIMUM_DIMENSION_VALUE); + TBOX_ASSERT(d <= SAMRAI::MAX_DIM_VAL); const tbox::Dimension dim(d); - if (dim != tbox::Dimension(2)) { - TBOX_ERROR("This test code is completed only for 2D!!!"); - } - const std::string log_fn = std::string("side_hiertest.") + tbox::Utilities::intToString(dim.getValue(), 1) + "d.log"; tbox::PIO::logAllNodes(log_fn); @@ -93,25 +87,51 @@ int main( * then there will be memory leaks reported. */ { - - const tbox::Dimension dim2d(2); - int ln, iv; // Make a dummy hierarchy domain - double lo[2] = { 0.0, 0.0 }; - double hi[2] = { 1.0, 0.5 }; - - hier::Box coarse0(hier::Index(0, 0), hier::Index(9, 2), hier::BlockId(0)); - hier::Box coarse1(hier::Index(0, 3), hier::Index(9, 4), hier::BlockId(0)); - hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7), hier::BlockId(0)); - hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7), hier::BlockId(0)); - hier::IntVector ratio(dim2d, 2); + double lo[SAMRAI::MAX_DIM_VAL]; + double hi[SAMRAI::MAX_DIM_VAL]; + + hier::Index clo0(dim); + hier::Index chi0(dim); + hier::Index clo1(dim); + hier::Index chi1(dim); + hier::Index flo0(dim); + hier::Index fhi0(dim); + hier::Index flo1(dim); + hier::Index fhi1(dim); + + for (int i = 0; i < dim.getValue(); ++i) { + lo[i] = 0.0; + clo0(i) = 0; + flo0(i) = 4; + fhi0(i) = 7; + if (i == 1) { + hi[i] = 0.5; + chi0(i) = 2; + clo1(i) = 3; + chi1(i) = 4; + } else { + hi[i] = 1.0; + chi0(i) = 9; + clo1(i) = 0; + chi1(i) = 9; + } + if (i == 0) { + flo1(i) = 8; + fhi1(i) = 13; + } else { + flo1(i) = flo0(i); + fhi1(i) = fhi0(i); + } + } - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); + hier::Box coarse0(clo0, chi0, hier::BlockId(0)); + hier::Box coarse1(clo1, chi1, hier::BlockId(0)); + hier::Box fine0(flo0, fhi0, hier::BlockId(0)); + hier::Box fine1(flo1, fhi1, hier::BlockId(0)); + hier::IntVector ratio(dim, 2); hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; @@ -133,37 +153,39 @@ int main( hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); - // Note: For these simple tests we allow at most 2 processors. + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_itr) { + hier::BoxContainer::iterator coarse_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), + layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); + layer0->addBox(hier::Box(*coarse_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_itr) { + hier::BoxContainer::iterator fine_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), + layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); + layer1->addBox(hier::Box(*fine_itr, hier::LocalId(ib), 0)); } } @@ -174,35 +196,35 @@ int main( hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); boost::shared_ptr dummy( variable_db->getContext("dummy")); - const hier::IntVector no_ghosts(dim2d, 0); + const hier::IntVector no_ghosts(dim, 0); // Make some dummy variables and data on the hierarchy boost::shared_ptr > fvar[NVARS]; int svindx[NVARS]; - fvar[0].reset(new pdat::SideVariable(dim2d, "fvar0", 1)); + fvar[0].reset(new pdat::SideVariable(dim, "fvar0", 1)); svindx[0] = variable_db->registerVariableAndContext( fvar[0], dummy, no_ghosts); - fvar[1].reset(new pdat::SideVariable(dim2d, "fvar1", 1)); + + fvar[1].reset(new pdat::SideVariable(dim, "fvar1", 1)); svindx[1] = variable_db->registerVariableAndContext( fvar[1], dummy, no_ghosts); - fvar[2].reset(new pdat::SideVariable(dim2d, "fvar2", 1)); + fvar[2].reset(new pdat::SideVariable(dim, "fvar2", 1)); svindx[2] = variable_db->registerVariableAndContext( fvar[2], dummy, no_ghosts); - fvar[3].reset(new pdat::SideVariable(dim2d, "fvar3", 1)); + fvar[3].reset(new pdat::SideVariable(dim, "fvar3", 1)); svindx[3] = variable_db->registerVariableAndContext( fvar[3], dummy, no_ghosts); - boost::shared_ptr > swgt( - new pdat::SideVariable(dim2d, "swgt", 1)); + new pdat::SideVariable(dim, "swgt", 1)); int swgt_id = variable_db->registerVariableAndContext( swgt, dummy, no_ghosts); // allocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); level->allocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { level->allocatePatchData(svindx[iv]); } } @@ -225,102 +247,314 @@ int main( // Initialize control volume data for side-centered components hier::Box coarse_fine = fine0 + fine1; coarse_fine.coarsen(ratio); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr pgeom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); - const double side_vol = dx[0] * dx[1]; + double side_vol = dx[0]; + for (int i = 1; i < dim.getValue(); ++i) { + side_vol *= dx[i]; + } boost::shared_ptr > data( - patch->getPatchData(swgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(swgt_id))); + TBOX_ASSERT(data); data->fillAll(side_vol); pdat::SideIndex fi(dim); - int plo0 = patch->getBox().lower(0); - int phi0 = patch->getBox().upper(0); - int plo1 = patch->getBox().lower(1); - int phi1 = patch->getBox().upper(1); - int ic; - - if (ln == 0) { - data->fillAll(0.0, (coarse_fine * patch->getBox())); - - if (patch->getLocalId() == 0) { - //bottom side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - } - //left and right side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; + + if (dim.getValue() == 2) { + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int ic; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // bottom side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + // left and right side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } else { + // top and bottom side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + // left and right side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } } } else { - //top and bottom side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; - } - //left and right side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 0.5; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 0.5; + if (patch->getLocalId() == 0) { + // top and bottom coarse-fine side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + // left coarse-fine side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } else { + // top and bottom coarse-fine side boundaries + for (ic = plo0; ic <= phi0; ++ic) { + fi = pdat::SideIndex(hier::Index(ic, plo1), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + fi = pdat::SideIndex(hier::Index(ic, phi1), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + // left and right coarse-fine side boundaries + for (ic = plo1; ic <= phi1; ++ic) { + fi = pdat::SideIndex(hier::Index(plo0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + fi = pdat::SideIndex(hier::Index(phi0, ic), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } } } } else { - if (patch->getLocalId() == 0) { - // top and bottom coarse-fine side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; - } - //left coarse-fine side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; + int plo0 = patch->getBox().lower(0); + int phi0 = patch->getBox().upper(0); + int plo1 = patch->getBox().lower(1); + int phi1 = patch->getBox().upper(1); + int plo2 = patch->getBox().lower(2); + int phi2 = patch->getBox().upper(2); + int ic0, ic1, ic2; + + if (ln == 0) { + data->fillAll(0.0, (coarse_fine * patch->getBox())); + + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 0.5; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 0.5; + } + } } } else { - // top and bottom coarse-fine side boundaries - for (ic = plo0; ic <= phi0; ic++) { - fi = pdat::SideIndex(hier::Index(ic, - plo1), pdat::SideIndex::Y, pdat::SideIndex::Lower); - (*data)(fi) *= 1.5; - fi = pdat::SideIndex(hier::Index(ic, - phi1), pdat::SideIndex::Y, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; - } - //left and right coarse-fine side boundaries - for (ic = plo1; ic <= phi1; ic++) { - fi = pdat::SideIndex(hier::Index(plo0, - ic), pdat::SideIndex::X, pdat::SideIndex::Lower); - (*data)(fi) = 0.0; - fi = pdat::SideIndex(hier::Index(phi0, - ic), pdat::SideIndex::X, pdat::SideIndex::Upper); - (*data)(fi) *= 1.5; + if (patch->getLocalId() == 0) { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + } else { + // front and back boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + int array_front[3] = { ic0, ic1, phi2 }; + fi = pdat::SideIndex(hier::Index(dim, array_front), + pdat::SideIndex::Z, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_back[3] = { ic0, ic1, plo2 }; + fi = pdat::SideIndex(hier::Index(dim, array_back), + pdat::SideIndex::Z, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // top and bottom boundary faces + for (ic0 = plo0; ic0 <= phi0; ++ic0) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_top[3] = { ic0, phi1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_top), + pdat::SideIndex::Y, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + int array_bottom[3] = { ic0, plo1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_bottom), + pdat::SideIndex::Y, + pdat::SideIndex::Lower); + (*data)(fi) *= 1.5; + } + } + // left and right boundary faces + for (ic1 = plo1; ic1 <= phi1; ++ic1) { + for (ic2 = plo2; ic2 <= phi2; ++ic2) { + int array_left[3] = { plo0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_left), + pdat::SideIndex::X, + pdat::SideIndex::Lower); + (*data)(fi) = 0.0; + int array_right[3] = { phi0, ic1, ic2 }; + fi = pdat::SideIndex(hier::Index(dim, array_right), + pdat::SideIndex::X, + pdat::SideIndex::Upper); + (*data)(fi) *= 1.5; + } + } } } } @@ -333,13 +567,13 @@ int main( // Expected: cwgt = 0.01 on coarse (except where finer patch exists) and // 0.0025 on fine level /* bool vol_test_passed = true; - * for (ln = 0; ln < 2; ln++) { + * for (ln = 0; ln < 2; ++ln) { * for (hier::PatchLevel::iterator ip(hierarchy->getPatchLevel(ln)->begin()); ip != hierarchy->getPatchLevel(ln)->end(); ++ip) { * patch = hierarchy->getPatchLevel(ln)->getPatch(ip()); * boost::shared_ptr< pdat::SideData > cvdata = patch->getPatchData(cwgt_id); * - * pdat::SideIterator cend(cvdata->getBox(), 1, false); - * for (pdat::SideIterator c(cvdata->getBox(), 1, true); c != cend && vol_test_passed; ++c) { + * pdat::SideIterator cend(pdat::SideGeometry::end(cvdata->getBox(), 1); + * for (pdat::SideIterator c(pdat::SideGeometry::begin(cvdata->getBox(), 1)); c != cend && vol_test_passed; ++c) { * pdat::SideIndex side_index = *c; * * if (ln == 0) { @@ -363,7 +597,7 @@ int main( * } * } * if (!vol_test_passed) { - * num_failures++; + * ++num_failures; * tbox::perr << "FAILED: - Test #1a: Check control volume data set properly" << std::endl; * cwgt_ops->printData(cwgt_id, tbox::plog); * } @@ -375,25 +609,40 @@ int main( // Test #1b: math::HierarchySideDataOpsReal::sumControlVolumes() // Expected: norm = 1.0 - double norm = - side_ops->sumControlVolumes(svindx[0], swgt_id); - if (!tbox::MathUtilities::equalEps(norm, 1.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #1b: math::HierarchySideDataOpsReal::sumControlVolumes()\n" - << "Expected value = 1.0 , Computed value = " - << norm << std::endl; + double norm = side_ops->sumControlVolumes(svindx[0], swgt_id); + { + double compare; + if (dim.getValue() == 2) { + compare = 1.0; + } else { + compare = 1.5; + } + if (!tbox::MathUtilities::equalEps(norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #1b: math::HierarchySideDataOpsReal::sumControlVolumes()\n" + << "Expected value = " << compare << ", Computed value = " + << norm << std::endl; + } } // Test #2: math::HierarchySideDataOpsReal::numberOfEntries() // Expected: num_data_points = 209 - int num_data_points = side_ops->numberOfEntries(svindx[0]); - if (num_data_points != 209) { - num_failures++; - tbox::perr - << "FAILED: - Test #2: math::HierarchySideDataOpsReal::numberOfEntries()\n" - << "Expected value = 209 , Computed value = " - << num_data_points << std::endl; + size_t num_data_points = side_ops->numberOfEntries(svindx[0]); + { + size_t compare; + if (dim.getValue() == 2) { + compare = 209; + } else { + compare = 2276; + } + if (num_data_points != compare) { + ++num_failures; + tbox::perr + << "FAILED: - Test #2: math::HierarchySideDataOpsReal::numberOfEntries()\n" + << "Expected value = " << compare << ", Computed value = " + << num_data_points << std::endl; + } } // Test #3a: math::HierarchySideDataOpsReal::setToScalar() @@ -401,7 +650,7 @@ int main( double val0 = double(2.0); side_ops->setToScalar(svindx[0], val0); if (!doubleDataSameAsValue(svindx[0], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3a: math::HierarchySideDataOpsReal::setToScalar()\n" << "Expected: v0 = " << val0 << std::endl; @@ -413,7 +662,7 @@ int main( side_ops->setToScalar(svindx[1], 4.0); double val1 = 4.0; if (!doubleDataSameAsValue(svindx[1], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #3b: math::HierarchySideDataOpsReal::setToScalar()\n" << "Expected: v1 = " << val1 << std::endl; @@ -424,7 +673,7 @@ int main( // Expected: v2 = v1 = (4.0) side_ops->copyData(svindx[2], svindx[1]); if (!doubleDataSameAsValue(svindx[2], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #4: math::HierarchySideDataOpsReal::copyData()\n" << "Expected: v2 = " << val1 << std::endl; @@ -435,14 +684,14 @@ int main( // Expected: v0 = (4.0), v1 = (2.0) side_ops->swapData(svindx[0], svindx[1]); if (!doubleDataSameAsValue(svindx[0], val1, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5a: math::HierarchySideDataOpsReal::swapData()\n" << "Expected: v0 = " << val1 << std::endl; side_ops->printData(svindx[0], tbox::plog); } if (!doubleDataSameAsValue(svindx[1], val0, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #5b: math::HierarchySideDataOpsReal::swapData()\n" << "Expected: v1 = " << val0 << std::endl; @@ -454,7 +703,7 @@ int main( side_ops->scale(svindx[2], 0.25, svindx[2]); double val_scale = 1.0; if (!doubleDataSameAsValue(svindx[2], val_scale, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #6: math::HierarchySideDataOpsReal::scale()\n" << "Expected: v2 = " << val_scale << std::endl; @@ -466,7 +715,7 @@ int main( side_ops->add(svindx[3], svindx[0], svindx[1]); double val_add = 6.0; if (!doubleDataSameAsValue(svindx[3], val_add, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #7: math::HierarchySideDataOpsReal::add()\n" << "Expected: v3 = " << val_add << std::endl; @@ -481,7 +730,7 @@ int main( side_ops->subtract(svindx[1], svindx[3], svindx[0]); double val_sub = 6.0; if (!doubleDataSameAsValue(svindx[1], val_sub, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #8: math::HierarchySideDataOpsReal::subtract()\n" << "Expected: v1 = " << val_sub << std::endl; @@ -493,7 +742,7 @@ int main( side_ops->addScalar(svindx[1], svindx[1], 0.0); double val_addScalar = 6.0; if (!doubleDataSameAsValue(svindx[1], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9a: math::HierarchySideDataOpsReal::addScalar()\n" << "Expected: v1 = " << val_addScalar << std::endl; @@ -505,7 +754,7 @@ int main( side_ops->addScalar(svindx[2], svindx[2], 0.0); val_addScalar = 1.0; if (!doubleDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9b: math::HierarchySideDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -517,7 +766,7 @@ int main( side_ops->addScalar(svindx[2], svindx[2], 3.0); val_addScalar = 4.0; if (!doubleDataSameAsValue(svindx[2], val_addScalar, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #9c: math::HierarchySideDataOpsReal::addScalar()\n" << "Expected: v2 = " << val_addScalar << std::endl; @@ -532,7 +781,7 @@ int main( side_ops->multiply(svindx[1], svindx[3], svindx[1]); double val_mult = 3.0; if (!doubleDataSameAsValue(svindx[1], val_mult, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #10 math::HierarchySideDataOpsReal::multiply()\n" << "Expected: v1 = " << val_mult << std::endl; @@ -544,7 +793,7 @@ int main( side_ops->divide(svindx[0], svindx[2], svindx[1]); double val_div = 1.333333333333; if (!doubleDataSameAsValue(svindx[0], val_div, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #11 math::HierarchySideDataOpsReal::divide()\n" << "Expected: v0 = " << val_div << std::endl; @@ -556,7 +805,7 @@ int main( side_ops->reciprocal(svindx[1], svindx[1]); double val_rec = 0.33333333333333; if (!doubleDataSameAsValue(svindx[1], val_rec, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #12 math::HierarchySideDataOpsReal::reciprocal()\n" << "Expected: v1 = " << val_rec << std::endl; @@ -568,7 +817,7 @@ int main( side_ops->abs(svindx[3], svindx[2]); double val_abs = 4.0; if (!doubleDataSameAsValue(svindx[3], val_abs, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #13 math::HierarchySideDataOpsReal::abs()\n" << "Expected: v3 = " << val_abs << std::endl; @@ -584,10 +833,12 @@ int main( for (hier::PatchLevel::iterator ip(level_zero->begin()); ip != level_zero->end(); ++ip) { patch = *ip; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(svindx[2])); - hier::Index index0(2, 2); - hier::Index index1(5, 3); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(cdata); + hier::Index index0(dim, 2); + hier::Index index1(dim, 3); + index1(0) = 5; if (patch->getBox().contains(index0)) { (*cdata)(pdat::SideIndex(index0, pdat::SideIndex::Y, pdat::SideIndex::Lower), 0) = 100.0; @@ -603,18 +854,22 @@ int main( for (hier::PatchLevel::iterator ipp(level_zero->begin()); ipp != level_zero->end(); ++ipp) { patch = *ipp; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(svindx[2])); - pdat::SideIndex index0(hier::Index(2, - 2), pdat::SideIndex::Y, + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(svindx[2])); + TBOX_ASSERT(cdata); + hier::Index idx0(dim, 2); + hier::Index idx1(dim, 3); + idx1(0) = 5; + pdat::SideIndex index0(idx0, + pdat::SideIndex::Y, pdat::SideIndex::Lower); - pdat::SideIndex index1(hier::Index(5, - 3), pdat::SideIndex::Y, + pdat::SideIndex index1(idx1, + pdat::SideIndex::Y, pdat::SideIndex::Upper); // check X axis data - pdat::SideIterator cend(cdata->getBox(), pdat::SideIndex::X, false); - for (pdat::SideIterator c(cdata->getBox(), pdat::SideIndex::X, true); + pdat::SideIterator cend(pdat::SideGeometry::end(cdata->getBox(), pdat::SideIndex::X)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(cdata->getBox(), pdat::SideIndex::X)); c != cend && bogus_value_test_passed; ++c) { pdat::SideIndex side_index = *c; @@ -626,8 +881,8 @@ int main( } // check Y axis data - pdat::SideIterator ccend(cdata->getBox(), pdat::SideIndex::Y, false); - for (pdat::SideIterator cc(cdata->getBox(), pdat::SideIndex::Y, true); + pdat::SideIterator ccend(pdat::SideGeometry::end(cdata->getBox(), pdat::SideIndex::Y)); + for (pdat::SideIterator cc(pdat::SideGeometry::begin(cdata->getBox(), pdat::SideIndex::Y)); cc != ccend && bogus_value_test_passed; ++cc) { pdat::SideIndex side_index = *cc; @@ -651,9 +906,24 @@ int main( } } } + + if (dim.getValue() == 3) { + // check Z axis data + pdat::SideIterator cend(pdat::SideGeometry::end(cdata->getBox(), pdat::SideIndex::Z)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(cdata->getBox(), pdat::SideIndex::Z)); + c != cend && bogus_value_test_passed; + ++c) { + pdat::SideIndex side_index = *c; + + if (!tbox::MathUtilities::equalEps((*cdata)(side_index), + 4.0)) { + bogus_value_test_passed = false; + } + } + } } if (!bogus_value_test_passed) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #14: Place some bogus values on coarse level" << std::endl; @@ -663,43 +933,67 @@ int main( // Test #15: math::HierarchySideDataOpsReal::L1Norm() - w/o control weights // Expected: bogus_l1_norm = 1984.00 double bogus_l1_norm = side_ops->L1Norm(svindx[2]); - if (!tbox::MathUtilities::equalEps(bogus_l1_norm, 1984.00)) { - num_failures++; - tbox::perr - << "FAILED: - Test #15: math::HierarchySideDataOpsReal::L1Norm()" - << " - w/o control weights\n" - << "Expected value = 1984.00, Computed value = " - << std::setprecision(12) << bogus_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 1984.0; + } else { + compare = 10660.0; + } + if (!tbox::MathUtilities::equalEps(bogus_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #15: math::HierarchySideDataOpsReal::L1Norm()" + << " - w/o control weights\n" + << "Expected value = " << compare << ", Computed value = " + << std::setprecision(12) << bogus_l1_norm << std::endl; + } } // Test #16: math::HierarchySideDataOpsReal::L1Norm() - w/control weights // Expected: correct_l1_norm = 4.0 double correct_l1_norm = side_ops->L1Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(correct_l1_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #16: math::HierarchySideDataOpsReal::L1Norm()" - << " - w/control weights\n" - << "Expected value = 4.0, Computed value = " - << correct_l1_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 6.0; + } + if (!tbox::MathUtilities::equalEps(correct_l1_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #16: math::HierarchySideDataOpsReal::L1Norm()" + << " - w/control weights\n" + << "Expected value = " << compare << ", Computed value = " + << correct_l1_norm << std::endl; + } } // Test #17: math::HierarchySideDataOpsReal::L2Norm() // Expected: l2_norm = 4.0 double l2_norm = side_ops->L2Norm(svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(l2_norm, 4.0)) { - num_failures++; - tbox::perr - << "FAILED: - Test #17: math::HierarchySideDataOpsReal::L2Norm()\n" - << "Expected value = 4.0, Computed value = " - << l2_norm << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 4.0; + } else { + compare = 4.89897948557; + } + if (!tbox::MathUtilities::equalEps(l2_norm, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #17: math::HierarchySideDataOpsReal::L2Norm()\n" + << "Expected value = " << compare << ", Computed value = " + << l2_norm << std::endl; + } } // Test #18: math::HierarchySideDataOpsReal::maxNorm() - w/o control weights // Expected: bogus_max_norm = 1000.0 double bogus_max_norm = side_ops->maxNorm(svindx[2]); if (!tbox::MathUtilities::equalEps(bogus_max_norm, 1000.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #18: math::HierarchySideDataOpsReal::maxNorm()" << " - w/o control weights\n" @@ -711,7 +1005,7 @@ int main( // Expected: max_norm = 4.0 double max_norm = side_ops->maxNorm(svindx[2], swgt_id); if (!tbox::MathUtilities::equalEps(max_norm, 4.0)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #19: math::HierarchySideDataOpsReal::maxNorm()" << " - w/control weights\n" @@ -729,7 +1023,7 @@ int main( side_ops->linearSum(svindx[3], 2.0, svindx[1], 0.0, svindx[0]); double val_linearSum = 5.0; if (!doubleDataSameAsValue(svindx[3], val_linearSum, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #20: math::HierarchySideDataOpsReal::linearSum()\n" << "Expected: v3 = " << val_linearSum << std::endl; @@ -741,7 +1035,7 @@ int main( side_ops->axmy(svindx[3], 3.0, svindx[1], svindx[0]); double val_axmy = 6.5; if (!doubleDataSameAsValue(svindx[3], val_axmy, hierarchy)) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - Test #21: math::HierarchySideDataOpsReal::axmy()\n" << "Expected: v3 = " << val_axmy << std::endl; @@ -751,34 +1045,50 @@ int main( // Test #22a: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 17.5 double cdot = side_ops->dot(svindx[2], svindx[1], swgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22a: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22a: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // Test #22b: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1) // Expected: cdot = 17.5 cdot = side_ops->dot(svindx[1], svindx[2], swgt_id); - if (!tbox::MathUtilities::equalEps(cdot, 17.5)) { - num_failures++; - tbox::perr - << "FAILED: - Test #22b: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1)\n" - << "Expected Value = 17.5, Computed Value = " - << cdot << std::endl; + { + double compare; + if (dim.getValue() == 2) { + compare = 17.5; + } else { + compare = 26.25; + } + if (!tbox::MathUtilities::equalEps(cdot, compare)) { + ++num_failures; + tbox::perr + << "FAILED: - Test #22b: math::HierarchySideDataOpsReal::dot() - (ind2) * (ind1)\n" + << "Expected Value = " << compare << ", Computed Value = " + << cdot << std::endl; + } } // deallocate data on hierarchy - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(swgt_id); - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { hierarchy->getPatchLevel(ln)->deallocatePatchData(svindx[iv]); } } - for (iv = 0; iv < NVARS; iv++) { + for (iv = 0; iv < NVARS; ++iv) { fvar[iv].reset(); } swgt.reset(); @@ -814,17 +1124,19 @@ doubleDataSameAsValue( int ln; boost::shared_ptr patch; - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; boost::shared_ptr > cvdata( - patch->getPatchData(desc_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(desc_id))); + + TBOX_ASSERT(cvdata); - pdat::SideIterator cend(cvdata->getBox(), 1, false); - for (pdat::SideIterator c(cvdata->getBox(), 1, true); + pdat::SideIterator cend(pdat::SideGeometry::end(cvdata->getBox(), 1)); + for (pdat::SideIterator c(pdat::SideGeometry::begin(cvdata->getBox(), 1)); c != cend && test_passed; ++c) { pdat::SideIndex side_index = *c; diff --git a/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.depend index b846f988..c1dc69aa 100644 --- a/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,7 +14,6 @@ FILE_0=main.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -22,16 +21,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.in b/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.in index e7b21b0f..853a46ec 100644 --- a/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/dimension/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for timer and statistician main programs ## ######################################################################### @@ -14,6 +14,7 @@ SUBDIR = source/test/dimension VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -28,11 +29,18 @@ main: main.o $(LIBSAMRAIDEPEND) NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: main check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -41,15 +49,26 @@ check3d: $(MAKE) check checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile +examples: -clean: - $(SAMCLEAN) +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main - $(RM) -rf *.log.* stats include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/dimension/README b/base/SAMRAI/SAMRAI/source/test/dimension/README new file mode 100644 index 00000000..075e84af --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/dimension/README @@ -0,0 +1,27 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI Dimension class. +## +######################################################################### + +This is a unit test of SAMRAI's dimension classs. The files included in this +directory are as follows: + + main.C - unit tester + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/dimension/main.C b/base/SAMRAI/SAMRAI/source/test/dimension/main.C index d3dd4f88..06ed68fd 100644 --- a/base/SAMRAI/SAMRAI/source/test/dimension/main.C +++ b/base/SAMRAI/SAMRAI/source/test/dimension/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program to demonstrate/test the Dimension class * ************************************************************************/ @@ -39,90 +39,85 @@ int main( */ { /* This test assumes that the maximum dim is at least 3 which is the default */ - assert(tbox::Dimension::MAXIMUM_DIMENSION_VALUE >= 3); + assert(SAMRAI::MAX_DIM_VAL >= 3); tbox::Dimension dim1(1); tbox::Dimension dim2(2); tbox::Dimension dim3(3); if (dim1.getValue() != 1) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim check; dim = 1"); } if (dim2.getValue() != 2) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim check; dim = 2"); } if (dim3.getValue() != 3) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim check; dim = 3"); } - if (!dim3.isValid()) { - fail_count++; - TBOX_ERROR("Failed dim check: isValid"); - } - tbox::Dimension a(2), b(2); if (!(a == b)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: =="); } if (!(a != dim1)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: !="); } if (dim1 > dim2) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: >"); } if (!(dim3 > dim2)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: >"); } if (dim1 >= dim2) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: >="); } if (!(dim3 >= dim2)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: >="); } if (!(dim2 >= dim2)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: >="); } if (dim2 < dim1) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: <"); } if (!(dim2 < dim3)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: <"); } if (dim2 <= dim1) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: <="); } if (!(dim2 <= dim3)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: <="); } if (!(dim2 <= dim2)) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim comparison check: <="); } @@ -130,7 +125,7 @@ int main( // Currently not allowed. a = dim3; if (a != dim3) { - fail_count++; + ++fail_count; TBOX_ERROR("Failed dim assignment check"); } #endif diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.C b/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.C index 0d1c80cf..225f9fbf 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.C +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: DLBGTest class implementation * ************************************************************************/ @@ -33,13 +33,12 @@ DLBGTest::DLBGTest( d_name(object_name), d_dim(dim), d_hierarchy(patch_hierarchy), - d_tagger(object_name + ":tagger", - d_dim, - database->isDatabase("sine_tagger") ? - database->getDatabase("sine_tagger").get() : NULL), + d_sine_wall(object_name + ":tagger", + d_dim, + database->getDatabaseWithDefault("sine_tagger", boost::shared_ptr())), d_time(0.5) { - d_tagger.resetHierarchyConfiguration(patch_hierarchy, 0, 0); + d_sine_wall.resetHierarchyConfiguration(patch_hierarchy, 0, 0); } DLBGTest::~DLBGTest() @@ -48,7 +47,7 @@ DLBGTest::~DLBGTest() mesh::StandardTagAndInitStrategy *DLBGTest::getStandardTagAndInitObject() { - return &d_tagger; + return &d_sine_wall; } /* @@ -58,7 +57,7 @@ void DLBGTest::computeHierarchyData( hier::PatchHierarchy& hierarchy, double time) { - d_tagger.computeHierarchyData(hierarchy, time); + d_sine_wall.computeHierarchyData(hierarchy, time); } /* @@ -67,7 +66,7 @@ void DLBGTest::computeHierarchyData( void DLBGTest::deallocatePatchData( hier::PatchHierarchy& hierarchy) { - d_tagger.deallocatePatchData(hierarchy); + d_sine_wall.deallocatePatchData(hierarchy); } /* @@ -76,7 +75,7 @@ void DLBGTest::deallocatePatchData( void DLBGTest::deallocatePatchData( hier::PatchLevel& level) { - d_tagger.deallocatePatchData(level); + d_sine_wall.deallocatePatchData(level); } #ifdef HAVE_HDF5 @@ -84,10 +83,7 @@ int DLBGTest::registerVariablesWithPlotter( boost::shared_ptr writer) { if (writer) { - d_tagger.registerVariablesWithPlotter(*writer); - writer->registerDerivedPlotQuantity("Owner", - "SCALAR", - this); + d_sine_wall.registerVariablesWithPlotter(*writer); } return 0; } @@ -98,21 +94,15 @@ bool DLBGTest::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { + NULL_USE(buffer); NULL_USE(patch); + NULL_USE(region); + NULL_USE(variable_name); NULL_USE(depth_id); - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << "DLBGTest::packDerivedPatchDataIntoDoubleBuffer"); - } - + NULL_USE(simulation_time); + TBOX_ERROR("Should not be here. This object didn't register any derived plot variables."); return true; } diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.h b/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.h index 972e9611..de0c45ab 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.h +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/DLBGTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: DLBGTest class declaration * ************************************************************************/ @@ -11,7 +11,7 @@ #define included_DLBGTest #include -#include +#include "boost/shared_ptr.hpp" #include "SAMRAI/tbox/Database.h" @@ -25,7 +25,7 @@ #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/solv/CartesianRobinBcHelper.h" #include "SAMRAI/solv/RobinBcCoefStrategy.h" -#include "SinusoidalFrontTagger.h" +#include "test/testlib/SinusoidalFrontGenerator.h" using namespace SAMRAI; @@ -59,7 +59,8 @@ class DLBGTest: const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; //@} @@ -107,7 +108,7 @@ class DLBGTest: const tbox::Dimension d_dim; boost::shared_ptr d_hierarchy; - SinusoidalFrontTagger d_tagger; + SinusoidalFrontGenerator d_sine_wall; /*! * @brief Front time. diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.depend index 91632639..8eb7d112 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -49,12 +49,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -92,7 +94,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -105,8 +106,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -114,10 +115,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h DLBGTest.C \ - DLBGTest.h SinusoidalFrontTagger.h + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h DLBGTest.C DLBGTest.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -140,160 +142,13 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=SinusoidalFrontTagger.o -DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SinusoidalFrontTagger.C \ - SinusoidalFrontTagger.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=get-input-filename.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h get-input-filename.C \ - get-input-filename.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - -endif +${FILE_0}: ${DEPENDS_0} -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - -FILE_3=main.o -DEPENDS_3:=\ +FILE_1=main.o +DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ @@ -310,6 +165,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -322,6 +178,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ @@ -335,12 +193,14 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -373,7 +233,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -381,11 +240,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -444,12 +304,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -464,9 +324,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -489,11 +350,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h DLBGTest.h \ - SinusoidalFrontTagger.h get-input-filename.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h \ + $(TESTLIBDIR)/get-input-filename.h DLBGTest.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ +DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ @@ -551,10 +413,9 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.in b/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.in index b84792af..56ab3333 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/Makefile.in @@ -3,65 +3,94 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for DLBG test ## ######################################################################### -SAMRAI = @top_srcdir@ +SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ SUBDIR = source/test/dlbg -VPATH = @top_srcdir@/source/test/dlbg +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 -CXX_OBJS = main.o DLBGTest.o SinusoidalFrontTagger.o intToString.o get-input-filename.o NUM_TESTS = 3 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = main.o DLBGTest.o SinusoidalFrontTagger.o get-input-filename.o +CXX_OBJS = main.o DLBGTest.o -main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ +main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ +testlib: + cd $(TESTLIBDIR) && $(MAKE) library + +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): + check: $(MAKE) check2d $(MAKE) check3d check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f *main* - $(RM) -rf restart-*d* +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/README b/base/SAMRAI/SAMRAI/source/test/dlbg/README new file mode 100644 index 00000000..12d6591e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/README @@ -0,0 +1,42 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Test of Connectors generated by Berger Rigoutsos. +## +######################################################################### + +This test checks the BergerRigoutsos algorithm and the Connectors generated by +it. It is very similar to the clustering/async_br test. The files included +in this directory are as follows: + + main.C - unit tester + DLBGTest.[Ch] - tags cells based on sinusoidal front and + computes new hierarchy based on tagging + get-input-filename.[Ch] - utility for getting input file name + test_inputs/*.input - 2d and 3d input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + For one of the following input files: + test_inputs/front.2d.input + test_inputs/periodic.2d.input + test_inputs/front.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/front.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.C b/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.C deleted file mode 100644 index d61948fd..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.C +++ /dev/null @@ -1,607 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class implementation - * - ************************************************************************/ -#include "SinusoidalFrontTagger.h" - -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include "SAMRAI/pdat/MDA_Access.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - -SinusoidalFrontTagger::SinusoidalFrontTagger( - const std::string& object_name, - const tbox::Dimension& dim, - tbox::Database* database): - d_name(object_name), - d_dim(dim), - d_period(1.0), - d_amplitude(0.2), - d_ghost_cell_width(dim, 0), - d_buffer_cells(dim, 1), - d_allocate_data(true), - d_time(0.5) -{ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(variable_db != NULL); -#endif - - tbox::Array init_disp; - tbox::Array velocity; - - if (database != NULL) { - d_allocate_data = - database->getBoolWithDefault("allocate_data", - d_allocate_data); - if (database->isInteger("buffer_cells")) { - database->getIntegerArray("buffer_cells", - &d_buffer_cells[0], d_dim.getValue()); - } - for (int ln = 0; true; ++ln) { - std::string name("buffer_space_"); - name = name + tbox::Utilities::intToString(ln); - if (database->isDouble(name)) { - d_buffer_space.resizeArray(d_dim.getValue() * (ln + 1)); - database->getDoubleArray(name, &d_buffer_space[d_dim.getValue() * ln], d_dim.getValue()); - } else { - break; - } - } - d_period = - database->getDoubleWithDefault("period", - d_period); - if (database->isDouble("init_disp")) { - init_disp = - database->getDoubleArray("init_disp"); - } - if (database->isDouble("velocity")) { - velocity = - database->getDoubleArray("velocity"); - } - d_amplitude = - database->getDoubleWithDefault("amplitude", - d_amplitude); - d_time = - database->getDoubleWithDefault("time", - d_time); - } - - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - d_init_disp[idim] = idim < init_disp.size() ? init_disp[idim] : 0.0; - d_velocity[idim] = idim < velocity.size() ? velocity[idim] : 0.0; - } - - const std::string context_name = d_name + std::string(":context"); - d_context = variable_db->getContext(context_name); - - if (database->isInteger("ghost_cell_width")) { - database->getIntegerArray("ghost_cell_width", - &d_ghost_cell_width[0], d_dim.getValue()); - } - - boost::shared_ptr dist_var( - new pdat::NodeVariable(dim, d_name + ":dist")); - d_dist_id = variable_db->registerVariableAndContext(dist_var, - d_context, - d_ghost_cell_width); - - boost::shared_ptr tag_var( - new pdat::CellVariable(dim, d_name + ":tag")); - d_tag_id = variable_db->registerVariableAndContext(tag_var, - d_context, - d_ghost_cell_width); - - t_setup = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::setup"); - t_node_pos = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::node_pos"); - t_distance = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::distance"); - t_tag_cells = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::tag_cells"); - t_copy = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::copy"); -} - -SinusoidalFrontTagger::~SinusoidalFrontTagger() -{ -} - -void SinusoidalFrontTagger::initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& base_hierarchy, - /*! Level to initialize */ - const int ln, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_base_level, - const bool allocate_data) -{ - NULL_USE(can_be_refined); - - boost::shared_ptr hierarchy(base_hierarchy); - boost::shared_ptr old_level(old_base_level); - if (old_base_level) { - TBOX_ASSERT(old_level); - } - TBOX_ASSERT(hierarchy); - - /* - * Reference the level object with the given index from the hierarchy. - */ - boost::shared_ptr level(hierarchy->getPatchLevel(ln)); - - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - initializePatchData(patch, - init_data_time, - initial_time, - allocate_data); - } - -#if 0 - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - level->allocatePatchData(d_dist_id); - level->allocatePatchData(d_tag_id); - } - computeLevelData(hierarchy, ln, d_time /*init_data_time*/, - d_dist_id, d_tag_id, old_level); - } -#endif -} - -void SinusoidalFrontTagger::initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) -{ - NULL_USE(initial_time); - - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - if (!patch.checkAllocated(d_dist_id)) { - patch.allocatePatchData(d_dist_id); - } - if (!patch.checkAllocated(d_tag_id)) { - patch.allocatePatchData(d_tag_id); - } - boost::shared_ptr > dist_data( - patch.getPatchData(d_dist_id), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch.getPatchData(d_tag_id), - boost::detail::dynamic_cast_tag()); - TBOX_ASSERT(dist_data); - TBOX_ASSERT(tag_data); - computePatchData(patch, init_data_time, - dist_data.get(), tag_data.get()); - } - } -} - -void SinusoidalFrontTagger::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - -void SinusoidalFrontTagger::applyGradientDetector( - const boost::shared_ptr& base_hierarchy_, - const int ln, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation) -{ - NULL_USE(initial_time); - NULL_USE(uses_richardson_extrapolation); - boost::shared_ptr hierarchy_(base_hierarchy_); - TBOX_ASSERT(hierarchy_); - boost::shared_ptr level_(hierarchy_->getPatchLevel(ln)); - TBOX_ASSERT(level_); - - hier::PatchLevel& level = *level_; - - for (hier::PatchLevel::iterator pi(level.begin()); - pi != level.end(); ++pi) { - hier::Patch& patch = **pi; - - boost::shared_ptr tag_data( - patch.getPatchData(tag_index)); - if (!tag_data) { - TBOX_ERROR("Data index " << tag_index - << " does not exist for patch.\n"); - } - boost::shared_ptr > tag_cell_data_( - tag_data, - boost::detail::dynamic_cast_tag()); - if (!tag_cell_data_) { - TBOX_ERROR("Data index " << tag_index - << " is not cell int data.\n"); - } - - if (d_allocate_data) { - // Use internally stored data. - boost::shared_ptr saved_tag_data( - patch.getPatchData(d_tag_id)); - tag_cell_data_->copy(*saved_tag_data); - } else { - // Compute tag data for patch. - computePatchData(patch, - error_data_time, - NULL, - tag_cell_data_.get()); - } - - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchHierarchy& hierarchy) -{ - int ln; - for (ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - boost::shared_ptr level(hierarchy.getPatchLevel(ln)); - deallocatePatchData(*level); - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchLevel& level) -{ - level.deallocatePatchData(d_dist_id); - level.deallocatePatchData(d_tag_id); -} - -/* - * Deallocate patch data allocated by this class. - */ -void SinusoidalFrontTagger::computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time) -{ - d_time = time; - if (!d_allocate_data) return; - - for (int ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - computeLevelData(hierarchy, ln, time, d_dist_id, d_tag_id); - } -} - -/* - * Compute the solution data for a level. - * Can copy data from old level (if any) to support - * initializeLevelData(). - */ - -void SinusoidalFrontTagger::computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level) const -{ - NULL_USE(old_level); - - const boost::shared_ptr level( - hierarchy.getPatchLevel(ln)); - - /* - * Initialize data in all patches in the level. - */ - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - boost::shared_ptr > dist_data; - if (dist_id >= 0) { - dist_data = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(dist_id)); - } - boost::shared_ptr > tag_data; - if (tag_id >= 0) { - tag_data = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(tag_id)); - } - computePatchData(patch, time, - dist_data.get(), - tag_data.get()); - } -} - -/* - * Compute the solution data for a patch. - */ - -void SinusoidalFrontTagger::computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const -{ - - t_setup->start(); - - TBOX_ASSERT(d_hierarchy); - TBOX_ASSERT(patch.inHierarchy()); - - const int ln = patch.getPatchLevelNumber(); - const boost::shared_ptr level( - d_hierarchy->getPatchLevel(ln)); - const hier::IntVector& ratio(level->getRatioToLevelZero()); - - const hier::Box& pbox = patch.getBox(); - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const double* xlo = patch_geom->getXLower(); - - const double* dx = patch_geom->getDx(); - - // Compute the size of buffer to tag around cells crossing front. - hier::IntVector buffer(d_buffer_cells); - for (int i = 0; i < d_dim.getValue(); ++i) { - if (d_buffer_space.size() > ln * d_dim.getValue() + i) { - int space_based_buffer = - int(d_buffer_space[ln * d_dim.getValue() + i] / dx[i] + 0.5); - if (space_based_buffer > buffer(i)) buffer(i) = space_based_buffer; - } - } - // std::cout << "buffer for ln of " << ln << " is " << buffer << std::endl; - - /* - * We need at least buffer ghost cells to compute - * the tags, but the data does not have as many ghost cells. - * So we create temporary patch data with the required "ghost" - * buffer for computing tag values. (We could give the real - * data the required ghost cells, but that may affect the - * regridding algorithm I'm testing.) - */ - hier::IntVector required_tmp_buffer(buffer); - required_tmp_buffer *= ratio; - pdat::NodeData tmp_dist(pbox, 1, required_tmp_buffer); - pdat::CellData tmp_tag(pbox, 1, required_tmp_buffer); - - /* - * Determine what x-node-index contains the sinusoidal front. - */ - - const double wave_number = 2 * 3.141592654 / d_period; - - t_setup->stop(); - - t_node_pos->start(); - - hier::Box front_box = pbox; - front_box.grow(required_tmp_buffer); - front_box.growUpper(hier::IntVector(d_dim, 1)); - // Squash front_box to a single plane. - front_box.upper(0) = front_box.lower(0); - const int ifront = front_box.lower(0); - - pdat::ArrayData front_i_(front_box, 1); - - MDA_Access > front_i2; - MDA_Access > front_i3; - if (d_dim == tbox::Dimension(2)) { - front_i2 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int j = front_i2.beg(1); j < front_i2.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number * (y + d_init_disp[1] - d_velocity[1] * time)); - double fx = d_amplitude * siny + d_init_disp[0] + d_velocity[0] * time; - front_i2(ifront, j) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); - // std::cout << i << '\t' << j << '\t' << y << '\t' << front_i(i,j) << std::endl; - } - } else if (d_dim == tbox::Dimension(3)) { - front_i3 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int k = front_i3.beg(2); k < front_i3.end(2); ++k) { - double z = xlo[2] + dx[2] * (k - pbox.lower(2)); - double sinz = - sin(wave_number * (z + d_init_disp[2] - d_velocity[2] * time)); - for (int j = front_i3.beg(1); j < front_i3.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number * (y + d_init_disp[1] + d_velocity[1] * time)); - double fx = d_amplitude * siny * sinz + d_init_disp[0] - + d_velocity[0] * time; - front_i3(ifront, j, k) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); - // std::cout << i << '\t' << j << '\t' << k << '\t' << y << '\t' << z << '\t' << front_i(i,j,k) << std::endl; - } - } - } - - t_node_pos->stop(); - - if (dist_data != NULL) { - t_distance->start(); - - pdat::NodeData::iterator ni(tmp_dist.getGhostBox(), true); - pdat::NodeData::iterator niend(tmp_dist.getGhostBox(), false); - for ( ; ni != niend; ++ni) { - const pdat::NodeIndex& index = *ni; - if (d_dim == tbox::Dimension(2)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i2(ifront, index(1)) * dx[0]; - } else if (d_dim == tbox::Dimension(3)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i3(ifront, index(1), index(2)) * dx[0]; - } - } - // tmp_dist.print(tmp_dist.getBox(),0,plog); - - t_distance->stop(); - } - - if (tag_data != NULL) { - - t_tag_cells->start(); - - tag_data->fill(0); - - const hier::IntVector tag_growth(buffer); - - if (d_dim == tbox::Dimension(2)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int mini = front_i2(ifront, j) - buffer(0); - int maxi = front_i2(ifront, j) + buffer(0); - if (mini < pbox.lower() (0)) mini = pbox.lower() (0); - if (maxi > pbox.upper() (0)) maxi = pbox.upper() (0); - for (int i = mini; i <= maxi; ++i) { - tag_aa(i, j) = 1; - } - } - } else if (d_dim == tbox::Dimension(3)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int k = pbox.lower(2); k <= pbox.upper(2); ++k) { - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int mini = front_i3(ifront, j, k) - buffer(0); - int maxi = front_i3(ifront, j, k) + buffer(0); - if (mini < pbox.lower() (0)) mini = pbox.lower() (0); - if (maxi > pbox.upper() (0)) maxi = pbox.upper() (0); - for (int i = mini; i <= maxi; ++i) { - tag_aa(i, j, k) = 1; - } - } - } - } - - t_tag_cells->stop(); - - } - - t_copy->start(); - - /* - * Copy computed data to output. Recall that the convention is - * to send in a NULL pointer to indicate that data is not wanted. - */ - if (dist_data != NULL) { - dist_data->copy(tmp_dist); - } - - t_copy->stop(); -} - -#ifdef HAVE_HDF5 -int SinusoidalFrontTagger::registerVariablesWithPlotter( - appu::VisItDataWriter& writer) -{ - /* - * Register variables with plotter. - */ - if (d_allocate_data) { - writer.registerPlotQuantity("Distance to front", "SCALAR", d_dist_id); - writer.registerPlotQuantity("Tag value", "SCALAR", d_tag_id); - } else { - writer.registerDerivedPlotQuantity("Distance to front", "SCALAR", this, - // hier::IntVector(0), - 1.0, - "NODE"); - writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); - } - return 0; -} -#endif - -bool SinusoidalFrontTagger::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - NULL_USE(region); - NULL_USE(depth_index); - - TBOX_ASSERT(d_allocate_data == false); - if (variable_name == "Distance to front") { - pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, - 0)); - computePatchData(patch, d_time, &dist_data, NULL); - pdat::NodeData::iterator ciend(patch.getBox(), false); - for (pdat::NodeData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = dist_data(*ci); - } - } else if (variable_name == "Tag value") { - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - computePatchData(patch, d_time, NULL, &tag_data); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} - -void SinusoidalFrontTagger::setTime( - double time) -{ - d_time = time; -} diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.h b/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.h deleted file mode 100644 index b03c6728..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/SinusoidalFrontTagger.h +++ /dev/null @@ -1,247 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class declaration - * - ************************************************************************/ -#ifndef included_SinusoidalFrontTagger -#define included_SinusoidalFrontTagger - -#include -#include - -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Timer.h" - -using namespace std; -using namespace SAMRAI; - -/*! - * @brief Class to tag a sinusoidal "front" in given domain. - */ -class SinusoidalFrontTagger: - public mesh::StandardTagAndInitStrategy, - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - SinusoidalFrontTagger( - /*! Ojbect name */ - const std::string& object_name, - const tbox::Dimension& dim, - /*! Input database */ - tbox::Database* database = NULL); - - ~SinusoidalFrontTagger(); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - /*! - * @brief Allocate and initialize data for a new level - * in the patch hierarchy. - * - * This is where you implement the code for initialize data on the - * grid. Nevermind when it is called or where in the program that - * happens. All the information you need to initialize the grid - * are in the arguments. - * - * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() - */ - virtual void - initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& hierarchy, - /*! Level to initialize */ - const int level_number, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_level = - boost::shared_ptr(), - /*! Whether data on new patch needs to be allocated */ - const bool allocate_data = true); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level); - - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data); - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - - void - setTime( - double time); - -public: - /*! - * @brief Deallocate internally managed patch data on level. - */ - void - deallocatePatchData( - hier::PatchLevel& level); - - /*! - * @brief Deallocate internally managed patch data on hierarchy. - */ - void - deallocatePatchData( - hier::PatchHierarchy& hierarchy); - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - - /* - * Compute patch data allocated by this class, on a hierarchy. - */ - void - computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time); - - /*! - * @brief Compute distance and tag data for a level. - */ - void - computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level = - boost::shared_ptr()) const; - - /*! - * @brief Compute distance and tag data for a patch. - */ - void - computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const; - -private: - std::string d_name; - - const tbox::Dimension d_dim; - - boost::shared_ptr d_hierarchy; - - /*! - * @brief Period of sinusoid. - */ - double d_period; - - /*! - * @brief Initial displacement. - */ - double d_init_disp[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Front velocity. - */ - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Amplitude of sinusoid. - */ - double d_amplitude; - - /*! - * @brief ghost cell width of internal data. - * - * Optional. Meant to influence gridding parameters. Defaults to zero. - */ - hier::IntVector d_ghost_cell_width; - - /*! - * @brief Number of cells to tag around cells intersecting the front. - */ - hier::IntVector d_buffer_cells; - - tbox::Array d_buffer_space; - - boost::shared_ptr d_context; - - /*! - * @brief Distance from the front in the x direction. - */ - int d_dist_id; - /*! - * @brief Value of tag based on distance from front. - */ - int d_tag_id; - - /*! - * @brief Whether to allocate data on the mesh. - */ - bool d_allocate_data; - - /*! - * @brief Front time. - */ - double d_time; - - boost::shared_ptr t_setup; - boost::shared_ptr t_node_pos; - boost::shared_ptr t_distance; - boost::shared_ptr t_tag_cells; - boost::shared_ptr t_copy; - -}; - -#endif // included_ssup_SinusoidalFrontTagger diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.C b/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.C deleted file mode 100644 index 67fbe719..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.C +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting input file name. - * - ************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "get-input-filename.h" - -int get_input_filename( - int* argc, - char* argv[], - std::string& input_filename) { - - int rval = 0; - std::string argv0(argv[0]); - if (*argc > 1) { - // Input file is the first argument. Shift other arguments down. - input_filename = argv[1]; - --(*argc); - int i; - for (i = 1; i < (*argc); ++i) { - argv[i] = argv[i + 1]; - } - } else if (*argc == 1 && argv0.rfind("check-") < argv0.size()) { - /* - * No argument but input file is implicit in program name - * which has the form check-. - */ - input_filename = argv0.substr(argv0.rfind("check-") + 6) + ".input"; - } else if (*argc == 1) { - // No argument and not invoked as "check-blah". - rval = 1; - } - return rval; -} diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.h b/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.h deleted file mode 100644 index c33df146..00000000 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/get-input-filename.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility for getting input file name. - * - ************************************************************************/ -#include - -/*! - * This function gets the input file name from the argument list. - * For most cases, this is simply the first - * command-line argument (after the program name). - * The variable @c input_filename is set to the filename, - * and all arguments following it are shifed down one. - * Unless you are a developer, this is all you need to know. - * - * For the special case with no command-line argument, - * if the program is invoked with the name "check-blah", - * it assumes the input file is "blah.input". - * The purpose of this setup is so that it is compatible with - * the automake make-check mechanism, which runs programs without - * arguments. At the same time, an input file can be manually - * specified for operational flexibility. - * - * @return 0 if filename is found, 1 otherwise. - */ -int get_input_filename(int* argc, char* argv[], std::string & input_filename); diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/main.C b/base/SAMRAI/SAMRAI/source/test/dlbg/main.C index b9c514ed..5e712620 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/main.C +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for asynchronous BR implementation * ************************************************************************/ @@ -18,7 +18,7 @@ * Headers for basic SAMRAI objects used in this code. */ #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" @@ -47,9 +47,9 @@ #include "SAMRAI/xfer/CoarsenSchedule.h" #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" -#include "get-input-filename.h" +#include "test/testlib/get-input-filename.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; using namespace tbox; @@ -89,7 +89,7 @@ int main( { tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - tbox::plog << "Input file is " << input_filename << std::endl; + tbox::pout << "Input file is " << input_filename << std::endl; std::string case_name; if (argc >= 2) { @@ -127,7 +127,7 @@ int main( boost::shared_ptr main_db(input_db->getDatabase("Main")); const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); - tbox::plog << "Main database:" << endl; + tbox::plog << "Main database:" << std::endl; main_db->printClassData(tbox::plog); int verbose = main_db->getIntegerWithDefault("verbose", 0); @@ -153,7 +153,7 @@ int main( base_name = base_name + '-' + tbox::Utilities::intToString(mpi.getSize(), 5); } - tbox::plog << "Added case name (" << case_name << ") and nprocs (" + tbox::pout << "Added case name (" << case_name << ") and nprocs (" << mpi.getSize() << ") to base name -> '" << base_name << "'\n"; @@ -178,20 +178,13 @@ int main( } if (!case_name.empty()) { - tbox::plog << "Added case name (" << case_name << ") and nprocs (" + tbox::pout << "Added case name (" << case_name << ") and nprocs (" << mpi.getSize() << ") to base name -> '" << base_name << "'\n"; } - tbox::plog << "Running on " << mpi.getSize() + tbox::pout << "Running on " << mpi.getSize() << " processes.\n"; - /* - * Choose which BR implementation to use. - */ - char which_br = 'o'; - which_br = main_db->getCharWithDefault("which_br", which_br); - tbox::plog << "which_br is " << which_br << std::endl; - int ln; int plot_step = main_db->getIntegerWithDefault("plot_step", 0); @@ -234,7 +227,7 @@ int main( input_db->isDatabase("BergerRigoutsos") ? input_db->getDatabase("BergerRigoutsos") : boost::shared_ptr())); - new_br->setMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + new_br->useDuplicateMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); tbox::plog << "Creating grid algorithm.\n"; /* @@ -243,7 +236,6 @@ int main( */ boost::shared_ptr tag_and_initializer( new mesh::StandardTagAndInitialize( - dim, "CellTaggingMethod", dlbgtest.getStandardTagAndInitObject(), input_db->getDatabase("StandardTagAndInitialize"))); @@ -266,7 +258,7 @@ int main( input_db->getDatabase("GriddingAlgorithm"), tag_and_initializer, new_br, - tree_load_balancer)); + tree_load_balancer)); tbox::plog << "Gridding algorithm:" << std::endl; gridding_algorithm->printClassData(tbox::plog); @@ -290,10 +282,12 @@ int main( tbox::plog << "\nVariable database..." << std::endl; hier::VariableDatabase::getDatabase()->printClassData(tbox::plog); - tbox::Array tag_buffer(10); - for (int i = 0; i < tag_buffer.size(); ++i) tag_buffer[i] = 0; + std::vector tag_buffer(10); + for (int i = 0; i < static_cast(tag_buffer.size()); ++i) { + tag_buffer[i] = 0; + } if (main_db->isInteger("tag_buffer")) { - tag_buffer = main_db->getIntegerArray("tag_buffer"); + tag_buffer = main_db->getIntegerVector("tag_buffer"); } /* @@ -306,14 +300,15 @@ int main( t_generate_mesh->start(); gridding_algorithm->makeCoarsestLevel(0.0); bool done = false; - for (ln = 0; patch_hierarchy->levelCanBeRefined(ln) && !done; ln++) { + for (ln = 0; patch_hierarchy->levelCanBeRefined(ln) && !done; ++ln) { tbox::plog << "Adding finer levels with ln = " << ln << std::endl; boost::shared_ptr level_( patch_hierarchy->getPatchLevel(ln)); gridding_algorithm->makeFinerLevel( - /* simulation time */ 0.0, - /* whether initial time */ true, - /* tag buffer size */ tag_buffer[ln]); + /* tag buffer size */ tag_buffer[ln], + /* whether initial cycle */ true, + /* simulation cycle */ 0, + /* simulation time */ 0.0); tbox::plog << "Just added finer level " << ln << " -> " << ln + 1; if (patch_hierarchy->getNumberOfLevels() < ln + 2) { tbox::plog << " (no new level!)" << std::endl; @@ -370,7 +365,7 @@ int main( for (int istep = 0; istep < num_steps; ++istep) { - tbox::plog << "Adaption number " << istep << std::endl; + tbox::pout << "Adaption number " << istep << std::endl; if (verbose > 0 && mpi.getRank() == 0) { tbox::pout << "Adaption number " << istep << std::endl; } @@ -379,15 +374,16 @@ int main( dlbgtest.computeHierarchyData(*patch_hierarchy, double(istep + 1)); - tbox::Array - regrid_start_time(patch_hierarchy->getMaxNumberOfLevels()); - for (int i = 0; i < regrid_start_time.size(); ++i) + std::vector regrid_start_time( + patch_hierarchy->getMaxNumberOfLevels()); + for (int i = 0; i < static_cast(regrid_start_time.size()); ++i) regrid_start_time[i] = istep; gridding_algorithm->regridAllFinerLevels( 0, - double(istep), tag_buffer, + istep, + double(istep), regrid_start_time); patch_hierarchy->recursivePrint(tbox::plog, std::string(" "), 1); @@ -457,8 +453,8 @@ static int createAndTestDLBG( const bool build_peer_edge = main_db.getBoolWithDefault("build_peer_edge", false); - const bool globalize_mapped_box_levels = - main_db.getBoolWithDefault("globalize_mapped_box_levels", false); + const bool globalize_box_levels = + main_db.getBoolWithDefault("globalize_box_levels", false); const int node_log_detail = main_db.getIntegerWithDefault("node_log_detail", -1); @@ -467,70 +463,65 @@ static int createAndTestDLBG( pout << "Generating boxgraph in parallel." << std::endl; - Connector* crse_connectors = NULL; - Connector* fine_connectors = NULL; - Connector* peer_connectors = NULL; + std::vector > crse_connectors; + std::vector > fine_connectors; + std::vector > peer_connectors; int ln; - tbox::Array mapped_box_levels( - patch_hierarchy.getNumberOfLevels(), BoxLevel(dim)); - if (build_peer_edge) { - peer_connectors = new Connector[patch_hierarchy.getNumberOfLevels()]; - } - if (build_cross_edge) { - crse_connectors = new Connector[patch_hierarchy.getNumberOfLevels()]; - fine_connectors = new Connector[patch_hierarchy.getNumberOfLevels()]; - } + std::vector > box_levels( + patch_hierarchy.getNumberOfLevels()); /* - * Set the mapped_box_level nodes. + * Set the box_level nodes. */ for (ln = 0; ln < patch_hierarchy.getNumberOfLevels(); ++ln) { boost::shared_ptr level_ptr( patch_hierarchy.getPatchLevel(ln)); PatchLevel& level = *level_ptr; - mapped_box_levels[ln] = *level.getBoxLevel(); + box_levels[ln].reset(new BoxLevel(*level.getBoxLevel())); plog << "****************************************\n"; - plog << "mapped_box_levels[" << ln << "]:\n"; + plog << "box_levels[" << ln << "]:\n"; plog << "****************************************\n"; - mapped_box_levels[ln].recursivePrint(plog, "", node_log_detail); - if (globalize_mapped_box_levels) { + box_levels[ln]->recursivePrint(plog, "", node_log_detail); + if (globalize_box_levels) { pout << "Globalizing BoxLevel " << ln << ".\n"; - mapped_box_levels[ln].setParallelState(BoxLevel::GLOBALIZED); + box_levels[ln]->setParallelState(BoxLevel::GLOBALIZED); } pout << "BoxLevel " << ln << " done.\n"; } /* - * Compute the cross edges by searching globalized node mapped_box_levels. + * Compute the cross edges by searching globalized node box_levels. */ hier::OverlapConnectorAlgorithm oca; if (build_cross_edge) { + crse_connectors.resize(patch_hierarchy.getNumberOfLevels()); + fine_connectors.resize(patch_hierarchy.getNumberOfLevels()); for (ln = 0; ln < patch_hierarchy.getNumberOfLevels(); ++ln) { boost::shared_ptr level_ptr( patch_hierarchy.getPatchLevel(ln)); PatchLevel& level = *level_ptr; if (ln < patch_hierarchy.getNumberOfLevels() - 1) { - fine_connectors[ln].setBase(mapped_box_levels[ln]); - fine_connectors[ln].setHead(mapped_box_levels[ln + 1]); - fine_connectors[ln].setWidth(IntVector(dim, 1), true); - oca.findOverlaps(fine_connectors[ln]); + oca.findOverlaps(fine_connectors[ln], + *box_levels[ln], + *box_levels[ln + 1], + IntVector::getOne(dim)); } if (ln > 0) { - crse_connectors[ln].setBase(mapped_box_levels[ln]); - crse_connectors[ln].setHead(mapped_box_levels[ln - 1]); - crse_connectors[ln].setWidth(level.getRatioToCoarserLevel(), true); - oca.findOverlaps(crse_connectors[ln]); + oca.findOverlaps(crse_connectors[ln], + *box_levels[ln], + *box_levels[ln - 1], + level.getRatioToCoarserLevel()); if (edge_log_detail >= 0) { plog << "****************************************\n"; plog << "fine_connectors[" << ln - 1 << "]:\n"; plog << "****************************************\n"; - fine_connectors[ln - 1].recursivePrint(plog, "", edge_log_detail); + fine_connectors[ln - 1]->recursivePrint(plog, "", edge_log_detail); plog << "****************************************\n"; plog << "crse_connectors[" << ln << "]:\n"; plog << "****************************************\n"; - crse_connectors[ln].recursivePrint(plog, "", edge_log_detail); + crse_connectors[ln]->recursivePrint(plog, "", edge_log_detail); } } } @@ -538,29 +529,28 @@ static int createAndTestDLBG( /* * Compute the peer edges. Use bridging operation centered on the coarse edge - * if available. Else, search globalized node mapped_box_levels. + * if available. Else, search globalized node box_levels. */ if (build_peer_edge) { for (ln = 0; ln < patch_hierarchy.getNumberOfLevels(); ++ln) { - peer_connectors[ln].setBase(mapped_box_levels[ln]); - peer_connectors[ln].setHead(mapped_box_levels[ln]); - peer_connectors[ln].setWidth(IntVector(dim, 1), true); if (build_cross_edge && ln > 0) { // plog << " Bridging for level " << ln << std::endl; oca.bridge( peer_connectors[ln], - crse_connectors[ln], - fine_connectors[ln - 1], - crse_connectors[ln], - fine_connectors[ln - 1]); + *crse_connectors[ln], + *fine_connectors[ln - 1], + false); } else { - oca.findOverlaps(peer_connectors[ln]); + oca.findOverlaps(peer_connectors[ln], + *box_levels[ln], + *box_levels[ln], + IntVector::getOne(dim)); } if (edge_log_detail >= 0) { plog << "****************************************\n"; plog << "peer_connectors[" << ln << "]:\n"; plog << "****************************************\n"; - peer_connectors[ln].recursivePrint(plog, "", edge_log_detail); + peer_connectors[ln]->recursivePrint(plog, "", edge_log_detail); } } } @@ -571,22 +561,22 @@ static int createAndTestDLBG( if (build_cross_edge) { for (ln = 0; ln < patch_hierarchy.getNumberOfLevels() - 1; ++ln) { - fine_connectors[ln].assertConsistencyWithBase(); + fine_connectors[ln]->assertConsistencyWithBase(); plog << "fine_connectors[" << ln << "] passed assertConsistencyWithBase().\n"; - fine_connectors[ln].assertConsistencyWithHead(); + fine_connectors[ln]->assertConsistencyWithHead(); plog << "fine_connectors[" << ln << "] passed assertConsistencyWithHead().\n"; - crse_connectors[ln + 1].assertConsistencyWithBase(); + crse_connectors[ln + 1]->assertConsistencyWithBase(); plog << "crse_connectors[" << ln + 1 << "] passed assertConsistencyWithBase().\n"; - crse_connectors[ln + 1].assertConsistencyWithHead(); + crse_connectors[ln + 1]->assertConsistencyWithHead(); plog << "crse_connectors[" << ln + 1 << "] passed assertConsistencyWithHead().\n"; - oca.assertOverlapCorrectness(fine_connectors[ln]); + fine_connectors[ln]->assertOverlapCorrectness(); plog << "fine_connectors[" << ln << "] passed assertOverlapCorrectness().\n"; - oca.assertOverlapCorrectness(crse_connectors[ln + 1]); + crse_connectors[ln + 1]->assertOverlapCorrectness(); plog << "crse_connectors[" << ln + 1 << "] passed assertOverlapCorrectness().\n"; } @@ -594,13 +584,13 @@ static int createAndTestDLBG( if (build_peer_edge) { for (ln = 0; ln < patch_hierarchy.getNumberOfLevels(); ++ln) { - peer_connectors[ln].assertConsistencyWithBase(); + peer_connectors[ln]->assertConsistencyWithBase(); plog << "peer_connectors[" << ln << "] passed assertConsistencyWithBase().\n"; - peer_connectors[ln].assertConsistencyWithHead(); + peer_connectors[ln]->assertConsistencyWithHead(); plog << "peer_connectors[" << ln << "] passed assertConsistencyWithHead().\n"; - oca.assertOverlapCorrectness(peer_connectors[ln]); + peer_connectors[ln]->assertOverlapCorrectness(); plog << "peer_connectors[" << ln << "] passed assertOverlapCorrectness().\n"; } @@ -613,11 +603,7 @@ static int createAndTestDLBG( << "=====================================================================\n"; patch_hierarchy.recursivePrint(plog, "", 2); - mapped_box_levels.clear(); - - if (crse_connectors) delete[] crse_connectors; - if (fine_connectors) delete[] fine_connectors; - if (peer_connectors) delete[] peer_connectors; + box_levels.clear(); return 0; } diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.2d.input b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.2d.input index 62da6637..5de5b396 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.2d.input @@ -3,64 +3,112 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for DLBG tests. * ************************************************************************/ Main { + // Dimension of problem. dim = 2 + + // If TRUE, computes and checks Connectors. check_dlbg_in_main = FALSE - which_br = 'n' - base_name = "front2d" + + // Base name of log file. + base_name = "front.2d" + + // Base name of visualization files. If not supplied, determined by + // base_name. + // vis_filename = "front.2d" + + // Name of log file(s). If not supplied, determined by base_name. + // log_filename = "front.2d.log" + + // If true log all nodes, otherwise only log node 0. log_all = TRUE + + // Time step frequency at which to plot. plot_step = 1 - check_graph = FALSE - // restart_write_dirname = "restart" - // time_nlbg_random_rmi = TRUE + + // If TRUE, perform recursivePrint on patch hierarchy. log_hierarchy = TRUE - num_steps = 100 - // num_steps = 1 + + // Number of time steps. + num_steps = 50 + + // build_cross_edge = TRUE + + // build_peer_edge = TRUE - globalize_node_sets = FALSE + + // Controls amount of logging info generated by each BoxLevel. A negative + // value means no info, 0 means minimal info, and anything > 0 means all + // info. node_log_detail = 2 + + // If TRUE, all BoxLevels are globalized prior to construction of Connectors. + globalize_box_levels = FALSE + + // Controls amount of logging info generatted by each Connector. A negative + // value means no info. Verbosity increase with the value. Maximum info + // is generated when value is > 1. edge_log_detail = 3 + + // Regridding tag buffer. tag_buffer = 1, 1, 1, 1, 1, 1, 1, 1 + + // If > 0 turns on more output. verbose = 0 } DLBGTest { + // Input for SinusoidalFrontGenerator. If anything other than sine_tagger is + // specified (or there is nothing) the SinusoidalFrontGenerator's defaults are + // used. See testlib/SinusoidalFrontGenerator for input parameter details. sine_tagger { - allocate_data = FALSE - period = 1 + // Period of tagging sinusoid. + period = 1.0, 1.0 + + // Amplitude of tagging sinusoid. amplitude = .3 + + // Front initial displacement. init_disp = -0.42, 0.0 - // init_disp = 0.50, 0.25 - velocity = 0.018, 0.005 + // init_disp = 0.5, 0.0 + + // Front velocity. + velocity = 0.015, 0.010 + + // Tagging buffer, in physical space units. + buffer_distance_0 = 0.2, 0.2 + buffer_distance_1 = 0.1, 0.1 + buffer_distance_2 = 0.05, 0.05 + buffer_distance_3 = 0.00, 0.00 } } +// Refer to mesh::BergerRigoutsos for input BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - // owner_mode = "FEWEST_OWNED" - owner_mode = "MOST_OVERLAP" - // owner_mode = "SINGLE_OWNER" - use_level_boxes = FALSE - use_private_communicator = TRUE - sequentialize_output_indices = FALSE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + // DEV_owner_mode = "FEWEST_OWNED" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "SINGLE_OWNER" max_box_size = 40, 40 - barrier_before_cluster = FALSE + efficiency_tolerance = 0.80 + combine_efficiency = 0.75 } +// Refer to geom::CartesianGeometry and its base clases for input CartesianGridGeometry { // domain_boxes = [(0,0), (3,3)] // domain_boxes = [(0,0), (15,31)] @@ -71,28 +119,29 @@ CartesianGridGeometry { periodic_dimension = 0, 0 } +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = -1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 4 proper_nesting_buffer = 2, 2, 2, 2, 2, 2 @@ -121,42 +170,22 @@ PatchHierarchy { allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE } +// Refer to mesh::GriddingAlgorithm for input GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.80 - combine_efficiency = 0.75 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "WARN" check_overlapping_patches = "WARN" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE check_overflow_nesting = FALSE check_proper_nesting = TRUE - check_connectors = FALSE - print_layer_hierarchy = FALSE - print_steps = FALSE + DEV_check_connectors = FALSE + DEV_print_steps = FALSE } - -GlobalInputs{ - tag_clustering_method = "BINARY_TREE" -} - - +// Refer to tbox::TimerManager for input TimerManager{ timer_list = "*::*::*" print_user = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.3d.input b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.3d.input index 60b6abc4..529837f2 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/front.3d.input @@ -3,26 +3,24 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for DLBG tests. * ************************************************************************/ +// Refer to front.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 check_dlbg_in_main = FALSE - which_br = 'n' - base_name = "front3d" + base_name = "front.3d" log_all = TRUE plot_step = 10 - check_graph = FALSE - // restart_write_dirname = "restart" - // time_nlbg_random_rmi = TRUE log_hierarchy = TRUE - num_steps = 100 + num_steps = 50 build_cross_edge = TRUE build_peer_edge = TRUE - globalize_node_sets = FALSE node_log_detail = 2 edge_log_detail = 3 tag_buffer = 1, 1, 1, 1, 1, 1, 1, 1 @@ -31,36 +29,42 @@ Main { DLBGTest { sine_tagger { - allocate_data = TRUE - period = 1 - amplitude = .3 - init_disp = -0.5, 0.0, 0.0 - velocity = 0.02, 0.005, 0.01 + period = 0.5, 2.0, 2.0 + amplitude = .25 + init_disp = 0.25, 0.0, 0.0 + init_time = 0.0 + velocity = 0.015, 0.010, 0.007 + + buffer_distance_0 = 0.0, 0.0, 0.0 + buffer_distance_1 = 0.0, 0.0, 0.0 + buffer_distance_2 = 0.0, 0.0, 0.0 + buffer_distance_3 = 0.0, 0.0, 0.0 } } BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - owner_mode = "MOST_OVERLAP" - // owner_mode = "SINGLE_OWNER" - use_level_boxes = FALSE - use_private_communicator = TRUE - sequentialize_output_indices = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "SINGLE_OWNER" + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 } CartesianGridGeometry { + // domain_boxes = [(0,0,0), (31,63,63)] + // domain_boxes = [(0,0,0), (15,31,31)] domain_boxes = [(0,0,0), (7,15,15)] - // domain_boxes = [(0,0,0), (9,3,3)] + // domain_boxes = [(0,0,0), (3,7,7)] x_lo = 0, 0, 0 - x_up = 1, 2, 2 + x_up = 0.25, 0.5, 0.5 } StandardTagAndInitialize { @@ -68,18 +72,17 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = -1 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } PatchHierarchy { @@ -111,33 +114,18 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE - combine_efficiency = 0.88 - efficiency_tolerance = 0.88 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" - allow_patches_smaller_than_ghostwidth = FALSE + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "WARN" check_overlapping_patches = "WARN" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - coalesce_boxes = FALSE check_overflow_nesting = FALSE check_proper_nesting = TRUE - check_connectors = FALSE - print_layer_hierarchy = FALSE - print_steps = FALSE -} - - -GlobalInputs{ - tag_clustering_method = "BINARY_TREE" + DEV_check_connectors = FALSE + DEV_print_steps = FALSE } - TimerManager{ timer_list = "*::*::*" print_user = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/periodic.2d.input b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/periodic.2d.input index 4dfdedee..1e722329 100644 --- a/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/periodic.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/dlbg/test_inputs/periodic.2d.input @@ -3,27 +3,25 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for DLBG tests. * ************************************************************************/ +// Refer to front.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 check_dlbg_in_main = FALSE - which_br = 'n' base_name = "periodic2d" log_all = TRUE plot_step = 1 - check_graph = FALSE - // restart_write_dirname = "restart" - // time_nlbg_random_rmi = TRUE log_hierarchy = TRUE - num_steps = 100 + num_steps = 50 // num_steps = 10 build_cross_edge = TRUE build_peer_edge = TRUE - globalize_node_sets = FALSE node_log_detail = 2 edge_log_detail = 3 // tag_buffer = 0, 0, 0, 0, 0, 0, 0, 0 @@ -32,32 +30,35 @@ Main { DLBGTest { sine_tagger { - allocate_data = FALSE - period = 1 + period = 1.0, 1.0 amplitude = .3 init_disp = -0.42, 0.0 // init_disp = -0.00, 0.25 - velocity = 0.018, 0.005 + velocity = 0.015, 0.010 + + // Tagging buffer, in physical space units. + buffer_distance_0 = 0.2, 0.2 + buffer_distance_1 = 0.1, 0.1 + buffer_distance_2 = 0.05, 0.05 + buffer_distance_3 = 0.00, 0.00 } } BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = TRUE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - // owner_mode = "FEWEST_OWNED" - owner_mode = "MOST_OVERLAP" - // owner_mode = "SINGLE_OWNER" - use_level_boxes = FALSE - use_private_communicator = TRUE - sequentialize_output_indices = FALSE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = TRUE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + // DEV_owner_mode = "FEWEST_OWNED" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "SINGLE_OWNER" max_box_size = 40, 40 - barrier_before_cluster = FALSE + efficiency_tolerance = 0.80 + combine_efficiency = 0.85 } @@ -83,21 +84,19 @@ StandardTagAndInitialize { } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = -1 - interlace_groups = FALSE - balance_penalty_wt = 0.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 0.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } PatchHierarchy { @@ -129,40 +128,18 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.80 - combine_efficiency = 0.85 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "WARN" check_overlapping_patches = "WARN" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE - coalesce_boxes = FALSE check_overflow_nesting = FALSE check_proper_nesting = FALSE - check_connectors = FALSE - print_layer_hierarchy = FALSE - print_steps = TRUE -} - - -GlobalInputs{ - tag_clustering_method = "BINARY_TREE" + DEV_check_connectors = FALSE + DEV_print_steps = TRUE } - TimerManager{ timer_list = "*::*::*" print_user = TRUE @@ -172,6 +149,6 @@ TimerManager{ print_max = TRUE } -OverlapConnectorUtil { - print_bridge_steps = 'n' +OverlapConnectorAlgorithm { + DEV_print_bridge_steps = 'n' } diff --git a/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.depend index 6d46a6d0..31e98561 100644 --- a/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -49,12 +49,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -84,7 +86,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SecondLayerNodeNoCornersVariableFillPattern.h\ $(INCLUDE_SAM)/SAMRAI/pdat/SecondLayerNodeVariableFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -98,8 +99,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -115,10 +116,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ main-fill-pattern.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -132,10 +133,9 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.in b/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.in index 59a0a875..2371b068 100644 --- a/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/fill_pattern/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the fill_pattern tests ## ######################################################################### -SAMRAI = @top_srcdir@ +SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ SUBDIR = source/test/fill_pattern -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DDISPLAY -DTESTING=1 @@ -24,6 +25,7 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main-fill-pattern.o @@ -32,8 +34,14 @@ main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(LIBSAMRAI) $(LDLIBS) -o $@ -check: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main +check: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -44,13 +52,26 @@ check3d: checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/fill_pattern/README b/base/SAMRAI/SAMRAI/source/test/fill_pattern/README new file mode 100644 index 00000000..402b9360 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/fill_pattern/README @@ -0,0 +1,28 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI fill patterns. +## +######################################################################### + +This is a unit test of SAMRAI's fill patterns. The files included in this +directory are as follows: + + main-fill-pattern.C - unit tester + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/fill_pattern/main-fill-pattern.C b/base/SAMRAI/SAMRAI/source/test/fill_pattern/main-fill-pattern.C index 1bfd685e..5a74c0e5 100644 --- a/base/SAMRAI/SAMRAI/source/test/fill_pattern/main-fill-pattern.C +++ b/base/SAMRAI/SAMRAI/source/test/fill_pattern/main-fill-pattern.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * ************************************************************************/ @@ -52,7 +52,7 @@ void txt2boxes( // translate coordinates into cell-centered, lower-left origin based int width = -1; - for (unsigned int idx = 0; idx < strlen(txt) - 1; idx++) { + for (unsigned int idx = 0; idx < strlen(txt) - 1; ++idx) { if (('x' == txt[idx] || '.' == txt[idx]) && ('.' == txt[idx + 1] || '|' == txt[idx + 1])) { width = idx + 1; @@ -72,7 +72,7 @@ void txt2boxes( // make vector of x locations vector > ix; - for (unsigned int idx = 0; idx < strlen(txt); idx++) { + for (unsigned int idx = 0; idx < strlen(txt); ++idx) { if ('x' == txt[idx]) { int j = idx / width; int i = idx - j * width; @@ -82,7 +82,7 @@ void txt2boxes( // foreach x1 in x vector >::iterator it; - for (it = ix.begin(); it != ix.end(); it++) { + for (it = ix.begin(); it != ix.end(); ++it) { vector >::iterator it2; @@ -92,7 +92,7 @@ void txt2boxes( vector boxes_here; boxes_here.clear(); - for (it2 = ix.begin(); it2 != ix.end(); it2++) { + for (it2 = ix.begin(); it2 != ix.end(); ++it2) { if (it2->first > it->first && it2->second > it->second) { @@ -111,8 +111,8 @@ void txt2boxes( if (txt[idx2] != 'x') isbox = false; // ...interior cells contain no corners - for (int i = it->first + 1; i < it2->first; i++) { - for (int j = it->second + 1; j < it2->second; j++) { + for (int i = it->first + 1; i < it2->first; ++i) { + for (int j = it->second + 1; j < it2->second; ++j) { int idx = j * width + i; if ('x' == txt[idx]) isbox = false; if ('-' == txt[idx]) isbox = false; @@ -128,8 +128,8 @@ void txt2boxes( int j0 = it->second / 2; j1 = it2->second / 2; - i1--; - j1--; + --i1; + --j1; // Flip coordinates vertically. j0 = cell_max - j0; @@ -141,7 +141,7 @@ void txt2boxes( j0 = tmp; hier::Box abox(hier::Index(i0, j0), - hier::Index(i1, j1), + hier::Index(i1, j1), hier::BlockId(0)); boxes_here.push_back(abox); } @@ -154,7 +154,7 @@ void txt2boxes( hier::Box smallest_box(boxes_here[0]); for (vector::iterator itb = boxes_here.begin(); - itb != boxes_here.end(); itb++) { + itb != boxes_here.end(); ++itb) { if ((*itb).numberCells() < smallest_box.numberCells()) { smallest_box = *itb; } @@ -166,7 +166,8 @@ void txt2boxes( } // Shift all boxes into SAMRAI coordinates - for (hier::BoxContainer::iterator itr(boxes); itr != boxes.end(); ++itr) { + for (hier::BoxContainer::iterator itr = boxes.begin(); + itr != boxes.end(); ++itr) { itr->shift(-hier::IntVector(tbox::Dimension(2), 2)); } } @@ -175,7 +176,7 @@ int txt_width( const char* txt) { int width = -1; - for (unsigned int idx = 0; idx < strlen(txt) - 1; idx++) { + for (unsigned int idx = 0; idx < strlen(txt) - 1; ++idx) { if (('x' == txt[idx] || '.' == txt[idx]) && ('.' == txt[idx + 1] || '|' == txt[idx + 1])) { width = idx + 1; @@ -236,11 +237,11 @@ bool txt_next_val( // If we outside the grid, there cannot be a value here if (grid_i < 0 || grid_j < 0) { - idx++; + ++idx; continue; } if (grid_i > grid_width || grid_j > grid_height) { - idx++; + ++idx; continue; } // Translate grid coords to text coordinates. Text coordinates @@ -285,7 +286,7 @@ bool txt_next_val( return true; } - idx++; // advance to next domain idx + ++idx; // advance to next domain idx } while (cnt++ < cnt_max); @@ -294,6 +295,7 @@ bool txt_next_val( << __FILE__ << endl; exit(1); + return false; } void txt2data( @@ -332,28 +334,21 @@ bool SingleLevelTestCase( hier::BoxContainer level_boxes; txt2boxes(levelboxes_txt, level_boxes); - hier::BoxContainer domain_boxes; - hier::LocalId domain_id(0); - for (hier::BoxContainer::iterator itr(level_boxes); - itr != level_boxes.end(); ++itr) { - domain_boxes.pushBack(hier::Box(*itr, domain_id++, 0)); - } - boost::shared_ptr geom( new geom::GridGeometry( "GridGeometry", - domain_boxes)); + level_boxes)); boost::shared_ptr hierarchy( new hier::PatchHierarchy("hier", geom)); - hier::BoxLevel mblevel(hier::IntVector(dim, 1), geom); + boost::shared_ptr mblevel( + boost::make_shared(hier::IntVector(dim, 1), geom)); const int num_nodes = mpi.getSize(); const int num_boxes = level_boxes.size(); hier::LocalId local_id(0); - tbox::Array local_indices(mpi.getSize(), 0); - hier::BoxContainer::iterator level_boxes_itr(level_boxes); + hier::BoxContainer::iterator level_boxes_itr = level_boxes.begin(); for (int i = 0; i < num_boxes; ++i, ++level_boxes_itr) { int proc; @@ -364,8 +359,8 @@ bool SingleLevelTestCase( } if (proc == mpi.getRank()) { - mblevel.addBox(hier::Box(*level_boxes_itr, local_id, proc)); - local_id++; + mblevel->addBox(hier::Box(*level_boxes_itr, local_id, proc)); + ++local_id; } } @@ -377,7 +372,7 @@ bool SingleLevelTestCase( // There is one variable-context pair with a gcw of 2 - xfer::RefineAlgorithm refine_alg(dim); + xfer::RefineAlgorithm refine_alg; boost::shared_ptr context( hier::VariableDatabase::getDatabase()->getContext("CONTEXT")); @@ -394,8 +389,6 @@ bool SingleLevelTestCase( level->allocatePatchData(data_id); - TBOX_ASSERT(mpi.getSize() <= 2); - if (pattern_name == "FIRST_LAYER_CELL_NO_CORNERS_FILL_PATTERN" || pattern_name == "FIRST_LAYER_CELL_FILL_PATTERN") { // Loop over each patch and initialize data @@ -403,8 +396,9 @@ bool SingleLevelTestCase( p != level->end(); ++p) { const boost::shared_ptr& patch(*p); boost::shared_ptr > cdata( - patch->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data_id))); + TBOX_ASSERT(cdata); int data_txt_id = patch->getBox().getLocalId().getValue(); if (mpi.getRank() == 1) { @@ -421,8 +415,9 @@ bool SingleLevelTestCase( p != level->end(); ++p) { const boost::shared_ptr& patch(*p); boost::shared_ptr > ndata( - patch->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data_id))); + TBOX_ASSERT(ndata); int data_txt_id = patch->getBox().getLocalId().getValue(); if (mpi.getRank() == 1) { @@ -435,10 +430,9 @@ bool SingleLevelTestCase( } // Cache Connector required for the schedule generation. - level->getBoxLevel()->getPersistentOverlapConnectors(). - findOrCreateConnector( - *(level->getBoxLevel()), - hier::IntVector(dim, 2)); + level->findConnector(*level, + hier::IntVector(dim, 2), + hier::CONNECTOR_CREATE); // Create and run comm schedule refine_alg.createSchedule(level)->fillData(0.0, false); @@ -452,8 +446,9 @@ bool SingleLevelTestCase( p != level->end(); ++p) { const boost::shared_ptr& patch(*p); boost::shared_ptr > cdata( - patch->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data_id))); + TBOX_ASSERT(cdata); pdat::CellData expected(cdata->getBox(), cdata->getDepth(), @@ -467,8 +462,8 @@ bool SingleLevelTestCase( txt2data(finaldata_txt[data_txt_id], expected, expected.getPointer(), false, false); - pdat::CellData::iterator ciend(cdata->getGhostBox(), false); - for (pdat::CellData::iterator ci(cdata->getGhostBox(), true); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(cdata->getGhostBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(cdata->getGhostBox())); ci != ciend; ++ci) { if ((*cdata)(*ci) != expected(*ci)) { failed = true; @@ -482,8 +477,9 @@ bool SingleLevelTestCase( p != level->end(); ++p) { const boost::shared_ptr& patch(*p); boost::shared_ptr > ndata( - patch->getPatchData(data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(data_id))); + TBOX_ASSERT(ndata); pdat::NodeData expected(ndata->getBox(), ndata->getDepth(), @@ -497,8 +493,8 @@ bool SingleLevelTestCase( txt2data(finaldata_txt[data_txt_id], expected, expected.getPointer(), false, true); - pdat::NodeData::iterator niend(ndata->getGhostBox(), false); - for (pdat::NodeData::iterator ni(ndata->getGhostBox(), true); + pdat::NodeData::iterator niend(pdat::NodeGeometry::end(ndata->getGhostBox())); + for (pdat::NodeData::iterator ni(pdat::NodeGeometry::begin(ndata->getGhostBox())); ni != niend; ++ni) { if ((*ndata)(*ni) != expected(*ni)) { failed = true; @@ -1033,9 +1029,9 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." + ". . 0 . 0 . 0 . 0 . 8 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." + ". . 0 . 0 . 0 . 8 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 4 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 3 @@ -1061,9 +1057,9 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 1 . 8 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 1 . 1 . 8 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 4 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 3 @@ -1091,9 +1087,9 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 6 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." + ". . 2 . 2 . 2 . 8 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." + ". . 2 . 2 . 2 . 2 . 8 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 3 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1119,9 +1115,9 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 6 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 3 . 3 . 8 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 3 . 8 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 3 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 2 @@ -1143,11 +1139,11 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." + ". . 0 . 0 . 0 . 0 . 8 . 1 . 0 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." + ". . 0 . 0 . 0 . 8 . 0 . 8 . 0 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 0 . 0 . 2 . 2 . 2 . 0 . 0 . . . . . ." + ". . 0 . 0 . 2 . 2 . 8 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 3 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1171,11 +1167,11 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 0 . 8 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 8 . 1 . 8 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 1 . 1 . 3 . 3 . 3 . 1 . 1 . ." + ". . . . . . 1 . 1 . 8 . 3 . 3 . 1 . 1 . ." ". . . . . . . . . . ." // 3 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 2 @@ -1199,11 +1195,11 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 2 . 2 . 0 . 0 . 0 . 2 . 2 . . . . . ." + ". . 2 . 2 . 0 . 0 . 8 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." + ". . 2 . 2 . 2 . 8 . 2 . 8 . 2 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." + ". . 2 . 2 . 2 . 2 . 8 . 3 . 2 . . . . . ." ". . . . . . . . . . ." // 3 ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1227,11 +1223,11 @@ bool Test_SecondLayerNodeNoCornersVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 3 . 3 . 1 . 1 . 1 . 3 . 3 . ." + ". . . . . . 3 . 3 . 8 . 1 . 1 . 3 . 3 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 8 . 3 . 8 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 2 . 8 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 3 ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 2 @@ -1307,9 +1303,9 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." + ". . 0 . 0 . 0 . 0 . 8 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." + ". . 0 . 0 . 0 . 8 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 4 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 3 @@ -1335,9 +1331,9 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 1 . 8 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 1 . 1 . 8 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 4 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 3 @@ -1365,9 +1361,9 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 6 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." + ". . 2 . 2 . 2 . 8 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." + ". . 2 . 2 . 2 . 2 . 8 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 3 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1393,9 +1389,9 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 6 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 3 . 3 . 8 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 3 . 8 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 3 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 2 @@ -1417,11 +1413,11 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." + ". . 0 . 0 . 0 . 0 . 8 . 1 . 0 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 0 . 0 . 0 . 0 . 0 . 1 . 0 . . . . . ." + ". . 0 . 0 . 0 . 8 . 0 . 8 . 0 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 0 . 0 . 2 . 2 . 2 . 3 . 0 . . . . . ." + ". . 0 . 0 . 2 . 2 . 8 . 3 . 0 . . . . . ." ". . . . . . . . . . ." // 3 ". . 0 . 0 . 0 . 0 . 0 . 0 . 0 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1445,11 +1441,11 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 0 . 8 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 1 . 0 . 1 . 1 . 1 . 1 . 1 . ." + ". . . . . . 1 . 8 . 1 . 8 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 1 . 2 . 3 . 3 . 3 . 1 . 1 . ." + ". . . . . . 1 . 2 . 8 . 3 . 3 . 1 . 1 . ." ". . . . . . . . . . ." // 3 ". . . . . . 1 . 1 . 1 . 1 . 1 . 1 . 1 . ." ". . . . . . . . . . ." // 2 @@ -1473,11 +1469,11 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . 2 . 2 . 2 . 2 . 2 . 2 . 2 . . . . . ." ". . . . . . . . . . ." // 6 - ". . 2 . 2 . 0 . 0 . 0 . 1 . 2 . . . . . ." + ". . 2 . 2 . 0 . 0 . 8 . 1 . 2 . . . . . ." ". . . . . . . . . . ." // 5 - ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." + ". . 2 . 2 . 2 . 8 . 2 . 8 . 2 . . . . . ." ". . . . . . . . . . ." // 4 - ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." + ". . 2 . 2 . 2 . 2 . 8 . 3 . 2 . . . . . ." ". . . . . . . . . . ." // 3 ". . 2 . 2 . 2 . 2 . 2 . 3 . 2 . . . . . ." ". . . . . . . . . . ." // 2 @@ -1501,11 +1497,11 @@ bool Test_SecondLayerNodeVariableFillPattern() ". . . . . . . . . . ." // 7 ". . . . . . 3 . 3 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 6 - ". . . . . . 3 . 0 . 1 . 1 . 1 . 3 . 3 . ." + ". . . . . . 3 . 0 . 8 . 1 . 1 . 3 . 3 . ." ". . . . . . . . . . ." // 5 - ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 8 . 3 . 8 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 4 - ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." + ". . . . . . 3 . 2 . 8 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 3 ". . . . . . 3 . 2 . 3 . 3 . 3 . 3 . 3 . ." ". . . . . . . . . . ." // 2 diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.C b/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.C index 846a5280..a6adac0b 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.C +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch hierarchy refine/coarsen tests. * ************************************************************************/ @@ -20,6 +20,7 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/hier/PatchGeometry.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" using namespace geom; @@ -39,12 +40,12 @@ HierarchyTester::HierarchyTester( const tbox::Dimension& dim, boost::shared_ptr hier_test_db): d_dim(dim), - d_ratio(dim, 0) + d_ratio(hier::IntVector::getZero(dim)) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(hier_test_db); -#endif + + hier::PersistentOverlapConnectors::setCreateEmptyNeighborContainers(true); d_object_name = object_name; @@ -56,9 +57,10 @@ HierarchyTester::HierarchyTester( if (d_do_refine_test) { tbox::plog << "\nPerforming hierarchy refine test..." << std::endl; if (hier_test_db->keyExists("ratio")) { - int* tmp_ratio = &d_ratio[0]; - hier_test_db->getIntegerArray("ratio", tmp_ratio, d_dim.getValue()); - tbox::plog << "with ratio = " << d_ratio << std::endl; + std::vector tmp_ratio = + hier_test_db->getIntegerVector("ratio"); + tbox::plog << "with ratio = " << hier::IntVector(tmp_ratio) << std::endl; + d_ratio.setAll(hier::IntVector(tmp_ratio)); } else { TBOX_ERROR( "HierarchyTester input error: no 'ratio' found in input" @@ -74,9 +76,10 @@ HierarchyTester::HierarchyTester( if (d_do_coarsen_test) { tbox::plog << "\nPerforming hierarchy coarsen test..." << std::endl; if (hier_test_db->keyExists("ratio")) { - int* tmp_ratio = &d_ratio[0]; - hier_test_db->getIntegerArray("ratio", tmp_ratio, d_dim.getValue()); - tbox::plog << "with ratio = " << d_ratio << std::endl; + std::vector tmp_ratio = + hier_test_db->getIntegerVector("ratio"); + tbox::plog << "with ratio = " << hier::IntVector(tmp_ratio) << std::endl; + d_ratio.setAll(hier::IntVector(tmp_ratio)); } else { TBOX_ERROR( "HierarchyTester input error: no 'ratio' found in input" @@ -108,9 +111,8 @@ HierarchyTester::~HierarchyTester() void HierarchyTester::setupInitialHierarchy( boost::shared_ptr main_input_db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif + boost::shared_ptr grid_geometry( new CartesianGridGeometry( d_dim, @@ -122,8 +124,9 @@ void HierarchyTester::setupInitialHierarchy( grid_geometry, main_input_db->getDatabase("PatchHierarchy"))); - boost::shared_ptr box_generator( - new BergerRigoutsos(d_dim)); + boost::shared_ptr box_generator(new BergerRigoutsos( + d_dim, + main_input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new TreeLoadBalancer( @@ -134,7 +137,6 @@ void HierarchyTester::setupInitialHierarchy( boost::shared_ptr dummy_error_detector( new StandardTagAndInitialize( - d_dim, "StandardTagAndInitialize", this, main_input_db->getDatabase("StandardTagAndInitialize"))); @@ -150,11 +152,12 @@ void HierarchyTester::setupInitialHierarchy( d_gridding_algorithm->makeCoarsestLevel( 0.0); // dummy time - for (int ln = 0; d_initial_patch_hierarchy->levelCanBeRefined(ln); ln++) { + for (int ln = 0; d_initial_patch_hierarchy->levelCanBeRefined(ln); ++ln) { d_gridding_algorithm->makeFinerLevel( - 0.0, // dummy time - true, // indicates initial time - 0); // dummy tag buffer + 0, // dummy tag buffer + true, // indicates initial cycle + 0, // dummy cycle + 0.0); // dummy time } @@ -172,16 +175,14 @@ int HierarchyTester::runHierarchyTestAndVerify() d_test_patch_hierarchy = d_initial_patch_hierarchy->makeRefinedPatchHierarchy( "FinePatchHierarchy", - d_ratio, - false); + d_ratio); } if (d_do_coarsen_test) { d_test_patch_hierarchy = d_initial_patch_hierarchy->makeCoarsenedPatchHierarchy( "CoarsePatchHierarchy", - d_ratio, - false); + d_ratio); } /* @@ -195,12 +196,12 @@ int HierarchyTester::runHierarchyTestAndVerify() boost::shared_ptr test_geometry( d_test_patch_hierarchy->getGridGeometry()); - hier::IntVector one_vector(d_dim, 1); + const hier::IntVector& one_vector(hier::IntVector::getOne(d_dim)); // Test #0a: - if (init_geometry->getPeriodicShift(one_vector) != + if (init_geometry->getPeriodicShift(d_do_refine_test ? d_ratio : -d_ratio) != test_geometry->getPeriodicShift(one_vector)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #0a: initial hierarchy has periodic shift " << init_geometry->getPeriodicShift(one_vector) << " and \n" << "test hierarchy has periodic shift " @@ -212,13 +213,15 @@ int HierarchyTester::runHierarchyTestAndVerify() const int npdboxes = init_phys_domain.size(); + const hier::IntVector& block_ratio = d_ratio.getBlockVector(BlockId(0)); + // Test #0b: - hier::BoxContainer::const_iterator ipditr(init_phys_domain); - hier::BoxContainer::const_iterator tpditr(test_phys_domain); + hier::BoxContainer::const_iterator ipditr = init_phys_domain.begin(); + hier::BoxContainer::const_iterator tpditr = test_phys_domain.begin(); if (d_do_refine_test) { - for (int ib = 0; ib < npdboxes; ib++, ++ipditr, ++tpditr) { - if (!Box::refine(*ipditr, d_ratio).isSpatiallyEqual(*tpditr)) { - fail_count++; + for (int ib = 0; ib < npdboxes; ++ib, ++ipditr, ++tpditr) { + if (!Box::refine(*ipditr, block_ratio).isSpatiallyEqual(*tpditr)) { + ++fail_count; tbox::perr << "FAILED: - Test #0b: test hierarchy physical domain" << " box with array index " << ib << " is not a proper refinement of initial hierarchy" @@ -227,9 +230,9 @@ int HierarchyTester::runHierarchyTestAndVerify() } } if (d_do_coarsen_test) { - for (int ib = 0; ib < npdboxes; ib++, ++ipditr, ++tpditr) { - if (!Box::coarsen(*ipditr, d_ratio).isSpatiallyEqual(*tpditr)) { - fail_count++; + for (int ib = 0; ib < npdboxes; ++ib, ++ipditr, ++tpditr) { + if (!Box::coarsen(*ipditr, block_ratio).isSpatiallyEqual(*tpditr)) { + ++fail_count; tbox::perr << "FAILED: - Test #0b: test hierarchy physical domain" << " box with array index " << ib << " is not a proper coarsening of initial hierarchy" @@ -241,7 +244,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #0c: if (init_geometry->getDomainIsSingleBox(BlockId(0)) != test_geometry->getDomainIsSingleBox(BlockId(0))) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #0c: initial and test hierarchy do not match" << " for geom->getDomainIsSingleBox()" << std::endl; @@ -257,7 +260,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #1: if (d_test_patch_hierarchy->getNumberOfLevels() != nlevels) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1: initial hierarchy has " << nlevels << " levels and \n" << "test hierarchy has " @@ -265,7 +268,7 @@ int HierarchyTester::runHierarchyTestAndVerify() << std::endl; } - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr init_level( d_initial_patch_hierarchy->getPatchLevel(ln)); boost::shared_ptr test_level( @@ -274,7 +277,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #2: if (init_level->getLevelNumber() != test_level->getLevelNumber()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2: for level number " << ln << " initial hierarchy level number is " << init_level->getLevelNumber() @@ -285,7 +288,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #3: if (init_level->getNextCoarserHierarchyLevelNumber() != test_level->getNextCoarserHierarchyLevelNumber()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3: for level number " << ln << " initial hierarchy next coarser level number is " << init_level->getNextCoarserHierarchyLevelNumber() @@ -297,7 +300,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #4: if (init_level->inHierarchy() != test_level->inHierarchy()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4: for level number " << ln << " initial hierarchy level in hierarchy is " << init_level->inHierarchy() @@ -308,7 +311,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #5: if (init_level->getGlobalNumberOfPatches() != test_level->getGlobalNumberOfPatches()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5: for level number " << ln << " initial hierarchy number of patches is " << init_level->getGlobalNumberOfPatches() @@ -319,7 +322,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #6: if (init_level->getRatioToLevelZero() != test_level->getRatioToLevelZero()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6: for level number " << ln << " initial hierarchy ratio to level zero is " << init_level->getRatioToLevelZero() @@ -330,7 +333,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #7: if (init_level->getRatioToCoarserLevel() != test_level->getRatioToCoarserLevel()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7: for level number " << ln << " initial hierarchy ratio to coarser level is " << init_level->getRatioToCoarserLevel() @@ -344,12 +347,12 @@ int HierarchyTester::runHierarchyTestAndVerify() const int nboxes = init_domain.size(); // Test #8: - hier::BoxContainer::const_iterator iditr(init_domain); - hier::BoxContainer::const_iterator tditr(test_domain); + hier::BoxContainer::const_iterator iditr = init_domain.begin(); + hier::BoxContainer::const_iterator tditr = test_domain.begin(); if (d_do_refine_test) { - for (int ib = 0; ib < nboxes; ib++, ++iditr, ++tditr) { - if (!Box::refine(*iditr, d_ratio).isSpatiallyEqual(*tditr)) { - fail_count++; + for (int ib = 0; ib < nboxes; ++ib, ++iditr, ++tditr) { + if (!Box::refine(*iditr, block_ratio).isSpatiallyEqual(*tditr)) { + ++fail_count; tbox::perr << "FAILED: - Test #8: for level number " << ln << " refined domain box with array index " << ib << " is not a proper refinement of initial domain " @@ -358,9 +361,9 @@ int HierarchyTester::runHierarchyTestAndVerify() } } if (d_do_coarsen_test) { - for (int ib = 0; ib < nboxes; ib++, ++iditr, ++tditr) { - if (!Box::coarsen(*iditr, d_ratio).isSpatiallyEqual(*tditr)) { - fail_count++; + for (int ib = 0; ib < nboxes; ++ib, ++iditr, ++tditr) { + if (!Box::coarsen(*iditr, block_ratio).isSpatiallyEqual(*tditr)) { + ++fail_count; tbox::perr << "FAILED: - Test #8: for level number " << ln << " coarsened domain box with array index " << ib << " is not a proper coarsening of initial domain " @@ -385,67 +388,69 @@ int HierarchyTester::runHierarchyTestAndVerify() init_connector_width = test_connector_width * d_ratio; } const Connector& init_connector = - init_level->getBoxLevel()->getPersistentOverlapConnectors().findOrCreateConnector( + init_level->getBoxLevel()->findConnector( d_initial_patch_hierarchy->getDomainBoxLevel(), init_connector_width, + hier::CONNECTOR_CREATE, true /* exact width only */); const Connector& test_connector = - test_level->getBoxLevel()->getPersistentOverlapConnectors().findConnector( + test_level->getBoxLevel()->findConnector( d_test_patch_hierarchy->getDomainBoxLevel(), test_connector_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE, true /* exact width only */); for (hier::PatchLevel::iterator ip(test_level->begin()); ip != test_level->end(); ++ip) { - const BoxId& mapped_box_id = ip->getBox().getId(); + const BoxId& box_id = ip->getBox().getBoxId(); // Test #9: if (d_do_refine_test) { - if (!Box::refine(init_level->getBoxForPatch(mapped_box_id), - d_ratio).isSpatiallyEqual(test_level->getBoxForPatch(mapped_box_id))) { - fail_count++; + if (!Box::refine(init_level->getBoxForPatch(box_id), + block_ratio).isSpatiallyEqual(test_level->getBoxForPatch(box_id))) { + ++fail_count; tbox::perr << "FAILED: - Test #9: for level number " << ln - << " refined patch box with array index " << mapped_box_id + << " refined patch box with array index " << box_id << " is not a proper refinement of initial domain " << "box with same index" << std::endl; } } if (d_do_coarsen_test) { - if (!Box::coarsen(init_level->getBoxForPatch(mapped_box_id), d_ratio).isSpatiallyEqual( - test_level->getBoxForPatch(mapped_box_id))) { - fail_count++; + if (!Box::coarsen(init_level->getBoxForPatch(box_id), block_ratio).isSpatiallyEqual( + test_level->getBoxForPatch(box_id))) { + ++fail_count; tbox::perr << "FAILED: - Test #9: for level number " << ln - << " coarsened patch box with array index " << mapped_box_id + << " coarsened patch box with array index " << box_id << " is not a proper coarsening of initial domain " << "box with same index" << std::endl; } } // Test #10: - if (!init_connector.neighborhoodEqual(mapped_box_id, test_connector)) { - fail_count++; + if (!init_connector.neighborhoodEqual(box_id, test_connector)) { + ++fail_count; tbox::perr << "FAILED: - Test #10: for level number " << ln << " initial and test level have different number of " - << "domain neighbors for patch number " << mapped_box_id << std::endl; + << "domain neighbors for patch number " << box_id << std::endl; } // Test #11: - if (init_level->getMappingForPatch(mapped_box_id) != - test_level->getMappingForPatch(mapped_box_id)) { - fail_count++; + if (init_level->getMappingForPatch(box_id) != + test_level->getMappingForPatch(box_id)) { + ++fail_count; tbox::perr << "FAILED: - Test #11: for level number " << ln << " initial and test level have different processor " - << "mapping for patch number " << mapped_box_id << std::endl; + << "mapping for patch number " << box_id << std::endl; } // Test #12: - if (init_level->patchTouchesRegularBoundary(mapped_box_id) != - test_level->patchTouchesRegularBoundary(mapped_box_id)) { - fail_count++; + if (init_level->patchTouchesRegularBoundary(box_id) != + test_level->patchTouchesRegularBoundary(box_id)) { + ++fail_count; tbox::perr << "FAILED: - Test #12: for level number " << ln << " initial and test level do not match for " << "patchTouchesRegularBoundary() " - << "for patch number " << mapped_box_id << std::endl; + << "for patch number " << box_id << std::endl; } } @@ -456,30 +461,30 @@ int HierarchyTester::runHierarchyTestAndVerify() */ for (PatchLevel::iterator tip(test_level->begin()); tip != test_level->end(); ++tip) { - const BoxId& mapped_box_id = tip->getBox().getId(); + const BoxId& box_id = tip->getBox().getBoxId(); boost::shared_ptr test_patch( - test_level->getPatch(mapped_box_id)); + test_level->getPatch(box_id)); boost::shared_ptr init_patch( - init_level->getPatch(mapped_box_id)); + init_level->getPatch(box_id)); // Test #13: if (d_do_refine_test) { - if (!Box::refine(init_patch->getBox(), d_ratio).isSpatiallyEqual( + if (!Box::refine(init_patch->getBox(), block_ratio).isSpatiallyEqual( test_patch->getBox())) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #13: for level number " << ln - << " box for test level patch " << mapped_box_id + << " box for test level patch " << box_id << " is not a proper refinement of box " << "for initial level patch with same number" << std::endl; } } if (d_do_coarsen_test) { - if (!Box::coarsen(init_patch->getBox(), d_ratio).isSpatiallyEqual( + if (!Box::coarsen(init_patch->getBox(), block_ratio).isSpatiallyEqual( test_patch->getBox())) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #13: for level number " << ln - << " box for test level patch " << mapped_box_id + << " box for test level patch " << box_id << " is not a proper coarsening of box " << "for initial level patch with same number" << std::endl; @@ -489,7 +494,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #14: if (init_patch->getLocalId() != test_patch->getLocalId()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #14: for level number " << ln << " initial and test level patches have different patch " << "numbers for patch with index " << tip->getLocalId() << std::endl; @@ -498,7 +503,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #15: if (init_patch->getPatchLevelNumber() != test_patch->getPatchLevelNumber()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #15: for level number " << ln << " initial and test level patches have different patch " << "level numbers for patch number " << tip->getLocalId() @@ -508,7 +513,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #16: if (init_patch->inHierarchy() != test_patch->inHierarchy()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #16: for level number " << ln << " initial and test level do not match for " << "inHierarchy() " @@ -518,7 +523,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #17: if (init_patch->getPatchGeometry()->getTouchesRegularBoundary() != test_patch->getPatchGeometry()->getTouchesRegularBoundary()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #17: for level number " << ln << " initial and test level do not match for " << "getTouchesRegularBoundary() " @@ -539,7 +544,7 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #18a: if (init_patch_geom->getRatio() != test_patch_geom->getRatio()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #18a: for level number " << ln << " patch geometry ratio data does not match " << "for patch number " << tip->getLocalId() << std::endl; @@ -548,17 +553,17 @@ int HierarchyTester::runHierarchyTestAndVerify() // Test #18b: if (init_patch_geom->intersectsPhysicalBoundary() != test_patch_geom->intersectsPhysicalBoundary()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #18b: for level number " << ln << " intersectsPhysicalBoundary() does not match " << "for patch number " << tip->getLocalId() << std::endl; } // Test #18c: - for (int id = 1; id <= d_dim.getValue(); id++) { - if ((init_patch_geom->getCodimensionBoundaries(id)).getSize() != - (test_patch_geom->getCodimensionBoundaries(id)).getSize()) { - fail_count++; + for (int id = 1; id <= d_dim.getValue(); ++id) { + if ((init_patch_geom->getCodimensionBoundaries(id)).size() != + (test_patch_geom->getCodimensionBoundaries(id)).size()) { + ++fail_count; tbox::perr << "FAILED: - Test #18c: for level number " << ln << " number of codimension " << id << " boundary boxes does not match " diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.h b/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.h index 8236b25e..5bde242a 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.h +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/HierarchyTester.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch hierarchy refine/coarsen tests. * ************************************************************************/ @@ -21,7 +21,7 @@ #include "SAMRAI/tbox/Dimension.h" #include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include +#include "boost/shared_ptr.hpp" #ifndef included_tbox_String #include diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.depend index 1bca05b5..4e9890e4 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -16,6 +16,7 @@ DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -25,6 +26,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -36,7 +38,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -48,18 +53,17 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -67,11 +71,12 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -85,12 +90,12 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -100,9 +105,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -120,13 +126,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ HierarchyTester.C HierarchyTester.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -134,16 +138,16 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -153,6 +157,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -164,7 +169,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -176,12 +184,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -205,7 +215,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -222,9 +231,9 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -242,10 +251,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ HierarchyTester.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -254,127 +263,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=tbox_Pointer-HierarchyTester.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - HierarchyTester.h tbox_Pointer-HierarchyTester.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.in b/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.in index 85d8945a..db08aa7d 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI patch hierarchy refine/coarsen tests ## ######################################################################### @@ -14,19 +14,20 @@ SUBDIR = source/test/hierarchy VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 -NUM_TESTS = 4 +NUM_TESTS = 6 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = HierarchyTester.o \ - tbox_Pointer-HierarchyTester.o \ main.o main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) @@ -35,15 +36,25 @@ main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check: $(MAKE) check2d @@ -52,15 +63,26 @@ check: checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: clean-check +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/README b/base/SAMRAI/SAMRAI/source/test/hierarchy/README new file mode 100644 index 00000000..1bc7973a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/README @@ -0,0 +1,43 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI::hier::PatchHierarchy::make(Coarsened, +## Refined)PatchHierarchy +## +######################################################################### + +This is a unit test of 2 methods in SAMRAI::hier::PatchHierarchy, +makeCoarsenedPatchHierarchy and makeRefinedPatchHierarchy. The files included +in this directory are as follows: + + main.C - driver + HierarchyTester.[Ch] - unit tester + test_inputs/*.input - 2d and 3d input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files: + test_inputs/hierarchy_coarsen.2d.input + test_inputs/hierarchy_coarsen.3d.input + test_inputs/hierarchy_refine.2d.input + test_inputs/hierarchy_refine.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/hierarchy_coarsen.2d.input for a full description of all +input parameters specific to this problem. \ No newline at end of file diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/main.C b/base/SAMRAI/SAMRAI/source/test/hierarchy/main.C index baaa5ae8..c4e86783 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/main.C +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for hierachy coarsen/refine tests. * ************************************************************************/ @@ -22,7 +22,7 @@ #include "HierarchyTester.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/tbox_Pointer-HierarchyTester.C b/base/SAMRAI/SAMRAI/source/test/hierarchy/tbox_Pointer-HierarchyTester.C deleted file mode 100644 index 77492656..00000000 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/tbox_Pointer-HierarchyTester.C +++ /dev/null @@ -1,15 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "HierarchyTester.h" - -#include - -template class boost::shared_ptr; diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen.3d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen.3d.input index 257c47dd..004dcaa2 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing patch hierarchy coarsening * ************************************************************************/ +// Refer to hierarchy_coarsen2d.input for full description of all input +// parameters specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -61,38 +64,39 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } StandardTagAndInitialize { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,12) , (11,23,19) ], - [ (0,16,0) , (15,23,11) ], - [ (16,0,0) , (31,7,7) ], - [ (24,8,0) , (31,15,7) ], - [ (20,0,8) , (31,11,19) ] + + level_0 { + boxes = [ (0,16,12) , (11,23,19) ], + [ (0,16,0) , (15,23,11) ], + [ (16,0,0) , (31,7,7) ], + [ (24,8,0) , (31,15,7) ], + [ (20,0,8) , (31,11,19) ] } } diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen2d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen2d.input index fdb83b35..6d2fed96 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen2d.input +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_coarsen2d.input @@ -3,39 +3,50 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing patch hierarchy coarsening * ************************************************************************/ GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). call_abort_in_serial_instead_of_exit = FALSE } Main { - dim = 2 -// -// Log file information -// - log_file_name = "hierarchy-coarsen2d-test.log" - log_all_nodes = TRUE + // Dimension of problem. + dim = 2 + + // Name of log file. + log_file_name = "hierarchy-coarsen2d-test.log" + + // If TRUE all nodes will log to individual files. + // If FALSE only node 0 will log. + log_all_nodes = TRUE } HierarchyTest { - do_refine_test = FALSE - do_coarsen_test = TRUE + // If TRUE will test makeRefinedPatchHierarchy. + do_refine_test = FALSE + + // If TRUE will test makeCoarsenedPatchHierarchy. + do_coarsen_test = TRUE - ratio = 2,2 + // Refinement or coarsening ratio. + ratio = 2,2 } +// Refer to mesh::CartesianGridGeometry and its base classes for input. CartesianGridGeometry { domain_boxes = [ (0,0) , (31,23) ] x_lo = 0.e0 , 0.e0 // lower end of computational domain. x_up = 1.e0 , 1.e0 // upper end of computational domain. } +// Refer to hier::PatchHierarchy for input. PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. @@ -61,40 +72,42 @@ PatchHierarchy { } -GriddingAlgorithm { - +// Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input. +GriddingAlgorithm { sequentialize_patch_indices = TRUE } +// Refer to mesh::StandardTagAndInitialize for input. StandardTagAndInitialize { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16) , (11,23) ], - [ (16,0) , (31,7) ], - [ (24,8) , (31,15) ] + level_0 { + boxes = [ (0,16) , (11,23) ], + [ (16,0) , (31,7) ], + [ (24,8) , (31,15) ] } - } +// Refer to mesh::TreeLoadBalancer for input. TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_coarsen.2d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_coarsen.2d.input new file mode 100644 index 00000000..d1627449 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_coarsen.2d.input @@ -0,0 +1,114 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: input file for testing patch hierarchy coarsening + * + ************************************************************************/ + +GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). + call_abort_in_serial_instead_of_exit = FALSE +} + +Main { + // Dimension of problem. + dim = 2 + + // Name of log file. + log_file_name = "hierarchy-coarsen2d-test.log" + + // If TRUE all nodes will log to individual files. + // If FALSE only node 0 will log. + log_all_nodes = TRUE +} + +HierarchyTest { + + // If TRUE will test makeRefinedPatchHierarchy. + do_refine_test = FALSE + + // If TRUE will test makeCoarsenedPatchHierarchy. + do_coarsen_test = TRUE + + // Refinement or coarsening ratio. + ratio = 2,2 + +} + +// Refer to mesh::CartesianGridGeometry and its base classes for input. +CartesianGridGeometry { + domain_boxes = [ (0,0) , (31,23) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 1,0 +} + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + max_levels = 2 // Maximum number of levels in hierarchy. + +// Note: For the following regridding information, data is required for each +// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. +// If more data values than needed are given, only the number required +// will be read in. If fewer values are given, an error will result. +// +// Specify coarsening ratios for each level 1 through max_levels-1 + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 + } + + largest_patch_size { + level_0 = 40, 40 + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 2, 2 + // all finer levels will use same values as level_0... + } + +} + +// Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +// Refer to mesh::GriddingAlgorithm for input. +GriddingAlgorithm { + sequentialize_patch_indices = TRUE +} + +// Refer to mesh::StandardTagAndInitialize for input. +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + + level_0 { + boxes = [ (0,16) , (11,23) ], + [ (16,0) , (31,7) ], + [ (24,8) , (31,15) ] + } +} + +// Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_refine.2d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_refine.2d.input new file mode 100644 index 00000000..7fea8dc8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_periodic_refine.2d.input @@ -0,0 +1,111 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: input file for testing patch hierarchy refining + * + ************************************************************************/ + +// Refer to hierarchy_coarsen2d.input for full description of all input +// parameters specific to this problem. + +GlobalInputs { + call_abort_in_serial_instead_of_exit = FALSE +} + +Main { + dim = 2 +// +// Log file information +// + log_file_name = "hierarchy-periodic-refine2d-test.log" + log_all_nodes = TRUE +} + +HierarchyTest { + + do_refine_test = TRUE + do_coarsen_test = FALSE + + ratio = 2,2 + +} + +CartesianGridGeometry { + domain_boxes = [ (0,0) , (53,61) ] + x_lo = 0.e0 , 0.e0 // lower end of computational domain. + x_up = 1.e0 , 1.e0 // upper end of computational domain. + periodic_dimension = 1,0 +} + +PatchHierarchy { + max_levels = 3 // Maximum number of levels in hierarchy. + +// Note: For the following regridding information, data is required for each +// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. +// If more data values than needed are given, only the number required +// will be read in. If fewer values are given, an error will result. +// +// Specify coarsening ratios for each level 1 through max_levels-1 + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 + level_2 = 2 , 2 + } + + largest_patch_size { + level_0 = 40, 40 + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 2, 2 + // all finer levels will use same values as level_0... + } + +} + +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { + sequentialize_patch_indices = TRUE +} + +TreeLoadBalancer { + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +StandardTagAndInitialize { + tagging_method = "REFINE_BOXES" + + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.2d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.2d.input index 5ae51e7b..014e5d0d 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing patch hierarchy refining * ************************************************************************/ +// Refer to hierarchy_coarsen2d.input for full description of all input +// parameters specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -65,46 +68,46 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +GriddingAlgorithm { sequentialize_patch_indices = TRUE } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } StandardTagAndInitialize { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16) , (11,19) ], - [ (12,0) , (31,19) ], - [ (32,4) , (43,5) ], - [ (16,20) , (21,27) ], - [ (8,28) , (27,41) ], - [ (20,42) , (27,55) ] - level_1 = [ (36,16) , (51,27) ], - [ (24,64) , (31,75) ], - [ (32,64) , (43,71) ] + level_0 { + boxes = [ (0,16) , (11,19) ], + [ (12,0) , (31,19) ], + [ (32,4) , (43,5) ], + [ (16,20) , (21,27) ], + [ (8,28) , (27,41) ], + [ (20,42) , (27,55) ] + } + level_1 { + boxes = [ (36,16) , (51,27) ], + [ (24,64) , (31,75) ], + [ (32,64) , (43,71) ] } - } diff --git a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.3d.input b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.3d.input index e3df2b1f..879fd4ed 100644 --- a/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/hierarchy/test_inputs/hierarchy_refine.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing patch hierarchy refining * ************************************************************************/ +// Refer to hierarchy_coarsen2d.input for full description of all input +// parameters specific to this problem. + GlobalInputs { call_abort_in_serial_instead_of_exit = FALSE } @@ -65,41 +68,44 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } StandardTagAndInitialize { tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,16,16) , (11,19,21) ], - [ (12,0,0) , (31,19,21) ], - [ (32,4,14) , (43,5,17) ], - [ (16,20,4) , (21,27,11) ], - [ (8,28,4) , (27,41,17) ] - level_1 = [ (36,16,14) , (51,27,17) ], - [ (24,64,20) , (31,75,29) ], - [ (32,64,20) , (43,71,25) ] + + level_0 { + boxes = [ (0,16,16) , (11,19,21) ], + [ (12,0,0) , (31,19,21) ], + [ (32,4,14) , (43,5,17) ], + [ (16,20,4) , (21,27,11) ], + [ (8,28,4) , (27,41,17) ] + } + level_1 { + boxes = [ (36,16,14) , (51,27,17) ], + [ (24,64,20) , (31,75,29) ], + [ (32,64,20) , (43,71,25) ] } } diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.C b/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.C index cca5ddd6..ff66f42f 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.C +++ b/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for example Hypre Poisson solver * ************************************************************************/ @@ -23,7 +23,7 @@ #include "SAMRAI/hier/VariableDatabase.h" extern "C" { -void F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, +void SAMRAI_F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, @@ -31,7 +31,7 @@ void F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) (const int& ifirst0, double* rhs, const double* dx, const double* xlower); -void F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) (const int& ifirst0, +void SAMRAI_F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) (const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, @@ -54,21 +54,12 @@ namespace SAMRAI { HyprePoisson::HyprePoisson( const string& object_name, const tbox::Dimension& dim, - boost::shared_ptr database): + boost::shared_ptr& hypre_solver, + boost::shared_ptr& bc_coefs): d_object_name(object_name), d_dim(dim), - d_poisson_hypre(dim, - object_name + "::poisson_hypre", - (database && - database->isDatabase("CellPoissonHypreSolver")) ? - database->getDatabase("CellPoissonHypreSolver") : - boost::shared_ptr()), - d_bc_coefs(dim, - object_name + "::bc_coefs", - (database && - database->isDatabase("bc_coefs")) ? - database->getDatabase("bc_coefs") : - boost::shared_ptr()) + d_poisson_hypre(hypre_solver), + d_bc_coefs(bc_coefs) { hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); @@ -146,8 +137,9 @@ void HyprePoisson::initializeLevelData( boost::shared_ptr patch_hierarchy = hierarchy; boost::shared_ptr grid_geom( - patch_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch_hierarchy->getGridGeometry())); + TBOX_ASSERT(grid_geom); boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); @@ -174,21 +166,24 @@ void HyprePoisson::initializeLevelData( } hier::Box pbox = patch->getBox(); boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); boost::shared_ptr > exact_data( - patch->getPatchData(d_exact_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exact_id))); boost::shared_ptr > rhs_data( - patch->getPatchData(d_rhs_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_rhs_id))); + TBOX_ASSERT(patch_geom); + TBOX_ASSERT(exact_data); + TBOX_ASSERT(rhs_data); /* * Set source function and exact solution. */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) ( + SAMRAI_F77_FUNC(setexactandrhs2d, SETEXACTANDRHS2D) ( pbox.lower()[0], pbox.upper()[0], pbox.lower()[1], @@ -197,9 +192,8 @@ void HyprePoisson::initializeLevelData( rhs_data->getPointer(), grid_geom->getDx(), patch_geom->getXLower()); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) ( + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(setexactandrhs3d, SETEXACTANDRHS3D) ( pbox.lower()[0], pbox.upper()[0], pbox.lower()[1], @@ -252,17 +246,18 @@ bool HyprePoisson::solvePoisson() * simultaneous setting the boundary values and initial guess. */ boost::shared_ptr level(d_hierarchy->getPatchLevel( - level_number)); + level_number)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > data( - patch->getPatchData(d_comp_soln_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_comp_soln_id))); + TBOX_ASSERT(data); data->fill(0.0); } - // d_poisson_hypre.setBoundaries( "Dirichlet" ); - d_poisson_hypre.setPhysicalBcCoefObject(&d_bc_coefs); + // d_poisson_hypre->setBoundaries( "Dirichlet" ); + d_poisson_hypre->setPhysicalBcCoefObject(d_bc_coefs.get()); /* * Set up HYPRE solver object. @@ -270,34 +265,34 @@ bool HyprePoisson::solvePoisson() * CellPoissonSpecifications object then passed to the solver * for setting the coefficients. */ - d_poisson_hypre.initializeSolverState(d_hierarchy, + d_poisson_hypre->initializeSolverState(d_hierarchy, level_number); solv::PoissonSpecifications sps("Hypre Poisson solver"); sps.setCZero(); sps.setDConstant(1.0); - d_poisson_hypre.setMatrixCoefficients(sps); + d_poisson_hypre->setMatrixCoefficients(sps); /* * Solve the system. */ tbox::plog << "solving..." << std::endl; int solver_ret; - solver_ret = d_poisson_hypre.solveSystem(d_comp_soln_id, + solver_ret = d_poisson_hypre->solveSystem(d_comp_soln_id, d_rhs_id); /* * Present data on the solve. */ tbox::plog << "\t" << (solver_ret ? "" : "NOT ") << "converged " << "\n" - << " iterations: "<< d_poisson_hypre.getNumberOfIterations() + << " iterations: " << d_poisson_hypre->getNumberOfIterations() << "\n" - << " residual: "<< d_poisson_hypre.getRelativeResidualNorm() + << " residual: " << d_poisson_hypre->getRelativeResidualNorm() << "\n" << std::flush; /* * Deallocate state. */ - d_poisson_hypre.deallocateSolverState(); + d_poisson_hypre->deallocateSolverState(); /* * Return whether solver converged. @@ -359,21 +354,25 @@ bool HyprePoisson::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { NULL_USE(region); NULL_USE(depth_id); + NULL_USE(simulation_time); - pdat::CellData::iterator icell(patch.getBox(), true); - pdat::CellData::iterator icellend(patch.getBox(), false); + pdat::CellData::iterator icell(pdat::CellGeometry::begin(patch.getBox())); + pdat::CellData::iterator icellend(pdat::CellGeometry::end(patch.getBox())); if (variable_name == "Error") { boost::shared_ptr > current_solution_( - patch.getPatchData(d_comp_soln_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_comp_soln_id))); boost::shared_ptr > exact_solution_( - patch.getPatchData(d_exact_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_exact_id))); + TBOX_ASSERT(current_solution_); + TBOX_ASSERT(exact_solution_); pdat::CellData& current_solution = *current_solution_; pdat::CellData& exact_solution = *exact_solution_; for ( ; icell != icellend; ++icell) { diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.h b/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.h index cc2d9e50..015ed907 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.h +++ b/base/SAMRAI/SAMRAI/source/test/hypre/HyprePoisson.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Example user class for solving Poisson using Hypre. * ************************************************************************/ @@ -12,8 +12,6 @@ #include "SAMRAI/SAMRAI_config.h" -using namespace std; - #if !defined(HAVE_HYPRE) /* @@ -44,7 +42,9 @@ using namespace std; #include "SAMRAI/appu/VisDerivedDataStrategy.h" #include "SAMRAI/appu/VisItDataWriter.h" -#include +#include "boost/shared_ptr.hpp" + +using namespace std; namespace SAMRAI { @@ -86,12 +86,14 @@ class HyprePoisson: * pass in valid pointers for those streams. * * @param object_name Ojbect name + * @param dim + * @param database */ HyprePoisson( const string& object_name, const tbox::Dimension& dim, - boost::shared_ptr database = - boost::shared_ptr()); + boost::shared_ptr& hypre_solver, + boost::shared_ptr& bc_coefs); virtual ~HyprePoisson(); @@ -137,7 +139,8 @@ class HyprePoisson: const hier::Patch& patch, const hier::Box& region, const std::string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time = 0.0) const; //@} @@ -191,12 +194,12 @@ class HyprePoisson: /*! * @brief HYPRE poisson solver. */ - solv::CellPoissonHypreSolver d_poisson_hypre; + boost::shared_ptr d_poisson_hypre; /*! * @brief Boundary condition coefficient implementation. */ - solv::LocationIndexRobinBcCoefs d_bc_coefs; + boost::shared_ptr d_bc_coefs; //@} diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.depend index 7ebc45f2..1b9fabbc 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -51,12 +51,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -99,7 +101,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -112,8 +113,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -123,7 +124,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h HyprePoisson.C \ HyprePoisson.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -147,11 +147,10 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -161,6 +160,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -170,6 +170,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -182,7 +183,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -194,18 +198,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -213,11 +216,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -248,12 +252,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -267,9 +271,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -287,13 +292,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h HyprePoisson.h \ main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -307,10 +310,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.in b/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.in index 80854b94..3bcb5df0 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/hypre/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI HYPRE interface test ## ######################################################################### @@ -14,36 +14,33 @@ SUBDIR = source/test/hypre VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +SUBDIRS = fortran + +CPPFLAGS_EXTRA= -DTESTING=1 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o HyprePoisson.o -F_OBJS = hyprepoisson2d.o hyprepoisson3d.o +F_OBJS = fortran/hyprepoisson2d.o fortran/hyprepoisson3d.o main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ $(LIBSAMRAI3D) $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ -include $(SRCDIR)/Makefile.depend - -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) - -hyprepoisson2d.o: $(FORTRAN)/hyprepoisson2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/hyprepoisson2d.m4 > hyprepoisson2d.f - $(F77) $(FFLAGS) -c hyprepoisson2d.f -o $@ +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/hyprepoisson2d.o: -hyprepoisson3d.o: $(FORTRAN)/hyprepoisson3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/hyprepoisson3d.m4 > hyprepoisson3d.f - $(F77) $(FFLAGS) -c hyprepoisson3d.f -o $@ +fortran/hyprepoisson3d.o: check: $(MAKE) check2d @@ -51,27 +48,51 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: clean-check +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.out.* + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/README b/base/SAMRAI/SAMRAI/source/test/hypre/README index 1a7d6e94..2e5eeffd 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/README +++ b/base/SAMRAI/SAMRAI/source/test/hypre/README @@ -3,8 +3,8 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Hypre Poisson solver example +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of CellPoissonHypreSolver ## ######################################################################### **************************************************************************** @@ -16,53 +16,32 @@ * * **************************************************************************** -This example demonstrates use of the PoissonHypreSolver class in a SAMRAI -application. -The files/classes included in this directory are as follows: +This test demonstrates the use of and unit tests the CellPoissonHypreSolver +class. The files included in this directory are as follows: - main - example main program - HyprePoisson - Class to set up and solve the scalar - Poisson equation on a single level. - Also supplies required implementations - to interfaces for building grid and + main.C - driver + HyprePoisson.[Ch] - Class to set up and solve the scalar Poisson + equation on a single level. Also supplies required + implementations to interfaces for building grid and plotting. + test_inputs/*.input - 2d and 3d input files -COMPILE and RUN ---------------- -Compile: make main2d main3d -Run: main2d 2d.default.input - main3d 3d.default.input - - -INPUTS ------- - -Main { - base_name = [All names used are derived from this one.] - log_all_nodes = [log all nodes or node 0 only?] - residual_tol = [Tolerance for solve] -} -CartesianGeometry { - // Define the domain. - // See SAMRAI documentation for inputs. -} +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main -StandardTagAndInitialize { - // Use default settings for this example. - // See SAMRAI documentation for inputs. -} - -LoadBalancer{ - // Use default settings for this example. - // See SAMRAI documentation for inputs. -} - -GriddingAlgorithm { - max_levels = 1 - largest_patch_size { - level_0 = 32, 32 - // all finer levels will use same values as level_0... - } -} + Execution: + serial: + ./main test_inputs/default.[2,3]d.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main test_inputs/default.[2,3]d.input + +INPUT PARAMETERS +---------------- +Refer to test_inputs/default.2d.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.depend new file mode 100644 index 00000000..d99030fb --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.depend @@ -0,0 +1,37 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=hyprepoisson2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + hyprepoisson2d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=hyprepoisson3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + hyprepoisson3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.in new file mode 100644 index 00000000..3ca09612 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/Makefile.in @@ -0,0 +1,38 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI HYPRE interface test +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/hypre/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= hyprepoisson2d.o hyprepoisson3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +hyprepoisson2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/hyprepoisson2d.m4 > hyprepoisson2d.f + $(F77) $(FFLAGS) -c hyprepoisson2d.f -o $@ + +hyprepoisson3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/hyprepoisson3d.m4 > hyprepoisson3d.f + $(F77) $(FFLAGS) -c hyprepoisson3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson2d.m4 b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson2d.m4 index dc306ea3..275def2c 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 2D F77 routines. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine setexactandrhs2d( & ifirst0,ilast0,ifirst1,ilast1, @@ -31,7 +38,7 @@ c do ic1=ifirst1,ilast1 y = xlower(1) + dx(1)*(ic1-ifirst1+0.5) do ic0=ifirst0,ilast0 - x = xlower(0) + dx(0)*(ic0-ifirst0+0.5) + x = xlower(0) + dx(0)*(ic0-ifirst0+0.5) sinsin = sin(pi*x) * sin(pi*y) exact(ic0,ic1) = sinsin rhs(ic0,ic1) = -NDIM*pi*pi*sinsin diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson3d.m4 b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson3d.m4 index 660db786..f167fde2 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/hypre/fortran/hyprepoisson3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 3D F77 routines. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine setexactandrhs3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/main.C b/base/SAMRAI/SAMRAI/source/test/hypre/main.C index b7b40bbb..e1a095e7 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/main.C +++ b/base/SAMRAI/SAMRAI/source/test/hypre/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for Hypre Poisson example * ************************************************************************/ @@ -14,6 +14,7 @@ using namespace std; #include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/tbox/InputDatabase.h" @@ -30,7 +31,7 @@ using namespace std; #include "HyprePoisson.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -165,12 +166,32 @@ int main( * process that includes making the initial guess, specifying the * boundary conditions and call the solver. */ + + std::string hypre_poisson_name = base_name + "::HyprePoisson"; + std::string hypre_solver_name = hypre_poisson_name + "::poisson_hypre"; + std::string bc_coefs_name = hypre_poisson_name + "::bc_coefs"; + + boost::shared_ptr hypre_solver( + new solv::CellPoissonHypreSolver( + dim, + hypre_poisson_name, + input_db->isDatabase("hypre_solver") ? + input_db->getDatabase("hypre_solver") : + boost::shared_ptr())); + + boost::shared_ptr bc_coefs( + new solv::LocationIndexRobinBcCoefs( + dim, + bc_coefs_name, + input_db->isDatabase("bc_coefs") ? + input_db->getDatabase("bc_coefs") : + boost::shared_ptr())); + HyprePoisson hypre_poisson( - base_name + "::HyprePoisson", + hypre_poisson_name, dim, - input_db->isDatabase("HyprePoisson") ? - input_db->getDatabase("HyprePoisson") : - boost::shared_ptr()); + hypre_solver, + bc_coefs); /* * Create the tag-and-initializer, box-generator and load-balancer @@ -178,7 +199,6 @@ int main( */ boost::shared_ptr tag_and_initializer( new mesh::StandardTagAndInitialize( - dim, "CellTaggingMethod", &hypre_poisson, input_db->getDatabase("StandardTagAndInitialize"))); @@ -219,25 +239,14 @@ int main( * function setupExternalPlotter to register its data * with the plotter. */ - tbox::Array vis_writer(1); - vis_writer[0] = "Visit"; - if (main_db->keyExists("vis_writer")) { - vis_writer = main_db->getStringArray("vis_writer"); - } - bool use_visit = false; - for (int i = 0; i < vis_writer.getSize(); i++) { - if (vis_writer[i] == "VisIt") use_visit = true; - } +#ifdef HAVE_HDF5 string vis_filename = main_db->getStringWithDefault("vis_filename", base_name); -#ifdef HAVE_HDF5 - boost::shared_ptr visit_writer; - if (use_visit) { - visit_writer.reset(new appu::VisItDataWriter(dim, - "Visit Writer", - vis_filename + ".visit")); - hypre_poisson.registerVariablesWithPlotter(*visit_writer); - } + boost::shared_ptr visit_writer( + boost::make_shared(dim, + "VisIt Writer", + vis_filename + ".visit")); + hypre_poisson.registerVariablesWithPlotter(*visit_writer); #endif /* @@ -259,9 +268,7 @@ int main( * Plot. */ #ifdef HAVE_HDF5 - if (use_visit) { - visit_writer->writePlotData(patch_hierarchy, 0); - } + visit_writer->writePlotData(patch_hierarchy, 0); #endif /* diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.2d.input index 59351277..3843ff75 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.2d.input @@ -3,92 +3,92 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for hypre test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for hypre unit test. * ************************************************************************/ Main { + // Dimension of problem. dim = 2 + + // Base name for log and visualization files. base_name = "default2" + + // If TRUE each process writes a log file. Otherwise only process 0 does. log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "VisIt" + + // The name of the visualization file generated if supplied. Otherwise + // visualization file name is derived from base_name. + // vis_filename = "default2d" } -HyprePoisson { - CellPoissonHypreSolver { - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - print_solver_info = TRUE - max_iterations = 20 // Max iterations used by Hypre - relative_residual_tol = 1.0e-8 // Residual tolerance used by Hypre - num_pre_relax_steps = 1 // # of presmoothing steps used by Hypre - num_post_relax_steps = 1 // # of postsmoothing steps used by Hypre - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - boundary_0 = "value", "0" - boundary_1 = "coefficients", "1", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - } +// Refer to solv::CellPoissonHypreSolver for input. +hypre_solver { + print_solver_info = TRUE + max_iterations = 20 // Max iterations used by Hypre + relative_residual_tol = 1.0e-8 // Residual tolerance used by Hypre +} +// Refer to solv::LocationIndexRobinBcCoefs for input. +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + boundary_0 = "value", "0" + boundary_1 = "coefficients", "1", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" } +// Refer to mesh::CartesianGridGeometry and its base classes for input. CartesianGeometry { domain_boxes = [(0,0), (31,31)] x_lo = 0, 0 x_up = 1, 1 } +// Refer to mesh::StandardTagAndInitialize for input. StandardTagAndInitialize { // Use default settings for this example. } +// Refer to mesh::BergerRigoutsos for input. BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - // owner_mode = "FEWEST_OWNED" - owner_mode = "MOST_OVERLAP" - // owner_mode = "SINGLE_OWNER" - use_level_boxes = FALSE - use_private_communicator = TRUE - sequentialize_output_indices = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + // DEV_owner_mode = "FEWEST_OWNED" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "SINGLE_OWNER" max_box_size = 40, 40 - barrier_before_cluster = FALSE -} - -LoadBalancer{ - // Use default settings for this example. + efficiency_tolerance = 0.70 + combine_efficiency = 0.95 } +// Refer to mesh::TreeLoadBalancer for input. TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 2 - interlace_groups = FALSE + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } +// Refer to hier::PatchHierarchy for input. PatchHierarchy { max_levels = 1 proper_nesting_buffer = 2, 2, 2, 2, 2, 2 - // load_balance = FALSE largest_patch_size { // level_0 = 8, 8 level_0 = -1, -1 @@ -113,24 +113,11 @@ PatchHierarchy { allow_patches_smaller_than_ghostwidth = TRUE } +// Refer to mesh::GriddingAlgorithm for input. GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.70 - combine_efficiency = 0.95 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = FALSE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.3d.input index ebf0e9ae..71014b48 100644 --- a/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/hypre/test_inputs/default.3d.input @@ -3,48 +3,44 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for hypre test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for hypre unit test. * ************************************************************************/ +// Refer to default.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 base_name = "default3" log_all_nodes = FALSE - // Visualization writers to write files for. - vis_writer = "VisIt" } -HyprePoisson { - CellPoissonHypreSolver { - use_smg = TRUE // Whether to use HYPRE's SMG instead of PFMG. - print_solver_info = TRUE - max_iterations = 20 // Max iterations used by Hypre - relative_residual_tol = 1.0e-8 // Residual tolerance used by Hypre - num_pre_relax_steps = 1 // # of presmoothing steps used by Hypre - num_post_relax_steps = 1 // # of postsmoothing steps used by Hypre - } - bc_coefs { - // These are the boundary condition specifications. The number - // after "boundary_" is the location index of the boundary. - // The inputs are arrays of strings where the first string - // indicates the type of values you want to set. "slope" means - // boundary slope, "value" means boundary value, and "coefficients" - // mean the raw Robin boundary condition coefficients. - // The remaining strings are converted into numbers as - // appropriate for what boundary condition you specified with - // the first string. Other boundary conditions are possible. - // see the solv_RobinBcCoefStrategy class. - // Examples: - boundary_0 = "value", "0" - boundary_1 = "coefficients", "1", "0" - boundary_2 = "value", "0" - boundary_3 = "value", "0" - boundary_4 = "value", "0" - boundary_5 = "value", "0" - } +hypre_solver { + print_solver_info = TRUE + max_iterations = 20 // Max iterations used by Hypre + relative_residual_tol = 1.0e-8 // Residual tolerance used by Hypre +} +bc_coefs { + // These are the boundary condition specifications. The number + // after "boundary_" is the location index of the boundary. + // The inputs are arrays of strings where the first string + // indicates the type of values you want to set. "slope" means + // boundary slope, "value" means boundary value, and "coefficients" + // mean the raw Robin boundary condition coefficients. + // The remaining strings are converted into numbers as + // appropriate for what boundary condition you specified with + // the first string. Other boundary conditions are possible. + // see the solv_RobinBcCoefStrategy class. + // Examples: + boundary_0 = "value", "0" + boundary_1 = "coefficients", "1", "0" + boundary_2 = "value", "0" + boundary_3 = "value", "0" + boundary_4 = "value", "0" + boundary_5 = "value", "0" } CartesianGeometry { @@ -58,25 +54,23 @@ StandardTagAndInitialize { } BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - // algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" - algo_advance_mode = "ADVANCE_SOME" - // algo_advance_mode = "SYNCHRONOUS" - // owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" - owner_mode = "MOST_OVERLAP" - // owner_mode = "SINGLE_OWNER" - use_level_boxes = FALSE - use_private_communicator = TRUE - sequentialize_output_indices = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_algo_advance_mode: "SYNCHRONOUS", "ADVANCE_SOME", "ROUND_ROBIN" or "ADVANCE_ANY" + DEV_algo_advance_mode = "ADVANCE_SOME" + // DEV_algo_advance_mode = "SYNCHRONOUS" + // DEV_owner_mode: "SINGLE_OWNER", "MOST_OVERLAP" (default), "FEWEST_OWNED", "LEAST_ACTIVE" + DEV_owner_mode = "MOST_OVERLAP" + // DEV_owner_mode = "SINGLE_OWNER" + efficiency_tolerance = 0.88 + combine_efficiency = 0.88 } TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 3 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE } PatchHierarchy { @@ -106,15 +100,9 @@ PatchHierarchy { GriddingAlgorithm { enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - // load_balance = FALSE - combine_efficiency = 0.88 - efficiency_tolerance = 0.88 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" + DEV_extend_to_domain_boundary = TRUE + // DEV_load_balance = FALSE check_nonrefined_tags = "IGNORE" - extend_tags_to_bdry = TRUE sequentialize_patch_indices = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.depend deleted file mode 100644 index 6af906f0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.depend +++ /dev/null @@ -1,40 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile dependencies -## -######################################################################### - -## This file is automatically generated by depend.pl. - - -FILE_0=ieee_test.o -DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IEEE.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h ieee_test.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - diff --git a/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.in b/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.in deleted file mode 100644 index cc4d9602..00000000 --- a/base/SAMRAI/SAMRAI/source/test/ieee/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for ieee test case -## -######################################################################### - -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ -SUBDIR = source/test/ieee -VPATH = @srcdir@ -TESTTOOLS = ../testtools -OBJECT = ../../.. - -default: check - -include $(OBJECT)/config/Makefile.config - -CPPFLAGS_EXTRA= -DDISPLAY -DNDIM=2 -DTESTING=1 - -NUM_TESTS = 1 - -TEST_NPROCS = @TEST_NPROCS@ - -CXX_OBJS = ieee_test.o - -main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(LIBSAMRAI) $(LDLIBS) -o $@ - -check: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main - -check2d: - $(MAKE) check - -check3d: - $(MAKE) check - -checkcompile: main - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main - -include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/ieee/ieee_test.C b/base/SAMRAI/SAMRAI/source/test/ieee/ieee_test.C deleted file mode 100644 index 68035fb9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/ieee/ieee_test.C +++ /dev/null @@ -1,237 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: simple test code for the IEEE exception handlers - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" - -#include -#include - -#include -// using namespace std; - -#include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/IEEE.h" - -#include - -using namespace SAMRAI; - -// A successful signaling operation will stop the program, making it -// difficult to test a variety of operations in a single executable. -// Uncomment the particular case you want to test and recompile: - -//#define SIGOPS_SUN_F0 -//#define SIGOPS_SUN_D0 -//#define SIGOPS_SUN_F1 -//#define SIGOPS_SUN_D1 -//#define SIGOPS_F2 -//#define SIGOPS_D2 -//#define SIGOPS_F3 -//#define SIGOPS_D3 - -int main( - int argc, - char** argv) -{ - /* - * Initialize MPI, SAMRAI, and enable logging. - */ - tbox::SAMRAI_MPI::init(&argc, &argv); - tbox::SAMRAIManager::initialize(); - tbox::SAMRAIManager::startup(); - - tbox::IEEE::setupFloatingPointExceptionHandlers(); - - /* - * Try using variables set to NaN and see if the signal handler catches - * and stops the program. Note that the TESTSIGNAL flag is not defined - * by default as it will stop this executable, signaling to the script - * there was an error, even though this is the desired behavior. - */ - - int fail_count = 0; - -#ifdef SIGOPS_SUN_F0 - float f0 = tbox::MathUtilities::getSignalingNaN(); - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "\nis working (under solaris)..." << std::endl; - tbox::pout << "f0 = " << f0 << std::endl; - tbox::pout << "f0 * 1.0 = " << std::endl; - tbox::pout << f0 * 1.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - -#ifdef SIGOPS_SUN_D0 - double d0 = tbox::MathUtilities::getSignalingNaN(); - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "\nis working (under solaris)..." << std::endl; - tbox::pout << "d0 = " << d0 << std::endl; - tbox::pout << "d0 * 1.0 = " << std::endl; - tbox::pout << d0 * 1.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - -#ifdef SIGOPS_SUN_F1 - float f1 = tbox::MathUtilities::getSignalingNaN(); - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "\nis working (under solaris)..." << std::endl; - tbox::pout << "f1 = " << f1 << std::endl; - tbox::pout << "f1 * 1.0 = " << std::endl; - tbox::pout << f1 * 1.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - -#ifdef SIGOPS_SUN_D1 - double d1 = tbox::MathUtilities::getSignalingNaN(); - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "\nis working (under solaris)..." << std::endl; - tbox::pout << "d1 = " << d1 << std::endl; - tbox::pout << "d1 * 1.0 = " << std::endl; - tbox::pout << d1 * 1.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - -#ifdef SIGOPS_F2 - float f2 = 1.0; - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "is working..." << std::endl; - tbox::pout << "f2 = " << f2 << std::endl; - tbox::pout << "f2/0.0 = " << std::endl; - tbox::pout << f2 / 0.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - -#ifdef SIGOPS_D2 - double d2 = 1.0; - tbox::pout - << "\nThis operation should stop the executable if signal handling " - << "is working..." << std::endl; - tbox::pout << "d2 = " << d2 << std::endl; - tbox::pout << "d2/0.0 = " << std::endl; - tbox::pout << d2 / 0.0 << std::endl; - tbox::pout << "The operation worked so SIGNAL HANDLING IS NOT ENABLED" - << std::endl; -#endif - - /* - * Check if the isNaN() method is working correctly - */ -#ifdef SIGOPS_F0 - bool is_f0_nan = tbox::MathUtilities::isNaN(f0); - if (!is_f0_nan) { - fail_count++; - tbox::perr << "Test f0 FAILED" << std::endl; - } else { - tbox::plog << "Test f0 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_D0 - bool is_d0_nan = tbox::MathUtilities::isNaN(d0); - if (!is_d0_nan) { - fail_count++; - tbox::perr << "Test d0 FAILED" << std::endl; - } else { - tbox::plog << "Test d0 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_F1 - bool is_f1_nan = tbox::IEEE::isNaN(f1); - if (!is_f1_nan) { - fail_count++; - tbox::perr << "Test f1 FAILED" << std::endl; - } else { - tbox::plog << "Test f1 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_D1 - bool is_d1_nan = tbox::IEEE::isNaN(d1); - if (!is_d1_nan) { - fail_count++; - tbox::perr << "Test d1 FAILED" << endl; - } else { - tbox::plog << "Test d1 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_F2 - bool is_f2_nan = tbox::IEEE::isNaN(f2); - if (is_f2_nan) { - fail_count++; - tbox::perr << "Test f2 FAILED" << endl; - } else { - tbox::plog << "Test f2 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_D2 - bool is_d2_nan = tbox::IEEE::isNaN(d2); - if (is_d2_nan) { - fail_count++; - tbox::perr << "Test d2 FAILED" << endl; - } else { - tbox::plog << "Test d2 passed" << std::endl; - } -#endif - -#ifdef SIGOPS_F3 - // Try some arrays - tbox::Array f3(5); - tbox::IEEE::initializeArrayToSignalingNaN(f3); - for (int i = 0; i < f3.getSize(); i++) { - bool is_f3_nan = tbox::IEEE::isNaN(f3[i]); - if (!is_f3_nan) { - fail_count++; - tbox::perr << "Test f3 FAILED; i = " << i << endl; - } else { - tbox::plog << "Test f3 passed" << std::endl; - } - } -#endif - -#ifdef SIGOPS_D3 - tbox::Array d3(5); - tbox::IEEE::initializeArrayToSignalingNaN(d3); - for (int i = 0; i < d3.getSize(); i++) { - bool is_d3_nan = tbox::IEEE::isNaN(d3[i]); - if (!is_d3_nan) { - fail_count++; - tbox::perr << "Test d3 FAILED; i = " << i << std::endl; - } else { - tbox::plog << "Test d3 passed" << std::endl; - } - } -#endif - - if (fail_count == 0) { - tbox::pout << "\nPASSED: ieee" << std::endl; - } - - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - - return fail_count; -} diff --git a/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.depend index 2da18103..eacc1f4f 100644 --- a/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -35,6 +35,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -44,7 +45,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ @@ -57,8 +57,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/IndexVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -70,7 +68,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -79,14 +76,13 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.in b/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.in index 7288c5bf..8c07d92f 100644 --- a/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/indexdata/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for test of index data ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/indexdata -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml # # For these classes don't turn off implicit template instantiation. @@ -26,31 +27,51 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DTESTING=1 -main: main.o $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(COBJS) \ - $(LIBSAMRAI) $(LDLIBS) -o $@ +main: main.o $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(COBJS) \ + $(LIBSAMRAI) $(LDLIBS) -o $@ NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: main check: - $(MAKE) check2d + $(MAKE) check2d check2d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check3d: checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - @$(RM) *.f main* + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + @$(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/indexdata/README b/base/SAMRAI/SAMRAI/source/test/indexdata/README new file mode 100644 index 00000000..8b8c8ec4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/indexdata/README @@ -0,0 +1,28 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of IndexData. +## +######################################################################### + +This test demonstrates the use of and unit tests the IndexData class. The +files included in this directory are as follows: + + main.C - unit tester + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/indexdata/main.C b/base/SAMRAI/SAMRAI/source/test/indexdata/main.C index c3bf57b4..28533a14 100644 --- a/base/SAMRAI/SAMRAI/source/test/indexdata/main.C +++ b/base/SAMRAI/SAMRAI/source/test/indexdata/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ @@ -13,20 +13,17 @@ #include "SAMRAI/pdat/IndexVariable.h" #include "SAMRAI/pdat/IndexVariable.C" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Array.C" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/pdat/CellData.C" -#include "SAMRAI/pdat/CellGeometry.C" #include "SAMRAI/pdat/IndexData.h" #include "SAMRAI/pdat/IndexData.C" #include "SAMRAI/pdat/IndexDataFactory.h" #include "SAMRAI/pdat/IndexDataFactory.C" -#include +#include "boost/shared_ptr.hpp" #include using namespace SAMRAI; @@ -57,7 +54,7 @@ public: { NULL_USE(idx); NULL_USE(src_offset); - for (int n = 0; n < NN; n++) { + for (int n = 0; n < NN; ++n) { x[n] = src_item.x[n]; } } @@ -81,12 +78,12 @@ public: NULL_USE(offset); } - void putUnregisteredToDatabase( + void putToRestart( boost::shared_ptr dbase) { NULL_USE(dbase); } - void getFromDatabase( + void getFromRestart( boost::shared_ptr dbase) { NULL_USE(dbase); @@ -95,31 +92,6 @@ public: double x[NN]; }; -/* - * SGH: BG{L,P} et. al. do not like to have explicit template instantiations - * outside of the namespace in which the template is defined. This causes - * a compile-time error, so we'll just avoid this on BG{L,P} platforms. - * - * Reference: XL C/C++ V9.0 for Linux documentation, i - * section: Templates - * subsection: Explicit instantiation - * URL: - * http://publib.boulder.ibm.com/infocenter/lnxpcomp/v9v111/index.jsp?topic=/com.ibm.xlcpp9.linux.doc/language_ref/templates.htm - * - */ -#ifndef __xlC__ -template class pdat::IndexData; -template class pdat::IndexDataFactory; -template class pdat::IndexDataNode; -template class pdat::IndexIterator; -template class pdat::IndexVariable; - -template class tbox::Array >; -template class boost::shared_ptr >; -template class boost::shared_ptr >; -template class boost::shared_ptr >; -#endif - int main( int argc, char* argv[]) @@ -282,8 +254,8 @@ int main( Index hi(v); Box box1(lo, hi, BlockId(0)); - hier::Box::iterator biend(box1, false); - for (Box::iterator bi(box1, true); bi != biend; ++bi) { + hier::Box::iterator biend(box1.end()); + for (Box::iterator bi(box1.begin()); bi != biend; ++bi) { Index idx = *bi; @@ -291,7 +263,7 @@ int main( } - assert(idx_data.getNumberOfItems() == box1.size()); + assert(static_cast(idx_data.getNumberOfItems()) == box1.size()); idx_data.removeInsideBox(box1); @@ -310,8 +282,8 @@ int main( Index hi(v); Box box1(lo, hi, BlockId(0)); - hier::Box::iterator biend(box1, false); - for (Box::iterator bi(box1, true); bi != biend; ++bi) { + hier::Box::iterator biend(box1.end()); + for (Box::iterator bi(box1.begin()); bi != biend; ++bi) { Index idx = *bi; @@ -319,7 +291,7 @@ int main( } - assert(idx_data.getNumberOfItems() == box1.size()); + assert(static_cast(idx_data.getNumberOfItems()) == box1.size()); idx_data.removeAllItems(); @@ -341,13 +313,13 @@ int main( Index hi(v); Box box1(lo, hi, BlockId(0)); - hier::Box::iterator biend(box1, false); - for (Box::iterator bi(box1, true); bi != biend; ++bi) { + hier::Box::iterator biend(box1.end()); + for (Box::iterator bi(box1.begin()); bi != biend; ++bi) { src.addItemPointer(*bi, new Item); } - assert(src.getNumberOfItems() == box1.size()); - assert(dst.getNumberOfItems() == 0); + assert(static_cast(src.getNumberOfItems()) == box1.size()); + assert(static_cast(dst.getNumberOfItems()) == 0); dst.copy(src); @@ -571,7 +543,7 @@ int main( IndexIterator itend(data, false); for (IndexIterator it(data, true); it != itend; ++it) { - count++; + ++count; } assert(3 == count); } @@ -603,7 +575,7 @@ int main( } } - int numberOfItems = idx_data.getNumberOfItems(); + size_t numberOfItems = idx_data.getNumberOfItems(); timer->stop(); tbox::plog << numberOfItems << endl; @@ -670,7 +642,7 @@ int main( timer->start(); - for (int n = 0; n < num_inserts; n++) { + for (int n = 0; n < num_inserts; ++n) { int i = rand() % size; int j = rand() % size; @@ -682,7 +654,7 @@ int main( idx_data.appendItem(idx, new_item); } - int numberOfItems = idx_data.getNumberOfItems(); + size_t numberOfItems = idx_data.getNumberOfItems(); timer->stop(); tbox::plog << numberOfItems << endl; @@ -710,7 +682,7 @@ int main( timer->start(); - for (int n = 0; n < num_inserts; n++) { + for (int n = 0; n < num_inserts; ++n) { int i = rand() % size; int j = rand() % size; @@ -749,7 +721,7 @@ int main( timer->start(); - for (int n = 0; n < num_inserts; n++) { + for (int n = 0; n < num_inserts; ++n) { int i = rand() % size; int j = rand() % size; diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.depend index 636bfa43..dfaffde3 100644 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,9 +14,9 @@ FILE_0=inputdb.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -28,17 +28,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h inputdb.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.in b/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.in index 8227654b..dc0ba1b0 100644 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/inputdb/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing the input database driver ## ######################################################################### @@ -14,6 +14,7 @@ SUBDIR = source/test/inputdb VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -22,32 +23,51 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DNDIM=2 -DTESTING=1 main: inputdb.o $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) inputdb.o $(LIBSAMRAI) $(LDLIBS) -o $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) inputdb.o $(LIBSAMRAI) $(LDLIBS) -o $@ NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: main -check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main inputdb.input +check: checkcompile + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/inputdb.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: - $(MAKE) check + $(MAKE) check check3d: - $(MAKE) check + $(MAKE) check checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/README b/base/SAMRAI/SAMRAI/source/test/inputdb/README index 428e7111..9c636bf3 100644 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/README +++ b/base/SAMRAI/SAMRAI/source/test/inputdb/README @@ -3,89 +3,38 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for input database tests. +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of InputDatabase class. ## ######################################################################### -The inputdb program tests the reading of input files into the input database. -Several sample input files are available within this directory. +This is a unit test of SAMRAI's InputDatabase class. The files included in +this directory are as follows: -Compilation: - make + inputdb.C - unit tester + test_inputs/inputdb.input - test input file -Execution: - ./inputdb -Output: - Input Database is dumped to stdout. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + serial: + ./main test_inputs/inputdb.input + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main inputdb.input -============================================================================== -General InputManager and InputDatabase Usage -============================================================================== -Required headers: - InputDatabase.h - InputManager.h +OUTPUT +------ + Input Database is dumped to inputdb.log. -Input File: - Supported Features - - *support types: - bool: TRUE,FALSE - box: [(lower coord),(upper coord)] - char: '' - complex: ( real , imag ) - double, float: standard representation for double/float. A period - may not start the double/float( use 0.8 instead of .8 ). - integer: standard integer representation - string: "" - vectors, arrays, lists: other types separated by commas - *nesting of databases - *simple expression grammar for keyword assignment - *inclusion of other input files using the standard C/C++ #include grammar - *use of standard C/C++ comments - An example input file might look like the following - - -#include "another_input_file" - -Database_name { - - keyword1 = value1 - keyword2 = value2 - sub_database1 { - keyword3 = value3 - keyword4 = value4 - } -} - -Reading from an input database: - 1) Create an InputDatabase object (the name for this database is not - important). - 2) Parse the input file using the parseInputFile() in the InputManager - class. Since the InputManager is a singleton object, a pointer - to it can be obtained by using the static function - InputManager::getManager(). - 3) Retrive data from the InputDatabase using the accessor methods - provided by the Database.h interface. - - A code snippet demonstrating InputDatabase use might look like - - -// Create input database object -Pointer input_db = new InputDatabase("input_db"); - -// Parse input file -InputManager::getManager()->parseInputFile("input_file",input_db); - -// Access database -int int_value = input_db->getInteger("integer_key"); -double double_value = input_db->getDouble("double_key"); -Pointer sub_database = input_db->getDatabase("sub_database_name"); -char char_value = sub_database->getChar("char_key"); -float float_value = input_db->getFloat("float_key"); - - - More examples of input database usage can be found in main.C for - the sample applications. These applications can be found in the - SAMRAI/source/applications/ directory. +INPUT PARAMETERS +---------------- +Refer to test_inputs/inputdb.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/errors.input b/base/SAMRAI/SAMRAI/source/test/inputdb/errors.input deleted file mode 100644 index a7201270..00000000 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/errors.input +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI input database test driver. - * - ************************************************************************/ - -/* - * This sample input file tests checks some input conditions that would - * cause an error or a warning. You should NOT copy this file as a template - * for valid input files. - */ - -SAMRAIManager { - call_abort_in_serial_instead_of_exit = FALSE -} - -Errors { - a = "a string", 'a', 1.0 - box = [("oops",1),(10,10)] - - array = 1, 2, 3, 4 - a = array[-1] - b = array[5] - c = array[4.1] - d = array - e = "a string" + 1.0 - f = func(array[1]) - g = len("a string") -} diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.C b/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.C index f0492ca0..dbfde7db 100644 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.C +++ b/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test driver for the SAMRAI input database * ************************************************************************/ @@ -12,7 +12,6 @@ //#include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/Complex.h" @@ -24,7 +23,8 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include +#include "boost/shared_ptr.hpp" +#include using namespace SAMRAI; using namespace std; @@ -81,7 +81,7 @@ int main( int lower[NDIM]; int upper[NDIM]; - for (int i = 0; i < NDIM; i++) { + for (int i = 0; i < NDIM; ++i) { lower[i] = 0; upper[i] = 9; } @@ -96,31 +96,31 @@ int main( tbox::DatabaseBox box0 = prim_type_db->getDatabaseBox("box0"); if (i0 != i0_correct) { - fail_count++; + ++fail_count; tbox::perr << "Integer test #0 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(f0, f0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Float test #0 FAILED" << endl; } if (!tbox::MathUtilities::equalEps(d0, d0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Double test #0 FAILED" << endl; } if (b0 != b0_correct) { - fail_count++; + ++fail_count; tbox::perr << "Bool test #0 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(c0, c0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Complex test #0 FAILED" << std::endl; } if (s0 != s0_correct) { - fail_count++; + ++fail_count; tbox::perr << "String test #0 FAILED" << std::endl; } if (!(box0 == box0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Box test #0 FAILED" << std::endl; } @@ -135,15 +135,15 @@ int main( boost::shared_ptr smart_array_db( input_db->getDatabase("SmartArrays")); - tbox::Array i1_correct(5); - tbox::Array f1_correct(5); - tbox::Array d1_correct(5); - tbox::Array b1_correct(5); - tbox::Array c1_correct(5); - tbox::Array s1_correct(5); - tbox::Array box1_correct(5); + std::vector i1_correct(5); + std::vector f1_correct(5); + std::vector d1_correct(5); + std::vector b1_correct(5); + std::vector c1_correct(5); + std::vector s1_correct(5); + std::vector box1_correct(5); - for (int i = 0; i < nsize; i++) { + for (int i = 0; i < nsize; ++i) { i1_correct[i] = i0_correct; f1_correct[i] = f0_correct; d1_correct[i] = d0_correct; @@ -153,42 +153,42 @@ int main( box1_correct[i] = box0_correct; } - tbox::Array i1 = smart_array_db->getIntegerArray("i1"); - tbox::Array f1 = smart_array_db->getFloatArray("f1"); - tbox::Array d1 = smart_array_db->getDoubleArray("d1"); - tbox::Array b1 = smart_array_db->getBoolArray("b1"); - tbox::Array c1 = smart_array_db->getComplexArray("c1"); - tbox::Array s1 = smart_array_db->getStringArray("s1"); - tbox::Array box1 = smart_array_db->getDatabaseBoxArray( - "box1"); + std::vector i1 = smart_array_db->getIntegerVector("i1"); + std::vector f1 = smart_array_db->getFloatVector("f1"); + std::vector d1 = smart_array_db->getDoubleVector("d1"); + std::vector b1 = smart_array_db->getBoolVector("b1"); + std::vector c1 = smart_array_db->getComplexVector("c1"); + std::vector s1 = smart_array_db->getStringVector("s1"); + std::vector box1 = + smart_array_db->getDatabaseBoxVector("box1"); - for (int i = 0; i < nsize; i++) { + for (int i = 0; i < nsize; ++i) { if (i1[i] != i1_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "Integer test #1 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(f1[i], f1_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Float test #1 FAILED" << endl; } if (!tbox::MathUtilities::equalEps(d1[i], d1_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Double test #1 FAILED" << endl; } if (b1[i] != b1_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "Bool test #1 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(c1[i], c1_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Complex test #1 FAILED" << std::endl; } if (s1[i] != s1_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "String test #1 FAILED" << std::endl; } if (!(box1[i] == box1_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Box test #1 FAILED" << std::endl; } } @@ -206,7 +206,7 @@ int main( dcomplex c2_correct[nsize]; std::string s2_correct[nsize]; tbox::DatabaseBox box2_correct[nsize]; - for (int i = 0; i < nsize; i++) { + for (int i = 0; i < nsize; ++i) { i2_correct[i] = i0_correct; f2_correct[i] = f0_correct; d2_correct[i] = d0_correct; @@ -231,33 +231,33 @@ int main( basic_array_db->getStringArray("s2", s2, nsize); basic_array_db->getDatabaseBoxArray("box2", box2, nsize); - for (int i = 0; i < nsize; i++) { + for (int i = 0; i < nsize; ++i) { if (i2[i] != i2_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "Integer test #2 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(f2[i], f2_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Float test #2 FAILED" << endl; } if (!tbox::MathUtilities::equalEps(d2[i], d2_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Double test #2 FAILED" << endl; } if (b2[i] != b2_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "Bool test #2 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(c2[i], c2_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Complex test #2 FAILED" << std::endl; } if (s2[i] != s2_correct[i]) { - fail_count++; + ++fail_count; tbox::perr << "String test #2 FAILED" << std::endl; } if (!(box2[i] == box2_correct[i])) { - fail_count++; + ++fail_count; tbox::perr << "Box test #2 FAILED" << std::endl; } } @@ -279,31 +279,31 @@ int main( box0_correct); if (i3 != i0_correct) { - fail_count++; + ++fail_count; tbox::perr << "Integer test #3 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(f3, f0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Float test #3 FAILED" << endl; } if (!tbox::MathUtilities::equalEps(d3, d0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Double test #3 FAILED" << endl; } if (b3 != b0_correct) { - fail_count++; + ++fail_count; tbox::perr << "Bool test #3 FAILED" << std::endl; } if (!tbox::MathUtilities::equalEps(c3, c0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Complex test #3 FAILED" << std::endl; } if (s3 != s0_correct) { - fail_count++; + ++fail_count; tbox::perr << "String test #3 FAILED" << std::endl; } if (!(box3 == box0_correct)) { - fail_count++; + ++fail_count; tbox::perr << "Box test #3 FAILED" << std::endl; } diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.input b/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.input deleted file mode 100644 index e609950e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/inputdb/inputdb.input +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI input database test driver. - * - ************************************************************************/ - -/* - * This sample input file checks input conditions. All entries should - * be valid. - */ - -GlobalInputs { - call_abort_in_serial_instead_of_exit = FALSE -} - -PrimitiveTypes { - i0 = 1 // integer - f0 = 1.0 // float - d0 = 1.0 // double - b0 = TRUE // bool - c0 = (1.0,1.0) // complex - s0 = "a string" // string - box0 = [(0,0),(9,9)] // box -} - -SmartArrays { - i1 = 1, 1, 1, 1, 1 - f1 = 1.0, 1.0, 1.0, 1.0, 1.0 - d1 = 1.0, 1.0, 1.0, 1.0, 1.0 - b1 = TRUE, TRUE, TRUE, TRUE, TRUE - c1 = (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0) - s1 = "a string", "a string", "a string", "a string", "a string" - box1 = [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)] -} - -BasicArrays { - i2 = 1, 1, 1, 1, 1 - f2 = 1.0, 1.0, 1.0, 1.0, 1.0 - d2 = 1.0, 1.0, 1.0, 1.0, 1.0 - b2 = TRUE, TRUE, TRUE, TRUE, TRUE - c2 = (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0) - s2 = "a string", "a string", "a string", "a string", "a string" - box2 = [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)], - [(0,0),(9,9)] -} - -WithDefaultTypes { - -} - -/* - * The following are not used by the test application but demonstrate - * other capabilities of the SAMRAI input database parser. The parser - * supports a simple expression grammar. All arithmetic operations work - * on integer, double, and complex numbers. Numbers will be promoted if - * necessary. - */ - -ExpressionGrammar { - bool = TRUE - arg1 = 1.1 - arg2 = 2.2 - array = arg1, arg2 - - a = arg1 // lookup variable - b = array[1] // array access - c = (arg1) // grouping of expressions - d = (bool ? arg1 : arg2) // C-style ?: if-then-else expressions - e = !bool // logical not for booleans - f = e || bool // logical or for booleans - g = e && bool // logical and for booleans - h = e == bool // equality comparison for all types - i = "hello" != "world" // equality comparison for all types - j = 1 < arg1 // less than comparison for numbers - k = 1 > arg1 // greater than comparison for numbers - l = 1 <= arg1 // less equal comparison for numbers - m = 1 >= arg1 // greater equal comparison for numbers - n = arg1 + arg2 // addition for ints, doubles, complex - o = arg1 - arg2 // subtraction for ints, doubles, complex - p = arg1 * arg2 // multiplication for ints, doubles, complex - q = arg1 / arg2 // division for ints, doubles, complex - r = arg1 ^ arg2 // exponentiation for ints, doubles, complex - s = -arg1 // negation for ints, doubles, complex -} - -/* - * The standard posix functions for doubles are supported, as well as the - * standard ANSI/ISO functions for complex numbers. Doubles may also be - * cast to integers via int(). - */ - -Functions { - double = 0.7 - complex = (double, 1.0) - - ii = int(double) - - a = abs(double) - b = abs(complex) - c = acos(double) - d = asin(double) - e = atan(double) - f = ceil(double) - g = conj(complex) - h = cos(double) - i = cos(complex) - j = cosh(double) - k = cosh(complex) - l = exp(double) - m = exp(complex) - n = fabs(double) - o = floor(double) - p = imag(complex) - q = log10(double) - r = log(double) - s = log(complex) - t = real(complex) - u = sin(double) - v = sin(complex) - w = sinh(double) - x = sinh(complex) - y = sqrt(double) - z = sqrt(complex) - - aa = tan(double) -} - -/* - * Just for fun, let's try some complex expressions. - */ - -ComplexExpressions { - PI = 4*atan(1.0) - PROCS = 10000 - box = [(0,0),(PROCS*20,PROCS*20)] - asci = (PROCS >= 5000 ? "happy" : "sad") -} diff --git a/base/SAMRAI/SAMRAI/source/test/inputdb/test_inputs/inputdb.input b/base/SAMRAI/SAMRAI/source/test/inputdb/test_inputs/inputdb.input new file mode 100644 index 00000000..a424011e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/inputdb/test_inputs/inputdb.input @@ -0,0 +1,185 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for inputdb unit test. + * + ************************************************************************/ + +GlobalInputs { + // If FALSE, when an error is encountered in serial exit(-1) will be called + // instead of SAMRAI_MPI::abort(). + call_abort_in_serial_instead_of_exit = FALSE +} + +PrimitiveTypes { + // Value to test reading of single integer. + i0 = 1 + + // Value to test reading of single float. + f0 = 1.0 + + // Value to test reading of single double. + d0 = 1.0 + + // Value to test reading of single bool. + b0 = TRUE + + // Value to test reading of single dcomplex. + c0 = (1.0,1.0) + + // Value to test reading of single string. + s0 = "a string" + + // Value to test reading of single DatabaseBox. + box0 = [(0,0),(9,9)] +} + +SmartArrays { + // Value to test reading of a vector of integers. + i1 = 1, 1, 1, 1, 1 + + // Value to test reading of a vector of floats. + f1 = 1.0, 1.0, 1.0, 1.0, 1.0 + + // Value to test reading of a vector of doubles. + d1 = 1.0, 1.0, 1.0, 1.0, 1.0 + + // Value to test reading of a vector of bools. + b1 = TRUE, TRUE, TRUE, TRUE, TRUE + + // Value to test reading of a vector of dcomplexes. + c1 = (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0) + + // Value to test reading of a vector of strings. + s1 = "a string", "a string", "a string", "a string", "a string" + + // Value to test reading of a vector of DatabaseBoxes. + box1 = [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)] +} + +BasicArrays { + // Value to test reading of an int*. + i2 = 1, 1, 1, 1, 1 + + // Value to test reading of a float*. + f2 = 1.0, 1.0, 1.0, 1.0, 1.0 + + // Value to test reading of a double*. + d2 = 1.0, 1.0, 1.0, 1.0, 1.0 + + // Value to test reading of a bool*. + b2 = TRUE, TRUE, TRUE, TRUE, TRUE + + // Value to test reading of a dcomplex*. + c2 = (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0), (1.0,1.0) + + // Value to test reading of a string*. + s2 = "a string", "a string", "a string", "a string", "a string" + + // Value to test reading of a DatabaseBox*. + box2 = [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)], + [(0,0),(9,9)] +} + +WithDefaultTypes { + // Keep empty to test reading single values of different types with a + // default value. +} + +/* + * The following are not used by the test application but demonstrate + * other capabilities of the SAMRAI input database parser. The parser + * supports a simple expression grammar. All arithmetic operations work + * on integer, double, and complex numbers. Numbers will be promoted if + * necessary. + */ + +ExpressionGrammar { + bool = TRUE + arg1 = 1.1 + arg2 = 2.2 + array = arg1, arg2 + + a = arg1 // lookup variable + b = array[1] // array access + c = (arg1) // grouping of expressions + d = (bool ? arg1 : arg2) // C-style ?: if-then-else expressions + e = !bool // logical not for booleans + f = e || bool // logical or for booleans + g = e && bool // logical and for booleans + h = e == bool // equality comparison for all types + i = "hello" != "world" // equality comparison for all types + j = 1 < arg1 // less than comparison for numbers + k = 1 > arg1 // greater than comparison for numbers + l = 1 <= arg1 // less equal comparison for numbers + m = 1 >= arg1 // greater equal comparison for numbers + n = arg1 + arg2 // addition for ints, doubles, complex + o = arg1 - arg2 // subtraction for ints, doubles, complex + p = arg1 * arg2 // multiplication for ints, doubles, complex + q = arg1 / arg2 // division for ints, doubles, complex + r = arg1 ^ arg2 // exponentiation for ints, doubles, complex + s = -arg1 // negation for ints, doubles, complex +} + +/* + * The standard posix functions for doubles are supported, as well as the + * standard ANSI/ISO functions for complex numbers. Doubles may also be + * cast to integers via int(). + */ + +Functions { + double = 0.7 + complex = (double, 1.0) + + ii = int(double) + + a = abs(double) + b = abs(complex) + c = acos(double) + d = asin(double) + e = atan(double) + f = ceil(double) + g = conj(complex) + h = cos(double) + i = cos(complex) + j = cosh(double) + k = cosh(complex) + l = exp(double) + m = exp(complex) + n = fabs(double) + o = floor(double) + p = imag(complex) + q = log10(double) + r = log(double) + s = log(complex) + t = real(complex) + u = sin(double) + v = sin(complex) + w = sinh(double) + x = sinh(complex) + y = sqrt(double) + z = sqrt(complex) + + aa = tan(double) +} + +/* + * Just for fun, let's try some complex expressions. + */ + +ComplexExpressions { + PI = 4*atan(1.0) + PROCS = 10000 + box = [(0,0),(PROCS*20,PROCS*20)] + asci = (PROCS >= 5000 ? "happy" : "sad") +} diff --git a/base/SAMRAI/SAMRAI/source/test/logger/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/logger/Makefile.depend index 5200b69b..69e0af47 100644 --- a/base/SAMRAI/SAMRAI/source/test/logger/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/logger/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,7 +14,6 @@ FILE_0=defaultloggertest.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -22,23 +21,20 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h defaultloggertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=userloggertest.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -46,16 +42,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h userloggertest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/logger/Makefile.in b/base/SAMRAI/SAMRAI/source/test/logger/Makefile.in index 01605c47..0a437c50 100644 --- a/base/SAMRAI/SAMRAI/source/test/logger/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/logger/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for timer and statistician test programs ## ######################################################################### @@ -14,6 +14,7 @@ SUBDIR = source/test/logger VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -32,24 +33,30 @@ userloggertest: userloggertest.o $(LIBSAMRAIDEPEND) NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" check: defaultloggertest userloggertest @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ - passed=1; \ - $(OBJECT)/config/serpa-run $$p ./defaultloggertest; \ - if ! grep "Test warning" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ - if grep "Test debug1" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ - if ! grep "Test debug2" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ - if [ $$passed == 1 ] ; then echo "PASSED defaultloggertest"; else echo "FAILED defaultloggertest"; fi; \ + echo " " >> $(REPORT); \ + passed=1; \ + $(OBJECT)/config/serpa-run $$p ./defaultloggertest; \ + if ! grep "Test warning" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ + if grep "Test debug1" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ + if ! grep "Test debug2" defaultloggertest.log.0000000 >& /dev/null ; then passed=0; fi; \ + if [ $$passed == 1 ] ; then echo "PASSED defaultloggertest"; else echo "FAILED defaultloggertest"; fi; \ + if [ $$passed == 0 ] ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ done; \ for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ - passed=1; \ - $(OBJECT)/config/serpa-run $$p ./userloggertest; \ - if ! grep "Test warning" user.log >& /dev/null ; then passed=0; fi; \ - if grep "Test debug1" user.log >& /dev/null ; then passed=0; fi; \ - if ! grep "Test debug2" user.log >& /dev/null ; then passed=0; fi; \ - passed=1; \ - if [ $$passed == 1 ] ; then echo "PASSED userloggertest"; else echo "FAILED userloggertest"; fi; \ + echo " " >> $(REPORT); \ + passed=1; \ + $(OBJECT)/config/serpa-run $$p ./userloggertest; \ + if ! grep "Test warning" user.log >& /dev/null ; then passed=0; fi; \ + if grep "Test debug1" user.log >& /dev/null ; then passed=0; fi; \ + if ! grep "Test debug2" user.log >& /dev/null ; then passed=0; fi; \ + if [ $$passed == 1 ] ; then echo "PASSED userloggertest"; else echo "FAILED userloggertest"; fi; \ + if [ $$passed == 0 ] ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ done; check2d: @@ -61,14 +68,26 @@ check3d: checkcompile: userloggertest defaultloggertest checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean: - $(SAMCLEAN) - $(RM) -rf defaultloggertest userloggertest - $(RM) -rf *.log.* stats +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) defaultloggertest userloggertest include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/logger/README b/base/SAMRAI/SAMRAI/source/test/logger/README new file mode 100644 index 00000000..c2f86d2a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/logger/README @@ -0,0 +1,33 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Test of Logger operations +## +######################################################################### + +This is a test of the Logger class, a singleton for logging error, +debug and warning messages. + +The files included in this directory are as follows: + + defaultloggertest.C - code for the test of Logger + userloggertest.C - code for the test of a subclass + of Logger::Appender + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make defaultloggertest + make userloggertest + + Execution: + make check + +INPUT PARAMETERS +---------------- +There are no input parameters for these tests. + diff --git a/base/SAMRAI/SAMRAI/source/test/logger/defaultloggertest.C b/base/SAMRAI/SAMRAI/source/test/logger/defaultloggertest.C index 055717ce..75163381 100644 --- a/base/SAMRAI/SAMRAI/source/test/logger/defaultloggertest.C +++ b/base/SAMRAI/SAMRAI/source/test/logger/defaultloggertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program to demonstrate/test logging useing default appenders. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/logger/userloggertest.C b/base/SAMRAI/SAMRAI/source/test/logger/userloggertest.C index c950bc1b..b8415400 100644 --- a/base/SAMRAI/SAMRAI/source/test/logger/userloggertest.C +++ b/base/SAMRAI/SAMRAI/source/test/logger/userloggertest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program to demonstrate/test a user defined logger appender * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.depend index 891f2112..393b1960 100644 --- a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,8 +27,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -39,18 +39,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-iterators.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.in b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.in index 03138dab..b7fbb2cb 100644 --- a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the BoxContainer iterator tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/mapped_box_set_iterators -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -24,13 +25,20 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" main: main-iterators.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-iterators.o $(LIBSAMRAI) $(LDLIBS) -o $@ check: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -41,13 +49,26 @@ check3d: checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/README b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/README new file mode 100644 index 00000000..c2d0cf7b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/README @@ -0,0 +1,28 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI box container iterators +## +######################################################################### + +This is a unit test of SAMRAI's BoxContainer iterators. The files included in +this directory are as follows: + + main-iterators.C - unit tester + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/main-iterators.C b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/main-iterators.C index bf4a78ea..75212163 100644 --- a/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/main-iterators.C +++ b/base/SAMRAI/SAMRAI/source/test/mapped_box_set_iterators/main-iterators.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for testing BoxContainer iterators * ************************************************************************/ @@ -75,7 +75,7 @@ int main( if (bi->getBlockId() != bid) { tbox::perr << "FAILED: - Test #1: box id " << bi->getBlockId() << " should have BlockId " << bid << endl; - fail_count++; + ++fail_count; } } @@ -91,14 +91,14 @@ int main( if (bi->getOwnerRank() != owner_rank) { tbox::perr << "FAILED: - Test #2: box id " << bi->getBlockId() << " should have rank " << owner_rank << endl; - fail_count++; + ++fail_count; } } } if (fail_count == 0) { - tbox::pout << "\nPASSED: testmappedboxsetiterator" << endl; + tbox::pout << "\nPASSED: testboxcontaineriterator" << endl; } } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.C index 9757e413..7313be50 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for cell-centered patch data * ************************************************************************/ @@ -17,25 +17,22 @@ #include "MultiblockTester.h" +#include + using namespace SAMRAI; CellMultiblockTest::CellMultiblockTest( const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option): PatchMultiblockTestStrategy(dim), d_dim(dim) { - NULL_USE(do_refine); - NULL_USE(do_coarsen); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -77,9 +74,7 @@ CellMultiblockTest::~CellMultiblockTest() void CellMultiblockTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. @@ -92,17 +87,17 @@ void CellMultiblockTest::readTestInput( void CellMultiblockTest::registerVariables( MultiblockTester* commtest) { - TBOX_ASSERT(commtest != (MultiblockTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::CellVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); commtest->registerVariable(d_variables[i], d_variables[i], @@ -129,11 +124,12 @@ void CellMultiblockTest::initializeDataOnPatch( || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") && (level_number < d_finest_level_number))) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); hier::Box dbox = cell_data->getGhostBox(); @@ -167,29 +163,27 @@ void CellMultiblockTest::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - int num_edge_bdry_boxes = 0; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - num_edge_bdry_boxes = edge_bdry.getSize(); - } + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - num_face_bdry_boxes = face_bdry.getSize(); - } + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); /* * Set node boundary data. @@ -210,7 +204,7 @@ void CellMultiblockTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int ei = 0; ei < num_edge_bdry_boxes; ei++) { + for (int ei = 0; ei < num_edge_bdry_boxes; ++ei) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[ei], patch.getBox(), @@ -228,7 +222,7 @@ void CellMultiblockTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fi = 0; fi < num_face_bdry_boxes; fi++) { + for (int fi = 0; fi < num_face_bdry_boxes; ++fi) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fi], patch.getBox(), @@ -249,25 +243,23 @@ void CellMultiblockTest::setPhysicalBoundaryConditions( void CellMultiblockTest::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry) { const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); hier::Box sing_fill_box(cell_data->getGhostBox() * fill_box); cell_data->fillAll(0.0, sing_fill_box); @@ -278,15 +270,15 @@ void CellMultiblockTest::fillSingularityBoundaryConditions( if (grid_geometry->hasEnhancedConnectivity()) { hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); const hier::BlockId& encon_blk_id = ei->getBlockId(); @@ -294,19 +286,13 @@ void CellMultiblockTest::fillSingularityBoundaryConditions( hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri = neighbors.begin(); - nbri != neighbors.end(); nbri++) { - - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation(rotation, offset, encon_blk_id, patch_blk_id); @@ -330,15 +316,17 @@ void CellMultiblockTest::fillSingularityBoundaryConditions( encon_blk_id); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData( + d_variables[i], getDataContext()))); + TBOX_ASSERT(sing_data); - pdat::CellIterator ciend(encon_fill_box, false); - for (pdat::CellIterator ci(encon_fill_box, true); + pdat::CellIterator ciend(pdat::CellGeometry::end(encon_fill_box)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(encon_fill_box)); ci != ciend; ++ci) { pdat::CellIndex src_index(*ci); pdat::CellGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*cell_data)(*ci, d) += (*sing_data)(src_index, d); } } @@ -350,9 +338,10 @@ void CellMultiblockTest::fillSingularityBoundaryConditions( } if (num_encon_used) { - pdat::CellIterator ciend(sing_fill_box, false); - for (pdat::CellIterator ci(sing_fill_box, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::CellIterator ciend(pdat::CellGeometry::end(sing_fill_box)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(sing_fill_box)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { (*cell_data)(*ci, d) /= num_encon_used; } } @@ -363,25 +352,6 @@ void CellMultiblockTest::fillSingularityBoundaryConditions( } } -void CellMultiblockTest::postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const boost::shared_ptr& context, - const hier::Box& fine_box, - const hier::IntVector& ratio) const -{ - const tbox::Dimension& dim(fine.getDim()); - - pdat::CellDoubleConstantRefine ref_op(dim); - - for (int i = 0; i < d_variables.getSize(); i++) { - - int id = hier::VariableDatabase::getDatabase()-> - mapVariableAndContextToIndex(d_variables[i], context); - - ref_op.refine(fine, coarse, id, id, fine_box, ratio); - } -} /* ************************************************************************* * @@ -402,7 +372,7 @@ bool CellMultiblockTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -414,10 +384,10 @@ bool CellMultiblockTest::verifyResults( hier::Box tbox(pbox); tbox.grow(tgcw); - const std::list& neighbors = - hierarchy->getGridGeometry()->getNeighbors(block_id); + boost::shared_ptr grid_geom( + hierarchy->getGridGeometry()); hier::BoxContainer singularity( - hierarchy->getGridGeometry()->getSingularityBoxContainer(block_id)); + grid_geom->getSingularityBoxContainer(block_id)); hier::IntVector ratio = hierarchy->getPatchLevel(level_number)->getRatioToLevelZero(); @@ -426,18 +396,20 @@ bool CellMultiblockTest::verifyResults( bool test_failed = false; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { double correct = (double)block_id.getBlockValue(); boost::shared_ptr > cell_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(cell_data); int depth = cell_data->getDepth(); - pdat::CellIterator ciend(pbox, false); - for (pdat::CellIterator ci(pbox, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::CellIterator ciend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(pbox)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*cell_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -454,25 +426,28 @@ bool CellMultiblockTest::verifyResults( hier::Box gbox = cell_data->getGhostBox(); - for (std::list::const_iterator - ne = neighbors.begin(); ne != neighbors.end(); ne++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ne = + grid_geom->begin(block_id); + ne != grid_geom->end(block_id); ++ne) { - correct = ne->getBlockId().getBlockValue(); + const hier::BaseGridGeometry::Neighbor& nbr = *ne; + correct = nbr.getBlockId().getBlockValue(); - if (ne->isSingularity()) { + if (nbr.isSingularity()) { continue; } - hier::BoxContainer neighbor_ghost(ne->getTransformedDomain()); + hier::BoxContainer neighbor_ghost(nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(gbox); - for (hier::BoxContainer::iterator ng(neighbor_ghost); + for (hier::BoxContainer::iterator ng = neighbor_ghost.begin(); ng != neighbor_ghost.end(); ++ng) { - pdat::CellIterator ciend(*ng, false); - for (pdat::CellIterator ci(*ng, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::CellIterator ciend(pdat::CellGeometry::end(*ng)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(*ng)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*cell_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, @@ -490,15 +465,14 @@ bool CellMultiblockTest::verifyResults( } } - boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr pgeom = patch.getPatchGeometry(); + TBOX_ASSERT(pgeom); - for (int b = 0; b < d_dim.getValue(); b++) { - tbox::Array bdry = + for (int b = 0; b < d_dim.getValue(); ++b) { + const std::vector& bdry = pgeom->getCodimensionBoundaries(b + 1); - for (int k = 0; k < bdry.size(); k++) { + for (int k = 0; k < static_cast(bdry.size()); ++k) { hier::Box fill_box = pgeom->getBoundaryFillBox(bdry[k], patch.getBox(), tgcw); @@ -508,16 +482,18 @@ bool CellMultiblockTest::verifyResults( correct = 0.0; int num_sing_neighbors = 0; - for (std::list::const_iterator ns( - neighbors.begin()); ns != neighbors.end(); ns++) { - if (ns->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ns( + grid_geom->begin(block_id)); + ns != grid_geom->end(block_id); ++ns) { + const hier::BaseGridGeometry::Neighbor& nbr = *ns; + if (nbr.isSingularity()) { hier::BoxContainer neighbor_ghost( - ns->getTransformedDomain()); + nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(fill_box); if (neighbor_ghost.size()) { - num_sing_neighbors++; - correct += ns->getBlockId().getBlockValue(); + ++num_sing_neighbors; + correct += nbr.getBlockId().getBlockValue(); } } } @@ -536,9 +512,10 @@ bool CellMultiblockTest::verifyResults( correct = (double)(bdry[k].getLocationIndex() + 100); } - pdat::CellIterator ciend(fill_box, false); - for (pdat::CellIterator ci(fill_box, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::CellIterator ciend(pdat::CellGeometry::end(fill_box)); + for (pdat::CellIterator ci(pdat::CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*cell_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.h index 5111eb4d..434cba52 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/CellMultiblockTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for cell-centered patch data * ************************************************************************/ @@ -35,8 +35,6 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option); /** @@ -46,7 +44,7 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy /** * User-supplied boundary conditions. Note that we do not implement - * user-defined coarsen and refine operations. + * user-defined refine operations. */ void setPhysicalBoundaryConditions( @@ -58,7 +56,7 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); @@ -67,7 +65,7 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ void @@ -108,15 +106,6 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy const int level_number, const hier::BlockId& block_id); - /// - void - postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const boost::shared_ptr& context, - const hier::Box& fine_box, - const hier::IntVector& ratio) const; - private: /** * Function for reading test data from input file. @@ -135,12 +124,12 @@ class CellMultiblockTest:public PatchMultiblockTestStrategy /* * Data members specific to this cell data test. */ -// tbox::Array > d_skel_grid_geometry; +// std::vector > d_skel_grid_geometry; string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.C index a8bf0a6a..053a890c 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -17,25 +17,22 @@ #include "MultiblockTester.h" +#include + using namespace SAMRAI; EdgeMultiblockTest::EdgeMultiblockTest( const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option): PatchMultiblockTestStrategy(dim), d_dim(dim) { - NULL_USE(do_refine); - NULL_USE(do_coarsen); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -71,9 +68,7 @@ EdgeMultiblockTest::~EdgeMultiblockTest() void EdgeMultiblockTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. @@ -86,17 +81,17 @@ void EdgeMultiblockTest::readTestInput( void EdgeMultiblockTest::registerVariables( MultiblockTester* commtest) { - TBOX_ASSERT(commtest != (MultiblockTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::EdgeVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); commtest->registerVariable(d_variables[i], d_variables[i], @@ -123,11 +118,12 @@ void EdgeMultiblockTest::initializeDataOnPatch( || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") && (level_number < d_finest_level_number))) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); hier::Box dbox = edge_data->getGhostBox(); @@ -161,48 +157,46 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - int num_edge_bdry_boxes = 0; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - num_edge_bdry_boxes = edge_bdry.getSize(); - } + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - num_face_bdry_boxes = face_bdry.getSize(); - } + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); /* * Set node boundary data. */ - for (int nb = 0; nb < num_node_bdry_boxes; nb++) { + for (int nb = 0; nb < num_node_bdry_boxes; ++nb) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[nb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_edge_box = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); if (!node_bdry[nb].getIsMultiblockSingularity()) { - pdat::EdgeIterator niend(fill_box, axis, false); - for (pdat::EdgeIterator ni(fill_box, axis, true); + pdat::EdgeIterator niend(pdat::EdgeGeometry::end(fill_box, axis)); + for (pdat::EdgeIterator ni(pdat::EdgeGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_edge_box.contains(*ni)) { - for (int d = 0; d < edge_data->getDepth(); d++) { + for (int d = 0; d < edge_data->getDepth(); ++d) { (*edge_data)(*ni, d) = (double)(node_bdry[nb].getLocationIndex() + 100); } @@ -216,25 +210,25 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int eb = 0; eb < num_edge_bdry_boxes; eb++) { + for (int eb = 0; eb < num_edge_bdry_boxes; ++eb) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[eb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_edge_box = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); hier::Index plower(patch_edge_box.lower()); hier::Index pupper(patch_edge_box.upper()); if (!edge_bdry[eb].getIsMultiblockSingularity()) { - pdat::EdgeIterator niend(fill_box, axis, false); - for (pdat::EdgeIterator ni(fill_box, axis, true); + pdat::EdgeIterator niend(pdat::EdgeGeometry::end(fill_box, axis)); + for (pdat::EdgeIterator ni(pdat::EdgeGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_edge_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && edge_bdry[eb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == @@ -246,7 +240,7 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < edge_data->getDepth(); d++) { + for (int d = 0; d < edge_data->getDepth(); ++d) { (*edge_data)(*ni, d) = (double)(edge_bdry[eb].getLocationIndex() + 100); @@ -263,13 +257,13 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fb = 0; fb < num_face_bdry_boxes; fb++) { + for (int fb = 0; fb < num_face_bdry_boxes; ++fb) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_edge_box = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); @@ -277,12 +271,12 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( hier::Index pupper(patch_edge_box.upper()); if (!face_bdry[fb].getIsMultiblockSingularity()) { - pdat::EdgeIterator niend(fill_box, axis, false); - for (pdat::EdgeIterator ni(fill_box, axis, true); + pdat::EdgeIterator niend(pdat::EdgeGeometry::end(fill_box, axis)); + for (pdat::EdgeIterator ni(pdat::EdgeGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_edge_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && face_bdry[fb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == @@ -311,42 +305,39 @@ void EdgeMultiblockTest::setPhysicalBoundaryConditions( void EdgeMultiblockTest::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry) { const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); hier::Box sing_fill_box(edge_data->getGhostBox() * fill_box); int depth = edge_data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - hier::Box pbox = - pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + hier::Box pbox = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::EdgeIterator niend(sing_fill_box, axis, false); - for (pdat::EdgeIterator ni(sing_fill_box, axis, true); + pdat::EdgeIterator niend(pdat::EdgeGeometry::end(sing_fill_box, axis)); + for (pdat::EdgeIterator ni(pdat::EdgeGeometry::begin(sing_fill_box, axis)); ni != niend; ++ni) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && bbox.getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == pupper(n)) { use_index = false; @@ -355,7 +346,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*edge_data)(*ni, d) = 0.0; } } @@ -367,32 +358,28 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( if (grid_geometry->hasEnhancedConnectivity()) { hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { const hier::BlockId& encon_blk_id = ei->getBlockId(); boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); hier::Transformation::RotationIdentifier rotation = hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri(neighbors.begin()); nbri != neighbors.end(); nbri++) { - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation(rotation, offset, encon_blk_id, patch_blk_id); @@ -416,10 +403,12 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( encon_blk_id); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData( + d_variables[i], getDataContext()))); + TBOX_ASSERT(sing_data); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox( pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis)); @@ -427,11 +416,11 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::EdgeIterator ciend(sing_fill_box, axis, false); - for (pdat::EdgeIterator ci(sing_fill_box, axis, true); + pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(sing_fill_box, axis)); + for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -444,7 +433,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( pdat::EdgeIndex src_index(*ci); pdat::EdgeGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*edge_data)(*ci, d) += (*sing_data)(src_index, d); } } @@ -460,7 +449,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( if (num_encon_used) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); @@ -468,11 +457,11 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::EdgeIterator ciend(sing_fill_box, axis, false); - for (pdat::EdgeIterator ci(sing_fill_box, axis, true); + pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(sing_fill_box, axis)); + for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -481,7 +470,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*edge_data)(*ci, d) /= num_encon_used; } } @@ -495,7 +484,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( * from which to acquire data. */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::EdgeGeometry::toEdgeBox(patch.getBox(), axis); @@ -503,11 +492,11 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::EdgeIterator ciend(sing_fill_box, axis, false); - for (pdat::EdgeIterator ci(sing_fill_box, axis, true); + pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(sing_fill_box, axis)); + for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -516,7 +505,7 @@ void EdgeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*edge_data)(*ci, d) = (double)bbox.getLocationIndex() + 200.0; } @@ -547,7 +536,7 @@ bool EdgeMultiblockTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -559,10 +548,11 @@ bool EdgeMultiblockTest::verifyResults( hier::Box tbox(pbox); tbox.grow(tgcw); - const std::list& neighbors = - hierarchy->getGridGeometry()->getNeighbors(block_id); + boost::shared_ptr grid_geom( + hierarchy->getGridGeometry()); + hier::BoxContainer singularity( - hierarchy->getGridGeometry()->getSingularityBoxContainer(block_id)); + grid_geom->getSingularityBoxContainer(block_id)); hier::IntVector ratio = hierarchy->getPatchLevel(level_number)->getRatioToLevelZero(); @@ -571,23 +561,24 @@ bool EdgeMultiblockTest::verifyResults( bool test_failed = false; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { double correct = (double)block_id.getBlockValue(); boost::shared_ptr > edge_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(edge_data); int depth = edge_data->getDepth(); hier::Box interior_box(pbox); interior_box.grow(hier::IntVector(d_dim, -1)); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - pdat::EdgeIterator ciend(interior_box, axis, false); - for (pdat::EdgeIterator ci(interior_box, axis, true); - ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { + pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(interior_box, axis)); + for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(interior_box, axis)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*edge_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -605,32 +596,34 @@ bool EdgeMultiblockTest::verifyResults( hier::Box gbox = edge_data->getGhostBox(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_edge_box = pdat::EdgeGeometry::toEdgeBox(pbox, axis); hier::BoxContainer tested_neighbors; hier::BoxContainer sing_edge_boxlist; - for (hier::BoxContainer::iterator si(singularity); + for (hier::BoxContainer::iterator si = singularity.begin(); si != singularity.end(); ++si) { sing_edge_boxlist.pushFront( pdat::EdgeGeometry::toEdgeBox(*si, axis)); } - for (std::list::const_iterator - ne(neighbors.begin()); ne != neighbors.end(); ne++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ne( + grid_geom->begin(block_id)); + ne != grid_geom->end(block_id); ++ne) { - if (ne->isSingularity()) { + const hier::BaseGridGeometry::Neighbor& nbr = *ne; + if (nbr.isSingularity()) { continue; } - correct = ne->getBlockId().getBlockValue(); + correct = nbr.getBlockId().getBlockValue(); - hier::BoxContainer neighbor_ghost(ne->getTransformedDomain()); + hier::BoxContainer neighbor_ghost(nbr.getTransformedDomain()); hier::BoxContainer neighbor_edge_ghost; - for (hier::BoxContainer::iterator nn(neighbor_ghost); + for (hier::BoxContainer::iterator nn = neighbor_ghost.begin(); nn != neighbor_ghost.end(); ++nn) { hier::Box neighbor_ghost_interior( pdat::EdgeGeometry::toEdgeBox(*nn, axis)); @@ -646,16 +639,16 @@ bool EdgeMultiblockTest::verifyResults( neighbor_edge_ghost.removeIntersections(sing_edge_boxlist); neighbor_edge_ghost.removeIntersections(tested_neighbors); - for (hier::BoxContainer::iterator ng(neighbor_edge_ghost); + for (hier::BoxContainer::iterator ng = neighbor_edge_ghost.begin(); ng != neighbor_edge_ghost.end(); ++ng) { - hier::Box::iterator ciend(*ng, false); - for (hier::Box::iterator ci(*ng, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(ng->end()); + for (hier::Box::iterator ci(ng->begin()); ci != ciend; ++ci) { pdat::EdgeIndex ei(*ci, 0, 0); ei.setAxis(axis); if (!patch_edge_box.contains(ei)) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*edge_data)(ei, d); if (!tbox::MathUtilities::equalEps(correct, @@ -680,11 +673,11 @@ bool EdgeMultiblockTest::verifyResults( boost::shared_ptr pgeom(patch.getPatchGeometry()); - for (int b = 0; b < d_dim.getValue(); b++) { - tbox::Array bdry = + for (int b = 0; b < d_dim.getValue(); ++b) { + const std::vector& bdry = pgeom->getCodimensionBoundaries(b + 1); - for (int k = 0; k < bdry.size(); k++) { + for (int k = 0; k < static_cast(bdry.size()); ++k) { hier::Box fill_box = pgeom->getBoundaryFillBox(bdry[k], patch.getBox(), tgcw); @@ -694,16 +687,18 @@ bool EdgeMultiblockTest::verifyResults( correct = 0.0; int num_sing_neighbors = 0; - for (std::list::const_iterator - ns(neighbors.begin()); ns != neighbors.end(); ns++) { - if (ns->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ns( + grid_geom->begin(block_id)); + ns != grid_geom->end(block_id); ++ns) { + const hier::BaseGridGeometry::Neighbor& nbr = *ns; + if (nbr.isSingularity()) { hier::BoxContainer neighbor_ghost( - ns->getTransformedDomain()); + nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(fill_box); if (neighbor_ghost.size()) { - num_sing_neighbors++; - correct += ns->getBlockId().getBlockValue(); + ++num_sing_neighbors; + correct += nbr.getBlockId().getBlockValue(); } } } @@ -722,18 +717,18 @@ bool EdgeMultiblockTest::verifyResults( correct = (double)(bdry[k].getLocationIndex() + 100); } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (int axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_edge_box = pdat::EdgeGeometry::toEdgeBox(pbox, axis); - pdat::EdgeIterator ciend(fill_box, axis, false); - for (pdat::EdgeIterator ci(fill_box, axis, true); + pdat::EdgeIterator ciend(pdat::EdgeGeometry::end(fill_box, axis)); + for (pdat::EdgeIterator ci(pdat::EdgeGeometry::begin(fill_box, axis)); ci != ciend; ++ci) { if (!patch_edge_box.contains(*ci)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis != n && bdry[k].getBox().numberCells(n) == 1) { if ((*ci)(n) == patch_edge_box.lower() (n) || @@ -745,7 +740,7 @@ bool EdgeMultiblockTest::verifyResults( } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*edge_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, @@ -790,15 +785,14 @@ void EdgeMultiblockTest::postprocessRefine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(fine.getDim()); - - pdat::EdgeDoubleConstantRefine ref_op(dim); + pdat::EdgeDoubleConstantRefine ref_op; hier::BoxContainer fine_box_list(fine_box); + hier::BoxContainer empty_box_list; xfer::BoxGeometryVariableFillPattern fill_pattern; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { int id = hier::VariableDatabase::getDatabase()-> mapVariableAndContextToIndex(d_variables[i], context); @@ -809,6 +803,7 @@ void EdgeMultiblockTest::postprocessRefine( boost::shared_ptr fine_overlap( fill_pattern.computeFillBoxesOverlap( fine_box_list, + empty_box_list, fine.getBox(), fine.getPatchData(id)->getGhostBox(), *fine_pdf)); diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.h index 72f9296d..97b64cd7 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/EdgeMultiblockTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/EdgeData.h" #include "SAMRAI/tbox/Database.h" @@ -22,7 +21,7 @@ #include "PatchMultiblockTestStrategy.h" #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -44,8 +43,6 @@ class EdgeMultiblockTest:public PatchMultiblockTestStrategy const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option); /** @@ -55,7 +52,7 @@ class EdgeMultiblockTest:public PatchMultiblockTestStrategy /** * User-supplied boundary conditions. Note that we do not implement - * user-defined coarsen and refine operations. + * user-defined refine operations. */ void setPhysicalBoundaryConditions( @@ -67,7 +64,7 @@ class EdgeMultiblockTest:public PatchMultiblockTestStrategy fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry); @@ -76,7 +73,7 @@ class EdgeMultiblockTest:public PatchMultiblockTestStrategy * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ void @@ -144,7 +141,7 @@ class EdgeMultiblockTest:public PatchMultiblockTestStrategy string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.C index 2296e4e5..05271a34 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for face-centered patch data * ************************************************************************/ @@ -18,25 +18,22 @@ #include "MultiblockTester.h" +#include + using namespace SAMRAI; FaceMultiblockTest::FaceMultiblockTest( const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option): PatchMultiblockTestStrategy(dim), d_dim(dim) { - NULL_USE(do_refine); - NULL_USE(do_coarsen); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -72,9 +69,7 @@ FaceMultiblockTest::~FaceMultiblockTest() void FaceMultiblockTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. @@ -87,17 +82,17 @@ void FaceMultiblockTest::readTestInput( void FaceMultiblockTest::registerVariables( MultiblockTester* commtest) { - TBOX_ASSERT(commtest != (MultiblockTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::FaceVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); commtest->registerVariable(d_variables[i], d_variables[i], @@ -124,11 +119,12 @@ void FaceMultiblockTest::initializeDataOnPatch( || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") && (level_number < d_finest_level_number))) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); hier::Box dbox = face_data->getGhostBox(); @@ -162,48 +158,46 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - int num_edge_bdry_boxes = 0; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - num_edge_bdry_boxes = edge_bdry.getSize(); - } + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - num_face_bdry_boxes = face_bdry.getSize(); - } + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); /* * Set node boundary data. */ - for (int nb = 0; nb < num_node_bdry_boxes; nb++) { + for (int nb = 0; nb < num_node_bdry_boxes; ++nb) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[nb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_face_box = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); if (!node_bdry[nb].getIsMultiblockSingularity()) { - pdat::FaceIterator niend(fill_box, axis, false); - for (pdat::FaceIterator ni(fill_box, axis, true); + pdat::FaceIterator niend(pdat::FaceGeometry::end(fill_box, axis)); + for (pdat::FaceIterator ni(pdat::FaceGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_face_box.contains(*ni)) { - for (int d = 0; d < face_data->getDepth(); d++) { + for (int d = 0; d < face_data->getDepth(); ++d) { (*face_data)(*ni, d) = (double)(node_bdry[nb].getLocationIndex() + 100); } @@ -217,25 +211,25 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int eb = 0; eb < num_edge_bdry_boxes; eb++) { + for (int eb = 0; eb < num_edge_bdry_boxes; ++eb) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[eb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_face_box = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); hier::Index plower(patch_face_box.lower()); hier::Index pupper(patch_face_box.upper()); if (!edge_bdry[eb].getIsMultiblockSingularity()) { - pdat::FaceIterator niend(fill_box, axis, false); - for (pdat::FaceIterator ni(fill_box, axis, true); - ni != niend; ++ni) { + pdat::FaceIterator niend(pdat::FaceGeometry::end(fill_box, axis)); + for (pdat::FaceIterator ni(pdat::FaceGeometry::begin(fill_box, axis)); + ni != niend; ++ni) { if (!patch_face_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && edge_bdry[eb].getBox().numberCells(n) == 1) { if ((*ni)(0) == plower(0) || (*ni)(0) == @@ -247,7 +241,7 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < face_data->getDepth(); d++) { + for (int d = 0; d < face_data->getDepth(); ++d) { (*face_data)(*ni, d) = (double)(edge_bdry[eb].getLocationIndex() + 100); @@ -264,25 +258,25 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fb = 0; fb < num_face_bdry_boxes; fb++) { + for (int fb = 0; fb < num_face_bdry_boxes; ++fb) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_face_box = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); hier::Index plower(patch_face_box.lower()); hier::Index pupper(patch_face_box.upper()); if (!face_bdry[fb].getIsMultiblockSingularity()) { - pdat::FaceIterator niend(fill_box, axis, false); - for (pdat::FaceIterator ni(fill_box, axis, true); + pdat::FaceIterator niend(pdat::FaceGeometry::end(fill_box, axis)); + for (pdat::FaceIterator ni(pdat::FaceGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_face_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && face_bdry[fb].getBox().numberCells(n) == 1) { if ((*ni)(0) == plower(0) || (*ni)(0) == @@ -294,7 +288,7 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < face_data->getDepth(); d++) { + for (int d = 0; d < face_data->getDepth(); ++d) { (*face_data)(*ni, d) = (double)(face_bdry[fb].getLocationIndex() + 100); @@ -314,41 +308,39 @@ void FaceMultiblockTest::setPhysicalBoundaryConditions( void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry) { const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); hier::Box sing_fill_box(face_data->getGhostBox() * fill_box); int depth = face_data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::FaceIterator niend(sing_fill_box, axis, false); - for (pdat::FaceIterator ni(sing_fill_box, axis, true); + pdat::FaceIterator niend(pdat::FaceGeometry::end(sing_fill_box, axis)); + for (pdat::FaceIterator ni(pdat::FaceGeometry::begin(sing_fill_box, axis)); ni != niend; ++ni) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ni)(0) == plower(0) || (*ni)(0) == pupper(0)) { use_index = false; @@ -357,7 +349,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*face_data)(*ni, d) = 0.0; } } @@ -368,15 +360,15 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( if (grid_geometry->hasEnhancedConnectivity()) { hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); const hier::BlockId& encon_blk_id = ei->getBlockId(); @@ -384,18 +376,13 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri(neighbors.begin()); nbri != neighbors.end(); nbri++) { - - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation(rotation, offset, encon_blk_id, patch_blk_id); @@ -414,16 +401,17 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Transformation::calculateReverseShift( back_shift, offset, rotation); - hier::Transformation back_trans(back_rotate, back_shift, patch_blk_id, encon_blk_id); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData( + d_variables[i], getDataContext()))); + TBOX_ASSERT(sing_data); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox( pdat::FaceGeometry::toFaceBox(patch.getBox(), axis)); @@ -431,11 +419,11 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::FaceIterator ciend(sing_fill_box, axis, false); - for (pdat::FaceIterator ci(sing_fill_box, axis, true); + pdat::FaceIterator ciend(pdat::FaceGeometry::end(sing_fill_box, axis)); + for (pdat::FaceIterator ci(pdat::FaceGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(0) == plower(0) || (*ci)(0) == pupper(0)) { use_index = false; @@ -448,7 +436,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( pdat::FaceIndex src_index(*ci); pdat::FaceGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*face_data)(*ci, d) += (*sing_data)(src_index, d); } } @@ -463,7 +451,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( if (num_encon_used) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); @@ -471,11 +459,11 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::FaceIterator ciend(sing_fill_box, axis, false); - for (pdat::FaceIterator ci(sing_fill_box, axis, true); + pdat::FaceIterator ciend(pdat::FaceGeometry::end(sing_fill_box, axis)); + for (pdat::FaceIterator ci(pdat::FaceGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(0) == plower(0) || (*ci)(0) == pupper(0)) { use_index = false; @@ -484,7 +472,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*face_data)(*ci, d) /= num_encon_used; } } @@ -498,7 +486,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( * from which to acquire data. */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::FaceGeometry::toFaceBox(patch.getBox(), axis); @@ -506,11 +494,11 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::FaceIterator ciend(sing_fill_box, axis, false); - for (pdat::FaceIterator ci(sing_fill_box, axis, true); + pdat::FaceIterator ciend(pdat::FaceGeometry::end(sing_fill_box, axis)); + for (pdat::FaceIterator ci(pdat::FaceGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(0) == plower(0) || (*ci)(0) == pupper(0)) { use_index = false; @@ -519,7 +507,7 @@ void FaceMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*face_data)(*ci, d) = (double)bbox.getLocationIndex() + 200.0; } @@ -550,7 +538,7 @@ bool FaceMultiblockTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -562,10 +550,11 @@ bool FaceMultiblockTest::verifyResults( hier::Box tbox(pbox); tbox.grow(tgcw); - const std::list& neighbors = - hierarchy->getGridGeometry()->getNeighbors(block_id); + boost::shared_ptr grid_geom( + hierarchy->getGridGeometry()); + hier::BoxContainer singularity( - hierarchy->getGridGeometry()->getSingularityBoxContainer(block_id)); + grid_geom->getSingularityBoxContainer(block_id)); hier::IntVector ratio = hierarchy->getPatchLevel(level_number)->getRatioToLevelZero(); @@ -574,23 +563,24 @@ bool FaceMultiblockTest::verifyResults( bool test_failed = false; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { double correct = (double)block_id.getBlockValue(); boost::shared_ptr > face_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(face_data); int depth = face_data->getDepth(); hier::Box interior_box(pbox); interior_box.grow(hier::IntVector(d_dim, -1)); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - pdat::FaceIterator ciend(interior_box, axis, false); - for (pdat::FaceIterator ci(interior_box, axis, true); - ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { + pdat::FaceIterator ciend(pdat::FaceGeometry::end(interior_box, axis)); + for (pdat::FaceIterator ci(pdat::FaceGeometry::begin(interior_box, axis)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*face_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -608,24 +598,26 @@ bool FaceMultiblockTest::verifyResults( hier::Box gbox = face_data->getGhostBox(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_face_box = pdat::FaceGeometry::toFaceBox(pbox, axis); hier::BoxContainer tested_neighbors; - for (std::list::const_iterator - ne(neighbors.begin()); ne != neighbors.end(); ne++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ne( + grid_geom->begin(block_id)); + ne != grid_geom->end(block_id); ++ne) { - if (ne->isSingularity()) { + const hier::BaseGridGeometry::Neighbor& nbr = *ne; + if (nbr.isSingularity()) { continue; } - correct = ne->getBlockId().getBlockValue(); + correct = nbr.getBlockId().getBlockValue(); - hier::BoxContainer neighbor_ghost(ne->getTransformedDomain()); + hier::BoxContainer neighbor_ghost(nbr.getTransformedDomain()); hier::BoxContainer neighbor_face_ghost; - for (hier::BoxContainer::iterator nn(neighbor_ghost); + for (hier::BoxContainer::iterator nn = neighbor_ghost.begin(); nn != neighbor_ghost.end(); ++nn) { hier::Box neighbor_ghost_interior( pdat::FaceGeometry::toFaceBox(*nn, axis)); @@ -639,15 +631,15 @@ bool FaceMultiblockTest::verifyResults( neighbor_face_ghost.removeIntersections(tested_neighbors); - for (hier::BoxContainer::iterator ng(neighbor_face_ghost); + for (hier::BoxContainer::iterator ng = neighbor_face_ghost.begin(); ng != neighbor_face_ghost.end(); ++ng) { - hier::Box::iterator ciend(*ng, false); - for (hier::Box::iterator ci(*ng, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(ng->end()); + for (hier::Box::iterator ci(ng->begin()); ci != ciend; ++ci) { pdat::FaceIndex fi(*ci, 0, 0); fi.setAxis(axis); if (!patch_face_box.contains(fi)) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*face_data)(fi, d); if (!tbox::MathUtilities::equalEps(correct, @@ -671,11 +663,11 @@ bool FaceMultiblockTest::verifyResults( boost::shared_ptr pgeom(patch.getPatchGeometry()); - for (int b = 0; b < d_dim.getValue(); b++) { - tbox::Array bdry = + for (int b = 0; b < d_dim.getValue(); ++b) { + const std::vector bdry = pgeom->getCodimensionBoundaries(b + 1); - for (int k = 0; k < bdry.size(); k++) { + for (int k = 0; k < static_cast(bdry.size()); ++k) { hier::Box fill_box = pgeom->getBoundaryFillBox(bdry[k], patch.getBox(), tgcw); @@ -685,16 +677,18 @@ bool FaceMultiblockTest::verifyResults( correct = 0.0; int num_sing_neighbors = 0; - for (std::list::const_iterator - ns(neighbors.begin()); ns != neighbors.end(); ns++) { - if (ns->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ns( + grid_geom->begin(block_id)); + ns != grid_geom->end(block_id); ++ns) { + const hier::BaseGridGeometry::Neighbor& nbr = *ns; + if (nbr.isSingularity()) { hier::BoxContainer neighbor_ghost( - ns->getTransformedDomain()); + nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(fill_box); if (neighbor_ghost.size()) { - num_sing_neighbors++; - correct += ns->getBlockId().getBlockValue(); + ++num_sing_neighbors; + correct += nbr.getBlockId().getBlockValue(); } } } @@ -713,18 +707,18 @@ bool FaceMultiblockTest::verifyResults( correct = (double)(bdry[k].getLocationIndex() + 100); } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_face_box = pdat::FaceGeometry::toFaceBox(pbox, axis); - pdat::FaceIterator ciend(fill_box, axis, false); - for (pdat::FaceIterator ci(fill_box, axis, true); + pdat::FaceIterator ciend(pdat::FaceGeometry::end(fill_box, axis)); + for (pdat::FaceIterator ci(pdat::FaceGeometry::begin(fill_box, axis)); ci != ciend; ++ci) { if (!patch_face_box.contains(*ci)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bdry[k].getBox().numberCells(n) == 1) { if ((*ci)(0) == patch_face_box.lower() (0) || @@ -736,7 +730,7 @@ bool FaceMultiblockTest::verifyResults( } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*face_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, @@ -781,15 +775,14 @@ void FaceMultiblockTest::postprocessRefine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(fine.getDim()); - - pdat::FaceDoubleConstantRefine ref_op(dim); + pdat::FaceDoubleConstantRefine ref_op; hier::BoxContainer fine_box_list(fine_box); + hier::BoxContainer empty_box_list; xfer::BoxGeometryVariableFillPattern fill_pattern; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { int id = hier::VariableDatabase::getDatabase()-> mapVariableAndContextToIndex(d_variables[i], context); @@ -800,6 +793,7 @@ void FaceMultiblockTest::postprocessRefine( boost::shared_ptr fine_overlap( fill_pattern.computeFillBoxesOverlap( fine_box_list, + empty_box_list, fine.getBox(), fine.getPatchData(id)->getGhostBox(), *fine_pdf)); diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.h index 4c6f4174..0291f8d3 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/FaceMultiblockTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/FaceData.h" #include "SAMRAI/pdat/FaceDoubleConstantRefine.h" @@ -23,7 +22,7 @@ #include "PatchMultiblockTestStrategy.h" #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -45,8 +44,6 @@ class FaceMultiblockTest:public PatchMultiblockTestStrategy const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option); /** @@ -56,7 +53,7 @@ class FaceMultiblockTest:public PatchMultiblockTestStrategy /** * User-supplied boundary conditions. Note that we do not implement - * user-defined coarsen and refine operations. + * user-defined refine operations. */ void setPhysicalBoundaryConditions( @@ -68,7 +65,7 @@ class FaceMultiblockTest:public PatchMultiblockTestStrategy fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry); @@ -77,7 +74,7 @@ class FaceMultiblockTest:public PatchMultiblockTestStrategy * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ void @@ -145,7 +142,7 @@ class FaceMultiblockTest:public PatchMultiblockTestStrategy string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.depend index 8763cbf0..5fb003b8 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -47,12 +47,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -73,7 +75,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -87,8 +88,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -98,22 +99,17 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CellMultiblockTest.C CellMultiblockTest.h MultiblockTester.h \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -122,12 +118,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=EdgeMultiblockTest.o DEPENDS_1:=\ @@ -165,12 +160,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -194,7 +191,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -208,8 +204,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -220,22 +216,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ $(INCLUDE_SAM)/SAMRAI/xfer/BoxGeometryVariableFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ EdgeMultiblockTest.C EdgeMultiblockTest.h MultiblockTester.h \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -246,12 +237,11 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=FaceMultiblockTest.o DEPENDS_2:=\ @@ -289,12 +279,14 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -318,7 +310,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -332,8 +323,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -344,22 +335,17 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ $(INCLUDE_SAM)/SAMRAI/xfer/BoxGeometryVariableFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ FaceMultiblockTest.C FaceMultiblockTest.h MultiblockTester.h \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -370,17 +356,17 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=MultiblockTester.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -390,6 +376,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -402,7 +389,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -414,18 +404,17 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -433,11 +422,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -451,12 +441,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -466,9 +456,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -480,25 +471,18 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MultiblockTester.C MultiblockTester.h \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -506,12 +490,11 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=NodeMultiblockTest.o DEPENDS_4:=\ @@ -549,12 +532,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -577,7 +562,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -591,8 +575,8 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -602,22 +586,17 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MultiblockTester.h NodeMultiblockTest.C NodeMultiblockTest.h \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -628,12 +607,11 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_4}: ${DEPENDS_4} FILE_5=PatchMultiblockTestStrategy.o DEPENDS_5:=\ @@ -671,12 +649,14 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -694,7 +674,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -708,8 +687,8 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -719,133 +698,31 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MultiblockTester.h PatchMultiblockTestStrategy.C \ PatchMultiblockTestStrategy.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=Pointer-MultiblockTester.o -DEPENDS_6:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MultiblockTester.h Pointer-MultiblockTester.C +${FILE_5}: ${DEPENDS_5} -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} - -FILE_7=SideMultiblockTest.o -DEPENDS_7:=\ +FILE_6=SideMultiblockTest.o +DEPENDS_6:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ @@ -880,12 +757,14 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -909,7 +788,6 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -923,8 +801,8 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -935,23 +813,18 @@ DEPENDS_7:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ $(INCLUDE_SAM)/SAMRAI/xfer/BoxGeometryVariableFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ MultiblockTester.h PatchMultiblockTestStrategy.h \ SideMultiblockTest.C SideMultiblockTest.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ +DEPENDS_6 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ @@ -961,17 +834,17 @@ DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} -FILE_8=main.o -DEPENDS_8:=\ +${FILE_6}: ${DEPENDS_6} + +FILE_7=main.o +DEPENDS_7:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -981,6 +854,7 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -992,7 +866,10 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -1004,12 +881,14 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -1051,7 +930,6 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -1068,9 +946,9 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -1082,24 +960,19 @@ DEPENDS_8:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ CellMultiblockTest.h EdgeMultiblockTest.h FaceMultiblockTest.h \ MultiblockTester.h NodeMultiblockTest.h \ PatchMultiblockTestStrategy.h SideMultiblockTest.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ +DEPENDS_7 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -1110,10 +983,9 @@ DEPENDS_8 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} + +${FILE_7}: ${DEPENDS_7} diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.in b/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.in index 132f58b8..00acdee3 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI multiblock tests ## ######################################################################### @@ -14,16 +14,18 @@ SUBDIR = source/test/mblkcomm VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 -NUM_TESTS = 25 +NUM_TESTS = 27 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = MultiblockTester.o \ PatchMultiblockTestStrategy.o \ @@ -32,7 +34,6 @@ CXX_OBJS = MultiblockTester.o \ EdgeMultiblockTest.o \ FaceMultiblockTest.o \ NodeMultiblockTest.o \ - Pointer-MultiblockTester.o \ SideMultiblockTest.o @@ -46,28 +47,49 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: clean-check +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.C index 5b2aa4b0..1854fd2a 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch data communication tests. * ************************************************************************/ @@ -12,13 +12,13 @@ #include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/hier/CoarseFineBoundary.h" -#include "SAMRAI/hier/CoarsenOperator.h" #include "PatchMultiblockTestStrategy.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/mesh/MultiblockGriddingTagger.h" #include "SAMRAI/hier/RefineOperator.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/hier/VariableDatabase.h" @@ -38,21 +38,18 @@ MultiblockTester::MultiblockTester( boost::shared_ptr& main_input_db, boost::shared_ptr& hierarchy, PatchMultiblockTestStrategy* data_test, - bool do_refine, - bool do_coarsen, const string& refine_option): - xfer::CoarsenPatchStrategy(dim), - xfer::RefinePatchStrategy(dim), + xfer::RefinePatchStrategy(), + xfer::SingularityPatchStrategy(), d_object_name(object_name), d_dim(dim), d_data_test_strategy(data_test), - d_do_refine(do_refine), - d_do_coarsen(false), d_refine_option(refine_option), d_patch_hierarchy(hierarchy), d_fake_time(0.0), + d_fake_cycle(0), d_source( - hier::VariableDatabase::getDatabase()->getContext("SOURCE")), + hier::VariableDatabase::getDatabase()->getContext("SOURCE")), d_destination( hier::VariableDatabase::getDatabase()->getContext("DESTINATION")), d_refine_scratch( @@ -63,19 +60,13 @@ MultiblockTester::MultiblockTester( hier::VariableDatabase::getDatabase()->getContext("DESTINATION")), d_reset_refine_scratch( hier::VariableDatabase::getDatabase()->getContext("REFINE_SCRATCH")), - d_reset_refine_algorithm(dim), - d_reset_coarsen_algorithm(dim), + d_reset_refine_algorithm(), d_is_reset(false) { NULL_USE(main_input_db); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(data_test != (PatchMultiblockTestStrategy *)NULL); -#endif - if (!do_refine) { - d_do_coarsen = do_coarsen; - } + TBOX_ASSERT(!object_name.empty()); + TBOX_ASSERT(data_test != 0); if (!((d_refine_option == "INTERIOR_FROM_SAME_LEVEL") || (d_refine_option == "INTERIOR_FROM_COARSER_LEVEL"))) { @@ -132,41 +123,30 @@ void MultiblockTester::registerVariable( d_patch_data_components.setFlag(dst_id); boost::shared_ptr refine_operator; - boost::shared_ptr coarsen_operator; - - if (d_do_refine) { - refine_operator = xfer_geom->lookupRefineOperator(src_variable, - operator_name); - d_mblk_refine_alg.reset(new xfer::RefineAlgorithm(d_dim)); + refine_operator = xfer_geom->lookupRefineOperator(src_variable, + operator_name); - hier::IntVector scratch_ghosts = - hier::IntVector::max(src_ghosts, dst_ghosts); - scratch_ghosts.max(hier::IntVector(d_dim, 1)); - if (refine_operator) { - scratch_ghosts.max(refine_operator->getStencilWidth()); - } - int scratch_id = - variable_db->registerVariableAndContext(src_variable, - d_refine_scratch, - scratch_ghosts); - TBOX_ASSERT(scratch_id != -1); - - d_patch_data_components.setFlag(scratch_id); - - d_mblk_refine_alg->registerRefine(dst_id, - src_id, - scratch_id, - refine_operator); - - } else if (d_do_coarsen) { - coarsen_operator = xfer_geom->lookupCoarsenOperator(src_variable, - operator_name); - d_coarsen_algorithm->registerCoarsen(dst_id, - src_id, - coarsen_operator); + d_mblk_refine_alg.reset(new xfer::RefineAlgorithm()); + hier::IntVector scratch_ghosts = + hier::IntVector::max(src_ghosts, dst_ghosts); + scratch_ghosts.max(hier::IntVector(d_dim, 1)); + if (refine_operator) { + scratch_ghosts.max(refine_operator->getStencilWidth(d_dim)); } + int scratch_id = + variable_db->registerVariableAndContext(src_variable, + d_refine_scratch, + scratch_ghosts); + TBOX_ASSERT(scratch_id != -1); + + d_patch_data_components.setFlag(scratch_id); + + d_mblk_refine_alg->registerRefine(dst_id, + src_id, + scratch_id, + refine_operator); registerVariableForReset(src_variable, dst_variable, src_ghosts, dst_ghosts, xfer_geom, @@ -202,45 +182,35 @@ void MultiblockTester::registerVariableForReset( d_patch_data_components.setFlag(dst_id); boost::shared_ptr refine_operator; - boost::shared_ptr coarsen_operator; - if (d_do_refine) { - refine_operator = xfer_geom->lookupRefineOperator(src_variable, - operator_name); + refine_operator = xfer_geom->lookupRefineOperator(src_variable, + operator_name); - hier::IntVector scratch_ghosts = - hier::IntVector::max(src_ghosts, dst_ghosts); + hier::IntVector scratch_ghosts = + hier::IntVector::max(src_ghosts, dst_ghosts); - scratch_ghosts.max(hier::IntVector(d_dim, 1)); - if (refine_operator) { - scratch_ghosts.max(refine_operator->getStencilWidth()); - } - int scratch_id = - variable_db->registerVariableAndContext(src_variable, - d_reset_refine_scratch, - scratch_ghosts); - - d_patch_data_components.setFlag(scratch_id); - - d_reset_refine_algorithm.registerRefine(dst_id, - src_id, - scratch_id, - refine_operator); - - } else if (d_do_coarsen) { - coarsen_operator = xfer_geom->lookupCoarsenOperator(src_variable, - operator_name); - d_reset_coarsen_algorithm.registerCoarsen(dst_id, - src_id, - coarsen_operator); + scratch_ghosts.max(hier::IntVector(d_dim, 1)); + if (refine_operator) { + scratch_ghosts.max(refine_operator->getStencilWidth(d_dim)); } + int scratch_id = + variable_db->registerVariableAndContext(src_variable, + d_reset_refine_scratch, + scratch_ghosts); + + d_patch_data_components.setFlag(scratch_id); + + d_reset_refine_algorithm.registerRefine(dst_id, + src_id, + scratch_id, + refine_operator); } /* ************************************************************************* * - * Create refine and coarsen communication schedules for hierarchy. + * Create refine communication schedules for hierarchy. * ************************************************************************* */ @@ -248,39 +218,33 @@ void MultiblockTester::registerVariableForReset( void MultiblockTester::createRefineSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif boost::shared_ptr level( d_patch_hierarchy->getPatchLevel(level_number)); - if (d_do_refine) { - - d_refine_schedule.resizeArray( - d_patch_hierarchy->getFinestLevelNumber() + 1); - d_refine_schedule[level_number].reset(); - - if (level_number == 0) { - d_refine_schedule[level_number] = - d_mblk_refine_alg->createSchedule(level, - this); - } else if (d_refine_option == "INTERIOR_FROM_SAME_LEVEL") { - d_refine_schedule[level_number] = - d_mblk_refine_alg->createSchedule(level, - level_number - 1, - d_patch_hierarchy, - this); - } else if (d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") { - d_refine_schedule[level_number] = - d_mblk_refine_alg->createSchedule(level, - boost::shared_ptr(), - level_number - 1, - d_patch_hierarchy, - this); - } - + d_refine_schedule.resize( + d_patch_hierarchy->getFinestLevelNumber() + 1); + d_refine_schedule[level_number].reset(); + + if (level_number == 0) { + d_refine_schedule[level_number] = + d_mblk_refine_alg->createSchedule(level, + this); + } else if (d_refine_option == "INTERIOR_FROM_SAME_LEVEL") { + d_refine_schedule[level_number] = + d_mblk_refine_alg->createSchedule(level, + level_number - 1, + d_patch_hierarchy, + this); + } else if (d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") { + d_refine_schedule[level_number] = + d_mblk_refine_alg->createSchedule(level, + boost::shared_ptr(), + level_number - 1, + d_patch_hierarchy, + this); } } @@ -288,80 +252,10 @@ void MultiblockTester::createRefineSchedule( void MultiblockTester::resetRefineSchedule( const int level_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT((level_number >= 0) && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif - - if (d_do_refine) { - - d_reset_refine_algorithm.resetSchedule(d_refine_schedule[level_number]); - } - - d_is_reset = true; -} - -void MultiblockTester::createCoarsenSchedule( - const int level_number) -{ - NULL_USE(level_number); -/* - * if (d_do_coarsen && (level_number > 0)) { - * - * d_coarsen_schedule.resizeArray( - * d_patch_hierarchy->getFinestLevelNumber()+1); - * d_coarsen_schedule[level_number].reset(); - * - * - * - * boost::shared_ptr level = - * d_patch_hierarchy->getPatchLevel(level_number); - * boost::shared_ptr coarser_level = - * d_patch_hierarchy->getPatchLevel(level_number-1); - * - * tbox::Array< boost::shared_ptr< hier::Connector > > fine_to_coarse; - * tbox::Array< boost::shared_ptr< hier::Connector > > coarse_to_fine; - * - * const hier::Connector *fine_to_coarse = - * &lh.getConnector(level_number, level_number-1); - * const hier::Connector *coarse_to_fine = - * &lh.getConnector(level_number-1, level_number); - * const hier::Connector::TransposePair - * coarse_fine_pair( coarse_to_fine, fine_to_coarse ); - * - * if ( dlbg_schedule ) { - * d_coarsen_schedule[level_number] = - * d_coarsen_algorithm.createSchedule(coarser_level, - * level, - * coarse_fine_pair, - * this); - * } else { - * TBOX_ERROR("The following must be replaced with the DLBG version."); - * #if 0 - * d_coarsen_schedule[level_number] = - * d_coarsen_algorithm->createSchedule(coarser_level, level, this); - * #endif - * } - * - * } - */ -} - -void MultiblockTester::resetCoarsenSchedule( - const int level_number) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT((level_number >= 0) - && (level_number <= d_patch_hierarchy->getFinestLevelNumber())); -#endif - - if (d_do_coarsen && (level_number > 0)) { - - d_reset_coarsen_algorithm.resetSchedule( - d_coarsen_schedule[level_number]); - - } + d_reset_refine_algorithm.resetSchedule(d_refine_schedule[level_number]); d_is_reset = true; } @@ -369,7 +263,7 @@ void MultiblockTester::resetCoarsenSchedule( /* ************************************************************************* * - * Perform data refine and coarsen operations. + * Perform data refine operations. * ************************************************************************* */ @@ -377,33 +271,15 @@ void MultiblockTester::resetCoarsenSchedule( void MultiblockTester::performRefineOperations( const int level_number) { - if (d_do_refine) { - if (d_is_reset) { - d_data_test_strategy->setDataContext(d_reset_refine_scratch); - } else { - d_data_test_strategy->setDataContext(d_destination); - } - if (d_refine_schedule[level_number]) { - d_refine_schedule[level_number]->fillData(d_fake_time); - } - d_data_test_strategy->clearDataContext(); + if (d_is_reset) { + d_data_test_strategy->setDataContext(d_reset_refine_scratch); + } else { + d_data_test_strategy->setDataContext(d_destination); } -} - -void MultiblockTester::performCoarsenOperations( - const int level_number) -{ - if (d_do_coarsen) { - if (d_is_reset) { - d_data_test_strategy->setDataContext(d_reset_source); - } else { - d_data_test_strategy->setDataContext(d_source); - } - if (d_coarsen_schedule[level_number]) { - d_coarsen_schedule[level_number]->coarsenData(); - } - d_data_test_strategy->clearDataContext(); + if (d_refine_schedule[level_number]) { + d_refine_schedule[level_number]->fillData(d_fake_time); } + d_data_test_strategy->clearDataContext(); } /* @@ -423,16 +299,17 @@ bool MultiblockTester::verifyCommunicationResults() const d_data_test_strategy->setDataContext(d_destination); } for (int ln = 0; - ln <= d_patch_hierarchy->getFinestLevelNumber(); ln++) { + ln <= d_patch_hierarchy->getFinestLevelNumber(); ++ln) { boost::shared_ptr level( d_patch_hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator mi(level->begin()); mi != level->end(); ++mi) { - success = d_data_test_strategy->verifyResults( + bool level_success = d_data_test_strategy->verifyResults( **mi, d_patch_hierarchy, ln, mi->getBox().getBlockId()); + success = level_success && success; } } @@ -463,11 +340,10 @@ void MultiblockTester::initializeLevelData( NULL_USE(initial_time); NULL_USE(old_level); NULL_USE(allocate_data); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(hierarchy); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); TBOX_ASSERT(level_number >= 0); -#endif boost::shared_ptr mblk_hierarchy(hierarchy); @@ -497,23 +373,6 @@ void MultiblockTester::initializeLevelData( 's'); d_data_test_strategy->clearDataContext(); - if (d_do_coarsen) { - - d_data_test_strategy->setDataContext(d_destination); - d_data_test_strategy->initializeDataOnPatch(*patch, - mblk_hierarchy, - level_num, block_id, - 'd'); - d_data_test_strategy->clearDataContext(); - - d_data_test_strategy->setDataContext(d_reset_destination); - d_data_test_strategy->initializeDataOnPatch(*patch, - mblk_hierarchy, - level_num, block_id, - 'd'); - d_data_test_strategy->clearDataContext(); - - } } } @@ -539,10 +398,9 @@ void MultiblockTester::applyGradientDetector( NULL_USE(dt_time); NULL_USE(initial_time); NULL_USE(uses_richardson_extrapolation_too); -#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(hierarchy); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); @@ -566,8 +424,8 @@ void MultiblockTester::applyGradientDetector( /* ************************************************************************* * - * Physical boundary condition and user-defined coarsen and refine - * operations declared in RefinePatchStrategy and CoarsenPatchStrategy. + * Physical boundary condition and user-defined refine + * operations declared in RefinePatchStrategy. * They are passed off to patch data test object. * ************************************************************************* @@ -595,15 +453,11 @@ void MultiblockTester::setPhysicalBoundaryConditions( void MultiblockTester::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) { - NULL_USE(grid_geometry); - NULL_USE(time); - boost::shared_ptr save_context( d_data_test_strategy->getDataContext()); @@ -624,9 +478,9 @@ void MultiblockTester::fillSingularityBoundaryConditions( d_data_test_strategy->setDataContext(save_context); } -hier::IntVector MultiblockTester::getRefineOpStencilWidth() const +hier::IntVector MultiblockTester::getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector(d_dim, 0); + return hier::IntVector(dim, 0); } void MultiblockTester::preprocessRefine( @@ -649,33 +503,6 @@ void MultiblockTester::postprocessRefine( fine_box, ratio); } -hier::IntVector MultiblockTester::getCoarsenOpStencilWidth() const -{ - return hier::IntVector(d_dim, 0); -} - -void MultiblockTester::preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - d_data_test_strategy->preprocessCoarsen(coarse, fine, - boost::shared_ptr(), - coarse_box, ratio); -} - -void MultiblockTester::postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) -{ - d_data_test_strategy->postprocessCoarsen(coarse, fine, - boost::shared_ptr(), - coarse_box, ratio); -} - /* ************************************************************************* * @@ -690,12 +517,11 @@ void MultiblockTester::setupHierarchy( boost::shared_ptr main_input_db, boost::shared_ptr cell_tagger) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(d_dim)); + new mesh::BergerRigoutsos(d_dim, + main_input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer(d_dim, @@ -711,24 +537,26 @@ void MultiblockTester::setupHierarchy( cell_tagger, box_generator, load_balancer, - load_balancer, - true)); + load_balancer)); int fake_tag_buffer = 0; gridding_alg->makeCoarsestLevel(d_fake_time); - bool initial_time = true; - for (int ln = 0; d_patch_hierarchy->levelCanBeRefined(ln); ln++) { - gridding_alg->makeFinerLevel(d_fake_time, - initial_time, fake_tag_buffer, + bool initial_cycle = true; + for (int ln = 0; d_patch_hierarchy->levelCanBeRefined(ln); ++ln) { + gridding_alg->makeFinerLevel( + fake_tag_buffer, + initial_cycle, + d_fake_cycle, + d_fake_time, d_fake_time); } tbox::plog << "\n\nHierarchy:\n"; d_patch_hierarchy->recursivePrint(tbox::plog, "", 2); - for (int ln = 1; ln < d_patch_hierarchy->getNumberOfLevels(); ln++) { + for (int ln = 1; ln < d_patch_hierarchy->getNumberOfLevels(); ++ln) { hier::CoarseFineBoundary cf_bndry(*d_patch_hierarchy, ln, hier::IntVector::getOne(d_dim)); } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.h index 8742492b..587cf437 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/MultiblockTester.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Manager class for patch data communication tests. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/PatchLevel.h" @@ -21,9 +20,6 @@ #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/ComponentSelector.h" -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/xfer/CoarsenPatchStrategy.h" -#include "SAMRAI/xfer/CoarsenSchedule.h" #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/xfer/RefinePatchStrategy.h" @@ -41,7 +37,7 @@ #include "SAMRAI/hier/Variable.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace std; using namespace SAMRAI; @@ -50,7 +46,7 @@ class PatchMultiblockTestStrategy; /** * Class MultiblockTester serves as a tool to test data communication operations - * in SAMRAI, such as coarsening, refining, and filling ghost cells. + * in SAMRAI, such as refining and filling ghost cells. * * The functions in this class called from main() are: * \begin{enumerate} @@ -58,17 +54,14 @@ class PatchMultiblockTestStrategy; * creates patch hierarchy and sets initial data. * - [createRefineSchedule(...)] creates communication schedule for * refining data to given level. - * - [createCoarsenSchedule(...)] creates communication schedule for - * coarsening data to given level. * - [performRefineOperations(...)] refines data to given level. - * - [performCoarsenOperations(...)] coarsens data to given level. * \end{enumerate} */ class MultiblockTester: public mesh::StandardTagAndInitStrategy, - public xfer::CoarsenPatchStrategy, - public xfer::RefinePatchStrategy + public xfer::RefinePatchStrategy, + public xfer::SingularityPatchStrategy { public: /** @@ -80,8 +73,6 @@ class MultiblockTester: boost::shared_ptr& main_input_db, boost::shared_ptr& hierarchy, PatchMultiblockTestStrategy* strategy, - bool do_refine = true, - bool do_coarsen = false, const string& refine_option = "INTERIOR_FROM_SAME_LEVEL"); /** @@ -136,16 +127,6 @@ class MultiblockTester: resetRefineSchedule( const int level_number); - /** - * Create communication schedule for coarsening data to given level. - */ - void - createCoarsenSchedule( - const int level_number); - void - resetCoarsenSchedule( - const int level_number); - /** * Refine data to specified level (or perform interpatch communication * on that level). @@ -154,13 +135,6 @@ class MultiblockTester: performRefineOperations( const int level_number); - /** - * Coarsen data to specified level. - */ - void - performCoarsenOperations( - const int level_number); - /** * After communication operations are performed, check results. */ @@ -200,8 +174,8 @@ class MultiblockTester: /** * These routines pass off physicial boundary and pre/postprocess - * coarsen/refine operations to patch data test object. They are - * pure virtual in RefinePatchStrategy and CoarsenPatchStrategy. + * refine operations to patch data test object. They are + * pure virtual in RefinePatchStrateg. */ void setPhysicalBoundaryConditions( @@ -216,14 +190,14 @@ class MultiblockTester: fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); hier::IntVector - getRefineOpStencilWidth() const; + getRefineOpStencilWidth( + const tbox::Dimension& dim) const; void preprocessRefine( @@ -239,23 +213,6 @@ class MultiblockTester: const hier::Box& fine_box, const hier::IntVector& ratio); - hier::IntVector - getCoarsenOpStencilWidth() const; - - void - preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); - - void - postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio); - double getLevelDt( const boost::shared_ptr& level, const double dt_time, @@ -275,6 +232,14 @@ class MultiblockTester: boost::shared_ptr main_input_db, boost::shared_ptr cell_tagger); + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; + } + private: /* * Object name for error reporting. @@ -288,12 +253,6 @@ class MultiblockTester: */ PatchMultiblockTestStrategy* d_data_test_strategy; - /* - * Booleans to indicate whether refine or coarsen is operation to test. - */ - bool d_do_refine; - bool d_do_coarsen; - /* * String name for refine option; ; i.e., source of interior patch * data on refined patches. Options are "INTERIOR_FROM_SAME_LEVEL" @@ -311,6 +270,11 @@ class MultiblockTester: */ double d_fake_time; + /* + * Dummy cycle for all data operations. + */ + int d_fake_cycle; + /* * The MultiblockTester uses two variable contexts for each variable. * The "source", and "destination" contexts indicate the source @@ -332,22 +296,13 @@ class MultiblockTester: */ hier::ComponentSelector d_patch_data_components; - /* - * Coarsen algorithm and schedules for testing communication - * among levels in the patch hierarchy. - */ - - boost::shared_ptr d_coarsen_algorithm; - xfer::RefineAlgorithm d_reset_refine_algorithm; - xfer::CoarsenAlgorithm d_reset_coarsen_algorithm; boost::shared_ptr d_mblk_refine_alg; bool d_is_reset; - tbox::Array > d_refine_schedule; - tbox::Array > d_coarsen_schedule; + std::vector > d_refine_schedule; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.C index 4cb4725e..30d0a9fe 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -16,25 +16,21 @@ #include "MultiblockTester.h" +#include + using namespace SAMRAI; NodeMultiblockTest::NodeMultiblockTest( const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option): PatchMultiblockTestStrategy(dim), d_dim(dim) { - NULL_USE(do_refine); - NULL_USE(do_coarsen); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); -#endif d_object_name = object_name; @@ -70,9 +66,7 @@ NodeMultiblockTest::~NodeMultiblockTest() void NodeMultiblockTest::readTestInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif /* * Base class reads variable parameters and boxes to refine. @@ -85,17 +79,17 @@ void NodeMultiblockTest::readTestInput( void NodeMultiblockTest::registerVariables( MultiblockTester* commtest) { - TBOX_ASSERT(commtest != (MultiblockTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::NodeVariable(d_dim, - d_variable_src_name[i], - d_variable_depth[i])); + d_variable_src_name[i], + d_variable_depth[i])); commtest->registerVariable(d_variables[i], d_variables[i], @@ -122,11 +116,12 @@ void NodeMultiblockTest::initializeDataOnPatch( || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") && (level_number < d_finest_level_number))) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); hier::Box dbox = node_data->getGhostBox(); @@ -160,34 +155,32 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - int num_edge_bdry_boxes = 0; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - num_edge_bdry_boxes = edge_bdry.getSize(); - } + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - num_face_bdry_boxes = face_bdry.getSize(); - } + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); /* * Set node boundary data. */ - for (int nb = 0; nb < num_node_bdry_boxes; nb++) { + for (int nb = 0; nb < num_node_bdry_boxes; ++nb) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[nb], patch.getBox(), @@ -196,10 +189,11 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( hier::Box patch_node_box = pdat::NodeGeometry::toNodeBox(patch.getBox()); if (!node_bdry[nb].getIsMultiblockSingularity()) { - pdat::NodeIterator niend(fill_box, false); - for (pdat::NodeIterator ni(fill_box, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(fill_box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(fill_box)); + ni != niend; ++ni) { if (!patch_node_box.contains(*ni)) { - for (int d = 0; d < node_data->getDepth(); d++) { + for (int d = 0; d < node_data->getDepth(); ++d) { (*node_data)(*ni, d) = (double)(node_bdry[nb].getLocationIndex() + 100); } @@ -212,7 +206,7 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int eb = 0; eb < num_edge_bdry_boxes; eb++) { + for (int eb = 0; eb < num_edge_bdry_boxes; ++eb) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[eb], patch.getBox(), @@ -224,11 +218,12 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( hier::Index pupper(patch_node_box.upper()); if (!edge_bdry[eb].getIsMultiblockSingularity()) { - pdat::NodeIterator niend(fill_box, false); - for (pdat::NodeIterator ni(fill_box, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(fill_box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(fill_box)); + ni != niend; ++ni) { if (!patch_node_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (edge_bdry[eb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == pupper(n)) { @@ -239,7 +234,7 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < node_data->getDepth(); d++) { + for (int d = 0; d < node_data->getDepth(); ++d) { (*node_data)(*ni, d) = (double)(edge_bdry[eb].getLocationIndex() + 100); } @@ -254,7 +249,7 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fb = 0; fb < num_face_bdry_boxes; fb++) { + for (int fb = 0; fb < num_face_bdry_boxes; ++fb) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fb], patch.getBox(), @@ -266,11 +261,12 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( hier::Index pupper(patch_node_box.upper()); if (!face_bdry[fb].getIsMultiblockSingularity()) { - pdat::NodeIterator niend(fill_box, false); - for (pdat::NodeIterator ni(fill_box, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(fill_box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(fill_box)); + ni != niend; ++ni) { if (!patch_node_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (face_bdry[fb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == pupper(n)) { @@ -281,7 +277,7 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < node_data->getDepth(); d++) { + for (int d = 0; d < node_data->getDepth(); ++d) { (*node_data)(*ni, d) = (double)(face_bdry[fb].getLocationIndex() + 100); } @@ -299,24 +295,22 @@ void NodeMultiblockTest::setPhysicalBoundaryConditions( void NodeMultiblockTest::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry) { const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); hier::Box sing_fill_box(node_data->getGhostBox() * fill_box); @@ -327,10 +321,11 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::NodeIterator niend(sing_fill_box, false); - for (pdat::NodeIterator ni(sing_fill_box, true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(sing_fill_box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(sing_fill_box)); + ni != niend; ++ni) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (bbox.getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == pupper(n)) { use_index = false; @@ -339,7 +334,7 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*node_data)(*ni, d) = 0.0; } } @@ -350,33 +345,28 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( if (grid_geometry->hasEnhancedConnectivity()) { hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { const hier::BlockId& encon_blk_id = ei->getBlockId(); boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); hier::Transformation::RotationIdentifier rotation = hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri(neighbors.begin()); nbri != neighbors.end(); nbri++) { - - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation(rotation, offset, encon_blk_id, patch_blk_id); @@ -400,14 +390,16 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( encon_blk_id); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData( + d_variables[i], getDataContext()))); + TBOX_ASSERT(sing_data); - pdat::NodeIterator ciend(sing_fill_box, false); - for (pdat::NodeIterator ci(sing_fill_box, true); + pdat::NodeIterator ciend(pdat::NodeGeometry::end(sing_fill_box)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(sing_fill_box)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -418,7 +410,7 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( if (use_index) { pdat::NodeIndex src_index(*ci); pdat::NodeGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*node_data)(*ci, d) += (*sing_data)(src_index, d); } } @@ -430,10 +422,11 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( } if (num_encon_used) { - pdat::NodeIterator ciend(sing_fill_box, false); - for (pdat::NodeIterator ci(sing_fill_box, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(sing_fill_box)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(sing_fill_box)); + ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -442,7 +435,7 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*node_data)(*ci, d) /= num_encon_used; } } @@ -455,10 +448,11 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( * from which to acquire data. */ - pdat::NodeIterator ciend(sing_fill_box, false); - for (pdat::NodeIterator ci(sing_fill_box, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(sing_fill_box)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(sing_fill_box)); + ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -467,7 +461,7 @@ void NodeMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*node_data)(*ci, d) = (double)bbox.getLocationIndex() + 200.0; } @@ -497,7 +491,7 @@ bool NodeMultiblockTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -509,10 +503,11 @@ bool NodeMultiblockTest::verifyResults( hier::Box tbox(pbox); tbox.grow(tgcw); - const std::list& neighbors = - hierarchy->getGridGeometry()->getNeighbors(block_id); + boost::shared_ptr grid_geom( + hierarchy->getGridGeometry()); + hier::BoxContainer singularity( - hierarchy->getGridGeometry()->getSingularityBoxContainer(block_id)); + grid_geom->getSingularityBoxContainer(block_id)); hier::IntVector ratio = hierarchy->getPatchLevel(level_number)->getRatioToLevelZero(); @@ -521,21 +516,23 @@ bool NodeMultiblockTest::verifyResults( bool test_failed = false; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { double correct = (double)block_id.getBlockValue(); boost::shared_ptr > node_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(node_data); int depth = node_data->getDepth(); hier::Box interior_box(pbox); interior_box.grow(hier::IntVector(d_dim, -1)); - pdat::NodeIterator ciend(interior_box, false); - for (pdat::NodeIterator ci(interior_box, true); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(interior_box)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(interior_box)); + ci != ciend; ++ci) { + for (int d = 0; d < depth; ++d) { double result = (*node_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -558,22 +555,24 @@ bool NodeMultiblockTest::verifyResults( pdat::NodeGeometry::toNodeBox(pbox); hier::BoxContainer sing_node_boxlist; - for (hier::BoxContainer::iterator si(singularity); + for (hier::BoxContainer::iterator si = singularity.begin(); si != singularity.end(); ++si) { sing_node_boxlist.pushFront(pdat::NodeGeometry::toNodeBox(*si)); } hier::BoxContainer tested_neighbors; - for (std::list::const_iterator - ne(neighbors.begin()); ne != neighbors.end(); ne++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ne( + grid_geom->begin(block_id)); + ne != grid_geom->end(block_id); ++ne) { - correct = ne->getBlockId().getBlockValue(); + const hier::BaseGridGeometry::Neighbor& nbr = *ne; + correct = nbr.getBlockId().getBlockValue(); - hier::BoxContainer neighbor_ghost(ne->getTransformedDomain()); + hier::BoxContainer neighbor_ghost(nbr.getTransformedDomain()); hier::BoxContainer neighbor_node_ghost; - for (hier::BoxContainer::iterator nn(neighbor_ghost); + for (hier::BoxContainer::iterator nn = neighbor_ghost.begin(); nn != neighbor_ghost.end(); ++nn) { hier::Box neighbor_ghost_interior( pdat::NodeGeometry::toNodeBox(*nn)); @@ -589,14 +588,14 @@ bool NodeMultiblockTest::verifyResults( neighbor_node_ghost.removeIntersections(sing_node_boxlist); neighbor_node_ghost.removeIntersections(tested_neighbors); - for (hier::BoxContainer::iterator ng(neighbor_node_ghost); + for (hier::BoxContainer::iterator ng = neighbor_node_ghost.begin(); ng != neighbor_node_ghost.end(); ++ng) { - hier::Box::iterator ciend(*ng, false); - for (hier::Box::iterator ci(*ng, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(ng->end()); + for (hier::Box::iterator ci(ng->begin()); ci != ciend; ++ci) { pdat::NodeIndex ni(*ci, hier::IntVector(d_dim, 0)); if (!patch_node_box.contains(ni)) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*node_data)(ni, d); if (!tbox::MathUtilities::equalEps(correct, @@ -616,11 +615,11 @@ bool NodeMultiblockTest::verifyResults( tested_neighbors.spliceBack(neighbor_node_ghost); } - for (int b = 0; b < d_dim.getValue(); b++) { - tbox::Array bdry = + for (int b = 0; b < d_dim.getValue(); ++b) { + const std::vector& bdry = pgeom->getCodimensionBoundaries(b + 1); - for (int k = 0; k < bdry.size(); k++) { + for (int k = 0; k < static_cast(bdry.size()); ++k) { hier::Box fill_box = pgeom->getBoundaryFillBox(bdry[k], patch.getBox(), tgcw); @@ -630,16 +629,18 @@ bool NodeMultiblockTest::verifyResults( correct = 0.0; int num_sing_neighbors = 0; - for (std::list::const_iterator - ns(neighbors.begin()); ns != neighbors.end(); ns++) { - if (ns->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ns( + grid_geom->begin(block_id)); + ns != grid_geom->end(block_id); ++ns) { + const hier::BaseGridGeometry::Neighbor& nbr = *ns; + if (nbr.isSingularity()) { hier::BoxContainer neighbor_ghost( - ns->getTransformedDomain()); + nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(fill_box); if (neighbor_ghost.size()) { - num_sing_neighbors++; - correct += ns->getBlockId().getBlockValue(); + ++num_sing_neighbors; + correct += nbr.getBlockId().getBlockValue(); } } } @@ -658,13 +659,14 @@ bool NodeMultiblockTest::verifyResults( correct = (double)(bdry[k].getLocationIndex() + 100); } - pdat::NodeIterator ciend(fill_box, false); - for (pdat::NodeIterator ci(fill_box, true); ci != ciend; ++ci) { + pdat::NodeIterator ciend(pdat::NodeGeometry::end(fill_box)); + for (pdat::NodeIterator ci(pdat::NodeGeometry::begin(fill_box)); + ci != ciend; ++ci) { if (!patch_node_box.contains(*ci)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (bdry[k].getBox().numberCells(n) == 1) { if ((*ci)(n) == patch_node_box.lower() (n) || (*ci)(n) == patch_node_box.upper() (n)) { @@ -675,7 +677,7 @@ bool NodeMultiblockTest::verifyResults( } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*node_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.h index 17c76f6d..43ca5ce9 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/NodeMultiblockTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for node-centered patch data * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/NodeData.h" #include "SAMRAI/tbox/Database.h" @@ -22,7 +21,7 @@ #include "PatchMultiblockTestStrategy.h" #include "SAMRAI/hier/Variable.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -44,8 +43,6 @@ class NodeMultiblockTest:public PatchMultiblockTestStrategy const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option); /** @@ -55,7 +52,7 @@ class NodeMultiblockTest:public PatchMultiblockTestStrategy /** * User-supplied boundary conditions. Note that we do not implement - * user-defined coarsen and refine operations. + * user-defined refine operations. */ void setPhysicalBoundaryConditions( @@ -67,7 +64,7 @@ class NodeMultiblockTest:public PatchMultiblockTestStrategy fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry); @@ -76,7 +73,7 @@ class NodeMultiblockTest:public PatchMultiblockTestStrategy * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ void @@ -135,7 +132,7 @@ class NodeMultiblockTest:public PatchMultiblockTestStrategy string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.C index d0a8dd1b..014eec7c 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for patch data test operations. * ************************************************************************/ @@ -15,6 +15,8 @@ #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/tbox/Utilities.h" +#include + using namespace SAMRAI; // These are used in the cell tagging routine. @@ -37,13 +39,12 @@ PatchMultiblockTestStrategy::PatchMultiblockTestStrategy( const tbox::Dimension& dim): d_dim(dim) { - d_variable_src_name.resizeArray(0); - d_variable_dst_name.resizeArray(0); - d_variable_depth.resizeArray(0); - d_variable_src_ghosts.resizeArray(0, hier::IntVector(d_dim)); - d_variable_dst_ghosts.resizeArray(0, hier::IntVector(d_dim)); - d_variable_coarsen_op.resizeArray(0); - d_variable_refine_op.resizeArray(0); + d_variable_src_name.resize(0); + d_variable_dst_name.resize(0); + d_variable_depth.resize(0); + d_variable_src_ghosts.resize(0, hier::IntVector(d_dim)); + d_variable_dst_ghosts.resize(0, hier::IntVector(d_dim)); + d_variable_refine_op.resize(0); } PatchMultiblockTestStrategy::~PatchMultiblockTestStrategy() @@ -61,22 +62,19 @@ PatchMultiblockTestStrategy::~PatchMultiblockTestStrategy() void PatchMultiblockTestStrategy::readVariableInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif - tbox::Array var_keys = db->getAllKeys(); - int nkeys = var_keys.getSize(); + std::vector var_keys = db->getAllKeys(); + int nkeys = static_cast(var_keys.size()); - d_variable_src_name.resizeArray(nkeys); - d_variable_dst_name.resizeArray(nkeys); - d_variable_depth.resizeArray(nkeys); - d_variable_src_ghosts.resizeArray(nkeys, hier::IntVector(d_dim, 0)); - d_variable_dst_ghosts.resizeArray(nkeys, hier::IntVector(d_dim, 0)); - d_variable_coarsen_op.resizeArray(nkeys); - d_variable_refine_op.resizeArray(nkeys); + d_variable_src_name.resize(nkeys); + d_variable_dst_name.resize(nkeys); + d_variable_depth.resize(nkeys); + d_variable_src_ghosts.resize(nkeys, hier::IntVector(d_dim, 0)); + d_variable_dst_ghosts.resize(nkeys, hier::IntVector(d_dim, 0)); + d_variable_refine_op.resize(nkeys); - for (int i = 0; i < nkeys; i++) { + for (int i = 0; i < nkeys; ++i) { boost::shared_ptr var_db(db->getDatabase(var_keys[i])); @@ -110,12 +108,6 @@ void PatchMultiblockTestStrategy::readVariableInput( var_db->getIntegerArray("dst_ghosts", tmp_ghosts, d_dim.getValue()); } - if (var_db->keyExists("coarsen_operator")) { - d_variable_coarsen_op[i] = var_db->getString("coarsen_operator"); - } else { - d_variable_coarsen_op[i] = "NO_COARSEN"; - } - if (var_db->keyExists("refine_operator")) { d_variable_refine_op[i] = var_db->getString("refine_operator"); } else { @@ -129,16 +121,16 @@ void PatchMultiblockTestStrategy::readVariableInput( void PatchMultiblockTestStrategy::readRefinementInput( boost::shared_ptr db) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); -#endif - tbox::Array box_keys = db->getAllKeys(); - int nkeys = box_keys.getSize(); + std::vector box_keys = db->getAllKeys(); + int nkeys = static_cast(box_keys.size()); - d_refine_level_boxes.resizeArray(nkeys); - for (int i = 0; i < nkeys; i++) { - d_refine_level_boxes[i] = db->getDatabaseBoxArray(box_keys[i]); + d_refine_level_boxes.resize(nkeys); + for (int i = 0; i < nkeys; ++i) { + std::vector db_box_vector = + db->getDatabaseBoxVector(box_keys[i]); + d_refine_level_boxes[i] = db_box_vector; } } @@ -157,19 +149,18 @@ void PatchMultiblockTestStrategy::tagCellsInInputBoxes( int tag_index) { - if (level_number < d_refine_level_boxes.getSize()) { + if (level_number < static_cast(d_refine_level_boxes.size())) { boost::shared_ptr > tags( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); TBOX_ASSERT(tags); -#endif tags->fillAll(0); const hier::Box pbox = patch.getBox(); - for (hier::BoxContainer::iterator k(d_refine_level_boxes[level_number]); + for (hier::BoxContainer::iterator k = + d_refine_level_boxes[level_number].begin(); k != d_refine_level_boxes[level_number].end(); ++k) { tags->fill(1, *k * pbox, 0); } @@ -181,7 +172,7 @@ void PatchMultiblockTestStrategy::tagCellsInInputBoxes( /* ************************************************************************* * - * Blank physical boundary and pre/postprocess coarsen/refine operations + * Blank physical boundary and pre/postprocess * so tester isn't required to implement them when not needed. * ************************************************************************* @@ -224,31 +215,3 @@ void PatchMultiblockTestStrategy::postprocessRefine( NULL_USE(fine_box); NULL_USE(ratio); } - -void PatchMultiblockTestStrategy::preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const boost::shared_ptr& context, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(context); - NULL_USE(coarse_box); - NULL_USE(ratio); -} - -void PatchMultiblockTestStrategy::postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const boost::shared_ptr& context, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const -{ - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(context); - NULL_USE(coarse_box); - NULL_USE(ratio); -} diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.h index 4c4d3558..30bbf5d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/PatchMultiblockTestStrategy.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Base class for patch data test operations. * ************************************************************************/ @@ -13,7 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/hier/Box.h" #include "MultiblockTester.h" @@ -22,7 +21,7 @@ #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/hier/VariableContext.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -47,7 +46,6 @@ using namespace SAMRAI; * - \b depth optional variable depth (default = 1) * - \b src_ghosts optional comm source ghost width (default = 0,0,0) * - \b dst_ghosts optional comm dest ghost width (default = 0,0,0) - * - \b coarsen_operator opt. coarsen op name (default = "NO_COARSEN") * - \b refine_operator opt. refine op name (default = "NO_REFINE") * * @@ -84,13 +82,11 @@ using namespace SAMRAI; * The following virtual functions are given default non-operations in this * class so that concrete test subclass can either implement them to test * specific functionality or simply ignore. They are pure virtual in the - * coarsen and refine patch strategy classes: + * refine patch strategy class: * \begin{enumerate} * - [setPhysicalBoundaryConditions(...)] * - [preprocessRefine(...)] * - [postprocessRefine(...)] - * - [preprocessCoarsen(...)] - * - [postprocessCoarsen(...)] * \end{enumerate} */ @@ -126,27 +122,21 @@ class PatchMultiblockTestStrategy void setDataContext( boost::shared_ptr context) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(context); -#endif d_data_context = context; } void setDestinationContext( boost::shared_ptr context) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(context); -#endif d_dst_context = context; } void setScratchContext( boost::shared_ptr context) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(context); -#endif d_scr_context = context; } @@ -208,7 +198,7 @@ class PatchMultiblockTestStrategy /** * Virtual functions in interface to user-supplied boundary conditions, - * coarsen and refine operations. + * and refine operations. */ virtual void setPhysicalBoundaryConditions( @@ -219,7 +209,7 @@ class PatchMultiblockTestStrategy virtual void fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) @@ -250,29 +240,11 @@ class PatchMultiblockTestStrategy const hier::Box& fine_box, const hier::IntVector& ratio) const; - /// - virtual void - preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const boost::shared_ptr& context, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const; - - /// - virtual void - postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const boost::shared_ptr& context, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const; - /** * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ virtual void @@ -317,20 +289,19 @@ class PatchMultiblockTestStrategy const tbox::Dimension d_dim; /* - * Arrays of information read from input file describing test variables + * Vectors of information read from input file describing test variables */ - tbox::Array d_variable_src_name; - tbox::Array d_variable_dst_name; - tbox::Array d_variable_depth; - tbox::Array d_variable_src_ghosts; - tbox::Array d_variable_dst_ghosts; - tbox::Array d_variable_coarsen_op; - tbox::Array d_variable_refine_op; + std::vector d_variable_src_name; + std::vector d_variable_dst_name; + std::vector d_variable_depth; + std::vector d_variable_src_ghosts; + std::vector d_variable_dst_ghosts; + std::vector d_variable_refine_op; /* - * Arrays of information read from input file describing test variables + * Vectors of information read from input file describing test variables */ - tbox::Array d_refine_level_boxes; + std::vector d_refine_level_boxes; private: boost::shared_ptr d_grid_geometry; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Pointer-MultiblockTester.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/Pointer-MultiblockTester.C deleted file mode 100644 index 26cef608..00000000 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/Pointer-MultiblockTester.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "MultiblockTester.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/README b/base/SAMRAI/SAMRAI/source/test/mblkcomm/README new file mode 100644 index 00000000..b3717a3d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/README @@ -0,0 +1,39 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Multiblock communication tests +## +######################################################################### + +This test exercises Refine operations on multiblock configurations. +The files included in this directory are as follows: + + main.C - driver + *MultiblockTest.[C,h] - Classes for patch data-specific tests + PatchMultiblockTestStrategy.[C,h] + - Implementaion of RefinePatchStrategy + test_inputs/*.input - Input files for a variety of data centerings + and multiblock configurations + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/cell.2d.input for a full description of all +input parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.C index 11e724fa..5607a263 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for side-centered patch data * ************************************************************************/ @@ -18,20 +18,18 @@ #include "MultiblockTester.h" +#include + using namespace SAMRAI; SideMultiblockTest::SideMultiblockTest( const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option): PatchMultiblockTestStrategy(dim), d_dim(dim) { - NULL_USE(do_refine); - NULL_USE(do_coarsen); TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(main_input_db); TBOX_ASSERT(!refine_option.empty()); @@ -83,17 +81,18 @@ void SideMultiblockTest::readTestInput( void SideMultiblockTest::registerVariables( MultiblockTester* commtest) { - TBOX_ASSERT(commtest != (MultiblockTester *)NULL); + TBOX_ASSERT(commtest != 0); - int nvars = d_variable_src_name.getSize(); + int nvars = static_cast(d_variable_src_name.size()); - d_variables.resizeArray(nvars); + d_variables.resize(nvars); - for (int i = 0; i < nvars; i++) { + for (int i = 0; i < nvars; ++i) { d_variables[i].reset( new pdat::SideVariable( d_dim, d_variable_src_name[i], + hier::IntVector::getOne(d_dim), d_variable_depth[i])); commtest->registerVariable(d_variables[i], @@ -121,11 +120,12 @@ void SideMultiblockTest::initializeDataOnPatch( || ((d_refine_option == "INTERIOR_FROM_COARSER_LEVEL") && (level_number < d_finest_level_number))) { - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); hier::Box dbox = side_data->getGhostBox(); @@ -159,48 +159,46 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( boost::shared_ptr pgeom(patch.getPatchGeometry()); - const tbox::Array node_bdry = + const std::vector& node_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue()); - const int num_node_bdry_boxes = node_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); - tbox::Array edge_bdry; - int num_edge_bdry_boxes = 0; - if (d_dim > tbox::Dimension(1)) { - edge_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 1); - num_edge_bdry_boxes = edge_bdry.getSize(); - } + std::vector empty_vector(0, hier::BoundaryBox(d_dim)); + const std::vector& edge_bdry = + d_dim > tbox::Dimension(1) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 1) : empty_vector; + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = pgeom->getCodimensionBoundaries(d_dim.getValue() - 2); - num_face_bdry_boxes = face_bdry.getSize(); - } + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + pgeom->getCodimensionBoundaries(d_dim.getValue() - 2) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); /* * Set node boundary data. */ - for (int nb = 0; nb < num_node_bdry_boxes; nb++) { + for (int nb = 0; nb < num_node_bdry_boxes; ++nb) { hier::Box fill_box = pgeom->getBoundaryFillBox(node_bdry[nb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_side_box = pdat::SideGeometry::toSideBox(patch.getBox(), axis); if (!node_bdry[nb].getIsMultiblockSingularity()) { - pdat::SideIterator niend(fill_box, axis, false); - for (pdat::SideIterator ni(fill_box, axis, true); + pdat::SideIterator niend(pdat::SideGeometry::end(fill_box, axis)); + for (pdat::SideIterator ni(pdat::SideGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_side_box.contains(*ni)) { - for (int d = 0; d < side_data->getDepth(); d++) { + for (int d = 0; d < side_data->getDepth(); ++d) { (*side_data)(*ni, d) = (double)(node_bdry[nb].getLocationIndex() + 100); } @@ -214,25 +212,25 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( /* * Set edge boundary data. */ - for (int eb = 0; eb < num_edge_bdry_boxes; eb++) { + for (int eb = 0; eb < num_edge_bdry_boxes; ++eb) { hier::Box fill_box = pgeom->getBoundaryFillBox(edge_bdry[eb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_side_box = pdat::SideGeometry::toSideBox(patch.getBox(), axis); hier::Index plower(patch_side_box.lower()); hier::Index pupper(patch_side_box.upper()); if (!edge_bdry[eb].getIsMultiblockSingularity()) { - pdat::SideIterator niend(fill_box, axis, false); - for (pdat::SideIterator ni(fill_box, axis, true); + pdat::SideIterator niend(pdat::SideGeometry::end(fill_box, axis)); + for (pdat::SideIterator ni(pdat::SideGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_side_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && edge_bdry[eb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == @@ -244,7 +242,7 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < side_data->getDepth(); d++) { + for (int d = 0; d < side_data->getDepth(); ++d) { (*side_data)(*ni, d) = (double)(edge_bdry[eb].getLocationIndex() + 100); @@ -261,25 +259,25 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( /* * Set face boundary data. */ - for (int fb = 0; fb < num_face_bdry_boxes; fb++) { + for (int fb = 0; fb < num_face_bdry_boxes; ++fb) { hier::Box fill_box = pgeom->getBoundaryFillBox(face_bdry[fb], patch.getBox(), gcw_to_fill); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_side_box = pdat::SideGeometry::toSideBox(patch.getBox(), axis); hier::Index plower(patch_side_box.lower()); hier::Index pupper(patch_side_box.upper()); if (!face_bdry[fb].getIsMultiblockSingularity()) { - pdat::SideIterator niend(fill_box, axis, false); - for (pdat::SideIterator ni(fill_box, axis, true); + pdat::SideIterator niend(pdat::SideGeometry::end(fill_box, axis)); + for (pdat::SideIterator ni(pdat::SideGeometry::begin(fill_box, axis)); ni != niend; ++ni) { if (!patch_side_box.contains(*ni)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && face_bdry[fb].getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == @@ -291,7 +289,7 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( } if (use_index) { - for (int d = 0; d < side_data->getDepth(); d++) { + for (int d = 0; d < side_data->getDepth(); ++d) { (*side_data)(*ni, d) = (double)(face_bdry[fb].getLocationIndex() + 100); @@ -311,41 +309,39 @@ void SideMultiblockTest::setPhysicalBoundaryConditions( void SideMultiblockTest::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry) { const tbox::Dimension& dim = fill_box.getDim(); - const hier::BoxId& dst_mb_id = patch.getBox().getId(); + const hier::BoxId& dst_mb_id = patch.getBox().getBoxId(); const hier::BlockId& patch_blk_id = patch.getBox().getBlockId(); - const std::list& neighbors = - grid_geometry->getNeighbors(patch_blk_id); - - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); hier::Box sing_fill_box(side_data->getGhostBox() * fill_box); int depth = side_data->getDepth(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox( pdat::SideGeometry::toSideBox(patch.getBox(), axis)); hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::SideIterator niend(sing_fill_box, axis, false); - for (pdat::SideIterator ni(sing_fill_box, axis, true); + pdat::SideIterator niend(pdat::SideGeometry::end(sing_fill_box, axis)); + for (pdat::SideIterator ni(pdat::SideGeometry::begin(sing_fill_box, axis)); ni != niend; ++ni) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ni)(n) == plower(n) || (*ni)(n) == pupper(n)) { use_index = false; @@ -354,7 +350,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*side_data)(*ni, d) = 0.0; } } @@ -365,15 +361,15 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( if (grid_geometry->hasEnhancedConnectivity()) { hier::Connector::ConstNeighborhoodIterator ni = - dst_to_encon.findLocal(dst_mb_id); + dst_to_encon->findLocal(dst_mb_id); - if (ni != dst_to_encon.end()) { + if (ni != dst_to_encon->end()) { - for (hier::Connector::ConstNeighborIterator ei = dst_to_encon.begin(ni); - ei != dst_to_encon.end(ni); ++ei) { + for (hier::Connector::ConstNeighborIterator ei = dst_to_encon->begin(ni); + ei != dst_to_encon->end(ni); ++ei) { boost::shared_ptr encon_patch( - encon_level.getPatch(ei->getId())); + encon_level.getPatch(ei->getBoxId())); const hier::BlockId& encon_blk_id = ei->getBlockId(); @@ -381,18 +377,13 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( hier::Transformation::NO_ROTATE; hier::IntVector offset(dim); - for (std::list::const_iterator - nbri(neighbors.begin()); nbri != neighbors.end(); nbri++) { - - if (nbri->getBlockId() == encon_blk_id) { - rotation = nbri->getRotationIdentifier(); - offset = nbri->getShift(); - break; - } + hier::BaseGridGeometry::ConstNeighborIterator itr = + grid_geometry->find(patch_blk_id, encon_blk_id); + if (itr != grid_geometry->end(patch_blk_id)) { + rotation = (*itr).getRotationIdentifier(); + offset = (*itr).getShift(encon_level.getLevelNumber()); } - offset *= patch.getPatchGeometry()->getRatio(); - hier::Transformation transformation(rotation, offset, encon_blk_id, patch_blk_id); @@ -416,10 +407,12 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( encon_blk_id); boost::shared_ptr > sing_data( - encon_patch->getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + encon_patch->getPatchData( + d_variables[i], getDataContext()))); + TBOX_ASSERT(sing_data); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::SideGeometry::toSideBox(patch.getBox(), axis); @@ -427,11 +420,11 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::SideIterator ciend(sing_fill_box, axis, false); - for (pdat::SideIterator ci(sing_fill_box, axis, true); + pdat::SideIterator ciend(pdat::SideGeometry::end(sing_fill_box, axis)); + for (pdat::SideIterator ci(pdat::SideGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -445,7 +438,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( pdat::SideIndex src_index(*ci); pdat::SideGeometry::transform(src_index, back_trans); - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*side_data)(*ci, d) += (*sing_data)(src_index, d); } } @@ -459,7 +452,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( } if (num_encon_used) { - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::SideGeometry::toSideBox(patch.getBox(), axis); @@ -467,11 +460,11 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::SideIterator ciend(sing_fill_box, axis, false); - for (pdat::SideIterator ci(sing_fill_box, axis, true); + pdat::SideIterator ciend(pdat::SideGeometry::end(sing_fill_box, axis)); + for (pdat::SideIterator ci(pdat::SideGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -480,7 +473,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*side_data)(*ci, d) /= num_encon_used; } } @@ -494,7 +487,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( * from which to acquire data. */ - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box pbox = pdat::SideGeometry::toSideBox(patch.getBox(), axis); @@ -502,11 +495,11 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( hier::Index plower(pbox.lower()); hier::Index pupper(pbox.upper()); - pdat::SideIterator ciend(sing_fill_box, axis, false); - for (pdat::SideIterator ci(sing_fill_box, axis, true); + pdat::SideIterator ciend(pdat::SideGeometry::end(sing_fill_box, axis)); + for (pdat::SideIterator ci(pdat::SideGeometry::begin(sing_fill_box, axis)); ci != ciend; ++ci) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bbox.getBox().numberCells(n) == 1) { if ((*ci)(n) == plower(n) || (*ci)(n) == pupper(n)) { use_index = false; @@ -515,7 +508,7 @@ void SideMultiblockTest::fillSingularityBoundaryConditions( } } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { (*side_data)(*ci, d) = (double)bbox.getLocationIndex() + 200.0; } @@ -546,7 +539,7 @@ bool SideMultiblockTest::verifyResults( tbox::plog << "Patch box = " << patch.getBox() << endl; hier::IntVector tgcw(d_dim, 0); - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { tgcw.max(patch.getPatchData(d_variables[i], getDataContext())-> getGhostCellWidth()); } @@ -558,10 +551,11 @@ bool SideMultiblockTest::verifyResults( hier::Box tbox(pbox); tbox.grow(tgcw); - const std::list& neighbors = - hierarchy->getGridGeometry()->getNeighbors(block_id); + boost::shared_ptr grid_geom( + hierarchy->getGridGeometry()); + hier::BoxContainer singularity( - hierarchy->getGridGeometry()->getSingularityBoxContainer(block_id)); + grid_geom->getSingularityBoxContainer(block_id)); hier::IntVector ratio = hierarchy->getPatchLevel(level_number)->getRatioToLevelZero(); @@ -570,23 +564,24 @@ bool SideMultiblockTest::verifyResults( bool test_failed = false; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { double correct = (double)block_id.getBlockValue(); boost::shared_ptr > side_data( - patch.getPatchData(d_variables[i], getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_variables[i], getDataContext()))); + TBOX_ASSERT(side_data); int depth = side_data->getDepth(); hier::Box interior_box(pbox); interior_box.grow(hier::IntVector(d_dim, -1)); - for (int axis = 0; axis < d_dim.getValue(); axis++) { - pdat::SideIterator ciend(interior_box, axis, false); - for (pdat::SideIterator ci(interior_box, axis, true); + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { + pdat::SideIterator ciend(pdat::SideGeometry::end(interior_box, axis)); + for (pdat::SideIterator ci(pdat::SideGeometry::begin(interior_box, axis)); ci != ciend; ++ci) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*side_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, result)) { @@ -604,24 +599,26 @@ bool SideMultiblockTest::verifyResults( hier::Box gbox = side_data->getGhostBox(); - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_side_box = pdat::SideGeometry::toSideBox(pbox, axis); hier::BoxContainer tested_neighbors; - for (std::list::const_iterator - ne(neighbors.begin()); ne != neighbors.end(); ne++) { + for (hier::BaseGridGeometry::ConstNeighborIterator ne( + grid_geom->begin(block_id)); + ne != grid_geom->end(block_id); ++ne) { - if (ne->isSingularity()) { - continue; - } + const hier::BaseGridGeometry::Neighbor& nbr = *ne; + if (nbr.isSingularity()) { + continue; + } - correct = ne->getBlockId().getBlockValue(); + correct = nbr.getBlockId().getBlockValue(); - hier::BoxContainer neighbor_ghost(ne->getTransformedDomain()); + hier::BoxContainer neighbor_ghost(nbr.getTransformedDomain()); hier::BoxContainer neighbor_side_ghost; - for (hier::BoxContainer::iterator nn(neighbor_ghost); + for (hier::BoxContainer::iterator nn = neighbor_ghost.begin(); nn != neighbor_ghost.end(); ++nn) { hier::Box neighbor_ghost_interior( pdat::SideGeometry::toSideBox(*nn, axis)); @@ -635,15 +632,15 @@ bool SideMultiblockTest::verifyResults( neighbor_side_ghost.removeIntersections(tested_neighbors); - for (hier::BoxContainer::iterator ng(neighbor_side_ghost); + for (hier::BoxContainer::iterator ng = neighbor_side_ghost.begin(); ng != neighbor_side_ghost.end(); ++ng) { - hier::Box::iterator ciend(*ng, false); - for (hier::Box::iterator ci(*ng, true); ci != ciend; ++ci) { + hier::Box::iterator ciend(ng->end()); + for (hier::Box::iterator ci(ng->begin()); ci != ciend; ++ci) { pdat::SideIndex si(*ci, 0, 0); si.setAxis(axis); if (!patch_side_box.contains(si)) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*side_data)(si, d); if (!tbox::MathUtilities::equalEps(correct, @@ -667,11 +664,11 @@ bool SideMultiblockTest::verifyResults( boost::shared_ptr pgeom(patch.getPatchGeometry()); - for (int b = 0; b < d_dim.getValue(); b++) { - tbox::Array bdry = + for (int b = 0; b < d_dim.getValue(); ++b) { + const std::vector& bdry = pgeom->getCodimensionBoundaries(b + 1); - for (int k = 0; k < bdry.size(); k++) { + for (int k = 0; k < static_cast(bdry.size()); ++k) { hier::Box fill_box = pgeom->getBoundaryFillBox(bdry[k], patch.getBox(), tgcw); @@ -681,16 +678,18 @@ bool SideMultiblockTest::verifyResults( correct = 0.0; int num_sing_neighbors = 0; - for (std::list::const_iterator - ns(neighbors.begin()); ns != neighbors.end(); ns++) { - if (ns->isSingularity()) { + for (hier::BaseGridGeometry::ConstNeighborIterator ns( + grid_geom->begin(block_id)); + ns != grid_geom->end(block_id); ++ns) { + const hier::BaseGridGeometry::Neighbor& nbr = *ns; + if (nbr.isSingularity()) { hier::BoxContainer neighbor_ghost( - ns->getTransformedDomain()); + nbr.getTransformedDomain()); neighbor_ghost.refine(ratio); neighbor_ghost.intersectBoxes(fill_box); if (neighbor_ghost.size()) { - num_sing_neighbors++; - correct += ns->getBlockId().getBlockValue(); + ++num_sing_neighbors; + correct += nbr.getBlockId().getBlockValue(); } } } @@ -709,18 +708,18 @@ bool SideMultiblockTest::verifyResults( correct = (double)(bdry[k].getLocationIndex() + 100); } - for (int axis = 0; axis < d_dim.getValue(); axis++) { + for (tbox::Dimension::dir_t axis = 0; axis < d_dim.getValue(); ++axis) { hier::Box patch_side_box = pdat::SideGeometry::toSideBox(pbox, axis); - pdat::SideIterator ciend(fill_box, axis, false); - for (pdat::SideIterator ci(fill_box, axis, true); + pdat::SideIterator ciend(pdat::SideGeometry::end(fill_box, axis)); + for (pdat::SideIterator ci(pdat::SideGeometry::begin(fill_box, axis)); ci != ciend; ++ci) { if (!patch_side_box.contains(*ci)) { bool use_index = true; - for (int n = 0; n < d_dim.getValue(); n++) { + for (tbox::Dimension::dir_t n = 0; n < d_dim.getValue(); ++n) { if (axis == n && bdry[k].getBox().numberCells(n) == 1) { if ((*ci)(n) == patch_side_box.lower() (n) || @@ -732,7 +731,7 @@ bool SideMultiblockTest::verifyResults( } if (use_index) { - for (int d = 0; d < depth; d++) { + for (int d = 0; d < depth; ++d) { double result = (*side_data)(*ci, d); if (!tbox::MathUtilities::equalEps(correct, @@ -777,15 +776,14 @@ void SideMultiblockTest::postprocessRefine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(fine.getDim()); - - pdat::SideDoubleConstantRefine ref_op(dim); + pdat::SideDoubleConstantRefine ref_op; hier::BoxContainer fine_box_list(fine_box); + hier::BoxContainer empty_box_list; xfer::BoxGeometryVariableFillPattern fill_pattern; - for (int i = 0; i < d_variables.getSize(); i++) { + for (int i = 0; i < static_cast(d_variables.size()); ++i) { int id = hier::VariableDatabase::getDatabase()-> mapVariableAndContextToIndex(d_variables[i], context); @@ -796,6 +794,7 @@ void SideMultiblockTest::postprocessRefine( boost::shared_ptr fine_overlap = fill_pattern.computeFillBoxesOverlap( fine_box_list, + empty_box_list, fine.getBox(), fine.getPatchData(id)->getGhostBox(), *fine_pdf); diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.h b/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.h index 7fe06076..b05a9c38 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.h +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/SideMultiblockTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: AMR communication tests for edge-centered patch data * ************************************************************************/ @@ -35,8 +35,6 @@ class SideMultiblockTest:public PatchMultiblockTestStrategy const string& object_name, const tbox::Dimension& dim, boost::shared_ptr main_input_db, - bool do_refine, - bool do_coarsen, const string& refine_option); /** @@ -46,7 +44,7 @@ class SideMultiblockTest:public PatchMultiblockTestStrategy /** * User-supplied boundary conditions. Note that we do not implement - * user-defined coarsen and refine operations. + * user-defined refine operations. */ void setPhysicalBoundaryConditions( @@ -58,7 +56,7 @@ class SideMultiblockTest:public PatchMultiblockTestStrategy fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& bbox, const boost::shared_ptr& grid_geometry); @@ -67,7 +65,7 @@ class SideMultiblockTest:public PatchMultiblockTestStrategy * This function is called from the MultiblockTester constructor. Its * purpose is to register variables used in the patch data test * and appropriate communication parameters (ghost cell widths, - * coarsen/refine operations) with the MultiblockTester object, which + * refine operations) with the MultiblockTester object, which * manages the variable storage. */ void @@ -135,7 +133,7 @@ class SideMultiblockTest:public PatchMultiblockTestStrategy string d_refine_option; int d_finest_level_number; - tbox::Array > d_variables; + std::vector > d_variables; }; diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/main.C b/base/SAMRAI/SAMRAI/source/test/mblkcomm/main.C index 36fe90e7..4950a977 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/main.C +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for patch data communication tests. * ************************************************************************/ @@ -32,7 +32,11 @@ #include "NodeMultiblockTest.h" #include "SideMultiblockTest.h" -#include +#include "boost/shared_ptr.hpp" + +#ifdef _OPENMP +#include +#endif using namespace SAMRAI; @@ -46,7 +50,7 @@ using namespace SAMRAI; * input file information and invokes the communcation operations * specified in the input file. The implementation of data type * specific operations (defining variables, initializing data, - * defining coarsen/refine operations, and verifying the results) + * defining refine operations, and verifying the results) * are provided in a class implemented for the test to be performed. * This test-specific class is derived from the PatchMultiblockTestStrategy * base class which declares the interface between the MultiblockTester @@ -72,12 +76,6 @@ using namespace SAMRAI; * "OuterodeMultiblockTest" * "SideMultiblockTest" * "MultiVariableMultiblockTest" - * do_refine = [test refine operation?] - * (optional - FALSE is default) - * do_coarsen = [test coarsen operation?] - * (optional - FALSE is default) - * NOTE: Only refine or coarsen test can be run, but not both. - * If both are TRUE, only refine operations will execute. * refine_option = [how interior of destination * level is filled during refine] * Options are: @@ -93,8 +91,6 @@ using namespace SAMRAI; * Available timers are: * "test::main::createRefineSchedule" * "test::main::performRefineOperations" - * "test::main::createCoarsenSchedule" - * "test::main::performCoarsenOperations" * } * * o Patch data tests... @@ -121,10 +117,9 @@ using namespace SAMRAI; * source data (opt. - def is 0,0,0) * dst_ghosts = 1,1,1 // for ghost width of * dest data (opt. - def is 0,0,0) - * coarsen_operator = "CONSERVATIVE_COARSEN" * refine_operator = "LINEAR_REFINE" * // Interlevel transfer operator name strings are optional - * // Default are "NO_COARSEN", and "NO_REFINE", resp. + * // Default is "NO_REFINE" * } * * // data for other variables as needed... @@ -214,7 +209,7 @@ int main( const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); - string log_file_name = "component_test.log"; + string log_file_name = "mblkcomm.log"; if (main_db->keyExists("log_file_name")) { log_file_name = main_db->getString("log_file_name"); } @@ -228,6 +223,14 @@ int main( tbox::PIO::logOnlyNodeZero(log_file_name); } +#ifdef _OPENMP + tbox::plog << "Compiled with OpenMP version " << _OPENMP + << ". Running with " << omp_get_max_threads() << " threads." + << std::endl; +#else + tbox::plog << "Compiled without OpenMP.\n"; +#endif + int ntimes_run = 1; if (main_db->keyExists("ntimes_run")) { ntimes_run = main_db->getInteger("ntimes_run"); @@ -240,15 +243,9 @@ int main( TBOX_ERROR("Error in Main input: no test specified." << endl); } - bool do_refine = true; - bool do_coarsen = false; - string refine_option = "INTERIOR_FROM_SAME_LEVEL"; tbox::plog << "\nPerforming refine data test..." << endl; - if (main_db->keyExists("refine_option")) { - refine_option = main_db->getString("refine_option"); - } #if 1 if (0) { @@ -270,43 +267,33 @@ int main( * Create communication tester and patch data test object */ - PatchMultiblockTestStrategy* patch_data_test = NULL; + PatchMultiblockTestStrategy* patch_data_test = 0; if (test_to_run == "CellMultiblockTest") { patch_data_test = new CellMultiblockTest("CellMultiblockTest", dim, input_db, - do_refine, - do_coarsen, refine_option); } else if (test_to_run == "EdgeMultiblockTest") { patch_data_test = new EdgeMultiblockTest("EdgeMultiblockTest", dim, input_db, - do_refine, - do_coarsen, refine_option); } else if (test_to_run == "FaceMultiblockTest") { patch_data_test = new FaceMultiblockTest("FaceMultiblockTest", dim, input_db, - do_refine, - do_coarsen, refine_option); } else if (test_to_run == "NodeMultiblockTest") { patch_data_test = new NodeMultiblockTest("NodeMultiblockTest", dim, input_db, - do_refine, - do_coarsen, refine_option); } else if (test_to_run == "SideMultiblockTest") { patch_data_test = new SideMultiblockTest("SideMultiblockTest", dim, input_db, - do_refine, - do_coarsen, refine_option); } else if (test_to_run == "MultiVariableMultiblockTest") { TBOX_ERROR("Error in Main input: no multi-variable test yet." << endl); @@ -322,8 +309,7 @@ int main( new hier::PatchHierarchy( "PatchHierarchy", patch_data_test->getGridGeometry(), - hier_db, - true)); + hier_db)); boost::shared_ptr comm_tester( new MultiblockTester( @@ -332,13 +318,10 @@ int main( base_db, hierarchy, patch_data_test, - do_refine, - do_coarsen, refine_option)); boost::shared_ptr cell_tagger( new mesh::StandardTagAndInitialize( - dim, "StandardTagggingAndInitializer", comm_tester.get(), input_db->getDatabase("StandardTaggingAndInitializer"))); @@ -366,11 +349,6 @@ int main( boost::shared_ptr refine_comm_time( time_man->getTimer("test::main::performRefineOperations")); - boost::shared_ptr coarsen_create_time( - time_man->getTimer("test::main::createCoarsenSchedule")); - boost::shared_ptr coarsen_comm_time( - time_man->getTimer("test::main::performCoarsenOperations")); - tbox::TimerManager::getManager()->resetAllTimers(); /* @@ -382,13 +360,13 @@ int main( int nlevels = patch_hierarchy->getNumberOfLevels(); - for (int n = 0; n < ntimes_run; n++) { + for (int n = 0; n < ntimes_run; ++n) { /* * Create communication schedules for data refine tests. */ refine_create_time->start(); - for (int i = 0; i < nlevels; i++) { + for (int i = 0; i < nlevels; ++i) { comm_tester->createRefineSchedule(i); } refine_create_time->stop(); @@ -397,7 +375,7 @@ int main( * Perform refine data communication operations. */ refine_comm_time->start(); - for (int j = 0; j < nlevels; j++) { + for (int j = 0; j < nlevels; ++j) { comm_tester->performRefineOperations(j); } refine_comm_time->stop(); diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-4blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-4blk.input index cba0ba57..d3329ce7 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-4blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-4blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test, and refine test information // ntimes_run = 1 // default is 1 @@ -31,21 +34,7 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE + } TimerManager { @@ -63,20 +52,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +62,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +72,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -115,22 +88,6 @@ BlockGridGeometry { domain_boxes_2 = [ (0,0) , (14,17) ] domain_boxes_3 = [ (0,0) , (19,17) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(-1,20),(-1,20)] - sing_box_1 = [(20,-1),(20,-1)] - sing_box_2 = [(-1,-1),(-1,-1)] - } - - Singularity1 { - blocks = 0,2,3 - - sing_box_0 = [(15,20),(15,20)] - sing_box_2 = [(15,-1),(15,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -172,7 +129,7 @@ BlockGridGeometry { block_b = 3 rotation_b_to_a = "I_UP", "J_UP" - point_in_a_space = 15,0 + point_in_a_space = 14,0 point_in_b_space = -1,0 } @@ -194,39 +151,36 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 1 - interlace_groups = FALSE - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = TRUE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-5blk.input index 6a10cead..dba03535 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-2d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { @@ -243,27 +200,24 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +GriddingAlgorithm { sequentialize_patch_indices = TRUE } TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9) , (10,10) ] + level_0 { + block_0 { + boxes = [ (9,9) , (10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-5blk.input index 1a730921..6d6dcac7 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test, and refine test information // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -97,8 +70,7 @@ CellMultiblockTest { dst_name = "dst_var1" depth = 1 src_ghosts = 0,0,0 - dst_ghosts = 1,1,0 - coarsen_operator = "NO_COARSEN" + dst_ghosts = 1,1,1 refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,14) ] domain_boxes_4 = [ (0,0,0) , (19,19,14) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,14)] - sing_box_1 = [(20,0,20),(20,14,20)] - sing_box_2 = [(20,-1,0),(20,-1,14)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_4 = [(-1,20,0),(-1,20,14)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -170,8 +130,8 @@ BlockGridGeometry { block_b = 2 rotation_b_to_a = "J_DOWN", "K_UP", "I_DOWN" - point_in_a_space = 19,0,0 - point_in_b_space = 0,0,19 + point_in_a_space = 19,0,19 + point_in_b_space = 20,0,0 } @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "K_UP", "I_UP" point_in_a_space = 19,0,19 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" point_in_a_space = 19,0,19 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { @@ -243,25 +200,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9,9) , (10,10,10) ] + level_0 { + block_0 { + boxes = [ (9,9,9) , (10,10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-full.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-full.input index ebb0ac9b..5934f4fb 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-full.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-full.input @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ @@ -19,7 +19,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +31,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +48,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +58,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +68,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -118,240 +87,6 @@ BlockGridGeometry { domain_boxes_5 = [ (0,0,0) , (14,14,14) ] domain_boxes_6 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,1,6 - - sing_box_0 = [(-1,15,0),(-1,15,14)] - sing_box_1 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity7 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity8 { - blocks = 0,3,6 - - sing_box_0 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,15),(14,-1,15)] - } - - Singularity9 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity10 { - blocks = 0,4,6 - - sing_box_0 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity11 { - blocks = 0,5,6 - - sing_box_0 = [(-1,-1,0),(-1,-1,14)] - sing_box_5 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity12 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity13 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity14 { - blocks = 1,3,6 - - sing_box_1 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(15,0,15),(15,14,15)] - } - - Singularity15 { - blocks = 1,4,6 - - sing_box_1 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(15,0,-1),(15,14,-1)] - } - - Singularity16 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity17 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity18 { - blocks = 3,5,6 - - sing_box_3 = [(-1,0,15),(-1,14,15)] - sing_box_5 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(-1,0,15),(-1,14,15)] - } - - Singularity19 { - blocks = 4,5,6 - - sing_box_4 = [(-1,0,-1),(-1,14,-1)] - sing_box_5 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(-1,0,-1),(-1,14,-1)] - } - - Singularity20 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity21 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity22 { - blocks = 0,1,3,6 - - sing_box_0 = [(-1,15,15),(-1,15,15)] - sing_box_1 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(15,-1,15),(15,-1,15)] - } - - Singularity23 { - blocks = 0,1,4,6 - - sing_box_0 = [(-1,15,-1),(-1,15,-1)] - sing_box_1 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity24 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity25 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - Singularity26 { - blocks = 0,3,5,6 - - sing_box_0 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,15),(-1,-1,15)] - sing_box_5 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(-1,-1,15),(-1,-1,15)] - } - - Singularity27 { - blocks = 0,4,5,6 - - sing_box_0 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_5 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(-1,-1,-1),(-1,-1,-1)] - } - - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -506,6 +241,16 @@ BlockGridGeometry { point_in_b_space = -1,0,14 } + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + } PatchHierarchy { @@ -524,25 +269,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-half.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-half.input index 9a6bb1d3..049e69be 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-half.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-half.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -117,140 +89,6 @@ BlockGridGeometry { domain_boxes_4 = [ (0,0,0) , (14,14,14) ] domain_boxes_5 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity7 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity8 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity9 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity10 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity11 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity12 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity13 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity14 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity15 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -387,25 +225,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-oct.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-oct.input index 6b5a483b..98c29d0e 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-oct.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-oct.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -115,47 +87,6 @@ BlockGridGeometry { domain_boxes_2 = [ (0,0,0) , (14,14,14) ] domain_boxes_3 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity3 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity4 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -229,25 +160,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-quad.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-quad.input index 9ab8678f..dfcba4ee 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-quad.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-3d-quad.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceDataTest" // test_to_run = "NodeDataTest" // test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,81 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (14,14,14) ] domain_boxes_4 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity6 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity7 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity8 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -259,9 +156,9 @@ BlockGridGeometry { block_a = 2 block_b = 3 - rotation_b_to_a = "J_UP", "K_DOWN", "I_DOWN" + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" point_in_a_space = 0,0,14 - point_in_b_space = 15,0,14 + point_in_b_space = 15,0,0 } BlockNeighbors8 { @@ -290,26 +187,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc2d.input new file mode 100755 index 00000000..13bb02ba --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc2d.input @@ -0,0 +1,215 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: input file for testing communication of SAMRAI cell data. + * + ************************************************************************/ + +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 +// +// Log file information +// + log_file_name = "cell-test.log" + log_all_nodes = TRUE + +// +// Testing information, including number of times to perform schedule +// creation and communication processes, name of particular patch data +// test, and refine test information +// + ntimes_run = 1 // default is 1 + +// +// Available tests are: +// + test_to_run = "CellMultiblockTest" +// test_to_run = "EdgeDataTest" +// test_to_run = "FaceDataTest" +// test_to_run = "NodeDataTest" +// test_to_run = "SideDataTest" + +} + +TimerManager { + timer_list = "test::main::*" + +// Available timers are: +// +// "test::main::createRefineSchedule" +// "test::main::performRefineOperations" +// "test::main::createCoarsenSchedule" +// "test::main::performCoarsenOperations" +// + +} + +CellMultiblockTest { + + // + // The VariableData database is read in by the PatchDataTestStrategy + // base class. Each sub-database must contain variable parameter data. + // The name of the sub-databases for each variable is arbitrary. But + // the names must be distinct. + // + // Required input: name + // Optional input: depth (default = 1) + // src_ghosts (default = 0,0,0) + // dst_ghosts (default = 0,0,0) + // refine_operator (default = "NO_REFINE") + // + VariableData { + + variable_1 { + src_name = "src_var1" + dst_name = "dst_var1" + depth = 1 + src_ghosts = 0,0 + dst_ghosts = 1,1 + refine_operator = "NO_REFINE" + } + } + + RefinementData { + } + +} + +BlockGridGeometry { + num_blocks = 5 + domain_boxes_0 = [ (0,0) , (14,19) ] + domain_boxes_1 = [ (0,0) , (19,17) ] + domain_boxes_2 = [ (0,0) , (7,17) ] + domain_boxes_3 = [ (0,0) , (19,17) ] + domain_boxes_4 = [ (8,0) , (14,17) ] + + BlockNeighbors0 { + block_a = 0 + block_b = 1 + + rotation_b_to_a = "J_DOWN", "I_UP" + point_in_a_space = 0,0 + point_in_b_space = 0,-1 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,19 + point_in_b_space = 0,-1 + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 14,19 + point_in_b_space = 0,-1 + } + + BlockNeighbors3 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 19,0 + point_in_b_space = -1,0 + } + + BlockNeighbors4 { + block_a = 4 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 14,0 + point_in_b_space = -1,0 + } + + BlockNeighbors5 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,0 + point_in_b_space = 0,0 + } + + BlockNeighbors6 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,19 + point_in_b_space = 0,-1 + } + + +} + +PatchHierarchy { + max_levels = 2 // Maximum number of levels in hierarchy. + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 + level_2 = 2 , 2 + } + largest_patch_size { + level_0 = 40, 40 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 2, 2 + // all finer levels will use same values as level_0... + } +} + +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { +} + +TreeLoadBalancer { + DEV_report_load_balance = TRUE + DEV_barrier_before = FALSE + DEV_barrier_after = FALSE + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +StandardTaggingAndInitializer { + tagging_method = "REFINE_BOXES" + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } + block_1 { + boxes = [ (3,3) , (4,4) ] + } + block_2 { + boxes = [ (3,3) , (4,4) ] + } + block_3 { + boxes = [ (3,3) , (4,4) ] + } + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc3d.input new file mode 100755 index 00000000..0a400c05 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell-tjunc3d.input @@ -0,0 +1,473 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2013 Lawrence Livermore National Security, LLC + * Description: input file for testing communication of SAMRAI cell data. + * + ************************************************************************/ + +Main { + dim = 3 +// +// Log file information +// + log_file_name = "cell-test.log" + log_all_nodes = TRUE + +// +// Testing information, including number of times to perform schedule +// creation and communication processes, name of particular patch data +// test +// + ntimes_run = 1 // default is 1 + +// +// Available tests are: +// + test_to_run = "CellMultiblockTest" +// test_to_run = "EdgeDataTest" +// test_to_run = "FaceDataTest" +// test_to_run = "NodeDataTest" +// test_to_run = "SideDataTest" +} + +TimerManager { + timer_list = "test::main::*" + +// Available timers are: +// +// "test::main::createRefineSchedule" +// "test::main::performRefineOperations" +// "test::main::createCoarsenSchedule" +// "test::main::performCoarsenOperations" +// + +} + +CellMultiblockTest { + + // + // The VariableData database is read in by the PatchDataTestStrategy + // base class. Each sub-database must contain variable parameter data. + // The name of the sub-databases for each variable is arbitrary. But + // the names must be distinct. + // + // Required input: name + // Optional input: depth (default = 1) + // src_ghosts (default = 0,0,0) + // dst_ghosts (default = 0,0,0) + // refine_operator (default = "NO_REFINE") + // + VariableData { + + variable_1 { + src_name = "src_var1" + dst_name = "dst_var1" + depth = 1 + src_ghosts = 0,0,0 + dst_ghosts = 1,1,1 + refine_operator = "CONSTANT_REFINE" + } + } + + RefinementData { + } + +} + +BlockGridGeometry { + num_blocks = 11 + domain_boxes_0 = [ (0,0,0) , (14,8,14) ] + domain_boxes_1 = [ (0,0,0) , (14,11,14) ] + domain_boxes_2 = [ (0,0,0) , (10,14,14) ] + domain_boxes_3 = [ (0,0,0) , (14,14,7) ] + domain_boxes_4 = [ (0,0,0) , (14,14,14) ] + domain_boxes_5 = [ (0,0,0) , (14,14,14) ] + domain_boxes_6 = [ (0,0,0) , (14,14,14) ] + domain_boxes_7 = [ (0,9,0) , (14,14,14) ] + domain_boxes_8 = [ (0,12,0) , (14,14,14) ] + domain_boxes_9 = [ (11,0,0) , (14,14,14) ] + domain_boxes_10 = [ (0,0,8) , (14,14,14) ] + + BlockNeighbors0 { + block_a = 7 + block_b = 1 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,14,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors1 { + block_a = 0 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors28 { + block_a = 0 + block_b = 9 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors2 { + block_a = 0 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors32 { + block_a = 0 + block_b = 10 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors3 { + block_a = 0 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors4 { + block_a = 0 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_DOWN", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,14 + } + + BlockNeighbors19 { + block_a = 7 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" + point_in_a_space = 14,0,0 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors20 { + block_a = 7 + block_b = 3 + + rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,-1,0 + } + + BlockNeighbors21 { + block_a = 7 + block_b = 4 + + rotation_b_to_a = "I_UP", "K_UP", "J_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors5 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors6 { + block_a = 1 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors7 { + block_a = 1 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors24 { + block_a = 8 + block_b = 2 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = -1,14,14 + } + + BlockNeighbors25 { + block_a = 8 + block_b = 3 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,14,14 + point_in_b_space = 14,14,-1 + } + + BlockNeighbors26 { + block_a = 8 + block_b = 4 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors27 { + block_a = 8 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { + block_a = 2 + block_b = 3 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors35 { + block_a = 2 + block_b = 10 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors10 { + block_a = 2 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors34 { + block_a = 9 + block_b = 10 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors30 { + block_a = 9 + block_b = 4 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,14 + } + + BlockNeighbors29 { + block_a = 9 + block_b = 5 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 14,0,14 + point_in_b_space = 15,0,0 + } + + BlockNeighbors33 { + block_a = 10 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 14,0,14 + point_in_b_space = 14,0,-1 + } + + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors31 { + block_a = 10 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors18 { + block_a = 7 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + + BlockNeighbors22 { + block_a = 0 + block_b = 7 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,0 + } + + BlockNeighbors23 { + block_a = 1 + block_b = 8 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,0 + } + + BlockNeighbors11 { + block_a = 2 + block_b = 9 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,0 + } + + BlockNeighbors12 { + block_a = 3 + block_b = 10 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,0 + } + + + +} + +PatchHierarchy { + max_levels = 2 // Maximum number of levels in hierarchy. + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 2 , 2 , 2 + level_2 = 2 , 2 , 2 + } + largest_patch_size { + level_0 = 40, 40, 40 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 2, 2, 2 + // all finer levels will use same values as level_0... + } +} + +BergerRigoutsos { + efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level + combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { +} + +TreeLoadBalancer { +} + +StandardTaggingAndInitializer { + tagging_method = "REFINE_BOXES" + level_0 { + block_0 { + boxes = [ (10,4,4) , (11,6,8) ] + } + block_1 { + boxes = [ (13,8,13) , (14,11,14) ] + } + block_2 { + boxes = [ (7,7,8) , (10,11,9) ] + } + block_3 { + boxes = [ (9,9,4) , (10,14,7) ] + } + block_4 { + boxes = [ (12,2,7) , (14,14,14) ] + } + block_8 { + boxes = [ (5,12,0) , (8,14,5) ] + } + + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.2d.input index 6f02fdb4..1c18a6f8 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.2d.input @@ -3,51 +3,38 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ Main { - dim = 2 -// -// Log file information -// - log_file_name = "cell-test.log" - log_all_nodes = TRUE -// -// Testing information, including number of times to perform schedule -// creation and communication processes, name of particular patch data -// test, and refine and coarsen test information -// - ntimes_run = 1 // default is 1 + // Dimension of problem. No default. + dim = 2 + + // name of log file. Default is "mblkcomm.log". + log_file_name = "cell-test.log" + + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. + log_all_nodes = TRUE + + // Testing information, including number of times to perform schedule + // creation and communication processes, name of particular patch data + // test, and refine and coarsen test information + + // Number of times to create and run schedule. Default is 1. + ntimes_run = 1 + + // Name of particular test to run. + // Choices are [Cell,Edge,Face,Node,Side]MultiblockTest + test_to_run = "CellMultiblockTest" -// -// Available tests are: -// - test_to_run = "CellMultiblockTest" -// test_to_run = "EdgeDataTest" -// test_to_run = "FaceDataTest" -// test_to_run = "NodeDataTest" -// test_to_run = "SideDataTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } +// Refer to tbox::TimerManager for input TimerManager { timer_list = "test::main::*" @@ -63,31 +50,16 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - - // - // The VariableData database is read in by the PatchDataTestStrategy + // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. // The name of the sub-databases for each variable is arbitrary. But // the names must be distinct. // - // Required input: name + // Required input: src_name + // dst_name // Optional input: depth (default = 1) - // src_ghosts (default = 0,0,0) - // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") + // src_ghosts (default = 0,0) + // dst_ghosts (default = 0,0) // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +70,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -108,20 +79,13 @@ CellMultiblockTest { } +// Refer to hier::BaseGridGeometry and geom::GridGeometry for input BlockGridGeometry { num_blocks = 3 domain_boxes_0 = [ (0,0) , (20,13) ] domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -153,7 +117,7 @@ BlockGridGeometry { } - +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level @@ -170,27 +134,28 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm { sequentialize_patch_indices = TRUE } +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } +// Refer to mesh::StandardTagAndInitialize for input StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.3d.input index 2067b66c..f9b6870c 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/cell.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -33,19 +36,6 @@ Main { // test_to_run = "SideDataTest" // test_to_run = "MultiVariableDataTest" -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +53,6 @@ TimerManager { CellMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +63,6 @@ CellMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +73,6 @@ CellMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +88,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,15) ] domain_boxes_2 = [ (0,0,0) , (20,25,15) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,15)] - sing_box_1 = [(-1,14,0),(-1,14,15)] - sing_box_2 = [(21,-1,0),(21,-1,15)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -168,25 +134,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-2d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-2d-5blk.input index 88ed7395..aa318428 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-2d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-2d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { EdgeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ EdgeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ EdgeMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { @@ -243,26 +200,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9) , (10,10) ] + level_0 { + block_0 { + boxes = [ (9,9) , (10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-3d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-3d-5blk.input index 3ac20a4a..80492eaf 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-3d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge-3d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { EdgeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ EdgeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -97,8 +70,7 @@ EdgeMultiblockTest { dst_name = "dst_var1" depth = 1 src_ghosts = 0,0,0 - dst_ghosts = 1,1,0 - coarsen_operator = "NO_COARSEN" + dst_ghosts = 1,1,1 refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,14) ] domain_boxes_4 = [ (0,0,0) , (19,19,14) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,14)] - sing_box_1 = [(-1,20,0),(-1,20,14)] - sing_box_2 = [(20,-1,0),(20,-1,14)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_4 = [(-1,20,0),(-1,20,14)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" point_in_a_space = 0,19,14 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_UP", "K_DOWN" point_in_a_space = 0,19,14 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { @@ -242,26 +199,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9,9) , (10,10,10) ] + level_0 { + block_0 { + boxes = [ (9,9,9) , (10,10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.2d.input index 9d208bdc..d5c8ca3e 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.2d.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 2 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -33,19 +35,6 @@ Main { // test_to_run = "SideDataTest" // test_to_run = "MultiVariableDataTest" -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +52,6 @@ TimerManager { EdgeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +62,6 @@ EdgeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +72,6 @@ EdgeMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +87,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (25,20) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(-1,-1),(-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -169,25 +134,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.3d.input index 05de2006..c2df8e4b 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/edge.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI edge data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableMultiblockTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { EdgeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ EdgeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ EdgeMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +86,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,15) ] domain_boxes_2 = [ (0,0,0) , (15,25,20) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,15)] - sing_box_1 = [(-1,14,0),(-1,14,15)] - sing_box_2 = [(0,-1,21),(15,-1,21)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -168,25 +132,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-2d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-2d-5blk.input index cad9163c..8b1b6f14 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-2d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-2d-5blk.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 2 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,6 @@ Main { test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +50,6 @@ TimerManager { FaceMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +60,6 @@ FaceMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +70,6 @@ FaceMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,16 +87,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +103,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +112,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +141,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +150,6 @@ BlockGridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +169,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { @@ -243,26 +199,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9) , (10,10) ] + level_0 { + block_0 { + boxes = [ (9,9) , (10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-3d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-3d-5blk.input index 3cdc47e6..0fadd0ce 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-3d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face-3d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { FaceMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ FaceMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -97,8 +70,7 @@ FaceMultiblockTest { dst_name = "dst_var1" depth = 1 src_ghosts = 0,0,0 - dst_ghosts = 1,1,0 - coarsen_operator = "NO_COARSEN" + dst_ghosts = 1,1,1 refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,14) ] domain_boxes_4 = [ (0,0,0) , (19,19,14) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,14)] - sing_box_1 = [(0,20,20),(14,20,20)] - sing_box_2 = [(20,-1,0),(20,-1,14)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_4 = [(-1,20,0),(-1,20,14)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" point_in_a_space = 14,19,19 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "K_DOWN", "I_UP", "J_DOWN" point_in_a_space = 14,19,19 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { @@ -242,26 +199,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9,9) , (10,10,10) ] + level_0 { + block_0 { + boxes = [ (9,9,9) , (10,10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.2d.input index 4c08c42f..8ceb5e44 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -33,19 +36,6 @@ Main { // test_to_run = "SideMultiblockTest" // test_to_run = "MultiVariableMultiblockTest" -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +53,6 @@ TimerManager { FaceMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +63,6 @@ FaceMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +73,6 @@ FaceMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +88,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0) , (13,25) ] domain_boxes_2 = [ (0,0) , (25,20) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(14,26),(14,26)] - sing_box_2 = [(-1,-1),(-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -169,25 +135,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.3d.input index e509eb13..e94dacfb 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/face.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI face data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 3 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableMultiblockTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { FaceMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ FaceMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ FaceMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +86,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,15) ] domain_boxes_2 = [ (0,0,0) , (15,20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,15)] - sing_box_1 = [(-1,14,0),(-1,14,15)] - sing_box_2 = [(0,-1,-1),(15,-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -169,25 +133,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-2d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-2d-5blk.input index f76bc1ae..c7fe9b9e 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-2d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-2d-5blk.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +34,6 @@ Main { // test_to_run = "FaceMultiblockTest" test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +51,6 @@ TimerManager { NodeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ NodeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ NodeMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { @@ -243,27 +200,23 @@ PatchHierarchy { } } - - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9) , (10,10) ] + level_0 { + block_0 { + boxes = [ (9,9) , (10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-3d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-3d-5blk.input index 366efbdc..3464556e 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-3d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node-3d-5blk.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 3 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,6 @@ Main { // test_to_run = "FaceMultiblockTest" test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +50,6 @@ TimerManager { NodeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +60,6 @@ NodeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -97,8 +69,7 @@ NodeMultiblockTest { dst_name = "dst_var1" depth = 1 src_ghosts = 0,0,0 - dst_ghosts = 1,1,0 - coarsen_operator = "NO_COARSEN" + dst_ghosts = 1,1,1 refine_operator = "NO_REFINE" } } @@ -116,16 +87,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,14) ] domain_boxes_4 = [ (0,0,0) , (19,19,14) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,14)] - sing_box_1 = [(20,0,-1),(20,14,-1)] - sing_box_2 = [(20,-1,0),(20,-1,14)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_4 = [(-1,20,0),(-1,20,14)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +103,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +112,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +141,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "K_DOWN", "I_DOWN" point_in_a_space = 19,14,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +150,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "K_DOWN", "J_UP" point_in_a_space = 19,14,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +169,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { @@ -242,26 +198,23 @@ PatchHierarchy { } } - - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9,9) , (10,10,10) ] + level_0 { + block_0 { + boxes = [ (9,9,9) , (10,10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.2d.input index 42bf71aa..fb7e8ae5 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. + Main { dim = 2 // @@ -19,7 +22,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -33,19 +36,6 @@ Main { // test_to_run = "SideMultiblockTest" // test_to_run = "MultiVariableMultiblockTest" -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +53,6 @@ TimerManager { NodeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +63,6 @@ NodeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +73,6 @@ NodeMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +88,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0) , (13,25) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(14,26),(14,26)] - sing_box_2 = [(-1,26),(-1,26)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -169,25 +135,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.3d.input index 1bd427d6..2537533c 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/node.3d.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI node data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 3 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,6 @@ Main { // test_to_run = "FaceMultiblockTest" test_to_run = "NodeMultiblockTest" // test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableMultiblockTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +50,6 @@ TimerManager { NodeMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +60,6 @@ NodeMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +70,6 @@ NodeMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +85,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,15) ] domain_boxes_2 = [ (0,0,0) , (15,25,20) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,15)] - sing_box_1 = [(-1,14,0),(-1,14,15)] - sing_box_2 = [(0,-1,-1),(15,-1,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -168,24 +131,23 @@ PatchHierarchy { } } - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-2d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-2d-5blk.input index 0bcbd27b..f93a7993 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-2d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-2d-5blk.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 2 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,7 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE + } TimerManager { @@ -63,20 +51,6 @@ TimerManager { SideMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ SideMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ SideMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -116,16 +88,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +104,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +113,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +142,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +151,6 @@ BlockGridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +170,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { @@ -244,24 +201,23 @@ PatchHierarchy { } } - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9) , (10,10) ] + level_0 { + block_0 { + boxes = [ (9,9) , (10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-3d-5blk.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-3d-5blk.input index fd1639c2..2b341231 100755 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-3d-5blk.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side-3d-5blk.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 3 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,6 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableDataTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +50,6 @@ TimerManager { SideMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchDataTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +60,6 @@ SideMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -97,8 +69,7 @@ SideMultiblockTest { dst_name = "dst_var1" depth = 1 src_ghosts = 0,0,0 - dst_ghosts = 1,1,0 - coarsen_operator = "NO_COARSEN" + dst_ghosts = 1,1,1 refine_operator = "NO_REFINE" } } @@ -116,16 +87,6 @@ BlockGridGeometry { domain_boxes_3 = [ (0,0,0) , (19,19,14) ] domain_boxes_4 = [ (0,0,0) , (19,19,14) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20,0),(20,20,14)] - sing_box_1 = [(0,20,20),(14,20,20)] - sing_box_2 = [(20,-1,0),(20,-1,14)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_4 = [(-1,20,0),(-1,20,14)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -142,7 +103,6 @@ BlockGridGeometry { rotation_b_to_a = "J_UP", "I_DOWN", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = 20,-1,0 - is_singularity = TRUE } BlockNeighbors2 { @@ -152,7 +112,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,19,0 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors3 { @@ -182,7 +141,6 @@ BlockGridGeometry { rotation_b_to_a = "K_UP", "I_UP", "J_UP" point_in_a_space = 0,19,19 point_in_b_space = -1,-1,0 - is_singularity = TRUE } BlockNeighbors6 { @@ -192,7 +150,6 @@ BlockGridGeometry { rotation_b_to_a = "K_UP", "J_DOWN", "I_UP" point_in_a_space = 0,19,19 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors7 { @@ -212,7 +169,6 @@ BlockGridGeometry { rotation_b_to_a = "I_UP", "J_UP", "K_UP" point_in_a_space = 19,0,0 point_in_b_space = -1,20,0 - is_singularity = TRUE } BlockNeighbors9 { @@ -244,24 +200,23 @@ PatchHierarchy { } } - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (9,9,9) , (10,10,10) ] + level_0 { + block_0 { + boxes = [ (9,9,9) , (10,10,10) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.2d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.2d.input index 46004a2b..937d469e 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.2d.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 2 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,6 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableMultiblockTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE } TimerManager { @@ -63,20 +50,6 @@ TimerManager { SideMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +60,6 @@ SideMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +70,6 @@ SideMultiblockTest { depth = 1 src_ghosts = 0,0 dst_ghosts = 1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +85,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0) , (13,25) ] domain_boxes_2 = [ (0,0) , (25,20) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(14,26),(14,26)] - sing_box_2 = [(26,21),(26,21)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -171,25 +134,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (3,3) , (4,4) ] + level_0 { + block_0 { + boxes = [ (3,3) , (4,4) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.3d.input b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.3d.input index d1358995..74cb2e57 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblkcomm/test_inputs/side.3d.input @@ -3,10 +3,12 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI side data. * ************************************************************************/ +// Refer to cell.2d.input for full description of all input parameters +// specific to this problem. Main { dim = 3 @@ -19,7 +21,7 @@ Main { // // Testing information, including number of times to perform schedule // creation and communication processes, name of particular patch data -// test, and refine and coarsen test information +// test // ntimes_run = 1 // default is 1 @@ -31,21 +33,7 @@ Main { // test_to_run = "FaceMultiblockTest" // test_to_run = "NodeMultiblockTest" test_to_run = "SideMultiblockTest" -// test_to_run = "MultiVariableMultiblockTest" - -// -// Either refine test or coarsen test can be run, but not both. This -// ensures proper validation of communicated data. Default test is -// to refine refine data with interior patch data filled from same level. -// If `do_refine' is true, then refine test will occur and coarsen test -// will not. Refine test also allows option of filling patch interiors -// from coarser levels. Coarsen test has no options as coarse patch -// interiors will always be filled with coarsened data from finer level. -// - do_refine = TRUE - refine_option = "INTERIOR_FROM_SAME_LEVEL" - - do_coarsen = FALSE + } TimerManager { @@ -63,20 +51,6 @@ TimerManager { SideMultiblockTest { - // - // Anything specific to the test goes here... - // - // e.g., coefficients for linear function to interpolate - // Ax + By + Cz + D = f(x,y,z) - // (NOTE: f(x,y,z) is the value assigned to each - // array value at initialization and - // against which interpolation is tested) - // - Acoef = 2.1 - Bcoef = 3.2 - Ccoef = 4.3 - Dcoef = 5.4 - // // The VariableData database is read in by the PatchMultiblockTestStrategy // base class. Each sub-database must contain variable parameter data. @@ -87,7 +61,6 @@ SideMultiblockTest { // Optional input: depth (default = 1) // src_ghosts (default = 0,0,0) // dst_ghosts (default = 0,0,0) - // coarsen_operator (default = "NO_COARSEN") // refine_operator (default = "NO_REFINE") // VariableData { @@ -98,7 +71,6 @@ SideMultiblockTest { depth = 1 src_ghosts = 0,0,0 dst_ghosts = 1,1,1 - coarsen_operator = "NO_COARSEN" refine_operator = "NO_REFINE" } } @@ -114,14 +86,6 @@ BlockGridGeometry { domain_boxes_1 = [ (0,0,0) , (25,13,15) ] domain_boxes_2 = [ (0,0,0) , (20,15,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14,0),(21,14,15)] - sing_box_1 = [(-1,14,0),(-1,14,15)] - sing_box_2 = [(21,0,26),(21,15,26)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -169,25 +133,23 @@ PatchHierarchy { } } - - -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + TreeLoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } StandardTaggingAndInitializer { tagging_method = "REFINE_BOXES" - - RefineBoxes { - level_0 = [ (5,5,5) , (6,7,7) ] + level_0 { + block_0 { + boxes = [ (5,5,5) , (6,7,7) ] + } } - } diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.depend index fbc0d855..5efe55bf 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -15,6 +15,7 @@ FILE_0=main-mbtree.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -35,6 +36,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -47,37 +50,27 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -89,34 +82,23 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-mbtree.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.in b/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.in index 40158e12..fb2a308d 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the MultiblockMappedBoxTree tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/mblktree -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -29,35 +30,81 @@ TEST_NPROCS = 0 else TEST_NPROCS = 1 endif +QUOTE = \" main: main-mbtree.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main-mbtree.o $(LIBSAMRAI) $(LDLIBS) -o $@ -check: main +check: main $(MAKE) check2d $(MAKE) check3d check2d: - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.3blk.simple.2d.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.3blk.subdivided.2d.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.5blk.simple.2d.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.5blk.subdivided.2d.input + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.3blk.simple.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.3blk.subdivided.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.5blk.simple.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.5blk.subdivided.2d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check3d: - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.full.simple.3d.input - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main test_inputs/mbtree.full.subdivided.3d.input + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.full.simple.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/mbtree.full.subdivided.3d.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/README b/base/SAMRAI/SAMRAI/source/test/mblktree/README new file mode 100644 index 00000000..0c90fcc4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/README @@ -0,0 +1,65 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Multiblock tree search tests +## +######################################################################### + +This test exercises tree-based box searches multiblock configurations. +The files included in this directory are as follows: + + main-mblktree.C - Entire code for the test + test_inputs/*.input - Input files for a variety of 2D and 3D + multiblock configurations + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/mbtree.3blk.simple.2d.input for a full description of all +input parameters specific to this problem. + +The provided input files test a variety of 2D and 3D multiblock configurations. +The files with "simple" in their names test the box searches on levels that +have a relatively small number of boxes. The files with "subdivided" in their +names use levels with the number of boxes increased by subdividing all boxes +to enforce a given maximum box size. + +RESETTING BASELINES +------------------- +The tests that are run from this directory include comparisons of the results +to baseline data that represent expected results. The tests compare a +Connector that is built using the multiblock tree search functionality to +baseline data that contains the expected contents of that Connector. +The baseline data are stored in HDF data files in the test_inputs directory, +one HDF file for each input file. + +If a SAMRAI developer makes changes to the library that can legitimately change +the box configuration of a level, then the baselines here need to be reset, +according to the following steps: + +1. Set the flag "generate_baseline" in each input file to TRUE. + +2. make check. The baseline HDF files will be regenerated here. + +3. Remove the flag "generate_baseline" from the input files, or set it to + FALSE. + +4. make checktest (there should be no more errors). + diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/main-mbtree.C b/base/SAMRAI/SAMRAI/source/test/mblktree/main-mbtree.C index 9a65f06f..54eab372 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/main-mbtree.C +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/main-mbtree.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for performance of tree search algorithm. * ************************************************************************/ @@ -14,6 +14,7 @@ #include "SAMRAI/hier/BoxLevel.h" #include "SAMRAI/geom/GridGeometry.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/HDFDatabase.h" @@ -35,7 +36,7 @@ using namespace tbox; */ void breakUpBoxes( - hier::BoxLevel& mapped_box_level, + hier::BoxLevel& box_level, const hier::IntVector& max_box_size); /* @@ -47,10 +48,10 @@ breakUpBoxes( void exhaustiveFindOverlapBoxes( hier::Connector& overlap_connector, - const hier::Box& mapped_box, + const hier::Box& box, const hier::IntVector& refinement_ratio, const boost::shared_ptr& grid_geometry, - const hier::BoxContainer& search_mapped_boxes); + const hier::BoxContainer& search_boxes); /* ************************************************************************ @@ -83,7 +84,6 @@ int main( TBOX_ERROR("mbtree test is intended to run on just one processor."); } - const int rank = mpi.getRank(); int fail_count = 0; { @@ -177,15 +177,15 @@ int main( boost::shared_ptr baseline_db( new tbox::HDFDatabase("mbtree baseline")); - boost::shared_ptr mapped_box_level_db; + boost::shared_ptr box_level_db; boost::shared_ptr connector_db; if (generate_baseline) { baseline_db->create(baseline_filename); - mapped_box_level_db = baseline_db->putDatabase("MappedBoxLevel"); + box_level_db = baseline_db->putDatabase("MappedBoxLevel"); connector_db = baseline_db->putDatabase("Connector"); } else { baseline_db->open(baseline_filename); - mapped_box_level_db = baseline_db->getDatabase("MappedBoxLevel"); + box_level_db = baseline_db->getDatabase("MappedBoxLevel"); connector_db = baseline_db->getDatabase("Connector"); } @@ -195,25 +195,27 @@ int main( plog << "Input database after running..." << std::endl; input_db->printClassData(plog); - const hier::IntVector& one_vector(hier::IntVector::getOne(dim)); + hier::IntVector one_vector(hier::IntVector::getOne(dim)); - hier::BoxLevel mapped_box_level( + hier::BoxLevel box_level( one_vector, grid_geometry, tbox::SAMRAI_MPI::getSAMRAIWorld()); grid_geometry->computePhysicalDomain( - mapped_box_level, - hier::IntVector::getOne(dim)); - mapped_box_level.finalize(); + box_level, + one_vector); + box_level.finalize(); /* * Generate boxes from the multiblock domain description. */ hier::IntVector max_box_size(dim, tbox::MathUtilities::getMax()); if (main_db->isInteger("max_box_size")) { - main_db->getIntegerArray("max_box_size", &max_box_size[0], dim.getValue()); + main_db->getIntegerArray("max_box_size", + &max_box_size[0], + dim.getValue()); } - breakUpBoxes(mapped_box_level, max_box_size); + breakUpBoxes(box_level, max_box_size); /* * Write the baseline BoxLevel or check to ensure it is @@ -222,26 +224,23 @@ int main( */ if (generate_baseline) { tbox::pout << "\nBoxLevel for review:\n" - << mapped_box_level.format("REVIEW: ", 2) + << box_level.format("REVIEW: ", 2) << std::endl; - mapped_box_level.putUnregisteredToDatabase(mapped_box_level_db); + box_level.putToRestart(box_level_db); } else { /* * Get the baselined BoxLevel and compare. */ - hier::BoxLevel baseline_mapped_box_level(dim); - baseline_mapped_box_level.getFromDatabase( - *mapped_box_level_db, - grid_geometry); - if (mapped_box_level != baseline_mapped_box_level) { + hier::BoxLevel baseline_box_level(dim, *box_level_db, grid_geometry); + if (box_level != baseline_box_level) { tbox::perr << "Multiblock Tree test problem:\n" << "the BoxLevel generated is different\n" << "from the one in the database. Thus the check\n" << "cannot be done.\n"; ++fail_count; - tbox::pout << mapped_box_level.format("M: ", 2) + tbox::pout << box_level.format("M: ", 2) << std::endl - << baseline_mapped_box_level.format("B: ", 2); + << baseline_box_level.format("B: ", 2); } } @@ -249,7 +248,7 @@ int main( * Generate boxes from the multiblock domain description. */ - const hier::BoxContainer& level_boxes = mapped_box_level.getBoxes(); + const hier::BoxContainer& level_boxes = box_level.getBoxes(); level_boxes.makeTree(grid_geometry.get()); /* @@ -257,22 +256,24 @@ int main( */ hier::IntVector connector_width(dim, 1); if (main_db->isInteger("connector_width")) { - main_db->getIntegerArray("connector_width", &connector_width[0], dim.getValue()); + main_db->getIntegerArray("connector_width", + &connector_width[0], + dim.getValue()); } hier::Connector connector( - mapped_box_level, - mapped_box_level, + box_level, + box_level, connector_width); - const hier::IntVector& refinement_ratio(one_vector); + const hier::IntVector refinement_ratio(one_vector); - for (hier::BoxContainer::const_iterator bi = mapped_box_level.getBoxes().begin(); - bi != mapped_box_level.getBoxes().end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = box_level.getBoxes().begin(); + bi != box_level.getBoxes().end(); ++bi) { - const hier::Box& mapped_box(*bi); + const hier::Box& box(*bi); - hier::Box grown_box(mapped_box); + hier::Box grown_box(box); grown_box.grow(connector_width); hier::BoxContainer overlap_boxes; @@ -282,7 +283,7 @@ int main( refinement_ratio, true); - connector.insertNeighbors(overlap_boxes, mapped_box.getId()); + connector.insertNeighbors(overlap_boxes, box.getBoxId()); } /* @@ -295,29 +296,29 @@ int main( * exhaustive search method first. */ hier::Connector connector_from_exhaustive_search( - mapped_box_level, - mapped_box_level, + box_level, + box_level, connector_width); for (hier::BoxContainer::const_iterator bi = - mapped_box_level.getBoxes().begin(); - bi != mapped_box_level.getBoxes().end(); ++bi) { + box_level.getBoxes().begin(); + bi != box_level.getBoxes().end(); ++bi) { - const hier::Box& mapped_box(*bi); + const hier::Box& box(*bi); - hier::Box grown_mapped_box(mapped_box); - grown_mapped_box.grow(connector_width); + hier::Box grown_box(box); + grown_box.grow(connector_width); exhaustiveFindOverlapBoxes( connector_from_exhaustive_search, - grown_mapped_box, + grown_box, refinement_ratio, grid_geometry, - mapped_box_level.getBoxes()); + box_level.getBoxes()); } if (!connector.localNeighborhoodsEqual( - connector_from_exhaustive_search)) { + connector_from_exhaustive_search)) { tbox::perr << "Failed verification in baseline generation:\n" << "Neighborhoods from the tree search do not match\n" @@ -330,7 +331,8 @@ int main( << connector_from_exhaustive_search.format("EXHAUSTIVE: ", 2) << std::endl; - hier::Connector exhaustive_minus_tree, tree_minus_exhaustive; + boost::shared_ptr exhaustive_minus_tree, + tree_minus_exhaustive; hier::Connector::computeNeighborhoodDifferences( exhaustive_minus_tree, connector_from_exhaustive_search, @@ -340,9 +342,9 @@ int main( connector, connector_from_exhaustive_search); tbox::perr << "What's found by exhaustive search but not by tree search:\n" - << exhaustive_minus_tree.format("", 2) + << exhaustive_minus_tree->format("", 2) << "\nWhat's found by tree search but not by exhaustive search:\n" - << tree_minus_exhaustive.format("", 2) + << tree_minus_exhaustive->format("", 2) << std::endl; tbox::perr << "Baseline was NOT generated due to the above problem!" @@ -350,7 +352,7 @@ int main( ++fail_count; } else { - connector.putNeighborhoodsToDatabase(connector_db); + connector.putToRestart(connector_db); tbox::pout << "Connector for review:\n" << connector.format("REVIEW: ", 2) << "This data has been verified by comparing against the results\n" @@ -364,8 +366,7 @@ int main( /* * Get the baseline Connector NeighborhoodSet and compare. */ - hier::Connector baseline_connector; - baseline_connector.getNeighborhoodsFromDatabase(*connector_db); + hier::Connector baseline_connector(dim, *connector_db); if (!baseline_connector.localNeighborhoodsEqual(connector)) { tbox::perr << "Multiblock Tree test problem:\n" << "the NeighborhoodSets generated is different\n" @@ -409,17 +410,8 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - tbox::pout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - tbox::plog << "Process " << std::setw(5) << rank << " exiting." << std::endl; return fail_count; } @@ -429,33 +421,31 @@ int main( * to set up a non-trivial mesh configuration. */ void breakUpBoxes( - hier::BoxLevel& mapped_box_level, + hier::BoxLevel& box_level, const hier::IntVector& max_box_size) { - const tbox::Dimension& dim(mapped_box_level.getDim()); + const tbox::Dimension& dim(box_level.getDim()); - hier::BoxLevel domain_mapped_box_level(mapped_box_level); - domain_mapped_box_level.setParallelState(hier::BoxLevel::GLOBALIZED); + hier::BoxLevel domain_box_level(box_level); + domain_box_level.setParallelState(hier::BoxLevel::GLOBALIZED); - mesh::TreeLoadBalancer load_balancer(mapped_box_level.getDim()); + mesh::TreeLoadBalancer load_balancer(box_level.getDim(), + "TreeLoadBalancer"); - hier::Connector dummy_connector; + hier::Connector* dummy_connector = 0; const hier::IntVector min_size(dim, 2); const hier::IntVector bad_interval(dim, 1); - const hier::IntVector cut_factor(dim, 1); + const hier::IntVector cut_factor(hier::IntVector::getOne(dim)); load_balancer.loadBalanceBoxLevel( - mapped_box_level, - dummy_connector, + box_level, dummy_connector, boost::shared_ptr(), 0, - dummy_connector, - dummy_connector, min_size, max_box_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor); } @@ -468,49 +458,49 @@ void breakUpBoxes( */ void exhaustiveFindOverlapBoxes( hier::Connector& overlap_connector, - const hier::Box& mapped_box, + const hier::Box& box, const hier::IntVector& refinement_ratio, const boost::shared_ptr& grid_geometry, - const hier::BoxContainer& search_mapped_boxes) + const hier::BoxContainer& search_boxes) { - const hier::BoxId& box_id = mapped_box.getId(); - hier::Box transformed_box(mapped_box); - hier::BlockId transformed_block_id(mapped_box.getBlockId()); + const hier::BoxId& box_id = box.getBoxId(); + hier::Box transformed_box(box); + hier::BlockId transformed_block_id(box.getBlockId()); hier::Connector::NeighborhoodIterator base_box_itr = overlap_connector.findLocal(box_id); bool has_base_box = base_box_itr != overlap_connector.end(); - for (hier::BoxContainer::const_iterator bi = search_mapped_boxes.begin(); - bi != search_mapped_boxes.end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = search_boxes.begin(); + bi != search_boxes.end(); ++bi) { - const hier::Box& search_mapped_box(*bi); + const hier::Box& search_box(*bi); /* - * Get transformed_box in coordinate of search_mapped_box, if + * Get transformed_box in coordinate of search_box, if * the two blocks are neighbors. If the blocks are not - * neighbors, there can't be any overlap between mapped_box and - * search_mapped_box. + * neighbors, there can't be any overlap between box and + * search_box. */ - if (transformed_block_id != search_mapped_box.getBlockId()) { - transformed_box = mapped_box; + if (transformed_block_id != search_box.getBlockId()) { + transformed_box = box; bool transformed = grid_geometry->transformBox(transformed_box, refinement_ratio, - search_mapped_box.getBlockId(), - mapped_box.getBlockId()); + search_box.getBlockId(), + box.getBlockId()); transformed_block_id = transformed ? - search_mapped_box.getBlockId() : - mapped_box.getBlockId(); + search_box.getBlockId() : + box.getBlockId(); } - if (transformed_block_id == search_mapped_box.getBlockId()) { - if (transformed_box.intersects(search_mapped_box)) { + if (transformed_block_id == search_box.getBlockId()) { + if (transformed_box.intersects(search_box)) { if (!has_base_box) { base_box_itr = overlap_connector.makeEmptyLocalNeighborhood( - box_id); + box_id); has_base_box = true; } overlap_connector.insertLocalNeighbor( - search_mapped_box, + search_box, base_box_itr); } } diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.baselinedb index 1f044ab6..1dcf842e 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.input index 1cc32b7d..a0f4cfbe 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.simple.2d.input @@ -3,70 +3,78 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ Main { - dim = 2 -// -// Log file information -// - base_name = "mbtree.3blk.simple.2d" - log_all_nodes = TRUE - -// generate_baseline = TRUE // Default is FALSE - baseline_dirname = "test_inputs" -// For breaking up user-specified boxes. -max_box_size = 10000,10000 // Do not break up. Keep config simple. + // Dimension of problem. No default. + dim = 2 -connector_width = 1,1 + // Base name of log files. Default is "unnamed". + base_name = "mbtree.3blk.simple.2d" -GridGeometry { - num_blocks = 3 - domain_boxes_0 = [ (0,0) , (20,13) ] - domain_boxes_1 = [ (0,0) , (25,13) ] - domain_boxes_2 = [ (0,0) , (20,25) ] + // If true all nodes will log to individual files + // If false only node 0 will log + // Default is FALSE. + log_all_nodes = TRUE - Singularity0 { - blocks = 0,1,2 + // Set generate_baseline to TRUE in order to regenerate the baseline + // files. Default is FALSE + // generate_baseline = TRUE - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } + // Directory where baselines exist. No default. + baseline_dirname = "test_inputs" - BlockNeighbors0 { - block_a = 0 - block_b = 1 + // Set the maximum box size for the boxes that will go into the tree. + // If any of the domain boxes specified in the GridGeometry are larger + // than this size, they will be split into boxes below this size. + // A large value of max_box_size will mean no boxes will be split. + // Default is INT_MAX. + max_box_size = 10000,10000 - rotation_b_to_a = "I_UP", "J_UP" - point_in_a_space = 21,0 - point_in_b_space = 0,0 - } + // Connector width of the Connector that will use the tree to do an + // overlap search. Default is 1,1. + connector_width = 1,1 - BlockNeighbors1 { - block_a = 0 - block_b = 2 + // Refer to hier::BaseGridGeometry and geom::GridGeometry for input + GridGeometry { + num_blocks = 3 + domain_boxes_0 = [ (0,0) , (20,13) ] + domain_boxes_1 = [ (0,0) , (25,13) ] + domain_boxes_2 = [ (0,0) , (20,25) ] - rotation_b_to_a = "I_UP", "J_UP" - point_in_a_space = 0,14 - point_in_b_space = 0,0 + BlockNeighbors0 { + block_a = 0 + block_b = 1 - } + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 21,0 + point_in_b_space = 0,0 + } - BlockNeighbors2 { - block_a = 1 - block_b = 2 + BlockNeighbors1 { + block_a = 0 + block_b = 2 - rotation_b_to_a = "J_UP", "I_DOWN" - point_in_a_space = 0,14 - point_in_b_space = 20,0 + rotation_b_to_a = "I_UP", "J_UP" + point_in_a_space = 0,14 + point_in_b_space = 0,0 - } + } -} + BlockNeighbors2 { + block_a = 1 + block_b = 2 + + rotation_b_to_a = "J_UP", "I_DOWN" + point_in_a_space = 0,14 + point_in_b_space = 20,0 + + } + + } } diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.baselinedb index 14cebb98..d7b47c87 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.input index 4bdf774b..e33999c8 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.3blk.subdivided.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ +// Refer to mbtree.3blk.simple.2d.input for full description of all input +// parameters specific to this problem. + Main { dim = 2 // @@ -30,14 +33,6 @@ GridGeometry { domain_boxes_1 = [ (0,0) , (25,13) ] domain_boxes_2 = [ (0,0) , (20,25) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(21,14),(21,14)] - sing_box_1 = [(-1,14),(-1,14)] - sing_box_2 = [(21,-1),(21,-1)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.baselinedb index a72d956c..e104d79f 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.input index 0d415f2d..0536b47a 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.simple.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ +// Refer to mbtree.3blk.simple.2d.input for full description of all input +// parameters specific to this problem. + Main { dim = 2 // @@ -32,16 +35,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -58,7 +51,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -68,7 +60,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -98,7 +89,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -108,7 +98,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -128,7 +117,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.baselinedb index 1d5fa515..66e95089 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.input index 1505e063..5dc65d2b 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.5blk.subdivided.2d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing multiblock tree searches. * ************************************************************************/ +// Refer to mbtree.3blk.simple.2d.input for full description of all input +// parameters specific to this problem. + Main { dim = 2 // @@ -32,16 +35,6 @@ GridGeometry { domain_boxes_3 = [ (0,0) , (19,19) ] domain_boxes_4 = [ (0,0) , (19,19) ] - Singularity0 { - blocks = 0,1,2,3,4 - - sing_box_0 = [(20,20),(20,20)] - sing_box_1 = [(20,20),(20,20)] - sing_box_2 = [(20,-1),(20,-1)] - sing_box_3 = [(-1,-1),(-1,-1)] - sing_box_4 = [(-1,20),(-1,20)] - } - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -58,7 +51,6 @@ GridGeometry { rotation_b_to_a = "J_UP", "I_DOWN" point_in_a_space = 19,19 point_in_b_space = 20,-1 - is_singularity = TRUE } BlockNeighbors2 { @@ -68,7 +60,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors3 { @@ -98,7 +89,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,19 point_in_b_space = -1,-1 - is_singularity = TRUE } BlockNeighbors6 { @@ -108,7 +98,6 @@ GridGeometry { rotation_b_to_a = "J_DOWN", "I_UP" point_in_a_space = 19,19 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors7 { @@ -128,7 +117,6 @@ GridGeometry { rotation_b_to_a = "I_UP", "J_UP" point_in_a_space = 19,0 point_in_b_space = -1,20 - is_singularity = TRUE } BlockNeighbors9 { diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.baselinedb index 7044772a..79e1ea83 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.input index 20887a3d..c0c815ba 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.simple.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to mbtree.3blk.simple.2d.input for full description of all input +// parameters specific to this problem. + Main { dim = 3 // @@ -35,240 +38,6 @@ GridGeometry { domain_boxes_5 = [ (0,0,0) , (14,14,14) ] domain_boxes_6 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,1,6 - - sing_box_0 = [(-1,15,0),(-1,15,14)] - sing_box_1 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity7 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity8 { - blocks = 0,3,6 - - sing_box_0 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,15),(14,-1,15)] - } - - Singularity9 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity10 { - blocks = 0,4,6 - - sing_box_0 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity11 { - blocks = 0,5,6 - - sing_box_0 = [(-1,-1,0),(-1,-1,14)] - sing_box_5 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity12 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity13 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity14 { - blocks = 1,3,6 - - sing_box_1 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(15,0,15),(15,14,15)] - } - - Singularity15 { - blocks = 1,4,6 - - sing_box_1 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(15,0,-1),(15,14,-1)] - } - - Singularity16 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity17 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity18 { - blocks = 3,5,6 - - sing_box_3 = [(-1,0,15),(-1,14,15)] - sing_box_5 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(-1,0,15),(-1,14,15)] - } - - Singularity19 { - blocks = 4,5,6 - - sing_box_4 = [(-1,0,-1),(-1,14,-1)] - sing_box_5 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(-1,0,-1),(-1,14,-1)] - } - - Singularity20 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity21 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity22 { - blocks = 0,1,3,6 - - sing_box_0 = [(-1,15,15),(-1,15,15)] - sing_box_1 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(15,-1,15),(15,-1,15)] - } - - Singularity23 { - blocks = 0,1,4,6 - - sing_box_0 = [(-1,15,-1),(-1,15,-1)] - sing_box_1 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity24 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity25 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - Singularity26 { - blocks = 0,3,5,6 - - sing_box_0 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,15),(-1,-1,15)] - sing_box_5 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(-1,-1,15),(-1,-1,15)] - } - - Singularity27 { - blocks = 0,4,5,6 - - sing_box_0 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_5 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(-1,-1,-1),(-1,-1,-1)] - } - - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -343,15 +112,24 @@ GridGeometry { } BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { block_a = 2 block_b = 3 - rotation_b_to_a = "J_UP", "K_DOWN", "I_DOWN" + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" point_in_a_space = 0,0,14 - point_in_b_space = 15,0,14 + point_in_b_space = 15,0,0 } - BlockNeighbors9 { + BlockNeighbors10 { block_a = 2 block_b = 4 @@ -360,7 +138,7 @@ GridGeometry { point_in_b_space = 15,0,14 } - BlockNeighbors10 { + BlockNeighbors11 { block_a = 2 block_b = 5 @@ -369,7 +147,7 @@ GridGeometry { point_in_b_space = 15,0,0 } - BlockNeighbors11 { + BlockNeighbors12 { block_a = 3 block_b = 5 @@ -378,6 +156,51 @@ GridGeometry { point_in_b_space = 14,0,-1 } + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + } } diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.baselinedb b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.baselinedb index 27b3429f..e8d781a4 100644 Binary files a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.baselinedb and b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.baselinedb differ diff --git a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.input b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.input index 926f905f..de96f58f 100644 --- a/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/mblktree/test_inputs/mbtree.full.subdivided.3d.input @@ -3,11 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: input file for testing communication of SAMRAI cell data. * ************************************************************************/ +// Refer to mbtree.3blk.simple.2d.input for full description of all input +// parameters specific to this problem. + Main { dim = 3 // @@ -35,240 +38,6 @@ GridGeometry { domain_boxes_5 = [ (0,0,0) , (14,14,14) ] domain_boxes_6 = [ (0,0,0) , (14,14,14) ] - Singularity0 { - blocks = 0,1,2 - - sing_box_0 = [(15,15,0),(15,15,14)] - sing_box_1 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity1 { - blocks = 0,1,3 - - sing_box_0 = [(0,15,15),(14,15,15)] - sing_box_1 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity2 { - blocks = 0,1,4 - - sing_box_0 = [(0,15,-1),(14,15,-1)] - sing_box_1 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,15),(14,-1,15)] - } - - Singularity3 { - blocks = 0,1,6 - - sing_box_0 = [(-1,15,0),(-1,15,14)] - sing_box_1 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(15,-1,0),(15,-1,14)] - } - - Singularity4 { - blocks = 0,2,3 - - sing_box_0 = [(15,0,15),(15,14,15)] - sing_box_2 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(15,-1,0),(15,-1,14)] - } - - Singularity5 { - blocks = 0,2,4 - - sing_box_0 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(15,-1,0),(15,-1,14)] - } - - Singularity6 { - blocks = 0,2,5 - - sing_box_0 = [(15,-1,0),(15,-1,14)] - sing_box_2 = [(15,-1,0),(15,-1,14)] - sing_box_5 = [(15,-1,0),(15,-1,14)] - } - - Singularity7 { - blocks = 0,3,5 - - sing_box_0 = [(0,-1,15),(14,-1,15)] - sing_box_3 = [(0,-1,15),(14,-1,15)] - sing_box_5 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity8 { - blocks = 0,3,6 - - sing_box_0 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,15),(14,-1,15)] - } - - Singularity9 { - blocks = 0,4,5 - - sing_box_0 = [(0,-1,-1),(14,-1,-1)] - sing_box_4 = [(0,-1,-1),(14,-1,-1)] - sing_box_5 = [(0,-1,15),(14,-1,15)] - } - - Singularity10 { - blocks = 0,4,6 - - sing_box_0 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(0,-1,-1),(14,-1,-1)] - } - - Singularity11 { - blocks = 0,5,6 - - sing_box_0 = [(-1,-1,0),(-1,-1,14)] - sing_box_5 = [(-1,-1,0),(-1,-1,14)] - sing_box_6 = [(-1,-1,0),(-1,-1,14)] - } - - Singularity12 { - blocks = 1,2,3 - - sing_box_1 = [(15,0,15),(15,14,15)] - sing_box_2 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(15,0,-1),(15,14,-1)] - } - - Singularity13 { - blocks = 1,2,4 - - sing_box_1 = [(15,0,-1),(15,14,-1)] - sing_box_2 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(15,0,15),(15,14,15)] - } - - Singularity14 { - blocks = 1,3,6 - - sing_box_1 = [(-1,0,15),(-1,14,15)] - sing_box_3 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(15,0,15),(15,14,15)] - } - - Singularity15 { - blocks = 1,4,6 - - sing_box_1 = [(-1,0,-1),(-1,14,-1)] - sing_box_4 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(15,0,-1),(15,14,-1)] - } - - Singularity16 { - blocks = 2,3,5 - - sing_box_2 = [(15,0,15),(15,14,15)] - sing_box_3 = [(15,0,15),(15,14,15)] - sing_box_5 = [(15,0,-1),(15,14,-1)] - } - - Singularity17 { - blocks = 2,4,5 - - sing_box_2 = [(15,0,-1),(15,14,-1)] - sing_box_4 = [(15,0,-1),(15,14,-1)] - sing_box_5 = [(15,0,15),(15,14,15)] - } - - Singularity18 { - blocks = 3,5,6 - - sing_box_3 = [(-1,0,15),(-1,14,15)] - sing_box_5 = [(-1,0,-1),(-1,14,-1)] - sing_box_6 = [(-1,0,15),(-1,14,15)] - } - - Singularity19 { - blocks = 4,5,6 - - sing_box_4 = [(-1,0,-1),(-1,14,-1)] - sing_box_5 = [(-1,0,15),(-1,14,15)] - sing_box_6 = [(-1,0,-1),(-1,14,-1)] - } - - Singularity20 { - blocks = 0,1,2,3 - - sing_box_0 = [(15,15,15),(15,15,15)] - sing_box_1 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity21 { - blocks = 0,1,2,4 - - sing_box_0 = [(15,15,-1),(15,15,-1)] - sing_box_1 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(15,-1,15),(15,-1,15)] - } - - Singularity22 { - blocks = 0,1,3,6 - - sing_box_0 = [(-1,15,15),(-1,15,15)] - sing_box_1 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(15,-1,15),(15,-1,15)] - } - - Singularity23 { - blocks = 0,1,4,6 - - sing_box_0 = [(-1,15,-1),(-1,15,-1)] - sing_box_1 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity24 { - blocks = 0,2,3,5 - - sing_box_0 = [(15,-1,15),(15,-1,15)] - sing_box_2 = [(15,-1,15),(15,-1,15)] - sing_box_3 = [(15,-1,15),(15,-1,15)] - sing_box_5 = [(15,-1,-1),(15,-1,-1)] - } - - Singularity25 { - blocks = 0,2,4,5 - - sing_box_0 = [(15,-1,-1),(15,-1,-1)] - sing_box_2 = [(15,-1,-1),(15,-1,-1)] - sing_box_4 = [(15,-1,-1),(15,-1,-1)] - sing_box_5 = [(15,-1,15),(15,-1,15)] - } - - Singularity26 { - blocks = 0,3,5,6 - - sing_box_0 = [(-1,-1,15),(-1,-1,15)] - sing_box_3 = [(-1,-1,15),(-1,-1,15)] - sing_box_5 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_6 = [(-1,-1,15),(-1,-1,15)] - } - - Singularity27 { - blocks = 0,4,5,6 - - sing_box_0 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_4 = [(-1,-1,-1),(-1,-1,-1)] - sing_box_5 = [(-1,-1,15),(-1,-1,15)] - sing_box_6 = [(-1,-1,-1),(-1,-1,-1)] - } - - - BlockNeighbors0 { block_a = 0 block_b = 1 @@ -343,15 +112,24 @@ GridGeometry { } BlockNeighbors8 { + block_a = 1 + block_b = 6 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 15,0,0 + } + + BlockNeighbors9 { block_a = 2 block_b = 3 - rotation_b_to_a = "J_UP", "K_DOWN", "I_DOWN" + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" point_in_a_space = 0,0,14 - point_in_b_space = 15,0,14 + point_in_b_space = 15,0,0 } - BlockNeighbors9 { + BlockNeighbors10 { block_a = 2 block_b = 4 @@ -360,7 +138,7 @@ GridGeometry { point_in_b_space = 15,0,14 } - BlockNeighbors10 { + BlockNeighbors11 { block_a = 2 block_b = 5 @@ -369,7 +147,7 @@ GridGeometry { point_in_b_space = 15,0,0 } - BlockNeighbors11 { + BlockNeighbors12 { block_a = 3 block_b = 5 @@ -378,6 +156,51 @@ GridGeometry { point_in_b_space = 14,0,-1 } + BlockNeighbors13 { + block_a = 3 + block_b = 6 + + rotation_b_to_a = "K_UP", "J_UP", "I_DOWN" + point_in_a_space = 0,0,14 + point_in_b_space = 0,0,15 + } + + BlockNeighbors14 { + block_a = 4 + block_b = 5 + + rotation_b_to_a = "I_UP", "J_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,15 + } + + BlockNeighbors15 { + block_a = 4 + block_b = 6 + + rotation_b_to_a = "K_DOWN", "J_UP", "I_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,0,-1 + } + + BlockNeighbors16 { + block_a = 5 + block_b = 6 + + rotation_b_to_a = "I_DOWN", "J_UP", "K_DOWN" + point_in_a_space = 0,0,0 + point_in_b_space = -1,0,14 + } + + BlockNeighbors17 { + block_a = 0 + block_b = 6 + + rotation_b_to_a = "J_DOWN", "I_UP", "K_UP" + point_in_a_space = 0,0,0 + point_in_b_space = 0,-1,0 + } + } } diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.depend index 4f363d74..01340001 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -55,12 +55,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -165,7 +167,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -181,8 +182,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -204,11 +205,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ ModifiedBratuFort.h ModifiedBratuProblem.C \ ModifiedBratuProblem.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -270,12 +271,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -287,6 +287,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -296,6 +297,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -309,7 +311,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -321,12 +326,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -359,7 +366,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -367,11 +373,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -446,12 +453,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/solv/SNES_SAMRAIContext.h \ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -466,9 +473,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -492,10 +500,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ ModifiedBratuProblem.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -556,515 +564,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=tbox_Pointer-CellPoissonFACSolver-NDIM.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ - $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ - $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - tbox_Pointer-CellPoissonFACSolver-NDIM.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - -FILE_3=tbox_Pointer-ModifiedBratuProblem.o -DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/ImplicitEquationStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ - $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/KINSOLAbstractFunctions.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ - $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SNESAbstractFunctions.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - ModifiedBratuProblem.h tbox_Pointer-ModifiedBratuProblem.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.in b/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.in index ce25aded..a12393ee 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for nonlinear solver test ## ######################################################################### @@ -14,244 +14,198 @@ SUBDIR = source/test/nonlinear VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DDISPLAY -DNDIM=$(PDIM) -DTESTING=1 +SUBDIRS = fortran -CXX_OBJS = main.o ModifiedBratuProblem.o \ - tbox_Pointer-CellPoissonFACSolver-NDIM.o tbox_Pointer-ModifiedBratuProblem.o -F_OBJS = \ - FACjacobian1d.o bcFluxCopy1d.o bcFluxFix1d.o bratufunc1d.o \ - err1d.o evalBratu1d.o evalDiffusionCoef1d.o evalExponential1d.o evalF1d.o \ - evalFaceFluxes1d.o evalJv1d.o evalSource1d.o setbc1d.o adjcrsfineoffdiag1d.o \ - \ - FACjacobian3d.o bcFluxCopy3d.o bcFluxFix3d.o bratufunc3d.o \ - err3d.o evalBratu3d.o evalDiffusionCoef3d.o evalExponential3d.o evalF3d.o \ - evalFaceFluxes3d.o evalJv3d.o evalSource3d.o setbc3d.o \ - \ - FACjacobian2d.o bcFluxCopy2d.o bcFluxFix2d.o bratufunc2d.o \ - err2d.o evalBratu2d.o evalDiffusionCoef2d.o evalExponential2d.o evalF2d.o \ - evalFaceFluxes2d.o evalJv2d.o evalSource2d.o setbc2d.o +CPPFLAGS_EXTRA= -DDISPLAY -DTESTING=1 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = main.o ModifiedBratuProblem.o +F_OBJS = \ + fortran/FACjacobian1d.o \ + fortran/bcFluxCopy1d.o \ + fortran/bcFluxFix1d.o \ + fortran/bratufunc1d.o \ + fortran/err1d.o \ + fortran/evalBratu1d.o \ + fortran/evalDiffusionCoef1d.o \ + fortran/evalExponential1d.o \ + fortran/evalF1d.o \ + fortran/evalFaceFluxes1d.o \ + fortran/evalJv1d.o \ + fortran/evalSource1d.o \ + fortran/setbc1d.o \ + fortran/adjcrsfineoffdiag1d.o \ + fortran/FACjacobian3d.o \ + fortran/bcFluxCopy3d.o \ + fortran/bcFluxFix3d.o \ + fortran/bratufunc3d.o \ + fortran/err3d.o \ + fortran/evalBratu3d.o \ + fortran/evalDiffusionCoef3d.o \ + fortran/evalExponential3d.o \ + fortran/evalF3d.o \ + fortran/evalFaceFluxes3d.o \ + fortran/evalJv3d.o \ + fortran/evalSource3d.o \ + fortran/setbc3d.o \ + fortran/FACjacobian2d.o \ + fortran/bcFluxCopy2d.o \ + fortran/bcFluxFix2d.o \ + fortran/bratufunc2d.o \ + fortran/err2d.o \ + fortran/evalBratu2d.o \ + fortran/evalDiffusionCoef2d.o \ + fortran/evalExponential2d.o \ + fortran/evalF2d.o \ + fortran/evalFaceFluxes2d.o \ + fortran/evalJv2d.o \ + fortran/evalSource2d.o \ + fortran/setbc2d.o main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ $(LIBSAMRAI) $(LDLIBS) -o main -check: - $(MAKE) check2d - echo Skipping for now: $(MAKE) check3d - -check2d: main - @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -check3dx: main - @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -# Disable check3d from test, because it takes too long. -# It can be run using check3dx -check3d: main +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/FACjacobian1d.o: -checkcompile: main +fortran/bcFluxCopy1d.o: -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile +fortran/bcFluxFix1d.o: -clean-check: - $(SAMCLEAN) +fortran/bratufunc1d.o: -clean: clean-check - $(RM) *.o *.f main - $(RM) -rf *visit +fortran/err1d.o: -include $(SRCDIR)/Makefile.depend +fortran/evalBratu1d.o: -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +fortran/evalDiffusionCoef1d.o: -FACjacobian1d.o: $(FORTRAN)/FACjacobian1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/FACjacobian1d.m4 > FACjacobian1d.f - $(F77) $(FFLAGS) -c FACjacobian1d.f -o $@ +fortran/evalExponential1d.o: -adjcrsfineoffdiag1d.o: $(FORTRAN)/adjcrsfineoffdiag1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/adjcrsfineoffdiag1d.m4 > adjcrsfineoffdiag1d.f - $(F77) $(FFLAGS) -c adjcrsfineoffdiag1d.f -o $@ +fortran/evalF1d.o: -bcFluxCopy1d.o: $(FORTRAN)/bcFluxCopy1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxCopy1d.m4 > bcFluxCopy1d.f - $(F77) $(FFLAGS) -c bcFluxCopy1d.f -o $@ +fortran/evalFaceFluxes1d.o: -bcFluxFix1d.o: $(FORTRAN)/bcFluxFix1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxFix1d.m4 > bcFluxFix1d.f - $(F77) $(FFLAGS) -c bcFluxFix1d.f -o $@ +fortran/evalJv1d.o: -bratufunc1d.o: $(FORTRAN)/bratufunc1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bratufunc1d.m4 > bratufunc1d.f - $(F77) $(FFLAGS) -c bratufunc1d.f -o $@ +fortran/evalSource1d.o: -err1d.o: $(FORTRAN)/err1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/err1d.m4 > err1d.f - $(F77) $(FFLAGS) -c err1d.f -o $@ +fortran/setbc1d.o: -evalBratu1d.o: $(FORTRAN)/evalBratu1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalBratu1d.m4 > evalBratu1d.f - $(F77) $(FFLAGS) -c evalBratu1d.f -o $@ +fortran/adjcrsfineoffdiag1d.o: -evalDiffusionCoef1d.o: $(FORTRAN)/evalDiffusionCoef1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalDiffusionCoef1d.m4 > evalDiffusionCoef1d.f - $(F77) $(FFLAGS) -c evalDiffusionCoef1d.f -o $@ +fortran/FACjacobian3d.o: -evalExponential1d.o: $(FORTRAN)/evalExponential1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalExponential1d.m4 > evalExponential1d.f - $(F77) $(FFLAGS) -c evalExponential1d.f -o $@ +fortran/bcFluxCopy3d.o: -evalF1d.o: $(FORTRAN)/evalF1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalF1d.m4 > evalF1d.f - $(F77) $(FFLAGS) -c evalF1d.f -o $@ +fortran/bcFluxFix3d.o: -evalFaceFluxes1d.o: $(FORTRAN)/evalFaceFluxes1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalFaceFluxes1d.m4 > evalFaceFluxes1d.f - $(F77) $(FFLAGS) -c evalFaceFluxes1d.f -o $@ +fortran/bratufunc3d.o: -evalJv1d.o: $(FORTRAN)/evalJv1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalJv1d.m4 > evalJv1d.f - $(F77) $(FFLAGS) -c evalJv1d.f -o $@ +fortran/err3d.o: -evalSource1d.o: $(FORTRAN)/evalSource1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalSource1d.m4 > evalSource1d.f - $(F77) $(FFLAGS) -c evalSource1d.f -o $@ +fortran/evalBratu3d.o: -setbc1d.o: $(FORTRAN)/setbc1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/setbc1d.m4 > setbc1d.f - $(F77) $(FFLAGS) -c setbc1d.f -o $@ +fortran/evalDiffusionCoef3d.o: +fortran/evalExponential3d.o: -FACjacobian2d.o: $(FORTRAN)/FACjacobian2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/FACjacobian2d.m4 > FACjacobian2d.f - $(F77) $(FFLAGS) -c FACjacobian2d.f -o $@ +fortran/evalF3d.o: -adjcrsfineoffdiag2d.o: $(FORTRAN)/adjcrsfineoffdiag2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/adjcrsfineoffdiag2d.m4 > adjcrsfineoffdiag2d.f - $(F77) $(FFLAGS) -c adjcrsfineoffdiag2d.f -o $@ +fortran/evalFaceFluxes3d.o: -bcFluxCopy2d.o: $(FORTRAN)/bcFluxCopy2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxCopy2d.m4 > bcFluxCopy2d.f - $(F77) $(FFLAGS) -c bcFluxCopy2d.f -o $@ +fortran/evalJv3d.o: -bcFluxFix2d.o: $(FORTRAN)/bcFluxFix2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxFix2d.m4 > bcFluxFix2d.f - $(F77) $(FFLAGS) -c bcFluxFix2d.f -o $@ +fortran/evalSource3d.o: -bratufunc2d.o: $(FORTRAN)/bratufunc2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bratufunc2d.m4 > bratufunc2d.f - $(F77) $(FFLAGS) -c bratufunc2d.f -o $@ +fortran/setbc3d.o: -err2d.o: $(FORTRAN)/err2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/err2d.m4 > err2d.f - $(F77) $(FFLAGS) -c err2d.f -o $@ +fortran/FACjacobian2d.o: -evalBratu2d.o: $(FORTRAN)/evalBratu2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalBratu2d.m4 > evalBratu2d.f - $(F77) $(FFLAGS) -c evalBratu2d.f -o $@ +fortran/bcFluxCopy2d.o: -evalDiffusionCoef2d.o: $(FORTRAN)/evalDiffusionCoef2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalDiffusionCoef2d.m4 > evalDiffusionCoef2d.f - $(F77) $(FFLAGS) -c evalDiffusionCoef2d.f -o $@ +fortran/bcFluxFix2d.o: -evalExponential2d.o: $(FORTRAN)/evalExponential2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalExponential2d.m4 > evalExponential2d.f - $(F77) $(FFLAGS) -c evalExponential2d.f -o $@ +fortran/bratufunc2d.o: -evalF2d.o: $(FORTRAN)/evalF2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalF2d.m4 > evalF2d.f - $(F77) $(FFLAGS) -c evalF2d.f -o $@ +fortran/err2d.o: -evalFaceFluxes2d.o: $(FORTRAN)/evalFaceFluxes2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalFaceFluxes2d.m4 > evalFaceFluxes2d.f - $(F77) $(FFLAGS) -c evalFaceFluxes2d.f -o $@ +fortran/evalBratu2d.o: -evalJv2d.o: $(FORTRAN)/evalJv2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalJv2d.m4 > evalJv2d.f - $(F77) $(FFLAGS) -c evalJv2d.f -o $@ +fortran/evalDiffusionCoef2d.o: -evalSource2d.o: $(FORTRAN)/evalSource2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalSource2d.m4 > evalSource2d.f - $(F77) $(FFLAGS) -c evalSource2d.f -o $@ +fortran/evalExponential2d.o: -setbc2d.o: $(FORTRAN)/setbc2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/setbc2d.m4 > setbc2d.f - $(F77) $(FFLAGS) -c setbc2d.f -o $@ +fortran/evalF2d.o: +fortran/evalFaceFluxes2d.o: -FACjacobian3d.o: $(FORTRAN)/FACjacobian3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/FACjacobian3d.m4 > FACjacobian3d.f - $(F77) $(FFLAGS) -c FACjacobian3d.f -o $@ +fortran/evalJv2d.o: -adjcrsfineoffdiag3d.o: $(FORTRAN)/adjcrsfineoffdiag3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/adjcrsfineoffdiag3d.m4 > adjcrsfineoffdiag3d.f - $(F77) $(FFLAGS) -c adjcrsfineoffdiag3d.f -o $@ +fortran/evalSource2d.o: -bcFluxCopy3d.o: $(FORTRAN)/bcFluxCopy3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxCopy3d.m4 > bcFluxCopy3d.f - $(F77) $(FFLAGS) -c bcFluxCopy3d.f -o $@ +fortran/setbc2d.o: -bcFluxFix3d.o: $(FORTRAN)/bcFluxFix3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bcFluxFix3d.m4 > bcFluxFix3d.f - $(F77) $(FFLAGS) -c bcFluxFix3d.f -o $@ +check: + $(MAKE) check2d -bratufunc3d.o: $(FORTRAN)/bratufunc3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/bratufunc3d.m4 > bratufunc3d.f - $(F77) $(FFLAGS) -c bratufunc3d.f -o $@ +check2d: main + @for i in test_inputs/*2d*.input ; do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} -skip_petscrc | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo -err3d.o: $(FORTRAN)/err3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/err3d.m4 > err3d.f - $(F77) $(FFLAGS) -c err3d.f -o $@ +checkcompile: main -evalBratu3d.o: $(FORTRAN)/evalBratu3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalBratu3d.m4 > evalBratu3d.f - $(F77) $(FFLAGS) -c evalBratu3d.f -o $@ +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -evalDiffusionCoef3d.o: $(FORTRAN)/evalDiffusionCoef3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalDiffusionCoef3d.m4 > evalDiffusionCoef3d.f - $(F77) $(FFLAGS) -c evalDiffusionCoef3d.f -o $@ +examples: -evalExponential3d.o: $(FORTRAN)/evalExponential3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalExponential3d.m4 > evalExponential3d.f - $(F77) $(FFLAGS) -c evalExponential3d.f -o $@ +perf3d: main + @for i in performance_inputs/*3d*.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i} -skip_petscrc; \ + done -evalF3d.o: $(FORTRAN)/evalF3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalF3d.m4 > evalF3d.f - $(F77) $(FFLAGS) -c evalF3d.f -o $@ +perf: + $(MAKE) perf3d -evalFaceFluxes3d.o: $(FORTRAN)/evalFaceFluxes3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalFaceFluxes3d.m4 > evalFaceFluxes3d.f - $(F77) $(FFLAGS) -c evalFaceFluxes3d.f -o $@ +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -evalJv3d.o: $(FORTRAN)/evalJv3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalJv3d.m4 > evalJv3d.f - $(F77) $(FFLAGS) -c evalJv3d.f -o $@ +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) nkLog.32x32.8 *.timing* -evalSource3d.o: $(FORTRAN)/evalSource3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/evalSource3d.m4 > evalSource3d.f - $(F77) $(FFLAGS) -c evalSource3d.f -o $@ +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -setbc3d.o: $(FORTRAN)/setbc3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/setbc3d.m4 > setbc3d.f - $(F77) $(FFLAGS) -c setbc3d.f -o $@ +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuFort.h b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuFort.h index 6fa3b5fe..0d3a8869 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuFort.h +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Fortran function declarations for modified-Bratu problem * ************************************************************************/ @@ -172,61 +172,61 @@ FORT_VAXPY1D( const double *, const double *); -void F77_FUNC(compfacdiag1d, COMPFACDIAG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compfacdiag1d, COMPFACDIAG1D) (const int&, const int&, const double&, const double&, const double *, const double *, double *); -void F77_FUNC(compfacoffdiag1d, COMPFACOFFDIAG1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compfacoffdiag1d, COMPFACOFFDIAG1D) (const int&, const int&, const double&, const double&, const double *, double *); -void F77_FUNC(compdiffcoef1d, COMPDIFFCOEF1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compdiffcoef1d, COMPDIFFCOEF1D) (const int&, const int&, const double *, const double *, const double&, double *); -void F77_FUNC(compexpu1d, COMPEXPU1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compexpu1d, COMPEXPU1D) (const int&, const int&, const int&, const double&, const double *, double *); -void F77_FUNC(compsrc1d, COMPSRC1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsrc1d, COMPSRC1D) (const int&, const int&, const int&, const double *, const double *, const double&, const double&, const double *, double *); -void F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (const int&, const int&, const int&, const double *, const double *, const double&, const double&, const double *, double *); -void F77_FUNC(compsideflux1d, COMPSIDEFLUX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsideflux1d, COMPSIDEFLUX1D) (const int&, const int&, const int&, const double *, const double *, const double *, double *); -void F77_FUNC(fluxbdryfix1d, FLUXBDRYFIX1D) (const int&, const int&, +void SAMRAI_F77_FUNC(fluxbdryfix1d, FLUXBDRYFIX1D) (const int&, const int&, const int&, const int&, const int&, const int&, const double&, double *); -void F77_FUNC(fluxcopy01d, FLUXCOPY01D) (const int&, const int&, +void SAMRAI_F77_FUNC(fluxcopy01d, FLUXCOPY01D) (const int&, const int&, const int&, const double *, double *); -void F77_FUNC(compresidual1d, COMPRESIDUAL1D) (const int&, const int&, +void SAMRAI_F77_FUNC(compresidual1d, COMPRESIDUAL1D) (const int&, const int&, const int&, const double *, const double&, const double *, @@ -238,7 +238,7 @@ void F77_FUNC(compresidual1d, COMPRESIDUAL1D) (const int&, const int&, // Bonus function -void F77_FUNC(adjcrsfineoffdiag1d, ADJCRSFINEOFFDIAG1D) ( +void SAMRAI_F77_FUNC(adjcrsfineoffdiag1d, ADJCRSFINEOFFDIAG1D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -456,7 +456,7 @@ FORT_VAXPY2D( /* These functions are in FACjacobian.m4 */ -void F77_FUNC(compjv2d, COMPJV2D) ( +void SAMRAI_F77_FUNC(compjv2d, COMPJV2D) ( const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, const int& gwc, @@ -467,32 +467,32 @@ void F77_FUNC(compjv2d, COMPJV2D) ( const double& dt, double* jv); -void F77_FUNC(compfacdiag2d, COMPFACDIAG2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compfacdiag2d, COMPFACDIAG2D) (const int&, const int&, const int&, const int&, const double&, const double&, const double *, const double *, double *); -void F77_FUNC(compfacoffdiag2d, COMPFACOFFDIAG2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compfacoffdiag2d, COMPFACOFFDIAG2D) (const int&, const int&, const int&, const int&, const double&, const double&, const double *, const double *, double *, double *); -void F77_FUNC(compdiffcoef2d, COMPDIFFCOEF2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compdiffcoef2d, COMPDIFFCOEF2D) (const int&, const int&, const int&, const int&, const double *, const double *, const double&, double *, double *); -void F77_FUNC(compexpu2d, COMPEXPU2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compexpu2d, COMPEXPU2D) (const int&, const int&, const int&, const int&, const int&, const double&, const double *, double *); -void F77_FUNC(compsrc2d, COMPSRC2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsrc2d, COMPSRC2D) (const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double&, @@ -500,7 +500,7 @@ void F77_FUNC(compsrc2d, COMPSRC2D) (const int&, const int&, const double *, double *); -void F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double&, @@ -508,7 +508,7 @@ void F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (const int&, const int&, const double *, double *); -void F77_FUNC(compsideflux2d, COMPSIDEFLUX2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compsideflux2d, COMPSIDEFLUX2D) (const int&, const int&, const int&, const int&, const int&, const double *, @@ -516,7 +516,7 @@ void F77_FUNC(compsideflux2d, COMPSIDEFLUX2D) (const int&, const int&, const double *, double *, double *); -void F77_FUNC(fluxbdryfix2d, FLUXBDRYFIX2D) (const int&, const int&, +void SAMRAI_F77_FUNC(fluxbdryfix2d, FLUXBDRYFIX2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -525,19 +525,19 @@ void F77_FUNC(fluxbdryfix2d, FLUXBDRYFIX2D) (const int&, const int&, const double&, double *, double *); -void F77_FUNC(fluxcopy02d, FLUXCOPY02D) (const int&, const int&, +void SAMRAI_F77_FUNC(fluxcopy02d, FLUXCOPY02D) (const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(fluxcopy12d, FLUXCOPY12D) (const int&, const int&, +void SAMRAI_F77_FUNC(fluxcopy12d, FLUXCOPY12D) (const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(compresidual2d, COMPRESIDUAL2D) (const int&, const int&, +void SAMRAI_F77_FUNC(compresidual2d, COMPRESIDUAL2D) (const int&, const int&, const int&, const int&, const int&, const double *, const double&, @@ -822,7 +822,7 @@ FORT_VAXPY3D( /* These functions are in FACjacobian.m4 */ -void F77_FUNC(compjv3d, COMPJV3D) ( +void SAMRAI_F77_FUNC(compjv3d, COMPJV3D) ( const int& ifirst0, const int& ilast0, const int& ifirst1, const int& ilast1, const int& ifirst2, const int& ilast2, @@ -834,14 +834,14 @@ void F77_FUNC(compjv3d, COMPJV3D) ( const double& dt, double* jv); -void F77_FUNC(compfacdiag3d, COMPFACDIAG3D) ( +void SAMRAI_F77_FUNC(compfacdiag3d, COMPFACDIAG3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const double *, const double *, double *); -void F77_FUNC(compfacoffdiag3d, COMPFACOFFDIAG3D) ( +void SAMRAI_F77_FUNC(compfacoffdiag3d, COMPFACOFFDIAG3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -849,7 +849,7 @@ void F77_FUNC(compfacoffdiag3d, COMPFACOFFDIAG3D) ( const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(compdiffcoef3d, COMPDIFFCOEF3D) ( +void SAMRAI_F77_FUNC(compdiffcoef3d, COMPDIFFCOEF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -857,7 +857,7 @@ void F77_FUNC(compdiffcoef3d, COMPDIFFCOEF3D) ( const double&, double *, double *, double *); -void F77_FUNC(compexpu3d, COMPEXPU3D) ( +void SAMRAI_F77_FUNC(compexpu3d, COMPEXPU3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -866,7 +866,7 @@ void F77_FUNC(compexpu3d, COMPEXPU3D) ( const double *, double *); -void F77_FUNC(compsrc3d, COMPSRC3D) ( +void SAMRAI_F77_FUNC(compsrc3d, COMPSRC3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -876,7 +876,7 @@ void F77_FUNC(compsrc3d, COMPSRC3D) ( const double *, double *); -void F77_FUNC(compsrcderv3d, COMPSRCDERV3D) ( +void SAMRAI_F77_FUNC(compsrcderv3d, COMPSRCDERV3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -886,7 +886,7 @@ void F77_FUNC(compsrcderv3d, COMPSRCDERV3D) ( const double *, double *); -void F77_FUNC(compsideflux3d, COMPSIDEFLUX3D) ( +void SAMRAI_F77_FUNC(compsideflux3d, COMPSIDEFLUX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -896,7 +896,7 @@ void F77_FUNC(compsideflux3d, COMPSIDEFLUX3D) ( const double *, double *, double *, double *); -void F77_FUNC(fluxbdryfix3d, FLUXBDRYFIX3D) ( +void SAMRAI_F77_FUNC(fluxbdryfix3d, FLUXBDRYFIX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -908,14 +908,14 @@ void F77_FUNC(fluxbdryfix3d, FLUXBDRYFIX3D) ( const double&, double *, double *, double *); -void F77_FUNC(fluxcopy03d, FLUXCOPY03D) ( +void SAMRAI_F77_FUNC(fluxcopy03d, FLUXCOPY03D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, double *); -void F77_FUNC(fluxcopy13d, FLUXCOPY13D) ( +void SAMRAI_F77_FUNC(fluxcopy13d, FLUXCOPY13D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -923,7 +923,7 @@ void F77_FUNC(fluxcopy13d, FLUXCOPY13D) ( const double *, double *); -void F77_FUNC(compresidual3d, COMPRESIDUAL3D) ( +void SAMRAI_F77_FUNC(compresidual3d, COMPRESIDUAL3D) ( const int&, const int&, const int&, const int&, const int&, const int&, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.C b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.C index 101dc28b..e4385ac9 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.C +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class containing numerical routines for modified Bratu problem * ************************************************************************/ @@ -36,8 +36,8 @@ using namespace SAMRAI; #include #include +#include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" @@ -112,51 +112,53 @@ boost::shared_ptr ModifiedBratuProblem::s_pc_timer; ModifiedBratuProblem::ModifiedBratuProblem( const string& object_name, const tbox::Dimension& dim, + const boost::shared_ptr fac_solver, boost::shared_ptr input_db, boost::shared_ptr grid_geometry, boost::shared_ptr visit_writer): - RefinePatchStrategy(dim), - CoarsenPatchStrategy(dim), + RefinePatchStrategy(), + CoarsenPatchStrategy(), d_object_name(object_name), d_dim(dim), d_grid_geometry(grid_geometry), d_lambda(tbox::MathUtilities::getSignalingNaN()), d_input_dt(tbox::MathUtilities::getSignalingNaN()), d_solution(new pdat::CellVariable( - dim, object_name + "solution", 1)), + dim, object_name + "solution", 1)), d_source_term(new pdat::CellVariable( - dim, object_name + "source_term", 1)), + dim, object_name + "source_term", 1)), d_exponential_term(new pdat::CellVariable( - dim, object_name + "exponential_term", 1)), + dim, object_name + "exponential_term", 1)), d_diffusion_coef(new pdat::SideVariable( - dim, object_name + "diffusion_coef", 1)), + dim, object_name + "diffusion_coef", hier::IntVector::getOne(dim), 1)), d_flux(new pdat::SideVariable( - dim, object_name + "flux", 1)), + dim, object_name + "flux", hier::IntVector::getOne(dim), 1)), d_coarse_fine_flux(new pdat::OutersideVariable( - dim, object_name + "coarse_fine_flux", 1)), + dim, object_name + "coarse_fine_flux", 1)), d_jacobian_a(new pdat::CellVariable( - dim, object_name + ":jacobian_a", 1)), + dim, object_name + ":jacobian_a", 1)), d_jacobian_b(new pdat::FaceVariable( - dim, object_name + ":jacobian_b", 1)), + dim, object_name + ":jacobian_b", 1)), d_jacobian_a_id(-1), d_jacobian_b_id(-1), d_precond_a(new pdat::CellVariable( - dim, object_name + "precond_a", 1)), + dim, object_name + "precond_a", 1)), d_precond_b(new pdat::FaceVariable( - dim, object_name + "precond_b", 1)), + dim, object_name + "precond_b", 1)), d_precond_a_id(-1), d_precond_b_id(-1), d_nghosts(hier::IntVector(dim, NUM_GHOSTS_U)), d_weight(new pdat::CellVariable( - dim, object_name + "weight", 1)), - d_fill_new_level(dim), - d_soln_fill(dim), + dim, object_name + "weight", 1)), + d_fill_new_level(), + d_soln_fill(), d_flux_coarsen(dim), d_soln_coarsen(dim), d_scratch_soln_coarsen(dim), d_current_time(tbox::MathUtilities::getSignalingNaN()), d_new_time(tbox::MathUtilities::getSignalingNaN()), d_current_dt(tbox::MathUtilities::getSignalingNaN()), + d_FAC_solver(fac_solver), d_max_precond_its(tbox::MathUtilities::getMax()), d_precond_tol(tbox::MathUtilities::getSignalingNaN()) { @@ -209,12 +211,10 @@ ModifiedBratuProblem::ModifiedBratuProblem( d_scratch, hier::IntVector(d_dim, 0)); - int exp_id = variable_db->registerVariableAndContext(d_exponential_term, d_scratch, hier::IntVector(d_dim, 0)); - int diffcoef_id = variable_db->registerVariableAndContext(d_diffusion_coef, d_scratch, hier::IntVector(d_dim, 0)); @@ -369,9 +369,7 @@ ModifiedBratuProblem::~ModifiedBratuProblem() void ModifiedBratuProblem::setupSolutionVector( const boost::shared_ptr >& solution) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(solution); -#endif d_solution_vector = solution; @@ -394,20 +392,21 @@ void ModifiedBratuProblem::setVectorWeights( { for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { /* * On every level, first assign cell volume to vector weight. */ boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); for (hier::PatchLevel::iterator p(level->begin()); p != level->end(); ++p) { const boost::shared_ptr& patch = *p; boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geometry); const double* dx = patch_geometry->getDx(); double cell_vol = dx[0]; if (d_dim > tbox::Dimension(1)) { @@ -417,8 +416,9 @@ void ModifiedBratuProblem::setVectorWeights( cell_vol *= dx[2]; } boost::shared_ptr > w( - patch->getPatchData(d_weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_weight_id))); + TBOX_ASSERT(w); w->fillAll(cell_vol); } @@ -452,15 +452,16 @@ void ModifiedBratuProblem::setVectorWeights( p != level->end(); ++p) { const boost::shared_ptr& patch = *p; - for (hier::BoxContainer::const_iterator i(coarsened_boxes); + for (hier::BoxContainer::const_iterator i = coarsened_boxes.begin(); i != coarsened_boxes.end(); ++i) { const hier::Box& coarse_box = *i; hier::Box intersection = coarse_box * patch->getBox(); if (!intersection.empty()) { boost::shared_ptr > w( - patch->getPatchData(d_weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_weight_id))); + TBOX_ASSERT(w); w->fillAll(0.0, intersection); } // assignment only in non-empty intersection @@ -498,18 +499,7 @@ void ModifiedBratuProblem::setInitialGuess( boost::shared_ptr hierarchy( d_solution_vector->getPatchHierarchy()); - if (first_step) { - - if (d_FAC_solver) { - d_FAC_solver.reset(); - } - - d_FAC_solver.reset( - new solv::CellPoissonFACSolver(d_dim, d_object_name + ":FAC_solver")); - - } - - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { hierarchy->getPatchLevel(ln)-> allocatePatchData(d_jacobian_data); hierarchy->getPatchLevel(ln)-> @@ -520,7 +510,7 @@ void ModifiedBratuProblem::setInitialGuess( for (int amr_level = 0; amr_level < hierarchy->getNumberOfLevels(); - amr_level++) { + ++amr_level) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(amr_level)); @@ -529,11 +519,13 @@ void ModifiedBratuProblem::setInitialGuess( const boost::shared_ptr& patch = *p; boost::shared_ptr > y_cur( - patch->getPatchData(d_solution, d_current), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_current))); boost::shared_ptr > y_new( - patch->getPatchData(d_solution, d_new), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_new))); + TBOX_ASSERT(y_cur); + TBOX_ASSERT(y_new); y_new->copy(*y_cur); y_new->setTime(d_new_time); @@ -541,8 +533,9 @@ void ModifiedBratuProblem::setInitialGuess( patch->getPatchData(d_solution, d_scratch)->setTime(d_new_time); boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geometry); const double* dx = patch_geometry->getDx(); const double* xlo = patch_geometry->getXLower(); const double* xhi = patch_geometry->getXUpper(); @@ -550,22 +543,21 @@ void ModifiedBratuProblem::setInitialGuess( const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); + TBOX_ASSERT(diffusion); if (d_dim == tbox::Dimension(1)) { FORT_EVALDIFFUSION1D(ifirst(0), ilast(0), dx, xlo, xhi, diffusion->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EVALDIFFUSION2D(ifirst(0), ilast(0), ifirst(1), ilast(1), dx, xlo, xhi, diffusion->getPointer(0), diffusion->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EVALDIFFUSION3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -580,7 +572,7 @@ void ModifiedBratuProblem::setInitialGuess( for (int amr_level = 0; amr_level < hierarchy->getNumberOfLevels(); - amr_level++) { + ++amr_level) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(amr_level)); @@ -589,11 +581,13 @@ void ModifiedBratuProblem::setInitialGuess( const boost::shared_ptr& patch = *p; boost::shared_ptr > y_cur( - patch->getPatchData(d_solution, d_current), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_current))); boost::shared_ptr > y_new( - patch->getPatchData(d_solution, d_new), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_new))); + TBOX_ASSERT(y_cur); + TBOX_ASSERT(y_new); y_new->copy(*y_cur); y_new->setTime(d_new_time); @@ -601,8 +595,9 @@ void ModifiedBratuProblem::setInitialGuess( patch->getPatchData(d_solution, d_scratch)->setTime(d_new_time); boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geometry); const double* dx = patch_geometry->getDx(); const double* xlo = patch_geometry->getXLower(); const double* xhi = patch_geometry->getXUpper(); @@ -610,21 +605,20 @@ void ModifiedBratuProblem::setInitialGuess( const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); + TBOX_ASSERT(diffusion); if (d_dim == tbox::Dimension(1)) { FORT_EVALDIFFUSION1D(ifirst(0), ilast(0), dx, xlo, xhi, diffusion->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EVALDIFFUSION2D(ifirst(0), ilast(0), ifirst(1), ilast(1), dx, xlo, xhi, diffusion->getPointer(0), diffusion->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EVALDIFFUSION3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -718,7 +712,7 @@ bool ModifiedBratuProblem::checkNewSolution( d_solution_vector->getPatchHierarchy()); for (int amr_level = 0; amr_level < hierarchy->getNumberOfLevels(); - amr_level++) { + ++amr_level) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(amr_level)); double levelerror = 0.0; @@ -729,17 +723,20 @@ bool ModifiedBratuProblem::checkNewSolution( const hier::Index ifirst = patch->getBox().lower(); const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const double* xlo = patch_geom->getXLower(); const double* xhi = patch_geom->getXUpper(); boost::shared_ptr > u( - patch->getPatchData(d_solution, d_new), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_new))); boost::shared_ptr > w( - patch->getPatchData(d_weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_weight_id))); + TBOX_ASSERT(u); + TBOX_ASSERT(w); if (d_dim == tbox::Dimension(1)) { FORT_ERROR1D(ifirst(0), ilast(0), @@ -748,8 +745,7 @@ bool ModifiedBratuProblem::checkNewSolution( xlo, xhi, dx, new_time, levelerror, levell2error); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_ERROR2D(ifirst(0), ilast(0), ifirst(1), ilast(1), u->getPointer(), w->getPointer(), @@ -757,8 +753,7 @@ bool ModifiedBratuProblem::checkNewSolution( xlo, xhi, dx, new_time, levelerror, levell2error); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_ERROR3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -805,7 +800,7 @@ void ModifiedBratuProblem::updateSolution( for (int amr_level = 0; amr_level < hierarchy->getNumberOfLevels(); - amr_level++) { + ++amr_level) { boost::shared_ptr patch_level( hierarchy->getPatchLevel(amr_level)); @@ -814,11 +809,13 @@ void ModifiedBratuProblem::updateSolution( const boost::shared_ptr& patch = *p; boost::shared_ptr > y_cur( - patch->getPatchData(d_solution, d_current), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_current))); boost::shared_ptr > y_new( - patch->getPatchData(d_solution, d_new), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_new))); + TBOX_ASSERT(y_cur); + TBOX_ASSERT(y_new); y_cur->copy(*y_new); y_cur->setTime(new_time); @@ -861,15 +858,11 @@ void ModifiedBratuProblem::initializeLevelData( NULL_USE(can_be_refined); NULL_USE(allocate_data); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((level_number >= 0) && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } + TBOX_ASSERT(!old_level || level_number == old_level->getLevelNumber()); TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif boost::shared_ptr level( hierarchy->getPatchLevel(level_number)); @@ -884,7 +877,7 @@ void ModifiedBratuProblem::initializeLevelData( old_level, level_number - 1, hierarchy, - NULL)); + 0)); sched->fillData(time); if (old_level) { @@ -908,15 +901,17 @@ void ModifiedBratuProblem::initializeLevelData( if (initial_time) { boost::shared_ptr > u( - patch->getPatchData(d_solution, d_current), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_current))); + TBOX_ASSERT(u); u->fillAll(0.0); } boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geometry); const double* dx = patch_geometry->getDx(); const double* xlo = patch_geometry->getXLower(); const double* xhi = patch_geometry->getXUpper(); @@ -924,21 +919,20 @@ void ModifiedBratuProblem::initializeLevelData( const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); + TBOX_ASSERT(diffusion); if (d_dim == tbox::Dimension(1)) { FORT_EVALDIFFUSION1D(ifirst(0), ilast(0), dx, xlo, xhi, diffusion->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EVALDIFFUSION2D(ifirst(0), ilast(0), ifirst(1), ilast(1), dx, xlo, xhi, diffusion->getPointer(0), diffusion->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EVALDIFFUSION3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -969,21 +963,20 @@ void ModifiedBratuProblem::resetHierarchyConfiguration( const int coarsest_level, const int finest_level) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(hierarchy); TBOX_ASSERT((coarsest_level >= 0) && (coarsest_level <= finest_level) && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln0 = 0; ln0 <= finest_level; ln0++) { +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln0 = 0; ln0 <= finest_level; ++ln0) { TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); } #endif - d_flux_coarsen_schedule.resizeArray(hierarchy->getNumberOfLevels()); - d_soln_fill_schedule.resizeArray(hierarchy->getNumberOfLevels()); - d_soln_coarsen_schedule.resizeArray(hierarchy->getNumberOfLevels()); - d_scratch_soln_coarsen_schedule.resizeArray( - hierarchy->getNumberOfLevels()); + d_flux_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); + d_soln_fill_schedule.resize(hierarchy->getNumberOfLevels()); + d_soln_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); + d_scratch_soln_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); int ln; /* @@ -1048,10 +1041,8 @@ void ModifiedBratuProblem::evaluateNonlinearFunction( solv::SundialsAbstractVector* soln, solv::SundialsAbstractVector* fval) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(soln == (solv::SundialsAbstractVector *)NULL)); - TBOX_ASSERT(!(fval == (solv::SundialsAbstractVector *)NULL)); -#endif + TBOX_ASSERT(soln != 0); + TBOX_ASSERT(fval != 0); boost::shared_ptr > x( solv::Sundials_SAMRAIVector::getSAMRAIVector(soln)); @@ -1075,9 +1066,8 @@ int ModifiedBratuProblem::precondSetup( NULL_USE(fval_scale); NULL_USE(vtemp1); NULL_USE(vtemp2); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(soln == (solv::SundialsAbstractVector *)NULL)); -#endif + + TBOX_ASSERT(soln != 0); num_feval += 0; @@ -1103,9 +1093,8 @@ int ModifiedBratuProblem::precondSolve( NULL_USE(fval); NULL_USE(fval_scale); NULL_USE(vtemp); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(rhs == (solv::SundialsAbstractVector *)NULL)); -#endif + + TBOX_ASSERT(rhs != 0); num_feval += 0; @@ -1122,11 +1111,9 @@ ModifiedBratuProblem::jacobianTimesVector( const bool soln_changed, solv::SundialsAbstractVector* soln) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(vector == (solv::SundialsAbstractVector *)NULL)); - TBOX_ASSERT(!(product == (solv::SundialsAbstractVector *)NULL)); - TBOX_ASSERT(!(soln == (solv::SundialsAbstractVector *)NULL)); -#endif + TBOX_ASSERT(vector != 0); + TBOX_ASSERT(product != 0); + TBOX_ASSERT(soln != 0); boost::shared_ptr > v( solv::Sundials_SAMRAIVector::getSAMRAIVector(vector)); @@ -1153,10 +1140,8 @@ int ModifiedBratuProblem::evaluateNonlinearFunction( Vec xcur, Vec fcur) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(xcur == NULL)); - TBOX_ASSERT(!(fcur == NULL)); -#endif + TBOX_ASSERT(xcur != 0); + TBOX_ASSERT(fcur != 0); boost::shared_ptr > x( solv::PETSc_SAMRAIVectorReal::getSAMRAIVector(xcur)); @@ -1171,9 +1156,7 @@ int ModifiedBratuProblem::evaluateNonlinearFunction( int ModifiedBratuProblem::evaluateJacobian( Vec x) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(x == NULL)); -#endif + TBOX_ASSERT(x != 0); boost::shared_ptr > xvec( solv::PETSc_SAMRAIVectorReal::getSAMRAIVector(x)); @@ -1187,10 +1170,8 @@ int ModifiedBratuProblem::jacobianTimesVector( Vec xin, Vec xout) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(xin != NULL); - TBOX_ASSERT(xout != NULL); -#endif + TBOX_ASSERT(xin != 0); + TBOX_ASSERT(xout != 0); boost::shared_ptr > xinvec( solv::PETSc_SAMRAIVectorReal::getSAMRAIVector(xin)); @@ -1216,10 +1197,8 @@ int ModifiedBratuProblem::applyPreconditioner( Vec r, Vec z) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(r != NULL); - TBOX_ASSERT(z != NULL); -#endif + TBOX_ASSERT(r != 0); + TBOX_ASSERT(z != 0); boost::shared_ptr > rhs( solv::PETSc_SAMRAIVectorReal::getSAMRAIVector(r)); @@ -1256,10 +1235,8 @@ void ModifiedBratuProblem::evaluateBratuFunction( boost::shared_ptr > x, boost::shared_ptr > f) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(x); TBOX_ASSERT(f); -#endif boost::shared_ptr hierarchy( d_solution_vector->getPatchHierarchy()); @@ -1275,9 +1252,9 @@ void ModifiedBratuProblem::evaluateBratuFunction( int amr_level = 0; for (amr_level = hierarchy->getFinestLevelNumber() - 1; amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); boost::shared_ptr finer_level( hierarchy->getPatchLevel(amr_level + 1)); eval_average.resetSchedule(d_soln_coarsen_schedule[amr_level]); @@ -1290,7 +1267,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( */ s_copy_timer->start(); - RefineAlgorithm eval_fill(d_dim); + RefineAlgorithm eval_fill; eval_fill.registerRefine(d_soln_scratch_id, x->getComponentDescriptorIndex(0), d_soln_scratch_id, @@ -1299,9 +1276,9 @@ void ModifiedBratuProblem::evaluateBratuFunction( for (amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); s_copy_timer->start(); eval_fill.resetSchedule(d_soln_fill_schedule[amr_level]); @@ -1319,24 +1296,28 @@ void ModifiedBratuProblem::evaluateBratuFunction( const boost::shared_ptr& patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch->getBox().lower(); const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr > u( - patch->getPatchData(d_solution, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_scratch))); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); boost::shared_ptr > flux( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); boost::shared_ptr > coarse_fine_flux( - patch->getPatchData(d_coarse_fine_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_coarse_fine_flux_id))); + TBOX_ASSERT(u); + TBOX_ASSERT(diffusion); + TBOX_ASSERT(flux); if (d_dim == tbox::Dimension(1)) { FORT_EVALFACEFLUXES1D(ifirst(0), ilast(0), NUM_GHOSTS_U, @@ -1344,8 +1325,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( u->getPointer(), dx, flux->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EVALFACEFLUXES2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, @@ -1355,8 +1335,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( dx, flux->getPointer(0), flux->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EVALFACEFLUXES3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1370,23 +1349,21 @@ void ModifiedBratuProblem::evaluateBratuFunction( flux->getPointer(1), flux->getPointer(2)); } - const tbox::Array bdry_faces = + const std::vector& bdry_faces = patch_geom->getCodimensionBoundaries(1); #if 0 if (d_dim == tbox::Dimension(1)) { - const tbox::Array bdry_faces = + const std::vector& bdry_faces = patch_geom->getNodeBoundaries(); - } - if (d_dim == tbox::Dimension(2)) { - const tbox::Array bdry_faces = + } else if (d_dim == tbox::Dimension(2)) { + const std::vector& bdry_faces = patch_geom->getEdgeBoundaries(); - } - if (d_dim == tbox::Dimension(3)) { - const tbox::Array bdry_faces = + } else if (d_dim == tbox::Dimension(3)) { + const std::vector& bdry_faces = patch_geom->getFaceBoundaries(); } #endif - for (int i = 0; i < bdry_faces.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_faces.size()); ++i) { hier::Box bbox = bdry_faces[i].getBox(); const hier::Index ibeg = bbox.lower(); @@ -1401,8 +1378,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( flux->getPointer(0), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EWBCFLUXFIX2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, @@ -1419,8 +1395,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( flux->getPointer(1), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EWBCFLUXFIX3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1456,14 +1431,15 @@ void ModifiedBratuProblem::evaluateBratuFunction( if (amr_level > 0) { - for (int side = 0; side < 2; side++) { + TBOX_ASSERT(coarse_fine_flux); + + for (int side = 0; side < 2; ++side) { if (d_dim == tbox::Dimension(1)) { FORT_EWFLUXCOPY1D(ifirst(0), ilast(0), flux->getPointer(0), coarse_fine_flux->getPointer(0, side), side); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EWFLUXCOPY2D(ifirst(0), ilast(0), ifirst(1), ilast(1), flux->getPointer(0), @@ -1474,8 +1450,7 @@ void ModifiedBratuProblem::evaluateBratuFunction( flux->getPointer(1), coarse_fine_flux->getPointer(1, side), side); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EWFLUXCOPY3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1527,8 +1502,9 @@ void ModifiedBratuProblem::evaluateBratuFunction( const boost::shared_ptr& patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const double* xlo = patch_geom->getXLower(); @@ -1537,69 +1513,42 @@ void ModifiedBratuProblem::evaluateBratuFunction( const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr > u( - patch->getPatchData(d_solution, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_scratch))); boost::shared_ptr > u_cur( - patch->getPatchData(d_solution, d_current), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_current))); boost::shared_ptr > source( - patch->getPatchData(d_source_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_source_term, d_scratch))); boost::shared_ptr > exponential( - patch->getPatchData(d_exponential_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exponential_term, d_scratch))); boost::shared_ptr > flux( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); boost::shared_ptr > fcur( - f->getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + f->getComponentPatchData(0, *patch))); boost::shared_ptr > xdat( - x->getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + x->getComponentPatchData(0, *patch))); + TBOX_ASSERT(u); + TBOX_ASSERT(u_cur); + TBOX_ASSERT(source); + TBOX_ASSERT(exponential); + TBOX_ASSERT(flux); + TBOX_ASSERT(fcur); + TBOX_ASSERT(xdat); if (d_dim == tbox::Dimension(1)) { FORT_EVALEXPONENTIAL1D(ifirst(0), ilast(0), xdat->getPointer(), d_lambda, exponential->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { - FORT_EVALEXPONENTIAL2D(ifirst(0), ilast(0), - ifirst(1), ilast(1), - xdat->getPointer(), - d_lambda, - exponential->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { - FORT_EVALEXPONENTIAL3D(ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - xdat->getPointer(), - d_lambda, - exponential->getPointer()); - } - if (d_dim == tbox::Dimension(1)) { FORT_EVALSOURCE1D(ifirst(0), ilast(0), d_lambda, xlo, xhi, dx, d_new_time, source->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { - FORT_EVALSOURCE2D(ifirst(0), ilast(0), - ifirst(1), ilast(1), - d_lambda, - xlo, xhi, dx, d_new_time, - source->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { - FORT_EVALSOURCE3D(ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - d_lambda, - xlo, xhi, dx, d_new_time, - source->getPointer()); - } - if (d_dim == tbox::Dimension(1)) { FORT_EVALBRATU1D(ifirst(0), ilast(0), NUM_GHOSTS_U, flux->getPointer(0), @@ -1609,8 +1558,17 @@ void ModifiedBratuProblem::evaluateBratuFunction( u->getPointer(), dx, d_current_dt, fcur->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { + FORT_EVALEXPONENTIAL2D(ifirst(0), ilast(0), + ifirst(1), ilast(1), + xdat->getPointer(), + d_lambda, + exponential->getPointer()); + FORT_EVALSOURCE2D(ifirst(0), ilast(0), + ifirst(1), ilast(1), + d_lambda, + xlo, xhi, dx, d_new_time, + source->getPointer()); FORT_EVALBRATU2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, @@ -1622,8 +1580,19 @@ void ModifiedBratuProblem::evaluateBratuFunction( u->getPointer(), dx, d_current_dt, fcur->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { + FORT_EVALEXPONENTIAL3D(ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + xdat->getPointer(), + d_lambda, + exponential->getPointer()); + FORT_EVALSOURCE3D(ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + d_lambda, + xlo, xhi, dx, d_new_time, + source->getPointer()); FORT_EVALBRATU3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1655,9 +1624,9 @@ void ModifiedBratuProblem::evaluateBratuFunction( d_soln_coarsen_op); for (amr_level = hierarchy->getFinestLevelNumber() - 1; amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); boost::shared_ptr finer_level( hierarchy->getPatchLevel(amr_level + 1)); /* @@ -1685,10 +1654,8 @@ ModifiedBratuProblem::jacobianTimesVector( boost::shared_ptr > v, boost::shared_ptr > Jv) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(v); TBOX_ASSERT(Jv); -#endif /* * Create a coarsen algorithm to average down fine-to-coarse. @@ -1708,10 +1675,10 @@ ModifiedBratuProblem::jacobianTimesVector( for (int amr_level = hierarchy->getFinestLevelNumber() - 1; amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); boost::shared_ptr finer_level( hierarchy->getPatchLevel(amr_level + 1)); jacv_average.resetSchedule(d_soln_coarsen_schedule[amr_level]); @@ -1725,7 +1692,7 @@ ModifiedBratuProblem::jacobianTimesVector( * multiplied. */ s_copy_timer->start(); - RefineAlgorithm jacv_fill(d_dim); + RefineAlgorithm jacv_fill; jacv_fill.registerRefine(d_soln_scratch_id, v->getComponentDescriptorIndex(0), d_soln_scratch_id, @@ -1753,10 +1720,10 @@ ModifiedBratuProblem::jacobianTimesVector( for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); /* * Allocate scratch space on this level used to store the fluxes. Also, @@ -1793,21 +1760,26 @@ ModifiedBratuProblem::jacobianTimesVector( const hier::Index ilast = patch->getBox().upper(); boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); + boost::shared_ptr > vdat( - patch->getPatchData(d_soln_scratch_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_soln_scratch_id))); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); boost::shared_ptr > flux( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); boost::shared_ptr > coarse_fine_flux( - patch->getPatchData(d_coarse_fine_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_coarse_fine_flux_id))); + TBOX_ASSERT(vdat); + TBOX_ASSERT(diffusion); + TBOX_ASSERT(flux); if (d_dim == tbox::Dimension(1)) { FORT_EVALFACEFLUXES1D(ifirst(0), ilast(0), @@ -1816,8 +1788,7 @@ ModifiedBratuProblem::jacobianTimesVector( vdat->getPointer(), dx, flux->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EVALFACEFLUXES2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, @@ -1827,8 +1798,7 @@ ModifiedBratuProblem::jacobianTimesVector( dx, flux->getPointer(0), flux->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EVALFACEFLUXES3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1850,23 +1820,21 @@ ModifiedBratuProblem::jacobianTimesVector( * boundaries, and the fluxes at these locations have to be modified. */ - const tbox::Array bdry_faces = + const std::vector& bdry_faces = patch_geom->getCodimensionBoundaries(1); #if 0 if (d_dim == tbox::Dimension(1)) { - const tbox::Array bdry_faces = + const std::vector& bdry_faces = patch_geom->getNodeBoundaries(); - } - if (d_dim == tbox::Dimension(2)) { - const tbox::Array bdry_faces = + } else if (d_dim == tbox::Dimension(2)) { + const std::vector& bdry_faces = patch_geom->getEdgeBoundaries(); - } - if (d_dim == tbox::Dimension(3)) { - const tbox::Array bdry_faces = + } else if (d_dim == tbox::Dimension(3)) { + const std::vector& bdry_faces = patch_geom->getFaceBoundaries(); } #endif - for (int i = 0; i < bdry_faces.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_faces.size()); ++i) { hier::Box bbox = bdry_faces[i].getBox(); const hier::Index ibeg = bbox.lower(); @@ -1881,8 +1849,7 @@ ModifiedBratuProblem::jacobianTimesVector( flux->getPointer(0), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EWBCFLUXFIX2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, @@ -1899,8 +1866,7 @@ ModifiedBratuProblem::jacobianTimesVector( flux->getPointer(1), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EWBCFLUXFIX3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1940,14 +1906,14 @@ ModifiedBratuProblem::jacobianTimesVector( */ if (amr_level > 0) { - for (int side = 0; side < 2; side++) { + TBOX_ASSERT(coarse_fine_flux); + for (int side = 0; side < 2; ++side) { if (d_dim == tbox::Dimension(1)) { FORT_EWFLUXCOPY1D(ifirst(0), ilast(0), flux->getPointer(0), coarse_fine_flux->getPointer(0, side), side); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_EWFLUXCOPY2D(ifirst(0), ilast(0), ifirst(1), ilast(1), flux->getPointer(0), @@ -1958,8 +1924,7 @@ ModifiedBratuProblem::jacobianTimesVector( flux->getPointer(1), coarse_fine_flux->getPointer(1, side), side); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_EWFLUXCOPY3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -2011,8 +1976,9 @@ ModifiedBratuProblem::jacobianTimesVector( const boost::shared_ptr& patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Index ifirst = patch->getBox().lower(); const hier::Index ilast = patch->getBox().upper(); @@ -2020,27 +1986,29 @@ ModifiedBratuProblem::jacobianTimesVector( const double* dx = patch_geom->getDx(); boost::shared_ptr > jac_a( - patch->getPatchData(d_jacobian_a_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_jacobian_a_id))); boost::shared_ptr > Jvdat( - Jv->getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + Jv->getComponentPatchData(0, *patch))); boost::shared_ptr > vdat( - patch->getPatchData(d_soln_scratch_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_soln_scratch_id))); boost::shared_ptr > flux( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); + TBOX_ASSERT(jac_a); + TBOX_ASSERT(Jvdat); + TBOX_ASSERT(vdat); + TBOX_ASSERT(flux); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(vdat->getGhostCellWidth() == hier::IntVector(d_dim, NUM_GHOSTS_U)); TBOX_ASSERT(Jvdat->getGhostCellWidth() == hier::IntVector(d_dim, 0)); TBOX_ASSERT(jac_a->getGhostCellWidth() == hier::IntVector(d_dim, 0)); -#endif if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compjv2d, COMPJV2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compjv2d, COMPJV2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, jac_a->getPointer(), @@ -2060,9 +2028,8 @@ ModifiedBratuProblem::jacobianTimesVector( dx, d_current_dt, Jvdat->getPointer()); #endif - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compjv3d, COMPJV3D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(compjv3d, COMPJV3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), NUM_GHOSTS_U, @@ -2117,14 +2084,12 @@ ModifiedBratuProblem::jacobianTimesVector( void ModifiedBratuProblem::setupBratuPreconditioner( boost::shared_ptr > x) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(x); -#endif boost::shared_ptr hierarchy( d_solution_vector->getPatchHierarchy()); - RefineAlgorithm eval_fill(d_dim); + RefineAlgorithm eval_fill; eval_fill.registerRefine(d_soln_scratch_id, x->getComponentDescriptorIndex(0), d_soln_scratch_id, @@ -2132,9 +2097,9 @@ void ModifiedBratuProblem::setupBratuPreconditioner( for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); eval_fill.resetSchedule(d_soln_fill_schedule[amr_level]); d_soln_fill_schedule[amr_level]->fillData(d_new_time); @@ -2145,8 +2110,9 @@ void ModifiedBratuProblem::setupBratuPreconditioner( const boost::shared_ptr& patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Index ifirst = patch->getBox().lower(); const hier::Index ilast = patch->getBox().upper(); @@ -2162,39 +2128,37 @@ void ModifiedBratuProblem::setupBratuPreconditioner( cell_vol *= dx[2]; } boost::shared_ptr > u( - patch->getPatchData(d_solution, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_scratch))); boost::shared_ptr > exponential( - patch->getPatchData(d_exponential_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exponential_term, d_scratch))); boost::shared_ptr > source( - patch->getPatchData(d_source_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_source_term, d_scratch))); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); boost::shared_ptr > a( - patch->getPatchData(d_precond_a_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_precond_a_id))); boost::shared_ptr > b( - patch->getPatchData(d_precond_b_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_precond_b_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(exponential); TBOX_ASSERT(source); TBOX_ASSERT(u); TBOX_ASSERT(diffusion); TBOX_ASSERT(a); TBOX_ASSERT(b); -#endif /* * Compute exponential = lambda * exp(u) */ if (d_dim == tbox::Dimension(1)) { - F77_FUNC(compexpu1d, COMPEXPU1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compexpu1d, COMPEXPU1D) (ifirst(0), ilast(0), NUM_GHOSTS_U, d_lambda, u->getPointer(), @@ -2203,16 +2167,15 @@ void ModifiedBratuProblem::setupBratuPreconditioner( /* * Compute source = df/du */ - F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (ifirst(0), ilast(0), NUM_GHOSTS_U, xlo, dx, d_new_time, d_lambda, u->getPointer(), source->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compexpu2d, COMPEXPU2D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(compexpu2d, COMPEXPU2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, d_lambda, @@ -2222,7 +2185,7 @@ void ModifiedBratuProblem::setupBratuPreconditioner( /* * Compute source = df/du */ - F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, xlo, dx, @@ -2230,9 +2193,8 @@ void ModifiedBratuProblem::setupBratuPreconditioner( d_lambda, u->getPointer(), source->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compexpu3d, COMPEXPU3D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(compexpu3d, COMPEXPU3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), NUM_GHOSTS_U, @@ -2243,7 +2205,7 @@ void ModifiedBratuProblem::setupBratuPreconditioner( /* * Compute source = df/du */ - F77_FUNC(compsrcderv3d, COMPSRCDERV3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv3d, COMPSRCDERV3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), NUM_GHOSTS_U, @@ -2257,24 +2219,22 @@ void ModifiedBratuProblem::setupBratuPreconditioner( * Compute a = cell_vol * ( 1 - d_current_dt*(exponential + source)) */ if (d_dim == tbox::Dimension(1)) { - F77_FUNC(compfacdiag1d, COMPFACDIAG1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compfacdiag1d, COMPFACDIAG1D) (ifirst(0), ilast(0), d_current_dt, cell_vol, exponential->getPointer(), source->getPointer(), a->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compfacdiag2d, COMPFACDIAG2D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(compfacdiag2d, COMPFACDIAG2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), d_current_dt, cell_vol, exponential->getPointer(), source->getPointer(), a->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compfacdiag3d, COMPFACDIAG3D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(compfacdiag3d, COMPFACDIAG3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_current_dt, @@ -2289,14 +2249,13 @@ void ModifiedBratuProblem::setupBratuPreconditioner( * and multiply by cell_vol*d_current_dt. */ if (d_dim == tbox::Dimension(1)) { - F77_FUNC(compfacoffdiag1d, COMPFACOFFDIAG1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compfacoffdiag1d, COMPFACOFFDIAG1D) (ifirst(0), ilast(0), d_current_dt, cell_vol, diffusion->getPointer(0), b->getPointer(0)); - } - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(compfacoffdiag2d, COMPFACOFFDIAG2D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(compfacoffdiag2d, COMPFACOFFDIAG2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), d_current_dt, cell_vol, @@ -2304,9 +2263,8 @@ void ModifiedBratuProblem::setupBratuPreconditioner( diffusion->getPointer(1), b->getPointer(0), b->getPointer(1)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(compfacoffdiag3d, COMPFACOFFDIAG3D) (ifirst(0), ilast(0), + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(compfacoffdiag3d, COMPFACOFFDIAG3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_current_dt, @@ -2355,10 +2313,8 @@ int ModifiedBratuProblem::applyBratuPreconditioner( boost::shared_ptr > r, boost::shared_ptr > z) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(r); TBOX_ASSERT(z); -#endif int ret_val = 0; @@ -2377,9 +2333,9 @@ int ModifiedBratuProblem::applyBratuPreconditioner( for (int amr_level = hierarchy->getFinestLevelNumber() - 1; amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); boost::shared_ptr finer_level( hierarchy->getPatchLevel(amr_level + 1)); pc_rhs_average.resetSchedule(d_soln_coarsen_schedule[amr_level]); @@ -2415,9 +2371,9 @@ int ModifiedBratuProblem::applyBratuPreconditioner( for (int amr_level = hierarchy->getFinestLevelNumber() - 1; amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); boost::shared_ptr finer_level( hierarchy->getPatchLevel(amr_level + 1)); pc_sol_average.resetSchedule(d_scratch_soln_coarsen_schedule[amr_level]); @@ -2428,20 +2384,22 @@ int ModifiedBratuProblem::applyBratuPreconditioner( for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); for (hier::PatchLevel::iterator p(level->begin()); p != level->end(); ++p) { const boost::shared_ptr& patch = *p; boost::shared_ptr > src_data( - patch->getPatchData(d_soln_scratch_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_soln_scratch_id))); boost::shared_ptr > dst_data( - patch->getPatchData(z_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(z_indx))); + TBOX_ASSERT(src_data); + TBOX_ASSERT(dst_data); dst_data->copy(*src_data); } @@ -2464,7 +2422,7 @@ void ModifiedBratuProblem::evaluateBratuJacobian( boost::shared_ptr hierarchy( d_solution_vector->getPatchHierarchy()); - RefineAlgorithm eval_fill(d_dim); + RefineAlgorithm eval_fill; eval_fill.registerRefine(d_soln_scratch_id, x->getComponentDescriptorIndex(0), d_soln_scratch_id, @@ -2472,9 +2430,9 @@ void ModifiedBratuProblem::evaluateBratuJacobian( for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level(hierarchy->getPatchLevel( - amr_level)); + amr_level)); eval_fill.resetSchedule(d_soln_fill_schedule[amr_level]); d_soln_fill_schedule[amr_level]->fillData(d_new_time); @@ -2485,8 +2443,9 @@ void ModifiedBratuProblem::evaluateBratuJacobian( const boost::shared_ptr& patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const hier::Index ifirst = patch->getBox().lower(); const hier::Index ilast = patch->getBox().upper(); @@ -2503,30 +2462,36 @@ void ModifiedBratuProblem::evaluateBratuJacobian( } boost::shared_ptr > u( - patch->getPatchData(d_solution, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_solution, d_scratch))); boost::shared_ptr > exponential( - patch->getPatchData(d_exponential_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_exponential_term, d_scratch))); boost::shared_ptr > source( - patch->getPatchData(d_source_term, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_source_term, d_scratch))); boost::shared_ptr > diffusion( - patch->getPatchData(d_diffusion_coef, d_scratch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_diffusion_coef, d_scratch))); boost::shared_ptr > a( - patch->getPatchData(d_jacobian_a_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_jacobian_a_id))); boost::shared_ptr > b( - patch->getPatchData(d_jacobian_b_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_jacobian_b_id))); + TBOX_ASSERT(u); + TBOX_ASSERT(exponential); + TBOX_ASSERT(source); + TBOX_ASSERT(diffusion); + TBOX_ASSERT(a); + TBOX_ASSERT(b); if (d_dim == tbox::Dimension(1)) { /* * Compute exponential = lambda * exp(u) */ - F77_FUNC(compexpu1d, COMPEXPU1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compexpu1d, COMPEXPU1D) (ifirst(0), ilast(0), NUM_GHOSTS_U, d_lambda, u->getPointer(), @@ -2535,19 +2500,18 @@ void ModifiedBratuProblem::evaluateBratuJacobian( /* * Compute source = df/du */ - F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv1d, COMPSRCDERV1D) (ifirst(0), ilast(0), NUM_GHOSTS_U, xlo, dx, d_new_time, d_lambda, u->getPointer(), source->getPointer()); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { /* * Compute exponential = lambda * exp(u) */ - F77_FUNC(compexpu2d, COMPEXPU2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compexpu2d, COMPEXPU2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, d_lambda, @@ -2557,7 +2521,7 @@ void ModifiedBratuProblem::evaluateBratuJacobian( /* * Compute source = df/du */ - F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv2d, COMPSRCDERV2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, xlo, dx, @@ -2565,12 +2529,11 @@ void ModifiedBratuProblem::evaluateBratuJacobian( d_lambda, u->getPointer(), source->getPointer()); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { /* * Compute exponential = lambda * exp(u) */ - F77_FUNC(compexpu3d, COMPEXPU3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compexpu3d, COMPEXPU3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), NUM_GHOSTS_U, @@ -2581,7 +2544,7 @@ void ModifiedBratuProblem::evaluateBratuJacobian( /* * Compute source = df/du */ - F77_FUNC(compsrcderv3d, COMPSRCDERV3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(compsrcderv3d, COMPSRCDERV3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), NUM_GHOSTS_U, @@ -2625,8 +2588,9 @@ void ModifiedBratuProblem::setPhysicalBoundaryConditions( */ boost::shared_ptr > u( - patch.getPatchData(d_soln_scratch_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_soln_scratch_id))); + TBOX_ASSERT(u); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); @@ -2636,21 +2600,20 @@ void ModifiedBratuProblem::setPhysicalBoundaryConditions( */ const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array boundary = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + const std::vector& boundary = patch_geom->getCodimensionBoundaries(1); #if 0 if (d_dim == tbox::Dimension(1)) { - const tbox::Array boundary = + const std::vector& boundary = patch_geom->getNodeBoundaries(); - } - if (d_dim == tbox::Dimension(2)) { - const tbox::Array boundary = + } else if (d_dim == tbox::Dimension(2)) { + const std::vector& boundary = patch_geom->getEdgeBoundaries(); - } - if (d_dim == tbox::Dimension(3)) { - const tbox::Array boundary = + } else if (d_dim == tbox::Dimension(3)) { + const std::vector& boundary = patch_geom->getFaceBoundaries(); } #endif @@ -2661,7 +2624,7 @@ void ModifiedBratuProblem::setPhysicalBoundaryConditions( */ int face; - for (int i = 0; i < boundary.getSize(); i++) { + for (int i = 0; i < static_cast(boundary.size()); ++i) { hier::Box bbox = hier::Box(boundary[i].getBox()); face = boundary[i].getLocationIndex(); if (d_dim == tbox::Dimension(1)) { @@ -2670,16 +2633,14 @@ void ModifiedBratuProblem::setPhysicalBoundaryConditions( u->getPointer(), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(2)) { + } else if (d_dim == tbox::Dimension(2)) { FORT_SETBC2D(ifirst(0), ilast(0), ifirst(1), ilast(1), NUM_GHOSTS_U, u->getPointer(), &bbox.lower()[0], &bbox.upper()[0], face); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == tbox::Dimension(3)) { FORT_SETBC3D(ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -2700,22 +2661,20 @@ void ModifiedBratuProblem::setPhysicalBoundaryConditions( */ void ModifiedBratuProblem::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); - if (db->keyExists("lambda")) { - d_lambda = db->getDouble("lambda"); + if (input_db->keyExists("lambda")) { + d_lambda = input_db->getDouble("lambda"); } else { TBOX_ERROR(d_object_name << " -- Key data `lambda'" << " missing in input."); } - if (db->keyExists("timestep")) { - d_input_dt = db->getDouble("timestep"); + if (input_db->keyExists("timestep")) { + d_input_dt = input_db->getDouble("timestep"); if (d_input_dt < 0.0) { TBOX_ERROR(d_object_name << " Input error: timestep < 0.0"); } @@ -2726,8 +2685,8 @@ void ModifiedBratuProblem::getFromInput( } } - if (db->keyExists("max_precond_its")) { - d_max_precond_its = db->getInteger("max_precond_its"); + if (input_db->keyExists("max_precond_its")) { + d_max_precond_its = input_db->getInteger("max_precond_its"); if (d_max_precond_its < 0) { TBOX_ERROR(d_object_name << " Input error: max_precond_its < 0"); } @@ -2738,8 +2697,8 @@ void ModifiedBratuProblem::getFromInput( } } - if (db->keyExists("precond_tol")) { - d_precond_tol = db->getDouble("precond_tol"); + if (input_db->keyExists("precond_tol")) { + d_precond_tol = input_db->getDouble("precond_tol"); if (d_precond_tol <= 0.0) { TBOX_ERROR(d_object_name << " Input error: precond_tol <= 0.0"); } @@ -2755,24 +2714,22 @@ void ModifiedBratuProblem::getFromInput( /* ************************************************************************* * - * Put class version number and data members in database. + * Put class version number and data members in restart database. * ************************************************************************* */ -void ModifiedBratuProblem::putToDatabase( - const boost::shared_ptr& db) const +void ModifiedBratuProblem::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("MODIFIED_BRATU_PROBLEM", MODIFIED_BRATU_PROBLEM); + restart_db->putInteger("MODIFIED_BRATU_PROBLEM", MODIFIED_BRATU_PROBLEM); - db->putDouble("d_lambda", d_lambda); - db->putDouble("d_input_dt", d_input_dt); - db->putInteger("d_max_precond_its", d_max_precond_its); - db->putDouble("d_precond_tol", d_precond_tol); + restart_db->putDouble("d_lambda", d_lambda); + restart_db->putDouble("d_input_dt", d_input_dt); + restart_db->putInteger("d_max_precond_its", d_max_precond_its); + restart_db->putDouble("d_precond_tol", d_precond_tol); } @@ -2818,7 +2775,7 @@ void ModifiedBratuProblem::getLevelEdges( hier::BoxContainer& boxes, boost::shared_ptr patch, boost::shared_ptr level, - const int dim, + const tbox::Dimension::dir_t dim, const int face) { @@ -2831,11 +2788,11 @@ void ModifiedBratuProblem::getLevelEdges( hier::Box box = patch->getBox(); hier::Box boundary = box; if (face == 0) { - boundary.lower(dim) = box.lower(dim) - 1; - boundary.upper(dim) = box.lower(dim) - 1; + boundary.setLower(dim, box.lower(dim) - 1); + boundary.setUpper(dim, box.lower(dim) - 1); } else { - boundary.lower(dim) = box.upper(dim) + 1; - boundary.upper(dim) = box.upper(dim) + 1; + boundary.setLower(dim, box.upper(dim) + 1); + boundary.setUpper(dim, box.upper(dim) + 1); } /* @@ -2853,11 +2810,12 @@ void ModifiedBratuProblem::getLevelEdges( */ boost::shared_ptr geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - tbox::Array boundary_boxes = + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(geometry); + const std::vector& boundary_boxes = geometry->getCodimensionBoundaries(1); - for (int i = 0; i < boundary_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(boundary_boxes.size()); ++i) { boxes.removeIntersections(boundary_boxes[i].getBox()); } @@ -2875,35 +2833,37 @@ void ModifiedBratuProblem::correctLevelFlux( const boost::shared_ptr& patch = *p; const hier::Box box = patch->getBox(); boost::shared_ptr > flux_data( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); + TBOX_ASSERT(flux_data); /* - * For each dimension, for each side: compute the index space that + * For each direction, for each side: compute the index space that * describes the part of the patch that lies on the outer edge of * the refinement level. Then, scale the fluxes along that edge * to account for the different grid spacing when CONSTANT_REFINE * is used to fill the ghost cells. */ - for (int d = 0; d < d_dim.getValue(); d++) { - for (int s = 0; s <= 1; s++) { + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + for (int s = 0; s <= 1; ++s) { hier::Index delta(d_dim, 0); delta(d) = ((s == 0) ? 1 : -1); hier::Index twodelta(d_dim, 0); twodelta(d) = ((s == 0) ? 2 : -2); hier::BoxContainer level_edges; getLevelEdges(level_edges, patch, level, d, s); - for (hier::BoxContainer::iterator l(level_edges); + for (hier::BoxContainer::iterator l = level_edges.begin(); l != level_edges.end(); ++l) { - pdat::CellIterator icend(*l, false); - for (pdat::CellIterator ic(*l, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(*l)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*l)); + ic != icend; ++ic) { pdat::SideIndex iside(*ic + delta, d, s); (*flux_data)(iside) = 2.0 * (*flux_data)(iside) / 3.0; } // cell loop } // box loop } // side loop - } // dimension loop + } // direction loop } // patch loop } @@ -2914,15 +2874,17 @@ void ModifiedBratuProblem::correctPatchFlux( { const hier::Box box = patch->getBox(); boost::shared_ptr > flux_data( - patch->getPatchData(d_flux_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_flux_id))); const boost::shared_ptr geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(flux_data); + TBOX_ASSERT(geometry); const double* dx = geometry->getDx(); - for (int d = 0; d < d_dim.getValue(); d++) { - for (int s = 0; s <= 1; s++) { + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + for (int s = 0; s <= 1; ++s) { hier::Index delta1(d_dim, 0); delta1(d) = ((s == 0) ? 1 : -1); hier::Index delta2(d_dim, 0); @@ -2930,10 +2892,11 @@ void ModifiedBratuProblem::correctPatchFlux( double factor = ((s == 0) ? 1.0 / dx[d] : -1.0 / dx[d]); hier::BoxContainer level_edges; getLevelEdges(level_edges, patch, level, d, s); - for (hier::BoxContainer::iterator l(level_edges); + for (hier::BoxContainer::iterator l = level_edges.begin(); l != level_edges.end(); ++l) { - pdat::CellIterator icend(*l, false); - for (pdat::CellIterator ic(*l, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(*l)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*l)); + ic != icend; ++ic) { pdat::SideIndex iside(*ic + delta1, d, s); (*flux_data)(iside) = factor * (-8.0 * (*u)(*ic) / 15.0 + (*u)(*ic + delta1) / 3.0 @@ -2941,7 +2904,7 @@ void ModifiedBratuProblem::correctPatchFlux( } // cell loop } // box loop } // side loop - } // dimension loop + } // direction loop } #endif diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.h b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.h index f663f262..2cb483b8 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.h +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/ModifiedBratuProblem.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Class containing numerical routines for modified Bratu problem * ************************************************************************/ @@ -61,11 +61,11 @@ #include "SAMRAI/hier/Box.h" #include "SAMRAI/tbox/Serializable.h" #include "SAMRAI/tbox/MessageStream.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" -#include +#include "boost/shared_ptr.hpp" #include +#include using namespace SAMRAI; using namespace xfer; @@ -106,6 +106,7 @@ class ModifiedBratuProblem: ModifiedBratuProblem( const string& object_name, const tbox::Dimension& dim, + const boost::shared_ptr fac_solver, boost::shared_ptr input_db, boost::shared_ptr grid_geometry, boost::shared_ptr visit_data_writer = @@ -340,9 +341,9 @@ class ModifiedBratuProblem: NULL_USE(ratio); } - hier::IntVector getRefineOpStencilWidth() const + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector(d_dim, 0); + return hier::IntVector(dim, 0); } //@} @@ -380,21 +381,29 @@ class ModifiedBratuProblem: NULL_USE(ratio); } - hier::IntVector getCoarsenOpStencilWidth() const + hier::IntVector getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { - return hier::IntVector(d_dim, 0); + return hier::IntVector(dim, 0); + } + + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; } //@} /** - * Write data members to given data base for restart. + * Write data members to given database for restart. * - * Overloaded from tbox::Serializable. + * Inherited from tbox::Serializable. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * Write class data to given output stream. @@ -405,16 +414,14 @@ class ModifiedBratuProblem: private: /* - * Functions to read data from input and restart databases. If the boolean - * flag is true, all data members are read from restart. They can - * later be overwritten from values in the input file. When the flag - * is false, all data values are set from thos given in input. + * Functions to read data from input database. If the boolean + * flag is true, all data members must be present in input. * * An assertion results if the database pointer is null. */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); /* @@ -427,7 +434,7 @@ class ModifiedBratuProblem: hier::BoxContainer& boxes, boost::shared_ptr patch, boost::shared_ptr level, - const int dim, + const tbox::Dimension::dir_t dim, const int face); void @@ -583,13 +590,13 @@ class ModifiedBratuProblem: */ RefineAlgorithm d_fill_new_level; RefineAlgorithm d_soln_fill; - tbox::Array > d_soln_fill_schedule; + std::vector > d_soln_fill_schedule; CoarsenAlgorithm d_flux_coarsen; - tbox::Array > d_flux_coarsen_schedule; + std::vector > d_flux_coarsen_schedule; CoarsenAlgorithm d_soln_coarsen; - tbox::Array > d_soln_coarsen_schedule; + std::vector > d_soln_coarsen_schedule; CoarsenAlgorithm d_scratch_soln_coarsen; - tbox::Array > d_scratch_soln_coarsen_schedule; + std::vector > d_scratch_soln_coarsen_schedule; boost::shared_ptr d_soln_refine_op; boost::shared_ptr d_soln_coarsen_op; diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/README b/base/SAMRAI/SAMRAI/source/test/nonlinear/README index d68dd288..d44b815e 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/README +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Nonlinear solver example ## ######################################################################### @@ -13,240 +13,47 @@ SAMRAI application. This example is for 2D and 3D only. The files included in this directory are as follows: - ModifiedBratuProblem.h, ModifiedBratuProblem.C + ModifiedBratuProblem.h, ModifiedBratuProblem.C - Class to set up and solve the modified Bratu problem.. - ModifiedBratuFort.h - - Declarations of FORTRAN functions for - the modified Bratu problem. + ModifiedBratuFort.h + - Declarations of FORTRAN functions for + the modified Bratu problem. + fortran/* - FORTRAN files for numerical kernels main.C - example main program. + test_inputs/*input + - 2D input files for regression testing + performance_inputs/*input + - 3D input files for performance testing -COMPILE and RUN ---------------- - -Compile: make main2d -Run: main2d 2d.kinsol.input - main2d 2d.petsc.input - -Compile: make main3d -Run: main3d 3d.kinsol.input - main3d 3d.petsc.input +COMPILATION AND EXECUTION +------------------------- + + Compilation: + make main + + Execution: + For one of the following input files: + test_inputs/kinsol.2d.input + test_inputs/petsc.2d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main INPUTS ------ - Main { - // General specifications. - base_name = "default" // The base file name for output files. - nonlinear_solver_package = "KINSOL" // Name of the nonlinear - // solver package. Can be "KINSOL" or "PETSc-SNES" - } - - ModifiedBratuProblem { - // The ModifiedBratuProblem class is the "user class" in this example. - // It owns the solver and contains the code to set up the solver. - // The inputs for ModifiedBratuProblem is simply the inputs for the - // individual parts owned by the FACPoisson class. - timestep = 0.0625 // time increment used for all steps - lambda = 6.0 // factor multiplying exponential term - max_precond_its = 35 // maximum iterations for preconditioner - precond_tol = 1.0e-2 // preconditioner convergence tolerance - preconditioner_print_flag = FALSE // whether preconditioner reports residuals - } - - KINSOLSolver{ - // Specify the parameters for the Newton-Krylov solve using KINSOL - max_nonlinear_iterations = 20 // Max number of nonlinear iterations. - residual_stop_tolerance = 1.0e-10 // Stopping tolerance on the norm - // of scaled residual. - nonlinear_step_tolerance = 1.0e-10 // Stopping tolerance on maximum - // entry in scaled Newton step. - max_krylov_dimension = 20 // Max dim of Krylov space. - max_linear_solve_restarts = 4 // Max number of linear solver - // restarts allowed. - // Specify whether the user provides certain components - // needed by the solver. - uses_preconditioner = TRUE // Whether a preconditioner is - // supplied. - uses_jac_times_vector = TRUE // Whether an analytic Jacobian-vector - // product is supplied. - // Debugging printouts - KINSOL_log_filename = "kinsol.log" // Name of KINSOL log file. - KINSOL_print_flag = 3 // Flag for KINSOL log file print - // option. - } - - SNESSolver{ - // Specify the parameters for the nonlinear solve using SNES - absolute_tolerance = 1.0e-10 // Absolute nonlinear - // convergence tolerance. - relative_tolerance = 1.0e-4 // Relative nonlinear - // convergence tolerance. - step_tolerance = 1.0e-6 // Minimum tolerance on change - // in solution norm between - // nonlinear iterates. - linear_solver_type = "gmres" // Name of linear solver type - // (KSPType). - maximum_gmres_krylov_dimension = 20 // Max dimension of Krylov - // subspace before restarting. - // Valid only when using GMRES - // linear solver. - maximum_linear_iterations = 50 // Max number of linear solver - // iterations. - // Specify whether the user provides certain components - // needed by the solver. - uses_preconditioner = TRUE // Whether a preconditioner is - // supplied. - uses_explicit_jacobian = TRUE // Whether user provides - // Jacobian-vector product - // function. - forcing_term_strategy = "EWCHOICE1" // Choice of forcing term - // in linear solver within the - // inexact Newton method. - } - - ImplicitIntegrator{ - initial_time = 0.0 - final_time = 1.0 - max_integrator_steps = 5 - } - - "CartesianGeometry" input section - --------------------------------- - CartesianGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - x_lo = 0.e0 , 0.e0 - x_up = 65.e0 , 55.e0 - domain_boxes = [(0,9),(14,20)], - [(0,21),(19,35)], - [(0,36),(14,49)], - [(20,0),(49,54)], - [(50,0),(64,35)], - [(50,46),(64,54)], - [(57,36),(64,45)] - periodic_dimension = 0, 1 // periodic in y only - } - - - "GriddingAlgorithm" input section - --------------------------------- - GriddingAlgorithm { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - // smallest_patch_size { - // level_0 -- (int array) smallest patch allowed on level 0. - // [max ghost width for all variables] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 48 , 48 - } - smallest_patch_size { - level_0 = 8 , 8 - } - - // Tolerances for gridding efficiency and box chopping operations. - // efficiency_tolerance -- (double array) minimum percentage of tagged - // cells allowed in a box [0.8 for each level] - // combine_efficiency -- (double array) threshold specifying when a - // box may be chopped into two smaller boxes. - // If sum of the volumes of smaller boxes is > - // combine efficiency * volume of larger box, - // then larger box will not be chopped. - // [0.8 for each level] - // proper_nesting_buffer -- (int array) number of coarse cells by which - // the next finer level is nested within its - // interior. [1 for each level] - efficiency_tolerance = 0.85e0 - combine_efficiency = 0.95e0 - proper_nesting_buffer = 1 + The test_inputs directory contains: + kinsol.2d.input + petsc.2d.input - // Option to read or write gridding information - // write_regrid_boxes -- (bool) Output sequence of refine boxes to file - // read_regrid_boxes -- (bool) Read sequence of refine boxes from file - // regrid_boxes_filename -- (string) file name used for reading or writing - // boxes. - // - // Reading and writing options require some user intervention to assure - // they work properly. Please consult Andy Wissink (awissink@llnl.gov) - // if you are interested in using these options. - write_regrid_boxes = TRUE - regrid_boxes_filename = TRUE - } + The performance_inputs directory contains: + kinsol.3d.input + petsc.3d.input - "StandardTagAndInitialize" input section - --------------------------------------------- - StandardTagAndInitialize { - // Specification of the type of tagging to be performed - // tagging_method -- (string array) one or more entries specifying - // the tagging algorithm used. Options include: - // "GRADIENT_DETECTOR" - // "RICHARDSON_EXTRAPOLATION" - // "REFINE_BOXES" - // - // REFINE_BOXES allows you to prescribe where refinement should occur. - // If this option is used, you must also supply a RefineBoxes database - // entry with the refine boxes on different levels specified. i.e. - // RefineBoxes{ - // level_0 -- (BoxArray) Boxes to be refined on level 0 - // level_1 -- (BoxArray) Boxes to be refined on level 1 - // etc. - // - // Gradient detection option. - tagging_method = "GRADIENT_DETECTOR" - // - // Richarson extrapolation option. - tagging_method = "RICHARDSON_EXTRAPOLATION" - // - // Static refine boxes option. - tagging_method = "REFINE_BOXES" - RefineBoxes { - level0_boxes = [(15,0),(29,14)] - level1_boxes = [(65,10),(114,40)] - } - // Combination. - tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" - } +Refer to kinsol.2d.input for description of the input parameters specific +to this test directory. diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian1d.m4 index df31c6f3..ebe678b6 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian1d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine compfacdiag1d( & ifirst0,ilast0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian2d.m4 index e350d0a6..49afdcf7 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian2d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine compfacdiag2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian3d.m4 index 97961e9e..3ff01ce8 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/FACjacobian3d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine compfacdiag3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.depend new file mode 100644 index 00000000..cd76ce85 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.depend @@ -0,0 +1,481 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=FACjacobian1d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + FACjacobian1d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=FACjacobian2d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + FACjacobian2d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=FACjacobian3d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + FACjacobian3d.m4 + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=adjcrsfineoffdiag1d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + adjcrsfineoffdiag1d.m4 + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=bcFluxCopy1d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + bcFluxCopy1d.m4 + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=bcFluxCopy2d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + bcFluxCopy2d.m4 + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=bcFluxCopy3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + bcFluxCopy3d.m4 + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=bcFluxFix1d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + bcFluxFix1d.m4 + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=bcFluxFix2d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + bcFluxFix2d.m4 + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=bcFluxFix3d.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + bcFluxFix3d.m4 + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=bratufunc1d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + bratufunc1d.m4 + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=bratufunc2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + bratufunc2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=bratufunc3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + bratufunc3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=err1d.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i err1d.m4 + +DEPENDS_13 +=\ + + + +${FILE_13}: ${DEPENDS_13} + +FILE_14=err2d.o +DEPENDS_14:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i err2d.m4 + +DEPENDS_14 +=\ + + + +${FILE_14}: ${DEPENDS_14} + +FILE_15=err3d.o +DEPENDS_15:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i err3d.m4 + +DEPENDS_15 +=\ + + + +${FILE_15}: ${DEPENDS_15} + +FILE_16=evalBratu1d.o +DEPENDS_16:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + evalBratu1d.m4 + +DEPENDS_16 +=\ + + + +${FILE_16}: ${DEPENDS_16} + +FILE_17=evalBratu2d.o +DEPENDS_17:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + evalBratu2d.m4 + +DEPENDS_17 +=\ + + + +${FILE_17}: ${DEPENDS_17} + +FILE_18=evalBratu3d.o +DEPENDS_18:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + evalBratu3d.m4 + +DEPENDS_18 +=\ + + + +${FILE_18}: ${DEPENDS_18} + +FILE_19=evalDiffusionCoef1d.o +DEPENDS_19:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + evalDiffusionCoef1d.m4 + +DEPENDS_19 +=\ + + + +${FILE_19}: ${DEPENDS_19} + +FILE_20=evalDiffusionCoef2d.o +DEPENDS_20:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + evalDiffusionCoef2d.m4 + +DEPENDS_20 +=\ + + + +${FILE_20}: ${DEPENDS_20} + +FILE_21=evalDiffusionCoef3d.o +DEPENDS_21:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + evalDiffusionCoef3d.m4 + +DEPENDS_21 +=\ + + + +${FILE_21}: ${DEPENDS_21} + +FILE_22=evalExponential1d.o +DEPENDS_22:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + evalExponential1d.m4 + +DEPENDS_22 +=\ + + + +${FILE_22}: ${DEPENDS_22} + +FILE_23=evalExponential2d.o +DEPENDS_23:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + evalExponential2d.m4 + +DEPENDS_23 +=\ + + + +${FILE_23}: ${DEPENDS_23} + +FILE_24=evalExponential3d.o +DEPENDS_24:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + evalExponential3d.m4 + +DEPENDS_24 +=\ + + + +${FILE_24}: ${DEPENDS_24} + +FILE_25=evalF1d.o +DEPENDS_25:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i evalF1d.m4 + +DEPENDS_25 +=\ + + + +${FILE_25}: ${DEPENDS_25} + +FILE_26=evalF2d.o +DEPENDS_26:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i evalF2d.m4 + +DEPENDS_26 +=\ + + + +${FILE_26}: ${DEPENDS_26} + +FILE_27=evalF3d.o +DEPENDS_27:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i evalF3d.m4 + +DEPENDS_27 +=\ + + + +${FILE_27}: ${DEPENDS_27} + +FILE_28=evalFaceFluxes1d.o +DEPENDS_28:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + evalFaceFluxes1d.m4 + +DEPENDS_28 +=\ + + + +${FILE_28}: ${DEPENDS_28} + +FILE_29=evalFaceFluxes2d.o +DEPENDS_29:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + evalFaceFluxes2d.m4 + +DEPENDS_29 +=\ + + + +${FILE_29}: ${DEPENDS_29} + +FILE_30=evalFaceFluxes3d.o +DEPENDS_30:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + evalFaceFluxes3d.m4 + +DEPENDS_30 +=\ + + + +${FILE_30}: ${DEPENDS_30} + +FILE_31=evalJv1d.o +DEPENDS_31:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i evalJv1d.m4 + +DEPENDS_31 +=\ + + + +${FILE_31}: ${DEPENDS_31} + +FILE_32=evalJv2d.o +DEPENDS_32:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i evalJv2d.m4 + +DEPENDS_32 +=\ + + + +${FILE_32}: ${DEPENDS_32} + +FILE_33=evalJv3d.o +DEPENDS_33:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i evalJv3d.m4 + +DEPENDS_33 +=\ + + + +${FILE_33}: ${DEPENDS_33} + +FILE_34=evalSource1d.o +DEPENDS_34:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i \ + evalSource1d.m4 + +DEPENDS_34 +=\ + + + +${FILE_34}: ${DEPENDS_34} + +FILE_35=evalSource2d.o +DEPENDS_35:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + evalSource2d.m4 + +DEPENDS_35 +=\ + + + +${FILE_35}: ${DEPENDS_35} + +FILE_36=evalSource3d.o +DEPENDS_36:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + evalSource3d.m4 + +DEPENDS_36 +=\ + + + +${FILE_36}: ${DEPENDS_36} + +FILE_37=setbc1d.o +DEPENDS_37:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim1d.i setbc1d.m4 + +DEPENDS_37 +=\ + + + +${FILE_37}: ${DEPENDS_37} + +FILE_38=setbc2d.o +DEPENDS_38:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i setbc2d.m4 + +DEPENDS_38 +=\ + + + +${FILE_38}: ${DEPENDS_38} + +FILE_39=setbc3d.o +DEPENDS_39:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i setbc3d.m4 + +DEPENDS_39 +=\ + + + +${FILE_39}: ${DEPENDS_39} + diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.in new file mode 100644 index 00000000..c598127a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/Makefile.in @@ -0,0 +1,202 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI nonlinear solver +## test +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/nonlinear/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= FACjacobian1d.o bcFluxCopy1d.o bcFluxFix1d.o bratufunc1d.o err1d.o \ + evalBratu1d.o evalDiffusionCoef1d.o evalExponential1d.o evalF1d.o \ + evalFaceFluxes1d.o evalJv1d.o evalSource1d.o setbc1d.o \ + adjcrsfineoffdiag1d.o \ + FACjacobian2d.o bcFluxCopy2d.o bcFluxFix2d.o bratufunc2d.o err2d.o \ + evalBratu2d.o evalDiffusionCoef2d.o evalExponential2d.o evalF2d.o \ + evalFaceFluxes2d.o evalJv2d.o evalSource2d.o setbc2d.o \ + FACjacobian3d.o bcFluxCopy3d.o bcFluxFix3d.o bratufunc3d.o err3d.o \ + evalBratu3d.o evalDiffusionCoef3d.o evalExponential3d.o evalF3d.o \ + evalFaceFluxes3d.o evalJv3d.o evalSource3d.o setbc3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +FACjacobian1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/FACjacobian1d.m4 > FACjacobian1d.f + $(F77) $(FFLAGS) -c FACjacobian1d.f -o $@ + +adjcrsfineoffdiag1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/adjcrsfineoffdiag1d.m4 > adjcrsfineoffdiag1d.f + $(F77) $(FFLAGS) -c adjcrsfineoffdiag1d.f -o $@ + +bcFluxCopy1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxCopy1d.m4 > bcFluxCopy1d.f + $(F77) $(FFLAGS) -c bcFluxCopy1d.f -o $@ + +bcFluxFix1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxFix1d.m4 > bcFluxFix1d.f + $(F77) $(FFLAGS) -c bcFluxFix1d.f -o $@ + +bratufunc1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bratufunc1d.m4 > bratufunc1d.f + $(F77) $(FFLAGS) -c bratufunc1d.f -o $@ + +err1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/err1d.m4 > err1d.f + $(F77) $(FFLAGS) -c err1d.f -o $@ + +evalBratu1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalBratu1d.m4 > evalBratu1d.f + $(F77) $(FFLAGS) -c evalBratu1d.f -o $@ + +evalDiffusionCoef1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalDiffusionCoef1d.m4 > evalDiffusionCoef1d.f + $(F77) $(FFLAGS) -c evalDiffusionCoef1d.f -o $@ + +evalExponential1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalExponential1d.m4 > evalExponential1d.f + $(F77) $(FFLAGS) -c evalExponential1d.f -o $@ + +evalF1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalF1d.m4 > evalF1d.f + $(F77) $(FFLAGS) -c evalF1d.f -o $@ + +evalFaceFluxes1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalFaceFluxes1d.m4 > evalFaceFluxes1d.f + $(F77) $(FFLAGS) -c evalFaceFluxes1d.f -o $@ + +evalJv1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalJv1d.m4 > evalJv1d.f + $(F77) $(FFLAGS) -c evalJv1d.f -o $@ + +evalSource1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalSource1d.m4 > evalSource1d.f + $(F77) $(FFLAGS) -c evalSource1d.f -o $@ + +setbc1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/setbc1d.m4 > setbc1d.f + $(F77) $(FFLAGS) -c setbc1d.f -o $@ + + +FACjacobian2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/FACjacobian2d.m4 > FACjacobian2d.f + $(F77) $(FFLAGS) -c FACjacobian2d.f -o $@ + +bcFluxCopy2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxCopy2d.m4 > bcFluxCopy2d.f + $(F77) $(FFLAGS) -c bcFluxCopy2d.f -o $@ + +bcFluxFix2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxFix2d.m4 > bcFluxFix2d.f + $(F77) $(FFLAGS) -c bcFluxFix2d.f -o $@ + +bratufunc2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bratufunc2d.m4 > bratufunc2d.f + $(F77) $(FFLAGS) -c bratufunc2d.f -o $@ + +err2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/err2d.m4 > err2d.f + $(F77) $(FFLAGS) -c err2d.f -o $@ + +evalBratu2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalBratu2d.m4 > evalBratu2d.f + $(F77) $(FFLAGS) -c evalBratu2d.f -o $@ + +evalDiffusionCoef2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalDiffusionCoef2d.m4 > evalDiffusionCoef2d.f + $(F77) $(FFLAGS) -c evalDiffusionCoef2d.f -o $@ + +evalExponential2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalExponential2d.m4 > evalExponential2d.f + $(F77) $(FFLAGS) -c evalExponential2d.f -o $@ + +evalF2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalF2d.m4 > evalF2d.f + $(F77) $(FFLAGS) -c evalF2d.f -o $@ + +evalFaceFluxes2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalFaceFluxes2d.m4 > evalFaceFluxes2d.f + $(F77) $(FFLAGS) -c evalFaceFluxes2d.f -o $@ + +evalJv2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalJv2d.m4 > evalJv2d.f + $(F77) $(FFLAGS) -c evalJv2d.f -o $@ + +evalSource2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalSource2d.m4 > evalSource2d.f + $(F77) $(FFLAGS) -c evalSource2d.f -o $@ + +setbc2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/setbc2d.m4 > setbc2d.f + $(F77) $(FFLAGS) -c setbc2d.f -o $@ + + +FACjacobian3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/FACjacobian3d.m4 > FACjacobian3d.f + $(F77) $(FFLAGS) -c FACjacobian3d.f -o $@ + +bcFluxCopy3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxCopy3d.m4 > bcFluxCopy3d.f + $(F77) $(FFLAGS) -c bcFluxCopy3d.f -o $@ + +bcFluxFix3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bcFluxFix3d.m4 > bcFluxFix3d.f + $(F77) $(FFLAGS) -c bcFluxFix3d.f -o $@ + +bratufunc3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/bratufunc3d.m4 > bratufunc3d.f + $(F77) $(FFLAGS) -c bratufunc3d.f -o $@ + +err3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/err3d.m4 > err3d.f + $(F77) $(FFLAGS) -c err3d.f -o $@ + +evalBratu3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalBratu3d.m4 > evalBratu3d.f + $(F77) $(FFLAGS) -c evalBratu3d.f -o $@ + +evalDiffusionCoef3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalDiffusionCoef3d.m4 > evalDiffusionCoef3d.f + $(F77) $(FFLAGS) -c evalDiffusionCoef3d.f -o $@ + +evalExponential3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalExponential3d.m4 > evalExponential3d.f + $(F77) $(FFLAGS) -c evalExponential3d.f -o $@ + +evalF3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalF3d.m4 > evalF3d.f + $(F77) $(FFLAGS) -c evalF3d.f -o $@ + +evalFaceFluxes3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalFaceFluxes3d.m4 > evalFaceFluxes3d.f + $(F77) $(FFLAGS) -c evalFaceFluxes3d.f -o $@ + +evalJv3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalJv3d.m4 > evalJv3d.f + $(F77) $(FFLAGS) -c evalJv3d.f -o $@ + +evalSource3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/evalSource3d.m4 > evalSource3d.f + $(F77) $(FFLAGS) -c evalSource3d.f -o $@ + +setbc3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/setbc3d.m4 > setbc3d.f + $(F77) $(FFLAGS) -c setbc3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/adjcrsfineoffdiag1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/adjcrsfineoffdiag1d.m4 index 3d0be338..aca12048 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/adjcrsfineoffdiag1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/adjcrsfineoffdiag1d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine adjcrsfineoffdiag1d( & flo0, fhi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy1d.m4 index 72e085a0..5f8a17a9 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy1d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to copy face fluxes in the x-direction. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine ewfluxcopy1d( & lo0, hi0, @@ -7,8 +14,6 @@ include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl & sideflux, & side ) -c Copy face fluxes in the x-direction. - implicit none integer lo0 diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy2d.m4 index 16cdbb0a..c391dbfe 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy2d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to copy face fluxes in the x and y directions. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine ewfluxcopy2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy3d.m4 index 0fc061a0..a720414d 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxCopy3d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to copy face fluxes in the x, y, and z directions. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine ewfluxcopy3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix1d.m4 index 450121d0..7080b94c 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix1d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to fixup boundary fluxes in the x-direction. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine ewbcfluxfix1d( & lo0, hi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix2d.m4 index 0296b478..56d508d5 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to fixup boundary fluxes in the x and y +c directions. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine ewbcfluxfix2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix3d.m4 index 04b738c9..fea71c24 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bcFluxFix3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to fixup boundary fluxes in the x, y, and z +c directions. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine ewbcfluxfix3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc1d.m4 index adae2f47..1647a6f7 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc1d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to solve +c du/dt = div( D(x,t)*div(u) ) + lambda * exp(u) + source(x,t,u) +c in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl c c The following macro definitions are used in the routines below to diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc2d.m4 index dfdba824..04e73a2f 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc2d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to solve +c du/dt = div( D(x,t)*div(u) ) + lambda * exp(u) + source(x,t,u) +c in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c c The following macro definitions are used in the routines below to diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc3d.m4 index dab2c34d..434dfbe5 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/bratufunc3d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to solve +c du/dt = div( D(x,t)*div(u) ) + lambda * exp(u) + source(x,t,u) +c in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c c The following macro definitions are used in the routines below to diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err1d.m4 index d3d4d26f..af3fce72 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err1d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute error in solution at time t in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine error1d( & lo0, hi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err2d.m4 index 9a4f863e..fc15361f 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err2d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute error in solution at time t in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine error2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err3d.m4 index 09f6f4b3..ecc16c68 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/err3d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute error in solution at time t in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine error3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu1d.m4 index a416e1cf..664e3284 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu1d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate modified bratu problem at u by +c assembling fluxes (in gew), sources (in f and lexpu), and +c previous time step (in v) in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalbratu1d( & lo0, hi0, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu2d.m4 index df52e4ff..4d9197b9 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu2d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate modified bratu problem at u by +c assembling fluxes (in gew), sources (in f and lexpu), and +c previous time step (in v) in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalbratu2d( & lo0, hi0, lo1, hi1, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu3d.m4 index 508fc5d9..4c9d18fd 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalBratu3d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate modified bratu problem at u by +c assembling fluxes (in gew), sources (in f and lexpu), and +c previous time step (in v) in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalbratu3d( & lo0, hi0, lo1, hi1, lo2, hi2, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef1d.m4 index f21d2e33..159892f0 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered diffusion coefficients +c in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalDiffusionCoef1d( & lo0, hi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef2d.m4 index e3783016..a4ac7098 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered diffusion coefficients +c in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalDiffusionCoef2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef3d.m4 index 4098f4a4..1a067cd1 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalDiffusionCoef3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered diffusion coefficients +c in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalDiffusionCoef3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential1d.m4 index 47178862..37d32bfd 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate exponential term in modified Bratu +c problem in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalExponential1d( & lo0, hi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential2d.m4 index 93f3b0ab..4f4a47e3 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate exponential term in modified Bratu +c problem in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalExponential2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential3d.m4 index da611e2b..a5fd6197 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalExponential3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered diffusion coefficients +c in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalExponential3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF1d.m4 index 21c2cd09..47db20cf 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF1d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate rhs of modified bratu problem at u by +c subtracting off the terms that are due to BE time +c discretization in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalF1d( & lo0, hi0, @@ -7,9 +16,6 @@ include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl & unew, ucur, & f ) -c Evaluate rhs of modified bratu problem at u by subtracting off the -c terms that are due to BE time discretization. - implicit none integer lo0 diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF2d.m4 index 44d04750..f1f8d5b1 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF2d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate rhs of modified bratu problem at u by +c subtracting off the terms that are due to BE time +c discretization in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalF2d( & lo0, hi0, lo1, hi1, @@ -7,9 +16,6 @@ include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl & unew, ucur, & f ) -c Evaluate rhs of modified bratu problem at u by subtracting off the -c terms that are due to BE time discretization. - implicit none integer lo0 diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF3d.m4 index 6a16481f..479b3df6 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalF3d.m4 @@ -1,5 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate rhs of modified bratu problem at u by +c subtracting off the terms that are due to BE time +c discretization in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalF3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes1d.m4 index 46402add..b53e5559 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered fluxes in div-grad +c operator in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalFaceFluxes1d( & lo0, hi0, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes2d.m4 index af4a818e..e524de0d 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered fluxes in div-grad +c operator in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalFaceFluxes2d( & lo0, hi0, lo1, hi1, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes3d.m4 index e56ece02..59bfa918 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalFaceFluxes3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate face-centered fluxes in div-grad +c operator in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalFaceFluxes3d( & lo0, hi0, lo1, hi1, lo2, hi2, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv1d.m4 index dfd6b58a..b124fc3a 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for analytic evaluation of Jacobian-vector +c products for the modified Bratu problem in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine bratujv1d( & lo0, hi0, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv2d.m4 index 900614b9..38bd00b1 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for analytic evaluation of Jacobian-vector +c products for the modified Bratu problem in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine bratujv2d( & lo0, hi0, lo1, hi1, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv3d.m4 index 1bef2a06..83ab7d6d 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalJv3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for analytic evaluation of Jacobian-vector +c products for the modified Bratu problem in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine bratujv3d( & lo0, hi0, lo1, hi1, lo2, hi2, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource1d.m4 index 82ae0749..6382b742 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate source term in modified Bratu problem +c in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine evalSource1d( & lo0, hi0, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource2d.m4 index a911ba70..af4705b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate source term in modified Bratu problem +c in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine evalSource2d( & lo0, hi0, lo1, hi1, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource3d.m4 index 142f0efc..a608f7f9 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/evalSource3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate source term in modified Bratu problem +c in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine evalSource3d( & lo0, hi0, lo1, hi1, lo2, hi2, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc1d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc1d.m4 index f233d416..894b6b2c 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc1d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to set boundary conditions in modified Bratu +c problem in 1d. +c define(NDIM,1)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim1d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim1d.i)dnl subroutine setbc1d( & lo0, hi0, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc2d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc2d.m4 index c92f6bd6..0d1eed56 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc2d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to set boundary conditions in modified Bratu +c problem in 2d. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine setbc2d( & lo0, hi0, lo1, hi1, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc3d.m4 b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc3d.m4 index 3fb93c77..0db0f0ad 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/fortran/setbc3d.m4 @@ -1,5 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to set boundary conditions in modified Bratu +c problem in 3d. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine setbc3d( & lo0, hi0, lo1, hi1, lo2, hi2, ghostcells, diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/main.C b/base/SAMRAI/SAMRAI/source/test/nonlinear/main.C index d0595de3..0c4d86ea 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/main.C +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for modified-Bratu problem * ************************************************************************/ @@ -19,12 +19,12 @@ using namespace std; * Headers for basic SAMRAI objects used in this sample code. */ #include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/hier/BaseGridGeometry.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/Timer.h" @@ -52,10 +52,15 @@ using namespace std; #ifdef HAVE_SUNDIALS #include "SAMRAI/solv/KINSOL_SAMRAIContext.h" #endif +#ifdef HAVE_HYPRE +#include "SAMRAI/solv/CellPoissonHypreSolver.h" +#endif #include "ModifiedBratuProblem.h" #include "SAMRAI/solv/NonlinearSolverStrategy.h" -#include +#include "boost/shared_ptr.hpp" + +#include using namespace SAMRAI; @@ -168,8 +173,8 @@ int main( */ string input_filename; - if (argc != 2) { - TBOX_ERROR("USAGE: " << argv[0] << " \n" + if (argc != 3) { + TBOX_ERROR("USAGE: " << argv[0] << " -skip_petscrc \n" << " options:\n" << " none at this time" << endl); } else { @@ -205,38 +210,25 @@ int main( viz_dump_interval = main_db->getInteger("viz_dump_interval"); } - tbox::Array viz_writer(1); - viz_writer[0] = "Visit"; - string viz_dump_filename; string visit_dump_dirname; bool uses_visit = false; int visit_number_procs_per_file = 1; if (viz_dump_interval > 0) { - if (main_db->keyExists("viz_writer")) { - viz_writer = main_db->getStringArray("viz_writer"); - } - if (main_db->keyExists("viz_dump_filename")) { - viz_dump_filename = main_db->getString("viz_dump_filename"); - } + uses_visit = true; string viz_dump_dirname; if (main_db->keyExists("viz_dump_dirname")) { viz_dump_dirname = main_db->getString("viz_dump_dirname"); } - for (int i = 0; i < viz_writer.getSize(); i++) { - if (viz_writer[i] == "VisIt") uses_visit = true; - } visit_dump_dirname = viz_dump_dirname; - if (uses_visit) { - if (viz_dump_dirname.empty()) { - TBOX_ERROR("main(): " - << "\nviz_dump_dirname is null ... " - << "\nThis must be specified for use with VisIt" - << endl); - } - if (main_db->keyExists("visit_number_procs_per_file")) { - visit_number_procs_per_file = - main_db->getInteger("visit_number_procs_per_file"); - } + if (viz_dump_dirname.empty()) { + TBOX_ERROR("main(): " + << "\nviz_dump_dirname is null ... " + << "\nThis must be specified for use with VisIt" + << endl); + } + if (main_db->keyExists("visit_number_procs_per_file")) { + visit_number_procs_per_file = + main_db->getInteger("visit_number_procs_per_file"); } } @@ -257,6 +249,9 @@ int main( * section of the input file. */ tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); + boost::shared_ptr t_all = + tbox::TimerManager::getManager()->getTimer("appu::main::all"); + t_all->start(); /* * Create major algorithm and data objects which comprise application. @@ -288,21 +283,74 @@ int main( grid_geometry, input_db->getDatabase("PatchHierarchy"))); + std::string mod_bratu_prob_name = "ModifiedBratuProblem"; + std::string fac_solver_name = mod_bratu_prob_name + ":FAC_solver"; + std::string fac_ops_name = fac_solver_name + "::fac_ops"; + std::string fac_precond_name = fac_solver_name + "::fac_precond"; + std::string hypre_poisson_name = fac_ops_name + "::hypre_solver"; + +#ifdef HAVE_HYPRE + boost::shared_ptr hypre_poisson( + new solv::CellPoissonHypreSolver( + dim, + hypre_poisson_name, + input_db->isDatabase("hypre_solver") ? + input_db->getDatabase("hypre_solver") : + boost::shared_ptr())); + + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + hypre_poisson, + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#else + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#endif + + boost::shared_ptr fac_precond( + new solv::FACPreconditioner( + fac_precond_name, + fac_ops, + input_db->isDatabase("fac_precond") ? + input_db->getDatabase("fac_precond") : + boost::shared_ptr())); + + boost::shared_ptr fac_solver( + new solv::CellPoissonFACSolver( + dim, + fac_solver_name, + fac_precond, + fac_ops, + input_db->isDatabase("fac_solver") ? + input_db->getDatabase("fac_solver") : + boost::shared_ptr())); + ModifiedBratuProblem* bratu_model = new ModifiedBratuProblem( - "ModifiedBratuProblem", + mod_bratu_prob_name, dim, + fac_solver, input_db->getDatabase("ModifiedBratuProblem"), - grid_geometry, visit_data_writer); + grid_geometry, + visit_data_writer); - solv::NonlinearSolverStrategy* nonlinear_solver = NULL; + solv::NonlinearSolverStrategy* nonlinear_solver = 0; if (nonlinear_solver_package == "PETSc-SNES") { #ifdef HAVE_PETSC nonlinear_solver = new solv::SNES_SAMRAIContext("SNESSolver", - input_db->getDatabase("SNESSolver"), - bratu_model); + bratu_model, + input_db->getDatabase("SNESSolver")); #else TBOX_ERROR("Cannot use PETSc-SNES option because SAMRAI was\n" << "not configured to use it."); @@ -313,8 +361,8 @@ int main( #ifdef HAVE_SUNDIALS nonlinear_solver = new solv::KINSOL_SAMRAIContext("KINSOLSolver", - input_db->getDatabase("KINSOLSolver"), - bratu_model); + bratu_model, + input_db->getDatabase("KINSOLSolver")); #else TBOX_ERROR("Cannot use KINSOL option because SAMRAI was\n" << "not configured to use it."); @@ -336,14 +384,13 @@ int main( boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "CellTaggingMethod", bratu_model, - input_db-> - getDatabase("StandardTagAndInitialize"))); + input_db->getDatabase("StandardTagAndInitialize"))); boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); + new mesh::BergerRigoutsos(dim, + input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer( @@ -365,21 +412,22 @@ int main( * Tag buffers are passed to the gridding algorithm for buffering * tagged cells before new levels are created. */ - tbox::Array tag_buffer(patch_hierarchy->getMaxNumberOfLevels()); - for (int ln = 0; ln < patch_hierarchy->getMaxNumberOfLevels(); ln++) { + std::vector tag_buffer(patch_hierarchy->getMaxNumberOfLevels()); + for (int ln = 0; ln < patch_hierarchy->getMaxNumberOfLevels(); ++ln) { tag_buffer[ln] = 0; } if (main_db->keyExists("tag_buffer")) { - tbox::Array input_tags = main_db->getIntegerArray("tag_buffer"); - if (input_tags.getSize() > 0) { + std::vector input_tags = main_db->getIntegerVector("tag_buffer"); + if (input_tags.size() > 0) { for (int ln0 = 0; ln0 < patch_hierarchy->getMaxNumberOfLevels(); - ln0++) { - if (input_tags.getSize() > ln0) { + ++ln0) { + if (static_cast(input_tags.size()) > ln0) { tag_buffer[ln0] = ((input_tags[ln0] > 0) ? input_tags[ln0] : 0); } else { - tag_buffer[ln0] = ((input_tags[input_tags.getSize() - 1] > 0) - ? input_tags[input_tags.getSize() - 1] : 0); + int input_tags_size = static_cast(input_tags.size()); + tag_buffer[ln0] = ((input_tags[input_tags_size - 1] > 0) + ? input_tags[input_tags_size - 1] : 0); } } } @@ -417,7 +465,7 @@ int main( if (tbox::RestartManager::getManager()->isFromRestart()) { - patch_hierarchy->getFromRestart(); + patch_hierarchy->initializeHierarchy(); gridding_algorithm->getTagAndInitializeStrategy()-> resetHierarchyConfiguration(patch_hierarchy, @@ -429,13 +477,14 @@ int main( gridding_algorithm->makeCoarsestLevel(sim_time); bool done = false; - bool initial_time = true; + bool initial_cycle = true; for (int lnum = 0; - patch_hierarchy->levelCanBeRefined(lnum) && !done; lnum++) { + patch_hierarchy->levelCanBeRefined(lnum) && !done; ++lnum) { gridding_algorithm->makeFinerLevel( - sim_time, - initial_time, - tag_buffer[lnum]); + tag_buffer[lnum], + initial_cycle, + imp_integrator->getIntegratorStep(), + sim_time); done = !(patch_hierarchy->finerLevelExists(lnum)); } @@ -521,8 +570,9 @@ int main( if ((regrid_interval > 0) && ((iteration_num % regrid_interval) == 0)) { gridding_algorithm->regridAllFinerLevels(0, - sim_time, - tag_buffer); + tag_buffer, + iteration_num, + sim_time); #if defined(HAVE_PETSC) || defined(HAVE_SUNDIALS) bratu_model->setVectorWeights(patch_hierarchy); #endif @@ -571,6 +621,16 @@ int main( visit_data_writer.reset(); } + t_all->stop(); + int size = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + if (tbox::SAMRAI_MPI::getSAMRAIWorld().getRank() == 0) { + string timing_file = + base_name + ".timing" + tbox::Utilities::intToString(size); + FILE* fp = fopen(timing_file.c_str(), "w"); + fprintf(fp, "%f\n", t_all->getTotalWallclockTime()); + fclose(fp); + } + #endif #ifdef TESTING @@ -581,7 +641,6 @@ int main( */ tbox::pout << "\nPASSED: nonlinear" << endl; #endif - } tbox::SAMRAIManager::shutdown(); diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/kinsol.3d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/kinsol.3d.input new file mode 100644 index 00000000..232612ee --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/kinsol.3d.input @@ -0,0 +1,161 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 3D nonlinear solver example using KINSOL. + * + ************************************************************************/ + +// Refer to test_inputs/kinsol.2d.input for description of the input parameters +// specific to this test directory. + + +// This is the input file for the 3D nonlinear solver example using KINSOL. + +Main{ + dim = 3 + + base_name = "kinsol.3d" + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + viz_dump_dirname = "kinsol.3d.visit" + visit_number_procs_per_file = 1 + +// regrid parameters + regrid_interval = 1 // zero to turn off + +// Options for nonlinear solver package are: +// "KINSOL" (default), or "PETSc-SNES" + nonlinear_solver_package = "KINSOL" + // nonlinear_solver_package = "PETSc-SNES" + +} + +TimerManager{ + maintain_exclusive_time = TRUE + maintain_concurrent_time = TRUE + timer_list = "apps::main::*", "apps::usrFcns::*" +} + +CartesianGeometry{ + domain_boxes = [(0,0,0), (31,31,31)] + x_lo = 0.0e0, 0.0e0, 0.0e0 + x_up = 1.0e0, 1.0e0, 1.0e0 +} + +PatchHierarchy { + max_levels = 2 + largest_patch_size { + level_0 = 32, 32, 32 + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 4,4,4 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + level_4 = 2, 2, 2 + level_5 = 2, 2, 2 + level_6 = 2, 2, 2 + level_7 = 2, 2, 2 + level_8 = 2, 2, 2 + level_9 = 2, 2, 2 + level_10 = 2, 2, 2 + // etc. + } +} + +BergerRigoutsos { + combine_efficiency = 0.75 + efficiency_tolerance = 0.75 +} + +GriddingAlgorithm{ +} + +StandardTagAndInitialize{ + tagging_method = "REFINE_BOXES" + + level_0 { + boxes = [(8,8,8), (23,23,23)] + } + level_1 { + boxes = [(24,24,24), (39,39,39)] + } + level_2 { + boxes = [(56,56,56), (71,71,71)] + } +// level_3 { +// boxes = [(120,120,120), (135,135,135)] +// } +// level_4 { +// boxes = [(248,248,248), (263,263,263)] +// } +// level_5 { +// boxes = [(504,504,504), (519,519,519)] +// } +// level_6 { +// boxes = [(1016,1016,1016), (1031,1031,1031)] +// } +// level_7 { +// boxes = [(2040,2040,2040), (2055,2055,2055)] +// } +// level_8 { +// boxes = [(4088,4088,4088), (4103,4103,4103)] +// } +// level_9 { +// boxes = [(8184,8184,8184), (8199,8199,8199)] +// } + //etc. +} + +LoadBalancer{ +} + +ModifiedBratuProblem{ + timestep = 0.0625 // time increment used for all steps + lambda = 6.0 // factor multiplying exponential term + + max_precond_its = 35 // maximum iterations for preconditioner + precond_tol = 1.0e-2 // preconditioner convergence tolerance +} + +KINSOLSolver{ + max_nonlinear_iterations = 20 + KINSOL_log_filename = "nkLog.32x32.8" + KINSOL_print_flag = 3 + + uses_preconditioner = TRUE + uses_jac_times_vector = TRUE + + residual_stop_tolerance = 1.0e-10 + nonlinear_step_tolerance = 1.0e-10 + + max_krylov_dimension = 20 + max_linear_solve_restarts = 6 +} + +SNESSolver{ + uses_preconditioner = TRUE + uses_explicit_jacobian = TRUE + absolute_tolerance = 1.0e-10 + relative_tolerance = 1.0e-4 + step_tolerance = 1.0e-6 + linear_solver_type = "gmres" + maximum_gmres_krylov_dimension = 20 + maximum_linear_iterations = 50 + forcing_term_strategy = "EWCHOICE1" +} + +ImplicitIntegrator{ + initial_time = 0.0 + final_time = 1.0 + max_integrator_steps = 5 +} diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/petsc.3d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/petsc.3d.input new file mode 100644 index 00000000..5174bed5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/performance_inputs/petsc.3d.input @@ -0,0 +1,160 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for 3D nonlinear solver example using PETSc. + * + ************************************************************************/ + +// Refer to test_inputs/kinsol.2d.input for description of the input parameters +// specific to this test directory. + +// This is the input file for the 3D nonlinear solver example using PETSc. + +Main{ + dim = 3 + + base_name = "petsc.3d" + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + viz_dump_dirname = "petsc.3d.visit" + visit_number_procs_per_file = 1 + +// regrid parameters + regrid_interval = 0 // zero to turn off + +// Options for nonlinear solver package are: +// "KINSOL" (default), or "PETSc-SNES" + // nonlinear_solver_package = "KINSOL" + nonlinear_solver_package = "PETSc-SNES" + +} + +TimerManager{ + maintain_exclusive_time = TRUE + maintain_concurrent_time = TRUE + timer_list = "apps::main::*", "apps::usrFcns::*" +} + +CartesianGeometry{ + domain_boxes = [(0,0,0), (31,31,31)] + x_lo = 0.0e0, 0.0e0, 0.0e0 + x_up = 1.0e0, 1.0e0, 1.0e0 +} + +PatchHierarchy { + max_levels = 2 + largest_patch_size { + level_0 = 32, 32, 32 + // all finer levels will use same values as level_0... + } + + smallest_patch_size { + level_0 = 4,4,4 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + level_4 = 2, 2, 2 + level_5 = 2, 2, 2 + level_6 = 2, 2, 2 + level_7 = 2, 2, 2 + level_8 = 2, 2, 2 + level_9 = 2, 2, 2 + level_10 = 2, 2, 2 + // etc. + } +} + +BergerRigoutsos { + combine_efficiency = 0.75 + efficiency_tolerance = 0.75 +} + +GriddingAlgorithm { +} + +StandardTagAndInitialize{ + tagging_method = "REFINE_BOXES" + + level_0 { + boxes = [(8,8,8), (23,23,23)] + } + level_1 { + boxes = [(24,24,24), (39,39,39)] + } + level_2 { + boxes = [(56,56,56), (71,71,71)] + } +// level_3 { +// boxes = [(120,120,120), (135,135,135)] +// } +// level_4 { +// boxes = [(248,248,248), (263,263,263)] +// } +// level_5 { +// boxes = [(504,504,504), (519,519,519)] +// } +// level_6 { +// boxes = [(1016,1016,1016), (1031,1031,1031)] +// } +// level_7 { +// boxes = [(2040,2040,2040), (2055,2055,2055)] +// } +// level_8 { +// boxes = [(4088,4088,4088), (4103,4103,4103)] +// } +// level_9 { +// boxes = [(8184,8184,8184), (8199,8199,8199)] +// } + //etc. +} + +LoadBalancer{ +} + +ModifiedBratuProblem{ + timestep = 0.0625 // time increment used for all steps + lambda = 6.0 // factor multiplying exponential term + + max_precond_its = 35 // maximum iterations for preconditioner + precond_tol = 1.0e-2 // preconditioner convergence tolerance +} + +KINSOLSolver{ + max_nonlinear_iterations = 20 + KINSOL_log_filename = "nkLog.32x32.8" + KINSOL_print_flag = 3 + + uses_preconditioner = TRUE + uses_jac_times_vector = TRUE + + residual_stop_tolerance = 1.0e-10 + nonlinear_step_tolerance = 1.0e-10 + + max_krylov_dimension = 20 + max_linear_solve_restarts = 4 +} + +SNESSolver{ + uses_preconditioner = TRUE + uses_explicit_jacobian = TRUE + absolute_tolerance = 1.0e-10 + relative_tolerance = 1.0e-4 + step_tolerance = 1.0e-6 + linear_solver_type = "gmres" + maximum_gmres_krylov_dimension = 20 + maximum_linear_iterations = 50 + forcing_term_strategy = "EWCHOICE1" +} + +ImplicitIntegrator{ + initial_time = 0.0 + final_time = 1.0 + max_integrator_steps = 5 +} diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-CellPoissonFACSolver-NDIM.C b/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-CellPoissonFACSolver-NDIM.C deleted file mode 100644 index 06c3b15f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-CellPoissonFACSolver-NDIM.C +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SAMRAI/solv/CellPoissonFACSolver.h" - -#include - -using namespace SAMRAI; -using namespace solv; - -template class boost::shared_ptr; diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-ModifiedBratuProblem.C b/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-ModifiedBratuProblem.C deleted file mode 100644 index 1651a5a6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/tbox_Pointer-ModifiedBratuProblem.C +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description - * - ************************************************************************/ - -#include "ModifiedBratuProblem.h" - -#include - -#if !defined(HAVE_PETSC) || !defined(HAVE_SUNDIALS) || !defined(HAVE_HYPRE) - -/* - ************************************************************************* - * If the library is not compiled with PETSC -and- KINSOL, print an error. - * If we're running autotests, skip the error - ************************************************************************* - */ -#if (TESTING != 1) -#error \ - "This example requires SAMRAI be compiled with KINSOL, PETSC, and HYPRE." -#endif - -#else - -template class boost::shared_ptr; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.2d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.2d.input index f3519916..14ad3b5d 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.2d.input @@ -3,47 +3,57 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for 2D nonlinear solver example using KINSOL. * ************************************************************************/ -// This is the input file for the 2D nonlinear solver example using KINSOL. + // This is the input file for the 2D nonlinear solver example using KINSOL. Main{ + + // Dimension of problem. No default. dim = 2 + // Base name of log and viz files. Default is "default". base_name = "2d.kinsol" -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off + // Frequency at which to dump viz output--zero to turn off + // Default is 0. + viz_dump_interval = 1 + + // Directory in which to place viz output. + // No default, this must be specified here if dump interval is non-zero. viz_dump_dirname = "2d.kinsol.visit" - viz_dump_filename = "2d.kinsol" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai + // Number of processors that dump to one viz file. + // Default is 1. + visit_number_procs_per_file = 1 -// regrid parameters + // Timestep interval for regridding. If zero, there will be no regridding. + // Default is 0. regrid_interval = 1 // zero to turn off -// Options for nonlinear solver package are: -// "KINSOL" (default), or "PETSc-SNES" + // Options for nonlinear solver package are: + // "KINSOL" (default), or "PETSc-SNES" nonlinear_solver_package = "KINSOL" - // nonlinear_solver_package = "PETSc-SNES" } +// Refer to xfer::TimerManager for input TimerManager{ maintain_exclusive_time = TRUE maintain_concurrent_time = TRUE timer_list = "apps::main::*", "apps::usrFcns::*" } +// Refer to geom::CartesianGridGeometry and its base classes for input CartesianGeometry{ domain_boxes = [(0,0), (31,31)] x_lo = 0.0e0, 0.0e0 x_up = 1.0e0, 1.0e0 } +// Refer to hier::PatchHierarchy for input PatchHierarchy { max_levels = 8 largest_patch_size { @@ -72,44 +82,77 @@ PatchHierarchy { // TODO this should be removed when visit writer is updated sequentialize_patch_indices = TRUE } -GriddingAlgorithm{ +// Refer to mesh::BergerRigoutsos for input +BergerRigoutsos { combine_efficiency = 0.75 efficiency_tolerance = 0.75 } +// Refer to mesh::GriddingAlgorithm for input +GriddingAlgorithm{ +} + +// Refer to mesh::StandardTagAndInitialize for input StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes{ - level_0 = [(8,8), (23,23)] - level_1 = [(24,24), (39,39)] - level_2 = [(56,56), (71,71)] - level_3 = [(120,120), (135,135)] - level_4 = [(248,248), (263,263)] - level_5 = [(504,504), (519,519)] - level_6 = [(1016,1016), (1031,1031)] - level_7 = [(2040,2040), (2055,2055)] - level_8 = [(4088,4088), (4103,4103)] - level_9 = [(8184,8184), (8199,8199)] - //etc. + + level_0 { + boxes = [(8,8), (23,23)] + } + level_1 { + boxes = [(24,24), (39,39)] + } + level_2 { + boxes = [(56,56), (71,71)] } + level_3 { + boxes = [(120,120), (135,135)] + } + level_4 { + boxes = [(248,248), (263,263)] + } + level_5 { + boxes = [(504,504), (519,519)] + } + level_6 { + boxes = [(1016,1016), (1031,1031)] + } + level_7 { + boxes = [(2040,2040), (2055,2055)] + } + level_8 { + boxes = [(4088,4088), (4103,4103)] + } +// level_9 { +// boxes = [(8184,8184), (8199,8199)] +// } + //etc. } +// Refer to mesh::TreeLoadBalancer for input LoadBalancer{ - processors = 1, 1 - use_spatial_bin_pack = TRUE } +// The ModifiedBratuProblem class is the "user class" in this example. +// It owns the solver and contains the code to set up the solver. +// The inputs for ModifiedBratuProblem is simply the inputs for the +// individual parts owned by the FACPoisson class. ModifiedBratuProblem{ - timestep = 0.0625 // time increment used for all steps + // Time increment used for all steps. No default. + timestep = 0.0625 + + // Factor multiplying exponential term. No default. lambda = 6.0 // factor multiplying exponential term - max_precond_its = 35 // maximum iterations for preconditioner - precond_tol = 1.0e-2 // preconditioner convergence tolerance + // Maximum iteration for preconditioner. No default. + max_precond_its = 35 - preconditioner_print_flag = FALSE // should the preconditioner report residuals + // Preconditioner convergence tolerance. No default. + precond_tol = 1.0e-2 // preconditioner convergence tolerance } +// Refer to solv::KINSOL_SAMRAIContext for input KINSOLSolver{ max_nonlinear_iterations = 20 KINSOL_log_filename = "nkLog.32x32.8" @@ -125,6 +168,7 @@ KINSOLSolver{ max_linear_solve_restarts = 6 } +// Refer to solv::SNES_SAMRAIContext for input SNESSolver{ uses_preconditioner = TRUE uses_explicit_jacobian = TRUE @@ -135,11 +179,9 @@ SNESSolver{ maximum_gmres_krylov_dimension = 20 maximum_linear_iterations = 50 forcing_term_strategy = "EWCHOICE1" - collect_convergence_histories = TRUE - print_nonlinear_residuals = TRUE - print_linear_residuals = TRUE } +// Refer to algs::ImplicitIntegrator for input ImplicitIntegrator{ initial_time = 0.0 final_time = 1.0 diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.3d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.3d.input deleted file mode 100644 index 98a83004..00000000 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/kinsol.3d.input +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for 3D nonlinear solver example using KINSOL. - * - ************************************************************************/ -// This is the input file for the 3D nonlinear solver example using KINSOL. - -Main{ - dim = 3 - - base_name = "3d.kinsol" - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "3d.kinsol.visit" - viz_dump_filename = "3d.kinsol" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// regrid parameters - regrid_interval = 1 // zero to turn off - -// Options for nonlinear solver package are: -// "KINSOL" (default), or "PETSc-SNES" - nonlinear_solver_package = "KINSOL" - // nonlinear_solver_package = "PETSc-SNES" - -} - -TimerManager{ - maintain_exclusive_time = TRUE - maintain_concurrent_time = TRUE - timer_list = "apps::main::*", "apps::usrFcns::*" -} - -CartesianGeometry{ - domain_boxes = [(0,0,0), (31,31,31)] - x_lo = 0.0e0, 0.0e0, 0.0e0 - x_up = 1.0e0, 1.0e0, 1.0e0 -} - -PatchHierarchy { - max_levels = 2 - largest_patch_size { - level_0 = 32, 32, 32 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 4,4,4 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - level_3 = 2, 2, 2 - level_4 = 2, 2, 2 - level_5 = 2, 2, 2 - level_6 = 2, 2, 2 - level_7 = 2, 2, 2 - level_8 = 2, 2, 2 - level_9 = 2, 2, 2 - level_10 = 2, 2, 2 - // etc. - } -} - -GriddingAlgorithm{ - combine_efficiency = 0.75 - efficiency_tolerance = 0.75 -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes{ - level_0 = [(8,8,8), (23,23,23)] - level_1 = [(24,24,24), (39,39,39)] - level_2 = [(56,56,56), (71,71,71)] - level_3 = [(120,120,120), (135,135,135)] - level_4 = [(248,248,248), (263,263,263)] - level_5 = [(504,504,504), (519,519,519)] - level_6 = [(1016,1016,1016), (1031,1031,1031)] - level_7 = [(2040,2040,2040), (2055,2055,2055)] - level_8 = [(4088,4088,4088), (4103,4103,4103)] - level_9 = [(8184,8184,8184), (8199,8199,8199)] - //etc. - } -} - -LoadBalancer{ - processors = 1, 1 - use_spatial_bin_pack = TRUE -} - -ModifiedBratuProblem{ - timestep = 0.0625 // time increment used for all steps - lambda = 6.0 // factor multiplying exponential term - - max_precond_its = 35 // maximum iterations for preconditioner - precond_tol = 1.0e-2 // preconditioner convergence tolerance - - preconditioner_print_flag = FALSE // should the preconditioner report residuals -} - -KINSOLSolver{ - max_nonlinear_iterations = 20 - KINSOL_log_filename = "nkLog.32x32.8" - KINSOL_print_flag = 3 - - uses_preconditioner = TRUE - uses_jac_times_vector = TRUE - - residual_stop_tolerance = 1.0e-10 - nonlinear_step_tolerance = 1.0e-10 - - max_krylov_dimension = 20 - max_linear_solve_restarts = 6 -} - -SNESSolver{ - uses_preconditioner = TRUE - uses_explicit_jacobian = TRUE - absolute_tolerance = 1.0e-10 - relative_tolerance = 1.0e-4 - step_tolerance = 1.0e-6 - linear_solver_type = "gmres" - maximum_gmres_krylov_dimension = 20 - maximum_linear_iterations = 50 - forcing_term_strategy = "EWCHOICE1" - collect_convergence_histories = TRUE - print_nonlinear_residuals = TRUE - print_linear_residuals = TRUE -} - -ImplicitIntegrator{ - initial_time = 0.0 - final_time = 1.0 - max_integrator_steps = 5 -} diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.2d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.2d.input index 91ea42c5..102c04d6 100644 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.2d.input @@ -3,10 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for 2D nonlinear solver example using PETSc. * ************************************************************************/ + +// Refer to test_inputs/kinsol.2d.input for description of the input parameters +// specific to this test directory. + // This is the input file for the 2D nonlinear solver example using PETSc. Main{ @@ -15,11 +19,9 @@ Main{ base_name = "2d.petsc" // visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both viz_dump_interval = 1 // zero to turn off viz_dump_dirname = "2d.petsc.visit" - viz_dump_filename = "2d.petsc" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai + visit_number_procs_per_file = 1 // regrid parameters regrid_interval = 0 // zero to turn off @@ -69,34 +71,53 @@ PatchHierarchy { } } -GriddingAlgorithm{ +BergerRigoutsos { combine_efficiency = 0.75 efficiency_tolerance = 0.75 +} +GriddingAlgorithm{ // TODO this should be removed when visit writer is updated sequentialize_patch_indices = TRUE } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes{ - level_0 = [(8,8), (23,23)] - level_1 = [(24,24), (39,39)] - level_2 = [(56,56), (71,71)] - level_3 = [(120,120), (135,135)] - level_4 = [(248,248), (263,263)] - level_5 = [(504,504), (519,519)] - level_6 = [(1016,1016), (1031,1031)] - level_7 = [(2040,2040), (2055,2055)] - level_8 = [(4088,4088), (4103,4103)] - level_9 = [(8184,8184), (8199,8199)] - //etc. + + level_0 { + boxes = [(8,8), (23,23)] + } + level_1 { + boxes = [(24,24), (39,39)] + } + level_2 { + boxes = [(56,56), (71,71)] } + level_3 { + boxes = [(120,120), (135,135)] + } + level_4 { + boxes = [(248,248), (263,263)] + } + level_5 { + boxes = [(504,504), (519,519)] + } + level_6 { + boxes = [(1016,1016), (1031,1031)] + } + level_7 { + boxes = [(2040,2040), (2055,2055)] + } + level_8 { + boxes = [(4088,4088), (4103,4103)] + } +// level_9 { +// boxes = [(8184,8184), (8199,8199)] +// } + //etc. } LoadBalancer{ - processors = 1, 1 - use_spatial_bin_pack = TRUE } ModifiedBratuProblem{ @@ -105,8 +126,6 @@ ModifiedBratuProblem{ max_precond_its = 35 // maximum iterations for preconditioner precond_tol = 1.0e-2 // preconditioner convergence tolerance - - preconditioner_print_flag = FALSE // should the preconditioner report residuals } KINSOLSolver{ @@ -134,9 +153,6 @@ SNESSolver{ maximum_gmres_krylov_dimension = 20 maximum_linear_iterations = 50 forcing_term_strategy = "EWCHOICE1" - collect_convergence_histories = TRUE - print_nonlinear_residuals = TRUE - print_linear_residuals = TRUE } ImplicitIntegrator{ diff --git a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.3d.input b/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.3d.input deleted file mode 100644 index 88d0b9cd..00000000 --- a/base/SAMRAI/SAMRAI/source/test/nonlinear/test_inputs/petsc.3d.input +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for 3D nonlinear solver example using PETSc. - * - ************************************************************************/ -// This is the input file for the 3D nonlinear solver example using PETSc. - -Main{ - dim = 3 - - base_name = "3d.petsc" - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "3d.petsc.visit" - viz_dump_filename = "3d.petsc" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// regrid parameters - regrid_interval = 0 // zero to turn off - -// Options for nonlinear solver package are: -// "KINSOL" (default), or "PETSc-SNES" - // nonlinear_solver_package = "KINSOL" - nonlinear_solver_package = "PETSc-SNES" - -} - -TimerManager{ - maintain_exclusive_time = TRUE - maintain_concurrent_time = TRUE - timer_list = "apps::main::*", "apps::usrFcns::*" -} - -CartesianGeometry{ - domain_boxes = [(0,0,0), (31,31,31)] - x_lo = 0.0e0, 0.0e0, 0.0e0 - x_up = 1.0e0, 1.0e0, 1.0e0 -} - -PatchHierarchy { - max_levels = 2 - largest_patch_size { - level_0 = 32, 32, 32 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 4,4,4 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - level_3 = 2, 2, 2 - level_4 = 2, 2, 2 - level_5 = 2, 2, 2 - level_6 = 2, 2, 2 - level_7 = 2, 2, 2 - level_8 = 2, 2, 2 - level_9 = 2, 2, 2 - level_10 = 2, 2, 2 - // etc. - } -} - -GriddingAlgorithm { - combine_efficiency = 0.75 - efficiency_tolerance = 0.75 -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes{ - level_0 = [(8,8,8), (23,23,23)] - level_1 = [(24,24,24), (39,39,39)] - level_2 = [(56,56,56), (71,71,71)] - level_3 = [(120,120,120), (135,135,135)] - level_4 = [(248,248,248), (263,263,263)] - level_5 = [(504,504,504), (519,519,519)] - level_6 = [(1016,1016,1016), (1031,1031,1031)] - level_7 = [(2040,2040,2040), (2055,2055,2055)] - level_8 = [(4088,4088,4088), (4103,4103,4103)] - level_9 = [(8184,8184,8184), (8199,8199,8199)] - //etc. - } -} - -LoadBalancer{ - processors = 1, 1 - use_spatial_bin_pack = TRUE -} - -ModifiedBratuProblem{ - timestep = 0.0625 // time increment used for all steps - lambda = 6.0 // factor multiplying exponential term - - max_precond_its = 35 // maximum iterations for preconditioner - precond_tol = 1.0e-2 // preconditioner convergence tolerance - - preconditioner_print_flag = FALSE // should the preconditioner report residuals -} - -KINSOLSolver{ - max_nonlinear_iterations = 20 - KINSOL_log_filename = "nkLog.32x32.8" - KINSOL_print_flag = 3 - - uses_preconditioner = TRUE - uses_jac_times_vector = TRUE - - residual_stop_tolerance = 1.0e-10 - nonlinear_step_tolerance = 1.0e-10 - - max_krylov_dimension = 20 - max_linear_solve_restarts = 4 -} - -SNESSolver{ - uses_preconditioner = TRUE - uses_explicit_jacobian = TRUE - absolute_tolerance = 1.0e-10 - relative_tolerance = 1.0e-4 - step_tolerance = 1.0e-6 - linear_solver_type = "gmres" - maximum_gmres_krylov_dimension = 20 - maximum_linear_iterations = 50 - forcing_term_strategy = "EWCHOICE1" - collect_convergence_histories = TRUE - print_nonlinear_residuals = TRUE - print_linear_residuals = TRUE -} - -ImplicitIntegrator{ - initial_time = 0.0 - final_time = 1.0 - max_integrator_steps = 5 -} diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.C b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.C index c36523d4..5d4700c9 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.C +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.C @@ -3,14 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SAMRAI interface class for hierarchy node and edge sum test * ************************************************************************/ #include "HierSumTest.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -30,7 +29,7 @@ #include "SAMRAI/hier/CoarseFineBoundary.h" extern "C" { -void F77_FUNC(setedges2d, SETEDGES2D) (const int&, const int&, +void SAMRAI_F77_FUNC(setedges2d, SETEDGES2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -38,14 +37,14 @@ void F77_FUNC(setedges2d, SETEDGES2D) (const int&, const int&, double *, double *); -void F77_FUNC(checkedges2d, CHECKEDGES2D) (const int&, const int&, +void SAMRAI_F77_FUNC(checkedges2d, CHECKEDGES2D) (const int&, const int&, const int&, const int&, const int&, const int&, const double&, int&, const double *, const double *); -void F77_FUNC(setedges3d, SETEDGES3D) (const int&, const int&, const int&, +void SAMRAI_F77_FUNC(setedges3d, SETEDGES3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -54,7 +53,7 @@ void F77_FUNC(setedges3d, SETEDGES3D) (const int&, const int&, const int&, double *, double *); -void F77_FUNC(checkedges3d, CHECKEDGES3D) (const int&, const int&, +void SAMRAI_F77_FUNC(checkedges3d, CHECKEDGES3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -185,7 +184,7 @@ HierSumTest::setInitialNodeValues( * Set node weight on patch interiors = sum(cell weights) */ // loop over hierarchy levels - for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ln++) { + for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); // loop over patches on level @@ -194,11 +193,13 @@ HierSumTest::setInitialNodeValues( const boost::shared_ptr& patch = *ip; boost::shared_ptr > unode( - patch->getPatchData(d_unode_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_unode_id))); boost::shared_ptr > ucell( - patch->getPatchData(d_ucell_node_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_node_id))); + TBOX_ASSERT(unode); + TBOX_ASSERT(ucell); // output initial cell values int level_number = level->getLevelNumber(); @@ -210,10 +211,10 @@ HierSumTest::setInitialNodeValues( Box pbox = patch->getBox(); double cell_val; int d; - NodeIterator niend(pbox, false); - for (NodeIterator ni(pbox, true); ni != niend; ++ni) { + NodeIterator niend(NodeGeometry::end(pbox)); + for (NodeIterator ni(NodeGeometry::begin(pbox)); ni != niend; ++ni) { NodeIndex node = *ni; - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { (*unode)(node, d) = 0.; @@ -222,8 +223,8 @@ HierSumTest::setInitialNodeValues( * value. */ if (d_dim == tbox::Dimension(2)) { - for (int j = 0; j <= 1; j++) { - for (int i = 0; i <= 1; i++) { + for (int j = 0; j <= 1; ++j) { + for (int i = 0; i <= 1; ++i) { CellIndex cell(*ni); cell(0) -= i; cell(1) -= j; @@ -233,9 +234,9 @@ HierSumTest::setInitialNodeValues( } } if (d_dim == tbox::Dimension(3)) { - for (int k = 0; k <= 1; k++) { - for (int j = 0; j <= 1; j++) { - for (int i = 0; i <= 1; i++) { + for (int k = 0; k <= 1; ++k) { + for (int j = 0; j <= 1; ++j) { + for (int i = 0; i <= 1; ++i) { CellIndex cell(*ni); cell(0) -= i; cell(1) -= j; @@ -272,7 +273,7 @@ HierSumTest::setInitialNodeValues( BoxContainer fine_level_boxes = fine_level->getBoxes(); fine_level_boxes.coarsen(fine_level->getRatioToCoarserLevel()); complement.removeIntersections(fine_level_boxes); - complement.grow(IntVector(d_dim, 1)); + complement.grow(IntVector::getOne(d_dim)); fine_overlap_shrunk.removeIntersections(complement); for (PatchLevel::iterator ip(level->begin()); @@ -280,18 +281,20 @@ HierSumTest::setInitialNodeValues( const boost::shared_ptr& patch = *ip; boost::shared_ptr > unode( - patch->getPatchData(d_unode_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_unode_id))); + TBOX_ASSERT(unode); for (BoxContainer::iterator b = fine_overlap_shrunk.begin(); b != fine_overlap_shrunk.end(); ++b) { Box fine_overlap = *b; Box patch_interior = patch->getBox(); Box data_box = fine_overlap * patch_interior; - NodeIterator niend(data_box, false); - for (NodeIterator ni(data_box, true); ni != niend; ++ni) { + NodeIterator niend(NodeGeometry::end(data_box)); + for (NodeIterator ni(NodeGeometry::begin(data_box)); + ni != niend; ++ni) { NodeIndex node = *ni; - for (int d = 0; d < unode->getDepth(); d++) { + for (int d = 0; d < unode->getDepth(); ++d) { double node_val = (*unode)(node, d); if (tbox::MathUtilities::equalEps(node_val, 0.0)) { @@ -308,8 +311,9 @@ HierSumTest::setInitialNodeValues( const boost::shared_ptr& patch = *ip; boost::shared_ptr > unode( - patch->getPatchData(d_unode_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_unode_id))); + TBOX_ASSERT(unode); // output initial node values tbox::plog << "INITIAL Node values - Level: " << level->getLevelNumber() @@ -334,7 +338,7 @@ HierSumTest::setInitialEdgeValues( int fail_count = 0; double correct_val = 1.; - for (int i = 0; i < d_dim.getValue() - 1; i++) { + for (int i = 0; i < d_dim.getValue() - 1; ++i) { correct_val *= 2.; } @@ -346,11 +350,13 @@ HierSumTest::setInitialEdgeValues( const boost::shared_ptr& patch = *ip; boost::shared_ptr > uedge( - patch->getPatchData(d_uedge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_uedge_id))); boost::shared_ptr > ucell( - patch->getPatchData(d_ucell_edge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_edge_id))); + TBOX_ASSERT(uedge); + TBOX_ASSERT(ucell); // output initial cell values int level_number = level->getLevelNumber(); @@ -364,10 +370,10 @@ HierSumTest::setInitialEdgeValues( IntVector cellg(ucell->getGhostCellWidth()); IntVector edgeg(uedge->getGhostCellWidth()); - for (int d = 0; d < uedge->getDepth(); d++) { + for (int d = 0; d < uedge->getDepth(); ++d) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(setedges2d, SETEDGES2D) (ifirst(0), ifirst(1), + SAMRAI_F77_FUNC(setedges2d, SETEDGES2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), cellg(0), cellg(1), edgeg(0), edgeg(1), @@ -376,7 +382,7 @@ HierSumTest::setInitialEdgeValues( uedge->getPointer(1, d)); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(setedges3d, SETEDGES3D) (ifirst(0), ifirst(1), ifirst(2), + SAMRAI_F77_FUNC(setedges3d, SETEDGES3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), cellg(0), cellg(1), cellg(2), edgeg(0), edgeg(1), edgeg(2), @@ -399,7 +405,7 @@ HierSumTest::setInitialEdgeValues( int fort_all_correct = 1; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(checkedges2d, CHECKEDGES2D) (ifirst(0), ifirst(1), + SAMRAI_F77_FUNC(checkedges2d, CHECKEDGES2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), edgeg(0), edgeg(1), correct_val, @@ -408,7 +414,7 @@ HierSumTest::setInitialEdgeValues( uedge->getPointer(1, d)); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(checkedges3d, CHECKEDGES3D) (ifirst(0), ifirst(1), + SAMRAI_F77_FUNC(checkedges3d, CHECKEDGES3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), edgeg(0), edgeg(1), edgeg(2), @@ -420,7 +426,7 @@ HierSumTest::setInitialEdgeValues( } if (fort_all_correct == 0) { - fail_count++; + ++fail_count; tbox::perr << "PatchBdrySum Edge test FAILED: Errors on Level: " << level->getLevelNumber() @@ -488,9 +494,7 @@ HierSumTest::setupOuternodeSum( void HierSumTest::doOuternodeSum() { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(d_node_sum_util); -#endif bool fill_hanging_nodes = true; d_node_sum_util->computeSum(fill_hanging_nodes); @@ -507,8 +511,8 @@ HierSumTest::setupOuteredgeSum( const boost::shared_ptr hierarchy, const int level_num) { - if (level_num >= d_edge_sum_util.getSize()) { - d_edge_sum_util.resizeArray(level_num + 1); + if (level_num >= static_cast(d_edge_sum_util.size())) { + d_edge_sum_util.resize(level_num + 1); } d_edge_sum_util[level_num].reset( @@ -528,10 +532,8 @@ void HierSumTest::doOuteredgeSum( const int level_num) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level_num < d_edge_sum_util.getSize()); + TBOX_ASSERT(level_num < static_cast(d_edge_sum_util.size())); TBOX_ASSERT(d_edge_sum_util[level_num]); -#endif d_edge_sum_util[level_num]->computeSum(); @@ -555,12 +557,12 @@ int HierSumTest::checkNodeResult( */ double correct_val = 1.; - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { correct_val *= 2.; } // loop over hierarchy levels - for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ln++) { + for (int ln = 0; ln <= hierarchy->getFinestLevelNumber(); ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); BoxContainer level_boxes_complement = level->getBoxes(); @@ -575,14 +577,15 @@ int HierSumTest::checkNodeResult( } // loop over patches on level - bool all_correct = true; for (PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { + bool all_correct = true; const boost::shared_ptr& patch = *ip; boost::shared_ptr > unode( - patch->getPatchData(d_unode_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_unode_id))); + TBOX_ASSERT(unode); // loop over Level complement boxlist for (BoxContainer::iterator b = level_boxes_complement.begin(); @@ -596,10 +599,11 @@ int HierSumTest::checkNodeResult( /* * Iterate over nodes and check correctness of result. */ - NodeIterator iend(data_box, false); - for (NodeIterator i(data_box, true); i != iend; ++i) { + NodeIterator iend(NodeGeometry::end(data_box)); + for (NodeIterator i(NodeGeometry::begin(data_box)); + i != iend; ++i) { NodeIndex node = *i; // i,j - for (int d = 0; d < unode->getDepth(); d++) { + for (int d = 0; d < unode->getDepth(); ++d) { bool node_correct = false; double node_val = (*unode)(node, d); @@ -610,7 +614,7 @@ int HierSumTest::checkNodeResult( } if (!node_correct) { - tbox::pout << "BAD NODE = " << node_val << " at index " + tbox::perr << "BAD NODE = " << node_val << " at index " << *i << " in L" << ln << " " << patch->getBox() << " depth = " << d << " should be " @@ -623,7 +627,7 @@ int HierSumTest::checkNodeResult( } // loop over complement boxes if (!all_correct) { - fail_count++; + ++fail_count; tbox::perr << "PatchBdrySum Node test FAILED: Errors on Level: " << level->getLevelNumber() << "\t Patch: " << patch->getBox() @@ -639,11 +643,12 @@ int HierSumTest::checkNodeResult( << "\tare correct." << endl; } +#if (TESTING == 1) boost::shared_ptr > ucell_node( - patch->getPatchData(d_ucell_node_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_node_id))); + TBOX_ASSERT(ucell_node); -#if (TESTING == 1) tbox::plog << "FINAL Cell values for NODE - Level: " << level->getLevelNumber() << "\tPatch: " << patch->getBox() << endl; @@ -681,7 +686,7 @@ int HierSumTest::checkEdgeResult( */ double correct_val = 1.; - for (int i = 0; i < d_dim.getValue() - 1; i++) { + for (int i = 0; i < d_dim.getValue() - 1; ++i) { correct_val *= 2.; } @@ -691,15 +696,16 @@ int HierSumTest::checkEdgeResult( const boost::shared_ptr& patch = *ip; boost::shared_ptr > uedge( - patch->getPatchData(d_uedge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_uedge_id))); + TBOX_ASSERT(uedge); const Index ifirst(patch->getBox().lower()); const Index ilast(patch->getBox().upper()); IntVector edgeg(uedge->getGhostCellWidth()); - for (int d = 0; d < uedge->getDepth(); d++) { + for (int d = 0; d < uedge->getDepth(); ++d) { /* * In the fortran, set "fort_all_correct" to 0 if we @@ -708,7 +714,7 @@ int HierSumTest::checkEdgeResult( int fort_all_correct = 1; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(checkedges2d, CHECKEDGES2D) (ifirst(0), ifirst(1), + SAMRAI_F77_FUNC(checkedges2d, CHECKEDGES2D) (ifirst(0), ifirst(1), ilast(0), ilast(1), edgeg(0), edgeg(1), correct_val, @@ -717,7 +723,7 @@ int HierSumTest::checkEdgeResult( uedge->getPointer(1, d)); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(checkedges3d, CHECKEDGES3D) (ifirst(0), ifirst(1), + SAMRAI_F77_FUNC(checkedges3d, CHECKEDGES3D) (ifirst(0), ifirst(1), ifirst(2), ilast(0), ilast(1), ilast(2), edgeg(0), edgeg(1), edgeg(2), @@ -729,7 +735,7 @@ int HierSumTest::checkEdgeResult( } if (fort_all_correct == 0) { - fail_count++; + ++fail_count; tbox::perr << "PatchBdrySum Edge test FAILED: Errors on Level: " << level->getLevelNumber() << "\t Patch: " << patch->getBox() @@ -747,11 +753,12 @@ int HierSumTest::checkEdgeResult( } // loop over depth +#if (TESTING == 1) boost::shared_ptr > ucell_edge( - patch->getPatchData(d_ucell_edge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_edge_id))); + TBOX_ASSERT(ucell_edge); -#if (TESTING == 1) tbox::plog << "FINAL Cell values for EDGE - Level: " << level->getLevelNumber() << "\tPatch: " << patch->getBox() << endl; @@ -821,11 +828,13 @@ void HierSumTest::initializeLevelData( const boost::shared_ptr& patch = *p0; boost::shared_ptr > unode( - patch->getPatchData(d_unode_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_unode_id))); boost::shared_ptr > uedge( - patch->getPatchData(d_uedge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_uedge_id))); + TBOX_ASSERT(unode); + TBOX_ASSERT(uedge); unode->fillAll(0.0); uedge->fillAll(0.0); } @@ -841,11 +850,13 @@ void HierSumTest::initializeLevelData( const boost::shared_ptr& patch = *p0; boost::shared_ptr > ucell_node( - patch->getPatchData(d_ucell_node_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_node_id))); boost::shared_ptr > ucell_edge( - patch->getPatchData(d_ucell_edge_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_ucell_edge_id))); + TBOX_ASSERT(ucell_node); + TBOX_ASSERT(ucell_edge); ucell_node->fillAll(0.0, ucell_node->getGhostBox()); // ghost box ucell_node->fillAll(1.0, patch->getBox()); // interior patch box @@ -855,16 +866,17 @@ void HierSumTest::initializeLevelData( // set cell values at physical boundary const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array node_bdry = + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); + const std::vector& node_bdry = patch_geom->getCodimensionBoundaries(d_dim.getValue()); - const tbox::Array edge_bdry = + const std::vector& edge_bdry = patch_geom->getCodimensionBoundaries(d_dim.getValue() - 1); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = patch_geom->getCodimensionBoundaries(1); - } + std::vector empty_vector(0, BoundaryBox(d_dim)); + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + patch_geom->getCodimensionBoundaries(1) : empty_vector; // node cell values setBoundaryConditions(*patch, node_bdry, @@ -895,12 +907,13 @@ void HierSumTest::initializeLevelData( fine_level_boxes.coarsen(ratio); for (PatchLevel::iterator p1(coarser_level->begin()); - p1 != coarser_level->end(); ++p1) { + p1 != coarser_level->end(); ++p1) { const boost::shared_ptr& cpatch = *p1; boost::shared_ptr > ucell_node( - cpatch->getPatchData(d_ucell_node_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + cpatch->getPatchData(d_ucell_node_id))); + TBOX_ASSERT(ucell_node); Box cpbox = cpatch->getBox(); for (BoxContainer::iterator fine_level_itr = fine_level_boxes.begin(); @@ -934,14 +947,14 @@ void HierSumTest::initializeLevelData( Box pbox = patch->getBox(); const GlobalId global_id = patch->getGlobalId(); - const tbox::Array node_bdry = + const std::vector& node_bdry = cfbdry.getNodeBoundaries(global_id); - const tbox::Array edge_bdry = + const std::vector& edge_bdry = cfbdry.getEdgeBoundaries(global_id); - tbox::Array face_bdry; - if (d_dim == tbox::Dimension(3)) { - face_bdry = cfbdry.getFaceBoundaries(global_id); - } + std::vector empty_vector(0, BoundaryBox(d_dim)); + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + cfbdry.getFaceBoundaries(global_id) : empty_vector; setBoundaryConditions(*patch, node_bdry, @@ -997,29 +1010,29 @@ HierSumTest::applyGradientDetector( void HierSumTest::setBoundaryConditions( Patch& patch, - const tbox::Array& node_bdry, - const tbox::Array& edge_bdry, - const tbox::Array& face_bdry, + const std::vector& node_bdry, + const std::vector& edge_bdry, + const std::vector& face_bdry, const int cell_data_id) { - const int num_node_bdry_boxes = node_bdry.getSize(); - const int num_edge_bdry_boxes = edge_bdry.getSize(); - const int num_face_bdry_boxes = face_bdry.getSize(); + const int num_node_bdry_boxes = static_cast(node_bdry.size()); + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); + const int num_face_bdry_boxes = static_cast(face_bdry.size()); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * boost::shared_ptr to data in ghost regions. */ boost::shared_ptr > ucell( - patch.getPatchData(cell_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch.getPatchData(cell_data_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(ucell); -#endif + IntVector ghost_cells(ucell->getGhostCellWidth()); const Box pbox(patch.getBox()); @@ -1031,7 +1044,7 @@ HierSumTest::setBoundaryConditions( /* * Set cell weights to 1.0 on FACES of patch. */ - for (i = 0; i < num_face_bdry_boxes; i++) { + for (i = 0; i < num_face_bdry_boxes; ++i) { Box fill_box = patch_geom->getBoundaryFillBox(face_bdry[i], pbox, ghost_cells); @@ -1060,10 +1073,11 @@ HierSumTest::setBoundaryConditions( shifted_pbox.shift(shift); fill_box = fill_box * shifted_pbox; - CellIterator ciend(fill_box, false); - for (CellIterator ci(fill_box, true); ci != ciend; ++ci) { + CellIterator ciend(CellGeometry::end(fill_box)); + for (CellIterator ci(CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { CellIndex cell = *ci; - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { (*ucell)(cell, d) = 1.0; } } @@ -1073,7 +1087,7 @@ HierSumTest::setBoundaryConditions( /* * Set cell weights to 1.0 on EDGES of patch. */ - for (i = 0; i < num_edge_bdry_boxes; i++) { + for (i = 0; i < num_edge_bdry_boxes; ++i) { Box fill_box = patch_geom->getBoundaryFillBox(edge_bdry[i], pbox, ghost_cells); @@ -1149,10 +1163,11 @@ HierSumTest::setBoundaryConditions( shifted_pbox.shift(shift); fill_box = fill_box * shifted_pbox; - CellIterator ciend(fill_box, false); - for (CellIterator ci(fill_box, true); ci != ciend; ++ci) { + CellIterator ciend(CellGeometry::end(fill_box)); + for (CellIterator ci(CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { CellIndex cell = *ci; - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { (*ucell)(cell, d) = 1.0; } } @@ -1162,15 +1177,16 @@ HierSumTest::setBoundaryConditions( * Set cell weights to 1.0 on NODES of patch. */ - for (i = 0; i < num_node_bdry_boxes; i++) { + for (i = 0; i < num_node_bdry_boxes; ++i) { Box fill_box = patch_geom->getBoundaryFillBox(node_bdry[i], pbox, ghost_cells); - CellIterator ciend(fill_box, false); - for (CellIterator ci(fill_box, true); ci != ciend; ++ci) { + CellIterator ciend(CellGeometry::end(fill_box)); + for (CellIterator ci(CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { CellIndex cell = *ci; //i,j - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { (*ucell)(cell, d) = 1.0; } } @@ -1189,34 +1205,33 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( { const boost::shared_ptr patch_geom( - cpatch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + cpatch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); /* * Get node and edge boundary boxes. */ - const tbox::Array edge_bdry = + const std::vector& edge_bdry = patch_geom->getCodimensionBoundaries(d_dim.getValue() - 1); - const int num_edge_bdry_boxes = edge_bdry.getSize(); + const int num_edge_bdry_boxes = static_cast(edge_bdry.size()); - tbox::Array face_bdry; - int num_face_bdry_boxes = 0; - if (d_dim == tbox::Dimension(3)) { - face_bdry = patch_geom->getCodimensionBoundaries(1); - num_face_bdry_boxes = face_bdry.getSize(); - } + std::vector empty_vector(0, BoundaryBox(d_dim)); + const std::vector& face_bdry = + d_dim == tbox::Dimension(3) ? + patch_geom->getCodimensionBoundaries(1) : empty_vector; + const int num_face_bdry_boxes = static_cast(face_bdry.size()); /* * boost::shared_ptr to data in ghost regions. */ boost::shared_ptr > ucell( - cpatch.getPatchData(cell_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + cpatch.getPatchData(cell_data_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(ucell); -#endif + IntVector ghost_cells(ucell->getGhostCellWidth()); int d; @@ -1228,7 +1243,7 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( * Zero out values on the FACE boundary when they border a value of * zero on the interior. */ - for (int i_box = 0; i_box < num_face_bdry_boxes; i_box++) { + for (int i_box = 0; i_box < num_face_bdry_boxes; ++i_box) { Box fill_box = patch_geom->getBoundaryFillBox(face_bdry[i_box], cpbox, ghost_cells); @@ -1239,8 +1254,9 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( * 4,5 - Z lower,upper */ int loc_indx = face_bdry[i_box].getLocationIndex(); - CellIterator ciend(fill_box, false); - for (CellIterator ci(fill_box, true); ci != ciend; ++ci) { + CellIterator ciend(CellGeometry::end(fill_box)); + for (CellIterator ci(CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { CellIndex boundary_cell = *ci; CellIndex interior = boundary_cell; if (loc_indx == 0) { @@ -1257,7 +1273,7 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( interior(2) -= 1; } - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { interior_value = (*ucell)(interior, d); if (tbox::MathUtilities::equalEps(interior_value, @@ -1272,7 +1288,7 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( * Zero out values on the EDGE boundary when they border a value of * zero on the interior. */ - for (int i = 0; i < num_edge_bdry_boxes; i++) { + for (int i = 0; i < num_edge_bdry_boxes; ++i) { Box fill_box = patch_geom->getBoundaryFillBox(edge_bdry[i], cpbox, ghost_cells); @@ -1287,8 +1303,9 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( * 2,3 - Ylo, Yhi */ int loc_indx = edge_bdry[i].getLocationIndex(); - CellIterator ciend(fill_box, false); - for (CellIterator ci(fill_box, true); ci != ciend; ++ci) { + CellIterator ciend(CellGeometry::end(fill_box)); + for (CellIterator ci(CellGeometry::begin(fill_box)); + ci != ciend; ++ci) { CellIndex boundary_cell = *ci; CellIndex interior = boundary_cell; if (d_dim == tbox::Dimension(3)) { @@ -1341,7 +1358,7 @@ void HierSumTest::zeroOutPhysicalBoundaryCellsAtCoarseFineBoundary( interior(1) -= 1; } } - for (d = 0; d < ucell->getDepth(); d++) { + for (d = 0; d < ucell->getDepth(); ++d) { interior_value = (*ucell)(interior, d); if (tbox::MathUtilities::equalEps(interior_value, 0.0)) { @@ -1371,40 +1388,40 @@ HierSumTest::getFromInput( /* * Set number of ghosts for node and edge data. */ - tbox::Array tmp_array; + std::vector tmp_array; if (input_db->keyExists("node_ghosts")) { - tmp_array = input_db->getIntegerArray("node_ghosts"); - if (tmp_array.getSize() != d_dim.getValue()) { + tmp_array = input_db->getIntegerVector("node_ghosts"); + if (static_cast(tmp_array.size()) != d_dim.getValue()) { TBOX_ERROR("HierSumTest::getFromInput()" << "invalid 'node_ghosts' entry - must be integer" << "array of size d_dim" << endl); } } else { - tmp_array.resizeArray(d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + tmp_array.resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { tmp_array[i] = 0; } } - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { d_node_ghosts(i) = tmp_array[i]; } if (input_db->keyExists("edge_ghosts")) { - tmp_array = input_db->getIntegerArray("edge_ghosts"); - if (tmp_array.getSize() != d_dim.getValue()) { + tmp_array = input_db->getIntegerVector("edge_ghosts"); + if (static_cast(tmp_array.size()) != d_dim.getValue()) { TBOX_ERROR("HierSumTest::getFromInput()" << "invalid 'edge_ghosts' entry - must be integer" << "array of size d_dim" << endl); } } else { - tmp_array.resizeArray(d_dim.getValue()); - for (int i = 0; i < d_dim.getValue(); i++) { + tmp_array.resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { tmp_array[i] = 0; } } - for (int i = 0; i < d_dim.getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { d_edge_ghosts(i) = tmp_array[i]; } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.h b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.h index 2d9bf762..fb73b0e4 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.h +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/HierSumTest.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: SAMRAI interface class for hierarchy node and edge sum test * ************************************************************************/ @@ -31,9 +31,10 @@ #include "SAMRAI/algs/PatchBoundaryEdgeSum.h" #include "SAMRAI/hier/PatchLevel.h" #include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/appu/VisItDataWriter.h"\ +#include "SAMRAI/appu/VisItDataWriter.h" \ -#include +#include "boost/shared_ptr.hpp" +#include using namespace std; using namespace SAMRAI; @@ -259,7 +260,7 @@ class HierSumTest: */ virtual void getFromInput( - boost::shared_ptr db); + boost::shared_ptr input_db); /* * Set boundary conditions at physical boundaries and coarse-fine @@ -270,9 +271,9 @@ class HierSumTest: void setBoundaryConditions( Patch& patch, - const tbox::Array& node_bdry, - const tbox::Array& edge_bdry, - const tbox::Array& face_bdry, + const std::vector& node_bdry, + const std::vector& edge_bdry, + const std::vector& face_bdry, const int cell_data_id); /* @@ -322,7 +323,7 @@ class HierSumTest: * Node and edge sum utilities. */ boost::shared_ptr d_node_sum_util; - Array > d_edge_sum_util; + std::vector > d_edge_sum_util; /* * Flag to tell whether to check data before communication. Usually, diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.depend index fb792c61..05e34cf4 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -50,12 +50,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -94,7 +96,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -108,8 +109,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -129,10 +130,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h HierSumTest.C \ HierSumTest.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -153,12 +154,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -170,6 +170,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -179,6 +180,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -191,7 +193,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -203,18 +208,17 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -222,11 +226,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -262,12 +267,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -281,9 +286,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -305,13 +311,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h HierSumTest.h \ main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -331,10 +335,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.in b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.in index bd35fa0a..598ac95d 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI patch boundary hierarchy sum test ## ######################################################################### @@ -14,24 +14,34 @@ SUBDIR = source/test/patchbdrysum VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DDISPLAY -DNDIM=$(PDIM) -DTESTING=1 +SUBDIRS = fortran -CXX_OBJS = main.o HierSumTest.o -F_OBJS = edgeops2d.o edgeops3d.o +CPPFLAGS_EXTRA= -DDISPLAY -DTESTING=1 NUM_TESTS = 17 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = main.o HierSumTest.o +F_OBJS = fortran/edgeops2d.o fortran/edgeops3d.o main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ $(LIBSAMRAI) $(LDLIBS) -o $@ +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/edgeops2d.o: + +fortran/edgeops3d.o: + check: $(MAKE) check2d $(MAKE) check3d @@ -39,43 +49,51 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: checkcompile - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: - $(SAMCLEAN) - $(RM) *.f *main* - $(RM) -rf restart-*d* - $(RM) -r viz* +perf: +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -include $(SRCDIR)/Makefile.depend +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -FORTRAN = $(SRCDIR) -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -edgeops2d.o: $(FORTRAN)/edgeops2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/edgeops2d.m4 > edgeops2d.f - $(F77) $(FFLAGS) -c edgeops2d.f -o $@ -edgeops3d.o: $(FORTRAN)/edgeops3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/edgeops3d.m4 > edgeops3d.f - $(F77) $(FFLAGS) -c edgeops3d.f -o $@ +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/README b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/README index 52120a7b..8246421f 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/README +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for patch boundary sum tests. ## ######################################################################### @@ -30,4 +30,39 @@ The test works as follows: be either 2^NDIM or 0.0 - there should be no cases where the node will have an alternative value. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + Execution: + For one of the following input files: + test_inputs/1lev_edge.2d.input + test_inputs/1lev_edge.3d.input + test_inputs/2lev_edge.3d.input + test_inputs/2lev_node.3d.input + test_inputs/2lev_node_aligned_bdry.2d.input + test_inputs/2lev_node_aligned_bdry.3d.input + test_inputs/2lev_node_edge.2d.input + test_inputs/2lev_node_edge_perx.2d.input + test_inputs/2lev_node_edge_perx.3d.input + test_inputs/2lev_node_edge_perxy.2d.input + test_inputs/2lev_node_edge_perxy.3d.input + test_inputs/2lev_node_edge_perxyz.3d.input + test_inputs/2lev_node_edge_perxz.3d.input + test_inputs/2lev_node_edge_pery.2d.input + test_inputs/2lev_node_edge_pery.3d.input + test_inputs/2lev_node_edge_peryz.3d.input + test_inputs/2lev_node_edge_perz.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + +INPUT +----- + +See test_inputs/2lev_node.3d.input for descriptions of the input options +specific to this test. diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.2d.input deleted file mode 100644 index ec5a49fb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.2d.input +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 2 - - do_node_sum = FALSE - do_edge_sum = TRUE - - nsteps = 1 - - log_file_name = "1lev-2d-edge.log" - visit_dump_dirname = "viz_1lev-2d-edge" - -} - -HierSumTest { - - node_ghosts = 0 , 0 - edge_ghosts = 0 , 0 - - check_data_before_communication = FALSE - -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (2,2) ] - x_lo = 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 1 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 3 , 3 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (2,2) , (4,4) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.3d.input deleted file mode 100644 index 46ddfa2f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/1lev_edge.3d.input +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 3 - - do_node_sum = FALSE - do_edge_sum = TRUE - - nsteps = 1 - - log_file_name = "1lev-3d-edge.log" - visit_dump_dirname = "viz_1lev-3d-edge" -} - -HierSumTest { - - node_ghosts = 0 , 0 , 0 - edge_ghosts = 0 , 0 , 0 - - check_data_before_communication = FALSE - -} - -CartesianGeometry { -// domain_boxes = [ (0,0,0) , (9,9,9) ] - domain_boxes = [ (0,0,0) , (4,4,4) ] - x_lo = 0.0e0 , 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 1 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 3 , 3 , 3 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1,1) , (3,3,3) ] -// level_0 = [ (1,2,2) , (4,4,4) ], -// [ (5,3,5) , (7,6,7) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_edge.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_edge.3d.input deleted file mode 100644 index e89e1d0a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_edge.3d.input +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 3 - - do_node_sum = FALSE - do_edge_sum = TRUE - - nsteps = 1 - - log_file_name = "2lev-3d-edge.log" - visit_dump_dirname = "viz_2lev-3d-edge" -} - -HierSumTest { - - node_ghosts = 0 , 0 , 0 - edge_ghosts = 0 , 0 , 0 - - check_data_before_communication = FALSE - -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , (9,8,7) ] - x_lo = 0.0e0 , 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 5, 4, 4 - level_1 = 4, 6, 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (2,2,2) , (7,6,5) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node.3d.input deleted file mode 100644 index 17f379d5..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node.3d.input +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 3 - - do_node_sum = TRUE - do_edge_sum = FALSE - - nsteps = 1 - - log_file_name = "2lev-3d-node.log" - visit_dump_dirname = "viz_2lev-3d-node" -} - -HierSumTest { - - node_ghosts = 0 , 0 , 0 - edge_ghosts = 0 , 0 , 0 - - check_data_before_communication = FALSE - -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , (11,10,9) ] - x_lo = 0.0e0 , 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 5, 4, 4 - level_1 = 4, 6, 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1,1) , (4,5,4) ], - [ (5,4,3) , (8,8,7) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.2d.input deleted file mode 100644 index bb056663..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.2d.input +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 2 - - do_node_sum = TRUE - do_edge_sum = TRUE - - nsteps = 1 - - log_file_name = "2lev-2d-node-aligned-bdry.log" - visit_dump_dirname = "viz_2lev-2d-node-aligned-bdry" -} - -HierSumTest { - - node_ghosts = 0 , 0 - edge_ghosts = 0 , 0 - - check_data_before_communication = FALSE -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (19,19) ] -// domain_boxes = [ (0,0) , (4,4) ] - x_lo = 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 8 , 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { -// level_0 = [ (0,0) , (2,2) ] - level_0 = [ (0,0) , (7,7) ], - [ (8,4) , (15,13) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.3d.input deleted file mode 100644 index fe679158..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_aligned_bdry.3d.input +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 3 - - do_node_sum = TRUE - do_edge_sum = FALSE - - nsteps = 1 - - log_file_name = "2lev-3d-node-aligned-bdry.log" - visit_dump_dirname = "viz_2lev-3d-node-aligned-bdry" -} - -HierSumTest { - - node_ghosts = 0 , 0 , 0 - edge_ghosts = 0 , 0 , 0 - - check_data_before_communication = FALSE - -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , (9,7,7) ] - x_lo = 0.0e0 , 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 5, 4, 4 - level_1 = 4, 6, 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (4,5,4) ], - [ (5,4,2) , (8,6,5) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_edge.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_edge.2d.input deleted file mode 100644 index 6cae41ce..00000000 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/example_inputs/2lev_node_edge.2d.input +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI patch boundary sum test - * - ************************************************************************/ - -Main { - dim = 2 - - do_node_sum = TRUE - do_edge_sum = TRUE - - nsteps = 1 - - log_file_name = "2lev-2d-node-edge.log" - visit_dump_dirname = "viz_2lev-2d-node-edge" -} - -HierSumTest { - - node_ghosts = 0 , 0 - edge_ghosts = 0 , 0 - - check_data_before_communication = FALSE -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (9,7) ] - x_lo = 0.0e0 , 0.0e0 // lower end of computational domain. - x_up = 1.0e0 , 1.0e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 5 , 4 - level_1 = 4 , 6 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1) , (4,5) ], - [ (5,4) , (8,6) ] - } -} - -LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.depend new file mode 100644 index 00000000..a1904749 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.depend @@ -0,0 +1,37 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=edgeops2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + edgeops2d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=edgeops3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + edgeops3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.in new file mode 100644 index 00000000..7749c2c0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/Makefile.in @@ -0,0 +1,39 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI patch hierarchy +## boundary sum test +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/patchbdrysum/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= edgeops2d.o edgeops3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +edgeops2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/edgeops2d.m4 > edgeops2d.f + $(F77) $(FFLAGS) -c edgeops2d.f -o $@ + +edgeops3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/edgeops3d.m4 > edgeops3d.f + $(F77) $(FFLAGS) -c edgeops3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops2d.m4 b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops2d.m4 similarity index 89% rename from base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops2d.m4 rename to base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops2d.m4 index 09f3abd1..6ab66900 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops2d.m4 @@ -1,15 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI test -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for edge operations +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for edge operations in 2d. c define(NDIM,2)dnl -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl c c*********************************************************************** c Set edge values from cell-centered values diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops3d.m4 b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops3d.m4 similarity index 92% rename from base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops3d.m4 rename to base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops3d.m4 index 79af316d..945fd7c2 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/edgeops3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/fortran/edgeops3d.m4 @@ -1,15 +1,12 @@ c -c File: $URL$ -c Package: SAMRAI test -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Release: -c Revision: -c Modified: -c Description: F77 routines for edge operations +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for edge operations in 3d. c define(NDIM,3)dnl -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl c c*********************************************************************** c Set edge values from cell-centered values diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/main.C b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/main.C index 659cca3c..4c0249f7 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/main.C +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for test of hierarchy sum * ************************************************************************/ @@ -12,6 +12,7 @@ // Headers for basic SAMRAI objects #include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" @@ -32,7 +33,7 @@ // Header for application-specific algorithm/data structure object #include "HierSumTest.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; using namespace tbox; @@ -216,7 +217,6 @@ int main( */ boost::shared_ptr tag_and_init_ops( new StandardTagAndInitialize( - dim, "StandardTagAndInitialize", hier_sum_test, input_db->getDatabase("StandardTagAndInitialize"))); @@ -232,7 +232,8 @@ int main( * "wave_eqn_model" problem class to define the user-specific operations. */ boost::shared_ptr box_generator( - new BergerRigoutsos(dim)); + new BergerRigoutsos(dim, + input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new TreeLoadBalancer(dim, @@ -281,21 +282,23 @@ int main( ****************************************************************/ double loop_time = 0.; - tbox::Array tag_buffer_array(patch_hierarchy->getMaxNumberOfLevels()); - for (int il = 0; il < patch_hierarchy->getMaxNumberOfLevels(); il++) { + int loop_cycle = 0; + std::vector tag_buffer_array(patch_hierarchy->getMaxNumberOfLevels()); + for (int il = 0; il < patch_hierarchy->getMaxNumberOfLevels(); ++il) { tag_buffer_array[il] = 1; } gridding_algorithm->makeCoarsestLevel(loop_time); bool done = false; - bool initial_time = true; + bool initial_cycle = true; for (int ln = 0; patch_hierarchy->levelCanBeRefined(ln) && !done; - ln++) { + ++ln) { gridding_algorithm->makeFinerLevel( - loop_time, - initial_time, - tag_buffer_array[ln]); + tag_buffer_array[ln], + initial_cycle, + loop_cycle, + loop_time); done = !(patch_hierarchy->finerLevelExists(ln)); } @@ -311,7 +314,7 @@ int main( int nlevels = patch_hierarchy->getNumberOfLevels(); for (int pln = 0; pln <= patch_hierarchy->getFinestLevelNumber(); - pln++) { + ++pln) { boost::shared_ptr level( patch_hierarchy->getPatchLevel(pln)); @@ -319,7 +322,7 @@ int main( for (PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { - tbox::plog << "patch # " << ip->getBox().getId() << " : " + tbox::plog << "patch # " << ip->getBox().getBoxId() << " : " << ip->getBox() << endl; } } @@ -344,13 +347,13 @@ int main( hier_sum_test->setupOuternodeSum(patch_hierarchy); } if (do_edge_sum) { - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { hier_sum_test->setupOuteredgeSum(patch_hierarchy, ln); } } - for (int i = 0; i < nsteps; i++) { + for (int i = 0; i < nsteps; ++i) { /* * In the process of constructing the hierarchy, we set cell values @@ -361,7 +364,7 @@ int main( fail_count += hier_sum_test->setInitialNodeValues(patch_hierarchy); } if (do_edge_sum) { - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr level( patch_hierarchy->getPatchLevel(ln)); fail_count += hier_sum_test->setInitialEdgeValues(level); @@ -385,7 +388,7 @@ int main( hier_sum_test->doOuternodeSum(); } if (do_edge_sum) { - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { hier_sum_test->doOuteredgeSum(ln); } } @@ -401,7 +404,7 @@ int main( tbox::pout << "\n" << endl; if (do_edge_sum) { - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr level( patch_hierarchy->getPatchLevel(ln)); fail_count += hier_sum_test->checkEdgeResult(level); diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.2d.input index 6ab3c671..f592c229 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.2d.input @@ -3,11 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + Main { dim = 2 @@ -17,9 +21,6 @@ Main { nsteps = 1 log_file_name = "1lev-2d-edge.log" - visit_dump_dirname = "viz_1lev-2d-edge" - - } HierSumTest { @@ -63,21 +64,23 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (2,2) , (4,4) ] + + level_0 { + boxes = [ (2,2) , (4,4) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.3d.input index e65c106e..4b4dbb4b 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/1lev_edge.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "1lev-3d-edge.log" - visit_dump_dirname = "viz_1lev-3d-edge" } HierSumTest { @@ -63,23 +67,27 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1,1) , (3,3,3) ] -// level_0 = [ (1,2,2) , (4,4,4) ], -// [ (5,3,5) , (7,6,7) ] + + level_0 { + boxes = [ (1,1,1) , (3,3,3) ] } +// level_0 { +// boxes = [ (1,2,2) , (4,4,4) ], +// [ (5,3,5) , (7,6,7) ] +// } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_edge.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_edge.3d.input index e89e1d0a..e1c944c9 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_edge.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_edge.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-edge.log" - visit_dump_dirname = "viz_2lev-3d-edge" } HierSumTest { @@ -60,23 +64,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (2,2,2) , (7,6,5) ] + + level_0 { + boxes = [ (2,2,2) , (7,6,5) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node.3d.input index 1b75ba5f..f22ce534 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node.3d.input @@ -3,38 +3,53 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ Main { + + //Dimension of the problem. No default. dim = 3 - do_node_sum = TRUE + //Turn on the node sum test. Default is false. + do_node_sum = TRUE + //Turn on the edge sum test. Default is false. do_edge_sum = FALSE + //Number of times the test is repeated. Default is 1. nsteps = 1 + //Output log file. Default is hiersumtest.log log_file_name = "2lev-3d-node.log" - visit_dump_dirname = "viz_2lev-3d-node" } HierSumTest { + //Ghost width for node data. Default is 0,0,0. + //Ignored if do_node_sum is FALSE. node_ghosts = 0 , 0 , 0 + + //Ghost width for edge data. Default is 0,0,0. + //Ignored if do_edge_sum is FALSE. edge_ghosts = 0 , 0 , 0 + //Checks state of data before communication. Since the checks are against + //expected post-communication values, this will cause a lot of output + //when set to TRUE. Default is FALES. check_data_before_communication = FALSE } +//See geom::CartesianGridGeometry and its base classes for input CartesianGeometry { domain_boxes = [ (0,0,0) , (11,10,9) ] x_lo = 0.0e0 , 0.0e0 , 0.0e0 // lower end of computational domain. x_up = 1.0e0 , 1.0e0 , 1.0e0 // upper end of computational domain. } +//See hier::PatchHierarchy for input. PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. @@ -62,22 +77,28 @@ PatchHierarchy { } } -GriddingAlgorithm { - +//See mesh::BergerRigoutsos for input. +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +//See mesh::GriddingAlgorithm for input. +GriddingAlgorithm { +} + +//See mesh::StandardTagAndInitialize for input. StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1,1) , (4,5,4) ], - [ (5,4,3) , (8,8,7) ] + + level_0 { + boxes = [ (1,1,1) , (4,5,4) ], + [ (5,4,3) , (8,8,7) ] } } -LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE +//See mesh::TreeLoadBalancer for input. +LoadBalancer { } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.2d.input index bb056663..5fcaa841 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.2d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 2 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-2d-node-aligned-bdry.log" - visit_dump_dirname = "viz_2lev-2d-node-aligned-bdry" } HierSumTest { @@ -61,23 +65,27 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { -// level_0 = [ (0,0) , (2,2) ] - level_0 = [ (0,0) , (7,7) ], - [ (8,4) , (15,13) ] + +// level_0 { +// boxes = [ (0,0) , (2,2) ] +// } + level_0 { + boxes = [ (0,0) , (7,7) ], + [ (8,4) , (15,13) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.3d.input index fe679158..e79edb9b 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_aligned_bdry.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-aligned-bdry.log" - visit_dump_dirname = "viz_2lev-3d-node-aligned-bdry" } HierSumTest { @@ -60,24 +64,26 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (4,5,4) ], - [ (5,4,2) , (8,6,5) ] + + level_0 { + boxes = [ (0,0,0) , (4,5,4) ], + [ (5,4,2) , (8,6,5) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge.2d.input index 6cae41ce..5d773ddd 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge.2d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 2 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-2d-node-edge.log" - visit_dump_dirname = "viz_2lev-2d-node-edge" } HierSumTest { @@ -61,22 +65,24 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1) , (4,5) ], - [ (5,4) , (8,6) ] + + level_0 { + boxes = [ (1,1) , (4,5) ], + [ (5,4) , (8,6) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.2d.input index 084ceb0c..7fd08116 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.2d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 2 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-2d-node-edge-perx.log" - visit_dump_dirname = "viz_2lev-2d-node-edge-perx" } HierSumTest { @@ -63,22 +67,24 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1) , (4,5) ], - [ (5,4) , (8,6) ] + + level_0 { + boxes = [ (1,1) , (4,5) ], + [ (5,4) , (8,6) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.3d.input index 1cd30c78..39d23419 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perx.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-perx.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-perx" } HierSumTest { @@ -62,23 +66,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.2d.input index 70c0f917..a0f63ea3 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.2d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 2 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-2d-node-edge-perxy.log" - visit_dump_dirname = "viz_2lev-2d-node-edge-perxy" } HierSumTest { @@ -63,22 +67,24 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1) , (4,5) ], - [ (5,4) , (8,6) ] + + level_0 { + boxes = [ (1,1) , (4,5) ], + [ (5,4) , (8,6) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.3d.input index 64a120bb..5354be29 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxy.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-perxy.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-perxy" } HierSumTest { @@ -62,23 +66,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxyz.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxyz.3d.input index c68a2e83..5669658d 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxyz.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxyz.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-perxyz.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-perxyz" } HierSumTest { @@ -62,23 +66,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxz.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxz.3d.input index f32444a1..3e1f85c9 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxz.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perxz.3d.input @@ -3,10 +3,13 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + Main { dim = 3 @@ -17,7 +20,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-perxz.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-perxz" } HierSumTest { @@ -63,23 +65,24 @@ PatchHierarchy { // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box -} +} + +GriddingAlgorithm { +} StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.2d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.2d.input index 73840efd..fee15d81 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.2d.input @@ -3,11 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + Main { dim = 2 @@ -17,7 +21,6 @@ Main { nsteps = 1 log_file_name = "2lev-2d-node-edge-pery.log" - visit_dump_dirname = "viz_2lev-2d-node-edge-pery" } HierSumTest { @@ -62,22 +65,24 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box } +GriddingAlgorithm { +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (1,1) , (4,5) ], - [ (5,4) , (8,6) ] + + level_0 { + boxes = [ (1,1) , (4,5) ], + [ (5,4) , (8,6) ] } } LoadBalancer { // for SAMRAI v1.3.2 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.3d.input index 4e2e32dc..5629b674 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_pery.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-pery.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-pery" } HierSumTest { @@ -62,23 +66,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_peryz.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_peryz.3d.input index 84ec602a..30c85d15 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_peryz.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_peryz.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-peryz.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-peryz" } HierSumTest { @@ -62,23 +66,25 @@ PatchHierarchy { level_0 = 1 , 1 , 1 // all finer levels will use same values as level_0... } -} - -GriddingAlgorithm { +} +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perz.3d.input b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perz.3d.input index 96f25096..2bd19f68 100644 --- a/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perz.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/patchbdrysum/test_inputs/2lev_node_edge_perz.3d.input @@ -3,11 +3,16 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI patch boundary sum test * ************************************************************************/ +//See test_inputs/2lev_node.3d.input for descriptions of the input options +//specific to this test. + + + Main { dim = 3 @@ -17,7 +22,6 @@ Main { nsteps = 1 log_file_name = "2lev-3d-node-edge-perz.log" - visit_dump_dirname = "viz_2lev-3d-node-edge-perz" } HierSumTest { @@ -65,21 +69,23 @@ PatchHierarchy { } } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} + +GriddingAlgorithm { } StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,8,7) ] + + level_0 { + boxes = [ (0,0,0) , (9,8,7) ] } } LoadBalancer { // for SAMRAI v1.3.2 and later - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.C b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.C index 9dc0d702..e2c585bc 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for Euler equations SAMRAI example * ************************************************************************/ @@ -28,12 +28,12 @@ using namespace std; -#include -#include -#include -#include +#include +#include +#include +#include -#include "SAMRAI/hier/BoxList.h" +#include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellIndex.h" @@ -42,11 +42,11 @@ using namespace std; #include "SAMRAI/pdat/FaceIndex.h" #include "SAMRAI/pdat/FaceVariable.h" #include "SAMRAI/hier/Index.h" -#include "SAMRAI/mesh/DistributedLoadBalancer.h" +#include "SAMRAI/mesh/TreeLoadBalancer.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" @@ -60,18 +60,14 @@ using namespace std; #define BOGUS_BDRY_DATA (-9999) // routines for managing boundary data -#if (NDIM == 2) #include "SAMRAI/appu/CartesianBoundaryUtilities2.h" -#endif -#if (NDIM == 3) #include "SAMRAI/appu/CartesianBoundaryUtilities3.h" -#endif // External definitions for Fortran numerical routines #include "EulerFort.h" -// Number of entries in state vector (NDIM velocity comps + pressure + density) -#define NEQU (NDIM + 2) +// Number of entries in state vector (d_dim velocity comps + pressure + density) +#define NEQU (d_dim.getValue() + 2) // Number of ghosts cells used for each variable quantity. #define CELLG (4) @@ -127,21 +123,36 @@ boost::shared_ptr Euler::t_taggradient; Euler::Euler( const string& object_name, + const tbox::Dimension& dim, boost::shared_ptr input_db, - boost::shared_ptr grid_geom) : + boost::shared_ptr grid_geom): + algs::HyperbolicPatchStrategy(), d_object_name(object_name), d_grid_geometry(grid_geom), - d_density(new pdat::CellVariable("density", 1)), - d_velocity(new pdat::CellVariable("velocity", NDIM)), - d_pressure(new pdat::CellVariable("pressure", 1)), - d_flux(new pdat::FaceVariable("flux", NEQU)), - d_gamma(1.4) // specific heat ratio for ideal diatomic gas (e.g., air) + d_dim(dim), + d_use_nonuniform_workload(false), + d_density(new pdat::CellVariable(dim, "density", 1)), + d_velocity(new pdat::CellVariable( + dim, "velocity", d_dim.getValue())), + d_pressure(new pdat::CellVariable(dim, "pressure", 1)), + d_flux(new pdat::FaceVariable(dim, "flux", NEQU)), + d_gamma(1.4), + // specific heat ratio for ideal diatomic gas (e.g., air) + d_riemann_solve("APPROX_RIEM_SOLVE"), + d_godunov_order(1), + d_corner_transport("CORNER_TRANSPORT_1"), + d_nghosts(hier::IntVector(dim, CELLG)), + d_fluxghosts(hier::IntVector(dim, FLUXG)), + d_radius(tbox::MathUtilities::getSignalingNaN()), + d_density_inside(tbox::MathUtilities::getSignalingNaN()), + d_pressure_inside(tbox::MathUtilities::getSignalingNaN()), + d_density_outside(tbox::MathUtilities::getSignalingNaN()), + d_pressure_outside(tbox::MathUtilities::getSignalingNaN()), + d_number_of_intervals(0) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); TBOX_ASSERT(grid_geom); -#endif tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); @@ -160,114 +171,93 @@ Euler::Euler( getTimer("apps::Euler::tagGradientDetectorCells()"); } - d_use_nonuniform_workload = false; - - /* - * Default parameters for numerical methods - */ - - d_riemann_solve = "APPROX_RIEM_SOLVE"; - d_godunov_order = 1; - d_corner_transport = "CORNER_TRANSPORT_1"; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif - d_nghosts = hier::IntVector(CELLG); - d_fluxghosts = hier::IntVector(FLUXG); /* * Defaults for problem type and initial data */ - d_radius = tbox::MathUtilities::getSignalingNaN(); - tbox::MathUtilities::setArrayToSignalingNaN(d_center, NDIM); - d_density_inside = tbox::MathUtilities::getSignalingNaN(); - tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_inside, NDIM); - d_pressure_inside = tbox::MathUtilities::getSignalingNaN(); - d_density_outside = tbox::MathUtilities::getSignalingNaN(); - tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_outside, NDIM); - d_pressure_outside = tbox::MathUtilities::getSignalingNaN(); - - d_number_of_intervals = 0; - d_front_position.resizeArray(0); - d_interval_density.resizeArray(0); - d_interval_velocity.resizeArray(0); - d_interval_pressure.resizeArray(0); + tbox::MathUtilities::setArrayToSignalingNaN(d_center, + d_dim.getValue()); + tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_inside, + d_dim.getValue()); + tbox::MathUtilities::setArrayToSignalingNaN(d_velocity_outside, + d_dim.getValue()); /* * Defaults for boundary conditions. Set to bogus values * for error checking. */ -#if (NDIM == 2) - d_master_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { - d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - } + if (d_dim == tbox::Dimension(2)) { + d_master_bdry_edge_conds.resize(NUM_2D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { + d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + } - d_master_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_master_bdry_node_conds.resize(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_vector_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { - d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; - } + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { + d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; + } - d_bdry_edge_density.resizeArray(NUM_2D_EDGES); - d_bdry_edge_velocity.resizeArray(NUM_2D_EDGES * NDIM); - d_bdry_edge_pressure.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_density); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_velocity); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_pressure); -#endif -#if (NDIM == 3) - d_master_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - d_vector_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { - d_master_bdry_face_conds[fi] = BOGUS_BDRY_DATA; - d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; - d_vector_bdry_face_conds[fi] = BOGUS_BDRY_DATA; + d_bdry_edge_density.resize(NUM_2D_EDGES); + d_bdry_edge_velocity.resize(NUM_2D_EDGES * d_dim.getValue()); + d_bdry_edge_pressure.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_density); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_velocity); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_pressure); } + if (d_dim == tbox::Dimension(3)) { + d_master_bdry_face_conds.resize(NUM_3D_FACES); + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + d_vector_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { + d_master_bdry_face_conds[fi] = BOGUS_BDRY_DATA; + d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; + d_vector_bdry_face_conds[fi] = BOGUS_BDRY_DATA; + } - d_master_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_vector_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { - d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; - } + d_master_bdry_edge_conds.resize(NUM_3D_EDGES); + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_vector_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { + d_master_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + d_vector_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; + d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; + } - d_master_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_vector_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_master_bdry_node_conds.resize(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_vector_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { - d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_node_bdry_face[ni] = BOGUS_BDRY_DATA; - } + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { + d_master_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_vector_bdry_node_conds[ni] = BOGUS_BDRY_DATA; + d_node_bdry_face[ni] = BOGUS_BDRY_DATA; + } - d_bdry_face_density.resizeArray(NUM_3D_FACES); - d_bdry_face_velocity.resizeArray(NUM_3D_FACES * NDIM); - d_bdry_face_pressure.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_density); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_velocity); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_pressure); -#endif + d_bdry_face_density.resize(NUM_3D_FACES); + d_bdry_face_velocity.resize(NUM_3D_FACES * d_dim.getValue()); + d_bdry_face_pressure.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_density); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_velocity); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_pressure); + } /* * Initialize object with data read from given input/restart databases. @@ -317,89 +307,89 @@ Euler::Euler( /* * Postprocess boundary data from input/restart values. */ -#if (NDIM == 2) - for (int i = 0; i < NUM_2D_EDGES; i++) { - d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; - d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; + if (d_dim == tbox::Dimension(2)) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { + d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; + d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; - if (d_master_bdry_edge_conds[i] == REFLECT_BC) { - d_scalar_bdry_edge_conds[i] = FLOW_BC; + if (d_master_bdry_edge_conds[i] == BdryCond::REFLECT) { + d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; + } } - } - for (int i = 0; i < NUM_2D_NODES; i++) { - d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; - d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; + for (int i = 0; i < NUM_2D_NODES; ++i) { + d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; + d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; - if (d_master_bdry_node_conds[i] == XREFLECT_BC) { - d_scalar_bdry_node_conds[i] = XFLOW_BC; - } - if (d_master_bdry_node_conds[i] == YREFLECT_BC) { - d_scalar_bdry_node_conds[i] = YFLOW_BC; - } + if (d_master_bdry_node_conds[i] == BdryCond::XREFLECT) { + d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; + } + if (d_master_bdry_node_conds[i] == BdryCond::YREFLECT) { + d_scalar_bdry_node_conds[i] = BdryCond::YFLOW; + } - if (d_master_bdry_node_conds[i] != BOGUS_BDRY_DATA) { - d_node_bdry_edge[i] = - appu::CartesianBoundaryUtilities2::getEdgeLocationForNodeBdry( - i, d_master_bdry_node_conds[i]); + if (d_master_bdry_node_conds[i] != BOGUS_BDRY_DATA) { + d_node_bdry_edge[i] = + appu::CartesianBoundaryUtilities2::getEdgeLocationForNodeBdry( + i, d_master_bdry_node_conds[i]); + } } } -#endif -#if (NDIM == 3) - for (int i = 0; i < NUM_3D_FACES; i++) { - d_scalar_bdry_face_conds[i] = d_master_bdry_face_conds[i]; - d_vector_bdry_face_conds[i] = d_master_bdry_face_conds[i]; + if (d_dim == tbox::Dimension(3)) { + for (int i = 0; i < NUM_3D_FACES; ++i) { + d_scalar_bdry_face_conds[i] = d_master_bdry_face_conds[i]; + d_vector_bdry_face_conds[i] = d_master_bdry_face_conds[i]; - if (d_master_bdry_face_conds[i] == REFLECT_BC) { - d_scalar_bdry_face_conds[i] = FLOW_BC; + if (d_master_bdry_face_conds[i] == BdryCond::REFLECT) { + d_scalar_bdry_face_conds[i] = BdryCond::FLOW; + } } - } - for (int i = 0; i < NUM_3D_EDGES; i++) { - d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; - d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; + for (int i = 0; i < NUM_3D_EDGES; ++i) { + d_scalar_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; + d_vector_bdry_edge_conds[i] = d_master_bdry_edge_conds[i]; - if (d_master_bdry_edge_conds[i] == XREFLECT_BC) { - d_scalar_bdry_edge_conds[i] = XFLOW_BC; - } - if (d_master_bdry_edge_conds[i] == YREFLECT_BC) { - d_scalar_bdry_edge_conds[i] = YFLOW_BC; - } - if (d_master_bdry_edge_conds[i] == ZREFLECT_BC) { - d_scalar_bdry_edge_conds[i] = ZFLOW_BC; - } + if (d_master_bdry_edge_conds[i] == BdryCond::XREFLECT) { + d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; + } + if (d_master_bdry_edge_conds[i] == BdryCond::YREFLECT) { + d_scalar_bdry_edge_conds[i] = BdryCond::YFLOW; + } + if (d_master_bdry_edge_conds[i] == BdryCond::ZREFLECT) { + d_scalar_bdry_edge_conds[i] = BdryCond::ZFLOW; + } - if (d_master_bdry_edge_conds[i] != BOGUS_BDRY_DATA) { - d_edge_bdry_face[i] = - appu::CartesianBoundaryUtilities3::getFaceLocationForEdgeBdry( - i, d_master_bdry_edge_conds[i]); + if (d_master_bdry_edge_conds[i] != BOGUS_BDRY_DATA) { + d_edge_bdry_face[i] = + appu::CartesianBoundaryUtilities3::getFaceLocationForEdgeBdry( + i, d_master_bdry_edge_conds[i]); + } } - } - for (int i = 0; i < NUM_3D_NODES; i++) { - d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; - d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; + for (int i = 0; i < NUM_3D_NODES; ++i) { + d_scalar_bdry_node_conds[i] = d_master_bdry_node_conds[i]; + d_vector_bdry_node_conds[i] = d_master_bdry_node_conds[i]; - if (d_master_bdry_node_conds[i] == XREFLECT_BC) { - d_scalar_bdry_node_conds[i] = XFLOW_BC; - } - if (d_master_bdry_node_conds[i] == YREFLECT_BC) { - d_scalar_bdry_node_conds[i] = YFLOW_BC; - } - if (d_master_bdry_node_conds[i] == ZREFLECT_BC) { - d_scalar_bdry_node_conds[i] = ZFLOW_BC; - } + if (d_master_bdry_node_conds[i] == BdryCond::XREFLECT) { + d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; + } + if (d_master_bdry_node_conds[i] == BdryCond::YREFLECT) { + d_scalar_bdry_node_conds[i] = BdryCond::YFLOW; + } + if (d_master_bdry_node_conds[i] == BdryCond::ZREFLECT) { + d_scalar_bdry_node_conds[i] = BdryCond::ZFLOW; + } - if (d_master_bdry_node_conds[i] != BOGUS_BDRY_DATA) { - d_node_bdry_face[i] = - appu::CartesianBoundaryUtilities3::getFaceLocationForNodeBdry( - i, d_master_bdry_node_conds[i]); + if (d_master_bdry_node_conds[i] != BOGUS_BDRY_DATA) { + d_node_bdry_face[i] = + appu::CartesianBoundaryUtilities3::getFaceLocationForNodeBdry( + i, d_master_bdry_node_conds[i]); + } } - } -#endif + } - F77_FUNC(stufprobc, STUFPROBC) (APPROX_RIEM_SOLVE, EXACT_RIEM_SOLVE, + SAMRAI_F77_FUNC(stufprobc, STUFPROBC) (APPROX_RIEM_SOLVE, EXACT_RIEM_SOLVE, HLLC_RIEM_SOLVE, PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SPHERE, STEP, @@ -416,12 +406,12 @@ Euler::Euler( Euler::~Euler() { - t_init = NULL; - t_compute_dt = NULL; - t_compute_fluxes = NULL; - t_conservdiff = NULL; - t_setphysbcs = NULL; - t_taggradient = NULL; + t_init.reset(); + t_compute_dt.reset(); + t_compute_fluxes.reset(); + t_conservdiff.reset(); + t_setphysbcs.reset(); + t_taggradient.reset(); } /* @@ -429,8 +419,8 @@ Euler::~Euler() * * Register density, velocity, pressure (i.e., solution state variables), * and flux variables with hyperbolic integrator that manages storage - * for those quantities. Also, register plot data with the vis tool - * or Visit). * + * for those quantities. Also, register plot data with the vis tool. + * * Note that density coarsening/refining uses standard conservative * operations provided in SAMRAI library. Velocity and pressure * are not conserved. The Euler code provides operations to coarsen/ @@ -443,10 +433,8 @@ Euler::~Euler() void Euler::registerModelVariables( algs::HyperbolicLevelIntegrator* integrator) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(integrator != (algs::HyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); -#endif integrator->registerVariable(d_density, d_nghosts, algs::HyperbolicLevelIntegrator::TIME_DEP, @@ -503,7 +491,7 @@ void Euler::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING(d_object_name << ": registerModelVariables()\n" - << "Visit data writer was not registerd\n" + << "VisIt data writer was not registered\n" << "Consequently, no plot data will\n" << "be written." << endl); } @@ -525,22 +513,29 @@ void Euler::setupLoadBalancer( { NULL_USE(integrator); + const hier::IntVector& zero_vec = hier::IntVector::getZero(d_dim); + hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); + hier::PatchDataRestartManager* pdrm = + hier::PatchDataRestartManager::getManager(); if (d_use_nonuniform_workload && gridding_algorithm) { - boost::shared_ptr load_balancer( - gridding_algorithm->getLoadBalanceStrategy()); + boost::shared_ptr load_balancer( + boost::dynamic_pointer_cast( + gridding_algorithm->getLoadBalanceStrategy())); if (load_balancer) { d_workload_variable.reset( new pdat::CellVariable( + d_dim, "workload_variable", 1)); d_workload_data_id = vardb->registerVariableAndContext(d_workload_variable, - vardb->getContext("WORKLOAD")); + vardb->getContext("WORKLOAD"), + zero_vec); load_balancer->setWorkloadPatchDataIndex(d_workload_data_id); - vardb->registerPatchDataForRestart(d_workload_data_id); + pdrm->registerPatchDataForRestart(d_workload_data_id); } else { TBOX_WARNING( d_object_name << ": " @@ -579,81 +574,114 @@ void Euler::initializeDataOnPatch( if (initial_time) { const boost::shared_ptr pgeom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* xlo = pgeom->getXLower(); const double* xhi = pgeom->getXUpper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif - hier::IntVector ghost_cells = density->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS + + const hier::IntVector& ghost_cells = density->getGhostCellWidth(); + TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); -#endif const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); if (d_data_problem == "SPHERE") { - F77_FUNC(eulerinitsphere, EULERINITSPHERE) (d_data_problem_int, - dx, xlo, xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), -#if (NDIM > 2) - ifirst(2), ilast(2), -#endif - ghost_cells(0), - ghost_cells(1), -#if (NDIM > 2) - ghost_cells(2), -#endif - d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - d_density_inside, - d_velocity_inside, - d_pressure_inside, - d_density_outside, - d_velocity_outside, - d_pressure_outside, - d_center, d_radius); + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2d) (d_data_problem_int, + dx, xlo, xhi, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ghost_cells(0), + ghost_cells(1), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + d_density_inside, + d_velocity_inside, + d_pressure_inside, + d_density_outside, + d_velocity_outside, + d_pressure_outside, + d_center, d_radius); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3d) (d_data_problem_int, + dx, xlo, xhi, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ghost_cells(0), + ghost_cells(1), + ghost_cells(2), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + d_density_inside, + d_velocity_inside, + d_pressure_inside, + d_density_outside, + d_velocity_outside, + d_pressure_outside, + d_center, d_radius); + } } else { - F77_FUNC(eulerinit, EULERINIT) (d_data_problem_int, - dx, xlo, xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), -#if (NDIM > 2) - ifirst(2), ilast(2), -#endif - ghost_cells(0), - ghost_cells(1), -#if (NDIM > 2) - ghost_cells(2), -#endif - d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - d_number_of_intervals, - d_front_position.getPointer(), - d_interval_density.getPointer(), - d_interval_velocity.getPointer(), - d_interval_pressure.getPointer()); + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(eulerinit2d, EULERINIT2D) (d_data_problem_int, + dx, xlo, xhi, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ghost_cells(0), + ghost_cells(1), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + d_number_of_intervals, + &d_front_position[0], + &d_interval_density[0], + &d_interval_velocity[0], + &d_interval_pressure[0]); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(eulerinit3d, EULERINIT3D) (d_data_problem_int, + dx, xlo, xhi, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ghost_cells(0), + ghost_cells(1), + ghost_cells(2), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + d_number_of_intervals, + &d_front_position[0], + &d_interval_density[0], + &d_interval_velocity[0], + &d_interval_pressure[0]); + } } @@ -664,7 +692,9 @@ void Euler::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } @@ -691,47 +721,59 @@ double Euler::computeStableDtOnPatch( t_compute_dt->start(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); const boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); const boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); const boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif - hier::IntVector ghost_cells = density->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS + + const hier::IntVector& ghost_cells = density->getGhostCellWidth(); + TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); -#endif double stabdt = 0.; - F77_FUNC(stabledt, STABLEDT) (dx, - ifirst(0), ilast(0), - ifirst(1), ilast(1), -#if (NDIM > 2) - ifirst(2), ilast(2), -#endif - ghost_cells(0), - ghost_cells(1), -#if (NDIM > 2) - ghost_cells(2), -#endif - d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - stabdt); + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) (dx, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ghost_cells(0), + ghost_cells(1), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + stabdt); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) (dx, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ghost_cells(0), + ghost_cells(1), + ghost_cells(2), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + stabdt); + } t_compute_dt->stop(); return stabdt; @@ -741,7 +783,7 @@ double Euler::computeStableDtOnPatch( ************************************************************************* * * Compute time integral of numerical fluxes for finite difference - * at each cell face on patch. When NDIM == 3, there are two options + * at each cell face on patch. When d_dim == tbox::Dimension(3)), there are two options * for the transverse flux correction. Otherwise, there is only one. * ************************************************************************* @@ -756,201 +798,203 @@ void Euler::computeFluxesOnPatch( t_compute_fluxes->start(); -#if (NDIM == 3) - if (d_corner_transport == "CORNER_TRANSPORT_2") { - compute3DFluxesWithCornerTransport2(patch, dt); - } else { - compute3DFluxesWithCornerTransport1(patch, dt); + if (d_dim == tbox::Dimension(3)) { + if (d_corner_transport == "CORNER_TRANSPORT_2") { + compute3DFluxesWithCornerTransport2(patch, dt); + } else { + compute3DFluxesWithCornerTransport1(patch, dt); + } } -#endif - -#if (NDIM == 2) -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(CELLG == FACEG); -#endif + if (d_dim == tbox::Dimension(2)) { - const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); - const double* dx = patch_geom->getDx(); + TBOX_ASSERT(CELLG == FACEG); - hier::Box pbox = patch.getBox(); - const hier::Index ifirst = pbox.lower(); - const hier::Index ilast = pbox.upper(); + const boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + const double* dx = patch_geom->getDx(); - boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); - boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); - boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); - boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext())); + hier::Box pbox = patch.getBox(); + const hier::Index ifirst = pbox.lower(); + const hier::Index ilast = pbox.upper(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(density); - TBOX_ASSERT(velocity); - TBOX_ASSERT(pressure); - TBOX_ASSERT(flux); - TBOX_ASSERT(density->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif + boost::shared_ptr > density( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); + boost::shared_ptr > velocity( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); + boost::shared_ptr > pressure( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); + boost::shared_ptr > flux( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); - /* - * Allocate patch data for temporaries local to this routine. - */ - pdat::FaceData traced_left(pbox, NEQU, d_nghosts); - pdat::FaceData traced_right(pbox, NEQU, d_nghosts); - pdat::CellData sound_speed(pbox, 1, d_nghosts); + TBOX_ASSERT(density); + TBOX_ASSERT(velocity); + TBOX_ASSERT(pressure); + TBOX_ASSERT(flux); + TBOX_ASSERT(density->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); - /* - * Initialize traced states (w^R and w^L) with proper cell-centered values. - */ - F77_FUNC(inittraceflux, INITTRACEFLUX) (ifirst(0), ilast(0), - ifirst(1), ilast(1), - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - traced_left.getPointer(0), - traced_left.getPointer(1), - traced_right.getPointer(0), - traced_right.getPointer(1), - flux->getPointer(0), - flux->getPointer(1)); + /* + * Allocate patch data for temporaries local to this routine. + */ + pdat::FaceData traced_left(pbox, NEQU, d_nghosts); + pdat::FaceData traced_right(pbox, NEQU, d_nghosts); + pdat::CellData sound_speed(pbox, 1, d_nghosts); - /* - * If Godunov method requires slopes with order greater than one, perform - * characteristic tracing to compute higher-order slopes. - */ - if (d_godunov_order > 1) { + /* + * Initialize traced states (w^R and w^L) with proper cell-centered values. + */ + SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + traced_left.getPointer(0), + traced_left.getPointer(1), + traced_right.getPointer(0), + traced_right.getPointer(1), + flux->getPointer(0), + flux->getPointer(1)); /* - * Prepare temporary data for characteristic tracing. + * If Godunov method requires slopes with order greater than one, perform + * characteristic tracing to compute higher-order slopes. */ - int Mcells = 0; - for (int k = 0; k < NDIM; k++) { - Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); - } + if (d_godunov_order > 1) { - // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + /* + * Prepare temporary data for characteristic tracing. + */ + int Mcells = 0; + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { + Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); + } - // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + // Face-centered temporary arrays + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + + // Cell-centered temporary arrays + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); + + /* + * Compute local sound speed in each computational cell. + */ + SAMRAI_F77_FUNC(computesound2d, COMPUTESOUND2D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + sound_speed.getPointer()); + + /* + * Apply characteristic tracing to compute initial estimate of + * traces w^L and w^R at faces. + * Inputs: sound_speed, w^L, w^R (traced_left/right) + * Output: w^L, w^R + */ + SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + Mcells, dx[0], d_gamma, d_godunov_order, + sound_speed.getPointer(), + traced_left.getPointer(0), + traced_right.getPointer(0), + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); + + SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, + ifirst(0), ilast(0), + ifirst(1), ilast(1), + Mcells, dx[1], d_gamma, d_godunov_order, + sound_speed.getPointer(), + traced_left.getPointer(1), + traced_right.getPointer(1), + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); + + } // if (d_godunov_order > 1) ... + +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity /* - * Compute local sound speed in each computational cell. + * Compute preliminary fluxes at faces by solving approximate + * Riemann problem using the trace states computed so far. + * Inputs: P, rho, v, w^L, w^R (traced_left/right) + * Output: F (flux) */ - F77_FUNC(computesound, COMPUTESOUND) (ifirst(0), ilast(0), - ifirst(1), ilast(1), + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, + ifirst(0), ilast(0), ifirst(1), ilast(1), d_gamma, + d_riemann_solve_int, density->getPointer(), velocity->getPointer(), pressure->getPointer(), - sound_speed.getPointer()); + flux->getPointer(0), + flux->getPointer(1), + traced_left.getPointer(0), + traced_left.getPointer(1), + traced_right.getPointer(0), + traced_right.getPointer(1)); /* - * Apply characteristic tracing to compute initial estimate of - * traces w^L and w^R at faces. - * Inputs: sound_speed, w^L, w^R (traced_left/right) - * Output: w^L, w^R + * Update trace states at cell faces with transverse correction applied. + * Inputs: F (flux) + * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(chartracing0, CHARTRACING0) (dt, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - Mcells, dx[0], d_gamma, d_godunov_order, - sound_speed.getPointer(), + SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) (dt, + ifirst(0), ilast(0), ifirst(1), ilast(1), + dx, d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + flux->getPointer(0), + flux->getPointer(1), traced_left.getPointer(0), - traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); - - F77_FUNC(chartracing1, CHARTRACING1) (dt, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - Mcells, dx[1], d_gamma, d_godunov_order, - sound_speed.getPointer(), traced_left.getPointer(1), - traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); - - } // if (d_godunov_order > 1) ... - -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity - - /* - * Compute preliminary fluxes at faces by solving approximate - * Riemann problem using the trace states computed so far. - * Inputs: P, rho, v, w^L, w^R (traced_left/right) - * Output: F (flux) - */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 1, 0, dx, - ifirst(0), ilast(0), ifirst(1), ilast(1), - d_gamma, - d_riemann_solve_int, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - flux->getPointer(0), - flux->getPointer(1), - traced_left.getPointer(0), - traced_left.getPointer(1), - traced_right.getPointer(0), - traced_right.getPointer(1)); - - /* - * Update trace states at cell faces with transverse correction applied. - * Inputs: F (flux) - * Output: w^L, w^R (traced_left/right) - */ - F77_FUNC(fluxcorrec, FLUXCORREC) (dt, - ifirst(0), ilast(0), ifirst(1), ilast(1), - dx, d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - flux->getPointer(0), - flux->getPointer(1), - traced_left.getPointer(0), - traced_left.getPointer(1), - traced_right.getPointer(0), - traced_right.getPointer(1)); + traced_right.getPointer(0), + traced_right.getPointer(1)); - boundaryReset(patch, traced_left, traced_right); + boundaryReset(patch, traced_left, traced_right); - /* - * Re-compute fluxes with updated trace states. - * Inputs: w^L, w^R (traced_left/right) - * Output: F (flux) - */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 0, 0, dx, - ifirst(0), ilast(0), ifirst(1), ilast(1), - d_gamma, - d_riemann_solve_int, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer(), - flux->getPointer(0), - flux->getPointer(1), - traced_left.getPointer(0), - traced_left.getPointer(1), - traced_right.getPointer(0), - traced_right.getPointer(1)); + /* + * Re-compute fluxes with updated trace states. + * Inputs: w^L, w^R (traced_left/right) + * Output: F (flux) + */ + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, + ifirst(0), ilast(0), ifirst(1), ilast(1), + d_gamma, + d_riemann_solve_int, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer(), + flux->getPointer(0), + flux->getPointer(1), + traced_left.getPointer(0), + traced_left.getPointer(1), + traced_right.getPointer(0), + traced_right.getPointer(1)); -#endif + } t_compute_fluxes->stop(); } @@ -965,17 +1009,16 @@ void Euler::computeFluxesOnPatch( ************************************************************************* */ -#if (NDIM == 3) void Euler::compute3DFluxesWithCornerTransport1( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -983,15 +1026,18 @@ void Euler::compute3DFluxesWithCornerTransport1( const hier::Index ilast = pbox.upper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -1000,7 +1046,6 @@ void Euler::compute3DFluxesWithCornerTransport1( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1015,7 +1060,7 @@ void Euler::compute3DFluxesWithCornerTransport1( /* * Initialize traced states (w^R and w^L) with proper cell-centered values. */ - F77_FUNC(inittraceflux, INITTRACEFLUX) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), density->getPointer(), @@ -1041,23 +1086,23 @@ void Euler::compute3DFluxesWithCornerTransport1( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < NDIM; k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); /* * Compute local sound speed in each computational cell. */ - F77_FUNC(computesound, COMPUTESOUND) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, @@ -1072,7 +1117,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: sound_speed, w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing0, CHARTRACING0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1080,13 +1125,13 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing1, CHARTRACING1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1094,13 +1139,13 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing2, CHARTRACING2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1108,11 +1153,11 @@ void Euler::compute3DFluxesWithCornerTransport1( sound_speed.getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... @@ -1122,9 +1167,9 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, w^L, w^R (traced_left/right) * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 1, 0, 0, dx, +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1148,7 +1193,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), P, rho, v, w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, 1, density->getPointer(), @@ -1178,7 +1223,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, temp_traced_left/right * Output: temp_flux */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 0, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1201,7 +1246,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), P, rho, v, w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, -1, density->getPointer(), @@ -1234,7 +1279,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: P, rho, v, temp_traced_left/right * Output: flux */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1257,7 +1302,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: temp_flux, flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, + SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_gamma, density->getPointer(), @@ -1281,7 +1326,7 @@ void Euler::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1298,7 +1343,6 @@ void Euler::compute3DFluxesWithCornerTransport1( traced_right.getPointer(1), traced_right.getPointer(2)); } -#endif /* ************************************************************************* @@ -1311,17 +1355,16 @@ void Euler::compute3DFluxesWithCornerTransport1( ************************************************************************* */ -#if (NDIM == 3) void Euler::compute3DFluxesWithCornerTransport2( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1329,15 +1372,18 @@ void Euler::compute3DFluxesWithCornerTransport2( const hier::Index ilast = pbox.upper(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); @@ -1346,7 +1392,6 @@ void Euler::compute3DFluxesWithCornerTransport2( TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1360,7 +1405,7 @@ void Euler::compute3DFluxesWithCornerTransport2( /* * Initialize traced states (w^R and w^L) with proper cell-centered values. */ - F77_FUNC(inittraceflux, INITTRACEFLUX) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), density->getPointer(), @@ -1382,9 +1427,9 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: P, rho, v, w^L, w^R (traced_left/right) * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 1, 1, 0, dx, +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1411,23 +1456,23 @@ void Euler::compute3DFluxesWithCornerTransport2( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < NDIM; k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttraclft((2 * FACEG + 1 + Mcells) * NEQU); - tbox::Array ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttedgslp((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttraclft((2 * FACEG + 1 + Mcells) * NEQU); + std::vector ttracrgt((2 * FACEG + 1 + Mcells) * NEQU); // Cell-centered temporary arrays - tbox::Array ttsound((2 * CELLG + Mcells)); - tbox::Array ttcelslp((2 * CELLG + Mcells) * NEQU); + std::vector ttsound((2 * CELLG + Mcells)); + std::vector ttcelslp((2 * CELLG + Mcells) * NEQU); /* * Compute local sound speed in each computational cell. */ - F77_FUNC(computesound, COMPUTESOUND) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, @@ -1441,7 +1486,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: sound_speed, w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing0, CHARTRACING0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1449,13 +1494,13 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing1, CHARTRACING1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1463,13 +1508,13 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing2, CHARTRACING2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1477,15 +1522,15 @@ void Euler::compute3DFluxesWithCornerTransport2( sound_speed.getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttsound.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttsound[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... - for (int idir = 0; idir < NDIM; idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { /* * Approximate traces at cell centers (in idir direction); @@ -1493,7 +1538,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: F (flux), rho, v, P * Output: third_state */ - F77_FUNC(onethirdstate, ONETHIRDSTATE) (dt, dx, idir, + SAMRAI_F77_FUNC(onethirdstate, ONETHIRDSTATE) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, density->getPointer(), @@ -1510,7 +1555,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: third_state, rho, v, P * Output: temp_flux (only directions other than idir are modified) */ - F77_FUNC(fluxthird, FLUXTHIRD) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxthird, FLUXTHIRD) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1528,7 +1573,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: temp_flux, rho, v, P * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrecjt, FLUXCORRECJT) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxcorrecjt, FLUXCORRECJT) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, density->getPointer(), @@ -1553,7 +1598,7 @@ void Euler::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation, FLUXCALCULATION) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_gamma, d_riemann_solve_int, @@ -1571,7 +1616,6 @@ void Euler::compute3DFluxesWithCornerTransport2( traced_right.getPointer(2)); } -#endif /* ************************************************************************* @@ -1598,7 +1642,9 @@ void Euler::conservativeDifferenceOnPatch( t_conservdiff->start(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1606,45 +1652,47 @@ void Euler::conservativeDifferenceOnPatch( const hier::Index ilast = pbox.upper(); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); - TBOX_ASSERT(flux); - TBOX_ASSERT(density->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); - TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif - -#if (NDIM == 2) - F77_FUNC(consdiff, CONSDIFF) (ifirst(0), ilast(0), ifirst(1), ilast(1), dx, - flux->getPointer(0), - flux->getPointer(1), - d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer()); -#endif -#if (NDIM == 3) - F77_FUNC(consdiff, CONSDIFF) (ifirst(0), ilast(0), ifirst(1), ilast(1), - ifirst(2), ilast(2), dx, - flux->getPointer(0), - flux->getPointer(1), - flux->getPointer(2), - d_gamma, - density->getPointer(), - velocity->getPointer(), - pressure->getPointer()); -#endif + TBOX_ASSERT(flux); + TBOX_ASSERT(density->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(velocity->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(pressure->getGhostCellWidth() == d_nghosts); + TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); + + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + dx, + flux->getPointer(0), + flux->getPointer(1), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer()); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + ifirst(2), ilast(2), dx, + flux->getPointer(0), + flux->getPointer(1), + flux->getPointer(2), + d_gamma, + density->getPointer(), + velocity->getPointer(), + pressure->getPointer()); + } t_conservdiff->stop(); @@ -1667,49 +1715,53 @@ void Euler::boundaryReset( { const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); - int i, idir; + int idir; bool bdry_cell = true; const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); - hier::BoxList domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + hier::BoxContainer domain_boxes; + d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); const double* dx = patch_geom->getDx(); const double* xpatchhi = patch_geom->getXUpper(); const double* xdomainhi = d_grid_geometry->getXUpper(); - pdat::CellIndex icell = ifirst; - hier::BoxList bdrybox(2 * NDIM); + pdat::CellIndex icell(ifirst); + hier::BoxContainer bdrybox; hier::Index ibfirst = ifirst; hier::Index iblast = ilast; - int bdry_case; + int bdry_case = 0; - for (idir = 0; idir < NDIM; idir++) { + for (idir = 0; idir < d_dim.getValue(); ++idir) { ibfirst(idir) = ifirst(idir) - 1; iblast(idir) = ifirst(idir) - 1; - bdrybox.appendItem(hier::Box(ibfirst, iblast)); + bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); ibfirst(idir) = ilast(idir) + 1; iblast(idir) = ilast(idir) + 1; - bdrybox.appendItem(hier::Box(ibfirst, iblast)); + bdrybox.pushBack(hier::Box(ibfirst, iblast, hier::BlockId(0))); } - hier::BoxList::Iterator bdryboxitr(bdrybox); - for (idir = 0; idir < NDIM; idir++) { + hier::BoxContainer::iterator ib = bdrybox.begin(); + for (idir = 0; idir < d_dim.getValue(); ++idir) { int bside = 2 * idir; -#if (NDIM == 2) - bdry_case = d_master_bdry_edge_conds[bside]; -#endif -#if (NDIM == 3) - bdry_case = d_master_bdry_face_conds[bside]; -#endif - if (bdry_case == REFLECT_BC) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxList::Iterator domain_boxes_itr(domain_boxes); - domain_boxes_itr; - domain_boxes_itr++) { - if (domain_boxes_itr().contains(*ic)) + if (d_dim == tbox::Dimension(2)) { + bdry_case = d_master_bdry_edge_conds[bside]; + } + if (d_dim == tbox::Dimension(3)) { + bdry_case = d_master_bdry_face_conds[bside]; + } + if (bdry_case == BdryCond::REFLECT) { + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); + domain_boxes_itr != domain_boxes.end(); + ++domain_boxes_itr) { + if (domain_boxes_itr->contains(*ic)) bdry_cell = false; } if (bdry_cell) { @@ -1718,28 +1770,30 @@ void Euler::boundaryReset( } } } - bdryboxitr++; + ++ib; int bnode = 2 * idir + 1; -#if (NDIM == 2) - bdry_case = d_master_bdry_edge_conds[bnode]; -#endif -#if (NDIM == 3) - bdry_case = d_master_bdry_face_conds[bnode]; -#endif + if (d_dim == tbox::Dimension(2)) { + bdry_case = d_master_bdry_edge_conds[bnode]; + } + if (d_dim == tbox::Dimension(3)) { + bdry_case = d_master_bdry_face_conds[bnode]; + } // BEGIN SIMPLE-MINDED FIX FOR STEP PROBLEM if ((d_data_problem == "STEP") && (bnode == 1) && (tbox::MathUtilities::Abs(xpatchhi[0] - xdomainhi[0]) < dx[0])) { - bdry_case = FLOW_BC; + bdry_case = BdryCond::FLOW; } // END SIMPLE-MINDED FIX FOR STEP PROBLEM - if (bdry_case == REFLECT_BC) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxList::Iterator domain_boxes_itr(domain_boxes); - domain_boxes_itr; - domain_boxes_itr++) { - if (domain_boxes_itr().contains(*ic)) + if (bdry_case == BdryCond::REFLECT) { + pdat::CellIterator icend(pdat::CellGeometry::end(*ib)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(*ib)); + ic != icend; ++ic) { + for (hier::BoxContainer::iterator domain_boxes_itr = + domain_boxes.begin(); + domain_boxes_itr != domain_boxes.end(); + ++domain_boxes_itr) { + if (domain_boxes_itr->contains(*ic)) bdry_cell = false; } if (bdry_cell) { @@ -1748,7 +1802,7 @@ void Euler::boundaryReset( } } } - bdryboxitr++; + ++ib; } } @@ -1761,33 +1815,39 @@ void Euler::boundaryReset( ************************************************************************* */ -hier::IntVector Euler::getRefineOpStencilWidth() const +hier::IntVector Euler::getRefineOpStencilWidth( + const tbox::Dimension& dim) const { - return hier::IntVector(1); + return hier::IntVector(dim, 1); } void Euler::postprocessRefine( hier::Patch& fine, const hier::Patch& coarse, const hier::Box& fine_box, - const hier::IntVector& ratio) + const hier::IntVector& ratio) { boost::shared_ptr > cdensity( - coarse.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_density, getDataContext()))); boost::shared_ptr > cvelocity( - coarse.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > cpressure( - coarse.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > fdensity( - fine.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_density, getDataContext()))); boost::shared_ptr > fvelocity( - fine.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > fpressure( - fine.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cdensity); TBOX_ASSERT(cvelocity); TBOX_ASSERT(cpressure); @@ -1795,7 +1855,8 @@ void Euler::postprocessRefine( TBOX_ASSERT(fvelocity); TBOX_ASSERT(fpressure); - hier::IntVector gccheck = cdensity->getGhostCellWidth(); +#ifdef DEBUG_CHECK_ASSERTIONS + hier::IntVector gccheck = cdensity->getGhostCellWidth(); TBOX_ASSERT(cvelocity->getGhostCellWidth() == gccheck); TBOX_ASSERT(cpressure->getGhostCellWidth() == gccheck); @@ -1812,9 +1873,13 @@ void Euler::postprocessRefine( const hier::Index fihi = fdensity->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry()); + BOOST_CAST( + coarse.getPatchGeometry())); const boost::shared_ptr fgeom( - fine.getPatchGeometry()); + BOOST_CAST( + fine.getPatchGeometry())); + TBOX_ASSERT(cgeom); + TBOX_ASSERT(fgeom); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); const hier::Index ifirstc = coarse_box.lower(); @@ -1822,10 +1887,10 @@ void Euler::postprocessRefine( const hier::Index ifirstf = fine_box.lower(); const hier::Index ilastf = fine_box.upper(); - const hier::IntVector cons_ghosts(1); + const hier::IntVector cons_ghosts(d_dim, 1); pdat::CellData conserved(coarse_box, 1, cons_ghosts); - const hier::IntVector tmp_ghosts(0); + const hier::IntVector tmp_ghosts(d_dim, 0); double* diff0 = new double[coarse_box.numberCells(0) + 1]; pdat::CellData slope0(coarse_box, 1, tmp_ghosts); @@ -1833,97 +1898,101 @@ void Euler::postprocessRefine( double* diff1 = new double[coarse_box.numberCells(1) + 1]; pdat::CellData slope1(coarse_box, 1, tmp_ghosts); -#if (NDIM == 3) - double* diff2 = new double[coarse_box.numberCells(2) + 1]; + double* diff2 = d_dim == + tbox::Dimension(3) ? new double[coarse_box.numberCells(2) + 1] : 0; pdat::CellData slope2(coarse_box, 1, tmp_ghosts); -#endif -#if (NDIM == 2) - pdat::CellData flat0(coarse_box, 1, tmp_ghosts); - pdat::CellData flat1(coarse_box, 1, tmp_ghosts); - int mc = cihi(0) - cilo(0) + 1; - mc = tbox::MathUtilities::Max(mc, cihi(1) - cilo(1) + 1); - double* tflat = new double[mc]; - double* tflat2 = new double[mc]; - double* tsound = new double[mc]; - double* tdensc = new double[mc]; - double* tpresc = new double[mc]; - double* tvelc = new double[mc]; - F77_FUNC(conservlinint2d, CONSERVLININT2D) (ifirstc(0), ifirstc(1), ilastc(0), - ilastc(1), /* input */ - ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), - cilo(0), cilo(1), cihi(0), cihi(1), - filo(0), filo(1), fihi(0), fihi(1), - ratio, - cgeom->getDx(), - fgeom->getDx(), - d_gamma, - cdensity->getPointer(), - fdensity->getPointer(), - cvelocity->getPointer(), - cpressure->getPointer(), - fvelocity->getPointer(), /* output */ - fpressure->getPointer(), - conserved.getPointer(), /* temporaries */ - tflat, tflat2, tsound, mc, - tdensc, tpresc, tvelc, - flat0.getPointer(), - flat1.getPointer(), - diff0, slope0.getPointer(), - diff1, slope1.getPointer()); -#endif -#if (NDIM == 3) - pdat::CellData flat0(coarse_box, 1, tmp_ghosts); - pdat::CellData flat1(coarse_box, 1, tmp_ghosts); - pdat::CellData flat2(coarse_box, 1, tmp_ghosts); - int mc = cihi(0) - cilo(0) + 1; - mc = tbox::MathUtilities::Max(mc, cihi(1) - cilo(1) + 1); - mc = tbox::MathUtilities::Max(mc, cihi(2) - cilo(2) + 1); - double* tflat = new double[mc]; - double* tflat2 = new double[mc]; - double* tsound = new double[mc]; - double* tdensc = new double[mc]; - double* tpresc = new double[mc]; - double* tvelc = new double[mc]; - F77_FUNC(conservlinint3d, CONSERVLININT3D) (ifirstc(0), ifirstc(1), - ifirstc(2), /* input */ - ilastc(0), ilastc(1), ilastc(2), - ifirstf(0), ifirstf(1), ifirstf(2), - ilastf(0), ilastf(1), ilastf(2), - cilo(0), cilo(1), cilo(2), cihi(0), cihi(1), cihi(2), - filo(0), filo(1), filo(2), fihi(0), fihi(1), fihi(2), - ratio, - cgeom->getDx(), - fgeom->getDx(), - d_gamma, - cdensity->getPointer(), - fdensity->getPointer(), - cvelocity->getPointer(), - cpressure->getPointer(), - fvelocity->getPointer(), /* output */ - fpressure->getPointer(), - conserved.getPointer(), /* temporaries */ - tflat, tflat2, tsound, mc, - tdensc, tpresc, tvelc, - flat0.getPointer(), - flat1.getPointer(), - flat2.getPointer(), - diff0, slope0.getPointer(), - diff1, slope1.getPointer(), - diff2, slope2.getPointer()); -#endif - delete[] tflat; - delete[] tflat2; - delete[] tsound; - delete[] tdensc; - delete[] tpresc; - delete[] tvelc; + if (d_dim == tbox::Dimension(2)) { + pdat::CellData flat0(coarse_box, 1, tmp_ghosts); + pdat::CellData flat1(coarse_box, 1, tmp_ghosts); + int mc = cihi(0) - cilo(0) + 1; + mc = tbox::MathUtilities::Max(mc, cihi(1) - cilo(1) + 1); + double* tflat = new double[mc]; + double* tflat2 = new double[mc]; + double* tsound = new double[mc]; + double* tdensc = new double[mc]; + double* tpresc = new double[mc]; + double* tvelc = new double[mc]; + SAMRAI_F77_FUNC(conservlinint2d, CONSERVLININT2D) (ifirstc(0), ifirstc(1), + ilastc(0), ilastc(1), /* input */ + ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), + cilo(0), cilo(1), cihi(0), cihi(1), + filo(0), filo(1), fihi(0), fihi(1), + &ratio[0], + cgeom->getDx(), + fgeom->getDx(), + d_gamma, + cdensity->getPointer(), + fdensity->getPointer(), + cvelocity->getPointer(), + cpressure->getPointer(), + fvelocity->getPointer(), /* output */ + fpressure->getPointer(), + conserved.getPointer(), /* temporaries */ + tflat, tflat2, tsound, mc, + tdensc, tpresc, tvelc, + flat0.getPointer(), + flat1.getPointer(), + diff0, slope0.getPointer(), + diff1, slope1.getPointer()); + delete[] tflat; + delete[] tflat2; + delete[] tsound; + delete[] tdensc; + delete[] tpresc; + delete[] tvelc; + } else if (d_dim == tbox::Dimension(3)) { + pdat::CellData flat0(coarse_box, 1, tmp_ghosts); + pdat::CellData flat1(coarse_box, 1, tmp_ghosts); + pdat::CellData flat2(coarse_box, 1, tmp_ghosts); + int mc = cihi(0) - cilo(0) + 1; + mc = tbox::MathUtilities::Max(mc, cihi(1) - cilo(1) + 1); + mc = tbox::MathUtilities::Max(mc, cihi(2) - cilo(2) + 1); + double* tflat = new double[mc]; + double* tflat2 = new double[mc]; + double* tsound = new double[mc]; + double* tdensc = new double[mc]; + double* tpresc = new double[mc]; + double* tvelc = new double[mc]; + SAMRAI_F77_FUNC(conservlinint3d, CONSERVLININT3D) (ifirstc(0), ifirstc(1), + ifirstc(2), /* input */ + ilastc(0), ilastc(1), ilastc(2), + ifirstf(0), ifirstf(1), ifirstf(2), + ilastf(0), ilastf(1), ilastf(2), + cilo(0), cilo(1), cilo(2), cihi(0), cihi(1), cihi(2), + filo(0), filo(1), filo(2), fihi(0), fihi(1), fihi(2), + &ratio[0], + cgeom->getDx(), + fgeom->getDx(), + d_gamma, + cdensity->getPointer(), + fdensity->getPointer(), + cvelocity->getPointer(), + cpressure->getPointer(), + fvelocity->getPointer(), /* output */ + fpressure->getPointer(), + conserved.getPointer(), /* temporaries */ + tflat, tflat2, tsound, mc, + tdensc, tpresc, tvelc, + flat0.getPointer(), + flat1.getPointer(), + flat2.getPointer(), + diff0, slope0.getPointer(), + diff1, slope1.getPointer(), + diff2, slope2.getPointer()); + delete[] tflat; + delete[] tflat2; + delete[] tsound; + delete[] tdensc; + delete[] tpresc; + delete[] tvelc; + } delete[] diff0; delete[] diff1; -#if (NDIM == 3) - delete[] diff2; -#endif + if (d_dim == tbox::Dimension(3)) { + delete[] diff2; + } } @@ -1936,32 +2005,38 @@ void Euler::postprocessRefine( ************************************************************************* */ -hier::IntVector Euler::getCoarsenOpStencilWidth() const +hier::IntVector Euler::getCoarsenOpStencilWidth( + const tbox::Dimension& dim) const { - return hier::IntVector(0); + return hier::IntVector(dim, 0); } void Euler::postprocessCoarsen( hier::Patch& coarse, const hier::Patch& fine, const hier::Box& coarse_box, - const hier::IntVector& ratio) + const hier::IntVector& ratio) { boost::shared_ptr > fdensity( - fine.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_density, getDataContext()))); boost::shared_ptr > fvelocity( - fine.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > fpressure( - fine.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(d_pressure, getDataContext()))); boost::shared_ptr > cdensity( - coarse.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_density, getDataContext()))); boost::shared_ptr > cvelocity( - coarse.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > cpressure( - coarse.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(cdensity); TBOX_ASSERT(cvelocity); TBOX_ASSERT(cpressure); @@ -1969,7 +2044,8 @@ void Euler::postprocessCoarsen( TBOX_ASSERT(fvelocity); TBOX_ASSERT(fpressure); - hier::IntVector gccheck = cdensity->getGhostCellWidth(); +#ifdef DEBUG_CHECK_ASSERTIONS + hier::IntVector gccheck = cdensity->getGhostCellWidth(); TBOX_ASSERT(cvelocity->getGhostCellWidth() == gccheck); TBOX_ASSERT(cpressure->getGhostCellWidth() == gccheck); @@ -1984,9 +2060,13 @@ void Euler::postprocessCoarsen( const hier::Index cihi = cdensity->getGhostBox().upper(); const boost::shared_ptr fgeom( - fine.getPatchGeometry()); + BOOST_CAST( + fine.getPatchGeometry())); const boost::shared_ptr cgeom( - coarse.getPatchGeometry()); + BOOST_CAST( + coarse.getPatchGeometry())); + TBOX_ASSERT(fgeom); + TBOX_ASSERT(cgeom); const hier::Box fine_box = hier::Box::refine(coarse_box, ratio); const hier::Index ifirstc = coarse_box.lower(); @@ -1994,46 +2074,45 @@ void Euler::postprocessCoarsen( const hier::Index ifirstf = fine_box.lower(); const hier::Index ilastf = fine_box.upper(); - const hier::IntVector cons_ghosts(0); + const hier::IntVector cons_ghosts(d_dim, 0); pdat::CellData conserved(fine_box, 1, cons_ghosts); -#if (NDIM == 2) - F77_FUNC(conservavg2d, CONSERVAVG2D) (ifirstf(0), ifirstf(1), ilastf(0), - ilastf(1), /* input */ - ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), - filo(0), filo(1), fihi(0), fihi(1), - cilo(0), cilo(1), cihi(0), cihi(1), - ratio, - fgeom->getDx(), - cgeom->getDx(), - d_gamma, - fdensity->getPointer(), - cdensity->getPointer(), - fvelocity->getPointer(), - fpressure->getPointer(), - cvelocity->getPointer(), /* output */ - cpressure->getPointer(), - conserved.getPointer()); /* temporary */ -#endif -#if (NDIM == 3) - F77_FUNC(conservavg3d, CONSERVAVG3D) (ifirstf(0), ifirstf(1), ifirstf(2), /* input */ - ilastf(0), ilastf(1), ilastf(2), - ifirstc(0), ifirstc(1), ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), cihi(0), cihi(1), cihi(2), - ratio, - fgeom->getDx(), - cgeom->getDx(), - d_gamma, - fdensity->getPointer(), - cdensity->getPointer(), - fvelocity->getPointer(), - fpressure->getPointer(), - cvelocity->getPointer(), /* output */ - cpressure->getPointer(), - conserved.getPointer()); -#endif + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(conservavg2d, CONSERVAVG2D) (ifirstf(0), ifirstf(1), ilastf(0), + ilastf(1), /* input */ + ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), + filo(0), filo(1), fihi(0), fihi(1), + cilo(0), cilo(1), cihi(0), cihi(1), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + d_gamma, + fdensity->getPointer(), + cdensity->getPointer(), + fvelocity->getPointer(), + fpressure->getPointer(), + cvelocity->getPointer(), /* output */ + cpressure->getPointer(), + conserved.getPointer()); /* temporary */ + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(conservavg3d, CONSERVAVG3D) (ifirstf(0), ifirstf(1), ifirstf(2), /* input */ + ilastf(0), ilastf(1), ilastf(2), + ifirstc(0), ifirstc(1), ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + filo(0), filo(1), filo(2), fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), cihi(0), cihi(1), cihi(2), + &ratio[0], + fgeom->getDx(), + cgeom->getDx(), + d_gamma, + fdensity->getPointer(), + cdensity->getPointer(), + fvelocity->getPointer(), + fpressure->getPointer(), + cvelocity->getPointer(), /* output */ + cpressure->getPointer(), + conserved.getPointer()); + } } @@ -2051,213 +2130,212 @@ void Euler::postprocessCoarsen( void Euler::setPhysicalBoundaryConditions( hier::Patch& patch, const double fill_time, - const hier::IntVector& ghost_width_to_fill) + const hier::IntVector& ghost_width_to_fill) { NULL_USE(fill_time); - t_setphysbcs->start(); boost::shared_ptr > density( - patch.getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif - hier::IntVector ghost_cells = density->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(velocity->getGhostCellWidth() == ghost_cells); - TBOX_ASSERT(pressure->getGhostCellWidth() == ghost_cells); -#endif + TBOX_ASSERT(velocity->getGhostCellWidth() == density->getGhostCellWidth()); + TBOX_ASSERT(pressure->getGhostCellWidth() == density->getGhostCellWidth()); -#if (NDIM == 2) + if (d_dim == tbox::Dimension(2)) { - /* - * Set boundary conditions for cells corresponding to patch edges. - * - * Note: We apply a simple-minded adjustment for the "STEP" problem - * so that the right edge of the domain gets (out)FLOW conditions - * whereas the right edge at the step gets REFLECT condtions (from input), - */ - tbox::Array tmp_edge_scalar_bcond(NUM_2D_EDGES); - tbox::Array tmp_edge_vector_bcond(NUM_2D_EDGES); - for (int i = 0; i < NUM_2D_EDGES; i++) { - tmp_edge_scalar_bcond[i] = d_scalar_bdry_edge_conds[i]; - tmp_edge_vector_bcond[i] = d_vector_bdry_edge_conds[i]; - } + /* + * Set boundary conditions for cells corresponding to patch edges. + * + * Note: We apply a simple-minded adjustment for the "STEP" problem + * so that the right edge of the domain gets (out)FLOW conditions + * whereas the right edge at the step gets REFLECT condtions (from input), + */ + std::vector tmp_edge_scalar_bcond(NUM_2D_EDGES); + std::vector tmp_edge_vector_bcond(NUM_2D_EDGES); + for (int i = 0; i < NUM_2D_EDGES; ++i) { + tmp_edge_scalar_bcond[i] = d_scalar_bdry_edge_conds[i]; + tmp_edge_vector_bcond[i] = d_vector_bdry_edge_conds[i]; + } - if (d_data_problem == "STEP") { + if (d_data_problem == "STEP") { - const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); - const double* dx = patch_geom->getDx(); - const double* xpatchhi = patch_geom->getXUpper(); - const double* xdomainhi = d_grid_geometry->getXUpper(); + const boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + const double* dx = patch_geom->getDx(); + const double* xpatchhi = patch_geom->getXUpper(); + const double* xdomainhi = d_grid_geometry->getXUpper(); - if (tbox::MathUtilities::Abs(xpatchhi[0] - xdomainhi[0]) < - dx[0]) { - tmp_edge_scalar_bcond[XHI] = FLOW_BC; - tmp_edge_vector_bcond[XHI] = FLOW_BC; - } + if (tbox::MathUtilities::Abs(xpatchhi[0] - xdomainhi[0]) < + dx[0]) { + tmp_edge_scalar_bcond[BdryLoc::XHI] = BdryCond::FLOW; + tmp_edge_vector_bcond[BdryLoc::XHI] = BdryCond::FLOW; + } - } + } - appu::CartesianBoundaryUtilities2:: - fillEdgeBoundaryData("density", density, - patch, - ghost_width_to_fill, - tmp_edge_scalar_bcond, - d_bdry_edge_density); - appu::CartesianBoundaryUtilities2:: - fillEdgeBoundaryData("velocity", velocity, - patch, - ghost_width_to_fill, - tmp_edge_vector_bcond, - d_bdry_edge_velocity); - appu::CartesianBoundaryUtilities2:: - fillEdgeBoundaryData("pressure", pressure, - patch, - ghost_width_to_fill, - tmp_edge_scalar_bcond, - d_bdry_edge_pressure); + appu::CartesianBoundaryUtilities2:: + fillEdgeBoundaryData("density", density, + patch, + ghost_width_to_fill, + tmp_edge_scalar_bcond, + d_bdry_edge_density); + appu::CartesianBoundaryUtilities2:: + fillEdgeBoundaryData("velocity", velocity, + patch, + ghost_width_to_fill, + tmp_edge_vector_bcond, + d_bdry_edge_velocity); + appu::CartesianBoundaryUtilities2:: + fillEdgeBoundaryData("pressure", pressure, + patch, + ghost_width_to_fill, + tmp_edge_scalar_bcond, + d_bdry_edge_pressure); #ifdef DEBUG_CHECK_ASSERTIONS #if CHECK_BDRY_DATA - checkBoundaryData(EDGE2D_BDRY_TYPE, patch, ghost_width_to_fill, - tmp_edge_scalar_bcond, tmp_edge_vector_bcond); + checkBoundaryData(Bdry::EDGE2D, patch, ghost_width_to_fill, + tmp_edge_scalar_bcond, tmp_edge_vector_bcond); #endif #endif - /* - * Set boundary conditions for cells corresponding to patch nodes. - */ + /* + * Set boundary conditions for cells corresponding to patch nodes. + */ - appu::CartesianBoundaryUtilities2:: - fillNodeBoundaryData("density", density, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_edge_density); - appu::CartesianBoundaryUtilities2:: - fillNodeBoundaryData("velocity", velocity, - patch, - ghost_width_to_fill, - d_vector_bdry_node_conds, - d_bdry_edge_velocity); - appu::CartesianBoundaryUtilities2:: - fillNodeBoundaryData("pressure", pressure, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_edge_pressure); + appu::CartesianBoundaryUtilities2:: + fillNodeBoundaryData("density", density, + patch, + ghost_width_to_fill, + d_scalar_bdry_node_conds, + d_bdry_edge_density); + appu::CartesianBoundaryUtilities2:: + fillNodeBoundaryData("velocity", velocity, + patch, + ghost_width_to_fill, + d_vector_bdry_node_conds, + d_bdry_edge_velocity); + appu::CartesianBoundaryUtilities2:: + fillNodeBoundaryData("pressure", pressure, + patch, + ghost_width_to_fill, + d_scalar_bdry_node_conds, + d_bdry_edge_pressure); #ifdef DEBUG_CHECK_ASSERTIONS #if CHECK_BDRY_DATA - checkBoundaryData(NODE2D_BDRY_TYPE, patch, ghost_width_to_fill, - d_scalar_bdry_node_conds, d_vector_bdry_node_conds); + checkBoundaryData(Bdry::NODE2D, patch, ghost_width_to_fill, + d_scalar_bdry_node_conds, d_vector_bdry_node_conds); #endif #endif -#endif // NDIM == 2 + } -#if (NDIM == 3) + if (d_dim == tbox::Dimension(3)) { - /* - * Set boundary conditions for cells corresponding to patch faces. - */ + /* + * Set boundary conditions for cells corresponding to patch faces. + */ - appu::CartesianBoundaryUtilities3:: - fillFaceBoundaryData("density", density, - patch, - ghost_width_to_fill, - d_scalar_bdry_face_conds, - d_bdry_face_density); - appu::CartesianBoundaryUtilities3:: - fillFaceBoundaryData("velocity", velocity, - patch, - ghost_width_to_fill, - d_vector_bdry_face_conds, - d_bdry_face_velocity); - appu::CartesianBoundaryUtilities3:: - fillFaceBoundaryData("pressure", pressure, - patch, - ghost_width_to_fill, - d_scalar_bdry_face_conds, - d_bdry_face_pressure); + appu::CartesianBoundaryUtilities3:: + fillFaceBoundaryData("density", density, + patch, + ghost_width_to_fill, + d_scalar_bdry_face_conds, + d_bdry_face_density); + appu::CartesianBoundaryUtilities3:: + fillFaceBoundaryData("velocity", velocity, + patch, + ghost_width_to_fill, + d_vector_bdry_face_conds, + d_bdry_face_velocity); + appu::CartesianBoundaryUtilities3:: + fillFaceBoundaryData("pressure", pressure, + patch, + ghost_width_to_fill, + d_scalar_bdry_face_conds, + d_bdry_face_pressure); #ifdef DEBUG_CHECK_ASSERTIONS #if CHECK_BDRY_DATA - checkBoundaryData(FACE3D_BDRY_TYPE, patch, ghost_width_to_fill, - d_scalar_bdry_face_conds, d_vector_bdry_face_conds); + checkBoundaryData(Bdry::FACE3D, patch, ghost_width_to_fill, + d_scalar_bdry_face_conds, d_vector_bdry_face_conds); #endif #endif - /* - * Set boundary conditions for cells corresponding to patch edges. - */ + /* + * Set boundary conditions for cells corresponding to patch edges. + */ - appu::CartesianBoundaryUtilities3:: - fillEdgeBoundaryData("density", density, - patch, - ghost_width_to_fill, - d_scalar_bdry_edge_conds, - d_bdry_face_density); - appu::CartesianBoundaryUtilities3:: - fillEdgeBoundaryData("velocity", velocity, - patch, - ghost_width_to_fill, - d_vector_bdry_edge_conds, - d_bdry_face_velocity); - appu::CartesianBoundaryUtilities3:: - fillEdgeBoundaryData("pressure", pressure, - patch, - ghost_width_to_fill, - d_scalar_bdry_edge_conds, - d_bdry_face_pressure); + appu::CartesianBoundaryUtilities3:: + fillEdgeBoundaryData("density", density, + patch, + ghost_width_to_fill, + d_scalar_bdry_edge_conds, + d_bdry_face_density); + appu::CartesianBoundaryUtilities3:: + fillEdgeBoundaryData("velocity", velocity, + patch, + ghost_width_to_fill, + d_vector_bdry_edge_conds, + d_bdry_face_velocity); + appu::CartesianBoundaryUtilities3:: + fillEdgeBoundaryData("pressure", pressure, + patch, + ghost_width_to_fill, + d_scalar_bdry_edge_conds, + d_bdry_face_pressure); #ifdef DEBUG_CHECK_ASSERTIONS #if CHECK_BDRY_DATA - checkBoundaryData(EDGE3D_BDRY_TYPE, patch, ghost_width_to_fill, - d_scalar_bdry_edge_conds, d_vector_bdry_edge_conds); + checkBoundaryData(Bdry::EDGE3D, patch, ghost_width_to_fill, + d_scalar_bdry_edge_conds, d_vector_bdry_edge_conds); #endif #endif - /* - * Set boundary conditions for cells corresponding to patch nodes. - */ + /* + * Set boundary conditions for cells corresponding to patch nodes. + */ - appu::CartesianBoundaryUtilities3:: - fillNodeBoundaryData("density", density, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_face_density); - appu::CartesianBoundaryUtilities3:: - fillNodeBoundaryData("velocity", velocity, - patch, - ghost_width_to_fill, - d_vector_bdry_node_conds, - d_bdry_face_velocity); - appu::CartesianBoundaryUtilities3:: - fillNodeBoundaryData("pressure", pressure, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_face_pressure); + appu::CartesianBoundaryUtilities3:: + fillNodeBoundaryData("density", density, + patch, + ghost_width_to_fill, + d_scalar_bdry_node_conds, + d_bdry_face_density); + appu::CartesianBoundaryUtilities3:: + fillNodeBoundaryData("velocity", velocity, + patch, + ghost_width_to_fill, + d_vector_bdry_node_conds, + d_bdry_face_velocity); + appu::CartesianBoundaryUtilities3:: + fillNodeBoundaryData("pressure", pressure, + patch, + ghost_width_to_fill, + d_scalar_bdry_node_conds, + d_bdry_face_pressure); #ifdef DEBUG_CHECK_ASSERTIONS #if CHECK_BDRY_DATA - checkBoundaryData(NODE3D_BDRY_TYPE, patch, ghost_width_to_fill, - d_scalar_bdry_node_conds, d_scalar_bdry_node_conds); + checkBoundaryData(Bdry::NODE3D, patch, ghost_width_to_fill, + d_scalar_bdry_node_conds, d_scalar_bdry_node_conds); #endif #endif -#endif // NDIM == 3 + } t_setphysbcs->stop(); } @@ -2278,28 +2356,31 @@ void Euler::tagGradientDetectorCells( const int tag_indx, const bool uses_richardson_extrapolation_too) { - NULL_USE(initial_error); - t_taggradient->start(); const int error_level_number = patch.getPatchLevelNumber(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); - boost::shared_ptr > tags(patch.getPatchData(tag_indx)); + boost::shared_ptr > tags( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); + TBOX_ASSERT(tags); hier::Box pbox = patch.getBox(); - hier::Box pboxm1 = pbox.grow(pbox, -1); - hier::BoxList domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio()); + hier::BoxContainer domain_boxes; + d_grid_geometry->computePhysicalDomain(domain_boxes, patch_geom->getRatio(), hier::BlockId::zero()); /* * Construct domain bounding box */ - hier::Box domain; - for (hier::BoxList::Iterator domain_box_itr(domain_boxes); domain_box_itr; domain_box_itr++) { - domain += *domain_box_itr; + hier::Box domain(d_dim); + for (hier::BoxContainer::iterator i = domain_boxes.begin(); + i != domain_boxes.end(); ++i) { + domain += *i; } const hier::Index domfirst = domain.lower(); @@ -2318,25 +2399,26 @@ void Euler::tagGradientDetectorCells( d_nghosts)); temp_tags->fillAll(FALSE); -#if (NDIM == 2) - /* - * Problem specific criteria for step case. - */ - if (initial_error && d_data_problem == "STEP") { - if (error_level_number < 2) { - hier::Box tagbox(hier::Index(9, 0), hier::Index(9, 3)); - if (error_level_number == 1) { - tagbox.refine(hier::IntVector(2)); - } - hier::Box ibox = pbox * tagbox; + if (d_dim == tbox::Dimension(2)) { + /* + * Problem specific criteria for step case. + */ + if (initial_error && d_data_problem == "STEP") { + if (error_level_number < 2) { + hier::Box tagbox(hier::Index(9, 0), hier::Index(9, 3), hier::BlockId(0)); + if (error_level_number == 1) { + tagbox.refine(hier::IntVector(d_dim, 2)); + } + hier::Box ibox = pbox * tagbox; - pdat::CellIterator itcend(ibox, false); - for (pdat::CellIterator itc(ibox, true); itc != itcend; ++itc) { - (*temp_tags)(*itc, 0) = TRUE; + pdat::CellIterator itcend(pdat::CellGeometry::end(ibox)); + for (pdat::CellIterator itc(pdat::CellGeometry::begin(ibox)); + itc != itcend; ++itc) { + (*temp_tags)(*itc, 0) = TRUE; + } } } } -#endif /* * Possible tagging criteria includes @@ -2348,7 +2430,8 @@ void Euler::tagGradientDetectorCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > var; @@ -2359,117 +2442,113 @@ void Euler::tagGradientDetectorCells( bool time_allowed = false; if (ref == "DENSITY_DEVIATION") { - var = patch.getPatchData(d_density, getDataContext()); - size = d_density_dev_tol.getSize(); + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_dev_tol.size()); tol = ((error_level_number < size) ? d_density_dev_tol[error_level_number] : d_density_dev_tol[size - 1]); - size = d_density_dev.getSize(); + size = static_cast(d_density_dev.size()); dev = ((error_level_number < size) ? d_density_dev[error_level_number] : d_density_dev[size - 1]); - size = d_density_dev_time_min.getSize(); + size = static_cast(d_density_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_density_dev_time_min[error_level_number] : d_density_dev_time_min[size - 1]); - size = d_density_dev_time_max.getSize(); + size = static_cast(d_density_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_density_dev_time_max[error_level_number] : d_density_dev_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "DENSITY_GRADIENT") { - var = patch.getPatchData(d_density, getDataContext()); - size = d_density_grad_tol.getSize(); + } else if (ref == "DENSITY_GRADIENT") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_grad_tol.size()); tol = ((error_level_number < size) ? d_density_grad_tol[error_level_number] : d_density_grad_tol[size - 1]); - size = d_density_grad_time_min.getSize(); + size = static_cast(d_density_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_density_grad_time_min[error_level_number] : d_density_grad_time_min[size - 1]); - size = d_density_grad_time_max.getSize(); + size = static_cast(d_density_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_density_grad_time_max[error_level_number] : d_density_grad_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "DENSITY_SHOCK") { - var = patch.getPatchData(d_density, getDataContext()); - size = d_density_shock_tol.getSize(); + } else if (ref == "DENSITY_SHOCK") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, getDataContext())); + size = static_cast(d_density_shock_tol.size()); tol = ((error_level_number < size) ? d_density_shock_tol[error_level_number] : d_density_shock_tol[size - 1]); - size = d_density_shock_onset.getSize(); + size = static_cast(d_density_shock_onset.size()); onset = ((error_level_number < size) ? d_density_shock_onset[error_level_number] : d_density_shock_onset[size - 1]); - size = d_density_shock_time_min.getSize(); + size = static_cast(d_density_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_density_shock_time_min[error_level_number] : d_density_shock_time_min[size - 1]); - size = d_density_shock_time_max.getSize(); + size = static_cast(d_density_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_density_shock_time_max[error_level_number] : d_density_shock_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_DEVIATION") { - var = patch.getPatchData(d_pressure, getDataContext()); - size = d_pressure_dev_tol.getSize(); + } else if (ref == "PRESSURE_DEVIATION") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_dev_tol.size()); tol = ((error_level_number < size) ? d_pressure_dev_tol[error_level_number] : d_pressure_dev_tol[size - 1]); - size = d_pressure_dev.getSize(); + size = static_cast(d_pressure_dev.size()); dev = ((error_level_number < size) ? d_pressure_dev[error_level_number] : d_pressure_dev[size - 1]); - size = d_pressure_dev_time_min.getSize(); + size = static_cast(d_pressure_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_dev_time_min[error_level_number] : d_pressure_dev_time_min[size - 1]); - size = d_pressure_dev_time_max.getSize(); + size = static_cast(d_pressure_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_dev_time_max[error_level_number] : d_pressure_dev_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_GRADIENT") { - var = patch.getPatchData(d_pressure, getDataContext()); - size = d_pressure_grad_tol.getSize(); + } else if (ref == "PRESSURE_GRADIENT") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_grad_tol.size()); tol = ((error_level_number < size) ? d_pressure_grad_tol[error_level_number] : d_pressure_grad_tol[size - 1]); - size = d_pressure_grad_time_min.getSize(); + size = static_cast(d_pressure_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_grad_time_min[error_level_number] : d_pressure_grad_time_min[size - 1]); - size = d_pressure_grad_time_max.getSize(); + size = static_cast(d_pressure_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_grad_time_max[error_level_number] : d_pressure_grad_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_SHOCK") { - var = patch.getPatchData(d_pressure, getDataContext()); - size = d_pressure_shock_tol.getSize(); + } else if (ref == "PRESSURE_SHOCK") { + var = BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, getDataContext())); + size = static_cast(d_pressure_shock_tol.size()); tol = ((error_level_number < size) ? d_pressure_shock_tol[error_level_number] : d_pressure_shock_tol[size - 1]); - size = d_pressure_shock_onset.getSize(); + size = static_cast(d_pressure_shock_onset.size()); onset = ((error_level_number < size) ? d_pressure_shock_onset[error_level_number] : d_pressure_shock_onset[size - 1]); - size = d_pressure_shock_time_min.getSize(); + size = static_cast(d_pressure_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_shock_time_min[error_level_number] : d_pressure_shock_time_min[size - 1]); - size = d_pressure_shock_time_max.getSize(); + size = static_cast(d_pressure_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_shock_time_max[error_level_number] : d_pressure_shock_time_max[size - 1]); @@ -2478,12 +2557,10 @@ void Euler::tagGradientDetectorCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(var); -#endif - hier::IntVector vghost = var->getGhostCellWidth(); - hier::IntVector tagghost = tags->getGhostCellWidth(); + hier::IntVector vghost = var->getGhostCellWidth(); + hier::IntVector tagghost = tags->getGhostCellWidth(); if (ref == "DENSITY_DEVIATION" || ref == "PRESSURE_DEVIATION") { @@ -2493,8 +2570,9 @@ void Euler::tagGradientDetectorCells( * RICHARDSON_NEWLY_TAGGED since these were set most recently * by Richardson extrapolation. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { double locden = tol; int tag_val = (*tags)(*ic, 0); if (tag_val) { @@ -2507,43 +2585,56 @@ void Euler::tagGradientDetectorCells( (*temp_tags)(*ic, 0) = TRUE; } } - } - - if (ref == "DENSITY_GRADIENT" || ref == "PRESSURE_GRADIENT") { - F77_FUNC(detectgrad, DETECTGRAD) (ifirst(0), ilast(0), - ifirst(1), ilast(1), -#if (NDIM > 2) - ifirst(2), ilast(2), -#endif - vghost(0), tagghost(0), d_nghosts(0), - vghost(1), tagghost(1), d_nghosts(1), -#if (NDIM > 2) - vghost(2), tagghost(2), d_nghosts(2), -#endif - dx, - tol, - TRUE, FALSE, - var->getPointer(), - tags->getPointer(), temp_tags->getPointer()); - } - - if (ref == "DENSITY_SHOCK" || ref == "PRESSURE_SHOCK") { - F77_FUNC(detectshock, DETECTSHOCK) (ifirst(0), ilast(0), - ifirst(1), ilast(1), -#if (NDIM > 2) - ifirst(2), ilast(2), -#endif - vghost(0), tagghost(0), d_nghosts(0), - vghost(1), tagghost(1), d_nghosts(1), -#if (NDIM > 2) - vghost(2), tagghost(2), d_nghosts(2), -#endif - dx, - tol, - onset, - TRUE, FALSE, - var->getPointer(), - tags->getPointer(), temp_tags->getPointer()); + } else if (ref == "DENSITY_GRADIENT" || ref == "PRESSURE_GRADIENT") { + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + vghost(0), tagghost(0), d_nghosts(0), + vghost(1), tagghost(1), d_nghosts(1), + dx, + tol, + TRUE, FALSE, + var->getPointer(), + tags->getPointer(), temp_tags->getPointer()); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + vghost(0), tagghost(0), d_nghosts(0), + vghost(1), tagghost(1), d_nghosts(1), + vghost(2), tagghost(2), d_nghosts(2), + dx, + tol, + TRUE, FALSE, + var->getPointer(), + tags->getPointer(), temp_tags->getPointer()); + } + } else if (ref == "DENSITY_SHOCK" || ref == "PRESSURE_SHOCK") { + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + vghost(0), tagghost(0), d_nghosts(0), + vghost(1), tagghost(1), d_nghosts(1), + dx, + tol, + onset, + TRUE, FALSE, + var->getPointer(), + tags->getPointer(), temp_tags->getPointer()); + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) (ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + vghost(0), tagghost(0), d_nghosts(0), + vghost(1), tagghost(1), d_nghosts(1), + vghost(2), tagghost(2), d_nghosts(2), + dx, + tol, + onset, + TRUE, FALSE, + var->getPointer(), + tags->getPointer(), temp_tags->getPointer()); + } } } // if time_allowed @@ -2554,8 +2645,9 @@ void Euler::tagGradientDetectorCells( * Adjust temp_tags from those tags set in Richardson extrapolation. */ if (uses_richardson_extrapolation_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*temp_tags)(*ic, 0) = TRUE; @@ -2566,8 +2658,9 @@ void Euler::tagGradientDetectorCells( /* * Update tags */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2586,8 +2679,8 @@ void Euler::tagGradientDetectorCells( void Euler::tagRichardsonExtrapolationCells( hier::Patch& patch, const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, + const boost::shared_ptr& coarsened_fine, + const boost::shared_ptr& advanced_coarse, const double regrid_time, const double deltat, const int error_coarsen_ratio, @@ -2598,13 +2691,18 @@ void Euler::tagRichardsonExtrapolationCells( NULL_USE(initial_error); const boost::shared_ptr patch_geom( - patch.getPatchGeometry()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* xdomainlo = d_grid_geometry->getXLower(); const double* xdomainhi = d_grid_geometry->getXUpper(); hier::Box pbox = patch.getBox(); - boost::shared_ptr > tags(patch.getPatchData(tag_index)); + boost::shared_ptr > tags( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); /* * Possible tagging criteria includes @@ -2615,7 +2713,8 @@ void Euler::tagRichardsonExtrapolationCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > coarsened_fine_var; @@ -2625,35 +2724,41 @@ void Euler::tagRichardsonExtrapolationCells( bool time_allowed = false; if (ref == "DENSITY_RICHARDSON") { - coarsened_fine_var = patch.getPatchData(d_density, coarsened_fine); - advanced_coarse_var = patch.getPatchData(d_density, advanced_coarse); - size = d_density_rich_tol.getSize(); + coarsened_fine_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, coarsened_fine)); + advanced_coarse_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, advanced_coarse)); + size = static_cast(d_density_rich_tol.size()); tol = ((error_level_number < size) ? d_density_rich_tol[error_level_number] : d_density_rich_tol[size - 1]); - size = d_density_rich_time_min.getSize(); + size = static_cast(d_density_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_density_rich_time_min[error_level_number] : d_density_rich_time_min[size - 1]); - size = d_density_rich_time_max.getSize(); + size = static_cast(d_density_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_density_rich_time_max[error_level_number] : d_density_rich_time_max[size - 1]); time_allowed = (time_min <= regrid_time) && (time_max > regrid_time); - } - - if (ref == "PRESSURE_RICHARDSON") { - coarsened_fine_var = patch.getPatchData(d_pressure, coarsened_fine); - advanced_coarse_var = patch.getPatchData(d_pressure, advanced_coarse); - size = d_pressure_rich_tol.getSize(); + } else if (ref == "PRESSURE_RICHARDSON") { + coarsened_fine_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, coarsened_fine)); + advanced_coarse_var = + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, advanced_coarse)); + size = static_cast(d_pressure_rich_tol.size()); tol = ((error_level_number < size) ? d_pressure_rich_tol[error_level_number] : d_pressure_rich_tol[size - 1]); - size = d_pressure_rich_time_min.getSize(); + size = static_cast(d_pressure_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_pressure_rich_time_min[error_level_number] : d_pressure_rich_time_min[size - 1]); - size = d_pressure_rich_time_max.getSize(); + size = static_cast(d_pressure_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_pressure_rich_time_max[error_level_number] : d_pressure_rich_time_max[size - 1]); @@ -2662,10 +2767,8 @@ void Euler::tagRichardsonExtrapolationCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(coarsened_fine_var); TBOX_ASSERT(advanced_coarse_var); -#endif if (ref == "DENSITY_RICHARDSON" || ref == "PRESSURE_RICHARDSON") { @@ -2689,7 +2792,7 @@ void Euler::tagRichardsonExtrapolationCells( const double* dx = patch_geom->getDx(); double max_dx = 0.; double max_length = 0.; - for (int idir = 0; idir < NDIM; idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { max_dx = tbox::MathUtilities::Max(max_dx, dx[idir]); double length = xdomainhi[idir] - xdomainlo[idir]; max_length = @@ -2716,8 +2819,9 @@ void Euler::tagRichardsonExtrapolationCells( double diff = 0.; double error = 0.; - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { /* * Compute error norm @@ -2759,8 +2863,9 @@ void Euler::tagRichardsonExtrapolationCells( * use this information in the gradient detector. */ if (!uses_gradient_detector_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*tags)(*ic, 0) = TRUE; @@ -2785,10 +2890,9 @@ void Euler::tagRichardsonExtrapolationCells( void Euler::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; + d_visit_writer->registerDerivedPlotQuantity("Owner", "SCALAR", this); } #endif @@ -2806,109 +2910,142 @@ bool Euler::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT((region * patch.getBox()) == region); -#endif + NULL_USE(simulation_time); + + TBOX_ASSERT((region * patch.getBox()).isSpatiallyEqual(region)); bool data_on_patch = FALSE; boost::shared_ptr > density( - patch.getPatchData(d_density, d_plot_context)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_density, d_plot_context))); boost::shared_ptr > velocity( - patch.getPatchData(d_velocity, d_plot_context)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_velocity, d_plot_context))); boost::shared_ptr > pressure( - patch.getPatchData(d_pressure, d_plot_context)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_pressure, d_plot_context))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); - TBOX_ASSERT(density->getGhostBox() == patch.getBox()); - TBOX_ASSERT(velocity->getGhostBox() == patch.getBox()); - TBOX_ASSERT(pressure->getGhostBox() == patch.getBox()); -#endif + TBOX_ASSERT(density->getGhostBox().isSpatiallyEqual(patch.getBox())); + TBOX_ASSERT(velocity->getGhostBox().isSpatiallyEqual(patch.getBox())); + TBOX_ASSERT(pressure->getGhostBox().isSpatiallyEqual(patch.getBox())); const hier::Box& data_box = density->getGhostBox(); const int box_w0 = region.numberCells(0); const int dat_w0 = data_box.numberCells(0); const int box_w1 = region.numberCells(1); -#if (NDIM > 2) - const int dat_w1 = data_box.numberCells(1); - const int box_w2 = region.numberCells(2); -#endif + const int dat_w1 = d_dim > + tbox::Dimension(2) ? data_box.numberCells(1) : tbox::MathUtilities::getMax(); + const int box_w2 = d_dim > + tbox::Dimension(2) ? region.numberCells(2) : tbox::MathUtilities::getMax(); + + if (variable_name == "Owner") { + + // double owner = patch.getBox().getOwnerRank(); + double owner = tbox::SAMRAI_MPI::getSAMRAIWorld().getRank(); + const size_t size = region.size(); + for (size_t i = 0; i < size; ++i) dbuffer[i] = owner; + data_on_patch = TRUE; + + } else if (variable_name == "Total Energy") { - if (variable_name == "Total Energy") { const double * const dens = density->getPointer(); const double * const xvel = velocity->getPointer(0); const double * const yvel = velocity->getPointer(1); -#if (NDIM > 2) - const double * const zvel = velocity->getPointer(2); -#endif + const double * const zvel = d_dim > tbox::Dimension(2) ? velocity->getPointer(2) : 0; const double * const pres = pressure->getPointer(); double valinv = 1.0 / (d_gamma - 1.0); int buf_b1 = 0; - int dat_b2 = data_box.offset(region.lower()); + size_t dat_b2 = data_box.offset(region.lower()); + + if (d_dim > tbox::Dimension(2)) { + for (int i2 = 0; i2 < box_w2; ++i2) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; + double v2norm = pow(xvel[dat_indx], 2.0) + + pow(yvel[dat_indx], 2.0) + + pow(zvel[dat_indx], 2.0) + ; + double rho = dens[dat_indx]; + double int_energy = 0.0; + if (rho > 0.0) { + int_energy = valinv * pres[dat_indx] / dens[dat_indx]; + } + dbuffer[buf_b1 + i0] = + dens[dat_indx] * (0.5 * v2norm + int_energy); + } + dat_b1 += dat_w0; + buf_b1 += box_w0; + } + dat_b2 += dat_w1 * dat_w0; + } + } -#if (NDIM > 2) - for (int i2 = 0; i2 < box_w2; i2++) { -#endif - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; - double v2norm = pow(xvel[dat_indx], 2.0) - + pow(yvel[dat_indx], 2.0) -#if (NDIM > 2) - + pow(zvel[dat_indx], 2.0) -#endif - ; - double rho = dens[dat_indx]; - double int_energy = 0.0; - if (rho > 0.0) { - int_energy = valinv * pres[dat_indx] / dens[dat_indx]; + if (d_dim == tbox::Dimension(2)) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; + double v2norm = pow(xvel[dat_indx], 2.0) + + pow(yvel[dat_indx], 2.0) + ; + double rho = dens[dat_indx]; + double int_energy = 0.0; + if (rho > 0.0) { + int_energy = valinv * pres[dat_indx] / dens[dat_indx]; + } + dbuffer[buf_b1 + i0] = + dens[dat_indx] * (0.5 * v2norm + int_energy); } - dbuffer[buf_b1 + i0] = - dens[dat_indx] * (0.5 * v2norm + int_energy); + dat_b1 += dat_w0; + buf_b1 += box_w0; } - dat_b1 += dat_w0; - buf_b1 += box_w0; } -#if (NDIM > 2) - dat_b2 += dat_w1 * dat_w0; - } -#endif data_on_patch = TRUE; } else if (variable_name == "Momentum") { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(depth_id < NDIM); -#endif + TBOX_ASSERT(depth_id < d_dim.getValue()); const double * const dens = density->getPointer(); const double * const vel = velocity->getPointer(depth_id); int buf_b1 = 0; - int dat_b2 = data_box.offset(region.lower()); - -#if (NDIM > 2) - for (int i2 = 0; i2 < box_w2; i2++) { -#endif - int dat_b1 = dat_b2; - for (int i1 = 0; i1 < box_w1; i1++) { - for (int i0 = 0; i0 < box_w0; i0++) { - int dat_indx = dat_b1 + i0; - dbuffer[buf_b1 + i0] = dens[dat_indx] * vel[dat_indx]; + size_t dat_b2 = data_box.offset(region.lower()); + + if (d_dim == tbox::Dimension(2)) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; + dbuffer[buf_b1 + i0] = dens[dat_indx] * vel[dat_indx]; + } + dat_b1 += dat_w0; + buf_b1 += box_w0; + } + } + if (d_dim == tbox::Dimension(3)) { + for (int i2 = 0; i2 < box_w2; ++i2) { + size_t dat_b1 = dat_b2; + for (int i1 = 0; i1 < box_w1; ++i1) { + for (int i0 = 0; i0 < box_w0; ++i0) { + size_t dat_indx = dat_b1 + i0; + dbuffer[buf_b1 + i0] = dens[dat_indx] * vel[dat_indx]; + } + dat_b1 += dat_w0; + buf_b1 += box_w0; + } + dat_b2 += dat_w1 * dat_w0; } - dat_b1 += dat_w0; - buf_b1 += box_w0; } -#if (NDIM > 2) - dat_b2 += dat_w1 * dat_w0; - } -#endif data_on_patch = TRUE; @@ -2933,7 +3070,7 @@ bool Euler::packDerivedDataIntoDoubleBuffer( void Euler::writeData1dPencil( const boost::shared_ptr patch, const hier::Box& pencil_box, - const int idir, + const tbox::Dimension::dir_t idir, ostream& file) { @@ -2943,20 +3080,23 @@ void Euler::writeData1dPencil( if (!box.empty()) { boost::shared_ptr > density( - patch->getPatchData(d_density, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_density, getDataContext()))); boost::shared_ptr > velocity( - patch->getPatchData(d_velocity, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_velocity, getDataContext()))); boost::shared_ptr > pressure( - patch->getPatchData(d_pressure, getDataContext())); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(d_pressure, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(density); TBOX_ASSERT(velocity); TBOX_ASSERT(pressure); -#endif const boost::shared_ptr pgeom( - patch->getPatchGeometry()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double* xlo = pgeom->getXLower(); @@ -2968,10 +3108,11 @@ void Euler::writeData1dPencil( double valinv = 1.0 / (d_gamma - 1.0); int ccount = 0; - pdat::CellIterator icend(box, false); - for (pdat::CellIterator ic(box, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(box)); + ic != icend; ++ic) { file << cell_center + ccount * dx[idir] << " "; - ccount++; + ++ccount; double rho = (*density)(*ic, 0); double vel = (*velocity)(*ic, idir); @@ -3022,7 +3163,7 @@ void Euler::printClassData( os << "Euler: this = " << (Euler *)this << endl; os << "d_object_name = " << d_object_name << endl; os << "d_grid_geometry = " - << (geom::CartesianGridGeometry *)d_grid_geometry << endl; + << d_grid_geometry.get() << endl; os << "Parameters for physical problem ..." << endl; os << " d_gamma = " << d_gamma << endl; @@ -3041,261 +3182,261 @@ void Euler::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < NDIM; j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_density_inside = " << d_density_inside << endl; os << " d_velocity_inside = "; - for (j = 0; j < NDIM; j++) os << d_velocity_inside[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_velocity_inside[j] << " "; os << endl; os << " d_pressure_inside = " << d_pressure_inside << endl; os << " d_density_outside = " << d_density_outside << endl; os << " d_velocity_outside = "; - for (j = 0; j < NDIM; j++) os << d_velocity_outside[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_velocity_outside[j] << " "; os << endl; os << " d_pressure_outside = " << d_pressure_outside << endl; os << " d_number_of_intervals = " << d_number_of_intervals << endl; os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { + for (k = 0; k < d_number_of_intervals - 1; ++k) { os << d_front_position[k] << " "; } os << endl; os << " d_interval_density = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_density[k] << endl; } os << " d_interval_velocity = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " "; - for (j = 0; j < NDIM; j++) { - os << d_interval_velocity[k * NDIM + j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) { + os << d_interval_velocity[k * d_dim.getValue() + j] << " "; } os << endl; } os << " d_interval_pressure = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_pressure[k] << endl; } os << " Boundary condition data " << endl; -#if (NDIM == 2) - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { - os << "\n d_master_bdry_edge_conds[" << j << "] = " - << d_master_bdry_edge_conds[j] << endl; - os << " d_scalar_bdry_edge_conds[" << j << "] = " - << d_scalar_bdry_edge_conds[j] << endl; - os << " d_vector_bdry_edge_conds[" << j << "] = " - << d_vector_bdry_edge_conds[j] << endl; - if (d_master_bdry_edge_conds[j] == DIRICHLET_BC) { - os << " d_bdry_edge_density[" << j << "] = " - << d_bdry_edge_density[j] << endl; - os << " d_bdry_edge_velocity[" << j << "] = " - << d_bdry_edge_velocity[j * NDIM + 0] << " , " - << d_bdry_edge_velocity[j * NDIM + 1] << endl; - os << " d_bdry_edge_pressure[" << j << "] = " - << d_bdry_edge_pressure[j] << endl; + if (d_dim == tbox::Dimension(2)) { + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { + os << "\n d_master_bdry_edge_conds[" << j << "] = " + << d_master_bdry_edge_conds[j] << endl; + os << " d_scalar_bdry_edge_conds[" << j << "] = " + << d_scalar_bdry_edge_conds[j] << endl; + os << " d_vector_bdry_edge_conds[" << j << "] = " + << d_vector_bdry_edge_conds[j] << endl; + if (d_master_bdry_edge_conds[j] == BdryCond::DIRICHLET) { + os << " d_bdry_edge_density[" << j << "] = " + << d_bdry_edge_density[j] << endl; + os << " d_bdry_edge_velocity[" << j << "] = " + << d_bdry_edge_velocity[j * d_dim.getValue() + 0] << " , " + << d_bdry_edge_velocity[j * d_dim.getValue() + 1] << endl; + os << " d_bdry_edge_pressure[" << j << "] = " + << d_bdry_edge_pressure[j] << endl; + } } - } - os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { - os << "\n d_master_bdry_node_conds[" << j << "] = " - << d_master_bdry_node_conds[j] << endl; - os << " d_scalar_bdry_node_conds[" << j << "] = " - << d_scalar_bdry_node_conds[j] << endl; - os << " d_vector_bdry_node_conds[" << j << "] = " - << d_vector_bdry_node_conds[j] << endl; - os << " d_node_bdry_edge[" << j << "] = " - << d_node_bdry_edge[j] << endl; - } -#endif -#if (NDIM == 3) - for (j = 0; j < d_master_bdry_face_conds.getSize(); j++) { - os << "\n d_master_bdry_face_conds[" << j << "] = " - << d_master_bdry_face_conds[j] << endl; - os << " d_scalar_bdry_face_conds[" << j << "] = " - << d_scalar_bdry_face_conds[j] << endl; - os << " d_vector_bdry_face_conds[" << j << "] = " - << d_vector_bdry_face_conds[j] << endl; - if (d_master_bdry_face_conds[j] == DIRICHLET_BC) { - os << " d_bdry_face_density[" << j << "] = " - << d_bdry_face_density[j] << endl; - os << " d_bdry_face_velocity[" << j << "] = " - << d_bdry_face_velocity[j * NDIM + 0] << " , " - << d_bdry_face_velocity[j * NDIM + 1] << " , " - << d_bdry_face_velocity[j * NDIM + 2] << endl; - os << " d_bdry_face_pressure[" << j << "] = " - << d_bdry_face_pressure[j] << endl; + os << endl; + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { + os << "\n d_master_bdry_node_conds[" << j << "] = " + << d_master_bdry_node_conds[j] << endl; + os << " d_scalar_bdry_node_conds[" << j << "] = " + << d_scalar_bdry_node_conds[j] << endl; + os << " d_vector_bdry_node_conds[" << j << "] = " + << d_vector_bdry_node_conds[j] << endl; + os << " d_node_bdry_edge[" << j << "] = " + << d_node_bdry_edge[j] << endl; } } - os << endl; - for (j = 0; j < d_master_bdry_edge_conds.getSize(); j++) { - os << "\n d_master_bdry_edge_conds[" << j << "] = " - << d_master_bdry_edge_conds[j] << endl; - os << " d_scalar_bdry_edge_conds[" << j << "] = " - << d_scalar_bdry_edge_conds[j] << endl; - os << " d_vector_bdry_edge_conds[" << j << "] = " - << d_vector_bdry_edge_conds[j] << endl; - os << " d_edge_bdry_face[" << j << "] = " - << d_edge_bdry_face[j] << endl; - } - os << endl; - for (j = 0; j < d_master_bdry_node_conds.getSize(); j++) { - os << "\n d_master_bdry_node_conds[" << j << "] = " - << d_master_bdry_node_conds[j] << endl; - os << " d_scalar_bdry_node_conds[" << j << "] = " - << d_scalar_bdry_node_conds[j] << endl; - os << " d_vector_bdry_node_conds[" << j << "] = " - << d_vector_bdry_node_conds[j] << endl; - os << " d_node_bdry_face[" << j << "] = " - << d_node_bdry_face[j] << endl; + if (d_dim == tbox::Dimension(3)) { + for (j = 0; j < static_cast(d_master_bdry_face_conds.size()); ++j) { + os << "\n d_master_bdry_face_conds[" << j << "] = " + << d_master_bdry_face_conds[j] << endl; + os << " d_scalar_bdry_face_conds[" << j << "] = " + << d_scalar_bdry_face_conds[j] << endl; + os << " d_vector_bdry_face_conds[" << j << "] = " + << d_vector_bdry_face_conds[j] << endl; + if (d_master_bdry_face_conds[j] == BdryCond::DIRICHLET) { + os << " d_bdry_face_density[" << j << "] = " + << d_bdry_face_density[j] << endl; + os << " d_bdry_face_velocity[" << j << "] = " + << d_bdry_face_velocity[j * d_dim.getValue() + 0] << " , " + << d_bdry_face_velocity[j * d_dim.getValue() + 1] << " , " + << d_bdry_face_velocity[j * d_dim.getValue() + 2] << endl; + os << " d_bdry_face_pressure[" << j << "] = " + << d_bdry_face_pressure[j] << endl; + } + } + os << endl; + for (j = 0; j < static_cast(d_master_bdry_edge_conds.size()); ++j) { + os << "\n d_master_bdry_edge_conds[" << j << "] = " + << d_master_bdry_edge_conds[j] << endl; + os << " d_scalar_bdry_edge_conds[" << j << "] = " + << d_scalar_bdry_edge_conds[j] << endl; + os << " d_vector_bdry_edge_conds[" << j << "] = " + << d_vector_bdry_edge_conds[j] << endl; + os << " d_edge_bdry_face[" << j << "] = " + << d_edge_bdry_face[j] << endl; + } + os << endl; + for (j = 0; j < static_cast(d_master_bdry_node_conds.size()); ++j) { + os << "\n d_master_bdry_node_conds[" << j << "] = " + << d_master_bdry_node_conds[j] << endl; + os << " d_scalar_bdry_node_conds[" << j << "] = " + << d_scalar_bdry_node_conds[j] << endl; + os << " d_vector_bdry_node_conds[" << j << "] = " + << d_vector_bdry_node_conds[j] << endl; + os << " d_node_bdry_face[" << j << "] = " + << d_node_bdry_face[j] << endl; + } } -#endif os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_tol.size()); ++j) { os << " d_density_dev_tol[" << j << "] = " << d_density_dev_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev.size()); ++j) { os << " d_density_dev[" << j << "] = " << d_density_dev[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_time_max.size()); ++j) { os << " d_density_dev_time_max[" << j << "] = " << d_density_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_dev_time_min.size()); ++j) { os << " d_density_dev_time_min[" << j << "] = " << d_density_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_tol.size()); ++j) { os << " d_density_grad_tol[" << j << "] = " << d_density_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_time_max.size()); ++j) { os << " d_density_grad_time_max[" << j << "] = " << d_density_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_grad_time_min.size()); ++j) { os << " d_density_grad_time_min[" << j << "] = " << d_density_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_onset.size()); ++j) { os << " d_density_shock_onset[" << j << "] = " << d_density_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_tol.size()); ++j) { os << " d_density_shock_tol[" << j << "] = " << d_density_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_time_max.size()); ++j) { os << " d_density_shock_time_max[" << j << "] = " << d_density_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_shock_time_min.size()); ++j) { os << " d_density_shock_time_min[" << j << "] = " << d_density_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_tol.size()); ++j) { os << " d_density_rich_tol[" << j << "] = " << d_density_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_time_max.size()); ++j) { os << " d_density_rich_time_max[" << j << "] = " << d_density_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_density_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_density_rich_time_min.size()); ++j) { os << " d_density_rich_time_min[" << j << "] = " << d_density_rich_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_tol.size()); ++j) { os << " d_pressure_dev_tol[" << j << "] = " << d_pressure_dev_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev.size()); ++j) { os << " d_pressure_dev[" << j << "] = " << d_pressure_dev[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_time_max.size()); ++j) { os << " d_pressure_dev_time_max[" << j << "] = " << d_pressure_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_dev_time_min.size()); ++j) { os << " d_pressure_dev_time_min[" << j << "] = " << d_pressure_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_tol.size()); ++j) { os << " d_pressure_grad_tol[" << j << "] = " << d_pressure_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_time_max.size()); ++j) { os << " d_pressure_grad_time_max[" << j << "] = " << d_pressure_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_grad_time_min.size()); ++j) { os << " d_pressure_grad_time_min[" << j << "] = " << d_pressure_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_onset.size()); ++j) { os << " d_pressure_shock_onset[" << j << "] = " << d_pressure_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_tol.size()); ++j) { os << " d_pressure_shock_tol[" << j << "] = " << d_pressure_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_time_max.size()); ++j) { os << " d_pressure_shock_time_max[" << j << "] = " << d_pressure_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_shock_time_min.size()); ++j) { os << " d_pressure_shock_time_min[" << j << "] = " << d_pressure_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_tol.size()); ++j) { os << " d_pressure_rich_tol[" << j << "] = " << d_pressure_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_time_max.size()); ++j) { os << " d_pressure_rich_time_max[" << j << "] = " << d_pressure_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_pressure_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_pressure_rich_time_min.size()); ++j) { os << " d_pressure_rich_time_min[" << j << "] = " << d_pressure_rich_time_min[j] << endl; } @@ -3313,12 +3454,10 @@ void Euler::printClassData( */ void Euler::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); /* * Note: if we are restarting, then we only allow nonuniform @@ -3326,21 +3465,21 @@ void Euler::getFromInput( */ if (!is_from_restart) { d_use_nonuniform_workload = - db->getBoolWithDefault("use_nonuniform_workload", + input_db->getBoolWithDefault("use_nonuniform_workload", d_use_nonuniform_workload); } else { if (d_use_nonuniform_workload) { d_use_nonuniform_workload = - db->getBool("use_nonuniform_workload"); + input_db->getBool("use_nonuniform_workload"); } } if (!is_from_restart) { - d_gamma = db->getDoubleWithDefault("gamma", d_gamma); + d_gamma = input_db->getDoubleWithDefault("gamma", d_gamma); } - if (db->keyExists("riemann_solve")) { - d_riemann_solve = db->getString("riemann_solve"); + if (input_db->keyExists("riemann_solve")) { + d_riemann_solve = input_db->getString("riemann_solve"); if ((d_riemann_solve != "APPROX_RIEM_SOLVE") && (d_riemann_solve != "EXACT_RIEM_SOLVE") && (d_riemann_solve != "HLLC_RIEM_SOLVE")) { @@ -3352,12 +3491,12 @@ void Euler::getFromInput( } } else { - d_riemann_solve = db->getStringWithDefault("d_riemann_solve", + d_riemann_solve = input_db->getStringWithDefault("d_riemann_solve", d_riemann_solve); } - if (db->keyExists("godunov_order")) { - d_godunov_order = db->getInteger("godunov_order"); + if (input_db->keyExists("godunov_order")) { + d_godunov_order = input_db->getInteger("godunov_order"); if ((d_godunov_order != 1) && (d_godunov_order != 2) && (d_godunov_order != 4)) { @@ -3367,12 +3506,12 @@ void Euler::getFromInput( } } else { - d_godunov_order = db->getIntegerWithDefault("d_godunov_order", + d_godunov_order = input_db->getIntegerWithDefault("d_godunov_order", d_godunov_order); } - if (db->keyExists("corner_transport")) { - d_corner_transport = db->getString("corner_transport"); + if (input_db->keyExists("corner_transport")) { + d_corner_transport = input_db->getString("corner_transport"); if ((d_corner_transport != "CORNER_TRANSPORT_1") && (d_corner_transport != "CORNER_TRANSPORT_2")) { TBOX_ERROR( @@ -3381,19 +3520,18 @@ void Euler::getFromInput( << " 'CORNER_TRANSPORT_1' or 'CORNER_TRANSPORT_2'." << endl); } } else { - d_corner_transport = db->getStringWithDefault("corner_transport", + d_corner_transport = input_db->getStringWithDefault("corner_transport", d_corner_transport); } - if (db->keyExists("Refinement_data")) { + if (input_db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( - db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + input_db->getDatabase("Refinement_data")); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -3401,10 +3539,10 @@ void Euler::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -3427,14 +3565,13 @@ void Euler::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } if (error_db && error_key == "DENSITY_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_density_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_density_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3443,8 +3580,7 @@ void Euler::getFromInput( } if (error_db->keyExists("density_dev")) { - d_density_dev = - error_db->getDoubleArray("density_dev"); + d_density_dev = error_db->getDoubleVector("density_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -3454,18 +3590,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_dev_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_dev_time_max.resizeArray(1); + d_density_dev_time_max.resize(1); d_density_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_dev_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_dev_time_min.resizeArray(1); + d_density_dev_time_min.resize(1); d_density_dev_time_min[0] = 0.; } @@ -3474,8 +3610,7 @@ void Euler::getFromInput( if (error_db && error_key == "DENSITY_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_density_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_density_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3485,18 +3620,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_grad_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_grad_time_max.resizeArray(1); + d_density_grad_time_max.resize(1); d_density_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_grad_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_grad_time_min.resizeArray(1); + d_density_grad_time_min.resize(1); d_density_grad_time_min[0] = 0.; } @@ -3506,7 +3641,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_onset")) { d_density_shock_onset = - error_db->getDoubleArray("shock_onset"); + error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -3515,8 +3650,7 @@ void Euler::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_density_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_density_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3526,18 +3660,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_shock_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_shock_time_max.resizeArray(1); + d_density_shock_time_max.resize(1); d_density_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_shock_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_shock_time_min.resizeArray(1); + d_density_shock_time_min.resize(1); d_density_shock_time_min[0] = 0.; } @@ -3546,8 +3680,7 @@ void Euler::getFromInput( if (error_db && error_key == "DENSITY_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_density_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_density_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3557,18 +3690,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_density_rich_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_density_rich_time_max.resizeArray(1); + d_density_rich_time_max.resize(1); d_density_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_density_rich_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_density_rich_time_min.resizeArray(1); + d_density_rich_time_min.resize(1); d_density_rich_time_min[0] = 0.; } @@ -3577,8 +3710,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_pressure_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_pressure_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3587,8 +3719,7 @@ void Euler::getFromInput( } if (error_db->keyExists("pressure_dev")) { - d_pressure_dev = - error_db->getDoubleArray("pressure_dev"); + d_pressure_dev = error_db->getDoubleVector("pressure_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -3598,18 +3729,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_dev_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_dev_time_max.resizeArray(1); + d_pressure_dev_time_max.resize(1); d_pressure_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_dev_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_dev_time_min.resizeArray(1); + d_pressure_dev_time_min.resize(1); d_pressure_dev_time_min[0] = 0.; } @@ -3618,8 +3749,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_pressure_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_pressure_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3629,18 +3759,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_grad_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_grad_time_max.resizeArray(1); + d_pressure_grad_time_max.resize(1); d_pressure_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_grad_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_grad_time_min.resizeArray(1); + d_pressure_grad_time_min.resize(1); d_pressure_grad_time_min[0] = 0.; } @@ -3650,7 +3780,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_onset")) { d_pressure_shock_onset = - error_db->getDoubleArray("shock_onset"); + error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -3660,7 +3790,7 @@ void Euler::getFromInput( if (error_db->keyExists("shock_tol")) { d_pressure_shock_tol = - error_db->getDoubleArray("shock_tol"); + error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3670,18 +3800,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_shock_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_shock_time_max.resizeArray(1); + d_pressure_shock_time_max.resize(1); d_pressure_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_shock_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_shock_time_min.resizeArray(1); + d_pressure_shock_time_min.resize(1); d_pressure_shock_time_min[0] = 0.; } @@ -3690,8 +3820,7 @@ void Euler::getFromInput( if (error_db && error_key == "PRESSURE_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_pressure_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_pressure_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -3701,18 +3830,18 @@ void Euler::getFromInput( if (error_db->keyExists("time_max")) { d_pressure_rich_time_max = - error_db->getDoubleArray("time_max"); + error_db->getDoubleVector("time_max"); } else { - d_pressure_rich_time_max.resizeArray(1); + d_pressure_rich_time_max.resize(1); d_pressure_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { d_pressure_rich_time_min = - error_db->getDoubleArray("time_min"); + error_db->getDoubleVector("time_min"); } else { - d_pressure_rich_time_min.resizeArray(1); + d_pressure_rich_time_min.resize(1); d_pressure_rich_time_min[0] = 0.; } @@ -3725,10 +3854,11 @@ void Euler::getFromInput( /* * Check that input is found for each string identifier in key list. */ - for (int k0 = 0; k0 < d_refinement_criteria.getSize(); k0++) { + for (int k0 = 0; + k0 < static_cast(d_refinement_criteria.size()); ++k0) { string use_key = d_refinement_criteria[k0]; bool key_found = false; - for (int k1 = 0; k1 < def_key_cnt; k1++) { + for (int k1 = 0; k1 < def_key_cnt; ++k1) { string def_key = ref_keys_defined[k1]; if (def_key == use_key) key_found = true; } @@ -3744,8 +3874,8 @@ void Euler::getFromInput( if (!is_from_restart) { - if (db->keyExists("data_problem")) { - d_data_problem = db->getString("data_problem"); + if (input_db->keyExists("data_problem")) { + d_data_problem = input_db->getString("data_problem"); } else { TBOX_ERROR( d_object_name << ": " @@ -3753,13 +3883,13 @@ void Euler::getFromInput( << endl); } - if (!db->keyExists("Initial_data")) { + if (!input_db->keyExists("Initial_data")) { TBOX_ERROR( d_object_name << ": " << "No `Initial_data' database found in input." << endl); } boost::shared_ptr init_data_db( - db->getDatabase("Initial_data")); + input_db->getDatabase("Initial_data")); bool found_problem_data = false; @@ -3773,7 +3903,7 @@ void Euler::getFromInput( << "`radius' input required for SPHERE problem." << endl); } if (init_data_db->keyExists("center")) { - init_data_db->getDoubleArray("center", d_center, NDIM); + init_data_db->getDoubleArray("center", d_center, d_dim.getValue()); } else { TBOX_ERROR( d_object_name << ": " @@ -3788,7 +3918,7 @@ void Euler::getFromInput( } if (init_data_db->keyExists("velocity_inside")) { init_data_db->getDoubleArray("velocity_inside", - d_velocity_inside, NDIM); + d_velocity_inside, d_dim.getValue()); } else { TBOX_ERROR(d_object_name << ": " << "`velocity_inside' input required for " @@ -3810,7 +3940,7 @@ void Euler::getFromInput( } if (init_data_db->keyExists("velocity_outside")) { init_data_db->getDoubleArray("velocity_outside", - d_velocity_outside, NDIM); + d_velocity_outside, d_dim.getValue()); } else { TBOX_ERROR( d_object_name << ": " @@ -3842,7 +3972,7 @@ void Euler::getFromInput( } if (d_data_problem == "PIECEWISE_CONSTANT_Z") { - if (NDIM < 3) { + if (d_dim < tbox::Dimension(3)) { TBOX_ERROR( d_object_name << ": `PIECEWISE_CONSTANT_Z' " << "problem invalid in 2 dimensions." @@ -3851,10 +3981,10 @@ void Euler::getFromInput( idir = 2; } - tbox::Array init_data_keys = init_data_db->getAllKeys(); + std::vector init_data_keys = init_data_db->getAllKeys(); if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); + d_front_position = init_data_db->getDoubleVector("front_position"); } else { TBOX_ERROR(d_object_name << ": " << "`front_position' input required for " @@ -3862,16 +3992,16 @@ void Euler::getFromInput( } d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); + tbox::MathUtilities::Min(static_cast(d_front_position.size()) + 1, + static_cast(init_data_keys.size()) - 1); - d_front_position.resizeArray(d_front_position.getSize() + 1); - d_front_position[d_front_position.getSize() - 1] = + d_front_position.resize(static_cast(d_front_position.size()) + 1); + d_front_position[static_cast(d_front_position.size()) - 1] = d_grid_geometry->getXUpper()[idir]; - d_interval_density.resizeArray(d_number_of_intervals); - d_interval_velocity.resizeArray(d_number_of_intervals * NDIM); - d_interval_pressure.resizeArray(d_number_of_intervals); + d_interval_density.resize(d_number_of_intervals); + d_interval_velocity.resize(d_number_of_intervals * d_dim.getValue()); + d_interval_pressure.resize(d_number_of_intervals); int i = 0; int nkey = 0; @@ -3879,7 +4009,7 @@ void Euler::getFromInput( while (!found_interval_data && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { + && (nkey < static_cast(init_data_keys.size()))) { if (!(init_data_keys[nkey] == "front_position")) { @@ -3893,13 +4023,13 @@ void Euler::getFromInput( d_interval_velocity, d_interval_pressure); - i++; + ++i; found_interval_data = (i == d_number_of_intervals); } - nkey++; + ++nkey; } @@ -3922,34 +4052,35 @@ void Euler::getFromInput( } // if !is_from_restart read in problem data - hier::IntVector periodic = d_grid_geometry->getPeriodicShift(); + const hier::IntVector& one_vec = hier::IntVector::getOne(d_dim); + hier::IntVector periodic = d_grid_geometry->getPeriodicShift(one_vec); int num_per_dirs = 0; - for (int id = 0; id < NDIM; id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } - if (num_per_dirs < NDIM) { + if (num_per_dirs < d_dim.getValue()) { - if (db->keyExists("Boundary_data")) { + if (input_db->keyExists("Boundary_data")) { - boost::shared_ptr bdry_db( - db->getDatabase("Boundary_data")); + boost::shared_ptr bdry_db = input_db->getDatabase( + "Boundary_data"); -#if (NDIM == 2) - appu::CartesianBoundaryUtilities2::readBoundaryInput(this, - bdry_db, - d_master_bdry_edge_conds, - d_master_bdry_node_conds, - periodic); -#endif -#if (NDIM == 3) - appu::CartesianBoundaryUtilities3::readBoundaryInput(this, - bdry_db, - d_master_bdry_face_conds, - d_master_bdry_edge_conds, - d_master_bdry_node_conds, - periodic); -#endif + if (d_dim == tbox::Dimension(2)) { + appu::CartesianBoundaryUtilities2::getFromInput(this, + bdry_db, + d_master_bdry_edge_conds, + d_master_bdry_node_conds, + periodic); + } + if (d_dim == tbox::Dimension(3)) { + appu::CartesianBoundaryUtilities3::getFromInput(this, + bdry_db, + d_master_bdry_face_conds, + d_master_bdry_edge_conds, + d_master_bdry_node_conds, + periodic); + } } else { TBOX_ERROR( @@ -3969,148 +4100,156 @@ void Euler::getFromInput( ************************************************************************* */ -void Euler::putToDatabase( - const boost::shared_ptr& db) const +void Euler::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("EULER_VERSION", EULER_VERSION); + restart_db->putInteger("EULER_VERSION", EULER_VERSION); - db->putDouble("d_gamma", d_gamma); + restart_db->putDouble("d_gamma", d_gamma); - db->putString("d_riemann_solve", d_riemann_solve); - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", d_nghosts, NDIM); - db->putIntegerArray("d_fluxghosts", d_fluxghosts, NDIM); + restart_db->putString("d_riemann_solve", d_riemann_solve); + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, NDIM); - db->putDouble("d_density_inside", d_density_inside); - db->putDoubleArray("d_velocity_inside", d_velocity_inside, NDIM); - db->putDouble("d_pressure_inside", d_pressure_inside); - db->putDouble("d_density_outside", d_density_outside); - db->putDoubleArray("d_velocity_outside", d_velocity_outside, NDIM); - db->putDouble("d_pressure_outside", d_pressure_outside); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleArray("d_center", d_center, d_dim.getValue()); + restart_db->putDouble("d_density_inside", d_density_inside); + restart_db->putDoubleArray("d_velocity_inside", + d_velocity_inside, + d_dim.getValue()); + restart_db->putDouble("d_pressure_inside", d_pressure_inside); + restart_db->putDouble("d_density_outside", d_density_outside); + restart_db->putDoubleArray("d_velocity_outside", + d_velocity_outside, + d_dim.getValue()); + restart_db->putDouble("d_pressure_outside", d_pressure_outside); } if ((d_data_problem == "PIECEWISE_CONSTANT_X") || (d_data_problem == "PIECEWISE_CONSTANT_Y") || (d_data_problem == "PIECEWISE_CONSTANT_Z") || (d_data_problem == "STEP")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); + restart_db->putInteger("d_number_of_intervals", d_number_of_intervals); if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_density", d_interval_density); - db->putDoubleArray("d_interval_velocity", d_interval_velocity); - db->putDoubleArray("d_interval_pressure", d_interval_pressure); + restart_db->putDoubleVector("d_front_position", d_front_position); + restart_db->putDoubleVector("d_interval_density", d_interval_density); + restart_db->putDoubleVector("d_interval_velocity", d_interval_velocity); + restart_db->putDoubleVector("d_interval_pressure", d_interval_pressure); } } - db->putIntegerArray("d_master_bdry_edge_conds", d_master_bdry_edge_conds); - db->putIntegerArray("d_master_bdry_node_conds", d_master_bdry_node_conds); + restart_db->putIntegerVector("d_master_bdry_edge_conds", + d_master_bdry_edge_conds); + restart_db->putIntegerVector("d_master_bdry_node_conds", + d_master_bdry_node_conds); -#if (NDIM == 2) - db->putDoubleArray("d_bdry_edge_density", d_bdry_edge_density); - db->putDoubleArray("d_bdry_edge_velocity", d_bdry_edge_velocity); - db->putDoubleArray("d_bdry_edge_pressure", d_bdry_edge_pressure); -#endif -#if (NDIM == 3) - db->putIntegerArray("d_master_bdry_face_conds", d_master_bdry_face_conds); + if (d_dim == tbox::Dimension(2)) { + restart_db->putDoubleVector("d_bdry_edge_density", d_bdry_edge_density); + restart_db->putDoubleVector("d_bdry_edge_velocity", d_bdry_edge_velocity); + restart_db->putDoubleVector("d_bdry_edge_pressure", d_bdry_edge_pressure); + } + if (d_dim == tbox::Dimension(3)) { + restart_db->putIntegerVector("d_master_bdry_face_conds", + d_master_bdry_face_conds); - db->putDoubleArray("d_bdry_face_density", d_bdry_face_density); - db->putDoubleArray("d_bdry_face_velocity", d_bdry_face_velocity); - db->putDoubleArray("d_bdry_face_pressure", d_bdry_face_pressure); -#endif + restart_db->putDoubleVector("d_bdry_face_density", d_bdry_face_density); + restart_db->putDoubleVector("d_bdry_face_velocity", d_bdry_face_velocity); + restart_db->putDoubleVector("d_bdry_face_pressure", d_bdry_face_pressure); + } - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "DENSITY_DEVIATION") { - db->putDoubleArray("d_density_dev_tol", + restart_db->putDoubleVector("d_density_dev_tol", d_density_dev_tol); - db->putDoubleArray("d_density_dev", + restart_db->putDoubleVector("d_density_dev", d_density_dev); - db->putDoubleArray("d_density_dev_time_max", + restart_db->putDoubleVector("d_density_dev_time_max", d_density_dev_time_max); - db->putDoubleArray("d_density_dev_time_min", + restart_db->putDoubleVector("d_density_dev_time_min", d_density_dev_time_min); } else if (d_refinement_criteria[i] == "DENSITY_GRADIENT") { - db->putDoubleArray("d_density_grad_tol", + restart_db->putDoubleVector("d_density_grad_tol", d_density_grad_tol); - db->putDoubleArray("d_density_grad_time_max", + restart_db->putDoubleVector("d_density_grad_time_max", d_density_grad_time_max); - db->putDoubleArray("d_density_grad_time_min", + restart_db->putDoubleVector("d_density_grad_time_min", d_density_grad_time_min); } else if (d_refinement_criteria[i] == "DENSITY_SHOCK") { - db->putDoubleArray("d_density_shock_onset", + restart_db->putDoubleVector("d_density_shock_onset", d_density_shock_onset); - db->putDoubleArray("d_density_shock_tol", + restart_db->putDoubleVector("d_density_shock_tol", d_density_shock_tol); - db->putDoubleArray("d_density_shock_time_max", + restart_db->putDoubleVector("d_density_shock_time_max", d_density_shock_time_max); - db->putDoubleArray("d_density_shock_time_min", + restart_db->putDoubleVector("d_density_shock_time_min", d_density_shock_time_min); } else if (d_refinement_criteria[i] == "DENSITY_RICHARDSON") { - db->putDoubleArray("d_density_rich_tol", + restart_db->putDoubleVector("d_density_rich_tol", d_density_rich_tol); - db->putDoubleArray("d_density_rich_time_max", + restart_db->putDoubleVector("d_density_rich_time_max", d_density_rich_time_max); - db->putDoubleArray("d_density_rich_time_min", + restart_db->putDoubleVector("d_density_rich_time_min", d_density_rich_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_DEVIATION") { - db->putDoubleArray("d_pressure_dev_tol", + restart_db->putDoubleVector("d_pressure_dev_tol", d_pressure_dev_tol); - db->putDoubleArray("d_pressure_dev", + restart_db->putDoubleVector("d_pressure_dev", d_pressure_dev); - db->putDoubleArray("d_pressure_dev_time_max", + restart_db->putDoubleVector("d_pressure_dev_time_max", d_pressure_dev_time_max); - db->putDoubleArray("d_pressure_dev_time_min", + restart_db->putDoubleVector("d_pressure_dev_time_min", d_pressure_dev_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_GRADIENT") { - db->putDoubleArray("d_pressure_grad_tol", + restart_db->putDoubleVector("d_pressure_grad_tol", d_pressure_grad_tol); - db->putDoubleArray("d_pressure_grad_time_max", + restart_db->putDoubleVector("d_pressure_grad_time_max", d_pressure_grad_time_max); - db->putDoubleArray("d_pressure_grad_time_min", + restart_db->putDoubleVector("d_pressure_grad_time_min", d_pressure_grad_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_SHOCK") { - db->putDoubleArray("d_pressure_shock_onset", + restart_db->putDoubleVector("d_pressure_shock_onset", d_pressure_shock_onset); - db->putDoubleArray("d_pressure_shock_tol", + restart_db->putDoubleVector("d_pressure_shock_tol", d_pressure_shock_tol); - db->putDoubleArray("d_pressure_shock_time_max", + restart_db->putDoubleVector("d_pressure_shock_time_max", d_pressure_shock_time_max); - db->putDoubleArray("d_pressure_shock_time_min", + restart_db->putDoubleVector("d_pressure_shock_time_min", d_pressure_shock_time_min); } else if (d_refinement_criteria[i] == "PRESSURE_RICHARDSON") { - db->putDoubleArray("d_pressure_rich_tol", + restart_db->putDoubleVector("d_pressure_rich_tol", d_pressure_rich_tol); - db->putDoubleArray("d_pressure_rich_time_max", + restart_db->putDoubleVector("d_pressure_rich_time_max", d_pressure_rich_time_max); - db->putDoubleArray("d_pressure_rich_time_min", + restart_db->putDoubleVector("d_pressure_rich_time_min", d_pressure_rich_time_min); } @@ -4143,18 +4282,18 @@ void Euler::getFromRestart() d_godunov_order = db->getInteger("d_godunov_order"); d_corner_transport = db->getString("d_corner_transport"); - int* tmp_nghosts = d_nghosts; - db->getIntegerArray("d_nghosts", tmp_nghosts, NDIM); - for (int i = 0; i < NDIM; i++) { + int* tmp_nghosts = &d_nghosts[0]; + db->getIntegerArray("d_nghosts", tmp_nghosts, d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { if (d_nghosts(i) != CELLG) { TBOX_ERROR( d_object_name << ": " << "Key data `d_nghosts' in restart file != CELLG." << endl); } } - int* tmp_fluxghosts = d_fluxghosts; - db->getIntegerArray("d_fluxghosts", tmp_fluxghosts, NDIM); - for (int i = 0; i < NDIM; i++) { + int* tmp_fluxghosts = &d_fluxghosts[0]; + db->getIntegerArray("d_fluxghosts", tmp_fluxghosts, d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { if (d_fluxghosts(i) != FLUXG) { TBOX_ERROR( d_object_name << ": " @@ -4166,12 +4305,12 @@ void Euler::getFromRestart() if (d_data_problem == "SPHERE") { d_radius = db->getDouble("d_radius"); - db->getDoubleArray("d_center", d_center, NDIM); + db->getDoubleArray("d_center", d_center, d_dim.getValue()); d_density_inside = db->getDouble("d_density_inside"); - db->getDoubleArray("d_velocity_inside", d_velocity_inside, NDIM); + db->getDoubleArray("d_velocity_inside", d_velocity_inside, d_dim.getValue()); d_pressure_inside = db->getDouble("d_pressure_inside"); d_density_outside = db->getDouble("d_density_outside"); - db->getDoubleArray("d_velocity_outside", d_velocity_outside, NDIM); + db->getDoubleArray("d_velocity_outside", d_velocity_outside, d_dim.getValue()); d_pressure_outside = db->getDouble("d_pressure_outside"); } @@ -4181,114 +4320,114 @@ void Euler::getFromRestart() (d_data_problem == "STEP")) { d_number_of_intervals = db->getInteger("d_number_of_intervals"); if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_density = db->getDoubleArray("d_interval_density"); - d_interval_velocity = db->getDoubleArray("d_interval_velocity"); - d_interval_pressure = db->getDoubleArray("d_interval_pressure"); + d_interval_density = db->getDoubleVector("d_interval_density"); + d_interval_velocity = db->getDoubleVector("d_interval_velocity"); + d_interval_pressure = db->getDoubleVector("d_interval_pressure"); } } - d_master_bdry_edge_conds = db->getIntegerArray("d_master_bdry_edge_conds"); - d_master_bdry_node_conds = db->getIntegerArray("d_master_bdry_node_conds"); + d_master_bdry_edge_conds = db->getIntegerVector("d_master_bdry_edge_conds"); + d_master_bdry_node_conds = db->getIntegerVector("d_master_bdry_node_conds"); -#if (NDIM == 2) - d_bdry_edge_density = db->getDoubleArray("d_bdry_edge_density"); - d_bdry_edge_velocity = db->getDoubleArray("d_bdry_edge_velocity"); - d_bdry_edge_pressure = db->getDoubleArray("d_bdry_edge_pressure"); -#endif -#if (NDIM == 3) - d_master_bdry_face_conds = db->getIntegerArray("d_master_bdry_face_conds"); + if (d_dim == tbox::Dimension(2)) { + d_bdry_edge_density = db->getDoubleVector("d_bdry_edge_density"); + d_bdry_edge_velocity = db->getDoubleVector("d_bdry_edge_velocity"); + d_bdry_edge_pressure = db->getDoubleVector("d_bdry_edge_pressure"); + } + if (d_dim == tbox::Dimension(3)) { + d_master_bdry_face_conds = + db->getIntegerVector("d_master_bdry_face_conds"); - d_bdry_face_density = db->getDoubleArray("d_bdry_face_density"); - d_bdry_face_velocity = db->getDoubleArray("d_bdry_face_velocity"); - d_bdry_face_pressure = db->getDoubleArray("d_bdry_face_pressure"); -#endif + d_bdry_face_density = db->getDoubleVector("d_bdry_face_density"); + d_bdry_face_velocity = db->getDoubleVector("d_bdry_face_velocity"); + d_bdry_face_pressure = db->getDoubleVector("d_bdry_face_pressure"); + } if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "DENSITY_DEVIATION") { d_density_dev_tol = - db->getDoubleArray("d_density_dev_tol"); + db->getDoubleVector("d_density_dev_tol"); d_density_dev = - db->getDoubleArray("d_density_dev"); + db->getDoubleVector("d_density_dev"); d_density_dev_time_max = - db->getDoubleArray("d_density_dev_time_max"); + db->getDoubleVector("d_density_dev_time_max"); d_density_dev_time_min = - db->getDoubleArray("d_density_dev_time_min"); + db->getDoubleVector("d_density_dev_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_GRADIENT") { d_density_grad_tol = - db->getDoubleArray("d_density_grad_tol"); + db->getDoubleVector("d_density_grad_tol"); d_density_grad_time_max = - db->getDoubleArray("d_density_grad_time_max"); + db->getDoubleVector("d_density_grad_time_max"); d_density_grad_time_min = - db->getDoubleArray("d_density_grad_time_min"); + db->getDoubleVector("d_density_grad_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_SHOCK") { d_density_shock_onset = - db->getDoubleArray("d_density_shock_onset"); + db->getDoubleVector("d_density_shock_onset"); d_density_shock_tol = - db->getDoubleArray("d_density_shock_tol"); + db->getDoubleVector("d_density_shock_tol"); d_density_shock_time_max = - db->getDoubleArray("d_density_shock_time_max"); + db->getDoubleVector("d_density_shock_time_max"); d_density_shock_time_min = - db->getDoubleArray("d_density_shock_time_min"); + db->getDoubleVector("d_density_shock_time_min"); } else if (d_refinement_criteria[i] == "DENSITY_RICHARDSON") { d_density_rich_tol = - db->getDoubleArray("d_density_rich_tol"); + db->getDoubleVector("d_density_rich_tol"); d_density_rich_time_max = - db->getDoubleArray("d_density_rich_time_max"); + db->getDoubleVector("d_density_rich_time_max"); d_density_rich_time_min = - db->getDoubleArray("d_density_rich_time_min"); + db->getDoubleVector("d_density_rich_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_DEVIATION") { d_pressure_dev_tol = - db->getDoubleArray("d_pressure_dev_tol"); + db->getDoubleVector("d_pressure_dev_tol"); d_pressure_dev = - db->getDoubleArray("d_pressure_dev"); + db->getDoubleVector("d_pressure_dev"); d_pressure_dev_time_max = - db->getDoubleArray("d_pressure_dev_time_max"); + db->getDoubleVector("d_pressure_dev_time_max"); d_pressure_dev_time_min = - db->getDoubleArray("d_pressure_dev_time_min"); + db->getDoubleVector("d_pressure_dev_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_GRADIENT") { d_pressure_grad_tol = - db->getDoubleArray("d_pressure_grad_tol"); + db->getDoubleVector("d_pressure_grad_tol"); d_pressure_grad_time_max = - db->getDoubleArray("d_pressure_grad_time_max"); + db->getDoubleVector("d_pressure_grad_time_max"); d_pressure_grad_time_min = - db->getDoubleArray("d_pressure_grad_time_min"); + db->getDoubleVector("d_pressure_grad_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_SHOCK") { d_pressure_shock_onset = - db->getDoubleArray("d_pressure_shock_onset"); + db->getDoubleVector("d_pressure_shock_onset"); d_pressure_shock_tol = - db->getDoubleArray("d_pressure_shock_tol"); + db->getDoubleVector("d_pressure_shock_tol"); d_pressure_shock_time_max = - db->getDoubleArray("d_pressure_shock_time_max"); + db->getDoubleVector("d_pressure_shock_time_max"); d_pressure_shock_time_min = - db->getDoubleArray("d_pressure_shock_time_min"); + db->getDoubleVector("d_pressure_shock_time_min"); } else if (d_refinement_criteria[i] == "PRESSURE_RICHARDSON") { d_pressure_rich_tol = - db->getDoubleArray("d_pressure_rich_tol"); + db->getDoubleVector("d_pressure_rich_tol"); d_pressure_rich_time_max = - db->getDoubleArray("d_pressure_rich_time_max"); + db->getDoubleVector("d_pressure_rich_time_max"); d_pressure_rich_time_min = - db->getDoubleArray("d_pressure_rich_time_min"); + db->getDoubleVector("d_pressure_rich_time_min"); } @@ -4309,44 +4448,51 @@ void Euler::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif -#if (NDIM == 2) - readStateDataEntry(db, - db_name, - bdry_location_index, - d_bdry_edge_density, - d_bdry_edge_velocity, - d_bdry_edge_pressure); -#endif -#if (NDIM == 3) - readStateDataEntry(db, - db_name, - bdry_location_index, - d_bdry_face_density, - d_bdry_face_velocity, - d_bdry_face_pressure); -#endif + + if (d_dim == tbox::Dimension(2)) { + readStateDataEntry(db, + db_name, + bdry_location_index, + d_bdry_edge_density, + d_bdry_edge_velocity, + d_bdry_edge_pressure); + } + if (d_dim == tbox::Dimension(3)) { + readStateDataEntry(db, + db_name, + bdry_location_index, + d_bdry_face_density, + d_bdry_face_velocity, + d_bdry_face_pressure); + } +} + +void Euler::readNeumannBoundaryDataEntry( + const boost::shared_ptr& db, + string& db_name, + int bdry_location_index) +{ + NULL_USE(db); + NULL_USE(db_name); + NULL_USE(bdry_location_index); } void Euler::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& density, - tbox::Array& velocity, - tbox::Array& pressure) + std::vector& density, + std::vector& velocity, + std::vector& pressure) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(density.getSize() > array_indx); - TBOX_ASSERT(velocity.getSize() > array_indx * NDIM); - TBOX_ASSERT(pressure.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(density.size()) > array_indx); + TBOX_ASSERT(static_cast(velocity.size()) > array_indx * d_dim.getValue()); + TBOX_ASSERT(static_cast(pressure.size()) > array_indx); if (db->keyExists("density")) { density[array_indx] = db->getDouble("density"); @@ -4356,16 +4502,15 @@ void Euler::readStateDataEntry( << " input database. " << endl); } if (db->keyExists("velocity")) { - tbox::Array tmp_vel(0); - tmp_vel = db->getDoubleArray("velocity"); - if (tmp_vel.getSize() < NDIM) { + std::vector tmp_vel = db->getDoubleVector("velocity"); + if (static_cast(tmp_vel.size()) < d_dim.getValue()) { TBOX_ERROR(d_object_name << ": " << "Insufficient number `velocity' values" << " given in " << db_name << " input database." << endl); } - for (int iv = 0; iv < NDIM; iv++) { - velocity[array_indx * NDIM + iv] = tmp_vel[iv]; + for (int iv = 0; iv < d_dim.getValue(); ++iv) { + velocity[array_indx * d_dim.getValue() + iv] = tmp_vel[iv]; } } else { TBOX_ERROR(d_object_name << ": " @@ -4393,121 +4538,112 @@ void Euler::readStateDataEntry( void Euler::checkBoundaryData( int btype, const hier::Patch& patch, - const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds, - const tbox::Array& vector_bconds) const + const hier::IntVector& ghost_width_to_check, + const std::vector& scalar_bconds, + const std::vector& vector_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS -#if (NDIM == 2) - TBOX_ASSERT(btype == EDGE2D_BDRY_TYPE || - btype == NODE2D_BDRY_TYPE); -#endif -#if (NDIM == 3) - TBOX_ASSERT(btype == FACE3D_BDRY_TYPE || - btype == EDGE3D_BDRY_TYPE || - btype == NODE3D_BDRY_TYPE); -#endif + if (d_dim == tbox::Dimension(2)) { + TBOX_ASSERT(btype == Bdry::EDGE2D || btype == Bdry::NODE2D); + } + if (d_dim == tbox::Dimension(3)) { + TBOX_ASSERT(btype == Bdry::FACE3D || btype == Bdry::EDGE3D || btype == Bdry::NODE3D); + } #endif const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - const tbox::Array bdry_boxes = + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); - int bscalarcase, bvelocitycase, refbdryloc; -#if (NDIM == 2) - if (btype == EDGE2D_BDRY_TYPE) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_2D_EDGES); -#endif - bscalarcase = scalar_bconds[bloc]; - bvelocitycase = vector_bconds[bloc]; - refbdryloc = bloc; - } else { // btype == NODE2D_BDRY_TYPE -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_2D_NODES); -#endif - bscalarcase = scalar_bconds[bloc]; - bvelocitycase = vector_bconds[bloc]; - refbdryloc = d_node_bdry_edge[bloc]; + int bscalarcase = 0; + int bvelocitycase = 0; + int refbdryloc = 0; + if (d_dim == tbox::Dimension(2)) { + if (btype == Bdry::EDGE2D) { + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_EDGES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_2D_EDGES); + + bscalarcase = scalar_bconds[bloc]; + bvelocitycase = vector_bconds[bloc]; + refbdryloc = bloc; + } else { // btype == Bdry::NODE2D + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_2D_NODES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_2D_NODES); + + bscalarcase = scalar_bconds[bloc]; + bvelocitycase = vector_bconds[bloc]; + refbdryloc = d_node_bdry_edge[bloc]; + } } -#endif -#if (NDIM == 3) - if (btype == FACE3D_BDRY_TYPE) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_FACES); -#endif - bscalarcase = scalar_bconds[bloc]; - bvelocitycase = vector_bconds[bloc]; - refbdryloc = bloc; - } else if (btype == EDGE3D_BDRY_TYPE) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_EDGES); -#endif - bscalarcase = scalar_bconds[bloc]; - bvelocitycase = vector_bconds[bloc]; - refbdryloc = d_edge_bdry_face[bloc]; - } else { // btype == NODE3D_BDRY_TYPE -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); - TBOX_ASSERT(vector_bconds.getSize() == NUM_3D_NODES); -#endif - bscalarcase = scalar_bconds[bloc]; - bvelocitycase = vector_bconds[bloc]; - refbdryloc = d_node_bdry_face[bloc]; + if (d_dim == tbox::Dimension(3)) { + if (btype == Bdry::FACE3D) { + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_FACES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_FACES); + + bscalarcase = scalar_bconds[bloc]; + bvelocitycase = vector_bconds[bloc]; + refbdryloc = bloc; + } else if (btype == Bdry::EDGE3D) { + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_EDGES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_EDGES); + + bscalarcase = scalar_bconds[bloc]; + bvelocitycase = vector_bconds[bloc]; + refbdryloc = d_edge_bdry_face[bloc]; + } else { // btype == Bdry::NODE3D + TBOX_ASSERT(static_cast(scalar_bconds.size()) == + NUM_3D_NODES); + TBOX_ASSERT(static_cast(vector_bconds.size()) == + NUM_3D_NODES); + + bscalarcase = scalar_bconds[bloc]; + bvelocitycase = vector_bconds[bloc]; + refbdryloc = d_node_bdry_face[bloc]; + } } -#endif - - int num_bad_values = 0; - NULL_USE(num_bad_values); -#if (NDIM == 2) - num_bad_values = + if (d_dim == tbox::Dimension(2)) { appu::CartesianBoundaryUtilities2::checkBdryData( d_density->getName(), patch, - vdb->mapVariableAndContextToIndex(d_density, getDataContext()), 0, + vdb->mapVariableAndContextToIndex(d_density, getDataContext()), + 0, ghost_width_to_check, bbox, bscalarcase, d_bdry_edge_density[refbdryloc]); -#endif -#if (NDIM == 3) - num_bad_values = + } + if (d_dim == tbox::Dimension(3)) { appu::CartesianBoundaryUtilities3::checkBdryData( d_density->getName(), patch, - vdb->mapVariableAndContextToIndex(d_density, getDataContext()), 0, + vdb->mapVariableAndContextToIndex(d_density, getDataContext()), + 0, ghost_width_to_check, bbox, bscalarcase, d_bdry_face_density[refbdryloc]); -#endif -#if (TESTING == 1) - if (num_bad_values > 0) { - tbox::perr << "\nEuler Boundary Test FAILED: \n" - << " " << num_bad_values - << " bad DENSITY values found for\n" - << " boundary type " << btype << " at location " - << bloc << endl; } -#endif -#if (NDIM == 2) - num_bad_values = + if (d_dim == tbox::Dimension(2)) { appu::CartesianBoundaryUtilities2::checkBdryData( d_pressure->getName(), patch, @@ -4517,9 +4653,8 @@ void Euler::checkBoundaryData( bbox, bscalarcase, d_bdry_edge_density[refbdryloc]); -#endif -#if (NDIM == 3) - num_bad_values = + } + if (d_dim == tbox::Dimension(3)) { appu::CartesianBoundaryUtilities3::checkBdryData( d_pressure->getName(), patch, @@ -4529,51 +4664,41 @@ void Euler::checkBoundaryData( bbox, bscalarcase, d_bdry_face_density[refbdryloc]); -#endif -#if (TESTING == 1) - if (num_bad_values > 0) { - tbox::perr << "\nEuler Boundary Test FAILED: \n" - << " " << num_bad_values - << " bad PRESSURE values found for\n" - << " boundary type " << btype << " at location " - << bloc << endl; } -#endif - for (int idir = 0; idir < NDIM; idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { int vbcase = bscalarcase; -#if (NDIM == 2) - if (btype == EDGE2D_BDRY_TYPE) { - if ((idir == 0 && (bloc == XLO || bloc == XHI)) || - (idir == 1 && (bloc == YLO || bloc == YHI))) { - vbcase = bvelocitycase; - } - } else if (btype == NODE2D_BDRY_TYPE) { - if ((idir == 0 && bvelocitycase == XREFLECT_BC) || - (idir == 1 && bvelocitycase == YREFLECT_BC)) { - vbcase = bvelocitycase; + if (d_dim == tbox::Dimension(2)) { + if (btype == Bdry::EDGE2D) { + if ((idir == 0 && (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI)) || + (idir == 1 && (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI))) { + vbcase = bvelocitycase; + } + } else if (btype == Bdry::NODE2D) { + if ((idir == 0 && bvelocitycase == BdryCond::XREFLECT) || + (idir == 1 && bvelocitycase == BdryCond::YREFLECT)) { + vbcase = bvelocitycase; + } } } -#endif -#if (NDIM == 3) - if (btype == FACE3D_BDRY_TYPE) { - if ((idir == 0 && (bloc == XLO || bloc == XHI)) || - (idir == 1 && (bloc == YLO || bloc == YHI)) || - (idir == 2 && (bloc == ZLO || bloc == ZHI))) { - vbcase = bvelocitycase; - } - } else if (btype == EDGE3D_BDRY_TYPE || btype == NODE3D_BDRY_TYPE) { - if ((idir == 0 && bvelocitycase == XREFLECT_BC) || - (idir == 1 && bvelocitycase == YREFLECT_BC) || - (idir == 2 && bvelocitycase == ZREFLECT_BC)) { - vbcase = bvelocitycase; + if (d_dim == tbox::Dimension(3)) { + if (btype == Bdry::FACE3D) { + if ((idir == 0 && (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI)) || + (idir == 1 && (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI)) || + (idir == 2 && (bloc == BdryLoc::ZLO || bloc == BdryLoc::ZHI))) { + vbcase = bvelocitycase; + } + } else if (btype == Bdry::EDGE3D || btype == Bdry::NODE3D) { + if ((idir == 0 && bvelocitycase == BdryCond::XREFLECT) || + (idir == 1 && bvelocitycase == BdryCond::YREFLECT) || + (idir == 2 && bvelocitycase == BdryCond::ZREFLECT)) { + vbcase = bvelocitycase; + } } } -#endif -#if (NDIM == 2) - num_bad_values = + if (d_dim == tbox::Dimension(2)) { appu::CartesianBoundaryUtilities2::checkBdryData( d_velocity->getName(), patch, @@ -4582,10 +4707,9 @@ void Euler::checkBoundaryData( ghost_width_to_check, bbox, vbcase, - d_bdry_edge_velocity[refbdryloc * NDIM + idir]); -#endif -#if (NDIM == 3) - num_bad_values = + d_bdry_edge_velocity[refbdryloc * d_dim.getValue() + idir]); + } + if (d_dim == tbox::Dimension(3)) { appu::CartesianBoundaryUtilities3::checkBdryData( d_velocity->getName(), patch, @@ -4594,18 +4718,8 @@ void Euler::checkBoundaryData( ghost_width_to_check, bbox, vbcase, - d_bdry_face_velocity[refbdryloc * NDIM + idir]); -#endif -#if (TESTING == 1) - if (num_bad_values > 0) { - tbox::perr << "\nEuler Boundary Test FAILED: \n" - << " " << num_bad_values - << " bad VELOCITY values found in direction " << idir - << " for\n" - << " boundary type " << btype << " at location " - << bloc << endl; + d_bdry_face_velocity[refbdryloc * d_dim.getValue() + idir]); } -#endif } } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.h b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.h index 39111305..e69c0710 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Euler.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in Euler equation ex. * ************************************************************************/ @@ -13,14 +13,14 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/MessageStream.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/hier/VariableContext.h" +#include "SAMRAI/appu/VisDerivedDataStrategy.h" +#include "SAMRAI/appu/VisItDataWriter.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/appu/BoundaryUtilityStrategy.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Database.h" #include "SAMRAI/pdat/FaceData.h" #include "SAMRAI/pdat/FaceVariable.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" @@ -29,14 +29,13 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Serializable.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/MessageStream.h" + +#include "boost/shared_ptr.hpp" #include +#include using namespace std; -#define included_String -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/appu/VisItDataWriter.h" - -#include /** * The Euler class provides routines for a sample application code that @@ -76,6 +75,7 @@ class Euler: */ Euler( const string& object_name, + const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom); @@ -151,7 +151,7 @@ class Euler: /** * Compute time integral of fluxes to be used in conservative difference - * for patch integration. When NDIM == 3, this function calls either + * for patch integration. When d_dim == tbox::Dimension(3)), this function calls either * compute3DFluxesWithCornerTransport1(), or * compute3DFluxesWithCornerTransport2() depending on which * transverse flux correction option that is specified in input. @@ -193,8 +193,8 @@ class Euler: tagRichardsonExtrapolationCells( hier::Patch& patch, const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, + const boost::shared_ptr& coarsened_fine, + const boost::shared_ptr& advanced_coarse, const double regrid_time, const double deltat, const int error_coarsen_ratio, @@ -202,11 +202,15 @@ class Euler: const int tag_index, const bool uses_gradient_detector_too); + //@{ + //! @name Required implementations of HyperbolicPatchStrategy pure virtuals. + /// /// The following routines: /// /// setPhysicalBoundaryConditions(), /// getRefineOpStencilWidth(), + /// preprocessRefine() /// postprocessRefine() /// /// are concrete implementations of functions declared in the @@ -222,14 +226,27 @@ class Euler: setPhysicalBoundaryConditions( hier::Patch& patch, const double fill_time, - const hier::IntVector& + const hier::IntVector& ghost_width_to_fill); /** * Return stencil width of conservative linear interpolation operations. */ - hier::IntVector - getRefineOpStencilWidth() const; + hier::IntVector + getRefineOpStencilWidth( + const tbox::Dimension& dim) const; + + void + preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } /** * Refine velocity and pressure from coarse patch to fine patch @@ -240,12 +257,13 @@ class Euler: hier::Patch& fine, const hier::Patch& coarse, const hier::Box& fine_box, - const hier::IntVector& ratio); + const hier::IntVector& ratio); /// /// The following routines: /// /// getCoarsenOpStencilWidth(), + /// preprocessCoarsen() /// postprocessCoarsen() /// /// are concrete implementations of functions declared in the @@ -255,8 +273,21 @@ class Euler: /** * Return stencil width of conservative averaging operations. */ - hier::IntVector - getCoarsenOpStencilWidth() const; + hier::IntVector + getCoarsenOpStencilWidth( + const tbox::Dimension& dim) const; + + void + preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } /** * Coarsen velocity and pressure from coarse patch to fine patch @@ -267,7 +298,9 @@ class Euler: hier::Patch& coarse, const hier::Patch& fine, const hier::Box& coarse_box, - const hier::IntVector& ratio); + const hier::IntVector& ratio); + + //@} /** * Write state of Euler object to the given database for restart. @@ -276,8 +309,8 @@ class Euler: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -293,6 +326,17 @@ class Euler: string& db_name, int bdry_location_index); + /** + * This routine is a concrete implementation of the virtual function + * in the base class BoundaryUtilityStrategy. It is a blank implementation + * for the purposes of this class. + */ + void + readNeumannBoundaryDataEntry( + const boost::shared_ptr& db, + string& db_name, + int bdry_location_index); + /** * Register a VisIt data writer so this class will write * plot files that may be postprocessed with the VisIt @@ -305,20 +349,21 @@ class Euler: #endif /** - * This routine is a concrete implementation of the virtual - * function in the base class appu::VisDerivedDataStrategy. - * It computes derived plot quantities registered with the VisIt - * data writer from data that is maintained on each patch in the + * This routine is a concrete implementation of the virtual function + * in the base class appu::VisDerivedDataStrategy. It computes derived + * plot quantities registered with the VisIt data + * writers from data that is maintained on each patch in the * hierarchy. In particular, it writes the plot quantity - * identified by the string variable name to the specified double - * buffer on the patch in the given region. The depth_id integer - * argument indicates which entry in the "depth" of the vector is - * being written; for a scalar quantity, this may be ignored. For - * a vector quantity, it may be used to compute the quantity at the - * particular depth (e.g. mom[depth_id] = rho * vel[depth_id]). - * The boolean return value specifies whether or not derived data - * exists on the patch. Generally, this will be TRUE. If the - * derived data does NOT exist on the patch, return FALSE. + * identified by the string variable name to the specified + * double buffer on the patch in the given region. The depth_id + * integer argument indicates which entry in the "depth" of the + * vector is being written; for a scalar quantity, this may be + * ignored. For a vector quantity, it may be used to compute + * the quantity at the particular depth (e.g. mom[depth_id] = + * rho * vel[depth_id]). The boolean return value specifies + * whether or not derived data exists on the patch. Generally, + * this will be TRUE. If the derived data does NOT exist on + * the patch, return FALSE. */ bool packDerivedDataIntoDoubleBuffer( @@ -326,7 +371,8 @@ class Euler: const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; /// /// The following routines are specific to the Euler class and @@ -360,7 +406,7 @@ class Euler: writeData1dPencil( const boost::shared_ptr patch, const hier::Box& pencil_box, - const int idir, + const tbox::Dimension::dir_t idir, ostream& file); private: @@ -375,7 +421,7 @@ class Euler: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void getFromRestart(); @@ -385,9 +431,9 @@ class Euler: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& density, - tbox::Array& velocity, - tbox::Array& pressure); + std::vector& density, + std::vector& velocity, + std::vector& pressure); /* * Private member function to check correctness of boundary data. @@ -396,9 +442,9 @@ class Euler: checkBoundaryData( int btype, const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds, - const tbox::Array& vector_bconds) const; + const hier::IntVector& ghost_width_to_fill, + const std::vector& scalar_bconds, + const std::vector& vector_bconds) const; /* * Three-dimensional flux computation routines corresponding to @@ -427,11 +473,17 @@ class Euler: * plot context passed to the variable registration routine. */ boost::shared_ptr d_grid_geometry; + #ifdef HAVE_HDF5 boost::shared_ptr d_visit_writer; #endif boost::shared_ptr d_plot_context; + /* + * Problem dimension. + */ + const tbox::Dimension d_dim; + /* * Data items used for nonuniform load balance, if used. */ @@ -477,8 +529,8 @@ class Euler: int d_riemann_solve_int; int d_godunov_order; string d_corner_transport; - hier::IntVector d_nghosts; - hier::IntVector d_fluxghosts; + hier::IntVector d_nghosts; + hier::IntVector d_fluxghosts; /* * Indicator for problem type and initial conditions @@ -490,22 +542,22 @@ class Euler: * Input for SPHERE problem */ double d_radius; - double d_center[NDIM]; + double d_center[SAMRAI::MAX_DIM_VAL]; double d_density_inside; - double d_velocity_inside[NDIM]; + double d_velocity_inside[SAMRAI::MAX_DIM_VAL]; double d_pressure_inside; double d_density_outside; - double d_velocity_outside[NDIM]; + double d_velocity_outside[SAMRAI::MAX_DIM_VAL]; double d_pressure_outside; /* * Input for PIECEWISE_CONSTANT_* and STEP problems */ int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_density; - tbox::Array d_interval_velocity; - tbox::Array d_interval_pressure; + std::vector d_front_position; + std::vector d_interval_density; + std::vector d_interval_velocity; + std::vector d_interval_pressure; /* * Boundary condition cases and boundary values. @@ -514,83 +566,71 @@ class Euler: * * Input file values are read into these arrays. */ - tbox::Array d_master_bdry_edge_conds; - tbox::Array d_master_bdry_node_conds; -#if (NDIM == 3) - tbox::Array d_master_bdry_face_conds; -#endif + std::vector d_master_bdry_edge_conds; + std::vector d_master_bdry_node_conds; + std::vector d_master_bdry_face_conds; // Used in 3D only. /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_vector_bdry_edge_conds; + std::vector d_scalar_bdry_edge_conds; + std::vector d_vector_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_vector_bdry_node_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_vector_bdry_node_conds; -#if (NDIM == 3) - tbox::Array d_scalar_bdry_face_conds; - tbox::Array d_vector_bdry_face_conds; -#endif + std::vector d_scalar_bdry_face_conds; // Used in 3D only. + std::vector d_vector_bdry_face_conds; // Used in 3D only. -#if (NDIM == 2) - tbox::Array d_node_bdry_edge; -#endif -#if (NDIM == 3) - tbox::Array d_edge_bdry_face; - tbox::Array d_node_bdry_face; -#endif + std::vector d_node_bdry_edge; // Used in 2D only. + std::vector d_edge_bdry_face; // Used in 3D only. + std::vector d_node_bdry_face; // Used in 3D only. /* * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. */ -#if (NDIM == 2) - tbox::Array d_bdry_edge_density; - tbox::Array d_bdry_edge_velocity; - tbox::Array d_bdry_edge_pressure; -#endif -#if (NDIM == 3) - tbox::Array d_bdry_face_density; - tbox::Array d_bdry_face_velocity; - tbox::Array d_bdry_face_pressure; -#endif + std::vector d_bdry_edge_density; // Used in 2D only. + std::vector d_bdry_edge_velocity; // Used in 2D only. + std::vector d_bdry_edge_pressure; // Used in 2D only. + std::vector d_bdry_face_density; // Used in 3D only. + std::vector d_bdry_face_velocity; // Used in 3D only. + std::vector d_bdry_face_pressure; // Used in 3D only. /* * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_density_dev_tol; - tbox::Array d_density_dev; - tbox::Array d_density_dev_time_max; - tbox::Array d_density_dev_time_min; - tbox::Array d_density_grad_tol; - tbox::Array d_density_grad_time_max; - tbox::Array d_density_grad_time_min; - tbox::Array d_density_shock_onset; - tbox::Array d_density_shock_tol; - tbox::Array d_density_shock_time_max; - tbox::Array d_density_shock_time_min; - tbox::Array d_density_rich_tol; - tbox::Array d_density_rich_time_max; - tbox::Array d_density_rich_time_min; - tbox::Array d_pressure_dev_tol; - tbox::Array d_pressure_dev; - tbox::Array d_pressure_dev_time_max; - tbox::Array d_pressure_dev_time_min; - tbox::Array d_pressure_grad_tol; - tbox::Array d_pressure_grad_time_max; - tbox::Array d_pressure_grad_time_min; - tbox::Array d_pressure_shock_onset; - tbox::Array d_pressure_shock_tol; - tbox::Array d_pressure_shock_time_max; - tbox::Array d_pressure_shock_time_min; - tbox::Array d_pressure_rich_tol; - tbox::Array d_pressure_rich_time_max; - tbox::Array d_pressure_rich_time_min; + std::vector d_refinement_criteria; + std::vector d_density_dev_tol; + std::vector d_density_dev; + std::vector d_density_dev_time_max; + std::vector d_density_dev_time_min; + std::vector d_density_grad_tol; + std::vector d_density_grad_time_max; + std::vector d_density_grad_time_min; + std::vector d_density_shock_onset; + std::vector d_density_shock_tol; + std::vector d_density_shock_time_max; + std::vector d_density_shock_time_min; + std::vector d_density_rich_tol; + std::vector d_density_rich_time_max; + std::vector d_density_rich_time_min; + std::vector d_pressure_dev_tol; + std::vector d_pressure_dev; + std::vector d_pressure_dev_time_max; + std::vector d_pressure_dev_time_min; + std::vector d_pressure_grad_tol; + std::vector d_pressure_grad_time_max; + std::vector d_pressure_grad_time_min; + std::vector d_pressure_shock_onset; + std::vector d_pressure_shock_tol; + std::vector d_pressure_shock_time_max; + std::vector d_pressure_shock_time_min; + std::vector d_pressure_rich_tol; + std::vector d_pressure_rich_time_max; + std::vector d_pressure_rich_time_min; /* * Timers. diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/EulerFort.h b/base/SAMRAI/SAMRAI/source/test/performance/Euler/EulerFort.h index 8a610d3c..d8637ab5 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/EulerFort.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/EulerFort.h @@ -3,94 +3,132 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI Euler gas dynamics ex. * ************************************************************************/ extern "C" { -void F77_FUNC(eulerinit, EULERINIT) ( +void SAMRAI_F77_FUNC(eulerinit2d, EULERINIT2D) ( + const int&, const double *, const double *, const double *, + const int&, const int&, + const int&, const int&, + const int&, + const int&, + const double&, + double *, double *, double *, + const int&, + const double *, + const double *, const double *, const double *); + +void SAMRAI_F77_FUNC(eulerinit3d, EULERINIT3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const int&, -#if (NDIM > 2) const int&, -#endif const double&, double *, double *, double *, const int&, const double *, const double *, const double *, const double *); -void F77_FUNC(eulerinitsphere, EULERINITSPHERE) ( +void SAMRAI_F77_FUNC(eulerinitsphere2d, EULERINITSPHERE2D) ( + const int&, const double *, const double *, const double *, + const int&, const int&, + const int&, const int&, + const int&, + const int&, + const double&, + double *, double *, double *, + const double&, const double *, const double&, + const double&, const double *, const double&, + const double *, const double&); + +void SAMRAI_F77_FUNC(eulerinitsphere3d, EULERINITSPHERE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const int&, -#if (NDIM > 2) const int&, -#endif const double&, double *, double *, double *, const double&, const double *, const double&, const double&, const double *, const double&, const double *, const double&); -void F77_FUNC(stabledt, STABLEDT) ( +void SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) ( + const double *, + const int&, const int&, + const int&, const int&, + const int&, + const int&, + const double&, + const double *, const double *, const double *, double&); + +void SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const int&, -#if (NDIM > 2) const int&, -#endif const double&, const double *, const double *, const double *, double&); -void F77_FUNC(inittraceflux, INITTRACEFLUX) ( +void SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( + const int&, const int&, + const int&, const int&, + const double *, const double *, const double *, + double *, double *, double *, + double *, double *, double *); + +void SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const double *, const double *, const double *, double *, double *, double *, -#if (NDIM > 2) double *, double *, double *, -#endif double *, double *, double *); -void F77_FUNC(computesound, COMPUTESOUND) ( +void SAMRAI_F77_FUNC(computesound2d, COMPUTESOUND2D) ( + const int&, const int&, + const int&, const int&, + const double&, + const double *, const double *, const double *, + double *); + +void SAMRAI_F77_FUNC(computesound3d, COMPUTESOUND3D) ( const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const double&, const double *, const double *, const double *, double *); -void F77_FUNC(chartracing0, CHARTRACING0) ( +void SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) ( + const double&, + const int&, const int&, + const int&, const int&, + const int&, const double&, const double&, const int&, + const double *, + double *, double *, + double *, double *, + double *, + double *, double *); + +void SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) ( const double&, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const double&, const double&, const int&, const double *, double *, double *, @@ -98,13 +136,22 @@ void F77_FUNC(chartracing0, CHARTRACING0) ( double *, double *, double *); -void F77_FUNC(chartracing1, CHARTRACING1) ( +void SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) ( + const double&, + const int&, const int&, + const int&, const int&, + const int&, const double&, const double&, const int&, + const double *, + double *, double *, + double *, double *, + double *, + double *, double *); + +void SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) ( const double&, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const double&, const double&, const int&, const double *, double *, double *, @@ -112,8 +159,7 @@ void F77_FUNC(chartracing1, CHARTRACING1) ( double *, double *, double *); -#if (NDIM == 3) -void F77_FUNC(chartracing2, CHARTRACING2) ( +void SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) ( const double&, const int&, const int&, const int&, const int&, @@ -124,31 +170,35 @@ void F77_FUNC(chartracing2, CHARTRACING2) ( double *, double *, double *, double *, double *); -#endif -void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( +void SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( + const double&, const int&, + const int&, + const double *, + const int&, const int&, + const int&, const int&, + const double&, + const int&, + const double *, const double *, const double *, + double *, double *, double *, + double *, double *, double *); + +void SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( const double&, const int&, -#if (NDIM > 2) const int&, -#endif const int&, const double *, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const double&, const int&, const double *, const double *, const double *, -#if (NDIM > 2) double *, double *, double *, -#endif double *, double *, double *, double *, double *, double *); -#if (NDIM == 3) -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double&, const int&, @@ -161,7 +211,7 @@ void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double&, @@ -170,10 +220,8 @@ void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -#endif -#if (NDIM == 2) -void F77_FUNC(fluxcorrec, FLUXCORREC) ( +void SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) ( const double&, const int&, const int&, const int&, const int&, const double *, const double&, @@ -181,25 +229,28 @@ void F77_FUNC(fluxcorrec, FLUXCORREC) ( double *, double *, double *, double *, double *, double *); -#endif -void F77_FUNC(consdiff, CONSDIFF) ( +void SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) ( + const int&, const int&, + const int&, const int&, + const double *, + const double *, + const double *, + const double&, + double *, double *, double *); + +void SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) ( const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const double *, const double *, const double *, -#if (NDIM > 2) const double *, -#endif const double&, double *, double *, double *); -#if (NDIM > 2) -void F77_FUNC(onethirdstate, ONETHIRDSTATE) ( +void SAMRAI_F77_FUNC(onethirdstate, ONETHIRDSTATE) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -207,7 +258,7 @@ void F77_FUNC(onethirdstate, ONETHIRDSTATE) ( const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird, FLUXTHIRD) ( +void SAMRAI_F77_FUNC(fluxthird, FLUXTHIRD) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -215,7 +266,7 @@ void F77_FUNC(fluxthird, FLUXTHIRD) ( const double *, const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( +void SAMRAI_F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, @@ -223,10 +274,8 @@ void F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( const double *, const double *, const double *, double *, double *, double *, double *, double *, double *); -#endif -#if (NDIM == 2) -void F77_FUNC(conservlinint2d, CONSERVLININT2D) ( +void SAMRAI_F77_FUNC(conservlinint2d, CONSERVLININT2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -241,7 +290,7 @@ void F77_FUNC(conservlinint2d, CONSERVLININT2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(conservavg2d, CONSERVAVG2D) ( +void SAMRAI_F77_FUNC(conservavg2d, CONSERVAVG2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -251,9 +300,7 @@ void F77_FUNC(conservavg2d, CONSERVAVG2D) ( const double *, const double *, double *, double *, double *); -#endif -#if (NDIM == 3) -void F77_FUNC(conservlinint3d, CONSERVLININT3D) ( +void SAMRAI_F77_FUNC(conservlinint3d, CONSERVLININT3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -272,7 +319,7 @@ void F77_FUNC(conservlinint3d, CONSERVLININT3D) ( double *, double *, double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(conservavg3d, CONSERVAVG3D) ( +void SAMRAI_F77_FUNC(conservavg3d, CONSERVAVG3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -286,43 +333,56 @@ void F77_FUNC(conservavg3d, CONSERVAVG3D) ( const double *, const double *, double *, double *, double *); -#endif -void F77_FUNC(detectgrad, DETECTGRAD) ( +void SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const double *, + const double&, + const int&, const int&, + const double *, + int *, int *); + +void SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const int&, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, const int&, -#endif const double *, const double&, const int&, const int&, const double *, int *, int *); -void F77_FUNC(detectshock, DETECTSHOCK) ( +void SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const double *, + const double&, const double&, + const int&, const int&, + const double *, + int *, int *); + +void SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, -#endif const int&, const int&, const int&, const int&, const int&, const int&, -#if (NDIM > 2) const int&, const int&, const int&, -#endif const double *, const double&, const double&, const int&, const int&, const double *, int *, int *); -void F77_FUNC(stufprobc, STUFPROBC) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.depend index fcb5a220..74c6e96b 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -36,6 +37,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -47,11 +49,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -59,12 +65,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -74,8 +82,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -98,11 +109,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -114,9 +125,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -140,10 +152,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h Euler.C Euler.h\ EulerFort.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -157,24 +169,22 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=intToString.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h intToString.C \ intToString.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=main.o DEPENDS_2:=\ @@ -182,6 +192,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ @@ -189,6 +200,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -198,6 +210,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -209,7 +222,10 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -221,30 +237,34 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -268,12 +288,12 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -288,14 +308,16 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SiloDatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ @@ -314,12 +336,10 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h Euler.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -332,10 +352,9 @@ DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.in index 348dfed6..10ac05ef 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/Makefile.in @@ -3,105 +3,121 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for Euler gas dynamics sample application ## ######################################################################### -# TODO sample_input should be renamed to example input or removed? - SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ SUBDIR = source/test/performance/Euler -VPATH = @top_srcdir@/$(SUBDIR) +VPATH = @srcdir@ +TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml -default: main3d +default: main include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DDISPLAY -DNDIM=$(PDIM) -DTESTING=0 +SUBDIRS = fortran -CXX_OBJS = main.o Euler.o -F2D_OBJS = avgint.o flaten1d.o flux.o grad.o init.o stable.o \ - stufprobc.o trace.o trace1d.o -F3D_OBJS = $(F2D_OBJS) fluxcorner.o +CPPFLAGS_EXTRA= + +NUM_TESTS = 0 -NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +PERF_NPROCS = 16,32,64 -main2d: - if test -f stamp-3d; then $(MAKE) clean; fi - touch stamp-2d - $(MAKE) PDIM=2 main-2d +CXX_OBJS = main.o Euler.o +F_OBJS = \ + fortran/avgint2d.o fortran/flaten1d2d.o fortran/flux2d.o \ + fortran/grad2d.o fortran/init2d.o fortran/stable2d.o \ + fortran/stufprobc.o fortran/trace2d.o fortran/trace1d2d.o \ + fortran/avgint3d.o fortran/flaten1d3d.o fortran/flux3d.o \ + fortran/grad3d.o fortran/init3d.o fortran/stable3d.o \ + fortran/trace3d.o fortran/trace1d3d.o fortran/fluxcorner3d.o -main-2d: $(CXX_OBJS) $(F2D_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F2D_OBJS) \ - $(LIBSAMRAI2D) $(LIBSAMRAI) $(LDLIBS) -o main2d +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ + $(LIBSAMRAI) $(LDLIBS) -o main -main3d: - if test -f stamp-2d; then $(MAKE) clean; fi - touch stamp-3d - $(MAKE) PDIM=3 main-3d +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/avgint2d.o: -main-3d: $(CXX_OBJS) $(F3D_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F3D_OBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main3d +fortran/flaten1d2d.o: -clean: - $(SAMCLEAN) - $(RM) *.f main2d main3d +fortran/flux2d.o: -redo: - $(RM) main2d main3d core *.ii *.int.c - $(RM) -r ti_files ii_files +fortran/grad2d.o: -include $(SRCDIR)/Makefile.depend +fortran/init2d.o: + +fortran/stable2d.o: + +fortran/stufprobc.o: + +fortran/trace2d.o: + +fortran/trace1d2d.o: -FORTRAN = fortran/$(PDIM)d -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +fortran/avgint3d.o: -avgint.o: $(FORTRAN)/avgint.m4 - $(M4) $(M4DIRS) $(FORTRAN)/avgint.m4 > avgint.f - $(F77) $(FFLAGS) -c avgint.f -o $@ +fortran/flaten1d3d.o: -flaten1d.o: $(FORTRAN)/flaten1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flaten1d.m4 > flaten1d.f - $(F77) $(FFLAGS) -c flaten1d.f -o $@ +fortran/flux3d.o: -flux.o: $(FORTRAN)/flux.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux.m4 > flux.f - $(F77) $(FFLAGS) -c flux.f -o $@ +fortran/grad3d.o: -fluxcorner.o: $(FORTRAN)/fluxcorner.m4 - $(M4) -B8096 $(M4DIRS) $(FORTRAN)/fluxcorner.m4 > fluxcorner.f - $(F77) $(FFLAGS) -c fluxcorner.f -o $@ +fortran/init3d.o: -grad.o: $(FORTRAN)/grad.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad.m4 > grad.f - $(F77) $(FFLAGS) -c grad.f -o $@ +fortran/stable3d.o: -init.o: $(FORTRAN)/init.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init.m4 > init.f - $(F77) $(FFLAGS) -c init.f -o $@ +fortran/trace3d.o: -stable.o: $(FORTRAN)/stable.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable.m4 > stable.f - $(F77) $(FFLAGS) -c stable.f -o $@ +fortran/trace1d3d.o: -stufprobc.o: $(FORTRAN)/../stufprobc.m4 - $(M4) $(M4DIRS) $(FORTRAN)/../stufprobc.m4 > stufprobc.f - $(F77) $(FFLAGS) -c stufprobc.f -o $@ +fortran/fluxcorner3d.o: -trace.o: $(FORTRAN)/trace.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace.m4 > trace.f - $(F77) $(FFLAGS) -c trace.f -o $@ +testlib: + cd $(TESTLIBDIR) && $(MAKE) library -trace1d.o: $(FORTRAN)/trace1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace1d.m4 > trace1d.f - $(F77) $(FFLAGS) -c trace1d.f -o $@ +check: -m2d: - rm -f *.o main2d && $(MAKE) main2d -m3d: - rm -f *.o main3d && $(MAKE) main3d +checkcompile: main + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: main + @for i in performance_inputs/mEuler/*.input ; do \ + $(OBJECT)/config/serpa-run $(PERF_NPROCS) \ + ./main $${i}; \ + done + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.timing* + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + +redo: + $(RM) main core *.ii *.int.c + $(RM) ti_files ii_files + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/README b/base/SAMRAI/SAMRAI/source/test/performance/Euler/README index 59de900e..37a33c7b 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/README +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Euler Equation Example ## ######################################################################### @@ -17,7 +17,7 @@ are as follows: Euler example and which are called from SAMRAI AMR library routines EulerFort.h - header file defining external fortran routines - fortran/2d,3d - Fortran numerical routines for 2d,3d problems, resp. + fortran - Fortran numerical routines for 2d and 3d problems To understand the construction of this application code from pieces specific to the Euler model and more generic pieces in the SAMRAI @@ -25,712 +25,23 @@ library consider the object construction pattern in the main.C file. For more details on these files and the Euler class consult the comments in those files and the Euler.h class header file. -COMPILE and RUN ---------------- -Compile: make where = "main2d" for 2D case - = "main3d" for 3D case +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main -Run: - - main2d ... Serial run (w/o MPI) - mpirun -np main2d ... Parallel run (with MPI) - - NOTE: is the FULL-PATH of the input file - - There are sample input files in the subdirectory sample_input. - - example: - main2d sample_input/room-2d.input - mpirun -np 2 main2d sample_input/room-2d.input - -Restarted Run: - - same format as regular run but add - to end of command. - is directory where restart files are stored - (set in input file). - is the identifier of which restart file to use - (generally the timestep). - - example: (to start from timestep #5) - - main2d sample_input/room-2d.input restart_room-2d 5 - mpirun -np 2 main2d sample_input/room-2d.input restart_room-2d 5 - - NOTE: The ordinary use of our restart functionality requires that - a problem can only be restarted on on the same number of - processors on which the problem was originally run. To restart - on a different number of processors, use the - restart-redistribute tool in SAMRAI/tools/restart. + Execution: + For the input files in the performance_inputs/mEuler directory + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main INPUT FILES: ------------ - sphere-2d-re.input - exploding 2D sphere, uses Richardson extrapolation. - step-2d.input - supersonic flow over a step - step-2d-5levels.input - supersonic flow over a step - - - Three example input files are included with the Euler application: - - sample_input/box-3d.input ... exploding 3D sphere with large initial - pressure differences inside a cube. - sample_input/room-2d.input ... exploding 2D sphere with large pressure - differences at time zero, in a room with - fixed boundaries. Room denoted with set of - boxes to define the computational region. - sample_input/room-3d.input ... 3d version of above. - sample_input/ - sphere-2d-re.input ... exploding 2D sphere, using Richardson - extrapolation. - sample_input/step-2d.input ... 2d supersonic flow over a step. - sample_input/ - step-2d-5levels.input ... as above but with 5 levels. - - The Euler application code is composed of various classes that implement - the algorithmic and numerical routines in the AMR solution process (see - comments in the main.C code for more discussion of the various objects - used to build the application). User-specified inputs control the - behavior of the objects. Those objects expecting input are: - - Main program .... creates objects used in the simulation - controls output - of viz and restart information. - - Euler ........... defines variables and provides numerical kernels for - Euler problem, including data initialization, time - integration, boundary routines, etc. - - CartesianGeometry ..... manages Cartesian grid coordinate system - on AMR patch hierarchy. - - GriddingAlgorithm ..... constructs AMR patch hierarchy and - regrids levels during simulation. - - - StandardTagAndInitialize .... manages tagging and initialization during - regridding operation. - - HyperbolicLevelIntegrator ... manages time integration and data management - on levels in AMR patch hierarchy. - - TimeRefinementIntegrator .... orchestrates time integration and - regridding on levels in AMR patch hierarchy. - - LoadBalancer .... manages mapping of patches to processors. - - DataWriter .... specifies variables to write for visualization. - - TimerManager ..... controls timers used that measure performance of - sections of code. - - The input options for these objects are discussed below. The TYPE is - shown in (parenthesis) and the DEFAULT setting (value set if no input - is given) for the option is shown in [brackets]. Required inputs are - designated by [REQD]. - - "Main" input section - -------------------- - Main { - // Log file where output is directed - // log_file_name -- (char string) name of log file ["euler.log"] - // log_all_nodes -- (bool) option to specify whether output on different - // processors should be directed to multiple log files - // (named "log_file_name.") or to the - // single file. [FALSE] - log_file_name = "room-2d.log" - log_all_nodes = TRUE - - // Visualization dump parameters. - // viz_writer -- (char string [, char string]) which visualization - // data writer to use. Use "VisIt" for the VisIt Data - // Writer, or "Vizamrai" for the Vizamrai Data Writer, - / or "VisIt", "Vizamrai" for both. - // viz_dump_interval -- (int) the interval in timesteps over coarsest - // level between writing of consecutive - // visualization dumps. Setting it to zero turns off - // writing of visualization files. - // viz_dump_dirname -- (char string) directory where viz files are - // writen (may include a path). VisIt requires a - // non-empty string. Vizamrai permits an empty string, - // in which case dumps go to directory where main2d/3d - // exists. If both data writers are used, directory name - // must be nonempty, and main.C will append _VisIt, - // _Vizamrai to dirname. - // viz_dump_filename -- (char string) Nonempty file prefix required for - // vizamrai filenames. Not used by VisIt. - // visit_number_procs_per_file - // -- (int >= 1) for parallel runs, number of processors - // that share a single common dump file. If this parameter - // > number processors being used, all processors share - // single dump file. Not used by Vizamrai. - // - // For example, the following inputs: - viz_writer = "Vizamrai", "VisIt" - viz_dump_interval = 1 - viz_dump_dirname = "viz_room-2d" - viz_dump_filename = "room-2d" - // would result in the following dump structure: - // main2d - // viz_room-2d_VisIt/ - // visit_dump.00000/ - // visit_dump.00001/ - // ... - // dumps.visit - // viz_room-2d_Vizamrai/ - // room-2d.00000.vis - // room-2d.00001.vis - // ... - // If only one data writer is selected, the - // _VisIt, _Vizamrai extension will be omitted. - - // Restart dump parameters. - // restart_interval -- (int) the interval in timesteps over coarsest - // level between writing of consecutive restart - // files. Setting it to zero turns off writing - // of restart files. [0] - // restart_write_dirname -- (char string) directory where restart files - // are written [empty string] - // (assertion thrown if not specified - // and restart_interval > 0) - // - restart_interval = 1 - restart_write_dirname = "restart_room-2d" - - // Run-time plotting arguments (only apply in 2d): - // - // X-windows plotting specification for each primitive variable. - // Options: NO_PLOTTING, BOXES_ONLY, CONTOURS_ONLY, SHADE_ONLY, - // CONTOUR_WITH_SHADE, BOTH_CONTOUR_AND_SHADE - // (see "euler_const.input" below for discussion of these options). - // plotting_interval -- (int) interval for which values are plotted - // in X window during run [1] - // plot2d_density -- (above options) specification of plotting for - // density [NO_PLOTTING] - // plot2d_pressure -- (above options) specification of plotting for - // pressure [NO_PLOTTING] - // plot2d_velocity -- (above options) specification of plotting for - // velocity [NO_PLOTTING] - plotting_interval = 5 - plot2d_density = NO_PLOTTING - plot2d_pressure = SHADE_ONLY - plot2d_velocity = NO_PLOTTING, NO_PLOTTING - } - - - "Euler" input section - --------------------- - Euler { - // Problem specification parameters - // gamma -- (double) ratio of specific heats [1.4] - // godunov_order -- (int) order of Godunov slopes (1, 2, or 4) [1] - // flux_method -- (one of APPROX_RIEM_SOLVE, EXACT_RIEM_SOLVE, - // see "euler_const.input" for more on these - // options) solver to be used in flux calculation - // across cell face [APPROX_RIEM_SOLVE] - // corner transport scheme -- (CORNER_TRANSPORT_1 -or- - // CORNER_TRANSPORT_2 - see "euler_const.input" - // for more on these options) [CORNER_TRANSPORT_1] - // data_problem -- (SPHERE -or- PIECEWISE_CONSTANT_[X,Y,Z]) - // specification of the problem to be solved [REQD] - // - gamma = 1.4 - godunov_order = 2 - flux_method = APPROX_RIEM_SOLVE - corner_transport = CORNER_TRANSPORT_1 - data_problem = SPHERE - - // Initial data for SPHERE problem: - // radius -- (double) radius of sphere [REQD] - // center -- (double array) location of sphere center [REQD] - // density_inside -- (double) fluid density inside sphere [REQD] - // velocity_inside -- (double array) fluid velocity inside sphere - // [REQD] - // pressure_inside -- (double) pressure outside sphere [REQD] - // density_outside -- (double) fluid density outside sphere [REQD] - // velocity_outside -- (double array) fluid velocity outside sphere - // [REQD] - // pressure_outside -- (double) pressure outside sphere [REQD] - data_problem = SPHERE - Initial_data { - radius = 2.9 - center = 5.5 , 5.5 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 - pressure_outside = 1.0 - } - - // Initial data for PIECEWISE_CONSTANT_[X,Y,Z]: - // front_position -- (double array) points between intervals [REQD] - // interval_n { - // density -- (double) density on interval n [REQD] - // velocity -- (double array) velocity in interval n [REQD] - // pressure -- (double) pressure in interval n [REQD] - // } - // - // interval 0 interval 1 interval n - // |------------|------------------|--------...-------|------------| - // front_position[0] front_position[1] front_position[n-1] - // - data_problem = PIECEWISE_CONSTANT_X - Initial_data { - front_position = 0.0 - interval_0 { - density = 1.0 - velocity = 0.0 , 0.0 - pressure = 1.0 - } - interval_1 { - density = 0.125 - velocity = 0.0 , 0.0 - pressure = 0.1 - } - } - - - // Refinement criteria - // Data for tagging cells to refine for gradient detection and - // Richardson extrapolation. Options: - // DENSITY_DEVIATION, PRESSURE_DEVIATION - // DENSITY_GRADIENT, PRESSURE_GRADIENT - // DENSITY_SHOCK, PRESSURE_SHOCK - // DENSITY_RICHARDSON, PRESSURE_RICHARDSON - // and combinations thereof... - // - // DENSITY_DEVIATION -- tag regions whose density exceeds a specified - // tolerance, preserving tags from earlier step. - // DENSITY_GRADIENT -- tag around gradients in density. - // DENSITY_SHOCK -- tag around discontinuous regions of density. - // DENSITY_RICHARDSON -- use Richardson extrapolation to tag - // around errors in density. - // PRESSURE_GRADIENT -- tag around gradients in pressure. - // PRESSURE_SHOCK -- tag around discontinuous regions of pressure. - // PRESSURE_RICHARDSON -- use Richardson extrapolation to tag - // around errors in pressure. - // - // Refinement_data { - // refine_criteria -- (string array) contains one or more of the - // tagging options, specified above [REQD] - // DENSITY_DEVIATION { - // density_dev -- (double array) freestream density, i.e. tag cells - // where |density - density_dev| > dev_tol [REQD] - // dev_tol -- (double array) deviation tolerance in density [REQD] - // time_min -- (double array) time on each level at which - // tagging using this criteria is started [0.] - // time_max -- (double array) time on each level at which - // tagging is stopped [DBL_MAX] - // NOTE: For each of the above entries, if a level is NOT specified, - // the value from the next coarser level is used. The time_min - // and time_max options may be used to control whether tagging - // on a level is active (i.e. setting time_max=0 makes it - // } - // - // DENSITY_GRADIENT { - // grad_tol -- (double array) gradient tolerance for each level [REQD] - // time_min -- (double array) time on each level at which - // tagging using this criteria is started [0.] - // time_max -- (double array) time on each level at which - // tagging is stopped [DBL_MAX] - // (see NOTE under DENSITY_DEVIATION above) - // } - // - // DENSITY_SHOCK { - // shock_onset -- (double array) onset tolerance for each level [REQD] - // shock_tol -- (double array) gradient tolerance for each level [REQD] - // time_min -- (double array) time on each level at which - // tagging using this criteria is started [0.] - // time_max -- (double array) time on each level at which - // tagging is stopped [DBL_MAX] - // (see NOTE under DENSITY_DEVIATION above) - // } - // - // DENSITY_RICHARDSON { - // rich_tol -- (double array) Richardson extrapolation tolerance for - // each level [REQD] - // time_min -- (double array) time on each level at which - // tagging using this criteria is started [0.] - // time_max -- (double array) time on each level at which - // tagging is stopped [DBL_MAX] - // (see NOTE under DENSITY_DEVIATION above) - // } - // - // PRESSURE_DEVIATION, PRESSURE_GRADIENT, PRESSURE_SHOCK, PRESSURE_RICHARDSON - // input entries are identical to the DENSITY cases shown above. - // - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 10.0, 9.0, 9.5 - time_min = 0., 0.5, 0.8 - time_max = 10.0, 10.0, 8.0 - } - - PRESSURE_SHOCK { - shock_tol = 5.0, 8.0, 12.0 - shock_onset = 0.85, 0.80 - time_min = 0., 0.5, 0.8 - time_max = 10.0, 10.0, 8.0 - } - } - - // Boundary conditions - // Options: FLOW, LINEAR, SYMMETRIC, FIXED - // (see "euler_const.input" for discussion of these options) - // Boundary_data { - // boundary_node_x0y0 -- (above options) lower left corner [FLOW] - // boundary_node_x1y0 -- (above options) lower right corner [FLOW] - // boundary_node_x0y1 -- (above options) upper left corner [FLOW] - // boundary_node_x1y1 -- (above options) upper right corner [FLOW] - // boundary_edge_x0 { -- left edge - // boundary_edge_x1 { -- right edge - // boundary_edge_y0 { -- bottom edge - // boundary_edge_y1 { -- top edge - // boundary_type -- (above options) type at prescribed edge [FLOW] - // density -- (double) density at prescribed edge [0] - // velocity -- (double array) velocity at prescribed edge [0] - // pressure -- (double) pressure at prescribed edge [0] - // } - // - // edge_y1 - // node_x0y1 o--------------o node_x1y1 - // | | - // | | - // edge_x0 | | edge_x1 - // | | - // | | - // node_x0y0 o--------------o node_x1y0 - // edge_y0 - // - // NOTE: 3D case specifies data at faces as well. See - // /SAMRAI/docs/userdocs/boundaries.ps for further discussion. - Boundary_data { - boundary_node_x0y0 = FLOW - boundary_node_x1y0 = FLOW - boundary_node_x0y1 = FLOW - boundary_node_x1y1 = FLOW - boundary_edge_x0 { - boundary_type = SYMMETRIC - } - boundary_edge_x1 { - boundary_type = SYMMETRIC - } - boundary_edge_y0 { - boundary_type = SYMMETRIC - } - boundary_edge_y1 { - boundary_type = SYMMETRIC - } - } - - } - - "CartesianGeometry" input section - --------------------------------- - CartesianGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - x_lo = 0.e0 , 0.e0 - x_up = 65.e0 , 55.e0 - domain_boxes = [(0,9),(14,20)], - [(0,21),(19,35)], - [(0,36),(14,49)], - [(20,0),(49,54)], - [(50,0),(64,35)], - [(50,46),(64,54)], - [(57,36),(64,45)] - periodic_dimension = 0, 1 // periodic in y only - } - - - "GriddingAlgorithm" input section - --------------------------------- - GriddingAlgorithm { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - // smallest_patch_size { - // level_0 -- (int array) smallest patch allowed on level 0. - // [max ghost width for all variables] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 48 , 48 - } - smallest_patch_size { - level_0 = 8 , 8 - } - - // Tolerances for gridding efficiency and box chopping operations. - // efficiency_tolerance -- (double array) minimum percentage of tagged - // cells allowed in a box [0.8 for each level] - // combine_efficiency -- (double array) threshold specifying when a - // box may be chopped into two smaller boxes. - // If sum of the volumes of smaller boxes is > - // combine efficiency * volume of larger box, - // then larger box will not be chopped. - // [0.8 for each level] - // proper_nesting_buffer -- (int array) number of coarse cells by which - // the next finer level is nested within its - // interior. [1 for each level] - efficiency_tolerance = 0.85e0 - combine_efficiency = 0.95e0 - proper_nesting_buffer = 1 - - // Option to read or write gridding information - // write_regrid_boxes -- (bool) Output sequence of refine boxes to file - // read_regrid_boxes -- (bool) Read sequence of refine boxes from file - // regrid_boxes_filename -- (string) file name used for reading or writing - // boxes. - // - // Reading and writing options require some user intervention to assure - // they work properly. Please consult Andy Wissink (awissink@llnl.gov) - // if you are interested in using these options. - write_regrid_boxes = TRUE - regrid_boxes_filename = TRUE - } - - "StandardTagAndInitialize" input section - --------------------------------------------- - StandardTagAndInitialize { - // Specification of the type of tagging to be performed - // tagging_method -- (string array) one or more entries specifying - // the tagging algorithm used. Options include: - // "GRADIENT_DETECTOR" - // "RICHARDSON_EXTRAPOLATION" - // "REFINE_BOXES" - // - // REFINE_BOXES allows you to prescribe where refinement should occur. - // If this option is used, you must also supply a RefineBoxes database - // entry with the refine boxes on different levels specified. i.e. - // RefineBoxes{ - // level_0 -- (BoxArray) Boxes to be refined on level 0 - // level_1 -- (BoxArray) Boxes to be refined on level 1 - // etc. - // - // Gradient detection option. - tagging_method = "GRADIENT_DETECTOR" - // - // Richarson extrapolation option. - tagging_method = "RICHARDSON_EXTRAPOLATION" - // - // Static refine boxes option. - tagging_method = "REFINE_BOXES" - RefineBoxes { - level0_boxes = [(15,0),(29,14)] - level1_boxes = [(65,10),(114,40)] - } - // Combination. - tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" - } - - "HyperbolicLevelIntegrator" input section - ----------------------------------------- - HyperbolicLevelIntegrator{ - // CFL used to determine timestep on each level. - // cfl -- (double) timestep at each level is given by - // dt = cfl*dx/a, where a is max wave speed. [REQD] - // cfl_init -- (double) cfl factor used for initial step [REQD] - cfl = 0.9e0 - cfl_init = 0.1e0 - - // Options for timestep computation. - // lag_dt_computation -- (bool) if true, characteristic data on the - // patch is not recomputed before computing the - // timestep; otherwise it uses data from - // preceding flux calculation [TRUE]. - // use_ghosts_to_compute_dt -- (bool) if true, fill ghost data before - // computing timestep on each patch [TRUE]. - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - } - - - "TimeRefinementIntegrator" input section - ----------------------------------------- - TimeRefinementIntegrator{ - // Time stepping specifications. - // start_time -- (double) initial integration time [REQD] - // end_time -- (double) final integration time [REQD] - // grow_dt -- (double) limit factor on maximum growth of timestep - // from one step to the next; useful for ramping up - // timestep size or to prevent rapid growth in timestep - // [REQD] - // max_integrator_steps -- max number timesteps on coarsest level [REQD] - // tag_buffer -- (int array) amount by which cells tagged for error are - // buffered before new fine patches are created to cover - // tagged regions. By default, it is the interval of - // timesteps between successive regids on level. - // [regrid_interval] - start_time = 0.e0 - end_time = 100.e0 - grow_dt = 1.1e0 - max_integrator_steps = 301 - tag_buffer = 1,1,1,1 // max of 4 finer levels in hierarchy - } - - "LoadBalancer" input section - ---------------------------------- - LoadBalancer { - // using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) - } - - "DataWriter" input section - ---------------------------------- - DataWriter { - // Specify which variables to write to visualization file(s). - // Variable_Names -- (string array) list of variable names to - // write to the viz file. - // Variable_Types -- (string array) list of the corresponding - // variable type to write to the viz file. - // Must be either "primitive" or "derived". - // Note that until vizamrai is updated to use - // HDF5, "derived" must always be used. - // Variable_Depths -- (int array) depth, or number of components, of - // each variable. - // Variable_Scales -- (double array) list of scaling factors for each - // variable to be written to the viz file. - Variable_Names = "density", "velocity", "pressure" - Variable_Types = "Derived", "Derived", "Derived" - Variable_Depths = 1, 3, 1 - Variable_Scales = 1.0, 1.0, 1.0 - } - - - "TimerManager" input section - ---------------------------- - TimerManager{ - // Specify which timers to invoke - // timer_list -- (string array) list of timers to be turned on - for - // complete list of available timers, see - // SAMRAI/docs/userdocs/timing.pdf [null] - timer_list = "apps::main::*", - "apps::Euler::computeFluxesOnPatch()", - "algs::GriddingAlgorithm::*", - "xfer::*::*" - // Various output options. - // print_total -- (bool) print total time [TRUE] - // print_exclusive -- (bool) output exclusive time - i.e. time spent - // exclusively in each routine. A nice way to - // identify routines with bottlenecks, but is more - // expensive than recording total time [FALSE]. - // print_wall -- (bool) output wallclock time [TRUE] - // print_user -- (bool) output user time [FALSE] - // print_sys -- (bool) output system time [FALSE] - // print_summed -- (bool) output sum of times measured across all - // processors during a parallel run [FALSE]. - // print_max -- (bool) output maximum time spent on any one - // processor, along with the processor ID [FALSE] - // print_percentage -- (bool) output percentage of total time for each - // printed timer [TRUE] - // print_concurrent -- (bool) in the process of performing exclusive - // time, a nested call tree is created; print the - // tree [FALSE] - // print_timer_overhead -- (bool) each timer start/stop invocation - // incurs about one-half a millionth of a second - // overhead. This option will output the number of - // invocations and the total predicted overhead for - // all the timers [FALSE] - // print_threshold -- (double) do not print any timers that constitute - // < (print_threshold)% of overall run time. Useful - // to prevent gobs of output if many timers are - // turned on. [0.25] - print_exclusive = TRUE - print_max = TRUE - print_timer_overhead = TRUE - print_threshold = 0.0 - } - - -"euler_const.input" -------------------- - // This file specifies some constants used within the Euler code. These - // names and values map to those specified via "#define" statements in - // Euler.C - - // 2D X Window plotting options - // Plotting will execute while the program is running for 2D cases. - // Note that since it pipes data to an X-window, it slows the - // performance of the code somewhat, but it sure is PRETTY! - NO_PLOTTING = 0 // no plotting - BOXES_ONLY = 1 // plot bounding boxes only - CONTOURS_ONLY = 2 // plot contours only - SHADE_ONLY = 3 // plot color shade only - CONTOUR_WITH_SHADE = 4 // plot contours and color shade in same window - BOTH_CONTOUR_AND_SHADE = 5 // plot contours and color shade in separate - // window - - // Riemann solver used in flux calculation across cell face - APPROX_RIEM_SOLVE = 0 // Colella-Glaz approx Riemann solver - EXACT_RIEM_SOLVE = 1 // Exact Riemann solver - - // Flux corner transport options - // CORNER_TRANSPORT_1 is based on an extension of Colella's formulation. - // CORNER_TRANSPORT_2 is a formulation constructed by Trangenstein - // A writeup on these two methods is available from R. Hornung or A. Wissink. - CORNER_TRANSPORT_1 = 1 - CORNER_TRANSPORT_2 = 2 - - // - // Two Different problems can be specified via input - // PIECEWISE_CONSTANT_* : piecewise constant data in *-coordinate direction - // SPHERE : sphere problem - PIECEWISE_CONSTANT_X = 10 - PIECEWISE_CONSTANT_Y = 11 - PIECEWISE_CONSTANT_Z = 12 - SPHERE = 40 - - // Boundary conditions - // FLOW indicates flow-thru conditions - // LINEAR indicates a linear profile at the boundary - // SYMMETRIC will apply a plane of symmetry - // FIXED designates a solid boundary. - FLOW = 0 - LINEAR = 1 - SYMMETRIC = 4 - FIXED = 5 +See test/applications/Euler/test_inputs/test.2d.input for descriptions of the +input files diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/avgint.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/avgint.m4 deleted file mode 100644 index b15c21f3..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/avgint.m4 +++ /dev/null @@ -1,448 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI applications -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for interlevel transfer of velocity and -c pressure for 2d euler equations. -c -define(NDIM,2)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(FORTDIR/../amrflaten.i)dnl -c -define(coarsen_index,`dnl - if ($1.lt.0) then - $2=($1+1)/$3-1 - else - $2=$1/$3 - endif -')dnl -define(coarse_fine_cell_deltas,`dnl - do ir$1=0,ratio($1)-1 - deltax(ir$1,$1)=(dble(ir$1)+half)*dxf($1)-dxc($1)*half - enddo -')dnl -define(muscl_limited_conserved_slopes,`dnl - do ie$1=ifirstc$1,ilastc$1+1 - diff$1(ie$1)=conservc($2) - & -conservc($3) - enddo - do ic$1=ifirstc$1,ilastc$1 - coef2=half*(diff$1(ic$1+1)+diff$1(ic$1)) - bound=two*min(abs(diff$1(ic$1+1)),abs(diff$1(ic$1))) - if (diff$1(ic$1)*diff$1(ic$1+1).gt.zero) then - slope$1($4)=sign(min(abs(coef2),bound),coef2) - & /dxc($1) - else - slope$1($4)=zero - endif - slope$1($4)=slope$1($4)*flat$1($4) - enddo -')dnl -c -c*********************************************************************** -c Conservative linear interpolation for 2d flux variables. -c*********************************************************************** -c - subroutine conservlinint2d( - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1, - & ratio,dxc,dxf, - & gamma, - & densc,densf, - & velc,presc, - & velf,presf, - & conservc, - & tflat,tflat2,sound,mc, - & tdensc,tpresc,tvelc, - & flat0,flat1, - & diff0,slope0,diff1,slope1) -c*********************************************************************** - implicit none -include(FORTDIR/../const.i)dnl -c*********************************************************************** - integer - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:NDIM-1) - REAL - & dxc(0:NDIM-1), - & dxf(0:NDIM-1), - & gamma - REAL - & densc(CELL2d(cilo,cihi,0)), - & densf(CELL2d(filo,fihi,0)), - & velc(CELL2d(cilo,cihi,0),0:NDIM-1), - & presc(CELL2d(cilo,cihi,0)) - REAL - & velf(CELL2d(filo,fihi,0),0:NDIM-1), - & presf(CELL2d(filo,fihi,0)) - REAL - & conservc(CELL2d(ifirstc,ilastc,1)), - & flat0(CELL2d(ifirstc,ilastc,0)), - & flat1(CELL2d(ifirstc,ilastc,0)), - & diff0(ifirstc0:ilastc0+1), - & slope0(CELL2d(ifirstc,ilastc,0)), - & diff1(ifirstc1:ilastc1+1), - & slope1(CELL2d(ifirstc,ilastc,0)) - REAL - & deltax(0:15,0:NDIM-1) - integer mc - REAL - & tdensc(0:mc-1),tpresc(0:mc-1),tvelc(0:mc-1) - REAL - & tflat(0:mc-1),tflat2(0:mc-1),sound(0:mc-1) - - integer id,ic0,ic1,ie0,ie1,if0,if1,ir0,ir1,it - REAL coef2,bound,val,valinv,deltax1,v2norm - logical presneg -c -c*********************************************************************** -c - - presneg = .false. - -coarse_fine_cell_deltas(0)dnl - -coarse_fine_cell_deltas(1)dnl - -c -c compute the flatten coefficients to further limit the slopes -c - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - it = ic0-cilo0 - tdensc(it) = densc(ic0,ic1) - tpresc(it) = presc(ic0,ic1) - tvelc(it) = velc(ic0,ic1,0) -c write(6,*) "presc(",ic0,ic1,") ",presc(ic0,ic1) -c write(6,*) "tpresc(",it,") ",tpresc(it) - enddo - call amrflaten(ifirstc0,ilastc0,cilo0,cihi0,mc,gamma, - & tdensc,tpresc,tvelc,tflat,tflat2,sound) - do ic0=ifirstc0,ilastc0 - flat0(ic0,ic1) = tflat(ic0-ifirstc0) - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic1=ifirstc1-1,ilastc1+1 - it = ic1-cilo1 - tdensc(it) = densc(ic0,ic1) - tpresc(it) = presc(ic0,ic1) - tvelc(it) = velc(ic0,ic1,1) - enddo - call amrflaten(ifirstc1,ilastc1,cilo1,cihi1,mc,gamma, - & tdensc,tpresc,tvelc,tflat,tflat2,sound) - do ic1=ifirstc1,ilastc1 - flat1(ic0,ic1) = tflat(ic1-ifirstc1) - enddo - enddo - -c -c - -c -c construct fine velocity values using conservative linear -c interpolation on momentum -c - do id=0,NDIM-1 - - do ic1=ifirstc1-1,ilastc1+1 - do ic0=ifirstc0-1,ilastc0+1 - conservc(ic0,ic1) = densc(ic0,ic1)*velc(ic0,ic1,id) - enddo - enddo - - do ic1=ifirstc1,ilastc1 -muscl_limited_conserved_slopes(0,`ie0,ic1',`ie0-1,ic1',`ic0,ic1')dnl - enddo - - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(1,`ic0,ie1',`ic0,ie1-1',`ic0,ic1')dnl - enddo - - do if1=ifirstf1,ilastf1 -coarsen_index(if1,ic1,ratio(1))dnl - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 -coarsen_index(if0,ic0,ratio(0))dnl - ir0=if0-ic0*ratio(0) - velf(if0,if1,id) = (conservc(ic0,ic1) - & + slope0(ic0,ic1)*deltax(ir0,0) - & + slope1(ic0,ic1)*deltax1) - & / densf(if0,if1) - enddo - enddo - - enddo - -c -c construct fine pressure values using conservative linear -c interpolation on energy -c - val = (gamma-one) - valinv = one/(gamma-one) - - do ic1=ifirstc1-1,ilastc1+1 - do ic0=ifirstc0-1,ilastc0+1 - v2norm = velc(ic0,ic1,0)**2+velc(ic0,ic1,1)**2 - conservc(ic0,ic1) = presc(ic0,ic1)*valinv - & + half*densc(ic0,ic1)*v2norm - enddo - enddo - - do ic1=ifirstc1,ilastc1 -muscl_limited_conserved_slopes(0,`ie0,ic1',`ie0-1,ic1',`ic0,ic1')dnl - enddo - - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(1,`ic0,ie1',`ic0,ie1-1',`ic0,ic1')dnl - enddo - - do if1=ifirstf1,ilastf1 -coarsen_index(if1,ic1,ratio(1))dnl - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 -coarsen_index(if0,ic0,ratio(0))dnl - ir0=if0-ic0*ratio(0) - v2norm = velf(if0,if1,0)**2+velf(if0,if1,1)**2 - presf(if0,if1) = ((conservc(ic0,ic1) - & + slope0(ic0,ic1)*deltax(ir0,0) - & + slope1(ic0,ic1)*deltax1) - & - half*densf(if0,if1)*v2norm) * val - presf(if0,if1) = max(presf(if0,if1),smallr) - if (presf(if0,if1).lt.zero) then -c write(6,*) "IN conservlinint2d" -c write(6,*) "gamma,val,valinv = ", -c & gamma,val,valinv -c write(6,*) "ifirstf0,ilastf0 ",ifirstf0,ilastf0, -c & ", ifirstf1,ilastf1 ",ifirstf1,ilastf1 -c write(6,*) "if0,if1 ",if0,if1 -c write(6,*) "ic0,ic1 ",ic0,ic1 -c write(6,*) "fine energy = ", -c & conservc(ic0,ic1) + slope0(ic0,ic1)*deltax(ir0,0) -c & + slope1(ic0,ic1)*deltax1 -c write(6,*) "densf(if0,if1) ",densf(if0,if1) -c write(6,*) "vel() ",velf(if0,if1,0),velf(if0,if1,1) -c write(6,*) "presf(if0,if1) ",presf(if0,if1) -c write(6,*) "conservc(",ic0,ic1,") ",conservc(ic0,ic1) -c write(6,*) "slope0(",ic0,ic1,") ",slope0(ic0,ic1) -c write(6,*) "deltax(",ir0,0,") ",deltax(ir0,0) -c write(6,*) "slope1(",ic0,ic1,") ",slope1(ic0,ic1) -c write(6,*) "deltax1(",ir1,1,") ",deltax1 -c write(6,*) "val ",val,", v2norm ",v2norm -c write(6,*) "presc(",ic0,ic1,") ",presc(ic0,ic1) -c write(6,*) "densc(",ic0,ic1,") ",densc(ic0,ic1) -c write(6,*) "velc() ",velc(ic0,ic1,0),velc(ic0,ic1,1) - presneg = .true. - endif - enddo - enddo - - if (presneg) then - write(6,*) "negative pressure reported in conservlinint2d" -c write(6,*) "coarse conserved values" -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,conservc = ", -c & ic0,ic1,conservc(ic0,ic1) -c enddo -c enddo -c write(6,*) "coarse density values" -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,densc = ", -c & ic0,ic1,densc(ic0,ic1) -c enddo -c enddo -c write(6,*) "coarse velocity0 values" -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,velc0 = ", -c & ic0,ic1,velc(ic0,ic1,0) -c enddo -c enddo -c write(6,*) "coarse velocity1 values" -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,velc1 = ", -c & ic0,ic1,velc(ic0,ic1,1) -c enddo -c enddo -c write(6,*) "coarse pressure values" -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,presc = ", -c & ic0,ic1,presc(ic0,ic1) -c enddo -c enddo -c write(6,*) "fine density values" -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,densf = ", -c & if0,if1,densf(if0,if1) -c enddo -c enddo -c write(6,*) "fine velocity0 values" -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,velf0 = ", -c & if0,if1,velf(if0,if1,0) -c enddo -c enddo -c write(6,*) "fine velocity1 values" -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,velf1 = ", -c & if0,if1,velf(if0,if1,1) -c enddo -c enddo -c call flush(6) - stop - endif -c - return - end -c -c -c*********************************************************************** -c Volume weighted averaging for 2d flux variables. -c*********************************************************************** -c - subroutine conservavg2d( - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & filo0,filo1,fihi0,fihi1, - & cilo0,cilo1,cihi0,cihi1, - & ratio,dxf,dxc, - & gamma, - & densf,densc, - & velf,presf, - & velc,presc, - & conservf) -c*********************************************************************** - implicit none - REAL zero,half,one - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstf0,ifirstf1,ilastf0,ilastf1, - & ifirstc0,ifirstc1,ilastc0,ilastc1, - & cilo0,cilo1,cihi0,cihi1, - & filo0,filo1,fihi0,fihi1 - integer ratio(0:NDIM-1) - REAL - & dxf(0:NDIM-1), - & dxc(0:NDIM-1), - & gamma - REAL - & densf(CELL2d(filo,fihi,0)), - & densc(CELL2d(cilo,cihi,0)), - & velf(CELL2d(filo,fihi,0),0:NDIM-1), - & presf(CELL2d(filo,fihi,0)) - REAL - & velc(CELL2d(cilo,cihi,0),0:NDIM-1), - & presc(CELL2d(cilo,cihi,0)) - REAL - & conservf(CELL2d(ifirstf,ilastf,0)) - integer ic0,ic1,if0,if1,ir0,ir1,id - REAL dVf,dVc,val,valinv,v2norm -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1) - dVc = dxc(0)*dxc(1) -c -c construct coarse velocity values using conservative average -c of momentum -c - do id=0,NDIM-1 - - do if1=ifirstf1,ilastf1 - do if0=ifirstf0,ilastf0 - conservf(if0,if1) = densf(if0,if1)*velf(if0,if1,id) - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - velc(ic0,ic1,id) = zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - velc(ic0,ic1,id) = velc(ic0,ic1,id) - & + conservf(if0,if1)*dVf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - velc(ic0,ic1,id) = velc(ic0,ic1,id) - & / (densc(ic0,ic1)*dVc) - enddo - enddo - - enddo - -c -c construct coarse velocity values using conservative average -c of energy -c - val = (gamma-one) - valinv = one/(gamma-one) - - do if1=ifirstf1,ilastf1 - do if0=ifirstf0,ilastf0 - v2norm = velf(if0,if1,0)**2 + velf(if0,if1,1)**2 - conservf(if0,if1) = presf(if0,if1)*valinv - & + half*densf(if0,if1)*v2norm - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - presc(ic0,ic1) = zero - enddo - enddo - - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - presc(ic0,ic1) = presc(ic0,ic1) - & + conservf(if0,if1)*dVf - enddo - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - v2norm = velc(ic0,ic1,0)**2 + velc(ic0,ic1,1)**2 - presc(ic0,ic1) = ((presc(ic0,ic1)/dVc) - & - half*densc(ic0,ic1)*v2norm) * val - enddo - enddo -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flaten1d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flaten1d.m4 deleted file mode 100644 index 032ac34c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flaten1d.m4 +++ /dev/null @@ -1,3 +0,0 @@ -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(FORTDIR/../flaten.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flux.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flux.m4 deleted file mode 100644 index 3034dd91..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/flux.m4 +++ /dev/null @@ -1,277 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(FORTDIR/m4flux.i)dnl - - subroutine fluxcorrec(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & dx, - & gamma,density,velocity,pressure, - & flux0,flux1, - & trlft0,trlft1, - & trrgt0,trrgt1) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & density(CELL2d(ifirst,ilast,CELLG)), - & velocity(CELL2d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL2d(ifirst,ilast,CELLG)), - & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), - & trlft0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & trrgt0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & trlft1(FACE2d1(ifirst,ilast,FACEG),NEQU), - & trrgt1(FACE2d1(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,k - REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) - REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel0,gamma, - & gam_min_one - -c write(6,*) "In fluxcorrec()" - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" -c call flush(6) - stop - endif -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** - gam_min_one = gamma-one -c correct the 1-direction with 0-fluxes -c write(6,*) " correct the 1-direction with 0-fluxes" - do ic1=ifirst1-(FLUXG),ilast1+(FLUXG) - do ic0=ifirst0-(FLUXG-1),ilast0+(FLUXG-1) - rho = density(ic0,ic1) - vel0 = velocity(ic0,ic1,0) - vel1 = velocity(ic0,ic1,1) - v2norm= vel1**2 +vel0**2 - do k=1,NEQU - trnsvers(k)= - & (flux0(ic0+1,ic1,k)-flux0(ic0,ic1,k))*half/dx(0) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - trrgt1(ic1 ,ic0,k)= trrgt1(ic1 ,ic0,k) - ttv(k) - trlft1(ic1+1,ic0,k)= trlft1(ic1+1,ic0,k) - ttv(k) - enddo - trrgt1(ic1 ,ic0,NEQU) = max(smallr,trrgt1(ic1 ,ic0,NEQU)) - trlft1(ic1+1,ic0,NEQU) = max(smallr,trlft1(ic1+1,ic0,NEQU)) - enddo - enddo -c call flush(6) - -c correct the 0-direction with 1-fluxes -c write(6,*) " correct the 0-direction with 1-fluxes" - do ic0=ifirst0-(FLUXG),ilast0+(FLUXG) - do ic1=ifirst1-(FLUXG-1),ilast1+(FLUXG-1) - rho = density(ic0,ic1) - vel0 = velocity(ic0,ic1,0) - vel1 = velocity(ic0,ic1,1) - v2norm= vel1**2 +vel0**2 - do k=1,NEQU - trnsvers(k)= - & (flux1(ic1+1,ic0,k)-flux1(ic1,ic0,k))*half/dx(1) - enddo -c write(6,*) " flux1(",ic1+1,ic0,")= ",flux1(ic1+1,ic0,1), -c & flux1(ic1+1,ic0,2),flux1(ic1+1,ic0,3),flux1(ic1+1,ic0,4) -c write(6,*) " flux1(",ic1,ic0,")= ",flux1(ic1,ic0,1), -c & flux1(ic1,ic0,2),flux1(ic1,ic0,3),flux1(ic1,ic0,4) -c - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) + - & trnsvers(NEQU))*gam_min_one -c write(6,*) " old trrgt0(",ic0,ic1,"=",trrgt0(ic0,ic1,1), -c & trrgt0(ic0,ic1,2),trrgt0(ic0,ic1,3), -c & trrgt0(ic0,ic1,4) -c write(6,*) " old trlft0(",ic0+1,ic1,"=",trlft0(ic0+1,ic1,1), -c & trlft0(ic0+1,ic1,2),trlft0(ic0+1,ic1,3), -c & trlft0(ic0+1,ic1,4) - do k=1,NEQU - trrgt0(ic0 ,ic1,k)= trrgt0(ic0 ,ic1,k) - ttv(k) - trlft0(ic0+1,ic1,k)= trlft0(ic0+1,ic1,k) - ttv(k) - enddo - trrgt0(ic0 ,ic1,NEQU) = max(smallr,trrgt0(ic0 ,ic1,NEQU)) - trlft0(ic0+1,ic1,NEQU) = max(smallr,trlft0(ic0+1,ic1,NEQU)) -c write(6,*) " new trrgt0(",ic0,ic1,"=",trrgt0(ic0,ic1,1), -c & trrgt0(ic0,ic1,2),trrgt0(ic0,ic1,3), -c & trrgt0(ic0,ic1,4) -c write(6,*) " new trlft0(",ic0+1,ic1,"=",trlft0(ic0+1,ic1,1), -c & trlft0(ic0+1,ic1,2),trlft0(ic0+1,ic1,3), -c & trlft0(ic0+1,ic1,4) - enddo - enddo -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcalculation(dt,extra_cell,visco,dx, - & ifirst0,ilast0,ifirst1,ilast1, - & gamma,rpchoice, - & density,velocity,pressure, - & flux0,flux1, - & trlft0,trlft1,trrgt0,trrgt1) - -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer extra_cell,visco,rpchoice - REAL dt,dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & density(CELL2d(ifirst,ilast,CELLG)), - & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL2d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), - & trlft0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & trrgt0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & trlft1(FACE2d1(ifirst,ilast,FACEG),NEQU), - & trrgt1(FACE2d1(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ie0,ie1,j - REAL stateL(NEQU),stateR(NEQU), - & riemst(NEQU),gamma - REAL mom0,mom1,Hent,v2norm,vel_tan - REAL mom0L,mom1L,enerL,mom0R,mom1R,enerR - REAL maxeig, vcoef,vcorr(NEQU),gam_min_one -c -c variables for hllc scheme - REAL aLsq,aRsq,keL,keR,flux(NEQU),diff(NEQU) - REAL mfL,mfR,star(NEQU),sL,sM,sR - REAL w,omw,hat(NEQU+1),denom -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" -c call flush(6) - stop - endif -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c -c write(6,*) "In fluxcalculation(",extra_cell,")" -c write(6,*) "ifirst0,ilast0,ifirst1,ilast1,extra_cell", -c & ifirst0,ilast0,ifirst1,ilast1,extra_cell - gam_min_one = gamma-one -riemann_solve(0,1,(extra_cell+(FLUXG-1)))dnl -c -riemann_solve(1,0,(extra_cell+(FLUXG-1)))dnl - - if (visco.eq.1) then - write(6,*) "doing artificial viscosity" -c -artificial_viscosity1(0,1)dnl -c -artificial_viscosity1(1,0)dnl -c - endif -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - - subroutine consdiff(ifirst0,ilast0,ifirst1,ilast1,dx, - & flux0,flux1, - & gamma,density,velocity,pressure) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** - integer ifirst0, ilast0,ifirst1, ilast1 - REAL dx(0:NDIM-1) - REAL - & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), - & gamma, - & density(CELL2d(ifirst,ilast,CELLG)), - & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL2d(ifirst,ilast,CELLG)) -c - integer ic0,ic1,k - REAL temp,v2norm,mom(NDIM),energy, - & gam_min_one - -c*********************************************************************** -c update conserved variables to full time -c note the permutation of indices in 2nd coordinate direction -c*********************************************************************** - gam_min_one = gamma-one - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - mom(1) = density(ic0,ic1)*velocity(ic0,ic1,1) - mom(2) = density(ic0,ic1)*velocity(ic0,ic1,2) - v2norm = (velocity(ic0,ic1,1)**2+velocity(ic0,ic1,2)**2) - energy = pressure(ic0,ic1)/gam_min_one + - & half*density(ic0,ic1)*v2norm - - density(ic0,ic1) = density(ic0,ic1) - & -(flux0(ic0+1,ic1,1)-flux0(ic0,ic1,1))/dx(0) - & -(flux1(ic1+1,ic0,1)-flux1(ic1,ic0,1))/dx(1) - density(ic0,ic1) = max(smallr,density(ic0,ic1)) - do k=1,NDIM - mom(k) = mom(k) - & -(flux0(ic0+1,ic1,k+1)-flux0(ic0,ic1,k+1))/dx(0) - & -(flux1(ic1+1,ic0,k+1)-flux1(ic1,ic0,k+1))/dx(1) - velocity(ic0,ic1,k) = mom(k)/density(ic0,ic1) - enddo - energy = energy - & -(flux0(ic0+1,ic1,NEQU)-flux0(ic0,ic1,NEQU))/dx(0) - & -(flux1(ic1+1,ic0,NEQU)-flux1(ic1,ic0,NEQU))/dx(1) -c - v2norm = (velocity(ic0,ic1,1)**2+velocity(ic0,ic1,2)**2) - temp = energy - half*density(ic0,ic1)*v2norm - pressure(ic0,ic1) = gam_min_one*temp - pressure(ic0,ic1) = max(smallr,pressure(ic0,ic1)) - enddo - enddo -c - return - end -c*********************************************************************** -include(FORTDIR/../gas1d_approxrp.i)dnl -include(FORTDIR/../gas1d_exactrp.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/grad.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/grad.m4 deleted file mode 100644 index 3b9bcb49..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/grad.m4 +++ /dev/null @@ -1,213 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - - - subroutine detectgrad( - & ifirst0,ilast0,ifirst1,ilast1, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & dx, - & gradtol, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ifirst1,ilast0,ilast1, - & dotag,donttag, - & vghost0,vghost1, - & tagghost0,tagghost1, - & ttagghost0,ttagghost1 - REAL - & dx(0:NDIM-1), - & gradtol -c variables indexed as 2dimensional - REAL - & var(CELL2dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL2dVECG(ifirst,ilast,tagghost)), - & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) -c - REAL tol - REAL facejump, loctol - REAL presm1,presp1,diag01 - logical tagcell - integer ic0,ic1 -c -c*********************************************************************** -c - tol = gradtol - diag01 = sqrt(dx(0)**2+dx(1)**2) - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1) .ne. 0) then - loctol = 0.125*tol - else - loctol = tol - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1) - presp1 = var(ic0+1,ic1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(0))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1) - presp1 = var(ic0,ic1+1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(1))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1) - presp1 = var(ic0+1,ic1+1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*diag01)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1) - presp1 = var(ic0+1,ic1-1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*diag01)) - endif - - if ( tagcell ) then - temptags(ic0,ic1) = dotag - endif - enddo - enddo - return - end - - subroutine detectshock( - & ifirst0,ilast0,ifirst1,ilast1, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & dx, - & gradtol,gradonset, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ifirst1,ilast0,ilast1, - & dotag,donttag, - & vghost0,vghost1, - & tagghost0,tagghost1, - & ttagghost0,ttagghost1 - REAL - & dx(0:NDIM-1), - & gradtol,gradonset -c variables indexed as 2dimensional - REAL - & var(CELL2dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL2dVECG(ifirst,ilast,tagghost)), - & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) -c - REAL tol,onset - REAL jump1, jump2, facejump, loctol,locon - REAL presm1,presm2,presp1,presp2 - REAL diag01 - logical tagcell - integer ic0,ic1 -c -c*********************************************************************** -c - tol = gradtol - onset = gradonset - diag01 = sqrt(dx(0)**2+dx(1)**2) - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1) .ne. 0) then - loctol = 0.125*tol - locon = 0.66*onset - else - loctol = tol - locon = onset - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1) - presm2 = var(ic0-2,ic1) - presp1 = var(ic0+1,ic1) - presp2 = var(ic0+2,ic1) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(0)))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1) - presm2 = var(ic0,ic1-2) - presp1 = var(ic0,ic1+1) - presp2 = var(ic0,ic1+2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(1)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1) - presp1 = var(ic0+1,ic1+1) - presm2 = var(ic0-2,ic1-2) - presp2 = var(ic0+2,ic1+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag01))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1) - presp1 = var(ic0+1,ic1-1) - presm2 = var(ic0-2,ic1+2) - presp2 = var(ic0+2,ic1-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag01))) - endif - - if ( tagcell ) then - temptags(ic0,ic1) = dotag - endif - enddo - enddo - return - end - - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/init.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/init.m4 deleted file mode 100644 index ca849e3d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/init.m4 +++ /dev/null @@ -1,176 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - - subroutine eulerinit(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1, - & gcw0,gcw1, - & gamma, - & density,velocity,pressure, - & nintervals,front, - & i_dens,i_vel,i_pres) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer gcw0,gcw1 - integer data_problem - integer nintervals - REAL front(1:nintervals) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) - REAL i_dens(1:nintervals), - & i_vel(0:NDIM-1,1:nintervals), - & i_pres(1:nintervals) -c variables in 2d cell indexed - REAL - & density(CELL2dVECG(ifirst,ilast,gcw)), - & velocity(CELL2dVECG(ifirst,ilast,gcw),0:NDIM-1), - & pressure(CELL2dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,dir,ifr - REAL xc(0:NDIM-1) - REAL gamma -c -c dir 0 two linear states (L,R) indp of y,z -c dir 1 two linear states (L,R) indp of x,z - -c write(6,*) "Inside eulerinit" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "PIECEWISE_CONSTANT_X= ",PIECEWISE_CONSTANT_X -c write(6,*) "STEP = ",STEP -c write(6,*) "PIECEWISE_CONSTANT_Y= ",PIECEWISE_CONSTANT_Y -c write(6,*) "dx= ",dx(0), dx(1) -c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) -c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,"and ",ifirst1,ilast1 -c write(6,*) "gamma= ",gamma -c call flush(6) - - dir = 0 - if (data_problem.eq.PIECEWISE_CONSTANT_X) then - dir = 0 - else if (data_problem.eq.STEP) then - dir = 0 - else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then - dir = 1 - endif - - if (dir.eq.0) then - ifr = 1 - do ic0=ifirst0,ilast0 - xc(0) = xlo(0) + dx(0)*(dble(ic0-ifirst0)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - density(ic0,ic1) = i_dens(ifr) - velocity(ic0,ic1,0) = i_vel(0,ifr) - velocity(ic0,ic1,1) = i_vel(1,ifr) - pressure(ic0,ic1) = i_pres(ifr) - enddo - enddo - else if (dir.eq.1) then - ifr = 1 - do ic1=ifirst1,ilast1 - xc(1) =xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic0=ifirst0,ilast0 - density(ic0,ic1) = i_dens(ifr) - velocity(ic0,ic1,0) = i_vel(0,ifr) - velocity(ic0,ic1,1) = i_vel(1,ifr) - pressure(ic0,ic1) = i_pres(ifr) - enddo - enddo - endif -c - return - end -c*********************************************************************** -c -c Initialization routine where we use a spherical profile -c -c*********************************************************************** - subroutine eulerinitsphere(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1, - & gcw0,gcw1, - & gamma, - & density,velocity,pressure, - & i_dens,i_vel,i_pres, - & o_dens,o_vel,o_pres, - & center,radius) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer gcw0,gcw1 - integer data_problem - REAL i_dens,i_vel(0:NDIM-1),i_pres, - & o_dens,o_vel(0:NDIM-1),o_pres - REAL center(0:NDIM-1),radius - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma -c variables in 2d cell indexed - REAL - & density(CELL2dVECG(ifirst,ilast,gcw)), - & velocity(CELL2dVECG(ifirst,ilast,gcw),0:NDIM-1), - & pressure(CELL2dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1 - REAL xc(0:NDIM-1),x0,x1 - REAL angle -c -c write(6,*) "Inside eulerinitsphere" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1) -c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) -c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,ifirst1,ilast1 -c write(6,*) "gamma= ",gamma -c write(6,*) "radius= ",radius -c write(6,*) "center= ",center(0),center(1) -c call flush(6) - - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - x1 = xc(1)-center(1) - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - x0 = xc(0)-center(0) - if (x1.eq.zero .and. x0.eq.zero) then - angle = zero - else - angle = atan2(x1,x0) - endif - if ((x0**2+x1**2).lt.radius**2) then - density(ic0,ic1) = i_dens - velocity(ic0,ic1,0) = i_vel(0)*cos(angle) - velocity(ic0,ic1,1) = i_vel(1)*sin(angle) - pressure(ic0,ic1) = i_pres - else - density(ic0,ic1) = o_dens - velocity(ic0,ic1,0) = o_vel(0)*cos(angle) - velocity(ic0,ic1,1) = o_vel(1)*sin(angle) - pressure(ic0,ic1) = o_pres - endif -c write(6,*) "cell, state = ",ic0,ic1, density(ic0,ic1), -c & pressure(ic0,ic1),velocity(ic0,ic1,0),velocity(ic0,ic1,1) -c call flush(6) - enddo - enddo -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4flux.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4flux.i deleted file mode 100644 index 65175982..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4flux.i +++ /dev/null @@ -1,267 +0,0 @@ -define(riemann_solve,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt -c write(6,*) " calculating flux$1, 1+extra_cell= ",$3 -c write(6,*) " ic$2=",ifirst$2-1-$3,ilast$2+1+$3 -c write(6,*) " ie$1=",ifirst$1-1-$3,ilast$1+1+1+$3 - - if (rpchoice.eq.APPROX_RIEM_SOLVE - & .or. rpchoice.eq.EXACT_RIEM_SOLVE ) then - - do ic$2=ifirst$2-$3, - & ilast$2+$3 - do ie$1=ifirst$1-$3, - & ilast$1+1+$3 - -c ************************************************************ -c * Assign left and right states. Note only normal vel used. -c ************************************************************ - stateL(1) = trlft$1(ie$1,ic$2,1) - stateL(2) = trlft$1(ie$1,ic$2,2+$1) - stateL(3) = trlft$1(ie$1,ic$2,NEQU) - - stateR(1) = trrgt$1(ie$1,ic$2,1) - stateR(2) = trrgt$1(ie$1,ic$2,2+$1) - stateR(3) = trrgt$1(ie$1,ic$2,NEQU) - - if (rpchoice.eq.APPROX_RIEM_SOLVE) then - call gas1dapproxrp(gamma,stateL,stateR,riemst) - else - call gas1dexactrp(gamma,smallr,stateL,stateR,riemst) - endif - - if (riemst(2).le.zero) then - vel_tan=trrgt$1(ie$1,ic$2,2+$2) - else - vel_tan=trlft$1(ie$1,ic$2,2+$2) - endif - - mom$1=riemst(1)*riemst(2) - v2norm = riemst(2)**2+vel_tan**2 - Hent = riemst(3)/gam_min_one + v2norm*riemst(1)/two - - flux$1(ie$1,ic$2,1)= dt*mom$1 - flux$1(ie$1,ic$2,2+$1)= dt*(riemst(3)+mom$1*riemst(2)) - flux$1(ie$1,ic$2,2+$2)= dt*mom$1*vel_tan - flux$1(ie$1,ic$2,NEQU)= dt*riemst(2)*(Hent+riemst(3)) - - enddo - enddo - - elseif (rpchoice.eq.HLLC_RIEM_SOLVE) then - - do ic$2=ifirst$2-$3, - & ilast$2+$3 - do ie$1=ifirst$1-$3, - & ilast$1+1+$3 - -c ************************************************************ -c * Assign left and right states. -c * Note all vel comps used for Roe average. -c ************************************************************ - do j=1,NEQU - stateL(j) = trlft$1(ie$1,ic$2,j) - stateR(j) = trrgt$1(ie$1,ic$2,j) - enddo - -c ************************************************************ -c * Calculate bounding signal speeds. To do this, need the -c * Roe-average of the velocity and sound speed. -c ************************************************************ - w = one / ( one + sqrt( stateR(1)/stateL(1) ) ) - omw = one - w - hat(2+$1) = w*stateL(2+$1) + omw*stateR(2+$1) - aLsq = gamma * stateL(NEQU) / stateL(1) - aRsq = gamma * stateR(NEQU) / stateR(1) - hat(NEQU+1) = sqrt( w*aLsq + omw*aRsq - & + half*gam_min_one*w*omw*( - & (stateR(2)-stateL(2))**2 - & + (stateR(3)-stateL(3))**2 ) ) - - sL = min(stateL(2+$1) - sqrt(aLsq), hat(2+$1) - hat(NEQU+1)) - sR = max(stateR(2+$1) + sqrt(aRsq), hat(2+$1) + hat(NEQU+1)) - mfL = stateL(1) * ( sL - stateL(2+$1) ) - mfR = stateR(1) * ( sR - stateR(2+$1) ) - sM = ( stateR(NEQU) - stateL(NEQU) - & + mfL*stateL(2+$1) - mfR*stateR(2+$1) ) / ( mfL - mfR ) - -c ************************************************************ -c * Calculate flux starting at upwind state. -c ************************************************************ - if ( sM.gt.zero ) then - -c ********************************************************* -c * Flow is to the right; start from left state. -c ********************************************************* - flux(1) = stateL(1) * stateL(2+$1) - flux(2+$1) = flux(1) * stateL(2+$1) + stateL(NEQU) - flux(3-$1) = flux(1) * stateL(3-$1) - keL = half * (stateL(2)**2 + stateL(3)**2) - flux(NEQU) = flux(1) * (aLsq / gam_min_one + keL) - -c ********************************************************* -c * Check if flow is subsonic. -c ********************************************************* - if ( sL.lt.zero ) then - -c ****************************************************** -c * Add contribution from left acoustic wave. -c ****************************************************** - denom = one / (sL-sM) - star(1) = stateL(1) * (sL-stateL(2+$1)) * denom - star(2+$1) = sM - star(3-$1) = stateL(3-$1) - star(NEQU) = stateL(NEQU)*( one + gamma * denom - & * ( sM-stateL(2+$1) ) ) - & + half * gam_min_one - & * star(1) * ( sM-stateL(2+$1) )**2 - - diff(1) = star(1) - stateL(1) - diff(2) = star(1)*star(2) - stateL(1)*stateL(2) - diff(3) = star(1)*star(3) - stateL(1)*stateL(3) - diff(NEQU) = ( star(NEQU)-stateL(NEQU) ) - & / gam_min_one - & + half * star(1) * (star(2)**2 + star(3)**2) - & - stateL(1) * keL - - do j=1,NEQU - flux(j) = flux(j) + sL*diff(j) - enddo - - endif - - else - -c ********************************************************* -c * Flow is to the left; start from right state. -c ********************************************************* - flux(1) = stateR(1) * stateR(2+$1) - flux(2+$1) = flux(1) * stateR(2+$1) + stateR(NEQU) - flux(3-$1) = flux(1) * stateR(3-$1) - keR = half * (stateR(2)**2 + stateR(3)**2) - flux(NEQU) = flux(1) * (aRsq / gam_min_one + keR) - -c ********************************************************* -c * Check if flow is subsonic. -c ********************************************************* - if ( sR.gt.zero ) then - -c ****************************************************** -c * Add contribution from right acoustic wave. -c ****************************************************** - denom = one / (sR-sM) - star(1) = stateR(1) * (sR-stateR(2+$1)) * denom - star(2+$1) = sM - star(3-$1) = stateR(3-$1) - star(NEQU) = stateR(NEQU) * (1 + gamma * denom - & * ( sM-stateR(2+$1) ) ) - & + half * gam_min_one - & * star(1) * ( sM-stateR(2+$1) )**2 - - diff(1) = star(1) - stateR(1) - diff(2) = star(1)*star(2) - stateR(1)*stateR(2) - diff(3) = star(1)*star(3) - stateR(1)*stateR(3) - diff(NEQU) = ( star(NEQU)-stateR(NEQU) ) - & / gam_min_one - & + half * star(1) * (star(2)**2 + star(3)**2) - & - stateR(1) * keR - - do j=1,NEQU - flux(j) = flux(j) + sR*diff(j) - enddo - - endif - - endif - -c ************************************************************ -c * Assign average interface fluxes. -c ************************************************************ - do j=1,NEQU - flux$1(ie$1,ic$2,j) = dt * flux(j) - enddo - - enddo - enddo - - endif -')dnl -define(artificial_viscosity1,`dnl - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - do ie$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG) - maxeig =trrgt$1(ie$1,ic$2,4)-trlft$1(ie$1,ic$2,4) - vcoef = tenth*abs(maxeig) - - mom0L=trlft$1(ie$1,ic$2,1)*trlft$1(ie$1,ic$2,2) - mom1L=trlft$1(ie$1,ic$2,1)*trlft$1(ie$1,ic$2,3) - v2norm = mom1L**2+mom0L**2 - enerL=trlft$1(ie$1,ic$2,NEQU)/gam_min_one+ - & v2norm/(trlft$1(ie$1,ic$2,1)*two) - mom0R=trrgt$1(ie$1,ic$2,1)*trrgt$1(ie$1,ic$2,2) - mom1R=trrgt$1(ie$1,ic$2,1)*trrgt$1(ie$1,ic$2,3) - v2norm = mom1R**2+mom0R**2 - enerR=trrgt$1(ie$1,ic$2,NEQU)/gam_min_one+ - & v2norm/(trrgt$1(ie$1,ic$2,1)*two) - - vcorr(1) = dt*vcoef* - & (trrgt$1(ie$1,ic$2,1)-trlft$1(ie$1,ic$2,1)) - vcorr(2) = dt*vcoef*(mom0R-mom0L) - vcorr(3) = dt*vcoef*(mom1R-mom1L) - vcorr(NEQU) = dt*vcoef*(enerR-enerL) - do j=1,NEQU - flux$1(ie$1,ic$2,j)= flux$1(ie$1,ic$2,j) - & -vcorr(j) - enddo - enddo - enddo -')dnl -define(artificial_viscosity2,`dnl - do ic1=ifirst1-(FLUXG-1),ilast1+(FLUXG-1) - do ie0=ifirst0-(FLUXG-1),ilast0+(FLUXG) - maxeig =pressure(ie0,ic1)-pressure(ie0-1,ic1) - vcoef = tenth*abs(maxeig) - mom0L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,0) - mom1L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,1) - mom0R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,0) - mom1R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,1) - v2norm = mom1L**2+mom0L**2 - enerL=pressure(ie0-1,ic1)/gam_min_one+ - & v2norm/(density(ie0-1,ic1)*two) - v2norm = mom1R**2+mom0R**2 - enerR=pressure(ie0,ic1)/gam_min_one+ - & v2norm/(density(ie0,ic1)*two) - vcorr1= dt*vcoef*(density(ie0,ic1)-density(ie0-1,ic1)) - vcorr2= dt*vcoef*(mom0R-mom0L) - vcorr3= dt*vcoef*(mom1R-mom1L) - vcorr4= dt*vcoef*(enerR-enerL) - flux0(ie0,ic1,1)= flux0(ie0,ic1,1) - vcorr1 - flux0(ie0,ic1,2)= flux0(ie0,ic1,2) - vcorr2 - flux0(ie0,ic1,3)= flux0(ie0,ic1,3) - vcorr3 - flux0(ie0,ic1,4)= flux0(ie0,ic1,4) - vcorr4 - enddo - enddo - do ic0=ifirst0,ilast0 - do ie1=ifirst1,ilast1+1 - maxeig =pressure(ic0,ie1)-pressure(ic0-1,ie1) - vcoef = tenth*abs(maxeig) - mom0L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,0) - mom1L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,1) - mom0R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,0) - mom1R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,1) - v2norm = mom1L**2+mom0L**2 - enerL=pressure(ic0,ie1-1)/gam_min_one+ - & v2norm/(density(ic0,ie1-1)*two) - v2norm = mom1R**2+mom0R**2 - enerR=pressure(ic0,ie1)/gam_min_one+ - & v2norm/(density(ic0,ie1)*two) - vcorr1= dt*vcoef*(density(ic0,ie1)-density(ic0,ie1-1)) - vcorr2= dt*vcoef*(mom0R-mom0L) - vcorr3= dt*vcoef*(mom1R-mom1L) - vcorr4= dt*vcoef*(enerR-enerL) - flux1(ie1,ic0,1)= flux1(ie1,ic0,1) - vcorr1 - flux1(ie1,ic0,2)= flux1(ie1,ic0,2) - vcorr2 - flux1(ie1,ic0,3)= flux1(ie1,ic0,3) - vcorr3 - flux1(ie1,ic0,4)= flux1(ie1,ic0,4) - vcorr4 - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4trace.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4trace.i deleted file mode 100644 index b850385f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/m4trace.i +++ /dev/null @@ -1,61 +0,0 @@ -define(trace_init,`dnl - do ic$2=ifirst$2-FACEG,ilast$2+FACEG - ie$1=ifirst$1-FACEG - tracelft$1(ie$1,ic$2,1)=zero - tracelft$1(ie$1,ic$2,2)=zero - tracelft$1(ie$1,ic$2,3)=zero - tracelft$1(ie$1,ic$2,NEQU)=zero - tracergt$1(ie$1,ic$2,1)=density($5) - tracergt$1(ie$1,ic$2,2)=velocity($5,1) - tracergt$1(ie$1,ic$2,3)=velocity($5,2) - tracergt$1(ie$1,ic$2,NEQU)=pressure($5) - - do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG - tracelft$1(ie$1,ic$2,1)=density($4) - tracelft$1(ie$1,ic$2,2)=velocity($4,1) - tracelft$1(ie$1,ic$2,3)=velocity($4,2) - tracelft$1(ie$1,ic$2,NEQU)=pressure($4) - - tracergt$1(ie$1,ic$2,1)=density($5) - tracergt$1(ie$1,ic$2,2)=velocity($5,1) - tracergt$1(ie$1,ic$2,3)=velocity($5,2) - tracergt$1(ie$1,ic$2,NEQU)=pressure($5) - - enddo - - ie$1=ilast$1+FACEG+1 - tracelft$1(ie$1,ic$2,1)=density($4) - tracelft$1(ie$1,ic$2,2)=velocity($4,1) - tracelft$1(ie$1,ic$2,3)=velocity($4,2) - tracelft$1(ie$1,ic$2,NEQU)=pressure($4) - tracergt$1(ie$1,ic$2,1)=zero - tracergt$1(ie$1,ic$2,2)=zero - tracergt$1(ie$1,ic$2,3)=zero - tracergt$1(ie$1,ic$2,NEQU)=zero - enddo - -')dnl -define(trace_call,`dnl - do ic$2=ifirst$2-2,ilast$2+2 - do ic$1=ifirst$1-CELLG,ilast$1+CELLG - ttsound(ic$1)= sound(ic0,ic1) - enddo - do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 - do k=1,NEQU - ttraclft(ic$1,k) = tracelft(ic$1,ic$2,k) - ttracrgt(ic$1,k) = tracergt(ic$1,ic$2,k) - enddo - enddo - - call trace(dt,ifirst$1,ilast$1,mc, - & dx,idir,igdnv,ttsound, - & ttraclft,ttracrgt, - & ttcelslp,ttedgslp) - do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 - do k=1,NEQU - tracelft(ic$1,ic$2,k) = ttraclft(ic$1,k) - tracergt(ic$1,ic$2,k) = ttracrgt(ic$1,k) - enddo - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/stable.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/stable.m4 deleted file mode 100644 index 774f996b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/stable.m4 +++ /dev/null @@ -1,47 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - subroutine stabledt(dx, - & ifirst0,ilast0,ifirst1,ilast1, - & ngc0,ngc1, - & gamma,density,velocity,pressure,stabdt) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL stabdt,dx(0:NDIM-1) - integer ifirst0,ilast0,ifirst1,ilast1,ngc0,ngc1 -c - REAL - & gamma, - & density(CELL2dVECG(ifirst,ilast,ngc)), - & velocity(CELL2dVECG(ifirst,ilast,ngc),0:NDIM-1), - & pressure(CELL2dVECG(ifirst,ilast,ngc)) -c - integer ic0,ic1 - integer ighoslft(0:NDIM-1),ighosrgt(0:NDIM-1) - - REAL maxspeed(0:NDIM-1),lambda -c - ighoslft(0) = ifirst0 - ngc0 - ighoslft(1) = ifirst1 - ngc1 - ighosrgt(0) = ilast0 + ngc0 - ighosrgt(1) = ilast1 + ngc1 - - maxspeed(0)=zero - maxspeed(1)=zero - - do ic1=ighoslft(1),ighosrgt(1) - do ic0=ighoslft(0),ighosrgt(0) - lambda = - & sqrt(max(zero,gamma*pressure(ic0,ic1)/density(ic0,ic1))) - maxspeed(0) = max(maxspeed(0), - & abs(velocity(ic0,ic1,0))+lambda) - maxspeed(1) = max(maxspeed(1), - & abs(velocity(ic0,ic1,1))+lambda) - enddo - enddo - stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace.m4 deleted file mode 100644 index 97d518a5..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace.m4 +++ /dev/null @@ -1,258 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(FORTDIR/m4trace.i)dnl - - subroutine computesound(ifirst0,ilast0,ifirst1,ilast1, - & gamma,density, velocity,pressure,sound) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 -c variables indexed as 2dimensional - REAL - & gamma, - & density(CELL2d(ifirst,ilast,CELLG)), - & velocity(CELL2d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL2d(ifirst,ilast,CELLG)), - & sound(CELL2d(ifirst,ilast,CELLG)) -c - integer ic0,ic1 -c -c*********************************************************************** -c -c write(6,*) "in computesound" -c do ic1=ifirst1-4,ilast1+4 -c do ic0=ifirst0-4,ilast0+4 -c write(6,*) "ic01,d_p_v=",ic0,ic1, -c & density(ic0,ic1),pressure(ic0,ic1), -c & velocity(ic0,ic1,0),velocity(ic0,ic1,1) -c call flush(6) -c enddo -c enddo -c write(6,*) - - do ic0=ifirst0-CELLG,ilast0+CELLG - do ic1=ifirst1-CELLG,ilast1+CELLG -c write(6,*) " density,pressure = ",ic0,ic1, -c & density(ic0,ic1),pressure(ic0,ic1) -c write(6,*) " velocity, = ",ic0,ic1, -c & velocity(ic0,ic1,0),velocity(ic0,ic1,1) -c call flush(6) - sound(ic0,ic1) = - & sqrt(max(smallr,gamma*pressure(ic0,ic1)/density(ic0,ic1))) -c call flush(6) -c - enddo - enddo - -c write(6,*) "leaving computesound" -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** -c - subroutine inittraceflux( - & ifirst0,ilast0,ifirst1,ilast1, - & density,velocity,pressure, - & tracelft0,tracelft1, - & tracergt0,tracergt1, - & fluxriem0,fluxriem1) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - REAL - & density(CELL2d(ifirst,ilast,CELLG)), - & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL2d(ifirst,ilast,CELLG)), - & fluxriem0(FACE2d0(ifirst,ilast,FLUXG),NEQU), - & tracelft0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & tracergt0(FACE2d0(ifirst,ilast,FACEG),NEQU), - & fluxriem1(FACE2d1(ifirst,ilast,FLUXG),NEQU), - & tracelft1(FACE2d1(ifirst,ilast,FACEG),NEQU), - & tracergt1(FACE2d1(ifirst,ilast,FACEG),NEQU) - integer ic0,ic1,k,ie0,ie1 -c*********************************************************************** -c initialize left and right states at cell edges -c (first-order upwind) -c*********************************************************************** - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif -c*********************************************************************** -c write(6,*) "in init_trace_flux" -c call flush(6) -c write(6,*) "ifirst0,ilast0,ifirst1,ilast1", -c & ifirst0,ilast0,ifirst1,ilast1 -c write(6,*) "cell ghosts ", CELLG -c write(6,*) "face ghosts ", FACEG -c call flush(6) - -c write(6,*) " " -c write(6,*) " In trace_init0" -trace_init(0,1,2,`ie0-1,ic1',`ie0,ic1')dnl - -c write(6,*) " " -c write(6,*) " In trace_init1" -trace_init(1,0,2,`ic0,ie1-1',`ic0,ie1')dnl -c write(6,*) " " - -c -c we initialize the flux to be 0 - - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 - do k=1,NEQU - fluxriem0(ie0,ic1,k) = zero - enddo - enddo - enddo -c - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 - do k=1,NEQU - fluxriem1(ie1,ic0,k) = zero - enddo - enddo - enddo -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing0(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & mc, dx, - & gamma,igdnv, - & sound, - & tracelft,tracergt, - & ttcelslp, ttedgslp, - & ttsound, - & ttraclft, ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx, gamma - REAL - & sound(CELL2d(ifirst,ilast,CELLG)) - REAL - & tracelft(FACE2d0(ifirst,ilast,FACEG),NEQU), - & tracergt(FACE2d0(ifirst,ilast,FACEG),NEQU) -c side variables ifirst0 to ifirst0+mc plus ghost cells - REAL - & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), - & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), - & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU) -c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG,NEQU), - & ttsound(ifirst0-CELLG:ifirst0+mc-1+CELLG) -c*********************************************************************** -c - integer ic0,ic1,k,idir -c*********************************************************************** -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** -c write(6,*) "traced right chartracing0" -c do ic1=ifirst1-FACEG,ilast1+FACEG -c do ic0=ifirst0-FACEG,ilast0+FACEG+1 -c write(6,*) "ic,state=",ic0,ic1, -c & tracergt(ic0,ic1,1),tracergt(ic0,ic1,2), -c & tracergt(ic0,ic1,3),tracergt(ic0,ic1,4) -c call flush(6) -c enddo -c enddo -c write(6,*) -c -c call flush(6) -c - idir = 0 -trace_call(0,1)dnl -c -c*********************************************************************** -c write(6,*) "leaving chartracing" -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing1(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & mc, dx, - & gamma,igdnv, - & sound, - & tracelft,tracergt, - & ttcelslp, ttedgslp, - & ttsound, - & ttraclft, ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx, gamma - REAL - & sound(CELL2d(ifirst,ilast,CELLG)) - REAL - & tracelft(FACE2d1(ifirst,ilast,FACEG),NEQU), - & tracergt(FACE2d1(ifirst,ilast,FACEG),NEQU) -c side variables ifirst1 to ifirst1+mc plus ghost cells - REAL - & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), - & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), - & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU) -c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG,NEQU), - & ttsound(ifirst1-CELLG:ifirst1+mc-1+CELLG) -c*********************************************************************** -c - integer ic0,ic1,k,idir -c*********************************************************************** -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** -c write(6,*) "Entering chartracing1" -c call flush(6) -c - idir = 1 -trace_call(1,0)dnl -c -c*********************************************************************** -c write(6,*) "leaving chartracing" -c call flush(6) - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace1d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace1d.m4 deleted file mode 100644 index 3388c7d0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/2d/trace1d.m4 +++ /dev/null @@ -1,193 +0,0 @@ -define(NEQU,4)dnl -define(REAL,`double precision')dnl - - subroutine trace(dt,ifirst,ilast,mc, - & dx,dir,igdnv,sound, - & tracelft,tracergt, - & celslope,edgslope) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL dt - integer ifirst,ilast,mc,dir,igdnv -c REAL dx, flattn - REAL dx -c - REAL - & celslope(ifirst-CELLG:ifirst+mc-1+CELLG,NEQU), - & flattn(ifirst-CELLG:ifirst+mc-1+CELLG), - & sound (ifirst-CELLG:ifirst+mc-1+CELLG), -c side variables - & tracelft(ifirst-FACEG:ifirst+mc+FACEG,NEQU), - & tracergt(ifirst-FACEG:ifirst+mc+FACEG,NEQU), - & edgslope(ifirst-FACEG:ifirst+mc+FACEG,NEQU) -c - integer ie,ic,i,k - REAL bound,coef4,slope2,dtdx,slope4 - REAL csq, rho, u, v, p - REAL drho, du, dv, dp - REAL spminus, spplus, spzero, smminus, smplus, smzero - REAL alpham, alphap, alpha0r - REAL alpha0v - REAL apright, amright, azrright - REAL azv1rght - REAL apleft, amleft, azrleft - REAL azv1left,ceigv - integer dir1,dir2 - - if (dir.eq.0) then - dir1 = 2 - dir2 = 3 - else - dir1 = 3 - dir2 = 2 - endif -c -c write(6,*) "in trace" -c -c do ic=ifirst-4,ilast+4 -c write(6,*) "ic,state, flat =",ic, -c & tracergt(ic,1),tracergt(ic,2), -c & tracergt(ic,3),tracergt(ic,4), -c call flush(6) -c enddo - -c*********************************************************************** -c ****************************************************************** -c * check for inflection points in characteristic speeds -c * compute slopes at cell edges -c * zero slopes if neighboring cells have different loading -c ****************************************************************** - do ie=ifirst+1-FACEG,ilast+FACEG - do k=1,NEQU - edgslope(ie,k)=tracergt(ie,k)-tracelft(ie,k) - enddo - enddo -c ****************************************************************** -c * limit slopes -c ****************************************************************** - do i=1,NEQU - do ic=ifirst-CELLG,ilast+CELLG - celslope(ic,i)=zero - enddo - enddo - if (igdnv.eq.2) then -c write(6,*) "second-order slopes" -c **************************************************************** -c * second-order slopes -c **************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn(ic)) - enddo - do ic=ifirst+1-CELLG,ilast+CELLG-1 -c call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) -c flattn=one - do i=1,NEQU - slope2=half*(edgslope(ic,i)+edgslope(ic+1,i)) - celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) - if (edgslope(ic,i)*edgslope(ic+1,i).le.zero) then - celslope(ic,i)=zero - else - bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) - celslope(ic,i)=sign(min(two*bound,abs(slope2)),slope2) -c celslope(ic,i)=flattn*celslope(ic,i) - celslope(ic,i)=flattn(ic)*celslope(ic,i) - endif -c write(6,*) "i,ic,celslope= ", i,ic,celslope(ic,i) -c call flush(6) - enddo - enddo - else if (igdnv.eq.4) then -c write(6,*) "fourth-order slopes" -c **************************************************************** -c * fourth-order slopes -c **************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn(ic)) - enddo - do ic=ifirst+2-CELLG,ilast+CELLG-2 -c call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) -c flattn=one - do i=1,NEQU - slope4=fourth*(tracergt(ic+2,i)-tracergt(ic-2,i)) - celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) - coef4=third*(four*celslope(ic,i)-slope4) - if (edgslope(ic,i)*edgslope(ic+1,i).le.zero .or. - & coef4*celslope(ic,i).lt.zero) then - celslope(ic,i)=zero - else - bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) - celslope(ic,i)=sign(min(two*bound,abs(coef4)),coef4) -c celslope(ic,i)=flattn(ic)*celslope(ic,i) - endif - enddo - enddo - endif -c ****************************************************************** -c * characteristic projection -c ****************************************************************** - do ic=ifirst-FACEG+1,ilast+FACEG - dtdx=dt/dx - rho = max(smallr,tracergt(ic,1)) - u = tracergt(ic,dir1) - v = tracergt(ic,dir2) - p = tracergt(ic,NEQU) - drho = celslope(ic,1) - du = celslope(ic,dir1) - dv = celslope(ic,dir2) - dp = celslope(ic,NEQU) - - ceigv = sound(ic) - csq = ceigv**2 - - alpham = half*(dp/(rho*ceigv) - du)*rho/ceigv - alphap = half*(dp/(rho*ceigv) + du)*rho/ceigv - alpha0r = drho - dp/csq - alpha0v = dv - - if ((u-ceigv).gt.0) then - spminus = -one - smminus = (u-ceigv)*dtdx - else - spminus = (u-ceigv)*dtdx - smminus = one - endif - if ((u+ceigv).gt.0) then - spplus = -one - smplus = (u+ceigv)*dtdx - else - spplus = (u+ceigv)*dtdx - smplus = one - endif - if ((u).gt.0) then - spzero = -one - smzero = u*dtdx - else - spzero = u*dtdx - smzero = one - endif - apright = half*(-one - spplus )*alphap - amright = half*(-one - spminus)*alpham - azrright = half*(-one - spzero )*alpha0r - azv1rght = half*(-one - spzero )*alpha0v - tracergt(ic,1) = rho + apright + amright + azrright - tracergt(ic,1) = max(smallr,tracergt(ic,1)) - tracergt(ic,dir1) = u + (apright - amright)*ceigv/rho - tracergt(ic,dir2) = v + azv1rght - tracergt(ic,NEQU) = p + (apright + amright)*csq - - apleft = half*(one - smplus )*alphap - amleft = half*(one - smminus)*alpham - azrleft = half*(one - smzero )*alpha0r - azv1left = half*(one - smzero )*alpha0v - tracelft(ic+1,1) = rho + apleft + amleft + azrleft - tracelft(ic+1,1) = max(smallr,tracelft(ic+1,1)) - tracelft(ic+1,dir1) = u + (apleft - amleft)*ceigv/rho - tracelft(ic+1,dir2) = v + azv1left - tracelft(ic+1,NEQU) = p + (apleft + amleft)*csq - enddo -c call flush(6) - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/avgint.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/avgint.m4 deleted file mode 100644 index 552e1b84..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/avgint.m4 +++ /dev/null @@ -1,590 +0,0 @@ -c -c File: $URL$ -c Package: SAMRAI applications -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for conservative interlevel transfer of velocity -c and pressure for 3d euler equations. -c -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/../amrflaten.i)dnl -c -define(coarsen_index,`dnl - if ($1.lt.0) then - $2=($1+1)/$3-1 - else - $2=$1/$3 - endif -')dnl -define(coarse_fine_cell_deltas,`dnl - do ir$1=0,ratio($1)-1 - deltax(ir$1,$1)=(dble(ir$1)+half)*dxf($1)-dxc($1)*half - enddo -')dnl -define(muscl_limited_conserved_slopes,`dnl - do ie$1=ifirstc$1,ilastc$1+1 - diff$1(ie$1)=conservc($2) - & -conservc($3) - enddo - do ic$1=ifirstc$1,ilastc$1 - coef2=half*(diff$1(ic$1+1)+diff$1(ic$1)) - bound=two*min(abs(diff$1(ic$1+1)),abs(diff$1(ic$1))) - if (diff$1(ic$1)*diff$1(ic$1+1).gt.zero) then - slope$1($4)=sign(min(abs(coef2),bound),coef2) - & /dxc($1) - else - slope$1($4)=zero - endif - slope$1($4)=slope$1($4)*flat$1($4) - enddo -')dnl -c -c*********************************************************************** -c Conservative linear interpolation for 3d flux variables. -c*********************************************************************** -c - subroutine conservlinint3d( - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & ratio,dxc,dxf, - & gamma, - & densc,densf, - & velc,presc, - & velf,presf, - & conservc, - & tflat,tflat2,sound,mc, - & tdensc,tpresc,tvelc, - & flat0,flat1,flat2, - & diff0,slope0,diff1,slope1,diff2,slope2) -c*********************************************************************** - implicit none - REAL zero,half,one,two - parameter (zero=0.0d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) -c - integer - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2 - integer ratio(0:NDIM-1) - REAL - & dxc(0:NDIM-1), - & dxf(0:NDIM-1), - & gamma - REAL - & densc(CELL3d(cilo,cihi,0)), - & densf(CELL3d(filo,fihi,0)), - & velc(CELL3d(cilo,cihi,0),0:NDIM-1), - & presc(CELL3d(cilo,cihi,0)) - REAL - & velf(CELL3d(filo,fihi,0),0:NDIM-1), - & presf(CELL3d(filo,fihi,0)) - REAL - & conservc(CELL3d(ifirstc,ilastc,1)), - & flat0(CELL3d(ifirstc,ilastc,0)), - & flat1(CELL3d(ifirstc,ilastc,0)), - & flat2(CELL3d(ifirstc,ilastc,0)), - & diff0(ifirstc0:ilastc0+1), - & slope0(CELL3d(ifirstc,ilastc,0)), - & diff1(ifirstc1:ilastc1+1), - & slope1(CELL3d(ifirstc,ilastc,0)), - & diff2(ifirstc2:ilastc2+1), - & slope2(CELL3d(ifirstc,ilastc,0)) - REAL - & deltax(0:15,0:NDIM-1) - integer mc - REAL - & tdensc(0:mc-1),tpresc(0:mc-1),tvelc(0:mc-1) - REAL - & tflat(0:mc-1),tflat2(0:mc-1),sound(0:mc-1) - - integer id,ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2,it - REAL coef2,bound,val,valinv, - & deltax1,deltax2,v2norm - logical presneg -c -c*********************************************************************** -c - - presneg = .false. - -coarse_fine_cell_deltas(0)dnl - -coarse_fine_cell_deltas(1)dnl - -coarse_fine_cell_deltas(2)dnl - -c -c compute the flatten coefficients to further limit the slopes -c - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0-1,ilastc0+1 - it = ic0-cilo0 - tdensc(it) = densc(ic0,ic1,ic2) - tpresc(it) = presc(ic0,ic1,ic2) - tvelc(it) = velc(ic0,ic1,ic2,0) - enddo - call amrflaten(ifirstc0,ilastc0,cilo0,cihi0,mc,gamma, - & tdensc,tpresc,tvelc,tflat,tflat2,sound) - do ic0=ifirstc0,ilastc0 - flat0(ic0,ic1,ic2) = tflat(ic0-ifirstc0) - enddo - enddo - enddo - - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1-1,ilastc1+1 - it = ic1-cilo1 - tdensc(it) = densc(ic0,ic1,ic2) - tpresc(it) = presc(ic0,ic1,ic2) - tvelc(it) = velc(ic0,ic1,ic2,1) - enddo - call amrflaten(ifirstc1,ilastc1,cilo1,cihi1,mc,gamma, - & tdensc,tpresc,tvelc,tflat,tflat2,sound) - do ic1=ifirstc1,ilastc1 - flat1(ic0,ic1,ic2) = tflat(ic1-ifirstc1) - enddo - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - do ic2=ifirstc2-1,ilastc2+1 - it = ic2-cilo2 - tdensc(it) = densc(ic0,ic1,ic2) - tpresc(it) = presc(ic0,ic1,ic2) - tvelc(it) = velc(ic0,ic1,ic2,2) - enddo - call amrflaten(ifirstc2,ilastc2,cilo2,cihi2,mc,gamma, - & tdensc,tpresc,tvelc,tflat,tflat2,sound) - do ic2=ifirstc2,ilastc2 - flat2(ic0,ic1,ic2) = tflat(ic2-ifirstc2) - enddo - enddo - enddo - -c -c - -c -c construct fine velocity values using conservative linear -c interpolation on momentum -c - do id=0,NDIM-1 - - do ic2=ifirstc2-1,ilastc2+1 - do ic1=ifirstc1-1,ilastc1+1 - do ic0=ifirstc0-1,ilastc0+1 - conservc(ic0,ic1,ic2) = - & densc(ic0,ic1,ic2)*velc(ic0,ic1,ic2,id) - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 -muscl_limited_conserved_slopes(0,`ie0,ic1,ic2',`ie0-1,ic1,ic2',`ic0,ic1,ic2')dnl - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(1,`ic0,ie1,ic2',`ic0,ie1-1,ic2',`ic0,ic1,ic2')dnl - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(2,`ic0,ic1,ie2',`ic0,ic1,ie2-1',`ic0,ic1,ic2')dnl - enddo - enddo - - do if2=ifirstf2,ilastf2 -coarsen_index(if2,ic2,ratio(2))dnl - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 -coarsen_index(if1,ic1,ratio(1))dnl - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 -coarsen_index(if0,ic0,ratio(0))dnl - ir0=if0-ic0*ratio(0) - velf(if0,if1,if2,id)=(conservc(ic0,ic1,ic2) - & + slope0(ic0,ic1,ic2)*deltax(ir0,0) - & + slope1(ic0,ic1,ic2)*deltax1 - & + slope2(ic0,ic1,ic2)*deltax2) - & / densf(if0,if1,if2) - enddo - enddo - enddo - - enddo - -c -c construct fine pressure values using conservative linear -c interpolation on energy -c - val = (gamma-one) - valinv = one/(gamma-one) - - do ic2=ifirstc2-1,ilastc2+1 - do ic1=ifirstc1-1,ilastc1+1 - do ic0=ifirstc0-1,ilastc0+1 - v2norm = velc(ic0,ic1,ic2,0)**2 - & + velc(ic0,ic1,ic2,1)**2 - & + velc(ic0,ic1,ic2,2)**2 - conservc(ic0,ic1,ic2) = presc(ic0,ic1,ic2)*valinv - & + half*densc(ic0,ic1,ic2)*v2norm - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 -muscl_limited_conserved_slopes(0,`ie0,ic1,ic2',`ie0-1,ic1,ic2',`ic0,ic1,ic2')dnl - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(1,`ic0,ie1,ic2',`ic0,ie1-1,ic2',`ic0,ic1,ic2')dnl - enddo - enddo - - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 -muscl_limited_conserved_slopes(2,`ic0,ic1,ie2',`ic0,ic1,ie2-1',`ic0,ic1,ic2')dnl - enddo - enddo - - do if2=ifirstf2,ilastf2 -coarsen_index(if2,ic2,ratio(2))dnl - ir2=if2-ic2*ratio(2) - deltax2=deltax(ir2,2) - do if1=ifirstf1,ilastf1 -coarsen_index(if1,ic1,ratio(1))dnl - ir1=if1-ic1*ratio(1) - deltax1=deltax(ir1,1) - do if0=ifirstf0,ilastf0 -coarsen_index(if0,ic0,ratio(0))dnl - ir0=if0-ic0*ratio(0) - v2norm = velf(if0,if1,if2,0)**2 - & + velf(if0,if1,if2,1)**2 - & + velf(if0,if1,if2,2)**2 - presf(if0,if1,if2) = ((conservc(ic0,ic1,ic2) - & + slope0(ic0,ic1,ic2)*deltax(ir0,0) - & + slope1(ic0,ic1,ic2)*deltax1 - & + slope2(ic0,ic1,ic2)*deltax2) - & - half*densf(if0,if1,if2)*v2norm) * val - if (presf(if0,if1,if2).lt.zero) then -c write(6,*) "IN conservlinint3d" -c write(6,*) "gamma,val,valinv = ", -c & gamma,val,valinv -c write(6,*) "ifirstf0,ilastf0 ",ifirstf0,ilastf0, -c & ", ifirstf1,ilastf1 ",ifirstf1,ilastf1 -c & ", ifirstf2,ilastf2 ",ifirstf2,ilastf2 -c write(6,*) "if0,if1,if2 ",if0,if,if21 -c write(6,*) "ic0,ic1,if2 ",ic0,ic,if21 -c write(6,*) "fine energy = ", -c & conservc(ic0,ic1,ic2) + slope0(ic0,ic1,ic2)*deltax(ir0,0) -c & + slope1(ic0,ic1,ic2)*deltax1 -c & + slope2(ic0,ic1,ic2)*deltax2 -c write(6,*) "densf(if0,if1,if2) ",densf(if0,if1,if2) -c write(6,*) "vel() ",velf(if0,if1,if2,0), -c & velf(if0,if1,if2,1), -c & velf(if0,if1,if2,2) -c write(6,*) "presf(if0,if1,if2) ",presf(if0,if1,if2) -c write(6,*) "conservc(",ic0,ic1,ic2,") ", -c & conservc(ic0,ic1,ic2) -c write(6,*) "slope0(",ic0,ic1,ic2,") ", -c & slope0(ic0,ic1,ic2) -c write(6,*) "deltax(",ir0,0,") ",deltax(ir0,0) -c write(6,*) "slope1(",ic0,ic1,ic2,") ", -c & slope1(ic0,ic1,ic2) -c write(6,*) "deltax1(",ir1,1,") ",deltax1 -c write(6,*) "slope2(",ic0,ic1,ic2,") ", -c & slope2(ic0,ic1,ic2) -c write(6,*) "deltax2(",ir2,2,") ",deltax2 -c write(6,*) "val ",val,", v2norm ",v2norm -c write(6,*) "presc(",ic0,ic1,ic2,") ",presc(ic0,ic1,ic2) -c write(6,*) "densc(",ic0,ic1,ic2,") ",densc(ic0,ic1,ic2) -c write(6,*) "velc() ",velc(ic0,ic1,ic2,0), -c & velc(ic0,ic1,ic2,1), -c & velc(ic0,ic1,ic2,2) - presneg = .true. - endif - enddo - enddo - enddo - - if (presneg) then - write(6,*) "negative pressure reported in conservlinint3d" -c write(6,*) "coarse conserved values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,conservc = ", -c & ic0,ic1,ic2,conservc(ic0,ic1,ic2) -c enddo -c enddo -c enddo -c write(6,*) "coarse density values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,densc = ", -c & ic0,ic1,ic2,densc(ic0,ic1,ic2) -c enddo -c enddo -c enddo -c write(6,*) "coarse velocity0 values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,velc = ", -c & ic0,ic1,ic2,velc(ic0,ic1,ic2,0) -c enddo -c enddo -c enddo -c write(6,*) "coarse velocity1 values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,velc = ", -c & ic0,ic1,ic2,velc(ic0,ic1,ic2,1) -c enddo -c enddo -c enddo -c write(6,*) "coarse velocity2 values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,velc = ", -c & ic0,ic1,ic2,velc(ic0,ic1,ic2,2) -c enddo -c enddo -c enddo -c write(6,*) "coarse pressure values" -c do ic2=ifirstc2-1,ilastc2+1 -c do ic1=ifirstc1-1,ilastc1+1 -c do ic0=ifirstc0-1,ilastc0+1 -c write(6,*) "ic0,ic1,ic2,presc = ", -c & ic0,ic1,ic2,presc(ic0,ic1,ic2) -c enddo -c enddo -c enddo -c write(6,*) "fine density values" -c do if2=ifirstf2,ilastf2 -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,if2,densf = ", -c & if0,if1,if2,densf(if0,if1,if2) -c enddo -c enddo -c enddo -c write(6,*) "fine velocity0 values" -c do if2=ifirstf2,ilastf2 -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,if2,velf = ", -c & if0,if1,if2,velf(if0,if1,if2,0) -c enddo -c enddo -c enddo -c write(6,*) "fine velocity1 values" -c do if2=ifirstf2,ilastf2 -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,if2,velf = ", -c & if0,if1,if2,velf(if0,if1,if2,1) -c enddo -c enddo -c enddo -c write(6,*) "fine velocity2 values" -c do if2=ifirstf2,ilastf2 -c do if1=ifirstf1,ilastf1 -c do if0=ifirstf0,ilastf0 -c write(6,*) "if0,if1,if2,velf = ", -c & if0,if1,if2,velf(if0,if1,if2,2) -c enddo -c enddo -c enddo - stop - endif -c - return - end -c -c -c*********************************************************************** -c Volume weighted averaging for 3d flux variables. -c*********************************************************************** -c - subroutine conservavg3d( - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, - & ratio,dxf,dxc, - & gamma, - & densf,densc, - & velf,presf, - & velc,presc, - & conservf) -c*********************************************************************** - implicit none - REAL zero,half,one - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.d0) -c - integer - & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, - & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, - & filo0,filo1,filo2,fihi0,fihi1,fihi2, - & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 - integer ratio(0:NDIM-1) - REAL - & dxf(0:NDIM-1), - & dxc(0:NDIM-1), - & gamma - REAL - & densf(CELL3d(filo,fihi,0)), - & densc(CELL3d(cilo,cihi,0)), - & velf(CELL3d(filo,fihi,0),0:NDIM-1), - & presf(CELL3d(filo,fihi,0)) - REAL - & velc(CELL3d(cilo,cihi,0),0:NDIM-1), - & presc(CELL3d(cilo,cihi,0)) - REAL - & conservf(CELL3d(ifirstf,ilastf,0)) - integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2,id - REAL dVf,dVc,val,valinv,v2norm -c -c*********************************************************************** -c - dVf = dxf(0)*dxf(1)*dxf(2) - dVc = dxc(0)*dxc(1)*dxc(2) -c -c construct coarse velocity values using conservative average -c of momentum -c - do id=0,NDIM-1 - - do if2=ifirstf2,ilastf2 - do if1=ifirstf1,ilastf1 - do if0=ifirstf0,ilastf0 - conservf(if0,if1,if2) = - & densf(if0,if1,if2)*velf(if0,if1,if2,id) - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - velc(ic0,ic1,ic2,id) = zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - velc(ic0,ic1,ic2,id) = velc(ic0,ic1,ic2,id) - & + conservf(if0,if1,if2)*dVf - enddo - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - velc(ic0,ic1,ic2,id) = velc(ic0,ic1,ic2,id) - & / (densc(ic0,ic1,ic2)*dVc) - enddo - enddo - enddo - - enddo - -c -c construct coarse velocity values using conservative average -c of energy -c - val = (gamma-one) - valinv = one/(gamma-one) - - do if2=ifirstf2,ilastf2 - do if1=ifirstf1,ilastf1 - do if0=ifirstf0,ilastf0 - v2norm = velf(if0,if1,if2,0)**2 - & + velf(if0,if1,if2,1)**2 - & + velf(if0,if1,if2,2)**2 - conservf(if0,if1,if2) = presf(if0,if1,if2)*valinv - & + half*densf(if0,if1,if2)*v2norm - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - presc(ic0,ic1,ic2) = zero - enddo - enddo - enddo - - do ir2=0,ratio(2)-1 - do ir1=0,ratio(1)-1 - do ir0=0,ratio(0)-1 - do ic2=ifirstc2,ilastc2 - if2=ic2*ratio(2)+ir2 - do ic1=ifirstc1,ilastc1 - if1=ic1*ratio(1)+ir1 - do ic0=ifirstc0,ilastc0 - if0=ic0*ratio(0)+ir0 - presc(ic0,ic1,ic2) = presc(ic0,ic1,ic2) - & + conservf(if0,if1,if2)*dVf - enddo - enddo - enddo - enddo - enddo - enddo - - do ic2=ifirstc2,ilastc2 - do ic1=ifirstc1,ilastc1 - do ic0=ifirstc0,ilastc0 - v2norm = velc(ic0,ic1,ic2,0)**2 - & + velc(ic0,ic1,ic2,1)**2 - & + velc(ic0,ic1,ic2,2)**2 - presc(ic0,ic1,ic2) = ((presc(ic0,ic1,ic2)/dVc) - & - half*densc(ic0,ic1,ic2)*v2norm) * val - enddo - enddo - enddo - - -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flaten1d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flaten1d.m4 deleted file mode 100644 index e02e222d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flaten1d.m4 +++ /dev/null @@ -1,3 +0,0 @@ -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(FORTDIR/../flaten.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flux.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flux.m4 deleted file mode 100644 index 1668b1b2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/flux.m4 +++ /dev/null @@ -1,335 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/m4flux.i)dnl - - subroutine fluxcorrec2d(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx,gamma,idir, - & density,velocity,pressure, - & flux0,flux1,flux2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2, - & ttracelft0,ttracelft1,ttracelft2, - & ttracergt0,ttracergt1,ttracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - integer idir -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & gamma, - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)), -c - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), -c - & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU), -c - & ttracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & ttracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & ttracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & ttracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & ttracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & ttracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,k - REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) - REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel2,vel0,gam_min_one -c write(6,*) "In fluxcorrec2d()" - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif -c - gam_min_one = gamma - one -c -c "Forward" computation of transverse flux terms -c - if (idir.eq.1) then -c -correc_flux2d(0,`ic1,ic2',1,`ic2,ic0',2)dnl -c -correc_flux2d(1,`ic2,ic0',0,`ic1,ic2',2)dnl -c -correc_flux2d(2,`ic0,ic1',0,`ic1,ic2',1)dnl -c -c "Backward" computation of transverse flux terms -c - elseif (idir.eq.-1) then -c -correc_flux2d(0,`ic1,ic2',2,`ic0,ic1',1)dnl -c -correc_flux2d(1,`ic2,ic0',2,`ic0,ic1',0)dnl -c -correc_flux2d(2,`ic0,ic1',1,`ic2,ic0',0)dnl -c - endif -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrec3d(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx, - & gamma,density,velocity,pressure, - & fluxa0,fluxa1,fluxa2, - & fluxb0,fluxb1,fluxb2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & gamma, - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)), - & fluxa0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & fluxa1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & fluxa2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & fluxb0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & fluxb1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & fluxb2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,k - REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) - REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel2,vel0,gam_min_one -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** - gam_min_one = gamma - one -c -correc_flux3d(2,0,1,a0,a1,`ic1,ic2',`ic2,ic0')dnl -c -correc_flux3d(1,2,0,a2,b0,`ic0,ic1',`ic1,ic2')dnl -c -correc_flux3d(0,1,2,b1,b2,`ic2,ic0',`ic0,ic1')dnl -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcalculation(dt,xcell0,xcell1,visco,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gamma,rpchoice, - & density,velocity,pressure, - & flux0,flux1,flux2, - & trlft0,trlft1,trlft2, - & trrgt0,trrgt1,trrgt2) - -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer xcell0,xcell1,visco,rpchoice - REAL dt,dx(0:NDIM-1),gamma -c variables in 2d cell indexed - REAL - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & trlft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & trrgt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & trlft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & trrgt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & trlft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & trrgt2(FACE3d2(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,ie0,ie1,ie2,j - REAL stateL(NEQU),stateR(NEQU), - & riemst(NEQU) - REAL mom0,mom1,mom2,Hent,v2norm,vel(0:NDIM-1) - REAL mom0L,mom1L,mom2L,enerL,mom0R,mom1R,mom2R,enerR - REAL maxeig, vcoef,vcorr(NEQU),gam_min_one -c -c variables for hllc scheme - REAL aLsq,aRsq,keL,keR,flux(NEQU),diff(NEQU) - REAL mfL,mfR,star(NEQU),sL,sM,sR - REAL w,omw,hat(NEQU+1),denom -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - gam_min_one = gamma-one - -c write(6,*) "in fluxcalculation..." -c write(6,*) "ifirst = ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast = ",ilast0,ilast1,ilast2 -c write(6,*) "xcell0,xcell1 = ",xcell0,xcell1 -c write(6,*) "visco = ",visco -c write(6,*) "gamma = ",gamma -c write(6,*) "rpchoice = ",rpchoice -c write(6,*) "gam_min_one = ",gam_min_one -c call flush(6) -riemann_solve(0,1,2,`ic1,ic2',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl - -c -riemann_solve(1,0,2,`ic2,ic0',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl - -c -riemann_solve(2,0,1,`ic0,ic1',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl - - if (visco.eq.1) then -c write(6,*) "doing artificial viscosity" -c -artificial_viscosity1(0,1,2)dnl -c -artificial_viscosity1(1,2,0)dnl -c -artificial_viscosity1(2,0,1)dnl -c - endif - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - - subroutine consdiff(ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx, - & flux0,flux1,flux2, - & gamma,density,velocity,pressure) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** - integer ifirst0, ilast0,ifirst1, ilast1,ifirst2,ilast2 - REAL dx(0:NDIM-1) - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & gamma, - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL3d(ifirst,ilast,CELLG)) -c - integer ic0,ic1,ic2,k - REAL temp,v2norm,mom(NDIM),energy, - & gam_min_one - -c*********************************************************************** -c update conserved to full time -c note the permutation of indices in 2nd, 3rd coordinate directions -c*********************************************************************** - gam_min_one = gamma - one - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - mom(1) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,1) - mom(2) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,2) - mom(3) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,3) - v2norm = (velocity(ic0,ic1,ic2,1)**2+ - & velocity(ic0,ic1,ic2,2)**2+ - & velocity(ic0,ic1,ic2,3)**2) - energy = pressure(ic0,ic1,ic2)/gam_min_one + - & half*density(ic0,ic1,ic2)*v2norm - - density(ic0,ic1,ic2) = density(ic0,ic1,ic2) - & -(flux0(ic0+1,ic1,ic2,1)-flux0(ic0,ic1,ic2,1))/dx(0) - & -(flux1(ic1+1,ic2,ic0,1)-flux1(ic1,ic2,ic0,1))/dx(1) - & -(flux2(ic2+1,ic0,ic1,1)-flux2(ic2,ic0,ic1,1))/dx(2) - density(ic0,ic1,ic2) = max(smallr,density(ic0,ic1,ic2)) - - do k=1,3 - mom(k) = mom(k) - & -(flux0(ic0+1,ic1,ic2,k+1)-flux0(ic0,ic1,ic2,k+1))/dx(0) - & -(flux1(ic1+1,ic2,ic0,k+1)-flux1(ic1,ic2,ic0,k+1))/dx(1) - & -(flux2(ic2+1,ic0,ic1,k+1)-flux2(ic2,ic0,ic1,k+1))/dx(2) - velocity(ic0,ic1,ic2,k) = mom(k)/density(ic0,ic1,ic2) - enddo - energy = energy - & -(flux0(ic0+1,ic1,ic2,NEQU)-flux0(ic0,ic1,ic2,NEQU))/dx(0) - & -(flux1(ic1+1,ic2,ic0,NEQU)-flux1(ic1,ic2,ic0,NEQU))/dx(1) - & -(flux2(ic2+1,ic0,ic1,NEQU)-flux2(ic2,ic0,ic1,NEQU))/dx(2) -c - v2norm = (velocity(ic0,ic1,ic2,1)**2+ - & velocity(ic0,ic1,ic2,2)**2+velocity(ic0,ic1,ic2,3)**2) - temp = energy - half*density(ic0,ic1,ic2)*v2norm - pressure(ic0,ic1,ic2) = gam_min_one*temp - pressure(ic0,ic1,ic2) = max(smallr,pressure(ic0,ic1,ic2)) - enddo - enddo - enddo -c - return - end -c*********************************************************************** -include(FORTDIR/../gas1d_approxrp.i)dnl -include(FORTDIR/../gas1d_exactrp.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/fluxcorner.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/fluxcorner.m4 deleted file mode 100644 index b4e781d6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/fluxcorner.m4 +++ /dev/null @@ -1,215 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/m4fluxcorner.i)dnl - - subroutine onethirdstate(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gamma,density,velocity,pressure, - & flux0,flux1,flux2, - & st3) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1), gamma -c variables in 3d cell indexed - REAL - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & st3(CELL3d(ifirst,ilast,CELLG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,k - REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) - REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel2,vel0,pres, - & gam_min_one -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** - gam_min_one = gamma - one -c - if (idir.eq.0) then -c -st_third(0,1,2,`ic1,ic2')dnl -c - elseif (idir.eq.1) then -c -st_third(1,2,0,`ic2,ic0')dnl -c - elseif (idir.eq.2) then -c -st_third(2,0,1,`ic0,ic1')dnl -c - endif - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxthird(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gamma,rpchoice, - & density,velocity,pressure, - & st3, - & flux0,flux1,flux2 ) - -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt,dx(0:NDIM-1),gamma - integer rpchoice - REAL - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & st3(CELL3d(ifirst,ilast,CELLG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL stateL(4),stateR(4), - & riemst(4) - REAL mom2,mom1,mom0,Hent,v2norm,vel(0:3-1), - & gam_min_one -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - gam_min_one = gamma - one -c - if (idir.eq.0) then -c -f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c - elseif (idir.eq.1) then -c -f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c - elseif (idir.eq.2) then -c -f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c - endif -c - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrecjt(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gamma,density,velocity,pressure, - & flux0,flux1,flux2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:3-1) -c variables in 2d cell indexed - REAL - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,k - REAL trnsvers(NEQU) -c REAL ttvlft(NEQU),ttvrgt(NEQU) - REAL ttv(NEQU) - REAL v2norm,rho,vel1,vel2,vel0,gamma, - & gam_min_one -c - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** - gam_min_one = gamma - one -c - if (idir.eq.0) then -c -correc_fluxjt(0,2,1,`ic2,ic0',`ic0,ic1')dnl -c - elseif (idir.eq.1) then -c -correc_fluxjt(1,0,2,`ic0,ic1',`ic1,ic2')dnl -c - elseif (idir.eq.2) then -c -correc_fluxjt(2,1,0,`ic1,ic2',`ic2,ic0')dnl -c - endif -c - return - end -c -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/grad.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/grad.m4 deleted file mode 100644 index 28b278bb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/grad.m4 +++ /dev/null @@ -1,424 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - - subroutine detectgrad( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & vghost2,tagghost2,ttagghost2, - & dx, - & gradtol, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dotag,donttag, - & vghost0,vghost1,vghost2, - & tagghost0,tagghost1,tagghost2, - & ttagghost0,ttagghost1,ttagghost2 - REAL - & dx(0:NDIM-1), - & gradtol -c variables indexed as 3dimensional - REAL - & var(CELL3dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL3dVECG(ifirst,ilast,tagghost)), - & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) -c - REAL tol - REAL facejump, loctol - REAL presm1,presp1 - REAL diag(0:NDIM-1),diag012 - logical tagcell - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - tol = gradtol - diag(0) = sqrt(dx(2)**2+dx(1)**2) - diag(1) = sqrt(dx(0)**2+dx(2)**2) - diag(2) = sqrt(dx(0)**2+dx(1)**2) - diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1,ic2) .ne. 0) then - loctol = 0.125*tol - else - loctol = tol - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1,ic2) - presp1 = var(ic0+1,ic1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(0))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2) - presp1 = var(ic0,ic1+1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(1))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1,ic2-1) - presp1 = var(ic0,ic1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(2))) - endif - - -c 2Dimensional diagonals - - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2-1) - presp1 = var(ic0,ic1+1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(0))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1+1,ic2-1) - presp1 = var(ic0,ic1-1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(0))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2-1) - presp1 = var(ic0+1,ic1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(1))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2+1) - presp1 = var(ic0+1,ic1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(1))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2) - presp1 = var(ic0+1,ic1+1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(2))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2) - presp1 = var(ic0+1,ic1-1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(2))) - endif - -c End 2Dimensional diagonals -c 3Dimensional diagonals - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2-1) - presp1 = var(ic0+1,ic1+1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2+1) - presp1 = var(ic0+1,ic1+1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2-1) - presp1 = var(ic0+1,ic1-1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2+1) - presp1 = var(ic0+1,ic1-1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - -c End 3Dimensional diagonals - - if ( tagcell ) then - temptags(ic0,ic1,ic2) = dotag - endif - enddo - enddo - enddo - return - end - - subroutine detectshock( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & vghost2,tagghost2,ttagghost2, - & dx, - & gradtol,gradonset, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dotag,donttag, - & vghost0,vghost1,vghost2, - & tagghost0,tagghost1,tagghost2, - & ttagghost0,ttagghost1,ttagghost2 - REAL - & dx(0:NDIM-1), - & gradtol,gradonset -c variables indexed as 3dimensional - REAL - & var(CELL3dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL3dVECG(ifirst,ilast,tagghost)), - & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) -c - REAL tol,onset - REAL jump1, jump2, facejump, loctol,locon - REAL presm1,presm2,presp1,presp2 - REAL diag(0:NDIM-1),diag012 - logical tagcell - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - tol = gradtol - onset = gradonset - diag(0) = sqrt(dx(2)**2+dx(1)**2) - diag(1) = sqrt(dx(0)**2+dx(2)**2) - diag(2) = sqrt(dx(0)**2+dx(1)**2) - diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1,ic2) .ne. 0) then - loctol = 0.125*tol - locon = 0.66*onset - else - loctol = tol - locon = onset - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1,ic2) - presm2 = var(ic0-2,ic1,ic2) - presp1 = var(ic0+1,ic1,ic2) - presp2 = var(ic0+2,ic1,ic2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(0)))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2) - presm2 = var(ic0,ic1-2,ic2) - presp1 = var(ic0,ic1+1,ic2) - presp2 = var(ic0,ic1+2,ic2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(1)))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1,ic2-1) - presm2 = var(ic0,ic1,ic2-2) - presp1 = var(ic0,ic1,ic2+1) - presp2 = var(ic0,ic1,ic2+2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(2)))) - endif - - -c 2Dimensional diagonals - - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2-1) - presp1 = var(ic0,ic1+1,ic2+1) - presm2 = var(ic0,ic1-2,ic2-2) - presp2 = var(ic0,ic1+2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(0)))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1+1,ic2-1) - presp1 = var(ic0,ic1-1,ic2+1) - presm2 = var(ic0,ic1+2,ic2-2) - presp2 = var(ic0,ic1-2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(0)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2-1) - presp1 = var(ic0+1,ic1,ic2+1) - presm2 = var(ic0-2,ic1,ic2-2) - presp2 = var(ic0+2,ic1,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(1)))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2+1) - presp1 = var(ic0+1,ic1,ic2-1) - presm2 = var(ic0-2,ic1,ic2+2) - presp2 = var(ic0+2,ic1,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(1)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2) - presp1 = var(ic0+1,ic1+1,ic2) - presm2 = var(ic0-2,ic1-2,ic2) - presp2 = var(ic0+2,ic1+2,ic2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(2)))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2) - presp1 = var(ic0+1,ic1-1,ic2) - presm2 = var(ic0-2,ic1+2,ic2) - presp2 = var(ic0+2,ic1-2,ic2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(2)))) - endif - -c End 2Dimensional diagonals -c 3Dimensional diagonals - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2-1) - presp1 = var(ic0+1,ic1+1,ic2+1) - presm2 = var(ic0-2,ic1-2,ic2-2) - presp2 = var(ic0+2,ic1+2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2+1) - presp1 = var(ic0+1,ic1+1,ic2-1) - presm2 = var(ic0-2,ic1-2,ic2+2) - presp2 = var(ic0+2,ic1+2,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2-1) - presp1 = var(ic0+1,ic1-1,ic2+1) - presm2 = var(ic0-2,ic1+2,ic2-2) - presp2 = var(ic0+2,ic1-2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2+1) - presp1 = var(ic0+1,ic1-1,ic2-1) - presm2 = var(ic0-2,ic1+2,ic2+2) - presp2 = var(ic0+2,ic1-2,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - -c End 3Dimensional diagonals - - if ( tagcell ) then - temptags(ic0,ic1,ic2) = dotag - endif - enddo - enddo - enddo - return - end - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/init.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/init.m4 deleted file mode 100644 index 14572776..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/init.m4 +++ /dev/null @@ -1,212 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - - subroutine eulerinit(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gcw0,gcw1,gcw2, - & gamma, - & density,velocity,pressure, - & nintervals,front, - & i_dens,i_vel,i_pres) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer gcw0,gcw1,gcw2 - integer data_problem - integer nintervals - REAL front(1:nintervals) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma - REAL i_dens(1:nintervals), - & i_vel(0:NDIM-1,1:nintervals), - & i_pres(1:nintervals) -c variables in 3d cell indexed - REAL - & density(CELL3dVECG(ifirst,ilast,gcw)), - & velocity(CELL3dVECG(ifirst,ilast,gcw),0:NDIM-1), - & pressure(CELL3dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,dir,ifr - REAL xc(0:NDIM-1) -c -c dir 0 two linear states (L,R) indp of y,z -c dir 1 two linear states (L,R) indp of x,z -c dir 2 two linear states (L,R) indp of x,y - -c write(6,*) "Inside eulerinit" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1), dx(2) -c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) -c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) -c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast= ",ilast0,ilast1,ilast2 -c write(6,*) "gamma= ",gamma -c call flush(6) - - dir = 0 - if (data_problem.eq.PIECEWISE_CONSTANT_X) then - dir = 0 - else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then - dir = 1 - else if (data_problem.eq.PIECEWISE_CONSTANT_Z) then - dir = 2 - endif - - if (dir.eq.0) then - ifr = 1 - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+ dx(0)*(dble(ic0-ifirst0)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - do ic2=ifirst2,ilast2 - density(ic0,ic1,ic2) = i_dens(ifr) - velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) - velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) - velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) - pressure(ic0,ic1,ic2) = i_pres(ifr) - enddo - enddo - enddo - else if (dir.eq.1) then - ifr = 1 - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic2=ifirst2,ilast2 - do ic0=ifirst0,ilast0 - density(ic0,ic1,ic2) = i_dens(ifr) - velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) - velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) - velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) - pressure(ic0,ic1,ic2) = i_pres(ifr) - enddo - enddo - enddo - else if (dir.eq.2) then - ifr = 1 - do ic2=ifirst2,ilast2 - xc(2) = xlo(2)+ dx(2)*(dble(ic2-ifirst2)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - density(ic0,ic1,ic2) = i_dens(ifr) - velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) - velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) - velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) - pressure(ic0,ic1,ic2) = i_pres(ifr) - enddo - enddo - enddo - endif -c - return - end -c -c*********************************************************************** -c -c Initialization routine where we use a spherical profile -c -c*********************************************************************** - subroutine eulerinitsphere(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gcw0,gcw1,gcw2, - & gamma, - & density,velocity,pressure, - & i_dens,i_vel,i_pres, - & o_dens,o_vel,o_pres, - & center,radius) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer gcw0,gcw1,gcw2 - integer data_problem - REAL i_dens,i_vel(0:NDIM-1),i_pres, - & o_dens,o_vel(0:NDIM-1),o_pres - REAL center(0:NDIM-1),radius -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma -c variables in 2d cell indexed - REAL - & density(CELL3dVECG(ifirst,ilast,gcw)), - & velocity(CELL3dVECG(ifirst,ilast,gcw),0:NDIM-1), - & pressure(CELL3dVECG(ifirst,ilast,gcw)) -c -c********************************************************************** -c - integer ic0,ic1,ic2 - REAL xc(0:NDIM-1) - REAL angle,phi,rad2,rad3,x0,x1,x2 -c -c write(6,*) "Inside eulerinitsphere" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1), dx(2) -c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) -c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) -c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast= ",ilast0,ilast1,ilast2 -c write(6,*) "gamma= ",gamma -c write(6,*) "front= ",front(0),front(1),front(2),front(3) -c write(6,*) " = ",front(4),front(5) -c call flush(6) - - do ic2=ifirst2,ilast2 - xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) - x2 = xc(2)-center(2) - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - x1 = xc(1)-center(1) - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - x0 = xc(0)-center(0) - if (x1.eq.zero .and. x0.eq.zero) then - angle = zero - else - angle = atan2(x1,x0) - endif - rad2 = sqrt(x0**2+x1**2) - if (rad2.eq.zero .and. x2.eq.zero) then - phi = zero - else - phi = atan2(rad2,x2) - endif - rad3 = sqrt(rad2**2+x2**2) - if (rad3.lt.radius) then - density(ic0,ic1,ic2) = i_dens - velocity(ic0,ic1,ic2,0)= i_vel(0)*sin(phi)*cos(angle) - velocity(ic0,ic1,ic2,1)= i_vel(1)*sin(phi)*sin(angle) - velocity(ic0,ic1,ic2,2)= i_vel(2)*cos(phi) - pressure(ic0,ic1,ic2) = i_pres - else - density(ic0,ic1,ic2) = o_dens - velocity(ic0,ic1,ic2,0)= o_vel(0)*sin(phi)*cos(angle) - velocity(ic0,ic1,ic2,1)= o_vel(1)*sin(phi)*sin(angle) - velocity(ic0,ic1,ic2,2)= o_vel(2)*cos(phi) - pressure(ic0,ic1,ic2) = o_pres - endif - enddo - enddo - enddo - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4flux.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4flux.i deleted file mode 100644 index 68d7ff65..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4flux.i +++ /dev/null @@ -1,364 +0,0 @@ -define(riemann_solve,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - - if (rpchoice.eq.APPROX_RIEM_SOLVE - & .or. rpchoice.eq.EXACT_RIEM_SOLVE ) then -c ************************************************************ -c * Approximate Riemann solver and exact Riemann solver have -c * identical setup and post-process phases. -c ************************************************************ - - do ic$3=ifirst$3-$6,ilast$3+$6 - do ic$2=ifirst$2-$5,ilast$2+$5 - do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) - -c ************************************************************ -c * Assign left and right states. Note only normal vel used. -c ************************************************************ - stateL(1) = trlft$1(ie$1,$4,1) - stateL(2) = trlft$1(ie$1,$4,2+$1) - stateL(3) = trlft$1(ie$1,$4,NEQU) - - stateR(1) = trrgt$1(ie$1,$4,1) - stateR(2) = trrgt$1(ie$1,$4,2+$1) - stateR(3) = trrgt$1(ie$1,$4,NEQU) - - if (rpchoice.eq.APPROX_RIEM_SOLVE) then - call gas1dapproxrp(gamma,stateL,stateR,riemst) - else if (rpchoice.eq.EXACT_RIEM_SOLVE) then - call gas1dexactrp(gamma,smallr,stateL,stateR,riemst) - endif - - if (riemst(2).le.zero) then - vel($2)=trrgt$1(ie$1,$4,2+$2) - vel($3)=trrgt$1(ie$1,$4,2+$3) - else - vel($2)=trlft$1(ie$1,$4,2+$2) - vel($3)=trlft$1(ie$1,$4,2+$3) - endif - vel($1)=riemst(2) - - mom$1 =riemst(1)*vel($1) - v2norm = vel(0)**2+vel(1)**2+vel(2)**2 - Hent =riemst(3)/gam_min_one+v2norm*riemst(1)/two - - flux$1(ie$1,$4,1)= dt*mom$1 - flux$1(ie$1,$4,2+$1)= dt*(mom$1*vel($1)+riemst(3)) - flux$1(ie$1,$4,2+$2)= dt*mom$1*vel($2) - flux$1(ie$1,$4,2+$3)= dt*mom$1*vel($3) - flux$1(ie$1,$4,5)= dt*riemst(2)*(Hent+riemst(3)) - - enddo - enddo - enddo - - elseif (rpchoice.eq.HLLC_RIEM_SOLVE) then -c ****************************************************************** -c * HLLC Riemann Solver -c ****************************************************************** - - do ic$3=ifirst$3-$6,ilast$3+$6 - do ic$2=ifirst$2-$5,ilast$2+$5 - do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) - -c ************************************************************ -c * Assign left and right states. -c ************************************************************ - do j=1,NEQU - stateL(j) = trlft$1(ie$1,$4,j) - stateR(j) = trrgt$1(ie$1,$4,j) - enddo - -c ************************************************************ -c * Calculate bounding signal speeds. To do this, need the -c * Roe-average of the velocity and sound speed. -c ************************************************************ - w = one / ( one + sqrt( stateR(1)/stateL(1) ) ) - omw = one - w - hat(2+$1) = w*stateL(2+$1) + omw*stateR(2+$1) - aLsq = gamma * stateL(NEQU) / stateL(1) - aRsq = gamma * stateR(NEQU) / stateR(1) - hat(NEQU+1) = sqrt( w*aLsq + omw*aRsq - & + half*gam_min_one*w*omw*( - & (stateR(2)-stateL(2))**2 - & + (stateR(3)-stateL(3))**2 - & + (stateR(4)-stateL(4))**2 ) ) - - sL = min( stateL(2+$1) - sqrt(aLsq), - & hat(2+$1) - hat(NEQU+1) ) - sR = max( stateR(2+$1) + sqrt(aRsq), - & hat(2+$1) + hat(NEQU+1) ) - mfL = stateL(1) * ( sL - stateL(2+$1) ) - mfR = stateR(1) * ( sR - stateR(2+$1) ) - sM = ( stateR(NEQU) - stateL(NEQU) - & + mfL*stateL(2+$1) - mfR*stateR(2+$1) )/(mfL-mfR) - -c ************************************************************ -c * Calculate flux starting at upwind state. -c ************************************************************ - if ( sM.gt.zero ) then - -c ********************************************************* -c * Flow is to the right; start from left state. -c ********************************************************* - flux(1) = stateL(1) * stateL(2+$1) - flux(2+$1) = flux(1) * stateL(2+$1) + stateL(NEQU) - flux(2+$2) = flux(1) * stateL(2+$2) - flux(2+$3) = flux(1) * stateL(2+$3) - keL = half * (stateL(2)**2 + stateL(3)**2 + - & stateL(4)**2) - flux(NEQU) = flux(1) - & * (aLsq / gam_min_one + keL) - -c ********************************************************* -c * Check if flow is subsonic. -c ********************************************************* - if ( sL.lt.zero ) then - -c ****************************************************** -c * Add contribution from left acoustic wave. -c ****************************************************** - denom = one / (sL-sM) - star(1) = stateL(1) * (sL-stateL(2+$1)) * denom - star(2+$1) = sM - star(2+$2) = stateL(2+$2) - star(2+$3) = stateL(2+$3) - star(NEQU) = stateL(NEQU)*( one + gamma * denom - & * ( sM-stateL(2+$1) ) ) - & + half * gam_min_one - & * star(1) * ( sM-stateL(2+$1) )**2 - - diff(1) = star(1) - stateL(1) - diff(2) = star(1)*star(2) - stateL(1)*stateL(2) - diff(3) = star(1)*star(3) - stateL(1)*stateL(3) - diff(4) = star(1)*star(4) - stateL(1)*stateL(4) - diff(NEQU) = ( star(NEQU)-stateL(NEQU) ) - & / gam_min_one - & + half * star(1) * - & (star(2)**2 + star(3)**2+ star(4)**2) - & - stateL(1) * keL - - do j=1,NEQU - flux(j) = flux(j) + sL*diff(j) - enddo - - endif - - else - -c ********************************************************* -c * Flow is to the left; start from right state. -c ********************************************************* - flux(1) = stateR(1) * stateR(2+$1) - flux(2+$1) = flux(1) * stateR(2+$1) + stateR(NEQU) - flux(2+$2) = flux(1) * stateR(2+$2) - flux(2+$3) = flux(1) * stateR(2+$3) - keR = half * (stateR(2)**2 + stateR(3)**2 + - & stateR(4)**2) - flux(NEQU) = flux(1) - & * (aRsq / gam_min_one + keR) - -c ********************************************************* -c * Check if flow is subsonic. -c ********************************************************* - if ( sR.gt.zero ) then - -c ****************************************************** -c * Add contribution from right acoustic wave. -c ****************************************************** - denom = one / (sR-sM) - star(1) = stateR(1) * (sR-stateR(2+$1)) * denom - star(2+$1) = sM - star(2+$2) = stateR(2+$2) - star(2+$3) = stateR(2+$3) - star(NEQU) = stateR(NEQU)*(1 + gamma * denom - & * ( sM-stateR(2+$1) ) ) - & + half * gam_min_one - & * star(1) * ( sM-stateR(2+$1) )**2 - - diff(1) = star(1) - stateR(1) - diff(2) = star(1)*star(2) - stateR(1)*stateR(2) - diff(3) = star(1)*star(3) - stateR(1)*stateR(3) - diff(4) = star(1)*star(4) - stateR(1)*stateR(4) - diff(NEQU) = ( star(NEQU)-stateR(NEQU) ) - & / gam_min_one - & + half * star(1) * - & (star(2)**2 + star(3)**2+ star(4)**2) - & - stateR(1) * keR - - do j=1,NEQU - flux(j) = flux(j) + sR*diff(j) - enddo - - endif - - endif - -c ************************************************************ -c * Assign average interface fluxes. -c ************************************************************ - do j=1,NEQU - flux$1(ie$1,$4,j) = dt * flux(j) - enddo - - enddo - enddo - enddo - - endif -')dnl -define(correc_flux2d,`dnl -c correct the $1-direction with $3-fluxes - do ic$5=ifirst$5-(FLUXG),ilast$5+(FLUXG) - do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) - do ic$1=ifirst$1-(FLUXG),ilast$1+(FLUXG) - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)= - & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))*0.5/dx($3) - enddo -c - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - ttracelft$1(ic$1+1,$2,k)=tracelft$1(ic$1+1,$2,k) - & - ttv(k) - ttracergt$1(ic$1 ,$2,k)=tracergt$1(ic$1 ,$2,k) - & - ttv(k) - enddo - enddo - enddo - enddo -')dnl -define(correc_flux3d,`dnl -c correct the $1-direction with $2$3-fluxes - do ic$1=ifirst$1-FLUXG,ilast$1+FLUXG - do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=0.5*( - & (flux$4(ic$2+1,$6,k)-flux$4(ic$2,$6,k))/dx($2)+ - & (flux$5(ic$3+1,$7,k)-flux$5(ic$3,$7,k))/dx($3)) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracelft$1(ic$1+1,ic$2,ic$3,k)=tracelft$1(ic$1+1,ic$2,ic$3,k) - & - ttv(k) - tracergt$1(ic$1 ,ic$2,ic$3,k)=tracergt$1(ic$1 ,ic$2,ic$3,k) - & - ttv(k) - enddo - enddo - enddo - enddo -')dnl -define(artificial_viscosity1,`dnl - do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - do ie$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG) - maxeig =trrgt$1(ie$1,ic$2,ic$3,NEQU)-trlft$1(ie$1,ic$2,ic$3,NEQU) - vcoef = tenth*abs(maxeig) - - mom0L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,2) - mom1L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,3) - mom2L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,4) - v2norm = mom1L**2+mom0L**2+mom2L**2 - enerL=trlft$1(ie$1,ic$2,ic$3,NEQU)/gam_min_one+ - & v2norm/(trlft$1(ie$1,ic$2,ic$3,1)*two) - mom0R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,2) - mom1R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,3) - mom2R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,4) - v2norm = mom1R**2+mom0R**2+mom2R**2 - enerR=trrgt$1(ie$1,ic$2,ic$3,NEQU)/gam_min_one+ - & v2norm/(trrgt$1(ie$1,ic$2,ic$3,1)*two) - - vcorr(1) = dt*vcoef* - & (trrgt$1(ie$1,ic$2,ic$3,1)-trlft$1(ie$1,ic$2,ic$3,1)) - vcorr(2) = dt*vcoef*(mom0R-mom0L) - vcorr(3) = dt*vcoef*(mom1R-mom1L) - vcorr(4) = dt*vcoef*(mom2R-mom2L) - vcorr(NEQU) = dt*vcoef*(enerR-enerL) - do j=1,NEQU - flux$1(ie$1,ic$2,ic$3,j)=flux$1(ie$1,ic$2,ic$3,j) - & -vcorr(j) - enddo - enddo - enddo - enddo -')dnl -c -define(artificial_viscosity2,`dnl - do ic1=ifirst1,ilast1 - do ie0=ifirst0,ilast0+1 - maxeig =pressure(ie0,ic1)-pressure(ie0-1,ic1) - vcoef = tenth*abs(maxeig) - mom0L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,0) - mom1L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,1) - mom0R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,0) - mom1R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,1) - v2norm = mom1L**2+mom0L**2 - enerL=pressure(ie0-1,ic1)/gam_min_one+ - & v2norm/(density(ie0-1,ic1)*two) - v2norm = mom1R**2+mom0R**2 - enerR=pressure(ie0,ic1)/gam_min_one+ - & v2norm/(density(ie0,ic1)*two) - vcorr(1)= dt*vcoef*(density(ie0,ic1)-density(ie0-1,ic1)) - vcorr(2)= dt*vcoef*(mom0R-mom0L) - vcorr(3)= dt*vcoef*(mom1R-mom1L) - vcorr(4)= dt*vcoef*(mom2R-mom2L) - vcorr(NEQU)= dt*vcoef*(enerR-enerL) - do j=1,NEQU - flux0(ie0,ic1,ic2,j)=flux0(ie0,ic1,ic2,j) - & -vcorr(j) - enddo - enddo - enddo - do ic0=ifirst0,ilast0 - do ie1=ifirst1,ilast1+1 - maxeig =pressure(ic0,ie1)-pressure(ic0-1,ie1) - vcoef = 0.1*abs(maxeig) - mom0L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,0) - mom1L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,1) - mom0R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,0) - mom1R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,1) - v2norm = mom1L**2+mom0L**2 - enerL=pressure(ic0,ie1-1)/gam_min_one+ - & v2norm/(density(ic0,ie1-1)*two) - v2norm = mom1R**2+mom0R**2 - enerR=pressure(ic0,ie1)/gam_min_one+ - & v2norm/(density(ic0,ie1)*two) - vcorr1= dt*vcoef*(density(ic0,ie1)-density(ic0,ie1-1)) - vcorr2= dt*vcoef*(mom0R-mom0L) - vcorr3= dt*vcoef*(mom1R-mom1L) - vcorr4= dt*vcoef*(enerR-enerL) - flux1(ie1,ic0,1)= flux1(ie1,ic0,1) - vcorr1 - flux1(ie1,ic0,2)= flux1(ie1,ic0,2) - vcorr2 - flux1(ie1,ic0,3)= flux1(ie1,ic0,3) - vcorr3 - flux1(ie1,ic0,4)= flux1(ie1,ic0,4) - vcorr4 - enddo - enddo -')dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4fluxcorner.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4fluxcorner.i deleted file mode 100644 index 99b769eb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4fluxcorner.i +++ /dev/null @@ -1,236 +0,0 @@ -define(st_third,`dnl - do ic$3=ifirst$3-FLUXG,ilast$3+FLUXG - do ic$2=ifirst$2-FLUXG,ilast$2+FLUXG - do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - pres = pressure(ic0,ic1,ic2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)= - & (flux$1(ic$1+1,$4,k)-flux$1(ic$1,$4,k))/(3*dx($1)) - enddo -c - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - st3(ic0,ic1,ic2,1)=rho -ttv(1) - st3(ic0,ic1,ic2,2)=vel0 -ttv(2) - st3(ic0,ic1,ic2,3)=vel1 -ttv(3) - st3(ic0,ic1,ic2,4)=vel2 -ttv(4) - st3(ic0,ic1,ic2,5)=pres -ttv(5) - enddo - enddo - enddo -')dnl -define(f_third,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-FLUXG,ilast$3+FLUXG - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - do ic$1=ifirst$1-(FLUXG-1),ilast$1+FLUXG - - stateL(1) = st3($5,1) - stateL(2) = st3($5,2+$1) - stateL(3) = st3($5,NEQU) - stateL(4) = stateL(3)/gam_min_one - - stateR(1) = st3(ic0,ic1,ic2,1) - stateR(2) = st3(ic0,ic1,ic2,2+$1) - stateR(3) = st3(ic0,ic1,ic2,NEQU) - stateR(4) = stateR(3)/gam_min_one - - if (rpchoice.eq.APPROX_RIEM_SOLVE) then - call gas1dapproxrp(gamma,stateL,stateR,riemst) - else if (rpchoice.eq.EXACT_RIEM_SOLVE) then - call gas1dexactrp(gamma,smallr,stateL,stateR,riemst) -c else if (rpchoice.eq.ROE_RIEM_SOLVE) then -c else if (rpchoice.eq.HLLC_RIEM_SOLVE) then - endif - - if (riemst(2).le.zero) then - vel($2)=st3(ic0,ic1,ic2,2+$2) - vel($3)=st3(ic0,ic1,ic2,2+$3) - else - vel($2)=st3($5,2+$2) - vel($3)=st3($5,2+$3) - endif - vel($1)=riemst(2) - - mom$1 =riemst(1)*vel($1) - v2norm = vel(0)**2+vel(1)**2+vel(2)**2 - Hent =riemst(3)/gam_min_one+v2norm*riemst(1)/two - flux$1(ic$1,$4,1)= dt*mom$1 - flux$1(ic$1,$4,2+$1)= dt*(mom$1*vel($1)+riemst(3)) - flux$1(ic$1,$4,2+$2)= dt*mom$1*vel($2) - flux$1(ic$1,$4,2+$3)= dt*mom$1*vel($3) - flux$1(ic$1,$4,5)= dt*riemst(2)*(Hent+riemst(3)) - - enddo - enddo - enddo -')dnl -define(correc_fluxjt,`dnl -c correct the $2-direction with $3-fluxes - do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) - do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) - ic$2=ifirst$2-FLUXG - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracelft$2(ic$2+1,ic$1,ic$3,k)=tracelft$2(ic$2+1,ic$1,ic$3,k) - & - ttv(k) - enddo - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracelft$2(ic$2+1,ic$1,ic$3,k)=tracelft$2(ic$2+1,ic$1,ic$3,k) - & - ttv(k) - tracergt$2(ic$2 ,ic$1,ic$3,k)=tracergt$2(ic$2 ,ic$1,ic$3,k) - & - ttv(k) - enddo - enddo - ic$2=ilast$2+FLUXG - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracergt$2(ic$2 ,ic$1,ic$3,k)=tracergt$2(ic$2 ,ic$1,ic$3,k) - & - ttv(k) - enddo - enddo - enddo -c -c correct the $3-direction with $2-fluxes - do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) - do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) - ic$3=ifirst$3-FLUXG - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracelft$3(ic$3+1,ic$2,ic$1,k)=tracelft$3(ic$3+1,ic$2,ic$1,k) - & - ttv(k) - enddo - do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracelft$3(ic$3+1,ic$2,ic$1,k)=tracelft$3(ic$3+1,ic$2,ic$1,k) - & - ttv(k) - tracergt$3(ic$3 ,ic$2,ic$1,k)=tracergt$3(ic$3 ,ic$2,ic$1,k) - & - ttv(k) - enddo - enddo - ic$3=ilast$3+FLUXG - rho = density(ic0,ic1,ic2) - vel0 = velocity(ic0,ic1,ic2,0) - vel1 = velocity(ic0,ic1,ic2,1) - vel2 = velocity(ic0,ic1,ic2,2) - v2norm= vel0**2+vel1**2 +vel2**2 - do k=1,NEQU - trnsvers(k)=half* - & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) - enddo - - ttv(1)= trnsvers(1) - ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho - ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho - ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho - ttv(NEQU)= (v2norm*half*trnsvers(1) - - & vel0*trnsvers(2) - vel1*trnsvers(3) - - & vel2*trnsvers(4) + - & trnsvers(NEQU))*gam_min_one - do k=1,NEQU - tracergt$3(ic$3 ,ic$2,ic$1,k)=tracergt$3(ic$3 ,ic$2,ic$1,k) - & - ttv(k) - enddo - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4trace.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4trace.i deleted file mode 100644 index 1f2f95e1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/m4trace.i +++ /dev/null @@ -1,71 +0,0 @@ -define(trace_init,`dnl - do ic$3=ifirst$3-FACEG,ilast$3+FACEG - do ic$2=ifirst$2-FACEG,ilast$2+FACEG - ie$1=ifirst$1-FACEG - tracelft$1(ie$1,ic$2,ic$3,1)=zero - tracelft$1(ie$1,ic$2,ic$3,2)=zero - tracelft$1(ie$1,ic$2,ic$3,3)=zero - tracelft$1(ie$1,ic$2,ic$3,4)=zero - tracelft$1(ie$1,ic$2,ic$3,5)=zero - tracergt$1(ie$1,ic$2,ic$3,1)=density($5) - tracergt$1(ie$1,ic$2,ic$3,2)=velocity($5,1) - tracergt$1(ie$1,ic$2,ic$3,3)=velocity($5,2) - tracergt$1(ie$1,ic$2,ic$3,4)=velocity($5,3) - tracergt$1(ie$1,ic$2,ic$3,5)=pressure($5) - - do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG - tracelft$1(ie$1,ic$2,ic$3,1)=density($4) - tracelft$1(ie$1,ic$2,ic$3,2)=velocity($4,1) - tracelft$1(ie$1,ic$2,ic$3,3)=velocity($4,2) - tracelft$1(ie$1,ic$2,ic$3,4)=velocity($4,3) - tracelft$1(ie$1,ic$2,ic$3,5)=pressure($4) - - tracergt$1(ie$1,ic$2,ic$3,1)=density($5) - tracergt$1(ie$1,ic$2,ic$3,2)=velocity($5,1) - tracergt$1(ie$1,ic$2,ic$3,3)=velocity($5,2) - tracergt$1(ie$1,ic$2,ic$3,4)=velocity($5,3) - tracergt$1(ie$1,ic$2,ic$3,5)=pressure($5) - - enddo - - ie$1=ilast$1+FACEG+1 - tracelft$1(ie$1,ic$2,ic$3,1)=density($4) - tracelft$1(ie$1,ic$2,ic$3,2)=velocity($4,1) - tracelft$1(ie$1,ic$2,ic$3,3)=velocity($4,2) - tracelft$1(ie$1,ic$2,ic$3,4)=velocity($4,3) - tracelft$1(ie$1,ic$2,ic$3,5)=pressure($4) - tracergt$1(ie$1,ic$2,ic$3,1)=zero - tracergt$1(ie$1,ic$2,ic$3,2)=zero - tracergt$1(ie$1,ic$2,ic$3,3)=zero - tracergt$1(ie$1,ic$2,ic$3,4)=zero - tracergt$1(ie$1,ic$2,ic$3,5)=zero - enddo - enddo - -')dnl -define(trace_call,`dnl - do ic$3=ifirst$3-2,ilast$3+2 - do ic$2=ifirst$2-2,ilast$2+2 - do ic$1=ifirst$1-CELLG,ilast$1+CELLG - ttsound(ic$1)= sound(ic0,ic1,ic2) - enddo - do k=1,NEQU - do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 - ttraclft(ic$1,k) = tracelft(ic$1,ic$2,ic$3,k) - ttracrgt(ic$1,k) = tracergt(ic$1,ic$2,ic$3,k) - enddo - enddo - - call trace(dt,ifirst$1,ilast$1,mc, - & dx,idir,igdnv,ttsound, - & ttraclft,ttracrgt, - & ttcelslp,ttedgslp) - do k=1,NEQU - do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 - tracelft(ic$1,ic$2,ic$3,k) = ttraclft(ic$1,k) - tracergt(ic$1,ic$2,ic$3,k) = ttracrgt(ic$1,k) - enddo - enddo - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/stable.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/stable.m4 deleted file mode 100644 index ea604094..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/stable.m4 +++ /dev/null @@ -1,59 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - subroutine stabledt(dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ngc0,ngc1,ngc2, - & gamma,density,velocity,pressure,stabdt) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL stabdt,dx(0:NDIM-1) - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ngc0,ngc1,ngc2 -c - REAL - & density(CELL3dVECG(ifirst,ilast,ngc)), - & velocity(CELL3dVECG(ifirst,ilast,ngc),0:NDIM-1), - & pressure(CELL3dVECG(ifirst,ilast,ngc)) -c - integer ic0,ic1,ic2 - integer ighoslft(0:NDIM-1),ighosrgt(0:NDIM-1) - - REAL maxspeed(0:NDIM-1),gamma,lambda -c - ighoslft(0) = ifirst0 - ngc0 - ighoslft(1) = ifirst1 - ngc1 - ighoslft(2) = ifirst2 - ngc2 - ighosrgt(0) = ilast0 + ngc0 - ighosrgt(1) = ilast1 + ngc1 - ighosrgt(2) = ilast2 + ngc2 - - maxspeed(0)=zero - maxspeed(1)=zero - maxspeed(2)=zero - - do ic2=ighoslft(2),ighosrgt(2) - do ic1=ighoslft(1),ighosrgt(1) - do ic0=ighoslft(0),ighosrgt(0) - lambda = sqrt(max(zero, - & gamma*pressure(ic0,ic1,ic2)/density(ic0,ic1,ic2))) - maxspeed(0) = max(maxspeed(0), - & abs(velocity(ic0,ic1,ic2,0))+lambda) - maxspeed(1) = max(maxspeed(1), - & abs(velocity(ic0,ic1,ic2,1))+lambda) - maxspeed(2) = max(maxspeed(2), - & abs(velocity(ic0,ic1,ic2,2))+lambda) - enddo - enddo - enddo - stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) - stabdt = min((dx(2)/maxspeed(2)),stabdt) -c write(6,*) " dx(0),maxspeed(0)= ",dx(0),maxspeed(0) -c write(6,*) " dx(1),maxspeed(1)= ",dx(1),maxspeed(1) -c write(6,*) " dx(2),maxspeed(2)= ",dx(2),maxspeed(2) -c write(6,*) " stabdt= ",stabdt - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace.m4 deleted file mode 100644 index c9d071dc..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace.m4 +++ /dev/null @@ -1,271 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,5)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/m4trace.i)dnl - - subroutine computesound(ifirst0,ilast0,ifirst1,ilast1, - & ifirst2,ilast2,gamma,density,velocity,pressure,sound) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 -c variables indexed as 2dimensional - REAL - & gamma, - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), - & pressure(CELL3d(ifirst,ilast,CELLG)), - & sound(CELL3d(ifirst,ilast,CELLG)) -c - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - do ic0=ifirst0-CELLG,ilast0+CELLG - do ic1=ifirst1-CELLG,ilast1+CELLG - do ic2=ifirst2-CELLG,ilast2+CELLG - sound(ic0,ic1,ic2) = sqrt(max(smallr, - & gamma*pressure(ic0,ic1,ic2) - & /density(ic0,ic1,ic2))) - enddo - enddo - enddo - - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** -c - subroutine inittraceflux( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & density,velocity,pressure, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2, - & fluxriem0,fluxriem1,fluxriem2) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL - & density(CELL3d(ifirst,ilast,CELLG)), - & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), - & pressure(CELL3d(ifirst,ilast,CELLG)), - & fluxriem0(FACE3d0(ifirst,ilast,FLUXG),NEQU), - & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), - & fluxriem1(FACE3d1(ifirst,ilast,FLUXG),NEQU), - & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), - & fluxriem2(FACE3d2(ifirst,ilast,FLUXG),NEQU), - & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), - & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) - integer ic0,ic1,k,ie0,ie1,ic2,ie2 -c*********************************************************************** -c initialize left and right states at cell edges -c (first-order upwind) -c*********************************************************************** - if (FLUXG.lt.1) then - write(6,*) "flux ghosts < 1!" - stop - endif -c -c*********************************************************************** - -trace_init(0,1,2,`ie0-1,ic1,ic2',`ie0,ic1,ic2')dnl - -trace_init(1,2,0,`ic0,ie1-1,ic2',`ic0,ie1,ic2')dnl - -trace_init(2,0,1,`ic0,ic1,ie2-1',`ic0,ic1,ie2')dnl - -c -c we initialize the flux to be 0 - - do ic2=ifirst2-FLUXG,ilast2+FLUXG - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 - do k=1,NEQU - fluxriem0(ie0,ic1,ic2,k) = zero - enddo - enddo - enddo - enddo -c - do ic2=ifirst2-FLUXG,ilast2+FLUXG - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 - do k=1,NEQU - fluxriem1(ie1,ic2,ic0,k) = zero - enddo - enddo - enddo - enddo -c - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie2=ifirst2-FLUXG,ilast2+FLUXG+1 - do k=1,NEQU - fluxriem2(ie2,ic0,ic1,k) = zero - enddo - enddo - enddo - enddo -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** -c - subroutine chartracing0(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc,dx, - & gamma,igdnv, - & sound, - & tracelft,tracergt, - & ttcelslp, ttedgslp, - & ttsound, - & ttraclft, ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx, gamma - REAL - & sound(CELL3d(ifirst,ilast,CELLG)) - REAL - & tracelft(FACE3d0(ifirst,ilast,FACEG),NEQU), - & tracergt(FACE3d0(ifirst,ilast,FACEG),NEQU) -c side variables ifirst0 to ifirst0+mc plus ghost cells - REAL - & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), - & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), - & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU) -c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG,NEQU), - & ttsound(ifirst0-CELLG:ifirst0+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,k,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 0 -trace_call(0,1,2)dnl -c*********************************************************************** - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing1(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc,dx, - & gamma,igdnv, - & sound, - & tracelft,tracergt, - & ttcelslp, ttedgslp, - & ttsound, - & ttraclft, ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx, gamma - REAL - & sound(CELL3d(ifirst,ilast,CELLG)) - REAL - & tracelft(FACE3d1(ifirst,ilast,FACEG),NEQU), - & tracergt(FACE3d1(ifirst,ilast,FACEG),NEQU) - REAL - & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), - & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), - & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU) -c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG,NEQU), - & ttsound(ifirst1-CELLG:ifirst1+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,k,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 1 -trace_call(1,2,0)dnl -c -c*********************************************************************** - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing2(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc,dx, - & gamma,igdnv, - & sound, - & tracelft,tracergt, - & ttcelslp, ttedgslp, - & ttsound, - & ttraclft, ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx, gamma - REAL - & sound(CELL3d(ifirst,ilast,CELLG)) - REAL - & tracelft(FACE3d2(ifirst,ilast,FACEG),NEQU), - & tracergt(FACE3d2(ifirst,ilast,FACEG),NEQU) - REAL - & ttedgslp(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU), - & ttraclft(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU), - & ttracrgt(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU) -c cell variables ifirst2 to ifirst2+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst2-CELLG:ifirst2+mc-1+CELLG,NEQU), - & ttsound(ifirst2-CELLG:ifirst2+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,k,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 2 -trace_call(2,0,1)dnl -c -c*********************************************************************** - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace1d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace1d.m4 deleted file mode 100644 index 2bb4a1cf..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/3d/trace1d.m4 +++ /dev/null @@ -1,183 +0,0 @@ -define(NEQU,5)dnl -define(REAL,`double precision')dnl - - subroutine trace(dt,ifirst,ilast,mc, - & dx,dir,igdnv,sound, - & tracelft,tracergt, - & celslope,edgslope) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL dt - integer ifirst,ilast,mc,dir,igdnv - REAL dx, flattn -c - REAL - & celslope(ifirst-CELLG:ifirst+mc-1+CELLG,NEQU), - & sound (ifirst-CELLG:ifirst+mc-1+CELLG), -c side variables - & tracelft(ifirst-FACEG:ifirst+mc+FACEG,NEQU), - & tracergt(ifirst-FACEG:ifirst+mc+FACEG,NEQU), - & edgslope(ifirst-FACEG:ifirst+mc+FACEG,NEQU) -c - integer ie,ic,i,k - REAL bound,coef4,slope2,dtdx,slope4 - REAL csq, rho, u, v, w, p - REAL drho, du, dv, dw, dp - REAL spminus, spplus, spzero, smminus, smplus, smzero - REAL alpham, alphap, alpha0r - REAL alpha0v,alpha0w - REAL apright, amright, azrright - REAL azv1rght,azw1rght - REAL apleft, amleft, azrleft - REAL azv1left,azw1left,ceigv - integer dir1,dir2,dir3 - - if (dir.eq.0) then - dir1 = 2 - dir2 = 3 - dir3 = 4 - else if (dir.eq.1) then - dir1 = 3 - dir2 = 4 - dir3 = 2 - else if (dir.eq.2) then - dir1 = 4 - dir2 = 2 - dir3 = 3 - endif -c -c*********************************************************************** -c ****************************************************************** -c * check for inflection points in characteristic speeds -c * compute slopes at cell edges -c * zero slopes if neighboring cells have different loading -c ****************************************************************** - do ie=ifirst+1-FACEG,ilast+FACEG - do k=1,NEQU - edgslope(ie,k)=tracergt(ie,k)-tracelft(ie,k) - enddo - enddo -c ****************************************************************** -c * limit slopes -c ****************************************************************** - do i=1,NEQU - do ic=ifirst-CELLG,ilast+CELLG - celslope(ic,i)=zero - enddo - enddo - if (igdnv.eq.2) then -c **************************************************************** -c * second-order slopes -c **************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 -c call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) - flattn=one - do i=1,NEQU - slope2=half*(edgslope(ic,i)+edgslope(ic+1,i)) - celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) - if (edgslope(ic,i)*edgslope(ic+1,i).le.zero) then - celslope(ic,i)=zero - else - bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) - celslope(ic,i)=sign(min(two*bound,abs(slope2)),slope2) - celslope(ic,i)=flattn*celslope(ic,i) - endif - enddo - enddo - else if (igdnv.eq.4) then -c **************************************************************** -c * fourth-order slopes -c **************************************************************** - do ic=ifirst+2-CELLG,ilast+CELLG-2 -c call flaten(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) - flattn=one - do i=1,NEQU - slope4=fourth*(tracergt(ic+2,i)-tracergt(ic-2,i)) - celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) - coef4=third*(four*celslope(ic,i)-slope4) - if (edgslope(ic,i)*edgslope(ic+1,i).le.zero .or. - & coef4*celslope(ic,i).lt.zero) then - celslope(ic,i)=zero - else - bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) - celslope(ic,i)=sign(min(two*bound,abs(coef4)),coef4) - celslope(ic,i)=flattn*celslope(ic,i) - endif - enddo - enddo - endif -c ****************************************************************** -c * characteristic projection -c ****************************************************************** - do ic=ifirst-FACEG+1,ilast+FACEG - dtdx=dt/dx - rho = max(smallr,tracergt(ic,1)) - u = tracergt(ic,dir1) - v = tracergt(ic,dir2) - p = tracergt(ic,NEQU) - drho = celslope(ic,1) - du = celslope(ic,dir1) - dv = celslope(ic,dir2) - dp = celslope(ic,NEQU) - w = tracergt(ic,dir3) - dw = celslope(ic,dir3) - alpha0w = dw - - ceigv = sound(ic) - csq = ceigv**2 - - alpham = half*(dp/(rho*ceigv) - du)*rho/ceigv - alphap = half*(dp/(rho*ceigv) + du)*rho/ceigv - alpha0r = drho - dp/csq - alpha0v = dv - - if ((u-ceigv).gt.0) then - spminus = -one - smminus = (u-ceigv)*dtdx - else - spminus = (u-ceigv)*dtdx - smminus = one - endif - if ((u+ceigv).gt.0) then - spplus = -one - smplus = (u+ceigv)*dtdx - else - spplus = (u+ceigv)*dtdx - smplus = one - endif - if ((u).gt.0) then - spzero = -one - smzero = u*dtdx - else - spzero = u*dtdx - smzero = one - endif - apright = half*(-one - spplus )*alphap - amright = half*(-one - spminus)*alpham - azrright = half*(-one - spzero )*alpha0r - azv1rght = half*(-one - spzero )*alpha0v - azw1rght = half*(-one - spzero )*alpha0w - tracergt(ic,1) = rho + apright + amright + azrright - tracergt(ic,1) = max(smallr,tracergt(ic,1)) - tracergt(ic,dir1) = u + (apright - amright)*ceigv/rho - tracergt(ic,dir2) = v + azv1rght - tracergt(ic,dir3) = w + azw1rght - tracergt(ic,NEQU) = p + (apright + amright)*csq - - apleft = half*(one - smplus )*alphap - amleft = half*(one - smminus)*alpham - azrleft = half*(one - smzero )*alpha0r - azv1left = half*(one - smzero )*alpha0v - azw1left = half*(one - smzero )*alpha0w - tracelft(ic+1,1) = rho + apleft + amleft + azrleft - tracelft(ic+1,1) = max(smallr,tracelft(ic+1,1)) - tracelft(ic+1,dir1) = u + (apleft - amleft)*ceigv/rho - tracelft(ic+1,dir2) = v + azv1left - tracelft(ic+1,dir3) = w + azw1left - tracelft(ic+1,NEQU) = p + (apleft + amleft)*csq - enddo - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.depend new file mode 100644 index 00000000..02e0116f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.depend @@ -0,0 +1,226 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=avgint2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + amrflaten2d.i avgint2d.m4 const.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=avgint3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + amrflaten3d.i avgint3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=flaten1d2d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i flaten1d2d.m4 \ + flaten2d.i probparams.i + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=flaten1d3d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i flaten1d3d.m4 \ + flaten3d.i probparams.i + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=flux2d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + flux2d.m4 gas1d_approxrp2d.i gas1d_exactrp2d.i m4flux2d.i \ + probparams.i + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=flux3d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + flux3d.m4 gas1d_approxrp3d.i gas1d_exactrp3d.i m4flux3d.i \ + probparams.i + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=fluxcorner3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + fluxcorner3d.m4 m4fluxcorner3d.i probparams.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=grad2d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + grad2d.m4 probparams.i + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=grad3d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + grad3d.m4 probparams.i + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=init2d.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 probparams.i + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=init3d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 probparams.i + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=stable2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + stable2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=stable3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + stable3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=stufprobc.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc.m4 + +DEPENDS_13 +=\ + + + +${FILE_13}: ${DEPENDS_13} + +FILE_14=trace1d2d.o +DEPENDS_14:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d2d.m4 + +DEPENDS_14 +=\ + + + +${FILE_14}: ${DEPENDS_14} + +FILE_15=trace1d3d.o +DEPENDS_15:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d3d.m4 + +DEPENDS_15 +=\ + + + +${FILE_15}: ${DEPENDS_15} + +FILE_16=trace2d.o +DEPENDS_16:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + m4trace2d.i probparams.i trace2d.m4 + +DEPENDS_16 +=\ + + + +${FILE_16}: ${DEPENDS_16} + +FILE_17=trace3d.o +DEPENDS_17:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + m4trace3d.i probparams.i trace3d.m4 + +DEPENDS_17 +=\ + + + +${FILE_17}: ${DEPENDS_17} + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.in new file mode 100644 index 00000000..1e537084 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/Makefile.in @@ -0,0 +1,106 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI Euler gas dynamics +## sample application +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/performance/Euler/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= avgint2d.o flaten1d2d.o flux2d.o grad2d.o init2d.o stable2d.o \ + stufprobc.o trace2d.o trace1d2d.o \ + avgint3d.o flaten1d3d.o flux3d.o grad3d.o init3d.o stable3d.o \ + trace3d.o trace1d3d.o fluxcorner3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +avgint2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/avgint2d.m4 > avgint2d.f + $(F77) $(FFLAGS) -c avgint2d.f -o $@ + +avgint3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/avgint3d.m4 > avgint3d.f + $(F77) $(FFLAGS) -c avgint3d.f -o $@ + +flaten1d2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flaten1d2d.m4 > flaten1d2d.f + $(F77) $(FFLAGS) -c flaten1d2d.f -o $@ + +flaten1d3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flaten1d3d.m4 > flaten1d3d.f + $(F77) $(FFLAGS) -c flaten1d3d.f -o $@ + +flux2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux2d.m4 > flux2d.f + $(F77) $(FFLAGS) -c flux2d.f -o $@ + +flux3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux3d.m4 > flux3d.f + $(F77) $(FFLAGS) -c flux3d.f -o $@ + +fluxcorner3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/fluxcorner3d.m4 > fluxcorner3d.f + $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ + +grad2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad2d.m4 > grad2d.f + $(F77) $(FFLAGS) -c grad2d.f -o $@ + +grad3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad3d.m4 > grad3d.f + $(F77) $(FFLAGS) -c grad3d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +stable2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable2d.m4 > stable2d.f + $(F77) $(FFLAGS) -c stable2d.f -o $@ + +stable3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable3d.m4 > stable3d.f + $(F77) $(FFLAGS) -c stable3d.f -o $@ + +stufprobc.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc.m4 > stufprobc.f + $(F77) $(FFLAGS) -c stufprobc.f -o $@ + +trace2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace2d.m4 > trace2d.f + $(F77) $(FFLAGS) -c trace2d.f -o $@ + +trace3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace3d.m4 > trace3d.f + $(F77) $(FFLAGS) -c trace3d.f -o $@ + +trace1d2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d2d.m4 > trace1d2d.f + $(F77) $(FFLAGS) -c trace1d2d.f -o $@ + +trace1d3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d3d.m4 > trace1d3d.f + $(F77) $(FFLAGS) -c trace1d3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten.i deleted file mode 100644 index b55ec252..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten.i +++ /dev/null @@ -1,89 +0,0 @@ -c -c*********************************************************************** -c flatten routine -c*********************************************************************** -c - subroutine amrflaten(ifirst,ilast, - & cilo,cihi, - & mc,gamma, - & densc,presc,velc,flattn,flat2,sound) -c*********************************************************************** -c description of arguments: -c input: -c p ==> pressure tracest(NEQU) -c vn ==> normal velocity tracest(2+idir) -c output: -c flattn ==> flattening coefficient -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -cnclude(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - integer ifirst,ilast, - & cilo,cihi, - & mc - REAL gamma - REAL - & densc(cilo:cilo+mc), - & velc(cilo:cilo+mc), - & presc(cilo:cilo+mc) - REAL flattn(ifirst:ifirst+mc) - REAL flat2(cilo:cilo+mc),sound(cilo:cilo+mc) - - REAL zero,half,one,two - parameter (zero=0.d0) - parameter (half=0.5d0) - parameter (one=1.0d0) - parameter (two=2.d0) - -c -c*********************************************************************** -c - - - REAL shktst, zcut1, zcut2, dzcut, smallp - REAL denom, zeta, tst, tmp, dp,zi - REAL rhoc1,rhoc2,chi - integer ic - -c -c*********************************************************************** -c - shktst =0.33d0 - zcut1 =0.75d0 - zcut2 =0.85d0 - smallp =1.0d-6 - dzcut = one/(zcut2-zcut1) - - do ic=ifirst,ilast - flattn(ic) = one - enddo - do ic=ifirst-1,ilast+1 - sound(ic) = sqrt(gamma*presc(ic)/densc(ic)) - enddo - - do ic=ifirst+1,ilast-1 - dp = presc(ic+1) - presc(ic-1) - denom = max(smallp,abs(presc(ic+2)-presc(ic-2))) - zeta = abs(dp)/denom - zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) - if ((velc(ic-1) - velc(ic+1)).gt.zero) then - tst = one - else - tst = zero - endif - rhoc1 = densc(ic+1)*sound(ic+1)**2 - rhoc2 = densc(ic-1)*sound(ic-1)**2 - tmp = min(rhoc1,rhoc2) - if ((abs(dp)/tmp).gt.shktst) then - chi = tst - else - chi = zero - endif - flat2(ic) = chi*zi - enddo - do ic=ifirst+2,ilast-2 - flattn(ic) = one - max(flat2(ic-1),flat2(ic),flat2(ic+1)) - enddo - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten2d.i new file mode 100644 index 00000000..b079d423 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten2d.i @@ -0,0 +1,97 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient in 2d. +c +c +c*********************************************************************** +c flatten routine +c*********************************************************************** +c + subroutine amrflaten2d(ifirst,ilast, + & cilo,cihi, + & mc,gamma, + & densc,presc,velc,flattn,flat2,sound) +c*********************************************************************** +c description of arguments: +c input: +c p ==> pressure tracest(NEQU) +c vn ==> normal velocity tracest(2+idir) +c output: +c flattn ==> flattening coefficient +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +cnclude(FORTDIR/../const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + integer ifirst,ilast, + & cilo,cihi, + & mc + REAL gamma + REAL + & densc(cilo:cilo+mc), + & velc(cilo:cilo+mc), + & presc(cilo:cilo+mc) + REAL flattn(ifirst:ifirst+mc) + REAL flat2(cilo:cilo+mc),sound(cilo:cilo+mc) + + REAL zero,half,one,two + parameter (zero=0.d0) + parameter (half=0.5d0) + parameter (one=1.0d0) + parameter (two=2.d0) + +c +c*********************************************************************** +c + + + REAL shktst, zcut1, zcut2, dzcut, smallp + REAL denom, zeta, tst, tmp, dp,zi + REAL rhoc1,rhoc2,chi + integer ic + +c +c*********************************************************************** +c + shktst =0.33d0 + zcut1 =0.75d0 + zcut2 =0.85d0 + smallp =1.0d-6 + dzcut = one/(zcut2-zcut1) + + do ic=ifirst,ilast + flattn(ic) = one + enddo + do ic=ifirst-1,ilast+1 + sound(ic) = sqrt(gamma*presc(ic)/densc(ic)) + enddo + + do ic=ifirst+1,ilast-1 + dp = presc(ic+1) - presc(ic-1) + denom = max(smallp,abs(presc(ic+2)-presc(ic-2))) + zeta = abs(dp)/denom + zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) + if ((velc(ic-1) - velc(ic+1)).gt.zero) then + tst = one + else + tst = zero + endif + rhoc1 = densc(ic+1)*sound(ic+1)**2 + rhoc2 = densc(ic-1)*sound(ic-1)**2 + tmp = min(rhoc1,rhoc2) + if ((abs(dp)/tmp).gt.shktst) then + chi = tst + else + chi = zero + endif + flat2(ic) = chi*zi + enddo + do ic=ifirst+2,ilast-2 + flattn(ic) = one - max(flat2(ic-1),flat2(ic),flat2(ic+1)) + enddo + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten3d.i new file mode 100644 index 00000000..352f6444 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/amrflaten3d.i @@ -0,0 +1,97 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient in 3d. +c +c +c*********************************************************************** +c flatten routine +c*********************************************************************** +c + subroutine amrflaten3d(ifirst,ilast, + & cilo,cihi, + & mc,gamma, + & densc,presc,velc,flattn,flat2,sound) +c*********************************************************************** +c description of arguments: +c input: +c p ==> pressure tracest(NEQU) +c vn ==> normal velocity tracest(2+idir) +c output: +c flattn ==> flattening coefficient +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +cnclude(FORTDIR/../const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + integer ifirst,ilast, + & cilo,cihi, + & mc + REAL gamma + REAL + & densc(cilo:cilo+mc), + & velc(cilo:cilo+mc), + & presc(cilo:cilo+mc) + REAL flattn(ifirst:ifirst+mc) + REAL flat2(cilo:cilo+mc),sound(cilo:cilo+mc) + + REAL zero,half,one,two + parameter (zero=0.d0) + parameter (half=0.5d0) + parameter (one=1.0d0) + parameter (two=2.d0) + +c +c*********************************************************************** +c + + + REAL shktst, zcut1, zcut2, dzcut, smallp + REAL denom, zeta, tst, tmp, dp,zi + REAL rhoc1,rhoc2,chi + integer ic + +c +c*********************************************************************** +c + shktst =0.33d0 + zcut1 =0.75d0 + zcut2 =0.85d0 + smallp =1.0d-6 + dzcut = one/(zcut2-zcut1) + + do ic=ifirst,ilast + flattn(ic) = one + enddo + do ic=ifirst-1,ilast+1 + sound(ic) = sqrt(gamma*presc(ic)/densc(ic)) + enddo + + do ic=ifirst+1,ilast-1 + dp = presc(ic+1) - presc(ic-1) + denom = max(smallp,abs(presc(ic+2)-presc(ic-2))) + zeta = abs(dp)/denom + zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) + if ((velc(ic-1) - velc(ic+1)).gt.zero) then + tst = one + else + tst = zero + endif + rhoc1 = densc(ic+1)*sound(ic+1)**2 + rhoc2 = densc(ic-1)*sound(ic-1)**2 + tmp = min(rhoc1,rhoc2) + if ((abs(dp)/tmp).gt.shktst) then + chi = tst + else + chi = zero + endif + flat2(ic) = chi*zi + enddo + do ic=ifirst+2,ilast-2 + flattn(ic) = one - max(flat2(ic-1),flat2(ic),flat2(ic+1)) + enddo + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint2d.m4 new file mode 100644 index 00000000..6ab12c90 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint2d.m4 @@ -0,0 +1,448 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for interlevel transfer of velocity and pressure +c for 2d euler equations. +c +define(NDIM,2)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/amrflaten2d.i)dnl +c +define(coarsen_index,`dnl + if ($1.lt.0) then + $2=($1+1)/$3-1 + else + $2=$1/$3 + endif +')dnl +define(coarse_fine_cell_deltas,`dnl + do ir$1=0,ratio($1)-1 + deltax(ir$1,$1)=(dble(ir$1)+half)*dxf($1)-dxc($1)*half + enddo +')dnl +define(muscl_limited_conserved_slopes,`dnl + do ie$1=ifirstc$1,ilastc$1+1 + diff$1(ie$1)=conservc($2) + & -conservc($3) + enddo + do ic$1=ifirstc$1,ilastc$1 + coef2=half*(diff$1(ic$1+1)+diff$1(ic$1)) + bound=two*min(abs(diff$1(ic$1+1)),abs(diff$1(ic$1))) + if (diff$1(ic$1)*diff$1(ic$1+1).gt.zero) then + slope$1($4)=sign(min(abs(coef2),bound),coef2) + & /dxc($1) + else + slope$1($4)=zero + endif + slope$1($4)=slope$1($4)*flat$1($4) + enddo +')dnl +c +c*********************************************************************** +c Conservative linear interpolation for 2d flux variables. +c*********************************************************************** +c + subroutine conservlinint2d( + & ifirstc0,ifirstc1,ilastc0,ilastc1, + & ifirstf0,ifirstf1,ilastf0,ilastf1, + & cilo0,cilo1,cihi0,cihi1, + & filo0,filo1,fihi0,fihi1, + & ratio,dxc,dxf, + & gamma, + & densc,densf, + & velc,presc, + & velf,presf, + & conservc, + & tflat,tflat2,sound,mc, + & tdensc,tpresc,tvelc, + & flat0,flat1, + & diff0,slope0,diff1,slope1) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +c*********************************************************************** + integer + & ifirstc0,ifirstc1,ilastc0,ilastc1, + & ifirstf0,ifirstf1,ilastf0,ilastf1, + & cilo0,cilo1,cihi0,cihi1, + & filo0,filo1,fihi0,fihi1 + integer ratio(0:NDIM-1) + REAL + & dxc(0:NDIM-1), + & dxf(0:NDIM-1), + & gamma + REAL + & densc(CELL2d(cilo,cihi,0)), + & densf(CELL2d(filo,fihi,0)), + & velc(CELL2d(cilo,cihi,0),0:NDIM-1), + & presc(CELL2d(cilo,cihi,0)) + REAL + & velf(CELL2d(filo,fihi,0),0:NDIM-1), + & presf(CELL2d(filo,fihi,0)) + REAL + & conservc(CELL2d(ifirstc,ilastc,1)), + & flat0(CELL2d(ifirstc,ilastc,0)), + & flat1(CELL2d(ifirstc,ilastc,0)), + & diff0(ifirstc0:ilastc0+1), + & slope0(CELL2d(ifirstc,ilastc,0)), + & diff1(ifirstc1:ilastc1+1), + & slope1(CELL2d(ifirstc,ilastc,0)) + REAL + & deltax(0:15,0:NDIM-1) + integer mc + REAL + & tdensc(0:mc-1),tpresc(0:mc-1),tvelc(0:mc-1) + REAL + & tflat(0:mc-1),tflat2(0:mc-1),sound(0:mc-1) + + integer id,ic0,ic1,ie0,ie1,if0,if1,ir0,ir1,it + REAL coef2,bound,val,valinv,deltax1,v2norm + logical presneg +c +c*********************************************************************** +c + + presneg = .false. + +coarse_fine_cell_deltas(0)dnl + +coarse_fine_cell_deltas(1)dnl + +c +c compute the flatten coefficients to further limit the slopes +c + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0-1,ilastc0+1 + it = ic0-cilo0 + tdensc(it) = densc(ic0,ic1) + tpresc(it) = presc(ic0,ic1) + tvelc(it) = velc(ic0,ic1,0) +c write(6,*) "presc(",ic0,ic1,") ",presc(ic0,ic1) +c write(6,*) "tpresc(",it,") ",tpresc(it) + enddo + call amrflaten2d(ifirstc0,ilastc0,cilo0,cihi0,mc,gamma, + & tdensc,tpresc,tvelc,tflat,tflat2,sound) + do ic0=ifirstc0,ilastc0 + flat0(ic0,ic1) = tflat(ic0-ifirstc0) + enddo + enddo + + do ic0=ifirstc0,ilastc0 + do ic1=ifirstc1-1,ilastc1+1 + it = ic1-cilo1 + tdensc(it) = densc(ic0,ic1) + tpresc(it) = presc(ic0,ic1) + tvelc(it) = velc(ic0,ic1,1) + enddo + call amrflaten2d(ifirstc1,ilastc1,cilo1,cihi1,mc,gamma, + & tdensc,tpresc,tvelc,tflat,tflat2,sound) + do ic1=ifirstc1,ilastc1 + flat1(ic0,ic1) = tflat(ic1-ifirstc1) + enddo + enddo + +c +c + +c +c construct fine velocity values using conservative linear +c interpolation on momentum +c + do id=0,NDIM-1 + + do ic1=ifirstc1-1,ilastc1+1 + do ic0=ifirstc0-1,ilastc0+1 + conservc(ic0,ic1) = densc(ic0,ic1)*velc(ic0,ic1,id) + enddo + enddo + + do ic1=ifirstc1,ilastc1 +muscl_limited_conserved_slopes(0,`ie0,ic1',`ie0-1,ic1',`ic0,ic1')dnl + enddo + + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(1,`ic0,ie1',`ic0,ie1-1',`ic0,ic1')dnl + enddo + + do if1=ifirstf1,ilastf1 +coarsen_index(if1,ic1,ratio(1))dnl + ir1=if1-ic1*ratio(1) + deltax1=deltax(ir1,1) + do if0=ifirstf0,ilastf0 +coarsen_index(if0,ic0,ratio(0))dnl + ir0=if0-ic0*ratio(0) + velf(if0,if1,id) = (conservc(ic0,ic1) + & + slope0(ic0,ic1)*deltax(ir0,0) + & + slope1(ic0,ic1)*deltax1) + & / densf(if0,if1) + enddo + enddo + + enddo + +c +c construct fine pressure values using conservative linear +c interpolation on energy +c + val = (gamma-one) + valinv = one/(gamma-one) + + do ic1=ifirstc1-1,ilastc1+1 + do ic0=ifirstc0-1,ilastc0+1 + v2norm = velc(ic0,ic1,0)**2+velc(ic0,ic1,1)**2 + conservc(ic0,ic1) = presc(ic0,ic1)*valinv + & + half*densc(ic0,ic1)*v2norm + enddo + enddo + + do ic1=ifirstc1,ilastc1 +muscl_limited_conserved_slopes(0,`ie0,ic1',`ie0-1,ic1',`ic0,ic1')dnl + enddo + + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(1,`ic0,ie1',`ic0,ie1-1',`ic0,ic1')dnl + enddo + + do if1=ifirstf1,ilastf1 +coarsen_index(if1,ic1,ratio(1))dnl + ir1=if1-ic1*ratio(1) + deltax1=deltax(ir1,1) + do if0=ifirstf0,ilastf0 +coarsen_index(if0,ic0,ratio(0))dnl + ir0=if0-ic0*ratio(0) + v2norm = velf(if0,if1,0)**2+velf(if0,if1,1)**2 + presf(if0,if1) = ((conservc(ic0,ic1) + & + slope0(ic0,ic1)*deltax(ir0,0) + & + slope1(ic0,ic1)*deltax1) + & - half*densf(if0,if1)*v2norm) * val + presf(if0,if1) = max(presf(if0,if1),smallr) + if (presf(if0,if1).lt.zero) then +c write(6,*) "IN conservlinint2d" +c write(6,*) "gamma,val,valinv = ", +c & gamma,val,valinv +c write(6,*) "ifirstf0,ilastf0 ",ifirstf0,ilastf0, +c & ", ifirstf1,ilastf1 ",ifirstf1,ilastf1 +c write(6,*) "if0,if1 ",if0,if1 +c write(6,*) "ic0,ic1 ",ic0,ic1 +c write(6,*) "fine energy = ", +c & conservc(ic0,ic1) + slope0(ic0,ic1)*deltax(ir0,0) +c & + slope1(ic0,ic1)*deltax1 +c write(6,*) "densf(if0,if1) ",densf(if0,if1) +c write(6,*) "vel() ",velf(if0,if1,0),velf(if0,if1,1) +c write(6,*) "presf(if0,if1) ",presf(if0,if1) +c write(6,*) "conservc(",ic0,ic1,") ",conservc(ic0,ic1) +c write(6,*) "slope0(",ic0,ic1,") ",slope0(ic0,ic1) +c write(6,*) "deltax(",ir0,0,") ",deltax(ir0,0) +c write(6,*) "slope1(",ic0,ic1,") ",slope1(ic0,ic1) +c write(6,*) "deltax1(",ir1,1,") ",deltax1 +c write(6,*) "val ",val,", v2norm ",v2norm +c write(6,*) "presc(",ic0,ic1,") ",presc(ic0,ic1) +c write(6,*) "densc(",ic0,ic1,") ",densc(ic0,ic1) +c write(6,*) "velc() ",velc(ic0,ic1,0),velc(ic0,ic1,1) + presneg = .true. + endif + enddo + enddo + + if (presneg) then + write(6,*) "negative pressure reported in conservlinint2d" +c write(6,*) "coarse conserved values" +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,conservc = ", +c & ic0,ic1,conservc(ic0,ic1) +c enddo +c enddo +c write(6,*) "coarse density values" +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,densc = ", +c & ic0,ic1,densc(ic0,ic1) +c enddo +c enddo +c write(6,*) "coarse velocity0 values" +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,velc0 = ", +c & ic0,ic1,velc(ic0,ic1,0) +c enddo +c enddo +c write(6,*) "coarse velocity1 values" +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,velc1 = ", +c & ic0,ic1,velc(ic0,ic1,1) +c enddo +c enddo +c write(6,*) "coarse pressure values" +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,presc = ", +c & ic0,ic1,presc(ic0,ic1) +c enddo +c enddo +c write(6,*) "fine density values" +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,densf = ", +c & if0,if1,densf(if0,if1) +c enddo +c enddo +c write(6,*) "fine velocity0 values" +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,velf0 = ", +c & if0,if1,velf(if0,if1,0) +c enddo +c enddo +c write(6,*) "fine velocity1 values" +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,velf1 = ", +c & if0,if1,velf(if0,if1,1) +c enddo +c enddo +c call flush(6) + stop + endif +c + return + end +c +c +c*********************************************************************** +c Volume weighted averaging for 2d flux variables. +c*********************************************************************** +c + subroutine conservavg2d( + & ifirstf0,ifirstf1,ilastf0,ilastf1, + & ifirstc0,ifirstc1,ilastc0,ilastc1, + & filo0,filo1,fihi0,fihi1, + & cilo0,cilo1,cihi0,cihi1, + & ratio,dxf,dxc, + & gamma, + & densf,densc, + & velf,presf, + & velc,presc, + & conservf) +c*********************************************************************** + implicit none + REAL zero,half,one + parameter (zero=0.d0) + parameter (half=0.5d0) + parameter (one=1.d0) +c + integer + & ifirstf0,ifirstf1,ilastf0,ilastf1, + & ifirstc0,ifirstc1,ilastc0,ilastc1, + & cilo0,cilo1,cihi0,cihi1, + & filo0,filo1,fihi0,fihi1 + integer ratio(0:NDIM-1) + REAL + & dxf(0:NDIM-1), + & dxc(0:NDIM-1), + & gamma + REAL + & densf(CELL2d(filo,fihi,0)), + & densc(CELL2d(cilo,cihi,0)), + & velf(CELL2d(filo,fihi,0),0:NDIM-1), + & presf(CELL2d(filo,fihi,0)) + REAL + & velc(CELL2d(cilo,cihi,0),0:NDIM-1), + & presc(CELL2d(cilo,cihi,0)) + REAL + & conservf(CELL2d(ifirstf,ilastf,0)) + integer ic0,ic1,if0,if1,ir0,ir1,id + REAL dVf,dVc,val,valinv,v2norm +c +c*********************************************************************** +c + dVf = dxf(0)*dxf(1) + dVc = dxc(0)*dxc(1) +c +c construct coarse velocity values using conservative average +c of momentum +c + do id=0,NDIM-1 + + do if1=ifirstf1,ilastf1 + do if0=ifirstf0,ilastf0 + conservf(if0,if1) = densf(if0,if1)*velf(if0,if1,id) + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + velc(ic0,ic1,id) = zero + enddo + enddo + + do ir1=0,ratio(1)-1 + do ir0=0,ratio(0)-1 + do ic1=ifirstc1,ilastc1 + if1=ic1*ratio(1)+ir1 + do ic0=ifirstc0,ilastc0 + if0=ic0*ratio(0)+ir0 + velc(ic0,ic1,id) = velc(ic0,ic1,id) + & + conservf(if0,if1)*dVf + enddo + enddo + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + velc(ic0,ic1,id) = velc(ic0,ic1,id) + & / (densc(ic0,ic1)*dVc) + enddo + enddo + + enddo + +c +c construct coarse velocity values using conservative average +c of energy +c + val = (gamma-one) + valinv = one/(gamma-one) + + do if1=ifirstf1,ilastf1 + do if0=ifirstf0,ilastf0 + v2norm = velf(if0,if1,0)**2 + velf(if0,if1,1)**2 + conservf(if0,if1) = presf(if0,if1)*valinv + & + half*densf(if0,if1)*v2norm + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + presc(ic0,ic1) = zero + enddo + enddo + + do ir1=0,ratio(1)-1 + do ir0=0,ratio(0)-1 + do ic1=ifirstc1,ilastc1 + if1=ic1*ratio(1)+ir1 + do ic0=ifirstc0,ilastc0 + if0=ic0*ratio(0)+ir0 + presc(ic0,ic1) = presc(ic0,ic1) + & + conservf(if0,if1)*dVf + enddo + enddo + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + v2norm = velc(ic0,ic1,0)**2 + velc(ic0,ic1,1)**2 + presc(ic0,ic1) = ((presc(ic0,ic1)/dVc) + & - half*densc(ic0,ic1)*v2norm) * val + enddo + enddo +c + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint3d.m4 new file mode 100644 index 00000000..4af6e1e8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/avgint3d.m4 @@ -0,0 +1,590 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for conservative interlevel transfer of velocity +c and pressure for 3d euler equations. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/amrflaten3d.i)dnl +c +define(coarsen_index,`dnl + if ($1.lt.0) then + $2=($1+1)/$3-1 + else + $2=$1/$3 + endif +')dnl +define(coarse_fine_cell_deltas,`dnl + do ir$1=0,ratio($1)-1 + deltax(ir$1,$1)=(dble(ir$1)+half)*dxf($1)-dxc($1)*half + enddo +')dnl +define(muscl_limited_conserved_slopes,`dnl + do ie$1=ifirstc$1,ilastc$1+1 + diff$1(ie$1)=conservc($2) + & -conservc($3) + enddo + do ic$1=ifirstc$1,ilastc$1 + coef2=half*(diff$1(ic$1+1)+diff$1(ic$1)) + bound=two*min(abs(diff$1(ic$1+1)),abs(diff$1(ic$1))) + if (diff$1(ic$1)*diff$1(ic$1+1).gt.zero) then + slope$1($4)=sign(min(abs(coef2),bound),coef2) + & /dxc($1) + else + slope$1($4)=zero + endif + slope$1($4)=slope$1($4)*flat$1($4) + enddo +')dnl +c +c*********************************************************************** +c Conservative linear interpolation for 3d flux variables. +c*********************************************************************** +c + subroutine conservlinint3d( + & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, + & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, + & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, + & filo0,filo1,filo2,fihi0,fihi1,fihi2, + & ratio,dxc,dxf, + & gamma, + & densc,densf, + & velc,presc, + & velf,presf, + & conservc, + & tflat,tflat2,sound,mc, + & tdensc,tpresc,tvelc, + & flat0,flat1,flat2, + & diff0,slope0,diff1,slope1,diff2,slope2) +c*********************************************************************** + implicit none + REAL zero,half,one,two + parameter (zero=0.0d0) + parameter (half=0.5d0) + parameter (one=1.0d0) + parameter (two=2.d0) +c + integer + & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, + & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, + & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, + & filo0,filo1,filo2,fihi0,fihi1,fihi2 + integer ratio(0:NDIM-1) + REAL + & dxc(0:NDIM-1), + & dxf(0:NDIM-1), + & gamma + REAL + & densc(CELL3d(cilo,cihi,0)), + & densf(CELL3d(filo,fihi,0)), + & velc(CELL3d(cilo,cihi,0),0:NDIM-1), + & presc(CELL3d(cilo,cihi,0)) + REAL + & velf(CELL3d(filo,fihi,0),0:NDIM-1), + & presf(CELL3d(filo,fihi,0)) + REAL + & conservc(CELL3d(ifirstc,ilastc,1)), + & flat0(CELL3d(ifirstc,ilastc,0)), + & flat1(CELL3d(ifirstc,ilastc,0)), + & flat2(CELL3d(ifirstc,ilastc,0)), + & diff0(ifirstc0:ilastc0+1), + & slope0(CELL3d(ifirstc,ilastc,0)), + & diff1(ifirstc1:ilastc1+1), + & slope1(CELL3d(ifirstc,ilastc,0)), + & diff2(ifirstc2:ilastc2+1), + & slope2(CELL3d(ifirstc,ilastc,0)) + REAL + & deltax(0:15,0:NDIM-1) + integer mc + REAL + & tdensc(0:mc-1),tpresc(0:mc-1),tvelc(0:mc-1) + REAL + & tflat(0:mc-1),tflat2(0:mc-1),sound(0:mc-1) + + integer id,ic0,ic1,ic2,ie0,ie1,ie2,if0,if1,if2,ir0,ir1,ir2,it + REAL coef2,bound,val,valinv, + & deltax1,deltax2,v2norm + logical presneg +c +c*********************************************************************** +c + + presneg = .false. + +coarse_fine_cell_deltas(0)dnl + +coarse_fine_cell_deltas(1)dnl + +coarse_fine_cell_deltas(2)dnl + +c +c compute the flatten coefficients to further limit the slopes +c + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0-1,ilastc0+1 + it = ic0-cilo0 + tdensc(it) = densc(ic0,ic1,ic2) + tpresc(it) = presc(ic0,ic1,ic2) + tvelc(it) = velc(ic0,ic1,ic2,0) + enddo + call amrflaten3d(ifirstc0,ilastc0,cilo0,cihi0,mc,gamma, + & tdensc,tpresc,tvelc,tflat,tflat2,sound) + do ic0=ifirstc0,ilastc0 + flat0(ic0,ic1,ic2) = tflat(ic0-ifirstc0) + enddo + enddo + enddo + + do ic0=ifirstc0,ilastc0 + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1-1,ilastc1+1 + it = ic1-cilo1 + tdensc(it) = densc(ic0,ic1,ic2) + tpresc(it) = presc(ic0,ic1,ic2) + tvelc(it) = velc(ic0,ic1,ic2,1) + enddo + call amrflaten3d(ifirstc1,ilastc1,cilo1,cihi1,mc,gamma, + & tdensc,tpresc,tvelc,tflat,tflat2,sound) + do ic1=ifirstc1,ilastc1 + flat1(ic0,ic1,ic2) = tflat(ic1-ifirstc1) + enddo + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + do ic2=ifirstc2-1,ilastc2+1 + it = ic2-cilo2 + tdensc(it) = densc(ic0,ic1,ic2) + tpresc(it) = presc(ic0,ic1,ic2) + tvelc(it) = velc(ic0,ic1,ic2,2) + enddo + call amrflaten3d(ifirstc2,ilastc2,cilo2,cihi2,mc,gamma, + & tdensc,tpresc,tvelc,tflat,tflat2,sound) + do ic2=ifirstc2,ilastc2 + flat2(ic0,ic1,ic2) = tflat(ic2-ifirstc2) + enddo + enddo + enddo + +c +c + +c +c construct fine velocity values using conservative linear +c interpolation on momentum +c + do id=0,NDIM-1 + + do ic2=ifirstc2-1,ilastc2+1 + do ic1=ifirstc1-1,ilastc1+1 + do ic0=ifirstc0-1,ilastc0+1 + conservc(ic0,ic1,ic2) = + & densc(ic0,ic1,ic2)*velc(ic0,ic1,ic2,id) + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 +muscl_limited_conserved_slopes(0,`ie0,ic1,ic2',`ie0-1,ic1,ic2',`ic0,ic1,ic2')dnl + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(1,`ic0,ie1,ic2',`ic0,ie1-1,ic2',`ic0,ic1,ic2')dnl + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(2,`ic0,ic1,ie2',`ic0,ic1,ie2-1',`ic0,ic1,ic2')dnl + enddo + enddo + + do if2=ifirstf2,ilastf2 +coarsen_index(if2,ic2,ratio(2))dnl + ir2=if2-ic2*ratio(2) + deltax2=deltax(ir2,2) + do if1=ifirstf1,ilastf1 +coarsen_index(if1,ic1,ratio(1))dnl + ir1=if1-ic1*ratio(1) + deltax1=deltax(ir1,1) + do if0=ifirstf0,ilastf0 +coarsen_index(if0,ic0,ratio(0))dnl + ir0=if0-ic0*ratio(0) + velf(if0,if1,if2,id)=(conservc(ic0,ic1,ic2) + & + slope0(ic0,ic1,ic2)*deltax(ir0,0) + & + slope1(ic0,ic1,ic2)*deltax1 + & + slope2(ic0,ic1,ic2)*deltax2) + & / densf(if0,if1,if2) + enddo + enddo + enddo + + enddo + +c +c construct fine pressure values using conservative linear +c interpolation on energy +c + val = (gamma-one) + valinv = one/(gamma-one) + + do ic2=ifirstc2-1,ilastc2+1 + do ic1=ifirstc1-1,ilastc1+1 + do ic0=ifirstc0-1,ilastc0+1 + v2norm = velc(ic0,ic1,ic2,0)**2 + & + velc(ic0,ic1,ic2,1)**2 + & + velc(ic0,ic1,ic2,2)**2 + conservc(ic0,ic1,ic2) = presc(ic0,ic1,ic2)*valinv + & + half*densc(ic0,ic1,ic2)*v2norm + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 +muscl_limited_conserved_slopes(0,`ie0,ic1,ic2',`ie0-1,ic1,ic2',`ic0,ic1,ic2')dnl + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(1,`ic0,ie1,ic2',`ic0,ie1-1,ic2',`ic0,ic1,ic2')dnl + enddo + enddo + + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 +muscl_limited_conserved_slopes(2,`ic0,ic1,ie2',`ic0,ic1,ie2-1',`ic0,ic1,ic2')dnl + enddo + enddo + + do if2=ifirstf2,ilastf2 +coarsen_index(if2,ic2,ratio(2))dnl + ir2=if2-ic2*ratio(2) + deltax2=deltax(ir2,2) + do if1=ifirstf1,ilastf1 +coarsen_index(if1,ic1,ratio(1))dnl + ir1=if1-ic1*ratio(1) + deltax1=deltax(ir1,1) + do if0=ifirstf0,ilastf0 +coarsen_index(if0,ic0,ratio(0))dnl + ir0=if0-ic0*ratio(0) + v2norm = velf(if0,if1,if2,0)**2 + & + velf(if0,if1,if2,1)**2 + & + velf(if0,if1,if2,2)**2 + presf(if0,if1,if2) = ((conservc(ic0,ic1,ic2) + & + slope0(ic0,ic1,ic2)*deltax(ir0,0) + & + slope1(ic0,ic1,ic2)*deltax1 + & + slope2(ic0,ic1,ic2)*deltax2) + & - half*densf(if0,if1,if2)*v2norm) * val + if (presf(if0,if1,if2).lt.zero) then +c write(6,*) "IN conservlinint3d" +c write(6,*) "gamma,val,valinv = ", +c & gamma,val,valinv +c write(6,*) "ifirstf0,ilastf0 ",ifirstf0,ilastf0, +c & ", ifirstf1,ilastf1 ",ifirstf1,ilastf1 +c & ", ifirstf2,ilastf2 ",ifirstf2,ilastf2 +c write(6,*) "if0,if1,if2 ",if0,if,if21 +c write(6,*) "ic0,ic1,if2 ",ic0,ic,if21 +c write(6,*) "fine energy = ", +c & conservc(ic0,ic1,ic2) + slope0(ic0,ic1,ic2)*deltax(ir0,0) +c & + slope1(ic0,ic1,ic2)*deltax1 +c & + slope2(ic0,ic1,ic2)*deltax2 +c write(6,*) "densf(if0,if1,if2) ",densf(if0,if1,if2) +c write(6,*) "vel() ",velf(if0,if1,if2,0), +c & velf(if0,if1,if2,1), +c & velf(if0,if1,if2,2) +c write(6,*) "presf(if0,if1,if2) ",presf(if0,if1,if2) +c write(6,*) "conservc(",ic0,ic1,ic2,") ", +c & conservc(ic0,ic1,ic2) +c write(6,*) "slope0(",ic0,ic1,ic2,") ", +c & slope0(ic0,ic1,ic2) +c write(6,*) "deltax(",ir0,0,") ",deltax(ir0,0) +c write(6,*) "slope1(",ic0,ic1,ic2,") ", +c & slope1(ic0,ic1,ic2) +c write(6,*) "deltax1(",ir1,1,") ",deltax1 +c write(6,*) "slope2(",ic0,ic1,ic2,") ", +c & slope2(ic0,ic1,ic2) +c write(6,*) "deltax2(",ir2,2,") ",deltax2 +c write(6,*) "val ",val,", v2norm ",v2norm +c write(6,*) "presc(",ic0,ic1,ic2,") ",presc(ic0,ic1,ic2) +c write(6,*) "densc(",ic0,ic1,ic2,") ",densc(ic0,ic1,ic2) +c write(6,*) "velc() ",velc(ic0,ic1,ic2,0), +c & velc(ic0,ic1,ic2,1), +c & velc(ic0,ic1,ic2,2) + presneg = .true. + endif + enddo + enddo + enddo + + if (presneg) then + write(6,*) "negative pressure reported in conservlinint3d" +c write(6,*) "coarse conserved values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,conservc = ", +c & ic0,ic1,ic2,conservc(ic0,ic1,ic2) +c enddo +c enddo +c enddo +c write(6,*) "coarse density values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,densc = ", +c & ic0,ic1,ic2,densc(ic0,ic1,ic2) +c enddo +c enddo +c enddo +c write(6,*) "coarse velocity0 values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,velc = ", +c & ic0,ic1,ic2,velc(ic0,ic1,ic2,0) +c enddo +c enddo +c enddo +c write(6,*) "coarse velocity1 values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,velc = ", +c & ic0,ic1,ic2,velc(ic0,ic1,ic2,1) +c enddo +c enddo +c enddo +c write(6,*) "coarse velocity2 values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,velc = ", +c & ic0,ic1,ic2,velc(ic0,ic1,ic2,2) +c enddo +c enddo +c enddo +c write(6,*) "coarse pressure values" +c do ic2=ifirstc2-1,ilastc2+1 +c do ic1=ifirstc1-1,ilastc1+1 +c do ic0=ifirstc0-1,ilastc0+1 +c write(6,*) "ic0,ic1,ic2,presc = ", +c & ic0,ic1,ic2,presc(ic0,ic1,ic2) +c enddo +c enddo +c enddo +c write(6,*) "fine density values" +c do if2=ifirstf2,ilastf2 +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,if2,densf = ", +c & if0,if1,if2,densf(if0,if1,if2) +c enddo +c enddo +c enddo +c write(6,*) "fine velocity0 values" +c do if2=ifirstf2,ilastf2 +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,if2,velf = ", +c & if0,if1,if2,velf(if0,if1,if2,0) +c enddo +c enddo +c enddo +c write(6,*) "fine velocity1 values" +c do if2=ifirstf2,ilastf2 +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,if2,velf = ", +c & if0,if1,if2,velf(if0,if1,if2,1) +c enddo +c enddo +c enddo +c write(6,*) "fine velocity2 values" +c do if2=ifirstf2,ilastf2 +c do if1=ifirstf1,ilastf1 +c do if0=ifirstf0,ilastf0 +c write(6,*) "if0,if1,if2,velf = ", +c & if0,if1,if2,velf(if0,if1,if2,2) +c enddo +c enddo +c enddo + stop + endif +c + return + end +c +c +c*********************************************************************** +c Volume weighted averaging for 3d flux variables. +c*********************************************************************** +c + subroutine conservavg3d( + & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, + & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, + & filo0,filo1,filo2,fihi0,fihi1,fihi2, + & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2, + & ratio,dxf,dxc, + & gamma, + & densf,densc, + & velf,presf, + & velc,presc, + & conservf) +c*********************************************************************** + implicit none + REAL zero,half,one + parameter (zero=0.d0) + parameter (half=0.5d0) + parameter (one=1.d0) +c + integer + & ifirstf0,ifirstf1,ifirstf2,ilastf0,ilastf1,ilastf2, + & ifirstc0,ifirstc1,ifirstc2,ilastc0,ilastc1,ilastc2, + & filo0,filo1,filo2,fihi0,fihi1,fihi2, + & cilo0,cilo1,cilo2,cihi0,cihi1,cihi2 + integer ratio(0:NDIM-1) + REAL + & dxf(0:NDIM-1), + & dxc(0:NDIM-1), + & gamma + REAL + & densf(CELL3d(filo,fihi,0)), + & densc(CELL3d(cilo,cihi,0)), + & velf(CELL3d(filo,fihi,0),0:NDIM-1), + & presf(CELL3d(filo,fihi,0)) + REAL + & velc(CELL3d(cilo,cihi,0),0:NDIM-1), + & presc(CELL3d(cilo,cihi,0)) + REAL + & conservf(CELL3d(ifirstf,ilastf,0)) + integer ic0,ic1,ic2,if0,if1,if2,ir0,ir1,ir2,id + REAL dVf,dVc,val,valinv,v2norm +c +c*********************************************************************** +c + dVf = dxf(0)*dxf(1)*dxf(2) + dVc = dxc(0)*dxc(1)*dxc(2) +c +c construct coarse velocity values using conservative average +c of momentum +c + do id=0,NDIM-1 + + do if2=ifirstf2,ilastf2 + do if1=ifirstf1,ilastf1 + do if0=ifirstf0,ilastf0 + conservf(if0,if1,if2) = + & densf(if0,if1,if2)*velf(if0,if1,if2,id) + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + velc(ic0,ic1,ic2,id) = zero + enddo + enddo + enddo + + do ir2=0,ratio(2)-1 + do ir1=0,ratio(1)-1 + do ir0=0,ratio(0)-1 + do ic2=ifirstc2,ilastc2 + if2=ic2*ratio(2)+ir2 + do ic1=ifirstc1,ilastc1 + if1=ic1*ratio(1)+ir1 + do ic0=ifirstc0,ilastc0 + if0=ic0*ratio(0)+ir0 + velc(ic0,ic1,ic2,id) = velc(ic0,ic1,ic2,id) + & + conservf(if0,if1,if2)*dVf + enddo + enddo + enddo + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + velc(ic0,ic1,ic2,id) = velc(ic0,ic1,ic2,id) + & / (densc(ic0,ic1,ic2)*dVc) + enddo + enddo + enddo + + enddo + +c +c construct coarse velocity values using conservative average +c of energy +c + val = (gamma-one) + valinv = one/(gamma-one) + + do if2=ifirstf2,ilastf2 + do if1=ifirstf1,ilastf1 + do if0=ifirstf0,ilastf0 + v2norm = velf(if0,if1,if2,0)**2 + & + velf(if0,if1,if2,1)**2 + & + velf(if0,if1,if2,2)**2 + conservf(if0,if1,if2) = presf(if0,if1,if2)*valinv + & + half*densf(if0,if1,if2)*v2norm + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + presc(ic0,ic1,ic2) = zero + enddo + enddo + enddo + + do ir2=0,ratio(2)-1 + do ir1=0,ratio(1)-1 + do ir0=0,ratio(0)-1 + do ic2=ifirstc2,ilastc2 + if2=ic2*ratio(2)+ir2 + do ic1=ifirstc1,ilastc1 + if1=ic1*ratio(1)+ir1 + do ic0=ifirstc0,ilastc0 + if0=ic0*ratio(0)+ir0 + presc(ic0,ic1,ic2) = presc(ic0,ic1,ic2) + & + conservf(if0,if1,if2)*dVf + enddo + enddo + enddo + enddo + enddo + enddo + + do ic2=ifirstc2,ilastc2 + do ic1=ifirstc1,ilastc1 + do ic0=ifirstc0,ilastc0 + v2norm = velc(ic0,ic1,ic2,0)**2 + & + velc(ic0,ic1,ic2,1)**2 + & + velc(ic0,ic1,ic2,2)**2 + presc(ic0,ic1,ic2) = ((presc(ic0,ic1,ic2)/dVc) + & - half*densc(ic0,ic1,ic2)*v2norm) * val + enddo + enddo + enddo + + +c + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/const.i index d6e93070..6da5a3d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,tenth,sixth,fourth,third,half,twothird, & rt75,one,onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten.i deleted file mode 100644 index cb26e0b2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten.i +++ /dev/null @@ -1,75 +0,0 @@ -c*********************************************************************** - subroutine flaten(ifirst,ilast,i,mc,idir, - & tracest,sound,flattn) -c*********************************************************************** -c Compute "flattn" (flattening coefficient) for cell i -c description of arguments: -c input: -c ifirst,ilast,mc ==> array dimensions -c i ==> cell index flattn is being computed on -c idir ==> coordinate direction -c tracest ==> array of traced states -c sound ==> array of sound speeds -c output: -c flattn ==> flattening coefficient -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../probparams.i)dnl -include(FORTDIR/../const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - integer ifirst,ilast,i,mc,idir - REAL tracest(ifirst-FACEG:ifirst+mc+FACEG,NEQU) - REAL sound(ifirst-CELLG:ifirst+mc-1+CELLG) - REAL flat2(3) - REAL flattn - - REAL shktst, zcut1, zcut2, dzcut, smallp - REAL denom, zeta, tst, tmp, dp,zi - REAL rhoc1,rhoc2,chi - integer j,ii -c -c*********************************************************************** -c - shktst =0.33d0 - zcut1 =0.75d0 - zcut2 =0.85d0 - smallp =1.0d-6 - dzcut = one/(zcut2-zcut1) - - flattn = one - -c -c Leave flattn = 1. at bounds. -c - if ((i.lt.ifirst-1) .or. (i.gt.ilast+1)) return -c -c Compute "flat2" at i-1,i,i+1 -c - do j=1,3 - ii = (i-2) + j - dp = tracest(ii+1,NEQU) - tracest(ii-1,NEQU) - denom = max(smallp,abs(tracest(ii+2,NEQU)-tracest(ii-2,NEQU))) - zeta = abs(dp)/denom - zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) - if ((tracest(ii-1,idir+2) - tracest(ii+1,idir+2)).gt.zero) then - tst = one - else - tst = zero - endif - rhoc1 = tracest(ii+1,1)*sound(ii+1)**2 - rhoc2 = tracest(ii-1,1)*sound(ii-1)**2 - tmp = min(rhoc1,rhoc2) - if ((abs(dp)/tmp).gt.shktst) then - chi = tst - else - chi = zero - endif - flat2(j) = chi*zi - enddo -c -c Compute "flattn" at cell i, using flat2 at i-1,i,i+1 -c - flattn = one - max(flat2(1),flat2(2),flat2(3)) - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d2d.m4 new file mode 100644 index 00000000..07ddaee3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d2d.m4 @@ -0,0 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for computing flattening coefficient for 2d +c euler equations. +c +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(FORTDIR/flaten2d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d3d.m4 new file mode 100644 index 00000000..19a6e049 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten1d3d.m4 @@ -0,0 +1,11 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for computing flattening coefficient for 3d +c euler equations. +c +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(FORTDIR/flaten3d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten2d.i new file mode 100644 index 00000000..207b916f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten2d.i @@ -0,0 +1,83 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient in 2d. +c +c*********************************************************************** + subroutine flaten2d(ifirst,ilast,i,mc,idir, + & tracest,sound,flattn) +c*********************************************************************** +c Compute "flattn" (flattening coefficient) for cell i +c description of arguments: +c input: +c ifirst,ilast,mc ==> array dimensions +c i ==> cell index flattn is being computed on +c idir ==> coordinate direction +c tracest ==> array of traced states +c sound ==> array of sound speeds +c output: +c flattn ==> flattening coefficient +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + integer ifirst,ilast,i,mc,idir + REAL tracest(ifirst-FACEG:ifirst+mc+FACEG,NEQU) + REAL sound(ifirst-CELLG:ifirst+mc-1+CELLG) + REAL flat2(3) + REAL flattn + + REAL shktst, zcut1, zcut2, dzcut, smallp + REAL denom, zeta, tst, tmp, dp,zi + REAL rhoc1,rhoc2,chi + integer j,ii +c +c*********************************************************************** +c + shktst =0.33d0 + zcut1 =0.75d0 + zcut2 =0.85d0 + smallp =1.0d-6 + dzcut = one/(zcut2-zcut1) + + flattn = one + +c +c Leave flattn = 1. at bounds. +c + if ((i.lt.ifirst-1) .or. (i.gt.ilast+1)) return +c +c Compute "flat2" at i-1,i,i+1 +c + do j=1,3 + ii = (i-2) + j + dp = tracest(ii+1,NEQU) - tracest(ii-1,NEQU) + denom = max(smallp,abs(tracest(ii+2,NEQU)-tracest(ii-2,NEQU))) + zeta = abs(dp)/denom + zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) + if ((tracest(ii-1,idir+2) - tracest(ii+1,idir+2)).gt.zero) then + tst = one + else + tst = zero + endif + rhoc1 = tracest(ii+1,1)*sound(ii+1)**2 + rhoc2 = tracest(ii-1,1)*sound(ii-1)**2 + tmp = min(rhoc1,rhoc2) + if ((abs(dp)/tmp).gt.shktst) then + chi = tst + else + chi = zero + endif + flat2(j) = chi*zi + enddo +c +c Compute "flattn" at cell i, using flat2 at i-1,i,i+1 +c + flattn = one - max(flat2(1),flat2(2),flat2(3)) + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten3d.i new file mode 100644 index 00000000..8841310a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flaten3d.i @@ -0,0 +1,83 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute flattening +c coefficient in 3d. +c +c*********************************************************************** + subroutine flaten3d(ifirst,ilast,i,mc,idir, + & tracest,sound,flattn) +c*********************************************************************** +c Compute "flattn" (flattening coefficient) for cell i +c description of arguments: +c input: +c ifirst,ilast,mc ==> array dimensions +c i ==> cell index flattn is being computed on +c idir ==> coordinate direction +c tracest ==> array of traced states +c sound ==> array of sound speeds +c output: +c flattn ==> flattening coefficient +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + integer ifirst,ilast,i,mc,idir + REAL tracest(ifirst-FACEG:ifirst+mc+FACEG,NEQU) + REAL sound(ifirst-CELLG:ifirst+mc-1+CELLG) + REAL flat2(3) + REAL flattn + + REAL shktst, zcut1, zcut2, dzcut, smallp + REAL denom, zeta, tst, tmp, dp,zi + REAL rhoc1,rhoc2,chi + integer j,ii +c +c*********************************************************************** +c + shktst =0.33d0 + zcut1 =0.75d0 + zcut2 =0.85d0 + smallp =1.0d-6 + dzcut = one/(zcut2-zcut1) + + flattn = one + +c +c Leave flattn = 1. at bounds. +c + if ((i.lt.ifirst-1) .or. (i.gt.ilast+1)) return +c +c Compute "flat2" at i-1,i,i+1 +c + do j=1,3 + ii = (i-2) + j + dp = tracest(ii+1,NEQU) - tracest(ii-1,NEQU) + denom = max(smallp,abs(tracest(ii+2,NEQU)-tracest(ii-2,NEQU))) + zeta = abs(dp)/denom + zi = min( one, max( zero, dzcut*(zeta - zcut1) ) ) + if ((tracest(ii-1,idir+2) - tracest(ii+1,idir+2)).gt.zero) then + tst = one + else + tst = zero + endif + rhoc1 = tracest(ii+1,1)*sound(ii+1)**2 + rhoc2 = tracest(ii-1,1)*sound(ii-1)**2 + tmp = min(rhoc1,rhoc2) + if ((abs(dp)/tmp).gt.shktst) then + chi = tst + else + chi = zero + endif + flat2(j) = chi*zi + enddo +c +c Compute "flattn" at cell i, using flat2 at i-1,i,i+1 +c + flattn = one - max(flat2(1),flat2(2),flat2(3)) + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux2d.m4 new file mode 100644 index 00000000..9e89831e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux2d.m4 @@ -0,0 +1,284 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for flux compuation for 2d euler equations. +c +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/m4flux2d.i)dnl + + subroutine fluxcorrec(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & dx, + & gamma,density,velocity,pressure, + & flux0,flux1, + & trlft0,trlft1, + & trrgt0,trrgt1) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & density(CELL2d(ifirst,ilast,CELLG)), + & velocity(CELL2d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL2d(ifirst,ilast,CELLG)), + & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), + & trlft0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & trrgt0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & trlft1(FACE2d1(ifirst,ilast,FACEG),NEQU), + & trrgt1(FACE2d1(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,k + REAL trnsvers(NEQU) +c REAL ttvlft(NEQU),ttvrgt(NEQU) + REAL ttv(NEQU) + REAL v2norm,rho,vel1,vel0,gamma, + & gam_min_one + +c write(6,*) "In fluxcorrec()" + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" +c call flush(6) + stop + endif +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** + gam_min_one = gamma-one +c correct the 1-direction with 0-fluxes +c write(6,*) " correct the 1-direction with 0-fluxes" + do ic1=ifirst1-(FLUXG),ilast1+(FLUXG) + do ic0=ifirst0-(FLUXG-1),ilast0+(FLUXG-1) + rho = density(ic0,ic1) + vel0 = velocity(ic0,ic1,0) + vel1 = velocity(ic0,ic1,1) + v2norm= vel1**2 +vel0**2 + do k=1,NEQU + trnsvers(k)= + & (flux0(ic0+1,ic1,k)-flux0(ic0,ic1,k))*half/dx(0) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + trrgt1(ic1 ,ic0,k)= trrgt1(ic1 ,ic0,k) - ttv(k) + trlft1(ic1+1,ic0,k)= trlft1(ic1+1,ic0,k) - ttv(k) + enddo + trrgt1(ic1 ,ic0,NEQU) = max(smallr,trrgt1(ic1 ,ic0,NEQU)) + trlft1(ic1+1,ic0,NEQU) = max(smallr,trlft1(ic1+1,ic0,NEQU)) + enddo + enddo +c call flush(6) + +c correct the 0-direction with 1-fluxes +c write(6,*) " correct the 0-direction with 1-fluxes" + do ic0=ifirst0-(FLUXG),ilast0+(FLUXG) + do ic1=ifirst1-(FLUXG-1),ilast1+(FLUXG-1) + rho = density(ic0,ic1) + vel0 = velocity(ic0,ic1,0) + vel1 = velocity(ic0,ic1,1) + v2norm= vel1**2 +vel0**2 + do k=1,NEQU + trnsvers(k)= + & (flux1(ic1+1,ic0,k)-flux1(ic1,ic0,k))*half/dx(1) + enddo +c write(6,*) " flux1(",ic1+1,ic0,")= ",flux1(ic1+1,ic0,1), +c & flux1(ic1+1,ic0,2),flux1(ic1+1,ic0,3),flux1(ic1+1,ic0,4) +c write(6,*) " flux1(",ic1,ic0,")= ",flux1(ic1,ic0,1), +c & flux1(ic1,ic0,2),flux1(ic1,ic0,3),flux1(ic1,ic0,4) +c + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) + + & trnsvers(NEQU))*gam_min_one +c write(6,*) " old trrgt0(",ic0,ic1,"=",trrgt0(ic0,ic1,1), +c & trrgt0(ic0,ic1,2),trrgt0(ic0,ic1,3), +c & trrgt0(ic0,ic1,4) +c write(6,*) " old trlft0(",ic0+1,ic1,"=",trlft0(ic0+1,ic1,1), +c & trlft0(ic0+1,ic1,2),trlft0(ic0+1,ic1,3), +c & trlft0(ic0+1,ic1,4) + do k=1,NEQU + trrgt0(ic0 ,ic1,k)= trrgt0(ic0 ,ic1,k) - ttv(k) + trlft0(ic0+1,ic1,k)= trlft0(ic0+1,ic1,k) - ttv(k) + enddo + trrgt0(ic0 ,ic1,NEQU) = max(smallr,trrgt0(ic0 ,ic1,NEQU)) + trlft0(ic0+1,ic1,NEQU) = max(smallr,trlft0(ic0+1,ic1,NEQU)) +c write(6,*) " new trrgt0(",ic0,ic1,"=",trrgt0(ic0,ic1,1), +c & trrgt0(ic0,ic1,2),trrgt0(ic0,ic1,3), +c & trrgt0(ic0,ic1,4) +c write(6,*) " new trlft0(",ic0+1,ic1,"=",trlft0(ic0+1,ic1,1), +c & trlft0(ic0+1,ic1,2),trlft0(ic0+1,ic1,3), +c & trlft0(ic0+1,ic1,4) + enddo + enddo +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcalculation2d(dt,extra_cell,visco,dx, + & ifirst0,ilast0,ifirst1,ilast1, + & gamma,rpchoice, + & density,velocity,pressure, + & flux0,flux1, + & trlft0,trlft1,trrgt0,trrgt1) + +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer extra_cell,visco,rpchoice + REAL dt,dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & density(CELL2d(ifirst,ilast,CELLG)), + & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL2d(ifirst,ilast,CELLG)) +c variables in 2d side indexed + REAL + & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), + & trlft0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & trrgt0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & trlft1(FACE2d1(ifirst,ilast,FACEG),NEQU), + & trrgt1(FACE2d1(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ie0,ie1,j + REAL stateL(NEQU),stateR(NEQU), + & riemst(NEQU),gamma + REAL mom0,mom1,Hent,v2norm,vel_tan + REAL mom0L,mom1L,enerL,mom0R,mom1R,enerR + REAL maxeig, vcoef,vcorr(NEQU),gam_min_one +c +c variables for hllc scheme + REAL aLsq,aRsq,keL,keR,flux(NEQU),diff(NEQU) + REAL mfL,mfR,star(NEQU),sL,sM,sR + REAL w,omw,hat(NEQU+1),denom +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" +c call flush(6) + stop + endif +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c +c write(6,*) "In fluxcalculation2d(",extra_cell,")" +c write(6,*) "ifirst0,ilast0,ifirst1,ilast1,extra_cell", +c & ifirst0,ilast0,ifirst1,ilast1,extra_cell + gam_min_one = gamma-one +riemann_solve(0,1,(extra_cell+(FLUXG-1)))dnl +c +riemann_solve(1,0,(extra_cell+(FLUXG-1)))dnl + + if (visco.eq.1) then + write(6,*) "doing artificial viscosity" +c +artificial_viscosity1(0,1)dnl +c +artificial_viscosity1(1,0)dnl +c + endif +c call flush(6) + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + + subroutine consdiff2d(ifirst0,ilast0,ifirst1,ilast1,dx, + & flux0,flux1, + & gamma,density,velocity,pressure) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** + integer ifirst0, ilast0,ifirst1, ilast1 + REAL dx(0:NDIM-1) + REAL + & flux0(FACE2d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE2d1(ifirst,ilast,FLUXG),NEQU), + & gamma, + & density(CELL2d(ifirst,ilast,CELLG)), + & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL2d(ifirst,ilast,CELLG)) +c + integer ic0,ic1,k + REAL temp,v2norm,mom(NDIM),energy, + & gam_min_one + +c*********************************************************************** +c update conserved variables to full time +c note the permutation of indices in 2nd coordinate direction +c*********************************************************************** + gam_min_one = gamma-one + + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + mom(1) = density(ic0,ic1)*velocity(ic0,ic1,1) + mom(2) = density(ic0,ic1)*velocity(ic0,ic1,2) + v2norm = (velocity(ic0,ic1,1)**2+velocity(ic0,ic1,2)**2) + energy = pressure(ic0,ic1)/gam_min_one + + & half*density(ic0,ic1)*v2norm + + density(ic0,ic1) = density(ic0,ic1) + & -(flux0(ic0+1,ic1,1)-flux0(ic0,ic1,1))/dx(0) + & -(flux1(ic1+1,ic0,1)-flux1(ic1,ic0,1))/dx(1) + density(ic0,ic1) = max(smallr,density(ic0,ic1)) + do k=1,NDIM + mom(k) = mom(k) + & -(flux0(ic0+1,ic1,k+1)-flux0(ic0,ic1,k+1))/dx(0) + & -(flux1(ic1+1,ic0,k+1)-flux1(ic1,ic0,k+1))/dx(1) + velocity(ic0,ic1,k) = mom(k)/density(ic0,ic1) + enddo + energy = energy + & -(flux0(ic0+1,ic1,NEQU)-flux0(ic0,ic1,NEQU))/dx(0) + & -(flux1(ic1+1,ic0,NEQU)-flux1(ic1,ic0,NEQU))/dx(1) +c + v2norm = (velocity(ic0,ic1,1)**2+velocity(ic0,ic1,2)**2) + temp = energy - half*density(ic0,ic1)*v2norm + pressure(ic0,ic1) = gam_min_one*temp + pressure(ic0,ic1) = max(smallr,pressure(ic0,ic1)) + enddo + enddo +c + return + end +c*********************************************************************** +include(FORTDIR/gas1d_approxrp2d.i)dnl +include(FORTDIR/gas1d_exactrp2d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux3d.m4 new file mode 100644 index 00000000..98fa226e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/flux3d.m4 @@ -0,0 +1,343 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for flux compuation for 3d euler equations. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4flux3d.i)dnl + + subroutine fluxcorrec2d(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx,gamma,idir, + & density,velocity,pressure, + & flux0,flux1,flux2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2, + & ttracelft0,ttracelft1,ttracelft2, + & ttracergt0,ttracergt1,ttracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt + integer idir +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & gamma, + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)), +c + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), +c + & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU), +c + & ttracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & ttracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & ttracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & ttracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & ttracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & ttracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,k + REAL trnsvers(NEQU) +c REAL ttvlft(NEQU),ttvrgt(NEQU) + REAL ttv(NEQU) + REAL v2norm,rho,vel1,vel2,vel0,gam_min_one +c write(6,*) "In fluxcorrec2d()" + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif +c + gam_min_one = gamma - one +c +c "Forward" computation of transverse flux terms +c + if (idir.eq.1) then +c +correc_flux2d(0,`ic1,ic2',1,`ic2,ic0',2)dnl +c +correc_flux2d(1,`ic2,ic0',0,`ic1,ic2',2)dnl +c +correc_flux2d(2,`ic0,ic1',0,`ic1,ic2',1)dnl +c +c "Backward" computation of transverse flux terms +c + elseif (idir.eq.-1) then +c +correc_flux2d(0,`ic1,ic2',2,`ic0,ic1',1)dnl +c +correc_flux2d(1,`ic2,ic0',2,`ic0,ic1',0)dnl +c +correc_flux2d(2,`ic0,ic1',1,`ic2,ic0',0)dnl +c + endif +c + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcorrec3d(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx, + & gamma,density,velocity,pressure, + & fluxa0,fluxa1,fluxa2, + & fluxb0,fluxb1,fluxb2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & gamma, + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)), + & fluxa0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & fluxa1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & fluxa2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & fluxb0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & fluxb1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & fluxb2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,k + REAL trnsvers(NEQU) +c REAL ttvlft(NEQU),ttvrgt(NEQU) + REAL ttv(NEQU) + REAL v2norm,rho,vel1,vel2,vel0,gam_min_one +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** + gam_min_one = gamma - one +c +correc_flux3d(2,0,1,a0,a1,`ic1,ic2',`ic2,ic0')dnl +c +correc_flux3d(1,2,0,a2,b0,`ic0,ic1',`ic1,ic2')dnl +c +correc_flux3d(0,1,2,b1,b2,`ic2,ic0',`ic0,ic1')dnl +c + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcalculation3d(dt,xcell0,xcell1,visco,dx, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gamma,rpchoice, + & density,velocity,pressure, + & flux0,flux1,flux2, + & trlft0,trlft1,trlft2, + & trrgt0,trrgt1,trrgt2) + +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer xcell0,xcell1,visco,rpchoice + REAL dt,dx(0:NDIM-1),gamma +c variables in 2d cell indexed + REAL + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL3d(ifirst,ilast,CELLG)) +c variables in 2d side indexed + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & trlft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & trrgt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & trlft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & trrgt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & trlft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & trrgt2(FACE3d2(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,ie0,ie1,ie2,j + REAL stateL(NEQU),stateR(NEQU), + & riemst(NEQU) + REAL mom0,mom1,mom2,Hent,v2norm,vel(0:NDIM-1) + REAL mom0L,mom1L,mom2L,enerL,mom0R,mom1R,mom2R,enerR + REAL maxeig, vcoef,vcorr(NEQU),gam_min_one +c +c variables for hllc scheme + REAL aLsq,aRsq,keL,keR,flux(NEQU),diff(NEQU) + REAL mfL,mfR,star(NEQU),sL,sM,sR + REAL w,omw,hat(NEQU+1),denom +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c + gam_min_one = gamma-one + +c write(6,*) "in fluxcalculation3d..." +c write(6,*) "ifirst = ",ifirst0,ifirst1,ifirst2 +c write(6,*) "ilast = ",ilast0,ilast1,ilast2 +c write(6,*) "xcell0,xcell1 = ",xcell0,xcell1 +c write(6,*) "visco = ",visco +c write(6,*) "gamma = ",gamma +c write(6,*) "rpchoice = ",rpchoice +c write(6,*) "gam_min_one = ",gam_min_one +c call flush(6) +riemann_solve(0,1,2,`ic1,ic2',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl + +c +riemann_solve(1,0,2,`ic2,ic0',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl + +c +riemann_solve(2,0,1,`ic0,ic1',(xcell0+FLUXG-1),(xcell1+FLUXG-1))dnl + + if (visco.eq.1) then +c write(6,*) "doing artificial viscosity" +c +artificial_viscosity1(0,1,2)dnl +c +artificial_viscosity1(1,2,0)dnl +c +artificial_viscosity1(2,0,1)dnl +c + endif + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + + subroutine consdiff3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx, + & flux0,flux1,flux2, + & gamma,density,velocity,pressure) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** + integer ifirst0, ilast0,ifirst1, ilast1,ifirst2,ilast2 + REAL dx(0:NDIM-1) + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & gamma, + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL3d(ifirst,ilast,CELLG)) +c + integer ic0,ic1,ic2,k + REAL temp,v2norm,mom(NDIM),energy, + & gam_min_one + +c*********************************************************************** +c update conserved to full time +c note the permutation of indices in 2nd, 3rd coordinate directions +c*********************************************************************** + gam_min_one = gamma - one + + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + mom(1) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,1) + mom(2) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,2) + mom(3) = density(ic0,ic1,ic2)*velocity(ic0,ic1,ic2,3) + v2norm = (velocity(ic0,ic1,ic2,1)**2+ + & velocity(ic0,ic1,ic2,2)**2+ + & velocity(ic0,ic1,ic2,3)**2) + energy = pressure(ic0,ic1,ic2)/gam_min_one + + & half*density(ic0,ic1,ic2)*v2norm + + density(ic0,ic1,ic2) = density(ic0,ic1,ic2) + & -(flux0(ic0+1,ic1,ic2,1)-flux0(ic0,ic1,ic2,1))/dx(0) + & -(flux1(ic1+1,ic2,ic0,1)-flux1(ic1,ic2,ic0,1))/dx(1) + & -(flux2(ic2+1,ic0,ic1,1)-flux2(ic2,ic0,ic1,1))/dx(2) + density(ic0,ic1,ic2) = max(smallr,density(ic0,ic1,ic2)) + + do k=1,3 + mom(k) = mom(k) + & -(flux0(ic0+1,ic1,ic2,k+1)-flux0(ic0,ic1,ic2,k+1))/dx(0) + & -(flux1(ic1+1,ic2,ic0,k+1)-flux1(ic1,ic2,ic0,k+1))/dx(1) + & -(flux2(ic2+1,ic0,ic1,k+1)-flux2(ic2,ic0,ic1,k+1))/dx(2) + velocity(ic0,ic1,ic2,k) = mom(k)/density(ic0,ic1,ic2) + enddo + energy = energy + & -(flux0(ic0+1,ic1,ic2,NEQU)-flux0(ic0,ic1,ic2,NEQU))/dx(0) + & -(flux1(ic1+1,ic2,ic0,NEQU)-flux1(ic1,ic2,ic0,NEQU))/dx(1) + & -(flux2(ic2+1,ic0,ic1,NEQU)-flux2(ic2,ic0,ic1,NEQU))/dx(2) +c + v2norm = (velocity(ic0,ic1,ic2,1)**2+ + & velocity(ic0,ic1,ic2,2)**2+velocity(ic0,ic1,ic2,3)**2) + temp = energy - half*density(ic0,ic1,ic2)*v2norm + pressure(ic0,ic1,ic2) = gam_min_one*temp + pressure(ic0,ic1,ic2) = max(smallr,pressure(ic0,ic1,ic2)) + enddo + enddo + enddo +c + return + end +c*********************************************************************** +include(FORTDIR/gas1d_approxrp3d.i)dnl +include(FORTDIR/gas1d_exactrp3d.i)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/fluxcorner3d.m4 new file mode 100644 index 00000000..a1b429f0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/fluxcorner3d.m4 @@ -0,0 +1,221 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for corner flux compuation for 3d euler +c equations. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4fluxcorner3d.i)dnl + + subroutine onethirdstate(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gamma,density,velocity,pressure, + & flux0,flux1,flux2, + & st3) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1), gamma +c variables in 3d cell indexed + REAL + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)), + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & st3(CELL3d(ifirst,ilast,CELLG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,k + REAL trnsvers(NEQU) + REAL ttv(NEQU) + REAL v2norm,rho,vel1,vel2,vel0,pres, + & gam_min_one +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** + gam_min_one = gamma - one +c + if (idir.eq.0) then +c +st_third(0,1,2,`ic1,ic2')dnl +c + elseif (idir.eq.1) then +c +st_third(1,2,0,`ic2,ic0')dnl +c + elseif (idir.eq.2) then +c +st_third(2,0,1,`ic0,ic1')dnl +c + endif + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxthird(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gamma,rpchoice, + & density,velocity,pressure, + & st3, + & flux0,flux1,flux2 ) + +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt,dx(0:NDIM-1),gamma + integer rpchoice + REAL + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)) +c variables in 2d side indexed + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & st3(CELL3d(ifirst,ilast,CELLG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL stateL(4),stateR(4), + & riemst(4) + REAL mom2,mom1,mom0,Hent,v2norm,vel(0:3-1), + & gam_min_one +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c + gam_min_one = gamma - one +c + if (idir.eq.0) then +c +f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl +c +f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl +c + elseif (idir.eq.1) then +c +f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl +c +f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl +c + elseif (idir.eq.2) then +c +f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl +c +f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl +c + endif +c + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcorrecjt(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gamma,density,velocity,pressure, + & flux0,flux1,flux2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:3-1) +c variables in 2d cell indexed + REAL + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)), + & flux0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & flux1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & flux2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,k + REAL trnsvers(NEQU) + REAL ttv(NEQU) + REAL v2norm,rho,vel1,vel2,vel0,gamma, + & gam_min_one +c + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** + gam_min_one = gamma - one +c + if (idir.eq.0) then +c +correc_fluxjt(0,2,1,`ic2,ic0',`ic0,ic1')dnl +c + elseif (idir.eq.1) then +c +correc_fluxjt(1,0,2,`ic0,ic1',`ic1,ic2')dnl +c + elseif (idir.eq.2) then +c +correc_fluxjt(2,1,0,`ic1,ic2',`ic2,ic0')dnl +c + endif +c + return + end +c +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp.i deleted file mode 100644 index 9b567ab5..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp.i +++ /dev/null @@ -1,114 +0,0 @@ - subroutine gas1dapproxrp(eosgam,wleft,wright, striem) -c*********************************************************************** -c description of arguments: -c input: -c eosgam ==> ratio of specific heats -c wleft ==> left state -c wright ==> right state -c components ordered: density, vn, pressure -c output: -c striem (density,velocity,pressure) -c <== solution to riemann problem -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../const.i) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL wleft(3),wright(3),eosgam,striem(3) -c - REAL clsqp,clsqm,pstar,zp,zm,ustarm,ustarp,zsum - REAL wsqm,wsqp,wm,wp,ustar,sein,ro,uo,po,co,wo - REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 - REAL gp1g2i, gp1o2gm1 - integer it - REAL separ -c -c ****************************************************************** -c * the entries of wleft, wright, and wriem are (in order): -c * density, tangential velocity, normal velocity, pressure -c ****************************************************************** - - separ = zero - do it=1,3 - separ = separ+abs(wleft(it) - wright(it)) - enddo - if (separ.lt.smallr) then - do it=1,3 - striem(it) = half*(wleft(it)+wright(it)) - enddo - return - endif - - - gp1g2i=half*(eosgam+one)/eosgam - gp1o2gm1=half*(eosgam+one)/(eosgam-one) - clsqp=eosgam*wleft(1)*max(smallr,wleft(3)) - wp=sqrt(clsqp) - clsqm=eosgam*wright(1)*max(smallr,wright(3)) - wm=sqrt(clsqm) - pstar=(wp*wright(3)+wm*wleft(3)-wm*wp*(wright(2)-wleft(2))) - & /(wp+wm) - pstar=max(pstar,smallr ) -c - do it=1,5 - wsqp=clsqp*( one +gp1g2i*(pstar/wleft(3)- one )) - wp=sqrt(wsqp) - wsqm=clsqm*( one +gp1g2i*(pstar/wright(3)- one )) - wm=sqrt(wsqm) - zp= two *wp*wsqp/(wsqp+clsqp) - zm= two *wm*wsqm/(wsqm+clsqm) - ustarm=wright(2)-(wright(3)-pstar)/wm - ustarp=wleft(2)+(wleft(3)-pstar)/wp - zsum=zp+zm - pstar=pstar-zp*zm*(ustarm-ustarp)/zsum - pstar=max(pstar,smallr) - enddo -c - - ustar=(zp*ustarm+zm*ustarp)/zsum - sein=-dsign( one ,ustar) - if (sein.ge.zero) then - ro=wright(1) - uo=wright(2) - po=wright(3) - else - ro=wleft(1) - uo=wleft(2) - po=wleft(3) - endif - po=max(smallr,po) - co=sqrt(po*eosgam/ro) - dummy=pstar-po - wo=eosgam*ro*po*( one +gp1g2i*dummy/po) - rstar=ro/( one -ro*dummy/wo) - wo=sqrt(wo) - cstar=sqrt(eosgam*pstar/rstar) - wso=sein*uo+co - wsi=sein*ustar+cstar - ushok=sein*ustar+wo/rstar - if (dummy.ge.zero) then - wsi=ushok - wso=ushok - else - wsi=wsi - wso=wso - endif - if (wsi.ge.zero) then - striem(1)=rstar - striem(2)=ustar - striem(3)=pstar - else if (wso.lt.zero) then - striem(1)=ro - striem(2)=uo - striem(3)=po - else - t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) - t4= half *(t4+ one ) - t5= one -t4 - t3=t4*cstar+t5*co - striem(1)=t4*rstar+t5*ro - striem(2) =t4*ustar+t5*uo - striem(3)=t3*t3*striem(1)/eosgam - endif - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp2d.i new file mode 100644 index 00000000..62b7ea81 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp2d.i @@ -0,0 +1,122 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to +c Riemann problem in 2d. +c + subroutine gas1dapproxrp2d(eosgam,wleft,wright, striem) +c*********************************************************************** +c description of arguments: +c input: +c eosgam ==> ratio of specific heats +c wleft ==> left state +c wright ==> right state +c components ordered: density, vn, pressure +c output: +c striem (density,velocity,pressure) +c <== solution to riemann problem +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL wleft(3),wright(3),eosgam,striem(3) +c + REAL clsqp,clsqm,pstar,zp,zm,ustarm,ustarp,zsum + REAL wsqm,wsqp,wm,wp,ustar,sein,ro,uo,po,co,wo + REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 + REAL gp1g2i, gp1o2gm1 + integer it + REAL separ +c +c ****************************************************************** +c * the entries of wleft, wright, and wriem are (in order): +c * density, tangential velocity, normal velocity, pressure +c ****************************************************************** + + separ = zero + do it=1,3 + separ = separ+abs(wleft(it) - wright(it)) + enddo + if (separ.lt.smallr) then + do it=1,3 + striem(it) = half*(wleft(it)+wright(it)) + enddo + return + endif + + + gp1g2i=half*(eosgam+one)/eosgam + gp1o2gm1=half*(eosgam+one)/(eosgam-one) + clsqp=eosgam*wleft(1)*max(smallr,wleft(3)) + wp=sqrt(clsqp) + clsqm=eosgam*wright(1)*max(smallr,wright(3)) + wm=sqrt(clsqm) + pstar=(wp*wright(3)+wm*wleft(3)-wm*wp*(wright(2)-wleft(2))) + & /(wp+wm) + pstar=max(pstar,smallr ) +c + do it=1,5 + wsqp=clsqp*( one +gp1g2i*(pstar/wleft(3)- one )) + wp=sqrt(wsqp) + wsqm=clsqm*( one +gp1g2i*(pstar/wright(3)- one )) + wm=sqrt(wsqm) + zp= two *wp*wsqp/(wsqp+clsqp) + zm= two *wm*wsqm/(wsqm+clsqm) + ustarm=wright(2)-(wright(3)-pstar)/wm + ustarp=wleft(2)+(wleft(3)-pstar)/wp + zsum=zp+zm + pstar=pstar-zp*zm*(ustarm-ustarp)/zsum + pstar=max(pstar,smallr) + enddo +c + + ustar=(zp*ustarm+zm*ustarp)/zsum + sein=-dsign( one ,ustar) + if (sein.ge.zero) then + ro=wright(1) + uo=wright(2) + po=wright(3) + else + ro=wleft(1) + uo=wleft(2) + po=wleft(3) + endif + po=max(smallr,po) + co=sqrt(po*eosgam/ro) + dummy=pstar-po + wo=eosgam*ro*po*( one +gp1g2i*dummy/po) + rstar=ro/( one -ro*dummy/wo) + wo=sqrt(wo) + cstar=sqrt(eosgam*pstar/rstar) + wso=sein*uo+co + wsi=sein*ustar+cstar + ushok=sein*ustar+wo/rstar + if (dummy.ge.zero) then + wsi=ushok + wso=ushok + else + wsi=wsi + wso=wso + endif + if (wsi.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t4*cstar+t5*co + striem(1)=t4*rstar+t5*ro + striem(2) =t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/eosgam + endif + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp3d.i new file mode 100644 index 00000000..23b4576a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_approxrp3d.i @@ -0,0 +1,122 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to +c Riemann problem in 3d. +c + subroutine gas1dapproxrp3d(eosgam,wleft,wright, striem) +c*********************************************************************** +c description of arguments: +c input: +c eosgam ==> ratio of specific heats +c wleft ==> left state +c wright ==> right state +c components ordered: density, vn, pressure +c output: +c striem (density,velocity,pressure) +c <== solution to riemann problem +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL wleft(3),wright(3),eosgam,striem(3) +c + REAL clsqp,clsqm,pstar,zp,zm,ustarm,ustarp,zsum + REAL wsqm,wsqp,wm,wp,ustar,sein,ro,uo,po,co,wo + REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 + REAL gp1g2i, gp1o2gm1 + integer it + REAL separ +c +c ****************************************************************** +c * the entries of wleft, wright, and wriem are (in order): +c * density, tangential velocity, normal velocity, pressure +c ****************************************************************** + + separ = zero + do it=1,3 + separ = separ+abs(wleft(it) - wright(it)) + enddo + if (separ.lt.smallr) then + do it=1,3 + striem(it) = half*(wleft(it)+wright(it)) + enddo + return + endif + + + gp1g2i=half*(eosgam+one)/eosgam + gp1o2gm1=half*(eosgam+one)/(eosgam-one) + clsqp=eosgam*wleft(1)*max(smallr,wleft(3)) + wp=sqrt(clsqp) + clsqm=eosgam*wright(1)*max(smallr,wright(3)) + wm=sqrt(clsqm) + pstar=(wp*wright(3)+wm*wleft(3)-wm*wp*(wright(2)-wleft(2))) + & /(wp+wm) + pstar=max(pstar,smallr ) +c + do it=1,5 + wsqp=clsqp*( one +gp1g2i*(pstar/wleft(3)- one )) + wp=sqrt(wsqp) + wsqm=clsqm*( one +gp1g2i*(pstar/wright(3)- one )) + wm=sqrt(wsqm) + zp= two *wp*wsqp/(wsqp+clsqp) + zm= two *wm*wsqm/(wsqm+clsqm) + ustarm=wright(2)-(wright(3)-pstar)/wm + ustarp=wleft(2)+(wleft(3)-pstar)/wp + zsum=zp+zm + pstar=pstar-zp*zm*(ustarm-ustarp)/zsum + pstar=max(pstar,smallr) + enddo +c + + ustar=(zp*ustarm+zm*ustarp)/zsum + sein=-dsign( one ,ustar) + if (sein.ge.zero) then + ro=wright(1) + uo=wright(2) + po=wright(3) + else + ro=wleft(1) + uo=wleft(2) + po=wleft(3) + endif + po=max(smallr,po) + co=sqrt(po*eosgam/ro) + dummy=pstar-po + wo=eosgam*ro*po*( one +gp1g2i*dummy/po) + rstar=ro/( one -ro*dummy/wo) + wo=sqrt(wo) + cstar=sqrt(eosgam*pstar/rstar) + wso=sein*uo+co + wsi=sein*ustar+cstar + ushok=sein*ustar+wo/rstar + if (dummy.ge.zero) then + wsi=ushok + wso=ushok + else + wsi=wsi + wso=wso + endif + if (wsi.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t4*cstar+t5*co + striem(1)=t4*rstar+t5*ro + striem(2) =t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/eosgam + endif + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp.i deleted file mode 100644 index 6311ea6f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp.i +++ /dev/null @@ -1,346 +0,0 @@ -define(rarefvel,`dnl - $3= ($1*two/(gamma-one))*(one- exp(log($2)*tau)) -')dnl - -define(shockvel,`dnl - $3= $1*alpha*(one-$2)/sqrt(1+ $2*beta) -')dnl - -define(derrvel,`dnl - $3= (two*tau*$1/(one-gamma))*exp(log($2)*(tau-one)) -')dnl - -define(dersvel,`dnl - $3= (-1)*$1*half*alpha*(two+beta*(one+$2)) - & /(sqrt(one+ $2*beta)*(one+ $2*beta)) -')dnl - -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine gas1dexactrp(gamma,minpres,wleft,wright,striem) -c*********************************************************************** -c description of arguments: -c input: -c wleft ==> left state -c wright ==> right state -c components ordered: density, vn, pressure -c output: -c striem (density,velocity,pressure) -c <== solution to riemann problem) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/../const.i) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL wleft(3),wright(3),striem(3) - REAL gamma,minpres -c - REAL pstar,ustarl,ustarr,rstarl,rstarr - REAL px,pxl,pxr,pstarl,pstarr - REAL ustar,sein,ro,uo,po,co,wo - REAL feval,dfeval - REAL cxl,cxr - REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 - REAL gp1g2i,tau,beta,alpha - REAL lpres,lvel,lrho,rpres,rvel,rrho - REAL fleft,fright,dfleft,dfright,temp - integer it,leftwave,rightwave -c - tau=half*(gamma-one)/gamma - gp1g2i=half*(gamma+one)/gamma - alpha=sqrt(two/(gamma*(gamma-one))) - beta=(gamma+one)/(gamma-one) - lrho = wleft(1) - lvel = wleft(2) - lpres = wleft(3) - rrho = wright(1) - rvel = wright(2) - rpres = wright(3) - - temp = abs(lvel-rvel) - temp = max(abs(lpres-rpres),temp) - if (temp.lt.smallr) then - striem(2)=half*(lvel+rvel) - striem(3)=half*(lpres+rpres) - if (striem(2).gt.zero) then - striem(1)=lrho - else - striem(1)=rrho - endif - goto 666 - endif - - cxl = sqrt(gamma*lpres/lrho) - cxr = sqrt(gamma*rpres/rrho) - -c TERMINAL VELOCITIES - - ustarl = lvel + two*cxl/(gamma-1) - ustarr = rvel - two*cxr/(gamma-1) - - if (ustarl.lt.ustarr) then - write(6,*)" VACUUM in RS: " - write(6,*)" left state ",lrho,lvel,lpres - write(6,*)" right state ",rrho,rvel,rpres - write(6,*)" vacuum vels ",ustarl,ustarr - if (ustarl.gt.zero) then - ustar = ustarl - ro=lrho - uo=lvel - po=lpres - else if (ustarr.lt.zero) then - ustar = ustarr - ro=rrho - uo=rvel - po=rpres - else - ustar = 0 - striem(1)=0 - striem(2)=half*(ustarl+ustarr) - striem(3)=0 - goto 666 - endif - pstar = 0 - rstar = 0 - rstarl = 0 - rstarr = 0 - cstar = 0 - sein=-dsign( one ,ustar) - co=sqrt(po*gamma/ro) - wso=sein*uo+co - wsi=sein*ustar - if (wso.lt.zero) then - striem(1)=ro - striem(2)=uo - striem(3)=po - else - t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) - t4= half *(t4+ one ) - t5= one -t4 - t3=t5*co - striem(1)=t5*ro - striem(2)=t4*ustar+t5*uo - striem(3)=t3*t3*striem(1)/gamma - endif - return - endif - -c----------------------------------------------------------------- -c CLASSIFY the problem by 1 and 3 waves -c shock= 1, rarefaction=2 - - px = lpres/rpres - if (px .lt. one ) then -rarefvel(cxr,px,temp)dnl - else -shockvel(cxr,px,temp)dnl - endif - if (lvel .gt. (rvel - temp)) then - leftwave = 1 - else - leftwave = 2 - endif - - - px = rpres/lpres - if (px .lt. one ) then -rarefvel(cxl,px,temp) - else -shockvel(cxl,px,temp) - endif - if ((lvel + temp) .gt. rvel ) then - rightwave = 1 - else - rightwave = 2 - endif - -c----------------------------------------------------------------- -c SOLVE RIEMANN PROBLEM - - if ((leftwave.eq.2).and.(rightwave.eq.1)) then -c LEFT RAREF , RIGHT SHOCK - pstar = rpres - pxl = pstar/lpres - pxr = pstar/rpres -rarefvel(cxl,pxl,fleft)dnl -shockvel(cxr,pxr,fright)dnl -derrvel(cxl,pxl,dfleft)dnl -dersvel(cxr,pxr,dfright)dnl - do it=1,9 - feval = lvel + fleft - rvel + fright - dfeval = dfleft/lpres + dfright/rpres - pstar = pstar -feval/dfeval - pxl = pstar/lpres - pxr = pstar/rpres - if (pstar.lt.minpres) then - write(6,*)" pressure is too small or negative in - & exactsolver" - write(6,*)" left state ",lrho,lvel,lpres - write(6,*)" right state ",rrho,rvel,rpres - write(6,*)" lwave rwave = ",leftwave,rightwave - endif -rarefvel(cxl,pxl,fleft)dnl -shockvel(cxr,pxr,fright)dnl -derrvel(cxl,pxl,dfleft)dnl -dersvel(cxr,pxr,dfright)dnl - enddo - pstar=max(pstar,minpres ) - ustarl = lvel + fleft - ustarr = rvel - fright - rstarl = lrho*exp(log(pxl)/gamma) - rstarr = rrho*(1+beta*pxr)/(beta+pxr) - elseif ((leftwave.eq.1).and.(rightwave.eq.2)) then -c LEFT SHOCK ,RIGHT RAREF - pstar = lpres - pxl = pstar/lpres - pxr = pstar/rpres -shockvel(cxl,pxl,fleft)dnl -rarefvel(cxr,pxr,fright)dnl -dersvel(cxl,pxl,dfleft)dnl -derrvel(cxr,pxr,dfright)dnl - do it=1,5 - feval = lvel + fleft - rvel + fright - dfeval = dfleft/lpres + dfright/rpres - pstar = pstar -feval/dfeval - pxl = pstar/lpres - pxr = pstar/rpres - if (pstar.lt.minpres) then - write(6,*)" pressure is too small or negative in - & exactsolver" - write(6,*)" left state ",lrho,lvel,lpres - write(6,*)" right state ",rrho,rvel,rpres - write(6,*)" lwave rwave = ",leftwave,rightwave - endif -shockvel(cxl,pxl,fleft)dnl -rarefvel(cxr,pxr,fright)dnl -dersvel(cxl,pxl,dfleft)dnl -derrvel(cxr,pxr,dfright)dnl - enddo - pstar=max(pstar,minpres ) - ustarl = lvel + fleft - ustarr = rvel - fright - rstarl = lrho*(1+beta*pxl)/(beta+pxl) - rstarr = rrho*exp(log(pxr)/gamma) - elseif ((leftwave.eq.1).and.(rightwave.eq.1)) then -c RIGHT SHOCK, LEFT SHOCK - pstar = max(rpres,lpres) - pxl = pstar/lpres - pxr = pstar/rpres -shockvel(cxl,pxl,fleft)dnl -shockvel(cxr,pxr,fright)dnl -dersvel(cxl,pxl,dfleft)dnl -dersvel(cxr,pxr,dfright)dnl - do it=1,5 - feval = lvel + fleft - rvel + fright - dfeval = dfleft/lpres + dfright/rpres - pstar = pstar -feval/dfeval - pxl = pstar/lpres - pxr = pstar/rpres - if (pstar.lt.minpres) then - write(6,*)" pressure is too small or negative in - & exactsolver" - write(6,*)" left state ",lrho,lvel,lpres - write(6,*)" right state ",rrho,rvel,rpres - write(6,*)" lwave rwave = ",leftwave,rightwave - endif -shockvel(cxl,pxl,fleft)dnl -shockvel(cxr,pxr,fright)dnl -dersvel(cxl,pxl,dfleft)dnl -dersvel(cxr,pxr,dfright)dnl - enddo - pstar=max(pstar,minpres ) - ustarl = lvel + fleft - ustarr = rvel - fright - rstarl = lrho*(1+beta*pxl)/(beta+pxl) - rstarr = rrho*(1+beta*pxr)/(beta+pxr) - else -c RIGHT RAREF, LEFT RAREF - pstarl = exp(tau*log(lpres)) - pstarr = exp(tau*log(rpres)) - pstar = (half*(gamma-1)*(lvel-rvel)+cxl+cxr)/ - & (cxr/pstarr +cxl/pstarl) - pstar = exp(log(pstar)/tau) - if (pstar.lt.minpres) then - write(6,*)" pressure is too small or negative in - & exactsolver" - write(6,*)" left state ",lrho,lvel,lpres - write(6,*)" right state ",rrho,rvel,rpres - write(6,*)" lwave rwave = ",leftwave,rightwave - endif - pstar=max(pstar,minpres ) - pxl = pstar/lpres - pxr = pstar/rpres -rarefvel(cxl,pxl,fleft)dnl -rarefvel(cxr,pxr,fright)dnl - ustarl = lvel + fleft - ustarr = rvel - fright - rstarl = lrho*exp(log(pxl)/gamma) - rstarr = rrho*exp(log(pxr)/gamma) - endif - pstarl = pstar - pstarr = pstar - - ustar=half*(ustarl+ustarr) - -c----------------------------------------------------------------- -c PICK STATE FOR FLUXES - - sein=-dsign( one ,ustar) - if (sein.ge.zero) then - ro=rrho - uo=rvel - po=rpres - rstar =rstarr - else - ro=lrho - uo=lvel - po=lpres - rstar =rstarl - endif - cstar=sqrt(gamma*pstar/rstar) - dummy=pstar-po - if (dummy.ge.zero) then -c shock - wo=sqrt(gamma*ro*po*( one +gp1g2i*dummy/po)) - ushok=sein*ustar+wo/rstar - if (ushok.ge.zero) then - striem(1)=rstar - striem(2)=ustar - striem(3)=pstar - else - striem(1)=ro - striem(2)=uo - striem(3)=po - endif - else -c rarefaction - co=sqrt(po*gamma/ro) - wso=sein*uo+co - wsi=sein*ustar+cstar - if (wsi.ge.zero) then - striem(1)=rstar - striem(2)=ustar - striem(3)=pstar - else if (wso.lt.zero) then - striem(1)=ro - striem(2)=uo - striem(3)=po - else - t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) - t4= half *(t4+ one ) - t5= one -t4 - t3=t4*cstar+t5*co - striem(1)=t4*rstar+t5*ro - striem(2)=t4*ustar+t5*uo - striem(3)=t3*t3*striem(1)/gamma - endif - endif -c ------------------------------------------------------------------ -c write(6,*) "leaving riemnv" -c ------------------------------------------------------------------ - 666 return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp2d.i new file mode 100644 index 00000000..d5151437 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp2d.i @@ -0,0 +1,354 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to +c Riemann problem in 2d. +c +define(rarefvel,`dnl + $3= ($1*two/(gamma-one))*(one- exp(log($2)*tau)) +')dnl + +define(shockvel,`dnl + $3= $1*alpha*(one-$2)/sqrt(1+ $2*beta) +')dnl + +define(derrvel,`dnl + $3= (two*tau*$1/(one-gamma))*exp(log($2)*(tau-one)) +')dnl + +define(dersvel,`dnl + $3= (-1)*$1*half*alpha*(two+beta*(one+$2)) + & /(sqrt(one+ $2*beta)*(one+ $2*beta)) +')dnl + +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine gas1dexactrp2d(gamma,minpres,wleft,wright,striem) +c*********************************************************************** +c description of arguments: +c input: +c wleft ==> left state +c wright ==> right state +c components ordered: density, vn, pressure +c output: +c striem (density,velocity,pressure) +c <== solution to riemann problem) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL wleft(3),wright(3),striem(3) + REAL gamma,minpres +c + REAL pstar,ustarl,ustarr,rstarl,rstarr + REAL px,pxl,pxr,pstarl,pstarr + REAL ustar,sein,ro,uo,po,co,wo + REAL feval,dfeval + REAL cxl,cxr + REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 + REAL gp1g2i,tau,beta,alpha + REAL lpres,lvel,lrho,rpres,rvel,rrho + REAL fleft,fright,dfleft,dfright,temp + integer it,leftwave,rightwave +c + tau=half*(gamma-one)/gamma + gp1g2i=half*(gamma+one)/gamma + alpha=sqrt(two/(gamma*(gamma-one))) + beta=(gamma+one)/(gamma-one) + lrho = wleft(1) + lvel = wleft(2) + lpres = wleft(3) + rrho = wright(1) + rvel = wright(2) + rpres = wright(3) + + temp = abs(lvel-rvel) + temp = max(abs(lpres-rpres),temp) + if (temp.lt.smallr) then + striem(2)=half*(lvel+rvel) + striem(3)=half*(lpres+rpres) + if (striem(2).gt.zero) then + striem(1)=lrho + else + striem(1)=rrho + endif + goto 666 + endif + + cxl = sqrt(gamma*lpres/lrho) + cxr = sqrt(gamma*rpres/rrho) + +c TERMINAL VELOCITIES + + ustarl = lvel + two*cxl/(gamma-1) + ustarr = rvel - two*cxr/(gamma-1) + + if (ustarl.lt.ustarr) then + write(6,*)" VACUUM in RS: " + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" vacuum vels ",ustarl,ustarr + if (ustarl.gt.zero) then + ustar = ustarl + ro=lrho + uo=lvel + po=lpres + else if (ustarr.lt.zero) then + ustar = ustarr + ro=rrho + uo=rvel + po=rpres + else + ustar = 0 + striem(1)=0 + striem(2)=half*(ustarl+ustarr) + striem(3)=0 + goto 666 + endif + pstar = 0 + rstar = 0 + rstarl = 0 + rstarr = 0 + cstar = 0 + sein=-dsign( one ,ustar) + co=sqrt(po*gamma/ro) + wso=sein*uo+co + wsi=sein*ustar + if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t5*co + striem(1)=t5*ro + striem(2)=t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/gamma + endif + return + endif + +c----------------------------------------------------------------- +c CLASSIFY the problem by 1 and 3 waves +c shock= 1, rarefaction=2 + + px = lpres/rpres + if (px .lt. one ) then +rarefvel(cxr,px,temp)dnl + else +shockvel(cxr,px,temp)dnl + endif + if (lvel .gt. (rvel - temp)) then + leftwave = 1 + else + leftwave = 2 + endif + + + px = rpres/lpres + if (px .lt. one ) then +rarefvel(cxl,px,temp) + else +shockvel(cxl,px,temp) + endif + if ((lvel + temp) .gt. rvel ) then + rightwave = 1 + else + rightwave = 2 + endif + +c----------------------------------------------------------------- +c SOLVE RIEMANN PROBLEM + + if ((leftwave.eq.2).and.(rightwave.eq.1)) then +c LEFT RAREF , RIGHT SHOCK + pstar = rpres + pxl = pstar/lpres + pxr = pstar/rpres +rarefvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +derrvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + do it=1,9 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +rarefvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +derrvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*exp(log(pxl)/gamma) + rstarr = rrho*(1+beta*pxr)/(beta+pxr) + elseif ((leftwave.eq.1).and.(rightwave.eq.2)) then +c LEFT SHOCK ,RIGHT RAREF + pstar = lpres + pxl = pstar/lpres + pxr = pstar/rpres +shockvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +derrvel(cxr,pxr,dfright)dnl + do it=1,5 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +shockvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +derrvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*(1+beta*pxl)/(beta+pxl) + rstarr = rrho*exp(log(pxr)/gamma) + elseif ((leftwave.eq.1).and.(rightwave.eq.1)) then +c RIGHT SHOCK, LEFT SHOCK + pstar = max(rpres,lpres) + pxl = pstar/lpres + pxr = pstar/rpres +shockvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + do it=1,5 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +shockvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*(1+beta*pxl)/(beta+pxl) + rstarr = rrho*(1+beta*pxr)/(beta+pxr) + else +c RIGHT RAREF, LEFT RAREF + pstarl = exp(tau*log(lpres)) + pstarr = exp(tau*log(rpres)) + pstar = (half*(gamma-1)*(lvel-rvel)+cxl+cxr)/ + & (cxr/pstarr +cxl/pstarl) + pstar = exp(log(pstar)/tau) + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif + pstar=max(pstar,minpres ) + pxl = pstar/lpres + pxr = pstar/rpres +rarefvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*exp(log(pxl)/gamma) + rstarr = rrho*exp(log(pxr)/gamma) + endif + pstarl = pstar + pstarr = pstar + + ustar=half*(ustarl+ustarr) + +c----------------------------------------------------------------- +c PICK STATE FOR FLUXES + + sein=-dsign( one ,ustar) + if (sein.ge.zero) then + ro=rrho + uo=rvel + po=rpres + rstar =rstarr + else + ro=lrho + uo=lvel + po=lpres + rstar =rstarl + endif + cstar=sqrt(gamma*pstar/rstar) + dummy=pstar-po + if (dummy.ge.zero) then +c shock + wo=sqrt(gamma*ro*po*( one +gp1g2i*dummy/po)) + ushok=sein*ustar+wo/rstar + if (ushok.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else + striem(1)=ro + striem(2)=uo + striem(3)=po + endif + else +c rarefaction + co=sqrt(po*gamma/ro) + wso=sein*uo+co + wsi=sein*ustar+cstar + if (wsi.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t4*cstar+t5*co + striem(1)=t4*rstar+t5*ro + striem(2)=t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/gamma + endif + endif +c ------------------------------------------------------------------ +c write(6,*) "leaving riemnv" +c ------------------------------------------------------------------ + 666 return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp3d.i new file mode 100644 index 00000000..33d09504 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/gas1d_exactrp3d.i @@ -0,0 +1,354 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining routine to compute solution to +c Riemann problem in 3d. +c +define(rarefvel,`dnl + $3= ($1*two/(gamma-one))*(one- exp(log($2)*tau)) +')dnl + +define(shockvel,`dnl + $3= $1*alpha*(one-$2)/sqrt(1+ $2*beta) +')dnl + +define(derrvel,`dnl + $3= (two*tau*$1/(one-gamma))*exp(log($2)*(tau-one)) +')dnl + +define(dersvel,`dnl + $3= (-1)*$1*half*alpha*(two+beta*(one+$2)) + & /(sqrt(one+ $2*beta)*(one+ $2*beta)) +')dnl + +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine gas1dexactrp3d(gamma,minpres,wleft,wright,striem) +c*********************************************************************** +c description of arguments: +c input: +c wleft ==> left state +c wright ==> right state +c components ordered: density, vn, pressure +c output: +c striem (density,velocity,pressure) +c <== solution to riemann problem) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL wleft(3),wright(3),striem(3) + REAL gamma,minpres +c + REAL pstar,ustarl,ustarr,rstarl,rstarr + REAL px,pxl,pxr,pstarl,pstarr + REAL ustar,sein,ro,uo,po,co,wo + REAL feval,dfeval + REAL cxl,cxr + REAL dummy, rstar,cstar,wso,wsi,ushok,t4,t3,t5 + REAL gp1g2i,tau,beta,alpha + REAL lpres,lvel,lrho,rpres,rvel,rrho + REAL fleft,fright,dfleft,dfright,temp + integer it,leftwave,rightwave +c + tau=half*(gamma-one)/gamma + gp1g2i=half*(gamma+one)/gamma + alpha=sqrt(two/(gamma*(gamma-one))) + beta=(gamma+one)/(gamma-one) + lrho = wleft(1) + lvel = wleft(2) + lpres = wleft(3) + rrho = wright(1) + rvel = wright(2) + rpres = wright(3) + + temp = abs(lvel-rvel) + temp = max(abs(lpres-rpres),temp) + if (temp.lt.smallr) then + striem(2)=half*(lvel+rvel) + striem(3)=half*(lpres+rpres) + if (striem(2).gt.zero) then + striem(1)=lrho + else + striem(1)=rrho + endif + goto 666 + endif + + cxl = sqrt(gamma*lpres/lrho) + cxr = sqrt(gamma*rpres/rrho) + +c TERMINAL VELOCITIES + + ustarl = lvel + two*cxl/(gamma-1) + ustarr = rvel - two*cxr/(gamma-1) + + if (ustarl.lt.ustarr) then + write(6,*)" VACUUM in RS: " + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" vacuum vels ",ustarl,ustarr + if (ustarl.gt.zero) then + ustar = ustarl + ro=lrho + uo=lvel + po=lpres + else if (ustarr.lt.zero) then + ustar = ustarr + ro=rrho + uo=rvel + po=rpres + else + ustar = 0 + striem(1)=0 + striem(2)=half*(ustarl+ustarr) + striem(3)=0 + goto 666 + endif + pstar = 0 + rstar = 0 + rstarl = 0 + rstarr = 0 + cstar = 0 + sein=-dsign( one ,ustar) + co=sqrt(po*gamma/ro) + wso=sein*uo+co + wsi=sein*ustar + if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t5*co + striem(1)=t5*ro + striem(2)=t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/gamma + endif + return + endif + +c----------------------------------------------------------------- +c CLASSIFY the problem by 1 and 3 waves +c shock= 1, rarefaction=2 + + px = lpres/rpres + if (px .lt. one ) then +rarefvel(cxr,px,temp)dnl + else +shockvel(cxr,px,temp)dnl + endif + if (lvel .gt. (rvel - temp)) then + leftwave = 1 + else + leftwave = 2 + endif + + + px = rpres/lpres + if (px .lt. one ) then +rarefvel(cxl,px,temp) + else +shockvel(cxl,px,temp) + endif + if ((lvel + temp) .gt. rvel ) then + rightwave = 1 + else + rightwave = 2 + endif + +c----------------------------------------------------------------- +c SOLVE RIEMANN PROBLEM + + if ((leftwave.eq.2).and.(rightwave.eq.1)) then +c LEFT RAREF , RIGHT SHOCK + pstar = rpres + pxl = pstar/lpres + pxr = pstar/rpres +rarefvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +derrvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + do it=1,9 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +rarefvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +derrvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*exp(log(pxl)/gamma) + rstarr = rrho*(1+beta*pxr)/(beta+pxr) + elseif ((leftwave.eq.1).and.(rightwave.eq.2)) then +c LEFT SHOCK ,RIGHT RAREF + pstar = lpres + pxl = pstar/lpres + pxr = pstar/rpres +shockvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +derrvel(cxr,pxr,dfright)dnl + do it=1,5 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +shockvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +derrvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*(1+beta*pxl)/(beta+pxl) + rstarr = rrho*exp(log(pxr)/gamma) + elseif ((leftwave.eq.1).and.(rightwave.eq.1)) then +c RIGHT SHOCK, LEFT SHOCK + pstar = max(rpres,lpres) + pxl = pstar/lpres + pxr = pstar/rpres +shockvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + do it=1,5 + feval = lvel + fleft - rvel + fright + dfeval = dfleft/lpres + dfright/rpres + pstar = pstar -feval/dfeval + pxl = pstar/lpres + pxr = pstar/rpres + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif +shockvel(cxl,pxl,fleft)dnl +shockvel(cxr,pxr,fright)dnl +dersvel(cxl,pxl,dfleft)dnl +dersvel(cxr,pxr,dfright)dnl + enddo + pstar=max(pstar,minpres ) + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*(1+beta*pxl)/(beta+pxl) + rstarr = rrho*(1+beta*pxr)/(beta+pxr) + else +c RIGHT RAREF, LEFT RAREF + pstarl = exp(tau*log(lpres)) + pstarr = exp(tau*log(rpres)) + pstar = (half*(gamma-1)*(lvel-rvel)+cxl+cxr)/ + & (cxr/pstarr +cxl/pstarl) + pstar = exp(log(pstar)/tau) + if (pstar.lt.minpres) then + write(6,*)" pressure is too small or negative in + & exactsolver" + write(6,*)" left state ",lrho,lvel,lpres + write(6,*)" right state ",rrho,rvel,rpres + write(6,*)" lwave rwave = ",leftwave,rightwave + endif + pstar=max(pstar,minpres ) + pxl = pstar/lpres + pxr = pstar/rpres +rarefvel(cxl,pxl,fleft)dnl +rarefvel(cxr,pxr,fright)dnl + ustarl = lvel + fleft + ustarr = rvel - fright + rstarl = lrho*exp(log(pxl)/gamma) + rstarr = rrho*exp(log(pxr)/gamma) + endif + pstarl = pstar + pstarr = pstar + + ustar=half*(ustarl+ustarr) + +c----------------------------------------------------------------- +c PICK STATE FOR FLUXES + + sein=-dsign( one ,ustar) + if (sein.ge.zero) then + ro=rrho + uo=rvel + po=rpres + rstar =rstarr + else + ro=lrho + uo=lvel + po=lpres + rstar =rstarl + endif + cstar=sqrt(gamma*pstar/rstar) + dummy=pstar-po + if (dummy.ge.zero) then +c shock + wo=sqrt(gamma*ro*po*( one +gp1g2i*dummy/po)) + ushok=sein*ustar+wo/rstar + if (ushok.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else + striem(1)=ro + striem(2)=uo + striem(3)=po + endif + else +c rarefaction + co=sqrt(po*gamma/ro) + wso=sein*uo+co + wsi=sein*ustar+cstar + if (wsi.ge.zero) then + striem(1)=rstar + striem(2)=ustar + striem(3)=pstar + else if (wso.lt.zero) then + striem(1)=ro + striem(2)=uo + striem(3)=po + else + t4=(wso+wsi)/max(wso-wsi,wso+wsi,smallr) + t4= half *(t4+ one ) + t5= one -t4 + t3=t4*cstar+t5*co + striem(1)=t4*rstar+t5*ro + striem(2)=t4*ustar+t5*uo + striem(3)=t3*t3*striem(1)/gamma + endif + endif +c ------------------------------------------------------------------ +c write(6,*) "leaving riemnv" +c ------------------------------------------------------------------ + 666 return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad2d.m4 new file mode 100644 index 00000000..93009d5a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad2d.m4 @@ -0,0 +1,219 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradient compuation for 2d euler equations. +c +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine detectgrad2d( + & ifirst0,ilast0,ifirst1,ilast1, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & dx, + & gradtol, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ifirst1,ilast0,ilast1, + & dotag,donttag, + & vghost0,vghost1, + & tagghost0,tagghost1, + & ttagghost0,ttagghost1 + REAL + & dx(0:NDIM-1), + & gradtol +c variables indexed as 2dimensional + REAL + & var(CELL2dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL2dVECG(ifirst,ilast,tagghost)), + & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) +c + REAL tol + REAL facejump, loctol + REAL presm1,presp1,diag01 + logical tagcell + integer ic0,ic1 +c +c*********************************************************************** +c + tol = gradtol + diag01 = sqrt(dx(0)**2+dx(1)**2) + + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1) .ne. 0) then + loctol = 0.125*tol + else + loctol = tol + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1) + presp1 = var(ic0+1,ic1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(0))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1) + presp1 = var(ic0,ic1+1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(1))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1) + presp1 = var(ic0+1,ic1+1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*diag01)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1) + presp1 = var(ic0+1,ic1-1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*diag01)) + endif + + if ( tagcell ) then + temptags(ic0,ic1) = dotag + endif + enddo + enddo + return + end + + subroutine detectshock2d( + & ifirst0,ilast0,ifirst1,ilast1, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & dx, + & gradtol,gradonset, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ifirst1,ilast0,ilast1, + & dotag,donttag, + & vghost0,vghost1, + & tagghost0,tagghost1, + & ttagghost0,ttagghost1 + REAL + & dx(0:NDIM-1), + & gradtol,gradonset +c variables indexed as 2dimensional + REAL + & var(CELL2dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL2dVECG(ifirst,ilast,tagghost)), + & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) +c + REAL tol,onset + REAL jump1, jump2, facejump, loctol,locon + REAL presm1,presm2,presp1,presp2 + REAL diag01 + logical tagcell + integer ic0,ic1 +c +c*********************************************************************** +c + tol = gradtol + onset = gradonset + diag01 = sqrt(dx(0)**2+dx(1)**2) + + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1) .ne. 0) then + loctol = 0.125*tol + locon = 0.66*onset + else + loctol = tol + locon = onset + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1) + presm2 = var(ic0-2,ic1) + presp1 = var(ic0+1,ic1) + presp2 = var(ic0+2,ic1) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(0)))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1) + presm2 = var(ic0,ic1-2) + presp1 = var(ic0,ic1+1) + presp2 = var(ic0,ic1+2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(1)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1) + presp1 = var(ic0+1,ic1+1) + presm2 = var(ic0-2,ic1-2) + presp2 = var(ic0+2,ic1+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag01))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1) + presp1 = var(ic0+1,ic1-1) + presm2 = var(ic0-2,ic1+2) + presp2 = var(ic0+2,ic1-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag01))) + endif + + if ( tagcell ) then + temptags(ic0,ic1) = dotag + endif + enddo + enddo + return + end + + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad3d.m4 new file mode 100644 index 00000000..01c52a6e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/grad3d.m4 @@ -0,0 +1,431 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradient compuation for 3d euler equations. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine detectgrad3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & vghost2,tagghost2,ttagghost2, + & dx, + & gradtol, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dotag,donttag, + & vghost0,vghost1,vghost2, + & tagghost0,tagghost1,tagghost2, + & ttagghost0,ttagghost1,ttagghost2 + REAL + & dx(0:NDIM-1), + & gradtol +c variables indexed as 3dimensional + REAL + & var(CELL3dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL3dVECG(ifirst,ilast,tagghost)), + & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) +c + REAL tol + REAL facejump, loctol + REAL presm1,presp1 + REAL diag(0:NDIM-1),diag012 + logical tagcell + integer ic0,ic1,ic2 +c +c*********************************************************************** +c + tol = gradtol + diag(0) = sqrt(dx(2)**2+dx(1)**2) + diag(1) = sqrt(dx(0)**2+dx(2)**2) + diag(2) = sqrt(dx(0)**2+dx(1)**2) + diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) + + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1,ic2) .ne. 0) then + loctol = 0.125*tol + else + loctol = tol + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1,ic2) + presp1 = var(ic0+1,ic1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(0))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2) + presp1 = var(ic0,ic1+1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(1))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1,ic2-1) + presp1 = var(ic0,ic1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(2))) + endif + + +c 2Dimensional diagonals + + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2-1) + presp1 = var(ic0,ic1+1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(0))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1+1,ic2-1) + presp1 = var(ic0,ic1-1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(0))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2-1) + presp1 = var(ic0+1,ic1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(1))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2+1) + presp1 = var(ic0+1,ic1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(1))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2) + presp1 = var(ic0+1,ic1+1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(2))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2) + presp1 = var(ic0+1,ic1-1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(2))) + endif + +c End 2Dimensional diagonals +c 3Dimensional diagonals + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2-1) + presp1 = var(ic0+1,ic1+1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2+1) + presp1 = var(ic0+1,ic1+1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2-1) + presp1 = var(ic0+1,ic1-1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2+1) + presp1 = var(ic0+1,ic1-1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + +c End 3Dimensional diagonals + + if ( tagcell ) then + temptags(ic0,ic1,ic2) = dotag + endif + enddo + enddo + enddo + return + end + + subroutine detectshock3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & vghost2,tagghost2,ttagghost2, + & dx, + & gradtol,gradonset, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dotag,donttag, + & vghost0,vghost1,vghost2, + & tagghost0,tagghost1,tagghost2, + & ttagghost0,ttagghost1,ttagghost2 + REAL + & dx(0:NDIM-1), + & gradtol,gradonset +c variables indexed as 3dimensional + REAL + & var(CELL3dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL3dVECG(ifirst,ilast,tagghost)), + & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) +c + REAL tol,onset + REAL jump1, jump2, facejump, loctol,locon + REAL presm1,presm2,presp1,presp2 + REAL diag(0:NDIM-1),diag012 + logical tagcell + integer ic0,ic1,ic2 +c +c*********************************************************************** +c + tol = gradtol + onset = gradonset + diag(0) = sqrt(dx(2)**2+dx(1)**2) + diag(1) = sqrt(dx(0)**2+dx(2)**2) + diag(2) = sqrt(dx(0)**2+dx(1)**2) + diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) + + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1,ic2) .ne. 0) then + loctol = 0.125*tol + locon = 0.66*onset + else + loctol = tol + locon = onset + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1,ic2) + presm2 = var(ic0-2,ic1,ic2) + presp1 = var(ic0+1,ic1,ic2) + presp2 = var(ic0+2,ic1,ic2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(0)))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2) + presm2 = var(ic0,ic1-2,ic2) + presp1 = var(ic0,ic1+1,ic2) + presp2 = var(ic0,ic1+2,ic2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(1)))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1,ic2-1) + presm2 = var(ic0,ic1,ic2-2) + presp1 = var(ic0,ic1,ic2+1) + presp2 = var(ic0,ic1,ic2+2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(2)))) + endif + + +c 2Dimensional diagonals + + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2-1) + presp1 = var(ic0,ic1+1,ic2+1) + presm2 = var(ic0,ic1-2,ic2-2) + presp2 = var(ic0,ic1+2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(0)))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1+1,ic2-1) + presp1 = var(ic0,ic1-1,ic2+1) + presm2 = var(ic0,ic1+2,ic2-2) + presp2 = var(ic0,ic1-2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(0)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2-1) + presp1 = var(ic0+1,ic1,ic2+1) + presm2 = var(ic0-2,ic1,ic2-2) + presp2 = var(ic0+2,ic1,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(1)))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2+1) + presp1 = var(ic0+1,ic1,ic2-1) + presm2 = var(ic0-2,ic1,ic2+2) + presp2 = var(ic0+2,ic1,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(1)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2) + presp1 = var(ic0+1,ic1+1,ic2) + presm2 = var(ic0-2,ic1-2,ic2) + presp2 = var(ic0+2,ic1+2,ic2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(2)))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2) + presp1 = var(ic0+1,ic1-1,ic2) + presm2 = var(ic0-2,ic1+2,ic2) + presp2 = var(ic0+2,ic1-2,ic2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(2)))) + endif + +c End 2Dimensional diagonals +c 3Dimensional diagonals + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2-1) + presp1 = var(ic0+1,ic1+1,ic2+1) + presm2 = var(ic0-2,ic1-2,ic2-2) + presp2 = var(ic0+2,ic1+2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2+1) + presp1 = var(ic0+1,ic1+1,ic2-1) + presm2 = var(ic0-2,ic1-2,ic2+2) + presp2 = var(ic0+2,ic1+2,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2-1) + presp1 = var(ic0+1,ic1-1,ic2+1) + presm2 = var(ic0-2,ic1+2,ic2-2) + presp2 = var(ic0+2,ic1-2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2+1) + presp1 = var(ic0+1,ic1-1,ic2-1) + presm2 = var(ic0-2,ic1+2,ic2+2) + presp2 = var(ic0+2,ic1-2,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + +c End 3Dimensional diagonals + + if ( tagcell ) then + temptags(ic0,ic1,ic2) = dotag + endif + enddo + enddo + enddo + return + end + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init2d.m4 new file mode 100644 index 00000000..24db4629 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init2d.m4 @@ -0,0 +1,183 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization of 2d euler equations. +c +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine eulerinit2d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1, + & gcw0,gcw1, + & gamma, + & density,velocity,pressure, + & nintervals,front, + & i_dens,i_vel,i_pres) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer gcw0,gcw1 + integer data_problem + integer nintervals + REAL front(1:nintervals) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) + REAL i_dens(1:nintervals), + & i_vel(0:NDIM-1,1:nintervals), + & i_pres(1:nintervals) +c variables in 2d cell indexed + REAL + & density(CELL2dVECG(ifirst,ilast,gcw)), + & velocity(CELL2dVECG(ifirst,ilast,gcw),0:NDIM-1), + & pressure(CELL2dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,dir,ifr + REAL xc(0:NDIM-1) + REAL gamma +c +c dir 0 two linear states (L,R) indp of y,z +c dir 1 two linear states (L,R) indp of x,z + +c write(6,*) "Inside eulerinit" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "PIECEWISE_CONSTANT_X= ",PIECEWISE_CONSTANT_X +c write(6,*) "STEP = ",STEP +c write(6,*) "PIECEWISE_CONSTANT_Y= ",PIECEWISE_CONSTANT_Y +c write(6,*) "dx= ",dx(0), dx(1) +c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) +c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,"and ",ifirst1,ilast1 +c write(6,*) "gamma= ",gamma +c call flush(6) + + dir = 0 + if (data_problem.eq.PIECEWISE_CONSTANT_X) then + dir = 0 + else if (data_problem.eq.STEP) then + dir = 0 + else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then + dir = 1 + endif + + if (dir.eq.0) then + ifr = 1 + do ic0=ifirst0,ilast0 + xc(0) = xlo(0) + dx(0)*(dble(ic0-ifirst0)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + density(ic0,ic1) = i_dens(ifr) + velocity(ic0,ic1,0) = i_vel(0,ifr) + velocity(ic0,ic1,1) = i_vel(1,ifr) + pressure(ic0,ic1) = i_pres(ifr) + enddo + enddo + else if (dir.eq.1) then + ifr = 1 + do ic1=ifirst1,ilast1 + xc(1) =xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic0=ifirst0,ilast0 + density(ic0,ic1) = i_dens(ifr) + velocity(ic0,ic1,0) = i_vel(0,ifr) + velocity(ic0,ic1,1) = i_vel(1,ifr) + pressure(ic0,ic1) = i_pres(ifr) + enddo + enddo + endif +c + return + end +c*********************************************************************** +c +c Initialization routine where we use a spherical profile +c +c*********************************************************************** + subroutine eulerinitsphere2d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1, + & gcw0,gcw1, + & gamma, + & density,velocity,pressure, + & i_dens,i_vel,i_pres, + & o_dens,o_vel,o_pres, + & center,radius) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer gcw0,gcw1 + integer data_problem + REAL i_dens,i_vel(0:NDIM-1),i_pres, + & o_dens,o_vel(0:NDIM-1),o_pres + REAL center(0:NDIM-1),radius + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma +c variables in 2d cell indexed + REAL + & density(CELL2dVECG(ifirst,ilast,gcw)), + & velocity(CELL2dVECG(ifirst,ilast,gcw),0:NDIM-1), + & pressure(CELL2dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1 + REAL xc(0:NDIM-1),x0,x1 + REAL angle +c +c write(6,*) "Inside eulerinitsphere" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1) +c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) +c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,ifirst1,ilast1 +c write(6,*) "gamma= ",gamma +c write(6,*) "radius= ",radius +c write(6,*) "center= ",center(0),center(1) +c call flush(6) + + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + x1 = xc(1)-center(1) + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + x0 = xc(0)-center(0) + if (x1.eq.zero .and. x0.eq.zero) then + angle = zero + else + angle = atan2(x1,x0) + endif + if ((x0**2+x1**2).lt.radius**2) then + density(ic0,ic1) = i_dens + velocity(ic0,ic1,0) = i_vel(0)*cos(angle) + velocity(ic0,ic1,1) = i_vel(1)*sin(angle) + pressure(ic0,ic1) = i_pres + else + density(ic0,ic1) = o_dens + velocity(ic0,ic1,0) = o_vel(0)*cos(angle) + velocity(ic0,ic1,1) = o_vel(1)*sin(angle) + pressure(ic0,ic1) = o_pres + endif +c write(6,*) "cell, state = ",ic0,ic1, density(ic0,ic1), +c & pressure(ic0,ic1),velocity(ic0,ic1,0),velocity(ic0,ic1,1) +c call flush(6) + enddo + enddo +c + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init3d.m4 new file mode 100644 index 00000000..edbca09f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/init3d.m4 @@ -0,0 +1,219 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization of 3d euler equations. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine eulerinit3d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gcw0,gcw1,gcw2, + & gamma, + & density,velocity,pressure, + & nintervals,front, + & i_dens,i_vel,i_pres) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer gcw0,gcw1,gcw2 + integer data_problem + integer nintervals + REAL front(1:nintervals) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma + REAL i_dens(1:nintervals), + & i_vel(0:NDIM-1,1:nintervals), + & i_pres(1:nintervals) +c variables in 3d cell indexed + REAL + & density(CELL3dVECG(ifirst,ilast,gcw)), + & velocity(CELL3dVECG(ifirst,ilast,gcw),0:NDIM-1), + & pressure(CELL3dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,dir,ifr + REAL xc(0:NDIM-1) +c +c dir 0 two linear states (L,R) indp of y,z +c dir 1 two linear states (L,R) indp of x,z +c dir 2 two linear states (L,R) indp of x,y + +c write(6,*) "Inside eulerinit" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1), dx(2) +c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) +c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) +c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 +c write(6,*) "ilast= ",ilast0,ilast1,ilast2 +c write(6,*) "gamma= ",gamma +c call flush(6) + + dir = 0 + if (data_problem.eq.PIECEWISE_CONSTANT_X) then + dir = 0 + else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then + dir = 1 + else if (data_problem.eq.PIECEWISE_CONSTANT_Z) then + dir = 2 + endif + + if (dir.eq.0) then + ifr = 1 + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+ dx(0)*(dble(ic0-ifirst0)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + do ic2=ifirst2,ilast2 + density(ic0,ic1,ic2) = i_dens(ifr) + velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) + velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) + velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) + pressure(ic0,ic1,ic2) = i_pres(ifr) + enddo + enddo + enddo + else if (dir.eq.1) then + ifr = 1 + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic2=ifirst2,ilast2 + do ic0=ifirst0,ilast0 + density(ic0,ic1,ic2) = i_dens(ifr) + velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) + velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) + velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) + pressure(ic0,ic1,ic2) = i_pres(ifr) + enddo + enddo + enddo + else if (dir.eq.2) then + ifr = 1 + do ic2=ifirst2,ilast2 + xc(2) = xlo(2)+ dx(2)*(dble(ic2-ifirst2)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + density(ic0,ic1,ic2) = i_dens(ifr) + velocity(ic0,ic1,ic2,0) = i_vel(0,ifr) + velocity(ic0,ic1,ic2,1) = i_vel(1,ifr) + velocity(ic0,ic1,ic2,2) = i_vel(2,ifr) + pressure(ic0,ic1,ic2) = i_pres(ifr) + enddo + enddo + enddo + endif +c + return + end +c +c*********************************************************************** +c +c Initialization routine where we use a spherical profile +c +c*********************************************************************** + subroutine eulerinitsphere3d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gcw0,gcw1,gcw2, + & gamma, + & density,velocity,pressure, + & i_dens,i_vel,i_pres, + & o_dens,o_vel,o_pres, + & center,radius) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer gcw0,gcw1,gcw2 + integer data_problem + REAL i_dens,i_vel(0:NDIM-1),i_pres, + & o_dens,o_vel(0:NDIM-1),o_pres + REAL center(0:NDIM-1),radius +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1),gamma +c variables in 2d cell indexed + REAL + & density(CELL3dVECG(ifirst,ilast,gcw)), + & velocity(CELL3dVECG(ifirst,ilast,gcw),0:NDIM-1), + & pressure(CELL3dVECG(ifirst,ilast,gcw)) +c +c********************************************************************** +c + integer ic0,ic1,ic2 + REAL xc(0:NDIM-1) + REAL angle,phi,rad2,rad3,x0,x1,x2 +c +c write(6,*) "Inside eulerinitsphere" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1), dx(2) +c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) +c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) +c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 +c write(6,*) "ilast= ",ilast0,ilast1,ilast2 +c write(6,*) "gamma= ",gamma +c write(6,*) "front= ",front(0),front(1),front(2),front(3) +c write(6,*) " = ",front(4),front(5) +c call flush(6) + + do ic2=ifirst2,ilast2 + xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) + x2 = xc(2)-center(2) + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + x1 = xc(1)-center(1) + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + x0 = xc(0)-center(0) + if (x1.eq.zero .and. x0.eq.zero) then + angle = zero + else + angle = atan2(x1,x0) + endif + rad2 = sqrt(x0**2+x1**2) + if (rad2.eq.zero .and. x2.eq.zero) then + phi = zero + else + phi = atan2(rad2,x2) + endif + rad3 = sqrt(rad2**2+x2**2) + if (rad3.lt.radius) then + density(ic0,ic1,ic2) = i_dens + velocity(ic0,ic1,ic2,0)= i_vel(0)*sin(phi)*cos(angle) + velocity(ic0,ic1,ic2,1)= i_vel(1)*sin(phi)*sin(angle) + velocity(ic0,ic1,ic2,2)= i_vel(2)*cos(phi) + pressure(ic0,ic1,ic2) = i_pres + else + density(ic0,ic1,ic2) = o_dens + velocity(ic0,ic1,ic2,0)= o_vel(0)*sin(phi)*cos(angle) + velocity(ic0,ic1,ic2,1)= o_vel(1)*sin(phi)*sin(angle) + velocity(ic0,ic1,ic2,2)= o_vel(2)*cos(phi) + pressure(ic0,ic1,ic2) = o_pres + endif + enddo + enddo + enddo + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux2d.i new file mode 100644 index 00000000..aa22121f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux2d.i @@ -0,0 +1,274 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for flux computation in 2d. +c +define(riemann_solve,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt +c write(6,*) " calculating flux$1, 1+extra_cell= ",$3 +c write(6,*) " ic$2=",ifirst$2-1-$3,ilast$2+1+$3 +c write(6,*) " ie$1=",ifirst$1-1-$3,ilast$1+1+1+$3 + + if (rpchoice.eq.APPROX_RIEM_SOLVE + & .or. rpchoice.eq.EXACT_RIEM_SOLVE ) then + + do ic$2=ifirst$2-$3, + & ilast$2+$3 + do ie$1=ifirst$1-$3, + & ilast$1+1+$3 + +c ************************************************************ +c * Assign left and right states. Note only normal vel used. +c ************************************************************ + stateL(1) = trlft$1(ie$1,ic$2,1) + stateL(2) = trlft$1(ie$1,ic$2,2+$1) + stateL(3) = trlft$1(ie$1,ic$2,NEQU) + + stateR(1) = trrgt$1(ie$1,ic$2,1) + stateR(2) = trrgt$1(ie$1,ic$2,2+$1) + stateR(3) = trrgt$1(ie$1,ic$2,NEQU) + + if (rpchoice.eq.APPROX_RIEM_SOLVE) then + call gas1dapproxrp2d(gamma,stateL,stateR,riemst) + else + call gas1dexactrp2d(gamma,smallr,stateL,stateR,riemst) + endif + + if (riemst(2).le.zero) then + vel_tan=trrgt$1(ie$1,ic$2,2+$2) + else + vel_tan=trlft$1(ie$1,ic$2,2+$2) + endif + + mom$1=riemst(1)*riemst(2) + v2norm = riemst(2)**2+vel_tan**2 + Hent = riemst(3)/gam_min_one + v2norm*riemst(1)/two + + flux$1(ie$1,ic$2,1)= dt*mom$1 + flux$1(ie$1,ic$2,2+$1)= dt*(riemst(3)+mom$1*riemst(2)) + flux$1(ie$1,ic$2,2+$2)= dt*mom$1*vel_tan + flux$1(ie$1,ic$2,NEQU)= dt*riemst(2)*(Hent+riemst(3)) + + enddo + enddo + + elseif (rpchoice.eq.HLLC_RIEM_SOLVE) then + + do ic$2=ifirst$2-$3, + & ilast$2+$3 + do ie$1=ifirst$1-$3, + & ilast$1+1+$3 + +c ************************************************************ +c * Assign left and right states. +c * Note all vel comps used for Roe average. +c ************************************************************ + do j=1,NEQU + stateL(j) = trlft$1(ie$1,ic$2,j) + stateR(j) = trrgt$1(ie$1,ic$2,j) + enddo + +c ************************************************************ +c * Calculate bounding signal speeds. To do this, need the +c * Roe-average of the velocity and sound speed. +c ************************************************************ + w = one / ( one + sqrt( stateR(1)/stateL(1) ) ) + omw = one - w + hat(2+$1) = w*stateL(2+$1) + omw*stateR(2+$1) + aLsq = gamma * stateL(NEQU) / stateL(1) + aRsq = gamma * stateR(NEQU) / stateR(1) + hat(NEQU+1) = sqrt( w*aLsq + omw*aRsq + & + half*gam_min_one*w*omw*( + & (stateR(2)-stateL(2))**2 + & + (stateR(3)-stateL(3))**2 ) ) + + sL = min(stateL(2+$1) - sqrt(aLsq), hat(2+$1) - hat(NEQU+1)) + sR = max(stateR(2+$1) + sqrt(aRsq), hat(2+$1) + hat(NEQU+1)) + mfL = stateL(1) * ( sL - stateL(2+$1) ) + mfR = stateR(1) * ( sR - stateR(2+$1) ) + sM = ( stateR(NEQU) - stateL(NEQU) + & + mfL*stateL(2+$1) - mfR*stateR(2+$1) ) / ( mfL - mfR ) + +c ************************************************************ +c * Calculate flux starting at upwind state. +c ************************************************************ + if ( sM.gt.zero ) then + +c ********************************************************* +c * Flow is to the right; start from left state. +c ********************************************************* + flux(1) = stateL(1) * stateL(2+$1) + flux(2+$1) = flux(1) * stateL(2+$1) + stateL(NEQU) + flux(3-$1) = flux(1) * stateL(3-$1) + keL = half * (stateL(2)**2 + stateL(3)**2) + flux(NEQU) = flux(1) * (aLsq / gam_min_one + keL) + +c ********************************************************* +c * Check if flow is subsonic. +c ********************************************************* + if ( sL.lt.zero ) then + +c ****************************************************** +c * Add contribution from left acoustic wave. +c ****************************************************** + denom = one / (sL-sM) + star(1) = stateL(1) * (sL-stateL(2+$1)) * denom + star(2+$1) = sM + star(3-$1) = stateL(3-$1) + star(NEQU) = stateL(NEQU)*( one + gamma * denom + & * ( sM-stateL(2+$1) ) ) + & + half * gam_min_one + & * star(1) * ( sM-stateL(2+$1) )**2 + + diff(1) = star(1) - stateL(1) + diff(2) = star(1)*star(2) - stateL(1)*stateL(2) + diff(3) = star(1)*star(3) - stateL(1)*stateL(3) + diff(NEQU) = ( star(NEQU)-stateL(NEQU) ) + & / gam_min_one + & + half * star(1) * (star(2)**2 + star(3)**2) + & - stateL(1) * keL + + do j=1,NEQU + flux(j) = flux(j) + sL*diff(j) + enddo + + endif + + else + +c ********************************************************* +c * Flow is to the left; start from right state. +c ********************************************************* + flux(1) = stateR(1) * stateR(2+$1) + flux(2+$1) = flux(1) * stateR(2+$1) + stateR(NEQU) + flux(3-$1) = flux(1) * stateR(3-$1) + keR = half * (stateR(2)**2 + stateR(3)**2) + flux(NEQU) = flux(1) * (aRsq / gam_min_one + keR) + +c ********************************************************* +c * Check if flow is subsonic. +c ********************************************************* + if ( sR.gt.zero ) then + +c ****************************************************** +c * Add contribution from right acoustic wave. +c ****************************************************** + denom = one / (sR-sM) + star(1) = stateR(1) * (sR-stateR(2+$1)) * denom + star(2+$1) = sM + star(3-$1) = stateR(3-$1) + star(NEQU) = stateR(NEQU) * (1 + gamma * denom + & * ( sM-stateR(2+$1) ) ) + & + half * gam_min_one + & * star(1) * ( sM-stateR(2+$1) )**2 + + diff(1) = star(1) - stateR(1) + diff(2) = star(1)*star(2) - stateR(1)*stateR(2) + diff(3) = star(1)*star(3) - stateR(1)*stateR(3) + diff(NEQU) = ( star(NEQU)-stateR(NEQU) ) + & / gam_min_one + & + half * star(1) * (star(2)**2 + star(3)**2) + & - stateR(1) * keR + + do j=1,NEQU + flux(j) = flux(j) + sR*diff(j) + enddo + + endif + + endif + +c ************************************************************ +c * Assign average interface fluxes. +c ************************************************************ + do j=1,NEQU + flux$1(ie$1,ic$2,j) = dt * flux(j) + enddo + + enddo + enddo + + endif +')dnl +define(artificial_viscosity1,`dnl + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + do ie$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG) + maxeig =trrgt$1(ie$1,ic$2,4)-trlft$1(ie$1,ic$2,4) + vcoef = tenth*abs(maxeig) + + mom0L=trlft$1(ie$1,ic$2,1)*trlft$1(ie$1,ic$2,2) + mom1L=trlft$1(ie$1,ic$2,1)*trlft$1(ie$1,ic$2,3) + v2norm = mom1L**2+mom0L**2 + enerL=trlft$1(ie$1,ic$2,NEQU)/gam_min_one+ + & v2norm/(trlft$1(ie$1,ic$2,1)*two) + mom0R=trrgt$1(ie$1,ic$2,1)*trrgt$1(ie$1,ic$2,2) + mom1R=trrgt$1(ie$1,ic$2,1)*trrgt$1(ie$1,ic$2,3) + v2norm = mom1R**2+mom0R**2 + enerR=trrgt$1(ie$1,ic$2,NEQU)/gam_min_one+ + & v2norm/(trrgt$1(ie$1,ic$2,1)*two) + + vcorr(1) = dt*vcoef* + & (trrgt$1(ie$1,ic$2,1)-trlft$1(ie$1,ic$2,1)) + vcorr(2) = dt*vcoef*(mom0R-mom0L) + vcorr(3) = dt*vcoef*(mom1R-mom1L) + vcorr(NEQU) = dt*vcoef*(enerR-enerL) + do j=1,NEQU + flux$1(ie$1,ic$2,j)= flux$1(ie$1,ic$2,j) + & -vcorr(j) + enddo + enddo + enddo +')dnl +define(artificial_viscosity2,`dnl + do ic1=ifirst1-(FLUXG-1),ilast1+(FLUXG-1) + do ie0=ifirst0-(FLUXG-1),ilast0+(FLUXG) + maxeig =pressure(ie0,ic1)-pressure(ie0-1,ic1) + vcoef = tenth*abs(maxeig) + mom0L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,0) + mom1L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,1) + mom0R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,0) + mom1R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,1) + v2norm = mom1L**2+mom0L**2 + enerL=pressure(ie0-1,ic1)/gam_min_one+ + & v2norm/(density(ie0-1,ic1)*two) + v2norm = mom1R**2+mom0R**2 + enerR=pressure(ie0,ic1)/gam_min_one+ + & v2norm/(density(ie0,ic1)*two) + vcorr1= dt*vcoef*(density(ie0,ic1)-density(ie0-1,ic1)) + vcorr2= dt*vcoef*(mom0R-mom0L) + vcorr3= dt*vcoef*(mom1R-mom1L) + vcorr4= dt*vcoef*(enerR-enerL) + flux0(ie0,ic1,1)= flux0(ie0,ic1,1) - vcorr1 + flux0(ie0,ic1,2)= flux0(ie0,ic1,2) - vcorr2 + flux0(ie0,ic1,3)= flux0(ie0,ic1,3) - vcorr3 + flux0(ie0,ic1,4)= flux0(ie0,ic1,4) - vcorr4 + enddo + enddo + do ic0=ifirst0,ilast0 + do ie1=ifirst1,ilast1+1 + maxeig =pressure(ic0,ie1)-pressure(ic0-1,ie1) + vcoef = tenth*abs(maxeig) + mom0L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,0) + mom1L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,1) + mom0R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,0) + mom1R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,1) + v2norm = mom1L**2+mom0L**2 + enerL=pressure(ic0,ie1-1)/gam_min_one+ + & v2norm/(density(ic0,ie1-1)*two) + v2norm = mom1R**2+mom0R**2 + enerR=pressure(ic0,ie1)/gam_min_one+ + & v2norm/(density(ic0,ie1)*two) + vcorr1= dt*vcoef*(density(ic0,ie1)-density(ic0,ie1-1)) + vcorr2= dt*vcoef*(mom0R-mom0L) + vcorr3= dt*vcoef*(mom1R-mom1L) + vcorr4= dt*vcoef*(enerR-enerL) + flux1(ie1,ic0,1)= flux1(ie1,ic0,1) - vcorr1 + flux1(ie1,ic0,2)= flux1(ie1,ic0,2) - vcorr2 + flux1(ie1,ic0,3)= flux1(ie1,ic0,3) - vcorr3 + flux1(ie1,ic0,4)= flux1(ie1,ic0,4) - vcorr4 + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux3d.i new file mode 100644 index 00000000..289871a0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4flux3d.i @@ -0,0 +1,371 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for flux computation in 3d. +c +define(riemann_solve,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt + + if (rpchoice.eq.APPROX_RIEM_SOLVE + & .or. rpchoice.eq.EXACT_RIEM_SOLVE ) then +c ************************************************************ +c * Approximate Riemann solver and exact Riemann solver have +c * identical setup and post-process phases. +c ************************************************************ + + do ic$3=ifirst$3-$6,ilast$3+$6 + do ic$2=ifirst$2-$5,ilast$2+$5 + do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) + +c ************************************************************ +c * Assign left and right states. Note only normal vel used. +c ************************************************************ + stateL(1) = trlft$1(ie$1,$4,1) + stateL(2) = trlft$1(ie$1,$4,2+$1) + stateL(3) = trlft$1(ie$1,$4,NEQU) + + stateR(1) = trrgt$1(ie$1,$4,1) + stateR(2) = trrgt$1(ie$1,$4,2+$1) + stateR(3) = trrgt$1(ie$1,$4,NEQU) + + if (rpchoice.eq.APPROX_RIEM_SOLVE) then + call gas1dapproxrp3d(gamma,stateL,stateR,riemst) + else if (rpchoice.eq.EXACT_RIEM_SOLVE) then + call gas1dexactrp3d(gamma,smallr,stateL,stateR,riemst) + endif + + if (riemst(2).le.zero) then + vel($2)=trrgt$1(ie$1,$4,2+$2) + vel($3)=trrgt$1(ie$1,$4,2+$3) + else + vel($2)=trlft$1(ie$1,$4,2+$2) + vel($3)=trlft$1(ie$1,$4,2+$3) + endif + vel($1)=riemst(2) + + mom$1 =riemst(1)*vel($1) + v2norm = vel(0)**2+vel(1)**2+vel(2)**2 + Hent =riemst(3)/gam_min_one+v2norm*riemst(1)/two + + flux$1(ie$1,$4,1)= dt*mom$1 + flux$1(ie$1,$4,2+$1)= dt*(mom$1*vel($1)+riemst(3)) + flux$1(ie$1,$4,2+$2)= dt*mom$1*vel($2) + flux$1(ie$1,$4,2+$3)= dt*mom$1*vel($3) + flux$1(ie$1,$4,5)= dt*riemst(2)*(Hent+riemst(3)) + + enddo + enddo + enddo + + elseif (rpchoice.eq.HLLC_RIEM_SOLVE) then +c ****************************************************************** +c * HLLC Riemann Solver +c ****************************************************************** + + do ic$3=ifirst$3-$6,ilast$3+$6 + do ic$2=ifirst$2-$5,ilast$2+$5 + do ie$1=ifirst$1-(FLUXG-1),ilast$1+1+(FLUXG-1) + +c ************************************************************ +c * Assign left and right states. +c ************************************************************ + do j=1,NEQU + stateL(j) = trlft$1(ie$1,$4,j) + stateR(j) = trrgt$1(ie$1,$4,j) + enddo + +c ************************************************************ +c * Calculate bounding signal speeds. To do this, need the +c * Roe-average of the velocity and sound speed. +c ************************************************************ + w = one / ( one + sqrt( stateR(1)/stateL(1) ) ) + omw = one - w + hat(2+$1) = w*stateL(2+$1) + omw*stateR(2+$1) + aLsq = gamma * stateL(NEQU) / stateL(1) + aRsq = gamma * stateR(NEQU) / stateR(1) + hat(NEQU+1) = sqrt( w*aLsq + omw*aRsq + & + half*gam_min_one*w*omw*( + & (stateR(2)-stateL(2))**2 + & + (stateR(3)-stateL(3))**2 + & + (stateR(4)-stateL(4))**2 ) ) + + sL = min( stateL(2+$1) - sqrt(aLsq), + & hat(2+$1) - hat(NEQU+1) ) + sR = max( stateR(2+$1) + sqrt(aRsq), + & hat(2+$1) + hat(NEQU+1) ) + mfL = stateL(1) * ( sL - stateL(2+$1) ) + mfR = stateR(1) * ( sR - stateR(2+$1) ) + sM = ( stateR(NEQU) - stateL(NEQU) + & + mfL*stateL(2+$1) - mfR*stateR(2+$1) )/(mfL-mfR) + +c ************************************************************ +c * Calculate flux starting at upwind state. +c ************************************************************ + if ( sM.gt.zero ) then + +c ********************************************************* +c * Flow is to the right; start from left state. +c ********************************************************* + flux(1) = stateL(1) * stateL(2+$1) + flux(2+$1) = flux(1) * stateL(2+$1) + stateL(NEQU) + flux(2+$2) = flux(1) * stateL(2+$2) + flux(2+$3) = flux(1) * stateL(2+$3) + keL = half * (stateL(2)**2 + stateL(3)**2 + + & stateL(4)**2) + flux(NEQU) = flux(1) + & * (aLsq / gam_min_one + keL) + +c ********************************************************* +c * Check if flow is subsonic. +c ********************************************************* + if ( sL.lt.zero ) then + +c ****************************************************** +c * Add contribution from left acoustic wave. +c ****************************************************** + denom = one / (sL-sM) + star(1) = stateL(1) * (sL-stateL(2+$1)) * denom + star(2+$1) = sM + star(2+$2) = stateL(2+$2) + star(2+$3) = stateL(2+$3) + star(NEQU) = stateL(NEQU)*( one + gamma * denom + & * ( sM-stateL(2+$1) ) ) + & + half * gam_min_one + & * star(1) * ( sM-stateL(2+$1) )**2 + + diff(1) = star(1) - stateL(1) + diff(2) = star(1)*star(2) - stateL(1)*stateL(2) + diff(3) = star(1)*star(3) - stateL(1)*stateL(3) + diff(4) = star(1)*star(4) - stateL(1)*stateL(4) + diff(NEQU) = ( star(NEQU)-stateL(NEQU) ) + & / gam_min_one + & + half * star(1) * + & (star(2)**2 + star(3)**2+ star(4)**2) + & - stateL(1) * keL + + do j=1,NEQU + flux(j) = flux(j) + sL*diff(j) + enddo + + endif + + else + +c ********************************************************* +c * Flow is to the left; start from right state. +c ********************************************************* + flux(1) = stateR(1) * stateR(2+$1) + flux(2+$1) = flux(1) * stateR(2+$1) + stateR(NEQU) + flux(2+$2) = flux(1) * stateR(2+$2) + flux(2+$3) = flux(1) * stateR(2+$3) + keR = half * (stateR(2)**2 + stateR(3)**2 + + & stateR(4)**2) + flux(NEQU) = flux(1) + & * (aRsq / gam_min_one + keR) + +c ********************************************************* +c * Check if flow is subsonic. +c ********************************************************* + if ( sR.gt.zero ) then + +c ****************************************************** +c * Add contribution from right acoustic wave. +c ****************************************************** + denom = one / (sR-sM) + star(1) = stateR(1) * (sR-stateR(2+$1)) * denom + star(2+$1) = sM + star(2+$2) = stateR(2+$2) + star(2+$3) = stateR(2+$3) + star(NEQU) = stateR(NEQU)*(1 + gamma * denom + & * ( sM-stateR(2+$1) ) ) + & + half * gam_min_one + & * star(1) * ( sM-stateR(2+$1) )**2 + + diff(1) = star(1) - stateR(1) + diff(2) = star(1)*star(2) - stateR(1)*stateR(2) + diff(3) = star(1)*star(3) - stateR(1)*stateR(3) + diff(4) = star(1)*star(4) - stateR(1)*stateR(4) + diff(NEQU) = ( star(NEQU)-stateR(NEQU) ) + & / gam_min_one + & + half * star(1) * + & (star(2)**2 + star(3)**2+ star(4)**2) + & - stateR(1) * keR + + do j=1,NEQU + flux(j) = flux(j) + sR*diff(j) + enddo + + endif + + endif + +c ************************************************************ +c * Assign average interface fluxes. +c ************************************************************ + do j=1,NEQU + flux$1(ie$1,$4,j) = dt * flux(j) + enddo + + enddo + enddo + enddo + + endif +')dnl +define(correc_flux2d,`dnl +c correct the $1-direction with $3-fluxes + do ic$5=ifirst$5-(FLUXG),ilast$5+(FLUXG) + do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) + do ic$1=ifirst$1-(FLUXG),ilast$1+(FLUXG) + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)= + & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))*0.5/dx($3) + enddo +c + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + ttracelft$1(ic$1+1,$2,k)=tracelft$1(ic$1+1,$2,k) + & - ttv(k) + ttracergt$1(ic$1 ,$2,k)=tracergt$1(ic$1 ,$2,k) + & - ttv(k) + enddo + enddo + enddo + enddo +')dnl +define(correc_flux3d,`dnl +c correct the $1-direction with $2$3-fluxes + do ic$1=ifirst$1-FLUXG,ilast$1+FLUXG + do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=0.5*( + & (flux$4(ic$2+1,$6,k)-flux$4(ic$2,$6,k))/dx($2)+ + & (flux$5(ic$3+1,$7,k)-flux$5(ic$3,$7,k))/dx($3)) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracelft$1(ic$1+1,ic$2,ic$3,k)=tracelft$1(ic$1+1,ic$2,ic$3,k) + & - ttv(k) + tracergt$1(ic$1 ,ic$2,ic$3,k)=tracergt$1(ic$1 ,ic$2,ic$3,k) + & - ttv(k) + enddo + enddo + enddo + enddo +')dnl +define(artificial_viscosity1,`dnl + do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + do ie$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG) + maxeig =trrgt$1(ie$1,ic$2,ic$3,NEQU)-trlft$1(ie$1,ic$2,ic$3,NEQU) + vcoef = tenth*abs(maxeig) + + mom0L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,2) + mom1L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,3) + mom2L=trlft$1(ie$1,ic$2,ic$3,1)*trlft$1(ie$1,ic$2,ic$3,4) + v2norm = mom1L**2+mom0L**2+mom2L**2 + enerL=trlft$1(ie$1,ic$2,ic$3,NEQU)/gam_min_one+ + & v2norm/(trlft$1(ie$1,ic$2,ic$3,1)*two) + mom0R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,2) + mom1R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,3) + mom2R=trrgt$1(ie$1,ic$2,ic$3,1)*trrgt$1(ie$1,ic$2,ic$3,4) + v2norm = mom1R**2+mom0R**2+mom2R**2 + enerR=trrgt$1(ie$1,ic$2,ic$3,NEQU)/gam_min_one+ + & v2norm/(trrgt$1(ie$1,ic$2,ic$3,1)*two) + + vcorr(1) = dt*vcoef* + & (trrgt$1(ie$1,ic$2,ic$3,1)-trlft$1(ie$1,ic$2,ic$3,1)) + vcorr(2) = dt*vcoef*(mom0R-mom0L) + vcorr(3) = dt*vcoef*(mom1R-mom1L) + vcorr(4) = dt*vcoef*(mom2R-mom2L) + vcorr(NEQU) = dt*vcoef*(enerR-enerL) + do j=1,NEQU + flux$1(ie$1,ic$2,ic$3,j)=flux$1(ie$1,ic$2,ic$3,j) + & -vcorr(j) + enddo + enddo + enddo + enddo +')dnl +c +define(artificial_viscosity2,`dnl + do ic1=ifirst1,ilast1 + do ie0=ifirst0,ilast0+1 + maxeig =pressure(ie0,ic1)-pressure(ie0-1,ic1) + vcoef = tenth*abs(maxeig) + mom0L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,0) + mom1L=density(ie0-1,ic1,1)*velocity(ie0-1,ic1,1) + mom0R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,0) + mom1R=density(ie0 ,ic1,1)*velocity(ie0 ,ic1,1) + v2norm = mom1L**2+mom0L**2 + enerL=pressure(ie0-1,ic1)/gam_min_one+ + & v2norm/(density(ie0-1,ic1)*two) + v2norm = mom1R**2+mom0R**2 + enerR=pressure(ie0,ic1)/gam_min_one+ + & v2norm/(density(ie0,ic1)*two) + vcorr(1)= dt*vcoef*(density(ie0,ic1)-density(ie0-1,ic1)) + vcorr(2)= dt*vcoef*(mom0R-mom0L) + vcorr(3)= dt*vcoef*(mom1R-mom1L) + vcorr(4)= dt*vcoef*(mom2R-mom2L) + vcorr(NEQU)= dt*vcoef*(enerR-enerL) + do j=1,NEQU + flux0(ie0,ic1,ic2,j)=flux0(ie0,ic1,ic2,j) + & -vcorr(j) + enddo + enddo + enddo + do ic0=ifirst0,ilast0 + do ie1=ifirst1,ilast1+1 + maxeig =pressure(ic0,ie1)-pressure(ic0-1,ie1) + vcoef = 0.1*abs(maxeig) + mom0L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,0) + mom1L=density(ic0,ie1-1,1)*velocity(ic0,ie1-1,1) + mom0R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,0) + mom1R=density(ic0,ie1 ,1)*velocity(ic0,ie1 ,1) + v2norm = mom1L**2+mom0L**2 + enerL=pressure(ic0,ie1-1)/gam_min_one+ + & v2norm/(density(ic0,ie1-1)*two) + v2norm = mom1R**2+mom0R**2 + enerR=pressure(ic0,ie1)/gam_min_one+ + & v2norm/(density(ic0,ie1)*two) + vcorr1= dt*vcoef*(density(ic0,ie1)-density(ic0,ie1-1)) + vcorr2= dt*vcoef*(mom0R-mom0L) + vcorr3= dt*vcoef*(mom1R-mom1L) + vcorr4= dt*vcoef*(enerR-enerL) + flux1(ie1,ic0,1)= flux1(ie1,ic0,1) - vcorr1 + flux1(ie1,ic0,2)= flux1(ie1,ic0,2) - vcorr2 + flux1(ie1,ic0,3)= flux1(ie1,ic0,3) - vcorr3 + flux1(ie1,ic0,4)= flux1(ie1,ic0,4) - vcorr4 + enddo + enddo +')dnl +c diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4fluxcorner3d.i new file mode 100644 index 00000000..46d9f236 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4fluxcorner3d.i @@ -0,0 +1,243 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for corner flux computation in 3d. +c +define(st_third,`dnl + do ic$3=ifirst$3-FLUXG,ilast$3+FLUXG + do ic$2=ifirst$2-FLUXG,ilast$2+FLUXG + do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + pres = pressure(ic0,ic1,ic2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)= + & (flux$1(ic$1+1,$4,k)-flux$1(ic$1,$4,k))/(3*dx($1)) + enddo +c + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + st3(ic0,ic1,ic2,1)=rho -ttv(1) + st3(ic0,ic1,ic2,2)=vel0 -ttv(2) + st3(ic0,ic1,ic2,3)=vel1 -ttv(3) + st3(ic0,ic1,ic2,4)=vel2 -ttv(4) + st3(ic0,ic1,ic2,5)=pres -ttv(5) + enddo + enddo + enddo +')dnl +define(f_third,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt + do ic$3=ifirst$3-FLUXG,ilast$3+FLUXG + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + do ic$1=ifirst$1-(FLUXG-1),ilast$1+FLUXG + + stateL(1) = st3($5,1) + stateL(2) = st3($5,2+$1) + stateL(3) = st3($5,NEQU) + stateL(4) = stateL(3)/gam_min_one + + stateR(1) = st3(ic0,ic1,ic2,1) + stateR(2) = st3(ic0,ic1,ic2,2+$1) + stateR(3) = st3(ic0,ic1,ic2,NEQU) + stateR(4) = stateR(3)/gam_min_one + + if (rpchoice.eq.APPROX_RIEM_SOLVE) then + call gas1dapproxrp3d(gamma,stateL,stateR,riemst) + else if (rpchoice.eq.EXACT_RIEM_SOLVE) then + call gas1dexactrp3d(gamma,smallr,stateL,stateR,riemst) +c else if (rpchoice.eq.ROE_RIEM_SOLVE) then +c else if (rpchoice.eq.HLLC_RIEM_SOLVE) then + endif + + if (riemst(2).le.zero) then + vel($2)=st3(ic0,ic1,ic2,2+$2) + vel($3)=st3(ic0,ic1,ic2,2+$3) + else + vel($2)=st3($5,2+$2) + vel($3)=st3($5,2+$3) + endif + vel($1)=riemst(2) + + mom$1 =riemst(1)*vel($1) + v2norm = vel(0)**2+vel(1)**2+vel(2)**2 + Hent =riemst(3)/gam_min_one+v2norm*riemst(1)/two + flux$1(ic$1,$4,1)= dt*mom$1 + flux$1(ic$1,$4,2+$1)= dt*(mom$1*vel($1)+riemst(3)) + flux$1(ic$1,$4,2+$2)= dt*mom$1*vel($2) + flux$1(ic$1,$4,2+$3)= dt*mom$1*vel($3) + flux$1(ic$1,$4,5)= dt*riemst(2)*(Hent+riemst(3)) + + enddo + enddo + enddo +')dnl +define(correc_fluxjt,`dnl +c correct the $2-direction with $3-fluxes + do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) + do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) + ic$2=ifirst$2-FLUXG + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracelft$2(ic$2+1,ic$1,ic$3,k)=tracelft$2(ic$2+1,ic$1,ic$3,k) + & - ttv(k) + enddo + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracelft$2(ic$2+1,ic$1,ic$3,k)=tracelft$2(ic$2+1,ic$1,ic$3,k) + & - ttv(k) + tracergt$2(ic$2 ,ic$1,ic$3,k)=tracergt$2(ic$2 ,ic$1,ic$3,k) + & - ttv(k) + enddo + enddo + ic$2=ilast$2+FLUXG + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$3(ic$3+1,$4,k)-flux$3(ic$3,$4,k))/dx($3) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracergt$2(ic$2 ,ic$1,ic$3,k)=tracergt$2(ic$2 ,ic$1,ic$3,k) + & - ttv(k) + enddo + enddo + enddo +c +c correct the $3-direction with $2-fluxes + do ic$1=ifirst$1-(FLUXG-1),ilast$1+(FLUXG-1) + do ic$2=ifirst$2-(FLUXG-1),ilast$2+(FLUXG-1) + ic$3=ifirst$3-FLUXG + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracelft$3(ic$3+1,ic$2,ic$1,k)=tracelft$3(ic$3+1,ic$2,ic$1,k) + & - ttv(k) + enddo + do ic$3=ifirst$3-(FLUXG-1),ilast$3+(FLUXG-1) + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracelft$3(ic$3+1,ic$2,ic$1,k)=tracelft$3(ic$3+1,ic$2,ic$1,k) + & - ttv(k) + tracergt$3(ic$3 ,ic$2,ic$1,k)=tracergt$3(ic$3 ,ic$2,ic$1,k) + & - ttv(k) + enddo + enddo + ic$3=ilast$3+FLUXG + rho = density(ic0,ic1,ic2) + vel0 = velocity(ic0,ic1,ic2,0) + vel1 = velocity(ic0,ic1,ic2,1) + vel2 = velocity(ic0,ic1,ic2,2) + v2norm= vel0**2+vel1**2 +vel2**2 + do k=1,NEQU + trnsvers(k)=half* + & (flux$2(ic$2+1,$5,k)-flux$2(ic$2,$5,k))/dx($2) + enddo + + ttv(1)= trnsvers(1) + ttv(2)= (trnsvers(2) - vel0*trnsvers(1))/rho + ttv(3)= (trnsvers(3) - vel1*trnsvers(1))/rho + ttv(4)= (trnsvers(4) - vel2*trnsvers(1))/rho + ttv(NEQU)= (v2norm*half*trnsvers(1) - + & vel0*trnsvers(2) - vel1*trnsvers(3) - + & vel2*trnsvers(4) + + & trnsvers(NEQU))*gam_min_one + do k=1,NEQU + tracergt$3(ic$3 ,ic$2,ic$1,k)=tracergt$3(ic$3 ,ic$2,ic$1,k) + & - ttv(k) + enddo + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace2d.i new file mode 100644 index 00000000..101b64a4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace2d.i @@ -0,0 +1,68 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for trace computation in 2d. +c +define(trace_init,`dnl + do ic$2=ifirst$2-FACEG,ilast$2+FACEG + ie$1=ifirst$1-FACEG + tracelft$1(ie$1,ic$2,1)=zero + tracelft$1(ie$1,ic$2,2)=zero + tracelft$1(ie$1,ic$2,3)=zero + tracelft$1(ie$1,ic$2,NEQU)=zero + tracergt$1(ie$1,ic$2,1)=density($5) + tracergt$1(ie$1,ic$2,2)=velocity($5,1) + tracergt$1(ie$1,ic$2,3)=velocity($5,2) + tracergt$1(ie$1,ic$2,NEQU)=pressure($5) + + do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG + tracelft$1(ie$1,ic$2,1)=density($4) + tracelft$1(ie$1,ic$2,2)=velocity($4,1) + tracelft$1(ie$1,ic$2,3)=velocity($4,2) + tracelft$1(ie$1,ic$2,NEQU)=pressure($4) + + tracergt$1(ie$1,ic$2,1)=density($5) + tracergt$1(ie$1,ic$2,2)=velocity($5,1) + tracergt$1(ie$1,ic$2,3)=velocity($5,2) + tracergt$1(ie$1,ic$2,NEQU)=pressure($5) + + enddo + + ie$1=ilast$1+FACEG+1 + tracelft$1(ie$1,ic$2,1)=density($4) + tracelft$1(ie$1,ic$2,2)=velocity($4,1) + tracelft$1(ie$1,ic$2,3)=velocity($4,2) + tracelft$1(ie$1,ic$2,NEQU)=pressure($4) + tracergt$1(ie$1,ic$2,1)=zero + tracergt$1(ie$1,ic$2,2)=zero + tracergt$1(ie$1,ic$2,3)=zero + tracergt$1(ie$1,ic$2,NEQU)=zero + enddo + +')dnl +define(trace_call,`dnl + do ic$2=ifirst$2-2,ilast$2+2 + do ic$1=ifirst$1-CELLG,ilast$1+CELLG + ttsound(ic$1)= sound(ic0,ic1) + enddo + do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 + do k=1,NEQU + ttraclft(ic$1,k) = tracelft(ic$1,ic$2,k) + ttracrgt(ic$1,k) = tracergt(ic$1,ic$2,k) + enddo + enddo + + call trace2d(dt,ifirst$1,ilast$1,mc, + & dx,idir,igdnv,ttsound, + & ttraclft,ttracrgt, + & ttcelslp,ttedgslp) + do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 + do k=1,NEQU + tracelft(ic$1,ic$2,k) = ttraclft(ic$1,k) + tracergt(ic$1,ic$2,k) = ttracrgt(ic$1,k) + enddo + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace3d.i new file mode 100644 index 00000000..49278984 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/m4trace3d.i @@ -0,0 +1,78 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for trace computation in 3d. +c +define(trace_init,`dnl + do ic$3=ifirst$3-FACEG,ilast$3+FACEG + do ic$2=ifirst$2-FACEG,ilast$2+FACEG + ie$1=ifirst$1-FACEG + tracelft$1(ie$1,ic$2,ic$3,1)=zero + tracelft$1(ie$1,ic$2,ic$3,2)=zero + tracelft$1(ie$1,ic$2,ic$3,3)=zero + tracelft$1(ie$1,ic$2,ic$3,4)=zero + tracelft$1(ie$1,ic$2,ic$3,5)=zero + tracergt$1(ie$1,ic$2,ic$3,1)=density($5) + tracergt$1(ie$1,ic$2,ic$3,2)=velocity($5,1) + tracergt$1(ie$1,ic$2,ic$3,3)=velocity($5,2) + tracergt$1(ie$1,ic$2,ic$3,4)=velocity($5,3) + tracergt$1(ie$1,ic$2,ic$3,5)=pressure($5) + + do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG + tracelft$1(ie$1,ic$2,ic$3,1)=density($4) + tracelft$1(ie$1,ic$2,ic$3,2)=velocity($4,1) + tracelft$1(ie$1,ic$2,ic$3,3)=velocity($4,2) + tracelft$1(ie$1,ic$2,ic$3,4)=velocity($4,3) + tracelft$1(ie$1,ic$2,ic$3,5)=pressure($4) + + tracergt$1(ie$1,ic$2,ic$3,1)=density($5) + tracergt$1(ie$1,ic$2,ic$3,2)=velocity($5,1) + tracergt$1(ie$1,ic$2,ic$3,3)=velocity($5,2) + tracergt$1(ie$1,ic$2,ic$3,4)=velocity($5,3) + tracergt$1(ie$1,ic$2,ic$3,5)=pressure($5) + + enddo + + ie$1=ilast$1+FACEG+1 + tracelft$1(ie$1,ic$2,ic$3,1)=density($4) + tracelft$1(ie$1,ic$2,ic$3,2)=velocity($4,1) + tracelft$1(ie$1,ic$2,ic$3,3)=velocity($4,2) + tracelft$1(ie$1,ic$2,ic$3,4)=velocity($4,3) + tracelft$1(ie$1,ic$2,ic$3,5)=pressure($4) + tracergt$1(ie$1,ic$2,ic$3,1)=zero + tracergt$1(ie$1,ic$2,ic$3,2)=zero + tracergt$1(ie$1,ic$2,ic$3,3)=zero + tracergt$1(ie$1,ic$2,ic$3,4)=zero + tracergt$1(ie$1,ic$2,ic$3,5)=zero + enddo + enddo + +')dnl +define(trace_call,`dnl + do ic$3=ifirst$3-2,ilast$3+2 + do ic$2=ifirst$2-2,ilast$2+2 + do ic$1=ifirst$1-CELLG,ilast$1+CELLG + ttsound(ic$1)= sound(ic0,ic1,ic2) + enddo + do k=1,NEQU + do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 + ttraclft(ic$1,k) = tracelft(ic$1,ic$2,ic$3,k) + ttracrgt(ic$1,k) = tracergt(ic$1,ic$2,ic$3,k) + enddo + enddo + + call trace3d(dt,ifirst$1,ilast$1,mc, + & dx,idir,igdnv,ttsound, + & ttraclft,ttracrgt, + & ttcelslp,ttedgslp) + do k=1,NEQU + do ic$1=ifirst$1-FACEG,ilast$1+FACEG+1 + tracelft(ic$1,ic$2,ic$3,k) = ttraclft(ic$1,k) + tracergt(ic$1,ic$2,ic$3,k) = ttracrgt(ic$1,k) + enddo + enddo + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/probparams.i b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/probparams.i index d5771a82..8c0d1444 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/probparams.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/probparams.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining common block. +c common/probparams/APPROX_RIEM_SOLVE,EXACT_RIEM_SOLVE, & HLLC_RIEM_SOLVE, & PIECEWISE_CONSTANT_X,PIECEWISE_CONSTANT_Y,PIECEWISE_CONSTANT_Z, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable2d.m4 new file mode 100644 index 00000000..329f7352 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable2d.m4 @@ -0,0 +1,56 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for computation of stable dt for 2d euler +c equations. +c +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine stabledt2d(dx, + & ifirst0,ilast0,ifirst1,ilast1, + & ngc0,ngc1, + & gamma,density,velocity,pressure,stabdt) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL stabdt,dx(0:NDIM-1) + integer ifirst0,ilast0,ifirst1,ilast1,ngc0,ngc1 +c + REAL + & gamma, + & density(CELL2dVECG(ifirst,ilast,ngc)), + & velocity(CELL2dVECG(ifirst,ilast,ngc),0:NDIM-1), + & pressure(CELL2dVECG(ifirst,ilast,ngc)) +c + integer ic0,ic1 + integer ighoslft(0:NDIM-1),ighosrgt(0:NDIM-1) + + REAL maxspeed(0:NDIM-1),lambda +c + ighoslft(0) = ifirst0 - ngc0 + ighoslft(1) = ifirst1 - ngc1 + ighosrgt(0) = ilast0 + ngc0 + ighosrgt(1) = ilast1 + ngc1 + + maxspeed(0)=zero + maxspeed(1)=zero + + do ic1=ighoslft(1),ighosrgt(1) + do ic0=ighoslft(0),ighosrgt(0) + lambda = + & sqrt(max(zero,gamma*pressure(ic0,ic1)/density(ic0,ic1))) + maxspeed(0) = max(maxspeed(0), + & abs(velocity(ic0,ic1,0))+lambda) + maxspeed(1) = max(maxspeed(1), + & abs(velocity(ic0,ic1,1))+lambda) + enddo + enddo + stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable3d.m4 new file mode 100644 index 00000000..043a46f7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stable3d.m4 @@ -0,0 +1,68 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for computation of stable dt for 3d euler +c equations. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine stabledt3d(dx, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ngc0,ngc1,ngc2, + & gamma,density,velocity,pressure,stabdt) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL stabdt,dx(0:NDIM-1) + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ngc0,ngc1,ngc2 +c + REAL + & density(CELL3dVECG(ifirst,ilast,ngc)), + & velocity(CELL3dVECG(ifirst,ilast,ngc),0:NDIM-1), + & pressure(CELL3dVECG(ifirst,ilast,ngc)) +c + integer ic0,ic1,ic2 + integer ighoslft(0:NDIM-1),ighosrgt(0:NDIM-1) + + REAL maxspeed(0:NDIM-1),gamma,lambda +c + ighoslft(0) = ifirst0 - ngc0 + ighoslft(1) = ifirst1 - ngc1 + ighoslft(2) = ifirst2 - ngc2 + ighosrgt(0) = ilast0 + ngc0 + ighosrgt(1) = ilast1 + ngc1 + ighosrgt(2) = ilast2 + ngc2 + + maxspeed(0)=zero + maxspeed(1)=zero + maxspeed(2)=zero + + do ic2=ighoslft(2),ighosrgt(2) + do ic1=ighoslft(1),ighosrgt(1) + do ic0=ighoslft(0),ighosrgt(0) + lambda = sqrt(max(zero, + & gamma*pressure(ic0,ic1,ic2)/density(ic0,ic1,ic2))) + maxspeed(0) = max(maxspeed(0), + & abs(velocity(ic0,ic1,ic2,0))+lambda) + maxspeed(1) = max(maxspeed(1), + & abs(velocity(ic0,ic1,ic2,1))+lambda) + maxspeed(2) = max(maxspeed(2), + & abs(velocity(ic0,ic1,ic2,2))+lambda) + enddo + enddo + enddo + stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) + stabdt = min((dx(2)/maxspeed(2)),stabdt) +c write(6,*) " dx(0),maxspeed(0)= ",dx(0),maxspeed(0) +c write(6,*) " dx(1),maxspeed(1)= ",dx(1),maxspeed(1) +c write(6,*) " dx(2),maxspeed(2)= ",dx(2),maxspeed(2) +c write(6,*) " stabdt= ",stabdt + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stufprobc.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stufprobc.m4 index 4a9c9764..3fed00cf 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stufprobc.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/stufprobc.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine. +c subroutine stufprobc( & APPROX_RIEM_SOLVEin,EXACT_RIEM_SOLVEin,HLLC_RIEM_SOLVEin, & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, @@ -11,7 +18,7 @@ & PIECEWISE_CONSTANT_Zin, & SPHEREin,STEPin, & CELLGin,FACEGin,FLUXGin -include(FORTDIR/../probparams.i)dnl +include(FORTDIR/probparams.i)dnl APPROX_RIEM_SOLVE=APPROX_RIEM_SOLVEin EXACT_RIEM_SOLVE=EXACT_RIEM_SOLVEin diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d2d.m4 new file mode 100644 index 00000000..2692f02f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d2d.m4 @@ -0,0 +1,202 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for 2d trace. +c +define(NEQU,4)dnl +define(REAL,`double precision')dnl + + subroutine trace2d(dt,ifirst,ilast,mc, + & dx,dir,igdnv,sound, + & tracelft,tracergt, + & celslope,edgslope) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL dt + integer ifirst,ilast,mc,dir,igdnv +c REAL dx, flattn + REAL dx +c + REAL + & celslope(ifirst-CELLG:ifirst+mc-1+CELLG,NEQU), + & flattn(ifirst-CELLG:ifirst+mc-1+CELLG), + & sound (ifirst-CELLG:ifirst+mc-1+CELLG), +c side variables + & tracelft(ifirst-FACEG:ifirst+mc+FACEG,NEQU), + & tracergt(ifirst-FACEG:ifirst+mc+FACEG,NEQU), + & edgslope(ifirst-FACEG:ifirst+mc+FACEG,NEQU) +c + integer ie,ic,i,k + REAL bound,coef4,slope2,dtdx,slope4 + REAL csq, rho, u, v, p + REAL drho, du, dv, dp + REAL spminus, spplus, spzero, smminus, smplus, smzero + REAL alpham, alphap, alpha0r + REAL alpha0v + REAL apright, amright, azrright + REAL azv1rght + REAL apleft, amleft, azrleft + REAL azv1left,ceigv + integer dir1,dir2 + + if (dir.eq.0) then + dir1 = 2 + dir2 = 3 + else + dir1 = 3 + dir2 = 2 + endif +c +c write(6,*) "in trace" +c +c do ic=ifirst-4,ilast+4 +c write(6,*) "ic,state, flat =",ic, +c & tracergt(ic,1),tracergt(ic,2), +c & tracergt(ic,3),tracergt(ic,4), +c call flush(6) +c enddo + +c*********************************************************************** +c ****************************************************************** +c * check for inflection points in characteristic speeds +c * compute slopes at cell edges +c * zero slopes if neighboring cells have different loading +c ****************************************************************** + do ie=ifirst+1-FACEG,ilast+FACEG + do k=1,NEQU + edgslope(ie,k)=tracergt(ie,k)-tracelft(ie,k) + enddo + enddo +c ****************************************************************** +c * limit slopes +c ****************************************************************** + do i=1,NEQU + do ic=ifirst-CELLG,ilast+CELLG + celslope(ic,i)=zero + enddo + enddo + if (igdnv.eq.2) then +c write(6,*) "second-order slopes" +c **************************************************************** +c * second-order slopes +c **************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + call flaten2d( + & ifirst,ilast,ic,mc,dir,tracergt,sound,flattn(ic)) + enddo + do ic=ifirst+1-CELLG,ilast+CELLG-1 +c call flaten2d(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) +c flattn=one + do i=1,NEQU + slope2=half*(edgslope(ic,i)+edgslope(ic+1,i)) + celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) + if (edgslope(ic,i)*edgslope(ic+1,i).le.zero) then + celslope(ic,i)=zero + else + bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) + celslope(ic,i)=sign(min(two*bound,abs(slope2)),slope2) +c celslope(ic,i)=flattn*celslope(ic,i) + celslope(ic,i)=flattn(ic)*celslope(ic,i) + endif +c write(6,*) "i,ic,celslope= ", i,ic,celslope(ic,i) +c call flush(6) + enddo + enddo + else if (igdnv.eq.4) then +c write(6,*) "fourth-order slopes" +c **************************************************************** +c * fourth-order slopes +c **************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + call flaten2d( + & ifirst,ilast,ic,mc,dir,tracergt,sound,flattn(ic)) + enddo + do ic=ifirst+2-CELLG,ilast+CELLG-2 +c call flaten2d(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) +c flattn=one + do i=1,NEQU + slope4=fourth*(tracergt(ic+2,i)-tracergt(ic-2,i)) + celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) + coef4=third*(four*celslope(ic,i)-slope4) + if (edgslope(ic,i)*edgslope(ic+1,i).le.zero .or. + & coef4*celslope(ic,i).lt.zero) then + celslope(ic,i)=zero + else + bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) + celslope(ic,i)=sign(min(two*bound,abs(coef4)),coef4) +c celslope(ic,i)=flattn(ic)*celslope(ic,i) + endif + enddo + enddo + endif +c ****************************************************************** +c * characteristic projection +c ****************************************************************** + do ic=ifirst-FACEG+1,ilast+FACEG + dtdx=dt/dx + rho = max(smallr,tracergt(ic,1)) + u = tracergt(ic,dir1) + v = tracergt(ic,dir2) + p = tracergt(ic,NEQU) + drho = celslope(ic,1) + du = celslope(ic,dir1) + dv = celslope(ic,dir2) + dp = celslope(ic,NEQU) + + ceigv = sound(ic) + csq = ceigv**2 + + alpham = half*(dp/(rho*ceigv) - du)*rho/ceigv + alphap = half*(dp/(rho*ceigv) + du)*rho/ceigv + alpha0r = drho - dp/csq + alpha0v = dv + + if ((u-ceigv).gt.0) then + spminus = -one + smminus = (u-ceigv)*dtdx + else + spminus = (u-ceigv)*dtdx + smminus = one + endif + if ((u+ceigv).gt.0) then + spplus = -one + smplus = (u+ceigv)*dtdx + else + spplus = (u+ceigv)*dtdx + smplus = one + endif + if ((u).gt.0) then + spzero = -one + smzero = u*dtdx + else + spzero = u*dtdx + smzero = one + endif + apright = half*(-one - spplus )*alphap + amright = half*(-one - spminus)*alpham + azrright = half*(-one - spzero )*alpha0r + azv1rght = half*(-one - spzero )*alpha0v + tracergt(ic,1) = rho + apright + amright + azrright + tracergt(ic,1) = max(smallr,tracergt(ic,1)) + tracergt(ic,dir1) = u + (apright - amright)*ceigv/rho + tracergt(ic,dir2) = v + azv1rght + tracergt(ic,NEQU) = p + (apright + amright)*csq + + apleft = half*(one - smplus )*alphap + amleft = half*(one - smminus)*alpham + azrleft = half*(one - smzero )*alpha0r + azv1left = half*(one - smzero )*alpha0v + tracelft(ic+1,1) = rho + apleft + amleft + azrleft + tracelft(ic+1,1) = max(smallr,tracelft(ic+1,1)) + tracelft(ic+1,dir1) = u + (apleft - amleft)*ceigv/rho + tracelft(ic+1,dir2) = v + azv1left + tracelft(ic+1,NEQU) = p + (apleft + amleft)*csq + enddo +c call flush(6) + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d3d.m4 new file mode 100644 index 00000000..7628f99f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace1d3d.m4 @@ -0,0 +1,190 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for 3d trace. +c +define(NEQU,5)dnl +define(REAL,`double precision')dnl + + subroutine trace3d(dt,ifirst,ilast,mc, + & dx,dir,igdnv,sound, + & tracelft,tracergt, + & celslope,edgslope) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL dt + integer ifirst,ilast,mc,dir,igdnv + REAL dx, flattn +c + REAL + & celslope(ifirst-CELLG:ifirst+mc-1+CELLG,NEQU), + & sound (ifirst-CELLG:ifirst+mc-1+CELLG), +c side variables + & tracelft(ifirst-FACEG:ifirst+mc+FACEG,NEQU), + & tracergt(ifirst-FACEG:ifirst+mc+FACEG,NEQU), + & edgslope(ifirst-FACEG:ifirst+mc+FACEG,NEQU) +c + integer ie,ic,i,k + REAL bound,coef4,slope2,dtdx,slope4 + REAL csq, rho, u, v, w, p + REAL drho, du, dv, dw, dp + REAL spminus, spplus, spzero, smminus, smplus, smzero + REAL alpham, alphap, alpha0r + REAL alpha0v,alpha0w + REAL apright, amright, azrright + REAL azv1rght,azw1rght + REAL apleft, amleft, azrleft + REAL azv1left,azw1left,ceigv + integer dir1,dir2,dir3 + + if (dir.eq.0) then + dir1 = 2 + dir2 = 3 + dir3 = 4 + else if (dir.eq.1) then + dir1 = 3 + dir2 = 4 + dir3 = 2 + else if (dir.eq.2) then + dir1 = 4 + dir2 = 2 + dir3 = 3 + endif +c +c*********************************************************************** +c ****************************************************************** +c * check for inflection points in characteristic speeds +c * compute slopes at cell edges +c * zero slopes if neighboring cells have different loading +c ****************************************************************** + do ie=ifirst+1-FACEG,ilast+FACEG + do k=1,NEQU + edgslope(ie,k)=tracergt(ie,k)-tracelft(ie,k) + enddo + enddo +c ****************************************************************** +c * limit slopes +c ****************************************************************** + do i=1,NEQU + do ic=ifirst-CELLG,ilast+CELLG + celslope(ic,i)=zero + enddo + enddo + if (igdnv.eq.2) then +c **************************************************************** +c * second-order slopes +c **************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 +c call flaten3d(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) + flattn=one + do i=1,NEQU + slope2=half*(edgslope(ic,i)+edgslope(ic+1,i)) + celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) + if (edgslope(ic,i)*edgslope(ic+1,i).le.zero) then + celslope(ic,i)=zero + else + bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) + celslope(ic,i)=sign(min(two*bound,abs(slope2)),slope2) + celslope(ic,i)=flattn*celslope(ic,i) + endif + enddo + enddo + else if (igdnv.eq.4) then +c **************************************************************** +c * fourth-order slopes +c **************************************************************** + do ic=ifirst+2-CELLG,ilast+CELLG-2 +c call flaten3d(ifirst,ilast,ic,mc,dir,tracergt,sound,flattn) + flattn=one + do i=1,NEQU + slope4=fourth*(tracergt(ic+2,i)-tracergt(ic-2,i)) + celslope(ic,i)=half*(edgslope(ic,i)+edgslope(ic+1,i)) + coef4=third*(four*celslope(ic,i)-slope4) + if (edgslope(ic,i)*edgslope(ic+1,i).le.zero .or. + & coef4*celslope(ic,i).lt.zero) then + celslope(ic,i)=zero + else + bound=min(abs(edgslope(ic,i)),abs(edgslope(ic+1,i))) + celslope(ic,i)=sign(min(two*bound,abs(coef4)),coef4) + celslope(ic,i)=flattn*celslope(ic,i) + endif + enddo + enddo + endif +c ****************************************************************** +c * characteristic projection +c ****************************************************************** + do ic=ifirst-FACEG+1,ilast+FACEG + dtdx=dt/dx + rho = max(smallr,tracergt(ic,1)) + u = tracergt(ic,dir1) + v = tracergt(ic,dir2) + p = tracergt(ic,NEQU) + drho = celslope(ic,1) + du = celslope(ic,dir1) + dv = celslope(ic,dir2) + dp = celslope(ic,NEQU) + w = tracergt(ic,dir3) + dw = celslope(ic,dir3) + alpha0w = dw + + ceigv = sound(ic) + csq = ceigv**2 + + alpham = half*(dp/(rho*ceigv) - du)*rho/ceigv + alphap = half*(dp/(rho*ceigv) + du)*rho/ceigv + alpha0r = drho - dp/csq + alpha0v = dv + + if ((u-ceigv).gt.0) then + spminus = -one + smminus = (u-ceigv)*dtdx + else + spminus = (u-ceigv)*dtdx + smminus = one + endif + if ((u+ceigv).gt.0) then + spplus = -one + smplus = (u+ceigv)*dtdx + else + spplus = (u+ceigv)*dtdx + smplus = one + endif + if ((u).gt.0) then + spzero = -one + smzero = u*dtdx + else + spzero = u*dtdx + smzero = one + endif + apright = half*(-one - spplus )*alphap + amright = half*(-one - spminus)*alpham + azrright = half*(-one - spzero )*alpha0r + azv1rght = half*(-one - spzero )*alpha0v + azw1rght = half*(-one - spzero )*alpha0w + tracergt(ic,1) = rho + apright + amright + azrright + tracergt(ic,1) = max(smallr,tracergt(ic,1)) + tracergt(ic,dir1) = u + (apright - amright)*ceigv/rho + tracergt(ic,dir2) = v + azv1rght + tracergt(ic,dir3) = w + azw1rght + tracergt(ic,NEQU) = p + (apright + amright)*csq + + apleft = half*(one - smplus )*alphap + amleft = half*(one - smminus)*alpham + azrleft = half*(one - smzero )*alpha0r + azv1left = half*(one - smzero )*alpha0v + azw1left = half*(one - smzero )*alpha0w + tracelft(ic+1,1) = rho + apleft + amleft + azrleft + tracelft(ic+1,1) = max(smallr,tracelft(ic+1,1)) + tracelft(ic+1,dir1) = u + (apleft - amleft)*ceigv/rho + tracelft(ic+1,dir2) = v + azv1left + tracelft(ic+1,dir3) = w + azw1left + tracelft(ic+1,NEQU) = p + (apleft + amleft)*csq + enddo + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace2d.m4 new file mode 100644 index 00000000..db4f05f7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace2d.m4 @@ -0,0 +1,258 @@ +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/m4trace2d.i)dnl + + subroutine computesound2d(ifirst0,ilast0,ifirst1,ilast1, + & gamma,density, velocity,pressure,sound) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 +c variables indexed as 2dimensional + REAL + & gamma, + & density(CELL2d(ifirst,ilast,CELLG)), + & velocity(CELL2d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL2d(ifirst,ilast,CELLG)), + & sound(CELL2d(ifirst,ilast,CELLG)) +c + integer ic0,ic1 +c +c*********************************************************************** +c +c write(6,*) "in computesound" +c do ic1=ifirst1-4,ilast1+4 +c do ic0=ifirst0-4,ilast0+4 +c write(6,*) "ic01,d_p_v=",ic0,ic1, +c & density(ic0,ic1),pressure(ic0,ic1), +c & velocity(ic0,ic1,0),velocity(ic0,ic1,1) +c call flush(6) +c enddo +c enddo +c write(6,*) + + do ic0=ifirst0-CELLG,ilast0+CELLG + do ic1=ifirst1-CELLG,ilast1+CELLG +c write(6,*) " density,pressure = ",ic0,ic1, +c & density(ic0,ic1),pressure(ic0,ic1) +c write(6,*) " velocity, = ",ic0,ic1, +c & velocity(ic0,ic1,0),velocity(ic0,ic1,1) +c call flush(6) + sound(ic0,ic1) = + & sqrt(max(smallr,gamma*pressure(ic0,ic1)/density(ic0,ic1))) +c call flush(6) +c + enddo + enddo + +c write(6,*) "leaving computesound" +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** +c + subroutine inittraceflux2d( + & ifirst0,ilast0,ifirst1,ilast1, + & density,velocity,pressure, + & tracelft0,tracelft1, + & tracergt0,tracergt1, + & fluxriem0,fluxriem1) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + REAL + & density(CELL2d(ifirst,ilast,CELLG)), + & velocity(CELL2d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL2d(ifirst,ilast,CELLG)), + & fluxriem0(FACE2d0(ifirst,ilast,FLUXG),NEQU), + & tracelft0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & tracergt0(FACE2d0(ifirst,ilast,FACEG),NEQU), + & fluxriem1(FACE2d1(ifirst,ilast,FLUXG),NEQU), + & tracelft1(FACE2d1(ifirst,ilast,FACEG),NEQU), + & tracergt1(FACE2d1(ifirst,ilast,FACEG),NEQU) + integer ic0,ic1,k,ie0,ie1 +c*********************************************************************** +c initialize left and right states at cell edges +c (first-order upwind) +c*********************************************************************** + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif +c*********************************************************************** +c write(6,*) "in init_trace_flux" +c call flush(6) +c write(6,*) "ifirst0,ilast0,ifirst1,ilast1", +c & ifirst0,ilast0,ifirst1,ilast1 +c write(6,*) "cell ghosts ", CELLG +c write(6,*) "face ghosts ", FACEG +c call flush(6) + +c write(6,*) " " +c write(6,*) " In trace_init0" +trace_init(0,1,2,`ie0-1,ic1',`ie0,ic1')dnl + +c write(6,*) " " +c write(6,*) " In trace_init1" +trace_init(1,0,2,`ic0,ie1-1',`ic0,ie1')dnl +c write(6,*) " " + +c +c we initialize the flux to be 0 + + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 + do k=1,NEQU + fluxriem0(ie0,ic1,k) = zero + enddo + enddo + enddo +c + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 + do k=1,NEQU + fluxriem1(ie1,ic0,k) = zero + enddo + enddo + enddo +c +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing2d0(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & mc, dx, + & gamma,igdnv, + & sound, + & tracelft,tracergt, + & ttcelslp, ttedgslp, + & ttsound, + & ttraclft, ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx, gamma + REAL + & sound(CELL2d(ifirst,ilast,CELLG)) + REAL + & tracelft(FACE2d0(ifirst,ilast,FACEG),NEQU), + & tracergt(FACE2d0(ifirst,ilast,FACEG),NEQU) +c side variables ifirst0 to ifirst0+mc plus ghost cells + REAL + & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), + & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), + & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU) +c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG,NEQU), + & ttsound(ifirst0-CELLG:ifirst0+mc-1+CELLG) +c*********************************************************************** +c + integer ic0,ic1,k,idir +c*********************************************************************** +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** +c write(6,*) "traced right chartracing2d0" +c do ic1=ifirst1-FACEG,ilast1+FACEG +c do ic0=ifirst0-FACEG,ilast0+FACEG+1 +c write(6,*) "ic,state=",ic0,ic1, +c & tracergt(ic0,ic1,1),tracergt(ic0,ic1,2), +c & tracergt(ic0,ic1,3),tracergt(ic0,ic1,4) +c call flush(6) +c enddo +c enddo +c write(6,*) +c +c call flush(6) +c + idir = 0 +trace_call(0,1)dnl +c +c*********************************************************************** +c write(6,*) "leaving chartracing2d" +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing2d1(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & mc, dx, + & gamma,igdnv, + & sound, + & tracelft,tracergt, + & ttcelslp, ttedgslp, + & ttsound, + & ttraclft, ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx, gamma + REAL + & sound(CELL2d(ifirst,ilast,CELLG)) + REAL + & tracelft(FACE2d1(ifirst,ilast,FACEG),NEQU), + & tracergt(FACE2d1(ifirst,ilast,FACEG),NEQU) +c side variables ifirst1 to ifirst1+mc plus ghost cells + REAL + & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), + & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), + & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU) +c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG,NEQU), + & ttsound(ifirst1-CELLG:ifirst1+mc-1+CELLG) +c*********************************************************************** +c + integer ic0,ic1,k,idir +c*********************************************************************** +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** +c write(6,*) "Entering chartracing2d1" +c call flush(6) +c + idir = 1 +trace_call(1,0)dnl +c +c*********************************************************************** +c write(6,*) "leaving chartracing2d" +c call flush(6) + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace3d.m4 new file mode 100644 index 00000000..f0cc2853 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/fortran/trace3d.m4 @@ -0,0 +1,278 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for 3d trace. +c +define(NDIM,3)dnl +define(NEQU,5)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4trace3d.i)dnl + + subroutine computesound3d(ifirst0,ilast0,ifirst1,ilast1, + & ifirst2,ilast2,gamma,density,velocity,pressure,sound) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 +c variables indexed as 3dimensional + REAL + & gamma, + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),0:NDIM-1), + & pressure(CELL3d(ifirst,ilast,CELLG)), + & sound(CELL3d(ifirst,ilast,CELLG)) +c + integer ic0,ic1,ic2 +c +c*********************************************************************** +c + do ic0=ifirst0-CELLG,ilast0+CELLG + do ic1=ifirst1-CELLG,ilast1+CELLG + do ic2=ifirst2-CELLG,ilast2+CELLG + sound(ic0,ic1,ic2) = sqrt(max(smallr, + & gamma*pressure(ic0,ic1,ic2) + & /density(ic0,ic1,ic2))) + enddo + enddo + enddo + + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** +c + subroutine inittraceflux3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & density,velocity,pressure, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2, + & fluxriem0,fluxriem1,fluxriem2) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL + & density(CELL3d(ifirst,ilast,CELLG)), + & velocity(CELL3d(ifirst,ilast,CELLG),NDIM), + & pressure(CELL3d(ifirst,ilast,CELLG)), + & fluxriem0(FACE3d0(ifirst,ilast,FLUXG),NEQU), + & tracelft0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracergt0(FACE3d0(ifirst,ilast,FACEG),NEQU), + & fluxriem1(FACE3d1(ifirst,ilast,FLUXG),NEQU), + & tracelft1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracergt1(FACE3d1(ifirst,ilast,FACEG),NEQU), + & fluxriem2(FACE3d2(ifirst,ilast,FLUXG),NEQU), + & tracelft2(FACE3d2(ifirst,ilast,FACEG),NEQU), + & tracergt2(FACE3d2(ifirst,ilast,FACEG),NEQU) + integer ic0,ic1,k,ie0,ie1,ic2,ie2 +c*********************************************************************** +c initialize left and right states at cell edges +c (first-order upwind) +c*********************************************************************** + if (FLUXG.lt.1) then + write(6,*) "flux ghosts < 1!" + stop + endif +c +c*********************************************************************** + +trace_init(0,1,2,`ie0-1,ic1,ic2',`ie0,ic1,ic2')dnl + +trace_init(1,2,0,`ic0,ie1-1,ic2',`ic0,ie1,ic2')dnl + +trace_init(2,0,1,`ic0,ic1,ie2-1',`ic0,ic1,ie2')dnl + +c +c we initialize the flux to be 0 + + do ic2=ifirst2-FLUXG,ilast2+FLUXG + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 + do k=1,NEQU + fluxriem0(ie0,ic1,ic2,k) = zero + enddo + enddo + enddo + enddo +c + do ic2=ifirst2-FLUXG,ilast2+FLUXG + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 + do k=1,NEQU + fluxriem1(ie1,ic2,ic0,k) = zero + enddo + enddo + enddo + enddo +c + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie2=ifirst2-FLUXG,ilast2+FLUXG+1 + do k=1,NEQU + fluxriem2(ie2,ic0,ic1,k) = zero + enddo + enddo + enddo + enddo +c + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** +c + subroutine chartracing3d0(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc,dx, + & gamma,igdnv, + & sound, + & tracelft,tracergt, + & ttcelslp, ttedgslp, + & ttsound, + & ttraclft, ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx, gamma + REAL + & sound(CELL3d(ifirst,ilast,CELLG)) + REAL + & tracelft(FACE3d0(ifirst,ilast,FACEG),NEQU), + & tracergt(FACE3d0(ifirst,ilast,FACEG),NEQU) +c side variables ifirst0 to ifirst0+mc plus ghost cells + REAL + & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), + & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU), + & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG,NEQU) +c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG,NEQU), + & ttsound(ifirst0-CELLG:ifirst0+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,k,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 0 +trace_call(0,1,2)dnl +c*********************************************************************** + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing3d1(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc,dx, + & gamma,igdnv, + & sound, + & tracelft,tracergt, + & ttcelslp, ttedgslp, + & ttsound, + & ttraclft, ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx, gamma + REAL + & sound(CELL3d(ifirst,ilast,CELLG)) + REAL + & tracelft(FACE3d1(ifirst,ilast,FACEG),NEQU), + & tracergt(FACE3d1(ifirst,ilast,FACEG),NEQU) + REAL + & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), + & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU), + & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG,NEQU) +c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG,NEQU), + & ttsound(ifirst1-CELLG:ifirst1+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,k,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 1 +trace_call(1,2,0)dnl +c +c*********************************************************************** + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing3d2(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc,dx, + & gamma,igdnv, + & sound, + & tracelft,tracergt, + & ttcelslp, ttedgslp, + & ttsound, + & ttraclft, ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx, gamma + REAL + & sound(CELL3d(ifirst,ilast,CELLG)) + REAL + & tracelft(FACE3d2(ifirst,ilast,FACEG),NEQU), + & tracergt(FACE3d2(ifirst,ilast,FACEG),NEQU) + REAL + & ttedgslp(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU), + & ttraclft(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU), + & ttracrgt(ifirst2-FACEG:ifirst2+mc+FACEG,NEQU) +c cell variables ifirst2 to ifirst2+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst2-CELLG:ifirst2+mc-1+CELLG,NEQU), + & ttsound(ifirst2-CELLG:ifirst2+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,k,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 2 +trace_call(2,0,1)dnl +c +c*********************************************************************** + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.C b/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.C index e15c62e1..9f035846 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.h b/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.h index dcd20e05..ef222272 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/intToString.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/main.C b/base/SAMRAI/SAMRAI/source/test/performance/Euler/main.C index fa3d6cb2..773801ab 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/main.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/main.C @@ -3,84 +3,69 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI Euler gas dynamics sample application * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" -#include -#include -#include -#include -using namespace std; - -#ifndef _MSC_VER -#include -#endif - -#include - -// Headers for basic SAMRAI objects +// Header for application-specific algorithm/data structure object -#include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/hier/BoxList.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/tbox/InputDatabase.h" -#include "SAMRAI/tbox/InputManager.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/RestartManager.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/Timer.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/hier/VariableDatabase.h" +#include "Euler.h" // Headers for major algorithm/data structure objects from SAMRAI -#include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/geom/CartesianGridGeometry.h" + #include "SAMRAI/mesh/GriddingAlgorithm.h" +#include "SAMRAI/mesh/StandardTagAndInitialize.h" +#include "SAMRAI/mesh/BergerRigoutsos.h" +#include "SAMRAI/mesh/TileClustering.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/CascadePartitioner.h" +#include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" + #include "SAMRAI/algs/HyperbolicLevelIntegrator.h" #include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/algs/TimeRefinementIntegrator.h" #include "SAMRAI/algs/TimeRefinementLevelStrategy.h" #include "SAMRAI/appu/VisItDataWriter.h" -#define RECORD_STATS -//#undef RECORD_STATS -#ifdef RECORD_STATS -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" -#endif - -// Header for application-specific algorithm/data structure object +// Headers for basic SAMRAI objects -#include "Euler.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/Index.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/SiloDatabaseFactory.h" +#include "SAMRAI/tbox/InputDatabase.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/PIO.h" +#include "SAMRAI/tbox/RestartManager.h" +#include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/tbox/Timer.h" +#include "SAMRAI/tbox/TimerManager.h" -// Classes for autotesting. +#include "boost/shared_ptr.hpp" +#include +#include +#include +#include +using namespace std; -#if (TESTING == 1) -#include "AutoTester.h" +#ifndef _MSC_VER +#include #endif -#include - -void -outputStats( - mesh::GriddingAlgorithm& gridding_algorithm, - algs::HyperbolicLevelIntegrator& hyp_level_integrator); +#include using namespace SAMRAI; -using namespace tbox; - /* ************************************************************************ * @@ -173,14 +158,6 @@ using namespace tbox; * executable \ * * - * Accessory routines used within the main program: - * - * dumpVizData1dPencil - Writes 1d pencil of Euler solution data - * to plot files so that it may be viewed in MatLab. This - * routine assumes a single patch level in 2d and 3d. In - * other words, it only plots data on level zero. It can - * handle AMR in 1d. - * ******************************************************************* */ @@ -196,56 +173,60 @@ int main( tbox::SAMRAI_MPI::init(&argc, &argv); tbox::SAMRAIManager::initialize(); tbox::SAMRAIManager::startup(); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); int num_failures = 0; { - const tbox::Dimension dim(NDIM); - string input_filename; - string restart_read_dirname; - int restore_num = 0; string case_name; - - bool is_from_restart = false; + int scale_size = mpi.getSize(); if ((argc != 2) && (argc != 3) && (argc != 4)) { - pout << "USAGE:\n" - << argv[0] << " " - << "or\n" - << argv[0] << " " - << "or\n" - << argv[0] << " " - << " [options]\n" - << " options:\n" - << " none at this time" - << endl; + tbox::pout << "USAGE:\n" + << argv[0] << " " + << "or\n" + << argv[0] << " " + << "or\n" + << argv[0] << " " + << endl; tbox::SAMRAI_MPI::abort(); return -1; } else { input_filename = argv[1]; - - if (argc == 3) { + if (argc > 2) { case_name = argv[2]; } - if (argc == 4) { - restart_read_dirname = argv[2]; - restore_num = atoi(argv[3]); - - is_from_restart = true; + if (argc > 3) { + scale_size = atoi(argv[3]); } } - plog << "input_filename = " << input_filename << endl; - plog << "restart_read_dirname = " << restart_read_dirname << endl; - plog << "restore_num = " << restore_num << endl; + tbox::pout << "input_filename = " << input_filename << endl; + tbox::pout << "case_name = " << case_name << std::endl; + tbox::pout << "scale_size = " << scale_size << std::endl; /* * Create input database and parse all data in input file. */ - boost::shared_ptr input_db(new InputDatabase("input_db")); - InputManager::getManager()->parseInputFile(input_filename, input_db); + boost::shared_ptr input_db( + new tbox::InputDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + /* + * Setup the timer manager to trace timing statistics during execution + * of the code. The list of timers is given in the TimerManager + * section of the input file. Timing information is stored in the + * restart file. Timers will automatically be initialized to their + * previous state if the run is restarted, unless they are explicitly + * reset using the TimerManager::resetAllTimers() routine. + */ + + tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); + boost::shared_ptr t_all = + tbox::TimerManager::getManager()->getTimer("appu::main::all"); + t_all->start(); /* * Retrieve "Main" section of the input database. First, read dump @@ -254,38 +235,39 @@ int main( * restart interval is non-zero, create a restart database. */ - boost::shared_ptr main_db(input_db->getDatabase("Main")); + boost::shared_ptr main_db(input_db->getDatabase("Main")); string base_name = main_db->getStringWithDefault("base_name", "unnamed"); + const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + /* * Modify basename for this particular run. * Add the number of processes and the case name. */ + string base_name_ext = base_name; if (!case_name.empty()) { - base_name = base_name + '-' + case_name; + base_name_ext = base_name_ext + '-' + case_name; } - base_name = base_name + '-' + tbox::Utilities::intToString( - SAMRAI_MPI::getNodes(), - 5); - pout << "Added case name (" << case_name << ") and nprocs (" - << SAMRAI_MPI::getNodes() << ") to base name -> '" - << base_name << "'\n"; + base_name_ext = base_name_ext + '-' + tbox::Utilities::nodeToString(scale_size); + tbox::pout << "Added case name (" << case_name << ") and nprocs (" + << mpi.getSize() << ") to base name -> '" + << base_name_ext << "'\n"; /* * Logging. */ - string log_filename = base_name + ".log"; + string log_filename = base_name_ext + ".log"; log_filename = - main_db->getStringWithDefault("log_filename", base_name + ".log"); + main_db->getStringWithDefault("log_filename", base_name_ext + ".log"); bool log_all_nodes = false; log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", log_all_nodes); if (log_all_nodes) { - PIO::logAllNodes(log_filename); + tbox::PIO::logAllNodes(log_filename); } else { - PIO::logOnlyNodeZero(log_filename); + tbox::PIO::logOnlyNodeZero(log_filename); } int viz_dump_interval = 0; @@ -293,38 +275,25 @@ int main( viz_dump_interval = main_db->getInteger("viz_dump_interval"); } - Array viz_writer(1); - viz_writer[0] = "VisIt"; - string viz_dump_filename; - string visit_dump_dirname = base_name + ".visit"; + string visit_dump_dirname = base_name_ext + ".visit"; bool uses_visit = false; int visit_number_procs_per_file = 1; if (viz_dump_interval > 0) { - if (main_db->keyExists("viz_writer")) { - viz_writer = main_db->getStringArray("viz_writer"); - } - if (main_db->keyExists("viz_dump_filename")) { - viz_dump_filename = main_db->getString("viz_dump_filename"); - } - string viz_dump_dirname = base_name; + uses_visit = true; + string viz_dump_dirname = base_name_ext; if (main_db->keyExists("viz_dump_dirname")) { viz_dump_dirname = main_db->getString("viz_dump_dirname"); } - for (int i = 0; i < viz_writer.getSize(); i++) { - if (viz_writer[i] == "VisIt") uses_visit = true; - } visit_dump_dirname = viz_dump_dirname + ".visit"; - if (uses_visit) { - if (viz_dump_dirname.empty()) { - TBOX_ERROR("main(): " - << "\nviz_dump_dirname is null ... " - << "\nThis must be specified for use with VisIt" - << endl); - } - if (main_db->keyExists("visit_number_procs_per_file")) { - visit_number_procs_per_file = - main_db->getInteger("visit_number_procs_per_file"); - } + if (viz_dump_dirname.empty()) { + TBOX_ERROR("main(): " + << "\nviz_dump_dirname is null ... " + << "\nThis must be specified for use with VisIt" + << endl); + } + if (main_db->keyExists("visit_number_procs_per_file")) { + visit_number_procs_per_file = + main_db->getInteger("visit_number_procs_per_file"); } } @@ -352,44 +321,9 @@ int main( } } -#if (TESTING == 1) && !(HAVE_HDF5) - /* - * If we are autotesting on a system w/o HDF5, the read from - * restart will result in an error. We want this to happen - * for users, so they know there is a problem with the restart, - * but we don't want it to happen when autotesting. - */ - is_from_restart = false; - restart_interval = 0; -#endif - const bool write_restart = (restart_interval > 0) && !(restart_write_dirname.empty()); - /* - * Get restart manager and root restart database. If run is from - * restart, open the restart file. - */ - - RestartManager* restart_manager = RestartManager::getManager(); - - if (is_from_restart) { - restart_manager-> - openRestartFile(restart_read_dirname, restore_num, - tbox::SAMRAI_MPI::getNodes()); - } - - /* - * Setup the timer manager to trace timing statistics during execution - * of the code. The list of timers is given in the TimerManager - * section of the input file. Timing information is stored in the - * restart file. Timers will automatically be initialized to their - * previous state if the run is restarted, unless they are explicitly - * reset using the TimerManager::resetAllTimers() routine. - */ - - TimerManager::createManager(input_db->getDatabase("TimerManager")); - /* * Create major algorithm and data objects which comprise application. * Each object is initialized either from input data or restart @@ -400,6 +334,7 @@ int main( boost::shared_ptr grid_geometry( new geom::CartesianGridGeometry( + dim, "CartesianGeometry", input_db->getDatabase("CartesianGeometry"))); @@ -410,6 +345,7 @@ int main( input_db->getDatabase("PatchHierarchy"))); Euler* euler_model = new Euler("Euler", + dim, input_db->getDatabase("Euler"), grid_geometry); @@ -418,43 +354,117 @@ int main( "HyperbolicLevelIntegrator", input_db->getDatabase("HyperbolicLevelIntegrator"), euler_model, - true, use_refined_timestepping)); boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( "StandardTagAndInitialize", - hyp_level_integrator, + hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); - boost::shared_ptr abr_db( - input_db->getDatabase("BergerRigoutsos")); - boost::shared_ptr new_box_generator( - new mesh::BergerRigoutsos(abr_db)); -#if 0 - boost::shared_ptr > old_box_generator; - const char which_br = main_db->getCharWithDefault("which_br", 'o'); - boost::shared_ptr box_generator( - which_br == 'o' - ? boost::shared_ptr(old_box_generator) - : boost::shared_ptr(new_box_generator)); -#endif + // Set up the clustering. - boost::shared_ptr load_balancer( - new mesh::TreeLoadBalancer( - dim, - "TreeLoadBalancer", - input_db->getDatabase("TreeLoadBalancer"))); - load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + const std::string clustering_type = + main_db->getStringWithDefault("clustering_type", "BergerRigoutsos"); + + boost::shared_ptr box_generator; + + if (clustering_type == "BergerRigoutsos") { + + boost::shared_ptr abr_db( + input_db->getDatabase("BergerRigoutsos")); + boost::shared_ptr berger_rigoutsos( + new mesh::BergerRigoutsos(dim, abr_db)); + box_generator = berger_rigoutsos; + + } else if (clustering_type == "TileClustering") { + + boost::shared_ptr tc_db( + input_db->getDatabase("TileClustering")); + boost::shared_ptr tile_clustering( + new mesh::TileClustering(dim, tc_db)); + box_generator = tile_clustering; + + } + + // Set up the load balancer. + + boost::shared_ptr load_balancer; + boost::shared_ptr load_balancer0; + + const std::string partitioner_type = + main_db->getStringWithDefault("partitioner_type", "TreeLoadBalancer"); + + if (partitioner_type == "TreeLoadBalancer") { + + boost::shared_ptr tree_load_balancer( + new mesh::TreeLoadBalancer( + dim, + "mesh::TreeLoadBalancer", + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); + tree_load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + boost::shared_ptr tree_load_balancer0( + new mesh::TreeLoadBalancer( + dim, + "mesh::TreeLoadBalancer0", + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new tbox::BalancedDepthFirstTree))); + tree_load_balancer0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + load_balancer = tree_load_balancer; + load_balancer0 = tree_load_balancer0; + } else if (partitioner_type == "CascadePartitioner") { + + boost::shared_ptr cascade_partitioner( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + boost::shared_ptr cascade_partitioner0( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner0", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + load_balancer = cascade_partitioner; + load_balancer0 = cascade_partitioner0; + } else if (partitioner_type == "ChopAndPackLoadBalancer") { + + boost::shared_ptr cap_load_balancer( + new mesh::ChopAndPackLoadBalancer( + dim, + "mesh::ChopAndPackLoadBalancer", + input_db->getDatabase("ChopAndPackLoadBalancer"))); + + load_balancer = cap_load_balancer; + + /* + * ChopAndPackLoadBalancer has trouble on L0 for some reason. + * Work around by using the CascadePartitioner for L0. + */ + boost::shared_ptr cascade_partitioner0( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner0", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + load_balancer0 = cascade_partitioner0; + } boost::shared_ptr gridding_algorithm( new mesh::GriddingAlgorithm( - dim, + patch_hierarchy, "GriddingAlgorithm", input_db->getDatabase("GriddingAlgorithm"), error_detector, - new_box_generator, - load_balancer)); + box_generator, + load_balancer, + load_balancer0)); boost::shared_ptr time_integrator( new algs::TimeRefinementIntegrator( @@ -473,6 +483,7 @@ int main( #ifdef HAVE_HDF5 boost::shared_ptr visit_data_writer( new appu::VisItDataWriter( + dim, "Euler VisIt Writer", visit_dump_dirname, visit_number_procs_per_file)); @@ -486,45 +497,18 @@ int main( * Then, close restart file and write initial state for visualization. */ - hier::Connector dummy; // Cause communicator set-up before performance timings. tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); // Synchronize for the sake of accurate timings. double dt_now = time_integrator->initializeHierarchy(); - RestartManager::getManager()->closeRestartFile(); - -#if (TESTING == 1) - /* - * Create the autotesting component which will verify correctness - * of the problem. If no automated testing is done, the object does - * not get used. - */ - AutoTester autotester("AutoTester", input_db); -#endif - - /* - * After creating all objects and initializing their state, we - * print the input database and variable database contents - * to the log file. - */ - -#if 1 - plog << "\nCheck input data and variables before simulation:" << endl; - plog << "Input database..." << endl; - input_db->printClassData(plog); - plog << "\nVariable database..." << endl; - hier::VariableDatabase::getDatabase()->printClassData(plog); - -#endif - plog << "\nCheck Euler data... " << endl; - euler_model->printClassData(plog); + tbox::RestartManager::getManager()->closeRestartFile(); /* * Create timers for measuring I/O. */ - boost::shared_ptr t_write_viz( - TimerManager::getManager()->getTimer("apps::main::write_viz")); - boost::shared_ptr t_write_restart( - TimerManager::getManager()->getTimer("apps::main::write_restart"); + boost::shared_ptr t_write_viz( + tbox::TimerManager::getManager()->getTimer("apps::main::write_viz")); + boost::shared_ptr t_write_restart( + tbox::TimerManager::getManager()->getTimer("apps::main::write_restart")); t_write_viz->start(); if (viz_dump_interval > 0) { @@ -539,6 +523,9 @@ int main( } t_write_viz->stop(); + tbox::plog << "Input database before time-step loop:" << std::endl; + input_db->printClassData(tbox::plog); + /* * Time step loop. Note that the step count and integration * time are maintained by algs::TimeRefinementIntegrator. @@ -547,74 +534,41 @@ int main( double loop_time = time_integrator->getIntegratorTime(); double loop_time_end = time_integrator->getEndTime(); -#if (TESTING == 1) - /* - * If we are doing autotests, check result... - */ - num_failures += autotester.evalTestData( - time_integrator->getIntegratorStep(), - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); -#endif - while ((loop_time < loop_time_end) && time_integrator->stepsRemaining()) { int iteration_num = time_integrator->getIntegratorStep() + 1; - plog << endl << endl; - pout << "++++++++++++++++++++++++++++++++++++++++++++" << endl; - pout << "At begining of timestep # " << iteration_num - 1 << endl; - pout << "Simulation time is " << loop_time << endl; - pout << "Current dt is " << dt_now << endl; - pout << "++++++++++++++++++++++++++++++++++++++++++++\n\n" << endl; - plog << endl << endl; + tbox::plog << endl << endl; + tbox::pout << "++++++++++++++++++++++++++++++++++++++++++++" << endl; + tbox::pout << "At begining of timestep # " << iteration_num - 1 << endl; + tbox::pout << "Simulation time is " << loop_time << endl; + tbox::pout << "Current dt is " << dt_now << endl; + tbox::pout << "++++++++++++++++++++++++++++++++++++++++++++\n\n" << endl; + tbox::plog << endl << endl; double dt_new = time_integrator->advanceHierarchy(dt_now); loop_time += dt_now; dt_now = dt_new; -#if 0 - int hierarchy_cell_count = 0; - for (int ln = 0; ln < patch_hierarchy->getNumberLevels(); ++ln) { - int level_cell_count = 0; - boost::shared_ptr patch_level( - patch_hierarchy->getPatchLevel(ln)); - for (hier::PatchLevel::iterator pi(patch_level->begin()); - pi != patch_level->end(); ++pi) { - boost::shared_ptr patch( - patch_level->getPatch(*pi)); - level_cell_count += patch->getBox().size(); - } - cell_count_stat[ln]->recordProcStat(level_cell_count); - hierarchy_cell_count += level_cell_count; - } - for (int ln = patch_hierarchy->getNumberLevels(); - ln < patch_hierarchy->getMaxNumberOfLevels(); ++ln) { - cell_count_stat[ln]->recordProcStat(0); + if (0) { + /* + * Logging can be very slow on I/O limited machines (such as + * BlueGene). + */ + tbox::plog << "Hierarchy summary:\n"; + patch_hierarchy->recursivePrint(tbox::plog, "H-> ", 1); + tbox::plog << "PatchHierarchy summary:\n"; + patch_hierarchy->recursivePrint(tbox::plog, "L->", 1); } - cell_count_stat[patch_hierarchy->getMaxNumberOfLevels()]-> - recordProcStat(hierarchy_cell_count); - patch_hierarchy->recursivePrint(plog, "", 2); - sim_time_stat->recordProcStat(dt_now); -#endif - - plog << "Hierarchy summary:\n"; - patch_hierarchy->recursivePrint(plog, "H-> ", 1); - plog << "PatchHierarchy summary:\n"; - patch_hierarchy->recursivePrint(plog, - "H-> ", - 1); - plog << endl << endl; - pout << "\n\n++++++++++++++++++++++++++++++++++++++++++++" << endl; - pout << "At end of timestep # " << iteration_num - 1 << endl; - pout << "Simulation time is " << loop_time << endl; - pout << "++++++++++++++++++++++++++++++++++++++++++++\n\n" << endl; - plog << endl << endl; + tbox::plog << endl << endl; + tbox::pout << "\n\n++++++++++++++++++++++++++++++++++++++++++++" << endl; + tbox::pout << "At end of timestep # " << iteration_num - 1 << endl; + tbox::pout << "Simulation time is " << loop_time << endl; + tbox::pout << "++++++++++++++++++++++++++++++++++++++++++++\n\n" << endl; + tbox::plog << endl << endl; /* * At specified intervals, write restart files. @@ -623,7 +577,7 @@ int main( if ((iteration_num % restart_interval) == 0) { t_write_restart->start(); - RestartManager::getManager()-> + tbox::RestartManager::getManager()-> writeRestartFile(restart_write_dirname, iteration_num); t_write_restart->stop(); @@ -647,39 +601,63 @@ int main( } t_write_viz->stop(); -#if (TESTING == 1) /* - * If we are doing autotests, check result... + * Output statistics. */ - num_failures += autotester.evalTestData(iteration_num, - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); -#endif + tbox::plog << "HyperbolicLevelIntegrator statistics:" << endl; + hyp_level_integrator->printStatistics(tbox::plog); + tbox::plog << "\nGriddingAlgorithm statistics:" << endl; + gridding_algorithm->printStatistics(tbox::plog); - /* - * Write byte transfer information to log file. - */ -#if 0 - char num_buf[8]; - sprintf(num_buf, "%02d", iteration_num); - tbox::plog << "Step " << num_buf - << " P" << tbox::SAMRAI_MPI::getRank() - << ": " << tbox::SAMRAI_MPI::getIncomingBytes() - << " bytes in" << endl; -#endif + } // End time-stepping loop. - } + t_all->stop(); + + tbox::plog << "Input database after time-step loop:" << std::endl; + input_db->printClassData(tbox::plog); /* * Output timer results. */ - TimerManager::getManager()->print(plog); + tbox::TimerManager::getManager()->print(tbox::plog); -#ifdef RECORD_STATS - outputStats(*gridding_algorithm, *hyp_level_integrator); -#endif + if (partitioner_type == "TreeLoadBalancer") { + /* + * Output load balancing results for TreeLoadBalancer. + */ + boost::shared_ptr tree_load_balancer( + BOOST_CAST( + load_balancer)); + TBOX_ASSERT(tree_load_balancer); + tbox::plog << "\n\n" << partitioner_type << " partitioning results:\n"; + tree_load_balancer->printStatistics(tbox::plog); + } + if (partitioner_type == "CascadePartitioner") { + /* + * Output load balancing results for CascadePartitioner. + */ + boost::shared_ptr cascade_partitioner( + BOOST_CAST( + load_balancer)); + TBOX_ASSERT(cascade_partitioner); + tbox::plog << "\n\n" << partitioner_type << " partitioning results:\n"; + cascade_partitioner->printStatistics(tbox::plog); + } + + /* + * Output box search results. + */ + tbox::plog << "\n\nBox searching results:\n"; + hier::BoxTree::printStatistics(dim); + + int size = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + if (tbox::SAMRAI_MPI::getSAMRAIWorld().getRank() == 0) { + string timing_file = + base_name + ".timing" + tbox::Utilities::intToString(size); + FILE* fp = fopen(timing_file.c_str(), "w"); + fprintf(fp, "%f\n", t_all->getTotalWallclockTime()); + fclose(fp); + } /* * At conclusion of simulation, deallocate objects. @@ -687,7 +665,7 @@ int main( patch_hierarchy.reset(); grid_geometry.reset(); - new_box_generator.reset(); + box_generator.reset(); load_balancer.reset(); hyp_level_integrator.reset(); error_detector.reset(); @@ -712,18 +690,3 @@ int main( return num_failures; } - -#ifdef RECORD_STATS -void outputStats( - mesh::GriddingAlgorithm& gridding_algorithm, - algs::HyperbolicLevelIntegrator& hyp_level_integrator) -{ - /* - * Output statistics. - */ - tbox::plog << "HyperbolicLevelIntegrator statistics:" << endl; - hyp_level_integrator.printStatistics(tbox::plog); - tbox::plog << "\nGriddingAlgorithm statistics:" << endl; - gridding_algorithm.printStatistics(tbox::plog); -} -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l1x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l1x.input index 0a38fec4..e317cca8 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l1x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l1x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-2l1x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-2l1x" + dim = 3 + base_name = "sphere-2l1x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,9 +244,9 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { @@ -246,8 +256,8 @@ PatchHierarchy { } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -255,11 +265,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -268,7 +274,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -278,20 +284,3 @@ TimeRefinementIntegrator { max_integrator_steps = 100 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l2x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l2x.input index a73f3972..1d84bb80 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l2x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l2x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-2l2x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-2l2x" + dim = 3 + base_name = "sphere-2l2x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,30 +244,28 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 // all finer levels will use same values as level_0... } + allow_patches_smaller_than_ghostwidth = TRUE } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -266,7 +274,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -276,20 +284,3 @@ TimeRefinementIntegrator { max_integrator_steps = 100 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l4x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l4x.input index a2872be0..38dfc38c 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l4x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l4x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,62 +143,98 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-2l4x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-2l4x" + dim = 3 + base_name = "sphere-2l4x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (31, 31, 31) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. @@ -234,19 +247,20 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -254,11 +268,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -267,7 +277,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -277,20 +287,3 @@ TimeRefinementIntegrator { max_integrator_steps = 100 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l8x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l8x.input index 1ca49753..159ac8ab 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l8x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-2l8x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,62 +143,98 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-2l8x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-2l8x" + dim = 3 + base_name = "sphere-2l8x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (31, 31, 31) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. @@ -234,19 +247,20 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -254,11 +268,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -267,7 +277,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -277,20 +287,3 @@ TimeRefinementIntegrator { max_integrator_steps = 100 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l1x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l1x.input index a26abd61..054e1680 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l1x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l1x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-3l1x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-3l1x" + dim = 3 + base_name = "sphere-3l1x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,9 +244,9 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { @@ -246,9 +256,9 @@ PatchHierarchy { } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -256,12 +266,7 @@ PatchHierarchy { } GriddingAlgorithm { - - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -270,30 +275,13 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { start_time = 0.e0 // initial simulation time - end_time = 0.0500 // final simulation time + end_time = 0.1000 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 37 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l2x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l2x.input index 8cb680d8..191fd86e 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l2x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l2x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-3l2x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-3l2x" + dim = 3 + base_name = "sphere-3l2x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,20 +244,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -255,11 +266,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -268,30 +275,13 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { start_time = 0.e0 // initial simulation time - end_time = 0.0500 // final simulation time + end_time = 0.1000 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 37 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l4x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l4x.input index c3d0e312..4595c16f 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l4x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l4x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-3l4x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-3l4x" + dim = 3 + base_name = "sphere-3l4x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,20 +244,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -255,11 +266,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -268,30 +275,13 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { start_time = 0.e0 // initial simulation time - end_time = 0.0500 // final simulation time + end_time = 0.1000 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 37 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l8x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l8x.input index 24c92a7d..3c62f6a7 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l8x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-3l8x.input @@ -1,35 +1,12 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ - -// 2-level Euler strong scaling performance test. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -53,18 +30,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -72,7 +49,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -166,63 +143,96 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-3l8x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_child_steps = FALSE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + // Main is used only by the new code. Main { - base_name = "spnew-3l8x" + dim = 3 + base_name = "sphere-3l8x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer + +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 -// restart dump parameters +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { - // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] - // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] + domain_boxes = [ (0, 0, 0) , (35, 35, 35) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. } @@ -234,20 +244,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 8, 8, 8 + level_1 = 8, 8, 8 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -255,11 +266,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -268,30 +275,13 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { start_time = 0.e0 // initial simulation time - end_time = 0.0500 // final simulation time + end_time = 0.1000 // final simulation time grow_dt = 1.1e0 // growth factor for timesteps max_integrator_steps = 37 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l1x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l1x.input index 21389fbb..efd4ee55 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l1x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l1x.input @@ -1,37 +1,16 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ // 4-level Euler strong scaling performance test. // The 1x version is set up to do about 28.4 cell updates. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -55,18 +34,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -74,7 +53,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -168,65 +147,110 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-4l1x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + // Main is used only by the new code. Main { - base_name = "spnew-4l1x" + dim = 3 + base_name = "sphere-4l1x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer -// restart dump parameters +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 + +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. + x_up = 2.e0, 2.e0, 2.e0 // upper end of computational domain. } StandardTagAndInitialize { @@ -236,9 +260,9 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { @@ -248,9 +272,9 @@ PatchHierarchy { } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -258,11 +282,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -271,7 +291,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -281,20 +301,3 @@ TimeRefinementIntegrator { max_integrator_steps = 19 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l2x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l2x.input index 6a82f0a1..d062fb27 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l2x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l2x.input @@ -1,37 +1,16 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ // 4-level Euler strong scaling performance test. // The 1x version is set up to do about 28.4 cell updates. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -55,18 +34,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -74,7 +53,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -168,65 +147,110 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-4l2x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + // Main is used only by the new code. Main { - base_name = "spnew-4l2x" + dim = 3 + base_name = "sphere-4l2x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer -// restart dump parameters +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 + +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. + x_up = 2.e0, 2.e0, 2.e0 // upper end of computational domain. } StandardTagAndInitialize { @@ -236,20 +260,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -257,11 +282,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -270,7 +291,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -280,20 +301,3 @@ TimeRefinementIntegrator { max_integrator_steps = 19 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l4x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l4x.input index d5d9f325..87d799be 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l4x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l4x.input @@ -1,37 +1,16 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ // 4-level Euler strong scaling performance test. // The 1x version is set up to do about 28.4 cell updates. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -55,18 +34,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -74,7 +53,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -168,65 +147,110 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-4l4x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + // Main is used only by the new code. Main { - base_name = "spnew-4l4x" + dim = 3 + base_name = "sphere-4l4x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer -// restart dump parameters +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 + +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. + x_up = 2.e0, 2.e0, 2.e0 // upper end of computational domain. } StandardTagAndInitialize { @@ -236,20 +260,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -257,11 +282,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -270,7 +291,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -280,20 +301,3 @@ TimeRefinementIntegrator { max_integrator_steps = 19 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l8x.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l8x.input index 139d2e44..e80c8629 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l8x.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/Euler/performance_inputs/mEuler/sphere-4l8x.input @@ -1,37 +1,16 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d sphere) + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Euler example problem (3d sphere) * ************************************************************************/ // 4-level Euler strong scaling performance test. // The 1x version is set up to do about 28.4 cell updates. -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -GlobalInputs { - //use_new_comm_sched = FALSE // uncomment to turn on OLD - use_newest_comm_sched = TRUE // uncomment to turn on NEW - //use_old_method_for_clustering = TRUE // uncomment to turn on OLD -} - Euler { gamma = 1.4 // gamma = Ratio of specific heats @@ -55,18 +34,18 @@ Euler { pressure_inside = 1140.35 density_outside = 1.0 - velocity_outside = 0.0 , 0.0, 0.0 + velocity_outside = 0.0 , 0.0, 0.0 pressure_outside = 0.00001 } Refinement_data { refine_criteria = "PRESSURE_GRADIENT" - + PRESSURE_GRADIENT { grad_tol = 100.0 } - + PRESSURE_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -74,7 +53,7 @@ Euler { PRESSURE_DEVIATION { dev_tol = 0.01 - pressure_dev = 0.01 + pressure_dev = 0.01 } } @@ -168,65 +147,110 @@ Euler { BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE sort_output_nodes = TRUE - log_cluster_summary = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } -// BaselineMain is used only by the baseline code. -BaselineMain { - base_name = "spbsl-4l8x" - log_all_nodes = TRUE +TileClustering { + tile_size = 3,3,3 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai +ChopAndPackLoadBalancer{ + // bin_pack_method = "GREEDY" + bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 500 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} - // which_br: 'o' = old, 'n' = new - which_br = 'o' +TreeLoadBalancer { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + max_cycle_spread_procs = 1000 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = FALSE } + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + // Main is used only by the new code. Main { - base_name = "spnew-4l8x" + dim = 3 + base_name = "sphere-4l8x" log_all_nodes = TRUE -// visualization dump parameters - viz_writer = "VisIt" - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai + clustering_type = "TileClustering" // TileClustering || BergerRigoutsos + partitioner_type = "CascadePartitioner" // CascadePartitioner || TreeLoadBalancer || ChopAndPackLoadBalancer -// restart dump parameters +// visualization dump parameters + viz_dump_interval = 1 // zero to turn off + visit_number_procs_per_file = 1 + +// restart dump parameters restart_interval = 0 // zero to turn off restart_write_dirname = "restart_sphere3d" } TimerManager{ - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE + // timer_list = "*::*::*" + // timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" + timer_list = "appu::main::all" + print_user = TRUE + // print_timer_overhead = TRUE + print_threshold = 0 + print_summed = TRUE + print_max = TRUE } CartesianGeometry { // domain_boxes = [ (0, 0, 0) , (49, 49, 49) ] - domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + // domain_boxes = [ (0, 0, 0) , (63, 63, 63) ] + domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] // domain_boxes = [ (0, 0, 0) , (7, 7, 7) ] x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 4.e0, 4.e0, 4.e0 // upper end of computational domain. + x_up = 2.e0, 2.e0, 2.e0 // upper end of computational domain. } StandardTagAndInitialize { @@ -236,20 +260,21 @@ StandardTagAndInitialize { PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 + level_1 = 4 , 4 , 4 + level_2 = 4 , 4 , 4 + level_3 = 4 , 4 , 4 } largest_patch_size { - level_0 = 19, 19, 19 // largest patch allowed in hierarchy + // level_0 = 32, 32, 32 // largest patch allowed in hierarchy + level_0 = -1, -1, -1 // No limit on largest patch. // all finer levels will use same values as level_0... } smallest_patch_size { - level_0 = 8, 8, 8 - level_1 = 8, 8, 8 - level_2 = 8, 8, 8 + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 8, 8, 8 // all finer levels will use same values as level_0... } @@ -257,11 +282,7 @@ PatchHierarchy { } GriddingAlgorithm { - efficiency_tolerance = 0.90e0 // min % of tag cells in new patch level - combine_efficiency = 0.90e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box - barrier_before_clustering = FALSE - sequentialize_patch_indices = FALSE + sequentialize_patch_indices = TRUE check_nonrefined_tags = "IGNORE" } @@ -270,7 +291,7 @@ HyperbolicLevelIntegrator { cfl_init = 0.1e0 // initial cfl factor lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + // DEV_distinguish_mpi_reduction_costs = TRUE } TimeRefinementIntegrator { @@ -280,20 +301,3 @@ TimeRefinementIntegrator { max_integrator_steps = 19 // max number of simulation timesteps // max_integrator_steps = 1 // max number of simulation timesteps } - -// DistributedLoadBalancer is used by the new code. -DistributedLoadBalancer { - report_load_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -// LoadBalancer is used by the new code. -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/box-3d.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/box-3d.input deleted file mode 100644 index e6e8b7c0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/box-3d.input +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d box) - * - ************************************************************************/ - -Euler { - use_nonuniform_workload = TRUE - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - corner_transport = "CORNER_TRANSPORT_2" - - data_problem = "SPHERE" - - Initial_data { - radius = 0.125 - center = 0.5 , 0.5 , 0.5 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 - pressure_outside = 1.0 - - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 10.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for an edge, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge boundary values - // will be the same regardless of which face is used. - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent faces have either FLOW - // or REFLECT conditions, the resulting node boundary values - // will be the same regardless of which face is used. - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -Main { -// log file parameters - log_file_name = "box-3d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_box3d" - viz_dump_filename = "box3d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 1 // zero to turn off - restart_write_dirname = "restart_box3d" -} - -TimerManager { - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0,0.e0,0.e0 // lower end of computational domain. - x_up = 1.e0,1.e0,1.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2,2,2 - level_2 = 2,2,2 - } - - largest_patch_size { - level_0 = 10, 10, 10 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8, 8, 8 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} - -BergerRigoutsos { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-2d.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-2d.input deleted file mode 100644 index c95f6b20..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-2d.input +++ /dev/null @@ -1,203 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (2d room) - * - ************************************************************************/ -check_input_connectors = 'y' -check_output_connectors = 'y' -DistributedLoadBalancer_print_steps = 'y' -DistributedLoadBalancer_check_connectivity = 'y' -check_connectivity = 'y' -print_steps = 'y' -print_break_steps = 'y' -print_edge_steps = 'y' - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "SPHERE" - - Initial_data { - radius = 6.0 - center = 34.0 , 28.0 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 - pressure_outside = 1.0 - - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 10.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "REFLECT" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "XREFLECT" - } - } -} - -Main { - base_name = "room-2d" -// log file parameters - log_file_name = "room-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - // viz_dump_dirname = "viz_room2d" - // viz_dump_filename = "room2d" // not used by VisIt - visit_file_cluster_size = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_room2d" -} - -TimerManager{ - // print_exclusive = TRUE // output exclusive time - // timer_list = "*::*::*" - timer_list = "hier::*::*", "mesh::*::*", "xfer::*::*", "algs::*::*", "apps::*::*" - print_user = TRUE - // print_timer_overhead = TRUE - print_threshold = 0 - print_summed = TRUE - print_max = TRUE -} - -CartesianGeometry{ - domain_boxes = [(0,9),(14,20)], - [(0,21),(19,35)], - [(0,36),(14,49)], - [(20,0),(49,54)], - [(50,0),(64,35)], - [(50,46),(64,54)], - [(57,36),(64,45)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 65.e0 , 55.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - - largest_patch_size { - level_0 = 48 , 48 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 4 , 4 - level_1 = 8 , 8 - // all finer levels will use same values as level_1... - } - - allow_patches_smaller_than_ghostwidth = TRUE -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 21 // max number of simulation timesteps - // max_integrator_steps = 100 // max number of simulation timesteps -} - -DistributedLoadBalancer { - algorithm_index = 1 - report_load_balance = TRUE - num_cycles = 2 -} - -BergerRigoutsos { - log_node_history = TRUE - log_cluster_summary = TRUE - sequentialize_output_indices = TRUE -} - -TreeLoadBalancer { - report_load_balance = TRUE - barrier_before = FALSE - barrier_after = FALSE - n_root_cycles = 2 -} - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-3d.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-3d.input deleted file mode 100644 index eb0cb426..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/room-3d.input +++ /dev/null @@ -1,237 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (3d room) - * - ************************************************************************/ - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Godunov slopes - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - corner_transport = "CORNER_TRANSPORT_2" - - data_problem = "SPHERE" - - Initial_data { - radius = 6.0 - center = 34.0 , 28.0 , 10.0 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 , 0.0 - pressure_outside = 1.0 - - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 10.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "REFLECT" - } - boundary_face_xhi { - boundary_condition = "REFLECT" - } - boundary_face_ylo { - boundary_condition = "REFLECT" - } - boundary_face_yhi { - boundary_condition = "REFLECT" - } - boundary_face_zlo { - boundary_condition = "REFLECT" - } - boundary_face_zhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for an edge, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge boundary values - // will be the same regardless of which face is used. - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZREFLECT" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZREFLECT" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZREFLECT" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZREFLECT" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XREFLECT" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XREFLECT" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XREFLECT" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XREFLECT" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YREFLECT" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YREFLECT" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YREFLECT" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YREFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent faces have either FLOW - // or REFLECT conditions, the resulting node boundary values - // will be the same regardless of which face is used. - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XREFLECT" - } - - } - -} - - -Main { -// log file parameters - log_file_name = "room-3d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_room3d" - viz_dump_filename = "room3d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 1 // zero to turn off - restart_write_dirname = "restart_room3d" -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithmX::*" -} - -CartesianGeometry { - domain_boxes = [ (0,9,0) , (14,20,20) ], - [ (0,21,0) , (19,35,20) ], - [ (0,36,0) , (14,49,20) ], - [ (20,0,0) , (49,54,20) ], - [ (50,0,0) , (64,35,20) ], - [ (50,46,0) , (64,54,20) ], - [ (57,36,0) , (64,45,20) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 65.e0 , 55.e0 , 20.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -PatchHierarchy { - max_levels = 1 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 - } - - largest_patch_size { - level_0 = 48, 48, 48 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8, 8, 8 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/sphere-2d-re.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/sphere-2d-re.input deleted file mode 100644 index 4282f8cb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/sphere-2d-re.input +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (2d sphere) - * - ************************************************************************/ -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "SPHERE" - - Initial_data { - radius = 6.0 - center = 30.0 , 30.0 - - density_inside = 8.0 - velocity_inside = 0.0 , 0.0 - pressure_inside = 40.0 - - density_outside = 1.0 - velocity_outside = 0.0 , 0.0 - pressure_outside = 1.0 - - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", - "PRESSURE_SHOCK", - "PRESSURE_RICHARDSON" - - PRESSURE_RICHARDSON { - rich_tol = 0.001 - } - - // PRESSURE_GRADIENT and PRESSURE_SHOCK criteria are applied only if - // the gradient detector is turned on in StandardTagAndInitialize - // input below... - PRESSURE_GRADIENT { - grad_tol = 10.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "REFLECT" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "XREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "XREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "XREFLECT" - } - } -} - -Main { -// log file parameters - log_file_name = "sphere-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - viz_dump_filename = "sphere2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere2d" -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry{ - domain_boxes = [(0,0),(59,59)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 60.e0 , 60.e0 // upper end of computational domain. -} - -StandardTagAndInitialize { -// tagging_method = "GRADIENT_DETECTOR" - tagging_method = "RICHARDSON_EXTRAPOLATION" -// tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" -// tagging_method = "REFINE_BOXES" -// RefineBoxes { -// level_0 = [(20,20),(40,40)] -// level_1 = [(90,90),(150,150)] -// } -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - - largest_patch_size { - level_0 = 48 , 48 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8 , 8 - level_1 = 16 , 16 - // all finer levels will use same values as level_1... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 301 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d-5levels.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d-5levels.input deleted file mode 100644 index 54f91664..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d-5levels.input +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (2d step) - * - ************************************************************************/ - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "STEP" - - Initial_data { - front_position = 0.0 - interval_0 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - interval_1 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 20.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.90 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "YREFLECT" - } - } -} - -Main { -// log file parameters - log_file_name = "step-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_step2d" - viz_dump_filename = "step2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 1 // zero to turn off - restart_write_dirname = "restart_step2d" -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (9,19) ], - [ (10,4) , (49,19) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 2.5e0 , 1.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -PatchHierarchy { - max_levels = 5 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - level_4 = 2 , 2 - } - - largest_patch_size { - level_0 = 32 , 32 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8 , 8 - level_1 = 8 , 8 - level_2 = 8 , 8 - level_3 = 12 , 12 - // all finer levels will use same values as level_3... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.75e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 20.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 401 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d.input b/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d.input deleted file mode 100644 index 13c8e14b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/Euler/sample_inputs/step-2d.input +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Euler example problem (2d step) - * - ************************************************************************/ -check_connectivity = 'y' -print_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - -Euler { - gamma = 1.4 // gamma = Ratio of specific heats - - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - - riemann_solve = "APPROX_RIEM_SOLVE" -// riemann_solve = "EXACT_RIEM_SOLVE" -// riemann_solve = "HLLC_RIEM_SOLVE" - - data_problem = "STEP" - - Initial_data { - front_position = 0.0 - interval_0 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - interval_1 { - density = 1.4 - velocity = 3.0 , 0.0 - pressure = 1.0 - } - } - - Refinement_data { - refine_criteria = "PRESSURE_GRADIENT", "PRESSURE_SHOCK" - - PRESSURE_GRADIENT { - grad_tol = 20.0 - } - - PRESSURE_SHOCK { - shock_tol = 10.0 - shock_onset = 0.90 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "REFLECT" - } - boundary_edge_ylo { - boundary_condition = "REFLECT" - } - boundary_edge_yhi { - boundary_condition = "REFLECT" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_ylo { - boundary_condition = "YREFLECT" - } - boundary_node_xlo_yhi { - boundary_condition = "YREFLECT" - } - boundary_node_xhi_yhi { - boundary_condition = "YREFLECT" - } - } -} - -Main { -// log file parameters - log_file_name = "step-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_step2d" - viz_dump_filename = "step2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 1 // zero to turn off - restart_write_dirname = "restart_step2d" -} - -TimerManager{ - print_exclusive = TRUE // output exclusive time - timer_list = "apps::main::*", - "apps::Euler::*", - "algs::GriddingAlgorithm::*", - "algs::HyperbolicLevelIntegrator::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (9,19) ], - [ (10,4) , (49,19) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 2.5e0 , 1.e0 // upper end of computational domain. -} - -StandardTagAndInitialize{ - tagging_method = "GRADIENT_DETECTOR" -} - -PatchHierarchy { - max_levels = 3 - proper_nesting_buffer = 2, 2, 2, 2, 2, 2 - largest_patch_size { - level_0 = 32, 32 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 8,8 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 4, 4 - level_2 = 4, 4 - // etc. - } - allow_patches_smaller_than_ghostwidth = TRUE -} - -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = FALSE - // load_balance = FALSE - efficiency_tolerance = 0.75 - combine_efficiency = 0.80 - sort_boxes_after_globalizing = FALSE - extend_tags_to_bdry = TRUE -} - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 20.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 401 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - -BergerRigoutsos { - log_node_history = TRUE - log_cluster_summary = TRUE - sequentialize_output_indices = TRUE -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.C b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.C index 97c242c3..1506da35 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -32,7 +32,6 @@ using namespace std; #include #include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/hier/BoxContainer.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" @@ -52,6 +51,7 @@ using namespace std; #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" //integer constants for boundary conditions @@ -120,20 +120,19 @@ LinAdv::LinAdv( const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom, - SinusoidalFrontTagger* analytical_tagger): - algs::HyperbolicPatchStrategy(dim), + const boost::shared_ptr& sine_wall): + algs::HyperbolicPatchStrategy(), d_object_name(object_name), d_dim(dim), - d_analytical_tagger(analytical_tagger), + d_mesh_gen(sine_wall), d_grid_geometry(grid_geom), d_use_nonuniform_workload(false), d_uval(new pdat::CellVariable(dim, "uval", 1)), d_flux(new pdat::FaceVariable(dim, "flux", 1)), - d_godunov_order (1), + d_godunov_order(1), d_corner_transport("CORNER_TRANSPORT_1"), d_nghosts(hier::IntVector(dim, CELLG)), - d_fluxghosts(hier::IntVector(dim, FLUXG)), - d_data_problem_int(tbox::MathUtilities::getMax()) + d_fluxghosts(hier::IntVector(dim, FLUXG)) { TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); @@ -150,77 +149,12 @@ LinAdv::LinAdv( getTimer("apps::LinAdv::analytical_tag"); } -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif /* * Defaults for problem type and initial data. */ - int k; - - // SPHERE problem... - d_radius = tbox::MathUtilities::getSignalingNaN(); - tbox::MathUtilities::setArrayToSignalingNaN(d_center, d_dim.getValue()); - d_uval_inside = tbox::MathUtilities::getSignalingNaN(); - d_uval_outside = tbox::MathUtilities::getSignalingNaN(); - - d_number_of_intervals = 0; - d_front_position.resizeArray(0); - d_interval_uval.resizeArray(0); - - // SINE problem - d_amplitude = 0.; - for (k = 0; k < d_dim.getValue(); k++) d_period[k] = 0.; - - /* - * Defaults for boundary conditions. Set to bogus values - * for error checking. - */ - - if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { - d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - } - - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); - - for (int ni = 0; ni < NUM_2D_NODES; ni++) { - d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; - } - - d_bdry_edge_uval.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_uval); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { - d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; - } - - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { - d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; - d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; - } - - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); - - for (int ni = 0; ni < NUM_3D_NODES; ni++) { - d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; - d_node_bdry_face[ni] = BOGUS_BDRY_DATA; - } - - d_bdry_face_uval.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_uval); - } - /* * Initialize object with data read from given input/restart databases. */ @@ -230,111 +164,13 @@ LinAdv::LinAdv( } getFromInput(input_db, is_from_restart); - /* - * Set problem data to values read from input/restart. - */ - - if (d_data_problem == "PIECEWISE_CONSTANT_X") { - d_data_problem_int = PIECEWISE_CONSTANT_X; - } else if (d_data_problem == "PIECEWISE_CONSTANT_Y") { - d_data_problem_int = PIECEWISE_CONSTANT_Y; - } else if (d_data_problem == "PIECEWISE_CONSTANT_Z") { - d_data_problem_int = PIECEWISE_CONSTANT_Z; - } else if (d_data_problem == "SINE_CONSTANT_X") { - d_data_problem_int = SINE_CONSTANT_X; - } else if (d_data_problem == "SINE_CONSTANT_Y") { - d_data_problem_int = SINE_CONSTANT_Y; - } else if (d_data_problem == "SINE_CONSTANT_Z") { - d_data_problem_int = SINE_CONSTANT_Z; - } else if (d_data_problem == "SPHERE") { - d_data_problem_int = SPHERE; - } else { - TBOX_ERROR( - d_object_name << ": " - << "Unknown d_data_problem string = " - << d_data_problem - << " encountered in constructor" << endl); - } - - /* - * Postprocess boundary data from input/restart values. Note: scalar - * quantity in this problem cannot have reflective boundary conditions - * so we reset them to FLOW. - */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { - if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { - d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; - } - } - - for (int i = 0; i < NUM_2D_NODES; i++) { - if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { - d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; - } - if (d_scalar_bdry_node_conds[i] == BdryCond::YREFLECT) { - d_scalar_bdry_node_conds[i] = BdryCond::YFLOW; - } - - if (d_scalar_bdry_node_conds[i] != BOGUS_BDRY_DATA) { - d_node_bdry_edge[i] = - appu::CartesianBoundaryUtilities2::getEdgeLocationForNodeBdry( - i, d_scalar_bdry_node_conds[i]); - } - } - } - if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { - if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { - d_scalar_bdry_face_conds[i] = BdryCond::FLOW; - } - } - - for (int i = 0; i < NUM_3D_EDGES; i++) { - if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { - d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; - } - if (d_scalar_bdry_edge_conds[i] == BdryCond::YREFLECT) { - d_scalar_bdry_edge_conds[i] = BdryCond::YFLOW; - } - if (d_scalar_bdry_edge_conds[i] == BdryCond::ZREFLECT) { - d_scalar_bdry_edge_conds[i] = BdryCond::ZFLOW; - } - - if (d_scalar_bdry_edge_conds[i] != BOGUS_BDRY_DATA) { - d_edge_bdry_face[i] = - appu::CartesianBoundaryUtilities3::getFaceLocationForEdgeBdry( - i, d_scalar_bdry_edge_conds[i]); - } - } - - for (int i = 0; i < NUM_3D_NODES; i++) { - if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { - d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; - } - if (d_scalar_bdry_node_conds[i] == BdryCond::YREFLECT) { - d_scalar_bdry_node_conds[i] = BdryCond::YFLOW; - } - if (d_scalar_bdry_node_conds[i] == BdryCond::ZREFLECT) { - d_scalar_bdry_node_conds[i] = BdryCond::ZFLOW; - } - - if (d_scalar_bdry_node_conds[i] != BOGUS_BDRY_DATA) { - d_node_bdry_face[i] = - appu::CartesianBoundaryUtilities3::getFaceLocationForNodeBdry( - i, d_scalar_bdry_node_conds[i]); - } - } - - } - - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(stufprobc2d, STUFPROBC2D) (PIECEWISE_CONSTANT_X, + SAMRAI_F77_FUNC(stufprobc2d, STUFPROBC2D) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SINE_CONSTANT_X, SINE_CONSTANT_Y, SINE_CONSTANT_Z, SPHERE, CELLG, FACEG, FLUXG); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(stufprobc3d, STUFPROBC3D) (PIECEWISE_CONSTANT_X, + SAMRAI_F77_FUNC(stufprobc3d, STUFPROBC3D) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SINE_CONSTANT_X, SINE_CONSTANT_Y, SINE_CONSTANT_Z, SPHERE, CELLG, FACEG, FLUXG); @@ -367,10 +203,8 @@ void LinAdv::registerModelVariables( algs::HyperbolicLevelIntegrator* integrator) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(integrator != (algs::HyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); -#endif integrator->registerVariable(d_uval, d_nghosts, algs::HyperbolicLevelIntegrator::TIME_DEP, @@ -384,30 +218,6 @@ void LinAdv::registerModelVariables( "CONSERVATIVE_COARSEN", "NO_REFINE"); - hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); - -#ifdef HAVE_HDF5 - if (d_visit_writer) { - d_visit_writer-> - registerPlotQuantity("U", - "SCALAR", - vardb->mapVariableAndContextToIndex( - d_uval, integrator->getPlotContext())); - if (d_analytical_tagger) { - d_analytical_tagger->registerVariablesWithPlotter(*d_visit_writer); - } - } -#endif - -#ifdef HAVE_HDF5 - if (!d_visit_writer) { - TBOX_WARNING(d_object_name << ": registerModelVariables()" - << "\nVisit data writer was not registered.\n" - << "Consequently, no plot data will" - << "\nbe written." << endl); - } -#endif - } /* @@ -425,11 +235,13 @@ void LinAdv::setupLoadBalancer( NULL_USE(integrator); hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); + hier::PatchDataRestartManager* pdrm = + hier::PatchDataRestartManager::getManager(); if (d_use_nonuniform_workload && gridding_algorithm) { boost::shared_ptr load_balancer( - gridding_algorithm->getLoadBalanceStrategy(), - boost::detail::dynamic_cast_tag()); + boost::dynamic_pointer_cast( + gridding_algorithm->getLoadBalanceStrategy())); if (load_balancer) { d_workload_variable.reset(new pdat::CellVariable( @@ -441,7 +253,7 @@ void LinAdv::setupLoadBalancer( vardb->getContext("WORKLOAD"), hier::IntVector(d_dim, 0)); load_balancer->setWorkloadPatchDataIndex(d_workload_data_id); - vardb->registerPatchDataForRestart(d_workload_data_id); + pdrm->registerPatchDataForRestart(d_workload_data_id); } else { TBOX_WARNING( d_object_name << ": " @@ -478,120 +290,20 @@ void LinAdv::initializeDataOnPatch( t_init_first_time->start(); const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const double* dx = pgeom->getDx(); - const double* xlo = pgeom->getXLower(); - const double* xhi = pgeom->getXUpper(); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(pgeom); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); TBOX_ASSERT(uval); -#endif - hier::IntVector ghost_cells(uval->getGhostCellWidth()); - - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); - - if ((d_data_problem_int == SPHERE)) { - - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(initsphere2d, INITSPHERE2D) (d_data_problem_int, dx, xlo, - xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ghost_cells(0), - ghost_cells(1), - - uval->getPointer(), - d_uval_inside, - d_uval_outside, - d_center, d_radius); - } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(initsphere3d, INITSPHERE3D) (d_data_problem_int, dx, xlo, - xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ghost_cells(0), - ghost_cells(1), - ghost_cells(2), + uval->setTime(data_time); - uval->getPointer(), - d_uval_inside, - d_uval_outside, - d_center, d_radius); - } - - } else if (d_data_problem_int == SINE_CONSTANT_X || - d_data_problem_int == SINE_CONSTANT_Y || - d_data_problem_int == SINE_CONSTANT_Z) { - - const double* domain_xlo = d_grid_geometry->getXLower(); - - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) (d_data_problem_int, - dx, xlo, - domain_xlo, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ghost_cells(0), - ghost_cells(1), - uval->getPointer(), - d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer(), - d_amplitude, - d_period); - } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) (d_data_problem_int, - dx, xlo, - domain_xlo, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ghost_cells(0), - ghost_cells(1), - ghost_cells(2), - uval->getPointer(), - d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer(), - d_amplitude, - d_period); - } - - } else { - - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(linadvinit2d, LINADVINIT2D) (d_data_problem_int, dx, xlo, - xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ghost_cells(0), - ghost_cells(1), - uval->getPointer(), - d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); - } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(linadvinit3d, LINADVINIT3D) (d_data_problem_int, dx, xlo, - xhi, - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ghost_cells(0), - ghost_cells(1), - ghost_cells(2), - uval->getPointer(), - d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); - } - } + d_mesh_gen->computePatchData( + patch, + uval.get(), 0, + patch.getBox()); t_init_first_time->stop(); } @@ -601,18 +313,12 @@ void LinAdv::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } - if (d_analytical_tagger) { - d_analytical_tagger->initializePatchData(patch, - data_time, - initial_time, - true); - } - t_init->stop(); } @@ -633,25 +339,25 @@ double LinAdv::computeStableDtOnPatch( NULL_USE(dt_time); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif + hier::IntVector ghost_cells = uval->getGhostCellWidth(); double stabdt; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(stabledt2d, STABLEDT2D) (dx, + SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), @@ -660,7 +366,7 @@ double LinAdv::computeStableDtOnPatch( uval->getPointer(), stabdt); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(stabledt3d, STABLEDT3D) (dx, + SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -670,6 +376,9 @@ double LinAdv::computeStableDtOnPatch( d_advection_velocity, uval->getPointer(), stabdt); + } else { + TBOX_ERROR("Only 2D or 3D allowed in LinAdv::computeStableDtOnPatch"); + stabdt = 0; } return stabdt; @@ -704,13 +413,12 @@ void LinAdv::computeFluxesOnPatch( if (d_dim < tbox::Dimension(3)) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -718,23 +426,21 @@ void LinAdv::computeFluxesOnPatch( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); /* * Verify that the integrator providing the context correctly * created it, and that the ghost cell width associated with the * context matches the ghosts defined in this class... */ -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -743,7 +449,7 @@ void LinAdv::computeFluxesOnPatch( pdat::FaceData traced_right(pbox, 1, d_nghosts); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), uval->getPointer(), traced_left.getPointer(0), @@ -761,17 +467,17 @@ void LinAdv::computeFluxesOnPatch( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -780,30 +486,30 @@ void LinAdv::computeFluxesOnPatch( * Output: w^L, w^R */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, + SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[0], d_advection_velocity[0], d_godunov_order, uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } if (d_dim == tbox::Dimension(2)) { - F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, + SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } } // if (d_godunov_order > 1) ... @@ -814,10 +520,10 @@ void LinAdv::computeFluxesOnPatch( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,1,dx, to get artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,0,dx, to get NO artificial viscosity - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), d_advection_velocity, uval->getPointer(), @@ -833,7 +539,7 @@ void LinAdv::computeFluxesOnPatch( * Inputs: F (flux) * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), dx, d_advection_velocity, uval->getPointer(), @@ -844,14 +550,12 @@ void LinAdv::computeFluxesOnPatch( traced_right.getPointer(0), traced_right.getPointer(1)); - boundaryReset(patch, traced_left, traced_right); - /* * Re-compute fluxes with updated traces. * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), d_advection_velocity, uval->getPointer(), @@ -882,13 +586,12 @@ void LinAdv::compute3DFluxesWithCornerTransport1( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -896,18 +599,16 @@ void LinAdv::compute3DFluxesWithCornerTransport1( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -918,7 +619,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( pdat::FaceData temp_traced_left(pbox, 1, d_nghosts); pdat::FaceData temp_traced_right(pbox, 1, d_nghosts); - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -943,17 +644,17 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -961,7 +662,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -969,12 +670,12 @@ void LinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -982,12 +683,12 @@ void LinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -995,10 +696,10 @@ void LinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } /* @@ -1008,9 +709,9 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Output: F (flux) */ -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity -// F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,1,dx, to do artificial viscosity +// SAMRAI_F77_FUNC(fluxcalculation,FLUXCALCULATION)(dt,*,*,0,dx, to do NO artificial viscosity + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1030,7 +731,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) ( + SAMRAI_F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) ( dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_advection_velocity, 1, uval->getPointer(), @@ -1050,15 +751,13 @@ void LinAdv::compute3DFluxesWithCornerTransport1( temp_traced_right.getPointer(1), temp_traced_right.getPointer(2)); - boundaryReset(patch, traced_left, traced_right); - /* * Compute fluxes with partially-corrected trace states. Store result in * temporary flux vector. * Inputs: temp_traced_left/right * Output: temp_flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1078,7 +777,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_advection_velocity, -1, uval->getPointer(), @@ -1098,8 +797,6 @@ void LinAdv::compute3DFluxesWithCornerTransport1( temp_traced_right.getPointer(1), temp_traced_right.getPointer(2)); - boundaryReset(patch, traced_left, traced_right); - /* * Compute final predicted fluxes with both sets of transverse flux * differences included. Store the result in regular flux vector. @@ -1109,7 +806,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_traced_left/right * Output: flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1130,7 +827,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_flux, flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec3d3d, FLUXCORREC3D3D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec3d3d, FLUXCORREC3D3D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, d_advection_velocity, uval->getPointer(), @@ -1151,7 +848,7 @@ void LinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1184,13 +881,12 @@ void LinAdv::compute3DFluxesWithCornerTransport2( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); hier::Box pbox = patch.getBox(); @@ -1198,18 +894,16 @@ void LinAdv::compute3DFluxesWithCornerTransport2( const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1222,7 +916,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( /* * Initialize trace fluxes (w^R and w^L) with cell-centered values. */ - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), uval->getPointer(), @@ -1242,7 +936,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 1, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1266,17 +960,17 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to update traces w^L and @@ -1284,7 +978,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1292,37 +986,37 @@ void LinAdv::compute3DFluxesWithCornerTransport2( uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[2], d_advection_velocity[2], d_godunov_order, uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { /* * Approximate traces at cell centers (in idir direction) - denoted @@ -1330,7 +1024,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: F (flux) * Output: third_state */ - F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, + SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1345,7 +1039,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Output: temp_flux (only two directions (i.e. those other than idir) * are modified) */ - F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1361,7 +1055,7 @@ void LinAdv::compute3DFluxesWithCornerTransport2( * Inputs: temp_flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1377,14 +1071,12 @@ void LinAdv::compute3DFluxesWithCornerTransport2( } // loop over directions... - boundaryReset(patch, traced_left, traced_right); - /* * Final flux calculation using corrected trace states. * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_advection_velocity, uval->getPointer(), @@ -1422,29 +1114,28 @@ void LinAdv::conservativeDifferenceOnPatch( NULL_USE(at_syncronization); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif if (d_dim == tbox::Dimension(2)) { - F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), dx, flux->getPointer(0), flux->getPointer(1), @@ -1452,7 +1143,7 @@ void LinAdv::conservativeDifferenceOnPatch( uval->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, flux->getPointer(0), flux->getPointer(1), @@ -1463,129 +1154,6 @@ void LinAdv::conservativeDifferenceOnPatch( } -/* - ************************************************************************* - * - * Reset physical boundary values for special cases, such as those - * involving symmetric (i.e., reflective) boundary conditions and - * when the "STEP" problem is run. - * - ************************************************************************* - */ -void LinAdv::boundaryReset( - hier::Patch& patch, - pdat::FaceData& traced_left, - pdat::FaceData& traced_right) const -{ - const hier::Index ifirst = patch.getBox().lower(); - const hier::Index ilast = patch.getBox().upper(); - int idir; - bool bdry_cell = true; - - const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - hier::BoxContainer domain_boxes; - d_grid_geometry->computePhysicalDomain(domain_boxes, - patch_geom->getRatio(), - patch.getBox().getBlockId()); - - pdat::CellIndex icell(ifirst); - hier::BoxContainer bdrybox; - hier::Index ibfirst = ifirst; - hier::Index iblast = ilast; - int bdry_case, bside; - - for (idir = 0; idir < d_dim.getValue(); idir++) { - ibfirst(idir) = ifirst(idir) - 1; - iblast(idir) = ifirst(idir) - 1; - bdrybox.pushBack(hier::Box(ibfirst, iblast, patch.getBox().getBlockId())); - - ibfirst(idir) = ilast(idir) + 1; - iblast(idir) = ilast(idir) + 1; - bdrybox.pushBack(hier::Box(ibfirst, iblast, patch.getBox().getBlockId())); - } - - hier::BoxContainer::iterator bdryboxitr(bdrybox); - if (d_dim == tbox::Dimension(2)) { - for (idir = 0; idir < d_dim.getValue(); idir++) { - bside = 2 * idir; - bdry_case = d_scalar_bdry_edge_conds[bside]; - if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator i(domain_boxes); - i != domain_boxes.end(); ++i) { - if (i->contains(*ic)) - bdry_cell = false; - } - if (bdry_cell) { - pdat::FaceIndex sidein = pdat::FaceIndex(*ic, idir, 1); - (traced_left)(sidein, 0) = (traced_right)(sidein, 0); - } - } - } - ++bdryboxitr; - - int bnode = 2 * idir + 1; - bdry_case = d_scalar_bdry_edge_conds[bnode]; - if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator i(domain_boxes); - i != domain_boxes.end(); ++i) { - if (i->contains(*ic)) - bdry_cell = false; - } - if (bdry_cell) { - pdat::FaceIndex sidein = pdat::FaceIndex(*ic, idir, 0); - (traced_right)(sidein, 0) = (traced_left)(sidein, 0); - } - } - } - ++bdryboxitr; - } - } else if (d_dim == tbox::Dimension(3)) { - for (idir = 0; idir < d_dim.getValue(); idir++) { - bside = 2 * idir; - bdry_case = d_scalar_bdry_face_conds[bside]; - if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator i(domain_boxes); - i != domain_boxes.end(); ++i) { - if (i->contains(*ic)) - bdry_cell = false; - } - if (bdry_cell) { - pdat::FaceIndex sidein = pdat::FaceIndex(*ic, idir, 1); - (traced_left)(sidein, 0) = (traced_right)(sidein, 0); - } - } - } - ++bdryboxitr; - - int bnode = 2 * idir + 1; - bdry_case = d_scalar_bdry_face_conds[bnode]; - if (bdry_case == BdryCond::REFLECT) { - pdat::CellIterator icend(*bdryboxitr, false); - for (pdat::CellIterator ic(*bdryboxitr, true); ic != icend; ++ic) { - for (hier::BoxContainer::iterator i(domain_boxes); - i != domain_boxes.end(); ++i) { - if (i->contains(*ic)) - bdry_cell = false; - } - if (bdry_cell) { - pdat::FaceIndex sidein = pdat::FaceIndex(*ic, idir, 0); - (traced_right)(sidein, 0) = (traced_left)(sidein, 0); - } - } - } - ++bdryboxitr; - } - } -} - /* ************************************************************************* * @@ -1605,110 +1173,34 @@ void LinAdv::setPhysicalBoundaryConditions( NULL_USE(fill_time); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif - hier::IntVector ghost_cells(uval->getGhostCellWidth()); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); -#endif - - if (d_dim == tbox::Dimension(2)) { + TBOX_ASSERT(uval->getTime() == fill_time); - /* - * Set boundary conditions for cells corresponding to patch edges. - */ - appu::CartesianBoundaryUtilities2:: - fillEdgeBoundaryData("uval", uval, - patch, - ghost_width_to_fill, - d_scalar_bdry_edge_conds, - d_bdry_edge_uval); - -#ifdef DEBUG_CHECK_ASSERTIONS -#if CHECK_BDRY_DATA - checkBoundaryData(Bdry::EDGE2D, patch, ghost_width_to_fill, - d_scalar_bdry_edge_conds); -#endif -#endif - - /* - * Set boundary conditions for cells corresponding to patch nodes. - */ - - appu::CartesianBoundaryUtilities2:: - fillNodeBoundaryData("uval", uval, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_edge_uval); - -#ifdef DEBUG_CHECK_ASSERTIONS -#if CHECK_BDRY_DATA - checkBoundaryData(Bdry::NODE2D, patch, ghost_width_to_fill, - d_scalar_bdry_node_conds); -#endif -#endif + const boost::shared_ptr pgeom( + BOOST_CAST( + patch.getPatchGeometry())); - } // NDIM == 2 + for (int codim = 1; codim <= patch.getDim().getValue(); ++codim) { - if (d_dim == tbox::Dimension(3)) { - - /* - * Set boundary conditions for cells corresponding to patch faces. - */ + const std::vector& boundary_boxes = + pgeom->getCodimensionBoundaries(codim); - appu::CartesianBoundaryUtilities3:: - fillFaceBoundaryData("uval", uval, - patch, - ghost_width_to_fill, - d_scalar_bdry_face_conds, - d_bdry_face_uval); -#ifdef DEBUG_CHECK_ASSERTIONS -#if CHECK_BDRY_DATA - checkBoundaryData(Bdry::FACE3D, patch, ghost_width_to_fill, - d_scalar_bdry_face_conds); -#endif -#endif - - /* - * Set boundary conditions for cells corresponding to patch edges. - */ + for (int bn = 0; bn < static_cast(boundary_boxes.size()); ++bn) { - appu::CartesianBoundaryUtilities3:: - fillEdgeBoundaryData("uval", uval, - patch, - ghost_width_to_fill, - d_scalar_bdry_edge_conds, - d_bdry_face_uval); -#ifdef DEBUG_CHECK_ASSERTIONS -#if CHECK_BDRY_DATA - checkBoundaryData(Bdry::EDGE3D, patch, ghost_width_to_fill, - d_scalar_bdry_edge_conds); -#endif -#endif + const hier::Box fill_box = + pgeom->getBoundaryFillBox(boundary_boxes[bn], + patch.getBox(), + ghost_width_to_fill); - /* - * Set boundary conditions for cells corresponding to patch nodes. - */ + d_mesh_gen->computePatchData(patch, uval.get(), 0, fill_box); - appu::CartesianBoundaryUtilities3:: - fillNodeBoundaryData("uval", uval, - patch, - ghost_width_to_fill, - d_scalar_bdry_node_conds, - d_bdry_face_uval); -#ifdef DEBUG_CHECK_ASSERTIONS -#if CHECK_BDRY_DATA - checkBoundaryData(Bdry::NODE3D, patch, ghost_width_to_fill, - d_scalar_bdry_node_conds); -#endif -#endif + } - } // NDIM == 3 + } } @@ -1737,8 +1229,9 @@ void LinAdv::tagRichardsonExtrapolationCells( hier::Box pbox = patch.getBox(); boost::shared_ptr > tags( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tags); /* * Possible tagging criteria includes @@ -1749,7 +1242,8 @@ void LinAdv::tagRichardsonExtrapolationCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > coarsened_fine_var; @@ -1760,20 +1254,20 @@ void LinAdv::tagRichardsonExtrapolationCells( if (ref == "UVAL_RICHARDSON") { coarsened_fine_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_uval, coarsened_fine)); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, coarsened_fine)); advanced_coarse_var = - boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(d_uval, advanced_coarse)); - size = d_rich_tol.getSize(); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, advanced_coarse)); + size = static_cast(d_rich_tol.size()); tol = ((error_level_number < size) ? d_rich_tol[error_level_number] : d_rich_tol[size - 1]); - size = d_rich_time_min.getSize(); + size = static_cast(d_rich_time_min.size()); double time_min = ((error_level_number < size) ? d_rich_time_min[error_level_number] : d_rich_time_min[size - 1]); - size = d_rich_time_max.getSize(); + size = static_cast(d_rich_time_max.size()); double time_max = ((error_level_number < size) ? d_rich_time_max[error_level_number] : d_rich_time_max[size - 1]); @@ -1781,10 +1275,9 @@ void LinAdv::tagRichardsonExtrapolationCells( if (time_allowed) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(coarsened_fine_var); TBOX_ASSERT(advanced_coarse_var); -#endif + /* * We tag wherever the global error > specified tolerance * (i.e. d_rich_tol). The estimated global error is the @@ -1802,7 +1295,7 @@ void LinAdv::tagRichardsonExtrapolationCells( const double* xdomainhi = d_grid_geometry->getXUpper(); double max_length = 0.; double max_wave_speed = 0.; - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { double length = xdomainhi[idir] - xdomainlo[idir]; if (length > max_length) max_length = length; @@ -1830,8 +1323,9 @@ void LinAdv::tagRichardsonExtrapolationCells( double diff = 0.; double error = 0.; - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { /* * Compute error norm @@ -1875,8 +1369,9 @@ void LinAdv::tagRichardsonExtrapolationCells( * use this information in the gradient detector. */ if (!uses_gradient_detector_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*tags)(*ic, 0) = TRUE; @@ -1909,13 +1404,16 @@ void LinAdv::tagGradientDetectorCells( const int error_level_number = patch.getPatchLevelNumber(); const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); + TBOX_ASSERT(tags); + TBOX_ASSERT(tags->getTime() == regrid_time); hier::Box pbox = patch.getBox(); @@ -1932,14 +1430,15 @@ void LinAdv::tagGradientDetectorCells( */ boost::shared_ptr > temp_tags( new pdat::CellData(pbox, 1, d_nghosts)); + temp_tags->setTime(regrid_time); temp_tags->fillAll(not_refine_tag_val); - if (d_analytical_tagger) { + if (d_mesh_gen) { t_analytical_tag->start(); - d_analytical_tagger->computePatchData(patch, - regrid_time, - (pdat::NodeData *)NULL, - tags.get()); + d_mesh_gen->computePatchData(patch, + 0, + tags.get(), + patch.getBox()); t_analytical_tag->stop(); } else { /* @@ -1951,12 +1450,13 @@ void LinAdv::tagGradientDetectorCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > var( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); TBOX_ASSERT(var); @@ -1969,19 +1469,19 @@ void LinAdv::tagGradientDetectorCells( bool time_allowed = false; if (ref == "UVAL_DEVIATION") { - size = d_dev_tol.getSize(); + size = static_cast(d_dev_tol.size()); tol = ((error_level_number < size) ? d_dev_tol[error_level_number] : d_dev_tol[size - 1]); - size = d_dev.getSize(); + size = static_cast(d_dev.size()); double dev = ((error_level_number < size) ? d_dev[error_level_number] : d_dev[size - 1]); - size = d_dev_time_min.getSize(); + size = static_cast(d_dev_time_min.size()); double time_min = ((error_level_number < size) ? d_dev_time_min[error_level_number] : d_dev_time_min[size - 1]); - size = d_dev_time_max.getSize(); + size = static_cast(d_dev_time_max.size()); double time_max = ((error_level_number < size) ? d_dev_time_max[error_level_number] : d_dev_time_max[size - 1]); @@ -1995,8 +1495,9 @@ void LinAdv::tagGradientDetectorCells( * RICHARDSON_NEWLY_TAGGED since these were set most recently * by Richardson extrapolation. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { double locden = tol; int tag_val = (*tags)(*ic, 0); if (tag_val) { @@ -2013,15 +1514,15 @@ void LinAdv::tagGradientDetectorCells( } if (ref == "UVAL_GRADIENT") { - size = d_grad_tol.getSize(); + size = static_cast(d_grad_tol.size()); tol = ((error_level_number < size) ? d_grad_tol[error_level_number] : d_grad_tol[size - 1]); - size = d_grad_time_min.getSize(); + size = static_cast(d_grad_time_min.size()); double time_min = ((error_level_number < size) ? d_grad_time_min[error_level_number] : d_grad_time_min[size - 1]); - size = d_grad_time_max.getSize(); + size = static_cast(d_grad_time_max.size()); double time_max = ((error_level_number < size) ? d_grad_time_max[error_level_number] : d_grad_time_max[size - 1]); @@ -2030,7 +1531,7 @@ void LinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectgrad2d, DETECTGRAD2D) ( + SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2040,7 +1541,7 @@ void LinAdv::tagGradientDetectorCells( var->getPointer(), tags->getPointer(), temp_tags->getPointer()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectgrad3d, DETECTGRAD3D) ( + SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), @@ -2057,19 +1558,19 @@ void LinAdv::tagGradientDetectorCells( } if (ref == "UVAL_SHOCK") { - size = d_shock_tol.getSize(); + size = static_cast(d_shock_tol.size()); tol = ((error_level_number < size) ? d_shock_tol[error_level_number] : d_shock_tol[size - 1]); - size = d_shock_onset.getSize(); + size = static_cast(d_shock_onset.size()); onset = ((error_level_number < size) ? d_shock_onset[error_level_number] : d_shock_onset[size - 1]); - size = d_shock_time_min.getSize(); + size = static_cast(d_shock_time_min.size()); double time_min = ((error_level_number < size) ? d_shock_time_min[error_level_number] : d_shock_time_min[size - 1]); - size = d_shock_time_max.getSize(); + size = static_cast(d_shock_time_max.size()); double time_max = ((error_level_number < size) ? d_shock_time_max[error_level_number] : d_shock_time_max[size - 1]); @@ -2078,7 +1579,7 @@ void LinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectshock2d, DETECTSHOCK2D) ( + SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2089,7 +1590,7 @@ void LinAdv::tagGradientDetectorCells( var->getPointer(), tags->getPointer(), temp_tags->getPointer()); } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectshock3d, DETECTSHOCK3D) ( + SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), @@ -2114,8 +1615,9 @@ void LinAdv::tagGradientDetectorCells( * to be the designated "refine_tag_val". */ if (uses_richardson_extrapolation_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*temp_tags)(*ic, 0) = refine_tag_val; @@ -2126,8 +1628,9 @@ void LinAdv::tagGradientDetectorCells( /* * Update tags. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2148,14 +1651,21 @@ void LinAdv::tagGradientDetectorCells( void LinAdv::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif - d_visit_writer = viz_writer; - d_visit_writer->registerDerivedPlotQuantity("Owner", - "SCALAR", - this); + d_mesh_gen->registerVariablesWithPlotter(*viz_writer); + + hier::VariableDatabase* vardb = hier::VariableDatabase::getDatabase(); + +#ifdef HAVE_HDF5 + if (viz_writer) { + viz_writer-> + registerPlotQuantity("U", + "SCALAR", + vardb->mapVariableAndContextToIndex( + d_uval, vardb->getContext("CURRENT"))); + } +#endif } #endif @@ -2164,22 +1674,16 @@ bool LinAdv::packDerivedDataIntoDoubleBuffer( const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const + int depth_id, + double simulation_time) const { + NULL_USE(buffer); NULL_USE(patch); + NULL_USE(region); + NULL_USE(variable_name); NULL_USE(depth_id); - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << "DLBGTest::packDerivedPatchDataIntoDoubleBuffer"); - } - + NULL_USE(simulation_time); + TBOX_ERROR("Should not be here. This object didn't register any derived plot variables."); return true; } @@ -2194,7 +1698,7 @@ bool LinAdv::packDerivedDataIntoDoubleBuffer( void LinAdv::printClassData( ostream& os) const { - int j, k; + int j; os << "\nLinAdv::printClassData..." << endl; os << "LinAdv: this = " << (LinAdv *)this << endl; @@ -2204,150 +1708,86 @@ void LinAdv::printClassData( os << "Parameters for numerical method ..." << endl; os << " d_advection_velocity = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_advection_velocity[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_advection_velocity[j] << " "; os << endl; os << " d_godunov_order = " << d_godunov_order << endl; os << " d_corner_transport = " << d_corner_transport << endl; os << " d_nghosts = " << d_nghosts << endl; os << " d_fluxghosts = " << d_fluxghosts << endl; - - os << "Problem description and initial data..." << endl; - os << " d_data_problem = " << d_data_problem << endl; - os << " d_data_problem_int = " << d_data_problem << endl; - - os << " d_radius = " << d_radius << endl; - os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; - os << endl; - os << " d_uval_inside = " << d_uval_inside << endl; - os << " d_uval_outside = " << d_uval_outside << endl; - - os << " d_number_of_intervals = " << d_number_of_intervals << endl; - os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { - os << d_front_position[k] << " "; - } - os << endl; - os << " d_interval_uval = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { - os << " " << d_interval_uval[k] << endl; - } os << " Boundary condition data " << endl; - if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { - os << " d_scalar_bdry_edge_conds[" << j << "] = " - << d_scalar_bdry_edge_conds[j] << endl; - if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { - os << " d_bdry_edge_uval[" << j << "] = " - << d_bdry_edge_uval[j] << endl; - } - } - os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { - os << " d_scalar_bdry_node_conds[" << j << "] = " - << d_scalar_bdry_node_conds[j] << endl; - os << " d_node_bdry_edge[" << j << "] = " - << d_node_bdry_edge[j] << endl; - } - } - if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { - os << " d_scalar_bdry_face_conds[" << j << "] = " - << d_scalar_bdry_face_conds[j] << endl; - if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { - os << " d_bdry_face_uval[" << j << "] = " - << d_bdry_face_uval[j] << endl; - } - } - os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { - os << " d_scalar_bdry_edge_conds[" << j << "] = " - << d_scalar_bdry_edge_conds[j] << endl; - os << " d_edge_bdry_face[" << j << "] = " - << d_edge_bdry_face[j] << endl; - } - os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { - os << " d_scalar_bdry_node_conds[" << j << "] = " - << d_scalar_bdry_node_conds[j] << endl; - os << " d_node_bdry_face[" << j << "] = " - << d_node_bdry_face[j] << endl; - } - } - os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_tol.size()); ++j) { os << " d_dev_tol[" << j << "] = " << d_dev_tol[j] << endl; } - for (j = 0; j < d_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_dev.size()); ++j) { os << " d_dev[" << j << "] = " << d_dev[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_max.size()); ++j) { os << " d_dev_time_max[" << j << "] = " << d_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_min.size()); ++j) { os << " d_dev_time_min[" << j << "] = " << d_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_tol.size()); ++j) { os << " d_grad_tol[" << j << "] = " << d_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_max.size()); ++j) { os << " d_grad_time_max[" << j << "] = " << d_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_min.size()); ++j) { os << " d_grad_time_min[" << j << "] = " << d_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_onset.size()); ++j) { os << " d_shock_onset[" << j << "] = " << d_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_tol.size()); ++j) { os << " d_shock_tol[" << j << "] = " << d_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_max.size()); ++j) { os << " d_shock_time_max[" << j << "] = " << d_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_min.size()); ++j) { os << " d_shock_time_min[" << j << "] = " << d_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_tol.size()); ++j) { os << " d_rich_tol[" << j << "] = " << d_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_max.size()); ++j) { os << " d_rich_time_max[" << j << "] = " << d_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_min.size()); ++j) { os << " d_rich_time_min[" << j << "] = " << d_rich_time_min[j] << endl; } @@ -2364,12 +1804,10 @@ void LinAdv::printClassData( ************************************************************************* */ void LinAdv::getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(input_db); /* * Note: if we are restarting, then we only allow nonuniform @@ -2377,17 +1815,17 @@ void LinAdv::getFromInput( */ if (!is_from_restart) { d_use_nonuniform_workload = - db->getBoolWithDefault("use_nonuniform_workload", + input_db->getBoolWithDefault("use_nonuniform_workload", d_use_nonuniform_workload); } else { if (d_use_nonuniform_workload) { d_use_nonuniform_workload = - db->getBool("use_nonuniform_workload"); + input_db->getBool("use_nonuniform_workload"); } } - if (db->keyExists("advection_velocity")) { - db->getDoubleArray("advection_velocity", + if (input_db->keyExists("advection_velocity")) { + input_db->getDoubleArray("advection_velocity", d_advection_velocity, d_dim.getValue()); } else { TBOX_ERROR( @@ -2395,8 +1833,8 @@ void LinAdv::getFromInput( << "Key data `advection_velocity' not found in input."); } - if (db->keyExists("godunov_order")) { - d_godunov_order = db->getInteger("godunov_order"); + if (input_db->keyExists("godunov_order")) { + d_godunov_order = input_db->getInteger("godunov_order"); if ((d_godunov_order != 1) && (d_godunov_order != 2) && (d_godunov_order != 4)) { @@ -2405,12 +1843,12 @@ void LinAdv::getFromInput( << "`godunov_order' in input must be 1, 2, or 4." << endl); } } else { - d_godunov_order = db->getIntegerWithDefault("d_godunov_order", + d_godunov_order = input_db->getIntegerWithDefault("d_godunov_order", d_godunov_order); } - if (db->keyExists("corner_transport")) { - d_corner_transport = db->getString("corner_transport"); + if (input_db->keyExists("corner_transport")) { + d_corner_transport = input_db->getString("corner_transport"); if ((d_corner_transport != "CORNER_TRANSPORT_1") && (d_corner_transport != "CORNER_TRANSPORT_2")) { TBOX_ERROR( @@ -2419,19 +1857,19 @@ void LinAdv::getFromInput( << " 'CORNER_TRANSPORT_1' or 'CORNER_TRANSPORT_2'." << endl); } } else { - d_corner_transport = db->getStringWithDefault("corner_transport", + d_corner_transport = input_db->getStringWithDefault("corner_transport", d_corner_transport); } - if (db->keyExists("Refinement_data")) { + if (input_db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( - db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + input_db->getDatabase("Refinement_data")); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -2439,10 +1877,10 @@ void LinAdv::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -2461,14 +1899,13 @@ void LinAdv::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } if (error_db && error_key == "UVAL_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2477,8 +1914,7 @@ void LinAdv::getFromInput( } if (error_db->keyExists("uval_dev")) { - d_dev = - error_db->getDoubleArray("uval_dev"); + d_dev = error_db->getDoubleVector("uval_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -2487,18 +1923,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_dev_time_max = - error_db->getDoubleArray("time_max"); + d_dev_time_max = error_db->getDoubleVector("time_max"); } else { - d_dev_time_max.resizeArray(1); + d_dev_time_max.resize(1); d_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_dev_time_min = - error_db->getDoubleArray("time_min"); + d_dev_time_min = error_db->getDoubleVector("time_min"); } else { - d_dev_time_min.resizeArray(1); + d_dev_time_min.resize(1); d_dev_time_min[0] = 0.; } @@ -2507,8 +1941,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2517,18 +1950,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_grad_time_max = - error_db->getDoubleArray("time_max"); + d_grad_time_max = error_db->getDoubleVector("time_max"); } else { - d_grad_time_max.resizeArray(1); + d_grad_time_max.resize(1); d_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_grad_time_min = - error_db->getDoubleArray("time_min"); + d_grad_time_min = error_db->getDoubleVector("time_min"); } else { - d_grad_time_min.resizeArray(1); + d_grad_time_min.resize(1); d_grad_time_min[0] = 0.; } @@ -2537,8 +1968,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_SHOCK") { if (error_db->keyExists("shock_onset")) { - d_shock_onset = - error_db->getDoubleArray("shock_onset"); + d_shock_onset = error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -2547,8 +1977,7 @@ void LinAdv::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2557,18 +1986,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_shock_time_max = - error_db->getDoubleArray("time_max"); + d_shock_time_max = error_db->getDoubleVector("time_max"); } else { - d_shock_time_max.resizeArray(1); + d_shock_time_max.resize(1); d_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_shock_time_min = - error_db->getDoubleArray("time_min"); + d_shock_time_min = error_db->getDoubleVector("time_min"); } else { - d_shock_time_min.resizeArray(1); + d_shock_time_min.resize(1); d_shock_time_min[0] = 0.; } @@ -2577,8 +2004,7 @@ void LinAdv::getFromInput( if (error_db && error_key == "UVAL_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2587,18 +2013,16 @@ void LinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_rich_time_max = - error_db->getDoubleArray("time_max"); + d_rich_time_max = error_db->getDoubleVector("time_max"); } else { - d_rich_time_max.resizeArray(1); + d_rich_time_max.resize(1); d_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_rich_time_min = - error_db->getDoubleArray("time_min"); + d_rich_time_min = error_db->getDoubleVector("time_min"); } else { - d_rich_time_min.resizeArray(1); + d_rich_time_min.resize(1); d_rich_time_min[0] = 0.; } @@ -2611,10 +2035,11 @@ void LinAdv::getFromInput( /* * Check that input is found for each string identifier in key list. */ - for (int k0 = 0; k0 < d_refinement_criteria.getSize(); k0++) { + for (int k0 = 0; + k0 < static_cast(d_refinement_criteria.size()); ++k0) { string use_key = d_refinement_criteria[k0]; bool key_found = false; - for (int k1 = 0; k1 < def_key_cnt; k1++) { + for (int k1 = 0; k1 < def_key_cnt; ++k1) { string def_key = ref_keys_defined[k1]; if (def_key == use_key) key_found = true; } @@ -2628,206 +2053,11 @@ void LinAdv::getFromInput( } // refine db entry exists - if (!is_from_restart) { - - if (db->keyExists("data_problem")) { - d_data_problem = db->getString("data_problem"); - } else { - TBOX_ERROR( - d_object_name << ": " - << "`data_problem' value not found in input." - << endl); - } - - if (!db->keyExists("Initial_data")) { - TBOX_ERROR( - d_object_name << ": " - << "No `Initial_data' database found in input." << endl); - } - boost::shared_ptr init_data_db( - db->getDatabase("Initial_data")); - - bool found_problem_data = false; - - if (d_data_problem == "SPHERE") { - - if (init_data_db->keyExists("radius")) { - d_radius = init_data_db->getDouble("radius"); - } else { - TBOX_ERROR( - d_object_name << ": " - << "`radius' input required for SPHERE problem." << endl); - } - if (init_data_db->keyExists("center")) { - init_data_db->getDoubleArray("center", d_center, d_dim.getValue()); - } else { - TBOX_ERROR( - d_object_name << ": " - << "`center' input required for SPHERE problem." << endl); - } - if (init_data_db->keyExists("uval_inside")) { - d_uval_inside = init_data_db->getDouble("uval_inside"); - } else { - TBOX_ERROR(d_object_name << ": " - << "`uval_inside' input required for " - << "SPHERE problem." << endl); - } - if (init_data_db->keyExists("uval_outside")) { - d_uval_outside = init_data_db->getDouble("uval_outside"); - } else { - TBOX_ERROR(d_object_name << ": " - << "`uval_outside' input required for " - << "SPHERE problem." << endl); - } - - found_problem_data = true; - - } - - if (!found_problem_data && - ((d_data_problem == "PIECEWISE_CONSTANT_X") || - (d_data_problem == "PIECEWISE_CONSTANT_Y") || - (d_data_problem == "PIECEWISE_CONSTANT_Z") || - (d_data_problem == "SINE_CONSTANT_X") || - (d_data_problem == "SINE_CONSTANT_Y") || - (d_data_problem == "SINE_CONSTANT_Z"))) { - - int idir = 0; - if (d_data_problem == "PIECEWISE_CONSTANT_Y") { - if (d_dim < tbox::Dimension(2)) { - TBOX_ERROR( - d_object_name << ": `PIECEWISE_CONSTANT_Y' " - << "problem invalid in 1 dimension." - << endl); - } - idir = 1; - } - - if (d_data_problem == "PIECEWISE_CONSTANT_Z") { - if (d_dim < tbox::Dimension(3)) { - TBOX_ERROR( - d_object_name << ": `PIECEWISE_CONSTANT_Z' " - << "problem invalid in 1 or 2 dimensions." << endl); - } - idir = 2; - } - - tbox::Array init_data_keys = init_data_db->getAllKeys(); - - if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); - } else { - TBOX_ERROR(d_object_name << ": " - << "`front_position' input required for " - << d_data_problem << " problem." << endl); - } - - d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); - - d_front_position.resizeArray(d_front_position.getSize() + 1); - d_front_position[d_front_position.getSize() - 1] = - d_grid_geometry->getXUpper()[idir]; - - d_interval_uval.resizeArray(d_number_of_intervals); - - int i = 0; - int nkey = 0; - bool found_interval_data = false; - - while (!found_interval_data - && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { - - if (!(init_data_keys[nkey] == "front_position")) { - - boost::shared_ptr interval_db( - init_data_db->getDatabase(init_data_keys[nkey])); - - if (interval_db->keyExists("uval")) { - d_interval_uval[i] = interval_db->getDouble("uval"); - } else { - TBOX_ERROR(d_object_name << ": " - << "`uval' data missing in input for key = " - << init_data_keys[nkey] << endl); - } - i++; - - found_interval_data = (i == d_number_of_intervals); - - } - - nkey++; - - } - - if ((d_data_problem == "SINE_CONSTANT_X") || - (d_data_problem == "SINE_CONSTANT_Y") || - (d_data_problem == "SINE_CONSTANT_Z")) { - if (init_data_db->keyExists("amplitude")) { - d_amplitude = init_data_db->getDouble("amplitude"); - } - if (init_data_db->keyExists("period")) { - init_data_db->getDoubleArray("period", d_period, d_dim.getValue()); - } else { - TBOX_ERROR( - d_object_name << ": " - << "`period' input required for SINE problem." << endl); - } - } - - if (!found_interval_data) { - TBOX_ERROR( - d_object_name << ": " - << "Insufficient interval data given in input" - << " for PIECEWISE_CONSTANT_*problem." - << endl); - } - - found_problem_data = true; - } - - if (!found_problem_data) { - TBOX_ERROR(d_object_name << ": " - << "`Initial_data' database found in input." - << " But bad data supplied." << endl); - } - - } // if !is_from_restart read in problem data - hier::IntVector periodic( d_grid_geometry->getPeriodicShift(hier::IntVector(d_dim, 1))); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; - } - - if (db->keyExists("Boundary_data")) { - - boost::shared_ptr bdry_db( - db->getDatabase("Boundary_data")); - - if (d_dim == tbox::Dimension(2)) { - appu::CartesianBoundaryUtilities2::readBoundaryInput(this, - bdry_db, - d_scalar_bdry_edge_conds, - d_scalar_bdry_node_conds, - periodic); - } - if (d_dim == tbox::Dimension(3)) { - appu::CartesianBoundaryUtilities3::readBoundaryInput(this, - bdry_db, - d_scalar_bdry_face_conds, - d_scalar_bdry_edge_conds, - d_scalar_bdry_node_conds, - periodic); - } - - } else { - TBOX_ERROR( - d_object_name << ": " - << "Key data `Boundary_data' not found in input. " << endl); + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } } @@ -2840,78 +2070,48 @@ void LinAdv::getFromInput( ************************************************************************* */ -void LinAdv::putToDatabase( - const boost::shared_ptr& db) const +void LinAdv::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("LINADV_VERSION", LINADV_VERSION); + restart_db->putInteger("LINADV_VERSION", LINADV_VERSION); - db->putDoubleArray("d_advection_velocity", d_advection_velocity, d_dim.getValue()); - - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); - - db->putString("d_data_problem", d_data_problem); - - if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, d_dim.getValue()); - db->putDouble("d_uval_inside", d_uval_inside); - db->putDouble("d_uval_outside", d_uval_outside); - } - - if ((d_data_problem == "PIECEWISE_CONSTANT_X") || - (d_data_problem == "PIECEWISE_CONSTANT_Y") || - (d_data_problem == "PIECEWISE_CONSTANT_Z") || - (d_data_problem == "SINE_CONSTANT_X") || - (d_data_problem == "SINE_CONSTANT_Y") || - (d_data_problem == "SINE_CONSTANT_Z")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); - if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_uval", d_interval_uval); - } - } - - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putDoubleArray("d_advection_velocity", + d_advection_velocity, + d_dim.getValue()); - if (d_dim == tbox::Dimension(2)) { - db->putDoubleArray("d_bdry_edge_uval", d_bdry_edge_uval); - } - if (d_dim == tbox::Dimension(3)) { - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_uval", d_bdry_face_uval); - } + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - db->putDoubleArray("d_dev_tol", d_dev_tol); - db->putDoubleArray("d_dev", d_dev); - db->putDoubleArray("d_dev_time_max", d_dev_time_max); - db->putDoubleArray("d_dev_time_min", d_dev_time_min); + restart_db->putDoubleVector("d_dev_tol", d_dev_tol); + restart_db->putDoubleVector("d_dev", d_dev); + restart_db->putDoubleVector("d_dev_time_max", d_dev_time_max); + restart_db->putDoubleVector("d_dev_time_min", d_dev_time_min); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - db->putDoubleArray("d_grad_tol", d_grad_tol); - db->putDoubleArray("d_grad_time_max", d_grad_time_max); - db->putDoubleArray("d_grad_time_min", d_grad_time_min); + restart_db->putDoubleVector("d_grad_tol", d_grad_tol); + restart_db->putDoubleVector("d_grad_time_max", d_grad_time_max); + restart_db->putDoubleVector("d_grad_time_min", d_grad_time_min); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - db->putDoubleArray("d_shock_onset", d_shock_onset); - db->putDoubleArray("d_shock_tol", d_shock_tol); - db->putDoubleArray("d_shock_time_max", d_shock_time_max); - db->putDoubleArray("d_shock_time_min", d_shock_time_min); + restart_db->putDoubleVector("d_shock_onset", d_shock_onset); + restart_db->putDoubleVector("d_shock_tol", d_shock_tol); + restart_db->putDoubleVector("d_shock_time_max", d_shock_time_max); + restart_db->putDoubleVector("d_shock_time_min", d_shock_time_min); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - db->putDoubleArray("d_rich_tol", d_rich_tol); - db->putDoubleArray("d_rich_time_max", d_rich_time_max); - db->putDoubleArray("d_rich_time_min", d_rich_time_min); + restart_db->putDoubleVector("d_rich_tol", d_rich_tol); + restart_db->putDoubleVector("d_rich_time_max", d_rich_time_max); + restart_db->putDoubleVector("d_rich_time_min", d_rich_time_min); } } @@ -2963,122 +2163,44 @@ void LinAdv::getFromRestart() << "Key data `d_fluxghosts' in restart file != FLUXG." << endl); } - d_data_problem = db->getString("d_data_problem"); - - if (d_data_problem == "SPHERE") { - d_data_problem_int = SPHERE; - d_radius = db->getDouble("d_radius"); - db->getDoubleArray("d_center", d_center, d_dim.getValue()); - d_uval_inside = db->getDouble("d_uval_inside"); - d_uval_outside = db->getDouble("d_uval_outside"); - } - - if ((d_data_problem == "PIECEWISE_CONSTANT_X") || - (d_data_problem == "PIECEWISE_CONSTANT_Y") || - (d_data_problem == "PIECEWISE_CONSTANT_Z") || - (d_data_problem == "SINE_CONSTANT_X") || - (d_data_problem == "SINE_CONSTANT_Y") || - (d_data_problem == "SINE_CONSTANT_Z")) { - d_number_of_intervals = db->getInteger("d_number_of_intervals"); - if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_uval = db->getDoubleArray("d_interval_uval"); - } - } - - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); - - if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_uval = db->getDoubleArray("d_bdry_edge_uval"); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); - - d_bdry_face_uval = db->getDoubleArray("d_bdry_face_uval"); - } - if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - d_dev_tol = db->getDoubleArray("d_dev_tol"); - d_dev_time_max = db->getDoubleArray("d_dev_time_max"); - d_dev_time_min = db->getDoubleArray("d_dev_time_min"); + d_dev_tol = db->getDoubleVector("d_dev_tol"); + d_dev_time_max = db->getDoubleVector("d_dev_time_max"); + d_dev_time_min = db->getDoubleVector("d_dev_time_min"); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - d_grad_tol = db->getDoubleArray("d_grad_tol"); - d_grad_time_max = db->getDoubleArray("d_grad_time_max"); - d_grad_time_min = db->getDoubleArray("d_grad_time_min"); + d_grad_tol = db->getDoubleVector("d_grad_tol"); + d_grad_time_max = db->getDoubleVector("d_grad_time_max"); + d_grad_time_min = db->getDoubleVector("d_grad_time_min"); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - d_shock_onset = db->getDoubleArray("d_shock_onset"); - d_shock_tol = db->getDoubleArray("d_shock_tol"); - d_shock_time_max = db->getDoubleArray("d_shock_time_max"); - d_shock_time_min = db->getDoubleArray("d_shock_time_min"); + d_shock_onset = db->getDoubleVector("d_shock_onset"); + d_shock_tol = db->getDoubleVector("d_shock_tol"); + d_shock_time_max = db->getDoubleVector("d_shock_time_max"); + d_shock_time_min = db->getDoubleVector("d_shock_time_min"); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - d_rich_tol = db->getDoubleArray("d_rich_tol"); - d_rich_time_max = db->getDoubleArray("d_rich_time_max"); - d_rich_time_min = db->getDoubleArray("d_rich_time_min"); + d_rich_tol = db->getDoubleVector("d_rich_tol"); + d_rich_time_max = db->getDoubleVector("d_rich_time_max"); + d_rich_time_min = db->getDoubleVector("d_rich_time_min"); } } } -/* - ************************************************************************* - * - * Routines to read boundary data from input database. - * - ************************************************************************* - */ - -void LinAdv::readDirichletBoundaryDataEntry( - const boost::shared_ptr& db, - string& db_name, - int bdry_location_index) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); - TBOX_ASSERT(!db_name.empty()); -#endif - if (d_dim == tbox::Dimension(2)) { - readStateDataEntry(db, - db_name, - bdry_location_index, - d_bdry_edge_uval); - } - if (d_dim == tbox::Dimension(3)) { - readStateDataEntry(db, - db_name, - bdry_location_index, - d_bdry_face_uval); - } -} - -void LinAdv::readNeumannBoundaryDataEntry( - const boost::shared_ptr& db, - string& db_name, - int bdry_location_index) -{ - NULL_USE(db); - NULL_USE(db_name); - NULL_USE(bdry_location_index); -} - void LinAdv::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval) + std::vector& uval) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(uval.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(uval.size()) > array_indx); if (db->keyExists("uval")) { uval[array_indx] = db->getDouble("uval"); @@ -3089,128 +2211,3 @@ void LinAdv::readStateDataEntry( } } - -/* - ************************************************************************* - * - * Routine to check boundary data when debugging. - * - ************************************************************************* - */ - -void LinAdv::checkBoundaryData( - int btype, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const -{ -#ifdef DEBUG_CHECK_ASSERTIONS - if (d_dim == tbox::Dimension(2)) { - TBOX_ASSERT(btype == Bdry::EDGE2D || - btype == Bdry::NODE2D); - } - if (d_dim == tbox::Dimension(3)) { - TBOX_ASSERT(btype == Bdry::FACE3D || - btype == Bdry::EDGE3D || - btype == Bdry::NODE3D); - } -#endif - - const boost::shared_ptr pgeom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const tbox::Array bdry_boxes = - pgeom->getCodimensionBoundaries(btype); - - hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - - for (int i = 0; i < bdry_boxes.getSize(); i++) { - hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif - int bloc = bbox.getLocationIndex(); - - int bscalarcase = 0, refbdryloc = 0; - if (d_dim == tbox::Dimension(2)) { - if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); -#endif - bscalarcase = scalar_bconds[bloc]; - refbdryloc = bloc; - } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); -#endif - bscalarcase = scalar_bconds[bloc]; - refbdryloc = d_node_bdry_edge[bloc]; - } - } - if (d_dim == tbox::Dimension(3)) { - if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); -#endif - bscalarcase = scalar_bconds[bloc]; - refbdryloc = bloc; - } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); -#endif - bscalarcase = scalar_bconds[bloc]; - refbdryloc = d_edge_bdry_face[bloc]; - } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); -#endif - bscalarcase = scalar_bconds[bloc]; - refbdryloc = d_node_bdry_face[bloc]; - } - } - - int num_bad_values = 0; - NULL_USE(num_bad_values); - - if (d_dim == tbox::Dimension(2)) { - num_bad_values = - appu::CartesianBoundaryUtilities2::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_edge_uval[refbdryloc]); - } - if (d_dim == tbox::Dimension(3)) { - num_bad_values = - appu::CartesianBoundaryUtilities3::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_face_uval[refbdryloc]); - } -#if (TESTING == 1) - if (num_bad_values > 0) { - tbox::perr << "\nLinAdv Boundary Test FAILED: \n" - << " " << num_bad_values - << " bad UVAL values found for\n" - << " boundary type " << btype << " at location " - << bloc << endl; - } -#endif - - } - -} - -void LinAdv::setAnalyticalTaggerTime( - double time) { - if (d_analytical_tagger) { - d_analytical_tagger->setTime(time); - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.h b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.h index 98f1807c..5c9cd12b 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdv.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -13,8 +13,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/appu/BoundaryUtilityStrategy.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/pdat/CellVariable.h" @@ -28,15 +26,16 @@ #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Serializable.h" #include +#include using namespace std; #define included_String #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/appu/VisItDataWriter.h" #include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SinusoidalFrontTagger.h" +#include "test/testlib/MeshGenerationStrategy.h" -#include +#include "boost/shared_ptr.hpp" /** * The LinAdv class provides routines for a sample application code that @@ -62,7 +61,6 @@ using namespace SAMRAI; class LinAdv: public tbox::Serializable, public algs::HyperbolicPatchStrategy, - public appu::BoundaryUtilityStrategy, public appu::VisDerivedDataStrategy { public: @@ -82,7 +80,8 @@ class LinAdv: const tbox::Dimension& dim, boost::shared_ptr input_db, boost::shared_ptr grid_geom, - SinusoidalFrontTagger* analytical_tagger = NULL); + const boost::shared_ptr& sine_wall = + boost::shared_ptr()); /** * The destructor for LinAdv does nothing. @@ -207,13 +206,20 @@ class LinAdv: const int tag_index, const bool uses_gradient_detector_too); + //@{ + //! @name Required implementations of HyperbolicPatchStrategy pure virtuals. + /// /// The following routines: /// /// setPhysicalBoundaryConditions() + /// getRefineOpStencilWidth(), + /// preprocessRefine() + /// postprocessRefine() /// /// are concrete implementations of functions declared in the - /// RefinePatchStrategy abstract base class. + /// RefinePatchStrategy abstract base class. Some are trivial + /// because this class doesn't do any pre/postprocessRefine. /// /** @@ -228,40 +234,87 @@ class LinAdv: const hier::IntVector& ghost_width_to_fill); - /** - * Write state of LinAdv object to the given database for restart. - * - * This routine is a concrete implementation of the function - * declared in the tbox::Serializable abstract base class. - */ + hier::IntVector + getRefineOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + void - putToDatabase( - const boost::shared_ptr& db) const; + preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } - /** - * This routine is a concrete implementation of the virtual function - * in the base class BoundaryUtilityStrategy. It reads DIRICHLET - * boundary state values from the given database with the - * given name string idenifier. The integer location index - * indicates the face (in 3D) or edge (in 2D) to which the boundary - * condition applies. - */ void - readDirichletBoundaryDataEntry( - const boost::shared_ptr& db, - string& db_name, - int bdry_location_index); + postprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + /// + /// The following routines: + /// + /// getCoarsenOpStencilWidth(), + /// preprocessCoarsen() + /// postprocessCoarsen() + /// + /// are concrete implementations of functions declared in the + /// CoarsenPatchStrategy abstract base class. They are trivial + /// because this class doesn't do any pre/postprocessCoarsen. + /// + + hier::IntVector + getCoarsenOpStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector::getZero(dim); + } + + void + preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + void + postprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + //@} /** - * This routine is a concrete implementation of the virtual function - * in the base class BoundaryUtilityStrategy. It is a blank implementation - * for the purposes of this class. + * Write state of LinAdv object to the given database for restart. + * + * This routine is a concrete implementation of the function + * declared in the tbox::Serializable abstract base class. */ void - readNeumannBoundaryDataEntry( - const boost::shared_ptr& db, - string& db_name, - int bdry_location_index); + putToRestart( + const boost::shared_ptr& restart_db) const; #ifdef HAVE_HDF5 /** @@ -274,16 +327,6 @@ class LinAdv: boost::shared_ptr viz_writer); #endif - /** - * Reset physical boundary values in special cases, such as when - * using symmetric (i.e., reflective) boundary conditions. - */ - void - boundaryReset( - hier::Patch& patch, - pdat::FaceData& traced_left, - pdat::FaceData& traced_right) const; - /** * Print all data members for LinAdv class. */ @@ -291,10 +334,6 @@ class LinAdv: printClassData( ostream& os) const; - void - setAnalyticalTaggerTime( - double time); - //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals virtual bool @@ -303,7 +342,8 @@ class LinAdv: const hier::Patch& patch, const hier::Box& region, const string& variable_name, - int depth_id) const; + int depth_id, + double simulation_time) const; private: /* @@ -317,7 +357,7 @@ class LinAdv: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void @@ -328,17 +368,7 @@ class LinAdv: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); - - /* - * Private member function to check correctness of boundary data. - */ - void - checkBoundaryData( - int btype, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + std::vector& uval); /* * Three-dimensional flux computation routines corresponding to @@ -362,7 +392,7 @@ class LinAdv: const tbox::Dimension d_dim; - SinusoidalFrontTagger* d_analytical_tagger; + boost::shared_ptr d_mesh_gen; /* * We cache pointers to the grid geometry @@ -371,10 +401,6 @@ class LinAdv: */ boost::shared_ptr d_grid_geometry; -#ifdef HAVE_HDF5 - boost::shared_ptr d_visit_writer; -#endif - /* * Data items used for nonuniform load balance, if used. */ @@ -395,7 +421,7 @@ class LinAdv: /** * linear advection velocity vector */ - double d_advection_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_advection_velocity[SAMRAI::MAX_DIM_VAL]; /* * Parameters for numerical method: @@ -416,78 +442,31 @@ class LinAdv: hier::IntVector d_nghosts; hier::IntVector d_fluxghosts; - /* - * Indicator for problem type and initial conditions - */ - string d_data_problem; - int d_data_problem_int; - - /* - * Input for SPHERE problem - */ - double d_radius; - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double d_uval_inside; - double d_uval_outside; - - /* - * Input for FRONT problem - */ - int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_uval; - - /* - * Boundary condition cases and boundary values. - * Options are: FLOW, REFLECT, DIRICHLET - * and variants for nodes and edges. - * - * Input file values are read into these arrays. - */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // 3D only. - - /* - * Boundary condition cases for scalar and vector (i.e., depth > 1) - * variables. These are post-processed input values and are passed - * to the boundary routines. - */ - tbox::Array d_node_bdry_edge; // 2D only. - tbox::Array d_edge_bdry_face; // 3D only. - tbox::Array d_node_bdry_face; // 3D only. - /* * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_uval; // 2D only. - tbox::Array d_bdry_face_uval; // 3D only. - - /* - * Input for Sine problem initialization - */ - double d_amplitude; - double d_period[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + std::vector d_bdry_edge_uval; // 2D only. + std::vector d_bdry_face_uval; // 3D only. /* * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_dev_tol; - tbox::Array d_dev; - tbox::Array d_dev_time_max; - tbox::Array d_dev_time_min; - tbox::Array d_grad_tol; - tbox::Array d_grad_time_max; - tbox::Array d_grad_time_min; - tbox::Array d_shock_onset; - tbox::Array d_shock_tol; - tbox::Array d_shock_time_max; - tbox::Array d_shock_time_min; - tbox::Array d_rich_tol; - tbox::Array d_rich_time_max; - tbox::Array d_rich_time_min; + std::vector d_refinement_criteria; + std::vector d_dev_tol; + std::vector d_dev; + std::vector d_dev_time_max; + std::vector d_dev_time_min; + std::vector d_grad_tol; + std::vector d_grad_time_max; + std::vector d_grad_time_min; + std::vector d_shock_onset; + std::vector d_shock_tol; + std::vector d_shock_time_max; + std::vector d_shock_time_min; + std::vector d_rich_tol; + std::vector d_rich_time_max; + std::vector d_rich_time_min; boost::shared_ptr t_analytical_tag; boost::shared_ptr t_init; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdvFort.h b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdvFort.h index 406a3fc1..e33a4fc8 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdvFort.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/LinAdvFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI linear advection example. * ************************************************************************/ @@ -15,7 +15,7 @@ extern "C" { /////////////////////////// 2D ////////////////////////// -void F77_FUNC(linadvinit2d, LINADVINIT2D) ( +void SAMRAI_F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -25,7 +25,7 @@ void F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *); -void F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( +void SAMRAI_F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( const int&, const double *, const double *, const double *, const int&, const int&, @@ -37,7 +37,7 @@ void F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) ( const double *, const double *, const double&, const double *); -void F77_FUNC(initsphere2d, INITSPHERE2D) ( +void SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -47,7 +47,7 @@ void F77_FUNC(initsphere2d, INITSPHERE2D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(stabledt2d, STABLEDT2D) ( +void SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, const int&, const int&, const int&, const int&, @@ -57,14 +57,14 @@ void F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, double&); -void F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( +void SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( const int&, const int&, const int&, const int&, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( +void SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -73,7 +73,7 @@ void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( +void SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, const double *, @@ -81,7 +81,7 @@ void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( double *, double *, double *, double *); -void F77_FUNC(chartracing2d2, CHARTRACING2D2) ( +void SAMRAI_F77_FUNC(chartracing2d2, CHARTRACING2D2) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -90,7 +90,7 @@ void F77_FUNC(chartracing2d2, CHARTRACING2D2) ( double *, double *, double *, double *); -void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( +void SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( const double&, const int&, const int&, const double *, const int&, const int&, @@ -100,7 +100,7 @@ void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, @@ -108,7 +108,7 @@ void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( double *, double *, double *, double *); -void F77_FUNC(consdiff2d, CONSDIFF2D) ( +void SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) ( const int&, const int&, const int&, const int&, const double *, @@ -116,7 +116,7 @@ void F77_FUNC(consdiff2d, CONSDIFF2D) ( const double *, double *); -void F77_FUNC(getbdry2d, GETBDRY2D) (const int&, +void SAMRAI_F77_FUNC(getbdry2d, GETBDRY2D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -126,7 +126,7 @@ void F77_FUNC(getbdry2d, GETBDRY2D) (const int&, double *, const double *, const double *, const int&); -void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( +void SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -137,7 +137,7 @@ void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const double *, int *, int *); -void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( +void SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -148,14 +148,14 @@ void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const double *, int *, int *); -void F77_FUNC(stufprobc2d, STUFPROBC2D) ( +void SAMRAI_F77_FUNC(stufprobc2d, STUFPROBC2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); /////////////////////////// 3D ////////////////////////// -void F77_FUNC(linadvinit3d, LINADVINIT3D) ( +void SAMRAI_F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -167,7 +167,7 @@ void F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *); -void F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( +void SAMRAI_F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, @@ -181,7 +181,7 @@ void F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) ( const double *, const double *, const double&, const double *); -void F77_FUNC(initsphere3d, INITSPHERE3D) ( +void SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -193,7 +193,7 @@ void F77_FUNC(initsphere3d, INITSPHERE3D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(stabledt3d, STABLEDT3D) ( +void SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, const int&, const int&, const int&, const int&, @@ -205,7 +205,7 @@ void F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, double&); -void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( +void SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -214,7 +214,7 @@ void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( +void SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -224,7 +224,7 @@ void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( +void SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -233,7 +233,7 @@ void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( double *, double *, double *, double *); -void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( +void SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -242,7 +242,7 @@ void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( double *, double *, double *, double *); -void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( +void SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( const double&, const int&, const int&, const int&, const double *, @@ -255,7 +255,7 @@ void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const int&, @@ -266,7 +266,7 @@ void F77_FUNC(fluxcorrec3d2d, FLUXCORREC3D2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d3d, FLUXCORREC3D3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d3d, FLUXCORREC3D3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -276,7 +276,7 @@ void F77_FUNC(fluxcorrec3d3d, FLUXCORREC3D3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(consdiff3d, CONSDIFF3D) ( +void SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -286,7 +286,7 @@ void F77_FUNC(consdiff3d, CONSDIFF3D) ( const double *, double *); -void F77_FUNC(getbdry3d, GETBDRY3D) (const int&, +void SAMRAI_F77_FUNC(getbdry3d, GETBDRY3D) (const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -298,21 +298,21 @@ void F77_FUNC(getbdry3d, GETBDRY3D) (const int&, double *, const double *, const double *, const int&); -void F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( +void SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( +void SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( +void SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -320,7 +320,7 @@ void F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( +void SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -333,7 +333,7 @@ void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const double *, int *, int *); -void F77_FUNC(detectshock3d, DETECTSHOCK3D) ( +void SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -346,7 +346,7 @@ void F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const double *, int *, int *); -void F77_FUNC(stufprobc3d, STUFPROBC3D) ( +void SAMRAI_F77_FUNC(stufprobc3d, STUFPROBC3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/MDA_Access_instances.C b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/MDA_Access_instances.C index 7c2b1f68..7f26e98f 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/MDA_Access_instances.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/MDA_Access_instances.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.depend index 153d4545..116efc34 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -36,6 +37,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -47,11 +49,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -59,27 +65,27 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -108,12 +114,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -125,9 +130,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -151,13 +157,12 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h LinAdv.C \ - LinAdv.h LinAdvFort.h SinusoidalFrontTagger.h + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/MeshGenerationStrategy.h LinAdv.C LinAdv.h \ + LinAdvFort.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -171,172 +176,38 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=MDA_Access_instances.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h MDA_Access_instances.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=SinusoidalFrontTagger.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SinusoidalFrontTagger.C \ - SinusoidalFrontTagger.h +${FILE_1}: ${DEPENDS_1} -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - -FILE_3=main.o -DEPENDS_3:=\ +FILE_2=main.o +DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -346,6 +217,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -357,7 +229,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -369,31 +244,34 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -422,12 +300,12 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -442,9 +320,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -468,13 +347,13 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h LinAdv.h \ - SinusoidalFrontTagger.h main.C + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/MeshGenerationStrategy.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h \ + $(TESTLIBDIR)/SphericalShellGenerator.h LinAdv.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ +DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -488,10 +367,9 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_2}: ${DEPENDS_2} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.in index c840e7bc..5494fe66 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/Makefile.in @@ -3,122 +3,127 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for linear advection performance test ## ######################################################################### -SAMRAI = @top_srcdir@ +SAMRAI = @top_srcdir@ SRCDIR = @srcdir@ SUBDIR = source/test/performance/LinAdv -VPATH = @top_srcdir@/$(SUBDIR) +VPATH = @srcdir@ OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: main include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=0 +SUBDIRS = fortran + +CPPFLAGS_EXTRA = NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" -CXX_OBJS = main.o LinAdv.o SinusoidalFrontTagger.o +CXX_OBJS = main.o LinAdv.o F_OBJS = \ - flux3d.o grad3d.o init3d.o stable3d.o stufprobc3d.o trace3d.o trace1d3d.o fluxcorner3d.o \ - flux2d.o grad2d.o init2d.o stable2d.o stufprobc2d.o trace2d.o trace1d2d.o - -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ - $(LIBSAMRAI) $(LDLIBS) -o $@ - -clean: - $(SAMCLEAN) - $(RM) *.f main + fortran/flux3d.o fortran/grad3d.o fortran/init3d.o \ + fortran/stable3d.o fortran/stufprobc3d.o fortran/trace3d.o \ + fortran/trace1d3d.o fortran/fluxcorner3d.o \ + fortran/flux2d.o fortran/grad2d.o fortran/init2d.o \ + fortran/stable2d.o fortran/stufprobc2d.o fortran/trace2d.o \ + fortran/trace1d2d.o -check: -# $(MAKE) check2d - $(MAKE) check3d +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) $(TESTLIB) \ + $(LIBSAMRAI) $(LDLIBS) -o $@ -check2d: main +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -check3d: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main performance_inputs/domainexpansion.input; - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main performance_inputs/domainexpansionb.input; +fortran/flux3d.o: -checkcompile: main +fortran/grad3d.o: -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile +fortran/init3d.o: -include $(SRCDIR)/Makefile.depend +fortran/stable3d.o: -FORTRAN = @srcdir@/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +fortran/stufprobc3d.o: -flux2d.o: $(FORTRAN)/2d/flux2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/flux2d.m4 > flux2d.f - $(F77) $(FFLAGS) -c flux2d.f -o $@ +fortran/trace3d.o: -grad2d.o: $(FORTRAN)/2d/grad2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/grad2d.m4 > grad2d.f - $(F77) $(FFLAGS) -c grad2d.f -o $@ +fortran/trace1d3d.o: -init2d.o: $(FORTRAN)/2d/init2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/init2d.m4 > init2d.f - $(F77) $(FFLAGS) -c init2d.f -o $@ +fortran/fluxcorner3d.o: -stable2d.o: $(FORTRAN)/2d/stable2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/stable2d.m4 > stable2d.f - $(F77) $(FFLAGS) -c stable2d.f -o $@ +fortran/flux2d.o: -stufprobc2d.o: $(FORTRAN)/2d/stufprobc2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/stufprobc2d.m4 > stufprobc2d.f - $(F77) $(FFLAGS) -c stufprobc2d.f -o $@ +fortran/grad2d.o: -trace2d.o: $(FORTRAN)/2d/trace2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/trace2d.m4 > trace2d.f - $(F77) $(FFLAGS) -c trace2d.f -o $@ +fortran/init2d.o: -trace1d2d.o: $(FORTRAN)/2d/trace1d2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/2d/trace1d2d.m4 > trace1d2d.f - $(F77) $(FFLAGS) -c trace1d2d.f -o $@ +fortran/stable2d.o: +fortran/stufprobc2d.o: +fortran/trace2d.o: -flux3d.o: $(FORTRAN)/3d/flux3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/flux3d.m4 > flux3d.f - $(F77) $(FFLAGS) -c flux3d.f -o $@ +fortran/trace1d2d.o: -fluxcorner3d.o: $(FORTRAN)/3d/fluxcorner3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/fluxcorner3d.m4 > fluxcorner3d.f - $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ +testlib: + cd $(TESTLIBDIR) && $(MAKE) library -grad3d.o: $(FORTRAN)/3d/grad3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/grad3d.m4 > grad3d.f - $(F77) $(FFLAGS) -c grad3d.f -o $@ +check: main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/domainexpansion.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main test_inputs/domainexpansionb.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo -init3d.o: $(FORTRAN)/3d/init3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/init3d.m4 > init3d.f - $(F77) $(FFLAGS) -c init3d.f -o $@ - -stable3d.o: $(FORTRAN)/3d/stable3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/stable3d.m4 > stable3d.f - $(F77) $(FFLAGS) -c stable3d.f -o $@ - -stufprobc3d.o: $(FORTRAN)/3d/stufprobc3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/stufprobc3d.m4 > stufprobc3d.f - $(F77) $(FFLAGS) -c stufprobc3d.f -o $@ +checkcompile: main -trace3d.o: $(FORTRAN)/3d/trace3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/trace3d.m4 > trace3d.f - $(F77) $(FFLAGS) -c trace3d.f -o $@ +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: main + @for i in performance_inputs/*.input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i}; \ + done + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.timing* + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -trace1d3d.o: $(FORTRAN)/3d/trace1d3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/3d/trace1d3d.m4 > trace1d3d.f - $(F77) $(FFLAGS) -c trace1d3d.f -o $@ +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/README b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/README index 85c32d60..23f3c5f9 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/README +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/README @@ -3,12 +3,12 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Linear Advection Equation Example ## ######################################################################### -This README explains how to use the AMR LinAdv sample application +This README explains how to use the AMR LinAdv performance test code in the SAMRAI library. The files included in this directory are as follows: @@ -25,65 +25,27 @@ library consider the object construction pattern in the main.C file. For more details on these files and the LinAdv class consult the comments in those files and the LinAdv.h class header file. -COMPILE and RUN ---------------- -Compile: make where = "main2d" for 2D case - = "main3d" for 3D case - -Run: - - main2d ... Serial run (w/o MPI) - mpirun -np main2d ... Parallel run (with MPI) - - NOTE: is the FULL-PATH of the input file - - There are sample input files in the subdirectory sample_input. - sphere-2d.input - advecting sphere with periodic boundaries - sphere-2d-per-4levels.input - same as above but with 4 levels - sphere-2d-re.input - advecting sphere using Richardson extrapolation - sine-front-2d.input - advecting sphere with sinusoidal front - sphere-3d.input - advecting sphere with periodic boundaries - - example: - main2d sample_input/sphere-2d.input - mpirun -np 2 main2d sample_input/sphere-2d.input - -Restarted Run: - - same format as regular run but add - to end of command. - is directory where restart files are stored - (set in input file). - is the identifier of which restart file to use - (generally the timestep). - - example: (to start from timestep #5) - - main2d sample_input/sphere-2d.input restart_sphere2d 5 - mpirun -np 2 main2d sample_input/sphere-2d.input restart_sphere2d 5 - - NOTE: The ordinary use of our restart functionality requires that - a problem can only be restarted on on the same number of - processors on which the problem was originally run. To restart - on a different number of processors, used the - restart-redistribute tool in SAMRAI/tools/restart. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one the following input files: + test_inputs/domainexpansion.input + test_inputs/domainexpansionb.input + test_inputs/domainexpansiont.input + performance_inputs/domainexpansionc.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main INPUT FILES: ------------ - Two example input files are included with the LinAdv application: - - sample_input/sphere-2d.input ... 2d sphere with large uval - differences at time zero - simulates - advection of "blob" of fluid in 2D. - sample_input/sphere-2d-re.input ... same as above case but with - Richardson extrapolation applied to - resolve solution errors. - sample_input/sphere-3d.input ... 3d sphere with large uval - differences at time zero - simulates - advection of "blob" of fluid in 3D. - - The LinAdv application code is composed of various classes that implement the algorithmic and numerical routines in the AMR solution process (see comments in the main.C code for more discussion of the various objects @@ -143,36 +105,23 @@ INPUT FILES: // writing of visualization files. // viz_dump_dirname -- (char string) directory where viz files are // writen (may include a path). VisIt requires a - // non-empty string. Vizamrai permits an empty string, - // in which case dumps go to directory where main2d/3d - // exists. If both data writers are used, directory name - // must be nonempty, and main.C will append _VisIt, - // _Vizamrai to dirname. - // viz_dump_filename -- (char string) Nonempty file prefix required for - // vizamrai filenames. Not used by VisIt. + // non-empty string. // visit_number_procs_per_file // -- (int >= 1) for parallel runs, number of processors // that share a single common dump file. If this parameter // > number processors being used, all processors share - // single dump file. Not used by Vizamrai. + // single dump file. // // For example, the following inputs: viz_dump_interval = 1 viz_dump_dirname = "viz_sphere-2d" - viz_dump_filename = "sphere-2d" // would result in the following dump structure: - // main2d - // viz_sphere-2d_VisIt/ + // main + // viz_sphere-2d // visit_dump.00000/ // visit_dump.00001/ // ... // dumps.visit - // viz_sphere-2d_Vizamrai/ - // sphere-2d.00000.vis - // sphere-2d.00001.vis - // ... - // If only one data writer is selected, the - // _VisIt, _Vizamrai extension will be omitted. // Restart dump parameters. // restart_interval -- (int) the interval in timesteps over coarsest @@ -409,253 +358,3 @@ INPUT FILES: } - "CartesianGeometry" input section - --------------------------------- - CartesianGeometry { - // Specify lower/upper corners of the computational domain and a - // set of non-overlapping boxes defining domain interior. If union - // of boxes is not a parallelpiped, lower/upper corner data corresponds - // to min/max corner indices over all boxes given. - // x_lo -- (double array) lower corner of computational domain [REQD] - // x_up -- (double array) upper corner of computational domain [REQD] - // domain_boxes -- (box array) set of boxes that define interior of - // hysical domain. [REQD] - // periodic_dimension -- (int array) coordinate directions in which - // domain is periodic. Zero indicates not - // periodic, non-zero value indicates periodicity. - // [0] - x_lo = 0.e0 , 0.e0 - x_up = 30.e0 , 20.e0 - domain_boxes = [(0,0),(59,39)] - } - - - "GriddingAlgorithm" input section - --------------------------------- - GriddingAlgorithm { - // Information used to create patches in AMR hierarchy. - // max_levels -- (int) max number of mesh levels in hierarchy [REQD] - // - // For most of the following parameters, the number of precribed data - // values need not match the number of levels in the hierarchy - // (determined by max_levels). If more values are given than number - // of levels, extraneous values will be ignored. If less are give, then - // values that correspond to individual levels will apply to those - // levels. Missing values will be taken from those for the finest - // level specified. - // - // ratio_to_coarser { - // level_1 -- (int array) ratio between index spaces on - // level 1 to level 0 [REQD] - // level_2 -- (int array) ratio between index spaces on - // level 2 to level 1 [REQD] - // etc.... - // } - // largest_patch_size { - // level_0 -- (int array) largest patch allowed on level 0. - // [REQD] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - // smallest_patch_size { - // level_0 -- (int array) smallest patch allowed on level 0. - // [max ghost width for all variables] - // level_1 -- (int array) " " " " level 1 - // [level 0 entry] - // etc.... - // } - max_levels = 3 - ratio_to_coarser { - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 40 , 40 - } - smallest_patch_size { - level_0 = 16 , 16 - } - - // Tolerances for gridding efficiency and box chopping operations. - // efficiency_tolerance -- (double array) minimum percentage of tagged - // cells allowed in a box [0.8 for each level] - // combine_efficiency -- (double array) threshold specifying when a - // box may be chopped into two smaller boxes. - // If sum of the volumes of smaller boxes is > - // combine efficiency * volume of larger box, - // then larger box will not be chopped. - // [0.8 for each level] - // proper_nesting_buffer -- (int array) number of coarse cells by which - // the next finer level is nested within its - // interior. [1 for each level] - efficiency_tolerance = 0.85e0 - combine_efficiency = 0.95e0 - proper_nesting_buffer = 1 - - // Option to read or write gridding information - // write_regrid_boxes -- (bool) Output sequence of refine boxes to file - // read_regrid_boxes -- (bool) Read sequence of refine boxes from file - // regrid_boxes_filename -- (string) file name used for reading or writing - // boxes. - // - // Reading and writing options require some user intervention to assure - // they work properly. Please consult Andy Wissink (awissink@llnl.gov) - // if you are interested in using these options. - write_regrid_boxes = TRUE - regrid_boxes_filename = TRUE - - } - - "StandardTagAndInitialize" input section - --------------------------------------------- - StandardTagAndInitialize { - // Specification of the type of tagging to be performed - // tagging_method -- (string array) one or more entries specifying - // the tagging algorithm used. Options include: - // "GRADIENT_DETECTOR" - // "RICHARDSON_EXTRAPOLATION" - // "REFINE_BOXES" - // - // REFINE_BOXES allows you to prescribe where refinement should occur. - // If this option is used, you must also supply a RefineBoxes database - // entry with the refine boxes on different levels specified. i.e. - // RefineBoxes{ - // level_0 -- (BoxArray) Boxes to be refined on level 0 - // level_1 -- (BoxArray) Boxes to be refined on level 1 - // etc. - // - // Gradient detection option. - tagging_method = "GRADIENT_DETECTOR" - // - // Richarson extrapolation option. - tagging_method = "RICHARDSON_EXTRAPOLATION" - // - // Static refine boxes option. - tagging_method = "REFINE_BOXES" - RefineBoxes { - level0_boxes = [(15,0),(29,14)] - level1_boxes = [(65,10),(114,40)] - } - // Combination. - tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" - } - - - "HyperbolicLevelIntegrator" input section - ----------------------------------------- - HyperbolicLevelIntegrator{ - // CFL used to determine timestep on each level. - // cfl -- (double) timestep at each level is given by - // dt = cfl*dx/a, where a is max wave speed. [REQD] - // cfl_init -- (double) cfl factor used for initial step [REQD] - cfl = 0.9e0 - cfl_init = 0.9e0 - - // Options for timestep computation. - // lag_dt_computation -- (bool) if true, characteristic data on the - // patch is not recomputed before computing the - // timestep; otherwise it uses data from - // preceding flux calculation [TRUE]. - // use_ghosts_to_compute_dt -- (bool) if true, fill ghost data before - // computing timestep on each patch [TRUE]. - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - } - - - "TimeRefinementIntegrator" input section - ----------------------------------------- - TimeRefinementIntegrator{ - // Time stepping specifications. - // start_time -- (double) initial integration time [REQD] - // end_time -- (double) final integration time [REQD] - // grow_dt -- (double) limit factor on maximum growth of timestep - // from one step to the next; useful for ramping up - // timestep size or to prevent rapid growth in timestep - // [REQD] - // max_integrator_steps -- max number timesteps on coarsest level [REQD] - // tag_buffer -- (int array) amount by which cells tagged for error are - // buffered before new fine patches are created to cover - // tagged regions. By default, it is the interval of - // timesteps between successive regids on level. - // [regrid_interval] - start_time = 0.e0 - end_time = 100.e0 - grow_dt = 1.1e0 - max_integrator_steps = 10 - tag_buffer = 1,1,1,1 // max of 4 finer levels in hierarchy - } - - "LoadBalancer" input section - ---------------------------------- - LoadBalancer { - // using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) - } - - "DataWriter" input section - ---------------------------------- - DataWriter { - // Specify which variables to write to visualization file(s). - // Variable_Names -- (string array) list of variable names to - // write to the viz file. - // Variable_Types -- (string array) list of the corresponding - // variable type to write to the viz file. - // Must be either "primitive" or "derived". - // Note that until vizamrai is updated to use - // HDF5, "derived" must always be used. - // Variable_Depths -- (int array) depth, or number of components, of - // each variable. - // Variable_Scales -- (double array) list of scaling factors for each - // variable to be written to the viz file. - Variable_Names = "uval" - Variable_Types = "Derived" - Variable_Depths = 1 - Variable_Scales = 1.0 - } - - "TimerManager" input section - ---------------------------- - TimerManager{ - // Specify which timers to invoke - // timer_list -- (string array) list of timers to be turned on - for - // complete list of available timers, see - // SAMRAI/docs/userdocs/timing.pdf [null] - timer_list = "apps::main::*", - "apps::Euler::computeFluxesOnPatch()", - "algs::GriddingAlgorithm::*", - "xfer::*::*" - - // Various output options. - // print_total -- (bool) print total time [TRUE] - // print_exclusive -- (bool) output exclusive time - i.e. time spent - // exclusively in each routine. A nice way to - // identify routines with bottlenecks, but is more - // expensive than recording total time [FALSE]. - // print_wall -- (bool) output wallclock time [TRUE] - // print_user -- (bool) output user time [FALSE] - // print_sys -- (bool) output system time [FALSE] - // print_summed -- (bool) output sum of times measured across all - // processors during a parallel run [FALSE]. - // print_max -- (bool) output maximum time spent on any one - // processor, along with the processor ID [FALSE] - // print_percentage -- (bool) output percentage of total time for each - // printed timer [TRUE] - // print_concurrent -- (bool) in the process of performing exclusive - // time, a nested call tree is created; print the - // tree [FALSE] - // print_timer_overhead -- (bool) each timer start/stop invocation - // incurs about one-half a millionth of a second - // overhead. This option will output the number of - // invocations and the total predicted overhead for - // all the timers [FALSE] - // print_threshold -- (double) do not print any timers that constitute - // < (print_threshold)% of overall run time. Useful - // to prevent gobs of output if many timers are - // turned on. [0.25] - print_exclusive = TRUE - print_max = TRUE - print_timer_overhead = TRUE - print_threshold = 0.0 - } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.C b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.C deleted file mode 100644 index 9d5b4ced..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.C +++ /dev/null @@ -1,623 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class implementation - * - ************************************************************************/ -#include "SinusoidalFrontTagger.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include "SAMRAI/pdat/MDA_Access.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - -SinusoidalFrontTagger::SinusoidalFrontTagger( - const std::string& object_name, - const tbox::Dimension& dim, - tbox::Database* database): - d_name(object_name), - d_dim(dim), - d_amplitude(0.2), - d_ghost_cell_width(dim, 0), - d_buffer_cells(dim, 1), - d_allocate_data(true), - d_time(0.5) -{ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(variable_db != NULL); -#endif - - tbox::Array init_disp; - tbox::Array velocity; - tbox::Array period; - - if (database != NULL) { - d_allocate_data = - database->getBoolWithDefault("allocate_data", - d_allocate_data); - if (database->isInteger("buffer_cells")) { - database->getIntegerArray("buffer_cells", - &d_buffer_cells[0], d_dim.getValue()); - } - for (int ln = 0; true; ++ln) { - std::string name("buffer_space_"); - name = name + tbox::Utilities::intToString(ln); - if (database->isDouble(name)) { - d_buffer_space.resizeArray(d_dim.getValue() * (ln + 1)); - database->getDoubleArray(name, &d_buffer_space[d_dim.getValue() * ln], d_dim.getValue()); - } else { - break; - } - } - if (database->isDouble("period")) { - period = - database->getDoubleArray("period"); - } - if (database->isDouble("init_disp")) { - init_disp = - database->getDoubleArray("init_disp"); - } - if (database->isDouble("velocity")) { - velocity = - database->getDoubleArray("velocity"); - } - d_amplitude = - database->getDoubleWithDefault("amplitude", - d_amplitude); - d_time = - database->getDoubleWithDefault("time", - d_time); - - if (database->isInteger("ghost_cell_width")) { - database->getIntegerArray("ghost_cell_width", - &d_ghost_cell_width[0], d_dim.getValue()); - } - } - - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - d_init_disp[idim] = idim < init_disp.size() ? init_disp[idim] : 0.0; - d_velocity[idim] = idim < velocity.size() ? velocity[idim] : 0.0; - d_period[idim] = idim < period.size() ? period[idim] : 1.0e20; - } - - const std::string context_name = d_name + std::string(":context"); - d_context = variable_db->getContext(context_name); - - boost::shared_ptr dist_var( - new pdat::NodeVariable(dim, d_name + ":dist")); - d_dist_id = variable_db->registerVariableAndContext(dist_var, - d_context, - d_ghost_cell_width); - - boost::shared_ptr tag_var( - new pdat::CellVariable(dim, d_name + ":tag")); - d_tag_id = variable_db->registerVariableAndContext(tag_var, - d_context, - d_ghost_cell_width); - - t_setup = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::setup"); - t_node_pos = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::node_pos"); - t_distance = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::distance"); - t_tag_cells = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::tag_cells"); - t_copy = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::copy"); -} - -SinusoidalFrontTagger::~SinusoidalFrontTagger() -{ -} - -void SinusoidalFrontTagger::initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& base_hierarchy, - /*! Level to initialize */ - const int ln, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_base_level, - const bool allocate_data) -{ - NULL_USE(can_be_refined); - NULL_USE(old_base_level); - - TBOX_ASSERT(base_hierarchy); - - /* - * Reference the level object with the given index from the hierarchy. - */ - boost::shared_ptr level( - base_hierarchy->getPatchLevel(ln)); - - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - initializePatchData(patch, - init_data_time, - initial_time, - allocate_data); - } - -#if 0 - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - level->allocatePatchData(d_dist_id); - level->allocatePatchData(d_tag_id); - } - computeLevelData(base_hierarchy, ln, d_time /*init_data_time*/, - d_dist_id, d_tag_id, old_base_level); - } -#endif -} - -void SinusoidalFrontTagger::initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) -{ - NULL_USE(initial_time); - - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - if (!patch.checkAllocated(d_dist_id)) { - patch.allocatePatchData(d_dist_id); - } - if (!patch.checkAllocated(d_tag_id)) { - patch.allocatePatchData(d_tag_id); - } - boost::shared_ptr > dist_data( - patch.getPatchData(d_dist_id), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch.getPatchData(d_tag_id), - boost::detail::dynamic_cast_tag()); - TBOX_ASSERT(dist_data); - TBOX_ASSERT(tag_data); - computePatchData(patch, init_data_time, - dist_data.get(), tag_data.get()); - } - } -} - -void SinusoidalFrontTagger::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - -void SinusoidalFrontTagger::applyGradientDetector( - const boost::shared_ptr& base_hierarchy_, - const int ln, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation) -{ - NULL_USE(initial_time); - NULL_USE(uses_richardson_extrapolation); - TBOX_ASSERT(base_hierarchy_); - boost::shared_ptr level_( - base_hierarchy_->getPatchLevel(ln)); - TBOX_ASSERT(level_); - - hier::PatchLevel& level = *level_; - - for (hier::PatchLevel::iterator pi(level.begin()); - pi != level.end(); ++pi) { - hier::Patch& patch = **pi; - - boost::shared_ptr tag_data( - patch.getPatchData(tag_index)); - if (!tag_data) { - TBOX_ERROR("Data index " << tag_index - << " does not exist for patch.\n"); - } - boost::shared_ptr > tag_cell_data_( - tag_data, - boost::detail::dynamic_cast_tag()); - if (!tag_cell_data_) { - TBOX_ERROR("Data index " << tag_index - << " is not cell int data.\n"); - } - - if (d_allocate_data) { - // Use internally stored data. - boost::shared_ptr saved_tag_data( - patch.getPatchData(d_tag_id)); - tag_cell_data_->copy(*saved_tag_data); - } else { - // Compute tag data for patch. - computePatchData(patch, - error_data_time, - NULL, - tag_cell_data_.get()); - } - - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchHierarchy& hierarchy) -{ - int ln; - for (ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - boost::shared_ptr level(hierarchy.getPatchLevel(ln)); - deallocatePatchData(*level); - } -} - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchLevel& level) -{ - level.deallocatePatchData(d_dist_id); - level.deallocatePatchData(d_tag_id); -} - -/* - * Deallocate patch data allocated by this class. - */ -void SinusoidalFrontTagger::computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time) -{ - d_time = time; - if (!d_allocate_data) return; - - for (int ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - computeLevelData(hierarchy, ln, time, d_dist_id, d_tag_id); - } -} - -/* - * Compute the solution data for a level. - * Can copy data from old level (if any) to support - * initializeLevelData(). - */ - -void SinusoidalFrontTagger::computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level) const -{ - NULL_USE(old_level); - - const boost::shared_ptr level( - hierarchy.getPatchLevel(ln)); - - /* - * Initialize data in all patches in the level. - */ - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - boost::shared_ptr > dist_data; - if (dist_id >= 0) { - dist_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(dist_id)); - } - boost::shared_ptr > tag_data; - if (tag_id >= 0) { - tag_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(tag_id)); - } - computePatchData(patch, time, - dist_data.get(), - tag_data.get()); - } -} - -/* - * Compute the solution data for a patch. - */ - -void SinusoidalFrontTagger::computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const -{ - - t_setup->start(); - - TBOX_ASSERT(d_hierarchy); - TBOX_ASSERT(patch.inHierarchy()); - - const int ln = patch.getPatchLevelNumber(); - const boost::shared_ptr level( - d_hierarchy->getPatchLevel(ln)); - const hier::IntVector& ratio(level->getRatioToLevelZero()); - - const hier::Box& pbox = patch.getBox(); - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const double* xlo = patch_geom->getXLower(); - - const double* dx = patch_geom->getDx(); - - // Compute the size of buffer to tag around cells crossing front. - hier::IntVector buffer(d_buffer_cells); - for (int i = 0; i < d_dim.getValue(); ++i) { - if (d_buffer_space.size() > ln * d_dim.getValue() + i) { - int space_based_buffer = - int(d_buffer_space[ln * d_dim.getValue() + i] / dx[i] + 0.5); - if (space_based_buffer > buffer(i)) buffer(i) = space_based_buffer; - } - } - // std::cout << "buffer for ln of " << ln << " is " << buffer << std::endl; - - /* - * We need at least buffer ghost cells to compute - * the tags, but the data does not have as many ghost cells. - * So we create temporary patch data with the required "ghost" - * buffer for computing tag values. (We could give the real - * data the required ghost cells, but that may affect the - * regridding algorithm I'm testing.) - */ - hier::IntVector required_tmp_buffer(buffer); - required_tmp_buffer *= ratio; - pdat::NodeData tmp_dist(pbox, 1, required_tmp_buffer); - pdat::CellData tmp_tag(pbox, 1, required_tmp_buffer); - - /* - * Determine what x-cell-index contains the sinusoidal front. - */ - - double wave_number[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - wave_number[idim] = 2 * 3.141592654 / d_period[idim]; - } - const int iperiod = int(d_period[0] / dx[0] + 0.5); - - t_setup->stop(); - - t_node_pos->start(); - - hier::Box front_box = pbox; - front_box.grow(required_tmp_buffer); - front_box.growUpper(hier::IntVector(d_dim, 1)); - // Squash front_box to a single plane. - front_box.upper(0) = front_box.lower(0); - const int ifront = front_box.lower(0); - - pdat::ArrayData front_i_(front_box, 1); - - MDA_Access > front_i2; - MDA_Access > front_i3; - if (d_dim == tbox::Dimension(2)) { - front_i2 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int j = front_i2.beg(1); j < front_i2.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number[1] * (y + d_init_disp[1] - d_velocity[1] * time)); - double fx = d_amplitude * siny + d_init_disp[0] + d_velocity[0] * time; - front_i2(ifront, j) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); - // std::cout << i << '\t' << j << '\t' << y << '\t' << front_i(i,j) << std::endl; - } - } else if (d_dim == tbox::Dimension(3)) { - front_i3 = MDA_Access >( - front_i_.getPointer(0), - &front_i_.getBox().lower()[0], - &front_i_.getBox().upper()[0]); - for (int k = front_i3.beg(2); k < front_i3.end(2); ++k) { - double z = xlo[2] + dx[2] * (k - pbox.lower(2)); - double sinz = - sin(wave_number[2] * (z + d_init_disp[2] - d_velocity[2] * time)); - for (int j = front_i3.beg(1); j < front_i3.end(1); ++j) { - double y = xlo[1] + dx[1] * (j - pbox.lower(1)); - double siny = - sin(wave_number[1] * (y + d_init_disp[1] + d_velocity[1] * time)); - double fx = d_amplitude * siny * sinz + d_init_disp[0] - + d_velocity[0] * time; - front_i3(ifront, j, k) = int((fx - xlo[0]) / dx[0]) + pbox.lower(0); -#if 0 - std::cout << ifront - << '\t' << j - << '\t' << k - << '\t' << y - << '\t' << siny - << '\t' << z - << '\t' << sinz - << '\t' << fx - << std::endl; -#endif - } - } - } - - t_node_pos->stop(); - - if (dist_data != NULL) { - t_distance->start(); - - pdat::NodeData::iterator ni(tmp_dist.getGhostBox(), true); - pdat::NodeData::iterator niend(tmp_dist.getGhostBox(), false); - for ( ; ni != niend; ++ni) { - const pdat::NodeIndex& index = *ni; - if (d_dim == tbox::Dimension(2)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i2(ifront, index(1)) * dx[0]; - } else if (d_dim == tbox::Dimension(3)) { - tmp_dist(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_i3(ifront, index(1), index(2)) * dx[0]; - } - } - // tmp_dist.print(tmp_dist.getBox(),0,plog); - - t_distance->stop(); - } - - if (tag_data != NULL) { - - t_tag_cells->start(); - - tag_data->fill(0); - const hier::IntVector& glower = tag_data->getGhostBox().lower(); - const hier::IntVector& gupper = tag_data->getGhostBox().upper(); - - if (d_dim == tbox::Dimension(2)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int if3 = front_i3(ifront, j); - while (if3 >= glower(0)) { - if3 -= iperiod; - } - while (if3 + iperiod < glower(0)) { - if3 += iperiod; - } - for (if3 += iperiod; if3 <= gupper(0); if3 += iperiod) { - tag_aa(if3, j) = 1; - } - } - } else if (d_dim == tbox::Dimension(3)) { - MDA_Access > tag_aa( - tag_data->getPointer(0), - &tag_data->getGhostBox().lower()[0], - &tag_data->getGhostBox().upper()[0]); - for (int k = pbox.lower(2); k <= pbox.upper(2); ++k) { - for (int j = pbox.lower(1); j <= pbox.upper(1); ++j) { - int if3 = front_i3(ifront, j, k); - while (if3 >= glower(0)) { - if3 -= iperiod; - } - while (if3 + iperiod < glower(0)) { - if3 += iperiod; - } - for (if3 += iperiod; if3 <= gupper(0); if3 += iperiod) { - tag_aa(if3, j, k) = 1; - } - } - } - } - - t_tag_cells->stop(); - - } - - t_copy->start(); - - /* - * Copy computed data to output. Recall that the convention is - * to send in a NULL pointer to indicate that data is not wanted. - */ - if (dist_data != NULL) { - dist_data->copy(tmp_dist); - } - - t_copy->stop(); -} - -#ifdef HAVE_HDF5 -int SinusoidalFrontTagger::registerVariablesWithPlotter( - appu::VisItDataWriter& writer) -{ - /* - * Register variables with plotter. - */ - if (d_allocate_data) { - writer.registerPlotQuantity("Distance to front", "SCALAR", d_dist_id); - writer.registerPlotQuantity("Tag value", "SCALAR", d_tag_id); - } else { - writer.registerDerivedPlotQuantity("Distance to front", "SCALAR", this, - // hier::IntVector(0), - 1.0, - "NODE"); - writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); - } - return 0; -} -#endif - -bool SinusoidalFrontTagger::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - NULL_USE(region); - NULL_USE(depth_index); - - TBOX_ASSERT(d_allocate_data == false); - if (variable_name == "Distance to front") { - pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, - 0)); - computePatchData(patch, d_time, &dist_data, NULL); - pdat::NodeData::iterator ciend(patch.getBox(), false); - for (pdat::NodeData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = dist_data(*ci); - } - } else if (variable_name == "Tag value") { - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - computePatchData(patch, d_time, NULL, &tag_data); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} - -void SinusoidalFrontTagger::setTime( - double time) -{ - d_time = time; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.h b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.h deleted file mode 100644 index 4bd6e442..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/SinusoidalFrontTagger.h +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class declaration - * - ************************************************************************/ -#ifndef included_SinusoidalFrontTagger -#define included_SinusoidalFrontTagger - -#include -#include -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Timer.h" - -using namespace SAMRAI; - -/*! - * @brief Class to tag a sinusoidal "front" in given domain. - */ -class SinusoidalFrontTagger: - public mesh::StandardTagAndInitStrategy, - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - SinusoidalFrontTagger( - /*! Ojbect name */ - const std::string& object_name, - const tbox::Dimension& dim, - /*! Input database */ - tbox::Database* database = NULL); - - ~SinusoidalFrontTagger(); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - /*! - * @brief Allocate and initialize data for a new level - * in the patch hierarchy. - * - * This is where you implement the code for initialize data on the - * grid. Nevermind when it is called or where in the program that - * happens. All the information you need to initialize the grid - * are in the arguments. - * - * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() - */ - virtual void - initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& hierarchy, - /*! Level to initialize */ - const int level_number, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_level = - boost::shared_ptr(), - /*! Whether data on new patch needs to be allocated */ - const bool allocate_data = true); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level); - - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data); - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - - void - setTime( - double time); - -public: - /*! - * @brief Deallocate internally managed patch data on level. - */ - void - deallocatePatchData( - hier::PatchLevel& level); - - /*! - * @brief Deallocate internally managed patch data on hierarchy. - */ - void - deallocatePatchData( - hier::PatchHierarchy& hierarchy); - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - - /* - * Compute patch data allocated by this class, on a hierarchy. - */ - void - computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time); - - /*! - * @brief Compute distance and tag data for a level. - */ - void - computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level = - boost::shared_ptr()) const; - - /*! - * @brief Compute distance and tag data for a patch. - */ - void - computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const; - -private: - std::string d_name; - - const tbox::Dimension d_dim; - - boost::shared_ptr d_hierarchy; - - /*! - * @brief Period of sinusoid. - */ - double d_period[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Initial displacement. - */ - double d_init_disp[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Front velocity. - */ - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Amplitude of sinusoid. - */ - double d_amplitude; - - /*! - * @brief ghost cell width of internal data. - * - * Optional. Meant to influence gridding parameters. Defaults to zero. - */ - hier::IntVector d_ghost_cell_width; - - /*! - * @brief Number of cells to tag around cells intersecting the front. - */ - hier::IntVector d_buffer_cells; - - tbox::Array d_buffer_space; - - boost::shared_ptr d_context; - - /*! - * @brief Distance from the front in the x direction. - */ - int d_dist_id; - /*! - * @brief Value of tag based on distance from front. - */ - int d_tag_id; - - /*! - * @brief Whether to allocate data on the mesh. - */ - bool d_allocate_data; - - /*! - * @brief Front time. - */ - double d_time; - - boost::shared_ptr t_setup; - boost::shared_ptr t_node_pos; - boost::shared_ptr t_distance; - boost::shared_ptr t_tag_cells; - boost::shared_ptr t_copy; - -}; - -#endif // included_ssup_SinusoidalFrontTagger diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/flux2d.m4 deleted file mode 100644 index d9ee3710..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/flux2d.m4 +++ /dev/null @@ -1,229 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,1)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(FORTDIR/2d/m4flux2d.i)dnl - - subroutine fluxcorrec2d(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & dx, - & advecspeed,uval, - & flux0,flux1, - & trlft0,trlft1, - & trrgt0,trrgt1) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL2d(ifirst,ilast,CELLG)), - & flux0(FACE2d0(ifirst,ilast,FLUXG)), - & flux1(FACE2d1(ifirst,ilast,FLUXG)), - & trlft0(FACE2d0(ifirst,ilast,FACEG)), - & trrgt0(FACE2d0(ifirst,ilast,FACEG)), - & trlft1(FACE2d1(ifirst,ilast,FACEG)), - & trrgt1(FACE2d1(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1 - REAL trnsvers - -c write(6,*) "In fluxcorrec()" -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c correct the 1-direction with 0-fluxes -c write(6,*) " correct the 1-direction with 0-fluxes" - do ic1=ifirst1-1,ilast1+1 - do ic0=ifirst0-1,ilast0+1 - trnsvers= (flux0(ic0+1,ic1)-flux0(ic0,ic1))*0.5/dx(0) - - trrgt1(ic1 ,ic0)= trrgt1(ic1 ,ic0) - trnsvers - trlft1(ic1+1,ic0)= trlft1(ic1+1,ic0) - trnsvers - enddo - enddo -c call flush(6) - -c correct the 0-direction with 1-fluxes -c write(6,*) " correct the 0-direction with 1-fluxes" - do ic0=ifirst0-1,ilast0+1 - do ic1=ifirst1-1,ilast1+1 - trnsvers= (flux1(ic1+1,ic0)-flux1(ic1,ic0))*0.5/dx(1) - trrgt0(ic0 ,ic1)= trrgt0(ic0 ,ic1) - trnsvers - trlft0(ic0+1,ic1)= trlft0(ic0+1,ic1) - trnsvers - enddo - enddo -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcalculation2d(dt,extra_cell,visco,dx, - & ifirst0,ilast0,ifirst1,ilast1, - & advecspeed, - & uval, - & flux0,flux1, - & trlft0,trlft1,trrgt0,trrgt1) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,extra_cell,visco - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL2d(ifirst,ilast,CELLG)), -c variables in 2d side indexed - & flux0(FACE2d0(ifirst,ilast,FLUXG)), - & flux1(FACE2d1(ifirst,ilast,FLUXG)), - & trlft0(FACE2d0(ifirst,ilast,FACEG)), - & trrgt0(FACE2d0(ifirst,ilast,FACEG)), - & trlft1(FACE2d1(ifirst,ilast,FACEG)), - & trrgt1(FACE2d1(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ie0,ie1 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c -c write(6,*) "In fluxcalculation(",extra_cell,")" -c write(6,*) "ifirst0,ilast0,ifirst1,ilast1,extra_cell", -c & ifirst0,ilast0,ifirst1,ilast1,extra_cell - -riemann_solve(0,1,extra_cell)dnl -c -riemann_solve(1,0,extra_cell)dnl - - if (visco.eq.1) then - write(6,*) "doing artificial viscosity" -c -crtificial_viscosity1(0,1)dnl -c -crtificial_viscosity1(1,0)dnl -c - endif -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - - subroutine consdiff2d(ifirst0,ilast0,ifirst1,ilast1, - & dx, - & flux0,flux1, - & advecspeed,uval) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** - integer ifirst0, ilast0,ifirst1, ilast1 - REAL dx(0:NDIM-1) - REAL - & flux0(FACE2d0(ifirst,ilast,FLUXG)), - & flux1(FACE2d1(ifirst,ilast,FLUXG)), - & advecspeed(0:NDIM-1), - & uval(CELL2d(ifirst,ilast,CELLG)) -c - integer ic0,ic1 - -c*********************************************************************** -c update velocity to full time -c note the reversal of indices in 2nd coordinate direction -c*********************************************************************** -c*********************************************************************** -c write(6,*) "at top of consdiff" -c call flush(6) -c write(6,*) "flux0" -c do ic1=ifirst1,ilast1 -c do ic0=ifirst0,ilast0+1 -c write(6,*) "ic0,flux0= ",ic0,ic1, -c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), -c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) -c call flush(6) -c enddo -c enddo -c write(6,*) "flux1" -c do ic1=ifirst1,ilast1 -c do ic0=ifirst0,ilast0+1 -c write(6,*) "ic0,flux1= ",ic0,ic1, -c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), -c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) -c call flush(6) -c enddo -c enddo -c do ic1=ifirst1,ilast1 -c do ic0=ifirst0,ilast0 -c write(6,*) "ic0,ic1,all = ",ic0,ic1, -c & density(ic0,ic1), -c & velocity(ic0,ic1,1),velocity(ic0,ic1,2), -c & pressure(ic0,ic1) -c call flush(6) -c enddo -c enddo -c*********************************************************************** - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - uval(ic0,ic1) = uval(ic0,ic1) - & -(flux0(ic0+1,ic1)-flux0(ic0,ic1))/dx(0) - & -(flux1(ic1+1,ic0)-flux1(ic1,ic0))/dx(1) - enddo - enddo -c*********************************************************************** -c write(6,*) "in consdiff" -c do ic1=ifirst1,ilast1+1 -c do ic0=ifirst0,ilast0+1 -c write(6,*) "ic0,ic1,flux0= ",ic0,ic1, -c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), -c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) -c call flush(6) -c enddo -c enddo -c do ic1=ifirst1,ilast1+1 -c do ic0=ifirst0,ilast0+1 -c write(6,*) "ic0,ic1,flux1= ",ic0,ic1, -c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), -c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) -c call flush(6) -c enddo -c enddo -c*********************************************************************** -c*********************************************************************** -c do ic1=ifirst1,ilast1 -c do ic0=ifirst0,ilast0 -c write(6,*) "ic0,ic1,all = ",ic0,ic1, -c & density(ic0,ic1), -c & velocity(ic0,ic1,1),velocity(ic0,ic1,2), -c & momentum(ic0,ic1,1),momentum(ic0,ic1,2), -c & pressure(ic0,ic1), -c & energy(ic0,ic1) -c call flush(6) -c enddo -c enddo - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/grad2d.m4 deleted file mode 100644 index 3ae0eb70..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/grad2d.m4 +++ /dev/null @@ -1,212 +0,0 @@ -define(NDIM,2)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - - - subroutine detectgrad2d( - & ifirst0,ilast0,ifirst1,ilast1, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & dx, - & gradtol, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl -include(FORTDIR/const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ifirst1,ilast0,ilast1, - & dotag,donttag, - & vghost0,vghost1, - & tagghost0,tagghost1, - & ttagghost0,ttagghost1 - REAL - & dx(0:NDIM-1), - & gradtol -c variables indexed as 2dimensional - REAL - & var(CELL2dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL2dVECG(ifirst,ilast,tagghost)), - & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) -c - REAL tol - REAL facejump, loctol - REAL presm1,presp1,diag01 - logical tagcell - integer ic0,ic1 -c -c*********************************************************************** -c - tol = gradtol - diag01 = sqrt(dx(0)**2+dx(1)**2) - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1) .ne. 0) then - loctol = 0.125*tol - else - loctol = tol - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1) - presp1 = var(ic0+1,ic1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(0))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1) - presp1 = var(ic0,ic1+1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(1))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1) - presp1 = var(ic0+1,ic1+1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*diag01)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1) - presp1 = var(ic0+1,ic1-1) - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((facejump).gt.(loctol*diag01)) - endif - - if ( tagcell ) then - temptags(ic0,ic1) = dotag - endif - enddo - enddo - return - end - - subroutine detectshock2d( - & ifirst0,ilast0,ifirst1,ilast1, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & dx, - & gradtol,gradonset, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl -include(FORTDIR/const.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ifirst1,ilast0,ilast1, - & dotag,donttag, - & vghost0,vghost1, - & tagghost0,tagghost1, - & ttagghost0,ttagghost1 - REAL - & dx(0:NDIM-1), - & gradtol,gradonset -c variables indexed as 2dimensional - REAL - & var(CELL2dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL2dVECG(ifirst,ilast,tagghost)), - & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) -c - REAL tol,onset - REAL jump1, jump2, facejump, loctol,locon - REAL presm1,presm2,presp1,presp2 - REAL diag01 - logical tagcell - integer ic0,ic1 -c -c*********************************************************************** -c - tol = gradtol - onset = gradonset - diag01 = sqrt(dx(0)**2+dx(1)**2) - - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1) .ne. 0) then - loctol = 0.125*tol - locon = 0.66*onset - else - loctol = tol - locon = onset - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1) - presm2 = var(ic0-2,ic1) - presp1 = var(ic0+1,ic1) - presp2 = var(ic0+2,ic1) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(0)))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1) - presm2 = var(ic0,ic1-2) - presp1 = var(ic0,ic1+1) - presp2 = var(ic0,ic1+2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(1)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1) - presp1 = var(ic0+1,ic1+1) - presm2 = var(ic0-2,ic1-2) - presp2 = var(ic0+2,ic1+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag01))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1) - presp1 = var(ic0+1,ic1-1) - presm2 = var(ic0-2,ic1+2) - presp2 = var(ic0+2,ic1-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1)-presm1) - facejump = max(facejump,abs(var(ic0,ic1)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag01))) - endif - - if ( tagcell ) then - temptags(ic0,ic1) = dotag - endif - enddo - enddo - return - end - - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/init2d.m4 deleted file mode 100644 index 64b3151c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/init2d.m4 +++ /dev/null @@ -1,224 +0,0 @@ -define(NDIM,2)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - - subroutine linadvinit2d(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1, - & gcw0,gcw1, - & uval, - & nintervals,front, - & i_uval) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer gcw0,gcw1 - integer data_problem - integer nintervals - REAL front(1:nintervals) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) - REAL - & i_uval(1:nintervals) - REAL - & uval(CELL2dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,dir,ifr - REAL xc(0:NDIM-1) -c -c dir 0 two linear states (L,R) indp of y,z -c dir 1 two linear states (L,R) indp of x,z - -c write(6,*) "Inside initplane" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1) -c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) -c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,"and ",ifirst1,ilast1 -c call flush(6) - - dir = 0 - if (data_problem.eq.PIECEWISE_CONSTANT_X) then - dir = 0 - else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then - dir = 1 - endif - - if (dir.eq.0) then - ifr = 1 - do ic0=ifirst0,ilast0 - xc(0) = xlo(0) + dx(0)*(dble(ic0-ifirst0)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - uval(ic0,ic1) = i_uval(ifr) - enddo - enddo - else if (dir.eq.1) then - ifr = 1 - do ic1=ifirst1,ilast1 - xc(1) =xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic0=ifirst0,ilast0 - uval(ic0,ic1) = i_uval(ifr) - enddo - enddo - endif -c - return - end - -c*********************************************************************** -c -c Initialization routine where we use a spherical profile -c -c*********************************************************************** - subroutine initsphere2d(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1, - & gcw0,gcw1, - & uval, - & i_uval,o_uval, - & center,radius) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer gcw0,gcw1 - integer data_problem - REAL i_uval,o_uval - REAL radius,center(0:NDIM-1) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) -c variables in 2d cell indexed - REAL - & uval(CELL2dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1 - REAL xc(0:NDIM-1),x0,x1 - REAL angle - -c write(6,*) "in initsphere" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx = ",(dx(i),i=0,NDIM-1) -c write(6,*) "xlo = ",(xlo(i),i=0,NDIM-1) -c write(6,*) "xhi = ",(xhi(i),i=0,NDIM-1) -c write(6,*) "ce = ",(ce(i),i=0,NDIM-1) -c write(6,*) "radius = ",radius -c write(6,*) "ifirst0,ilast0 = ",ifirst0,ilast0 -c write(6,*) "ifirst1,ilast1 = ",ifirst1,ilast1 -c - - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - x1 = xc(1)-center(1) - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - x0 = xc(0)-center(0) - if (x1.eq.zero .and. x0.eq.zero) then - angle = zero - else - angle = atan2(x1,x0) - endif - if ((x0**2+x1**2).lt.radius**2) then - uval(ic0,ic1) = i_uval - else - uval(ic0,ic1) = o_uval - endif - enddo - enddo -c - return - end - -c*********************************************************************** -c -c Sine profile -c -c*********************************************************************** - - subroutine linadvinitsine2d(data_problem,dx,xlo, - & domain_xlo, - & ifirst0,ilast0,ifirst1,ilast1, - & gcw0,gcw1, - & uval, - & nintervals,front, - & i_uval, - & amplitude) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer gcw0,gcw1 - integer data_problem - integer nintervals - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1), - & domain_xlo(0:NDIM-1) - REAL front(1:nintervals) - REAL i_uval(1:nintervals) - REAL amplitude,period(0:NDIM-1) -c variables in 2d cell indexed - REAL - & uval(CELL2dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,j,ifr - REAL xc(0:NDIM-1),xmid(1:10) - REAL coef(0:NDIM-1),coscoef(1:2) -c -c write(6,*) "Inside eulerinitsine" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1) -c write(6,*) "mc= ",mc(0), mc(1) -c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) -c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,ifirst1,ilast1 -c write(6,*) "gamma= ",gamma -c call flush(6) - - if (data_problem.eq.SINE_CONSTANT_Y) then - write(6,*) "Sorry, Y direction not implemented :-(" - return - endif - - coef(0) = zero - do j=1,NDIM-1 - coef(j) = two*pi/period(j) - enddo - - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - coscoef(1) = amplitude* - & cos((xc(1)-domain_xlo(1))*coef(1)) - do j=1,(nintervals-1) - xmid(j) = front(j) + coscoef(1) - enddo - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - ifr = 1 - do j=1,(nintervals-1) - if( xc(0) .gt. xmid(j) ) ifr = j+1 - enddo - uval(ic0,ic1) = i_uval(ifr) - enddo - enddo - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4flux2d.i deleted file mode 100644 index 338013fc..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4flux2d.i +++ /dev/null @@ -1,22 +0,0 @@ -define(riemann_solve,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt -c write(6,*) " calculating flux$1, 1+extra_cell= ",$3 -c write(6,*) " ic$2=",ifirst$2-1-$3,ilast$2+1+$3 -c write(6,*) " ie$1=",ifirst$1-1-$3,ilast$1+1+1+$3 - do ic$2=ifirst$2-$3,ilast$2+$3 - do ie$1=ifirst$1-$3,ilast$1+1+$3 - - if (advecspeed($1).ge.zero) then - riemst= trlft$1(ie$1,ic$2) - else - riemst= trrgt$1(ie$1,ic$2) - endif - - flux$1(ie$1,ic$2)= dt*riemst*advecspeed($1) -c write(6,*) " flux$1(",ie$1,ic$2,")= ",flux$1(ie$1,ic$2,1), -c & flux$1(ie$1,ic$2,2), -c & flux$1(ie$1,ic$2,3),flux$1(ie$1,ic$2,4) - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4trace2d.i deleted file mode 100644 index 64054d15..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/m4trace2d.i +++ /dev/null @@ -1,33 +0,0 @@ -define(trace_init,`dnl - do ic$2=ifirst$2-FACEG,ilast$2+FACEG - ie$1=ifirst$1-FACEG - tracergt$1(ie$1,ic$2)=uval($5) - tracelft$1(ie$1,ic$2)=uval($5) - - do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG - tracelft$1(ie$1,ic$2)=uval($4) - tracergt$1(ie$1,ic$2)=uval($5) - enddo - - ie$1=ilast$1+FACEG+1 - tracelft$1(ie$1,ic$2)=uval($4) - tracergt$1(ie$1,ic$2)=uval($4) - enddo -')dnl -define(trace_call,`dnl - do ic$2=ifirst$2-2,ilast$2+2 - do ic$1=ifirst$1-FACEG,ilast$1+FACEG - ttraclft(ic$1) = tracelft(ic$1,ic$2) - ttracrgt(ic$1) = tracergt(ic$1,ic$2) - enddo - - call trace(dt,ifirst$1,ilast$1,mc, - & dx,idir,advecspeed,igdnv, - & ttraclft,ttracrgt, - & ttcelslp,ttedgslp) - do ic$1=ifirst$1-FACEG,ilast$1+FACEG - tracelft(ic$1,ic$2) = ttraclft(ic$1) - tracergt(ic$1,ic$2) = ttracrgt(ic$1) - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stable2d.m4 deleted file mode 100644 index a788a373..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stable2d.m4 +++ /dev/null @@ -1,44 +0,0 @@ -define(NDIM,2)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - - subroutine stabledt2d(dx, - & ifirst0,ilast0,ifirst1,ilast1, - & ngc0,ngc1, - & advecspeed,uval,stabdt) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL stabdt,dx(0:NDIM-1) - integer ifirst0,ilast0,ifirst1,ilast1,ngc0,ngc1 -c - REAL - & advecspeed(0:NDIM-1), - & uval(CELL2dVECG(ifirst,ilast,ngc)) -c - REAL maxspeed(0:NDIM-1) -c - maxspeed(0)=zero - maxspeed(1)=zero - - maxspeed(0) = max(maxspeed(0), abs(advecspeed(0))) - maxspeed(1) = max(maxspeed(1), abs(advecspeed(1))) - -c Do the following with checks for zero -c stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) - - if ( maxspeed(0) .EQ. 0.0 ) then - if( maxspeed(1) .EQ. 0.0 ) then - stabdt = 1.0E9 - else - stabdt = dx(1)/maxspeed(1) - endif - elseif ( maxspeed(1) .EQ. 0.0 ) then - stabdt = dx(0)/maxspeed(0) - else - stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) - endif - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace1d2d.m4 deleted file mode 100644 index 182d48bf..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace1d2d.m4 +++ /dev/null @@ -1,94 +0,0 @@ -define(NEQU,1)dnl -define(REAL,`double precision')dnl - - subroutine trace(dt,ifirst,ilast,mc, - & dx,dir,advecspeed,igdnv, - & tracelft,tracergt, - & celslope,edgslope) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/probparams.i)dnl -include(FORTDIR/const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL dt - integer ifirst,ilast,mc,dir,igdnv - REAL dx,advecspeed -c - REAL - & celslope(ifirst-CELLG:ifirst+mc-1+CELLG), -c side variables - & tracelft(ifirst-FACEG:ifirst+mc+FACEG), - & tracergt(ifirst-FACEG:ifirst+mc+FACEG), - & edgslope(ifirst-FACEG:ifirst+mc+FACEG) -c - integer ie,ic - REAL bound,coef4,slope2,dtdx,slope4 - REAL du,nu -c -c*********************************************************************** -c ****************************************************************** -c * check for inflection points in characteristic speeds -c * compute slopes at cell edges -c * zero slopes if neighboring cells have different loading -c ****************************************************************** - do ie=ifirst+1-FACEG,ilast+FACEG - edgslope(ie)=tracergt(ie)-tracelft(ie) - enddo -c ****************************************************************** -c * limit slopes -c ****************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - celslope(ic)=zero - enddo - if (igdnv.eq.2) then -c write(6,*) "second-order slopes" -c **************************************************************** -c * second-order slopes -c **************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - slope2=half*(edgslope(ic)+edgslope(ic+1)) - celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) - if (edgslope(ic)*edgslope(ic+1).le.zero) then - celslope(ic)=zero - else - bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) - celslope(ic)=sign(min(two*bound,abs(slope2)),slope2) - endif -c write(6,*) "ic,celslope= ", ic,celslope(ic) -c call flush(6) - enddo - else if (igdnv.eq.4) then -c write(6,*) "fourth-order slopes" -c **************************************************************** -c * fourth-order slopes -c **************************************************************** - do ic=ifirst+2-CELLG,ilast+CELLG-2 - slope4=fourth*(tracergt(ic+2)-tracergt(ic-2)) - celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) - coef4=third*(four*celslope(ic)-slope4) - if (edgslope(ic)*edgslope(ic+1).le.zero .or. - & coef4*celslope(ic).lt.zero) then - celslope(ic)=zero - else - bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) - celslope(ic)=sign(min(two*bound,abs(coef4)),coef4) - endif - enddo - endif -c ****************************************************************** -c * characteristic projection -c ****************************************************************** - dtdx=dt/dx - nu = advecspeed*dtdx - do ic=ifirst-1,ilast+1 - du = celslope(ic) - if (nu.gt.0) then - tracelft(ic+1) = tracelft(ic+1) + half*(one -nu)*du - tracergt(ic) = tracergt(ic) - else - tracelft(ic+1) = tracelft(ic+1) - tracergt(ic) = tracergt(ic) -half*(one + nu)*du - endif - enddo - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace2d.m4 deleted file mode 100644 index af506d71..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/trace2d.m4 +++ /dev/null @@ -1,158 +0,0 @@ -define(NDIM,2)dnl -define(NEQU,4)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -include(FORTDIR/2d/m4trace2d.i)dnl - - subroutine inittraceflux2d( - & ifirst0,ilast0,ifirst1,ilast1, - & uval, - & tracelft0,tracelft1, - & tracergt0,tracergt1, - & fluxriem0,fluxriem1) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - REAL - & uval(CELL2d(ifirst,ilast,CELLG)), - & fluxriem0(FACE2d0(ifirst,ilast,FLUXG)), - & tracelft0(FACE2d0(ifirst,ilast,FACEG)), - & tracergt0(FACE2d0(ifirst,ilast,FACEG)), - & fluxriem1(FACE2d1(ifirst,ilast,FLUXG)), - & tracelft1(FACE2d1(ifirst,ilast,FACEG)), - & tracergt1(FACE2d1(ifirst,ilast,FACEG)) -c*********************************************************************** -c initialize left and right states at cell edges -c (first-order upwind) -c*********************************************************************** -c - integer ic0,ic1,ie0,ie1 -c*********************************************************************** - -trace_init(0,1,2,`ie0-1,ic1',`ie0,ic1')dnl - -trace_init(1,0,2,`ic0,ie1-1',`ic0,ie1')dnl - -c -c we initialize the flux to be zero - - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 - fluxriem0(ie0,ic1) = zero - enddo - enddo -c - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 - fluxriem1(ie1,ic0) = zero - enddo - enddo -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing2d0(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & mc, - & dx, - & advecspeed,igdnv, - & uval, - & tracelft,tracergt, - & ttcelslp,ttedgslp, - & ttraclft,ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx,advecspeed -c variables in 2d axis indexed - REAL - & uval(CELL2d(ifirst,ilast,CELLG)), - & tracelft(FACE2d0(ifirst,ilast,FACEG)), - & tracergt(FACE2d0(ifirst,ilast,FACEG)) -c side variables ifirst0 to ifirst0+mc plus ghost cells - REAL - & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG), - & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG), - & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG) -c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG) -c*********************************************************************** -c - integer ic0,ic1,idir -c*********************************************************************** -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 0 -trace_call(0,1)dnl -c*********************************************************************** - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing2d1(dt, - & ifirst0,ilast0,ifirst1,ilast1, - & mc, - & dx, - & advecspeed,igdnv, - & uval, - & tracelft,tracergt, - & ttcelslp,ttedgslp, - & ttraclft,ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx,advecspeed -c variables in 2d axis indexed - REAL - & uval(CELL2d(ifirst,ilast,CELLG)), - & tracelft(FACE2d1(ifirst,ilast,FACEG)), - & tracergt(FACE2d1(ifirst,ilast,FACEG)) -c side variables ifirst1 to ifirst1+mc plus ghost cells - REAL - & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG), - & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG), - & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG) -c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG) -c*********************************************************************** -c - integer ic0,ic1,idir -c*********************************************************************** -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 1 -trace_call(1,0)dnl -c*********************************************************************** - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/bdry3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/bdry3d.m4 deleted file mode 100644 index e7b058c5..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/bdry3d.m4 +++ /dev/null @@ -1,285 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -define(PARAMDIR,SAMRAI_FORTDIR/../examples/LinAdv/fortran)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/m4bdry.i)dnl -c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -c bcceglobal is called before riemnv to set boundary values for left and -c right states in riemann problem. -c -c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -c****************************************************************** - subroutine getbdry3d(bdry_type, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & bside, - & dx,time, - & uval, - & bdry_states,bdry_data,bdry_case) -c*********************************************************************** - implicit none -include(PARAMDIR/probparams.i)dnl - - integer ngc0,ngc1,ngc2,bside,bdry_type - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer bdry_case - REAL bdry_states(2*NDIM) - REAL bdry_data(2*NDIM) - REAL time -c - REAL dx(0:NDIM-1) -c - REAL - & uval(CELL3dVECG(ifirst,ilast,ngc)) - - REAL slope,uval0 - integer ic1,ic0,ic2,ict1,ict0,ict2 - integer sn - integer ibdebug(0:NDIM-1),iedebug(0:NDIM-1) - -c write(6,*) "IN getbdry" -c write(6,*) "bdry_type ",bdry_type,", bside ",bside -c write(6,*) "ibeg ",ibeg0,ibeg1,ibeg2 -c write(6,*) "iend ",iend0,iend1,iend2 -c write(6,*) "ifirst ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast ",ilast0,ilast1,ilast2 -c write(6,*) "bdry_case ",bdry_case - - ibdebug(0) = ibeg0 - ibdebug(1) = ibeg1 - ibdebug(2) = ibeg2 - iedebug(0) = iend0 - iedebug(1) = iend1 - iedebug(2) = iend2 - - if (bdry_type.eq.1) then -c -c bside index bside index bside index -c 0 (-1, 0, 0) 2 ( 0,-1, 0) 4 ( 0, 0,-1) -c 1 ( 1, 0, 0) 3 ( 0, 1, 0) 5 ( 0, 0, 1) -c*********************************************************************** - sn = 1+bside - if (bside.eq.0) then -c*********************************************************************** -c x0 boundary -c*********************************************************************** -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -do_bdry_face(0,1,2,`ifirst0-ngc0,ifirst0-1',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.1) then -c -c*********************************************************************** -c x1 boundary -c*********************************************************************** -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -do_bdry_face(0,1,2,`ilast0+1,ilast0+ngc0',`ilast0',`ilast0-1')dnl - else if (bside.eq.2) then -c -c*********************************************************************** -c y0 boundary -c*********************************************************************** -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -do_bdry_face(1,0,2,`ifirst1-ngc1,ifirst1-1',`ifirst1',`ifirst1+1')dnl - else if (bside.eq.3) then -c -c*********************************************************************** -c y1 boundary -c*********************************************************************** -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -do_bdry_face(1,0,2,`ilast1+1,ilast1+ngc1',`ilast1',`ilast1-1')dnl - else if (bside.eq.4) then -c -c*********************************************************************** -c z0 boundary -c*********************************************************************** -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_face(2,0,1,`ifirst2-ngc2,ifirst2-1',`ifirst2',`ifirst2+1')dnl - else if (bside.eq.5) then -c -c*********************************************************************** -c z1 boundary -c*********************************************************************** -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_face(2,0,1,`ilast2+1,ilast2+ngc2',`ilast2',`ilast2-1')dnl - endif -c*********************************************************************** - - else if (bdry_type.eq.2) then -c*********************************************************************** -c write(6,*) "doing edges" -c*********************************************************************** -c -c bside index bside index bside index -c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) -c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) -c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) -c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) -c*********************************************************************** - sn = 1+bside - if (bside.eq.0) then -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ifirst2-ngc1 -c iedebug(2) =ifirst2-1 -do_bdry_edge(0,1,2,`ifirst1-ngc1,ifirst1-1',`ifirst2-ngc2,ifirst2-1',`ifirst1',`ifirst1+1')dnl - else if (bside.eq.1) then -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_edge(0,1,2,`ilast1+1,ilast1+ngc1',`ifirst2-ngc2,ifirst2-1',`ilast1',`ilast1-1')dnl - else if (bside.eq.2) then -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_edge(0,1,2,`ifirst1-ngc1,ifirst1-1',`ilast2+1,ilast2+ngc2',`ifirst1',`ifirst1+1')dnl - else if (bside.eq.3) then -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_edge(0,1,2,`ilast1+1,ilast1+ngc1',`ilast2+1,ilast2+ngc2',`ilast1',`ilast1-1')dnl - - else if (bside.eq.4) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_edge(1,2,0,`ifirst2-ngc2,ifirst2-1',`ifirst0-ngc0,ifirst0-1',`ifirst2',`ifirst2+1')dnl - else if (bside.eq.5) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_edge(1,2,0,`ilast2+1,ilast2+ngc2',`ifirst0-ngc0,ifirst0-1',`ilast2',`ilast2-1')dnl - else if (bside.eq.6) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_edge(1,2,0,`ifirst2-ngc2,ifirst2-1',`ilast0+1,ilast0+ngc0',`ifirst2',`ifirst2+1')dnl - else if (bside.eq.7) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_edge(1,2,0,`ilast2+1,ilast2+ngc2',`ilast0+1,ilast0+ngc0',`ilast2',`ilast2-1')dnl - - else if (bside.eq.8) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -do_bdry_edge(2,0,1,`ifirst0-ngc0,ifirst0-1',`ifirst1-ngc1,ifirst1-1',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.9) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -do_bdry_edge(2,0,1,`ilast0+1,ilast0+ngc0',`ifirst1-ngc1,ifirst1-1',`ilast0',`ilast0-1')dnl - else if (bside.eq.10) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -do_bdry_edge(2,0,1,`ifirst0-ngc0,ifirst0-1',`ilast1+1,ilast1+ngc1',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.11) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -do_bdry_edge(2,0,1,`ilast0+1,ilast0+ngc0',`ilast1+1,ilast1+ngc1',`ilast0',`ilast0-1')dnl - endif -c -c*********************************************************************** - - else if (bdry_type.eq.NDIM) then -c*********************************************************************** -c write(6,*) "IN getbdrynode" -c*********************************************************************** -c bside index bside index -c 0 (-1,-1,-1) 4 (-1,-1, 1) -c 1 ( 1,-1,-1) 5 ( 1,-1, 1) -c 2 (-1, 1,-1) 6 (-1, 1, 1) -c 3 ( 1, 1,-1) 7 ( 1, 1, 1) -c*********************************************************************** - sn = 1+bside - - if (bside.eq.0) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_node(`ifirst0-ngc0,ifirst0-1',`ifirst1-ngc1,ifirst1-1',`ifirst2-ngc2,ifirst2-1',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.1) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_node(`ilast0+1,ilast0+ngc0',`ifirst1-ngc1,ifirst1-1',`ifirst2-ngc2,ifirst2-1',`ilast0',`ilast0-1')dnl - else if (bside.eq.2) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_node(`ifirst0-ngc0,ifirst0-1',`ilast1+1,ilast1+ngc1',`ifirst2-ngc2,ifirst2-1',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.3) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ifirst2-ngc2 -c iedebug(2) =ifirst2-1 -do_bdry_node(`ilast0+1,ilast0+ngc0',`ilast1+1,ilast1+ngc1',`ifirst2-ngc2,ifirst2-1',`ilast0',`ilast0-1')dnl - else if (bside.eq.4) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_node(`ifirst0-ngc0,ifirst0-1',`ifirst1-ngc1,ifirst1-1',`ilast2+1,ilast2+ngc2',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.5) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ifirst1-ngc1 -c iedebug(1) =ifirst1-1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_node(`ilast0+1,ilast0+ngc0',`ifirst1-ngc1,ifirst1-1',`ilast2+1,ilast2+ngc2',`ilast0',`ilast0-1')dnl - else if (bside.eq.6) then -c ibdebug(0) =ifirst0-ngc0 -c iedebug(0) =ifirst0-1 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_node(`ifirst0-ngc0,ifirst0-1',`ilast1+1,ilast1+ngc1',`ilast2+1,ilast2+ngc2',`ifirst0',`ifirst0+1')dnl - else if (bside.eq.7) then -c ibdebug(0) =ilast0+1 -c iedebug(0) =ilast0+ngc0 -c ibdebug(1) =ilast1+1 -c iedebug(1) =ilast1+ngc1 -c ibdebug(2) =ilast2+1 -c iedebug(2) =ilast2+ngc2 -do_bdry_node(`ilast0+1,ilast0+ngc0',`ilast1+1,ilast1+ngc1',`ilast2+1,ilast2+ngc2',`ilast0',`ilast0-1')dnl - endif - endif -c -c*********************************************************************** - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/flux3d.m4 deleted file mode 100644 index f5d41851..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/flux3d.m4 +++ /dev/null @@ -1,261 +0,0 @@ -define(NDIM,3)dnl -define(NEQU,1)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/3d/m4flux3d.i)dnl - - subroutine fluxcorrec3d2d(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx,advecspeed,idir, - & uval, - & flux0,flux1,flux2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2, - & ttracelft0,ttracelft1,ttracelft2, - & ttracergt0,ttracergt1,ttracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - integer idir -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), -c - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), -c - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)), -c - & ttracelft0(FACE3d0(ifirst,ilast,FACEG)), - & ttracelft1(FACE3d1(ifirst,ilast,FACEG)), - & ttracelft2(FACE3d2(ifirst,ilast,FACEG)), - & ttracergt0(FACE3d0(ifirst,ilast,FACEG)), - & ttracergt1(FACE3d1(ifirst,ilast,FACEG)), - & ttracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -c -c "Forward" computation of transverse flux terms -c - if (idir.eq.1) then -c -correc_flux2d(0,`ic1,ic2',1,`ic2,ic0',2)dnl -c -correc_flux2d(1,`ic2,ic0',0,`ic1,ic2',2)dnl -c -correc_flux2d(2,`ic0,ic1',0,`ic1,ic2',1)dnl -c -c "Backward" computation of transverse flux terms -c - elseif (idir.eq.-1) then -c -correc_flux2d(0,`ic1,ic2',2,`ic0,ic1',1)dnl -c -correc_flux2d(1,`ic2,ic0',2,`ic0,ic1',0)dnl -c -correc_flux2d(2,`ic0,ic1',1,`ic2,ic0',0)dnl -c - endif -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrec3d3d(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx, - & advecspeed,uval, - & fluxa0,fluxa1,fluxa2, - & fluxb0,fluxb1,fluxb2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & fluxa0(FACE3d0(ifirst,ilast,FLUXG)), - & fluxa1(FACE3d1(ifirst,ilast,FLUXG)), - & fluxa2(FACE3d2(ifirst,ilast,FLUXG)), - & fluxb0(FACE3d0(ifirst,ilast,FLUXG)), - & fluxb1(FACE3d1(ifirst,ilast,FLUXG)), - & fluxb2(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -correc_flux3d(2,0,1,a0,a1,`ic1,ic2',`ic2,ic0')dnl -c -correc_flux3d(1,2,0,a2,b0,`ic0,ic1',`ic1,ic2')dnl -c -correc_flux3d(0,1,2,b1,b2,`ic2,ic0',`ic0,ic1')dnl -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcalculation3d(dt,xcell0,xcell1,visco,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed, - & uval, - & flux0,flux1,flux2, - & trlft0,trlft1,trlft2, - & trrgt0,trrgt1,trrgt2) - -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer xcell0,xcell1,visco - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & trlft0(FACE3d0(ifirst,ilast,FACEG)), - & trrgt0(FACE3d0(ifirst,ilast,FACEG)), - & trlft1(FACE3d1(ifirst,ilast,FACEG)), - & trrgt1(FACE3d1(ifirst,ilast,FACEG)), - & trlft2(FACE3d2(ifirst,ilast,FACEG)), - & trrgt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,ie0,ie1,ie2 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - -riemann_solve(0,1,2,`ic1,ic2',xcell0,xcell1)dnl - -c -riemann_solve(1,0,2,`ic2,ic0',xcell0,xcell1)dnl - -c -riemann_solve(2,0,1,`ic0,ic1',xcell0,xcell1)dnl - - if (visco.eq.1) then - write(6,*) "doing artificial viscosity" -c -crtificial_viscosity1(0,1,2)dnl -c -crtificial_viscosity1(1,2,0)dnl -c -crtificial_viscosity1(2,0,1)dnl -c - endif -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - - subroutine consdiff3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dx, - & flux0,flux1,flux2, - & advecspeed,uval) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** - integer ifirst0, ilast0,ifirst1, ilast1,ifirst2,ilast2 - REAL dx(0:NDIM-1) - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c - integer ic0,ic1,ic2 - -c*********************************************************************** -c update velocity to full time -c note the reversal of indices in 2nd coordinate direction -c*********************************************************************** -c*********************************************************************** - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - uval(ic0,ic1,ic2) = uval(ic0,ic1,ic2) - & -(flux0(ic0+1,ic1,ic2)-flux0(ic0,ic1,ic2))/dx(0) - & -(flux1(ic1+1,ic2,ic0)-flux1(ic1,ic2,ic0))/dx(1) - & -(flux2(ic2+1,ic0,ic1)-flux2(ic2,ic0,ic1))/dx(2) - enddo - enddo - enddo - return - end -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.i deleted file mode 100644 index c18ea0d7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.i +++ /dev/null @@ -1,168 +0,0 @@ -include(FORTDIR/m4fluxjt.i)dnl - - subroutine onethirdstates3d(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux0,flux1,flux2, - & st3_0,st3_1,st3_2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -st_third(0,1,2,`ic1,ic2')dnl -c -st_third(1,2,0,`ic2,ic0')dnl -c -st_third(2,0,1,`ic0,ic1')dnl -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxthird3d(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed, - & uval, - & st3_0,st3_1,st3_2, - & flux01,flux12,flux20, - & flux02,flux10,flux21) - -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - -f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrecjt3d(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux01,flux12,flux20, - & flux02,flux10,flux21, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:3-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers -c REAL ttvlft,ttvrgt - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -correc_fluxjt(2,0,1,`ic1,ic2',`ic2,ic0')dnl -c -correc_fluxjt(1,2,0,`ic0,ic1',`ic1,ic2')dnl -c -correc_fluxjt(0,1,2,`ic2,ic0',`ic0,ic1')dnl -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.m4 deleted file mode 100644 index 4e8f9952..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/fluxcorner3d.m4 +++ /dev/null @@ -1,187 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/3d/m4fluxcorner3d.i)dnl - - subroutine onethirdstate3d(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux0,flux1,flux2, - & st3) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & st3(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c - if (idir.eq.0) then -c -st_third(0,1,2,`ic1,ic2')dnl -c - elseif (idir.eq.1) then -c -st_third(1,2,0,`ic2,ic0')dnl -c - elseif (idir.eq.2) then -c -st_third(2,0,1,`ic0,ic1')dnl -c - endif - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxthird3d(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed, - & uval, - & st3, - & flux0,flux1,flux2) - -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & st3(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - if (idir.eq.0) then -c -f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c - elseif (idir.eq.1) then -c -f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c - elseif (idir.eq.2) then -c -f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c - endif -c -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrecjt3d(dt,dx,idir, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux0,flux1,flux2, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:3-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers -c REAL ttvlft,ttvrgt - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c - if (idir.eq.0) then -c -correc_fluxjt(0,2,1,`ic2,ic0',`ic0,ic1')dnl -c - elseif (idir.eq.1) then -c -correc_fluxjt(1,0,2,`ic0,ic1',`ic1,ic2')dnl -c - elseif (idir.eq.2) then -c -correc_fluxjt(2,1,0,`ic1,ic2',`ic2,ic0')dnl -c - endif -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/grad3d.m4 deleted file mode 100644 index 52917b23..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/grad3d.m4 +++ /dev/null @@ -1,423 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - - subroutine detectgrad3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & vghost2,tagghost2,ttagghost2, - & dx, - & gradtol, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dotag,donttag, - & vghost0,vghost1,vghost2, - & tagghost0,tagghost1,tagghost2, - & ttagghost0,ttagghost1,ttagghost2 - REAL - & dx(0:NDIM-1), - & gradtol -c variables indexed as 3dimensional - REAL - & var(CELL3dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL3dVECG(ifirst,ilast,tagghost)), - & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) -c - REAL tol - REAL facejump, loctol - REAL presm1,presp1 - REAL diag(0:NDIM-1),diag012 - logical tagcell - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - tol = gradtol - diag(0) = sqrt(dx(2)**2+dx(1)**2) - diag(1) = sqrt(dx(0)**2+dx(2)**2) - diag(2) = sqrt(dx(0)**2+dx(1)**2) - diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1,ic2) .ne. 0) then - loctol = 0.125*tol - else - loctol = tol - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1,ic2) - presp1 = var(ic0+1,ic1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(0))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2) - presp1 = var(ic0,ic1+1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(1))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1,ic2-1) - presp1 = var(ic0,ic1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*dx(2))) - endif - - -c 2Dimensional diagonals - - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2-1) - presp1 = var(ic0,ic1+1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(0))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1+1,ic2-1) - presp1 = var(ic0,ic1-1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(0))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2-1) - presp1 = var(ic0+1,ic1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(1))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2+1) - presp1 = var(ic0+1,ic1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(1))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2) - presp1 = var(ic0+1,ic1+1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(2))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2) - presp1 = var(ic0+1,ic1-1,ic2) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag(2))) - endif - -c End 2Dimensional diagonals -c 3Dimensional diagonals - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2-1) - presp1 = var(ic0+1,ic1+1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2+1) - presp1 = var(ic0+1,ic1+1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2-1) - presp1 = var(ic0+1,ic1-1,ic2+1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2+1) - presp1 = var(ic0+1,ic1-1,ic2-1) - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((facejump).gt.(loctol*diag012)) - endif - -c End 3Dimensional diagonals - - if ( tagcell ) then - temptags(ic0,ic1,ic2) = dotag - endif - enddo - enddo - enddo - return - end - - subroutine detectshock3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & vghost0,tagghost0,ttagghost0, - & vghost1,tagghost1,ttagghost1, - & vghost2,tagghost2,ttagghost2, - & dx, - & gradtol,gradonset, - & dotag,donttag, - & var, - & tags,temptags) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c input arrays: - integer - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & dotag,donttag, - & vghost0,vghost1,vghost2, - & tagghost0,tagghost1,tagghost2, - & ttagghost0,ttagghost1,ttagghost2 - REAL - & dx(0:NDIM-1), - & gradtol,gradonset -c variables indexed as 3dimensional - REAL - & var(CELL3dVECG(ifirst,ilast,vghost)) - integer - & tags(CELL3dVECG(ifirst,ilast,tagghost)), - & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) -c - REAL tol,onset - REAL jump1, jump2, facejump, loctol,locon - REAL presm1,presm2,presp1,presp2 - REAL diag(0:NDIM-1),diag012 - logical tagcell - integer ic0,ic1,ic2 -c -c*********************************************************************** -c - tol = gradtol - onset = gradonset - diag(0) = sqrt(dx(2)**2+dx(1)**2) - diag(1) = sqrt(dx(0)**2+dx(2)**2) - diag(2) = sqrt(dx(0)**2+dx(1)**2) - diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) - - do ic2=ifirst2,ilast2 - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - - if (tags(ic0,ic1,ic2) .ne. 0) then - loctol = 0.125*tol - locon = 0.66*onset - else - loctol = tol - locon = onset - endif - - tagcell = .false. - - presm1 = var(ic0-1,ic1,ic2) - presm2 = var(ic0-2,ic1,ic2) - presp1 = var(ic0+1,ic1,ic2) - presp2 = var(ic0+2,ic1,ic2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(0)))) - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2) - presm2 = var(ic0,ic1-2,ic2) - presp1 = var(ic0,ic1+1,ic2) - presp2 = var(ic0,ic1+2,ic2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(1)))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1,ic2-1) - presm2 = var(ic0,ic1,ic2-2) - presp1 = var(ic0,ic1,ic2+1) - presp2 = var(ic0,ic1,ic2+2) - jump2 = presp2-presm2 - jump1 = presp1-presm1 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*dx(2)))) - endif - - -c 2Dimensional diagonals - - if (.not.tagcell) then - presm1 = var(ic0,ic1-1,ic2-1) - presp1 = var(ic0,ic1+1,ic2+1) - presm2 = var(ic0,ic1-2,ic2-2) - presp2 = var(ic0,ic1+2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(0)))) - endif - if (.not.tagcell) then - presm1 = var(ic0,ic1+1,ic2-1) - presp1 = var(ic0,ic1-1,ic2+1) - presm2 = var(ic0,ic1+2,ic2-2) - presp2 = var(ic0,ic1-2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(0)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2-1) - presp1 = var(ic0+1,ic1,ic2+1) - presm2 = var(ic0-2,ic1,ic2-2) - presp2 = var(ic0+2,ic1,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(1)))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1,ic2+1) - presp1 = var(ic0+1,ic1,ic2-1) - presm2 = var(ic0-2,ic1,ic2+2) - presp2 = var(ic0+2,ic1,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(1)))) - endif - - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2) - presp1 = var(ic0+1,ic1+1,ic2) - presm2 = var(ic0-2,ic1-2,ic2) - presp2 = var(ic0+2,ic1+2,ic2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(2)))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2) - presp1 = var(ic0+1,ic1-1,ic2) - presm2 = var(ic0-2,ic1+2,ic2) - presp2 = var(ic0+2,ic1-2,ic2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag(2)))) - endif - -c End 2Dimensional diagonals -c 3Dimensional diagonals - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2-1) - presp1 = var(ic0+1,ic1+1,ic2+1) - presm2 = var(ic0-2,ic1-2,ic2-2) - presp2 = var(ic0+2,ic1+2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1-1,ic2+1) - presp1 = var(ic0+1,ic1+1,ic2-1) - presm2 = var(ic0-2,ic1-2,ic2+2) - presp2 = var(ic0+2,ic1+2,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2-1) - presp1 = var(ic0+1,ic1-1,ic2+1) - presm2 = var(ic0-2,ic1+2,ic2-2) - presp2 = var(ic0+2,ic1-2,ic2+2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - if (.not.tagcell) then - presm1 = var(ic0-1,ic1+1,ic2+1) - presp1 = var(ic0+1,ic1-1,ic2-1) - presm2 = var(ic0-2,ic1+2,ic2+2) - presp2 = var(ic0+2,ic1-2,ic2-2) - jump1 = presp1-presm1 - jump2 = presp2-presm2 - facejump = abs(var(ic0,ic1,ic2)-presm1) - facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) - tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. - & ((jump1*jump2).lt.zero)).and. - & ((facejump).gt.(loctol*diag012))) - endif - -c End 3Dimensional diagonals - - if ( tagcell ) then - temptags(ic0,ic1,ic2) = dotag - endif - enddo - enddo - enddo - return - end - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/init3d.m4 deleted file mode 100644 index 4c957128..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/init3d.m4 +++ /dev/null @@ -1,269 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - - subroutine linadvinit3d(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gcw0,gcw1,gcw2, - & uval, - & nintervals,front, - & i_uval) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer gcw0,gcw1,gcw2 - integer data_problem - integer nintervals - REAL front(1:nintervals) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) - REAL - & i_uval(1:nintervals) -c variables in 2d cell indexed - REAL - & uval(CELL3dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,dir,ifr - REAL xc(0:NDIM-1) -c -c dir 0 two linear states (L,R) indp of y,z -c dir 1 two linear states (L,R) indp of x,z -c dir 2 two linear states (L,R) indp of x,y - -c write(6,*) "Inside eulerinit" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1), dx(2) -c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) -c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) -c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast= ",ilast0,ilast1,ilast2 -c write(6,*) "gamma= ",gamma -c call flush(6) - - dir = 0 - if (data_problem.eq.PIECEWISE_CONSTANT_X) then - dir = 0 - else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then - dir = 1 - else if (data_problem.eq.PIECEWISE_CONSTANT_Z) then - dir = 2 - endif - - if (dir.eq.0) then - ifr = 1 - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+ dx(0)*(dble(ic0-ifirst0)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - do ic2=ifirst2,ilast2 - uval(ic0,ic1,ic2) = i_uval(ifr) - enddo - enddo - enddo - else if (dir.eq.1) then - ifr = 1 - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic2=ifirst2,ilast2 - do ic0=ifirst0,ilast0 - uval(ic0,ic1,ic2) = i_uval(ifr) - enddo - enddo - enddo - else if (dir.eq.2) then - ifr = 1 - do ic2=ifirst2,ilast2 - xc(2) = xlo(2)+ dx(2)*(dble(ic2-ifirst2)+half) - if (xc(dir).gt.front(ifr)) then - ifr = ifr+1 - endif - do ic1=ifirst1,ilast1 - do ic0=ifirst0,ilast0 - uval(ic0,ic1,ic2) = i_uval(ifr) - enddo - enddo - enddo - endif -c - return - end - -c*********************************************************************** -c -c Initialization routine where we use a spherical profile -c -c*********************************************************************** - subroutine initsphere3d(data_problem,dx,xlo,xhi, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gcw0,gcw1,gcw2, - & uval, - & l_uval,r_uval, - & ce,rad) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer gcw0,gcw1,gcw2 - integer data_problem - REAL rad,ce(0:NDIM-1) -c variables in 1d axis indexed -c - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) -c variables in 2d cell indexed - REAL - & uval(CELL3dVECG(ifirst,ilast,gcw)) - REAL - & l_uval(0:4), - & r_uval(0:4) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,side - REAL xc(0:NDIM-1),x0,x1,x2 - REAL theta,phi,rad2,rad3 -c - -c write(6,*) " dx = ",dx(0),dx(1),dx(2) -c write(6,*) " xlo= ",xlo(0),xlo(1),xlo(2) -c write(6,*) " ce = ",ce(0),ce(1),ce(2)," rad ",rad - do ic2=ifirst2,ilast2 - xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) - x2 = xc(2) - ce(2) - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - x1 = xc(1) - ce(1) - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - x0 = xc(0)-ce(0) - if (x1.eq.zero .and. x0.eq.zero) then - theta = zero - else - theta = atan2(x1,x0) - endif - rad2 = sqrt(x0**2+x1**2) - if (rad2.eq.zero .and. x2.eq.zero) then - phi = zero - else - phi = atan2(rad2,x2) - endif - rad3 = sqrt(rad2**2 + x2**2) - if (rad3.lt.rad) then - side = 0 - else - side = 1 - endif - uval(ic0,ic1,ic2) = l_uval(side) - enddo - enddo - enddo - return - end - -c -c*********************************************************************** -c -c Sine-wave interface -c -c*********************************************************************** - - subroutine linadvinitsine3d(data_problem,dx,xlo, - & domain_xlo, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & gcw0,gcw1,gcw2, - & uval, - & nintervals,front, - & i_uval, - & amplitude,period) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** - -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer gcw0,gcw1,gcw2 - integer data_problem - integer nintervals - REAL front(1:nintervals) - REAL - & dx(0:NDIM-1),xlo(0:NDIM-1), - & domain_xlo(0:NDIM-1) - REAL i_uval(1:nintervals) - REAL amplitude,period(0:NDIM-1) -c variables in 3d cell indexed - REAL - & uval(CELL3dVECG(ifirst,ilast,gcw)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2,j,ifr - REAL xc(0:NDIM-1),xmid(1:10) - REAL coef(0:NDIM-1),coscoef(1:2) -c -c write(6,*) "Inside eulerinitrm" -c write(6,*) "data_problem= ",data_problem -c write(6,*) "dx= ",dx(0), dx(1), dx(2) -c write(6,*) "xlo= ",xlo(0), xlo(1), xlo(2) -c write(6,*) "domain_xlo= ", -c & domain_xlo(0), domain_xlo(1), domain_xlo(2) -c write(6,*) "ifirst = ",ifirst0,ifirst1,ifirst2 -c write(6,*) "ilast = ",ilast0,ilast1,ilast2 -c write(6,*) "front= ",front(1) -c write(6,*) "amplitude= ",amplitude -c write(6,*) "period= ",period(0), -c & period(1),period(2) -c call flush(6) - - if (data_problem.eq.SINE_CONSTANT_Y .or. - & data_problem.eq.SINE_CONSTANT_Z) then - write(6,*) "Sorry, Y and Z directions not implemented :-(" - return - endif - - coef(0) = zero - do j=1,NDIM-1 - coef(j) = two*pi/period(j) - enddo -c - do ic2=ifirst2,ilast2 - xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) - coscoef(2) = amplitude*cos((xc(2)-domain_xlo(2))*coef(2)) - do ic1=ifirst1,ilast1 - xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) - coscoef(1) = - & cos((xc(1)-domain_xlo(1))*coef(1))*coscoef(2) - do j=1,(nintervals-1) - xmid(j) = front(j) + coscoef(1) - enddo - do ic0=ifirst0,ilast0 - xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) - ifr = 1 - do j=1,(nintervals-1) - if( xc(0) .gt. xmid(j) ) ifr = j+1 - enddo - uval(ic0,ic1,ic2) = i_uval(ifr) - enddo - enddo - enddo -c - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4bdry3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4bdry3d.i deleted file mode 100644 index 7ba8c7ca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4bdry3d.i +++ /dev/null @@ -1,167 +0,0 @@ -define(cell_even,`dnl - uval(ic0,ic1,ic2)=uval($1) -')dnl -define(lin_boundary,`dnl - ict$1 = $2 - uval0 = uval(ict0,ict1,ict2) - ict$1 = $3 - slope=(uval0-uval(ict0,ict1,ict2))/($2-$3) - uval(ic0,ic1,ic2)=uval0 + (ic$1-$2)*slope -')dnl -define(fixed_state,`dnl - uval(ic0,ic1,ic2)=bdry_states(1+(sn-1)) -')dnl -define(symmetry,`dnl - ict$1 = 3*$2-$3-ic$1 - uval(ic0,ic1,ic2)=uval(ict0,ict1,ict2) -')dnl -define(do_bdry_face,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -lin_boundary(`$1',`$5',`$6')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -symmetry(`$1',`$5',`$6')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_node,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -lin_boundary(`0',`$4',`$5')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -symmetry(`0',`$4',`$5')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_edge,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -lin_boundary($2,`$6',`$7')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -symmetry($2,`$6',`$7')dnl - enddo - enddo - enddo - endif -')dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4flux3d.i deleted file mode 100644 index af2ecf4c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4flux3d.i +++ /dev/null @@ -1,51 +0,0 @@ -define(riemann_solve,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-$6,ilast$3+$6 - do ic$2=ifirst$2-$5,ilast$2+$5 - do ie$1=ifirst$1,ilast$1+1 - - if (advecspeed($1).ge.zero) then - riemst= trlft$1(ie$1,$4) - else - riemst= trrgt$1(ie$1,$4) - endif - flux$1(ie$1,$4)= dt*riemst*advecspeed($1) - - enddo - enddo - enddo -')dnl -define(correc_flux2d,`dnl -c correct the $1-direction with $3-fluxes - do ic$5=ifirst$5-1,ilast$5+1 - do ic$3=ifirst$3,ilast$3 - do ic$1=ifirst$1-1,ilast$1+1 - trnsvers= - & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))*half/dx($3) -c - ttracelft$1(ic$1+1,$2)=tracelft$1(ic$1+1,$2) - & - trnsvers - ttracergt$1(ic$1 ,$2)=tracergt$1(ic$1 ,$2) - & - trnsvers - enddo - enddo - enddo -')dnl -define(correc_flux3d,`dnl -c correct the $1-direction with $2$3-fluxes - do ic$1=ifirst$1-1,ilast$1+1 - do ic$3=ifirst$3,ilast$3 - do ic$2=ifirst$2,ilast$2 - trnsvers=half*( - & (flux$4(ic$2+1,$6)-flux$4(ic$2,$6))/dx($2)+ - & (flux$5(ic$3+1,$7)-flux$5(ic$3,$7))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxcorner3d.i deleted file mode 100644 index c24a00b7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxcorner3d.i +++ /dev/null @@ -1,84 +0,0 @@ -define(st_third,`dnl - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2-1,ilast$2+1 - do ic$1=ifirst$1,ilast$1 - trnsvers= - & (flux$1(ic$1+1,$4)-flux$1(ic$1,$4))/(3*dx($1)) -c - st3(ic0,ic1,ic2)=uval(ic0,ic1,ic2) -trnsvers - enddo - enddo - enddo -')dnl -define(f_third,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2,ilast$2 - do ic$1=ifirst$1,ilast$1+1 - - if (advecspeed($1).ge.zero) then - riemst = st3($5) - else - riemst = st3(ic0,ic1,ic2) - endif - flux$1(ic$1,$4)= dt*riemst*advecspeed($1) - enddo - enddo - enddo -')dnl -define(correc_fluxjt,`dnl -c correct the $2-direction with $3-fluxes - do ic$3=ifirst$3,ilast$3 - do ic$1=ifirst$1,ilast$1 - ic$2=ifirst$2-1 - trnsvers=half* - & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) - - tracelft$2(ic$2+1,ic$1,ic$3)=tracelft$2(ic$2+1,ic$1,ic$3) - & - trnsvers - do ic$2=ifirst$2,ilast$2 - trnsvers=half* - & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) - - tracelft$2(ic$2+1,ic$1,ic$3)=tracelft$2(ic$2+1,ic$1,ic$3) - & - trnsvers - tracergt$2(ic$2 ,ic$1,ic$3)=tracergt$2(ic$2 ,ic$1,ic$3) - & - trnsvers - enddo - ic$2=ilast$2+1 - trnsvers=half* - & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) - - tracergt$2(ic$2 ,ic$1,ic$3)=tracergt$2(ic$2 ,ic$1,ic$3) - & - trnsvers - enddo - enddo -c -c correct the $3-direction with $2-fluxes - do ic$1=ifirst$1,ilast$1 - do ic$2=ifirst$2,ilast$2 - ic$3=ifirst$3-1 - trnsvers=half* - & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) - - tracelft$3(ic$3+1,ic$2,ic$1)=tracelft$3(ic$3+1,ic$2,ic$1) - & - trnsvers - do ic$3=ifirst$3,ilast$3 - trnsvers=half* - & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) - - tracelft$3(ic$3+1,ic$2,ic$1)=tracelft$3(ic$3+1,ic$2,ic$1) - & - trnsvers - tracergt$3(ic$3 ,ic$2,ic$1)=tracergt$3(ic$3 ,ic$2,ic$1) - & - trnsvers - enddo - ic$3=ilast$3+1 - trnsvers=half* - & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) - - tracergt$3(ic$3 ,ic$2,ic$1)=tracergt$3(ic$3 ,ic$2,ic$1) - & - trnsvers - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxjt3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxjt3d.i deleted file mode 100644 index c9c03036..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4fluxjt3d.i +++ /dev/null @@ -1,60 +0,0 @@ -define(st_third,`dnl - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2-1,ilast$2+1 - do ic$1=ifirst$1,ilast$1 - trnsvers= - & (flux$1(ic$1+1,$4)-flux$1(ic$1,$4))/(3*dx($1)) -c - st3_$1(ic0,ic1,ic2)=uval(ic0,ic1,ic2) -trnsvers - enddo - enddo - enddo -')dnl -define(f_third,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2,ilast$2 - do ic$1=ifirst$1,ilast$1+1 - - if (advecspeed($1).ge.zero) then - riemst = st3_$2($5) - else - riemst = st3_$2(ic0,ic1,ic2) - endif - flux$1$2(ic$1,$4)= dt*riemst*advecspeed($1) - enddo - enddo - enddo -')dnl -define(correc_fluxjt,`dnl -c correct the $1-direction with $2$3-fluxes - do ic$3=ifirst$3,ilast$3 - do ic$2=ifirst$2,ilast$2 - ic$1=ifirst$1-1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - do ic$1=ifirst$1,ilast$1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - ic$1=ilast$1+1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4trace3d.i deleted file mode 100644 index 743987f9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/m4trace3d.i +++ /dev/null @@ -1,39 +0,0 @@ -define(trace_init,`dnl - do ic$3=ifirst$3-FACEG,ilast$3+FACEG - do ic$2=ifirst$2-FACEG,ilast$2+FACEG - ie$1=ifirst$1-FACEG - tracergt$1(ie$1,ic$2,ic$3)=uval($5) - tracelft$1(ie$1,ic$2,ic$3)=uval($5) - - do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG - tracelft$1(ie$1,ic$2,ic$3)=uval($4) - tracergt$1(ie$1,ic$2,ic$3)=uval($5) - enddo - - ie$1=ilast$1+FACEG+1 - tracelft$1(ie$1,ic$2,ic$3)=uval($4) - tracergt$1(ie$1,ic$2,ic$3)=uval($4) - enddo - enddo - - -')dnl -define(trace_call,`dnl - do ic$3=ifirst$3-2,ilast$3+2 - do ic$2=ifirst$2-2,ilast$2+2 - do ic$1=ifirst$1-FACEG,ilast$1+FACEG - ttraclft(ic$1) = tracelft(ic$1,ic$2,ic$3) - ttracrgt(ic$1) = tracergt(ic$1,ic$2,ic$3) - enddo - - call trace(dt,ifirst$1,ilast$1,mc, - & dx,idir,advecspeed,igdnv, - & ttraclft,ttracrgt, - & ttcelslp,ttedgslp) - do ic$1=ifirst$1-FACEG,ilast$1+FACEG - tracelft(ic$1,ic$2,ic$3) = ttraclft(ic$1) - tracergt(ic$1,ic$2,ic$3) = ttracrgt(ic$1) - enddo - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stable3d.m4 deleted file mode 100644 index 0e11632b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stable3d.m4 +++ /dev/null @@ -1,52 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl - - subroutine stabledt3d(dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ngc0,ngc1,ngc2, - & advecspeed,uval,stabdt) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/const.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL stabdt,dx(0:NDIM-1) - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ngc0,ngc1,ngc2 -c - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3dVECG(ifirst,ilast,ngc)) -c - REAL maxspeed(0:NDIM-1) -c - maxspeed(0)=zero - maxspeed(1)=zero - maxspeed(2)=zero - - maxspeed(0) = max(maxspeed(0), abs(advecspeed(0))) - maxspeed(1) = max(maxspeed(1), abs(advecspeed(1))) - maxspeed(2) = max(maxspeed(2), abs(advecspeed(2))) - -c Do the following with checks for zero -c stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) -c stabdt = min((dx(2)/maxspeed(2)),stabdt) - - if ( maxspeed(0) .EQ. 0.0 ) then - if( maxspeed(1) .EQ. 0.0 ) then - stabdt = 1.0E9 - else - stabdt = dx(1)/maxspeed(1) - endif - elseif ( maxspeed(1) .EQ. 0.0 ) then - stabdt = dx(0)/maxspeed(0) - else - stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) - endif - - if (maxspeed(2) .NE. 0.0 ) then - stabdt = min((dx(2)/maxspeed(2)),stabdt) - endif - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace1d3d.m4 deleted file mode 100644 index 8cf6a9b1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace1d3d.m4 +++ /dev/null @@ -1,94 +0,0 @@ -define(NEQU,1)dnl -define(REAL,`double precision')dnl - - subroutine trace3d(dt,ifirst,ilast,mc, - & dx,dir,advecspeed,igdnv, - & tracelft,tracergt, - & celslope,edgslope) -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - REAL dt - integer ifirst,ilast,mc,dir,igdnv - REAL dx,advecspeed -c - REAL - & celslope(ifirst-CELLG:ifirst+mc-1+CELLG), -c side variables - & tracelft(ifirst-FACEG:ifirst+mc+FACEG), - & tracergt(ifirst-FACEG:ifirst+mc+FACEG), - & edgslope(ifirst-FACEG:ifirst+mc+FACEG) -c - integer ie,ic - REAL bound,coef4,slope2,dtdx,slope4 - REAL du,nu -c -c*********************************************************************** -c ****************************************************************** -c * check for inflection points in characteristic speeds -c * compute slopes at cell edges -c * zero slopes if neighboring cells have different loading -c ****************************************************************** - do ie=ifirst+1-FACEG,ilast+FACEG - edgslope(ie)=tracergt(ie)-tracelft(ie) - enddo -c ****************************************************************** -c * limit slopes -c ****************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - celslope(ic)=zero - enddo - if (igdnv.eq.2) then -c write(6,*) "second-order slopes" -c **************************************************************** -c * second-order slopes -c **************************************************************** - do ic=ifirst+1-CELLG,ilast+CELLG-1 - slope2=half*(edgslope(ic)+edgslope(ic+1)) - celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) - if (edgslope(ic)*edgslope(ic+1).le.zero) then - celslope(ic)=zero - else - bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) - celslope(ic)=sign(min(two*bound,abs(slope2)),slope2) - endif -c write(6,*) "ic,celslope= ", ic,celslope(ic) -c call flush(6) - enddo - else if (igdnv.eq.4) then -c write(6,*) "fourth-order slopes" -c **************************************************************** -c * fourth-order slopes -c **************************************************************** - do ic=ifirst+2-CELLG,ilast+CELLG-2 - slope4=fourth*(tracergt(ic+2)-tracergt(ic-2)) - celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) - coef4=third*(four*celslope(ic)-slope4) - if (edgslope(ic)*edgslope(ic+1).le.zero .or. - & coef4*celslope(ic).lt.zero) then - celslope(ic)=zero - else - bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) - celslope(ic)=sign(min(two*bound,abs(coef4)),coef4) - endif - enddo - endif -c ****************************************************************** -c * characteristic projection -c ****************************************************************** - dtdx=dt/dx - nu = advecspeed*dtdx - do ic=ifirst-1,ilast+1 - du = celslope(ic) - if (nu.gt.0) then - tracelft(ic+1) = tracelft(ic+1) + half*(one -nu)*du - tracergt(ic) = tracergt(ic) - else - tracelft(ic+1) = tracelft(ic+1) - tracergt(ic) = tracergt(ic) -half*(one + nu)*du - endif - enddo - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace3d.m4 deleted file mode 100644 index fb268179..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/trace3d.m4 +++ /dev/null @@ -1,218 +0,0 @@ -define(NDIM,3)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -include(FORTDIR/3d/m4trace3d.i)dnl - - subroutine inittraceflux3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & uval, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2, - & fluxriem0,fluxriem1,fluxriem2) -c*********************************************************************** - implicit none -include(FORTDIR/const.i)dnl -include(FORTDIR/probparams.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL - & uval(CELL3d(ifirst,ilast,CELLG)), - & fluxriem0(FACE3d0(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & fluxriem1(FACE3d1(ifirst,ilast,FLUXG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & fluxriem2(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c*********************************************************************** -c initialize left and right states at cell edges -c (first-order upwind) -c*********************************************************************** -c - integer ic0,ic1,ie0,ie1,ic2,ie2 -c*********************************************************************** - -trace_init(0,1,2,`ie0-1,ic1,ic2',`ie0,ic1,ic2')dnl - -trace_init(1,2,0,`ic0,ie1-1,ic2',`ic0,ie1,ic2')dnl - -trace_init(2,0,1,`ic0,ic1,ie2-1',`ic0,ic1,ie2')dnl - -c -c we initialize the flux to be zero - - do ic2=ifirst2-FLUXG,ilast2+FLUXG - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 - fluxriem0(ie0,ic1,ic2) = zero - enddo - enddo - enddo -c - do ic2=ifirst2-FLUXG,ilast2+FLUXG - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 - fluxriem1(ie1,ic2,ic0) = zero - enddo - enddo - enddo -c - do ic1=ifirst1-FLUXG,ilast1+FLUXG - do ic0=ifirst0-FLUXG,ilast0+FLUXG - do ie2=ifirst2-FLUXG,ilast2+FLUXG+1 - fluxriem2(ie2,ic0,ic1) = zero - enddo - enddo - enddo -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** -c - subroutine chartracing3d0(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc, - & dx, - & advecspeed,igdnv, - & uval, - & tracelft,tracergt, - & ttcelslp,ttedgslp, - & ttraclft,ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl - -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx,advecspeed -c variables in 2d axis indexed - REAL - & uval(CELL3d(ifirst,ilast,CELLG)), - & tracelft(FACE3d0(ifirst,ilast,FACEG)), - & tracergt(FACE3d0(ifirst,ilast,FACEG)) -c side variables ifirst0 to ifirst0+mc plus ghost cells - REAL - & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG), - & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG), - & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG) -c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 0 -trace_call(0,1,2)dnl -c*********************************************************************** - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing3d1(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc, - & dx, - & advecspeed,igdnv, - & uval, - & tracelft,tracergt, - & ttcelslp,ttedgslp, - & ttraclft,ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl - -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx,advecspeed -c variables in 2d axis indexed - REAL - & uval(CELL3d(ifirst,ilast,CELLG)), - & tracelft(FACE3d1(ifirst,ilast,FACEG)), - & tracergt(FACE3d1(ifirst,ilast,FACEG)) - REAL - & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG), - & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG), - & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG) -c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 1 -trace_call(1,2,0)dnl -c*********************************************************************** - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine chartracing3d2(dt, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & mc, - & dx, - & advecspeed,igdnv, - & uval, - & tracelft,tracergt, - & ttcelslp,ttedgslp, - & ttraclft,ttracrgt) -c*********************************************************************** - implicit none -include(FORTDIR/probparams.i)dnl - -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer mc,igdnv - REAL dt -c variables in 1d axis indexed - REAL - & dx,advecspeed -c variables in 2d axis indexed - REAL - & uval(CELL3d(ifirst,ilast,CELLG)), - & tracelft(FACE3d2(ifirst,ilast,FACEG)), - & tracergt(FACE3d2(ifirst,ilast,FACEG)) - REAL - & ttedgslp(ifirst2-FACEG:ifirst2+mc+FACEG), - & ttraclft(ifirst2-FACEG:ifirst2+mc+FACEG), - & ttracrgt(ifirst2-FACEG:ifirst2+mc+FACEG) -c cell variables ifirst2 to ifirst2+mc-1 plus ghost cells - REAL - & ttcelslp(ifirst2-CELLG:ifirst2+mc-1+CELLG) -c*********************************************************************** - integer ic0,ic1,ic2,idir -c*********************************************************************** -c trace higher order states at cell edges -c*********************************************************************** - idir = 2 -trace_call(2,0,1)dnl -c*********************************************************************** - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.depend new file mode 100644 index 00000000..e9cce404 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.depend @@ -0,0 +1,189 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=flux2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + flux2d.m4 m4flux2d.i probparams.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=flux3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + flux3d.m4 m4flux3d.i probparams.i + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=fluxcorner3d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + fluxcorner3d.m4 m4fluxcorner3d.i probparams.i + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=grad2d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + grad2d.m4 probparams.i + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=grad3d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + grad3d.m4 probparams.i + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=init2d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 probparams.i + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=init3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 probparams.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=stable2d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + stable2d.m4 + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=stable3d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + stable3d.m4 + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=stufprobc2d.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc2d.m4 + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=stufprobc3d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc3d.m4 + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=trace1d2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=trace1d3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + +FILE_13=trace2d.o +DEPENDS_13:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + m4trace2d.i probparams.i trace2d.m4 + +DEPENDS_13 +=\ + + + +${FILE_13}: ${DEPENDS_13} + +FILE_14=trace3d.o +DEPENDS_14:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + m4trace3d.i probparams.i trace3d.m4 + +DEPENDS_14 +=\ + + + +${FILE_14}: ${DEPENDS_14} + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.in new file mode 100644 index 00000000..12917898 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/Makefile.in @@ -0,0 +1,94 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI linear advection +## performance test +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/performance/LinAdv/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +F_OBJS = flux3d.o fluxcorner3d.o grad3d.o init3d.o stable3d.o stufprobc3d.o \ + trace3d.o trace1d3d.o \ + flux2d.o grad2d.o init2d.o stable2d.o stufprobc2d.o trace2d.o \ + trace1d2d.o + +main: $(F_OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +flux2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux2d.m4 > flux2d.f + $(F77) $(FFLAGS) -c flux2d.f -o $@ + +grad2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad2d.m4 > grad2d.f + $(F77) $(FFLAGS) -c grad2d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +stable2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable2d.m4 > stable2d.f + $(F77) $(FFLAGS) -c stable2d.f -o $@ + +stufprobc2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc2d.m4 > stufprobc2d.f + $(F77) $(FFLAGS) -c stufprobc2d.f -o $@ + +trace2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace2d.m4 > trace2d.f + $(F77) $(FFLAGS) -c trace2d.f -o $@ + +trace1d2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d2d.m4 > trace1d2d.f + $(F77) $(FFLAGS) -c trace1d2d.f -o $@ + +flux3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux3d.m4 > flux3d.f + $(F77) $(FFLAGS) -c flux3d.f -o $@ + +fluxcorner3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/fluxcorner3d.m4 > fluxcorner3d.f + $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ + +grad3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad3d.m4 > grad3d.f + $(F77) $(FFLAGS) -c grad3d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +stable3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable3d.m4 > stable3d.f + $(F77) $(FFLAGS) -c stable3d.f -o $@ + +stufprobc3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc3d.m4 > stufprobc3d.f + $(F77) $(FFLAGS) -c stufprobc3d.f -o $@ + +trace3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace3d.m4 > trace3d.f + $(F77) $(FFLAGS) -c trace3d.f -o $@ + +trace1d3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d3d.m4 > trace1d3d.f + $(F77) $(FFLAGS) -c trace1d3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/const.i index f1303636..d815c0c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,sixth,fourth,third,half,twothird,rt75,one, & onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux2d.m4 new file mode 100644 index 00000000..c8a193e8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux2d.m4 @@ -0,0 +1,236 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to evaluate fluxes in 2d. +c +define(NDIM,2)dnl +define(NEQU,1)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/m4flux2d.i)dnl + + subroutine fluxcorrec2d(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & dx, + & advecspeed,uval, + & flux0,flux1, + & trlft0,trlft1, + & trrgt0,trrgt1) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL2d(ifirst,ilast,CELLG)), + & flux0(FACE2d0(ifirst,ilast,FLUXG)), + & flux1(FACE2d1(ifirst,ilast,FLUXG)), + & trlft0(FACE2d0(ifirst,ilast,FACEG)), + & trrgt0(FACE2d0(ifirst,ilast,FACEG)), + & trlft1(FACE2d1(ifirst,ilast,FACEG)), + & trrgt1(FACE2d1(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1 + REAL trnsvers + +c write(6,*) "In fluxcorrec()" +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** +c correct the 1-direction with 0-fluxes +c write(6,*) " correct the 1-direction with 0-fluxes" + do ic1=ifirst1-1,ilast1+1 + do ic0=ifirst0-1,ilast0+1 + trnsvers= (flux0(ic0+1,ic1)-flux0(ic0,ic1))*0.5/dx(0) + + trrgt1(ic1 ,ic0)= trrgt1(ic1 ,ic0) - trnsvers + trlft1(ic1+1,ic0)= trlft1(ic1+1,ic0) - trnsvers + enddo + enddo +c call flush(6) + +c correct the 0-direction with 1-fluxes +c write(6,*) " correct the 0-direction with 1-fluxes" + do ic0=ifirst0-1,ilast0+1 + do ic1=ifirst1-1,ilast1+1 + trnsvers= (flux1(ic1+1,ic0)-flux1(ic1,ic0))*0.5/dx(1) + trrgt0(ic0 ,ic1)= trrgt0(ic0 ,ic1) - trnsvers + trlft0(ic0+1,ic1)= trlft0(ic0+1,ic1) - trnsvers + enddo + enddo +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcalculation2d(dt,extra_cell,visco,dx, + & ifirst0,ilast0,ifirst1,ilast1, + & advecspeed, + & uval, + & flux0,flux1, + & trlft0,trlft1,trrgt0,trrgt1) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,extra_cell,visco + REAL dt + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL2d(ifirst,ilast,CELLG)), +c variables in 2d side indexed + & flux0(FACE2d0(ifirst,ilast,FLUXG)), + & flux1(FACE2d1(ifirst,ilast,FLUXG)), + & trlft0(FACE2d0(ifirst,ilast,FACEG)), + & trrgt0(FACE2d0(ifirst,ilast,FACEG)), + & trlft1(FACE2d1(ifirst,ilast,FACEG)), + & trrgt1(FACE2d1(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1,ie0,ie1 + REAL riemst +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c +c write(6,*) "In fluxcalculation(",extra_cell,")" +c write(6,*) "ifirst0,ilast0,ifirst1,ilast1,extra_cell", +c & ifirst0,ilast0,ifirst1,ilast1,extra_cell + +riemann_solve(0,1,extra_cell)dnl +c +riemann_solve(1,0,extra_cell)dnl + + if (visco.eq.1) then + write(6,*) "doing artificial viscosity" +c +crtificial_viscosity1(0,1)dnl +c +crtificial_viscosity1(1,0)dnl +c + endif +c call flush(6) + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + + subroutine consdiff2d(ifirst0,ilast0,ifirst1,ilast1, + & dx, + & flux0,flux1, + & advecspeed,uval) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** + integer ifirst0, ilast0,ifirst1, ilast1 + REAL dx(0:NDIM-1) + REAL + & flux0(FACE2d0(ifirst,ilast,FLUXG)), + & flux1(FACE2d1(ifirst,ilast,FLUXG)), + & advecspeed(0:NDIM-1), + & uval(CELL2d(ifirst,ilast,CELLG)) +c + integer ic0,ic1 + +c*********************************************************************** +c update velocity to full time +c note the reversal of indices in 2nd coordinate direction +c*********************************************************************** +c*********************************************************************** +c write(6,*) "at top of consdiff" +c call flush(6) +c write(6,*) "flux0" +c do ic1=ifirst1,ilast1 +c do ic0=ifirst0,ilast0+1 +c write(6,*) "ic0,flux0= ",ic0,ic1, +c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), +c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) +c call flush(6) +c enddo +c enddo +c write(6,*) "flux1" +c do ic1=ifirst1,ilast1 +c do ic0=ifirst0,ilast0+1 +c write(6,*) "ic0,flux1= ",ic0,ic1, +c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), +c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) +c call flush(6) +c enddo +c enddo +c do ic1=ifirst1,ilast1 +c do ic0=ifirst0,ilast0 +c write(6,*) "ic0,ic1,all = ",ic0,ic1, +c & density(ic0,ic1), +c & velocity(ic0,ic1,1),velocity(ic0,ic1,2), +c & pressure(ic0,ic1) +c call flush(6) +c enddo +c enddo +c*********************************************************************** + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + uval(ic0,ic1) = uval(ic0,ic1) + & -(flux0(ic0+1,ic1)-flux0(ic0,ic1))/dx(0) + & -(flux1(ic1+1,ic0)-flux1(ic1,ic0))/dx(1) + enddo + enddo +c*********************************************************************** +c write(6,*) "in consdiff" +c do ic1=ifirst1,ilast1+1 +c do ic0=ifirst0,ilast0+1 +c write(6,*) "ic0,ic1,flux0= ",ic0,ic1, +c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), +c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) +c call flush(6) +c enddo +c enddo +c do ic1=ifirst1,ilast1+1 +c do ic0=ifirst0,ilast0+1 +c write(6,*) "ic0,ic1,flux1= ",ic0,ic1, +c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), +c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) +c call flush(6) +c enddo +c enddo +c*********************************************************************** +c*********************************************************************** +c do ic1=ifirst1,ilast1 +c do ic0=ifirst0,ilast0 +c write(6,*) "ic0,ic1,all = ",ic0,ic1, +c & density(ic0,ic1), +c & velocity(ic0,ic1,1),velocity(ic0,ic1,2), +c & momentum(ic0,ic1,1),momentum(ic0,ic1,2), +c & pressure(ic0,ic1), +c & energy(ic0,ic1) +c call flush(6) +c enddo +c enddo + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux3d.m4 new file mode 100644 index 00000000..65dd2dc3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/flux3d.m4 @@ -0,0 +1,268 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to evaluate fluxes in 3d. +c +define(NDIM,3)dnl +define(NEQU,1)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4flux3d.i)dnl + + subroutine fluxcorrec3d2d(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx,advecspeed,idir, + & uval, + & flux0,flux1,flux2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2, + & ttracelft0,ttracelft1,ttracelft2, + & ttracergt0,ttracergt1,ttracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt + integer idir +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)), +c + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), +c + & tracelft0(FACE3d0(ifirst,ilast,FACEG)), + & tracelft1(FACE3d1(ifirst,ilast,FACEG)), + & tracelft2(FACE3d2(ifirst,ilast,FACEG)), + & tracergt0(FACE3d0(ifirst,ilast,FACEG)), + & tracergt1(FACE3d1(ifirst,ilast,FACEG)), + & tracergt2(FACE3d2(ifirst,ilast,FACEG)), +c + & ttracelft0(FACE3d0(ifirst,ilast,FACEG)), + & ttracelft1(FACE3d1(ifirst,ilast,FACEG)), + & ttracelft2(FACE3d2(ifirst,ilast,FACEG)), + & ttracergt0(FACE3d0(ifirst,ilast,FACEG)), + & ttracergt1(FACE3d1(ifirst,ilast,FACEG)), + & ttracergt2(FACE3d2(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL trnsvers + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** +c +c +c "Forward" computation of transverse flux terms +c + if (idir.eq.1) then +c +correc_flux2d(0,`ic1,ic2',1,`ic2,ic0',2)dnl +c +correc_flux2d(1,`ic2,ic0',0,`ic1,ic2',2)dnl +c +correc_flux2d(2,`ic0,ic1',0,`ic1,ic2',1)dnl +c +c "Backward" computation of transverse flux terms +c + elseif (idir.eq.-1) then +c +correc_flux2d(0,`ic1,ic2',2,`ic0,ic1',1)dnl +c +correc_flux2d(1,`ic2,ic0',2,`ic0,ic1',0)dnl +c +correc_flux2d(2,`ic0,ic1',1,`ic2,ic0',0)dnl +c + endif +c + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcorrec3d3d(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx, + & advecspeed,uval, + & fluxa0,fluxa1,fluxa2, + & fluxb0,fluxb1,fluxb2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)), + & fluxa0(FACE3d0(ifirst,ilast,FLUXG)), + & fluxa1(FACE3d1(ifirst,ilast,FLUXG)), + & fluxa2(FACE3d2(ifirst,ilast,FLUXG)), + & fluxb0(FACE3d0(ifirst,ilast,FLUXG)), + & fluxb1(FACE3d1(ifirst,ilast,FLUXG)), + & fluxb2(FACE3d2(ifirst,ilast,FLUXG)), + & tracelft0(FACE3d0(ifirst,ilast,FACEG)), + & tracergt0(FACE3d0(ifirst,ilast,FACEG)), + & tracelft1(FACE3d1(ifirst,ilast,FACEG)), + & tracergt1(FACE3d1(ifirst,ilast,FACEG)), + & tracelft2(FACE3d2(ifirst,ilast,FACEG)), + & tracergt2(FACE3d2(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL trnsvers + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** +c +correc_flux3d(2,0,1,a0,a1,`ic1,ic2',`ic2,ic0')dnl +c +correc_flux3d(1,2,0,a2,b0,`ic0,ic1',`ic1,ic2')dnl +c +correc_flux3d(0,1,2,b1,b2,`ic2,ic0',`ic0,ic1')dnl +c +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcalculation3d(dt,xcell0,xcell1,visco,dx, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & advecspeed, + & uval, + & flux0,flux1,flux2, + & trlft0,trlft1,trlft2, + & trrgt0,trrgt1,trrgt2) + +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer xcell0,xcell1,visco + REAL dt + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)) +c variables in 2d side indexed + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), + & trlft0(FACE3d0(ifirst,ilast,FACEG)), + & trrgt0(FACE3d0(ifirst,ilast,FACEG)), + & trlft1(FACE3d1(ifirst,ilast,FACEG)), + & trrgt1(FACE3d1(ifirst,ilast,FACEG)), + & trlft2(FACE3d2(ifirst,ilast,FACEG)), + & trrgt2(FACE3d2(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,ie0,ie1,ie2 + REAL riemst +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c + +riemann_solve(0,1,2,`ic1,ic2',xcell0,xcell1)dnl + +c +riemann_solve(1,0,2,`ic2,ic0',xcell0,xcell1)dnl + +c +riemann_solve(2,0,1,`ic0,ic1',xcell0,xcell1)dnl + + if (visco.eq.1) then + write(6,*) "doing artificial viscosity" +c +crtificial_viscosity1(0,1,2)dnl +c +crtificial_viscosity1(1,2,0)dnl +c +crtificial_viscosity1(2,0,1)dnl +c + endif +c call flush(6) + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + + subroutine consdiff3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dx, + & flux0,flux1,flux2, + & advecspeed,uval) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** + integer ifirst0, ilast0,ifirst1, ilast1,ifirst2,ilast2 + REAL dx(0:NDIM-1) + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)) +c + integer ic0,ic1,ic2 + +c*********************************************************************** +c update velocity to full time +c note the reversal of indices in 2nd coordinate direction +c*********************************************************************** +c*********************************************************************** + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + uval(ic0,ic1,ic2) = uval(ic0,ic1,ic2) + & -(flux0(ic0+1,ic1,ic2)-flux0(ic0,ic1,ic2))/dx(0) + & -(flux1(ic1+1,ic2,ic0)-flux1(ic1,ic2,ic0))/dx(1) + & -(flux2(ic2+1,ic0,ic1)-flux2(ic2,ic0,ic1))/dx(2) + enddo + enddo + enddo + return + end +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/fluxcorner3d.m4 new file mode 100644 index 00000000..367a8ef0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/fluxcorner3d.m4 @@ -0,0 +1,194 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to evaluate corner fluxes in 3d. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4fluxcorner3d.i)dnl + + subroutine onethirdstate3d(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & advecspeed,uval, + & flux0,flux1,flux2, + & st3) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)), + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), + & st3(CELL3d(ifirst,ilast,CELLG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL trnsvers + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** +c + if (idir.eq.0) then +c +st_third(0,1,2,`ic1,ic2')dnl +c + elseif (idir.eq.1) then +c +st_third(1,2,0,`ic2,ic0')dnl +c + elseif (idir.eq.2) then +c +st_third(2,0,1,`ic0,ic1')dnl +c + endif + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxthird3d(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & advecspeed, + & uval, + & st3, + & flux0,flux1,flux2) + +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt + REAL + & dx(0:NDIM-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)) +c variables in 2d side indexed + REAL + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), + & st3(CELL3d(ifirst,ilast,CELLG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL riemst +c +c*********************************************************************** +c solve riemann problems for conservative flux +c arguments: ( axis for RP, other axis, extra cells-direction) +c*********************************************************************** +c + if (idir.eq.0) then +c +f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl +c +f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl +c + elseif (idir.eq.1) then +c +f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl +c +f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl +c + elseif (idir.eq.2) then +c +f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl +c +f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl +c + endif +c +c call flush(6) + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine fluxcorrecjt3d(dt,dx,idir, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & advecspeed,uval, + & flux0,flux1,flux2, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer idir,ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL dt +c variables in 1d axis indexed +c + REAL + & dx(0:3-1) +c variables in 2d cell indexed + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3d(ifirst,ilast,CELLG)), + & flux0(FACE3d0(ifirst,ilast,FLUXG)), + & flux1(FACE3d1(ifirst,ilast,FLUXG)), + & flux2(FACE3d2(ifirst,ilast,FLUXG)), + & tracelft0(FACE3d0(ifirst,ilast,FACEG)), + & tracergt0(FACE3d0(ifirst,ilast,FACEG)), + & tracelft1(FACE3d1(ifirst,ilast,FACEG)), + & tracergt1(FACE3d1(ifirst,ilast,FACEG)), + & tracelft2(FACE3d2(ifirst,ilast,FACEG)), + & tracergt2(FACE3d2(ifirst,ilast,FACEG)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2 + REAL trnsvers +c REAL ttvlft,ttvrgt + +c ****************************************************************** +c * complete tracing at cell edges +c ****************************************************************** +c + if (idir.eq.0) then +c +correc_fluxjt(0,2,1,`ic2,ic0',`ic0,ic1')dnl +c + elseif (idir.eq.1) then +c +correc_fluxjt(1,0,2,`ic0,ic1',`ic1,ic2')dnl +c + elseif (idir.eq.2) then +c +correc_fluxjt(2,1,0,`ic1,ic2',`ic2,ic0')dnl +c + endif +c +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad2d.m4 new file mode 100644 index 00000000..b3ec3e3e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad2d.m4 @@ -0,0 +1,218 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to evaluate gradients in 2d. +c +define(NDIM,2)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine detectgrad2d( + & ifirst0,ilast0,ifirst1,ilast1, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & dx, + & gradtol, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ifirst1,ilast0,ilast1, + & dotag,donttag, + & vghost0,vghost1, + & tagghost0,tagghost1, + & ttagghost0,ttagghost1 + REAL + & dx(0:NDIM-1), + & gradtol +c variables indexed as 2dimensional + REAL + & var(CELL2dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL2dVECG(ifirst,ilast,tagghost)), + & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) +c + REAL tol + REAL facejump, loctol + REAL presm1,presp1,diag01 + logical tagcell + integer ic0,ic1 +c +c*********************************************************************** +c + tol = gradtol + diag01 = sqrt(dx(0)**2+dx(1)**2) + + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1) .ne. 0) then + loctol = 0.125*tol + else + loctol = tol + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1) + presp1 = var(ic0+1,ic1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(0))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1) + presp1 = var(ic0,ic1+1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(1))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1) + presp1 = var(ic0+1,ic1+1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*diag01)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1) + presp1 = var(ic0+1,ic1-1) + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((facejump).gt.(loctol*diag01)) + endif + + if ( tagcell ) then + temptags(ic0,ic1) = dotag + endif + enddo + enddo + return + end + + subroutine detectshock2d( + & ifirst0,ilast0,ifirst1,ilast1, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & dx, + & gradtol,gradonset, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ifirst1,ilast0,ilast1, + & dotag,donttag, + & vghost0,vghost1, + & tagghost0,tagghost1, + & ttagghost0,ttagghost1 + REAL + & dx(0:NDIM-1), + & gradtol,gradonset +c variables indexed as 2dimensional + REAL + & var(CELL2dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL2dVECG(ifirst,ilast,tagghost)), + & temptags(CELL2dVECG(ifirst,ilast,ttagghost)) +c + REAL tol,onset + REAL jump1, jump2, facejump, loctol,locon + REAL presm1,presm2,presp1,presp2 + REAL diag01 + logical tagcell + integer ic0,ic1 +c +c*********************************************************************** +c + tol = gradtol + onset = gradonset + diag01 = sqrt(dx(0)**2+dx(1)**2) + + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1) .ne. 0) then + loctol = 0.125*tol + locon = 0.66*onset + else + loctol = tol + locon = onset + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1) + presm2 = var(ic0-2,ic1) + presp1 = var(ic0+1,ic1) + presp2 = var(ic0+2,ic1) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(0)))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1) + presm2 = var(ic0,ic1-2) + presp1 = var(ic0,ic1+1) + presp2 = var(ic0,ic1+2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(1)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1) + presp1 = var(ic0+1,ic1+1) + presm2 = var(ic0-2,ic1-2) + presp2 = var(ic0+2,ic1+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag01))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1) + presp1 = var(ic0+1,ic1-1) + presm2 = var(ic0-2,ic1+2) + presp2 = var(ic0+2,ic1-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1)-presm1) + facejump = max(facejump,abs(var(ic0,ic1)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag01))) + endif + + if ( tagcell ) then + temptags(ic0,ic1) = dotag + endif + enddo + enddo + return + end + + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad3d.m4 new file mode 100644 index 00000000..580fe8c4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/grad3d.m4 @@ -0,0 +1,430 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines to evaluate gradients in 3d. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine detectgrad3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & vghost2,tagghost2,ttagghost2, + & dx, + & gradtol, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dotag,donttag, + & vghost0,vghost1,vghost2, + & tagghost0,tagghost1,tagghost2, + & ttagghost0,ttagghost1,ttagghost2 + REAL + & dx(0:NDIM-1), + & gradtol +c variables indexed as 3dimensional + REAL + & var(CELL3dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL3dVECG(ifirst,ilast,tagghost)), + & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) +c + REAL tol + REAL facejump, loctol + REAL presm1,presp1 + REAL diag(0:NDIM-1),diag012 + logical tagcell + integer ic0,ic1,ic2 +c +c*********************************************************************** +c + tol = gradtol + diag(0) = sqrt(dx(2)**2+dx(1)**2) + diag(1) = sqrt(dx(0)**2+dx(2)**2) + diag(2) = sqrt(dx(0)**2+dx(1)**2) + diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) + + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1,ic2) .ne. 0) then + loctol = 0.125*tol + else + loctol = tol + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1,ic2) + presp1 = var(ic0+1,ic1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(0))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2) + presp1 = var(ic0,ic1+1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(1))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1,ic2-1) + presp1 = var(ic0,ic1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*dx(2))) + endif + + +c 2Dimensional diagonals + + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2-1) + presp1 = var(ic0,ic1+1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(0))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1+1,ic2-1) + presp1 = var(ic0,ic1-1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(0))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2-1) + presp1 = var(ic0+1,ic1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(1))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2+1) + presp1 = var(ic0+1,ic1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(1))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2) + presp1 = var(ic0+1,ic1+1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(2))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2) + presp1 = var(ic0+1,ic1-1,ic2) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag(2))) + endif + +c End 2Dimensional diagonals +c 3Dimensional diagonals + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2-1) + presp1 = var(ic0+1,ic1+1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2+1) + presp1 = var(ic0+1,ic1+1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2-1) + presp1 = var(ic0+1,ic1-1,ic2+1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2+1) + presp1 = var(ic0+1,ic1-1,ic2-1) + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((facejump).gt.(loctol*diag012)) + endif + +c End 3Dimensional diagonals + + if ( tagcell ) then + temptags(ic0,ic1,ic2) = dotag + endif + enddo + enddo + enddo + return + end + + subroutine detectshock3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & vghost0,tagghost0,ttagghost0, + & vghost1,tagghost1,ttagghost1, + & vghost2,tagghost2,ttagghost2, + & dx, + & gradtol,gradonset, + & dotag,donttag, + & var, + & tags,temptags) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c input arrays: + integer + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & dotag,donttag, + & vghost0,vghost1,vghost2, + & tagghost0,tagghost1,tagghost2, + & ttagghost0,ttagghost1,ttagghost2 + REAL + & dx(0:NDIM-1), + & gradtol,gradonset +c variables indexed as 3dimensional + REAL + & var(CELL3dVECG(ifirst,ilast,vghost)) + integer + & tags(CELL3dVECG(ifirst,ilast,tagghost)), + & temptags(CELL3dVECG(ifirst,ilast,ttagghost)) +c + REAL tol,onset + REAL jump1, jump2, facejump, loctol,locon + REAL presm1,presm2,presp1,presp2 + REAL diag(0:NDIM-1),diag012 + logical tagcell + integer ic0,ic1,ic2 +c +c*********************************************************************** +c + tol = gradtol + onset = gradonset + diag(0) = sqrt(dx(2)**2+dx(1)**2) + diag(1) = sqrt(dx(0)**2+dx(2)**2) + diag(2) = sqrt(dx(0)**2+dx(1)**2) + diag012= sqrt(dx(0)**2+dx(1)**2+dx(2)**2) + + do ic2=ifirst2,ilast2 + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + + if (tags(ic0,ic1,ic2) .ne. 0) then + loctol = 0.125*tol + locon = 0.66*onset + else + loctol = tol + locon = onset + endif + + tagcell = .false. + + presm1 = var(ic0-1,ic1,ic2) + presm2 = var(ic0-2,ic1,ic2) + presp1 = var(ic0+1,ic1,ic2) + presp2 = var(ic0+2,ic1,ic2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(0)))) + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2) + presm2 = var(ic0,ic1-2,ic2) + presp1 = var(ic0,ic1+1,ic2) + presp2 = var(ic0,ic1+2,ic2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(1)))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1,ic2-1) + presm2 = var(ic0,ic1,ic2-2) + presp1 = var(ic0,ic1,ic2+1) + presp2 = var(ic0,ic1,ic2+2) + jump2 = presp2-presm2 + jump1 = presp1-presm1 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*dx(2)))) + endif + + +c 2Dimensional diagonals + + if (.not.tagcell) then + presm1 = var(ic0,ic1-1,ic2-1) + presp1 = var(ic0,ic1+1,ic2+1) + presm2 = var(ic0,ic1-2,ic2-2) + presp2 = var(ic0,ic1+2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(0)))) + endif + if (.not.tagcell) then + presm1 = var(ic0,ic1+1,ic2-1) + presp1 = var(ic0,ic1-1,ic2+1) + presm2 = var(ic0,ic1+2,ic2-2) + presp2 = var(ic0,ic1-2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(0)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2-1) + presp1 = var(ic0+1,ic1,ic2+1) + presm2 = var(ic0-2,ic1,ic2-2) + presp2 = var(ic0+2,ic1,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(1)))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1,ic2+1) + presp1 = var(ic0+1,ic1,ic2-1) + presm2 = var(ic0-2,ic1,ic2+2) + presp2 = var(ic0+2,ic1,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(1)))) + endif + + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2) + presp1 = var(ic0+1,ic1+1,ic2) + presm2 = var(ic0-2,ic1-2,ic2) + presp2 = var(ic0+2,ic1+2,ic2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(2)))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2) + presp1 = var(ic0+1,ic1-1,ic2) + presm2 = var(ic0-2,ic1+2,ic2) + presp2 = var(ic0+2,ic1-2,ic2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag(2)))) + endif + +c End 2Dimensional diagonals +c 3Dimensional diagonals + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2-1) + presp1 = var(ic0+1,ic1+1,ic2+1) + presm2 = var(ic0-2,ic1-2,ic2-2) + presp2 = var(ic0+2,ic1+2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1-1,ic2+1) + presp1 = var(ic0+1,ic1+1,ic2-1) + presm2 = var(ic0-2,ic1-2,ic2+2) + presp2 = var(ic0+2,ic1+2,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2-1) + presp1 = var(ic0+1,ic1-1,ic2+1) + presm2 = var(ic0-2,ic1+2,ic2-2) + presp2 = var(ic0+2,ic1-2,ic2+2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + if (.not.tagcell) then + presm1 = var(ic0-1,ic1+1,ic2+1) + presp1 = var(ic0+1,ic1-1,ic2-1) + presm2 = var(ic0-2,ic1+2,ic2+2) + presp2 = var(ic0+2,ic1-2,ic2-2) + jump1 = presp1-presm1 + jump2 = presp2-presm2 + facejump = abs(var(ic0,ic1,ic2)-presm1) + facejump = max(facejump,abs(var(ic0,ic1,ic2)-presp1)) + tagcell = ((((abs(jump2)*locon).le.abs(jump1)).or. + & ((jump1*jump2).lt.zero)).and. + & ((facejump).gt.(loctol*diag012))) + endif + +c End 3Dimensional diagonals + + if ( tagcell ) then + temptags(ic0,ic1,ic2) = dotag + endif + enddo + enddo + enddo + return + end + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init2d.m4 new file mode 100644 index 00000000..015715ec --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init2d.m4 @@ -0,0 +1,231 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 2d. +c +define(NDIM,2)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine linadvinit2d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1, + & gcw0,gcw1, + & uval, + & nintervals,front, + & i_uval) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer gcw0,gcw1 + integer data_problem + integer nintervals + REAL front(1:nintervals) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) + REAL + & i_uval(1:nintervals) + REAL + & uval(CELL2dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,dir,ifr + REAL xc(0:NDIM-1) +c +c dir 0 two linear states (L,R) indp of y,z +c dir 1 two linear states (L,R) indp of x,z + +c write(6,*) "Inside initplane" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1) +c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) +c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,"and ",ifirst1,ilast1 +c call flush(6) + + dir = 0 + if (data_problem.eq.PIECEWISE_CONSTANT_X) then + dir = 0 + else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then + dir = 1 + endif + + if (dir.eq.0) then + ifr = 1 + do ic0=ifirst0,ilast0 + xc(0) = xlo(0) + dx(0)*(dble(ic0-ifirst0)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + uval(ic0,ic1) = i_uval(ifr) + enddo + enddo + else if (dir.eq.1) then + ifr = 1 + do ic1=ifirst1,ilast1 + xc(1) =xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic0=ifirst0,ilast0 + uval(ic0,ic1) = i_uval(ifr) + enddo + enddo + endif +c + return + end + +c*********************************************************************** +c +c Initialization routine where we use a spherical profile +c +c*********************************************************************** + subroutine initsphere2d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1, + & gcw0,gcw1, + & uval, + & i_uval,o_uval, + & center,radius) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer gcw0,gcw1 + integer data_problem + REAL i_uval,o_uval + REAL radius,center(0:NDIM-1) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) +c variables in 2d cell indexed + REAL + & uval(CELL2dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1 + REAL xc(0:NDIM-1),x0,x1 + REAL angle + +c write(6,*) "in initsphere" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx = ",(dx(i),i=0,NDIM-1) +c write(6,*) "xlo = ",(xlo(i),i=0,NDIM-1) +c write(6,*) "xhi = ",(xhi(i),i=0,NDIM-1) +c write(6,*) "ce = ",(ce(i),i=0,NDIM-1) +c write(6,*) "radius = ",radius +c write(6,*) "ifirst0,ilast0 = ",ifirst0,ilast0 +c write(6,*) "ifirst1,ilast1 = ",ifirst1,ilast1 +c + + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + x1 = xc(1)-center(1) + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + x0 = xc(0)-center(0) + if (x1.eq.zero .and. x0.eq.zero) then + angle = zero + else + angle = atan2(x1,x0) + endif + if ((x0**2+x1**2).lt.radius**2) then + uval(ic0,ic1) = i_uval + else + uval(ic0,ic1) = o_uval + endif + enddo + enddo +c + return + end + +c*********************************************************************** +c +c Sine profile +c +c*********************************************************************** + + subroutine linadvinitsine2d(data_problem,dx,xlo, + & domain_xlo, + & ifirst0,ilast0,ifirst1,ilast1, + & gcw0,gcw1, + & uval, + & nintervals,front, + & i_uval, + & amplitude) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer gcw0,gcw1 + integer data_problem + integer nintervals + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1), + & domain_xlo(0:NDIM-1) + REAL front(1:nintervals) + REAL i_uval(1:nintervals) + REAL amplitude,period(0:NDIM-1) +c variables in 2d cell indexed + REAL + & uval(CELL2dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,j,ifr + REAL xc(0:NDIM-1),xmid(1:10) + REAL coef(0:NDIM-1),coscoef(1:2) +c +c write(6,*) "Inside eulerinitsine" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1) +c write(6,*) "mc= ",mc(0), mc(1) +c write(6,*) "xlo= ",xlo(0), xlo(1),", xhi = ",xhi(0), xhi(1) +c write(6,*) "ifirst, ilast= ",ifirst0,ilast0,ifirst1,ilast1 +c write(6,*) "gamma= ",gamma +c call flush(6) + + if (data_problem.eq.SINE_CONSTANT_Y) then + write(6,*) "Sorry, Y direction not implemented :-(" + return + endif + + coef(0) = zero + do j=1,NDIM-1 + coef(j) = two*pi/period(j) + enddo + + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + coscoef(1) = amplitude* + & cos((xc(1)-domain_xlo(1))*coef(1)) + do j=1,(nintervals-1) + xmid(j) = front(j) + coscoef(1) + enddo + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + ifr = 1 + do j=1,(nintervals-1) + if( xc(0) .gt. xmid(j) ) ifr = j+1 + enddo + uval(ic0,ic1) = i_uval(ifr) + enddo + enddo + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init3d.m4 new file mode 100644 index 00000000..3b82285a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/init3d.m4 @@ -0,0 +1,276 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 3d. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine linadvinit3d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gcw0,gcw1,gcw2, + & uval, + & nintervals,front, + & i_uval) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer gcw0,gcw1,gcw2 + integer data_problem + integer nintervals + REAL front(1:nintervals) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) + REAL + & i_uval(1:nintervals) +c variables in 2d cell indexed + REAL + & uval(CELL3dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,dir,ifr + REAL xc(0:NDIM-1) +c +c dir 0 two linear states (L,R) indp of y,z +c dir 1 two linear states (L,R) indp of x,z +c dir 2 two linear states (L,R) indp of x,y + +c write(6,*) "Inside eulerinit" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1), dx(2) +c write(6,*) "xlo= ",xlo(0), xlo(1),xhi(2) +c write(6,*) "xhi= ",xhi(0), xhi(1),xhi(2) +c write(6,*) "ifirst= ",ifirst0,ifirst1,ifirst2 +c write(6,*) "ilast= ",ilast0,ilast1,ilast2 +c write(6,*) "gamma= ",gamma +c call flush(6) + + dir = 0 + if (data_problem.eq.PIECEWISE_CONSTANT_X) then + dir = 0 + else if (data_problem.eq.PIECEWISE_CONSTANT_Y) then + dir = 1 + else if (data_problem.eq.PIECEWISE_CONSTANT_Z) then + dir = 2 + endif + + if (dir.eq.0) then + ifr = 1 + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+ dx(0)*(dble(ic0-ifirst0)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + do ic2=ifirst2,ilast2 + uval(ic0,ic1,ic2) = i_uval(ifr) + enddo + enddo + enddo + else if (dir.eq.1) then + ifr = 1 + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+ dx(1)*(dble(ic1-ifirst1)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic2=ifirst2,ilast2 + do ic0=ifirst0,ilast0 + uval(ic0,ic1,ic2) = i_uval(ifr) + enddo + enddo + enddo + else if (dir.eq.2) then + ifr = 1 + do ic2=ifirst2,ilast2 + xc(2) = xlo(2)+ dx(2)*(dble(ic2-ifirst2)+half) + if (xc(dir).gt.front(ifr)) then + ifr = ifr+1 + endif + do ic1=ifirst1,ilast1 + do ic0=ifirst0,ilast0 + uval(ic0,ic1,ic2) = i_uval(ifr) + enddo + enddo + enddo + endif +c + return + end + +c*********************************************************************** +c +c Initialization routine where we use a spherical profile +c +c*********************************************************************** + subroutine initsphere3d(data_problem,dx,xlo,xhi, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gcw0,gcw1,gcw2, + & uval, + & l_uval,r_uval, + & ce,rad) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer gcw0,gcw1,gcw2 + integer data_problem + REAL rad,ce(0:NDIM-1) +c variables in 1d axis indexed +c + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1),xhi(0:NDIM-1) +c variables in 2d cell indexed + REAL + & uval(CELL3dVECG(ifirst,ilast,gcw)) + REAL + & l_uval(0:4), + & r_uval(0:4) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,side + REAL xc(0:NDIM-1),x0,x1,x2 + REAL theta,phi,rad2,rad3 +c + +c write(6,*) " dx = ",dx(0),dx(1),dx(2) +c write(6,*) " xlo= ",xlo(0),xlo(1),xlo(2) +c write(6,*) " ce = ",ce(0),ce(1),ce(2)," rad ",rad + do ic2=ifirst2,ilast2 + xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) + x2 = xc(2) - ce(2) + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + x1 = xc(1) - ce(1) + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + x0 = xc(0)-ce(0) + if (x1.eq.zero .and. x0.eq.zero) then + theta = zero + else + theta = atan2(x1,x0) + endif + rad2 = sqrt(x0**2+x1**2) + if (rad2.eq.zero .and. x2.eq.zero) then + phi = zero + else + phi = atan2(rad2,x2) + endif + rad3 = sqrt(rad2**2 + x2**2) + if (rad3.lt.rad) then + side = 0 + else + side = 1 + endif + uval(ic0,ic1,ic2) = l_uval(side) + enddo + enddo + enddo + return + end + +c +c*********************************************************************** +c +c Sine-wave interface +c +c*********************************************************************** + + subroutine linadvinitsine3d(data_problem,dx,xlo, + & domain_xlo, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & gcw0,gcw1,gcw2, + & uval, + & nintervals,front, + & i_uval, + & amplitude,period) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** + +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer gcw0,gcw1,gcw2 + integer data_problem + integer nintervals + REAL front(1:nintervals) + REAL + & dx(0:NDIM-1),xlo(0:NDIM-1), + & domain_xlo(0:NDIM-1) + REAL i_uval(1:nintervals) + REAL amplitude,period(0:NDIM-1) +c variables in 3d cell indexed + REAL + & uval(CELL3dVECG(ifirst,ilast,gcw)) +c +c*********************************************************************** +c + integer ic0,ic1,ic2,j,ifr + REAL xc(0:NDIM-1),xmid(1:10) + REAL coef(0:NDIM-1),coscoef(1:2) +c +c write(6,*) "Inside eulerinitrm" +c write(6,*) "data_problem= ",data_problem +c write(6,*) "dx= ",dx(0), dx(1), dx(2) +c write(6,*) "xlo= ",xlo(0), xlo(1), xlo(2) +c write(6,*) "domain_xlo= ", +c & domain_xlo(0), domain_xlo(1), domain_xlo(2) +c write(6,*) "ifirst = ",ifirst0,ifirst1,ifirst2 +c write(6,*) "ilast = ",ilast0,ilast1,ilast2 +c write(6,*) "front= ",front(1) +c write(6,*) "amplitude= ",amplitude +c write(6,*) "period= ",period(0), +c & period(1),period(2) +c call flush(6) + + if (data_problem.eq.SINE_CONSTANT_Y .or. + & data_problem.eq.SINE_CONSTANT_Z) then + write(6,*) "Sorry, Y and Z directions not implemented :-(" + return + endif + + coef(0) = zero + do j=1,NDIM-1 + coef(j) = two*pi/period(j) + enddo +c + do ic2=ifirst2,ilast2 + xc(2) = xlo(2)+dx(2)*(dble(ic2-ifirst2)+half) + coscoef(2) = amplitude*cos((xc(2)-domain_xlo(2))*coef(2)) + do ic1=ifirst1,ilast1 + xc(1) = xlo(1)+dx(1)*(dble(ic1-ifirst1)+half) + coscoef(1) = + & cos((xc(1)-domain_xlo(1))*coef(1))*coscoef(2) + do j=1,(nintervals-1) + xmid(j) = front(j) + coscoef(1) + enddo + do ic0=ifirst0,ilast0 + xc(0) = xlo(0)+dx(0)*(dble(ic0-ifirst0)+half) + ifr = 1 + do j=1,(nintervals-1) + if( xc(0) .gt. xmid(j) ) ifr = j+1 + enddo + uval(ic0,ic1,ic2) = i_uval(ifr) + enddo + enddo + enddo +c + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux2d.i new file mode 100644 index 00000000..abfa1efe --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux2d.i @@ -0,0 +1,29 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d flux calculation. +c +define(riemann_solve,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt +c write(6,*) " calculating flux$1, 1+extra_cell= ",$3 +c write(6,*) " ic$2=",ifirst$2-1-$3,ilast$2+1+$3 +c write(6,*) " ie$1=",ifirst$1-1-$3,ilast$1+1+1+$3 + do ic$2=ifirst$2-$3,ilast$2+$3 + do ie$1=ifirst$1-$3,ilast$1+1+$3 + + if (advecspeed($1).ge.zero) then + riemst= trlft$1(ie$1,ic$2) + else + riemst= trrgt$1(ie$1,ic$2) + endif + + flux$1(ie$1,ic$2)= dt*riemst*advecspeed($1) +c write(6,*) " flux$1(",ie$1,ic$2,")= ",flux$1(ie$1,ic$2,1), +c & flux$1(ie$1,ic$2,2), +c & flux$1(ie$1,ic$2,3),flux$1(ie$1,ic$2,4) + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux3d.i new file mode 100644 index 00000000..6136784f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4flux3d.i @@ -0,0 +1,58 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d flux calculation. +c +define(riemann_solve,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt + do ic$3=ifirst$3-$6,ilast$3+$6 + do ic$2=ifirst$2-$5,ilast$2+$5 + do ie$1=ifirst$1,ilast$1+1 + + if (advecspeed($1).ge.zero) then + riemst= trlft$1(ie$1,$4) + else + riemst= trrgt$1(ie$1,$4) + endif + flux$1(ie$1,$4)= dt*riemst*advecspeed($1) + + enddo + enddo + enddo +')dnl +define(correc_flux2d,`dnl +c correct the $1-direction with $3-fluxes + do ic$5=ifirst$5-1,ilast$5+1 + do ic$3=ifirst$3,ilast$3 + do ic$1=ifirst$1-1,ilast$1+1 + trnsvers= + & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))*half/dx($3) +c + ttracelft$1(ic$1+1,$2)=tracelft$1(ic$1+1,$2) + & - trnsvers + ttracergt$1(ic$1 ,$2)=tracergt$1(ic$1 ,$2) + & - trnsvers + enddo + enddo + enddo +')dnl +define(correc_flux3d,`dnl +c correct the $1-direction with $2$3-fluxes + do ic$1=ifirst$1-1,ilast$1+1 + do ic$3=ifirst$3,ilast$3 + do ic$2=ifirst$2,ilast$2 + trnsvers=half*( + & (flux$4(ic$2+1,$6)-flux$4(ic$2,$6))/dx($2)+ + & (flux$5(ic$3+1,$7)-flux$5(ic$3,$7))/dx($3)) + + tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) + & - trnsvers + tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) + & - trnsvers + enddo + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4fluxcorner3d.i new file mode 100644 index 00000000..2115d9da --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4fluxcorner3d.i @@ -0,0 +1,91 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d corner flux calculation. +c +define(st_third,`dnl + do ic$3=ifirst$3-1,ilast$3+1 + do ic$2=ifirst$2-1,ilast$2+1 + do ic$1=ifirst$1,ilast$1 + trnsvers= + & (flux$1(ic$1+1,$4)-flux$1(ic$1,$4))/(3*dx($1)) +c + st3(ic0,ic1,ic2)=uval(ic0,ic1,ic2) -trnsvers + enddo + enddo + enddo +')dnl +define(f_third,`dnl +c write(6,*) "checking onedr sol in riemann solve " +c write(6,*) " dt= ",dt + do ic$3=ifirst$3-1,ilast$3+1 + do ic$2=ifirst$2,ilast$2 + do ic$1=ifirst$1,ilast$1+1 + + if (advecspeed($1).ge.zero) then + riemst = st3($5) + else + riemst = st3(ic0,ic1,ic2) + endif + flux$1(ic$1,$4)= dt*riemst*advecspeed($1) + enddo + enddo + enddo +')dnl +define(correc_fluxjt,`dnl +c correct the $2-direction with $3-fluxes + do ic$3=ifirst$3,ilast$3 + do ic$1=ifirst$1,ilast$1 + ic$2=ifirst$2-1 + trnsvers=half* + & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) + + tracelft$2(ic$2+1,ic$1,ic$3)=tracelft$2(ic$2+1,ic$1,ic$3) + & - trnsvers + do ic$2=ifirst$2,ilast$2 + trnsvers=half* + & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) + + tracelft$2(ic$2+1,ic$1,ic$3)=tracelft$2(ic$2+1,ic$1,ic$3) + & - trnsvers + tracergt$2(ic$2 ,ic$1,ic$3)=tracergt$2(ic$2 ,ic$1,ic$3) + & - trnsvers + enddo + ic$2=ilast$2+1 + trnsvers=half* + & (flux$3(ic$3+1,$4)-flux$3(ic$3,$4))/dx($3) + + tracergt$2(ic$2 ,ic$1,ic$3)=tracergt$2(ic$2 ,ic$1,ic$3) + & - trnsvers + enddo + enddo +c +c correct the $3-direction with $2-fluxes + do ic$1=ifirst$1,ilast$1 + do ic$2=ifirst$2,ilast$2 + ic$3=ifirst$3-1 + trnsvers=half* + & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) + + tracelft$3(ic$3+1,ic$2,ic$1)=tracelft$3(ic$3+1,ic$2,ic$1) + & - trnsvers + do ic$3=ifirst$3,ilast$3 + trnsvers=half* + & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) + + tracelft$3(ic$3+1,ic$2,ic$1)=tracelft$3(ic$3+1,ic$2,ic$1) + & - trnsvers + tracergt$3(ic$3 ,ic$2,ic$1)=tracergt$3(ic$3 ,ic$2,ic$1) + & - trnsvers + enddo + ic$3=ilast$3+1 + trnsvers=half* + & (flux$2(ic$2+1,$5)-flux$2(ic$2,$5))/dx($2) + + tracergt$3(ic$3 ,ic$2,ic$1)=tracergt$3(ic$3 ,ic$2,ic$1) + & - trnsvers + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace2d.i new file mode 100644 index 00000000..082f7c22 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace2d.i @@ -0,0 +1,40 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d trace calculation. +c +define(trace_init,`dnl + do ic$2=ifirst$2-FACEG,ilast$2+FACEG + ie$1=ifirst$1-FACEG + tracergt$1(ie$1,ic$2)=uval($5) + tracelft$1(ie$1,ic$2)=uval($5) + + do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG + tracelft$1(ie$1,ic$2)=uval($4) + tracergt$1(ie$1,ic$2)=uval($5) + enddo + + ie$1=ilast$1+FACEG+1 + tracelft$1(ie$1,ic$2)=uval($4) + tracergt$1(ie$1,ic$2)=uval($4) + enddo +')dnl +define(trace_call,`dnl + do ic$2=ifirst$2-2,ilast$2+2 + do ic$1=ifirst$1-FACEG,ilast$1+FACEG + ttraclft(ic$1) = tracelft(ic$1,ic$2) + ttracrgt(ic$1) = tracergt(ic$1,ic$2) + enddo + + call trace(dt,ifirst$1,ilast$1,mc, + & dx,idir,advecspeed,igdnv, + & ttraclft,ttracrgt, + & ttcelslp,ttedgslp) + do ic$1=ifirst$1-FACEG,ilast$1+FACEG + tracelft(ic$1,ic$2) = ttraclft(ic$1) + tracergt(ic$1,ic$2) = ttracrgt(ic$1) + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace3d.i new file mode 100644 index 00000000..6b2a6ba4 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/m4trace3d.i @@ -0,0 +1,46 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d trace calculation. +c +define(trace_init,`dnl + do ic$3=ifirst$3-FACEG,ilast$3+FACEG + do ic$2=ifirst$2-FACEG,ilast$2+FACEG + ie$1=ifirst$1-FACEG + tracergt$1(ie$1,ic$2,ic$3)=uval($5) + tracelft$1(ie$1,ic$2,ic$3)=uval($5) + + do ie$1=ifirst$1+1-FACEG,ilast$1+FACEG + tracelft$1(ie$1,ic$2,ic$3)=uval($4) + tracergt$1(ie$1,ic$2,ic$3)=uval($5) + enddo + + ie$1=ilast$1+FACEG+1 + tracelft$1(ie$1,ic$2,ic$3)=uval($4) + tracergt$1(ie$1,ic$2,ic$3)=uval($4) + enddo + enddo + + +')dnl +define(trace_call,`dnl + do ic$3=ifirst$3-2,ilast$3+2 + do ic$2=ifirst$2-2,ilast$2+2 + do ic$1=ifirst$1-FACEG,ilast$1+FACEG + ttraclft(ic$1) = tracelft(ic$1,ic$2,ic$3) + ttracrgt(ic$1) = tracergt(ic$1,ic$2,ic$3) + enddo + + call trace(dt,ifirst$1,ilast$1,mc, + & dx,idir,advecspeed,igdnv, + & ttraclft,ttracrgt, + & ttcelslp,ttedgslp) + do ic$1=ifirst$1-FACEG,ilast$1+FACEG + tracelft(ic$1,ic$2,ic$3) = ttraclft(ic$1) + tracergt(ic$1,ic$2,ic$3) = ttracrgt(ic$1) + enddo + enddo + enddo +')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/probparams.i b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/probparams.i index 1b46a43e..b43283f0 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/probparams.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/probparams.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining common block. +c common/probparams/ & PIECEWISE_CONSTANT_X,PIECEWISE_CONSTANT_Y,PIECEWISE_CONSTANT_Z, & SINE_CONSTANT_X,SINE_CONSTANT_Y,SINE_CONSTANT_Z,SPHERE, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable2d.m4 new file mode 100644 index 00000000..a7cdf83a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable2d.m4 @@ -0,0 +1,51 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to evaluate stable dt in 2d. +c +define(NDIM,2)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl + + subroutine stabledt2d(dx, + & ifirst0,ilast0,ifirst1,ilast1, + & ngc0,ngc1, + & advecspeed,uval,stabdt) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL stabdt,dx(0:NDIM-1) + integer ifirst0,ilast0,ifirst1,ilast1,ngc0,ngc1 +c + REAL + & advecspeed(0:NDIM-1), + & uval(CELL2dVECG(ifirst,ilast,ngc)) +c + REAL maxspeed(0:NDIM-1) +c + maxspeed(0)=zero + maxspeed(1)=zero + + maxspeed(0) = max(maxspeed(0), abs(advecspeed(0))) + maxspeed(1) = max(maxspeed(1), abs(advecspeed(1))) + +c Do the following with checks for zero +c stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) + + if ( maxspeed(0) .EQ. 0.0 ) then + if( maxspeed(1) .EQ. 0.0 ) then + stabdt = 1.0E9 + else + stabdt = dx(1)/maxspeed(1) + endif + elseif ( maxspeed(1) .EQ. 0.0 ) then + stabdt = dx(0)/maxspeed(0) + else + stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) + endif + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable3d.m4 new file mode 100644 index 00000000..4b8c1381 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stable3d.m4 @@ -0,0 +1,59 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine to compute stable dt in 3d. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl + + subroutine stabledt3d(dx, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ngc0,ngc1,ngc2, + & advecspeed,uval,stabdt) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL stabdt,dx(0:NDIM-1) + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ngc0,ngc1,ngc2 +c + REAL + & advecspeed(0:NDIM-1), + & uval(CELL3dVECG(ifirst,ilast,ngc)) +c + REAL maxspeed(0:NDIM-1) +c + maxspeed(0)=zero + maxspeed(1)=zero + maxspeed(2)=zero + + maxspeed(0) = max(maxspeed(0), abs(advecspeed(0))) + maxspeed(1) = max(maxspeed(1), abs(advecspeed(1))) + maxspeed(2) = max(maxspeed(2), abs(advecspeed(2))) + +c Do the following with checks for zero +c stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) +c stabdt = min((dx(2)/maxspeed(2)),stabdt) + + if ( maxspeed(0) .EQ. 0.0 ) then + if( maxspeed(1) .EQ. 0.0 ) then + stabdt = 1.0E9 + else + stabdt = dx(1)/maxspeed(1) + endif + elseif ( maxspeed(1) .EQ. 0.0 ) then + stabdt = dx(0)/maxspeed(0) + else + stabdt = min((dx(1)/maxspeed(1)),(dx(0)/maxspeed(0))) + endif + + if (maxspeed(2) .NE. 0.0 ) then + stabdt = min((dx(2)/maxspeed(2)),stabdt) + endif + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stufprobc2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc2d.m4 similarity index 79% rename from base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stufprobc2d.m4 rename to base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc2d.m4 index d3f7f1d8..89023f10 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/2d/stufprobc2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc2d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine in 2d. +c subroutine stufprobc2d( & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, & PIECEWISE_CONSTANT_Zin, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stufprobc3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc3d.m4 similarity index 79% rename from base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stufprobc3d.m4 rename to base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc3d.m4 index 9bd17274..4abe47ba 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/3d/stufprobc3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/stufprobc3d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine in 3d. +c subroutine stufprobc3d( & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, & PIECEWISE_CONSTANT_Zin, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d2d.m4 new file mode 100644 index 00000000..411750ce --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d2d.m4 @@ -0,0 +1,101 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 2d. +c +define(NEQU,1)dnl +define(REAL,`double precision')dnl + + subroutine trace(dt,ifirst,ilast,mc, + & dx,dir,advecspeed,igdnv, + & tracelft,tracergt, + & celslope,edgslope) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/probparams.i)dnl +include(FORTDIR/const.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL dt + integer ifirst,ilast,mc,dir,igdnv + REAL dx,advecspeed +c + REAL + & celslope(ifirst-CELLG:ifirst+mc-1+CELLG), +c side variables + & tracelft(ifirst-FACEG:ifirst+mc+FACEG), + & tracergt(ifirst-FACEG:ifirst+mc+FACEG), + & edgslope(ifirst-FACEG:ifirst+mc+FACEG) +c + integer ie,ic + REAL bound,coef4,slope2,dtdx,slope4 + REAL du,nu +c +c*********************************************************************** +c ****************************************************************** +c * check for inflection points in characteristic speeds +c * compute slopes at cell edges +c * zero slopes if neighboring cells have different loading +c ****************************************************************** + do ie=ifirst+1-FACEG,ilast+FACEG + edgslope(ie)=tracergt(ie)-tracelft(ie) + enddo +c ****************************************************************** +c * limit slopes +c ****************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + celslope(ic)=zero + enddo + if (igdnv.eq.2) then +c write(6,*) "second-order slopes" +c **************************************************************** +c * second-order slopes +c **************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + slope2=half*(edgslope(ic)+edgslope(ic+1)) + celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) + if (edgslope(ic)*edgslope(ic+1).le.zero) then + celslope(ic)=zero + else + bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) + celslope(ic)=sign(min(two*bound,abs(slope2)),slope2) + endif +c write(6,*) "ic,celslope= ", ic,celslope(ic) +c call flush(6) + enddo + else if (igdnv.eq.4) then +c write(6,*) "fourth-order slopes" +c **************************************************************** +c * fourth-order slopes +c **************************************************************** + do ic=ifirst+2-CELLG,ilast+CELLG-2 + slope4=fourth*(tracergt(ic+2)-tracergt(ic-2)) + celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) + coef4=third*(four*celslope(ic)-slope4) + if (edgslope(ic)*edgslope(ic+1).le.zero .or. + & coef4*celslope(ic).lt.zero) then + celslope(ic)=zero + else + bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) + celslope(ic)=sign(min(two*bound,abs(coef4)),coef4) + endif + enddo + endif +c ****************************************************************** +c * characteristic projection +c ****************************************************************** + dtdx=dt/dx + nu = advecspeed*dtdx + do ic=ifirst-1,ilast+1 + du = celslope(ic) + if (nu.gt.0) then + tracelft(ic+1) = tracelft(ic+1) + half*(one -nu)*du + tracergt(ic) = tracergt(ic) + else + tracelft(ic+1) = tracelft(ic+1) + tracergt(ic) = tracergt(ic) -half*(one + nu)*du + endif + enddo + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d3d.m4 new file mode 100644 index 00000000..229d9ad6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace1d3d.m4 @@ -0,0 +1,101 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 3d. +c +define(NEQU,1)dnl +define(REAL,`double precision')dnl + + subroutine trace3d(dt,ifirst,ilast,mc, + & dx,dir,advecspeed,igdnv, + & tracelft,tracergt, + & celslope,edgslope) +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + REAL dt + integer ifirst,ilast,mc,dir,igdnv + REAL dx,advecspeed +c + REAL + & celslope(ifirst-CELLG:ifirst+mc-1+CELLG), +c side variables + & tracelft(ifirst-FACEG:ifirst+mc+FACEG), + & tracergt(ifirst-FACEG:ifirst+mc+FACEG), + & edgslope(ifirst-FACEG:ifirst+mc+FACEG) +c + integer ie,ic + REAL bound,coef4,slope2,dtdx,slope4 + REAL du,nu +c +c*********************************************************************** +c ****************************************************************** +c * check for inflection points in characteristic speeds +c * compute slopes at cell edges +c * zero slopes if neighboring cells have different loading +c ****************************************************************** + do ie=ifirst+1-FACEG,ilast+FACEG + edgslope(ie)=tracergt(ie)-tracelft(ie) + enddo +c ****************************************************************** +c * limit slopes +c ****************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + celslope(ic)=zero + enddo + if (igdnv.eq.2) then +c write(6,*) "second-order slopes" +c **************************************************************** +c * second-order slopes +c **************************************************************** + do ic=ifirst+1-CELLG,ilast+CELLG-1 + slope2=half*(edgslope(ic)+edgslope(ic+1)) + celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) + if (edgslope(ic)*edgslope(ic+1).le.zero) then + celslope(ic)=zero + else + bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) + celslope(ic)=sign(min(two*bound,abs(slope2)),slope2) + endif +c write(6,*) "ic,celslope= ", ic,celslope(ic) +c call flush(6) + enddo + else if (igdnv.eq.4) then +c write(6,*) "fourth-order slopes" +c **************************************************************** +c * fourth-order slopes +c **************************************************************** + do ic=ifirst+2-CELLG,ilast+CELLG-2 + slope4=fourth*(tracergt(ic+2)-tracergt(ic-2)) + celslope(ic)=half*(edgslope(ic)+edgslope(ic+1)) + coef4=third*(four*celslope(ic)-slope4) + if (edgslope(ic)*edgslope(ic+1).le.zero .or. + & coef4*celslope(ic).lt.zero) then + celslope(ic)=zero + else + bound=min(abs(edgslope(ic)),abs(edgslope(ic+1))) + celslope(ic)=sign(min(two*bound,abs(coef4)),coef4) + endif + enddo + endif +c ****************************************************************** +c * characteristic projection +c ****************************************************************** + dtdx=dt/dx + nu = advecspeed*dtdx + do ic=ifirst-1,ilast+1 + du = celslope(ic) + if (nu.gt.0) then + tracelft(ic+1) = tracelft(ic+1) + half*(one -nu)*du + tracergt(ic) = tracergt(ic) + else + tracelft(ic+1) = tracelft(ic+1) + tracergt(ic) = tracergt(ic) -half*(one + nu)*du + endif + enddo + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace2d.m4 new file mode 100644 index 00000000..63869563 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace2d.m4 @@ -0,0 +1,165 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace in 2d. +c +define(NDIM,2)dnl +define(NEQU,4)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +include(FORTDIR/m4trace2d.i)dnl + + subroutine inittraceflux2d( + & ifirst0,ilast0,ifirst1,ilast1, + & uval, + & tracelft0,tracelft1, + & tracergt0,tracergt1, + & fluxriem0,fluxriem1) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + REAL + & uval(CELL2d(ifirst,ilast,CELLG)), + & fluxriem0(FACE2d0(ifirst,ilast,FLUXG)), + & tracelft0(FACE2d0(ifirst,ilast,FACEG)), + & tracergt0(FACE2d0(ifirst,ilast,FACEG)), + & fluxriem1(FACE2d1(ifirst,ilast,FLUXG)), + & tracelft1(FACE2d1(ifirst,ilast,FACEG)), + & tracergt1(FACE2d1(ifirst,ilast,FACEG)) +c*********************************************************************** +c initialize left and right states at cell edges +c (first-order upwind) +c*********************************************************************** +c + integer ic0,ic1,ie0,ie1 +c*********************************************************************** + +trace_init(0,1,2,`ie0-1,ic1',`ie0,ic1')dnl + +trace_init(1,0,2,`ic0,ie1-1',`ic0,ie1')dnl + +c +c we initialize the flux to be zero + + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 + fluxriem0(ie0,ic1) = zero + enddo + enddo +c + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 + fluxriem1(ie1,ic0) = zero + enddo + enddo +c +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing2d0(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & mc, + & dx, + & advecspeed,igdnv, + & uval, + & tracelft,tracergt, + & ttcelslp,ttedgslp, + & ttraclft,ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx,advecspeed +c variables in 2d axis indexed + REAL + & uval(CELL2d(ifirst,ilast,CELLG)), + & tracelft(FACE2d0(ifirst,ilast,FACEG)), + & tracergt(FACE2d0(ifirst,ilast,FACEG)) +c side variables ifirst0 to ifirst0+mc plus ghost cells + REAL + & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG), + & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG), + & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG) +c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG) +c*********************************************************************** +c + integer ic0,ic1,idir +c*********************************************************************** +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 0 +trace_call(0,1)dnl +c*********************************************************************** + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing2d1(dt, + & ifirst0,ilast0,ifirst1,ilast1, + & mc, + & dx, + & advecspeed,igdnv, + & uval, + & tracelft,tracergt, + & ttcelslp,ttedgslp, + & ttraclft,ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx,advecspeed +c variables in 2d axis indexed + REAL + & uval(CELL2d(ifirst,ilast,CELLG)), + & tracelft(FACE2d1(ifirst,ilast,FACEG)), + & tracergt(FACE2d1(ifirst,ilast,FACEG)) +c side variables ifirst1 to ifirst1+mc plus ghost cells + REAL + & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG), + & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG), + & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG) +c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG) +c*********************************************************************** +c + integer ic0,ic1,idir +c*********************************************************************** +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 1 +trace_call(1,0)dnl +c*********************************************************************** + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace3d.m4 new file mode 100644 index 00000000..7162f578 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/fortran/trace3d.m4 @@ -0,0 +1,225 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for trace in 3d. +c +define(NDIM,3)dnl +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +include(FORTDIR/m4trace3d.i)dnl + + subroutine inittraceflux3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & uval, + & tracelft0,tracelft1,tracelft2, + & tracergt0,tracergt1,tracergt2, + & fluxriem0,fluxriem1,fluxriem2) +c*********************************************************************** + implicit none +include(FORTDIR/const.i)dnl +include(FORTDIR/probparams.i)dnl +c*********************************************************************** +c*********************************************************************** +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + REAL + & uval(CELL3d(ifirst,ilast,CELLG)), + & fluxriem0(FACE3d0(ifirst,ilast,FLUXG)), + & tracelft0(FACE3d0(ifirst,ilast,FACEG)), + & tracergt0(FACE3d0(ifirst,ilast,FACEG)), + & fluxriem1(FACE3d1(ifirst,ilast,FLUXG)), + & tracelft1(FACE3d1(ifirst,ilast,FACEG)), + & tracergt1(FACE3d1(ifirst,ilast,FACEG)), + & fluxriem2(FACE3d2(ifirst,ilast,FLUXG)), + & tracelft2(FACE3d2(ifirst,ilast,FACEG)), + & tracergt2(FACE3d2(ifirst,ilast,FACEG)) +c*********************************************************************** +c initialize left and right states at cell edges +c (first-order upwind) +c*********************************************************************** +c + integer ic0,ic1,ie0,ie1,ic2,ie2 +c*********************************************************************** + +trace_init(0,1,2,`ie0-1,ic1,ic2',`ie0,ic1,ic2')dnl + +trace_init(1,2,0,`ic0,ie1-1,ic2',`ic0,ie1,ic2')dnl + +trace_init(2,0,1,`ic0,ic1,ie2-1',`ic0,ic1,ie2')dnl + +c +c we initialize the flux to be zero + + do ic2=ifirst2-FLUXG,ilast2+FLUXG + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ie0=ifirst0-FLUXG,ilast0+FLUXG+1 + fluxriem0(ie0,ic1,ic2) = zero + enddo + enddo + enddo +c + do ic2=ifirst2-FLUXG,ilast2+FLUXG + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie1=ifirst1-FLUXG,ilast1+FLUXG+1 + fluxriem1(ie1,ic2,ic0) = zero + enddo + enddo + enddo +c + do ic1=ifirst1-FLUXG,ilast1+FLUXG + do ic0=ifirst0-FLUXG,ilast0+FLUXG + do ie2=ifirst2-FLUXG,ilast2+FLUXG+1 + fluxriem2(ie2,ic0,ic1) = zero + enddo + enddo + enddo +c +c call flush(6) + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** +c + subroutine chartracing3d0(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc, + & dx, + & advecspeed,igdnv, + & uval, + & tracelft,tracergt, + & ttcelslp,ttedgslp, + & ttraclft,ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl + +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx,advecspeed +c variables in 2d axis indexed + REAL + & uval(CELL3d(ifirst,ilast,CELLG)), + & tracelft(FACE3d0(ifirst,ilast,FACEG)), + & tracergt(FACE3d0(ifirst,ilast,FACEG)) +c side variables ifirst0 to ifirst0+mc plus ghost cells + REAL + & ttedgslp(ifirst0-FACEG:ifirst0+mc+FACEG), + & ttraclft(ifirst0-FACEG:ifirst0+mc+FACEG), + & ttracrgt(ifirst0-FACEG:ifirst0+mc+FACEG) +c cell variables ifirst0 to ifirst0+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst0-CELLG:ifirst0+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 0 +trace_call(0,1,2)dnl +c*********************************************************************** + return + end +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing3d1(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc, + & dx, + & advecspeed,igdnv, + & uval, + & tracelft,tracergt, + & ttcelslp,ttedgslp, + & ttraclft,ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl + +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx,advecspeed +c variables in 2d axis indexed + REAL + & uval(CELL3d(ifirst,ilast,CELLG)), + & tracelft(FACE3d1(ifirst,ilast,FACEG)), + & tracergt(FACE3d1(ifirst,ilast,FACEG)) + REAL + & ttedgslp(ifirst1-FACEG:ifirst1+mc+FACEG), + & ttraclft(ifirst1-FACEG:ifirst1+mc+FACEG), + & ttracrgt(ifirst1-FACEG:ifirst1+mc+FACEG) +c cell variables ifirst1 to ifirst1+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst1-CELLG:ifirst1+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 1 +trace_call(1,2,0)dnl +c*********************************************************************** + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + subroutine chartracing3d2(dt, + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & mc, + & dx, + & advecspeed,igdnv, + & uval, + & tracelft,tracergt, + & ttcelslp,ttedgslp, + & ttraclft,ttracrgt) +c*********************************************************************** + implicit none +include(FORTDIR/probparams.i)dnl + +c input arrays: + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer mc,igdnv + REAL dt +c variables in 1d axis indexed + REAL + & dx,advecspeed +c variables in 2d axis indexed + REAL + & uval(CELL3d(ifirst,ilast,CELLG)), + & tracelft(FACE3d2(ifirst,ilast,FACEG)), + & tracergt(FACE3d2(ifirst,ilast,FACEG)) + REAL + & ttedgslp(ifirst2-FACEG:ifirst2+mc+FACEG), + & ttraclft(ifirst2-FACEG:ifirst2+mc+FACEG), + & ttracrgt(ifirst2-FACEG:ifirst2+mc+FACEG) +c cell variables ifirst2 to ifirst2+mc-1 plus ghost cells + REAL + & ttcelslp(ifirst2-CELLG:ifirst2+mc-1+CELLG) +c*********************************************************************** + integer ic0,ic1,ic2,idir +c*********************************************************************** +c trace higher order states at cell edges +c*********************************************************************** + idir = 2 +trace_call(2,0,1)dnl +c*********************************************************************** + return + end +c +c*********************************************************************** +c*********************************************************************** +c*********************************************************************** + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/main.C b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/main.C index 6583c4c7..75797779 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/main.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for SAMRAI Linear Advection example problem. * ************************************************************************/ @@ -25,6 +25,7 @@ using namespace std; // Headers for basic SAMRAI objects #include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" @@ -39,11 +40,13 @@ using namespace std; // Headers for major algorithm/data structure objects #include "SAMRAI/mesh/BergerRigoutsos.h" +#include "SAMRAI/mesh/TileClustering.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/algs/HyperbolicLevelIntegrator.h" #include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/CascadePartitioner.h" #include "SAMRAI/hier/PatchHierarchy.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" #include "SAMRAI/algs/TimeRefinementIntegrator.h" @@ -56,15 +59,11 @@ using namespace std; // Header for application-specific algorithm/data structure object #include "LinAdv.h" -#include "SinusoidalFrontTagger.h" +#include "test/testlib/SinusoidalFrontGenerator.h" +#include "test/testlib/SphericalShellGenerator.h" +#include "test/testlib/MeshGenerationStrategy.h" -// Classes for run-time plotting and autotesting. - -#if (TESTING == 1) -#include "AutoTester.h" -#endif - -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -187,11 +186,8 @@ int main( { string input_filename; - string restart_read_dirname; - int restore_num = 0; string case_name; - - bool is_from_restart = false; + int scale_size = mpi.getSize(); if ((argc != 2) && (argc != 3) && (argc != 4)) { tbox::pout << "USAGE:\n" @@ -199,30 +195,23 @@ int main( << "or\n" << argv[0] << " " << "or\n" - << argv[0] << " " - << " [options]\n" - << " options:\n" - << " none at this time" + << argv[0] << " " << endl; tbox::SAMRAI_MPI::abort(); return -1; } else { input_filename = argv[1]; - - if (argc == 3) { + if (argc > 2) { case_name = argv[2]; } - if (argc == 4) { - restart_read_dirname = argv[2]; - restore_num = atoi(argv[3]); - - is_from_restart = true; + if (argc > 3) { + scale_size = atoi(argv[3]); } } pout << "input_filename = " << input_filename << endl; - pout << "restart_read_dirname = " << restart_read_dirname << endl; - pout << "restore_num = " << restore_num << endl; + pout << "case_name = " << case_name << std::endl; + pout << "scale_size = " << scale_size << std::endl; /* * Create input database and parse all data in input file. @@ -231,9 +220,10 @@ int main( boost::shared_ptr input_db(new InputDatabase("input_db")); InputManager::getManager()->parseInputFile(input_filename, input_db); - if (input_db->isDatabase("TimerManager")) { - tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); - } + tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); + boost::shared_ptr t_all = + tbox::TimerManager::getManager()->getTimer("appu::main::all"); + t_all->start(); boost::shared_ptr t_vis_writing( tbox::TimerManager::getManager()->getTimer("apps::Main::vis_writing")); @@ -255,10 +245,8 @@ int main( string scaled_input_str = string("ScaledInput") - + (use_scaled_input ? tbox::Utilities::intToString(mpi.getSize()) - : string()); - boost::shared_ptr scaled_input_db( - input_db->getDatabase(scaled_input_str)); + + (use_scaled_input ? tbox::Utilities::intToString(scale_size) : string()); + boost::shared_ptr scaled_input_db(input_db->getDatabase(scaled_input_str)); string base_name = main_db->getStringWithDefault("base_name", "unnamed"); @@ -266,19 +254,21 @@ int main( * Modify basename for this particular run. * Add the number of processes and the case name. */ + string base_name_ext = base_name; if (!case_name.empty()) { - base_name = base_name + '-' + case_name; + base_name_ext = base_name_ext + '-' + case_name; } - base_name = base_name + '-' + tbox::Utilities::intToString( - mpi.getSize(), - 5); + base_name_ext = base_name_ext + '-' + tbox::Utilities::nodeToString(scale_size); + tbox::pout << "Added case name (" << case_name << ") and nprocs (" + << mpi.getSize() << ") to base name -> '" + << base_name_ext << "'\n"; /* * Logging. */ - string log_filename = base_name + ".log"; + string log_filename = base_name_ext + ".log"; log_filename = - main_db->getStringWithDefault("log_filename", base_name + ".log"); + main_db->getStringWithDefault("log_filename", base_name_ext + ".log"); bool log_all_nodes = false; log_all_nodes = @@ -294,9 +284,8 @@ int main( viz_dump_interval = main_db->getInteger("viz_dump_interval"); } - Array viz_writer(1); const string viz_dump_dirname = main_db->getStringWithDefault( - "viz_dump_dirname", base_name + ".visit"); + "viz_dump_dirname", base_name_ext + ".visit"); int visit_number_procs_per_file = 1; const bool viz_dump_data = (viz_dump_interval > 0); @@ -324,33 +313,9 @@ int main( } } -#if (TESTING == 1) && !(HAVE_HDF5) - /* - * If we are autotesting on a system w/o HDF5, the read from - * restart will result in an error. We want this to happen - * for users, so they know there is a problem with the restart, - * but we don't want it to happen when autotesting. - */ - is_from_restart = false; - restart_interval = 0; -#endif - const bool write_restart = (restart_interval > 0) && !(restart_write_dirname.empty()); - /* - * Get the restart manager and root restart database. If run is from - * restart, open the restart file. - */ - - RestartManager* restart_manager = RestartManager::getManager(); - - if (is_from_restart) { - restart_manager-> - openRestartFile(restart_read_dirname, restore_num, - mpi.getSize()); - } - /* * Create major algorithm and data objects which comprise application. * Each object will be initialized either from input data or restart @@ -370,22 +335,32 @@ int main( grid_geometry, input_db->getDatabase("PatchHierarchy"))); - const bool use_analytical_tagger = - input_db->isDatabase("SinusoidalFrontTagger"); - - SinusoidalFrontTagger analytical_tagger( - "SinusoidalFrontTagger", - dim, - input_db->getDatabaseWithDefault("SinusoidalFrontTagger", - boost::shared_ptr()).get()); - analytical_tagger.resetHierarchyConfiguration(patch_hierarchy, 0, 3); + boost::shared_ptr sine_wall; + boost::shared_ptr spherical_shell; + boost::shared_ptr mesh_gen; + + if (input_db->isDatabase("SinusoidalFrontGenerator")) { + sine_wall.reset(new SinusoidalFrontGenerator( + "SinusoidalFrontGenerator", dim, + input_db->getDatabase("SinusoidalFrontGenerator"))); + sine_wall->resetHierarchyConfiguration( + patch_hierarchy, 0, patch_hierarchy->getMaxNumberOfLevels() - 1); + mesh_gen = sine_wall; + } else if (input_db->isDatabase("SphericalShellGenerator")) { + spherical_shell.reset(new SphericalShellGenerator( + "SphericalShellGenerator", dim, + input_db->getDatabase("SphericalShellGenerator"))); + spherical_shell->resetHierarchyConfiguration( + patch_hierarchy, 0, patch_hierarchy->getMaxNumberOfLevels() - 1); + mesh_gen = spherical_shell; + } LinAdv* linear_advection_model = new LinAdv( "LinAdv", dim, input_db->getDatabase("LinAdv"), grid_geometry, - use_analytical_tagger ? &analytical_tagger : NULL); + mesh_gen); boost::shared_ptr hli_db( scaled_input_db->isDatabase("HyperbolicLevelIntegrator") ? @@ -395,20 +370,38 @@ int main( new algs::HyperbolicLevelIntegrator( "HyperbolicLevelIntegrator", hli_db, - linear_advection_model, true, use_refined_timestepping)); + linear_advection_model, use_refined_timestepping)); boost::shared_ptr error_detector( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", - hyp_level_integrator.get(), + hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); - boost::shared_ptr abr_db( - input_db->getDatabase("BergerRigoutsos")); - boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim, abr_db)); + // Set up the clustering. + + const std::string clustering_type = + main_db->getStringWithDefault("clustering_type", "BergerRigoutsos"); + + boost::shared_ptr box_generator; + + if (clustering_type == "BergerRigoutsos") { + + boost::shared_ptr abr_db( + input_db->getDatabase("BergerRigoutsos")); + boost::shared_ptr berger_rigoutsos( + new mesh::BergerRigoutsos(dim, abr_db)); + box_generator = berger_rigoutsos; + } else if (clustering_type == "TileClustering") { + + boost::shared_ptr tc_db( + input_db->getDatabase("TileClustering")); + boost::shared_ptr tile_clustering( + new mesh::TileClustering(dim, tc_db)); + box_generator = tile_clustering; + + } // Set up the load balancer. @@ -418,26 +411,45 @@ int main( const std::string load_balancer_type = main_db->getStringWithDefault("load_balancer_type", "TreeLoadBalancer"); - if ( load_balancer_type == "TreeLoadBalancer" ) { + if (load_balancer_type == "TreeLoadBalancer") { boost::shared_ptr tree_load_balancer( new mesh::TreeLoadBalancer( dim, "mesh::TreeLoadBalancer", - input_db->getDatabase("TreeLoadBalancer"))); + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new BalancedDepthFirstTree))); tree_load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); boost::shared_ptr tree_load_balancer0( new mesh::TreeLoadBalancer( dim, "mesh::TreeLoadBalancer0", - input_db->getDatabase("TreeLoadBalancer"))); + input_db->getDatabase("TreeLoadBalancer"), + boost::shared_ptr(new BalancedDepthFirstTree))); tree_load_balancer0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); load_balancer = tree_load_balancer; load_balancer0 = tree_load_balancer0; - } - else if ( load_balancer_type == "ChopAndPackLoadBalancer" ) { + } else if (load_balancer_type == "CascadePartitioner") { + + boost::shared_ptr cascade_partitioner( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + boost::shared_ptr cascade_partitioner0( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner0", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + load_balancer = cascade_partitioner; + load_balancer0 = cascade_partitioner0; + } else if (load_balancer_type == "ChopAndPackLoadBalancer") { boost::shared_ptr cap_load_balancer( new mesh::ChopAndPackLoadBalancer( @@ -446,9 +458,19 @@ int main( input_db->getDatabase("ChopAndPackLoadBalancer"))); load_balancer = cap_load_balancer; - load_balancer0 = cap_load_balancer; - } + /* + * ChopAndPackLoadBalancer has trouble on L0 for some reason. + * Work around by using the CascadePartitioner for L0. + */ + boost::shared_ptr cascade_partitioner0( + new mesh::CascadePartitioner( + dim, + "mesh::CascadePartitioner0", + input_db->getDatabase("CascadePartitioner"))); + cascade_partitioner0->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + load_balancer0 = cascade_partitioner0; + } boost::shared_ptr gridding_algorithm( new mesh::GriddingAlgorithm( @@ -468,7 +490,15 @@ int main( hyp_level_integrator, gridding_algorithm)); - // VisitDataWriter is only present if HDF is available + /* + * Initialize hierarchy configuration and data on all patches. + * Then, close restart file and write initial state for visualization. + */ + + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); // For timing. + double dt_now = time_integrator->initializeHierarchy(); + + // VisItDataWriter is only present if HDF is available #ifdef HAVE_HDF5 boost::shared_ptr visit_data_writer( new appu::VisItDataWriter( @@ -480,25 +510,8 @@ int main( registerVisItDataWriter(visit_data_writer); #endif - /* - * Initialize hierarchy configuration and data on all patches. - * Then, close restart file and write initial state for visualization. - */ - - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); // For timing. - double dt_now = time_integrator->initializeHierarchy(); - RestartManager::getManager()->closeRestartFile(); -#if (TESTING == 1) - /* - * Create the autotesting object which will verify correctness - * of the problem. If no automated testing is done, the object does - * not get used. - */ - AutoTester autotester("AutoTester", input_db); -#endif - /* * After creating all objects and initializing their state, we * print the input database and variable database contents @@ -537,17 +550,6 @@ int main( int iteration_num = time_integrator->getIntegratorStep(); -#if (TESTING == 1) - /* - * If we are doing autotests, check result... - */ - num_failures += autotester.evalTestData(iteration_num, - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); -#endif - while ((loop_time < loop_time_end) && time_integrator->stepsRemaining()) { @@ -605,44 +607,44 @@ int main( } } -#if (TESTING == 1) +#ifdef RECORD_STATS /* - * If we are doing autotests, check result... + * Output statistics. */ - num_failures += autotester.evalTestData(iteration_num, - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); + tbox::plog << "HyperbolicLevelIntegrator statistics:" << endl; + hyp_level_integrator->printStatistics(tbox::plog); + tbox::plog << "\nGriddingAlgorithm statistics:" << endl; + gridding_algorithm->printStatistics(tbox::plog); #endif - - } + } // End time-stepping loop. /* * Output timer results. */ tbox::TimerManager::getManager()->print(tbox::plog); -#ifdef RECORD_STATS - /* - * Output statistics. - */ - tbox::plog << "HyperbolicLevelIntegrator statistics:" << endl; - hyp_level_integrator->printStatistics(tbox::plog); - tbox::plog << "\nGriddingAlgorithm statistics:" << endl; - gridding_algorithm->printStatistics(tbox::plog); -#endif - - if ( load_balancer_type == "TreeLoadBalancer" ) { + if (load_balancer_type == "TreeLoadBalancer") { /* * Output load balancing results for TreeLoadBalancer. */ boost::shared_ptr tree_load_balancer( - boost::dynamic_pointer_cast(load_balancer)); + BOOST_CAST( + load_balancer)); + TBOX_ASSERT(tree_load_balancer); tbox::plog << "\n\nLoad balancing results:\n"; tree_load_balancer->printStatistics(tbox::plog); } + if (load_balancer_type == "CascadePartitioner") { + /* + * Output load balancing results for CascadePartitioner. + */ + boost::shared_ptr cascade_partitioner( + BOOST_CAST( + load_balancer)); + TBOX_ASSERT(cascade_partitioner); + tbox::plog << "\n\nLoad balancing results:\n"; + cascade_partitioner->printStatistics(tbox::plog); + } /* * Output box search results. @@ -650,6 +652,16 @@ int main( tbox::plog << "\n\nBox searching results:\n"; hier::BoxTree::printStatistics(dim); + t_all->stop(); + int size = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + if (tbox::SAMRAI_MPI::getSAMRAIWorld().getRank() == 0) { + string timing_file = + base_name + ".timing" + tbox::Utilities::intToString(size); + FILE* fp = fopen(timing_file.c_str(), "w"); + fprintf(fp, "%f\n", t_all->getTotalWallclockTime()); + fclose(fp); + } + /* * At conclusion of simulation, deallocate objects. */ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansion.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansion.input deleted file mode 100644 index 363702fb..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansion.input +++ /dev/null @@ -1,504 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Linadv example problem - * (3d sinusoidal fronusoidal frontt) - * - ************************************************************************/ - - -LinAdv { - advection_velocity = 2.0e0 , 0.01e0, 0.01e0 - - godunov_order = 4 - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SINE_CONSTANT_X" - - Initial_data { - front_position = 1.0 - interval_0 { - uval = 40.0 - } - interval_1 { - uval = 1.0 - } - amplitude = 0.5 - period = 8.0, 4.0, 4.0 - - } - - Refinement_data { - // refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - refine_criteria = "UVAL_GRADIENT" - - UVAL_GRADIENT { - grad_tol = 20.0 - } - - UVAL_SHOCK { - shock_tol = 20.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - laplace_cut_threshold_ar = 4 - log_node_history = FALSE - use_level_boxes = TRUE // Used by SAMRAI-2, but not DLBG. - use_private_communicator = TRUE - sort_output_nodes = TRUE // Used by DLBG, but not SAMRAI-2. - max_box_size = 100, 100, 100 - log_cluster_summary = TRUE - log_cluster = FALSE - barrier_before = TRUE - barrier_after = TRUE -} - -Main { - dim = 3 - base_name = "domex" - log_all_nodes = FALSE - - // load_balancer_type = "ChopAndPackLoadBalancer" - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - - run_time_plotting = FALSE - - use_scaled_input = TRUE - // timestepping = "SYNCHRONIZED" -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", - "apps::*::*", - "algs::*::*", - "mesh::*::*", - "tbox::AsyncCommGroup::*", - "tbox::AsyncCommStage::*", - "tbox::JobRelauncher::*", - "tbox::Schedule::*", - "xfer::*::*" -} - -PatchHierarchy { - max_levels = 3 - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - level_3 = 2, 2, 2 - level_4 = 2, 2, 2 - level_5 = 2, 2, 2 - level_6 = 2, 2, 2 - level_7 = 2, 2, 2 - level_8 = 2, 2, 2 - level_9 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = FALSE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} - -GriddingAlgorithm { - - combine_efficiency = 0.80 - efficiency_tolerance = 0.80 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" - sequentialize_patch_indices = FALSE - barrier_and_time = TRUE - log_metadata_statistics = TRUE - print_steps = FALSE -} - -V2GriddingAlgorithm { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - level_4 = 2 , 2 , 2 - level_5 = 2 , 2 , 2 - level_6 = 2 , 2 , 2 - level_7 = 2 , 2 , 2 - level_8 = 2 , 2 , 2 - level_9 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 30, 30, 30 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 5, 5, 5 - // all finer levels will use same values as level_0... - } - - efficiency_tolerance = 0.80e0 // min % of tag cells in new patch level - combine_efficiency = 0.80e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -// write_regrid_boxes = TRUE - // regrid_boxes_filename = "regrid_boxes" - barrier_before_clustering = FALSE - sort_boxes_after_clustering = FALSE - extend_tags_to_bdry = TRUE - use_new_alg = TRUE -} - -SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 8.0, 4.0, 4.0 - velocity = 2.0e0 , 0.01e0, 0.01e0 - amplitude = 0.5 -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 2.0 // final simulation time - grow_dt = 1.0e0 // growth factor for timesteps - // max_integrator_steps = 1 // max number of simulation timesteps - max_integrator_steps = 30 // max number of simulation timesteps - // tag_buffer = 3, 3, 3, 3, 3, 3 - barrier_and_time = TRUE -} - -ChopAndPackLoadBalancer{ - processors = 1, 1 - bin_pack_method = "GREEDY" - // bin_pack_method = "SPATIAL" - ignore_level_box_union_is_single_box = TRUE -} - -TreeLoadBalancer { - min_load_fraction_per_box = 0.03 - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 1 - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE - slender_penalty_wt = 0.0 - summarize_map = TRUE -} - -HyperbolicLevelIntegrator { - cfl = 0.43 - cfl_init = 0.43 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - -RefineSchedule { - barrier_and_time = TRUE - extra_debug = FALSE -} - -PersistentOverlapConnectors { - check_created_connectors = FALSE - check_accessed_connectors = FALSE -} - -//////////////////////////////////////////////////////////////////////// -// Specific databases for scaling tests. -//////////////////////////////////////////////////////////////////////// - -ScaledInput1 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 31, 7, 7) ] // 1proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 8.e0, 2.e0, 2.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput2 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 31, 15, 7) ] // 2proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 8.e0, 4.e0, 2.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput4 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (31, 15, 15) ] // 4proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 8.e0, 4.e0, 4.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput8 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (63, 15, 15) ] // 8proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 16.e0, 4.e0, 4.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput16 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (63, 31, 15) ] // 16proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 16.e0, 8.e0, 4.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput32 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (63, 31, 31) ] // 32proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 16.e0, 8.e0, 8.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput64 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (127, 31, 31) ] // 64proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 32.e0, 8.e0, 8.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput128 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (127, 63, 31) ] // 128proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 32.e0, 16.e0, 8.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput256 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (127, 63, 63) ] // 256proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 32.e0, 16.e0, 16.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput512 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (255, 63, 63) ] // 512proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 64.e0, 16.e0, 16.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput1024 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (255, 127, 63) ] // 1024proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 64.e0, 32.e0, 16.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput2048 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (255, 127, 127) ] // 2048proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 64.e0, 32.e0, 32.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput4096 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (511, 127, 127) ] // 4096proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 128.e0, 32.e0, 32.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput8192 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (511, 255, 127) ] // 8192proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 128.e0, 64.e0, 32.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput16384 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (511, 255, 255) ] // 16384proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 128.e0, 64.e0, 64.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput32768 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (1023, 255, 255) ] // 32768proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 256.e0, 64.e0, 64.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput36864 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (1023, 287, 255) ] // 36864proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 256.e0, 72.e0, 64.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput65536 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (1023, 511, 255) ] // 65536proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 256.e0, 128.e0, 64.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} - -ScaledInput131072 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (1023, 511, 511) ] // 131072proc - x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. - x_up = 256.e0, 128.e0, 128.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionc.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionc.input new file mode 100644 index 00000000..9f8aa420 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionc.input @@ -0,0 +1,342 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Linadv example problem + * (3d sinusoidal fronusoidal frontt) + * + ************************************************************************/ + +//See test_inputs/domainexpansion.input for inputs + +LinAdv { + advection_velocity = 2.0e0 , 0.55e0, 0.55e0 + + godunov_order = 4 + corner_transport = "CORNER_TRANSPORT_1" + + Refinement_data { + // refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + refine_criteria = "UVAL_GRADIENT" + + UVAL_GRADIENT { + grad_tol = 20.0 + } + + UVAL_SHOCK { + shock_tol = 20.0 + shock_onset = 0.85 + } + } + +} + +BergerRigoutsos { + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_min_box_size_from_cutting = 1, 1, 1 + DEV_log_node_history = FALSE + sort_output_nodes = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.85 + efficiency_tolerance = 0.85 +// DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE +// DEV_barrier_before = TRUE +// DEV_barrier_after = TRUE +} + +TileClustering { + tile_size = 8,8,8 +// DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE +// DEV_barrier_and_time = TRUE +} + +Main { + dim = 3 + base_name = "domexc" + log_all_nodes = FALSE + + // Clustering choices: BergerRigoutsos, TileClustering + clustering_type = "BergerRigoutsos" + + // Partitioner choices: TreeLoadBalancer, ChopAndPackLoadBalancer, TilePartitioner + load_balancer_type = "TreeLoadBalancer" + +// visualization dump parameters + viz_dump_interval = 0 // zero to turn off + +// restart dump parameters + restart_interval = 0 // zero to turn off + + use_scaled_input = FALSE + // timestepping = "SYNCHRONIZED" +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", + "apps::*::*", + "algs::*::*", + "mesh::*::*", + "tbox::AsyncCommGroup::*", + "tbox::AsyncCommStage::*", + "tbox::JobRelauncher::*", + "tbox::Schedule::*", + "xfer::*::*", + "appu::main::all" +} + +PatchHierarchy { + max_levels = 3 + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6,6,6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + level_4 = 2, 2, 2 + level_5 = 2, 2, 2 + level_6 = 2, 2, 2 + level_7 = 2, 2, 2 + level_8 = 2, 2, 2 + level_9 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = FALSE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +GriddingAlgorithm { + // DEV_load_balance = FALSE + sequentialize_patch_indices = TRUE +// DEV_barrier_and_time = TRUE +// DEV_log_metadata_statistics = TRUE +// DEV_print_steps = FALSE +// DEV_check_boundary_proximity_violation = "ERROR" +} + +SinusoidalFrontTagger { + init_disp = 1.0, 1.0, 0.0 + period = 8.0, 8.0, 8.0 + velocity = 2.0e0 , 0.55e0, 0.55e0 + amplitude = 1.0 +} + +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + + +TimeRefinementIntegrator { + start_time = 0.e0 // initial simulation time + end_time = 5.0 // final simulation time + grow_dt = 1.0e0 // growth factor for timesteps + // max_integrator_steps = 1 // max number of simulation timesteps + max_integrator_steps = 25 // max number of simulation timesteps + // tag_buffer = 3, 3, 3, 3, 3, 3 +// DEV_barrier_and_time = TRUE +} + +ChopAndPackLoadBalancer{ + bin_pack_method = "GREEDY" + // bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + max_spread_procs = 1000000 + + DEV_report_load_balance = FALSE +// DEV_barrier_before = TRUE +// DEV_barrier_after = TRUE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_slender_penalty_wt = 0.0 + DEV_summarize_map = FALSE +} + +TreeLoadBalancer { + tile_size = 16,16,16 + flexible_load_tolerance = 0.05 + DEV_report_load_balance = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +HyperbolicLevelIntegrator { + cfl = 0.43 + cfl_init = 0.43 + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE +// DEV_distinguish_mpi_reduction_costs = TRUE +} + +RefineSchedule { +// DEV_barrier_and_time = TRUE + DEV_extra_debug = FALSE +} + +PersistentOverlapConnectors { + DEV_check_created_connectors = FALSE + DEV_check_accessed_connectors = FALSE + implicit_connector_creation_rule = "ERROR" +} + +//////////////////////////////////////////////////////////////////////// +// Specific databases for scaling tests. +//////////////////////////////////////////////////////////////////////// + +ScaledInput { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 31, 31) ] // 32proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput64 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 31, 31) ] // 64proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput128 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 31) ] // 128proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput256 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 63) ] // 256proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput512 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 63, 63) ] // 512proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput1024 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 63) ] // 1024proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput2048 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 127) ] // 2048proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput4096 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 127, 127) ] // 4096proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput8192 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 127) ] // 8192proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput16384 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 255) ] // 16384proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput32768 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 255, 255) ] // 32768proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput36864 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 287, 255) ] // 36864proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 72.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput65536 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 255) ] // 65536proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput131072 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 511) ] // 131072proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 128.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/front.3d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/front.3d.input deleted file mode 100644 index 889af287..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/front.3d.input +++ /dev/null @@ -1,656 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Linadv example problem - * (3d sinusoidal fronusoidal frontt) - * - ************************************************************************/ -log_actions = 'n' -check_input_connectors = 'n' -check_output_connectors = 'n' -check_connectors = 'n' -print_layer_hierarchy = 'n' -DistributedLoadBalancer_print_steps = 'n' -DistributedLoadBalancer_check_connectivity = 'n' -check_map = 'n' -check_connectivity = 'n' -print_steps = 'n' -print_swap_steps = 'n' -print_break_steps = 'n' -print_edge_steps = 'n' - - -LinAdv { - advection_velocity = 2.0e0 , 0.01e0, 0.01e0 - - godunov_order = 4 - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SINE_CONSTANT_X" - - Initial_data { - front_position = 0.0 - interval_0 { - uval = 40.0 - } - interval_1 { - uval = 1.0 - } - amplitude = 0.3 - frequency = 2.0, 2.0, 2.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - - use_analytical_tagger = TRUE -} - -BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = FALSE - use_private_communicator = TRUE - sort_output_nodes = TRUE - log_cluster_summary = TRUE - barrier_before = TRUE - barrier_after = TRUE -} - -Main { - dim = 3 - base_name = "newf3d" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - - run_time_plotting = FALSE - - // which_br: 'o' = old, 'n' = new - which_br = 'n' - use_scaled_input = TRUE -} - -BaselineMain { - base_name = "bslf3d" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - - run_time_plotting = FALSE - - // which_br: 'o' = old, 'n' = new - which_br = 'o' - use_scaled_input = TRUE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", - "apps::*::*", - "algs::*::*", - "mesh::*::*", - "tbox::AsyncCommGroup::*", - "tbox::AsyncCommStage::*", - "tbox::JobRelauncher::*", - "xfer::*::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - //domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - //domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - //domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - //domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - //domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - //domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - //domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - //domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - //domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - //domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} - -PatchHierarchy { - max_levels = 3 - largest_patch_size { - // level_0 = -1,-1,-1 - level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 4, 4, 4 - level_2 = 4, 4, 4 - level_3 = 4, 4, 4 - level_4 = 4, 4, 4 - level_5 = 4, 4, 4 - level_6 = 4, 4, 4 - level_7 = 4, 4, 4 - level_8 = 4, 4, 4 - level_9 = 4, 4, 4 - // etc. - } - allow_patches_smaller_than_ghostwidth = TRUE -} - -GriddingAlgorithm { - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - combine_efficiency = 0.7 - efficiency_tolerance = 0.85 - barrier_before_regrid = TRUE - barrier_before_find_refinement = TRUE - barrier_before_cluster = TRUE - barrier_before_nest = TRUE - barrier_before_limit = TRUE - barrier_before_extend = TRUE - barrier_before_balance = TRUE - barrier_after_find_refinement = TRUE -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator { - //cfl = 0.9e0 // procs 256, 512, 1024 - //cfl_init = 0.9e0 // procs 256, 512, 1024 - //cfl = 0.45e0 // procs 32, 64, 128 - //cfl_init = 0.45e0 // procs 32, 64, 128 - //cfl = 0.225e0 // procs 4, 8, 16 - //cfl_init = 0.225e0 // procs 4, 8, 16 - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 0.6 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - // max_integrator_steps = 5 // max number of simulation timesteps - max_integrator_steps = 25 // max number of simulation timesteps - // tag_buffer = 0, 0, 0, 0, 0, 0 -} - -LoadBalancer{ - processors = 1, 1 - bin_pack_method = "GREEDY" - // bin_pack_method = "SPATIAL" - ignore_level_box_union_is_single_box = TRUE -} - -DistributedLoadBalancer{ - algorithm_index = 1 - report_load_balance = FALSE - dummy = FALSE - OldLoadBalancer{ - processors = 1, 1 - bin_pack_method = "GREEDY" - // bin_pack_method = "SPATIAL" - ignore_level_box_union_is_single_box = TRUE - } - barrier_before_balance = FALSE -} - -TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 2 -} - - -ScaledInput { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .08, .08, .08 - buffer_space_1 = .04, .04, .04 - buffer_space_2 = .02, .02, .02 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -//////////////////////////////////////////////////////////////////////// -// Specific databases for scaling tests. -//////////////////////////////////////////////////////////////////////// - -ScaledInput1 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput2 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput4 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput8 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput16 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput32 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput64 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput128 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput256 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput512 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} - -ScaledInput1024 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,0,0 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0, 0.01e0, 0.01e0 - init_disp = 0.0, 0.25, 0.25 - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_bsyn.3d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_bsyn.3d.input deleted file mode 100644 index d8f321d2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_bsyn.3d.input +++ /dev/null @@ -1,555 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Linadv example problem - * (3d sinusoidal fronusoidal frontt) - * - ************************************************************************/ - - -LinAdv { - advection_velocity = 2.0e0 , 0.1e0, 0.1e0 - - godunov_order = 4 - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SINE_CONSTANT_X" - - Initial_data { - front_position = 0.0 - interval_0 { - uval = 40.0 - } - interval_1 { - uval = 1.0 - } - amplitude = 0.25 - frequency = 2.0, 2.0, 2.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - - use_analytical_tagger = TRUE -} - -BergerRigoutsos { - use_level_boxes = TRUE - // algo_advance_mode = "SYNCHRONOUS" - algo_advance_mode = "ADVANCE_SOME" - single_owner = TRUE - use_private_communicator = TRUE - - log_cluster_summary = TRUE - log_node_history = FALSE -} - -Main { - dim = 3 - base_name = "sine-front-3d-bsyn" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - - run_time_plotting = FALSE - - // which_br: 'o' = old, 'n' = new - which_br = 'n' - use_scaled_input = TRUE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", - "apps::*::*", - "algs::*::*", - "mesh::*::*", - "tbox::AsyncCommGroup::*", - "tbox::AsyncCommStage::*", - "tbox::JobRelauncher::*", - "xfer::*::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - //domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - //domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - //domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - //domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - //domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - //domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - //domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - //domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - //domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - //domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 - } - - largest_patch_size { - level_0 = 30, 30, 30 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 5, 5, 5 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -// write_regrid_boxes = TRUE - // regrid_boxes_filename = "regrid_boxes" - barrier_before_clustering = TRUE - sort_boxes_after_clustering = TRUE - extend_tags_to_bdry = TRUE - use_new_alg = TRUE -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator { - //cfl = 0.9e0 // procs 256, 512, 1024 - //cfl_init = 0.9e0 // procs 256, 512, 1024 - //cfl = 0.45e0 // procs 32, 64, 128 - //cfl_init = 0.45e0 // procs 32, 64, 128 - //cfl = 0.225e0 // procs 4, 8, 16 - //cfl_init = 0.225e0 // procs 4, 8, 16 - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 0.6 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - // max_integrator_steps = 2 // max number of simulation timesteps - max_integrator_steps = 25 // max number of simulation timesteps - tag_buffer = 0, 0, 0, 0, 0, 0 -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) - use_spatialBinPack = TRUE - ignore_level_box_union_is_single_box = TRUE -} - - -ScaledInput { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .08, .08, .08 - buffer_space_1 = .04, .04, .04 - buffer_space_2 = .02, .02, .02 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -//////////////////////////////////////////////////////////////////////// -// Specific databases for scaling tests. -//////////////////////////////////////////////////////////////////////// - -ScaledInput1 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput2 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput4 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput8 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput16 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput32 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput64 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput128 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput256 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput512 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput1024 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_orig.3d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_orig.3d.input deleted file mode 100644 index a74f61ee..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/sine_front_orig.3d.input +++ /dev/null @@ -1,555 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Linadv example problem - * (3d sinusoidal fronusoidal frontt) - * - ************************************************************************/ - - -LinAdv { - advection_velocity = 2.0e0 , 0.1e0, 0.1e0 - - godunov_order = 4 - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SINE_CONSTANT_X" - - Initial_data { - front_position = 0.0 - interval_0 { - uval = 40.0 - } - interval_1 { - uval = 1.0 - } - amplitude = 0.25 - frequency = 2.0, 2.0, 2.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "XFLOW" - } - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - - use_analytical_tagger = TRUE -} - -BergerRigoutsos { - use_level_boxes = TRUE - // algo_advance_mode = "SYNCHRONOUS" - algo_advance_mode = "ADVANCE_SOME" - single_owner = TRUE - use_private_communicator = TRUE - - log_cluster_summary = TRUE - log_node_history = FALSE -} - -Main { - dim = 3 - base_name = "sine-front-3d-orig" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - - run_time_plotting = FALSE - - // which_br: 'o' = old, 'n' = new - which_br = 'o' - use_scaled_input = TRUE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", - "apps::*::*", - "algs::*::*", - "mesh::*::*", - "tbox::AsyncCommGroup::*", - "tbox::AsyncCommStage::*", - "tbox::JobRelauncher::*", - "xfer::*::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - //domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - //domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - //domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - //domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - //domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - //domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - //domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - //domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - //domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - //domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 , 4 - level_2 = 4 , 4 , 4 - level_3 = 4 , 4 , 4 - } - - largest_patch_size { - level_0 = 30, 30, 30 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 5, 5, 5 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -// write_regrid_boxes = TRUE - // regrid_boxes_filename = "regrid_boxes" - barrier_before_clustering = TRUE - sort_boxes_after_clustering = TRUE - extend_tags_to_bdry = TRUE - use_new_alg = TRUE -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator { - //cfl = 0.9e0 // procs 256, 512, 1024 - //cfl_init = 0.9e0 // procs 256, 512, 1024 - //cfl = 0.45e0 // procs 32, 64, 128 - //cfl_init = 0.45e0 // procs 32, 64, 128 - //cfl = 0.225e0 // procs 4, 8, 16 - //cfl_init = 0.225e0 // procs 4, 8, 16 - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 0.6 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - // max_integrator_steps = 2 // max number of simulation timesteps - max_integrator_steps = 25 // max number of simulation timesteps - tag_buffer = 0, 0, 0, 0, 0, 0 -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) - use_spatialBinPack = TRUE - ignore_level_box_union_is_single_box = TRUE -} - - -ScaledInput { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .08, .08, .08 - buffer_space_1 = .04, .04, .04 - buffer_space_2 = .02, .02, .02 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -//////////////////////////////////////////////////////////////////////// -// Specific databases for scaling tests. -//////////////////////////////////////////////////////////////////////// - -ScaledInput1 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 4) ] // 1proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput2 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , ( 9, 9, 9) ] // 2proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.1125e0 // procs 1, 2 - cfl_init = 0.1125e0 // procs 1, 2 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput4 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19, 9, 9) ] // 4proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput8 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19, 9) ] // 8proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput16 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (19,19,19) ] // 16proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.225e0 // procs 4, 8, 16 - cfl_init = 0.225e0 // procs 4, 8, 16 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput32 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,19,19) ] // 32proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput64 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,19) ] // 64proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput128 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (39,39,39) ] // 128proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.45e0 // procs 32, 64, 128 - cfl_init = 0.45e0 // procs 32, 64, 128 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput256 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,39,39) ] // 256proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput512 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,39) ] // 512proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} - -ScaledInput1024 { -CartesianGeometry { - domain_boxes = [ (0,0,0) , (79,79,79) ] // 1024proc - x_lo = -2.e0, -1.e0,-1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0, 1.e0 // upper end of computational domain. - periodic_dimension = 0,1,1 -} -HyperbolicLevelIntegrator { - cfl = 0.9e0 // procs 256, 512, 1024 - cfl_init = 0.9e0 // procs 256, 512, 1024 - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - SinusoidalFrontTagger { - allocate_data = FALSE - buffer_cells = 0,0,0 - buffer_space_0 = .25, .25, .25 - buffer_space_1 = .05, .05, .05 - buffer_space_2 = .01, .01, .01 - period = 1 - amplitude = .3 - velocity = 2.0e0 , 0.1e0, 0.1e0 - init_disp = 0.0, 0.0, 0.0 - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sine-front-2d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sine-front-2d.input deleted file mode 100644 index 6b38e63e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sine-front-2d.input +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI Linadv example problem - * (2d sinusoidal fronusoidal frontt) - * - ************************************************************************/ - - -LinAdv { - advection_velocity = 2.0e0 , 0.1e0 - - godunov_order = 4 - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SINE_CONSTANT_X" - - Initial_data { - front_position = 0.0 - interval_0 { - uval = 40.0 - } - interval_1 { - uval = 1.0 - } - amplitude = 0.25 - frequency = 2.0, 2.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi { - boundary_condition = "XFLOW" - } - } -} - -Main { -// log file parameters - log_file_name = "sine-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sine2d" - viz_dump_filename = "sine2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sine2d" - - run_time_plotting = FALSE -} - -TimerManager { - print_exclusive = TRUE - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -} - -CartesianGeometry { - domain_boxes = [ (0,0) , (39,19) ] - x_lo = -2.e0, -1.e0 // lower end of computational domain. - x_up = 2.e0, 1.e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - } - - largest_patch_size { - level_0 = 19, 19 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 8, 8 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -// write_regrid_boxes = TRUE - regrid_boxes_filename = "regrid_boxes" -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - - -HyperbolicLevelIntegrator { - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.1e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator { - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-per-4levels.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-per-4levels.input deleted file mode 100644 index cf10ad46..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-per-4levels.input +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -LinAdv { - - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi { - boundary_condition = "XFLOW" - } - } - -} - -Main { -// log file parameters - log_file_name = "sphere-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - viz_dump_filename = "sphere2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere2d" -} - -CartesianGeometry{ - domain_boxes = [(0,0),(29,19)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 30.e0 , 20.e0 // upper end of computational domain. - - periodic_dimension = 1,0 -} - -PatchHierarchy { - max_levels = 4 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 16 , 16 - level_1 = 12 , 12 - // all finer levels will use same values as level_1... - } -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps - - tag_buffer = 3,3,3 -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-re.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-re.input deleted file mode 100644 index 5f927af3..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d-re.input +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ -LinAdv { - - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_RICHARDSON", "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_RICHARDSON { - rich_tol = 0.1, 0.1, 0.001 - } - - // UVAL_GRADIENT AND UVAL_SHOCK criteria are applied only if the gradient - // detector is turned on in the StandardTagAndInitialize input below... - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi { - boundary_condition = "XFLOW" - } - } - -} - -Main { -// log file parameters - log_file_name = "sphere-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - viz_dump_filename = "sphere2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere2d" -} - -CartesianGeometry{ - domain_boxes = [(0,0),(29,19)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 30.e0 , 20.e0 // upper end of computational domain. - - periodic_dimension = 1,0 -} - -PatchHierarchy { - max_levels = 4 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 2 , 2 - level_3 = 2 , 2 - level_4 = 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 16 , 16 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { -// tagging_method = "GRADIENT_DETECTOR" - tagging_method = "RICHARDSON_EXTRAPOLATION" -// tagging_method = "RICHARDSON_EXTRAPOLATION", "GRADIENT_DETECTOR" -// tagging_method = "REFINE_BOXES" -// RefineBoxes { -// level_0 = [(15,0),(29,14)] -// level_1 = [(65,10),(114,40)] -// } -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps - - tag_buffer = 2,2,2 -} -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d.input deleted file mode 100644 index 04b038b1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-2d.input +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -LinAdv { - - advection_velocity = 2.0e0 , 1.0e0 - godunov_order = 4 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 22.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi { - boundary_condition = "XFLOW" - } - } - -} - -Main { -// log file parameters - log_file_name = "sphere-2d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere2d" - viz_dump_filename = "sphere2d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere2d" - -} - -CartesianGeometry{ - domain_boxes = [(0,0),(29,19)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 30.e0 , 20.e0 // upper end of computational domain. - - periodic_dimension = 1,0 -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - level_4 = 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 16 , 16 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps - - tag_buffer = 2,2,2 -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-3d.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-3d.input deleted file mode 100644 index 3948baca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/sample_inputs/sphere-3d.input +++ /dev/null @@ -1,224 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -LinAdv { - - advection_velocity = 2.0e0 , 1.0e0 , 1.0e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 2.9 - center = 5.5 , 5.5 , 5.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_face_xlo { - boundary_condition = "FLOW" - } - boundary_face_xhi { - boundary_condition = "FLOW" - } - boundary_face_ylo { - boundary_condition = "FLOW" - } - boundary_face_yhi { - boundary_condition = "FLOW" - } - boundary_face_zlo { - boundary_condition = "FLOW" - } - boundary_face_zhi { - boundary_condition = "FLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for an edge, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge boundary values - // will be the same regardless of which face is used. - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZFLOW" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XFLOW" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent faces have either FLOW - // or REFLECT conditions, the resulting node boundary values - // will be the same regardless of which face is used. - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XFLOW" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XFLOW" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XFLOW" - } - - } - -} - -Main { -// log file parameters - log_file_name = "sphere-3d.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 1 // zero to turn off - viz_dump_dirname = "viz_sphere3d" - viz_dump_filename = "sphere3d" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_sphere3d" - -} - -CartesianGeometry{ - domain_boxes = [ (0,0,0) , (29,19,19) ] - - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 30.e0 , 20.e0 , 20.e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 3 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 40 , 40 , 40 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 9 , 9 , 9 - // all finer levels will use same values as level_0... - } -} - -GriddingAlgorithm{ - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 25 // max number of simulation timesteps -} - -LoadBalancer { -// using default uniform load balance configuration (see mesh_LoadBalancerX.h.sed) -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansion.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansion.input new file mode 100644 index 00000000..6f5a2cb2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansion.input @@ -0,0 +1,568 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Linadv example problem + * (3d sinusoidal fronusoidal frontt) + * + ************************************************************************/ + + +LinAdv { + + // Problem specification parameters + // advection_velocity -- (double array) velocity by which + // initial profile of uval is + // advected through the domain [0.0] + // godunov_order -- (int) order of Godunov slopes (1, 2, or 4) [1] + // corner transport scheme -- ("CORNER_TRANS_1" -or- "CORNER_TRANS_2" + // ["CORNER_TRANS_1"] + // Flux corner transport options + // CORNER_TRANS_1 is based on an extension of Colella's formulation. + // CORNER_TRANS_2 is a formulation constructed by Trangenstein + // data_problem -- ("SPHERE_PROB", "PIECEWISE_CONST_[X,Y,Z]", or + // "SINE_CONST_[X,Y,Z]") specification of the + // problem to be solved [REQD] + // + advection_velocity = 2.0e0 , 0.01e0, 0.01e0 + godunov_order = 4 + corner_transport = "CORNER_TRANSPORT_1" + data_problem = "SINE_CONSTANT_X" + + // Initial data for "SPHERE_PROB" problem + // radius -- (double) radius of sphere [REQD] + // center -- (double array) location of sphere center [REQD] + // uval_inside -- (double) uval inside sphere [REQD] + // uval_outside -- (double) uval outside sphere [REQD] + Initial_data { + front_position = 1.0 + interval_0 { + uval = 40.0 + } + interval_1 { + uval = 1.0 + } + amplitude = 0.5 + period = 8.0, 4.0, 4.0 + + } + + // Refinement criteria + // Data for tagging cells to refine for gradient detection and + // Richardson extrapolation. Options: + // UVAL_DEVIATION, UVAL_GRADIENT, UVAL_SHOCK, UVAL_RICHARDSON + // and combinations thereof... + // + // UVAL_DEVIATION -- tag around deviations in a specified uval + // UVAL_GRADIENT -- tag around gradients + // UVAL_SHOCK -- tag around discontinuous regions + // UVAL_RICHARDSON -- use Richardson extrapolation to tag + // around solution errors + // + // Refinement_data { + // refine_criteria -- (string array) contains one or more of the + // tagging options, specified above [REQD] + // UVAL_DEVIATION { + // uval_dev -- (double array) freestream uval, i.e. tag cells where + // |uval - uval_dev] > dev_tol [REQD] + // dev_tol -- (double array) deviation tolerance [REQD] + // time_min -- (double array) time on each level at which + // tagging using this criteria is started [0.] + // time_max -- (double array) time on each level at which + // tagging is stopped [DBL_MAX] + // NOTE: For each of the above entries, if a level is NOT specified, + // the value from the next coarser level is used. The time_min + // and time_max options may be used to control whether tagging + // on a level is active (i.e. setting time_max=0 makes it + // inactive). + // } + // UVAL_GRADIENT { + // grad_tol -- (double array) gradient tolerance for each level [REQD] + // time_min -- (double array) time on each level at which + // tagging using this criteria is started [0.] + // time_max -- (double array) time on each level at which + // tagging is stopped [DBL_MAX] + // (see NOTE under UVAL_DEVIATION above) + // } + // UVAL_SHOCK { + // shock_onset -- (double array) onset tolerance for each level [REQD] + // shock_tol -- (double array) gradient tolerance for each level [REQD] + // time_min -- (double array) time on each level at which + // tagging using this criteria is started [0.] + // time_max -- (double array) time on each level at which + // tagging is stopped [DBL_MAX] + // (see NOTE under UVAL_DEVIATION above) + // } + // UVAL_RICHARDSON { + // rich_tol -- (double array) Richardson extrapolation tolerance + // for each level [REQD] + // time_min -- (double array) time on each level at which + // tagging using this criteria is started [0.] + // time_max -- (double array) time on each level at which + // tagging is stopped [DBL_MAX] + // (see NOTE under UVAL_DEVIATION above) + // } + // + Refinement_data { + // refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + refine_criteria = "UVAL_GRADIENT" + + UVAL_GRADIENT { + grad_tol = 20.0 + } + + UVAL_SHOCK { + shock_tol = 20.0 + shock_onset = 0.85 + } + } + + // Boundary condition data following the format defined in + // appu::CartesianBoundaryUtility[2,3]. Refer to these classes for details. + // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + Boundary_data { + boundary_face_xlo { + boundary_condition = "FLOW" + } + boundary_face_xhi { + boundary_condition = "FLOW" + } + boundary_face_ylo { + boundary_condition = "FLOW" + } + boundary_face_yhi { + boundary_condition = "FLOW" + } + boundary_face_zlo { + boundary_condition = "FLOW" + } + boundary_face_zhi { + boundary_condition = "FLOW" + } + + boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed + boundary_condition = "ZFLOW" + } + boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed + boundary_condition = "XFLOW" + } + boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + + boundary_node_xlo_ylo_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi_zlo { + boundary_condition = "XFLOW" + } + boundary_node_xlo_ylo_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_ylo_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xlo_yhi_zhi { + boundary_condition = "XFLOW" + } + boundary_node_xhi_yhi_zhi { + boundary_condition = "XFLOW" + } + + } + +} + +//See mesh::BergerRigoutsos for input. +BergerRigoutsos { + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_log_node_history = FALSE + sort_output_nodes = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.80 + efficiency_tolerance = 0.80 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE +} + +Main { + //Dimension for the problem. No default + dim = 3 + + //Base name for loga and viz files. default is "unnamed" + base_name = "domex" + + //TRUE to produce a log file on all nodes, FALSE to log only node 0. + //Default is FALSE + log_all_nodes = FALSE + + //Choose the type of LoadBalancer. Default is "TreeLoadBalancer" + // load_balancer_type = "ChopAndPackLoadBalancer" + + //Timestep interval to dump viz files. No viz files will be produced + //when this value is 0. Default is 0. + viz_dump_interval = 0 + + //Name of directory for viz dumps. Default is base_name + ".visit" + //viz_dump_dirname = "dump.visit" + + //Timestep interval to dump restart files. No restart files will be + //produced when this value is 0. Default is 0. + restart_interval = 0 + + //Name of directory for restart dumps. No default, this entry is required + //when restart_interval is nonzero. + //restart_write_dirname = "dump.restart" + + //When TRUE, used ScaledInput entries from this file to scale up the + //size of the problem based on processor count. Default is TRUE + use_scaled_input = TRUE + + //Turn on syncronized timestepping. Only valid entry is "SYNCHRONIZED" + //If used, the TimeRefinementIntegrator will operation with synchronized + //timestepping on all levels. Otherwise, time refinement will be used. + // timestepping = "SYNCHRONIZED" +} + +//See tbox::TimerManager for input +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", + "apps::*::*", + "algs::*::*", + "mesh::*::*", + "tbox::AsyncCommGroup::*", + "tbox::AsyncCommStage::*", + "tbox::JobRelauncher::*", + "tbox::Schedule::*", + "xfer::*::*", + "appu::main::all" +} + +//See hier::PatchHierarchy for input +PatchHierarchy { + max_levels = 3 + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 5,5,5 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + level_4 = 2, 2, 2 + level_5 = 2, 2, 2 + level_6 = 2, 2, 2 + level_7 = 2, 2, 2 + level_8 = 2, 2, 2 + level_9 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = FALSE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +//See mesh::GriddingAlgorithm for input +GriddingAlgorithm { + sequentialize_patch_indices = FALSE + DEV_barrier_and_time = TRUE + DEV_log_metadata_statistics = TRUE + DEV_print_steps = FALSE +} + +//See SinusoidalFrontGenerator for input +SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 8.0, 4.0, 4.0 + velocity = 2.0e0 , 0.01e0, 0.01e0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02, 0.02 + buffer_distance_2 = 0.00, 0.00, 0.00 +} + +//See mesh::StandardTagAndInitialize for input +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + +//See algs::TimeRefinementIntegrator for input +TimeRefinementIntegrator { + start_time = 0.e0 // initial simulation time + end_time = 2.0 // final simulation time + grow_dt = 1.0e0 // growth factor for timesteps + // max_integrator_steps = 1 // max number of simulation timesteps + max_integrator_steps = 30 // max number of simulation timesteps + // tag_buffer = 3, 3, 3, 3, 3, 3 + DEV_barrier_and_time = TRUE +} + +//See mesh::ChopAndPackLoadBalancer for input +ChopAndPackLoadBalancer{ + bin_pack_method = "GREEDY" + // bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} + +//See mesh::TreeLoadBalancer for input +TreeLoadBalancer { + DEV_report_load_balance = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_slender_penalty_wt = 0.0 + DEV_summarize_map = TRUE +} + +//See algs::HyperbolicLevelIntegrator for input +HyperbolicLevelIntegrator { + cfl = 0.43 + cfl_init = 0.43 + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE + DEV_distinguish_mpi_reduction_costs = TRUE +} + +//See xfer::RefineSchedule for input +RefineSchedule { + DEV_barrier_and_time = TRUE + DEV_extra_debug = FALSE +} + +//See hier::PersistentOverlapConnectors for input +PersistentOverlapConnectors { + DEV_check_created_connectors = FALSE + DEV_check_accessed_connectors = FALSE + implicit_connector_creation_rule = "ERROR" +} + +//////////////////////////////////////////////////////////////////////// +// Specific databases for scaling tests. +// See geom::CartesianGridGeometry and its base classes for input +//////////////////////////////////////////////////////////////////////// + +ScaledInput1 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , ( 31, 7, 7) ] // 1proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 2.e0, 2.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput2 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , ( 31, 15, 7) ] // 2proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 4.e0, 2.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput4 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (31, 15, 15) ] // 4proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 4.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput8 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 15, 15) ] // 8proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 4.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput16 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 31, 15) ] // 16proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 8.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput32 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 31, 31) ] // 32proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput64 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 31, 31) ] // 64proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput128 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 31) ] // 128proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput256 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 63) ] // 256proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput512 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 63, 63) ] // 512proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput1024 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 63) ] // 1024proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput2048 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 127) ] // 2048proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput4096 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 127, 127) ] // 4096proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput8192 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 127) ] // 8192proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput16384 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 255) ] // 16384proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput32768 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 255, 255) ] // 32768proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput36864 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 287, 255) ] // 36864proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 72.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput65536 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 255) ] // 65536proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput131072 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 511) ] // 131072proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 128.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionb.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansionb.input similarity index 81% rename from base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionb.input rename to base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansionb.input index ea7ec93e..294b3c87 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/performance_inputs/domainexpansionb.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansionb.input @@ -3,18 +3,20 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI Linadv example problem * (3d sinusoidal fronusoidal frontt) * ************************************************************************/ /* - domainexpansionb is similar to domainexpansiona, but it is aimed at + domainexpansionb is similar to domainexpansion, but it is aimed at cutting the number of cells/proc by 1/3, to about 19K cells/proc on the level 2 (finest level). Cutting down the size makes the problem fit on ubgl better when running in coprocessor mode. I did this by tuning the clustering parameters and changing the base resolution. + + See domainexpansion.input for description of inputs */ LinAdv { @@ -52,7 +54,7 @@ LinAdv { } } - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" + // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" Boundary_data { boundary_face_xlo { boundary_condition = "FLOW" @@ -140,17 +142,17 @@ LinAdv { } BergerRigoutsos { - algo_advance_mode = "ADVANCE_SOME" - owner_mode = "MOST_OVERLAP" - log_node_history = FALSE - use_level_boxes = TRUE // Used by SAMRAI-2, but not DLBG. - use_private_communicator = TRUE + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_log_node_history = FALSE sort_output_nodes = TRUE // Used by DLBG, but not SAMRAI-2. max_box_size = 100, 100, 100 - log_cluster_summary = TRUE - log_cluster = FALSE - barrier_before = TRUE - barrier_after = TRUE + combine_efficiency = 0.90 + efficiency_tolerance = 0.90 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE } Main { @@ -159,15 +161,11 @@ Main { log_all_nodes = FALSE // visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both viz_dump_interval = 0 // zero to turn off - visit_number_procs_per_file = 1 // not used by Vizamrai // restart dump parameters restart_interval = 0 // zero to turn off - run_time_plotting = FALSE - use_scaled_input = TRUE // timestepping = "SYNCHRONIZED" } @@ -185,15 +183,12 @@ TimerManager { "tbox::AsyncCommStage::*", "tbox::JobRelauncher::*", "tbox::Schedule::*", - "xfer::*::*" + "xfer::*::*", + "appu::main::all" } PatchHierarchy { max_levels = 3 - enforce_proper_nesting = TRUE - extend_to_domain_boundary = TRUE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE largest_patch_size { level_0 = -1,-1,-1 // level_0 = 20,20,20 @@ -222,57 +217,20 @@ PatchHierarchy { } GriddingAlgorithm { - - combine_efficiency = 0.90 - efficiency_tolerance = 0.90 - // write_regrid_boxes = TRUE - // read_regrid_boxes = TRUE - // regrid_boxes_filename = "grid" sequentialize_patch_indices = FALSE - barrier_and_time = TRUE - log_metadata_statistics = TRUE -} - -V2GriddingAlgorithm { - max_levels = 3 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - level_4 = 2 , 2 , 2 - level_5 = 2 , 2 , 2 - level_6 = 2 , 2 , 2 - level_7 = 2 , 2 , 2 - level_8 = 2 , 2 , 2 - level_9 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 30, 30, 30 // largest patch allowed in hierarchy - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 5, 5, 5 - // all finer levels will use same values as level_0... - } - - efficiency_tolerance = 0.80e0 // min % of tag cells in new patch level - combine_efficiency = 0.80e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -// write_regrid_boxes = TRUE - // regrid_boxes_filename = "regrid_boxes" - barrier_before_clustering = FALSE - sort_boxes_after_clustering = FALSE - extend_tags_to_bdry = TRUE - use_new_alg = TRUE + DEV_barrier_and_time = TRUE + DEV_log_metadata_statistics = TRUE } -SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 8.0, 4.0, 4.0 - velocity = 2.0e0 , 0.01e0, 0.01e0 - amplitude = 0.5 +SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 8.0, 4.0, 4.0 + velocity = 2.0e0 , 0.01e0, 0.01e0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02, 0.02 + buffer_distance_2 = 0.00, 0.00, 0.00 } StandardTagAndInitialize { @@ -287,27 +245,25 @@ TimeRefinementIntegrator { // max_integrator_steps = 1 // max number of simulation timesteps max_integrator_steps = 30 // max number of simulation timesteps // tag_buffer = 3, 3, 3, 3, 3, 3 - barrier_and_time = TRUE + DEV_barrier_and_time = TRUE } -LoadBalancer{ - processors = 1, 1 - bin_pack_method = "GREEDY" - // bin_pack_method = "SPATIAL" - ignore_level_box_union_is_single_box = TRUE +ChopAndPackLoadBalancer{ + bin_pack_method = "GREEDY" + // bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE } TreeLoadBalancer { - report_load_balance = FALSE - barrier_before = TRUE - barrier_after = TRUE - n_root_cycles = 1 - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_report_load_balance = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } HyperbolicLevelIntegrator { @@ -315,11 +271,17 @@ HyperbolicLevelIntegrator { cfl_init = 0.43 lag_dt_computation = TRUE use_ghosts_to_compute_dt = TRUE - distinguish_mpi_reduction_costs = TRUE + DEV_distinguish_mpi_reduction_costs = TRUE } RefineSchedule { - barrier_and_time = TRUE + DEV_barrier_and_time = TRUE +} + +PersistentOverlapConnectors { + DEV_check_created_connectors = FALSE + DEV_check_accessed_connectors = FALSE + implicit_connector_creation_rule = "ERROR" } //////////////////////////////////////////////////////////////////////// diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansiont.input b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansiont.input new file mode 100644 index 00000000..cb7ca70c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/LinAdv/test_inputs/domainexpansiont.input @@ -0,0 +1,387 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for SAMRAI Linadv example problem + * (3d sinusoidal fronusoidal frontt) + * + ************************************************************************/ + +// See domainexpansion.input for description of inputs + +LinAdv { + advection_velocity = 2.0e0 , 0.55e0, 0.55e0 + + godunov_order = 4 + corner_transport = "CORNER_TRANSPORT_1" + + Refinement_data { + // refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + refine_criteria = "UVAL_GRADIENT" + + UVAL_GRADIENT { + grad_tol = 20.0 + } + + UVAL_SHOCK { + shock_tol = 20.0 + shock_onset = 0.85 + } + } + +} + +BergerRigoutsos { + DEV_algo_advance_mode = "ADVANCE_SOME" + DEV_owner_mode = "MOST_OVERLAP" + DEV_inflection_cut_threshold_ar = 4 + DEV_min_box_size_from_cutting = 1, 1, 1 + DEV_log_node_history = FALSE + sort_output_nodes = TRUE + max_box_size = 100, 100, 100 + combine_efficiency = 0.85 + efficiency_tolerance = 0.85 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE +} + +TileClustering { + tile_size = 8,8,8 + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} + +Main { + dim = 3 + base_name = "domext" + log_all_nodes = FALSE + + // Clustering choices: BergerRigoutsos, TileClustering + clustering_type = "TileClustering" + + // Partitioner choices: TreeLoadBalancer, ChopAndPackLoadBalancer, TilePartitioner + load_balancer_type = "TilePartitioner" + +// visualization dump parameters + viz_dump_interval = 0 // zero to turn off + +// restart dump parameters + restart_interval = 0 // zero to turn off + + use_scaled_input = TRUE + // timestepping = "SYNCHRONIZED" +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", + "apps::*::*", + "algs::*::*", + "mesh::*::*", + "tbox::AsyncCommGroup::*", + "tbox::AsyncCommStage::*", + "tbox::JobRelauncher::*", + "tbox::Schedule::*", + "xfer::*::*", + "appu::main::all" +} + +PatchHierarchy { + max_levels = 3 + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6,6,6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + level_4 = 2, 2, 2 + level_5 = 2, 2, 2 + level_6 = 2, 2, 2 + level_7 = 2, 2, 2 + level_8 = 2, 2, 2 + level_9 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = FALSE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} + +GriddingAlgorithm { + // DEV_load_balance = FALSE + sequentialize_patch_indices = TRUE + DEV_barrier_and_time = TRUE + DEV_log_metadata_statistics = TRUE + DEV_print_steps = FALSE + DEV_check_boundary_proximity_violation = "ERROR" +} + +SinusoidalFrontTagger { + init_disp = 1.0, 1.0, 0.0 + period = 8.0, 8.0, 8.0 + velocity = 2.0e0 , 0.55e0, 0.55e0 + amplitude = 1.0 +} + +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + + +TimeRefinementIntegrator { + start_time = 0.e0 // initial simulation time + end_time = 5.0 // final simulation time + grow_dt = 1.0e0 // growth factor for timesteps + // max_integrator_steps = 1 // max number of simulation timesteps + max_integrator_steps = 25 // max number of simulation timesteps + // tag_buffer = 3, 3, 3, 3, 3, 3 + DEV_barrier_and_time = TRUE +} + +ChopAndPackLoadBalancer{ + bin_pack_method = "GREEDY" + // bin_pack_method = "SPATIAL" + ignore_level_box_union_is_single_box = TRUE +} + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + max_spread_procs = 1000000 + + DEV_report_load_balance = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_slender_penalty_wt = 0.0 + DEV_summarize_map = FALSE +} + +TilePartitioner { + tile_size = 16,16,16 + DEV_report_load_balance = FALSE + DEV_barrier_before = TRUE + DEV_barrier_after = TRUE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_slender_penalty_wt = 0.0 + DEV_summarize_map = TRUE +} + +HyperbolicLevelIntegrator { + cfl = 0.43 + cfl_init = 0.43 + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE + DEV_distinguish_mpi_reduction_costs = TRUE +} + +RefineSchedule { + DEV_barrier_and_time = TRUE + DEV_extra_debug = FALSE +} + +PersistentOverlapConnectors { + DEV_check_created_connectors = FALSE + DEV_check_accessed_connectors = FALSE + implicit_connector_creation_rule = "ERROR" +} + +//////////////////////////////////////////////////////////////////////// +// Specific databases for scaling tests. +//////////////////////////////////////////////////////////////////////// + +ScaledInput1 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , ( 31, 7, 7) ] // 1proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 2.e0, 2.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput2 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , ( 31, 15, 7) ] // 2proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 4.e0, 2.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput4 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (31, 15, 15) ] // 4proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 8.e0, 4.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput8 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 15, 15) ] // 8proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 4.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput16 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 31, 15) ] // 16proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 8.e0, 4.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput32 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (63, 31, 31) ] // 32proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 16.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput64 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 31, 31) ] // 64proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 8.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput128 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 31) ] // 128proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 8.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput256 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (127, 63, 63) ] // 256proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 32.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput512 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 63, 63) ] // 512proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 16.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput1024 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 63) ] // 1024proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 16.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput2048 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (255, 127, 127) ] // 2048proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 64.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput4096 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 127, 127) ] // 4096proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 32.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput8192 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 127) ] // 8192proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 32.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput16384 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (511, 255, 255) ] // 16384proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 128.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput32768 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 255, 255) ] // 32768proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 64.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput36864 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 287, 255) ] // 36864proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 72.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput65536 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 255) ] // 65536proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 64.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} + +ScaledInput131072 { +CartesianGeometry { + domain_boxes = [ (0,0,0) , (1023, 511, 511) ] // 131072proc + x_lo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + x_up = 256.e0, 128.e0, 128.e0 // upper end of computational domain. + periodic_dimension = 0,0,0 +} +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.C b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.C deleted file mode 100644 index 4c72bec0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.C +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#include "DerivedVisOwnerData.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/SAMRAIManager.h" - -using namespace SAMRAI; - -DerivedVisOwnerData::DerivedVisOwnerData() -{ -} - -DerivedVisOwnerData::~DerivedVisOwnerData() -{ -} - -bool DerivedVisOwnerData::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const -{ - NULL_USE(patch); - NULL_USE(depth_id); - - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << - "DerivedVisOwnerData::packDerivedPatchDataIntoDoubleBuffer"); - } - - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.h b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.h deleted file mode 100644 index 76584caa..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/DerivedVisOwnerData.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#ifndef included_DerivedVisOwnerData -#define included_DerivedVisOwnerData - -#include - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/Patch.h" - -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisDerivedDataStrategy.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Write owner rank using VisDerivedDataStrategy. - */ -class DerivedVisOwnerData: - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - DerivedVisOwnerData(); - - ~DerivedVisOwnerData(); - - //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals - - virtual bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const; - - //@} - -private: -}; - -#endif // included_DerivedVisOwnerData diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.depend deleted file mode 100644 index d6d48489..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.depend +++ /dev/null @@ -1,339 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile dependencies -## -######################################################################### - -## This file is automatically generated by depend.pl. - - -FILE_0=DerivedVisOwnerData.o -DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.C \ - DerivedVisOwnerData.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=SinusoidalFrontTagger.o -DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/MDA_Access.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SinusoidalFrontTagger.C \ - SinusoidalFrontTagger.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} - -FILE_2=lb.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelStatistics.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ConnectorStatistics.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancerOld.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ - SinusoidalFrontTagger.h lb.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.in deleted file mode 100644 index 701ae085..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/Makefile.in +++ /dev/null @@ -1,71 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Test program for performance of load balancers. -## -######################################################################### - -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ -SUBDIR = source/test/performance/LoadBalancers -VPATH = @srcdir@ -OBJECT = ../../../.. - -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 - -default: check - -include $(OBJECT)/config/Makefile.config - -NUM_TESTS = 9 - -TEST_NPROCS = @TEST_NPROCS@ - -CXX_OBJS = lb.o DerivedVisOwnerData.o SinusoidalFrontTagger.o - -INPUTS1D = rod.1d.input -INPUTS2D = rect.2d.treelb.input rod.2d.treelb.input small_cube.2d.caplb.input small_cube.2d.treelb.input small_sphere.2d.caplb.input small_sphere.2d.treelb.input small_front.2d.treelb.input -INPUTS3D = plank.3d.treelb.input small_cube.3d.treelb.input - -main: $(CXX_OBJS) $(LIBSAMRAI) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ - $(LIBSAMRAI) $(LDLIBS) -o $@ - -check: - $(MAKE) check2d - $(MAKE) check3d - -check1d: main - for f in $(INPUTS1D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done - -check2d: main - for f in $(INPUTS2D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done - -check3d: main - for f in $(INPUTS3D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done - -checkcompile: main - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean-check: - $(SAMCLEAN) - -clean: - $(SAMCLEAN) - $(RM) *.f main - -include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.C b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.C deleted file mode 100644 index 9151dd1f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.C +++ /dev/null @@ -1,677 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class implementation - * - ************************************************************************/ -#include "SinusoidalFrontTagger.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/math/HierarchyCellDataOpsReal.h" -#include "SAMRAI/pdat/MDA_Access.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - - - -SinusoidalFrontTagger::SinusoidalFrontTagger( - const std::string& object_name, - const tbox::Dimension& dim, - tbox::Database* database): - d_name(object_name), - d_dim(dim), - d_amplitude(0.2), - d_ghost_cell_width(dim, 0), - d_buffer_cells(dim, 1), - d_allocate_data(true), - d_time(0.5) -{ - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(variable_db != NULL); -#endif - - tbox::Array init_disp; - tbox::Array velocity; - tbox::Array period; - - if (database != NULL) { - d_allocate_data = - database->getBoolWithDefault("allocate_data", - d_allocate_data); - if (database->isInteger("buffer_cells")) { - database->getIntegerArray("buffer_cells", - &d_buffer_cells[0], d_dim.getValue()); - } - for (int ln = 0; true; ++ln) { - std::string name("buffer_space_"); - name = name + tbox::Utilities::intToString(ln); - if (database->isDouble(name)) { - d_buffer_space.resizeArray(d_dim.getValue() * (ln + 1)); - database->getDoubleArray(name, &d_buffer_space[d_dim.getValue() * ln], d_dim.getValue()); - } else { - break; - } - } - if (database->isDouble("period")) { - period = - database->getDoubleArray("period"); - } - if (database->isDouble("init_disp")) { - init_disp = - database->getDoubleArray("init_disp"); - } - if (database->isDouble("velocity")) { - velocity = - database->getDoubleArray("velocity"); - } - d_amplitude = - database->getDoubleWithDefault("amplitude", - d_amplitude); - d_time = - database->getDoubleWithDefault("time", - d_time); - - if (database->isInteger("ghost_cell_width")) { - database->getIntegerArray("ghost_cell_width", - &d_ghost_cell_width[0], d_dim.getValue()); - } - } - - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - d_init_disp[idim] = idim < init_disp.size() ? init_disp[idim] : 0.0; - d_velocity[idim] = idim < velocity.size() ? velocity[idim] : 0.0; - d_period[idim] = idim < period.size() ? period[idim] : 1.0e20; - } - - const std::string context_name = d_name + std::string(":context"); - d_context = variable_db->getContext(context_name); - - boost::shared_ptr dist_var( - new pdat::NodeVariable(dim, d_name + ":dist")); - d_dist_id = variable_db->registerVariableAndContext(dist_var, - d_context, - d_ghost_cell_width); - - boost::shared_ptr tag_var( - new pdat::CellVariable(dim, d_name + ":tag")); - d_tag_id = variable_db->registerVariableAndContext(tag_var, - d_context, - d_ghost_cell_width); - - t_setup = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::setup"); - t_node_pos = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::node_pos"); - t_distance = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::distance"); - t_tag_cells = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::tag_cells"); - t_copy = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontTagger::copy"); -} - - - -SinusoidalFrontTagger::~SinusoidalFrontTagger() -{ -} - - - -void SinusoidalFrontTagger::initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& base_hierarchy, - /*! Level to initialize */ - const int ln, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_base_level, - const bool allocate_data) -{ - NULL_USE(can_be_refined); - NULL_USE(old_base_level); - - TBOX_ASSERT(base_hierarchy); - - /* - * Reference the level object with the given index from the hierarchy. - */ - boost::shared_ptr level( - base_hierarchy->getPatchLevel(ln)); - - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - initializePatchData(patch, - init_data_time, - initial_time, - allocate_data); - } - -#if 0 - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - level->allocatePatchData(d_dist_id); - level->allocatePatchData(d_tag_id); - } - computeLevelData(base_hierarchy, ln, d_time /*init_data_time*/, - d_dist_id, d_tag_id, old_base_level); - } -#endif -} - - - -void SinusoidalFrontTagger::initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) -{ - NULL_USE(initial_time); - - if (d_allocate_data) { - /* - * If instructed, allocate all patch data on the level. - * Allocate only persistent data. Scratch data will - * generally be allocated and deallocated as needed. - */ - if (allocate_data) { - if (!patch.checkAllocated(d_dist_id)) { - patch.allocatePatchData(d_dist_id); - } - if (!patch.checkAllocated(d_tag_id)) { - patch.allocatePatchData(d_tag_id); - } - boost::shared_ptr > dist_data( - patch.getPatchData(d_dist_id), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > tag_data( - patch.getPatchData(d_tag_id), - boost::detail::dynamic_cast_tag()); - TBOX_ASSERT(dist_data); - TBOX_ASSERT(tag_data); - computePatchData(patch, init_data_time, - dist_data.get(), tag_data.get()); - } - } -} - - - -void SinusoidalFrontTagger::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - - - -void SinusoidalFrontTagger::applyGradientDetector( - const boost::shared_ptr& base_hierarchy_, - const int ln, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation) -{ - NULL_USE(initial_time); - NULL_USE(uses_richardson_extrapolation); - TBOX_ASSERT(base_hierarchy_); - boost::shared_ptr level_( - base_hierarchy_->getPatchLevel(ln)); - TBOX_ASSERT(level_); - - hier::PatchLevel& level = *level_; - - for (hier::PatchLevel::iterator pi(level.begin()); - pi != level.end(); ++pi) { - hier::Patch& patch = **pi; - - boost::shared_ptr tag_data( - patch.getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); - if (!tag_data) { - TBOX_ERROR("Data index " << tag_index - << " does not exist for patch.\n"); - } - boost::shared_ptr > tag_cell_data_( - tag_data, - boost::detail::dynamic_cast_tag()); - if (!tag_cell_data_) { - TBOX_ERROR("Data index " << tag_index - << " is not cell int data.\n"); - } - - if (d_allocate_data) { - // Use internally stored data. - boost::shared_ptr saved_tag_data( - patch.getPatchData(d_tag_id), - boost::detail::dynamic_cast_tag()); - tag_cell_data_->copy(*saved_tag_data); - } else { - // Compute tag data for patch. - computePatchData(patch, - error_data_time, - NULL, - tag_cell_data_.get()); - } - - } -} - - - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchHierarchy& hierarchy) -{ - int ln; - for (ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - boost::shared_ptr level(hierarchy.getPatchLevel(ln)); - deallocatePatchData(*level); - } -} - - - -/* - * Deallocate patch data allocated by this class. - */ - -void SinusoidalFrontTagger::deallocatePatchData( - hier::PatchLevel& level) -{ - level.deallocatePatchData(d_dist_id); - level.deallocatePatchData(d_tag_id); -} - - - -/* - * Deallocate patch data allocated by this class. - */ -void SinusoidalFrontTagger::computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time) -{ - d_time = time; - if (!d_allocate_data) return; - - for (int ln = 0; ln < hierarchy.getNumberOfLevels(); ++ln) { - computeLevelData(hierarchy, ln, time, d_dist_id, d_tag_id); - } -} - - - -/* - * Compute the solution data for a level. - * Can copy data from old level (if any) to support - * initializeLevelData(). - */ - -void SinusoidalFrontTagger::computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level) const -{ - NULL_USE(old_level); - - const boost::shared_ptr level( - hierarchy.getPatchLevel(ln)); - - /* - * Initialize data in all patches in the level. - */ - for (hier::PatchLevel::iterator pi(level->begin()); - pi != level->end(); ++pi) { - hier::Patch& patch = **pi; - boost::shared_ptr > dist_data; - if (dist_id >= 0) { - dist_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(dist_id)); - } - boost::shared_ptr > tag_data; - if (tag_id >= 0) { - tag_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(tag_id)); - } - computePatchData(patch, time, - dist_data.get(), - tag_data.get()); - } -} - - - -/* - * Compute the solution data for a patch. - */ - -void SinusoidalFrontTagger::computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const -{ - - t_setup->start(); - - TBOX_ASSERT(d_hierarchy); - TBOX_ASSERT(patch.inHierarchy()); - - const int ln = patch.getPatchLevelNumber(); - const boost::shared_ptr level( - d_hierarchy->getPatchLevel(ln)); - const hier::IntVector& ratio(level->getRatioToLevelZero()); - - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const double* xlo = patch_geom->getXLower(); - - const double* dx = patch_geom->getDx(); - - /* - * Compute the size of buffer to tag around cells crossing front. - * They should be at least d_buffer_cells in reference index space - * and at least getBufferSpace(ln) in physical space. - */ - hier::IntVector buffer(d_buffer_cells); - for (int i = 0; i < d_dim.getValue(); ++i) { - const double *buffer_space = getBufferSpace(ln); - if ( buffer_space != NULL ) { - int space_based_buffer = - int(d_buffer_space[ln * d_dim.getValue() + i] / dx[i] + 0.5); - if (space_based_buffer > buffer(i)) { - buffer(i) = space_based_buffer; - } - } - } - buffer *= ratio; - - computeFrontsData( dist_data, tag_data, buffer, xlo, dx, time ); -} - - - -/* - * Compute the various data due to the fronts. - */ -void SinusoidalFrontTagger::computeFrontsData( - pdat::NodeData* dist_data, - pdat::CellData* tag_data, - const hier::IntVector &tag_buffer, - const double xlo[], - const double dx[], - const double time ) const -{ - const tbox::Dimension &dim(tag_buffer.getDim()); - - t_setup->start(); - - if ( dist_data != NULL && tag_data != NULL ) { - TBOX_ASSERT( dist_data->getBox().isSpatiallyEqual(tag_data->getBox()) ); - } - - const hier::Box& pbox = tag_data->getBox(); - - /* - * We need at least tag_buffer ghost cells to compute - * the tags, but the data may not have as many ghost cells. - * So we create temporary patch data with the required - * tag_buffer for computing tag values. (We could give the real - * data the required ghost cells, but that may affect the - * regridding algorithm I'm testing.) - */ - pdat::CellData tmp_tag(pbox, 1, tag_buffer); - - /* - * Determine what x-cell-index contains the sinusoidal front. - */ - - double wave_number[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - wave_number[idim] = 2 * 3.141592654 / d_period[idim]; - } - - t_setup->stop(); - - - /* - * Initialize node x-distances from front. - */ - - t_node_pos->start(); - hier::Box front_box = pbox; - front_box.grow(tag_buffer); - front_box.growUpper(hier::IntVector(d_dim, 1)); - // Squash front_box to a single plane. - front_box.upper(0) = front_box.lower(0) = pbox.lower(0); - pdat::ArrayData front_x(front_box, 1); - pdat::ArrayData::iterator aiend(front_x.getBox(), false); - for ( pdat::ArrayData::iterator ai(front_x.getBox(), true); - ai != aiend; ++ai ) { - - const hier::Index &index = *ai; - double y=0.0, siny=0.0, z=0.0, sinz=1.0; - - y = xlo[1] + dx[1]*(index(1) - pbox.lower()[1]); - siny = sin(wave_number[1] * (y + d_init_disp[1] - d_velocity[1] * time)); - - if ( dim.getValue() > 2 ) { - z = xlo[2] + dx[2]*(index(2) - front_box.lower()[2]); - sinz = sin(wave_number[2] * (z + d_init_disp[2] - d_velocity[2] * time)); - } - - front_x(index,0) = d_amplitude * siny * sinz + d_init_disp[0]; - // tbox::plog << "front_x" << index << " = " << front_x(index,0) << std::endl; - } - t_node_pos->stop(); - - /* - * Initialize tmp_tag to zero then tag specific cells. - */ - tmp_tag.fill(0); - hier::BlockId blk0(0); - pdat::CellData::iterator ciend(tmp_tag.getGhostBox(), false); - for ( pdat::CellData::iterator ci(tmp_tag.getGhostBox(), true); - ci != ciend; ++ci ) { - - const pdat::CellIndex &cell_index = *ci; - const hier::Box cell_box(cell_index, cell_index, blk0); - -#if 0 - int node_orientation = 0; -#endif - double min_distance_to_front = tbox::MathUtilities::getMax(); - double max_distance_to_front = -tbox::MathUtilities::getMax(); - // tbox::plog << "initial distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - pdat::NodeIterator niend(cell_box, false); - for ( pdat::NodeIterator ni(cell_box, true); ni != niend; ++ni ) { - - const pdat::NodeIndex &node_index = *ni; - hier::Index front_index = node_index; - front_index(0) = pbox.lower(0); - - double node_x = xlo[0] + dx[0]*( node_index(0) - pbox.lower()(0) ); - - double distance_to_front = node_x - front_x(front_index,0); - min_distance_to_front = tbox::MathUtilities::Min(min_distance_to_front, distance_to_front); - max_distance_to_front = tbox::MathUtilities::Max(max_distance_to_front, distance_to_front); - // tbox::plog << "cell_index = " << cell_index << " node_index = " << node_index << " node_x = " << node_x << " front_index = " << front_index << " front_x = " << front_x(front_index,0) << " distance to front(" << node_x << ") = " << distance_to_front << std::endl; - -#if 0 - while ( distance_to_front > 0.5*d_period[0] ) distance_to_front -= d_period[0]; - while ( distance_to_front < -0.5*d_period[0] ) distance_to_front += d_period[0]; - // tbox::plog << "distance_to_front adjusted = " << distance_to_front << std::endl; - int distance_sign = distance_to_front < 0 ? -1 : 1; - if ( node_orientation == 0 ) { - node_orientation = distance_sign; - } - else { - if ( distance_sign != node_orientation ) { - // This cell has nodes on both sides of the front. Tag it and the tag_buffer around it. - hier::Box cell_and_buffer(cell_index, cell_index); - cell_and_buffer.grow(tag_buffer); - tmp_tag.fill(1,cell_and_buffer); - } - } -#endif - } - // tbox::plog << "distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - while ( min_distance_to_front < -0.5*d_period[0] ) { - min_distance_to_front += d_period[0]; - max_distance_to_front += d_period[0]; - } - while ( max_distance_to_front > 0.5*d_period[0] ) { - min_distance_to_front -= d_period[0]; - max_distance_to_front -= d_period[0]; - } - // tbox::plog << "shifted ..........: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - if ( min_distance_to_front < 0 && max_distance_to_front > 0 ) { - // This cell has nodes on both sides of the front. Tag it and the tag_buffer around it. - hier::Box cell_and_buffer(cell_index, cell_index, blk0); - cell_and_buffer.grow(tag_buffer); - tmp_tag.fill(1,cell_and_buffer); - } - - } - - - /* - * Initialize distance data. - */ - if (dist_data != NULL) { - t_distance->start(); - - pdat::NodeData &dist_to_front(*dist_data); - pdat::NodeData::iterator ni(dist_to_front.getGhostBox(), true); - pdat::NodeData::iterator niend(dist_to_front.getGhostBox(), false); - for ( ; ni != niend; ++ni) { - const pdat::NodeIndex& index = *ni; - pdat::NodeIndex front_index(index); - front_index(0) = 0; - dist_to_front(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_x(front_index,0); - } - // dist_to_front.print(dist_to_front.getBox(),0,plog); - - t_distance->stop(); - } - - t_copy->start(); - tag_data->copy(tmp_tag); - t_copy->stop(); -} - - - -#ifdef HAVE_HDF5 -int SinusoidalFrontTagger::registerVariablesWithPlotter( - appu::VisItDataWriter& writer) -{ - /* - * Register variables with plotter. - */ - if (d_allocate_data) { - writer.registerPlotQuantity("Distance to front", "SCALAR", d_dist_id); - writer.registerPlotQuantity("Tag value", "SCALAR", d_tag_id); - } else { - writer.registerDerivedPlotQuantity("Distance to front", "SCALAR", this, - // hier::IntVector(0), - 1.0, - "NODE"); - writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); - } - return 0; -} -#endif - - - -bool SinusoidalFrontTagger::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - NULL_USE(region); - NULL_USE(depth_index); - - TBOX_ASSERT(d_allocate_data == false); - if (variable_name == "Distance to front") { - pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, - 0)); - computePatchData(patch, d_time, &dist_data, NULL); - pdat::NodeData::iterator ciend(patch.getBox(), false); - for (pdat::NodeData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = dist_data(*ci); - } - } else if (variable_name == "Tag value") { - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - computePatchData(patch, d_time, NULL, &tag_data); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} - - - -void SinusoidalFrontTagger::setTime( - double time) -{ - d_time = time; -} - - - -const double *SinusoidalFrontTagger::getBufferSpace( int ln ) const -{ - if ( d_buffer_space.size() > ln*d_dim.getValue() ) { - return &d_buffer_space[ln*d_dim.getValue()]; - } - return NULL; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.h b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.h deleted file mode 100644 index c6ac9c13..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/SinusoidalFrontTagger.h +++ /dev/null @@ -1,273 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontTagger class declaration - * - ************************************************************************/ -#ifndef included_SinusoidalFrontTagger -#define included_SinusoidalFrontTagger - -#include -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Timer.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Class to tag a sinusoidal "front" in given domain. - */ -class SinusoidalFrontTagger: - public mesh::StandardTagAndInitStrategy, - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - SinusoidalFrontTagger( - /*! Ojbect name */ - const std::string& object_name, - const tbox::Dimension& dim, - /*! Input database */ - tbox::Database* database = NULL); - - ~SinusoidalFrontTagger(); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - /*! - * @brief Allocate and initialize data for a new level - * in the patch hierarchy. - * - * This is where you implement the code for initialize data on the - * grid. Nevermind when it is called or where in the program that - * happens. All the information you need to initialize the grid - * are in the arguments. - * - * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() - */ - virtual void - initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr& hierarchy, - /*! Level to initialize */ - const int level_number, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr& old_level = - boost::shared_ptr(), - /*! Whether data on new patch needs to be allocated */ - const bool allocate_data = true); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr& new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level); - - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data); - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - - void - setTime( - double time); - -public: - /*! - * @brief Deallocate internally managed patch data on level. - */ - void - deallocatePatchData( - hier::PatchLevel& level); - - /*! - * @brief Deallocate internally managed patch data on hierarchy. - */ - void - deallocatePatchData( - hier::PatchHierarchy& hierarchy); - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - - /* - * Compute patch data allocated by this class, on a hierarchy. - */ - void - computeHierarchyData( - hier::PatchHierarchy& hierarchy, - double time); - - /*! - * @brief Compute distance and tag data for a level. - */ - void - computeLevelData( - const hier::PatchHierarchy& hierarchy, - const int ln, - const double time, - const int dist_id, - const int tag_id, - const boost::shared_ptr& old_level = - boost::shared_ptr()) const; - - /*! - * @brief Compute distance and tag data for a patch. - */ - void - computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const; - - /*! - * @brief Compute distance and tag data for a patch. - * - * This method is not specific to data on the hierarchy, - * so it is of more general use. It does not require the - * hierarchy. - */ - void computeFrontsData( - pdat::NodeData* dist_data, - pdat::CellData* tag_data, - const hier::IntVector &buffer, - const double xlo[], - const double dx[], - const double time ) const; - -private: - - const double *getBufferSpace(int ln) const; - - std::string d_name; - - const tbox::Dimension d_dim; - - /*! - * @brief PatchHierarchy for use in implementations of some - * abstract interfaces that do not specify a hierarch. - */ - boost::shared_ptr d_hierarchy; - - /*! - * @brief Period of sinusoid. - */ - double d_period[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Initial displacement. - */ - double d_init_disp[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Front velocity. - */ - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Amplitude of sinusoid. - */ - double d_amplitude; - - /*! - * @brief ghost cell width of internal data. - * - * Optional. Meant to influence gridding parameters. Defaults to zero. - */ - hier::IntVector d_ghost_cell_width; - - /*! - * @brief Number of cells to tag around cells intersecting the front. - */ - hier::IntVector d_buffer_cells; - - /*! - * @brief Buffer size in physical space. - * - * d_buffer_space[ln*d_dim + d] is the buffer size for level ln in direction d. - */ - tbox::Array d_buffer_space; - - boost::shared_ptr d_context; - - /*! - * @brief Distance from the front in the x direction. - */ - int d_dist_id; - /*! - * @brief Value of tag based on distance from front. - */ - int d_tag_id; - - /*! - * @brief Whether to allocate data on the mesh. - */ - bool d_allocate_data; - - /*! - * @brief Front time. - */ - double d_time; - - boost::shared_ptr t_setup; - boost::shared_ptr t_node_pos; - boost::shared_ptr t_distance; - boost::shared_ptr t_tag_cells; - boost::shared_ptr t_copy; - -}; - -#endif // included_ssup_SinusoidalFrontTagger diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.2d.treelb.input deleted file mode 100644 index ad6fe241..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.2d.treelb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "big_cube.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(499,499)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(499,499)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(489,489)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.caplb.input deleted file mode 100644 index 309ecad9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.caplb.input +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "big_cube.3d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,99)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(99,99,99)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(89,89,89)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.treelb.input deleted file mode 100644 index 872339ec..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/big_cube.3d.treelb.input +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "big_cube.3d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,99)] - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserBoxes" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(89,89,89)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.2d.treelb.input deleted file mode 100644 index ddbe85a4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.2d.treelb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "huge_cube.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(999,999)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(999,999)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(989,989)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.3d.treelb.input deleted file mode 100644 index 83a417c2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/huge_cube.3d.treelb.input +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "huge_cube.3d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(199,199,199)] - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserBoxes" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(189,189,189)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.caplb.input deleted file mode 100644 index a0ff8fc7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.caplb.input +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "med_cube.2d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(299,299)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(299,299)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(289,289)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -ChopAndPackLoadBalancer { - max_workload_factor = 1.0 -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.treelb.input deleted file mode 100644 index a8494c66..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.2d.treelb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "med_cube.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(299,299)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(299,299)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(289,289)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.caplb.input deleted file mode 100644 index f4caca75..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.caplb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "med_cube.3d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(49,49,49)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(49,49,49)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 2, 2, 2 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(44,44,44)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.treelb.input deleted file mode 100644 index 54457558..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/med_cube.3d.treelb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "med_cube.3d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(49,49,49)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(49,49,49)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 2, 2, 2 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(44,44,44)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.caplb.input deleted file mode 100644 index fa53c4d0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.caplb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_cube.3d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(19,19,19)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(19,19,19)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 2, 2, 2 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(14,14,14)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.treelb.input deleted file mode 100644 index 557a8e4b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/cube_inputs/small_cube.3d.treelb.input +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_cube.3d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(19,19,19)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(19,19,19)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 2, 2, 2 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(14,14,14)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.2d.treelb.input deleted file mode 100644 index c719a226..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.2d.treelb.input +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - - -Main { - dim = 2 - - base_name = "huge_front.2d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(799,399)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 16.0, 8.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(199,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.3d.treelb.input deleted file mode 100644 index d5904528..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/huge_front.3d.treelb.input +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "huge_front.3d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(199,99,99)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 4.0, 2.0, 2.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0,0),(199,99,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0,36),(36,36,36)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.2d.treelb.input deleted file mode 100644 index 708d0c69..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.2d.treelb.input +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "large_front.2d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(399,199)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 8.0, 4.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(199,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.3d.treelb.input deleted file mode 100644 index f349f5d8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/large_front.3d.treelb.input +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "large_front.3d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,99)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 2.0, 2.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0,0),(199,99,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0,36),(36,36,36)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.2d.treelb.input deleted file mode 100644 index 66578e19..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.2d.treelb.input +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "med_front.2d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,99)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 4.0, 2.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(199,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.3d.treelb.input deleted file mode 100644 index d73ea7df..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/med_front.3d.treelb.input +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "med_front.3d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,49)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 2.0, 1.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0,0),(199,99,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0,36),(36,36,36)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.2d.treelb.input deleted file mode 100644 index aef4073d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.2d.treelb.input +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "scaled_front.2d.treelb" - log_all_nodes = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,99)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 4.0, 2.0 - - /* - Use num_procs_in_tile if you want to scale up the problem - size by tiling the domain. Tiling doubles the domain - size one direction at a time, starting with the j-direction. - - When tiling, we keep constant the ratio of the domain size to - num_procs_in_tile and double the domain as many times as needed - for the number of MPI processes running. We require that the - number of MPI processes be a power-of-two times - num_procs_in_tile. - */ - num_procs_in_tile = 1 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(199,99)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.3d.treelb.input deleted file mode 100644 index a8c28ca8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/front_inputs/scaled_front.3d.treelb.input +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "scaled_front.3d.treelb" - log_all_nodes = FALSE - write_visit = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(15,7,7)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - /* - Use num_procs_in_tile if you want to scale up the problem - size by tiling the domain. Tiling doubles the domain - size one direction at a time, starting with the j-direction - and cycles through all directions repeatedly. - - When tiling, we keep constant the ratio of the domain size to - num_procs_in_tile and double the domain as many times as needed - for the number of MPI processes running. We require that the - number of MPI processes be a power-of-two times - num_procs_in_tile. - */ - num_procs_in_tile = 8 - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.85 - combine_tol = 0.85 - tag_buffer = 2, 2, 2 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 5, 5, 5 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TreeLoadBalancerOld { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3,3,3 - level_1 = 6,6,6 - level_2 = 6,6,6 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/lb.C b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/lb.C deleted file mode 100644 index 74d668b0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/lb.C +++ /dev/null @@ -1,1684 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Test program for performance and quality of TreeLoadBalancer. - * - ************************************************************************/ -#include "SAMRAI/SAMRAI_config.h" - -#include - -#include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxLevel.h" -#include "SAMRAI/hier/BoxLevelStatistics.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/hier/Connector.h" -#include "SAMRAI/hier/ConnectorStatistics.h" -#include "SAMRAI/hier/BoxLevelConnectorUtils.h" -#include "SAMRAI/hier/OverlapConnectorAlgorithm.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/mesh/BalanceUtilities.h" -#include "SAMRAI/mesh/TreeLoadBalancer.h" -#include "SAMRAI/mesh/TreeLoadBalancerOld.h" -#include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/appu/VisItDataWriter.h" - -#include "SAMRAI/tbox/InputDatabase.h" -#include "SAMRAI/tbox/InputManager.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/TimerManager.h" -#include - -#include "DerivedVisOwnerData.h" -#include "SinusoidalFrontTagger.h" - -using namespace SAMRAI; -using namespace tbox; - -/* - ************************************************************************ - * - * - ************************************************************************* - */ - -void -generatePrebalance( - hier::BoxLevel &Lb, - hier::BoxLevel &La, - hier::Connector &La_to_Lb, - hier::Connector &Lb_to_La, - const std::string &Lb_box_gen_method, - tbox::Database &main_db, - const boost::shared_ptr &hierarchy, - int coarser_ln, - const hier::IntVector &min_size, - const hier::IntVector &required_connector_width ); - -void -generatePrebalanceByUserBoxes( - hier::BoxLevel& L1, - hier::Connector& L0_to_L1, - hier::Connector& balance_to_L0, - const hier::BoxLevel& L0, - boost::shared_ptr database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ); - -void -generatePrebalanceByUserShells( - hier::BoxLevel& L1, - hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, - const hier::BoxLevel& L0, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ); - -void -generatePrebalanceBySinusoidalFront( - hier::BoxLevel& L1, - hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, - const hier::BoxLevel& L0, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - int coarser_ln, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ); - -void -generatePrebalanceByShrinkingLevel( - hier::BoxLevel& L2, - hier::Connector& L1_to_L2, - hier::Connector& L2_to_L1, - const hier::BoxLevel& L1, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - int coarser_ln, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ); - -void -sortNodes( - hier::BoxLevel& new_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - bool sort_by_corners, - bool sequentialize_global_indices); - -void -refineHead( - hier::BoxLevel& head, - hier::Connector& ref_to_head, - hier::Connector& head_to_ref, - const hier::IntVector &refinement_ratio ); - -void outputMetadataL0( - const hier::BoxLevel &L0, - const hier::Connector &L0_to_L0, - int level_output_depth = 1, - int connector_output_depth = 0 ); - -void outputMetadataBefore( - const hier::Connector &La_to_Lb, - const hier::Connector &Lb_to_La, - const std::string &La_name, - const std::string &Lb_name, - int level_output_depth = 1, - int connector_output_depth = 0 ); - -void outputMetadataAfter( - const hier::Connector &La_to_Lb, - const hier::Connector &Lb_to_La, - const hier::Connector &Lb_to_Lb, - const std::string &La_name, - const std::string &Lb_name, - int level_output_depth = 1, - int connector_output_depth = 0 ); - -boost::shared_ptr -createLoadBalancer( - boost::shared_ptr &input_db, - const std::string &lb_type, - int ln, - const tbox::Dimension &dim ); - - -/* -******************************************************************************** -* -* Performance testing for load balancers. -* -* 1. Build "level 0" from the domain description (input parameter -* "domain_boxes"). L0 is for doing the test, not for checking load -* balancer performance. -* -* 2. Build "level 1" and write out performance data for balancing it. -* The prebalance boxes for L1 are user-specified (input parameter -* "L1_box_gen_method"). This configuration tries to mimick real problems -* where the tags occupy a small portion of the tag level, leading to a -* limited number of owners for prebalance boxes. -* -* 3. Build "level 2" and write out performance data for balancing it. -* The prebalance boxes for L2 are generated by clustering tags on L1. -* All L1 cells are tagged except for a small margin by the L1 boundary -* (input parameter "tag_margin". This configuration tries to mimick -* real problems where the tags occupy a large portion of the tag -* level, leading to a greater number of owners for prebalance boxes. -* -******************************************************************************** -*/ - -int main( - int argc, - char* argv[]) -{ - /* - * Initialize MPI, SAMRAI. - */ - - SAMRAI_MPI::init(&argc, &argv); - SAMRAIManager::initialize(); - SAMRAIManager::startup(); - tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - - const int rank = mpi.getRank(); - int fail_count = 0; - - /* - * Process command line arguments. For each run, the input - * filename must be specified. Usage is: - * - * executable - */ - std::string input_filename; - - if (argc < 2) { - TBOX_ERROR("USAGE: " << argv[0] << " [case name]\n" - << " options:\n" - << " none at this time" << std::endl); - } else { - input_filename = argv[1]; - } - - std::string case_name; - if (argc > 2) { - case_name = argv[2]; - } - - { - /* - * Scope to force destruction of objects that would otherwise - * leave allocated memory reported by the memory test. - */ - - /* - * Create input database and parse all data in input file. - */ - - boost::shared_ptr input_db(new InputDatabase("input_db")); - boost::shared_ptr base_db(input_db); - tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); - - /* - * Set up the timer manager. - */ - if (input_db->isDatabase("TimerManager")) { - TimerManager::createManager(input_db->getDatabase("TimerManager")); - } - - /* - * Retrieve "Main" section from input database. - * The main database is used only in main(). - * The base_name variable is a base name for - * all name strings in this program. - */ - - boost::shared_ptr main_db(input_db->getDatabase("Main")); - - const tbox::Dimension - dim(static_cast(main_db->getInteger("dim"))); - - const hier::IntVector &zero_vec = hier::IntVector::getZero(dim); - - std::string base_name = "unnamed"; - base_name = main_db->getStringWithDefault("base_name", base_name); - - /* - * Modify basename for this particular run. - * Add the number of processes and the case name. - */ - if (!case_name.empty()) { - base_name = base_name + '-' + case_name; - } - base_name = base_name + '-' + tbox::Utilities::intToString( - mpi.getSize(), - 5); - tbox::plog << "Added case name (" << case_name << ") and nprocs (" - << mpi.getSize() << ") to base name -> '" - << base_name << "'\n"; - - if (!case_name.empty()) { - tbox::plog << "Added case name (" << case_name << ") and nprocs (" - << mpi.getSize() << ") to base name -> '" - << base_name << "'\n"; - } - - /* - * Start logging. - */ - const std::string log_file_name = base_name + ".log"; - bool log_all_nodes = false; - log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", - log_all_nodes); - if (log_all_nodes) { - PIO::logAllNodes(log_file_name); - } else { - PIO::logOnlyNodeZero(log_file_name); - } - - plog << "Input database after initialization..." << std::endl; - input_db->printClassData(plog); - - - - /* - * Parameters. Some of these can be specified by input deck. - */ - hier::IntVector ghost_cell_width(dim, 2); - if (main_db->isInteger("ghost_cell_width")) { - main_db->getIntegerArray("ghost_cell_width", &ghost_cell_width[0], dim.getValue()); - } - - hier::IntVector bad_interval(dim, 2); - hier::IntVector cut_factor(dim, 1); - - hier::OverlapConnectorAlgorithm oca; - - - - /* - * Set up the domain from input. - */ - - hier::BoxContainer input_boxes(main_db->getDatabaseBoxArray("domain_boxes")); - - hier::BoxContainer domain_boxes; - hier::LocalId local_id(0); - for (hier::BoxContainer::iterator itr = input_boxes.begin(); - itr != input_boxes.end(); ++itr) { - itr->setBlockId(hier::BlockId(0)); - domain_boxes.pushBack(hier::Box(*itr, local_id++, 0)); - } - - std::vector xlo(dim.getValue()); - std::vector xhi(dim.getValue()); - for (int i = 0; i < dim.getValue(); ++i) { - xlo[i] = 0.0; - xhi[i] = 1.0; - } - if (main_db->isDouble("xlo")) { - main_db->getDoubleArray("xlo", &xlo[0], dim.getValue()); - } - if (main_db->isDouble("xhi")) { - main_db->getDoubleArray("xhi", &xhi[0], dim.getValue()); - } - - /* - * If num_procs_in_tile is given, take the domain_boxes, xlo and xhi - * to be the size for the (integer) value of num_procs_in_tile. Scale - * the problem from there to the number of process running by - * doubling the dimension starting with the j direction. - * - * The number of processes must be a power of 2 times the value - * of num_procs_in_tile. - */ - if ( main_db->isInteger("num_procs_in_tile") ) { - int num_procs_in_tile = main_db->getInteger("num_procs_in_tile"); - int doubling_dir = 1; - - while (num_procs_in_tile < mpi.getSize()) { - for ( hier::BoxContainer::iterator bi=domain_boxes.begin(); - bi!=domain_boxes.end(); ++bi ) { - hier::Box &input_box = *bi; - input_box.upper()(doubling_dir) += input_box.numberCells(doubling_dir); - } - xhi[doubling_dir] += xhi[doubling_dir] - xlo[doubling_dir]; - doubling_dir = (doubling_dir + 1)%dim.getValue(); - num_procs_in_tile *= 2; - tbox::plog << "num_procs_in_tile = " << num_procs_in_tile << std::endl - << domain_boxes.format("IB: ", 2) << std::endl; - } - - if ( num_procs_in_tile != mpi.getSize() ) { - TBOX_ERROR("If num_procs_in_tile (" << num_procs_in_tile << ") is given,\n" - <<"number of processes (" << mpi.getSize() << ") must be\n" - <<"a power-of-2 times the value of num_procs_in_tile."); - } - - } - - - { - /* - * Add a dummy PatchData with a big ghost width. - * GridGeometry forbids increasing the max data ghost width - * after it starts computing boundary boxes for a patch. We - * force it to accept a big ghost width here so that the - * methods below (particularly those registering tag - * data) won't crash by asking for more ghost width than what - * was registered when the first boundary boxes were - * computed. - */ - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); - - boost::shared_ptr > dummy_variable( - new pdat::CellVariable(dim, "DummyVariable")); - - boost::shared_ptr dummy_context( - vdb->getContext("DUMMY")); - - vdb->registerVariableAndContext( - dummy_variable, - dummy_context, - hier::IntVector(dim,10)); - } - - - - /* - * Create hierarchy. - */ - - boost::shared_ptr grid_geometry( - new geom::CartesianGridGeometry( - "GridGeometry", - &xlo[0], - &xhi[0], - domain_boxes)); - - boost::shared_ptr hierarchy( - new hier::PatchHierarchy( - "Hierarchy", - grid_geometry, - input_db->getDatabase("PatchHierarchy") )); - - const int max_levels = hierarchy->getMaxNumberOfLevels(); - - hier::BoxLevel domain_box_level( - hier::IntVector(dim, 1), - grid_geometry, - tbox::SAMRAI_MPI::getSAMRAIWorld(), - hier::BoxLevel::GLOBALIZED); - hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); - for (int i = 0; i < domain_boxes.size(); ++i, ++domain_boxes_itr) { - domain_box_level.addBox(hier::Box(*domain_boxes_itr, - hier::LocalId(i), 0)); - } - - - /* - * Set up the load balancers. - */ - - - - std::string load_balancer_type = - main_db->getStringWithDefault("load_balancer_type", "TreeLoadBalancer"); - - - - - /* - * Step 1: Build L0. - */ - tbox::pout << "\nGenerating L0" << std::endl; - - hier::BoxLevel L0(hier::IntVector(dim, 1), grid_geometry); - - { - hier::BoxContainer L0_boxes( - main_db->isDatabase("L0_boxes") ? - main_db->getDatabaseBoxArray("L0_boxes") : domain_boxes ); - const int boxes_per_proc = - (L0_boxes.size() + L0.getMPI().getSize() - - 1) / L0.getMPI().getSize(); - const int my_boxes_start = L0.getMPI().getRank() - * boxes_per_proc; - const int my_boxes_stop = - tbox::MathUtilities::Min(my_boxes_start + boxes_per_proc, - L0_boxes.size()); - hier::BoxContainer::iterator L0_boxes_itr(L0_boxes); - for (int i = 0; i < my_boxes_start; ++i) { - ++L0_boxes_itr; - } - for (int i = my_boxes_start; i < my_boxes_stop; ++i, ++L0_boxes_itr) { - L0.addBox(*L0_boxes_itr, hier::BlockId::zero()); - } - } - - { - /* - * Load balance the L0 BoxLevel, using the domain as its L0. - * - * This is not a part of the performance test because does not - * reflect the load balancer use in real apps. We just neeed a - * distributed L0 for the real load balancing performance test. - */ - hier::Connector L0_to_domain( - L0, - domain_box_level, - hier::IntVector(dim, 2)); - hier::Connector domain_to_L0( - domain_box_level, - L0, - hier::IntVector(dim, 2)); - oca.findOverlaps(L0_to_domain); - oca.findOverlaps(domain_to_L0); - - boost::shared_ptr lb0( - createLoadBalancer( base_db, load_balancer_type, 0, dim )); - - tbox::plog << "\n\n\ninitial L0 loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L0.getLocalNumberOfCells(), - L0.getMPI()); - - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - lb0->loadBalanceBoxLevel( - L0, - L0_to_domain, - domain_to_L0, - hierarchy, - 0, - hier::Connector(), - hier::Connector(), - hierarchy->getSmallestPatchSize(0), - hierarchy->getLargestPatchSize(0), - domain_box_level, - bad_interval, - cut_factor); - - sortNodes(L0, - domain_to_L0, - L0_to_domain, - false, - true); - - oca.assertOverlapCorrectness(L0_to_domain); - oca.assertOverlapCorrectness(domain_to_L0); - - L0.cacheGlobalReducedData(); - - tbox::plog << "\n\n\nfinal L0 loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L0.getLocalNumberOfCells(), - L0.getMPI()); - - outputMetadataL0( - L0, - L0.getPersistentOverlapConnectors(). - findOrCreateConnector( L0, ghost_cell_width, true ) ); - } - - - - hier::BoxLevel L1(dim); - hier::Connector L1_to_L0; - hier::Connector L0_to_L1; - hier::Connector L1_to_L1; - - hier::BoxLevel L2(dim); - hier::Connector L2_to_L1; - hier::Connector L1_to_L2; - hier::Connector L2_to_L2; - - - - if ( max_levels > 1 ) { - /* - * Step 2: Build L1. - */ - tbox::pout << "\nGenerating L1" << std::endl; - - - const int coarser_ln = 0; - const int finer_ln = coarser_ln + 1; - - // Get the prebalanced L1: - const hier::IntVector required_connector_width = - hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); - const hier::IntVector min_size = hier::IntVector::ceilingDivide( - hierarchy->getSmallestPatchSize(finer_ln), hierarchy->getRatioToCoarserLevel(finer_ln) ); - - std::string L1_box_gen_method = - main_db->getStringWithDefault("L1_box_gen_method", "PrebalanceByUserBoxes"); - generatePrebalance( - L1, - L0, - L0_to_L1, - L1_to_L0, - L1_box_gen_method, - *main_db, - hierarchy, - coarser_ln, - min_size, - required_connector_width ); - - - // Output metadata before balancing L1. - outputMetadataBefore( L0_to_L1, L1_to_L0, "L0", "L1pre" ); - - if ( L1.getGlobalNumberOfBoxes() == 0 ) { - TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); - } - - boost::shared_ptr lb1( - createLoadBalancer( base_db, load_balancer_type, 1 , dim)); - - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L1.getLocalNumberOfCells(), - L1.getMPI()); - - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - // Load balance L1. - lb1->loadBalanceBoxLevel( - L1, - L1_to_L0, - L0_to_L1, - hierarchy, - 1, - hier::Connector(), - hier::Connector(), - hier::IntVector::ceilingDivide(hierarchy->getSmallestPatchSize(1), hierarchy->getRatioToCoarserLevel(1)), - hier::IntVector::ceilingDivide(hierarchy->getLargestPatchSize(1), hierarchy->getRatioToCoarserLevel(1)), - domain_box_level, - bad_interval, - cut_factor); - - oca.assertOverlapCorrectness(L1_to_L0); - oca.assertOverlapCorrectness(L0_to_L1); - - sortNodes(L1, - L0_to_L1, - L1_to_L0, - false, - true); - - // Refine L1. - if ( hierarchy->getRatioToCoarserLevel(1) != zero_vec ) { - refineHead( - L1, - L0_to_L1, - L1_to_L0, - hierarchy->getRatioToCoarserLevel(1) ); - } - - // Get the L1_to_L1 for edge statistics. - oca.bridge( - L1_to_L1, - L1_to_L0, - L0_to_L1, - L1_to_L0, - L0_to_L1); - - // Output metadata after balancing L1. - outputMetadataAfter( L0_to_L1, L1_to_L0, L1_to_L1, "L0", "L1post" ); - - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L1.getLocalNumberOfCells(), - L1.getMPI()); - - } - - - - if ( max_levels > 2 ) { - /* - * Step 3: Build L2. - */ - tbox::pout << "\nGenerating L2" << std::endl; - - const int coarser_ln = 1; - const int finer_ln = coarser_ln + 1; - - // Get the prebalanced L2: - const hier::IntVector required_connector_width = - hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); - const hier::IntVector min_size = hier::IntVector::ceilingDivide( - hierarchy->getSmallestPatchSize(finer_ln), hierarchy->getRatioToCoarserLevel(finer_ln) ); - - std::string L2_box_gen_method = - main_db->getStringWithDefault("L2_box_gen_method", "PrebalanceByShrinkingLevel"); - generatePrebalance( - L2, - L1, - L1_to_L2, - L2_to_L1, - L2_box_gen_method, - *main_db, - hierarchy, - coarser_ln, - min_size, - required_connector_width ); - - - // Output metadata before balancing L2. - outputMetadataBefore( L1_to_L2, L2_to_L1, "L1", "L2pre" ); - - if ( L2.getGlobalNumberOfBoxes() == 0 ) { - TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); - } - - boost::shared_ptr lb2( - createLoadBalancer( base_db, load_balancer_type, 2 , dim)); - - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L2.getLocalNumberOfCells(), - L2.getMPI()); - - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - // Load balance L2. - lb2->loadBalanceBoxLevel( - L2, - L2_to_L1, - L1_to_L2, - hierarchy, - 1, - hier::Connector(), - hier::Connector(), - hier::IntVector::ceilingDivide(hierarchy->getSmallestPatchSize(2), hierarchy->getRatioToCoarserLevel(2)), - hier::IntVector::ceilingDivide(hierarchy->getLargestPatchSize(2), hierarchy->getRatioToCoarserLevel(2)), - domain_box_level, - bad_interval, - cut_factor); - - oca.assertOverlapCorrectness(L2_to_L1); - oca.assertOverlapCorrectness(L1_to_L2); - - sortNodes(L2, - L1_to_L2, - L2_to_L1, - false, - true); - - // Refine L2. - if ( hierarchy->getRatioToCoarserLevel(2) != zero_vec ) { - refineHead( - L2, - L1_to_L2, - L2_to_L1, - hierarchy->getRatioToCoarserLevel(2) ); - } - - // Get the L2_to_L2 for edge statistics. - oca.bridge( - L2_to_L2, - L2_to_L1, - L1_to_L2, - L2_to_L1, - L1_to_L2); - - // Output metadata after balancing L2. - outputMetadataAfter( L1_to_L2, L2_to_L1, L2_to_L2, "L1", "L2post" ); - - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L2.getLocalNumberOfCells(), - L2.getMPI()); - - } - - - - - bool write_visit = - main_db->getBoolWithDefault("write_visit", false); - if ( write_visit ) { -#ifdef HAVE_HDF5 - hierarchy->makeNewPatchLevel(0, L0); - if ( hierarchy->getMaxNumberOfLevels() > 1 ) { - hierarchy->makeNewPatchLevel(1, L1); - } - if ( hierarchy->getMaxNumberOfLevels() > 2 ) { - hierarchy->makeNewPatchLevel(2, L2); - } - - if ((dim == tbox::Dimension(2)) || (dim == tbox::Dimension(3))) { - /* - * Create the VisIt data writer. - * Write the plot file. - */ - DerivedVisOwnerData owner_writer; - const std::string visit_filename = base_name + ".visit"; - appu::VisItDataWriter visit_data_writer(dim, - "VisIt Writer", - visit_filename); - visit_data_writer.registerDerivedPlotQuantity("Owner", - "SCALAR", - &owner_writer); - visit_data_writer.writePlotData(hierarchy, 0); - } -#else - TBOX_WARNING("main: You set write_visit to TRUE,\n" - << "but VisIt dumps are not supported due to\n" - << "not having configured with HDF5.\n"); -#endif - } - - } - - /* - * Output timer results. - */ - tbox::TimerManager::getManager()->print(tbox::plog); - - - /* - * Print input database again to fully show usage. - */ - plog << "Input database after running..." << std::endl; - tbox::InputManager::getManager()->getInputDatabase()->printClassData(plog); - - tbox::pout << "\nPASSED: treelb" << std::endl; - - /* - * Exit properly by shutting down services in correct order. - */ - tbox::plog << "\nShutting down..." << std::endl; - - /* - * Shut down. - */ - SAMRAIManager::shutdown(); - SAMRAIManager::finalize(); - - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - std::cout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - return fail_count; -} - - - -/* -**************************************************************************** -* Output data for L0. -**************************************************************************** -*/ -void outputMetadataL0( - const hier::BoxLevel &L0, - const hier::Connector &L0_to_L0, - int level_output_depth, - int connector_output_depth ) -{ - const std::string L0_name("L0"); - const std::string L0_to_L0_name(L0_name + "_to_" + L0_name ); - const std::string arrow("-> "); - - L0.cacheGlobalReducedData(); - - tbox::plog << "\n\n\n" << L0_name << ":\n"; - - hier::BoxLevelStatistics L0_stats(L0); - tbox::plog << L0_name << " stats:\n"; - L0_stats.printBoxStats(tbox::plog, L0_name + arrow); - tbox::plog << L0_name << ":\n" << L0.format( L0_name + arrow, level_output_depth ); - - hier::ConnectorStatistics L0_L0_stats(L0_to_L0); - tbox::plog << L0_to_L0_name << " neighbor stats:\n"; - L0_L0_stats.printNeighborStats(tbox::plog, L0_to_L0_name + arrow ); - tbox::plog << L0_to_L0_name << ":\n" << L0_to_L0.format( L0_to_L0_name + arrow, connector_output_depth ); - - return; -} - - - -/* -**************************************************************************** -* Output "before" data. -**************************************************************************** -*/ -void outputMetadataBefore( - const hier::Connector &La_to_Lb, - const hier::Connector &Lb_to_La, - const std::string &La_name, - const std::string &Lb_name, - int level_output_depth, - int connector_output_depth ) -{ - const hier::BoxLevel &La = La_to_Lb.getBase(); - const hier::BoxLevel &Lb = La_to_Lb.getHead(); - - const std::string La_to_Lb_name(La_name + "_to_" + Lb_name ); - const std::string Lb_to_La_name(Lb_name + "_to_" + La_name ); - const std::string arrow("-> "); - - La.cacheGlobalReducedData(); - Lb.cacheGlobalReducedData(); - - tbox::plog << "\n\n\nBefore balancing " << Lb_name << ":\n"; - - hier::BoxLevelStatistics La_stats(La); - tbox::plog << La_name << " stats:\n"; - La_stats.printBoxStats(tbox::plog, La_name + arrow); - tbox::plog << La_name << ":\n" << La.format( La_name + arrow, level_output_depth ); - - hier::BoxLevelStatistics Lb_stats(Lb); - tbox::plog << Lb_name << " stats:\n"; - Lb_stats.printBoxStats(tbox::plog, Lb_name + arrow); - tbox::plog << Lb_name << ":\n" << Lb.format( Lb_name + arrow, level_output_depth ); - - hier::ConnectorStatistics Lb_La_stats(Lb_to_La); - tbox::plog << Lb_to_La_name << " neighbor stats:\n"; - Lb_La_stats.printNeighborStats(tbox::plog, Lb_to_La_name + arrow ); - tbox::plog << Lb_to_La_name << ":\n" << Lb_to_La.format( Lb_to_La_name + arrow, connector_output_depth ); - - hier::ConnectorStatistics La_Lb_stats(La_to_Lb); - tbox::plog << La_to_Lb_name << " neighbor stats:\n"; - La_Lb_stats.printNeighborStats(tbox::plog, La_to_Lb_name + arrow ); - tbox::plog << La_to_Lb_name << ":\n" << La_to_Lb.format( La_to_Lb_name + arrow, connector_output_depth ); - - return; -} - - - -/* -**************************************************************************** -* Output "after" data. -**************************************************************************** -*/ -void outputMetadataAfter( - const hier::Connector &La_to_Lb, - const hier::Connector &Lb_to_La, - const hier::Connector &Lb_to_Lb, - const std::string &La_name, - const std::string &Lb_name, - int level_output_depth, - int connector_output_depth ) -{ - const hier::BoxLevel &Lb = La_to_Lb.getHead(); - - const std::string La_to_Lb_name(La_name + "_to_" + Lb_name ); - const std::string Lb_to_La_name(Lb_name + "_to_" + La_name ); - const std::string Lb_to_Lb_name(Lb_name + "_to_" + Lb_name ); - const std::string arrow("-> "); - - Lb.cacheGlobalReducedData(); - - tbox::plog << "\n\n\nAfter balancing " << Lb_name << ":\n"; - - hier::BoxLevelStatistics Lb_stats(Lb); - tbox::plog << Lb_name << " stats:\n"; - Lb_stats.printBoxStats(tbox::plog, Lb_name + arrow); - tbox::plog << Lb_name << ":\n" << Lb.format( Lb_name + arrow, level_output_depth ); - - hier::ConnectorStatistics Lb_Lb_stats(Lb_to_Lb); - tbox::plog << Lb_to_Lb_name << " neighbor stats:\n"; - Lb_Lb_stats.printNeighborStats(tbox::plog, Lb_to_Lb_name + arrow ); - tbox::plog << Lb_to_Lb_name << ":\n" << Lb_to_Lb.format( Lb_to_Lb_name + arrow, connector_output_depth ); - - hier::ConnectorStatistics Lb_La_stats(Lb_to_La); - tbox::plog << Lb_to_La_name << " neighbor stats:\n"; - Lb_La_stats.printNeighborStats(tbox::plog, Lb_to_La_name + arrow ); - tbox::plog << Lb_to_La_name << ":\n" << Lb_to_La.format( Lb_to_La_name + arrow, connector_output_depth ); - - hier::ConnectorStatistics La_Lb_stats(La_to_Lb); - tbox::plog << La_to_Lb_name << " neighbor stats:\n"; - La_Lb_stats.printNeighborStats(tbox::plog, La_to_Lb_name + arrow ); - tbox::plog << La_to_Lb_name << ":\n" << La_to_Lb.format( La_to_Lb_name + arrow, connector_output_depth ); - - return; -} - -/* - *********************************************************************** - *********************************************************************** - */ -void generatePrebalanceByUserShells( - hier::BoxLevel& L1, - hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, - const hier::BoxLevel& L0, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ) -{ - - const tbox::Dimension dim(hierarchy->getDim()); - const hier::IntVector &zero_vec(hier::IntVector::getZero(dim)); - const hier::IntVector &one_vec(hier::IntVector::getOne(dim)); - - /* - * Starting at shell origin, tag cells with centroids - * at radii[0] radii; - double efficiency_tol = 0.75; - double combine_tol = 0.75; - - std::vector r0(dim.getValue()); - for (int d = 0; d < dim.getValue(); ++d) r0[d] = 0; - - boost::shared_ptr abr_db; - if (database) { - efficiency_tol = database->getDoubleWithDefault("efficiency_tol", - efficiency_tol); - combine_tol = database->getDoubleWithDefault("combine_tol", combine_tol); - if (database->isDouble("r0")) { - database->getDoubleArray("r0", &r0[0], dim.getValue()); - } - if (database->isDouble("radii")) { - radii = database->getDoubleArray("radii"); - } - abr_db = database->getDatabaseWithDefault("BergerRigoutsos", abr_db); - TBOX_ASSERT(radii.size() % 2 == 0); - } - - const int tag_val = 1; - - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr tag_level( - new hier::PatchLevel(L0, - grid_geometry, - vdb->getPatchDescriptor())); - - boost::shared_ptr > tag_variable( - new pdat::CellVariable( - dim, - "UserShellsTagVariable")); - - boost::shared_ptr default_context( - vdb->getContext("TagVariable")); - - const int tag_id = vdb->registerVariableAndContext( - tag_variable, - default_context, - hier::IntVector::getZero(dim)); - - tag_level->allocatePatchData(tag_id); - - const double* xlo = grid_geometry->getXLower(); - const double* h = grid_geometry->getDx(); - std::vector r(dim.getValue()); - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - const boost::shared_ptr& patch = *pi; - - pdat::NodeData node_tag_data(patch->getBox(), 1, zero_vec); - pdat::NodeData::iterator niend(node_tag_data.getGhostBox(), false); - for (pdat::NodeData::iterator ni(node_tag_data.getGhostBox(), true); - ni != niend; ++ni) { - const pdat::NodeIndex& idx = *ni; - double rr = 0; - for (int d = 0; d < dim.getValue(); ++d) { - r[d] = xlo[d] + h[d] * idx(d) - r0[d]; - rr += r[d] * r[d]; - } - rr = sqrt(rr); - for (int i = 0; i < radii.size(); i += 2) { - if (radii[i] < rr && rr < radii[i + 1]) { - (node_tag_data)(idx) = tag_val; - break; - } - } - } - - boost::shared_ptr > tag_data( - patch->getPatchData(tag_id), - boost::detail::dynamic_cast_tag()); - - tag_data->getArrayData().fillAll(0); - - const hier::BlockId& block_id = patch->getBox().getBlockId(); - - pdat::CellData::iterator ciend(tag_data->getGhostBox(), false); - for (pdat::CellData::iterator ci(tag_data->getGhostBox(), true); - ci != ciend; ++ci) { - const pdat::CellIndex& cid = *ci; - - // Loop through nodes of cell cid. Tag cell if node is tagged. - const hier::Box cell_box(cid,cid, block_id); - pdat::NodeIterator node_itr_end(cell_box, false); - for ( pdat::NodeIterator node_itr(cell_box, true); - node_itr != node_itr_end; ++node_itr ) { - if ( node_tag_data(*node_itr) == tag_val ) { - (*tag_data)(cid) = tag_val; - break; - } - } - } - - } - - mesh::BergerRigoutsos abr(dim, abr_db); - abr.setMPI(L0.getMPI()); - abr.findBoxesContainingTags( - L1, - L0_to_L1, - L1_to_L0, - tag_level, - tag_id, - tag_val, - L0.getGlobalBoundingBox(0), - min_size, - efficiency_tol, - combine_tol, - connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); - - /* - * The clustering step generated Connectors to/from the temporary - * tag_level->getBoxLevel(), which is not the same as the - * L0 BoxLevel. We need to reset the Connectors to use - * the L0 instead. - */ - L0_to_L1.setBase(L0); - L0_to_L1.setHead(L1, true); - L1_to_L0.setBase(L1); - L1_to_L0.setHead(L0, true); - - - /* - * Make L1 nest inside L0 by one cell. - */ - hier::BoxLevel L1nested(dim); - hier::Connector L1_to_L1nested; - hier::BoxLevelConnectorUtils blcu; - blcu.computeInternalParts( L1nested, - L1_to_L1nested, - L1_to_L0, - -one_vec, - grid_geometry->getDomainSearchTree() ); - hier::MappingConnectorAlgorithm mca; - mca.modify( L0_to_L1, - L1_to_L0, - L1_to_L1nested, - &L1, - &L1nested ); - - return; -} - -/* - *********************************************************************** - *********************************************************************** - */ -void generatePrebalanceByShrinkingLevel( - hier::BoxLevel& L2, - hier::Connector& L1_to_L2, - hier::Connector& L2_to_L1, - const hier::BoxLevel& L1, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - int coarser_ln, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ) -{ - - const tbox::Dimension dim(hierarchy->getDim()); - - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - - // Parameters set by database, with defaults. - double efficiency_tol = 1.00; - double combine_tol = 1.00; - hier::IntVector shrink_width(dim, 2); - boost::shared_ptr abr_db; - - if (database) { - - efficiency_tol = database->getDoubleWithDefault("efficiency_tol", - efficiency_tol); - - combine_tol = database->getDoubleWithDefault("combine_tol", combine_tol); - - abr_db = database->getDatabaseWithDefault("BergerRigoutsos", abr_db); - - database->getIntegerArray("shrink_width", &shrink_width[0], dim.getValue()); - } - - - hier::BoxLevel L1tags(dim); - hier::Connector L1_to_L1tags; - const hier::Connector &L1_to_L1 = - L1.getPersistentOverlapConnectors().findOrCreateConnector( - L1, - shrink_width ); - - hier::BoxLevelConnectorUtils blcu; - blcu.computeInternalParts( L1tags, - L1_to_L1tags, - L1_to_L1, - -shrink_width, - grid_geometry->getDomainSearchTree() ); - tbox::plog << "L1_to_L1tags:\n" << L1_to_L1tags.format("L1->L1tags: ", 2); - - - const int tag_val = 1; - - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); - - boost::shared_ptr tag_level( - new hier::PatchLevel( - L1, - grid_geometry, - vdb->getPatchDescriptor())); - - boost::shared_ptr > tag_variable( - new pdat::CellVariable( - dim, - "ShrinkingLevelTagVariable")); - - boost::shared_ptr default_context( - vdb->getContext("TagVariable")); - - const int tag_id = vdb->registerVariableAndContext( - tag_variable, - default_context, - hier::IntVector::getZero(dim)); - - tag_level->allocatePatchData(tag_id); - - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - - const boost::shared_ptr& patch = *pi; - boost::shared_ptr > tag_data( - patch->getPatchData(tag_id), - boost::detail::dynamic_cast_tag()); - - tag_data->getArrayData().fillAll(0); - - if ( !L1_to_L1tags.hasNeighborSet(patch->getBox().getId()) ) { - tag_data->getArrayData().fillAll(1); - } - else { - hier::Connector::ConstNeighborhoodIterator ni = - L1_to_L1tags.find(patch->getBox().getId()); - - for ( hier::Connector::ConstNeighborIterator na = L1_to_L1tags.begin(ni); - na != L1_to_L1tags.end(ni); ++na ) { - - const hier::Box &tag_box = *na; - tag_data->getArrayData().fillAll(1, tag_box); - - } - } - - } - - mesh::BergerRigoutsos abr(dim, abr_db); - abr.setMPI(L1.getMPI()); - abr.findBoxesContainingTags( - L2, - L1_to_L2, - L2_to_L1, - tag_level, - tag_id, - tag_val, - L1.getGlobalBoundingBox(0), - min_size, - efficiency_tol, - combine_tol, - connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); - - - /* - * The clustering step generated Connectors to/from the temporary - * tag_level->getBoxLevel(), which is not the same as the - * L1 BoxLevel. We need to reset the Connectors to use - * the L1 instead. - */ - L1_to_L2.setBase(L1); - L1_to_L2.setHead(L2, true); - L2_to_L1.setBase(L2); - L2_to_L1.setHead(L1, true); - - - /* - * Make L2 nest inside L1 by shrink_width. - */ - const hier::IntVector nesting_width(dim, hierarchy->getProperNestingBuffer(coarser_ln)); - hier::BoxLevel L2nested(dim); - hier::Connector L2_to_L2nested; - blcu.computeInternalParts( L2nested, - L2_to_L2nested, - L2_to_L1, - -nesting_width, - grid_geometry->getDomainSearchTree() ); - hier::MappingConnectorAlgorithm mca; - mca.modify( L1_to_L2, - L2_to_L1, - L2_to_L2nested, - &L2, - &L2nested ); - - return; -} - -/* - *********************************************************************** - *********************************************************************** - */ -void generatePrebalanceBySinusoidalFront( - hier::BoxLevel& L2, - hier::Connector& L1_to_L2, - hier::Connector& L2_to_L1, - const hier::BoxLevel& L1, - const boost::shared_ptr& database, - const boost::shared_ptr& hierarchy, - int coarser_ln, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ) -{ - - const tbox::Dimension dim(hierarchy->getDim()); - - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - - // Parameters set by database, with defaults. - double efficiency_tol = 0.70; - double combine_tol = 0.70; - hier::IntVector tag_buffer(dim, 2); - boost::shared_ptr abr_db; // BergerRigoutsos database. - boost::shared_ptr sft_db; // SinusoidalFrontTagger database. - - if (database) { - - efficiency_tol = database->getDoubleWithDefault("efficiency_tol", - efficiency_tol); - - combine_tol = database->getDoubleWithDefault("combine_tol", combine_tol); - - abr_db = database->getDatabaseWithDefault("BergerRigoutsos", abr_db); - - sft_db = database->getDatabaseWithDefault("SinusoidalFrontTagger", sft_db); - - if ( database->isInteger("tag_buffer") ) { - database->getIntegerArray("tag_buffer", &tag_buffer[0], dim.getValue()); - } - } - - - - - const int tag_val = 1; - - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); - - boost::shared_ptr tag_level( - new hier::PatchLevel( - L1, - grid_geometry, - vdb->getPatchDescriptor())); - - boost::shared_ptr > tag_variable( - new pdat::CellVariable( - dim, - "SinusoidalFrontTagVariable")); - - boost::shared_ptr default_context( - vdb->getContext("TagVariable")); - - const int tag_id = vdb->registerVariableAndContext( - tag_variable, - default_context, - tag_buffer ); - - tag_level->allocatePatchData(tag_id); - - SinusoidalFrontTagger sinusoidal_front_tagger( - "SinusoidalFrontTagger", - dim, - sft_db.get() ); - sinusoidal_front_tagger.resetHierarchyConfiguration(hierarchy, 0, 1); - - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - - const boost::shared_ptr& patch = *pi; - - boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr > tag_data( - patch->getPatchData(tag_id), - boost::detail::dynamic_cast_tag()); - - sinusoidal_front_tagger.computeFrontsData( - NULL /* distance data */, - tag_data.get(), - tag_buffer, - patch_geom->getXLower(), - patch_geom->getDx(), - 0.0 ); - - // tbox::plog << "Tag data for patch " << patch->getBox() << ":\n"; - // tag_data->print(tag_data->getGhostBox(),0,tbox::plog); - - } - - mesh::BergerRigoutsos abr(dim, abr_db); - abr.setMPI(L1.getMPI()); - abr.findBoxesContainingTags( - L2, - L1_to_L2, - L2_to_L1, - tag_level, - tag_id, - tag_val, - L1.getGlobalBoundingBox(0), - min_size, - efficiency_tol, - combine_tol, - connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); - - - /* - * The clustering step generated Connectors to/from the temporary - * tag_level->getBoxLevel(), which is not the same as the - * L1 BoxLevel. We need to reset the Connectors to use - * the L1 instead. - */ - L1_to_L2.setBase(L1); - L1_to_L2.setHead(L2, true); - L2_to_L1.setBase(L2); - L2_to_L1.setHead(L1, true); - - - /* - * Make L2 nest inside L1 by nesting_width. - */ - const hier::IntVector nesting_width(dim, hierarchy->getProperNestingBuffer(coarser_ln)); - hier::BoxLevel L2nested(dim); - hier::Connector L2_to_L2nested; - hier::BoxLevelConnectorUtils blcu; - blcu.computeInternalParts( L2nested, - L2_to_L2nested, - L2_to_L1, - -nesting_width, - grid_geometry->getDomainSearchTree() ); - hier::MappingConnectorAlgorithm mca; - mca.modify( L1_to_L2, - L2_to_L1, - L2_to_L2nested, - &L2, - &L2nested ); - - return; -} - -/* - *********************************************************************** - *********************************************************************** - */ -void generatePrebalanceByUserBoxes( - hier::BoxLevel& L1, - hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, - const hier::BoxLevel& L0, - boost::shared_ptr database, - const boost::shared_ptr& hierarchy, - const hier::IntVector& min_size, - const hier::IntVector& connector_width ) -{ - NULL_USE(min_size); - - const tbox::Dimension& dim(hierarchy->getDim()); - - hier::BoxContainer prebalance_boxes(database->getDatabaseBoxArray("prebalance_boxes")); - tbox::Array initial_owners(1); - initial_owners[0] = 0; - initial_owners = database->getIntegerArray("initial_owners"); - - L1.initialize(hier::IntVector(dim, 1), - hierarchy->getGridGeometry(), - L0.getMPI()); - hier::BoxContainer::iterator prebalance_boxes_itr(prebalance_boxes); - for (int i = 0; i < prebalance_boxes.size(); ++i, ++prebalance_boxes_itr) { - const int owner = i % initial_owners.size(); - if (owner == L1.getMPI().getRank()) { - prebalance_boxes_itr->setBlockId(hier::BlockId(0)); - L1.addBox(hier::Box(*prebalance_boxes_itr, - hier::LocalId(i), owner)); - } - } - - // Generate the balance<===>L0 Connectors. - L1_to_L0.setBase(L1); - L1_to_L0.setHead(L0); - L1_to_L0.setWidth(connector_width, true); - L0_to_L1.setBase(L0); - L0_to_L1.setHead(L1); - L0_to_L1.setWidth(connector_width, true); - hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(L1_to_L0); - oca.findOverlaps(L0_to_L1); - - return; -} - -/* - *********************************************************************** - *********************************************************************** - */ -void sortNodes( - hier::BoxLevel& new_box_level, - hier::Connector& tag_to_new, - hier::Connector& new_to_tag, - bool sort_by_corners, - bool sequentialize_global_indices) -{ - const hier::MappingConnectorAlgorithm mca; - - hier::Connector sorting_map; - hier::BoxLevel seq_box_level(new_box_level.getDim()); - hier::BoxLevelConnectorUtils dlbg_edge_utils; - dlbg_edge_utils.makeSortingMap( - seq_box_level, - sorting_map, - new_box_level, - sort_by_corners, - sequentialize_global_indices); - - mca.modify(tag_to_new, - new_to_tag, - sorting_map, - &new_box_level); - - return; -} - - - - -/* - *********************************************************************** - *********************************************************************** - */ -void refineHead( - hier::BoxLevel& head, - hier::Connector& ref_to_head, - hier::Connector& head_to_ref, - const hier::IntVector &refinement_ratio ) -{ - head.refineBoxes( - head, - refinement_ratio, - head.getRefinementRatio()*refinement_ratio); - head.finalize(); - - const hier::IntVector& head_to_ref_width = - refinement_ratio * head_to_ref.getConnectorWidth(); - head_to_ref.setBase(head); - head_to_ref.setWidth(head_to_ref_width, true); - - ref_to_head.setHead(head, true); - ref_to_head.refineLocalNeighbors(refinement_ratio); - - return; -} - - - - -/* - *********************************************************************** - *********************************************************************** - */ -void generatePrebalance( - hier::BoxLevel &Lb, - hier::BoxLevel &La, - hier::Connector &La_to_Lb, - hier::Connector &Lb_to_La, - const std::string &box_gen_method, - tbox::Database &main_db, - const boost::shared_ptr &hierarchy, - int coarser_ln, - const hier::IntVector &min_size, - const hier::IntVector &required_connector_width ) -{ - boost::shared_ptr box_gen_db( - main_db.getDatabaseWithDefault( - box_gen_method, boost::shared_ptr())); - - if (box_gen_method == "PrebalanceByUserBoxes") { - generatePrebalanceByUserBoxes( - Lb, - La_to_Lb, - Lb_to_La, - La, - box_gen_db, - hierarchy, - min_size, - required_connector_width ); - } else if (box_gen_method == "PrebalanceByUserShells") { - generatePrebalanceByUserShells( - Lb, - La_to_Lb, - Lb_to_La, - La, - box_gen_db, - hierarchy, - min_size, - required_connector_width ); - } else if (box_gen_method == "PrebalanceBySinusoidalFront") { - generatePrebalanceBySinusoidalFront( - Lb, - La_to_Lb, - Lb_to_La, - La, - box_gen_db, - hierarchy, - coarser_ln, - min_size, - required_connector_width ); - } else if (box_gen_method == "PrebalanceByShrinkingLevel") { - generatePrebalanceByShrinkingLevel( - Lb, - La_to_Lb, - Lb_to_La, - La, - box_gen_db, - hierarchy, - coarser_ln, - min_size, - required_connector_width ); - } else { - TBOX_ERROR("Bad box_gen_method: '" << box_gen_method << "'"); - } - - return; -} - -boost::shared_ptr -createLoadBalancer( - boost::shared_ptr &input_db, - const std::string &lb_type, - int ln, - const tbox::Dimension &dim ) -{ - - if (lb_type == "TreeLoadBalancer") { - - boost::shared_ptr tree_lb( - new mesh::TreeLoadBalancer( - dim, - std::string("mesh::TreeLoadBalancer") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("TreeLoadBalancer", - boost::shared_ptr()))); - tree_lb->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - return tree_lb; - - }else if (lb_type == "TreeLoadBalancerOld") { - - boost::shared_ptr tree_lb( - new mesh::TreeLoadBalancerOld( - dim, - std::string("mesh::TreeLoadBalancerOld") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("TreeLoadBalancerOld", - boost::shared_ptr()))); - tree_lb->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - return tree_lb; - - } else if (lb_type == "ChopAndPackLoadBalancer") { - - boost::shared_ptr cap_lb( - new mesh::ChopAndPackLoadBalancer( - dim, - std::string("mesh::ChopAndPackLoadBalancer") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("ChopAndPackLoadBalancer", - boost::shared_ptr()))); - return cap_lb; - - } - else { - TBOX_ERROR( - "Missing or bad load_balancer specification in Main database.\n" - << "Specify load_balancer_type = STRING, where STRING can be\n" - << "\"ChopAndPackLoadBalancer\" or \"TreeLoadBalancer\"."); - } - - return boost::shared_ptr(); -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/README b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/README deleted file mode 100644 index 296f7b12..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/README +++ /dev/null @@ -1,13 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Inputs to test load balancers. -## -######################################################################### - -These are inputs for testing the load balancers on concentric sphere -configurations. Each grade (small, med, big, etc.) increases the -initial mesh resolution by about 4 times in each coordinate direction. diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.caplb.input deleted file mode 100644 index 0cdd18ca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.caplb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "big_sphere.2d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(799,799)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(799,799)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.treelb.input deleted file mode 100644 index b875b986..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/big_sphere.2d.treelb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "big_sphere.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(799,799)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(799,799)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/huge_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/huge_sphere.2d.caplb.input deleted file mode 100644 index 7bb0371e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/huge_sphere.2d.caplb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "huge_sphere.2d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(3199,3199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(3199,3199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.caplb.input deleted file mode 100644 index 6d9690db..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.caplb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "med_sphere.2d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(199,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.treelb.input deleted file mode 100644 index 3b729081..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/med_sphere.2d.treelb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "med_sphere.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(199,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.caplb.input deleted file mode 100644 index 28cbd38e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.caplb.input +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_sphere.3d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,99)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(99,99,99)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(89,89,89)] - initial_owners = 0 - max_box_size = 10, 10, 10 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0.0, 0.0, 0.0 - radii = 0.0, 0.5, 0.7, 0.8, 1.4, 1.41 - efficiency_tol = 0.85 - combine_tol = 0.85 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.treelb.input deleted file mode 100644 index 5bf91907..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/small_sphere.3d.treelb.input +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_sphere.3d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,99,99)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0,0),(99,99,99)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(89,89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0.0, 0.0, 0.0 - radii = 0.0, 0.5, 0.7, 0.8, 1.4, 1.41 - efficiency_tol = 0.85 - combine_tol = 0.85 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.caplb.input deleted file mode 100644 index 5a47ee7a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.caplb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "tiny_sphere.2d.caplb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(11,11)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(11,11)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.treelb.input deleted file mode 100644 index 323e9500..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/sphere_inputs/tiny_sphere.2d.treelb.input +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "tiny_sphere.2d.treelb" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(11,11)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(11,11)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/plank.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/plank.3d.treelb.input deleted file mode 100644 index f51df00d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/plank.3d.treelb.input +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "plank.3d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(24,49,199)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 1.0, 2.0, 8.0 - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserBoxes" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10,10),(14,39,189)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rect.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rect.2d.treelb.input deleted file mode 100644 index 2b18a71b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rect.2d.treelb.input +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "rect.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(999,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(999,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(989,189)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.1d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.1d.treelb.input deleted file mode 100644 index a3942e6e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.1d.treelb.input +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - base_name = "rod.1d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0),(299)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0),(299)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(1),(298)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.2d.treelb.input deleted file mode 100644 index 1ab33f20..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/rod.2d.treelb.input +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "rod.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(299,2)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(299,2)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(1,1),(298,1)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.caplb.input deleted file mode 100644 index b870417c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.caplb.input +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_cube.2d.caplb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(199,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - // max_size = 8, 8 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -ChopAndPackLoadBalancer { - max_workload_factor = 0.1, 0.1 -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.treelb.input deleted file mode 100644 index 8da3e36b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.2d.treelb.input +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_cube.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(199,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.3d.treelb.input deleted file mode 100644 index f4310e1e..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_cube.3d.treelb.input +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_cube.3d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(24,24,24)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 1.0, 1.0, 1.0 - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserBoxes" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(19,19,19)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.2d.treelb.input deleted file mode 100644 index b00dff75..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.2d.treelb.input +++ /dev/null @@ -1,167 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_front.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(99,49)] - // domain_boxes = [(0,0),(49,24)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 2.0, 1.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(49,24)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.3d.treelb.input deleted file mode 100644 index b642579a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_front.3d.treelb.input +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_front.3d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(99,49,49)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - // L0_boxes = [(0,0),(99,49)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceBySinusoidalFront" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0,0),(36,36,36)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_rect.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_rect.2d.treelb.input deleted file mode 100644 index 955683d6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_rect.2d.treelb.input +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_rect.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(49,49)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(49,49)] - - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(0,0),(36,36)] - // prebalance_boxes = [(0,0),(19,39)], [(20,0),(39,39)] - initial_owners = 0 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6 //, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 3, 3 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.caplb.input deleted file mode 100644 index 6b998913..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.caplb.input +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_sphere.2d.caplb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "ChopAndPackLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(49,49)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(49,49)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.treelb.input deleted file mode 100644 index f2de67ac..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/LoadBalancers/test_inputs/small_sphere.2d.treelb.input +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_sphere.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(49,49)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(49,49)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - L1_box_gen_method = "PrebalanceByUserShells" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at r0, with shell i having inner radius 2*i - and outer radius (2*i)+1. Note that making shells too thin - can lead to discontinuous tagging. - */ - r0 = 0, 0 // 0.5, 0.5 - radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_width = 10, 10 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/Makefile.in index f30f6bd3..cf61ca2b 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the performance test directory ## ######################################################################### @@ -17,18 +17,10 @@ default: library include $(OBJECT)/config/Makefile.config -SUBDIRS = treesearch MeshGeneration LoadBalancers LinAdv +SUBDIRS = treesearch multiblock TreeCommunication MeshGeneration LinAdv Euler library: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib1d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib2d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -lib3d: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done -libXd: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done check: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done check2d: @@ -36,8 +28,17 @@ check2d: check3d: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done checkcompile: - for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done + (cd $(OBJECT)/source/test/testlib && $(MAKE) $@) + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done checktest: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +examples: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +perf: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +everything: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@) || exit 1; done clean: for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done +checkclean: + for DIR in $(SUBDIRS); do (cd $$DIR && $(MAKE) $@); done diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.C b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.C deleted file mode 100644 index b49d6e3b..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.C +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#include "DerivedVisOwnerData.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/SAMRAIManager.h" - -using namespace SAMRAI; - -DerivedVisOwnerData::DerivedVisOwnerData() -{ -} - -DerivedVisOwnerData::~DerivedVisOwnerData() -{ -} - -bool DerivedVisOwnerData::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const -{ - (void)patch; - (void)region; - (void)variable_name; - (void)depth_id; - if (variable_name == "Owner") { - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - double owner = mpi.getRank(); - int i, size = region.size(); - for (i = 0; i < size; ++i) buffer[i] = owner; - } else { - // Did not register this name. - TBOX_ERROR( - "Unregistered variable name '" << variable_name << "' in\n" - << - "DerivedVisOwnerData::packDerivedPatchDataIntoDoubleBuffer"); - } - - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.h b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.h deleted file mode 100644 index 76584caa..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/DerivedVisOwnerData.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: TreeLoadBalancer test. - * - ************************************************************************/ -#ifndef included_DerivedVisOwnerData -#define included_DerivedVisOwnerData - -#include - -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/Patch.h" - -#include "SAMRAI/tbox/Database.h" - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisDerivedDataStrategy.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Write owner rank using VisDerivedDataStrategy. - */ -class DerivedVisOwnerData: - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - DerivedVisOwnerData(); - - ~DerivedVisOwnerData(); - - //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals - - virtual bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_id) const; - - //@} - -private: -}; - -#endif // included_DerivedVisOwnerData diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.depend index 5683df06..d23a31d9 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -11,437 +11,8 @@ ## This file is automatically generated by depend.pl. -FILE_0=DerivedVisOwnerData.o +FILE_0=mg.o DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.C \ - DerivedVisOwnerData.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - -FILE_1=MeshGenerationStrategy.o -DEPENDS_1:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MeshGenerationStrategy.C \ - MeshGenerationStrategy.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} - -FILE_2=SinusoidalFrontGenerator.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MeshGenerationStrategy.h \ - SinusoidalFrontGenerator.C SinusoidalFrontGenerator.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} - -FILE_3=SphericalShellGenerator.o -DEPENDS_3:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MeshGenerationStrategy.h \ - SphericalShellGenerator.C SphericalShellGenerator.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} - -FILE_4=mg.o -DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ @@ -473,6 +44,7 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -487,12 +59,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -501,12 +75,16 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitioner.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/CascadePartitionerTree.h \ $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancerOld.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ @@ -524,12 +102,14 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BreadthFirstRankTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -543,23 +123,22 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ - MeshGenerationStrategy.h SinusoidalFrontGenerator.h \ - SphericalShellGenerator.h mg.C + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(TESTLIBDIR)/ShrunkenLevelGenerator.h \ + $(TESTLIBDIR)/SinusoidalFrontGenerator.h \ + $(TESTLIBDIR)/SphericalShellGenerator.h mg.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ +DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ @@ -570,10 +149,9 @@ DEPENDS_4 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.in index 64d7d05a..9ab9e12f 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/Makefile.in @@ -3,68 +3,137 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Test program for performance of load balancers. +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Test for performance and quality of mesh generation. ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/performance/MeshGeneration -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. - -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -NUM_TESTS = 4 +NUM_TESTS = 41 +CPPFLAGS_EXTRA= -DTESTING=1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = mg.o + +INPUTS2D = test_inputs/small_spread.2d.tile.input \ + test_inputs/front.2d.caplb.input \ + test_inputs/front.2d.localtile.input \ + test_inputs/front.2d.tile.input \ + test_inputs/front.2d.treelb.input \ + test_inputs/front.2d.voucher.input \ + test_inputs/lss.2d.caplb.input \ + test_inputs/lss.2d.localtile.input \ + test_inputs/lss.2d.tile.input \ + test_inputs/lss.2d.tilevoucher.input \ + test_inputs/lss.2d.treelb.input \ + test_inputs/lss.2d.voucher.input \ + test_inputs/lump.2d.treelb.input \ + test_inputs/lump.2d.tilecascade.input \ + test_inputs/lump.2d.voucher.input \ + test_inputs/lump.2d.tilevoucher.input \ + test_inputs/box_deep.2d.cascade.input + + +INPUTS3D = test_inputs/spreadby10.3d.treelb.input \ + performance_inputs/bigbox.3d.tile.input \ + performance_inputs/single_sphere.3d.caplb.input \ + performance_inputs/single_sphere.3d.treelb.input \ + performance_inputs/lsphere_weak.3d.treelb.input \ + performance_inputs/lsphere_weak.3d.localtile.input \ + performance_inputs/front.3d.caplb.input \ + performance_inputs/front.3d.treelb.input \ + performance_inputs/front.3d.cascade.input \ + performance_inputs/front.3d.tile.input \ + performance_inputs/front.3d.localtile.input \ + performance_inputs/domexlike.caplb.input \ + performance_inputs/domexlike.treelb.input \ + test_inputs/front.3d.caplb.input \ + test_inputs/front.3d.localtile.input \ + test_inputs/front.3d.tile.input \ + test_inputs/front.3d.treelb.input \ + test_inputs/lump.3d.tile.input \ + test_inputs/lss.3d.caplb.input \ + test_inputs/lss.3d.localtile.input \ + test_inputs/lss.3d.tile.input \ + test_inputs/lss.3d.tilevoucher.input \ + test_inputs/lss.3d.voucher.input \ + test_inputs/lss.3d.treelb.input + +main: $(CXX_OBJS) $(LIBSAMRAI) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(TESTLIB) \ + $(LIBSAMRAI) $(LDLIBS) -o $@ -CXX_OBJS = mg.o MeshGenerationStrategy.o DerivedVisOwnerData.o SinusoidalFrontGenerator.o SphericalShellGenerator.o - -INPUTS2D = test_inputs/small_sphere.2d.treelb.input \ - test_inputs/small_front.2d.treelb.input - -INPUTS3D = test_inputs/small_sphere.3d.treelb.input \ - test_inputs/small_front.3d.treelb.input +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -main: $(CXX_OBJS) $(LIBSAMRAI) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ - $(LIBSAMRAI) $(LDLIBS) -o $@ check: - $(MAKE) check2d - $(MAKE) check3d + $(MAKE) check2d + $(MAKE) check3d check1d: main check2d: main - for f in $(INPUTS2D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "$$f"; \ - done + @for f in $(INPUTS2D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main - for f in $(INPUTS3D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "$$f"; \ - done + @for f in $(INPUTS3D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: main + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.timing* -clean: - $(SAMCLEAN) - $(RM) *.f main +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.C b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.C deleted file mode 100644 index fc1bfc07..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.C +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: MeshGeneration class implementation - * - ************************************************************************/ -#include "MeshGenerationStrategy.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxLevelConnectorUtils.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - - - -void MeshGenerationStrategy::setTagsByShrinkingLevel( - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id, - const hier::IntVector &shrink_cells, - const double *shrink_distance ) -{ - - const tbox::Dimension dim(hierarchy->getDim()); - - boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); - - const int tag_val = 1; - - const boost::shared_ptr &tag_level( - hierarchy->getPatchLevel(tag_ln)); - - const hier::BoxLevel &Ltag = *tag_level->getBoxLevel(); - - - /* - * Compute shrinkage in terms of coarse cell count. It should be - * the largest of properly converted values for shrink_cells, - * shrink_distance and nesting width. - */ - hier::IntVector shrink_width(dim, hierarchy->getProperNestingBuffer(tag_ln)); - shrink_width.max(shrink_cells); - - const double *ref_dx = grid_geometry->getDx(); - for ( int i=0; i::Max( - static_cast(0.5 + shrink_distance[i]/h), - shrink_width(i) ); - } - - - hier::BoxLevel tagfootprint(dim); - hier::Connector Ltag_to_tagfootprint; - const hier::Connector &Ltag_to_Ltag = - Ltag.getPersistentOverlapConnectors().findOrCreateConnector( - Ltag, - shrink_width ); - - hier::BoxLevelConnectorUtils blcu; - blcu.computeInternalParts( tagfootprint, - Ltag_to_tagfootprint, - Ltag_to_Ltag, - -shrink_width, - grid_geometry->getDomainSearchTree() ); - tbox::plog << "Ltag_to_tagfootprint:\n" << Ltag_to_tagfootprint.format("Ltag->tagfootprint: ", 2); - - - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - - boost::shared_ptr patch = *pi; - boost::shared_ptr > tag_data( - patch->getPatchData(tag_data_id), - boost::detail::dynamic_cast_tag()); - - tag_data->getArrayData().fillAll(0); - - if ( !Ltag_to_tagfootprint.hasNeighborSet(patch->getBox().getId()) ) { - tag_data->getArrayData().fillAll(1); - } - else { - hier::Connector::ConstNeighborhoodIterator ni = - Ltag_to_tagfootprint.find(patch->getBox().getId()); - - for ( hier::Connector::ConstNeighborIterator na = Ltag_to_tagfootprint.begin(ni); - na != Ltag_to_tagfootprint.end(ni); ++na ) { - - const hier::Box &tag_box = *na; - tag_data->getArrayData().fillAll(tag_val, tag_box); - - } - } - - } - - return; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.h b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.h deleted file mode 100644 index 8192b251..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/MeshGenerationStrategy.h +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Strategy class for MeshGeneration performance tests. - * - ************************************************************************/ -#ifndef included_MeshGenerationStrategy -#define included_MeshGenerationStrategy - -#include - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Timer.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Interface definition for MeshGeneration performance test. - * - * This is a combination of mesh::StandardTagAndInitStrategy and - * appu::VisDerivedDataStrategy, giving no-op implementations to - * unneeded methods. - */ -class MeshGenerationStrategy: - public mesh::StandardTagAndInitStrategy, - public appu::VisDerivedDataStrategy -{ - -public: - /*! - * @brief Constructor. - */ - MeshGenerationStrategy() {}; - - virtual ~MeshGenerationStrategy() {}; - - /*! - * @brief Set tas on the tag level. - */ - virtual void setTags( - bool &exact_tagging, - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id) = 0; - - /*! - * @brief Set tags by shrinking the level at its coarse-fine - * boundary. - * - * Some implementations may choose the strategy of setting tags by - * shrinking the tag level. Those implementations may delegate - * that job to this method. - * - * @param [o] exact_tagging Set to true of the clustering should - * match the tags exactly, e.g., the tags are generated from and - * look like boxes. - */ - virtual void setTagsByShrinkingLevel( - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id, - const hier::IntVector &shrink_cells, - const double *shrink_distance ); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - - /*! - * @brief Set the domain, possibly scaling up the specifications. - * - * Take the domain_boxes, xlo and xhi to be the size for the value - * of autoscale_base_nprocs. Scale the problem from there to the - * number of process specified by the argument mpi. - * - * The object should also adjust whatever internal data needed to - * reflect the scaled-up domain. - * - * @param [i/o] domain Domain description to be scaled up (or - * overridden). - * - * @param [i/o] xlo Domain lower physical coordinate to be scaled - * up (or overridden). - * - * @param [i/o] xhi Domain upper physical coordinate to be scaled - * up (or overridden). - * - * @param [i] autoscale_base_nprocs Scale up the domain based on - * the current definition being for this many processes. Scale the - * domain up to the number of processes in the given SAMRAI_MPI. - * - * @param [i] mpi - */ - virtual void setDomain( - hier::BoxContainer &domain, - double xlo[], - double xhi[], - int autoscale_base_nprocs, - const tbox::SAMRAI_MPI &mpi) = 0; - - /*! - * @brief Allocate and initialize data for a new level - * in the patch hierarchy. - * - * This is where you implement the code for initialize data on the - * grid. Nevermind when it is called or where in the program that - * happens. All the information you need to initialize the grid - * are in the arguments. - * - * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() - */ - void - initializeLevelData( - /*! Hierarchy to initialize */ - const boost::shared_ptr &hierarchy, - /*! Level to initialize */ - const int level_number, - const double init_data_time, - const bool can_be_refined, - /*! Whether level is being introduced for the first time */ - const bool initial_time, - /*! Level to copy data from */ - const boost::shared_ptr &old_level = - boost::shared_ptr(), - /*! Whether data on new patch needs to be allocated */ - const bool allocate_data = true) - { - NULL_USE(hierarchy); - NULL_USE(level_number); - NULL_USE(init_data_time); - NULL_USE(can_be_refined); - NULL_USE(initial_time); - NULL_USE(old_level); - NULL_USE(allocate_data); - TBOX_ERROR("Should not be here"); - } - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr &new_hierarchy, - /*! Coarsest level */ int coarsest_level, - /*! Finest level */ int finest_level) = 0; - - void - applyGradientDetector( - const boost::shared_ptr &hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation) - { - NULL_USE(hierarchy); - NULL_USE(level_number); - NULL_USE(error_data_time); - NULL_USE(tag_index); - NULL_USE(initial_time); - NULL_USE(uses_richardson_extrapolation); - TBOX_ERROR("Should not be here"); - } - - //@} - - virtual void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) = 0; - - virtual bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const = 0; - -private: - -}; - -#endif // MeshGenerationStrategy diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/README b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/README index 5cf73d59..d5a81b80 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/README +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/README @@ -1,4 +1,14 @@ -Performance tests for mesh generations. +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Test for performance and quality of mesh generation. +## +######################################################################### + +Performance tests for mesh generation. The two bottle-neck steps (clustering and partitioning) are tested here for: @@ -10,3 +20,18 @@ We don't test all steps in mesh generation or remeshing here, just the most expensive steps. These steps have the same characteristics whether generating the mesh or remeshing, so we omit remesh-specific steps. + +COMPILATION AND EXECUTION +------------------------- + + Compilation: + make main + + Execution: + For one the following input files in test_inputs: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.C b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.C deleted file mode 100644 index 14a02dc5..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.C +++ /dev/null @@ -1,483 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontGenerator class implementation - * - ************************************************************************/ -#include "SinusoidalFrontGenerator.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxLevelConnectorUtils.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - - - -SinusoidalFrontGenerator::SinusoidalFrontGenerator( - const std::string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr &database): - d_name(object_name), - d_dim(dim), - d_hierarchy(), - d_amplitude(0.2) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - TBOX_ASSERT(variable_db != NULL); -#endif - - tbox::Array init_disp; - tbox::Array velocity; - tbox::Array period; - - - // Parameters set by database, with defaults. - boost::shared_ptr sft_db; // SinusoidalFrontGenerator database. - - if (database) { - - sft_db = database->getDatabaseWithDefault("SinusoidalFrontGenerator", sft_db); - - if (database->isDouble("period")) { - period = - database->getDoubleArray("period"); - } - if (database->isDouble("init_disp")) { - init_disp = - database->getDoubleArray("init_disp"); - } - if (database->isDouble("velocity")) { - velocity = - database->getDoubleArray("velocity"); - } - d_amplitude = - database->getDoubleWithDefault("amplitude", - d_amplitude); - - /* - * Input parameters to determine whether to tag by buffering - * fronts or shrinking level, and by how much. - */ - const std::string sname( "shrink_distance_" ); - const std::string bname( "buffer_distance_" ); - std::string aname; - for ( int ln=0; ; ++ln ) { - const std::string lnstr( tbox::Utilities::intToString(ln) ); - - // Look for buffer input first, then shrink input. - const std::string bnameln = bname + lnstr; - const std::string snameln = sname + lnstr; - - tbox::Array tmpa; - - if ( database->isDouble(bnameln) ) { - tmpa = database->getDoubleArray(bnameln); - if ( tmpa.getSize() != dim.getValue() ) { - TBOX_ERROR(bnameln << " input parameter must have " << dim << " values"); - } - d_buffer_shrink.push_back('b'); - } - - if ( database->isDouble(snameln) ) { - if ( !tmpa.empty() ) { - TBOX_ERROR("Cannot specify both " << bnameln << " and " << snameln); - } - tmpa = database->getDoubleArray(snameln); - if ( tmpa.getSize() != dim.getValue() ) { - TBOX_ERROR(snameln << " input parameter must have " << dim << " values"); - } - d_buffer_shrink.push_back('s'); - } - - if ( !tmpa.empty() ) { - d_buffer_shrink_distance.resize(d_buffer_shrink_distance.size() + 1); - d_buffer_shrink_distance.back().insert( d_buffer_shrink_distance.back().end(), - tmpa.getPointer(), - tmpa.getPointer()+tmpa.size() ); - } - else { - break; - } - - } - } - - if ( d_buffer_shrink.empty() ) { - TBOX_ERROR("SinusoidalFrontGenerator: You must specify either\n" - << "buffer_distance_# or shrink_distance_# for each level\n" - << "you plan to use, except the finest level."); - } - - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - d_init_disp[idim] = idim < init_disp.size() ? init_disp[idim] : 0.0; - d_velocity[idim] = idim < velocity.size() ? velocity[idim] : 0.0; - d_period[idim] = idim < period.size() ? period[idim] : 1.0e20; - } - - t_setup = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontGenerator::setup"); - t_node_pos = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontGenerator::node_pos"); - t_distance = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontGenerator::distance"); - t_tag_cells = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontGenerator::tag_cells"); - t_copy = tbox::TimerManager::getManager()-> - getTimer("apps::SinusoidalFrontGenerator::copy"); -} - - - -SinusoidalFrontGenerator::~SinusoidalFrontGenerator() -{ -} - - - - -/* - *********************************************************************** - *********************************************************************** - */ -void SinusoidalFrontGenerator::setTags( - bool &exact_tagging, - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id ) -{ - if ( d_buffer_shrink[tag_ln] == 's' ) { - setTagsByShrinkingLevel( - hierarchy, - tag_ln, - tag_data_id, - hier::IntVector::getZero(d_dim), - &d_buffer_shrink_distance[1][0]); - exact_tagging = true; - return; - } - - const boost::shared_ptr &tag_level( - hierarchy->getPatchLevel(tag_ln)); - - resetHierarchyConfiguration(hierarchy, 0, 1); - - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - - boost::shared_ptr patch = *pi; - - boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr > tag_data( - patch->getPatchData(tag_data_id), - boost::detail::dynamic_cast_tag()); - - computeFrontsData( - NULL /* distance data */, - tag_data.get(), - d_buffer_shrink_distance[tag_ln], - patch_geom->getXLower(), - patch_geom->getDx(), - 0.0 ); - - } - - exact_tagging = false; - - return; -} - - - -void SinusoidalFrontGenerator::setDomain( - hier::BoxContainer &domain, - double xlo[], - double xhi[], - int autoscale_base_nprocs, - const tbox::SAMRAI_MPI &mpi) -{ - TBOX_ASSERT( autoscale_base_nprocs <= mpi.getSize() ); - TBOX_ASSERT( !domain.isEmpty() ); - - hier::BoxContainer::const_iterator ii = domain.begin(); - ii->getDim(); - const tbox::Dimension &dim = domain.begin()->getDim(); - - int doubling_dir = 1; - while (autoscale_base_nprocs < mpi.getSize()) { - for ( hier::BoxContainer::iterator bi=domain.begin(); - bi!=domain.end(); ++bi ) { - hier::Box &input_box = *bi; - input_box.upper()(doubling_dir) += input_box.numberCells(doubling_dir); - } - xhi[doubling_dir] += xhi[doubling_dir] - xlo[doubling_dir]; - doubling_dir = (doubling_dir + 1)%dim.getValue(); - autoscale_base_nprocs *= 2; - tbox::plog << "autoscale_base_nprocs = " << autoscale_base_nprocs << std::endl - << domain.format("IB: ", 2) << std::endl; - } - - if ( autoscale_base_nprocs != mpi.getSize() ) { - TBOX_ERROR("If autoscale_base_nprocs (" << autoscale_base_nprocs << ") is given,\n" - <<"number of processes (" << mpi.getSize() << ") must be\n" - <<"a power-of-2 times the value of autoscale_base_nprocs."); - } - -} - - - -void SinusoidalFrontGenerator::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr &new_hierarchy, - /*! Coarsest level */ const int coarsest_level, - /*! Finest level */ const int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - TBOX_ASSERT(new_hierarchy->getDim() == d_dim); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - - - -/* - * Compute the solution data for a patch. - */ - -void SinusoidalFrontGenerator::computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const -{ - - t_setup->start(); - - TBOX_ASSERT(d_hierarchy); - TBOX_ASSERT(patch.inHierarchy()); - - const int ln = patch.getPatchLevelNumber(); - const boost::shared_ptr level = - d_hierarchy->getPatchLevel(ln); - - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - const double* xlo = patch_geom->getXLower(); - - const double* dx = patch_geom->getDx(); - - computeFrontsData( dist_data, tag_data, d_buffer_shrink_distance[patch.getPatchLevelNumber()], xlo, dx, time ); -} - - - -/* - * Compute the various data due to the fronts. - */ -void SinusoidalFrontGenerator::computeFrontsData( - pdat::NodeData* dist_data, - pdat::CellData* tag_data, - const std::vector &buffer_distance, - const double xlo[], - const double dx[], - const double time ) const -{ - const tbox::Dimension &dim(tag_data->getDim()); - - t_setup->start(); - - if ( dist_data != NULL && tag_data != NULL ) { - TBOX_ASSERT( dist_data->getBox().isSpatiallyEqual(tag_data->getBox()) ); - } - - // Compute the buffer in terms of cells. - hier::IntVector buffer_cells(dim); - for ( int i=0; i(0.5 + buffer_distance[i]/dx[i]); - } - - const hier::Box& pbox = tag_data->getBox(); - - /* - * We need at least buffer_cells ghost cells to compute - * the tags, but the data may not have as many ghost cells. - * So we create temporary patch data with the required - * buffer_cells for computing tag values. (We could give the real - * data the required ghost cells, but that may affect the - * regridding algorithm I'm testing.) - */ - pdat::CellData tmp_tag(pbox, 1, buffer_cells); - - /* - * Determine what x-cell-index contains the sinusoidal front. - */ - - double wave_number[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - for (int idim = 0; idim < d_dim.getValue(); ++idim) { - wave_number[idim] = 2 * 3.141592654 / d_period[idim]; - } - - t_setup->stop(); - - - /* - * Initialize node x-distances from front. - */ - - t_node_pos->start(); - hier::Box front_box = pbox; - front_box.grow(buffer_cells); - front_box.growUpper(hier::IntVector(d_dim, 1)); - // Squash front_box to a single plane. - front_box.upper(0) = front_box.lower(0) = pbox.lower(0); - pdat::ArrayData front_x(front_box, 1); - pdat::ArrayData::iterator aiend(front_x.getBox(), false); - for ( pdat::ArrayData::iterator ai(front_x.getBox(), true); - ai != aiend; ++ai ) { - - const hier::Index &index = *ai; - double y=0.0, siny=0.0, z=0.0, sinz=1.0; - - y = xlo[1] + dx[1]*(index(1) - pbox.lower()[1]); - siny = sin(wave_number[1] * (y + d_init_disp[1] - d_velocity[1] * time)); - - if ( dim.getValue() > 2 ) { - z = xlo[2] + dx[2]*(index(2) - front_box.lower()[2]); - sinz = sin(wave_number[2] * (z + d_init_disp[2] - d_velocity[2] * time)); - } - - front_x(index,0) = d_amplitude * siny * sinz + d_init_disp[0]; - // tbox::plog << "front_x" << index << " = " << front_x(index,0) << std::endl; - } - t_node_pos->stop(); - - /* - * Initialize tmp_tag to zero then tag specific cells. - */ - tmp_tag.fill(0); - hier::BlockId blk0(0); - pdat::CellData::iterator ciend(tmp_tag.getGhostBox(), false); - for ( pdat::CellData::iterator ci(tmp_tag.getGhostBox(), true); - ci != ciend; ++ci ) { - - const pdat::CellIndex &cell_index = *ci; - const hier::Box cell_box(cell_index, cell_index, blk0); - - double min_distance_to_front = tbox::MathUtilities::getMax(); - double max_distance_to_front = -tbox::MathUtilities::getMax(); - // tbox::plog << "initial distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - pdat::NodeIterator niend(cell_box, false); - for ( pdat::NodeIterator ni(cell_box, true); ni != niend; ++ni ) { - - const pdat::NodeIndex &node_index = *ni; - hier::Index front_index = node_index; - front_index(0) = pbox.lower(0); - - double node_x = xlo[0] + dx[0]*( node_index(0) - pbox.lower()(0) ); - - double distance_to_front = node_x - front_x(front_index,0); - min_distance_to_front = tbox::MathUtilities::Min(min_distance_to_front, distance_to_front); - max_distance_to_front = tbox::MathUtilities::Max(max_distance_to_front, distance_to_front); - // tbox::plog << "cell_index = " << cell_index << " node_index = " << node_index << " node_x = " << node_x << " front_index = " << front_index << " front_x = " << front_x(front_index,0) << " distance to front(" << node_x << ") = " << distance_to_front << std::endl; - - } - // tbox::plog << "distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - while ( min_distance_to_front < -0.5*d_period[0] ) { - min_distance_to_front += d_period[0]; - max_distance_to_front += d_period[0]; - } - while ( max_distance_to_front > 0.5*d_period[0] ) { - min_distance_to_front -= d_period[0]; - max_distance_to_front -= d_period[0]; - } - // tbox::plog << "shifted ..........: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; - if ( min_distance_to_front < 0 && max_distance_to_front > 0 ) { - // This cell has nodes on both sides of the front. Tag it and the buffer_cells around it. - hier::Box cell_and_buffer(cell_index, cell_index, blk0); - cell_and_buffer.grow(buffer_cells); - tmp_tag.fill(1,cell_and_buffer); - } - - } - - - /* - * Initialize distance data. - */ - if (dist_data != NULL) { - t_distance->start(); - - pdat::NodeData &dist_to_front(*dist_data); - pdat::NodeData::iterator ni(dist_to_front.getGhostBox(), true); - pdat::NodeData::iterator niend(dist_to_front.getGhostBox(), false); - for ( ; ni != niend; ++ni) { - const pdat::NodeIndex& index = *ni; - pdat::NodeIndex front_index(index); - front_index(0) = 0; - dist_to_front(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] - - front_x(front_index,0); - } - // dist_to_front.print(dist_to_front.getBox(),0,plog); - - t_distance->stop(); - } - - t_copy->start(); - tag_data->copy(tmp_tag); - t_copy->stop(); -} - - - -bool SinusoidalFrontGenerator::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - (void)region; - (void)depth_index; - - if (variable_name == "Distance to front") { - pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, - 0)); - computePatchData(patch, 0.0, &dist_data, NULL); - pdat::NodeData::iterator ciend(patch.getBox(), false); - for (pdat::NodeData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = dist_data(*ci); - } - } else if (variable_name == "Tag value") { - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - computePatchData(patch, 0.0, NULL, &tag_data); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.h b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.h deleted file mode 100644 index e9655960..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SinusoidalFrontGenerator.h +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SinusoidalFrontGenerator class declaration - * - ************************************************************************/ -#ifndef included_SinusoidalFrontGenerator -#define included_SinusoidalFrontGenerator - -#include "MeshGenerationStrategy.h" - -#include - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Timer.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Class to tag a sinusoidal "front" in given domain. - * - * Inputs: - * - * buffer_distance_0, buffer_distance_1, ...: - * buffer_distance[ln] is the buffer distance when tagging ON - * level ln. We tag the fronts and buffer the tags by this amount. - * If buffer_distance[ln] is not given, then tag by buffer_distance[ln]. - * - * shrink_distance_0, shrink_distance_1, ...: - * shrink_distance[ln] is the shink distance when tagging ON - * level ln by shrinking the boundaries of level ln. - * We use this method ONLY when shrink_distance[ln] is not given. - */ -class SinusoidalFrontGenerator: - public MeshGenerationStrategy -{ - -public: - /*! - * @brief Constructor. - */ - SinusoidalFrontGenerator( - /*! Ojbect name */ - const std::string& object_name, - const tbox::Dimension& dim, - /*! Input database */ - const boost::shared_ptr &database = boost::shared_ptr() ); - - ~SinusoidalFrontGenerator(); - - /*! - * @brief Set tas on the tag level. - */ - virtual void setTags( - bool &exact_tagging, - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - - /*! - * @brief Set the domain, possibly scaling up the specifications. - * - * Take the domain_boxes, xlo and xhi to be the size for the - * (integer) value of autoscale_base_nprocs. Scale the problem - * from there to the number of process running by doubling the - * dimension starting with the j direction. - * - * The number of processes must be a power of 2 times the value - * of autoscale_base_nprocs. - */ - void setDomain( - hier::BoxContainer &domain, - double xlo[], - double xhi[], - int autoscale_base_nprocs, - const tbox::SAMRAI_MPI &mpi); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr &new_hierarchy, - /*! Coarsest level */ const int coarsest_level, - /*! Finest level */ const int finest_level); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) - { - NULL_USE(patch); - NULL_USE(init_data_time); - NULL_USE(initial_time); - NULL_USE(allocate_data); - TBOX_ERROR("Should not be here."); - } - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - -public: - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - - /*! - * @brief Compute distance and tag data for a patch. - * - * This method is not specific to data on the hierarchy, - * so it is of more general use. It does not require the - * hierarchy. - */ - void computeFrontsData( - pdat::NodeData* dist_data, - pdat::CellData* tag_data, - const std::vector &buffer_distance, - const double xlo[], - const double dx[], - const double time ) const; - -private: - - /*! - * @brief Compute distance and tag data for a patch. - */ - void - computePatchData( - const hier::Patch& patch, - const double time, - pdat::NodeData* dist_data, - pdat::CellData* tag_data) const; - - std::string d_name; - - const tbox::Dimension d_dim; - - /*! - * @brief PatchHierarchy for use in implementations of some - * abstract interfaces that do not specify a hierarch. - */ - boost::shared_ptr d_hierarchy; - - /*! - * @brief Period of sinusoid. - */ - double d_period[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Initial displacement. - */ - double d_init_disp[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Front velocity. - */ - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - - /*! - * @brief Amplitude of sinusoid. - */ - double d_amplitude; - - /* - * @brief Whether to generate tags by buffering around the fronts - * or by shrinking the tag level. - * - * 'b' means tag around the fronts and buffer the tags. 's' means - * tag by shrinking the tag level. The amount of buffer or - * shinkage is given by d_buffer_shrink_distance. - */ - std::vector d_buffer_shrink; - - /*! - * @brief Buffer or shrink distances for generating tags. - * - * d_buffer_shrink determines how to generate tags on each level. - * If buffering on level ln, then d_buffer_shrink_distance[ln] - * means the buffer distances. If shrinking on level ln, then it - * means the shrink distances. - */ - std::vector > d_buffer_shrink_distance; - -#if 0 - /*! - * @brief Number of cells to tag around cells intersecting the front. - */ - hier::IntVector d_buffer_cells; - - /*! - * @brief Buffer size in physical space. - * - * d_buffer_space[ln*d_dim + d] is the buffer size for level ln in direction d. - */ - tbox::Array d_buffer_space; - - /*! - * @brief Shrink distance, for generating L2 by shrinking. - */ - tbox::Array d_shrink_distance; -#endif - - boost::shared_ptr t_setup; - boost::shared_ptr t_node_pos; - boost::shared_ptr t_distance; - boost::shared_ptr t_tag_cells; - boost::shared_ptr t_copy; - -}; - -#endif // included_ssup_SinusoidalFrontGenerator diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.C b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.C deleted file mode 100644 index 8006e53d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.C +++ /dev/null @@ -1,332 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SphericalShellGenerator class implementation - * - ************************************************************************/ -#include "SphericalShellGenerator.h" -#include "SAMRAI/geom/CartesianGridGeometry.h" -#include "SAMRAI/geom/CartesianPatchGeometry.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/BoxLevelConnectorUtils.h" -#include "SAMRAI/hier/MappingConnectorAlgorithm.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/ArrayData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/pdat/NodeVariable.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Utilities.h" - -#include - -using namespace SAMRAI; - - - -SphericalShellGenerator::SphericalShellGenerator( - const std::string& object_name, - const tbox::Dimension& dim, - const boost::shared_ptr &database): - d_name(object_name), - d_dim(dim), - d_hierarchy(), - d_radii(0) -{ - tbox::Array init_disp; - tbox::Array velocity; - tbox::Array period; - - - if (database) { - - if (database->isDouble("radii")) { - - d_radii = database->getDoubleArray("radii"); - - if ( d_radii.size()%2 != 0 ) { - d_radii.push_back(tbox::MathUtilities::getMax()); - } - - tbox::plog << "SphericalShellGenerator radii:\n"; - for ( int i=0; i tmpa; - - if ( database->isDouble(bnameln) ) { - tmpa = database->getDoubleArray(bnameln); - if ( tmpa.getSize() != dim.getValue() ) { - TBOX_ERROR(bnameln << " input parameter must have " << dim << " values"); - } - d_buffer_shrink.push_back('b'); - } - - if ( database->isDouble(snameln) ) { - if ( !tmpa.empty() ) { - TBOX_ERROR("Cannot specify both " << bnameln << " and " << snameln); - } - tmpa = database->getDoubleArray(snameln); - if ( tmpa.getSize() != dim.getValue() ) { - TBOX_ERROR(snameln << " input parameter must have " << dim << " values"); - } - d_buffer_shrink.push_back('s'); - } - - if ( !tmpa.empty() ) { - d_buffer_shrink_distance.resize(d_buffer_shrink_distance.size() + 1); - d_buffer_shrink_distance.back().insert( d_buffer_shrink_distance.back().end(), - tmpa.getPointer(), - tmpa.getPointer()+tmpa.size() ); - } - else { - break; - } - - } - - } - - if ( d_buffer_shrink.empty() ) { - TBOX_ERROR("SphericalShellGenerator: You must specify either\n" - << "buffer_distance_# or shrink_distance_# for each level\n" - << "you plan to use, except the finest level."); - } - -} - - - -SphericalShellGenerator::~SphericalShellGenerator() -{ -} - - - - -/* - *********************************************************************** - *********************************************************************** - */ -void SphericalShellGenerator::setTags( - bool &exact_tagging, - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id ) -{ - if ( d_buffer_shrink[tag_ln] == 's' ) { - setTagsByShrinkingLevel( - hierarchy, - tag_ln, - tag_data_id, - hier::IntVector::getZero(d_dim), - &d_buffer_shrink_distance[1][0]); - exact_tagging = true; - return; - } - - const boost::shared_ptr &tag_level( - hierarchy->getPatchLevel(tag_ln)); - - resetHierarchyConfiguration(hierarchy, 0, 1); - - for (hier::PatchLevel::iterator pi(tag_level->begin()); - pi != tag_level->end(); ++pi) { - - boost::shared_ptr patch = *pi; - - boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - - boost::shared_ptr > tag_data( - patch->getPatchData(tag_data_id), - boost::detail::dynamic_cast_tag()); - - tagShells( *tag_data, patch_geom->getDx(), d_buffer_shrink_distance[tag_ln] ); - - } - - exact_tagging = false; - - return; -} - - - -void SphericalShellGenerator::setDomain( - hier::BoxContainer &domain, - double xlo[], - double xhi[], - int autoscale_base_nprocs, - const tbox::SAMRAI_MPI &mpi) -{ - TBOX_ASSERT( autoscale_base_nprocs <= mpi.getSize() ); - TBOX_ASSERT( !domain.isEmpty() ); - NULL_USE(xlo); - NULL_USE(xhi); - - if ( domain.size() != 1 ) { - TBOX_ERROR("SphericalShellGenerator only supports autoscale_base_nprocs\n" - << "for single-box domains."); - } - - hier::BoxContainer::const_iterator ii = domain.begin(); - hier::Box domain_box = *ii; - hier::IntVector tmp_intvec = ii->numberCells(); - const tbox::Dimension &dim = domain.begin()->getDim(); - - double scale_factor = static_cast(mpi.getSize()) / autoscale_base_nprocs; - double linear_scale_factor = pow( scale_factor, 1.0/dim.getValue() ); - - for ( int d=0; d(0.5 + tmp_intvec(d)*linear_scale_factor); - } - tmp_intvec -= hier::IntVector::getOne(domain_box.getDim()); - tbox::plog << "SphericalShellGenerator::setDomain changing domain from " - << domain_box << " to "; - domain_box.upper() = domain_box.lower() + tmp_intvec; - tbox::plog << domain_box << '\n'; - domain.pushBack(domain_box); - -} - - - -void SphericalShellGenerator::resetHierarchyConfiguration( - /*! New hierarchy */ const boost::shared_ptr &new_hierarchy, - /*! Coarsest level */ const int coarsest_level, - /*! Finest level */ const int finest_level) -{ - NULL_USE(coarsest_level); - NULL_USE(finest_level); - TBOX_ASSERT(new_hierarchy->getDim() == d_dim); - d_hierarchy = new_hierarchy; - TBOX_ASSERT(d_hierarchy); -} - - - -/* - * Compute the various data due to the fronts. - */ -void SphericalShellGenerator::tagShells( - pdat::CellData &tag_data, - const double dx[], - const std::vector &buffer_distance ) const -{ - const tbox::Dimension &dim(tag_data.getDim()); - - const hier::Box& pbox = tag_data.getBox(); - const hier::BlockId& block_id = pbox.getBlockId(); - const int tag_val = 1; - - // Compute the buffer in terms of cells. - hier::IntVector buffer_cells(dim); - for ( int i=0; i(0.5 + buffer_distance[i]/dx[i]); - } - - /* - * Compute tags on the nodes. Tag node if it falls within one of - * the shells. - */ - pdat::NodeData node_tag_data(pbox, 1, tag_data.getGhostCellWidth()+buffer_cells); - node_tag_data.getArrayData().fillAll(0); - - pdat::NodeData::iterator niend(node_tag_data.getGhostBox(), false); - for (pdat::NodeData::iterator ni(node_tag_data.getGhostBox(), true); - ni != niend; ++ni) { - const pdat::NodeIndex& idx = *ni; - double r[SAMRAI_MAXIMUM_DIMENSION]; - double rr = 0; - for (int d = 0; d < dim.getValue(); ++d) { - r[d] = dx[d] * idx(d); - rr += r[d] * r[d]; - } - rr = sqrt(rr); - for (int i = 0; i < static_cast(d_radii.size()); i += 2) { - if (d_radii[i] <= rr && rr < d_radii[i + 1]) { - node_tag_data(idx) = tag_val; - break; - } - } - } - - /* - * Initialize tag_data to zero then tag specific cells. - * Tag cell if any of is node in its buffered neighborhood is tagged. - */ - tag_data.getArrayData().fillAll(0); - - pdat::CellData::iterator ciend(tag_data.getGhostBox(), false); - for (pdat::CellData::iterator ci(tag_data.getGhostBox(), true); - ci != ciend; ++ci) { - const pdat::CellIndex& cid = *ci; - - hier::Box check_box(cid,cid, block_id); - check_box.grow(buffer_cells); - pdat::NodeIterator node_itr_end(check_box, false); - for ( pdat::NodeIterator node_itr(check_box, true); - node_itr != node_itr_end; ++node_itr ) { - if ( node_tag_data(*node_itr) == tag_val ) { - tag_data(cid) = tag_val; - break; - } - } - } - -} - - - -bool SphericalShellGenerator::packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const -{ - (void)region; - (void)depth_index; - - if (variable_name == "Tag value") { - - boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); - const double* dx = patch_geom->getDx(); - - pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); - tagShells(tag_data, dx, d_buffer_shrink_distance[patch.getPatchLevelNumber()]); - pdat::CellData::iterator ciend(patch.getBox(), false); - for (pdat::CellData::iterator ci(patch.getBox(), true); - ci != ciend; ++ci) { - *(buffer++) = tag_data(*ci); - } - - } else { - TBOX_ERROR("Unrecognized name " << variable_name); - } - return true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.h b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.h deleted file mode 100644 index 69d9bb44..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/SphericalShellGenerator.h +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: SphericalShellGenerator class declaration - * - ************************************************************************/ -#ifndef included_SphericalShellGenerator -#define included_SphericalShellGenerator - -#include "MeshGenerationStrategy.h" - -#include - -/* - * SAMRAI classes - */ -#include "SAMRAI/appu/VisItDataWriter.h" -#include "SAMRAI/appu/VisDerivedDataStrategy.h" -#include "SAMRAI/hier/BoxContainer.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/mesh/BergerRigoutsos.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/NodeData.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Timer.h" - -#include - -using namespace SAMRAI; - -/*! - * @brief Class to tag spherical shell patternse in given domain. - * - * Inputs: - * - * radii: - * Starting at shell origin, tag cells that intersect regions defined by - * radii[0] &database = boost::shared_ptr() ); - - ~SphericalShellGenerator(); - - /*! - * @brief Set tas on the tag level. - */ - virtual void setTags( - bool &exact_tagging, - const boost::shared_ptr& hierarchy, - int tag_ln, - int tag_data_id); - - //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals - -public: - - /*! - * @brief Set the domain, possibly scaling up the specifications. - * - * Take the domain_boxes, xlo and xhi to be the size for the - * (integer) value of autoscale_base_nprocs. Scale the problem - * from there to the number of process running by doubling the - * dimension starting with the j direction. - * - * The number of processes must be a power of 2 times the value - * of autoscale_base_nprocs. - */ - void setDomain( - hier::BoxContainer &domain, - double xlo[], - double xhi[], - int autoscale_base_nprocs, - const tbox::SAMRAI_MPI &mpi); - - virtual void - resetHierarchyConfiguration( - /*! New hierarchy */ - const boost::shared_ptr &new_hierarchy, - /*! Coarsest level */ const int coarsest_level, - /*! Finest level */ const int finest_level); - - //@} - - void - initializePatchData( - hier::Patch& patch, - const double init_data_time, - const bool initial_time, - const bool allocate_data) - { - NULL_USE(patch); - NULL_USE(init_data_time); - NULL_USE(initial_time); - NULL_USE(allocate_data); - TBOX_ERROR("Should not be here."); - } - - bool - packDerivedDataIntoDoubleBuffer( - double* buffer, - const hier::Patch& patch, - const hier::Box& region, - const std::string& variable_name, - int depth_index) const; - -public: - -#ifdef HAVE_HDF5 - /*! - * @brief Tell a VisIt plotter which data to write for this class. - */ - int - registerVariablesWithPlotter( - appu::VisItDataWriter& writer); -#endif - -private: - - void tagShells( - pdat::CellData &tag_data, - const double dx[], - const std::vector &buffer_distance ) const; - - std::string d_name; - - const tbox::Dimension d_dim; - - /*! - * @brief PatchHierarchy for use in implementations of some - * abstract interfaces that do not specify a hierarch. - */ - boost::shared_ptr d_hierarchy; - - /*! - * @brief Radii of shells. - */ - tbox::Array d_radii; - - /* - * @brief Whether to generate tags by buffering around the shells - * or by shrinking the tag level. - * - * 'b' means tag around the shells and buffer the tags. 's' means - * tag by shrinking the tag level. The amount of buffer or - * shinkage is given by d_buffer_shrink_distance. - */ - std::vector d_buffer_shrink; - - /*! - * @brief Buffer or shrink distances for generating tags. - * - * d_buffer_shrink determines how to generate tags on each level. - * If buffering on level ln, then d_buffer_shrink_distance[ln] - * means the buffer distances. If shrinking on level ln, then it - * means the shrink distances. - */ - std::vector > d_buffer_shrink_distance; - - /*! - * @brief Whether to allocate data on the mesh. - */ - bool d_allocate_data; - -}; - -#endif // included_ssup_SphericalShellGenerator diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/mg.C b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/mg.C index b0fb3480..90030d41 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/mg.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/mg.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Test program for performance and quality of TreeLoadBalancer. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Test for performance and quality of mesh generation. * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" @@ -26,22 +26,27 @@ #include "SAMRAI/hier/OverlapConnectorAlgorithm.h" #include "SAMRAI/hier/MappingConnectorAlgorithm.h" #include "SAMRAI/mesh/BalanceUtilities.h" +#include "SAMRAI/mesh/CascadePartitioner.h" #include "SAMRAI/mesh/TreeLoadBalancer.h" -#include "SAMRAI/mesh/TreeLoadBalancerOld.h" +#include "SAMRAI/mesh/TileClustering.h" #include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" +#include "SAMRAI/tbox/BreadthFirstRankTree.h" +#include "SAMRAI/tbox/CenteredRankTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/MathUtilities.h" +#include "SAMRAI/tbox/OpenMPUtilities.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/TimerManager.h" #include -#include "DerivedVisOwnerData.h" -#include "SinusoidalFrontGenerator.h" -#include "SphericalShellGenerator.h" +#include "test/testlib/SinusoidalFrontGenerator.h" +#include "test/testlib/SphericalShellGenerator.h" +#include "test/testlib/ShrunkenLevelGenerator.h" using namespace SAMRAI; using namespace tbox; @@ -53,10 +58,10 @@ using namespace tbox; ************************************************************************* */ -void enforceNesting( +void +enforceNesting( hier::BoxLevel& L1, hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, const boost::shared_ptr& hierarchy, int coarser_ln); @@ -64,7 +69,6 @@ void sortNodes( hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, bool sort_by_corners, bool sequentialize_global_indices); @@ -72,55 +76,106 @@ void refineHead( hier::BoxLevel& head, hier::Connector& ref_to_head, - hier::Connector& head_to_ref, - const hier::IntVector &refinement_ratio ); + const hier::IntVector& refinement_ratio); -void outputPostcluster( - const hier::BoxLevel &cluster, - const hier::BoxLevel &ref, - const hier::IntVector &ref_to_cluster_width, - const std::string &border ); +void +outputPostcluster( + const hier::BoxLevel& cluster, + const hier::BoxLevel& ref, + const hier::IntVector& ref_to_cluster_width, + const std::string& border); -void outputPrebalance( - const hier::BoxLevel &pre, - const hier::BoxLevel &ref, - const hier::IntVector &pre_width, - const std::string &border ); +void +outputPrebalance( + const hier::BoxLevel& pre, + const hier::BoxLevel& ref, + const hier::IntVector& pre_width, + const std::string& border); -void outputPostbalance( - const hier::BoxLevel &post, - const hier::BoxLevel &ref, - const hier::IntVector &post_width, - const std::string &border ); +void +outputPostbalance( + const hier::BoxLevel& post, + const hier::BoxLevel& ref, + const hier::IntVector& post_width, + const std::string& border); + +boost::shared_ptr +createBoxGenerator( + const boost::shared_ptr& input_db, + const std::string& bg_type, + int ln, + const tbox::Dimension& dim); boost::shared_ptr createLoadBalancer( - boost::shared_ptr &input_db, - const std::string &lb_type, + const boost::shared_ptr& input_db, + const std::string& lb_type, + const std::string& rank_tree_type, int ln, - const tbox::Dimension &dim ); + const tbox::Dimension& dim); + +boost::shared_ptr +getRankTree( + Database& input_db, + const std::string& rank_tree_type); + +/*! + * @brief Implementation to tell PatchHierarchy about the request + * for Connector widths used in enforcing nesting. + * + * This is not essential, but we chose to go through the hierarchy to + * determine how big a Connector width to compute during the level + * generation. This more closely resembles what real aplications do. + * This step is typically done in the mesh generator, and what we are + * writing here is essentially a mesh generator. + */ +class NestingLevelConnectorWidthRequestor: + public hier::PatchHierarchy::ConnectorWidthRequestorStrategy +{ +public: + virtual void + computeRequiredConnectorWidths( + std::vector& self_connector_widths, + std::vector& fine_connector_widths, + const hier::PatchHierarchy& patch_hierarchy) const + { + self_connector_widths.clear(); + self_connector_widths.reserve(patch_hierarchy.getMaxNumberOfLevels()); + const hier::IntVector& one = hier::IntVector::getOne((patch_hierarchy.getDim())); + for (int ln = 0; ln < patch_hierarchy.getMaxNumberOfLevels(); ++ln) { + self_connector_widths.push_back( + one * patch_hierarchy.getProperNestingBuffer(ln)); + } + // fine_connector_widths is same, but doesn't need last level's. + fine_connector_widths = self_connector_widths; + fine_connector_widths.pop_back(); + } +}; +NestingLevelConnectorWidthRequestor nesting_level_connector_width_requestor; +static boost::shared_ptr comm_graph_writer; +size_t num_records_written = 0; /* -******************************************************************************** -* -* Performance testing for load balancers. -* -* 1. Build "level 0" from the domain description (input parameter -* "domain_boxes"). L0 is for doing the test, not for checking load -* balancer performance. -* -* 2. Build "level 1" and write out performance data for balancing it. -* -* 3. Build "level 2" and write out performance data for balancing it. -* The prebalance boxes for L2 are generated by clustering tags on L1. -* All L1 cells are tagged except for a small margin by the L1 boundary -* (input parameter "tag_margin". This configuration tries to mimick -* real problems where the tags occupy a large portion of the tag -* level, leading to a greater number of owners for prebalance boxes. -* -******************************************************************************** -*/ + ******************************************************************************** + * + * Performance testing for mesh generation operations. + * + * 1. Build "level 0" from the domain description (input parameter + * "domain_boxes"). L0 is for doing the test, not for checking load + * balancer performance. + * + * 2. Build "level 1" and write out performance data for balancing it. + * + * 3. Build "level 2" and write out performance data for balancing it. + * The prebalance boxes for L2 are generated by clustering tags on L1. + * All L1 cells are tagged except for a small margin by the L1 boundary + * (input parameter "tag_margin". This configuration tries to mimick + * real problems where the tags occupy a large portion of the tag + * level, leading to a greater number of owners for prebalance boxes. + * + ******************************************************************************** + */ int main( int argc, @@ -135,9 +190,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); - int fail_count = 0; - /* * Process command line arguments. For each run, the input * filename must be specified. Usage is: @@ -159,6 +211,8 @@ int main( case_name = argv[2]; } + int error_count = 0; + { /* * Scope to force destruction of objects that would otherwise @@ -170,15 +224,15 @@ int main( */ boost::shared_ptr input_db(new InputDatabase("input_db")); - boost::shared_ptr base_db(input_db); tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); /* * Set up the timer manager. */ - if (input_db->isDatabase("TimerManager")) { - TimerManager::createManager(input_db->getDatabase("TimerManager")); - } + TimerManager::createManager(input_db->getDatabase("TimerManager")); + boost::shared_ptr t_all = + tbox::TimerManager::getManager()->getTimer("appu::main::all"); + t_all->start(); /* * Retrieve "Main" section from input database. @@ -190,9 +244,9 @@ int main( boost::shared_ptr main_db = input_db->getDatabase("Main"); const tbox::Dimension - dim(static_cast(main_db->getInteger("dim"))); + dim(static_cast(main_db->getInteger("dim"))); - const hier::IntVector &zero_vec = hier::IntVector::getZero(dim); + const hier::IntVector& zero_vec = hier::IntVector::getZero(dim); std::string base_name = "unnamed"; base_name = main_db->getStringWithDefault("base_name", base_name); @@ -201,26 +255,26 @@ int main( * Modify basename for this particular run. * Add the number of processes and the case name. */ + std::string base_name_ext = base_name; if (!case_name.empty()) { - base_name = base_name + '-' + case_name; + base_name_ext = base_name_ext + '-' + case_name; } - base_name = base_name + '-' + tbox::Utilities::intToString( - mpi.getSize(), - 5); + base_name_ext = base_name_ext + '-' + + tbox::Utilities::nodeToString(mpi.getSize()); tbox::plog << "Added case name (" << case_name << ") and nprocs (" << mpi.getSize() << ") to base name -> '" - << base_name << "'\n"; + << base_name_ext << "'\n"; if (!case_name.empty()) { tbox::plog << "Added case name (" << case_name << ") and nprocs (" << mpi.getSize() << ") to base name -> '" - << base_name << "'\n"; + << base_name_ext << "'\n"; } /* * Start logging. */ - const std::string log_file_name = base_name + ".log"; + const std::string log_file_name = base_name_ext + ".log"; bool log_all_nodes = false; log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", log_all_nodes); @@ -230,51 +284,40 @@ int main( PIO::logOnlyNodeZero(log_file_name); } + tbox::plog << "MPI has " << tbox::SAMRAI_MPI::getSAMRAIWorld().getSize() + << " processes." << std::endl; + tbox::plog << "OpenMP version " + << TBOX_omp_version << ".\n" + << "Running with " << TBOX_omp_get_max_threads() << " threads." + << std::endl; /* * Whether to perform certain steps in mesh generation. */ - tbox::Array enforce_nesting(1, true); - if ( main_db->isBool("enforce_nesting") ) { - enforce_nesting = main_db->getBoolArray("enforce_nesting"); + std::vector enforce_nesting(1, true); + if (main_db->isBool("enforce_nesting")) { + enforce_nesting = main_db->getBoolVector("enforce_nesting"); } - tbox::Array load_balance(1, true); - if ( main_db->isBool("load_balance") ) { - load_balance = main_db->getBoolArray("load_balance"); + std::vector load_balance(1, true); + if (main_db->isBool("load_balance")) { + load_balance = main_db->getBoolVector("load_balance"); } - - - /* - * Parameters. Some of these can be specified by input deck. - */ - hier::IntVector ghost_cell_width(dim, 2); - if (main_db->isInteger("ghost_cell_width")) { - main_db->getIntegerArray("ghost_cell_width", &ghost_cell_width[0], dim.getValue()); - } - - hier::IntVector bad_interval(dim, 2); - hier::IntVector cut_factor(dim, 1); - hier::OverlapConnectorAlgorithm oca; - - /* * Set up the domain from input. */ - hier::BoxContainer input_boxes(main_db->getDatabaseBoxArray("domain_boxes")); - input_boxes.begin(); + std::vector db_box_vector = + main_db->getDatabaseBoxVector("domain_boxes"); + hier::BoxContainer domain_boxes(db_box_vector); - hier::BoxContainer domain_boxes; - hier::LocalId local_id(0); - for (hier::BoxContainer::iterator itr = input_boxes.begin(); - itr != input_boxes.end(); ++itr) { + for (hier::BoxContainer::iterator itr = domain_boxes.begin(); + itr != domain_boxes.end(); ++itr) { itr->setBlockId(hier::BlockId(0)); - domain_boxes.pushBack(hier::Box(*itr, local_id++, 0)); } std::vector xlo(dim.getValue()); @@ -284,13 +327,12 @@ int main( xhi[i] = 1.0; } if (main_db->isDouble("xlo")) { - main_db->getDoubleArray("xlo", &xlo[0], dim.getValue()); + xlo = main_db->getDoubleVector("xlo"); } if (main_db->isDouble("xhi")) { - main_db->getDoubleArray("xhi", &xhi[0], dim.getValue()); + xhi = main_db->getDoubleVector("xhi"); } - /* * Choose the tagging code. */ @@ -303,17 +345,22 @@ int main( "SinusoidalFrontGenerator", dim, main_db->getDatabaseWithDefault("SinusoidalFrontGenerator", - boost::shared_ptr()))); - } - else if (mesh_generator_name == "SphericalShellGenerator") { + boost::shared_ptr()))); + } else if (mesh_generator_name == "SphericalShellGenerator") { mesh_gen.reset( new SphericalShellGenerator( "SphericalShellGenerator", dim, main_db->getDatabaseWithDefault("SphericalShellGenerator", - boost::shared_ptr()))); - } - else { + boost::shared_ptr()))); + } else if (mesh_generator_name == "ShrunkenLevelGenerator") { + mesh_gen.reset( + new ShrunkenLevelGenerator( + "ShrunkenLevelGenerator", + dim, + main_db->getDatabaseWithDefault("ShrunkenLevelGenerator", + boost::shared_ptr()))); + } else { TBOX_ERROR("Unrecognized MeshGeneratorStrategy " << mesh_generator_name); } @@ -321,7 +368,7 @@ int main( * If autoscale_base_nprocs is given, take the domain_boxes, xlo and xhi * to be the size for the (integer) value of autoscale_base_nprocs. Scale * the problem from there to the number of process running by - * doubling the dimension starting with the j direction. + * doubling the size starting with the j direction. * * The number of processes must be a power of 2 times the value * of autoscale_base_nprocs. @@ -329,49 +376,22 @@ int main( const int autoscale_base_nprocs = main_db->getIntegerWithDefault("autoscale_base_nprocs", mpi.getSize()); - mesh_gen->setDomain( domain_boxes, &xlo[0], &xhi[0], autoscale_base_nprocs, mpi ); - + mesh_gen->setDomain(domain_boxes, &xlo[0], &xhi[0], autoscale_base_nprocs, mpi); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - { - /* - * Add a dummy PatchData with a big ghost width. - * GridGeometry forbids increasing the max data ghost width - * after it starts computing boundary boxes for a patch. We - * force it to accept a big ghost width here so that the - * methods below (particularly those registering tag - * data) won't crash by asking for more ghost width than what - * was registered when the first boundary boxes were - * computed. - */ - - boost::shared_ptr > dummy_variable( - new pdat::CellVariable(dim, "DummyVariable")); - - boost::shared_ptr dummy_context = - vdb->getContext("DUMMY"); - - vdb->registerVariableAndContext( - dummy_variable, - dummy_context, - hier::IntVector(dim,10)); - } - - /* * Clustering algorithm. */ - mesh::BergerRigoutsos abr( - dim, - main_db->getDatabaseWithDefault("BergerRigoutsos", boost::shared_ptr()) ); - double efficiency_tol = main_db->getDoubleWithDefault("efficiency_tol", 0.7); - double combine_tol = main_db->getDoubleWithDefault("combine_tol", 0.7); + + std::string box_generator_type = + main_db->getStringWithDefault("box_generator_type", "BergerRigoutsos"); /* * Create hierarchy. */ + tbox::plog << "Building domain with boxes " << domain_boxes.format() << std::endl; boost::shared_ptr grid_geometry( new geom::CartesianGridGeometry( "GridGeometry", @@ -383,16 +403,17 @@ int main( new hier::PatchHierarchy( "Hierarchy", grid_geometry, - input_db->getDatabase("PatchHierarchy") )); + input_db->getDatabase("PatchHierarchy"))); - mesh_gen->resetHierarchyConfiguration(hierarchy, 0, 1); + hierarchy->registerConnectorWidthRequestor(nesting_level_connector_width_requestor); - enforce_nesting.resizeArray( hierarchy->getMaxNumberOfLevels(), - bool(enforce_nesting.back()) ); + mesh_gen->resetHierarchyConfiguration(hierarchy, 0, 1); - load_balance.resizeArray( hierarchy->getMaxNumberOfLevels(), - bool(load_balance.back()) ); + enforce_nesting.resize(hierarchy->getMaxNumberOfLevels(), + bool(enforce_nesting.back())); + load_balance.resize(hierarchy->getMaxNumberOfLevels(), + bool(load_balance.back())); const int max_levels = hierarchy->getMaxNumberOfLevels(); @@ -401,12 +422,12 @@ int main( grid_geometry, tbox::SAMRAI_MPI::getSAMRAIWorld(), hier::BoxLevel::GLOBALIZED); - for (hier::BoxContainer::const_iterator bi=grid_geometry->getPhysicalDomain().begin(); - bi!=grid_geometry->getPhysicalDomain().end(); ++bi) { + for (hier::BoxContainer::const_iterator bi = + grid_geometry->getPhysicalDomain().begin(); + bi != grid_geometry->getPhysicalDomain().end(); ++bi) { domain_box_level.addBox(*bi); } - /* * Set up the patch data for tags. */ @@ -418,50 +439,60 @@ int main( vdb->getContext("TagVariable"); const int tag_data_id = vdb->registerVariableAndContext( - tag_variable, - default_context, - hier::IntVector::getZero(dim)); - + tag_variable, + default_context, + hier::IntVector::getZero(dim)); /* * Set up the load balancers. */ - std::string load_balancer_type = - main_db->getStringWithDefault("load_balancer_type", "TreeLoadBalancer"); + std::vector load_balancer_type = + main_db->getStringVector("load_balancer_type"); + load_balancer_type.reserve(hierarchy->getMaxNumberOfLevels()); + while (static_cast(load_balancer_type.size()) < hierarchy->getMaxNumberOfLevels()) { + load_balancer_type.push_back(load_balancer_type.back()); + } + + std::string rank_tree_type = + main_db->getStringWithDefault("rank_tree_type", "CenteredRankTree"); + const bool write_comm_graph = main_db->getBoolWithDefault("write_comm_graph", false); + if (write_comm_graph) { + comm_graph_writer.reset(new CommGraphWriter); + comm_graph_writer->setWriteFullGraph(mpi.getSize() <= 16); + } plog << "Input database after initialization..." << std::endl; input_db->printClassData(plog); - - /* - * Step 1: Build L0. + * Build L0. */ - tbox::pout << "\n==================== Generating L0 ====================" << std::endl; - - { + tbox::pout << "\n==================== Generating L0 ====================" << std::endl; - hier::BoxLevel L0(hier::IntVector(dim, 1), grid_geometry); + boost::shared_ptr L0( + boost::make_shared( + hier::IntVector(dim, 1), grid_geometry)); hier::BoxContainer L0_boxes( - grid_geometry->getPhysicalDomain() ); + grid_geometry->getPhysicalDomain()); const int boxes_per_proc = - (L0_boxes.size() + L0.getMPI().getSize() - - 1) / L0.getMPI().getSize(); - const int my_boxes_start = L0.getMPI().getRank() - * boxes_per_proc; + (L0_boxes.size() + L0->getMPI().getSize() - 1) + / L0->getMPI().getSize(); + const int my_boxes_start = L0->getMPI().getRank() * boxes_per_proc; const int my_boxes_stop = tbox::MathUtilities::Min(my_boxes_start + boxes_per_proc, L0_boxes.size()); - hier::BoxContainer::iterator L0_boxes_itr(L0_boxes); + hier::BoxContainer::iterator L0_boxes_itr = L0_boxes.begin(); for (int i = 0; i < my_boxes_start; ++i) { - ++L0_boxes_itr; + if (L0_boxes_itr != L0_boxes.end()) { + ++L0_boxes_itr; + } } - for (int i = my_boxes_start; i < my_boxes_stop; ++i, L0_boxes_itr++) { - L0.addBox(*L0_boxes_itr, hier::BlockId::zero()); + for (int i = my_boxes_start; i < my_boxes_stop; ++i, ++L0_boxes_itr) { + L0->addBox(*L0_boxes_itr, hier::BlockId::zero()); } /* @@ -471,340 +502,229 @@ int main( * reflect the load balancer use in real apps. We just neeed a * distributed L0 for the real load balancing performance test. */ - hier::Connector L0_to_domain( - L0, + boost::shared_ptr domain_to_L0; + oca.findOverlapsWithTranspose(domain_to_L0, domain_box_level, + *L0, + hier::IntVector(dim, 2), hier::IntVector(dim, 2)); - hier::Connector domain_to_L0( - domain_box_level, - L0, - hier::IntVector(dim, 2)); - oca.findOverlaps(L0_to_domain); - oca.findOverlaps(domain_to_L0); + hier::Connector* L0_to_domain = &domain_to_L0->getTranspose(); - boost::shared_ptr lb0 = - createLoadBalancer( base_db, load_balancer_type, 0, dim ); + boost::shared_ptr lb = + createLoadBalancer(input_db, load_balancer_type[0], rank_tree_type, 0, dim); tbox::plog << "\n\tL0 prebalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L0.getLocalNumberOfCells(), - L0.getMPI()); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L0->getLocalNumberOfCells())), + L0->getMPI()); - tbox::pout << "\tPartitioning..." << std::endl; + outputPrebalance(*L0, domain_box_level, hierarchy->getRequiredConnectorWidth(0, 0), "L0: "); - outputPrebalance( L0, domain_box_level, ghost_cell_width, "L0: " ); - - if ( load_balance[0] ) { + if (load_balance[0]) { + tbox::pout << "\tPartitioning..." << std::endl; tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - lb0->loadBalanceBoxLevel( - L0, + lb->loadBalanceBoxLevel( + *L0, L0_to_domain, - domain_to_L0, hierarchy, 0, - hier::Connector(), - hier::Connector(), hierarchy->getSmallestPatchSize(0), hierarchy->getLargestPatchSize(0), domain_box_level, - bad_interval, - cut_factor); + hier::IntVector::getOne(dim), + hier::IntVector::getOne(dim)); } - sortNodes(L0, - domain_to_L0, - L0_to_domain, + sortNodes(*L0, + *domain_to_L0, false, true); tbox::plog << "\n\tL0 postbalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L0.getLocalNumberOfCells(), - L0.getMPI()); - - outputPostbalance( L0, domain_box_level, ghost_cell_width, "L0: " ); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(L0->getLocalNumberOfCells())), + L0->getMPI()); + + outputPostbalance(*L0, domain_box_level, hierarchy->getRequiredConnectorWidth(0, + 0), "L0: "); + + if (comm_graph_writer) { + tbox::pout << "\tWriting communication graph..." << std::endl; + tbox::plog << "\nCommunication Graph for balancing L0:\n"; + for ( ; + num_records_written < comm_graph_writer->getNumberOfRecords(); + ++num_records_written) { + comm_graph_writer->writeGraphToTextStream(num_records_written, tbox::plog); + } + tbox::plog << "\n"; + } - L0.cacheGlobalReducedData(); + L0->cacheGlobalReducedData(); hierarchy->makeNewPatchLevel(0, L0); } - const hier::BoxLevel &L0 = *hierarchy->getPatchLevel(0)->getBoxLevel(); - - - - hier::Connector L1_to_L0; - hier::Connector L0_to_L1; - hier::Connector L1_to_L1; - - - - if ( max_levels > 1 ) { + for (int new_ln = 1; new_ln < max_levels; ++new_ln) { /* - * Step 2: Build L1. + * Build level new_ln. */ - tbox::pout << "\n==================== Generating L1 ====================" << std::endl; + tbox::pout << "\n==================== Generating L" << new_ln + << " ====================" << std::endl; - hier::BoxLevel L1(dim); + const int tag_ln = new_ln - 1; - const int coarser_ln = 0; - const int finer_ln = coarser_ln + 1; + const hier::BoxLevel& Ltag = *hierarchy->getPatchLevel(tag_ln)->getBoxLevel(); - // Get the prebalanced L1: + boost::shared_ptr Lnew; + boost::shared_ptr Ltag_to_Lnew; + boost::shared_ptr Lnew_to_Lnew; + + // Get the prebalanced Lnew: const hier::IntVector required_connector_width = - hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); + hierarchy->getRequiredConnectorWidth(tag_ln, new_ln); const hier::IntVector min_size = hier::IntVector::ceilingDivide( - hierarchy->getSmallestPatchSize(finer_ln), hierarchy->getRatioToCoarserLevel(finer_ln) ); - + hierarchy->getSmallestPatchSize(new_ln), + hierarchy->getRatioToCoarserLevel(new_ln)); /* * Tag cells. */ tbox::pout << "\tTagging..." << std::endl; bool exact_tagging = false; - hierarchy->getPatchLevel(coarser_ln)->allocatePatchData(tag_data_id); - mesh_gen->setTags( exact_tagging, hierarchy, coarser_ln, tag_data_id ); - + hierarchy->getPatchLevel(tag_ln)->allocatePatchData(tag_data_id); + mesh_gen->setTags(exact_tagging, hierarchy, tag_ln, tag_data_id); /* * Cluster. */ tbox::pout << "\tClustering..." << std::endl; - abr.setMPI(L0.getMPI()); + boost::shared_ptr bg = + createBoxGenerator(input_db, box_generator_type, new_ln, dim); tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - abr.findBoxesContainingTags( - L1, - L0_to_L1, - L1_to_L0, - hierarchy->getPatchLevel(coarser_ln), + bg->findBoxesContainingTags( + Lnew, + Ltag_to_Lnew, + hierarchy->getPatchLevel(tag_ln), tag_data_id, 1 /* tag_val */, - L0.getGlobalBoundingBox(0), + hier::BoxContainer(Ltag.getGlobalBoundingBox(hier::BlockId(0))), min_size, - exact_tagging ? 1.0 : efficiency_tol, - exact_tagging ? 1.0 : combine_tol, - required_connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); - - outputPostcluster( L1, L0, required_connector_width, "L1: " ); - - /* - * Enforce nesting. - */ - if ( enforce_nesting[1] ) { - enforceNesting( - L1, - L0_to_L1, - L1_to_L0, - hierarchy, - coarser_ln); - } - - if ( L1.getGlobalNumberOfBoxes() == 0 ) { - TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); - } - - boost::shared_ptr lb1 - = createLoadBalancer( base_db, load_balancer_type, 1 , dim); - - tbox::pout << "\tPartitioning..." << std::endl; - - outputPrebalance( L1, L0, required_connector_width, "L1: " ); - - tbox::plog << "\n\tL1 prebalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L1.getLocalNumberOfCells(), - L1.getMPI()); - - if ( load_balance[1] ) { + required_connector_width); + + if (Ltag_to_Lnew->getConnectorWidth() != required_connector_width) { + const hier::Connector& Ltag_to_Ltag = + Ltag.findConnectorWithTranspose( + Ltag, + required_connector_width, + required_connector_width, + hier::CONNECTOR_IMPLICIT_CREATION_RULE); + hier::OverlapConnectorAlgorithm timed_oca; + timed_oca.setTimerPrefix(std::string( + "apps::fix_zero_width") + tbox::Utilities::intToString(new_ln)); tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - lb1->loadBalanceBoxLevel( - L1, - L1_to_L0, - L0_to_L1, - hierarchy, - 1, - hier::Connector(), - hier::Connector(), - hier::IntVector::ceilingDivide(hierarchy->getSmallestPatchSize(1), hierarchy->getRatioToCoarserLevel(1)), - hier::IntVector::ceilingDivide(hierarchy->getLargestPatchSize(1), hierarchy->getRatioToCoarserLevel(1)), - domain_box_level, - bad_interval, - cut_factor); + timed_oca.bridgeWithNesting( + Ltag_to_Lnew, + Ltag_to_Ltag, + hier::Connector(*Ltag_to_Lnew), + hier::IntVector::getZero(dim), + hier::IntVector::getZero(dim), + required_connector_width, + true); } - sortNodes(L1, - L0_to_L1, - L1_to_L0, - false, - true); - - outputPostbalance( L1, L0, required_connector_width, "L1: " ); - - tbox::plog << "\n\tL1 postbalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L1.getLocalNumberOfCells(), - L1.getMPI()); + outputPostcluster(*Lnew, Ltag, required_connector_width, "Lnew: "); - if ( hierarchy->getRatioToCoarserLevel(1) != zero_vec ) { - refineHead( - L1, - L0_to_L1, - L1_to_L0, - hierarchy->getRatioToCoarserLevel(1) ); + if (Lnew->getGlobalNumberOfBoxes() == 0) { + TBOX_WARNING("Level " << new_ln << " box generator resulted in no boxes. Stopping."); + break; } - // Get the L1_to_L1 for edge statistics. - oca.bridge( - L1_to_L1, - L1_to_L0, - L0_to_L1, - L1_to_L0, - L0_to_L1); - - hierarchy->makeNewPatchLevel(1, L1); - } - - const hier::BoxLevel &L1 = *hierarchy->getPatchLevel(1)->getBoxLevel(); - - hier::Connector L2_to_L1; - hier::Connector L1_to_L2; - hier::Connector L2_to_L2; - - if ( max_levels > 2 ) { - /* - * Step 3: Build L2. - */ - tbox::pout << "\n==================== Generating L2 ====================" << std::endl; - - hier::BoxLevel L2(dim); - - const int coarser_ln = 1; - const int finer_ln = coarser_ln + 1; - - // Get the prebalanced L2: - const hier::IntVector required_connector_width = - hierarchy->getRequiredConnectorWidth(coarser_ln, finer_ln); - const hier::IntVector min_size = hier::IntVector::ceilingDivide( - hierarchy->getSmallestPatchSize(finer_ln), hierarchy->getRatioToCoarserLevel(finer_ln) ); - - - /* - * Tag cells. - */ - tbox::pout << "\tTagging..." << std::endl; - bool exact_tagging = false; - hierarchy->getPatchLevel(coarser_ln)->allocatePatchData(tag_data_id); - mesh_gen->setTags( exact_tagging, hierarchy, coarser_ln, tag_data_id ); - - - /* - * Cluster. - */ - tbox::pout << "\tClustering..." << std::endl; - abr.setMPI(L0.getMPI()); - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - abr.findBoxesContainingTags( - L2, - L1_to_L2, - L2_to_L1, - hierarchy->getPatchLevel(coarser_ln), - tag_data_id, - 1 /* tag_val */, - L1.getGlobalBoundingBox(0), - min_size, - exact_tagging ? 1.0 : efficiency_tol, - exact_tagging ? 1.0 : combine_tol, - required_connector_width, - hier::BlockId::zero(), - hier::LocalId(0)); - - outputPostcluster( L2, L1, required_connector_width, "L2: " ); - /* * Enforce nesting. */ - if ( enforce_nesting[2] ) { + if (enforce_nesting[new_ln]) { enforceNesting( - L2, - L1_to_L2, - L2_to_L1, + *Lnew, + *Ltag_to_Lnew, hierarchy, - coarser_ln); - } + tag_ln); - if ( L2.getGlobalNumberOfBoxes() == 0 ) { - TBOX_ERROR("Level " << finer_ln << " box generator resulted in no boxes."); + if (Lnew->getGlobalNumberOfBoxes() == 0) { + TBOX_WARNING( + "Level " << new_ln << " box generator has no box after proper nesting."); + } } + if (hierarchy->getRatioToCoarserLevel(new_ln) != zero_vec) { + refineHead( + *Lnew, + *Ltag_to_Lnew, + hierarchy->getRatioToCoarserLevel(new_ln)); + } - boost::shared_ptr lb2 - = createLoadBalancer( base_db, load_balancer_type, 2 , dim); - - tbox::pout << "\tPartitioning..." << std::endl; + boost::shared_ptr lb = + createLoadBalancer(input_db, load_balancer_type[new_ln], rank_tree_type, new_ln, dim); - outputPrebalance( L2, L1, required_connector_width, "L2: " ); + outputPrebalance(*Lnew, Ltag, required_connector_width, "Lnew: "); - tbox::plog << "\n\tL2 prebalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L2.getLocalNumberOfCells(), - L2.getMPI()); + tbox::plog << "\n\tLnew prebalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(static_cast(1), + static_cast(Lnew->getLocalNumberOfCells())), + Lnew->getMPI()); - if ( load_balance[2] ) { + if (load_balance[new_ln]) { + tbox::pout << "\tPartitioning..." << std::endl; tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - lb2->loadBalanceBoxLevel( - L2, - L2_to_L1, - L1_to_L2, + lb->loadBalanceBoxLevel( + *Lnew, + &Ltag_to_Lnew->getTranspose(), hierarchy, - 1, - hier::Connector(), - hier::Connector(), - hier::IntVector::ceilingDivide(hierarchy->getSmallestPatchSize(2), hierarchy->getRatioToCoarserLevel(2)), - hier::IntVector::ceilingDivide(hierarchy->getLargestPatchSize(2), hierarchy->getRatioToCoarserLevel(2)), + tag_ln, + hierarchy->getSmallestPatchSize(new_ln), + hierarchy->getLargestPatchSize(new_ln), domain_box_level, - bad_interval, - cut_factor); + hierarchy->getRatioToCoarserLevel(new_ln), + hierarchy->getRatioToCoarserLevel(new_ln)); } - sortNodes(L2, - L1_to_L2, - L2_to_L1, - false, - true); - - outputPostbalance( L2, L1, required_connector_width, "L2: " ); - - tbox::plog << "\n\tL2 postalance loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)L2.getLocalNumberOfCells(), - L2.getMPI()); + sortNodes(*Lnew, + *Ltag_to_Lnew, + false, + true); - if ( hierarchy->getRatioToCoarserLevel(2) != zero_vec ) { - refineHead( - L2, - L1_to_L2, - L2_to_L1, - hierarchy->getRatioToCoarserLevel(2) ); + outputPostbalance(*Lnew, Ltag, required_connector_width, "Lnew: "); + + tbox::plog << "\n\tLnew postbalance loads:\n"; + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(static_cast(1), + static_cast(Lnew->getLocalNumberOfCells())), + Lnew->getMPI()); + + if (comm_graph_writer) { + tbox::pout << "\tWriting communication graph..." << std::endl; + tbox::plog << "\nCommunication Graph for balancing Lnew:\n"; + for ( ; + num_records_written < comm_graph_writer->getNumberOfRecords(); + ++num_records_written) { + comm_graph_writer->writeGraphToTextStream(num_records_written, tbox::plog); + } + tbox::plog << "\n\n"; } - // Get the L2_to_L2 for edge statistics. + // Get the Lnew_to_Lnew for edge statistics. oca.bridge( - L2_to_L2, - L2_to_L1, - L1_to_L2, - L2_to_L1, - L1_to_L2); - - hierarchy->makeNewPatchLevel(2, L2); - } + Lnew_to_Lnew, + Ltag_to_Lnew->getTranspose(), + *Ltag_to_Lnew, + false); - // const hier::BoxLevel &L2 = *hierarchy->getPatchLevel(2)->getBoxLevel(); + hierarchy->makeNewPatchLevel(new_ln, Lnew); + } // end new_ln loop tbox::plog << "\n==================== Final hierarchy ====================" << std::endl; - for ( int ln=0; lngetNumberOfLevels(); ++ln ) { + for (int ln = 0; ln < hierarchy->getNumberOfLevels(); ++ln) { tbox::plog << '\n' << "\tL" << ln << " summary:\n" << hierarchy->getPatchLevel(ln)->getBoxLevel()->format("\t\t", 0) @@ -813,10 +733,9 @@ int main( } tbox::plog << "\n\n"; - bool write_visit = main_db->getBoolWithDefault("write_visit", false); - if ( write_visit ) { + if (write_visit) { #ifdef HAVE_HDF5 if ((dim == tbox::Dimension(2)) || (dim == tbox::Dimension(3))) { @@ -824,23 +743,30 @@ int main( * Create the VisIt data writer. * Write the plot file. */ - DerivedVisOwnerData owner_writer; - const std::string visit_filename = base_name + ".visit"; + const std::string visit_filename = base_name_ext + ".visit"; appu::VisItDataWriter visit_data_writer(dim, "VisIt Writer", visit_filename); - visit_data_writer.registerDerivedPlotQuantity("Owner", - "SCALAR", - &owner_writer); + mesh_gen->registerVariablesWithPlotter(visit_data_writer); visit_data_writer.writePlotData(hierarchy, 0); } #else TBOX_WARNING("main: You set write_visit to TRUE,\n" - << "but VisIt dumps are not supported due to\n" - << "not having configured with HDF5.\n"); + << "but VisIt dumps are not supported due to\n" + << "not having configured with HDF5.\n"); #endif } + t_all->stop(); + int size = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + if (tbox::SAMRAI_MPI::getSAMRAIWorld().getRank() == 0) { + std::string timing_file = + base_name + ".timing" + tbox::Utilities::intToString(size); + FILE* fp = fopen(timing_file.c_str(), "w"); + fprintf(fp, "%f\n", t_all->getTotalWallclockTime()); + fclose(fp); + } + } /* @@ -848,14 +774,15 @@ int main( */ tbox::TimerManager::getManager()->print(tbox::plog); - /* * Print input database again to fully show usage. */ plog << "Input database after running..." << std::endl; tbox::InputManager::getManager()->getInputDatabase()->printClassData(plog); - tbox::pout << "\nPASSED: MeshGeneration" << std::endl; + if (error_count == 0) { + tbox::pout << "\nPASSED: MeshGeneration" << std::endl; + } /* * Exit properly by shutting down services in correct order. @@ -867,166 +794,153 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - std::cout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - return fail_count; + return error_count; } - - /* -**************************************************************************** -* Output post-cluster metadata. -**************************************************************************** -*/ + **************************************************************************** + * Output post-cluster metadata. + **************************************************************************** + */ void outputPostcluster( - const hier::BoxLevel &cluster, - const hier::BoxLevel &ref, - const hier::IntVector &ref_to_cluster_width, - const std::string &border ) + const hier::BoxLevel& cluster, + const hier::BoxLevel& ref, + const hier::IntVector& ref_to_cluster_width, + const std::string& border) { + cluster.cacheGlobalReducedData(); + const hier::IntVector cluster_to_ref_width = hier::Connector::convertHeadWidthToBase( cluster.getRefinementRatio(), ref.getRefinementRatio(), ref_to_cluster_width); - const hier::Connector &cluster_to_ref = - cluster.getPersistentOverlapConnectors().findOrCreateConnector( - ref, ref_to_cluster_width, true ); + const hier::Connector& cluster_to_ref = cluster.findConnector(ref, + ref_to_cluster_width, + hier::CONNECTOR_CREATE, + true); cluster.cacheGlobalReducedData(); cluster_to_ref.cacheGlobalReducedData(); tbox::plog << "\n\n" << border << "Cluster summary:\n" - << cluster.format( border + "\t", 0 ) + << cluster.format(border + "\t", 0) << border << "Cluster stats:\n" - << cluster.formatStatistics( border + "\t" ); + << cluster.formatStatistics(border + "\t"); tbox::plog << '\n' << border << "cluster--->ref summary:\n" - << cluster_to_ref.format( border + "\t", 0 ) + << cluster_to_ref.format(border + "\t", 0) << border << "cluster--->ref stats:\n" - << cluster_to_ref.formatStatistics( border + "\t" ); - - return; + << cluster_to_ref.formatStatistics(border + "\t"); } - - /* -**************************************************************************** -* Output pre-balance metadata. -* - pre-balance level -* - pre--->pre for proximity contrast to post--->post -* - pre--->ref for proximity contrast to post--->pre -* - ref--->pre for proximity contrast to ref--->post -**************************************************************************** -*/ + **************************************************************************** + * Output pre-balance metadata. + * - pre-balance level + * - pre--->pre for proximity contrast to post--->post + * - pre--->ref for proximity contrast to post--->pre + * - ref--->pre for proximity contrast to ref--->post + **************************************************************************** + */ void outputPrebalance( - const hier::BoxLevel &pre, - const hier::BoxLevel &ref, - const hier::IntVector &pre_width, - const std::string &border ) + const hier::BoxLevel& pre, + const hier::BoxLevel& ref, + const hier::IntVector& pre_width, + const std::string& border) { + pre.cacheGlobalReducedData(); + const hier::IntVector ref_width = hier::Connector::convertHeadWidthToBase( ref.getRefinementRatio(), pre.getRefinementRatio(), pre_width); - const hier::Connector &pre_to_pre = - pre.getPersistentOverlapConnectors().findOrCreateConnector( - pre, pre_width, true ); + const hier::Connector& pre_to_pre = pre.findConnector(pre, + pre_width, + hier::CONNECTOR_CREATE, + true); tbox::plog << "\n\n" << border << "Prebalance summary:\n" - << pre.format( border + "\t", 0 ) + << pre.format(border + "\t", 0) << border << "Prebalance stats:\n" - << pre.formatStatistics( border + "\t" ); + << pre.formatStatistics(border + "\t"); tbox::plog << '\n' << border << "pre--->pre summary:\n" - << pre_to_pre.format( border + "\t", 0 ) + << pre_to_pre.format(border + "\t", 0) << border << "pre--->pre stats:\n" - << pre_to_pre.formatStatistics( border + "\t" ); - - return; + << pre_to_pre.formatStatistics(border + "\t"); } - - /* -**************************************************************************** -* Output post-balance metadata: -* - post-balance level -* - post--->post for proximity evaluation -* - post--->ref for proximity contrast to pre--->ref -* - ref--->post for proximity contrast to ref--->pre -**************************************************************************** -*/ + **************************************************************************** + * Output post-balance metadata: + * - post-balance level + * - post--->post for proximity evaluation + * - post--->ref for proximity contrast to pre--->ref + * - ref--->post for proximity contrast to ref--->pre + **************************************************************************** + */ void outputPostbalance( - const hier::BoxLevel &post, - const hier::BoxLevel &ref, - const hier::IntVector &post_width, - const std::string &border ) + const hier::BoxLevel& post, + const hier::BoxLevel& ref, + const hier::IntVector& post_width, + const std::string& border) { + post.cacheGlobalReducedData(); + const hier::IntVector ref_width = hier::Connector::convertHeadWidthToBase( ref.getRefinementRatio(), post.getRefinementRatio(), post_width); - const hier::Connector &post_to_post = - post.getPersistentOverlapConnectors().findOrCreateConnector( - post, post_width, true ); + const hier::Connector& post_to_post = post.findConnector(post, + post_width, + hier::CONNECTOR_CREATE, + true); - const hier::Connector &post_to_ref = - post.getPersistentOverlapConnectors().findOrCreateConnector( - ref, post_width, true ); + const hier::Connector& post_to_ref = post.findConnectorWithTranspose(ref, + (post.getRefinementRatio() / ref.getRefinementRatio()) * ref_width, + ref_width, + hier::CONNECTOR_CREATE, + true); - const hier::Connector &ref_to_post = - ref.getPersistentOverlapConnectors().findOrCreateConnector( - post, ref_width, true ); + const hier::Connector& ref_to_post = post_to_ref.getTranspose(); tbox::plog << "\n\n" << border << "Postbalance summary:\n" - << post.format( border + "\t", 0 ) + << post.format(border + "\t", 0) << border << "Postbalance stats:\n" - << post.formatStatistics( border + "\t" ); + << post.formatStatistics(border + "\t"); tbox::plog << '\n' << border << "post--->post summary:\n" - << post_to_post.format( border + "\t", 0 ) + << post_to_post.format(border + "\t", 0) << border << "post--->post stats:\n" - << post_to_post.formatStatistics( border + "\t" ); + << post_to_post.formatStatistics(border + "\t"); tbox::plog << '\n' << border << "post--->ref summary:\n" - << post_to_ref.format( border + "\t", 0 ) + << post_to_ref.format(border + "\t", 0) << border << "post--->ref stats:\n" - << post_to_ref.formatStatistics( border + "\t" ); + << post_to_ref.formatStatistics(border + "\t"); tbox::plog << '\n' << border << "ref--->post summary:\n" - << ref_to_post.format( border + "\t", 0 ) + << ref_to_post.format(border + "\t", 0) << border << "ref--->post stats:\n" - << ref_to_post.formatStatistics( border + "\t" ); - - return; + << ref_to_post.formatStatistics(border + "\t"); } - - /* *********************************************************************** *********************************************************************** @@ -1034,15 +948,14 @@ void outputPostbalance( void sortNodes( hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, bool sort_by_corners, bool sequentialize_global_indices) { - const hier::MappingConnectorAlgorithm mca; - - hier::Connector sorting_map; - hier::BoxLevel seq_box_level(new_box_level.getDim()); hier::BoxLevelConnectorUtils dlbg_edge_utils; + dlbg_edge_utils.setTimerPrefix("apps::sortNodes"); + + boost::shared_ptr sorting_map; + boost::shared_ptr seq_box_level; dlbg_edge_utils.makeSortingMap( seq_box_level, sorting_map, @@ -1050,17 +963,14 @@ void sortNodes( sort_by_corners, sequentialize_global_indices); + hier::MappingConnectorAlgorithm mca; + mca.setTimerPrefix("apps::sortNodes"); + mca.modify(tag_to_new, - new_to_tag, - sorting_map, + *sorting_map, &new_box_level); - - return; } - - - /* *********************************************************************** *********************************************************************** @@ -1068,70 +978,70 @@ void sortNodes( void refineHead( hier::BoxLevel& head, hier::Connector& ref_to_head, - hier::Connector& head_to_ref, - const hier::IntVector &refinement_ratio ) + const hier::IntVector& refinement_ratio) { + hier::Connector& head_to_ref = ref_to_head.getTranspose(); + head.refineBoxes( head, refinement_ratio, - head.getRefinementRatio()*refinement_ratio); + head.getRefinementRatio() * refinement_ratio); head.finalize(); - const hier::IntVector& head_to_ref_width = + hier::IntVector head_to_ref_width = refinement_ratio * head_to_ref.getConnectorWidth(); head_to_ref.setBase(head); head_to_ref.setWidth(head_to_ref_width, true); ref_to_head.setHead(head, true); ref_to_head.refineLocalNeighbors(refinement_ratio); - - return; } - - boost::shared_ptr createLoadBalancer( - boost::shared_ptr &input_db, - const std::string &lb_type, + const boost::shared_ptr& input_db, + const std::string& lb_type, + const std::string& rank_tree_type, int ln, - const tbox::Dimension &dim ) + const tbox::Dimension& dim) { if (lb_type == "TreeLoadBalancer") { + boost::shared_ptr rank_tree = getRankTree(*input_db, + rank_tree_type); + boost::shared_ptr - tree_lb(new mesh::TreeLoadBalancer( - dim, - std::string("mesh::TreeLoadBalancer") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("TreeLoadBalancer", - boost::shared_ptr()))); + tree_lb(new mesh::TreeLoadBalancer( + dim, + std::string("mesh::TreeLoadBalancer") + tbox::Utilities::intToString(ln), + input_db->getDatabaseWithDefault("TreeLoadBalancer", + boost::shared_ptr()))); tree_lb->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + tree_lb->setCommGraphWriter(comm_graph_writer); return tree_lb; - }else if (lb_type == "TreeLoadBalancerOld") { + } else if (lb_type == "CascadePartitioner") { - boost::shared_ptr - tree_lb(new mesh::TreeLoadBalancerOld( - dim, - std::string("mesh::TreeLoadBalancerOld") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("TreeLoadBalancerOld", - boost::shared_ptr()))); - tree_lb->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); - return tree_lb; + boost::shared_ptr + cascade_lb(new mesh::CascadePartitioner( + dim, + std::string("mesh::CascadePartitioner") + tbox::Utilities::intToString(ln), + input_db->getDatabaseWithDefault("CascadePartitioner", + boost::shared_ptr()))); + return cascade_lb; } else if (lb_type == "ChopAndPackLoadBalancer") { boost::shared_ptr - cap_lb(new mesh::ChopAndPackLoadBalancer( - dim, - std::string("mesh::ChopAndPackLoadBalancer") + tbox::Utilities::intToString(ln), - input_db->getDatabaseWithDefault("ChopAndPackLoadBalancer", - boost::shared_ptr()))); + cap_lb(new mesh::ChopAndPackLoadBalancer( + dim, + std::string("mesh::ChopAndPackLoadBalancer") + tbox::Utilities::intToString(ln), + input_db->getDatabaseWithDefault("ChopAndPackLoadBalancer", + boost::shared_ptr()))); return cap_lb; - } - else { + } else { TBOX_ERROR( "Missing or bad load_balancer specification in Main database.\n" << "Specify load_balancer_type = STRING, where STRING can be\n" @@ -1141,17 +1051,116 @@ createLoadBalancer( return boost::shared_ptr(); } +boost::shared_ptr +createBoxGenerator( + const boost::shared_ptr& input_db, + const std::string& bg_type, + int ln, + const tbox::Dimension& dim) +{ + boost::shared_ptr null_db; + + if (bg_type == "BergerRigoutsos") { + + boost::shared_ptr + berger_rigoutsos( + new mesh::BergerRigoutsos( + dim, + input_db->getDatabaseWithDefault( + std::string("BergerRigoutsos"), null_db))); + berger_rigoutsos->useDuplicateMPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + berger_rigoutsos->setTimerPrefix( + std::string("mesh::BergerRigoutsos") + tbox::Utilities::intToString(ln)); + + return berger_rigoutsos; + + } else if (bg_type == "TileClustering") { + + boost::shared_ptr + tile_clustering( + new mesh::TileClustering( + dim, + input_db->getDatabaseWithDefault( + std::string("TileClustering"), null_db))); + tile_clustering->setTimerPrefix( + std::string("mesh::TileClustering") + tbox::Utilities::intToString(ln)); + + return tile_clustering; + + } else { + TBOX_ERROR( + "Missing or box generator specification in Main database.\n" + << "Specify load_balancer_type = STRING, where STRING can be\n" + << "\"BergerRigoutsos\" or \"TileClustering\"."); + } + + return boost::shared_ptr(); +} + +/* + **************************************************************************** + * Get the RankTreeStrategy implementation for TreeLoadBalancer + **************************************************************************** + */ +boost::shared_ptr getRankTree( + Database& input_db, + const std::string& rank_tree_type) +{ + tbox::plog << "Rank tree type is " << rank_tree_type << '\n'; + + boost::shared_ptr rank_tree; + + if (rank_tree_type == "BalancedDepthFirstTree") { + + BalancedDepthFirstTree * bdfs(new BalancedDepthFirstTree()); + + if (input_db.isDatabase("BalancedDepthFirstTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("BalancedDepthFirstTree"); + bool do_left_leaf_switch = tmp_db->getBoolWithDefault("do_left_leaf_switch", true); + bdfs->setLeftLeafSwitching(do_left_leaf_switch); + } + rank_tree.reset(bdfs); + } else if (rank_tree_type == "CenteredRankTree") { + + CenteredRankTree * crt(new tbox::CenteredRankTree()); + + if (input_db.isDatabase("CenteredRankTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("CenteredRankTree"); + bool make_first_rank_the_root = tmp_db->getBoolWithDefault("make_first_rank_the_root", + true); + crt->makeFirstRankTheRoot(make_first_rank_the_root); + } + + rank_tree.reset(crt); + + } else if (rank_tree_type == "BreadthFirstRankTree") { + + BreadthFirstRankTree * dft(new tbox::BreadthFirstRankTree()); + + if (input_db.isDatabase("BreadthFirstRankTree")) { + boost::shared_ptr tmp_db = input_db.getDatabase("BreadthFirstRankTree"); + const int tree_degree = tmp_db->getIntegerWithDefault("tree_degree", true); + dft->setTreeDegree(static_cast(tree_degree)); + } + + rank_tree.reset(dft); + + } else { + TBOX_ERROR("Unrecognized RankTreeStrategy " << rank_tree_type); + } + + return rank_tree; +} /* -************************************************************************ -************************************************************************ -*/ + ************************************************************************ + ************************************************************************ + */ void enforceNesting( hier::BoxLevel& L1, hier::Connector& L0_to_L1, - hier::Connector& L1_to_L0, const boost::shared_ptr& hierarchy, int coarser_ln) { @@ -1159,48 +1168,53 @@ void enforceNesting( const tbox::Dimension dim(hierarchy->getDim()); - const int cell_count = L1.getGlobalNumberOfCells(); + const hier::BoxLevel& L0 = L0_to_L1.getBase(); + + const size_t cell_count = L1.getGlobalNumberOfCells(); /* * Make L1 nest inside L0 by nesting_width. */ const hier::IntVector nesting_width(dim, hierarchy->getProperNestingBuffer(coarser_ln)); - hier::BoxLevel L1nested(dim); - hier::Connector L1_to_L1nested; + const hier::IntVector nesting_width_transpose = hier::Connector::convertHeadWidthToBase( + L0.getRefinementRatio(), + L1.getRefinementRatio(), + nesting_width); + boost::shared_ptr L1nested; + boost::shared_ptr L1_to_L1nested; hier::BoxLevelConnectorUtils blcu; - blcu.computeInternalParts( L1nested, - L1_to_L1nested, - L1_to_L0, - -nesting_width, - hierarchy->getGridGeometry()->getDomainSearchTree() ); + blcu.computeInternalParts(L1nested, + L1_to_L1nested, + L1.findConnectorWithTranspose(L0, + nesting_width, + nesting_width_transpose, + hier::CONNECTOR_CREATE, + true), + -nesting_width, + hierarchy->getGridGeometry()->getDomainSearchTree()); hier::MappingConnectorAlgorithm mca; - mca.modify( L0_to_L1, - L1_to_L0, - L1_to_L1nested, - &L1, - &L1nested ); + mca.modify(L0_to_L1, + *L1_to_L1nested, + &L1, + L1nested.get()); /* * Remove overflow nesting. */ - blcu.computeInternalParts( L1nested, - L1_to_L1nested, - L1_to_L0, - hier::IntVector::getZero(dim), - hierarchy->getGridGeometry()->getDomainSearchTree() ); - mca.modify( L0_to_L1, - L1_to_L0, - L1_to_L1nested, - &L1, - &L1nested ); - - if ( cell_count != L1.getGlobalNumberOfCells() ) { + blcu.computeInternalParts(L1nested, + L1_to_L1nested, + L0_to_L1.getTranspose(), + hier::IntVector::getZero(dim), + hierarchy->getGridGeometry()->getDomainSearchTree()); + mca.modify(L0_to_L1, + *L1_to_L1nested, + &L1, + L1nested.get()); + + if (cell_count != L1.getGlobalNumberOfCells()) { tbox::plog << "\t\tWarning: enforceNesting changed number of cells from " << cell_count << " to " << L1.getGlobalNumberOfCells() << '\n'; - } - else { + } else { tbox::plog << "\t\tenforceNesting left number of cells at " << cell_count << '\n'; } - - return; } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/bigbox.3d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/bigbox.3d.tile.input new file mode 100644 index 00000000..1952b510 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/bigbox.3d.tile.input @@ -0,0 +1,157 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "bigbox.3d.tile" + + write_visit = FALSE + + log_all_nodes = TRUE + + domain_boxes = [ (0,0,0) , (4095, 1152, 1023) ] + xlo = 0.e0, 0.e0, 0.e0 // lower end of computational domain. + xhi = 1024.e0, 288.e0, 256.e0 // upper end of computational domain. + + enforce_nesting = TRUE, TRUE, TRUE + + // autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 20.0, 20.0, 20.0 + shrink_distance_1 = 20.0, 20.0, 20.0 + } + +} + + +TileClustering { + tile_size = 6,6,6 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + tile_size = 12,12,12 + flexible_load_tolerance = 0.05 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.05 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 1 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + level_3 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/core2shell.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/core2shell.3d.treelb.input deleted file mode 100644 index 9d412812..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/core2shell.3d.treelb.input +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "core2shell.3d.treelb" - log_all_nodes = FALSE - write_visit = FALSE - enforce_nesting = FALSE - load_balance = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(9,9,9)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 1.0, 1.0, 1.0 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 4 - - ghost_cell_width = 4, 4, 4 - - efficiency_tol = 0.85 - combine_tol = 0.85 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SphericalShellGenerator" - - SphericalShellGenerator { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at (0,0,0), with shell i having inner radius radii[2*i] - and outer radius radii[(2*i)+1]. Note that making shells too thin - can lead to discontinuous tagging. - */ - radii = 0.0, 0.25, 0.40, 0.45, 0.85, 0.87 - - // Tag L0 by buffering and l1 by buffering. - buffer_distance_0 = 0.032, 0.032, 0.032 - buffer_distance_1 = 0.00, 0.00, 0.00 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/deep_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/deep_front.3d.treelb.input deleted file mode 100644 index 391da664..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/deep_front.3d.treelb.input +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "deep_front.3d.treelb" - log_all_nodes = FALSE - write_visit = FALSE - enforce_nesting = FALSE - load_balance = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(13,6,6)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - ghost_cell_width = 4, 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 4 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 1.0, 0.0, 0.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.75 - - // Tag L0 by buffering and L1 by buffering. - buffer_distance_0 = 0.08, 0.08, 0.08 - buffer_distance_1 = 0.04, 0.04, 0.04 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.caplb.input new file mode 100644 index 00000000..eed89aa7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.caplb.input @@ -0,0 +1,141 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + + +// Mesh configuration: Front with many boxes, similar to the +// domainexpansion LinAdv scaling benchmark. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + + +Main { + dim = 3 + + base_name = "domexlike.caplb" + + write_visit = FALSE + + log_all_nodes = FALSE + + // Domain definition + domain_boxes = [(0,0,0),(15,15,15)] + xlo = 0.0, 0.0, 0.0 + xhi = 4.0, 4.0, 4.0 + + enforce_nesting = FALSE + load_balance = TRUE + + load_balancer_type = "ChopAndPackLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + write_comm_graph = FALSE + + autoscale_base_nprocs = 1 + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 2.0, 0.0, 0.0 + period = 4.1, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.16, 0.16, 0.16 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + sort_output_nodes = TRUE + efficiency_tolerance = 0.80 + combine_efficiency = 0.80 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.input deleted file mode 100644 index 689743d9..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.input +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "domexlike" - log_all_nodes = FALSE - write_visit = FALSE - enforce_nesting = FALSE - load_balance = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - // domain_boxes = [(0,0,0),(15,7,7)] - domain_boxes = [(0,0,0),(15,15,15)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 4.0, 4.0, 4.0 - - ghost_cell_width = 4, 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 1 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 2.0, 0.0, 0.0 - period = 4.1, 4.0, 4.0 - amplitude = 0.5 - - // Tag L0 by buffering and L1 by buffering. - // buffer_distance_0 = 0.08, 0.08, 0.08 - // buffer_distance_1 = 0.02, 0.02, 0.02 - buffer_distance_0 = 0.16, 0.16, 0.16 - buffer_distance_1 = 0.02, 0.02, 0.02 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 6, 6, 6 - level_1 = 6, 6, 6 - level_2 = 6, 6, 6 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 2, 2, 2 - level_2 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.treelb.input new file mode 100644 index 00000000..84401e3a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/domexlike.treelb.input @@ -0,0 +1,141 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + + +// Mesh configuration: Front with many boxes, similar to the +// domainexpansion LinAdv scaling benchmark. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + + +Main { + dim = 3 + + base_name = "domexlike.treelb" + + write_visit = FALSE + + log_all_nodes = FALSE + + // Domain definition + domain_boxes = [(0,0,0),(15,15,15)] + xlo = 0.0, 0.0, 0.0 + xhi = 4.0, 4.0, 4.0 + + enforce_nesting = FALSE + load_balance = TRUE + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + write_comm_graph = FALSE + + autoscale_base_nprocs = 1 + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 2.0, 0.0, 0.0 + period = 4.1, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.16, 0.16, 0.16 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + sort_output_nodes = TRUE + efficiency_tolerance = 0.80 + combine_efficiency = 0.80 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2, 2 + level_2 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.caplb.input new file mode 100644 index 00000000..807db32c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.caplb.input @@ -0,0 +1,129 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.caplb" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.cascade.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.cascade.input new file mode 100644 index 00000000..8aa992db --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.cascade.input @@ -0,0 +1,147 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.treelb" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = TRUE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + flexible_load_tolerance = 0.05 + // Debugging options + DEV_report_load_balance = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = TRUE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.localtile.input new file mode 100644 index 00000000..5c81f9b0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.localtile.input @@ -0,0 +1,138 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.localtile" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = FALSE + coalesce_boxes = TRUE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.05 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.tile.input new file mode 100644 index 00000000..387afaae --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.tile.input @@ -0,0 +1,138 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.tile" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "ChopAndPackLoadBalancer", "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.05 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.treelb.input new file mode 100644 index 00000000..8ac27519 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/front.3d.treelb.input @@ -0,0 +1,136 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.treelb" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = TRUE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.localtile.input new file mode 100644 index 00000000..eea050a9 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.localtile.input @@ -0,0 +1,159 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +/* +From Luitjens and Berzins, Scalable parallel regridding algorithms +for block-structured adaptive mesh refinement, Concurrency +andComputation: Practice and Experience, 2011, 23:1522-1537. The +problem description is at the beginning of section 3. + +This is Luitjens's weak-scaling set-up. +He probably used a min box size of 1x1x1. He didn't say. +That's unrealistic. I'm using 3x3x3 (coarse resolution) min box size +with 4x4x4 min box size for inflection cut. + +This set-up uses tiling with size 16^3, similar to Luitjens, but we +then coalesce our tiles. */ + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + + +Main { + dim = 3 + + base_name = "lsphere_weak.3d.localtile" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(31,31,15)] + xlo = -0.5, -0.5, -0.0 + xhi = 0.5, 0.5, 0.5 + + enforce_nesting = FALSE, FALSE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + init_center = 0.0, 0.0, 0.0 + radii = 0.3, 0.4 + + buffer_distance_0 = 0.00, 0.00, 0.00 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, BreadthFirstTree + rank_tree_type = "CenteredRankTree" + +} + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + DEV_min_box_size_from_cutting = 5, 5, 5 + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +// Used if load_balancer_type is ChopAndPackLoadBalancer. Refer to mesh::ChopAndPackLoadBalancer for input. +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 8, 8, 8 + coalesce_boxes = TRUE + allow_remote_tile_extent = FALSE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + tile_size = 16, 16, 16 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + max_levels = 2 + + largest_patch_size { + level_0 = -1,-1,-1 + } + smallest_patch_size { + level_0 = 16, 16, 16 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 16, 16, 16 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.treelb.input new file mode 100644 index 00000000..d30c21b3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/lsphere_weak.3d.treelb.input @@ -0,0 +1,158 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +/* +From Luitjens and Berzins, Scalable parallel regridding algorithms +for block-structured adaptive mesh refinement, Concurrency +andComputation: Practice and Experience, 2011, 23:1522-1537. The +problem description is at the beginning of section 3. + +This is Luitjens's weak-scaling set-up. +He probably used a min box size of 1x1x1. He didn't say. +That's unrealistic. I'm using 3x3x3 (coarse resolution) min box size +with 4x4x4 min box size for inflection cut. + +This set-up uses Berger-Rigoutsos, for contrast to tiling. +*/ + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + + +Main { + dim = 3 + + base_name = "lsphere_weak.3d.treelb" + + write_visit = FALSE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(31,31,15)] + xlo = -0.5, -0.5, -0.0 + xhi = 0.5, 0.5, 0.5 + + enforce_nesting = FALSE, FALSE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + center = 0.0, 0.0, 0.0 + radii = 0.3, 0.4 + + buffer_distance_0 = 0.00, 0.00, 0.00 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, BreadthFirstTree + rank_tree_type = "CenteredRankTree" + +} + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + DEV_min_box_size_from_cutting = 5, 5, 5 + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +// Used if load_balancer_type is ChopAndPackLoadBalancer. Refer to mesh::ChopAndPackLoadBalancer for input. +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 8, 8, 8 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + max_levels = 2 + + largest_patch_size { + level_0 = -1,-1,-1 + } + smallest_patch_size { + level_0 = 16, 16, 16 + } + ratio_to_coarser { + level_1 = 2, 2, 2 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/mild_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/mild_front.3d.treelb.input deleted file mode 100644 index 875a777c..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/mild_front.3d.treelb.input +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "mild_front.3d.treelb" - log_all_nodes = FALSE - write_visit = FALSE - enforce_nesting = FALSE - load_balance = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(15,7,7)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - ghost_cell_width = 4, 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 4 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 1.0, 0.0, 0.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - - // Tag L0 by buffering and L1 by buffering. - buffer_distance_0 = 0.08, 0.08, 0.08 - buffer_distance_1 = 0.04, 0.04, 0.04 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/shallow_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/shallow_front.3d.treelb.input deleted file mode 100644 index fb671e30..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/shallow_front.3d.treelb.input +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "shallow_front.3d.treelb" - log_all_nodes = FALSE - write_visit = FALSE - enforce_nesting = FALSE - load_balance = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(15,7,7)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - ghost_cell_width = 4, 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 4 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 1.0, 0.0, 0.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.25 - - // Tag L0 by buffering and L1 by buffering. - buffer_distance_0 = 0.08, 0.08, 0.08 - buffer_distance_1 = 0.04, 0.04, 0.04 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.caplb.input new file mode 100644 index 00000000..2c310ac7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.caplb.input @@ -0,0 +1,131 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single sphere + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "single_sphere.3d.caplb" + log_all_nodes = FALSE + write_visit = FALSE + enforce_nesting = FALSE + load_balance = TRUE + + load_balancer_type = "ChopAndPackLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + write_comm_graph = FALSE + + domain_boxes = [(0,0,0),(9,9,9)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.0, 1.0, 1.0 + + autoscale_base_nprocs = 2 + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.50 + + buffer_distance_0 = 0.05, 0.05, 0.05 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + sort_output_nodes = TRUE + efficiency_tolerance = 0.88 + combine_efficiency = 0.88 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.treelb.input index 4c398983..cbd88bb2 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/performance_inputs/single_sphere.3d.treelb.input @@ -3,12 +3,15 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. * ************************************************************************/ +// Mesh configuration: Single sphere +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. Main { dim = 3 @@ -19,80 +22,73 @@ Main { enforce_nesting = FALSE load_balance = TRUE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(9,9,9)] + rank_tree_type = "CenteredRankTree" - /* - Specify physical domain box. - */ + write_comm_graph = FALSE + + domain_boxes = [(0,0,0),(9,9,9)] xlo = 0.0, 0.0, 0.0 xhi = 1.0, 1.0, 1.0 - /* - Base nprocs for automatic scaling. - */ autoscale_base_nprocs = 2 - ghost_cell_width = 4, 4, 4 - - efficiency_tol = 0.88 - combine_tol = 0.88 - - BergerRigoutsos { - laplace_cut_threshold_ar = 4 - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - mesh_generator_name = "SphericalShellGenerator" SphericalShellGenerator { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at (0,0,0), with shell i having inner radius radii[2*i] - and outer radius radii[(2*i)+1]. Note that making shells too thin - can lead to discontinuous tagging. - */ radii = 0.0, 0.50 - // Tag L0 by buffering and l1 by buffering. buffer_distance_0 = 0.05, 0.05, 0.05 buffer_distance_1 = 0.00, 0.00, 0.00 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06 } } +BergerRigoutsos { + DEV_inflection_cut_threshold_ar = 4 + sort_output_nodes = TRUE + efficiency_tolerance = 0.88 + combine_efficiency = 0.88 + DEV_build_zero_width_connector = TRUE + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 1000000 + flexible_load_tolerance = 0.05 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 } TimerManager { @@ -100,7 +96,7 @@ TimerManager { print_summed = TRUE print_max = TRUE print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*", "appu::main::all" } @@ -111,10 +107,6 @@ PatchHierarchy { */ max_levels = 3 - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE largest_patch_size { level_0 = -1,-1,-1 // level_0 = 20,20,20 diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/box_deep.2d.cascade.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/box_deep.2d.cascade.input new file mode 100644 index 00000000..e34719e2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/box_deep.2d.cascade.input @@ -0,0 +1,163 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Deep hierarchy. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "box_deep.2d.cascade" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(11,11)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 0.07, 0.03 + shrink_distance_1 = 0.07, 0.03 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + // tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_summarize_map = FALSE +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 8 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.caplb.input new file mode 100644 index 00000000..ee9ee58d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.caplb.input @@ -0,0 +1,135 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.caplb" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 10, 10 + coalesce_boxes = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_build_zero_width_connector = TRUE + DEV_cluster_tiles = FALSE + // DEV_tag_coarsen_ratio = 4, 4 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_min_box_size_from_cutting = 4, 4 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.localtile.input new file mode 100644 index 00000000..59f535d5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.localtile.input @@ -0,0 +1,145 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.localtile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = FALSE + coalesce_boxes = TRUE + DEV_print_steps = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + // DEV_tag_coarsen_ratio = 4, 4 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_min_box_size_from_cutting = 7, 7 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.03 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 12, 12 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.tile.input new file mode 100644 index 00000000..a602b4a6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.tile.input @@ -0,0 +1,145 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.tile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "ChopAndPackLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + // DEV_tag_coarsen_ratio = 4, 4 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_min_box_size_from_cutting = 7, 7 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.03 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 12, 12 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.treelb.input new file mode 100644 index 00000000..e56baacd --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.treelb.input @@ -0,0 +1,156 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.treelb" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + buffer_distance_2 = 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 7, 7 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + // DEV_tag_coarsen_ratio = 4, 4 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_min_box_size_from_cutting = 7, 7 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 12, 12 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.voucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.voucher.input new file mode 100644 index 00000000..d3a17baf --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.2d.voucher.input @@ -0,0 +1,156 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "front.2d.voucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(99,49)] + xlo = 0.0, 0.0 + xhi = 2.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0 + period = 2.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.07, 0.07 + buffer_distance_1 = 0.02, 0.02 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 7, 7 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + // DEV_tag_coarsen_ratio = 4, 4 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_min_box_size_from_cutting = 7, 7 + DEV_log_node_history = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_voucher_mode = TRUE + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 12, 12 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.caplb.input new file mode 100644 index 00000000..0c7bd379 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.caplb.input @@ -0,0 +1,129 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.caplb" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 2, 2, 2 + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.localtile.input new file mode 100644 index 00000000..932cf55d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.localtile.input @@ -0,0 +1,139 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.localtile" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = TRUE + allow_remote_tile_extent = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.tile.input new file mode 100644 index 00000000..4e78493b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.tile.input @@ -0,0 +1,139 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.tile" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "ChopAndPackLoadBalancer", "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_barrier_and_time = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + tile_size = 12, 12, 12 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.treelb.input new file mode 100644 index 00000000..e083c8d7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/front.3d.treelb.input @@ -0,0 +1,138 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "front.3d.treelb" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(11,5,5)] + xlo = 0.0, 0.0, 0.0 + xhi = 2.0, 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 1 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SinusoidalFrontGenerator" + + SinusoidalFrontGenerator { + init_disp = 1.0, 1.0, 1.0 + period = 2.0, 4.0, 4.0 + amplitude = 0.5 + + buffer_distance_0 = 0.09, 0.09, 0.09 + buffer_distance_1 = 0.02, 0.02, 0.02 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6, 6 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.caplb.input new file mode 100644 index 00000000..e593f6da --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.caplb.input @@ -0,0 +1,128 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.caplb" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(49,49)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + load_balance = TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 10, 10 + coalesce_boxes = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.85 + combine_efficiency = 0.85 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 12, 12 + level_1 = 6, 6 + level_2 = 15, 15 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.cascadetile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.cascadetile.input new file mode 100644 index 00000000..c74723b6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.cascadetile.input @@ -0,0 +1,167 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.cascadetile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.localtile.input new file mode 100644 index 00000000..ea883f38 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.localtile.input @@ -0,0 +1,133 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.localtile" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(47,47)] + x_lo = 0.0, 0.0 + x_up = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + coalesce_boxes = TRUE + allow_remote_tile_extent = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.03 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = TRUE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tile.input new file mode 100644 index 00000000..e7f7de65 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tile.input @@ -0,0 +1,153 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.tile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tilevoucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tilevoucher.input new file mode 100644 index 00000000..4941b441 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.tilevoucher.input @@ -0,0 +1,156 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lss.2d.tilevoucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.treelb.input new file mode 100644 index 00000000..3fc9d644 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.treelb.input @@ -0,0 +1,170 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +Main { + // Dimension of problem. No default. + dim = 2 + + // Base name for output files. + base_name = "lss.2d.treelb" + + // Whether to dump the hierarchy in a visit file. + write_visit = TRUE + + // Whether to log all nodes. + log_all_nodes = FALSE + + // Domain definition: box, lower and upper corners. + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + // Whether to enforce nesting (one value for each level, but first value is ignored). + enforce_nesting = TRUE, TRUE, TRUE + + // Scale the domain size by number of processes divided by this value. + autoscale_base_nprocs = 4 + + // Box generator types: BergerRigoutsos or TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer or CascadePartitioner + load_balancer_type = "TreeLoadBalancer" + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, or BreadthFirstTree. + rank_tree_type = "CenteredRankTree" + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + // Mesh generator: SphericalShellGenerator, SinusoidalFrontGenerator, or ShrunkenLevelGenerator. + mesh_generator_name = "SphericalShellGenerator" + + // Refer to SphericalShellGenerator for input. + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = FALSE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.voucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.voucher.input new file mode 100644 index 00000000..e954b2c9 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.2d.voucher.input @@ -0,0 +1,164 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +Main { + // Dimension of problem. No default. + dim = 2 + + // Base name for output files. + base_name = "lss.2d.voucher" + + // Whether to dump the hierarchy in a visit file. + write_visit = TRUE + + // Whether to log all nodes. + log_all_nodes = FALSE + + // Domain definition: box, lower and upper corners. + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + // Whether to enforce nesting (one value for each level, but first value is ignored). + enforce_nesting = TRUE, TRUE, TRUE + + // Scale the domain size by number of processes divided by this value. + autoscale_base_nprocs = 4 + + // Box generator types: BergerRigoutsos or TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer or CascadePartitioner + load_balancer_type = "TreeLoadBalancer" + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, or BreadthFirstTree. + rank_tree_type = "CenteredRankTree" + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + // Mesh generator: SphericalShellGenerator, SinusoidalFrontGenerator, or ShrunkenLevelGenerator. + mesh_generator_name = "SphericalShellGenerator" + + // Refer to SphericalShellGenerator for input. + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 7, 7 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_voucher_mode = TRUE + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.caplb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.caplb.input new file mode 100644 index 00000000..3d367179 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.caplb.input @@ -0,0 +1,134 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lss.3d.caplb" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "ChopAndPackLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.localtile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.localtile.input new file mode 100644 index 00000000..8f4d082b --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.localtile.input @@ -0,0 +1,134 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lss.3d.localtile" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "ChopAndPackLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = FALSE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.03 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tile.input new file mode 100644 index 00000000..604af5bb --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tile.input @@ -0,0 +1,134 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lss.3d.tile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.03 + DEV_voucher_mode = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tilevoucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tilevoucher.input new file mode 100644 index 00000000..f95edcd0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.tilevoucher.input @@ -0,0 +1,134 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lss.3d.tilevoucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.03 + DEV_voucher_mode = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.treelb.input new file mode 100644 index 00000000..5b470483 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.treelb.input @@ -0,0 +1,167 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +Main { + // Dimension of problem. No default. + dim = 3 + + // Base name for output files. + base_name = "lss.3d.treelb" + + // Whether to dump the hierarchy in a visit file. + write_visit = TRUE + + // Whether to log all nodes. + log_all_nodes = FALSE + + // Domain definition: box, lower and upper corners. + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + // Whether to enforce nesting (one value for each level, but first value is ignored). + enforce_nesting = TRUE, TRUE, TRUE + + // Scale the domain size by number of processes divided by this value. + autoscale_base_nprocs = 4 + + // Box generator types: BergerRigoutsos or TileClustering + box_generator_type = "BergerRigoutsos" + + // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer or CascadePartitioner + load_balancer_type = "TreeLoadBalancer" + + // Tree type for TreeLoadBalancer: CenteredRankTree, BalancedDepthFirstTree, or BreadthFirstTree. + rank_tree_type = "CenteredRankTree" + + // Whether to load balance (one value for each level). + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + // Mesh generator: SphericalShellGenerator, SinusoidalFrontGenerator, or ShrunkenLevelGenerator. + mesh_generator_name = "SphericalShellGenerator" + + // Refer to SphericalShellGenerator for input. + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +// Used if box_generator_type is TileClustering. Refer to mesh::TileClustering for input. +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +// Used if box_generator_type is BergerRigoutsos. Refer to mesh::BergerRigoutsos for input. +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +// Used if load_balancer_type is TreeLoadBalancer. Refer to mesh::TreeLoadBalancer for input. +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +// Used if rank_tree_type is CenteredRankTree. Refer to tbox::CenteredRankTree for input. +CenteredRankTree { // Parameters for BalancedDepthFirstTree in getRankTree() + make_first_rank_the_root = TRUE +} + +// Used if rank_tree_type is BalancedDepthFirstTree. Refer to tbox::CenteredRankTree for input. +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +// Used if rank_tree_type is BreadthFirstRankTree. Refer to tbox::CenteredRankTree for input. +BreadthFirstRankTree { // Parameters for CenteredRankTree in getRankTree() + tree_degree = 2 +} + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +// Refer to hier::PatchHierarchy for input. +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1,-1 + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.voucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.voucher.input new file mode 100644 index 00000000..3212eba7 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lss.3d.voucher.input @@ -0,0 +1,137 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Lump with 2 shells. + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lss.3d.voucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + radii = 0.0, 0.35, 0.70, 0.75, 1.15, 1.17 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.03 + DEV_voucher_mode = TRUE + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + // Specify number of levels (1, 2 or 3 for this test). + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.cascade.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.cascade.input new file mode 100644 index 00000000..294e1ee3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.cascade.input @@ -0,0 +1,164 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.cascade" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "CascadePartitioner" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + // tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_summarize_map = FALSE +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tile.input new file mode 100644 index 00000000..e95d5036 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tile.input @@ -0,0 +1,165 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.tile" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + coalesce_boxes_from_same_patch = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_summarize_map = FALSE +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilecascade.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilecascade.input new file mode 100644 index 00000000..b8def916 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilecascade.input @@ -0,0 +1,165 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.tilecascade" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner", "CascadePartitioner" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + coalesce_boxes_from_same_patch = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_summarize_map = FALSE +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilevoucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilevoucher.input new file mode 100644 index 00000000..7e5b80ca --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.tilevoucher.input @@ -0,0 +1,155 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.tilevoucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + tile_size = 21, 21 + // max_spread_procs = 8 + DEV_voucher_mode = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.treelb.input new file mode 100644 index 00000000..e132a147 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.treelb.input @@ -0,0 +1,151 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.treelb" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = FALSE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.voucher.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.voucher.input new file mode 100644 index 00000000..e9ee3318 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.2d.voucher.input @@ -0,0 +1,158 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.voucher" + + write_visit = TRUE + + log_all_nodes = FALSE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = TRUE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +VoucherTransitLoad { + DEV_partition_work_supply_recursively = TRUE + DEV_print_steps = TRUE + DEV_print_edge_steps = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.3d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.3d.tile.input new file mode 100644 index 00000000..558af46c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/lump.3d.tile.input @@ -0,0 +1,134 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single sphere (lump). + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "lump.3d.tile" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(10,10,10)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.5, 1.5, 1.5 + + enforce_nesting = TRUE, TRUE, FALSE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer", "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.75 + + buffer_distance_0 = 0.04, 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 4, 4, 4 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_print_steps = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 12, 12, 12 + flexible_load_tolerance = 0.03 + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1, -1, -1 + // level_0 = 20, 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 4, 4, 4 + level_1 = 6, 6, 6 + level_2 = 6, 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 3, 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/rootcycle.bug.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/rootcycle.bug.input new file mode 100644 index 00000000..1ee9e399 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/rootcycle.bug.input @@ -0,0 +1,172 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Single disc (lump). + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "lump.2d.voucher" + + write_visit = TRUE + + log_all_nodes = TRUE + + domain_boxes = [(0,0),(47,47)] + xlo = 0.0, 0.0 + xhi = 1.0, 1.0 + + enforce_nesting = TRUE, TRUE, TRUE + + autoscale_base_nprocs = 4 + + box_generator_type = "TileClustering" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + radii = 0.0, 0.65 + + buffer_distance_0 = 0.04, 0.04 + buffer_distance_1 = 0.00, 0.00 + } + +} + + +TileClustering { + tile_size = 7, 7 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_print_steps = TRUE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + DEV_debug_checks = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 7, 7 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +TreeLoadBalancer { + tile_size = 21, 21 + flexible_load_tolerance = 0.05 + // max_spread_procs = 8 + DEV_voucher_mode = TRUE + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = TRUE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_summarize_map = TRUE +} + + +TreeLoadBalancer { + flexible_load_tolerance = 0.05 + max_spread_procs = 2 + DEV_voucher_mode = TRUE + DEV_report_load_balance = TRUE // Reported in main + + // Debugging options + DEV_print_steps = TRUE + DEV_check_map = TRUE + DEV_check_connectivity = TRUE + DEV_summarize_map = TRUE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +VoucherTransitLoad { + DEV_partition_work_supply_recursively = TRUE + DEV_print_steps = TRUE + DEV_print_edge_steps = TRUE +} + + +ChopAndPackLoadBalancer { +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 1 + + largest_patch_size { + level_0 = -1,-1 + // level_0 = 20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 12, 12 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3 + level_2 = 3, 3 + level_3 = 3, 3 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 7, 7 +} + + +PersistentOverlapConnectors { + implicit_connector_creation_rule = "ERROR" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.2d.treelb.input deleted file mode 100644 index 1689b1dd..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.2d.treelb.input +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_cube.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(199,199)] - - /* - Specify L0 layer as a box array in the reference index space. - The L0 layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the L0 layer is the same as the domain. - */ - L0_boxes = [(0,0),(199,199)] - /* - If L0 is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_L0 = TRUE - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(10,10),(189,189)] - initial_owners = 0 - } - - PrebalanceByShrinkingLevel { - shrink_distance = 0.06, 0.06, 0.06 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.3d.treelb.input deleted file mode 100644 index 6d6fdc85..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_cube.3d.treelb.input +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_cube.3d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(24,24,24)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 1.0, 1.0, 1.0 - - /* - Specify ghost-cell-width between L0 and unbalanced. - */ - ghost_cell_width = 4, 4, 4 - - L1_box_gen_method = "PrebalanceByUserBoxes" - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - prebalance_boxes = [(5,5,5),(19,19,19)] - initial_owners = 0 - } - - PrebalanceBySinusoidalFront { - /* - Specify unbalanced layer by tagging a set of sinusoidal fronts - oriented in perpendicular to the x-axis. - */ - efficiency_tol = 0.80 - combine_tol = 0.80 - tag_buffer = 4, 4, 4 - SinusoidalFrontTagger { - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - } - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - - PrebalanceByShrinkingLevel { - shrink_distance = 0.06, 0.06, 0.06 - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 2 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 5,5,5 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.2d.treelb.input deleted file mode 100644 index 359b3c29..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.2d.treelb.input +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_front.2d.treelb" - log_all_nodes = FALSE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(99,49)] - // domain_boxes = [(0,0),(49,24)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 2.0, 1.0 - - ghost_cell_width = 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 1 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 1.0, 1.0 - period = 2.0, 4.0 - amplitude = 0.5 - - // Tag L0 by buffering and L1 by buffering. - buffer_distance_0 = 0.07, 0.07 - buffer_distance_1 = 0.02, 0.02 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 12, 12 - level_1 = 6, 6 - level_2 = 15, 15 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.3d.treelb.input deleted file mode 100644 index 85a1e7d0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_front.3d.treelb.input +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_front.3d.treelb" - log_all_nodes = FALSE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(39,19,19)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 2.0, 1.0, 1.0 - - ghost_cell_width = 4, 4, 4 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 1 - - efficiency_tol = 0.80 - combine_tol = 0.80 - - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SinusoidalFrontGenerator" - - SinusoidalFrontGenerator { - /* - Define a set of sinusoidal fronts oriented in perpendicular to the x-axis. - */ - init_disp = 1.0, 1.0, 1.0 - period = 2.0, 4.0, 4.0 - amplitude = 0.5 - - // Tag L0 by buffering and L1 by buffering. - buffer_distance_0 = 0.08, 0.08, 0.08 - buffer_distance_1 = 0.02, 0.02, 0.02 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.2d.treelb.input deleted file mode 100644 index 426826a4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.2d.treelb.input +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 2 - - base_name = "small_sphere.2d.treelb" - log_all_nodes = TRUE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0),(49,49)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0 - xhi = 1.0, 1.0 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 1 - - ghost_cell_width = 4, 4 - - efficiency_tol = 0.85 - combine_tol = 0.85 - - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SphericalShellGenerator" - - SphericalShellGenerator { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at (0,0), with shell i having inner radius radii[2*i] - and outer radius radii[(2*i)+1]. Note that making shells too thin - can lead to discontinuous tagging. - */ - radii = 0.0, 0.35, 0.60, 0.65, 0.95, 0.97 - - // Tag L0 by buffering and l1 by buffering. - buffer_distance_0 = 0.04, 0.04 - buffer_distance_1 = 0.00, 0.00 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1 - // level_0 = 20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 12, 12 - level_1 = 6, 6 - level_2 = 15, 15 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3 - level_2 = 3, 3 - level_3 = 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.3d.treelb.input deleted file mode 100644 index 670e27e7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_sphere.3d.treelb.input +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - dim = 3 - - base_name = "small_sphere.3d.treelb" - log_all_nodes = FALSE - write_visit = TRUE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0,0,0),(19,19,19)] - - /* - Specify physical domain box. - */ - xlo = 0.0, 0.0, 0.0 - xhi = 1.0, 1.0, 1.0 - - /* - Base nprocs for automatic scaling. - */ - autoscale_base_nprocs = 1 - - ghost_cell_width = 4, 4, 4 - - efficiency_tol = 0.85 - combine_tol = 0.85 - - BergerRigoutsos { - sort_output_nodes = TRUE - log_node_history = FALSE - log_cluster_summary = FALSE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" - } - - mesh_generator_name = "SphericalShellGenerator" - - SphericalShellGenerator { - /* - Specify unbalanced layer by tagging a set of concentric shells, - centered at (0,0,0), with shell i having inner radius radii[2*i] - and outer radius radii[(2*i)+1]. Note that making shells too thin - can lead to discontinuous tagging. - */ - radii = 0.0, 0.25, 0.40, 0.45, 0.85, 0.87 - - // Tag L0 by buffering and l1 by buffering. - buffer_distance_0 = 0.03, 0.03, 0.03 - buffer_distance_1 = 0.00, 0.00, 0.00 - - // Tag L0 by buffering and l1 by shrinking. - // buffer_distance_0 = 0.02, 0.02 - // shrink_distance_1 = 0.06, 0.06 - } - -} - -TreeLoadBalancer { - report_load_balance = FALSE // Reported in main - n_root_cycles = -1 - min_load_fraction_per_box = 0.03 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = FALSE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} - - -PatchHierarchy { - - /* - Specify number of levels (1, 2 or 3 for this test). - */ - max_levels = 3 - - enforce_proper_nesting = FALSE - extend_to_domain_boundary = FALSE - check_nonrefined_tags = "IGNORE" - // load_balance = FALSE - largest_patch_size { - level_0 = -1,-1,-1 - // level_0 = 20,20,20 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 3, 3, 3 - level_1 = 6, 6, 6 - level_2 = 9, 9, 9 - // all finer levels will use same values as level_0... - } - ratio_to_coarser { - level_1 = 3, 3, 3 - level_2 = 3, 3, 3 - level_3 = 2, 2, 2 - // etc. - } - - allow_patches_smaller_than_ghostwidth = TRUE - allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE - proper_nesting_buffer = 1, 1, 1 -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_spread.2d.tile.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_spread.2d.tile.input new file mode 100644 index 00000000..849a9268 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/small_spread.2d.tile.input @@ -0,0 +1,158 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +// Mesh configuration: Sinusoidal front + +// Refer to lss.2d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "small_spread.2d.tile" + + write_visit = FALSE + + log_all_nodes = TRUE + + domain_boxes = [ (0,0) , (999, 999) ] + xlo = 0.e0, 0.e0 // lower end of computational domain. + xhi = 1.e0, 1.e0 // upper end of computational domain. + + enforce_nesting = TRUE, TRUE, TRUE + + // autoscale_base_nprocs = 1 + + box_generator_type = "TileClustering" + + load_balancer_type = "CascadePartitioner" + + rank_tree_type = "CenteredRankTree" + + load_balance = TRUE, TRUE, TRUE + + write_comm_graph = FALSE + + mesh_generator_name = "ShrunkenLevelGenerator" + + ShrunkenLevelGenerator { + domain_scale_method = 'r' + shrink_distance_0 = 20.0, 20.0 + shrink_distance_1 = 20.0, 20.0 + } + +} + + +TileClustering { + tile_size = 6,6 + allow_remote_tile_extent = TRUE + coalesce_boxes = TRUE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + DEV_barrier_and_time = TRUE +} + + +BergerRigoutsos { + sort_output_nodes = TRUE + efficiency_tolerance = 0.75 + combine_efficiency = 0.75 + DEV_min_box_size_from_cutting = 4, 4 + DEV_build_zero_width_connector = TRUE + DEV_cluster_locally = FALSE + DEV_cluster_tiles = FALSE + DEV_tag_coarsen_ratio = 1, 1 + DEV_inflection_cut_threshold_ar = 4.0 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = FALSE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" +} + + +CascadePartitioner { + tile_size = 12,12 + flexible_load_tolerance = 0.05 + max_spread_procs = 2 + DEV_reset_obligations = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_child_steps = TRUE + DEV_summarize_map = FALSE +} + + +BoxTransitSet { + DEV_print_steps = FALSE + DEV_print_pop_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + + +TreeLoadBalancer { + tile_size = 12, 12 + flexible_load_tolerance = 0.05 + DEV_report_load_balance = FALSE // Reported in main + DEV_allow_box_breaking = TRUE + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE + DEV_summarize_map = TRUE +} + + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 1 + + largest_patch_size { + level_0 = -1, -1 + // level_0 = 20, 20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 6, 6 + level_1 = 6, 6 + level_2 = 6, 6 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 2, 2 + level_2 = 2, 2 + level_3 = 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 4, 4 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/spreadby10.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/spreadby10.3d.treelb.input new file mode 100644 index 00000000..cde2a959 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/MeshGeneration/test_inputs/spreadby10.3d.treelb.input @@ -0,0 +1,138 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for MeshGeneration tests. + * + ************************************************************************/ + +/* +This tests the root-cycle feature of the TreeLoadBalancer by limiting +the fan-out ratio to 10. +*/ + + +// Refer to lss.3d.treelb.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "spreadby10.3d.treelb" + + write_visit = FALSE + + log_all_nodes = TRUE + + domain_boxes = [(0,0,0),(9,9,9)] + xlo = 0.0, 0.0, 0.0 + xhi = 1.0, 1.0, 1.0 + + enforce_nesting = FALSE, TRUE, TRUE + + autoscale_base_nprocs = 2 + + box_generator_type = "BergerRigoutsos" + + load_balancer_type = "TreeLoadBalancer" + + load_balance = TRUE, TRUE, TRUE + + mesh_generator_name = "SphericalShellGenerator" + + SphericalShellGenerator { + + radii = 0.0, 0.50 + + buffer_distance_0 = 0.05, 0.05, 0.05 + buffer_distance_1 = 0.00, 0.00, 0.00 + } + + rank_tree_type = "CenteredRankTree" + + write_comm_graph = FALSE + +} + +BergerRigoutsos { + efficiency_tolerance = 0.88 + combine_efficiency = 0.88 +} + +TreeLoadBalancer { + DEV_report_load_balance = FALSE // Reported in main + max_spread_procs = 10 + flexible_load_tolerance = 0.05 + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 0.0 + DEV_slender_penalty_wt = 0.0 + DEV_precut_penalty_wt = 1.0 + + // Debugging options + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = FALSE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE +} + +CenteredRankTree { // Parameters for CenteredRankTree in getRankTree() + make_first_rank_the_root = TRUE +} + +BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getRankTree() + do_left_leaf_switch = TRUE +} + +BreadthFirstRankTree { // Parameters for BreadthFirstRankTree in getRankTree() + tree_degree = 2 +} + +ChopAndPackLoadBalancer { + // processor_layout = 10, 10, 10 + bin_pack_method = "SPATIAL" + max_workload_factor = 0.3333333333 + workload_tolerance = 0.0 +} + +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" +} + + +PatchHierarchy { + + /* + Specify number of levels (1, 2 or 3 for this test). + */ + max_levels = 3 + + largest_patch_size { + level_0 = -1,-1,-1 + // level_0 = 20,20,20 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 3, 3, 3 + level_1 = 6, 6, 6 + level_2 = 9, 9, 9 + // all finer levels will use same values as level_0... + } + ratio_to_coarser { + level_1 = 3, 3, 3 + level_2 = 3, 3, 3 + level_3 = 2, 2, 2 + // etc. + } + + allow_patches_smaller_than_ghostwidth = TRUE + allow_patches_smaller_than_minimum_size_to_prevent_overlaps = TRUE + proper_nesting_buffer = 1, 1, 1 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/ExtractSAMRAITimers.pm b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/ExtractSAMRAITimers.pm new file mode 100644 index 00000000..de048b50 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/ExtractSAMRAITimers.pm @@ -0,0 +1,144 @@ +package ExtractSAMRAITimers; + +# Debugging parameters can be set externally. +my $verbose; +my $debug; + +sub extract_timers { + +# Aruments: + +# 1 [i] Reference to array of number-of-processes. These are the +# processes corresponding to the log files. + +# 2 [i] Reference to array of log file names. Log files not +# corresponding to a process-count value in argument 1 are ignored. + +# 3 [i] Reference to array of test names. Test names are as defined +# by in the TreeCommunication test code. They must be in the same +# order as they appear in the log files. The test number is the array +# index corresponding to the test names. + +# 4 [o] Reference to a hash (%times) to be populated. +# $times{test_number:timer_name} will be an array of timers for that +# test number and time name. The array contains timer values +# corresponding to the input nproc array. + + +my @nprocs = @{shift @_}; +my @logs = @{shift @_}; +my @test_names = @{shift @_}; + +# Temporary variable to hold output until the end. +my %times; + +for $inproc (0 .. $#nprocs) { + + my $nproc = $nprocs[$inproc]; + + # Get the log files corresponding to $nproc + my $nprocstr = sprintf("%05d", $nproc); + my @logs_for_nproc = grep /-$nprocstr\.log/, @logs; + print STDERR ("logs for nproc=$nproc: ", @logs_for_nproc, "\n") if $verbose; + + for $fn (@logs_for_nproc) { + + if ( open (LOG, "< $fn") ) { warn "Opened $fn\n"; } + else { warn "Cannot open $fn\n"; next; } + + for $test_index ( 0..$#test_names ) { + + while ( !eof(LOG) && ($_ = ) ) { last if /^Starting test/; } + + die "File $fn ended prematurely while searching for test $test_index ($test_names[$test_index])\n" + if eof(LOG); + + /^Starting test Test([0-9]+) \((.*)\)$/; + my $test_number = int($1); + my $test_name = $2; + print STDERR "Found line ${_}for test #$test_number ($test_name)\n" + if $debug; + + die "Test $test_number is out of order. Corrupted log file $fn?" + if $test_number != $test_index; + + while ( !eof(LOG) && ($_=) ) { last if /\brepetition\s*=\s*\d+/o; } + die "File $fn ended prematurely while searching for repetitions\n" if eof(LOG); + /\brepetition\s*=\s*(\d+)/o; + my $repetition = $1; + + while ( !eof(LOG) && ($_=) ) { last if /^WALLCLOCK TIME/o; } + ; ; + + while ( !eof(LOG) && ($_ = ) ) { + last if /TOTAL RUN TIME:/; + s/^\s*//; # Strip leading white spaces. + my @c = split /\s+/; + $t = $c[0]; + $v = $c[5]; + $times{"$test_number:$t"}[$inproc] = $v/$repetition; + print STDERR "$test_number:$t for $inproc is ", $times{"$test_number:$t"}[$inproc], "\n" if $debug; + } + die "File $fn ended prematurely while searching for timers." if eof(LOG); + + } + + close LOG; + + } + +} + +# Set output to the temporary variable. +%{@_[0]} = %times; + +} + + + + +sub get_nprocs_from_log_names { +# Get list of nproc from log file names. + my %nprocset; + for (@_) { + if ( /-([0-9]+).log/ ) { + print STDERR "Log file $_ -> $1 procs\n" if $verbose; + $nprocset{$1} = ''; + } + else { + die "Cannot determine nproc corresponding to log file $_\n"; + } + } + @nprocs = sort keys %nprocset; + for (@nprocs) { $_ = sprintf("%d",$_); } + @nprocs; +} + + + +################################################################### +# Scan a timer paragraph for all the timers we need. +# Return the paragraph section name, the timer array +# and the timer label mapping. +################################################################### +sub parse_timer_selection { + $_ = shift; + my @lines = split /\n/; + my $section_name = shift @lines; + my @timers; + my %timer_label; + if ( $section_name !~ /^#/ ) { + @lines = grep !/^#/, @lines; # Remove comment lines. + for $line (@lines) { + my ($timer,$label) = split /\s+/, $line, 2; + $label = $timer unless "$label"; + push @timers, $timer; + $timer_label{$timer} = $label; + } + } + + ($section_name, \@timers, %timer_label); +} + + +1; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.depend new file mode 100644 index 00000000..d7f97613 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.depend @@ -0,0 +1,51 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=tcb.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/BreadthFirstRankTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CenteredRankTree.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h tcb.C + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.in new file mode 100644 index 00000000..e3c8c83f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/Makefile.in @@ -0,0 +1,79 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Code and input for benchmarking and experimentation with tree-based communication. +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/performance/TreeCommunication +VPATH = @srcdir@ +OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml + +default: check + +include $(OBJECT)/config/Makefile.config + +NUM_TESTS = 9 + +TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = tcb.o + +INPUTS = test_inputs/multiple.input \ + test_inputs/comparetrees.input \ + test_inputs/centeredrank.input \ + test_inputs/breadthfirsttree.input \ + test_inputs/contention.input \ + test_inputs/messagelengthdependency.input \ + test_inputs/firstlengths.input \ + test_inputs/tlbdown.input \ + test_inputs/tlbL0delay.input + +main: $(CXX_OBJS) $(LIBSAMRAI) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ + $(LIBSAMRAI) $(LDLIBS) -o $@ + +check: main + @for f in $(INPUTS); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +checkcompile: main + +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/README b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/README new file mode 100644 index 00000000..c15b1d59 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/README @@ -0,0 +1,29 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Code and input for benchmarking and experimentation with tree-based communication. +## +######################################################################### + +Code and input for evaluating performance of tree communication classes. + +We test various combinations of tree arangements, message size and +communication patterns. See the individual input files for details. + +COMPILATION AND EXECUTION +------------------------- + + Compilation: + make main + + Execution: + For one the following input files in test_inputs: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/extract-tree-from-CommGraphWriter.pl b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/extract-tree-from-CommGraphWriter.pl new file mode 100755 index 00000000..7c73d064 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/extract-tree-from-CommGraphWriter.pl @@ -0,0 +1,525 @@ +#!/usr/bin/env perl + +# Extract tree structure and data from TreeLoadBalancer CommGraphWriter output. +# Write input file for dot to plot the tree. + +my @saveargs = @ARGV; + +require Getopt::Long; +Getopt::Long::GetOptions( 'help' => \$help + , 'verbose' => \$verbose + , 'debug' => \$debug + , 'record=s' => \@records + , 'output=s' => \$output + , 'edgeout=s' => \@edgeout + , 'nodeout=s' => \@nodeout + , 'twopi' => \$runtwopi + ); + + +my $script_name = `basename $0`; chop $script_name; + +if ( $help ) { + print <<_EOM_; + +Usage: $script_name [options] + +Extract the tree data written to SAMRAI log files by CommGraphWriter. +Write out the tree in format to be used by dot. + +Log files must be of the form *-.log.* +All log files must have the same nproc. + + --output= + The dot filename. If omitted, generate a name ending in '.dot' + from the log file. To output to stdout, use '-'. + + --record=<#[,#...]> + Comma-separated list of record numbers to extract. + If omitted, extract all records. + + --edgeout= --edgeout= ... + Specify which edges to draw. String values must be of the form + "c:,w:", where "value for ..." + is one of the values from the input data. If either "c:" or "w:" + is omitted, a uniform value is assumed. + + --nodeout= + Specify which node values to draw. String values must be of the form + "c:", where "value for ..." + is one of the values from the input data. + + --twopi + Run twopi on the dot file if it is successfully generated. + Error if output is stdout. + Generate a postscript file of the tree. + +_EOM_ + exit(0); +} + + +@records = split(/,/, join(',',@records)); +print "records: @records\n"; + + +my $logfile = shift; +die "No logfile specified" if $logfile eq ''; +print "logfile = '$logfile'\n" if $debug; + + + +# Parse log files for edges and nodes. + + +# Output; +my $outfh; +if (!defined($output)) { + ($output = $logfile) =~ s!.*/!!; + $output =~ s!\.log(\.\d+)?$!!; + $output .= ".dot"; +} +print "Writing to file '$output'\n" if $debug; + + +my $logfh; +open( $logfh, "< $logfile" ) || die "Cannot open log file $logfile"; +print "Opened file $logfile\n" if $debug; + + +while (!eof($logfh)) { + + # Look for start of output record. + my $currecordnum; + while ( !eof($logfh) && ($_ = <$logfh>) ) { + if ( /^CommGraphWriter begin record number (\d+)\n$/ ) { + $currecordnum = $1; + last; + } + } + last if !defined($currecordnum); + next if ( @records > 0 && !number_in_list($currecordnum,@records) ); + + + print "\nRecord number $currecordnum\n"; + + + my @nvalues; # 2D array of node values: [nvalueindex][nodeindex] + my @nvaluenames; # value index --> value name + my %nvalueids; # value name --> value index + + my @evalues; # 2D array with all edge values: [evalueindex][edgeindex] + my @evaluenames; # value index --> value name + my %evalueids; # value name --> value index + my @edgenames; # edge index --> edge name + my %edgeids; # edge name --> edge index + + # Look for graph data; + get_graph_from_log( $logfh, \@nvalues, \@nvaluenames, \%nvalueids, \@evalues, \@evaluenames, \%evalueids, \@edgenames, \%edgeids ); + + + + if ($debug) { + for (0..$#edgenames) { + print "edgename[$_] = '$edgenames[$_]' $edgeids{$edgenames[$_]}\n"; + } + for (0..$#evaluenames) { + print "evaluenames[$_] = '$evaluenames[$_]' $evalueids{$evaluenames[$_]}\n"; + } + for $edgename ( @edgenames ) { + my $edgeid = $edgeids{$edgename}; + print "Edge $edgeid '$edgename':"; + for $evaluename (@evaluenames) { + my $evalueid = $evalueids{$evaluename}; + print " '$evaluename'=$evalues[$evalueid][$edgeid]"; + } + print "\n"; + } + } + + + + # Choose default edges to plot, if needed. + if (!defined @edgeout) { + print STDERR "No edgeout specified.\n"; + print STDERR "Available edgeouts are:"; + for ( @evaluenames ) { print STDERR " '$_'"; } + print STDERR "\n"; + print STDERR "Available nodeouts are:"; + for ( @nvaluenames ) { print STDERR " '$_'"; } + print STDERR "\n"; + next; + #$edgeout[0] = "w:$evaluenames[0]"; + #print STDERR "Choosing default edge group '$edgeout[0]' to plot.\n"; + } + + + + # Validity check for edgeout switches. + if ($debug) { + print "Edge specifiers:\n"; + } + for (@edgeout) { + (my $name1, $attr1, $name2, $attr2) = parse_edgeout($_); + print "edgeout='$_' gave: '$name1' for '$attr1', '$name2' for '$attr2'\n" if $debug; + die "Repeated attribute '$attr1' edgeout '$_'" if ( $attr1 ne '' && $attr1 eq $attr2 ); + die "Attribute '$attr1' in edgeout '$_' unrecognized" if ( $attr1 ne '' && $attr1 ne 'c' && $attr1 ne 'w' ); + die "Attribute '$attr2' in edgeout '$_' unrecognized" if ( $attr2 ne '' && $attr2 ne 'c' && $attr2 ne 'w' ); + die "Value '$name1' in edgeout '$_' not in file $logfile" if ( $name1 && !string_in_list($name1, @evaluenames) ); + die "Value '$name2' in edgeout '$_' not in file $logfile" if ( $name2 && !string_in_list($name2, @evaluenames) ); + } + die "Only one nodeout switch is allowed" if @nodeout > 1; + for (@nodeout) { + (my $name1, $attr1) = parse_nodeout($_); + print "nodeout='$_' gave: '$name1' for '$attr1'\n" if $debug; + die "Attribute '$attr1' in nodeout '$_' unrecognized" if ( $attr1 ne '' && $attr1 ne 'c' ); + } + + + + # Compute range of each edge value field. + my @iemin, @iemax; + my @vemin, @vemax; + for ( 0..$#evalues ) { + ($iemin[$_], $iemax[$_]) = iextrema(@{$evalues[$_]}); + $vemin[$_] = $evalues[$_][$iemin[$_]]; + $vemax[$_] = $evalues[$_][$iemax[$_]]; + print "Edge values ($_) '$evaluenames[$_]' in [$vemin[$_] @ $iemin[$_] , $vemax[$_] @ $iemax[$_] ]\n" if $debug; + } + + + + # Compute range of each node value field. + my @inmin, @inmax; + my @vnmin, @vnmax; + for ( 0..$#nvalues ) { + ($inmin[$_], $inmax[$_]) = iextrema(@{$nvalues[$_]}); + $vnmin[$_] = $nvalues[$_][$inmin[$_]]; + $vnmax[$_] = $nvalues[$_][$inmax[$_]]; + print "Node values ($_) '$nvaluenames[$_]' in [$vnmin[$_] @ $inmin[$_] , $vnmax[$_] @ $inmax[$_] ]\n" if $debug; + } + + + + # Write out tree in dot format. + + if ( !defined($outfh) ) { + open $outfh, ">$output" || die "Cannot open output file '$output'"; + print $outfh "// Written by $0 with command:\n// '$0'"; + for (@saveargs) { print $outfh " '$_'"; } + print $outfh "\n\n"; + + print $outfh "// Available edgeouts are:"; + for ( @evaluenames ) { print $outfh " '$_'"; } + print $outfh "\n"; + print $outfh "// Available nodeouts are:"; + for ( @nvaluenames ) { print $outfh " '$_'"; } + print $outfh "\n"; + } + + my $edgewidth, $saturation; + my $brightness = 1; + my $minsat = 0.05; # Useful saturation is from $minsat to 1. + my $maxsat = 1; + my $minwidth = 1; + my $maxwidth = 15; + + + print $outfh "\ndigraph \"$logfile:$currecordnum\" {\n"; + + + + for ( 0..$#nodeout ) { + + my $hue = 0.5; + + print STDERR "\n\tNode group: $_ defined by 'nodeout=$nodeout[$_]'\n"; + print $outfh "\n\t// Node group: $_ defined by 'nodeout=$nodeout[$_]'\n"; + (my $name1, $attr1) = parse_nodeout($nodeout[$_]); + my $colorvid = $nvalueids{$name1}; + + my (@colorfield, $colorfieldmin, $colorfieldmax); + if ( defined($colorvid) ) { + @colorfield = @{$nvalues[$colorvid]}; + $colorfieldmin = $vnmin[$colorvid]; + $colorfieldmax = $vnmax[$colorvid]; + my $colorfieldminstr = sprintf("%.4g", $colorfieldmin); + my $colorfieldmaxstr = sprintf("%.4g", $colorfieldmax); + print STDERR "\tcolor='$nvaluenames[$colorvid]' in [$colorfieldminstr @ $inmin[$colorvid], $colorfieldmaxstr @ $inmax[$colorvid]]\n"; + print $outfh "\t\"nodeout[$_]\" [shape=box,style=filled,color=\"$hue,$maxsat,$brightness\",label=\"$nvaluenames[$colorvid] in [$colorfieldminstr @ $inmin[$colorvid], $colorfieldmaxstr @ $inmax[$colorvid]]\"]\n"; + } + + for ( 0..$#colorfield ) { + my $cval = $colorfield[$_]; + my $sat = $colorfieldmin == $colorfieldmax ? 1 : $minsat + ($maxsat-$minsat)*($cval-$colorfieldmin)/($colorfieldmax-$colorfieldmin); + print $outfh "\t$_ [style=filled,shape=box,width=0.4,height=0.2, color=\"$hue,$sat,$brightness\"] // c:$cval\n"; + } + + } + + + my @edgehues = ( 2./3, 0, 1.0/3, 1.0 ); + + for ( 0..$#edgeout ) { + + (my $name1, $attr1, $name2, $attr2) = parse_edgeout($edgeout[$_]); + #print "Parsed edgeout '$_' into: $name1, $attr1, $name2, $attr2\n"; + + my $colorvid, $widthvid; + if ( $attr1 eq 'c' ) { $colorvid = $evalueids{$name1}; } + if ( $attr2 eq 'c' ) { $colorvid = $evalueids{$name2}; } + if ( $attr1 eq 'w' ) { $widthvid = $evalueids{$name1}; } + if ( $attr2 eq 'w' ) { $widthvid = $evalueids{$name2}; } + + print STDERR "\n\tEdge group: $_ defined by 'edgeout=$edgeout[$_]'\n"; + print $outfh "\n\t// Edge group: $_ defined by 'edgeout=$edgeout[$_]'\n"; + + my $labelstr; + + my (@colorfield, $colorfieldmin, $colorfieldmax); + if ( defined($colorvid) ) { + @colorfield = @{$evalues[$colorvid]}; + $colorfieldmin = $vemin[$colorvid]; + $colorfieldmax = $vemax[$colorvid]; + my $colorfieldminstr = sprintf("%.4g", $colorfieldmin); + my $colorfieldmaxstr = sprintf("%.4g", $colorfieldmax); + print STDERR "\tcolor='$evaluenames[$colorvid]' in [$colorfieldminstr @ $edgenames[$iemin[$colorvid]], $colorfieldmaxstr @ $edgenames[$iemax[$colorvid]]]\n"; + $labelstr = "color='$evaluenames[$colorvid]' in [$colorfieldminstr @ $edgenames[$iemin[$colorvid]], $colorfieldmaxstr @ $edgenames[$iemax[$colorvid]]]"; + } + + my (@widthfield, $widthfieldmin, $widthfieldmax); + if ( defined($widthvid) ) { + @widthfield = @{$evalues[$widthvid]}; + $widthfieldmin = $vemin[$widthvid]; + $widthfieldmax = $vemax[$widthvid]; + my $widthfieldminstr = sprintf("%.4g", $widthfieldmin); + my $widthfieldmaxstr = sprintf("%.4g", $widthfieldmax); + print STDERR "\twidth='$evaluenames[$widthvid]' in [$widthfieldminstr @ $edgenames[$iemin[$widthvid]], $widthfieldmaxstr @ $edgenames[$iemax[$widthvid]]]\n"; + $labelstr .= "\\nwidth='$evaluenames[$widthvid]' in [$widthfieldminstr @ $edgenames[$iemin[$widthvid]], $widthfieldmaxstr @ $edgenames[$iemax[$widthvid]]]"; + } + + my $primaryvid = $evalueids{$name1}; + my @primaryfield = @{$evalues[$primaryvid]}; + + my $edgehue = $edgehues[ ($_ % @edgehues) ]; + + print $outfh "\ta$_ [style=invis]\n\tb$_ [style=invis]\n\ta$_ -> b$_ [label=\"$labelstr\", color=\"$edgehue,$maxsat,$brightness\", penwidth=3]\n"; + + for ( 0..$#primaryfield ) { + + if ( defined($primaryfield[$_]) ) { + # print "primary = $primaryfield[$_], color = $colorfield[$_]\n"; + my $edgename = $edgenames[$_]; + my $cval = $colorfield[$_]; + my $wval = $widthfield[$_]; + + $edgename =~ m/(\d+)(.)(\d+)/ || die "Cannot parse edge $edgename"; + (my $na, $arrow, $nb) = ($1,$2,$3); + + #my $edgewidth = 1; + my $edgewidth = $widthfieldmin == $widthfieldmax ? 1 : $minwidth + ($maxwidth-$minwidth)*($wval-$widthfieldmin)/($widthfieldmax-$widthfieldmin); + #my $style = ($wval > $widthfieldmin && $widthfieldmin != $widthfieldmax) ? "solid" : "dotted"; + + my $saturation = $colorfieldmin == $colorfieldmax ? 1 : $minsat + (1-$minsat)*($cval-$colorfieldmin)/($colorfieldmax-$colorfieldmin); + + my $edgestr = $arrow eq '>' ? "$na -> $nb" : "$nb -> $na"; + print $outfh "\t$edgestr [color=\"$edgehue,$saturation,$brightness\", penwidth=$edgewidth] // c:$cval w:$wval\n"; + } + + } + + } + + print $outfh "}\n"; + + +} + + +close $logfh || die "Cannot close log file $logfile"; + +if ( !defined($outfh) ) { + print STDERR "\nOutput file '$output' was NOT written!\n"; +} +else { + close $outfh || die "Cannot close output file '$output'"; + if ( defined($runtwopi) ) { + die "Cannot use --runtwopi when writing output to stdout" if $output eq '-'; + my $psfile = $output; + $psfile =~ s/\.dot$//; + $psfile .= ".ps"; + print STDERR "\nRunning 'twopi -Tps -o $psfile $output'\n"; + my $errf = system('twopi', '-Tps', '-o', $psfile, $output); + die "Error running twopi to generate '$psfile'" if $errf; + } +} + + +exit; + + +sub get_graph_from_log { + # Search for next CommGraphWriter section and extract its data. + + my $fh = shift; + my @nvalues; # 2D array of node values: [nvalueindex][nodeindex] + my @nvaluenames; # value index --> value name + my %nvalueids; # value name --> value index + + my @evalues; # 2D array with all edge values: [evalueindex][edgeindex] + my @evaluenames; # value index --> value name + my %evalueids; # value name --> value index + my @edgenames; # edge index --> edge name + my %edgeids; # edge name --> edge index + + while ( $_ = <$fh> ) { + + print "line:$_" if $debug; + last if eof($fh); + last if ( $_ =~ m/^CommGraphWriter end record number/ ); + next if ( $_ =~ m'^#' ); + chop; + + my @tmpfields = split( /\t/, $_, 5 ); + + if ( $tmpfields[1] eq '->' || $tmpfields[1] eq '<-' ) { + # Edge + my ($na, $arrow, $nb, $edgeval, $evaluename) = split( /\t/, $_, 5 ); + $arrow =~ s/-//; + die "Column count not the expected 5" if !defined($evaluename); + + # Skip edges with invalid nodes. + next if ( $na < 0 || $nb < 0 ); + + my $edgename = $arrow eq '>' ? "$na>$nb" : "$nb>$na"; + + if ( !defined $edgeids{$edgename} ) { + push @edgenames, $edgename; + $edgeids{$edgename} = $#edgenames; + } + my $edgeid = $edgeids{$edgename}; + + if ( !defined $evalueids{$evaluename} ) { + push @evaluenames, $evaluename; + $evalueids{$evaluename} = $#evaluenames; + } + my $evalueid = $evalueids{$evaluename}; + + $evalues[$evalueid][$edgeid] = $edgeval; + #print "found edge '$edgename' with '$evaluename' = $edgeval \n"; + } + else { + # Node value + my ($nodeid, $nodevalue, $nvaluename) = split( /\t/, $_, 3 ); + #print "nodeid,nodevaule,nvaluename = $nodeid,$nodevalue,$nvaluename\n"; + + if ( !defined($nvalueids{$nvaluename}) ) { + push @nvaluenames, $nvaluename; + $nvalueids{$nvaluename} = $#nvaluenames; + } + my $nvalueid = $nvalueids{$nvaluename}; + $nvalues[$nvalueid][$nodeid] = $nodevalue; + + } + + } + + # Set the data, which was sent in by reference. + @{scalar shift} = @nvalues; + @{scalar shift} = @nvaluenames; + %{scalar shift} = %nvalueids; + @{scalar shift} = @evalues; + @{scalar shift} = @evaluenames; + %{scalar shift} = %evalueids; + @{scalar shift} = @edgenames; + %{scalar shift} = %edgeids; + +} + + + +# Parse nodeout to get values to use for node attributes. +sub parse_nodeout { + my $str = shift; + my @s1 = split(/,/, $str); + die "nodeout '$str' has more than one attribute specifiers." if @s1 > 1; + my @value, my @attr; + for (@s1) { + my @s2 = split /:/, $_, 2; + push( @value, $s2[1] ); + push( @attr, $s2[0] ); + } + return ( $value[0], $attr[0] ); +} + + + +# Parse edgeout to get values to use for edge attributes. +sub parse_edgeout { + my $str = shift; + my @s1 = split(/,/, $str); + #print "s1: ", array_to_str(@s1), "\n"; + die "edgeout '$str' has more than two attribute specifiers." if @s1 > 2; + my @value, my @attr; + #print "ini attr: ", array_to_str(@attr), "\n"; + for (@s1) { + my @s2 = split /:/, $_, 2; + #print "s2: ", array_to_str(@s2), "\n"; + push( @value, $s2[1] ); + push( @attr, $s2[0] ); + } + #print "attr: ", array_to_str(@attr), "\n"; + #print "value: ", array_to_str(@value), "\n"; + return ( $value[0], $attr[0], $value[1], $attr[1] ); +} + + + +sub array_to_str { + my @a = @_; + my $str = sprintf("%d items:", scalar(@a)); + for (0..$#a) { + $str .= " $_='$a[$_]'"; + } + return $str; +} + + + +# Whether a string is in a list. +sub string_in_list { + my $s = shift; + my @l = @_; + for (@_) { + if ( $_ eq $s ) { return 1; } + } + return 0; +} + + + +# Whether a number is in a list. +sub number_in_list { + my $s = shift; + my @l = @_; + for (@_) { + if ( $_ == $s ) { return 1; } + } + return 0; +} + + +# Compute extrema points in an edge group. +sub iextrema { + my @edges = @_; + my $imin = 0; + my $imax = 0; + for (0..$#edges) { + if ( defined($edges[$_]) ) { + #print "Defined $edges[$_] for $_\n"; + $imin = $_ if $edges[$imin] > $edges[$_] || !defined($edges[$imin]); + $imax = $_ if $edges[$imax] < $edges[$_] || !defined($edges[$imax]); + } + } + return ($imin,$imax); +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/tcb.C b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/tcb.C new file mode 100644 index 00000000..1e9c04f9 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/tcb.C @@ -0,0 +1,1310 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ +#include "SAMRAI/SAMRAI_config.h" + +#include + +#ifndef _MSC_VER +#include +#endif + +#include "SAMRAI/tbox/AsyncCommPeer.h" +#include "SAMRAI/tbox/AsyncCommStage.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" +#include "SAMRAI/tbox/CenteredRankTree.h" +#include "SAMRAI/tbox/Clock.h" +#include "SAMRAI/tbox/CommGraphWriter.h" +#include "SAMRAI/tbox/BreadthFirstRankTree.h" +#include "SAMRAI/tbox/InputDatabase.h" +#include "SAMRAI/tbox/InputManager.h" +#include "SAMRAI/tbox/RankTreeStrategy.h" +#include "SAMRAI/tbox/SAMRAIManager.h" +#include "SAMRAI/tbox/TimerManager.h" + +using namespace SAMRAI; +using namespace tbox; + +/* + ************************************************************************ + * Tree communication benchmark code. + ************************************************************************* + */ + +struct CommonTestSwitches { + std::string tree_name; + std::string message_pattern; + int msg_length; + int first_data_length; + int processing_cost[2]; + bool randomize_processing_cost; + bool verify_data; + int repetition; + bool barrier_after_each_repetition; + int mpi_tags[2]; + CommonTestSwitches(): + tree_name(), + message_pattern(), + msg_length(1024), + first_data_length(1), + randomize_processing_cost(false), + verify_data(false), + repetition(1), + barrier_after_each_repetition(false) + { + processing_cost[0] = 0; + processing_cost[1] = 0; + mpi_tags[0] = 0; + mpi_tags[1] = 1; + } +}; + +boost::shared_ptr +getTreeForTesting( + const std::string& tree_name, + Database& test_db, + const SAMRAI_MPI& mpi); + +void +setupAsyncComms( + AsyncCommStage& child_stage, + AsyncCommPeer *& child_comms, + AsyncCommStage& parent_stage, + AsyncCommPeer *& parent_comm, + const SAMRAI_MPI& mpi, + const RankTreeStrategy& rank_tree, + const CommonTestSwitches& cts); + +void +destroyAsyncComms( + AsyncCommPeer *& child_comms, + AsyncCommPeer *& parent_comm); + +int +testUp( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db); + +int +testDown( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db); + +int +testUpThenDown( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db); + +int +testTreeLB( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db); + +void +setMessageData( + std::vector& msg, + int rank); + +int +verifyReceivedData( + const AsyncCommPeer& peer_comm); + +void +getCommonTestSwitchesFromDatabase( + CommonTestSwitches& cts, + Database& test_db); + +void +simulateDataProcessing( + const CommonTestSwitches& cts); + +SAMRAI_MPI::Comm +getRotatedMPI( + const SAMRAI_MPI::Comm& old_comm); +SAMRAI_MPI::Comm +getSmallerMPI( + const SAMRAI_MPI::Comm& old_comm); + +// Replacement for usleep, which is broken on some machines. +void +my_usleep( + size_t num_usec); +void +calibrate_my_usleep(); +unsigned long dummy() { + static unsigned long i = 0; + i = (i + 1) % 1000; + return i; +} +double my_usleep_calls_per_usec = 0; + +/* + ******************************************************************************** + * + * Performance testing for tree communication. + * + * 1. + * + * 2. + * + * Input File: + * + * Test## { // ## is a 2-digit integer, sequentially from 0 + * + * nickname = "Foobar" // Optional name for this test. + * + * tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + * + * BalancedDepthFirstTree { // Parameters for BalancedDepthFirstTree in getTreeForTesting() + * do_left_leaf_switch = TRUE + * } + * + * // Pattern of message travel: + * // "UP", "DOWN": Up or down the tree. + * // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + * // "TreeLB": Simulate the communication of the TreeLoadBalancer. + * message_pattern = "DOWN" + * + * msg_length = 1024 // Message length (units of integer) + * first_data_length = 1 // One int. see AsyncCommPeer::limitFirstDataLength(). + * + * repetition = 1 // Number of times to run. 0 disables test. + * barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + * + * processing_cost = 5, 2 // Simulate processing with this 5 microseconds per message and 2 per msg_length unit. + * randomize_processing_cost = FALSE // Multiply a random factor in [0,1] to the processing cost. + * verify_data = TRUE // Verify correctness of received data. + * + * mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + * + * // Specify the dependency for the down-message, as a funcion of MPI rank: + * // 1: down message depends only on parent + * // 2: down message depends on grandparent + * // 0: there is no down message + * // First value is for rank 0, second is for rank 1, and so on. + * // The array is repeated for ranks higher than specifed. + * // (Rank r has dependency according to index r%L, where L is + * // the length of down_message_dependency.) + * down_message_dependency = 1, 2, 0, 1, 2, 0 + * } + * + ******************************************************************************** + */ + +int main( + int argc, + char* argv[]) +{ +#ifndef HAVE_MPI + // This test doesn't make sense without MPI because it cannot avoid MPI interfaces. + NULL_USE(argc); + std::cout << "PASSED: " << argv[0] << std::endl; + return 0; + +#else + + /* + * The switch --alter_mpi= is an option to alter SAMRAI's + * MPI group. It must be processed before starting SAMRAI because + * it affects SAMRAI's initial MPI. Valid values for and + * what they mean are seen in the if-else blocks below. + */ + std::string arg1(argv[1]); + std::string arg1value; + if (arg1.find("--alter_mpi=", 0) < arg1.size()) { + arg1value = arg1.c_str() + 12; + --argc; + for (int i = 1; i < argc; ++i) { + argv[i] = argv[i + 1]; + } + } + + // Start MPI first to we can generate a special communicator for SAMRAI. + MPI_Init(&argc, &argv); + + MPI_Comm communicator = MPI_COMM_WORLD; + { + int rank; + MPI_Comm_rank(communicator, &rank); + if (arg1value == "drop1") { + communicator = getSmallerMPI(communicator); + if (rank == 0) { + std::cout << "Dropped rank 1 from communicator." << std::endl; + } + } else if (arg1value == "rotate") { + communicator = getRotatedMPI(communicator); + if (rank == 0) { + std::cout << "Rotated ranks in communicator." << std::endl; + } + } else if (arg1value.empty()) { + if (rank == 0) { + std::cout << "No change in communicator." << std::endl; + } + } else { + if (rank == 0) { + std::cout << "alter_mpi of " << arg1value << " unrecognized." << std::endl; + MPI_Finalize(); + return 1; + } + } + } + + if (communicator == MPI_COMM_NULL) { + // This process has been excluded from the test. + MPI_Finalize(); + return 0; + } + + /* + * Initialize SAMRAI. + */ + SAMRAI_MPI::init(communicator); + SAMRAIManager::initialize(); + SAMRAIManager::startup(); + tbox::SAMRAI_MPI samrai_mpi(SAMRAI_MPI::getSAMRAIWorld()); + tbox::SAMRAI_MPI world_mpi(MPI_COMM_WORLD); + + int fail_count = 0; + + /* + * Process command line arguments. For each run, the input + * filename must be specified. Usage is: + * + * executable + */ + std::string input_filename; + + if (argc < 2) { + TBOX_ERROR("USAGE: " << argv[0] << " [case name]\n" + << " options:\n" + << " none at this time" << std::endl); + } else { + input_filename = argv[1]; + } + + std::string case_name; + if (argc > 2) { + case_name = argv[2]; + } + + /* + * Randomize the random number generator to avoid funny looking + * first random number. + */ + srand48(samrai_mpi.getRank() + 10 + samrai_mpi.getSize()); + + int total_err_count = 0; + + { + /* + * Scope to force destruction of objects that would otherwise + * leave allocated memory reported by the memory test. + */ + + /* + * Create input database and parse all data in input file. + */ + + boost::shared_ptr input_db(new InputDatabase("input_db")); + tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + + /* + * Set up the timer manager. + */ + if (input_db->isDatabase("TimerManager")) { + TimerManager::createManager(input_db->getDatabase("TimerManager")); + } + /* + * Create timers in the following orders so that they match + * across processors. That means creating some timers that are + * not needed in the current scope. + */ + TimerManager::getManager()->getTimer("apps::main::child_send"); + TimerManager::getManager()->getTimer("apps::main::child_recv"); + boost::shared_ptr t_child_wait = TimerManager::getManager()->getTimer( + "apps::main::child_wait"); + TimerManager::getManager()->getTimer("apps::main::parent_send"); + TimerManager::getManager()->getTimer("apps::main::parent_recv"); + boost::shared_ptr t_parent_wait = TimerManager::getManager()->getTimer( + "apps::main::parent_wait"); + TimerManager::getManager()->getTimer("apps::main::equiv_MPI"); + boost::shared_ptr t_processing = TimerManager::getManager()->getTimer( + "apps::main::processing"); + + /* + * Retrieve "Main" section from input database. + * The main database is used only in main(). + * The base_name variable is a base name for + * all name strings in this program. + */ + + boost::shared_ptr main_db = input_db->getDatabase("Main"); + + std::string base_name = "unnamed"; + base_name = main_db->getStringWithDefault("base_name", base_name); + + /* + * Modify basename for this particular run. + * Add the number of processes and the case name. + */ + if (!case_name.empty()) { + base_name = base_name + '-' + case_name; + } + base_name = base_name + '-' + tbox::Utilities::intToString( + samrai_mpi.getSize(), + 5); + tbox::plog << "Added case name (" << case_name << ") and nprocs (" + << samrai_mpi.getSize() << ") to base name -> '" + << base_name << "'\n"; + + if (!case_name.empty()) { + tbox::plog << "Added case name (" << case_name << ") and nprocs (" + << samrai_mpi.getSize() << ") to base name -> '" + << base_name << "'\n"; + } + + /* + * Start logging. + */ + const std::string log_file_name = base_name + ".log"; + bool log_all_nodes = false; + log_all_nodes = main_db->getBoolWithDefault("log_all_nodes", + log_all_nodes); + if (log_all_nodes) { + PIO::logAllNodes(log_file_name); + } else { + PIO::logOnlyNodeZero(log_file_name); + } + plog << "This is SAMRAI process " << samrai_mpi.getRank() << " of " << samrai_mpi.getSize() + << " and world process " << world_mpi.getRank() << " of " << world_mpi.getSize() + << std::endl; + + calibrate_my_usleep(); + + if (samrai_mpi.getCommunicator() != MPI_COMM_NULL) { + /* + * Run each test as it is pulled out of input_db. + */ + + int test_number = 0; + + CommGraphWriter comm_graph_writer; + + while (true) { + + std::string test_name("Test"); + test_name += Utilities::intToString(test_number, 2); + + boost::shared_ptr test_db = + input_db->getDatabaseWithDefault(test_name, boost::shared_ptr()); + + if (!test_db) { + break; + } + + const std::string nickname = + test_db->getStringWithDefault("nickname", test_name); + + plog << "\n\n\nStarting test " << test_name << " (" << nickname << ")\n"; + + CommonTestSwitches cts; + getCommonTestSwitchesFromDatabase(cts, *test_db); + + const boost::shared_ptr rank_tree = + getTreeForTesting(cts.tree_name, *test_db, samrai_mpi); + + // Write local part of tree to log. + plog << "Tree " << cts.tree_name << ":\n" + << " Root rank: " << rank_tree->getRootRank() << '\n' + << " Child number: " << rank_tree->getChildNumber() << '\n' + << " Generation number: " << rank_tree->getGenerationNumber() << '\n' + << " Number of children: " << rank_tree->getNumberOfChildren() << '\n' + << " " << rank_tree->getParentRank() << " <- " << rank_tree->getRank() << " ->"; + for (unsigned int i = 0; i < rank_tree->getNumberOfChildren(); ++i) { + plog << ' ' << rank_tree->getChildRank(i); + } + plog << std::endl; + + int test_err_count = 0; + + if (cts.message_pattern == "UP") { + test_err_count = testUp(*rank_tree, samrai_mpi, cts, *test_db); + } else if (cts.message_pattern == "DOWN") { + test_err_count = testDown(*rank_tree, samrai_mpi, cts, *test_db); + } else if (cts.message_pattern == "UP_THEN_DOWN") { + test_err_count = testUpThenDown(*rank_tree, samrai_mpi, cts, *test_db); + } else if (cts.message_pattern == "TreeLB") { + test_err_count = testTreeLB(*rank_tree, samrai_mpi, cts, *test_db); + } else { + TBOX_ERROR("Test message_pattern '" << cts.message_pattern << "' is not supported."); + } + + total_err_count += test_err_count; + + plog << "\n"; + pout << "Completed " << test_name << " (" << nickname << ") with " + << test_err_count << " errs, total of " << total_err_count << "\n"; + + if (test_err_count != 0) { + perr << "Test FAILED.\n"; + } + + comm_graph_writer.addRecord(samrai_mpi, size_t(1 + rank_tree->getDegree()), size_t(1)); + + for (unsigned int cn = 0; cn < rank_tree->getDegree(); ++cn) { + comm_graph_writer.setEdgeInCurrentRecord( + size_t(cn), + "child_wait", + t_child_wait->getTotalWallclockTime() / cts.repetition, + CommGraphWriter::FROM, + rank_tree->getChildRank(cn)); + } + + comm_graph_writer.setEdgeInCurrentRecord( + size_t(0 + rank_tree->getDegree()), + "parent_wait", + t_parent_wait->getTotalWallclockTime() / cts.repetition, + CommGraphWriter::FROM, + rank_tree->getParentRank()); + + comm_graph_writer.setNodeValueInCurrentRecord( + size_t(0), + "processing_time", + t_processing->getTotalWallclockTime() / cts.repetition); + + comm_graph_writer.writeGraphToTextStream( + comm_graph_writer.getNumberOfRecords() - 1, plog); + + // Output timer results then reset for next test. + tbox::TimerManager::getManager()->print(tbox::plog); + tbox::TimerManager::getManager()->resetAllTimers(); + + ++test_number; + + } + + if (samrai_mpi != SAMRAI_MPI::getSAMRAIWorld()) { + samrai_mpi.freeCommunicator(); + } + + tbox::plog << "TreeCommunicationBenchmark completed " << test_number << " tests." + << std::endl; + + } + + } + + /* + * Print input database again to fully show usage. + */ + plog << "Input database after running..." << std::endl; + tbox::InputManager::getManager()->getInputDatabase()->printClassData(plog); + + if (total_err_count == 0) { + tbox::pout << "\nPASSED: TreeCommunicationBenchmark" << std::endl; + } + + /* + * Exit properly by shutting down services in correct order. + */ + tbox::plog << "\nShutting down..." << std::endl; + + /* + * Shut down. + */ + SAMRAIManager::shutdown(); + SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); + MPI_Finalize(); + + return fail_count; + +#endif +} + +/* + ************************************************************************* + * Get common test switches from the test database. + ************************************************************************* + */ +void getCommonTestSwitchesFromDatabase( + CommonTestSwitches& cts, + Database& test_db) +{ + cts.tree_name = test_db.getString("tree_name"); + cts.message_pattern = test_db.getString("message_pattern"); + cts.msg_length = test_db.getIntegerWithDefault("msg_length", 1); + cts.first_data_length = test_db.getIntegerWithDefault("first_data_length", 1); + cts.verify_data = test_db.getBoolWithDefault("verify_data", false); + cts.repetition = test_db.getIntegerWithDefault("repetition", 1); + cts.barrier_after_each_repetition = test_db.getBoolWithDefault("barrier_after_each_repetition", + false); + if (test_db.isInteger("mpi_tags")) { + test_db.getIntegerArray("mpi_tags", cts.mpi_tags, 2); + } + if (test_db.isInteger("processing_cost")) { + test_db.getIntegerArray("processing_cost", cts.processing_cost, 2); + } + cts.randomize_processing_cost = test_db.getBoolWithDefault("randomize_processing_cost", false); +} + +/* + **************************************************************************** + * Test sending up the tree. + **************************************************************************** + */ +int testUp( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db) +{ + plog << "Test database:\n"; + test_db.printClassData(plog); + + int err_count = 0; + + AsyncCommStage child_stage; + AsyncCommPeer* child_comms; + AsyncCommStage parent_stage; + AsyncCommPeer* parent_comm; + setupAsyncComms(child_stage, child_comms, parent_stage, parent_comm, + mpi, rank_tree, cts); + + std::vector msg(cts.msg_length, 1); + setMessageData(msg, mpi.getRank()); + + boost::shared_ptr repetitions_timer = TimerManager::getManager()->getTimer( + "apps::main::repetitions"); + boost::shared_ptr processing_timer = TimerManager::getManager()->getTimer( + "apps::main::processing"); + boost::shared_ptr verify_timer = TimerManager::getManager()->getTimer( + "apps::main::verify"); + boost::shared_ptr equiv_mpi_timer = TimerManager::getManager()->getTimer( + "apps::main::equiv_MPI"); + + mpi.Barrier(); + repetitions_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + child_comms[ic].beginRecv(); + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.verify_data) { + verify_timer->start(); + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + err_count += verifyReceivedData(child_comms[ic]); + } + verify_timer->stop(); + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + + if (rank_tree.getParentRank() != RankTreeStrategy::getInvalidRank()) { + if (!parent_comm->isDone()) { + parent_comm->completeCurrentOperation(); // From previous repetition. + } + parent_comm->beginSend(&msg[0], cts.msg_length); + } + + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + repetitions_timer->stop(); + + parent_stage.advanceAll(); // Make sure all is completed before destroying. + destroyAsyncComms(child_comms, parent_comm); + + /* + * Run equivalent MPI operations for comparison. + */ + + std::vector msgr(cts.msg_length, 1); + equiv_mpi_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + mpi.Reduce(&msg[0], &msgr[0], cts.msg_length, MPI_INT, MPI_SUM, + rank_tree.getRootRank()); + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + equiv_mpi_timer->stop(); + + return err_count; +} + +/* + **************************************************************************** + * Test sending down the tree. + **************************************************************************** + */ +int testDown( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db) +{ + plog << "Test database:\n"; + test_db.printClassData(plog); + + int err_count = 0; + + AsyncCommStage child_stage; + AsyncCommPeer* child_comms; + AsyncCommStage parent_stage; + AsyncCommPeer* parent_comm; + setupAsyncComms(child_stage, child_comms, parent_stage, parent_comm, + mpi, rank_tree, cts); + + std::vector msg(cts.msg_length, 1); + setMessageData(msg, mpi.getRank()); + + boost::shared_ptr repetitions_timer = TimerManager::getManager()->getTimer( + "apps::main::repetitions"); + boost::shared_ptr processing_timer = TimerManager::getManager()->getTimer( + "apps::main::processing"); + boost::shared_ptr verify_timer = TimerManager::getManager()->getTimer( + "apps::main::verify"); + boost::shared_ptr equiv_mpi_timer = TimerManager::getManager()->getTimer( + "apps::main::equiv_MPI"); + + mpi.Barrier(); + repetitions_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + + if (rank_tree.getParentRank() != RankTreeStrategy::getInvalidRank()) { + parent_comm->beginRecv(); + parent_comm->completeCurrentOperation(); + + if (cts.verify_data) { + verify_timer->start(); + err_count += verifyReceivedData(*parent_comm); + verify_timer->stop(); + } + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + if (!child_comms[ic].isDone()) { + child_comms[ic].completeCurrentOperation(); // From previous repetition. + } + child_comms[ic].beginSend(&msg[0], cts.msg_length); + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + repetitions_timer->stop(); + + child_stage.advanceAll(); // Make sure all is completed before destroying. + destroyAsyncComms(child_comms, parent_comm); + + /* + * Run equivalent MPI operations for comparison. + */ + + equiv_mpi_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + mpi.Bcast(&msg[0], cts.msg_length, MPI_INT, rank_tree.getRootRank()); + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + equiv_mpi_timer->stop(); + + return err_count; +} + +/* + **************************************************************************** + * Test sending up then down the tree. + **************************************************************************** + */ +int testUpThenDown( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db) +{ + plog << "Test database:\n"; + test_db.printClassData(plog); + + int err_count = 0; + + AsyncCommStage child_stage; + AsyncCommPeer* child_comms; + AsyncCommStage parent_stage; + AsyncCommPeer* parent_comm; + setupAsyncComms(child_stage, child_comms, parent_stage, parent_comm, + mpi, rank_tree, cts); + + std::vector msg(cts.msg_length, 1); + setMessageData(msg, mpi.getRank()); + + boost::shared_ptr repetitions_timer = TimerManager::getManager()->getTimer( + "apps::main::repetitions"); + boost::shared_ptr processing_timer = TimerManager::getManager()->getTimer( + "apps::main::processing"); + boost::shared_ptr verify_timer = TimerManager::getManager()->getTimer( + "apps::main::verify"); + boost::shared_ptr equiv_mpi_timer = TimerManager::getManager()->getTimer( + "apps::main::equiv_MPI"); + + mpi.Barrier(); + repetitions_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + child_comms[ic].beginRecv(); + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.verify_data) { + verify_timer->start(); + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + err_count += verifyReceivedData(child_comms[ic]); + } + verify_timer->stop(); + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + + if (rank_tree.getParentRank() != RankTreeStrategy::getInvalidRank()) { + parent_comm->beginSend(&msg[0], cts.msg_length); + parent_comm->completeCurrentOperation(); + + parent_comm->beginRecv(); + parent_comm->completeCurrentOperation(); + + if (cts.verify_data) { + verify_timer->start(); + err_count += verifyReceivedData(*parent_comm); + verify_timer->stop(); + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + } + + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + if (!child_comms[ic].isDone()) { + TBOX_ERROR("Test code error: Should never be here."); + } + child_comms[ic].beginSend(&msg[0], cts.msg_length); + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + repetitions_timer->stop(); + + child_stage.advanceAll(); // Make sure all is completed before destroying. + destroyAsyncComms(child_comms, parent_comm); + + /* + * Run equivalent MPI operations for comparison. + */ + + std::vector msgr(cts.msg_length, 1); + mpi.Barrier(); + equiv_mpi_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + mpi.Allreduce(&msg[0], &msgr[0], cts.msg_length, MPI_INT, MPI_SUM); + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + equiv_mpi_timer->stop(); + + return err_count; +} + +/* + **************************************************************************** + * Simulation the communication of the TreeLoadBalancer. + * Test sending up then down the tree. Some ranks expect a down + * message dependent on the parent, some expect one dependent + * on the grandparent and some expect no down message at all. + * See the extra input parameter down_message_dependency. + **************************************************************************** + */ +int testTreeLB( + const RankTreeStrategy& rank_tree, + const SAMRAI_MPI& mpi, + const CommonTestSwitches& cts, + Database& test_db) +{ + + std::vector down_message_dependency = + test_db.getIntegerVector("down_message_dependency"); + const int dl = static_cast(down_message_dependency.size()); + +#ifdef DEBUG_CHECK_ASSERTIONS + for (int i = 0; i < dl; ++i) { + TBOX_ASSERT(down_message_dependency[i] >= 0 && + down_message_dependency[i] < 3); + } +#endif + + plog << "Test database:\n"; + test_db.printClassData(plog); + + int err_count = 0; + + AsyncCommStage child_stage; + AsyncCommPeer* child_comms; + AsyncCommStage parent_stage; + AsyncCommPeer* parent_comm; + setupAsyncComms(child_stage, child_comms, parent_stage, parent_comm, + mpi, rank_tree, cts); + + std::vector msg(cts.msg_length, 1); + setMessageData(msg, mpi.getRank()); + + boost::shared_ptr repetitions_timer = TimerManager::getManager()->getTimer( + "apps::main::repetitions"); + boost::shared_ptr processing_timer = TimerManager::getManager()->getTimer( + "apps::main::processing"); + boost::shared_ptr verify_timer = TimerManager::getManager()->getTimer( + "apps::main::verify"); + + mpi.Barrier(); + repetitions_timer->start(); + for (int r = 0; r < cts.repetition; ++r) { + + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + child_comms[ic].beginRecv(); + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.verify_data) { + verify_timer->start(); + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + err_count += verifyReceivedData(child_comms[ic]); + } + verify_timer->stop(); + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + + if (rank_tree.getParentRank() != RankTreeStrategy::getInvalidRank()) { + parent_comm->beginSend(&msg[0], cts.msg_length); + } + + // Send down-messages to children that are independent of their grandparents. + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + const int child_rank = rank_tree.getChildRank(ic); + if (down_message_dependency[child_rank % dl] == 1) { + if (!child_comms[ic].isDone()) { + TBOX_ERROR("Test code error: Should never be here."); + } + child_comms[ic].beginSend(&msg[0], cts.msg_length); + } + } + + if (rank_tree.getParentRank() != RankTreeStrategy::getInvalidRank()) { + parent_comm->completeCurrentOperation(); + + if (down_message_dependency[rank_tree.getRank() % dl] != 0) { + // This process expects a message from its parent. + parent_comm->beginRecv(); + parent_comm->completeCurrentOperation(); + + if (cts.verify_data) { + verify_timer->start(); + err_count += verifyReceivedData(*parent_comm); + verify_timer->stop(); + } + + processing_timer->start(); + simulateDataProcessing(cts); + processing_timer->stop(); + } + } + + // Send down-messages to children that depend on their grandparents. + for (unsigned int ic = 0; ic < rank_tree.getNumberOfChildren(); ++ic) { + const int child_rank = rank_tree.getChildRank(ic); + if (down_message_dependency[child_rank % dl] == 2) { + if (!child_comms[ic].isDone()) { + TBOX_ERROR("Test code error: Should never be here."); + } + child_comms[ic].beginSend(&msg[0], cts.msg_length); + } + } + + child_stage.advanceAll(); + child_stage.clearCompletionQueue(); + + if (cts.barrier_after_each_repetition) { + mpi.Barrier(); + } + } + repetitions_timer->stop(); + + child_stage.advanceAll(); // Make sure all is completed before destroying. + destroyAsyncComms(child_comms, parent_comm); + + return err_count; +} + +/* + **************************************************************************** + * Simulate the data_processing. + **************************************************************************** + */ +void simulateDataProcessing(const CommonTestSwitches& cts) +{ + double randf = cts.randomize_processing_cost ? tbox::MathUtilities::Rand(0.0, 1.0) : 1.0; + unsigned long microsecs = + static_cast(randf + * (cts.processing_cost[0] + cts.msg_length + * cts.processing_cost[1])); + my_usleep(microsecs); +} + +/* + **************************************************************************** + * Sleep for some count of microseconds, a substitute for usleep. + **************************************************************************** + */ +void my_usleep(size_t num_usec) +{ + size_t num_calls = static_cast(double(num_usec) * my_usleep_calls_per_usec); + for (size_t i = 0; i < num_calls; ++i) { + dummy(); + } +} + +/* + **************************************************************************** + * Calibration for my_usleep, a substitute for usleep. + **************************************************************************** + */ +void calibrate_my_usleep() +{ + tbox::plog << "Calibrating my_usleep.\n"; + + const size_t num_samples = 1000000; + + clock_t user_start, system_start; + double wallclock_start; + tbox::Clock::timestamp(user_start, system_start, wallclock_start); + + for (size_t i = 0; i < num_samples; ++i) { + dummy(); + } + + clock_t user_stop, system_stop; + double wallclock_stop; + tbox::Clock::timestamp(user_stop, system_stop, wallclock_stop); + + double wall_time = wallclock_stop - wallclock_start; + my_usleep_calls_per_usec = 1e-6 * num_samples / wall_time; + + tbox::plog << "Calibration completed. my_usleep_calls_per_usec = " + << my_usleep_calls_per_usec; + +} + +/* + **************************************************************************** + * Initialize data. + * Fill array starting with value of rank, then increasing. + **************************************************************************** + */ +void setMessageData( + std::vector& msg, + int rank) +{ + for (size_t i = 0; i < msg.size(); ++i) { + msg[i] = rank + static_cast(i); + } +} + +/* + **************************************************************************** + * Verify that data matches what is set by setMessageData. + **************************************************************************** + */ +int verifyReceivedData( + const AsyncCommPeer& peer_comm) +{ + TBOX_ASSERT(peer_comm.isDone()); + int err_count = 0; + const int* msg = peer_comm.getRecvData(); + const int msg_length = peer_comm.getRecvSize(); + const int rank = peer_comm.getPeerRank(); + for (int i = 0; i < msg_length; ++i) { + if (msg[i] != rank + i) { + ++err_count; + } + } + return err_count; +} + +/* + **************************************************************************** + * Get the RankTreeStrategy implementation for the test Database. + **************************************************************************** + */ +boost::shared_ptr getTreeForTesting( + const std::string& tree_name, + Database& test_db, + const SAMRAI_MPI& mpi) +{ + boost::shared_ptr rank_tree; + + if (tree_name == "BalancedDepthFirstTree") { + + BalancedDepthFirstTree * bdfs(new BalancedDepthFirstTree()); + + if (test_db.isDatabase("BalancedDepthFirstTree")) { + boost::shared_ptr tmp_db = test_db.getDatabase("BalancedDepthFirstTree"); + bool do_left_leaf_switch = tmp_db->getBoolWithDefault("do_left_leaf_switch", true); + bdfs->setLeftLeafSwitching(do_left_leaf_switch); + } + + bdfs->setupTree(RankGroup(mpi), mpi.getRank()); + rank_tree.reset(bdfs); + + } else if (tree_name == "CenteredRankTree") { + + CenteredRankTree * crt(new tbox::CenteredRankTree()); + + if (test_db.isDatabase("CenteredRankTree")) { + boost::shared_ptr tmp_db = test_db.getDatabase("CenteredRankTree"); + bool make_first_rank_the_root = tmp_db->getBoolWithDefault("make_first_rank_the_root", + true); + crt->makeFirstRankTheRoot(make_first_rank_the_root); + } + + crt->setupTree(RankGroup(mpi), mpi.getRank()); + rank_tree.reset(crt); + + } else if (tree_name == "BreadthFirstRankTree") { + + BreadthFirstRankTree * dft(new tbox::BreadthFirstRankTree()); + + if (test_db.isDatabase("BreadthFirstRankTree")) { + boost::shared_ptr tmp_db = test_db.getDatabase("BreadthFirstRankTree"); + const int tree_degree = tmp_db->getIntegerWithDefault("tree_degree", true); + dft->setTreeDegree(static_cast(tree_degree)); + } + + dft->setupTree(RankGroup(mpi), mpi.getRank()); + rank_tree.reset(dft); + + } else { + TBOX_ERROR("Unrecognized RankTreeStrategy " << tree_name); + } + + return rank_tree; +} + +/* + **************************************************************************** + * + **************************************************************************** + */ +void setupAsyncComms( + AsyncCommStage& child_stage, + AsyncCommPeer *& child_comms, + AsyncCommStage& parent_stage, + AsyncCommPeer *& parent_comm, + const SAMRAI_MPI& mpi, + const RankTreeStrategy& rank_tree, + const CommonTestSwitches& cts) +{ + child_comms = parent_comm = 0; + + const int num_children = rank_tree.getNumberOfChildren(); + + if (num_children > 0) { + + child_comms = new tbox::AsyncCommPeer[num_children]; + + for (int child_num = 0; child_num < num_children; ++child_num) { + + const int child_rank = rank_tree.getChildRank(child_num); + + child_comms[child_num].initialize(&child_stage); + child_comms[child_num].setPeerRank(child_rank); + child_comms[child_num].setMPI(mpi); + child_comms[child_num].setMPITag(cts.mpi_tags[0], cts.mpi_tags[1]); + child_comms[child_num].limitFirstDataLength(cts.first_data_length); + child_comms[child_num].setSendTimer( + TimerManager::getManager()->getTimer("apps::main::child_send")); + child_comms[child_num].setRecvTimer( + TimerManager::getManager()->getTimer("apps::main::child_recv")); + child_comms[child_num].setWaitTimer( + TimerManager::getManager()->getTimer("apps::main::child_wait")); + } + } + + if (rank_tree.getParentRank() != tbox::RankTreeStrategy::getInvalidRank()) { + + const int parent_rank = rank_tree.getParentRank(); + + parent_comm = new tbox::AsyncCommPeer; + parent_comm->initialize(&parent_stage); + parent_comm->setPeerRank(parent_rank); + parent_comm->setMPI(mpi); + parent_comm->setMPITag(cts.mpi_tags[0], cts.mpi_tags[1]); + parent_comm->limitFirstDataLength(cts.first_data_length); + parent_comm->setSendTimer( + TimerManager::getManager()->getTimer("apps::main::parent_send")); + parent_comm->setRecvTimer( + TimerManager::getManager()->getTimer("apps::main::parent_recv")); + parent_comm->setWaitTimer( + TimerManager::getManager()->getTimer("apps::main::parent_wait")); + + } + + parent_stage.setCommunicationWaitTimer(TimerManager::getManager()->getTimer( + "apps::main::parent_wait")); + child_stage.setCommunicationWaitTimer(TimerManager::getManager()->getTimer( + "apps::main::child_wait")); +} + +/* + ************************************************************************* + ************************************************************************* + */ +void destroyAsyncComms( + AsyncCommPeer *& child_comms, + AsyncCommPeer *& parent_comm) +{ + if (child_comms != 0) { + delete[] child_comms; + } + if (parent_comm != 0) { + delete parent_comm; + } + child_comms = parent_comm = 0; +} + +/* + ************************************************************************* + * Create a new communicator with ranks rotated downward by 1. + ************************************************************************* + */ +SAMRAI_MPI::Comm getRotatedMPI(const SAMRAI_MPI::Comm& old_comm) +{ +#ifdef HAVE_MPI + int old_rank, old_size; + MPI_Comm_rank(old_comm, &old_rank); + MPI_Comm_size(old_comm, &old_size); + + if (old_size == 1) { + return old_comm; + } + + MPI_Group old_group; + MPI_Comm_group(old_comm, &old_group); + + MPI_Group new_group; + int ranges[2][3]; + ranges[0][0] = 1; + ranges[0][1] = old_size - 1; + ranges[0][2] = 1; + ranges[1][0] = 0; + ranges[1][1] = 0; + ranges[1][2] = 1; + MPI_Group_range_incl(old_group, 2, ranges, &new_group); + + SAMRAI_MPI::Comm new_comm; + MPI_Comm_create(old_comm, new_group, &new_comm); + return new_comm; + +#else + NULL_USE(old_comm); + return SAMRAI_MPI::Comm(); + +#endif +} + +/* + ************************************************************************* + * Create a new communicator with process 1 removed. + ************************************************************************* + */ +SAMRAI_MPI::Comm getSmallerMPI(const SAMRAI_MPI::Comm& old_comm) +{ +#ifdef HAVE_MPI + int old_rank, old_size; + MPI_Comm_rank(old_comm, &old_rank); + MPI_Comm_size(old_comm, &old_size); + + if (old_size == 1) { + return old_comm; + } + + MPI_Group old_group; + MPI_Comm_group(old_comm, &old_group); + + MPI_Group new_group; + int ranges[2][3]; + ranges[0][0] = 0; + ranges[0][1] = 0; + ranges[0][2] = 1; + if (old_size == 2) { + MPI_Group_range_incl(old_group, 1, ranges, &new_group); + } else { + ranges[1][0] = 2; + ranges[1][1] = old_size - 1; + ranges[1][2] = 1; + MPI_Group_range_incl(old_group, 2, ranges, &new_group); + } + + SAMRAI_MPI::Comm new_comm; + MPI_Comm_create(old_comm, new_group, &new_comm); + return old_rank == 1 ? MPI_COMM_NULL : new_comm; + +#else + NULL_USE(old_comm); + return SAMRAI_MPI::Comm(); + +#endif +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/breadthfirsttree.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/breadthfirsttree.input new file mode 100644 index 00000000..ccfdcfe2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/breadthfirsttree.input @@ -0,0 +1,97 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* +Benchmark for BreadthFirstRankTree communication. +*/ + +Main { + + // Base name for output files. + base_name = "bft" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + + nickname = "binarytree" // Nick name of test. + // Test the binary tree mode. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + +Test01 { + + nickname = "trinarytree" // Nick name of test. + // Test the binary tree mode. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 3 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/centeredrank.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/centeredrank.input new file mode 100644 index 00000000..733a6d9f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/centeredrank.input @@ -0,0 +1,120 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* +Benchmark for CenteredRankTree communication. +*/ + +Main { + + // Base name for output files. + base_name = "centeredrank" + + // Whether to log all nodes. + log_all_nodes = TRUE + +} + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + +Test00 { + + nickname = "Centered-root=0" // Nick name of test. + // This is an extension of the Allreduce test, simulating the communication + // patern of the TreeLoadBalancer. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + +Test01 { + + nickname = "Centered-standard" // Nick name of test. + // This is an extension of the Allreduce test, simulating the communication + // patern of the TreeLoadBalancer. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/comparetrees.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/comparetrees.input new file mode 100644 index 00000000..29c13b21 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/comparetrees.input @@ -0,0 +1,299 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * The purpose of this input file is to compare performance of different + * RankTreeStrategy implementations. There is no barrrier after each + * cycle, so comparisons against MPI equivalents might be questionable. + * + * Processing cost is zero, since it would not diffentiate the diffeent + * implementations. + */ + +Main { + + // Base name for output files. + base_name = "comparetrees" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + + nickname = "Reduce-DFS" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP" +} + + +Test01 { + + nickname = "Reduce-CT" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP" +} + + +Test02 { + + nickname = "Broadcast-DFS" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "DOWN" +} + + +Test03 { + + nickname = "Broadcast-CT" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "DOWN" +} + + +Test04 { + + nickname = "Allreduce-DFS" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test05 { + + nickname = "Allreduce-CT" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test06 { + + nickname = "TreeLB-DFS" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + +Test07 { + + nickname = "TreeLB-CT" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/contention.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/contention.input new file mode 100644 index 00000000..dce76d11 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/contention.input @@ -0,0 +1,298 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * Test contention for Allreduce operation using tree communication. + * Compare CenteredRankTree, which has the shortest hop counts with + * BreadthFirstRankTree, which has the longest hop counts (of all + * we have implemented) and BalancedDepthFirstTree, which has hop + * counts in between. + */ + +Main { + + // Base name for output files. + base_name = "contention" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + nickname = "crt-10" // CenteredRankTree, 10 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test01 { + nickname = "bft-10" // BreadthFirstRankTree, 10 items. + tree_name = "BreadthFirstRankTree" + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test02 { + nickname = "dft-10" // BalancedDepthFirstTree, 10 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} + + +Test03 { + nickname = "crt-100" // CenteredRankTree, 100 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test04 { + nickname = "bft-100" // BreadthFirstRankTree, 100 items. + tree_name = "BreadthFirstRankTree" + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test05 { + nickname = "dft-100" // BalancedDepthFirstTree, 100 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} + + +Test06 { + nickname = "crt-1000" // CenteredRankTree, 1000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test07 { + nickname = "bft-1000" // BreadthFirstRankTree, 1000 items. + tree_name = "BreadthFirstRankTree" + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test08 { + nickname = "dft-1000" // BalancedDepthFirstTree, 1000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} + + +Test09 { + nickname = "crt-10000" // CenteredRankTree, 10000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test10 { + nickname = "bft-10000" // BreadthFirstRankTree, 10000 items. + tree_name = "BreadthFirstRankTree" + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test11 { + nickname = "dft-10000" // BalancedDepthFirstTree, 10000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} + + +Test12 { + nickname = "crt-100000" // CenteredRankTree, 100000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test13 { + nickname = "bft-100000" // BreadthFirstRankTree, 100000 items. + tree_name = "BreadthFirstRankTree" + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} +Test14 { + nickname = "dft-100000" // BalancedDepthFirstTree, 100000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + // Send messages up then down to simulate an all-reduce. + message_pattern = "UP_THEN_DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/firstlengths.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/firstlengths.input new file mode 100644 index 00000000..368a9b38 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/firstlengths.input @@ -0,0 +1,225 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * Similar to messagelengthdependency test, but make the first + * length always 1 to force most tests to send two messages + * for each edge. + * + * To be compared with messagelengthdependency to see the effects + * of sending the extra message. + */ + +Main { + + // Base name for output files. + base_name = "firstlengths" + + // Whether to log all nodes. + log_all_nodes = FALSE + + alter_mpi = "drop1" // "rotate" | "drop1" + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + + nickname = "num_int=1" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test01 { + + nickname = "num_int=10" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test02 { + + nickname = "num_int=100" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test03 { + + nickname = "num_int=1000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test04 { + + nickname = "num_int=10000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test05 { + + nickname = "num_int=100000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/messagelengthdependency.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/messagelengthdependency.input new file mode 100644 index 00000000..ad9d47cd --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/messagelengthdependency.input @@ -0,0 +1,219 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* +Benchmark for studying the tree communication performance dependencies +on message length. +*/ + +Main { + + // Base name for output files. + base_name = "messagelengthdependency" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + + nickname = "num_int=1" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test01 { + + nickname = "num_int=10" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 10 // Message length (units of integer) + first_data_length = 10 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test02 { + + nickname = "num_int=100" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 100 // Message length (units of integer) + first_data_length = 100 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test03 { + + nickname = "num_int=1000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1000 // Message length (units of integer) + first_data_length = 1000 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test04 { + + nickname = "num_int=10000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 10000 // Message length (units of integer) + first_data_length = 10000 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test05 { + + nickname = "num_int=100000" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 100000 // Message length (units of integer) + first_data_length = 100000 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/multiple.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/multiple.input new file mode 100644 index 00000000..16f428ab --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/multiple.input @@ -0,0 +1,429 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* +Benchmark for various combinations of rank trees and collective +communication operations. +*/ + +Main { + + // Base name for output files. + base_name = "multiple" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + + nickname = "DFT-Reduce" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP" +} + + +Test01 { + + nickname = "DFT-Broadcast" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "DOWN" +} + + +Test02 { + + nickname = "DFT-Allreduce" // Nick name of test. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test03 { + + nickname = "DFT-TreeLB" // Nick name of test. + // This is an extension of the Allreduce test, simulating the communication + // patern of the TreeLoadBalancer. + + tree_name = "BalancedDepthFirstTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + +Test04 { + + nickname = "CT-Reduce" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP" +} + + +Test05 { + + nickname = "CT-Broadcast" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "DOWN" +} + + +Test06 { + + nickname = "CT-Allreduce" // Nick name of test. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test07 { + + nickname = "CT-TreeLB" // Nick name of test. + // This is an extension of the Allreduce test, simulating the communication + // patern of the TreeLoadBalancer. + + tree_name = "CenteredRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + +Test08 { + + nickname = "BFT-Reduce" // Nick name of test. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP" +} + + +Test09 { + + nickname = "BFT-Broadcast" // Nick name of test. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "DOWN" +} + + +Test10 { + + nickname = "BFT-Allreduce" // Nick name of test. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "UP_THEN_DOWN" +} + + +Test11 { + + nickname = "BFT-TreeLB" // Nick name of test. + // This is an extension of the Allreduce test, simulating the communication + // patern of the TreeLoadBalancer. + + tree_name = "BreadthFirstRankTree" // BalancedDepthFirstTree || CenteredRankTree || ... + + BreadthFirstRankTree { // Parameters for tree of same name in getTreeForTesting() + tree_degree = 2 + } + + msg_length = 1024 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + + verify_data = TRUE // Verify correctness of received data. + processing_cost = 400, 0 // Simulated processing cost is 400 usec per message and 0 usec per item in message. + + repetition = 100 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + + // Pattern of message travel: + // "UP", "DOWN": Up or down the tree + // "UP_THEN_DOWN", "DOWN_THEN_UP": Self-explanatory + // "TreeLB": Simulation communication of TreeLoadBalancer + message_pattern = "TreeLB" + + // Specify the dependency for the down-message, as a funcion of MPI rank: + // 1: down message depends only on parent + // 2: down message depends on grandparent + // 0: there is no down message + // First value is for rank 0, second is for rank 1, and so on. + // The array is repeated for ranks higher than specifed. + // (Rank r has dependency according to index r%L, where L is + // the length of down_message_dependency.) + down_message_dependency = 1, 2, 0, 1, 2, 0 +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbL0delay.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbL0delay.input new file mode 100644 index 00000000..ca9eca9f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbL0delay.input @@ -0,0 +1,103 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * Test tlbL0delay tries to simulate the down-communication part of + * the TreeLoadBalancer for the case of work originating from the root. + * It uses a broadcast operation. + * + * Use CenteredRankTree. + * + * Do one run with zero processing cost, one with regular processing costs + * and one with randomized processing cost. + */ + +Main { + + // Base name for output files. + base_name = "tlbL0delay" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + nickname = "zerocost" // CenteredRankTree, 10 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 500 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 0, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + randomize_processing_cost = FALSE + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test01 { + nickname = "uniformcost" // CenteredRankTree, 10 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 500 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + randomize_processing_cost = FALSE + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test02 { + nickname = "randomcost" // CenteredRankTree, 10 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 500 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + randomize_processing_cost = TRUE + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdomex.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdomex.input new file mode 100644 index 00000000..078f47b0 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdomex.input @@ -0,0 +1,162 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * Try to simulate dms3ub49/dmc06ub load balancing communication: + * Based on dms3ub49: the max box count over any edge is about 1120 at 128K procs; + * the max local processing time for 40 partitionings is 2 seconds at 65K procs. + * + * TreeLoadBalancer uses first data length of 500 boxes, or 5000 integers. + * + * To cover the worst-case based on those quantities, I will set + * msg_length up to 100,000 integers and processing_cost = 50000 microseconds + * (independent of message length), first_data_length = 5000. + * + * Test for Allreduce operation using tree communication. + */ + +Main { + + // Base name for output files. + base_name = "tlbdomex" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + nickname = "dft-1" // BalancedDepthFirstTree, 10 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 1 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + +Test01 { + nickname = "dft-10" // BalancedDepthFirstTree, 10 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + repetition = 10 // Repetitions of communication and processing steps. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + +Test02 { + nickname = "dft-100" // BalancedDepthFirstTree, 100 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + +Test03 { + nickname = "dft-1000" // BalancedDepthFirstTree, 1000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + +Test04 { + nickname = "dft-10000" // BalancedDepthFirstTree, 10000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + +Test05 { + nickname = "dft-100000" // BalancedDepthFirstTree, 100000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 5000 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 50000, 0 // Simulate processing with X microseconds per message and Y per msg_length unit. + randomize_processing_cost = TRUE // Multiply a random factor in [0,1] to the processing cost. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = FALSE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "UP_THEN_DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdown.input b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdown.input new file mode 100644 index 00000000..68686a4d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/test_inputs/tlbdown.input @@ -0,0 +1,207 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Code and input for benchmarking and experimentation with tree-based communication. + * + ************************************************************************/ + +/* + * Test tlbdown tries to simulate the down-communication part of + * the TreeLoadBalancer. It uses a broadcast operation. + * + * Compare CenteredRankTree and BalancedDepthFirstTree. + */ + +Main { + + // Base name for output files. + base_name = "tlbdown" + + // Whether to log all nodes. + log_all_nodes = FALSE + +} + + + + +/* + * Define tests using databases named Test##, + * where ## is a 2-digit integer, sequentially from 0 + */ + + +Test00 { + nickname = "Centered-10" // CenteredRankTree, 10 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} +Test01 { + nickname = "DepthFirst-10" // BalancedDepthFirstTree, 10 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test02 { + nickname = "Centered-100" // CenteredRankTree, 100 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} +Test03 { + nickname = "DepthFirst-100" // BalancedDepthFirstTree, 100 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test04 { + nickname = "Centered-1000" // CenteredRankTree, 1000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} +Test05 { + nickname = "DepthFirst-1000" // BalancedDepthFirstTree, 1000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 1000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test06 { + nickname = "Centered-10000" // CenteredRankTree, 10000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} +Test07 { + nickname = "DepthFirst-10000" // BalancedDepthFirstTree, 10000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 10000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + +Test08 { + nickname = "Centered-100000" // CenteredRankTree, 100000 items. + tree_name = "CenteredRankTree" + CenteredRankTree { // Parameters for tree of same name in getTreeForTesting() + make_first_rank_the_root = FALSE + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} +Test09 { + nickname = "DepthFirst-100000" // BalancedDepthFirstTree, 100000 items. + tree_name = "BalancedDepthFirstTree" + BalancedDepthFirstTree { // Parameters for tree of same name in getTreeForTesting() + do_left_leaf_switch = TRUE + } + msg_length = 100000 // Message length (units of integer) + first_data_length = 1 // See AsyncCommPeer::limitFirstDataLength(). + verify_data = TRUE // Verify correctness of received data. + processing_cost = 4000, 0 // Simulated processing cost is [0] usec per message and [1] usec per item in message. + repetition = 10 // Repetitions of communication and processing steps. + barrier_after_each_repetition = TRUE // Whether to barrier after each rep. + mpi_tags = 1, 2 // Array of 2 ints, see AsyncCommPeer::setMPITag(). + message_pattern = "DOWN" +} + + + + + +// Refer to tbox::TimerManager for input. +TimerManager { +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE + print_threshold = 0. + timer_list = "tbox::*::*", "apps::*::*" +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_length.pl b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_length.pl new file mode 100755 index 00000000..a34dd269 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_length.pl @@ -0,0 +1,173 @@ +#!/usr/bin/env perl + +# Build a tab-delineated summary table of timings for plotting time vs message-length +# using plot-samrai-timers. + + +use ExtractSAMRAITimers; + + +require Getopt::Long; +my $raw; +Getopt::Long::GetOptions( 'help' => \$help + , 'verbose' => \$verbose + , 'debug' => \$debug + , 'raw' => \$raw + ); + +my $script_name = `basename $0`; chop $script_name; + +if ( $help ) { + print <<_EOM_; + +Usage: $script_name [options] + +Log files must be of the form *-.log* +Each log file name is parsed to find its corresponding nproc. +The same set of TreeCommunication benchmark tests must appear +in all the log files, in the same order. (They must all be +generated using the same input files.) + +Options: + + --raw + Use raw values instead of normalizing by number of repetitions. + +_EOM_ + exit(0); +} + +$ExtractSAMRAITimers::verbose = $verbose; +$ExtractSAMRAITimers::debug = $debug; + +my @logs = @ARGV; +die "No log files specified" if @logs == 0; + +my @nprocs = ExtractSAMRAITimers::get_nprocs_from_log_names(@logs); +$,=' '; +print STDERR ("nprocs:", @nprocs, "\n") if $verbose; +$,=''; + +$, = "\t"; + + +################################################################### +# Suck in all the timer sections. +################################################################### + +$/ = "\n\n"; +my @timerparagraphs; +if (defined $timerfile) { + open( TIMERFILE, "< $timerfile" ) || die "Cannot open file $timerfile"; + @timerparagraphs = ; + close TIMERFILE || die "Cannot close $timerfile"; +} +else { + @timerparagraphs = ; +} +$/ = "\n"; +my ($section_name, $timers_, %timer_label) = + ExtractSAMRAITimers::parse_timer_selection($timerparagraphs[0]); +my @timers = @$timers_; + + + +################################################################### +# Scan first log file to determine number of tests. +# We have to require that the same tests appear in all logs. +# Store the (nick)names in @test_names. +################################################################### +my @test_names; +open (LOG, $logs[0]) || die "Cannot open $logs[0]"; +while ( $_ = ) { + if ( /^Starting test Test([0-9]+) \((.*)\)$/ ) { + $test_names[$1] = $2; + } +} +close LOG; + +my %tests_by_length; +for ( @test_names ) { + my $length = $_; + $length =~ s/^.*[^0-9]([0-9]?)/\1/; + $tests_by_length{$length} = $_; +} +my @sorted_test_names = sort(keys(%tests_by_length)); +my @lengthsorted_tests; +for ( @sorted_test_names ) { + push @lengthsorted_tests, $tests_by_length{$_}; +} + +if ( $verbose ) { + print STDERR "test names, sorted by length:\n"; + for ( @lengthsorted_tests ) { + print STDERR "\t$_: $lengthsorted_tests{$_}\n"; + } +} + + +################################################################### +# Scan log files to collect all the timers. +# Store them in %times, which maps test_name+timer_name to +# the timer value. +################################################################### +my %times; +$ExtractSAMRAITimers::debug = $debug; +ExtractSAMRAITimers::extract_timers( \@nprocs, \@logs, \@test_names, \%times ); + + + +################################################################### +# Write the output file. +# One paragraph for each test. +################################################################### + +# Compose the table headings string. +my $table_heading = "length"; +for ( @nprocs ) { + $table_heading = "${table_heading}\t$_-proc"; +} + +$,=''; + +for $itimer (0 .. $#timers) { + # Each chart is for a timer + + print "$timers[$itimer]\n"; + print "up-and-down time\n"; # Unused, but needed. + print "$table_heading\n"; + + for ( @lengthsorted_tests ) { + # Each datum is a message length + + $itest = 0; + while ( $test_names[$itest] ne $_ ) { ++$itest; } + my $length = $_; + $length =~ s/^.*[^0-9]([0-9]?)/\1/; + print $length; + + for $inproc (0 .. $#nprocs) { + # Each line is for an nproc + + my $value = defined($times{"$itest:$timers[$itimer]"}[$inproc]) ? + $times{"$itest:$timers[$itimer]"}[$inproc] : 'x'; + print "\t$value"; + } + print "\n"; + + } + print "\n"; + +} + +# The data section should have paragraphs delinineated by blank lines. +# First line in each paragraph is the header. If header is commented +# out, skip paragraph. Each following line in paragraph is a timer +# name. If timer name is commented out, skip that timer. If the +# timer name is followed by and a string, use the timer, but +# substitute the string for timer name. + +__DATA__ +All timers +# +apps::main::repetitions Repetition loop diff --git a/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_tests.pl b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_tests.pl new file mode 100755 index 00000000..c10df8c2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/TreeCommunication/write_time_vs_nproc_for_single_tests.pl @@ -0,0 +1,166 @@ +#!/usr/bin/env perl + +# Build a tab-delineated summary table of timings for plotting time vs nproc +# using plot-samrai-timers. + + +use ExtractSAMRAITimers; + + +require Getopt::Long; +my $raw; +Getopt::Long::GetOptions( 'help' => \$help + , 'verbose' => \$verbose + , 'debug' => \$debug + , 'raw' => \$raw + ); + +my $script_name = `basename $0`; chop $script_name; + +if ( $help ) { + print <<_EOM_; + +Usage: $script_name [options] + +Log files must be of the form *-.log* +Each log file name is parsed to find its corresponding nproc. +The same set of TreeCommunication benchmark tests must appear +in all the log files, in the same order. (They must all be +generated using the same input files.) + +Options: + + --raw + Use raw values instead of normalizing by number of repetitions. + +_EOM_ + exit(0); +} + +$ExtractSAMRAITimers::verbose = $verbose; +$ExtractSAMRAITimers::debug = $debug; + +my @logs = @ARGV; +die "No log files specified" if @logs == 0; + +my @nprocs = ExtractSAMRAITimers::get_nprocs_from_log_names(@logs); +$,=' '; +print STDERR ("nprocs:", @nprocs, "\n") if $verbose; +$,=''; + +$, = "\t"; + + +################################################################### +# Suck in all the timer sections. +################################################################### + +$/ = "\n\n"; +my @timerparagraphs; +if (defined $timerfile) { + open( TIMERFILE, "< $timerfile" ) || die "Cannot open file $timerfile"; + @timerparagraphs = ; + close TIMERFILE || die "Cannot close $timerfile"; +} +else { + @timerparagraphs = ; +} +$/ = "\n"; +my ($section_name, $timers_, %timer_label) = + ExtractSAMRAITimers::parse_timer_selection($timerparagraphs[0]); +my @timers = @$timers_; + + + +################################################################### +# Scan first log file to determine number of tests. +# We have to require that the same tests appear in all logs. +# Store the (nick)names in @test_names. +################################################################### +my @test_names; +open (LOG, $logs[0]) || die "Cannot open $logs[0]"; +while ( $_ = ) { + if ( /^Starting test Test([0-9]+) \((.*)\)$/ ) { + $test_names[$1] = $2; + } +} +close LOG; +if ( $verbose ) { + print STDERR "test names:\n"; + for ( 0..$#test_names ) { + print STDERR "\t$_: $test_names[$_]\n"; + } +} + + +################################################################### +# Scan log files to collect all the timers. +# Store them in %times, which maps test_name+timer_name to +# the timer value. +################################################################### +my %times; +ExtractSAMRAITimers::extract_timers( \@nprocs, \@logs, \@test_names, \%times ); + + + +################################################################### +# Write the output file. +# One paragraph for each test. +################################################################### + +# Compose the table headings string. +my $table_heading = "nproc"; +for ( 0 .. $#timers ) { + $table_heading = "${table_heading}\t$timer_label{$timers[$_]}"; +} + +$,=''; + +for $itest (0 .. $#test_names) { + # Each chart is for a named test + + print "$test_names[$itest]\n"; + print "timer*nproc:\n"; # Unused, but needed. + print "$table_heading\n"; + + for $inproc (0 .. $#nprocs) { + # Each datum is for an nproc + + print $nprocs[$inproc]; + for $itimer (0 .. $#timers) { + # Each line is for a timer. + my $value = defined($times{"$itest:$timers[$itimer]"}[$inproc]) ? + $times{"$itest:$timers[$itimer]"}[$inproc] : 'x'; + print "\t$value"; + } + print "\n"; + + } + print "\n"; + +} + +# The data section should have paragraphs delinineated by blank lines. +# First line in each paragraph is the header. If header is commented +# out, skip paragraph. Each following line in paragraph is a timer +# name. If timer name is commented out, skip that timer. If the +# timer name is followed by and a string, use the timer, but +# substitute the string for timer name. + +__DATA__ +All timers +# +apps::main::repetitions Repetition loop +# +apps::main::parent_send Parent send +apps::main::parent_recv Parent receive +apps::main::parent_wait Parent wait +# +apps::main::child_send Child send +apps::main::child_recv Child receive +apps::main::child_wait Child wait +# +apps::main::verify Verify data +apps::main::processing Process data +# +apps::main::equiv_MPI MPI equivalent diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.depend index 0495fe07..be173146 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,6 +14,7 @@ FILE_0=MblkGeometry.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ @@ -22,6 +23,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ @@ -35,6 +37,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -54,7 +60,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -66,17 +72,17 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MblkGeometry.C \ MblkGeometry.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -84,16 +90,21 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} -FILE_1=MblkHyperbolicLevelIntegrator.o +${FILE_0}: ${DEPENDS_0} + +FILE_1=MblkLinAdv.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -114,6 +125,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ @@ -126,26 +139,35 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ @@ -154,47 +176,51 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleInjection.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ @@ -204,62 +230,60 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchInteriorVariableFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.C MblkHyperbolicLevelIntegrator.h \ - MblkHyperbolicPatchStrategy.h + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h \ + $(TESTLIBDIR)/SkeletonBoundaryUtilities2.h \ + $(TESTLIBDIR)/SkeletonBoundaryUtilities3.h \ + $(TESTLIBDIR)/SkeletonCellDoubleConservativeLinearRefine.h \ + $(TESTLIBDIR)/SkeletonCellDoubleWeightedAverage.h MblkGeometry.h\ + MblkLinAdv.C MblkLinAdv.h \ + SkeletonOutersideDoubleWeightedAverage.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=MblkHyperbolicPatchStrategy.o +${FILE_1}: ${DEPENDS_1} + +FILE_2=SkeletonOutersideDoubleWeightedAverage.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ @@ -270,27 +294,28 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -299,45 +324,44 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicPatchStrategy.C MblkHyperbolicPatchStrategy.h + SkeletonOutersideDoubleWeightedAverage.C \ + SkeletonOutersideDoubleWeightedAverage.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} -FILE_3=MblkLinAdv.o +${FILE_2}: ${DEPENDS_2} + +FILE_3=main.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -347,6 +371,7 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -358,7 +383,10 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -370,30 +398,34 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TileClustering.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleLinearTimeInterpolateOp.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ @@ -409,8 +441,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleInjection.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDoubleLinearTimeInterpolateOp.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ @@ -423,10 +453,8 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -443,9 +471,9 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -469,18 +497,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h MblkGeometry.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - MblkLinAdv.C MblkLinAdv.h SkeletonBoundaryUtilities2.h \ - SkeletonBoundaryUtilities3.h \ - SkeletonCellDoubleConservativeLinearRefine.h \ - SkeletonCellDoubleWeightedAverage.h \ - SkeletonOutersideDoubleWeightedAverage.h + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + $(TESTLIBDIR)/MblkHyperbolicLevelIntegrator.h \ + $(TESTLIBDIR)/MblkHyperbolicPatchStrategy.h \ + $(TESTLIBDIR)/SkeletonCellDoubleConservativeLinearRefine.h \ + $(TESTLIBDIR)/SkeletonCellDoubleWeightedAverage.h MblkGeometry.h\ + MblkLinAdv.h SkeletonOutersideDoubleWeightedAverage.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ @@ -498,829 +523,9 @@ DEPENDS_3 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} - -FILE_4=Pointer-MblkHyperbolicLevelIntegrator.o -DEPENDS_4:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - Pointer-MblkHyperbolicLevelIntegrator.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} - -FILE_5=Pointer-SkeletonCellDoubleConservativeLinearRefine.o -DEPENDS_5:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonCellDoubleConservativeLinearRefine.C \ - SkeletonCellDoubleConservativeLinearRefine.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} -FILE_6=Pointer-SkeletonCellDoubleWeightedAverage.o -DEPENDS_6:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonCellDoubleWeightedAverage.C \ - SkeletonCellDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_6 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_6:X.o=${NDIM}.o}: ${DEPENDS_6} - -FILE_7=Pointer-SkeletonOutersideDoubleWeightedAverage.o -DEPENDS_7:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - Pointer-SkeletonOutersideDoubleWeightedAverage.C \ - SkeletonOutersideDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_7 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_7:X.o=${NDIM}.o}: ${DEPENDS_7} - -FILE_8=SkeletonBoundaryUtilities2.o -DEPENDS_8:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonBoundaryUtilities2.C SkeletonBoundaryUtilities2.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_8 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_8:X.o=${NDIM}.o}: ${DEPENDS_8} - -FILE_9=SkeletonBoundaryUtilities3.o -DEPENDS_9:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonBoundaryUtilities3.C SkeletonBoundaryUtilities3.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_9 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_9:X.o=${NDIM}.o}: ${DEPENDS_9} - -FILE_10=SkeletonCellDoubleConservativeLinearRefine.o -DEPENDS_10:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonCellDoubleConservativeLinearRefine.C \ - SkeletonCellDoubleConservativeLinearRefine.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_10 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_10:X.o=${NDIM}.o}: ${DEPENDS_10} - -FILE_11=SkeletonCellDoubleWeightedAverage.o -DEPENDS_11:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonCellDoubleWeightedAverage.C \ - SkeletonCellDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_11 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_11:X.o=${NDIM}.o}: ${DEPENDS_11} - -FILE_12=SkeletonOutersideDoubleWeightedAverage.o -DEPENDS_12:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - SkeletonOutersideDoubleWeightedAverage.C \ - SkeletonOutersideDoubleWeightedAverage.h - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_12 +=\ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_12:X.o=${NDIM}.o}: ${DEPENDS_12} - -FILE_13=main.o -DEPENDS_13:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ - $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ - $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ - $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/InputManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h MblkGeometry.h \ - MblkHyperbolicLevelIntegrator.h MblkHyperbolicPatchStrategy.h \ - MblkLinAdv.h SkeletonCellDoubleConservativeLinearRefine.h \ - SkeletonCellDoubleWeightedAverage.h \ - SkeletonOutersideDoubleWeightedAverage.h main.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_13 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_13:X.o=${NDIM}.o}: ${DEPENDS_13} +${FILE_3}: ${DEPENDS_3} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.in index 519bef38..a2f9ee0b 100755 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Makefile.in @@ -1,10 +1,10 @@ ######################################################################### ## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for linear advection sample application +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Multiblock performance tests. ## ######################################################################### @@ -14,144 +14,112 @@ SUBDIR = source/test/performance/multiblock VPATH = @srcdir@ TESTTOOLS = ../../testtools OBJECT = ../../../.. +REPORT = $(OBJECT)/report.xml +TESTLIBDIR = $(OBJECT)/source/test/testlib +TESTLIB = $(TESTLIBDIR)/libSAMRAI_test$(LIB_SUFFIX) default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DTESTING=0 +SUBDIRS = fortran -NUM_TESTS = 8 +CPPFLAGS_EXTRA= + +NUM_TESTS = 0 TEST_NPROCS = @TEST_NPROCS@ -CXX_OBJS = MblkGeometry.o main.o MblkLinAdv.o MblkHyperbolicLevelIntegrator.o \ - MblkHyperbolicPatchStrategy.o Pointer-MblkHyperbolicLevelIntegrator.o \ - SkeletonCellDoubleConservativeLinearRefine.o Pointer-SkeletonCellDoubleConservativeLinearRefine.o \ - SkeletonCellDoubleWeightedAverage.o Pointer-SkeletonCellDoubleWeightedAverage.o \ - SkeletonOutersideDoubleWeightedAverage.o Pointer-SkeletonOutersideDoubleWeightedAverage.o \ - SkeletonBoundaryUtilities2.o \ - SkeletonBoundaryUtilities3.o +CXX_OBJS = MblkGeometry.o main.o MblkLinAdv.o \ + SkeletonOutersideDoubleWeightedAverage.o -F_OBJS = stufprobc.o trace1d.o trace2d.o trace3d.o grad2d.o grad3d.o flux2d.o flux3d.o fluxcorner3d.o stable2d.o stable3d.o init2d.o init3d.o upfluxsum2d.o skelbdry2d.o upfluxsum3d.o skelbdry3d.o +F_OBJS = fortran/stufprobc.o fortran/trace1d.o fortran/trace2d.o \ + fortran/trace3d.o fortran/grad2d.o fortran/grad3d.o \ + fortran/flux2d.o fortran/flux3d.o fortran/fluxcorner3d.o \ + fortran/stable2d.o fortran/stable3d.o fortran/init2d.o \ + fortran/init3d.o -main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ +main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) $(TESTLIB) + (cd $(TESTLIBDIR) && $(MAKE) library) || exit 1 + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) $(TESTLIB) \ $(LIBSAMRAI) $(LDLIBS) -o $@ -check: - $(MAKE) check3d - -check2d: - -check3d: main - @for i in test_inputs/*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done - -checkcompile: main - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile +# Prevents "No rule to make target" error. Built in the rule for main. +$(TESTLIB): -examples2d: +fortran/stufprobc.o: -examples3d: main - @for i in $(SRCDIR)/example_inputs/*.3d.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done +fortran/trace1d.o: -examples: - $(MAKE) examples2d - $(MAKE) examples3d +fortran/trace2d.o: -clean-check: - $(SAMCLEAN) +fortran/trace3d.o: -clean: - $(SAMCLEAN) - $(RM) *.f main viz* +fortran/grad2d.o: -redo: - $(RM) main +fortran/grad3d.o: -include $(SRCDIR)/Makefile.depend +fortran/flux2d.o: -FORTRAN = $(SRCDIR)/fortran -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +fortran/flux3d.o: -skelbdry2d.o: $(FORTRAN)/skelbdry2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/skelbdry2d.m4 > skelbdry2d.f - $(F77) $(FFLAGS) -c skelbdry2d.f -o $@ +fortran/fluxcorner3d.o: -upfluxsum2d.o: $(FORTRAN)/upfluxsum2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/upfluxsum2d.m4 > upfluxsum2d.f - $(F77) $(FFLAGS) -c upfluxsum2d.f -o $@ +fortran/stable2d.o: +fortran/stable3d.o: -skelbdry3d.o: $(FORTRAN)/skelbdry3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/skelbdry3d.m4 > skelbdry3d.f - $(F77) $(FFLAGS) -c skelbdry3d.f -o $@ +fortran/init2d.o: -upfluxsum3d.o: $(FORTRAN)/upfluxsum3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/upfluxsum3d.m4 > upfluxsum3d.f - $(F77) $(FFLAGS) -c upfluxsum3d.f -o $@ +fortran/init3d.o: -init2d.o: $(FORTRAN)/init2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init2d.m4 > init2d.f - $(F77) $(FFLAGS) -c init2d.f -o $@ - -init3d.o: $(FORTRAN)/init3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/init3d.m4 > init3d.f - $(F77) $(FFLAGS) -c init3d.f -o $@ +check: -flux2d.o: $(FORTRAN)/flux2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux2d.m4 > flux2d.f - $(F77) $(FFLAGS) -c flux2d.f -o $@ +checkcompile: main -flux3d.o: $(FORTRAN)/flux3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/flux3d.m4 > flux3d.f - $(F77) $(FFLAGS) -c flux3d.f -o $@ +checktest: + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -grad2d.o: $(FORTRAN)/grad2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad2d.m4 > grad2d.f - $(F77) $(FFLAGS) -c grad2d.f -o $@ +examples: -grad3d.o: $(FORTRAN)/grad3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/grad3d.m4 > grad3d.f - $(F77) $(FFLAGS) -c grad3d.f -o $@ +perf2d: main + @for i in performance_inputs/*.2d.*input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i}; \ + done -trace1d.o: $(FORTRAN)/trace1d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace1d.m4 > trace1d.f - $(F77) $(FFLAGS) -c trace1d.f -o $@ +perf3d: main + @for i in performance_inputs/*.3d.*input ; do \ + $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ + ./main $${i}; \ + done -trace2d.o: $(FORTRAN)/trace2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace2d.m4 > trace2d.f - $(F77) $(FFLAGS) -c trace2d.f -o $@ +perf: + $(MAKE) perf2d + $(MAKE) perf3d -trace3d.o: $(FORTRAN)/trace3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/trace3d.m4 > trace3d.f - $(F77) $(FFLAGS) -c trace3d.f -o $@ +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -stufprobc.o: $(FORTRAN)/stufprobc.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stufprobc.m4 > stufprobc.f - $(F77) $(FFLAGS) -c stufprobc.f -o $@ +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.timing* -stable2d.o: $(FORTRAN)/stable2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable2d.m4 > stable2d.f - $(F77) $(FFLAGS) -c stable2d.f -o $@ +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -stable3d.o: $(FORTRAN)/stable3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/stable3d.m4 > stable3d.f - $(F77) $(FFLAGS) -c stable3d.f -o $@ +redo: + $(RM) main -fluxcorner3d.o: $(FORTRAN)/fluxcorner3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/fluxcorner3d.m4 > fluxcorner3d.f - $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.C index 3804a633..fa9a268a 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.C @@ -3,13 +3,14 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: set geometry for multiblock domain * ************************************************************************/ #include "MblkGeometry.h" +#include "SAMRAI/hier/BaseGridGeometry.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/hier/Index.h" #include "SAMRAI/hier/IntVector.h" @@ -18,6 +19,8 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" +#include + #define POLY3(i, j, k, imin, jmin, kmin, nx, nxny) \ ((i - imin) + (j - jmin) * (nx) + (k - kmin) * (nxny)) @@ -32,23 +35,25 @@ MblkGeometry::MblkGeometry( const std::string& object_name, const tbox::Dimension& dim, - boost::shared_ptr input_db, - const int nblocks): + boost::shared_ptr& input_db, + boost::shared_ptr& grid_geom): + d_grid_geom(grid_geom), d_dim(dim) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); -#endif d_object_name = object_name; //tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); - d_nblocks = nblocks; + d_nblocks = static_cast(grid_geom->getNumberBlocks()); - d_metrics_set.resizeArray(10); - for (int i = 0; i < 10; i++) { - d_metrics_set[i] = false; + d_metrics_set.resize(10); + for (int i = 0; i < 10; ++i) { + d_metrics_set[i].resize(d_nblocks); + for (int b = 0; b < d_nblocks; ++b) { + d_metrics_set[i][b] = false; + } } /* @@ -60,6 +65,33 @@ MblkGeometry::MblkGeometry( } getFromInput(input_db, is_from_restart); + std::vector domain_boxes(d_nblocks); + for (int b = 0; b < d_nblocks; ++b) { + grid_geom->computePhysicalDomain(domain_boxes[b], + hier::IntVector::getOne(dim), + hier::BlockId(b)); + TBOX_ASSERT(domain_boxes[b].size() == 1); + } + + if (d_geom_problem == "CARTESIAN") { + for (int b = 0; b < d_nblocks; ++b) { + if (!d_metrics_set[0][b]) { + setCartesianMetrics(domain_boxes[b].front(), 0, b); + } + } + } + + if (d_geom_problem == "WEDGE") { + if (!d_metrics_set[0][0]) { + setWedgeMetrics(domain_boxes[0].front(), 0); + } + } + if (d_geom_problem == "SPHERICAL_SHELL") { + if (!d_metrics_set[0][0]) { + setSShellMetrics(domain_boxes[0].front(), 0); + } + } + } /* @@ -100,8 +132,8 @@ bool MblkGeometry::getRefineBoxes( const int level_number) { bool boxes_exist = false; - if (block_number < d_refine_boxes.getSize()) { - if (level_number < d_refine_boxes[level_number].getSize()) { + if (block_number < static_cast(d_refine_boxes.size())) { + if (level_number < static_cast(d_refine_boxes[level_number].size())) { boxes_exist = true; refine_boxes = d_refine_boxes[block_number][level_number]; } @@ -123,15 +155,14 @@ void MblkGeometry::tagOctantCells( const double regrid_time, const int refine_tag_val) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(d_geom_problem == "SPHERICAL_SHELL" && d_sshell_type == "OCTANT"); TBOX_ASSERT(temp_tags); -#endif boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); + TBOX_ASSERT(xyz); if (d_dim == tbox::Dimension(3)) { /* @@ -143,9 +174,9 @@ void MblkGeometry::tagOctantCells( + (regrid_time * d_tag_velocity) + (0.5 * d_tag_width); hier::Box pbox = patch.getBox(); - for (int k = pbox.lower(2); k <= pbox.upper(2) + 1; k++) { - for (int j = pbox.lower(1); j <= pbox.upper(1) + 1; j++) { - for (int i = pbox.lower(0); i <= pbox.upper(0) + 1; i++) { + for (int k = pbox.lower(2); k <= pbox.upper(2) + 1; ++k) { + for (int j = pbox.lower(1); j <= pbox.upper(1) + 1; ++j) { + for (int i = pbox.lower(0); i <= pbox.upper(0) + 1; ++i) { hier::Index ic(i, j, k); pdat::NodeIndex node(ic, pdat::NodeIndex::LLL); hier::Index icm1(i - 1, j - 1, k - 1); @@ -178,9 +209,7 @@ void MblkGeometry::getFromInput( { NULL_USE(is_from_restart); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif boost::shared_ptr db(input_db->getDatabase("MblkGeometry")); @@ -189,7 +218,7 @@ void MblkGeometry::getFromInput( bool found = false; int i, nb; char block_name[128]; - double temp_domain[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double temp_domain[SAMRAI::MAX_DIM_VAL]; /* * Cartesian geometry @@ -199,10 +228,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr cart_db( db->getDatabase("CartesianGeometry")); - d_cart_xlo.resizeArray(d_nblocks); - d_cart_xhi.resizeArray(d_nblocks); + d_cart_xlo.resize(d_nblocks); + d_cart_xhi.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (nb = 0; nb < d_nblocks; ++nb) { // xlo sprintf(block_name, "domain_xlo_%d", nb); @@ -212,9 +241,9 @@ void MblkGeometry::getFromInput( << "' domain_xlo for block " << nb << " not found in input." << std::endl); } - d_cart_xlo[nb].resizeArray(d_dim.getValue()); + d_cart_xlo[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xlo[nb][i] = temp_domain[i]; } @@ -226,9 +255,9 @@ void MblkGeometry::getFromInput( << "' domain_xhi for block " << nb << " not found in input." << std::endl); } - d_cart_xhi[nb].resizeArray(d_dim.getValue()); + d_cart_xhi[nb].resize(d_dim.getValue()); cart_db->getDoubleArray(block_name, temp_domain, d_dim.getValue()); - for (i = 0; i < d_dim.getValue(); i++) { + for (i = 0; i < d_dim.getValue(); ++i) { d_cart_xhi[nb][i] = temp_domain[i]; } @@ -244,10 +273,10 @@ void MblkGeometry::getFromInput( boost::shared_ptr wedge_db( db->getDatabase("WedgeGeometry")); - d_wedge_rmin.resizeArray(d_nblocks); - d_wedge_rmax.resizeArray(d_nblocks); + d_wedge_rmin.resize(d_nblocks); + d_wedge_rmax.resize(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + for (nb = 0; nb < d_nblocks; ++nb) { // rmin sprintf(block_name, "rmin_%d", nb); @@ -337,8 +366,8 @@ void MblkGeometry::getFromInput( /* * Block rotation */ - d_block_rotation.resizeArray(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + d_block_rotation.resize(d_nblocks); + for (nb = 0; nb < d_nblocks; ++nb) { d_block_rotation[nb] = 0; sprintf(block_name, "rotation_%d", nb); if (db->keyExists(block_name)) { @@ -359,24 +388,26 @@ void MblkGeometry::getFromInput( * would specify the refinement region on block 2, level 0. * */ - d_refine_boxes.resizeArray(d_nblocks); - for (nb = 0; nb < d_nblocks; nb++) { + d_refine_boxes.resize(d_nblocks); + for (nb = 0; nb < d_nblocks; ++nb) { // see what the max number of levels is int max_ln = 0; int ln; - for (ln = 0; ln < 10; ln++) { + for (ln = 0; ln < 10; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - max_ln++; + ++max_ln; } } - d_refine_boxes[nb].resizeArray(max_ln); + d_refine_boxes[nb].resize(max_ln); - for (ln = 0; ln < max_ln; ln++) { + for (ln = 0; ln < max_ln; ++ln) { sprintf(block_name, "refine_boxes_%d_%d", nb, ln); if (db->keyExists(block_name)) { - d_refine_boxes[nb][ln] = db->getDatabaseBoxArray(block_name); + std::vector db_box_vector = + db->getDatabaseBoxVector(block_name); + d_refine_boxes[nb][ln] = db_box_vector; } else { TBOX_ERROR( d_object_name << ": input entry `" @@ -405,9 +436,10 @@ void MblkGeometry::buildGridOnPatch( { if (d_geom_problem == "CARTESIAN") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setCartesianMetrics(domain, - level_number); + level_number, + block_number); } buildCartesianGridOnPatch(patch, xyz_id, @@ -416,7 +448,7 @@ void MblkGeometry::buildGridOnPatch( } if (d_geom_problem == "WEDGE") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setWedgeMetrics(domain, level_number); } @@ -427,7 +459,7 @@ void MblkGeometry::buildGridOnPatch( } if (d_geom_problem == "SPHERICAL_SHELL") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setSShellMetrics(domain, level_number); } @@ -451,49 +483,53 @@ void MblkGeometry::buildGridOnPatch( void MblkGeometry::getDx( const hier::Box& domain, const int level_number, + const int block_number, double* dx) { if (d_geom_problem == "CARTESIAN") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setCartesianMetrics(domain, - level_number); + level_number, + block_number); } } if (d_geom_problem == "WEDGE") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setWedgeMetrics(domain, level_number); } } if (d_geom_problem == "SPHERICAL_SHELL") { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { setSShellMetrics(domain, level_number); } } getDx(level_number, + block_number, dx); } void MblkGeometry::getDx( const int level_number, + const int block_number, double* dx) { - if (!d_metrics_set[level_number]) { + if (!d_metrics_set[level_number][block_number]) { TBOX_ERROR( d_object_name << ":metrics have not been set.\n" << "Use the alternative 'getDx()' method call that " << "takes in the domain." << std::endl); } - for (int i = 0; i < d_dim.getValue(); i++) { - dx[i] = d_dx[level_number][i]; + for (int i = 0; i < d_dim.getValue(); ++i) { + dx[i] = d_dx[level_number][block_number][i]; } } @@ -523,29 +559,31 @@ int MblkGeometry::getBlockRotation( void MblkGeometry::setCartesianMetrics( const hier::Box& domain, - const int level_number) + const int level_number, + const int block_number) { + if (d_metrics_set[level_number][block_number]) return; + hier::Index lower(domain.lower()); hier::Index upper(domain.upper()); hier::Index diff(upper - lower + hier::Index(lower.getDim(), 1)); - if (d_dx.getSize() < (level_number + 1)) { - d_dx.resizeArray(level_number + 1); + if (static_cast(d_dx.size()) < (level_number + 1)) { + d_dx.resize(level_number + 1); } - if (d_dx[level_number].getSize() < d_dim.getValue()) { - d_dx[level_number].resizeArray(d_dim.getValue()); + if (static_cast(d_dx[level_number].size()) < d_nblocks) { + d_dx[level_number].resize(d_nblocks); + } + if (static_cast(d_dx[level_number][block_number].size()) < d_dim.getValue()) { + d_dx[level_number][block_number].resize(d_dim.getValue()); } - /* - * Compute dx from first grid geometry block only. Its assumed - * to be uniform across the multiple blocks. - */ - for (int i = 0; i < d_dim.getValue(); i++) { - d_dx[level_number][i] = - (d_cart_xhi[0][i] - d_cart_xlo[0][i]) / (double)diff(i); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_dx[level_number][block_number][i] = + (d_cart_xhi[block_number][i] - d_cart_xlo[block_number][i]) / (double)diff(i); } - d_metrics_set[level_number] = true; + d_metrics_set[level_number][block_number] = true; } @@ -565,36 +603,35 @@ void MblkGeometry::buildCartesianGridOnPatch( { boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif - pdat::NodeIterator niend(patch.getBox(), false); - for (pdat::NodeIterator ni(patch.getBox(), true); ni != niend; ++ni) { + pdat::NodeIterator niend(pdat::NodeGeometry::end(patch.getBox())); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(patch.getBox())); + ni != niend; ++ni) { pdat::NodeIndex node = *ni; if (d_block_rotation[block_number] == 0) { (*xyz)(node, 0) = - d_cart_xlo[block_number][0] + node(0) * d_dx[level_number][0]; + d_cart_xlo[block_number][0] + node(0) * d_dx[level_number][block_number][0]; (*xyz)(node, 1) = - d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][1]; + d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][block_number][1]; if (d_dim == tbox::Dimension(3)) { (*xyz)(node, 2) = - d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][2]; + d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][block_number][2]; } } if (d_block_rotation[block_number] == 1) { // I sideways, J down (*xyz)(node, 0) = - d_cart_xlo[block_number][0] - node(0) * d_dx[level_number][0]; + d_cart_xlo[block_number][0] - node(0) * d_dx[level_number][block_number][0]; (*xyz)(node, 1) = - d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][1]; + d_cart_xlo[block_number][1] + node(1) * d_dx[level_number][block_number][1]; if (d_dim == tbox::Dimension(3)) { (*xyz)(node, 2) = - d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][2]; + d_cart_xlo[block_number][2] + node(2) * d_dx[level_number][block_number][2]; } } @@ -614,24 +651,25 @@ void MblkGeometry::setWedgeMetrics( const hier::Box& domain, const int level_number) { - + int b = domain.getBlockId().getBlockValue(); // // Set dx (dr, dth, dz) for the level // - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(d_dim.getValue()); + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_nblocks); + d_dx[level_number][b].resize(d_dim.getValue()); double nr = (domain.upper(0) - domain.lower(0) + 1); double nth = (domain.upper(1) - domain.lower(1) + 1); - d_dx[level_number][0] = (d_wedge_rmax[0] - d_wedge_rmin[0]) / nr; - d_dx[level_number][1] = (d_wedge_thmax - d_wedge_thmin) / nth; + d_dx[level_number][b][0] = (d_wedge_rmax[0] - d_wedge_rmin[0]) / nr; + d_dx[level_number][b][1] = (d_wedge_thmax - d_wedge_thmin) / nth; if (d_dim == tbox::Dimension(3)) { double nz = (domain.upper(2) - domain.lower(2) + 1); - d_dx[level_number][2] = (d_wedge_zmax - d_wedge_zmin) / nz; + d_dx[level_number][b][2] = (d_wedge_zmax - d_wedge_zmin) / nz; } - d_metrics_set[level_number] = true; + d_metrics_set[level_number][b] = true; } /* @@ -650,8 +688,8 @@ void MblkGeometry::buildWedgeGridOnPatch( { boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); TBOX_ASSERT(xyz); @@ -669,21 +707,21 @@ void MblkGeometry::buildWedgeGridOnPatch( int nd_nxny = nd_nx * nd_ny; //int nd_nel = nd_nx*nd_ny*nd_nz; - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - dx[0] = d_dx[level_number][0]; - dx[1] = d_dx[level_number][1]; + double dx[SAMRAI::MAX_DIM_VAL]; + dx[0] = d_dx[level_number][block_number][0]; + dx[1] = d_dx[level_number][block_number][1]; double* x = xyz->getPointer(0); double* y = xyz->getPointer(1); int nd_kmin; int nd_kmax; - dx[2] = d_dx[level_number][2]; - double* z = NULL; + dx[2] = d_dx[level_number][block_number][2]; + double* z = 0; if (d_dim == tbox::Dimension(3)) { nd_kmin = ifirst(2) - nghost_cells(2); nd_kmax = ilast(2) + 1 + nghost_cells(2); - dx[2] = d_dx[level_number][2]; + dx[2] = d_dx[level_number][block_number][2]; z = xyz->getPointer(2); } else { nd_kmin = 0; @@ -694,9 +732,9 @@ void MblkGeometry::buildWedgeGridOnPatch( // ----------- set the wedge nodal positions // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { - for (int i = nd_imin; i <= nd_imax; i++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, nd_imin, nd_jmin, nd_kmin, nd_nx, nd_nxny); @@ -730,12 +768,13 @@ void MblkGeometry::setSShellMetrics( const hier::Box& domain, const int level_number) { - + int b = domain.getBlockId().getBlockValue(); // // Set dx (drad, dth, dphi) for the level // - d_dx.resizeArray(level_number + 1); - d_dx[level_number].resizeArray(d_dim.getValue()); + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_nblocks); + d_dx[level_number][b].resize(d_dim.getValue()); double nrad = (domain.upper(0) - domain.lower(0) + 1); double nth = (domain.upper(1) - domain.lower(1) + 1); @@ -749,18 +788,18 @@ void MblkGeometry::setSShellMetrics( */ if (d_sshell_type == "SOLID") { - d_dx[level_number][0] = (d_sshell_rmax - d_sshell_rmin) / nrad; - d_dx[level_number][1] = + d_dx[level_number][b][0] = (d_sshell_rmax - d_sshell_rmin) / nrad; + d_dx[level_number][b][1] = 2.0 * tbox::MathUtilities::Abs(d_sangle_thmin) / nth; if (d_dim == tbox::Dimension(3)) { - d_dx[level_number][2] = + d_dx[level_number][b][2] = 2.0 * tbox::MathUtilities::Abs(d_sangle_thmin) / nphi; } } else { - d_dx[level_number][0] = 0.0001; - d_dx[level_number][1] = 0.0001; + d_dx[level_number][b][0] = 0.0001; + d_dx[level_number][b][1] = 0.0001; if (d_dim == tbox::Dimension(3)) { - d_dx[level_number][2] = 0.0001; + d_dx[level_number][b][2] = 0.0001; } } @@ -769,7 +808,7 @@ void MblkGeometry::setSShellMetrics( * computeUnitSphereOctant() method so all we do here is allocate * space for d_dx. */ - d_metrics_set[level_number] = true; + d_metrics_set[level_number][0] = true; } /* @@ -795,12 +834,10 @@ void MblkGeometry::buildSShellGridOnPatch( } boost::shared_ptr > xyz( - patch.getPatchData(xyz_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(xyz_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(xyz); -#endif if (d_dim == tbox::Dimension(3)) { @@ -843,11 +880,11 @@ void MblkGeometry::buildSShellGridOnPatch( */ if (d_sshell_type == "SOLID") { - d_dx[level_number][0] = (d_sshell_rmax - d_sshell_rmin) / (double)nrad; - d_dx[level_number][1] = + d_dx[level_number][block_number][0] = (d_sshell_rmax - d_sshell_rmin) / (double)nrad; + d_dx[level_number][block_number][1] = 2.0 * tbox::MathUtilities::Abs(d_sangle_thmin) / (double)nth; - d_dx[level_number][2] = + d_dx[level_number][block_number][2] = 2.0 * tbox::MathUtilities::Abs(d_sangle_thmin) / (double)nphi; @@ -855,17 +892,17 @@ void MblkGeometry::buildSShellGridOnPatch( // step in a radial direction in x and set y and z appropriately // for a solid angle we go -th to th and -phi to phi // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { - double theta = d_sangle_thmin + j * d_dx[level_number][1]; // dx used for dth - double phi = d_sangle_thmin + k * d_dx[level_number][2]; + double theta = d_sangle_thmin + j * d_dx[level_number][block_number][1]; // dx used for dth + double phi = d_sangle_thmin + k * d_dx[level_number][block_number][2]; double xface = cos(theta) * cos(phi); double yface = sin(theta) * cos(phi); double zface = sin(phi); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, @@ -876,7 +913,7 @@ void MblkGeometry::buildSShellGridOnPatch( nd_nx, nd_nxny); - double r = d_sshell_rmin + d_dx[level_number][0] * (i); + double r = d_sshell_rmin + d_dx[level_number][block_number][0] * (i); double xx = r * xface; double yy = r * yface; @@ -905,8 +942,8 @@ void MblkGeometry::buildSShellGridOnPatch( // the block we are in. This is contained in the dispOctant.m // matlab code. // - for (int k = nd_kmin; k <= nd_kmax; k++) { - for (int j = nd_jmin; j <= nd_jmax; j++) { + for (int k = nd_kmin; k <= nd_kmax; ++k) { + for (int j = nd_jmin; j <= nd_jmax; ++j) { // // compute the position on the unit sphere for our radial line @@ -915,7 +952,7 @@ void MblkGeometry::buildSShellGridOnPatch( computeUnitSphereOctant(block_number, nth, j, k, &xface, &yface, &zface); - for (int i = nd_imin; i <= nd_imax; i++) { + for (int i = nd_imin; i <= nd_imax; ++i) { int ind = POLY3(i, j, k, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.h index 03886a1e..0eccab48 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkGeometry.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: set geometry for multiblock domain * ************************************************************************/ @@ -13,14 +13,13 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/hier/Patch.h" #include "SAMRAI/tbox/Serializable.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -40,8 +39,8 @@ class MblkGeometry MblkGeometry( const std::string& object_name, const tbox::Dimension& dim, - boost::shared_ptr input_db, - const int nblocks); + boost::shared_ptr& input_db, + boost::shared_ptr& grid_geom); ~MblkGeometry(); @@ -82,11 +81,13 @@ class MblkGeometry getDx( const hier::Box& domain, const int level_number, + const int block_number, double* dx); void getDx( const int level_number, + const int block_number, double* dx); /*! @@ -122,7 +123,8 @@ class MblkGeometry void setCartesianMetrics( const hier::Box& domain, - const int level_number); + const int level_number, + const int block_number); void buildCartesianGridOnPatch( @@ -166,7 +168,7 @@ class MblkGeometry * For the spherical shell construction, i always points in the r direction * and j,k are points on the shell. Given a certain j,k compute the * unit sphere locations for block face (actual xyz is computed - * by x = r*xface, y = r*yface, z = r*zface. Note that the dimension + * by x = r*xface, y = r*yface, z = r*zface. Note that the size * in the theta direction (nth) should be the same for each block. */ void @@ -185,6 +187,8 @@ class MblkGeometry std::string d_geom_problem; std::string d_object_name; + boost::shared_ptr d_grid_geom; + const tbox::Dimension d_dim; /* @@ -192,25 +196,25 @@ class MblkGeometry * up a multiblock mesh. */ int d_nblocks; - tbox::Array d_metrics_set; + std::vector > d_metrics_set; /* * The grid spacing. For cartesian, d_dx = (dx,dy,dz). For wedge, * d_dx = (dr, dth, dz). For spherical shell, d_dx = (dr, dth, dphi) */ - tbox::Array > d_dx; + std::vector > > d_dx; /* * Cartesian inputs */ - tbox::Array > d_cart_xlo; - tbox::Array > d_cart_xhi; + std::vector > d_cart_xlo; + std::vector > d_cart_xhi; /* * Wedge inputs */ - tbox::Array d_wedge_rmin; - tbox::Array d_wedge_rmax; + std::vector d_wedge_rmin; + std::vector d_wedge_rmax; double d_wedge_thmin; double d_wedge_thmax; double d_wedge_zmin; @@ -238,12 +242,12 @@ class MblkGeometry /* * Specify block rotation. */ - tbox::Array d_block_rotation; + std::vector d_block_rotation; /* * Refine boxes for different blocks/levels */ - tbox::Array > d_refine_boxes; + std::vector > d_refine_boxes; }; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 3dedd2c7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,2706 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include -#include -#include -using namespace std; -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/PatchDataFactory.h" -#include "SAMRAI/hier/VariableDatabase.h" -#include "SAMRAI/pdat/FaceData.h" -#include "SAMRAI/pdat/FaceDataFactory.h" -#include "SAMRAI/pdat/FaceVariable.h" -#include "SAMRAI/pdat/OuterfaceData.h" -#include "SAMRAI/pdat/OuterfaceVariable.h" -#include "SAMRAI/pdat/OutersideData.h" -#include "SAMRAI/pdat/OutersideVariable.h" -#include "SAMRAI/pdat/SideData.h" -#include "SAMRAI/pdat/SideDataFactory.h" -#include "SAMRAI/pdat/SideVariable.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/RestartManager.h" -#include "SAMRAI/tbox/TimerManager.h" -#include "SAMRAI/tbox/Timer.h" -#include "SAMRAI/tbox/Utilities.h" -#include "SAMRAI/tbox/MathUtilities.h" -#include "SAMRAI/xfer/CoarsenSchedule.h" -#include "SAMRAI/xfer/PatchInteriorVariableFillPattern.h" - -//#define RECORD_STATS -#undef RECORD_STATS -#ifdef RECORD_STATS -#include "SAMRAI/tbox/Statistic.h" -#include "SAMRAI/tbox/Statistician.h" -#endif - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in flux - * synchronization process between hierarchy levels. - * - ************************************************************************* - */ - -extern "C" { -// in upfluxsum.m4: - -void F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const double *, double *); - -void F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -void F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const int&, - const double *, double *); -} - -#ifndef NULL -#define NULL (0) -#endif - -#define ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION (3) - -using namespace SAMRAI; -using namespace algs; - -/* - ************************************************************************* - * - * This constructor sets the HyperbolicPatchStrategy pointer and - * initializes integration parameters to default values. Communication - * algorithms are created here too. Other data members are read in - * from the input database or from the restart database corresponding - * to the specified object_name. - * - ************************************************************************* - */ - -MblkHyperbolicLevelIntegrator::MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - boost::shared_ptr mblk_hierarchy, - bool register_for_restart, - bool use_time_refinement): - d_patch_strategy(patch_strategy), - d_object_name(object_name), - d_dim(dim), - d_use_time_refinement(use_time_refinement), - d_registered_for_restart(register_for_restart), - d_cfl(tbox::MathUtilities::getSignalingNaN()), - d_cfl_init(tbox::MathUtilities::getSignalingNaN()), - d_lag_dt_computation(true), - d_use_ghosts_for_dt(false), - d_flux_is_face(true), - d_flux_face_registered(false), - d_flux_side_registered(false), - d_mblk_bdry_fill_advance(new xfer::RefineAlgorithm(d_dim)), - d_mblk_bdry_fill_advance_new(new xfer::RefineAlgorithm(d_dim)), - d_mblk_bdry_fill_advance_old(new xfer::RefineAlgorithm(d_dim)), - d_mblk_coarsen_fluxsum(new xfer::CoarsenAlgorithm(d_dim)), - d_mblk_coarsen_sync_data(new xfer::CoarsenAlgorithm(d_dim)), - d_mblk_sync_initial_data(new xfer::CoarsenAlgorithm(d_dim)), - d_coarsen_rich_extrap_init(new xfer::CoarsenAlgorithm(dim)), - d_coarsen_rich_extrap_final(new xfer::CoarsenAlgorithm(dim)), - d_mblk_fill_new_level(new xfer::RefineAlgorithm(d_dim)), - d_number_time_data_levels(2), - d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")), - d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_new(hier::VariableDatabase::getDatabase()->getContext("NEW")), - d_plot_context(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), - d_have_flux_on_level_zero(false), - d_distinguish_mpi_reduction_costs(false), - t_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_comm")), - t_error_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_create")), - t_error_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_comm")), - t_mpi_reductions(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::mpi_reductions")), - t_initialize_level_data(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::initializeLevelData()")), - t_fill_new_level_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_create")), - t_fill_new_level_comm(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_comm")), - t_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_create")), - t_new_advance_bdry_fill_create(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_create")), - t_apply_gradient_detector(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::applyGradientDetector()")), - t_coarsen_rich_extrap(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_rich_extrap")), - t_get_level_dt(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()")), - t_get_level_dt_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()_sync")), - t_advance_level(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()")), - t_new_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_comm")), - t_patch_num_kernel(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::patch_numerical_kernels")), - t_advance_level_sync(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()_sync")), - t_std_level_sync(tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::standardLevelSynchronization()")), - t_sync_new_levels(tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::synchronizeNewLevels()")) -{ - NULL_USE(mblk_hierarchy); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(input_db); - TBOX_ASSERT(patch_strategy != ((MblkHyperbolicPatchStrategy *)NULL)); -#endif - - if (d_registered_for_restart) { - tbox::RestartManager::getManager()-> - registerRestartItem(d_object_name, this); - } - - /* - * Default parameter values. - */ - d_number_time_data_levels = 2; - - d_flux_is_face = true; - d_flux_face_registered = false; - d_flux_side_registered = false; - - d_have_flux_on_level_zero = false; - - d_lag_dt_computation = true; - d_use_ghosts_for_dt = false; - d_distinguish_mpi_reduction_costs = false; - - d_cfl = tbox::MathUtilities::getSignalingNaN(); - d_cfl_init = tbox::MathUtilities::getSignalingNaN(); - - /* - * Communication algorithms. - */ - // "regular" single hierarchy Coarsen/Refine algs - d_coarsen_rich_extrap_init.reset(new xfer::CoarsenAlgorithm(dim)); - d_coarsen_rich_extrap_final.reset(new xfer::CoarsenAlgorithm(dim)); - - // multi-block versions of Coarsen/Refine algs - d_mblk_bdry_fill_advance.reset( - new xfer::RefineAlgorithm(d_dim)); - d_mblk_bdry_fill_advance_new.reset( - new xfer::RefineAlgorithm(d_dim)); - d_mblk_bdry_fill_advance_old.reset( - new xfer::RefineAlgorithm(d_dim)); - d_mblk_fill_new_level.reset( - new xfer::RefineAlgorithm(d_dim)); - d_mblk_coarsen_fluxsum.reset( - new xfer::CoarsenAlgorithm(d_dim)); - d_mblk_coarsen_sync_data.reset( - new xfer::CoarsenAlgorithm(d_dim)); - d_mblk_sync_initial_data.reset( - new xfer::CoarsenAlgorithm(d_dim)); - - /* - * hier::Variable contexts used in algorithm. Note that "OLD" context - * is only created and used in the case of Richardson extrapolation - * and a refinement ratio of 3 (see registerModelVariables()). - */ - d_scratch = hier::VariableDatabase::getDatabase()->getContext("SCRATCH"); - d_current = hier::VariableDatabase::getDatabase()->getContext("CURRENT"); - d_new = hier::VariableDatabase::getDatabase()->getContext("NEW"); - - d_plot_context = d_current; - - /* - * Timers: one for each of the communication algorithms ("create" - * indicates schedule creation, "comm" indicates communication) - */ - t_advance_bdry_fill_comm = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_comm"); - t_error_bdry_fill_create = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_create"); - t_error_bdry_fill_comm = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_comm"); - t_mpi_reductions = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::mpi_reductions"); - t_initialize_level_data = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::initializeLevelData()"); - t_fill_new_level_create = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_create"); - t_fill_new_level_comm = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_comm"); - t_advance_bdry_fill_create = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_create"); - t_new_advance_bdry_fill_create = tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_create"); - t_apply_gradient_detector = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::applyGradientDetector()"); - t_coarsen_rich_extrap = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_rich_extrap"); - t_get_level_dt = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()"); - t_get_level_dt_sync = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()_sync"); - t_advance_level = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()"); - t_new_advance_bdry_fill_comm = tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_comm"); - t_patch_num_kernel = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::patch_numerical_kernels"); - t_advance_level_sync = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()_sync"); - t_std_level_sync = tbox::TimerManager::getManager()-> - getTimer( - "algs::MblkHyperbolicLevelIntegrator::standardLevelSynchronization()"); - t_sync_new_levels = tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::synchronizeNewLevels()"); - - /* - * Initialize object with data read from the input and restart databases. - */ - - bool from_restart = tbox::RestartManager::getManager()->isFromRestart(); - if (from_restart) { - getFromRestart(); - } - getFromInput(input_db, from_restart); -} - -/* - ************************************************************************* - * - * Destructor tells the tbox::RestartManager to remove this object from - * the list of restart items. - * - ************************************************************************* - */ -MblkHyperbolicLevelIntegrator::~MblkHyperbolicLevelIntegrator() -{ - if (d_registered_for_restart) { - tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); - } -} - -/* - ************************************************************************* - * - * Initialize integration data on all patches on level. This process - * is used at the start of the simulation to set the initial hierarchy - * data and after adaptive regridding. In the second case, the old - * level pointer points to the level that existed in the hierarchy - * before regridding. This pointer may be null, in which case it is - * ignored. If it is non-null, then data is copied from the old level - * to the new level before the old level is discarded. - * - * Note that we also allocate flux storage for the coarsest AMR - * hierarchy level here (i.e., level 0). The time step sequence on - * level 0 is dictated by the user code; so to avoid any memory - * management errors, flux storage on level 0 persists as long as the - * level does. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level, - const bool allocate_data) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - if (old_level) { - TBOX_ASSERT(level_number == old_level->getLevelNumber()); - } - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_initialize_level_data->start(); - - boost::shared_ptr mblk_hierarchy(hierarchy); - - boost::shared_ptr mblk_level( - mblk_hierarchy->getPatchLevel(level_number)); - - boost::shared_ptr mblk_old_level(old_level); - - /* - * Allocate storage needed to initialize level and fill data - * from coarser levels in AMR hierarchy, potentially. Since - * time gets set when we allocate data, re-stamp it to current - * time if we don't need to allocate. - */ - if (allocate_data) { - mblk_level->allocatePatchData(d_new_patch_init_data, init_data_time); - mblk_level->allocatePatchData(d_old_time_dep_data, init_data_time); - } else { - mblk_level->setTime(init_data_time, d_new_patch_init_data); - } - - /* - * Create schedules for filling new level and fill data. - */ - - if ((level_number > 0) || old_level) { - t_fill_new_level_create->start(); - - boost::shared_ptr sched( - d_mblk_fill_new_level->createSchedule(mblk_level, - mblk_old_level, - level_number - 1, - mblk_hierarchy, - d_patch_strategy)); - t_fill_new_level_create->stop(); - - d_patch_strategy->setDataContext(d_scratch); - - t_fill_new_level_comm->start(); - sched->fillData(init_data_time); - t_fill_new_level_comm->stop(); - - d_patch_strategy->clearDataContext(); - } - - if ((d_number_time_data_levels == 3) && can_be_refined) { - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator - time_dep_var = d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - time_dep_var++; - } - } - - } // loop over patches - - /* - * Initialize data on patch interiors. - */ - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, init_data_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - init_data_time, - initial_time); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - //d_mblk_fill_new_level.reset(); - - t_initialize_level_data->stop(); -} - -/* - ************************************************************************* - * - * Reset hierarchy configuration information where the range of new - * hierarchy levels is specified. The information updated involves - * the cached communication schedules maintained by the algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level <= finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln0 = 0; ln0 <= finest_level; ln0++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); - } -#else - NULL_USE(finest_level); -#endif - - boost::shared_ptr mblk_hierarchy(hierarchy); - - int finest_hiera_level = hierarchy->getFinestLevelNumber(); - - d_mblk_bdry_sched_advance.resizeArray(finest_hiera_level + 1); - d_mblk_bdry_sched_advance_new.resizeArray(finest_hiera_level + 1); - - for (int ln = coarsest_level; ln <= finest_hiera_level; ln++) { - boost::shared_ptr mblk_level( - mblk_hierarchy->getPatchLevel(ln)); - - t_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance[ln] = - d_mblk_bdry_fill_advance->createSchedule(mblk_level, - ln - 1, - mblk_hierarchy, - d_patch_strategy); - t_advance_bdry_fill_create->stop(); - - if (!d_lag_dt_computation && d_use_ghosts_for_dt) { - t_new_advance_bdry_fill_create->start(); - d_mblk_bdry_sched_advance_new[ln] = - d_mblk_bdry_fill_advance_new->createSchedule(mblk_level, - ln - 1, - mblk_hierarchy, - d_patch_strategy); - t_new_advance_bdry_fill_create->stop(); - } - - } - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells near large gradients. - * These cells will be refined. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); -#endif - - t_apply_gradient_detector->start(); - - boost::shared_ptr mblk_hierarchy(hierarchy); - - boost::shared_ptr mblk_level( - mblk_hierarchy->getPatchLevel(level_number)); - - mblk_level->allocatePatchData(d_saved_var_scratch_data, error_data_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_error_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[level_number]->fillData(error_data_time); - t_error_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - d_patch_strategy-> - tagGradientDetectorCells(**mi, - error_data_time, - initial_time, - tag_index, - uses_richardson_extrapolation_too); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - mblk_level->deallocatePatchData(d_saved_var_scratch_data); - - t_apply_gradient_detector->stop(); - -} - -/* - ************************************************************************* - * - * The Richardson extrapolation algorithm requires a coarsened version - * of the level on which error estiamtion is performed. This routine - * is used to coarsen data from a level in the AMR hierarchy to some - * coarsened version of it. Note that this routine will be called twice - * The init_coarse_level boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * or by coarsening the "new" solution on the fine level (i.e., after - * it has been advanced). - * - * The contexts used for coarsening old data depends on the number of - * time levels. We always want to use data at the oldest time on the - * fine level, coarsened to the CURRENT context on the coarse level. - * Thus, if the problem uses two time levels, we coarsen data from - * CURRENT on fine level (since CURRENT is the oldest time maintained) - * to CURRENT on the coarse level. If the problem uses three time - * levels, we coarsen from OLD on the fine level (since OLD is the - * time maintained) to CURRENT on the coarse level. - * - * When the boolean is false, indicating we are operating at the new - * time, we coarsen the time advanced solution at the NEW context on - * the fine level to the NEW context on the coarse level so that they - * may be compared later. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((level_number >= 0) - && (level_number <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); - TBOX_ASSERT(coarse_level); -#endif - t_coarsen_rich_extrap->start(); - - boost::shared_ptr level( - hierarchy->getPatchLevel(level_number)); - - if (before_advance) { - - coarse_level->allocatePatchData(d_new_patch_init_data, - coarsen_data_time); - - if (d_number_time_data_levels == 3) { - d_patch_strategy->setDataContext(d_old); - } else { - d_patch_strategy->setDataContext(d_current); - } - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_init-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } else { - - coarse_level->allocatePatchData(d_new_time_dep_data, - coarsen_data_time); - - d_patch_strategy->setDataContext(d_new); - - TBOX_ERROR("Incomplete DLBG code."); -// d_coarsen_rich_extrap_final-> -// createSchedule(coarse_level, level, d_patch_strategy)-> -// coarsenData(); - - d_patch_strategy->clearDataContext(); - - } - - t_coarsen_rich_extrap->stop(); - -} - -/* - ************************************************************************* - * - * Call patch routines to tag cells for refinement using Richardson - * extrapolation. Richardson extrapolation requires two copies of - * the solution to compare. The NEW context holds the solution - * computed on the fine level and coarsened, whereas the CURRENT - * context holds the solution integrated on the coarse level after - * coarsening the initial data from the fine level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - /* - * Compare solutions computed on level (stored in NEW context) and on - * the coarser level (stored in CURR context) on the patches of the - * coarser level. The patch strategy implements the compare operations - * performed on each patch. - */ - - int error_level_number = - level->getLevelNumber() + 2; - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - d_patch_strategy-> - tagRichardsonExtrapolationCells(*patch, - error_level_number, - d_new, // finer context - d_current, // coarser context - error_data_time, - deltat, - error_coarsen_ratio, - initial_time, - tag_index, - uses_gradient_detector_too); - } - -} - -/* - ************************************************************************* - * - * Initialize level integrator by: - * - * (1) Setting the number of time data levels based on needs of - * the gridding algorithm - * (2) Invoking variable registration in patch strategy. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(gridding_alg); -#endif - - d_number_time_data_levels = 2; - - if ((gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() < 1) || - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() > 3)) { - TBOX_ERROR("MblkHyperbolicLevelIntegrator::initializeLevelIntegrator " - << "error...\n" << " object name = " << d_object_name - << " gridding algorithm has bad error coarsen ratio" << endl); - } - - if ((gridding_alg->getTagAndInitializeStrategy()->usesTimeIntegration()) && - (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() == 3)) { - d_number_time_data_levels = 3; - d_old = hier::VariableDatabase::getDatabase()->getContext("OLD"); - } - - d_patch_strategy->registerModelVariables(this); - - d_patch_strategy->setupLoadBalancer(this, - gridding_alg.get()); -} - -/* - ************************************************************************* - * - * Invoke dt calculation routines in patch strategy and take a min - * over all patches on the level. The result will be the max of the - * next timestep on the level. If the boolean recompute_dt is true, - * the max timestep on the level will be computed. If it is false, - * the method will simply access the latest dt stored in the time - * refinement integrator. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time) -{ - boost::shared_ptr mblk_patch_level(level); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_patch_level); -#endif - t_get_level_dt->start(); - - double dt = tbox::MathUtilities::getMax(); - - if (!d_use_ghosts_for_dt) { - - d_patch_strategy->setDataContext(d_current); - - for (hier::PatchLevel::iterator mi(mblk_patch_level->begin()); - mi != mblk_patch_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } else { - - mblk_patch_level->allocatePatchData(d_saved_var_scratch_data, - dt_time); - - d_patch_strategy->setDataContext(d_scratch); - - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[mblk_patch_level->getLevelNumber()]-> - fillData(dt_time); - t_advance_bdry_fill_comm->stop(); - - for (hier::PatchLevel::iterator mi(mblk_patch_level->begin()); - mi != mblk_patch_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); - - double patch_dt; - patch_dt = d_patch_strategy-> - computeStableDtOnPatch(**mi, - initial_time, - dt_time); - - dt = tbox::MathUtilities::Min(dt, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - /* - * Copy data from scratch to current and de-allocate scratch storage. - * This may be excessive here, but seems necessary if the - * computation of dt affects the state of the problem solution. - * Also, this getLevelDt() routine is called at initialization only - * in most cases. - */ - - copyTimeDependentData(mblk_patch_level, d_scratch, d_current); - - mblk_patch_level->deallocatePatchData(d_saved_var_scratch_data); - - } - - t_get_level_dt_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_get_level_dt_sync->stop(); - t_mpi_reductions->start(); - } - - /* - * The level time increment is a global min over all patches. - */ - - double global_dt = dt; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&global_dt, 1, MPI_MIN); - } - global_dt *= tbox::MathUtilities::Min(d_cfl_init, d_cfl); - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_get_level_dt_sync->stop(); - } - - t_get_level_dt->stop(); - - return global_dt; - -} - -/* - ************************************************************************* - * - * For the standard explicit integration algorithm for hyperbolic - * conservation laws, the fine time increment is the coarse increment - * divided by the maximum mesh ratio (independent of level number). - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio) -{ - NULL_USE(finer_level_number); -#ifdef DEBUG_CHECK_ASSERTIONS - for (int id = 0; id < d_dim.getValue(); id++) { - TBOX_ASSERT(ratio(id) > 0); - } -#endif - return coarse_dt / double(ratio.max()); -} - -/* - ************************************************************************* - * - * Integrate data on all patches in patch level from current time - * to new time (new_time) using a single time step. Before the advance - * can occur, proper ghost cell information is obtained for all patches - * on the level. Then, local patches are advanced sequentially in the - * loop over patches. The details of the routine are as follows: - * - * 0) Allocate storage for new time level data. Also, allocate - * necessary FLUX and flux integral storage if needed - * (i.e., if regrid_advance is false, first_step is true, and - * coarser or finer level than current level exists in hierarchy.) - * - * 1) Scratch space is filled so that, for each patch, interior data - * and ghost cell bdry data correspond to specified time. - * - * 1a) Call user routines to pre-process advance data, if needed. - * - * 2) Compute explicit fluxes in scratch space using data on - * patch + ghosts at given time. - * - * 3) Apply conservative difference in scratch space to advance patch - * interior data to time = new_time. - * - * 3a) Call user routines to post-process advance data, if needed. - * - * 4) Compute next stable time increment for subsequent level advances: - * - * 4a) If (d_lag_dt_computation == true) { - * DO NOT RECOMPUTE characteristic data after advancing - * data on patch. Use characteristic data corresponding - * to current time level, computed prior to flux computation, - * in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Compute dt using data on patch+ghosts at time. - * Else - * - Compute dt using data on patch interior ONLY. - * } - * - * 4b) Copy data from scratch space patch interior to new data - * storage for patch (i.e., at time = new_time). - * - * 4a) If (d_lag_dt_computation == false) { - * RECOMPUTE characteristic data after advancing data on - * patch. Use characteristic data corresponding to new time - * level in dt calculation. - * If (d_use_ghosts_for_dt == true) - * - Refill scratch space with new interior patch data - * and ghost cell bdry data correspond to new time. - * (NOTE: This requires a new boundary schedule.) - * - Compute dt using data on patch+ghosts at new_time. - * Else - * - Compute dt using data on patch interior ONLY. - * (using patch interior data at new_time) - * } - * - * 5) If (ln > 0), update flux integrals by adding patch bdry FLUXes - * to flux sums. - * - * Important Notes: - * 1) In order to advance finer levels (if they exist), both old - * and new data for each patch on the level must be maintained. - * 2) If the timestep is the first in the timestep loop on the level - * (indicated by first_step), then time interpolation is - * is unnecessary to fill ghost cells from the next coarser level. - * 3) The new dt is not calculated if regrid_advance is true. - * If this is the case, it is assumed that the results of the - * advance and the timestep calculation will be discarded - * (e.g., during regridding, or initialization). Also, allocation - * and post-processing of FLUX/flux integral data is not performed - * in this case. - * - ************************************************************************* - */ - -double -MblkHyperbolicLevelIntegrator::advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance) -{ - - boost::shared_ptr mblk_hierarchy(hierarchy); - - boost::shared_ptr mblk_level(level); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_level); - TBOX_ASSERT(mblk_hierarchy); - TBOX_ASSERT(current_time <= new_time); -#endif - - int nb; - -#ifdef RECORD_STATS - boost::shared_ptr num_boxes_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL0", "PROC_STAT")); - boost::shared_ptr num_boxes_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL1", "PROC_STAT")); - boost::shared_ptr num_boxes_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL2", "PROC_STAT")); - boost::shared_ptr num_boxes_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberBoxesL3", "PROC_STAT")); - boost::shared_ptr num_gridcells_l0( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL0", "PROC_STAT")); - boost::shared_ptr num_gridcells_l1( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL1", "PROC_STAT")); - boost::shared_ptr num_gridcells_l2( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL2", "PROC_STAT")); - boost::shared_ptr num_gridcells_l3( - tbox::Statistician::getStatistician()-> - getStatistic("NumberGridcellsL3", "PROC_STAT")); - boost::shared_ptr timestamp_l0( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL0", "PROC_STAT")); - boost::shared_ptr timestamp_l1( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL1", "PROC_STAT")); - boost::shared_ptr timestamp_l2( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL2", "PROC_STAT")); - boost::shared_ptr timestamp_l3( - tbox::Statistician::getStatistician()-> - getStatistic("TimeStampL3", "PROC_STAT")); - - int level_num = mblk_level->getLevelNumber(); - - /* - * Record number of gridcells on each patch. Note that patch - * stat requires a seq number to be identified. - */ - double level_gridcells = 0.; - double level_local_patches = 0.; - // to count total gridcells on mblk_level - //const hier::BoxList& boxes = mblk_level->getBoxes(); - //for (hier::BoxList::Iterator i(boxes); i; i++) { - // level_gridcells += i().size(); - //} - // to count gridcells on this processor - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - level_gridcells += (*mi)->getBox().size(); - level_local_patches += 1.0; - } // loop over patches - - if (level_num == 0) { - num_boxes_l0->recordProcStat(level_local_patches); - num_gridcells_l0->recordProcStat(level_gridcells); - timestamp_l0->recordProcStat(current_time); - } - if (level_num == 1) { - num_boxes_l1->recordProcStat(level_local_patches); - num_gridcells_l1->recordProcStat(level_gridcells); - timestamp_l1->recordProcStat(current_time); - } - if (level_num == 2) { - num_boxes_l2->recordProcStat(level_local_patches); - num_gridcells_l2->recordProcStat(level_gridcells); - timestamp_l2->recordProcStat(current_time); - } - if (level_num == 3) { - num_boxes_l3->recordProcStat(level_local_patches); - num_gridcells_l3->recordProcStat(level_gridcells); - timestamp_l3->recordProcStat(current_time); - } -#endif - - t_advance_level->start(); - - const int level_number = mblk_level->getLevelNumber(); - const double dt = new_time - current_time; - - /* - * (1) Allocate data needed for advancing level. - * (2) Generate temporary communication schedule to fill ghost - * cells, if needed. - * (3) Fill ghost cell data. - * (4) Process flux storage before the advance. - */ - - mblk_level->allocatePatchData(d_new_time_dep_data, new_time); - mblk_level->allocatePatchData(d_saved_var_scratch_data, current_time); - - boost::shared_ptr mblk_fill_schedule; - - bool in_hierarchy = mblk_level->inHierarchy(); - - if (!in_hierarchy) { - t_error_bdry_fill_create->start(); - if (d_number_time_data_levels == 3) { - mblk_fill_schedule = d_mblk_bdry_fill_advance_old-> - createSchedule(mblk_level, - mblk_level->getLevelNumber() - 1, - mblk_hierarchy, - d_patch_strategy); - } else { - mblk_fill_schedule = d_mblk_bdry_fill_advance-> - createSchedule(mblk_level, - mblk_level->getLevelNumber() - 1, - mblk_hierarchy, - d_patch_strategy); - } - t_error_bdry_fill_create->stop(); - } else { - mblk_fill_schedule = d_mblk_bdry_sched_advance[level_number]; - } - - d_patch_strategy->setDataContext(d_scratch); - if (regrid_advance) { - t_error_bdry_fill_comm->start(); - } else { - t_advance_bdry_fill_comm->start(); - } - mblk_fill_schedule->fillData(current_time); - if (regrid_advance) { - t_error_bdry_fill_comm->stop(); - } else { - t_advance_bdry_fill_comm->stop(); - } - - d_patch_strategy->clearDataContext(); - mblk_fill_schedule.reset(); - - preprocessFluxData(mblk_level, - current_time, - new_time, - regrid_advance, - first_step, - last_step); - - /* - * (5) Call user-routine to pre-process state data, if needed. - * (6) Advance solution on all level patches (scratch storage). - * (7) Copy new solution to from scratch to new storage. - * (8) Call user-routine to post-process state data, if needed. - */ - t_patch_num_kernel->start(); - d_patch_strategy->preprocessAdvanceLevelState(mblk_level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - d_patch_strategy->setDataContext(d_scratch); - for (hier::PatchLevel::iterator ip(mblk_level->begin()); - ip != mblk_level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - patch->allocatePatchData(d_temp_var_scratch_data, current_time); - - t_patch_num_kernel->start(); - d_patch_strategy->computeFluxesOnPatch(*patch, - current_time, - dt); - t_patch_num_kernel->stop(); - - bool at_syncronization = false; - - t_patch_num_kernel->start(); - d_patch_strategy->conservativeDifferenceOnPatch(*patch, - current_time, - dt, - at_syncronization); - t_patch_num_kernel->stop(); - - patch->deallocatePatchData(d_temp_var_scratch_data); - } - d_patch_strategy->clearDataContext(); - - mblk_level->setTime(new_time, d_saved_var_scratch_data); - mblk_level->setTime(new_time, d_flux_var_data); - - copyTimeDependentData(mblk_level, d_scratch, d_new); - - t_patch_num_kernel->start(); - d_patch_strategy->postprocessAdvanceLevelState(mblk_level, - current_time, - dt, - first_step, - last_step, - regrid_advance); - t_patch_num_kernel->stop(); - - /* - * (9) If the level advance is for regridding, we compute the next timestep: - * - * (a) If the dt computation is lagged (i.e., we use pre-advance data - * to compute timestep), we reset scratch space on patch interiors - * if needed. Then, we set the strategy context to current or scratch - * depending on whether ghost values are used to compute dt. - * (b) If the dt computation is not lagged (i.e., we use advanced data - * to compute timestep), we refill scratch space, including ghost - * data with new solution values if needed. Then, we set the strategy - * context to new or scratch depending on whether ghost values are - * used to compute dt. - * (c) Then, we loop over patches and compute the dt on each patch. - */ - - double dt_next = tbox::MathUtilities::getMax(); - - if (!regrid_advance) { - - if (d_lag_dt_computation) { - - if (d_use_ghosts_for_dt) { - d_patch_strategy->setDataContext(d_scratch); - copyTimeDependentData(mblk_level, d_current, d_scratch); - } else { - d_patch_strategy->setDataContext(d_current); - } - - } else { - - if (d_use_ghosts_for_dt) { - - if (!d_mblk_bdry_sched_advance_new[level_number]) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to fill new ghost data for timestep" - << "computation, but schedule not defined." << endl); - } - - d_patch_strategy->setDataContext(d_scratch); - t_new_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance_new[level_number]->fillData(new_time); - t_new_advance_bdry_fill_comm->stop(); - - } else { - d_patch_strategy->setDataContext(d_new); - } - - } - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, new_time); - // "false" argument indicates "initial_time" is false. - t_patch_num_kernel->start(); - double patch_dt = - d_patch_strategy->computeStableDtOnPatch(**mi, - false, - new_time); - t_patch_num_kernel->stop(); - - dt_next = tbox::MathUtilities::Min(dt_next, patch_dt); - - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - } // !regrid_advance - - mblk_level->deallocatePatchData(d_saved_var_scratch_data); - - postprocessFluxData(mblk_level, - regrid_advance, - first_step, - last_step); - - t_advance_level->stop(); - - t_advance_level_sync->start(); - - if (d_distinguish_mpi_reduction_costs) { - tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); - t_advance_level_sync->stop(); - t_mpi_reductions->start(); - } - - double next_dt = dt_next; - const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - if (mpi.getSize() > 1) { - mpi.AllReduce(&next_dt, 1, MPI_MIN); - } - next_dt *= d_cfl; - - if (d_distinguish_mpi_reduction_costs) { - t_mpi_reductions->stop(); - } else { - t_advance_level_sync->stop(); - } - - return next_dt; -} - -/* - ************************************************************************* - * - * Synchronize data between patch levels according to the standard - * hyperbolic flux correction algorithm. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time) -{ - tbox::Array old_times(finest_level - coarsest_level + 1); - for (int i = coarsest_level; i <= finest_level; i++) { - old_times[i] = old_time; - } - standardLevelSynchronization(hierarchy, coarsest_level, finest_level, - sync_time, old_times); -} - -void -MblkHyperbolicLevelIntegrator::standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - TBOX_ASSERT(old_times.getSize() >= finest_level); - for (int ln = coarsest_level; ln < finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - TBOX_ASSERT(sync_time >= old_times[ln]); - } - TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); -#endif - t_std_level_sync->start(); - - boost::shared_ptr mblk_hierarchy(hierarchy); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sync_time >= old_times[coarse_ln]); -#endif - - boost::shared_ptr mblk_fine_level( - mblk_hierarchy->getPatchLevel(fine_ln)); - boost::shared_ptr mblk_coarse_level( - mblk_hierarchy->getPatchLevel(coarse_ln)); - - synchronizeLevelWithCoarser(mblk_fine_level, - mblk_coarse_level, - sync_time, - old_times[coarse_ln]); - - mblk_fine_level->deallocatePatchData(d_fluxsum_data); - mblk_fine_level->deallocatePatchData(d_flux_var_data); - - if (coarse_ln > coarsest_level) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - } else { - if (coarsest_level == 0) { - mblk_coarse_level->deallocatePatchData(d_flux_var_data); - d_have_flux_on_level_zero = false; - } - } - - } - - t_std_level_sync->stop(); - -} - -/* - ************************************************************************* - * - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true (i.e., hierarchy is being constructed at initial simulation - * time). After data is coarsened, the user's initialization routine - * is called to reset data (as needed by the application) before - * that solution is further coarsened to the next coarser level in the - * hierarchy. If initial_time is false, then this routine does nothing - * In that case, interpolation of data from coarser levels is sufficient - * to set data on new levels in the hierarchy during regridding. - * - * NOTE: The fact that this routine does nothing when called at any - * time later than when the AMR hierarchy is constructed initially - * may need to change at some point based on application needs. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(hierarchy); - TBOX_ASSERT((coarsest_level >= 0) - && (coarsest_level < finest_level) - && (finest_level <= hierarchy->getFinestLevelNumber())); - for (int ln = coarsest_level; ln <= finest_level; ln++) { - TBOX_ASSERT(hierarchy->getPatchLevel(ln)); - } -#endif - - boost::shared_ptr t_sync_initial_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_create")); - boost::shared_ptr t_sync_initial_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_comm")); - - t_sync_new_levels->start(); - - boost::shared_ptr mblk_hierarchy(hierarchy); - - if (initial_time) { - - d_patch_strategy->setDataContext(d_current); - - for (int fine_ln = finest_level; fine_ln > coarsest_level; fine_ln--) { - const int coarse_ln = fine_ln - 1; - - boost::shared_ptr fine_level( - mblk_hierarchy->getPatchLevel(fine_ln)); - - boost::shared_ptr coarse_level( - mblk_hierarchy->getPatchLevel(coarse_ln)); - - t_sync_initial_create->start(); - boost::shared_ptr sched( - d_mblk_sync_initial_data->createSchedule(coarse_level, - fine_level, - d_patch_strategy)); - t_sync_initial_create->stop(); - - t_sync_initial_comm->start(); - sched->coarsenData(); - t_sync_initial_comm->stop(); - - for (hier::PatchLevel::iterator mi(coarse_level->begin()); - mi != coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, sync_time); - - d_patch_strategy->initializeDataOnPatch(**mi, - sync_time, - initial_time); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } - } - - d_patch_strategy->clearDataContext(); - - } // if (initial_time) - - t_sync_new_levels->stop(); - -} - -/* - ************************************************************************* - * - * Synchronize data between coarse and fine patch levels according to - * the standard hyperbolic flux correction algorithm. The steps of - * the algorithm are: - * - * (1) Replace coarse time-space flux integrals at coarse-fine - * boundaries with time-space flux integrals computed on fine - * level. - * (2) Repeat conservative difference on coarse level with corrected - * fluxes. - * (3) Conservatively coarsen solution on interior of fine level to - * coarse level. - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::synchronizeLevelWithCoarser( - const boost::shared_ptr mblk_fine_level, - const boost::shared_ptr mblk_coarse_level, - const double sync_time, - const double coarse_sim_time) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_fine_level); - TBOX_ASSERT(mblk_coarse_level); - TBOX_ASSERT(mblk_coarse_level->getLevelNumber() == - (mblk_fine_level->getLevelNumber() - 1)); -#endif - - boost::shared_ptr t_coarsen_fluxsum_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_create")); - boost::shared_ptr t_coarsen_fluxsum_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_comm")); - boost::shared_ptr t_coarsen_sync_create( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_create")); - boost::shared_ptr t_coarsen_sync_comm( - tbox::TimerManager::getManager()-> - getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_comm")); - - /* - * Coarsen flux integrals around fine patch boundaries to coarser level - * and replace coarse flux information where appropriate. - */ - - t_coarsen_fluxsum_create->start(); - boost::shared_ptr sched( - d_mblk_coarsen_fluxsum->createSchedule(mblk_coarse_level, - mblk_fine_level, - d_patch_strategy)); - t_coarsen_fluxsum_create->stop(); - - d_patch_strategy->setDataContext(d_current); - t_coarsen_fluxsum_comm->start(); - sched->coarsenData(); - t_coarsen_fluxsum_comm->stop(); - d_patch_strategy->clearDataContext(); - - /* - * Repeat conservative difference on coarser level. - */ - mblk_coarse_level->allocatePatchData(d_saved_var_scratch_data, - coarse_sim_time); - mblk_coarse_level->setTime(coarse_sim_time, d_flux_var_data); - - d_patch_strategy->setDataContext(d_scratch); - t_advance_bdry_fill_comm->start(); - d_mblk_bdry_sched_advance[mblk_coarse_level->getLevelNumber()]-> - fillData(coarse_sim_time); - t_advance_bdry_fill_comm->stop(); - - const double reflux_dt = sync_time - coarse_sim_time; - - int nb; - - for (hier::PatchLevel::iterator mi(mblk_coarse_level->begin()); - mi != mblk_coarse_level->end(); ++mi) { - - (*mi)->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); - - bool at_syncronization = true; - d_patch_strategy->conservativeDifferenceOnPatch(**mi, - coarse_sim_time, - reflux_dt, - at_syncronization); - (*mi)->deallocatePatchData(d_temp_var_scratch_data); - - } // loop over patches - - d_patch_strategy->clearDataContext(); - - copyTimeDependentData(mblk_coarse_level, d_scratch, d_new); - - mblk_coarse_level->deallocatePatchData(d_saved_var_scratch_data); - - /* - * Coarsen time-dependent data from fine patch interiors to coarse patches. - */ - - t_coarsen_sync_create->start(); - sched = d_mblk_coarsen_sync_data->createSchedule(mblk_coarse_level, - mblk_fine_level, - d_patch_strategy); - t_coarsen_sync_create->stop(); - - d_patch_strategy->setDataContext(d_new); - - t_coarsen_sync_comm->start(); - sched->coarsenData(); - t_coarsen_sync_comm->stop(); - - d_patch_strategy->clearDataContext(); - -} - -/* - ************************************************************************* - * - * Reset time-dependent data on patch level by replacing current data - * with new. The boolean argument is used for odd refinement ratios - * (in particular 3 used in certain applications). - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined) -{ - boost::shared_ptr mblk_level(level); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_level); -#endif - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - double cur_time = 0.; - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - - int cur_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_current); - int new_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_new); - - cur_time = (*mi)->getPatchData(cur_indx)->getTime(); - - if (can_be_refined && d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } else { - - if (d_number_time_data_levels == 3) { - - int old_indx = - variable_db->mapVariableAndContextToIndex(*time_dep_var, - d_old); - - (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); - - } - - (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); - - } - - (*mi)->deallocatePatchData(new_indx); - - time_dep_var++; - - } - - } // loop over patches - - mblk_level->setTime(new_time, d_new_patch_init_data); - - if (d_number_time_data_levels == 3) { - mblk_level->setTime(cur_time, d_old_time_dep_data); - } - -} - -/* - ************************************************************************* - * - * Discard new data on level. This is used primarily to reset patch - * data after error estimation (e.g., Richardson extrapolation.) - * - ************************************************************************* - */ - -void -MblkHyperbolicLevelIntegrator::resetDataToPreadvanceState( - const boost::shared_ptr& level) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); -#endif - - /* - * De-allocate new context - */ - level->deallocatePatchData(d_new_time_dep_data); - -} - -/* - ************************************************************************* - * - * Register given variable with algorithm according to specified - * algorithm role (i.e., HYP_VAR_TYPE). Assignment of descriptor - * indices to variable lists, component selectors, and communication - * algorithms takes place here. The different cases are: - * - * TIME_DEP: - * The number of factories depends on the number of time - * levels of data that must be stored on patches to satisfy - * regridding reqs. Currently, there are two possibilities: - * - * (1) If the coarsen ratios between levels are even, the - * error coarsening ratio will be two and so only two - * time levels of data must be maintained on every level - * but the finest as usual. - * - * (2) If the coarsen ratios between levels are three, and - * time integration is used during regridding (e.g., Rich- - * ardson extrapolation), then three time levels of data - * must be maintained on every level but the finest so - * that error estimation can be executed properly. - * - * In case (1), three factories are needed: - * SCRATCH, CURRENT, NEW. - * In case (2), four factories are needed: - * SCRATCH, OLD, CURRENT, NEW. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * NEW index is added to d_new_time_dep_data. - * - * INPUT: - * Only one time level of data is maintained and once values - * are set on patches, they do not change in time. - * - * Two factories are needed: SCRATCH, CURRENT. - * - * SCRATCH index is added to d_saved_var_scratch_data. - * CURRENT index is added to d_new_patch_init_data. - * - * NO_FILL: - * Only one time level of data is stored and no scratch space - * is used. Data may be set and manipulated at will in user - * routines. Data (including ghost values) is never touched - * outside of user routines. - * - * Two factories are needed: CURRENT, SCRATCH. - * - * CURRENT index is added to d_new_patch_init_data. - * SCRATCH index is needed only for temporary work space to - * fill new patch levels. - * - * FLUX: - * One factory is needed: SCRATCH. - * - * SCRATCH index is added to d_flux_var_data. - * - * Additionally, a variable for flux integral data is created - * for each FLUX variable. It has a single factory, SCRATCH, - * which is added to d_fluxsum_data. - * - * TEMPORARY: - * One factory needed: SCRATCH. - * SCRATCH index is added to d_temp_var_scratch_data. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op, - const boost::shared_ptr refine_op, - const boost::shared_ptr time_int) -{ - TBOX_ASSERT(var); - - hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); - - const hier::IntVector zero_ghosts(d_dim, 0); - - d_all_variables.push_back(var); - - switch (h_v_type) { - - case TIME_DEP: { - -#ifdef DEBUG_CHECK_ASSERTIONS - //TBOX_ASSERT(refine_op); - //TBOX_ASSERT(coarsen_op); - //TBOX_ASSERT(time_int); -#endif - - d_time_dep_variables.push_back(var); - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int new_id = variable_db->registerVariableAndContext(var, - d_new, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - d_new_time_dep_data.setFlag(new_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Set boundary fill schedules for time-dependent variable. - * If time interpolation operator is non-NULL, regular advance - * bdry fill algorithm will time interpolate between current and - * new data on coarser levels, and fill from current data on - * same level. New advance bdry fill algorithm will time interpolate - * between current and new data on coarser levels, and fill from new - * data on same level. If time interpolation operator is NULL, - * regular and new bdry fill algorithms will use current and new - * data, respectively. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, new_id, cur_id, new_id, scr_id, refine_op, time_int); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); - - /* - * For data synchronization between levels, the coarsen algorithm - * will coarsen new data on finer level to new data on coarser. - * Recall that coarser level data pointers will not be reset until - * after synchronization so we always coarsen to new - * (see synchronizeLevelWithCoarser routine). - */ - - boost::shared_ptr fill_pattern( - new xfer::PatchInteriorVariableFillPattern(d_dim)); - d_mblk_coarsen_sync_data->registerCoarsen(new_id, new_id, coarsen_op, - fill_pattern); - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op, - fill_pattern); - - /* - * Coarsen operations used in Richardson extrapolation. The init - * initializes data on coarser level, before the coarse level - * advance. If two time levels are used, coarsening occurs between - * the CURRENT context on both levels. If three levels are used, - * coarsening occurs between the OLD context on the fine level and - * the CURRENT context on the coarse level. The final coarsen - * algorithm coarsens data after it has been advanced on the fine - * level to the NEW context on the coarser level. - */ - - if (d_number_time_data_levels == 3) { - - int old_id = variable_db->registerVariableAndContext(var, - d_old, - zero_ghosts); - d_old_time_dep_data.setFlag(old_id); - - d_mblk_bdry_fill_advance_old->registerRefine( - scr_id, cur_id, old_id, new_id, scr_id, refine_op, time_int); - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, old_id, coarsen_op, - fill_pattern); - - } else { - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op, - fill_pattern); - } - - d_coarsen_rich_extrap_final-> - registerCoarsen(new_id, new_id, coarsen_op, - fill_pattern); - - break; - } - - case INPUT: { - -#ifdef DEBUG_CHECK_ASSERTIONS - // TBOX_ASSERT(refine_op); - // TBOX_ASSERT(coarsen_op); -#endif - - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - zero_ghosts); - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_saved_var_scratch_data.setFlag(scr_id); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - /* - * Bdry algorithms for input variables will fill from current only. - */ - - d_mblk_bdry_fill_advance->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_bdry_fill_advance_new->registerRefine( - scr_id, cur_id, scr_id, refine_op); - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * At initialization, it may be necessary to coarsen INPUT data - * up through the hierarchy so that all levels are consistent. - */ - - boost::shared_ptr fill_pattern( - new xfer::PatchInteriorVariableFillPattern(d_dim)); - - d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op, - fill_pattern); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op, fill_pattern); - - break; - } - - case NO_FILL: { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(refine_op); - TBOX_ASSERT(coarsen_op); -#endif - int cur_id = variable_db->registerVariableAndContext(var, - d_current, - ghosts); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_new_patch_init_data.setFlag(cur_id); - - /* - * Register variable and context needed for restart. - */ - hier::VariableDatabase::getDatabase()-> - registerPatchDataForRestart(cur_id); - - d_mblk_fill_new_level->registerRefine( - cur_id, cur_id, scr_id, refine_op); - - /* - * Coarsen operation for setting initial data on coarser level - * in the Richardson extrapolation algorithm. - */ - - boost::shared_ptr fill_pattern( - new xfer::PatchInteriorVariableFillPattern(d_dim)); - - d_coarsen_rich_extrap_init-> - registerCoarsen(cur_id, cur_id, coarsen_op, fill_pattern); - - break; - } - - case FLUX: { - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(coarsen_op); -#endif - /* - * Note that we force all flux variables to hold double precision - * data and be face- or side-centered. Also, for each flux variable, - * a corresponding "fluxsum" variable is created to manage - * synchronization of data betweeen patch levels in the hierarchy. - */ - const boost::shared_ptr > face_var( - var, boost::detail::dynamic_cast_tag()); - const boost::shared_ptr > side_var( - var, boost::detail::dynamic_cast_tag()); - - if (face_var) { - if (d_flux_side_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register FaceVariable when " - << "SideVariable already registered." - << endl); - } - - d_flux_is_face = true; - - } else if (side_var) { - if (d_flux_face_registered) { - TBOX_ERROR( - d_object_name << ": " - << "Attempt to register SideVariable when " - << "FaceVariable already registered." - << endl); - } - - d_flux_is_face = false; - - } else { - TBOX_ERROR( - d_object_name << ": " - << "Flux is neither face- or side-centered." << endl); - } - - d_flux_variables.push_back(var); - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_flux_var_data.setFlag(scr_id); - - string var_name = var->getName(); - string fs_suffix = "_fluxsum"; - string fsum_name = var_name; - fsum_name += fs_suffix; - - boost::shared_ptr fluxsum; - - if (d_flux_is_face) { - boost::shared_ptr > face_factory( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OuterfaceVariable( - d_dim, - fsum_name, - face_factory->getDepth())); - d_flux_face_registered = true; - } else { - boost::shared_ptr > side_factory( - var->getPatchDataFactory(), - boost::detail::dynamic_cast_tag()); - fluxsum.reset(new pdat::OutersideVariable( - d_dim, - fsum_name, - side_factory->getDepth())); - d_flux_side_registered = true; - } - - d_fluxsum_variables.push_back(fluxsum); - - int fs_id = variable_db->registerVariableAndContext(fluxsum, - d_scratch, - zero_ghosts); - - d_fluxsum_data.setFlag(fs_id); - - boost::shared_ptr fill_pattern( - new xfer::PatchInteriorVariableFillPattern(d_dim)); - d_mblk_coarsen_fluxsum->registerCoarsen(scr_id, fs_id, coarsen_op, - fill_pattern); - - break; - } - - case TEMPORARY: { - - int scr_id = variable_db->registerVariableAndContext(var, - d_scratch, - ghosts); - - d_temp_var_scratch_data.setFlag(scr_id); - - break; - } - - default: { - - TBOX_ERROR( - d_object_name << ": " - << "unknown HYP_VAR_TYPE = " << h_v_type - << endl); - - } - - } -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data before integration on the level. - * - * We allocate FLUX storage if appropriate. - * - * If the advance is not temporary, we also zero out the FLUX INTEGRALS - * on the first step of any level finer than level zero. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::preprocessFluxData( - const boost::shared_ptr mblk_level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(cur_time); - NULL_USE(last_step); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(mblk_level); -#endif - - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - const int level_number = mblk_level->getLevelNumber(); - - if (!regrid_advance) { - if (((level_number > 0) && first_step) || - ((level_number == 0) && !d_have_flux_on_level_zero)) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - if (level_number == 0) { - d_have_flux_on_level_zero = true; - } - } - } else { - if (first_step) { - mblk_level->allocatePatchData(d_flux_var_data, new_time); - } - } - - if (!regrid_advance && (level_number > 0)) { - - if (first_step) { - - mblk_level->allocatePatchData(d_fluxsum_data, new_time); - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator fs_var = - d_fluxsum_variables.begin(); - - while (fs_var != d_fluxsum_variables.end()) { - int fsum_id = - variable_db->mapVariableAndContextToIndex(*fs_var, - d_scratch); - - if (d_flux_is_face) { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } else { - boost::shared_ptr > fsum_data( - (*mi)->getPatchData(fsum_id), - boost::detail::dynamic_cast_tag()); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fsum_data); -#endif - fsum_data->fillAll(0.0); - } - - fs_var++; - } - } // loop over patches - - } else { - mblk_level->setTime(new_time, d_fluxsum_data); - } - - } // if ( !regrid_advance && (level_number > 0) ) - -} - -/* - ************************************************************************* - * - * Process FLUX and FLUX INTEGRAL data after advancing the solution on - * the level. During normal integration steps, the flux integrals are - * updated for subsequent synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is not temporary (regular integration step): - * 1) If the level is the finest in the hierarchy, FLUX data is - * deallocated. It is not used during synchronization, and is only - * maintained if needed for the advance. - * - * 2) If the level is not the coarsest in the hierarchy, update the - * flux integrals for later synchronization by adding FLUX values to - * flux integrals. - * - * If the advance is temporary, deallocate the flux data if first step. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::postprocessFluxData( - const boost::shared_ptr mblk_level, - const bool regrid_advance, - const bool first_step, - const bool last_step) -{ - NULL_USE(last_step); - - TBOX_ASSERT(mblk_level); - - if (regrid_advance && first_step) { - mblk_level->deallocatePatchData(d_flux_var_data); - } - - if (!regrid_advance && (mblk_level->getLevelNumber() > 0)) { - - for (hier::PatchLevel::iterator mi(mblk_level->begin()); - mi != mblk_level->end(); ++mi) { - - std::list >::iterator flux_var = - d_flux_variables.begin(); - std::list >::iterator fluxsum_var = - d_fluxsum_variables.begin(); - - const hier::Index& ilo = (*mi)->getBox().lower(); - const hier::Index& ihi = (*mi)->getBox().upper(); - - while (flux_var != d_flux_variables.end()) { - - boost::shared_ptr flux_data( - (*mi)->getPatchData(*flux_var, d_scratch)); - boost::shared_ptr fsum_data( - (*mi)->getPatchData(*fluxsum_var, d_scratch)); - - boost::shared_ptr > fflux_data; - boost::shared_ptr > ffsum_data; - - boost::shared_ptr > sflux_data; - boost::shared_ptr > sfsum_data; - - int ddepth; - hier::IntVector flux_ghosts(d_dim); - - if (d_flux_is_face) { - fflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - ffsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fflux_data && ffsum_data); - TBOX_ASSERT(fflux_data->getDepth() == ffsum_data->getDepth()); -#endif - ddepth = fflux_data->getDepth(); - flux_ghosts = fflux_data->getGhostCellWidth(); - } else { - sflux_data = - boost::dynamic_pointer_cast, - hier::PatchData>(flux_data); - sfsum_data = - boost::dynamic_pointer_cast, - hier::PatchData>(fsum_data); - -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(sflux_data && sfsum_data); - TBOX_ASSERT(sflux_data->getDepth() == sfsum_data->getDepth()); -#endif - ddepth = sflux_data->getDepth(); - flux_ghosts = sflux_data->getGhostCellWidth(); - } - - for (int d = 0; d < ddepth; d++) { - // loop over lower and upper parts of outer face/side arrays - for (int ifs = 0; ifs < 2; ifs++) { - if (d_flux_is_face) { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(0, d), - ffsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(1, d), - ffsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - fflux_data->getPointer(2, d), - ffsum_data->getPointer(2, ifs, d)); - } - } else { - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( - ilo(0), ilo(1), ihi(0), ihi(1), - flux_ghosts(0), - flux_ghosts(1), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(0, d), - sfsum_data->getPointer(0, ifs, d)); - F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(1, d), - sfsum_data->getPointer(1, ifs, d)); - F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( - ilo(0), ilo(1), ilo(2), - ihi(0), ihi(1), ihi(2), - flux_ghosts(0), - flux_ghosts(1), - flux_ghosts(2), - ifs, - sflux_data->getPointer(2, d), - sfsum_data->getPointer(2, ifs, d)); - } - } // if face operations vs. side operations - } // loop over lower and upper sides/faces - } // loop over depth - - flux_var++; - fluxsum_var++; - - } // loop over flux variables - - } // loop over patches - - } // if !regrid_advance and level number > 0 .... - -} - -/* - ************************************************************************* - * - * Copy time-dependent data from source to destination on level. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(level); - TBOX_ASSERT(src_context); - TBOX_ASSERT(dst_context); -#endif - - for (hier::PatchLevel::iterator ip(level->begin()); - ip != level->end(); ++ip) { - const boost::shared_ptr& patch = *ip; - - std::list >::iterator time_dep_var = - d_time_dep_variables.begin(); - while (time_dep_var != d_time_dep_variables.end()) { - boost::shared_ptr src_data( - patch->getPatchData(*time_dep_var, src_context)); - boost::shared_ptr dst_data( - patch->getPatchData(*time_dep_var, dst_context)); - - dst_data->copy(*src_data); - time_dep_var++; - } - - } - -} - -/* - ************************************************************************* - * - * Print all class data for MblkHyperbolicLevelIntegrator object. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::printClassData( - ostream& os) const -{ - os << "\nMblkHyperbolicLevelIntegrator::printClassData..." << endl; - os << "MblkHyperbolicLevelIntegrator: this = " - << (MblkHyperbolicLevelIntegrator *)this << endl; - os << "d_object_name = " << d_object_name << endl; - os << "d_cfl = " << d_cfl << "\n" - << "d_cfl_init = " << d_cfl_init << endl; - os << "d_lag_dt_computation = " << d_lag_dt_computation << "\n" - << "d_use_ghosts_for_dt = " - << d_use_ghosts_for_dt << endl; - os << "d_patch_strategy = " - << (MblkHyperbolicPatchStrategy *)d_patch_strategy << endl; - os - << "NOTE: Not printing variable arrays, ComponentSelectors, communication schedules, etc." - << endl; -} - -/* - ************************************************************************* - * - * Writes out the class version number, d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_for_dt to the database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::putToDatabase( - const boost::shared_ptr& db) const -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", - ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION); - - db->putDouble("d_cfl", d_cfl); - db->putDouble("d_cfl_init", d_cfl_init); - db->putBool("d_lag_dt_computation", d_lag_dt_computation); - db->putBool("d_use_ghosts_for_dt", d_use_ghosts_for_dt); -} - -/* - ************************************************************************* - * - * Reads in cfl, cfl_init, lag_dt_computation, and - * use_ghosts_to_compute_dt from the input database. - * Note all restart values are overriden with values from the input - * database. - * - ************************************************************************* - */ - -void MblkHyperbolicLevelIntegrator::getFromInput( - boost::shared_ptr db, - bool is_from_restart) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif - - if (db->keyExists("cfl")) { - d_cfl = db->getDouble("cfl"); - } else { - if (!is_from_restart) { - d_cfl = db->getDoubleWithDefault("cfl", d_cfl); - } - } - - if (db->keyExists("cfl_init")) { - d_cfl_init = db->getDouble("cfl_init"); - } else { - if (!is_from_restart) { - d_cfl_init = db->getDoubleWithDefault("cfl_init", d_cfl_init); - } - } - - if (db->keyExists("lag_dt_computation")) { - d_lag_dt_computation = db->getBool("lag_dt_computation"); - } else { - if (!is_from_restart) { - d_lag_dt_computation = - db->getDoubleWithDefault("lag_dt_computation", - d_lag_dt_computation); - } - } - - if (db->keyExists("use_ghosts_to_compute_dt")) { - d_use_ghosts_for_dt = db->getBool("use_ghosts_to_compute_dt"); - } else { - if (!is_from_restart) { - d_use_ghosts_for_dt = - db->getDoubleWithDefault("use_ghosts_for_dt", - d_use_ghosts_for_dt); - TBOX_WARNING( - d_object_name << ": " - << "Key data `use_ghosts_to_compute_dt' not found in input." - << " Using default value " - << d_use_ghosts_for_dt << endl); - } - } - - if (db->keyExists("distinguish_mpi_reduction_costs")) { - d_distinguish_mpi_reduction_costs = - db->getBool("distinguish_mpi_reduction_costs"); - } -} - -/* - ************************************************************************* - * - * First, gets the database corresponding to the object_name from the - * restart file. If this database exists, this method checks to make - * sure that the version number of the class matches the version number - * of the restart file. If they match, then d_cfl, d_cfl_init, - * d_lag_dt_computation, and d_use_ghosts_to_compute_dt are read from - * restart database. - * Note all restart values can be overriden with values from the input - * database. - * - ************************************************************************* - */ -void MblkHyperbolicLevelIntegrator::getFromRestart() -{ - - boost::shared_ptr root_db( - tbox::RestartManager::getManager()->getRootDatabase()); - - if (!root_db->isDatabase(d_object_name)) { - TBOX_ERROR("Restart database corresponding to " - << d_object_name << " not found in restart file" << endl); - } - boost::shared_ptr db(root_db->getDatabase(d_object_name)); - - int ver = db->getInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION"); - if (ver != ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION) { - TBOX_ERROR(d_object_name << ": " - << "Restart file version different " - << "than class version." << endl); - } - - d_cfl = db->getDouble("d_cfl"); - d_cfl_init = db->getDouble("d_cfl_init"); - d_lag_dt_computation = db->getBool("d_lag_dt_computation"); - d_use_ghosts_for_dt = db->getBool("d_use_ghosts_for_dt"); -} - -/* - ************************************************************************* - * - * Utility routines to retrieve variable contexts used by integrator. - * - ************************************************************************* - */ - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getCurrentContext() const -{ - return d_current; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getNewContext() const -{ - return d_new; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getOldContext() const -{ - return d_old; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getScratchContext() const -{ - return d_scratch; -} - -boost::shared_ptr -MblkHyperbolicLevelIntegrator::getPlotContext() const -{ - return d_plot_context; -} - -bool -MblkHyperbolicLevelIntegrator::usingRefinedTimestepping() const -{ - return d_use_time_refinement; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.h deleted file mode 100644 index d97497e4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicLevelIntegrator.h +++ /dev/null @@ -1,1057 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Integration routines for single level in AMR hierarchy - * (basic hyperbolic systems) - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicLevelIntegratorXD -#define included_MblkHyperbolicLevelIntegratorXD - -#include "SAMRAI/SAMRAI_config.h" - -#ifndef included_iostream -#define included_iostream -#include -using namespace std; -#endif -#include "MblkHyperbolicPatchStrategy.h" -#include "SAMRAI/algs/TimeRefinementLevelStrategy.h" -#include "SAMRAI/hier/ComponentSelector.h" -#include "SAMRAI/hier/Variable.h" -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" -#include "SAMRAI/hier/CoarsenOperator.h" -#include "SAMRAI/hier/RefineOperator.h" -#include "SAMRAI/hier/TimeInterpolateOperator.h" -#include "SAMRAI/hier/PatchHierarchy.h" -#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" -#include "SAMRAI/tbox/Database.h" -#include "SAMRAI/tbox/Serializable.h" - -#include - -#ifndef included_String -#include -using namespace std; -#define included_String -#endif - -#include "SAMRAI/xfer/CoarsenAlgorithm.h" -#include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/xfer/RefineAlgorithm.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/tbox/Timer.h" - -#include - -/** - * Class MblkHyperbolicLevelIntegrator provides routines needed to - * integrate a system of hyperbolic conservation laws on a structured - * AMR patch hierarchy using local time refinement. The routines include - * initializing a level, advance a level, and synchronize levels in a - * time-dependent AMR application. The AMR timestepping algorithm that - * cycles through the patch levels and calls these routines is provided by - * the TimeRefinementIntegrator class. Together, that hierarchy - * integration class and this single level integration class produce the - * common AMR algorithm due to Berger, Colella and Oliger - * (see e.g., Berger and Colella, J. Comp. Phys. (82)1:64-84, 1989). - * The operations performed on single patches on each level are implemented - * in the user-defined, problem-specific class derived from the abstract - * base class HyperbolicPatchStrategy. - * - * It is important to note that the variable contexts used by the concrete - * patch strategy subclass must be consistent with those defined in this - * class which manages the data for the variables. - * - * This class is derived from the abstract base class - * TimeRefinementLevelStrategy, which defines routines needed by - * the time refinement integrator. There is an argument in the constructor - * that determines whether this class will be used by the time - * refinement integrator for refined timestepping or synchronized - * timestepping. The routines overloaded in - * TimeRefinementLevelStrategy are: initializeLevelIntegrator(), - * getLevelDt(), getMaxFinerLevelDt(), advanceLevel(), - * standardLevelSynchronization(), synchronizeNewLevels(), - * resetTimeDependentData(), and resetDataToPreadvanceState(). - * This class is also derived from mesh::StandardTagAndInitStrategy, - * which defines routines needed by the gridding algorithm classes. The - * routines overloaded in mesh::StandardTagAndInitStrategy are: - * initializeLevelData(), resetHierarchyConfiguration(), - * applyGradientDetector(), applyRichardsonExtrapolation(), and - * coarsenDataForRichardsonExtrapolation(). - * - * An object of this class requires numerous parameters to be read from - * input. Also, data must be written to and read from files for restart. - * The input and restart data are summarized as follows. - * - * Required input keys and data types: NONE - * - * Optional input keys, data types, and defaults: - * - * - * - * - * - \b cfl - * double value for the CFL factor used for timestep selection - * (dt used = CFL * max dt). If no input value is given, a default - * value of 0.9 is used. - * - * - \b cfl_init - * double value for CFL factor used for initial timestep. - * If no input value is given, a default value of 0.9 is used. - * - * - \b lag_dt_computation - * boolean value indicating whether dt is based on current - * solution or solution from previous step (possible optimization - * in communication for characteristic analysis). If no input - * value is given, a default value of TRUE is used. - * - * - * - \b use_ghosts_to_compute_dt - * boolean value indicating whether ghost data must be filled before - * timestep is computed on each patch (possible communication - * optimization). if no input value is given, a default value - * of TRUE is used. - * - * - \b distinguish_mpi_reduction_costs - * boolean specifying whether to separate reduction costs in tbox::MPI - * from costs of load imbalances. By specifying it true, a - * barrier is put in place before the reduction call, so an extra - * operation is incurred. For this reason, it is defaulted FALSE. - * - * - * - * - * - * Note that when continuing from restart, the input values in the - * input file override all values read in from the restart database. - * - * A sample input file entry might look like: - * - * \verbatim - * - * cfl = 0.9 - * cfl_init = 0.9 - * lag_dt_computation = FALSE - * use_ghosts_to_compute_dt = TRUE - * distinguish_mpi_reduction_costs = TRUE - * - * \endverbatim - * - * @see algs::TimeRefinementIntegrator - * @see mesh::StandardTagAndInitStrategy - * @see algs::HyperbolicPatchStrategy - */ - -using namespace SAMRAI; -using namespace algs; - -class MblkHyperbolicLevelIntegrator: - public TimeRefinementLevelStrategy, - public mesh::StandardTagAndInitStrategy, - public tbox::Serializable -{ -public: - /** - * Enumerated type for the different ways in which variable storage - * can be manipulated by the level integration algorithm. - * See registerVariable(...) function for more details. - * - * - * - * - \b TIME_DEP {Data that changes in time and needs more than one - * time level to be stored.} - * - \b INPUT {Data that is set once and do not change during - * the ghosts are never re-filled outside of - * user-defined routines.} - * - \b FLUX {Face-centered double values used in conservative - * difference and synchronization (i.e., refluxing) - * process. A corresponding variable to store flux - * integral information is created for each FLUX - * variable.} - * - \b TEMPORARY {Accessory values intended to live only for - * computation on a single patch (i.e., they cannot - * be assumed to exist between patch routine function - * calls.)} - * - * - * - */ - enum HYP_VAR_TYPE { TIME_DEP = 0, - INPUT = 1, - NO_FILL = 2, - FLUX = 3, - TEMPORARY = 4 }; - - /** - * Constructor for MblkHyperbolicLevelIntegrator initializes - * integration parameters to default values and constructs standard - * communication algorithms. Other data members are read in from - * the specified input database or the restart database corresponding - * to the specified object_name. The constructor also registers - * this object for restart using the specified object name when - * the boolean argument is true. Whether object will write its state to - * restart files during program execution is determined by this argument. - * Note that it has a default state of true. This class is used by - * the time refinement integrator for refined timestepping when the - * use_time_refinement argument is true, and for synchronized - * timestepping when the boolean is false. - * - * When assertion checking is active, passing in any null pointer - * or an empty string will result in an unrecoverable assertion. - */ - MblkHyperbolicLevelIntegrator( - const string& object_name, - const tbox::Dimension& dim, - boost::shared_ptr input_db, - MblkHyperbolicPatchStrategy* patch_strategy, - boost::shared_ptr mblk_hierarchy, - bool register_for_restart = true, - bool use_time_refinement = true); - - /** - * The destructor for MblkHyperbolicLevelIntegrator unregisters - * the integrator object with the restart manager when so registered. - */ - virtual ~MblkHyperbolicLevelIntegrator(); - - /** - * Initialize level integrator by by setting the number of time levels - * of data needed based on specifications of the gridding algorithm. - * - * This routine also invokes variable registration in the patch strategy. - * - * Assertion checking will throw unrecoverable assertions if either - * pointer is null. - */ - virtual void - initializeLevelIntegrator( - const boost::shared_ptr& gridding_alg); - - /** - * Determine time increment to advance data on level and return that - * value. The double dt_time argument is the simulation time when - * the routine is called. The initial_time boolean is true if this - * routine is called during hierarchy initialization (i.e., at the - * initial simulation time). Otherwise, it is false. The - * recompute_dt option specifies whether to compute the timestep using - * the current level data or to return the value stored by the time - * integrator. The default true setting means the timestep will be - * computed if no value is supplied. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual double - getLevelDt( - const boost::shared_ptr& level, - const double dt_time, - const bool initial_time); - - /** - * Return the maximum allowable time increment for the level with - * the specified level number based on the time increment for the - * next coarser level and the mesh refinement ratio between the two - * levels. For the common explicit integration methods for hyperbolic - * conservation laws (constrained by a CFL limit), the fine time increment - * is typically the coarse increment divided by the refinement ratio. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the ratio vector is not acceptable (i.e., all values > 0). - */ - virtual double - getMaxFinerLevelDt( - const int finer_level_number, - const double coarse_dt, - const hier::IntVector& ratio_to_coarser); - - /** - * Integrate data on all patches on the given patch level from current - * time (current_time) to new time (new_time). This routine is used - * to advance the solution on each level in the hierarchy and during - * time-dependent regridding procedures, such as Richardson extrapolation. - * The boolean arguments are used to determine the state of the algorithm - * and the data when the advance routine is called. The first_step - * and last_step indicate whether the step is the first or last in the - * current timestep sequence on the level. Typically, the current timestep - * sequence means each step on the level between advance steps on a - * coarser level in the hierarchy, if one exists. The regrid_advance - * value is true when the advance is called as part of a time-dependent - * regridding procedure. Usually when this happens, the results of the - * colution advance will be discarded. So, for example, when this is true - * flux information is not maintained and flux integrals are not updated. - * The final boolean argument indicates whether or not the level resides - * in the hierarchy. For example, during time-dependent regridding, such - * as Richardson extrapolation, a temporary level that is not in the - * hierarchy is created and advanced. Then, a communication schedule - * must be generated for the level before the advance begins. - * - * This routine is called at two different points during time integration: - * during the regular time advance sequence, and possibly at the initial - * simulation time. The second call advances the solution on a coarser - * level ahead in time to provide time-dependent boundary values for some - * finer level when time-dependent regridding is used. In the first case, - * the values of the boolean flags are: - * - * - * - * - \b first_step - * = true for first step in level time step sequence; else, false. - * - \b last_step - * = true for last step in level time step sequence; else, false. - * - \b regrid_advance - * = false. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = false. - * - \b regrid_advance - * = true. - * - * - * - * - * When time-dependent regridding (i.e., Richardson extrapolation) is - * used, the routine is called from two different points in addition to - * those described above: to advance a temporary level that is coarser - * than the hierarchy level on which error estimation is performed, and - * to advance the hierarchy level itself. In the first case, the values of - * the boolean flags are: - * - * - * - * - \b first_step - * = true. - * - \b last_step - * = true. - * - \b regrid_advance - * = true. - * - * - * - * In the second case, the values of the boolean flags are: - * - * - * - * - \b first_step - * (when regridding during time integration sequence) - * = true when the level is not coarsest level to synchronize - * immediately before the regridding process; else, false. - * (when generating initial hierarchy construction) - * = true, even though there may be multiple advance steps. - * - \b last_step - * = true when the advance is the last in the Richardson - * extrapolation step sequence; else false. - * - \b regrid_advance - * = true. - * - * - * - * - * When assertion checking is active, an unrecoverable assertion will - * result if either the level or hierarchy pointer is null, or the - * new time is not greater than the given time. - */ - - virtual double - advanceLevel( - const boost::shared_ptr& level, - const boost::shared_ptr& hierarchy, - const double current_time, - const double new_time, - const bool first_step, - const bool last_step, - const bool regrid_advance = false); - - /** - * Synchronize data between given patch levels in patch hierarchy - * according to the standard hyperbolic AMR flux correction algorithm. - * This routine synchronizes data between two levels at a time from - * the level with index finest_level down to the level with index - * coarsest_level. The array of old time values are used in the - * re-integration of the time-dependent data. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null), or - * all of the old time values are less than the value of sync_time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const tbox::Array& old_times); - - /** - * This overloaded version of standardLevelSynchronization implements - * a routine used for synchronized timestepping. Only a single - * value for the old time is needed, since all levels would have the - * same old time. - */ - virtual void - standardLevelSynchronization( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const double old_time); - - /** - * Coarsen current solution data from finest hierarchy level specified - * down through the coarsest hierarchy level specified, if initial_time - * is true. In this case, the hierarchy is being constructed at the - * initial simulation time, After data is coarsened, the application- - * specific initialization routine is called to set data before that - * solution is further coarsened to the next coarser level in the - * hierarchy. This operation makes the solution consistent between - * coarser levels and finer levels that did not exist when the coarse - * levels where created and initialized originally. - * - * When initial_time is false, this routine does nothing since the - * standard hyperbolic AMR algorithm for conservation laws requires - * no data synchronization after regridding beyond interpolation of - * data from coarser levels in the hierarchy in some conservative fashion. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level numbers do - * not properly match existing levels in the hierarchy (either - * coarsest_level > finest_level or some level is null). - */ - virtual void - synchronizeNewLevels( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level, - const double sync_time, - const bool initial_time); - - /** - * Resets time-dependent data storage and update time for patch level. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetTimeDependentData( - const boost::shared_ptr& level, - const double new_time, - const bool can_be_refined); - - /** - * Deallocate all new simulation data on the given level. This may - * be necessary during regridding, or setting up levels initially. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - */ - virtual void - resetDataToPreadvanceState( - const boost::shared_ptr& level); - - /** - * Initialize data on a new level after it is inserted into an AMR patch - * hierarchy by the gridding algorithm. The level number indicates - * that of the new level. The old_level pointer corresponds to - * the level that resided in the hierarchy before the level with the - * specified number was introduced. If the pointer is null, there was - * no level in the hierarchy prior to the call and the level data is set - * based on the user routines and the simulation time. Otherwise, the - * specified level replaces the old level and the new level receives data - * from the old level appropriately before it is destroyed. - * - * Typically, when data is set, it is interpolated from coarser levels - * in the hierarchy. If the data is to be set, the level number must - * match that of the old level, if non-null. If the old level is - * non-null, then data is copied from the old level to the new level - * on regions of intersection between those levels before interpolation - * occurs. Then, user-supplied patch routines are called to further - * initialize the data if needed. The boolean argument initial_time - * is passed into the user's routines. - * - * The boolean argument initial_time indicates whether the level is - * being introduced for the first time (i.e., at initialization time), - * or after some regrid process during the calculation beyond the initial - * hierarchy construction. This information is provided since the - * initialization of the data on a patch may be different in each of those - * circumstances. The can_be_refined boolean argument indicates whether - * the level is the finest level allowed in the hierarchy. This may or - * may not affect the data initialization process depending on the problem. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, the level number does - * not match any level in the hierarchy, or the old level number - * does not match the level number (if the old level pointer is non-null). - */ - virtual void - initializeLevelData( - const boost::shared_ptr& hierarchy, - const int level_number, - const double init_data_time, - const bool can_be_refined, - const bool initial_time, - const boost::shared_ptr& old_level, - const bool allocate_data = true); - - /** - * Reset cached communication schedules after the hierarchy has changed - * (due to regidding, for example) and the data has been initialized on - * the new levels. The intent is that the cost of data movement on the - * hierarchy will be amortized across multiple communication cycles, - * if possible. The level numbers indicate the range of levels in the - * hierarchy that have changed. However, this routine updates - * communication schedules every level finer than and including that - * indexed by the coarsest level number given. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null, any pointer to a level - * in the hierarchy that is coarser than the finest level is null, - * or the given level numbers not specified properly; e.g., - * coarsest_level > finest_level. - */ - virtual void - resetHierarchyConfiguration( - const boost::shared_ptr& hierarchy, - const int coarsest_level, - const int finest_level); - - /** - * Set integer tags to "one" in cells where refinement of the given - * level should occur according to some user-supplied gradient criteria. - * The double time argument is the regrid time. The integer "tag_index" - * argument is the patch descriptor index of the cell-centered integer tag - * array on each patch in the hierarchy. The boolean argument - * initial_time indicates whether the level is being subject to refinement - * at the initial simulation time. If it is false, then the error - * estimation process is being invoked at some later time after the AMR - * hierarchy was initially constructed. The boolean argument - * uses_richardson_extrapolation_too is true when Richardson - * extrapolation error estimation is used in addition to the gradient - * detector, and false otherwise. This argument helps the user to - * manage multiple regridding criteria. This information is passed along - * to the user's patch tagging routines since the application of the - * gradient detector may be different in each case. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the hierarchy pointer is null or the level number does - * not match any existing level in the hierarchy. - */ - virtual void - applyGradientDetector( - const boost::shared_ptr& hierarchy, - const int level_number, - const double error_data_time, - const int tag_index, - const bool initial_time, - const bool uses_richardson_extrapolation_too); - - /** - * Set integer tags to "one" where refinement onf the given - * level should occur according to some user-supplied Richardson - * extrapolation criteria. The "error_data_time" argument is the - * regrid time. The "deltat" argument is the time increment to advance - * the solution on the level to be refined. Note that that level is - * finer than the level in the argument list, in general. The - * ratio between the argument level and the actual hierarchy level - * is given by the integer "coarsen ratio". - * - * The integer "tag_index" argument is the patch descriptor index of - * the cell-centered integer tag array on each patch in the hierarchy. - * - * The boolean argument initial_time indicates whether the level is being - * subject to refinement at the initial simulation time. If it is false, - * then the error estimation process is being invoked at some later time - * after the AMR hierarchy was initially constructed. Typically, this - * information is passed to the user's patch tagging routines since the - * application of the Richardson extrapolation process may be different - * in each case. - * - * The boolean uses_gradient_detector_too is true when a gradient - * detector procedure is used in addition to Richardson extrapolation, - * and false otherwise. This argument helps the user to manage multiple - * regridding criteria. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the level pointer is null. - * - */ - virtual void - applyRichardsonExtrapolation( - const boost::shared_ptr& level, - const double error_data_time, - const int tag_index, - const double deltat, - const int error_coarsen_ratio, - const bool initial_time, - const bool uses_gradient_detector_too); - - /** - * Coarsen solution data from level to coarse_level for Richardson - * extrapolation. Note that this routine will be called twice during - * the Richardson extrapolation error estimation process. The - * before_advance boolean argument indicates whether data is - * set on the coarse level by coarsening the "old" time level solution - * (i.e., before it has been advanced) or by coarsening the "new" - * solution on the fine level (i.e., after it has been advanced). - * - * When assertion checking is active, an unrecoverable assertion will - * result if either level pointer is null. - * - */ - virtual void - coarsenDataForRichardsonExtrapolation( - const boost::shared_ptr& hierarchy, - const int level_number, - const boost::shared_ptr& coarse_level, - const double coarsen_data_time, - const bool before_advance); - - /** - * Register a variable with the hyperbolic integration algorithm. The - * variable type must be one of the options defined by the enumerated - * type defined above. Typically, this routine is called from the - * hyperbolic patch model when the variable registration process is - * invoked by calling the function initializeLevelIntegrator() above. - * In fact, that function should be called before this routine is called. - * - * When assertion checking is active, an unrecoverable assertion will - * result if the variable pointer or geometry pointer is null. - */ - virtual void - registerVariable( - const boost::shared_ptr var, - const hier::IntVector ghosts, - const HYP_VAR_TYPE h_v_type, - const boost::shared_ptr coarsen_op = - boost::shared_ptr(), - const boost::shared_ptr refine_op = - boost::shared_ptr(), - const boost::shared_ptr time_int = - boost::shared_ptr()); - - /** - * Print class data representation for hyperbolic level integrator object. - * This is done automatically, when an unrecoverable run-time assertion - * is thrown within some member function of this class. - */ - virtual void - printClassData( - ostream& os) const; - - /** - * Write out object state to the given database. - * - * When assertion checking is active, database point must be non-null. - */ - virtual void - putToDatabase( - const boost::shared_ptr& db) const; - - /** - * Return pointer to "current" variable context used by integrator. - * Current data corresponds to state data at the beginning of a - * timestep, or when a new level is initialized. - */ - boost::shared_ptr - getCurrentContext() const; - - /** - * Return pointer to "new" variable context used by integrator. - * New data corresponds to advanced state data at the end of a timestep. - * The data is one timestep later than the "current" data. - */ - boost::shared_ptr - getNewContext() const; - - /** - * Return pointer to "old" variable context used by integrator. - * Old data corresponds to an extra time level of state data used - * for Richardson extrapolation error estimation. The data is - * one timestep earlier than the "current" data. - * - * Note that only in certain cases when using time-dependent error - * estimation, such as Richardson extrapolation, is the returned - * pointer will non-null. See contructor for more information. - */ - boost::shared_ptr - getOldContext() const; - - /** - * Return pointer to "scratch" variable context used by integrator. - * Scratch data typically corresponds to storage that user-routines - * in the concrete HyperbolicPatchStrategy object manipulate; - * in particular, scratch data contains ghost cells. - */ - boost::shared_ptr - getScratchContext() const; - - /** - * Return pointer to variable context used for plotting. This - * context corresponds to the data storage that should be written - * to plot files. Typically, this is the same as the "current" context. - */ - boost::shared_ptr - getPlotContext() const; - - /** - * Return true if this class has been constructed to use refined - * timestepping and false if it has been constructed to use - * synchronized timestepping. - */ - bool - usingRefinedTimestepping() const; - -protected: - /** - * Read input values, indicated above, from given database. The boolean - * argument is_from_restart should be set to true if the simulation - * is beginning from restart. Otherwise it should be set to false. - * - * When assertion checking is active, the database pointer must be non-null. - */ - virtual void - getFromInput( - boost::shared_ptr db, - bool is_from_restart); - - /** - * Read object state from the restart file and initialize class - * data members. The database from which the restart data is read is - * determined by the object_name specified in the constructor. - * - * Unrecoverable Errors: - * - * - * - * - * - - * The database corresponding to object_name is not found - * in the restart file. - * - * - - * The class version number and restart version number do not - * match. - * - * - * - * - * - */ - virtual void - getFromRestart(); - - /* - * Pre-process flux storage before advancing solution on level from - * cur_time to new_time. The boolean flags are used to determine - * how flux and flux integral storage is allocated and initialized. - * These are needed since the advanceLevel() routine is used for - * both level integration and time-dependent error estimation. - * - * When assertion checking is active, the level and schedule pointers - * must be non-null and the current time must be less than the new time. - */ - virtual void - preprocessFluxData( - const boost::shared_ptr level, - const double cur_time, - const double new_time, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Post-process flux storage after advancing solution on level. - * The boolean flag is used to determine how flux and flux integral - * storage is copied and de-allocated. This is needed since the - * advanceLevel() routine is used for both level integration and - * time-dependent error estimation. - * - * When assertion checking is active, the level pointer must be non-null. - */ - virtual void - postprocessFluxData( - const boost::shared_ptr level, - const bool regrid_advance, - const bool first_step, - const bool last_step); - - /* - * Copy time-dependent data from source space to destination space. - * - * When assertion checking is active, the level and context pointers - * must be non-null. - */ - virtual void - copyTimeDependentData( - const boost::shared_ptr level, - const boost::shared_ptr src_context, - const boost::shared_ptr dst_context); - - /** - * Apply the standard AMR hyperbolic flux synchronization process preserve - * conservation properties in the solution between the fine level and the - * coarse level. The sync_time argument indicates the time at which - * the solution on the two levels is being synchronized. The variable - * coarse_sim_time indicates the previous simulation time on the - * coarse level (recall the conservative difference will be repeated on the - * coarse level during the synchronization process). After the - * synchronization, the flux and flux integral data storage is reset on - * the levels. - * - * When assertion checking is turned on, an unrecoverable assertion - * will result if either level pointer is null, the levels are not - * consecutive in the AMR hierarchy, or the coarse sim time is not - * less than the sync time. - */ - virtual void - synchronizeLevelWithCoarser( - const boost::shared_ptr fine, - const boost::shared_ptr coarse, - const double sync_time, - const double coarse_sim_time); - -private: - /* - * The patch strategy supplies the application-specific operations - * needed to treat data on patches in the AMR hierarchy. - */ - MblkHyperbolicPatchStrategy* d_patch_strategy; - - /* - * The object name is used as a handle to databases stored in - * restart files and for error reporting purposes. The boolean - * is used to control restart file writing operations. - */ - string d_object_name; - - const tbox::Dimension d_dim; - - bool d_use_time_refinement; - bool d_registered_for_restart; - - /* - * Courant-Friedrichs-Levy parameters for time increment selection. - */ - double d_cfl; - double d_cfl_init; - - /* - * Boolean flags for algorithm variations during time integration. - * - * d_lag_dt_computation indicates when time increment is computed for - * next step on a level. A value of true means - * that the current solution values will be used to - * compute dt. A value of false means that dt will - * be computed after the current solution is advanced - * and the new solution is used to compute dt. The - * default value is true. - * - * d_use_ghosts_for_dt indicates whether the time increment computation - * on a patch requires ghost cell data (e.g., if - * boundary conditions are needed). This value must - * be consistent with the numerical routines used - * in the hyperbolic patch strategy object to - * calculate the time step size. The default is true. - */ - bool d_lag_dt_computation; - bool d_use_ghosts_for_dt; - - /* - * Boolean flags for indicated whether face or side data types are - * used for fluxes (choice is determined by numerical routines in - * hyperbolic patch model). - */ - bool d_flux_is_face; - bool d_flux_face_registered; - bool d_flux_side_registered; - -/* - * The following communication algorithms and schedules are created and - * maintained to manage inter-patch communication during AMR integration. - * The algorithms are created in the class constructor. They are initialized - * when variables are "registered" are registered with the integrator. - */ - - /* - * The "advance" schedule is used prior to advancing a level and - * prior to computing dt at initialization. It must be reset each - * time a level is regridded. All ghosts are filled with TIME_DEP - * and INPUT data at specified time. TIME_DEP data in patch interiors - * will be filled with CURRENT_VAR values. - */ - boost::shared_ptr - d_mblk_bdry_fill_advance; - tbox::Array > - d_mblk_bdry_sched_advance; - - /* - * The "advance new" schedule can be used twice during a time integration - * cycle. The first is when ghost cell data is required during the - * conservative difference process (i.e., d_use_ghosts_for_cons_diff - * is true). If this is the case, ghosts must be refilled before the - * conservative difference on a coarser level during the refluxing - * process can take place. See synchronizeLevelWithCoarser in class - * MblkHyperbolicLevelIntegrator second occurs when the dt calculation is - * not lagged and the physical boundary conditions are needed to compute dt - * (i.e., (!d_lag_dt_computation && d_use_ghosts_for_dt_computation) - * is true). In either case, all ghosts are filled with TIME_DEP and INPUT - * data at specified time. TIME_DEP data in patch interiors will be filled - * with values corresponding to NEW descriptor indices. See notes - * accompanying MblkHyperbolicLevelIntegrator::advanceLevel. - */ - boost::shared_ptr - d_mblk_bdry_fill_advance_new; - tbox::Array > - d_mblk_bdry_sched_advance_new; - - /* - * The "advance old" algorithm is used to fill ghosts using time - * interpolated data from OLD_VAR and NEW_VAR on the coarser hierarchy - * level. It is currently only used for advancing data on a temporary - * level during the Richardson extrapolation algorithm. Use of OLD_VAR - * data is required only when three time levels are used - * (i.e. d_number_time_data_levels=3). - */ - boost::shared_ptr - d_mblk_bdry_fill_advance_old; - - /* - * Coarsen algorithms for conservative data synchronization - * (e.g., flux correction or refluxing). - */ - boost::shared_ptr - d_mblk_coarsen_fluxsum; - boost::shared_ptr - d_mblk_coarsen_sync_data; - boost::shared_ptr - d_mblk_sync_initial_data; - - /* - * Coarsen algorithms for Richardson extrapolation. - */ - boost::shared_ptr d_coarsen_rich_extrap_init; - boost::shared_ptr d_coarsen_rich_extrap_final; - - /* - * Algorithm for filling a new patch level in the hierarchy. - */ - boost::shared_ptr - d_mblk_fill_new_level; - - /* - * Number of levels of time-dependent data that must be maintained - * on each patch level. This value is used to coordinate the needs - * of the time integration and the regridding process with the - * patch data types and descriptor indices. - */ - int d_number_time_data_levels; - - /* - * hier::Variable contexts and lists of variables used for data management. - * The contexts are set in the constructor. Note that they must - * be consistent with those defined by the concrete subclass of - * the HyperbolicPatchStrategy object. The variable lists - * and component selectors are set in the registerVariable() function. - */ - - boost::shared_ptr d_scratch; - boost::shared_ptr d_current; - boost::shared_ptr d_new; - boost::shared_ptr d_old; - boost::shared_ptr d_plot_context; - - std::list > d_all_variables; - std::list > d_time_dep_variables; - std::list > d_flux_variables; - std::list > d_fluxsum_variables; - - /* - * SCRATCH descriptor indices for (non-TEMPORARY) variables - * (i.e., TIME_DEP, INPUT, FLUX). Note that these are used - * to create scratch space before ghost cells are filled - * on level prior to advancing the data. - */ - hier::ComponentSelector d_saved_var_scratch_data; - - /* - * SCRATCH descriptor indices for TEMPORARY variables. Note that - * these are used to create scratch space on a patch-by-patch basis. - */ - hier::ComponentSelector d_temp_var_scratch_data; - - /* - * CURRENT descriptor indices for TIME_DEP, INPUT, NO_FILL - * variables. Note that these are used to create storage for quantities - * when new patches are made (e.g., during hierachy initialization, - * before error estimation during regridding, after regridding new - * patch levels, etc.). - */ - hier::ComponentSelector d_new_patch_init_data; - - /* - * NEW descriptor indices for TIME_DEP variables. Note that these - * are used to create space for new data before patch level is advanced. - */ - hier::ComponentSelector d_new_time_dep_data; - - /* - * Descriptor indices for FLUX quantities and integrals of fluxes - * (used to accumulate flux information around fine patch boundaries). - * Also, a boolean flag to track flux storage on level 0. - */ - hier::ComponentSelector d_flux_var_data; - hier::ComponentSelector d_fluxsum_data; - bool d_have_flux_on_level_zero; - - /* - * OLD descriptor indices for TIME_DEP variables. Note that - * these are used only when three time levels of data are used. - */ - hier::ComponentSelector d_old_time_dep_data; - - /* - * Option to distinguish tbox::MPI reduction costs from load imbalances - * when doing performance timings. - */ - bool d_distinguish_mpi_reduction_costs; - - /* - * Timers interspersed throughout the class. - */ - boost::shared_ptr t_advance_bdry_fill_comm; - boost::shared_ptr t_error_bdry_fill_create; - boost::shared_ptr t_error_bdry_fill_comm; - boost::shared_ptr t_mpi_reductions; - boost::shared_ptr t_initialize_level_data; - boost::shared_ptr t_fill_new_level_create; - boost::shared_ptr t_fill_new_level_comm; - boost::shared_ptr t_advance_bdry_fill_create; - boost::shared_ptr t_new_advance_bdry_fill_create; - boost::shared_ptr t_apply_gradient_detector; - boost::shared_ptr t_coarsen_rich_extrap; - boost::shared_ptr t_get_level_dt; - boost::shared_ptr t_get_level_dt_sync; - boost::shared_ptr t_advance_level; - boost::shared_ptr t_new_advance_bdry_fill_comm; - boost::shared_ptr t_patch_num_kernel; - boost::shared_ptr t_advance_level_sync; - boost::shared_ptr t_std_level_sync; - boost::shared_ptr t_sync_new_levels; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.C deleted file mode 100644 index ec6d41d2..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.C +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#include "MblkHyperbolicPatchStrategy.h" - -#include "SAMRAI/tbox/Utilities.h" - -using namespace std; -using namespace SAMRAI; - -MblkHyperbolicPatchStrategy::MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim): - xfer::RefinePatchStrategy(dim), - xfer::CoarsenPatchStrategy(dim), - d_dim(dim) -{ - d_data_context.reset(); -} - -MblkHyperbolicPatchStrategy::~MblkHyperbolicPatchStrategy() -{ -} - -/* - ************************************************************************* - * - * Default virtual function implementations. - * - ************************************************************************* - */ - -void MblkHyperbolicPatchStrategy::tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too) -{ - NULL_USE(patch); - NULL_USE(regrid_time); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_richardson_extrapolation_too); - TBOX_WARNING("MblkHyperbolicPatchStrategy::tagGradientDetectorCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << endl); -} - -void MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too) -{ - NULL_USE(patch); - NULL_USE(error_level_number); - NULL_USE(coarsened_fine); - NULL_USE(advanced_coarse); - NULL_USE(regrid_time); - NULL_USE(deltat); - NULL_USE(error_coarsen_ratio); - NULL_USE(initial_error); - NULL_USE(tag_index); - NULL_USE(uses_gradient_detector_too); - TBOX_WARNING( - "MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells()" - << "\nNo class supplies a concrete implementation for " - << "\nthis method. The default abstract method (which " - << "\ndoes no cell tagging) is executed" << endl); -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.h deleted file mode 100644 index 67efea7a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkHyperbolicPatchStrategy.h +++ /dev/null @@ -1,527 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Interface to patch routines for hyperbolic integration scheme. - * - ************************************************************************/ - -#ifndef included_MblkHyperbolicPatchStrategyXD -#define included_MblkHyperbolicPatchStrategyXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/PatchData.h" -#include "SAMRAI/hier/PatchLevel.h" -#include "SAMRAI/hier/Variable.h" -#include "SAMRAI/hier/VariableContext.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" -#include "SAMRAI/xfer/CoarsenPatchStrategy.h" -#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" -#include "SAMRAI/xfer/RefineSchedule.h" -#include "SAMRAI/xfer/RefinePatchStrategy.h" - -#include - -/** - * Class MblkHyperbolicPatchStrategy is an abstract base class defining the - * interface between an MblkHyperbolicLevelIntegrator object and operations - * applied to a single patch in a structured AMR hierarchy. The operations - * include patch initialization, dt calculation, flux computation, - * conservative differencing, and error estimation. This class is derived - * from the xfer::RefinePatchStrategy and xfer::CoarsenPatchStrategy - * abstract base classes. These base classes provide the interface for - * user-defined interlevel data refining and coarsening operations and the - * specification of physical boundary conditions. The functions - * setPhysicalBoundaryConditions(), and pre/postprocessRefine() are - * overloaded from the class xfer::RefinePatchStrategy. The operations - * pre/postprocessCoarsen() are overloaded from xfer::CoarsenPatchStrategy. - * The pre/postprocessCoarsen/Refine() operations are given empty - * implementations here so that the user does not need to proovide them if - * the operations are not needed. - * - * It is important to recognize that for the concrete patch strategy subclass - * and the MblkHyperbolicLevelIntegrator to work together, the concrete - * strategy must know which patch data to operate on. The patch data storage - * is manipulated by the level integrator. The set/clearDataContext() methods - * allow the integrator to inform the patch strategy of the correct data - * context. The concrete patch strategy subclass can access the appropriate - * context via the getDataContext() method. - * - * @see algs::MblkHyperbolicLevelIntegrator - * @see xfer::RefinePatchStrategy - * @see xfer::CoarsenPatchStrategy - */ - -using namespace SAMRAI; - -class MblkHyperbolicLevelIntegrator; - -class MblkHyperbolicPatchStrategy: - public xfer::RefinePatchStrategy, - public xfer::CoarsenPatchStrategy -{ -public: - /** - * Default constructor for MblkHyperbolicPatchStrategy. - */ - MblkHyperbolicPatchStrategy( - const tbox::Dimension& dim); - - /** - * Virtual destructor for MblkHyperbolicPatchStrategy. - */ - virtual ~MblkHyperbolicPatchStrategy(); - - /** - * Register specific variables needed in the numerical routines with the - * hyperbolic level integrator using the registerVariable() function in that - * class. The integrator manipulates storage for the data and this - * registration defines the way in which data for each quantity will - * be manipulated on the patches. Typically, the derived data quantities - * for plotting are registered with a visualization data writer in this - * routine as well, since the hyperbolic level integrator provides the - * variable context for plotting (i.e., which data is available when a - * plot file is generated). The integrator pointer cannot be null in - * most cases. - * - * The gridding algorithm pointer is provided so that patch data objects - * may be registered with the load balancer object (owned by the gridding - * algorithm) for non-uniform load balancing, if needed. - */ - virtual void - registerModelVariables( - MblkHyperbolicLevelIntegrator* integrator) = 0; - - /** - * Set up parameters in the load balancer object (owned by the gridding - * algorithm) if needed. This function is called immediately after the - * registerModelVariables() function is called. The hyperbolic level - * integrator pointer is provided so that the integrator can be used - * to manage data for the load balancer if needed (e.g., when using - * non-uniform load balancing). - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void setupLoadBalancer( - MblkHyperbolicLevelIntegrator* integrator, - mesh::GriddingAlgorithmStrategy* gridding_algorithm) - { - NULL_USE(integrator); - NULL_USE(gridding_algorithm); - } - - /** - * Set the initial data on a patch interior only. Note that no ghost cells - * need to be set in this routine regardless of whether the patch data - * corresponding to the context requires ghost cells. The data_time - * is the simulation time when the routine is called. The boolean - * initial_time is true if the routine is called at the initial time - * when the hierarchy is initially constructed, otherwise it is false. - */ - virtual void - initializeDataOnPatch( - hier::Patch& patch, - const double data_time, - const bool initial_time) = 0; - - /** - * Compute the stable time increment for a patch on the level with the - * given number. The boolean flag initial_time is true if the routine - * is called at the initial simulation time; otherwise it is false. - * The double argument dt_time is the simulation time. - */ - virtual double - computeStableDtOnPatch( - hier::Patch& patch, - const bool initial_time, - const double dt_time) = 0; - - /** - * Compute TIME INTEGRALS of fluxes to be used in conservative difference - * for patch integration. That is, it is assumed that this numerical - * routine will compute the fluxes corresponding to the cell faces - * multiplied by the time increment. Typically, the numerical flux is - * the normal flux at the cell face. The flux integrals will be used in - * the conservative difference that updates the conserved quantities. - * - * Note that the numerical routines in this method generally require - * ghost cells. Ghost cells data is filled before this routine is called. - */ - virtual void - computeFluxesOnPatch( - hier::Patch& patch, - const double time, - const double dt) = 0; - - /** - * Update patch data with a conservative difference (approximating - * the divergence theorem) using the flux integrals computed in - * computeFluxesOnPatch() routine. The boolean flag is true when this - * routine is called during a flux synchronization step. Otherwise, - * it is false. Note that the computeFluxesOnPatch() routine computes - * TIME INTEGRALs of the numerical fluxes (e.g., they have been multiplied - * by dt). So the conservative difference routine should be consistent - * with this. - */ - virtual void - conservativeDifferenceOnPatch( - hier::Patch& patch, - const double time, - const double dt, - bool at_syncronization) = 0; - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data BEFORE patches are advanced on the given level. - * This routine is called after patch boundary data is filled - * (i.e., ghosts) and before computeFluxesOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser level will occur - * immediately after this advance), regrid_advance -- boolean flag that - * is true if the advance is during a regridding phase (i.e., the advance - * is not used to integrate data on the hierarchy) in which case the - * results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * current level data on all patch interiors. That is, both scratch and - * current data correspond to current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - preprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * This is an optional routine for user to process any application-specific - * patch strategy data AFTER patches are advanced on the given level. - * This routine is called after conservativeDifferenceOnPatch() is called - * and before computeStableDtOnPatch(). The arguments are: - * level -- level that will be advanced, current_time -- current - * integration time, dt -- current time increment, first_step -- boolean - * flag that is true if advance is first in time step sequence on level - * (i.e., previous advance step was on another level, false otherwise, - * last_step -- boolean flag that is true if advance is last in time step - * sequence on level (i.e., synchronization with coarser - * level will occur immediately after this advance), regrid_advance -- - * boolean flag that is true if the advance is during a regridding phase - * (i.e., the advance is not used to integrate data on the hierarchy) in - * which case the results of the advance will be discarded. - * - * Note that when this routine is called, the scratch data is filled on - * all patches (i.e., ghost cells) and that data is the same as the - * new level data on all patch interiors. That is, both scratch and - * new data correspond to current_time + dt on patch interiors. - * The current data and ghost values correspond to the current_time. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - postprocessAdvanceLevelState( - const boost::shared_ptr& level, - double current_time, - double dt, - bool first_step, - bool last_step, - bool regrid_advance) - { - NULL_USE(level); - NULL_USE(current_time); - NULL_USE(dt); - NULL_USE(first_step); - NULL_USE(last_step); - NULL_USE(regrid_advance); - } - - /** - * Tag cells on the given patch that require refinement based on - * application-specific numerical quantities. The tag index argument - * indicates the index of the tag data on the patch data array. The - * boolean argument initial_error is true if tagging is being done at the - * initial simulation time; otherwise, it is false. The other boolean - * flag uses_richardson_extrapolation_too is true when Richardson - * extrapolation is used in addition to the gradient detector. This flag - * helps users manage multiple regridding criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagGradientDetectorCells( - hier::Patch& patch, - const double regrid_time, - const bool initial_error, - const int tag_index, - const bool uses_richardson_extrapolation_too); - - /** - * Tag cells based from differences computed in the Richardson - * extrapolation. The Richardson - * extrapolation algorithm creates a coarsened version of some hierarchy - * patch level and advances data in time on both the coarsened patch - * level and the hierarchy level. This routine takes the data resulting - * from the advance on both the coarse and fine levels, compares them, and - * tags cells according to the difference. - * \verbatim - * (2) - * n+1 ^------->x finish (1) advanced_coarse - * | ^ (2) coarsened_fine - * time n - | - * ^ |(1) - * | | - * <--------o start - * fine coarse - * \endverbatim - * - * The patch supplied to this routine is on the coarsened level. However, - * the error_level_number corresponds to the actual hierarchy level - * from which it was coarsened. Data resides on this patch in two - * contexts - ``advanced_coarse'' and ``coarsened_fine''. Advanced - * coarse is data advanced on the coarsened version of the level, while - * coarsened fine is the data advanced on the fine level and then - * coarsened to the coarse level. The regrid time and the time increment - * are given for the actual hierarchy level. The error coarsen ratio - * argument is the ratio between the index spaces on the hierarchy level - * and the coarsened hierarchy level. The boolean flag ``initial_error'' - * is true when the error estimation is performed at the initial simulation - * time; i.e., when the hierarchy levels are being constructed for the first - * time. The tag index argument is the index of the tag data on the patch - * data array. The other boolean flag uses_gradient_detector_too is - * true when a gradient detector scheme is used in addition to Richardson - * extrapolation. This flag helps users manage multiple regridding - * criteria. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual void - tagRichardsonExtrapolationCells( - hier::Patch& patch, - const int error_level_number, - const boost::shared_ptr coarsened_fine, - const boost::shared_ptr advanced_coarse, - const double regrid_time, - const double deltat, - const int error_coarsen_ratio, - const bool initial_error, - const int tag_index, - const bool uses_gradient_detector_too); - - /** - * Set user-defined boundary conditions at the physical domain boundary. - */ - virtual void - setPhysicalBoundaryConditions( - hier::Patch& patch, - const double fill_time, - const hier::IntVector& ghost_width_to_fill) = 0; - - /** - * Fill the singularity conditions for the multi-block case - */ - virtual void - fillSingularityBoundaryConditions( - hier::Patch& patch, - const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, - const hier::Box& fill_box, - const hier::BoundaryBox& boundary_box, - const boost::shared_ptr& grid_geometry) = 0; - - /** - * Return maximum stencil width needed for user-defined - * data interpolation operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getRefineOpStencilWidth() const - { - return hier::IntVector(d_dim, 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial interpolation routines applied to variables. The - * interpolation routines are used in the hyperbolic AMR algorithm - * for filling patch ghost cells before advancing data on a level - * and after regridding a level to fill portions of the new level - * from some coarser level. These routines are called automatically - * from within patch boundary filling schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_REFINE" is given as the interpolation - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that refine such variables in either - * of these routines, then they will not be refined. - * - * The order in which these operations are used in each patch - * boundary filling schedule is: - * - * - \b (1) {Call user's preprocessRefine() routine.} - * - \b (2) {Refine all variables with standard interpolation operators.} - * - \b (3) {Call user's postprocessRefine() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessRefine( - hier::Patch& fine, - const hier::Patch& coarse, - const hier::Box& fine_box, - const hier::IntVector& ratio) - { - NULL_USE(fine); - NULL_USE(coarse); - NULL_USE(fine_box); - NULL_USE(ratio); - } - - /** - * Return maximum stencil width needed for user-defined - * data coarsen operations. Default is to return - * zero, assuming no user-defined operations provided. - * - * Note that this function is not pure virtual. It is given a - * dummy implementation here so that users may ignore it when - * inheriting from this class. - */ - virtual hier::IntVector getCoarsenOpStencilWidth() const - { - return hier::IntVector(d_dim, 0); - } - - /** - * Pre- and post-processing routines for implementing user-defined - * spatial coarsening routines applied to variables. The coarsening - * routines are used in the hyperbolic AMR algorithm synchronizing - * coarse and fine levels when they have been integrated to the same - * point. These routines are called automatically from within the - * data synchronization coarsen schedules; thus, some concrete - * function matching these signatures must be provided in the user's - * patch routines. However, the routines only need to perform some - * operations when "USER_DEFINED_COARSEN" is given as the coarsening - * method for some variable when the patch routines register variables - * with the hyperbolic level integration algorithm, typically. If the - * user does not provide operations that coarsen such variables in either - * of these routines, then they will not be coarsened. - * - * The order in which these operations are used in each coarsening - * schedule is: - * - * - \b (1) {Call user's preprocessCoarsen() routine.} - * - \b (2) {Coarsen all variables with standard coarsening operators.} - * - \b (3) {Call user's postprocessCoarsen() routine.} - * - * Note that these functions are not pure virtual. They are given - * dummy implementations here so that users may ignore them when - * inheriting from this class. - */ - virtual void preprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /// - virtual void postprocessCoarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const hier::Box& coarse_box, - const hier::IntVector& ratio) - { - NULL_USE(coarse); - NULL_USE(fine); - NULL_USE(coarse_box); - NULL_USE(ratio); - } - - /** - * Return pointer to patch data context. - */ - boost::shared_ptr getDataContext() const - { - return d_data_context; - } - - /** - * The hyperbolic integrator controls the context for the data to be used - * in the numerical routines implemented in the concrete patch strategy. - * The setDataContext() allows the integrator to set the context for - * data on a patch on which to operate. - */ - void setDataContext( - boost::shared_ptr context) - { - d_data_context = context; - } - - /** - * The clearDataContext() routine resets the data context to be null. - */ - void clearDataContext() - { - d_data_context.reset(); - } - -private: - const tbox::Dimension d_dim; - - boost::shared_ptr d_data_context; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.C index 8ac0ba3d..6cbfa0b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -32,7 +32,6 @@ using namespace std; #include #include -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/pdat/CellData.h" #include "SAMRAI/pdat/CellIndex.h" @@ -65,8 +64,8 @@ using namespace std; #define BOGUS_BDRY_DATA (-9999) // routines for managing boundary data -#include "SkeletonBoundaryUtilities2.h" -#include "SkeletonBoundaryUtilities3.h" +#include "test/testlib/SkeletonBoundaryUtilities2.h" +#include "test/testlib/SkeletonBoundaryUtilities3.h" // Depth of the advected variable #define DEPTH (1) @@ -117,7 +116,7 @@ using namespace std; extern "C" { -void F77_FUNC(initsphere2d, INITSPHERE2D) ( +void SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -127,7 +126,7 @@ void F77_FUNC(initsphere2d, INITSPHERE2D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(initsphere3d, INITSPHERE3D) ( +void SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -139,7 +138,7 @@ void F77_FUNC(initsphere3d, INITSPHERE3D) ( const double&, const double&, const double *, const double&); -void F77_FUNC(linadvinit2d, LINADVINIT2D) ( +void SAMRAI_F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -149,7 +148,7 @@ void F77_FUNC(linadvinit2d, LINADVINIT2D) ( const int&, const double *, const double *); -void F77_FUNC(linadvinit3d, LINADVINIT3D) ( +void SAMRAI_F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -161,7 +160,7 @@ void F77_FUNC(linadvinit3d, LINADVINIT3D) ( const int&, const double *, const double *); -void F77_FUNC(stabledt2d, STABLEDT2D) ( +void SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, const int&, const int&, const int&, const int&, @@ -171,7 +170,7 @@ void F77_FUNC(stabledt2d, STABLEDT2D) ( const double *, double&); -void F77_FUNC(stabledt3d, STABLEDT3D) ( +void SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, const int&, const int&, const int&, const int&, @@ -183,19 +182,19 @@ void F77_FUNC(stabledt3d, STABLEDT3D) ( const double *, double&); -void F77_FUNC(inittraceflux1d, INITTRACEFLUX1D) ( +void SAMRAI_F77_FUNC(inittraceflux1d, INITTRACEFLUX1D) ( const int&, const int&, const double *, double *, double *, double *); -void F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( +void SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) ( const int&, const int&, const int&, const int&, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( +void SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -204,7 +203,7 @@ void F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing1d0, CHARTRACING1D0) ( +void SAMRAI_F77_FUNC(chartracing1d0, CHARTRACING1D0) ( const double&, const int&, const int&, const int&, const double&, const double&, const int&, const double *, @@ -212,7 +211,7 @@ void F77_FUNC(chartracing1d0, CHARTRACING1D0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( +void SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -221,7 +220,7 @@ void F77_FUNC(chartracing2d0, CHARTRACING2D0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( +void SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, const double *, @@ -229,7 +228,7 @@ void F77_FUNC(chartracing2d1, CHARTRACING2D1) ( double *, double *, double *, double *); -void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( +void SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -239,7 +238,7 @@ void F77_FUNC(chartracing3d0, CHARTRACING3D0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( +void SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -248,7 +247,7 @@ void F77_FUNC(chartracing3d1, CHARTRACING3D1) ( double *, double *, double *, double *); -void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( +void SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -257,7 +256,7 @@ void F77_FUNC(chartracing3d2, CHARTRACING3D2) ( double *, double *, double *, double *); -void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2d) ( +void SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2d) ( const double&, const int&, const int&, const double *, const int&, const int&, @@ -267,7 +266,7 @@ void F77_FUNC(fluxcalculation2d, FLUXCALCULATION2d) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) ( +void SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) ( const double&, const int&, const int&, const int&, const double *, @@ -280,7 +279,7 @@ void F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec, FLUXCORREC) ( +void SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) ( const double&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, @@ -288,7 +287,7 @@ void F77_FUNC(fluxcorrec, FLUXCORREC) ( double *, double *, double *, double *); -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const int&, @@ -299,7 +298,7 @@ void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -309,21 +308,21 @@ void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( +void SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( +void SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( +void SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -331,12 +330,12 @@ void F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(stufprobc, STUFPROBC) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); -void F77_FUNC(consdiff2d, CONSDIFF2D) ( +void SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) ( const int&, const int&, const int&, const int&, const double *, @@ -344,7 +343,7 @@ void F77_FUNC(consdiff2d, CONSDIFF2D) ( const double *, double *); -void F77_FUNC(consdiff3d, CONSDIFF3D) ( +void SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -354,7 +353,7 @@ void F77_FUNC(consdiff3d, CONSDIFF3D) ( const double *, double *); -void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( +void SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -365,7 +364,7 @@ void F77_FUNC(detectgrad2d, DETECTGRAD2D) ( const double *, int *, int *); -void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( +void SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -378,7 +377,7 @@ void F77_FUNC(detectgrad3d, DETECTGRAD3D) ( const double *, int *, int *); -void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( +void SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -389,7 +388,7 @@ void F77_FUNC(detectshock2d, DETECTSHOCK2D) ( const double *, int *, int *); -void F77_FUNC(detectshock3d, DETECTSHOCK3D) ( +void SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -444,24 +443,22 @@ MblkLinAdv::MblkLinAdv( d_number_of_intervals(0), d_amplitude(0.), d_mblk_geometry(new MblkGeometry("MblkGeometry", - dim, - input_db, - grid_geoms->getNumberBlocks())) + dim, + input_db, + grid_geoms)) { TBOX_ASSERT(!object_name.empty()); TBOX_ASSERT(input_db); tbox::RestartManager::getManager()->registerRestartItem(d_object_name, this); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif // SPHERE problem... tbox::MathUtilities::setArrayToSignalingNaN(d_center, d_dim.getValue()); // SINE problem - for (int k = 0; k < d_dim.getValue(); k++) d_frequency[k] = 0.; + for (int k = 0; k < d_dim.getValue(); ++k) d_frequency[k] = 0.; /* * Defaults for boundary conditions. Set to bogus values @@ -469,45 +466,45 @@ MblkLinAdv::MblkLinAdv( */ if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_uval.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_uval); + d_bdry_edge_uval.resize(NUM_2D_EDGES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_edge_uval); } if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_uval.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_uval); + d_bdry_face_uval.resize(NUM_3D_FACES); + tbox::MathUtilities::setVectorToSignalingNaN(d_bdry_face_uval); } /* @@ -551,13 +548,13 @@ MblkLinAdv::MblkLinAdv( * so we reset them to BdryCond::FLOW. */ if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -573,13 +570,13 @@ MblkLinAdv::MblkLinAdv( } } if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + for (int i = 0; i < NUM_3D_FACES; ++i) { if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_face_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; } @@ -597,7 +594,7 @@ MblkLinAdv::MblkLinAdv( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -617,7 +614,7 @@ MblkLinAdv::MblkLinAdv( } - F77_FUNC(stufprobc, STUFPROBC) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, + SAMRAI_F77_FUNC(stufprobc, STUFPROBC) (PIECEWISE_CONSTANT_X, PIECEWISE_CONSTANT_Y, PIECEWISE_CONSTANT_Z, SINE_CONSTANT_X, SINE_CONSTANT_Y, SINE_CONSTANT_Z, SPHERE, CELLG, FACEG, FLUXG); @@ -641,7 +638,7 @@ MblkLinAdv::~MblkLinAdv() { * * Register conserved variable (u) (i.e., solution state variable) and * flux variable with hyperbolic integrator that manages storage for - * those quantities. Also, register plot data with Vizamrai or VisIt. + * those quantities. Also, register plot data with VisIt. * ************************************************************************* */ @@ -649,7 +646,7 @@ MblkLinAdv::~MblkLinAdv() { void MblkLinAdv::registerModelVariables( MblkHyperbolicLevelIntegrator* integrator) { - TBOX_ASSERT(integrator != (MblkHyperbolicLevelIntegrator *)NULL); + TBOX_ASSERT(integrator != 0); TBOX_ASSERT(CELLG == FACEG); d_cell_cons_linear_refine_op.reset( @@ -666,7 +663,7 @@ void MblkLinAdv::registerModelVariables( // which we explicitly set on any new patch boost::shared_ptr node_linear_refine_op; boost::shared_ptr node_cons_coarsen_op( - new pdat::NodeDoubleInjection(d_dim)); + new pdat::NodeDoubleInjection()); integrator->registerVariable(d_uval, d_nghosts, MblkHyperbolicLevelIntegrator::TIME_DEP, @@ -704,7 +701,7 @@ void MblkLinAdv::registerModelVariables( if (!d_visit_writer) { TBOX_WARNING( d_object_name << ": registerModelVariables()" - << "\nVisit data writer was" + << "\nVisIt data writer was" << "\nregistered. Consequently, no plot data will" << "\nbe written." << endl); } @@ -740,47 +737,58 @@ void MblkLinAdv::initializeDataOnPatch( int level_number = patch.getPatchLevelNumber(); setMappedGridOnPatch(patch, level_number, block_number); + hier::BoxContainer domain; + d_grid_geometry->computePhysicalDomain(domain, + patch.getPatchGeometry()->getRatio(), + patch.getBox().getBlockId()); + + TBOX_ASSERT(domain.size() == 1); + /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, block_number, dx); boost::shared_ptr > xyz( - patch.getPatchData(d_xyz, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_xyz, getDataContext()))); + TBOX_ASSERT(xyz); - double xlo[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double xhi[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double xlo[SAMRAI::MAX_DIM_VAL]; + double xhi[SAMRAI::MAX_DIM_VAL]; pdat::NodeIndex plo(patch.getBox().lower(), hier::IntVector(dim, 0)); pdat::NodeIndex phi(patch.getBox().upper(), hier::IntVector(dim, 1)); - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { xlo[d] = (*xyz)(plo, d); xhi[d] = (*xyz)(phi, d); } - d_cell_cons_linear_refine_op->setDx(level_number, dx); - d_cell_cons_coarsen_op->setDx(level_number, dx); - d_side_cons_coarsen_op->setDx(level_number, dx); + for (int ln = 0; ln <= level_number; ++ln) { + double level_dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(domain.front(), ln, block_number, level_dx); + d_cell_cons_linear_refine_op->setDx(ln, level_dx); + d_cell_cons_coarsen_op->setDx(ln, level_dx); + d_side_cons_coarsen_op->setDx(ln, level_dx); + } if (initial_time) { boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); TBOX_ASSERT(uval); - TBOX_ASSERT(xyz); hier::IntVector ghost_cells(uval->getGhostCellWidth()); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); - if ((d_data_problem_int == SPHERE)) { + if (d_data_problem_int == SPHERE) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(initsphere2d, INITSPHERE2D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(initsphere2d, INITSPHERE2D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -792,7 +800,7 @@ void MblkLinAdv::initializeDataOnPatch( &d_center[0], d_radius); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(initsphere3d, INITSPHERE3D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(initsphere3d, INITSPHERE3D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -812,7 +820,7 @@ void MblkLinAdv::initializeDataOnPatch( * * * if (d_dim == tbox::Dimension(2)) { - * F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) (d_data_problem_int, + * SAMRAI_F77_FUNC(linadvinitsine2d, LINADVINITSINE2D) (d_data_problem_int, * dx, xlo, * domain_xlo, &domain_length[0], * ifirst(0), ilast(0), @@ -821,13 +829,13 @@ void MblkLinAdv::initializeDataOnPatch( * ghost_cells(1), * uval->getPointer(), * d_number_of_intervals, - * d_front_position.getPointer(), - * d_interval_uval.getPointer(), + * &d_front_position[0], + * &d_interval_uval[0], * d_amplitude, * &d_frequency[0]); * } * if (d_dim == tbox::Dimension(3)) { - * F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) (d_data_problem_int, + * SAMRAI_F77_FUNC(linadvinitsine3d, LINADVINITSINE3D) (d_data_problem_int, * dx, xlo, * domain_xlo, &domain_length[0], * ifirst(0), ilast(0), @@ -838,8 +846,8 @@ void MblkLinAdv::initializeDataOnPatch( * ghost_cells(2), * uval->getPointer(), * d_number_of_intervals, - * d_front_position.getPointer(), - * d_interval_uval.getPointer(), + * &d_front_position[0], + * &d_interval_uval[0], * d_amplitude, * &d_frequency[0]); * } @@ -847,7 +855,7 @@ void MblkLinAdv::initializeDataOnPatch( } else { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(linadvinit2d, LINADVINIT2D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(linadvinit2d, LINADVINIT2D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -855,11 +863,11 @@ void MblkLinAdv::initializeDataOnPatch( ghost_cells(1), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); + &d_front_position[0], + &d_interval_uval[0]); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(linadvinit3d, LINADVINIT3D) (d_data_problem_int, dx, xlo, + SAMRAI_F77_FUNC(linadvinit3d, LINADVINIT3D) (d_data_problem_int, dx, xlo, xhi, ifirst(0), ilast(0), ifirst(1), ilast(1), @@ -869,8 +877,8 @@ void MblkLinAdv::initializeDataOnPatch( ghost_cells(2), uval->getPointer(), d_number_of_intervals, - d_front_position.getPointer(), - d_interval_uval.getPointer()); + &d_front_position[0], + &d_interval_uval[0]); } } @@ -881,8 +889,9 @@ void MblkLinAdv::initializeDataOnPatch( patch.allocatePatchData(d_workload_data_id); } boost::shared_ptr > workload_data( - patch.getPatchData(d_workload_data_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_workload_data_id))); + TBOX_ASSERT(workload_data); workload_data->fillAll(1.0); } @@ -918,21 +927,21 @@ double MblkLinAdv::computeStableDtOnPatch( const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif + hier::IntVector ghost_cells(uval->getGhostCellWidth()); double stabdt; if (d_dim == tbox::Dimension(2)) { - F77_FUNC(stabledt2d, STABLEDT2D) (dx, + SAMRAI_F77_FUNC(stabledt2d, STABLEDT2D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), @@ -942,7 +951,7 @@ double MblkLinAdv::computeStableDtOnPatch( stabdt); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(stabledt3d, STABLEDT3D) (dx, + SAMRAI_F77_FUNC(stabledt3d, STABLEDT3D) (dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -988,35 +997,32 @@ void MblkLinAdv::computeFluxesOnPatch( if (d_dim < tbox::Dimension(3)) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); -#endif - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); hier::Box pbox = patch.getBox(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); /* * Verify that the integrator providing the context correctly * created it, and that the ghost cell width associated with the * context matches the ghosts defined in this class... */ -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1025,7 +1031,7 @@ void MblkLinAdv::computeFluxesOnPatch( pdat::FaceData traced_right(pbox, 1, d_nghosts); if (d_dim == tbox::Dimension(2)) { - F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), + SAMRAI_F77_FUNC(inittraceflux2d, INITTRACEFLUX2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), uval->getPointer(), traced_left.getPointer(0), @@ -1043,17 +1049,17 @@ void MblkLinAdv::computeFluxesOnPatch( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -1062,28 +1068,28 @@ void MblkLinAdv::computeFluxesOnPatch( * Output: w^L, w^R */ if (d_dim == tbox::Dimension(2)) { - F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, + SAMRAI_F77_FUNC(chartracing2d0, CHARTRACING2D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[0], d_advection_velocity[0], d_godunov_order, uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, + SAMRAI_F77_FUNC(chartracing2d1, CHARTRACING2D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } } // if (d_godunov_order > 1) ... @@ -1097,7 +1103,7 @@ void MblkLinAdv::computeFluxesOnPatch( // fluxcalculation_(dt,*,1,dx, to get artificial viscosity // fluxcalculation_(dt,*,0,dx, to get NO artificial viscosity - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), &d_advection_velocity[0], uval->getPointer(), @@ -1113,7 +1119,7 @@ void MblkLinAdv::computeFluxesOnPatch( * Inputs: F (flux) * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec, FLUXCORREC) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), dx, &d_advection_velocity[0], uval->getPointer(), @@ -1131,7 +1137,7 @@ void MblkLinAdv::computeFluxesOnPatch( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation2d, FLUXCALCULATION2D) (dt, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), &d_advection_velocity[0], uval->getPointer(), @@ -1163,36 +1169,33 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); TBOX_ASSERT(d_dim == tbox::Dimension(3)); -#endif int level_number = patch.getPatchLevelNumber(); /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); hier::Box pbox = patch.getBox(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1203,7 +1206,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( pdat::FaceData temp_traced_left(pbox, 1, d_nghosts); pdat::FaceData temp_traced_right(pbox, 1, d_nghosts); - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1228,17 +1231,17 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to compute initial estimate of @@ -1246,7 +1249,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1254,12 +1257,12 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1267,12 +1270,12 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1280,10 +1283,10 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } /* @@ -1295,7 +1298,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( // fluxcalculation_(dt,*,*,1,dx, to do artificial viscosity // fluxcalculation_(dt,*,*,0,dx, to do NO artificial viscosity - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1315,7 +1318,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], 1, uval->getPointer(), @@ -1343,7 +1346,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_traced_left/right * Output: temp_flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1363,7 +1366,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: F (flux), w^L, w^R (traced_left/right) * Output: temp_traced_left/right */ - F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], -1, uval->getPointer(), @@ -1394,7 +1397,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_traced_left/right * Output: flux */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1415,7 +1418,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: temp_flux, flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), + SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, &d_advection_velocity[0], uval->getPointer(), @@ -1436,7 +1439,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport1( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1469,36 +1472,33 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( hier::Patch& patch, const double dt) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(CELLG == FACEG); TBOX_ASSERT(d_dim == tbox::Dimension(3)); -#endif int level_number = patch.getPatchLevelNumber(); /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); hier::Box pbox = patch.getBox(); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif /* * Allocate patch data for temporaries local to this routine. @@ -1511,7 +1511,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( /* * Initialize trace fluxes (w^R and w^L) with cell-centered values. */ - F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( + SAMRAI_F77_FUNC(inittraceflux3d, INITTRACEFLUX3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1532,7 +1532,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 1, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3d) (dt, 1, 1, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1556,17 +1556,17 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Prepare temporary data for characteristic tracing. */ int Mcells = 0; - for (int k = 0; k < d_dim.getValue(); k++) { + for (tbox::Dimension::dir_t k = 0; k < d_dim.getValue(); ++k) { Mcells = tbox::MathUtilities::Max(Mcells, pbox.numberCells(k)); } // Face-centered temporary arrays - tbox::Array ttedgslp(2 * FACEG + 1 + Mcells); - tbox::Array ttraclft(2 * FACEG + 1 + Mcells); - tbox::Array ttracrgt(2 * FACEG + 1 + Mcells); + std::vector ttedgslp(2 * FACEG + 1 + Mcells); + std::vector ttraclft(2 * FACEG + 1 + Mcells); + std::vector ttracrgt(2 * FACEG + 1 + Mcells); // Cell-centered temporary arrays - tbox::Array ttcelslp(2 * CELLG + Mcells); + std::vector ttcelslp(2 * CELLG + Mcells); /* * Apply characteristic tracing to update traces w^L and @@ -1574,7 +1574,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: w^L, w^R */ - F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, + SAMRAI_F77_FUNC(chartracing3d0, CHARTRACING3D0) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -1582,37 +1582,37 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( uval->getPointer(), traced_left.getPointer(0), traced_right.getPointer(0), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, + SAMRAI_F77_FUNC(chartracing3d1, CHARTRACING3D1) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[1], d_advection_velocity[1], d_godunov_order, uval->getPointer(), traced_left.getPointer(1), traced_right.getPointer(1), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); - F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, + SAMRAI_F77_FUNC(chartracing3d2, CHARTRACING3D2) (dt, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), Mcells, dx[2], d_advection_velocity[2], d_godunov_order, uval->getPointer(), traced_left.getPointer(2), traced_right.getPointer(2), - ttcelslp.getPointer(), - ttedgslp.getPointer(), - ttraclft.getPointer(), - ttracrgt.getPointer()); + &ttcelslp[0], + &ttedgslp[0], + &ttraclft[0], + &ttracrgt[0]); } // if (d_godunov_order > 1) ... - for (int idir = 0; idir < d_dim.getValue(); idir++) { + for (int idir = 0; idir < d_dim.getValue(); ++idir) { /* * Approximate traces at cell centers (in idir direction) - denoted @@ -1620,7 +1620,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Inputs: F (flux) * Output: third_state */ - F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, + SAMRAI_F77_FUNC(onethirdstate3d, ONETHIRDSTATE3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1635,7 +1635,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Output: temp_flux (only two directions (i.e. those other than idir) * are modified) */ - F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxthird3d, FLUXTHIRD3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1651,7 +1651,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Inputs: temp_flux * Output: w^L, w^R (traced_left/right) */ - F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, + SAMRAI_F77_FUNC(fluxcorrecjt3d, FLUXCORRECJT3D) (dt, dx, idir, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1674,7 +1674,7 @@ void MblkLinAdv::compute3DFluxesWithCornerTransport2( * Inputs: w^L, w^R (traced_left/right) * Output: F (flux) */ - F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, + SAMRAI_F77_FUNC(fluxcalculation3d, FLUXCALCULATION3D) (dt, 0, 0, 0, dx, ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), &d_advection_velocity[0], uval->getPointer(), @@ -1719,28 +1719,27 @@ void MblkLinAdv::conservativeDifferenceOnPatch( /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); const hier::Index ifirst = patch.getBox().lower(); const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); boost::shared_ptr > flux( - patch.getPatchData(d_flux, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_flux, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); TBOX_ASSERT(flux); TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); TBOX_ASSERT(flux->getGhostCellWidth() == d_fluxghosts); -#endif if (d_dim == tbox::Dimension(2)) { - F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff2d, CONSDIFF2D) (ifirst(0), ilast(0), ifirst(1), ilast(1), dx, flux->getPointer(0), flux->getPointer(1), @@ -1748,7 +1747,7 @@ void MblkLinAdv::conservativeDifferenceOnPatch( uval->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), + SAMRAI_F77_FUNC(consdiff3d, CONSDIFF3D) (ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), dx, flux->getPointer(0), flux->getPointer(1), @@ -1778,16 +1777,11 @@ void MblkLinAdv::setPhysicalBoundaryConditions( NULL_USE(fill_time); boost::shared_ptr > uval( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval); -#endif - hier::IntVector uval_ghosts = uval->getGhostCellWidth(); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(uval->getGhostCellWidth() == d_nghosts); -#endif if (d_dim == tbox::Dimension(2)) { @@ -1883,10 +1877,10 @@ void MblkLinAdv::preprocessRefine( setMappedGridOnPatch(fine, fln, block_number); } - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(fln, fdx); - d_mblk_geometry->getDx(cln, cdx); + double fdx[SAMRAI::MAX_DIM_VAL]; + double cdx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(fln, block_number, fdx); + d_mblk_geometry->getDx(cln, block_number, cdx); d_cell_cons_linear_refine_op->setDx(fln, fdx); d_cell_cons_linear_refine_op->setDx(cln, cdx); @@ -1935,10 +1929,10 @@ void MblkLinAdv::preprocessCoarsen( setMappedGridOnPatch(fine, fln, block_number); } - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(fln, fdx); - d_mblk_geometry->getDx(cln, cdx); + double fdx[SAMRAI::MAX_DIM_VAL]; + double cdx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(fln, block_number, fdx); + d_mblk_geometry->getDx(cln, block_number, cdx); d_cell_cons_coarsen_op->setDx(fln, fdx); d_side_cons_coarsen_op->setDx(fln, fdx); @@ -1990,12 +1984,14 @@ void MblkLinAdv::tagGradientDetectorCells( /* * Set the dx in the operators */ - double dx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - d_mblk_geometry->getDx(level_number, dx); + double dx[SAMRAI::MAX_DIM_VAL]; + d_mblk_geometry->getDx(level_number, + patch.getBox().getBlockId().getBlockValue(), dx); boost::shared_ptr > tags( - patch.getPatchData(tag_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_indx))); + TBOX_ASSERT(tags); hier::Box pbox(patch.getBox()); @@ -2023,15 +2019,15 @@ void MblkLinAdv::tagGradientDetectorCells( * specified time interval. If so, apply appropriate tagging for * the level. */ - for (int ncrit = 0; ncrit < d_refinement_criteria.getSize(); ncrit++) { + for (int ncrit = 0; + ncrit < static_cast(d_refinement_criteria.size()); ++ncrit) { string ref = d_refinement_criteria[ncrit]; boost::shared_ptr > var( - patch.getPatchData(d_uval, getDataContext()), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + patch.getPatchData(d_uval, getDataContext()))); TBOX_ASSERT(var); -#endif + hier::IntVector vghost(var->getGhostCellWidth()); hier::IntVector tagghost(tags->getGhostCellWidth()); @@ -2041,19 +2037,19 @@ void MblkLinAdv::tagGradientDetectorCells( bool time_allowed = false; if (ref == "UVAL_DEVIATION") { - size = d_dev_tol.getSize(); + size = static_cast(d_dev_tol.size()); tol = ((level_number < size) ? d_dev_tol[level_number] : d_dev_tol[size - 1]); - size = d_dev.getSize(); + size = static_cast(d_dev.size()); double dev = ((level_number < size) ? d_dev[level_number] : d_dev[size - 1]); - size = d_dev_time_min.getSize(); + size = static_cast(d_dev_time_min.size()); double time_min = ((level_number < size) ? d_dev_time_min[level_number] : d_dev_time_min[size - 1]); - size = d_dev_time_max.getSize(); + size = static_cast(d_dev_time_max.size()); double time_max = ((level_number < size) ? d_dev_time_max[level_number] : d_dev_time_max[size - 1]); @@ -2067,8 +2063,9 @@ void MblkLinAdv::tagGradientDetectorCells( * RICHARDSON_NEWLY_TAGGED since these were set most recently * by Richardson extrapolation. */ - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { double locden = tol; int tag_val = (*tags)(*ic, 0); if (tag_val) { @@ -2085,15 +2082,15 @@ void MblkLinAdv::tagGradientDetectorCells( } if (ref == "UVAL_GRADIENT") { - size = d_grad_tol.getSize(); + size = static_cast(d_grad_tol.size()); tol = ((level_number < size) ? d_grad_tol[level_number] : d_grad_tol[size - 1]); - size = d_grad_time_min.getSize(); + size = static_cast(d_grad_time_min.size()); double time_min = ((level_number < size) ? d_grad_time_min[level_number] : d_grad_time_min[size - 1]); - size = d_grad_time_max.getSize(); + size = static_cast(d_grad_time_max.size()); double time_max = ((level_number < size) ? d_grad_time_max[level_number] : d_grad_time_max[size - 1]); @@ -2102,7 +2099,7 @@ void MblkLinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectgrad2d, DETECTGRAD2D) ( + SAMRAI_F77_FUNC(detectgrad2d, DETECTGRAD2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2113,7 +2110,7 @@ void MblkLinAdv::tagGradientDetectorCells( tags->getPointer(), temp_tags->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectgrad3d, DETECTGRAD3D) ( + SAMRAI_F77_FUNC(detectgrad3d, DETECTGRAD3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2129,19 +2126,19 @@ void MblkLinAdv::tagGradientDetectorCells( } if (ref == "UVAL_SHOCK") { - size = d_shock_tol.getSize(); + size = static_cast(d_shock_tol.size()); tol = ((level_number < size) ? d_shock_tol[level_number] : d_shock_tol[size - 1]); - size = d_shock_onset.getSize(); + size = static_cast(d_shock_onset.size()); onset = ((level_number < size) ? d_shock_onset[level_number] : d_shock_onset[size - 1]); - size = d_shock_time_min.getSize(); + size = static_cast(d_shock_time_min.size()); double time_min = ((level_number < size) ? d_shock_time_min[level_number] : d_shock_time_min[size - 1]); - size = d_shock_time_max.getSize(); + size = static_cast(d_shock_time_max.size()); double time_max = ((level_number < size) ? d_shock_time_max[level_number] : d_shock_time_max[size - 1]); @@ -2150,7 +2147,7 @@ void MblkLinAdv::tagGradientDetectorCells( if (time_allowed) { if (d_dim == tbox::Dimension(2)) { - F77_FUNC(detectshock2d, DETECTSHOCK2D) ( + SAMRAI_F77_FUNC(detectshock2d, DETECTSHOCK2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2162,7 +2159,7 @@ void MblkLinAdv::tagGradientDetectorCells( tags->getPointer(), temp_tags->getPointer()); } if (d_dim == tbox::Dimension(3)) { - F77_FUNC(detectshock3d, DETECTSHOCK3D) ( + SAMRAI_F77_FUNC(detectshock3d, DETECTSHOCK3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), vghost(0), tagghost(0), d_nghosts(0), vghost(1), tagghost(1), d_nghosts(1), @@ -2186,8 +2183,9 @@ void MblkLinAdv::tagGradientDetectorCells( * to be the designated "refine_tag_val". */ if (uses_richardson_extrapolation_too) { - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { if ((*tags)(*ic, 0) == RICHARDSON_ALREADY_TAGGED || (*tags)(*ic, 0) == RICHARDSON_NEWLY_TAGGED) { (*temp_tags)(*ic, 0) = refine_tag_val; @@ -2198,8 +2196,9 @@ void MblkLinAdv::tagGradientDetectorCells( // // Update tags // - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); + ic != icend; ++ic) { (*tags)(*ic, 0) = (*temp_tags)(*ic, 0); } @@ -2218,8 +2217,7 @@ void MblkLinAdv::tagGradientDetectorCells( void MblkLinAdv::fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry) @@ -2228,7 +2226,6 @@ void MblkLinAdv::fillSingularityBoundaryConditions( NULL_USE(patch); NULL_USE(encon_level); NULL_USE(dst_to_encon); - NULL_USE(fill_time); NULL_USE(fill_box); NULL_USE(boundary_box); NULL_USE(grid_geometry); @@ -2246,14 +2243,12 @@ void MblkLinAdv::setMappedGridOnPatch( const int level_number, const int block_number) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(level_number >= 0); -#endif // compute level domain const boost::shared_ptr patch_geom( patch.getPatchGeometry()); - hier::IntVector ratio = patch_geom->getRatio(); + const hier::IntVector& ratio = patch_geom->getRatio(); hier::BoxContainer domain_boxes; d_grid_geometry->computePhysicalDomain(domain_boxes, ratio, hier::BlockId(block_number)); @@ -2286,9 +2281,7 @@ void MblkLinAdv::setMappedGridOnPatch( void MblkLinAdv::registerVisItDataWriter( boost::shared_ptr viz_writer) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(viz_writer); -#endif d_visit_writer = viz_writer; } #endif @@ -2310,13 +2303,13 @@ void MblkLinAdv::printClassData( os << "MblkLinAdv: this = " << (MblkLinAdv *)this << endl; os << "d_object_name = " << d_object_name << endl; os << "d_grid_geometry = " << endl; -// for (j=0; j < d_grid_geometry.getSize(); j++) { +// for (j=0; j < d_grid_geometry.getSize(); ++j) { // os << (*((boost::shared_ptr)(d_grid_geometry[j]))) << endl; // } os << "Parameters for numerical method ..." << endl; os << " d_advection_velocity = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_advection_velocity[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_advection_velocity[j] << " "; os << endl; os << " d_godunov_order = " << d_godunov_order << endl; os << " d_corner_transport = " << d_corner_transport << endl; @@ -2329,25 +2322,25 @@ void MblkLinAdv::printClassData( os << " d_radius = " << d_radius << endl; os << " d_center = "; - for (j = 0; j < d_dim.getValue(); j++) os << d_center[j] << " "; + for (j = 0; j < d_dim.getValue(); ++j) os << d_center[j] << " "; os << endl; os << " d_uval_inside = " << d_uval_inside << endl; os << " d_uval_outside = " << d_uval_outside << endl; os << " d_number_of_intervals = " << d_number_of_intervals << endl; os << " d_front_position = "; - for (k = 0; k < d_number_of_intervals - 1; k++) { + for (k = 0; k < d_number_of_intervals - 1; ++k) { os << d_front_position[k] << " "; } os << endl; os << " d_interval_uval = " << endl; - for (k = 0; k < d_number_of_intervals; k++) { + for (k = 0; k < d_number_of_intervals; ++k) { os << " " << d_interval_uval[k] << endl; } os << " Boundary condition data " << endl; if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { @@ -2356,7 +2349,7 @@ void MblkLinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " @@ -2364,7 +2357,7 @@ void MblkLinAdv::printClassData( } } if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { @@ -2373,14 +2366,14 @@ void MblkLinAdv::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " @@ -2390,76 +2383,76 @@ void MblkLinAdv::printClassData( os << " Refinement criteria parameters " << endl; - for (j = 0; j < d_refinement_criteria.getSize(); j++) { + for (j = 0; j < static_cast(d_refinement_criteria.size()); ++j) { os << " d_refinement_criteria[" << j << "] = " << d_refinement_criteria[j] << endl; } os << endl; - for (j = 0; j < d_dev_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_tol.size()); ++j) { os << " d_dev_tol[" << j << "] = " << d_dev_tol[j] << endl; } - for (j = 0; j < d_dev.getSize(); j++) { + for (j = 0; j < static_cast(d_dev.size()); ++j) { os << " d_dev[" << j << "] = " << d_dev[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_max.size()); ++j) { os << " d_dev_time_max[" << j << "] = " << d_dev_time_max[j] << endl; } os << endl; - for (j = 0; j < d_dev_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_dev_time_min.size()); ++j) { os << " d_dev_time_min[" << j << "] = " << d_dev_time_min[j] << endl; } os << endl; - for (j = 0; j < d_grad_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_tol.size()); ++j) { os << " d_grad_tol[" << j << "] = " << d_grad_tol[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_max.size()); ++j) { os << " d_grad_time_max[" << j << "] = " << d_grad_time_max[j] << endl; } os << endl; - for (j = 0; j < d_grad_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_grad_time_min.size()); ++j) { os << " d_grad_time_min[" << j << "] = " << d_grad_time_min[j] << endl; } os << endl; - for (j = 0; j < d_shock_onset.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_onset.size()); ++j) { os << " d_shock_onset[" << j << "] = " << d_shock_onset[j] << endl; } os << endl; - for (j = 0; j < d_shock_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_tol.size()); ++j) { os << " d_shock_tol[" << j << "] = " << d_shock_tol[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_max.size()); ++j) { os << " d_shock_time_max[" << j << "] = " << d_shock_time_max[j] << endl; } os << endl; - for (j = 0; j < d_shock_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_shock_time_min.size()); ++j) { os << " d_shock_time_min[" << j << "] = " << d_shock_time_min[j] << endl; } os << endl; - for (j = 0; j < d_rich_tol.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_tol.size()); ++j) { os << " d_rich_tol[" << j << "] = " << d_rich_tol[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_max.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_max.size()); ++j) { os << " d_rich_time_max[" << j << "] = " << d_rich_time_max[j] << endl; } os << endl; - for (j = 0; j < d_rich_time_min.getSize(); j++) { + for (j = 0; j < static_cast(d_rich_time_min.size()); ++j) { os << " d_rich_time_min[" << j << "] = " << d_rich_time_min[j] << endl; } @@ -2479,9 +2472,7 @@ void MblkLinAdv::getFromInput( boost::shared_ptr input_db, bool is_from_restart) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(input_db); -#endif boost::shared_ptr db(input_db->getDatabase("MblkLinAdv")); @@ -2540,12 +2531,11 @@ void MblkLinAdv::getFromInput( if (db->keyExists("Refinement_data")) { boost::shared_ptr refine_db( db->getDatabase("Refinement_data")); - tbox::Array refinement_keys = refine_db->getAllKeys(); - int num_keys = refinement_keys.getSize(); + std::vector refinement_keys = refine_db->getAllKeys(); + int num_keys = static_cast(refinement_keys.size()); if (refine_db->keyExists("refine_criteria")) { - d_refinement_criteria = - refine_db->getStringArray("refine_criteria"); + d_refinement_criteria = refine_db->getStringVector("refine_criteria"); } else { TBOX_WARNING( d_object_name << ": " @@ -2553,10 +2543,10 @@ void MblkLinAdv::getFromInput( << " RefinementData. No refinement will occur." << endl); } - tbox::Array ref_keys_defined(num_keys); + std::vector ref_keys_defined(num_keys); int def_key_cnt = 0; boost::shared_ptr error_db; - for (int i = 0; i < refinement_keys.getSize(); i++) { + for (int i = 0; i < num_keys; ++i) { string error_key = refinement_keys[i]; error_db.reset(); @@ -2575,14 +2565,13 @@ void MblkLinAdv::getFromInput( } else { error_db = refine_db->getDatabase(error_key); ref_keys_defined[def_key_cnt] = error_key; - def_key_cnt++; + ++def_key_cnt; } if (error_db && error_key == "UVAL_DEVIATION") { if (error_db->keyExists("dev_tol")) { - d_dev_tol = - error_db->getDoubleArray("dev_tol"); + d_dev_tol = error_db->getDoubleVector("dev_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2591,8 +2580,7 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("uval_dev")) { - d_dev = - error_db->getDoubleArray("uval_dev"); + d_dev = error_db->getDoubleVector("uval_dev"); } else { TBOX_ERROR( d_object_name << ": " @@ -2601,18 +2589,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_dev_time_max = - error_db->getDoubleArray("time_max"); + d_dev_time_max = error_db->getDoubleVector("time_max"); } else { - d_dev_time_max.resizeArray(1); + d_dev_time_max.resize(1); d_dev_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_dev_time_min = - error_db->getDoubleArray("time_min"); + d_dev_time_min = error_db->getDoubleVector("time_min"); } else { - d_dev_time_min.resizeArray(1); + d_dev_time_min.resize(1); d_dev_time_min[0] = 0.; } @@ -2621,8 +2607,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_GRADIENT") { if (error_db->keyExists("grad_tol")) { - d_grad_tol = - error_db->getDoubleArray("grad_tol"); + d_grad_tol = error_db->getDoubleVector("grad_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2631,18 +2616,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_grad_time_max = - error_db->getDoubleArray("time_max"); + d_grad_time_max = error_db->getDoubleVector("time_max"); } else { - d_grad_time_max.resizeArray(1); + d_grad_time_max.resize(1); d_grad_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_grad_time_min = - error_db->getDoubleArray("time_min"); + d_grad_time_min = error_db->getDoubleVector("time_min"); } else { - d_grad_time_min.resizeArray(1); + d_grad_time_min.resize(1); d_grad_time_min[0] = 0.; } @@ -2651,8 +2634,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_SHOCK") { if (error_db->keyExists("shock_onset")) { - d_shock_onset = - error_db->getDoubleArray("shock_onset"); + d_shock_onset = error_db->getDoubleVector("shock_onset"); } else { TBOX_ERROR( d_object_name << ": " @@ -2661,8 +2643,7 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("shock_tol")) { - d_shock_tol = - error_db->getDoubleArray("shock_tol"); + d_shock_tol = error_db->getDoubleVector("shock_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2671,18 +2652,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_shock_time_max = - error_db->getDoubleArray("time_max"); + d_shock_time_max = error_db->getDoubleVector("time_max"); } else { - d_shock_time_max.resizeArray(1); + d_shock_time_max.resize(1); d_shock_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_shock_time_min = - error_db->getDoubleArray("time_min"); + d_shock_time_min = error_db->getDoubleVector("time_min"); } else { - d_shock_time_min.resizeArray(1); + d_shock_time_min.resize(1); d_shock_time_min[0] = 0.; } @@ -2691,8 +2670,7 @@ void MblkLinAdv::getFromInput( if (error_db && error_key == "UVAL_RICHARDSON") { if (error_db->keyExists("rich_tol")) { - d_rich_tol = - error_db->getDoubleArray("rich_tol"); + d_rich_tol = error_db->getDoubleVector("rich_tol"); } else { TBOX_ERROR( d_object_name << ": " @@ -2701,18 +2679,16 @@ void MblkLinAdv::getFromInput( } if (error_db->keyExists("time_max")) { - d_rich_time_max = - error_db->getDoubleArray("time_max"); + d_rich_time_max = error_db->getDoubleVector("time_max"); } else { - d_rich_time_max.resizeArray(1); + d_rich_time_max.resize(1); d_rich_time_max[0] = tbox::MathUtilities::getMax(); } if (error_db->keyExists("time_min")) { - d_rich_time_min = - error_db->getDoubleArray("time_min"); + d_rich_time_min = error_db->getDoubleVector("time_min"); } else { - d_rich_time_min.resizeArray(1); + d_rich_time_min.resize(1); d_rich_time_min[0] = 0.; } @@ -2788,7 +2764,6 @@ void MblkLinAdv::getFromInput( (d_data_problem == "SINE_CONSTANT_Y") || (d_data_problem == "SINE_CONSTANT_Z"))) { - int idir = 0; if (d_data_problem == "PIECEWISE_CONSTANT_Y") { if (d_dim < tbox::Dimension(2)) { TBOX_ERROR( @@ -2796,7 +2771,6 @@ void MblkLinAdv::getFromInput( << "problem invalid in 1 dimension." << endl); } - idir = 1; } if (d_data_problem == "PIECEWISE_CONSTANT_Z") { @@ -2805,13 +2779,12 @@ void MblkLinAdv::getFromInput( d_object_name << ": `PIECEWISE_CONSTANT_Z' " << "problem invalid in 1 or 2 dimensions." << endl); } - idir = 2; } - tbox::Array init_data_keys = init_data_db->getAllKeys(); + std::vector init_data_keys = init_data_db->getAllKeys(); if (init_data_db->keyExists("front_position")) { - d_front_position = init_data_db->getDoubleArray("front_position"); + d_front_position = init_data_db->getDoubleVector("front_position"); } else { TBOX_ERROR(d_object_name << ": " << "`front_position' input required for " @@ -2819,10 +2792,10 @@ void MblkLinAdv::getFromInput( } d_number_of_intervals = - tbox::MathUtilities::Min(d_front_position.getSize() + 1, - init_data_keys.getSize() - 1); + tbox::MathUtilities::Min(static_cast(d_front_position.size()) + 1, + static_cast(init_data_keys.size()) - 1); - d_interval_uval.resizeArray(d_number_of_intervals); + d_interval_uval.resize(d_number_of_intervals); int i = 0; int nkey = 0; @@ -2830,7 +2803,7 @@ void MblkLinAdv::getFromInput( while (!found_interval_data && (i < d_number_of_intervals) - && (nkey < init_data_keys.getSize())) { + && (nkey < static_cast(init_data_keys.size()))) { if (!(init_data_keys[nkey] == "front_position")) { @@ -2844,13 +2817,13 @@ void MblkLinAdv::getFromInput( << "`uval' data missing in input for key = " << init_data_keys[nkey] << endl); } - i++; + ++i; found_interval_data = (i == d_number_of_intervals); } - nkey++; + ++nkey; } @@ -2891,8 +2864,8 @@ void MblkLinAdv::getFromInput( hier::IntVector periodic = d_grid_geometry->getPeriodicShift( hier::IntVector(d_dim, 1)); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } /* @@ -2909,14 +2882,14 @@ void MblkLinAdv::getFromInput( db->getDatabase("Boundary_data")); if (d_dim == tbox::Dimension(2)) { - SkeletonBoundaryUtilities2::readBoundaryInput(this, + SkeletonBoundaryUtilities2::getFromInput(this, bdry_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); } if (d_dim == tbox::Dimension(3)) { - SkeletonBoundaryUtilities3::readBoundaryInput(this, + SkeletonBoundaryUtilities3::getFromInput(this, bdry_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, @@ -2940,29 +2913,31 @@ void MblkLinAdv::getFromInput( ************************************************************************* */ -void MblkLinAdv::putToDatabase( - const boost::shared_ptr& db) const +void MblkLinAdv::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("MBLKLINADV_VERSION", MBLKLINADV_VERSION); + restart_db->putInteger("MBLKLINADV_VERSION", MBLKLINADV_VERSION); - db->putDoubleArray("d_advection_velocity", d_advection_velocity, d_dim.getValue()); + restart_db->putDoubleArray("d_advection_velocity", + d_advection_velocity, + d_dim.getValue()); - db->putInteger("d_godunov_order", d_godunov_order); - db->putString("d_corner_transport", d_corner_transport); - db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); - db->putIntegerArray("d_fluxghosts", &d_fluxghosts[0], d_dim.getValue()); + restart_db->putInteger("d_godunov_order", d_godunov_order); + restart_db->putString("d_corner_transport", d_corner_transport); + restart_db->putIntegerArray("d_nghosts", &d_nghosts[0], d_dim.getValue()); + restart_db->putIntegerArray("d_fluxghosts", + &d_fluxghosts[0], + d_dim.getValue()); - db->putString("d_data_problem", d_data_problem); + restart_db->putString("d_data_problem", d_data_problem); if (d_data_problem == "SPHERE") { - db->putDouble("d_radius", d_radius); - db->putDoubleArray("d_center", d_center, d_dim.getValue()); - db->putDouble("d_uval_inside", d_uval_inside); - db->putDouble("d_uval_outside", d_uval_outside); + restart_db->putDouble("d_radius", d_radius); + restart_db->putDoubleArray("d_center", d_center, d_dim.getValue()); + restart_db->putDouble("d_uval_inside", d_uval_inside); + restart_db->putDouble("d_uval_outside", d_uval_outside); } if ((d_data_problem == "PIECEWISE_CONSTANT_X") || @@ -2971,43 +2946,51 @@ void MblkLinAdv::putToDatabase( (d_data_problem == "SINE_CONSTANT_X") || (d_data_problem == "SINE_CONSTANT_Y") || (d_data_problem == "SINE_CONSTANT_Z")) { - db->putInteger("d_number_of_intervals", d_number_of_intervals); + restart_db->putInteger("d_number_of_intervals", d_number_of_intervals); if (d_number_of_intervals > 0) { - db->putDoubleArray("d_front_position", d_front_position); - db->putDoubleArray("d_interval_uval", d_interval_uval); + restart_db->putDoubleVector("d_front_position", d_front_position); + restart_db->putDoubleVector("d_interval_uval", d_interval_uval); } } - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putIntegerVector("d_scalar_bdry_edge_conds", + d_scalar_bdry_edge_conds); + restart_db->putIntegerVector("d_scalar_bdry_node_conds", + d_scalar_bdry_node_conds); - db->putDoubleArray("d_bdry_edge_uval", d_bdry_edge_uval); - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_uval", d_bdry_face_uval); + if (d_dim == tbox::Dimension(2)) { + restart_db->putDoubleVector("d_bdry_edge_uval", d_bdry_edge_uval); + } + if (d_dim == tbox::Dimension(3)) { + restart_db->putIntegerVector("d_scalar_bdry_face_conds", + d_scalar_bdry_face_conds); + restart_db->putDoubleVector("d_bdry_face_uval", d_bdry_face_uval); + } - if (d_refinement_criteria.getSize() > 0) { - db->putStringArray("d_refinement_criteria", d_refinement_criteria); + if (d_refinement_criteria.size() > 0) { + restart_db->putStringVector("d_refinement_criteria", + d_refinement_criteria); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - db->putDoubleArray("d_dev_tol", d_dev_tol); - db->putDoubleArray("d_dev", d_dev); - db->putDoubleArray("d_dev_time_max", d_dev_time_max); - db->putDoubleArray("d_dev_time_min", d_dev_time_min); + restart_db->putDoubleVector("d_dev_tol", d_dev_tol); + restart_db->putDoubleVector("d_dev", d_dev); + restart_db->putDoubleVector("d_dev_time_max", d_dev_time_max); + restart_db->putDoubleVector("d_dev_time_min", d_dev_time_min); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - db->putDoubleArray("d_grad_tol", d_grad_tol); - db->putDoubleArray("d_grad_time_max", d_grad_time_max); - db->putDoubleArray("d_grad_time_min", d_grad_time_min); + restart_db->putDoubleVector("d_grad_tol", d_grad_tol); + restart_db->putDoubleVector("d_grad_time_max", d_grad_time_max); + restart_db->putDoubleVector("d_grad_time_min", d_grad_time_min); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - db->putDoubleArray("d_shock_onset", d_shock_onset); - db->putDoubleArray("d_shock_tol", d_shock_tol); - db->putDoubleArray("d_shock_time_max", d_shock_time_max); - db->putDoubleArray("d_shock_time_min", d_shock_time_min); + restart_db->putDoubleVector("d_shock_onset", d_shock_onset); + restart_db->putDoubleVector("d_shock_tol", d_shock_tol); + restart_db->putDoubleVector("d_shock_time_max", d_shock_time_max); + restart_db->putDoubleVector("d_shock_time_min", d_shock_time_min); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - db->putDoubleArray("d_rich_tol", d_rich_tol); - db->putDoubleArray("d_rich_time_max", d_rich_time_max); - db->putDoubleArray("d_rich_time_min", d_rich_time_min); + restart_db->putDoubleVector("d_rich_tol", d_rich_tol); + restart_db->putDoubleVector("d_rich_time_max", d_rich_time_max); + restart_db->putDoubleVector("d_rich_time_min", d_rich_time_min); } } @@ -3062,45 +3045,46 @@ void MblkLinAdv::getFromRestart() (d_data_problem == "SINE_CONSTANT_Z")) { d_number_of_intervals = db->getInteger("d_number_of_intervals"); if (d_number_of_intervals > 0) { - d_front_position = db->getDoubleArray("d_front_position"); - d_interval_uval = db->getDoubleArray("d_interval_uval"); + d_front_position = db->getDoubleVector("d_front_position"); + d_interval_uval = db->getDoubleVector("d_interval_uval"); } } - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); + d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); + d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_uval = db->getDoubleArray("d_bdry_edge_uval"); + d_bdry_edge_uval = db->getDoubleVector("d_bdry_edge_uval"); } if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); + d_scalar_bdry_face_conds = + db->getIntegerVector("d_scalar_bdry_face_conds"); - d_bdry_face_uval = db->getDoubleArray("d_bdry_face_uval"); + d_bdry_face_uval = db->getDoubleVector("d_bdry_face_uval"); } if (db->keyExists("d_refinement_criteria")) { - d_refinement_criteria = db->getStringArray("d_refinement_criteria"); + d_refinement_criteria = db->getStringVector("d_refinement_criteria"); } - for (int i = 0; i < d_refinement_criteria.getSize(); i++) { + for (int i = 0; i < static_cast(d_refinement_criteria.size()); ++i) { if (d_refinement_criteria[i] == "UVAL_DEVIATION") { - d_dev_tol = db->getDoubleArray("d_dev_tol"); - d_dev_time_max = db->getDoubleArray("d_dev_time_max"); - d_dev_time_min = db->getDoubleArray("d_dev_time_min"); + d_dev_tol = db->getDoubleVector("d_dev_tol"); + d_dev_time_max = db->getDoubleVector("d_dev_time_max"); + d_dev_time_min = db->getDoubleVector("d_dev_time_min"); } else if (d_refinement_criteria[i] == "UVAL_GRADIENT") { - d_grad_tol = db->getDoubleArray("d_grad_tol"); - d_grad_time_max = db->getDoubleArray("d_grad_time_max"); - d_grad_time_min = db->getDoubleArray("d_grad_time_min"); + d_grad_tol = db->getDoubleVector("d_grad_tol"); + d_grad_time_max = db->getDoubleVector("d_grad_time_max"); + d_grad_time_min = db->getDoubleVector("d_grad_time_min"); } else if (d_refinement_criteria[i] == "UVAL_SHOCK") { - d_shock_onset = db->getDoubleArray("d_shock_onset"); - d_shock_tol = db->getDoubleArray("d_shock_tol"); - d_shock_time_max = db->getDoubleArray("d_shock_time_max"); - d_shock_time_min = db->getDoubleArray("d_shock_time_min"); + d_shock_onset = db->getDoubleVector("d_shock_onset"); + d_shock_tol = db->getDoubleVector("d_shock_tol"); + d_shock_time_max = db->getDoubleVector("d_shock_time_max"); + d_shock_time_min = db->getDoubleVector("d_shock_time_min"); } else if (d_refinement_criteria[i] == "UVAL_RICHARDSON") { - d_rich_tol = db->getDoubleArray("d_rich_tol"); - d_rich_time_max = db->getDoubleArray("d_rich_time_max"); - d_rich_time_min = db->getDoubleArray("d_rich_time_min"); + d_rich_tol = db->getDoubleVector("d_rich_tol"); + d_rich_time_max = db->getDoubleVector("d_rich_time_max"); + d_rich_time_min = db->getDoubleVector("d_rich_time_min"); } } @@ -3120,10 +3104,9 @@ void MblkLinAdv::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif + if (d_dim == tbox::Dimension(2)) { readStateDataEntry(db, db_name, @@ -3142,14 +3125,12 @@ void MblkLinAdv::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval) + std::vector& uval) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(uval.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(uval.size()) > array_indx); if (db->keyExists("uval")) { uval[array_indx] = db->getDouble("uval"); @@ -3173,7 +3154,7 @@ void MblkLinAdv::checkBoundaryData( int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_check, - const tbox::Array& scalar_bconds) const + const std::vector& scalar_bconds) const { #ifdef DEBUG_CHECK_ASSERTIONS if (d_dim == tbox::Dimension(2)) { @@ -3189,90 +3170,64 @@ void MblkLinAdv::checkBoundaryData( const boost::shared_ptr pgeom( patch.getPatchGeometry()); - const tbox::Array bdry_boxes = + const std::vector& bdry_boxes = pgeom->getCodimensionBoundaries(btype); hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); - for (int i = 0; i < bdry_boxes.getSize(); i++) { + for (int i = 0; i < static_cast(bdry_boxes.size()); ++i) { hier::BoundaryBox bbox = bdry_boxes[i]; -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(bbox.getBoundaryType() == btype); -#endif int bloc = bbox.getLocationIndex(); - int bscalarcase, refbdryloc; + int bscalarcase = 0, refbdryloc = 0; if (d_dim == tbox::Dimension(2)) { if (btype == Bdry::EDGE2D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_2D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else { // btype == Bdry::NODE2D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_2D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_2D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_edge[bloc]; } } if (d_dim == tbox::Dimension(3)) { if (btype == Bdry::FACE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_FACES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_FACES); bscalarcase = scalar_bconds[bloc]; refbdryloc = bloc; } else if (btype == Bdry::EDGE3D) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_EDGES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_EDGES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_edge_bdry_face[bloc]; } else { // btype == Bdry::NODE3D -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(scalar_bconds.getSize() == NUM_3D_NODES); -#endif + TBOX_ASSERT(static_cast(scalar_bconds.size()) == NUM_3D_NODES); bscalarcase = scalar_bconds[bloc]; refbdryloc = d_node_bdry_face[bloc]; } } - int num_bad_values = 0; - if (d_dim == tbox::Dimension(2)) { - num_bad_values = - SkeletonBoundaryUtilities2::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_edge_uval[refbdryloc]); + SkeletonBoundaryUtilities2::checkBdryData( + d_uval->getName(), + patch, + vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, + ghost_width_to_check, + bbox, + bscalarcase, + d_bdry_edge_uval[refbdryloc]); } if (d_dim == tbox::Dimension(3)) { - num_bad_values = - SkeletonBoundaryUtilities3::checkBdryData( - d_uval->getName(), - patch, - vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, - ghost_width_to_check, - bbox, - bscalarcase, - d_bdry_face_uval[refbdryloc]); - } -#if (TESTING == 1) - if (num_bad_values > 0) { - tbox::perr << "\nMblkLinAdv Boundary Test FAILED: \n" - << " " << num_bad_values - << " bad UVAL values found for\n" - << " boundary type " << btype << " at location " - << bloc << endl; + SkeletonBoundaryUtilities3::checkBdryData( + d_uval->getName(), + patch, + vdb->mapVariableAndContextToIndex(d_uval, getDataContext()), 0, + ghost_width_to_check, + bbox, + bscalarcase, + d_bdry_face_uval[refbdryloc]); } -#endif - } } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.h index e35f54b7..dfa364f8 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdv.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Numerical routines for single patch in linear advection ex. * ************************************************************************/ @@ -23,10 +23,11 @@ #include "SAMRAI/pdat/FaceVariable.h" #include "SAMRAI/appu/BoundaryUtilityStrategy.h" -#include "SkeletonCellDoubleConservativeLinearRefine.h" -#include "SkeletonCellDoubleWeightedAverage.h" +#include "test/testlib/SkeletonCellDoubleConservativeLinearRefine.h" +#include "test/testlib/SkeletonCellDoubleWeightedAverage.h" #include "SkeletonOutersideDoubleWeightedAverage.h" #include +#include using namespace std; #define included_String #include "SAMRAI/hier/TimeInterpolateOperator.h" @@ -35,10 +36,10 @@ using namespace std; // Local classes used for this application #include "MblkGeometry.h" -#include "MblkHyperbolicLevelIntegrator.h" -#include "MblkHyperbolicPatchStrategy.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicPatchStrategy.h" -#include +#include "boost/shared_ptr.hpp" /** * The MblkLinAdv class provides routines for a sample application code that @@ -64,6 +65,7 @@ using namespace SAMRAI; class MblkLinAdv: public tbox::Serializable, public MblkHyperbolicPatchStrategy, + public xfer::SingularityPatchStrategy, public appu::BoundaryUtilityStrategy { public: @@ -110,7 +112,7 @@ class MblkLinAdv: * In other words, variables are registered according to their role * in the integration process (e.g., time-dependent, flux, etc.). * This routine also registers variables for plotting with the - * Vis writer (Vizamrai or VisIt). + * Vis writer. */ void registerModelVariables( @@ -237,13 +239,11 @@ class MblkLinAdv: fillSingularityBoundaryConditions( hier::Patch& patch, const hier::PatchLevel& encon_level, - const hier::Connector& dst_to_encon, - const double fill_time, + boost::shared_ptr dst_to_encon, const hier::Box& fill_box, const hier::BoundaryBox& boundary_box, const boost::shared_ptr& grid_geometry); - /** * Build mapped grid on patch */ @@ -260,8 +260,8 @@ class MblkLinAdv: * declared in the tbox::Serializable abstract base class. */ void - putToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -283,7 +283,10 @@ class MblkLinAdv: string& db_name, int bdry_location_index) { - } + NULL_USE(db); + NULL_USE(db_name); + NULL_USE(bdry_location_index); + } hier::IntVector getMultiblockRefineOpStencilWidth() const; @@ -320,7 +323,7 @@ class MblkLinAdv: */ void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); void @@ -331,7 +334,7 @@ class MblkLinAdv: boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); + std::vector& uval); /* * Private member function to check correctness of boundary data. @@ -341,7 +344,7 @@ class MblkLinAdv: int btype, const hier::Patch& patch, const hier::IntVector& ghost_width_to_fill, - const tbox::Array& scalar_bconds) const; + const std::vector& scalar_bconds) const; /* * Three-dimensional flux computation routines corresponding to @@ -366,7 +369,7 @@ class MblkLinAdv: const tbox::Dimension d_dim; /* - * We cache pointers to the grid geometry and Vizamrai data writer + * We cache pointers to the grid geometry and VisIt data writer * object to set up initial data, set physical boundary conditions, * and register plot variables. */ @@ -396,12 +399,11 @@ class MblkLinAdv: * boost::shared_ptr to grid - [xyz] */ boost::shared_ptr > d_xyz; - int d_xyz_id; /** * linear advection velocity vector */ - double d_advection_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_advection_velocity[SAMRAI::MAX_DIM_VAL]; /* * Parameters for numerical method: @@ -433,7 +435,7 @@ class MblkLinAdv: * Input for SPHERE problem */ double d_radius; - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[SAMRAI::MAX_DIM_VAL]; double d_uval_inside; double d_uval_outside; @@ -441,8 +443,8 @@ class MblkLinAdv: * Input for FRONT problem */ int d_number_of_intervals; - tbox::Array d_front_position; - tbox::Array d_interval_uval; + std::vector d_front_position; + std::vector d_interval_uval; /* * Boundary condition cases and boundary values. @@ -451,50 +453,50 @@ class MblkLinAdv: * * Input file values are read into these arrays. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // 3D only + std::vector d_scalar_bdry_edge_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_scalar_bdry_face_conds; // 3D only /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_node_bdry_edge; // 2D only - tbox::Array d_edge_bdry_face; // 3D only - tbox::Array d_node_bdry_face; // 3D only + std::vector d_node_bdry_edge; // 2D only + std::vector d_edge_bdry_face; // 3D only + std::vector d_node_bdry_face; // 3D only /* - * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. + * Vectors of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_uval; - tbox::Array d_bdry_face_uval; + std::vector d_bdry_edge_uval; + std::vector d_bdry_face_uval; /* * Input for Sine problem initialization */ double d_amplitude; - double d_frequency[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_frequency[SAMRAI::MAX_DIM_VAL]; /* * Refinement criteria parameters for gradient detector and * Richardson extrapolation. */ - tbox::Array d_refinement_criteria; - tbox::Array d_dev_tol; - tbox::Array d_dev; - tbox::Array d_dev_time_max; - tbox::Array d_dev_time_min; - tbox::Array d_grad_tol; - tbox::Array d_grad_time_max; - tbox::Array d_grad_time_min; - tbox::Array d_shock_onset; - tbox::Array d_shock_tol; - tbox::Array d_shock_time_max; - tbox::Array d_shock_time_min; - tbox::Array d_rich_tol; - tbox::Array d_rich_time_max; - tbox::Array d_rich_time_min; + std::vector d_refinement_criteria; + std::vector d_dev_tol; + std::vector d_dev; + std::vector d_dev_time_max; + std::vector d_dev_time_min; + std::vector d_grad_tol; + std::vector d_grad_time_max; + std::vector d_grad_time_min; + std::vector d_shock_onset; + std::vector d_shock_tol; + std::vector d_shock_time_max; + std::vector d_shock_time_min; + std::vector d_rich_tol; + std::vector d_rich_time_max; + std::vector d_rich_time_min; /* * This class stores geometry information used for constructing the @@ -506,11 +508,11 @@ class MblkLinAdv: * Operators to be used with GridGeometry */ boost::shared_ptr - d_cell_cons_linear_refine_op; + d_cell_cons_linear_refine_op; boost::shared_ptr d_cell_cons_coarsen_op; boost::shared_ptr d_cell_time_interp_op; boost::shared_ptr - d_side_cons_coarsen_op; + d_side_cons_coarsen_op; }; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdvFort.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdvFort.h index 6de00706..5af53c17 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdvFort.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/MblkLinAdvFort.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: F77 external declarations for SAMRAI linear advection example. * ************************************************************************/ @@ -15,7 +15,7 @@ extern "C" { // 2D: -void F77_FUNC(linadvinit, LINADVINIT) ( +void SAMRAI_F77_FUNC(linadvinit, LINADVINIT) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -25,7 +25,7 @@ void F77_FUNC(linadvinit, LINADVINIT) ( const int&, const double *, const double *); -void F77_FUNC(linadvinitsine, LINADVINITSINE) ( +void SAMRAI_F77_FUNC(linadvinitsine, LINADVINITSINE) ( const int&, const double *, const double *, const double *, const double *, const int&, const int&, @@ -37,7 +37,7 @@ void F77_FUNC(linadvinitsine, LINADVINITSINE) ( const double *, const double *, const double&, const double *); -void F77_FUNC(initsphere, INITSPHERE) ( +void SAMRAI_F77_FUNC(initsphere, INITSPHERE) ( const int&, const int&, const int&, const int&, const int&, @@ -48,7 +48,7 @@ void F77_FUNC(initsphere, INITSPHERE) ( const double&, const double&, const double *, const double&); -void F77_FUNC(stabledt, STABLEDT) ( +void SAMRAI_F77_FUNC(stabledt, STABLEDT) ( const double *, const int&, const int&, const int&, const int&, @@ -58,14 +58,14 @@ void F77_FUNC(stabledt, STABLEDT) ( const double *, double&); -void F77_FUNC(inittraceflux, INITTRACEFLUX) ( +void SAMRAI_F77_FUNC(inittraceflux, INITTRACEFLUX) ( const int&, const int&, const int&, const int&, const double *, double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing0, CHARTRACING0) ( +void SAMRAI_F77_FUNC(chartracing0, CHARTRACING0) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -74,7 +74,7 @@ void F77_FUNC(chartracing0, CHARTRACING0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing1, CHARTRACING1) ( +void SAMRAI_F77_FUNC(chartracing1, CHARTRACING1) ( const double&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, const double *, @@ -82,7 +82,7 @@ void F77_FUNC(chartracing1, CHARTRACING1) ( double *, double *, double *, double *); -void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( +void SAMRAI_F77_FUNC(fluxcalculation, FLUXCALCULATION) ( const double&, const int&, const int&, const double *, const int&, const int&, @@ -92,7 +92,7 @@ void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec, FLUXCORREC) ( +void SAMRAI_F77_FUNC(fluxcorrec, FLUXCORREC) ( const double&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, @@ -100,7 +100,7 @@ void F77_FUNC(fluxcorrec, FLUXCORREC) ( double *, double *, double *, double *); -void F77_FUNC(consdiff, CONSDIFF) ( +void SAMRAI_F77_FUNC(consdiff, CONSDIFF) ( const int&, const int&, const int&, const int&, const double *, @@ -108,7 +108,7 @@ void F77_FUNC(consdiff, CONSDIFF) ( const double *, double *); -void F77_FUNC(getbdry, GETBDRY) ( +void SAMRAI_F77_FUNC(getbdry, GETBDRY) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -119,7 +119,7 @@ void F77_FUNC(getbdry, GETBDRY) ( double *, const double *, const double *, const int&); -void F77_FUNC(detectgrad, DETECTGRAD) ( +void SAMRAI_F77_FUNC(detectgrad, DETECTGRAD) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -130,7 +130,7 @@ void F77_FUNC(detectgrad, DETECTGRAD) ( const double *, int *, int *); -void F77_FUNC(detectshock, DETECTSHOCK) ( +void SAMRAI_F77_FUNC(detectshock, DETECTSHOCK) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -141,13 +141,13 @@ void F77_FUNC(detectshock, DETECTSHOCK) ( const double *, int *, int *); -void F77_FUNC(stufprobc, STUFPROBC) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); // in cartrefine2d.f: -void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( +void SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -158,7 +158,7 @@ void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( // 3D: -void F77_FUNC(linadvinit, LINADVINIT) ( +void SAMRAI_F77_FUNC(linadvinit, LINADVINIT) ( const int&, const double *, const double *, const double *, const int&, const int&, const int&, const int&, @@ -170,7 +170,7 @@ void F77_FUNC(linadvinit, LINADVINIT) ( const int&, const double *, const double *); -void F77_FUNC(linadvinitsine, LINADVINITSINE) ( +void SAMRAI_F77_FUNC(linadvinitsine, LINADVINITSINE) ( const int&, const double *, const double *, const double *, const double *, const int&, const int&, @@ -184,7 +184,7 @@ void F77_FUNC(linadvinitsine, LINADVINITSINE) ( const double *, const double *, const double&, const double *); -void F77_FUNC(initsphere, INITSPHERE) ( +void SAMRAI_F77_FUNC(initsphere, INITSPHERE) ( const int&, const int&, const int&, const int&, const int&, @@ -197,7 +197,7 @@ void F77_FUNC(initsphere, INITSPHERE) ( const double&, const double&, const double *, const double&); -void F77_FUNC(stabledt, STABLEDT) ( +void SAMRAI_F77_FUNC(stabledt, STABLEDT) ( const double *, const int&, const int&, const int&, const int&, @@ -209,7 +209,7 @@ void F77_FUNC(stabledt, STABLEDT) ( const double *, double&); -void F77_FUNC(inittraceflux, INITTRACEFLUX) ( +void SAMRAI_F77_FUNC(inittraceflux, INITTRACEFLUX) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -218,7 +218,7 @@ void F77_FUNC(inittraceflux, INITTRACEFLUX) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(chartracing0, CHARTRACING0) ( +void SAMRAI_F77_FUNC(chartracing0, CHARTRACING0) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -228,7 +228,7 @@ void F77_FUNC(chartracing0, CHARTRACING0) ( double *, double *, double *, double *); -void F77_FUNC(chartracing1, CHARTRACING1) ( +void SAMRAI_F77_FUNC(chartracing1, CHARTRACING1) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -237,7 +237,7 @@ void F77_FUNC(chartracing1, CHARTRACING1) ( double *, double *, double *, double *); -void F77_FUNC(chartracing2, CHARTRACING2) ( +void SAMRAI_F77_FUNC(chartracing2, CHARTRACING2) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double&, const double&, const int&, @@ -246,7 +246,7 @@ void F77_FUNC(chartracing2, CHARTRACING2) ( double *, double *, double *, double *); -void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( +void SAMRAI_F77_FUNC(fluxcalculation, FLUXCALCULATION) ( const double&, const int&, const int&, const int&, const double *, @@ -259,7 +259,7 @@ void F77_FUNC(fluxcalculation, FLUXCALCULATION) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( +void SAMRAI_F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const int&, @@ -270,7 +270,7 @@ void F77_FUNC(fluxcorrec2d, FLUXCORREC2D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( +void SAMRAI_F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( const double&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -280,7 +280,7 @@ void F77_FUNC(fluxcorrec3d, FLUXCORREC3D) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(consdiff, CONSDIFF) ( +void SAMRAI_F77_FUNC(consdiff, CONSDIFF) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -290,7 +290,7 @@ void F77_FUNC(consdiff, CONSDIFF) ( const double *, double *); -void F77_FUNC(getbdry, GETBDRY) ( +void SAMRAI_F77_FUNC(getbdry, GETBDRY) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -303,21 +303,21 @@ void F77_FUNC(getbdry, GETBDRY) ( double *, const double *, const double *, const int&); -void F77_FUNC(onethirdstate, ONETHIRDSTATE) ( +void SAMRAI_F77_FUNC(onethirdstate, ONETHIRDSTATE) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, const double *, const double *, double *); -void F77_FUNC(fluxthird, FLUXTHIRD) ( +void SAMRAI_F77_FUNC(fluxthird, FLUXTHIRD) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, const double *, double *, double *, double *); -void F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( +void SAMRAI_F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( const double&, const double *, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const double *, const double *, @@ -325,7 +325,7 @@ void F77_FUNC(fluxcorrecjt, FLUXCORRECJT) ( double *, double *, double *, double *, double *, double *); -void F77_FUNC(detectgrad, DETECTGRAD) ( +void SAMRAI_F77_FUNC(detectgrad, DETECTGRAD) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -338,7 +338,7 @@ void F77_FUNC(detectgrad, DETECTGRAD) ( const double *, int *, int *); -void F77_FUNC(detectshock, DETECTSHOCK) ( +void SAMRAI_F77_FUNC(detectshock, DETECTSHOCK) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -351,13 +351,13 @@ void F77_FUNC(detectshock, DETECTSHOCK) ( const double *, int *, int *); -void F77_FUNC(stufprobc, STUFPROBC) ( +void SAMRAI_F77_FUNC(stufprobc, STUFPROBC) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&); // in cartrefine3d.f: -void F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( +void SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-MblkHyperbolicLevelIntegrator.C deleted file mode 100644 index 6b0f5329..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-MblkHyperbolicLevelIntegrator.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "MblkHyperbolicLevelIntegrator.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleConservativeLinearRefine.C deleted file mode 100644 index 4733eccc..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleConservativeLinearRefine.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonCellDoubleConservativeLinearRefine.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleWeightedAverage.C deleted file mode 100644 index 7bb47e1d..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonCellDoubleWeightedAverage.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonCellDoubleWeightedAverage.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonOutersideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonOutersideDoubleWeightedAverage.C deleted file mode 100644 index 8866697a..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/Pointer-SkeletonOutersideDoubleWeightedAverage.C +++ /dev/null @@ -1,19 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ - -#include "SkeletonOutersideDoubleWeightedAverage.h" - -#include - -using namespace SAMRAI; - -#ifndef LACKS_EXPLICIT_TEMPLATE_INSTANTIATION -template class boost::shared_ptr; -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/README b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/README index f98278a4..e331ec15 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/README +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/README @@ -1,29 +1,41 @@ ######################################################################### ## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: MULTIBLOCK LINEAR ADVECTION EQUATION EXAMPLE +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Multiblock performance tests. ## ######################################################################### This example is similar to the single-block AMR LinAdv sample application. -Please see the README in that example for details on how to compile -and run. This example has the following differences: +This example has the following differences: - 1. It works on non-cartesian mapped grids + 1. It works on non-cartesian mapped grids 2. It works with multiblock grids 3. All numerical kernel operations (e.g. computeFluxesOnPatch()) are c-based rather than fortran -The three test cases included are: +The four test cases included are: - 1. cart-1blk - single block Cartesian grid - 2. wedge-1blk - single block mapped wedge grid - 3. octant-3blk - multi block (3 blocks) mapped octant grid + 1. test.3d.1blk - single block Cartesian grid + 2. test.3d.2blk - two block Cartesian grid + 3. test.3d.4blk - four block Cartesian grid + 4. test.3d.8blk - eight block Cartesian grid -Note that this example will compile in 2D but the numerics have not been fully -tested so it currently should only run in 3D. For further information, please -contact Andy Wissink: awissink@llnl.gov +Note that the numerics for this example have not been fully tested in 2D so it +currently should only run in 3D. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files in performance_inputs: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.C deleted file mode 100644 index c2f460fa..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.C +++ /dev/null @@ -1,861 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating 2D Skeleton boundary data - * - ************************************************************************/ - -#include "SkeletonBoundaryUtilities2.h" - -#include "SAMRAI/appu/CartesianBoundaryDefines.h" - -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/pdat/CellIndex.h" -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in - * boundary condition implementation. - * - ************************************************************************* - */ - -extern "C" { - -void F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -void F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&); - -void F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, - const int&, - const double *, - double *, - const int&); - -} - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -bool SkeletonBoundaryUtilities2::s_fortran_constants_stuffed = false; - -/* - * This function reads 2D boundary data from given input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete BoundaryStrategy - * provided). When DIRICHLET or NEUMANN conditions are specified, control - * is passed to the BoundaryStrategy to read the boundary state data - * specific to the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary edges or - * node entries are not required from input. Error checking requires - * that node boundary conditions are consistent with those - * specified for the edges. - * - * Arguments are: - * bdry_strategy .... object that reads DIRICHLET or NEUMANN data - * bdry_db .......... input database containing all boundary data - * edge_conds ....... array into which integer boundary conditions - * for edges are read - * node_conds ....... array into which integer boundary conditions - * for nodes are read - * periodic ......... integer vector specifying which coordinate - * directions are periodic (value returned from - * GridGeometry2::getPeriodicShift()) - */ - -void SkeletonBoundaryUtilities2::readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - read2dBdryEdges(bdry_strategy, - bdry_db, - edge_conds, - periodic); - - read2dBdryNodes(bdry_db, - edge_conds, - node_conds, - periodic); - -} - -/* - * Function to fill edge boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_edge_conds ...... array of boundary conditions for patch edges - * bdry_edge_values ..... array of boundary values for edges - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities2::fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - - const hier::Box& interior = patch.getBox(); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& edge_bdry = - pgeom->getCodimensionBoundaries(Bdry::EDGE2D); - for (int i = 0; i < edge_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE2D); -#endif - - int bedge_loc = edge_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], - interior, - gcw_to_fill)); - - if (!fill_box.empty()) { - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ibeg(0), iend(0), - ibeg(1), iend(1), - ghost_cells(0), ghost_cells(1), - bedge_loc, - bdry_edge_conds[bedge_loc], - bdry_edge_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - } - - } - -} - -/* - * Function to fill node boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_node_conds ...... array of boundary conditions for patch nodes - * bdry_edge_values ..... array of boundary values for edges - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities2::fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_2D_NODES); - TBOX_ASSERT(bdry_edge_values.getSize() == NUM_2D_EDGES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff2dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& node_bdry = - pgeom->getCodimensionBoundaries(Bdry::NODE2D); - - for (int i = 0; i < node_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE2D); -#endif - - int bnode_loc = node_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], - interior, - gcw_to_fill)); - - if (!fill_box.empty()) { - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ibeg(0), iend(0), - ibeg(1), iend(1), - ghost_cells(0), ghost_cells(1), - bnode_loc, - bdry_node_conds[bnode_loc], - bdry_edge_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - } - - } - -} - -/* - * Function that returns the integer edge boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - */ - -int SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry( - int node_loc, - int node_btype) -{ - - int ret_edge = -1; - - switch (node_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - { - if (node_loc == NodeBdyLoc2D::XLO_YLO || node_loc == NodeBdyLoc2D::XLO_YHI) { - ret_edge = BdryLoc::XLO; - } else { - ret_edge = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - { - if (node_loc == NodeBdyLoc2D::XLO_YLO || node_loc == NodeBdyLoc2D::XHI_YLO) { - ret_edge = BdryLoc::YLO; - } else { - ret_edge = BdryLoc::YHI; - } - break; - } - default: { - TBOX_ERROR("Unknown node boundary condition type = " - << node_btype << " passed to \n" - << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" - << endl); - } - } - - if (ret_edge == -1) { - TBOX_ERROR("Node boundary condition type = " - << node_btype << " and node location = " << node_loc - << "\n passed to " - << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" - << " are inconsistant." << endl); - } - - return ret_edge; - -} - -/* - * Function to check 2D boundary data filling. Arguments are: - * - * varname ..... name of variable (for error reporting) - * patch ....... patch on which boundary data to check lives - * data_id ..... patch data index on patch - * depth ....... depth index of data to check - * gcw_to_check. boundary ghost width to fill - * bbox ........ boundary box to check - * bcase ....... boundary condition case for edge or a node to check - * bstate ...... boundary state that applies when such a value is - * required, such as when using Dirichlet conditions - */ - -int SkeletonBoundaryUtilities2::checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!varname.empty()); - TBOX_ASSERT(data_id >= 0); - TBOX_ASSERT(depth >= 0); -#endif - - int num_bad_values = 0; - - int btype = bbox.getBoundaryType(); - int bloc = bbox.getLocationIndex(); - - boost::shared_ptr pgeom(patch.getPatchGeometry()); - - boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); - - string bdry_type_str; - if (btype == Bdry::EDGE2D) { - bdry_type_str = "EDGE"; - } else if (btype == Bdry::NODE2D) { - bdry_type_str = "NODE"; - } else { - TBOX_ERROR( - "Unknown btype " << btype - << " passed to SkeletonBoundaryUtilities2::checkBdryData()! " - << endl); - } - - tbox::plog << "\n\nCHECKING 2D " << bdry_type_str << " BDRY DATA..." << endl; - tbox::plog << "varname = " << varname << " : depth = " << depth << endl; - tbox::plog << "bbox = " << bbox.getBox() << endl; - tbox::plog << "btype, bloc, bcase = " - << btype << ", = " << bloc << ", = " << bcase << endl; - - int idir; - double valfact = 0.0, constval = 0.0, dxfact = 0.0; - int offsign; - - get2dBdryDirectionCheckValues(idir, offsign, - btype, bloc, bcase); - - if (btype == Bdry::EDGE2D) { - - if (bcase == BdryCond::FLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::REFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::DIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::NODE2D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } - - hier::Box gbox_to_check( - vardata->getGhostBox() * pgeom->getBoundaryFillBox(bbox, - patch.getBox(), - gcw_to_check)); - - hier::Box cbox(gbox_to_check); - hier::Box dbox(gbox_to_check); - hier::Index ifirst(vardata->getBox().lower()); - hier::Index ilast(vardata->getBox().upper()); - - if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); - } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); - } - - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { - double checkval = valfact * (*vardata)(*id, depth) + constval; - pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { - double offcheckval = checkval + dxfact * (p + 1); - if ((*vardata)(check, depth) != offcheckval) { - num_bad_values++; - TBOX_WARNING("Bad " << bdry_type_str - << " boundary value for " << varname - << " found in cell " << check - << "\n found = " << (*vardata)(check, depth) - << " : correct = " << offcheckval << endl); - } - check(idir) += offsign; - } - ++id; - } - - return num_bad_values; - -} - -/* - * Private function to read 2D edge boundary data from input database. - */ - -void SkeletonBoundaryUtilities2::read2dBdryEdges( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& edge_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 2) { // face boundary input required - - for (int s = 0; s < NUM_2D_EDGES; s++) { - - string bdry_loc_str; - switch (s) { - case BdryLoc::XLO: { bdry_loc_str = "boundary_edge_xlo"; - break; - } - case BdryLoc::XHI: { bdry_loc_str = "boundary_edge_xhi"; - break; - } - case BdryLoc::YLO: { bdry_loc_str = "boundary_edge_ylo"; - break; - } - case BdryLoc::YHI: { bdry_loc_str = "boundary_edge_yhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = true; - if (num_per_dirs > 0) { - if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { - need_data_read = false; - } else if (periodic(1) && (s == BdryLoc::YLO || s == BdryLoc::YHI)) { - need_data_read = false; - } - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - edge_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - edge_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - edge_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 2) - -} - -/* - * Private function to read 2D node boundary data from input database. - */ - -void SkeletonBoundaryUtilities2::read2dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(edge_conds.getSize() == NUM_2D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_2D_NODES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 2; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 1) { // node boundary data required - - for (int s = 0; s < NUM_2D_NODES; s++) { - - string bdry_loc_str; - switch (s) { - case NodeBdyLoc2D::XLO_YLO: { bdry_loc_str = "boundary_node_xlo_ylo"; - break; - } - case NodeBdyLoc2D::XHI_YLO: { bdry_loc_str = "boundary_node_xhi_ylo"; - break; - } - case NodeBdyLoc2D::XLO_YHI: { bdry_loc_str = "boundary_node_xlo_yhi"; - break; - } - case NodeBdyLoc2D::XHI_YHI: { bdry_loc_str = "boundary_node_xhi_yhi"; - break; - } - default: NULL_STATEMENT; - } - - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - string proper_edge; - string proper_edge_data; - bool no_edge_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || s == NodeBdyLoc2D::XLO_YHI) { - proper_edge = "XLO"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "XHI"; - if (bdry_cond_str == "XFLOW" && - edge_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - edge_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "XREFLECT" && - edge_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc2D::XLO_YLO || s == NodeBdyLoc2D::XHI_YLO) { - proper_edge = "YLO"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } else { - proper_edge = "YHI"; - if (bdry_cond_str == "YFLOW" && - edge_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_edge_data_found = true; - proper_edge_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - edge_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_edge_data_found = true; - proper_edge_data = "DIRICHLET"; - } - if (bdry_cond_str == "YREFLECT" && - edge_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_edge_data_found = true; - proper_edge_data = "REFLECT"; - } - } - } - if (no_edge_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_edge_data - << " data found for edge " - << proper_edge << endl); - } - - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // for (int s = 0 ... - - } // if (num_per_dirs < 1) - -} - -/* - * Private function to get boundary orientation information for - * 2D boundary condition checking. Called from checkBdryData(). - */ - -void SkeletonBoundaryUtilities2::get2dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase) -{ - - string bdry_type_str; - - if (btype == Bdry::EDGE2D) { - - bdry_type_str = "NODE"; - - if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { - idir = 0; - if (bloc == BdryLoc::XLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { - idir = 1; - if (bloc == BdryLoc::YLO) { - offsign = -1; - } else { - offsign = 1; - } - } else { - TBOX_ERROR( - "Unknown boundary location " << bloc - << - " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " - << bdry_type_str << " boundary " << endl); - } - - } else if (btype == Bdry::NODE2D) { - - bdry_type_str = "NODE"; - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET) { - idir = 0; - if (bloc == NodeBdyLoc2D::XLO_YLO || bloc == NodeBdyLoc2D::XLO_YHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET) { - idir = 1; - if (bloc == NodeBdyLoc2D::XLO_YLO || bloc == NodeBdyLoc2D::XHI_YLO) { - offsign = -1; - } else { - offsign = 1; - } - } - - } else { - TBOX_ERROR( - "Unknown boundary type " << btype - << " passed to SkeletonBoundaryUtilities2::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - -} - -/* - * Private function to stuff 2D boundary contants into Fortran common blocks - */ - -void SkeletonBoundaryUtilities2::stuff2dBdryFortConst() -{ - F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( - BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, - NodeBdyLoc2D::XLO_YLO, NodeBdyLoc2D::XHI_YLO, NodeBdyLoc2D::XLO_YHI, NodeBdyLoc2D::XHI_YHI); - F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( - BdryCond::FLOW, - BdryCond::XFLOW, BdryCond::YFLOW, - BdryCond::REFLECT, - BdryCond::XREFLECT, BdryCond::YREFLECT, - BdryCond::DIRICHLET, - BdryCond::XDIRICHLET, BdryCond::YDIRICHLET); - s_fortran_constants_stuffed = true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.h deleted file mode 100644 index 7b0e00f7..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities2.h +++ /dev/null @@ -1,262 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating Skeleton 2d boundary data - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/appu/BoundaryUtilityStrategy.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Database.h" - -#include -#ifndef included_String -#include -#define included_String -#endif - -/*! - * @brief Class SkeletonBoundaryUtilities2 is a utility class that - * simplifies the implementation of simple physical boundary data in - * 2 spatial dimensions. It contains routines for reading boundary data - * information from input files, applying those boundary conditions, - * and error checking boundary data. These routines apply to the - * case of cell-centered double data only. One may use all of these - * capabilities, or use the input reading, boundary setting, and error - * checking routines independently. - * - * To use the boundary condition input reading capabilities, the format - * of the input file section containing the boundary information must - * be as described next. Boundary node and edge entries are only - * required for those that are not filled automatically when periodic - * conditions apply. - * - * The boundary condition for edge "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_edge_* { - * boundary_condition = ... // boundary condition string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... - * } - * - * Allowable edge identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi - * Supported edge boundary_condition strin values are: - * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - * - * \endverbatim - * - * The boundary condition for node "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_node_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable node identifiers (i.e., values for "*") are: - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition string values are: - * "XFLOW", "YFLOW", - * "XREFLECT", "YREFLECT", - * "XDIRICHLET", "YDIRICHLET", - * "XNEUMANN", "YNEUMANN" - * - * \endverbatim - * - * Note that node conditions must be consistent with adjacent edge conditions. - * - * See the include file SkeletonBoundaryDefines.h for integer constant - * definitions that apply for the various boundary types, locations, - * and boundary conditions. If you choose to use the input reading - * capabilities only and write your own boundary condition routines in - * FORTRAN, you should note that the integer constants for the various - * boundary condition types and locations are automatically "stuffed" into - * FORTRAN common blocks. This avoids potential problems with - * inconsistencies between C++ and FORTRAN usage. Please see the - * FORTRAN include file cartbdryparams2d.i for details. - * - * @see appu::BoundaryUtilityStrategy2 - */ - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -struct SkeletonBoundaryUtilities2 { -public: - /*! - * Function to read 2d boundary data from input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete - * BoundaryUtilityStrategy object provided). When DIRICHLET or - * NEUMANN conditions are specified, control is passed to the - * BoundaryUtilityStrategy to read the boundary state data specific to - * the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary edge or - * node entries are not required from input. Error checking - * requires that node boundary conditions are consistent - * with those specified for the edges. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN - * conditions - * @param bdry_db input database containing all boundary data - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read - * @param periodic integer vector specifying which coordinate - * directions are periodic (e.g., value returned from - * GridGeometry2::getPeriodicShift()) - */ - static void - readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - /*! - * Function to fill 2d edge boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. - */ - static void - fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_edge_values); - - /*! - * Function to fill 2d node boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_edge_values tbox::Array of boundary values for patch edges. - */ - static void - fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_edge_values); - - /*! - * Function that returns the integer edge boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - * - * @return Integer edge location for node location and boundary condition type. - * - * @param node_loc Integer location for node. - * @param node_btype Integer boundary condition type for node. - */ - static int - getEdgeLocationForNodeBdry( - int node_loc, - int node_btype); - - /*! - * Function to check 2d boundary data for a patch data quantity on - * a patch after it is set. A warning message will be sent to log - * file for each bad boundary value that is found. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @return Integer number of bad boundary values found. - * - * @param varname String name of variable (for error reporting). - * @param patch hier::Patch on which data object lives. - * @param data_id hier::Patch data index for data on patch. - * @param depth Depth index of patch data to check. - * @param gcw_to_check Width of ghost region to check. - * @param bbox Boundary box to check. - * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. - */ - static int - checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate); - -private: - static bool s_fortran_constants_stuffed; - - static void - read2dBdryEdges( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& edge_conds, - const hier::IntVector& periodic); - - static void - read2dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - static void - get2dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase); - - static void - stuff2dBdryFortConst(); -}; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.C deleted file mode 100644 index 4fa80024..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.C +++ /dev/null @@ -1,1632 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating 3D Skeleton boundary data - * - ************************************************************************/ - -#include "SkeletonBoundaryUtilities3.h" - -#include "SAMRAI/appu/CartesianBoundaryDefines.h" - -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/pdat/CellIndex.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN 77 routines used in - * boundary condition implementation. - * - ************************************************************************* - */ - -extern "C" { - -void F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&); - -void F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&, - const int&, - const int&, const int&, const int&); - -void F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -void F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, const int&, - const double *, - const int&, - const int&, - const double *, - double *, - const int&); - -} -using namespace SAMRAI; -using namespace appu; - -bool SkeletonBoundaryUtilities3::s_fortran_constants_stuffed = false; - -/* - * This function reads 3D boundary data from given input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete BoundaryStrategy - * provided). When DIRICHLET or NEUMANN conditions are specified, control - * is passed to the BoundaryStrategy to read the boundary state data - * specific to the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary face, edge, or - * node entries are not required from input. Error checking requires - * that node and edge boundary conditions are consistent with those - * specified for the faces. - * - * Arguments are: - * bdry_strategy .... object that reads DIRICHLET or NEUMANN conditions - * bdry_db .......... input database containing all boundary data - * face_conds ....... array into which integer boundary conditions - * for faces are read - * edge_conds ....... array into which integer boundary conditions - * for edges are read - * node_conds ....... array into which integer boundary conditions - * for nodes are read - * periodic ......... integer vector specifying which coordinate - * directions are periodic (value returned from - * GridGeometry3::getPeriodicShift()) - */ - -void SkeletonBoundaryUtilities3::readBoundaryInput( - BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - read3dBdryFaces(bdry_strategy, - bdry_db, - face_conds, - periodic); - - read3dBdryEdges(bdry_db, - face_conds, - edge_conds, - periodic); - - read3dBdryNodes(bdry_db, - face_conds, - node_conds, - periodic); - -} - -/* - * Function to fill face boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_face_conds ...... array of boundary conditions for patch faces - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillFaceBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_face_conds.getSize() == NUM_3D_FACES); -// TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES*(vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - const tbox::Array& face_bdry = - pgeom->getCodimensionBoundaries(Bdry::FACE3D); - for (int i = 0; i < face_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(face_bdry[i].getBoundaryType() == Bdry::FACE3D); -#endif - - int bface_loc = face_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(face_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bface_loc, - bdry_face_conds[bface_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function to fill edge boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_edge_conds ...... array of boundary conditions for patch edges - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_edge_conds.getSize() == NUM_3D_EDGES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& edge_bdry = - pgeom->getCodimensionBoundaries(Bdry::EDGE3D); - for (int i = 0; i < edge_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE3D); -#endif - - int bedge_loc = edge_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bedge_loc, - bdry_edge_conds[bedge_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function to fill node boundary values. - * - * Arguments are: - * varname .............. name of variable (for error reporting) - * vardata .............. cell-centered patch data object to check - * patch ................ patch on which data object lives - * ghost_width_to_fill .. width of ghost region to fill - * bdry_node_conds ...... array of boundary conditions for patch nodes - * bdry_face_values ..... array of boundary values for faces - * (this must be consistent with boundary - * condition types) - */ - -void SkeletonBoundaryUtilities3::fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_fill_width, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values) -{ - NULL_USE(varname); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(vardata); - TBOX_ASSERT(bdry_node_conds.getSize() == NUM_3D_NODES); - TBOX_ASSERT(bdry_face_values.getSize() == NUM_3D_FACES * (vardata->getDepth())); -#endif - - if (!s_fortran_constants_stuffed) { - stuff3dBdryFortConst(); - } - - const boost::shared_ptr pgeom( - patch.getPatchGeometry()); - //const double* dx = pgeom->getDx(); - const double dx[3] = { 0., 0., 0. }; - - const hier::Box& interior(patch.getBox()); - const hier::Index& ifirst(interior.lower()); - const hier::Index& ilast(interior.upper()); - - const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); - - hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, - ghost_fill_width); - - const tbox::Array& node_bdry = - pgeom->getCodimensionBoundaries(Bdry::NODE3D); - for (int i = 0; i < node_bdry.getSize(); i++) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE3D); -#endif - - int bnode_loc = node_bdry[i].getLocationIndex(); - - hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], - interior, - gcw_to_fill)); - const hier::Index& ibeg(fill_box.lower()); - const hier::Index& iend(fill_box.upper()); - - F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( - ifirst(0), ilast(0), - ifirst(1), ilast(1), - ifirst(2), ilast(2), - ibeg(0), iend(0), - ibeg(1), iend(1), - ibeg(2), iend(2), - ghost_cells(0), ghost_cells(1), ghost_cells(2), - dx, - bnode_loc, - bdry_node_conds[bnode_loc], - bdry_face_values.getPointer(), - vardata->getPointer(), - vardata->getDepth()); - - } - -} - -/* - * Function that returns the integer face boundary location - * corresponding to the given edge location and edge boundary - * condition. - * - * If the edge boundary condition type or edge location are unknown, - * or the boundary condition type is inconsistant with the edge location - * an error results. - */ - -int SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry( - int edge_loc, - int edge_btype) -{ - - int ret_face = -1; - - switch (edge_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - case BdryCond::XNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XLO_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XLO_YHI) { - ret_face = BdryLoc::XLO; - } else if (edge_loc == EdgeBdyLoc3D::XHI_ZLO || edge_loc == EdgeBdyLoc3D::XHI_ZHI || - edge_loc == EdgeBdyLoc3D::XHI_YLO || edge_loc == EdgeBdyLoc3D::XHI_YHI) { - ret_face = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - case BdryCond::YNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YLO_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XHI_YLO) { - ret_face = BdryLoc::YLO; - } else if (edge_loc == EdgeBdyLoc3D::YHI_ZLO || edge_loc == EdgeBdyLoc3D::YHI_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_YHI || edge_loc == EdgeBdyLoc3D::XHI_YHI) { - ret_face = BdryLoc::YHI; - } - break; - } - case BdryCond::ZFLOW: - case BdryCond::ZREFLECT: - case BdryCond::ZDIRICHLET: - case BdryCond::ZNEUMANN: - { - if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YHI_ZLO || - edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XHI_ZLO) { - ret_face = BdryLoc::ZLO; - } else if (edge_loc == EdgeBdyLoc3D::YLO_ZHI || edge_loc == EdgeBdyLoc3D::YHI_ZHI || - edge_loc == EdgeBdyLoc3D::XLO_ZHI || edge_loc == EdgeBdyLoc3D::XHI_ZHI) { - ret_face = BdryLoc::ZHI; - } - break; - } - default: { - TBOX_ERROR("Unknown edge boundary condition type = " - << edge_btype << " passed to \n" - << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" - << endl); - } - } - - if (ret_face == -1) { - TBOX_ERROR("Edge boundary condition type = " - << edge_btype << " and edge location = " << edge_loc - << "\n passed to " - << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" - << " are inconsistant." << endl); - } - - return ret_face; - -} - -/* - * Function that returns the integer face boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - */ - -int SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry( - int node_loc, - int node_btype) -{ - - int ret_face = -1; - - switch (node_btype) { - case BdryCond::XFLOW: - case BdryCond::XREFLECT: - case BdryCond::XDIRICHLET: - case BdryCond::XNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || NodeBdyLoc3D::XLO_YHI_ZLO || - NodeBdyLoc3D::XLO_YLO_ZHI || NodeBdyLoc3D::XLO_YHI_ZHI) { - ret_face = BdryLoc::XLO; - } else { - ret_face = BdryLoc::XHI; - } - break; - } - case BdryCond::YFLOW: - case BdryCond::YREFLECT: - case BdryCond::YDIRICHLET: - case BdryCond::YNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || NodeBdyLoc3D::XHI_YLO_ZLO || - NodeBdyLoc3D::XLO_YLO_ZHI || NodeBdyLoc3D::XHI_YLO_ZHI) { - ret_face = BdryLoc::YLO; - } else { - ret_face = BdryLoc::YHI; - } - break; - } - case BdryCond::ZFLOW: - case BdryCond::ZREFLECT: - case BdryCond::ZDIRICHLET: - case BdryCond::ZNEUMANN: - { - if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || NodeBdyLoc3D::XHI_YLO_ZLO || - NodeBdyLoc3D::XLO_YHI_ZLO || NodeBdyLoc3D::XHI_YHI_ZLO) { - ret_face = BdryLoc::ZLO; - } else { - ret_face = BdryLoc::ZHI; - } - break; - } - default: { - TBOX_ERROR("Unknown node boundary condition type = " - << node_btype << " passed to \n" - << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" - << endl); - } - } - - if (ret_face == -1) { - TBOX_ERROR("Node boundary condition type = " - << node_btype << " and node location = " << node_loc - << "\n passed to " - << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" - << " are inconsistant." << endl); - } - - return ret_face; - -} - -/* - * Function to check 3D boundary data filling. Arguments are: - * - * varname ..... name of variable (for error reporting) - * patch ....... patch on which boundary data to check lives - * data_id ..... patch data index on patch - * depth ....... depth index of data to check - * gcw_to_check. boundary ghost width to fill - * bbox ........ boundary box to check - * bcase ....... boundary condition case for edge or a node to check - * bstate ...... boundary state that applies when such a value is - * required, such as when using Dirichlet conditions - */ - -int SkeletonBoundaryUtilities3::checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!varname.empty()); - TBOX_ASSERT(data_id >= 0); - TBOX_ASSERT(depth >= 0); -#endif - - int num_bad_values = 0; - - int btype = bbox.getBoundaryType(); - int bloc = bbox.getLocationIndex(); - - boost::shared_ptr pgeom(patch.getPatchGeometry()); - - boost::shared_ptr > vardata( - patch.getPatchData(data_id), - boost::detail::dynamic_cast_tag()); - - string bdry_type_str; - if (btype == Bdry::FACE3D) { - bdry_type_str = "FACE"; - } else if (btype == Bdry::EDGE3D) { - bdry_type_str = "EDGE"; - } else if (btype == Bdry::NODE3D) { - bdry_type_str = "NODE"; - } else { - TBOX_ERROR( - "Unknown btype " << btype - << " passed to SkeletonBoundaryUtilities3::checkBdryData()! " - << endl); - } - - tbox::plog << "\n\nCHECKING 3D " << bdry_type_str << " BDRY DATA..." << endl; - tbox::plog << "varname = " << varname << " : depth = " << depth << endl; - tbox::plog << "bbox = " << bbox.getBox() << endl; - tbox::plog << "btype, bloc, bcase = " - << btype << ", = " << bloc << ", = " << bcase << endl; - - int idir; - double valfact = 0.0, constval = 0.0, dxfact = 0.0; - int offsign; - - get3dBdryDirectionCheckValues(idir, offsign, - btype, bloc, bcase); - - if (btype == Bdry::FACE3D) { - - if (bcase == BdryCond::FLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::REFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::DIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::EDGE3D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || bcase == BdryCond::ZFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || - bcase == BdryCond::ZREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || - bcase == BdryCond::ZDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } else if (btype == Bdry::NODE3D) { - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || bcase == BdryCond::ZFLOW) { - valfact = 1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || - bcase == BdryCond::ZREFLECT) { - valfact = -1.0; - constval = 0.0; - dxfact = 0.0; - } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || - bcase == BdryCond::ZDIRICHLET) { - valfact = 0.0; - constval = bstate; - dxfact = 0.0; - } else { - TBOX_ERROR( - "Unknown bcase " << bcase - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - - } - - hier::Box gbox_to_check(vardata->getGhostBox() * pgeom->getBoundaryFillBox( - bbox, - patch.getBox(), - gcw_to_check)); - - hier::Box cbox(gbox_to_check); - hier::Box dbox(gbox_to_check); - hier::Index ifirst(vardata->getBox().lower()); - hier::Index ilast(vardata->getBox().upper()); - - if (offsign == -1) { - cbox.lower(idir) = ifirst(idir) - 1; - cbox.upper(idir) = ifirst(idir) - 1; - dbox.lower(idir) = ifirst(idir); - dbox.upper(idir) = ifirst(idir); - } else { - cbox.lower(idir) = ilast(idir) + 1; - cbox.upper(idir) = ilast(idir) + 1; - dbox.lower(idir) = ilast(idir); - dbox.upper(idir) = ilast(idir); - } - - pdat::CellIterator id(dbox, true); - pdat::CellIterator icend(cbox, false); - for (pdat::CellIterator ic(cbox, true); ic != icend; ++ic) { - double checkval = valfact * (*vardata)(*id, depth) + constval; - pdat::CellIndex check = *ic; - for (int p = 0; p < gbox_to_check.numberCells(idir); p++) { - double offcheckval = checkval + dxfact * (p + 1); - if ((*vardata)(check, depth) != offcheckval) { - num_bad_values++; - TBOX_WARNING("Bad " << bdry_type_str - << " boundary value for " << varname - << " found in cell " << check - << "\n found = " << (*vardata)(check, depth) - << " : correct = " << offcheckval << endl); - } - check(idir) += offsign; - } - ++id; - } - - return num_bad_values; - -} - -/* - * Private function to read 3D face boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryFaces( - BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& face_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_strategy != (BoundaryUtilityStrategy *)NULL); - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 3) { // face boundary input required - - for (int s = 0; s < NUM_3D_FACES; s++) { - - string bdry_loc_str; - switch (s) { - case BdryLoc::XLO: { bdry_loc_str = "boundary_face_xlo"; - break; - } - case BdryLoc::XHI: { bdry_loc_str = "boundary_face_xhi"; - break; - } - case BdryLoc::YLO: { bdry_loc_str = "boundary_face_ylo"; - break; - } - case BdryLoc::YHI: { bdry_loc_str = "boundary_face_yhi"; - break; - } - case BdryLoc::ZLO: { bdry_loc_str = "boundary_face_zlo"; - break; - } - case BdryLoc::ZHI: { bdry_loc_str = "boundary_face_zhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = true; - if (num_per_dirs > 0) { - if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { - need_data_read = false; - } else if (periodic(1) && (s == BdryLoc::YLO || s == BdryLoc::YHI)) { - need_data_read = false; - } else if (periodic(2) && (s == BdryLoc::ZLO || s == BdryLoc::ZHI)) { - need_data_read = false; - } - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "FLOW") { - face_conds[s] = BdryCond::FLOW; - } else if (bdry_cond_str == "REFLECT") { - face_conds[s] = BdryCond::REFLECT; - } else if (bdry_cond_str == "DIRICHLET") { - face_conds[s] = BdryCond::DIRICHLET; - bdry_strategy-> - readDirichletBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else if (bdry_cond_str == "NEUMANN") { - face_conds[s] = BdryCond::NEUMANN; - bdry_strategy-> - readNeumannBoundaryDataEntry(bdry_loc_db, - bdry_loc_str, - s); - } else { - TBOX_ERROR("Unknown face boundary string = " - << bdry_cond_str << " found in input." << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 3) - -} - -/* - * Private function to read 3D edge boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryEdges( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(edge_conds.getSize() == NUM_3D_EDGES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 2) { // edge boundary input required - - for (int s = 0; s < NUM_3D_EDGES; s++) { - - string bdry_loc_str; - switch (s) { - case EdgeBdyLoc3D::YLO_ZLO: { bdry_loc_str = "boundary_edge_ylo_zlo"; - break; - } - case EdgeBdyLoc3D::YHI_ZLO: { bdry_loc_str = "boundary_edge_yhi_zlo"; - break; - } - case EdgeBdyLoc3D::YLO_ZHI: { bdry_loc_str = "boundary_edge_ylo_zhi"; - break; - } - case EdgeBdyLoc3D::YHI_ZHI: { bdry_loc_str = "boundary_edge_yhi_zhi"; - break; - } - case EdgeBdyLoc3D::XLO_ZLO: { bdry_loc_str = "boundary_edge_xlo_zlo"; - break; - } - case EdgeBdyLoc3D::XLO_ZHI: { bdry_loc_str = "boundary_edge_xlo_zhi"; - break; - } - case EdgeBdyLoc3D::XHI_ZLO: { bdry_loc_str = "boundary_edge_xhi_zlo"; - break; - } - case EdgeBdyLoc3D::XHI_ZHI: { bdry_loc_str = "boundary_edge_xhi_zhi"; - break; - } - case EdgeBdyLoc3D::XLO_YLO: { bdry_loc_str = "boundary_edge_xlo_ylo"; - break; - } - case EdgeBdyLoc3D::XHI_YLO: { bdry_loc_str = "boundary_edge_xhi_ylo"; - break; - } - case EdgeBdyLoc3D::XLO_YHI: { bdry_loc_str = "boundary_edge_xlo_yhi"; - break; - } - case EdgeBdyLoc3D::XHI_YHI: { bdry_loc_str = "boundary_edge_xhi_yhi"; - break; - } - default: NULL_STATEMENT; - } - - bool need_data_read = false; - if (num_per_dirs == 0) { - need_data_read = true; - } else if (periodic(0) && - (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI)) { - need_data_read = true; - } else if (periodic(1) && - (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI)) { - need_data_read = true; - } else if (periodic(2) && - (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || - s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI)) { - need_data_read = true; - } - - if (need_data_read) { - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - edge_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - edge_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - edge_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - edge_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - edge_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - edge_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - edge_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - edge_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - edge_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - edge_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - edge_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - edge_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown edge boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - bool ambiguous_type = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XREFLECT" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN") { - if (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YREFLECT" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI) { - ambiguous_type = true; - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZREFLECT" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN") { - if (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || - s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI) { - ambiguous_type = true; - } - } - if (ambiguous_type) { - TBOX_ERROR("Ambiguous bdry condition " - << bdry_cond_str - << " found for " << bdry_loc_str << endl); - } - - string proper_face; - string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XLO_YHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YLO_ZHI || - s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || - s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << endl); - } - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // if (need_data_read) - - } // for (int s = 0 ... - - } // if (num_per_dirs < 2) - -} - -/* - * Private function to read 3D node boundary data from input database. - */ - -void SkeletonBoundaryUtilities3::read3dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic) -{ -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(bdry_db); - TBOX_ASSERT(face_conds.getSize() == NUM_3D_FACES); - TBOX_ASSERT(node_conds.getSize() == NUM_3D_NODES); -#endif - - int num_per_dirs = 0; - for (int id = 0; id < 3; id++) { - if (periodic(id)) num_per_dirs++; - } - - if (num_per_dirs < 1) { // node boundary data required - - for (int s = 0; s < NUM_3D_NODES; s++) { - - string bdry_loc_str; - switch (s) { - case NodeBdyLoc3D::XLO_YLO_ZLO: { bdry_loc_str = "boundary_node_xlo_ylo_zlo"; - break; - } - case NodeBdyLoc3D::XHI_YLO_ZLO: { bdry_loc_str = "boundary_node_xhi_ylo_zlo"; - break; - } - case NodeBdyLoc3D::XLO_YHI_ZLO: { bdry_loc_str = "boundary_node_xlo_yhi_zlo"; - break; - } - case NodeBdyLoc3D::XHI_YHI_ZLO: { bdry_loc_str = "boundary_node_xhi_yhi_zlo"; - break; - } - case NodeBdyLoc3D::XLO_YLO_ZHI: { bdry_loc_str = "boundary_node_xlo_ylo_zhi"; - break; - } - case NodeBdyLoc3D::XHI_YLO_ZHI: { bdry_loc_str = "boundary_node_xhi_ylo_zhi"; - break; - } - case NodeBdyLoc3D::XLO_YHI_ZHI: { bdry_loc_str = "boundary_node_xlo_yhi_zhi"; - break; - } - case NodeBdyLoc3D::XHI_YHI_ZHI: { bdry_loc_str = "boundary_node_xhi_yhi_zhi"; - break; - } - default: NULL_STATEMENT; - } - - if (bdry_db->keyExists(bdry_loc_str)) { - boost::shared_ptr bdry_loc_db( - bdry_db->getDatabase(bdry_loc_str)); - if (bdry_loc_db) { - if (bdry_loc_db->keyExists("boundary_condition")) { - string bdry_cond_str = - bdry_loc_db->getString("boundary_condition"); - if (bdry_cond_str == "XFLOW") { - node_conds[s] = BdryCond::XFLOW; - } else if (bdry_cond_str == "YFLOW") { - node_conds[s] = BdryCond::YFLOW; - } else if (bdry_cond_str == "ZFLOW") { - node_conds[s] = BdryCond::ZFLOW; - } else if (bdry_cond_str == "XREFLECT") { - node_conds[s] = BdryCond::XREFLECT; - } else if (bdry_cond_str == "YREFLECT") { - node_conds[s] = BdryCond::YREFLECT; - } else if (bdry_cond_str == "ZREFLECT") { - node_conds[s] = BdryCond::ZREFLECT; - } else if (bdry_cond_str == "XDIRICHLET") { - node_conds[s] = BdryCond::XDIRICHLET; - } else if (bdry_cond_str == "YDIRICHLET") { - node_conds[s] = BdryCond::YDIRICHLET; - } else if (bdry_cond_str == "ZDIRICHLET") { - node_conds[s] = BdryCond::ZDIRICHLET; - } else if (bdry_cond_str == "XNEUMANN") { - node_conds[s] = BdryCond::XNEUMANN; - } else if (bdry_cond_str == "YNEUMANN") { - node_conds[s] = BdryCond::YNEUMANN; - } else if (bdry_cond_str == "ZNEUMANN") { - node_conds[s] = BdryCond::ZNEUMANN; - } else { - TBOX_ERROR("Unknown node boundary string = " - << bdry_cond_str << " found in input." << endl); - } - - string proper_face; - string proper_face_data; - bool no_face_data_found = false; - if (bdry_cond_str == "XFLOW" || - bdry_cond_str == "XDIRICHLET" || - bdry_cond_str == "XNEUMANN" || - bdry_cond_str == "XREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || s == NodeBdyLoc3D::XLO_YHI_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || s == NodeBdyLoc3D::XLO_YHI_ZHI) { - proper_face = "XLO"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "XHI"; - if (bdry_cond_str == "XFLOW" && - face_conds[BdryLoc::XHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "XDIRICHLET" && - face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "XNEUMANN" && - face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "XREFLECT" && - face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "YFLOW" || - bdry_cond_str == "YDIRICHLET" || - bdry_cond_str == "YNEUMANN" || - bdry_cond_str == "YREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YLO_ZHI || s == NodeBdyLoc3D::XHI_YLO_ZHI) { - proper_face = "YLO"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "YHI"; - if (bdry_cond_str == "YFLOW" && - face_conds[BdryLoc::YHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "YDIRICHLET" && - face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "YNEUMANN" && - face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "YREFLECT" && - face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } else if (bdry_cond_str == "ZFLOW" || - bdry_cond_str == "ZDIRICHLET" || - bdry_cond_str == "ZNEUMANN" || - bdry_cond_str == "ZREFLECT") { - if (s == NodeBdyLoc3D::XLO_YLO_ZLO || s == NodeBdyLoc3D::XHI_YLO_ZLO || - s == NodeBdyLoc3D::XLO_YHI_ZLO || s == NodeBdyLoc3D::XHI_YHI_ZLO) { - proper_face = "ZLO"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } else { - proper_face = "ZHI"; - if (bdry_cond_str == "ZFLOW" && - face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { - no_face_data_found = true; - proper_face_data = "FLOW"; - } - if (bdry_cond_str == "ZDIRICHLET" && - face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { - no_face_data_found = true; - proper_face_data = "DIRICHLET"; - } - if (bdry_cond_str == "ZNEUMANN" && - face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { - no_face_data_found = true; - proper_face_data = "NEUMANN"; - } - if (bdry_cond_str == "ZREFLECT" && - face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { - no_face_data_found = true; - proper_face_data = "REFLECT"; - } - } - } - if (no_face_data_found) { - TBOX_ERROR( - "Bdry condition " << bdry_cond_str - << " found for " - << bdry_loc_str - << "\n but no " - << proper_face_data - << " data found for face " - << proper_face << endl); - } - - } else { - TBOX_ERROR("'boundary_condition' entry missing from " - << bdry_loc_str << " input database." << endl); - } - } - } else { - TBOX_ERROR(bdry_loc_str - << " database entry not found in input." << endl); - } - - } // for (int s = 0 ... - - } // if (num_per_dirs < 1) - -} - -/* - * Private function to get boundary orientation information for - * 3D boundary condition checking. Called from checkBdryData(). - */ - -void SkeletonBoundaryUtilities3::get3dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase) -{ - - string bdry_type_str; - - if (btype == Bdry::FACE3D) { - - bdry_type_str = "FACE"; - - if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { - idir = 0; - if (bloc == BdryLoc::XLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { - idir = 1; - if (bloc == BdryLoc::YLO) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bloc == BdryLoc::ZLO || bloc == BdryLoc::ZHI) { - idir = 2; - if (bloc == BdryLoc::ZLO) { - offsign = -1; - } else { - offsign = 1; - } - } else { - TBOX_ERROR( - "Unknown boundary location " << bloc - << - " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " - << bdry_type_str << " boundary " << endl); - } - - } else if (btype == Bdry::EDGE3D) { - - bdry_type_str = "EDGE"; - - bool bad_case = false; - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { - idir = 0; - if (bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XLO_ZHI || - bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XLO_YHI) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::XHI_ZLO || bloc == EdgeBdyLoc3D::XHI_ZHI || - bloc == EdgeBdyLoc3D::XHI_YLO || bloc == EdgeBdyLoc3D::XHI_YHI) { - offsign = 1; - } else { - bad_case = true; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { - idir = 1; - if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YLO_ZHI || - bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XHI_YLO) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::YHI_ZLO || bloc == EdgeBdyLoc3D::YHI_ZHI || - bloc == EdgeBdyLoc3D::XLO_YHI || bloc == EdgeBdyLoc3D::XHI_YHI) { - offsign = 1; - } else { - bad_case = true; - } - } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || - bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { - idir = 2; - if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YHI_ZLO || - bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XHI_ZLO) { - offsign = -1; - } else if (bloc == EdgeBdyLoc3D::YLO_ZHI || bloc == EdgeBdyLoc3D::YHI_ZHI || - bloc == EdgeBdyLoc3D::XLO_ZHI || bloc == EdgeBdyLoc3D::XHI_ZHI) { - offsign = 1; - } else { - bad_case = true; - } - } - if (bad_case) { - TBOX_ERROR( - "Unknown or ambigous bcase " << bcase - << - " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc - << endl); - } - - } else if (btype == Bdry::NODE3D) { - - bdry_type_str = "NODE"; - - if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || - bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { - idir = 0; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XLO_YHI_ZLO || - bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XLO_YHI_ZHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || - bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { - idir = 1; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || - bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XHI_YLO_ZHI) { - offsign = -1; - } else { - offsign = 1; - } - } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || - bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { - idir = 2; - if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || - bloc == NodeBdyLoc3D::XLO_YHI_ZLO || bloc == NodeBdyLoc3D::XHI_YHI_ZLO) { - offsign = -1; - } else { - offsign = 1; - } - } - - } else { - TBOX_ERROR( - "Unknown boundary type " << btype - << " passed to SkeletonBoundaryUtilities3::checkBdryData()" - << "\n for " << bdry_type_str - << " at location " << bloc << endl); - } - -} - -/* - * Private function to stuff 3D boundary contants into Fortran common blocks - */ - -void SkeletonBoundaryUtilities3::stuff3dBdryFortConst() -{ - F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( - BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, BdryLoc::ZLO, BdryLoc::ZHI, - EdgeBdyLoc3D::YLO_ZLO, EdgeBdyLoc3D::YHI_ZLO, EdgeBdyLoc3D::YLO_ZHI, EdgeBdyLoc3D::YHI_ZHI, - EdgeBdyLoc3D::XLO_ZLO, EdgeBdyLoc3D::XLO_ZHI, EdgeBdyLoc3D::XHI_ZLO, EdgeBdyLoc3D::XHI_ZHI, - EdgeBdyLoc3D::XLO_YLO, EdgeBdyLoc3D::XHI_YLO, EdgeBdyLoc3D::XLO_YHI, EdgeBdyLoc3D::XHI_YHI, - NodeBdyLoc3D::XLO_YLO_ZLO, NodeBdyLoc3D::XHI_YLO_ZLO, NodeBdyLoc3D::XLO_YHI_ZLO, - NodeBdyLoc3D::XHI_YHI_ZLO, - NodeBdyLoc3D::XLO_YLO_ZHI, NodeBdyLoc3D::XHI_YLO_ZHI, NodeBdyLoc3D::XLO_YHI_ZHI, - NodeBdyLoc3D::XHI_YHI_ZHI); - F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( - BdryCond::FLOW, - BdryCond::XFLOW, BdryCond::YFLOW, BdryCond::ZFLOW, - BdryCond::REFLECT, - BdryCond::XREFLECT, BdryCond::YREFLECT, BdryCond::ZREFLECT, - BdryCond::DIRICHLET, - BdryCond::XDIRICHLET, BdryCond::YDIRICHLET, BdryCond::ZDIRICHLET, - BdryCond::NEUMANN, - BdryCond::XNEUMANN, BdryCond::YNEUMANN, BdryCond::ZNEUMANN); - s_fortran_constants_stuffed = true; -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.h deleted file mode 100644 index f04aa913..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonBoundaryUtilities3.h +++ /dev/null @@ -1,341 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Utility routines for manipulating Skeleton 3d boundary data - * - ************************************************************************/ - -#ifndef included_appu_SkeletonBoundaryUtilities3 -#define included_appu_SkeletonBoundaryUtilities3 - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/appu/BoundaryUtilityStrategy.h" -#include "SAMRAI/hier/BoundaryBox.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Database.h" - -#include -#include - -using namespace std; -using namespace SAMRAI; -using namespace appu; - -/*! - * @brief Class SkeletonBoundaryUtilities2 is a utility class that - * simplifies the implementation of simple physical boundary data in - * 3 spatial dimensions. It contains routines for reading boundary data - * information from input files, applying those boundary conditions, - * and error checking boundary data. These routines apply to the - * case of cell-centered double data only. One may use all of these - * capabilities, or use the input reading, boundary setting, and error - * checking routines independently. - * - * To use the boundary condition input reading capabilities, the format - * of the input file section containing the boundary information must - * be as described next. Boundary face, node, and edge entries are only - * required for those that are not filled automatically when periodic - * conditions apply. - * - * The boundary condition for face "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_face_* { - * boundary_condition = ... // boundary condition string identifier - * // Any problem-specific boundary data read by user routines - * // is placed here... - * } - * - * Allowable face identifiers (i.e., values for "*") are: - * xlo, xhi, ylo, yhi, zlo, zhi - * Supported face boundary_condition string values are: - * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" - * - * \endverbatim - * - * The boundary condition for edge "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_edge_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable edge identifiers (i.e., values for "*") are: - * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, - * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported edge boundary_condition string values are: - * "XFLOW", "YFLOW", "ZFLOW", - * "XREFLECT", "YREFLECT", "ZREFLECT", - * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" - * "XNEUMANN", "YNEUMANN", "ZNEUMANN" - * - * \endverbatim - * - * Note that edge conditions must be consistent with adjacent face conditions. - * - * The boundary condition for node "*" is provided in a section as follows: - * - * \verbatim - * - * boundary_node_* { - * boundary_condition = ... // boundary condition string identifier - * } - * - * Allowable node identifiers (i.e., values for "*") are: - * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, - * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, - * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi - * Supported node boundary_condition values are: - * "XFLOW", "YFLOW", "ZFLOW", - * "XREFLECT", "YREFLECT", "ZREFLECT", - * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" - * "XNEUMANN", "YNEUMANN", "ZNEUMANN" - * - * \endverbatim - * - * Note that node conditions must be consistent with adjacent face conditions. - * - * See the include file SkeletonBoundaryDefines.h for integer constant - * definitions that apply for the various boundary types, locations, - * and boundary conditions. If you choose to use the input reading - * capabilities only and write your own boundary condition routines in - * FORTRAN, you should note that the integer constants for the various - * boundary condition types and locations are automatically "stuffed" into - * FORTRAN common blocks. This avoids potential problems with - * inconsistencies between C++ and FORTRAN usage. Please see the - * FORTRAN include file cartbdryparams3d.i for details. - * - * @see appu::BoundaryUtilityStrategy3 - */ - -struct SkeletonBoundaryUtilities3 { -public: - /*! - * Function to read 3d boundary data from input database. - * The integer boundary condition types are placed in the integer - * arrays supplied by the caller (typically, the concrete - * BoundaryUtilityStrategy object provided). When DIRICHLET or - * NEUMANN conditions are specified, control is passed to the - * BoundaryUtilityStrategy to read the boundary state data specific to - * the problem. - * - * Errors will be reported and the program will abort whenever necessary - * boundary condition information is missing in the input database, or - * when the data read in is either unknown or inconsistent. The periodic - * domain information is used to determine which boundary face, edge, or - * node entries are not required from input. Error checking - * requires that node and edge boundary conditions are consistent - * with those specified for the faces. - * - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN - * conditions - * @param bdry_db input database containing all boundary data - * @param face_conds array into which integer face boundary condition types - * are read - * @param edge_conds array into which integer edge boundary condition types - * are read - * @param node_conds array into which integer node boundary condition types - * are read - * @param periodic integer vector specifying which coordinate - * directions are periodic (e.g., value returned from - * GridGeometry2::getPeriodicShift()) - */ - static void - readBoundaryInput( - appu::BoundaryUtilityStrategy* bdry_strategy, - const boost::shared_ptr& bdry_db, - tbox::Array& face_conds, - tbox::Array& edge_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - /*! - * Function to fill 3d face boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_face_conds tbox::Array of boundary condition types for patch faces. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillFaceBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_face_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function to fill 3d edge boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_edge_conds tbox::Array of boundary condition types for patch edges. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillEdgeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_edge_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function to fill 3d node boundary values for a patch. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @param varname String name of variable (for error reporting). - * @param vardata Cell-centered patch data object to fill. - * @param patch hier::Patch on which data object lives. - * @param ghost_width_to_fill Width of ghost region to fill. - * @param bdry_node_conds tbox::Array of boundary condition types for patch nodes. - * @param bdry_face_values tbox::Array of boundary values for patch faces. - */ - static void - fillNodeBoundaryData( - const string& varname, - boost::shared_ptr >& vardata, - const hier::Patch& patch, - const hier::IntVector& ghost_width_to_fill, - const tbox::Array& bdry_node_conds, - const tbox::Array& bdry_face_values); - - /*! - * Function that returns the integer face boundary location - * corresponding to the given edge location and edge boundary - * condition. - * - * If the edge boundary condition type or edge location are unknown, - * or the boundary condition type is inconsistant with the edge location - * an error results. - * - * @return Integer face location for edge location and boundary condition type. - * - * @param edge_loc Integer location for edge. - * @param edge_btype Integer boundary condition type for edge. - */ - static int - getFaceLocationForEdgeBdry( - int edge_loc, - int edge_btype); - - /*! - * Function that returns the integer face boundary location - * corresponding to the given node location and node boundary - * condition. - * - * If the node boundary condition type or node location are unknown, - * or the boundary condition type is inconsistant with the node location - * an error results. - * - * @return Integer face location for node location and boundary condition type. - * - * @param node_loc Integer location for node. - * @param node_btype Integer boundary condition type for node. - */ - static int - getFaceLocationForNodeBdry( - int node_loc, - int node_btype); - - /*! - * Function to check 3d boundary data for a patch data quantity on - * a patch after it is set. A warning message will be sent to log - * file for each bad boundary value that is found. - * - * When assertion checking is active, assertions will result when any - * of the pointer arguments is null, or an array is passed in with the - * the wrong size. - * - * @return Integer number of bad boundary values found. - * - * @param varname String name of variable (for error reporting). - * @param patch hier::Patch on which data object lives. - * @param data_id hier::Patch data index for data on patch. - * @param depth Depth index of patch data to check. - * @param gcw_to_check Width of ghost region to check. - * @param bbox Boundary box to check. - * @param bcase Boundary condition type for given edge or node. - * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. - */ - static int - checkBdryData( - const string& varname, - const hier::Patch& patch, - int data_id, - int depth, - const hier::IntVector& gcw_to_check, - const hier::BoundaryBox& bbox, - int bcase, - double bstate); - -private: - static bool s_fortran_constants_stuffed; - - static void - read3dBdryFaces( - appu::BoundaryUtilityStrategy* bdry_strategy, - boost::shared_ptr bdry_db, - tbox::Array& face_conds, - const hier::IntVector& periodic); - - static void - read3dBdryEdges( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& edge_conds, - const hier::IntVector& periodic); - - static void - read3dBdryNodes( - boost::shared_ptr bdry_db, - const tbox::Array& face_conds, - tbox::Array& node_conds, - const hier::IntVector& periodic); - - static void - get3dBdryDirectionCheckValues( - int& idir, - int& offsign, - int btype, - int bloc, - int bcase); - - static void - stuff3dBdryFortConst(); -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.C deleted file mode 100644 index 3a3f78be..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.C +++ /dev/null @@ -1,263 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Conservative linear refine operator for cell-centered - * double data on a Skeleton mesh. - * - ************************************************************************/ - -#include "SkeletonCellDoubleConservativeLinearRefine.h" - -#include -#include -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Array.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN routines. - * - ************************************************************************* - */ - -extern "C" { -// in cartrefine1d.f: -void F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *); -// in cartrefine2d.f: -void F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, double *); -// in cartrefine3d.f: -void F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *, - double *, double *, double *, - double *, double *, double *); -} - -using namespace SAMRAI; - -SkeletonCellDoubleConservativeLinearRefine:: -SkeletonCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim): - hier::RefineOperator(dim, "SKELETON_CONSERVATIVE_LINEAR_REFINE") -{ - const int max_levels = 10; - d_dx.resizeArray(max_levels); - for (int n = 0; n < max_levels; n++) { - d_dx[n].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[n][i] = 1.; - } - } - -} - -SkeletonCellDoubleConservativeLinearRefine::~ -SkeletonCellDoubleConservativeLinearRefine() -{ -} - -int -SkeletonCellDoubleConservativeLinearRefine::getOperatorPriority() const -{ - return 0; -} - -hier::IntVector -SkeletonCellDoubleConservativeLinearRefine::getStencilWidth() const { - return hier::IntVector(getDim(), 1); -} - -void SkeletonCellDoubleConservativeLinearRefine::refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::BoxOverlap& fine_overlap, - const hier::IntVector& ratio) const -{ - const pdat::CellOverlap* t_overlap = - dynamic_cast(&fine_overlap); - - TBOX_ASSERT(t_overlap != NULL); - - const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b = boxes.begin(); - b != boxes.end(); ++b) { - refine(fine, - coarse, - dst_component, - src_component, - *b, - ratio); - } -} - -void SkeletonCellDoubleConservativeLinearRefine::refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::Box& fine_box, - const hier::IntVector& ratio) const -{ - boost::shared_ptr > cdata( - coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > fdata( - fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); - - TBOX_ASSERT(cdata); - TBOX_ASSERT(fdata); - TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); - - const hier::Box cgbox(cdata->getGhostBox()); - - const hier::Index cilo = cgbox.lower(); - const hier::Index cihi = cgbox.upper(); - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - - const boost::shared_ptr cgeom( - coarse.getPatchGeometry()); - const boost::shared_ptr fgeom( - fine.getPatchGeometry()); - - const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - const hier::Index ifirstf = fine_box.lower(); - const hier::Index ilastf = fine_box.upper(); - - const hier::IntVector tmp_ghosts(getDim(), 0); - tbox::Array diff0(cgbox.numberCells(0) + 1); - pdat::CellData slope0(cgbox, 1, tmp_ghosts); - - int flev_num = fine.getPatchLevelNumber(); - int clev_num = coarse.getPatchLevelNumber(); - - // deal with levels not in hierarchy - if (flev_num < 0) flev_num = clev_num + 1; - if (clev_num < 0) clev_num = flev_num - 1; - - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - getDx(clev_num, cdx); - getDx(flev_num, fdx); - - for (int d = 0; d < fdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( - ifirstc(0), ilastc(0), - ifirstf(0), ilastf(0), - cilo(0), cihi(0), - filo(0), fihi(0), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer()); - } else if (getDim() == tbox::Dimension(2)) { - - tbox::Array diff1(cgbox.numberCells(1) + 1); - pdat::CellData slope1(cgbox, 1, tmp_ghosts); - - F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( - ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), - ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), - cilo(0), cilo(1), cihi(0), cihi(1), - filo(0), filo(1), fihi(0), fihi(1), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer()); - } else if (getDim() == tbox::Dimension(3)) { - - tbox::Array diff1(cgbox.numberCells(1) + 1); - pdat::CellData slope1(cgbox, 1, tmp_ghosts); - - tbox::Array diff2(cgbox.numberCells(2) + 1); - pdat::CellData slope2(cgbox, 1, tmp_ghosts); - - F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( - ifirstc(0), ifirstc(1), ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - ifirstf(0), ifirstf(1), ifirstf(2), - ilastf(0), ilastf(1), ilastf(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - &ratio[0], - cdx, - fdx, - cdata->getPointer(d), - fdata->getPointer(d), - diff0.getPointer(), slope0.getPointer(), - diff1.getPointer(), slope1.getPointer(), - diff2.getPointer(), slope2.getPointer()); - } else { - TBOX_ERROR("SkeletonCellDoubleConservativeLinearRefine error...\n" - << "getDim() > 3 not supported." << endl); - - } - } -} - -void SkeletonCellDoubleConservativeLinearRefine::setDx( - const int level_number, - const double* dx) -{ - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); - } - if (d_dx[level_number].size() < getDim().getValue()) { - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[level_number][i] = dx[i]; - } - } -} - -void SkeletonCellDoubleConservativeLinearRefine::getDx( - const int level_number, - double* dx) const -{ - for (int i = 0; i < getDim().getValue(); i++) { - dx[i] = d_dx[level_number][i]; - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.h deleted file mode 100644 index d44416a0..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleConservativeLinearRefine.h +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Conservative linear refine operator for cell-centered - * double data on a Skeleton mesh. - * - ************************************************************************/ - -#ifndef included_SkeletonCellDoubleConservativeLinearRefineXD -#define included_SkeletonCellDoubleConservativeLinearRefineXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#ifndef included_String -#include -#define included_String -#endif -#include "SAMRAI/hier/RefineOperator.h" - -#include - -using namespace std; -using namespace SAMRAI; - -/** - * Class SkeletonCellDoubleConservativeLinearRefine implements - * conservative linear interpolation for cell-centered double patch data - * defined over a Skeleton mesh. It is derived from the base class - * hier::RefineOperator. The numerical operations for the interpolation - * use FORTRAN numerical routines. - * - * @see hier::RefineOperator - */ - -class SkeletonCellDoubleConservativeLinearRefine: - public hier::RefineOperator -{ -public: - /** - * Uninteresting default constructor. - */ - SkeletonCellDoubleConservativeLinearRefine( - const tbox::Dimension& dim); - - /** - * Uninteresting virtual destructor. - */ - virtual ~SkeletonCellDoubleConservativeLinearRefine(); - - /** - * The priority of cell-centered double conservative linear is 0. - * It will be performed before any user-defined interpolation operations. - */ - int - getOperatorPriority() const; - - /** - * The stencil width of the conservative linear interpolation operator is - * the vector of ones. - */ - hier::IntVector - getStencilWidth() const; - - /** - * Refine the source component on the coarse patch to the destination - * component on the fine patch using the cell-centered double conservative - * linear interpolation operator. Interpolation is performed on the - * intersection of the destination patch and the fine box. It is assumed - * that the coarse patch contains sufficient data for the stencil width of - * the refinement operator. - */ - void - refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::BoxOverlap& fine_overlap, - const hier::IntVector& ratio) const; - - void - refine( - hier::Patch& fine, - const hier::Patch& coarse, - const int dst_component, - const int src_component, - const hier::Box& fine_box, - const hier::IntVector& ratio) const; - - /** - * Set the dx, the distance between mesh nodes. - */ - void - setDx( - const int level_number, - const double* dx); - -private: - /** - * Return the dx - */ - void - getDx( - const int level_number, - double* dx) const; - - tbox::Array > d_dx; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.C deleted file mode 100644 index e89cffd6..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.C +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Weighted averaging operator for cell-centered double data on - * a Skeleton mesh. - * - ************************************************************************/ - -#include "SkeletonCellDoubleWeightedAverage.h" - -#include -#include -#include "SAMRAI/hier/PatchGeometry.h" -#include "SAMRAI/hier/Index.h" -#include "SAMRAI/pdat/CellData.h" -#include "SAMRAI/pdat/CellVariable.h" -#include "SAMRAI/tbox/Utilities.h" - -/* - ************************************************************************* - * - * External declarations for FORTRAN routines. - * - ************************************************************************* - */ -extern "C" { -// in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( - const int&, const int&, - const int&, const int&, - const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -// in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int&, const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -// in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int&, const int&, const int&, - const int *, const double *, const double *, - const double *, double *); -} - -using namespace SAMRAI; - -SkeletonCellDoubleWeightedAverage::SkeletonCellDoubleWeightedAverage( - const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "SKELETON_CONSERVATIVE_COARSEN") -{ -} - -SkeletonCellDoubleWeightedAverage::~SkeletonCellDoubleWeightedAverage() -{ -} - -int SkeletonCellDoubleWeightedAverage::getOperatorPriority() const -{ - return 0; -} - -hier::IntVector -SkeletonCellDoubleWeightedAverage::getStencilWidth() const { - return hier::IntVector(getDim(), 0); -} - -void SkeletonCellDoubleWeightedAverage::coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const -{ - boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(fdata); - TBOX_ASSERT(cdata); - TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); -#endif - - const hier::Index filo = fdata->getGhostBox().lower(); - const hier::Index fihi = fdata->getGhostBox().upper(); - const hier::Index cilo = cdata->getGhostBox().lower(); - const hier::Index cihi = cdata->getGhostBox().upper(); - - const boost::shared_ptr fgeom( - fine.getPatchGeometry()); - const boost::shared_ptr cgeom( - coarse.getPatchGeometry()); - - const hier::Index ifirstc = coarse_box.lower(); - const hier::Index ilastc = coarse_box.upper(); - - int flev_num = fine.getPatchLevelNumber(); - int clev_num = coarse.getPatchLevelNumber(); - - // deal with levels not in hierarchy - if (flev_num < 0) flev_num = clev_num + 1; - if (clev_num < 0) clev_num = flev_num - 1; - - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - getDx(clev_num, cdx); - getDx(flev_num, fdx); - - for (int d = 0; d < cdata->getDepth(); d++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( - ifirstc(0), ilastc(0), - filo(0), fihi(0), - cilo(0), cihi(0), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( - ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), - filo(0), filo(1), fihi(0), fihi(1), - cilo(0), cilo(1), cihi(0), cihi(1), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( - ifirstc(0), ifirstc(1), ifirstc(2), - ilastc(0), ilastc(1), ilastc(2), - filo(0), filo(1), filo(2), - fihi(0), fihi(1), fihi(2), - cilo(0), cilo(1), cilo(2), - cihi(0), cihi(1), cihi(2), - &ratio[0], - fdx, - cdx, - fdata->getPointer(d), - cdata->getPointer(d)); - } else { - TBOX_ERROR("SkeletonCellDoubleWeightedAverage error...\n" - << "getDim() > 3 not supported." << endl); - - } - } -} - -void SkeletonCellDoubleWeightedAverage::setDx( - const int level_number, - const double* dx) -{ - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); - } - if (d_dx[level_number].size() < getDim().getValue()) { - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { - d_dx[level_number][i] = dx[i]; - } - } -} - -void SkeletonCellDoubleWeightedAverage::getDx( - const int level_number, - double* dx) const -{ - for (int i = 0; i < getDim().getValue(); i++) { - dx[i] = d_dx[level_number][i]; - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.h deleted file mode 100644 index 20de42ec..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonCellDoubleWeightedAverage.h +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Weighted averaging operator for cell-centered double data on - * a Skeleton mesh. - * - ************************************************************************/ - -#ifndef included_SkeletonCellDoubleWeightedAverageXD -#define included_SkeletonCellDoubleWeightedAverageXD - -#include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/hier/Box.h" -#include "SAMRAI/hier/IntVector.h" -#include "SAMRAI/hier/Patch.h" -#ifndef included_String -#include -#define included_String -#endif -#include "SAMRAI/hier/CoarsenOperator.h" - -#include - -using namespace std; -using namespace SAMRAI; - -/** - * Class SkeletonCellDoubleWeightedAverageX implements conservative - * cell-weighted averaging for cell-centered double patch data defined over a - * Skeleton mesh. It is derived from the hier::CoarsenOperator base class. - * The numerical operations for the averaging use FORTRAN numerical routines. - * - * @see hier::CoarsenOperator - */ - -class SkeletonCellDoubleWeightedAverage: - public hier::CoarsenOperator -{ -public: - /** - * Uninteresting default constructor. - */ - SkeletonCellDoubleWeightedAverage( - const tbox::Dimension& dim); - - /** - * Uninteresting virtual destructor. - */ - virtual ~SkeletonCellDoubleWeightedAverage(); - - /** - * The priority of cell-centered double weighted averaging is 0. - * It will be performed before any user-defined coarsen operations. - */ - int - getOperatorPriority() const; - - /** - * The stencil width of the weighted averaging operator is the vector of - * zeros. That is, its stencil does not extend outside the fine box. - */ - hier::IntVector - getStencilWidth() const; - - /** - * Coarsen the source component on the fine patch to the destination - * component on the coarse patch using the cell-centered double weighted - * averaging operator. Coarsening is performed on the intersection of - * the destination patch and the coarse box. It is assumed that the - * fine patch contains sufficient data for the stencil width of the - * coarsening operator. - */ - void - coarsen( - hier::Patch& coarse, - const hier::Patch& fine, - const int dst_component, - const int src_component, - const hier::Box& coarse_box, - const hier::IntVector& ratio) const; - - /** - * Set the dx, the distance between mesh nodes. - */ - void - setDx( - const int level_number, - const double* dx); - -private: - /** - * Return the dx - */ - void - getDx( - const int level_number, - double* dx) const; - - tbox::Array > d_dx; - -}; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.C index 9c4afc01..969a9482 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Skeleton mesh. * @@ -28,14 +28,14 @@ */ extern "C" { // in cartcoarsen1d.f: -void F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) ( const int&, const int&, const int&, const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); // in cartcoarsen2d.f: -void F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -45,7 +45,7 @@ void F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) ( const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -55,7 +55,7 @@ void F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) ( const int *, const double *, const double *, const double *, double *); // in cartcoarsen3d.f: -void F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -64,7 +64,7 @@ void F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) ( const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -73,7 +73,7 @@ void F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) ( const int&, const int&, const int&, const int *, const double *, const double *, const double *, double *); -void F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) ( +void SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) ( const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, @@ -88,7 +88,8 @@ using namespace SAMRAI; SkeletonOutersideDoubleWeightedAverage::SkeletonOutersideDoubleWeightedAverage( const tbox::Dimension& dim): - hier::CoarsenOperator(dim, "SKELETON_CONSERVATIVE_COARSEN") + hier::CoarsenOperator("SKELETON_CONSERVATIVE_COARSEN"), + d_dim(dim) { } @@ -102,8 +103,8 @@ int SkeletonOutersideDoubleWeightedAverage::getOperatorPriority() const } hier::IntVector -SkeletonOutersideDoubleWeightedAverage::getStencilWidth() const { - return hier::IntVector(getDim(), 0); +SkeletonOutersideDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector(dim, 0); } void SkeletonOutersideDoubleWeightedAverage::coarsen( @@ -115,16 +116,14 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( const hier::IntVector& ratio) const { boost::shared_ptr > fdata( - fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); boost::shared_ptr > cdata( - coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); -#ifdef DEBUG_CHECK_ASSERTIONS + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); TBOX_ASSERT(fdata); TBOX_ASSERT(cdata); TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); -#endif const hier::Index filo = fdata->getGhostBox().lower(); const hier::Index fihi = fdata->getGhostBox().upper(); @@ -146,16 +145,16 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( if (flev_num < 0) flev_num = clev_num + 1; if (clev_num < 0) clev_num = flev_num - 1; - double cdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double fdx[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double cdx[SAMRAI::MAX_DIM_VAL]; + double fdx[SAMRAI::MAX_DIM_VAL]; getDx(clev_num, cdx); getDx(flev_num, fdx); - for (int d = 0; d < cdata->getDepth(); d++) { + for (int d = 0; d < cdata->getDepth(); ++d) { // loop over lower and upper outerside arrays - for (int i = 0; i < 2; i++) { - if (getDim() == tbox::Dimension(1)) { - F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) ( + for (int i = 0; i < 2; ++i) { + if (d_dim == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub1d, CARTWGTAVGOUTFACEDOUB1D) ( ifirstc(0), ilastc(0), filo(0), fihi(0), cilo(0), cihi(0), @@ -164,8 +163,8 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - } else if (getDim() == tbox::Dimension(2)) { - F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) ( + } else if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d0, CARTWGTAVGOUTFACEDOUB2D0) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -174,7 +173,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) ( + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub2d1, CARTWGTAVGOUTFACEDOUB2D1) ( ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), filo(0), filo(1), fihi(0), fihi(1), cilo(0), cilo(1), cihi(0), cihi(1), @@ -183,8 +182,8 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - } else if (getDim() == tbox::Dimension(3)) { - F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) ( + } else if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d0, CARTWGTAVGOUTFACEDOUB3D0) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -196,7 +195,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(0, i, d), cdata->getPointer(0, i, d)); - F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) ( + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d1, CARTWGTAVGOUTFACEDOUB3D1) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -208,7 +207,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdx, fdata->getPointer(1, i, d), cdata->getPointer(1, i, d)); - F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) ( + SAMRAI_F77_FUNC(cartwgtavgoutfacedoub3d2, CARTWGTAVGOUTFACEDOUB3D2) ( ifirstc(0), ifirstc(1), ifirstc(2), ilastc(0), ilastc(1), ilastc(2), filo(0), filo(1), filo(2), @@ -222,7 +221,7 @@ void SkeletonOutersideDoubleWeightedAverage::coarsen( cdata->getPointer(2, i, d)); } else { TBOX_ERROR("SkeletonOutersideDoubleWeightedAverage error...\n" - << "getDim() > 3 not supported." << endl); + << "d_dim > 3 not supported." << endl); } } } @@ -232,12 +231,12 @@ void SkeletonOutersideDoubleWeightedAverage::setDx( const int level_number, const double* dx) { - if (level_number >= d_dx.getSize()) { - d_dx.resizeArray(level_number + 1); + if (level_number >= static_cast(d_dx.size())) { + d_dx.resize(level_number + 1); } - if (d_dx[level_number].size() < getDim().getValue()) { - d_dx[level_number].resizeArray(getDim().getValue()); - for (int i = 0; i < getDim().getValue(); i++) { + if (static_cast(d_dx[level_number].size()) < d_dim.getValue()) { + d_dx[level_number].resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { d_dx[level_number][i] = dx[i]; } } @@ -247,7 +246,7 @@ void SkeletonOutersideDoubleWeightedAverage::getDx( const int level_number, double* dx) const { - for (int i = 0; i < getDim().getValue(); i++) { + for (int i = 0; i < d_dim.getValue(); ++i) { dx[i] = d_dx[level_number][i]; } } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.h index 67d23ed4..d09f0289 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.h +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/SkeletonOutersideDoubleWeightedAverage.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Weighted averaging operator for outerside double data on * a Skeleton mesh. * @@ -22,7 +22,7 @@ #endif #include "SAMRAI/hier/CoarsenOperator.h" -#include +#include "boost/shared_ptr.hpp" using namespace std; using namespace SAMRAI; @@ -63,7 +63,8 @@ class SkeletonOutersideDoubleWeightedAverage: * zeros. That is, its stencil does not extend outside the fine box. */ hier::IntVector - getStencilWidth() const; + getStencilWidth( + const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination @@ -99,7 +100,9 @@ class SkeletonOutersideDoubleWeightedAverage: const int level_number, double* dx) const; - tbox::Array > d_dx; + tbox::Dimension d_dim; + + std::vector > d_dx; }; diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.depend new file mode 100644 index 00000000..2285ae84 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.depend @@ -0,0 +1,167 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=flux2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + flux2d.m4 m4flux2d.i probparams.i + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=flux3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + flux3d.m4 m4flux3d.i probparams.i + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=fluxcorner3d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + fluxcorner3d.m4 m4fluxcorner3d.i probparams.i + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=grad2d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + grad2d.m4 probparams.i + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=grad3d.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + grad3d.m4 probparams.i + +DEPENDS_4 +=\ + + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=init2d.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + init2d.m4 probparams.i + +DEPENDS_5 +=\ + + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=init3d.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + init3d.m4 probparams.i + +DEPENDS_6 +=\ + + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=stable2d.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + stable2d.m4 + +DEPENDS_7 +=\ + + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=stable3d.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + stable3d.m4 + +DEPENDS_8 +=\ + + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=stufprobc.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h probparams.i \ + stufprobc.m4 + +DEPENDS_9 +=\ + + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=trace1d.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h const.i probparams.i \ + trace1d.m4 + +DEPENDS_10 +=\ + + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=trace2d.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i const.i \ + m4trace2d.i probparams.i trace2d.m4 + +DEPENDS_11 +=\ + + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=trace3d.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i const.i \ + m4trace3d.i probparams.i trace3d.m4 + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.in new file mode 100644 index 00000000..1828e012 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/Makefile.in @@ -0,0 +1,85 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI multiblock +## performance test +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/performance/multiblock/fortran +VPATH = @srcdir@ +OBJECT = ../../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= stufprobc.o trace1d.o trace2d.o trace3d.o grad2d.o grad3d.o \ + flux2d.o flux3d.o fluxcorner3d.o stable2d.o stable3d.o \ + init2d.o init3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +flux2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux2d.m4 > flux2d.f + $(F77) $(FFLAGS) -c flux2d.f -o $@ + +flux3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/flux3d.m4 > flux3d.f + $(F77) $(FFLAGS) -c flux3d.f -o $@ + +fluxcorner3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/fluxcorner3d.m4 > fluxcorner3d.f + $(F77) $(FFLAGS) -c fluxcorner3d.f -o $@ + +grad2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad2d.m4 > grad2d.f + $(F77) $(FFLAGS) -c grad2d.f -o $@ + +grad3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/grad3d.m4 > grad3d.f + $(F77) $(FFLAGS) -c grad3d.f -o $@ + +init2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init2d.m4 > init2d.f + $(F77) $(FFLAGS) -c init2d.f -o $@ + +init3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/init3d.m4 > init3d.f + $(F77) $(FFLAGS) -c init3d.f -o $@ + +stable2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable2d.m4 > stable2d.f + $(F77) $(FFLAGS) -c stable2d.f -o $@ + +stable3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/stable3d.m4 > stable3d.f + $(F77) $(FFLAGS) -c stable3d.f -o $@ + +stufprobc.o: + $(M4) $(M4DIRS) $(SRCDIR)/stufprobc.m4 > stufprobc.f + $(F77) $(FFLAGS) -c stufprobc.f -o $@ + +trace1d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace1d.m4 > trace1d.f + $(F77) $(FFLAGS) -c trace1d.f -o $@ + +trace2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace2d.m4 > trace2d.f + $(F77) $(FFLAGS) -c trace2d.f -o $@ + +trace3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/trace3d.m4 > trace3d.f + $(F77) $(FFLAGS) -c trace3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/const.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/const.i index f1303636..d815c0c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/const.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/const.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining FORTRAN constants. +c REAL zero,sixth,fourth,third,half,twothird,rt75,one, & onept5,two,three,pi,four,seven,smallr parameter (zero=0.d0) diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux2d.m4 index 6c04ceee..54eda787 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for fluxes in 2d. +c define(NDIM,2)dnl define(NEQU,1)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4flux2d.i)dnl subroutine fluxcorrec(dt, @@ -164,7 +171,7 @@ c write(6,*) "flux0" c do ic1=ifirst1,ilast1 c do ic0=ifirst0,ilast0+1 c write(6,*) "ic0,flux0= ",ic0,ic1, -c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), +c & flux0(ic0,ic1,1),flux0(ic0,ic1,2), c & flux0(ic0,ic1,3),flux0(ic0,ic1,4) c call flush(6) c enddo @@ -173,7 +180,7 @@ c write(6,*) "flux1" c do ic1=ifirst1,ilast1 c do ic0=ifirst0,ilast0+1 c write(6,*) "ic0,flux1= ",ic0,ic1, -c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), +c & flux1(ic0,ic1,1),flux1(ic0,ic1,2), c & flux1(ic0,ic1,3),flux1(ic0,ic1,4) c call flush(6) c enddo diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux3d.m4 index 7a50fb1b..641c2a04 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/flux3d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for fluxes in 3d. +c define(NDIM,3)dnl define(NEQU,1)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4flux3d.i)dnl subroutine fluxcorrec2d(dt, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.i deleted file mode 100644 index 992cf4f3..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.i +++ /dev/null @@ -1,168 +0,0 @@ -include(FORTDIR/m4fluxjt.i)dnl - - subroutine onethirdstates(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux0,flux1,flux2, - & st3_0,st3_1,st3_2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux0(FACE3d0(ifirst,ilast,FLUXG)), - & flux1(FACE3d1(ifirst,ilast,FLUXG)), - & flux2(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -st_third(0,1,2,`ic1,ic2')dnl -c -st_third(1,2,0,`ic2,ic0')dnl -c -st_third(2,0,1,`ic0,ic1')dnl -c - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxthird(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed, - & uval, - & st3_0,st3_1,st3_2, - & flux01,flux12,flux20, - & flux02,flux10,flux21) - -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt - REAL - & dx(0:NDIM-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)) -c variables in 2d side indexed - REAL - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & st3_0(CELL3d(ifirst,ilast,CELLG)), - & st3_1(CELL3d(ifirst,ilast,CELLG)), - & st3_2(CELL3d(ifirst,ilast,CELLG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL riemst -c -c*********************************************************************** -c solve riemann problems for conservative flux -c arguments: ( axis for RP, other axis, extra cells-direction) -c*********************************************************************** -c - -f_third(0,1,2,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(0,2,1,`ic1,ic2',`ic0-1,ic1,ic2')dnl -c -f_third(1,0,2,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(1,2,0,`ic2,ic0',`ic0,ic1-1,ic2')dnl -c -f_third(2,0,1,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -f_third(2,1,0,`ic0,ic1',`ic0,ic1,ic2-1')dnl -c -c call flush(6) - return - end -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** - subroutine fluxcorrecjt(dt,dx, - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & advecspeed,uval, - & flux01,flux12,flux20, - & flux02,flux10,flux21, - & tracelft0,tracelft1,tracelft2, - & tracergt0,tracergt1,tracergt2) -c*********************************************************************** -include(FORTDIR/const.i)dnl -c*********************************************************************** -c*********************************************************************** -c input arrays: - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - REAL dt -c variables in 1d axis indexed -c - REAL - & dx(0:3-1) -c variables in 2d cell indexed - REAL - & advecspeed(0:NDIM-1), - & uval(CELL3d(ifirst,ilast,CELLG)), - & flux01(FACE3d0(ifirst,ilast,FLUXG)), - & flux10(FACE3d1(ifirst,ilast,FLUXG)), - & flux20(FACE3d2(ifirst,ilast,FLUXG)), - & flux02(FACE3d0(ifirst,ilast,FLUXG)), - & flux12(FACE3d1(ifirst,ilast,FLUXG)), - & flux21(FACE3d2(ifirst,ilast,FLUXG)), - & tracelft0(FACE3d0(ifirst,ilast,FACEG)), - & tracergt0(FACE3d0(ifirst,ilast,FACEG)), - & tracelft1(FACE3d1(ifirst,ilast,FACEG)), - & tracergt1(FACE3d1(ifirst,ilast,FACEG)), - & tracelft2(FACE3d2(ifirst,ilast,FACEG)), - & tracergt2(FACE3d2(ifirst,ilast,FACEG)) -c -c*********************************************************************** -c - integer ic0,ic1,ic2 - REAL trnsvers -c REAL ttvlft,ttvrgt - -c ****************************************************************** -c * complete tracing at cell edges -c ****************************************************************** -c -correc_fluxjt(2,0,1,`ic1,ic2',`ic2,ic0')dnl -c -correc_fluxjt(1,2,0,`ic0,ic1',`ic1,ic2')dnl -c -correc_fluxjt(0,1,2,`ic2,ic0',`ic0,ic1')dnl -c -c call flush(6) - return - end -c -c*********************************************************************** -c*********************************************************************** -c*********************************************************************** diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.m4 index e13aefca..39098e37 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/fluxcorner3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for corner fluxes in 2d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4fluxcorner3d.i)dnl subroutine onethirdstate3d(dt,dx,idir, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad2d.m4 index 3ae0eb70..7870227d 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad2d.m4 @@ -1,7 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradients in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl - +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine detectgrad2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad3d.m4 index 52917b23..95a43bd3 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/grad3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for gradients in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine detectgrad3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init2d.m4 index 213e9df6..441255da 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine linadvinit2d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init3d.m4 index 2585c8cd..8c8bf03c 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/init3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for initialization in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine linadvinit3d(data_problem,dx,xlo,xhi, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m3fluxjt3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m3fluxjt3d.i deleted file mode 100644 index c9c03036..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m3fluxjt3d.i +++ /dev/null @@ -1,60 +0,0 @@ -define(st_third,`dnl - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2-1,ilast$2+1 - do ic$1=ifirst$1,ilast$1 - trnsvers= - & (flux$1(ic$1+1,$4)-flux$1(ic$1,$4))/(3*dx($1)) -c - st3_$1(ic0,ic1,ic2)=uval(ic0,ic1,ic2) -trnsvers - enddo - enddo - enddo -')dnl -define(f_third,`dnl -c write(6,*) "checking onedr sol in riemann solve " -c write(6,*) " dt= ",dt - do ic$3=ifirst$3-1,ilast$3+1 - do ic$2=ifirst$2,ilast$2 - do ic$1=ifirst$1,ilast$1+1 - - if (advecspeed($1).ge.zero) then - riemst = st3_$2($5) - else - riemst = st3_$2(ic0,ic1,ic2) - endif - flux$1$2(ic$1,$4)= dt*riemst*advecspeed($1) - enddo - enddo - enddo -')dnl -define(correc_fluxjt,`dnl -c correct the $1-direction with $2$3-fluxes - do ic$3=ifirst$3,ilast$3 - do ic$2=ifirst$2,ilast$2 - ic$1=ifirst$1-1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - do ic$1=ifirst$1,ilast$1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracelft$1(ic$1+1,ic$2,ic$3)=tracelft$1(ic$1+1,ic$2,ic$3) - & - trnsvers - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - ic$1=ilast$1+1 - trnsvers=0.5*( - & (flux$2$3(ic$2+1,$4)-flux$2$3(ic$2,$4))/dx($2)+ - & (flux$3$2(ic$3+1,$5)-flux$3$2(ic$3,$5))/dx($3)) - - tracergt$1(ic$1 ,ic$2,ic$3)=tracergt$1(ic$1 ,ic$2,ic$3) - & - trnsvers - enddo - enddo -')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4bdry3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4bdry3d.i deleted file mode 100644 index 7ba8c7ca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4bdry3d.i +++ /dev/null @@ -1,167 +0,0 @@ -define(cell_even,`dnl - uval(ic0,ic1,ic2)=uval($1) -')dnl -define(lin_boundary,`dnl - ict$1 = $2 - uval0 = uval(ict0,ict1,ict2) - ict$1 = $3 - slope=(uval0-uval(ict0,ict1,ict2))/($2-$3) - uval(ic0,ic1,ic2)=uval0 + (ic$1-$2)*slope -')dnl -define(fixed_state,`dnl - uval(ic0,ic1,ic2)=bdry_states(1+(sn-1)) -')dnl -define(symmetry,`dnl - ict$1 = 3*$2-$3-ic$1 - uval(ic0,ic1,ic2)=uval(ict0,ict1,ict2) -')dnl -define(do_bdry_face,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -lin_boundary(`$1',`$5',`$6')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 - ict$1 = $5 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=ibeg$2,iend$2 - ict$2 = ic$2 - do ic$3=ibeg$3,iend$3 - ict$3 = ic$3 - do ic$1=$4 -symmetry(`$1',`$5',`$6')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_node,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -lin_boundary(`0',`$4',`$5')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic0=$1 - ict0 = $4 - do ic1=$2 - ict1 = ic1 - do ic2=$3 - ict2 = ic2 -symmetry(`0',`$4',`$5')dnl - enddo - enddo - enddo - endif -')dnl -c -define(do_bdry_edge,`dnl -c write(6,*) "ibdebug ",ibdebug -c write(6,*) "iedebug ",iedebug - if ((bdry_case.eq.FLOW)) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -cell_even(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.LINEAR) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -lin_boundary($2,`$6',`$7')dnl - enddo - enddo - enddo - else if (bdry_case.eq.FIXED) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 - ict$2 = $6 -fixed_state(`ict0,ict1,ict2')dnl - enddo - enddo - enddo - else if (bdry_case.eq.SYMMETRIC) then - do ic$2=$4 - ict$2 = ic$2 - do ic$3=$5 - ict$3 = ic$3 - do ic$1=ibeg$1,iend$1 - ict$1 = ic$1 -symmetry($2,`$6',`$7')dnl - enddo - enddo - enddo - endif -')dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux2d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux2d.i index 338013fc..abfa1efe 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux2d.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux3d.i index 6460c423..e1c9aa3a 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux3d.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4flux3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d flux calculation. +c define(riemann_solve,`dnl c write(6,*) "checking onedr sol in riemann solve " c write(6,*) " dt= ",dt diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4fluxcorner3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4fluxcorner3d.i index c24a00b7..2115d9da 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4fluxcorner3d.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4fluxcorner3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d corner flux calculation. +c define(st_third,`dnl do ic$3=ifirst$3-1,ilast$3+1 do ic$2=ifirst$2-1,ilast$2+1 diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace2d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace2d.i index 64054d15..082f7c22 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace2d.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace2d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 2d trace calculation. +c define(trace_init,`dnl do ic$2=ifirst$2-FACEG,ilast$2+FACEG ie$1=ifirst$1-FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace3d.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace3d.i index 743987f9..6b2a6ba4 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace3d.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/m4trace3d.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file for 3d trace calculation. +c define(trace_init,`dnl do ic$3=ifirst$3-FACEG,ilast$3+FACEG do ic$2=ifirst$2-FACEG,ilast$2+FACEG diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/probparams.i b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/probparams.i index 1b46a43e..b43283f0 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/probparams.i +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/probparams.i @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: m4 include file defining common block. +c common/probparams/ & PIECEWISE_CONSTANT_X,PIECEWISE_CONSTANT_Y,PIECEWISE_CONSTANT_Z, & SINE_CONSTANT_X,SINE_CONSTANT_Y,SINE_CONSTANT_Z,SPHERE, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry2d.m4 deleted file mode 100644 index ea1f8b74..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry2d.m4 +++ /dev/null @@ -1,430 +0,0 @@ -c -c -c general boundary condition cases -c -c -c node boundary conditions -c -c -c edge boundary conditions -c -c*********************************************************************** -c*********************************************************************** - subroutine getskeledgebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1, 0) 2 (0,-1) -c 1 ( 1, 0) 3 (0, 1) -c*********************************************************************** -c*********************************************************************** - edge_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc) - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskelnodebdry2d( - & ifirst0,ilast0,ifirst1,ilast1, - & ibeg0,iend0,ibeg1,iend1, - & ngc0,ngc1, - & bdry_loc, - & bdry_cond, - & edge_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1 - integer ibeg0,iend0,ibeg1,iend1 - integer ngc0,ngc1 -c -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & edge_values(0:arrdepth-1,0:2*2-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) -c - integer ic1,ic0,ict0,ict1 - integer k - integer ipivot0,ipivot1 - integer edge_loc0,edge_loc1 - double precision dirsign0,dirsign1 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index -c 0 (-1,-1) -c 1 ( 1,-1) -c 2 (-1, 1) -c 3 ( 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else if (bdry_loc.eq.X0Y1) then - edge_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - else if (bdry_loc.eq.X1Y1) then - edge_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - edge_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc0) - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=edge_values(k,edge_loc1) - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) - enddo - arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getskelnodebdry2d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdryloc2d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - -c 2d edges - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - -c 2d nodes - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdrycond2d( - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin -c -c File: appu_skelbdryparams2d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 2d boundary constant common blocks -c - common/skelbdrylocparams2d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT, - & X0Y0,X1Y0,X0Y1,X1Y1 -c -c - common/skelbdrycondparams2d/ - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - integer - & FLOW,XFLOW,YFLOW, - & REFLECT,XREFLECT,YREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry3d.m4 deleted file mode 100644 index 35ed9eb1..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/skelbdry3d.m4 +++ /dev/null @@ -1,1414 +0,0 @@ -c -c*********************************************************************** -c*********************************************************************** - subroutine getskelfacebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_cartbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (-1, 0, 0) 2 (0,-1, 0) 4 (0, 0,-1) -c 1 ( 1, 0, 0) 3 (0, 1, 0) 5 (0, 0, 1) -c*********************************************************************** -c*********************************************************************** - face_loc = bdry_loc - if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then - if (bdry_loc.eq.XLEFT) then -c x0 boundary - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else -c x1 boundary - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then - if (bdry_loc.eq.YLEFT) then -c y0 boundary - ipivot1 = ifirst1 - dirsign1 = -1.d0 - else -c y1 boundary - ipivot1 = ilast1 - dirsign1 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.ZLEFT).or.(bdry_loc.eq.ZRIGHT)) then - if (bdry_loc.eq.ZLEFT) then -c z0 boundary - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else -c z1 boundary - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.DIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.NEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.FLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.REFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskeledgebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index bdry_loc index -c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) -c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) -c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) -c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) -c*********************************************************************** -c*********************************************************************** - if ((bdry_loc.eq.Y0Z0).or.(bdry_loc.eq.Y1Z0).or. - & (bdry_loc.eq.Y0Z1).or.(bdry_loc.eq.Y1Z1)) then - if (bdry_loc.eq.Y0Z0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y1Z0) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.Y0Z1) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Z0).or.(bdry_loc.eq.X0Z1).or. - & (bdry_loc.eq.X1Z0).or.(bdry_loc.eq.X1Z1)) then - if (bdry_loc.eq.X0Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X0Z1) then - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Z0) then - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - else if ((bdry_loc.eq.X0Y0).or.(bdry_loc.eq.X1Y0).or. - & (bdry_loc.eq.X0Y1).or.(bdry_loc.eq.X1Y1)) then - if (bdry_loc.eq.X0Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else if (bdry_loc.eq.X1Y0) then - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - else if (bdry_loc.eq.X0Y1) then - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - else - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif - endif -c - return - end -c*********************************************************************** -c*********************************************************************** - subroutine getskelnodebdry3d( - & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, - & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, - & ngc0,ngc1,ngc2, - & dx, - & bdry_loc, - & bdry_cond, - & face_values, - & arrdata, - & arrdepth) -c*********************************************************************** - implicit none -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN -c*********************************************************************** - integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 - integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 - integer ngc0,ngc1,ngc2 -c - double precision dx(0:3-1) -c - integer bdry_loc, - & arrdepth, - & bdry_cond - double precision - & face_values(0:arrdepth-1,0:2*3-1) -c - double precision - & arrdata(ifirst0-ngc0:ilast0+ngc0, - & ifirst1-ngc1:ilast1+ngc1, - & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) -c - integer ic2,ic1,ic0,ict0,ict1,ict2 - integer k - integer ipivot0,ipivot1,ipivot2 - integer face_loc0,face_loc1,face_loc2 - double precision dirsign0,dirsign1,dirsign2 -c -c*********************************************************************** -c*********************************************************************** -c bdry_loc index bdry_loc index -c 0 (-1,-1,-1) 4 (-1,-1, 1) -c 1 ( 1,-1,-1) 5 ( 1,-1, 1) -c 2 (-1, 1,-1) 6 (-1, 1, 1) -c 3 ( 1, 1,-1) 7 ( 1, 1, 1) -c*********************************************************************** -c*********************************************************************** - if (bdry_loc.eq.X0Y0Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y0Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y1Z0) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X1Y1Z0) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZLEFT - ipivot2 = ifirst2 - dirsign2 = -1.d0 - else if (bdry_loc.eq.X0Y0Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y0Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YLEFT - ipivot1 = ifirst1 - dirsign1 = -1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X0Y1Z1) then - face_loc0 = XLEFT - ipivot0 = ifirst0 - dirsign0 = -1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - else if (bdry_loc.eq.X1Y1Z1) then - face_loc0 = XRIGHT - ipivot0 = ilast0 - dirsign0 = 1.d0 - face_loc1 = YRIGHT - ipivot1 = ilast1 - dirsign1 = 1.d0 - face_loc2 = ZRIGHT - ipivot2 = ilast2 - dirsign2 = 1.d0 - endif - if (bdry_cond.eq.XDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZDIRICHLET) then - do ic2=ibeg2,iend2 - do ic1=ibeg1,iend1 - do ic0=ibeg0,iend0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 - & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 - & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZNEUMANN) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 - & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.YFLOW) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.ZFLOW) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - enddo - enddo - enddo - else if (bdry_cond.eq.XREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ipivot0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) - enddo - enddo - enddo - else if (bdry_cond.eq.YREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ic2 - do ic1=ibeg1,iend1 - ict1 = ipivot1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) - enddo - enddo - enddo - else if (bdry_cond.eq.ZREFLECT) then - do ic2=ibeg2,iend2 - ict2 = ipivot2 - do ic1=ibeg1,iend1 - ict1 = ic1 - do ic0=ibeg0,iend0 - ict0 = ic0 - do k=0,arrdepth-1 - arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) - enddo - arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) - enddo - enddo - enddo - else - write(6,*) "INVALID NODE bdry_cond in getskelnodebdry3d" - write(6,*) "bdry_loc = ",bdry_loc, - & "bdry_cond = ",bdry_cond - endif -c - return - end - -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdryloc3d( - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in) - implicit none - integer - & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, - & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, - & X0Z0in, X0Z1in, X1Z0in, X1Z1in, - & X0Y0in, X1Y0in, X0Y1in, X1Y1in, - & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, - & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - -c 3d faces - XLEFT=XLEFTin - XRIGHT=XRIGHTin - YLEFT=YLEFTin - YRIGHT=YRIGHTin - ZLEFT=ZLEFTin - ZRIGHT=ZRIGHTin - -c 3d edges - Y0Z0=Y0Z0in - Y1Z0=Y1Z0in - Y0Z1=Y0Z1in - Y1Z1=Y1Z1in - X0Z0=X0Z0in - X0Z1=X0Z1in - X1Z0=X1Z0in - X1Z1=X1Z1in - X0Y0=X0Y0in - X1Y0=X1Y0in - X0Y1=X0Y1in - X1Y1=X1Y1in - -c 3d nodes - X0Y0Z0=X0Y0Z0in - X1Y0Z0=X1Y0Z0in - X0Y1Z0=X0Y1Z0in - X1Y1Z0=X1Y1Z0in - X0Y0Z1=X0Y0Z1in - X1Y0Z1=X1Y0Z1in - X0Y1Z1=X0Y1Z1in - X1Y1Z1=X1Y1Z1in - - return - end -c*********************************************************************** -c*********************************************************************** - subroutine stufskelbdrycond3d( - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin) - implicit none - integer - & FLOWin, XFLOWin, YFLOWin, ZFLOWin, - & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, - & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, - & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin -c -c File: appu_skelbdryparams3d.i -c Package: SAMRAI application utilities -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: -c Modified: -c Description: m4 include file for 3d boundary constant common blocks -c - common/skelbdrylocparams3d/ - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 - integer - & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, - & Y0Z0,Y1Z0,Y0Z1,Y1Z1, - & X0Z0,X0Z1,X1Z0,X1Z1, - & X0Y0,X1Y0,X0Y1,X1Y1, - & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, - & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 -c -c - common/skelbdrycondparams3d/ - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - integer - & FLOW,XFLOW,YFLOW,ZFLOW, - & REFLECT,XREFLECT,YREFLECT,ZREFLECT, - & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, - & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN - - FLOW=FLOWin - XFLOW=XFLOWin - YFLOW=YFLOWin - ZFLOW=ZFLOWin - - REFLECT=REFLECTin - XREFLECT=XREFLECTin - YREFLECT=YREFLECTin - ZREFLECT=ZREFLECTin - - DIRICHLET=DIRICHLETin - XDIRICHLET=XDIRICHLETin - YDIRICHLET=YDIRICHLETin - ZDIRICHLET=ZDIRICHLETin - - NEUMANN=NEUMANNin - XNEUMANN=XNEUMANNin - YNEUMANN=YNEUMANNin - ZNEUMANN=ZNEUMANNin - - return - end diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable2d.m4 index a788a373..8021d11a 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable2d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for stable dt computation in 2d. +c define(NDIM,2)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine stabledt2d(dx, & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable3d.m4 index 0e11632b..61d47e92 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stable3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for stable dt computation in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine stabledt3d(dx, & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stufprobc.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stufprobc.m4 index 64885c81..aa31d5da 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stufprobc.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/stufprobc.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine. +c subroutine stufprobc( & PIECEWISE_CONSTANT_Xin,PIECEWISE_CONSTANT_Yin, & PIECEWISE_CONSTANT_Zin, diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace1d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace1d.m4 index 182d48bf..c65db5e0 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace1d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace1d.m4 @@ -1,3 +1,10 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 1d. +c define(NEQU,1)dnl define(REAL,`double precision')dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace2d.m4 index edfdce15..65b1a9bf 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace2d.m4 @@ -1,7 +1,14 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 2d. +c define(NDIM,2)dnl define(NEQU,4)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl include(FORTDIR/m4trace2d.i)dnl subroutine inittraceflux2d( diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace3d.m4 index 9ba8ae5a..fe6072a2 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/trace3d.m4 @@ -1,6 +1,13 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routine for trace in 3d. +c define(NDIM,3)dnl define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl include(FORTDIR/m4trace3d.i)dnl subroutine inittraceflux3d( diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum2d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum2d.m4 deleted file mode 100644 index 968defbf..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum2d.m4 +++ /dev/null @@ -1,89 +0,0 @@ -c -c File: algs_upfluxsum2d.m4 -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 2d flux sums from fluxes. -c -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -define(upfluxsumface_case_2d,`dnl - subroutine upfluxsumface2d$1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - REAL - & flux(FACE2d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERFACE2d$1(ilo,ihi,0)) - integer ie$1,ic$2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie$1 = ilo$1 - else - ie$1 = ihi$1+1 - endif - - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2)=fluxsum(ic$2)+flux(ie$1,ic$2) - enddo -c - return - end -')dnl -define(upfluxsumside_case_2d,`dnl - subroutine upfluxsumside2d$1( - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ihi0,ihi1, - & flxgc0,flxgc1, - & iface - REAL - & flux(SIDE2d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE2d$1(ilo,ihi,0)) - integer ic$1,ic$2 -c -c*********************************************************************** -c - if (iface.eq.0) then - ic$1 = ilo$1 - else - ic$1 = ihi$1+1 - endif - - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2)=fluxsum(ic$2)+flux(ic0,ic1) - enddo -c - return - end -')dnl -upfluxsumface_case_2d(0,1)dnl -c -upfluxsumface_case_2d(1,0)dnl -c -upfluxsumside_case_2d(0,1)dnl -c -upfluxsumside_case_2d(1,0)dnl -c diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum3d.m4 b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum3d.m4 deleted file mode 100644 index 74b0603f..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/fortran/upfluxsum3d.m4 +++ /dev/null @@ -1,98 +0,0 @@ -c -c File: algs_upfluxsum3d.m4 -c Package: SAMRAI algorithms -c Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -c Revision: $LastChangedRevision$ -c Description: F77 routines for updating 3d flux sums from fluxes. -c -define(SAMRAI_FORTDIR,../../patchdata/fortran)dnl -define(REAL,`double precision')dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl -c -c*********************************************************************** -c Add flux integrals to fluxsums -c*********************************************************************** -c -define(upfluxsumface_case_3d,`dnl - subroutine upfluxsumface3d$1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iface - REAL - & flux(FACE3d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERFACE3d$1(ilo,ihi,0)) - integer ie$1,ic$2,ic$3 -c -c*********************************************************************** -c - if (iface.eq.0) then - ie$1 = ilo$1 - else - ie$1 = ihi$1+1 - endif - - do ic$3=ilo$3,ihi$3 - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ie$1,ic$2,ic$3) - enddo - enddo -c - return - end -')dnl -c -c -define(upfluxsumside_case_3d,`dnl - subroutine upfluxsumside3d$1( - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside, - & flux,fluxsum) -c*********************************************************************** - implicit none -c - integer - & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, - & flxgc0,flxgc1,flxgc2, - & iside - REAL - & flux(SIDE3d$1VECG(ilo,ihi,flxgc)), - & fluxsum(OUTERSIDE3d$1(ilo,ihi,0)) - integer ic$1,ic$2,ic$3 -c -c*********************************************************************** -c - if (iside.eq.0) then - ic$1 = ilo$1 - else - ic$1 = ihi$1+1 - endif - - do ic$3=ilo$3,ihi$3 - do ic$2=ilo$2,ihi$2 - fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ic0,ic1,ic2) - enddo - enddo -c - return - end -')dnl -upfluxsumface_case_3d(0,1,2)dnl -c -upfluxsumface_case_3d(1,2,0)dnl -c -upfluxsumface_case_3d(2,0,1)dnl -c -upfluxsumside_case_3d(0,1,2)dnl -c -upfluxsumside_case_3d(1,0,2)dnl -c -upfluxsumside_case_3d(2,0,1)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/main.C b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/main.C index 54a6c1a1..d3deaa00 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/main.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/main.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Main program for SAMRAI Linear Advection example problem. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Multiblock performance tests. * ************************************************************************/ @@ -28,26 +28,21 @@ using namespace std; #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/RestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/geom/GridGeometry.h" // Headers for major algorithm/data structure objects -#include "SAMRAI/mesh/BergerRigoutsos.h" +#include "SAMRAI/mesh/TileClustering.h" #include "SAMRAI/mesh/GriddingAlgorithm.h" #include "SAMRAI/mesh/StandardTagAndInitialize.h" -#include "SAMRAI/mesh/TreeLoadBalancer.h" +#include "SAMRAI/mesh/ChopAndPackLoadBalancer.h" #include "SAMRAI/algs/TimeRefinementIntegrator.h" // Header for application-specific algorithm/data structure object -#include "MblkHyperbolicLevelIntegrator.h" +#include "test/testlib/MblkHyperbolicLevelIntegrator.h" #include "MblkLinAdv.h" -// Classes for run-time plotting and autotesting. - -#if (TESTING == 1) -#include "AutoTester.h" -#endif - using namespace SAMRAI; /************************************************************************ @@ -159,6 +154,9 @@ int main( int argc, char* argv[]) { + double wc_time = 0.0; + string base_name; + /* * Initialize tbox::MPI and SAMRAI, enable logging, and process command line. */ @@ -166,7 +164,7 @@ int main( tbox::SAMRAI_MPI::init(&argc, &argv); tbox::SAMRAIManager::initialize(); - for (int run = 0; run < 1; run++) { + for (int run = 0; run < 1; ++run) { tbox::SAMRAIManager::startup(); const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); @@ -207,6 +205,20 @@ int main( new tbox::InputDatabase("input_db")); tbox::InputManager::getManager()->parseInputFile(input_filename, input_db); + /* + * Setup the timer manager to trace timing statistics during execution + * of the code. The list of timers is given in the tbox::TimerManager + * section of the input file. Timing information is stored in the + * restart file. Timers will automatically be initialized to their + * previous state if the run is restarted, unless they are explicitly + * reset using the tbox::TimerManager::resetAllTimers() routine. + */ + + tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); + boost::shared_ptr t_all = + tbox::TimerManager::getManager()->getTimer("appu::main::all"); + t_all->start(); + /* * Retrieve "GlobalInputs" section of the input database and set * values accordingly. @@ -229,7 +241,7 @@ int main( /* * Retrieve "Main" section of the input database. First, read dump - * information, which is used for writing vizamrai plot files. Second, + * information, which is used for writing VisIt plot files. Second, * if proper restart information was given on command line, and the restart * interval is non-zero, create a restart database. */ @@ -239,6 +251,8 @@ int main( const tbox::Dimension dim(static_cast(main_db->getInteger("dim"))); + base_name = main_db->getString("base_name"); + string log_file_name = "linadv.log"; if (main_db->keyExists("log_file_name")) { log_file_name = main_db->getString("log_file_name"); @@ -302,17 +316,6 @@ int main( } } -#if (TESTING == 1) && !(HAVE_HDF5) - /* - * If we are autotesting on a system w/o HDF5, the read from - * restart will result in an error. We want this to happen - * for users, so they know there is a problem with the restart, - * but we don't want it to happen when autotesting. - */ - is_from_restart = false; - restart_interval = 0; -#endif - const bool write_restart = (restart_interval > 0) && !(restart_write_dirname.empty()); @@ -329,17 +332,6 @@ int main( mpi.getSize()); } - /* - * Setup the timer manager to trace timing statistics during execution - * of the code. The list of timers is given in the tbox::TimerManager - * section of the input file. Timing information is stored in the - * restart file. Timers will automatically be initialized to their - * previous state if the run is restarted, unless they are explicitly - * reset using the tbox::TimerManager::resetAllTimers() routine. - */ - - tbox::TimerManager::createManager(input_db->getDatabase("TimerManager")); - /* * Create major algorithm and data objects which comprise application. * Each object will be initialized either from input data or restart @@ -371,24 +363,25 @@ int main( input_db->getDatabase("HyperbolicLevelIntegrator"), linear_advection_model, mblk_patch_hierarchy, - true, use_refined_timestepping)); boost::shared_ptr error_detector( - new mesh::StandardTagAndInitialize(dim, + new mesh::StandardTagAndInitialize( "StandardTagAndInitialize", mblk_hyp_level_integrator.get(), input_db->getDatabase("StandardTagAndInitialize"))); - boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); + boost::shared_ptr box_generator( + new mesh::TileClustering(dim, + input_db->getDatabase("BergerRigoutsos"))); - boost::shared_ptr load_balancer( - new mesh::TreeLoadBalancer( + boost::shared_ptr load_balancer( + new mesh::ChopAndPackLoadBalancer( dim, - "TreeLoadBalancer", - input_db->getDatabase("TreeLoadBalancer"))); - load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); + "CascadePartitioner", + input_db->getDatabaseWithDefault("TreeLoadBalancer", + boost::shared_ptr()))); +// load_balancer->setSAMRAI_MPI(tbox::SAMRAI_MPI::getSAMRAIWorld()); boost::shared_ptr mblk_gridding_algorithm( new mesh::GriddingAlgorithm( @@ -411,7 +404,7 @@ int main( /* * Set up Visualization plot file writer(s). */ - // VisitDataWriter is only present if HDF is available + // VisItDataWriter is only present if HDF is available #ifdef HAVE_HDF5 bool is_multiblock = true; boost::shared_ptr visit_data_writer( @@ -434,15 +427,6 @@ int main( tbox::RestartManager::getManager()->closeRestartFile(); -#if (TESTING == 1) - /* - * Create the autotesting object which will verify correctness - * of the problem. If no automated testing is done, the object does - * not get used. - */ - AutoTester autotester("AutoTester", input_db); -#endif - /* * After creating all objects and initializing their state, we * print the input database and variable database contents @@ -478,17 +462,6 @@ int main( int iteration_num = time_integrator->getIntegratorStep(); -#if (TESTING == 1) - /* - * If we are doing autotests, check result... - */ - autotester.evalTestData(iteration_num, - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); -#endif - while ((loop_time < loop_time_end) && time_integrator->stepsRemaining()) { @@ -537,26 +510,14 @@ int main( #endif } } - -#if (TESTING == 1) - /* - * If we are doing autotests, check result... - */ - autotester.evalTestData(iteration_num, - patch_hierarchy, - time_integrator, - hyp_level_integrator, - gridding_algorithm); -#endif - } /* * Output timer results. */ -#if (TESTING != 1) tbox::TimerManager::getManager()->print(tbox::plog); -#endif + t_all->stop(); + wc_time += t_all->getTotalWallclockTime(); /* * At conclusion of simulation, deallocate objects. @@ -586,6 +547,15 @@ int main( tbox::SAMRAIManager::shutdown(); } + int size = tbox::SAMRAI_MPI::getSAMRAIWorld().getSize(); + if (tbox::SAMRAI_MPI::getSAMRAIWorld().getRank() == 0) { + string timing_file = + base_name + ".timing" + tbox::Utilities::intToString(size); + FILE* fp = fopen(timing_file.c_str(), "w"); + fprintf(fp, "%f\n", wc_time); + fclose(fp); + } + tbox::SAMRAIManager::finalize(); tbox::SAMRAI_MPI::finalize(); @@ -600,16 +570,14 @@ void setupHierarchy( boost::shared_ptr& geometry, boost::shared_ptr& mblk_hierarchy) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(main_input_db); -#endif boost::shared_ptr mult_db( main_input_db->getDatabase("PatchHierarchy")); char geom_name[32]; - sprintf(geom_name, "BlockGeometry"); + sprintf(geom_name, "GridGeometry"); if (main_input_db->keyExists(geom_name)) { geometry.reset( new geom::GridGeometry( @@ -622,7 +590,6 @@ void setupHierarchy( } mblk_hierarchy.reset( - new hier::PatchHierarchy("PatchHierarchy", - geometry, mult_db, true)); + new hier::PatchHierarchy("PatchHierarchy", geometry, mult_db)); } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.1blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.1blk.input new file mode 100644 index 00000000..92150e9f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.1blk.input @@ -0,0 +1,212 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests + * + ************************************************************************/ + +// Input file for multiblock performance test with linear advection problem. + + +Main { + // Dimension of problem. Vectors in this problem should have compatible length. + dim = 2 + + base_name = "test.2d.1blk" + + // log file name + log_file_name = "newtest.log" + + // Whether to write a log file for each process. + log_all_nodes = TRUE + + // visualization dump parameters + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" // See parameter in appu::VisItDataWriter. + visit_number_procs_per_file = 1 // See parameter in appu::VisItDataWriter. + + + // restart dump parameters + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" // See RestartManager::writeRestartFile(). + + // Optional time stepping scheme: SYNCHRONIZED means no time refinement. + timestepping = "SYNCHRONIZED" + +} + + +// Input for mapped grid. See MblkGeometry class. +MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. + problem_type = "CARTESIAN" + + // Definition of Cartesian geometry box. + CartesianGeometry { + domain_xlo_0 = 0.0, 0.0 + domain_xhi_0 = 30.0, 20.0 + } +} + + +// Input database for setting up the multiblock linear advection problem. +// See MblkLinAdv class. +MblkLinAdv { + + advection_velocity = 2.0e0 , 0.5e0 + + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + // Initial condition: SPHERE, PIECEWISE_CONSTANT_{X,Y,Z}, or SINE_CONSTANT_{X,Y,Z} + data_problem = "SPHERE" + + // Initial condition parameters for data_problem. + Initial_data { + radius = 0.75 + center = 11.00 , 8.5 + + uval_inside = 80.0 + uval_outside = 5.0 + + } + + // Controls for refinement. See similar inputs for applications/LinAdv/test_inputs/test.2d.input. + Refinement_data { + refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" + + UVAL_GRADIENT { + grad_tol = 10.0 + } + + UVAL_SHOCK { + shock_tol = 10.0 + shock_onset = 0.85 + } + } + + // Controls for refinement. See similar inputs for applications/LinAdv/test_inputs/test.2d.input. + Boundary_data { + boundary_edge_xlo { + boundary_condition = "FLOW" + } + boundary_edge_xhi { + boundary_condition = "FLOW" + } + boundary_edge_ylo { + boundary_condition = "FLOW" + } + boundary_edge_yhi { + boundary_condition = "FLOW" + } + boundary_edge_zlo { + boundary_condition = "FLOW" + } + boundary_edge_zhi { + boundary_condition = "FLOW" + } + + + boundary_node_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_node_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_node_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + boundary_node_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed + boundary_condition = "YFLOW" + } + + + } + +} + + +// Refer to input documentation for tbox::TimerManager class. +TimerManager { + timer_list = "apps::*::*", + "algs::*::*", + "mesh::*::*", + "appu::main::all" +// print_exclusive = TRUE + print_summed = TRUE + print_max = TRUE +// print_timer_overhead = TRUE + print_threshold = 0.0 +} + + +// Refer to input documentation for mesh::BergerRigoutsos class. +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} + + +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { + num_blocks = 1 + + domain_boxes_0 = [ (0,0) , (59,39) ] +} + + +// Refer to input documentation for hier:PatchHierarchy class. +PatchHierarchy { + max_levels = 4 // Maximum number of levels in hierarchy. + ratio_to_coarser { // vector ratio to next coarser level + level_1 = 4 , 4 + level_2 = 4 , 4 + level_3 = 4 , 4 + } + largest_patch_size { + level_0 = 200 , 200 + // all finer levels will use same values as level_0... + } + smallest_patch_size { + level_0 = 10 , 10 + // all finer levels will use same values as level_0... + } +} + + +// Refer to input documentation for mesh::GriddingAlgorithm class. +GriddingAlgorithm{ + sequentialize_patch_indices = TRUE +} + + +// Refer to input documentation for mesh::StandardTagAndInitialize class. +StandardTagAndInitialize { + tagging_method = "GRADIENT_DETECTOR" +} + + +// Refer to input documentation for algs::HyperbolicLevelIntegrator class. +HyperbolicLevelIntegrator{ + cfl = 0.9e0 // max cfl factor used in problem + cfl_init = 0.9e0 // initial cfl factor + lag_dt_computation = TRUE + use_ghosts_to_compute_dt = TRUE +} + + +// Refer to input documentation for algs::timeRefinementIntegrator class. +TimeRefinementIntegrator{ + start_time = 0.e0 // initial simulation time + end_time = 100.e0 // final simulation time + grow_dt = 1.1e0 // growth factor for timesteps + max_integrator_steps = 1000 // max number of simulation timesteps + regrid_interval = 10 +} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-h.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-h.input similarity index 79% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-h.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-h.input index 9fa6a24e..55d8b7ce 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-h.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-h.input @@ -1,16 +1,45 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "test.2d.2blk-h" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" + +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0 domain_xhi_0 = 30.0, 10.0 @@ -23,27 +52,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + data_problem = "SPHERE" + + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 11.00 , 8.5 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -90,32 +124,12 @@ MblkLinAdv { } -Main { - dim = 2 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" - -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -124,7 +138,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 2 domain_boxes_0 = [ (0,0) , (59,19) ] domain_boxes_1 = [ (0,0) , (59,19) ] @@ -139,10 +154,11 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 + level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 } @@ -157,22 +173,23 @@ PatchHierarchy { } - - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -180,6 +197,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -187,6 +205,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 1000 // max number of simulation timesteps regrid_interval = 10 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-v.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-v.input similarity index 78% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-v.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-v.input index 1539be18..04049b31 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.2blk-v.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.2blk-v.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "test.2d.2blk-v" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0 domain_xhi_0 = 15.0, 20.0 @@ -23,27 +50,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 11.00 , 8.5 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -90,31 +122,12 @@ MblkLinAdv { } -Main { - dim = 2 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -123,7 +136,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 2 domain_boxes_0 = [ (0,0) , (29,39) ] domain_boxes_1 = [ (0,0) , (29,39) ] @@ -138,10 +152,11 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 + level_1 = 4 , 4 level_2 = 4 , 4 level_3 = 4 , 4 } @@ -156,21 +171,23 @@ PatchHierarchy { } - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -178,6 +195,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -185,6 +203,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 1000 // max number of simulation timesteps regrid_interval = 10 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.4blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.4blk.input similarity index 80% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.4blk.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.4blk.input index e6b66f3d..a39643b5 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.4blk.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.2d.4blk.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 2 + + base_name = "test.2d.4blk" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0 domain_xhi_0 = 15.0, 10.0 @@ -24,30 +51,37 @@ MblkGeometry { } +// Input for linear advection problem. See MblkLinAdv class. MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + // Initial condition: SPHERE, PIECEWISE_CONSTANT_{X,Y,Z}, or SINE_CONSTANT_{X,Y,Z} + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 11.00 , 8.5 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -94,31 +128,12 @@ MblkLinAdv { } -Main { - dim = 2 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -127,7 +142,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 4 domain_boxes_0 = [ (0,0) , (29,19) ] domain_boxes_1 = [ (0,0) , (29,19) ] @@ -189,6 +205,7 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 4 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level @@ -207,21 +224,23 @@ PatchHierarchy { } - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -229,6 +248,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -236,6 +256,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 1000 // max number of simulation timesteps regrid_interval = 10 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.1blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.1blk.input similarity index 83% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.1blk.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.1blk.input index 0739f94f..a4f9ae2a 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.1blk.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.1blk.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "test.3d.1blk" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0, 0.0 domain_xhi_0 = 30.0, 20.0, 20.0 @@ -21,27 +48,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0, 1.0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 10.00 , 7.5, 4.0 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -137,31 +169,12 @@ MblkLinAdv { } -Main { - dim = 3 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -170,15 +183,17 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 1 domain_boxes_0 = [ (0,0,0) , (29,19,19) ] } + PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4, 4 + level_1 = 4 , 4, 4 level_2 = 4 , 4, 4 level_3 = 4 , 4, 4 } @@ -193,22 +208,23 @@ PatchHierarchy { } - - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -216,6 +232,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -223,6 +240,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 200 // max number of simulation timesteps regrid_interval = 2 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.2blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.2blk.input similarity index 84% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.2blk.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.2blk.input index 2c0f33de..cecf0293 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.2blk.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.2blk.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "test.3d.2blk" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0, 0.0 domain_xhi_0 = 15.0, 20.0, 20.0 @@ -23,27 +50,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0, 1.0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 10.00 , 7.5, 4.0 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -139,31 +171,12 @@ MblkLinAdv { } -Main { - dim = 3 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -172,7 +185,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 2 domain_boxes_0 = [ (0,0,0) , (14,19,19) ] domain_boxes_1 = [ (0,0,0) , (14,19,19) ] @@ -187,10 +201,11 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4, 4 + level_1 = 4 , 4, 4 level_2 = 4 , 4, 4 level_3 = 4 , 4, 4 } @@ -205,22 +220,23 @@ PatchHierarchy { } - - +BergerRigoutsos{ + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -228,6 +244,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -235,6 +252,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 200 // max number of simulation timesteps regrid_interval = 2 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.4blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.4blk.input similarity index 86% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.4blk.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.4blk.input index 2d767ef1..31cf4f97 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.4blk.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.4blk.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "test.3d.4blk" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0, 0.0 domain_xhi_0 = 15.0, 10.0, 20.0 @@ -27,27 +54,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0, 1.0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 10.00 , 7.5, 4.0 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -143,31 +175,12 @@ MblkLinAdv { } -Main { - dim = 3 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -176,7 +189,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 4 domain_boxes_0 = [ (0,0,0) , (14,9,19) ] domain_boxes_1 = [ (0,0,0) , (14,9,19) ] @@ -238,10 +252,11 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4, 4 + level_1 = 4 , 4, 4 level_2 = 4 , 4, 4 level_3 = 4 , 4, 4 } @@ -256,22 +271,23 @@ PatchHierarchy { } - - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -279,6 +295,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -286,6 +303,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 200 // max number of simulation timesteps regrid_interval = 2 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.8blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.8blk.input similarity index 91% rename from base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.8blk.input rename to base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.8blk.input index 135dc527..9948b685 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.3d.8blk.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/performance_inputs/test.3d.8blk.input @@ -1,16 +1,43 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Input file for multiblock performance tests * ************************************************************************/ +// Input file for multiblock performance test with linear advection problem. + +// Refer to test.2d.1blk.input for full description of all input parameters +// specific to this problem. + +Main { + dim = 3 + + base_name = "test.3d.8blk" + + log_file_name = "newtest.log" + log_all_nodes = TRUE + + viz_dump_interval = 0 // zero to turn off + viz_dump_dirname = "viz_newtest" + visit_number_procs_per_file = 1 + + restart_interval = 0 // zero to turn off + restart_write_dirname = "restart_newtest" + + timestepping = "SYNCHRONIZED" +} + + +// Input for mapped grid. See MblkGeometry class. MblkGeometry { + // Geometry: CARTESIAN, WEDGE or SPHERICAL_SHELL. problem_type = "CARTESIAN" + // Definition of Cartesian geometry box. CartesianGeometry { domain_xlo_0 = 0.0, 0.0, 0.0 domain_xhi_0 = 15.0, 10.0, 10.0 @@ -35,27 +62,32 @@ MblkGeometry { MblkLinAdv { advection_velocity = 2.0e0 , 0.5e0, 1.0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - data_problem = "SPHERE" + // order of Goduov slopes (1, 2, or 4) + godunov_order = 2 + + // Corner transport scheme: CORNER_TRANSPORT_1 or CORNER_TRANSPORT_2 + corner_transport = "CORNER_TRANSPORT_1" + + data_problem = "SPHERE" + // Initial condition parameters for data_problem. Initial_data { - radius = 0.75 + radius = 0.75 center = 10.00 , 7.5, 4.0 uval_inside = 80.0 uval_outside = 5.0 - + } Refinement_data { refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - + UVAL_GRADIENT { grad_tol = 10.0 } - + UVAL_SHOCK { shock_tol = 10.0 shock_onset = 0.85 @@ -151,31 +183,12 @@ MblkLinAdv { } -Main { - dim = 3 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" -} TimerManager { timer_list = "apps::*::*", "algs::*::*", - "mesh::*::*" + "mesh::*::*", + "appu::main::all" // print_exclusive = TRUE print_summed = TRUE print_max = TRUE @@ -184,7 +197,8 @@ TimerManager { } -BlockGeometry { +// Refer to input documentation for hier:GridGeometry class. +GridGeometry { num_blocks = 8 domain_boxes_0 = [ (0,0,0) , (14,9,9) ] domain_boxes_1 = [ (0,0,0) , (14,9,9) ] @@ -448,10 +462,11 @@ BlockGeometry { } } + PatchHierarchy { max_levels = 3 // Maximum number of levels in hierarchy. ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4, 4 + level_1 = 4 , 4, 4 level_2 = 4 , 4, 4 level_3 = 4 , 4, 4 } @@ -466,22 +481,23 @@ PatchHierarchy { } - - +BergerRigoutsos { + efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level + combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller + // boxes < efficiency * vol of large box +} GriddingAlgorithm{ sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box } + StandardTagAndInitialize { tagging_method = "GRADIENT_DETECTOR" } + HyperbolicLevelIntegrator{ cfl = 0.9e0 // max cfl factor used in problem cfl_init = 0.9e0 // initial cfl factor @@ -489,6 +505,7 @@ HyperbolicLevelIntegrator{ use_ghosts_to_compute_dt = TRUE } + TimeRefinementIntegrator{ start_time = 0.e0 // initial simulation time end_time = 100.e0 // final simulation time @@ -496,6 +513,3 @@ TimeRefinementIntegrator{ max_integrator_steps = 200 // max number of simulation timesteps regrid_interval = 2 } - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.1blk.input b/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.1blk.input deleted file mode 100644 index 337b36ea..00000000 --- a/base/SAMRAI/SAMRAI/source/test/performance/multiblock/test_inputs/test.2d.1blk.input +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -MblkGeometry { - problem_type = "CARTESIAN" - - CartesianGeometry { - domain_xlo_0 = 0.0, 0.0 - domain_xhi_0 = 30.0, 20.0 - } -} - - -MblkLinAdv { - - advection_velocity = 2.0e0 , 0.5e0 - godunov_order = 2 // order of Goduov slopes (1, 2, or 4) - corner_transport = "CORNER_TRANSPORT_1" - - data_problem = "SPHERE" - - Initial_data { - radius = 0.75 - center = 11.00 , 8.5 - - uval_inside = 80.0 - uval_outside = 5.0 - - } - - Refinement_data { - refine_criteria = "UVAL_GRADIENT", "UVAL_SHOCK" - - UVAL_GRADIENT { - grad_tol = 10.0 - } - - UVAL_SHOCK { - shock_tol = 10.0 - shock_onset = 0.85 - } - } - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - Boundary_data { - boundary_edge_xlo { - boundary_condition = "FLOW" - } - boundary_edge_xhi { - boundary_condition = "FLOW" - } - boundary_edge_ylo { - boundary_condition = "FLOW" - } - boundary_edge_yhi { - boundary_condition = "FLOW" - } - boundary_edge_zlo { - boundary_condition = "FLOW" - } - boundary_edge_zhi { - boundary_condition = "FLOW" - } - - - boundary_node_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_node_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_node_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - boundary_node_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YFLOW" - } - - - } - -} - -Main { - dim = 2 -// log file parameters - log_file_name = "newtest.log" - log_all_nodes = TRUE - -// visualization dump parameters - viz_writer = "VisIt" // use: "Vizamrai", "VisIt" for both - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz_newtest" - viz_dump_filename = "newtest" // not used by VisIt - visit_number_procs_per_file = 1 // not used by Vizamrai - - -// restart dump parameters - restart_interval = 0 // zero to turn off - restart_write_dirname = "restart_newtest" - - timestepping = "SYNCHRONIZED" - -} - -TimerManager { - timer_list = "apps::*::*", - "algs::*::*", - "mesh::*::*" -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE -// print_timer_overhead = TRUE - print_threshold = 0.0 -} - - -BlockGeometry { - num_blocks = 1 - - domain_boxes_0 = [ (0,0) , (59,39) ] -} - -PatchHierarchy { - max_levels = 4 // Maximum number of levels in hierarchy. - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 4 , 4 - level_2 = 4 , 4 - level_3 = 4 , 4 - } - largest_patch_size { - level_0 = 200 , 200 - // all finer levels will use same values as level_0... - } - smallest_patch_size { - level_0 = 10 , 10 - // all finer levels will use same values as level_0... - } -} - - - - - - -GriddingAlgorithm{ - sequentialize_patch_indices = TRUE - - efficiency_tolerance = 0.85e0 // min % of tag cells in new patch level - combine_efficiency = 0.95e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -StandardTagAndInitialize { - tagging_method = "GRADIENT_DETECTOR" -} - -HyperbolicLevelIntegrator{ - cfl = 0.9e0 // max cfl factor used in problem - cfl_init = 0.9e0 // initial cfl factor - lag_dt_computation = TRUE - use_ghosts_to_compute_dt = TRUE -} - -TimeRefinementIntegrator{ - start_time = 0.e0 // initial simulation time - end_time = 100.e0 // final simulation time - grow_dt = 1.1e0 // growth factor for timesteps - max_integrator_steps = 1000 // max number of simulation timesteps - regrid_interval = 10 -} - -TreeLoadBalancer { -} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.depend index e9dfa0c4..9d7fdecc 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -25,8 +25,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -40,7 +40,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -49,11 +48,9 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.in b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.in index 53e10de3..751002ce 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/Makefile.in @@ -3,18 +3,17 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Test program for performance of tree search algorithm. ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/performance/treesearch -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../../.. - -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +REPORT = $(OBJECT)/report.xml default: check @@ -23,10 +22,11 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o -main: $(CXX_OBJS) $(LIBSAMRAI) +main: $(CXX_OBJS) $(LIBSAMRAI) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ $(LIBSAMRAI) $(LDLIBS) -o $@ @@ -36,29 +36,49 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f main +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/README b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/README new file mode 100644 index 00000000..035d52ea --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/README @@ -0,0 +1,21 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Performance tests for tree searches. +## +######################################################################### + +Code and input for evaluating performance of tree searches. + +Generate a set of boxes, perform intersection searches and write out +timing data. + +This test does the same thing on all processes. There is no need to +run it in parallel. + +Execution: + ./main test_inputs/default.2d.input + ./main test_inputs/default.3d.input diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/main.C b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/main.C index 9aa3633e..b9367864 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/main.C +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/main.C @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Test program for performance of tree search algorithm. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Performance tests for tree searches. * ************************************************************************/ #include "SAMRAI/SAMRAI_config.h" @@ -40,7 +40,6 @@ using namespace tbox; ************************************************************************* */ -typedef std::vector NodeVec; typedef std::vector BoxVec; /* @@ -65,7 +64,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); int fail_count = 0; { @@ -131,9 +129,6 @@ int main( plog << "Input database after initialization..." << std::endl; input_db->printClassData(plog); - const std::string box_gen_method = - main_db->getStringWithDefault("box_gen_method", "UNIFORM"); - tbox::TimerManager * tm(tbox::TimerManager::getManager()); const std::string dim_str(tbox::Utilities::intToString(dim.getValue())); boost::shared_ptr t_build_tree( @@ -147,13 +142,9 @@ int main( * Generate the boxes. */ BoxVec boxes; - if (box_gen_method == "UNIFORM") { - generateBoxesUniform(dim, - boxes, - main_db->getDatabase("UniformBoxGen")); - } else { - TBOX_ERROR("Unsupported box_gen_method: " << box_gen_method); - } + generateBoxesUniform(dim, + boxes, + main_db->getDatabase("UniformBoxGen")); tbox::plog << "\n\n\nGenerated boxes (" << boxes.size() << "):\n"; for (size_t i = 0; i < boxes.size(); ++i) { tbox::plog << '\t' << i << '\t' << boxes[i] << '\n'; @@ -192,7 +183,8 @@ int main( /* * Scale up the box array. */ - int shift_dir = (iscale - 1) % dim.getValue(); + tbox::Dimension::dir_t shift_dir = + static_cast((iscale - 1) % dim.getValue()); /* * Shift distance is less than number of bounding boxes in shift_dir * in order to generate some non-trivial overlaps. @@ -204,9 +196,12 @@ int main( for (size_t i = 0; i < old_size; ++i) { boxes[i].shift(shift_dir, shift_distance); } - bounding_box.upper() (shift_dir) += shift_distance; + bounding_box.setUpper(shift_dir, shift_distance); } + if (mpi.getRank() == 0) { + tbox::pout << "Repetition " << iscale << std::endl; + } tbox::plog << "Repetition " << iscale << " has " << boxes.size() << " boxes bounded by " << bounding_box << std::endl; @@ -247,7 +242,7 @@ int main( * Build search tree. */ t_build_tree->start(); - nodes.makeTree(NULL); + nodes.makeTree(0); t_build_tree->stop(); /* @@ -268,7 +263,7 @@ int main( t_search_tree_for_set->stop(); hier::BoxContainer ordered_overlap; - ordered_overlap.order(); + ordered_overlap.order(); t_search_tree_for_vec->start(); for (BoxVec::iterator bi = grown_boxes.begin(); bi != grown_boxes.end(); @@ -281,6 +276,9 @@ int main( /* * Output normalized timer to plog. */ + tbox::plog << "Timers for repetition " << iscale + << " (normalized by " << node_count << " nodes):\n"; + tbox::plog.precision(8); tbox::plog << t_build_tree->getName() << " = " << t_build_tree->getTotalWallclockTime() / static_cast(node_count) @@ -329,17 +327,8 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); + SAMRAI_MPI::finalize(); - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - tbox::pout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } - - tbox::plog << "Process " << std::setw(5) << rank << " exiting." << std::endl; return fail_count; } @@ -357,7 +346,7 @@ void generateBoxesUniform( if (db->isInteger("boxsize")) { db->getIntegerArray("boxsize", &boxsize[0], dim.getValue()); } else { - TBOX_ERROR("CartesianGridGeometry::getFromInput() error...\n" + TBOX_ERROR("generateBoxesUniform() error...\n" << " box size is absent."); } diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.2d.input b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.2d.input index a3d11113..c3c07b2b 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.2d.input @@ -1,19 +1,22 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for tree search test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Performance input file for tree search test. * ************************************************************************/ - Main { + // Dimension of problem. No default. dim = 2 + // Base name for output files. base_name = "default2d" + + // Whether to log all nodes. log_all_nodes = FALSE /* @@ -22,34 +25,27 @@ Main { */ num_scale = 7 - /* - Amount to grow each box before searching for overlaps. - */ + // Amount to grow each box before searching for overlaps. growth = 2, 2 - /* - Whether to randomize the box ordering. - */ + // Whether to randomize the box ordering. randomize_order = TRUE - /* - Box generator parameters. - */ + // Box generator parameters. UniformBoxGen { - /* - Size of each box - */ + // Size of each box boxsize = 10, 10 /* Repetition of the box in each index direction. - Will generate an NDIM-dimensional array of boxes. + Will generate a dim-dimensional array of boxes. */ boxrepeat = 33, 17 } } +// Refer to tbox::TimerManager for input. TimerManager { // print_exclusive = TRUE print_summed = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.3d.input b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.3d.input index 460f044f..25e32365 100644 --- a/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/performance/treesearch/test_inputs/default.3d.input @@ -1,18 +1,22 @@ /************************************************************************* * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for tree search test. + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Performance input file for tree search test. * ************************************************************************/ - Main { + // Dimension of problem. No default. dim = 3 + + // Base name for output files. base_name = "default3d" + + // Whether to log all nodes. log_all_nodes = FALSE /* @@ -21,34 +25,27 @@ Main { */ num_scale = 7 - /* - Amount to grow each box before searching for overlaps. - */ + // Amount to grow each box before searching for overlaps. growth = 2, 2, 2 - /* - Whether to randomize the box ordering. - */ + // Whether to randomize the box ordering. randomize_order = TRUE - /* - Box generator parameters. - */ + // Box generator parameters. UniformBoxGen { - /* - Size of each box - */ + // Size of each box boxsize = 10, 10, 10 /* Repetition of the box in each index direction. - Will generate an NDIM-dimensional array of boxes. + Will generate a dim-dimensional array of boxes. */ boxrepeat = 15, 9, 7 } } +// Refer to tbox::TimerManager for input. TimerManager { // print_exclusive = TRUE print_summed = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.depend deleted file mode 100644 index cd6af5a8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.depend +++ /dev/null @@ -1,37 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile dependencies -## -######################################################################### - -## This file is automatically generated by depend.pl. - - -FILE_0=main-pointer.o -DEPENDS_0:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-pointer.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif - -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} - diff --git a/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.in b/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.in deleted file mode 100644 index c00041e8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/pointer/Makefile.in +++ /dev/null @@ -1,53 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: makefile for the pointer tests -## -######################################################################### - -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ -SUBDIR = source/test/pointer -VPATH = @srcdir@ -TESTTOOLS = ../testtools -OBJECT = ../../.. - -CPPFLAGS_EXTRA = -DTESTING=1 - -default: check - -include $(OBJECT)/config/Makefile.config - -NUM_TESTS = 1 - -TEST_NPROCS = @TEST_NPROCS@ - -main: main-pointer.o $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) main-pointer.o $(LIBSAMRAI) $(LDLIBS) -o $@ - - -check: main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main - -check2d: - $(MAKE) check - -check3d: - $(MAKE) check - -checkcompile: main - -checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - $(RM) main - -include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/pointer/README b/base/SAMRAI/SAMRAI/source/test/pointer/README deleted file mode 100644 index 463cda73..00000000 --- a/base/SAMRAI/SAMRAI/source/test/pointer/README +++ /dev/null @@ -1,26 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: README file for pointer tests. -## -######################################################################### - -This program tests the smart pointer casting operations, including -virtual base class notions. - -Compilation: - make - or - make testpointer - -Execution: - ./testpointer - -Output: - pointertest.log - --OR- make check - diff --git a/base/SAMRAI/SAMRAI/source/test/pointer/main-pointer.C b/base/SAMRAI/SAMRAI/source/test/pointer/main-pointer.C deleted file mode 100644 index 1630b6ca..00000000 --- a/base/SAMRAI/SAMRAI/source/test/pointer/main-pointer.C +++ /dev/null @@ -1,495 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Main program for testing SAMRAI smart pointers - * - ************************************************************************/ - -#include "SAMRAI/SAMRAI_config.h" - -#include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/SAMRAI_MPI.h" -#include "SAMRAI/tbox/PIO.h" - -#include - -using namespace std; -using namespace SAMRAI; - -class A -{ -public: - A() { - } - virtual ~A() { - } - virtual void - foo( - std::string& trace) = 0; - virtual void - foo1( - std::string& trace) = 0; -}; - -class B -{ -public: - B() { - } - virtual ~B() { - } - virtual void - foo( - std::string& trace) = 0; - virtual void foo1( - std::string& trace) { - trace = "B::foo1()"; - } -}; - -class C:public A, - public B -{ -public: - C() { - } - virtual ~C() { - } - void foo( - std::string& trace) { - trace = "C::foo()"; - } - void foo1( - std::string& trace) { - trace = "C::foo1()"; - } -}; - -class HaveA -{ -public: - HaveA( - int& fail_count, - A* a_ptr, - const A* a_constptr, - boost::shared_ptr a_smartptr, - const boost::shared_ptr a_constsmartptr) - { - if (a_ptr != a_constptr) { - fail_count++; - tbox::perr << "FAILED: - Test #4a: a_ptr != a_constptr" << endl; - } - if (a_ptr != a_smartptr.get()) { - fail_count++; - tbox::perr << "FAILED: - Test #4b: a_ptr != (A*)a_smartptr" << endl; - } - if (a_ptr != a_constsmartptr.get()) { - fail_count++; - tbox::perr << "FAILED: - Test #4c: a_ptr != (A*)a_constsmartptr" - << endl; - } - d_a_ptr = a_ptr; - d_a_smartptr = a_smartptr; - } - virtual ~HaveA() { - } - int callFoo() - { - int fail_count = 0; - std::string trace1 = "test-d_a_ptr"; - d_a_ptr->foo(trace1); - if (trace1 != "C::foo()") { - fail_count++; - tbox::perr << "FAILED: - Test #6a: calling d_a_ptr->foo()" << endl; - tbox::perr << " Expected C::foo(), Received " << trace1 << endl; - } - std::string trace2 = "test-d_a_smartptr"; - d_a_smartptr->foo(trace2); - if (trace2 != "C::foo()") { - fail_count++; - tbox::perr << "FAILED: - Test #6b: calling d_a_smartptr->foo()" - << endl; - tbox::perr << " Expected C::foo(), Received " << trace2 << endl; - } - return fail_count; - } - int callFoo1() - { - int fail_count = 0; - string trace = "test-d_a_smartptr"; - d_a_smartptr->foo1(trace); - if (trace != "C::foo1()") { - fail_count++; - tbox::perr << "FAILED: - Test #8a: calling d_a_smartptr->foo1()" - << endl; - tbox::perr << " Expected C::foo1(), Received " << trace << endl; - } - return fail_count; - } -private: - A* d_a_ptr; - boost::shared_ptr d_a_smartptr; -}; - -class HaveB -{ -public: - HaveB( - int& fail_count, - B* b_ptr, - const B* b_constptr, - boost::shared_ptr b_smartptr, - const boost::shared_ptr b_constsmartptr) - { - if (b_ptr != b_constptr) { - fail_count++; - tbox::perr << "FAILED: - Test #5b: b_ptr != b_constptr" << endl; - } - if (b_ptr != b_smartptr.get()) { - fail_count++; - tbox::perr << "FAILED: - Test #5b: b_ptr != (A*)b_smartptr" << endl; - } - if (b_ptr != b_constsmartptr.get()) { - fail_count++; - tbox::perr << "FAILED: - Test #5c: b_ptr != (A*)b_constsmartptr" - << endl; - } - d_b_ptr = b_ptr; - d_b_smartptr = b_smartptr; - } - virtual ~HaveB() { - } - int callFoo() - { - int fail_count = 0; - string trace1 = "test-d_b_ptr"; - d_b_ptr->foo(trace1); - if (trace1 != "C::foo()") { - fail_count++; - tbox::perr << "FAILED: - Test #7a: calling d_b_ptr->foo()" << endl; - tbox::perr << " Expected C::foo(), Received " << trace1 << endl; - } - std::string trace2 = "test-d_b_smartptr"; - d_b_smartptr->foo(trace2); - if (trace2 != "C::foo()") { - fail_count++; - tbox::perr << "FAILED: - Test #7b: calling d_b_smartptr->foo()" - << endl; - tbox::perr << " Expected C::foo(), Received " << trace2 << endl; - } - return fail_count; - } - int callFoo1() - { - int fail_count = 0; - string trace = "test-d_b_smartptr"; - d_b_smartptr->foo1(trace); - if (trace != "C::foo1()") { - fail_count++; - tbox::perr << "FAILED: - Test #9a: calling d_b_smartptr->foo1()" - << endl; - tbox::perr << " Expected C::foo1(), Received " << trace << endl; - } - return fail_count; - } -private: - B* d_b_ptr; - boost::shared_ptr d_b_smartptr; -}; - -class Derived -{ -public: - Derived() { - } - virtual ~Derived() { - } -}; - -class ReallyDerived:public Derived -{ -public: - ReallyDerived() { - } - virtual ~ReallyDerived() { - } -}; - -class ReallyReallyDerived:public ReallyDerived -{ -public: - ReallyReallyDerived() { - } - virtual ~ReallyReallyDerived() { - } -}; - -template class boost::shared_ptr; -template class boost::shared_ptr; -template class boost::shared_ptr; -template class boost::shared_ptr; -template class boost::shared_ptr; -template class boost::shared_ptr; - -/* - * Function to test casting in function call. - */ - -int test( - boost::shared_ptr a, - boost::shared_ptr b, - boost::shared_ptr c) -{ - int fail_count = 0; - if (a) { - fail_count++; - tbox::perr << "FAILED: - Test #2a: in test(), a is non-null" << endl; - } - if (!b) { - fail_count++; - tbox::perr << "FAILED: - Test #2b: in test(), b is null" << endl; - } - if (!c) { - fail_count++; - tbox::perr << "FAILED: - Test #2c: in test(), c is null" << endl; - } - - boost::shared_ptr d( - b, - boost::detail::dynamic_cast_tag()); - if (d) { - fail_count++; - tbox::perr << "FAILED: - Test #2d: in test(), d is non-null" << endl; - } - boost::shared_ptr e( - c, - boost::detail::dynamic_cast_tag()); - if (!e) { - fail_count++; - tbox::perr << "FAILED: - Test #2e: in test(), e is null" << endl; - } - return fail_count; -} - -int main( - int argc, - char* argv[]) -{ - int fail_count = 0; - - tbox::SAMRAI_MPI::init(&argc, &argv); - tbox::SAMRAIManager::initialize(); - tbox::SAMRAIManager::startup(); - - /* - * Create block to force pointer deallocation. If this is not done - * then there will be memory leaks reported. - */ - { - - /* - * Regular pointer tests. - */ - - boost::shared_ptr derived(new Derived()); - boost::shared_ptr really_derived(new ReallyDerived()); - boost::shared_ptr really_really_derived( - new ReallyReallyDerived()); - - /* - * Test casting to base class Derived. - */ - boost::shared_ptr a(derived); - if (!a) { - fail_count++; - tbox::perr << "FAILED: - Test #1a: a is null" << endl; - } - boost::shared_ptr b(really_derived); - if (!b) { - fail_count++; - tbox::perr << "FAILED: - Test #1b: b is null" << endl; - } - boost::shared_ptr c(really_really_derived); - if (!c) { - fail_count++; - tbox::perr << "FAILED: - Test #1c: c is null" << endl; - } - - /* - * Test casting to intermediate class ReallyDerived. - */ - boost::shared_ptr d( - derived, - boost::detail::dynamic_cast_tag()); - if (d) { - fail_count++; - tbox::perr << "FAILED: - Test #1d: d is non-null" << endl; - } - boost::shared_ptr e(really_derived); - if (!e) { - fail_count++; - tbox::perr << "FAILED: - Test #1e: e is null" << endl; - } - boost::shared_ptr f(really_really_derived); - if (!f) { - fail_count++; - tbox::perr << "FAILED: - Test #1f: f is null" << endl; - } - - /* - * Test casting to most derived class ReallyReallyDerived. - */ - boost::shared_ptr g( - derived, - boost::detail::dynamic_cast_tag()); - if (g) { - fail_count++; - tbox::perr << "FAILED: - Test #1g: g is non-null" << endl; - } - boost::shared_ptr h( - really_derived, - boost::detail::dynamic_cast_tag()); - if (h) { - fail_count++; - tbox::perr << "FAILED: - Test #1h: h is non-null" << endl; - } - boost::shared_ptr i(really_really_derived); - if (!i) { - fail_count++; - tbox::perr << "FAILED: - Test #1i: i is null" << endl; - } - - /* - * Test casting in function call (#2 tests). - */ - fail_count += test( - boost::dynamic_pointer_cast(derived), - really_derived, - really_really_derived); - - /* - * Const pointer tests. - */ - - /* - * Test casting to base class Derived. - */ - const boost::shared_ptr j(derived); - if (!j) { - fail_count++; - tbox::perr << "FAILED: - Test #3j: j is null" << endl; - } - const boost::shared_ptr k(really_derived); - if (!k) { - fail_count++; - tbox::perr << "FAILED: - Test #3k: k is null" << endl; - } - const boost::shared_ptr l(really_really_derived); - if (!l) { - fail_count++; - tbox::perr << "FAILED: - Test #3l: l is null" << endl; - } - - /* - * Test casting to intermediate class ReallyDerived. - */ - const boost::shared_ptr m( - derived, - boost::detail::dynamic_cast_tag()); - if (m) { - fail_count++; - tbox::perr << "FAILED: - Test #3m: m is non-null" << endl; - } - const boost::shared_ptr n(really_derived); - if (!n) { - fail_count++; - tbox::perr << "FAILED: - Test #3n: n is null" << endl; - } - const boost::shared_ptr o(really_really_derived); - if (!o) { - fail_count++; - tbox::perr << "FAILED: - Test #3o: o is null" << endl; - } - - /* - * Test casting to most derived class ReallyDerived. - */ - const boost::shared_ptr p( - derived, - boost::detail::dynamic_cast_tag()); - if (p) { - fail_count++; - tbox::perr << "FAILED: - Test #3p: p is non-null" << endl; - } - const boost::shared_ptr q( - really_derived, - boost::detail::dynamic_cast_tag()); - if (q) { - fail_count++; - tbox::perr << "FAILED: - Test #3q: q is non-null" << endl; - } - const boost::shared_ptr r(really_really_derived); - if (!r) { - fail_count++; - tbox::perr << "FAILED: - Test #3r: r is null" << endl; - } - - /* - * Test casting const pointer to regular pointers. - */ -#if 0 - const boost::shared_ptr s(derived); - if (s) { - fail_count++; - tbox::perr << "FAILED: - Test #3s: s is non-null" << endl; - } - const boost::shared_ptr t(really_derived); - if (t) { - fail_count++; - tbox::perr << "FAILED: - Test #3t: t is non-null" << endl; - } - const boost::shared_ptr u(really_really_derived); - if (u) { - fail_count++; - tbox::perr << "FAILED: - Test #3u: u is non-null" << endl; - } -#endif - - /* - * Virtual base class pointer tests. - */ - - boost::shared_ptr my_C(new C()); - - // #4 tests - HaveA my_HaveA(fail_count, my_C.get(), my_C.get(), my_C, my_C); - - // #5 tests - HaveB my_HaveB(fail_count, my_C.get(), my_C.get(), my_C, my_C); - - // #6 tests - fail_count += my_HaveA.callFoo(); - - // #7 tests - fail_count += my_HaveB.callFoo(); - - // #8 tests - fail_count += my_HaveA.callFoo1(); - - // #9 tests - fail_count += my_HaveB.callFoo1(); - - if (fail_count == 0) { - tbox::pout << "\nPASSED: testpointer" << endl; - } - } - - tbox::SAMRAIManager::shutdown(); - tbox::SAMRAIManager::finalize(); - tbox::SAMRAI_MPI::finalize(); - - return fail_count; -} diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.depend index cae4d084..2589d013 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -43,6 +43,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ @@ -57,12 +58,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -73,7 +76,9 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/ChopAndPackLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -87,12 +92,12 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -106,20 +111,18 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ @@ -130,10 +133,9 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.in b/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.in index fd88402e..0489ad21 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/Makefile.in @@ -3,18 +3,19 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: Test program for performance of load balancers. ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/rank_group -VPATH = @srcdir@ +VPATH = @srcdir@ OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml -CPPFLAGS_EXTRA= -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA= -DTESTING=1 default: check @@ -23,49 +24,66 @@ include $(OBJECT)/config/Makefile.config NUM_TESTS = 6 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" CXX_OBJS = main.o -INPUTS1D = rod.1d.input INPUTS2D = rect.2d.treelb.input rod.2d.treelb.input small_cube.2d.treelb.input small_sphere.2d.treelb.input INPUTS3D = plank.3d.treelb.input small_cube.3d.treelb.input -main: $(CXX_OBJS) $(LIBSAMRAI) +main: $(CXX_OBJS) $(LIBSAMRAI) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) \ $(LIBSAMRAI) $(LDLIBS) -o $@ check: - $(MAKE) check2d - $(MAKE) check3d - -check1d: main - for f in $(INPUTS1D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done + $(MAKE) check2d + $(MAKE) check3d check2d: main - for f in $(INPUTS2D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done + @for f in $(INPUTS2D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "test_inputs/$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main - for f in $(INPUTS3D); do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ ./main "test_inputs/$$f"; \ - done + @for f in $(INPUTS3D); do \ + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main "test_inputs/$$f" | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo checkcompile: main checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(OBJECT)/source/test/testtools/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -clean-check: - $(SAMCLEAN) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -clean: - $(SAMCLEAN) - $(RM) *.f main *visit +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/README b/base/SAMRAI/SAMRAI/source/test/rank_group/README new file mode 100644 index 00000000..9117f363 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/README @@ -0,0 +1,42 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of RankGroup class. +## +######################################################################### + +This test unit tests the RankGroup class in the context of the +TreeLoadBalancer. The files included in this directory are as follows: + + main.C - unit tester + test_inputs/*.input - 2d and 3d input files + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files: + test_inputs/plank.3d.treelb.input + test_inputs/rect.2d.treelb.input + test_inputs/rod.2d.treelb.input + test_inputs/small_cube.2d.treelb.input + test_inputs/small_cube.3d.treelb.input + test_inputs/small_sphere.2d.treelb.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + + +INPUT PARAMETERS +---------------- +Refer to test_inputs/rect.2d.treelb.input for a full description of all input +parameters specific to this problem. diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/main.C b/base/SAMRAI/SAMRAI/source/test/rank_group/main.C index 84693a43..c35fc677 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/main.C +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for RankGroup with TreeLoadBalancer. * ************************************************************************/ @@ -30,12 +30,16 @@ #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/tbox/InputDatabase.h" #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAIManager.h" #include "SAMRAI/tbox/TimerManager.h" #include +#include + +#include using namespace SAMRAI; using namespace tbox; @@ -47,19 +51,15 @@ using namespace tbox; ************************************************************************* */ -typedef std::vector NodeVec; -typedef std::vector BoxVec; - void generatePrebalanceByUserBoxes( boost::shared_ptr database, const boost::shared_ptr& hierarchy, const hier::IntVector& min_size, const hier::IntVector& max_gcw, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balacne_to_anchor); + boost::shared_ptr& balance_box_level, + const hier::BoxLevel& anchor_box_level, + boost::shared_ptr& anchor_to_balance); void generatePrebalanceByUserShells( @@ -67,16 +67,15 @@ generatePrebalanceByUserShells( const boost::shared_ptr& hierarchy, const hier::IntVector& min_size, const hier::IntVector& max_gcw, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor); + boost::shared_ptr& balance_box_level, + const boost::shared_ptr& anchor_box_level, + boost::shared_ptr& anchor_to_balance, + int tag_level_number); void sortNodes( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, bool sort_by_corners, bool sequentialize_global_indices); @@ -93,7 +92,6 @@ int main( SAMRAIManager::startup(); tbox::SAMRAI_MPI mpi(SAMRAI_MPI::getSAMRAIWorld()); - const int rank = mpi.getRank(); int fail_count = 0; /* @@ -205,7 +203,7 @@ int main( if (main_db->isInteger("min_size")) { main_db->getIntegerArray("min_size", &min_size[0], dimval); } - hier::IntVector max_size(dim, -1); + hier::IntVector max_size(dim, INT_MAX); if (main_db->isInteger("max_size")) { main_db->getIntegerArray("max_size", &max_size[0], dimval); } @@ -217,21 +215,20 @@ int main( /* * Set up the domain from input. */ - hier::BoxContainer input_boxes(main_db->getDatabaseBoxArray("domain_boxes")); - hier::BoxContainer domain_boxes; - hier::LocalId local_id(0); - for (hier::BoxContainer::iterator itr = input_boxes.begin(); - itr != input_boxes.end(); ++itr) { + std::vector db_box_vector = + main_db->getDatabaseBoxVector("domain_boxes"); + hier::BoxContainer domain_boxes(db_box_vector); + for (hier::BoxContainer::iterator itr = domain_boxes.begin(); + itr != domain_boxes.end(); ++itr) { itr->setBlockId(hier::BlockId(0)); - domain_boxes.pushBack(hier::Box(*itr, local_id++, 0)); } /* * Create hierarchy we can satisfy the load balancing * interface and dump visit output. * - * anchor_mapped_box_level is used for level 0. - * balance_mapped_box_level is used for level 1. + * anchor_box_level is used for level 0. + * balance_box_level is used for level 1. */ std::vector xlo(dimval); std::vector xhi(dimval); @@ -253,16 +250,14 @@ int main( hierarchy->setMaxNumberOfLevels(2); - hier::BoxLevel domain_mapped_box_level( + hier::BoxLevel domain_box_level( hier::IntVector(dim, 1), grid_geometry, mpi, hier::BoxLevel::GLOBALIZED); - - hier::BoxContainer::iterator domain_boxes_itr(domain_boxes); - for (int i = 0; i < domain_boxes.size(); ++i, ++domain_boxes_itr) { - domain_mapped_box_level.addBox(hier::Box(*domain_boxes_itr, - hier::LocalId(i), 0)); + for (hier::BoxContainer::iterator domain_boxes_itr = domain_boxes.begin(); + domain_boxes_itr != domain_boxes.end(); ++domain_boxes_itr) { + domain_box_level.addBox(*domain_boxes_itr); } /* @@ -282,7 +277,7 @@ int main( boost::shared_ptr())); tree_lb.setSAMRAI_MPI(mpi); - mesh::LoadBalanceStrategy* lb = NULL; + mesh::LoadBalanceStrategy* lb = 0; std::string load_balancer_type; if (main_db->isString("load_balancer_type")) { @@ -293,7 +288,7 @@ int main( lb = &cut_and_pack_lb; } } - if (lb == NULL) { + if (lb == 0) { TBOX_ERROR( "Missing or bad load_balancer specification in Main database.\n" << "Specify load_balancer_type = STRING, where STRING can be\n" @@ -303,100 +298,98 @@ int main( /* * Set up data used by TreeLoadBalancer. */ - hier::BoxLevel anchor_mapped_box_level(hier::IntVector(dim, 1), - grid_geometry); - hier::BoxLevel balance_mapped_box_level(dim); - hier::Connector balance_to_anchor; - hier::Connector anchor_to_balance; - hier::Connector balance_to_balance; + boost::shared_ptr anchor_box_level( + boost::make_shared( + hier::IntVector(dim, 1), grid_geometry)); + boost::shared_ptr balance_box_level; + boost::shared_ptr anchor_to_balance; + boost::shared_ptr balance_to_balance; { - hier::BoxContainer anchor_boxes(main_db->getDatabaseBoxArray("anchor_boxes")); + std::vector db_box_vector = + main_db->getDatabaseBoxVector("anchor_boxes"); + hier::BoxContainer anchor_boxes(db_box_vector); const int boxes_per_proc = - (anchor_boxes.size() + anchor_mapped_box_level.getMPI().getSize() - - 1) / anchor_mapped_box_level.getMPI().getSize(); - const int my_boxes_start = anchor_mapped_box_level.getMPI().getRank() + (anchor_boxes.size() + anchor_box_level->getMPI().getSize() - 1) + / anchor_box_level->getMPI().getSize(); + const int my_boxes_start = anchor_box_level->getMPI().getRank() * boxes_per_proc; const int my_boxes_stop = tbox::MathUtilities::Min(my_boxes_start + boxes_per_proc, anchor_boxes.size()); - hier::BoxContainer::iterator anchor_boxes_itr(anchor_boxes); + hier::BoxContainer::iterator anchor_boxes_itr = anchor_boxes.begin(); for (int i = 0; i < my_boxes_start; ++i) { - ++anchor_boxes_itr; + if (anchor_boxes_itr != anchor_boxes.end()) { + ++anchor_boxes_itr; + } } for (int i = my_boxes_start; i < my_boxes_stop; ++i, ++anchor_boxes_itr) { - anchor_mapped_box_level.addBox(*anchor_boxes_itr, - hier::BlockId::zero()); + anchor_box_level->addBox(*anchor_boxes_itr, hier::BlockId::zero()); } } { /* - * Load balance the anchor mapped_box_level, using the domain as its anchor. + * Load balance the anchor box_level, using the domain as its anchor. * * This is not a part of the performance test because does not * reflect the load balancer use in real apps. We just neeed a * distributed anchor for the real loac balancing performance test. */ - hier::Connector anchor_to_domain( - anchor_mapped_box_level, - domain_mapped_box_level, + boost::shared_ptr domain_to_anchor; + oca.findOverlapsWithTranspose(domain_to_anchor, + domain_box_level, + *anchor_box_level, + hier::IntVector(dim, 2), hier::IntVector(dim, 2)); - hier::Connector domain_to_anchor( - domain_mapped_box_level, - anchor_mapped_box_level, - hier::IntVector(dim, 2)); - oca.findOverlaps(anchor_to_domain); - oca.findOverlaps(domain_to_anchor); + hier::Connector* anchor_to_domain = &domain_to_anchor->getTranspose(); tbox::plog << "\n\n\ninitial anchor loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)anchor_mapped_box_level.getLocalNumberOfCells(), - anchor_mapped_box_level.getMPI()); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(anchor_box_level->getLocalNumberOfCells())), + anchor_box_level->getMPI()); const int nnodes = mpi.getSize(); - tbox::Array active_ranks; + std::vector active_ranks; if (nnodes == 1) { - active_ranks.resizeArray(1); + active_ranks.resize(1); active_ranks[0] = 0; } else { - active_ranks.resizeArray(nnodes / 2); - for (int i = 0; i < nnodes / 2; i++) { + active_ranks.resize(nnodes / 2); + for (int i = 0; i < nnodes / 2; ++i) { active_ranks[i] = (i + 1) % (nnodes / 2); } + std::sort(&active_ranks[0], + &active_ranks[0] + static_cast(active_ranks.size())); } tbox::RankGroup rank_group_0(active_ranks, mpi); lb->loadBalanceBoxLevel( - anchor_mapped_box_level, + *anchor_box_level, anchor_to_domain, - domain_to_anchor, hierarchy, 0, - hier::Connector(), - hier::Connector(), min_size, max_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor, rank_group_0); - sortNodes(anchor_mapped_box_level, - domain_to_anchor, - anchor_to_domain, + sortNodes(*anchor_box_level, + *domain_to_anchor, false, true); - oca.assertOverlapCorrectness(anchor_to_domain); - oca.assertOverlapCorrectness(domain_to_anchor); + anchor_to_domain->assertOverlapCorrectness(); + domain_to_anchor->assertOverlapCorrectness(); - anchor_mapped_box_level.cacheGlobalReducedData(); + anchor_box_level->cacheGlobalReducedData(); tbox::plog << "\n\n\nfinal anchor loads:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)anchor_mapped_box_level.getLocalNumberOfCells(), - anchor_mapped_box_level.getMPI()); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(anchor_box_level->getLocalNumberOfCells())), + anchor_box_level->getMPI()); } { @@ -409,58 +402,58 @@ int main( hierarchy, min_size, ghost_cell_width, - balance_mapped_box_level, - anchor_mapped_box_level, - anchor_to_balance, - balance_to_anchor); + balance_box_level, + *anchor_box_level, + anchor_to_balance); } else if (box_gen_method == "PrebalanceByUserShells") { generatePrebalanceByUserShells( main_db->getDatabase("PrebalanceByUserShells"), hierarchy, min_size, ghost_cell_width, - balance_mapped_box_level, - anchor_mapped_box_level, + balance_box_level, + anchor_box_level, anchor_to_balance, - balance_to_anchor); + 0); } else { TBOX_ERROR("Bad box_gen_method: '" << box_gen_method << "'"); } } + hier::Connector* balance_to_anchor = &anchor_to_balance->getTranspose(); { /* * Output "before" data. */ - balance_mapped_box_level.cacheGlobalReducedData(); + balance_box_level->cacheGlobalReducedData(); tbox::plog << "\n\n\nBefore:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)balance_mapped_box_level.getLocalNumberOfCells(), - balance_mapped_box_level.getMPI()); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(balance_box_level->getLocalNumberOfCells())), + balance_box_level->getMPI()); - hier::BoxLevelStatistics anchor_stats(anchor_mapped_box_level); - tbox::plog << "Anchor mapped_box_level node stats:\n"; + hier::BoxLevelStatistics anchor_stats(*anchor_box_level); + tbox::plog << "Anchor box_level node stats:\n"; anchor_stats.printBoxStats(tbox::plog, "AL-> "); - tbox::plog << "Anchor mapped_box_level:\n"; - anchor_mapped_box_level.recursivePrint(tbox::plog, "AL-> ", 2); + tbox::plog << "Anchor box_level:\n"; + anchor_box_level->recursivePrint(tbox::plog, "AL-> ", 2); - hier::BoxLevelStatistics balance_stats(anchor_mapped_box_level); - tbox::plog << "Balance mapped_box_level node stats:\n"; + hier::BoxLevelStatistics balance_stats(*balance_box_level); + tbox::plog << "Balance box_level node stats:\n"; balance_stats.printBoxStats(tbox::plog, "BL-> "); - tbox::plog << "Balance mapped_box_level:\n"; - balance_mapped_box_level.recursivePrint(tbox::plog, "BL-> ", 2); + tbox::plog << "Balance box_level:\n"; + balance_box_level->recursivePrint(tbox::plog, "BL-> ", 2); - hier::ConnectorStatistics balance_anchor_stats(balance_to_anchor); + hier::ConnectorStatistics balance_anchor_stats(*balance_to_anchor); tbox::plog << "balance_to_anchor edge stats:\n"; balance_anchor_stats.printNeighborStats(tbox::plog, "BA-> "); tbox::plog << "balance_to_anchor:\n"; - balance_to_anchor.recursivePrint(tbox::plog, "BA-> "); + balance_to_anchor->recursivePrint(tbox::plog, "BA-> "); - hier::ConnectorStatistics anchor_balance_stats(anchor_to_balance); + hier::ConnectorStatistics anchor_balance_stats(*anchor_to_balance); tbox::plog << "anchor_to_balance edge stats:\n"; anchor_balance_stats.printNeighborStats(tbox::plog, "AB-> "); tbox::plog << "anchor_to_balance:\n"; - anchor_to_balance.recursivePrint(tbox::plog, "AB-> "); + anchor_to_balance->recursivePrint(tbox::plog, "AB-> "); } { @@ -474,29 +467,25 @@ int main( } /* - * Load balance the unbalanced mapped_box_level. + * Load balance the unbalanced box_level. */ lb->loadBalanceBoxLevel( - balance_mapped_box_level, + *balance_box_level, balance_to_anchor, - anchor_to_balance, hierarchy, 1, - hier::Connector(), - hier::Connector(), min_size, max_size, - domain_mapped_box_level, + domain_box_level, bad_interval, cut_factor, rank_group_1); - oca.assertOverlapCorrectness(balance_to_anchor); - oca.assertOverlapCorrectness(anchor_to_balance); + balance_to_anchor->assertOverlapCorrectness(); + anchor_to_balance->assertOverlapCorrectness(); - sortNodes(balance_mapped_box_level, - anchor_to_balance, - balance_to_anchor, + sortNodes(*balance_box_level, + *anchor_to_balance, false, true); } @@ -506,61 +495,58 @@ int main( */ oca.bridge( balance_to_balance, - balance_to_anchor, - anchor_to_balance, - balance_to_anchor, - anchor_to_balance); + *balance_to_anchor, + *anchor_to_balance, + false); { /* * Output "after" data. */ - balance_mapped_box_level.cacheGlobalReducedData(); + balance_box_level->cacheGlobalReducedData(); tbox::plog << "\n\n\nAfter:\n"; - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)balance_mapped_box_level.getLocalNumberOfCells(), - balance_mapped_box_level.getMPI()); + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(balance_box_level->getLocalNumberOfCells())), + balance_box_level->getMPI()); - hier::BoxLevelStatistics balance_stats(balance_mapped_box_level); - tbox::plog << "Balance mapped_box_level node stats:\n"; + hier::BoxLevelStatistics balance_stats(*balance_box_level); + tbox::plog << "Balance box_level node stats:\n"; balance_stats.printBoxStats(tbox::plog, "BL-> "); - tbox::plog << "Balance mapped_box_level:\n"; - balance_mapped_box_level.recursivePrint(tbox::plog, "BL-> ", 2); + tbox::plog << "Balance box_level:\n"; + balance_box_level->recursivePrint(tbox::plog, "BL-> ", 2); - hier::ConnectorStatistics balance_balance_stats(balance_to_balance); + hier::ConnectorStatistics balance_balance_stats(*balance_to_balance); tbox::plog << "balance_to_balance edge stats:\n"; balance_balance_stats.printNeighborStats(tbox::plog, "BB-> "); tbox::plog << "balance_to_balance:\n"; - balance_to_balance.recursivePrint(tbox::plog, "BB-> "); + balance_to_balance->recursivePrint(tbox::plog, "BB-> "); - hier::ConnectorStatistics balance_anchor_stats(balance_to_anchor); + hier::ConnectorStatistics balance_anchor_stats(*balance_to_anchor); tbox::plog << "balance_to_anchor edge stats:\n"; balance_anchor_stats.printNeighborStats(tbox::plog, "BA-> "); tbox::plog << "balance_to_anchor:\n"; - balance_to_anchor.recursivePrint(tbox::plog, "BA-> "); + balance_to_anchor->recursivePrint(tbox::plog, "BA-> "); - hier::ConnectorStatistics anchor_balance_stats(anchor_to_balance); + hier::ConnectorStatistics anchor_balance_stats(*anchor_to_balance); tbox::plog << "anchor_to_balance edge stats:\n"; anchor_balance_stats.printNeighborStats(tbox::plog, "AB-> "); tbox::plog << "anchor_to_balance:\n"; - anchor_to_balance.recursivePrint(tbox::plog, "AB-> "); + anchor_to_balance->recursivePrint(tbox::plog, "AB-> "); // Dump summary statistics to output. - mesh::BalanceUtilities::gatherAndReportLoadBalance( - (double)balance_mapped_box_level.getLocalNumberOfCells(), - balance_mapped_box_level.getMPI(), + mesh::BalanceUtilities::reduceAndReportLoadBalance( + std::vector(1, static_cast(balance_box_level->getLocalNumberOfCells())), + balance_box_level->getMPI(), tbox::plog); } - const hier::BoxLevel& layer0 = anchor_mapped_box_level; hierarchy->makeNewPatchLevel( 0, - layer0); + anchor_box_level); - const hier::BoxLevel& layer1 = balance_mapped_box_level; hierarchy->makeNewPatchLevel( 1, - layer1); + balance_box_level); #ifdef HAVE_HDF5 #if 0 @@ -602,15 +588,7 @@ int main( */ SAMRAIManager::shutdown(); SAMRAIManager::finalize(); - - if (fail_count == 0) { - SAMRAI_MPI::finalize(); - } else { - std::cout << "Process " << std::setw(5) << rank << " aborting." - << std::endl; - tbox::Utilities::abort("Aborting due to nonzero fail count", - __FILE__, __LINE__); - } + SAMRAI_MPI::finalize(); return fail_count; } @@ -624,10 +602,10 @@ void generatePrebalanceByUserShells( const boost::shared_ptr& hierarchy, const hier::IntVector& min_size, const hier::IntVector& max_gcw, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor) + boost::shared_ptr& balance_box_level, + const boost::shared_ptr& anchor_box_level, + boost::shared_ptr& anchor_to_balance, + int tag_level_number) { const tbox::Dimension dim(hierarchy->getDim()); @@ -637,26 +615,21 @@ void generatePrebalanceByUserShells( * Starting at shell origin, tag cells with centroids * at radii[0] radii; - double efficiency_tol = 0.75; - double combine_tol = 0.75; + std::vector radii; std::vector r0(dimval); for (int d = 0; d < dimval; ++d) r0[d] = 0; boost::shared_ptr abr_db; if (database) { - efficiency_tol = database->getDoubleWithDefault("efficiency_tol", - efficiency_tol); - combine_tol = database->getDoubleWithDefault("combine_tol", combine_tol); if (database->isDouble("r0")) { - database->getDoubleArray("r0", &r0[0], dimval); + r0 = database->getDoubleVector("r0"); } if (database->isDouble("radii")) { - radii = database->getDoubleArray("radii"); + radii = database->getDoubleVector("radii"); } abr_db = database->getDatabaseWithDefault("BergerRigoutsos", abr_db); - TBOX_ASSERT(radii.size() % 2 == 0); + TBOX_ASSERT(static_cast(radii.size()) % 2 == 0); } const int tag_val = 1; @@ -664,14 +637,16 @@ void generatePrebalanceByUserShells( hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); boost::shared_ptr grid_geometry( - hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + hierarchy->getGridGeometry())); + TBOX_ASSERT(grid_geometry); boost::shared_ptr tag_level( new hier::PatchLevel( - anchor_mapped_box_level, + anchor_box_level, grid_geometry, vdb->getPatchDescriptor())); + tag_level->setLevelNumber(tag_level_number); boost::shared_ptr > tag_variable( new pdat::CellVariable(dim, "TagVariable")); @@ -692,13 +667,14 @@ void generatePrebalanceByUserShells( pi != tag_level->end(); ++pi) { const boost::shared_ptr& patch = *pi; boost::shared_ptr > tag_data( - patch->getPatchData(tag_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_id))); + TBOX_ASSERT(tag_data); tag_data->getArrayData().undefineData(); - pdat::CellData::iterator ciend(tag_data->getGhostBox(), false); - for (pdat::CellData::iterator ci(tag_data->getGhostBox(), true); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(tag_data->getGhostBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(tag_data->getGhostBox())); ci != ciend; ++ci) { const pdat::CellIndex& idx = *ci; double rr = 0; @@ -708,7 +684,7 @@ void generatePrebalanceByUserShells( rr += r[d] * r[d]; } rr = sqrt(rr); - for (int i = 0; i < radii.size(); i += 2) { + for (int i = 0; i < static_cast(radii.size()); i += 2) { if (radii[i] < rr && rr < radii[i + 1]) { (*tag_data)(idx) = tag_val; break; @@ -718,32 +694,29 @@ void generatePrebalanceByUserShells( } mesh::BergerRigoutsos abr(dim, abr_db); - abr.setMPI(anchor_mapped_box_level.getMPI()); + abr.useDuplicateMPI(anchor_box_level->getMPI()); abr.findBoxesContainingTags( - balance_mapped_box_level, + balance_box_level, anchor_to_balance, - balance_to_anchor, tag_level, tag_id, tag_val, - anchor_mapped_box_level.getGlobalBoundingBox(0), + hier::BoxContainer(anchor_box_level->getGlobalBoundingBox(hier::BlockId(0))), min_size, - efficiency_tol, - combine_tol, - max_gcw, - hier::BlockId::zero(), - hier::LocalId(0)); + max_gcw); + + hier::Connector& balance_to_anchor = anchor_to_balance->getTranspose(); /* * The clustering step generated Connectors to/from the temporary * tag_level->getBoxLevel(), which is not the same as the * anchor BoxLevel. We need to reset the Connectors to use - * the anchor_mapped_box_level instead. + * the anchor_box_level instead. */ - anchor_to_balance.setBase(anchor_mapped_box_level); - anchor_to_balance.setHead(balance_mapped_box_level, true); - balance_to_anchor.setBase(balance_mapped_box_level); - balance_to_anchor.setHead(anchor_mapped_box_level, true); + anchor_to_balance->setBase(*anchor_box_level); + anchor_to_balance->setHead(*balance_box_level, true); + balance_to_anchor.setBase(*balance_box_level); + balance_to_anchor.setHead(*anchor_box_level, true); } /* @@ -755,42 +728,40 @@ void generatePrebalanceByUserBoxes( const boost::shared_ptr& hierarchy, const hier::IntVector& min_size, const hier::IntVector& max_gcw, - hier::BoxLevel& balance_mapped_box_level, - const hier::BoxLevel& anchor_mapped_box_level, - hier::Connector& anchor_to_balance, - hier::Connector& balance_to_anchor) + boost::shared_ptr& balance_box_level, + const hier::BoxLevel& anchor_box_level, + boost::shared_ptr& anchor_to_balance) { NULL_USE(hierarchy); NULL_USE(min_size); const tbox::Dimension& dim(hierarchy->getDim()); - hier::BoxContainer balance_boxes(database->getDatabaseBoxArray("balance_boxes")); - tbox::Array initial_owners(1); + std::vector db_box_vector = + database->getDatabaseBoxVector("balance_boxes"); + hier::BoxContainer balance_boxes(db_box_vector); + std::vector initial_owners(1); initial_owners[0] = 0; - initial_owners = database->getIntegerArray("initial_owners"); + initial_owners = database->getIntegerVector("initial_owners"); - balance_mapped_box_level.initialize(hier::IntVector(dim, 1), - hierarchy->getGridGeometry(), - anchor_mapped_box_level.getMPI()); - hier::BoxContainer::iterator balance_boxes_itr(balance_boxes); + balance_box_level.reset(new hier::BoxLevel(hier::IntVector(dim, 1), + hierarchy->getGridGeometry(), + anchor_box_level.getMPI())); + hier::BoxContainer::iterator balance_boxes_itr = balance_boxes.begin(); for (int i = 0; i < balance_boxes.size(); ++i, ++balance_boxes_itr) { - const int owner = i % initial_owners.size(); - if (owner == balance_mapped_box_level.getMPI().getRank()) { - balance_boxes_itr->setBlockId(hier::BlockId(0)); - balance_mapped_box_level.addBox(hier::Box(*balance_boxes_itr, + const int owner = i % static_cast(initial_owners.size()); + if (owner == balance_box_level->getMPI().getRank()) { + balance_boxes_itr->setBlockId(hier::BlockId(0)); + balance_box_level->addBox(hier::Box(*balance_boxes_itr, hier::LocalId(i), owner)); } } - balance_to_anchor.setBase(balance_mapped_box_level); - balance_to_anchor.setHead(anchor_mapped_box_level); - balance_to_anchor.setWidth(max_gcw, true); - anchor_to_balance.setBase(anchor_mapped_box_level); - anchor_to_balance.setHead(balance_mapped_box_level); - anchor_to_balance.setWidth(max_gcw, true); hier::OverlapConnectorAlgorithm oca; - oca.findOverlaps(balance_to_anchor); - oca.findOverlaps(anchor_to_balance); + oca.findOverlapsWithTranspose(anchor_to_balance, + anchor_box_level, + *balance_box_level, + max_gcw, + max_gcw); } /* @@ -798,26 +769,24 @@ void generatePrebalanceByUserBoxes( *********************************************************************** */ void sortNodes( - hier::BoxLevel& new_mapped_box_level, + hier::BoxLevel& new_box_level, hier::Connector& tag_to_new, - hier::Connector& new_to_tag, bool sort_by_corners, bool sequentialize_global_indices) { const hier::MappingConnectorAlgorithm mca; - hier::Connector sorting_map; - hier::BoxLevel seq_mapped_box_level(new_mapped_box_level.getDim()); + boost::shared_ptr sorting_map; + boost::shared_ptr seq_box_level; hier::BoxLevelConnectorUtils dlbg_edge_utils; dlbg_edge_utils.makeSortingMap( - seq_mapped_box_level, + seq_box_level, sorting_map, - new_mapped_box_level, + new_box_level, sort_by_corners, sequentialize_global_indices); mca.modify(tag_to_new, - new_to_tag, - sorting_map, - &new_mapped_box_level); + *sorting_map, + &new_box_level); } diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/plank.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/plank.3d.treelb.input index 3da0e648..15326dd1 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/plank.3d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/plank.3d.treelb.input @@ -3,79 +3,66 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - +// Refer to rect.2d.treelb.input for full description of all input parameters +// specific to this problem. Main { + // Dimension of problem. dim = 3 + // Base name of log file. base_name = "plank.treelb.3d" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer. load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0,0),(49,99,299)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0,0),(49,99,299)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. min_size = 4, 4, 4 PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ + // Specify unbalanced layer as a box array in the reference index space. balance_boxes = [(10,10,10),(39,89,289)] + + // initial_owners are the ranks of the owners of all the initial balance + // boxes. initial_owners = 0 } } TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE } TimerManager { diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rect.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rect.2d.treelb.input index c497f96e..4f31d2fc 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rect.2d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rect.2d.treelb.input @@ -3,81 +3,75 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - - Main { + // Dimension of the problem. dim = 2 + // Base name for log file. base_name = "rect.treelb.2d" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer. load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0),(999,199)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0),(999,199)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. If omitted, min patch size is 8 in each + // dimension. min_size = 4, 4 - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. + // Specify the max patch size. If omitted, no max patch size. + // max_size = -1, -1 + + // Box generation method. One of PrebalanceByUserBoxes, + // PrebalanceByUserShells. + // box_gen_method = "PrebalanceByUserBoxes" - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ + PrebalanceByUserBoxes { + // Specify unbalanced layer as a box array in the reference index space. balance_boxes = [(10,10),(989,189)] + + // initial_owners are the ranks of the owners of all the initial balance + // boxes. initial_owners = 0 } } +// Refer to mesh::TreeLoadBalancer for input TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } +// Refer to tbox::TimerManager for input. TimerManager { // print_exclusive = TRUE print_summed = TRUE diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.1d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.1d.treelb.input deleted file mode 100644 index 681632b8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.1d.treelb.input +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Performance input file for TreeLoadBalancer - * - ************************************************************************/ - - - -Main { - base_name = "rod.treelb.1d" - log_all_nodes = FALSE - - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer - load_balancer_type = "TreeLoadBalancer" - - /* - Specify domain as a box array in the reference index space. - */ - domain_boxes = [(0),(299)] - - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ - anchor_boxes = [(0),(299)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ - ghost_cell_width = 4 - - /* - Specify the min patch size. - */ - min_size = 1 - - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(1),(298)] - initial_owners = 0 - } - -} - -TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 - - // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE -} - -TimerManager { -// print_exclusive = TRUE - print_summed = TRUE - print_max = TRUE - print_threshold = 0. - timer_list = "hier::*::*", "mesh::*::*", "apps::*::*" -} diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.2d.treelb.input index 80be523b..5641f044 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.2d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/rod.2d.treelb.input @@ -3,79 +3,66 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - +// Refer to rect.2d.treelb.input for full description of all input parameters +// specific to this problem. Main { + // Dimension of the problem. dim = 2 + // Base name for log file. base_name = "rod.treelb.2d" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0),(299,2)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0),(299,2)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. min_size = 1, 1 PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ + // Specify unbalanced layer as a box array in the reference index space. balance_boxes = [(1,1),(298,1)] + + // initial_owners are the ranks of the owners of all the initial balance + // boxes. initial_owners = 0 } } TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } TimerManager { diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.2d.treelb.input index 670f8bae..9f9e5fc6 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.2d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.2d.treelb.input @@ -3,79 +3,66 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - +// Refer to rect.2d.treelb.input for full description of all input parameters +// specific to this problem. Main { + // Dimension of problem. dim = 2 + // Base name for log file. base_name = "small_cube.2d.treelb" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer. load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0),(199,199)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0),(199,199)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. min_size = 4, 4 PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ + // Specify unbalanced layer as a box array in the reference index space. balance_boxes = [(10,10),(189,189)] + + // initial_owners are the ranks of the owners of all the initial balance + // boxes. initial_owners = 0 } } TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } TimerManager { diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.3d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.3d.treelb.input index d2e82fe4..e60c0307 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.3d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_cube.3d.treelb.input @@ -3,79 +3,66 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - +// Refer to rect.2d.treelb.input for full description of all input parameters +// specific to this problem. Main { + // Dimension of problem. dim = 3 + // Base name of log file. base_name = "small_cube.3d.treelb" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer. load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0,0),(99,99,99)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0,0),(99,99,99)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. min_size = 4, 4, 4 PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ + // Specify unbalanced layer as a box array in the reference index space. balance_boxes = [(10,10,10),(89,89,89)] + + // initial_owners are the ranks of the owners of all the initial balance + // boxes. initial_owners = 0 } } TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = TRUE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = TRUE + DEV_print_edge_steps = FALSE } TimerManager { diff --git a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_sphere.2d.treelb.input b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_sphere.2d.treelb.input index 9f668ffb..0344c2df 100644 --- a/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_sphere.2d.treelb.input +++ b/base/SAMRAI/SAMRAI/source/test/rank_group/test_inputs/small_sphere.2d.treelb.input @@ -3,101 +3,79 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Performance input file for TreeLoadBalancer * ************************************************************************/ - +// Refer to rect.2d.treelb.input for full description of all input parameters +// specific to this problem. Main { + // Dimension of problem. dim = 2 + // Base name of log file. base_name = "small_sphere.2d.treelb" + + // If true all processes generate log files. Otherwise only process 0 does. log_all_nodes = FALSE - // Balancer types: TreeLoadBalancer, ChopAndPackLoadBalancer + // Load balancer choice. One of TreeLoadBalancer, ChopAndPackLoadBalancer. load_balancer_type = "TreeLoadBalancer" - /* - Specify domain as a box array in the reference index space. - */ + // Specify domain as a box array in the reference index space. domain_boxes = [(0,0),(49,49)] - /* - Specify anchor layer as a box array in the reference index space. - The anchor layer will be partitioned but its partitioning is not - used in the performance test. - - If omitted, the anchor layer is the same as the domain. - */ + // Specify anchor layer as a box array in the reference index space. + // The anchor layer will be partitioned but its partitioning is not + // used in the performance test. anchor_boxes = [(0,0),(49,49)] - /* - If anchor is not contained in domain, you can use this flag - to remove the parts that are outside the domain. - */ - autonest_anchor = TRUE - - /* - Specify ghost-cell-width between anchor and unbalanced. - */ + + // Specify ghost-cell-width between anchor and unbalanced. ghost_cell_width = 4, 4 - /* - Specify the min patch size. - */ + // Specify the min patch size. min_size = 4, 4 + // Box generation method. One of PrebalanceByUserBoxes, + // PrebalanceByUserShells. box_gen_method = "PrebalanceByUserShells" - PrebalanceByUserBoxes { - /* - Specify unbalanced layer as a box array in the reference index space. - - initial_owners are the ranks of the owners of all the initial balance boxes. - By default, processor 0 owns all the initial balance boxes. - */ - balance_boxes = [(10,10),(89,89)] - initial_owners = 0 - max_box_size = -1, -1, -1 - } - PrebalanceByUserShells { - /* - Specify unbalanced layer by tagging a set of concentric shells. - */ + // Specify unbalanced layer by tagging a set of concentric shells. + // Starting at r0, tag cells with centroids at radii[n] < r < radii[n+1]. r0 = 0, 0 // 0.5, 0.5 radii = 0.0, 0.6, 0.75, 0.85, 0.99, 1.0 - efficiency_tol = 0.80 - combine_tol = 0.90 + + // Refer to mesh::BergerRigoutsos for input. BergerRigoutsos { - log_node_history = FALSE - log_cluster_summary = TRUE - log_cluster = FALSE - sequentialize_output_indices = FALSE - barrier_before_cluster = FALSE - // owner_mode = "SINGLE_OWNER" - // algo_advance_mode = "SYNCHRONOUS" + efficiency_tol = 0.80 + combine_tol = 0.90 + DEV_log_node_history = FALSE + DEV_log_cluster_summary = TRUE + DEV_log_cluster = FALSE + // DEV_owner_mode = "SINGLE_OWNER" + // DEV_algo_advance_mode = "SYNCHRONOUS" } } } TreeLoadBalancer { - report_load_balance = TRUE // Reported in main - n_root_cycles = -1 - balance_penalty_wt = 1.0 - surface_penalty_wt = 1.0 - slender_penalty_wt = 1.0 - precut_penalty_wt = 1.0 + DEV_report_load_balance = TRUE // Reported in main + DEV_balance_penalty_wt = 1.0 + DEV_surface_penalty_wt = 1.0 + DEV_slender_penalty_wt = 1.0 + DEV_precut_penalty_wt = 1.0 // Debugging options - check_map = FALSE - check_connectivity = FALSE - print_steps = TRUE - print_swap_steps = FALSE - print_break_steps = FALSE - print_edge_steps = FALSE + DEV_check_map = FALSE + DEV_check_connectivity = FALSE + DEV_print_steps = TRUE + DEV_print_swap_steps = FALSE + DEV_print_break_steps = FALSE + DEV_print_edge_steps = FALSE } TimerManager { diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.depend index 82439dea..2d4651fa 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,8 +14,8 @@ FILE_0=database_tests.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -25,7 +25,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -34,18 +33,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.C \ database_tests.h database_values.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=mainHDF5.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -55,7 +51,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -64,17 +59,15 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.h \ mainHDF5.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} +${FILE_1}: ${DEPENDS_1} FILE_2=mainHDF5AppFileOpen.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -84,7 +77,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -93,17 +85,15 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.h \ mainHDF5AppFileOpen.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} +${FILE_2}: ${DEPENDS_2} FILE_3=mainMemory.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -113,7 +103,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -122,17 +111,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.h \ mainMemory.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} + +${FILE_3}: ${DEPENDS_3} FILE_4=mainSilo.o DEPENDS_4:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -141,7 +128,6 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -151,17 +137,15 @@ DEPENDS_4:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.h \ mainSilo.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_4 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_4:X.o=${NDIM}.o}: ${DEPENDS_4} +${FILE_4}: ${DEPENDS_4} FILE_5=mainSiloAppFileOpen.o DEPENDS_5:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -170,7 +154,6 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -180,10 +163,9 @@ DEPENDS_5:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h database_tests.h \ mainSiloAppFileOpen.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_5 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_5:X.o=${NDIM}.o}: ${DEPENDS_5} +${FILE_5}: ${DEPENDS_5} diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.in b/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.in index fae258d1..15e8a9c7 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/Makefile.in @@ -3,27 +3,29 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the restart database and HDF5 tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/restartdb -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 -default: check +default: check include $(OBJECT)/config/Makefile.config NUM_TESTS = 5 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" testHDF5: mainHDF5.o database_tests.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) mainHDF5.o database_tests.o \ @@ -46,11 +48,37 @@ testMemory: mainMemory.o database_tests.o $(LIBSAMRAIDEPEND) $(LIBSAMRAI) $(LDLIBS) -o testMemory check: testHDF5 testHDF5AppFileOpen testSilo testSiloAppFileOpen testMemory - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./testHDF5 - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./testHDF5AppFileOpen - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./testSilo - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./testSiloAppFileOpen - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./testMemory + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./testHDF5 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./testHDF5AppFileOpen | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./testSilo | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./testSiloAppFileOpen | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./testMemory | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -62,14 +90,28 @@ checkcompile: testHDF5 testHDF5AppFileOpen testSilo testSiloAppFileOpen \ testMemory checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean: - $(SAMCLEAN) - $(RM) testHDF5 testSilo - $(RM) -r test_dir *.silo *.hdf5 +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) test_dir *.silo *.hdf5 + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) testHDF5 testHDF5AppFileOpen testSilo testSiloAppFileOpen \ + testMemory include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/README b/base/SAMRAI/SAMRAI/source/test/restartdb/README index 0cf68217..b24ea891 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/README +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/README @@ -3,24 +3,37 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for hdf5 test. ## ######################################################################### -This program tests the methods provided by the HDF5Database and +This program tests the methods provided by the HDFDatabase and RestartManager classes. -Compilation: - make - or - make testHDF5 +COMPILATION AND EXECUTION +------------------------- + Compilation: + make checkcompile -Execution: - ./testHDF5 - -Output: - HDF5test.log - --OR- make check + Execution: + serial: + ./testHDF5 + ./testHDF5AppFileOpen + ./testSilo + ./testSiloAppFileOpen + ./testMemory + parallel: + Parallel execution is platform dependent. These examples demonstrate + execution via mpirun. + mpirun -np [mpirun options] ./testHDF5 + mpirun -np [mpirun options] ./testHDF5AppFileOpen + mpirun -np [mpirun options] ./testSilo + mpirun -np [mpirun options] ./testSiloAppFileOpen + mpirun -np [mpirun options] ./testMemory +OUTPUT +------ + HDF5test.log + Silotest.log + Memorytest.log diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.C b/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.C index 1a077175..b58db34b 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Some simple generic database test functions * ************************************************************************/ @@ -84,36 +84,36 @@ void writeTestData( * Set array values and write to database hierarchy. */ - tbox::Array arraydb_dcomplexArray(3); + std::vector arraydb_dcomplexArray(3); arraydb_dcomplexArray[0] = arraydb_dcomplexArray0; arraydb_dcomplexArray[1] = arraydb_dcomplexArray1; arraydb_dcomplexArray[2] = arraydb_dcomplexArray2; - tbox::Array arraydb_boolArray(3); + std::vector arraydb_boolArray(3); arraydb_boolArray[0] = arraydb_boolArray0; arraydb_boolArray[1] = arraydb_boolArray1; arraydb_boolArray[2] = arraydb_boolArray2; - tbox::Array arraydb_intArray(5); + std::vector arraydb_intArray(5); arraydb_intArray[0] = arraydb_intArray0; arraydb_intArray[1] = arraydb_intArray1; arraydb_intArray[2] = arraydb_intArray2; arraydb_intArray[3] = arraydb_intArray3; arraydb_intArray[4] = arraydb_intArray4; - tbox::Array arraydb_stringArray(3); + std::vector arraydb_stringArray(3); arraydb_stringArray[0] = arraydb_stringArray0; arraydb_stringArray[1] = arraydb_stringArray1; arraydb_stringArray[2] = arraydb_stringArray2; - tbox::Array arraydb_floatArray(5); + std::vector arraydb_floatArray(5); arraydb_floatArray[0] = arraydb_floatArray0; arraydb_floatArray[1] = arraydb_floatArray1; arraydb_floatArray[2] = arraydb_floatArray2; arraydb_floatArray[3] = arraydb_floatArray3; arraydb_floatArray[4] = arraydb_floatArray4; - tbox::Array arraydb_doubleArray(6); + std::vector arraydb_doubleArray(6); arraydb_doubleArray[0] = arraydb_doubleArray0; arraydb_doubleArray[1] = arraydb_doubleArray1; arraydb_doubleArray[2] = arraydb_doubleArray2; @@ -121,11 +121,11 @@ void writeTestData( arraydb_doubleArray[4] = arraydb_doubleArray4; arraydb_doubleArray[5] = arraydb_doubleArray5; - tbox::Array arraydb_charArray(2); + std::vector arraydb_charArray(2); arraydb_charArray[0] = arraydb_charArray0; arraydb_charArray[1] = arraydb_charArray1; - tbox::Array arraydb_boxArray(3); + std::vector arraydb_boxArray(3); arraydb_boxArray[0] = arraydb_boxArray0; arraydb_boxArray[1] = arraydb_boxArray1; arraydb_boxArray[2] = arraydb_boxArray2; @@ -133,14 +133,14 @@ void writeTestData( db->putFloat("float_val", db_float_val); db->putInteger("int_val", db_int_val); - arraydb->putComplexArray("ComplexArray", arraydb_dcomplexArray); - arraydb->putDatabaseBoxArray("BoxArray", arraydb_boxArray); - arraydb->putBoolArray("BoolArray", arraydb_boolArray); - arraydb->putIntegerArray("IntArray", arraydb_intArray); - arraydb->putStringArray("StringArray", arraydb_stringArray); - arraydb->putFloatArray("FloatArray", arraydb_floatArray); - arraydb->putDoubleArray("DoubleArray", arraydb_doubleArray); - arraydb->putCharArray("CharArray", arraydb_charArray); + arraydb->putComplexVector("ComplexArray", arraydb_dcomplexArray); + arraydb->putDatabaseBoxVector("BoxArray", arraydb_boxArray); + arraydb->putBoolVector("BoolArray", arraydb_boolArray); + arraydb->putIntegerVector("IntArray", arraydb_intArray); + arraydb->putStringVector("StringArray", arraydb_stringArray); + arraydb->putFloatVector("FloatArray", arraydb_floatArray); + arraydb->putDoubleVector("DoubleArray", arraydb_doubleArray); + arraydb->putCharVector("CharArray", arraydb_charArray); scalardb->putFloat("float1", scalardb_float1); scalardb->putFloat("float2", scalardb_float2); @@ -159,11 +159,11 @@ void writeTestData( namesdb->putDouble("Name-with-dashes", scalardb_full_thisDouble); namesdb->putDouble("Name-with-!@#$%^&*()_+-=", scalardb_full_thisDouble); - std::vector vector_IntVector(2); + std::vector vector_IntVector(2, intVector0); vector_IntVector[0] = intVector1; vector_IntVector[1] = intVector2; - vectordb->putVector("vector_IntVector", vector_IntVector); + vectordb->putObjectVector("vector_IntVector", vector_IntVector); testDatabaseContents(db, "write"); } @@ -232,21 +232,21 @@ void testDatabaseContents( ++number_of_failures; } - tbox::Array dbkeys = db->getAllKeys(); - tbox::Array arraydbkeys = arraydb->getAllKeys(); - tbox::Array scalardbkeys = scalardb->getAllKeys(); - tbox::Array scalardb_emptykeys = scalardb_empty->getAllKeys(); - tbox::Array scalardb_fullkeys = scalardb_full->getAllKeys(); + std::vector dbkeys = db->getAllKeys(); + std::vector arraydbkeys = arraydb->getAllKeys(); + std::vector scalardbkeys = scalardb->getAllKeys(); + std::vector scalardb_emptykeys = scalardb_empty->getAllKeys(); + std::vector scalardb_fullkeys = scalardb_full->getAllKeys(); - int i, nkeys; + size_t i, nkeys; - if (dbkeys.getSize() != 7) { + if (dbkeys.size() != 7) { tbox::perr << "FAILED: - Test #2a-" << tag << ": # `db' keys wrong" << endl; ++number_of_failures; } - nkeys = arraydbkeys.getSize(); - if (arraydbkeys.getSize() != 8) { + nkeys = arraydbkeys.size(); + if (nkeys != 8) { tbox::perr << "FAILED: - Test #2b-" << tag << ": # `arraydb' keys wrong" << "\n\tFound " << nkeys << " keys:" @@ -257,20 +257,20 @@ void testDatabaseContents( } tbox::pout << endl; } - if (scalardbkeys.getSize() != 5) { + if (scalardbkeys.size() != 5) { tbox::perr << "FAILED: - Test #2c-" << tag << ": # `scalardb' keys wrong" << endl; ++number_of_failures; } - if (scalardb_emptykeys.getSize() != 0) { + if (scalardb_emptykeys.size() != 0) { tbox::perr << "FAILED: - Test #2d-" << tag << ": # `scalardb_empty' keys wrong" << endl; ++number_of_failures; } - if (scalardb_fullkeys.getSize() != 8) { + if (scalardb_fullkeys.size() != 8) { tbox::perr << "FAILED: - Test #2e-" << tag << ": `scalardb_full' size is wrong" << endl - << " returned : " << scalardb_fullkeys.getSize() << endl + << " returned : " << scalardb_fullkeys.size() << endl << " expected : " << 8 << endl; ++number_of_failures; } @@ -306,36 +306,36 @@ void testDatabaseContents( * Set array values to test database. */ - tbox::Array arraydb_dcomplexArray(3); + std::vector arraydb_dcomplexArray(3); arraydb_dcomplexArray[0] = arraydb_dcomplexArray0; arraydb_dcomplexArray[1] = arraydb_dcomplexArray1; arraydb_dcomplexArray[2] = arraydb_dcomplexArray2; - tbox::Array arraydb_boolArray(3); + std::vector arraydb_boolArray(3); arraydb_boolArray[0] = arraydb_boolArray0; arraydb_boolArray[1] = arraydb_boolArray1; arraydb_boolArray[2] = arraydb_boolArray2; - tbox::Array arraydb_intArray(5); + std::vector arraydb_intArray(5); arraydb_intArray[0] = arraydb_intArray0; arraydb_intArray[1] = arraydb_intArray1; arraydb_intArray[2] = arraydb_intArray2; arraydb_intArray[3] = arraydb_intArray3; arraydb_intArray[4] = arraydb_intArray4; - tbox::Array arraydb_stringArray(3); + std::vector arraydb_stringArray(3); arraydb_stringArray[0] = arraydb_stringArray0; arraydb_stringArray[1] = arraydb_stringArray1; arraydb_stringArray[2] = arraydb_stringArray2; - tbox::Array arraydb_floatArray(5); + std::vector arraydb_floatArray(5); arraydb_floatArray[0] = arraydb_floatArray0; arraydb_floatArray[1] = arraydb_floatArray1; arraydb_floatArray[2] = arraydb_floatArray2; arraydb_floatArray[3] = arraydb_floatArray3; arraydb_floatArray[4] = arraydb_floatArray4; - tbox::Array arraydb_doubleArray(6); + std::vector arraydb_doubleArray(6); arraydb_doubleArray[0] = arraydb_doubleArray0; arraydb_doubleArray[1] = arraydb_doubleArray1; arraydb_doubleArray[2] = arraydb_doubleArray2; @@ -343,29 +343,28 @@ void testDatabaseContents( arraydb_doubleArray[4] = arraydb_doubleArray4; arraydb_doubleArray[5] = arraydb_doubleArray5; - tbox::Array arraydb_charArray(2); + std::vector arraydb_charArray(2); arraydb_charArray[0] = arraydb_charArray0; arraydb_charArray[1] = arraydb_charArray1; - tbox::Array arraydb_boxArray(3); + std::vector arraydb_boxArray(3); arraydb_boxArray[0] = arraydb_boxArray0; arraydb_boxArray[1] = arraydb_boxArray1; arraydb_boxArray[2] = arraydb_boxArray2; - int tsize = 0; + size_t tsize = 0; - tbox::Array tarraydb_dcomplexArray = - arraydb->getComplexArray("ComplexArray"); - tsize = tarraydb_dcomplexArray.getSize(); - if (tsize != arraydb_dcomplexArray.getSize()) { + std::vector tarraydb_dcomplexArray = + arraydb->getComplexVector("ComplexArray"); + tsize = tarraydb_dcomplexArray.size(); + if (tsize != arraydb_dcomplexArray.size()) { tbox::perr << "FAILED: - Test #4a-" << tag << ": `Array Entries' database" << "\n Returned `ComplexArray' size = " << tsize - << " , Expected = " << arraydb_dcomplexArray.getSize() - << endl; + << " , Expected = " << arraydb_dcomplexArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (tarraydb_dcomplexArray[i] != arraydb_dcomplexArray[i]) { tbox::perr << "FAILED: - Test #4b-" << tag << ": `Array Entries' database" @@ -374,17 +373,16 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_boolArray = - arraydb->getBoolArray("BoolArray"); - tsize = tarraydb_boolArray.getSize(); - if (tsize != arraydb_boolArray.getSize()) { + std::vector tarraydb_boolArray = arraydb->getBoolVector("BoolArray"); + tsize = tarraydb_boolArray.size(); + if (tsize != arraydb_boolArray.size()) { tbox::perr << "FAILED: - Test #4c-" << tag << ": `Array Entries' database" << "\n Returned `BoolArray' size = " << tsize - << " , Expected = " << arraydb_boolArray.getSize() << endl; + << " , Expected = " << arraydb_boolArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (tarraydb_boolArray[i] != arraydb_boolArray[i]) { tbox::perr << "FAILED: - Test #4d-" << tag << ": `Array Entries' database" @@ -394,17 +392,16 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_intArray = - arraydb->getIntegerArray("IntArray"); - tsize = tarraydb_intArray.getSize(); - if (tsize != arraydb_intArray.getSize()) { + std::vector tarraydb_intArray = arraydb->getIntegerVector("IntArray"); + tsize = tarraydb_intArray.size(); + if (tsize != arraydb_intArray.size()) { tbox::perr << "FAILED: - Test #4e-" << tag << ": `Array Entries' database" << "\n Returned `IntArray' size = " << tsize - << " , Expected = " << arraydb_intArray.getSize() << endl; + << " , Expected = " << arraydb_intArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (tarraydb_intArray[i] != arraydb_intArray[i]) { tbox::perr << "FAILED: - Test #4f-" << tag << ": `Array Entries' database" @@ -412,17 +409,17 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_stringArray = - arraydb->getStringArray("StringArray"); - tsize = tarraydb_stringArray.getSize(); - if (tsize != arraydb_stringArray.getSize()) { + std::vector tarraydb_stringArray = + arraydb->getStringVector("StringArray"); + tsize = tarraydb_stringArray.size(); + if (tsize != arraydb_stringArray.size()) { tbox::perr << "FAILED: - Test #4g-" << tag << ": `Array Entries' database" << "\n Returned `StringArray' size = " << tsize << " , Expected = " << arraydb_stringArray[i] << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (tarraydb_stringArray[i] != arraydb_stringArray[i]) { tbox::perr << "FAILED: - Test #4h-" << tag << ": `Array Entries' database" @@ -430,17 +427,17 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_floatArray = - arraydb->getFloatArray("FloatArray"); - tsize = tarraydb_floatArray.getSize(); - if (tsize != arraydb_floatArray.getSize()) { + std::vector tarraydb_floatArray = + arraydb->getFloatVector("FloatArray"); + tsize = tarraydb_floatArray.size(); + if (tsize != arraydb_floatArray.size()) { tbox::perr << "FAILED: - Test #4i-" << tag << ": `Array Entries' database" << "\n Returned `FloatArray' size = " << tsize - << " , Expected = " << arraydb_floatArray.getSize() << endl; + << " , Expected = " << arraydb_floatArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (!tbox::MathUtilities::equalEps(tarraydb_floatArray[i], arraydb_floatArray[i])) { tbox::perr << "FAILED: - Test #4j-" << tag @@ -450,17 +447,17 @@ void testDatabaseContents( } } - tbox::Array tarraydb_doubleArray = - arraydb->getDoubleArray("DoubleArray"); - tsize = tarraydb_doubleArray.getSize(); - if (tsize != arraydb_doubleArray.getSize()) { + std::vector tarraydb_doubleArray = + arraydb->getDoubleVector("DoubleArray"); + tsize = tarraydb_doubleArray.size(); + if (tsize != arraydb_doubleArray.size()) { tbox::perr << "FAILED: - Test #4k.b-" << tag << ": `Array Entries' database" << "\n Returned `DoubleArray' size = " << tsize - << " , Expected = " << arraydb_doubleArray.getSize() << endl; + << " , Expected = " << arraydb_doubleArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (!tbox::MathUtilities::equalEps(tarraydb_doubleArray[i], arraydb_doubleArray[i])) { tbox::perr << "FAILED: - Test #4l-" << tag @@ -469,17 +466,16 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_charArray = - arraydb->getCharArray("CharArray"); - tsize = tarraydb_charArray.getSize(); - if (tsize != arraydb_charArray.getSize()) { + std::vector tarraydb_charArray = arraydb->getCharVector("CharArray"); + tsize = tarraydb_charArray.size(); + if (tsize != arraydb_charArray.size()) { tbox::perr << "FAILED: - Test #4m-" << tag << ": `Array Entries' database" << "\n Returned `CharArray' size = " << tsize - << " , Expected = " << arraydb_charArray.getSize() << endl; + << " , Expected = " << arraydb_charArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { + for (i = 0; i < tsize; ++i) { if (tarraydb_charArray[i] != arraydb_charArray[i]) { tbox::perr << "FAILED: - Test #4l-" << tag << ": `Array Entries' database" @@ -487,18 +483,18 @@ void testDatabaseContents( ++number_of_failures; } } - tbox::Array tarraydb_boxArray = - arraydb->getDatabaseBoxArray("BoxArray"); - tsize = tarraydb_boxArray.getSize(); - if (tsize != arraydb_boxArray.getSize()) { + std::vector tarraydb_boxVector = + arraydb->getDatabaseBoxVector("BoxArray"); + tsize = tarraydb_boxVector.size(); + if (tsize != arraydb_boxArray.size()) { tbox::perr << "FAILED: - Test #4o-" << tag << ": `Array Entries' database" << "\n Returned `BoxArray' size = " << tsize - << " , Expected = " << arraydb_boxArray.getSize() << endl; + << " , Expected = " << arraydb_boxArray.size() << endl; ++number_of_failures; } - for (i = 0; i < tsize; i++) { - if (!(tarraydb_boxArray[i] == arraydb_boxArray[i])) { + for (i = 0; i < tsize; ++i) { + if (!(tarraydb_boxVector[i] == arraydb_boxArray[i])) { tbox::perr << "FAILED: - Test #4p-" << tag << ": `Array Entries' database" << "\n `BoxArray' entry " << i << " incorrect" << endl; @@ -656,10 +652,10 @@ void testDatabaseContents( /* * Tests for array size */ - int actual_size; + size_t actual_size; tsize = arraydb->getArraySize("ComplexArray"); - actual_size = arraydb_dcomplexArray.getSize(); + actual_size = arraydb_dcomplexArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7a-" << tag << ": `getArraySize'" @@ -669,7 +665,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("BoolArray"); - actual_size = arraydb_boolArray.getSize(); + actual_size = arraydb_boolArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7b-" << tag << ": `getArraySize'" @@ -679,7 +675,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("IntArray"); - actual_size = arraydb_intArray.getSize(); + actual_size = arraydb_intArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7c-" << tag << ": `getArraySize'" @@ -689,7 +685,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("StringArray"); - actual_size = arraydb_stringArray.getSize(); + actual_size = arraydb_stringArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7d-" << tag << ": `getArraySize'" @@ -699,7 +695,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("FloatArray"); - actual_size = arraydb_floatArray.getSize(); + actual_size = arraydb_floatArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7e-" << tag << ": `getArraySize'" @@ -709,7 +705,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("DoubleArray"); - actual_size = arraydb_doubleArray.getSize(); + actual_size = arraydb_doubleArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7f-" << tag << ": `getArraySize'" @@ -719,7 +715,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("CharArray"); - actual_size = arraydb_charArray.getSize(); + actual_size = arraydb_charArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7g-" << tag << ": `getArraySize'" @@ -729,7 +725,7 @@ void testDatabaseContents( } tsize = arraydb->getArraySize("BoxArray"); - actual_size = arraydb_boxArray.getSize(); + actual_size = arraydb_boxArray.size(); if (tsize != actual_size) { tbox::perr << "FAILED: - Test #7h-" << tag << ": `getArraySize'" @@ -1170,9 +1166,9 @@ void testDatabaseContents( /* * Tests for reading stl::vector */ - std::vector vector_IntVector(2); + std::vector vector_IntVector(2, intVector0); - vectordb->getVector("vector_IntVector", vector_IntVector); + vectordb->getObjectVector("vector_IntVector", vector_IntVector); if (vector_IntVector[0] != intVector1) { tbox::perr << "FAILED: - Test #16a-" << tag diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.h b/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.h index a964e24d..ac4a298c 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.h +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/database_tests.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Some simple generic database test functions * ************************************************************************/ @@ -11,14 +11,13 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/database_values.h b/base/SAMRAI/SAMRAI/source/test/restartdb/database_values.h index 4daf32f8..3caa2543 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/database_values.h +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/database_values.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Global values for the restart tests * ************************************************************************/ @@ -13,14 +13,13 @@ #include "SAMRAI/hier/IntVector.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -77,5 +76,6 @@ int ilo[3] = { 0, 0, 0 }; int ihi[3] = { 1, 1, 1 }; tbox::DatabaseBox scalardb_full_thisBox(tbox::Dimension(3), ilo, ihi); +hier::IntVector intVector0(tbox::Dimension(2), 0); hier::IntVector intVector1(tbox::Dimension(2), 1); hier::IntVector intVector2(tbox::Dimension(2), 1); diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5.C b/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5.C index 83ae2047..02108f90 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Tests HDF database in SAMRAI * ************************************************************************/ @@ -11,7 +11,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/HDFDatabase.h" @@ -19,7 +18,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -39,13 +38,13 @@ public: virtual ~RestartTester() { } - void putToDatabase( + void putToRestart( const boost::shared_ptr& db) const { writeTestData(db); } - void getFromDatabase() + void getFromRestart() { boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -101,7 +100,7 @@ int main( 0, mpi.getSize()); - hdf_tester.getFromDatabase(); + hdf_tester.getFromRestart(); restart_manager->closeRestartFile(); diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5AppFileOpen.C b/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5AppFileOpen.C index e6dbb538..8f1a2ca0 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5AppFileOpen.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/mainHDF5AppFileOpen.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Tests HDF database in SAMRAI * ************************************************************************/ @@ -11,7 +11,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/HDFDatabase.h" @@ -19,7 +18,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -39,13 +38,13 @@ public: virtual ~RestartTester() { } - void putToDatabase( + void putToRestart( const boost::shared_ptr& db) const { writeTestData(db); } - void getFromDatabase() + void getFromRestart() { boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -131,7 +130,7 @@ int main( restart_manager->setRootDatabase(database); - hdf_tester.getFromDatabase(); + hdf_tester.getFromRestart(); database->close(); diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/mainMemory.C b/base/SAMRAI/SAMRAI/source/test/restartdb/mainMemory.C index 7d3f6f08..76322970 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/mainMemory.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/mainMemory.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Tests Memory database in SAMRAI * ************************************************************************/ @@ -11,7 +11,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/MemoryDatabase.h" @@ -19,7 +18,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -39,13 +38,13 @@ public: virtual ~RestartTester() { } - void putToDatabase( + void putToRestart( const boost::shared_ptr& db) const { writeTestData(db); } - void getFromDatabase() + void getFromRestart() { boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -99,7 +98,7 @@ int main( // In this test just read the database stored in memory that // was just created. - memory_tester.getFromDatabase(); + memory_tester.getFromRestart(); database->close(); diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/mainSilo.C b/base/SAMRAI/SAMRAI/source/test/restartdb/mainSilo.C index 3a04ffde..e5c592e1 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/mainSilo.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/mainSilo.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Tests Silo database in SAMRAI * ************************************************************************/ @@ -11,7 +11,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/SiloDatabase.h" @@ -19,7 +18,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -39,13 +38,13 @@ public: virtual ~RestartTester() { } - void putToDatabase( + void putToRestart( const boost::shared_ptr& db) const { writeTestData(db); } - void getFromDatabase() + void getFromRestart() { boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -114,7 +113,7 @@ int main( restart_manager->setRootDatabase(database); - silo_tester.getFromDatabase(); + silo_tester.getFromRestart(); database->close(); diff --git a/base/SAMRAI/SAMRAI/source/test/restartdb/mainSiloAppFileOpen.C b/base/SAMRAI/SAMRAI/source/test/restartdb/mainSiloAppFileOpen.C index a5659f78..5ba399ea 100644 --- a/base/SAMRAI/SAMRAI/source/test/restartdb/mainSiloAppFileOpen.C +++ b/base/SAMRAI/SAMRAI/source/test/restartdb/mainSiloAppFileOpen.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Tests Silo database in SAMRAI * ************************************************************************/ @@ -11,7 +11,6 @@ #include "SAMRAI/SAMRAI_config.h" #include "SAMRAI/tbox/SAMRAIManager.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/DatabaseBox.h" #include "SAMRAI/tbox/Complex.h" #include "SAMRAI/tbox/SiloDatabase.h" @@ -19,7 +18,7 @@ #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/RestartManager.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -39,13 +38,13 @@ public: virtual ~RestartTester() { } - void putToDatabase( + void putToRestart( const boost::shared_ptr& db) const { writeTestData(db); } - void getFromDatabase() + void getFromRestart() { boost::shared_ptr root_db( tbox::RestartManager::getManager()->getRootDatabase()); @@ -94,7 +93,7 @@ int main( std::string name = "./restart." + tbox::Utilities::processorToString( mpi.getRank()) + ".silo"; DBfile* silo_file = DBCreate( - name.c_str(), DB_CLOBBER, DB_LOCAL, NULL, DB_PDB); + name.c_str(), DB_CLOBBER, DB_LOCAL, 0, DB_PDB); database->attachToFile(silo_file, "/"); restart_manager->setRootDatabase(database); @@ -116,7 +115,7 @@ int main( restart_manager->setRootDatabase(database); - silo_tester.getFromDatabase(); + silo_tester.getFromRestart(); database->close(); restart_manager->setRootDatabase(boost::shared_ptr()); diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.depend index 43aa0dd6..4daad4a3 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -23,12 +23,11 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-runtime-disabled.C \ mpi-interface-tests.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main-runtime-off.o DEPENDS_1:=\ @@ -42,12 +41,11 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-runtime-off.C \ mpi-interface-tests.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=main-runtime-on.o DEPENDS_2:=\ @@ -61,17 +59,15 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-runtime-on.C \ mpi-interface-tests.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=mpi-interface-tests.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -79,17 +75,15 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h mpi-interface-tests.C \ mpi-interface-tests.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} +${FILE_3}: ${DEPENDS_3} diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.in b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.in index 810cca1a..f221e0b6 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the SAMRAI_MPI communication class tests ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/samrai_mpi -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml CPPFLAGS_EXTRA = -DTESTING=1 @@ -27,6 +28,7 @@ TEST_NPROCS = @TEST_NPROCS@ ifeq ($(findstring 2, ${TEST_NPROCS}),2) TEST_NPROCS = 1 endif +QUOTE = \" CXX_OBJS = mpi-interface-tests.o @@ -43,9 +45,25 @@ main-runtime-disabled: main-runtime-disabled.o $(CXX_OBJS) $(LIBSAMRAIDEPEND) $(LIBSAMRAI) $(LDLIBS) -o $@ check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main-runtime-on - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main-runtime-off - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main-runtime-disabled + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main-runtime-on | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main-runtime-off | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main-runtime-disabled | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -56,13 +74,26 @@ check3d: checkcompile: main-runtime-on main-runtime-off main-runtime-disabled checktest: checkcompile - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean: - $(SAMCLEAN) +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main-runtime-on main-runtime-off main-runtime-disabled include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/README b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/README new file mode 100644 index 00000000..9c3d7f96 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/README @@ -0,0 +1,36 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Test of configurations of SAMRAI_MPI class +## +######################################################################### + +This directory tests the configuration options for SAMRAI_MPI, which wraps +the interface to MPI. The following files are contained in this directory. + + main-runtime-disabled.C - tests with MPI linked but not used + main-runtime-on.C - tests with MPI linked and used + main-runtime-off.C - tests with MPI not linked and not used + mpi-interface-tests.C - code that makes SAMRAI_MPI calls + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main-runtime-disabled + make main-runtime-on + make main-runtime-off + + Execution: + serial: + ./main-runtime-disabled + ./main-runtime-on + ./main-runtime-off + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main-runtime-disabled + mpirun -np [mpirun options] ./main-runtime-on + mpirun -np [mpirun options] ./main-runtime-off diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-disabled.C b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-disabled.C index 7085e393..61c5fc33 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-disabled.C +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-disabled.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for SAMRAI_MPI with run-time MPI disabled. * ************************************************************************/ @@ -33,7 +33,7 @@ int main( mpiInterfaceTests(argc, argv, fail_count, runtime_mpi, disable_mpi); if (fail_count == 0) { - tbox::pout << "\nPASSED: " << argv[0] << std::endl; + std::cout << "\nPASSED: " << argv[0] << std::endl; } return fail_count; diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-off.C b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-off.C index 14d28738..c08cf523 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-off.C +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-off.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for SAMRAI_MPI with run-time MPI off. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-on.C b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-on.C index 88b90914..2977cbec 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-on.C +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/main-runtime-on.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program for SAMRAI_MPI with run-time MPI on. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.C b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.C index 2ead731b..b6d39888 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.C +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ @@ -117,20 +117,21 @@ int mpiInterfaceTestParallelPrefixSum( data[1] = 10; // Prefix sum should yield 10*(rank+1) data[2] = mpi.getRank(); // Prefix sum should yield triangular numbers. mpi.parallelPrefixSum(data, 3, 0); - if (data[0] != mpi.getRank()+1) { + if (data[0] != mpi.getRank() + 1) { perr << "parallelPrefixSum test failed." << std::endl; rval += 1; } - if (data[1] != 10*(mpi.getRank()+1)) { + if (data[1] != 10 * (mpi.getRank() + 1)) { perr << "parallelPrefixSum test failed." << std::endl; rval += 1; } - if (data[2] != mpi.getRank()*(mpi.getRank()+1)/2) { + if (data[2] != mpi.getRank() * (mpi.getRank() + 1) / 2) { perr << "parallelPrefixSum test failed." << std::endl; rval += 1; } - for ( int i=0; i<3; ++i ) { - std::cout << mpi.getRank() << ": ParallelPrefixSum[" << i << "] = " << data[i] << std::endl; + for (int i = 0; i < 3; ++i) { + std::cout << mpi.getRank() << ": ParallelPrefixSum[" << i << "] = " << data[i] + << std::endl; } fail_count += rval; diff --git a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.h b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.h index c48404e1..c250dfbd 100644 --- a/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.h +++ b/base/SAMRAI/SAMRAI/source/test/samrai_mpi/mpi-interface-tests.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test multiple SAMRAI interfaces. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.depend index 3629e8e8..d5d7ecb2 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -28,6 +28,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ @@ -35,7 +36,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/DoubleAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IntegerAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -49,7 +49,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -59,14 +58,12 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SparseDataTester.C \ SparseDataTester.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -85,6 +82,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ @@ -92,7 +90,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/pdat/DoubleAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/IntegerAttributeId.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -104,7 +101,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -113,14 +109,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h SparseDataTester.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} FILE_2=sparse_dataops.o DEPENDS_2:=\ @@ -150,6 +144,7 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ @@ -157,12 +152,14 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -175,7 +172,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataVariable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -190,8 +186,8 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -201,14 +197,12 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h sparse_dataops.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SparseData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SparseDataVariable.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.in b/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.in index 985df810..c8aa2668 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for test of index data ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/sparsedata -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml # # For these classes don't turn off implicit template instantiation. @@ -29,6 +30,7 @@ CPPFLAGS_EXTRA= -DTESTING=1 NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" main: main.o SparseDataTester.o $(LIBSAMRAIDEPEND) $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o SparseDataTester.o $(LIBSAMRAI2D) $(LIBSAMRAI) $(LDLIBS) -o $@ @@ -39,22 +41,46 @@ sparse: sparse_dataops.o $(LIBSAMRAIDEPEND) checkcompile: main sparse check: - $(MAKE) check2d + $(MAKE) check2d check2d: main sparse - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./sparse + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./sparse | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check3d: checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - -clean: - $(SAMCLEAN) - @$(RM) *.f main* sparse* + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile + +examples: + +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + @$(RM) main sparse include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/README b/base/SAMRAI/SAMRAI/source/test/sparsedata/README new file mode 100644 index 00000000..6cbd2193 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/README @@ -0,0 +1,32 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI SparseData +## +######################################################################### + +This contains unit tests for SAMRAI's SparseData patch data type. The files +included in this directory are as follows: + + main.C - driver for testing high-level functionality + sparse_dataops.C - driver for testing data manipulation of SparseData + SparseDataTester.[C,h] - Class implementing unit tests + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main - builds executable from main.C + make sparse - builds executable from sparse_dataops.C + + Execution: + serial: + ./main + ./sparse + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main + mpirun -np [mpirun options] ./sparse diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.C b/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.C index 8ae76751..c24d5c85 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.C +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test class for SparseData (implementation). * ************************************************************************/ @@ -76,8 +76,10 @@ SparseDataTester::testConstruction() d_sparse_data->clear(); return passed; + #else return true; + #endif } @@ -96,8 +98,10 @@ SparseDataTester::testCopy() d_sparse_data->clear(); sample->clear(); return success; + #else return true; + #endif } @@ -116,8 +120,10 @@ SparseDataTester::testCopy2() d_sparse_data->clear(); sample->clear(); return success; + #else return true; + #endif } @@ -169,8 +175,10 @@ SparseDataTester::testRemove() } return success; + #else return true; + #endif } @@ -191,7 +199,7 @@ SparseDataTester::testPackStream() pdat::CellOverlap overlap(blist, trans); - int strsize = sample->getDataStreamSize(overlap); + size_t strsize = sample->getDataStreamSize(overlap); SparseDataType::iterator iter(sample.get()); @@ -206,17 +214,39 @@ SparseDataTester::testPackStream() sample2->unpackStream(upStr, overlap); - SparseDataType::iterator iter2(sample2.get()); +// SparseDataType::iterator iter2(sample2.get()); sample2->printNames(tbox::plog); tbox::plog << "Printing sample2" << std::endl; sample2->printAttributes(tbox::plog); - for ( ; iter != sample->end() && iter2 != sample2->end(); ++iter, ++iter2) { +/* + * for ( ; iter != sample->end() && iter2 != sample2->end(); ++iter, ++iter2) { + * tbox::plog << "iter1 node: " << std::endl; + * tbox::plog << iter; + * tbox::plog << "iter2 node: " << std::endl; + * tbox::plog << iter2; + * if (!iter.equals(iter2)) { + * success = false; + * } + * tbox::plog << std::endl; + * } + */ + for ( ; iter != sample->end(); ++iter) { tbox::plog << "iter1 node: " << std::endl; tbox::plog << iter; - tbox::plog << "iter2 node: " << std::endl; - tbox::plog << iter2; - if (!iter.equals(iter2)) { + + bool found = false; + SparseDataType::iterator iter2(sample2.get()); + for ( ; iter2 != sample2->end(); ++iter2) { + if (iter.equals(iter2)) { + found = true; + tbox::plog << "iter2 node: " << std::endl; + tbox::plog << iter2; + break; + } + } + + if (!found) { success = false; } tbox::plog << std::endl; @@ -244,17 +274,24 @@ SparseDataTester::testDatabaseInterface() _fillObject(sample); boost::shared_ptr input_db( new tbox::InputDatabase("input_db")); - sample->putUnregisteredToDatabase(input_db); + sample->putToRestart(input_db); boost::shared_ptr sample2(_createEmptySparseData()); - sample2->getFromDatabase(input_db); + sample2->getFromRestart(input_db); SparseDataType::iterator iter1(sample.get()); - SparseDataType::iterator iter2(sample2.get()); - for ( ; iter1 != sample->end() && iter2 != sample2->end() && success; - ++iter1, ++iter2) { - if (!iter1.equals(iter2)) { + for ( ; iter1 != sample->end(); ++iter1) { + bool found = false; + SparseDataType::iterator iter2(sample2.get()); + for ( ; iter2 != sample2->end(); ++iter2) { + if (iter1.equals(iter2)) { + found = true; + break; + } + } + + if (!found) { success = false; } } @@ -265,7 +302,6 @@ SparseDataTester::testDatabaseInterface() return success; } - void SparseDataTester::testTiming() { @@ -307,11 +343,8 @@ SparseDataTester::testTiming() #endif } - - #ifdef HAVE_BOOST_HEADERS - bool SparseDataTester::_testCopy( boost::shared_ptr src, @@ -332,7 +365,6 @@ SparseDataTester::_testCopy( return success; } - hier::Index SparseDataTester::_getRandomIndex() { @@ -383,7 +415,7 @@ SparseDataTester::_createEmptySparseData() std::vector ikeys; _getIntKeys(ikeys); return boost::shared_ptr( - new SparseDataType(box, ghosts, dkeys, ikeys)); + new SparseDataType(box, ghosts, dkeys, ikeys)); } void diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.h b/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.h index 5b648c44..61dfcc23 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.h +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/SparseDataTester.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test class for SparseData. * ************************************************************************/ @@ -18,7 +18,7 @@ #include "SAMRAI/pdat/CellGeometry.h" #include "SAMRAI/hier/Index.h" -#include +#include "boost/shared_ptr.hpp" #include #include diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/main.C b/base/SAMRAI/SAMRAI/source/test/sparsedata/main.C index 0e763eea..cf82a0a1 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/main.C +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ @@ -27,12 +27,6 @@ int main( SAMRAI_MPI mpi(SAMRAI_MPI::getSAMRAIWorld()); const Dimension dim(2); - // for these tests we allow at most 2 procs -#ifdef DEBUG_CHECK_ASSERTIONS - const int nproc = mpi.getSize(); -#endif - TBOX_ASSERT(nproc < 3); - //if (argc < 2) { // TBOX_ERROR("Usage: " << argv[0] << " [input file]"); //} @@ -63,7 +57,7 @@ int main( tbox::plog << "PASSED: Restart Test" << std::endl; else { tbox::perr << "FAILED: Restart Test" << std::endl; - fail_count++; + ++fail_count; } } else { @@ -72,7 +66,7 @@ int main( tbox::plog << "PASSED: Test 1 (construction)" << std::endl; else { tbox::perr << "FAILED: construction" << std::endl; - fail_count++; + ++fail_count; } success = tester.testAdd(); @@ -80,7 +74,7 @@ int main( tbox::plog << "PASSED: Test 2 addItems" << std::endl; else { tbox::perr << "FAILED: addItems" << std::endl; - fail_count++; + ++fail_count; } success = tester.testRemove(); @@ -88,7 +82,7 @@ int main( tbox::plog << "PASSED: Test 3 removeItems" << std::endl; else { tbox::perr << "FAILED: remove items" << std::endl; - fail_count++; + ++fail_count; } success = tester.testCopy(); @@ -96,7 +90,7 @@ int main( tbox::plog << "PASSED: Test 4: copy" << std::endl; else { tbox::perr << "FAILED: copy items" << std::endl; - fail_count++; + ++fail_count; } success = tester.testCopy2(); @@ -104,7 +98,7 @@ int main( tbox::plog << "PASSED: Test 5: copy2 " << std::endl; else { tbox::perr << "FAILED: copy2 " << std::endl; - fail_count++; + ++fail_count; } success = tester.testPackStream(); @@ -112,7 +106,7 @@ int main( tbox::plog << "PASSED: Test 6: packStream" << std::endl; else { tbox::perr << "FAILED: packStream " << std::endl; - fail_count++; + ++fail_count; } success = tester.testDatabaseInterface(); @@ -120,7 +114,7 @@ int main( tbox::plog << "PASSED: Test 7: database interface" << std::endl; else { tbox::perr << "FAILED: database interface " << std::endl; - fail_count++; + ++fail_count; } tester.testTiming(); diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/sparse_dataops.C b/base/SAMRAI/SAMRAI/source/test/sparsedata/sparse_dataops.C index 80d300e2..407beb0c 100644 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/sparse_dataops.C +++ b/base/SAMRAI/SAMRAI/source/test/sparsedata/sparse_dataops.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test index data operations * ************************************************************************/ @@ -25,6 +25,7 @@ #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/InputDatabase.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "SAMRAI/hier/VariableDatabase.h" #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/tbox/RestartManager.h" @@ -32,7 +33,7 @@ #include "SAMRAI/pdat/SparseData.h" #include "SAMRAI/pdat/SparseDataVariable.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -87,7 +88,6 @@ int main( // Note: For these simple tests we allow at most 2 processors. tbox::SAMRAI_MPI mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); const int nproc = mpi.getSize(); - TBOX_ASSERT(nproc < 3); // Currently this test only works for 2 dimensions. const tbox::Dimension dim(2); @@ -116,7 +116,6 @@ int main( ********************************************************************/ hier::BoxContainer coarse_domain; hier::BoxContainer fine_domain; - hier::IntVector ratio(dim, 2); boost::shared_ptr geometry( getGeometry(coarse_domain, fine_domain, dim)); @@ -124,37 +123,41 @@ int main( boost::shared_ptr hierarchy( new hier::PatchHierarchy("PatchHierarchy", geometry)); + hier::IntVector ratio(dim, 2); hierarchy->setMaxNumberOfLevels(2); hierarchy->setRatioToCoarserLevel(ratio, 1); const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_domain.size(); - hier::BoxLevel layer0(hier::IntVector(dim, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_domain_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_domain_itr) { + hier::BoxContainer::iterator coarse_domain_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_domain_itr) { if (nproc > 1) { - if (ib == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_domain_itr, - hier::LocalId(ib), layer0.getMPI().getRank())); + if (ib == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_domain_itr, + hier::LocalId(ib), layer0->getMPI().getRank())); } } else { - layer0.addBox(hier::Box(*coarse_domain_itr, + layer0->addBox(hier::Box(*coarse_domain_itr, hier::LocalId(ib), 0)); } } - hier::BoxContainer::iterator fine_domain_itr(fine_domain); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_domain_itr) { + hier::BoxContainer::iterator fine_domain_itr = fine_domain.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_domain_itr) { if (nproc > 1) { - if (ib == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_domain_itr, - hier::LocalId(ib), layer1.getMPI().getRank())); + if (ib == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_domain_itr, + hier::LocalId(ib), layer1->getMPI().getRank())); } } else { - layer1.addBox(hier::Box(*fine_domain_itr, + layer1->addBox(hier::Box(*fine_domain_itr, hier::LocalId(ib), 0)); } } @@ -168,8 +171,10 @@ int main( */ hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); + hier::PatchDataRestartManager* pdrm = + hier::PatchDataRestartManager::getManager(); boost::shared_ptr cxt( - variable_db->getContext("dummy")); + variable_db->getContext("dummy")); const hier::IntVector no_ghosts(dim, 0); typedef pdat::SparseData LSparseData; @@ -191,8 +196,8 @@ int main( data2, cxt, no_ghosts); // set us up for restart. - variable_db->registerPatchDataForRestart(data_id1); - variable_db->registerPatchDataForRestart(data_id2); + pdrm->registerPatchDataForRestart(data_id1); + pdrm->registerPatchDataForRestart(data_id2); for (int i = 0; i < 2; ++i) { // allocate "sample" data @@ -203,7 +208,7 @@ int main( /* * Loop over hierarchy levels and populate data. */ - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); @@ -214,15 +219,17 @@ int main( // access sample data from patch boost::shared_ptr sample1( - patch->getPatchData(data_id1), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id1))); boost::shared_ptr sample2( - patch->getPatchData(data_id2), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id2))); + TBOX_ASSERT(sample1); + TBOX_ASSERT(sample2); // add items to the sparse data objects. - pdat::CellIterator ic(patch->getBox(), true); - pdat::CellIterator icend(patch->getBox(), false); + pdat::CellIterator ic(pdat::CellGeometry::begin(patch->getBox())); + pdat::CellIterator icend(pdat::CellGeometry::end(patch->getBox())); for ( ; ic != icend; ++ic) { const hier::Index* idx = &(*ic); LSparseData::iterator iter1 = sample1->registerIndex(*idx); @@ -340,7 +347,7 @@ checkIterators( int num_failures(0); #ifdef HAVE_BOOST_HEADERS typedef pdat::SparseData LSparseData; - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -348,19 +355,20 @@ checkIterators( const boost::shared_ptr& patch = *ip; boost::shared_ptr sample( - patch->getPatchData(data_id1), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id1))); + TBOX_ASSERT(sample); // Test #1a: check empty. This should be false. if (sample->empty()) { - num_failures++; + ++num_failures; tbox::perr << "FAILED: - sparse data structure reports empty. " << std::endl; } - pdat::CellIterator ic(patch->getBox(), true); - pdat::CellIterator icend(patch->getBox(), false); + pdat::CellIterator ic(pdat::CellGeometry::begin(patch->getBox())); + pdat::CellIterator icend(pdat::CellGeometry::end(patch->getBox())); for ( ; ic != icend; ++ic) { const hier::Index& idx = *ic; LSparseData::AttributeIterator it = sample->begin(idx); @@ -369,17 +377,17 @@ checkIterators( // check element access. for (int i = 0; i < DSIZE; ++i) { if (it[pdat::DoubleAttributeId(i)] != i) { - num_failures++; + ++num_failures; } } for (int j = 0; j < ISIZE; ++j) { if (it[pdat::IntegerAttributeId(j)] != j) { - num_failures++; + ++num_failures; } } } // for (; it != ... (attribute iterator) - } // for (; ic; ic++) ... (cell iterator) + } // for (; ic; ++ic) ... (cell iterator) } // for (hier::PatchLevel::iterator... } // hierarchy iteration #endif @@ -404,24 +412,27 @@ bool checkCopyOps( #ifdef HAVE_BOOST_HEADERS typedef pdat::SparseData LSparseData; - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr control( - patch->getPatchData(data_id1), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id1))); boost::shared_ptr copiedTo( - patch->getPatchData(data_id1), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id1))); boost::shared_ptr copiedFrom( - patch->getPatchData(data_id2), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id2))); + TBOX_ASSERT(control); + TBOX_ASSERT(copiedTo); + TBOX_ASSERT(copiedFrom); int edit = copiedTo->size() / 2; LSparseData::iterator ct_it(copiedTo.get()); - for ( ; ct_it != copiedTo->end() && edit > 0; ++ct_it, edit--) { + for ( ; ct_it != copiedTo->end() && edit > 0; ++ct_it, --edit) { } while (ct_it != copiedTo->end()) { @@ -478,7 +489,7 @@ bool checkRemoveOps( #ifdef HAVE_BOOST_HEADERS typedef pdat::SparseData LSparseData; int num_failures(0); - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); @@ -486,8 +497,9 @@ bool checkRemoveOps( const boost::shared_ptr& patch = *ip; boost::shared_ptr sample( - patch->getPatchData(data_id1), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchData(data_id1))); + TBOX_ASSERT(sample); LSparseData::iterator it; int stop = sample->size() / 2; @@ -513,7 +525,7 @@ bool checkRemoveOps( sample->clear(); if (!sample->empty()) { - num_failures++; + ++num_failures; remove_passed = false; tbox::perr << "sample size is " << sample->size() << std::endl; } @@ -548,11 +560,6 @@ getGeometry( hier::Box fine0(hier::Index(4, 4), hier::Index(7, 7), hier::BlockId(0)); hier::Box fine1(hier::Index(8, 4), hier::Index(13, 7), hier::BlockId(0)); - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - fine0.initialize(fine0, hier::LocalId(0), 0); - fine1.initialize(fine1, hier::LocalId(1), 0); - coarse_domain.pushBack(coarse0); coarse_domain.pushBack(coarse1); fine_domain.pushBack(fine0); diff --git a/base/SAMRAI/SAMRAI/source/test/sparsedata/test_inputs/test_restart.2d.input b/base/SAMRAI/SAMRAI/source/test/sparsedata/test_inputs/test_restart.2d.input deleted file mode 100644 index 7da11e34..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sparsedata/test_inputs/test_restart.2d.input +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI LinAdv example problem - * - ************************************************************************/ - -GlobalInputs { - call_abort_in_serial_instead_of_exit = FALSE -} - -Main { - dim = 2 - base_name = "test_restart.2d" -// log file parameters - log_all_nodes = TRUE - -// visualization dump parameters - viz_dump_interval = 0 // zero to turn off - viz_dump_dirname = "viz-test-2d-re" - -// restart dump parameters - restart_interval = 1 // zero to turn off - - plotting_interval = 0 - -} - -CartesianGeometry{ - domain_boxes = [(0,0),(9,2)], [(0,3), (9,4)] - - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e0 , 0.e5 // upper end of computational domain. - - periodic_dimension = 1,0 -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - } -} diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.C b/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.C index 6f657e98..beaa0069 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.C +++ b/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: * ************************************************************************/ @@ -12,7 +12,6 @@ #if defined(HAVE_SUNDIALS) && defined(HAVE_HYPRE) -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/BoundaryBox.h" #include "SAMRAI/geom/CartesianPatchGeometry.h" #include "SAMRAI/pdat/CellData.h" @@ -59,7 +58,7 @@ #endif extern "C" { -void F77_FUNC(comprhs2d, COMPRHS2D) ( +void SAMRAI_F77_FUNC(comprhs2d, COMPRHS2D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -68,14 +67,14 @@ void F77_FUNC(comprhs2d, COMPRHS2D) ( const double *, const double *, double *); #ifdef USE_FAC_PRECONDITIONER -void F77_FUNC(setneufluxvalues2d, SETNEUFLUXVALUES2D) ( +void SAMRAI_F77_FUNC(setneufluxvalues2d, SETNEUFLUXVALUES2D) ( const int&, const int&, const int&, const int&, const int *, const double *, int *, int *, int *, int *, double *, double *, double *, double *); #endif -void F77_FUNC(comprhs3d, COMPRHS3D) ( +void SAMRAI_F77_FUNC(comprhs3d, COMPRHS3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -85,7 +84,7 @@ void F77_FUNC(comprhs3d, COMPRHS3D) ( const double *, const double *, const double *, double *); #ifdef USE_FAC_PRECONDITIONER -void F77_FUNC(setneufluxvalues3d, SETNEUFLUXVALUES3D) ( +void SAMRAI_F77_FUNC(setneufluxvalues3d, SETNEUFLUXVALUES3D) ( const int&, const int&, const int&, const int&, const int&, const int&, @@ -103,15 +102,16 @@ void F77_FUNC(setneufluxvalues3d, SETNEUFLUXVALUES3D) ( CVODEModel::CVODEModel( const string& object_name, - const tbox::Dimension& dim, + const Dimension& dim, + boost::shared_ptr fac_solver, boost::shared_ptr input_db, boost::shared_ptr grid_geom): - RefinePatchStrategy(dim), - CoarsenPatchStrategy(dim), + RefinePatchStrategy(), + CoarsenPatchStrategy(), d_object_name(object_name), d_dim(dim), d_soln_var(new CellVariable(dim, "soln", 1)), - d_FAC_solver(dim, object_name + ":FAC solver"), + d_FAC_solver(fac_solver), d_grid_geometry(grid_geom) { /* @@ -129,7 +129,8 @@ CVODEModel::CVODEModel( d_scr_cxt, IntVector(d_dim, 1)); #ifdef USE_FAC_PRECONDITIONER - d_diff_var.reset(new SideVariable(d_dim, "diffusion", 1)); + d_diff_var.reset(new SideVariable(d_dim, "diffusion", + hier::IntVector::getOne(d_dim), 1)); d_diff_id = variable_db->registerVariableAndContext(d_diff_var, d_cur_cxt, @@ -138,10 +139,6 @@ CVODEModel::CVODEModel( /* * Set default values for preconditioner. */ - d_max_fac_its = 1; - d_fac_tol = 1.0e-40; - d_max_hypre_its = 1; - d_hypre_tol = 1.0e-40; d_use_neumann_bcs = false; d_current_soln_time = 0.; @@ -163,46 +160,45 @@ CVODEModel::CVODEModel( /* * Boundary condition initialization. */ - if (d_dim == tbox::Dimension(2)) { - d_scalar_bdry_edge_conds.resizeArray(NUM_2D_EDGES); - for (int ei = 0; ei < NUM_2D_EDGES; ei++) { + if (d_dim == Dimension(2)) { + d_scalar_bdry_edge_conds.resize(NUM_2D_EDGES); + for (int ei = 0; ei < NUM_2D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_2D_NODES); - d_node_bdry_edge.resizeArray(NUM_2D_NODES); + d_scalar_bdry_node_conds.resize(NUM_2D_NODES); + d_node_bdry_edge.resize(NUM_2D_NODES); - for (int ni = 0; ni < NUM_2D_NODES; ni++) { + for (int ni = 0; ni < NUM_2D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_edge[ni] = BOGUS_BDRY_DATA; } - d_bdry_edge_val.resizeArray(NUM_2D_EDGES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds.resizeArray(NUM_3D_FACES); - for (int fi = 0; fi < NUM_3D_FACES; fi++) { + d_bdry_edge_val.resize(NUM_2D_EDGES); + MathUtilities::setVectorToSignalingNaN(d_bdry_edge_val); + } else if (d_dim == Dimension(3)) { + d_scalar_bdry_face_conds.resize(NUM_3D_FACES); + for (int fi = 0; fi < NUM_3D_FACES; ++fi) { d_scalar_bdry_face_conds[fi] = BOGUS_BDRY_DATA; } - d_scalar_bdry_edge_conds.resizeArray(NUM_3D_EDGES); - d_edge_bdry_face.resizeArray(NUM_3D_EDGES); - for (int ei = 0; ei < NUM_3D_EDGES; ei++) { + d_scalar_bdry_edge_conds.resize(NUM_3D_EDGES); + d_edge_bdry_face.resize(NUM_3D_EDGES); + for (int ei = 0; ei < NUM_3D_EDGES; ++ei) { d_scalar_bdry_edge_conds[ei] = BOGUS_BDRY_DATA; d_edge_bdry_face[ei] = BOGUS_BDRY_DATA; } - d_scalar_bdry_node_conds.resizeArray(NUM_3D_NODES); - d_node_bdry_face.resizeArray(NUM_3D_NODES); + d_scalar_bdry_node_conds.resize(NUM_3D_NODES); + d_node_bdry_face.resize(NUM_3D_NODES); - for (int ni = 0; ni < NUM_3D_NODES; ni++) { + for (int ni = 0; ni < NUM_3D_NODES; ++ni) { d_scalar_bdry_node_conds[ni] = BOGUS_BDRY_DATA; d_node_bdry_face[ni] = BOGUS_BDRY_DATA; } - d_bdry_face_val.resizeArray(NUM_3D_FACES); - tbox::MathUtilities::setArrayToSignalingNaN(d_bdry_face_val); + d_bdry_face_val.resize(NUM_3D_FACES); + MathUtilities::setVectorToSignalingNaN(d_bdry_face_val); } /* @@ -236,15 +232,14 @@ CVODEModel::CVODEModel( * Set boundary types for FAC preconditioner. * bdry_types holds a flag where 0 = dirichlet, 1 = neumann */ - if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + if (d_dim == Dimension(2)) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { d_bdry_types[i] = 0; if (d_scalar_bdry_edge_conds[i] == BdryCond::DIRICHLET) d_bdry_types[i] = 0; if (d_scalar_bdry_edge_conds[i] == BdryCond::NEUMANN) d_bdry_types[i] = 1; } - } - if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + } else if (d_dim == Dimension(3)) { + for (int i = 0; i < NUM_3D_FACES; ++i) { d_bdry_types[i] = 0; if (d_scalar_bdry_face_conds[i] == BdryCond::DIRICHLET) d_bdry_types[i] = 0; if (d_scalar_bdry_face_conds[i] == BdryCond::NEUMANN) d_bdry_types[i] = 1; @@ -257,14 +252,14 @@ CVODEModel::CVODEModel( * quantity in this problem cannot have reflective boundary conditions * so we reset them to BdryCond::FLOW. */ - if (d_dim == tbox::Dimension(2)) { - for (int i = 0; i < NUM_2D_EDGES; i++) { + if (d_dim == Dimension(2)) { + for (int i = 0; i < NUM_2D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_2D_NODES; i++) { + for (int i = 0; i < NUM_2D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -278,15 +273,14 @@ CVODEModel::CVODEModel( i, d_scalar_bdry_node_conds[i]); } } - } - if (d_dim == tbox::Dimension(3)) { - for (int i = 0; i < NUM_3D_FACES; i++) { + } else if (d_dim == Dimension(3)) { + for (int i = 0; i < NUM_3D_FACES; ++i) { if (d_scalar_bdry_face_conds[i] == BdryCond::REFLECT) { d_scalar_bdry_face_conds[i] = BdryCond::FLOW; } } - for (int i = 0; i < NUM_3D_EDGES; i++) { + for (int i = 0; i < NUM_3D_EDGES; ++i) { if (d_scalar_bdry_edge_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_edge_conds[i] = BdryCond::XFLOW; } @@ -304,7 +298,7 @@ CVODEModel::CVODEModel( } } - for (int i = 0; i < NUM_3D_NODES; i++) { + for (int i = 0; i < NUM_3D_NODES; ++i) { if (d_scalar_bdry_node_conds[i] == BdryCond::XREFLECT) { d_scalar_bdry_node_conds[i] = BdryCond::XFLOW; } @@ -419,8 +413,9 @@ CVODEModel::applyGradientDetector( const boost::shared_ptr& patch = *p; boost::shared_ptr > tag_data( - patch->getPatchData(tag_index), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(tag_index))); + TBOX_ASSERT(tag_data); // dumb implementation that tags all cells. tag_data->fillAll(TRUE); @@ -444,15 +439,14 @@ CVODEModel::setPhysicalBoundaryConditions( NULL_USE(time); boost::shared_ptr > soln_data( - patch.getPatchData(d_soln_scr_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch.getPatchData(d_soln_scr_id))); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(soln_data); -#endif + IntVector ghost_cells(soln_data->getGhostCellWidth()); - if (d_dim == tbox::Dimension(2)) { + if (d_dim == Dimension(2)) { /* * Set boundary conditions for cells corresponding to patch edges. @@ -475,9 +469,7 @@ CVODEModel::setPhysicalBoundaryConditions( d_scalar_bdry_node_conds, d_bdry_edge_val); - } - - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == Dimension(3)) { /* * Set boundary conditions for cells corresponding to patch faces. @@ -620,16 +612,17 @@ CVODEModel::evaluateRHSFunction( * 4) Use the refine schedule to fill data on fine level. */ boost::shared_ptr bdry_fill_alg( - new RefineAlgorithm(d_dim)); + new RefineAlgorithm()); boost::shared_ptr refine_op(d_grid_geometry-> - lookupRefineOperator(d_soln_var, "CONSERVATIVE_LINEAR_REFINE")); + lookupRefineOperator(d_soln_var, + "CONSERVATIVE_LINEAR_REFINE")); bdry_fill_alg->registerRefine(d_soln_scr_id, // dest y_samvect-> getComponentDescriptorIndex(0), // src d_soln_scr_id, // scratch refine_op); - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); if (!level->checkAllocated(d_soln_scr_id)) { level->allocatePatchData(d_soln_scr_id); @@ -649,28 +642,32 @@ CVODEModel::evaluateRHSFunction( /* * Step through the levels and compute rhs */ - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > y( - patch->getPatchData(d_soln_scr_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_soln_scr_id))); boost::shared_ptr > diff( - patch->getPatchData(d_diff_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_diff_id))); boost::shared_ptr > rhs( - patch->getPatchData(y_dot_samvect->getComponentDescriptorIndex(0)), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(y_dot_samvect->getComponentDescriptorIndex(0)))); + TBOX_ASSERT(y); + TBOX_ASSERT(diff); + TBOX_ASSERT(rhs); const Index ifirst(patch->getBox().lower()); const Index ilast(patch->getBox().upper()); const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( + patch->getPatchGeometry())); + TBOX_ASSERT(patch_geom); const double* dx = patch_geom->getDx(); IntVector ghost_cells(y->getGhostCellWidth()); @@ -678,8 +675,8 @@ CVODEModel::evaluateRHSFunction( /* * 1 eqn radiation diffusion */ - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(comprhs2d, COMPRHS2D) ( + if (d_dim == Dimension(2)) { + SAMRAI_F77_FUNC(comprhs2d, COMPRHS2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ghost_cells(0), ghost_cells(1), @@ -688,8 +685,8 @@ CVODEModel::evaluateRHSFunction( diff->getPointer(0), diff->getPointer(1), rhs->getPointer()); - } else if (d_dim == tbox::Dimension(3)) { - F77_FUNC(comprhs3d, COMPRHS3D) ( + } else if (d_dim == Dimension(3)) { + SAMRAI_F77_FUNC(comprhs3d, COMPRHS3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), @@ -709,7 +706,7 @@ CVODEModel::evaluateRHSFunction( /* * Deallocate scratch space. */ - for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (int ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(d_soln_scr_id); } @@ -718,7 +715,7 @@ CVODEModel::evaluateRHSFunction( * evaluations. */ d_current_soln_time = time; - d_number_rhs_eval++; + ++d_number_rhs_eval; return 0; } @@ -746,9 +743,9 @@ int CVODEModel::CVSpgmrPrecondSet( SundialsAbstractVector* vtemp3) { #ifndef USE_FAC_PRECONDITIONER - NULL_USE(t); - NULL_USE(y); - NULL_USE(gamma); + NULL_USE(t); + NULL_USE(y); + NULL_USE(gamma); #endif NULL_USE(fy); NULL_USE(jok); @@ -773,9 +770,10 @@ int CVODEModel::CVSpgmrPrecondSet( /* * Construct refine algorithm to fill boundaries of solution vector */ - RefineAlgorithm fill_soln_vector_bounds(d_dim); + RefineAlgorithm fill_soln_vector_bounds; boost::shared_ptr refine_op(d_grid_geometry-> - lookupRefineOperator(d_soln_var, "CONSERVATIVE_LINEAR_REFINE")); + lookupRefineOperator(d_soln_var, + "CONSERVATIVE_LINEAR_REFINE")); fill_soln_vector_bounds.registerRefine(d_soln_scr_id, y_samvect->getComponentDescriptorIndex(0), d_soln_scr_id, @@ -787,7 +785,8 @@ int CVODEModel::CVSpgmrPrecondSet( */ CoarsenAlgorithm fill_soln_interior_on_coarser(d_dim); boost::shared_ptr coarsen_op(d_grid_geometry-> - lookupCoarsenOperator(d_soln_var, "CONSERVATIVE_COARSEN")); + lookupCoarsenOperator(d_soln_var, + "CONSERVATIVE_COARSEN")); fill_soln_interior_on_coarser.registerCoarsen(y_indx, y_indx, @@ -798,7 +797,7 @@ int CVODEModel::CVSpgmrPrecondSet( */ for (int amr_level = hierarchy->getFinestLevelNumber(); amr_level >= 0; - amr_level--) { + --amr_level) { boost::shared_ptr level( hierarchy->getPatchLevel(amr_level)); @@ -836,15 +835,13 @@ int CVODEModel::CVSpgmrPrecondSet( const Index ilast(patch->getBox().upper()); boost::shared_ptr > diffusion( - patch->getPatchData(d_diff_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_diff_id))); + TBOX_ASSERT(diffusion); diffusion->fillAll(1.0); -#ifdef DEBUG_CHECK_ASSERTIONS - double current_dt = t - d_current_soln_time; - TBOX_ASSERT(current_dt >= 0.); -#endif + TBOX_ASSERT((t - d_current_soln_time) >= 0.); /* * Set Neumann fluxes and flag array (if desired) @@ -852,11 +849,13 @@ int CVODEModel::CVSpgmrPrecondSet( if (d_use_neumann_bcs) { boost::shared_ptr > flag_data( - patch->getPatchData(d_flag_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_flag_id))); boost::shared_ptr > neuf_data( - patch->getPatchData(d_neuf_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_neuf_id))); + TBOX_ASSERT(flag_data); + TBOX_ASSERT(neuf_data); /* * Outerface data access: @@ -865,12 +864,12 @@ int CVODEModel::CVSpgmrPrecondSet( * and face specifies lower or upper (0,1 respectively) */ - if (d_dim == tbox::Dimension(2)) { - F77_FUNC(setneufluxvalues2d, SETNEUFLUXVALUES2D) ( + if (d_dim == Dimension(2)) { + SAMRAI_F77_FUNC(setneufluxvalues2d, SETNEUFLUXVALUES2D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), d_bdry_types, - d_bdry_edge_val.getPointer(), + &d_bdry_edge_val[0], flag_data->getPointer(0, 0), // x lower flag_data->getPointer(0, 1), // x upper flag_data->getPointer(1, 0), // y lower @@ -879,14 +878,13 @@ int CVODEModel::CVSpgmrPrecondSet( neuf_data->getPointer(0, 1), // x upper neuf_data->getPointer(1, 0), // y lower neuf_data->getPointer(1, 1)); // y upper - } - if (d_dim == tbox::Dimension(3)) { - F77_FUNC(setneufluxvalues3d, SETNEUFLUXVALUES3D) ( + } else if (d_dim == Dimension(3)) { + SAMRAI_F77_FUNC(setneufluxvalues3d, SETNEUFLUXVALUES3D) ( ifirst(0), ilast(0), ifirst(1), ilast(1), ifirst(2), ilast(2), d_bdry_types, - d_bdry_face_val.getPointer(), + &d_bdry_face_val[0], flag_data->getPointer(0, 0), // x lower flag_data->getPointer(0, 1), // x upper flag_data->getPointer(1, 0), // y lower @@ -908,36 +906,23 @@ int CVODEModel::CVSpgmrPrecondSet( } // level loop - /* - * Setup FAC preconditioner - */ - - /* Construct a Poisson solver for a level. The use_smg flag - * is used to select which of HYPRE's linear solver algorithms to use - * if true, the semicoarsening multigrid algorithm is used, and if - * false, the ``PF'' multigrid algorithm is used. - */ - bool use_smg = false; - - d_FAC_solver.setUseSMG(use_smg); - /* * Set boundaries. The "bdry_types" array holds a set of integers * where 0 = dirichlet and 1 = neumann boundary conditions. */ if (d_use_neumann_bcs) { - d_FAC_solver.setBoundaries("Mixed", d_neuf_id, d_flag_id, d_bdry_types); + d_FAC_solver->setBoundaries("Mixed", d_neuf_id, d_flag_id, d_bdry_types); } else { - d_FAC_solver.setBoundaries("Dirichlet"); + d_FAC_solver->setBoundaries("Dirichlet"); } - d_FAC_solver.setCConstant(1.0 / gamma); - d_FAC_solver.setDPatchDataId(d_diff_id); + d_FAC_solver->setCConstant(1.0 / gamma); + d_FAC_solver->setDPatchDataId(d_diff_id); /* * increment counter for number of precond setup calls */ - d_number_precond_setup++; + ++d_number_precond_setup; #endif /* @@ -1009,9 +994,10 @@ int CVODEModel::CVSpgmrPrecondSolve( * Construct a communication schedule which will fill ghosts of * soln_scratch with z vector data (z -> soln_scratch). */ - RefineAlgorithm fill_z_vector_bounds(d_dim); + RefineAlgorithm fill_z_vector_bounds; boost::shared_ptr refine_op(d_grid_geometry-> - lookupRefineOperator(d_soln_var, "CONSERVATIVE_LINEAR_REFINE")); + lookupRefineOperator(d_soln_var, + "CONSERVATIVE_LINEAR_REFINE")); fill_z_vector_bounds.registerRefine(d_soln_scr_id, z_indx, d_soln_scr_id, @@ -1022,7 +1008,7 @@ int CVODEModel::CVSpgmrPrecondSolve( * solution scratch context. */ int ln; - for (ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); if (!level->checkAllocated(d_soln_scr_id)) { @@ -1034,8 +1020,9 @@ int CVODEModel::CVSpgmrPrecondSolve( const boost::shared_ptr& patch = *p; boost::shared_ptr > z_data( - patch->getPatchData(z_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(z_indx))); + TBOX_ASSERT(z_data); /* * Set initial guess for z here. @@ -1047,16 +1034,18 @@ int CVODEModel::CVSpgmrPrecondSolve( */ PatchCellDataOpsReal math_ops; boost::shared_ptr > r_data( - patch->getPatchData(r_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(r_indx))); + TBOX_ASSERT(r_data); math_ops.scale(r_data, 1.0 / gamma, r_data, r_data->getBox()); /* * Copy interior data from z vector to soln_scratch */ boost::shared_ptr > z_scr_data( - patch->getPatchData(d_soln_scr_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_soln_scr_id))); + TBOX_ASSERT(z_scr_data); z_scr_data->copy(*z_data); } @@ -1099,8 +1088,6 @@ int CVODEModel::CVSpgmrPrecondSolve( * error. */ - d_FAC_solver.setMaxCycles(d_max_fac_its); - d_FAC_solver.setResidualTolerance(d_fac_tol); const int coarsest_solve_ln = 0; const int finest_solve_ln = 0; /* @@ -1108,7 +1095,7 @@ int CVODEModel::CVSpgmrPrecondSolve( * When upgrading to the new FAC solver from the old, I noticed * that the old solver only solved on level 0. BTNG. */ - bool converge = d_FAC_solver.solveSystem(d_soln_scr_id, + bool converge = d_FAC_solver->solveSystem(d_soln_scr_id, r_indx, hierarchy, coarsest_solve_ln, @@ -1116,9 +1103,9 @@ int CVODEModel::CVSpgmrPrecondSolve( if (d_print_solver_info) { double avg_convergence, final_convergence; - d_FAC_solver.getConvergenceFactors(avg_convergence, final_convergence); + d_FAC_solver->getConvergenceFactors(avg_convergence, final_convergence); pout << " \t\t\tFinal Residual Norm: " - << d_FAC_solver.getResidualNorm() << endl; + << d_FAC_solver->getResidualNorm() << endl; pout << " \t\t\tFinal Convergence Error: " << final_convergence << endl; pout << " \t\t\tFinal Convergence Rate: " @@ -1132,18 +1119,20 @@ int CVODEModel::CVSpgmrPrecondSolve( * into the z vector. * ******************************************************************/ - for (ln = hierarchy->getFinestLevelNumber(); ln >= 0; ln--) { + for (ln = hierarchy->getFinestLevelNumber(); ln >= 0; --ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); for (PatchLevel::iterator p(level->begin()); p != level->end(); ++p) { const boost::shared_ptr& patch = *p; boost::shared_ptr > soln_scratch( - patch->getPatchData(d_soln_scr_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_soln_scr_id))); boost::shared_ptr > z( - patch->getPatchData(z_indx), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(z_indx))); + TBOX_ASSERT(soln_scratch); + TBOX_ASSERT(z); z->copy(*soln_scratch); } @@ -1152,11 +1141,11 @@ int CVODEModel::CVSpgmrPrecondSolve( if (d_print_solver_info) { double avg_convergence, final_convergence; - d_FAC_solver.getConvergenceFactors(avg_convergence, final_convergence); + d_FAC_solver->getConvergenceFactors(avg_convergence, final_convergence); pout << "\t\tAfter FAC Solve (Az=r): " << "\n \t\t\tz_l2norm = " << z_samvect->L2Norm() << "\n \t\t\tz_maxnorm = " << z_samvect->maxNorm() - << "\n \t\t\tResidual Norm: " << d_FAC_solver.getResidualNorm() + << "\n \t\t\tResidual Norm: " << d_FAC_solver->getResidualNorm() << "\n \t\t\tConvergence Error: " << final_convergence << endl; } @@ -1168,7 +1157,7 @@ int CVODEModel::CVSpgmrPrecondSolve( /* * Increment counter for number of precond solves */ - d_number_precond_solve++; + ++d_number_precond_solve; return ret_val; @@ -1213,11 +1202,9 @@ CVODEModel::setupSolutionVector( const int nlevels = hierarchy->getNumberOfLevels(); - for (int ln = 0; ln < nlevels; ln++) { + for (int ln = 0; ln < nlevels; ++ln) { boost::shared_ptr level(hierarchy->getPatchLevel(ln)); -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(level); -#endif level->allocatePatchData(d_diff_id); if (d_use_neumann_bcs) { level->allocatePatchData(d_flag_id); @@ -1264,8 +1251,9 @@ CVODEModel::setInitialConditions( * Set initial conditions for y */ boost::shared_ptr > y_init( - soln_init_samvect->getComponentPatchData(cn, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + soln_init_samvect->getComponentPatchData(cn, *patch))); + TBOX_ASSERT(y_init); y_init->fillAll(d_initial_value); /* @@ -1275,8 +1263,9 @@ CVODEModel::setInitialConditions( * approach and set it to 1. */ boost::shared_ptr > diffusion( - patch->getPatchData(d_diff_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, PatchData>( + patch->getPatchData(d_diff_id))); + TBOX_ASSERT(diffusion); diffusion->fillAll(1.0); } @@ -1298,9 +1287,9 @@ CVODEModel::setInitialConditions( */ void CVODEModel::getCounters( - Array& counters) + std::vector& counters) { - counters.resizeArray(3); + counters.resize(3); counters[0] = d_number_rhs_eval; counters[1] = d_number_precond_setup; counters[2] = d_number_precond_solve; @@ -1322,26 +1311,25 @@ CVODEModel::getFromInput( d_initial_value = input_db->getDoubleWithDefault("initial_value", 0.0); - IntVector periodic(d_grid_geometry->getPeriodicShift(hier::IntVector(d_dim, + IntVector periodic(d_grid_geometry->getPeriodicShift(IntVector(d_dim, 1))); int num_per_dirs = 0; - for (int id = 0; id < d_dim.getValue(); id++) { - if (periodic(id)) num_per_dirs++; + for (int id = 0; id < d_dim.getValue(); ++id) { + if (periodic(id)) ++num_per_dirs; } if (input_db->keyExists("Boundary_data")) { boost::shared_ptr boundary_db( input_db->getDatabase("Boundary_data")); - if (d_dim == tbox::Dimension(2)) { - CartesianBoundaryUtilities2::readBoundaryInput(this, + if (d_dim == Dimension(2)) { + CartesianBoundaryUtilities2::getFromInput(this, boundary_db, d_scalar_bdry_edge_conds, d_scalar_bdry_node_conds, periodic); - } - if (d_dim == tbox::Dimension(3)) { - CartesianBoundaryUtilities3::readBoundaryInput(this, + } else if (d_dim == Dimension(3)) { + CartesianBoundaryUtilities3::getFromInput(this, boundary_db, d_scalar_bdry_face_conds, d_scalar_bdry_edge_conds, @@ -1356,14 +1344,6 @@ CVODEModel::getFromInput( } #ifdef USE_FAC_PRECONDITIONER - d_max_fac_its = - input_db->getIntegerWithDefault("max_fac_its", d_max_fac_its); - d_fac_tol = - input_db->getDoubleWithDefault("fac_tol", d_fac_tol); - d_max_hypre_its = - input_db->getIntegerWithDefault("max_hypre_its", d_max_hypre_its); - d_hypre_tol = - input_db->getDoubleWithDefault("hypre_tol", d_hypre_tol); d_use_neumann_bcs = input_db->getBoolWithDefault("use_neumann_bcs", d_use_neumann_bcs); d_print_solver_info = @@ -1379,26 +1359,26 @@ CVODEModel::getFromInput( * ************************************************************************* */ -void CVODEModel::putUnregisteredToDatabase( - const boost::shared_ptr& db) const +void CVODEModel::putToRestart( + const boost::shared_ptr& restart_db) const { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(db); -#endif + TBOX_ASSERT(restart_db); - db->putInteger("CVODE_MODEL_VERSION", CVODE_MODEL_VERSION); + restart_db->putInteger("CVODE_MODEL_VERSION", CVODE_MODEL_VERSION); - db->putDouble("d_initial_value", d_initial_value); + restart_db->putDouble("d_initial_value", d_initial_value); - db->putIntegerArray("d_scalar_bdry_edge_conds", d_scalar_bdry_edge_conds); - db->putIntegerArray("d_scalar_bdry_node_conds", d_scalar_bdry_node_conds); + restart_db->putIntegerVector("d_scalar_bdry_edge_conds", + d_scalar_bdry_edge_conds); + restart_db->putIntegerVector("d_scalar_bdry_node_conds", + d_scalar_bdry_node_conds); - if (d_dim == tbox::Dimension(2)) { - db->putDoubleArray("d_bdry_edge_val", d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { - db->putIntegerArray("d_scalar_bdry_face_conds", d_scalar_bdry_face_conds); - db->putDoubleArray("d_bdry_face_val", d_bdry_face_val); + if (d_dim == Dimension(2)) { + restart_db->putDoubleVector("d_bdry_edge_val", d_bdry_edge_val); + } else if (d_dim == Dimension(3)) { + restart_db->putIntegerVector("d_scalar_bdry_face_conds", + d_scalar_bdry_face_conds); + restart_db->putDoubleVector("d_bdry_face_val", d_bdry_face_val); } } @@ -1431,16 +1411,16 @@ void CVODEModel::getFromRestart() d_initial_value = db->getDouble("d_initial_value"); - d_scalar_bdry_edge_conds = db->getIntegerArray("d_scalar_bdry_edge_conds"); - d_scalar_bdry_node_conds = db->getIntegerArray("d_scalar_bdry_node_conds"); + d_scalar_bdry_edge_conds = db->getIntegerVector("d_scalar_bdry_edge_conds"); + d_scalar_bdry_node_conds = db->getIntegerVector("d_scalar_bdry_node_conds"); - if (d_dim == tbox::Dimension(2)) { - d_bdry_edge_val = db->getDoubleArray("d_bdry_edge_val"); - } - if (d_dim == tbox::Dimension(3)) { - d_scalar_bdry_face_conds = db->getIntegerArray("d_scalar_bdry_face_conds"); + if (d_dim == Dimension(2)) { + d_bdry_edge_val = db->getDoubleVector("d_bdry_edge_val"); + } else if (d_dim == Dimension(3)) { + d_scalar_bdry_face_conds = + db->getIntegerVector("d_scalar_bdry_face_conds"); - d_bdry_face_val = db->getDoubleArray("d_bdry_face_val"); + d_bdry_face_val = db->getDoubleVector("d_bdry_face_val"); } } @@ -1458,17 +1438,15 @@ void CVODEModel::readDirichletBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif - if (d_dim == tbox::Dimension(2)) { + + if (d_dim == Dimension(2)) { readStateDataEntry(db, db_name, bdry_location_index, d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == Dimension(3)) { readStateDataEntry(db, db_name, bdry_location_index, @@ -1481,17 +1459,15 @@ void CVODEModel::readNeumannBoundaryDataEntry( string& db_name, int bdry_location_index) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); -#endif - if (d_dim == tbox::Dimension(2)) { + + if (d_dim == Dimension(2)) { readStateDataEntry(db, db_name, bdry_location_index, d_bdry_edge_val); - } - if (d_dim == tbox::Dimension(3)) { + } else if (d_dim == Dimension(3)) { readStateDataEntry(db, db_name, bdry_location_index, @@ -1503,14 +1479,12 @@ void CVODEModel::readStateDataEntry( boost::shared_ptr db, const string& db_name, int array_indx, - Array& val) + std::vector& val) { -#ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(db); TBOX_ASSERT(!db_name.empty()); TBOX_ASSERT(array_indx >= 0); - TBOX_ASSERT(val.getSize() > array_indx); -#endif + TBOX_ASSERT(static_cast(val.size()) > array_indx); if (db->keyExists("val")) { val[array_indx] = db->getDouble("val"); @@ -1545,8 +1519,8 @@ void CVODEModel::printClassData( os << "d_initial_value = " << d_initial_value << endl; os << "Boundary Condition data..." << endl; - if (d_dim == tbox::Dimension(2)) { - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + if (d_dim == Dimension(2)) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; if (d_scalar_bdry_edge_conds[j] == BdryCond::DIRICHLET) { @@ -1555,15 +1529,14 @@ void CVODEModel::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_edge[" << j << "] = " << d_node_bdry_edge[j] << endl; } - } - if (d_dim == tbox::Dimension(3)) { - for (j = 0; j < d_scalar_bdry_face_conds.getSize(); j++) { + } else if (d_dim == Dimension(3)) { + for (j = 0; j < static_cast(d_scalar_bdry_face_conds.size()); ++j) { os << " d_scalar_bdry_face_conds[" << j << "] = " << d_scalar_bdry_face_conds[j] << endl; if (d_scalar_bdry_face_conds[j] == BdryCond::DIRICHLET) { @@ -1572,14 +1545,14 @@ void CVODEModel::printClassData( } } os << endl; - for (j = 0; j < d_scalar_bdry_edge_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_edge_conds.size()); ++j) { os << " d_scalar_bdry_edge_conds[" << j << "] = " << d_scalar_bdry_edge_conds[j] << endl; os << " d_edge_bdry_face[" << j << "] = " << d_edge_bdry_face[j] << endl; } os << endl; - for (j = 0; j < d_scalar_bdry_node_conds.getSize(); j++) { + for (j = 0; j < static_cast(d_scalar_bdry_node_conds.size()); ++j) { os << " d_scalar_bdry_node_conds[" << j << "] = " << d_scalar_bdry_node_conds[j] << endl; os << " d_node_bdry_face[" << j << "] = " diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.h b/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.h index e4dde12d..b8025a31 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.h +++ b/base/SAMRAI/SAMRAI/source/test/sundials/CVODEModel.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Example demonstrating use of CVODE vectors. * ************************************************************************/ @@ -43,7 +43,6 @@ using namespace std; /* * Header file for SAMRAI classes referenced in this class. */ -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/hier/Box.h" #include "SAMRAI/pdat/CellVariable.h" #include "SAMRAI/geom/CartesianGridGeometry.h" @@ -72,7 +71,9 @@ using namespace std; #include "SAMRAI/solv/SundialsAbstractVector.h" #include "SAMRAI/solv/Sundials_SAMRAIVector.h" -#include +#include "boost/shared_ptr.hpp" + +#include using namespace SAMRAI; using namespace tbox; @@ -133,9 +134,10 @@ class CVODEModel: */ CVODEModel( const string& object_name, - const tbox::Dimension& dim, - boost::shared_ptr input_db, - boost::shared_ptr grid_geom); + const Dimension& dim, + boost::shared_ptr fac_solver, + boost::shared_ptr input_db, + boost::shared_ptr grid_geom); /** * Empty destructor for CVODEModel. @@ -287,9 +289,9 @@ class CVODEModel: * data interpolation operations. Default is to return * zero, assuming no user-defined operations provided. */ - virtual IntVector getRefineOpStencilWidth() const + virtual IntVector getRefineOpStencilWidth(const Dimension& dim) const { - return IntVector(d_dim, 0); + return IntVector(dim, 0); } /************************************************************************* @@ -331,9 +333,17 @@ class CVODEModel: * data interpolation operations. Default is to return * zero, assuming no user-defined operations provided. */ - virtual IntVector getCoarsenOpStencilWidth() const + virtual IntVector getCoarsenOpStencilWidth(const Dimension& dim) const + { + return IntVector(dim, 0); + } + + /*! + * @brief Return the dimension of this object. + */ + const Dimension& getDim() const { - return IntVector(d_dim, 0); + return d_dim; } /************************************************************************* @@ -420,17 +430,17 @@ class CVODEModel: */ void getCounters( - tbox::Array& counters); + std::vector& counters); /** - * Writes state of CVODEModel object to the specified database. + * Writes state of CVODEModel object to the specified restart database. * * This routine is a concrete implementation of the function * declared in the tbox::Serializable abstract base class. */ void - putUnregisteredToDatabase( - const boost::shared_ptr& db) const; + putToRestart( + const boost::shared_ptr& restart_db) const; /** * This routine is a concrete implementation of the virtual function @@ -442,13 +452,13 @@ class CVODEModel: */ void readDirichletBoundaryDataEntry( - const boost::shared_ptr& db, + const boost::shared_ptr& db, string& db_name, int bdry_location_index); void readNeumannBoundaryDataEntry( - const boost::shared_ptr& db, + const boost::shared_ptr& db, string& db_name, int bdry_location_index); @@ -471,7 +481,7 @@ class CVODEModel: */ virtual void getFromInput( - boost::shared_ptr db, + boost::shared_ptr input_db, bool is_from_restart); virtual void @@ -479,10 +489,10 @@ class CVODEModel: void readStateDataEntry( - boost::shared_ptr db, + boost::shared_ptr db, const string& db_name, int array_indx, - tbox::Array& uval); + std::vector& uval); /* * Object name used for error/warning reporting and as a label @@ -490,7 +500,7 @@ class CVODEModel: */ string d_object_name; - const tbox::Dimension d_dim; + const Dimension d_dim; /* * Pointer to solution vector @@ -522,17 +532,13 @@ class CVODEModel: int d_diff_id; int d_flag_id; int d_neuf_id; - int d_bdry_types[2 * tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int d_bdry_types[2 * MAX_DIM_VAL]; - solv::CellPoissonFACSolver d_FAC_solver; + boost::shared_ptr d_FAC_solver; bool d_FAC_solver_allocated; bool d_level_solver_allocated; bool d_use_neumann_bcs; - int d_max_fac_its; - double d_fac_tol; - int d_max_hypre_its; - double d_hypre_tol; double d_current_soln_time; #endif @@ -544,7 +550,7 @@ class CVODEModel: /* * Grid geometry */ - boost::shared_ptr d_grid_geometry; + boost::shared_ptr d_grid_geometry; /* * Initial value @@ -568,24 +574,24 @@ class CVODEModel: * * Input file values are read into these arrays. */ - tbox::Array d_scalar_bdry_edge_conds; - tbox::Array d_scalar_bdry_node_conds; - tbox::Array d_scalar_bdry_face_conds; // Only used for 3D. + std::vector d_scalar_bdry_edge_conds; + std::vector d_scalar_bdry_node_conds; + std::vector d_scalar_bdry_face_conds; // Only used for 3D. /* * Boundary condition cases for scalar and vector (i.e., depth > 1) * variables. These are post-processed input values and are passed * to the boundary routines. */ - tbox::Array d_node_bdry_edge; // Only used for 2D. - tbox::Array d_edge_bdry_face; // Only used for 3D. - tbox::Array d_node_bdry_face; // Only used for 3D. + std::vector d_node_bdry_edge; // Only used for 2D. + std::vector d_edge_bdry_face; // Only used for 3D. + std::vector d_node_bdry_face; // Only used for 3D. /* * Arrays of face (3d) or edge (2d) boundary values for DIRICHLET case. */ - tbox::Array d_bdry_edge_val; // Only used for 2D - tbox::Array d_bdry_face_val; // Only used for 3D + std::vector d_bdry_edge_val; // Only used for 2D + std::vector d_bdry_face_val; // Only used for 3D }; #endif // HAVE_SUNDIALS diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.depend index 03307ea5..07719768 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -55,12 +55,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -163,7 +165,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ @@ -178,8 +179,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -201,10 +202,10 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CVODEModel.C \ CVODEModel.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -265,12 +266,11 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ @@ -278,6 +278,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ @@ -287,6 +288,7 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ @@ -300,7 +302,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ @@ -312,12 +317,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -350,7 +357,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/BalanceUtilities.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ @@ -358,11 +364,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/SpatialKey.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/PartitioningParams.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitialize.h \ $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitializeConnectorWidthRequestor.h\ $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TransitLoad.h \ $(INCLUDE_SAM)/SAMRAI/mesh/TreeLoadBalancer.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ @@ -434,12 +441,12 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ $(INCLUDE_SAM)/SAMRAI/tbox/BalancedDepthFirstTree.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/CommGraphWriter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -452,9 +459,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankTreeStrategy.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ @@ -477,10 +485,10 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CVODEModel.h \ main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -541,265 +549,9 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif - -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} -FILE_2=tbox_Pointer-CVODEModel.o -DEPENDS_2:=\ - $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/BoxUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarseFineBoundary.h \ - $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ - $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ - $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ - $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ - $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ - $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ - $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ - $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ - $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.h \ - $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDoubleConstantRefine.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CVODEAbstractFunctions.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CartesianRobinBcHelper.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACOps.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonFACSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/CellPoissonHypreSolver.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACOperatorStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/FACPreconditioner.h \ - $(INCLUDE_SAM)/SAMRAI/solv/GhostCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/PoissonSpecifications.h \ - $(INCLUDE_SAM)/SAMRAI/solv/RobinBcCoefStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SimpleCellRobinBcCoefs.h \ - $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ - $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ - $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h CVODEModel.h \ - tbox_Pointer-CVODEModel.C - -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) -DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/ArrayDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchyNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/HierarchySideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchCellDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchEdgeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchFaceDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchNodeDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataBasicOps.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataMiscellaneousOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataNormOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/math/PatchSideDataOpsReal.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/EdgeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuteredgeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ - $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.in b/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.in index 2da21682..532ca8bc 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/sundials/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for cvode sample application ## ######################################################################### @@ -14,25 +14,33 @@ SUBDIR = source/test/sundials VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA= -DDISPLAY -DNDIM=$(PDIM) -DTESTING=1 +SUBDIRS = fortran -CXX_OBJS = main.o CVODEModel.o tbox_Pointer-CVODEModel.o -F_OBJS = FACjacobian2d.o FACjacobian3d.o +CPPFLAGS_EXTRA= -DDISPLAY -DTESTING=1 NUM_TESTS = 4 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" + +CXX_OBJS = main.o CVODEModel.o +F_OBJS = fortran/FACjacobian2d.o fortran/FACjacobian3d.o main: $(CXX_OBJS) $(F_OBJS) $(LIBSAMRAIDEPEND) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CXX_OBJS) $(F_OBJS) \ $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o main -checkcompile: main +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/FACjacobian2d.o: + +fortran/FACjacobian3d.o: check: $(MAKE) check2d @@ -40,40 +48,52 @@ check: check2d: main @for i in test_inputs/*2d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo check3d: main @for i in test_inputs/*3d*.input ; do \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./main $${i}; \ - done + for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main $${i} | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done \ + done; \ + $(RM) foo + +checkcompile: main checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile - + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: - $(RM) *.o main +perf: -include $(SRCDIR)/Makefile.depend +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf -FORTRAN = $(SRCDIR) -M4DIRS = -DFORTDIR=$(FORTRAN) $(SAMRAI_M4_FLAGS) +checkclean: + $(CLEAN_COMMON_CHECK_FILES) -FACjacobian2d.o: $(FORTRAN)/FACjacobian2d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/FACjacobian2d.m4 > FACjacobian2d.f - $(F77) $(FFLAGS) -c FACjacobian2d.f -o $@ +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done -FACjacobian3d.o: $(FORTRAN)/FACjacobian3d.m4 - $(M4) $(M4DIRS) $(FORTRAN)/FACjacobian3d.m4 > FACjacobian3d.f - $(F77) $(FFLAGS) -c FACjacobian3d.f -o $@ +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/README b/base/SAMRAI/SAMRAI/source/test/sundials/README index 1ba86ab7..0644c811 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/README +++ b/base/SAMRAI/SAMRAI/source/test/sundials/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: CVODE example ## ######################################################################### @@ -14,14 +14,27 @@ SAMRAI. The files included in this directory are as follows: main.C - example main program CVODEModel.[Ch] - example user routines that supply interface methods to CVODE operations in the library - cvode-[2d,3d].input - 2d and 3d input files + cvode-dir.[2d,3d].input - 2d and 3d Dirichlet input files + cvode-neu.[2d,3d].input - 2d and 3d Neumann input files -COMPILE and RUN ---------------- -Compile: make -Run: main2d sundials-2d-[dir,neu].input - -"dir" indicates dirichlet BCs, while "neu" indicates neumann BCs. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + For one of the following input files: + "dir" indicates Dirichlet BCs, while "neu" indicates Neumann BCs. + test_inputs/cvode_dir.2d.input + test_inputs/cvode_neu.2d.input + test_inputs/cvode_dir.3d.input + test_inputs/cvode_neu.3d.input + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main INPUTS: @@ -57,39 +70,3 @@ CVODEModel { Diffusion_Coefficient = .1 Boundary_value = 0.0 } - -The "Geometry" section describes the spatial layout of the problem. -It specifies the domain boxes, which specify the index space, and -the low and high spatial dimensions of the domain. -An example input might look like: - -Geometry { - domain_boxes = [ (0,0) , (9,9) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 1.e1 , 1.e1 // upper end of computational domain. -} - -The "GriddingAlgorithm" section describes parameters used for -adaptive gridding. It specifies the number of levels, the ratios -between coarse and fine levels, and the largest and smallest allowed -patch size. An example input might look like: - -GriddingAlgorithm { - max_levels = 1 // Maximum number of levels in hierarchy. - - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - } - - largest_patch_size { - level_0 = 10,10 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1,1 - // all finer levels will use same values as level_0... - } - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box} diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.2d.input b/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.2d.input deleted file mode 100644 index 7e4f8d76..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.2d.input +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI CVODE test program - * - ************************************************************************/ - -Main { - - init_time = 0.0 - print_interval = 1.0e-2 - num_print_intervals = 25 - solution_logging = TRUE - - max_internal_steps = 100000 - relative_tolerance = 1e-4 - absolute_tolerance = 1e-4 - max_order = 0 -// stepping_method = timestepping mode for CVODE - NORMAL = 1 - ONESTEP = 2 - stepping_method = NORMAL - uses_newton = TRUE - uses_preconditioning = TRUE - - viz_dump_filename = "rad2d" - viz_dump_dirname = "viz_rad2d" - viz_dump_interval = 1 -} - -CVODEModel { - - initial_value = 0.0 - - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 - - Boundary_data { - boundary_edge_xlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_edge_xhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_edge_ylo { - boundary_condition = "DIRICHLET" - val = 1.0 - } - boundary_edge_yhi { - boundary_condition = "DIRICHLET" - val = 0. - } - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi { - boundary_condition = "YDIRICHLET" - } - boundary_node_xhi_yhi { - boundary_condition = "YDIRICHLET" - } - } - -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (9,4) ] - level_1 = [ (0,0) , (19,4) ] - level_2 = [ (0,0) , (39,4) ] - } -} - -TimerManager { - timer_list = "apps::main::*" -} - -Geometry { - domain_boxes = [ (0,0) , (9,9) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 5.e0 , 5.e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 8,8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1,1 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -LoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.3d.input b/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.3d.input deleted file mode 100644 index 2b7b1593..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_dir.3d.input +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI CVODE test program - * - ************************************************************************/ - -Main { - - init_time = 0.0 - print_interval = 1.0e-2 - num_print_intervals = 25 - solution_logging = TRUE - - max_internal_steps = 100000 - relative_tolerance = 1e-4 - absolute_tolerance = 1e-4 -// 0=use default - max_order = 0 -// stepping_method = timestepping mode for CVODE - NORMAL = 1 - ONESTEP = 2 - stepping_method = NORMAL - uses_newton = TRUE - uses_preconditioning = TRUE - - viz_dump_filename = "rad3d" - viz_dump_dirname = "viz_rad3d" - viz_dump_interval = 1 - -} - -CVODEModel { - initial_value = 0.0 - - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 - use_neumann_bcs = FALSE - print_solver_info = FALSE - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - // and "NEUMANN" - Boundary_data { - boundary_face_xlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_xhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_ylo { - boundary_condition = "DIRICHLET" - val = 1. - } - boundary_face_yhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_zlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_zhi { - boundary_condition = "DIRICHLET" - val = 0. - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for an edge, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge boundary values - // will be the same regardless of which face is used. - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent faces have either FLOW - // or REFLECT conditions, the resulting node boundary values - // will be the same regardless of which face is used. - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XDIRICHLET" - } - - } -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,4,9) ] - level_1 = [ (0,0,0) , (19,4,19) ] - level_2 = [ (0,0,0) , (39,4,39) ] - } -} - -TimerManager { - timer_list = "apps::main::*" -} - -Geometry { - domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 10. , 10. , 10. // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 8 , 8 , 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -LoadBalancer { -// processors = 1 , 1 , 1 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.2d.input b/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.2d.input deleted file mode 100644 index e0d6e9a4..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.2d.input +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI CVODE test program - * - ************************************************************************/ - -Main { - - init_time = 0.0 - print_interval = 1.0e-2 - num_print_intervals = 25 - solution_logging = TRUE - - max_internal_steps = 100000 - relative_tolerance = 1e-4 - absolute_tolerance = 1e-4 -// 0=use default - max_order = 0 -// stepping_method = timestepping mode for CVODE - NORMAL = 1 - ONESTEP = 2 - stepping_method = NORMAL - uses_newton = TRUE - uses_preconditioning = TRUE - - viz_dump_filename = "rad2d" - viz_dump_dirname = "viz_rad2d" - viz_dump_interval = 1 -} - -CVODEModel { - - initial_value = 0.0 - - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 - use_neumann_bcs = TRUE - print_solver_info = FALSE - - Boundary_data { - boundary_edge_xlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_edge_xhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_edge_ylo { - boundary_condition = "NEUMANN" - val = 1. - } - boundary_edge_yhi { - boundary_condition = "DIRICHLET" - val = 0. - } - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent edge above. This is enforced for - // consistency. However, note when a REFLECT edge condition - // is given and the other adjacent edge has either a FLOW - // or REFLECT condition, the resulting node boundary values - // will be the same regardless of which edge is used. - boundary_node_xlo_ylo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi { - boundary_condition = "YDIRICHLET" - } - boundary_node_xhi_yhi { - boundary_condition = "YDIRICHLET" - } - } - -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (9,4) ] - level_1 = [ (0,0) , (19,4) ] - level_2 = [ (0,0) , (39,4) ] - } -} - -TimerManager { - timer_list = "apps::main::*" -} - -Geometry { - domain_boxes = [ (0,0) , (9,9) ] - x_lo = 0.e0 , 0.e0 // lower end of computational domain. - x_up = 5.e0 , 5.e0 // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 - level_2 = 2 , 2 - level_3 = 2 , 2 - } - - largest_patch_size { - level_0 = 20,20 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1,1 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -LoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.3d.input b/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.3d.input deleted file mode 100644 index 519bd5ea..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sundials/example_inputs/cvode_neu.3d.input +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: Input file for SAMRAI CVODE test program - * - ************************************************************************/ - -Main { - - init_time = 0.0 - print_interval = 1.0e-2 - num_print_intervals = 25 - solution_logging = TRUE - - max_internal_steps = 100000 - relative_tolerance = 1e-6 - absolute_tolerance = 1e-6 -// 0=use default - max_order = 0 -// stepping_method = timestepping mode for CVODE - NORMAL = 1 - ONESTEP = 2 - stepping_method = NORMAL - uses_newton = TRUE - uses_preconditioning = TRUE - - viz_dump_filename = "rad3d" - viz_dump_dirname = "viz_rad3d" - viz_dump_interval = 1 - -} - -CVODEModel { - initial_value = 0.0 - - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 - use_neumann_bcs = TRUE - print_solver_info = FALSE - - // valid boundary_condition values are "FLOW", "REFLECT", "DIRICHLET" - // and "NEUMANN" - Boundary_data { - boundary_face_xlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_xhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_ylo { - boundary_condition = "NEUMANN" - val = 1. - } - boundary_face_yhi { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_zlo { - boundary_condition = "DIRICHLET" - val = 0. - } - boundary_face_zhi { - boundary_condition = "DIRICHLET" - val = 0. - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for an edge, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent face has either a FLOW - // or REFLECT condition, the resulting edge boundary values - // will be the same regardless of which face is used. - - boundary_edge_ylo_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_yhi_zlo { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_ylo_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_yhi_zhi { // XFLOW, XREFLECT, XDIRICHLET not allowed - boundary_condition = "ZDIRICHLET" - } - boundary_edge_xlo_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xlo_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xhi_zlo { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xhi_zhi { // YFLOW, YREFLECT, YDIRICHLET not allowed - boundary_condition = "XDIRICHLET" - } - boundary_edge_xlo_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YNEUMANN" - } - boundary_edge_xhi_ylo { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YNEUMANN" - } - boundary_edge_xlo_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - boundary_edge_xhi_yhi { // ZFLOW, ZREFLECT, ZDIRICHLET not allowed - boundary_condition = "YDIRICHLET" - } - - // IMPORTANT: If a *REFLECT, *DIRICHLET, or *FLOW condition is given - // for a node, the condition must match that of the - // appropriate adjacent face above. This is enforced for - // consistency. However, note when a REFLECT face condition - // is given and the other adjacent faces have either FLOW - // or REFLECT conditions, the resulting node boundary values - // will be the same regardless of which face is used. - - boundary_node_xlo_ylo_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_yhi_zlo { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_ylo_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_ylo_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xlo_yhi_zhi { - boundary_condition = "XDIRICHLET" - } - boundary_node_xhi_yhi_zhi { - boundary_condition = "XDIRICHLET" - } - - } -} - -StandardTagAndInitialize{ - tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,4,9) ] - level_1 = [ (0,0,0) , (19,4,19) ] - level_2 = [ (0,0,0) , (39,4,39) ] - } -} - -TimerManager { - timer_list = "apps::main::*" -} - -Geometry { - domain_boxes = [ (0,0,0) , (9,9,9) ] - x_lo = 0.e0 , 0.e0 , 0.e0 // lower end of computational domain. - x_up = 10. , 10. , 10. // upper end of computational domain. -} - -PatchHierarchy { - max_levels = 2 // Maximum number of levels in hierarchy. - -// Note: For the following regridding information, data is required for each -// potential in the patch hierarchy; i.e., levels 0 thru max_levels-1. -// If more data values than needed are given, only the number required -// will be read in. If fewer values are given, an error will result. -// -// Specify coarsening ratios for each level 1 through max_levels-1 - ratio_to_coarser { // vector ratio to next coarser level - level_1 = 2 , 2 , 2 - level_2 = 2 , 2 , 2 - level_3 = 2 , 2 , 2 - } - - largest_patch_size { - level_0 = 8 , 8 , 8 - // all finer levels will use same values as level_0... - } - - smallest_patch_size { - level_0 = 1 , 1 , 1 - // all finer levels will use same values as level_0... - } - -} - -GriddingAlgorithm { - - efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level - combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller - // boxes < efficiency * vol of large box -} - -LoadBalancer { -// processors = 1 , 1 , 1 - use_spatial_bin_pack = TRUE -} - diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian2d.m4 b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian2d.m4 similarity index 92% rename from base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian2d.m4 rename to base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian2d.m4 index 89275259..5ef46194 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian2d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian2d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 2D F77 routines. +c define(NDIM,2)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim2d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl subroutine comprhs2d( & ifirst0,ilast0,ifirst1,ilast1, diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian3d.m4 b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian3d.m4 similarity index 94% rename from base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian3d.m4 rename to base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian3d.m4 index 612ed00e..91667080 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/FACjacobian3d.m4 +++ b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/FACjacobian3d.m4 @@ -1,5 +1,12 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: 3D F77 routines. +c define(NDIM,3)dnl -include(SAMRAI_FORTDIR/pdat_m4arrdim3d.i)dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl subroutine comprhs3d( & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.depend new file mode 100644 index 00000000..c12b3e70 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.depend @@ -0,0 +1,37 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=FACjacobian2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + FACjacobian2d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=FACjacobian3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + FACjacobian3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.in new file mode 100644 index 00000000..fe2dd299 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/sundials/fortran/Makefile.in @@ -0,0 +1,39 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for SAMRAI cvode sample +## application +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/sundials/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= FACjacobian2d.o FACjacobian3d.o + +main: $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +FACjacobian2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/FACjacobian2d.m4 > FACjacobian2d.f + $(F77) $(FFLAGS) -c FACjacobian2d.f -o $@ + +FACjacobian3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/FACjacobian3d.m4 > FACjacobian3d.f + $(F77) $(FFLAGS) -c FACjacobian3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/main.C b/base/SAMRAI/SAMRAI/source/test/sundials/main.C index 87ce2043..387e5798 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/main.C +++ b/base/SAMRAI/SAMRAI/source/test/sundials/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program for testing Sundials/SAMRAI interface. * ************************************************************************/ @@ -27,7 +27,7 @@ using namespace std; #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/PIO.h" -#include "SAMRAI/tbox/Array.h" +#include "SAMRAI/tbox/BalancedDepthFirstTree.h" #include "SAMRAI/mesh/BergerRigoutsos.h" #include "SAMRAI/geom/CartesianGridGeometry.h" #include "SAMRAI/pdat/CellVariable.h" @@ -63,7 +63,7 @@ using namespace std; #endif #endif -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -145,6 +145,7 @@ int main( int max_order = main_db->getInteger("max_order"); int max_internal_steps = main_db->getInteger("max_internal_steps"); double init_time = main_db->getDouble("init_time"); + int init_cycle = main_db->getInteger("init_cycle"); double print_interval = main_db->getDouble("print_interval"); int num_print_intervals = main_db->getInteger("num_print_intervals"); @@ -154,22 +155,9 @@ int main( int stepping_method = main_db->getInteger("stepping_method"); bool uses_preconditioning = main_db->getBoolWithDefault("uses_preconditioning", false); - int viz_dump_interval = - main_db->getIntegerWithDefault("viz_dump_interval", 0); bool solution_logging = main_db->getBoolWithDefault("solution_logging", false); - string viz_dump_filename; - string viz_dump_dirname; - if (viz_dump_interval > 0) { - if (main_db->keyExists("viz_dump_filename")) { - viz_dump_filename = main_db->getString("viz_dump_filename"); - } - if (main_db->keyExists("viz_dump_dirname")) { - viz_dump_dirname = main_db->getString("viz_dump_dirname"); - } - } - /* * Create geometry and hierarchy objects. */ @@ -189,22 +177,75 @@ int main( * Create gridding algorithm objects that will handle construction of * of the patch levels in the hierarchy. */ + + std::string cvode_model_name = "CVODEModel"; + std::string fac_solver_name = cvode_model_name + ":FAC solver"; + std::string fac_ops_name = fac_solver_name + "::fac_ops"; + std::string fac_precond_name = fac_solver_name + "::fac_precond"; + std::string hypre_poisson_name = fac_ops_name + "::hypre_solver"; + +#ifdef HAVE_HYPRE + boost::shared_ptr hypre_poisson( + new solv::CellPoissonHypreSolver( + dim, + hypre_poisson_name, + input_db->isDatabase("hypre_solver") ? + input_db->getDatabase("hypre_solver") : + boost::shared_ptr())); + + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + hypre_poisson, + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#else + boost::shared_ptr fac_ops( + new solv::CellPoissonFACOps( + dim, + fac_ops_name, + input_db->isDatabase("fac_ops") ? + input_db->getDatabase("fac_ops") : + boost::shared_ptr())); +#endif + + boost::shared_ptr fac_precond( + new solv::FACPreconditioner( + fac_precond_name, + fac_ops, + input_db->isDatabase("fac_precond") ? + input_db->getDatabase("fac_precond") : + boost::shared_ptr())); + + boost::shared_ptr fac_solver( + new solv::CellPoissonFACSolver( + dim, + fac_solver_name, + fac_precond, + fac_ops, + input_db->isDatabase("fac_solver") ? + input_db->getDatabase("fac_solver") : + boost::shared_ptr())); + boost::shared_ptr cvode_model( new CVODEModel( - "CVODEModel", + cvode_model_name, dim, + fac_solver, input_db->getDatabase("CVODEModel"), geometry)); boost::shared_ptr error_est( new mesh::StandardTagAndInitialize( - dim, "StandardTagAndInitialize", cvode_model.get(), input_db->getDatabase("StandardTagAndInitialize"))); boost::shared_ptr box_generator( - new mesh::BergerRigoutsos(dim)); + new mesh::BergerRigoutsos(dim, + input_db->getDatabase("BergerRigoutsos"))); boost::shared_ptr load_balancer( new mesh::TreeLoadBalancer( @@ -227,19 +268,20 @@ int main( */ gridding_algorithm->makeCoarsestLevel(init_time); - tbox::Array tag_buffer_array(hierarchy->getMaxNumberOfLevels()); - for (int il = 0; il < hierarchy->getMaxNumberOfLevels(); il++) { + std::vector tag_buffer_array(hierarchy->getMaxNumberOfLevels()); + for (int il = 0; il < hierarchy->getMaxNumberOfLevels(); ++il) { tag_buffer_array[il] = 1; } bool done = false; - bool initial_time = true; + bool initial_cycle = true; for (int ln = 0; hierarchy->levelCanBeRefined(ln) && !done; - ln++) { + ++ln) { gridding_algorithm->makeFinerLevel( - init_time, - initial_time, - tag_buffer_array[ln]); + tag_buffer_array[ln], + initial_cycle, + init_cycle, + init_time); done = !(hierarchy->finerLevelExists(ln)); } @@ -273,11 +315,11 @@ int main( cvode_model.get(), uses_preconditioning); - int neq = 0; + size_t neq = 0; boost::shared_ptr level_zero( hierarchy->getPatchLevel(0)); const hier::BoxContainer& level_0_boxes = level_zero->getBoxes(); - for (hier::BoxContainer::const_iterator i(level_0_boxes); + for (hier::BoxContainer::const_iterator i = level_0_boxes.begin(); i != level_0_boxes.end(); ++i) { neq += i->size(); } @@ -311,7 +353,7 @@ int main( tbox::pout << "Initial solution vector y() at initial time: " << endl; int ln; tbox::pout << "y(" << init_time << "): " << endl; - for (ln = 0; ln < init_hierarchy->getNumberOfLevels(); ln++) { + for (ln = 0; ln < init_hierarchy->getNumberOfLevels(); ++ln) { boost::shared_ptr level( init_hierarchy->getPatchLevel(ln)); tbox::plog << "level = " << ln << endl; @@ -321,8 +363,10 @@ int main( const boost::shared_ptr& patch = *p; boost::shared_ptr > y_data( - y_init->getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + y_init->getComponentPatchData(0, *patch))); + TBOX_ASSERT(y_data); + y_data->print(y_data->getBox()); } } } @@ -341,14 +385,14 @@ int main( * Start time-stepping. **************************************************************************/ - tbox::Array time(num_print_intervals); - tbox::Array maxnorm(num_print_intervals); - tbox::Array l1norm(num_print_intervals); - tbox::Array l2norm(num_print_intervals); + std::vector time(num_print_intervals); + std::vector maxnorm(num_print_intervals); + std::vector l1norm(num_print_intervals); + std::vector l2norm(num_print_intervals); double final_time = init_time; int interval; - for (interval = 1; interval <= num_print_intervals; interval++) { + for (interval = 1; interval <= num_print_intervals; ++interval) { /* * Set time interval @@ -390,7 +434,7 @@ int main( tbox::plog << "y(" << final_time << "): " << endl << endl; t_log_dump->start(); for (int ln = 0; ln < result_hierarchy->getNumberOfLevels(); - ln++) { + ++ln) { boost::shared_ptr level( result_hierarchy->getPatchLevel(ln)); tbox::plog << "level = " << ln << endl; @@ -400,8 +444,9 @@ int main( const boost::shared_ptr& patch = *p; boost::shared_ptr > y_data( - y_result->getComponentPatchData(0, *patch), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + y_result->getComponentPatchData(0, *patch))); + TBOX_ASSERT(y_data); y_data->print(y_data->getBox()); } } @@ -415,7 +460,7 @@ int main( /* * Write CVODEModel stats */ - tbox::Array counters; + std::vector counters; cvode_model->getCounters(counters); #if (TESTING == 1) @@ -469,7 +514,7 @@ int main( << " L1 Norm \t" << " L2 Norm " << endl; - for (interval = 0; interval < num_print_intervals; interval++) { + for (interval = 0; interval < num_print_intervals; ++interval) { tbox::pout.precision(18); tbox::pout << " " << time[interval] << " \t"; tbox::pout.precision(6); diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/tbox_Pointer-CVODEModel.C b/base/SAMRAI/SAMRAI/source/test/sundials/tbox_Pointer-CVODEModel.C deleted file mode 100644 index 84408d36..00000000 --- a/base/SAMRAI/SAMRAI/source/test/sundials/tbox_Pointer-CVODEModel.C +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: - * - ************************************************************************/ -#include "CVODEModel.h" - -#include - -#if defined(HAVE_SUNDIALS) && defined(HAVE_HYPRE) - -template class boost::shared_ptr; - -#endif diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.2d.input b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.2d.input index a1df5e46..8b9b34d4 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.2d.input @@ -3,51 +3,60 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI CVODE test program * ************************************************************************/ Main { + // Dimension of the problem. No default. dim = 2 + // Initial time. No default. init_time = 0.0 + // Initial cycle number. No default + init_cycle = 0 + // Time between printing output. No default print_interval = 1.0e-2 + // Number of intervals to print. No default num_print_intervals = 10 + // Log the solution at each print interval. Default is FALSE solution_logging = FALSE + // Parameters needed for the CVODE solver. No defaults unless listed. + // Maximum iterations allowed in the solver. max_internal_steps = 100000 + // Tolerances used to determine convergence relative_tolerance = 1e-4 absolute_tolerance = 1e-4 -// // 0=use default + // 0 means used CVODE's defaults max_order = 0 -// stepping_method = timestepping mode for CVODE - NORMAL = 1 - ONESTEP = 2 - stepping_method = NORMAL + // stepping method is 1 for NORMAL and 2 for ONESTEP + stepping_method = 1 + // TRUE for CV_NEWTON, FALSE for CV_FUNCTIONAL uses_newton = TRUE - uses_preconditioning = TRUE + // Default is FALSE + uses_preconditioning = TRUE - viz_dump_filename = "rad2d" - viz_dump_dirname = "viz_rad2d" - viz_dump_interval = 0 - -// Used for testing only + // Used for testing only + // These values serve as baselines for testing verification. correct_rhs_evals = 678 correct_precond_setups = 507 correct_precond_solves = 337 } CVODEModel { - + // Default is 0.0 initial_value = 0.0 - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 + // Use Neumann boundary conditions. Default is FALSE. + use_neumann_bcs = FALSE + // Print solver info. Default is FALSE. + print_solver_info = FALSE + + // See appu::CartesianBoundaryUtilities[2,3] for input. Boundary_data { boundary_edge_xlo { boundary_condition = "DIRICHLET" @@ -88,25 +97,45 @@ CVODEModel { } +//See solv::FACPreconditioner for input. +fac_precond { + max_cycles = 1 + residual_tol = 1.e-40 +} + +//See solv::CellPoissonHypreSolver for input. +hypre_solver { + use_smg = FALSE +} + +//See mesh::StandardTagAndInitialize for input. StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (9,4) ] - level_1 = [ (0,0) , (19,4) ] - level_2 = [ (0,0) , (39,4) ] + + level_0 { + boxes = [ (0,0) , (9,4) ] + } + level_1 { + boxes = [ (0,0) , (19,4) ] + } + level_2 { + boxes = [ (0,0) , (39,4) ] } } +//See tbox::TimerManager for input. TimerManager { - timer_list = "apps::main::*" + timer_list = "apps::main::*" } +//See geom::CartesianGridGeometry and its base classes for input. Geometry { domain_boxes = [ (0,0) , (9,9) ] x_lo = 0.e0 , 0.e0 // lower end of computational domain. x_up = 5.e0 , 5.e0 // upper end of computational domain. } +//See hier::PatchHierarchy for input. PatchHierarchy { max_levels = 2 // Maximum number of levels in hierarchy. @@ -134,16 +163,18 @@ PatchHierarchy { } -GriddingAlgorithm { - +//See mesh::BergerRigoutsos for input +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +//See mesh::GriddingAlgorithm for input +GriddingAlgorithm { } +//See mesh::TreeLoadBalancer for input LoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.3d.input b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.3d.input index cc888866..36300399 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_dir.3d.input @@ -3,16 +3,19 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI CVODE test program * ************************************************************************/ +//See cvode_dir.2d.input for documentation of input specific to this test. + Main { dim = 3 init_time = 0.0 + init_cycle = 0 print_interval = 1.0e-2 num_print_intervals = 10 solution_logging = FALSE @@ -29,10 +32,6 @@ Main { uses_newton = TRUE uses_preconditioning = TRUE - viz_dump_filename = "rad3d" - viz_dump_dirname = "viz_rad3d" - viz_dump_interval = 0 - // Used for testing only correct_rhs_evals = 211 correct_precond_setups = 156 @@ -43,10 +42,6 @@ Main { CVODEModel { initial_value = 0.0 - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 use_neumann_bcs = FALSE print_solver_info = FALSE @@ -159,12 +154,26 @@ CVODEModel { } } +fac_precond { + max_cycles = 1 + residual_tol = 1.e-40 +} + +hypre_solver { + use_smg = FALSE +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,4,9) ] - level_1 = [ (0,0,0) , (19,4,19) ] - level_2 = [ (0,0,0) , (39,4,39) ] + + level_0 { + boxes = [ (0,0,0) , (9,4,9) ] + } + level_1 { + boxes = [ (0,0,0) , (19,4,19) ] + } + level_2 { + boxes = [ (0,0,0) , (39,4,39) ] } } @@ -205,16 +214,15 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +GriddingAlgorithm { } LoadBalancer { -// processors = 1 , 1 , 1 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.2d.input b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.2d.input index 1117b365..18cba493 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.2d.input +++ b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.2d.input @@ -3,16 +3,19 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI CVODE test program * ************************************************************************/ +//See cvode_dir.2d.input for documentation of input specific to this test. + Main { dim = 2 init_time = 0.0 + init_cycle = 0 print_interval = 1.0e-2 num_print_intervals = 10 solution_logging = FALSE @@ -27,11 +30,7 @@ Main { ONESTEP = 2 stepping_method = NORMAL uses_newton = TRUE - uses_preconditioning = TRUE - - viz_dump_filename = "rad2d" - viz_dump_dirname = "viz_rad2d" - viz_dump_interval = 0 + uses_preconditioning = TRUE // Used for testing only correct_rhs_evals = 927 @@ -43,10 +42,6 @@ CVODEModel { initial_value = 0.0 - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 use_neumann_bcs = TRUE print_solver_info = FALSE @@ -90,17 +85,31 @@ CVODEModel { } +fac_precond { + max_cycles = 1 + residual_tol = 1.e-40 +} + +hypre_solver { + use_smg = FALSE +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0) , (9,4) ] - level_1 = [ (0,0) , (19,4) ] - level_2 = [ (0,0) , (39,4) ] + + level_0 { + boxes = [ (0,0) , (9,4) ] + } + level_1 { + boxes = [ (0,0) , (19,4) ] + } + level_2 { + boxes = [ (0,0) , (39,4) ] } } TimerManager { - timer_list = "apps::main::*" + timer_list = "apps::main::*" } Geometry { @@ -136,16 +145,15 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +GriddingAlgorithm { } LoadBalancer { -// processors = 1 , 1 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.3d.input b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.3d.input index f069d588..99c4a757 100644 --- a/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.3d.input +++ b/base/SAMRAI/SAMRAI/source/test/sundials/test_inputs/cvode_neu.3d.input @@ -3,16 +3,20 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for SAMRAI CVODE test program * ************************************************************************/ +//See cvode_dir.2d.input for documentation of input specific to this test. + + Main { dim = 3 init_time = 0.0 + init_cycle = 0 print_interval = 1.0e-2 num_print_intervals = 10 solution_logging = FALSE @@ -29,10 +33,6 @@ Main { uses_newton = TRUE uses_preconditioning = TRUE - viz_dump_filename = "rad3d" - viz_dump_dirname = "viz_rad3d" - viz_dump_interval = 0 - // Used for testing only correct_rhs_evals = 498 correct_precond_setups = 372 @@ -43,10 +43,6 @@ Main { CVODEModel { initial_value = 0.0 - max_fac_its = 1 - fac_tol = 1.e-40 - max_hypre_its = 1 - hypre_tol = 1.e-40 use_neumann_bcs = TRUE print_solver_info = FALSE @@ -159,12 +155,26 @@ CVODEModel { } } +fac_precond { + max_cycles = 1 + residual_tol = 1.e-40 +} + +hypre_solver { + use_smg = FALSE +} + StandardTagAndInitialize{ tagging_method = "REFINE_BOXES" - RefineBoxes { - level_0 = [ (0,0,0) , (9,4,9) ] - level_1 = [ (0,0,0) , (19,4,19) ] - level_2 = [ (0,0,0) , (39,4,39) ] + + level_0 { + boxes = [ (0,0,0) , (9,4,9) ] + } + level_1 { + boxes = [ (0,0,0) , (19,4,19) ] + } + level_2 { + boxes = [ (0,0,0) , (39,4,39) ] } } @@ -205,16 +215,15 @@ PatchHierarchy { } -GriddingAlgorithm { - +BergerRigoutsos { efficiency_tolerance = 0.70e0 // min % of tag cells in new patch level combine_efficiency = 0.85e0 // chop box if sum of volumes of smaller // boxes < efficiency * vol of large box +} +GriddingAlgorithm { } LoadBalancer { -// processors = 1 , 1 , 1 - use_spatial_bin_pack = TRUE } diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.C b/base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.C new file mode 100644 index 00000000..c63ca277 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.C @@ -0,0 +1,796 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Class used for auto testing applications + * + ************************************************************************/ + +#include "AutoTester.h" + +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/FlattenedHierarchy.h" +#include "SAMRAI/hier/HierarchyNeighbors.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/tbox/MathUtilities.h" + +AutoTester::AutoTester( + const std::string& object_name, + const tbox::Dimension& dim, + boost::shared_ptr input_db): + d_dim(dim), + d_base_name("unnamed") +#ifdef HAVE_HDF5 + , + d_hdf_db("AutoTesterDatabase") +#endif +{ + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + d_object_name = object_name; + d_test_fluxes = false; + d_test_iter_num = 10; + d_output_correct = false; + + d_write_patch_boxes = false; + d_read_patch_boxes = false; + d_test_patch_boxes_at_steps.resize(0); + d_test_patch_boxes_step_count = 0; + + getFromInput(input_db); + + std::string test_patch_boxes_filename = "test_inputs/"; +#if defined(__xlC__) +#ifdef OPT_BUILD + test_patch_boxes_filename += "xlC/"; +#else + test_patch_boxes_filename += "xlC_debug/"; +#endif +#endif + test_patch_boxes_filename += d_base_name + ".boxes"; + + const std::string hdf_filename = + test_patch_boxes_filename + + "." + tbox::Utilities::nodeToString(mpi.getSize()) + + "." + tbox::Utilities::processorToString(mpi.getRank()); + +#ifdef HAVE_HDF5 + if (d_read_patch_boxes) { + d_hdf_db.open(hdf_filename); + if (d_output_correct) { + d_hdf_db.printClassData(tbox::pout); + } + + } + + if (d_write_patch_boxes) { + d_hdf_db.create(hdf_filename); + } +#endif + +} + +AutoTester::~AutoTester() +{ +} + +/* + ****************************************************************** + * + * Method "evalTestData" compares the result of the run with + * the correct result for runs with the TimeRefinementIntegrator + * and HyperbolicLevelIntegrator. + * + ****************************************************************** + */ +int AutoTester::evalTestData( + int iter, + const boost::shared_ptr hierarchy, + const boost::shared_ptr tri, + const boost::shared_ptr hli, + const boost::shared_ptr ga) +{ + NULL_USE(ga); + + int num_failures = 0; + + /* + * Compare "correct_result" array to the computed result on specified + * iteration. + */ + if (iter == d_test_iter_num && !d_test_fluxes) { + + /* + * set precision of output stream. + */ + tbox::plog.precision(12); + + /* + * determine level. + */ + int nlevels = hierarchy->getNumberOfLevels() - 1; + boost::shared_ptr level( + hierarchy->getPatchLevel(nlevels)); + + /* + * Test 0: Time Refinement Integrator + */ + double time = tri->getIntegratorTime(); + if (d_correct_result.size() > 0) { + if (d_output_correct) { + tbox::plog << "Test 0: Time Refinement Integrator " + << "\n computed result: " << time; + + tbox::plog << "\n specified result = " + << d_correct_result[0]; + } + tbox::plog << std::endl; + + if (tbox::MathUtilities::equalEps(time, + d_correct_result[0])) { + tbox::plog << "Test 0: Time Refinement check successful" + << std::endl; + } else { + tbox::perr << "Test 0 FAILED: Check Time Refinement Integrator" + << std::endl; + ++num_failures; + } + } + + /* + * Test 1: Time Refinement Integrator + */ + double dt = tri->getLevelDtMax(nlevels); + if (d_correct_result.size() > 1) { + if (d_output_correct) { + tbox::plog << "Test 1: Time Refinement Integrator " + << "\n computed result: " << dt; + tbox::plog << "\n specified result = " + << d_correct_result[1]; + } + tbox::plog << std::endl; + + if (tbox::MathUtilities::equalEps(dt, d_correct_result[1])) { + tbox::plog << "Test 1: Time Refinement check successful" + << std::endl; + } else { + tbox::perr << "Test 1 FAILED: Check Time Refinement Integrator" + << std::endl; + ++num_failures; + } + } + + /* + * Test 2: Hyperbolic Level Integrator + */ + dt = hli->getLevelDt(level, time, false); + if (d_correct_result.size() > 2) { + if (d_output_correct) { + tbox::plog << "Test 2: Hyperbolic Level Integrator " + << "\n computed result: " << dt; + + tbox::plog << "\n specified result = " + << d_correct_result[2]; + } + tbox::plog << std::endl; + + if (tbox::MathUtilities::equalEps(dt, d_correct_result[2])) { + tbox::plog << "Test 2: Hyperbolic Level Int check successful" + << std::endl; + } else { + tbox::perr << "Test 2 FAILED: Check Hyperbolic Level Integrator" + << std::endl; + ++num_failures; + } + } + + /* + * Test 3: Gridding Algorithm + */ + int n = hierarchy->getMaxNumberOfLevels(); + if (d_output_correct) { + tbox::plog << "Test 3: Gridding Algorithm " + << "\n computed result: " << n; + tbox::plog << "\n correct result = " << nlevels + 1; + tbox::plog << std::endl; + } + if (n == (nlevels + 1)) { + tbox::plog << "Test 3: Gridding Algorithm check successful" + << std::endl; + } else { + tbox::perr << "Test 3 FAILED: Check Gridding Algorithm" << std::endl; + ++num_failures; + } + + num_failures += testHierarchyNeighbors(hierarchy); + num_failures += testFlattenedHierarchy(hierarchy); + + } + + if ((static_cast(d_test_patch_boxes_at_steps.size()) > + d_test_patch_boxes_step_count) && + (d_test_patch_boxes_at_steps[d_test_patch_boxes_step_count] == iter)) { + + int num_levels = hierarchy->getNumberOfLevels(); + +#ifdef HAVE_HDF5 + if (d_read_patch_boxes) { + + if (d_output_correct) { + d_hdf_db.printClassData(tbox::pout); + } + + const std::string step_name = + std::string("step_number_") + tbox::Utilities::intToString( + d_test_patch_boxes_step_count, + 2); + std::cout << std::endl; + boost::shared_ptr step_db( + d_hdf_db.getDatabase(step_name)); + + /* + * TODO: This check give false positives!!!!! + * It writes the same file regardless of the number of processors. + * We should be checking against base runs with the same number of processors, + * compare different data. + */ + for (int ln = 0; ln < num_levels; ++ln) { + + const std::string level_name = + std::string("level_number_") + tbox::Utilities::levelToString(ln); + boost::shared_ptr grid_geometry( + hierarchy->getGridGeometry()); + boost::shared_ptr level_db( + step_db->getDatabase(level_name)); + hier::BoxLevel correct_box_level(d_dim, *level_db, grid_geometry); + + num_failures += checkHierarchyBoxes(hierarchy, + ln, + correct_box_level, + iter); + } + + } + + if (d_write_patch_boxes) { + + const std::string step_name = + std::string("step_number_") + tbox::Utilities::intToString( + d_test_patch_boxes_step_count, + 2); + std::cout << std::endl; + boost::shared_ptr step_db( + d_hdf_db.putDatabase(step_name)); + + for (int ln = 0; ln < num_levels; ++ln) { + boost::shared_ptr level( + hierarchy->getPatchLevel(ln)); + + const std::string level_name = + std::string("level_number_") + tbox::Utilities::levelToString(ln); + boost::shared_ptr level_db( + step_db->putDatabase(level_name)); + level->getBoxLevel()->putToRestart(level_db); + } + + if (d_output_correct) { + d_hdf_db.printClassData(tbox::pout); + } + } +#endif + + ++d_test_patch_boxes_step_count; + + } + + return num_failures; +} + +/* + ****************************************************************** + * + * Method "evalTestData" compares the result of the run with + * the correct result for runs with the MethodOfLinesIntegrator. + * + ****************************************************************** + */ +int AutoTester::evalTestData( + int iter, + const boost::shared_ptr hierarchy, + double time, + const boost::shared_ptr mol, + const boost::shared_ptr ga) +{ + NULL_USE(ga); + + int num_failures = 0; + + /* + * Compare "correct_result" array to the computed result on specified + * iteration. + */ + if (iter == d_test_iter_num && !d_test_fluxes) { + + /* + * set precision of output stream. + */ + tbox::plog.precision(12); + + /* + * determine level. + */ + int nlevels = hierarchy->getNumberOfLevels() - 1; + boost::shared_ptr level( + hierarchy->getPatchLevel(nlevels)); + + /* + * Test 0: Time test + */ + if (d_correct_result.size() > 0) { + if (d_output_correct) { + tbox::plog << "Test 0: Simulation Time: " + << "\n computed result: " << time; + tbox::plog << "\n specified result = " + << d_correct_result[0]; + } + tbox::plog << std::endl; + + if (tbox::MathUtilities::equalEps(time, + d_correct_result[0])) { + tbox::plog << "Test 0: Simulation Time check successful" + << std::endl; + } else { + tbox::perr << "Test 0 FAILED: Simulation time incorrect" + << std::endl; + ++num_failures; + } + } + + /* + * Test 1: MethodOfLinesIntegrator + */ + double dt = mol->getTimestep(hierarchy, time); + if (d_correct_result.size() > 1) { + if (d_output_correct) { + tbox::plog << "Test 1: Method of Lines Integrator " + << "\n computed result: " << dt; + tbox::plog << "\n specified result = " + << d_correct_result[1]; + } + tbox::plog << std::endl; + + if (tbox::MathUtilities::equalEps(dt, d_correct_result[1])) { + tbox::plog << "Test 1: MOL Int check successful" << std::endl; + } else { + tbox::perr << "Test 1 FAILED: Check Method of Lines Integrator" + << std::endl; + ++num_failures; + } + } + + /* + * Test 2: Gridding Algorithm + */ + int n = hierarchy->getMaxNumberOfLevels(); + if (d_output_correct) { + tbox::plog << "Test 2: Gridding Algorithm " + << "\n computed result: " << n; + tbox::plog << "\n correct result = " << nlevels + 1; + tbox::plog << std::endl; + } + if (n == (nlevels + 1)) { + tbox::plog << "Test 2: Gridding Alg check successful" << std::endl; + } else { + tbox::perr << "Test 2 FAILED: Check Gridding Algorithm" << std::endl; + ++num_failures; + } + + num_failures += testHierarchyNeighbors(hierarchy); + num_failures += testFlattenedHierarchy(hierarchy); + + } + + if ((static_cast(d_test_patch_boxes_at_steps.size()) > 0) && + (d_test_patch_boxes_at_steps[d_test_patch_boxes_step_count] == iter)) { + + int num_levels = hierarchy->getNumberOfLevels(); + +#ifdef HAVE_HDF5 + if (d_read_patch_boxes) { + + if (d_output_correct) { + d_hdf_db.printClassData(tbox::pout); + } + + const std::string step_name = + std::string("step_number_") + tbox::Utilities::intToString( + d_test_patch_boxes_step_count, + 2); + std::cout << std::endl; + boost::shared_ptr step_db( + d_hdf_db.getDatabase(step_name)); + + for (int ln = 0; ln < num_levels; ++ln) { + + const std::string level_name = + std::string("level_number_") + tbox::Utilities::levelToString(ln); + boost::shared_ptr grid_geometry( + hierarchy->getGridGeometry()); + boost::shared_ptr level_db( + step_db->getDatabase(level_name)); + hier::BoxLevel correct_box_level(d_dim, *level_db, grid_geometry); + + num_failures += checkHierarchyBoxes(hierarchy, + ln, + correct_box_level, + iter); + } + + } + + if (d_write_patch_boxes) { + + if (d_output_correct) { + d_hdf_db.printClassData(tbox::pout); + } + + const std::string step_name = + std::string("step_number_") + tbox::Utilities::intToString( + d_test_patch_boxes_step_count, + 2); + std::cout << std::endl; + boost::shared_ptr step_db( + d_hdf_db.putDatabase(step_name)); + + for (int ln = 0; ln < num_levels; ++ln) { + boost::shared_ptr level( + hierarchy->getPatchLevel(ln)); + + const std::string level_name = + std::string("level_number_") + tbox::Utilities::levelToString(ln); + boost::shared_ptr level_db( + step_db->putDatabase(level_name)); + level->getBoxLevel()->putToRestart(level_db); + } + + } +#endif + + ++d_test_patch_boxes_step_count; + + } + + return num_failures; +} + +int AutoTester::testHierarchyNeighbors( + const boost::shared_ptr& hierarchy) +{ + int num_failures = 0; + int num_levels = hierarchy->getNumberOfLevels(); + hier::HierarchyNeighbors hier_nbrs(*hierarchy, 0, num_levels-1); + for (int ln = 0; ln < num_levels; ++ln) { + const boost::shared_ptr& current_level = + hierarchy->getPatchLevel(ln); + + if (ln < num_levels-1) { + + boost::shared_ptr finer_level( + hierarchy->getPatchLevel(ln+1)); + + const hier::Connector& coarse_to_fine = + current_level->findConnector( + *finer_level, + hier::IntVector::getOne(hierarchy->getDim()), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (hier::Connector::ConstNeighborhoodIterator cf = + coarse_to_fine.begin(); cf != coarse_to_fine.end(); ++cf) { + + const hier::BoxId& crse_box_id(*cf); + const hier::Box& crse_box = + *(current_level->getBoxLevel()->getBox(crse_box_id)); + const hier::BoxContainer& finer_nbrs = + hier_nbrs.getFinerLevelNeighbors(crse_box, ln); + TBOX_ASSERT(finer_nbrs.isOrdered()); + + for (hier::Connector::ConstNeighborIterator ni = + coarse_to_fine.begin(cf); + ni != coarse_to_fine.end(cf); ++ni) { + + const hier::Box& fine_box = *ni; + if (finer_nbrs.find(fine_box) == finer_nbrs.end()) { + tbox::perr << "Test fine FAILED" << std::endl; + ++num_failures; + } + } + } + } + + if (ln > 0) { + + boost::shared_ptr coarser_level( + hierarchy->getPatchLevel(ln-1)); + + const hier::Connector& fine_to_coarse = + current_level->findConnector( + *coarser_level, + hier::IntVector::getOne(hierarchy->getDim()), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (hier::Connector::ConstNeighborhoodIterator fc = + fine_to_coarse.begin(); fc != fine_to_coarse.end(); ++fc) { + + const hier::BoxId& fine_box_id(*fc); + const hier::Box& fine_box = + *(current_level->getBoxLevel()->getBox(fine_box_id)); + const hier::BoxContainer& coarser_nbrs = + hier_nbrs.getCoarserLevelNeighbors(fine_box, ln); + TBOX_ASSERT(coarser_nbrs.isOrdered()); + + for (hier::Connector::ConstNeighborIterator ni = + fine_to_coarse.begin(fc); + ni != fine_to_coarse.end(fc); ++ni) { + + const hier::Box& coarse_box = *ni; + if (coarser_nbrs.find(coarse_box) == coarser_nbrs.end()) { + tbox::perr << "Test coarse FAILED" << std::endl; + ++num_failures; + } + } + } + } + + const hier::Connector& current_to_current = + current_level->findConnector( + *current_level, + hier::IntVector::getOne(hierarchy->getDim()), + hier::CONNECTOR_IMPLICIT_CREATION_RULE, + true); + + for (hier::Connector::ConstNeighborhoodIterator cc = + current_to_current.begin(); cc != current_to_current.end(); ++cc) { + + const hier::BoxId& current_box_id(*cc); + const hier::Box& current_box = + *(current_level->getBoxLevel()->getBox(current_box_id)); + const hier::BoxContainer& same_nbrs = + hier_nbrs.getSameLevelNeighbors(current_box, ln); + TBOX_ASSERT(same_nbrs.isOrdered() || same_nbrs.empty()); + + for (hier::Connector::ConstNeighborIterator ni = + current_to_current.begin(cc); + ni != current_to_current.end(cc); ++ni) { + + const hier::Box& nbr_box = *ni; + if (nbr_box.getBoxId() != current_box.getBoxId()) { + if (same_nbrs.find(nbr_box) == same_nbrs.end()) { + tbox::perr << "Test same FAILED" << std::endl; + ++num_failures; + } + } + } + } + } + + return num_failures; +} + +int AutoTester::testFlattenedHierarchy( + const boost::shared_ptr& hierarchy) +{ + int num_failures = 0; + int num_levels = hierarchy->getNumberOfLevels(); + hier::FlattenedHierarchy flat_hier(*hierarchy, 0, num_levels-1); + + const boost::shared_ptr& level_zero = + hierarchy->getPatchLevel(0); + + double level_zero_size = + static_cast(level_zero->getBoxLevel()->getGlobalNumberOfCells()); + + double local_size = 0.0; + + hier::UncoveredBoxIterator itr = flat_hier.beginUncovered(); + hier::UncoveredBoxIterator flat_end = flat_hier.endUncovered(); + for ( ; itr != flat_end; ++itr) { + + const hier::IntVector& ratio_to_zero = + itr->first->getPatchGeometry()->getRatio(); + + const hier::BlockId& block_id = itr->second.getBlockId(); + double refine_quotient = + static_cast(ratio_to_zero.getProduct(block_id)); + + double cell_value = 1.0 / refine_quotient; + local_size += (cell_value * static_cast(itr->second.size())); + + } + + double global_flat_size = local_size; + if (hierarchy->getMPI().AllReduce(&global_flat_size, 1, MPI_SUM) != MPI_SUCCESS) { + tbox::perr << "FAILED: - AutoTester " << "\n" + << "MPI sum reduction failed" << std::endl; + num_failures++; + } + + if (tbox::MathUtilities::Abs(global_flat_size-level_zero_size) > + 1.0e-8) { + tbox::perr << "FAILED: - AutoTester " << "\n" + << "Flattened hierarchy size not equivalent \n" + << "to level zero size." << std::endl; + num_failures++; + } + + return num_failures; +} + +/* + ****************************************************************** + * + * Get test parameters from input. + * + ****************************************************************** + */ + +void AutoTester::getFromInput( + boost::shared_ptr input_db) +{ + boost::shared_ptr tester_db( + input_db->getDatabase(d_object_name)); + boost::shared_ptr main_db( + input_db->getDatabase("Main")); + + /* + * Read testing parameters from testing_db + */ + if (tester_db->keyExists("test_fluxes")) { + d_test_fluxes = tester_db->getBool("test_fluxes"); + } + + if (tester_db->keyExists("test_iter_num")) { + d_test_iter_num = tester_db->getInteger("test_iter_num"); + } + + if (tester_db->keyExists("write_patch_boxes")) { + d_write_patch_boxes = tester_db->getBool("write_patch_boxes"); + } + if (tester_db->keyExists("read_patch_boxes")) { + d_read_patch_boxes = tester_db->getBool("read_patch_boxes"); + } + if (d_read_patch_boxes && d_write_patch_boxes) { + tbox::perr << "FAILED: - AutoTester " << d_object_name << "\n" + << "Cannot 'read_patch_boxes' and 'write_patch_boxes' \n" + << "at the same time." << std::endl; + } + d_base_name = main_db->getStringWithDefault("base_name", d_base_name); + if (d_read_patch_boxes || d_write_patch_boxes) { + if (!tester_db->keyExists("test_patch_boxes_at_steps")) { + tbox::perr << "FAILED: - AutoTester " << d_object_name << "\n" + << "Must provide 'test_patch_boxes_at_steps' data." + << std::endl; + } else { + d_test_patch_boxes_at_steps = + tester_db->getIntegerVector("test_patch_boxes_at_steps"); + } + } + + if (d_test_fluxes) { + + /* + * Read expected result for flux test... + * Fluxes not verified in this routine. Rather, we let it + * write the result and do a "diff" within the script + */ + + tbox::pout << "Do a diff on the resulting *.dat file to verify result." + << std::endl; + + } else { + + /* + * Read correct_result array for timestep test... + */ + if (tester_db->keyExists("correct_result")) { + d_correct_result = tester_db->getDoubleVector("correct_result"); + } else { + TBOX_WARNING("main.C: TESTING is on but no `correct_result' array" + << "is given in input file." << std::endl); + } + + /* Specify whether to output "correct_result" result */ + + if (tester_db->keyExists("output_correct")) { + d_output_correct = tester_db->getBool("output_correct"); + } + + } + +} + +int AutoTester::checkHierarchyBoxes( + const boost::shared_ptr hierarchy, + int level_number, + const hier::BoxLevel& correct_box_level, + int iter) +{ + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + + const boost::shared_ptr patch_level( + hierarchy->getPatchLevel(level_number)); + const hier::BoxLevel& box_level = *patch_level->getBoxLevel(); + + const int local_exact_match = box_level == correct_box_level; + + int global_exact_match = local_exact_match; + if (mpi.getSize() > 1) { + mpi.AllReduce(&global_exact_match, 1, MPI_MIN); + } + + /* + * Check to make sure hierarchy's BoxLevel and + * correct_box_level are identical. If not, write an error + * message. + */ + + int num_failures = 0; + + if (local_exact_match && global_exact_match) { + tbox::plog << "Test 4: Level " << level_number + << " BoxLevel check successful for step " << iter + << std::endl << std::endl; + } else { + tbox::perr << "Test 4: FAILED: Level " << level_number + << " hier::BoxLevel configuration doesn't match at step " << iter + << std::endl << std::endl; + + hier::BoxContainer correct_minus_computed( + correct_box_level.getGlobalizedVersion().getGlobalBoxes()); + correct_minus_computed.unorder(); + correct_minus_computed.removeIntersections( + box_level.getGlobalizedVersion().getGlobalBoxes()); + + hier::BoxContainer computed_minus_correct( + box_level.getGlobalizedVersion().getGlobalBoxes()); + computed_minus_correct.unorder(); + computed_minus_correct.removeIntersections( + correct_box_level.getGlobalizedVersion().getGlobalBoxes()); + + tbox::plog << " global correct_box_level \\ box_level:\n" + << correct_minus_computed.format("\t"); + tbox::plog << " global box_level \\ correct_box_level:\n" + << computed_minus_correct.format("\t"); + tbox::plog << " correct_box_level:\n" << correct_box_level.format(" ", 2) << '\n' + << " box_level:\n" << box_level.format(" ", 2) << "\n\n"; + ++num_failures; + } + + if (d_output_correct) { + + tbox::pout << "-------------------------------------------------------" + << std::endl; + + if (!local_exact_match) { + tbox::pout << "LOCAL BOX LEVEL DOES NOT MATCH " + << "ON LEVEL: " << level_number << std::endl; + } + + if (!global_exact_match) { + tbox::pout << "GLOBAL BOX LEVEL DOES NOT MATCH " + << "ON LEVEL: " << level_number << std::endl; + } + tbox::pout << "BoxLevel: " << std::endl; + box_level.recursivePrint(tbox::pout, "", 3); + tbox::pout << "correct BoxLevel: " << std::endl; + correct_box_level.recursivePrint(tbox::pout, "", 3); + + tbox::pout << "-------------------------------------------------------" + << std::endl << std::endl; + + } + + return num_failures; +} diff --git a/base/SAMRAI/SAMRAI/source/test/applications/AutoTester.h b/base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.h similarity index 82% rename from base/SAMRAI/SAMRAI/source/test/applications/AutoTester.h rename to base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.h index 666ab976..722a6e0b 100644 --- a/base/SAMRAI/SAMRAI/source/test/applications/AutoTester.h +++ b/base/SAMRAI/SAMRAI/source/test/testlib/AutoTester.h @@ -3,8 +3,8 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple class used for autotesting. * ************************************************************************/ @@ -14,7 +14,6 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Database.h" #include "SAMRAI/algs/HyperbolicLevelIntegrator.h" #include "SAMRAI/algs/MethodOfLinesIntegrator.h" @@ -23,7 +22,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/algs/TimeRefinementIntegrator.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; @@ -93,9 +92,17 @@ class AutoTester checkHierarchyBoxes( const boost::shared_ptr hierarchy, int ln, - const hier::BoxLevel& correct_mapped_box_level, + const hier::BoxLevel& correct_box_level, int iter); + static int + testHierarchyNeighbors( + const boost::shared_ptr& hierarchy); + + static int + testFlattenedHierarchy( + const boost::shared_ptr& hierarchy); + private: /* * Sets the parameters in the struct, based @@ -113,17 +120,17 @@ class AutoTester bool d_output_correct; // output result? int d_test_iter_num; // iteration number to check result. - tbox::Array d_correct_result; // array to hold correct values + std::vector d_correct_result; // array to hold correct values //!@brief Time steps at which to checkHierarchyBoxes(). - tbox::Array d_test_patch_boxes_at_steps; + std::vector d_test_patch_boxes_at_steps; //!@brief checkHierarchyBoxes() at d_test_patch_boxes_at_steps[d_test_patch_boxes_step_count]. int d_test_patch_boxes_step_count; - //!@brief File containing "correct" results used by checkHierarchyBoxes(). - std::string d_test_patch_boxes_filename; - //!@brief Whether to write file d_test_patch_boxes_filename. + //!@brief Base name of files used in the run and regression test. + std::string d_base_name; + //!@brief Whether to write file of boxes for regression check. bool d_write_patch_boxes; - //!@brief Whether to read file d_test_patch_boxes_filename. + //!@brief Whether to read file of boxes for regression check. bool d_read_patch_boxes; #ifdef HAVE_HDF5 diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.C b/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.C new file mode 100644 index 00000000..c5a33b37 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.C @@ -0,0 +1,63 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: TreeLoadBalancer test. + * + ************************************************************************/ +#include "DerivedVisOwnerData.h" +#include "SAMRAI/tbox/SAMRAI_MPI.h" +#include "SAMRAI/tbox/SAMRAIManager.h" + +using namespace SAMRAI; + +DerivedVisOwnerData::DerivedVisOwnerData() +{ +} + +DerivedVisOwnerData::~DerivedVisOwnerData() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +#ifdef HAVE_HDF5 +int DerivedVisOwnerData::registerVariablesWithPlotter( + appu::VisItDataWriter& writer) +{ + writer.registerDerivedPlotQuantity("Owner", "SCALAR", this); + return 0; +} +#endif + +bool DerivedVisOwnerData::packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_id, + double simulation_time) const +{ + NULL_USE(patch); + NULL_USE(depth_id); + NULL_USE(simulation_time); + + if (variable_name == "Owner") { + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + double owner = mpi.getRank(); + size_t i, size = region.size(); + for (i = 0; i < size; ++i) buffer[i] = owner; + } else { + // Did not register this name. + TBOX_ERROR( + "Unregistered variable name '" << variable_name << "' in\n" + << + "DerivedVisOwnerData::packDerivedPatchDataIntoDoubleBuffer"); + } + + return true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.h b/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.h new file mode 100644 index 00000000..724aed2e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/DerivedVisOwnerData.h @@ -0,0 +1,70 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: TreeLoadBalancer test. + * + ************************************************************************/ +#ifndef included_DerivedVisOwnerData +#define included_DerivedVisOwnerData + +#include + +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/Patch.h" + +#include "SAMRAI/tbox/Database.h" + +/* + * SAMRAI classes + */ +#include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/appu/VisDerivedDataStrategy.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Write owner rank using VisDerivedDataStrategy. + */ +class DerivedVisOwnerData: + public appu::VisDerivedDataStrategy +{ + +public: + /*! + * @brief Constructor. + */ + DerivedVisOwnerData(); + + ~DerivedVisOwnerData(); + +#ifdef HAVE_HDF5 + /*! + * @brief Tell a VisIt plotter which data to write for this class. + */ + int + registerVariablesWithPlotter( + appu::VisItDataWriter& writer); +#endif + + //@{ @name SAMRAI::appu::VisDerivedDataStrategy virtuals + + virtual bool + packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_id, + double simulation_time) const; + + //@} + +private: +}; + +#endif // included_DerivedVisOwnerData diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/GeomUtilsAMR.h b/base/SAMRAI/SAMRAI/source/test/testlib/GeomUtilsAMR.h new file mode 100644 index 00000000..68d7a635 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/GeomUtilsAMR.h @@ -0,0 +1,449 @@ +/************************************************************************** + * Module: GeomUtilsAMR + * Purpose: inline functions + ***************************************************************************/ + +#ifndef __GeomUtilsAMR_h +#define __GeomUtilsAMR_h + +// +// calculate the flux through a face +// +real8 +UpwindFlux( + const real8 x1, + const real8 x2, + const real8 x3, + const real8 x4, + const real8 y1, + const real8 y2, + const real8 y3, + const real8 y4, + const real8 z1, + const real8 z2, + const real8 z3, + const real8 z4, + real8 u, + real8 v, + real8 w, + real8 psiLo, + real8 psiHi) +{ + real8 dx31 = x3 - x1; + real8 dx42 = x4 - x2; + + real8 dy31 = y3 - y1; + real8 dy42 = y4 - y2; + + real8 dz31 = z3 - z1; + real8 dz42 = z4 - z2; + + real8 Ax = 0.5 * (dy42 * dz31 - dz42 * dy31); + real8 Ay = 0.5 * (dz42 * dx31 - dx42 * dz31); + real8 Az = 0.5 * (dx42 * dy31 - dy42 * dx31); + + real8 Audotn = Ax * u + Ay * v + Az * w; + + real8 flux = (Audotn > 0.0 ? psiLo : psiHi) * Audotn; + + return flux; +} + +// +// calculate the flux through a face, assuming a velocity in the radial +// direction +// +real8 +UpwindFluxRadial( + const real8 x1, + const real8 x2, + const real8 x3, + const real8 x4, + const real8 y1, + const real8 y2, + const real8 y3, + const real8 y4, + const real8 z1, + const real8 z2, + const real8 z3, + const real8 z4, + real8 u0, + real8 psiLo, + real8 psiHi) +{ + // --------- set the velocity + real8 xm = 0.25 * (x1 + x2 + x3 + x4); + real8 ym = 0.25 * (y1 + y2 + y3 + y4); + real8 zm = 0.25 * (z1 + z2 + z3 + z4); + real8 xnorm = sqrt(xm * xm + ym * ym + zm * zm); + + real8 u = u0 * xm / xnorm; + real8 v = u0 * ym / xnorm; + real8 w = u0 * zm / xnorm; + + // --------- set the flux + real8 dx31 = x3 - x1; + real8 dx42 = x4 - x2; + + real8 dy31 = y3 - y1; + real8 dy42 = y4 - y2; + + real8 dz31 = z3 - z1; + real8 dz42 = z4 - z2; + + real8 Ax = 0.5 * (dy42 * dz31 - dz42 * dy31); + real8 Ay = 0.5 * (dz42 * dx31 - dx42 * dz31); + real8 Az = 0.5 * (dx42 * dy31 - dy42 * dx31); + + real8 Audotn = Ax * u + Ay * v + Az * w; + + real8 flux = (Audotn > 0.0 ? psiLo : psiHi) * Audotn; + + return flux; +} + +// +// calculate the volume of a hexahedral element +// +real8 +UpwindVolume( + const real8 x0, + const real8 x1, + const real8 x2, + const real8 x3, + const real8 x4, + const real8 x5, + const real8 x6, + const real8 x7, + const real8 y0, + const real8 y1, + const real8 y2, + const real8 y3, + const real8 y4, + const real8 y5, + const real8 y6, + const real8 y7, + const real8 z0, + const real8 z1, + const real8 z2, + const real8 z3, + const real8 z4, + const real8 z5, + const real8 z6, + const real8 z7) +{ + const real8 twelfth = 1.0 / 12.0; + real8 volume, s1234, s5678, s1265, s4378, s2376, s1485; + + s1234 = + (x1 + x2) * ((y0 + y1) * (z2 + z3) - (z0 + z1) * (y2 + y3)) + + (y1 + y2) * ((z0 + z1) * (x2 + x3) - (x0 + x1) * (z2 + z3)) + + (z1 + z2) * ((x0 + x1) * (y2 + y3) - (y0 + y1) * (x2 + x3)); + + s5678 = + (x5 + x6) * ((y4 + y5) * (z6 + z7) - (z4 + z5) * (y6 + y7)) + + (y5 + y6) * ((z4 + z5) * (x6 + x7) - (x4 + x5) * (z6 + z7)) + + (z5 + z6) * ((x4 + x5) * (y6 + y7) - (y4 + y5) * (x6 + x7)); + + s1265 = + (x1 + x5) * ((y0 + y1) * (z5 + z4) - (z0 + z1) * (y5 + y4)) + + (y1 + y5) * ((z0 + z1) * (x5 + x4) - (x0 + x1) * (z5 + z4)) + + (z1 + z5) * ((x0 + x1) * (y5 + y4) - (y0 + y1) * (x5 + x4)); + + s4378 = + (x2 + x6) * ((y3 + y2) * (z6 + z7) - (z3 + z2) * (y6 + y7)) + + (y2 + y6) * ((z3 + z2) * (x6 + x7) - (x3 + x2) * (z6 + z7)) + + (z2 + z6) * ((x3 + x2) * (y6 + y7) - (y3 + y2) * (x6 + x7)); + + s2376 = + (x2 + x6) * ((y1 + y2) * (z6 + z5) - (z1 + z2) * (y6 + y5)) + + (y2 + y6) * ((z1 + z2) * (x6 + x5) - (x1 + x2) * (z6 + z5)) + + (z2 + z6) * ((x1 + x2) * (y6 + y5) - (y1 + y2) * (x6 + x5)); + + s1485 = + (x3 + x7) * ((y0 + y3) * (z7 + z4) - (z0 + z3) * (y7 + y4)) + + (y3 + y7) * ((z0 + z3) * (x7 + x4) - (x0 + x3) * (z7 + z4)) + + (z3 + z7) * ((x0 + x3) * (y7 + y4) - (y0 + y3) * (x7 + x4)); + + volume = (s1234 - s5678 - s1265 + s4378 - s2376 + s1485) * twelfth; + return volume; +} + +// +// compute the area of a face +// +real8 +UpwindAreaFace( + const real8 x0, + const real8 x1, + const real8 x2, + const real8 x3, + const real8 y0, + const real8 y1, + const real8 y2, + const real8 y3, + const real8 z0, + const real8 z1, + const real8 z2, + const real8 z3) +{ + real8 fx = (x2 - x0) - (x3 - x1); + real8 fy = (y2 - y0) - (y3 - y1); + real8 fz = (z2 - z0) - (z3 - z1); + real8 gx = (x2 - x0) + (x3 - x1); + real8 gy = (y2 - y0) + (y3 - y1); + real8 gz = (z2 - z0) + (z3 - z1); + real8 area = + (fx * fx + fy * fy + fz * fz) + * (gx * gx + gy * gy + gz * gz) + - (fx * gx + fy * gy + fz * gz) + * (fx * gx + fy * gy + fz * gz); + return area; +} + +// +// compute a characteristic length +// +real8 +UpwindCharacteristicLength( + const real8 x[8], + const real8 y[8], + const real8 z[8], + const real8 volume) +{ + real8 a, charLength = 0.0; + + a = UpwindAreaFace(x[0], x[1], x[2], x[3], + y[0], y[1], y[2], y[3], + z[0], z[1], z[2], z[3]); + charLength = MAX(a, charLength); + + a = UpwindAreaFace(x[4], x[5], x[6], x[7], + y[4], y[5], y[6], y[7], + z[4], z[5], z[6], z[7]); + charLength = MAX(a, charLength); + + a = UpwindAreaFace(x[0], x[1], x[5], x[4], + y[0], y[1], y[5], y[4], + z[0], z[1], z[5], z[4]); + charLength = MAX(a, charLength); + + a = UpwindAreaFace(x[1], x[2], x[6], x[5], + y[1], y[2], y[6], y[5], + z[1], z[2], z[6], z[5]); + charLength = MAX(a, charLength); + + a = UpwindAreaFace(x[2], x[3], x[7], x[6], + y[2], y[3], y[7], y[6], + z[2], z[3], z[7], z[6]); + charLength = MAX(a, charLength); + + a = UpwindAreaFace(x[3], x[0], x[4], x[7], + y[3], y[0], y[4], y[7], + z[3], z[0], z[4], z[7]); + charLength = MAX(a, charLength); + + charLength = 4.0 * volume / sqrt(charLength); + + return charLength; +} + +/// +/// the non-uniform grid monotonic slope finder +/// +void +my_slopes( + double psi, + double pim, + double pip, + double pjm, + double pjp, + double pkm, + double pkp, + double w_i, + double w_ip, + double w_im, + double w_jp, + double w_jm, + double w_kp, + double w_km, + double& pxi, + double& peta, + double& pzeta) +{ + real8 sumf, sumb; + real8 elDenm, elDenp, del, sfp, sbm, scale; + + real8 elDenC = psi; + real8 scale_fact = 1.0; + real8 slope_fact = 1.0; + + // + // compute weight functions + // + real8 volzrc = w_i; + + real8 volzrxim = w_im; + real8 volzrxip = w_ip; + real8 volzretam = w_jm; + real8 volzretap = w_jp; + real8 volzrzetam = w_km; + real8 volzrzetap = w_kp; + + sumf = volzrc + volzrxip; + sumb = volzrc + volzrxim; + real8 wgtxi1 = volzrc / sumf; + real8 wgtxi2 = volzrxip / sumf; + real8 wgtxi3 = volzrc / sumb; + real8 wgtxi4 = volzrxim / sumb; + + sumf = volzrc + volzretap; + sumb = volzrc + volzretam; + real8 wgteta1 = volzrc / sumf; + real8 wgteta2 = volzretap / sumf; + real8 wgteta3 = volzrc / sumb; + real8 wgteta4 = volzretam / sumb; + + sumf = volzrc + volzrzetap; + sumb = volzrc + volzrzetam; + real8 wgtzeta1 = volzrc / sumf; + real8 wgtzeta2 = volzrzetap / sumf; + real8 wgtzeta3 = volzrc / sumb; + real8 wgtzeta4 = volzrzetam / sumb; + + elDenm = pim; + elDenp = pip; + + del = (wgtxi2 * elDenp + wgtxi1 * elDenC + - wgtxi4 * elDenm - wgtxi3 * elDenC) + 1e-80; + + sfp = (elDenp - elDenC) * scale_fact / del; + sbm = (elDenC - elDenm) * scale_fact / del; + + scale = MIN(sfp, sbm); + if (scale > 1.) + scale = 1.0; + else if (scale < 0.) + scale = 0.; + + if ((sfp * sbm) < 0.0) scale = 0.; + + pxi = slope_fact * del * scale; + + // --------------------------------- eta + + elDenm = pjm; + elDenp = pjp; + + del = (wgteta2 * elDenp + wgteta1 * elDenC + - wgteta4 * elDenm - wgteta3 * elDenC) + 1e-80; + + sfp = (elDenp - elDenC) * scale_fact / del; + sbm = (elDenC - elDenm) * scale_fact / del; + + scale = MIN(sfp, sbm); + if (scale > 1.) + scale = 1.0; + else if (scale < 0.) + scale = 0.; + + if ((sfp * sbm) < 0.0) scale = 0.; + + peta = slope_fact * del * scale; + + // --------------------------------- zeta + + elDenm = pkm; + elDenp = pkp; + + del = (wgtzeta2 * elDenp + wgtzeta1 * elDenC + - wgtzeta4 * elDenm - wgtzeta3 * elDenC) + 1e-80; + + sfp = (elDenp - elDenC) * scale_fact / del; + sbm = (elDenC - elDenm) * scale_fact / del; + + scale = MIN(sfp, sbm); + if (scale > 1.) + scale = 1.0; + else if (scale < 0.) + scale = 0.; + + if ((sfp * sbm) < 0.0) scale = 0.; + + pzeta = slope_fact * del * scale; +} + +/// +/// the cartesian uniform grid monotonic slope finder +/// +void +my_slopesCart( + double psi, + double pim, + double pip, + double pjm, + double pjp, + double pkm, + double pkp, + double& pxi, + double& peta, + double& pzeta) +{ + real8 del, sfp, sbm, scale; + real8 elDenp, elDenC, elDenm; + real8 sfact = 0.25; // due to the fact that xi ranges from -1 to 1 + elDenC = psi; + + // + // xi + // + elDenp = pip; + elDenm = pim; + + del = sfact * (elDenp - elDenm) + 1.e-80; + sfp = (elDenp - elDenC) * 2. / del; + sbm = (elDenC - elDenm) * 2. / del; + + scale = MIN(sfp, sbm); + scale = (scale > 1.0 ? 1.0 : scale); + scale = (scale < 0.0 ? 0.0 : scale); + scale = (sfp * sbm < 0.0 ? 0.0 : scale); + + pxi = del * scale; // xi, eta, zeta vary from -1 to 1 + + // + // eta + // + elDenp = pjp; + elDenm = pjm; + + del = sfact * (elDenp - elDenm) + 1.e-80; + sfp = (elDenp - elDenC) * 2. / del; + sbm = (elDenC - elDenm) * 2. / del; + + scale = MIN(sfp, sbm); + scale = (scale > 1.0 ? 1.0 : scale); + scale = (scale < 0.0 ? 0.0 : scale); + scale = (sfp * sbm < 0.0 ? 0.0 : scale); + + peta = del * scale; + + // + // eta + // + elDenp = pkp; + elDenm = pkm; + + del = sfact * (elDenp - elDenm) + 1.e-80; + sfp = (elDenp - elDenC) * 2. / del; + sbm = (elDenC - elDenm) * 2. / del; + + scale = MIN(sfp, sbm); + scale = (scale > 1.0 ? 1.0 : scale); + scale = (scale < 0.0 ? 0.0 : scale); + scale = (sfp * sbm < 0.0 ? 0.0 : scale); + + pzeta = del * scale; +} + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.depend new file mode 100644 index 00000000..52e9c66c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.depend @@ -0,0 +1,1260 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=AutoTester.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicLevelIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/HyperbolicPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/MethodOfLinesPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegrator.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementIntegratorConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/FlattenedHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/HierarchyNeighbors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/OverlapConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmConnectorWidthRequestor.h\ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/LoadBalanceStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/MultiblockGriddingTagger.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RankGroup.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h AutoTester.C \ + AutoTester.h + +DEPENDS_0 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=DerivedVisOwnerData.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.C \ + DerivedVisOwnerData.h + +DEPENDS_1 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=MblkHyperbolicLevelIntegrator.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/algs/TimeRefinementLevelStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataRestartManager.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseFactory.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistic.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + MblkHyperbolicLevelIntegrator.C MblkHyperbolicLevelIntegrator.h \ + MblkHyperbolicPatchStrategy.h + +DEPENDS_2 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/FaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OutersideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=MblkHyperbolicPatchStrategy.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/GriddingAlgorithmStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/TagAndInitializeStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Schedule.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Transaction.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/CoarsenPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/PatchLevelFillPattern.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineClasses.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefinePatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineSchedule.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/RefineTransactionFactory.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/SingularityPatchStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/xfer/VariableFillPattern.h \ + MblkHyperbolicPatchStrategy.C MblkHyperbolicPatchStrategy.h + +DEPENDS_3 +=\ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_3}: ${DEPENDS_3} + +FILE_4=MeshGenerationStrategy.o +DEPENDS_4:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h MeshGenerationStrategy.C \ + MeshGenerationStrategy.h + +DEPENDS_4 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_4}: ${DEPENDS_4} + +FILE_5=ShrunkenLevelGenerator.o +DEPENDS_5:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ + MeshGenerationStrategy.h ShrunkenLevelGenerator.C \ + ShrunkenLevelGenerator.h + +DEPENDS_5 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_5}: ${DEPENDS_5} + +FILE_6=SinusoidalFrontGenerator.o +DEPENDS_6:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ + MeshGenerationStrategy.h SinusoidalFrontGenerator.C \ + SinusoidalFrontGenerator.h + +DEPENDS_6 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_6}: ${DEPENDS_6} + +FILE_7=SkeletonBoundaryUtilities2.o +DEPENDS_7:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + SkeletonBoundaryUtilities2.C SkeletonBoundaryUtilities2.h + +DEPENDS_7 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_7}: ${DEPENDS_7} + +FILE_8=SkeletonBoundaryUtilities3.o +DEPENDS_8:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/BoundaryUtilityStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/CartesianBoundaryDefines.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + SkeletonBoundaryUtilities3.C SkeletonBoundaryUtilities3.h + +DEPENDS_8 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_8}: ${DEPENDS_8} + +FILE_9=SkeletonCellDoubleConservativeLinearRefine.o +DEPENDS_9:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + SkeletonCellDoubleConservativeLinearRefine.C \ + SkeletonCellDoubleConservativeLinearRefine.h + +DEPENDS_9 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_9}: ${DEPENDS_9} + +FILE_10=SkeletonCellDoubleWeightedAverage.o +DEPENDS_10:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h \ + SkeletonCellDoubleWeightedAverage.C \ + SkeletonCellDoubleWeightedAverage.h + +DEPENDS_10 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_10}: ${DEPENDS_10} + +FILE_11=SphericalShellGenerator.o +DEPENDS_11:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisDerivedDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisItDataWriter.h \ + $(INCLUDE_SAM)/SAMRAI/appu/VisMaterialsDataStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/CartesianPatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/geom/GridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BaseGridGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BlockId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoundaryBox.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Box.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainer.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxContainerSingleBlockIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelConnectorUtils.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxLevelHandle.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxNeighborhoodCollection.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/hier/BoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/CoarsenOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ComponentSelector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Connector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/GlobalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Index.h \ + $(INCLUDE_SAM)/SAMRAI/hier/IntVector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnector.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MappingConnectorAlgorithm.h \ + $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Patch.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchBoundaries.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchData.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchHierarchy.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ + $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ + $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ + $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ + $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BergerRigoutsos.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/BoxGeneratorStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/mesh/StandardTagAndInitStrategy.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIndex.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeIterator.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeOverlap.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeGeometry.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommStage.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Dimension.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/HDFDatabase.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h DerivedVisOwnerData.h \ + MeshGenerationStrategy.h SphericalShellGenerator.C \ + SphericalShellGenerator.h + +DEPENDS_11 +=\ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CellVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/CopyOperation.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/NodeVariable.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeData.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/OuternodeDataFactory.C \ + $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/AsyncCommPeer.C \ + $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C + + +${FILE_11}: ${DEPENDS_11} + +FILE_12=get-input-filename.o +DEPENDS_12:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(TESTLIBDIR)/get-input-filename.h get-input-filename.C + +DEPENDS_12 +=\ + + + +${FILE_12}: ${DEPENDS_12} + diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.in b/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.in new file mode 100644 index 00000000..2346be69 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/Makefile.in @@ -0,0 +1,83 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for library of reusable test code +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/testlib +VPATH = @srcdir@ +TESTTOOLS = ../../testtools +OBJECT = ../../.. +TESTLIBDIR = $(OBJECT)/source/test/testlib + +default: check + +include $(OBJECT)/config/Makefile.config + +SUBDIRS = fortran + +CPPFLAGS_EXTRA= -DTESTING=1 + +CXX_OBJS = AutoTester.o \ + DerivedVisOwnerData.o \ + MblkHyperbolicLevelIntegrator.o \ + MblkHyperbolicPatchStrategy.o \ + SkeletonBoundaryUtilities2.o \ + SkeletonBoundaryUtilities3.o \ + SkeletonCellDoubleConservativeLinearRefine.o \ + SkeletonCellDoubleWeightedAverage.o \ + MeshGenerationStrategy.o \ + SinusoidalFrontGenerator.o \ + SphericalShellGenerator.o \ + ShrunkenLevelGenerator.o \ + get-input-filename.o + +F_OBJS = fortran/skelbdry2d.o \ + fortran/skelbdry3d.o \ + fortran/upfluxsum2d.o \ + fortran/upfluxsum3d.o + +library: libSAMRAI_test$(LIB_SUFFIX) + +libSAMRAI_test$(LIB_SUFFIX): $(CXX_OBJS) $(F_OBJS) + rm -rf libSAMRAI_test$(LIB_SUFFIX) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + echo $(CXX_OBJS) $(F_OBJS) | @XARGS@ @AR@ ru libSAMRAI_test$(LIB_SUFFIX); + +# Prevents "No rule to make target" error. Built in the rule for main. +fortran/skelbdry2d.o: + +fortran/skelbdry3d.o: + +fortran/upfluxsum2d.o: + +fortran/upfluxsum3d.o: + +check: library + +checkcompile: + $(MAKE) check + +checktest: + $(MAKE) check + +examples: + +perf: + +everything: + +checkclean: + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) libSAMRAI_test$(LIB_SUFFIX) + for DIR in $(SUBDIRS); do if test -d $$DIR; then (cd $$DIR && $(MAKE) $@) ; fi || exit 1; done + +include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.C b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.C new file mode 100644 index 00000000..43e4c93e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.C @@ -0,0 +1,2518 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Integration routines for single level in AMR hierarchy + * (basic hyperbolic systems) + * + ************************************************************************/ + +#include "MblkHyperbolicLevelIntegrator.h" + +#include +#include +#include +using namespace std; + +#include "SAMRAI/tbox/RestartManager.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/FaceVariable.h" +#include "SAMRAI/pdat/OuterfaceVariable.h" +#include "SAMRAI/pdat/OutersideVariable.h" +#include "SAMRAI/pdat/SideVariable.h" + +//#define RECORD_STATS +#undef RECORD_STATS +#ifdef RECORD_STATS +#include "SAMRAI/tbox/Statistic.h" +#include "SAMRAI/tbox/Statistician.h" +#endif + +/* + ************************************************************************* + * + * External declarations for FORTRAN 77 routines used in flux + * synchronization process between hierarchy levels. + * + ************************************************************************* + */ + +extern "C" { +// in upfluxsum.m4: + +void SAMRAI_F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const double *, double *); + +void SAMRAI_F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +void SAMRAI_F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const int&, + const double *, double *); +} + +#define ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION (3) + +using namespace SAMRAI; +using namespace algs; + +/* + ************************************************************************* + * + * This constructor sets the HyperbolicPatchStrategy pointer and + * initializes integration parameters to default values. Communication + * algorithms are created here too. Other data members are read in + * from the input database or from the restart database corresponding + * to the specified object_name. + * + ************************************************************************* + */ + +MblkHyperbolicLevelIntegrator::MblkHyperbolicLevelIntegrator( + const string& object_name, + const tbox::Dimension& dim, + const boost::shared_ptr input_db, + MblkHyperbolicPatchStrategy* patch_strategy, + const boost::shared_ptr& mblk_hierarchy, + const bool use_time_refinement): + d_patch_strategy(patch_strategy), + d_object_name(object_name), + d_dim(dim), + d_use_time_refinement(use_time_refinement), + d_cfl(tbox::MathUtilities::getSignalingNaN()), + d_cfl_init(tbox::MathUtilities::getSignalingNaN()), + d_lag_dt_computation(true), + d_use_ghosts_for_dt(false), + d_flux_is_face(true), + d_flux_face_registered(false), + d_flux_side_registered(false), + d_mblk_bdry_fill_advance(new xfer::RefineAlgorithm()), + d_mblk_bdry_fill_advance_new(new xfer::RefineAlgorithm()), + d_mblk_bdry_fill_advance_old(new xfer::RefineAlgorithm()), + d_mblk_coarsen_fluxsum(new xfer::CoarsenAlgorithm(dim)), + d_mblk_coarsen_sync_data(new xfer::CoarsenAlgorithm(dim)), + d_mblk_sync_initial_data(new xfer::CoarsenAlgorithm(dim)), + d_coarsen_rich_extrap_init(new xfer::CoarsenAlgorithm(dim)), + d_coarsen_rich_extrap_final(new xfer::CoarsenAlgorithm(dim)), + d_mblk_fill_new_level(new xfer::RefineAlgorithm()), + d_number_time_data_levels(2), + d_scratch(hier::VariableDatabase::getDatabase()->getContext("SCRATCH")), + d_current(hier::VariableDatabase::getDatabase()->getContext("CURRENT")), + d_new(hier::VariableDatabase::getDatabase()->getContext("NEW")), + d_plot_context( + hier::VariableDatabase::getDatabase()->getContext("CURRENT")), + d_have_flux_on_level_zero(false), + d_distinguish_mpi_reduction_costs(false), + t_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_comm")), + t_error_bdry_fill_create(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_create")), + t_error_bdry_fill_comm(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::error_bdry_fill_comm")), + t_mpi_reductions(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::mpi_reductions")), + t_initialize_level_data(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::initializeLevelData()")), + t_fill_new_level_create(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_create")), + t_fill_new_level_comm(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::fill_new_level_comm")), + t_advance_bdry_fill_create(tbox::TimerManager::getManager()-> + getTimer( + "algs::MblkHyperbolicLevelIntegrator::advance_bdry_fill_create")), + t_new_advance_bdry_fill_create(tbox::TimerManager::getManager()-> + getTimer( + "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_create")), + t_apply_gradient_detector(tbox::TimerManager::getManager()-> + getTimer( + "algs::MblkHyperbolicLevelIntegrator::applyGradientDetector()")), + t_coarsen_rich_extrap(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_rich_extrap")), + t_get_level_dt(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()")), + t_get_level_dt_sync(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::getLevelDt()_sync")), + t_advance_level(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()")), + t_new_advance_bdry_fill_comm(tbox::TimerManager::getManager()-> + getTimer( + "algs::MblkHyperbolicLevelIntegrator::new_advance_bdry_fill_comm")), + t_patch_num_kernel(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::patch_numerical_kernels")), + t_advance_level_sync(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::advanceLevel()_sync")), + t_std_level_sync(tbox::TimerManager::getManager()-> + getTimer( + "algs::MblkHyperbolicLevelIntegrator::standardLevelSynchronization()")), + t_sync_new_levels(tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::synchronizeNewLevels()")) +{ + NULL_USE(mblk_hierarchy); + + TBOX_ASSERT(!object_name.empty()); + TBOX_ASSERT(input_db); + TBOX_ASSERT(patch_strategy != 0); + + tbox::RestartManager::getManager()-> + registerRestartItem(d_object_name, this); + + /* + * Initialize object with data read from the input and restart databases. + */ + + bool from_restart = tbox::RestartManager::getManager()->isFromRestart(); + if (from_restart) { + getFromRestart(); + } + getFromInput(input_db, from_restart); +} + +/* + ************************************************************************* + * + * Destructor tells the tbox::RestartManager to remove this object from + * the list of restart items. + * + ************************************************************************* + */ +MblkHyperbolicLevelIntegrator::~MblkHyperbolicLevelIntegrator() +{ + tbox::RestartManager::getManager()->unregisterRestartItem(d_object_name); +} + +/* + ************************************************************************* + * + * Initialize integration data on all patches on level. This process + * is used at the start of the simulation to set the initial hierarchy + * data and after adaptive regridding. In the second case, the old + * level pointer points to the level that existed in the hierarchy + * before regridding. This pointer may be null, in which case it is + * ignored. If it is non-null, then data is copied from the old level + * to the new level before the old level is discarded. + * + * Note that we also allocate flux storage for the coarsest AMR + * hierarchy level here (i.e., level 0). The time step sequence on + * level 0 is dictated by the user code; so to avoid any memory + * management errors, flux storage on level 0 persists as long as the + * level does. + * + ************************************************************************* + */ +void MblkHyperbolicLevelIntegrator::initializeLevelData( + const boost::shared_ptr& hierarchy, + const int level_number, + const double init_data_time, + const bool can_be_refined, + const bool initial_time, + const boost::shared_ptr& old_level, + const bool allocate_data) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) && + (level_number <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(!old_level || (level_number == old_level->getLevelNumber())); + TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); + + t_initialize_level_data->start(); + + boost::shared_ptr mblk_level( + hierarchy->getPatchLevel(level_number)); + + /* + * Allocate storage needed to initialize level and fill data + * from coarser levels in AMR hierarchy, potentially. Since + * time gets set when we allocate data, re-stamp it to current + * time if we don't need to allocate. + */ + if (allocate_data) { + mblk_level->allocatePatchData(d_new_patch_init_data, init_data_time); + mblk_level->allocatePatchData(d_old_time_dep_data, init_data_time); + } else { + mblk_level->setTime(init_data_time, d_new_patch_init_data); + } + + /* + * Create schedules for filling new level and fill data. + */ + + if ((level_number > 0) || old_level) { + t_fill_new_level_create->start(); + + boost::shared_ptr sched( + d_mblk_fill_new_level->createSchedule(mblk_level, + old_level, + level_number - 1, + hierarchy, + d_patch_strategy)); + t_fill_new_level_create->stop(); + + d_patch_strategy->setDataContext(d_scratch); + + t_fill_new_level_comm->start(); + sched->fillData(init_data_time); + t_fill_new_level_comm->stop(); + + d_patch_strategy->clearDataContext(); + } + + if ((d_number_time_data_levels == 3) && can_be_refined) { + + hier::VariableDatabase* variable_db = + hier::VariableDatabase::getDatabase(); + + for (hier::PatchLevel::iterator mi(mblk_level->begin()); + mi != mblk_level->end(); ++mi) { + + std::list >::iterator time_dep_var = + d_time_dep_variables.begin(); + while (time_dep_var != d_time_dep_variables.end()) { + int old_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_old); + int cur_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_current); + + (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); + + ++time_dep_var; + } + } + + } // loop over patches + + /* + * Initialize data on patch interiors. + */ + d_patch_strategy->setDataContext(d_current); + + for (hier::PatchLevel::iterator mi(mblk_level->begin()); + mi != mblk_level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, init_data_time); + + d_patch_strategy->initializeDataOnPatch(**mi, + init_data_time, + initial_time); + + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + //d_mblk_fill_new_level.reset(); + + t_initialize_level_data->stop(); +} + +/* + ************************************************************************* + * + * Reset hierarchy configuration information where the range of new + * hierarchy levels is specified. The information updated involves + * the cached communication schedules maintained by the algorithm. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::resetHierarchyConfiguration( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level) +{ +#ifdef DEBUG_CHECK_ASSERTIONS + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((coarsest_level >= 0) && + (coarsest_level <= finest_level) && + (finest_level <= hierarchy->getFinestLevelNumber())); + for (int ln0 = 0; ln0 <= finest_level; ++ln0) { + TBOX_ASSERT(hierarchy->getPatchLevel(ln0)); + } +#else + NULL_USE(finest_level); +#endif + + int finest_hiera_level = hierarchy->getFinestLevelNumber(); + + d_mblk_bdry_sched_advance.resize(finest_hiera_level + 1); + d_mblk_bdry_sched_advance_new.resize(finest_hiera_level + 1); + + for (int ln = coarsest_level; ln <= finest_hiera_level; ++ln) { + boost::shared_ptr mblk_level( + hierarchy->getPatchLevel(ln)); + + t_advance_bdry_fill_create->start(); + d_mblk_bdry_sched_advance[ln] = + d_mblk_bdry_fill_advance->createSchedule(mblk_level, + ln - 1, + hierarchy, + d_patch_strategy); + t_advance_bdry_fill_create->stop(); + + if (!d_lag_dt_computation && d_use_ghosts_for_dt) { + t_new_advance_bdry_fill_create->start(); + d_mblk_bdry_sched_advance_new[ln] = + d_mblk_bdry_fill_advance_new->createSchedule(mblk_level, + ln - 1, + hierarchy, + d_patch_strategy); + t_new_advance_bdry_fill_create->stop(); + } + + } + +} + +/* + ************************************************************************* + * + * Call patch routines to tag cells near large gradients. + * These cells will be refined. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::applyGradientDetector( + const boost::shared_ptr& hierarchy, + const int level_number, + const double error_data_time, + const int tag_index, + const bool initial_time, + const bool uses_richardson_extrapolation_too) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); + + t_apply_gradient_detector->start(); + + boost::shared_ptr mblk_level( + hierarchy->getPatchLevel(level_number)); + + mblk_level->allocatePatchData(d_saved_var_scratch_data, error_data_time); + + d_patch_strategy->setDataContext(d_scratch); + + t_error_bdry_fill_comm->start(); + d_mblk_bdry_sched_advance[level_number]->fillData(error_data_time); + t_error_bdry_fill_comm->stop(); + + for (hier::PatchLevel::iterator mi(mblk_level->begin()); + mi != mblk_level->end(); ++mi) { + + d_patch_strategy-> + tagGradientDetectorCells(**mi, + error_data_time, + initial_time, + tag_index, + uses_richardson_extrapolation_too); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + mblk_level->deallocatePatchData(d_saved_var_scratch_data); + + t_apply_gradient_detector->stop(); + +} + +/* + ************************************************************************* + * + * The Richardson extrapolation algorithm requires a coarsened version + * of the level on which error estiamtion is performed. This routine + * is used to coarsen data from a level in the AMR hierarchy to some + * coarsened version of it. Note that this routine will be called twice + * The init_coarse_level boolean argument indicates whether data is + * set on the coarse level by coarsening the "old" time level solution + * or by coarsening the "new" solution on the fine level (i.e., after + * it has been advanced). + * + * The contexts used for coarsening old data depends on the number of + * time levels. We always want to use data at the oldest time on the + * fine level, coarsened to the CURRENT context on the coarse level. + * Thus, if the problem uses two time levels, we coarsen data from + * CURRENT on fine level (since CURRENT is the oldest time maintained) + * to CURRENT on the coarse level. If the problem uses three time + * levels, we coarsen from OLD on the fine level (since OLD is the + * time maintained) to CURRENT on the coarse level. + * + * When the boolean is false, indicating we are operating at the new + * time, we coarsen the time advanced solution at the NEW context on + * the fine level to the NEW context on the coarse level so that they + * may be compared later. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::coarsenDataForRichardsonExtrapolation( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& coarse_level, + const double coarsen_data_time, + const bool before_advance) +{ +#ifndef DEBUG_CHECK_ASSERTIONS + NULL_USE(hierarchy); + NULL_USE(level_number); +#endif + + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((level_number >= 0) + && (level_number <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(hierarchy->getPatchLevel(level_number)); + TBOX_ASSERT(coarse_level); + + t_coarsen_rich_extrap->start(); + +// boost::shared_ptr level( +// hierarchy->getPatchLevel(level_number)); + + if (before_advance) { + + coarse_level->allocatePatchData(d_new_patch_init_data, + coarsen_data_time); + + if (d_number_time_data_levels == 3) { + d_patch_strategy->setDataContext(d_old); + } else { + d_patch_strategy->setDataContext(d_current); + } + + TBOX_ERROR("Incomplete DLBG code."); +// d_coarsen_rich_extrap_init-> +// createSchedule(coarse_level, level, d_patch_strategy)-> +// coarsenData(); + + d_patch_strategy->clearDataContext(); + + } else { + + coarse_level->allocatePatchData(d_new_time_dep_data, + coarsen_data_time); + + d_patch_strategy->setDataContext(d_new); + + TBOX_ERROR("Incomplete DLBG code."); +// d_coarsen_rich_extrap_final-> +// createSchedule(coarse_level, level, d_patch_strategy)-> +// coarsenData(); + + d_patch_strategy->clearDataContext(); + + } + + t_coarsen_rich_extrap->stop(); + +} + +/* + ************************************************************************* + * + * Call patch routines to tag cells for refinement using Richardson + * extrapolation. Richardson extrapolation requires two copies of + * the solution to compare. The NEW context holds the solution + * computed on the fine level and coarsened, whereas the CURRENT + * context holds the solution integrated on the coarse level after + * coarsening the initial data from the fine level. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::applyRichardsonExtrapolation( + const boost::shared_ptr& level, + const double error_data_time, + const int tag_index, + const double deltat, + const int error_coarsen_ratio, + const bool initial_time, + const bool uses_gradient_detector_too) +{ + TBOX_ASSERT(level); + + /* + * Compare solutions computed on level (stored in NEW context) and on + * the coarser level (stored in CURR context) on the patches of the + * coarser level. The patch strategy implements the compare operations + * performed on each patch. + */ + + int error_level_number = + level->getNextCoarserHierarchyLevelNumber() + 1; + + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + + d_patch_strategy-> + tagRichardsonExtrapolationCells(*patch, + error_level_number, + d_new, // finer context + d_current, // coarser context + error_data_time, + deltat, + error_coarsen_ratio, + initial_time, + tag_index, + uses_gradient_detector_too); + } + +} + +/* + ************************************************************************* + * + * Initialize level integrator by: + * + * (1) Setting the number of time data levels based on needs of + * the gridding algorithm + * (2) Invoking variable registration in patch strategy. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::initializeLevelIntegrator( + const boost::shared_ptr& gridding_alg) +{ + TBOX_ASSERT(gridding_alg); + + d_number_time_data_levels = 2; + + if ((gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() < 1) || + (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() > 3)) { + TBOX_ERROR("MblkHyperbolicLevelIntegrator::initializeLevelIntegrator " + << "error...\n" << " object name = " << d_object_name + << " gridding algorithm has bad error coarsen ratio" << endl); + } + + if ((gridding_alg->getTagAndInitializeStrategy()->everUsesTimeIntegration()) && + (gridding_alg->getTagAndInitializeStrategy()->getErrorCoarsenRatio() == 3)) { + d_number_time_data_levels = 3; + d_old = hier::VariableDatabase::getDatabase()->getContext("OLD"); + } + + d_patch_strategy->registerModelVariables(this); + + d_patch_strategy->setupLoadBalancer(this, + gridding_alg.get()); +} + +/* + ************************************************************************* + * + * Invoke dt calculation routines in patch strategy and take a min + * over all patches on the level. The result will be the max of the + * next timestep on the level. If the boolean recompute_dt is true, + * the max timestep on the level will be computed. If it is false, + * the method will simply access the latest dt stored in the time + * refinement integrator. + * + ************************************************************************* + */ + +double +MblkHyperbolicLevelIntegrator::getLevelDt( + const boost::shared_ptr& level, + const double dt_time, + const bool initial_time) +{ + TBOX_ASSERT(level); + + t_get_level_dt->start(); + + double dt = tbox::MathUtilities::getMax(); + + if (!d_use_ghosts_for_dt) { + + d_patch_strategy->setDataContext(d_current); + + for (hier::PatchLevel::iterator mi(level->begin()); + mi != level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); + + double patch_dt; + patch_dt = d_patch_strategy-> + computeStableDtOnPatch(**mi, + initial_time, + dt_time); + + dt = tbox::MathUtilities::Min(dt, patch_dt); + + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + } else { + + level->allocatePatchData(d_saved_var_scratch_data, dt_time); + + d_patch_strategy->setDataContext(d_scratch); + + t_advance_bdry_fill_comm->start(); + d_mblk_bdry_sched_advance[level->getLevelNumber()]->fillData(dt_time); + t_advance_bdry_fill_comm->stop(); + + for (hier::PatchLevel::iterator mi(level->begin()); + mi != level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, dt_time); + + double patch_dt; + patch_dt = d_patch_strategy-> + computeStableDtOnPatch(**mi, + initial_time, + dt_time); + + dt = tbox::MathUtilities::Min(dt, patch_dt); + + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + /* + * Copy data from scratch to current and de-allocate scratch storage. + * This may be excessive here, but seems necessary if the + * computation of dt affects the state of the problem solution. + * Also, this getLevelDt() routine is called at initialization only + * in most cases. + */ + + copyTimeDependentData(level, d_scratch, d_current); + + level->deallocatePatchData(d_saved_var_scratch_data); + + } + + t_get_level_dt_sync->start(); + + if (d_distinguish_mpi_reduction_costs) { + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + t_get_level_dt_sync->stop(); + t_mpi_reductions->start(); + } + + /* + * The level time increment is a global min over all patches. + */ + + double global_dt = dt; + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + if (mpi.getSize() > 1) { + mpi.AllReduce(&global_dt, 1, MPI_MIN); + } + global_dt *= tbox::MathUtilities::Min(d_cfl_init, d_cfl); + + if (d_distinguish_mpi_reduction_costs) { + t_mpi_reductions->stop(); + } else { + t_get_level_dt_sync->stop(); + } + + t_get_level_dt->stop(); + + return global_dt; + +} + +/* + ************************************************************************* + * + * For the standard explicit integration algorithm for hyperbolic + * conservation laws, the fine time increment is the coarse increment + * divided by the maximum mesh ratio (independent of level number). + * + ************************************************************************* + */ + +double +MblkHyperbolicLevelIntegrator::getMaxFinerLevelDt( + const int finer_level_number, + const double coarse_dt, + const hier::IntVector& ratio) +{ + NULL_USE(finer_level_number); + TBOX_ASSERT(ratio.min() > 0); + return coarse_dt / static_cast(ratio.max()); +} + +/* + ************************************************************************* + * + * Integrate data on all patches in patch level from current time + * to new time (new_time) using a single time step. Before the advance + * can occur, proper ghost cell information is obtained for all patches + * on the level. Then, local patches are advanced sequentially in the + * loop over patches. The details of the routine are as follows: + * + * 0) Allocate storage for new time level data. Also, allocate + * necessary FLUX and flux integral storage if needed + * (i.e., if regrid_advance is false, first_step is true, and + * coarser or finer level than current level exists in hierarchy.) + * + * 1) Scratch space is filled so that, for each patch, interior data + * and ghost cell bdry data correspond to specified time. + * + * 1a) Call user routines to pre-process advance data, if needed. + * + * 2) Compute explicit fluxes in scratch space using data on + * patch + ghosts at given time. + * + * 3) Apply conservative difference in scratch space to advance patch + * interior data to time = new_time. + * + * 3a) Call user routines to post-process advance data, if needed. + * + * 4) Compute next stable time increment for subsequent level advances: + * + * 4a) If (d_lag_dt_computation == true) { + * DO NOT RECOMPUTE characteristic data after advancing + * data on patch. Use characteristic data corresponding + * to current time level, computed prior to flux computation, + * in dt calculation. + * If (d_use_ghosts_for_dt == true) + * - Compute dt using data on patch+ghosts at time. + * Else + * - Compute dt using data on patch interior ONLY. + * } + * + * 4b) Copy data from scratch space patch interior to new data + * storage for patch (i.e., at time = new_time). + * + * 4a) If (d_lag_dt_computation == false) { + * RECOMPUTE characteristic data after advancing data on + * patch. Use characteristic data corresponding to new time + * level in dt calculation. + * If (d_use_ghosts_for_dt == true) + * - Refill scratch space with new interior patch data + * and ghost cell bdry data correspond to new time. + * (NOTE: This requires a new boundary schedule.) + * - Compute dt using data on patch+ghosts at new_time. + * Else + * - Compute dt using data on patch interior ONLY. + * (using patch interior data at new_time) + * } + * + * 5) If (ln > 0), update flux integrals by adding patch bdry FLUXes + * to flux sums. + * + * Important Notes: + * 1) In order to advance finer levels (if they exist), both old + * and new data for each patch on the level must be maintained. + * 2) If the timestep is the first in the timestep loop on the level + * (indicated by first_step), then time interpolation is + * is unnecessary to fill ghost cells from the next coarser level. + * 3) The new dt is not calculated if regrid_advance is true. + * If this is the case, it is assumed that the results of the + * advance and the timestep calculation will be discarded + * (e.g., during regridding, or initialization). Also, allocation + * and post-processing of FLUX/flux integral data is not performed + * in this case. + * + ************************************************************************* + */ + +double +MblkHyperbolicLevelIntegrator::advanceLevel( + const boost::shared_ptr& level, + const boost::shared_ptr& hierarchy, + const double current_time, + const double new_time, + const bool first_step, + const bool last_step, + const bool regrid_advance) +{ + TBOX_ASSERT(level); + TBOX_ASSERT(hierarchy); + TBOX_ASSERT(current_time <= new_time); + +#ifdef RECORD_STATS + boost::shared_ptr num_boxes_l0( + tbox::Statistician::getStatistician()-> + getStatistic("NumberBoxesL0", "PROC_STAT")); + boost::shared_ptr num_boxes_l1( + tbox::Statistician::getStatistician()-> + getStatistic("NumberBoxesL1", "PROC_STAT")); + boost::shared_ptr num_boxes_l2( + tbox::Statistician::getStatistician()-> + getStatistic("NumberBoxesL2", "PROC_STAT")); + boost::shared_ptr num_boxes_l3( + tbox::Statistician::getStatistician()-> + getStatistic("NumberBoxesL3", "PROC_STAT")); + boost::shared_ptr num_gridcells_l0( + tbox::Statistician::getStatistician()-> + getStatistic("NumberGridcellsL0", "PROC_STAT")); + boost::shared_ptr num_gridcells_l1( + tbox::Statistician::getStatistician()-> + getStatistic("NumberGridcellsL1", "PROC_STAT")); + boost::shared_ptr num_gridcells_l2( + tbox::Statistician::getStatistician()-> + getStatistic("NumberGridcellsL2", "PROC_STAT")); + boost::shared_ptr num_gridcells_l3( + tbox::Statistician::getStatistician()-> + getStatistic("NumberGridcellsL3", "PROC_STAT")); + boost::shared_ptr timestamp_l0( + tbox::Statistician::getStatistician()-> + getStatistic("TimeStampL0", "PROC_STAT")); + boost::shared_ptr timestamp_l1( + tbox::Statistician::getStatistician()-> + getStatistic("TimeStampL1", "PROC_STAT")); + boost::shared_ptr timestamp_l2( + tbox::Statistician::getStatistician()-> + getStatistic("TimeStampL2", "PROC_STAT")); + boost::shared_ptr timestamp_l3( + tbox::Statistician::getStatistician()-> + getStatistic("TimeStampL3", "PROC_STAT")); + + int level_num = level->getLevelNumber(); + + /* + * Record number of gridcells on each patch. Note that patch + * stat requires a seq number to be identified. + */ + double level_gridcells = 0.; + double level_local_patches = 0.; + // to count total gridcells on level + //hier::BoxList boxes = level->getBoxes(); + //for (hier::BoxList::Iterator i(boxes); i; ++i) { + // level_gridcells += itr().size(); + //} + // to count gridcells on this processor + + for (hier::PatchLevel::iterator mi(level->begin()); + mi != level->end(); ++mi) { + level_gridcells += (*mi)->getBox().size(); + level_local_patches += 1.0; + } // loop over patches + + if (level_num == 0) { + num_boxes_l0->recordProcStat(level_local_patches); + num_gridcells_l0->recordProcStat(level_gridcells); + timestamp_l0->recordProcStat(current_time); + } + if (level_num == 1) { + num_boxes_l1->recordProcStat(level_local_patches); + num_gridcells_l1->recordProcStat(level_gridcells); + timestamp_l1->recordProcStat(current_time); + } + if (level_num == 2) { + num_boxes_l2->recordProcStat(level_local_patches); + num_gridcells_l2->recordProcStat(level_gridcells); + timestamp_l2->recordProcStat(current_time); + } + if (level_num == 3) { + num_boxes_l3->recordProcStat(level_local_patches); + num_gridcells_l3->recordProcStat(level_gridcells); + timestamp_l3->recordProcStat(current_time); + } +#endif + + t_advance_level->start(); + + const int level_number = level->getLevelNumber(); + const double dt = new_time - current_time; + + /* + * (1) Allocate data needed for advancing level. + * (2) Generate temporary communication schedule to fill ghost + * cells, if needed. + * (3) Fill ghost cell data. + * (4) Process flux storage before the advance. + */ + + level->allocatePatchData(d_new_time_dep_data, new_time); + level->allocatePatchData(d_saved_var_scratch_data, current_time); + + boost::shared_ptr mblk_fill_schedule; + + const bool in_hierarchy = level->inHierarchy(); + + if (!in_hierarchy) { + t_error_bdry_fill_create->start(); + if (d_number_time_data_levels == 3) { + mblk_fill_schedule = d_mblk_bdry_fill_advance_old-> + createSchedule(level, + level->getLevelNumber() - 1, + hierarchy, + d_patch_strategy); + } else { + mblk_fill_schedule = d_mblk_bdry_fill_advance-> + createSchedule(level, + level->getLevelNumber() - 1, + hierarchy, + d_patch_strategy); + } + t_error_bdry_fill_create->stop(); + } else { + mblk_fill_schedule = d_mblk_bdry_sched_advance[level_number]; + } + + d_patch_strategy->setDataContext(d_scratch); + if (regrid_advance) { + t_error_bdry_fill_comm->start(); + } else { + t_advance_bdry_fill_comm->start(); + } + mblk_fill_schedule->fillData(current_time); + if (regrid_advance) { + t_error_bdry_fill_comm->stop(); + } else { + t_advance_bdry_fill_comm->stop(); + } + + d_patch_strategy->clearDataContext(); + mblk_fill_schedule.reset(); + + preprocessFluxData(level, + current_time, + new_time, + regrid_advance, + first_step, + last_step); + + /* + * (5) Call user-routine to pre-process state data, if needed. + * (6) Advance solution on all level patches (scratch storage). + * (7) Copy new solution to from scratch to new storage. + * (8) Call user-routine to post-process state data, if needed. + */ + t_patch_num_kernel->start(); + d_patch_strategy->preprocessAdvanceLevelState(level, + current_time, + dt, + first_step, + last_step, + regrid_advance); + t_patch_num_kernel->stop(); + + d_patch_strategy->setDataContext(d_scratch); + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + const boost::shared_ptr& patch = *ip; + + patch->allocatePatchData(d_temp_var_scratch_data, current_time); + + t_patch_num_kernel->start(); + d_patch_strategy->computeFluxesOnPatch(*patch, + current_time, + dt); + t_patch_num_kernel->stop(); + + bool at_syncronization = false; + + t_patch_num_kernel->start(); + d_patch_strategy->conservativeDifferenceOnPatch(*patch, + current_time, + dt, + at_syncronization); + t_patch_num_kernel->stop(); + + patch->deallocatePatchData(d_temp_var_scratch_data); + } + d_patch_strategy->clearDataContext(); + + level->setTime(new_time, d_saved_var_scratch_data); + level->setTime(new_time, d_flux_var_data); + + copyTimeDependentData(level, d_scratch, d_new); + + t_patch_num_kernel->start(); + d_patch_strategy->postprocessAdvanceLevelState(level, + current_time, + dt, + first_step, + last_step, + regrid_advance); + t_patch_num_kernel->stop(); + + /* + * (9) If the level advance is for regridding, we compute the next timestep: + * + * (a) If the dt computation is lagged (i.e., we use pre-advance data + * to compute timestep), we reset scratch space on patch interiors + * if needed. Then, we set the strategy context to current or scratch + * depending on whether ghost values are used to compute dt. + * (b) If the dt computation is not lagged (i.e., we use advanced data + * to compute timestep), we refill scratch space, including ghost + * data with new solution values if needed. Then, we set the strategy + * context to new or scratch depending on whether ghost values are + * used to compute dt. + * (c) Then, we loop over patches and compute the dt on each patch. + */ + + double dt_next = tbox::MathUtilities::getMax(); + + if (!regrid_advance) { + + if (d_lag_dt_computation) { + + if (d_use_ghosts_for_dt) { + d_patch_strategy->setDataContext(d_scratch); + copyTimeDependentData(level, d_current, d_scratch); + } else { + d_patch_strategy->setDataContext(d_current); + } + + } else { + + if (d_use_ghosts_for_dt) { + + if (!d_mblk_bdry_sched_advance_new[level_number]) { + TBOX_ERROR( + d_object_name << ": " + << "Attempt to fill new ghost data for timestep" + << "computation, but schedule not defined." << endl); + } + + d_patch_strategy->setDataContext(d_scratch); + t_new_advance_bdry_fill_comm->start(); + d_mblk_bdry_sched_advance_new[level_number]->fillData(new_time); + t_new_advance_bdry_fill_comm->stop(); + + } else { + d_patch_strategy->setDataContext(d_new); + } + + } + + for (hier::PatchLevel::iterator mi(level->begin()); + mi != level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, new_time); + // "false" argument indicates "initial_time" is false. + t_patch_num_kernel->start(); + double patch_dt = + d_patch_strategy->computeStableDtOnPatch(**mi, + false, + new_time); + t_patch_num_kernel->stop(); + + dt_next = tbox::MathUtilities::Min(dt_next, patch_dt); + + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + } // !regrid_advance + + level->deallocatePatchData(d_saved_var_scratch_data); + + postprocessFluxData(level, + regrid_advance, + first_step, + last_step); + + t_advance_level->stop(); + + t_advance_level_sync->start(); + + if (d_distinguish_mpi_reduction_costs) { + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); + t_advance_level_sync->stop(); + t_mpi_reductions->start(); + } + + double next_dt = dt_next; + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + if (mpi.getSize() > 1) { + mpi.AllReduce(&next_dt, 1, MPI_MIN); + } + next_dt *= d_cfl; + + if (d_distinguish_mpi_reduction_costs) { + t_mpi_reductions->stop(); + } else { + t_advance_level_sync->stop(); + } + + return next_dt; +} + +/* + ************************************************************************* + * + * Synchronize data between patch levels according to the standard + * hyperbolic flux correction algorithm. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::standardLevelSynchronization( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const double old_time) +{ + std::vector old_times(finest_level - coarsest_level + 1); + for (int i = coarsest_level; i <= finest_level; ++i) { + old_times[i] = old_time; + } + standardLevelSynchronization(hierarchy, coarsest_level, finest_level, + sync_time, old_times); +} + +void +MblkHyperbolicLevelIntegrator::standardLevelSynchronization( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const std::vector& old_times) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((coarsest_level >= 0) + && (coarsest_level < finest_level) + && (finest_level <= hierarchy->getFinestLevelNumber())); + TBOX_ASSERT(static_cast(old_times.size()) >= finest_level); +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln = coarsest_level; ln < finest_level; ++ln) { + TBOX_ASSERT(hierarchy->getPatchLevel(ln)); + TBOX_ASSERT(sync_time >= old_times[ln]); + } +#endif + TBOX_ASSERT(hierarchy->getPatchLevel(finest_level)); + + t_std_level_sync->start(); + + for (int fine_ln = finest_level; fine_ln > coarsest_level; --fine_ln) { + const int coarse_ln = fine_ln - 1; + + TBOX_ASSERT(sync_time >= old_times[coarse_ln]); + + boost::shared_ptr mblk_fine_level( + hierarchy->getPatchLevel(fine_ln)); + boost::shared_ptr mblk_coarse_level( + hierarchy->getPatchLevel(coarse_ln)); + + synchronizeLevelWithCoarser(mblk_fine_level, + mblk_coarse_level, + sync_time, + old_times[coarse_ln]); + + mblk_fine_level->deallocatePatchData(d_fluxsum_data); + mblk_fine_level->deallocatePatchData(d_flux_var_data); + + if (coarse_ln > coarsest_level) { + mblk_coarse_level->deallocatePatchData(d_flux_var_data); + } else { + if (coarsest_level == 0) { + mblk_coarse_level->deallocatePatchData(d_flux_var_data); + d_have_flux_on_level_zero = false; + } + } + + } + + t_std_level_sync->stop(); + +} + +/* + ************************************************************************* + * + * Coarsen current solution data from finest hierarchy level specified + * down through the coarsest hierarchy level specified, if initial_time + * is true (i.e., hierarchy is being constructed at initial simulation + * time). After data is coarsened, the user's initialization routine + * is called to reset data (as needed by the application) before + * that solution is further coarsened to the next coarser level in the + * hierarchy. If initial_time is false, then this routine does nothing + * In that case, interpolation of data from coarser levels is sufficient + * to set data on new levels in the hierarchy during regridding. + * + * NOTE: The fact that this routine does nothing when called at any + * time later than when the AMR hierarchy is constructed initially + * may need to change at some point based on application needs. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::synchronizeNewLevels( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const bool initial_time) +{ + TBOX_ASSERT(hierarchy); + TBOX_ASSERT((coarsest_level >= 0) + && (coarsest_level < finest_level) + && (finest_level <= hierarchy->getFinestLevelNumber())); +#ifdef DEBUG_CHECK_ASSERTIONS + for (int ln = coarsest_level; ln <= finest_level; ++ln) { + TBOX_ASSERT(hierarchy->getPatchLevel(ln)); + } +#endif + + boost::shared_ptr t_sync_initial_create( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_create")); + boost::shared_ptr t_sync_initial_comm( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::sync_initial_comm")); + + t_sync_new_levels->start(); + + if (initial_time) { + + d_patch_strategy->setDataContext(d_current); + + for (int fine_ln = finest_level; fine_ln > coarsest_level; --fine_ln) { + const int coarse_ln = fine_ln - 1; + + boost::shared_ptr fine_level( + hierarchy->getPatchLevel(fine_ln)); + + boost::shared_ptr coarse_level( + hierarchy->getPatchLevel(coarse_ln)); + + if (d_do_coarsening) { + t_sync_initial_create->start(); + boost::shared_ptr sched( + d_mblk_sync_initial_data->createSchedule(coarse_level, + fine_level, + d_patch_strategy)); + t_sync_initial_create->stop(); + + t_sync_initial_comm->start(); + sched->coarsenData(); + t_sync_initial_comm->stop(); + } + + for (hier::PatchLevel::iterator mi(coarse_level->begin()); + mi != coarse_level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, sync_time); + + d_patch_strategy->initializeDataOnPatch(**mi, + sync_time, + initial_time); + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } + } + + d_patch_strategy->clearDataContext(); + + } // if (initial_time) + + t_sync_new_levels->stop(); + +} + +/* + ************************************************************************* + * + * Synchronize data between coarse and fine patch levels according to + * the standard hyperbolic flux correction algorithm. The steps of + * the algorithm are: + * + * (1) Replace coarse time-space flux integrals at coarse-fine + * boundaries with time-space flux integrals computed on fine + * level. + * (2) Repeat conservative difference on coarse level with corrected + * fluxes. + * (3) Conservatively coarsen solution on interior of fine level to + * coarse level. + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::synchronizeLevelWithCoarser( + const boost::shared_ptr mblk_fine_level, + const boost::shared_ptr mblk_coarse_level, + const double sync_time, + const double coarse_sim_time) +{ + TBOX_ASSERT(mblk_fine_level); + TBOX_ASSERT(mblk_coarse_level); + TBOX_ASSERT(mblk_coarse_level->getLevelNumber() == + (mblk_fine_level->getLevelNumber() - 1)); + + boost::shared_ptr t_coarsen_fluxsum_create( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_create")); + boost::shared_ptr t_coarsen_fluxsum_comm( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_fluxsum_comm")); + boost::shared_ptr t_coarsen_sync_create( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_create")); + boost::shared_ptr t_coarsen_sync_comm( + tbox::TimerManager::getManager()-> + getTimer("algs::MblkHyperbolicLevelIntegrator::coarsen_sync_comm")); + + /* + * Coarsen flux integrals around fine patch boundaries to coarser level + * and replace coarse flux information where appropriate. NULL patch + * model is passed in to avoid over complicating coarsen process; + * i.e. patch model is not needed in coarsening of flux integrals. + */ + + boost::shared_ptr sched; + if (d_do_coarsening) { + t_coarsen_fluxsum_create->start(); + sched = d_mblk_coarsen_fluxsum->createSchedule(mblk_coarse_level, + mblk_fine_level, + 0); + t_coarsen_fluxsum_create->stop(); + + d_patch_strategy->setDataContext(d_current); + t_coarsen_fluxsum_comm->start(); + sched->coarsenData(); + t_coarsen_fluxsum_comm->stop(); + d_patch_strategy->clearDataContext(); + } + + /* + * Repeat conservative difference on coarser level. + */ + mblk_coarse_level->allocatePatchData(d_saved_var_scratch_data, + coarse_sim_time); + mblk_coarse_level->setTime(coarse_sim_time, d_flux_var_data); + + d_patch_strategy->setDataContext(d_scratch); + t_advance_bdry_fill_comm->start(); + d_mblk_bdry_sched_advance[mblk_coarse_level->getLevelNumber()]-> + fillData(coarse_sim_time); + t_advance_bdry_fill_comm->stop(); + + const double reflux_dt = sync_time - coarse_sim_time; + + for (hier::PatchLevel::iterator mi(mblk_coarse_level->begin()); + mi != mblk_coarse_level->end(); ++mi) { + + (*mi)->allocatePatchData(d_temp_var_scratch_data, coarse_sim_time); + + bool at_syncronization = true; + d_patch_strategy->conservativeDifferenceOnPatch(**mi, + coarse_sim_time, + reflux_dt, + at_syncronization); + (*mi)->deallocatePatchData(d_temp_var_scratch_data); + + } // loop over patches + + d_patch_strategy->clearDataContext(); + + copyTimeDependentData(mblk_coarse_level, d_scratch, d_new); + + mblk_coarse_level->deallocatePatchData(d_saved_var_scratch_data); + + /* + * Coarsen time-dependent data from fine patch interiors to coarse patches. + */ + + if (d_do_coarsening) { + t_coarsen_sync_create->start(); + sched = d_mblk_coarsen_sync_data->createSchedule(mblk_coarse_level, + mblk_fine_level, + d_patch_strategy); + t_coarsen_sync_create->stop(); + + d_patch_strategy->setDataContext(d_new); + + t_coarsen_sync_comm->start(); + sched->coarsenData(); + t_coarsen_sync_comm->stop(); + + d_patch_strategy->clearDataContext(); + } +} + +/* + ************************************************************************* + * + * Reset time-dependent data on patch level by replacing current data + * with new. The boolean argument is used for odd refinement ratios + * (in particular 3 used in certain applications). + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::resetTimeDependentData( + const boost::shared_ptr& level, + const double new_time, + const bool can_be_refined) +{ + TBOX_ASSERT(level); + + hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); + + double cur_time = 0.; + + for (hier::PatchLevel::iterator mi(level->begin()); + mi != level->end(); ++mi) { + + std::list >::iterator time_dep_var = + d_time_dep_variables.begin(); + while (time_dep_var != d_time_dep_variables.end()) { + + int cur_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_current); + int new_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_new); + + cur_time = (*mi)->getPatchData(cur_indx)->getTime(); + + if (can_be_refined && d_number_time_data_levels == 3) { + + int old_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_old); + + (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); + + (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); + + } else { + + if (d_number_time_data_levels == 3) { + + int old_indx = + variable_db->mapVariableAndContextToIndex(*time_dep_var, + d_old); + + (*mi)->setPatchData(old_indx, (*mi)->getPatchData(cur_indx)); + + } + + (*mi)->setPatchData(cur_indx, (*mi)->getPatchData(new_indx)); + + } + + (*mi)->deallocatePatchData(new_indx); + + ++time_dep_var; + + } + + } // loop over patches + + level->setTime(new_time, d_new_patch_init_data); + + if (d_number_time_data_levels == 3) { + level->setTime(cur_time, d_old_time_dep_data); + } + +} + +/* + ************************************************************************* + * + * Discard new data on level. This is used primarily to reset patch + * data after error estimation (e.g., Richardson extrapolation.) + * + ************************************************************************* + */ + +void +MblkHyperbolicLevelIntegrator::resetDataToPreadvanceState( + const boost::shared_ptr& level) +{ + TBOX_ASSERT(level); + + /* + * De-allocate new context + */ + level->deallocatePatchData(d_new_time_dep_data); + +} + +/* + ************************************************************************* + * + * Register given variable with algorithm according to specified + * algorithm role (i.e., HYP_VAR_TYPE). Assignment of descriptor + * indices to variable lists, component selectors, and communication + * algorithms takes place here. The different cases are: + * + * TIME_DEP: + * The number of factories depends on the number of time + * levels of data that must be stored on patches to satisfy + * regridding reqs. Currently, there are two possibilities: + * + * (1) If the coarsen ratios between levels are even, the + * error coarsening ratio will be two and so only two + * time levels of data must be maintained on every level + * but the finest as usual. + * + * (2) If the coarsen ratios between levels are three, and + * time integration is used during regridding (e.g., Rich- + * ardson extrapolation), then three time levels of data + * must be maintained on every level but the finest so + * that error estimation can be executed properly. + * + * In case (1), three factories are needed: + * SCRATCH, CURRENT, NEW. + * In case (2), four factories are needed: + * SCRATCH, OLD, CURRENT, NEW. + * + * SCRATCH index is added to d_saved_var_scratch_data. + * CURRENT index is added to d_new_patch_init_data. + * NEW index is added to d_new_time_dep_data. + * + * INPUT: + * Only one time level of data is maintained and once values + * are set on patches, they do not change in time. + * + * Two factories are needed: SCRATCH, CURRENT. + * + * SCRATCH index is added to d_saved_var_scratch_data. + * CURRENT index is added to d_new_patch_init_data. + * + * NO_FILL: + * Only one time level of data is stored and no scratch space + * is used. Data may be set and manipulated at will in user + * routines. Data (including ghost values) is never touched + * outside of user routines. + * + * Two factories are needed: CURRENT, SCRATCH. + * + * CURRENT index is added to d_new_patch_init_data. + * SCRATCH index is needed only for temporary work space to + * fill new patch levels. + * + * FLUX: + * One factory is needed: SCRATCH. + * + * SCRATCH index is added to d_flux_var_data. + * + * Additionally, a variable for flux integral data is created + * for each FLUX variable. It has a single factory, SCRATCH, + * which is added to d_fluxsum_data. + * + * TEMPORARY: + * One factory needed: SCRATCH. + * SCRATCH index is added to d_temp_var_scratch_data. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::registerVariable( + const boost::shared_ptr var, + const hier::IntVector ghosts, + const HYP_VAR_TYPE h_v_type, + const boost::shared_ptr coarsen_op, + const boost::shared_ptr refine_op, + const boost::shared_ptr time_int) +{ + TBOX_ASSERT(var); + + hier::VariableDatabase* variable_db = hier::VariableDatabase::getDatabase(); + + const hier::IntVector zero_ghosts(d_dim, 0); + + d_all_variables.push_back(var); + + switch (h_v_type) { + + case TIME_DEP: { + + //TBOX_ASSERT(refine_op); + //TBOX_ASSERT(coarsen_op); + //TBOX_ASSERT(time_int); + + d_time_dep_variables.push_back(var); + + int cur_id = variable_db->registerVariableAndContext(var, + d_current, + zero_ghosts); + int new_id = variable_db->registerVariableAndContext(var, + d_new, + zero_ghosts); + int scr_id = variable_db->registerVariableAndContext(var, + d_scratch, + ghosts); + + d_saved_var_scratch_data.setFlag(scr_id); + + d_new_patch_init_data.setFlag(cur_id); + + d_new_time_dep_data.setFlag(new_id); + + /* + * Register variable and context needed for restart. + */ + hier::PatchDataRestartManager::getManager()-> + registerPatchDataForRestart(cur_id); + + /* + * Set boundary fill schedules for time-dependent variable. + * If time interpolation operator is non-NULL, regular advance + * bdry fill algorithm will time interpolate between current and + * new data on coarser levels, and fill from current data on + * same level. New advance bdry fill algorithm will time interpolate + * between current and new data on coarser levels, and fill from new + * data on same level. If time interpolation operator is NULL, + * regular and new bdry fill algorithms will use current and new + * data, respectively. + */ + + d_mblk_bdry_fill_advance->registerRefine( + scr_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); + d_mblk_bdry_fill_advance_new->registerRefine( + scr_id, new_id, cur_id, new_id, scr_id, refine_op, time_int); + d_mblk_fill_new_level->registerRefine( + cur_id, cur_id, cur_id, new_id, scr_id, refine_op, time_int); + + /* + * For data synchronization between levels, the coarsen algorithm + * will coarsen new data on finer level to new data on coarser. + * Recall that coarser level data pointers will not be reset until + * after synchronization so we always coarsen to new + * (see synchronizeLevelWithCoarser routine). + */ + + d_mblk_coarsen_sync_data->registerCoarsen(new_id, new_id, coarsen_op); + + d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); + + /* + * Coarsen operations used in Richardson extrapolation. The init + * initializes data on coarser level, before the coarse level + * advance. If two time levels are used, coarsening occurs between + * the CURRENT context on both levels. If three levels are used, + * coarsening occurs between the OLD context on the fine level and + * the CURRENT context on the coarse level. The final coarsen + * algorithm coarsens data after it has been advanced on the fine + * level to the NEW context on the coarser level. + */ + + if (d_number_time_data_levels == 3) { + + int old_id = variable_db->registerVariableAndContext(var, + d_old, + zero_ghosts); + d_old_time_dep_data.setFlag(old_id); + + d_mblk_bdry_fill_advance_old->registerRefine( + scr_id, cur_id, old_id, new_id, scr_id, refine_op, time_int); + + d_coarsen_rich_extrap_init-> + registerCoarsen(cur_id, old_id, coarsen_op); + + } else { + + d_coarsen_rich_extrap_init-> + registerCoarsen(cur_id, cur_id, coarsen_op); + } + + d_coarsen_rich_extrap_final-> + registerCoarsen(new_id, new_id, coarsen_op); + + break; + } + + case INPUT: { + + // TBOX_ASSERT(refine_op); + // TBOX_ASSERT(coarsen_op); + + int cur_id = variable_db->registerVariableAndContext(var, + d_current, + zero_ghosts); + int scr_id = variable_db->registerVariableAndContext(var, + d_scratch, + ghosts); + + d_saved_var_scratch_data.setFlag(scr_id); + + d_new_patch_init_data.setFlag(cur_id); + + /* + * Register variable and context needed for restart. + */ + hier::PatchDataRestartManager::getManager()-> + registerPatchDataForRestart(cur_id); + + /* + * Bdry algorithms for input variables will fill from current only. + */ + + d_mblk_bdry_fill_advance->registerRefine( + scr_id, cur_id, scr_id, refine_op); + d_mblk_bdry_fill_advance_new->registerRefine( + scr_id, cur_id, scr_id, refine_op); + d_mblk_fill_new_level->registerRefine( + cur_id, cur_id, scr_id, refine_op); + + /* + * At initialization, it may be necessary to coarsen INPUT data + * up through the hierarchy so that all levels are consistent. + */ + + d_mblk_sync_initial_data->registerCoarsen(cur_id, cur_id, coarsen_op); + + /* + * Coarsen operation for setting initial data on coarser level + * in the Richardson extrapolation algorithm. + */ + + d_coarsen_rich_extrap_init-> + registerCoarsen(cur_id, cur_id, coarsen_op); + + break; + } + + case NO_FILL: { + + TBOX_ASSERT(refine_op); + TBOX_ASSERT(coarsen_op); + int cur_id = variable_db->registerVariableAndContext(var, + d_current, + ghosts); + + int scr_id = variable_db->registerVariableAndContext(var, + d_scratch, + ghosts); + + d_new_patch_init_data.setFlag(cur_id); + + /* + * Register variable and context needed for restart. + */ + hier::PatchDataRestartManager::getManager()-> + registerPatchDataForRestart(cur_id); + + d_mblk_fill_new_level->registerRefine( + cur_id, cur_id, scr_id, refine_op); + + /* + * Coarsen operation for setting initial data on coarser level + * in the Richardson extrapolation algorithm. + */ + + d_coarsen_rich_extrap_init-> + registerCoarsen(cur_id, cur_id, coarsen_op); + + break; + } + + case FLUX: { + +// TBOX_ASSERT(coarsen_op); + /* + * Note that we force all flux variables to hold double precision + * data and be face- or side-centered. Also, for each flux variable, + * a corresponding "fluxsum" variable is created to manage + * synchronization of data betweeen patch levels in the hierarchy. + */ + const boost::shared_ptr > face_var( + boost::dynamic_pointer_cast, + hier::Variable>(var)); + const boost::shared_ptr > side_var( + boost::dynamic_pointer_cast, + hier::Variable>(var)); + + if (face_var) { + if (d_flux_side_registered) { + TBOX_ERROR( + d_object_name << ": " + << "Attempt to register FaceVariable when " + << "SideVariable already registered." + << endl); + } + + d_flux_is_face = true; + + } else if (side_var) { + if (d_flux_face_registered) { + TBOX_ERROR( + d_object_name << ": " + << "Attempt to register SideVariable when " + << "FaceVariable already registered." + << endl); + } + + d_flux_is_face = false; + + } else { + TBOX_ERROR( + d_object_name << ": " + << "Flux is neither face- or side-centered." << endl); + } + + d_flux_variables.push_back(var); + + int scr_id = variable_db->registerVariableAndContext(var, + d_scratch, + ghosts); + + d_flux_var_data.setFlag(scr_id); + + string var_name = var->getName(); + string fs_suffix = "_fluxsum"; + string fsum_name = var_name; + fsum_name += fs_suffix; + + boost::shared_ptr fluxsum; + + if (d_flux_is_face) { + boost::shared_ptr > fdf( + BOOST_CAST, + hier::PatchDataFactory>(var->getPatchDataFactory())); + TBOX_ASSERT(fdf); + fluxsum.reset(new pdat::OuterfaceVariable( + d_dim, + fsum_name, + fdf->getDepth())); + d_flux_face_registered = true; + } else { + boost::shared_ptr > sdf( + BOOST_CAST, + hier::PatchDataFactory>(var->getPatchDataFactory())); + TBOX_ASSERT(sdf); + fluxsum.reset(new pdat::OutersideVariable( + d_dim, + fsum_name, + sdf->getDepth())); + d_flux_side_registered = true; + } + + d_fluxsum_variables.push_back(fluxsum); + + int fs_id = variable_db->registerVariableAndContext(fluxsum, + d_scratch, + zero_ghosts); + + d_fluxsum_data.setFlag(fs_id); + + d_mblk_coarsen_fluxsum->registerCoarsen(scr_id, fs_id, coarsen_op); + + break; + } + + case TEMPORARY: { + + int scr_id = variable_db->registerVariableAndContext(var, + d_scratch, + ghosts); + + d_temp_var_scratch_data.setFlag(scr_id); + + break; + } + + default: { + + TBOX_ERROR( + d_object_name << ": " + << "unknown HYP_VAR_TYPE = " << h_v_type + << endl); + + } + + } +} + +/* + ************************************************************************* + * + * Process FLUX and FLUX INTEGRAL data before integration on the level. + * + * We allocate FLUX storage if appropriate. + * + * If the advance is not temporary, we also zero out the FLUX INTEGRALS + * on the first step of any level finer than level zero. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::preprocessFluxData( + const boost::shared_ptr mblk_level, + const double cur_time, + const double new_time, + const bool regrid_advance, + const bool first_step, + const bool last_step) +{ + NULL_USE(cur_time); + NULL_USE(last_step); + + TBOX_ASSERT(mblk_level); + + hier::VariableDatabase* variable_db = + hier::VariableDatabase::getDatabase(); + + const int level_number = mblk_level->getLevelNumber(); + + if (!regrid_advance) { + if (((level_number > 0) && first_step) || + ((level_number == 0) && !d_have_flux_on_level_zero)) { + mblk_level->allocatePatchData(d_flux_var_data, new_time); + if (level_number == 0) { + d_have_flux_on_level_zero = true; + } + } + } else { + if (first_step) { + mblk_level->allocatePatchData(d_flux_var_data, new_time); + } + } + + if (!regrid_advance && (level_number > 0)) { + + if (first_step) { + + mblk_level->allocatePatchData(d_fluxsum_data, new_time); + + for (hier::PatchLevel::iterator mi(mblk_level->begin()); + mi != mblk_level->end(); ++mi) { + + std::list >::iterator fs_var = + d_fluxsum_variables.begin(); + + while (fs_var != d_fluxsum_variables.end()) { + int fsum_id = + variable_db->mapVariableAndContextToIndex(*fs_var, + d_scratch); + + if (d_flux_is_face) { + boost::shared_ptr > fsum_data( + BOOST_CAST, hier::PatchData>( + (*mi)->getPatchData(fsum_id))); + + TBOX_ASSERT(fsum_data); + fsum_data->fillAll(0.0); + } else { + boost::shared_ptr > fsum_data( + BOOST_CAST, hier::PatchData>( + (*mi)->getPatchData(fsum_id))); + + TBOX_ASSERT(fsum_data); + + fsum_data->fillAll(0.0); + } + + ++fs_var; + } + } // loop over patches + + } else { + mblk_level->setTime(new_time, d_fluxsum_data); + } + + } // if ( !regrid_advance && (level_number > 0) ) + +} + +/* + ************************************************************************* + * + * Process FLUX and FLUX INTEGRAL data after advancing the solution on + * the level. During normal integration steps, the flux integrals are + * updated for subsequent synchronization by adding FLUX values to + * flux integrals. + * + * If the advance is not temporary (regular integration step): + * 1) If the level is the finest in the hierarchy, FLUX data is + * deallocated. It is not used during synchronization, and is only + * maintained if needed for the advance. + * + * 2) If the level is not the coarsest in the hierarchy, update the + * flux integrals for later synchronization by adding FLUX values to + * flux integrals. + * + * If the advance is temporary, deallocate the flux data if first step. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::postprocessFluxData( + const boost::shared_ptr mblk_level, + const bool regrid_advance, + const bool first_step, + const bool last_step) +{ + NULL_USE(last_step); + + TBOX_ASSERT(mblk_level); + + if (regrid_advance && first_step) { + mblk_level->deallocatePatchData(d_flux_var_data); + } + + if (!regrid_advance && (mblk_level->getLevelNumber() > 0)) { + + for (hier::PatchLevel::iterator mi(mblk_level->begin()); + mi != mblk_level->end(); ++mi) { + + std::list >::iterator flux_var = + d_flux_variables.begin(); + std::list >::iterator fluxsum_var = + d_fluxsum_variables.begin(); + + const hier::Index& ilo = (*mi)->getBox().lower(); + const hier::Index& ihi = (*mi)->getBox().upper(); + + while (flux_var != d_flux_variables.end()) { + + boost::shared_ptr flux_data( + (*mi)->getPatchData(*flux_var, d_scratch)); + boost::shared_ptr fsum_data( + (*mi)->getPatchData(*fluxsum_var, d_scratch)); + + boost::shared_ptr > fflux_data; + boost::shared_ptr > ffsum_data; + + boost::shared_ptr > sflux_data; + boost::shared_ptr > sfsum_data; + + int ddepth; + hier::IntVector flux_ghosts(d_dim); + + if (d_flux_is_face) { + fflux_data = BOOST_CAST, + hier::PatchData>(flux_data); + ffsum_data = BOOST_CAST, + hier::PatchData>(fsum_data); + + TBOX_ASSERT(fflux_data && ffsum_data); + TBOX_ASSERT(fflux_data->getDepth() == ffsum_data->getDepth()); + + ddepth = fflux_data->getDepth(); + flux_ghosts = fflux_data->getGhostCellWidth(); + } else { + sflux_data = BOOST_CAST, + hier::PatchData>(flux_data); + sfsum_data = BOOST_CAST, + hier::PatchData>(fsum_data); + + TBOX_ASSERT(sflux_data && sfsum_data); + TBOX_ASSERT(sflux_data->getDepth() == sfsum_data->getDepth()); + + ddepth = sflux_data->getDepth(); + flux_ghosts = sflux_data->getGhostCellWidth(); + } + + for (int d = 0; d < ddepth; ++d) { + // loop over lower and upper parts of outer face/side arrays + for (int ifs = 0; ifs < 2; ++ifs) { + if (d_flux_is_face) { + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(upfluxsumface2d0, UPFLUXSUMFACE2D0) ( + ilo(0), ilo(1), ihi(0), ihi(1), + flux_ghosts(0), + flux_ghosts(1), + ifs, + fflux_data->getPointer(0, d), + ffsum_data->getPointer(0, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumface2d1, UPFLUXSUMFACE2D1) ( + ilo(0), ilo(1), ihi(0), ihi(1), + flux_ghosts(0), + flux_ghosts(1), + ifs, + fflux_data->getPointer(1, d), + ffsum_data->getPointer(1, ifs, d)); + } + if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(upfluxsumface3d0, UPFLUXSUMFACE3D0) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + fflux_data->getPointer(0, d), + ffsum_data->getPointer(0, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumface3d1, UPFLUXSUMFACE3D1) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + fflux_data->getPointer(1, d), + ffsum_data->getPointer(1, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumface3d2, UPFLUXSUMFACE3D2) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + fflux_data->getPointer(2, d), + ffsum_data->getPointer(2, ifs, d)); + } + } else { + if (d_dim == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(upfluxsumside2d0, UPFLUXSUMSIDE2D0) ( + ilo(0), ilo(1), ihi(0), ihi(1), + flux_ghosts(0), + flux_ghosts(1), + ifs, + sflux_data->getPointer(0, d), + sfsum_data->getPointer(0, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumside2d1, UPFLUXSUMSIDE2D1) ( + ilo(0), ilo(1), ihi(0), ihi(1), + flux_ghosts(0), + flux_ghosts(1), + ifs, + sflux_data->getPointer(1, d), + sfsum_data->getPointer(1, ifs, d)); + } + if (d_dim == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(upfluxsumside3d0, UPFLUXSUMSIDE3D0) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + sflux_data->getPointer(0, d), + sfsum_data->getPointer(0, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumside3d1, UPFLUXSUMSIDE3D1) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + sflux_data->getPointer(1, d), + sfsum_data->getPointer(1, ifs, d)); + SAMRAI_F77_FUNC(upfluxsumside3d2, UPFLUXSUMSIDE3D2) ( + ilo(0), ilo(1), ilo(2), + ihi(0), ihi(1), ihi(2), + flux_ghosts(0), + flux_ghosts(1), + flux_ghosts(2), + ifs, + sflux_data->getPointer(2, d), + sfsum_data->getPointer(2, ifs, d)); + } + } // if face operations vs. side operations + } // loop over lower and upper sides/faces + } // loop over depth + + ++flux_var; + ++fluxsum_var; + + } // loop over flux variables + + } // loop over patches + + } // if !regrid_advance and level number > 0 .... + +} + +/* + ************************************************************************* + * + * Copy time-dependent data from source to destination on level. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::copyTimeDependentData( + const boost::shared_ptr level, + const boost::shared_ptr src_context, + const boost::shared_ptr dst_context) +{ + TBOX_ASSERT(level); + TBOX_ASSERT(src_context); + TBOX_ASSERT(src_context); + + for (hier::PatchLevel::iterator ip(level->begin()); + ip != level->end(); ++ip) { + boost::shared_ptr patch = *ip; + + std::list >::iterator time_dep_var = + d_time_dep_variables.begin(); + while (time_dep_var != d_time_dep_variables.end()) { + boost::shared_ptr src_data = + patch->getPatchData(*time_dep_var, src_context); + boost::shared_ptr dst_data = + patch->getPatchData(*time_dep_var, dst_context); + + TBOX_ASSERT(src_data); + TBOX_ASSERT(dst_data); + + dst_data->copy(*src_data); + ++time_dep_var; + } + + } + +} + +/* + ************************************************************************* + * + * Print all class data for MblkHyperbolicLevelIntegrator object. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::printClassData( + ostream& os) const +{ + os << "\nMblkHyperbolicLevelIntegrator::printClassData..." << endl; + os << "MblkHyperbolicLevelIntegrator: this = " + << (MblkHyperbolicLevelIntegrator *)this << endl; + os << "d_object_name = " << d_object_name << endl; + os << "d_cfl = " << d_cfl << "\n" + << "d_cfl_init = " << d_cfl_init << endl; + os << "d_lag_dt_computation = " << d_lag_dt_computation << "\n" + << "d_use_ghosts_for_dt = " + << d_use_ghosts_for_dt << endl; + os << "d_patch_strategy = " + << (MblkHyperbolicPatchStrategy *)d_patch_strategy << endl; + os + << "NOTE: Not printing variable arrays, ComponentSelectors, communication schedules, etc." + << endl; +} + +/* + ************************************************************************* + * + * Writes out the class version number, d_cfl, d_cfl_init, + * d_lag_dt_computation, and d_use_ghosts_for_dt to the restart database. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::putToRestart( + const boost::shared_ptr& restart_db) const +{ + TBOX_ASSERT(restart_db); + + restart_db->putInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION", + ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION); + + restart_db->putDouble("d_cfl", d_cfl); + restart_db->putDouble("d_cfl_init", d_cfl_init); + restart_db->putBool("d_lag_dt_computation", d_lag_dt_computation); + restart_db->putBool("d_use_ghosts_for_dt", d_use_ghosts_for_dt); + restart_db->putBool("d_do_coarsening", d_do_coarsening); +} + +/* + ************************************************************************* + * + * Reads in cfl, cfl_init, lag_dt_computation, and + * use_ghosts_to_compute_dt from the input database. + * Note all restart values are overriden with values from the input + * database. + * + ************************************************************************* + */ + +void MblkHyperbolicLevelIntegrator::getFromInput( + boost::shared_ptr input_db, + bool is_from_restart) +{ + TBOX_ASSERT(input_db); + + if (input_db->keyExists("cfl")) { + d_cfl = input_db->getDouble("cfl"); + } else { + if (!is_from_restart) { + d_cfl = input_db->getDoubleWithDefault("cfl", d_cfl); + } + } + + if (input_db->keyExists("cfl_init")) { + d_cfl_init = input_db->getDouble("cfl_init"); + } else { + if (!is_from_restart) { + d_cfl_init = input_db->getDoubleWithDefault("cfl_init", d_cfl_init); + } + } + + if (input_db->keyExists("lag_dt_computation")) { + d_lag_dt_computation = input_db->getBool("lag_dt_computation"); + } else { + if (!is_from_restart) { + d_lag_dt_computation = + input_db->getBoolWithDefault("lag_dt_computation", + d_lag_dt_computation); + } + } + + if (input_db->keyExists("use_ghosts_to_compute_dt")) { + d_use_ghosts_for_dt = input_db->getBool("use_ghosts_to_compute_dt"); + } else { + if (!is_from_restart) { + d_use_ghosts_for_dt = + input_db->getBoolWithDefault("use_ghosts_for_dt", + d_use_ghosts_for_dt); + TBOX_WARNING( + d_object_name << ": " + << "Key data `use_ghosts_to_compute_dt' not found in input." + << " Using default value " + << d_use_ghosts_for_dt << endl); + } + } + + if (input_db->keyExists("distinguish_mpi_reduction_costs")) { + d_distinguish_mpi_reduction_costs = + input_db->getBool("distinguish_mpi_reduction_costs"); + } + + d_do_coarsening = input_db->getBoolWithDefault("do_coarsening", true); +} + +/* + ************************************************************************* + * + * First, gets the database corresponding to the object_name from the + * restart file. If this database exists, this method checks to make + * sure that the version number of the class matches the version number + * of the restart file. If they match, then d_cfl, d_cfl_init, + * d_lag_dt_computation, and d_use_ghosts_to_compute_dt are read from + * restart database. + * Note all restart values can be overriden with values from the input + * database. + * + ************************************************************************* + */ +void MblkHyperbolicLevelIntegrator::getFromRestart() +{ + + boost::shared_ptr root_db( + tbox::RestartManager::getManager()->getRootDatabase()); + + if (!root_db->isDatabase(d_object_name)) { + TBOX_ERROR("Restart database corresponding to " + << d_object_name << " not found in restart file" << endl); + } + boost::shared_ptr db(root_db->getDatabase(d_object_name)); + + int ver = db->getInteger("ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION"); + if (ver != ALGS_HYPERBOLIC_LEVEL_INTEGRATOR_VERSION) { + TBOX_ERROR(d_object_name << ": " + << "Restart file version different " + << "than class version." << endl); + } + + d_cfl = db->getDouble("d_cfl"); + d_cfl_init = db->getDouble("d_cfl_init"); + d_lag_dt_computation = db->getBool("d_lag_dt_computation"); + d_use_ghosts_for_dt = db->getBool("d_use_ghosts_for_dt"); + d_do_coarsening = db->getBool("d_do_coarsening"); +} + +/* + ************************************************************************* + * + * Utility routines to retrieve variable contexts used by integrator. + * + ************************************************************************* + */ + +boost::shared_ptr +MblkHyperbolicLevelIntegrator::getCurrentContext() const +{ + return d_current; +} + +boost::shared_ptr +MblkHyperbolicLevelIntegrator::getNewContext() const +{ + return d_new; +} + +boost::shared_ptr +MblkHyperbolicLevelIntegrator::getOldContext() const +{ + return d_old; +} + +boost::shared_ptr +MblkHyperbolicLevelIntegrator::getScratchContext() const +{ + return d_scratch; +} + +boost::shared_ptr +MblkHyperbolicLevelIntegrator::getPlotContext() const +{ + return d_plot_context; +} + +bool +MblkHyperbolicLevelIntegrator::usingRefinedTimestepping() const +{ + return d_use_time_refinement; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.h b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.h new file mode 100644 index 00000000..9e4fa1eb --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicLevelIntegrator.h @@ -0,0 +1,1015 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Integration routines for single level in AMR hierarchy + * (basic hyperbolic systems) + * + ************************************************************************/ + +#ifndef included_MblkHyperbolicLevelIntegrator +#define included_MblkHyperbolicLevelIntegrator + +#include "SAMRAI/SAMRAI_config.h" + +#include "MblkHyperbolicPatchStrategy.h" + +#include "SAMRAI/xfer/CoarsenAlgorithm.h" +#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" +#include "SAMRAI/algs/TimeRefinementLevelStrategy.h" + +/** + * Class MblkHyperbolicLevelIntegrator provides routines needed to + * integrate a system of hyperbolic conservation laws on a structured + * AMR patch hierarchy using local time refinement. The routines include + * initializing a level, advance a level, and synchronize levels in a + * time-dependent AMR application. The AMR timestepping algorithm that + * cycles through the patch levels and calls these routines is provided by + * the TimeRefinementIntegrator class. Together, that hierarchy + * integration class and this single level integration class produce the + * common AMR algorithm due to Berger, Colella and Oliger + * (see e.g., Berger and Colella, J. Comp. Phys. (82)1:64-84, 1989). + * The operations performed on single patches on each level are implemented + * in the user-defined, problem-specific class derived from the abstract + * base class HyperbolicPatchStrategy. + * + * It is important to note that the variable contexts used by the concrete + * patch strategy subclass must be consistent with those defined in this + * class which manages the data for the variables. + * + * This class is derived from the abstract base class + * TimeRefinementLevelStrategy, which defines routines needed by + * the time refinement integrator. There is an argument in the constructor + * that determines whether this class will be used by the time + * refinement integrator for refined timestepping or synchronized + * timestepping. The routines overloaded in + * TimeRefinementLevelStrategy are: initializeLevelIntegrator(), + * getLevelDt(), getMaxFinerLevelDt(), advanceLevel(), + * standardLevelSynchronization(), synchronizeNewLevels(), + * resetTimeDependentData(), and resetDataToPreadvanceState(). + * This class is also derived from mesh::StandardTagAndInitStrategy, + * which defines routines needed by the gridding algorithm classes. The + * routines overloaded in mesh::StandardTagAndInitStrategy are: + * initializeLevelData(), resetHierarchyConfiguration(), + * applyGradientDetector(), applyRichardsonExtrapolation(), and + * coarsenDataForRichardsonExtrapolation(). + * + * An object of this class requires numerous parameters to be read from + * input. Also, data must be written to and read from files for restart. + * The input and restart data are summarized as follows. + * + * Required input keys and data types: NONE + * + * Optional input keys, data types, and defaults: + * + * + * + * + * - \b cfl + * double value for the CFL factor used for timestep selection + * (dt used = CFL * max dt). If no input value is given, a default + * value of 0.9 is used. + * + * - \b cfl_init + * double value for CFL factor used for initial timestep. + * If no input value is given, a default value of 0.9 is used. + * + * - \b lag_dt_computation + * boolean value indicating whether dt is based on current + * solution or solution from previous step (possible optimization + * in communication for characteristic analysis). If no input + * value is given, a default value of TRUE is used. + * + * + * - \b use_ghosts_to_compute_dt + * boolean value indicating whether ghost data must be filled before + * timestep is computed on each patch (possible communication + * optimization). if no input value is given, a default value + * of TRUE is used. + * + * - \b distinguish_mpi_reduction_costs + * boolean specifying whether to separate reduction costs in tbox::MPI + * from costs of load imbalances. By specifying it true, a + * barrier is put in place before the reduction call, so an extra + * operation is incurred. For this reason, it is defaulted FALSE. + * + * + * + * + * + * Note that when continuing from restart, the input values in the + * input file override all values read in from the restart database. + * + * A sample input file entry might look like: + * + * \verbatim + * + * cfl = 0.9 + * cfl_init = 0.9 + * lag_dt_computation = FALSE + * use_ghosts_to_compute_dt = TRUE + * distinguish_mpi_reduction_costs = TRUE + * + * \endverbatim + * + * @see algs::TimeRefinementIntegrator + * @see mesh::StandardTagAndInitStrategy + * @see algs::HyperbolicPatchStrategy + */ + +using namespace SAMRAI; + +class MblkHyperbolicLevelIntegrator: + public algs::TimeRefinementLevelStrategy, + public mesh::StandardTagAndInitStrategy, + public tbox::Serializable +{ +public: + /** + * Enumerated type for the different ways in which variable storage + * can be manipulated by the level integration algorithm. + * See registerVariable(...) function for more details. + * + * + * + * - \b TIME_DEP {Data that changes in time and needs more than one + * time level to be stored.} + * - \b INPUT {Data that is set once and do not change during + * the ghosts are never re-filled outside of + * user-defined routines.} + * - \b FLUX {Face-centered double values used in conservative + * difference and synchronization (i.e., refluxing) + * process. A corresponding variable to store flux + * integral information is created for each FLUX + * variable.} + * - \b TEMPORARY {Accessory values intended to live only for + * computation on a single patch (i.e., they cannot + * be assumed to exist between patch routine function + * calls.)} + * + * + * + */ + enum HYP_VAR_TYPE { TIME_DEP = 0, + INPUT = 1, + NO_FILL = 2, + FLUX = 3, + TEMPORARY = 4 }; + + /** + * Constructor for MblkHyperbolicLevelIntegrator initializes + * integration parameters to default values and constructs standard + * communication algorithms. Other data members are read in from + * the specified input database or the restart database corresponding + * to the specified object_name. This class is used by + * the time refinement integrator for refined timestepping when the + * use_time_refinement argument is true, and for synchronized + * timestepping when the boolean is false. + * + * When assertion checking is active, passing in any null pointer + * or an empty string will result in an unrecoverable assertion. + */ + MblkHyperbolicLevelIntegrator( + const std::string& object_name, + const tbox::Dimension& dim, + const boost::shared_ptr input_db, + MblkHyperbolicPatchStrategy* patch_strategy, + const boost::shared_ptr& mblk_hierarchy, + const bool use_time_refinement = true); + + /** + * The destructor for MblkHyperbolicLevelIntegrator unregisters + * the integrator object with the restart manager. + */ + virtual ~MblkHyperbolicLevelIntegrator(); + + /** + * Initialize level integrator by by setting the number of time levels + * of data needed based on specifications of the gridding algorithm. + * + * This routine also invokes variable registration in the patch strategy. + * + * Assertion checking will throw unrecoverable assertions if either + * pointer is null. + */ + virtual void + initializeLevelIntegrator( + const boost::shared_ptr& gridding_alg); + + /** + * Determine time increment to advance data on level and return that + * value. The double dt_time argument is the simulation time when + * the routine is called. The initial_time boolean is true if this + * routine is called during hierarchy initialization (i.e., at the + * initial simulation time). Otherwise, it is false. The + * recompute_dt option specifies whether to compute the timestep using + * the current level data or to return the value stored by the time + * integrator. The default true setting means the timestep will be + * computed if no value is supplied. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the level pointer is null. + */ + virtual double + getLevelDt( + const boost::shared_ptr& level, + const double dt_time, + const bool initial_time); + + /** + * Return the maximum allowable time increment for the level with + * the specified level number based on the time increment for the + * next coarser level and the mesh refinement ratio between the two + * levels. For the common explicit integration methods for hyperbolic + * conservation laws (constrained by a CFL limit), the fine time increment + * is typically the coarse increment divided by the refinement ratio. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the ratio vector is not acceptable (i.e., all values > 0). + */ + virtual double + getMaxFinerLevelDt( + const int finer_level_number, + const double coarse_dt, + const hier::IntVector& ratio_to_coarser); + + /** + * Integrate data on all patches on the given patch level from current + * time (current_time) to new time (new_time). This routine is used + * to advance the solution on each level in the hierarchy and during + * time-dependent regridding procedures, such as Richardson extrapolation. + * The boolean arguments are used to determine the state of the algorithm + * and the data when the advance routine is called. The first_step + * and last_step indicate whether the step is the first or last in the + * current timestep sequence on the level. Typically, the current timestep + * sequence means each step on the level between advance steps on a + * coarser level in the hierarchy, if one exists. The regrid_advance + * value is true when the advance is called as part of a time-dependent + * regridding procedure. Usually when this happens, the results of the + * colution advance will be discarded. So, for example, when this is true + * flux information is not maintained and flux integrals are not updated. + * The final boolean argument indicates whether or not the level resides + * in the hierarchy. For example, during time-dependent regridding, such + * as Richardson extrapolation, a temporary level that is not in the + * hierarchy is created and advanced. Then, a communication schedule + * must be generated for the level before the advance begins. + * + * This routine is called at two different points during time integration: + * during the regular time advance sequence, and possibly at the initial + * simulation time. The second call advances the solution on a coarser + * level ahead in time to provide time-dependent boundary values for some + * finer level when time-dependent regridding is used. In the first case, + * the values of the boolean flags are: + * + * + * + * - \b first_step + * = true for first step in level time step sequence; else, false. + * - \b last_step + * = true for last step in level time step sequence; else, false. + * - \b regrid_advance + * = false. + * + * + * + * In the second case, the values of the boolean flags are: + * + * + * + * - \b first_step + * = true. + * - \b last_step + * = false. + * - \b regrid_advance + * = true. + * + * + * + * + * When time-dependent regridding (i.e., Richardson extrapolation) is + * used, the routine is called from two different points in addition to + * those described above: to advance a temporary level that is coarser + * than the hierarchy level on which error estimation is performed, and + * to advance the hierarchy level itself. In the first case, the values of + * the boolean flags are: + * + * + * + * - \b first_step + * = true. + * - \b last_step + * = true. + * - \b regrid_advance + * = true. + * + * + * + * In the second case, the values of the boolean flags are: + * + * + * + * - \b first_step + * (when regridding during time integration sequence) + * = true when the level is not coarsest level to synchronize + * immediately before the regridding process; else, false. + * (when generating initial hierarchy construction) + * = true, even though there may be multiple advance steps. + * - \b last_step + * = true when the advance is the last in the Richardson + * extrapolation step sequence; else false. + * - \b regrid_advance + * = true. + * + * + * + * + * When assertion checking is active, an unrecoverable assertion will + * result if either the level or hierarchy pointer is null, or the + * new time is not greater than the given time. + */ + + virtual double + advanceLevel( + const boost::shared_ptr& level, + const boost::shared_ptr& hierarchy, + const double current_time, + const double new_time, + const bool first_step, + const bool last_step, + const bool regrid_advance = false); + + /** + * Synchronize data between given patch levels in patch hierarchy + * according to the standard hyperbolic AMR flux correction algorithm. + * This routine synchronizes data between two levels at a time from + * the level with index finest_level down to the level with index + * coarsest_level. The array of old time values are used in the + * re-integration of the time-dependent data. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the hierarchy pointer is null, the level numbers do + * not properly match existing levels in the hierarchy (either + * coarsest_level > finest_level or some level is null), or + * all of the old time values are less than the value of sync_time. + */ + virtual void + standardLevelSynchronization( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const std::vector& old_times); + + /** + * This overloaded version of standardLevelSynchronization implements + * a routine used for synchronized timestepping. Only a single + * value for the old time is needed, since all levels would have the + * same old time. + */ + virtual void + standardLevelSynchronization( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const double old_time); + + /** + * Coarsen current solution data from finest hierarchy level specified + * down through the coarsest hierarchy level specified, if initial_time + * is true. In this case, the hierarchy is being constructed at the + * initial simulation time, After data is coarsened, the application- + * specific initialization routine is called to set data before that + * solution is further coarsened to the next coarser level in the + * hierarchy. This operation makes the solution consistent between + * coarser levels and finer levels that did not exist when the coarse + * levels where created and initialized originally. + * + * When initial_time is false, this routine does nothing since the + * standard hyperbolic AMR algorithm for conservation laws requires + * no data synchronization after regridding beyond interpolation of + * data from coarser levels in the hierarchy in some conservative fashion. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the hierarchy pointer is null, the level numbers do + * not properly match existing levels in the hierarchy (either + * coarsest_level > finest_level or some level is null). + */ + virtual void + synchronizeNewLevels( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level, + const double sync_time, + const bool initial_time); + + /** + * Resets time-dependent data storage and update time for patch level. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the level pointer is null. + */ + virtual void + resetTimeDependentData( + const boost::shared_ptr& level, + const double new_time, + const bool can_be_refined); + + /** + * Deallocate all new simulation data on the given level. This may + * be necessary during regridding, or setting up levels initially. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the level pointer is null. + */ + virtual void + resetDataToPreadvanceState( + const boost::shared_ptr& level); + + /** + * Initialize data on a new level after it is inserted into an AMR patch + * hierarchy by the gridding algorithm. The level number indicates + * that of the new level. The old_level pointer corresponds to + * the level that resided in the hierarchy before the level with the + * specified number was introduced. If the pointer is null, there was + * no level in the hierarchy prior to the call and the level data is set + * based on the user routines and the simulation time. Otherwise, the + * specified level replaces the old level and the new level receives data + * from the old level appropriately before it is destroyed. + * + * Typically, when data is set, it is interpolated from coarser levels + * in the hierarchy. If the data is to be set, the level number must + * match that of the old level, if non-null. If the old level is + * non-null, then data is copied from the old level to the new level + * on regions of intersection between those levels before interpolation + * occurs. Then, user-supplied patch routines are called to further + * initialize the data if needed. The boolean argument initial_time + * is passed into the user's routines. + * + * The boolean argument initial_time indicates whether the level is + * being introduced for the first time (i.e., at initialization time), + * or after some regrid process during the calculation beyond the initial + * hierarchy construction. This information is provided since the + * initialization of the data on a patch may be different in each of those + * circumstances. The can_be_refined boolean argument indicates whether + * the level is the finest level allowed in the hierarchy. This may or + * may not affect the data initialization process depending on the problem. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the hierarchy pointer is null, the level number does + * not match any level in the hierarchy, or the old level number + * does not match the level number (if the old level pointer is non-null). + */ + virtual void + initializeLevelData( + const boost::shared_ptr& hierarchy, + const int level_number, + const double init_data_time, + const bool can_be_refined, + const bool initial_time, + const boost::shared_ptr& old_level, + const bool allocate_data = true); + + /** + * Reset cached communication schedules after the hierarchy has changed + * (due to regidding, for example) and the data has been initialized on + * the new levels. The intent is that the cost of data movement on the + * hierarchy will be amortized across multiple communication cycles, + * if possible. The level numbers indicate the range of levels in the + * hierarchy that have changed. However, this routine updates + * communication schedules every level finer than and including that + * indexed by the coarsest level number given. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the hierarchy pointer is null, any pointer to a level + * in the hierarchy that is coarser than the finest level is null, + * or the given level numbers not specified properly; e.g., + * coarsest_level > finest_level. + */ + virtual void + resetHierarchyConfiguration( + const boost::shared_ptr& hierarchy, + const int coarsest_level, + const int finest_level); + + /** + * Set integer tags to "one" in cells where refinement of the given + * level should occur according to some user-supplied gradient criteria. + * The double time argument is the regrid time. The integer "tag_index" + * argument is the patch descriptor index of the cell-centered integer tag + * array on each patch in the hierarchy. The boolean argument + * initial_time indicates whether the level is being subject to refinement + * at the initial simulation time. If it is false, then the error + * estimation process is being invoked at some later time after the AMR + * hierarchy was initially constructed. The boolean argument + * uses_richardson_extrapolation_too is true when Richardson + * extrapolation error estimation is used in addition to the gradient + * detector, and false otherwise. This argument helps the user to + * manage multiple regridding criteria. This information is passed along + * to the user's patch tagging routines since the application of the + * gradient detector may be different in each case. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the hierarchy pointer is null or the level number does + * not match any existing level in the hierarchy. + */ + virtual void + applyGradientDetector( + const boost::shared_ptr& hierarchy, + const int level_number, + const double error_data_time, + const int tag_index, + const bool initial_time, + const bool uses_richardson_extrapolation_too); + + /** + * Set integer tags to "one" where refinement onf the given + * level should occur according to some user-supplied Richardson + * extrapolation criteria. The "error_data_time" argument is the + * regrid time. The "deltat" argument is the time increment to advance + * the solution on the level to be refined. Note that that level is + * finer than the level in the argument list, in general. The + * ratio between the argument level and the actual hierarchy level + * is given by the integer "coarsen ratio". + * + * The integer "tag_index" argument is the patch descriptor index of + * the cell-centered integer tag array on each patch in the hierarchy. + * + * The boolean argument initial_time indicates whether the level is being + * subject to refinement at the initial simulation time. If it is false, + * then the error estimation process is being invoked at some later time + * after the AMR hierarchy was initially constructed. Typically, this + * information is passed to the user's patch tagging routines since the + * application of the Richardson extrapolation process may be different + * in each case. + * + * The boolean uses_gradient_detector_too is true when a gradient + * detector procedure is used in addition to Richardson extrapolation, + * and false otherwise. This argument helps the user to manage multiple + * regridding criteria. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the level pointer is null. + * + */ + virtual void + applyRichardsonExtrapolation( + const boost::shared_ptr& level, + const double error_data_time, + const int tag_index, + const double deltat, + const int error_coarsen_ratio, + const bool initial_time, + const bool uses_gradient_detector_too); + + /** + * Coarsen solution data from level to coarse_level for Richardson + * extrapolation. Note that this routine will be called twice during + * the Richardson extrapolation error estimation process. The + * before_advance boolean argument indicates whether data is + * set on the coarse level by coarsening the "old" time level solution + * (i.e., before it has been advanced) or by coarsening the "new" + * solution on the fine level (i.e., after it has been advanced). + * + * When assertion checking is active, an unrecoverable assertion will + * result if either level pointer is null. + * + */ + virtual void + coarsenDataForRichardsonExtrapolation( + const boost::shared_ptr& hierarchy, + const int level_number, + const boost::shared_ptr& coarse_level, + const double coarsen_data_time, + const bool before_advance); + + /** + * Register a variable with the hyperbolic integration algorithm. The + * variable type must be one of the options defined by the enumerated + * type defined above. Typically, this routine is called from the + * hyperbolic patch model when the variable registration process is + * invoked by calling the function initializeLevelIntegrator() above. + * In fact, that function should be called before this routine is called. + * + * When assertion checking is active, an unrecoverable assertion will + * result if the variable pointer or geometry pointer is null. + */ + virtual void + registerVariable( + const boost::shared_ptr var, + const hier::IntVector ghosts, + const HYP_VAR_TYPE h_v_type, + const boost::shared_ptr coarsen_op = + boost::shared_ptr(), + const boost::shared_ptr refine_op = + boost::shared_ptr(), + const boost::shared_ptr time_int = + boost::shared_ptr()); + + /** + * Print class data representation for hyperbolic level integrator object. + * This is done automatically, when an unrecoverable run-time assertion + * is thrown within some member function of this class. + */ + virtual void + printClassData( + std::ostream& os) const; + + /** + * Write out object state to the given restart database. + * + * When assertion checking is active, restart_db point must be non-null. + */ + virtual void + putToRestart( + const boost::shared_ptr& restart_db) const; + + /** + * Return pointer to "current" variable context used by integrator. + * Current data corresponds to state data at the beginning of a + * timestep, or when a new level is initialized. + */ + boost::shared_ptr + getCurrentContext() const; + + /** + * Return pointer to "new" variable context used by integrator. + * New data corresponds to advanced state data at the end of a timestep. + * The data is one timestep later than the "current" data. + */ + boost::shared_ptr + getNewContext() const; + + /** + * Return pointer to "old" variable context used by integrator. + * Old data corresponds to an extra time level of state data used + * for Richardson extrapolation error estimation. The data is + * one timestep earlier than the "current" data. + * + * Note that only in certain cases when using time-dependent error + * estimation, such as Richardson extrapolation, is the returned + * pointer will non-null. See contructor for more information. + */ + boost::shared_ptr + getOldContext() const; + + /** + * Return pointer to "scratch" variable context used by integrator. + * Scratch data typically corresponds to storage that user-routines + * in the concrete HyperbolicPatchStrategy object manipulate; + * in particular, scratch data contains ghost cells. + */ + boost::shared_ptr + getScratchContext() const; + + /** + * Return pointer to variable context used for plotting. This + * context corresponds to the data storage that should be written + * to plot files. Typically, this is the same as the "current" context. + */ + boost::shared_ptr + getPlotContext() const; + + /** + * Return true if this class has been constructed to use refined + * timestepping and false if it has been constructed to use + * synchronized timestepping. + */ + bool + usingRefinedTimestepping() const; + +protected: + /** + * Read values, indicated above, from given input database. The boolean + * argument is_from_restart should be set to true if the simulation + * is beginning from restart. Otherwise it should be set to false. + * + * When assertion checking is active, the database pointer must be non-null. + */ + virtual void + getFromInput( + boost::shared_ptr input_db, + bool is_from_restart); + + /** + * Read object state from the restart file and initialize class + * data members. The database from which the restart data is read is + * determined by the object_name specified in the constructor. + * + * Unrecoverable Errors: + * + * + * + * + * - + * The database corresponding to object_name is not found + * in the restart file. + * + * - + * The class version number and restart version number do not + * match. + * + * + * + * + * + */ + virtual void + getFromRestart(); + + /* + * Pre-process flux storage before advancing solution on level from + * cur_time to new_time. The boolean flags are used to determine + * how flux and flux integral storage is allocated and initialized. + * These are needed since the advanceLevel() routine is used for + * both level integration and time-dependent error estimation. + * + * When assertion checking is active, the level and schedule pointers + * must be non-null and the current time must be less than the new time. + */ + virtual void + preprocessFluxData( + const boost::shared_ptr level, + const double cur_time, + const double new_time, + const bool regrid_advance, + const bool first_step, + const bool last_step); + + /* + * Post-process flux storage after advancing solution on level. + * The boolean flag is used to determine how flux and flux integral + * storage is copied and de-allocated. This is needed since the + * advanceLevel() routine is used for both level integration and + * time-dependent error estimation. + * + * When assertion checking is active, the level pointer must be non-null. + */ + virtual void + postprocessFluxData( + const boost::shared_ptr level, + const bool regrid_advance, + const bool first_step, + const bool last_step); + + /* + * Copy time-dependent data from source space to destination space. + * + * When assertion checking is active, the level and context pointers + * must be non-null. + */ + virtual void + copyTimeDependentData( + const boost::shared_ptr level, + const boost::shared_ptr src_context, + const boost::shared_ptr dst_context); + + /** + * Apply the standard AMR hyperbolic flux synchronization process preserve + * conservation properties in the solution between the fine level and the + * coarse level. The sync_time argument indicates the time at which + * the solution on the two levels is being synchronized. The variable + * coarse_sim_time indicates the previous simulation time on the + * coarse level (recall the conservative difference will be repeated on the + * coarse level during the synchronization process). After the + * synchronization, the flux and flux integral data storage is reset on + * the levels. + * + * When assertion checking is turned on, an unrecoverable assertion + * will result if either level pointer is null, the levels are not + * consecutive in the AMR hierarchy, or the coarse sim time is not + * less than the sync time. + */ + virtual void + synchronizeLevelWithCoarser( + const boost::shared_ptr fine, + const boost::shared_ptr coarse, + const double sync_time, + const double coarse_sim_time); + +private: + /* + * The patch strategy supplies the application-specific operations + * needed to treat data on patches in the AMR hierarchy. + */ + MblkHyperbolicPatchStrategy* d_patch_strategy; + + /* + * The object name is used as a handle to databases stored in + * restart files and for error reporting purposes. + */ + std::string d_object_name; + + const tbox::Dimension d_dim; + + bool d_use_time_refinement; + + /* + * Courant-Friedrichs-Levy parameters for time increment selection. + */ + double d_cfl; + double d_cfl_init; + + /* + * Boolean flags for algorithm variations during time integration. + * + * d_lag_dt_computation indicates when time increment is computed for + * next step on a level. A value of true means + * that the current solution values will be used to + * compute dt. A value of false means that dt will + * be computed after the current solution is advanced + * and the new solution is used to compute dt. The + * default value is true. + * + * d_use_ghosts_for_dt indicates whether the time increment computation + * on a patch requires ghost cell data (e.g., if + * boundary conditions are needed). This value must + * be consistent with the numerical routines used + * in the hyperbolic patch strategy object to + * calculate the time step size. The default is true. + */ + bool d_lag_dt_computation; + bool d_use_ghosts_for_dt; + + /* + * Boolean flags for indicated whether face or side data types are + * used for fluxes (choice is determined by numerical routines in + * hyperbolic patch model). + */ + bool d_flux_is_face; + bool d_flux_face_registered; + bool d_flux_side_registered; + +/* + * The following communication algorithms and schedules are created and + * maintained to manage inter-patch communication during AMR integration. + * The algorithms are created in the class constructor. They are initialized + * when variables are "registered" are registered with the integrator. + */ + + /* + * The "advance" schedule is used prior to advancing a level and + * prior to computing dt at initialization. It must be reset each + * time a level is regridded. All ghosts are filled with TIME_DEP + * and INPUT data at specified time. TIME_DEP data in patch interiors + * will be filled with CURRENT_VAR values. + */ + boost::shared_ptr d_mblk_bdry_fill_advance; + std::vector > + d_mblk_bdry_sched_advance; + + /* + * The "advance new" schedule can be used twice during a time integration + * cycle. The first is when ghost cell data is required during the + * conservative difference process (i.e., d_use_ghosts_for_cons_diff + * is true). If this is the case, ghosts must be refilled before the + * conservative difference on a coarser level during the refluxing + * process can take place. See synchronizeLevelWithCoarser in class + * MblkHyperbolicLevelIntegrator second occurs when the dt calculation is + * not lagged and the physical boundary conditions are needed to compute dt + * (i.e., (!d_lag_dt_computation && d_use_ghosts_for_dt_computation) + * is true). In either case, all ghosts are filled with TIME_DEP and INPUT + * data at specified time. TIME_DEP data in patch interiors will be filled + * with values corresponding to NEW descriptor indices. See notes + * accompanying MblkHyperbolicLevelIntegrator::advanceLevel. + */ + boost::shared_ptr d_mblk_bdry_fill_advance_new; + std::vector > + d_mblk_bdry_sched_advance_new; + + /* + * The "advance old" algorithm is used to fill ghosts using time + * interpolated data from OLD_VAR and NEW_VAR on the coarser hierarchy + * level. It is currently only used for advancing data on a temporary + * level during the Richardson extrapolation algorithm. Use of OLD_VAR + * data is required only when three time levels are used + * (i.e. d_number_time_data_levels=3). + */ + boost::shared_ptr d_mblk_bdry_fill_advance_old; + + /* + * Coarsen algorithms for conservative data synchronization + * (e.g., flux correction or refluxing). + */ + boost::shared_ptr d_mblk_coarsen_fluxsum; + boost::shared_ptr d_mblk_coarsen_sync_data; + boost::shared_ptr d_mblk_sync_initial_data; + + /* + * Coarsen algorithms for Richardson extrapolation. + */ + boost::shared_ptr d_coarsen_rich_extrap_init; + boost::shared_ptr d_coarsen_rich_extrap_final; + + /* + * Algorithm for filling a new patch level in the hierarchy. + */ + boost::shared_ptr d_mblk_fill_new_level; + + /* + * Number of levels of time-dependent data that must be maintained + * on each patch level. This value is used to coordinate the needs + * of the time integration and the regridding process with the + * patch data types and descriptor indices. + */ + int d_number_time_data_levels; + + /* + * hier::Variable contexts and lists of variables used for data management. + * The contexts are set in the constructor. Note that they must + * be consistent with those defined by the concrete subclass of + * the HyperbolicPatchStrategy object. The variable lists + * and component selectors are set in the registerVariable() function. + */ + + boost::shared_ptr d_scratch; + boost::shared_ptr d_current; + boost::shared_ptr d_new; + boost::shared_ptr d_old; + boost::shared_ptr d_plot_context; + + std::list > d_all_variables; + std::list > d_time_dep_variables; + std::list > d_flux_variables; + std::list > d_fluxsum_variables; + + /* + * SCRATCH descriptor indices for (non-TEMPORARY) variables + * (i.e., TIME_DEP, INPUT, FLUX). Note that these are used + * to create scratch space before ghost cells are filled + * on level prior to advancing the data. + */ + hier::ComponentSelector d_saved_var_scratch_data; + + /* + * SCRATCH descriptor indices for TEMPORARY variables. Note that + * these are used to create scratch space on a patch-by-patch basis. + */ + hier::ComponentSelector d_temp_var_scratch_data; + + /* + * CURRENT descriptor indices for TIME_DEP, INPUT, NO_FILL + * variables. Note that these are used to create storage for quantities + * when new patches are made (e.g., during hierachy initialization, + * before error estimation during regridding, after regridding new + * patch levels, etc.). + */ + hier::ComponentSelector d_new_patch_init_data; + + /* + * NEW descriptor indices for TIME_DEP variables. Note that these + * are used to create space for new data before patch level is advanced. + */ + hier::ComponentSelector d_new_time_dep_data; + + /* + * Descriptor indices for FLUX quantities and integrals of fluxes + * (used to accumulate flux information around fine patch boundaries). + * Also, a boolean flag to track flux storage on level 0. + */ + hier::ComponentSelector d_flux_var_data; + hier::ComponentSelector d_fluxsum_data; + bool d_have_flux_on_level_zero; + + /* + * OLD descriptor indices for TIME_DEP variables. Note that + * these are used only when three time levels of data are used. + */ + hier::ComponentSelector d_old_time_dep_data; + + /* + * Option to distinguish tbox::MPI reduction costs from load imbalances + * when doing performance timings. + */ + bool d_distinguish_mpi_reduction_costs; + + bool d_do_coarsening; + + /* + * Timers interspersed throughout the class. + */ + boost::shared_ptr t_advance_bdry_fill_comm; + boost::shared_ptr t_error_bdry_fill_create; + boost::shared_ptr t_error_bdry_fill_comm; + boost::shared_ptr t_mpi_reductions; + boost::shared_ptr t_initialize_level_data; + boost::shared_ptr t_fill_new_level_create; + boost::shared_ptr t_fill_new_level_comm; + boost::shared_ptr t_advance_bdry_fill_create; + boost::shared_ptr t_new_advance_bdry_fill_create; + boost::shared_ptr t_apply_gradient_detector; + boost::shared_ptr t_coarsen_rich_extrap; + boost::shared_ptr t_get_level_dt; + boost::shared_ptr t_get_level_dt_sync; + boost::shared_ptr t_advance_level; + boost::shared_ptr t_new_advance_bdry_fill_comm; + boost::shared_ptr t_patch_num_kernel; + boost::shared_ptr t_advance_level_sync; + boost::shared_ptr t_std_level_sync; + boost::shared_ptr t_sync_new_levels; + +}; + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.C b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.C new file mode 100644 index 00000000..0c6ad1f3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.C @@ -0,0 +1,83 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Interface to patch routines for hyperbolic integration scheme. + * + ************************************************************************/ + +#include "MblkHyperbolicPatchStrategy.h" + +#include "SAMRAI/tbox/Utilities.h" + +using namespace std; +using namespace SAMRAI; + +MblkHyperbolicPatchStrategy::MblkHyperbolicPatchStrategy( + const tbox::Dimension& dim): + xfer::RefinePatchStrategy(), + xfer::CoarsenPatchStrategy(), + d_dim(dim) +{ +} + +MblkHyperbolicPatchStrategy::~MblkHyperbolicPatchStrategy() +{ +} + +/* + ************************************************************************* + * + * Default virtual function implementations. + * + ************************************************************************* + */ + +void MblkHyperbolicPatchStrategy::tagGradientDetectorCells( + hier::Patch& patch, + const double regrid_time, + const bool initial_error, + const int tag_index, + const bool uses_richardson_extrapolation_too) +{ + NULL_USE(patch); + NULL_USE(regrid_time); + NULL_USE(initial_error); + NULL_USE(tag_index); + NULL_USE(uses_richardson_extrapolation_too); + TBOX_WARNING("MblkHyperbolicPatchStrategy::tagGradientDetectorCells()" + << "\nNo class supplies a concrete implementation for " + << "\nthis method. The default abstract method (which " + << "\ndoes no cell tagging) is executed" << endl); +} + +void MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells( + hier::Patch& patch, + const int error_level_number, + const boost::shared_ptr coarsened_fine, + const boost::shared_ptr advanced_coarse, + const double regrid_time, + const double deltat, + const int error_coarsen_ratio, + const bool initial_error, + const int tag_index, + const bool uses_gradient_detector_too) +{ + NULL_USE(patch); + NULL_USE(error_level_number); + NULL_USE(coarsened_fine); + NULL_USE(advanced_coarse); + NULL_USE(regrid_time); + NULL_USE(deltat); + NULL_USE(error_coarsen_ratio); + NULL_USE(initial_error); + NULL_USE(tag_index); + NULL_USE(uses_gradient_detector_too); + TBOX_WARNING( + "MblkHyperbolicPatchStrategy::tagRichardsonExtrapolationCells()" + << "\nNo class supplies a concrete implementation for " + << "\nthis method. The default abstract method (which " + << "\ndoes no cell tagging) is executed" << endl); +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.h b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.h new file mode 100644 index 00000000..c071619a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MblkHyperbolicPatchStrategy.h @@ -0,0 +1,522 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Interface to patch routines for hyperbolic integration scheme. + * + ************************************************************************/ + +#ifndef included_MblkHyperbolicPatchStrategyXD +#define included_MblkHyperbolicPatchStrategyXD + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/PatchData.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/hier/Variable.h" +#include "SAMRAI/hier/VariableContext.h" +#include "SAMRAI/xfer/RefinePatchStrategy.h" +#include "SAMRAI/xfer/CoarsenPatchStrategy.h" +#include "SAMRAI/mesh/GriddingAlgorithmStrategy.h" +#include "SAMRAI/xfer/RefineSchedule.h" +#include "SAMRAI/xfer/RefinePatchStrategy.h" + +#include "boost/shared_ptr.hpp" + +/** + * Class MblkHyperbolicPatchStrategy is an abstract base class defining the + * interface between an MblkHyperbolicLevelIntegrator object and operations + * applied to a single patch in a structured AMR hierarchy. The operations + * include patch initialization, dt calculation, flux computation, + * conservative differencing, and error estimation. This class is derived + * from the xfer::RefinePatchStrategy and xfer::CoarsenPatchStrategy + * abstract base classes. These base classes provide the interface for + * user-defined interlevel data refining and coarsening operations and the + * specification of physical boundary conditions. The functions + * setPhysicalBoundaryConditions(), and pre/postprocessRefine() are + * overloaded from the class xfer::RefinePatchStrategy. The operations + * pre/postprocessCoarsen() are overloaded from xfer::CoarsenPatchStrategy. + * The pre/postprocessCoarsen/Refine() operations are given empty + * implementations here so that the user does not need to proovide them if + * the operations are not needed. + * + * It is important to recognize that for the concrete patch strategy subclass + * and the MblkHyperbolicLevelIntegrator to work together, the concrete + * strategy must know which patch data to operate on. The patch data storage + * is manipulated by the level integrator. The set/clearDataContext() methods + * allow the integrator to inform the patch strategy of the correct data + * context. The concrete patch strategy subclass can access the appropriate + * context via the getDataContext() method. + * + * @see algs::MblkHyperbolicLevelIntegrator + * @see xfer::RefinePatchStrategy + * @see xfer::CoarsenPatchStrategy + */ + +using namespace SAMRAI; + +class MblkHyperbolicLevelIntegrator; + +class MblkHyperbolicPatchStrategy: + public xfer::RefinePatchStrategy, + public xfer::CoarsenPatchStrategy +{ +public: + /** + * Default constructor for MblkHyperbolicPatchStrategy. + */ + MblkHyperbolicPatchStrategy( + const tbox::Dimension& dim); + + /** + * Virtual destructor for MblkHyperbolicPatchStrategy. + */ + virtual ~MblkHyperbolicPatchStrategy(); + + /** + * Register specific variables needed in the numerical routines with the + * hyperbolic level integrator using the registerVariable() function in that + * class. The integrator manipulates storage for the data and this + * registration defines the way in which data for each quantity will + * be manipulated on the patches. Typically, the derived data quantities + * for plotting are registered with a visualization data writer in this + * routine as well, since the hyperbolic level integrator provides the + * variable context for plotting (i.e., which data is available when a + * plot file is generated). The integrator pointer cannot be null in + * most cases. + * + * The gridding algorithm pointer is provided so that patch data objects + * may be registered with the load balancer object (owned by the gridding + * algorithm) for non-uniform load balancing, if needed. + */ + virtual void + registerModelVariables( + MblkHyperbolicLevelIntegrator* integrator) = 0; + + /** + * Set up parameters in the load balancer object (owned by the gridding + * algorithm) if needed. This function is called immediately after the + * registerModelVariables() function is called. The hyperbolic level + * integrator pointer is provided so that the integrator can be used + * to manage data for the load balancer if needed (e.g., when using + * non-uniform load balancing). + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual void setupLoadBalancer( + MblkHyperbolicLevelIntegrator* integrator, + mesh::GriddingAlgorithmStrategy* gridding_algorithm) + { + NULL_USE(integrator); + NULL_USE(gridding_algorithm); + } + + /** + * Set the initial data on a patch interior only. Note that no ghost cells + * need to be set in this routine regardless of whether the patch data + * corresponding to the context requires ghost cells. The data_time + * is the simulation time when the routine is called. The boolean + * initial_time is true if the routine is called at the initial time + * when the hierarchy is initially constructed, otherwise it is false. + */ + virtual void + initializeDataOnPatch( + hier::Patch& patch, + const double data_time, + const bool initial_time) = 0; + + /** + * Compute the stable time increment for a patch on the level with the + * given number. The boolean flag initial_time is true if the routine + * is called at the initial simulation time; otherwise it is false. + * The double argument dt_time is the simulation time. + */ + virtual double + computeStableDtOnPatch( + hier::Patch& patch, + const bool initial_time, + const double dt_time) = 0; + + /** + * Compute TIME INTEGRALS of fluxes to be used in conservative difference + * for patch integration. That is, it is assumed that this numerical + * routine will compute the fluxes corresponding to the cell faces + * multiplied by the time increment. Typically, the numerical flux is + * the normal flux at the cell face. The flux integrals will be used in + * the conservative difference that updates the conserved quantities. + * + * Note that the numerical routines in this method generally require + * ghost cells. Ghost cells data is filled before this routine is called. + */ + virtual void + computeFluxesOnPatch( + hier::Patch& patch, + const double time, + const double dt) = 0; + + /** + * Update patch data with a conservative difference (approximating + * the divergence theorem) using the flux integrals computed in + * computeFluxesOnPatch() routine. The boolean flag is true when this + * routine is called during a flux synchronization step. Otherwise, + * it is false. Note that the computeFluxesOnPatch() routine computes + * TIME INTEGRALs of the numerical fluxes (e.g., they have been multiplied + * by dt). So the conservative difference routine should be consistent + * with this. + */ + virtual void + conservativeDifferenceOnPatch( + hier::Patch& patch, + const double time, + const double dt, + bool at_syncronization) = 0; + + /** + * This is an optional routine for user to process any application-specific + * patch strategy data BEFORE patches are advanced on the given level. + * This routine is called after patch boundary data is filled + * (i.e., ghosts) and before computeFluxesOnPatch(). The arguments are: + * level -- level that will be advanced, current_time -- current + * integration time, dt -- current time increment, first_step -- boolean + * flag that is true if advance is first in time step sequence on level + * (i.e., previous advance step was on another level, false otherwise, + * last_step -- boolean flag that is true if advance is last in time step + * sequence on level (i.e., synchronization with coarser level will occur + * immediately after this advance), regrid_advance -- boolean flag that + * is true if the advance is during a regridding phase (i.e., the advance + * is not used to integrate data on the hierarchy) in which case the + * results of the advance will be discarded. + * + * Note that when this routine is called, the scratch data is filled on + * all patches (i.e., ghost cells) and that data is the same as the + * current level data on all patch interiors. That is, both scratch and + * current data correspond to current_time. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual void + preprocessAdvanceLevelState( + const boost::shared_ptr& level, + double current_time, + double dt, + bool first_step, + bool last_step, + bool regrid_advance) + { + NULL_USE(level); + NULL_USE(current_time); + NULL_USE(dt); + NULL_USE(first_step); + NULL_USE(last_step); + NULL_USE(regrid_advance); + } + + /** + * This is an optional routine for user to process any application-specific + * patch strategy data AFTER patches are advanced on the given level. + * This routine is called after conservativeDifferenceOnPatch() is called + * and before computeStableDtOnPatch(). The arguments are: + * level -- level that will be advanced, current_time -- current + * integration time, dt -- current time increment, first_step -- boolean + * flag that is true if advance is first in time step sequence on level + * (i.e., previous advance step was on another level, false otherwise, + * last_step -- boolean flag that is true if advance is last in time step + * sequence on level (i.e., synchronization with coarser + * level will occur immediately after this advance), regrid_advance -- + * boolean flag that is true if the advance is during a regridding phase + * (i.e., the advance is not used to integrate data on the hierarchy) in + * which case the results of the advance will be discarded. + * + * Note that when this routine is called, the scratch data is filled on + * all patches (i.e., ghost cells) and that data is the same as the + * new level data on all patch interiors. That is, both scratch and + * new data correspond to current_time + dt on patch interiors. + * The current data and ghost values correspond to the current_time. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual void + postprocessAdvanceLevelState( + const boost::shared_ptr& level, + double current_time, + double dt, + bool first_step, + bool last_step, + bool regrid_advance) + { + NULL_USE(level); + NULL_USE(current_time); + NULL_USE(dt); + NULL_USE(first_step); + NULL_USE(last_step); + NULL_USE(regrid_advance); + } + + /** + * Tag cells on the given patch that require refinement based on + * application-specific numerical quantities. The tag index argument + * indicates the index of the tag data on the patch data array. The + * boolean argument initial_error is true if tagging is being done at the + * initial simulation time; otherwise, it is false. The other boolean + * flag uses_richardson_extrapolation_too is true when Richardson + * extrapolation is used in addition to the gradient detector. This flag + * helps users manage multiple regridding criteria. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual void + tagGradientDetectorCells( + hier::Patch& patch, + const double regrid_time, + const bool initial_error, + const int tag_index, + const bool uses_richardson_extrapolation_too); + + /** + * Tag cells based from differences computed in the Richardson + * extrapolation. The Richardson + * extrapolation algorithm creates a coarsened version of some hierarchy + * patch level and advances data in time on both the coarsened patch + * level and the hierarchy level. This routine takes the data resulting + * from the advance on both the coarse and fine levels, compares them, and + * tags cells according to the difference. + * \verbatim + * (2) + * n+1 ^------->x finish (1) advanced_coarse + * | ^ (2) coarsened_fine + * time n - | + * ^ |(1) + * | | + * <--------o start + * fine coarse + * \endverbatim + * + * The patch supplied to this routine is on the coarsened level. However, + * the error_level_number corresponds to the actual hierarchy level + * from which it was coarsened. Data resides on this patch in two + * contexts - ``advanced_coarse'' and ``coarsened_fine''. Advanced + * coarse is data advanced on the coarsened version of the level, while + * coarsened fine is the data advanced on the fine level and then + * coarsened to the coarse level. The regrid time and the time increment + * are given for the actual hierarchy level. The error coarsen ratio + * argument is the ratio between the index spaces on the hierarchy level + * and the coarsened hierarchy level. The boolean flag ``initial_error'' + * is true when the error estimation is performed at the initial simulation + * time; i.e., when the hierarchy levels are being constructed for the first + * time. The tag index argument is the index of the tag data on the patch + * data array. The other boolean flag uses_gradient_detector_too is + * true when a gradient detector scheme is used in addition to Richardson + * extrapolation. This flag helps users manage multiple regridding + * criteria. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual void + tagRichardsonExtrapolationCells( + hier::Patch& patch, + const int error_level_number, + const boost::shared_ptr coarsened_fine, + const boost::shared_ptr advanced_coarse, + const double regrid_time, + const double deltat, + const int error_coarsen_ratio, + const bool initial_error, + const int tag_index, + const bool uses_gradient_detector_too); + + /** + * Set user-defined boundary conditions at the physical domain boundary. + */ + virtual void + setPhysicalBoundaryConditions( + hier::Patch& patch, + const double fill_time, + const hier::IntVector& ghost_width_to_fill) = 0; + + /** + * Return maximum stencil width needed for user-defined + * data interpolation operations. Default is to return + * zero, assuming no user-defined operations provided. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual hier::IntVector getRefineOpStencilWidth(const tbox::Dimension& dim) const + { + return hier::IntVector(dim, 0); + } + + /** + * Pre- and post-processing routines for implementing user-defined + * spatial interpolation routines applied to variables. The + * interpolation routines are used in the hyperbolic AMR algorithm + * for filling patch ghost cells before advancing data on a level + * and after regridding a level to fill portions of the new level + * from some coarser level. These routines are called automatically + * from within patch boundary filling schedules; thus, some concrete + * function matching these signatures must be provided in the user's + * patch routines. However, the routines only need to perform some + * operations when "USER_DEFINED_REFINE" is given as the interpolation + * method for some variable when the patch routines register variables + * with the hyperbolic level integration algorithm, typically. If the + * user does not provide operations that refine such variables in either + * of these routines, then they will not be refined. + * + * The order in which these operations are used in each patch + * boundary filling schedule is: + * + * - \b (1) {Call user's preprocessRefine() routine.} + * - \b (2) {Refine all variables with standard interpolation operators.} + * - \b (3) {Call user's postprocessRefine() routine.} + * + * Note that these functions are not pure virtual. They are given + * dummy implementations here so that users may ignore them when + * inheriting from this class. + */ + virtual void preprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) + { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + /// + virtual void postprocessRefine( + hier::Patch& fine, + const hier::Patch& coarse, + const hier::Box& fine_box, + const hier::IntVector& ratio) + { + NULL_USE(fine); + NULL_USE(coarse); + NULL_USE(fine_box); + NULL_USE(ratio); + } + + /** + * Return maximum stencil width needed for user-defined + * data coarsen operations. Default is to return + * zero, assuming no user-defined operations provided. + * + * Note that this function is not pure virtual. It is given a + * dummy implementation here so that users may ignore it when + * inheriting from this class. + */ + virtual hier::IntVector getCoarsenOpStencilWidth(const tbox::Dimension& dim) const + { + return hier::IntVector(dim, 0); + } + + /** + * Pre- and post-processing routines for implementing user-defined + * spatial coarsening routines applied to variables. The coarsening + * routines are used in the hyperbolic AMR algorithm synchronizing + * coarse and fine levels when they have been integrated to the same + * point. These routines are called automatically from within the + * data synchronization coarsen schedules; thus, some concrete + * function matching these signatures must be provided in the user's + * patch routines. However, the routines only need to perform some + * operations when "USER_DEFINED_COARSEN" is given as the coarsening + * method for some variable when the patch routines register variables + * with the hyperbolic level integration algorithm, typically. If the + * user does not provide operations that coarsen such variables in either + * of these routines, then they will not be coarsened. + * + * The order in which these operations are used in each coarsening + * schedule is: + * + * - \b (1) {Call user's preprocessCoarsen() routine.} + * - \b (2) {Coarsen all variables with standard coarsening operators.} + * - \b (3) {Call user's postprocessCoarsen() routine.} + * + * Note that these functions are not pure virtual. They are given + * dummy implementations here so that users may ignore them when + * inheriting from this class. + */ + virtual void preprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) + { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + /// + virtual void postprocessCoarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const hier::Box& coarse_box, + const hier::IntVector& ratio) + { + NULL_USE(coarse); + NULL_USE(fine); + NULL_USE(coarse_box); + NULL_USE(ratio); + } + + /** + * Return pointer to patch data context. + */ + boost::shared_ptr getDataContext() const + { + return d_data_context; + } + + /** + * The hyperbolic integrator controls the context for the data to be used + * in the numerical routines implemented in the concrete patch strategy. + * The setDataContext() allows the integrator to set the context for + * data on a patch on which to operate. + */ + void setDataContext( + boost::shared_ptr context) + { + d_data_context = context; + } + + /** + * The clearDataContext() routine resets the data context to be null. + */ + void clearDataContext() + { + d_data_context.reset(); + } + + /*! + * @brief Return the dimension of this object. + */ + const tbox::Dimension& getDim() const + { + return d_dim; + } + +private: + const tbox::Dimension d_dim; + + boost::shared_ptr d_data_context; + +}; + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.C b/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.C new file mode 100644 index 00000000..fcc79bd2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.C @@ -0,0 +1,26 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: MeshGeneration class implementation + * + ************************************************************************/ +#include "MeshGenerationStrategy.h" +#include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/ArrayData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/pdat/NodeVariable.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +using namespace SAMRAI; diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.h b/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.h new file mode 100644 index 00000000..a3a2a09f --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/MeshGenerationStrategy.h @@ -0,0 +1,212 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Strategy class for MeshGeneration performance tests. + * + ************************************************************************/ +#ifndef included_MeshGenerationStrategy +#define included_MeshGenerationStrategy + +#include + +/* + * SAMRAI classes + */ +#include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/appu/VisDerivedDataStrategy.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/Timer.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Interface definition for MeshGeneration performance test. + * + * This is a combination of mesh::StandardTagAndInitStrategy and + * appu::VisDerivedDataStrategy, giving no-op implementations to + * unneeded methods. + */ +class MeshGenerationStrategy: + public mesh::StandardTagAndInitStrategy, + public appu::VisDerivedDataStrategy +{ + +public: + /*! + * @brief Constructor. + */ + MeshGenerationStrategy() { + } + + virtual ~MeshGenerationStrategy() { + } + + /*! + * @brief Set tag on the tag level. + * + * @param [o] exact_tagging Set to true if the implementation wants + * the clustering to match the tags exactly. Exact clustering + * match means using clustering efficiency of 1.0. + */ + virtual void + setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id) = 0; + + //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals + +public: + /*! + * @brief Set the domain, possibly scaling up the specifications. + * + * Take the domain_boxes, xlo and xhi to be the size for the value + * of autoscale_base_nprocs. Scale the problem from there to the + * number of process specified by the argument mpi. + * + * The object should also adjust whatever internal data needed to + * reflect the scaled-up domain. + * + * @param [i/o] domain Domain description to be scaled up (or + * overridden). + * + * @param [i/o] xlo Domain lower physical coordinate to be scaled + * up (or overridden). + * + * @param [i/o] xhi Domain upper physical coordinate to be scaled + * up (or overridden). + * + * @param [i] autoscale_base_nprocs Scale up the domain based on + * the current definition being for this many processes. Scale the + * domain up to the number of processes in the given SAMRAI_MPI. + * + * @param [i] mpi + */ + virtual void setDomain( + hier::BoxContainer & domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI & mpi) = 0; + + /*! + * @brief Allocate and initialize data for a new level + * in the patch hierarchy. + * + * This is where you implement the code for initialize data on the + * grid. Nevermind when it is called or where in the program that + * happens. All the information you need to initialize the grid + * are in the arguments. + * + * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() + */ + void + initializeLevelData( + /*! Hierarchy to initialize */ + const boost::shared_ptr& hierarchy, + /*! Level to initialize */ + const int level_number, + const double init_data_time, + const bool can_be_refined, + /*! Whether level is being introduced for the first time */ + const bool initial_time, + /*! Level to copy data from */ + const boost::shared_ptr& old_level = + boost::shared_ptr(), + /*! Whether data on new patch needs to be allocated */ + const bool allocate_data = true) + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(init_data_time); + NULL_USE(can_be_refined); + NULL_USE(initial_time); + NULL_USE(old_level); + NULL_USE(allocate_data); + TBOX_ERROR("Should not be here"); + } + + virtual void + resetHierarchyConfiguration( + /*! New hierarchy */ + const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ int coarsest_level, + /*! Finest level */ int finest_level) = 0; + + void + applyGradientDetector( + const boost::shared_ptr& hierarchy, + const int level_number, + const double error_data_time, + const int tag_index, + const bool initial_time, + const bool uses_richardson_extrapolation) + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(error_data_time); + NULL_USE(tag_index); + NULL_USE(initial_time); + NULL_USE(uses_richardson_extrapolation); + TBOX_ERROR("Should not be here"); + } + + //@} + + /*! + * @brief Compute tag and/or scalar solution on a patch. + */ + virtual void + computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const = 0; + +#ifdef HAVE_HDF5 + /*! + * @brief Tell a VisIt plotter which data to write for this class. + */ + virtual int + registerVariablesWithPlotter( + appu::VisItDataWriter& writer) { + NULL_USE(writer); + return 0; + } +#endif + + virtual bool + packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const + { + NULL_USE(buffer); + NULL_USE(patch); + NULL_USE(region); + NULL_USE(variable_name); + NULL_USE(depth_index); + NULL_USE(simulation_time); + TBOX_ERROR("Should not be here"); + return false; + } + +private: +}; + +#endif // MeshGenerationStrategy diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.C b/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.C new file mode 100644 index 00000000..68063c09 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.C @@ -0,0 +1,314 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: ShrunkenLevelGenerator class implementation + * + ************************************************************************/ +#include "ShrunkenLevelGenerator.h" +#include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/ArrayData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/pdat/NodeVariable.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +using namespace SAMRAI; + +ShrunkenLevelGenerator::ShrunkenLevelGenerator( + const std::string& object_name, + const tbox::Dimension& dim, + const boost::shared_ptr& database): + d_name(object_name), + d_dim(dim), + d_hierarchy(), + d_domain_scale_method('r'), + d_shrink_distance(0) +{ + if (database) { + + /* + * Input parameters to determine whether to tag by buffering + * fronts or shrinking level, and by how much. + */ + const std::string sname("shrink_distance_"); + for (int ln = 0; ; ++ln) { + const std::string lnstr(tbox::Utilities::intToString(ln)); + + // Look for buffer input first, then shrink input. + const std::string snameln = sname + lnstr; + + std::vector tmpa; + + if (database->isDouble(snameln)) { + tmpa = database->getDoubleVector(snameln); + if (static_cast(tmpa.size()) != dim.getValue()) { + TBOX_ERROR(snameln << " input parameter must have " << dim << " values"); + } + } + + if (!tmpa.empty()) { + d_shrink_distance.resize(d_shrink_distance.size() + 1); + d_shrink_distance.back().insert(d_shrink_distance.back().end(), + &tmpa[0], + &tmpa[0] + static_cast(tmpa.size())); + } else { + break; + } + + } + + d_domain_scale_method = + database->getCharWithDefault("domain_scale_method", d_domain_scale_method); + + } + +} + +ShrunkenLevelGenerator::~ShrunkenLevelGenerator() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +void ShrunkenLevelGenerator::setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id) +{ + setTagsByShrinkingLevel( + hierarchy, + tag_ln, + tag_data_id, + hier::IntVector::getZero(d_dim), + &d_shrink_distance[1][0]); + exact_tagging = true; +} + +void ShrunkenLevelGenerator::setDomain( + hier::BoxContainer& domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI& mpi) +{ + TBOX_ASSERT(!domain.empty()); + NULL_USE(xlo); + NULL_USE(xhi); + + if (d_domain_scale_method == 'r') { + + if (domain.size() != 1) { + TBOX_ERROR("ShrunkenLevelGenerator resolution scaling only supports\n" + << "single-box domains."); + } + + hier::Box domain_box = domain.front(); + hier::IntVector tmp_intvec = domain_box.numberCells(); + const tbox::Dimension& dim = domain_box.getDim(); + + double scale_factor = static_cast(mpi.getSize()) / autoscale_base_nprocs; + double linear_scale_factor = pow(scale_factor, 1.0 / dim.getValue()); + + for (int d = 0; d < dim.getValue(); ++d) { + // xhi[d] = xlo[d] + linear_scale_factor*(xhi[d]-xlo[d]); + tmp_intvec(d) = static_cast(0.5 + tmp_intvec(d) * linear_scale_factor); + } + tmp_intvec -= hier::IntVector::getOne(domain_box.getDim()); + tbox::plog << "ShrunkenLevelGenerator::setDomain changing domain from " + << domain_box << " to "; + domain_box.setUpper(domain_box.lower() + tmp_intvec); + tbox::plog << domain_box << '\n'; + + domain.clear(); + domain.pushBack(domain_box); + + } else { + + if (mpi.getSize() < autoscale_base_nprocs) { + TBOX_ERROR("ShrunkenLevelGenerator::setDomain: When using\n" + << "domain_scale_method = 't', autoscale_base_nprocs\n" + << "cannot be smaller than number of processes.\n" + << "Either set domain_scale_method = 'r', increase\n" + << "autoscale_base_nprocs or run with mor processes."); + } + + hier::BoxContainer::const_iterator ii = domain.begin(); + ii->getDim(); + const tbox::Dimension& dim = domain.begin()->getDim(); + + tbox::Dimension::dir_t doubling_dir = 1; + while (autoscale_base_nprocs < mpi.getSize()) { + for (hier::BoxContainer::iterator bi = domain.begin(); + bi != domain.end(); ++bi) { + hier::Box& input_box = *bi; + input_box.setUpper(doubling_dir, + input_box.upper(doubling_dir) + input_box.numberCells(doubling_dir)); + } + xhi[doubling_dir] += xhi[doubling_dir] - xlo[doubling_dir]; + doubling_dir = static_cast((doubling_dir + 1) % dim.getValue()); + autoscale_base_nprocs *= 2; + tbox::plog << "autoscale_base_nprocs = " << autoscale_base_nprocs << std::endl + << domain.format("IB: ", 2) << std::endl; + } + + if (autoscale_base_nprocs != mpi.getSize()) { + TBOX_ERROR("If autoscale_base_nprocs (" << autoscale_base_nprocs << ") is given,\n" + << "number of processes (" << mpi.getSize() + << ") must be\n" + << + "a power-of-2 times the value of autoscale_base_nprocs."); + } + } + +} + +void ShrunkenLevelGenerator::resetHierarchyConfiguration( + /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level) +{ + NULL_USE(coarsest_level); + NULL_USE(finest_level); + TBOX_ASSERT(new_hierarchy->getDim() == d_dim); + d_hierarchy = new_hierarchy; + TBOX_ASSERT(d_hierarchy); +} + +void ShrunkenLevelGenerator::setTagsByShrinkingLevel( + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id, + const hier::IntVector& shrink_cells, + const double* shrink_distance) +{ + + const tbox::Dimension dim(hierarchy->getDim()); + + boost::shared_ptr grid_geometry( + BOOST_CAST( + hierarchy->getGridGeometry())); + TBOX_ASSERT(grid_geometry); + + const int tag_val = 1; + + const boost::shared_ptr& tag_level( + hierarchy->getPatchLevel(tag_ln)); + + const hier::BoxLevel& Ltag = *tag_level->getBoxLevel(); + + /* + * Compute shrinkage in terms of coarse cell count. It should be + * the largest of properly converted values for shrink_cells, + * shrink_distance and nesting width. + */ + const int nblocks = + static_cast(hierarchy->getGridGeometry()->getNumberBlocks()); + hier::IntVector shrink_width(dim, hierarchy->getProperNestingBuffer(tag_ln), nblocks); + shrink_width.max(shrink_cells); + + const double *ref_dx = grid_geometry->getDx(); + for (int b = 0; b < nblocks; ++b) { + const hier::IntVector& ref_ratio = Ltag.getRefinementRatio(); + for ( int i=0; i::Max( + static_cast(0.5 + shrink_distance[i]/h), + shrink_width(b,i) ); + } + } + + boost::shared_ptr tagfootprint; + boost::shared_ptr Ltag_to_tagfootprint; + const hier::Connector& Ltag_to_Ltag = Ltag.findConnector(Ltag, + shrink_width, + hier::CONNECTOR_CREATE); + + hier::BoxLevelConnectorUtils blcu; + blcu.computeInternalParts(tagfootprint, + Ltag_to_tagfootprint, + Ltag_to_Ltag, + -shrink_width); + tbox::plog << "Ltag_to_tagfootprint:\n" << Ltag_to_tagfootprint->format("Ltag->tagfootprint: ", + 2); + + for (hier::PatchLevel::iterator pi(tag_level->begin()); + pi != tag_level->end(); ++pi) { + + boost::shared_ptr patch = *pi; + boost::shared_ptr > tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_data_id))); + TBOX_ASSERT(tag_data); + + tag_data->getArrayData().fillAll(0); + + if (!Ltag_to_tagfootprint->hasNeighborSet(patch->getBox().getBoxId())) { + /* + * Ltag_to_tagfootprint is a mapping Connector, so missing + * neighbor set means the box has itself as its only + * neighbor. + */ + tag_data->getArrayData().fillAll(1); + } else { + hier::Connector::ConstNeighborhoodIterator ni = + Ltag_to_tagfootprint->find(patch->getBox().getBoxId()); + + for (hier::Connector::ConstNeighborIterator na = Ltag_to_tagfootprint->begin(ni); + na != Ltag_to_tagfootprint->end(ni); ++na) { + + const hier::Box& tag_box = *na; + tag_data->getArrayData().fillAll(tag_val, tag_box); + + } + } + + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +#ifdef HAVE_HDF5 +int ShrunkenLevelGenerator::registerVariablesWithPlotter( + appu::VisItDataWriter& writer) +{ + d_vis_owner_data.registerVariablesWithPlotter(writer); + return 0; +} +#endif + +/* + *********************************************************************** + *********************************************************************** + */ +bool ShrunkenLevelGenerator::packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const +{ + (void)buffer; + (void)patch; + (void)region; + (void)variable_name; + (void)depth_index; + (void)simulation_time; + return true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.h b/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.h new file mode 100644 index 00000000..bc75b003 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/ShrunkenLevelGenerator.h @@ -0,0 +1,173 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: ShrunkenLevelGenerator class declaration + * + ************************************************************************/ +#ifndef included_ShrunkenLevelGenerator +#define included_ShrunkenLevelGenerator + +#include "MeshGenerationStrategy.h" + +#include + +/* + * SAMRAI classes + */ +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/Timer.h" + +#include "DerivedVisOwnerData.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Class to tag a full level, shrunken by a given IntVector amount. + * + * Inputs: + * + * shrink_distance_0, shrink_distance_1, ...: + * shrink_distance[ln] is the shink distance when tagging ON + * level ln by shrinking the boundaries of level ln. + */ +class ShrunkenLevelGenerator: + public MeshGenerationStrategy +{ + +public: + /*! + * @brief Constructor. + */ + ShrunkenLevelGenerator( + /*! Ojbect name */ + const std::string& object_name, + const tbox::Dimension& dim, + /*! Input database */ + const boost::shared_ptr& database = boost::shared_ptr()); + + ~ShrunkenLevelGenerator(); + + /*! + * @brief Set tags on the tag level. + */ + virtual void + setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id); + + //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals + +public: + /*! + * @brief Set the domain, possibly scaling up the specifications. + * + * Take the domain_boxes, xlo and xhi to be the size for the + * (integer) value of autoscale_base_nprocs. Scale the problem + * from there to the number of process running by doubling the + * size starting with the j direction. + * + * The number of processes must be a power of 2 times the value + * of autoscale_base_nprocs. + */ + void setDomain( + hier::BoxContainer & domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI & mpi); + + virtual void + resetHierarchyConfiguration( + /*! New hierarchy */ + const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level); + + //@} + + /*! + * @brief Compute shell-dependent data for a patch. + */ + void + computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const { + NULL_USE(patch); + NULL_USE(uval_data); + NULL_USE(tag_data); + NULL_USE(fill_box); + TBOX_ERROR("Shrunken Level generator doesn't yet support computePatchData."); + } + + bool + packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const; + +public: +#ifdef HAVE_HDF5 + /*! + * @brief Tell a VisIt plotter which data to write for this class. + */ + int + registerVariablesWithPlotter( + appu::VisItDataWriter& writer); +#endif + +private: + /*! + * @brief Set tags by shrinking the level at its coarse-fine + * boundary. + */ + void + setTagsByShrinkingLevel( + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id, + const hier::IntVector& shrink_cells, + const double* shrink_distance); + + std::string d_name; + + const tbox::Dimension d_dim; + + /*! + * @brief PatchHierarchy for use in implementations of some + * abstract interfaces that do not specify a hierarch. + */ + boost::shared_ptr d_hierarchy; + + /*! + * @brief Whether to scale up domain by increasing resolution ('r') + * or by tiling ('t'). + */ + char d_domain_scale_method; + + /*! + * @brief Shrink distances for generating tags. + */ + std::vector > d_shrink_distance; + + DerivedVisOwnerData d_vis_owner_data; + +}; + +#endif // included_ShrunkenLevelGenerator diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.C b/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.C new file mode 100644 index 00000000..1d28eec5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.C @@ -0,0 +1,597 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: SinusoidalFrontGenerator class implementation + * + ************************************************************************/ +#include "SinusoidalFrontGenerator.h" +#include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/ArrayData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/pdat/NodeVariable.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +using namespace SAMRAI; + +/* + *********************************************************************** + *********************************************************************** + */ +SinusoidalFrontGenerator::SinusoidalFrontGenerator( + const std::string& object_name, + const tbox::Dimension& dim, + const boost::shared_ptr& database): + d_name(object_name), + d_dim(dim), + d_hierarchy(), + d_time_shift(0.0), + d_amplitude(0.2), + d_buffer_distance(1, std::vector(dim.getValue(), 0.0)) +{ + TBOX_ASSERT(hier::VariableDatabase::getDatabase() != 0); + + std::vector init_disp; + std::vector velocity; + std::vector period; + + // Parameters set by database, with defaults. + boost::shared_ptr sft_db; // SinusoidalFrontGenerator database. + + if (database) { + + sft_db = database->getDatabaseWithDefault("SinusoidalFrontGenerator", sft_db); + + if (database->isDouble("period")) { + period = database->getDoubleVector("period"); + for (size_t i = 0; i < period.size(); ++i) { + TBOX_ASSERT(period[i] > 0.0); + } + } + if (database->isDouble("init_disp")) { + init_disp = database->getDoubleVector("init_disp"); + } + if (database->isDouble("velocity")) { + velocity = database->getDoubleVector("velocity"); + } + d_amplitude = database->getDoubleWithDefault("amplitude", d_amplitude); + d_time_shift = database->getDoubleWithDefault("time_shift", d_time_shift); + + /* + * Input parameters to determine whether to tag by buffering + * fronts, and by how much. + */ + const std::string bname("buffer_distance_"); + for (int ln = 0; ; ++ln) { + const std::string lnstr(tbox::Utilities::intToString(ln)); + + const std::string bnameln = bname + lnstr; + + std::vector tmpa; + + if (database->isDouble(bnameln)) { + tmpa = database->getDoubleVector(bnameln); + if (static_cast(tmpa.size()) != dim.getValue()) { + TBOX_ERROR(bnameln << " input parameter must have " << dim << " values"); + } + } + + if (!tmpa.empty()) { + d_buffer_distance.resize(ln + 1); + d_buffer_distance.back().swap(tmpa); + } else { + break; + } + + } + } + + for (int idim = 0; idim < d_dim.getValue(); ++idim) { + d_init_disp[idim] = + idim < static_cast(init_disp.size()) ? init_disp[idim] : 0.0; + d_velocity[idim] = + idim < static_cast(velocity.size()) ? velocity[idim] : 0.0; + d_period[idim] = + idim < static_cast(period.size()) ? period[idim] : 1.0e20; + } + + t_setup = tbox::TimerManager::getManager()-> + getTimer("apps::SinusoidalFrontGenerator::setup"); + t_node_pos = tbox::TimerManager::getManager()-> + getTimer("apps::SinusoidalFrontGenerator::node_pos"); + t_distance = tbox::TimerManager::getManager()-> + getTimer("apps::SinusoidalFrontGenerator::distance"); + t_uval = tbox::TimerManager::getManager()-> + getTimer("apps::SinusoidalFrontGenerator::uval"); + t_tag_cells = tbox::TimerManager::getManager()-> + getTimer("apps::SinusoidalFrontGenerator::tag_cells"); +} + +/* + *********************************************************************** + *********************************************************************** + */ +SinusoidalFrontGenerator::~SinusoidalFrontGenerator() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +void SinusoidalFrontGenerator::applyGradientDetector( + const boost::shared_ptr& base_hierarchy_, + const int ln, + const double error_data_time, + const int tag_index, + const bool initial_time, + const bool uses_richardson_extrapolation) +{ + NULL_USE(initial_time); + NULL_USE(uses_richardson_extrapolation); + TBOX_ASSERT(base_hierarchy_); + boost::shared_ptr level_( + base_hierarchy_->getPatchLevel(ln)); + TBOX_ASSERT(level_); + + hier::PatchLevel& level = *level_; + + for (hier::PatchLevel::iterator pi(level.begin()); + pi != level.end(); ++pi) { + hier::Patch& patch = **pi; + + boost::shared_ptr > tag_cell_data_( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(tag_index))); + TBOX_ASSERT(tag_cell_data_); + assert(tag_cell_data_->getTime() == error_data_time); + + // Compute tag data for patch. + computePatchData(patch, + 0, + tag_cell_data_.get(), + patch.getBox()); + + } +} + +/* + *********************************************************************** + *********************************************************************** + */ +void SinusoidalFrontGenerator::setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id) +{ + const boost::shared_ptr& tag_level( + hierarchy->getPatchLevel(tag_ln)); + + resetHierarchyConfiguration(hierarchy, 0, 1); + + for (hier::PatchLevel::iterator pi(tag_level->begin()); + pi != tag_level->end(); ++pi) { + + boost::shared_ptr patch = *pi; + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch->getPatchGeometry())); + + boost::shared_ptr > tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_data_id))); + TBOX_ASSERT(patch_geom); + TBOX_ASSERT(tag_data); + + computeFrontsData( + 0 /* distance data */, + 0 /* uval data */, + tag_data.get(), + tag_data->getBox(), + (static_cast(tag_ln) < d_buffer_distance.size() ? + d_buffer_distance[tag_ln] : d_buffer_distance.back()), + patch_geom->getXLower(), + patch_geom->getDx()); + + } + + exact_tagging = false; +} + +/* + *********************************************************************** + *********************************************************************** + */ +void SinusoidalFrontGenerator::setDomain( + hier::BoxContainer& domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI& mpi) +{ + TBOX_ASSERT(autoscale_base_nprocs <= mpi.getSize()); + TBOX_ASSERT(!domain.empty()); + + hier::BoxContainer::const_iterator ii = domain.begin(); + ii->getDim(); + const tbox::Dimension& dim = domain.begin()->getDim(); + + tbox::Dimension::dir_t doubling_dir = 1; + while (autoscale_base_nprocs < mpi.getSize()) { + for (hier::BoxContainer::iterator bi = domain.begin(); + bi != domain.end(); ++bi) { + hier::Box& input_box = *bi; + input_box.setUpper(doubling_dir, + input_box.upper(doubling_dir) + input_box.numberCells(doubling_dir)); + } + xhi[doubling_dir] += xhi[doubling_dir] - xlo[doubling_dir]; + doubling_dir = static_cast((doubling_dir + 1) % dim.getValue()); + autoscale_base_nprocs *= 2; + tbox::plog << "autoscale_base_nprocs = " << autoscale_base_nprocs << std::endl + << domain.format("IB: ", 2) << std::endl; + } + + if (autoscale_base_nprocs != mpi.getSize()) { + TBOX_ERROR("If autoscale_base_nprocs (" << autoscale_base_nprocs << ") is given,\n" + << "number of processes (" << mpi.getSize() + << ") must be\n" + << + "a power-of-2 times the value of autoscale_base_nprocs."); + } + +} + +/* + *********************************************************************** + *********************************************************************** + */ +void SinusoidalFrontGenerator::resetHierarchyConfiguration( + /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level) +{ + NULL_USE(coarsest_level); + NULL_USE(finest_level); + TBOX_ASSERT(new_hierarchy->getDim() == d_dim); + d_hierarchy = new_hierarchy; + TBOX_ASSERT(d_hierarchy); +} + +/* + * Compute the solution data for a patch. + */ +void SinusoidalFrontGenerator::computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const +{ + t_setup->start(); + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom.get() != 0); + + const double* xlo = patch_geom->getXLower(); + const double* dx = patch_geom->getDx(); + + t_setup->stop(); + + if (tag_data) { + computeFrontsData(0, uval_data, tag_data, + fill_box, + (patch.getPatchLevelNumber() < static_cast(d_buffer_distance.size()) ? + d_buffer_distance[patch.getPatchLevelNumber()] : d_buffer_distance.back()), + xlo, dx); + } else { + // Not computing tag => no tag buffer needed. + computeFrontsData(0, uval_data, tag_data, + fill_box, + std::vector(d_dim.getValue(), 0.0), + xlo, dx); + } +} + +/* + * Compute the various data due to the fronts. + */ +void SinusoidalFrontGenerator::computeFrontsData( + pdat::NodeData* dist_data, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box, + const std::vector& buffer_distance, + const double xlo[], + const double dx[]) const +{ + t_setup->start(); + + if (dist_data != 0 && tag_data != 0) { + TBOX_ASSERT(dist_data->getBox().isSpatiallyEqual(tag_data->getBox())); + } + + // Compute the buffer in terms of cells. + hier::IntVector buffer_cells(d_dim); + for (int i = 0; i < d_dim.getValue(); ++i) { + buffer_cells(i) = static_cast(0.5 + buffer_distance[i] / dx[i]); + } + + hier::Box pbox(d_dim); + double time = 0; + if (tag_data != 0) { + pbox = tag_data->getBox(); + time = tag_data->getTime() + d_time_shift; + } else if (uval_data != 0) { + pbox = uval_data->getBox(); + time = uval_data->getTime() + d_time_shift; + } else { + pbox = dist_data->getBox(); + time = dist_data->getTime() + d_time_shift; + } + + double wave_number[SAMRAI::MAX_DIM_VAL]; + for (int idim = 0; idim < d_dim.getValue(); ++idim) { + wave_number[idim] = 2 * 3.141592654 / d_period[idim]; + } + + t_setup->stop(); + + /* + * Initialize node x-distances from front. + */ + + t_node_pos->start(); + hier::Box front_box = fill_box; + front_box.grow(buffer_cells); + front_box.growUpper(hier::IntVector::getOne(d_dim)); + // Squash front_box to a single plane. + front_box.setUpper(0, pbox.lower(0)); + front_box.setLower(0, pbox.lower(0)); + pdat::ArrayData front_x(front_box, 1); + pdat::ArrayData::iterator aiend(front_x.getBox(), false); + for (pdat::ArrayData::iterator ai(front_x.getBox(), true); + ai != aiend; ++ai) { + + const hier::Index& index = *ai; + double y = 0.0, cosy = 0.0, z = 0.0, cosz = 1.0; + + y = xlo[1] + dx[1] * (index(1) - pbox.lower()[1]); + cosy = cos(wave_number[1] * (y + d_init_disp[1] - d_velocity[1] * time)); + + if (d_dim.getValue() > 2) { + z = xlo[2] + dx[2] * (index(2) - pbox.lower()[2]); + cosz = cos(wave_number[2] * (z + d_init_disp[2] - d_velocity[2] * time)); + } + + front_x(index, 0) = d_velocity[0] * time + d_init_disp[0] + + d_amplitude * cosy * cosz; + // tbox::plog << "index=" << index << " y=" << y << " cosy=" << cosy << " z=" << z << " cosz=" << cosz << " front_x = " << front_x(index,0) << std::endl; + } + t_node_pos->stop(); + + if (tag_data) { + /* + * Initialize tags to zero then tag specific cells. + */ + tag_data->fill(0, fill_box); + hier::Box buffered_box(fill_box); + buffered_box.grow(buffer_cells); + hier::BlockId blk0(0); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(buffered_box)); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(buffered_box)); + ci != ciend; ++ci) { + + const pdat::CellIndex& cell_index = *ci; + const hier::Box cell_box(cell_index, cell_index, blk0); + + double min_distance_to_front = tbox::MathUtilities::getMax(); + double max_distance_to_front = -tbox::MathUtilities::getMax(); + // tbox::plog << "initial distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; + pdat::NodeIterator niend(pdat::NodeGeometry::end(cell_box)); + for (pdat::NodeIterator ni(pdat::NodeGeometry::begin(cell_box)); ni != niend; ++ni) { + + const pdat::NodeIndex& node_index = *ni; + hier::Index front_index = node_index; + front_index(0) = pbox.lower(0); + + double node_x = xlo[0] + dx[0] * (node_index(0) - pbox.lower() (0)); + + double distance_to_front = node_x - front_x(front_index, 0); + min_distance_to_front = tbox::MathUtilities::Min( + min_distance_to_front, distance_to_front); + max_distance_to_front = tbox::MathUtilities::Max( + max_distance_to_front, distance_to_front); + // tbox::plog << "cell_index = " << cell_index << " node_index = " << node_index << " node_x = " << node_x << " front_index = " << front_index << " front_x = " << front_x(front_index,0) << " distance to front(" << node_x << ") = " << distance_to_front << std::endl; + + } + // tbox::plog << "distances to front: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; + + /* + * Compute shifts needed to put distances in the range [ -.5*d_period[0], .5*d_period[0] ] + * This makes the distances relative to the nearest front instead of front 0. + */ +#if 1 + const double cycles_up = min_distance_to_front > 0.5 * d_period[0] ? + 0.0 : static_cast(0.5 - min_distance_to_front / d_period[0]); + const double cycles_dn = max_distance_to_front < 0.5 * d_period[0] ? + 0.0 : static_cast(0.5 + max_distance_to_front / d_period[0]); + min_distance_to_front += (cycles_up - cycles_dn) * d_period[0]; + max_distance_to_front += (cycles_up - cycles_dn) * d_period[0]; +#else + // This is more readable than the above, but the short innner loop is too slow. + while (min_distance_to_front < -0.5 * d_period[0]) { + min_distance_to_front += d_period[0]; + max_distance_to_front += d_period[0]; + } + while (max_distance_to_front > 0.5 * d_period[0]) { + min_distance_to_front -= d_period[0]; + max_distance_to_front -= d_period[0]; + } +#endif + // tbox::plog << "shifted ..........: " << min_distance_to_front << " .. " << max_distance_to_front << std::endl; + if (min_distance_to_front <= 0 && max_distance_to_front >= 0) { + // This cell has nodes on both sides of the front. Tag it and the buffer_cells around it. + hier::Box cell_and_buffer(cell_index, cell_index, blk0); + cell_and_buffer.grow(buffer_cells); + tag_data->fill(1, cell_and_buffer); + } + + } + } + + /* + * Initialize U-value data. + * The exact value of U increases by 1 across each front. + */ + if (uval_data != 0) { + t_uval->start(); + + pdat::CellData& uval(*uval_data); + hier::Box uval_fill_box = uval.getGhostBox() * fill_box; + uval.fill(0.0, uval_fill_box); + const pdat::CellData::iterator ciend(pdat::CellGeometry::end(uval_fill_box)); + for (pdat::CellData::iterator ci = pdat::CellGeometry::begin(uval_fill_box); + ci != ciend; ++ci) { + const pdat::CellIndex& cindex = *ci; + pdat::CellIndex squashed_cindex = cindex; + squashed_cindex(0) = front_box.lower(0); + double cellx = xlo[0] + dx[0] * (cindex(0) - pbox.lower(0) + 0.5); + // Approximate cell's distance to front as average of its node distances. + double dist_from_front = 0.0; + if (d_dim == tbox::Dimension(2)) { + dist_from_front = cellx - 0.5 * ( + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::LowerLeft), 0) + + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::UpperLeft), 0)); + } else if (d_dim == tbox::Dimension(3)) { + dist_from_front = cellx - 0.25 * ( + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::LLL), 0) + + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::LUL), 0) + + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::LLU), 0) + + front_x(pdat::NodeIndex(squashed_cindex, pdat::NodeIndex::LUU), 0)); + } + const int k = + (dist_from_front < 0 ? static_cast(-dist_from_front / d_period[0] + 1) : 0); + const int front_count = static_cast(dist_from_front / d_period[0] + k) - k; + uval(cindex) = front_count; + } + + t_uval->stop(); + } + + /* + * Initialize distance data. + */ + if (dist_data != 0) { + t_distance->start(); + + pdat::NodeData& dist_to_front(*dist_data); + hier::Box dist_fill_box = dist_to_front.getGhostBox() * fill_box; + pdat::NodeData::iterator ni(pdat::NodeGeometry::begin(dist_fill_box)); + pdat::NodeData::iterator niend(pdat::NodeGeometry::end(dist_fill_box)); + for ( ; ni != niend; ++ni) { + const pdat::NodeIndex& index = *ni; + pdat::NodeIndex front_index(index); + front_index(0) = pbox.lower(0); + dist_to_front(index) = xlo[0] + (index(0) - pbox.lower(0)) * dx[0] + - front_x(front_index, 0); + } + + t_distance->stop(); + } + +} + +/* + *********************************************************************** + *********************************************************************** + */ +#ifdef HAVE_HDF5 +int SinusoidalFrontGenerator::registerVariablesWithPlotter( + appu::VisItDataWriter& writer) +{ + /* + * Register variables with plotter. + */ + writer.registerDerivedPlotQuantity("Distance to front", "SCALAR", this, 1.0, "NODE"); + writer.registerDerivedPlotQuantity("U_Sinusoid", "SCALAR", this); + writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); + d_vis_owner_data.registerVariablesWithPlotter(writer); + return 0; +} +#endif + +/* + *********************************************************************** + *********************************************************************** + */ +bool SinusoidalFrontGenerator::packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const +{ + (void)depth_index; + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + + const double* xlo = patch_geom->getXLower(); + const double* dx = patch_geom->getDx(); + + if (variable_name == "Distance to front") { + pdat::NodeData dist_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); + dist_data.setTime(simulation_time); + computeFrontsData(&dist_data, 0, 0, region, + std::vector(d_dim.getValue(), 0.0), + xlo, dx); + pdat::NodeData::iterator ciend(pdat::NodeGeometry::end(patch.getBox())); + for (pdat::NodeData::iterator ci(pdat::NodeGeometry::begin(patch.getBox())); + ci != ciend; ++ci) { + *(buffer++) = dist_data(*ci); + } + } else if (variable_name == "U_Sinusoid") { + pdat::CellData u_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); + u_data.setTime(simulation_time); + computeFrontsData(0, &u_data, 0, region, + std::vector(d_dim.getValue(), 0.0), + xlo, dx); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(patch.getBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(patch.getBox())); + ci != ciend; ++ci) { + *(buffer++) = u_data(*ci); + } + } else if (variable_name == "Tag value") { + pdat::CellData tag_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); + tag_data.setTime(simulation_time); + computeFrontsData(0, 0, &tag_data, region, + (static_cast(patch.getPatchLevelNumber()) < d_buffer_distance.size() ? + d_buffer_distance[patch.getPatchLevelNumber()] : d_buffer_distance.back()), + xlo, dx); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(patch.getBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(patch.getBox())); + ci != ciend; ++ci) { + *(buffer++) = tag_data(*ci); + } + } else { + TBOX_ERROR("Unrecognized name " << variable_name); + } + return true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.h b/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.h new file mode 100644 index 00000000..0ead3472 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SinusoidalFrontGenerator.h @@ -0,0 +1,290 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: SinusoidalFrontGenerator class declaration + * + ************************************************************************/ +#ifndef included_SinusoidalFrontGenerator +#define included_SinusoidalFrontGenerator + +#include "MeshGenerationStrategy.h" + +#include + +/* + * SAMRAI classes + */ +#include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/appu/VisDerivedDataStrategy.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/Timer.h" + +#include "DerivedVisOwnerData.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Class to tag a sinusoidal "front" in given domain. + * + * Inputs: + * + * init_disp: Initial displacement of the front. + * + * period: Period of the front. + * + * amplitude: Amplitude of the front. + * + * buffer_distance_0, buffer_distance_1, ...: + * buffer_distance[ln] is the buffer distance when tagging ON + * level ln. We tag the fronts and buffer the tags by this amount. + * Missing buffer distances will use the last values given. + * Default is zero buffering. + */ +class SinusoidalFrontGenerator: + public MeshGenerationStrategy +{ + +public: + /*! + * @brief Constructor. + */ + SinusoidalFrontGenerator( + /*! Ojbect name */ + const std::string& object_name, + const tbox::Dimension& dim, + /*! Input database */ + const boost::shared_ptr& database = boost::shared_ptr()); + + ~SinusoidalFrontGenerator(); + + /*! + * @brief Set tas on the tag level. + */ + virtual void + setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id); + + //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals + +public: + /*! + * @brief Set the domain, possibly scaling up the specifications. + * + * Take the domain_boxes, xlo and xhi to be the size for the + * (integer) value of autoscale_base_nprocs. Scale the problem + * from there to the number of process running by doubling the + * size starting with the j direction. + * + * The number of processes must be a power of 2 times the value + * of autoscale_base_nprocs. + */ + void setDomain( + hier::BoxContainer & domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI & mpi); + + //@} + + bool + packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const; + +public: +#ifdef HAVE_HDF5 + /*! + * @brief Tell a VisIt plotter which data to write for this class. + */ + int + registerVariablesWithPlotter( + appu::VisItDataWriter& writer); +#endif + + /*! + * @brief Compute distance and tag data for a patch. + * + * This method is not specific to data on the hierarchy, + * so it is of more general use. It does not require the + * hierarchy. + */ + void + computeFrontsData( + pdat::NodeData* dist_data, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box, + const std::vector& buffer_distance, + const double xlo[], + const double dx[]) const; + + /* + * Compute patch data allocated by this class, on a hierarchy. + */ + void + computeHierarchyData( + hier::PatchHierarchy& hierarchy, + double time) { + NULL_USE(hierarchy); + d_time_shift = time; + } + + /*! + * @brief Compute front-dependent data for a patch. + */ + void + computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const; + + /*! + * @brief Deallocate internally managed patch data on level. + */ + void + deallocatePatchData( + hier::PatchLevel& level) { + NULL_USE(level); + } + + /*! + * @brief Deallocate internally managed patch data on hierarchy. + */ + void + deallocatePatchData( + hier::PatchHierarchy& hierarchy) { + NULL_USE(hierarchy); + } + + //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals + + virtual void + resetHierarchyConfiguration( + /*! New hierarchy */ + const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level); + + /*! + * @brief Allocate and initialize data for a new level + * in the patch hierarchy. + * + * @see SAMRAI::mesh::StandardTagAndInitStrategy::initializeLevelData() + */ + void + initializeLevelData( + /*! Hierarchy to initialize */ + const boost::shared_ptr& hierarchy, + /*! Level to initialize */ + const int level_number, + const double init_data_time, + const bool can_be_refined, + /*! Whether level is being introduced for the first time */ + const bool initial_time, + /*! Level to copy data from */ + const boost::shared_ptr& old_level = + boost::shared_ptr(), + /*! Whether data on new patch needs to be allocated */ + const bool allocate_data = true) + { + NULL_USE(hierarchy); + NULL_USE(level_number); + NULL_USE(init_data_time); + NULL_USE(can_be_refined); + NULL_USE(initial_time); + NULL_USE(old_level); + NULL_USE(allocate_data); + } + + virtual void + applyGradientDetector( + const boost::shared_ptr& hierarchy, + const int level_number, + const double error_data_time, + const int tag_index, + const bool initial_time, + const bool uses_richardson_extrapolation); + + //@} + + /*! + * @brief Set the independent time variable in the front equation. + */ + void + setTime(double time) { + d_time_shift = time; + } + +private: + std::string d_name; + + const tbox::Dimension d_dim; + + /*! + * @brief PatchHierarchy for use in implementations of some + * abstract interfaces that do not specify a hierarch. + */ + boost::shared_ptr d_hierarchy; + + /*! + * @brief Period of sinusoid. + */ + double d_period[SAMRAI::MAX_DIM_VAL]; + + /*! + * @brief Initial displacement. + */ + double d_init_disp[SAMRAI::MAX_DIM_VAL]; + + /*! + * @brief Front velocity. + */ + double d_velocity[SAMRAI::MAX_DIM_VAL]; + + /*! + * @brief Constant time shift to be added to simulation time. + */ + double d_time_shift; + + /*! + * @brief Amplitude of sinusoid. + */ + double d_amplitude; + + /*! + * @brief Buffer distances for generating tags. + */ + std::vector > d_buffer_distance; + + DerivedVisOwnerData d_vis_owner_data; + + boost::shared_ptr t_setup; + boost::shared_ptr t_node_pos; + boost::shared_ptr t_distance; + boost::shared_ptr t_uval; + boost::shared_ptr t_tag_cells; + +}; + +#endif // included_SinusoidalFrontGenerator diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.C b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.C new file mode 100644 index 00000000..509ed1d8 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.C @@ -0,0 +1,870 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility routines for manipulating 2D Skeleton boundary data + * + ************************************************************************/ + +#include "SkeletonBoundaryUtilities2.h" + +#include "SAMRAI/appu/CartesianBoundaryDefines.h" + +#include "SAMRAI/hier/BoundaryBox.h" +#include "SAMRAI/pdat/CellIndex.h" +#include "SAMRAI/hier/PatchGeometry.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +/* + ************************************************************************* + * + * External declarations for FORTRAN 77 routines used in + * boundary condition implementation. + * + ************************************************************************* + */ + +extern "C" { + +void SAMRAI_F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&); + +void SAMRAI_F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&); + +void SAMRAI_F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const int&, + const double *, + double *, + const int&); + +void SAMRAI_F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, + const int&, + const double *, + double *, + const int&); + +} + +using namespace std; +using namespace SAMRAI; +using namespace appu; + +bool SkeletonBoundaryUtilities2::s_fortran_constants_stuffed = false; + +/* + * This function reads 2D boundary data from given input database. + * The integer boundary condition types are placed in the integer + * arrays supplied by the caller (typically, the concrete BoundaryStrategy + * provided). When DIRICHLET or NEUMANN conditions are specified, control + * is passed to the BoundaryStrategy to read the boundary state data + * specific to the problem. + * + * Errors will be reported and the program will abort whenever necessary + * boundary condition information is missing in the input database, or + * when the data read in is either unknown or inconsistent. The periodic + * domain information is used to determine which boundary edges or + * node entries are not required from input. Error checking requires + * that node boundary conditions are consistent with those + * specified for the edges. + * + * Arguments are: + * bdry_strategy .... object that reads DIRICHLET or NEUMANN data + * input_db ......... input database containing all boundary data + * edge_conds ....... vector into which integer boundary conditions + * for edges are read + * node_conds ....... vector into which integer boundary conditions + * for nodes are read + * periodic ......... integer vector specifying which coordinate + * directions are periodic (value returned from + * GridGeometry2::getPeriodicShift()) + */ + +void SkeletonBoundaryUtilities2::getFromInput( + BoundaryUtilityStrategy* bdry_strategy, + const boost::shared_ptr& input_db, + std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_2D_NODES); + + if (!s_fortran_constants_stuffed) { + stuff2dBdryFortConst(); + } + + read2dBdryEdges(bdry_strategy, + input_db, + edge_conds, + periodic); + + read2dBdryNodes(input_db, + edge_conds, + node_conds, + periodic); + +} + +/* + * Function to fill edge boundary values. + * + * Arguments are: + * varname .............. name of variable (for error reporting) + * vardata .............. cell-centered patch data object to check + * patch ................ patch on which data object lives + * ghost_width_to_fill .. width of ghost region to fill + * bdry_edge_conds ...... vector of boundary conditions for patch edges + * bdry_edge_values ..... vector of boundary values for edges + * (this must be consistent with boundary + * condition types) + */ + +void SkeletonBoundaryUtilities2::fillEdgeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_fill_width, + const std::vector& bdry_edge_conds, + const std::vector& bdry_edge_values) +{ + NULL_USE(varname); + + TBOX_ASSERT(vardata); + TBOX_ASSERT(static_cast(bdry_edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(bdry_edge_values.size()) == + NUM_2D_EDGES * (vardata->getDepth())); + + if (!s_fortran_constants_stuffed) { + stuff2dBdryFortConst(); + } + + const boost::shared_ptr pgeom( + patch.getPatchGeometry()); + + const hier::Box& interior = patch.getBox(); + const hier::Index& ifirst(interior.lower()); + const hier::Index& ilast(interior.upper()); + + const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); + + hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, + ghost_fill_width); + + const std::vector& edge_bdry = + pgeom->getCodimensionBoundaries(Bdry::EDGE2D); + for (int i = 0; i < static_cast(edge_bdry.size()); ++i) { + TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE2D); + + int bedge_loc = edge_bdry[i].getLocationIndex(); + + hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], + interior, + gcw_to_fill)); + + if (!fill_box.empty()) { + const hier::Index& ibeg(fill_box.lower()); + const hier::Index& iend(fill_box.upper()); + + SAMRAI_F77_FUNC(getskeledgebdry2d, GETSKELEDGEBDRY2D) ( + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ibeg(0), iend(0), + ibeg(1), iend(1), + ghost_cells(0), ghost_cells(1), + bedge_loc, + bdry_edge_conds[bedge_loc], + &bdry_edge_values[0], + vardata->getPointer(), + vardata->getDepth()); + } + + } + +} + +/* + * Function to fill node boundary values. + * + * Arguments are: + * varname .............. name of variable (for error reporting) + * vardata .............. cell-centered patch data object to check + * patch ................ patch on which data object lives + * ghost_width_to_fill .. width of ghost region to fill + * bdry_node_conds ...... vector of boundary conditions for patch nodes + * bdry_edge_values ..... vector of boundary values for edges + * (this must be consistent with boundary + * condition types) + */ + +void SkeletonBoundaryUtilities2::fillNodeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_fill_width, + const std::vector& bdry_node_conds, + const std::vector& bdry_edge_values) +{ + NULL_USE(varname); + + TBOX_ASSERT(vardata); + TBOX_ASSERT(static_cast(bdry_node_conds.size()) == NUM_2D_NODES); + TBOX_ASSERT(static_cast(bdry_edge_values.size()) == + NUM_2D_EDGES * (vardata->getDepth())); + + if (!s_fortran_constants_stuffed) { + stuff2dBdryFortConst(); + } + + const boost::shared_ptr pgeom( + patch.getPatchGeometry()); + + const hier::Box& interior(patch.getBox()); + const hier::Index& ifirst(interior.lower()); + const hier::Index& ilast(interior.upper()); + + const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); + + hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, + ghost_fill_width); + + const std::vector& node_bdry = + pgeom->getCodimensionBoundaries(Bdry::NODE2D); + + for (int i = 0; i < static_cast(node_bdry.size()); ++i) { + TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE2D); + + int bnode_loc = node_bdry[i].getLocationIndex(); + + hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], + interior, + gcw_to_fill)); + + if (!fill_box.empty()) { + const hier::Index& ibeg(fill_box.lower()); + const hier::Index& iend(fill_box.upper()); + + SAMRAI_F77_FUNC(getskelnodebdry2d, GETSKELNODEBDRY2D) ( + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ibeg(0), iend(0), + ibeg(1), iend(1), + ghost_cells(0), ghost_cells(1), + bnode_loc, + bdry_node_conds[bnode_loc], + &bdry_edge_values[0], + vardata->getPointer(), + vardata->getDepth()); + } + + } + +} + +/* + * Function that returns the integer edge boundary location + * corresponding to the given node location and node boundary + * condition. + * + * If the node boundary condition type or node location are unknown, + * or the boundary condition type is inconsistant with the node location + * an error results. + */ + +int SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry( + int node_loc, + int node_btype) +{ + + int ret_edge = -1; + + switch (node_btype) { + case BdryCond::XFLOW: + case BdryCond::XREFLECT: + case BdryCond::XDIRICHLET: + { + if (node_loc == NodeBdyLoc2D::XLO_YLO || + node_loc == NodeBdyLoc2D::XLO_YHI) { + ret_edge = BdryLoc::XLO; + } else { + ret_edge = BdryLoc::XHI; + } + break; + } + case BdryCond::YFLOW: + case BdryCond::YREFLECT: + case BdryCond::YDIRICHLET: + { + if (node_loc == NodeBdyLoc2D::XLO_YLO || + node_loc == NodeBdyLoc2D::XHI_YLO) { + ret_edge = BdryLoc::YLO; + } else { + ret_edge = BdryLoc::YHI; + } + break; + } + default: { + TBOX_ERROR("Unknown node boundary condition type = " + << node_btype << " passed to \n" + << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" + << endl); + } + } + + if (ret_edge == -1) { + TBOX_ERROR("Node boundary condition type = " + << node_btype << " and node location = " << node_loc + << "\n passed to " + << "SkeletonBoundaryUtilities2::getEdgeLocationForNodeBdry" + << " are inconsistant." << endl); + } + + return ret_edge; + +} + +/* + * Function to check 2D boundary data filling. Arguments are: + * + * varname ..... name of variable (for error reporting) + * patch ....... patch on which boundary data to check lives + * data_id ..... patch data index on patch + * depth ....... depth index of data to check + * gcw_to_check. boundary ghost width to fill + * bbox ........ boundary box to check + * bcase ....... boundary condition case for edge or a node to check + * bstate ...... boundary state that applies when such a value is + * required, such as when using Dirichlet conditions + */ + +int SkeletonBoundaryUtilities2::checkBdryData( + const string& varname, + const hier::Patch& patch, + int data_id, + int depth, + const hier::IntVector& gcw_to_check, + const hier::BoundaryBox& bbox, + int bcase, + double bstate) +{ + TBOX_ASSERT(!varname.empty()); + TBOX_ASSERT(data_id >= 0); + TBOX_ASSERT(depth >= 0); + + int num_bad_values = 0; + + int btype = bbox.getBoundaryType(); + int bloc = bbox.getLocationIndex(); + + boost::shared_ptr pgeom(patch.getPatchGeometry()); + + boost::shared_ptr > vardata( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(data_id))); + TBOX_ASSERT(vardata); + + string bdry_type_str; + if (btype == Bdry::EDGE2D) { + bdry_type_str = "EDGE"; + } else if (btype == Bdry::NODE2D) { + bdry_type_str = "NODE"; + } else { + TBOX_ERROR( + "Unknown btype " << btype + << " passed to SkeletonBoundaryUtilities2::checkBdryData()! " + << endl); + } + + tbox::plog << "\n\nCHECKING 2D " << bdry_type_str << " BDRY DATA..." << endl; + tbox::plog << "varname = " << varname << " : depth = " << depth << endl; + tbox::plog << "bbox = " << bbox.getBox() << endl; + tbox::plog << "btype, bloc, bcase = " + << btype << ", = " << bloc << ", = " << bcase << endl; + + tbox::Dimension::dir_t idir; + double valfact = 0.0, constval = 0.0, dxfact = 0.0; + int offsign; + + get2dBdryDirectionCheckValues(idir, offsign, + btype, bloc, bcase); + + if (btype == Bdry::EDGE2D) { + + if (bcase == BdryCond::FLOW) { + valfact = 1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::REFLECT) { + valfact = -1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::DIRICHLET) { + valfact = 0.0; + constval = bstate; + dxfact = 0.0; + } else { + TBOX_ERROR( + "Unknown bcase " << bcase + << " passed to SkeletonBoundaryUtilities2::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + + } else if (btype == Bdry::NODE2D) { + + if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW) { + valfact = 1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT) { + valfact = -1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XDIRICHLET || + bcase == BdryCond::YDIRICHLET) { + valfact = 0.0; + constval = bstate; + dxfact = 0.0; + } else { + TBOX_ERROR( + "Unknown bcase " << bcase + << " passed to SkeletonBoundaryUtilities2::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + + } + + hier::Box gbox_to_check( + vardata->getGhostBox() * pgeom->getBoundaryFillBox(bbox, + patch.getBox(), + gcw_to_check)); + + hier::Box cbox(gbox_to_check); + hier::Box dbox(gbox_to_check); + hier::Index ifirst(vardata->getBox().lower()); + hier::Index ilast(vardata->getBox().upper()); + + if (offsign == -1) { + cbox.setLower(idir, ifirst(idir) - 1); + cbox.setUpper(idir, ifirst(idir) - 1); + dbox.setLower(idir, ifirst(idir)); + dbox.setUpper(idir, ifirst(idir)); + } else { + cbox.setLower(idir, ilast(idir) + 1); + cbox.setUpper(idir, ilast(idir) + 1); + dbox.setLower(idir, ilast(idir)); + dbox.setUpper(idir, ilast(idir)); + } + + pdat::CellIterator id(pdat::CellGeometry::begin(dbox)); + pdat::CellIterator icend(pdat::CellGeometry::end(cbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(cbox)); + ic != icend; ++ic) { + double checkval = valfact * (*vardata)(*id, depth) + constval; + pdat::CellIndex check = *ic; + for (int p = 0; p < gbox_to_check.numberCells(idir); ++p) { + double offcheckval = checkval + dxfact * (p + 1); + if ((*vardata)(check, depth) != offcheckval) { + ++num_bad_values; + TBOX_WARNING("Bad " << bdry_type_str + << " boundary value for " << varname + << " found in cell " << check + << "\n found = " << (*vardata)(check, depth) + << " : correct = " << offcheckval << endl); + } + check(idir) += offsign; + } + ++id; + } + + return num_bad_values; + +} + +/* + * Private function to read 2D edge boundary data from input database. + */ + +void SkeletonBoundaryUtilities2::read2dBdryEdges( + BoundaryUtilityStrategy* bdry_strategy, + boost::shared_ptr input_db, + std::vector& edge_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); + + int num_per_dirs = 0; + for (int id = 0; id < 2; ++id) { + if (periodic(id)) ++num_per_dirs; + } + + if (num_per_dirs < 2) { // face boundary input required + + for (int s = 0; s < NUM_2D_EDGES; ++s) { + + string bdry_loc_str; + switch (s) { + case BdryLoc::XLO: { + bdry_loc_str = "boundary_edge_xlo"; + break; + } + case BdryLoc::XHI: { + bdry_loc_str = "boundary_edge_xhi"; + break; + } + case BdryLoc::YLO: { + bdry_loc_str = "boundary_edge_ylo"; + break; + } + case BdryLoc::YHI: { + bdry_loc_str = "boundary_edge_yhi"; + break; + } + default: NULL_STATEMENT; + } + + bool need_data_read = true; + if (num_per_dirs > 0) { + if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { + need_data_read = false; + } else if (periodic(1) && (s == BdryLoc::YLO || + s == BdryLoc::YHI)) { + need_data_read = false; + } + } + + if (need_data_read) { + if (input_db->keyExists(bdry_loc_str)) { + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + if (bdry_loc_db) { + if (bdry_loc_db->keyExists("boundary_condition")) { + string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "FLOW") { + edge_conds[s] = BdryCond::FLOW; + } else if (bdry_cond_str == "REFLECT") { + edge_conds[s] = BdryCond::REFLECT; + } else if (bdry_cond_str == "DIRICHLET") { + edge_conds[s] = BdryCond::DIRICHLET; + bdry_strategy-> + readDirichletBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); + } else { + TBOX_ERROR("Unknown edge boundary string = " + << bdry_cond_str << " found in input." << endl); + } + } else { + TBOX_ERROR("'boundary_condition' entry missing from " + << bdry_loc_str << " input database." << endl); + } + } + } else { + TBOX_ERROR(bdry_loc_str + << " database entry not found in input." << endl); + } + } // if (need_data_read) + + } // for (int s = 0 ... + + } // if (num_per_dirs < 2) + +} + +/* + * Private function to read 2D node boundary data from input database. + */ + +void SkeletonBoundaryUtilities2::read2dBdryNodes( + boost::shared_ptr input_db, + const std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_2D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_2D_NODES); + + int num_per_dirs = 0; + for (int id = 0; id < 2; ++id) { + if (periodic(id)) ++num_per_dirs; + } + + if (num_per_dirs < 1) { // node boundary data required + + for (int s = 0; s < NUM_2D_NODES; ++s) { + + string bdry_loc_str; + switch (s) { + case NodeBdyLoc2D::XLO_YLO: { + bdry_loc_str = "boundary_node_xlo_ylo"; + break; + } + case NodeBdyLoc2D::XHI_YLO: { + bdry_loc_str = "boundary_node_xhi_ylo"; + break; + } + case NodeBdyLoc2D::XLO_YHI: { + bdry_loc_str = "boundary_node_xlo_yhi"; + break; + } + case NodeBdyLoc2D::XHI_YHI: { + bdry_loc_str = "boundary_node_xhi_yhi"; + break; + } + default: NULL_STATEMENT; + } + + if (input_db->keyExists(bdry_loc_str)) { + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + if (bdry_loc_db) { + if (bdry_loc_db->keyExists("boundary_condition")) { + string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + node_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + node_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "XREFLECT") { + node_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + node_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + node_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + node_conds[s] = BdryCond::YDIRICHLET; + } else { + TBOX_ERROR("Unknown node boundary string = " + << bdry_cond_str << " found in input." << endl); + } + + string proper_edge; + string proper_edge_data; + bool no_edge_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XREFLECT") { + if (s == NodeBdyLoc2D::XLO_YLO || + s == NodeBdyLoc2D::XLO_YHI) { + proper_edge = "XLO"; + if (bdry_cond_str == "XFLOW" && + edge_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + edge_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "XREFLECT" && + edge_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } else { + proper_edge = "XHI"; + if (bdry_cond_str == "XFLOW" && + edge_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + edge_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "XREFLECT" && + edge_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YREFLECT") { + if (s == NodeBdyLoc2D::XLO_YLO || + s == NodeBdyLoc2D::XHI_YLO) { + proper_edge = "YLO"; + if (bdry_cond_str == "YFLOW" && + edge_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + edge_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "YREFLECT" && + edge_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } else { + proper_edge = "YHI"; + if (bdry_cond_str == "YFLOW" && + edge_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_edge_data_found = true; + proper_edge_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + edge_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_edge_data_found = true; + proper_edge_data = "DIRICHLET"; + } + if (bdry_cond_str == "YREFLECT" && + edge_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_edge_data_found = true; + proper_edge_data = "REFLECT"; + } + } + } + if (no_edge_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_edge_data + << " data found for edge " + << proper_edge << endl); + } + + } else { + TBOX_ERROR("'boundary_condition' entry missing from " + << bdry_loc_str << " input database." << endl); + } + } + } else { + TBOX_ERROR(bdry_loc_str + << " database entry not found in input." << endl); + } + + } // for (int s = 0 ... + + } // if (num_per_dirs < 1) + +} + +/* + * Private function to get boundary orientation information for + * 2D boundary condition checking. Called from checkBdryData(). + */ + +void SkeletonBoundaryUtilities2::get2dBdryDirectionCheckValues( + tbox::Dimension::dir_t& idir, + int& offsign, + int btype, + int bloc, + int bcase) +{ + + string bdry_type_str; + + if (btype == Bdry::EDGE2D) { + + bdry_type_str = "NODE"; + + if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { + idir = 0; + if (bloc == BdryLoc::XLO) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { + idir = 1; + if (bloc == BdryLoc::YLO) { + offsign = -1; + } else { + offsign = 1; + } + } else { + TBOX_ERROR( + "Unknown boundary location " << bloc + << + " passed to SkeletonBoundaryUtilities2::checkBdryData()" + << "\n for " + << bdry_type_str << " boundary " << endl); + } + + } else if (btype == Bdry::NODE2D) { + + bdry_type_str = "NODE"; + + if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || + bcase == BdryCond::XDIRICHLET) { + idir = 0; + if (bloc == NodeBdyLoc2D::XLO_YLO || + bloc == NodeBdyLoc2D::XLO_YHI) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || + bcase == BdryCond::YDIRICHLET) { + idir = 1; + if (bloc == NodeBdyLoc2D::XLO_YLO || + bloc == NodeBdyLoc2D::XHI_YLO) { + offsign = -1; + } else { + offsign = 1; + } + } + + } else { + TBOX_ERROR( + "Unknown boundary type " << btype + << " passed to SkeletonBoundaryUtilities2::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + +} + +/* + * Private function to stuff 2D boundary contants into Fortran common blocks + */ + +void SkeletonBoundaryUtilities2::stuff2dBdryFortConst() +{ + SAMRAI_F77_FUNC(stufskelbdryloc2d, STUFSKELBDRYLOC2D) ( + BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, + NodeBdyLoc2D::XLO_YLO, NodeBdyLoc2D::XHI_YLO, + NodeBdyLoc2D::XLO_YHI, NodeBdyLoc2D::XHI_YHI); + SAMRAI_F77_FUNC(stufskelbdrycond2d, STUFSKELBDRYCOND2D) ( + BdryCond::FLOW, + BdryCond::XFLOW, BdryCond::YFLOW, + BdryCond::REFLECT, + BdryCond::XREFLECT, BdryCond::YREFLECT, + BdryCond::DIRICHLET, + BdryCond::XDIRICHLET, BdryCond::YDIRICHLET); + s_fortran_constants_stuffed = true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.h b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.h new file mode 100644 index 00000000..1af9313e --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities2.h @@ -0,0 +1,265 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility routines for manipulating Skeleton 2d boundary data + * + ************************************************************************/ + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/appu/BoundaryUtilityStrategy.h" +#include "SAMRAI/hier/BoundaryBox.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/tbox/Database.h" + +#include "boost/shared_ptr.hpp" +#ifndef included_String +#include +#define included_String +#endif + +#include + +/*! + * @brief Class SkeletonBoundaryUtilities2 is a utility class that + * simplifies the implementation of simple physical boundary data in + * 2 spatial dimensions. It contains routines for reading boundary data + * information from input files, applying those boundary conditions, + * and error checking boundary data. These routines apply to the + * case of cell-centered double data only. One may use all of these + * capabilities, or use the input reading, boundary setting, and error + * checking routines independently. + * + * To use the boundary condition input reading capabilities, the format + * of the input file section containing the boundary information must + * be as described next. Boundary node and edge entries are only + * required for those that are not filled automatically when periodic + * conditions apply. + * + * The boundary condition for edge "*" is provided in a section as follows: + * + * \verbatim + * + * boundary_edge_* { + * boundary_condition = ... // boundary condition string identifier + * // Any problem-specific boundary data read by user routines + * // is placed here... + * } + * + * Allowable edge identifiers (i.e., values for "*") are: + * xlo, xhi, ylo, yhi + * Supported edge boundary_condition strin values are: + * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" + * + * \endverbatim + * + * The boundary condition for node "*" is provided in a section as follows: + * + * \verbatim + * + * boundary_node_* { + * boundary_condition = ... // boundary condition string identifier + * } + * + * Allowable node identifiers (i.e., values for "*") are: + * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi + * Supported node boundary_condition string values are: + * "XFLOW", "YFLOW", + * "XREFLECT", "YREFLECT", + * "XDIRICHLET", "YDIRICHLET", + * "XNEUMANN", "YNEUMANN" + * + * \endverbatim + * + * Note that node conditions must be consistent with adjacent edge conditions. + * + * See the include file SkeletonBoundaryDefines.h for integer constant + * definitions that apply for the various boundary types, locations, + * and boundary conditions. If you choose to use the input reading + * capabilities only and write your own boundary condition routines in + * FORTRAN, you should note that the integer constants for the various + * boundary condition types and locations are automatically "stuffed" into + * FORTRAN common blocks. This avoids potential problems with + * inconsistencies between C++ and FORTRAN usage. Please see the + * FORTRAN include file cartbdryparams2d.i for details. + * + * @see appu::BoundaryUtilityStrategy2 + */ + +using namespace std; +using namespace SAMRAI; +using namespace appu; + +struct SkeletonBoundaryUtilities2 { +public: + /*! + * Function to read 2d boundary data from input database. + * The integer boundary condition types are placed in the integer + * arrays supplied by the caller (typically, the concrete + * BoundaryUtilityStrategy object provided). When DIRICHLET or + * NEUMANN conditions are specified, control is passed to the + * BoundaryUtilityStrategy to read the boundary state data specific to + * the problem. + * + * Errors will be reported and the program will abort whenever necessary + * boundary condition information is missing in the input database, or + * when the data read in is either unknown or inconsistent. The periodic + * domain information is used to determine which boundary edge or + * node entries are not required from input. Error checking + * requires that node boundary conditions are consistent + * with those specified for the edges. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN + * conditions + * @param input_db input database containing all boundary data + * @param edge_conds vector into which integer edge boundary condition + * types are read + * @param node_conds vector into which integer node boundary condition + * types are read + * @param periodic integer vector specifying which coordinate + * directions are periodic (e.g., value returned from + * GridGeometry2::getPeriodicShift()) + */ + static void + getFromInput( + BoundaryUtilityStrategy* bdry_strategy, + const boost::shared_ptr& input_db, + std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic); + + /*! + * Function to fill 2d edge boundary values for a patch. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param varname String name of variable (for error reporting). + * @param vardata Cell-centered patch data object to fill. + * @param patch hier::Patch on which data object lives. + * @param ghost_width_to_fill Width of ghost region to fill. + * @param bdry_edge_conds std::vector of boundary condition types for + * patch edges. + * @param bdry_edge_values std::vector of boundary values for patch edges. + */ + static void + fillEdgeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_width_to_fill, + const std::vector& bdry_edge_conds, + const std::vector& bdry_edge_values); + + /*! + * Function to fill 2d node boundary values for a patch. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param varname String name of variable (for error reporting). + * @param vardata Cell-centered patch data object to fill. + * @param patch hier::Patch on which data object lives. + * @param ghost_width_to_fill Width of ghost region to fill. + * @param bdry_node_conds std::vector of boundary condition types for + * patch nodes. + * @param bdry_edge_values std::vector of boundary values for patch edges. + */ + static void + fillNodeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_width_to_fill, + const std::vector& bdry_node_conds, + const std::vector& bdry_edge_values); + + /*! + * Function that returns the integer edge boundary location + * corresponding to the given node location and node boundary + * condition. + * + * If the node boundary condition type or node location are unknown, + * or the boundary condition type is inconsistant with the node location + * an error results. + * + * @return Integer edge location for node location and boundary condition type. + * + * @param node_loc Integer location for node. + * @param node_btype Integer boundary condition type for node. + */ + static int + getEdgeLocationForNodeBdry( + int node_loc, + int node_btype); + + /*! + * Function to check 2d boundary data for a patch data quantity on + * a patch after it is set. A warning message will be sent to log + * file for each bad boundary value that is found. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @return Integer number of bad boundary values found. + * + * @param varname String name of variable (for error reporting). + * @param patch hier::Patch on which data object lives. + * @param data_id hier::Patch data index for data on patch. + * @param depth Depth index of patch data to check. + * @param gcw_to_check Width of ghost region to check. + * @param bbox Boundary box to check. + * @param bcase Boundary condition type for given edge or node. + * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. + */ + static int + checkBdryData( + const string& varname, + const hier::Patch& patch, + int data_id, + int depth, + const hier::IntVector& gcw_to_check, + const hier::BoundaryBox& bbox, + int bcase, + double bstate); + +private: + static bool s_fortran_constants_stuffed; + + static void + read2dBdryEdges( + BoundaryUtilityStrategy* bdry_strategy, + boost::shared_ptr input_db, + std::vector& edge_conds, + const hier::IntVector& periodic); + + static void + read2dBdryNodes( + boost::shared_ptr input_db, + const std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic); + + static void + get2dBdryDirectionCheckValues( + tbox::Dimension::dir_t& idir, + int& offsign, + int btype, + int bloc, + int bcase); + + static void + stuff2dBdryFortConst(); +}; diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.C b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.C new file mode 100644 index 00000000..75622d42 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.C @@ -0,0 +1,1660 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility routines for manipulating 3D Skeleton boundary data + * + ************************************************************************/ + +#include "SkeletonBoundaryUtilities3.h" + +#include "SAMRAI/appu/CartesianBoundaryDefines.h" + +#include "SAMRAI/hier/PatchGeometry.h" +#include "SAMRAI/hier/BoundaryBox.h" +#include "SAMRAI/pdat/CellIndex.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +/* + ************************************************************************* + * + * External declarations for FORTRAN 77 routines used in + * boundary condition implementation. + * + ************************************************************************* + */ + +extern "C" { + +void SAMRAI_F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&); + +void SAMRAI_F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( + const int&, + const int&, const int&, const int&, + const int&, + const int&, const int&, const int&, + const int&, + const int&, const int&, const int&, + const int&, + const int&, const int&, const int&); + +void SAMRAI_F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const double *, + const int&, + const int&, + const double *, + double *, + const int&); + +void SAMRAI_F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const double *, + const int&, + const int&, + const double *, + double *, + const int&); + +void SAMRAI_F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, const int&, + const double *, + const int&, + const int&, + const double *, + double *, + const int&); + +} +using namespace SAMRAI; +using namespace appu; + +bool SkeletonBoundaryUtilities3::s_fortran_constants_stuffed = false; + +/* + * This function reads 3D boundary data from given input database. + * The integer boundary condition types are placed in the integer + * arrays supplied by the caller (typically, the concrete BoundaryStrategy + * provided). When DIRICHLET or NEUMANN conditions are specified, control + * is passed to the BoundaryStrategy to read the boundary state data + * specific to the problem. + * + * Errors will be reported and the program will abort whenever necessary + * boundary condition information is missing in the input database, or + * when the data read in is either unknown or inconsistent. The periodic + * domain information is used to determine which boundary face, edge, or + * node entries are not required from input. Error checking requires + * that node and edge boundary conditions are consistent with those + * specified for the faces. + * + * Arguments are: + * bdry_strategy .... object that reads DIRICHLET or NEUMANN conditions + * input_db ......... input database containing all boundary data + * face_conds ....... vector into which integer boundary conditions + * for faces are read + * edge_conds ....... vector into which integer boundary conditions + * for edges are read + * node_conds ....... vector into which integer boundary conditions + * for nodes are read + * periodic ......... integer vector specifying which coordinate + * directions are periodic (value returned from + * GridGeometry3::getPeriodicShift()) + */ + +void SkeletonBoundaryUtilities3::getFromInput( + BoundaryUtilityStrategy* bdry_strategy, + const boost::shared_ptr& input_db, + std::vector& face_conds, + std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_3D_EDGES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_3D_NODES); + + if (!s_fortran_constants_stuffed) { + stuff3dBdryFortConst(); + } + + read3dBdryFaces(bdry_strategy, + input_db, + face_conds, + periodic); + + read3dBdryEdges(input_db, + face_conds, + edge_conds, + periodic); + + read3dBdryNodes(input_db, + face_conds, + node_conds, + periodic); + +} + +/* + * Function to fill face boundary values. + * + * Arguments are: + * varname .............. name of variable (for error reporting) + * vardata .............. cell-centered patch data object to check + * patch ................ patch on which data object lives + * ghost_width_to_fill .. width of ghost region to fill + * bdry_face_conds ...... vector of boundary conditions for patch faces + * bdry_face_values ..... vector of boundary values for faces + * (this must be consistent with boundary + * condition types) + */ + +void SkeletonBoundaryUtilities3::fillFaceBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_fill_width, + const std::vector& bdry_face_conds, + const std::vector& bdry_face_values) +{ + NULL_USE(varname); + TBOX_ASSERT(vardata); + TBOX_ASSERT(static_cast(bdry_face_conds.size()) == NUM_3D_FACES); +// TBOX_ASSERT(static_cast(static_cast(bdry_face_values.size())) == +// NUM_3D_FACES*(vardata->getDepth())); + + if (!s_fortran_constants_stuffed) { + stuff3dBdryFortConst(); + } + + const boost::shared_ptr pgeom( + patch.getPatchGeometry()); + //const double* dx = pgeom->getDx(); + const double dx[3] = { 0., 0., 0. }; + + const hier::Box& interior(patch.getBox()); + const hier::Index& ifirst(interior.lower()); + const hier::Index& ilast(interior.upper()); + + const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); + + hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, + ghost_fill_width); + const std::vector& face_bdry = + pgeom->getCodimensionBoundaries(Bdry::FACE3D); + for (int i = 0; i < static_cast(face_bdry.size()); ++i) { + TBOX_ASSERT(face_bdry[i].getBoundaryType() == Bdry::FACE3D); + + int bface_loc = face_bdry[i].getLocationIndex(); + + hier::Box fill_box(pgeom->getBoundaryFillBox(face_bdry[i], + interior, + gcw_to_fill)); + const hier::Index& ibeg(fill_box.lower()); + const hier::Index& iend(fill_box.upper()); + + SAMRAI_F77_FUNC(getcartfacebdry3d, GETCARTFACEBDRY3D) ( + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ibeg(0), iend(0), + ibeg(1), iend(1), + ibeg(2), iend(2), + ghost_cells(0), ghost_cells(1), ghost_cells(2), + dx, + bface_loc, + bdry_face_conds[bface_loc], + &bdry_face_values[0], + vardata->getPointer(), + vardata->getDepth()); + + } + +} + +/* + * Function to fill edge boundary values. + * + * Arguments are: + * varname .............. name of variable (for error reporting) + * vardata .............. cell-centered patch data object to check + * patch ................ patch on which data object lives + * ghost_width_to_fill .. width of ghost region to fill + * bdry_edge_conds ...... vector of boundary conditions for patch edges + * bdry_face_values ..... vector of boundary values for faces + * (this must be consistent with boundary + * condition types) + */ + +void SkeletonBoundaryUtilities3::fillEdgeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_fill_width, + const std::vector& bdry_edge_conds, + const std::vector& bdry_face_values) +{ + NULL_USE(varname); + + TBOX_ASSERT(vardata); + TBOX_ASSERT(static_cast(bdry_edge_conds.size()) == NUM_3D_EDGES); + TBOX_ASSERT(static_cast(bdry_face_values.size()) == + NUM_3D_FACES * (vardata->getDepth())); + + if (!s_fortran_constants_stuffed) { + stuff3dBdryFortConst(); + } + + const boost::shared_ptr pgeom( + patch.getPatchGeometry()); + //const double* dx = pgeom->getDx(); + const double dx[3] = { 0., 0., 0. }; + + const hier::Box& interior(patch.getBox()); + const hier::Index& ifirst(interior.lower()); + const hier::Index& ilast(interior.upper()); + + const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); + + hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, + ghost_fill_width); + + const std::vector& edge_bdry = + pgeom->getCodimensionBoundaries(Bdry::EDGE3D); + for (int i = 0; i < static_cast(edge_bdry.size()); ++i) { + TBOX_ASSERT(edge_bdry[i].getBoundaryType() == Bdry::EDGE3D); + + int bedge_loc = edge_bdry[i].getLocationIndex(); + + hier::Box fill_box(pgeom->getBoundaryFillBox(edge_bdry[i], + interior, + gcw_to_fill)); + const hier::Index& ibeg(fill_box.lower()); + const hier::Index& iend(fill_box.upper()); + + SAMRAI_F77_FUNC(getcartedgebdry3d, GETCARTEDGEBDRY3D) ( + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ibeg(0), iend(0), + ibeg(1), iend(1), + ibeg(2), iend(2), + ghost_cells(0), ghost_cells(1), ghost_cells(2), + dx, + bedge_loc, + bdry_edge_conds[bedge_loc], + &bdry_face_values[0], + vardata->getPointer(), + vardata->getDepth()); + + } + +} + +/* + * Function to fill node boundary values. + * + * Arguments are: + * varname .............. name of variable (for error reporting) + * vardata .............. cell-centered patch data object to check + * patch ................ patch on which data object lives + * ghost_width_to_fill .. width of ghost region to fill + * bdry_node_conds ...... vector of boundary conditions for patch nodes + * bdry_face_values ..... vector of boundary values for faces + * (this must be consistent with boundary + * condition types) + */ + +void SkeletonBoundaryUtilities3::fillNodeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_fill_width, + const std::vector& bdry_node_conds, + const std::vector& bdry_face_values) +{ + NULL_USE(varname); + + TBOX_ASSERT(vardata); + TBOX_ASSERT(static_cast(bdry_node_conds.size()) == NUM_3D_NODES); + TBOX_ASSERT(static_cast(bdry_face_values.size()) == + NUM_3D_FACES * (vardata->getDepth())); + + if (!s_fortran_constants_stuffed) { + stuff3dBdryFortConst(); + } + + const boost::shared_ptr pgeom( + patch.getPatchGeometry()); + //const double* dx = pgeom->getDx(); + const double dx[3] = { 0., 0., 0. }; + + const hier::Box& interior(patch.getBox()); + const hier::Index& ifirst(interior.lower()); + const hier::Index& ilast(interior.upper()); + + const hier::IntVector& ghost_cells = vardata->getGhostCellWidth(); + + hier::IntVector gcw_to_fill = hier::IntVector::min(ghost_cells, + ghost_fill_width); + + const std::vector& node_bdry = + pgeom->getCodimensionBoundaries(Bdry::NODE3D); + for (int i = 0; i < static_cast(node_bdry.size()); ++i) { + TBOX_ASSERT(node_bdry[i].getBoundaryType() == Bdry::NODE3D); + + int bnode_loc = node_bdry[i].getLocationIndex(); + + hier::Box fill_box(pgeom->getBoundaryFillBox(node_bdry[i], + interior, + gcw_to_fill)); + const hier::Index& ibeg(fill_box.lower()); + const hier::Index& iend(fill_box.upper()); + + SAMRAI_F77_FUNC(getcartnodebdry3d, GETCARTNODEBDRY3D) ( + ifirst(0), ilast(0), + ifirst(1), ilast(1), + ifirst(2), ilast(2), + ibeg(0), iend(0), + ibeg(1), iend(1), + ibeg(2), iend(2), + ghost_cells(0), ghost_cells(1), ghost_cells(2), + dx, + bnode_loc, + bdry_node_conds[bnode_loc], + &bdry_face_values[0], + vardata->getPointer(), + vardata->getDepth()); + + } + +} + +/* + * Function that returns the integer face boundary location + * corresponding to the given edge location and edge boundary + * condition. + * + * If the edge boundary condition type or edge location are unknown, + * or the boundary condition type is inconsistant with the edge location + * an error results. + */ + +int SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry( + int edge_loc, + int edge_btype) +{ + + int ret_face = -1; + + switch (edge_btype) { + case BdryCond::XFLOW: + case BdryCond::XREFLECT: + case BdryCond::XDIRICHLET: + case BdryCond::XNEUMANN: + { + if (edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XLO_ZHI || + edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XLO_YHI) { + ret_face = BdryLoc::XLO; + } else if (edge_loc == EdgeBdyLoc3D::XHI_ZLO || + edge_loc == EdgeBdyLoc3D::XHI_ZHI || + edge_loc == EdgeBdyLoc3D::XHI_YLO || + edge_loc == EdgeBdyLoc3D::XHI_YHI) { + ret_face = BdryLoc::XHI; + } + break; + } + case BdryCond::YFLOW: + case BdryCond::YREFLECT: + case BdryCond::YDIRICHLET: + case BdryCond::YNEUMANN: + { + if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YLO_ZHI || + edge_loc == EdgeBdyLoc3D::XLO_YLO || edge_loc == EdgeBdyLoc3D::XHI_YLO) { + ret_face = BdryLoc::YLO; + } else if (edge_loc == EdgeBdyLoc3D::YHI_ZLO || + edge_loc == EdgeBdyLoc3D::YHI_ZHI || + edge_loc == EdgeBdyLoc3D::XLO_YHI || + edge_loc == EdgeBdyLoc3D::XHI_YHI) { + ret_face = BdryLoc::YHI; + } + break; + } + case BdryCond::ZFLOW: + case BdryCond::ZREFLECT: + case BdryCond::ZDIRICHLET: + case BdryCond::ZNEUMANN: + { + if (edge_loc == EdgeBdyLoc3D::YLO_ZLO || edge_loc == EdgeBdyLoc3D::YHI_ZLO || + edge_loc == EdgeBdyLoc3D::XLO_ZLO || edge_loc == EdgeBdyLoc3D::XHI_ZLO) { + ret_face = BdryLoc::ZLO; + } else if (edge_loc == EdgeBdyLoc3D::YLO_ZHI || + edge_loc == EdgeBdyLoc3D::YHI_ZHI || + edge_loc == EdgeBdyLoc3D::XLO_ZHI || + edge_loc == EdgeBdyLoc3D::XHI_ZHI) { + ret_face = BdryLoc::ZHI; + } + break; + } + default: { + TBOX_ERROR("Unknown edge boundary condition type = " + << edge_btype << " passed to \n" + << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" + << endl); + } + } + + if (ret_face == -1) { + TBOX_ERROR("Edge boundary condition type = " + << edge_btype << " and edge location = " << edge_loc + << "\n passed to " + << "SkeletonBoundaryUtilities3::getFaceLocationForEdgeBdry" + << " are inconsistant." << endl); + } + + return ret_face; + +} + +/* + * Function that returns the integer face boundary location + * corresponding to the given node location and node boundary + * condition. + * + * If the node boundary condition type or node location are unknown, + * or the boundary condition type is inconsistant with the node location + * an error results. + */ + +int SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry( + int node_loc, + int node_btype) +{ + + int ret_face = -1; + + switch (node_btype) { + case BdryCond::XFLOW: + case BdryCond::XREFLECT: + case BdryCond::XDIRICHLET: + case BdryCond::XNEUMANN: + { + if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || + node_loc == NodeBdyLoc3D::XLO_YHI_ZLO || + node_loc == NodeBdyLoc3D::XLO_YLO_ZHI || + node_loc == NodeBdyLoc3D::XLO_YHI_ZHI) { + ret_face = BdryLoc::XLO; + } else { + ret_face = BdryLoc::XHI; + } + break; + } + case BdryCond::YFLOW: + case BdryCond::YREFLECT: + case BdryCond::YDIRICHLET: + case BdryCond::YNEUMANN: + { + if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || + node_loc == NodeBdyLoc3D::XHI_YLO_ZLO || + node_loc == NodeBdyLoc3D::XLO_YLO_ZHI || + node_loc == NodeBdyLoc3D::XHI_YLO_ZHI) { + ret_face = BdryLoc::YLO; + } else { + ret_face = BdryLoc::YHI; + } + break; + } + case BdryCond::ZFLOW: + case BdryCond::ZREFLECT: + case BdryCond::ZDIRICHLET: + case BdryCond::ZNEUMANN: + { + if (node_loc == NodeBdyLoc3D::XLO_YLO_ZLO || + node_loc == NodeBdyLoc3D::XHI_YLO_ZLO || + node_loc == NodeBdyLoc3D::XLO_YHI_ZLO || + node_loc == NodeBdyLoc3D::XHI_YHI_ZLO) { + ret_face = BdryLoc::ZLO; + } else { + ret_face = BdryLoc::ZHI; + } + break; + } + default: { + TBOX_ERROR("Unknown node boundary condition type = " + << node_btype << " passed to \n" + << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" + << endl); + } + } + + if (ret_face == -1) { + TBOX_ERROR("Node boundary condition type = " + << node_btype << " and node location = " << node_loc + << "\n passed to " + << "SkeletonBoundaryUtilities3::getFaceLocationForNodeBdry" + << " are inconsistant." << endl); + } + + return ret_face; + +} + +/* + * Function to check 3D boundary data filling. Arguments are: + * + * varname ..... name of variable (for error reporting) + * patch ....... patch on which boundary data to check lives + * data_id ..... patch data index on patch + * depth ....... depth index of data to check + * gcw_to_check. boundary ghost width to fill + * bbox ........ boundary box to check + * bcase ....... boundary condition case for edge or a node to check + * bstate ...... boundary state that applies when such a value is + * required, such as when using Dirichlet conditions + */ + +int SkeletonBoundaryUtilities3::checkBdryData( + const string& varname, + const hier::Patch& patch, + int data_id, + int depth, + const hier::IntVector& gcw_to_check, + const hier::BoundaryBox& bbox, + int bcase, + double bstate) +{ + TBOX_ASSERT(!varname.empty()); + TBOX_ASSERT(data_id >= 0); + TBOX_ASSERT(depth >= 0); + + int num_bad_values = 0; + + int btype = bbox.getBoundaryType(); + int bloc = bbox.getLocationIndex(); + + boost::shared_ptr pgeom( + patch.getPatchGeometry()); + + boost::shared_ptr > vardata( + BOOST_CAST, hier::PatchData>( + patch.getPatchData(data_id))); + TBOX_ASSERT(vardata); + + string bdry_type_str; + if (btype == Bdry::FACE3D) { + bdry_type_str = "FACE"; + } else if (btype == Bdry::EDGE3D) { + bdry_type_str = "EDGE"; + } else if (btype == Bdry::NODE3D) { + bdry_type_str = "NODE"; + } else { + TBOX_ERROR( + "Unknown btype " << btype + << " passed to SkeletonBoundaryUtilities3::checkBdryData()! " + << endl); + } + + tbox::plog << "\n\nCHECKING 3D " << bdry_type_str << " BDRY DATA..." << endl; + tbox::plog << "varname = " << varname << " : depth = " << depth << endl; + tbox::plog << "bbox = " << bbox.getBox() << endl; + tbox::plog << "btype, bloc, bcase = " + << btype << ", = " << bloc << ", = " << bcase << endl; + + tbox::Dimension::dir_t idir; + double valfact = 0.0, constval = 0.0, dxfact = 0.0; + int offsign; + + get3dBdryDirectionCheckValues(idir, offsign, + btype, bloc, bcase); + + if (btype == Bdry::FACE3D) { + + if (bcase == BdryCond::FLOW) { + valfact = 1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::REFLECT) { + valfact = -1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::DIRICHLET) { + valfact = 0.0; + constval = bstate; + dxfact = 0.0; + } else { + TBOX_ERROR( + "Unknown bcase " << bcase + << " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + + } else if (btype == Bdry::EDGE3D) { + + if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || + bcase == BdryCond::ZFLOW) { + valfact = 1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || + bcase == BdryCond::ZREFLECT) { + valfact = -1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || + bcase == BdryCond::ZDIRICHLET) { + valfact = 0.0; + constval = bstate; + dxfact = 0.0; + } else { + TBOX_ERROR( + "Unknown bcase " << bcase + << " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + + } else if (btype == Bdry::NODE3D) { + + if (bcase == BdryCond::XFLOW || bcase == BdryCond::YFLOW || + bcase == BdryCond::ZFLOW) { + valfact = 1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XREFLECT || bcase == BdryCond::YREFLECT || + bcase == BdryCond::ZREFLECT) { + valfact = -1.0; + constval = 0.0; + dxfact = 0.0; + } else if (bcase == BdryCond::XDIRICHLET || bcase == BdryCond::YDIRICHLET || + bcase == BdryCond::ZDIRICHLET) { + valfact = 0.0; + constval = bstate; + dxfact = 0.0; + } else { + TBOX_ERROR( + "Unknown bcase " << bcase + << " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + + } + + hier::Box gbox_to_check(vardata->getGhostBox() * pgeom->getBoundaryFillBox( + bbox, + patch.getBox(), + gcw_to_check)); + + hier::Box cbox(gbox_to_check); + hier::Box dbox(gbox_to_check); + hier::Index ifirst(vardata->getBox().lower()); + hier::Index ilast(vardata->getBox().upper()); + + if (offsign == -1) { + cbox.setLower(idir, ifirst(idir) - 1); + cbox.setUpper(idir, ifirst(idir) - 1); + dbox.setLower(idir, ifirst(idir)); + dbox.setUpper(idir, ifirst(idir)); + } else { + cbox.setLower(idir, ilast(idir) + 1); + cbox.setUpper(idir, ilast(idir) + 1); + dbox.setLower(idir, ilast(idir)); + dbox.setUpper(idir, ilast(idir)); + } + + pdat::CellIterator id(pdat::CellGeometry::begin(dbox)); + pdat::CellIterator icend(pdat::CellGeometry::end(cbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(cbox)); + ic != icend; ++ic) { + double checkval = valfact * (*vardata)(*id, depth) + constval; + pdat::CellIndex check = *ic; + for (int p = 0; p < gbox_to_check.numberCells(idir); ++p) { + double offcheckval = checkval + dxfact * (p + 1); + if ((*vardata)(check, depth) != offcheckval) { + ++num_bad_values; + TBOX_WARNING("Bad " << bdry_type_str + << " boundary value for " << varname + << " found in cell " << check + << "\n found = " << (*vardata)(check, depth) + << " : correct = " << offcheckval << endl); + } + check(idir) += offsign; + } + ++id; + } + + return num_bad_values; + +} + +/* + * Private function to read 3D face boundary data from input database. + */ + +void SkeletonBoundaryUtilities3::read3dBdryFaces( + BoundaryUtilityStrategy* bdry_strategy, + boost::shared_ptr input_db, + std::vector& face_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(bdry_strategy != 0); + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + + int num_per_dirs = 0; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; + } + + if (num_per_dirs < 3) { // face boundary input required + + for (int s = 0; s < NUM_3D_FACES; ++s) { + + string bdry_loc_str; + switch (s) { + case BdryLoc::XLO: { bdry_loc_str = "boundary_face_xlo"; + break; + } + case BdryLoc::XHI: { bdry_loc_str = "boundary_face_xhi"; + break; + } + case BdryLoc::YLO: { bdry_loc_str = "boundary_face_ylo"; + break; + } + case BdryLoc::YHI: { bdry_loc_str = "boundary_face_yhi"; + break; + } + case BdryLoc::ZLO: { bdry_loc_str = "boundary_face_zlo"; + break; + } + case BdryLoc::ZHI: { bdry_loc_str = "boundary_face_zhi"; + break; + } + default: NULL_STATEMENT; + } + + bool need_data_read = true; + if (num_per_dirs > 0) { + if (periodic(0) && (s == BdryLoc::XLO || s == BdryLoc::XHI)) { + need_data_read = false; + } else if (periodic(1) && (s == BdryLoc::YLO || s == BdryLoc::YHI)) { + need_data_read = false; + } else if (periodic(2) && (s == BdryLoc::ZLO || s == BdryLoc::ZHI)) { + need_data_read = false; + } + } + + if (need_data_read) { + if (input_db->keyExists(bdry_loc_str)) { + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + if (bdry_loc_db) { + if (bdry_loc_db->keyExists("boundary_condition")) { + string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "FLOW") { + face_conds[s] = BdryCond::FLOW; + } else if (bdry_cond_str == "REFLECT") { + face_conds[s] = BdryCond::REFLECT; + } else if (bdry_cond_str == "DIRICHLET") { + face_conds[s] = BdryCond::DIRICHLET; + bdry_strategy-> + readDirichletBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); + } else if (bdry_cond_str == "NEUMANN") { + face_conds[s] = BdryCond::NEUMANN; + bdry_strategy-> + readNeumannBoundaryDataEntry(bdry_loc_db, + bdry_loc_str, + s); + } else { + TBOX_ERROR("Unknown face boundary string = " + << bdry_cond_str << " found in input." << endl); + } + } else { + TBOX_ERROR("'boundary_condition' entry missing from " + << bdry_loc_str << " input database." << endl); + } + } + } else { + TBOX_ERROR(bdry_loc_str + << " database entry not found in input." << endl); + } + } // if (need_data_read) + + } // for (int s = 0 ... + + } // if (num_per_dirs < 3) + +} + +/* + * Private function to read 3D edge boundary data from input database. + */ + +void SkeletonBoundaryUtilities3::read3dBdryEdges( + boost::shared_ptr input_db, + const std::vector& face_conds, + std::vector& edge_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(edge_conds.size()) == NUM_3D_EDGES); + + int num_per_dirs = 0; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; + } + + if (num_per_dirs < 2) { // edge boundary input required + + for (int s = 0; s < NUM_3D_EDGES; ++s) { + + string bdry_loc_str; + switch (s) { + case EdgeBdyLoc3D::YLO_ZLO: { + bdry_loc_str = "boundary_edge_ylo_zlo"; + break; + } + case EdgeBdyLoc3D::YHI_ZLO: { + bdry_loc_str = "boundary_edge_yhi_zlo"; + break; + } + case EdgeBdyLoc3D::YLO_ZHI: { + bdry_loc_str = "boundary_edge_ylo_zhi"; + break; + } + case EdgeBdyLoc3D::YHI_ZHI: { + bdry_loc_str = "boundary_edge_yhi_zhi"; + break; + } + case EdgeBdyLoc3D::XLO_ZLO: { + bdry_loc_str = "boundary_edge_xlo_zlo"; + break; + } + case EdgeBdyLoc3D::XLO_ZHI: { + bdry_loc_str = "boundary_edge_xlo_zhi"; + break; + } + case EdgeBdyLoc3D::XHI_ZLO: { + bdry_loc_str = "boundary_edge_xhi_zlo"; + break; + } + case EdgeBdyLoc3D::XHI_ZHI: { + bdry_loc_str = "boundary_edge_xhi_zhi"; + break; + } + case EdgeBdyLoc3D::XLO_YLO: { + bdry_loc_str = "boundary_edge_xlo_ylo"; + break; + } + case EdgeBdyLoc3D::XHI_YLO: { + bdry_loc_str = "boundary_edge_xhi_ylo"; + break; + } + case EdgeBdyLoc3D::XLO_YHI: { + bdry_loc_str = "boundary_edge_xlo_yhi"; + break; + } + case EdgeBdyLoc3D::XHI_YHI: { + bdry_loc_str = "boundary_edge_xhi_yhi"; + break; + } + default: NULL_STATEMENT; + } + + bool need_data_read = false; + if (num_per_dirs == 0) { + need_data_read = true; + } else if (periodic(0) && + (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || + s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI)) { + need_data_read = true; + } else if (periodic(1) && + (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || + s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI)) { + need_data_read = true; + } else if (periodic(2) && + (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || + s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI)) { + need_data_read = true; + } + + if (need_data_read) { + if (input_db->keyExists(bdry_loc_str)) { + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + if (bdry_loc_db) { + if (bdry_loc_db->keyExists("boundary_condition")) { + string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + edge_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + edge_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "ZFLOW") { + edge_conds[s] = BdryCond::ZFLOW; + } else if (bdry_cond_str == "XREFLECT") { + edge_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + edge_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "ZREFLECT") { + edge_conds[s] = BdryCond::ZREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + edge_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + edge_conds[s] = BdryCond::YDIRICHLET; + } else if (bdry_cond_str == "ZDIRICHLET") { + edge_conds[s] = BdryCond::ZDIRICHLET; + } else if (bdry_cond_str == "XNEUMANN") { + edge_conds[s] = BdryCond::XNEUMANN; + } else if (bdry_cond_str == "YNEUMANN") { + edge_conds[s] = BdryCond::YNEUMANN; + } else if (bdry_cond_str == "ZNEUMANN") { + edge_conds[s] = BdryCond::ZNEUMANN; + } else { + TBOX_ERROR("Unknown edge boundary string = " + << bdry_cond_str << " found in input." << endl); + } + + bool ambiguous_type = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XREFLECT" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN") { + if (s == EdgeBdyLoc3D::YLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || + s == EdgeBdyLoc3D::YLO_ZHI || s == EdgeBdyLoc3D::YHI_ZHI) { + ambiguous_type = true; + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YREFLECT" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN") { + if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || + s == EdgeBdyLoc3D::XHI_ZLO || s == EdgeBdyLoc3D::XHI_ZHI) { + ambiguous_type = true; + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZREFLECT" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN") { + if (s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO || + s == EdgeBdyLoc3D::XLO_YHI || s == EdgeBdyLoc3D::XHI_YHI) { + ambiguous_type = true; + } + } + if (ambiguous_type) { + TBOX_ERROR("Ambiguous bdry condition " + << bdry_cond_str + << " found for " << bdry_loc_str << endl); + } + + string proper_face; + string proper_face_data; + bool no_face_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN" || + bdry_cond_str == "XREFLECT") { + if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XLO_ZHI || + s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XLO_YHI) { + proper_face = "XLO"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "XHI"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN" || + bdry_cond_str == "YREFLECT") { + if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YLO_ZHI || + s == EdgeBdyLoc3D::XLO_YLO || s == EdgeBdyLoc3D::XHI_YLO) { + proper_face = "YLO"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "YHI"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN" || + bdry_cond_str == "ZREFLECT") { + if (s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::YHI_ZLO || + s == EdgeBdyLoc3D::XLO_ZLO || s == EdgeBdyLoc3D::XHI_ZLO) { + proper_face = "ZLO"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "ZHI"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } + if (no_face_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_face_data + << " data found for face " + << proper_face << endl); + } + } else { + TBOX_ERROR("'boundary_condition' entry missing from " + << bdry_loc_str << " input database." << endl); + } + } + } else { + TBOX_ERROR(bdry_loc_str + << " database entry not found in input." << endl); + } + + } // if (need_data_read) + + } // for (int s = 0 ... + + } // if (num_per_dirs < 2) + +} + +/* + * Private function to read 3D node boundary data from input database. + */ + +void SkeletonBoundaryUtilities3::read3dBdryNodes( + boost::shared_ptr input_db, + const std::vector& face_conds, + std::vector& node_conds, + const hier::IntVector& periodic) +{ + TBOX_ASSERT(input_db); + TBOX_ASSERT(static_cast(face_conds.size()) == NUM_3D_FACES); + TBOX_ASSERT(static_cast(node_conds.size()) == NUM_3D_NODES); + + int num_per_dirs = 0; + for (int id = 0; id < 3; ++id) { + if (periodic(id)) ++num_per_dirs; + } + + if (num_per_dirs < 1) { // node boundary data required + + for (int s = 0; s < NUM_3D_NODES; ++s) { + + string bdry_loc_str; + switch (s) { + case NodeBdyLoc3D::XLO_YLO_ZLO: { + bdry_loc_str = "boundary_node_xlo_ylo_zlo"; + break; + } + case NodeBdyLoc3D::XHI_YLO_ZLO: { + bdry_loc_str = "boundary_node_xhi_ylo_zlo"; + break; + } + case NodeBdyLoc3D::XLO_YHI_ZLO: { + bdry_loc_str = "boundary_node_xlo_yhi_zlo"; + break; + } + case NodeBdyLoc3D::XHI_YHI_ZLO: { + bdry_loc_str = "boundary_node_xhi_yhi_zlo"; + break; + } + case NodeBdyLoc3D::XLO_YLO_ZHI: { + bdry_loc_str = "boundary_node_xlo_ylo_zhi"; + break; + } + case NodeBdyLoc3D::XHI_YLO_ZHI: { + bdry_loc_str = "boundary_node_xhi_ylo_zhi"; + break; + } + case NodeBdyLoc3D::XLO_YHI_ZHI: { + bdry_loc_str = "boundary_node_xlo_yhi_zhi"; + break; + } + case NodeBdyLoc3D::XHI_YHI_ZHI: { + bdry_loc_str = "boundary_node_xhi_yhi_zhi"; + break; + } + default: NULL_STATEMENT; + } + + if (input_db->keyExists(bdry_loc_str)) { + boost::shared_ptr bdry_loc_db( + input_db->getDatabase(bdry_loc_str)); + if (bdry_loc_db) { + if (bdry_loc_db->keyExists("boundary_condition")) { + string bdry_cond_str = + bdry_loc_db->getString("boundary_condition"); + if (bdry_cond_str == "XFLOW") { + node_conds[s] = BdryCond::XFLOW; + } else if (bdry_cond_str == "YFLOW") { + node_conds[s] = BdryCond::YFLOW; + } else if (bdry_cond_str == "ZFLOW") { + node_conds[s] = BdryCond::ZFLOW; + } else if (bdry_cond_str == "XREFLECT") { + node_conds[s] = BdryCond::XREFLECT; + } else if (bdry_cond_str == "YREFLECT") { + node_conds[s] = BdryCond::YREFLECT; + } else if (bdry_cond_str == "ZREFLECT") { + node_conds[s] = BdryCond::ZREFLECT; + } else if (bdry_cond_str == "XDIRICHLET") { + node_conds[s] = BdryCond::XDIRICHLET; + } else if (bdry_cond_str == "YDIRICHLET") { + node_conds[s] = BdryCond::YDIRICHLET; + } else if (bdry_cond_str == "ZDIRICHLET") { + node_conds[s] = BdryCond::ZDIRICHLET; + } else if (bdry_cond_str == "XNEUMANN") { + node_conds[s] = BdryCond::XNEUMANN; + } else if (bdry_cond_str == "YNEUMANN") { + node_conds[s] = BdryCond::YNEUMANN; + } else if (bdry_cond_str == "ZNEUMANN") { + node_conds[s] = BdryCond::ZNEUMANN; + } else { + TBOX_ERROR("Unknown node boundary string = " + << bdry_cond_str << " found in input." << endl); + } + + string proper_face; + string proper_face_data; + bool no_face_data_found = false; + if (bdry_cond_str == "XFLOW" || + bdry_cond_str == "XDIRICHLET" || + bdry_cond_str == "XNEUMANN" || + bdry_cond_str == "XREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YHI_ZLO || + s == NodeBdyLoc3D::XLO_YLO_ZHI || + s == NodeBdyLoc3D::XLO_YHI_ZHI) { + proper_face = "XLO"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "XHI"; + if (bdry_cond_str == "XFLOW" && + face_conds[BdryLoc::XHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "XDIRICHLET" && + face_conds[BdryLoc::XHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "XNEUMANN" && + face_conds[BdryLoc::XHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "XREFLECT" && + face_conds[BdryLoc::XHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "YFLOW" || + bdry_cond_str == "YDIRICHLET" || + bdry_cond_str == "YNEUMANN" || + bdry_cond_str == "YREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XHI_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YLO_ZHI || + s == NodeBdyLoc3D::XHI_YLO_ZHI) { + proper_face = "YLO"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "YHI"; + if (bdry_cond_str == "YFLOW" && + face_conds[BdryLoc::YHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "YDIRICHLET" && + face_conds[BdryLoc::YHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "YNEUMANN" && + face_conds[BdryLoc::YHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "YREFLECT" && + face_conds[BdryLoc::YHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } else if (bdry_cond_str == "ZFLOW" || + bdry_cond_str == "ZDIRICHLET" || + bdry_cond_str == "ZNEUMANN" || + bdry_cond_str == "ZREFLECT") { + if (s == NodeBdyLoc3D::XLO_YLO_ZLO || + s == NodeBdyLoc3D::XHI_YLO_ZLO || + s == NodeBdyLoc3D::XLO_YHI_ZLO || + s == NodeBdyLoc3D::XHI_YHI_ZLO) { + proper_face = "ZLO"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZLO] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZLO] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZLO] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZLO] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } else { + proper_face = "ZHI"; + if (bdry_cond_str == "ZFLOW" && + face_conds[BdryLoc::ZHI] != BdryCond::FLOW) { + no_face_data_found = true; + proper_face_data = "FLOW"; + } + if (bdry_cond_str == "ZDIRICHLET" && + face_conds[BdryLoc::ZHI] != BdryCond::DIRICHLET) { + no_face_data_found = true; + proper_face_data = "DIRICHLET"; + } + if (bdry_cond_str == "ZNEUMANN" && + face_conds[BdryLoc::ZHI] != BdryCond::NEUMANN) { + no_face_data_found = true; + proper_face_data = "NEUMANN"; + } + if (bdry_cond_str == "ZREFLECT" && + face_conds[BdryLoc::ZHI] != BdryCond::REFLECT) { + no_face_data_found = true; + proper_face_data = "REFLECT"; + } + } + } + if (no_face_data_found) { + TBOX_ERROR( + "Bdry condition " << bdry_cond_str + << " found for " + << bdry_loc_str + << "\n but no " + << proper_face_data + << " data found for face " + << proper_face << endl); + } + + } else { + TBOX_ERROR("'boundary_condition' entry missing from " + << bdry_loc_str << " input database." << endl); + } + } + } else { + TBOX_ERROR(bdry_loc_str + << " database entry not found in input." << endl); + } + + } // for (int s = 0 ... + + } // if (num_per_dirs < 1) + +} + +/* + * Private function to get boundary orientation information for + * 3D boundary condition checking. Called from checkBdryData(). + */ + +void SkeletonBoundaryUtilities3::get3dBdryDirectionCheckValues( + tbox::Dimension::dir_t& idir, + int& offsign, + int btype, + int bloc, + int bcase) +{ + + string bdry_type_str; + + if (btype == Bdry::FACE3D) { + + bdry_type_str = "FACE"; + + if (bloc == BdryLoc::XLO || bloc == BdryLoc::XHI) { + idir = 0; + if (bloc == BdryLoc::XLO) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bloc == BdryLoc::YLO || bloc == BdryLoc::YHI) { + idir = 1; + if (bloc == BdryLoc::YLO) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bloc == BdryLoc::ZLO || bloc == BdryLoc::ZHI) { + idir = 2; + if (bloc == BdryLoc::ZLO) { + offsign = -1; + } else { + offsign = 1; + } + } else { + TBOX_ERROR( + "Unknown boundary location " << bloc + << + " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " + << bdry_type_str << " boundary " << endl); + } + + } else if (btype == Bdry::EDGE3D) { + + bdry_type_str = "EDGE"; + + bool bad_case = false; + if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || + bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { + idir = 0; + if (bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XLO_ZHI || + bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XLO_YHI) { + offsign = -1; + } else if (bloc == EdgeBdyLoc3D::XHI_ZLO || bloc == EdgeBdyLoc3D::XHI_ZHI || + bloc == EdgeBdyLoc3D::XHI_YLO || bloc == EdgeBdyLoc3D::XHI_YHI) { + offsign = 1; + } else { + bad_case = true; + } + } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || + bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { + idir = 1; + if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YLO_ZHI || + bloc == EdgeBdyLoc3D::XLO_YLO || bloc == EdgeBdyLoc3D::XHI_YLO) { + offsign = -1; + } else if (bloc == EdgeBdyLoc3D::YHI_ZLO || bloc == EdgeBdyLoc3D::YHI_ZHI || + bloc == EdgeBdyLoc3D::XLO_YHI || bloc == EdgeBdyLoc3D::XHI_YHI) { + offsign = 1; + } else { + bad_case = true; + } + } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || + bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { + idir = 2; + if (bloc == EdgeBdyLoc3D::YLO_ZLO || bloc == EdgeBdyLoc3D::YHI_ZLO || + bloc == EdgeBdyLoc3D::XLO_ZLO || bloc == EdgeBdyLoc3D::XHI_ZLO) { + offsign = -1; + } else if (bloc == EdgeBdyLoc3D::YLO_ZHI || bloc == EdgeBdyLoc3D::YHI_ZHI || + bloc == EdgeBdyLoc3D::XLO_ZHI || bloc == EdgeBdyLoc3D::XHI_ZHI) { + offsign = 1; + } else { + bad_case = true; + } + } + if (bad_case) { + TBOX_ERROR( + "Unknown or ambigous bcase " << bcase + << + " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc + << endl); + } + + } else if (btype == Bdry::NODE3D) { + + bdry_type_str = "NODE"; + + if (bcase == BdryCond::XFLOW || bcase == BdryCond::XREFLECT || + bcase == BdryCond::XDIRICHLET || bcase == BdryCond::XNEUMANN) { + idir = 0; + if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XLO_YHI_ZLO || + bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XLO_YHI_ZHI) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bcase == BdryCond::YFLOW || bcase == BdryCond::YREFLECT || + bcase == BdryCond::YDIRICHLET || bcase == BdryCond::YNEUMANN) { + idir = 1; + if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || + bloc == NodeBdyLoc3D::XLO_YLO_ZHI || bloc == NodeBdyLoc3D::XHI_YLO_ZHI) { + offsign = -1; + } else { + offsign = 1; + } + } else if (bcase == BdryCond::ZFLOW || bcase == BdryCond::ZREFLECT || + bcase == BdryCond::ZDIRICHLET || bcase == BdryCond::ZNEUMANN) { + idir = 2; + if (bloc == NodeBdyLoc3D::XLO_YLO_ZLO || bloc == NodeBdyLoc3D::XHI_YLO_ZLO || + bloc == NodeBdyLoc3D::XLO_YHI_ZLO || bloc == NodeBdyLoc3D::XHI_YHI_ZLO) { + offsign = -1; + } else { + offsign = 1; + } + } + + } else { + TBOX_ERROR( + "Unknown boundary type " << btype + << " passed to SkeletonBoundaryUtilities3::checkBdryData()" + << "\n for " << bdry_type_str + << " at location " << bloc << endl); + } + +} + +/* + * Private function to stuff 3D boundary contants into Fortran common blocks + */ + +void SkeletonBoundaryUtilities3::stuff3dBdryFortConst() +{ + SAMRAI_F77_FUNC(stufcartbdryloc3d, STUFCARTBDRYLOC3D) ( + BdryLoc::XLO, BdryLoc::XHI, BdryLoc::YLO, BdryLoc::YHI, BdryLoc::ZLO, BdryLoc::ZHI, + EdgeBdyLoc3D::YLO_ZLO, EdgeBdyLoc3D::YHI_ZLO, EdgeBdyLoc3D::YLO_ZHI, + EdgeBdyLoc3D::YHI_ZHI, EdgeBdyLoc3D::XLO_ZLO, EdgeBdyLoc3D::XLO_ZHI, + EdgeBdyLoc3D::XHI_ZLO, EdgeBdyLoc3D::XHI_ZHI, EdgeBdyLoc3D::XLO_YLO, + EdgeBdyLoc3D::XHI_YLO, EdgeBdyLoc3D::XLO_YHI, EdgeBdyLoc3D::XHI_YHI, + NodeBdyLoc3D::XLO_YLO_ZLO, NodeBdyLoc3D::XHI_YLO_ZLO, NodeBdyLoc3D::XLO_YHI_ZLO, + NodeBdyLoc3D::XHI_YHI_ZLO, NodeBdyLoc3D::XLO_YLO_ZHI, NodeBdyLoc3D::XHI_YLO_ZHI, + NodeBdyLoc3D::XLO_YHI_ZHI, NodeBdyLoc3D::XHI_YHI_ZHI); + SAMRAI_F77_FUNC(stufcartbdrycond3d, STUFCARTBDRYCOND3D) ( + BdryCond::FLOW, + BdryCond::XFLOW, BdryCond::YFLOW, BdryCond::ZFLOW, + BdryCond::REFLECT, + BdryCond::XREFLECT, BdryCond::YREFLECT, BdryCond::ZREFLECT, + BdryCond::DIRICHLET, + BdryCond::XDIRICHLET, BdryCond::YDIRICHLET, BdryCond::ZDIRICHLET, + BdryCond::NEUMANN, + BdryCond::XNEUMANN, BdryCond::YNEUMANN, BdryCond::ZNEUMANN); + s_fortran_constants_stuffed = true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.h b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.h new file mode 100644 index 00000000..acb7316d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonBoundaryUtilities3.h @@ -0,0 +1,344 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility routines for manipulating Skeleton 3d boundary data + * + ************************************************************************/ + +#ifndef included_appu_SkeletonBoundaryUtilities3 +#define included_appu_SkeletonBoundaryUtilities3 + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/appu/BoundaryUtilityStrategy.h" +#include "SAMRAI/hier/BoundaryBox.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/tbox/Database.h" + +#include "boost/shared_ptr.hpp" +#include +#include + +using namespace std; +using namespace SAMRAI; +using namespace appu; + +/*! + * @brief Class SkeletonBoundaryUtilities2 is a utility class that + * simplifies the implementation of simple physical boundary data in + * 3 spatial dimensions. It contains routines for reading boundary data + * information from input files, applying those boundary conditions, + * and error checking boundary data. These routines apply to the + * case of cell-centered double data only. One may use all of these + * capabilities, or use the input reading, boundary setting, and error + * checking routines independently. + * + * To use the boundary condition input reading capabilities, the format + * of the input file section containing the boundary information must + * be as described next. Boundary face, node, and edge entries are only + * required for those that are not filled automatically when periodic + * conditions apply. + * + * The boundary condition for face "*" is provided in a section as follows: + * + * \verbatim + * + * boundary_face_* { + * boundary_condition = ... // boundary condition string identifier + * // Any problem-specific boundary data read by user routines + * // is placed here... + * } + * + * Allowable face identifiers (i.e., values for "*") are: + * xlo, xhi, ylo, yhi, zlo, zhi + * Supported face boundary_condition string values are: + * "FLOW", "REFLECT", "DIRICHLET", "NEUMANN" + * + * \endverbatim + * + * The boundary condition for edge "*" is provided in a section as follows: + * + * \verbatim + * + * boundary_edge_* { + * boundary_condition = ... // boundary condition string identifier + * } + * + * Allowable edge identifiers (i.e., values for "*") are: + * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, + * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, + * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi + * Supported edge boundary_condition string values are: + * "XFLOW", "YFLOW", "ZFLOW", + * "XREFLECT", "YREFLECT", "ZREFLECT", + * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" + * "XNEUMANN", "YNEUMANN", "ZNEUMANN" + * + * \endverbatim + * + * Note that edge conditions must be consistent with adjacent face conditions. + * + * The boundary condition for node "*" is provided in a section as follows: + * + * \verbatim + * + * boundary_node_* { + * boundary_condition = ... // boundary condition string identifier + * } + * + * Allowable node identifiers (i.e., values for "*") are: + * ylo_zlo, yhi_zlo, ylo_zhi, yhi_zhi, + * xlo_zlo, xlo_zhi, xhi_zlo, xhi_zhi, + * xlo_ylo, xhi_ylo, xlo_yhi, xhi_yhi + * Supported node boundary_condition values are: + * "XFLOW", "YFLOW", "ZFLOW", + * "XREFLECT", "YREFLECT", "ZREFLECT", + * "XDIRICHLET", "YDIRICHLET", "ZDIRICHLET" + * "XNEUMANN", "YNEUMANN", "ZNEUMANN" + * + * \endverbatim + * + * Note that node conditions must be consistent with adjacent face conditions. + * + * See the include file SkeletonBoundaryDefines.h for integer constant + * definitions that apply for the various boundary types, locations, + * and boundary conditions. If you choose to use the input reading + * capabilities only and write your own boundary condition routines in + * FORTRAN, you should note that the integer constants for the various + * boundary condition types and locations are automatically "stuffed" into + * FORTRAN common blocks. This avoids potential problems with + * inconsistencies between C++ and FORTRAN usage. Please see the + * FORTRAN include file cartbdryparams3d.i for details. + * + * @see appu::BoundaryUtilityStrategy3 + */ + +struct SkeletonBoundaryUtilities3 { +public: + /*! + * Function to read 3d boundary data from input database. + * The integer boundary condition types are placed in the integer + * arrays supplied by the caller (typically, the concrete + * BoundaryUtilityStrategy object provided). When DIRICHLET or + * NEUMANN conditions are specified, control is passed to the + * BoundaryUtilityStrategy to read the boundary state data specific to + * the problem. + * + * Errors will be reported and the program will abort whenever necessary + * boundary condition information is missing in the input database, or + * when the data read in is either unknown or inconsistent. The periodic + * domain information is used to determine which boundary face, edge, or + * node entries are not required from input. Error checking + * requires that node and edge boundary conditions are consistent + * with those specified for the faces. + * + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param bdry_strategy user-defined object that reads DIRICHLET or NEUMANN + * conditions + * @param input_db input database containing all boundary data + * @param face_conds vector into which integer face boundary condition + * types are read + * @param edge_conds vector into which integer edge boundary condition + * types are read + * @param node_conds vector into which integer node boundary condition + * types are read + * @param periodic integer vector specifying which coordinate + * directions are periodic (e.g., value returned from + * GridGeometry2::getPeriodicShift()) + */ + static void + getFromInput( + appu::BoundaryUtilityStrategy* bdry_strategy, + const boost::shared_ptr& input_db, + std::vector& face_conds, + std::vector& edge_conds, + std::vector& node_conds, + const hier::IntVector& periodic); + + /*! + * Function to fill 3d face boundary values for a patch. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param varname String name of variable (for error reporting). + * @param vardata Cell-centered patch data object to fill. + * @param patch hier::Patch on which data object lives. + * @param ghost_width_to_fill Width of ghost region to fill. + * @param bdry_face_conds std::vector of boundary condition types for + * patch faces. + * @param bdry_face_values std::vector of boundary values for patch faces. + */ + static void + fillFaceBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_width_to_fill, + const std::vector& bdry_face_conds, + const std::vector& bdry_face_values); + + /*! + * Function to fill 3d edge boundary values for a patch. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param varname String name of variable (for error reporting). + * @param vardata Cell-centered patch data object to fill. + * @param patch hier::Patch on which data object lives. + * @param ghost_width_to_fill Width of ghost region to fill. + * @param bdry_edge_conds std::vector of boundary condition types for + * patch edges. + * @param bdry_face_values std::vector of boundary values for patch faces. + */ + static void + fillEdgeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_width_to_fill, + const std::vector& bdry_edge_conds, + const std::vector& bdry_face_values); + + /*! + * Function to fill 3d node boundary values for a patch. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @param varname String name of variable (for error reporting). + * @param vardata Cell-centered patch data object to fill. + * @param patch hier::Patch on which data object lives. + * @param ghost_width_to_fill Width of ghost region to fill. + * @param bdry_node_conds std::vector of boundary condition types for + * patch nodes. + * @param bdry_face_values std::vector of boundary values for patch faces. + */ + static void + fillNodeBoundaryData( + const string& varname, + boost::shared_ptr >& vardata, + const hier::Patch& patch, + const hier::IntVector& ghost_width_to_fill, + const std::vector& bdry_node_conds, + const std::vector& bdry_face_values); + + /*! + * Function that returns the integer face boundary location + * corresponding to the given edge location and edge boundary + * condition. + * + * If the edge boundary condition type or edge location are unknown, + * or the boundary condition type is inconsistant with the edge location + * an error results. + * + * @return Integer face location for edge location and boundary condition type. + * + * @param edge_loc Integer location for edge. + * @param edge_btype Integer boundary condition type for edge. + */ + static int + getFaceLocationForEdgeBdry( + int edge_loc, + int edge_btype); + + /*! + * Function that returns the integer face boundary location + * corresponding to the given node location and node boundary + * condition. + * + * If the node boundary condition type or node location are unknown, + * or the boundary condition type is inconsistant with the node location + * an error results. + * + * @return Integer face location for node location and boundary condition type. + * + * @param node_loc Integer location for node. + * @param node_btype Integer boundary condition type for node. + */ + static int + getFaceLocationForNodeBdry( + int node_loc, + int node_btype); + + /*! + * Function to check 3d boundary data for a patch data quantity on + * a patch after it is set. A warning message will be sent to log + * file for each bad boundary value that is found. + * + * When assertion checking is active, assertions will result when any + * of the pointer arguments is null, or an array is passed in with the + * the wrong size. + * + * @return Integer number of bad boundary values found. + * + * @param varname String name of variable (for error reporting). + * @param patch hier::Patch on which data object lives. + * @param data_id hier::Patch data index for data on patch. + * @param depth Depth index of patch data to check. + * @param gcw_to_check Width of ghost region to check. + * @param bbox Boundary box to check. + * @param bcase Boundary condition type for given edge or node. + * @param bstate Boundary value that applies in DIRICHLET or NEUMANN case. + */ + static int + checkBdryData( + const string& varname, + const hier::Patch& patch, + int data_id, + int depth, + const hier::IntVector& gcw_to_check, + const hier::BoundaryBox& bbox, + int bcase, + double bstate); + +private: + static bool s_fortran_constants_stuffed; + + static void + read3dBdryFaces( + appu::BoundaryUtilityStrategy* bdry_strategy, + boost::shared_ptr input_db, + std::vector& face_conds, + const hier::IntVector& periodic); + + static void + read3dBdryEdges( + boost::shared_ptr input_db, + const std::vector& face_conds, + std::vector& edge_conds, + const hier::IntVector& periodic); + + static void + read3dBdryNodes( + boost::shared_ptr input_db, + const std::vector& face_conds, + std::vector& node_conds, + const hier::IntVector& periodic); + + static void + get3dBdryDirectionCheckValues( + tbox::Dimension::dir_t& idir, + int& offsign, + int btype, + int bloc, + int bcase); + + static void + stuff3dBdryFortConst(); +}; + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.C b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.C new file mode 100644 index 00000000..81dd3fe3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.C @@ -0,0 +1,256 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Conservative linear refine operator for cell-centered + * double data on a Skeleton mesh. + * + ************************************************************************/ + +#include "SkeletonCellDoubleConservativeLinearRefine.h" + +#include +#include +#include "SAMRAI/hier/PatchGeometry.h" +#include "SAMRAI/hier/Index.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/tbox/Utilities.h" + +/* + ************************************************************************* + * + * External declarations for FORTRAN routines. + * + ************************************************************************* + */ + +extern "C" { +// in cartrefine1d.f: +void SAMRAI_F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int *, const double *, const double *, + const double *, double *, + double *, double *); +// in cartrefine2d.f: +void SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *, + double *, double *, double *, double *); +// in cartrefine3d.f: +void SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *, + double *, double *, double *, + double *, double *, double *); +} + +using namespace SAMRAI; + +SkeletonCellDoubleConservativeLinearRefine:: +SkeletonCellDoubleConservativeLinearRefine( + const tbox::Dimension& dim): + hier::RefineOperator("SKELETON_CONSERVATIVE_LINEAR_REFINE"), + d_dim(dim) +{ + const int max_levels = 10; + d_dx.resize(max_levels); + for (int n = 0; n < max_levels; ++n) { + d_dx[n].resize(dim.getValue()); + for (int i = 0; i < dim.getValue(); ++i) { + d_dx[n][i] = 1.; + } + } + +} + +SkeletonCellDoubleConservativeLinearRefine::~ +SkeletonCellDoubleConservativeLinearRefine() +{ +} + +int +SkeletonCellDoubleConservativeLinearRefine::getOperatorPriority() const +{ + return 0; +} + +hier::IntVector +SkeletonCellDoubleConservativeLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector(dim, 1); +} + +void SkeletonCellDoubleConservativeLinearRefine::refine( + hier::Patch& fine, + const hier::Patch& coarse, + const int dst_component, + const int src_component, + const hier::BoxOverlap& fine_overlap, + const hier::IntVector& ratio) const +{ + const pdat::CellOverlap* t_overlap = + CPP_CAST(&fine_overlap); + + TBOX_ASSERT(t_overlap != 0); + + const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); + for (hier::BoxContainer::const_iterator b = boxes.begin(); + b != boxes.end(); ++b) { + refine(fine, + coarse, + dst_component, + src_component, + *b, + ratio); + } +} + +void SkeletonCellDoubleConservativeLinearRefine::refine( + hier::Patch& fine, + const hier::Patch& coarse, + const int dst_component, + const int src_component, + const hier::Box& fine_box, + const hier::IntVector& ratio) const +{ + boost::shared_ptr > cdata( + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(src_component))); + boost::shared_ptr > fdata( + BOOST_CAST, hier::PatchData>( + fine.getPatchData(dst_component))); + + TBOX_ASSERT(cdata); + TBOX_ASSERT(fdata); + TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); + + const hier::Box cgbox(cdata->getGhostBox()); + + const hier::Index cilo = cgbox.lower(); + const hier::Index cihi = cgbox.upper(); + const hier::Index filo = fdata->getGhostBox().lower(); + const hier::Index fihi = fdata->getGhostBox().upper(); + + const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); + const hier::Index ifirstc = coarse_box.lower(); + const hier::Index ilastc = coarse_box.upper(); + const hier::Index ifirstf = fine_box.lower(); + const hier::Index ilastf = fine_box.upper(); + + const hier::IntVector tmp_ghosts(fine.getDim(), 0); + std::vector diff0(cgbox.numberCells(0) + 1); + pdat::CellData slope0(cgbox, 1, tmp_ghosts); + + int flev_num = fine.getPatchLevelNumber(); + int clev_num = coarse.getPatchLevelNumber(); + + // deal with levels not in hierarchy + if (flev_num < 0) flev_num = clev_num + 1; + if (clev_num < 0) clev_num = flev_num - 1; + + double cdx[SAMRAI::MAX_DIM_VAL]; + double fdx[SAMRAI::MAX_DIM_VAL]; + getDx(clev_num, cdx); + getDx(flev_num, fdx); + + for (int d = 0; d < fdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(cartclinrefcelldoub1d, CARTCLINREFCELLDOUB1D) ( + ifirstc(0), ilastc(0), + ifirstf(0), ilastf(0), + cilo(0), cihi(0), + filo(0), fihi(0), + &ratio[0], + cdx, + fdx, + cdata->getPointer(d), + fdata->getPointer(d), + &diff0[0], slope0.getPointer()); + } else if (fine.getDim() == tbox::Dimension(2)) { + + std::vector diff1(cgbox.numberCells(1) + 1); + pdat::CellData slope1(cgbox, 1, tmp_ghosts); + + SAMRAI_F77_FUNC(cartclinrefcelldoub2d, CARTCLINREFCELLDOUB2D) ( + ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), + ifirstf(0), ifirstf(1), ilastf(0), ilastf(1), + cilo(0), cilo(1), cihi(0), cihi(1), + filo(0), filo(1), fihi(0), fihi(1), + &ratio[0], + cdx, + fdx, + cdata->getPointer(d), + fdata->getPointer(d), + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer()); + } else if (fine.getDim() == tbox::Dimension(3)) { + + std::vector diff1(cgbox.numberCells(1) + 1); + pdat::CellData slope1(cgbox, 1, tmp_ghosts); + + std::vector diff2(cgbox.numberCells(2) + 1); + pdat::CellData slope2(cgbox, 1, tmp_ghosts); + + SAMRAI_F77_FUNC(cartclinrefcelldoub3d, CARTCLINREFCELLDOUB3D) ( + ifirstc(0), ifirstc(1), ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + ifirstf(0), ifirstf(1), ifirstf(2), + ilastf(0), ilastf(1), ilastf(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + &ratio[0], + cdx, + fdx, + cdata->getPointer(d), + fdata->getPointer(d), + &diff0[0], slope0.getPointer(), + &diff1[0], slope1.getPointer(), + &diff2[0], slope2.getPointer()); + } else { + TBOX_ERROR("SkeletonCellDoubleConservativeLinearRefine error...\n" + << "dimension > 3 not supported." << endl); + + } + } +} + +void SkeletonCellDoubleConservativeLinearRefine::setDx( + const int level_number, + const double* dx) +{ + if (level_number >= static_cast(d_dx.size())) { + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_dx[level_number][i] = dx[i]; + } + } +} + +void SkeletonCellDoubleConservativeLinearRefine::getDx( + const int level_number, + double* dx) const +{ + for (int i = 0; i < d_dim.getValue(); ++i) { + dx[i] = d_dx[level_number][i]; + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.h b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.h new file mode 100644 index 00000000..ba87700d --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleConservativeLinearRefine.h @@ -0,0 +1,118 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Conservative linear refine operator for cell-centered + * double data on a Skeleton mesh. + * + ************************************************************************/ + +#ifndef included_SkeletonCellDoubleConservativeLinearRefineXD +#define included_SkeletonCellDoubleConservativeLinearRefineXD + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/Patch.h" +#ifndef included_String +#include +#define included_String +#endif +#include "SAMRAI/hier/RefineOperator.h" + +#include "boost/shared_ptr.hpp" + +using namespace std; +using namespace SAMRAI; + +/** + * Class SkeletonCellDoubleConservativeLinearRefine implements + * conservative linear interpolation for cell-centered double patch data + * defined over a Skeleton mesh. It is derived from the base class + * hier::RefineOperator. The numerical operations for the interpolation + * use FORTRAN numerical routines. + * + * @see hier::RefineOperator + */ + +class SkeletonCellDoubleConservativeLinearRefine: + public hier::RefineOperator +{ +public: + /** + * Uninteresting default constructor. + */ + SkeletonCellDoubleConservativeLinearRefine( + const tbox::Dimension& dim); + + /** + * Uninteresting virtual destructor. + */ + virtual ~SkeletonCellDoubleConservativeLinearRefine(); + + /** + * The priority of cell-centered double conservative linear is 0. + * It will be performed before any user-defined interpolation operations. + */ + int + getOperatorPriority() const; + + /** + * The stencil width of the conservative linear interpolation operator is + * the vector of ones. + */ + hier::IntVector + getStencilWidth( + const tbox::Dimension& dim) const; + + /** + * Refine the source component on the coarse patch to the destination + * component on the fine patch using the cell-centered double conservative + * linear interpolation operator. Interpolation is performed on the + * intersection of the destination patch and the fine box. It is assumed + * that the coarse patch contains sufficient data for the stencil width of + * the refinement operator. + */ + void + refine( + hier::Patch& fine, + const hier::Patch& coarse, + const int dst_component, + const int src_component, + const hier::BoxOverlap& fine_overlap, + const hier::IntVector& ratio) const; + + void + refine( + hier::Patch& fine, + const hier::Patch& coarse, + const int dst_component, + const int src_component, + const hier::Box& fine_box, + const hier::IntVector& ratio) const; + + /** + * Set the dx, the distance between mesh nodes. + */ + void + setDx( + const int level_number, + const double* dx); + +private: + /** + * Return the dx + */ + void + getDx( + const int level_number, + double* dx) const; + + const tbox::Dimension d_dim; + std::vector > d_dx; + +}; + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.C b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.C new file mode 100644 index 00000000..e8343f46 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.C @@ -0,0 +1,179 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Weighted averaging operator for cell-centered double data on + * a Skeleton mesh. + * + ************************************************************************/ + +#include "SkeletonCellDoubleWeightedAverage.h" + +#include +#include +#include "SAMRAI/hier/PatchGeometry.h" +#include "SAMRAI/hier/Index.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/tbox/Utilities.h" + +/* + ************************************************************************* + * + * External declarations for FORTRAN routines. + * + ************************************************************************* + */ +extern "C" { +// in cartcoarsen1d.f: +void SAMRAI_F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( + const int&, const int&, + const int&, const int&, + const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +// in cartcoarsen2d.f: +void SAMRAI_F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +// in cartcoarsen3d.f: +void SAMRAI_F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int&, const int&, const int&, + const int *, const double *, const double *, + const double *, double *); +} + +using namespace SAMRAI; + +SkeletonCellDoubleWeightedAverage::SkeletonCellDoubleWeightedAverage( + const tbox::Dimension& dim): + hier::CoarsenOperator("SKELETON_CONSERVATIVE_COARSEN"), + d_dim(dim) +{ +} + +SkeletonCellDoubleWeightedAverage::~SkeletonCellDoubleWeightedAverage() +{ +} + +int SkeletonCellDoubleWeightedAverage::getOperatorPriority() const +{ + return 0; +} + +hier::IntVector +SkeletonCellDoubleWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { + return hier::IntVector(dim, 0); +} + +void SkeletonCellDoubleWeightedAverage::coarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const int dst_component, + const int src_component, + const hier::Box& coarse_box, + const hier::IntVector& ratio) const +{ + boost::shared_ptr > fdata( + BOOST_CAST, hier::PatchData>( + fine.getPatchData(src_component))); + boost::shared_ptr > cdata( + BOOST_CAST, hier::PatchData>( + coarse.getPatchData(dst_component))); + TBOX_ASSERT(fdata); + TBOX_ASSERT(cdata); + TBOX_ASSERT(cdata->getDepth() == fdata->getDepth()); + + const hier::Index filo = fdata->getGhostBox().lower(); + const hier::Index fihi = fdata->getGhostBox().upper(); + const hier::Index cilo = cdata->getGhostBox().lower(); + const hier::Index cihi = cdata->getGhostBox().upper(); + + const hier::Index ifirstc = coarse_box.lower(); + const hier::Index ilastc = coarse_box.upper(); + + int flev_num = fine.getPatchLevelNumber(); + int clev_num = coarse.getPatchLevelNumber(); + + // deal with levels not in hierarchy + if (flev_num < 0) flev_num = clev_num + 1; + if (clev_num < 0) clev_num = flev_num - 1; + + double cdx[SAMRAI::MAX_DIM_VAL]; + double fdx[SAMRAI::MAX_DIM_VAL]; + getDx(clev_num, cdx); + getDx(flev_num, fdx); + + for (int d = 0; d < cdata->getDepth(); ++d) { + if (fine.getDim() == tbox::Dimension(1)) { + SAMRAI_F77_FUNC(cartwgtavgcelldoub1d, CARTWGTAVGCELLDOUB1D) ( + ifirstc(0), ilastc(0), + filo(0), fihi(0), + cilo(0), cihi(0), + &ratio[0], + fdx, + cdx, + fdata->getPointer(d), + cdata->getPointer(d)); + } else if (fine.getDim() == tbox::Dimension(2)) { + SAMRAI_F77_FUNC(cartwgtavgcelldoub2d, CARTWGTAVGCELLDOUB2D) ( + ifirstc(0), ifirstc(1), ilastc(0), ilastc(1), + filo(0), filo(1), fihi(0), fihi(1), + cilo(0), cilo(1), cihi(0), cihi(1), + &ratio[0], + fdx, + cdx, + fdata->getPointer(d), + cdata->getPointer(d)); + } else if (fine.getDim() == tbox::Dimension(3)) { + SAMRAI_F77_FUNC(cartwgtavgcelldoub3d, CARTWGTAVGCELLDOUB3D) ( + ifirstc(0), ifirstc(1), ifirstc(2), + ilastc(0), ilastc(1), ilastc(2), + filo(0), filo(1), filo(2), + fihi(0), fihi(1), fihi(2), + cilo(0), cilo(1), cilo(2), + cihi(0), cihi(1), cihi(2), + &ratio[0], + fdx, + cdx, + fdata->getPointer(d), + cdata->getPointer(d)); + } else { + TBOX_ERROR("SkeletonCellDoubleWeightedAverage error...\n" + << "dimension > 3 not supported." << endl); + + } + } +} + +void SkeletonCellDoubleWeightedAverage::setDx( + const int level_number, + const double* dx) +{ + if (level_number >= static_cast(d_dx.size())) { + d_dx.resize(level_number + 1); + d_dx[level_number].resize(d_dim.getValue()); + for (int i = 0; i < d_dim.getValue(); ++i) { + d_dx[level_number][i] = dx[i]; + } + } +} + +void SkeletonCellDoubleWeightedAverage::getDx( + const int level_number, + double* dx) const +{ + for (int i = 0; i < d_dim.getValue(); ++i) { + dx[i] = d_dx[level_number][i]; + } +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.h b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.h new file mode 100644 index 00000000..c4f357b3 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SkeletonCellDoubleWeightedAverage.h @@ -0,0 +1,108 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Weighted averaging operator for cell-centered double data on + * a Skeleton mesh. + * + ************************************************************************/ + +#ifndef included_SkeletonCellDoubleWeightedAverageXD +#define included_SkeletonCellDoubleWeightedAverageXD + +#include "SAMRAI/SAMRAI_config.h" +#include "SAMRAI/hier/Box.h" +#include "SAMRAI/hier/IntVector.h" +#include "SAMRAI/hier/Patch.h" +#ifndef included_String +#include +#define included_String +#endif +#include "SAMRAI/hier/CoarsenOperator.h" + +#include "boost/shared_ptr.hpp" + +using namespace std; +using namespace SAMRAI; + +/** + * Class SkeletonCellDoubleWeightedAverageX implements conservative + * cell-weighted averaging for cell-centered double patch data defined over a + * Skeleton mesh. It is derived from the hier::CoarsenOperator base class. + * The numerical operations for the averaging use FORTRAN numerical routines. + * + * @see hier::CoarsenOperator + */ + +class SkeletonCellDoubleWeightedAverage: + public hier::CoarsenOperator +{ +public: + /** + * Uninteresting default constructor. + */ + SkeletonCellDoubleWeightedAverage( + const tbox::Dimension& dim); + + /** + * Uninteresting virtual destructor. + */ + virtual ~SkeletonCellDoubleWeightedAverage(); + + /** + * The priority of cell-centered double weighted averaging is 0. + * It will be performed before any user-defined coarsen operations. + */ + int + getOperatorPriority() const; + + /** + * The stencil width of the weighted averaging operator is the vector of + * zeros. That is, its stencil does not extend outside the fine box. + */ + hier::IntVector + getStencilWidth( + const tbox::Dimension& dim) const; + + /** + * Coarsen the source component on the fine patch to the destination + * component on the coarse patch using the cell-centered double weighted + * averaging operator. Coarsening is performed on the intersection of + * the destination patch and the coarse box. It is assumed that the + * fine patch contains sufficient data for the stencil width of the + * coarsening operator. + */ + void + coarsen( + hier::Patch& coarse, + const hier::Patch& fine, + const int dst_component, + const int src_component, + const hier::Box& coarse_box, + const hier::IntVector& ratio) const; + + /** + * Set the dx, the distance between mesh nodes. + */ + void + setDx( + const int level_number, + const double* dx); + +private: + /** + * Return the dx + */ + void + getDx( + const int level_number, + double* dx) const; + + const tbox::Dimension d_dim; + std::vector > d_dx; + +}; + +#endif diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.C b/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.C new file mode 100644 index 00000000..e60f0fc9 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.C @@ -0,0 +1,422 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: SphericalShellGenerator class implementation + * + ************************************************************************/ +#include "SphericalShellGenerator.h" +#include "SAMRAI/geom/CartesianGridGeometry.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/BoxLevelConnectorUtils.h" +#include "SAMRAI/hier/MappingConnectorAlgorithm.h" +#include "SAMRAI/hier/VariableDatabase.h" +#include "SAMRAI/pdat/ArrayData.h" +#include "SAMRAI/pdat/CellVariable.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/pdat/NodeVariable.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/Utilities.h" + +#include + +using namespace SAMRAI; + +SphericalShellGenerator::SphericalShellGenerator( + const std::string& object_name, + const tbox::Dimension& dim, + const boost::shared_ptr& database): + d_name(object_name), + d_dim(dim), + d_hierarchy(), + d_time_shift(0.0), + d_radii(0), + d_buffer_distance(1, std::vector(dim.getValue(), 0.0)) +{ + for (int i = 0; i < SAMRAI::MAX_DIM_VAL; ++i) { + d_init_center[i] = 0.0; + d_velocity[i] = 0.0; + } + + if (database) { + + if (database->isDouble("radii")) { + + d_radii = database->getDoubleVector("radii"); + + if (static_cast(d_radii.size()) % 2 != 0) { + d_radii.push_back(tbox::MathUtilities::getMax()); + } + + tbox::plog << "SphericalShellGenerator radii:\n"; + for (int i = 0; i < static_cast(d_radii.size()); ++i) { + tbox::plog << "\tradii[" << i << "] = " << d_radii[i] << '\n'; + } + } + + if (database->isDouble("init_center")) { + std::vector tmpa = database->getDoubleVector("init_center"); + for (int d = 0; d < d_dim.getValue(); ++d) { + d_init_center[d] = tmpa[d]; + } + } + if (database->isDouble("velocity")) { + std::vector tmpa = database->getDoubleVector("velocity"); + for (int d = 0; d < d_dim.getValue(); ++d) { + d_velocity[d] = tmpa[d]; + } + } + + d_time_shift = database->getDoubleWithDefault("time_shift", d_time_shift); + + /* + * Input parameters to determine whether to tag by buffering + * fronts, and by how much. + */ + const std::string bname("buffer_distance_"); + for (int ln = 0; ; ++ln) { + const std::string lnstr(tbox::Utilities::intToString(ln)); + + const std::string bnameln = bname + lnstr; + + std::vector tmpa; + + if (database->isDouble(bnameln)) { + tmpa = database->getDoubleVector(bnameln); + if (static_cast(tmpa.size()) != dim.getValue()) { + TBOX_ERROR(bnameln << " input parameter must have " << dim << " values"); + } + } + + if (!tmpa.empty()) { + d_buffer_distance.resize(ln + 1); + d_buffer_distance.back().swap(tmpa); + } else { + break; + } + + } + + } + +} + +SphericalShellGenerator::~SphericalShellGenerator() +{ +} + +/* + *********************************************************************** + *********************************************************************** + */ +void SphericalShellGenerator::setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id) +{ + const boost::shared_ptr& tag_level( + hierarchy->getPatchLevel(tag_ln)); + + resetHierarchyConfiguration(hierarchy, 0, 1); + + for (hier::PatchLevel::iterator pi(tag_level->begin()); + pi != tag_level->end(); ++pi) { + + boost::shared_ptr patch = *pi; + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch->getPatchGeometry())); + + boost::shared_ptr > tag_data( + BOOST_CAST, hier::PatchData>( + patch->getPatchData(tag_data_id))); + + TBOX_ASSERT(patch_geom); + TBOX_ASSERT(tag_data); + + computeShellsData(0, tag_data.get(), + tag_data->getBox(), + (static_cast(tag_ln) < d_buffer_distance.size() ? + d_buffer_distance[tag_ln] : d_buffer_distance.back()), + patch_geom->getXLower(), + patch_geom->getDx()); + + } + + exact_tagging = false; +} + +void SphericalShellGenerator::setDomain( + hier::BoxContainer& domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI& mpi) +{ + TBOX_ASSERT(!domain.empty()); + NULL_USE(xlo); + NULL_USE(xhi); + + if (domain.size() != 1) { + TBOX_ERROR("SphericalShellGenerator only supports single-box domains."); + } + + hier::Box domain_box = domain.front(); + hier::IntVector tmp_intvec = domain_box.numberCells(); + const tbox::Dimension& dim = domain_box.getDim(); + + double scale_factor = static_cast(mpi.getSize()) / autoscale_base_nprocs; + double linear_scale_factor = pow(scale_factor, 1.0 / dim.getValue()); + + for (int d = 0; d < dim.getValue(); ++d) { + // xhi[d] = xlo[d] + linear_scale_factor*(xhi[d]-xlo[d]); + tmp_intvec(d) = static_cast(0.5 + tmp_intvec(d) * linear_scale_factor); + } + tmp_intvec -= hier::IntVector::getOne(domain_box.getDim()); + tbox::plog << "SphericalShellGenerator::setDomain changing domain from " + << domain_box << " to "; + domain_box.setUpper(domain_box.lower() + tmp_intvec); + tbox::plog << domain_box << '\n'; + + domain.clear(); + domain.pushBack(domain_box); + +} + +void SphericalShellGenerator::resetHierarchyConfiguration( + /*! New hierarchy */ const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level) +{ + NULL_USE(coarsest_level); + NULL_USE(finest_level); + TBOX_ASSERT(new_hierarchy->getDim() == d_dim); + d_hierarchy = new_hierarchy; + TBOX_ASSERT(d_hierarchy); +} + +/* + * Compute the solution data for a patch. + */ +void SphericalShellGenerator::computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const +{ + boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom.get() != 0); + + const double* xlo = patch_geom->getXLower(); + const double* dx = patch_geom->getDx(); + + if (tag_data) { + computeShellsData(uval_data, tag_data, + fill_box, + (static_cast(patch.getPatchLevelNumber()) < d_buffer_distance.size() ? + d_buffer_distance[patch.getPatchLevelNumber()] : d_buffer_distance.back()), + xlo, dx); + } else { + // Not computing tag => no tag buffer needed. + computeShellsData(uval_data, tag_data, + fill_box, + std::vector(d_dim.getValue(), 0.0), + xlo, dx); + } +} + +/* + * Compute the various data due to the shells. + */ +void SphericalShellGenerator::computeShellsData( + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box, + const std::vector& buffer_distance, + const double xlo[], + const double dx[]) const +{ + const int tag_val = 1; + + // Compute the buffer in terms of cells. + hier::IntVector buffer_cells(d_dim); + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + buffer_cells(d) = static_cast(0.5 + buffer_distance[d] / dx[d]); + } + + hier::Box pbox(d_dim), gbox(d_dim); + double time = 0.0; + if (tag_data != 0) { + pbox = tag_data->getBox(); + gbox = tag_data->getGhostBox(); + time = tag_data->getTime() + d_time_shift; + } else if (uval_data != 0) { + pbox = uval_data->getBox(); + gbox = uval_data->getGhostBox(); + time = uval_data->getTime() + d_time_shift; + } + + if (tag_data != 0) { + /* + * Compute radii of the nodes. Tag cell if it has nodes farther than + * the inner shell radius and nodes closer than the shell outer radius. + */ + hier::Box radius_data_box = fill_box * gbox; + pdat::NodeData radius_data(radius_data_box, 1, buffer_cells); + + pdat::NodeData::iterator niend(pdat::NodeGeometry::end(radius_data.getGhostBox())); + for (pdat::NodeData::iterator ni(pdat::NodeGeometry::begin(radius_data.getGhostBox())); + ni != niend; ++ni) { + const pdat::NodeIndex& idx = *ni; + double r[SAMRAI::MAX_DIM_VAL]; + double rr = 0; + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + r[d] = xlo[d] + + dx[d] * (idx(d) - pbox.lower() (d)) + - (d_init_center[d] + time * d_velocity[d]); + rr += r[d] * r[d]; + } + rr = sqrt(rr); + radius_data(idx) = rr; + } + + hier::Box fbox = tag_data->getGhostBox() * fill_box; + tag_data->getArrayData().fill(0, fill_box); + + pdat::CellData::iterator ciend(pdat::CellGeometry::end(fbox)); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(fbox)); + ci != ciend; ++ci) { + const pdat::CellIndex& cid = *ci; + + hier::Box check_box(cid, cid, pbox.getBlockId()); + check_box.grow(buffer_cells); + pdat::NodeIterator node_itr_end(pdat::NodeGeometry::end(check_box)); + double min_node_radius = 1e20; + double max_node_radius = 0; + for (pdat::NodeIterator node_itr(pdat::NodeGeometry::begin(check_box)); + node_itr != node_itr_end; ++node_itr) { + min_node_radius = + tbox::MathUtilities::Min(min_node_radius, radius_data(*node_itr)); + max_node_radius = + tbox::MathUtilities::Max(min_node_radius, radius_data(*node_itr)); + } + for (int i = 0; i < static_cast(d_radii.size()); i += 2) { + if (d_radii[i] <= max_node_radius && min_node_radius < d_radii[i + 1]) { + (*tag_data)(cid) = tag_val; + break; + } + } + } + } + + if (uval_data != 0) { + hier::Box fbox = uval_data->getGhostBox() * fill_box; + uval_data->fill(static_cast(d_radii.size()), fbox); + + pdat::CellData::iterator ciend(pdat::CellGeometry::end(fbox)); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(fbox)); + ci != ciend; ++ci) { + const pdat::CellIndex& cid = *ci; + + double r[SAMRAI::MAX_DIM_VAL]; + double rr = 0; + for (tbox::Dimension::dir_t d = 0; d < d_dim.getValue(); ++d) { + r[d] = xlo[d] + + dx[d] * (cid(d) - pbox.lower() (d) + 0.5) + - (d_init_center[d] + time * d_velocity[d]); + rr += r[d] * r[d]; + } + rr = sqrt(rr); + + for (int i = 0; i < static_cast(d_radii.size()); ++i) { + if (rr < d_radii[i]) { + (*uval_data)(cid) = static_cast(i); + break; + } + } + } + } + +} + +/* + *********************************************************************** + *********************************************************************** + */ +#ifdef HAVE_HDF5 +int SphericalShellGenerator::registerVariablesWithPlotter( + appu::VisItDataWriter& writer) +{ + writer.registerDerivedPlotQuantity("Tag value", "SCALAR", this); + writer.registerDerivedPlotQuantity("U_Shells", "SCALAR", this); + d_vis_owner_data.registerVariablesWithPlotter(writer); + return 0; +} +#endif + +/* + *********************************************************************** + *********************************************************************** + */ +bool SphericalShellGenerator::packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const +{ + (void)depth_index; + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + + const double* xlo = patch_geom->getXLower(); + const double* dx = patch_geom->getDx(); + + if (variable_name == "U_Shells") { + pdat::CellData u_data(patch.getBox(), 1, hier::IntVector(d_dim, 0)); + u_data.setTime(simulation_time); + computeShellsData(&u_data, 0, region, + std::vector(d_dim.getValue(), 0.0), + xlo, dx); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(patch.getBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(patch.getBox())); + ci != ciend; ++ci) { + *(buffer++) = u_data(*ci); + } + } else if (variable_name == "Tag value") { + + boost::shared_ptr patch_geom( + BOOST_CAST( + patch.getPatchGeometry())); + TBOX_ASSERT(patch_geom); + + pdat::CellData tag_data(region, 1, hier::IntVector(d_dim, 0)); + tag_data.setTime(simulation_time); + computeShellsData( + 0, &tag_data, + region, + (static_cast(patch.getPatchLevelNumber()) < d_buffer_distance.size() ? + d_buffer_distance[patch.getPatchLevelNumber()] : d_buffer_distance.back()), + xlo, dx); + pdat::CellData::iterator ciend(pdat::CellGeometry::end(patch.getBox())); + for (pdat::CellData::iterator ci(pdat::CellGeometry::begin(patch.getBox())); + ci != ciend; ++ci) { + *(buffer++) = tag_data(*ci); + } + + } else { + TBOX_ERROR("Unrecognized name " << variable_name); + } + return true; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.h b/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.h new file mode 100644 index 00000000..8b2c1765 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/SphericalShellGenerator.h @@ -0,0 +1,190 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: SphericalShellGenerator class declaration + * + ************************************************************************/ +#ifndef included_SphericalShellGenerator +#define included_SphericalShellGenerator + +#include "MeshGenerationStrategy.h" + +#include + +/* + * SAMRAI classes + */ +#include "SAMRAI/appu/VisItDataWriter.h" +#include "SAMRAI/appu/VisDerivedDataStrategy.h" +#include "SAMRAI/hier/BoxContainer.h" +#include "SAMRAI/hier/Patch.h" +#include "SAMRAI/hier/PatchHierarchy.h" +#include "SAMRAI/hier/PatchLevel.h" +#include "SAMRAI/geom/CartesianPatchGeometry.h" +#include "SAMRAI/mesh/BergerRigoutsos.h" +#include "SAMRAI/mesh/StandardTagAndInitStrategy.h" +#include "SAMRAI/pdat/CellData.h" +#include "SAMRAI/pdat/NodeData.h" +#include "SAMRAI/tbox/Database.h" +#include "SAMRAI/tbox/Timer.h" + +#include "DerivedVisOwnerData.h" + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Class to tag spherical shell patternse in given domain. + * + * Inputs: + * + * radii: + * Starting at shell origin, tag cells that intersect regions defined by + * radii[0]& database = boost::shared_ptr()); + + ~SphericalShellGenerator(); + + /*! + * @brief Set tas on the tag level. + */ + virtual void + setTags( + bool& exact_tagging, + const boost::shared_ptr& hierarchy, + int tag_ln, + int tag_data_id); + + //@{ @name SAMRAI::mesh::StandardTagAndInitStrategy virtuals + +public: + /*! + * @brief Set the domain, possibly scaling up the specifications. + * + * Take the domain_boxes, xlo and xhi to be the size for the + * (integer) value of autoscale_base_nprocs. Scale the problem + * from there to the number of process running by doubling the + * size starting with the j direction. + * + * The number of processes must be a power of 2 times the value + * of autoscale_base_nprocs. + */ + void setDomain( + hier::BoxContainer & domain, + double xlo[], + double xhi[], + int autoscale_base_nprocs, + const tbox::SAMRAI_MPI & mpi); + + virtual void + resetHierarchyConfiguration( + /*! New hierarchy */ + const boost::shared_ptr& new_hierarchy, + /*! Coarsest level */ const int coarsest_level, + /*! Finest level */ const int finest_level); + + //@} + + /*! + * @brief Compute shell-dependent data for a patch. + */ + void + computePatchData( + const hier::Patch& patch, + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box) const; + + bool + packDerivedDataIntoDoubleBuffer( + double* buffer, + const hier::Patch& patch, + const hier::Box& region, + const std::string& variable_name, + int depth_index, + double simulation_time) const; + +public: +#ifdef HAVE_HDF5 + /*! + * @brief Tell a VisIt plotter which data to write for this class. + */ + int + registerVariablesWithPlotter( + appu::VisItDataWriter& writer); +#endif + +private: + void + computeShellsData( + pdat::CellData* uval_data, + pdat::CellData* tag_data, + const hier::Box& fill_box, + const std::vector& buffer_distance, + const double xlo[], + const double dx[]) const; + + std::string d_name; + + const tbox::Dimension d_dim; + + /*! + * @brief PatchHierarchy for use in implementations of some + * abstract interfaces that do not specify a hierarch. + */ + boost::shared_ptr d_hierarchy; + + /*! + * @brief Constant time shift to be added to simulation time. + */ + double d_time_shift; + + /*! + * @brief Center of shells at time zero. + */ + double d_init_center[SAMRAI::MAX_DIM_VAL]; + + /*! + * @brief Shell velocity. + */ + double d_velocity[SAMRAI::MAX_DIM_VAL]; + + /*! + * @brief Radii of shells. + */ + std::vector d_radii; + + /*! + * @brief Buffer distances for generating tags. + */ + std::vector > d_buffer_distance; + + DerivedVisOwnerData d_vis_owner_data; + +}; + +#endif // included_SphericalShellGenerator diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.depend new file mode 100644 index 00000000..405fd66a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.depend @@ -0,0 +1,57 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile dependencies +## +######################################################################### + +## This file is automatically generated by depend.pl. + + +FILE_0=skelbdry2d.o +DEPENDS_0:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h skelbdry2d.m4 + +DEPENDS_0 +=\ + + + +${FILE_0}: ${DEPENDS_0} + +FILE_1=skelbdry3d.o +DEPENDS_1:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h skelbdry3d.m4 + +DEPENDS_1 +=\ + + + +${FILE_1}: ${DEPENDS_1} + +FILE_2=upfluxsum2d.o +DEPENDS_2:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim2d.i \ + upfluxsum2d.m4 + +DEPENDS_2 +=\ + + + +${FILE_2}: ${DEPENDS_2} + +FILE_3=upfluxsum3d.o +DEPENDS_3:=\ + $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ + $(INCLUDE_SAM)/SAMRAI/pdat/fortran/pdat_m4arrdim3d.i \ + upfluxsum3d.m4 + +DEPENDS_3 +=\ + + + +${FILE_3}: ${DEPENDS_3} + diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.in b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.in new file mode 100644 index 00000000..8385f8a6 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/Makefile.in @@ -0,0 +1,46 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: makefile for fortran files for library of reusable test code +## +######################################################################### + +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ +SUBDIR = source/test/testlib/fortran +VPATH = @srcdir@ +OBJECT = ../../../.. + +default: main + +include $(OBJECT)/config/Makefile.config + +OBJS= skelbdry2d.o skelbdry3d.o upfluxsum2d.o upfluxsum3d.o + +libSAMRAI_test$(LIB_SUFFIX): $(OBJS) + +clean: + $(CLEAN_COMMON_TEST_FILES) + +include $(SRCDIR)/Makefile.depend + +M4DIRS = -DFORTDIR=$(SRCDIR) $(SAMRAI_M4_FLAGS) + +skelbdry2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/skelbdry2d.m4 > skelbdry2d.f + $(F77) $(FFLAGS) -c skelbdry2d.f -o $@ + +skelbdry3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/skelbdry3d.m4 > skelbdry3d.f + $(F77) $(FFLAGS) -c skelbdry3d.f -o $@ + +upfluxsum2d.o: + $(M4) $(M4DIRS) $(SRCDIR)/upfluxsum2d.m4 > upfluxsum2d.f + $(F77) $(FFLAGS) -c upfluxsum2d.f -o $@ + +upfluxsum3d.o: + $(M4) $(M4DIRS) $(SRCDIR)/upfluxsum3d.m4 > upfluxsum3d.f + $(F77) $(FFLAGS) -c upfluxsum3d.f -o $@ diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry2d.m4 b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry2d.m4 new file mode 100644 index 00000000..12068dc5 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry2d.m4 @@ -0,0 +1,408 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for general 2d boundary condition cases, +c node boundary conditions, and edge boundary conditions +c +c*********************************************************************** +c*********************************************************************** + subroutine getskeledgebdry2d( + & ifirst0,ilast0,ifirst1,ilast1, + & ibeg0,iend0,ibeg1,iend1, + & ngc0,ngc1, + & bdry_loc, + & bdry_cond, + & edge_values, + & arrdata, + & arrdepth) +c*********************************************************************** + implicit none +c +c 2d boundary constant common blocks +c + common/skelbdrylocparams2d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 +c +c + common/skelbdrycondparams2d/ + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + integer + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET +c*********************************************************************** + integer ifirst0,ilast0,ifirst1,ilast1 + integer ibeg0,iend0,ibeg1,iend1 + integer ngc0,ngc1 +c +c + integer bdry_loc, + & arrdepth, + & bdry_cond + double precision + & edge_values(0:arrdepth-1,0:2*2-1) +c + double precision + & arrdata(ifirst0-ngc0:ilast0+ngc0, + & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) +c + integer ic1,ic0,ict0,ict1 + integer k + integer ipivot0,ipivot1 + integer edge_loc + double precision dirsign0,dirsign1 +c +c*********************************************************************** +c bdry_loc index bdry_loc index +c 0 (-1, 0) 2 (0,-1) +c 1 ( 1, 0) 3 (0, 1) +c*********************************************************************** +c*********************************************************************** + edge_loc = bdry_loc + if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then + if (bdry_loc.eq.XLEFT) then +c x0 boundary + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else +c x1 boundary + ipivot0 = ilast0 + dirsign0 = 1.d0 + endif + if (bdry_cond.eq.DIRICHLET) then + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=edge_values(k,edge_loc) + enddo + enddo + enddo + else if (bdry_cond.eq.FLOW) then + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + enddo + enddo + else if (bdry_cond.eq.REFLECT) then + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) + enddo + enddo + else + write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then + if (bdry_loc.eq.YLEFT) then +c y0 boundary + ipivot1 = ifirst1 + dirsign1 = -1.d0 + else +c y1 boundary + ipivot1 = ilast1 + dirsign1 = 1.d0 + endif + if (bdry_cond.eq.DIRICHLET) then + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=edge_values(k,edge_loc) + enddo + enddo + enddo + else if (bdry_cond.eq.FLOW) then + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + enddo + enddo + else if (bdry_cond.eq.REFLECT) then + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) + enddo + enddo + else + write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry2d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + endif +c + return + end +c*********************************************************************** +c*********************************************************************** + subroutine getskelnodebdry2d( + & ifirst0,ilast0,ifirst1,ilast1, + & ibeg0,iend0,ibeg1,iend1, + & ngc0,ngc1, + & bdry_loc, + & bdry_cond, + & edge_values, + & arrdata, + & arrdepth) +c*********************************************************************** + implicit none +c +c 2d boundary constant common blocks +c + common/skelbdrylocparams2d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 +c +c + common/skelbdrycondparams2d/ + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + integer + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET +c*********************************************************************** + integer ifirst0,ilast0,ifirst1,ilast1 + integer ibeg0,iend0,ibeg1,iend1 + integer ngc0,ngc1 +c +c + integer bdry_loc, + & arrdepth, + & bdry_cond + double precision + & edge_values(0:arrdepth-1,0:2*2-1) +c + double precision + & arrdata(ifirst0-ngc0:ilast0+ngc0, + & ifirst1-ngc1:ilast1+ngc1,0:arrdepth-1) +c + integer ic1,ic0,ict0,ict1 + integer k + integer ipivot0,ipivot1 + integer edge_loc0,edge_loc1 + double precision dirsign0,dirsign1 +c +c*********************************************************************** +c*********************************************************************** +c bdry_loc index +c 0 (-1,-1) +c 1 ( 1,-1) +c 2 (-1, 1) +c 3 ( 1, 1) +c*********************************************************************** +c*********************************************************************** + if (bdry_loc.eq.X0Y0) then + edge_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + edge_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + else if (bdry_loc.eq.X1Y0) then + edge_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + edge_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + else if (bdry_loc.eq.X0Y1) then + edge_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + edge_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + else if (bdry_loc.eq.X1Y1) then + edge_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + edge_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + endif + if (bdry_cond.eq.XDIRICHLET) then + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=edge_values(k,edge_loc0) + enddo + enddo + enddo + else if (bdry_cond.eq.YDIRICHLET) then + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=edge_values(k,edge_loc1) + enddo + enddo + enddo + else if (bdry_cond.eq.XFLOW) then + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + enddo + enddo + else if (bdry_cond.eq.YFLOW) then + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + enddo + enddo + else if (bdry_cond.eq.XREFLECT) then + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + arrdata(ic0,ic1,0)= -arrdata(ic0,ic1,0) + enddo + enddo + else if (bdry_cond.eq.YREFLECT) then + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,k)=arrdata(ict0,ict1,k) + enddo + arrdata(ic0,ic1,1)= -arrdata(ic0,ic1,1) + enddo + enddo + else + write(6,*) "INVALID NODE bdry_cond in getskelnodebdry2d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif +c + return + end + +c*********************************************************************** +c*********************************************************************** + subroutine stufskelbdryloc2d( + & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, + & X0Y0in, X1Y0in, X0Y1in, X1Y1in) + implicit none + integer + & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, + & X0Y0in, X1Y0in, X0Y1in, X1Y1in +c +c 2d boundary constant common blocks +c + common/skelbdrylocparams2d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 +c +c + common/skelbdrycondparams2d/ + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + integer + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + +c 2d edges + XLEFT=XLEFTin + XRIGHT=XRIGHTin + YLEFT=YLEFTin + YRIGHT=YRIGHTin + +c 2d nodes + X0Y0=X0Y0in + X1Y0=X1Y0in + X0Y1=X0Y1in + X1Y1=X1Y1in + + return + end +c*********************************************************************** +c*********************************************************************** + subroutine stufskelbdrycond2d( + & FLOWin, XFLOWin, YFLOWin, + & REFLECTin, XREFLECTin, YREFLECTin, + & DIRICHLETin, XDIRICHLETin, YDIRICHLETin) + implicit none + integer + & FLOWin, XFLOWin, YFLOWin, + & REFLECTin, XREFLECTin, YREFLECTin, + & DIRICHLETin, XDIRICHLETin, YDIRICHLETin +c +c 2d boundary constant common blocks +c + common/skelbdrylocparams2d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT, + & X0Y0,X1Y0,X0Y1,X1Y1 +c +c + common/skelbdrycondparams2d/ + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + integer + & FLOW,XFLOW,YFLOW, + & REFLECT,XREFLECT,YREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET + + FLOW=FLOWin + XFLOW=XFLOWin + YFLOW=YFLOWin + + REFLECT=REFLECTin + XREFLECT=XREFLECTin + YREFLECT=YREFLECTin + + DIRICHLET=DIRICHLETin + XDIRICHLET=XDIRICHLETin + YDIRICHLET=YDIRICHLETin + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry3d.m4 b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry3d.m4 new file mode 100644 index 00000000..a325bc32 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/skelbdry3d.m4 @@ -0,0 +1,1396 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: FORTRAN routines for general 3d boundary condition cases, +c node boundary conditions, and edge boundary conditions +c +c*********************************************************************** +c*********************************************************************** + subroutine getskelfacebdry3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, + & ngc0,ngc1,ngc2, + & dx, + & bdry_loc, + & bdry_cond, + & face_values, + & arrdata, + & arrdepth) +c*********************************************************************** + implicit none +c +c 3d boundary constant common blocks +c + common/skelbdrylocparams3d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 +c +c + common/skelbdrycondparams3d/ + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + integer + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN +c*********************************************************************** + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 + integer ngc0,ngc1,ngc2 +c + double precision dx(0:3-1) +c + integer bdry_loc, + & arrdepth, + & bdry_cond + double precision + & face_values(0:arrdepth-1,0:2*3-1) +c + double precision + & arrdata(ifirst0-ngc0:ilast0+ngc0, + & ifirst1-ngc1:ilast1+ngc1, + & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) +c + integer ic2,ic1,ic0,ict0,ict1,ict2 + integer k + integer ipivot0,ipivot1,ipivot2 + integer face_loc + double precision dirsign0,dirsign1,dirsign2 +c +c*********************************************************************** +c bdry_loc index bdry_loc index bdry_loc index +c 0 (-1, 0, 0) 2 (0,-1, 0) 4 (0, 0,-1) +c 1 ( 1, 0, 0) 3 (0, 1, 0) 5 (0, 0, 1) +c*********************************************************************** +c*********************************************************************** + face_loc = bdry_loc + if ((bdry_loc.eq.XLEFT).or.(bdry_loc.eq.XRIGHT)) then + if (bdry_loc.eq.XLEFT) then +c x0 boundary + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else +c x1 boundary + ipivot0 = ilast0 + dirsign0 = 1.d0 + endif + if (bdry_cond.eq.DIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.NEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 + & * face_values(k,face_loc) * dble(ic0-ict0) * dx(0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.FLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.REFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) + enddo + enddo + enddo + else + write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + else if ((bdry_loc.eq.YLEFT).or.(bdry_loc.eq.YRIGHT)) then + if (bdry_loc.eq.YLEFT) then +c y0 boundary + ipivot1 = ifirst1 + dirsign1 = -1.d0 + else +c y1 boundary + ipivot1 = ilast1 + dirsign1 = 1.d0 + endif + if (bdry_cond.eq.DIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.NEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 + & * face_values(k,face_loc) * dble(ic1-ict1) * dx(1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.FLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.REFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) + enddo + enddo + enddo + else + write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + else if ((bdry_loc.eq.ZLEFT).or.(bdry_loc.eq.ZRIGHT)) then + if (bdry_loc.eq.ZLEFT) then +c z0 boundary + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else +c z1 boundary + ipivot2 = ilast2 + dirsign2 = 1.d0 + endif + if (bdry_cond.eq.DIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.NEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 + & * face_values(k,face_loc) * dble(ic2-ict2) * dx(2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.FLOW) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.REFLECT) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) + enddo + enddo + enddo + else + write(6,*) "INVALID FACE bdry_cond in getskelfacebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + endif +c + return + end +c*********************************************************************** +c*********************************************************************** + subroutine getskeledgebdry3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, + & ngc0,ngc1,ngc2, + & dx, + & bdry_loc, + & bdry_cond, + & face_values, + & arrdata, + & arrdepth) +c*********************************************************************** + implicit none +c +c 3d boundary constant common blocks +c + common/skelbdrylocparams3d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 +c +c + common/skelbdrycondparams3d/ + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + integer + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN +c*********************************************************************** + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 + integer ngc0,ngc1,ngc2 +c + double precision dx(0:3-1) +c + integer bdry_loc, + & arrdepth, + & bdry_cond + double precision + & face_values(0:arrdepth-1,0:2*3-1) +c + double precision + & arrdata(ifirst0-ngc0:ilast0+ngc0, + & ifirst1-ngc1:ilast1+ngc1, + & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) +c + integer ic2,ic1,ic0,ict0,ict1,ict2 + integer k + integer ipivot0,ipivot1,ipivot2 + integer face_loc0,face_loc1,face_loc2 + double precision dirsign0,dirsign1,dirsign2 +c +c*********************************************************************** +c*********************************************************************** +c bdry_loc index bdry_loc index bdry_loc index +c 0 (0,-1,-1) 4 (-1,0,-1) 8 (-1,-1,0) +c 1 (0, 1,-1) 5 (-1,0, 1) 9 ( 1,-1,0) +c 2 (0,-1, 1) 6 ( 1,0,-1) 10 (-1, 1,0) +c 3 (0, 1, 1) 7 ( 1,0, 1) 11 ( 1, 1,0) +c*********************************************************************** +c*********************************************************************** + if ((bdry_loc.eq.Y0Z0).or.(bdry_loc.eq.Y1Z0).or. + & (bdry_loc.eq.Y0Z1).or.(bdry_loc.eq.Y1Z1)) then + if (bdry_loc.eq.Y0Z0) then + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.Y1Z0) then + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.Y0Z1) then + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + else + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + endif + if (bdry_cond.eq.XDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 + & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 + & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 + & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZFLOW) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) + enddo + enddo + enddo + else if (bdry_cond.eq.YREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) + enddo + enddo + enddo + else if (bdry_cond.eq.ZREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) + enddo + enddo + enddo + else + write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + else if ((bdry_loc.eq.X0Z0).or.(bdry_loc.eq.X0Z1).or. + & (bdry_loc.eq.X1Z0).or.(bdry_loc.eq.X1Z1)) then + if (bdry_loc.eq.X0Z0) then + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else if (bdry_loc.eq.X0Z1) then + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else if (bdry_loc.eq.X1Z0) then + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + else + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + endif + if (bdry_cond.eq.XDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 + & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 + & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 + & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZFLOW) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) + enddo + enddo + enddo + else if (bdry_cond.eq.YREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) + enddo + enddo + enddo + else if (bdry_cond.eq.ZREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) + enddo + enddo + enddo + else + write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + else if ((bdry_loc.eq.X0Y0).or.(bdry_loc.eq.X1Y0).or. + & (bdry_loc.eq.X0Y1).or.(bdry_loc.eq.X1Y1)) then + if (bdry_loc.eq.X0Y0) then + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else if (bdry_loc.eq.X1Y0) then + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + else if (bdry_loc.eq.X0Y1) then + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + else + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + endif + if (bdry_cond.eq.XDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 + & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 + & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 + & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZFLOW) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) + enddo + enddo + enddo + else if (bdry_cond.eq.YREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) + enddo + enddo + enddo + else if (bdry_cond.eq.ZREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) + enddo + enddo + enddo + else + write(6,*) "INVALID EDGE bdry_cond in getskeledgebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif + endif +c + return + end +c*********************************************************************** +c*********************************************************************** + subroutine getskelnodebdry3d( + & ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2, + & ibeg0,iend0,ibeg1,iend1,ibeg2,iend2, + & ngc0,ngc1,ngc2, + & dx, + & bdry_loc, + & bdry_cond, + & face_values, + & arrdata, + & arrdepth) +c*********************************************************************** + implicit none +c +c 3d boundary constant common blocks +c + common/skelbdrylocparams3d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 +c +c + common/skelbdrycondparams3d/ + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + integer + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN +c*********************************************************************** + integer ifirst0,ilast0,ifirst1,ilast1,ifirst2,ilast2 + integer ibeg0,iend0,ibeg1,iend1,ibeg2,iend2 + integer ngc0,ngc1,ngc2 +c + double precision dx(0:3-1) +c + integer bdry_loc, + & arrdepth, + & bdry_cond + double precision + & face_values(0:arrdepth-1,0:2*3-1) +c + double precision + & arrdata(ifirst0-ngc0:ilast0+ngc0, + & ifirst1-ngc1:ilast1+ngc1, + & ifirst2-ngc2:ilast2+ngc2,0:arrdepth-1) +c + integer ic2,ic1,ic0,ict0,ict1,ict2 + integer k + integer ipivot0,ipivot1,ipivot2 + integer face_loc0,face_loc1,face_loc2 + double precision dirsign0,dirsign1,dirsign2 +c +c*********************************************************************** +c*********************************************************************** +c bdry_loc index bdry_loc index +c 0 (-1,-1,-1) 4 (-1,-1, 1) +c 1 ( 1,-1,-1) 5 ( 1,-1, 1) +c 2 (-1, 1,-1) 6 (-1, 1, 1) +c 3 ( 1, 1,-1) 7 ( 1, 1, 1) +c*********************************************************************** +c*********************************************************************** + if (bdry_loc.eq.X0Y0Z0) then + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.X1Y0Z0) then + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.X0Y1Z0) then + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.X1Y1Z0) then + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZLEFT + ipivot2 = ifirst2 + dirsign2 = -1.d0 + else if (bdry_loc.eq.X0Y0Z1) then + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + else if (bdry_loc.eq.X1Y0Z1) then + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + face_loc1 = YLEFT + ipivot1 = ifirst1 + dirsign1 = -1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + else if (bdry_loc.eq.X0Y1Z1) then + face_loc0 = XLEFT + ipivot0 = ifirst0 + dirsign0 = -1.d0 + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + else if (bdry_loc.eq.X1Y1Z1) then + face_loc0 = XRIGHT + ipivot0 = ilast0 + dirsign0 = 1.d0 + face_loc1 = YRIGHT + ipivot1 = ilast1 + dirsign1 = 1.d0 + face_loc2 = ZRIGHT + ipivot2 = ilast2 + dirsign2 = 1.d0 + endif + if (bdry_cond.eq.XDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZDIRICHLET) then + do ic2=ibeg2,iend2 + do ic1=ibeg1,iend1 + do ic0=ibeg0,iend0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=face_values(k,face_loc2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign0 + & * face_values(k,face_loc0) * dble(ic0-ict0) * dx(0) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign1 + & * face_values(k,face_loc1) * dble(ic1-ict1) * dx(1) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZNEUMANN) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + dirsign2 + & * face_values(k,face_loc2) * dble(ic2-ict2) * dx(2) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.YFLOW) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.ZFLOW) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + enddo + enddo + enddo + else if (bdry_cond.eq.XREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ipivot0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,0)= -arrdata(ic0,ic1,ic2,0) + enddo + enddo + enddo + else if (bdry_cond.eq.YREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ic2 + do ic1=ibeg1,iend1 + ict1 = ipivot1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,1)= -arrdata(ic0,ic1,ic2,1) + enddo + enddo + enddo + else if (bdry_cond.eq.ZREFLECT) then + do ic2=ibeg2,iend2 + ict2 = ipivot2 + do ic1=ibeg1,iend1 + ict1 = ic1 + do ic0=ibeg0,iend0 + ict0 = ic0 + do k=0,arrdepth-1 + arrdata(ic0,ic1,ic2,k)=arrdata(ict0,ict1,ict2,k) + enddo + arrdata(ic0,ic1,ic2,2)= -arrdata(ic0,ic1,ic2,2) + enddo + enddo + enddo + else + write(6,*) "INVALID NODE bdry_cond in getskelnodebdry3d" + write(6,*) "bdry_loc = ",bdry_loc, + & "bdry_cond = ",bdry_cond + endif +c + return + end + +c*********************************************************************** +c*********************************************************************** + subroutine stufskelbdryloc3d( + & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, + & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, + & X0Z0in, X0Z1in, X1Z0in, X1Z1in, + & X0Y0in, X1Y0in, X0Y1in, X1Y1in, + & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, + & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in) + implicit none + integer + & XLEFTin, XRIGHTin, YLEFTin, YRIGHTin, ZLEFTin, ZRIGHTin, + & Y0Z0in, Y1Z0in, Y0Z1in, Y1Z1in, + & X0Z0in, X0Z1in, X1Z0in, X1Z1in, + & X0Y0in, X1Y0in, X0Y1in, X1Y1in, + & X0Y0Z0in, X1Y0Z0in, X0Y1Z0in, X1Y1Z0in, + & X0Y0Z1in, X1Y0Z1in, X0Y1Z1in, X1Y1Z1in +c +c 3d boundary constant common blocks +c + common/skelbdrylocparams3d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 +c +c + common/skelbdrycondparams3d/ + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + integer + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + +c 3d faces + XLEFT=XLEFTin + XRIGHT=XRIGHTin + YLEFT=YLEFTin + YRIGHT=YRIGHTin + ZLEFT=ZLEFTin + ZRIGHT=ZRIGHTin + +c 3d edges + Y0Z0=Y0Z0in + Y1Z0=Y1Z0in + Y0Z1=Y0Z1in + Y1Z1=Y1Z1in + X0Z0=X0Z0in + X0Z1=X0Z1in + X1Z0=X1Z0in + X1Z1=X1Z1in + X0Y0=X0Y0in + X1Y0=X1Y0in + X0Y1=X0Y1in + X1Y1=X1Y1in + +c 3d nodes + X0Y0Z0=X0Y0Z0in + X1Y0Z0=X1Y0Z0in + X0Y1Z0=X0Y1Z0in + X1Y1Z0=X1Y1Z0in + X0Y0Z1=X0Y0Z1in + X1Y0Z1=X1Y0Z1in + X0Y1Z1=X0Y1Z1in + X1Y1Z1=X1Y1Z1in + + return + end +c*********************************************************************** +c*********************************************************************** + subroutine stufskelbdrycond3d( + & FLOWin, XFLOWin, YFLOWin, ZFLOWin, + & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, + & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, + & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin) + implicit none + integer + & FLOWin, XFLOWin, YFLOWin, ZFLOWin, + & REFLECTin, XREFLECTin, YREFLECTin, ZREFLECTin, + & DIRICHLETin, XDIRICHLETin, YDIRICHLETin, ZDIRICHLETin, + & NEUMANNin, XNEUMANNin, YNEUMANNin, ZNEUMANNin +c +c 3d boundary constant common blocks +c + common/skelbdrylocparams3d/ + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 + integer + & XLEFT,XRIGHT,YLEFT,YRIGHT,ZLEFT,ZRIGHT, + & Y0Z0,Y1Z0,Y0Z1,Y1Z1, + & X0Z0,X0Z1,X1Z0,X1Z1, + & X0Y0,X1Y0,X0Y1,X1Y1, + & X0Y0Z0,X1Y0Z0,X0Y1Z0,X1Y1Z0, + & X0Y0Z1,X1Y0Z1,X0Y1Z1,X1Y1Z1 +c +c + common/skelbdrycondparams3d/ + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + integer + & FLOW,XFLOW,YFLOW,ZFLOW, + & REFLECT,XREFLECT,YREFLECT,ZREFLECT, + & DIRICHLET,XDIRICHLET,YDIRICHLET,ZDIRICHLET, + & NEUMANN,XNEUMANN,YNEUMANN,ZNEUMANN + + FLOW=FLOWin + XFLOW=XFLOWin + YFLOW=YFLOWin + ZFLOW=ZFLOWin + + REFLECT=REFLECTin + XREFLECT=XREFLECTin + YREFLECT=YREFLECTin + ZREFLECT=ZREFLECTin + + DIRICHLET=DIRICHLETin + XDIRICHLET=XDIRICHLETin + YDIRICHLET=YDIRICHLETin + ZDIRICHLET=ZDIRICHLETin + + NEUMANN=NEUMANNin + XNEUMANN=XNEUMANNin + YNEUMANN=YNEUMANNin + ZNEUMANN=ZNEUMANNin + + return + end diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum2d.m4 b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum2d.m4 new file mode 100644 index 00000000..13c88cdd --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum2d.m4 @@ -0,0 +1,88 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for updating 2d flux sums from fluxes. +c +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim2d.i)dnl +c +c*********************************************************************** +c Add flux integrals to fluxsums +c*********************************************************************** +c +define(upfluxsumface_case_2d,`dnl + subroutine upfluxsumface2d$1( + & ilo0,ilo1,ihi0,ihi1, + & flxgc0,flxgc1, + & iface, + & flux,fluxsum) +c*********************************************************************** + implicit none +c + integer + & ilo0,ilo1,ihi0,ihi1, + & flxgc0,flxgc1, + & iface + REAL + & flux(FACE2d$1VECG(ilo,ihi,flxgc)), + & fluxsum(OUTERFACE2d$1(ilo,ihi,0)) + integer ie$1,ic$2 +c +c*********************************************************************** +c + if (iface.eq.0) then + ie$1 = ilo$1 + else + ie$1 = ihi$1+1 + endif + + do ic$2=ilo$2,ihi$2 + fluxsum(ic$2)=fluxsum(ic$2)+flux(ie$1,ic$2) + enddo +c + return + end +')dnl +define(upfluxsumside_case_2d,`dnl + subroutine upfluxsumside2d$1( + & ilo0,ilo1,ihi0,ihi1, + & flxgc0,flxgc1, + & iface, + & flux,fluxsum) +c*********************************************************************** + implicit none +c + integer + & ilo0,ilo1,ihi0,ihi1, + & flxgc0,flxgc1, + & iface + REAL + & flux(SIDE2d$1VECG(ilo,ihi,flxgc)), + & fluxsum(OUTERSIDE2d$1(ilo,ihi,0)) + integer ic$1,ic$2 +c +c*********************************************************************** +c + if (iface.eq.0) then + ic$1 = ilo$1 + else + ic$1 = ihi$1+1 + endif + + do ic$2=ilo$2,ihi$2 + fluxsum(ic$2)=fluxsum(ic$2)+flux(ic0,ic1) + enddo +c + return + end +')dnl +upfluxsumface_case_2d(0,1)dnl +c +upfluxsumface_case_2d(1,0)dnl +c +upfluxsumside_case_2d(0,1)dnl +c +upfluxsumside_case_2d(1,0)dnl +c diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum3d.m4 b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum3d.m4 new file mode 100644 index 00000000..badfbc3c --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/fortran/upfluxsum3d.m4 @@ -0,0 +1,97 @@ +c +c This file is part of the SAMRAI distribution. For full copyright +c information, see COPYRIGHT and COPYING.LESSER. +c +c Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +c Description: F77 routines for updating 3d flux sums from fluxes. +c +define(REAL,`double precision')dnl +include(PDAT_FORTDIR/pdat_m4arrdim3d.i)dnl +c +c*********************************************************************** +c Add flux integrals to fluxsums +c*********************************************************************** +c +define(upfluxsumface_case_3d,`dnl + subroutine upfluxsumface3d$1( + & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, + & flxgc0,flxgc1,flxgc2, + & iface, + & flux,fluxsum) +c*********************************************************************** + implicit none +c + integer + & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, + & flxgc0,flxgc1,flxgc2, + & iface + REAL + & flux(FACE3d$1VECG(ilo,ihi,flxgc)), + & fluxsum(OUTERFACE3d$1(ilo,ihi,0)) + integer ie$1,ic$2,ic$3 +c +c*********************************************************************** +c + if (iface.eq.0) then + ie$1 = ilo$1 + else + ie$1 = ihi$1+1 + endif + + do ic$3=ilo$3,ihi$3 + do ic$2=ilo$2,ihi$2 + fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ie$1,ic$2,ic$3) + enddo + enddo +c + return + end +')dnl +c +c +define(upfluxsumside_case_3d,`dnl + subroutine upfluxsumside3d$1( + & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, + & flxgc0,flxgc1,flxgc2, + & iside, + & flux,fluxsum) +c*********************************************************************** + implicit none +c + integer + & ilo0,ilo1,ilo2,ihi0,ihi1,ihi2, + & flxgc0,flxgc1,flxgc2, + & iside + REAL + & flux(SIDE3d$1VECG(ilo,ihi,flxgc)), + & fluxsum(OUTERSIDE3d$1(ilo,ihi,0)) + integer ic$1,ic$2,ic$3 +c +c*********************************************************************** +c + if (iside.eq.0) then + ic$1 = ilo$1 + else + ic$1 = ihi$1+1 + endif + + do ic$3=ilo$3,ihi$3 + do ic$2=ilo$2,ihi$2 + fluxsum(ic$2,ic$3)=fluxsum(ic$2,ic$3)+flux(ic0,ic1,ic2) + enddo + enddo +c + return + end +')dnl +upfluxsumface_case_3d(0,1,2)dnl +c +upfluxsumface_case_3d(1,2,0)dnl +c +upfluxsumface_case_3d(2,0,1)dnl +c +upfluxsumside_case_3d(0,1,2)dnl +c +upfluxsumside_case_3d(1,0,2)dnl +c +upfluxsumside_case_3d(2,0,1)dnl diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.C b/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.C new file mode 100644 index 00000000..c1900197 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.C @@ -0,0 +1,41 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for getting input file name. + * + ************************************************************************/ +#include "SAMRAI/SAMRAI_config.h" +#include + +#include "test/testlib/get-input-filename.h" + +int get_input_filename( + int* argc, + char* argv[], + std::string& input_filename) { + + int rval = 0; + std::string argv0(argv[0]); + if (*argc > 1) { + // Input file is the first argument. Shift other arguments down. + input_filename = argv[1]; + --(*argc); + int i; + for (i = 1; i < (*argc); ++i) { + argv[i] = argv[i + 1]; + } + } else if (*argc == 1 && argv0.rfind("check-") < argv0.size()) { + /* + * No argument but input file is implicit in program name + * which has the form check-. + */ + input_filename = argv0.substr(argv0.rfind("check-") + 6) + ".input"; + } else if (*argc == 1) { + // No argument and not invoked as "check-blah". + rval = 1; + } + return rval; +} diff --git a/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.h b/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.h new file mode 100644 index 00000000..815a3ac2 --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/testlib/get-input-filename.h @@ -0,0 +1,30 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: Utility for getting input file name. + * + ************************************************************************/ +#include + +/*! + * This function gets the input file name from the argument list. + * For most cases, this is simply the first + * command-line argument (after the program name). + * The variable @c input_filename is set to the filename, + * and all arguments following it are shifed down one. + * Unless you are a developer, this is all you need to know. + * + * For the special case with no command-line argument, + * if the program is invoked with the name "check-blah", + * it assumes the input file is "blah.input". + * The purpose of this setup is so that it is compatible with + * the automake make-check mechanism, which runs programs without + * arguments. At the same time, an input file can be manually + * specified for operational flexibility. + * + * @return 0 if filename is found, 1 otherwise. + */ +int get_input_filename(int* argc, char* argv[], std::string & input_filename); diff --git a/base/SAMRAI/SAMRAI/source/test/testtools/testcount.sh b/base/SAMRAI/SAMRAI/source/test/testtools/testcount.sh index ffb97483..565eed4d 100755 --- a/base/SAMRAI/SAMRAI/source/test/testtools/testcount.sh +++ b/base/SAMRAI/SAMRAI/source/test/testtools/testcount.sh @@ -4,14 +4,15 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: script for testing the number of tests passed ## ######################################################################### num_tests=`echo $1 | sed -e 's/,/ /g' | wc -w` num_tests=`expr $num_tests \* $2` -num_passed=`grep PASSED $3 | wc -l` +num_tests=`expr $num_tests \+ $3` +num_passed=`grep PASSED $4 | wc -l` if test $num_tests -ne $num_passed; then echo "FAILED: Count of passed tests in directory " `pwd` " passed was $num_passed expected $num_tests" fi diff --git a/base/SAMRAI/SAMRAI/source/test/timers/Foo.C b/base/SAMRAI/SAMRAI/source/test/timers/Foo.C index 24cedf34..aa899d89 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/Foo.C +++ b/base/SAMRAI/SAMRAI/source/test/timers/Foo.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Routine to time some routines in the dummy class Foo. * ************************************************************************/ @@ -12,8 +12,7 @@ #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/Utilities.h" - -#include +#include "boost/shared_ptr.hpp" #define LOOP_MAX (10000000) @@ -30,7 +29,7 @@ Foo::~Foo() void Foo::timerOff() { boost::shared_ptr timer(tbox::TimerManager::getManager()-> - getTimer("dummy::SomeClassName::shouldBeTurnedOff")); + getTimer("dummy::SomeClassName::shouldBeTurnedOff")); timer->start(); timer->stop(); @@ -162,7 +161,7 @@ void Foo::setMaxDepth( void Foo::start( std::string& name) { - d_depth++; + ++d_depth; boost::shared_ptr timer( tbox::TimerManager::getManager()->getTimer(name)); diff --git a/base/SAMRAI/SAMRAI/source/test/timers/Foo.h b/base/SAMRAI/SAMRAI/source/test/timers/Foo.h index d5f91f1f..539f520b 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/Foo.h +++ b/base/SAMRAI/SAMRAI/source/test/timers/Foo.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Simple example to demonstrate input/restart of patch data. * ************************************************************************/ diff --git a/base/SAMRAI/SAMRAI/source/test/timers/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/timers/Makefile.depend index 7f726c59..9a7be239 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/timers/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -14,7 +14,6 @@ FILE_0=Foo.o DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -23,7 +22,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/IOStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ @@ -31,17 +29,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Foo.C Foo.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main_example.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -53,7 +49,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -62,17 +57,15 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main_example.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} +${FILE_1}: ${DEPENDS_1} FILE_2=main_stats.o DEPENDS_2:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ $(INCLUDE_SAM)/SAMRAI/tbox/DatabaseBox.h \ @@ -83,7 +76,6 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -93,18 +85,15 @@ DEPENDS_2:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Statistician.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main_stats.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_2 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_2:X.o=${NDIM}.o}: ${DEPENDS_2} + +${FILE_2}: ${DEPENDS_2} FILE_3=main_timer.o DEPENDS_3:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -117,7 +106,6 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/Logger.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryDatabase.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/RestartManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ @@ -127,10 +115,9 @@ DEPENDS_3:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h Foo.h main_timer.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_3 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C -endif + + -${FILE_3:X.o=${NDIM}.o}: ${DEPENDS_3} +${FILE_3}: ${DEPENDS_3} diff --git a/base/SAMRAI/SAMRAI/source/test/timers/Makefile.in b/base/SAMRAI/SAMRAI/source/test/timers/Makefile.in index af3b831f..9561688d 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/timers/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for timer and statistician test programs ## ######################################################################### @@ -14,6 +14,7 @@ SUBDIR = source/test/timers VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -36,16 +37,30 @@ example: main_example.o $(LIBSAMRAIDEPEND) NUM_TESTS = 3 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: timertest statstest example check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./timertest test_inputs/test.input; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./timertest test_inputs/test.input restart 0; \ - $(OBJECT)/config/serpa-run $(TEST_NPROCS) \ - ./statstest + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./timertest test_inputs/test.input | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./timertest test_inputs/test.input restart 0 | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./statstest | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -54,15 +69,27 @@ check3d: $(MAKE) check checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile +examples: -clean: - $(SAMCLEAN) - $(RM) timertest statstest timermaxtest - $(RM) -rf *.log.* stats +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + $(RM) *.txt restart + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) timertest statstest example include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/timers/README b/base/SAMRAI/SAMRAI/source/test/timers/README index 0bb3a7a7..37b0930a 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/README +++ b/base/SAMRAI/SAMRAI/source/test/timers/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for timer tests. ## ######################################################################### @@ -11,70 +11,95 @@ This test case tests the functionality of the timer and statistician classes in SAMRAI. -Compilation: - make - make timertest (generates timer_test) - make statstest (generates stats_test) - -Execution: - serial - ./timer_test input.file - serial (restarted) - ./timer_test input.file restart 0 1 - parallel - mpirun -np [necessary options] [above serial cmd] - - The necessary options are those required by MPI to run the - executable. For example, on the CASC Sun Cluster, one needs - to specify the machines that will run the MPI processes in - a file and use the -machinefile option. - -timer_test: (What it does) - - This test will measure the time per call to invoke timers in your code. - To run, set the following two variables in the input file: - ntimes - number of times timer is called - exclusive_tree_depth - depth of exclusive timers - - Run #1: Run #2: - print_exclusive = FALSE = TRUE - print_concurrent = FALSE = TRUE - Output to log file will show wallclock time for the calls. Time per call - is computed as follows: - - unregistered timer = wall time for apps::main::timer_off/ntimes - registered timer = Run #1: wall time for apps:main:timer_on/ntimes - exclusive timer = Run #2: wall time for apps::main:exclusive_timer/ - (ntimes*exclusive_tree_depth) - - The following are results measured on some systems we support, - with ntimes = 1000, exclusive_timer_depth = 5. - - ------------------------------------------------------------------ - Sun Ultra 10 Workstation - (debug, KCC) - EXCLUSIVE OFF EXCLUSIVE ON - unregistered timer 4.30e-7 sec/call 3.80e-7 sec/call - registered timer 1.09e-5 sec/call 1.58e-5 sec/call - exclusive timer 1.10e-5 sec/call 3.54e-5 sec/call - - ------------------------------------------------------------------ - DEC Alpha (Compass cluster) - (optimized, KCC) - EXCLUSIVE OFF EXCLUSIVE ON - unregistered timer 0 sec/call 0 sec/call - registered timer 2.34e-5 sec/call 4.10e-5 sec/call - exclusive timer 2.38e-5 sec/call 7.01e-5 sec/call - - ------------------------------------------------------------------ - IBM SP (ASCI Blue Pacific) - (optimized, mpKCC) - EXCLUSIVE OFF EXCLUSIVE ON - unregistered timer 5.00e-7 sec/call 3.70e-7 sec/call - registered timer 1.40e-5 sec/call 3.90e-5 sec/call - exclusive timer 4.00e-5 sec/call 4.02e-5 sec/call - -stats_test: - Mimics an actual time dependent integration loop by building a - statistician object that records current simulation time and some - dummy integer value (e.g. could be gridpoints). Outputs this to - log file at the end. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make checkcompile + Execution: + serial: + ./statstest + ./timertest test_inputs/test.input + parallel: + Parallel execution is platform dependent. These examples demonstrate + execution via mpirun. + mpirun -np [mpirun options] ./statstest + mpirun -np [mpirun options] ./timertest test_inputs/test.input + Restarted Run: + + same format as regular run but add + to end of command. + is directory where restart files are stored + (set in input file). + is the identifier of which restart file to use + (generally the timestep). + + example: (to start from timestep #0) + + ./timertest test_inputs/test.input restart 0 + mpirun -np ./timertest [mpirun options] test_inputs/test.input restart 0 + + NOTE: The ordinary use of our restart functionality requires that + a problem can only be restarted on on the same number of + processors on which the problem was originally run. To restart + on a different number of processors, use the + restart-redistribute tool in SAMRAI/tools/restart. + +timertest (What it does) +------------------------ + This test will measure the time per call to invoke timers in your code. + To run, set the following two variables in the input file: + ntimes - number of times timer is called + exclusive_tree_depth - depth of exclusive timers + + Run #1: Run #2: + print_exclusive = FALSE = TRUE + print_concurrent = FALSE = TRUE + Output to log file will show wallclock time for the calls. Time per call + is computed as follows: + + unregistered timer = wall time for apps::main::timer_off/ntimes + registered timer = Run #1: wall time for apps:main:timer_on/ntimes + exclusive timer = Run #2: wall time for apps::main:exclusive_timer/ + (ntimes*exclusive_tree_depth) + + The following are results measured on some systems we support, + with ntimes = 1000, exclusive_timer_depth = 5. + + ------------------------------------------------------------------ + Sun Ultra 10 Workstation + (debug, KCC) + EXCLUSIVE OFF EXCLUSIVE ON + unregistered timer 4.30e-7 sec/call 3.80e-7 sec/call + registered timer 1.09e-5 sec/call 1.58e-5 sec/call + exclusive timer 1.10e-5 sec/call 3.54e-5 sec/call + + ------------------------------------------------------------------ + DEC Alpha (Compass cluster) + (optimized, KCC) + EXCLUSIVE OFF EXCLUSIVE ON + unregistered timer 0 sec/call 0 sec/call + registered timer 2.34e-5 sec/call 4.10e-5 sec/call + exclusive timer 2.38e-5 sec/call 7.01e-5 sec/call + + ------------------------------------------------------------------ + IBM SP (ASCI Blue Pacific) + (optimized, mpKCC) + EXCLUSIVE OFF EXCLUSIVE ON + unregistered timer 5.00e-7 sec/call 3.70e-7 sec/call + registered timer 1.40e-5 sec/call 3.90e-5 sec/call + exclusive timer 4.00e-5 sec/call 4.02e-5 sec/call + +statstest (What it does) +------------------------ + Mimics an actual time dependent integration loop by building a + statistician object that records current simulation time and some + dummy integer value (e.g. could be gridpoints). Outputs this to + log file at the end. + + +INPUTS: +------------ + +See test_inputs/test.input for documentation of input options for timertest. diff --git a/base/SAMRAI/SAMRAI/source/test/timers/README.example b/base/SAMRAI/SAMRAI/source/test/timers/README.example deleted file mode 100644 index c3e24c49..00000000 --- a/base/SAMRAI/SAMRAI/source/test/timers/README.example +++ /dev/null @@ -1,74 +0,0 @@ -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Timer example -## -######################################################################### - -This example demonstrates use of timers in a SAMRAI application. -The files included in this directory are as follows: - - main.C - example main program - default.input - input file - -COMPILE and RUN ---------------- -Compile: make -Run: timers default.input - - -INPUTS: ------------- - - The only component requiring input is the TimerManager. The input - options for the TimerManager are discussed below. The TYPE is - shown in (parenthesis) and the DEFAULT setting (value set if no input - is given) for the option is shown in [brackets]. Required inputs are - designated by [REQD]. - - TimerManager{ - // Specify which timers to invoke - // timer_list -- (string array) list of timers to be turned on - for - // complete list of available timers, see - // SAMRAI/docs/userdocs/timing.pdf [null] - timer_list = "apps::main::*", - "apps::Foo::someMethodName()", - "algs::*::*" - - // Various output options. - // print_total -- (bool) print total time [TRUE] - // print_exclusive -- (bool) output exclusive time - i.e. time spent - // exclusively in each routine. A nice way to - // identify routines with bottlenecks, but is more - // expensive than recording total time [FALSE]. - // print_wall -- (bool) output wallclock time [TRUE] - // print_user -- (bool) output user time [FALSE] - // print_sys -- (bool) output system time [FALSE] - // print_summed -- (bool) output sum of times measured across all - // processors during a parallel run [FALSE]. - // print_max -- (bool) output maximum time spent on any one - // processor, along with the processor ID [FALSE] - // print_percentage -- (bool) output percentage of total time for each - // printed timer [TRUE] - // print_concurrent -- (bool) in the process of performing exclusive - // time, a nested call tree is created; print the - // tree [FALSE] - // print_timer_overhead -- (bool) each timer start/stop invocation - // incurs about one-half a millionth of a second - // overhead. This option will output the number of - // invocations and the total predicted overhead for - // all the timers [FALSE] - // print_threshold -- (double) do not print any timers that constitute - // < (print_threshold)% of overall run time. Useful - // to prevent gobs of output if many timers are - // turned on. [0.25] - print_exclusive = TRUE - print_max = TRUE - print_timer_overhead = TRUE - print_threshold = 0.0 - } - - diff --git a/base/SAMRAI/SAMRAI/source/test/timers/example_inputs/example.input b/base/SAMRAI/SAMRAI/source/test/timers/example_inputs/example.input deleted file mode 100644 index 3ea4e8b8..00000000 --- a/base/SAMRAI/SAMRAI/source/test/timers/example_inputs/example.input +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************************************* - * - * This file is part of the SAMRAI distribution. For full copyright - * information, see COPYRIGHT and COPYING.LESSER. - * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC - * Description: $Description - * - ************************************************************************/ - -TimerManager{ - - timer_list = "apps::main::*" - - print_exclusive = TRUE - print_user = TRUE - print_sys = TRUE - print_summed = TRUE - print_max = TRUE - print_concurrent = TRUE - print_timer_overhead = TRUE - print_threshold = 0.0 - - track_memory_use = TRUE - -} diff --git a/base/SAMRAI/SAMRAI/source/test/timers/main_example.C b/base/SAMRAI/SAMRAI/source/test/timers/main_example.C index f97f80d3..add9aefb 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/main_example.C +++ b/base/SAMRAI/SAMRAI/source/test/timers/main_example.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Example program to demonstrate timers. * ************************************************************************/ @@ -22,7 +22,7 @@ using namespace std; #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" -#include +#include "boost/shared_ptr.hpp" using namespace SAMRAI; diff --git a/base/SAMRAI/SAMRAI/source/test/timers/main_stats.C b/base/SAMRAI/SAMRAI/source/test/timers/main_stats.C index ab297162..b6a4f1a3 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/main_stats.C +++ b/base/SAMRAI/SAMRAI/source/test/timers/main_stats.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test statistics operations * ************************************************************************/ @@ -23,7 +23,7 @@ #include "SAMRAI/tbox/Utilities.h" #include "SAMRAI/tbox/MathUtilities.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -130,7 +130,7 @@ int main( * is the tbox::MPI process rank. */ double factor = myrank + 1; - for (ips = 0; ips < 3; ips++) { + for (ips = 0; ips < 3; ++ips) { procstat1->recordProcStat(factor * ips); } @@ -140,7 +140,7 @@ int main( * is the tbox::MPI process rank. */ factor = myrank + 2; - for (ips = 0; ips < 1; ips++) { + for (ips = 0; ips < 1; ++ips) { procstat2->recordProcStat(factor * (ips + 1)); } @@ -150,8 +150,8 @@ int main( * item of the patches will be (patch id*2 + seq #), where the patch * id's on each processor are myrank*2 and myrank*2+1. */ - for (ips = 0; ips < 2; ips++) { - for (i = myrank * 2; i <= myrank * 2 + 1; i++) { + for (ips = 0; ips < 2; ++ips) { + for (i = myrank * 2; i <= myrank * 2 + 1; ++i) { patchstat1->recordPatchStat(i, // patch number i * 2 + ips, // data value ips); // seq number @@ -166,13 +166,13 @@ int main( * value, etc.). The value for each patch will be twice the patch * number plus the sequence number. */ - for (ips = 0; ips < 2; ips++) { + for (ips = 0; ips < 2; ++ips) { int patch_start_num = 0; - for (i = 0; i < myrank; i++) { + for (i = 0; i < myrank; ++i) { patch_start_num += i + 2; } int num_patches = myrank + 2; - for (i = patch_start_num; i < patch_start_num + num_patches; i++) { + for (i = patch_start_num; i < patch_start_num + num_patches; ++i) { patchstat2->recordPatchStat(i, // patch number 2.0 * i + ips, // data value ips); // sequence number @@ -182,7 +182,7 @@ int main( // Test #1: int tval = statistician->getNumberProcessorStats(); if (tval != 3) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1a: tbox::Statistician::getNumberProcessorStats()\n" << "incorrect number of processor statistics found" << endl; @@ -191,7 +191,7 @@ int main( } tval = statistician->getNumberPatchStats(); if (tval != 3) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1b: tbox::Statistician::getNumberPatchStats()\n" << "incorrect number of patch statistics found" << endl; @@ -202,14 +202,14 @@ int main( // Test #2: boost::shared_ptr tstat; if (!statistician->checkStatisticExists(tstat, "procstat2")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2a: tbox::Statistician::checkStatisticExists()\n" << "procstat2 added to statistician, but not found" << endl; } else { tbox::plog << "Test #2a successful" << endl; if (tstat->getName() != "procstat2") { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2b: tbox::Statistician::checkStatisticExists()\n" << "name of procstat2 does not match statistician entry" @@ -220,7 +220,7 @@ int main( } if (!statistician->checkStatisticExists(tstat, "patchstat1")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2c: tbox::Statistician::checkStatisticExists()\n" << "patchstat1 added to statistician, but not found" @@ -228,7 +228,7 @@ int main( } else { tbox::plog << "Test #2c successful" << endl; if (tstat->getName() != "patchstat1") { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2d: tbox::Statistician::checkStatisticExists()\n" << "name of patchstat1 does not match statistician entry" << endl; @@ -238,7 +238,7 @@ int main( } if (statistician->checkStatisticExists(tstat, "dummy")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2e: tbox::Statistician::checkStatisticExists()\n" << "wrongly found statistic named dummy in statistician" @@ -251,7 +251,7 @@ int main( // Test #3: if (statistician->getProcStatId(procstat1->getName()) != procstat1->getInstanceId()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3a: tbox::Statistician::getProcStatId()\n" << "procstat1 has wrong instance id in statistician" @@ -261,7 +261,7 @@ int main( } if (statistician->getPatchStatId(patchstat2->getName()) != patchstat2->getInstanceId()) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3b: tbox::Statistician::getPatchStatId()\n" << "patchstat2 has wrong instance id in statistician" @@ -270,7 +270,7 @@ int main( tbox::plog << "Test #3b successful" << endl; } if (statistician->getProcStatId(patchstat1->getName()) != -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3c: tbox::Statistician::getProcStatId()\n" << "patchstat1 is not a processor statistic" << endl; @@ -278,7 +278,7 @@ int main( tbox::plog << "Test #3c successful" << endl; } if (statistician->getPatchStatId(procstat2->getName()) != -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3d: tbox::Statistician::getPatchStatId()\n" << "procstat2 is not a patch statistic" << endl; @@ -288,14 +288,14 @@ int main( // Test #4: if (procstat1->getType() != "PROC_STAT") { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4a: tbox::Statistic::getType()\n" << "procstat1 returns incorrect type" << endl; } else { tbox::plog << "Test #4a successful" << endl; } if (patchstat1->getType() != "PATCH_STAT") { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4b: tbox::Statistic::getType()\n" << "patchstat1 returns incorrect type" << endl; } else { @@ -313,7 +313,7 @@ int main( procstat2_seqlen = 1; } if (procstat1->getStatSequenceLength() != procstat1_seqlen) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5a: tbox::Statistic::getStatSequenceLength()\n" << "procstat1 returns incorrect sequence length" << endl; @@ -321,7 +321,7 @@ int main( tbox::plog << "Test #5a successful" << endl; } if (procstat2->getStatSequenceLength() != procstat2_seqlen) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5b: tbox::Statistic::getStatSequenceLength()\n" << "procstat2 returns incorrect sequence length" << endl; @@ -329,7 +329,7 @@ int main( tbox::plog << "Test #5b successful" << endl; } if (patchstat1->getStatSequenceLength() != 2) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5c: tbox::Statistic::getStatSequenceLength()\n" << "patchstat1 returns incorrect sequence length" << endl; @@ -337,7 +337,7 @@ int main( tbox::plog << "Test #5c successful" << endl; } if (patchstat2->getStatSequenceLength() != 2) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5d: tbox::Statistic::getStatSequenceLength()\n" << "patchstat2 returns incorrect sequence length" << endl; @@ -347,15 +347,15 @@ int main( statistician->printLocalStatData(tbox::plog); - statistician->finalize(); + statistician->finalize(true); statistician->printAllGlobalStatData(tbox::plog); - statistician->finalize(); + statistician->finalize(true); statistician->printSpreadSheetOutput(); - statistician->finalize(); + statistician->finalize(true); if (mpi.getRank() == 0) { @@ -363,7 +363,7 @@ int main( if (statistician-> getGlobalProcStatSequenceLength(procstat1->getInstanceId()) != procstat1_seqlen) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6a: " << "Statistician::getGlobalProcStatSequenceLength()\n" << "incorrect sequence length returned for procstat1" @@ -375,7 +375,7 @@ int main( if (statistician-> getGlobalProcStatSequenceLength(procstat2->getInstanceId()) != procstat2_seqlen) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6b: " << "Statistician::getGlobalProcStatSequenceLength()\n" << "incorrect sequence length returned for procstat2" @@ -384,11 +384,11 @@ int main( tbox::plog << "Test #6b successful" << endl; } - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatValue(procstat1->getInstanceId(), 2, i), (i + 1) * 2)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6c: " << "Statistician::getGlobalProcStatValue()\n" << "incorrect global data returned for procstat1" @@ -397,11 +397,11 @@ int main( tbox::plog << "Test #6c successful" << endl; } } - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatValue(procstat2->getInstanceId(), 0, i), i + 2)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6d: " << "Statistician::getGlobalProcStatValue()\n" << "incorrect global data returned for procstat2" @@ -414,7 +414,7 @@ int main( // Test #7: if (statistician-> getGlobalPatchStatSequenceLength(patchstat1->getInstanceId()) != 2) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7a: " << "Statistician::getGlobalPatchStatSequenceLength()\n" << "incorrect sequence length returned for patchstat1" @@ -426,7 +426,7 @@ int main( int num_patches = mpi.getSize() * 2; if (statistician->getGlobalPatchStatNumberPatches( patchstat1->getInstanceId(), 0) != num_patches) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7b: " << "Statistician::getGlobalPatchStatNumberPatches()\n" << "incorrect num patches returned for patchstat1" @@ -435,16 +435,16 @@ int main( tbox::plog << "Test #7b successful" << endl; } - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { int pnum = 0; - for (j = 0; j < 1; j++) { + for (j = 0; j < 1; ++j) { pnum = i * 2 + j; } if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatValue( patchstat1->getInstanceId(), 1, pnum), pnum * 2 + 1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7e: " << "Statistician::getGlobalPatchStatValue()\n" << "incorrect global data returned for patch " @@ -457,12 +457,12 @@ int main( } num_patches = 0; - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { num_patches += i + 2; } if (statistician->getGlobalPatchStatNumberPatches( patchstat2->getInstanceId(), 0) != num_patches) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7c: " << "Statistician::getGlobalPatchStatNumberPatches()\n" << "incorrect num patches returned for patchstat2" @@ -471,14 +471,14 @@ int main( tbox::plog << "Test #7c successful" << endl; } - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { int pnum = 0; - for (j = 0; j < i; j++) { + for (j = 0; j < i; ++j) { pnum += j + 2; } if (statistician->getGlobalPatchStatPatchMapping( patchstat2->getInstanceId(), 1, pnum) != i) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7d: " << "Statistician::getGlobalPatchStatPatchMapping()\n" << "incorrect mapping for patch " << pnum << "in " @@ -489,15 +489,15 @@ int main( } - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { int pnum = 0; - for (j = 0; j < i; j++) { + for (j = 0; j < i; ++j) { pnum += j + 2; } if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatValue( patchstat2->getInstanceId(), 1, pnum), pnum * 2 + 1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7f: " << "Statistician::getGlobalPatchStatValue()\n" << "incorrect global data returned for patch " @@ -514,14 +514,14 @@ int main( double sum1 = 0.; double sum2 = 0.; - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { sum1 += (double)i + 1; sum2 += (double)2 * (i + 1); } if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatSum( procstat1->getInstanceId(), 0), sum0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8a: " << "Statistician::getGlobalProcStatSum()\n" << "incorrect value returned." << endl; @@ -531,7 +531,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatSum( procstat1->getInstanceId(), 1), sum1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8b: " << "Statistician::getGlobalProcStatSum()\n" << "incorrect value returned." << endl; @@ -541,7 +541,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatSum( procstat1->getInstanceId(), 2), sum2)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8c: " << "Statistician::getGlobalProcStatSum()\n" << "incorrect value returned." << endl; @@ -555,7 +555,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMax( procstat1->getInstanceId(), 0), max0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8d: " << "Statistician::getGlobalProcStatMax()\n" << "incorrect value returned." << endl; @@ -565,7 +565,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMax( procstat1->getInstanceId(), 1), max1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8e: " << "Statistician::getGlobalProcStatMax()\n" << "incorrect value returned." << endl; @@ -575,7 +575,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMax( procstat1->getInstanceId(), 2), max2)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8f: " << "Statistician::getGlobalProcStatMax()\n" << "incorrect value returned." << endl; @@ -585,7 +585,7 @@ int main( if (statistician->getGlobalProcStatMaxProcessorId( procstat1->getInstanceId(), 1) != mpi.getSize() - 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8g: " << "Statistician::getGlobalProcStatMaxId()\n" << "returned incorrect ID." << endl; @@ -595,7 +595,7 @@ int main( if (statistician->getGlobalProcStatMaxProcessorId( procstat1->getInstanceId(), 2) != mpi.getSize() - 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8h: " << "Statistician::getGlobalProcStatMaxId()\n" << "returned incorrect ID." << endl; @@ -609,7 +609,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMin( procstat1->getInstanceId(), 0), min0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8i: " << "Statistician::getGlobalProcStatMin()\n" << "incorrect value returned." << endl; @@ -619,7 +619,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMin( procstat1->getInstanceId(), 1), min1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8j: " << "Statistician::getGlobalProcStatMin()\n" << "incorrect value returned." << endl; @@ -629,7 +629,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalProcStatMin( procstat1->getInstanceId(), 2), min2)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8k: " << "Statistician::getGlobalProcStatMin()\n" << "incorrect value returned." << endl; @@ -641,7 +641,7 @@ int main( procstat1->getInstanceId(), 1) != 0) { tbox::pout << statistician->getGlobalProcStatMinProcessorId( procstat1->getInstanceId(), 1) << endl; - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8l: " << "Statistician::getGlobalProcStatMinProcessorId()\n" << "incorrect value returned." << endl; @@ -652,7 +652,7 @@ int main( procstat1->getInstanceId(), 2) != 0) { tbox::pout << statistician->getGlobalProcStatMinProcessorId( procstat1->getInstanceId(), 2) << endl; - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8m: " << "Statistician::getGlobalProcStatMinProcessorId()\n" << "incorrect value returned." << endl; @@ -664,8 +664,8 @@ int main( int pnum = 0; sum0 = 0.; sum1 = 0.; - for (i = 0; i < mpi.getSize(); i++) { - for (j = 0; j < i + 2; j++) { + for (i = 0; i < mpi.getSize(); ++i) { + for (j = 0; j < i + 2; ++j) { sum0 += (double)pnum * 2; sum1 += (double)(pnum * 2 + 1); pnum += 1; @@ -675,7 +675,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatSum( patchstat2->getInstanceId(), 0), sum0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9a: " << "Statistician::getGlobalPatchStatSum()\n" << "incorrect value returned." << endl; @@ -686,7 +686,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatSum( patchstat2->getInstanceId(), 1), sum1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9b: " << "Statistician::getGlobalPatchStatSum()\n" << "incorrect value returned." << endl; @@ -697,8 +697,8 @@ int main( max0 = 0.; max1 = 0.; pnum = -1; - for (i = 0; i < mpi.getSize(); i++) { - for (j = 0; j < i + 2; j++) { + for (i = 0; i < mpi.getSize(); ++i) { + for (j = 0; j < i + 2; ++j) { pnum += 1; } } @@ -708,7 +708,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatMax( patchstat2->getInstanceId(), 0), max0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9c: " << "Statistician::getGlobalPatchStatMax()\n" << "incorrect value returned." << endl; @@ -719,7 +719,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatMax( patchstat2->getInstanceId(), 1), max1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9d: " << "Statistician::getGlobalPatchStatMax()\n" << "incorrect value returned." << endl; @@ -729,7 +729,7 @@ int main( if (statistician->getGlobalPatchStatMaxPatchId( patchstat2->getInstanceId(), 0) != pnum) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9e: " << "Statistician::getGlobalPatchStatMaxPatchId()\n" << "incorrect value returned." << endl; @@ -739,7 +739,7 @@ int main( if (statistician->getGlobalPatchStatMaxPatchId( patchstat2->getInstanceId(), 1) != pnum) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9f: " << "Statistician::getGlobalPatchStatMaxPatchId()\n" << "incorrect value returned." << endl; @@ -752,7 +752,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatMin( patchstat2->getInstanceId(), 0), min0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9g: " << "Statistician::getGlobalPatchStatMin()\n" << "incorrect value returned." << endl; @@ -762,7 +762,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatMin( patchstat2->getInstanceId(), 1), min1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9h: " << "Statistician::getGlobalPatchStatMin()\n" << "incorrect value returned." << endl; @@ -772,7 +772,7 @@ int main( if (statistician->getGlobalPatchStatMinPatchId( patchstat2->getInstanceId(), 0) != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9i: " << "Statistician::getGlobalPatchStatMinPatchId()\n" << "incorrect value returned." << endl; @@ -781,7 +781,7 @@ int main( } if (statistician->getGlobalPatchStatMinPatchId( patchstat2->getInstanceId(), 1) != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9j: " << "Statistician::getGlobalPatchStatMinPatchId()\n" << "incorrect value returned." << endl; @@ -791,10 +791,10 @@ int main( // Test #10: pnum = 0; - for (i = 0; i < mpi.getSize(); i++) { + for (i = 0; i < mpi.getSize(); ++i) { max0 = 0.; max1 = 0.; - for (j = 0; j < i + 2; j++) { + for (j = 0; j < i + 2; ++j) { max0 += (double)pnum * 2; max1 += (double)(pnum * 2 + 1); pnum += 1; @@ -802,7 +802,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSum( patchstat2->getInstanceId(), i, 0), max0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10a: " << "Statistician::getGlobalPatchStatProcessorSum()\n" << "incorrect value returned." << endl; @@ -812,7 +812,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSum( patchstat2->getInstanceId(), i, 1), max1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10b: " << "Statistician::getGlobalPatchStatProcessorSum()\n" << "incorrect value returned." << endl; @@ -824,7 +824,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSumMax( patchstat2->getInstanceId(), 0), max0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10c: " << "Statistician::getGlobalPatchStatProcessorSumMax()\n" << "incorrect value returned." << endl; @@ -834,7 +834,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSumMax( patchstat2->getInstanceId(), 1), max1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10d: " << "Statistician::getGlobalPatchStatProcessorSumMax()\n" << "incorrect value returned." << endl; @@ -845,7 +845,7 @@ int main( int nnodes = mpi.getSize(); if (statistician->getGlobalPatchStatProcessorSumMaxId( patchstat2->getInstanceId(), 0) != nnodes - 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10e: " << "Statistician::getGlobalPatchStatProcessorSumMaxId()\n" << "incorrect value returned." << endl; @@ -854,7 +854,7 @@ int main( } if (statistician->getGlobalPatchStatProcessorSumMaxId( patchstat2->getInstanceId(), 1) != nnodes - 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10f: " << "Statistician::getGlobalPatchStatProcessorSumMaxId()\n" << "incorrect value returned." << endl; @@ -867,7 +867,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSumMin( patchstat2->getInstanceId(), 0), min0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10g: " << "Statistician::getGlobalPatchStatProcessorSumMin()\n" << "incorrect value returned." << endl; @@ -877,7 +877,7 @@ int main( if (!tbox::MathUtilities::equalEps(statistician-> getGlobalPatchStatProcessorSumMin( patchstat2->getInstanceId(), 1), min1)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10h: " << "Statistician::getGlobalPatchStatProcessorSumMin()\n" << "incorrect value returned." << endl; @@ -887,7 +887,7 @@ int main( if (statistician->getGlobalPatchStatProcessorSumMinId( patchstat2->getInstanceId(), 0) != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10i: " << "Statistician::getGlobalPatchStatProcessorSumMinId()\n" << "incorrect value returned." << endl; @@ -896,7 +896,7 @@ int main( } if (statistician->getGlobalPatchStatProcessorSumMinId( patchstat2->getInstanceId(), 1) != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10j: " << "Statistician::getGlobalPatchStatProcessorSumMinId()\n" << "incorrect value returned." << endl; diff --git a/base/SAMRAI/SAMRAI/source/test/timers/main_timer.C b/base/SAMRAI/SAMRAI/source/test/timers/main_timer.C index b4c1a6e1..2d17dfa5 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/main_timer.C +++ b/base/SAMRAI/SAMRAI/source/test/timers/main_timer.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program to demonstrate/test timers. * ************************************************************************/ @@ -24,7 +24,7 @@ #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -52,7 +52,7 @@ public: void start() { - d_accesses++; + ++d_accesses; static struct timeval tp; gettimeofday(&tp, (struct timezone *)0); @@ -88,10 +88,6 @@ private: }; #endif -#ifndef NULL -#define NULL (0) -#endif - using namespace SAMRAI; int main( @@ -213,7 +209,7 @@ int main( boost::shared_ptr timer_off( tbox::TimerManager::getManager()->getTimer("apps::main::timer_off")); timer_off->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->timerOff(); } timer_off->stop(); @@ -228,7 +224,7 @@ int main( tbox::TimerManager::getManager()->getTimer("apps::Foo::timerOn()")); NULL_USE(dummy_timer); timer_on->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->timerOn(); } timer_on->stop(); @@ -241,7 +237,7 @@ int main( boost::shared_ptr timer_excl( tbox::TimerManager::getManager()->getTimer("apps::main::exclusive_timer")); timer_excl->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->zero(exclusive_tree_depth); } timer_excl->stop(); @@ -261,7 +257,7 @@ int main( * registered. That is, time a NULL timer call. */ timer_off->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->timerOff(); } timer_off->stop(); @@ -271,7 +267,7 @@ int main( * registered. */ timer_on->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->timerOn(); } timer_on->stop(); @@ -282,7 +278,7 @@ int main( * and so forth until we reach specified "exclusive_tree_depth. */ timer_excl->start(); - for (i = 0; i < ntimes; i++) { + for (i = 0; i < ntimes; ++i) { foo->zero(exclusive_tree_depth); } timer_excl->stop(); @@ -294,7 +290,7 @@ int main( const int max_timers = 575; boost::shared_ptr timers[max_timers]; - for (int timer_number = 0; timer_number < max_timers; timer_number++) { + for (int timer_number = 0; timer_number < max_timers; ++timer_number) { std::string timer_name = "testcount-" + tbox::Utilities::intToString( timer_number, @@ -304,11 +300,11 @@ int main( getTimer(timer_name); if (!timers[timer_number]) { - TBOX_ERROR("Failed to allocate timer, max was " + timer_number); + TBOX_ERROR("Failed to allocate timer, max was " << timer_number); } } - for (int timer_number = 0; timer_number < max_timers; timer_number++) { + for (int timer_number = 0; timer_number < max_timers; ++timer_number) { timers[timer_number].reset(); } @@ -320,7 +316,7 @@ int main( boost::shared_ptr tarray1[testit]; boost::shared_ptr tarray2[testit]; - for (int tcnt = 0; tcnt < testit; tcnt++) { + for (int tcnt = 0; tcnt < testit; ++tcnt) { int mfactor = 1; for (int i = 0; i < tcnt; ++i) { @@ -339,14 +335,14 @@ int main( tbox::pout << "\n\nEstimate SAMRAI Timer overhead..." << endl; - for (int tcnt = 0; tcnt < testit; tcnt++) { + for (int tcnt = 0; tcnt < testit; ++tcnt) { int ntest = 1; for (int i = 0; i < tcnt; ++i) { ntest *= 10; } - for (int i = 0; i < ntest; i++) { + for (int i = 0; i < ntest; ++i) { tarray1[tcnt]->start(); tarray2[tcnt]->start(); sleep(nsleepsec); @@ -373,14 +369,14 @@ int main( PTimer Ptarray1[testit]; PTimer Ptarray2[testit]; - for (int tcnt = 0; tcnt < testit; tcnt++) { + for (int tcnt = 0; tcnt < testit; ++tcnt) { int ntest = 1; for (int i = 0; i < tcnt; ++i) { ntest *= 10; } - for (int i = 0; i < ntest; i++) { + for (int i = 0; i < ntest; ++i) { Ptarray1[tcnt].start(); Ptarray2[tcnt].start(); sleep(nsleepsec); diff --git a/base/SAMRAI/SAMRAI/source/test/timers/test_inputs/test.input b/base/SAMRAI/SAMRAI/source/test/timers/test_inputs/test.input index c83a0522..d1c80a3b 100644 --- a/base/SAMRAI/SAMRAI/source/test/timers/test_inputs/test.input +++ b/base/SAMRAI/SAMRAI/source/test/timers/test_inputs/test.input @@ -3,17 +3,26 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Input file for timer tests. * ************************************************************************/ Main { + // Number of times the timer will be started and stop ntimes = 10000 + + // Depth of the tree of nested exclusive timers exclusive_tree_depth = 5 } +// See tbox::TimerManager for input TimerManager{ + // List of timers to invoke + timer_list = "apps::main::*", + "apps::Foo::*" + + // print_exclusive = TRUE print_user = TRUE print_sys = TRUE @@ -23,7 +32,4 @@ TimerManager{ print_concurrent = TRUE print_timer_overhead = TRUE print_threshold = 0.0 - init_from_restart = TRUE - timer_list = "apps::main::*", - "apps::Foo::*" } diff --git a/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.depend index 5f21cd4d..fbbc5505 100644 --- a/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -27,6 +27,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/LocalId.h \ $(INCLUDE_SAM)/SAMRAI/hier/MultiblockBoxTree.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/CellIndex.h \ @@ -43,7 +44,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideIndex.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SideOverlap.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -54,18 +54,15 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.in b/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.in index 76a0bcc2..d908527f 100644 --- a/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/transformation/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for timer and statistician main programs ## ######################################################################### @@ -14,6 +14,7 @@ SUBDIR = source/test/transformation VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -22,17 +23,23 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DTESTING=1 main: main.o $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o \ - $(LIBSAMRAI) $(LDLIBS) -o main + $(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(LIBSAMRAI) $(LDLIBS) -o main NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: main check: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check2d: $(MAKE) check @@ -41,15 +48,26 @@ check3d: $(MAKE) check checktest: - rm -f makecheck.logfile + $(RM) makecheck.logfile $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile +examples: -clean: - $(SAMCLEAN) +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) $(RM) main - $(RM) -rf *.log.* stats include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/transformation/README b/base/SAMRAI/SAMRAI/source/test/transformation/README new file mode 100644 index 00000000..28d3873a --- /dev/null +++ b/base/SAMRAI/SAMRAI/source/test/transformation/README @@ -0,0 +1,26 @@ +######################################################################### +## +## This file is part of the SAMRAI distribution. For full copyright +## information, see COPYRIGHT and COPYING.LESSER. +## +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Unit test of SAMRAI tranformation class. +## +######################################################################### + +This is a unit test of SAMRAI's Transformation class on a variety of 2D and +3D usage patterns. + + +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main + + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main diff --git a/base/SAMRAI/SAMRAI/source/test/transformation/main.C b/base/SAMRAI/SAMRAI/source/test/transformation/main.C index 5d61127f..8057f7f2 100644 --- a/base/SAMRAI/SAMRAI/source/test/transformation/main.C +++ b/base/SAMRAI/SAMRAI/source/test/transformation/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Test program to demonstrate/test the Transformation class * ************************************************************************/ @@ -53,7 +53,7 @@ int main( /* * For each test, create an arbitrary Box, do a transform and an - * inverse transform on the Box, and check to see that it has + * inverse-transform on the Box, and check to see that it has * returned to its original state. */ @@ -72,7 +72,7 @@ int main( zero_trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 2D trivial tranformation" << endl; } @@ -94,7 +94,7 @@ int main( zero_trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 3D trivial tranformation" << endl; } @@ -122,7 +122,7 @@ int main( shift_trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 2D shift tranformation" << endl; } @@ -151,7 +151,7 @@ int main( shift_trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 3D shift tranformation" << endl; } @@ -163,7 +163,7 @@ int main( */ { // loop over all 2D rotations - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; ++i) { hier::Transformation::RotationIdentifier rotate = static_cast(i); @@ -183,7 +183,7 @@ int main( trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 2D rotate/shift transformation" << endl; } @@ -196,7 +196,7 @@ int main( */ { // loop over all 3D rotations - for (int i = 0; i < 24; i++) { + for (int i = 0; i < 24; ++i) { hier::Transformation::RotationIdentifier rotate = static_cast(i); @@ -216,7 +216,7 @@ int main( trans.inverseTransform(trans_box); if (!trans_box.isSpatiallyEqual(ref_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - 3D rotate/shift transformation" << endl; } @@ -224,6 +224,473 @@ int main( } } + /* + * 2D getSourceBoxContainer tests + */ + { + hier::Index index_lo_a(28, 17); + hier::Index index_hi_a(33, 66); + hier::Index index_lo_b(34, 44); + hier::Index index_hi_b(44, 49); + hier::Box dst_box_a(index_lo_a, index_hi_a, block_zero); + hier::Box dst_box_b(index_lo_b, index_hi_b, block_zero); + + hier::BoxContainer dst_boxes; + dst_boxes.pushBack(dst_box_a); + dst_boxes.pushBack(dst_box_b); + + for (int i = 0; i < 4; ++i) { + hier::Transformation::RotationIdentifier rotate = + static_cast(i); + + hier::IntVector offset(dim2); + offset[0] = 41 + i; + offset[1] = 10 - i; + + hier::Transformation trans(rotate, offset, block_one, block_zero); + + /* + * CellOverlap test + */ + pdat::CellOverlap cell_overlap(dst_boxes, trans); + + const hier::BoxContainer& cell_ov_dst = + cell_overlap.getDestinationBoxContainer(); + + hier::BoxContainer cell_ov_src; + cell_overlap.getSourceBoxContainer(cell_ov_src); + + /* + * cell_ov_src is cell_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in cell_ov_dst. + */ + hier::BoxContainer::const_iterator cdi = cell_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = cell_ov_src.begin(); + bi != cell_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + trans.transform(trans_box); + if (!trans_box.isSpatiallyEqual(*cdi)) { + ++fail_count; + tbox::perr << "FAILED: - 2D CellOverlap getSourceBoxContainer" << endl; + } + + ++cdi; + } + + /* + * NodeOverlap test + */ + + hier::BoxContainer dst_node_boxes; + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_node_boxes.pushBack(pdat::NodeGeometry::toNodeBox(*di)); + } + + pdat::NodeOverlap node_overlap(dst_node_boxes, trans); + + const hier::BoxContainer& node_ov_dst = + node_overlap.getDestinationBoxContainer(); + + hier::BoxContainer node_ov_src; + node_overlap.getSourceBoxContainer(node_ov_src); + + /* + * node_ov_src is node_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in node_ov_dst. + */ + hier::BoxContainer::const_iterator ndi = node_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = node_ov_src.begin(); + bi != node_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + pdat::NodeGeometry::transform(trans_box, trans); + if (!trans_box.isSpatiallyEqual(*ndi)) { + ++fail_count; + tbox::perr << "FAILED: - 2D NodeOverlap getSourceBoxContainer" << endl; + } + + ++ndi; + } + + /* + * SideOverlap test + */ + std::vector dst_side_boxes(dim2.getValue()); + for (tbox::Dimension::dir_t normal = 0; normal < dim2.getValue(); ++normal) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_side_boxes[normal].pushBack( + pdat::SideGeometry::toSideBox(*di, normal)); + } + } + + pdat::SideOverlap side_overlap(dst_side_boxes, trans); + + for (tbox::Dimension::dir_t normal = 0; normal < dim2.getValue(); ++normal) { + + const hier::BoxContainer& side_ov_dst = + side_overlap.getDestinationBoxContainer(normal); + + hier::BoxContainer side_ov_src; + int src_normal = normal; + side_overlap.getSourceBoxContainer(side_ov_src, src_normal); + + /* + * side_ov_src is side_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in side_ov_dst. + */ + hier::BoxContainer::const_iterator sdi = side_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = side_ov_src.begin(); + bi != side_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_normal = src_normal; + pdat::SideGeometry::transform(trans_box, test_normal, trans); + if (!trans_box.isSpatiallyEqual(*sdi) || + test_normal != normal) { + ++fail_count; + tbox::perr << "FAILED: - 2D SideOverlap getSourceBoxContainer" << endl; + } + + ++sdi; + } + } + + /* + * FaceOverlap test + */ + std::vector dst_face_boxes(dim2.getValue()); + for (tbox::Dimension::dir_t normal = 0; normal < dim2.getValue(); ++normal) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_face_boxes[normal].pushBack( + pdat::FaceGeometry::toFaceBox(*di, normal)); + } + } + + pdat::FaceOverlap face_overlap(dst_face_boxes, trans); + + for (tbox::Dimension::dir_t normal = 0; normal < dim2.getValue(); ++normal) { + + const hier::BoxContainer& face_ov_dst = + face_overlap.getDestinationBoxContainer(normal); + + hier::BoxContainer face_ov_src; + int src_normal = normal; + face_overlap.getSourceBoxContainer(face_ov_src, src_normal); + + /* + * face_ov_src is face_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in face_ov_dst. + */ + hier::BoxContainer::const_iterator fdi = face_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = face_ov_src.begin(); + bi != face_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_normal = src_normal; + pdat::FaceGeometry::transform(trans_box, test_normal, trans); + if (!trans_box.isSpatiallyEqual(*fdi) || + test_normal != normal) { + ++fail_count; + tbox::perr << "FAILED: - 2D FaceOverlap getSourceBoxContainer" << endl; + } + + ++fdi; + } + } + + /* + * EdgeOverlap test + */ + std::vector dst_edge_boxes(dim2.getValue()); + for (int axis = 0; axis < dim2.getValue(); ++axis) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_edge_boxes[axis].pushBack( + pdat::EdgeGeometry::toEdgeBox(*di, axis)); + } + } + + pdat::EdgeOverlap edge_overlap(dst_edge_boxes, trans); + + for (int axis = 0; axis < dim2.getValue(); ++axis) { + + const hier::BoxContainer& edge_ov_dst = + edge_overlap.getDestinationBoxContainer(axis); + + hier::BoxContainer edge_ov_src; + int src_axis = axis; + edge_overlap.getSourceBoxContainer(edge_ov_src, src_axis); + + /* + * edge_ov_src is edge_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in edge_ov_dst. + */ + hier::BoxContainer::const_iterator edi = edge_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = edge_ov_src.begin(); + bi != edge_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_axis = src_axis; + pdat::EdgeGeometry::transform(trans_box, test_axis, trans); + if (!trans_box.isSpatiallyEqual(*edi) || + test_axis != axis) { + ++fail_count; + tbox::perr << "FAILED: - 2D EdgeOverlap getSourceBoxContainer" << endl; + } + + ++edi; + } + } + + } + } + + /* + * 3D getSourceBoxContainer tests + */ + { + hier::Index index_lo_a(19, 15, 26); + hier::Index index_hi_a(24, 43, 74); + hier::Index index_lo_b(25, 19, 48); + hier::Index index_hi_b(73, 59, 64); + hier::Box dst_box_a(index_lo_a, index_hi_a, block_zero); + hier::Box dst_box_b(index_lo_b, index_hi_b, block_zero); + + hier::BoxContainer dst_boxes; + dst_boxes.pushBack(dst_box_a); + dst_boxes.pushBack(dst_box_b); + + for (int i = 0; i < 24; ++i) { + hier::Transformation::RotationIdentifier rotate = + static_cast(i); + + hier::IntVector offset(dim3); + offset[0] = 46 + i; + offset[1] = 50 - i; + offset[2] = -17 + 4 * i; + + hier::Transformation trans(rotate, offset, block_one, block_zero); + + /* + * CellOverlap test + */ + pdat::CellOverlap cell_overlap(dst_boxes, trans); + + const hier::BoxContainer& cell_ov_dst = + cell_overlap.getDestinationBoxContainer(); + + hier::BoxContainer cell_ov_src; + cell_overlap.getSourceBoxContainer(cell_ov_src); + + /* + * cell_ov_src is cell_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in cell_ov_dst. + */ + hier::BoxContainer::const_iterator cdi = cell_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = cell_ov_src.begin(); + bi != cell_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + trans.transform(trans_box); + if (!trans_box.isSpatiallyEqual(*cdi)) { + ++fail_count; + tbox::perr << "FAILED: - 3D CellOverlap getSourceBoxContainer" << endl; + } + + ++cdi; + } + + /* + * NodeOverlap test + */ + + hier::BoxContainer dst_node_boxes; + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_node_boxes.pushBack(pdat::NodeGeometry::toNodeBox(*di)); + } + + pdat::NodeOverlap node_overlap(dst_node_boxes, trans); + + const hier::BoxContainer& node_ov_dst = + node_overlap.getDestinationBoxContainer(); + + hier::BoxContainer node_ov_src; + node_overlap.getSourceBoxContainer(node_ov_src); + + /* + * node_ov_src is node_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in node_ov_dst. + */ + hier::BoxContainer::const_iterator ndi = node_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = node_ov_src.begin(); + bi != node_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + pdat::NodeGeometry::transform(trans_box, trans); + if (!trans_box.isSpatiallyEqual(*ndi)) { + ++fail_count; + tbox::perr << "FAILED: - 3D NodeOverlap getSourceBoxContainer" << endl; + } + + ++ndi; + } + + /* + * SideOverlap test + */ + std::vector dst_side_boxes(dim3.getValue()); + for (tbox::Dimension::dir_t normal = 0; normal < dim3.getValue(); ++normal) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_side_boxes[normal].pushBack( + pdat::SideGeometry::toSideBox(*di, normal)); + } + } + + pdat::SideOverlap side_overlap(dst_side_boxes, trans); + + for (tbox::Dimension::dir_t normal = 0; normal < dim3.getValue(); ++normal) { + + const hier::BoxContainer& side_ov_dst = + side_overlap.getDestinationBoxContainer(normal); + + hier::BoxContainer side_ov_src; + int src_normal = normal; + side_overlap.getSourceBoxContainer(side_ov_src, src_normal); + + /* + * side_ov_src is side_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in side_ov_dst. + */ + hier::BoxContainer::const_iterator sdi = side_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = side_ov_src.begin(); + bi != side_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_normal = src_normal; + pdat::SideGeometry::transform(trans_box, test_normal, trans); + if (!trans_box.isSpatiallyEqual(*sdi) || + test_normal != normal) { + ++fail_count; + tbox::perr << "FAILED: - 3D SideOverlap getSourceBoxContainer" << endl; + } + + ++sdi; + } + } + + /* + * FaceOverlap test + */ + std::vector dst_face_boxes(dim3.getValue()); + for (tbox::Dimension::dir_t normal = 0; normal < dim3.getValue(); ++normal) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_face_boxes[normal].pushBack( + pdat::FaceGeometry::toFaceBox(*di, normal)); + } + } + + pdat::FaceOverlap face_overlap(dst_face_boxes, trans); + + for (tbox::Dimension::dir_t normal = 0; normal < dim3.getValue(); ++normal) { + + const hier::BoxContainer& face_ov_dst = + face_overlap.getDestinationBoxContainer(normal); + + hier::BoxContainer face_ov_src; + int src_normal = normal; + face_overlap.getSourceBoxContainer(face_ov_src, src_normal); + + /* + * face_ov_src is face_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in face_ov_dst. + */ + hier::BoxContainer::const_iterator fdi = face_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = face_ov_src.begin(); + bi != face_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_normal = src_normal; + pdat::FaceGeometry::transform(trans_box, test_normal, trans); + if (!trans_box.isSpatiallyEqual(*fdi) || + test_normal != normal) { + ++fail_count; + tbox::perr << "FAILED: - 3D FaceOverlap getSourceBoxContainer" << endl; + } + + ++fdi; + } + } + + /* + * EdgeOverlap test + */ + std::vector dst_edge_boxes(dim3.getValue()); + for (int axis = 0; axis < dim3.getValue(); ++axis) { + + for (hier::BoxContainer::iterator di = dst_boxes.begin(); + di != dst_boxes.end(); ++di) { + dst_edge_boxes[axis].pushBack( + pdat::EdgeGeometry::toEdgeBox(*di, axis)); + } + } + + pdat::EdgeOverlap edge_overlap(dst_edge_boxes, trans); + + for (int axis = 0; axis < dim3.getValue(); ++axis) { + + const hier::BoxContainer& edge_ov_dst = + edge_overlap.getDestinationBoxContainer(axis); + + hier::BoxContainer edge_ov_src; + int src_axis = axis; + edge_overlap.getSourceBoxContainer(edge_ov_src, src_axis); + + /* + * edge_ov_src is edge_ov_dst inverse-transformed to source + * space. Transform back to dst space and the boxes should + * be equal to those in edge_ov_dst. + */ + hier::BoxContainer::const_iterator edi = edge_ov_dst.begin(); + for (hier::BoxContainer::iterator bi = edge_ov_src.begin(); + bi != edge_ov_src.end(); ++bi) { + + hier::Box trans_box(*bi); + int test_axis = src_axis; + pdat::EdgeGeometry::transform(trans_box, test_axis, trans); + if (!trans_box.isSpatiallyEqual(*edi) || + test_axis != axis) { + ++fail_count; + tbox::perr << "FAILED: - 3D EdgeOverlap getSourceBoxContainer" << endl; + } + + ++edi; + } + } + + } + } + } if (fail_count == 0) { @@ -266,7 +733,7 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::CellGeometry::transform(trans_cindex, reverse_trans); if (trans_cindex != ref_cindex) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - CellIndex transformation" << endl; } @@ -278,7 +745,7 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::NodeGeometry::transform(trans_node_box, transformation); pdat::NodeGeometry::transform(trans_node_box, reverse_trans); if (!trans_node_box.isSpatiallyEqual(ref_node_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Node box transformation" << endl; } @@ -288,21 +755,21 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::NodeGeometry::transform(trans_nindex, reverse_trans); if (trans_nindex != ref_nindex) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - NodeIndex transformation" << endl; } /* * Side test */ - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box ref_side_box(pdat::SideGeometry::toSideBox(box, d)); hier::Box trans_side_box(ref_side_box); int direction = d; pdat::SideGeometry::transform(trans_side_box, direction, transformation); pdat::SideGeometry::transform(trans_side_box, direction, reverse_trans); if (!trans_side_box.isSpatiallyEqual(ref_side_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Side box transformation" << endl; } @@ -312,7 +779,7 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::SideGeometry::transform(trans_sindex, reverse_trans); if (trans_sindex != ref_sindex) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - SideIndex transformation" << endl; } } @@ -320,14 +787,14 @@ int testGeometryTransformations(const hier::Transformation& transformation, /* * Edge test */ - for (int d = 0; d < dim.getValue(); d++) { + for (int d = 0; d < dim.getValue(); ++d) { hier::Box ref_edge_box(pdat::EdgeGeometry::toEdgeBox(box, d)); hier::Box trans_edge_box(ref_edge_box); int direction = d; pdat::EdgeGeometry::transform(trans_edge_box, direction, transformation); pdat::EdgeGeometry::transform(trans_edge_box, direction, reverse_trans); if (!trans_edge_box.isSpatiallyEqual(ref_edge_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Edge box transformation" << endl; } @@ -337,7 +804,7 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::EdgeGeometry::transform(trans_eindex, reverse_trans); if (trans_eindex != ref_eindex) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - EdgeIndex transformation" << endl; } } @@ -345,14 +812,14 @@ int testGeometryTransformations(const hier::Transformation& transformation, /* * Face test */ - for (int d = 0; d < dim.getValue(); d++) { + for (tbox::Dimension::dir_t d = 0; d < dim.getValue(); ++d) { hier::Box ref_face_box(pdat::FaceGeometry::toFaceBox(box, d)); hier::Box trans_face_box(ref_face_box); int direction = d; pdat::FaceGeometry::transform(trans_face_box, direction, transformation); pdat::FaceGeometry::transform(trans_face_box, direction, reverse_trans); if (!trans_face_box.isSpatiallyEqual(ref_face_box)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Face box transformation" << endl; } @@ -362,7 +829,7 @@ int testGeometryTransformations(const hier::Transformation& transformation, pdat::FaceGeometry::transform(trans_findex, reverse_trans); if (trans_findex != ref_findex) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - FaceIndex transformation" << endl; } } diff --git a/base/SAMRAI/SAMRAI/source/test/variables/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/variables/Makefile.depend index 2a725ba0..475bac3a 100644 --- a/base/SAMRAI/SAMRAI/source/test/variables/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/variables/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -35,6 +35,7 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchDescriptor.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchGeometry.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ @@ -62,7 +63,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceGeometry.h \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.h \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Database.h \ @@ -74,14 +74,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ $(INCLUDE_SAM)/SAMRAI/tbox/StartupShutdownManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Timer.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h main-var_db.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayData.C \ $(INCLUDE_SAM)/SAMRAI/pdat/ArrayDataOperationUtilities.C \ @@ -96,9 +96,8 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceDataFactory.C \ $(INCLUDE_SAM)/SAMRAI/pdat/OuterfaceVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} diff --git a/base/SAMRAI/SAMRAI/source/test/variables/Makefile.in b/base/SAMRAI/SAMRAI/source/test/variables/Makefile.in index c5e8d650..8f1165d4 100644 --- a/base/SAMRAI/SAMRAI/source/test/variables/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/variables/Makefile.in @@ -3,23 +3,24 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for testing variable database operations ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/variables -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check include $(OBJECT)/config/Makefile.config -CPPFLAGS_EXTRA = -DNDIM=$(PDIM) -DTESTING=1 +CPPFLAGS_EXTRA = -DTESTING=1 CXX_OBJS = main-var_db.o @@ -30,28 +31,46 @@ main: $(CXX_OBJS) $(LIBSAMRAIDEPEND) NUM_TESTS = 1 TEST_NPROCS = @TEST_NPROCS@ +QUOTE = \" checkcompile: main check: - $(MAKE) check2d - $(MAKE) check3d + $(MAKE) check2d + $(MAKE) check3d check2d: checkcompile - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./main + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./main | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo check3d: checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile -clean-check: - $(SAMCLEAN) +examples: -clean: clean-check - $(RM) *.f main* +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) main include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/variables/README b/base/SAMRAI/SAMRAI/source/test/variables/README index 39d0d508..8a0196fa 100644 --- a/base/SAMRAI/SAMRAI/source/test/variables/README +++ b/base/SAMRAI/SAMRAI/source/test/variables/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for variables tests. ## ######################################################################### @@ -17,15 +17,20 @@ code near the end of main-var_db.C that are errors in the usage of the VariableDatabase. These are removed by the preprocessor in the distribution version of the code. +COMPILATION AND EXECUTION +------------------------- + Compilation: + make main -Compilation: - make - or - make vdbtest + Execution: + serial: + ./main + parallel: + Parallel execution is platform dependent. This example demonstrates + execution via mpirun. + mpirun -np [mpirun options] ./main -Execution: - ./vdbtest - -Output: - main-var_db.log +OUTPUT +------ + vdbtest.log.* diff --git a/base/SAMRAI/SAMRAI/source/test/variables/main-var_db.C b/base/SAMRAI/SAMRAI/source/test/variables/main-var_db.C index ffccbd23..99959829 100644 --- a/base/SAMRAI/SAMRAI/source/test/variables/main-var_db.C +++ b/base/SAMRAI/SAMRAI/source/test/variables/main-var_db.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test variable database operations * ************************************************************************/ @@ -25,7 +25,7 @@ #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/hier/VariableDatabase.h" -#include +#include "boost/shared_ptr.hpp" #include using namespace std; @@ -118,7 +118,7 @@ int main( tbox::plog << "Test #1a: hier::VariableDatabase::checkContextExists()..." << endl; if (!var_db->checkContextExists("SCRATCH")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1a: hier::VariableDatabase::checkContextExists()\n" << "SCRATCH context added to var_db, but not found" << endl; @@ -128,7 +128,7 @@ int main( tbox::plog << "Test #1b: hier::VariableDatabase::checkContextExists()..." << endl; if (!var_db->checkContextExists("CURRENT")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1b: hier::VariableDatabase::checkContextExists()\n" << "CURRENT context added to var_db, but not found" << endl; @@ -138,7 +138,7 @@ int main( tbox::plog << "Test #1c: hier::VariableDatabase::checkContextExists()..." << endl; if (var_db->checkContextExists("dummy")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1c: hier::VariableDatabase::checkContextExists()\n" << "dummy context not added to var_db, but found" << endl; @@ -157,7 +157,7 @@ int main( tbox::plog << "Test #1d: hier::VariableDatabase::checkContextExists()..." << endl; if (!var_db->checkContextExists("dummy")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1d: hier::VariableDatabase::checkContextExists()\n" << "dummy context added to var_db, but not found" << endl; @@ -169,7 +169,7 @@ int main( tbox::plog << "Test #2a: hier::VariableDatabase::checkVariableExists()..." << endl; if (!var_db->checkVariableExists("uval")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2a: hier::VariableDatabase::checkVariableExists()\n" << "uval variable added to var_db, but not found" << endl; @@ -179,7 +179,7 @@ int main( tbox::plog << "Test #2b: hier::VariableDatabase::checkVariableExists()..." << endl; if (!var_db->checkVariableExists("flux")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2b: hier::VariableDatabase::checkVariableExists()\n" << "flux variable added to var_db, but not found" << endl; @@ -189,7 +189,7 @@ int main( tbox::plog << "Test #2c: hier::VariableDatabase::checkVariableExists()..." << endl; if (!var_db->checkVariableExists("fluxsum")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2c: hier::VariableDatabase::checkVariableExists()\n" << "fluxsum variable added to var_db, but not found" @@ -200,7 +200,7 @@ int main( tbox::plog << "Test #2d: hier::VariableDatabase::checkVariableExists()..." << endl; if (var_db->checkVariableExists("dummy")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2d: hier::VariableDatabase::checkVariableExists()\n" << "dummy variable not added to var_db, but found" << endl; @@ -211,7 +211,7 @@ int main( << endl; boost::shared_ptr tvar_uval(var_db->getVariable("uval")); if (!tvar_uval) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3a: hier::VariableDatabase::getVariable()\n" << "uval variable added to var_db, but returning NULL" @@ -223,7 +223,7 @@ int main( << endl; boost::shared_ptr tvar_flux(var_db->getVariable("flux")); if (!tvar_flux) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3b: hier::VariableDatabase::getVariable()\n" << "flux variable added to var_db, but returning NULL" @@ -236,7 +236,7 @@ int main( boost::shared_ptr tvar_fluxsum( var_db->getVariable("fluxsum")); if (!tvar_fluxsum) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3c: hier::VariableDatabase::getVariable()\n" << "fluxsum variable added to var_db, but returning NULL" @@ -250,7 +250,7 @@ int main( boost::shared_ptr tvar_dummy( var_db->getVariable("dummy")); if (tvar_dummy) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3d: hier::VariableDatabase::getVariable()\n" << "dummy variable not added to var_db, but not returning NULL" @@ -264,7 +264,7 @@ int main( << endl; int uval_id = tvar_uval->getInstanceIdentifier(); if (uval_id != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4a: hier::Variable::getInstanceIdentifier()\n" << "uval should have id = 0, but has id = " << uval_id @@ -276,7 +276,7 @@ int main( << endl; int flux_id = tvar_flux->getInstanceIdentifier(); if (flux_id != 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4b: hier::Variable::getInstanceIdentifier()\n" << "flux should have id = 1, but has id = " << flux_id @@ -288,7 +288,7 @@ int main( << endl; int fluxsum_id = tvar_fluxsum->getInstanceIdentifier(); if (fluxsum_id != 2) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4c: hier::Variable::getInstanceIdentifier()\n" << "fluxsum should have id = 2, but has id = " @@ -304,7 +304,7 @@ int main( int ti = var_db->registerVariableAndContext( tvar_uval, tctxt_current, tzero_ghosts); if (ti != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5: Re-registering a variable and context\n" << "Original id = 0 should be returned, but " @@ -317,7 +317,7 @@ int main( << endl; ti = var_db->mapVariableAndContextToIndex(tvar_uval, tctxt_current); if (ti != 0) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6a: hier::VariableDatabase::mapVariableAndContextToIndex()\n" << "(uval,CURRENT) should be mapped to 0, but is mapped to " @@ -333,7 +333,7 @@ int main( var_db->getContext("SCRATCH")); ti = var_db->mapVariableAndContextToIndex(tvar_uval, tctxt_scratch); if (ti != -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6b: hier::VariableDatabase::mapVariableAndContextToIndex()\n" << "(uval,SCRATCH) should be mapped to -1, but is mapped to " @@ -349,7 +349,7 @@ int main( tctxt_scratch = var_db->getContext("SCRATCH"); ti = var_db->mapVariableAndContextToIndex(dummy_var, tctxt_scratch); if (ti != -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6c: hier::VariableDatabase::mapVariableAndContextToIndex()\n" << "(dummy,SCRATCH) should be mapped to -1, but is mapped to " @@ -365,7 +365,7 @@ int main( new hier::VariableContext("RANDOM")); ti = var_db->mapVariableAndContextToIndex(tvar_uval, tctxt_random); if (ti != -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6d: hier::VariableDatabase::mapVariableAndContextToIndex()\n" << "(uval,RANDOM) should be mapped to -1, but is mapped to " @@ -385,20 +385,20 @@ int main( // searching for index = 2 if (!var_db->mapIndexToVariableAndContext( search_id, search_var, search_ctxt)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7a.1: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "Problem finding a (variable,context) pair for index = 2" << endl; if (search_var->getName() != flux_variable) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7a.2: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "Returned var name should be \"flux\" but is " << search_var->getName() << endl; } if (search_ctxt->getName() != scratch_variable) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7a.3: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "Returned context name should be \"SCRATCH\" but is " @@ -422,7 +422,7 @@ int main( // searching for index = 20 if (var_db->mapIndexToVariableAndContext( search_id, search_var, search_ctxt)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7b.1: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "Something maps to index = 20 when nothing should.\n" @@ -432,13 +432,13 @@ int main( } else { if (search_var) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7b.2: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "search_var should be NULL" << endl; } if (search_ctxt) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7b.3: hier::VariableDatabase::mapIndexToVariableAndContext()\n" << "search_ctxt should be NULL" << endl; @@ -453,13 +453,13 @@ int main( // searching for index = 2 if (!var_db->mapIndexToVariable(search_id, search_var)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7c.1: hier::VariableDatabase::mapIndexToVariable()\n" << "Problem finding a (variable) for index = 2" << endl; if (search_var->getName() != flux_variable) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7c.2: hier::VariableDatabase::mapIndexToVariable()\n" << "Returned var name should be \"flux\" but is " @@ -474,7 +474,7 @@ int main( // searching for index = 20 if (var_db->mapIndexToVariable(search_id, search_var)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7d.1: hier::VariableDatabase::mapIndexToVariable()\n" << "Something maps to index = 20 when nothing should.\n" @@ -483,7 +483,7 @@ int main( } else { if (search_var) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7d.2: hier::VariableDatabase::mapIndexToVariable()\n" << "search_var should be NULL" << endl; @@ -504,7 +504,7 @@ int main( tbox::plog << "Test #8a: Checking mapping in variable database..." << endl; if (!var_db->checkVariablePatchDataIndex(uval, uval_current_id)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8a: " << "VariableDatabase:checkVariablePatchDataIndex()\n" << "uval should be map to current id in patch descriptor" @@ -514,7 +514,7 @@ int main( tbox::plog << "Test #8b: Checking mapping in variable database..." << endl; if (!var_db->checkVariablePatchDataIndexType(uval, uval_current_id)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8b: " << "VariableDatabase:checkVariablePatchDataIndexType()\n" << "uval should be map to current id in patch descriptor" @@ -528,7 +528,7 @@ int main( int test_id = var_db->registerPatchDataIndex(uval, uval_current_id); if (test_id != uval_current_id) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8c: " << "VariableDatabase:registerPatchDataIndex()\n" << "re-registering current uval id should return same id" @@ -543,7 +543,7 @@ int main( var_db->registerClonedPatchDataIndex(uval, uval_current_id); if ((new_id < 0) || (new_id == uval_current_id)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8d: " << "VariableDatabase:registerClonedPatchDataIndex()\n" << "cloning current uval id return invalid id" << endl; @@ -556,7 +556,7 @@ int main( boost::shared_ptr tvar; if (!var_db->mapIndexToVariable(new_id, tvar) || (tvar->getName() != "uval")) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8e: " << "VariableDatabase:mapIndexToVariable()\n" << "descriptor id = " << new_id @@ -581,7 +581,7 @@ int main( tvar.reset(); if (var_db->mapIndexToVariable(new_id, tvar)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8f: " << "VariableDatabase:removePatchDataIndex()\n" << "descriptor id = " << new_id @@ -593,13 +593,13 @@ int main( << "Test #8g-h: Testing whether inconsistent mapping is allowed..." << endl; if (!var_db->checkVariablePatchDataIndex(flux, flux_scratch_id)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8g: " << "VariableDatabase:checkVariablePatchDataIndex()\n" << "flux should be mapped to scratch flux id" << endl; } if (var_db->checkVariablePatchDataIndex(uval, flux_scratch_id)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8h: " << "VariableDatabase:checkVariablePatchDataIndex()\n" << "uval should not map to scratch flux id" << endl; @@ -614,7 +614,7 @@ int main( var_db->mapVariableAndContextToIndex(flux, var_db->getContext("SCRATCH")); if (tindex > -1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8i: " << "VariableDatabase:removePatchDataIndex()\n" << "flux-SCRATCH mapping should no longer be in database" @@ -623,7 +623,7 @@ int main( tvar.reset(); if (var_db->mapIndexToVariable(flux_scratch_id, tvar)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8j: " << "VariableDatabase:mapIndexToVariable()\n" << "descriptor id = " << flux_scratch_id @@ -660,7 +660,7 @@ int main( << "This should bomb!!" << endl; tctxt = var_db->getContext("CURRENT"); tvar = var_db->getVariable("uval"); - g = hier::IntVector(2); + g = hier::IntVector(2); ti = var_db->registerVariableAndContext(tvar, tctxt, g); tbox::plog << "uval, CURRENT at index = " << ti << endl; @@ -669,7 +669,7 @@ int main( << "This should bomb!!" << endl; tctxt = new hier::VariableContext("CURRENT"); tvar = var_db->getVariable("uval"); - g = hier::IntVector(0); + g = hier::IntVector(0); ti = var_db->registerVariableAndContext(tvar, tctxt, g); tbox::plog << "uval, fake CURRENT at index = " << ti << endl; diff --git a/base/SAMRAI/SAMRAI/source/test/vector/Makefile.depend b/base/SAMRAI/SAMRAI/source/test/vector/Makefile.depend index 2a1b40ff..cbec31d1 100644 --- a/base/SAMRAI/SAMRAI/source/test/vector/Makefile.depend +++ b/base/SAMRAI/SAMRAI/source/test/vector/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -48,12 +48,14 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -145,7 +147,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/solv/SundialsAbstractVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/Sundials_SAMRAIVector.h \ $(INCLUDE_SAM)/SAMRAI/solv/solv_NVector.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -157,8 +158,8 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -167,7 +168,6 @@ DEPENDS_0:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h kvtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -226,11 +226,10 @@ DEPENDS_0 +=\ $(INCLUDE_SAM)/SAMRAI/pdat/SideVariable.C \ $(INCLUDE_SAM)/SAMRAI/pdat/SumOperation.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=pvtest.o DEPENDS_1:=\ @@ -269,12 +268,14 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevel.h \ $(INCLUDE_SAM)/SAMRAI/hier/PatchLevelFactory.h \ $(INCLUDE_SAM)/SAMRAI/hier/PeriodicId.h \ + $(INCLUDE_SAM)/SAMRAI/hier/PeriodicShiftCatalog.h \ $(INCLUDE_SAM)/SAMRAI/hier/PersistentOverlapConnectors.h \ $(INCLUDE_SAM)/SAMRAI/hier/ProcessorMapping.h \ $(INCLUDE_SAM)/SAMRAI/hier/RefineOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TimeInterpolateOperator.h \ $(INCLUDE_SAM)/SAMRAI/hier/TransferOperatorRegistry.h \ $(INCLUDE_SAM)/SAMRAI/hier/Transformation.h \ + $(INCLUDE_SAM)/SAMRAI/hier/UncoveredBoxIterator.h \ $(INCLUDE_SAM)/SAMRAI/hier/Variable.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableContext.h \ $(INCLUDE_SAM)/SAMRAI/hier/VariableDatabase.h \ @@ -365,7 +366,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.h \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Boost.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Clock.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Complex.h \ @@ -377,8 +377,8 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MemoryUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/MessageStream.h \ + $(INCLUDE_SAM)/SAMRAI/tbox/OpenMPUtilities.h \ $(INCLUDE_SAM)/SAMRAI/tbox/PIO.h \ - $(INCLUDE_SAM)/SAMRAI/tbox/ReferenceCounter.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAIManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/SAMRAI_MPI.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Serializable.h \ @@ -387,7 +387,6 @@ DEPENDS_1:=\ $(INCLUDE_SAM)/SAMRAI/tbox/TimerManager.h \ $(INCLUDE_SAM)/SAMRAI/tbox/Utilities.h pvtest.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataBasicOps.C \ $(INCLUDE_SAM)/SAMRAI/math/ArrayDataMiscellaneousOpsReal.C \ @@ -448,9 +447,8 @@ DEPENDS_1 +=\ $(INCLUDE_SAM)/SAMRAI/solv/PETScAbstractVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/PETSc_SAMRAIVectorReal.C \ $(INCLUDE_SAM)/SAMRAI/solv/SAMRAIVectorReal.C \ - $(INCLUDE_SAM)/SAMRAI/tbox/Array.C \ $(INCLUDE_SAM)/SAMRAI/tbox/MathUtilities.C -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/source/test/vector/Makefile.in b/base/SAMRAI/SAMRAI/source/test/vector/Makefile.in index 2337577c..541a35f1 100644 --- a/base/SAMRAI/SAMRAI/source/test/vector/Makefile.in +++ b/base/SAMRAI/SAMRAI/source/test/vector/Makefile.in @@ -3,17 +3,18 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for test of patch data and vector operations ## ######################################################################### -SAMRAI = @top_srcdir@ -SRCDIR = @srcdir@ +SAMRAI = @top_srcdir@ +SRCDIR = @srcdir@ SUBDIR = source/test/vector -VPATH = @srcdir@ +VPATH = @srcdir@ TESTTOOLS = ../testtools OBJECT = ../../.. +REPORT = $(OBJECT)/report.xml default: check @@ -21,38 +22,65 @@ include $(OBJECT)/config/Makefile.config CPPFLAGS_EXTRA= -DTESTING=1 -pvtest: pvtest.o $(FOBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) pvtest.o $(COBJS) \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ -kvtest: kvtest.o $(FOBJS) $(LIBSAMRAIDEPEND) - $(CXX) $(CXXFLAGS) $(LDFLAGS) kvtest.o \ - $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ +pvtest: pvtest.o $(FOBJS) $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) pvtest.o $(COBJS) \ + $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ +kvtest: kvtest.o $(FOBJS) $(LIBSAMRAIDEPEND) + $(CXX) $(CXXFLAGS) $(LDFLAGS) kvtest.o \ + $(LIBSAMRAI3D) $(LIBSAMRAI) $(LDLIBS) -o $@ NUM_TESTS = 2 TEST_NPROCS = @TEST_NPROCS@ +ifeq ($(findstring 4, ${TEST_NPROCS}),4) +TEST_NPROCS = 1,2 +endif +QUOTE = \" check: - $(MAKE) check2d - $(MAKE) check3d + $(MAKE) check2d + $(MAKE) check3d check2d: check3d: kvtest pvtest - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./kvtest - $(OBJECT)/config/serpa-run $(TEST_NPROCS) ./pvtest + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./kvtest | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done + @for p in `echo "$(TEST_NPROCS)" | tr "," " "`; do \ + echo " " >> $(REPORT); \ + $(OBJECT)/config/serpa-run $$p ./pvtest -skip_petscrc | $(TEE) foo; \ + if ! grep "PASSED" foo >& /dev/null ; then echo " " >> $(REPORT); fi; \ + echo " " >> $(REPORT); \ + done; \ + $(RM) foo checkcompile: kvtest pvtest checktest: - rm -f makecheck.logfile - $(MAKE) check 2>&1 | $(TEE) makecheck.logfile - $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) makecheck.logfile - rm -f makecheck.logfile + $(RM) makecheck.logfile + $(MAKE) check 2>&1 | $(TEE) makecheck.logfile + $(TESTTOOLS)/testcount.sh $(TEST_NPROCS) $(NUM_TESTS) 0 makecheck.logfile + $(RM) makecheck.logfile +examples: -clean: - $(SAMCLEAN) - $(RM) *.f *vtest* +perf: + +everything: + $(MAKE) checkcompile || exit 1 + $(MAKE) checktest + $(MAKE) examples + $(MAKE) perf + +checkclean: + $(CLEAN_COMMON_CHECK_FILES) + +clean: checkclean + $(CLEAN_COMMON_TEST_FILES) + $(RM) *vtest* include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/source/test/vector/README b/base/SAMRAI/SAMRAI/source/test/vector/README index a6baebcb..a98da97a 100644 --- a/base/SAMRAI/SAMRAI/source/test/vector/README +++ b/base/SAMRAI/SAMRAI/source/test/vector/README @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: README file for vector test. ## ######################################################################### @@ -14,20 +14,23 @@ interface and the SAMRAI-Kinsol vector interface. Each of these test programs creates a 2 level patch hierarchy with 2 patches on each level and may only be run on 1 or 2 processors. +COMPILATION AND EXECUTION +------------------------- + Compilation: + pvtest - make pvtest + kvtest - make kvtest -Compilation: - pvtest - make pvtest - kvtest - make kvtest + Execution: + serial: + pvtest - ./pvtest + kvtest - ./kvtest + parallel: + Parallel execution is platform dependent. These examples demonstrate + execution via mpirun. + pvtest - mpirun -np [mpirun options] ./pvtest + kvtest - mpirun -np [mpirun options] ./kvtest -Execution: - serial - - pvtest - ./pvtest - kvtest - ./kvtest - - parallel - - pvtest - mpirun -np pvtest - kvtest - mpirun -np kvtest - -Output: - pvtest - pvtest.log.* - kvtest - kvtest.log.* +OUTPUT +------ + pvtest - pvtest.log.* + kvtest - kvtest.log.* diff --git a/base/SAMRAI/SAMRAI/source/test/vector/kvtest.C b/base/SAMRAI/SAMRAI/source/test/vector/kvtest.C index c54df75f..e949c28a 100644 --- a/base/SAMRAI/SAMRAI/source/test/vector/kvtest.C +++ b/base/SAMRAI/SAMRAI/source/test/vector/kvtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test SAMRAI-KINSOL vector interface. * ************************************************************************/ @@ -57,11 +57,7 @@ #endif -#include - -#ifndef NULL -#define NULL (0) -#endif +#include "boost/shared_ptr.hpp" #define NCELL_VARS 2 #define NFACE_VARS 2 @@ -118,15 +114,6 @@ int main( hier::Box fine7(hier::Index(8, 6, 6), hier::Index(13, 7, 7), blk0); hier::IntVector ratio(dim3d, 2); - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - coarse2.initialize(coarse2, hier::LocalId(2), 0); - coarse3.initialize(coarse3, hier::LocalId(3), 0); - coarse4.initialize(coarse4, hier::LocalId(4), 0); - coarse5.initialize(coarse5, hier::LocalId(5), 0); - coarse6.initialize(coarse6, hier::LocalId(6), 0); - coarse7.initialize(coarse7, hier::LocalId(7), 0); - hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; coarse_domain.pushBack(coarse0); @@ -180,24 +167,27 @@ int main( const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim3d, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim3d, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_domain_itr(coarse_domain); - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_domain_itr) { - if (ib % nproc == layer0.getMPI().getRank()) { - layer0.addBox(hier::Box(*coarse_domain_itr, + hier::BoxContainer::iterator coarse_domain_itr = coarse_domain.begin(); + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_domain_itr) { + if (ib % nproc == layer0->getMPI().getRank()) { + layer0->addBox(hier::Box(*coarse_domain_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + layer0->getMPI().getRank())); } } - hier::BoxContainer::iterator fine_boxes_itr(fine_boxes); - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_boxes_itr) { - if (ib % nproc == layer1.getMPI().getRank()) { - layer1.addBox(hier::Box(*fine_boxes_itr, + hier::BoxContainer::iterator fine_boxes_itr = fine_boxes.begin(); + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_boxes_itr) { + if (ib % nproc == layer1->getMPI().getRank()) { + layer1->addBox(hier::Box(*fine_boxes_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + layer1->getMPI().getRank())); } } @@ -259,24 +249,28 @@ int main( int nwgt_id = variable_db->registerVariableAndContext( nwgt, dummy, no_ghosts); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(cwgt_id); hierarchy->getPatchLevel(ln)->allocatePatchData(fwgt_id); hierarchy->getPatchLevel(ln)->allocatePatchData(nwgt_id); } boost::shared_ptr > cell_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(cwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(cwgt, hierarchy))); boost::shared_ptr > face_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(fwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(fwgt, hierarchy))); boost::shared_ptr > node_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(nwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(nwgt, hierarchy))); + + TBOX_ASSERT(cell_ops); + TBOX_ASSERT(face_ops); + TBOX_ASSERT(node_ops); cell_ops->resetLevels(0, 1); face_ops->resetLevels(0, 1); @@ -294,39 +288,43 @@ int main( // Initialize control volume data for cell-centered components - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double cell_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + TBOX_ASSERT(cvdata); cvdata->fillAll(cell_vol); if (ln == 0) cvdata->fillAll(0.0, (coarse_fine * patch->getBox())); } } // Initialize control volume data for face-centered components - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double face_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > data( - patch->getPatchData(fwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fwgt_id))); + TBOX_ASSERT(data); data->fillAll(face_vol); pdat::FaceIndex fi(dim3d); int plo0 = patch->getBox().lower(0); @@ -349,8 +347,8 @@ int main( } //X face boundaries if (plo0 == level_box.lower(0)) { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(plo0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Lower); @@ -358,8 +356,8 @@ int main( } } } else { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(plo0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Lower); @@ -368,8 +366,8 @@ int main( } } if (phi0 == level_box.upper(0)) { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(phi0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Upper); @@ -380,8 +378,8 @@ int main( //Y face boundaries if (plo1 == level_box.lower(1)) { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, plo1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); @@ -389,8 +387,8 @@ int main( } } } else { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, plo1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); @@ -399,8 +397,8 @@ int main( } } if (phi1 == level_box.upper(1)) { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, phi1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Upper); @@ -411,8 +409,8 @@ int main( //Z face boundaries if (plo2 == level_box.lower(2)) { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, plo2), pdat::FaceIndex::Z, pdat::FaceIndex::Lower); @@ -420,8 +418,8 @@ int main( } } } else { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, plo2), pdat::FaceIndex::Z, pdat::FaceIndex::Lower); @@ -430,8 +428,8 @@ int main( } } if (phi2 == level_box.upper(2)) { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, phi2), pdat::FaceIndex::Z, pdat::FaceIndex::Upper); @@ -442,20 +440,22 @@ int main( } } - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double node_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > data( - patch->getPatchData(nwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(nwgt_id))); + TBOX_ASSERT(data); data->fillAll(node_vol); pdat::NodeIndex ni(dim3d); hier::Index plo = patch->getBox().lower(); @@ -481,16 +481,16 @@ int main( //X faces if (plo(0) == level_box.lower(0)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo( 0), jc, kc), pdat::NodeIndex::LUU); (*data)(ni) *= bdry_face_factor; } } } else { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo( 0), jc, kc), pdat::NodeIndex::LUU); (*data)(ni) = 0.0; @@ -498,8 +498,8 @@ int main( } } if (phi(0) == level_box.upper(0)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(phi( 0), jc, kc), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -509,16 +509,16 @@ int main( //Y faces if (plo(1) == level_box.lower(1)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo( 1), kc), pdat::NodeIndex::ULU); (*data)(ni) *= bdry_face_factor; } } } else { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo( 1), kc), pdat::NodeIndex::ULU); (*data)(ni) = 0.0; @@ -526,8 +526,8 @@ int main( } } if (phi(1) == level_box.upper(1)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, phi( 1), kc), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -537,16 +537,16 @@ int main( //Z faces if (plo(2) == level_box.lower(2)) { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, plo( 2)), pdat::NodeIndex::UUL); (*data)(ni) *= bdry_face_factor; } } } else { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, plo( 2)), pdat::NodeIndex::UUL); (*data)(ni) = 0.0; @@ -554,8 +554,8 @@ int main( } } if (phi(2) == level_box.upper(2)) { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, phi( 2)), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -564,7 +564,7 @@ int main( } // edge boundaries - for (ic = plo(0); ic < phi(0); ic++) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo(1), plo( 2)), pdat::NodeIndex::ULL); if (plo(1) == level_box.lower(1)) { @@ -617,7 +617,7 @@ int main( } } - for (jc = plo(1); jc < phi(1); jc++) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo(0), jc, plo( 2)), pdat::NodeIndex::LUL); if (plo(0) == level_box.lower(0)) { @@ -670,7 +670,7 @@ int main( } } - for (kc = plo(2); kc < phi(2); kc++) { + for (kc = plo(2); kc < phi(2); ++kc) { ni = pdat::NodeIndex(hier::Index(plo(0), plo( 1), kc), pdat::NodeIndex::LLU); if (plo(0) == level_box.lower(0)) { @@ -950,28 +950,28 @@ int main( norm = cell_ops->sumControlVolumes(cvindx[0], cwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.5)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1, norm != 0.5\n"; } //pout << "Component 0 : " << norm << " = 0.5?" << std::endl; norm = face_ops->sumControlVolumes(fvindx[0], fwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.75)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2, norm != 0.75\n"; } //pout << "Component 1 : " << norm << " = 0.75?" << std::endl; norm = node_ops->sumControlVolumes(nvindx[0], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.25)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3, norm != 0.25\n"; } //pout << "Component 2 : " << norm << " = 0.25?" << std::endl; norm = node_ops->sumControlVolumes(nvindx[1], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.25)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4, norm != 0.25\n"; } //pout << "Component 3 : " << norm << " = 0.25?\n" << std::endl; @@ -1003,7 +1003,7 @@ int main( p_norm = N_VL1Norm(kvec0); //pout << "L1-norm of kvec0 is " << norm << " = 6.0?\n" << std::endl; if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5, L1-norm calculation\n"; } @@ -1025,7 +1025,7 @@ int main( p_min_val = N_VMin(kvec0); tbox::plog << "min of kvec0 is " << p_min_val << " = 2.0?\n" << std::endl; if (!tbox::MathUtilities::equalEps(my_min_val, p_min_val)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9, min val calculation\n"; } @@ -1037,7 +1037,7 @@ int main( double p_max_val; p_max_val = N_VMaxNorm(kvec1); if (!tbox::MathUtilities::equalEps(my_max_val, p_max_val)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10, reciprocal max val calculation\n"; } @@ -1052,8 +1052,9 @@ int main( ip != level_zero->end(); ++ip) { patch = *ip; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(cvindx[1])); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[1])); + TBOX_ASSERT(cdata); hier::Index cindex0(2, 2, 2); hier::Index cindex1(5, 3, 2); hier::Index cindex2(4, 2, 2); @@ -1071,8 +1072,9 @@ int main( (*cdata)(pdat::CellIndex(cindex3), 1) = -10.0; } - fdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(fvindx[1])); + fdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[1])); + TBOX_ASSERT(fdata); hier::Index findex0(2, 2, 2); hier::Index findex1(5, 3, 2); if (patch->getBox().contains(findex0)) { @@ -1089,19 +1091,23 @@ int main( hier::Index nindex0(2, 2, 2); hier::Index nindex1(5, 3, 2); if (patch->getBox().contains(nindex0)) { - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex0, pdat::NodeIndex::LLL)) = 300.0; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[3])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[3])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex0, pdat::NodeIndex::LUL)) = 30.0; } if (patch->getBox().contains(nindex1)) { - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex1, pdat::NodeIndex::UUL)) = -300.0; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[3])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[3])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex1, pdat::NodeIndex::ULL)) = -3300.0; } } @@ -1112,13 +1118,13 @@ int main( double max_val = my_vec1->max(); if (!tbox::MathUtilities::equalEps(max_val, (double)1100.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #11, max bogus value\n"; } double min_val = my_vec1->min(); if (!tbox::MathUtilities::equalEps(min_val, (double)-3300.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #12, min bogus value\n"; } @@ -1127,7 +1133,7 @@ int main( double p_dot; p_dot = N_VDotProd(kvec1, kvec1); if (!tbox::MathUtilities::equalEps(my_dot, p_dot)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #14, dot product calculation\n"; std::cout << "SGS " << my_dot << "," << p_dot << std::endl; } @@ -1135,44 +1141,44 @@ int main( my_norm = my_vec1->maxNorm(); p_norm = N_VMaxNorm(kvec1); if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #16, max norm calculation\n"; } N_VConst(twelve, kvec0); norm = my_vec1->weightedL2Norm(my_vec0); if (!tbox::MathUtilities::equalEps(norm, (double)7.6393717)) { - fail_count++; + ++fail_count; } norm = N_VWL2Norm(kvec1, kvec0); if (!tbox::MathUtilities::equalEps(norm, (double)7.6393717)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #17, weighted L2 norm calculation\n"; } norm = my_vec0->RMSNorm(); if (!tbox::MathUtilities::equalEps(norm, (double)12.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #18, RMS norm calculation\n"; } norm = my_vec0->weightedRMSNorm(my_vec1); if (!tbox::MathUtilities::equalEps(norm, (double)5.77482219887084)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #19, weighted RMS norm calculation\n"; } norm = N_VWrmsNorm(kvec0, kvec1); if (!tbox::MathUtilities::equalEps(norm, (double)5.77482219887084)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #19, weighted RMS norm calculation\n"; } // Vector test routines int test = my_vec0->testReciprocal(my_vec1); if (test != 1) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #20, reciprocal\n"; } @@ -1202,7 +1208,7 @@ int main( tbox::plog << "\nVariables and data components in new vector..."; int ncomp = sam_vec3->getNumberOfComponents(); - for (int ic = 0; ic < ncomp; ic++) { + for (int ic = 0; ic < ncomp; ++ic) { tbox::plog << "\n Comp id, variable, data id = " << ic << ", " << sam_vec3->getComponentVariable(ic)->getName() << ", " @@ -1299,19 +1305,19 @@ int main( my_vec1->freeVectorComponents(); my_vec2->freeVectorComponents(); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cwgt_id); hierarchy->getPatchLevel(ln)->deallocatePatchData(fwgt_id); hierarchy->getPatchLevel(ln)->deallocatePatchData(nwgt_id); } - for (iv = 0; iv < NCELL_VARS; iv++) { + for (iv = 0; iv < NCELL_VARS; ++iv) { cvar[iv].reset(); } - for (iv = 0; iv < NFACE_VARS; iv++) { + for (iv = 0; iv < NFACE_VARS; ++iv) { fvar[iv].reset(); } - for (iv = 0; iv < NNODE_VARS; iv++) { + for (iv = 0; iv < NNODE_VARS; ++iv) { nvar[iv].reset(); } cwgt.reset(); diff --git a/base/SAMRAI/SAMRAI/source/test/vector/pvtest.C b/base/SAMRAI/SAMRAI/source/test/vector/pvtest.C index 63f671e5..9408a761 100644 --- a/base/SAMRAI/SAMRAI/source/test/vector/pvtest.C +++ b/base/SAMRAI/SAMRAI/source/test/vector/pvtest.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program to test SAMRAI-PETSc vector interface. * ************************************************************************/ @@ -48,11 +48,7 @@ using namespace std; #include "SAMRAI/hier/VariableContext.h" #include "SAMRAI/hier/VariableDatabase.h" -#include - -#ifndef NULL -#define NULL (0) -#endif +#include "boost/shared_ptr.hpp" #define NCELL_VARS 2 #define NFACE_VARS 2 @@ -85,7 +81,7 @@ int main( // This problem fixed, DAH 9/19/2001. Problem arose from the PETSc // libs not having world readable and executable permisions. // Also added a matching PetscFinalize, to prevent memory leaks, etc. - PetscInitialize(&argc, &argv, (char *)NULL, NULL); + PetscInitialize(&argc, &argv, 0, 0); int ln, iv; @@ -112,15 +108,6 @@ int main( hier::Box fine7(hier::Index(8, 6, 6), hier::Index(13, 7, 7), blk0); hier::IntVector ratio(dim3d, 2); - coarse0.initialize(coarse0, hier::LocalId(0), 0); - coarse1.initialize(coarse1, hier::LocalId(1), 0); - coarse2.initialize(coarse2, hier::LocalId(2), 0); - coarse3.initialize(coarse3, hier::LocalId(3), 0); - coarse4.initialize(coarse4, hier::LocalId(4), 0); - coarse5.initialize(coarse5, hier::LocalId(5), 0); - coarse6.initialize(coarse6, hier::LocalId(6), 0); - coarse7.initialize(coarse7, hier::LocalId(7), 0); - hier::BoxContainer coarse_domain; hier::BoxContainer fine_boxes; coarse_domain.pushBack(coarse0); @@ -174,64 +161,67 @@ int main( const int n_coarse_boxes = coarse_domain.size(); const int n_fine_boxes = fine_boxes.size(); - hier::BoxLevel layer0(hier::IntVector(dim3d, 1), geometry); - hier::BoxLevel layer1(ratio, geometry); + boost::shared_ptr layer0( + boost::make_shared( + hier::IntVector(dim3d, 1), geometry)); + boost::shared_ptr layer1( + boost::make_shared(ratio, geometry)); - hier::BoxContainer::iterator coarse_domain_itr(coarse_domain); + hier::BoxContainer::iterator coarse_domain_itr = coarse_domain.begin(); if (nproc > 1) { - if (layer0.getMPI().getRank() == 0) { - for (int ib = 0; ib < n_coarse_boxes / 2; ib++, ++coarse_domain_itr) { - layer0.addBox(hier::Box(*coarse_domain_itr, + if (layer0->getMPI().getRank() == 0) { + for (int ib = 0; ib < n_coarse_boxes / 2; ++ib, ++coarse_domain_itr) { + layer0->addBox(hier::Box(*coarse_domain_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + layer0->getMPI().getRank())); } } else { - for (int ib = 0; ib < n_coarse_boxes / 2; ib++) { + for (int ib = 0; ib < n_coarse_boxes / 2; ++ib) { ++coarse_domain_itr; } - for (int ib = n_coarse_boxes / 2; ib < n_coarse_boxes; ib++, ++coarse_domain_itr) { - layer0.addBox(hier::Box(*coarse_domain_itr, + for (int ib = n_coarse_boxes / 2; ib < n_coarse_boxes; ++ib, ++coarse_domain_itr) { + layer0->addBox(hier::Box(*coarse_domain_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + layer0->getMPI().getRank())); } } } else { - for (int ib = 0; ib < n_coarse_boxes; ib++, ++coarse_domain_itr) { - layer0.addBox(hier::Box(*coarse_domain_itr, + for (int ib = 0; ib < n_coarse_boxes; ++ib, ++coarse_domain_itr) { + layer0->addBox(hier::Box(*coarse_domain_itr, hier::LocalId(ib), - layer0.getMPI().getRank())); + layer0->getMPI().getRank())); } } - hier::BoxContainer::iterator fine_boxes_itr(fine_boxes); + hier::BoxContainer::iterator fine_boxes_itr = fine_boxes.begin(); if (nproc > 1) { - if (layer1.getMPI().getRank() == 0) { - for (int ib = 0; ib < n_fine_boxes / 2; ib++, ++fine_boxes_itr) { - layer1.addBox(hier::Box(*fine_boxes_itr, + if (layer1->getMPI().getRank() == 0) { + for (int ib = 0; ib < n_fine_boxes / 2; ++ib, ++fine_boxes_itr) { + layer1->addBox(hier::Box(*fine_boxes_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + layer1->getMPI().getRank())); } } else { - for (int ib = 0; ib < n_fine_boxes / 2; ib++) { + for (int ib = 0; ib < n_fine_boxes / 2; ++ib) { ++fine_boxes_itr; } - for (int ib = n_fine_boxes / 2; ib < n_fine_boxes; ib++, ++fine_boxes_itr) { - layer1.addBox(hier::Box(*fine_boxes_itr, + for (int ib = n_fine_boxes / 2; ib < n_fine_boxes; ++ib, ++fine_boxes_itr) { + layer1->addBox(hier::Box(*fine_boxes_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + layer1->getMPI().getRank())); } } } else { - for (int ib = 0; ib < n_fine_boxes; ib++, ++fine_boxes_itr) { - layer1.addBox(hier::Box(*fine_boxes_itr, + for (int ib = 0; ib < n_fine_boxes; ++ib, ++fine_boxes_itr) { + layer1->addBox(hier::Box(*fine_boxes_itr, hier::LocalId(ib), - layer1.getMPI().getRank())); + layer1->getMPI().getRank())); } } @@ -294,24 +284,28 @@ int main( int nwgt_id = variable_db->registerVariableAndContext( nwgt, dummy, no_ghosts); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->allocatePatchData(cwgt_id); hierarchy->getPatchLevel(ln)->allocatePatchData(fwgt_id); hierarchy->getPatchLevel(ln)->allocatePatchData(nwgt_id); } boost::shared_ptr > cell_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(cwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(cwgt, hierarchy))); boost::shared_ptr > face_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(fwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(fwgt, hierarchy))); boost::shared_ptr > node_ops( - math::HierarchyDataOpsManager::getManager()->getOperationsDouble(nwgt, - hierarchy), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, + math::HierarchyDataOpsReal >( + math::HierarchyDataOpsManager::getManager()->getOperationsDouble(nwgt, hierarchy))); + + TBOX_ASSERT(cell_ops); + TBOX_ASSERT(face_ops); + TBOX_ASSERT(node_ops); cell_ops->resetLevels(0, 1); face_ops->resetLevels(0, 1); @@ -329,40 +323,44 @@ int main( // Initialize control volume data for cell-centered components - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double cell_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > cvdata( - patch->getPatchData(cwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(cwgt_id))); + TBOX_ASSERT(cvdata); cvdata->fillAll(cell_vol); if (ln == 0) cvdata->fillAll(0.0, (coarse_fine * patch->getBox())); } } // Initialize control volume data for face-centered components - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double face_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > data( - patch->getPatchData(fwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(fwgt_id))); + TBOX_ASSERT(data); data->fillAll(face_vol); pdat::FaceIndex fi(dim3d); int plo0 = patch->getBox().lower(0); @@ -385,8 +383,8 @@ int main( } //X face boundaries if (plo0 == level_box.lower(0)) { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(plo0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Lower); @@ -394,8 +392,8 @@ int main( } } } else { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(plo0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Lower); @@ -404,8 +402,8 @@ int main( } } if (phi0 == level_box.upper(0)) { - for (kc = plo2; kc <= phi2; kc++) { - for (jc = plo1; jc <= phi1; jc++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (jc = plo1; jc <= phi1; ++jc) { fi = pdat::FaceIndex(hier::Index(phi0, jc, kc), pdat::FaceIndex::X, pdat::FaceIndex::Upper); @@ -416,8 +414,8 @@ int main( //Y face boundaries if (plo1 == level_box.lower(1)) { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, plo1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); @@ -425,8 +423,8 @@ int main( } } } else { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, plo1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Lower); @@ -435,8 +433,8 @@ int main( } } if (phi1 == level_box.upper(1)) { - for (kc = plo2; kc <= phi2; kc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (kc = plo2; kc <= phi2; ++kc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, phi1, kc), pdat::FaceIndex::Y, pdat::FaceIndex::Upper); @@ -447,8 +445,8 @@ int main( //Z face boundaries if (plo2 == level_box.lower(2)) { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, plo2), pdat::FaceIndex::Z, pdat::FaceIndex::Lower); @@ -456,8 +454,8 @@ int main( } } } else { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, plo2), pdat::FaceIndex::Z, pdat::FaceIndex::Lower); @@ -466,8 +464,8 @@ int main( } } if (phi2 == level_box.upper(2)) { - for (jc = plo1; jc <= phi1; jc++) { - for (ic = plo0; ic <= phi0; ic++) { + for (jc = plo1; jc <= phi1; ++jc) { + for (ic = plo0; ic <= phi0; ++ic) { fi = pdat::FaceIndex(hier::Index(ic, jc, phi2), pdat::FaceIndex::Z, pdat::FaceIndex::Upper); @@ -478,19 +476,21 @@ int main( } } - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { boost::shared_ptr level( hierarchy->getPatchLevel(ln)); for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { patch = *ip; - pgeom = boost::dynamic_pointer_cast(patch->getPatchGeometry()); + pgeom = BOOST_CAST(patch->getPatchGeometry()); + TBOX_ASSERT(pgeom); const double* dx = pgeom->getDx(); const double node_vol = dx[0] * dx[1] * dx[2]; boost::shared_ptr > data( - patch->getPatchData(nwgt_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( + patch->getPatchData(nwgt_id))); + TBOX_ASSERT(data); data->fillAll(node_vol); pdat::NodeIndex ni(dim3d); hier::Index plo = patch->getBox().lower(); @@ -516,16 +516,16 @@ int main( //X faces if (plo(0) == level_box.lower(0)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo( 0), jc, kc), pdat::NodeIndex::LUU); (*data)(ni) *= bdry_face_factor; } } } else { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo( 0), jc, kc), pdat::NodeIndex::LUU); (*data)(ni) = 0.0; @@ -533,8 +533,8 @@ int main( } } if (phi(0) == level_box.upper(0)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (jc = plo(1); jc < phi(1); jc++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(phi( 0), jc, kc), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -544,16 +544,16 @@ int main( //Y faces if (plo(1) == level_box.lower(1)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo( 1), kc), pdat::NodeIndex::ULU); (*data)(ni) *= bdry_face_factor; } } } else { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo( 1), kc), pdat::NodeIndex::ULU); (*data)(ni) = 0.0; @@ -561,8 +561,8 @@ int main( } } if (phi(1) == level_box.upper(1)) { - for (kc = plo(2); kc < phi(2); kc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (kc = plo(2); kc < phi(2); ++kc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, phi( 1), kc), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -572,16 +572,16 @@ int main( //Z faces if (plo(2) == level_box.lower(2)) { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, plo( 2)), pdat::NodeIndex::UUL); (*data)(ni) *= bdry_face_factor; } } } else { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, plo( 2)), pdat::NodeIndex::UUL); (*data)(ni) = 0.0; @@ -589,8 +589,8 @@ int main( } } if (phi(2) == level_box.upper(2)) { - for (jc = plo(1); jc < phi(1); jc++) { - for (ic = plo(0); ic < phi(0); ic++) { + for (jc = plo(1); jc < phi(1); ++jc) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, jc, phi( 2)), pdat::NodeIndex::UUU); (*data)(ni) *= bdry_face_factor; @@ -599,7 +599,7 @@ int main( } // edge boundaries - for (ic = plo(0); ic < phi(0); ic++) { + for (ic = plo(0); ic < phi(0); ++ic) { ni = pdat::NodeIndex(hier::Index(ic, plo(1), plo( 2)), pdat::NodeIndex::ULL); if (plo(1) == level_box.lower(1)) { @@ -652,7 +652,7 @@ int main( } } - for (jc = plo(1); jc < phi(1); jc++) { + for (jc = plo(1); jc < phi(1); ++jc) { ni = pdat::NodeIndex(hier::Index(plo(0), jc, plo( 2)), pdat::NodeIndex::LUL); if (plo(0) == level_box.lower(0)) { @@ -705,7 +705,7 @@ int main( } } - for (kc = plo(2); kc < phi(2); kc++) { + for (kc = plo(2); kc < phi(2); ++kc) { ni = pdat::NodeIndex(hier::Index(plo(0), plo( 1), kc), pdat::NodeIndex::LLU); if (plo(0) == level_box.lower(0)) { @@ -985,28 +985,28 @@ int main( norm = cell_ops->sumControlVolumes(cvindx[0], cwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.5)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #1, norm != 0.5\n"; } //pout << "Component 0 : " << norm << " = 0.5?" << endl; norm = face_ops->sumControlVolumes(fvindx[0], fwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.75)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #2, norm != 0.75\n"; } //pout << "Component 1 : " << norm << " = 0.75?" << endl; norm = node_ops->sumControlVolumes(nvindx[0], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.25)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #3, norm != 0.25\n"; } //pout << "Component 2 : " << norm << " = 0.25?" << endl; norm = node_ops->sumControlVolumes(nvindx[1], nwgt_id); if (!tbox::MathUtilities::equalEps(norm, (double)0.25)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #4, norm != 0.25\n"; } //pout << "Component 3 : " << norm << " = 0.25?\n" << endl; @@ -1018,6 +1018,8 @@ int main( my_vec0); Vec pvec1 = solv::PETSc_SAMRAIVectorReal::createPETScVector( my_vec1); + Vec result = solv::PETSc_SAMRAIVectorReal::createPETScVector( + my_vec0); double zero = 0.0; double half = 0.5; @@ -1029,7 +1031,7 @@ int main( // my_vec0 = 2.0 my_vec0->setToScalar(2.0); - VecView(pvec0, ((PetscViewer)NULL)); + VecView(pvec0, 0); double my_norm; double p_norm; @@ -1039,7 +1041,7 @@ int main( VecNorm(pvec0, NORM_1, &p_norm); //pout << "L1-norm of pvec0 is " << norm << " = 6.0?\n" << endl; if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #5, L1-norm calculation\n"; } l1_norm = my_norm; @@ -1048,7 +1050,7 @@ int main( my_norm = my_vec0->L2Norm(); VecNorm(pvec0, NORM_2, &p_norm); if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #6, L2-norm calculation\n"; } l2_norm = my_norm; @@ -1056,11 +1058,11 @@ int main( double both_norms[2]; VecNorm(pvec0, NORM_1_AND_2, both_norms); if (!tbox::MathUtilities::equalEps(both_norms[0], l1_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #7, both norms calculation, L1-norm\n"; } if (!tbox::MathUtilities::equalEps(both_norms[1], l2_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #8, both norms calculation, L2-norm\n"; } //pout << "Both norms of pvec0: " << both_norms[0] << " and " @@ -1087,7 +1089,7 @@ int main( VecMin(pvec0, &dummy1, &min_val); tbox::plog << "min of pvec0 is " << min_val << " = 2.0?\n" << endl; if (!tbox::MathUtilities::equalEps(my_min_val, p_min_val)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #9, min val calculation\n"; } @@ -1099,7 +1101,7 @@ int main( double p_max_val; VecMax(pvec1, &dummy1, &p_max_val); if (!tbox::MathUtilities::equalEps(my_max_val, p_max_val)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #10, reciprocal max val calculation\n"; } @@ -1114,8 +1116,9 @@ int main( ip != level_zero->end(); ++ip) { patch = *ip; - cdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(cvindx[1])); + cdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(cvindx[1])); + TBOX_ASSERT(cdata); hier::Index cindex0(2, 2, 2); hier::Index cindex1(5, 3, 2); hier::Index cindex2(4, 2, 2); @@ -1133,8 +1136,9 @@ int main( (*cdata)(pdat::CellIndex(cindex3), 1) = -10.0; } - fdata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(fvindx[1])); + fdata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(fvindx[1])); + TBOX_ASSERT(fdata); hier::Index findex0(2, 2, 2); hier::Index findex1(5, 3, 2); if (patch->getBox().contains(findex0)) { @@ -1151,19 +1155,23 @@ int main( hier::Index nindex0(2, 2, 2); hier::Index nindex1(5, 3, 2); if (patch->getBox().contains(nindex0)) { - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex0, pdat::NodeIndex::LLL)) = 300.0; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[3])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[3])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex0, pdat::NodeIndex::LUL)) = 30.0; } if (patch->getBox().contains(nindex1)) { - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[2])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[2])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex1, pdat::NodeIndex::UUL)) = -300.0; - ndata = boost::dynamic_pointer_cast, - hier::PatchData>(patch->getPatchData(nvindx[3])); + ndata = BOOST_CAST, + hier::PatchData>(patch->getPatchData(nvindx[3])); + TBOX_ASSERT(ndata); (*ndata)(pdat::NodeIndex(nindex1, pdat::NodeIndex::ULL)) = -3300.0; } } @@ -1174,20 +1182,20 @@ int main( double max_val = my_vec1->max(); if (!tbox::MathUtilities::equalEps(max_val, (double)1100.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #11, max bogus value\n"; } min_val = my_vec1->min(); if (!tbox::MathUtilities::equalEps(min_val, (double)-3300.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #12, min bogus value\n"; } my_norm = my_vec1->L2Norm(); VecNorm(pvec1, NORM_2, &p_norm); if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #13, L2-norm calculation\n"; } @@ -1196,33 +1204,33 @@ int main( double p_dot; VecDot(pvec1, pvec1, &p_dot); if (!tbox::MathUtilities::equalEps(my_dot, p_dot)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #14, dot product calculation\n"; } VecTDot(pvec1, pvec1, &p_dot); if (!tbox::MathUtilities::equalEps(my_dot, p_dot)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #15, T-dot product calculation\n"; } my_norm = my_vec1->maxNorm(); VecNorm(pvec1, NORM_INFINITY, &p_norm); if (!tbox::MathUtilities::equalEps(my_norm, p_norm)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #16, max norm calculation\n"; } VecSet(pvec0, twelve); norm = my_vec1->weightedL2Norm(my_vec0); if (!tbox::MathUtilities::equalEps(norm, (double)7.6393717)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #17, weighted L2 norm calculation\n"; } norm = my_vec0->RMSNorm(); if (!tbox::MathUtilities::equalEps(norm, (double)12.0)) { - fail_count++; + ++fail_count; tbox::perr << "FAILED: - Test #18, RMS norm calculation\n"; } @@ -1271,7 +1279,7 @@ int main( tbox::plog << "\nVariables and data components in new vector..."; int ncomp = sam_vec3->getNumberOfComponents(); - for (int ic = 0; ic < ncomp; ic++) { + for (int ic = 0; ic < ncomp; ++ic) { tbox::plog << "\n Comp id, variable, data id = " << ic << ", " << sam_vec3->getComponentVariable(ic)->getName() << ", " @@ -1283,27 +1291,27 @@ int main( variable_db->printClassData(tbox::plog); tbox::plog << "pvec3 = Random....?" << endl; - VecView(pvec3, ((PetscViewer)NULL)); + VecView(pvec3, 0); VecSwap(pvec0, pvec3); tbox::plog << "After swapping pvec0 and pvec3, pvec0 = Random....?" << endl; - VecView(pvec0, ((PetscViewer)NULL)); + VecView(pvec0, 0); tbox::plog << "pvec3 = 2.0 on L0 (-1.0 in covered region), = 3.0 pn L1?" << endl; - VecView(pvec3, ((PetscViewer)NULL)); + VecView(pvec3, 0); VecAXPY(pvec0, four, pvec3); tbox::plog << "pvec0 = pvec0 + 4.0 * pvec3 = Random + 8.0 on L0 (-3.0 - Random in covered region), = 12.0 + Random on L1?" << endl; - VecView(pvec0, ((PetscViewer)NULL)); + VecView(pvec0, 0); VecScale(pvec3, half); tbox::plog << "pvec3 = 1.0 on L0 (-0.5 in covered region), = 1.5 pn L1?" << endl; - VecView(pvec3, ((PetscViewer)NULL)); + VecView(pvec3, 0); VecSet(pvec0, one); VecSet(pvec1, two); @@ -1311,19 +1319,19 @@ int main( VecAXPBY(pvec0, three, half, pvec1); tbox::plog << "pvec0 = 3 * 2 + 0.5 * 1 = 6.5?" << endl; - VecView(pvec0, ((PetscViewer)NULL)); + VecView(pvec0, 0); VecAYPX(pvec1, twelve, pvec0); tbox::plog << "pvec1 = 6.5 + 12 * 2 = 30.5?" << endl; - VecView(pvec1, ((PetscViewer)NULL)); + VecView(pvec1, 0); - VecWAXPY(pvec0, zero, pvec0, pvec0); + VecWAXPY(result, zero, pvec0, pvec0); tbox::plog << "pvec0 = 0 * 6.5 + 6.5 = 6.5?" << endl; - VecView(pvec0, ((PetscViewer)NULL)); + VecView(result, 0); // No more tests....Destroy vectors and data... - VecDestroy(pvec3); + VecDestroy(&pvec3); tbox::plog << "\n\nPRINTING VARIABLE DATABASE after freeing new vector" << endl; @@ -1333,25 +1341,26 @@ int main( solv::PETSc_SAMRAIVectorReal::destroyPETScVector(pvec0); solv::PETSc_SAMRAIVectorReal::destroyPETScVector(pvec1); solv::PETSc_SAMRAIVectorReal::destroyPETScVector(pvec2); + solv::PETSc_SAMRAIVectorReal::destroyPETScVector(result); // Deallocate vector data and control volumes my_vec0->freeVectorComponents(); my_vec1->freeVectorComponents(); my_vec2->freeVectorComponents(); - for (ln = 0; ln < 2; ln++) { + for (ln = 0; ln < 2; ++ln) { hierarchy->getPatchLevel(ln)->deallocatePatchData(cwgt_id); hierarchy->getPatchLevel(ln)->deallocatePatchData(fwgt_id); hierarchy->getPatchLevel(ln)->deallocatePatchData(nwgt_id); } - for (iv = 0; iv < NCELL_VARS; iv++) { + for (iv = 0; iv < NCELL_VARS; ++iv) { cvar[iv].reset(); } - for (iv = 0; iv < NFACE_VARS; iv++) { + for (iv = 0; iv < NFACE_VARS; ++iv) { fvar[iv].reset(); } - for (iv = 0; iv < NNODE_VARS; iv++) { + for (iv = 0; iv < NNODE_VARS; ++iv) { nvar[iv].reset(); } cwgt.reset(); diff --git a/base/SAMRAI/SAMRAI/tools/Makefile.in b/base/SAMRAI/SAMRAI/tools/Makefile.in index 69b0b652..1088c150 100644 --- a/base/SAMRAI/SAMRAI/tools/Makefile.in +++ b/base/SAMRAI/SAMRAI/tools/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for the tools directory ## ######################################################################### diff --git a/base/SAMRAI/SAMRAI/tools/restart/Makefile.depend b/base/SAMRAI/SAMRAI/tools/restart/Makefile.depend index ad967a37..f3f70ccc 100644 --- a/base/SAMRAI/SAMRAI/tools/restart/Makefile.depend +++ b/base/SAMRAI/SAMRAI/tools/restart/Makefile.depend @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile dependencies ## ######################################################################### @@ -16,22 +16,20 @@ DEPENDS_0:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ RedistributedRestartUtility.C RedistributedRestartUtility.h -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_0 +=\ -endif -${FILE_0:X.o=${NDIM}.o}: ${DEPENDS_0} + +${FILE_0}: ${DEPENDS_0} FILE_1=main.o DEPENDS_1:=\ $(OBJECT)/include/SAMRAI/SAMRAI_config.h \ RedistributedRestartUtility.h main.C -ifeq (${DEPENDS_ON_TEMPLATE_IMPLEMENTATION},yes) DEPENDS_1 +=\ -endif -${FILE_1:X.o=${NDIM}.o}: ${DEPENDS_1} + +${FILE_1}: ${DEPENDS_1} diff --git a/base/SAMRAI/SAMRAI/tools/restart/Makefile.in b/base/SAMRAI/SAMRAI/tools/restart/Makefile.in index 0145defe..714f5d26 100644 --- a/base/SAMRAI/SAMRAI/tools/restart/Makefile.in +++ b/base/SAMRAI/SAMRAI/tools/restart/Makefile.in @@ -3,7 +3,7 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Description: makefile for SAMRAI patch hierarchy refine/coarsen tests ## ######################################################################### @@ -29,12 +29,8 @@ restart-redistribute: $(CXX_OBJS) $(LIBSAMRAIDEPEND) tools: restart-redistribute - -clean-check: - $(RM) restart-resdistribute - $(SAMCLEAN) - -clean: clean-check - $(RM) redo +clean: + $(CLEAN_COMMON_TEST_FILES) + $(RM) restart-redistribute include $(SRCDIR)/Makefile.depend diff --git a/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.C b/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.C index 7b275876..17e374cf 100644 --- a/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.C +++ b/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ @@ -32,49 +32,78 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( const string& input_dirname, const int total_input_files, const int total_output_files, - const tbox::Array >& file_mapping, + const std::vector >& file_mapping, const int restore_num) { - int num_files_written = 0; - int num_iterations = tbox::MathUtilities::Min(total_input_files, - total_output_files); + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + int nprocs = mpi.getSize(); + int rank = mpi.getRank(); + int output_files_per_proc = total_output_files / nprocs; + int extra_output_files = total_output_files % nprocs; + int num_files_written; + if (total_input_files < total_output_files) { + num_files_written = file_mapping[0][0]; + } else { + num_files_written = output_files_per_proc * rank; + if (extra_output_files) { + if (rank >= extra_output_files) { + num_files_written += extra_output_files; + } else { + num_files_written += rank; + } + } + } + int num_iterations = static_cast(file_mapping.size()); - for (int icount = 0; icount < num_iterations; icount++) { + for (int icount = 0; icount < num_iterations; ++icount) { //We are writing to one file or reading only one file int num_files_to_read = (total_input_files < total_output_files) ? - 1 : file_mapping[icount].size(); + 1 : static_cast(file_mapping[icount].size()); int num_files_to_write = (total_input_files < total_output_files) ? - file_mapping[icount].size() : 1; + static_cast(file_mapping[icount].size()) : 1; - string restore_buf; - string nodes_buf; - - restore_buf = "/restore." + tbox::Utilities::intToString(restore_num, 6); - nodes_buf = "/nodes." + tbox::Utilities::nodeToString(total_output_files); + string restore_buf = + "/restore." + tbox::Utilities::intToString(restore_num, 6); + string nodes_buf = + "/nodes." + tbox::Utilities::nodeToString(total_output_files); string restart_dirname = output_dirname + restore_buf + nodes_buf; //Make the subdirectories if this is the first iteration. if (icount == 0) { tbox::Utilities::recursiveMkdir(restart_dirname); + tbox::SAMRAI_MPI::getSAMRAIWorld().Barrier(); } //Mount the output files on an array of output databases - tbox::Array > + std::vector > output_dbs(num_files_to_write); - string proc_buf; - for (int j = 0; j < num_files_to_write; j++) { + for (int i = 0; i < num_files_to_write; ++i) { - proc_buf = "/proc." + tbox::Utilities::processorToString( - num_files_written + j); + int cur_out_file_id; + if (total_input_files < total_output_files) { + cur_out_file_id = file_mapping[icount][i]; + } else { + cur_out_file_id = (output_files_per_proc * rank) + icount; + if (extra_output_files) { + if (rank >= extra_output_files) { + cur_out_file_id += extra_output_files; + } else { + cur_out_file_id += rank; + } + } + } + + string proc_buf = + "/proc." + tbox::Utilities::processorToString(cur_out_file_id); string output_filename = restart_dirname + proc_buf; - output_dbs[j].reset(new tbox::HDFDatabase(output_filename)); + output_dbs[i].reset(new tbox::HDFDatabase(output_filename)); - int open_success = output_dbs[j]->create(output_filename); + int open_success = output_dbs[i]->create(output_filename); if (open_success < 0) { TBOX_ERROR( @@ -86,27 +115,35 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( } //Mount the input files on an array of input databases. - tbox::Array > + std::vector > input_dbs(num_files_to_read); nodes_buf = "/nodes." + tbox::Utilities::nodeToString(total_input_files); - tbox::Array input_keys(0); - tbox::Array test_keys(0); + std::vector input_keys(0); + std::vector test_keys(0); int num_keys = 0; - for (int i = 0; i < num_files_to_read; i++) { + int input_files_per_proc = total_input_files / nprocs; + int extra_input_files = total_input_files % nprocs; + for (int i = 0; i < num_files_to_read; ++i) { int cur_in_file_id; if (total_input_files < total_output_files) { - //cur_in_file_id = num_files_written; - cur_in_file_id = icount; + cur_in_file_id = (input_files_per_proc * rank) + icount; + if (extra_input_files) { + if (rank >= extra_input_files) { + cur_in_file_id += extra_input_files; + } else { + cur_in_file_id += rank; + } + } } else { cur_in_file_id = file_mapping[icount][i]; } - proc_buf = "/proc." + tbox::Utilities::processorToString( - cur_in_file_id); + string proc_buf = + "/proc." + tbox::Utilities::processorToString(cur_in_file_id); string restart_filename = input_dirname + restore_buf + nodes_buf + proc_buf; @@ -125,10 +162,10 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( //Get the array of input keys. if (i == 0) { input_keys = input_dbs[i]->getAllKeys(); - num_keys = input_keys.size(); + num_keys = static_cast(input_keys.size()); } else { test_keys = input_dbs[i]->getAllKeys(); - if (test_keys.size() != num_keys) { + if (static_cast(test_keys.size()) != num_keys) { TBOX_ERROR("Input files contain differing number of keys"); } } @@ -136,10 +173,10 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( //For every input key, call the recursive function that reads from the //input databases and writes to output databases. - for (int j = 0; j < num_keys; j++) { + for (int i = 0; i < num_keys; ++i) { readAndWriteRestartData(output_dbs, input_dbs, - input_keys[j], + input_keys[i], &file_mapping, num_files_written, icount, @@ -148,12 +185,11 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( } //Unmount the databases. This closes the files. - int k; - for (k = 0; k < num_files_to_read; k++) { - input_dbs[k]->close(); + for (int i = 0; i < num_files_to_read; ++i) { + input_dbs[i]->close(); } - for (k = 0; k < num_files_to_write; k++) { - output_dbs[k]->close(); + for (int i = 0; i < num_files_to_write; ++i) { + output_dbs[i]->close(); } num_files_written += num_files_to_write; @@ -167,12 +203,12 @@ void RedistributedRestartUtility::writeRedistributedRestartFiles( */ void RedistributedRestartUtility::readAndWriteRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& input_dbs, + std::vector >& output_dbs, + const std::vector >& input_dbs, const string& key, - const tbox::Array >* file_mapping, // = NULL + const std::vector >* file_mapping, // = 0 const int num_files_written, // = -1, - const int input_proc_num, // = -1 + const int which_file_mapping, // = -1 const int total_input_files, // = -1, const int total_output_files) // = -1);); { @@ -192,6 +228,10 @@ void RedistributedRestartUtility::readAndWriteRestartData( //can be read from input_dbs[0] and written to every element of output_dbs. //The Database case is handled separately. + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + int nprocs = mpi.getSize(); + int rank = mpi.getRank(); + if (input_dbs[0]->isDatabase(key)) { boost::shared_ptr db = input_dbs[0]->getDatabase(key); @@ -201,26 +241,38 @@ void RedistributedRestartUtility::readAndWriteRestartData( //Here we are handling the input database(s) for a PatchLevel. //Create array of level input databases. - tbox::Array > level_in_dbs; - level_in_dbs.resizeArray(input_dbs.size()); + std::vector > level_in_dbs( + input_dbs.size()); - for (int i = 0; i < input_dbs.size(); i++) { + for (int i = 0; i < static_cast(input_dbs.size()); ++i) { level_in_dbs[i] = input_dbs[i]->getDatabase(key); } //input_proc_nums is an array that contains all of the processor //numbers that created the input databases that are currently //being processed. - tbox::Array input_proc_nums; + std::vector input_proc_nums; if (total_input_files < total_output_files) { - input_proc_nums.resizeArray(1); + input_proc_nums.resize(1); + int output_files_per_proc = total_output_files / nprocs; + int extra_output_files = total_output_files % nprocs; + int input_proc_num = + (output_files_per_proc * rank) + which_file_mapping; + if (extra_output_files) { + if (rank >= extra_output_files) { + input_proc_num += extra_output_files; + } else { + input_proc_num += rank; + } + } input_proc_nums[0] = input_proc_num; } else { - input_proc_nums = (*file_mapping)[num_files_written]; + input_proc_nums = (*file_mapping)[which_file_mapping]; } //Call routine to write output according to the new processor mapping - readAndWritePatchLevelRestartData(output_dbs, level_in_dbs, + readAndWritePatchLevelRestartData(output_dbs, + level_in_dbs, key, num_files_written, input_proc_nums, @@ -230,25 +282,37 @@ void RedistributedRestartUtility::readAndWriteRestartData( db->getBool("d_is_mapped_box_level")) { //Create array of level input databases. - tbox::Array > level_in_dbs; - level_in_dbs.resizeArray(input_dbs.size()); + std::vector > level_in_dbs( + input_dbs.size()); - for (int i = 0; i < input_dbs.size(); i++) { + for (int i = 0; i < static_cast(input_dbs.size()); ++i) { level_in_dbs[i] = input_dbs[i]->getDatabase(key); } //input_proc_nums is an array that contains all of the processor //numbers that created the input databases that are currently //being processed. - tbox::Array input_proc_nums; + std::vector input_proc_nums; if (total_input_files < total_output_files) { - input_proc_nums.resizeArray(1); + input_proc_nums.resize(1); + int output_files_per_proc = total_output_files / nprocs; + int extra_output_files = total_output_files % nprocs; + int input_proc_num = + (output_files_per_proc * rank) + which_file_mapping; + if (extra_output_files) { + if (rank >= extra_output_files) { + input_proc_num += extra_output_files; + } else { + input_proc_num += rank; + } + } input_proc_nums[0] = input_proc_num; } else { - input_proc_nums = (*file_mapping)[num_files_written]; + input_proc_nums = (*file_mapping)[which_file_mapping]; } - readAndWriteBoxLevelRestartData(output_dbs, level_in_dbs, + readAndWriteBoxLevelRestartData(output_dbs, + level_in_dbs, key, num_files_written, input_proc_nums, @@ -267,117 +331,102 @@ void RedistributedRestartUtility::readAndWriteRestartData( //for input_dbs and output_dbs, and then call readAndWriteRestartData //recursively. - tbox::Array > child_in_dbs; - child_in_dbs.resizeArray(input_dbs.size()); + std::vector > child_in_dbs( + input_dbs.size()); - for (int i = 0; i < input_dbs.size(); i++) { + for (int i = 0; i < static_cast(input_dbs.size()); ++i) { child_in_dbs[i] = input_dbs[i]->getDatabase(key); } - tbox::Array > child_out_dbs; - child_out_dbs.resizeArray(output_dbs.size()); + std::vector > child_out_dbs( + output_dbs.size()); - for (int i = 0; i < output_dbs.size(); i++) { + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { child_out_dbs[i] = output_dbs[i]->putDatabase(key); } - tbox::Array child_keys = db->getAllKeys(); + std::vector child_keys = db->getAllKeys(); - for (int j = 0; j < child_keys.size(); j++) { + for (int j = 0; j < static_cast(child_keys.size()); ++j) { readAndWriteRestartData(child_out_dbs, child_in_dbs, child_keys[j], file_mapping, num_files_written, - input_proc_num, + which_file_mapping, total_input_files, total_output_files); } } } else if (input_dbs[0]->isInteger(key)) { - tbox::Array int_array(0); - - int_array = input_dbs[0]->getIntegerArray(key); + std::vector int_array = input_dbs[0]->getIntegerVector(key); - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putIntegerArray(key, int_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putIntegerVector(key, int_array); } } else if (input_dbs[0]->isDouble(key)) { - tbox::Array double_array(0); + std::vector double_array = input_dbs[0]->getDoubleVector(key); - double_array = input_dbs[0]->getDoubleArray(key); - - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putDoubleArray(key, double_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putDoubleVector(key, double_array); } } else if (input_dbs[0]->isBool(key)) { - tbox::Array bool_array(0); - - bool_array = input_dbs[0]->getBoolArray(key); + std::vector bool_array = input_dbs[0]->getBoolVector(key); if (key == "d_write_edges_for_restart") { - for (int j = 0; j < bool_array.size(); j++) { + for (int j = 0; j < static_cast(bool_array.size()); ++j) { bool_array[j] = false; } } - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putBoolArray(key, bool_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putBoolVector(key, bool_array); } } else if (input_dbs[0]->isDatabaseBox(key)) { - tbox::Array box_array(0); - - box_array = input_dbs[0]->getDatabaseBoxArray(key); + std::vector box_array = + input_dbs[0]->getDatabaseBoxVector(key); - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putDatabaseBoxArray(key, box_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putDatabaseBoxVector(key, box_array); } } else if (input_dbs[0]->isString(key)) { - tbox::Array string_array(0); + std::vector string_array = input_dbs[0]->getStringVector(key); - string_array = input_dbs[0]->getStringArray(key); - - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putStringArray(key, string_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putStringVector(key, string_array); } } else if (input_dbs[0]->isComplex(key)) { - tbox::Array complex_array(0); - - complex_array = input_dbs[0]->getComplexArray(key); + std::vector complex_array = input_dbs[0]->getComplexVector(key); - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putComplexArray(key, complex_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putComplexVector(key, complex_array); } } else if (input_dbs[0]->isChar(key)) { - tbox::Array char_array(0); + std::vector char_array = input_dbs[0]->getCharVector(key); - char_array = input_dbs[0]->getCharArray(key); - - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putCharArray(key, char_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putCharVector(key, char_array); } } else if (input_dbs[0]->isFloat(key)) { - tbox::Array float_array(0); - - float_array = input_dbs[0]->getFloatArray(key); + std::vector float_array = input_dbs[0]->getFloatVector(key); - for (int i = 0; i < output_dbs.size(); i++) { - output_dbs[i]->putFloatArray(key, float_array); + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { + output_dbs[i]->putFloatVector(key, float_array); } } else { @@ -396,11 +445,11 @@ void RedistributedRestartUtility::readAndWriteRestartData( */ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& level_in_dbs, + std::vector >& output_dbs, + const std::vector >& level_in_dbs, const string& key, const int num_files_written, - const tbox::Array& input_proc_nums, + const std::vector& input_proc_nums, const int total_output_files) { #ifdef DEBUG_CHECK_ASSERTIONS @@ -410,66 +459,66 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( #endif //Create an array of level output databases - tbox::Array > level_out_dbs; - level_out_dbs.resizeArray(output_dbs.size()); + std::vector > level_out_dbs( + output_dbs.size()); - for (int i = 0; i < output_dbs.size(); i++) { + for (int i = 0; i < static_cast(output_dbs.size()); ++i) { level_out_dbs[i] = output_dbs[i]->putDatabase(key); } //Read in data that is global to every processor bool is_patch_level = level_in_dbs[0]->getBool("d_is_patch_level"); int version = level_in_dbs[0]->getInteger("HIER_PATCH_LEVEL_VERSION"); - tbox::Array box_array(0); + std::vector box_array(0); if (level_in_dbs[0]->keyExists("d_boxes")) { - level_in_dbs[0]->getDatabaseBoxArray("d_boxes"); + level_in_dbs[0]->getDatabaseBoxVector("d_boxes"); } - tbox::Array ratio_to_zero = - level_in_dbs[0]->getIntegerArray("d_ratio_to_level_zero"); + std::vector ratio_to_zero = + level_in_dbs[0]->getIntegerVector("d_ratio_to_level_zero"); int number_blocks = level_in_dbs[0]->getInteger("d_number_blocks"); - tbox::Array > physical_domain(number_blocks); - for (int nb = 0; nb < number_blocks; nb++) { + std::vector > physical_domain(number_blocks); + for (int nb = 0; nb < number_blocks; ++nb) { std::string domain_name = "d_physical_domain_" + tbox::Utilities::blockToString(nb); physical_domain[nb] = - level_in_dbs[0]->getDatabaseBoxArray(domain_name); + level_in_dbs[0]->getDatabaseBoxVector(domain_name); } int level_number = level_in_dbs[0]->getInteger("d_level_number"); int next_coarser_level = level_in_dbs[0]->getInteger("d_next_coarser_level_number"); bool in_hierarchy = level_in_dbs[0]->getBool("d_in_hierarchy"); - tbox::Array ratio_to_coarser = - level_in_dbs[0]->getIntegerArray("d_ratio_to_coarser_level"); + std::vector ratio_to_coarser = + level_in_dbs[0]->getIntegerVector("d_ratio_to_coarser_level"); - const int out_size = level_out_dbs.size(); + const int out_size = static_cast(level_out_dbs.size()); //Write out global data. - for (int i = 0; i < out_size; i++) { + for (int i = 0; i < out_size; ++i) { level_out_dbs[i]->putBool("d_is_patch_level", is_patch_level); level_out_dbs[i]->putInteger("HIER_PATCH_LEVEL_VERSION", version); if (box_array.size() > 0) { - level_out_dbs[i]->putDatabaseBoxArray("d_boxes", box_array); + level_out_dbs[i]->putDatabaseBoxVector("d_boxes", box_array); } - level_out_dbs[i]->putIntegerArray("d_ratio_to_level_zero", + level_out_dbs[i]->putIntegerVector("d_ratio_to_level_zero", ratio_to_zero); level_out_dbs[i]->putInteger("d_number_blocks", number_blocks); - for (int nb = 0; nb < number_blocks; nb++) { + for (int nb = 0; nb < number_blocks; ++nb) { std::string domain_name = "d_physical_domain_" + tbox::Utilities::blockToString(nb); - level_out_dbs[i]->putDatabaseBoxArray(domain_name, + level_out_dbs[i]->putDatabaseBoxVector(domain_name, physical_domain[nb]); } level_out_dbs[i]->putInteger("d_level_number", level_number); level_out_dbs[i]->putInteger("d_next_coarser_level_number", next_coarser_level); level_out_dbs[i]->putBool("d_in_hierarchy", in_hierarchy); - level_out_dbs[i]->putIntegerArray("d_ratio_to_coarser_level", + level_out_dbs[i]->putIntegerVector("d_ratio_to_coarser_level", ratio_to_coarser); } - tbox::Array > + std::vector > mapped_box_level_dbs_in(input_proc_nums.size()); std::list local_indices_used; @@ -477,7 +526,7 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( //Each iteration of this loop processes the patches from one input //database. - for (int i = 0; i < input_proc_nums.size(); i++) { + for (int i = 0; i < static_cast(input_proc_nums.size()); ++i) { boost::shared_ptr mbl_database = level_in_dbs[i]->getDatabase("mapped_box_level"); @@ -487,18 +536,18 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( boost::shared_ptr mapped_boxes_db = mbl_database->getDatabase("mapped_boxes"); - tbox::Array local_indices(0); + std::vector local_indices(0); if (mapped_boxes_db->keyExists("local_indices")) { - local_indices = mapped_boxes_db->getIntegerArray("local_indices"); + local_indices = mapped_boxes_db->getIntegerVector("local_indices"); } - tbox::Array block_ids(0); + std::vector block_ids(0); if (mapped_boxes_db->keyExists("block_ids")) { - block_ids = mapped_boxes_db->getIntegerArray("block_ids"); + block_ids = mapped_boxes_db->getIntegerVector("block_ids"); } //This list will contain all of the patch numbers that came from a //single processor. - int mbs_size = local_indices.size(); + int mbs_size = static_cast(local_indices.size()); std::list input_local_patch_nums; std::list input_local_block_ids; std::list output_local_patch_nums; @@ -506,10 +555,10 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( int max_local_indices = 0; int min_local_indices = tbox::MathUtilities::getMax(); - for (int j = 0; j < mbs_size; j++) { + for (int j = 0; j < mbs_size; ++j) { bool new_patch_num = true; for (std::list::iterator p(input_local_patch_nums.begin()); - p != input_local_patch_nums.end(); p++) { + p != input_local_patch_nums.end(); ++p) { if (*p == local_indices[j]) { new_patch_num = false; break; @@ -525,17 +574,17 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( bool recompute_local_patch_nums = false; if (local_indices_used.size() == 0) { for (std::list::iterator ni(input_local_patch_nums.begin()); - ni != input_local_patch_nums.end(); ni++) { + ni != input_local_patch_nums.end(); ++ni) { local_indices_used.push_front(*ni); max_index_used = tbox::MathUtilities::Max(max_index_used, *ni); } } else { for (std::list::iterator ni(input_local_patch_nums.begin()); - ni != input_local_patch_nums.end(); ni++) { + ni != input_local_patch_nums.end(); ++ni) { bool repeat_found = false; for (std::list::iterator li(local_indices_used.begin()); - li != local_indices_used.end(); li++) { + li != local_indices_used.end(); ++li) { if (*ni == *li) { repeat_found = true; break; @@ -544,7 +593,7 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( if (repeat_found) { recompute_local_patch_nums = true; int new_value = max_index_used + 1; - for (int a = 0; a < mbs_size; a++) { + for (int a = 0; a < mbs_size; ++a) { if (local_indices[a] == *ni) { local_indices[a] = new_value; } @@ -560,11 +609,11 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( } if (recompute_local_patch_nums) { - for (int j = 0; j < mbs_size; j++) { + for (int j = 0; j < mbs_size; ++j) { bool new_patch_num = true; for (std::list::iterator p(output_local_patch_nums.begin()); p != output_local_patch_nums.end(); - p++) { + ++p) { if (*p == local_indices[j]) { new_patch_num = false; break; @@ -584,7 +633,7 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( output_local_block_ids = input_local_block_ids; } - for (int j = 0; j < mbs_size; j++) { + for (int j = 0; j < mbs_size; ++j) { max_local_indices = tbox::MathUtilities::Max(max_local_indices, local_indices[j]); min_local_indices = tbox::MathUtilities::Min(min_local_indices, @@ -599,8 +648,8 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( min_local_indices = 0; } - tbox::Array output_dist_cutoff(out_size); - for (int j = 0; j < out_size; j++) { + std::vector output_dist_cutoff(out_size); + for (int j = 0; j < out_size; ++j) { output_dist_cutoff[j] = min_local_indices + j * (indices_range / out_size); } @@ -614,19 +663,18 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( for (std::list::iterator ilp(input_local_patch_nums.begin()); ilp != input_local_patch_nums.end(); ) { int output_id = 0; - for (int a = 1; a < out_size; a++) { + for (int a = 1; a < out_size; ++a) { if (*olp > output_dist_cutoff[a]) { output_id = a; } } - string in_patch_name; - string out_patch_name; - in_patch_name = "level_" + tbox::Utilities::levelToString(level_number) + string in_patch_name = + "level_" + tbox::Utilities::levelToString(level_number) + "-patch_" + tbox::Utilities::patchToString(*ilp) + "-block_" + tbox::Utilities::blockToString(*ilb); - out_patch_name = "level_" + tbox::Utilities::levelToString( - level_number) + string out_patch_name = + "level_" + tbox::Utilities::levelToString(level_number) + "-patch_" + tbox::Utilities::patchToString(*olp) + "-block_" + tbox::Utilities::blockToString(*olb); @@ -639,10 +687,10 @@ void RedistributedRestartUtility::readAndWritePatchLevelRestartData( int output_proc = num_files_written + output_id; readAndWritePatchRestartData(patch_out_db, patch_in_db, output_proc); - ilp++; - olp++; - ilb++; - olb++; + ++ilp; + ++olp; + ++ilb; + ++olb; } } @@ -665,18 +713,18 @@ void RedistributedRestartUtility::readAndWritePatchRestartData( const int output_proc) { //Get the keys in the patch input database. - tbox::Array keys = patch_in_db->getAllKeys(); + std::vector keys = patch_in_db->getAllKeys(); //Place the database on arrays of length 1. - tbox::Array > in_db_array(1); - tbox::Array > out_db_array(1); + std::vector > in_db_array(1); + std::vector > out_db_array(1); in_db_array[0] = patch_in_db; out_db_array[0] = patch_out_db; //Call recursive function to read and write the data associated with each //key. - for (int i = 0; i < keys.size(); i++) { + for (int i = 0; i < static_cast(keys.size()); ++i) { if (keys[i] == "d_patch_owner") { patch_out_db->putInteger(keys[i], output_proc); } else { @@ -692,11 +740,11 @@ void RedistributedRestartUtility::readAndWritePatchRestartData( */ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& level_in_dbs, + std::vector >& output_dbs, + const std::vector >& level_in_dbs, const string& key, const int num_files_written, - const tbox::Array& input_proc_nums, + const std::vector& input_proc_nums, const int total_output_files) { #ifdef DEBUG_CHECK_ASSERTIONS @@ -705,27 +753,36 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( assert(level_in_dbs.size() == 1 || output_dbs.size() == 1); #endif - const int out_size = output_dbs.size(); + const int out_size = static_cast(output_dbs.size()); //Create an array of level output databases - tbox::Array > level_out_dbs; - level_out_dbs.resizeArray(out_size); + std::vector > level_out_dbs(out_size); - for (int i = 0; i < out_size; i++) { + for (int i = 0; i < out_size; ++i) { level_out_dbs[i] = output_dbs[i]->putDatabase(key); } bool is_mapped_box_level = level_in_dbs[0]->getBool("d_is_mapped_box_level"); int version = level_in_dbs[0]->getInteger("HIER_MAPPED_BOX_LEVEL_VERSION"); int dim = level_in_dbs[0]->getInteger("dim"); - tbox::Array ratio = level_in_dbs[0]->getIntegerArray("d_ratio"); - - for (int i = 0; i < out_size; i++) { + std::vector > ratio; + int b = 0; + for ( ; ; ++b ) { + string ratio_name = "d_ratio_" + tbox::Utilities::intToString(b); + if (level_in_dbs[0]->isInteger(ratio_name)) { + ratio.push_back(level_in_dbs[0]->getIntegerVector(ratio_name)); + } else { + break; + } + } + for (int i = 0; i < out_size; ++i) { level_out_dbs[i]->putBool("d_is_mapped_box_level", is_mapped_box_level); level_out_dbs[i]->putInteger("HIER_MAPPED_BOX_LEVEL_VERSION", version); level_out_dbs[i]->putInteger("dim", dim); - level_out_dbs[i]->putIntegerArray("d_ratio", ratio); - + for (int nb = 0; nb < static_cast(ratio.size()); ++nb) { + string ratio_name = "d_ratio_" + tbox::Utilities::intToString(nb); + level_out_dbs[i]->putIntegerVector(ratio_name, ratio[nb]); + } level_out_dbs[i]->putInteger("d_nproc", total_output_files); level_out_dbs[i]->putInteger("d_rank", num_files_written + i); } @@ -734,50 +791,57 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( std::vector* out_ranks = new std::vector[out_size]; std::vector* out_periodic_ids = new std::vector[out_size]; + std::vector* out_block_ids = new std::vector[out_size]; - tbox::Array* out_box_array = - new tbox::Array[out_size]; + std::vector* out_box_array = + new std::vector[out_size]; int out_vec_size = 0; - tbox::Array out_mbs_size(out_size, 0); + std::vector out_mbs_size(out_size, 0); std::list local_indices_used; int max_index_used = 0; //Each iteration of this loop processes the patches from one input //database. - for (int i = 0; i < input_proc_nums.size(); i++) { + version = level_in_dbs[0]->getDatabase("mapped_boxes")->getInteger( + "HIER_BOX_CONTAINER_VERSION"); + for (int i = 0; i < static_cast(input_proc_nums.size()); ++i) { boost::shared_ptr mapped_boxes_in_db = level_in_dbs[i]->getDatabase("mapped_boxes"); int mbs_size = mapped_boxes_in_db->getInteger("mapped_box_set_size"); - tbox::Array local_indices; - tbox::Array ranks; - tbox::Array periodic_ids; - tbox::Array boxes; + std::vector local_indices; + std::vector ranks; + std::vector periodic_ids; + std::vector block_ids; + std::vector boxes; if (mapped_boxes_in_db->keyExists("local_indices")) { - local_indices = mapped_boxes_in_db->getIntegerArray("local_indices"); + local_indices = mapped_boxes_in_db->getIntegerVector("local_indices"); } if (mapped_boxes_in_db->keyExists("ranks")) { - ranks = mapped_boxes_in_db->getIntegerArray("ranks"); + ranks = mapped_boxes_in_db->getIntegerVector("ranks"); } if (mapped_boxes_in_db->keyExists("periodic_ids")) { periodic_ids = - mapped_boxes_in_db->getIntegerArray("periodic_ids"); + mapped_boxes_in_db->getIntegerVector("periodic_ids"); + } + if (mapped_boxes_in_db->keyExists("block_ids")) { + block_ids = mapped_boxes_in_db->getIntegerVector("block_ids"); } if (mapped_boxes_in_db->keyExists("boxes")) { - boxes = mapped_boxes_in_db->getDatabaseBoxArray("boxes"); + boxes = mapped_boxes_in_db->getDatabaseBoxVector("boxes"); } if (out_size == 1) { std::list new_indices; - for (int k = 0; k < mbs_size; k++) { + for (int k = 0; k < mbs_size; ++k) { bool is_new_index = true; for (std::list::iterator ni(new_indices.begin()); - ni != new_indices.end(); ni++) { + ni != new_indices.end(); ++ni) { if (local_indices[k] == *ni) { is_new_index = false; break; @@ -789,18 +853,18 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( } if (local_indices_used.size() == 0) { for (std::list::iterator ni(new_indices.begin()); - ni != new_indices.end(); ni++) { + ni != new_indices.end(); ++ni) { local_indices_used.push_front(*ni); max_index_used = tbox::MathUtilities::Max(max_index_used, *ni); } } else { for (std::list::iterator ni(new_indices.begin()); - ni != new_indices.end(); ni++) { + ni != new_indices.end(); ++ni) { bool repeat_found = false; for (std::list::iterator li(local_indices_used.begin()); li != local_indices_used.end(); - li++) { + ++li) { if (*ni == *li) { repeat_found = true; break; @@ -808,7 +872,7 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( } if (repeat_found) { int new_value = max_index_used + 1; - for (int a = 0; a < mbs_size; a++) { + for (int a = 0; a < mbs_size; ++a) { if (local_indices[a] == *ni) { local_indices[a] = new_value; } @@ -826,7 +890,7 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( int max_local_indices = 0; int min_local_indices = tbox::MathUtilities::getMax(); - for (int j = 0; j < mbs_size; j++) { + for (int j = 0; j < mbs_size; ++j) { max_local_indices = tbox::MathUtilities::Max(max_local_indices, local_indices[j]); min_local_indices = tbox::MathUtilities::Min(min_local_indices, @@ -835,8 +899,8 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( int indices_range = max_local_indices - min_local_indices; - tbox::Array output_dist_cutoff(out_size); - for (int j = 0; j < out_size; j++) { + std::vector output_dist_cutoff(out_size); + for (int j = 0; j < out_size; ++j) { output_dist_cutoff[j] = min_local_indices + j * (indices_range / out_size); } @@ -844,59 +908,57 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( if (mbs_size > 0) { out_vec_size += mbs_size; - tbox::Array output_ids(mbs_size); + std::vector output_ids(mbs_size); - for (int k = 0; k < mbs_size; k++) { + for (int k = 0; k < mbs_size; ++k) { output_ids[k] = 0; - for (int a = 1; a < out_size; a++) { + for (int a = 1; a < out_size; ++a) { if (local_indices[k] > output_dist_cutoff[a]) { output_ids[k] = a; } } } - for (int j = 0; j < out_size; j++) { + for (int j = 0; j < out_size; ++j) { out_local_indices[j].reserve(out_vec_size); out_ranks[j].reserve(out_vec_size); out_periodic_ids[j].reserve(out_vec_size); + out_block_ids[j].reserve(out_vec_size); - out_box_array[j].resizeArray(out_vec_size); - for (int k = 0; k < mbs_size; k++) { + out_box_array[j].reserve(out_vec_size); + for (int k = 0; k < mbs_size; ++k) { if (output_ids[k] == j) { int output_rank = num_files_written + output_ids[k]; out_local_indices[j].push_back(local_indices[k]); out_ranks[j].push_back(output_rank); - out_periodic_ids[j].push_back( - periodic_ids[k]); - out_box_array[j][out_mbs_size[j]++] = boxes[k]; + out_periodic_ids[j].push_back(periodic_ids[k]); + out_block_ids[j].push_back(block_ids[k]); + out_box_array[j].push_back(boxes[k]); + ++out_mbs_size[j]; } } } } } - for (int j = 0; j < out_size; j++) { + for (int j = 0; j < out_size; ++j) { boost::shared_ptr mapped_boxes_out_db = level_out_dbs[j]->putDatabase("mapped_boxes"); - mapped_boxes_out_db-> - putInteger("HIER_MAPPED_BOX_SET_VERSION", version); - mapped_boxes_out_db-> - putInteger("mapped_box_set_size", out_mbs_size[j]); + mapped_boxes_out_db->putInteger("HIER_BOX_CONTAINER_VERSION", version); + mapped_boxes_out_db->putInteger("mapped_box_set_size", out_mbs_size[j]); if (out_mbs_size[j]) { - mapped_boxes_out_db-> - putIntegerArray("local_indices", - &out_local_indices[j][0], - out_mbs_size[j]); - mapped_boxes_out_db-> - putIntegerArray("periodic_ids", - &out_periodic_ids[j][0], - out_mbs_size[j]); - mapped_boxes_out_db-> - putIntegerArray("ranks", &out_ranks[j][0], out_mbs_size[j]); - mapped_boxes_out_db-> - putDatabaseBoxArray("boxes", &out_box_array[j][0], out_mbs_size[j]); + mapped_boxes_out_db->putIntegerVector("local_indices", + out_local_indices[j]); + mapped_boxes_out_db->putIntegerVector("periodic_ids", + out_periodic_ids[j]); + mapped_boxes_out_db->putIntegerVector("block_ids", + out_block_ids[j]); + mapped_boxes_out_db->putIntegerVector("ranks", + out_ranks[j]); + mapped_boxes_out_db->putDatabaseBoxVector("boxes", + out_box_array[j]); } } @@ -904,9 +966,10 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( delete[] out_local_indices; delete[] out_ranks; delete[] out_periodic_ids; + delete[] out_block_ids; delete[] out_box_array; /* - * for (int j = 0; j < out_size; j++) { + * for (int j = 0; j < out_size; ++j) { * std::vector out_local_indices; * std::vector out_ranks; * std::vector out_periodic_ids; @@ -914,12 +977,12 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( * out_ranks.reserve(mbs_size); * out_periodic_ids.reserve(mbs_size); * - * tbox::Array out_box_array(mbs_size); + * std::vector out_box_array(mbs_size); * * int out_mbs_size = 0; - * for (int k = 0; k < mbs_size; k++) { + * for (int k = 0; k < mbs_size; ++k) { * int output_id = 0; - * for (int a = 1; a < out_size; a++) { + * for (int a = 1; a < out_size; ++a) { * if (local_indices[k] > output_dist_cutoff[a]) { * output_id = a; * } @@ -937,23 +1000,17 @@ void RedistributedRestartUtility::readAndWriteBoxLevelRestartData( * level_out_dbs[j]->putDatabase("mapped_boxes"); * * mapped_boxes_out_db-> - * putInteger("HIER_MAPPED_BOX_SET_VERSION", version); + * putInteger("HIER_BOX_CONTAINER_VERSION", version); * mapped_boxes_out_db-> * putInteger("mapped_box_set_size", out_mbs_size); * * if (out_mbs_size) { - * mapped_boxes_out_db-> - * putIntegerArray("local_indices", - * &out_local_indices[0], - * out_mbs_size); - * mapped_boxes_out_db-> - * putIntegerArray("periodic_ids", - * &out_periodic_ids[0], - * out_mbs_size); - * mapped_boxes_out_db-> - * putIntegerArray("ranks", &out_ranks[0], out_mbs_size); - * mapped_boxes_out_db-> - * putDatabaseBoxArray("boxes", &out_box_array[0], out_mbs_size); + * mapped_boxes_out_db->putIntegerVector("local_indices", + * out_local_indices); + * mapped_boxes_out_db->putIntegerVector("periodic_ids" + * out_periodic_ids); + * mapped_boxes_out_db->putIntegerVector("ranks", out_ranks); + * mapped_boxes_out_db->putDatabaseBoxVector("boxes", out_box_array); * * } * } diff --git a/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.h b/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.h index 06c38c65..83164ff2 100644 --- a/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.h +++ b/base/SAMRAI/SAMRAI/tools/restart/RedistributedRestartUtility.h @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: $Description * ************************************************************************/ @@ -12,7 +12,6 @@ #ifdef HAVE_HDF5 -#include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/HDFDatabase.h" #include @@ -47,7 +46,7 @@ class RedistributedRestartUtility const string& input_dirname, const int total_input_files, const int total_output_files, - const tbox::Array >& file_mapping, + const std::vector >& file_mapping, const int restore_num); private: @@ -67,12 +66,12 @@ class RedistributedRestartUtility */ static void readAndWriteRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& input_dbs, + std::vector >& output_dbs, + const std::vector >& input_dbs, const string& key, - const tbox::Array >* file_mapping = NULL, + const std::vector >* file_mapping = 0, int num_files_written = -1, - int input_proc_num = -1, + int which_file_mapping = -1, int total_input_files = -1, int total_output_files = -1); @@ -83,11 +82,11 @@ class RedistributedRestartUtility */ static void readAndWritePatchLevelRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& level_in_dbs, + std::vector >& output_dbs, + const std::vector >& level_in_dbs, const string& key, const int num_files_written, - const tbox::Array& input_proc_nums, + const std::vector& input_proc_nums, const int total_output_files); /* @@ -97,11 +96,11 @@ class RedistributedRestartUtility */ static void readAndWriteBoxLevelRestartData( - tbox::Array >& output_dbs, - const tbox::Array >& level_in_dbs, + std::vector >& output_dbs, + const std::vector >& level_in_dbs, const string& key, const int num_files_written, - const tbox::Array& input_proc_nums, + const std::vector& input_proc_nums, const int total_output_files); /* diff --git a/base/SAMRAI/SAMRAI/tools/restart/main.C b/base/SAMRAI/SAMRAI/tools/restart/main.C index cd4855ca..fdba72be 100644 --- a/base/SAMRAI/SAMRAI/tools/restart/main.C +++ b/base/SAMRAI/SAMRAI/tools/restart/main.C @@ -3,7 +3,7 @@ * This file is part of the SAMRAI distribution. For full copyright * information, see COPYRIGHT and COPYING.LESSER. * - * Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC * Description: Main program restart-redistribute tool. * ************************************************************************/ @@ -24,7 +24,10 @@ #include #include #include + +#ifdef HAVE_UNISTD_H #include +#endif #ifndef _MSC_VER #include @@ -234,36 +237,60 @@ int main( // file_mapping will have size equal to the lesser value of // num_input_files and num_output_files. - tbox::Array > file_mapping; - int file_ratio; - int remainder; + std::vector > file_mapping; + int smaller, larger; if (num_output_files > num_input_files) { - file_mapping.resizeArray(num_input_files); - file_ratio = num_output_files / num_input_files; - remainder = num_output_files % num_input_files; + smaller = num_input_files; + larger = num_output_files; } else { - file_mapping.resizeArray(num_output_files); - file_ratio = num_input_files / num_output_files; - remainder = num_input_files % num_output_files; + smaller = num_output_files; + larger = num_input_files; + } + const tbox::SAMRAI_MPI& mpi(tbox::SAMRAI_MPI::getSAMRAIWorld()); + int nprocs = mpi.getSize(); + int rank = mpi.getRank(); + if (nprocs > smaller) { + TBOX_ERROR("The number of processes must be equal to the smaller of\n" + << "the number of input files an the number of output files." + << std::endl); + } + int file_ratio = larger / smaller; + int remainder = larger % smaller; + int files_per_each_proc = smaller / nprocs; + int extra_files = smaller % nprocs; + int my_file_mapping_size = files_per_each_proc; + if (rank < extra_files) { + ++my_file_mapping_size; } + file_mapping.resize(my_file_mapping_size); int file_counter = 0; // fill file_mapping. - int i; - for (i = 0; i < file_mapping.size(); i++) { - if (i < remainder) { - file_mapping[i].resizeArray(file_ratio + 1); - for (int j = 0; j <= file_ratio; j++) { - file_mapping[i][j] = file_counter + j; - } - file_counter += file_ratio + 1; - } else { - file_mapping[i].resizeArray(file_ratio); - for (int j = 0; j < file_ratio; j++) { - file_mapping[i][j] = file_counter + j; + for (int i = 0; i <= rank; ++i) { + int this_file_mapping_size = files_per_each_proc; + if (i < extra_files) { + ++this_file_mapping_size; + } + for (int j = 0; j < this_file_mapping_size; j++) { + if (remainder > 0) { + if (i == rank) { + file_mapping[j].resize(file_ratio + 1); + for (int k = 0; k <= file_ratio; k++) { + file_mapping[j][k] = file_counter + k; + } + } + file_counter += file_ratio + 1; + --remainder; + } else { + if (i == rank) { + file_mapping[j].resize(file_ratio); + for (int k = 0; k < file_ratio; k++) { + file_mapping[j][k] = file_counter + k; + } + } + file_counter += file_ratio; } - file_counter += file_ratio; } } @@ -280,6 +307,7 @@ int main( tbox::SAMRAIManager::shutdown(); tbox::SAMRAIManager::finalize(); + tbox::SAMRAI_MPI::finalize(); return 0; diff --git a/base/SAMRAI/SAMRAI/tools/scripts/README b/base/SAMRAI/SAMRAI/tools/scripts/README index 25096a33..4f80f8ac 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/README +++ b/base/SAMRAI/SAMRAI/tools/scripts/README @@ -3,50 +3,10 @@ ## This file is part of the SAMRAI distribution. For full copyright ## information, see COPYRIGHT and COPYING.LESSER. ## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: vizamrai_cat.sh +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC +## Description: Contents of tools/scripts. ## ######################################################################### -vizamrai_cat.sh: - -Shell script which constructs a single vizamrai file from files -constructed on multiple processors - -usage: sh vizamrai_cat.sh - - Where is the rootname of the .vis file collection. - - example: vizamrai_cat.sh euler.00000 - - will collect euler.00000.vis.00000 euler.00000.vis.00001 - into euler.vis for a 2 processor run." - - ---------------------------------------------------------------------- -vizamrai_multistep.pl: - -Perl script which invokes vizamrai_cat.sh on a series of different -timesteps - -usage: %> perl vizamrai_multistep.pl - %> (e.g. euler..vis., enter 'euler') - %> - %> - - example: perl vizamrai_multistep.pl - euler - 0000 - 0025 - - will collect euler.[0000-0025].vis.[procs] and construct - euler.[0000-0025].vis - -NOTE: vizamrai_multistep.pl invokes vizamrai_cat.sh so it must be - able to find this file. By default, it looks in the directory - you are running from. You may change the $vizamrai_cat_dir variable - in the file to point to a different location. - ---------------------------------------------------------------------- insure++.psrc Config file for Insure++ to unsuppress warnings/errors that should diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/algs.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/algs.data index d2e34741..e0ef2e71 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/algs.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/algs.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/appu.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/appu.data index 70eea481..68eafcca 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/appu.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/appu.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/convert2.0 b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/convert2.0 index b92f1bdd..73b4dc27 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/convert2.0 +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/convert2.0 @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: shell script to convert 1.x codes to 2.0 ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/geom.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/geom.data index b952b94c..69fafc92 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/geom.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/geom.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/hier.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/hier.data index 5afe4b52..443ed595 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/hier.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/hier.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/math.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/math.data index f97c6b86..2cf8d1fd 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/math.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/math.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mblk.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mblk.data index 33463ac1..763dfdc7 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mblk.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mblk.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mesh.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mesh.data index 2c86f21d..03fa874b 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mesh.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/mesh.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend index e76cdc89..d992d390 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: shell script to convert 1.x codes to 2.0 ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend.pl index 18c4dabb..47a5f0e2 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/packagePrefixPrepend.pl @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: perl script to update Xd sed files to templates on DIM ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/pdat.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/pdat.data index 2585ef33..7fd9f1e7 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/pdat.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/pdat.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/renameXd.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/renameXd.pl index 05e53969..19282967 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/renameXd.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/renameXd.pl @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: perl script to update Xd sed files to templates on DIM ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox index e5f6fd19..713e6342 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: shell script to run rename X class names to template on ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox.pl index d2fa3b10..9a2bfcc9 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/rename_tbox.pl @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: perl script to update Xd sed files to templates on DIM ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/solv.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/solv.data index 18f7658c..c4ebd7ef 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/solv.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/solv.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox.data index c753cb9d..dcd12740 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox_classes.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox_classes.data index 5e1e4c64..945709c3 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox_classes.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/tbox_classes.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/xfer.data b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/xfer.data index 76c99eb8..2b5d04c1 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/xfer.data +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.0/xfer.data @@ -1,7 +1,7 @@ ## ## File: $URL$ ## Package: SAMRAI build scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision$ ## Description: data file for sed substitutions to generate dim-dep. files ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/convert2.3 b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/convert2.3 index beaa19d3..b2d74408 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/convert2.3 +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/convert2.3 @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/tools/scripts/conversion2.0/convert2.0 $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: shell script to convert 1.x codes to 2.0 ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/renameGetNumberMethods.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/renameGetNumberMethods.pl index 16b6d89e..06c05ee6 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/renameGetNumberMethods.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/renameGetNumberMethods.pl @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/tools/scripts/conversion2.0/renameXd.pl $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: perl script to rename getNumber methods to be getNumberOf ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards index 5562f86a..5c1f120a 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/source/scripts/source_manipulation/replaceIncludeGuards $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: shell script to convert 1.x codes to 2.0 ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards.pl index c2f4d1d4..1d1f028e 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion2.3/replaceIncludeGuards.pl @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/source/scripts/source_manipulation/replaceIncludeGuards.pl $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: perl script to update Xd sed files to templates on DIM ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths index 30c4b1d1..87ca8512 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/source/scripts/source_manipulation/replaceIncludeGuards $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: shell script to insert package name in #includes ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths.pl index 9a229022..5a90585d 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/convertIncludePaths.pl @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/source/scripts/source_manipulation/replaceIncludeGuards.pl $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: perl script to insert the package prefix in #includes ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/createDimClassData.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/createDimClassData.pl index 72886c1e..4f8a9640 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/createDimClassData.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/createDimClassData.pl @@ -2,7 +2,7 @@ ## ## File: $URL$ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: Create list of classes templated on DIM. Run in v2 ## directory to generate files. diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim index 7bf4609c..80870a92 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/source/scripts/source_manipulation/replaceIncludeGuards $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: shell script to insert package name in #includes ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim.pl b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim.pl index e53f7898..ac1c9149 100755 --- a/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim.pl +++ b/base/SAMRAI/SAMRAI/tools/scripts/conversion3.0/removeTemplateOnDim.pl @@ -2,7 +2,7 @@ ## ## File: $URL: file:///usr/casc/samrai/repository/SAMRAI/trunk/tools/scripts/conversion2.0/renameXd.pl $ ## Package: SAMRAI scripts -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC +## Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC ## Revision: $LastChangedRevision: 1917 $ ## Description: perl script to rename getNumber methods to be getNumberOf ## diff --git a/base/SAMRAI/SAMRAI/tools/scripts/insure++.psrc b/base/SAMRAI/SAMRAI/tools/scripts/insure++.psrc index c68579fb..3067eb1a 100644 --- a/base/SAMRAI/SAMRAI/tools/scripts/insure++.psrc +++ b/base/SAMRAI/SAMRAI/tools/scripts/insure++.psrc @@ -173,6 +173,8 @@ insure++.leaksummaryfilter -! * PetscHeaderCreate_Private * insure++.leaksummaryfilter -! * PetscViewerASCIIGetStdout * insure++.leaksummaryfilter -! * VecInitializePackage * insure++.leaksummaryfilter -! * PETSC_VIEWER_STDOUT_ * +insure++.leaksummaryfilter -! * PetscGetUserName * +insure++.leaksummaryfilter -! * PetscMallocAlign * # SILO insure++.leaksummaryfilter -! * _lite_PD_init_chrt * @@ -189,6 +191,10 @@ insure++.suppress USER_ERROR { qsort lite_SC_string_sort lite_PD_ls PJ_ls db_pdb # SILO is xstating a file during creation; assume it knows what it is doing to handle file not found. insure++.suppress RETURN_FAILURE { __xstat64() DBCreateReal() * } +#WJA 3/18/13 +#stl_bvector copies data into uninitialized memory which is OK +insure++.suppress READ_UNINIT_MEM(read) at stl_bvector.h + ############################################################################## # Suppress warnings in SAMRAI # These should all include documentation on why it is valid to @@ -236,17 +242,15 @@ suppress COPY_WILD { yy_load_buffer_state *} suppress COPY_WILD { yyparse *} suppress COPY_WILD { delete_list * } -suppress COPY_WILD in ReferenceCounter.C:47 - -# SGS 7/11/11 -# This looks to be just an Insure++ STL error. The object in question -# is the root node which has just been pushed then popped off of the queue -suppress COPY_WILD in BergerRigoutsosNode.C:395 - # SGS 7/12/11 # Insure++ is getting confused by this code; causing bogus leaks to be detected. file_ignore BoxTree.C +# WJA 2/27/13 +# Something in the TreeCommunication performance test is confusing Insure++. +suppress READ_DANGLING {* testUpThenDown *} +suppress WRITE_DANGLING {* testUpThenDown *} + #============================================================================= # These lines should improve insure++ performance but will result in # less valuable information on finding the location of leaks. By @@ -290,3 +294,5 @@ file_ignore BoxTree.C # WJA LIBC bug? insure++.suppress FREE_NULL { * vfprintf * } + +insure++.suppress COPY_DANGLING {* SAMRAI::solv::CellPoissonHypreSolver::copyToHypre *} diff --git a/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_cat.sh b/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_cat.sh deleted file mode 100644 index 0246379c..00000000 --- a/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_cat.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: -## -######################################################################### -if [ $1 = "-h" ] -then - echo "usage: $0 filename" - echo - echo "Where filename is the rootname of the .vis file collection." - echo " example $0 euler.00000" - echo "will collect euler.00000.vis.00000 euler.00000.vis.00001 into euler.vis" - echo "for a 2 processor run." - echo - - exit 0 -fi - -# First cat all the files together -rm -f $1.vis -FILES=`ls $1.vis.[0-9]*` -for i in $FILES -do - cat $i >> $1.vis -done -echo - -# Remove files -for i in $FILES -do - rm -f $i -done - - - diff --git a/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_multistep.pl b/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_multistep.pl deleted file mode 100644 index 269efff1..00000000 --- a/base/SAMRAI/SAMRAI/tools/scripts/vizamrai_multistep.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl - -######################################################################### -## -## This file is part of the SAMRAI distribution. For full copyright -## information, see COPYRIGHT and COPYING.LESSER. -## -## Copyright: (c) 1997-2012 Lawrence Livermore National Security, LLC -## Description: Perl script for running the vizamrai_cat.sh script -## on multiple timesteps. -## -######################################################################### - -# -# Determine path to vizamrai_cat.sh script -# - # below line just sets the dirname where this perl file is located - ($dirname = $0) =~ s:[^/]+$::; $dirname = '.' unless "$dirname"; - # the vizamrai_cat.sh file is presumed to be located in the same directory - $vizamrai_cat = "$dirname/vizamrai_cat.sh"; - - if (!((-e $vizamrai_cat) && (-r $vizamrai_cat))) { - die "ERROR: cannot find $vizamrai_cat"; - } -# -# Read file basename -# - print "File basename (e.g. euler..vis., enter 'euler'):"; - $basename = ; - chop($basename); - print "Start Timestep (include zeros - e.g. 00000-00025, enter '00000'): "; - $start = ; - chop($start); - print "End Timestep: "; - $end = ; - chop($end); - - $length = length($start); -# -# Loop over files -# - $inc = 1; - for ($tstep = $start; $tstep <= $end; $tstep = $tstep + $inc) { - $newlength = length($tstep); - while ($newlength < $length) { - $tstep = "0$tstep"; - } continue { - $newlength = length($tstep); - } - $firstfile = "$basename.$tstep.vis.00000"; - if (-e $firstfile) { - system("/bin/sh $vizamrai_cat $basename.$tstep"); - print "Created $basename.$tstep ...\n"; - } else { - print "$basename.$tstep.vis. - files don't exist\n"; - } - } - print "Done. \n"; diff --git a/config/doinstall.in b/config/doinstall.in index b9274741..4cfbc047 100644 --- a/config/doinstall.in +++ b/config/doinstall.in @@ -2,13 +2,13 @@ # Configure and install Sundials pushd @BASE_DIR@/sundials -doconfig -doinstall +./doconfig +./doinstall popd # Configure and install SAMRAI pushd @SAMCONFDIR@ -doconfig -doinstall +./doconfig +./doinstall popd diff --git a/scripts/doconfig_cades_gnu_dbg b/scripts/doconfig_cades_gnu_dbg new file mode 100755 index 00000000..49833f36 --- /dev/null +++ b/scripts/doconfig_cades_gnu_dbg @@ -0,0 +1,17 @@ +#!/bin/sh +module purge +module load PE-gnu +module load hdf5 +module load netcdf +module load hypre +module load boost + +./configure --enable-debug \ + --with-CXX=mpiCC \ + --with-CC=mpicc \ + --with-F77=mpif77 \ + --with-boost=$BOOST_DIR \ + --with-hdf5=$HDF5_DIR \ + --with-hypre=$HYPRE_DIR \ + --with-netcdf=$NETCDF_DIR \ + --prefix=$PWD/build diff --git a/scripts/doconfig_cades_gnu_opt b/scripts/doconfig_cades_gnu_opt new file mode 100755 index 00000000..6a316fb4 --- /dev/null +++ b/scripts/doconfig_cades_gnu_opt @@ -0,0 +1,17 @@ +#!/bin/sh +module purge +module load PE-gnu +module load hdf5 +module load netcdf +module load hypre +module load boost + +./configure --disable-debug --enable-opt \ + --with-CXX=mpiCC \ + --with-CC=mpicc \ + --with-F77=mpif77 \ + --with-boost=$BOOST_DIR \ + --with-hdf5=$HDF5_DIR \ + --with-hypre=$HYPRE_DIR \ + --with-netcdf=$NETCDF_DIR \ + --prefix=$PWD/build diff --git a/source/AzizPartitionCoefficientStrategy.C b/source/AzizPartitionCoefficientStrategy.C index 8336ef0d..21b0905d 100644 --- a/source/AzizPartitionCoefficientStrategy.C +++ b/source/AzizPartitionCoefficientStrategy.C @@ -40,8 +40,8 @@ void AzizPartitionCoefficientStrategy::evaluate( { const hier::Box& patch_box = patch.getBox(); - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; double temperature=(*cd_temperature)(ccell); diff --git a/source/BiasDoubleWellFreeEnergyStrategy.C b/source/BiasDoubleWellFreeEnergyStrategy.C index f282b0f6..b7165dbd 100644 --- a/source/BiasDoubleWellFreeEnergyStrategy.C +++ b/source/BiasDoubleWellFreeEnergyStrategy.C @@ -76,15 +76,15 @@ void BiasDoubleWellFreeEnergyStrategy::addComponentRhsPhi( (void) f_a_id; // unused boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > temp ( - patch.getPatchData(temperature_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(temperature_id) ) ); assert( temp ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -94,7 +94,7 @@ void BiasDoubleWellFreeEnergyStrategy::addComponentRhsPhi( d_meltingTstrat->evaluate(patch); boost::shared_ptr< pdat::CellData > eq_temp ( - patch.getPatchData(d_meltingTstrat->equilibrium_temperature_id() ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(d_meltingTstrat->equilibrium_temperature_id() ) ) ); assert( eq_temp ); #ifdef DEBUG_CHECK_ASSERTIONS SAMRAI::math::PatchCellDataNormOpsReal ops; diff --git a/source/CALPHADFreeEnergyStrategy.C b/source/CALPHADFreeEnergyStrategy.C index 8e2d0b23..f325b7f8 100644 --- a/source/CALPHADFreeEnergyStrategy.C +++ b/source/CALPHADFreeEnergyStrategy.C @@ -356,13 +356,13 @@ void CALPHADFreeEnergyStrategy::computeFreeEnergyPrivate( const hier::Box& pbox = patch.getBox(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > f ( - patch.getPatchData( f_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_id) ) ); boost::shared_ptr< pdat::CellData > c_i ( - patch.getPatchData( conc_i_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( conc_i_id) ) ); computeFreeEnergyPrivatePatch( pbox, @@ -390,13 +390,13 @@ void CALPHADFreeEnergyStrategy::computeDerivFreeEnergyPrivate( const hier::Box& pbox = patch.getBox(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > df ( - patch.getPatchData( df_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( df_id) ) ); boost::shared_ptr< pdat::CellData > c_i ( - patch.getPatchData( conc_i_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( conc_i_id) ) ); computeDerivFreeEnergyPrivatePatch( pbox, @@ -644,31 +644,31 @@ void CALPHADFreeEnergyStrategy::addComponentRhsPhi( } boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > t ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( t ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > c_l ( - patch.getPatchData( d_conc_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_id) ) ); assert( c_l ); boost::shared_ptr< pdat::CellData > c_a ( - patch.getPatchData( d_conc_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_id) ) ); assert( c_a ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -917,43 +917,43 @@ void CALPHADFreeEnergyStrategy::addComponentRhsEta( assert( f_b_id >= 0 ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); assert( eta ); boost::shared_ptr< pdat::CellData > t ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( t ); boost::shared_ptr< pdat::CellData > f_l ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( f_l ); boost::shared_ptr< pdat::CellData > f_a ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( f_a ); boost::shared_ptr< pdat::CellData > f_b ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); assert( f_b ); boost::shared_ptr< pdat::CellData > c_l ( - patch.getPatchData( d_conc_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_id) ) ); assert( c_l ); boost::shared_ptr< pdat::CellData > c_a ( - patch.getPatchData( d_conc_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_id) ) ); assert( c_a ); boost::shared_ptr< pdat::CellData > c_b ( - patch.getPatchData( d_conc_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_b_id) ) ); assert( c_b ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); const hier::Box& pbox = patch.getBox(); diff --git a/source/CALPHADequilibriumPhaseConcentrationsStrategy.C b/source/CALPHADequilibriumPhaseConcentrationsStrategy.C index 7b56a7f1..7791de93 100644 --- a/source/CALPHADequilibriumPhaseConcentrationsStrategy.C +++ b/source/CALPHADequilibriumPhaseConcentrationsStrategy.C @@ -102,11 +102,11 @@ void CALPHADequilibriumPhaseConcentrationsStrategy::computePhaseConcentrationsOn const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > cd_c_l_ref ( - patch->getPatchData( d_conc_l_ref_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_l_ref_id) ) ); assert( cd_c_l_ref ); boost::shared_ptr< pdat::CellData > cd_c_a_ref ( - patch->getPatchData( d_conc_a_ref_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_a_ref_id) ) ); assert( cd_c_a_ref ); boost::shared_ptr< pdat::CellData > cd_c_b_ref; diff --git a/source/CALPHADequilibriumPhaseConcentrationsStrategy.h b/source/CALPHADequilibriumPhaseConcentrationsStrategy.h index c319b21e..3b834415 100644 --- a/source/CALPHADequilibriumPhaseConcentrationsStrategy.h +++ b/source/CALPHADequilibriumPhaseConcentrationsStrategy.h @@ -34,7 +34,7 @@ #define included_CALPHADequilibriumPhaseConcentrationsStrategy #include "PhaseConcentrationsStrategy.h" -#include "FreeEnergyFunctions.h"; +#include "CALPHADFreeEnergyFunctionsBinary.h" #include "SAMRAI/tbox/InputManager.h" diff --git a/source/CPODESSolver.C b/source/CPODESSolver.C index 6539d94c..2302dbc3 100644 --- a/source/CPODESSolver.C +++ b/source/CPODESSolver.C @@ -179,14 +179,14 @@ CPODESSolver::CPODESSolver( { #ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT(!object_name.empty()); - TBOX_ASSERT(!(my_functions == (CPODESAbstractFunctions*)NULL)); + TBOX_ASSERT(!(my_functions == 0)); #endif d_object_name = object_name; d_cpode_functions = my_functions; d_uses_preconditioner = uses_preconditioner; - d_solution_vector = (solv::SundialsAbstractVector*)NULL; + d_solution_vector = 0; d_solution_deriv_vector = (solv::SundialsAbstractVector*)NULL; d_weight_vector = (solv::SundialsAbstractVector*)NULL; @@ -274,12 +274,12 @@ CPODESSolver::~CPODESSolver() void CPODESSolver::initialize(solv::SundialsAbstractVector* solution) { -#ifdef DEBUG_CHECK_ASSERTIONS - TBOX_ASSERT(!(solution == (solv::SundialsAbstractVector*)NULL)); - TBOX_ASSERT(d_solution_vector == (solv::SundialsAbstractVector*)NULL); - double l1norm=solution->L1Norm(); - assert( l1norm==l1norm ); -#endif +//#ifdef DEBUG_CHECK_ASSERTIONS +// TBOX_ASSERT(!(solution == (solv::SundialsAbstractVector*)NULL)); +// TBOX_ASSERT(d_solution_vector == (solv::SundialsAbstractVector*)NULL); +// double l1norm=solution->L1Norm(); +// assert( l1norm==l1norm ); +//#endif d_solution_vector = solution; d_CPODE_needs_initialization = true; initializeCPODES(); diff --git a/source/CPODESSolver.h b/source/CPODESSolver.h index d2f0d0e6..4a647f1e 100644 --- a/source/CPODESSolver.h +++ b/source/CPODESSolver.h @@ -217,32 +217,19 @@ class CPODESSolver * * Notes: * - - - * * - * The solution vector is not passed into the constructor. * Before the solver can be used, the initialize() function must * be called. - * - * - - * * Assertion checks: * - - - * * - * my_functions must not be null * * - * object_name must not be empty. * - * - - * */ CPODESSolver(const std::string& object_name, @@ -263,18 +250,12 @@ class CPODESSolver * * Assertion checks: * - - - * * - * the solution vector must not be null * * - * the solution vector must not have already been set * - * - - */ void initialize(solv::SundialsAbstractVector* solution); @@ -285,8 +266,6 @@ class CPODESSolver * * CPODES Termination Codes: * - - * * - @b SUCCESS (=0) * Cpodes succeeded. diff --git a/source/CartesianRobinBcHelperWithDepth.C b/source/CartesianRobinBcHelperWithDepth.C index be855e1e..ebeda4da 100644 --- a/source/CartesianRobinBcHelperWithDepth.C +++ b/source/CartesianRobinBcHelperWithDepth.C @@ -66,7 +66,7 @@ extern "C" { #pragma warning (disable:1419) #endif -void F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( +void SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -77,12 +77,12 @@ void F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) ( const int& jbeg, const int& jend, const int& face, const int& ghos, const int& inte, const int& location, const double& h, const int& zerog); -void F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) ( +void SAMRAI_F77_FUNC(settype2cells2d, SETTYPE2CELLS2D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, const int* lower, const int* upper, const int& location); -void F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( +void SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -96,13 +96,13 @@ void F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) ( const int& kbeg, const int& kend, const int& face, const int& ghos, const int& inte, const int& location, const double& h, const int& zerog); -void F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) ( +void SAMRAI_F77_FUNC(settype2cells3d, SETTYPE2CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, const int& dkfirst, const int& dklast, const int* lower, const int* upper, const int& location); -void F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) ( +void SAMRAI_F77_FUNC(settype3cells3d, SETTYPE3CELLS3D) ( double* data, const int& difirst, const int& dilast, const int& djfirst, const int& djlast, @@ -122,10 +122,10 @@ CartesianRobinBcHelperWithDepth::CartesianRobinBcHelperWithDepth( const tbox::Dimension& dim, std::string object_name, solv::RobinBcCoefStrategy* coef_strategy): - xfer::RefinePatchStrategy(dim), + xfer::RefinePatchStrategy(), d_dim(dim), d_object_name(object_name), - d_coef_strategy(NULL), + d_coef_strategy(0), d_target_data_id(-1), d_homogeneous_bc(false) { @@ -162,10 +162,12 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( int target_data_id, bool homogeneous_bc) const { - TBOX_DIM_ASSERT_CHECK_ARGS3(*this, patch, ghost_width_to_fill); + TBOX_ASSERT_OBJDIM_EQUALITY2(patch, ghost_width_to_fill); NULL_USE(fill_time); + const tbox::Dimension& dim(patch.getDim()); + t_set_boundary_values_in_cells->start(); #ifdef DEBUG_CHECK_ASSERTIONS @@ -175,7 +177,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( } #endif - if (d_dim == tbox::Dimension(1)) { + if (patch.getDim() == tbox::Dimension(1)) { TBOX_ERROR(d_object_name << ": dim = 1 not supported"); } math::PatchCellDataOpsReal cops; @@ -183,39 +185,28 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( /* * Get info on the data. */ - hier::VariableDatabase* vdb = - hier::VariableDatabase::getDatabase(); + hier::VariableDatabase* vdb = hier::VariableDatabase::getDatabase(); boost::shared_ptr variable_ptr; vdb->mapIndexToVariable(target_data_id, variable_ptr); - boost::shared_ptr > cell_variable_ptr( - variable_ptr, - boost::detail::dynamic_cast_tag()); if (!variable_ptr) { TBOX_ERROR(d_object_name << ": No variable for index " << target_data_id); } - if (!cell_variable_ptr) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << target_data_id - << " does not correspond to\n" - << "a cell-centered double variable.\n"); - } + boost::shared_ptr > cell_variable_ptr( + BOOST_CAST, hier::Variable>(variable_ptr)); + TBOX_ASSERT(cell_variable_ptr); /* * Get the data. */ boost::shared_ptr data_ptr( patch.getPatchData(target_data_id)); - boost::shared_ptr > cell_data_ptr( - data_ptr, - boost::detail::dynamic_cast_tag()); if (!data_ptr) { TBOX_ERROR(d_object_name << ": No data for index " << target_data_id); } - if (!cell_data_ptr) { - TBOX_ERROR(d_object_name << ": hier::Patch data index " << target_data_id - << " does not correspond to\n" - << "cell-centered double data.\n"); - } + boost::shared_ptr > cell_data_ptr( + BOOST_CAST, hier::PatchData>(data_ptr)); + TBOX_ASSERT(cell_data_ptr); pdat::CellData& data = *cell_data_ptr; const hier::IntVector& ghost_cells = @@ -241,13 +232,13 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( * They are kept her for debugging. */ boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); + TBOX_ASSERT(pg); - const tbox::Array& codim1_boxes = + const std::vector& codim1_boxes = pg->getCodimensionBoundaries(1); - const int n_codim1_boxes = codim1_boxes.getSize(); + const int n_codim1_boxes = static_cast(codim1_boxes.size()); const hier::Box& ghost_box = data.getGhostBox(); const double* h = pg->getDx(); @@ -306,7 +297,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iint = igho + 1; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), @@ -326,7 +317,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iint = igho - 1; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), @@ -346,7 +337,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( jint = jgho + 1; ibeg = lower[0]; iend = upper[0]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), @@ -366,7 +357,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( jint = jgho - 1; ibeg = lower[0]; iend = upper[0]; - F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells2d, SETTYPE1CELLS2D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], acoef_data->getPointer(), @@ -395,7 +386,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( jend = upper[1]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -419,7 +410,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( jend = upper[1]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -443,7 +434,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iend = upper[0]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -467,7 +458,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iend = upper[0]; kbeg = lower[2]; kend = upper[2]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -491,7 +482,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iend = upper[0]; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -515,7 +506,7 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( iend = upper[0]; jbeg = lower[1]; jend = upper[1]; - F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), + SAMRAI_F77_FUNC(settype1cells3d, SETTYPE1CELLS3D) (data.getPointer(depth), ghost_box.lower()[0], ghost_box.upper()[0], ghost_box.lower()[1], ghost_box.upper()[1], ghost_box.lower()[2], ghost_box.upper()[2], @@ -551,9 +542,9 @@ CartesianRobinBcHelperWithDepth::setBoundaryValuesInCells( * This data may be used by refinement operators to do interpolation. */ - const tbox::Array& node_boxes = + const std::vector& node_boxes = pg->getNodeBoundaries(); - const int n_node_boxes = node_boxes.getSize(); + const int n_node_boxes = static_cast(node_boxes.size()); for(int depth=0;depth& edge_boxes = + const std::vector& edge_boxes = pg->getEdgeBoundaries(); - const int n_edge_boxes = edge_boxes.getSize(); + const int n_edge_boxes = static_cast(edge_boxes.size()); for(int depth=0;depth& node_boxes = pg->getNodeBoundaries(); - const int n_node_boxes = node_boxes.getSize(); + const std::vector& node_boxes = pg->getNodeBoundaries(); + const int n_node_boxes = static_cast(node_boxes.size()); for(int depth=0;depth(location_index / 2), 1); } /* * The node indices range one higher than the cell indices, diff --git a/source/CartesianRobinBcHelperWithDepth.h b/source/CartesianRobinBcHelperWithDepth.h index 246d6d6a..2f28f226 100644 --- a/source/CartesianRobinBcHelperWithDepth.h +++ b/source/CartesianRobinBcHelperWithDepth.h @@ -113,7 +113,7 @@ class CartesianRobinBcHelperWithDepth: const double fill_time, const hier::IntVector& ghost_width_to_fill); hier::IntVector - getRefineOpStencilWidth() const; + getRefineOpStencilWidth(const tbox::Dimension &dim) const; virtual void preprocessRefineBoxes( hier::Patch& fine, diff --git a/source/CellPoissonHypreSolver.C b/source/CellPoissonHypreSolver.C index 3b927c6c..6d072186 100644 --- a/source/CellPoissonHypreSolver.C +++ b/source/CellPoissonHypreSolver.C @@ -56,10 +56,10 @@ #include "SAMRAI/tbox/MathUtilities.h" #include "SAMRAI/tbox/SAMRAI_MPI.h" #include "SAMRAI/tbox/SAMRAIManager.h" -//#include "SAMRAI/tbox/PIO.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" #include "SAMRAI/tbox/Utilities.h" +#include "SAMRAI/math/HierarchyCellDataOpsReal.h" #include #include @@ -284,7 +284,7 @@ extern "C" { } boost::shared_ptr > -CellPoissonHypreSolver::s_Ak0_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; +CellPoissonHypreSolver::s_Ak0_var[3]; #ifndef NULL #define NULL (0) @@ -530,7 +530,7 @@ void CellPoissonHypreSolver::initializeSolverState( int ln ) { TBOX_ASSERT(hierarchy); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS1(d_dim, *hierarchy); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY1(d_dim, *hierarchy); assert( d_msqrt_id>=0 ); assert( d_Ak0_id>=0 ); @@ -599,13 +599,12 @@ void CellPoissonHypreSolver::allocateHypreData() boost::shared_ptr level(d_hierarchy->getPatchLevel(d_ln)); boost::shared_ptr grid_geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( d_hierarchy->getGridGeometry() ) ); const hier::IntVector ratio = level->getRatioToLevelZero(); hier::IntVector periodic_shift = grid_geometry->getPeriodicShift(ratio); - int periodic_flag[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int periodic_flag[3]; bool is_periodic = false; for (int d=0; dgetPhysicalDomain(hier::BlockId::zero()); hier::Box domain_bound(level_domain.front()); - for (hier::BoxContainer::const_iterator i(level_domain); + for (hier::BoxContainer::const_iterator i = level_domain.begin(); i != level_domain.end(); ++i) { - domain_bound.lower().min(i->lower()); - domain_bound.upper().max(i->upper()); + domain_bound.setLower( + hier::Index::min(domain_bound.lower(), i->lower())); + domain_bound.setUpper( + hier::Index::min(domain_bound.upper(), i->upper())); } - for (int d=0; d domain_bound.numberCells(d) ) { - TBOX_ERROR(d_object_name << ": Hypre currently requires\n" - <<"that grid size in periodic directions be\n" - <<"powers of two. (This requirement may go\n" - <<"away in future versions of hypre.)\n" - <<"Size problem in direction " << d << "\n" - <<"Domain bound is " << domain_bound << ",\n" - <<"Size of " << domain_bound.numberCells() << "\n"); + if (tmpi > domain_bound.numberCells(d)) { + TBOX_ERROR( + d_object_name << ": Hypre currently requires\n" + << "that grid size in periodic directions be\n" + << "powers of two. (This requirement may go\n" + << "away in future versions of hypre.)\n" + << "Size problem in direction " + << d << "\n" + << "Domain bound is " + << domain_bound << ",\n" + << "Size of " + << domain_bound.numberCells() << "\n"); } tmpi = tmpi ? tmpi << 1 : 1; } @@ -826,10 +833,10 @@ CellPoissonHypreSolver::copyToHypre( int depth, const hier::Box& box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, src, box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, src, box); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box, true); c != cend; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c != cend; ++c) { hier::IntVector ic = *c; HYPRE_StructVectorSetValues(vector, &ic[0], src(*c, depth)); } @@ -850,10 +857,10 @@ CellPoissonHypreSolver::copyFromHypre( HYPRE_StructVector vector, const hier::Box box) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, dst, box); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, dst, box); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box, true); c != cend; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c != cend; ++c) { double value; hier::IntVector ic = *c; HYPRE_StructVectorGetValues(vector, &ic[0], &value); @@ -932,8 +939,8 @@ void CellPoissonHypreSolver::setMatrixCoefficients( hier::Patch& patch = **pi; boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); + TBOX_ASSERT(pg); const double* h = pg->getDx(); @@ -942,37 +949,28 @@ void CellPoissonHypreSolver::setMatrixCoefficients( const hier::Index patch_up = patch_box.upper(); if ( spec.cIsVariable() ) { - C_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(spec.getCPatchDataId())); - if ( !C_data ) { - TBOX_ERROR(d_object_name << ": Invalid cell variable index " - << spec.getCPatchDataId() - <<" for the C parameter. It is not\n" - <<"cell-centered double data." ); - } + C_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(spec.getCPatchDataId())); + TBOX_ASSERT(C_data); } if ( ! spec.dIsConstant() ) { - D_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData(spec.getDPatchDataId())); - if ( !D_data ) { - TBOX_ERROR(d_object_name << ": Invalid cell variable index " - << spec.getDPatchDataId() - << " for diffusion coefficient. It is not\n" - << "side-centered double data." ); - } + D_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData(spec.getDPatchDataId())); + TBOX_ASSERT(D_data); } if ( ! spec.mIsConstant() ) { - M_data = boost::dynamic_pointer_cast, - hier::PatchData>(patch.getPatchData( spec.getMPatchDataId())); + M_data = BOOST_CAST, hier::PatchData>( + patch.getPatchData( spec.getMPatchDataId()) ); + TBOX_ASSERT(M_data); +#ifdef DEBUG_CHECK_ASSERTIONS + math::ArrayDataNormOpsReal ops; + const double norm_u = ops.maxNorm(M_data->getArrayData(),M_data->getArrayData().getBox()); + assert( norm_u==norm_u ); + assert( norm_u>0. ); +#endif d_msqrt_transform=true; - if ( !M_data ) { - TBOX_ERROR(d_object_name << ": Invalid cell variable index " - << spec.getMPatchDataId() - << " for mobility coefficient. It is not\n" - << "cell-centered double data." ); - } } Ak0 = boost::dynamic_pointer_cast, @@ -1085,8 +1083,10 @@ void CellPoissonHypreSolver::setMatrixCoefficients( // To do: This loop uses inefficient high-level syntax. // See if it can be replaced by a Fortran loop. - pdat::CellIterator icend(patch_box, false); - for (pdat::CellIterator ic(patch_box, true) ; ic!=icend; ++ic) { + pdat::CellIterator ic(pdat::CellGeometry::begin(patch_box)); + pdat::CellIterator icend(pdat::CellGeometry::end(patch_box)); + + for ( ; ic != icend; ++ic) { const pdat::CellIndex& icell( *ic ); pdat::SideIndex ixlower(icell, @@ -1135,6 +1135,7 @@ void CellPoissonHypreSolver::setMatrixCoefficients( assert( spec.getCPatchDataId()>=0 ); if ( spec.mIsConstant() ) { double mscale = spec.getMConstant(); + assert( fabs(mscale)>0. ); for ( i=0; i& surface_boxes = + const std::vector< hier::BoundaryBox >& surface_boxes = pg->getCodimensionBoundaries(1); - const int n_bdry_boxes = surface_boxes.getSize(); + const int n_bdry_boxes = surface_boxes.size(); for ( int n=0; n surface_boxes; + std::vector< hier::BoundaryBox > surface_boxes; if (NDIM == 2) { surface_boxes = d_cf_boundary->getEdgeBoundaries(pi->getGlobalId()); @@ -1296,7 +1297,7 @@ void CellPoissonHypreSolver::setMatrixCoefficients( surface_boxes = d_cf_boundary->getFaceBoundaries(pi->getGlobalId()); } - const int n_bdry_boxes = surface_boxes.getSize(); + const int n_bdry_boxes = surface_boxes.size(); for ( int n=0; n 1) { pdat::SideIndex iylower(*ic, pdat::SideIndex::Y, @@ -1424,11 +1424,11 @@ void CellPoissonHypreSolver::setMatrixCoefficients( void CellPoissonHypreSolver::add_gAk0_toRhs( const hier::Patch &patch, - const tbox::Array< hier::BoundaryBox > &bdry_boxes, + const std::vector< hier::BoundaryBox > &bdry_boxes, const solv::RobinBcCoefStrategy *robin_bc_coef, pdat::CellData &rhs ) { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS2(d_dim, patch, rhs); + TBOX_ASSERT_DIM_OBJDIM_EQUALITY2(d_dim, patch, rhs); /* * g*A*k0(a) is the storage for adjustments to be made to the rhs @@ -1438,10 +1438,9 @@ void CellPoissonHypreSolver::add_gAk0_toRhs( * to rhs. */ boost::shared_ptr >Ak0( - patch.getPatchData(d_Ak0_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_Ak0_id) ) ); - const int n_bdry_boxes = bdry_boxes.getSize(); + const int n_bdry_boxes = bdry_boxes.size(); for ( int n=0; nstart(); - boost::shared_ptr< hier::PatchLevel > level = d_hierarchy->getPatchLevel(d_ln); + boost::shared_ptr< hier::PatchLevel > level ( d_hierarchy->getPatchLevel(d_ln) ); #ifdef DEBUG_CHECK_ASSERTIONS assert(u >= 0); assert(u < level->getPatchDescriptor()->getMaxNumberRegisteredComponents()); assert(f >= 0); assert(f < level->getPatchDescriptor()->getMaxNumberRegisteredComponents()); + + math::HierarchyCellDataOpsReal mathops(d_hierarchy); + const double norm_u = mathops.L2Norm( u ); + assert( norm_u==norm_u ); + + const double norm_f = mathops.L2Norm( f ); + assert( norm_f==norm_f ); #endif @@ -1662,8 +1668,7 @@ int CellPoissonHypreSolver::solveSystem( const int u , * Set up variable data needed to prepare linear system solver. */ boost::shared_ptr > u_data_( - patch->getPatchData(u), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(u) ) ); TBOX_ASSERT(u_data_); pdat::CellData& u_data = *u_data_; pdat::CellData rhs_data(box, 1, no_ghosts); @@ -1680,7 +1685,13 @@ int CellPoissonHypreSolver::solveSystem( const int u , // divide rhs by M^1/2 if M was used to construct matrix if( d_msqrt_transform ){ boost::shared_ptr > msqrt ( - patch->getPatchData(d_msqrt_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(d_msqrt_id) ) ); +#ifdef DEBUG_CHECK_ASSERTIONS + math::ArrayDataNormOpsReal ops; + double nb=ops.maxNorm(msqrt->getArrayData(),box); + assert( nb==nb ); + assert( nb>0. ); +#endif math::ArrayDataBasicOps array_math; array_math.divide(rhs_data.getArrayData(), rhs_data.getArrayData(), msqrt->getArrayData(), box); @@ -1758,6 +1769,8 @@ int CellPoissonHypreSolver::solveSystem( const int u , &d_relative_residual_norm); } + assert( d_relative_residual_norm==d_relative_residual_norm ); + /* * Pull the solution vector out of the HYPRE structures */ @@ -1765,8 +1778,9 @@ int CellPoissonHypreSolver::solveSystem( const int u , ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; boost::shared_ptr > u_data_( - patch->getPatchData(u), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(u) ) ); + TBOX_ASSERT(u_data_); + pdat::CellData& u_data = *u_data_; copyFromHypre(u_data, d_soln_depth, @@ -1776,7 +1790,7 @@ int CellPoissonHypreSolver::solveSystem( const int u , // multiply solution by M^1/2 if M was used to build matrix if( d_msqrt_transform ){ boost::shared_ptr > msqrt ( - patch->getPatchData(d_msqrt_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(d_msqrt_id) ) ); math::ArrayDataBasicOps array_math; array_math.multiply(u_data.getArrayData(), u_data.getArrayData(), msqrt->getArrayData(), patch->getBox()); @@ -1784,7 +1798,7 @@ int CellPoissonHypreSolver::solveSystem( const int u , } t_solve_system->stop(); - + d_converged = ( d_relative_residual_norm <= d_relative_residual_tol ); return d_converged; @@ -1979,7 +1993,7 @@ CellPoissonHypreSolver::printConvergenceFactors(ostream& os) void CellPoissonHypreSolver::freeVariables() { - for (int d = 0; d < tbox::Dimension::MAXIMUM_DIMENSION_VALUE; ++d) { + for (int d = 0; d < 3; ++d) { s_Ak0_var[d].reset(); } } diff --git a/source/CellPoissonHypreSolver.h b/source/CellPoissonHypreSolver.h index bb67f6ed..50f4d143 100644 --- a/source/CellPoissonHypreSolver.h +++ b/source/CellPoissonHypreSolver.h @@ -327,7 +327,7 @@ class CellPoissonHypreSolver * boundary being worked on. */ void add_gAk0_toRhs( const hier::Patch &patch, - const tbox::Array< hier::BoundaryBox > &bdry_boxes, + const std::vector< hier::BoundaryBox > &bdry_boxes, const solv::RobinBcCoefStrategy *robin_bc_coef, pdat::CellData &rhs ); @@ -470,7 +470,7 @@ class CellPoissonHypreSolver int d_Ak0_id; static boost::shared_ptr > - s_Ak0_var[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + s_Ak0_var[3]; /*! * @brief Depth of the solution variable. diff --git a/source/CompositionRHSStrategy.C b/source/CompositionRHSStrategy.C index cdfc122c..02e0ccda 100644 --- a/source/CompositionRHSStrategy.C +++ b/source/CompositionRHSStrategy.C @@ -74,15 +74,14 @@ void CompositionRHSStrategy::setZeroFluxAtBoundaryOnPatch( const int flux_id) { boost::shared_ptr< geom::CartesianPatchGeometry > pg ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); // Get face boundary boxes. - const tbox::Array< hier::BoundaryBox > bdry = + const std::vector< hier::BoundaryBox > bdry = pg->getCodimensionBoundaries(1); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); const hier::Box& gbox=flux->getGhostBox(); @@ -95,7 +94,7 @@ void CompositionRHSStrategy::setZeroFluxAtBoundaryOnPatch( const hier::Index glo(gbox.lower()); for(int i=0;i>1; diff --git a/source/ConcFACSolver.C b/source/ConcFACSolver.C index bca3716a..567d6dab 100644 --- a/source/ConcFACSolver.C +++ b/source/ConcFACSolver.C @@ -36,7 +36,7 @@ using namespace std; ConcFACSolver::ConcFACSolver ( const std::string &object_name, - ConcFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr& database ) : EllipticFACSolver( object_name, fac_ops, database ) @@ -53,7 +53,8 @@ void ConcFACSolver::setOperatorCoefficients( { t_set_op_coef->start(); - ConcFACOps* conc_fac_ops = dynamic_cast( d_fac_ops ); + boost::shared_ptr conc_fac_ops ( + boost::dynamic_pointer_cast( d_fac_ops ) ); conc_fac_ops->setOperatorCoefficients( gamma, diff --git a/source/ConcFACSolver.h b/source/ConcFACSolver.h index c4764ca2..ac1266dc 100644 --- a/source/ConcFACSolver.h +++ b/source/ConcFACSolver.h @@ -46,7 +46,7 @@ class ConcFACSolver ConcFACSolver( const std::string &object_name, - ConcFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr& database = boost::shared_ptr() ); diff --git a/source/ConstantHeatCapacityStrategy.C b/source/ConstantHeatCapacityStrategy.C index 79183563..64becffd 100644 --- a/source/ConstantHeatCapacityStrategy.C +++ b/source/ConstantHeatCapacityStrategy.C @@ -66,7 +66,7 @@ void ConstantHeatCapacityStrategy::setCurrentValue( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > cp_data ( - patch->getPatchData( d_cp_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_cp_id) ) ); assert( cp_data ); cp_data->fillAll( d_cp ); diff --git a/source/ConstantMeltingTemperatureStrategy.C b/source/ConstantMeltingTemperatureStrategy.C index 08541146..95896ad0 100644 --- a/source/ConstantMeltingTemperatureStrategy.C +++ b/source/ConstantMeltingTemperatureStrategy.C @@ -40,7 +40,7 @@ void ConstantMeltingTemperatureStrategy::evaluate(hier::Patch& patch) assert( d_equilibrium_temperature_id>=0 ); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( d_equilibrium_temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_equilibrium_temperature_id) ) ); assert( temperature ); diff --git a/source/DiffusionForConcInPhaseStrategy.C b/source/DiffusionForConcInPhaseStrategy.C index ed6bc108..a3f0e7c2 100644 --- a/source/DiffusionForConcInPhaseStrategy.C +++ b/source/DiffusionForConcInPhaseStrategy.C @@ -108,18 +108,18 @@ void DiffusionForConcInPhaseStrategy::setDiffusionForConcInPhase( *p; boost::shared_ptr< pdat::CellData > phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_l ( - patch->getPatchData( d_diffusion_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_l_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_a ( - patch->getPatchData( d_diffusion_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_a_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_b; boost::shared_ptr< pdat::SideData > diffusion_coeff_l ( - patch->getPatchData( d_diffusion_coeff_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_l_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_coeff_a ( - patch->getPatchData( d_diffusion_coeff_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_a_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_coeff_b; boost::shared_ptr< pdat::CellData > eta; @@ -164,20 +164,20 @@ void DiffusionForConcInPhaseStrategy::setDiffusionCoeffForConcInPhase( *p; boost::shared_ptr< pdat::CellData > temp ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > cl ( - patch->getPatchData( d_conc_l_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_l_scratch_id) ) ); assert( cl ); boost::shared_ptr< pdat::CellData > ca ( - patch->getPatchData( d_conc_a_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_a_scratch_id) ) ); assert( ca ); boost::shared_ptr< pdat::CellData > cb; boost::shared_ptr< pdat::SideData > diffusion_coeff_l ( - patch->getPatchData( d_diffusion_coeff_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_l_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_coeff_a ( - patch->getPatchData( d_diffusion_coeff_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_a_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_coeff_b; boost::shared_ptr< pdat::CellData > eta; diff --git a/source/EBSCompositionRHSStrategy.C b/source/EBSCompositionRHSStrategy.C index a6113be5..ea12c043 100644 --- a/source/EBSCompositionRHSStrategy.C +++ b/source/EBSCompositionRHSStrategy.C @@ -171,8 +171,7 @@ void EBSCompositionRHSStrategy::computeFluxOnPatch( assert( d_diffusion_a_id>=0 ); const boost::shared_ptr patch_geom ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -182,25 +181,25 @@ void EBSCompositionRHSStrategy::computeFluxOnPatch( const unsigned short nc2=d_ncompositions*d_ncompositions; boost::shared_ptr< pdat::CellData > conc_l ( - patch.getPatchData( d_conc_l_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_scratch_id) ) ); assert( conc_l ); boost::shared_ptr< pdat::CellData > conc_a ( - patch.getPatchData( d_conc_a_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_scratch_id) ) ); assert( conc_a ); boost::shared_ptr< pdat::SideData > conc_diffusionl ( - patch.getPatchData( d_diffusion_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion_l_id) ) ); assert( conc_diffusionl ); assert( conc_diffusionl->getDepth()==(nc2) ); boost::shared_ptr< pdat::SideData > conc_diffusiona ( - patch.getPatchData( d_diffusion_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion_a_id) ) ); assert( conc_diffusiona ); assert( conc_diffusiona->getDepth()==(nc2) ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); assert( flux->getDepth()==d_ncompositions ); @@ -254,11 +253,11 @@ void EBSCompositionRHSStrategy::computeFluxOnPatch( if ( d_with_third_phase ){ assert( d_conc_b_scratch_id>=0 ); boost::shared_ptr< pdat::CellData > conc_b ( - patch.getPatchData( d_conc_b_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_b_scratch_id) ) ); assert( conc_b ); boost::shared_ptr< pdat::SideData > conc_diffusionb ( - patch.getPatchData( d_diffusion_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion_b_id) ) ); assert( conc_diffusionb ); assert( conc_diffusionb->getPointer(0)!=NULL ); @@ -316,9 +315,9 @@ void EBSCompositionRHSStrategy::setDiffusionCoeffForPreconditionConcentration( *p; boost::shared_ptr< pdat::SideData > dl ( - patch->getPatchData( d_diffusion_coeff_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_l_id) ) ); boost::shared_ptr< pdat::SideData > da ( - patch->getPatchData( d_diffusion_coeff_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_coeff_a_id) ) ); boost::shared_ptr< pdat::SideData > db; boost::shared_ptr< pdat::CellData > eta; @@ -328,10 +327,10 @@ void EBSCompositionRHSStrategy::setDiffusionCoeffForPreconditionConcentration( } boost::shared_ptr< pdat::CellData > phi ( - patch->getPatchData( d_phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_scratch_id) ) ); boost::shared_ptr< pdat::SideData > diffusion ( - patch->getPatchData( d_diffusion_precond_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_precond_id) ) ); setDiffusionCoeffForPreconditionConcentrationOnPatch( dl, da, db, @@ -568,8 +567,7 @@ void EBSCompositionRHSStrategy::addFluxFromAntitrappingonPatch( //tbox::plog<<"EBSCompositionRHSStrategy::addFluxFromGradTonPatch()"< patch_geom ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -577,19 +575,19 @@ void EBSCompositionRHSStrategy::addFluxFromAntitrappingonPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData( phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( phase_scratch_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > cl ( - patch.getPatchData( d_conc_l_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_scratch_id) ) ); assert( cl ); boost::shared_ptr< pdat::CellData > ca ( - patch.getPatchData( d_conc_a_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_scratch_id) ) ); assert( ca ); boost::shared_ptr< pdat::CellData > dphidt ( - patch.getPatchData( dphidt_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( dphidt_id) ) ); assert( dphidt ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); assert( phase->getGhostCellWidth()[0]==1 ); @@ -640,19 +638,19 @@ void EBSCompositionRHSStrategy::setDiffusionCoeffForT( *p; boost::shared_ptr< pdat::CellData > temp ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > cl ( - patch->getPatchData( concentration_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( concentration_l_id) ) ); boost::shared_ptr< pdat::CellData > ca ( - patch->getPatchData( concentration_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( concentration_a_id) ) ); boost::shared_ptr< pdat::CellData > cb; boost::shared_ptr< pdat::CellData > phi ( - patch->getPatchData( d_phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_scratch_id) ) ); boost::shared_ptr< pdat::SideData > mq ( - patch->getPatchData( d_Mq_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_Mq_id) ) ); assert( mq ); boost::shared_ptr< pdat::CellData > eta; @@ -1002,8 +1000,7 @@ void EBSCompositionRHSStrategy::addFluxFromGradTonPatch( //tbox::plog<<"EBSCompositionRHSStrategy::addFluxFromGradTonPatch()"< patch_geom ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -1011,13 +1008,13 @@ void EBSCompositionRHSStrategy::addFluxFromGradTonPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( temperature ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); boost::shared_ptr< pdat::SideData > mq ( - patch.getPatchData( d_Mq_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_Mq_id) ) ); assert( mq ); // now compute concentration flux diff --git a/source/EllipticFACOps.C b/source/EllipticFACOps.C index 54199f16..69cab5e0 100644 --- a/source/EllipticFACOps.C +++ b/source/EllipticFACOps.C @@ -45,7 +45,6 @@ #include "SAMRAI/pdat/OutersideVariable.h" #include "SAMRAI/hier/PatchData.h" #include "SAMRAI/pdat/SideVariable.h" -#include "SAMRAI/solv/FACPreconditioner.h" #include "SAMRAI/tbox/Array.h" #include "SAMRAI/tbox/Timer.h" #include "SAMRAI/tbox/TimerManager.h" @@ -57,6 +56,9 @@ #include "SAMRAI/xfer/RefineAlgorithm.h" #include "SAMRAI/hier/RefineOperator.h" #include "SAMRAI/xfer/RefineSchedule.h" +#include "SAMRAI/xfer/PatchLevelFullFillPattern.h" + +#include "boost/make_shared.hpp" #include using namespace std; @@ -754,26 +756,6 @@ EllipticFACOps::EllipticFACOps( d_c_id(-1), d_d_id(-1), d_oflux_scratch_id(-1), - d_prolongation_refine_operator() , - d_prolongation_refine_algorithm() , - d_prolongation_refine_schedules() , - d_urestriction_coarsen_operator() , - d_urestriction_coarsen_algorithm() , - d_urestriction_coarsen_schedules() , - d_rrestriction_coarsen_operator() , - d_rrestriction_coarsen_algorithm() , - d_rrestriction_coarsen_schedules() , - d_flux_coarsen_operator() , - d_flux_coarsen_algorithm() , - d_flux_coarsen_schedules() , - d_ghostfill_refine_operator() , - d_ghostfill_refine_algorithm() , - d_ghostfill_refine_schedules() , - d_ghostfill_nocoarse_refine_operator() , - d_ghostfill_nocoarse_refine_algorithm() , - d_ghostfill_nocoarse_refine_schedules() , - d_mobility_refine_operator(), - d_mobility_refine_algorithm(), d_bc_helper( tbox::Dimension(NDIM), d_object_name+"::bc helper" ), d_enable_logging(false) , d_verbose(false), @@ -978,8 +960,7 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s << "correspond to a variable.\n"); } boost::shared_ptr > cell_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::Variable>(var) ); if ( !cell_var ) { TBOX_ERROR(d_object_name << ": RHS variable is not cell-centered double\n"); @@ -993,8 +974,7 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s << "correspond to a variable.\n"); } boost::shared_ptr > cell_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::Variable>(var) ); if ( !cell_var ) { TBOX_ERROR(d_object_name << ": Solution variable is not cell-centered double\n"); @@ -1014,8 +994,7 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s * Some data checks can only be done if the data already exists. */ boost::shared_ptr > cd( - fd, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::PatchData>(fd) ); if (!cd) { TBOX_ERROR(d_object_name << ": RHS data is not cell-centered double\n"); @@ -1027,15 +1006,13 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s } } boost::shared_ptr ud( - patch.getPatchData(solution.getComponentDescriptorIndex(0)), - boost::detail::dynamic_cast_tag()); + patch.getPatchData(solution.getComponentDescriptorIndex(0) ) ); if (ud) { /* * Some data checks can only be done if the data already exists. */ boost::shared_ptr > cd( - ud, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::PatchData>(ud) ); if (!cd) { TBOX_ERROR(d_object_name << ": Solution data is not cell-centered double\n"); @@ -1069,7 +1046,7 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s * Initialize the coarse-fine boundary description for the * hierarchy. */ - d_cf_boundary.resizeArray( d_hierarchy->getNumberOfLevels() ); + d_cf_boundary.resize( d_hierarchy->getNumberOfLevels() ); hier::IntVector max_gcw(tbox::Dimension(NDIM),1); for ( int ln=d_ln_min; ln<=d_ln_max; ++ln ) { @@ -1090,8 +1067,7 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s * acceptable strings for looking up the refine operator. */ boost::shared_ptr geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( d_hierarchy->getGridGeometry() ) ); boost::shared_ptr< hier::Variable > variable; vdb->mapIndexToVariable( d_cell_scratch_id, variable ); @@ -1182,27 +1158,31 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s There is no need to delete the old schedules first because we have deallocated the solver state above. */ - d_prolongation_refine_schedules.resizeArray(d_ln_max+1); - d_ghostfill_refine_schedules.resizeArray(d_ln_max+1); - d_ghostfill_nocoarse_refine_schedules.resizeArray(d_ln_max+1); - d_urestriction_coarsen_schedules.resizeArray(d_ln_max+1); - d_rrestriction_coarsen_schedules.resizeArray(d_ln_max+1); - d_flux_coarsen_schedules.resizeArray(d_ln_max+1); + d_prolongation_refine_schedules.resize(d_ln_max+1); + d_ghostfill_refine_schedules.resize(d_ln_max+1); + d_ghostfill_nocoarse_refine_schedules.resize(d_ln_max+1); + d_urestriction_coarsen_schedules.resize(d_ln_max+1); + d_rrestriction_coarsen_schedules.resize(d_ln_max+1); + d_flux_coarsen_schedules.resize(d_ln_max+1); d_prolongation_refine_algorithm.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + new xfer::RefineAlgorithm() ); + d_urestriction_coarsen_algorithm.reset( - new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM))); + new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM)) ); d_rrestriction_coarsen_algorithm.reset( - new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM))); + new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM)) ); d_flux_coarsen_algorithm.reset( - new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM))); + new xfer::CoarsenAlgorithm(tbox::Dimension(NDIM)) ); d_ghostfill_refine_algorithm.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + new xfer::RefineAlgorithm() ); + d_ghostfill_nocoarse_refine_algorithm.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + new xfer::RefineAlgorithm() ); + d_mobility_refine_algorithm.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + new xfer::RefineAlgorithm() ); + d_prolongation_refine_algorithm-> registerRefine( d_cell_scratch_id , @@ -1239,9 +1219,13 @@ EllipticFACOps::initializeOperatorState (const solv::SAMRAIVectorReal &s d_mobility_refine_operator ); for ( int dest_ln=d_ln_min+1; dest_ln<=d_ln_max; ++dest_ln ) { + + boost::shared_ptr fill_pattern( + boost::make_shared()); d_prolongation_refine_schedules[dest_ln] = d_prolongation_refine_algorithm-> - createSchedule( d_hierarchy->getPatchLevel(dest_ln) , + createSchedule( fill_pattern, + d_hierarchy->getPatchLevel(dest_ln) , boost::shared_ptr() , dest_ln-1 , d_hierarchy , @@ -1339,7 +1323,7 @@ EllipticFACOps::deallocateOperatorState() d_hierarchy->getPatchLevel(ln)-> deallocatePatchData(d_oflux_scratch_id); } - d_cf_boundary.resizeArray(0); + d_cf_boundary.resize(0); #if HAVE_HYPRE d_hypre_solver.deallocateSolverState(); #endif @@ -1348,23 +1332,11 @@ EllipticFACOps::deallocateOperatorState() d_ln_max = -1; d_prolongation_refine_algorithm.reset(); - d_prolongation_refine_schedules.setNull(); - d_urestriction_coarsen_algorithm.reset(); - d_urestriction_coarsen_schedules.setNull(); - d_rrestriction_coarsen_algorithm.reset(); - d_rrestriction_coarsen_schedules.setNull(); - d_flux_coarsen_algorithm.reset(); - d_flux_coarsen_schedules.setNull(); - d_ghostfill_refine_algorithm.reset(); - d_ghostfill_refine_schedules.setNull(); - d_ghostfill_nocoarse_refine_algorithm.reset(); - d_ghostfill_nocoarse_refine_schedules.setNull(); - d_mobility_refine_algorithm.reset(); } d_C_is_set = false; @@ -1397,9 +1369,9 @@ EllipticFACOps::setM(const int m_id) // Copy M to local array boost::shared_ptr > m_data( - patch->getPatchData(m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(m_id) ) ); boost::shared_ptr > local_m_data ( - patch->getPatchData(d_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(d_m_id) ) ); local_m_data->copy(*m_data); @@ -1751,11 +1723,11 @@ EllipticFACOps::smoothErrorByRedBlack(solv::SAMRAIVectorReal &data , } boost::shared_ptr > err_data ( - data.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(data.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > residual_data ( - residual.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(residual.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); computeFluxOnPatch( *patch , @@ -1795,11 +1767,11 @@ EllipticFACOps::smoothErrorByRedBlack(solv::SAMRAIVectorReal &data , } boost::shared_ptr > err_data ( - data.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(data.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > residual_data ( - residual.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(residual.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); computeFluxOnPatch( *patch , @@ -1856,28 +1828,27 @@ EllipticFACOps::ewingFixFlux (const hier::Patch &patch , pdat::SideData &flux_data , const hier::IntVector &ratio_to_coarser ) const { - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(tbox::Dimension(NDIM), patch, soln_data, flux_data, + TBOX_ASSERT_DIM_OBJDIM_EQUALITY4(tbox::Dimension(NDIM), patch, soln_data, flux_data, ratio_to_coarser); const int patch_ln = patch.getPatchLevelNumber(); const hier::GlobalId id = patch.getGlobalId(); boost::shared_ptr patch_geom( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( d_hierarchy->getGridGeometry() ) ); const double *dx = patch_geom->getDx(); const hier::Box &patch_box( patch.getBox() ); const hier::Index& plower = patch_box.lower(); const hier::Index& pupper = patch_box.upper(); - const tbox::Array& bboxes = + const std::vector& bboxes = d_cf_boundary[patch_ln]->getBoundaries(id, 1); - int bn, nboxes = bboxes.getSize(); + unsigned int bn; + size_t nboxes = bboxes.size(); if ( d_poisson_spec.dIsVariable() ) { boost::shared_ptr > diffcoef_data( - patch.getPatchData(d_poisson_spec.getDPatchDataId()), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_poisson_spec.getDPatchDataId() ) ) ); for ( bn=0; bn patch = *pi; boost::shared_ptr > soln_data ( - patch->getPatchData(soln_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(soln_id) ) ); boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); computeFluxOnPatch(*patch , level->getRatioToCoarserLevel() , @@ -2203,13 +2174,13 @@ EllipticFACOps::accumulateOperatorOnLevel( for (hier::PatchLevel::Iterator pi(level->begin()); pi!=level->end(); pi++ ) { boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); boost::shared_ptr > m_data ( - patch->getPatchData(d_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(d_m_id) ) ); boost::shared_ptr > soln_data ( - patch->getPatchData(soln_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(soln_id) ) ); boost::shared_ptr > accum_data ( - patch->getPatchData(accum_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(accum_id) ) ); accumulateOperatorOnPatch( *patch, *flux_data, *m_data, *soln_data, *accum_data ); @@ -2222,7 +2193,7 @@ EllipticFACOps::accumulateOperatorOnLevel( * avoid writing another loop for it. */ boost::shared_ptr > oflux_data ( - patch->getPatchData( d_oflux_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_oflux_scratch_id) ) ); #ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT( oflux_data ); #endif @@ -2336,9 +2307,9 @@ EllipticFACOps::computeCompositeResidualOnLevel( boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > soln_data ( - solution.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(solution.getComponentPatchData ( 0 , *patch ))); boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); computeFluxOnPatch(*patch , level->getRatioToCoarserLevel() , *soln_data , @@ -2360,15 +2331,15 @@ EllipticFACOps::computeCompositeResidualOnLevel( for (hier::PatchLevel::Iterator pi(level->begin()); pi!=level->end(); pi++ ) { boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > soln_data ( - solution.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::PatchData>( solution.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > m_data ( - patch->getPatchData(d_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(d_m_id) ) ); boost::shared_ptr > rhs_data ( - rhs.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( rhs.getComponentPatchData ( 0 , *patch ) ) ); boost::shared_ptr > residual_data ( - residual.getComponentPatchData( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>( residual.getComponentPatchData( 0 , *patch ) ) ); boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); computeResidualOnPatch( *patch , *flux_data , *m_data , @@ -2385,7 +2356,7 @@ EllipticFACOps::computeCompositeResidualOnLevel( * avoid writing another loop for it. */ boost::shared_ptr > oflux_data ( - patch->getPatchData( d_oflux_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_oflux_scratch_id) ) ); #ifdef DEBUG_CHECK_ASSERTIONS TBOX_ASSERT( oflux_data ); #endif @@ -2502,8 +2473,7 @@ EllipticFACOps::computeVectorWeights( p != level->end(); ++p) { const boost::shared_ptr& patch = *p; boost::shared_ptr patch_geometry( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geometry->getDx(); double cell_vol = dx[0]; if (NDIM > 1) { @@ -2515,7 +2485,7 @@ EllipticFACOps::computeVectorWeights( } boost::shared_ptr< pdat::CellData > w ( - patch->getPatchData(weight_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData(weight_id) ) ); if ( !w ) { TBOX_ERROR(d_object_name << ": weight id must refer to a pdat::CellVariable"); @@ -2553,14 +2523,13 @@ EllipticFACOps::computeVectorWeights( p != level->end(); ++p) { const boost::shared_ptr& patch = *p; - for (hier::BoxContainer::iterator i(coarsened_boxes); + for (hier::BoxContainer::iterator i=coarsened_boxes.begin(); i != coarsened_boxes.end(); ++i) { hier::Box intersection = *i * (patch->getBox()); if (!intersection.empty()) { boost::shared_ptr > w( - patch->getPatchData(weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(weight_id) ) ); w->fillAll(0.0, intersection); } // assignment only in non-empty intersection @@ -2592,8 +2561,7 @@ EllipticFACOps::checkInputPatchDataIndices() const boost::shared_ptr var; vdb.mapIndexToVariable(d_poisson_spec.getDPatchDataId(), var); boost::shared_ptr > diffcoef_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::Variable>( var ) ); if ( !diffcoef_var ) { TBOX_ERROR(d_object_name << ": Bad diffusion coefficient patch data index."); @@ -2604,8 +2572,7 @@ EllipticFACOps::checkInputPatchDataIndices() const boost::shared_ptr var; vdb.mapIndexToVariable(d_poisson_spec.getCPatchDataId(), var); boost::shared_ptr > scalar_field_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::Variable>(var) ); if (!scalar_field_var) { TBOX_ERROR(d_object_name << ": Bad linear term patch data index."); } @@ -2615,8 +2582,7 @@ EllipticFACOps::checkInputPatchDataIndices() const boost::shared_ptr var; vdb.mapIndexToVariable(d_flux_id, var); boost::shared_ptr > flux_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::Variable>( var ) ); TBOX_ASSERT(flux_var); } @@ -2644,8 +2610,7 @@ EllipticFACOps::computeFluxOnPatch( #endif boost::shared_ptr patch_geom( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( d_hierarchy->getGridGeometry() ) ); const hier::Box &box=patch.getBox(); const hier::Index& lower = box.lower(); const hier::Index& upper = box.upper(); @@ -2757,8 +2722,7 @@ EllipticFACOps::accumulateOperatorOnPatch( { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const hier::Box &box=patch.getBox(); const hier::Index& lower = box.lower(); const hier::Index& upper = box.upper(); @@ -2925,8 +2889,7 @@ EllipticFACOps::computeResidualOnPatch( { boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const hier::Box &box=patch.getBox(); const hier::Index& lower = box.lower(); const hier::Index& upper = box.upper(); @@ -3137,8 +3100,7 @@ EllipticFACOps::redOrBlackSmoothingOnPatch( const int offset = red_or_black == 'r' ? 0 : 1; boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const hier::Box &box=patch.getBox(); const hier::Index& lower = box.lower(); const hier::Index& upper = box.upper(); @@ -3168,7 +3130,7 @@ EllipticFACOps::redOrBlackSmoothingOnPatch( diffcoef_constant = d_poisson_spec.getDConstant(); } boost::shared_ptr > m_data ( - patch.getPatchData(d_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_m_id) ) ); double maxres=0.0; if ( d_poisson_spec.dIsVariable() && d_poisson_spec.cIsVariable() ) { @@ -3529,7 +3491,8 @@ EllipticFACOps::xeqScheduleProlongation( if ( ! d_prolongation_refine_schedules[dest_ln] ) { TBOX_ERROR("Expected schedule not found."); } - xfer::RefineAlgorithm refiner(tbox::Dimension(NDIM)); + xfer::RefineAlgorithm refiner; + refiner. registerRefine( dst_id , src_id , @@ -3629,7 +3592,8 @@ EllipticFACOps::xeqScheduleGhostFill( if ( ! d_ghostfill_refine_schedules[dest_ln] ) { TBOX_ERROR("Expected schedule not found."); } - xfer::RefineAlgorithm refiner(tbox::Dimension(NDIM)); + xfer::RefineAlgorithm refiner; + refiner. registerRefine( dst_id , dst_id , @@ -3654,7 +3618,8 @@ EllipticFACOps::xeqScheduleGhostFillNoCoarse( if ( ! d_ghostfill_nocoarse_refine_schedules[dest_ln] ) { TBOX_ERROR("Expected schedule not found."); } - xfer::RefineAlgorithm refiner(tbox::Dimension(NDIM)); + xfer::RefineAlgorithm refiner; + refiner. registerRefine( dst_id , dst_id , diff --git a/source/EllipticFACOps.I b/source/EllipticFACOps.I index f4be4ff7..006fc9d9 100644 --- a/source/EllipticFACOps.I +++ b/source/EllipticFACOps.I @@ -77,7 +77,7 @@ void EllipticFACOps::setCConstant( const double scalar ) { } SAMRAI_INLINE_KEYWORD -void EllipticFACOps::setPreconditioner(const solv::FACPreconditioner *preconditioner ) +void EllipticFACOps::setPreconditioner(const FACPreconditioner *preconditioner ) { d_preconditioner = preconditioner; return; diff --git a/source/EllipticFACOps.h b/source/EllipticFACOps.h index 682d7736..0a30340e 100644 --- a/source/EllipticFACOps.h +++ b/source/EllipticFACOps.h @@ -35,7 +35,7 @@ #include "SAMRAI/SAMRAI_config.h" -#include "SAMRAI/solv/FACPreconditioner.h" +#include "FACPreconditioner.h" #include "SAMRAI/solv/CartesianRobinBcHelper.h" #include "SAMRAI/xfer/CoarsenAlgorithm.h" #include "SAMRAI/pdat/SideVariable.h" @@ -416,7 +416,7 @@ class EllipticFACOps * The FAC preconditioner is accessed to get convergence data during * the cycle postprocessing step. It is optional. */ - void setPreconditioner( const solv::FACPreconditioner *preconditioner ); + void setPreconditioner( const FACPreconditioner *preconditioner ); /*! * @brief function to compute flux, using general diffusion @@ -828,7 +828,7 @@ class EllipticFACOps *hier::CoarseFineBoundary is a light object before * it is set for a level. */ - tbox::Array > d_cf_boundary; + std::vector > d_cf_boundary; //@} @@ -988,43 +988,43 @@ class EllipticFACOps //! @brief Error prolongation (refinement) operator. boost::shared_ptr d_prolongation_refine_operator; boost::shared_ptr d_prolongation_refine_algorithm; - tbox::Array > + std::vector > d_prolongation_refine_schedules; //! @brief Solution restriction (coarsening) operator. boost::shared_ptr d_urestriction_coarsen_operator; boost::shared_ptr d_urestriction_coarsen_algorithm; - tbox::Array > + std::vector > d_urestriction_coarsen_schedules; //! @brief Residual restriction (coarsening) operator. boost::shared_ptr d_rrestriction_coarsen_operator; boost::shared_ptr d_rrestriction_coarsen_algorithm; - tbox::Array > + std::vector > d_rrestriction_coarsen_schedules; //! @brief Coarsen operator for outerflux-to-flux boost::shared_ptr d_flux_coarsen_operator; boost::shared_ptr d_flux_coarsen_algorithm; - tbox::Array > + std::vector > d_flux_coarsen_schedules; //! @brief Refine operator for cell-like data from coarser level. boost::shared_ptr d_ghostfill_refine_operator; boost::shared_ptr d_ghostfill_refine_algorithm; - tbox::Array > + std::vector > d_ghostfill_refine_schedules; //! @brief Refine operator for cell-like data from same level. boost::shared_ptr d_ghostfill_nocoarse_refine_operator; boost::shared_ptr d_ghostfill_nocoarse_refine_algorithm; - tbox::Array > + std::vector > d_ghostfill_nocoarse_refine_schedules; //! @brief Refine operator for cell-like data from coarser level. boost::shared_ptr d_mobility_refine_operator; boost::shared_ptr d_mobility_refine_algorithm; - tbox::Array > + std::vector > d_mobility_refine_schedules; //@} @@ -1067,7 +1067,7 @@ class EllipticFACOps * * See setPreconditioner(). */ - const solv::FACPreconditioner *d_preconditioner; + const FACPreconditioner *d_preconditioner; /*! * @brief Hierarchy cell operator used in debugging. diff --git a/source/EllipticFACSolver.C b/source/EllipticFACSolver.C index 6ee98a3e..8a145026 100644 --- a/source/EllipticFACSolver.C +++ b/source/EllipticFACSolver.C @@ -59,12 +59,12 @@ using namespace std; EllipticFACSolver::EllipticFACSolver ( const std::string &object_name, - EllipticFACOps * fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr& database ) : d_object_name(object_name), d_fac_ops(fac_ops), - d_fac_precond(object_name+"::fac_precond",*d_fac_ops), + d_fac_precond(object_name+"::fac_precond",d_fac_ops), d_bc_object(NULL), d_simple_bc(tbox::Dimension(NDIM),object_name+"::bc"), d_ln_min(-1), @@ -105,7 +105,7 @@ EllipticFACSolver::EllipticFACSolver ( * to get data for logging. */ d_fac_ops->setPreconditioner( - (const solv::FACPreconditioner*)(&d_fac_precond) ); + (const FACPreconditioner*)(&d_fac_precond) ); if ( database ) { getFromInput(database); @@ -127,7 +127,6 @@ EllipticFACSolver::EllipticFACSolver ( EllipticFACSolver::~EllipticFACSolver() { deallocateSolverState(); - delete d_fac_ops; return; } @@ -421,14 +420,17 @@ EllipticFACSolver::solveSystem(const int u_id, d_fac_ops->setWeightIds(ew_id, d_vol_id); - //d_fac_precond.printClassData(tbox::pout); +#if 0 + d_fac_precond.printClassData(tbox::pout); - //double normf = d_hopscell->weightedRMSNorm(f_id, ew_id, d_vol_id); - //tbox::pout << "EllipticFACSolver ("< > cell_variable ( - variable, - boost::detail::dynamic_cast_tag() ); + BOOST_CAST,hier::Variable>(variable) ); if ( !cell_variable ) { TBOX_ERROR(d_object_name << ": hier::Patch data index " << u << " is not a cell-double variable.\n"); @@ -541,8 +542,7 @@ EllipticFACSolver::createVectorWrappers(int u, << f << "\n"); } boost::shared_ptr > cell_variable ( - variable, - boost::detail::dynamic_cast_tag() ); + BOOST_CAST,hier::Variable>(variable) ); if ( !cell_variable ) { TBOX_ERROR(d_object_name << ": hier::Patch data index " << f << " is not a cell-double variable.\n"); diff --git a/source/EllipticFACSolver.h b/source/EllipticFACSolver.h index 2d1fd34a..b8e38ee4 100644 --- a/source/EllipticFACSolver.h +++ b/source/EllipticFACSolver.h @@ -34,12 +34,12 @@ #define included_EllipticFACSolver #include "SAMRAI/tbox/Database.h" -#include "SAMRAI/solv/FACPreconditioner.h" #include "SAMRAI/solv/CartesianRobinBcHelper.h" #include "SAMRAI/SAMRAI_config.h" #include "EllipticFACOps.h" +#include "FACPreconditioner.h" #include using namespace SAMRAI; @@ -158,7 +158,7 @@ class EllipticFACSolver */ EllipticFACSolver( const std::string &object_name, - EllipticFACOps * fac_ops, + const boost::shared_ptr fac_ops, const boost::shared_ptr& database = boost::shared_ptr() ); @@ -589,12 +589,12 @@ class EllipticFACSolver * @brief FAC operator implementation corresponding to cell-centered * Poisson discretization. */ - EllipticFACOps * d_fac_ops; + boost::shared_ptr d_fac_ops; /*! * @brief FAC preconditioner algorithm. */ - solv::FACPreconditioner d_fac_precond; + FACPreconditioner d_fac_precond; /*! * @brief Robin bc object in use. diff --git a/source/EtaFACOps.C b/source/EtaFACOps.C index 6abfa0c3..706e7fd6 100644 --- a/source/EtaFACOps.C +++ b/source/EtaFACOps.C @@ -113,16 +113,16 @@ void EtaFACOps::setC( const hier::Box& patch_box = patch->getBox(); boost::shared_ptr< pdat::CellData > phi_data ( - patch->getPatchData( phi_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phi_id) ) ); boost::shared_ptr< pdat::CellData > eta_data ( - patch->getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( eta_id) ) ); boost::shared_ptr< pdat::CellData > local_m_data ( - patch->getPatchData( d_m_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_m_id) ) ); boost::shared_ptr< pdat::CellData > cdata ( - patch->getPatchData( d_c_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_c_id) ) ); setCOnPatchPrivate( phi_data, diff --git a/source/EtaFACSolver.C b/source/EtaFACSolver.C index 364a1df0..5a8405c1 100644 --- a/source/EtaFACSolver.C +++ b/source/EtaFACSolver.C @@ -37,7 +37,7 @@ using namespace std; EtaFACSolver::EtaFACSolver ( const std::string &object_name, - EtaFACOps* fac_ops, + boost::shared_ptr fac_ops, boost::shared_ptr database ) : EllipticFACSolver( object_name, fac_ops, database ) @@ -55,7 +55,8 @@ void EtaFACSolver::setOperatorCoefficients( const double eta_well_scale, const string eta_well_func_type ) { - EtaFACOps* eta_fac_ops = dynamic_cast( d_fac_ops ); + boost::shared_ptr eta_fac_ops ( + boost::dynamic_pointer_cast< EtaFACOps, EllipticFACOps >( d_fac_ops ) ); eta_fac_ops->setOperatorCoefficients( phase_id, diff --git a/source/EtaFACSolver.h b/source/EtaFACSolver.h index 072d695f..482f8d74 100644 --- a/source/EtaFACSolver.h +++ b/source/EtaFACSolver.h @@ -47,7 +47,7 @@ class EtaFACSolver EtaFACSolver( const std::string &object_name, - EtaFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr database = boost::shared_ptr() ); diff --git a/source/FACPreconditioner.C b/source/FACPreconditioner.C new file mode 100644 index 00000000..31cfa137 --- /dev/null +++ b/source/FACPreconditioner.C @@ -0,0 +1,870 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: FAC algorithm for solving linear equations on a hierarchy + * + ************************************************************************/ +#include "FACPreconditioner.h" + +#include "SAMRAI/math/HierarchyDataOpsManager.h" +#include "SAMRAI/tbox/Timer.h" +#include "SAMRAI/tbox/TimerManager.h" +#include "SAMRAI/tbox/MathUtilities.h" + +#include IOMANIP_HEADER_FILE + + +using namespace std; + +/* + ************************************************************************* + * + * Constructor checks arguments and sets uninitialized solver state. + * + ************************************************************************* + */ + +FACPreconditioner::FACPreconditioner( + const std::string& name, + boost::shared_ptr user_ops, + const boost::shared_ptr& input_db): + d_object_name(name), + d_fac_operator(user_ops), + d_coarsest_ln(0), + d_finest_ln(0), + d_max_iterations(10), + d_residual_tolerance(1.0e-6), + d_relative_residual_tolerance(-1.0), + d_presmoothing_sweeps(1), + d_postsmoothing_sweeps(1), + d_algorithm_choice("default"), + d_number_iterations(0), + d_residual_norm(tbox::MathUtilities::getMax()), + d_convergence_factor(), + d_avg_convergence_factor(tbox::MathUtilities::getMax()), + d_net_convergence_factor(tbox::MathUtilities::getMax()), + d_controlled_level_ops() +{ + + t_solve_system = tbox::TimerManager::getManager()-> + getTimer("FACPreconditioner::solveSystem()_fac_cycling"); + + /* + * Initialize object with data read from input database. + */ + getFromInput(input_db); +} + +/* + ************************************************************************* + * + * Destructor for FACPreconditioner. + * + ************************************************************************* + */ + +FACPreconditioner::~FACPreconditioner() +{ + deallocateSolverState(); +} + +/* + ******************************************************************** + * Set state from database + ******************************************************************** + */ + +void +FACPreconditioner::getFromInput( + const boost::shared_ptr& input_db) +{ + if (input_db) { + d_max_iterations = input_db->getIntegerWithDefault("max_cycles", 10); + if (!(d_max_iterations >= 1)) { + INPUT_RANGE_ERROR("max_cycles"); + } + + d_residual_tolerance = + input_db->getDoubleWithDefault("residual_tol", 1.0e-6); + if (!(d_residual_tolerance > 0.0)) { + INPUT_RANGE_ERROR("residual_tol"); + } + + d_relative_residual_tolerance = + input_db->getDoubleWithDefault("relative_residual_tol", -1.0); + if (!(d_relative_residual_tolerance > 0.0 || + d_relative_residual_tolerance == -1)) { + INPUT_RANGE_ERROR("relative_residual_tol"); + } + + d_presmoothing_sweeps = + input_db->getIntegerWithDefault("num_pre_sweeps", 1); + if (!(d_presmoothing_sweeps >= 0)) { + INPUT_RANGE_ERROR("num_pre_sweeps"); + } + + d_postsmoothing_sweeps = + input_db->getIntegerWithDefault("num_post_sweeps", 1); + if (!(d_postsmoothing_sweeps >= 0)) { + INPUT_RANGE_ERROR("num_post_sweeps"); + } + } +} + +/* + ************************************************************************* + * + * Functions for setting up and deallocating solver state. + * + ************************************************************************* + */ +void +FACPreconditioner::deallocateSolverState() +{ + /* + * Delete hierarchy-dependent state data. + */ + + if (d_patch_hierarchy) { + + d_coarsest_ln = d_finest_ln = -1; + d_patch_hierarchy.reset(); + + if (d_error_vector) { + d_error_vector->freeVectorComponents(); + d_error_vector.reset(); + } + if (d_tmp_error) { + d_tmp_error->freeVectorComponents(); + d_tmp_error.reset(); + } + if (d_residual_vector) { + d_residual_vector->freeVectorComponents(); + d_residual_vector.reset(); + } + if (d_tmp_residual) { + d_tmp_residual->freeVectorComponents(); + d_tmp_residual.reset(); + } + + d_controlled_level_ops.clear(); + d_fac_operator->deallocateOperatorState(); + } +} + +void +FACPreconditioner::initializeSolverState( + const solv::SAMRAIVectorReal& solution, + const solv::SAMRAIVectorReal& rhs) +{ + /* + * First get rid of current data. + */ + deallocateSolverState(); + /* + * Set hierarchy and levels to solve. + */ + d_patch_hierarchy = solution.getPatchHierarchy(); + d_coarsest_ln = solution.getCoarsestLevelNumber(); + d_finest_ln = solution.getFinestLevelNumber(); + /* + * Set the solution-vector-dependent scratch space. + */ + d_error_vector = solution.cloneVector(d_object_name + "::error"); + d_error_vector->allocateVectorData(); + if (d_algorithm_choice == "mccormick-s4.3") { + d_tmp_error = solution.cloneVector(d_object_name + "::temporary_error"); + d_tmp_error->allocateVectorData(); + } + d_residual_vector = rhs.cloneVector(d_object_name + "::residual"); + d_residual_vector->allocateVectorData(); + d_tmp_residual = rhs.cloneVector(d_object_name + "::FAC coarser residual"); + d_tmp_residual->allocateVectorData(); + /* + * Set the controlled level operators, which depend on the number + * of components in the solution vector. + */ + math::HierarchyDataOpsManager* ops_manager = + math::HierarchyDataOpsManager::getManager(); + int num_components = solution.getNumberOfComponents(); + d_controlled_level_ops.resize(num_components); + for (int i = 0; i < num_components; ++i) { + d_controlled_level_ops[i] = + ops_manager->getOperationsDouble( + solution.getComponentVariable(i), + d_patch_hierarchy, + true); + /* + * Note: the variable used above is only for the purpose of determining + * the variable alignment on the grid. It is not specific to any + * instance. + */ + } + /* + * Error checking. + */ +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_patch_hierarchy != rhs.getPatchHierarchy()) { + TBOX_ERROR(d_object_name << ": vectors must have the same hierarchy.\n"); + } + if (d_coarsest_ln < 0) { + TBOX_ERROR(d_object_name << ": coarsest level must not be negative.\n"); + } + if (d_coarsest_ln > d_finest_ln) { + TBOX_ERROR(d_object_name << ": coarsest level must be <= finest" + << "level.\n"); + } +#endif + for (int ln = d_coarsest_ln; ln <= d_finest_ln; ++ln) { + if (!d_patch_hierarchy->getPatchLevel(ln)) { + TBOX_ERROR("FACPreconditioner::initializeSolverState error ..." + << "\n object name = " << d_object_name + << "\n hierarchy level " << ln + << " does not exist" << std::endl); + } + } + d_fac_operator->initializeOperatorState(solution, rhs); +} + +bool +FACPreconditioner::checkVectorStateCompatibility( + const solv::SAMRAIVectorReal& solution, + const solv::SAMRAIVectorReal& rhs) const +{ + /* + * It is an error when the state is not initialized. + */ + if (!d_patch_hierarchy) { + TBOX_ERROR( + d_object_name << ": cannot check vector-state\n" + << "compatibility when the state is uninitialized.\n"); + } + bool rvalue = true; + const solv::SAMRAIVectorReal& error = *d_error_vector; + if (solution.getPatchHierarchy() != d_patch_hierarchy + || rhs.getPatchHierarchy() != d_patch_hierarchy) { + rvalue = false; + } + if (rvalue == true) { + if (solution.getCoarsestLevelNumber() != d_coarsest_ln + || rhs.getCoarsestLevelNumber() != d_coarsest_ln + || solution.getFinestLevelNumber() != d_finest_ln + || rhs.getFinestLevelNumber() != d_finest_ln) { + rvalue = false; + } + } + if (rvalue == true) { + const int ncomp = error.getNumberOfComponents(); + if (solution.getNumberOfComponents() != ncomp + || rhs.getNumberOfComponents() != ncomp) { + rvalue = false; + } + } + return rvalue; +} + +/* + ************************************************************************* + * + * Solve the linear system and report whether itertion converged. + * + ************************************************************************* + */ + +bool +FACPreconditioner::solveSystem( + solv::SAMRAIVectorReal& u, + solv::SAMRAIVectorReal& f) +{ + + d_residual_norm = tbox::MathUtilities::getSignalingNaN(); + d_avg_convergence_factor = tbox::MathUtilities::getSignalingNaN(); + + /* + * Set the solution-vector-dependent data if not preset. + */ + bool clear_hierarchy_configuration_when_done = false; + if (!d_patch_hierarchy) { + clear_hierarchy_configuration_when_done = true; + initializeSolverState(u, f); + } else { +#ifdef DEBUG_CHECK_ASSERTIONS + if (!checkVectorStateCompatibility(u, f)) { + TBOX_ERROR(d_object_name << ": Incompatible vectors for\n" + << "current state in solveSystem.\n"); + } +#endif + } + + t_solve_system->start(); + + d_error_vector->setToScalar(0.0, false); + if (d_tmp_error) { + d_tmp_error->setToScalar(0.0, false); + } + d_residual_vector->setToScalar(0.0); + + const double initial_residual_norm = d_residual_norm = + computeFullCompositeResidual(*d_residual_vector, + u, + f); + /* + * Above step has the side effect of filling the residual + * vector d_residual_vector. + */ + + double effective_residual_tolerance = d_residual_tolerance; + if (d_relative_residual_tolerance >= 0) { + double tmp = d_fac_operator->computeResidualNorm(f, + d_finest_ln, + d_coarsest_ln); + tmp *= d_relative_residual_tolerance; + if (effective_residual_tolerance < tmp) effective_residual_tolerance = + tmp; + } + + if (static_cast(d_convergence_factor.size()) < d_max_iterations) + d_convergence_factor.resize(d_max_iterations); + d_number_iterations = 0; + /* + * Use a do loop instead of a while loop until convergence. + * It is important to go through the loop at least once + * because the residual norm can be less than the tolerance + * when the solution is 0 and the rhs is less than the tolerance. + */ + do { + + /* + * In zeroing the error vector, also zero out the ghost values. + * This gives the FAC operator an oportunity to bypass the + * ghost filling if it decides that the ghost values do not + * change. + */ + d_error_vector->setToScalar(0.0, false); + /* + * Both the recursive and non-recursive fac cycling functions + * were coded to find the problem due presmoothing. Both give + * the same results, but the problem due to presmoothing still + * exists. BTNG. + */ + if (d_algorithm_choice == "default") { + facCycle_Recursive(*d_error_vector, + *d_residual_vector, + u, + d_finest_ln, + d_coarsest_ln, + d_finest_ln); + } else if (d_algorithm_choice == "mccormick-s4.3") { + facCycle_McCormick(*d_error_vector, + *d_residual_vector, + u, + d_finest_ln, + d_coarsest_ln, + d_finest_ln); + } else if (d_algorithm_choice == "pernice") { + facCycle(*d_error_vector, + *d_residual_vector, + u, + d_finest_ln, + d_coarsest_ln); + } + + int i, num_components = d_error_vector->getNumberOfComponents(); + /* + * u += e + */ + for (i = 0; i < num_components; ++i) { + int soln_id = u.getComponentDescriptorIndex(i); + int err_id = d_error_vector->getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(d_coarsest_ln, d_finest_ln); + d_controlled_level_ops[i]->add(soln_id, + soln_id, + err_id); + } + + /* + * Synchronize solution across levels by coarsening the + * more accurate fine-level solutions. + */ + for (int ln = d_finest_ln - 1; ln >= d_coarsest_ln; --ln) { + d_fac_operator->restrictSolution(u, + u, + ln); + } + + /* + * Compute convergence factor and new residual norm. + * 1. Temporarily save pre-cycle residual norm in + * convergence factor stack. + * 2. Compute post-cycle residual norm. + * 3. Set convergence factor to ratio of post-cycle to pre-cycle + * residual norms. + */ + d_convergence_factor[d_number_iterations] = d_residual_norm; + d_residual_norm = computeFullCompositeResidual(*d_residual_vector, + u, + f); + +// Disable Intel warning on real comparison +#ifdef __INTEL_COMPILER +#pragma warning (disable:1572) +#endif + if (d_convergence_factor[d_number_iterations] != 0) { + d_convergence_factor[d_number_iterations] = + d_residual_norm / d_convergence_factor[d_number_iterations]; + } else { + d_convergence_factor[d_number_iterations] = 0; + } + + /* + * Increment the iteration counter. + * The rest of this block expects it to have the incremented value. + * In particular, d_fac_operator->postprocessOneCycle does. + */ + ++d_number_iterations; + + /* + * Compute the convergence factors because they may be accessed + * from the operator's postprocessOneCycle function. + */ + d_net_convergence_factor = d_residual_norm + / (initial_residual_norm + 1e-20); + d_avg_convergence_factor = pow(d_net_convergence_factor, + 1.0 / d_number_iterations); + + d_fac_operator->postprocessOneCycle(d_number_iterations - 1, + u, + *d_residual_vector); + + } while ((d_residual_norm > effective_residual_tolerance) + && (d_number_iterations < d_max_iterations)); + + t_solve_system->stop(); + + if (clear_hierarchy_configuration_when_done) { + deallocateSolverState(); + } + //tbox::plog<<"FACPreconditioner::solveSystem, d_residual_norm="<& e, + solv::SAMRAIVectorReal& r, + solv::SAMRAIVectorReal& u, + int lmax, + int lmin, + int ln) +{ + + /* + * The steps 1-4 in this function correspond to McCormick's steps + * those in his description. + * + * 1. If on the coarsest level, solve it. + * 2. Presmoothing. + * 3. Recurse to next lower level. + * 4. Postsmoothing. + */ + + /* + * Step 1. + */ + if (ln == lmin) { + /* + * Solve coarsest level. + */ + d_fac_operator->solveCoarsestLevel(e, + r, + ln); + } else { + + int i, num_components = e.getNumberOfComponents(); + + /* + * Step 2a. + */ + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, + e, + r, + ln, + true); + for (i = 0; i < num_components; ++i) { + int tmp_id = d_tmp_error->getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(ln, + ln); + d_controlled_level_ops[i]->setToScalar(tmp_id, + 0.0); + } + /* + * Step 2b. + */ + d_fac_operator->smoothError(*d_tmp_error, + *d_tmp_residual, + ln, + d_presmoothing_sweeps); + /* + * Step 2c. + */ + for (i = 0; i < num_components; ++i) { + int tmp_id = d_tmp_error->getComponentDescriptorIndex(i); + int id = e.getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(ln, + ln); + d_controlled_level_ops[i]->add(id, + id, + tmp_id); + } + /* + * Step 3a. + */ + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, + e, + r, + ln, + true); + d_fac_operator->restrictResidual(*d_tmp_residual, + *d_tmp_residual, + ln - 1); + /* + * Step 3b. + */ + for (i = 0; i < num_components; ++i) { + int tmp_id = e.getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(ln - 1, + ln - 1); + d_controlled_level_ops[i]->setToScalar(tmp_id, + 0.0); + } + /* + * Step 3c. + */ + facCycle_McCormick(e, + r, + u, + lmax, + lmin, + ln - 1); + /* + * Step 3d. + */ + d_fac_operator->prolongErrorAndCorrect(e, + e, + ln); + /* + * Step 4a. + */ + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, + e, + r, + ln, + true); + for (i = 0; i < num_components; ++i) { + int tmp_id = d_tmp_error->getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(ln, + ln); + d_controlled_level_ops[i]->setToScalar(tmp_id, + 0.0); + } + /* + * Step 4b. + */ + d_fac_operator->smoothError(*d_tmp_error, + *d_tmp_residual, + ln, + d_postsmoothing_sweeps); + /* + * Step 4c. + */ + for (i = 0; i < num_components; ++i) { + int tmp_id = d_tmp_error->getComponentDescriptorIndex(i); + int id = e.getComponentDescriptorIndex(i); + d_controlled_level_ops[i]->resetLevels(ln, + ln); + d_controlled_level_ops[i]->add(id, + id, + tmp_id); + } + + } +} + +/* + ************************************************************************* + * + * Reimplementation of the FAC cycle Michael Pernice coded up + * in the first version of FACPreconditioner (the version + * that did not separate out the operators. + * + ************************************************************************* + */ +void +FACPreconditioner::facCycle( + solv::SAMRAIVectorReal& e, + solv::SAMRAIVectorReal& r, + solv::SAMRAIVectorReal& u, + int lmax, + int lmin) +{ + + NULL_USE(u); + + int ln; + + /* + * V-cycle descent. + */ + for (ln = lmax; ln > lmin; --ln) { + /* + * Presmoothing. + */ + d_fac_operator->smoothError(e, + r, + ln, + d_presmoothing_sweeps); + /* + * Compute residual to see how much correction is still needed: + * d_tmp_residual <- r - A e + */ + d_fac_operator->computeCompositeResidualOnLevel(*d_tmp_residual, + e, + r, + ln, + true); + /* + * Change the residual on the part of the next coarser level + * below this level, so that the solve on the next coarser + * level really solves for the correction for this level + * where they overlap. + */ + d_fac_operator->restrictResidual(*d_tmp_residual, + r, + ln - 1); + } // End V-cycle descent. + + /* + * V-cycle ascent. + */ + for (ln = lmin; ln <= lmax; ++ln) { + /* + * Update the error by prolonging and postsmoothing, + * except on coarse level where an exact solve is performed. + */ + if (ln == lmin) { + /* + * Solve coarsest level. + */ + d_fac_operator->solveCoarsestLevel(e, + r, + ln); + } else { + /* + * Apply the coarse level correction to this level. + */ + d_fac_operator->prolongErrorAndCorrect(e, + e, + ln); + + /* + * Postsmoothing on the error, + * with inhomogeneous boundary condition. + */ + /* + * Postsmoothing. + */ + d_fac_operator->smoothError(e, + r, + ln, + d_postsmoothing_sweeps); + + } + + } // End V-cycle ascent. +} + +/* + ************************************************************************* + * + * Private member function to compute the composite residual on all + * levels and return residual norm. + * + ************************************************************************* + */ + +double +FACPreconditioner::computeFullCompositeResidual( + solv::SAMRAIVectorReal& r, + solv::SAMRAIVectorReal& u, + solv::SAMRAIVectorReal& f) +{ + + d_fac_operator->computeCompositeResidualOnLevel + (r, + u, + f, + d_finest_ln, + false); + + for (int ln = d_finest_ln - 1; ln >= d_coarsest_ln; --ln) { + + // Bring down more accurate solution from finer level. + d_fac_operator->restrictSolution(u, u, ln); + + d_fac_operator->computeCompositeResidualOnLevel + (r, + u, + f, + ln, + false); + + // Bring down more accurate residual from finer level. + d_fac_operator->restrictResidual(r, + r, + ln); + + } + + double residual_norm = + d_fac_operator->computeResidualNorm(r, + d_finest_ln, + d_coarsest_ln); + + return residual_norm; + +} + +/* + ************************************************************************* + * + * Print internal data, mostly for debugging. + * + ************************************************************************* + */ +void +FACPreconditioner::printClassData( + std::ostream& os) const { + os << "printing FACPreconditioner data...\n" + << "FACPreconditioner: this = " << (FACPreconditioner *)this << "\n" + << "d_object_name = " << d_object_name << "\n" + << "d_coarsest_ln = " << d_coarsest_ln << "\n" + << "d_finest_ln = " << d_finest_ln << "\n" + << "d_max_iterations = " << d_max_iterations << "\n" + << "d_residual_tolerance = " << d_residual_tolerance << "\n" + << "d_relative_residual_tolerance = " << d_relative_residual_tolerance + << "\n" + << "d_presmoothing_sweeps = " << d_presmoothing_sweeps << "\n" + << "d_postsmoothing_sweeps = " << d_postsmoothing_sweeps << "\n" + << "d_number_iterations = " << d_number_iterations << "\n" + << "d_residual_norm = " << d_residual_norm << "\n" + << std::endl; + +} + +void +FACPreconditioner::setAlgorithmChoice( + const std::string& choice) +{ + /* This ptr_function helps resolve to the correct tolower method */ + int (* ptr_function)( + int) = std::tolower; + std::string lower = choice; + std::transform(lower.begin(), + lower.end(), + lower.begin(), + ptr_function); +#ifdef DEBUG_CHECK_ASSERTIONS + if (lower != "default" /* Recursive from BTNG */ + && lower != "mccormick-s4.3" /* McCormick's section 4.3 */ + && lower != "pernice" /* Translation of Pernice's */ + ) { + TBOX_ERROR( + d_object_name << ": algorithm should be set to one of\n" + << "'default' (recommended), 'mccormick-s4.3' or 'pernice'\n"); + } +#endif + d_algorithm_choice = lower; +} + diff --git a/source/FACPreconditioner.h b/source/FACPreconditioner.h new file mode 100644 index 00000000..9bdcbee3 --- /dev/null +++ b/source/FACPreconditioner.h @@ -0,0 +1,718 @@ +/************************************************************************* + * + * This file is part of the SAMRAI distribution. For full copyright + * information, see COPYRIGHT and COPYING.LESSER. + * + * Copyright: (c) 1997-2016 Lawrence Livermore National Security, LLC + * Description: FAC algorithm for solving linear equations on a hierarchy + * + ************************************************************************/ + +#ifndef included_FACPreconditioner +#define included_FACPreconditioner + +#include "SAMRAI/SAMRAI_config.h" + +#include "SAMRAI/math/HierarchyDataOpsReal.h" +#include "SAMRAI/solv/FACOperatorStrategy.h" +#include "SAMRAI/solv/SAMRAIVectorReal.h" +#include "SAMRAI/tbox/Utilities.h" + +#include +#include + +#include "boost/shared_ptr.hpp" + +using namespace SAMRAI; + +/*! + * @brief Implements the FAC iterative solution procedure + * for a linear system of equations, Au=f, defined + * on some subset of levels in an AMR patch hierarchy. + * + * The solution is found by applying an FAC algorithm + * to the composite grid represented in the hierarchy. + * After each FAC cycle the norm of the residual will be computed over + * all levels involved. The FAC iteration will stop when either the + * maximum number of iterations is reached, or the residual norm on + * all levels is below the given tolerance. + * + * The user must perform the following steps to use the FAC solver: + * -# Create a FACPreconditioner, providing a valid concrete + * FACOperatorStrategy object. + * -# Set the stopping criteria using the setStoppingParameters() function. + * -# Set the number of smooting sweeps using the setSmoothingSweeps() + * function. This is optional; if not used, the default is one sweep + * in each case. + * -# Enable logging to record the FAC residual norms during the FAC + * itertion using the setFACLogFlag() function. This is optional; + * the default is to turn logging off. When loggin is turned on, the + * default mode is to send this information to the application log + * file (i.e., plog). + * -# Invoke the FAC iteration process by calling solveSystem(), + * providing the vectors u and f, defined on a patch hierarchy + * containing the desired range of levels. + * -# After solving, get solver statistics by viewing the log information + * and calling getNumberOfIterations(), getResidualNorm() functions + * if desired. + * + * Input Parameters + * + * Definitions: + * - \b max_cycles + * + * - \b residual_tol + * + * - \b relative_residual_tol + * + * - \b num_pre_sweeps + * + * - \b num_post_sweeps + * + * Details:
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    parametertypedefaultrangeopt/reqbehavior on restart
    max_cyclesint10>=1optNot written to restart. Value in input db used.
    residual_toldouble1.0e-6>0.0optNot written to restart. Value in input db used.
    relative_residual_toldouble-1.0-1.0 or >0.0optNot written to restart. Value in input db used.
    num_pre_sweepsint1>=0optNot written to restart. Value in input db used.
    num_post_sweepsint1>=0optNot written to restart. Value in input db used.
    + * + */ + +class FACPreconditioner +{ +public: + /*! + * Constructor. + * + * @param name Object name + * @param user_ops Reference to user-specified FAC operator + * @param input_db Input database with initialization parameters + */ + FACPreconditioner( + const std::string& name, + boost::shared_ptr user_ops, + const boost::shared_ptr& input_db = + boost::shared_ptr()); + + /*! + * Virtual destructor. + */ + virtual ~FACPreconditioner(); + + /*! + * @brief Solve linear system Au=f using the FAC algorithm. + * + * The return value is true if the solver + * converged and false otherwise. + * The problem-specific portions of the FAC procedure, + * including the definitions of A are provided by the + * FACOperatorStrategy object passed to the constructor. More + * information about the iteration can be found by calling the functions + * getNumberOfIterations() and getResidualNorm() and by looking at the + * log information. + * + * Before calling this function, the form of the solution and + * right-hand-side quantities should be set properly by the user + * on all patch interiors on the range of levels covered by the + * FAC iteration. All data in these vectors (that will be used + * by the FACOperatorStrategy implementation) should be allocated. + * Thus, the user is responsible for managing the + * storage for the solution and right-hand-side. + * + * Conditions on arguments: + * - vectors solution and rhs must have same hierarchy + * - vectors solution and rhs must have same variables (except that + * solution can--and should--have enough ghost cells for computation). + * + * Upon return from this function, + * the solution vector will contain the result of the solve. + * + * @param solution solution vector u + * @param rhs right hand side vector f + * + * See initializeSolverState() and deallocateSolverState() + * for opportunities to save overhead + * when using multiple consecutive solves. + * + * @return whether solver converged to specified level + * + * @see initializeSolverState + * + * @pre !d_patch_hierarchy || checkVectorStateCompatibility(solution, rhs) + */ + bool + solveSystem( + solv::SAMRAIVectorReal& solution, + solv::SAMRAIVectorReal& rhs); + + /*! + * @brief Compute hierarchy-dependent data required for solving + * + * By default, the solveSystem() method + * computes some required hierarchy-dependent data before + * solving and removes that data after the solve. + * For multiple solves using the same hierarchy configuration, + * it is more efficient to manually compute, using + * initializeSolverState(), and remove, using deallocateSolverState(), + * the hierarchy-dependent data so that it is not done inside + * solveSystem(). If solveSystem() detects that the solver state + * is already initialized, it will @em NOT change the state. + * + * The vector arguments for solveSystem() need not match + * those for initializeSolverState(). However, there must + * be a certain degree of similarity, including + * - hierarchy configuration (hierarchy pointer and level range) + * - number, type and alignment of vector component data + * - ghost cell width of data in the solution vector + * + * When assertion checking is enabled, limited checking is done + * by solveSystem() to help ensure that of the vectors passed + * to solveSystem() is compatible with the existing state. + * + * It is important to remember to reinitialize the solver state + * when your hierarchy configuration changes. + * + * It is safe to initializeSolverState() when the state is + * already initialized (the state is deallocated and reinitialized). + * + * Conditions on arguments: + * - solution and rhs must have same hierarchy + * - solution and rhs must have same structure, depth, etc. + * (except that u can--and should--have enough ghost cells + * for computation). + * - coarsest_ln through finest_ln must exist in u. + * + * To unset the data set in this function, + * see deallocateSolverState(). + * + * After setting data for the current object, this function + * calls the operator's corresponding function, + * FACOperatorStrategy::initializeOperatorState() + * so that the operator object can take steps to remain + * in sync. + * + * @param solution solution vector u + * @param rhs right hand side vector f + * + * @post d_patch_hierarchy == rhs.getPatchHierarchy() + * @post d_coarsest_ln >= 0 + * @post d_coarsest_ln <= d_finest_ln + */ + void + initializeSolverState( + const solv::SAMRAIVectorReal& solution, + const solv::SAMRAIVectorReal& rhs); + + /*! + * @brief Remove all hierarchy-dependent data computed by + * initializeSolverState() + * + * Remove all hierarchy-dependent data set by initializeSolverState(). + * It is safe to call deallocateSolverState() even state is already + * deallocated. + * + * After deallocating data for the current object, this function + * calls the operator's corresponding function, + * FACOperatorStrategy::deallocateOperatorState() + * so that the operator object can take steps to remain + * in sync. + * + * @see initializeSolverState + */ + void + deallocateSolverState(); + + /*! + * @brief Check compatibility of vectors with existing solver state. + * + * Check whether the solution and residual vectors given are + * compatible with the existing solver state (solver state + * must be initialized). Compatibility means that the vectors + * are sufficiently similar with the vectors with which the + * state are initialized. Compatibility implies that the + * vectors may be used in solveSystem(). + * + * The checking is not perfect! + * Due to the possibility of user-defined patch data, + * data-dependent checks cannot be performed. + * It is possible that a false compatibility is returned. + * + * @return true if vectors are compatible with existing state + * + * @pre d_patch_hierarchy + */ + bool + checkVectorStateCompatibility( + const solv::SAMRAIVectorReal& solution, + const solv::SAMRAIVectorReal& rhs) const; + + //@{ + //! @name Functions to set solving parameters. + + /*! + * @brief Set the choice of FAC cycling algorithm to use. + * + * For developer experimentation use only. + * All others should use the default choice. + * + * @internal This function allows us to switch the cycling + * algorithm to compare them. This is mainly a debugging + * feature and will be removed at some time. Current + * choices are: + * - "default": the default recursive algorithm interpreted + * and coded by BTNG. + * - "mccormick-s4.3": algorithm coded by BTNG, following Steve McCormick's + * section 4.3 + * - "pernice": algorithm coded by BTNG, interpretting the + * code originally written by Michael Pernice. + */ + void + setAlgorithmChoice( + const std::string& choice); + + //@} + + //@{ + //! @name Functions to get data on last solve. + + /*! + * @brief Return FAC iteration count from last (or current + * if there is one) FAC iteration process. + */ + int + getNumberOfIterations() const + { + return d_number_iterations; + } + + /*! + * @brief Get convergance rates of + * the last (or current if there is one) FAC solve. + * + * The convergence factor is the factor to which the residual + * has been reduced. The final factor is that from the last + * FAC cycle. + * + * @param avg_factor average convergence factor over FAC cycles + * from last solve. + * @param final_factor convergence factor of the last FAC cycle + * + * @pre d_number_iterations > 0 + */ + void + getConvergenceFactors( + double& avg_factor, + double& final_factor) const + { +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_number_iterations <= 0) { + TBOX_ERROR(d_object_name << ": Seeking convergence factors before\n" + << "a solve is invalid.\n"); + } +#endif + avg_factor = d_avg_convergence_factor; + final_factor = d_convergence_factor[d_number_iterations - 1]; + } + + /*! + * @brief Get the net convergance rate of + * the last (or current if there is one) FAC solve. + * + * The net factor is the factor to which the residual + * has been reduced by the FAC cycles. + * It is (current residual)/( initial residual + epsilon), + * so it may not be accurate if the initial residual is very small. + * + * @pre d_number_iterations > 0 + */ + double + getNetConvergenceFactor() const + { +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_number_iterations <= 0) { + TBOX_ERROR(d_object_name << ": Seeking convergence factors before\n" + << "a solve is invalid.\n"); + } +#endif + return d_net_convergence_factor; + } + + /*! + * @brief Get the average convergance rates of + * the last (or current if there is one) FAC solve. + * + * The average factor is the net factor to the power of + * 1/(number of FAC cycles). + * It may not be accurate if the initial residual is very small. + * + * @pre d_number_iterations > 0 + */ + double + getAvgConvergenceFactor() const + { +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_number_iterations <= 0) { + TBOX_ERROR(d_object_name << ": Seeking convergence factors before\n" + << "a solve is invalid.\n"); + } +#endif + return d_avg_convergence_factor; + } + + /*! + * @brief Get the final convergance rate of + * the last (or current if there is one) FAC solve. + * + * The final factor is the factor to which the residual + * has been reduced by the last FAC cycle. + * + * @pre d_number_iterations > 0 + */ + double + getFinalConvergenceFactor() const + { +#ifdef DEBUG_CHECK_ASSERTIONS + if (d_number_iterations <= 0) { + TBOX_ERROR(d_object_name << ": Seeking convergence factors before\n" + << "a solve is invalid.\n"); + } +#endif + return d_convergence_factor[d_number_iterations - 1]; + } + + /*! + * @brief Return residual norm from the just-completed FAC iteration. + * + * The norm return value is computed as the maximum norm over all + * patch levels involved in the solve. The value corresponds to the + * norm applied in the user-defined residual computation. + * + * The latest computed norm is the one returned. + */ + double + getResidualNorm() const + { + return d_residual_norm; + } + + //@} + + /*! + * @brief Print data members for debugging. + */ + virtual void + printClassData( + std::ostream& os) const; + + /*! + * @brief Get the name of this object. + * + * @return The name of this object. + */ + const std::string& + getObjectName() const + { + return d_object_name; + } + + /*! + * * @brief Set the max number of iterations (cycles) to use per solve. + * */ + void + setMaxCycles( + int max_cycles) + { + d_max_iterations = max_cycles; + } + + void + setResidualTolerance( + double residual_tol, + double relative_residual_tol = -1.0) + { + d_residual_tolerance = residual_tol; + d_relative_residual_tolerance = relative_residual_tol; + } + + +private: + //@{ + //! @name Functions not implemented: + FACPreconditioner( + const FACPreconditioner&); + FACPreconditioner& + operator = ( + const FACPreconditioner&); + //@} + + /*! + * @brief Set state using database + * + * See the class description for the parameters that can be set + * from a database. + * + * @param input_db Input database. If a NULL pointer is given, + * nothing is done. + */ + void + getFromInput( + const boost::shared_ptr& input_db); + + /*! + * @brief Compute composite residual on all levels and + * returns residual norm. + * + * Uses the FACOperatorStrategy::computeResidualOnLevel() function + * provided by the operator object to compute per level residual. + * Perform coarsen residual operation to get fine-grid approximation + * of residual on to coarse grid. + * + * The residual is r=f-Au. + * + * @param residual residual vector r + * @param solution solution vector u + * @param rhs right hand side vector f + */ + double + computeFullCompositeResidual( + solv::SAMRAIVectorReal& residual, + solv::SAMRAIVectorReal& solution, + solv::SAMRAIVectorReal& rhs); + + /*! + * @brief Perform recursive FAC cycle iteration. + * + * Do one FAC iteration of Ae=r system. The FAC algorithm + * modifies Ae=r on coarser levels so that each coarser + * level solves for the change in error of the next finer level, + * as is expected in the FAC algorithm. + * + * The level number range lmax to lmin + * must exist in the vectors e and r. + * + * Assumes: + * - The error vector is preset to 0 on levels lmin to ln. + * + * @param error error vector e + * @param residual residual vector r + * @param solution solution vector u + * @param lmax finest level number + * @param lmin coarsest level number + * @param ln current level number + */ + void + facCycle_Recursive( + solv::SAMRAIVectorReal& error, + solv::SAMRAIVectorReal& residual, + solv::SAMRAIVectorReal& solution, + int lmax, + int lmin, + int ln); + + /*! + * @brief Perform recursive FAC cycle iteration from McCormick. + * + * Do one FAC iteration of Ae=r system. The FAC algorithm + * modifies Ae=r on coarser levels so that each coarser + * level solves for the change in error of the next finer level, + * as is expected in the FAC algorithm. + * + * The level number range lmax to lmin + * must exist in the vectors e and r. + * + * Assumes: + * - The error vector is preset to 0 on levels lmin to ln. + * + * @param error error vector e + * @param residual residual vector r + * @param solution solution vector u + * @param lmax finest level number + * @param lmin coarsest level number + * @param ln current level number + */ + void + facCycle_McCormick( + solv::SAMRAIVectorReal& error, + solv::SAMRAIVectorReal& residual, + solv::SAMRAIVectorReal& solution, + int lmax, + int lmin, + int ln); + + /*! + * @brief Perform FAC cycle iteration. + * + * Do one FAC iteration of Ae=r system. The FAC algorithm + * modifies Ae=r on coarser levels so that each coarser + * level solves for the change in error of the next finer level, + * as is expected in the FAC algorithm. + * + * The level number range lmax to lmin + * must exist in the vectors e and r. + * + * Assumes: + * - The error vector is preset to 0. + * + * @internal McCormick warned that cell-centered finite-volume + * methods requires a W cycle, even in multigrid. So this + * function should be rewritten for that sort of flexibility. + * Probably, a recursive function is needed. + * + * @param error error vector e + * @param residual residual vector r + * @param solution solution vector u + * @param lmax finest level number + * @param lmin coarsest level number + */ + void + facCycle( + solv::SAMRAIVectorReal& error, + solv::SAMRAIVectorReal& residual, + solv::SAMRAIVectorReal& solution, + int lmax, + int lmin); + + /*! + * @brief Name of this FAC solver object. + */ + std::string d_object_name; + + /*! + * @brief Object providing problem-specific routines. + * + * Reference is initialized by constructor @em never changes. + */ + boost::shared_ptr d_fac_operator; + + //@{ + /*! + * @name Solution vector-dependent data. + * + * These variables are set by + * initializeSolverState and deallocateSolverState + * and used only during the solve process. + */ + + boost::shared_ptr d_patch_hierarchy; + int d_coarsest_ln; + int d_finest_ln; + + /*! + * @brief Clone of solution vector to store residual. + */ + boost::shared_ptr > d_residual_vector; + + /*! + * @brief Clone of solution vector to store temporary residual. + */ + boost::shared_ptr > d_tmp_residual; + + /*! + * @brief Error vector. + */ + boost::shared_ptr > d_error_vector; + + /*! + * @brief Error vector for homogeneous boundary condition problem.. + */ + boost::shared_ptr > d_tmp_error; + + //@} + + //@{ + /*! + * @name Parameters for FAC iteration. + */ + int d_max_iterations; + double d_residual_tolerance; + double d_relative_residual_tolerance; + int d_presmoothing_sweeps; + int d_postsmoothing_sweeps; + std::string d_algorithm_choice; + //@} + + //@{ + /*! + * @name Status quantitities for FAC iteration. + */ + int d_number_iterations; + double d_residual_norm; + + /*! + * @brief Convergence factor stack. + * + * The convergence factor stack is reset for each solve + * and contains the convergence factors for each FAC cycle. + */ + std::vector d_convergence_factor; + /*! + * The average convergence factor computed from the current + * values in d_convergence_factor. + */ + double d_avg_convergence_factor; + /*! + * The net convergence factor computed from the current + * values in d_convergence_factor. + */ + double d_net_convergence_factor; + //@} + + /*! + * @brief Objects facilitating operations over a specific range + * of levels. + */ + std::vector > > + d_controlled_level_ops; + + /*! + * Timers for performance measurement. + */ + boost::shared_ptr t_solve_system; +}; + +#endif diff --git a/source/FreeEnergyStrategy.C b/source/FreeEnergyStrategy.C index 5da7a3f9..a4d0b222 100644 --- a/source/FreeEnergyStrategy.C +++ b/source/FreeEnergyStrategy.C @@ -49,7 +49,7 @@ void FreeEnergyStrategy::computeDerivFreeEnergy( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > df ( - patch->getPatchData( df_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( df_id) ) ); assert( df ); df->fillAll( 0. ); diff --git a/source/GaussianTemperatureStrategy.C b/source/GaussianTemperatureStrategy.C index 11da3c85..624f142f 100644 --- a/source/GaussianTemperatureStrategy.C +++ b/source/GaussianTemperatureStrategy.C @@ -156,11 +156,11 @@ void GaussianTemperatureStrategy::setCurrentTemperature( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > t_data ( - patch->getPatchData( d_temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); setCurrentTemperaturePrivatePatch(*patch, t_data, tgaussian); boost::shared_ptr< pdat::CellData > ts_data ( - patch->getPatchData( d_temperature_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_scratch_id) ) ); setCurrentTemperaturePrivatePatch(*patch, ts_data, tgaussian); } @@ -182,8 +182,7 @@ void GaussianTemperatureStrategy::setCurrentTemperaturePrivatePatch( const double tgaussian ) { const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double* dx = patch_geom->getDx(); const double* xlo = patch_geom->getXLower(); diff --git a/source/GaussianTemperatureStrategy.h b/source/GaussianTemperatureStrategy.h index 0f04ac26..931675e5 100644 --- a/source/GaussianTemperatureStrategy.h +++ b/source/GaussianTemperatureStrategy.h @@ -81,19 +81,19 @@ class GaussianTemperatureStrategy: double d_initial_temperature; // Gaussian parameters - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[3]; // Gaussian center at t=0 - double d_center0[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double d_periodic_length[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center0[3]; + double d_periodic_length[3]; // velocity of Gaussian center - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_velocity[3]; double d_standard_dev; boost::shared_ptr d_grid_geometry; - int d_periodic_flag[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int d_periodic_flag[3]; void setCurrentTemperaturePrivatePatch( hier::Patch& patch, diff --git a/source/GrainNumberRefinePatchStrategy.C b/source/GrainNumberRefinePatchStrategy.C index b872caf0..4db75851 100644 --- a/source/GrainNumberRefinePatchStrategy.C +++ b/source/GrainNumberRefinePatchStrategy.C @@ -43,7 +43,7 @@ GrainNumberRefinePatchStrategy::GrainNumberRefinePatchStrategy( const string& object_name, boost::shared_ptr< tbox::Database > input_bc_db, const int grain_number_id ) - : xfer::RefinePatchStrategy(tbox::Dimension(NDIM)), + : xfer::RefinePatchStrategy(), d_object_name( object_name ), d_grain_number_id( grain_number_id ) { diff --git a/source/GrainNumberRefinePatchStrategy.h b/source/GrainNumberRefinePatchStrategy.h index 19ee35b7..e2191f48 100644 --- a/source/GrainNumberRefinePatchStrategy.h +++ b/source/GrainNumberRefinePatchStrategy.h @@ -114,9 +114,9 @@ class GrainNumberRefinePatchStrategy : (void) ratio; } - hier::IntVector getRefineOpStencilWidth() const + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension &dim) const { - return( hier::IntVector(tbox::Dimension(NDIM),1) ); + return hier::IntVector::getOne(dim); } //@} diff --git a/source/Grains.C b/source/Grains.C index b2d500f3..c3ff0c0b 100644 --- a/source/Grains.C +++ b/source/Grains.C @@ -53,7 +53,6 @@ Grains::Grains(const int qlen, d_number_of_grains = -1; d_grain_diag_isActive=false; d_grain_extend_isActive=false; - d_grain_extend_refine_sched.setNull(); d_grain_refine_strategy=NULL; d_grain_phase_threshold = 0.85; @@ -185,6 +184,8 @@ void Grains::initializeRefineCoarsenAlgorithms( boost::shared_ptr grid_geom, boost::shared_ptr quat_coarsen_op) { + tbox::plog<<"Grains::initializeRefineCoarsenAlgorithms()"<=0 ); assert( grid_geom ); @@ -195,7 +196,7 @@ void Grains::initializeRefineCoarsenAlgorithms( "CONSTANT_REFINE" ); d_grain_number_refine_alg.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM)) ); + new xfer::RefineAlgorithm() ); d_grain_number_refine_alg->registerRefine( d_grain_number_id, // destination @@ -229,7 +230,8 @@ void Grains::initializeRefineCoarsenAlgorithms( "CONSTANT_REFINE" ); d_grain_quat_refine_alg.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + new xfer::RefineAlgorithm() ); + d_grain_quat_refine_alg->registerRefine( d_grain_quat_scr_id, // destination d_grain_quat_id, // source @@ -237,7 +239,8 @@ void Grains::initializeRefineCoarsenAlgorithms( d_grain_quat_refine_op ); d_grain_extend_refine_alg.reset( - new xfer::RefineAlgorithm(tbox::Dimension(NDIM)) ); + new xfer::RefineAlgorithm() ); + d_grain_extend_refine_alg->registerRefine( d_grain_extend_scr_id, // destination d_grain_extend_id, // source @@ -365,16 +368,16 @@ void Grains::findAndNumberGrains( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::CellData > g ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); assert( g ); g->fillAll(-1); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; if ( (*phase)(cell) >= d_grain_phase_threshold ) { @@ -421,10 +424,10 @@ void Grains::findAndNumberGrains( const hier::Box& pbox (patch->getBox()); boost::shared_ptr< pdat::CellData > g ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > w ( - patch->getPatchData( weight_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( weight_id) ) ); #if 0 // optimized loop... int imin = pbox.lower(0); @@ -493,8 +496,8 @@ void Grains::findAndNumberGrains( } #else - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator ic(pbox, true); ic!=iend; ++ic ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); ic!=iend; ++ic ) { const pdat::CellIndex icell = *ic; const int n = (*g)(icell); const double v = (*w)(icell); @@ -561,13 +564,13 @@ void Grains::findAndNumberGrains( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > g ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > w ( - patch->getPatchData( weight_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( weight_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*g)(cell); double v = (*w)(cell); @@ -630,10 +633,10 @@ void Grains::findAndNumberGrains( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > g ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*g)(cell); @@ -680,13 +683,13 @@ void Grains::computeGrainVolumes( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > grain ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > wgt ( - patch->getPatchData( weight_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( weight_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*grain)(cell); double v = (*wgt)(cell); @@ -720,13 +723,13 @@ void Grains::computeGrainVolumes( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > g ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > v ( - patch->getPatchData( d_grain_volume_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_volume_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*g)(cell); @@ -776,16 +779,16 @@ void Grains::computeGrainConcentrations( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > grain ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > wgt ( - patch->getPatchData( weight_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( weight_id) ) ); boost::shared_ptr< pdat::CellData > conc ( - patch->getPatchData( conc_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( conc_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*grain)(cell); double w = (*wgt)(cell); @@ -838,16 +841,16 @@ void Grains::computeGrainConcentrations( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > grain ( - patch->getPatchData( d_grain_number_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_number_id) ) ); boost::shared_ptr< pdat::CellData > wgt ( - patch->getPatchData( weight_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( weight_id) ) ); boost::shared_ptr< pdat::CellData > conc ( - patch->getPatchData( conc_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( conc_id) ) ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; int n = (*grain)(cell); double w = (*wgt)(cell); @@ -953,15 +956,15 @@ void Grains::extendGrainOrientation( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::CellData > flag ( - patch->getPatchData( d_grain_extend_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_extend_id) ) ); flag->fillAll( 0 ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; if ( (*phase)(cell) >= d_grain_phase_threshold ) { @@ -998,21 +1001,21 @@ void Grains::extendGrainOrientation( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > flag ( - patch->getPatchData( d_grain_extend_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_extend_id) ) ); boost::shared_ptr< pdat::CellData > flag_scr ( - patch->getPatchData( d_grain_extend_scr_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_extend_scr_id) ) ); boost::shared_ptr< pdat::CellData > quat ( - patch->getPatchData( d_grain_quat_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_quat_id) ) ); boost::shared_ptr< pdat::CellData > quat_scr ( - patch->getPatchData( d_grain_quat_scr_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_grain_quat_scr_id) ) ); one_still_unset = 0; - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; bool this_cell_still_unset = false; @@ -1102,7 +1105,7 @@ void Grains::resetHierarchyConfiguration( const int nlev = hierarchy->getNumberOfLevels(); - d_grain_number_refine_sched.resizeArray( nlev ); + d_grain_number_refine_sched.resize( nlev ); if ( d_grain_diag_isActive ) for ( int ln = coarsest_level; ln <= finest_level; ln++ ) { @@ -1120,7 +1123,7 @@ void Grains::resetHierarchyConfiguration( d_grain_refine_strategy ); } - d_grain_number_coarsen_sched.resizeArray( hierarchy->getNumberOfLevels() ); + d_grain_number_coarsen_sched.resize( hierarchy->getNumberOfLevels() ); const int ln_beg = coarsest_level - (coarsest_level>0); const int ln_end = finest_level; @@ -1137,8 +1140,8 @@ void Grains::resetHierarchyConfiguration( finer_level ); } if ( d_grain_extend_isActive ) { - d_grain_extend_refine_sched.resizeArray( nlev ); - d_grain_quat_refine_sched.resizeArray( nlev ); + d_grain_extend_refine_sched.resize( nlev ); + d_grain_quat_refine_sched.resize( nlev ); for ( int ln = coarsest_level; ln <= finest_level; ln++ ) { boost::shared_ptr level = @@ -1158,8 +1161,8 @@ void Grains::resetHierarchyConfiguration( d_grain_refine_strategy ); } - d_grain_extend_coarsen_sched.resizeArray( hierarchy->getNumberOfLevels() ); - d_grain_quat_coarsen_sched.resizeArray( hierarchy->getNumberOfLevels() ); + d_grain_extend_coarsen_sched.resize( hierarchy->getNumberOfLevels() ); + d_grain_quat_coarsen_sched.resize( hierarchy->getNumberOfLevels() ); for ( int ln = ln_beg; ln < ln_end; ln++ ) { boost::shared_ptr level = diff --git a/source/Grains.h b/source/Grains.h index 5ccbe919..75149e34 100644 --- a/source/Grains.h +++ b/source/Grains.h @@ -148,17 +148,17 @@ private : boost::shared_ptr d_grain_quat_refine_alg; boost::shared_ptr d_grain_quat_coarsen_alg; - tbox::Array< boost::shared_ptr< xfer::RefineSchedule > > + std::vector< boost::shared_ptr< xfer::RefineSchedule > > d_grain_number_refine_sched; - tbox::Array< boost::shared_ptr< xfer::CoarsenSchedule > > + std::vector< boost::shared_ptr< xfer::CoarsenSchedule > > d_grain_number_coarsen_sched; - tbox::Array< boost::shared_ptr< xfer::RefineSchedule > > + std::vector< boost::shared_ptr< xfer::RefineSchedule > > d_grain_extend_refine_sched; - tbox::Array< boost::shared_ptr< xfer::CoarsenSchedule > > + std::vector< boost::shared_ptr< xfer::CoarsenSchedule > > d_grain_extend_coarsen_sched; - tbox::Array< boost::shared_ptr< xfer::RefineSchedule > > + std::vector< boost::shared_ptr< xfer::RefineSchedule > > d_grain_quat_refine_sched; - tbox::Array< boost::shared_ptr< xfer::CoarsenSchedule > > + std::vector< boost::shared_ptr< xfer::CoarsenSchedule > > d_grain_quat_coarsen_sched; int d_number_of_grains; diff --git a/source/HBSMFreeEnergyStrategy.C b/source/HBSMFreeEnergyStrategy.C index 33f7cad9..e4342d3f 100644 --- a/source/HBSMFreeEnergyStrategy.C +++ b/source/HBSMFreeEnergyStrategy.C @@ -463,13 +463,13 @@ void HBSMFreeEnergyStrategy::computeFreeEnergyPrivate( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > f ( - patch->getPatchData( f_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( f_id) ) ); boost::shared_ptr< pdat::CellData > c_i ( - patch->getPatchData( conc_i_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( conc_i_id) ) ); computeFreeEnergyPrivatePatch( pbox, @@ -501,13 +501,13 @@ void HBSMFreeEnergyStrategy::computeFreeEnergyPrivate( const hier::Box& pbox = patch.getBox(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > f ( - patch.getPatchData( f_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_id) ) ); boost::shared_ptr< pdat::CellData > c_i ( - patch.getPatchData( conc_i_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( conc_i_id) ) ); computeFreeEnergyPrivatePatch( pbox, @@ -536,13 +536,13 @@ void HBSMFreeEnergyStrategy::computeDerivFreeEnergyPrivate( const hier::Box& pbox = patch.getBox(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::CellData > df ( - patch.getPatchData( df_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( df_id) ) ); boost::shared_ptr< pdat::CellData > c_i ( - patch.getPatchData( conc_i_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( conc_i_id) ) ); computeDerivFreeEnergyPrivatePatch( pbox, @@ -742,31 +742,31 @@ void HBSMFreeEnergyStrategy::addComponentRhsPhi( } boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > t ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( t ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > c_l ( - patch.getPatchData( d_conc_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_id) ) ); assert( c_l ); boost::shared_ptr< pdat::CellData > c_a ( - patch.getPatchData( d_conc_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_id) ) ); assert( c_a ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -1003,47 +1003,47 @@ void HBSMFreeEnergyStrategy::addComponentRhsEta( assert( f_b_id >= 0 ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); assert( eta ); boost::shared_ptr< pdat::CellData > conc ( - patch.getPatchData(conc_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(conc_id) ) ); assert( conc ); boost::shared_ptr< pdat::CellData > t ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( t ); boost::shared_ptr< pdat::CellData > f_l ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( f_l ); boost::shared_ptr< pdat::CellData > f_a ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( f_a ); boost::shared_ptr< pdat::CellData > f_b ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); assert( f_b ); boost::shared_ptr< pdat::CellData > c_l ( - patch.getPatchData( d_conc_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_l_id) ) ); assert( c_l ); boost::shared_ptr< pdat::CellData > c_a ( - patch.getPatchData( d_conc_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_id) ) ); assert( c_a ); boost::shared_ptr< pdat::CellData > c_b ( - patch.getPatchData( d_conc_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_b_id) ) ); assert( c_b ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); const hier::Box& pbox = patch.getBox(); diff --git a/source/KKSCompositionRHSStrategy.C b/source/KKSCompositionRHSStrategy.C index b4fd0009..4d0d1f60 100644 --- a/source/KKSCompositionRHSStrategy.C +++ b/source/KKSCompositionRHSStrategy.C @@ -181,13 +181,13 @@ void KKSCompositionRHSStrategy::setDiffusionCoeffForConcentration( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); boost::shared_ptr< pdat::SideData > diffusion0 ( - patch->getPatchData( conc_diffusion0_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_diffusion0_id) ) ); int three_phase = 0; double* ptr_eta = NULL; @@ -236,23 +236,23 @@ void KKSCompositionRHSStrategy::setDiffusionCoeffForConcentration( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::SideData > sd_phi_diff_coeff ( - patch->getPatchData( conc_phase_coupling_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_phase_coupling_diffusion_id) ) ); boost::shared_ptr< pdat::SideData > sd_eta_diff_coeff; boost::shared_ptr< pdat::SideData > sd_d0_coeff ( - patch->getPatchData( conc_diffusion0_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_diffusion0_id) ) ); boost::shared_ptr< pdat::CellData > cd_phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::CellData > cd_eta; boost::shared_ptr< pdat::CellData > cd_c_l ( - patch->getPatchData( d_conc_l_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_l_scratch_id) ) ); boost::shared_ptr< pdat::CellData > cd_c_a ( - patch->getPatchData( d_conc_a_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_a_scratch_id) ) ); boost::shared_ptr< pdat::CellData > cd_c_b; @@ -808,8 +808,7 @@ void KKSCompositionRHSStrategy::computeFluxOnPatch( const int flux_id) { const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -817,23 +816,23 @@ void KKSCompositionRHSStrategy::computeFluxOnPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > conc ( - patch.getPatchData( d_conc_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_scratch_id) ) ); assert( conc ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData( d_phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_phase_scratch_id) ) ); assert( phase ); boost::shared_ptr< pdat::SideData > conc_diffusion0 ( - patch.getPatchData( d_diffusion0_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion0_id) ) ); assert( conc_diffusion0 ); boost::shared_ptr< pdat::SideData > conc_phase_coupling_diffusion ( - patch.getPatchData( d_conc_phase_coupling_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_conc_phase_coupling_diffusion_id) ) ); assert( conc_phase_coupling_diffusion ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); int three_phase = 0; @@ -845,8 +844,8 @@ void KKSCompositionRHSStrategy::computeFluxOnPatch( #endif if ( d_with_third_phase ) { three_phase = 1; - boost::shared_ptr< pdat::CellData > eta - ( patch.getPatchData( d_eta_scratch_id ), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::CellData > eta ( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch.getPatchData( d_eta_scratch_id) ) ); assert( eta ); ptr_eta = eta->getPointer(); } diff --git a/source/LinearMeltingTemperatureStrategy.C b/source/LinearMeltingTemperatureStrategy.C index 37dea748..92f2cb84 100644 --- a/source/LinearMeltingTemperatureStrategy.C +++ b/source/LinearMeltingTemperatureStrategy.C @@ -63,9 +63,9 @@ void LinearMeltingTemperatureStrategy::evaluate(hier::Patch& patch) const hier::Index ilast = patch.getBox().upper(); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( d_equilibrium_temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_equilibrium_temperature_id) ) ); boost::shared_ptr< pdat::CellData > concentration ( - patch.getPatchData( d_concentration_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_concentration_id) ) ); assert( temperature ); assert( concentration ); diff --git a/source/Makefile.in b/source/Makefile.in index 10e6aebe..774e9f5d 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -88,7 +88,7 @@ CXX_OBJS = DiffusionForConcInPhaseStrategy.o \ CompositionRHSStrategy.o \ GrainNumberRefinePatchStrategy.o Grains.o \ TemperatureFACSolver.o TemperatureFACOps.o \ - $(CALPHAD_OBJS) + FACPreconditioner.o $(CALPHAD_OBJS) MAIN_OBJ = main.o TEST_CALPHAD_BINARY_MAIN_OBJ = testCALPHADbinary.o diff --git a/source/MinIntCoarsen.C b/source/MinIntCoarsen.C index b67a0933..06326cb3 100644 --- a/source/MinIntCoarsen.C +++ b/source/MinIntCoarsen.C @@ -45,7 +45,7 @@ using namespace SAMRAI; using namespace std; MinIntCoarsen::MinIntCoarsen() - : hier::CoarsenOperator(tbox::Dimension(NDIM), "BASE_MIN_COARSEN") + : hier::CoarsenOperator("BASE_MIN_COARSEN") { d_name_id = "MINIMUM_COARSEN"; } @@ -59,8 +59,7 @@ bool MinIntCoarsen::findCoarsenOperator( const string &op_name) const { const boost::shared_ptr< pdat::CellVariable > cast_var( - var, - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellVariable, hier::Variable >( var ) ); if ( cast_var && (op_name == d_name_id) ) { return(true); } else { @@ -80,8 +79,8 @@ int MinIntCoarsen::getOperatorPriority() const } hier::IntVector -MinIntCoarsen::getStencilWidth() const { - return(hier::IntVector(tbox::Dimension(NDIM),0)); +MinIntCoarsen::getStencilWidth(const tbox::Dimension& dim) const { + return(hier::IntVector(dim,0)); } @@ -97,20 +96,18 @@ void MinIntCoarsen::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - boost::shared_ptr< pdat::CellData > - fdata ( fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::CellData > - cdata ( coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::CellData > fdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( fine.getPatchData(src_component) ) ); + boost::shared_ptr< pdat::CellData > cdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( coarse.getPatchData(dst_component) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert(fdata); assert(cdata); assert(cdata->getDepth() == fdata->getDepth()); #endif - pdat::CellIterator cend(coarse_box, false); - for ( pdat::CellIterator ci(coarse_box, true); ci != cend; ++ci ) { + pdat::CellIterator cend(pdat::CellGeometry::end(coarse_box)); + for ( pdat::CellIterator ci(pdat::CellGeometry::begin(coarse_box)); ci != cend; ++ci ) { pdat::CellIndex coarse_cell = *ci; hier::Index fine_lower = coarse_cell * ratio; hier::Index fine_upper = fine_lower + ratio - 1; @@ -119,8 +116,8 @@ void MinIntCoarsen::coarsen( (*cdata)(coarse_cell) = -1; - pdat::CellIterator fend(fine_box, false); - for ( pdat::CellIterator fi(fine_box, true); fi != fend; ++fi ) { + pdat::CellIterator fend(pdat::CellGeometry::end(fine_box)); + for ( pdat::CellIterator fi(pdat::CellGeometry::begin(fine_box)); fi != fend; ++fi ) { pdat::CellIndex fine_cell = *fi; int fine_val = (*fdata)(fine_cell); diff --git a/source/MinIntCoarsen.h b/source/MinIntCoarsen.h index d5060ad4..fe5c06e4 100644 --- a/source/MinIntCoarsen.h +++ b/source/MinIntCoarsen.h @@ -92,7 +92,7 @@ class MinIntCoarsen * The stencil width of the weighted averaging operator is the vector of * zeros. That is, its stencil does not extend outside the fine box. */ - hier::IntVector getStencilWidth() const; + hier::IntVector getStencilWidth(const tbox::Dimension& dim) const; /** * Coarsen the source component on the fine patch to the destination diff --git a/source/NKRHeatCapacityStrategy.C b/source/NKRHeatCapacityStrategy.C index 1b2e55fc..4f73ce73 100644 --- a/source/NKRHeatCapacityStrategy.C +++ b/source/NKRHeatCapacityStrategy.C @@ -114,11 +114,11 @@ void NKRHeatCapacityStrategy::setCurrentValue( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > conc ( - patch->getPatchData( d_composition_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_composition_id) ) ); boost::shared_ptr< pdat::CellData > temp ( - patch->getPatchData( d_temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); boost::shared_ptr< pdat::CellData > cp ( - patch->getPatchData( d_cp_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_cp_id) ) ); assert( conc ); assert( temp ); assert( cp ); diff --git a/source/PFModel.C b/source/PFModel.C index 291b1d5e..db78dbc2 100644 --- a/source/PFModel.C +++ b/source/PFModel.C @@ -70,7 +70,6 @@ PFModel::~PFModel() d_grid_geometry.reset(); d_gridding_algorithm.reset(); d_visit_data_writer.reset(); - d_tag_buffer_array.setNull(); } //======================================================================= @@ -225,11 +224,11 @@ void PFModel::Initialize( cart_db->putDatabaseBox( "domain_boxes", domain_box ); - tbox::Array x_lo = geo_db->getDoubleArray( "x_lo" ); - tbox::Array x_up = geo_db->getDoubleArray( "x_up" ); + std::vector x_lo = geo_db->getDoubleVector( "x_lo" ); + std::vector x_up = geo_db->getDoubleVector( "x_up" ); - cart_db->putDoubleArray( "x_lo", x_lo ); - cart_db->putDoubleArray( "x_up", x_up ); + cart_db->putDoubleVector( "x_lo", x_lo ); + cart_db->putDoubleVector( "x_up", x_up ); d_grid_geometry.reset( new geom::CartesianGridGeometry( tbox::Dimension(NDIM), @@ -296,7 +295,7 @@ void PFModel::Initialize( } boost::shared_ptr error_detector ( - new mesh::StandardTagAndInitialize(dim, + new mesh::StandardTagAndInitialize( "StandardTagAndInitialize", this, tag_db ) ); @@ -371,7 +370,7 @@ void PFModel::Initialize( RegisterWithVisit(); } - d_tag_buffer_array = tbox::Array(d_patch_hierarchy->getMaxNumberOfLevels()); + d_tag_buffer_array = std::vector(d_patch_hierarchy->getMaxNumberOfLevels()); } @@ -433,9 +432,7 @@ void PFModel::setupHierarchy( void ) for (int ln = 0; d_patch_hierarchy->levelCanBeRefined(ln) && !done; ln++) { d_gridding_algorithm->makeFinerLevel( - init_time, - initial_time, // indicates initial time - d_tag_buffer_array[ln] ); // tag buffer + d_tag_buffer_array[ln], initial_time, d_cycle, init_time); done = !(d_patch_hierarchy->finerLevelExists(ln)); } } @@ -604,9 +601,7 @@ void PFModel::Regrid( int fine_lev_before = d_patch_hierarchy->getFinestLevelNumber(); d_gridding_algorithm->regridAllFinerLevels( - 0, - d_time, - d_tag_buffer_array ); + 0, d_tag_buffer_array, d_cycle, d_time); int fine_lev_after = d_patch_hierarchy->getFinestLevelNumber(); @@ -644,7 +639,7 @@ void PFModel::computeGrainDiagnostics( void ) // Methods inherited from Serializable // -void PFModel::putToDatabase(const boost::shared_ptr& db )const +void PFModel::putToRestart(const boost::shared_ptr& db )const { assert( db ); diff --git a/source/PFModel.h b/source/PFModel.h index 6ab86608..2b887062 100644 --- a/source/PFModel.h +++ b/source/PFModel.h @@ -118,7 +118,7 @@ public : // // Methods inherited from Serializable // - virtual void putToDatabase(const boost::shared_ptr& db )const; + virtual void putToRestart(const boost::shared_ptr& db )const; //----------------------------------------------------------------------- // @@ -149,7 +149,7 @@ public : bool d_amr_enabled; - tbox::Array d_tag_buffer_array; + std::vector d_tag_buffer_array; bool d_all_periodic; bool d_periodic_flag[NDIM]; diff --git a/source/PartitionCoeffRefinePatchStrategy.C b/source/PartitionCoeffRefinePatchStrategy.C index c22be8b5..1d60f742 100644 --- a/source/PartitionCoeffRefinePatchStrategy.C +++ b/source/PartitionCoeffRefinePatchStrategy.C @@ -44,7 +44,7 @@ PartitionCoeffRefinePatchStrategy::PartitionCoeffRefinePatchStrategy( const string& object_name, boost::shared_ptr< tbox::Database > input_bc_db, const int partition_coeff_id ) - : xfer::RefinePatchStrategy(tbox::Dimension(NDIM)), + : xfer::RefinePatchStrategy(), d_object_name( object_name ), d_partition_coeff_id( partition_coeff_id ) { diff --git a/source/PartitionCoeffRefinePatchStrategy.h b/source/PartitionCoeffRefinePatchStrategy.h index 73091fb0..9c2344b8 100644 --- a/source/PartitionCoeffRefinePatchStrategy.h +++ b/source/PartitionCoeffRefinePatchStrategy.h @@ -111,9 +111,9 @@ class PartitionCoeffRefinePatchStrategy : (void) ratio; } - hier::IntVector getRefineOpStencilWidth() const + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension &dim) const { - return( hier::IntVector(tbox::Dimension(NDIM),1) ); + return( hier::IntVector(dim,1) ); } //@} diff --git a/source/PartitionCoefficientStrategy.C b/source/PartitionCoefficientStrategy.C index bfb51d69..129c0788 100644 --- a/source/PartitionCoefficientStrategy.C +++ b/source/PartitionCoefficientStrategy.C @@ -48,7 +48,7 @@ void PartitionCoefficientStrategy::evaluate( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > partition_coeff ( - patch->getPatchData( d_partition_coeff_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_partition_coeff_id) ) ); boost::shared_ptr< pdat::CellData > velocity; if( d_velocity_id>=0 ){ diff --git a/source/PartitionPhaseConcentrationsStrategy.C b/source/PartitionPhaseConcentrationsStrategy.C index 79591cf3..51fc3c1e 100644 --- a/source/PartitionPhaseConcentrationsStrategy.C +++ b/source/PartitionPhaseConcentrationsStrategy.C @@ -52,7 +52,7 @@ void PartitionPhaseConcentrationsStrategy::computePhaseConcentrationsOnPatch( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > cd_partition_coeff ( - patch->getPatchData( d_partition_coeff_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_partition_coeff_id) ) ); assert( cd_partition_coeff ); const double* const ptr_partition = cd_partition_coeff->getPointer(); diff --git a/source/PhaseConcentrationRefinePatchStrategy.C b/source/PhaseConcentrationRefinePatchStrategy.C index a168bbfe..3d0d7f96 100644 --- a/source/PhaseConcentrationRefinePatchStrategy.C +++ b/source/PhaseConcentrationRefinePatchStrategy.C @@ -46,7 +46,7 @@ PhaseConcentrationRefinePatchStrategy::PhaseConcentrationRefinePatchStrategy( const int conc_l_id, const int conc_a_id, const int conc_b_id ) - : xfer::RefinePatchStrategy(tbox::Dimension(NDIM)), + : xfer::RefinePatchStrategy(), d_object_name( object_name ), d_conc_l_id( conc_l_id ), d_conc_a_id( conc_a_id ), diff --git a/source/PhaseConcentrationRefinePatchStrategy.h b/source/PhaseConcentrationRefinePatchStrategy.h index f3665847..c248791d 100644 --- a/source/PhaseConcentrationRefinePatchStrategy.h +++ b/source/PhaseConcentrationRefinePatchStrategy.h @@ -113,9 +113,9 @@ class PhaseConcentrationRefinePatchStrategy : (void) ratio; } - hier::IntVector getRefineOpStencilWidth() const + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension& dim) const { - return( hier::IntVector(tbox::Dimension(NDIM),1) ); + return( hier::IntVector(dim,1) ); } //@} diff --git a/source/PhaseConcentrationsStrategy.C b/source/PhaseConcentrationsStrategy.C index 99eba28d..940dbb59 100644 --- a/source/PhaseConcentrationsStrategy.C +++ b/source/PhaseConcentrationsStrategy.C @@ -83,19 +83,18 @@ void PhaseConcentrationsStrategy::computePhaseConcentrations( hierarchy->getPatchLevel( amr_level ); for ( hier::PatchLevel::Iterator p(level->begin()); p!=level->end(); p++ ) { - boost::shared_ptr patch = - *p; - - const hier::Box& pbox = patch->getBox(); + boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); assert( temperature ); boost::shared_ptr< pdat::CellData > phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phi ); #ifdef DEBUG_CHECK_ASSERTIONS + const hier::Box& pbox = patch->getBox(); + SAMRAI::math::PatchCellDataNormOpsReal ops; double l2phi=ops.L2Norm(phi,pbox); assert( l2phi==l2phi ); @@ -110,15 +109,15 @@ void PhaseConcentrationsStrategy::computePhaseConcentrations( } boost::shared_ptr< pdat::CellData > concentration ( - patch->getPatchData( concentration_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( concentration_id) ) ); assert( concentration ); boost::shared_ptr< pdat::CellData > c_l ( - patch->getPatchData( d_conc_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_l_id) ) ); assert( c_l ); boost::shared_ptr< pdat::CellData > c_a ( - patch->getPatchData( d_conc_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_a_id) ) ); assert( c_a ); boost::shared_ptr< pdat::CellData > c_b; diff --git a/source/PhaseFACOps.C b/source/PhaseFACOps.C index bce0e660..af4221c3 100644 --- a/source/PhaseFACOps.C +++ b/source/PhaseFACOps.C @@ -124,7 +124,7 @@ void PhaseFACOps::setC( const hier::Box& patch_box = patch->getBox(); boost::shared_ptr< pdat::CellData > phi_data ( - patch->getPatchData( phi_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phi_id) ) ); boost::shared_ptr< pdat::CellData > eta_data; if ( d_with_third_phase ) { @@ -134,10 +134,10 @@ void PhaseFACOps::setC( } boost::shared_ptr< pdat::CellData > local_m_data ( - patch->getPatchData( d_m_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_m_id) ) ); boost::shared_ptr< pdat::CellData > cdata ( - patch->getPatchData( d_c_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_c_id) ) ); setCOnPatchPrivate( phi_data, diff --git a/source/PhaseFACSolver.C b/source/PhaseFACSolver.C index 5109a90d..b0c20c71 100644 --- a/source/PhaseFACSolver.C +++ b/source/PhaseFACSolver.C @@ -37,7 +37,7 @@ using namespace std; PhaseFACSolver::PhaseFACSolver ( const std::string &object_name, - PhaseFACOps* fac_ops, + boost::shared_ptr fac_ops, boost::shared_ptr database ) : EllipticFACSolver( object_name, fac_ops, database ) @@ -61,7 +61,8 @@ void PhaseFACSolver::setOperatorCoefficients( { t_set_op_coef->start(); - PhaseFACOps* phase_fac_ops = dynamic_cast( d_fac_ops ); + boost::shared_ptr phase_fac_ops ( + boost::dynamic_pointer_cast< PhaseFACOps, EllipticFACOps >( d_fac_ops ) ); phase_fac_ops->setOperatorCoefficients( phase_id, diff --git a/source/PhaseFACSolver.h b/source/PhaseFACSolver.h index 3d5d5b3d..a156ceed 100644 --- a/source/PhaseFACSolver.h +++ b/source/PhaseFACSolver.h @@ -47,7 +47,7 @@ class PhaseFACSolver PhaseFACSolver( const std::string &object_name, - PhaseFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr database = boost::shared_ptr() ); diff --git a/source/PhaseFluxStrategyAnisotropy.C b/source/PhaseFluxStrategyAnisotropy.C index 39c33568..2ba83bc7 100644 --- a/source/PhaseFluxStrategyAnisotropy.C +++ b/source/PhaseFluxStrategyAnisotropy.C @@ -49,17 +49,17 @@ void PhaseFluxStrategyAnisotropy::computeFluxes(const boost::shared_ptr patch = *ip; const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); - boost::shared_ptr > - phase ( patch->getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase ( + BOOST_CAST, hier::PatchData>( patch->getPatchData(phase_id) ) ); - boost::shared_ptr > - phase_flux ( patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase_flux ( + BOOST_CAST, hier::PatchData>( patch->getPatchData( flux_id) ) ); - boost::shared_ptr< pdat::CellData > - quat( patch->getPatchData( quat_id ), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::CellData > quat( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch->getPatchData( quat_id) ) ); const hier::Box& pbox = patch->getBox(); const hier::Index& ifirst = pbox.lower(); diff --git a/source/PhaseFluxStrategyIsotropic.C b/source/PhaseFluxStrategyIsotropic.C index c3245b41..1de6d4a0 100644 --- a/source/PhaseFluxStrategyIsotropic.C +++ b/source/PhaseFluxStrategyIsotropic.C @@ -18,16 +18,16 @@ void PhaseFluxStrategyIsotropic::computeFluxes(const boost::shared_ptr patch = *ip; const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); - boost::shared_ptr > - phase ( patch->getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase ( + BOOST_CAST, hier::PatchData>( patch->getPatchData(phase_id) ) ); assert( phase->getGhostCellWidth()[0]>0 ); - boost::shared_ptr > - phase_flux ( patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase_flux ( + BOOST_CAST, hier::PatchData>( patch->getPatchData( flux_id) ) ); const hier::Box& pbox = patch->getBox(); const hier::Index& ifirst = pbox.lower(); diff --git a/source/PhaseFluxStrategySimple.C b/source/PhaseFluxStrategySimple.C index 3b6404a0..8d7cbe9f 100644 --- a/source/PhaseFluxStrategySimple.C +++ b/source/PhaseFluxStrategySimple.C @@ -50,16 +50,16 @@ void PhaseFluxStrategySimple::computeFluxes(const boost::shared_ptr patch = *ip; const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); - boost::shared_ptr > - phase ( patch->getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase( + BOOST_CAST, hier::PatchData>(patch->getPatchData(phase_id) ) ); assert( phase->getGhostCellWidth()[0]>0 ); - boost::shared_ptr > - phase_flux ( patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > phase_flux ( + BOOST_CAST, hier::PatchData>( patch->getPatchData( flux_id) ) ); const hier::Box& pbox = patch->getBox(); const hier::Index& ifirst = pbox.lower(); diff --git a/source/PhaseFreeEnergyStrategy.C b/source/PhaseFreeEnergyStrategy.C index 952b94be..ba14b92e 100644 --- a/source/PhaseFreeEnergyStrategy.C +++ b/source/PhaseFreeEnergyStrategy.C @@ -100,7 +100,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergyLiquid( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fl ( - patch->getPatchData( fl_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fl_id) ) ); assert( fl ); fl->fillAll( d_f_l ); @@ -119,7 +119,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergyLiquid( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( fl_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fl_id) ) ); assert( fl ); fl->fillAll( d_f_l ); @@ -154,7 +154,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergySolidA( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fs ( - patch->getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_a ); @@ -173,7 +173,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergySolidA( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > fs ( - patch.getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_a ); @@ -208,7 +208,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergySolidB( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fs ( - patch->getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_b ); @@ -227,7 +227,7 @@ void PhaseFreeEnergyStrategy::computeFreeEnergySolidB( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > fs ( - patch.getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_b ); @@ -257,19 +257,19 @@ void PhaseFreeEnergyStrategy::addComponentRhsPhi( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -280,11 +280,11 @@ void PhaseFreeEnergyStrategy::addComponentRhsPhi( if ( d_with_third_phase ) { three_phase = 1; boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); ptr_eta = eta->getPointer(); boost::shared_ptr< pdat::CellData > fb ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); ptr_fb = fb->getPointer(); } @@ -332,27 +332,27 @@ void PhaseFreeEnergyStrategy::addComponentRhsEta( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); assert( eta ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > fb ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); assert( fb ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); diff --git a/source/QuatFACOps.C b/source/QuatFACOps.C index 5267035c..ee7a3a69 100644 --- a/source/QuatFACOps.C +++ b/source/QuatFACOps.C @@ -130,26 +130,6 @@ QuatFACOps::QuatFACOps( d_physical_bc_coef(NULL) , d_flux_scratch_id(-1), d_oflux_scratch_id(-1), - //d_sqrt_m_refine_operator(), - //d_sqrt_m_refine_algorithm(), - d_prolongation_refine_operator(), - d_prolongation_refine_algorithm(), - d_prolongation_refine_schedules(), - d_urestriction_coarsen_operator(), - d_urestriction_coarsen_algorithm(), - d_urestriction_coarsen_schedules(), - d_rrestriction_coarsen_operator(), - d_rrestriction_coarsen_algorithm(), - d_rrestriction_coarsen_schedules(), - d_flux_coarsen_operator(), - d_flux_coarsen_algorithm(), - d_flux_coarsen_schedules(), - d_ghostfill_refine_operator(), - d_ghostfill_refine_algorithm(), - d_ghostfill_refine_schedules(), - d_ghostfill_nocoarse_refine_operator(), - d_ghostfill_nocoarse_refine_algorithm(), - d_ghostfill_nocoarse_refine_schedules(), d_bc_helper( tbox::Dimension(NDIM), d_object_name+"::bc helper" ), d_enable_logging(false), d_verbose(false), @@ -424,8 +404,8 @@ QuatFACOps::initializeOperatorState( TBOX_ERROR(d_object_name << ": RHS component " << component << " does not\n" << "correspond to a variable.\n"); } - boost::shared_ptr > cell_var ( - var, boost::detail::dynamic_cast_tag()); + boost::shared_ptr > cell_var ( + BOOST_CAST,hier::Variable>(var) ); if ( !cell_var ) { TBOX_ERROR(d_object_name << ": RHS component " << component << " variable is not cell-centered double\n"); @@ -441,7 +421,7 @@ QuatFACOps::initializeOperatorState( << "correspond to a variable.\n"); } boost::shared_ptr > cell_var ( - var, boost::detail::dynamic_cast_tag()); + BOOST_CAST,hier::Variable>(var) ); if ( !cell_var ) { TBOX_ERROR(d_object_name << ": Solution component " << component << " variable is not cell-centered double\n"); @@ -461,8 +441,8 @@ QuatFACOps::initializeOperatorState( /* Some data checks can only be done if the data already exists. */ - boost::shared_ptr > cd ( - fd, boost::detail::dynamic_cast_tag()); + boost::shared_ptr > cd ( + BOOST_CAST, hier::PatchData>(fd) ); if ( !cd ) { TBOX_ERROR(d_object_name << ": RHS data component " << component << " is not cell-centered double\n"); @@ -478,7 +458,8 @@ QuatFACOps::initializeOperatorState( /* Some data checks can only be done if the data already exists. */ - boost::shared_ptr > cd ( ud, boost::detail::dynamic_cast_tag()); + boost::shared_ptr > cd ( + BOOST_CAST, hier::PatchData>(ud) ); if ( !cd ) { TBOX_ERROR(d_object_name << ": Solution data component " << component << " is not cell-centered double\n"); @@ -512,7 +493,7 @@ QuatFACOps::initializeOperatorState( * Initialize the coarse-fine boundary description for the * hierarchy. */ - d_cf_boundary.resizeArray(d_hierarchy->getNumberOfLevels()); + d_cf_boundary.resize(d_hierarchy->getNumberOfLevels()); hier::IntVector max_gcw(tbox::Dimension(NDIM),1); for ( int ln=d_ln_min; ln<=d_ln_max; ++ln ) { @@ -556,8 +537,9 @@ QuatFACOps::initializeOperatorState( * acceptable strings for looking up the refine operator. */ boost::shared_ptr geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST( d_hierarchy->getGridGeometry() ) ); + TBOX_ASSERT(geometry); + boost::shared_ptr< hier::Variable > variable; //vdb->mapIndexToVariable( d_sqrt_m_id, variable ); @@ -567,9 +549,9 @@ QuatFACOps::initializeOperatorState( for (int component=0; componentmapIndexToVariable( d_cell_scratch_id[component], variable ); - d_prolongation_refine_operator[component] = + d_prolongation_refine_operator.push_back( geometry->lookupRefineOperator( variable, - d_prolongation_method ); + d_prolongation_method ) ); d_urestriction_coarsen_operator[component] = d_rrestriction_coarsen_operator[component] = geometry->lookupCoarsenOperator(variable, @@ -626,7 +608,8 @@ QuatFACOps::initializeOperatorState( allocatePatchData(d_oflux_scratch_id); } - //d_sqrt_m_refine_algorithm.reset( new xfer::RefineAlgorithm(tbox::Dimension(NDIM))); + //d_sqrt_m_refine_algorithm.reset; + //d_sqrt_m_refine_algorithm-> // registerRefine( d_sqrt_m_id , // d_sqrt_m_id , @@ -639,20 +622,20 @@ QuatFACOps::initializeOperatorState( because we have deallocated the solver state above. */ for (int component=0; component registerRefine( solution.getComponentDescriptorIndex(0) , solution.getComponentDescriptorIndex(0) , @@ -837,12 +823,12 @@ QuatFACOps::computeFaceCoefs( for ( hier::PatchLevel::Iterator pi(level->begin()); pi!=level->end(); pi++ ) { boost::shared_ptr< hier::Patch > patch = *pi; - boost::shared_ptr< pdat::SideData > diffusion_coef_data - ( patch->getPatchData(diffusion_coef_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::SideData > grad_q_data - ( patch->getPatchData(grad_q_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::SideData > face_coef_data - ( patch->getPatchData(face_coef_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::SideData > diffusion_coef_data ( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(diffusion_coef_id) ) ); + boost::shared_ptr< pdat::SideData > grad_q_data ( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(grad_q_id) ) ); + boost::shared_ptr< pdat::SideData > face_coef_data ( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(face_coef_id) ) ); assert( diffusion_coef_data->getDepth() == 1 ); computeFaceCoefsOnPatch(*patch, epsilon_q, *diffusion_coef_data, *grad_q_data, @@ -871,12 +857,12 @@ QuatFACOps::computeDQuatDPhiFaceCoefs( for ( hier::PatchLevel::Iterator pi(level->begin()); pi!=level->end(); pi++ ) { boost::shared_ptr< hier::Patch > patch = *pi; - boost::shared_ptr< pdat::SideData > dprime_data - ( patch->getPatchData(dprime_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::CellData > phi_data - ( patch->getPatchData(phi_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::SideData > face_coef_data - ( patch->getPatchData(face_coef_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::SideData > dprime_data( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(dprime_id) ) ); + boost::shared_ptr< pdat::CellData > phi_data( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch->getPatchData(phi_id) ) ); + boost::shared_ptr< pdat::SideData > face_coef_data( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(face_coef_id) ) ); computeDQuatDPhiFaceCoefsOnPatch(*patch, *dprime_data, *phi_data, *face_coef_data); } @@ -944,19 +930,19 @@ QuatFACOps::setOperatorCoefficients( // Copy q solution to "local" array member - boost::shared_ptr > q_data - ( patch->getPatchData(q_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr > q_local_data - ( patch->getPatchData(d_q_local_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > q_data( + BOOST_CAST, hier::PatchData>( patch->getPatchData(q_id) ) ); + boost::shared_ptr > q_local_data( + BOOST_CAST, hier::PatchData>( patch->getPatchData(d_q_local_id) ) ); q_local_data->copy(*q_data); // Copy mobility to local array - boost::shared_ptr > mobility_data - ( patch->getPatchData(mobility_id), boost::detail::dynamic_cast_tag() ); - boost::shared_ptr > sqrt_m_data - ( patch->getPatchData(d_sqrt_m_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > mobility_data( + BOOST_CAST, hier::PatchData>( patch->getPatchData(mobility_id) ) ); + boost::shared_ptr > sqrt_m_data( + BOOST_CAST, hier::PatchData>( patch->getPatchData(d_sqrt_m_id) ) ); sqrt_m_data->copy(*mobility_data); takeSquareRootOnPatch(*sqrt_m_data); @@ -965,10 +951,10 @@ QuatFACOps::setOperatorCoefficients( // Copy mobility derivatives to local array - boost::shared_ptr< pdat::CellData > mobility_deriv_data - ( patch->getPatchData(mobility_deriv_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::CellData > m_deriv_data - ( patch->getPatchData(d_m_deriv_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::CellData > mobility_deriv_data( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch->getPatchData(mobility_deriv_id) ) ); + boost::shared_ptr< pdat::CellData > m_deriv_data( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch->getPatchData(d_m_deriv_id) ) ); m_deriv_data->copy(*mobility_deriv_data); } @@ -977,10 +963,10 @@ QuatFACOps::setOperatorCoefficients( // Copy face coef derivatives to local array - boost::shared_ptr< pdat::SideData > face_coef_deriv_data - ( patch->getPatchData(face_coef_deriv_id), boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::SideData > local_face_coef_deriv_data - ( patch->getPatchData(d_face_coef_deriv_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::SideData > face_coef_deriv_data( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(face_coef_deriv_id) ) ); + boost::shared_ptr< pdat::SideData > local_face_coef_deriv_data( + BOOST_CAST< pdat::SideData, hier::PatchData>( patch->getPatchData(d_face_coef_deriv_id) ) ); local_face_coef_deriv_data->copy(*face_coef_deriv_data); @@ -1028,7 +1014,7 @@ QuatFACOps::deallocateOperatorState() level_ptr->deallocatePatchData(d_face_coef_deriv_id); level_ptr->deallocatePatchData(d_face_coef_id); } - d_cf_boundary.resizeArray(0); + d_cf_boundary.resize(0); #ifdef DEBUG_CHECK_ASSERTIONS assert( d_quat_level_solver.size()>0 ); #endif @@ -1049,15 +1035,6 @@ QuatFACOps::deallocateOperatorState() d_flux_coarsen_algorithm.reset(); d_ghostfill_refine_algorithm.reset(); d_ghostfill_nocoarse_refine_algorithm.reset(); - - for (int component=0; component patch_geom ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box & patch_box( patch.getBox() ); const hier::Index & plower = patch_box.lower(); const hier::Index & pupper = patch_box.upper(); - const tbox::Array< hier::BoundaryBox > & bboxes = d_cf_boundary[patch_ln].getBoundaries(pn,1); + const std::vector< hier::BoundaryBox > & bboxes = d_cf_boundary[patch_ln].getBoundaries(pn,1); int nboxes=bboxes.getSize(); for (int bn=0; bn patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box & box = patch.getBox(); @@ -1576,7 +1552,7 @@ QuatFACOps::checkFluxPatchDataIndex() const boost::shared_ptr var; vdb.mapIndexToVariable(d_flux_id, var); boost::shared_ptr > flux_var ( - var, boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::SideVariable, hier::Variable >(var)); #ifdef DEBUG_CHECK_ASSERTIONS assert( flux_var ); #endif @@ -1732,7 +1708,7 @@ QuatFACOps::computeFluxOnPatch( //tbox::pout<<"QuatFACOps::computeFluxOnPatch() NOT using grad_q data..."< patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box & box = patch.getBox(); @@ -1807,10 +1783,6 @@ QuatFACOps::computeFluxOnPatch( const hier::Index& lower = box.lower(); const hier::Index& upper = box.upper(); - const hier::Box & q_gbox = gradq_data.getGhostBox(); - const hier::Index& qlower = q_gbox.lower(); - const hier::Index& qupper = q_gbox.upper(); - const hier::Box & d_gbox = face_coef_data.getGhostBox(); const hier::Index& dlower = d_gbox.lower(); const hier::Index& dupper = d_gbox.upper(); @@ -1863,7 +1835,7 @@ QuatFACOps::computeSymmetricFluxOnPatch( #endif boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box & box = patch.getBox(); @@ -2018,13 +1990,13 @@ QuatFACOps::computeCompositeResidualOnLevel( boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > q_data( - solution.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(solution.getComponentPatchData ( 0 , *patch ))); boost::shared_ptr > flux_data( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); boost::shared_ptr< pdat::SideData > face_coef_data( - patch->getPatchData( d_face_coef_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_face_coef_id) ) ); boost::shared_ptr > sqrt_m_data( - patch->getPatchData( d_sqrt_m_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_sqrt_m_id) ) ); computeSymmetricFluxOnPatch( *patch , @@ -2049,15 +2021,15 @@ QuatFACOps::computeCompositeResidualOnLevel( for ( hier::PatchLevel::Iterator pi(level->begin()); pi!=level->end(); pi++ ) { boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > q_data ( - solution.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(solution.getComponentPatchData ( 0 , *patch ))); boost::shared_ptr > q_rhs_data ( - rhs.getComponentPatchData ( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(rhs.getComponentPatchData ( 0 , *patch ))); boost::shared_ptr > q_residual_data ( - residual.getComponentPatchData( 0 , *patch ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(residual.getComponentPatchData( 0 , *patch ))); boost::shared_ptr > sqrt_m_data( - patch->getPatchData( d_sqrt_m_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_sqrt_m_id) ) ); boost::shared_ptr > flux_data( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); boost::shared_ptr > rotation_index; if( d_rotation_index_id>=0 ){ rotation_index = boost::dynamic_pointer_cast,hier::PatchData> @@ -2076,7 +2048,7 @@ QuatFACOps::computeCompositeResidualOnLevel( * avoid writing another loop for it. */ boost::shared_ptr > oflux_data ( - patch->getPatchData( d_oflux_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_oflux_scratch_id) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert( oflux_data ); #endif @@ -2104,7 +2076,7 @@ QuatFACOps::computeResidualOnPatch( pdat::CellData & q_residual_data) const { boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double *dx = patch_geom->getDx(); @@ -2251,9 +2223,9 @@ QuatFACOps::multiplyDQuatDPhiBlock( hier::Patch & patch = **pi; boost::shared_ptr > out_data ( - patch.getPatchData(out_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(out_id) ) ); boost::shared_ptr > phi_data ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(phase_id) ) ); const hier::Box & box = patch.getBox(); const hier::Index& lower = box.lower(); @@ -2375,13 +2347,13 @@ QuatFACOps::accumulateOperatorOnLevel( boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > flux_data ( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); boost::shared_ptr< pdat::SideData > face_coef_data( - patch->getPatchData( face_coef_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( face_coef_id) ) ); if( grad_q_id==-1 ){ boost::shared_ptr > q_data ( - patch->getPatchData(q_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(q_id) ) ); computeFluxOnPatch(*patch , level->getRatioToCoarserLevel() , @@ -2391,7 +2363,7 @@ QuatFACOps::accumulateOperatorOnLevel( }else{ //tbox::pout<<"call computeFluxOnPatch()..."< > grad_q_data ( - patch->getPatchData(grad_q_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(grad_q_id) ) ); computeFluxOnPatch(*patch , level->getRatioToCoarserLevel() , *face_coef_data , @@ -2415,16 +2387,16 @@ QuatFACOps::accumulateOperatorOnLevel( boost::shared_ptr< hier::Patch > patch = *pi; boost::shared_ptr > flux_data( - patch->getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( flux_id) ) ); boost::shared_ptr< pdat::CellData > mobility_data( - patch->getPatchData( mobility_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( mobility_id) ) ); boost::shared_ptr > q_rhs_data( - patch->getPatchData(rhs_q_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(rhs_q_id) ) ); if (project && d_qlen != 1) { boost::shared_ptr > q_data ( - patch->getPatchData(q_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(q_id) ) ); // Temporary to store lambda boost::shared_ptr > @@ -2455,7 +2427,7 @@ QuatFACOps::accumulateOperatorOnLevel( * avoid writing another loop for it. */ boost::shared_ptr > oflux_data ( - patch->getPatchData( d_oflux_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_oflux_scratch_id) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert( oflux_data ); #endif @@ -2480,7 +2452,7 @@ QuatFACOps::accumulateOperatorOnPatch( assert( d_rotation_index_id==-1 ); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double *dx = patch_geom->getDx(); @@ -2536,7 +2508,7 @@ QuatFACOps::accumulateProjectedOperatorOnPatch( const pdat::CellData & q_rhs_data ) const { boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); const double *dx = patch_geom->getDx(); @@ -2618,9 +2590,9 @@ QuatFACOps::multiplyMobilitySqrt(const int id) hier::Patch & patch = **pi; boost::shared_ptr > data ( - patch.getPatchData(id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(id) ) ); boost::shared_ptr > sqrt_m_data ( - patch.getPatchData(d_sqrt_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_sqrt_m_id) ) ); int ncomp = data->getDepth(); const hier::Box & gbox = data->getGhostBox(); @@ -2661,9 +2633,9 @@ QuatFACOps::divideMobilitySqrt(const int id) hier::Patch & patch = **pi; boost::shared_ptr > data ( - patch.getPatchData(id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(id) ) ); boost::shared_ptr > sqrt_m_data ( - patch.getPatchData(d_sqrt_m_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_sqrt_m_id) ) ); int ncomp = data->getDepth(); #ifdef DEBUG_CHECK_ASSERTIONS @@ -2717,11 +2689,11 @@ QuatFACOps::applyProjectionOnLevel( hier::Patch & patch = **pi; boost::shared_ptr > q_data ( - patch.getPatchData(q_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(q_id) ) ); boost::shared_ptr > corr_data ( - patch.getPatchData(corr_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(corr_id) ) ); boost::shared_ptr > err_data ( - patch.getPatchData(err_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(err_id) ) ); const hier::Box & box = patch.getBox(); const hier::Index& lower = box.lower(); @@ -2775,10 +2747,13 @@ QuatFACOps::xeqScheduleProlongation( int scr_id, int dest_ln ) { + //tbox::plog<<"xeqScheduleProlongation for component "< > d_cf_boundary; + std::vector > d_cf_boundary; /* @@ -860,43 +860,40 @@ class QuatFACOps * Various refine and coarsen objects used internally. */ - //boost::shared_ptr d_sqrt_m_refine_operator; - //boost::shared_ptr d_sqrt_m_refine_algorithm; - // Error prolongation (refinement) operator. - boost::shared_ptr d_prolongation_refine_operator[2]; + std::vector< boost::shared_ptr > d_prolongation_refine_operator; boost::shared_ptr d_prolongation_refine_algorithm[2]; - tbox::Array > + std::vector > d_prolongation_refine_schedules[2]; // Solution restriction (coarsening) operator. boost::shared_ptr d_urestriction_coarsen_operator[2]; boost::shared_ptr d_urestriction_coarsen_algorithm[2]; - tbox::Array > + std::vector > d_urestriction_coarsen_schedules[2]; // Residual restriction (coarsening) operator. boost::shared_ptr d_rrestriction_coarsen_operator[2]; boost::shared_ptr d_rrestriction_coarsen_algorithm[2]; - tbox::Array > + std::vector > d_rrestriction_coarsen_schedules[2]; // Coarsen operator for outerflux-to-flux boost::shared_ptr d_flux_coarsen_operator; boost::shared_ptr d_flux_coarsen_algorithm; - tbox::Array > + std::vector > d_flux_coarsen_schedules; // Refine operator for cell-like data from coarser level. boost::shared_ptr d_ghostfill_refine_operator; boost::shared_ptr d_ghostfill_refine_algorithm; - tbox::Array > + std::vector > d_ghostfill_refine_schedules; // Refine operator for cell-like data from same level. boost::shared_ptr d_ghostfill_nocoarse_refine_operator; boost::shared_ptr d_ghostfill_nocoarse_refine_algorithm; - tbox::Array > + std::vector > d_ghostfill_nocoarse_refine_schedules; @@ -937,7 +934,7 @@ class QuatFACOps * * See setPreconditioner(). */ - const solv::FACPreconditioner *d_solver; + const FACPreconditioner *d_solver; /* * Hierarchy cell operator diff --git a/source/QuatIntegrator.C b/source/QuatIntegrator.C index e9b18a8b..fbb48228 100644 --- a/source/QuatIntegrator.C +++ b/source/QuatIntegrator.C @@ -339,11 +339,11 @@ void QuatIntegrator::setupPreconditionersPhase(boost::shared_ptr phase_sys_solver_database->getBoolWithDefault( "verbose", false ); } - PhaseFACOps* fac_ops = + boost::shared_ptr fac_ops( new PhaseFACOps( d_name+"_QIPhaseFACOps", d_with_third_phase, - phase_sys_solver_database ); + phase_sys_solver_database ) ); d_phase_sys_solver.reset( new PhaseFACSolver( @@ -364,10 +364,10 @@ void QuatIntegrator::setupPreconditionersConcentration(boost::shared_ptrgetBoolWithDefault( "verbose", false ); } - ConcFACOps* fac_ops = + boost::shared_ptr fac_ops( new ConcFACOps( d_name+"_QIConcFACOps", - conc_sys_solver_database ); + conc_sys_solver_database ) ); d_conc_sys_solver.reset( new ConcFACSolver( @@ -387,10 +387,10 @@ void QuatIntegrator::setupPreconditionersEta(boost::shared_ptr i eta_sys_solver_database->getBoolWithDefault( "verbose", false ); } - EtaFACOps* fac_ops = + boost::shared_ptr fac_ops ( new EtaFACOps( d_name+"_QIEtaFACOps", - eta_sys_solver_database ); + eta_sys_solver_database ) ); d_eta_sys_solver.reset( new EtaFACSolver( @@ -411,10 +411,10 @@ void QuatIntegrator::setupPreconditionersTemperature(boost::shared_ptrgetBoolWithDefault( "verbose", false ); } - TemperatureFACOps* fac_ops = + boost::shared_ptr fac_ops ( new TemperatureFACOps( d_name+"_QITemperatureFACOps", - temperature_sys_solver_database ); + temperature_sys_solver_database ) ); d_temperature_sys_solver.reset( new TemperatureFACSolver( @@ -550,15 +550,15 @@ void QuatIntegrator::resetHierarchyConfiguration( { // tbox::pout<<"QuatIntegrator::resetHierarchyConfiguration()"<getNumberOfLevels()); + d_flux_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); - d_quat_diffusion_coarsen_schedule.resizeArray(hierarchy->getNumberOfLevels()); + d_quat_diffusion_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); if (d_precond_has_dquatdphi) { - d_quat_diffusion_deriv_coarsen_schedule.resizeArray(hierarchy->getNumberOfLevels()); + d_quat_diffusion_deriv_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); } - d_conc_diffusion_coarsen_schedule.resizeArray(hierarchy->getNumberOfLevels()); + d_conc_diffusion_coarsen_schedule.resize(hierarchy->getNumberOfLevels()); int ln_beg = coarsest_level - (coarsest_level>0); int ln_end = finest_level; @@ -2372,13 +2372,13 @@ void QuatIntegrator::setDiffusionCoeffForQuatPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phi ( - patch.getPatchData(d_phase_scratch_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(d_phase_scratch_id) ) ); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( d_temperature_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_temperature_scratch_id) ) ); boost::shared_ptr< pdat::SideData > diffusion ( - patch.getPatchData(d_quat_diffusion_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData(d_quat_diffusion_id) ) ); assert( diffusion->getDepth() == 1 ); #ifdef DEBUG_CHECK_ASSERTIONS @@ -2477,16 +2477,16 @@ void QuatIntegrator::setDerivDiffusionCoeffForQuatPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phi ( - patch.getPatchData( d_phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_phase_scratch_id) ) ); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( d_temperature_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_temperature_scratch_id) ) ); boost::shared_ptr< pdat::SideData > diffusion_deriv ( - patch.getPatchData( d_quat_diffusion_deriv_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_quat_diffusion_deriv_id) ) ); boost::shared_ptr< pdat::SideData > grad_q ( - patch.getPatchData(d_quat_grad_side_copy_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData(d_quat_grad_side_copy_id) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert( phi ); @@ -2573,7 +2573,7 @@ void QuatIntegrator::setUniformDiffusionCoeffForQuat( // evaluate vel at finest level boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); const double * dx = patch_geom->getDx(); double vel=1.; for(int i=0;i this_patch = *this_p; boost::shared_ptr< pdat::SideData > diffusion ( - this_patch->getPatchData(d_quat_diffusion_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(this_patch->getPatchData(d_quat_diffusion_id) ) ); diffusion->fillAll(dval); boost::shared_ptr< pdat::SideData > grad_side_copy_data ( - this_patch->getPatchData(d_quat_grad_side_copy_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(this_patch->getPatchData(d_quat_grad_side_copy_id) ) ); assert( grad_side_copy_data ); grad_side_copy_data->fillAll( alpha ); boost::shared_ptr< pdat::SideData > grad_side_data ( - this_patch->getPatchData(d_quat_grad_side_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(this_patch->getPatchData(d_quat_grad_side_id) ) ); assert( grad_side_data ); grad_side_data->fillAll( alpha ); @@ -2668,29 +2668,29 @@ void QuatIntegrator::evaluatePhaseRHS( d_f_a_id, false ); const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > phase_rhs ( - patch->getPatchData( phase_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_rhs_id) ) ); assert( phase_rhs ); boost::shared_ptr< pdat::CellData > fl ( - patch->getPatchData( d_f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch->getPatchData( d_f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_a_id) ) ); assert( fa ); boost::shared_ptr > phase_flux ( - patch->getPatchData( d_flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_flux_id) ) ); assert( phase_flux ); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); assert( temperature ); int with_orient = 0; @@ -2699,7 +2699,7 @@ void QuatIntegrator::evaluatePhaseRHS( with_orient = 1; assert( d_quat_grad_modulus_id >= 0 ); boost::shared_ptr< pdat::CellData > qgm ( - patch->getPatchData( d_quat_grad_modulus_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_grad_modulus_id) ) ); ptr_quat_grad_modulus = qgm->getPointer(); } @@ -2708,7 +2708,7 @@ void QuatIntegrator::evaluatePhaseRHS( if ( d_with_third_phase ) { three_phase = 1; boost::shared_ptr< pdat::CellData > eta ( - patch->getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( eta_id) ) ); ptr_eta = eta->getPointer(); } @@ -2774,7 +2774,7 @@ void QuatIntegrator::evaluatePhaseRHS( #endif boost::shared_ptr< pdat::CellData > phase_mobility ( - patch->getPatchData( d_phase_mobility_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_mobility_id) ) ); assert( phase_mobility ); mathops.multiply( phase_rhs, phase_mobility, phase_rhs, pbox ); @@ -2837,27 +2837,27 @@ void QuatIntegrator::evaluateEtaRHS( d_f_b_id, false ); const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > eta ( - patch->getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( eta_id) ) ); assert( eta ); boost::shared_ptr< pdat::CellData > eta_rhs ( - patch->getPatchData( eta_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( eta_rhs_id) ) ); assert( eta_rhs ); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); assert( temperature ); boost::shared_ptr > eta_flux ( - patch->getPatchData( d_flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData( d_flux_id) ) ); const hier::Box& pbox = patch->getBox(); const hier::Index& ifirst = pbox.lower(); @@ -2900,7 +2900,7 @@ void QuatIntegrator::evaluateEtaRHS( eta_rhs_id ); boost::shared_ptr< pdat::CellData > eta_mobility ( - patch->getPatchData( d_eta_mobility_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_eta_mobility_id) ) ); assert( eta_mobility ); mathops.multiply( eta_rhs, eta_mobility, eta_rhs, pbox ); @@ -2940,24 +2940,24 @@ void QuatIntegrator::evaluateTemperatureRHS( *ip; const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double * dx = patch_geom->getDx(); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); assert( temperature ); assert( temperature->getGhostCellWidth()[0]>0 ); boost::shared_ptr< pdat::CellData > cp ( - patch->getPatchData( d_cp_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_cp_id) ) ); assert( cp ); boost::shared_ptr< pdat::CellData > temperature_rhs ( - patch->getPatchData( temperature_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_rhs_id) ) ); assert( temperature_rhs ); boost::shared_ptr< pdat::CellData > phase_rhs ( - patch->getPatchData( phase_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_rhs_id) ) ); assert( phase_rhs ); const hier::Box& pbox = patch->getBox(); @@ -3034,16 +3034,16 @@ void QuatIntegrator::evaluateConcentrationRHS( boost::shared_ptr patch = *ip; const boost::shared_ptr patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double * dx = patch_geom->getDx(); boost::shared_ptr< pdat::SideData > flux ( - patch->getPatchData( d_flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_flux_id) ) ); assert( flux ); assert( flux->getDepth()==d_ncompositions ); boost::shared_ptr< pdat::CellData > conc_rhs ( - patch->getPatchData( conc_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( conc_rhs_id) ) ); assert( conc_rhs ); assert( conc_rhs->getDepth()==d_ncompositions ); assert( conc_rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -3107,12 +3107,12 @@ void QuatIntegrator::evaluateQuatRHS( const hier::Box box (patch->getBox()); boost::shared_ptr< pdat::CellData > rhs ( - patch->getPatchData( quat_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_rhs_id) ) ); boost::shared_ptr< pdat::CellData > nrhs ( - patch->getPatchData( d_q_rhs1_visit_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_q_rhs1_visit_id) ) ); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box,true); c!=cend; ++c) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c!=cend; ++c) { pdat::CellIndex cell = *c; (*nrhs)(cell) = 0.; for(int m=0;mgetBox()); boost::shared_ptr< pdat::CellData > rhs ( - patch->getPatchData( quat_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_rhs_id) ) ); boost::shared_ptr< pdat::CellData > nrhs ( - patch->getPatchData( d_modulus_q_rhs_visit_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_modulus_q_rhs_visit_id) ) ); - pdat::CellIterator cend(box, false); - for (pdat::CellIterator c(box,true); c!=cend; c++) { + pdat::CellIterator cend(pdat::CellGeometry::end(box)); + for (pdat::CellIterator c(pdat::CellGeometry::begin(box)); c!=cend; c++) { pdat::CellIndex cell = *c; (*nrhs)(cell) = 0.; for(int m=0;m h math::HierarchyCellDataOpsReal cellops( hierarchy ); - // Zero out the initial guess in the temporary solution array - cellops.setToScalar( d_phase_sol_id, 0., false ); +#ifdef DEBUG_CHECK_ASSERTIONS + assert( cellops.max(r_phase_id)==cellops.max(r_phase_id) ); +#endif // Copy the right-hand side (r_phase_id) to the temporary right-hand side array (d_phase_rhs_id) cellops.copyData( d_phase_rhs_id, r_phase_id, false ); + // Zero out the initial guess in the temporary solution array + cellops.setToScalar( d_phase_sol_id, 0., false ); + // Set the tolerance for the FAC solve as requested by integrator d_phase_sys_solver->setResidualTolerance( delta ); @@ -3904,15 +3909,15 @@ int QuatIntegrator::ConcentrationPrecondSolve( assert( r_conc_id >= 0 ); assert( ewt_conc_id >= 0 ); - // Zero out the initial guess in the temporary solution array - cellops.setToScalar( d_conc_sol_id, 0., false ); - // Copy the right-hand side to the temporary right-hand side array cellops.copyData( d_conc_rhs_id, r_conc_id, false ); // Set the tolerance for the FAC solve as requested by integrator d_conc_sys_solver->setResidualTolerance( delta ); + // Zero out the initial guess in the temporary solution array + cellops.setToScalar( d_conc_sol_id, 0., false ); + // Solve the concentration block system bool converged = d_conc_sys_solver->solveSystem( @@ -3940,7 +3945,6 @@ int QuatIntegrator::QuatPrecondSolve(boost::shared_ptr hi math::HierarchyCellDataOpsReal cellops( hierarchy ); #ifdef DEBUG_CHECK_ASSERTIONS assert( cellops.max(r_quat_id)==cellops.max(r_quat_id) ); - assert( cellops.max(d_quat_rhs_id)==cellops.max(d_quat_rhs_id) ); #endif if ( d_precond_has_dquatdphi ) { @@ -3979,7 +3983,7 @@ int QuatIntegrator::QuatPrecondSolve(boost::shared_ptr hi d_quat_rhs_id, ewt_quat_id ); - int retcode = (converged && retcode==0) ? 0 : 1; + int retcode = converged ? 0 : 1; // Copy solution from the local temporary to the output array, z_quat_id cellops.copyData( z_quat_id, d_quat_sol_id, false ); @@ -4064,7 +4068,8 @@ CVSpgmrPrecondSolve if ( d_precond_has_dquatdphi ) { // Copy the phase correction to an array with ghost cells and fill them - xfer::RefineAlgorithm copy_with_ghosts (tbox::Dimension(NDIM)); + xfer::RefineAlgorithm copy_with_ghosts ; + copy_with_ghosts.registerRefine( d_phase_sol_id, // destination z_phase_id, // source @@ -4269,7 +4274,7 @@ void QuatIntegrator::correctRhsForSymmetry( boost::shared_ptr patch = *p; boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); const hier::Box& box = patch->getBox(); @@ -4277,34 +4282,34 @@ void QuatIntegrator::correctRhsForSymmetry( const hier::Index& upper = box.upper(); boost::shared_ptr< pdat::CellData > q_data ( - patch->getPatchData( quat_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_id) ) ); assert( q_data ); boost::shared_ptr< pdat::SideData > face_coeff ( - patch->getPatchData( face_coeff_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( face_coeff_id) ) ); assert( face_coeff ); assert( face_coeff->getDepth() == d_qlen ); assert( face_coeff->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); boost::shared_ptr< pdat::SideData > quat_diffs ( - patch->getPatchData( d_quat_diffs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_diffs_id) ) ); assert( quat_diffs ); assert( quat_diffs->getDepth() == 2 * d_qlen ); assert( quat_diffs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > mobility ( - patch->getPatchData( d_quat_mobility_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_mobility_id) ) ); assert( mobility ); assert( mobility->getDepth() == 1 ); assert( mobility->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),1) ); boost::shared_ptr< pdat::CellData > rhs ( - patch->getPatchData( quat_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_rhs_id) ) ); assert( rhs ); assert( rhs->getDepth() == d_qlen ); boost::shared_ptr< pdat::SideData > rotation_index ( - patch->getPatchData( d_quat_symm_rotation_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); assert( rotation_index->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); diff --git a/source/QuatIntegrator.h b/source/QuatIntegrator.h index aec5c47c..1e11b19a 100644 --- a/source/QuatIntegrator.h +++ b/source/QuatIntegrator.h @@ -844,19 +844,19 @@ private : int d_tmp2_id; xfer::CoarsenAlgorithm d_quat_diffusion_coarsen; - tbox::Array > + std::vector > d_quat_diffusion_coarsen_schedule; xfer::CoarsenAlgorithm d_quat_diffusion_deriv_coarsen; - tbox::Array > + std::vector > d_quat_diffusion_deriv_coarsen_schedule; xfer::CoarsenAlgorithm d_conc_diffusion_coarsen; - tbox::Array > + std::vector > d_conc_diffusion_coarsen_schedule; xfer::CoarsenAlgorithm d_flux_coarsen_algorithm; - tbox::Array > + std::vector > d_flux_coarsen_schedule; xfer::CoarsenAlgorithm d_coarsen_alg; diff --git a/source/QuatLevelSolver.C b/source/QuatLevelSolver.C index b23a186e..05296627 100644 --- a/source/QuatLevelSolver.C +++ b/source/QuatLevelSolver.C @@ -359,8 +359,7 @@ void QuatLevelSolver::allocateHypreData() boost::shared_ptr level = d_hierarchy->getPatchLevel(d_ln); boost::shared_ptr grid_geometry( - d_hierarchy->getGridGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(d_hierarchy->getGridGeometry())); const hier::IntVector ratio = level->getRatioToLevelZero(); hier::IntVector periodic_shift = grid_geometry->getPeriodicShift(ratio); @@ -435,41 +434,49 @@ void QuatLevelSolver::allocateHypreData() HYPRE_SStructGridSetExtents(d_grid, PART, &lower[0], &upper[0]); } - if ( is_periodic ) { - #ifdef DEBUG_CHECK_ASSERTIONS + tbox::Dimension::dir_t d; + if (is_periodic) { const hier::BoxContainer& level_domain = level->getPhysicalDomain(hier::BlockId::zero()); hier::Box domain_bound(level_domain.front()); - for (hier::BoxContainer::const_iterator i(level_domain); + for (hier::BoxContainer::const_iterator i = level_domain.begin(); i != level_domain.end(); ++i) { - domain_bound.lower().min(i->lower()); - domain_bound.upper().max(i->upper()); + domain_bound.setLower( + hier::Index::min(domain_bound.lower(), i->lower())); + domain_bound.setUpper( + hier::Index::min(domain_bound.upper(), i->upper())); } - for (int d=0; d domain_bound.numberCells(d) ) { - TBOX_ERROR(d_object_name << ": Hypre currently requires\n" - <<"that grid size in periodic directions be\n" - <<"powers of two. (This requirement may go\n" - <<"away in future versions of hypre.)\n" - <<"Size problem in direction " << d << "\n" - <<"Domain bound is " << domain_bound << ",\n" - <<"Size of " << domain_bound.numberCells() << "\n"); + if (tmpi > domain_bound.numberCells(d)) { + TBOX_ERROR( + d_object_name << ": Hypre currently requires\n" + << "that grid size in periodic directions be\n" + << "powers of two. (This requirement may go\n" + << "away in future versions of hypre.)\n" + << "Size problem in direction " + << d << "\n" + << "Domain bound is " + << domain_bound << ",\n" + << "Size of " + << domain_bound.numberCells() << "\n"); } tmpi = tmpi ? tmpi << 1 : 1; } } } + } #endif - HYPRE_SStructGridSetPeriodic(d_grid, PART, &periodic_shift[0]); - } + HYPRE_SStructGridSetPeriodic(d_grid, PART, &periodic_shift[0]); // Set the variable type and number of variables on each part. HYPRE_SStructVariable * vartypes = new HYPRE_SStructVariable[1]; @@ -738,8 +745,8 @@ QuatLevelSolver::copyFromHypre( TBOX_ERROR(d_object_name<< ": Could not allocate values\n"); } - hier::Index& lower = box.lower(); - hier::Index& upper = box.upper(); + hier::Index lower = box.lower(); + hier::Index upper = box.upper(); HYPRE_SStructVectorGetBoxValues(src_vector, PART, &lower[0], &upper[0], depth, values); #if NDIM==2 @@ -807,8 +814,7 @@ QuatLevelSolver::setMatrixCoefficients( // Get the cell width array boost::shared_ptr pg( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * h = pg->getDx(); @@ -818,8 +824,8 @@ QuatLevelSolver::setMatrixCoefficients( to Hypre (whose prototypes don't accept const modifiers) */ hier::Box patch_box(patch.getBox()); - hier::Index& lower = patch_box.lower(); - hier::Index& upper = patch_box.upper(); + hier::Index lower = patch_box.lower(); + hier::Index upper = patch_box.upper(); int num_cells = patch_box.size(); Ak0 = boost::dynamic_pointer_cast, @@ -832,8 +838,8 @@ QuatLevelSolver::setMatrixCoefficients( pdat::CellData diagonal(patch_box, d_qlen, hier::IntVector(tbox::Dimension(NDIM),0)); pdat::SideData off_diagonal(patch_box, d_qlen, hier::IntVector(tbox::Dimension(NDIM),0)); - boost::shared_ptr > face_coef_data ( patch.getPatchData(face_coef_id), boost::detail::dynamic_cast_tag()); - + boost::shared_ptr > face_coef_data ( + BOOST_CAST, hier::PatchData>(patch.getPatchData(face_coef_id))); // Set the J_ij blocks for (int depth=0; depth > sqrt_mobility_data ( patch.getPatchData(sqrt_mobility_id), boost::detail::dynamic_cast_tag()); + + boost::shared_ptr > sqrt_mobility_data ( + BOOST_CAST,hier::PatchData>( patch.getPatchData(sqrt_mobility_id) ) ); + const hier::Box & m_gbox = sqrt_mobility_data->getGhostBox(); const hier::Index& mlower = m_gbox.lower(); const hier::Index& mupper = m_gbox.upper(); @@ -878,9 +886,9 @@ QuatLevelSolver::setMatrixCoefficients( * and rhs contribution (k0). */ { - const tbox::Array< hier::BoundaryBox >& surface_boxes = + const std::vector< hier::BoundaryBox >& surface_boxes = pg->getCodimensionBoundaries(1); - const int n_bdry_boxes = surface_boxes.getSize(); + const int n_bdry_boxes = surface_boxes.size(); for ( int n=0; n surface_boxes; + std::vector< hier::BoundaryBox > surface_boxes; if (NDIM == 2) { surface_boxes = d_cf_boundary->getEdgeBoundaries(pi->getGlobalId()); @@ -936,7 +944,7 @@ QuatLevelSolver::setMatrixCoefficients( surface_boxes = d_cf_boundary->getFaceBoundaries(pi->getGlobalId()); } - const int n_bdry_boxes = surface_boxes.getSize(); + const int n_bdry_boxes = surface_boxes.size(); for ( int n=0; n& bdry_boxes, + const std::vector< hier::BoundaryBox >& bdry_boxes, const solv::RobinBcCoefStrategy* robin_bc_coef, pdat::CellData& rhs ) { @@ -1113,11 +1121,10 @@ QuatLevelSolver::add_gAk0_toRhs( * to rhs. */ boost::shared_ptr >Ak0( - patch.getPatchData(d_Ak0_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch.getPatchData(d_Ak0_id) ) ); assert( Ak0->getDepth()==d_qlen); - const int n_bdry_boxes = bdry_boxes.getSize(); + const int n_bdry_boxes = bdry_boxes.size(); for (int n=0; n > q_solution_data_ ( - patch->getPatchData(q_solution_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::PatchData>(patch->getPatchData(q_solution_id) ) ); TBOX_ASSERT( q_solution_data_ ); TBOX_ASSERT( q_solution_data_->getDepth()==d_qlen ); @@ -1622,8 +1628,8 @@ QuatLevelSolver::solveSystem( for (hier::PatchLevel::iterator ip(level->begin()); ip != level->end(); ++ip) { const boost::shared_ptr& patch = *ip; - boost::shared_ptr > q_solution_data - ( patch->getPatchData(q_solution_id), boost::detail::dynamic_cast_tag()); + boost::shared_ptr > q_solution_data( + BOOST_CAST, hier::PatchData>( patch->getPatchData(q_solution_id) ) ); for (int depth=0; depth & bdry_boxes, + const std::vector< hier::BoundaryBox > & bdry_boxes, const solv::RobinBcCoefStrategy * robin_bc_coef, pdat::CellData & rhs ); diff --git a/source/QuatLinearRefine.C b/source/QuatLinearRefine.C index ceb777ad..b7b3cb1a 100644 --- a/source/QuatLinearRefine.C +++ b/source/QuatLinearRefine.C @@ -86,7 +86,7 @@ using namespace SAMRAI; QuatLinearRefine:: QuatLinearRefine( const int quat_symm_rotation_id ) -: hier::RefineOperator(tbox::Dimension(NDIM), "BASE_QUAT_LINEAR_REFINE") +: hier::RefineOperator("BASE_QUAT_LINEAR_REFINE") { d_name_id = "QUAT_LINEAR_REFINE"; d_quat_symm_rotation_id = quat_symm_rotation_id; @@ -101,8 +101,8 @@ bool QuatLinearRefine::findRefineOperator( const boost::shared_ptr& var, const string &op_name) const { - const boost::shared_ptr< pdat::CellVariable > cast_var(var, - boost::detail::dynamic_cast_tag()); + const boost::shared_ptr< pdat::CellVariable > cast_var( + BOOST_CAST, hier::Variable>(var) ); if ( cast_var && (op_name == d_name_id) ) { return(true); } else { @@ -122,8 +122,8 @@ int QuatLinearRefine::getOperatorPriority() const } hier::IntVector -QuatLinearRefine::getStencilWidth() const { - return(hier::IntVector(tbox::Dimension(NDIM),1)); +QuatLinearRefine::getStencilWidth(const tbox::Dimension& dim) const { + return(hier::IntVector(dim,1)); } void QuatLinearRefine::refine( @@ -140,7 +140,7 @@ void QuatLinearRefine::refine( TBOX_ASSERT(t_overlap != NULL); const hier::BoxContainer& boxes = t_overlap->getDestinationBoxContainer(); - for (hier::BoxContainer::const_iterator b(boxes); b != boxes.end(); ++b) { + for (hier::BoxContainer::const_iterator b=boxes.begin(); b != boxes.end(); ++b) { hier::Box fine_box(*b); fine_box.growUpper(hier::IntVector(ratio.getDim(), -1)); refine(fine, @@ -160,15 +160,13 @@ void QuatLinearRefine::refine( const hier::Box& fine_box, const hier::IntVector& ratio) const { - const tbox::Dimension& dim(getDim()); - TBOX_DIM_ASSERT_CHECK_DIM_ARGS4(dim, fine, coarse, fine_box, ratio); - - boost::shared_ptr< pdat::CellData > - cdata ( coarse.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::CellData > - fdata ( fine.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + const tbox::Dimension& dim(fine.getDim()); + TBOX_ASSERT_OBJDIM_EQUALITY3(fine, coarse, ratio); + + boost::shared_ptr< pdat::CellData > cdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( coarse.getPatchData(src_component) ) ); + boost::shared_ptr< pdat::CellData > fdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( fine.getPatchData(dst_component) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert(cdata); assert(fdata); @@ -184,18 +182,16 @@ void QuatLinearRefine::refine( const hier::Index& fihi = fdata->getGhostBox().upper(); const boost::shared_ptr cgeom( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(coarse.getPatchGeometry()) ); const boost::shared_ptr fgeom( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(fine.getPatchGeometry()) ); const hier::Box coarse_box = hier::Box::coarsen(fine_box, ratio); const hier::Index& ifirstf = fine_box.lower(); const hier::Index& ilastf = fine_box.upper(); boost::shared_ptr< pdat::SideData > rotation_index ( - coarse.getPatchData( d_quat_symm_rotation_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(coarse.getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); const hier::Box & rot_gbox = rotation_index->getGhostBox(); const hier::Index& r_lower = rot_gbox.lower(); diff --git a/source/QuatLinearRefine.h b/source/QuatLinearRefine.h index bc384e93..122a8ce4 100644 --- a/source/QuatLinearRefine.h +++ b/source/QuatLinearRefine.h @@ -93,7 +93,7 @@ class QuatLinearRefine * The stencil width of the linear interpolation operator is the vector * of zeros. That is, its stencil does not extend outside the fine box. */ - hier::IntVector getStencilWidth() const; + hier::IntVector getStencilWidth(const tbox::Dimension& dim) const; /** * Refine the source component on the coarse patch to the destination diff --git a/source/QuatModel.C b/source/QuatModel.C index 5cb85fc0..a7e07884 100644 --- a/source/QuatModel.C +++ b/source/QuatModel.C @@ -78,6 +78,8 @@ #include "SAMRAI/tbox/InputManager.h" #include "SAMRAI/math/PatchCellDataBasicOps.h" #include "SAMRAI/solv/LocationIndexRobinBcCoefs.h" +#include "SAMRAI/tbox/RestartManager.h" +#include "SAMRAI/hier/PatchDataRestartManager.h" #include "tools.h" @@ -896,7 +898,8 @@ void QuatModel::Initialize( else { const int max_levels = d_patch_hierarchy->getMaxNumberOfLevels(); - d_patch_hierarchy->getFromRestart(); + d_patch_hierarchy->initializeHierarchy(); + //d_patch_hierarchy->getFromRestart(); for (int ll = 0; ll < max_levels; ll++) { d_tag_buffer_array[ll] = 1; @@ -1092,8 +1095,10 @@ void QuatModel::initializeRefineCoarsenAlgorithms() "LINEAR_REFINE" ); } - d_curr_to_curr_refine_alg.reset( new xfer::RefineAlgorithm(tbox::Dimension(NDIM)) ); - d_curr_to_scr_refine_alg.reset( new xfer::RefineAlgorithm(tbox::Dimension(NDIM)) ); + d_curr_to_curr_refine_alg.reset( new xfer::RefineAlgorithm() ); + + d_curr_to_scr_refine_alg.reset( new xfer::RefineAlgorithm() ); + // curr to curr d_curr_to_curr_refine_alg->registerRefine( @@ -1326,7 +1331,9 @@ void QuatModel::initializeLevelFromData( int nvar=ncf.getVarCount(); tbox::plog << "Number of variables in NcFile: "< patch, // initialize phase boost::shared_ptr< pdat::CellData > phase_data ( - patch->getPatchData( d_phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_id) ) ); assert( phase_data ); #ifdef HAVE_NETCDF3 @@ -1597,8 +1601,8 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, ncPhase.getVar(startp, countp, vals); #endif - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; int ix = ccell(0) - x_lower; int iy = ccell(1) - y_lower; @@ -1614,8 +1618,7 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, // initialize eta if ( d_model_parameters.with_third_phase() ) { boost::shared_ptr< pdat::CellData > eta_data ( - patch->getPatchData( d_eta_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_eta_id) ) ); assert( eta_data ); #ifdef HAVE_NETCDF3 @@ -1628,8 +1631,8 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, ncEta.getVar(startp, countp, vals); #endif - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; int ix = ccell(0) - x_lower; int iy = ccell(1) - y_lower; @@ -1651,8 +1654,7 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, if ( !ncTemp.isNull() ){ #endif boost::shared_ptr< pdat::CellData > temp_data ( - patch->getPatchData( d_temperature_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); assert( temp_data ); #ifdef HAVE_NETCDF3 @@ -1664,8 +1666,8 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, #ifdef HAVE_NETCDF4 ncTemp.getVar(startp, countp, vals); #endif - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; int ix = ccell(0) - x_lower; int iy = ccell(1) - y_lower; @@ -1682,8 +1684,7 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, // initialize quaternion if ( d_model_parameters.with_orientation() ){ boost::shared_ptr< pdat::CellData > quat_data ( - patch->getPatchData( d_quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_id) ) ); assert( quat_data ); for ( int qq = 0; qq < d_qlen; qq++ ) { @@ -1702,8 +1703,8 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, ncQuat.getVar(startp, countp, vals); #endif - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; int ix = ccell(0) - x_lower; int iy = ccell(1) - y_lower; @@ -1721,8 +1722,7 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, // initialize concentration if ( d_model_parameters.with_concentration() ){ boost::shared_ptr< pdat::CellData > conc_data ( - patch->getPatchData( d_conc_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_id) ) ); assert( conc_data ); for ( int cc = 0; cc < d_ncompositions; cc++ ) { @@ -1741,8 +1741,8 @@ void QuatModel::initializePatchFromData(boost::shared_ptr patch, ncConc.getVar(startp, countp, vals); #endif - pdat::CellIterator iend(patch_box, false); - for ( pdat::CellIterator i(patch_box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(patch_box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(patch_box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; int ix = ccell(0) - x_lower; int iy = ccell(1) - y_lower; @@ -2419,28 +2419,25 @@ void QuatModel::registerOrientationVariables( void ) void QuatModel::registerPatchDataForRestart( void ) { - hier::VariableDatabase* variable_db = - hier::VariableDatabase::getDatabase(); - - variable_db->registerPatchDataForRestart( d_phase_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_phase_id ); if ( d_model_parameters.with_third_phase() ) { - variable_db->registerPatchDataForRestart( d_eta_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_eta_id ); } - variable_db->registerPatchDataForRestart( d_temperature_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_temperature_id ); if ( d_model_parameters.with_orientation() ){ - variable_db->registerPatchDataForRestart( d_quat_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_quat_id ); } if ( d_model_parameters.with_concentration() ){ - variable_db->registerPatchDataForRestart( d_conc_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_conc_id ); if ( d_model_parameters.concentrationModelNeedsPhaseConcentrations() ) { - variable_db->registerPatchDataForRestart( d_conc_l_id ); - variable_db->registerPatchDataForRestart( d_conc_a_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_conc_l_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_conc_a_id ); if ( d_model_parameters.with_third_phase() ) - variable_db->registerPatchDataForRestart( d_conc_b_id ); + hier::PatchDataRestartManager::getManager()->registerPatchDataForRestart( d_conc_b_id ); } } } @@ -3447,8 +3444,7 @@ void QuatModel::computeMinMaxQModulus( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > y ( - patch->getPatchData( d_quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_id) ) ); const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > q_norm_err; @@ -3457,8 +3453,8 @@ void QuatModel::computeMinMaxQModulus( ( patch->getPatchData(d_quat_norm_error_id) ); } - pdat::CellIterator iend(pbox, false); - for (pdat::CellIterator i(pbox, true); i!= iend; ++i) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!= iend; ++i) { pdat::CellIndex cell = *i; double qnorm2 = 0.; for ( int q = 0 ; q < d_qlen ; q++ ) { @@ -3489,7 +3485,7 @@ void QuatModel::computeMinMaxQModulus( void QuatModel::Regrid( const boost::shared_ptr hierarchy ) { - d_regrid_refine_alg.reset( new xfer::RefineAlgorithm(tbox::Dimension(NDIM)) ); + d_regrid_refine_alg.reset( new xfer::RefineAlgorithm() ); d_regrid_refine_alg->registerRefine( d_phase_id, // destination @@ -3620,10 +3616,10 @@ void QuatModel::Regrid( // Methods inherited from Serializable // -void QuatModel::putToDatabase( +void QuatModel::putToRestart( const boost::shared_ptr& db )const { - PFModel::putToDatabase( db ); + PFModel::putToRestart( db ); } //======================================================================= @@ -3773,21 +3769,18 @@ void QuatModel::initializeLevelData( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fl ( - patch->getPatchData( d_f_l_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_l_id) ) ); assert( fl ); fl->fillAll( d_model_parameters.free_energy_liquid() ); boost::shared_ptr< pdat::CellData > fa ( - patch->getPatchData( d_f_a_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_a_id) ) ); assert( fa ); fa->fillAll( d_model_parameters.free_energy_solid_A() ); if ( d_model_parameters.with_third_phase() ) { boost::shared_ptr< pdat::CellData > fb ( - patch->getPatchData( d_f_b_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_b_id) ) ); assert( fb ); fb->fillAll( d_model_parameters.free_energy_solid_B() ); } @@ -4102,8 +4095,7 @@ void QuatModel::AllocateAndZeroData( if ( zero_data ) { for ( hier::PatchLevel::iterator p(level->begin()); p != level->end(); ++p ) { boost::shared_ptr data ( - p->getPatchData( data_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< T, hier::PatchData>(p->getPatchData( data_id ) ) ); data->fillAll( 0 ); } } @@ -4146,7 +4138,7 @@ void QuatModel::resetHierarchyConfiguration( hierarchy->getPatchLevel( ln ); hier::BoxContainer bl( level->getBoxes() ); if ( bl.boxesIntersect() ) { - for ( hier::BoxContainer::iterator bli(bl); + for ( hier::BoxContainer::iterator bli=bl.begin(); bli != bl.end(); ++bli ) { tbox::pout << *bli << endl; @@ -4164,7 +4156,7 @@ void QuatModel::resetHierarchyConfiguration( d_integrator_quat_only->resetHierarchyConfiguration( hierarchy, coarsest_level, finest_level ); - d_curr_to_scr_refine_sched.resizeArray( nlev ); + d_curr_to_scr_refine_sched.resize( nlev ); for ( int ln = coarsest_level; ln <= finest_level; ln++ ) { boost::shared_ptr level = @@ -4276,9 +4268,8 @@ void QuatModel::tagGradientDetectorCells( (void) initial_error; (void) uses_richardson_extrapolation_too; - boost::shared_ptr< pdat::CellData > - tags ( patch.getPatchData( tag_index ), - boost::detail::dynamic_cast_tag() ); + boost::shared_ptr< pdat::CellData > tags( + BOOST_CAST< pdat::CellData, hier::PatchData>( patch.getPatchData( tag_index) ) ); assert( tags ); tags->fillAll( 0 ); @@ -4290,14 +4281,14 @@ void QuatModel::tagGradientDetectorCells( const hier::Index& tag_gbox_upper = tag_ghost_box.upper(); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch.getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch.getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); const double * dx = patch_geom->getDx(); if ( d_tag_phase ) { boost::shared_ptr< pdat::CellData > phase_grad ( - patch.getPatchData( d_phase_grad_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_phase_grad_cell_id) ) ); assert( phase_grad ); const hier::Box& gbox = phase_grad->getGhostBox(); @@ -4333,8 +4324,7 @@ void QuatModel::tagGradientDetectorCells( if ( d_tag_eta ) { boost::shared_ptr< pdat::CellData > eta_grad ( - patch.getPatchData( d_eta_grad_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_eta_grad_cell_id) ) ); assert( eta_grad ); const hier::Box& gbox = eta_grad->getGhostBox(); @@ -4371,8 +4361,7 @@ void QuatModel::tagGradientDetectorCells( if ( d_tag_quat ) { boost::shared_ptr< pdat::CellData > quat_grad ( - patch.getPatchData( d_quat_grad_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_quat_grad_cell_id) ) ); assert( quat_grad ); const hier::Box& gbox = quat_grad->getGhostBox(); @@ -4498,7 +4487,7 @@ void QuatModel::WriteInitialConditionsFile( void ) NcVar* nc_temp=NULL; #endif #ifdef HAVE_NETCDF4 - NcFile f; + NcFile* f; NcVar nc_phase; NcVar nc_eta; NcVar* nc_conc =new NcVar[d_ncompositions]; @@ -4514,8 +4503,8 @@ void QuatModel::WriteInitialConditionsFile( void ) } #endif #ifdef HAVE_NETCDF4 - f.open( d_initial_conditions_file_name, NcFile::replace ); - if( f.isNull()) { + f=new NcFile( d_initial_conditions_file_name, NcFile::replace ); + if( f->isNull()) { TBOX_ERROR("Cannot open file " << d_initial_conditions_file_name << endl); }else{ tbox::plog<<"Open/replace file "<addDim( "x", nx_prob ); + NcDim nc_ny = f->addDim( "y", ny_prob ); + NcDim nc_nz = f->addDim( "z", nz_prob ); + f->addDim( "qlen", d_qlen ); vector dims; dims.push_back(nc_nz); dims.push_back(nc_ny); dims.push_back(nc_nx); - nc_phase = f.addVar("phase", ncFloat, dims); + nc_phase = f->addVar("phase", ncFloat, dims); if( nc_phase.isNull() ){ TBOX_ERROR( "Could add variable 'phase'" << endl ); } if ( d_model_parameters.with_third_phase() ) { - nc_eta = f.addVar( "eta", ncFloat, dims); + nc_eta = f->addVar( "eta", ncFloat, dims); } if ( d_model_parameters.with_orientation() ) { @@ -4580,7 +4569,7 @@ void QuatModel::WriteInitialConditionsFile( void ) std::ostringstream o; o << "quat" << ii+1; nc_qcomp[ii] = - f.addVar( o.str(), ncFloat, dims); + f->addVar( o.str(), ncFloat, dims); } } @@ -4590,11 +4579,11 @@ void QuatModel::WriteInitialConditionsFile( void ) o << "concentration"; if( d_ncompositions>1 )o << ii+1; nc_conc[ii] = - f.addVar( o.str(), ncFloat, dims); + f->addVar( o.str(), ncFloat, dims); } } - nc_temp = f.addVar( "temperature", ncFloat, dims); + nc_temp = f->addVar( "temperature", ncFloat, dims); //cout<<"variables added on PE 0..."<isNull() ) { TBOX_ERROR("Cannot open file " << d_initial_conditions_file_name << endl); }else{ tbox::plog<<"Open/write file "<0..."<getVar( "phase" ); if ( d_model_parameters.with_third_phase() ) { - nc_eta = f.getVar( "eta" ); + nc_eta = f->getVar( "eta" ); } if ( d_model_parameters.with_orientation() ) { for ( int ii = 0; ii < d_qlen; ii++ ) { std::ostringstream o; o << "quat" << ii+1; - nc_qcomp[ii] = f.getVar( o.str() ); + nc_qcomp[ii] = f->getVar( o.str() ); } } @@ -4661,11 +4650,11 @@ void QuatModel::WriteInitialConditionsFile( void ) std::ostringstream o; o << "concentration"; if( d_ncompositions>1 )o << ii+1; - nc_conc[ii] = f.getVar( o.str() ); + nc_conc[ii] = f->getVar( o.str() ); } } - nc_temp = f.getVar( "temperature" ); + nc_temp = f->getVar( "temperature" ); #endif } // pp==0 or not @@ -4746,8 +4735,7 @@ void QuatModel::WriteInitialConditionsFile( void ) boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > phase_data ( - patch->getPatchData( d_phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_id) ) ); assert( phase_data ); const hier::Box& this_b = patch->getBox(); @@ -4783,8 +4771,7 @@ void QuatModel::WriteInitialConditionsFile( void ) #endif if ( d_model_parameters.with_third_phase() ) { boost::shared_ptr< pdat::CellData > eta_data ( - patch->getPatchData( d_eta_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_eta_id) ) ); assert( eta_data ); #ifdef HAVE_NETCDF3 @@ -4797,8 +4784,7 @@ void QuatModel::WriteInitialConditionsFile( void ) } boost::shared_ptr< pdat::CellData > temp_data ( - patch->getPatchData( d_temperature_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); assert( temp_data ); #ifdef HAVE_NETCDF3 @@ -4812,8 +4798,7 @@ void QuatModel::WriteInitialConditionsFile( void ) if ( d_model_parameters.with_orientation() ){ boost::shared_ptr< pdat::CellData > quat_data ( - patch->getPatchData( d_quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_id) ) ); assert( quat_data ); for ( int dd = 0; dd < d_qlen; dd++ ) { @@ -4829,8 +4814,7 @@ void QuatModel::WriteInitialConditionsFile( void ) if ( d_model_parameters.with_concentration() ){ boost::shared_ptr< pdat::CellData > conc_data ( - patch->getPatchData( d_conc_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_id) ) ); assert( conc_data ); for ( int dd = 0; dd < d_ncompositions; dd++ ) { @@ -4892,7 +4876,7 @@ QuatModel::FlattenHierarchy( //boxes.print(cout); - hier::BoxContainer::const_iterator boxes_itr(boxes); + hier::BoxContainer::const_iterator boxes_itr=boxes.begin(); for (int ib=0; ib < boxes.size(); ib++, boxes_itr++) { layer0.addBox(hier::Box(*boxes_itr, hier::LocalId(ib), layer0.getMPI().getRank())); } @@ -4903,8 +4887,7 @@ QuatModel::FlattenHierarchy( hier::PatchHierarchy tmp_hierarchy( "tmpPatchHierarchy", d_grid_geometry, - boost::shared_ptr(), - false ); + boost::shared_ptr() ); tmp_hierarchy.makeNewPatchLevel(level_number, layer0); boost::shared_ptr flattened_level = @@ -5000,19 +4983,17 @@ void QuatModel::computePhaseDiffs( const hier::Box& box = patch->getBox(); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( phase_diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( phase_diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > cell_diffs_data ( - patch->getPatchData( d_phase_diffs_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_diffs_cell_id) ) ); assert( cell_diffs_data ); - pdat::CellIterator iend(box, false); - for ( pdat::CellIterator i(box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; const pdat::SideIndex xside( ccell, pdat::SideIndex::X, pdat::SideIndex::Lower ); @@ -5106,29 +5087,25 @@ void QuatModel::smoothQuat( const hier::Index& ilast = box.upper(); boost::shared_ptr< pdat::CellData > quat ( - patch->getPatchData( d_quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_id) ) ); assert( quat ); assert( quat->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); boost::shared_ptr< pdat::CellData > quat_scratch ( - patch->getPatchData( d_quat_scratch_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_scratch_id) ) ); assert( quat_scratch ); assert( quat_scratch->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( d_quat_diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( d_phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_id) ) ); assert( phase ); assert( phase->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -5198,15 +5175,13 @@ void QuatModel::computeVarDiffs( const hier::Index& ilast = box.upper(); boost::shared_ptr< pdat::CellData > var_data ( - patch->getPatchData( var_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( var_id) ) ); assert( var_data ); assert( var_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -5372,15 +5347,13 @@ void QuatModel::computeVarGradCell( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > grad_cell_data ( - patch->getPatchData( grad_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( grad_cell_id) ) ); assert( grad_cell_data ); assert( grad_cell_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -5394,7 +5367,8 @@ void QuatModel::computeVarGradCell( const hier::Index& g_upper = grad_gbox.upper(); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); const double * dx = patch_geom->getDx(); @@ -5476,15 +5450,13 @@ void QuatModel::computeVarGradSide( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::SideData > grad_side_data ( - patch->getPatchData( grad_side_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( grad_side_id) ) ); assert( grad_side_data ); assert( grad_side_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -5498,7 +5470,8 @@ void QuatModel::computeVarGradSide( const hier::Index& g_upper = grad_gbox.upper(); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); const double * dx = patch_geom->getDx(); @@ -5597,16 +5570,14 @@ void QuatModel::computeQuatDiffs( const hier::Index& ilast = box.upper(); boost::shared_ptr< pdat::CellData > quat_data ( - patch->getPatchData( quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_id) ) ); assert( quat_data ); assert( quat_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); assert( quat_data->getDepth() == d_qlen ); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( quat_diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( quat_diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -5637,8 +5608,7 @@ void QuatModel::computeQuatDiffs( assert( d_quat_symm_rotation_id>=0 ); boost::shared_ptr< pdat::SideData > rotation_index ( - patch->getPatchData( d_quat_symm_rotation_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); assert( rotation_index->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -5669,17 +5639,15 @@ void QuatModel::computeQuatDiffs( if ( d_model_parameters.with_extra_visit_output() ) { boost::shared_ptr< pdat::CellData > cell_diffs_data ( - patch->getPatchData( d_quat_diffs_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_diffs_cell_id) ) ); assert( cell_diffs_data ); boost::shared_ptr< pdat::CellData > nonsymm_cell_diffs_data ( - patch->getPatchData( d_quat_nonsymm_diffs_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_nonsymm_diffs_cell_id) ) ); assert( nonsymm_cell_diffs_data ); - pdat::CellIterator iend(box, false); - for ( pdat::CellIterator i(box,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(box)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(box)); i!=iend; ++i ) { const pdat::CellIndex ccell = *i; const pdat::SideIndex xside( ccell, pdat::SideIndex::X, pdat::SideIndex::Lower ); @@ -5759,30 +5727,28 @@ void QuatModel::computeQuatGradCell( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( quat_diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( quat_diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > grad_cell_data ( - patch->getPatchData( grad_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( grad_cell_id) ) ); assert( grad_cell_data ); assert( grad_cell_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); assert( grad_cell_data->getDepth() == NDIM * d_qlen ); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); const double * dx = patch_geom->getDx(); if ( d_symmetry_aware ) { boost::shared_ptr< pdat::SideData > rotation_index ( - patch->getPatchData( d_quat_symm_rotation_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); assert( rotation_index->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -5892,30 +5858,28 @@ void QuatModel::computeQuatGradSide( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::SideData > diff_data ( - patch->getPatchData( quat_diffs_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( quat_diffs_id) ) ); assert( diff_data ); assert( diff_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::SideData > grad_side_data ( - patch->getPatchData( grad_side_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( grad_side_id) ) ); assert( grad_side_data ); assert( grad_side_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); assert( grad_side_data->getDepth() == NDIM * d_qlen ); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); const double * dx = patch_geom->getDx(); if ( d_symmetry_aware ) { boost::shared_ptr< pdat::SideData > rotation_index ( - patch->getPatchData( d_quat_symm_rotation_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); assert( rotation_index->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -6149,15 +6113,13 @@ void QuatModel::computeQuatGradModulus( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > grad_cell_data ( - patch->getPatchData( grad_cell_id), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( grad_cell_id) ) ); assert( grad_cell_data ); assert( grad_cell_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); boost::shared_ptr< pdat::CellData > grad_modulus_data ( - patch->getPatchData( grad_modulus_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( grad_modulus_id) ) ); assert( grad_modulus_data ); assert( grad_modulus_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -6221,15 +6183,13 @@ void QuatModel::computeQuatGradModulusFromSides( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::SideData > grad_side_data ( - patch->getPatchData( grad_side_id), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( grad_side_id) ) ); assert( grad_side_data ); assert( grad_side_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); boost::shared_ptr< pdat::CellData > grad_modulus_data ( - patch->getPatchData( grad_modulus_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( grad_modulus_id) ) ); assert( grad_modulus_data ); assert( grad_modulus_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -6305,15 +6265,14 @@ void QuatModel::normalizeQuat( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > quat ( - patch->getPatchData( quat_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( quat_id) ) ); assert( quat ); const hier::Box& gbox = quat->getGhostBox(); // issue:mew: Potentially replace this loop with fortran kernel. - pdat::CellIterator iend(gbox, false); - for (pdat::CellIterator i(gbox, true); i!=iend; ++i) { + pdat::CellIterator iend(pdat::CellGeometry::end(gbox)); + for (pdat::CellIterator i(pdat::CellGeometry::begin(gbox)); i!=iend; ++i) { pdat::CellIndex cell = *i; double qnorm2 = 0.; for ( int q = 0; q < d_qlen; q++ ) { @@ -6354,20 +6313,18 @@ void QuatModel::applyPolynomial( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > sdata ( - patch->getPatchData( src_cell_data_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( src_cell_data_id) ) ); assert( sdata ); const hier::Box& gbox = sdata->getGhostBox(); boost::shared_ptr< pdat::CellData > ddata ( - patch->getPatchData( dst_cell_data_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( dst_cell_data_id) ) ); assert( ddata ); // issue:mew: Potentially replace this loop with fortran kernel. - pdat::CellIterator iend(gbox, false); - for (pdat::CellIterator i(gbox, true); i!=iend; ++i) { + pdat::CellIterator iend(pdat::CellGeometry::end(gbox)); + for (pdat::CellIterator i(pdat::CellGeometry::begin(gbox)); i!=iend; ++i) { pdat::CellIndex cell = *i; const double phi = (*sdata)(cell); const double hphi = @@ -6424,13 +6381,11 @@ void QuatModel::computeUniformPhaseMobility( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > temp_data ( - patch->getPatchData( d_temperature_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); assert( temp_data ); boost::shared_ptr< pdat::CellData > mobility_data ( - patch->getPatchData( mobility_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( mobility_id) ) ); assert( mobility_data ); assert( mobility_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -6552,18 +6507,15 @@ void QuatModel::computeEtaMobility( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > temp_data ( - patch->getPatchData( d_temperature_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); assert( temp_data ); boost::shared_ptr< pdat::CellData > phase_data ( - patch->getPatchData( phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phase_data ); boost::shared_ptr< pdat::CellData > mobility_data ( - patch->getPatchData( mobility_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( mobility_id) ) ); assert( mobility_data ); if ( d_model_parameters.min_eta_mobility() == d_model_parameters.eta_mobility() && @@ -6721,15 +6673,13 @@ void QuatModel::computeQuatMobility( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phase_data ( - patch->getPatchData( phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phase_data ); assert( phase_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > mobility_data ( - patch->getPatchData( mobility_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( mobility_id) ) ); assert( mobility_data ); assert( mobility_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -6800,15 +6750,13 @@ void QuatModel::computeQuatMobilityDeriv( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > phase_data ( - patch->getPatchData( phase_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( phase_data ); assert( phase_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::CellData > mobility_deriv_data ( - patch->getPatchData( mobility_deriv_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( mobility_deriv_id) ) ); assert( mobility_deriv_data ); assert( mobility_deriv_data->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -6853,12 +6801,11 @@ void QuatModel::checkQuatNorm( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > y ( - patch->getPatchData(d_quat_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData(d_quat_id) ) ); const hier::Box& pbox = patch->getBox(); - pdat::CellIterator icend(pbox, false); - for (pdat::CellIterator ic(pbox, true); ic != icend; ++ic) { + pdat::CellIterator icend(pdat::CellGeometry::end(pbox)); + for (pdat::CellIterator ic(pdat::CellGeometry::begin(pbox)); ic != icend; ++ic) { pdat::CellIndex cell = *ic; double qnorm2 = 0.; for ( int q = 0; q < d_qlen; q++ ) { @@ -6923,8 +6870,9 @@ void QuatModel::computeVectorWeights( for ( hier::PatchLevel::iterator p(level->begin()); p != level->end(); ++p ) { boost::shared_ptr< hier::Patch > patch = *p; boost::shared_ptr< geom::CartesianPatchGeometry > patch_geometry ( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geometry); + const double* dx = patch_geometry->getDx(); double cell_vol = dx[0]; if (NDIM > 1) { @@ -6935,8 +6883,7 @@ void QuatModel::computeVectorWeights( } boost::shared_ptr< pdat::CellData > w ( - patch->getPatchData(d_weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData(d_weight_id) ) ); if ( !w ) { TBOX_ERROR(d_object_name << ": weight id must refer to a pdat::CellVariable"); @@ -6973,15 +6920,14 @@ void QuatModel::computeVectorWeights( for ( hier::PatchLevel::iterator p(level->begin()); p != level->end(); ++p ) { boost::shared_ptr< hier::Patch > patch = *p; - for (hier::BoxContainer::const_iterator i(coarsened_boxes); + for (hier::BoxContainer::const_iterator i=coarsened_boxes.begin(); i != coarsened_boxes.end(); ++i) { hier::Box coarse_box = *i; hier::Box intersection = coarse_box*( patch->getBox() ); if ( !intersection.empty() ) { boost::shared_ptr< pdat::CellData > w ( - patch->getPatchData(d_weight_id), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData(d_weight_id) ) ); w->fillAll(0.0, intersection); } // assignment only in non-empty intersection @@ -7089,8 +7035,9 @@ void QuatModel::evaluateEnergy( boost::shared_ptr patch = *p; boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); + const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch->getBox(); @@ -7100,8 +7047,7 @@ void QuatModel::evaluateEnergy( double* pgrad_quat[NDIM]; if ( d_model_parameters.with_orientation() ){ boost::shared_ptr< pdat::SideData > grad_quat ( - patch->getPatchData( d_quat_grad_side_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_grad_side_id) ) ); assert( grad_quat ); assert( grad_quat->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); for ( int d = 0; d < NDIM; d++ ) { @@ -7115,20 +7061,15 @@ void QuatModel::evaluateEnergy( } boost::shared_ptr< pdat::CellData > phase ( - patch->getPatchData( d_phase_scratch_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_scratch_id) ) ); boost::shared_ptr< pdat::CellData > weight ( - patch->getPatchData( d_weight_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_weight_id) ) ); boost::shared_ptr< pdat::CellData > fl ( - patch->getPatchData( d_f_l_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_l_id) ) ); boost::shared_ptr< pdat::CellData > fa ( - patch->getPatchData( d_f_a_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_a_id) ) ); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( d_temperature_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); int three_phase = 0; double* ptr_fb = NULL; @@ -7136,12 +7077,10 @@ void QuatModel::evaluateEnergy( if ( d_model_parameters.with_third_phase() ) { three_phase = 1; boost::shared_ptr< pdat::CellData > fb ( - patch->getPatchData( d_f_b_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_f_b_id) ) ); ptr_fb = fb->getPointer(); boost::shared_ptr< pdat::CellData > eta ( - patch->getPatchData( d_eta_scratch_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_eta_scratch_id) ) ); ptr_eta = eta->getPointer(); } @@ -7150,8 +7089,7 @@ void QuatModel::evaluateEnergy( if ( d_model_parameters.with_visit_energy_output() ) { per_cell = 1; boost::shared_ptr< pdat::CellData > energy ( - patch->getPatchData( d_energy_diag_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_energy_diag_id) ) ); ptr_energy = energy->getPointer(); } @@ -7260,15 +7198,13 @@ void QuatModel::computeSymmetryRotations( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > quat ( - patch->getPatchData( d_quat_scratch_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_scratch_id) ) ); assert( quat ); assert( quat->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); boost::shared_ptr< pdat::SideData > rotation_index ( - patch->getPatchData( d_quat_symm_rotation_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); assert( rotation_index->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),NGHOSTS) ); @@ -7293,12 +7229,11 @@ void QuatModel::computeSymmetryRotations( if ( d_model_parameters.with_extra_visit_output() ) { assert( d_quat_symm_rotation_cell_id>=0 ); boost::shared_ptr< pdat::CellData > cell_rot_data ( - patch->getPatchData( d_quat_symm_rotation_cell_id ), - boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_symm_rotation_cell_id) ) ); assert( cell_rot_data ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox, true); i!= iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!= iend; ++i ) { const pdat::CellIndex ccell = *i; const pdat::SideIndex xside( ccell, pdat::SideIndex::X, pdat::SideIndex::Lower ); @@ -7346,8 +7281,7 @@ void QuatModel::makeQuatFundamental( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > quat ( - patch->getPatchData( d_quat_id ), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_quat_id) ) ); assert( quat ); const hier::Box & quat_gbox = quat->getGhostBox(); const hier::Index& q_lower = quat_gbox.lower(); @@ -7449,7 +7383,8 @@ void QuatModel::fillPhaseConcentrationGhosts( void ) //tbox::pout<<"QuatModel::fillPhaseConcentrationGhosts"< refine_op = d_grid_geometry->lookupRefineOperator( @@ -7501,7 +7436,8 @@ void QuatModel::fillPartitionCoeffGhosts( void ) //tbox::pout<<"QuatModel::fillPartitionCoeffGhosts"< refine_op = d_grid_geometry->lookupRefineOperator( @@ -7597,16 +7533,13 @@ void QuatModel::computeVelocity(boost::shared_ptr patch, const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > grad_cell_data ( - patch->getPatchData( d_phase_grad_cell_id), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_phase_grad_cell_id) ) ); boost::shared_ptr< pdat::CellData > phi_dot_data ( - patch->getPatchData( phi_dot_id), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phi_dot_id) ) ); boost::shared_ptr< pdat::CellData > velocity_data ( - patch->getPatchData( d_velocity_id), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_velocity_id) ) ); assert( grad_cell_data ); assert( phi_dot_data ); @@ -7617,8 +7550,9 @@ void QuatModel::computeVelocity(boost::shared_ptr patch, assert( velocity_data->getGhostCellWidth()[0]==0 ); boost::shared_ptr< geom::CartesianPatchGeometry > patch_geom ( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag() ); + BOOST_CAST< geom::CartesianPatchGeometry , hier::PatchGeometry>(patch->getPatchGeometry()) ); + TBOX_ASSERT(patch_geom); + const double * dx = patch_geom->getDx(); const double threshold = 0.02/dx[0]; //tbox::pout<<"QuatModel::computeVelocity() with threshold "<& db )const; + virtual void putToRestart(const boost::shared_ptr& db )const; //----------------------------------------------------------------------- // @@ -777,7 +777,7 @@ private : boost::shared_ptr d_curr_to_curr_refine_alg; boost::shared_ptr d_curr_to_scr_refine_alg; - tbox::Array< boost::shared_ptr< xfer::RefineSchedule > > + std::vector< boost::shared_ptr< xfer::RefineSchedule > > d_curr_to_scr_refine_sched; QuatGradStrategy* d_quat_grad_strategy; diff --git a/source/QuatRefinePatchStrategy.C b/source/QuatRefinePatchStrategy.C index 7ef2e463..1a6f1107 100644 --- a/source/QuatRefinePatchStrategy.C +++ b/source/QuatRefinePatchStrategy.C @@ -48,7 +48,7 @@ QuatRefinePatchStrategy::QuatRefinePatchStrategy( const int quat_id, const int conc_id, const int temperature_id ) - : xfer::RefinePatchStrategy(tbox::Dimension(NDIM)), + : xfer::RefinePatchStrategy(), d_object_name( object_name ), d_phase_id( phase_id ), d_eta_id( eta_id ), diff --git a/source/QuatRefinePatchStrategy.h b/source/QuatRefinePatchStrategy.h index 3bad6e24..17428523 100644 --- a/source/QuatRefinePatchStrategy.h +++ b/source/QuatRefinePatchStrategy.h @@ -118,9 +118,9 @@ class QuatRefinePatchStrategy : (void) ratio; } - hier::IntVector getRefineOpStencilWidth() const + hier::IntVector getRefineOpStencilWidth(const tbox::Dimension &dim) const { - return( hier::IntVector(tbox::Dimension(NDIM),1) ); + return( hier::IntVector(dim,1) ); } //@} diff --git a/source/QuatSysSolver.C b/source/QuatSysSolver.C index e0cb9178..b74aaef9 100644 --- a/source/QuatSysSolver.C +++ b/source/QuatSysSolver.C @@ -66,7 +66,7 @@ QuatSysSolver::QuatSysSolver( boost::shared_ptr database ) : qlen(ql), d_object_name(object_name), - d_fac_ops(ql, object_name+"::fac_ops",database), + d_fac_ops(new QuatFACOps(ql, object_name+"::fac_ops",database)), d_fac_solver(object_name+"::fac_precond",d_fac_ops), d_bc_object(NULL), d_simple_bc(tbox::Dimension(NDIM),object_name+"::bc"), @@ -106,7 +106,7 @@ QuatSysSolver::QuatSysSolver( * The FAC operator optionally uses (via callback through the pointer * being supplied here) the FAC solver object to get data for logging. */ - d_fac_ops.setSolver((const solv::FACPreconditioner*)(&d_fac_solver)); + d_fac_ops->setSolver((const FACPreconditioner*)(&d_fac_solver)); if ( database ) { getFromInput(database); @@ -114,7 +114,6 @@ QuatSysSolver::QuatSysSolver( } - /* ************************************************************************* * * @@ -124,7 +123,6 @@ QuatSysSolver::QuatSysSolver( ************************************************************************* */ - QuatSysSolver::~QuatSysSolver() { deallocateSolverState(); @@ -194,8 +192,6 @@ QuatSysSolver::getFromInput(const boost::shared_ptr& input_db ) } - - void QuatSysSolver::initializeLevelData( const boost::shared_ptr hierarchy, const int level_number, @@ -208,7 +204,6 @@ void QuatSysSolver::initializeLevelData( } - /* ************************************************************************* * * @@ -224,9 +219,9 @@ void QuatSysSolver::initializeLevelData( void QuatSysSolver::initializeSolverState(const int q_soln_id, - const int q_rhs_id, - const int weight_id, - boost::shared_ptr< hier::PatchHierarchy > hierarchy) + const int q_rhs_id, + const int weight_id, + boost::shared_ptr< hier::PatchHierarchy > hierarchy) { TBOX_ASSERT(hierarchy); assert( q_soln_id>=0 ); @@ -239,7 +234,6 @@ QuatSysSolver::initializeSolverState(const int q_soln_id, } if(!d_solver_is_initialized){ - #ifdef DEBUG_CHECK_ASSERTIONS if ( q_soln_id < 0 || q_rhs_id < 0 || weight_id < 0 ) { TBOX_ERROR(d_object_name << ": Bad patch data id.\n"); @@ -350,7 +344,7 @@ QuatSysSolver::setBoundaries(const string& boundary_type, #endif d_simple_bc.setBoundaries(boundary_type, fluxes, flags, bdry_types); d_bc_object = &d_simple_bc; - d_fac_ops.setPhysicalBcCoefObject(d_bc_object); + d_fac_ops->setPhysicalBcCoefObject(d_bc_object); } @@ -381,7 +375,7 @@ QuatSysSolver::setOperatorCoefficients( } #endif - d_fac_ops.setOperatorCoefficients( + d_fac_ops->setOperatorCoefficients( time_step, epsilon_q, mobility_id, mobility_deriv_id, diff_coef_id, diff_coef_deriv_id, grad_q_id, q_id, quat_grad_floor, quat_smooth_floor_type ); @@ -392,8 +386,8 @@ QuatSysSolver::setOperatorCoefficients( bool QuatSysSolver::solveSystem(const int q_soln_id, - const int q_rhs_id, - const int q_ewt_id) + const int q_rhs_id, + const int q_ewt_id) { t_solve_system->start(); @@ -407,10 +401,10 @@ QuatSysSolver::solveSystem(const int q_soln_id, createVectorWrappers(q_soln_id, q_rhs_id, solution, rhs); - d_fac_ops.setWeightIds(q_ewt_id, d_weight_id); + d_fac_ops->setWeightIds(q_ewt_id, d_weight_id); // Divide by the square root of the mobility - d_fac_ops.divideMobilitySqrt(q_rhs_id); + d_fac_ops->divideMobilitySqrt(q_rhs_id); // setResidualTolerance(d_precond_tol); setMaxCycles(d_precond_maxiters); @@ -431,7 +425,7 @@ QuatSysSolver::solveSystem(const int q_soln_id, bool solver_rval = d_fac_solver.solveSystem( *solution, *rhs ); // Multiply by the square root of the mobility - d_fac_ops.multiplyMobilitySqrt(q_soln_id); + d_fac_ops->multiplyMobilitySqrt(q_soln_id); if ( d_bc_object == &d_simple_bc ) { /* @@ -446,7 +440,7 @@ QuatSysSolver::solveSystem(const int q_soln_id, printFACConvergenceFactors(solver_rval); } - d_fac_ops.setWeightIds(-1, -1); + d_fac_ops->setWeightIds(-1, -1); destroyVectorWrappers(solution, rhs); @@ -477,9 +471,10 @@ QuatSysSolver::evaluateRHS( assert( solution_id>=0 ); assert( rhs_id>=0 ); - d_fac_ops.evaluateRHS(epsilon_q, diffusion_coef_id, grad_q_id, grad_q_copy_id, quat_grad_floor, - quat_floor_type, mobility_id, rotations_id, solution_id, rhs_id, - use_gradq_for_flux); + d_fac_ops->evaluateRHS(epsilon_q, diffusion_coef_id, grad_q_id, grad_q_copy_id, + quat_grad_floor, quat_floor_type, mobility_id, + rotations_id, solution_id, rhs_id, + use_gradq_for_flux); } @@ -492,7 +487,7 @@ QuatSysSolver::multiplyDQuatDPhiBlock( assert( q_id>=0 ); assert( operator_q_id>=0 ); - d_fac_ops.multiplyDQuatDPhiBlock(q_id, operator_q_id); + d_fac_ops->multiplyDQuatDPhiBlock(q_id, operator_q_id); } @@ -507,12 +502,11 @@ QuatSysSolver::applyProjection(const int q_id, assert( err_id>=0 ); for (int ln=d_ln_max; ln>=d_ln_min; ln--) { - d_fac_ops.applyProjectionOnLevel(q_id, corr_id, err_id, ln); + d_fac_ops->applyProjectionOnLevel(q_id, corr_id, err_id, ln); } } - void QuatSysSolver::printFACConvergenceFactors(const int solver_ret) { @@ -528,12 +522,11 @@ QuatSysSolver::printFACConvergenceFactors(const int solver_ret) } - void QuatSysSolver::createVectorWrappers(int q_u, - int q_f, - boost::shared_ptr > & uv, - boost::shared_ptr > & fv) + int q_f, + boost::shared_ptr > & uv, + boost::shared_ptr > & fv) { #ifdef DEBUG_CHECK_ASSERTIONS assert( d_weight_id!=-1 ); @@ -559,8 +552,7 @@ QuatSysSolver::createVectorWrappers(int q_u, << q_u << "\n"); } boost::shared_ptr > cell_variable( - variable, - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::Variable>(variable)); if (!cell_variable) { TBOX_ERROR(d_object_name << ": hier::Patch data index " << q_u << " is not a cell-double variable.\n"); @@ -587,8 +579,7 @@ QuatSysSolver::createVectorWrappers(int q_u, << q_f << "\n"); } boost::shared_ptr > cell_variable( - variable, - boost::detail::dynamic_cast_tag()); + BOOST_CAST, hier::Variable>(variable)); if (!cell_variable) { TBOX_ERROR(d_object_name << ": hier::Patch data index " << q_f << " is not a cell-double variable.\n"); @@ -600,7 +591,6 @@ QuatSysSolver::createVectorWrappers(int q_u, } - /* *********************************************************************** * Delete the vector wrappers. Do not freeVectorComponents because * @@ -608,8 +598,9 @@ QuatSysSolver::createVectorWrappers(int q_u, *********************************************************************** */ void -QuatSysSolver::destroyVectorWrappers(boost::shared_ptr > & uv, - boost::shared_ptr > & fv) +QuatSysSolver::destroyVectorWrappers( + boost::shared_ptr > & uv, + boost::shared_ptr > & fv) { uv.reset(); fv.reset(); diff --git a/source/QuatSysSolver.I b/source/QuatSysSolver.I index b854af35..8296907a 100644 --- a/source/QuatSysSolver.I +++ b/source/QuatSysSolver.I @@ -39,43 +39,43 @@ SAMRAI_INLINE_KEYWORD void QuatSysSolver::setVerbose(const bool verbose) { d_verbose = verbose; - d_fac_ops.setVerbose(verbose); + d_fac_ops->setVerbose(verbose); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setProlongationMethod(const std::string & prolongation_method) { - d_fac_ops.setProlongationMethod(prolongation_method); + d_fac_ops->setProlongationMethod(prolongation_method); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setLevelSolverTolerance(double tol) { - d_fac_ops.setLevelSolverTolerance(tol); + d_fac_ops->setLevelSolverTolerance(tol); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setLevelSolverMaxIterations(int max_iterations) { - d_fac_ops.setLevelSolverMaxIterations(max_iterations); + d_fac_ops->setLevelSolverMaxIterations(max_iterations); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setCoarsestLevelSolverTolerance(double tol) { - d_fac_ops.setCoarsestLevelSolverTolerance(tol); + d_fac_ops->setCoarsestLevelSolverTolerance(tol); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setCoarsestLevelSolverMaxIterations(int max_iterations) { - d_fac_ops.setCoarsestLevelSolverMaxIterations(max_iterations); + d_fac_ops->setCoarsestLevelSolverMaxIterations(max_iterations); } SAMRAI_INLINE_KEYWORD void QuatSysSolver::setCoarseFineDiscretization(const std::string & coarsefine_method) { - d_fac_ops.setCoarseFineDiscretization(coarsefine_method); + d_fac_ops->setCoarseFineDiscretization(coarsefine_method); } SAMRAI_INLINE_KEYWORD void @@ -110,6 +110,6 @@ QuatSysSolver::getFACConvergenceFactors(double & avg_factor, SAMRAI_INLINE_KEYWORD void QuatSysSolver::setLogging(bool logging) { - d_fac_ops.enableLogging(logging); + d_fac_ops->enableLogging(logging); } diff --git a/source/QuatSysSolver.h b/source/QuatSysSolver.h index f8cc1858..ac8de829 100644 --- a/source/QuatSysSolver.h +++ b/source/QuatSysSolver.h @@ -302,7 +302,7 @@ class QuatSysSolver } #endif d_bc_object = bc_object; - d_fac_ops.setPhysicalBcCoefObject(d_bc_object); + d_fac_ops->setPhysicalBcCoefObject(d_bc_object); } void setOperatorCoefficients( @@ -478,11 +478,11 @@ class QuatSysSolver int getFaceDiffCoeffId() { - return d_fac_ops.getFaceDiffCoeffId(); + return d_fac_ops->getFaceDiffCoeffId(); } int getFaceDiffCoeffScratchId() { - return d_fac_ops.getFaceDiffCoeffScratchId(); + return d_fac_ops->getFaceDiffCoeffScratchId(); } private: @@ -527,13 +527,12 @@ class QuatSysSolver /* * FAC operator implementation */ - // QuatFACOps d_fac_ops; - QuatFACOps d_fac_ops; + boost::shared_ptr d_fac_ops; /* * The FAC solver used for the preconditioner */ - solv::FACPreconditioner d_fac_solver; + FACPreconditioner d_fac_solver; /* * Robin bc object in use. diff --git a/source/QuatWeightedAverage.C b/source/QuatWeightedAverage.C index 7ed97d5f..71f59a47 100644 --- a/source/QuatWeightedAverage.C +++ b/source/QuatWeightedAverage.C @@ -85,7 +85,7 @@ using namespace SAMRAI; QuatWeightedAverage::QuatWeightedAverage( const bool symmetry_aware, const int quat_symm_rotation_id ) - : hier::CoarsenOperator(tbox::Dimension(NDIM), "BASE_QUAT_COARSEN") + : hier::CoarsenOperator("BASE_QUAT_COARSEN") { d_name_id = "QUAT_COARSEN"; d_symmetry_aware = symmetry_aware; @@ -100,8 +100,8 @@ bool QuatWeightedAverage::findCoarsenOperator( const boost::shared_ptr< hier::Variable >& var, const string &op_name) const { - const boost::shared_ptr< pdat::CellVariable > cast_var(var, - boost::detail::dynamic_cast_tag()); + const boost::shared_ptr< pdat::CellVariable > cast_var( + BOOST_CAST, hier::Variable>( var ) ); if ( cast_var && (op_name == d_name_id) ) { return(true); } else { @@ -121,8 +121,8 @@ int QuatWeightedAverage::getOperatorPriority() const } hier::IntVector -QuatWeightedAverage::getStencilWidth() const { - return(hier::IntVector(tbox::Dimension(NDIM),0)); +QuatWeightedAverage::getStencilWidth(const tbox::Dimension& dim) const { + return(hier::IntVector(dim,0)); } void QuatWeightedAverage::coarsen( @@ -133,12 +133,10 @@ void QuatWeightedAverage::coarsen( const hier::Box& coarse_box, const hier::IntVector& ratio) const { - boost::shared_ptr< pdat::CellData > - fdata ( fine.getPatchData(src_component), - boost::detail::dynamic_cast_tag()); - boost::shared_ptr< pdat::CellData > - cdata ( coarse.getPatchData(dst_component), - boost::detail::dynamic_cast_tag()); + boost::shared_ptr< pdat::CellData > fdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( fine.getPatchData(src_component) ) ); + boost::shared_ptr< pdat::CellData > cdata ( + BOOST_CAST< pdat::CellData, hier::PatchData>( coarse.getPatchData(dst_component) ) ); #ifdef DEBUG_CHECK_ASSERTIONS assert(fdata); assert(cdata); @@ -151,11 +149,9 @@ void QuatWeightedAverage::coarsen( const hier::Index cihi = cdata->getGhostBox().upper(); const boost::shared_ptr fgeom ( - fine.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(fine.getPatchGeometry()) ); const boost::shared_ptr cgeom ( - coarse.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(coarse.getPatchGeometry()) ); const hier::Index ifirstc = coarse_box.lower(); const hier::Index ilastc = coarse_box.upper(); @@ -164,7 +160,7 @@ void QuatWeightedAverage::coarsen( if ( d_symmetry_aware ) { boost::shared_ptr< pdat::SideData > rotation_index ( - coarse.getPatchData( d_quat_symm_rotation_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(coarse.getPatchData( d_quat_symm_rotation_id) ) ); assert( rotation_index ); const hier::Box & rot_gbox = rotation_index->getGhostBox(); const hier::Index r_lower = rot_gbox.lower(); diff --git a/source/QuatWeightedAverage.h b/source/QuatWeightedAverage.h index 5650662b..4f043113 100644 --- a/source/QuatWeightedAverage.h +++ b/source/QuatWeightedAverage.h @@ -93,7 +93,7 @@ class QuatWeightedAverage * The stencil width of the weighted averaging operator is the vector of * zeros. That is, its stencil does not extend outside the fine box. */ - hier::IntVector getStencilWidth() const; + hier::IntVector getStencilWidth(const tbox::Dimension &dim) const; /** * Coarsen the source component on the fine patch to the destination diff --git a/source/ScalarTemperatureStrategy.C b/source/ScalarTemperatureStrategy.C index c01b6efa..bb2bbe61 100644 --- a/source/ScalarTemperatureStrategy.C +++ b/source/ScalarTemperatureStrategy.C @@ -113,12 +113,12 @@ void ScalarTemperatureStrategy::setCurrentTemperature( boost::shared_ptr patch = *p; boost::shared_ptr< pdat::CellData > t_data ( - patch->getPatchData( d_temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_id) ) ); t_data->fillAll( t ); boost::shared_ptr< pdat::CellData > ts_data ( - patch->getPatchData( d_temperature_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_scratch_id) ) ); ts_data->fillAll( t ); diff --git a/source/SpinodalCompositionRHSStrategy.C b/source/SpinodalCompositionRHSStrategy.C index 0d89be48..d4ef5a1f 100644 --- a/source/SpinodalCompositionRHSStrategy.C +++ b/source/SpinodalCompositionRHSStrategy.C @@ -97,8 +97,7 @@ void SpinodalCompositionRHSStrategy::computeFluxOnPatch( assert( d_eta_scratch_id>=0 ); const boost::shared_ptr patch_geom ( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -106,29 +105,29 @@ void SpinodalCompositionRHSStrategy::computeFluxOnPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > conc ( - patch.getPatchData( d_conc_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_scratch_id) ) ); assert( conc ); boost::shared_ptr< pdat::CellData > conca ( - patch.getPatchData( d_conc_a_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_a_scratch_id) ) ); assert( conca ); boost::shared_ptr< pdat::CellData > concb ( - patch.getPatchData( d_conc_b_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_b_scratch_id) ) ); assert( concb ); boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( d_eta_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_eta_scratch_id) ) ); assert( eta ); boost::shared_ptr< pdat::SideData > conc_diffusion ( - patch.getPatchData( d_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion_id) ) ); assert( conc_diffusion ); assert( conc_diffusion->getDepth()==(1) ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); assert( flux->getDepth()==1 ); @@ -202,13 +201,13 @@ void SpinodalCompositionRHSStrategy::setDiffusionForConc( *p; boost::shared_ptr< pdat::CellData > conc ( - patch->getPatchData( d_conc_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_scratch_id) ) ); boost::shared_ptr< pdat::CellData > temp ( - patch->getPatchData( d_temperature_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_temperature_scratch_id) ) ); boost::shared_ptr< pdat::SideData > diffusion ( - patch->getPatchData( d_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( d_diffusion_id) ) ); setDiffusionCoeffForConcOnPatch( conc, temp, diff --git a/source/SteadyStateTemperatureCompositionSource.C b/source/SteadyStateTemperatureCompositionSource.C index cf45121b..8fbe052b 100644 --- a/source/SteadyStateTemperatureCompositionSource.C +++ b/source/SteadyStateTemperatureCompositionSource.C @@ -94,11 +94,11 @@ void SteadyStateTemperatureCompositionSource::setCurrentTemperature( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > rhs ( - patch->getPatchData( d_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_rhs_id) ) ); boost::shared_ptr< pdat::CellData > conc ( - patch->getPatchData( d_composition_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_composition_id) ) ); boost::shared_ptr< pdat::CellData > cp ( - patch->getPatchData( d_cp_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_cp_id) ) ); FORT_SOURCE_TEMPERATURE( ifirst(0), ilast(0), diff --git a/source/SteadyStateTemperatureGaussianSource.C b/source/SteadyStateTemperatureGaussianSource.C index 0ddd6ff3..936d59d8 100644 --- a/source/SteadyStateTemperatureGaussianSource.C +++ b/source/SteadyStateTemperatureGaussianSource.C @@ -149,8 +149,7 @@ void SteadyStateTemperatureGaussianSource::setCurrentTemperature( boost::shared_ptr patch = *p; const boost::shared_ptr patch_geom( - patch->getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch->getPatchGeometry()) ); const double* dx = patch_geom->getDx(); const double* xlo = patch_geom->getXLower(); const double* xhi = patch_geom->getXUpper(); @@ -160,9 +159,9 @@ void SteadyStateTemperatureGaussianSource::setCurrentTemperature( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > rhs ( - patch->getPatchData( d_rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_rhs_id) ) ); boost::shared_ptr< pdat::CellData > cp ( - patch->getPatchData( d_cp_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_cp_id) ) ); FORT_INITGAUSSIAN_SOURCE(dx, xlo, xhi, ifirst(0), ilast(0), diff --git a/source/SteadyStateTemperatureGaussianSource.h b/source/SteadyStateTemperatureGaussianSource.h index e9813367..08bc45a8 100644 --- a/source/SteadyStateTemperatureGaussianSource.h +++ b/source/SteadyStateTemperatureGaussianSource.h @@ -79,21 +79,21 @@ class SteadyStateTemperatureGaussianSource: HeatCapacityStrategy* d_heat_capacity_strategy; // Gaussian parameters - double d_center[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center[3]; // Gaussian center at t=0 - double d_center0[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; - double d_periodic_length[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_center0[3]; + double d_periodic_length[3]; // velocity of Gaussian center - double d_velocity[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + double d_velocity[3]; // Gaussian in time for pulse double d_pulse_time; double d_pulse_width; boost::shared_ptr d_grid_geometry; - int d_periodic_flag[tbox::Dimension::MAXIMUM_DIMENSION_VALUE]; + int d_periodic_flag[3]; double d_source_peak; double d_standard_dev; diff --git a/source/SteadyStateTemperatureStrategy.C b/source/SteadyStateTemperatureStrategy.C index 5c30c3b3..bd002255 100644 --- a/source/SteadyStateTemperatureStrategy.C +++ b/source/SteadyStateTemperatureStrategy.C @@ -53,10 +53,10 @@ SteadyStateTemperatureStrategy::SteadyStateTemperatureStrategy( d_rhs_id = rhs_id; d_weight_id = weight_id; - TemperatureFACOps* fac_ops = + boost::shared_ptr fac_ops ( new TemperatureFACOps( "SteadyStateTemperatureStrategyFACOps", - temperature_sys_solver_database ); + temperature_sys_solver_database ) ); d_temperature_sys_solver = new TemperatureFACSolver( diff --git a/source/TemperatureFACSolver.C b/source/TemperatureFACSolver.C index 7e2e19ca..c59eeb5f 100644 --- a/source/TemperatureFACSolver.C +++ b/source/TemperatureFACSolver.C @@ -37,7 +37,7 @@ using namespace std; TemperatureFACSolver::TemperatureFACSolver ( const std::string &object_name, - TemperatureFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr database ) : EllipticFACSolver( object_name, fac_ops, database ) @@ -57,7 +57,8 @@ void TemperatureFACSolver::setOperatorCoefficients( t_set_op_coef->start(); - TemperatureFACOps* Temperature_fac_ops = dynamic_cast( d_fac_ops ); + boost::shared_ptr Temperature_fac_ops ( + boost::dynamic_pointer_cast( d_fac_ops ) ); Temperature_fac_ops->setOperatorCoefficients( m, c, d ); diff --git a/source/TemperatureFACSolver.h b/source/TemperatureFACSolver.h index d3c7a62b..c3658e84 100644 --- a/source/TemperatureFACSolver.h +++ b/source/TemperatureFACSolver.h @@ -47,7 +47,7 @@ class TemperatureFACSolver TemperatureFACSolver( const std::string &object_name, - TemperatureFACOps* fac_ops, + boost::shared_ptr fac_ops, const boost::shared_ptr database = boost::shared_ptr() ); diff --git a/source/TemperatureFreeEnergyStrategy.C b/source/TemperatureFreeEnergyStrategy.C index 45060ca7..096365e9 100644 --- a/source/TemperatureFreeEnergyStrategy.C +++ b/source/TemperatureFreeEnergyStrategy.C @@ -107,14 +107,14 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergyLiquid( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::CellData > fl ( - patch->getPatchData( fl_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fl_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > temperature ( - patch->getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( temperature_id) ) ); assert( temperature ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; (*fl)(cell) = computeValFreeEnergyLiquid((*temperature)(cell), 0.); } @@ -136,14 +136,14 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergyLiquid( const hier::Box& pbox = patch.getBox(); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( fl_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fl_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > temperature ( - patch.getPatchData( temperature_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( temperature_id) ) ); assert( temperature ); - pdat::CellIterator iend(pbox, false); - for ( pdat::CellIterator i(pbox,true); i!=iend; ++i ) { + pdat::CellIterator iend(pdat::CellGeometry::end(pbox)); + for ( pdat::CellIterator i(pdat::CellGeometry::begin(pbox)); i!=iend; ++i ) { pdat::CellIndex cell = *i; (*fl)(cell) = computeValFreeEnergyLiquid((*temperature)(cell), 0.); } @@ -168,7 +168,7 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergySolidA( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fs ( - patch->getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_a ); @@ -188,7 +188,7 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergySolidA( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > fs ( - patch.getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_a ); @@ -213,7 +213,7 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergySolidB( boost::shared_ptr patch = *ip; boost::shared_ptr< pdat::CellData > fs ( - patch->getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_b ); @@ -233,7 +233,7 @@ void TemperatureFreeEnergyStrategy::computeFreeEnergySolidB( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > fs ( - patch.getPatchData( fs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( fs_id) ) ); assert( fs ); fs->fillAll( d_f_b ); @@ -265,19 +265,19 @@ void TemperatureFreeEnergyStrategy::addComponentRhsPhi( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData(phase_id), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData(phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); @@ -288,11 +288,11 @@ void TemperatureFreeEnergyStrategy::addComponentRhsPhi( if ( d_with_third_phase ) { three_phase = 1; boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); ptr_eta = eta->getPointer(); boost::shared_ptr< pdat::CellData > fb ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); ptr_fb = fb->getPointer(); } @@ -340,27 +340,27 @@ void TemperatureFreeEnergyStrategy::addComponentRhsEta( (void) temperature_id; // unused boost::shared_ptr< pdat::CellData > eta ( - patch.getPatchData( eta_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( eta_id) ) ); assert( eta ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( phase_id) ) ); assert( phase ); boost::shared_ptr< pdat::CellData > fl ( - patch.getPatchData( f_l_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_l_id) ) ); assert( fl ); boost::shared_ptr< pdat::CellData > fa ( - patch.getPatchData( f_a_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_a_id) ) ); assert( fa ); boost::shared_ptr< pdat::CellData > fb ( - patch.getPatchData( f_b_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( f_b_id) ) ); assert( fb ); boost::shared_ptr< pdat::CellData > rhs ( - patch.getPatchData( rhs_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( rhs_id) ) ); assert( rhs ); assert( rhs->getGhostCellWidth() == hier::IntVector(tbox::Dimension(NDIM),0) ); diff --git a/source/UTRCCompositionRHSStrategy.C b/source/UTRCCompositionRHSStrategy.C index 0b0047f9..bfdc3754 100644 --- a/source/UTRCCompositionRHSStrategy.C +++ b/source/UTRCCompositionRHSStrategy.C @@ -153,15 +153,15 @@ void UTRCCompositionRHSStrategy::setDiffusionCoeffForConcentration( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > cd_phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); assert( cd_phi ); boost::shared_ptr< pdat::SideData > sd_diffusion0 ( - patch->getPatchData( conc_tilde_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_tilde_diffusion_id) ) ); assert( sd_diffusion0 ); boost::shared_ptr< pdat::CellData > cd_partition_coeff ( - patch->getPatchData( partition_coeff_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( partition_coeff_scratch_id) ) ); assert( cd_partition_coeff ); FORT_CONCENTRATIONDIFFUSIONUTRC( @@ -198,19 +198,19 @@ void UTRCCompositionRHSStrategy::setDiffusionCoeffForConcentration( const hier::Box& pbox = patch->getBox(); boost::shared_ptr< pdat::SideData > sd_phi_diff_coeff ( - patch->getPatchData( conc_phase_coupling_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_phase_coupling_diffusion_id) ) ); boost::shared_ptr< pdat::SideData > sd_d0_coeff ( - patch->getPatchData( conc_tilde_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch->getPatchData( conc_tilde_diffusion_id) ) ); boost::shared_ptr< pdat::CellData > cd_phi ( - patch->getPatchData( phase_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( phase_id) ) ); boost::shared_ptr< pdat::CellData > cd_c ( - patch->getPatchData( d_conc_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_conc_scratch_id) ) ); boost::shared_ptr< pdat::CellData > cd_k ( - patch->getPatchData( d_partition_coeff_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch->getPatchData( d_partition_coeff_scratch_id) ) ); setDiffusionCoeffForPhaseOnPatch( sd_phi_diff_coeff, @@ -447,8 +447,7 @@ void UTRCCompositionRHSStrategy::computeFluxOnPatch( const int flux_id) { const boost::shared_ptr patch_geom( - patch.getPatchGeometry(), - boost::detail::dynamic_cast_tag()); + BOOST_CAST(patch.getPatchGeometry()) ); const double * dx = patch_geom->getDx(); const hier::Box& pbox = patch.getBox(); @@ -456,23 +455,23 @@ void UTRCCompositionRHSStrategy::computeFluxOnPatch( const hier::Index& ilast = pbox.upper(); boost::shared_ptr< pdat::CellData > conc ( - patch.getPatchData( d_conc_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_conc_scratch_id) ) ); assert( conc ); boost::shared_ptr< pdat::CellData > phase ( - patch.getPatchData( d_phase_scratch_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::CellData, hier::PatchData>(patch.getPatchData( d_phase_scratch_id) ) ); assert( phase ); boost::shared_ptr< pdat::SideData > sd_conc_diffusion0 ( - patch.getPatchData( d_diffusion0_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_diffusion0_id) ) ); assert( sd_conc_diffusion0 ); boost::shared_ptr< pdat::SideData > sd_conc_phase_coupling_diffusion ( - patch.getPatchData( d_conc_phase_coupling_diffusion_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( d_conc_phase_coupling_diffusion_id) ) ); assert( sd_conc_phase_coupling_diffusion ); boost::shared_ptr< pdat::SideData > flux ( - patch.getPatchData( flux_id ), boost::detail::dynamic_cast_tag()); + BOOST_CAST< pdat::SideData, hier::PatchData>(patch.getPatchData( flux_id) ) ); assert( flux ); int three_phase = 0;